Merge tag 'AU_LINUX_ANDROID_JB_2.5.04.02.02.040.384' into cm-10.1

AU_LINUX_ANDROID_JB_2.5.04.02.02.040.384 based on quic/aosp/jb_2.5

Conflicts:
	drivers/media/video/msm/gemini/msm_gemini_hw.c
	drivers/media/video/msm/gemini/msm_gemini_hw.h
	drivers/media/video/msm/msm.c
	drivers/media/video/msm/msm_mctl.c
	drivers/media/video/msm/server/msm_cam_server.c
	drivers/media/video/msm/vfe/msm_vfe32.c
	include/media/msm_camera.h

Change-Id: I4995089fa838875cd0d7236c3f72f4a0148c6e35
diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index f7ade3b..59c080f 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -218,16 +218,16 @@
 Linux kernel development process currently consists of a few different
 main kernel "branches" and lots of different subsystem-specific kernel
 branches.  These different branches are:
-  - main 2.6.x kernel tree
-  - 2.6.x.y -stable kernel tree
-  - 2.6.x -git kernel patches
+  - main 3.x kernel tree
+  - 3.x.y -stable kernel tree
+  - 3.x -git kernel patches
   - subsystem specific kernel trees and patches
-  - the 2.6.x -next kernel tree for integration tests
+  - the 3.x -next kernel tree for integration tests
 
-2.6.x kernel tree
+3.x kernel tree
 -----------------
-2.6.x kernels are maintained by Linus Torvalds, and can be found on
-kernel.org in the pub/linux/kernel/v2.6/ directory.  Its development
+3.x kernels are maintained by Linus Torvalds, and can be found on
+kernel.org in the pub/linux/kernel/v3.x/ directory.  Its development
 process is as follows:
   - As soon as a new kernel is released a two weeks window is open,
     during this period of time maintainers can submit big diffs to
@@ -262,20 +262,20 @@
 	released according to perceived bug status, not according to a
 	preconceived timeline."
 
-2.6.x.y -stable kernel tree
+3.x.y -stable kernel tree
 ---------------------------
-Kernels with 4-part versions are -stable kernels. They contain
+Kernels with 3-part versions are -stable kernels. They contain
 relatively small and critical fixes for security problems or significant
-regressions discovered in a given 2.6.x kernel.
+regressions discovered in a given 3.x kernel.
 
 This is the recommended branch for users who want the most recent stable
 kernel and are not interested in helping test development/experimental
 versions.
 
-If no 2.6.x.y kernel is available, then the highest numbered 2.6.x
+If no 3.x.y kernel is available, then the highest numbered 3.x
 kernel is the current stable kernel.
 
-2.6.x.y are maintained by the "stable" team <stable@vger.kernel.org>, and
+3.x.y are maintained by the "stable" team <stable@vger.kernel.org>, and
 are released as needs dictate.  The normal release period is approximately
 two weeks, but it can be longer if there are no pressing problems.  A
 security-related problem, instead, can cause a release to happen almost
@@ -285,7 +285,7 @@
 documents what kinds of changes are acceptable for the -stable tree, and
 how the release process works.
 
-2.6.x -git patches
+3.x -git patches
 ------------------
 These are daily snapshots of Linus' kernel tree which are managed in a
 git repository (hence the name.) These patches are usually released
@@ -317,13 +317,13 @@
 accepted, or rejected.  Most of these patchwork sites are listed at
 http://patchwork.kernel.org/.
 
-2.6.x -next kernel tree for integration tests
+3.x -next kernel tree for integration tests
 ---------------------------------------------
-Before updates from subsystem trees are merged into the mainline 2.6.x
+Before updates from subsystem trees are merged into the mainline 3.x
 tree, they need to be integration-tested.  For this purpose, a special
 testing repository exists into which virtually all subsystem trees are
 pulled on an almost daily basis:
-	http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git
+	http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git
 	http://linux.f-seidel.de/linux-next/pmwiki/
 
 This way, the -next kernel gives a summary outlook onto what will be
diff --git a/Documentation/block/row-iosched.txt b/Documentation/block/row-iosched.txt
new file mode 100644
index 0000000..987bd88
--- /dev/null
+++ b/Documentation/block/row-iosched.txt
@@ -0,0 +1,117 @@
+Introduction
+============
+
+The ROW scheduling algorithm will be used in mobile devices as default
+block layer IO scheduling algorithm. ROW stands for "READ Over WRITE"
+which is the main requests dispatch policy of this algorithm.
+
+The ROW IO scheduler was developed with the mobile devices needs in
+mind. In mobile devices we favor user experience upon everything else,
+thus we want to give READ IO requests as much priority as possible.
+The main idea of the ROW scheduling policy is:
+If there are READ requests in pipe - dispatch them but don't starve
+the WRITE requests too much.
+
+Software description
+====================
+The requests are kept in queues according to their priority. The
+dispatching of requests is done in a Round Robin manner with a
+different slice for each queue. The dispatch quantum for a specific
+queue is defined according to the queues priority. READ queues are
+given bigger dispatch quantum than the WRITE queues, within a dispatch
+cycle.
+
+At the moment there are 6 types of queues the requests are
+distributed to:
+-	High priority READ queue
+-	High priority Synchronous WRITE queue
+-	Regular priority READ queue
+-	Regular priority Synchronous WRITE queue
+-	Regular priority WRITE queue
+-	Low priority READ queue
+
+If in a certain dispatch cycle one of the queues was empty and didn't
+use its quantum that queue will be marked as "un-served". If we're in a
+middle of a dispatch cycle dispatching from queue Y and a request
+arrives for queue X that was un-served in the previous cycle, if X's
+priority is higher than Y's, queue X will be preempted in the favor of
+queue Y. This won't mean that cycle is restarted. The "dispatched"
+counter of queue X will remain unchanged. Once queue Y uses up it's quantum
+(or there will be no more requests left on it) we'll switch back to queue X
+and allow it to finish it's quantum.
+
+For READ requests queues we allow idling in within a dispatch quantum in
+order to give the application a chance to insert more requests. Idling
+means adding some extra time for serving a certain queue even if the
+queue is empty. The idling is enabled if we identify the application is
+inserting requests in a high frequency.
+
+For idling on READ queues we use timer mechanism. When the timer expires,
+if there are requests in the scheduler we will signal the underlying driver
+(for example the MMC driver) to fetch another request for dispatch.
+
+The ROW algorithm takes the scheduling policy one step further, making
+it a bit more "user-needs oriented", by allowing the application to
+hint on the urgency of its requests. For example: even among the READ
+requests several requests may be more urgent for completion then others.
+The former will go to the High priority READ queue, that is given the
+bigger dispatch quantum than any other queue.
+
+ROW scheduler will support special services for block devices that
+supports High Priority Requests. That is, the scheduler may inform the
+device upon urgent requests using new callback make_urgent_request.
+In addition it will support rescheduling of requests that were
+interrupted. For example, if the device issues a long write request and
+a sudden high priority read interrupt pops in, the scheduler will
+inform the device about the urgent request, so the device can stop the
+current write request and serve the high priority read request. In such
+a case the device may also send back to the scheduler the reminder of
+the interrupted write request, such that the scheduler may continue
+sending high priority requests without the need to interrupt the
+ongoing write again and again. The write remainder will be sent later on
+according to the scheduler policy.
+
+Design
+======
+Existing algorithms (cfq, deadline) sort the io requests according LBA.
+When deciding on the next request to dispatch they choose the closest
+request to the current disk head position (from handling last
+dispatched request). This is done in order to reduce the disk head
+movement to a minimum.
+We feel that this functionality isn't really needed in mobile devices.
+Usually applications that write/read large chunks of data insert the
+requests in already sorted LBA order. Thus dealing with sort trees adds
+unnecessary complexity.
+
+We're planing to try this enhancement in the future to check if the
+performance is influenced by it.
+
+SMP/multi-core
+==============
+At the moment the code is acceded from 2 contexts:
+- Application context (from block/elevator layer): adding the requests.
+- Underlying driver context (for example the mmc driver thread): dispatching
+  the requests and notifying on completion.
+
+One lock is used to synchronize between the two. This lock is provided
+by the underlying driver along with the dispatch queue.
+
+Config options
+==============
+1. hp_read_quantum: dispatch quantum for the high priority READ queue
+2. rp_read_quantum: dispatch quantum for the regular priority READ queue
+3. hp_swrite_quantum: dispatch quantum for the high priority Synchronous
+   WRITE queue
+4. rp_swrite_quantum: dispatch quantum for the regular priority
+   Synchronous WRITE queue
+5. rp_write_quantum: dispatch quantum for the regular priority WRITE
+   queue
+6. lp_read_quantum: dispatch quantum for the low priority READ queue
+7. lp_swrite_quantum: dispatch quantum for the low priority Synchronous
+   WRITE queue
+8. read_idle: how long to idle on read queue in Msec (in case idling
+   is enabled on that queue).
+9. read_idle_freq: frequency of inserting READ requests that will
+   trigger idling. This is the time in Msec between inserting two READ
+   requests
+
diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt
index 6aed1ce..92bbd16 100644
--- a/Documentation/cpu-freq/governors.txt
+++ b/Documentation/cpu-freq/governors.txt
@@ -198,57 +198,84 @@
 
 The CPUfreq governor "interactive" is designed for latency-sensitive,
 interactive workloads. This governor sets the CPU speed depending on
-usage, similar to "ondemand" and "conservative" governors.  However,
-the governor is more aggressive about scaling the CPU speed up in
-response to CPU-intensive activity.
-
-Sampling the CPU load every X ms can lead to under-powering the CPU
-for X ms, leading to dropped frames, stuttering UI, etc.  Instead of
-sampling the cpu at a specified rate, the interactive governor will
-check whether to scale the cpu frequency up soon after coming out of
-idle.  When the cpu comes out of idle, a timer is configured to fire
-within 1-2 ticks.  If the cpu is very busy between exiting idle and
-when the timer fires then we assume the cpu is underpowered and ramp
-to MAX speed.
-
-If the cpu was not sufficiently busy to immediately ramp to MAX speed,
-then governor evaluates the cpu load since the last speed adjustment,
-choosing the highest value between that longer-term load or the
-short-term load since idle exit to determine the cpu speed to ramp to.
+usage, similar to "ondemand" and "conservative" governors, but with a
+different set of configurable behaviors.
 
 The tuneable values for this governor are:
 
+target_loads: CPU load values used to adjust speed to influence the
+current CPU load toward that value.  In general, the lower the target
+load, the more often the governor will raise CPU speeds to bring load
+below the target.  The format is a single target load, optionally
+followed by pairs of CPU speeds and CPU loads to target at or above
+those speeds.  Colons can be used between the speeds and associated
+target loads for readability.  For example:
+
+   85 1000000:90 1700000:99
+
+targets CPU load 85% below speed 1GHz, 90% at or above 1GHz, until
+1.7GHz and above, at which load 99% is targeted.  If speeds are
+specified these must appear in ascending order.  Higher target load
+values are typically specified for higher speeds, that is, target load
+values also usually appear in an ascending order. The default is
+target load 90% for all speeds.
+
 min_sample_time: The minimum amount of time to spend at the current
-frequency before ramping down. This is to ensure that the governor has
-seen enough historic cpu load data to determine the appropriate
-workload.  Default is 80000 uS.
+frequency before ramping down. Default is 80000 uS.
 
 hispeed_freq: An intermediate "hi speed" at which to initially ramp
 when CPU load hits the value specified in go_hispeed_load.  If load
 stays high for the amount of time specified in above_hispeed_delay,
-then speed may be bumped higher.  Default is maximum speed.
+then speed may be bumped higher.  Default is the maximum speed
+allowed by the policy at governor initialization time.
 
-go_hispeed_load: The CPU load at which to ramp to the intermediate "hi
-speed".  Default is 85%.
+go_hispeed_load: The CPU load at which to ramp to hispeed_freq.
+Default is 99%.
 
-above_hispeed_delay: Once speed is set to hispeed_freq, wait for this
-long before bumping speed higher in response to continued high load.
-Default is 20000 uS.
+above_hispeed_delay: When speed is at or above hispeed_freq, wait for
+this long before raising speed in response to continued high load.
+The format is a single delay value, optionally followed by pairs of
+CPU speeds and the delay to use at or above those speeds.  Colons can
+be used between the speeds and associated delays for readability.  For
+example:
 
-timer_rate: Sample rate for reevaluating cpu load when the system is
-not idle.  Default is 20000 uS.
+   80000 1300000:200000 1500000:40000
 
-input_boost: If non-zero, boost speed of all CPUs to hispeed_freq on
-touchscreen activity.  Default is 0.
+uses delay 80000 uS until CPU speed 1.3 GHz, at which speed delay
+200000 uS is used until speed 1.5 GHz, at which speed (and above)
+delay 40000 uS is used.  If speeds are specified these must appear in
+ascending order.  Default is 20000 uS.
+
+timer_rate: Sample rate for reevaluating CPU load when the CPU is not
+idle.  A deferrable timer is used, such that the CPU will not be woken
+from idle to service this timer until something else needs to run.
+(The maximum time to allow deferring this timer when not running at
+minimum speed is configurable via timer_slack.)  Default is 20000 uS.
+
+timer_slack: Maximum additional time to defer handling the governor
+sampling timer beyond timer_rate when running at speeds above the
+minimum.  For platforms that consume additional power at idle when
+CPUs are running at speeds greater than minimum, this places an upper
+bound on how long the timer will be deferred prior to re-evaluating
+load and dropping speed.  For example, if timer_rate is 20000uS and
+timer_slack is 10000uS then timers will be deferred for up to 30msec
+when not at lowest speed.  A value of -1 means defer timers
+indefinitely at all speeds.  Default is 80000 uS.
 
 boost: If non-zero, immediately boost speed of all CPUs to at least
 hispeed_freq until zero is written to this attribute.  If zero, allow
 CPU speeds to drop below hispeed_freq according to load as usual.
+Default is zero.
 
-boostpulse: Immediately boost speed of all CPUs to hispeed_freq for
-min_sample_time, after which speeds are allowed to drop below
+boostpulse: On each write, immediately boost speed of all CPUs to
+hispeed_freq for at least the period of time specified by
+boostpulse_duration, after which speeds are allowed to drop below
 hispeed_freq according to load as usual.
 
+boostpulse_duration: Length of time to hold CPU speed at hispeed_freq
+on a write to boostpulse, before allowing speed to drop according to
+load as usual.  Default is 80000 uS.
+
 
 3. The Governor Interface in the CPUfreq Core
 =============================================
diff --git a/Documentation/device-mapper/verity.txt b/Documentation/device-mapper/verity.txt
index 32e4879..9884681 100644
--- a/Documentation/device-mapper/verity.txt
+++ b/Documentation/device-mapper/verity.txt
@@ -7,39 +7,39 @@
 
 Construction Parameters
 =======================
-    <version> <dev> <hash_dev> <hash_start>
+    <version> <dev> <hash_dev>
     <data_block_size> <hash_block_size>
     <num_data_blocks> <hash_start_block>
     <algorithm> <digest> <salt>
 
 <version>
-    This is the version number of the on-disk format.
+    This is the type of the on-disk hash format.
 
     0 is the original format used in the Chromium OS.
-	The salt is appended when hashing, digests are stored continuously and
-	the rest of the block is padded with zeros.
+      The salt is appended when hashing, digests are stored continuously and
+      the rest of the block is padded with zeros.
 
     1 is the current format that should be used for new devices.
-	The salt is prepended when hashing and each digest is
-	padded with zeros to the power of two.
+      The salt is prepended when hashing and each digest is
+      padded with zeros to the power of two.
 
 <dev>
-    This is the device containing the data the integrity of which needs to be
+    This is the device containing data, the integrity of which needs to be
     checked.  It may be specified as a path, like /dev/sdaX, or a device number,
     <major>:<minor>.
 
 <hash_dev>
-    This is the device that that supplies the hash tree data.  It may be
+    This is the device that supplies the hash tree data.  It may be
     specified similarly to the device path and may be the same device.  If the
-    same device is used, the hash_start should be outside of the dm-verity
-    configured device size.
+    same device is used, the hash_start should be outside the configured
+    dm-verity device.
 
 <data_block_size>
-    The block size on a data device.  Each block corresponds to one digest on
-    the hash device.
+    The block size on a data device in bytes.
+    Each block corresponds to one digest on the hash device.
 
 <hash_block_size>
-    The size of a hash block.
+    The size of a hash block in bytes.
 
 <num_data_blocks>
     The number of data blocks on the data device.  Additional blocks are
@@ -65,7 +65,7 @@
 Theory of operation
 ===================
 
-dm-verity is meant to be setup as part of a verified boot path.  This
+dm-verity is meant to be set up as part of a verified boot path.  This
 may be anything ranging from a boot using tboot or trustedgrub to just
 booting from a known-good device (like a USB drive or CD).
 
@@ -73,20 +73,20 @@
 has been authenticated in some way (cryptographic signatures, etc).
 After instantiation, all hashes will be verified on-demand during
 disk access.  If they cannot be verified up to the root node of the
-tree, the root hash, then the I/O will fail.  This should identify
+tree, the root hash, then the I/O will fail.  This should detect
 tampering with any data on the device and the hash data.
 
 Cryptographic hashes are used to assert the integrity of the device on a
-per-block basis.  This allows for a lightweight hash computation on first read
-into the page cache.  Block hashes are stored linearly-aligned to the nearest
-block the size of a page.
+per-block basis. This allows for a lightweight hash computation on first read
+into the page cache. Block hashes are stored linearly, aligned to the nearest
+block size.
 
 Hash Tree
 ---------
 
 Each node in the tree is a cryptographic hash.  If it is a leaf node, the hash
-is of some block data on disk.  If it is an intermediary node, then the hash is
-of a number of child nodes.
+of some data block on disk is calculated. If it is an intermediary node,
+the hash of a number of child nodes is calculated.
 
 Each entry in the tree is a collection of neighboring nodes that fit in one
 block.  The number is determined based on block_size and the size of the
@@ -110,63 +110,23 @@
 On-disk format
 ==============
 
-Below is the recommended on-disk format. The verity kernel code does not
-read the on-disk header. It only reads the hash blocks which directly
-follow the header. It is expected that a user-space tool will verify the
-integrity of the verity_header and then call dmsetup with the correct
-parameters. Alternatively, the header can be omitted and the dmsetup
-parameters can be passed via the kernel command-line in a rooted chain
-of trust where the command-line is verified.
+The verity kernel code does not read the verity metadata on-disk header.
+It only reads the hash blocks which directly follow the header.
+It is expected that a user-space tool will verify the integrity of the
+verity header.
 
-The on-disk format is especially useful in cases where the hash blocks
-are on a separate partition. The magic number allows easy identification
-of the partition contents. Alternatively, the hash blocks can be stored
-in the same partition as the data to be verified. In such a configuration
-the filesystem on the partition would be sized a little smaller than
-the full-partition, leaving room for the hash blocks.
-
-struct superblock {
-	uint8_t signature[8]
-		"verity\0\0";
-
-	uint8_t version;
-		1 - current format
-
-	uint8_t data_block_bits;
-		log2(data block size)
-
-	uint8_t hash_block_bits;
-		log2(hash block size)
-
-	uint8_t pad1[1];
-		zero padding
-
-	uint16_t salt_size;
-		big-endian salt size
-
-	uint8_t pad2[2];
-		zero padding
-
-	uint32_t data_blocks_hi;
-		big-endian high 32 bits of the 64-bit number of data blocks
-
-	uint32_t data_blocks_lo;
-		big-endian low 32 bits of the 64-bit number of data blocks
-
-	uint8_t algorithm[16];
-		cryptographic algorithm
-
-	uint8_t salt[384];
-		salt (the salt size is specified above)
-
-	uint8_t pad3[88];
-		zero padding to 512-byte boundary
-}
+Alternatively, the header can be omitted and the dmsetup parameters can
+be passed via the kernel command-line in a rooted chain of trust where
+the command-line is verified.
 
 Directly following the header (and with sector number padded to the next hash
 block boundary) are the hash blocks which are stored a depth at a time
 (starting from the root), sorted in order of increasing index.
 
+The full specification of kernel parameters and on-disk metadata format
+is available at the cryptsetup project's wiki page
+  http://code.google.com/p/cryptsetup/wiki/DMVerity
+
 Status
 ======
 V (for Valid) is returned if every check performed so far was valid.
@@ -174,21 +134,22 @@
 
 Example
 =======
-
-Setup a device:
-  dmsetup create vroot --table \
-    "0 2097152 "\
-    "verity 1 /dev/sda1 /dev/sda2 4096 4096 2097152 1 "\
+Set up a device:
+  # dmsetup create vroot --readonly --table \
+    "0 2097152 verity 1 /dev/sda1 /dev/sda2 4096 4096 262144 1 sha256 "\
     "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\
     "1234000000000000000000000000000000000000000000000000000000000000"
 
 A command line tool veritysetup is available to compute or verify
-the hash tree or activate the kernel driver.  This is available from
-the LVM2 upstream repository and may be supplied as a package called
-device-mapper-verity-tools:
-    git://sources.redhat.com/git/lvm2
-    http://sourceware.org/git/?p=lvm2.git
-    http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/verity?cvsroot=lvm2
+the hash tree or activate the kernel device. This is available from
+the cryptsetup upstream repository http://code.google.com/p/cryptsetup/
+(as a libcryptsetup extension).
 
-veritysetup -a vroot /dev/sda1 /dev/sda2 \
-	4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076
+Create hash on the device:
+  # veritysetup format /dev/sda1 /dev/sda2
+  ...
+  Root hash: 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076
+
+Activate the device:
+  # veritysetup create vroot /dev/sda1 /dev/sda2 \
+    4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt
index 03f7897..286ec04 100644
--- a/Documentation/sound/alsa/HD-Audio-Models.txt
+++ b/Documentation/sound/alsa/HD-Audio-Models.txt
@@ -21,10 +21,11 @@
 ==========
   N/A
 
-ALC269
+ALC269/270/275/276/280/282
 ======
   laptop-amic	Laptops with analog-mic input
   laptop-dmic	Laptops with digital-mic input
+  lenovo-dock   Enables docking station I/O for some Lenovos
 
 ALC662/663/272
 ==============
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt
index f0ab5cf..b0714d8 100644
--- a/Documentation/stable_kernel_rules.txt
+++ b/Documentation/stable_kernel_rules.txt
@@ -1,4 +1,4 @@
-Everything you ever wanted to know about Linux 2.6 -stable releases.
+Everything you ever wanted to know about Linux -stable releases.
 
 Rules on what kind of patches are accepted, and which ones are not, into the
 "-stable" tree:
@@ -12,6 +12,12 @@
    marked CONFIG_BROKEN), an oops, a hang, data corruption, a real
    security issue, or some "oh, that's not good" issue.  In short, something
    critical.
+ - Serious issues as reported by a user of a distribution kernel may also
+   be considered if they fix a notable performance or interactivity issue.
+   As these fixes are not as obvious and have a higher risk of a subtle
+   regression they should only be submitted by a distribution kernel
+   maintainer and include an addendum linking to a bugzilla entry if it
+   exists and additional information on the user-visible impact.
  - New device IDs and quirks are also accepted.
  - No "theoretical race condition" issues, unless an explanation of how the
    race can be exploited is also provided.
@@ -36,10 +42,10 @@
    cherry-picked than this can be specified in the following format in
    the sign-off area:
 
-     Cc: <stable@vger.kernel.org> # .32.x: a1f84a3: sched: Check for idle
-     Cc: <stable@vger.kernel.org> # .32.x: 1b9508f: sched: Rate-limit newidle
-     Cc: <stable@vger.kernel.org> # .32.x: fd21073: sched: Fix affinity logic
-     Cc: <stable@vger.kernel.org> # .32.x
+     Cc: <stable@vger.kernel.org> # 3.3.x: a1f84a3: sched: Check for idle
+     Cc: <stable@vger.kernel.org> # 3.3.x: 1b9508f: sched: Rate-limit newidle
+     Cc: <stable@vger.kernel.org> # 3.3.x: fd21073: sched: Fix affinity logic
+     Cc: <stable@vger.kernel.org> # 3.3.x
     Signed-off-by: Ingo Molnar <mingo@elte.hu>
 
    The tag sequence has the meaning of:
@@ -73,6 +79,15 @@
    security kernel team, and not go through the normal review cycle.
    Contact the kernel security team for more details on this procedure.
 
+Trees:
+
+ - The queues of patches, for both completed versions and in progress
+   versions can be found at:
+	http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
+ - The finalized and tagged releases of all stable kernels can be found
+   in separate branches per version at:
+	http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git
+
 
 Review committee:
 
diff --git a/MAINTAINERS b/MAINTAINERS
index 5f8ab49..c56bd02 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5566,7 +5566,7 @@
 F:	drivers/block/brd.c
 
 RANDOM NUMBER DRIVER
-M:	Matt Mackall <mpm@selenic.com>
+M:	Theodore Ts'o" <tytso@mit.edu>
 S:	Maintained
 F:	drivers/char/random.c
 
diff --git a/Makefile b/Makefile
index 75b36ae..7c55015 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 4
-SUBLEVEL = 0
+SUBLEVEL = 10
 EXTRAVERSION =
 NAME = Saber-toothed Squirrel
 
@@ -192,8 +192,8 @@
 # Default value for CROSS_COMPILE is not to prefix executables
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
 export KBUILD_BUILDHOST := $(SUBARCH)
-ARCH		?= $(SUBARCH)
-CROSS_COMPILE	?= $(CONFIG_CROSS_COMPILE:"%"=%)
+ARCH		?= arm
+CROSS_COMPILE	?= arm-eabi-
 
 # Architecture as present in compile.h
 UTS_MACHINE 	:= $(ARCH)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index d380dbb..971a7e2 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -575,7 +575,7 @@
 	select ARCH_HAS_DMA_SET_COHERENT_MASK
 	select CLKSRC_MMIO
 	select CPU_XSCALE
-	select GENERIC_GPIO
+	select ARCH_REQUIRE_GPIOLIB
 	select GENERIC_CLOCKEVENTS
 	select MIGHT_HAVE_PCI
 	select NEED_MACH_IO_H
diff --git a/arch/arm/boot/dts/imx53-ard.dts b/arch/arm/boot/dts/imx53-ard.dts
index 2dccce4..7541a91 100644
--- a/arch/arm/boot/dts/imx53-ard.dts
+++ b/arch/arm/boot/dts/imx53-ard.dts
@@ -70,10 +70,30 @@
 			interrupt-parent = <&gpio2>;
 			interrupts = <31>;
 			reg-io-width = <4>;
+			/*
+			 * VDD33A and VDDVARIO of LAN9220 are supplied by
+			 * SW4_3V3 of LTC3589.  Before the regulator driver
+			 * for this PMIC is available, we use a fixed dummy
+			 * 3V3 regulator to get LAN9220 driver probing work.
+			 */
+			vdd33a-supply = <&reg_3p3v>;
+			vddvario-supply = <&reg_3p3v>;
 			smsc,irq-push-pull;
 		};
 	};
 
+	regulators {
+		compatible = "simple-bus";
+
+		reg_3p3v: 3p3v {
+			compatible = "regulator-fixed";
+			regulator-name = "3P3V";
+			regulator-min-microvolt = <3300000>;
+			regulator-max-microvolt = <3300000>;
+			regulator-always-on;
+		};
+	};
+
 	gpio-keys {
 		compatible = "gpio-keys";
 
diff --git a/arch/arm/boot/dts/tegra-cardhu.dts b/arch/arm/boot/dts/tegra-cardhu.dts
index ac3fb75..631a86c 100644
--- a/arch/arm/boot/dts/tegra-cardhu.dts
+++ b/arch/arm/boot/dts/tegra-cardhu.dts
@@ -64,7 +64,7 @@
 		status = "disable";
 	};
 
-	sdhci@78000400 {
+	sdhci@78000600 {
 		support-8bit;
 	};
 };
diff --git a/arch/arm/configs/elite_defconfig b/arch/arm/configs/elite_defconfig
new file mode 100644
index 0000000..5fa1c33
--- /dev/null
+++ b/arch/arm/configs/elite_defconfig
@@ -0,0 +1,3483 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux/arm 3.4.0 Kernel Configuration
+#
+CONFIG_ARM=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_KTIME_SCALAR=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_ARM_TICKET_LOCKS=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_ARCH_HAS_CPUFREQ=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_VECTORS_BASE=0xffff0000
+# CONFIG_ARM_PATCH_PHYS_VIRT is not set
+CONFIG_NEED_MACH_IO_H=y
+CONFIG_NEED_MACH_MEMORY_H=y
+CONFIG_PHYS_OFFSET=0x80400000
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_HAVE_IRQ_WORK=y
+CONFIG_IRQ_WORK=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=""
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_XZ=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_XZ is not set
+# CONFIG_KERNEL_LZO is not set
+CONFIG_DEFAULT_HOSTNAME="(none)"
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_FHANDLE is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+
+#
+# IRQ subsystem
+#
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_IRQ_DOMAIN=y
+# CONFIG_IRQ_DOMAIN_DEBUG is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_PREEMPT_RCU=y
+CONFIG_PREEMPT_RCU=y
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_RCU_FAST_NO_HZ is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_RCU_BOOST is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=17
+CONFIG_CGROUPS=y
+CONFIG_CGROUP_DEBUG=y
+CONFIG_CGROUP_FREEZER=y
+# CONFIG_CGROUP_DEVICE is not set
+# CONFIG_CPUSETS is not set
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_RESOURCE_COUNTERS=y
+# CONFIG_CGROUP_MEM_RES_CTLR is not set
+# CONFIG_CGROUP_PERF is not set
+CONFIG_CGROUP_SCHED=y
+CONFIG_FAIR_GROUP_SCHED=y
+# CONFIG_CFS_BANDWIDTH is not set
+CONFIG_RT_GROUP_SCHED=y
+# CONFIG_BLK_CGROUP is not set
+# CONFIG_CHECKPOINT_RESTORE is not set
+CONFIG_NAMESPACES=y
+# CONFIG_UTS_NS is not set
+# CONFIG_IPC_NS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+# CONFIG_NET_NS is not set
+# CONFIG_SCHED_AUTOGROUP is not set
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+CONFIG_RD_BZIP2=y
+CONFIG_RD_LZMA=y
+# CONFIG_RD_XZ is not set
+# CONFIG_RD_LZO is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_PANIC_TIMEOUT=5
+CONFIG_EXPERT=y
+CONFIG_UID16=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_ASHMEM=y
+CONFIG_AIO=y
+CONFIG_EMBEDDED=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_PERF_EVENTS=y
+# CONFIG_PERF_COUNTERS is not set
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+CONFIG_PROFILING=y
+CONFIG_TRACEPOINTS=y
+CONFIG_OPROFILE=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_KPROBES=y
+# CONFIG_JUMP_LABEL is not set
+CONFIG_KRETPROBES=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_CONTIGUOUS=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_HW_BREAKPOINT=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_STOP_MACHINE=y
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_BSGLIB is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_KARMA_PARTITION is not set
+CONFIG_EFI_PARTITION=y
+# CONFIG_SYSV68_PARTITION is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_TEST is not set
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_ROW=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_ROW=y
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="row"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_UNINLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
+CONFIG_FREEZER=y
+
+#
+# System Type
+#
+CONFIG_MMU=y
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_VEXPRESS is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_BCMRING is not set
+# CONFIG_ARCH_HIGHBANK is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CNS3XXX is not set
+# CONFIG_ARCH_GEMINI is not set
+# CONFIG_ARCH_PRIMA2 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_MXS is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_DOVE is not set
+# CONFIG_ARCH_KIRKWOOD is not set
+# CONFIG_ARCH_LPC32XX is not set
+# CONFIG_ARCH_MV78XX0 is not set
+# CONFIG_ARCH_ORION5X is not set
+# CONFIG_ARCH_MMP is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_W90X900 is not set
+# CONFIG_ARCH_TEGRA is not set
+# CONFIG_ARCH_PICOXCELL is not set
+# CONFIG_ARCH_PNX4008 is not set
+# CONFIG_ARCH_PXA is not set
+CONFIG_ARCH_MSM=y
+# CONFIG_ARCH_SHMOBILE is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C24XX is not set
+# CONFIG_ARCH_S3C64XX is not set
+# CONFIG_ARCH_S5P64X0 is not set
+# CONFIG_ARCH_S5PC100 is not set
+# CONFIG_ARCH_S5PV210 is not set
+# CONFIG_ARCH_EXYNOS is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_U300 is not set
+# CONFIG_ARCH_U8500 is not set
+# CONFIG_ARCH_NOMADIK is not set
+# CONFIG_ARCH_DAVINCI is not set
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_PLAT_SPEAR is not set
+# CONFIG_ARCH_VT8500 is not set
+# CONFIG_ARCH_ZYNQ is not set
+# CONFIG_GPIO_PCA953X is not set
+# CONFIG_KEYBOARD_GPIO_POLLED is not set
+
+#
+# MSM SoC Type
+#
+# CONFIG_ARCH_MSM7X01A is not set
+# CONFIG_ARCH_MSM7X25 is not set
+# CONFIG_ARCH_MSM7X27 is not set
+# CONFIG_ARCH_MSM7X30 is not set
+# CONFIG_ARCH_QSD8X50 is not set
+# CONFIG_ARCH_MSM8X60 is not set
+CONFIG_ARCH_MSM8960=y
+# CONFIG_ARCH_MSM8930 is not set
+# CONFIG_ARCH_APQ8064 is not set
+# CONFIG_ARCH_MSM8974 is not set
+# CONFIG_ARCH_MPQ8092 is not set
+# CONFIG_ARCH_MSM8226 is not set
+# CONFIG_ARCH_FSM9XXX is not set
+# CONFIG_ARCH_MSM9615 is not set
+# CONFIG_ARCH_MSM8625 is not set
+# CONFIG_ARCH_MSM9625 is not set
+CONFIG_MSM_SOC_REV_NONE=y
+# CONFIG_MSM_SOC_REV_A is not set
+CONFIG_MSM_KRAIT_TBB_ABORT_HANDLER=y
+CONFIG_ARCH_MSM_KRAIT=y
+CONFIG_MSM_SMP=y
+CONFIG_ARCH_MSM_KRAITMP=y
+CONFIG_MSM_KRAIT_WFE_FIXUP=y
+CONFIG_MSM_RPM=y
+# CONFIG_MSM_RPM_SMD is not set
+CONFIG_MSM_MPM=y
+CONFIG_MSM_XO=y
+CONFIG_MSM_REMOTE_SPINLOCK_SFPB=y
+
+#
+# MSM Board Selection
+#
+# CONFIG_MACH_MSM8960_CDP is not set
+# CONFIG_MACH_MSM8960_MTP is not set
+# CONFIG_MACH_MSM8960_FLUID is not set
+# CONFIG_MACH_MSM8960_LIQUID is not set
+# CONFIG_MACH_MSM_DUMMY is not set
+
+#
+# LGE Board Selection
+#
+CONFIG_BOARD_HEADER_FILE=""
+# CONFIG_MACH_LGE_DUMMY is not set
+
+#
+# LGE Specific Patches
+#
+# CONFIG_LGE_CRASH_HANDLER is not set
+CONFIG_MACH_HTC=y
+
+#
+# HTC Board Selection
+#
+CONFIG_MACH_ELITE=y
+# CONFIG_MACH_JET is not set
+# CONFIG_MACH_VILLE is not set
+# CONFIG_MACH_HTC_DUMMY is not set
+
+#
+# HTC Specific Patches
+#
+CONFIG_HTC_BATT_CORE=y
+CONFIG_HTC_BATT_8960=y
+CONFIG_HTC_HEADSET_MGR=y
+CONFIG_HTC_HEADSET_PMIC=y
+# CONFIG_HTC_HEADSET_ONE_WIRE is not set
+# CONFIG_MSM_STACKED_MEMORY is not set
+# CONFIG_KERNEL_MSM_CONTIG_MEM_REGION is not set
+CONFIG_MSM_AMSS_VERSION=6225
+# CONFIG_MSM_AMSS_VERSION_6210 is not set
+# CONFIG_MSM_AMSS_VERSION_6220 is not set
+CONFIG_MSM_AMSS_VERSION_6225=y
+CONFIG_MSM7X00A_USE_GP_TIMER=y
+# CONFIG_MSM7X00A_USE_DG_TIMER is not set
+CONFIG_MSM7X00A_SLEEP_MODE_POWER_COLLAPSE_SUSPEND=y
+# CONFIG_MSM7X00A_SLEEP_MODE_POWER_COLLAPSE is not set
+# CONFIG_MSM7X00A_SLEEP_MODE_APPS_SLEEP is not set
+# CONFIG_MSM7X00A_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT is not set
+# CONFIG_MSM7X00A_SLEEP_WAIT_FOR_INTERRUPT is not set
+CONFIG_MSM7X00A_SLEEP_MODE=0
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_POWER_COLLAPSE_SUSPEND is not set
+CONFIG_MSM7X00A_IDLE_SLEEP_MODE_POWER_COLLAPSE=y
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_APPS_SLEEP is not set
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT is not set
+# CONFIG_MSM7X00A_IDLE_SLEEP_WAIT_FOR_INTERRUPT is not set
+CONFIG_MSM7X00A_IDLE_SLEEP_MODE=1
+CONFIG_MSM7X00A_IDLE_SLEEP_MIN_TIME=20000000
+CONFIG_MSM7X00A_IDLE_SPIN_TIME=80000
+CONFIG_MSM_IDLE_STATS=y
+CONFIG_MSM_IDLE_STATS_FIRST_BUCKET=62500
+CONFIG_MSM_IDLE_STATS_BUCKET_SHIFT=2
+CONFIG_MSM_IDLE_STATS_BUCKET_COUNT=10
+CONFIG_MSM_SUSPEND_STATS_FIRST_BUCKET=1000000000
+CONFIG_CPU_HAS_L2_PMU=y
+# CONFIG_HTC_HEADSET is not set
+# CONFIG_HTC_PWRSINK is not set
+# CONFIG_MSM_FIQ_SUPPORT is not set
+# CONFIG_MSM_SERIAL_DEBUGGER is not set
+# CONFIG_MSM_PROC_COMM is not set
+CONFIG_MSM_SMD=y
+# CONFIG_MSM_SMD_PKG3 is not set
+CONFIG_MSM_SMD_PKG4=y
+CONFIG_MSM_SMD_DEBUG=y
+CONFIG_MSM_BAM_DMUX=y
+CONFIG_MSM_N_WAY_SMD=y
+CONFIG_MSM_N_WAY_SMSM=y
+CONFIG_MSM_RESET_MODEM=y
+CONFIG_MSM_SMD_LOGGING=y
+# CONFIG_MSM_IPC_LOGGING is not set
+CONFIG_MSM_SMD_NMEA=y
+# CONFIG_MSM_HSIC_TTY is not set
+CONFIG_MSM_SMD_TTY=y
+CONFIG_MSM_SMD_QMI=y
+CONFIG_MSM_SMD_PKT=y
+# CONFIG_MSM_DSPS is not set
+# CONFIG_MSM_ONCRPCROUTER is not set
+CONFIG_MSM_IPC_ROUTER=y
+CONFIG_MSM_IPC_ROUTER_SMD_XPRT=y
+# CONFIG_MSM_IPC_ROUTER_SECURITY is not set
+# CONFIG_MSM_DALRPC is not set
+# CONFIG_MSM_CPU_FREQ_SET_MIN_MAX is not set
+CONFIG_MSM_AVS_HW=y
+# CONFIG_MSM_HW3D is not set
+CONFIG_AMSS_7X25_VERSION_2009=y
+# CONFIG_AMSS_7X25_VERSION_2008 is not set
+CONFIG_RTAC=y
+# CONFIG_MSM_VREG_SWITCH_INVERTED is not set
+# CONFIG_MSM_DMA_TEST is not set
+# CONFIG_WIFI_CONTROL_FUNC is not set
+CONFIG_SURF_FFA_GPIO_KEYPAD=y
+CONFIG_MSM_SLEEP_TIME_OVERRIDE=y
+# CONFIG_MSM_MEMORY_LOW_POWER_MODE is not set
+CONFIG_MSM_PM_TIMEOUT_HALT=y
+# CONFIG_MSM_PM_TIMEOUT_RESET_MODEM is not set
+# CONFIG_MSM_PM_TIMEOUT_RESET_CHIP is not set
+CONFIG_MSM_IDLE_WAIT_ON_MODEM=0
+CONFIG_MSM_RPM_REGULATOR=y
+CONFIG_MSM_SUBSYSTEM_RESTART=y
+CONFIG_MSM_SYSMON_COMM=y
+CONFIG_MSM_PIL=y
+# CONFIG_MSM_PIL_MODEM is not set
+# CONFIG_MSM_PIL_QDSP6V3 is not set
+CONFIG_MSM_PIL_QDSP6V4=y
+# CONFIG_MSM_PIL_LPASS_QDSP6V5 is not set
+# CONFIG_MSM_PIL_MSS_QDSP6V5 is not set
+CONFIG_MSM_PIL_RIVA=y
+# CONFIG_MSM_INSECURE_PIL_RIVA is not set
+# CONFIG_MSM_PIL_TZAPPS is not set
+# CONFIG_MSM_PIL_DSPS is not set
+# CONFIG_MSM_PIL_VIDC is not set
+# CONFIG_MSM_PIL_VENUS is not set
+# CONFIG_MSM_PIL_GSS is not set
+# CONFIG_MSM_PIL_PRONTO is not set
+CONFIG_MSM_SCM=y
+CONFIG_MSM_MODEM_8960=y
+CONFIG_MSM_LPASS_8960=y
+CONFIG_MSM_WCNSS_SSR_8960=y
+CONFIG_MSM_BUSPM_DEV=y
+CONFIG_MSM_TZ_LOG=y
+CONFIG_MSM_RPM_LOG=y
+CONFIG_MSM_RPM_STATS_LOG=y
+# CONFIG_MSM_RPM_RBCPR_STATS_LOG is not set
+CONFIG_MSM_DIRECT_SCLK_ACCESS=y
+CONFIG_IOMMU_API=y
+CONFIG_MSM_GPIOMUX=y
+CONFIG_MSM_NATIVE_RESTART=y
+CONFIG_MSM_PM8X60=y
+# CONFIG_MSM_EVENT_TIMER is not set
+CONFIG_MSM_BUS_SCALING=y
+CONFIG_MSM_BUS_RPM_MULTI_TIER_ENABLED=y
+CONFIG_MSM_WATCHDOG=y
+# CONFIG_MSM_WATCHDOG_V2 is not set
+# CONFIG_MSM_MEMORY_DUMP is not set
+CONFIG_MSM_DLOAD_MODE=y
+# CONFIG_MSM_JTAG is not set
+# CONFIG_MSM_JTAG_MM is not set
+# CONFIG_MSM_SLEEP_STATS_DEVICE is not set
+CONFIG_MSM_RUN_QUEUE_STATS=y
+CONFIG_MSM_STANDALONE_POWER_COLLAPSE=y
+# CONFIG_MSM_GSBI9_UART is not set
+CONFIG_MSM_SHOW_RESUME_IRQ=y
+# CONFIG_MSM_FAKE_BATTERY is not set
+CONFIG_MSM_QDSP6_APR=y
+# CONFIG_MSM_QDSP6_APRV2 is not set
+CONFIG_MSM_QDSP6_CODECS=y
+# CONFIG_MSM_QDSP6V2_CODECS is not set
+CONFIG_MSM_AUDIO_QDSP6=y
+# CONFIG_MSM_AUDIO_QDSP6V2 is not set
+# CONFIG_MSM_ULTRASOUND is not set
+# CONFIG_MSM_SPM_V1 is not set
+CONFIG_MSM_SPM_V2=y
+CONFIG_MSM_L2_SPM=y
+CONFIG_MSM_MULTIMEDIA_USE_ION=y
+# CONFIG_MSM_OCMEM is not set
+# CONFIG_MSM_RTB is not set
+# CONFIG_MSM_EBI_ERP is not set
+# CONFIG_MSM_CACHE_ERP is not set
+CONFIG_MSM_DCVS=y
+# CONFIG_MSM_CPR is not set
+CONFIG_HAVE_ARCH_HAS_CURRENT_TIMER=y
+# CONFIG_MSM_CACHE_DUMP is not set
+# CONFIG_MSM_HSIC_SYSMON is not set
+CONFIG_MSM_CPU_PWRCTL=y
+
+#
+# System MMU
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_V7=y
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV7=y
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_HAS_ASID=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+# CONFIG_ARM_LPAE is not set
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_ARM_THUMB=y
+# CONFIG_ARM_THUMBEE is not set
+CONFIG_SWP_EMULATE=y
+# CONFIG_CPU_ICACHE_DISABLE is not set
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+# CONFIG_CACHE_L2X0 is not set
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_DMA_MEM_BUFFERABLE=y
+# CONFIG_VCM is not set
+CONFIG_STRICT_MEMORY_RWX=y
+CONFIG_ARM_NR_BANKS=8
+# CONFIG_RESERVE_FIRST_PAGE is not set
+CONFIG_CPU_HAS_PMU=y
+CONFIG_MULTI_IRQ_HANDLER=y
+# CONFIG_ARM_ERRATA_430973 is not set
+# CONFIG_ARM_ERRATA_458693 is not set
+# CONFIG_ARM_ERRATA_460075 is not set
+# CONFIG_ARM_ERRATA_742230 is not set
+# CONFIG_ARM_ERRATA_742231 is not set
+# CONFIG_ARM_ERRATA_720789 is not set
+# CONFIG_ARM_ERRATA_743622 is not set
+# CONFIG_ARM_ERRATA_751472 is not set
+# CONFIG_ARM_ERRATA_754322 is not set
+# CONFIG_ARM_ERRATA_754327 is not set
+# CONFIG_ARM_ERRATA_764369 is not set
+# CONFIG_KSAPI is not set
+CONFIG_ARM_GIC=y
+# CONFIG_FIQ_DEBUGGER is not set
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_HAVE_SMP=y
+CONFIG_SMP=y
+# CONFIG_SMP_ON_UP is not set
+CONFIG_ARM_CPU_TOPOLOGY=y
+# CONFIG_SCHED_MC is not set
+# CONFIG_SCHED_SMT is not set
+CONFIG_HAVE_ARM_SCU=y
+# CONFIG_ARM_ARCH_TIMER is not set
+CONFIG_VMSPLIT_3G=y
+# CONFIG_VMSPLIT_2G is not set
+# CONFIG_VMSPLIT_1G is not set
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_NR_CPUS=2
+CONFIG_HOTPLUG_CPU=y
+CONFIG_LOCAL_TIMERS=y
+CONFIG_ARCH_NR_GPIO=0
+# CONFIG_PREEMPT_NONE is not set
+# CONFIG_PREEMPT_VOLUNTARY is not set
+CONFIG_PREEMPT=y
+CONFIG_PREEMPT_COUNT=y
+CONFIG_HZ=100
+# CONFIG_THUMB2_KERNEL is not set
+CONFIG_AEABI=y
+CONFIG_OABI_COMPAT=y
+CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_HAVE_ARCH_PFN_VALID=y
+CONFIG_HIGHMEM=y
+# CONFIG_HIGHPTE is not set
+CONFIG_HW_PERF_EVENTS=y
+CONFIG_VMALLOC_RESERVE=0x25800000
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_SPARSEMEM_MANUAL=y
+CONFIG_SPARSEMEM=y
+CONFIG_HAVE_MEMORY_PRESENT=y
+CONFIG_SPARSEMEM_EXTREME=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_COMPACTION=y
+CONFIG_MIGRATION=y
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_CLEANCACHE=y
+# CONFIG_ARCH_MEMORY_PROBE is not set
+# CONFIG_ARCH_MEMORY_REMOVE is not set
+# CONFIG_ENABLE_DMM is not set
+CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0=y
+CONFIG_HOLES_IN_ZONE=y
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_UACCESS_WITH_MEMCPY is not set
+# CONFIG_SECCOMP is not set
+CONFIG_CC_STACKPROTECTOR=y
+# CONFIG_DEPRECATED_PARAM_STRUCT is not set
+# CONFIG_ARM_FLUSH_CONSOLE_ON_RESTART is not set
+CONFIG_CP_ACCESS=y
+
+#
+# Boot options
+#
+# CONFIG_USE_OF is not set
+CONFIG_ZBOOT_ROM_TEXT=0
+CONFIG_ZBOOT_ROM_BSS=0
+CONFIG_CMDLINE=""
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
+# CONFIG_AUTO_ZRELADDR is not set
+
+#
+# CPU Power Management
+#
+
+#
+# CPU Frequency scaling
+#
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_TABLE=y
+CONFIG_CPU_FREQ_STAT=y
+# CONFIG_CPU_FREQ_STAT_DETAILS is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=y
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_INTERACTIVE=y
+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
+
+#
+# ARM CPU frequency scaling drivers
+#
+# CONFIG_ARM_EXYNOS4210_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS4X12_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS5250_CPUFREQ is not set
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_IDLE_GOV_MENU=y
+CONFIG_CPU_FREQ_MSM=y
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+# CONFIG_FPE_NWFPE is not set
+# CONFIG_FPE_FASTFPE is not set
+CONFIG_VFP=y
+CONFIG_VFPv3=y
+CONFIG_NEON=y
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+CONFIG_HAVE_AOUT=y
+# CONFIG_BINFMT_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+
+#
+# Power management options
+#
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+CONFIG_HAS_WAKELOCK=y
+CONFIG_HAS_EARLYSUSPEND=y
+CONFIG_WAKELOCK=y
+CONFIG_WAKELOCK_STAT=y
+CONFIG_USER_WAKELOCK=y
+CONFIG_EARLYSUSPEND=y
+# CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL is not set
+CONFIG_FB_EARLYSUSPEND=y
+CONFIG_PM_SLEEP=y
+CONFIG_PM_SLEEP_SMP=y
+CONFIG_PM_RUNTIME=y
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_CLK=y
+CONFIG_CPU_PM=y
+# CONFIG_SUSPEND_TIME is not set
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+# CONFIG_UNIX_DIAG is not set
+CONFIG_XFRM=y
+CONFIG_XFRM_USER=y
+# CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
+CONFIG_XFRM_IPCOMP=y
+CONFIG_NET_KEY=y
+# CONFIG_NET_KEY_MIGRATE is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_ADVANCED_ROUTER=y
+# CONFIG_IP_FIB_TRIE_STATS is not set
+CONFIG_IP_MULTIPLE_TABLES=y
+# CONFIG_IP_ROUTE_MULTIPATH is not set
+# CONFIG_IP_ROUTE_VERBOSE is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE_DEMUX is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+CONFIG_INET_AH=y
+CONFIG_INET_ESP=y
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+CONFIG_INET_TUNNEL=y
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+CONFIG_IPV6=y
+CONFIG_IPV6_PRIVACY=y
+CONFIG_IPV6_ROUTER_PREF=y
+CONFIG_IPV6_ROUTE_INFO=y
+CONFIG_IPV6_OPTIMISTIC_DAD=y
+CONFIG_INET6_AH=y
+CONFIG_INET6_ESP=y
+CONFIG_INET6_IPCOMP=y
+CONFIG_IPV6_MIP6=y
+CONFIG_INET6_XFRM_TUNNEL=y
+CONFIG_INET6_TUNNEL=y
+CONFIG_INET6_XFRM_MODE_TRANSPORT=y
+CONFIG_INET6_XFRM_MODE_TUNNEL=y
+CONFIG_INET6_XFRM_MODE_BEET=y
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+CONFIG_IPV6_SIT=y
+# CONFIG_IPV6_SIT_6RD is not set
+CONFIG_IPV6_NDISC_NODETYPE=y
+# CONFIG_IPV6_TUNNEL is not set
+CONFIG_IPV6_MULTIPLE_TABLES=y
+CONFIG_IPV6_SUBTREES=y
+# CONFIG_IPV6_MROUTE is not set
+# CONFIG_ANDROID_PARANOID_NETWORK is not set
+CONFIG_NET_ACTIVITY_STATS=y
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+CONFIG_NETFILTER_ADVANCED=y
+
+#
+# Core Netfilter Configuration
+#
+CONFIG_NETFILTER_NETLINK=y
+# CONFIG_NETFILTER_NETLINK_ACCT is not set
+CONFIG_NETFILTER_NETLINK_QUEUE=y
+CONFIG_NETFILTER_NETLINK_LOG=y
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_CONNTRACK_MARK=y
+CONFIG_NF_CONNTRACK_PROCFS=y
+CONFIG_NF_CONNTRACK_EVENTS=y
+# CONFIG_NF_CONNTRACK_TIMEOUT is not set
+# CONFIG_NF_CONNTRACK_TIMESTAMP is not set
+CONFIG_NF_CT_PROTO_DCCP=y
+CONFIG_NF_CT_PROTO_GRE=y
+CONFIG_NF_CT_PROTO_SCTP=y
+CONFIG_NF_CT_PROTO_UDPLITE=y
+CONFIG_NF_CONNTRACK_AMANDA=y
+CONFIG_NF_CONNTRACK_FTP=y
+CONFIG_NF_CONNTRACK_H323=y
+CONFIG_NF_CONNTRACK_IRC=y
+CONFIG_NF_CONNTRACK_BROADCAST=y
+CONFIG_NF_CONNTRACK_NETBIOS_NS=y
+# CONFIG_NF_CONNTRACK_SNMP is not set
+CONFIG_NF_CONNTRACK_PPTP=y
+CONFIG_NF_CONNTRACK_SANE=y
+CONFIG_NF_CONNTRACK_SIP=y
+CONFIG_NF_CONNTRACK_TFTP=y
+CONFIG_NF_CT_NETLINK=y
+# CONFIG_NF_CT_NETLINK_TIMEOUT is not set
+CONFIG_NETFILTER_TPROXY=y
+CONFIG_NETFILTER_XTABLES=y
+
+#
+# Xtables combined modules
+#
+CONFIG_NETFILTER_XT_MARK=y
+CONFIG_NETFILTER_XT_CONNMARK=y
+
+#
+# Xtables targets
+#
+# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set
+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
+CONFIG_NETFILTER_XT_TARGET_CONNMARK=y
+# CONFIG_NETFILTER_XT_TARGET_CT is not set
+# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
+CONFIG_NETFILTER_XT_TARGET_HL=y
+# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set
+# CONFIG_NETFILTER_XT_TARGET_LOG is not set
+CONFIG_NETFILTER_XT_TARGET_MARK=y
+# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y
+# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set
+# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
+# CONFIG_NETFILTER_XT_TARGET_TEE is not set
+# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set
+# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
+CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
+# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
+
+#
+# Xtables matches
+#
+# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set
+# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set
+CONFIG_NETFILTER_XT_MATCH_COMMENT=y
+# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set
+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y
+CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
+# CONFIG_NETFILTER_XT_MATCH_CPU is not set
+# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
+# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set
+# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
+CONFIG_NETFILTER_XT_MATCH_ECN=y
+CONFIG_NETFILTER_XT_MATCH_ESP=y
+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y
+CONFIG_NETFILTER_XT_MATCH_HELPER=y
+CONFIG_NETFILTER_XT_MATCH_HL=y
+CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
+CONFIG_NETFILTER_XT_MATCH_LENGTH=y
+CONFIG_NETFILTER_XT_MATCH_LIMIT=y
+CONFIG_NETFILTER_XT_MATCH_MAC=y
+CONFIG_NETFILTER_XT_MATCH_MARK=y
+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
+# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set
+# CONFIG_NETFILTER_XT_MATCH_OSF is not set
+# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
+CONFIG_NETFILTER_XT_MATCH_POLICY=y
+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
+CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA2=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG=y
+# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
+# CONFIG_NETFILTER_XT_MATCH_REALM is not set
+# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
+# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
+CONFIG_NETFILTER_XT_MATCH_SOCKET=y
+CONFIG_NETFILTER_XT_MATCH_STATE=y
+CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
+CONFIG_NETFILTER_XT_MATCH_STRING=y
+CONFIG_NETFILTER_XT_MATCH_TCPMSS=y
+CONFIG_NETFILTER_XT_MATCH_TIME=y
+CONFIG_NETFILTER_XT_MATCH_U32=y
+# CONFIG_IP_SET is not set
+# CONFIG_IP_VS is not set
+
+#
+# IP: Netfilter Configuration
+#
+CONFIG_NF_DEFRAG_IPV4=y
+CONFIG_NF_CONNTRACK_IPV4=y
+CONFIG_NF_CONNTRACK_PROC_COMPAT=y
+# CONFIG_IP_NF_QUEUE is not set
+CONFIG_IP_NF_IPTABLES=y
+CONFIG_IP_NF_MATCH_AH=y
+CONFIG_IP_NF_MATCH_ECN=y
+# CONFIG_IP_NF_MATCH_RPFILTER is not set
+CONFIG_IP_NF_MATCH_TTL=y
+CONFIG_IP_NF_FILTER=y
+CONFIG_IP_NF_TARGET_REJECT=y
+# CONFIG_IP_NF_TARGET_REJECT_SKERR is not set
+# CONFIG_IP_NF_TARGET_ULOG is not set
+CONFIG_NF_NAT=y
+CONFIG_NF_NAT_NEEDED=y
+CONFIG_IP_NF_TARGET_MASQUERADE=y
+CONFIG_IP_NF_TARGET_NETMAP=y
+CONFIG_IP_NF_TARGET_REDIRECT=y
+CONFIG_NF_NAT_PROTO_DCCP=y
+CONFIG_NF_NAT_PROTO_GRE=y
+CONFIG_NF_NAT_PROTO_UDPLITE=y
+CONFIG_NF_NAT_PROTO_SCTP=y
+CONFIG_NF_NAT_FTP=y
+CONFIG_NF_NAT_IRC=y
+CONFIG_NF_NAT_TFTP=y
+CONFIG_NF_NAT_AMANDA=y
+CONFIG_NF_NAT_PPTP=y
+CONFIG_NF_NAT_H323=y
+CONFIG_NF_NAT_SIP=y
+CONFIG_IP_NF_MANGLE=y
+# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
+# CONFIG_IP_NF_TARGET_ECN is not set
+# CONFIG_IP_NF_TARGET_TTL is not set
+CONFIG_IP_NF_RAW=y
+CONFIG_IP_NF_ARPTABLES=y
+CONFIG_IP_NF_ARPFILTER=y
+CONFIG_IP_NF_ARP_MANGLE=y
+
+#
+# IPv6: Netfilter Configuration
+#
+CONFIG_NF_DEFRAG_IPV6=y
+CONFIG_NF_CONNTRACK_IPV6=y
+# CONFIG_IP6_NF_QUEUE is not set
+CONFIG_IP6_NF_IPTABLES=y
+CONFIG_IP6_NF_MATCH_AH=y
+CONFIG_IP6_NF_MATCH_EUI64=y
+CONFIG_IP6_NF_MATCH_FRAG=y
+CONFIG_IP6_NF_MATCH_OPTS=y
+CONFIG_IP6_NF_MATCH_HL=y
+CONFIG_IP6_NF_MATCH_IPV6HEADER=y
+CONFIG_IP6_NF_MATCH_MH=y
+# CONFIG_IP6_NF_MATCH_RPFILTER is not set
+CONFIG_IP6_NF_MATCH_RT=y
+CONFIG_IP6_NF_TARGET_HL=y
+CONFIG_IP6_NF_FILTER=y
+CONFIG_IP6_NF_TARGET_REJECT=y
+# CONFIG_IP6_NF_TARGET_REJECT_SKERR is not set
+CONFIG_IP6_NF_MANGLE=y
+CONFIG_IP6_NF_RAW=y
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_L2TP is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+CONFIG_NET_SCHED=y
+
+#
+# Queueing/Scheduling
+#
+# CONFIG_NET_SCH_CBQ is not set
+CONFIG_NET_SCH_HTB=y
+# CONFIG_NET_SCH_HFSC is not set
+CONFIG_NET_SCH_PRIO=y
+# CONFIG_NET_SCH_MULTIQ is not set
+# CONFIG_NET_SCH_RED is not set
+# CONFIG_NET_SCH_SFB is not set
+# CONFIG_NET_SCH_SFQ is not set
+# CONFIG_NET_SCH_TEQL is not set
+# CONFIG_NET_SCH_TBF is not set
+# CONFIG_NET_SCH_GRED is not set
+# CONFIG_NET_SCH_DSMARK is not set
+# CONFIG_NET_SCH_NETEM is not set
+# CONFIG_NET_SCH_DRR is not set
+# CONFIG_NET_SCH_MQPRIO is not set
+# CONFIG_NET_SCH_CHOKE is not set
+# CONFIG_NET_SCH_QFQ is not set
+# CONFIG_NET_SCH_INGRESS is not set
+# CONFIG_NET_SCH_PLUG is not set
+
+#
+# Classification
+#
+CONFIG_NET_CLS=y
+# CONFIG_NET_CLS_BASIC is not set
+# CONFIG_NET_CLS_TCINDEX is not set
+# CONFIG_NET_CLS_ROUTE4 is not set
+CONFIG_NET_CLS_FW=y
+CONFIG_NET_CLS_U32=y
+# CONFIG_CLS_U32_PERF is not set
+CONFIG_CLS_U32_MARK=y
+# CONFIG_NET_CLS_RSVP is not set
+# CONFIG_NET_CLS_RSVP6 is not set
+CONFIG_NET_CLS_FLOW=y
+# CONFIG_NET_CLS_CGROUP is not set
+CONFIG_NET_EMATCH=y
+CONFIG_NET_EMATCH_STACK=32
+CONFIG_NET_EMATCH_CMP=y
+CONFIG_NET_EMATCH_NBYTE=y
+CONFIG_NET_EMATCH_U32=y
+CONFIG_NET_EMATCH_META=y
+CONFIG_NET_EMATCH_TEXT=y
+CONFIG_NET_CLS_ACT=y
+# CONFIG_NET_ACT_POLICE is not set
+# CONFIG_NET_ACT_GACT is not set
+# CONFIG_NET_ACT_MIRRED is not set
+# CONFIG_NET_ACT_IPT is not set
+# CONFIG_NET_ACT_NAT is not set
+# CONFIG_NET_ACT_PEDIT is not set
+# CONFIG_NET_ACT_SIMP is not set
+# CONFIG_NET_ACT_SKBEDIT is not set
+# CONFIG_NET_ACT_CSUM is not set
+# CONFIG_NET_CLS_IND is not set
+CONFIG_NET_SCH_FIFO=y
+# CONFIG_DCB is not set
+CONFIG_DNS_RESOLVER=y
+# CONFIG_BATMAN_ADV is not set
+# CONFIG_OPENVSWITCH is not set
+CONFIG_RPS=y
+CONFIG_RFS_ACCEL=y
+CONFIG_XPS=y
+# CONFIG_NETPRIO_CGROUP is not set
+CONFIG_BQL=y
+CONFIG_HAVE_BPF_JIT=y
+# CONFIG_BPF_JIT is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NET_TCPPROBE is not set
+# CONFIG_NET_DROP_MONITOR is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_RFCOMM_TTY=y
+CONFIG_BT_BNEP=y
+CONFIG_BT_BNEP_MC_FILTER=y
+CONFIG_BT_BNEP_PROTO_FILTER=y
+CONFIG_BT_HIDP=y
+
+#
+# Bluetooth device drivers
+#
+CONFIG_BT_HCISMD=y
+# CONFIG_BT_HCIBTUSB is not set
+# CONFIG_BT_HCIBTSDIO is not set
+# CONFIG_BT_HCIUART is not set
+# CONFIG_BT_HCIBCM203X is not set
+# CONFIG_BT_HCIBPA10X is not set
+# CONFIG_BT_MSM_SLEEP is not set
+# CONFIG_BT_HCIBFUSB is not set
+# CONFIG_BT_HCIVHCI is not set
+# CONFIG_BT_MRVL is not set
+# CONFIG_MSM_BT_POWER is not set
+# CONFIG_AF_RXRPC is not set
+CONFIG_FIB_RULES=y
+CONFIG_WIRELESS=y
+CONFIG_WIRELESS_EXT=y
+CONFIG_WEXT_CORE=y
+CONFIG_WEXT_PROC=y
+CONFIG_WEXT_SPY=y
+CONFIG_WEXT_PRIV=y
+CONFIG_CFG80211=y
+# CONFIG_NL80211_TESTMODE is not set
+# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
+# CONFIG_CFG80211_REG_DEBUG is not set
+CONFIG_CFG80211_DEFAULT_PS=y
+# CONFIG_CFG80211_DEBUGFS is not set
+# CONFIG_CFG80211_INTERNAL_REGDB is not set
+# CONFIG_CFG80211_WEXT is not set
+CONFIG_WIRELESS_EXT_SYSFS=y
+# CONFIG_LIB80211 is not set
+# CONFIG_CFG80211_ALLOW_RECONNECT is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_WIMAX is not set
+CONFIG_RFKILL=y
+CONFIG_RFKILL_PM=y
+# CONFIG_RFKILL_INPUT is not set
+# CONFIG_RFKILL_REGULATOR is not set
+# CONFIG_RFKILL_GPIO is not set
+# CONFIG_NET_9P is not set
+# CONFIG_CAIF is not set
+# CONFIG_CEPH_LIB is not set
+# CONFIG_NFC is not set
+# CONFIG_BCM2079X is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH=""
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_GENERIC_CPU_DEVICES is not set
+CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
+CONFIG_REGMAP_SPI=y
+CONFIG_DMA_SHARED_BUFFER=y
+CONFIG_GENLOCK=y
+CONFIG_GENLOCK_MISCDEVICE=y
+CONFIG_SYNC=y
+CONFIG_SW_SYNC=y
+# CONFIG_SW_SYNC_USER is not set
+# CONFIG_CMA is not set
+# CONFIG_CONNECTOR is not set
+# CONFIG_MTD is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=4096
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_MG_DISK is not set
+# CONFIG_BLK_DEV_RBD is not set
+
+#
+# Misc devices
+#
+# CONFIG_SENSORS_LIS3LV02D is not set
+# CONFIG_AD525X_DPOT is not set
+CONFIG_ANDROID_PMEM=y
+# CONFIG_ATMEL_PWM is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_APDS9802ALS is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_ISL29020 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_SENSORS_BH1780 is not set
+# CONFIG_SENSORS_BH1770 is not set
+# CONFIG_SENSORS_APDS990X is not set
+# CONFIG_HMC6352 is not set
+# CONFIG_SENSORS_AK8975 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
+CONFIG_UID_STAT=y
+# CONFIG_BMP085 is not set
+# CONFIG_USB_SWITCH_FSA9480 is not set
+# CONFIG_WL127X_RFKILL is not set
+# CONFIG_APANIC is not set
+# CONFIG_TSIF is not set
+# CONFIG_TSPP is not set
+# CONFIG_HAPTIC_ISA1200 is not set
+# CONFIG_PMIC8XXX_VIBRATOR is not set
+CONFIG_PMIC8XXX_VIBRATOR_PWM=y
+# CONFIG_ANDROID_VIBRATOR is not set
+# CONFIG_TOUCHSENSE_VIBRATOR is not set
+# CONFIG_PMIC8XXX_NFC is not set
+# CONFIG_PMIC8XXX_UPL is not set
+# CONFIG_QSEECOM is not set
+# CONFIG_QFP_FUSE is not set
+# CONFIG_BU52031NVX is not set
+CONFIG_CABLE_DETECT_8XXX=y
+CONFIG_CABLE_DETECT_ACCESSORY=y
+CONFIG_CABLE_DETECT_ACCESSORY_BY_ADC=y
+CONFIG_VP_A1028=y
+CONFIG_SENSORS_NFC_PN544=y
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_AT25 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_EEPROM_93XX46 is not set
+# CONFIG_IWMC3200TOP is not set
+
+#
+# Texas Instruments shared transport line discipline
+#
+# CONFIG_TI_ST is not set
+# CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
+
+#
+# Altera FPGA firmware download module
+#
+# CONFIG_ALTERA_STAPL is not set
+# CONFIG_SLIMPORT_ANX7808 is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI_MOD=y
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+CONFIG_SCSI_TGT=y
+# CONFIG_SCSI_NETLINK is not set
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+CONFIG_CHR_DEV_SG=y
+CONFIG_CHR_DEV_SCH=y
+CONFIG_SCSI_MULTI_LUN=y
+CONFIG_SCSI_CONSTANTS=y
+CONFIG_SCSI_LOGGING=y
+CONFIG_SCSI_SCAN_ASYNC=y
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_ISCSI_BOOT_SYSFS is not set
+# CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
+# CONFIG_ATA is not set
+CONFIG_MD=y
+# CONFIG_BLK_DEV_MD is not set
+CONFIG_BLK_DEV_DM=y
+# CONFIG_DM_DEBUG is not set
+CONFIG_DM_CRYPT=y
+# CONFIG_DM_SNAPSHOT is not set
+# CONFIG_DM_THIN_PROVISIONING is not set
+# CONFIG_DM_MIRROR is not set
+# CONFIG_DM_RAID is not set
+# CONFIG_DM_ZERO is not set
+# CONFIG_DM_MULTIPATH is not set
+# CONFIG_DM_DELAY is not set
+# CONFIG_DM_UEVENT is not set
+# CONFIG_DM_FLAKEY is not set
+# CONFIG_DM_VERITY is not set
+# CONFIG_TARGET_CORE is not set
+CONFIG_NETDEVICES=y
+CONFIG_NET_CORE=y
+# CONFIG_BONDING is not set
+CONFIG_DUMMY=y
+# CONFIG_EQUALIZER is not set
+CONFIG_MII=y
+# CONFIG_IFB is not set
+# CONFIG_NET_TEAM is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+CONFIG_TUN=y
+# CONFIG_VETH is not set
+
+#
+# CAIF transport drivers
+#
+CONFIG_ETHERNET=y
+CONFIG_NET_VENDOR_BROADCOM=y
+# CONFIG_B44 is not set
+# CONFIG_NET_CALXEDA_XGMAC is not set
+CONFIG_NET_VENDOR_CHELSIO=y
+CONFIG_NET_VENDOR_CIRRUS=y
+# CONFIG_CS89x0 is not set
+# CONFIG_DM9000 is not set
+# CONFIG_DNET is not set
+CONFIG_NET_VENDOR_FARADAY=y
+# CONFIG_FTMAC100 is not set
+# CONFIG_FTGMAC100 is not set
+CONFIG_NET_VENDOR_INTEL=y
+CONFIG_NET_VENDOR_I825XX=y
+CONFIG_NET_VENDOR_MARVELL=y
+CONFIG_NET_VENDOR_MICREL=y
+# CONFIG_KS8851 is not set
+# CONFIG_KS8851_MLL is not set
+CONFIG_NET_VENDOR_MICROCHIP=y
+# CONFIG_ENC28J60 is not set
+# CONFIG_MSM_RMNET is not set
+CONFIG_MSM_RMNET_BAM=y
+# CONFIG_QFEC is not set
+CONFIG_NET_VENDOR_NATSEMI=y
+CONFIG_NET_VENDOR_8390=y
+# CONFIG_AX88796 is not set
+# CONFIG_ETHOC is not set
+CONFIG_NET_VENDOR_SEEQ=y
+# CONFIG_SEEQ8005 is not set
+CONFIG_NET_VENDOR_SMSC=y
+CONFIG_SMC91X=y
+CONFIG_SMC911X=y
+CONFIG_SMSC911X=y
+# CONFIG_SMSC911X_ARCH_HOOKS is not set
+CONFIG_NET_VENDOR_STMICRO=y
+# CONFIG_STMMAC_ETH is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_AMD_PHY is not set
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+# CONFIG_LXT_PHY is not set
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+# CONFIG_SMSC_PHY is not set
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_MICREL_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+# CONFIG_MICREL_KS8995MA is not set
+# CONFIG_PPP is not set
+CONFIG_SLIP=y
+CONFIG_SLHC=y
+CONFIG_SLIP_COMPRESSED=y
+# CONFIG_SLIP_SMART is not set
+CONFIG_SLIP_MODE_SLIP6=y
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_USB_HSO is not set
+# CONFIG_USB_IPHETH is not set
+CONFIG_WLAN=y
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_USB_NET_RNDIS_WLAN is not set
+# CONFIG_LIBRA_SDIOIF is not set
+# CONFIG_ATH6K_LEGACY_EXT is not set
+CONFIG_WCNSS_CORE=y
+# CONFIG_ATH_COMMON is not set
+# CONFIG_BCMDHD is not set
+# CONFIG_BRCMFMAC is not set
+# CONFIG_HOSTAP is not set
+# CONFIG_IWM is not set
+# CONFIG_LIBERTAS is not set
+# CONFIG_MWIFIEX is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+CONFIG_INPUT_POLLDEV=y
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+CONFIG_INPUT_KEYRESET=y
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+# CONFIG_KEYBOARD_ADP5589 is not set
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_QT1070 is not set
+# CONFIG_KEYBOARD_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_GPIO is not set
+# CONFIG_KEYBOARD_TCA6416 is not set
+# CONFIG_KEYBOARD_TCA8418 is not set
+# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_LM8323 is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_MCS is not set
+# CONFIG_KEYBOARD_MPR121 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+CONFIG_KEYBOARD_PMIC8XXX=y
+# CONFIG_KEYBOARD_SAMSUNG is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_OMAP4 is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_QCIKBD is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_SENTELIC is not set
+# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_APPLETOUCH is not set
+# CONFIG_MOUSE_BCM5974 is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_GPIO is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
+# CONFIG_MOUSE_QCITP is not set
+# CONFIG_MOUSE_SYNAPTICS_USB is not set
+CONFIG_INPUT_JOYSTICK=y
+# CONFIG_JOYSTICK_ANALOG is not set
+# CONFIG_JOYSTICK_A3D is not set
+# CONFIG_JOYSTICK_ADI is not set
+# CONFIG_JOYSTICK_COBRA is not set
+# CONFIG_JOYSTICK_GF2K is not set
+# CONFIG_JOYSTICK_GRIP is not set
+# CONFIG_JOYSTICK_GRIP_MP is not set
+# CONFIG_JOYSTICK_GUILLEMOT is not set
+# CONFIG_JOYSTICK_INTERACT is not set
+# CONFIG_JOYSTICK_SIDEWINDER is not set
+# CONFIG_JOYSTICK_TMDC is not set
+# CONFIG_JOYSTICK_IFORCE is not set
+# CONFIG_JOYSTICK_WARRIOR is not set
+# CONFIG_JOYSTICK_MAGELLAN is not set
+# CONFIG_JOYSTICK_SPACEORB is not set
+# CONFIG_JOYSTICK_SPACEBALL is not set
+# CONFIG_JOYSTICK_STINGER is not set
+# CONFIG_JOYSTICK_TWIDJOY is not set
+# CONFIG_JOYSTICK_ZHENHUA is not set
+# CONFIG_JOYSTICK_AS5011 is not set
+# CONFIG_JOYSTICK_JOYDUMP is not set
+# CONFIG_JOYSTICK_XPAD is not set
+# CONFIG_TOUCHDISC_VTD518_SHINETSU is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_ADS7846 is not set
+# CONFIG_TOUCHSCREEN_AD7877 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_MAXTOUCH is not set
+# CONFIG_TOUCHSCREEN_AD7879 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set
+# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_BU21013 is not set
+# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set
+# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set
+# CONFIG_TOUCHSCREEN_DYNAPRO is not set
+# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set
+# CONFIG_TOUCHSCREEN_EETI is not set
+# CONFIG_TOUCHSCREEN_EGALAX is not set
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+# CONFIG_TOUCHSCREEN_ILI210X is not set
+# CONFIG_TOUCHSCREEN_GUNZE is not set
+# CONFIG_TOUCHSCREEN_ELO is not set
+# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
+# CONFIG_TOUCHSCREEN_MAX11801 is not set
+# CONFIG_TOUCHSCREEN_MCS5000 is not set
+# CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_INEXIO is not set
+# CONFIG_TOUCHSCREEN_MK712 is not set
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
+# CONFIG_TOUCHSCREEN_TSC_SERIO is not set
+# CONFIG_TOUCHSCREEN_TSC2005 is not set
+# CONFIG_TOUCHSCREEN_TSC2007 is not set
+# CONFIG_TOUCHSCREEN_MSM_LEGACY is not set
+# CONFIG_TOUCHSCREEN_W90X900 is not set
+# CONFIG_TOUCHSCREEN_ST1232 is not set
+# CONFIG_TOUCHSCREEN_TPS6507X is not set
+# CONFIG_TOUCHSCREEN_CY8C_TS is not set
+# CONFIG_TOUCHSCREEN_CYTTSP_I2C_QC is not set
+# CONFIG_TOUCHSCREEN_FT5X06 is not set
+# CONFIG_TOUCHSCREEN_LGE_COMMON is not set
+# CONFIG_TOUCHSCREEN_LGE_SYNAPTICS is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_224E is not set
+# CONFIG_TOUCHSCREEN_CYPRESS_CS is not set
+CONFIG_TOUCHSCREEN_SYNAPTICS_3K=y
+CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_AD714X is not set
+# CONFIG_INPUT_BMA150 is not set
+# CONFIG_INPUT_PM8XXX_VIBRATOR is not set
+CONFIG_INPUT_PMIC8XXX_PWRKEY=y
+# CONFIG_INPUT_MMA8450 is not set
+# CONFIG_INPUT_MPU3050 is not set
+# CONFIG_INPUT_GP2A is not set
+# CONFIG_INPUT_GPIO_TILT_POLLED is not set
+# CONFIG_INPUT_ATI_REMOTE2 is not set
+CONFIG_INPUT_KEYCHORD=y
+# CONFIG_INPUT_KEYSPAN_REMOTE is not set
+# CONFIG_INPUT_KXTJ9 is not set
+# CONFIG_INPUT_POWERMATE is not set
+# CONFIG_INPUT_YEALINK is not set
+# CONFIG_INPUT_CM109 is not set
+CONFIG_INPUT_UINPUT=y
+CONFIG_INPUT_GPIO=y
+# CONFIG_INPUT_ISA1200_FF_MEMLESS is not set
+# CONFIG_INPUT_PCF8574 is not set
+# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
+# CONFIG_INPUT_ADXL34X is not set
+# CONFIG_INPUT_CMA3000 is not set
+# CONFIG_BOSCH_BMA150 is not set
+# CONFIG_STM_LIS3DH is not set
+# CONFIG_BMP18X is not set
+# CONFIG_SENSORS_AKM8975 is not set
+CONFIG_SENSORS_AKM8975_PANA_GYRO=y
+CONFIG_SENSORS_PANASONIC_GYRO=y
+CONFIG_SENSORS_BMA250=y
+CONFIG_INPUT_CAPELLA_CM3629=y
+CONFIG_SENSORS_R3GD20=y
+CONFIG_MPU_SENSORS_MPU3050=y
+# CONFIG_MPU_SENSORS_ACCELEROMETER_NONE is not set
+# CONFIG_MPU_SENSORS_ADXL346 is not set
+# CONFIG_MPU_SENSORS_BMA150 is not set
+CONFIG_MPU_SENSORS_BMA250=y
+# CONFIG_MPU_SENSORS_BMA222 is not set
+# CONFIG_MPU_SENSORS_KXSD9 is not set
+# CONFIG_MPU_SENSORS_KXTF9 is not set
+# CONFIG_MPU_SENSORS_LIS331DLH is not set
+# CONFIG_MPU_SENSORS_LIS3DH is not set
+# CONFIG_MPU_SENSORS_LSM303DLHA is not set
+# CONFIG_MPU_SENSORS_MMA8450 is not set
+# CONFIG_MPU_SENSORS_MMA845X is not set
+# CONFIG_MPU_SENSORS_COMPASS_NONE is not set
+CONFIG_MPU_SENSORS_AK8975=y
+# CONFIG_MPU_SENSORS_AK8963 is not set
+# CONFIG_MPU_SENSORS_MMC314X is not set
+# CONFIG_MPU_SENSORS_AMI30X is not set
+# CONFIG_MPU_SENSORS_HMC5883 is not set
+# CONFIG_MPU_SENSORS_LSM303DLHM is not set
+# CONFIG_MPU_SENSORS_YAS529 is not set
+# CONFIG_MPU_SENSORS_HSCDTD002B is not set
+# CONFIG_MPU_SENSORS_HSCDTD004A is not set
+CONFIG_MPU_SENSORS_TIMERIRQ=y
+# CONFIG_MPU_SENSORS_DEBUG is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_SERPORT=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_SERIO_PS2MULT is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+# CONFIG_VT is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_N_GSM is not set
+# CONFIG_N_SMUX is not set
+# CONFIG_TRACE_SINK is not set
+CONFIG_DEVMEM=y
+CONFIG_DEVKMEM=y
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_MAX3100 is not set
+# CONFIG_SERIAL_MAX3107 is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_SERIAL_MSM=y
+# CONFIG_SERIAL_MSM_CONSOLE is not set
+CONFIG_SERIAL_MSM_HS=y
+# CONFIG_SERIAL_MSM_CLOCK_CONTROL is not set
+CONFIG_SERIAL_MSM_HSL=y
+CONFIG_SERIAL_MSM_HSL_CONSOLE=y
+# CONFIG_SERIAL_BCM_BT_LPM is not set
+# CONFIG_SERIAL_TIMBERDALE is not set
+# CONFIG_SERIAL_ALTERA_JTAGUART is not set
+# CONFIG_SERIAL_ALTERA_UART is not set
+# CONFIG_SERIAL_IFX6X60 is not set
+# CONFIG_SERIAL_MSM_SMD is not set
+# CONFIG_SERIAL_XILINX_PS_UART is not set
+
+#
+# Diag Support
+#
+CONFIG_DIAG_CHAR=y
+
+#
+# DIAG traffic over USB
+#
+CONFIG_DIAG_OVER_USB=y
+
+#
+# SDIO support for DIAG
+#
+
+#
+# HSIC/SMUX support for DIAG
+#
+# CONFIG_TTY_PRINTK is not set
+# CONFIG_HVC_DCC is not set
+# CONFIG_IPMI_HANDLER is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_HW_RANDOM_TIMERIOMEM is not set
+CONFIG_HW_RANDOM_MSM=y
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+# CONFIG_DCC_TTY is not set
+# CONFIG_RAMOOPS is not set
+CONFIG_MSM_ROTATOR=y
+# CONFIG_MSM_ADSPRPC is not set
+# CONFIG_MMC_GENERIC_CSDIO is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_MUX is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_MSM is not set
+CONFIG_I2C_QUP=y
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_PXA_PCI is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_XILINX is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_DIOLAN_U2C is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_ALTERA is not set
+# CONFIG_SPI_BITBANG is not set
+# CONFIG_SPI_GPIO is not set
+# CONFIG_SPI_OC_TINY is not set
+# CONFIG_SPI_PXA2XX_PCI is not set
+# CONFIG_SPI_XILINX is not set
+CONFIG_SPI_QUP=y
+# CONFIG_SPI_DESIGNWARE is not set
+
+#
+# SPI Protocol Masters
+#
+CONFIG_SPI_SPIDEV=y
+# CONFIG_SPI_TLE62X0 is not set
+# CONFIG_SPMI is not set
+CONFIG_SLIMBUS=y
+CONFIG_SLIMBUS_MSM_CTRL=y
+# CONFIG_HSI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+
+#
+# PPS generators support
+#
+
+#
+# PTP clock support
+#
+
+#
+# Enable Device Drivers -> PPS to see the PTP clock options.
+#
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_GPIOLIB=y
+CONFIG_DEBUG_GPIO=y
+CONFIG_GPIO_SYSFS=y
+
+#
+# Memory mapped GPIO drivers:
+#
+# CONFIG_GPIO_GENERIC_PLATFORM is not set
+# CONFIG_GPIO_MSM_V1 is not set
+CONFIG_GPIO_MSM_V2=y
+# CONFIG_GPIO_MSM_V3 is not set
+# CONFIG_GPIO_FSM9XXX is not set
+
+#
+# I2C GPIO expanders:
+#
+# CONFIG_GPIO_MAX7300 is not set
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCF857X is not set
+CONFIG_GPIO_SX150X=y
+# CONFIG_GPIO_ADP5588 is not set
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+# CONFIG_GPIO_MAX7301 is not set
+# CONFIG_GPIO_MCP23S08 is not set
+# CONFIG_GPIO_MC33880 is not set
+# CONFIG_GPIO_74X164 is not set
+
+#
+# AC97 GPIO expanders:
+#
+
+#
+# MODULbus GPIO expanders:
+#
+CONFIG_GPIO_PM8XXX=y
+CONFIG_GPIO_PM8XXX_MPP=y
+# CONFIG_GPIO_PM8XXX_RPC is not set
+# CONFIG_W1 is not set
+CONFIG_POWER_SUPPLY=y
+# CONFIG_POWER_SUPPLY_DEBUG is not set
+# CONFIG_PDA_POWER is not set
+# CONFIG_TEST_POWER is not set
+# CONFIG_BATTERY_DS2780 is not set
+# CONFIG_BATTERY_DS2781 is not set
+# CONFIG_BATTERY_DS2782 is not set
+# CONFIG_BATTERY_SBS is not set
+# CONFIG_BATTERY_BQ27x00 is not set
+# CONFIG_BATTERY_MAX17040 is not set
+# CONFIG_BATTERY_MAX17042 is not set
+# CONFIG_CHARGER_ISP1704 is not set
+# CONFIG_CHARGER_MAX8903 is not set
+# CONFIG_CHARGER_LP8727 is not set
+# CONFIG_CHARGER_GPIO is not set
+# CONFIG_CHARGER_MANAGER is not set
+# CONFIG_BATTERY_MSM is not set
+# CONFIG_BATTERY_MSM8X60 is not set
+# CONFIG_ISL9519_CHARGER is not set
+# CONFIG_SMB137B_CHARGER is not set
+# CONFIG_SMB349_CHARGER is not set
+# CONFIG_BATTERY_BQ27520 is not set
+# CONFIG_BATTERY_BQ27541 is not set
+CONFIG_PM8921_CHARGER=y
+CONFIG_PM8XXX_CCADC=y
+# CONFIG_LTC4088_CHARGER is not set
+CONFIG_PM8921_BMS=y
+# CONFIG_BATTERY_BCL is not set
+# CONFIG_CHARGER_SMB347 is not set
+CONFIG_HWMON=y
+# CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
+# CONFIG_SENSORS_AD7314 is not set
+# CONFIG_SENSORS_AD7414 is not set
+# CONFIG_SENSORS_AD7418 is not set
+# CONFIG_SENSORS_ADCXX is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ADT7411 is not set
+# CONFIG_SENSORS_ADT7462 is not set
+# CONFIG_SENSORS_ADT7470 is not set
+# CONFIG_SENSORS_ADT7475 is not set
+# CONFIG_SENSORS_ASC7621 is not set
+# CONFIG_SENSORS_ATXP1 is not set
+# CONFIG_SENSORS_DS620 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_F75375S is not set
+# CONFIG_SENSORS_G760A is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_GL520SM is not set
+# CONFIG_SENSORS_GPIO_FAN is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_JC42 is not set
+# CONFIG_SENSORS_LINEAGE is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_LM73 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_LM92 is not set
+# CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_LTC4151 is not set
+# CONFIG_SENSORS_LTC4215 is not set
+# CONFIG_SENSORS_LTC4245 is not set
+# CONFIG_SENSORS_LTC4261 is not set
+# CONFIG_SENSORS_LM95241 is not set
+# CONFIG_SENSORS_LM95245 is not set
+# CONFIG_SENSORS_MAX1111 is not set
+# CONFIG_SENSORS_MAX16065 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX1668 is not set
+# CONFIG_SENSORS_MAX6639 is not set
+# CONFIG_SENSORS_MAX6642 is not set
+# CONFIG_SENSORS_MAX6650 is not set
+# CONFIG_SENSORS_MCP3021 is not set
+# CONFIG_SENSORS_NTC_THERMISTOR is not set
+CONFIG_SENSORS_PM8XXX_ADC=y
+# CONFIG_SENSORS_EPM_ADC is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_PMBUS is not set
+# CONFIG_SENSORS_SHT15 is not set
+# CONFIG_SENSORS_SHT21 is not set
+# CONFIG_SENSORS_SMM665 is not set
+# CONFIG_SENSORS_DME1737 is not set
+# CONFIG_SENSORS_EMC1403 is not set
+# CONFIG_SENSORS_EMC2103 is not set
+# CONFIG_SENSORS_EMC6W201 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47M192 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_SCH56XX_COMMON is not set
+# CONFIG_SENSORS_SCH5627 is not set
+# CONFIG_SENSORS_SCH5636 is not set
+# CONFIG_SENSORS_ADS1015 is not set
+# CONFIG_SENSORS_ADS7828 is not set
+# CONFIG_SENSORS_ADS7871 is not set
+# CONFIG_SENSORS_AMC6821 is not set
+# CONFIG_SENSORS_THMC50 is not set
+# CONFIG_SENSORS_TMP102 is not set
+# CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
+# CONFIG_SENSORS_VT1211 is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83791D is not set
+# CONFIG_SENSORS_W83792D is not set
+# CONFIG_SENSORS_W83793 is not set
+# CONFIG_SENSORS_W83795 is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83L786NG is not set
+# CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+CONFIG_THERMAL=y
+CONFIG_THERMAL_HWMON=y
+# CONFIG_THERMAL_MSM_POPMEM is not set
+# CONFIG_THERMAL_TSENS is not set
+CONFIG_THERMAL_TSENS8960=y
+# CONFIG_THERMAL_TSENS8974 is not set
+CONFIG_THERMAL_PM8XXX=y
+CONFIG_THERMAL_MONITOR=y
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+CONFIG_BCMA_POSSIBLE=y
+
+#
+# Broadcom specific AMBA
+#
+# CONFIG_BCMA is not set
+
+#
+# Multifunction device drivers
+#
+CONFIG_MFD_CORE=y
+# CONFIG_MFD_88PM860X is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_MFD_ASIC3 is not set
+# CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_HTC_I2CPLD is not set
+# CONFIG_TPS6105X is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_PMIC8058 is not set
+# CONFIG_PMIC8901 is not set
+# CONFIG_TPS6507X is not set
+# CONFIG_MFD_TPS65217 is not set
+# CONFIG_MFD_TPS6586X is not set
+# CONFIG_MFD_TPS65910 is not set
+# CONFIG_MFD_TPS65912_I2C is not set
+# CONFIG_MFD_TPS65912_SPI is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_TWL6040_CORE is not set
+# CONFIG_MFD_STMPE is not set
+# CONFIG_MFD_TC3589X is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_T7L66XB is not set
+# CONFIG_MFD_TC6387XB is not set
+# CONFIG_MFD_TC6393XB is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_DA9052_SPI is not set
+# CONFIG_MFD_DA9052_I2C is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_MAX8925 is not set
+# CONFIG_MFD_MAX8997 is not set
+# CONFIG_MFD_MAX8998 is not set
+# CONFIG_MFD_S5M_CORE is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X_I2C is not set
+# CONFIG_MFD_WM831X_SPI is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_WM8994 is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_MFD_MC13XXX is not set
+# CONFIG_ABX500_CORE is not set
+# CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_WL1273_CORE is not set
+CONFIG_MFD_PM8XXX=y
+CONFIG_MFD_PM8921_CORE=y
+# CONFIG_MFD_PM8821_CORE is not set
+# CONFIG_MFD_PM8018_CORE is not set
+# CONFIG_MFD_PM8038_CORE is not set
+CONFIG_MFD_PM8XXX_IRQ=y
+# CONFIG_MFD_PM8821_IRQ is not set
+# CONFIG_MFD_TPS65090 is not set
+# CONFIG_MFD_AAT2870_CORE is not set
+CONFIG_MFD_PM8XXX_DEBUG=y
+CONFIG_MFD_PM8XXX_PWM=y
+CONFIG_MFD_PM8XXX_MISC=y
+CONFIG_MFD_PM8XXX_SPK=y
+CONFIG_MFD_PM8XXX_BATT_ALARM=y
+# CONFIG_WCD9304_CODEC is not set
+CONFIG_WCD9310_CODEC=y
+# CONFIG_WCD9320_CODEC is not set
+# CONFIG_MFD_RC5T583 is not set
+CONFIG_REGULATOR=y
+# CONFIG_REGULATOR_DEBUG is not set
+# CONFIG_REGULATOR_DUMMY is not set
+# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
+# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
+# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
+CONFIG_REGULATOR_GPIO=y
+# CONFIG_REGULATOR_AD5398 is not set
+# CONFIG_REGULATOR_ISL6271A is not set
+# CONFIG_REGULATOR_MAX1586 is not set
+# CONFIG_REGULATOR_MAX8649 is not set
+# CONFIG_REGULATOR_MAX8660 is not set
+# CONFIG_REGULATOR_MAX8952 is not set
+# CONFIG_REGULATOR_LP3971 is not set
+# CONFIG_REGULATOR_LP3972 is not set
+# CONFIG_REGULATOR_TPS62360 is not set
+# CONFIG_REGULATOR_TPS65023 is not set
+# CONFIG_REGULATOR_TPS6507X is not set
+# CONFIG_REGULATOR_TPS6524X is not set
+CONFIG_REGULATOR_PM8XXX=y
+# CONFIG_REGULATOR_MSM_GPIO is not set
+# CONFIG_REGULATOR_STUB is not set
+CONFIG_MEDIA_SUPPORT=y
+
+#
+# Multimedia core support
+#
+# CONFIG_MEDIA_CONTROLLER is not set
+CONFIG_VIDEO_DEV=y
+CONFIG_VIDEO_V4L2_COMMON=y
+# CONFIG_DVB_CORE is not set
+CONFIG_VIDEO_MEDIA=y
+
+#
+# Multimedia drivers
+#
+CONFIG_RC_CORE=y
+CONFIG_LIRC=y
+# CONFIG_USER_RC_INPUT is not set
+CONFIG_RC_MAP=y
+CONFIG_IR_NEC_DECODER=y
+CONFIG_IR_RC5_DECODER=y
+CONFIG_IR_RC6_DECODER=y
+CONFIG_IR_JVC_DECODER=y
+CONFIG_IR_SONY_DECODER=y
+CONFIG_IR_RC5_SZ_DECODER=y
+CONFIG_IR_SANYO_DECODER=y
+CONFIG_IR_MCE_KBD_DECODER=y
+CONFIG_IR_LIRC_CODEC=y
+# CONFIG_RC_ATI_REMOTE is not set
+# CONFIG_IR_IMON is not set
+# CONFIG_IR_MCEUSB is not set
+# CONFIG_IR_REDRAT3 is not set
+# CONFIG_IR_STREAMZAP is not set
+# CONFIG_RC_LOOPBACK is not set
+# CONFIG_IR_GPIO_CIR is not set
+# CONFIG_MEDIA_ATTACH is not set
+CONFIG_MEDIA_TUNER=y
+# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
+CONFIG_MEDIA_TUNER_SIMPLE=y
+CONFIG_MEDIA_TUNER_TDA8290=y
+CONFIG_MEDIA_TUNER_TDA827X=y
+CONFIG_MEDIA_TUNER_TDA18271=y
+CONFIG_MEDIA_TUNER_TDA9887=y
+CONFIG_MEDIA_TUNER_TEA5761=y
+CONFIG_MEDIA_TUNER_TEA5767=y
+CONFIG_MEDIA_TUNER_MT20XX=y
+CONFIG_MEDIA_TUNER_XC2028=y
+CONFIG_MEDIA_TUNER_XC5000=y
+CONFIG_MEDIA_TUNER_XC4000=y
+CONFIG_MEDIA_TUNER_MC44S803=y
+CONFIG_VIDEO_V4L2=y
+CONFIG_VIDEOBUF2_CORE=y
+CONFIG_VIDEOBUF2_MEMOPS=y
+CONFIG_VIDEOBUF2_DMA_CONTIG=y
+CONFIG_VIDEOBUF2_VMALLOC=y
+CONFIG_VIDEOBUF2_DMA_SG=y
+CONFIG_VIDEOBUF2_MSM_MEM=y
+CONFIG_VIDEO_CAPTURE_DRIVERS=y
+# CONFIG_VIDEO_ADV_DEBUG is not set
+# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
+CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
+CONFIG_VIDEO_IR_I2C=y
+
+#
+# Audio decoders, processors and mixers
+#
+
+#
+# RDS decoders
+#
+
+#
+# Video decoders
+#
+
+#
+# Video and audio decoders
+#
+
+#
+# MPEG video encoders
+#
+
+#
+# Video encoders
+#
+
+#
+# Camera sensor devices
+#
+
+#
+# Flash devices
+#
+
+#
+# Video improvement chips
+#
+
+#
+# Miscelaneous helper chips
+#
+# CONFIG_MSM_VCAP is not set
+# CONFIG_V4L_USB_DRIVERS is not set
+CONFIG_V4L_PLATFORM_DRIVERS=y
+# CONFIG_SOC_CAMERA is not set
+
+#
+# Qualcomm MSM Camera And Video
+#
+CONFIG_MSM_CAMERA=y
+# CONFIG_MSM_CAMERA_DEBUG is not set
+CONFIG_MSM_CAMERA_V4L2=y
+
+#
+# Camera Sensor Selection
+#
+# CONFIG_IMX074 is not set
+CONFIG_S5K3H2YX=y
+CONFIG_S5K6A1GX=y
+# CONFIG_AR0260 is not set
+# CONFIG_OV2722 is not set
+# CONFIG_OV5647 is not set
+# CONFIG_MT9M114 is not set
+# CONFIG_IMX074_ACT is not set
+CONFIG_S5K3H2YX_ACT=y
+# CONFIG_S5K4E1 is not set
+CONFIG_MSM_CAMERA_FLASH_SC628A=y
+# CONFIG_IMX072 is not set
+# CONFIG_OV2720 is not set
+CONFIG_MSM_CAMERA_FLASH=y
+CONFIG_MSM_CAMERA_SENSOR=y
+CONFIG_MSM_ACTUATOR=y
+CONFIG_MSM_GEMINI=y
+CONFIG_RAWCHIP=y
+CONFIG_QUP_EXCLUSIVE_TO_CAMERA=y
+# CONFIG_S5K3L1YX is not set
+# CONFIG_IMX091 is not set
+# CONFIG_IMX175 is not set
+# CONFIG_IMX135 is not set
+# CONFIG_OV8838 is not set
+CONFIG_IMX175_ACT=y
+# CONFIG_AD5823_ACT is not set
+# CONFIG_AD5816_ACT is not set
+# CONFIG_TI201_ACT is not set
+# CONFIG_MT9V113 is not set
+CONFIG_IMX175_2LANE=y
+# CONFIG_OV5693_ACT is not set
+# CONFIG_OV5693 is not set
+# CONFIG_RAWCHIP_MCLK is not set
+# CONFIG_S5K6A2YA is not set
+# CONFIG_V4L_MEM2MEM_DRIVERS is not set
+# CONFIG_MSM_WFD is not set
+CONFIG_RADIO_ADAPTERS=y
+# CONFIG_RADIO_SI470X is not set
+# CONFIG_USB_MR800 is not set
+# CONFIG_USB_DSBR is not set
+# CONFIG_I2C_SI4713 is not set
+# CONFIG_RADIO_SI4713 is not set
+# CONFIG_USB_KEENE is not set
+# CONFIG_RADIO_TEA5764 is not set
+# CONFIG_RADIO_SAA7706H is not set
+# CONFIG_RADIO_TEF6862 is not set
+# CONFIG_RADIO_WL1273 is not set
+
+#
+# Texas Instruments WL128x FM driver (ST based)
+#
+# CONFIG_RADIO_WL128X is not set
+CONFIG_RADIO_IRIS=y
+CONFIG_RADIO_IRIS_TRANSPORT=m
+
+#
+# Graphics support
+#
+CONFIG_DRM=y
+CONFIG_DRM_USB=y
+CONFIG_DRM_KMS_HELPER=y
+# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
+
+#
+# I2C encoder or helper chips
+#
+# CONFIG_DRM_I2C_CH7006 is not set
+# CONFIG_DRM_I2C_SIL164 is not set
+CONFIG_DRM_UDL=y
+CONFIG_ION=y
+CONFIG_ION_MSM=y
+CONFIG_MSM_KGSL=y
+# CONFIG_MSM_KGSL_CFF_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_CP_STAT_NO_DETAIL is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_NO_IB_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_RB_HEX is not set
+CONFIG_MSM_KGSL_2D=y
+# CONFIG_MSM_KGSL_DRM is not set
+CONFIG_KGSL_PER_PROCESS_PAGE_TABLE=y
+CONFIG_MSM_KGSL_PAGE_TABLE_SIZE=0xFFF0000
+CONFIG_MSM_KGSL_PAGE_TABLE_COUNT=32
+CONFIG_MSM_KGSL_MMU_PAGE_FAULT=y
+# CONFIG_MSM_KGSL_DISABLE_SHADOW_WRITES is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+CONFIG_FB_SYS_FILLRECT=y
+CONFIG_FB_SYS_COPYAREA=y
+CONFIG_FB_SYS_IMAGEBLIT=y
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_WMT_GE_ROPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+# CONFIG_FB_TMIO is not set
+# CONFIG_FB_SMSCUFX is not set
+# CONFIG_FB_UDL is not set
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_BROADSHEET is not set
+CONFIG_MSM_VIDC=y
+CONFIG_MSM_VIDC_1080P=y
+CONFIG_MSM_VIDC_VENC=y
+CONFIG_MSM_VIDC_VDEC=y
+# CONFIG_MSM_VIDC_CONTENT_PROTECTION is not set
+CONFIG_FB_MSM=y
+# CONFIG_FB_MSM_BACKLIGHT is not set
+# CONFIG_FB_MSM_LOGO is not set
+CONFIG_FB_MSM_LCDC_HW=y
+CONFIG_FB_MSM_TRIPLE_BUFFER=y
+CONFIG_FB_MSM_MDP_HW=y
+# CONFIG_FB_MSM_MDP22 is not set
+# CONFIG_FB_MSM_MDP30 is not set
+# CONFIG_FB_MSM_MDP31 is not set
+CONFIG_FB_MSM_MDP40=y
+# CONFIG_FB_MSM_MDSS is not set
+# CONFIG_FB_MSM_MDP_NONE is not set
+# CONFIG_FB_MSM_EBI2 is not set
+# CONFIG_FB_MSM_MDDI is not set
+CONFIG_FB_MSM_MIPI_DSI=y
+# CONFIG_FB_MSM_LCDC is not set
+# CONFIG_FB_MSM_LVDS is not set
+CONFIG_FB_MSM_OVERLAY=y
+CONFIG_FB_MSM_DTV=y
+# CONFIG_FB_MSM_EXTMDDI is not set
+# CONFIG_FB_MSM_TVOUT is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_COMMON is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_COMMON_VGA is not set
+# CONFIG_FB_MSM_MDDI_ORISE is not set
+# CONFIG_FB_MSM_MDDI_QUICKVX is not set
+# CONFIG_FB_MSM_MDDI_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_PANEL is not set
+# CONFIG_FB_MSM_MIPI_DSI_TOSHIBA is not set
+# CONFIG_FB_MSM_MIPI_DSI_LGIT is not set
+# CONFIG_FB_MSM_MIPI_DSI_RENESAS is not set
+# CONFIG_FB_MSM_MIPI_DSI_SIMULATOR is not set
+# CONFIG_FB_MSM_MIPI_DSI_NOVATEK is not set
+# CONFIG_FB_MSM_MIPI_DSI_ORISE is not set
+# CONFIG_FB_MSM_LCDC_ST15_WXGA is not set
+# CONFIG_FB_MSM_LCDC_ST15_PANEL is not set
+# CONFIG_FB_MSM_LCDC_PRISM_WVGA is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_WSVGA is not set
+# CONFIG_FB_MSM_LCDC_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_LCDC_GORDON_VGA is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_WVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_FWVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_SHARP_WVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_AUO_WVGA is not set
+# CONFIG_FB_MSM_LCDC_TRULY_HVGA_IPS3P2335 is not set
+# CONFIG_FB_MSM_LCDC_TRULY_HVGA_IPS3P2335_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT is not set
+# CONFIG_FB_MSM_LCDC_NT35582_WVGA is not set
+# CONFIG_FB_MSM_LCDC_WXGA is not set
+# CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WXGA_PT is not set
+# CONFIG_FB_MSM_LVDS_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WSVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WUXGA is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_CMD_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_ORISE_VIDEO_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_ORISE_CMD_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_VIDEO_FWVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_CMD_FWVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35510_VIDEO_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35510_CMD_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35516_VIDEO_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35516_CMD_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35590_CMD_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35590_VIDEO_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WUXGA is not set
+# CONFIG_FB_MSM_MIPI_SIMULATOR_VIDEO is not set
+CONFIG_FB_MSM_NO_MDP_PIPE_CTRL=y
+CONFIG_FB_MSM_OVERLAY0_WRITEBACK=y
+CONFIG_FB_MSM_OVERLAY1_WRITEBACK=y
+CONFIG_FB_MSM_WRITEBACK_MSM_PANEL=y
+# CONFIG_FB_MSM_LCDC_PRISM_WVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_WSVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_GORDON_VGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SHARP_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_AUO_WVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_NT35582_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT_PANEL is not set
+# CONFIG_FB_MSM_LVDS_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_LVDS_FRC_FHD_PANEL is not set
+# CONFIG_FB_MSM_TRY_MDDI_CATCH_LCDC_PRISM is not set
+# CONFIG_FB_MSM_MIPI_PANEL_DETECT is not set
+# CONFIG_FB_MSM_MDDI_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LVDS_MIPI_PANEL_DETECT is not set
+# CONFIG_FB_MSM_MDDI_PRISM_WVGA is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_WVGA_PORTRAIT is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_VGA is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_WVGA is not set
+# CONFIG_FB_MSM_MDDI_SHARP_QVGA_128x128 is not set
+# CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WXGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WSVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WUXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_CMD_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_ORISE_VIDEO_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_ORISE_CMD_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_VIDEO_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_CMD_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WUXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TRULY_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35510_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35510_CMD_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35516_VIDEO_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35516_CMD_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35590_CMD_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35590_VIDEO_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_SIMULATOR_VIDEO_PANEL is not set
+# CONFIG_FB_MSM_EBI2_TMD_QVGA_EPSON_QCIF is not set
+# CONFIG_FB_MSM_HDMI_AS_PRIMARY is not set
+CONFIG_FB_MSM_PANEL_NONE=y
+CONFIG_FB_MSM_EXT_INTERFACE_COMMON=y
+CONFIG_FB_MSM_HDMI_COMMON=y
+CONFIG_FB_MSM_HDMI_3D=y
+# CONFIG_FB_MSM_HDMI_ADV7520_PANEL is not set
+CONFIG_FB_MSM_HDMI_MSM_PANEL=y
+# CONFIG_FB_MSM_HDMI_MSM_PANEL_DVI_SUPPORT is not set
+# CONFIG_FB_MSM_HDMI_MSM_PANEL_CEC_SUPPORT is not set
+# CONFIG_FB_MSM_HDMI_MHL_9244 is not set
+# CONFIG_FB_MSM_HDMI_MHL_8334 is not set
+# CONFIG_FB_MSM_TVOUT_NTSC_M is not set
+# CONFIG_FB_MSM_TVOUT_NTSC_J is not set
+# CONFIG_FB_MSM_TVOUT_PAL_BDGHIN is not set
+# CONFIG_FB_MSM_TVOUT_PAL_M is not set
+# CONFIG_FB_MSM_TVOUT_PAL_N is not set
+CONFIG_FB_MSM_TVOUT_NONE=y
+# CONFIG_FB_MSM_DEFAULT_DEPTH_RGB565 is not set
+# CONFIG_FB_MSM_DEFAULT_DEPTH_ARGB8888 is not set
+CONFIG_FB_MSM_DEFAULT_DEPTH_RGBA8888=y
+# CONFIG_FB_MSM_EBI2_EPSON_S1D_QVGA_PANEL is not set
+# CONFIG_FB_MSM_EBI2_PANEL_DETECT is not set
+# CONFIG_EXYNOS_VIDEO is not set
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_LCD_CLASS_DEVICE=y
+# CONFIG_LCD_L4F00242T03 is not set
+# CONFIG_LCD_LMS283GF05 is not set
+# CONFIG_LCD_LTV350QV is not set
+# CONFIG_LCD_TDO24M is not set
+# CONFIG_LCD_VGG2432A4 is not set
+# CONFIG_LCD_PLATFORM is not set
+# CONFIG_LCD_S6E63M0 is not set
+# CONFIG_LCD_LD9040 is not set
+# CONFIG_LCD_AMS369FG06 is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_GENERIC=y
+# CONFIG_BACKLIGHT_ADP8860 is not set
+# CONFIG_BACKLIGHT_ADP8870 is not set
+# CONFIG_BACKLIGHT_LP855X is not set
+# CONFIG_BACKLIGHT_LM3530 is not set
+# CONFIG_BACKLIGHT_LM3533 is not set
+# CONFIG_LOGO is not set
+CONFIG_SOUND=y
+# CONFIG_SOUND_OSS_CORE is not set
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_HWDEP=y
+CONFIG_SND_RAWMIDI=y
+CONFIG_SND_JACK=y
+# CONFIG_SND_SEQUENCER is not set
+# CONFIG_SND_MIXER_OSS is not set
+# CONFIG_SND_PCM_OSS is not set
+# CONFIG_SND_HRTIMER is not set
+CONFIG_SND_DYNAMIC_MINORS=y
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_DRIVERS=y
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_ALOOP is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+# CONFIG_SND_ARM is not set
+# CONFIG_SND_SPI is not set
+CONFIG_SND_USB=y
+CONFIG_SND_USB_AUDIO=y
+# CONFIG_SND_USB_UA101 is not set
+# CONFIG_SND_USB_CAIAQ is not set
+# CONFIG_SND_USB_6FIRE is not set
+CONFIG_SND_SOC=y
+
+#
+# MSM SoC Audio support
+#
+CONFIG_SND_SOC_MSM_HOSTLESS_PCM=y
+CONFIG_SND_SOC_MSM_QDSP6_HDMI_AUDIO=y
+CONFIG_SND_SOC_MSM_QDSP6_INTF=y
+# CONFIG_SND_SOC_MSM_QDSP6V2_INTF is not set
+CONFIG_SND_SOC_VOICE=y
+CONFIG_SND_SOC_QDSP6=y
+# CONFIG_SND_SOC_QDSP6V2 is not set
+CONFIG_SND_SOC_MSM8960=y
+# CONFIG_SND_SOC_DUAL_AMIC is not set
+CONFIG_SND_SOC_I2C_AND_SPI=y
+# CONFIG_SND_SOC_ALL_CODECS is not set
+CONFIG_SND_SOC_WCD9304=y
+CONFIG_SND_SOC_WCD9310=y
+CONFIG_SND_SOC_CS8427=y
+CONFIG_SND_SOC_MSM_STUB=y
+# CONFIG_SND_SOC_TPA2028D is not set
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_BATTERY_STRENGTH is not set
+# CONFIG_HIDRAW is not set
+# CONFIG_UHID is not set
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+# CONFIG_USB_HIDDEV is not set
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_ACRUX is not set
+CONFIG_HID_APPLE=y
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_PRODIKEYS is not set
+# CONFIG_HID_CYPRESS is not set
+CONFIG_HID_DRAGONRISE=y
+# CONFIG_DRAGONRISE_FF is not set
+# CONFIG_HID_EMS_FF is not set
+# CONFIG_HID_ELECOM is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_HOLTEK is not set
+# CONFIG_HID_KEYTOUCH is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_UCLOGIC is not set
+# CONFIG_HID_WALTOP is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LCPOWER is not set
+CONFIG_HID_LOGITECH=y
+CONFIG_HID_LOGITECH_DJ=y
+# CONFIG_LOGITECH_FF is not set
+# CONFIG_LOGIRUMBLEPAD2_FF is not set
+# CONFIG_LOGIG940_FF is not set
+# CONFIG_LOGIWHEELS_FF is not set
+CONFIG_HID_MAGICMOUSE=y
+CONFIG_HID_MICROSOFT=y
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_MULTITOUCH is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_ORTEK is not set
+CONFIG_HID_PANTHERLORD=y
+# CONFIG_PANTHERLORD_FF is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_PICOLCD is not set
+# CONFIG_HID_PRIMAX is not set
+# CONFIG_HID_ROCCAT is not set
+# CONFIG_HID_SAITEK is not set
+# CONFIG_HID_SAMSUNG is not set
+CONFIG_HID_SONY=y
+# CONFIG_HID_SPEEDLINK is not set
+# CONFIG_HID_SUNPLUS is not set
+CONFIG_HID_GREENASIA=y
+# CONFIG_GREENASIA_FF is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TIVO is not set
+# CONFIG_HID_TOPSEED is not set
+CONFIG_HID_THRUSTMASTER=y
+# CONFIG_THRUSTMASTER_FF is not set
+# CONFIG_HID_WACOM is not set
+# CONFIG_HID_WIIMOTE is not set
+CONFIG_HID_ZEROPLUS=y
+# CONFIG_ZEROPLUS_FF is not set
+# CONFIG_HID_ZYDACRON is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+CONFIG_USB_ARCH_HAS_EHCI=y
+# CONFIG_USB_ARCH_HAS_XHCI is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_COMMON=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+CONFIG_USB_SUSPEND=y
+CONFIG_USB_OTG=y
+CONFIG_USB_OTG_WHITELIST=y
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_DWC3 is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_EHSET=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+# CONFIG_USB_EHCI_TT_NEWSCHED is not set
+CONFIG_USB_EHCI_MSM=y
+# CONFIG_USB_EHCI_MSM_HSIC is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+# CONFIG_USB_EHCI_HCD_PLATFORM is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_PEHCI_HCD is not set
+# CONFIG_USB_MUSB_HDRC is not set
+
+#
+# USB Device Class drivers
+#
+CONFIG_USB_ACM=y
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+
+#
+# also be needed; see USB_STORAGE Help for more info
+#
+CONFIG_USB_STORAGE=y
+CONFIG_USB_STORAGE_DEBUG=y
+# CONFIG_USB_STORAGE_REALTEK is not set
+CONFIG_USB_STORAGE_DATAFAB=y
+CONFIG_USB_STORAGE_FREECOM=y
+CONFIG_USB_STORAGE_ISD200=y
+CONFIG_USB_STORAGE_USBAT=y
+CONFIG_USB_STORAGE_SDDR09=y
+CONFIG_USB_STORAGE_SDDR55=y
+CONFIG_USB_STORAGE_JUMPSHOT=y
+CONFIG_USB_STORAGE_ALAUDA=y
+CONFIG_USB_STORAGE_ONETOUCH=y
+CONFIG_USB_STORAGE_KARMA=y
+CONFIG_USB_STORAGE_CYPRESS_ATACB=y
+# CONFIG_USB_STORAGE_ENE_UB6250 is not set
+# CONFIG_USB_UAS is not set
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+CONFIG_USB_EHSET_TEST_FIXTURE=y
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_YUREX is not set
+# CONFIG_USB_QCOM_DIAG_BRIDGE is not set
+# CONFIG_USB_QCOM_MDM_BRIDGE is not set
+# CONFIG_USB_QCOM_KS_BRIDGE is not set
+CONFIG_USB_GADGET=y
+# CONFIG_USB_GADGET_DEBUG is not set
+CONFIG_USB_GADGET_DEBUG_FILES=y
+# CONFIG_USB_GADGET_DEBUG_FS is not set
+CONFIG_USB_GADGET_VBUS_DRAW=500
+CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
+
+#
+# USB Peripheral Controller
+#
+# CONFIG_USB_FUSB300 is not set
+# CONFIG_USB_R8A66597 is not set
+# CONFIG_USB_MV_UDC is not set
+# CONFIG_USB_M66592 is not set
+# CONFIG_USB_NET2272 is not set
+CONFIG_USB_CI13XXX_MSM=y
+# CONFIG_USB_CI13XXX_MSM_HSIC is not set
+# CONFIG_USB_DWC3_MSM is not set
+# CONFIG_USB_MSM_72K is not set
+# CONFIG_USB_DUMMY_HCD is not set
+CONFIG_USB_GADGET_DUALSPEED=y
+# CONFIG_USB_GADGET_SUPERSPEED is not set
+# CONFIG_USB_ZERO is not set
+# CONFIG_USB_AUDIO is not set
+# CONFIG_USB_ETH is not set
+# CONFIG_USB_G_NCM is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FUNCTIONFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_MASS_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+# CONFIG_USB_G_PRINTER is not set
+CONFIG_USB_G_ANDROID=y
+# CONFIG_USB_CDC_COMPOSITE is not set
+# CONFIG_USB_G_ACM_MS is not set
+# CONFIG_USB_G_MULTI is not set
+# CONFIG_USB_G_HID is not set
+# CONFIG_USB_G_DBGP is not set
+# CONFIG_USB_G_WEBCAM is not set
+CONFIG_USB_CSW_HACK=y
+# CONFIG_USB_MSC_PROFILING is not set
+# CONFIG_MODEM_SUPPORT is not set
+CONFIG_RMNET_SMD_CTL_CHANNEL=""
+CONFIG_RMNET_SMD_DATA_CHANNEL=""
+CONFIG_USB_ANDROID_RMNET_CTRL_SMD=y
+# CONFIG_USB_ANDROID_CDC_ECM is not set
+
+#
+# OTG and related infrastructure
+#
+CONFIG_USB_OTG_UTILS=y
+# CONFIG_USB_OTG_WAKELOCK is not set
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_USB_ULPI is not set
+# CONFIG_USB_MSM_OTG_72K is not set
+# CONFIG_NOP_USB_XCEIV is not set
+CONFIG_USB_MSM_OTG=y
+# CONFIG_USB_MSM_ACA is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+CONFIG_MMC_PERF_PROFILING=y
+CONFIG_MMC_UNSAFE_RESUME=y
+# CONFIG_MMC_CLKGATE is not set
+# CONFIG_MMC_EMBEDDED_SDIO is not set
+CONFIG_MMC_PARANOID_SD_INIT=y
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_MINORS=64
+CONFIG_MMC_BLOCK_BOUNCE=y
+# CONFIG_MMC_BLOCK_DEFERRED_RESUME is not set
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+# CONFIG_MMC_SDHCI is not set
+# CONFIG_MMC_SDHCI_PXAV3 is not set
+# CONFIG_MMC_SDHCI_PXAV2 is not set
+CONFIG_MMC_MSM=y
+CONFIG_MMC_MSM_SDC1_SUPPORT=y
+CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT=y
+# CONFIG_MMC_MSM_SDC2_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC3_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC3_POLLING is not set
+# CONFIG_MMC_MSM_SDC4_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC5_SUPPORT is not set
+CONFIG_MMC_MSM_SPS_SUPPORT=y
+# CONFIG_MMC_DW is not set
+# CONFIG_MMC_VUB300 is not set
+# CONFIG_MMC_USHC is not set
+# CONFIG_MEMSTICK is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_LM3530 is not set
+# CONFIG_LEDS_PCA9532 is not set
+# CONFIG_LEDS_GPIO is not set
+# CONFIG_LEDS_MSM_PDM is not set
+# CONFIG_LEDS_PMIC_MPP is not set
+# CONFIG_LEDS_MSM_TRICOLOR is not set
+# CONFIG_LEDS_LP3944 is not set
+# CONFIG_LEDS_CPLD is not set
+# CONFIG_LEDS_LP5521 is not set
+# CONFIG_LEDS_LP5523 is not set
+# CONFIG_LEDS_PCA955X is not set
+CONFIG_LEDS_PM8XXX=y
+# CONFIG_LEDS_PCA9633 is not set
+# CONFIG_LEDS_DAC124S085 is not set
+# CONFIG_LEDS_REGULATOR is not set
+# CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_MSM_PMIC is not set
+# CONFIG_LEDS_LT3593 is not set
+# CONFIG_LEDS_RENESAS_TPU is not set
+# CONFIG_LEDS_TCA6507 is not set
+# CONFIG_LEDS_OT200 is not set
+# CONFIG_LEDS_TRIGGERS is not set
+
+#
+# LED Triggers
+#
+
+#
+# LED Flashlights
+#
+CONFIG_FLASHLIGHT_TPS61310=y
+CONFIG_SWITCH=y
+# CONFIG_SWITCH_GPIO is not set
+# CONFIG_SWITCH_FSA8008 is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+CONFIG_RTC_INTF_ALARM=y
+CONFIG_RTC_INTF_ALARM_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# I2C RTC drivers
+#
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_DS3232 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_ISL12022 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
+# CONFIG_RTC_DRV_EM3027 is not set
+# CONFIG_RTC_DRV_RV3029C2 is not set
+
+#
+# SPI RTC drivers
+#
+# CONFIG_RTC_DRV_M41T93 is not set
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
+# CONFIG_RTC_DRV_MAX6902 is not set
+# CONFIG_RTC_DRV_R9701 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_DS3234 is not set
+# CONFIG_RTC_DRV_PCF2123 is not set
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# on-CPU RTC drivers
+#
+# CONFIG_RTC_DRV_MSM is not set
+# CONFIG_RTC_DRV_MSM7X00A is not set
+CONFIG_RTC_DRV_PM8XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+
+#
+# Virtio drivers
+#
+# CONFIG_VIRTIO_BALLOON is not set
+# CONFIG_VIRTIO_MMIO is not set
+
+#
+# Microsoft Hyper-V guest support
+#
+CONFIG_STAGING=y
+# CONFIG_USBIP_CORE is not set
+# CONFIG_PRISM2_USB is not set
+# CONFIG_ECHO is not set
+# CONFIG_ASUS_OLED is not set
+# CONFIG_RTLLIB is not set
+# CONFIG_R8712U is not set
+# CONFIG_RTS5139 is not set
+# CONFIG_TRANZPORT is not set
+# CONFIG_LINE6_USB is not set
+# CONFIG_VT6656 is not set
+# CONFIG_IIO is not set
+CONFIG_QCACHE=y
+# CONFIG_FB_SM7XX is not set
+# CONFIG_USB_ENESTORAGE is not set
+# CONFIG_BCM_WIMAX is not set
+# CONFIG_FT1000 is not set
+
+#
+# Speakup console speech
+#
+# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4_STAGING is not set
+# CONFIG_STAGING_MEDIA is not set
+
+#
+# Android
+#
+CONFIG_ANDROID=y
+CONFIG_ANDROID_BINDER_IPC=y
+CONFIG_ANDROID_LOGGER=y
+CONFIG_ANDROID_PERSISTENT_RAM=y
+CONFIG_ANDROID_RAM_CONSOLE=y
+CONFIG_ANDROID_RAM_CONSOLE_ENABLE_VERBOSE=y
+# CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION is not set
+# CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT is not set
+# CONFIG_PERSISTENT_TRACER is not set
+CONFIG_ANDROID_TIMED_OUTPUT=y
+CONFIG_ANDROID_TIMED_GPIO=y
+CONFIG_ANDROID_LOW_MEMORY_KILLER=y
+CONFIG_ANDROID_LOW_MEMORY_KILLER_AUTODETECT_OOM_ADJ_VALUES=y
+# CONFIG_ANDROID_SWITCH is not set
+# CONFIG_ANDROID_INTF_ALARM_DEV is not set
+# CONFIG_PHONE is not set
+# CONFIG_USB_WPAN_HCD is not set
+
+#
+# Qualcomm Atheros Prima WLAN module
+#
+CONFIG_PRIMA_WLAN=m
+# CONFIG_PRIMA_WLAN_BTAMP is not set
+CONFIG_HTC_WIFI_NVS=y
+
+#
+# Qualcomm MSM specific device drivers
+#
+CONFIG_MSM_SSBI=y
+CONFIG_SPS=y
+# CONFIG_USB_BAM is not set
+CONFIG_SPS_SUPPORT_BAMDMA=y
+# CONFIG_SPS_SUPPORT_NDP_BAM is not set
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_HAVE_CLK_PREPARE=y
+
+#
+# Hardware Spinlock drivers
+#
+CONFIG_IOMMU_SUPPORT=y
+CONFIG_MSM_IOMMU=y
+CONFIG_MSM_IOMMU_GPU_SYNC=y
+CONFIG_IOMMU_PGTABLES_L2=y
+
+#
+# Remoteproc drivers (EXPERIMENTAL)
+#
+
+#
+# Rpmsg drivers (EXPERIMENTAL)
+#
+# CONFIG_VIRT_DRIVERS is not set
+# CONFIG_PM_DEVFREQ is not set
+# CONFIG_MOBICORE_SUPPORT is not set
+# CONFIG_CORESIGHT is not set
+
+#
+# File systems
+#
+# CONFIG_EXT2_FS is not set
+# CONFIG_EXT3_FS is not set
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_USE_FOR_EXT23=y
+CONFIG_EXT4_FS_XATTR=y
+# CONFIG_EXT4_FS_POSIX_ACL is not set
+# CONFIG_EXT4_FS_SECURITY is not set
+# CONFIG_EXT4_DEBUG is not set
+CONFIG_JBD2=y
+# CONFIG_JBD2_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FS_POSIX_ACL=y
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_FANOTIFY is not set
+# CONFIG_QUOTA is not set
+# CONFIG_QUOTACTL is not set
+# CONFIG_AUTOFS4_FS is not set
+CONFIG_FUSE_FS=y
+# CONFIG_CUSE is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+# CONFIG_MSDOS_FS is not set
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_ECRYPT_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_LOGFS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_QNX6FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_PSTORE is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+# CONFIG_NFS_V4_1 is not set
+# CONFIG_ROOT_NFS is not set
+# CONFIG_NFS_USE_LEGACY_DNS is not set
+CONFIG_NFS_USE_KERNEL_DNS=y
+# CONFIG_NFSD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_ACL_SUPPORT=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+CONFIG_SUNRPC_GSS=y
+# CONFIG_SUNRPC_DEBUG is not set
+# CONFIG_CEPH_FS is not set
+CONFIG_CIFS=y
+# CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_UPCALL is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_DFS_UPCALL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+CONFIG_NLS_ASCII=y
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_UTF8 is not set
+
+#
+# Kernel hacking
+#
+CONFIG_PRINTK_TIME=y
+CONFIG_DEFAULT_MESSAGE_LOGLEVEL=1
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_SECTION_MISMATCH=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_LOCKUP_DETECTOR is not set
+# CONFIG_HARDLOCKUP_DETECTOR is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+CONFIG_TIMER_STATS=y
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
+CONFIG_DEBUG_KMEMLEAK=y
+CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
+# CONFIG_DEBUG_KMEMLEAK_TEST is not set
+CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
+# CONFIG_DEBUG_PREEMPT is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_SPARSE_RCU_POINTER is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_ATOMIC_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+CONFIG_STACKTRACE=y
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_HIGHMEM is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_INFO_REDUCED is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+CONFIG_DEBUG_MEMORY_INIT=y
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_TEST_LIST_SORT is not set
+# CONFIG_DEBUG_SG is not set
+CONFIG_DEBUG_NOTIFIERS=y
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+CONFIG_RCU_CPU_STALL_TIMEOUT=60
+CONFIG_RCU_CPU_STALL_VERBOSE=y
+# CONFIG_RCU_CPU_STALL_INFO is not set
+# CONFIG_RCU_TRACE is not set
+# CONFIG_KPROBES_SANITY_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_DEBUG_PER_CPU_MAPS is not set
+# CONFIG_LKDTM is not set
+# CONFIG_CPU_NOTIFIER_ERROR_INJECT is not set
+CONFIG_FAULT_INJECTION=y
+CONFIG_FAILSLAB=y
+CONFIG_FAIL_PAGE_ALLOC=y
+# CONFIG_FAIL_MAKE_REQUEST is not set
+# CONFIG_FAIL_IO_TIMEOUT is not set
+# CONFIG_FAIL_MMC_REQUEST is not set
+CONFIG_FAULT_INJECTION_DEBUG_FS=y
+CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
+# CONFIG_DEBUG_PAGEALLOC is not set
+CONFIG_NOP_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_RING_BUFFER=y
+CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
+CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_RING_BUFFER_ALLOW_SWAP=y
+CONFIG_TRACING=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_PREEMPT_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+CONFIG_ENABLE_DEFAULT_TRACERS=y
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_KPROBE_EVENT=y
+# CONFIG_CPU_FREQ_SWITCH_PROFILER is not set
+# CONFIG_RING_BUFFER_BENCHMARK is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_ATOMIC64_SELFTEST is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_TEST_KSTRTOX is not set
+# CONFIG_STRICT_DEVMEM is not set
+CONFIG_ARM_UNWIND=y
+CONFIG_DEBUG_USER=y
+# CONFIG_DEBUG_RODATA is not set
+# CONFIG_DEBUG_LL is not set
+# CONFIG_ARM_KPROBES_TEST is not set
+# CONFIG_PID_IN_CONTEXTIDR is not set
+
+#
+# Security options
+#
+CONFIG_KEYS=y
+# CONFIG_ENCRYPTED_KEYS is not set
+# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
+# CONFIG_SECURITY_DMESG_RESTRICT is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP2=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+# CONFIG_CRYPTO_USER is not set
+CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_PCRYPT is not set
+CONFIG_CRYPTO_WORKQUEUE=y
+# CONFIG_CRYPTO_CRYPTD is not set
+CONFIG_CRYPTO_AUTHENC=y
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+CONFIG_CRYPTO_CBC=y
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=y
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+CONFIG_CRYPTO_HMAC=y
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_GHASH is not set
+CONFIG_CRYPTO_MD4=y
+CONFIG_CRYPTO_MD5=y
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+CONFIG_CRYPTO_SHA1=y
+CONFIG_CRYPTO_SHA256=y
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+CONFIG_CRYPTO_AES=y
+# CONFIG_CRYPTO_ANUBIS is not set
+CONFIG_CRYPTO_ARC4=y
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+CONFIG_CRYPTO_TWOFISH=y
+CONFIG_CRYPTO_TWOFISH_COMMON=y
+
+#
+# Compression
+#
+CONFIG_CRYPTO_DEFLATE=y
+# CONFIG_CRYPTO_ZLIB is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+CONFIG_CRYPTO_ANSI_CPRNG=y
+# CONFIG_CRYPTO_USER_API_HASH is not set
+# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
+CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_DEV_QCE40=y
+CONFIG_CRYPTO_DEV_QCRYPTO=m
+CONFIG_CRYPTO_DEV_QCE=m
+CONFIG_CRYPTO_DEV_QCEDEV=m
+# CONFIG_CRYPTO_DEV_OTA_CRYPTO is not set
+CONFIG_BINARY_PRINTF=y
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_IO=y
+CONFIG_CRC_CCITT=y
+CONFIG_CRC16=y
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC32_SELFTEST is not set
+CONFIG_CRC32_SLICEBY8=y
+# CONFIG_CRC32_SLICEBY4 is not set
+# CONFIG_CRC32_SARWATE is not set
+# CONFIG_CRC32_BIT is not set
+# CONFIG_CRC7 is not set
+CONFIG_LIBCRC32C=y
+# CONFIG_CRC8 is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+# CONFIG_XZ_DEC is not set
+# CONFIG_XZ_DEC_BCJ is not set
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_DECOMPRESS_BZIP2=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_REED_SOLOMON=y
+CONFIG_REED_SOLOMON_ENC8=y
+CONFIG_REED_SOLOMON_DEC8=y
+CONFIG_TEXTSEARCH=y
+CONFIG_TEXTSEARCH_KMP=y
+CONFIG_TEXTSEARCH_BM=y
+CONFIG_TEXTSEARCH_FSM=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_CPU_RMAP=y
+CONFIG_DQL=y
+CONFIG_NLATTR=y
+# CONFIG_AVERAGE is not set
+# CONFIG_CORDIC is not set
diff --git a/arch/arm/configs/fighter_defconfig b/arch/arm/configs/fighter_defconfig
new file mode 100644
index 0000000..cadae9e
--- /dev/null
+++ b/arch/arm/configs/fighter_defconfig
@@ -0,0 +1,3466 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux/arm 3.4.0 Kernel Configuration
+#
+CONFIG_ARM=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_KTIME_SCALAR=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_ARM_TICKET_LOCKS=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_ARCH_HAS_CPUFREQ=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_VECTORS_BASE=0xffff0000
+# CONFIG_ARM_PATCH_PHYS_VIRT is not set
+CONFIG_NEED_MACH_IO_H=y
+CONFIG_NEED_MACH_MEMORY_H=y
+CONFIG_PHYS_OFFSET=0x80400000
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_HAVE_IRQ_WORK=y
+CONFIG_IRQ_WORK=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=""
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_XZ=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_XZ is not set
+# CONFIG_KERNEL_LZO is not set
+CONFIG_DEFAULT_HOSTNAME="(none)"
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_FHANDLE is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+
+#
+# IRQ subsystem
+#
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_IRQ_DOMAIN=y
+# CONFIG_IRQ_DOMAIN_DEBUG is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_PREEMPT_RCU=y
+CONFIG_PREEMPT_RCU=y
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_RCU_FAST_NO_HZ is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_RCU_BOOST is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=17
+CONFIG_CGROUPS=y
+CONFIG_CGROUP_DEBUG=y
+CONFIG_CGROUP_FREEZER=y
+# CONFIG_CGROUP_DEVICE is not set
+# CONFIG_CPUSETS is not set
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_RESOURCE_COUNTERS=y
+# CONFIG_CGROUP_MEM_RES_CTLR is not set
+# CONFIG_CGROUP_PERF is not set
+CONFIG_CGROUP_SCHED=y
+CONFIG_FAIR_GROUP_SCHED=y
+# CONFIG_CFS_BANDWIDTH is not set
+CONFIG_RT_GROUP_SCHED=y
+# CONFIG_BLK_CGROUP is not set
+# CONFIG_CHECKPOINT_RESTORE is not set
+CONFIG_NAMESPACES=y
+# CONFIG_UTS_NS is not set
+# CONFIG_IPC_NS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+# CONFIG_NET_NS is not set
+# CONFIG_SCHED_AUTOGROUP is not set
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+CONFIG_RD_BZIP2=y
+CONFIG_RD_LZMA=y
+# CONFIG_RD_XZ is not set
+# CONFIG_RD_LZO is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_PANIC_TIMEOUT=5
+CONFIG_EXPERT=y
+CONFIG_UID16=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_ASHMEM=y
+CONFIG_AIO=y
+CONFIG_EMBEDDED=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_PERF_EVENTS=y
+# CONFIG_PERF_COUNTERS is not set
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+CONFIG_PROFILING=y
+CONFIG_TRACEPOINTS=y
+CONFIG_OPROFILE=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_KPROBES=y
+# CONFIG_JUMP_LABEL is not set
+CONFIG_KRETPROBES=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_CONTIGUOUS=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_HW_BREAKPOINT=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_STOP_MACHINE=y
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_BSGLIB is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_KARMA_PARTITION is not set
+CONFIG_EFI_PARTITION=y
+# CONFIG_SYSV68_PARTITION is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_TEST is not set
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_ROW=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_ROW=y
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="row"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_UNINLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
+CONFIG_FREEZER=y
+
+#
+# System Type
+#
+CONFIG_MMU=y
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_VEXPRESS is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_BCMRING is not set
+# CONFIG_ARCH_HIGHBANK is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CNS3XXX is not set
+# CONFIG_ARCH_GEMINI is not set
+# CONFIG_ARCH_PRIMA2 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_MXS is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_DOVE is not set
+# CONFIG_ARCH_KIRKWOOD is not set
+# CONFIG_ARCH_LPC32XX is not set
+# CONFIG_ARCH_MV78XX0 is not set
+# CONFIG_ARCH_ORION5X is not set
+# CONFIG_ARCH_MMP is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_W90X900 is not set
+# CONFIG_ARCH_TEGRA is not set
+# CONFIG_ARCH_PICOXCELL is not set
+# CONFIG_ARCH_PNX4008 is not set
+# CONFIG_ARCH_PXA is not set
+CONFIG_ARCH_MSM=y
+# CONFIG_ARCH_SHMOBILE is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C24XX is not set
+# CONFIG_ARCH_S3C64XX is not set
+# CONFIG_ARCH_S5P64X0 is not set
+# CONFIG_ARCH_S5PC100 is not set
+# CONFIG_ARCH_S5PV210 is not set
+# CONFIG_ARCH_EXYNOS is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_U300 is not set
+# CONFIG_ARCH_U8500 is not set
+# CONFIG_ARCH_NOMADIK is not set
+# CONFIG_ARCH_DAVINCI is not set
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_PLAT_SPEAR is not set
+# CONFIG_ARCH_VT8500 is not set
+# CONFIG_ARCH_ZYNQ is not set
+# CONFIG_GPIO_PCA953X is not set
+# CONFIG_KEYBOARD_GPIO_POLLED is not set
+
+#
+# MSM SoC Type
+#
+# CONFIG_ARCH_MSM7X01A is not set
+# CONFIG_ARCH_MSM7X25 is not set
+# CONFIG_ARCH_MSM7X27 is not set
+# CONFIG_ARCH_MSM7X30 is not set
+# CONFIG_ARCH_QSD8X50 is not set
+# CONFIG_ARCH_MSM8X60 is not set
+CONFIG_ARCH_MSM8960=y
+# CONFIG_ARCH_MSM8930 is not set
+# CONFIG_ARCH_APQ8064 is not set
+# CONFIG_ARCH_MSM8974 is not set
+# CONFIG_ARCH_MPQ8092 is not set
+# CONFIG_ARCH_MSM8226 is not set
+# CONFIG_ARCH_FSM9XXX is not set
+# CONFIG_ARCH_MSM9615 is not set
+# CONFIG_ARCH_MSM8625 is not set
+# CONFIG_ARCH_MSM9625 is not set
+CONFIG_MSM_SOC_REV_NONE=y
+# CONFIG_MSM_SOC_REV_A is not set
+CONFIG_MSM_KRAIT_TBB_ABORT_HANDLER=y
+CONFIG_ARCH_MSM_KRAIT=y
+CONFIG_MSM_SMP=y
+CONFIG_ARCH_MSM_KRAITMP=y
+CONFIG_MSM_KRAIT_WFE_FIXUP=y
+CONFIG_MSM_RPM=y
+# CONFIG_MSM_RPM_SMD is not set
+CONFIG_MSM_MPM=y
+CONFIG_MSM_XO=y
+CONFIG_MSM_REMOTE_SPINLOCK_SFPB=y
+
+#
+# MSM Board Selection
+#
+# CONFIG_MACH_MSM8960_CDP is not set
+# CONFIG_MACH_MSM8960_MTP is not set
+# CONFIG_MACH_MSM8960_FLUID is not set
+# CONFIG_MACH_MSM8960_LIQUID is not set
+# CONFIG_MACH_MSM_DUMMY is not set
+
+#
+# LGE Board Selection
+#
+CONFIG_BOARD_HEADER_FILE=""
+# CONFIG_MACH_LGE_DUMMY is not set
+
+#
+# LGE Specific Patches
+#
+# CONFIG_LGE_CRASH_HANDLER is not set
+CONFIG_MACH_HTC=y
+
+#
+# HTC Board Selection
+#
+# CONFIG_MACH_ELITE is not set
+CONFIG_MACH_FIGHTER=y
+# CONFIG_MACH_JET is not set
+# CONFIG_MACH_VILLE is not set
+# CONFIG_MACH_HTC_DUMMY is not set
+
+#
+# HTC Specific Patches
+#
+CONFIG_HTC_BATT_CORE=y
+CONFIG_HTC_BATT_8960=y
+CONFIG_HTC_HEADSET_MGR=y
+CONFIG_HTC_HEADSET_PMIC=y
+# CONFIG_HTC_HEADSET_ONE_WIRE is not set
+# CONFIG_MSM_STACKED_MEMORY is not set
+# CONFIG_KERNEL_MSM_CONTIG_MEM_REGION is not set
+CONFIG_MSM_AMSS_VERSION=6225
+# CONFIG_MSM_AMSS_VERSION_6210 is not set
+# CONFIG_MSM_AMSS_VERSION_6220 is not set
+CONFIG_MSM_AMSS_VERSION_6225=y
+CONFIG_MSM7X00A_USE_GP_TIMER=y
+# CONFIG_MSM7X00A_USE_DG_TIMER is not set
+CONFIG_MSM7X00A_SLEEP_MODE_POWER_COLLAPSE_SUSPEND=y
+# CONFIG_MSM7X00A_SLEEP_MODE_POWER_COLLAPSE is not set
+# CONFIG_MSM7X00A_SLEEP_MODE_APPS_SLEEP is not set
+# CONFIG_MSM7X00A_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT is not set
+# CONFIG_MSM7X00A_SLEEP_WAIT_FOR_INTERRUPT is not set
+CONFIG_MSM7X00A_SLEEP_MODE=0
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_POWER_COLLAPSE_SUSPEND is not set
+CONFIG_MSM7X00A_IDLE_SLEEP_MODE_POWER_COLLAPSE=y
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_APPS_SLEEP is not set
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT is not set
+# CONFIG_MSM7X00A_IDLE_SLEEP_WAIT_FOR_INTERRUPT is not set
+CONFIG_MSM7X00A_IDLE_SLEEP_MODE=1
+CONFIG_MSM7X00A_IDLE_SLEEP_MIN_TIME=20000000
+CONFIG_MSM7X00A_IDLE_SPIN_TIME=80000
+CONFIG_MSM_IDLE_STATS=y
+CONFIG_MSM_IDLE_STATS_FIRST_BUCKET=62500
+CONFIG_MSM_IDLE_STATS_BUCKET_SHIFT=2
+CONFIG_MSM_IDLE_STATS_BUCKET_COUNT=10
+CONFIG_MSM_SUSPEND_STATS_FIRST_BUCKET=1000000000
+CONFIG_CPU_HAS_L2_PMU=y
+# CONFIG_HTC_HEADSET is not set
+# CONFIG_HTC_PWRSINK is not set
+# CONFIG_MSM_FIQ_SUPPORT is not set
+# CONFIG_MSM_SERIAL_DEBUGGER is not set
+# CONFIG_MSM_PROC_COMM is not set
+CONFIG_MSM_SMD=y
+# CONFIG_MSM_SMD_PKG3 is not set
+CONFIG_MSM_SMD_PKG4=y
+CONFIG_MSM_SMD_DEBUG=y
+CONFIG_MSM_BAM_DMUX=y
+CONFIG_MSM_N_WAY_SMD=y
+CONFIG_MSM_N_WAY_SMSM=y
+CONFIG_MSM_RESET_MODEM=y
+CONFIG_MSM_SMD_LOGGING=y
+# CONFIG_MSM_IPC_LOGGING is not set
+CONFIG_MSM_SMD_NMEA=y
+# CONFIG_MSM_HSIC_TTY is not set
+CONFIG_MSM_SMD_TTY=y
+CONFIG_MSM_SMD_QMI=y
+CONFIG_MSM_SMD_PKT=y
+# CONFIG_MSM_DSPS is not set
+# CONFIG_MSM_ONCRPCROUTER is not set
+CONFIG_MSM_IPC_ROUTER=y
+CONFIG_MSM_IPC_ROUTER_SMD_XPRT=y
+# CONFIG_MSM_IPC_ROUTER_SECURITY is not set
+# CONFIG_MSM_DALRPC is not set
+CONFIG_MSM_CPU_FREQ_SET_MIN_MAX=y
+CONFIG_MSM_CPU_FREQ_MAX=1242000
+CONFIG_MSM_CPU_FREQ_MIN=384000
+# CONFIG_MSM_AVS_HW is not set
+# CONFIG_MSM_HW3D is not set
+CONFIG_AMSS_7X25_VERSION_2009=y
+# CONFIG_AMSS_7X25_VERSION_2008 is not set
+CONFIG_RTAC=y
+# CONFIG_MSM_VREG_SWITCH_INVERTED is not set
+# CONFIG_MSM_DMA_TEST is not set
+# CONFIG_WIFI_CONTROL_FUNC is not set
+CONFIG_SURF_FFA_GPIO_KEYPAD=y
+CONFIG_MSM_SLEEP_TIME_OVERRIDE=y
+# CONFIG_MSM_MEMORY_LOW_POWER_MODE is not set
+CONFIG_MSM_PM_TIMEOUT_HALT=y
+# CONFIG_MSM_PM_TIMEOUT_RESET_MODEM is not set
+# CONFIG_MSM_PM_TIMEOUT_RESET_CHIP is not set
+CONFIG_MSM_IDLE_WAIT_ON_MODEM=0
+CONFIG_MSM_RPM_REGULATOR=y
+CONFIG_MSM_SUBSYSTEM_RESTART=y
+CONFIG_MSM_SYSMON_COMM=y
+CONFIG_MSM_PIL=y
+# CONFIG_MSM_PIL_MODEM is not set
+# CONFIG_MSM_PIL_QDSP6V3 is not set
+CONFIG_MSM_PIL_QDSP6V4=y
+# CONFIG_MSM_PIL_LPASS_QDSP6V5 is not set
+# CONFIG_MSM_PIL_MSS_QDSP6V5 is not set
+CONFIG_MSM_PIL_RIVA=y
+CONFIG_MSM_INSECURE_PIL_RIVA=y
+# CONFIG_MSM_PIL_TZAPPS is not set
+# CONFIG_MSM_PIL_DSPS is not set
+# CONFIG_MSM_PIL_VIDC is not set
+# CONFIG_MSM_PIL_VENUS is not set
+# CONFIG_MSM_PIL_GSS is not set
+# CONFIG_MSM_PIL_PRONTO is not set
+CONFIG_MSM_SCM=y
+CONFIG_MSM_MODEM_8960=y
+CONFIG_MSM_LPASS_8960=y
+CONFIG_MSM_WCNSS_SSR_8960=y
+CONFIG_MSM_BUSPM_DEV=y
+CONFIG_MSM_TZ_LOG=y
+CONFIG_MSM_RPM_LOG=y
+CONFIG_MSM_RPM_STATS_LOG=y
+# CONFIG_MSM_RPM_RBCPR_STATS_LOG is not set
+CONFIG_MSM_DIRECT_SCLK_ACCESS=y
+CONFIG_IOMMU_API=y
+CONFIG_MSM_GPIOMUX=y
+CONFIG_MSM_NATIVE_RESTART=y
+CONFIG_MSM_PM8X60=y
+# CONFIG_MSM_EVENT_TIMER is not set
+CONFIG_MSM_BUS_SCALING=y
+CONFIG_MSM_BUS_RPM_MULTI_TIER_ENABLED=y
+CONFIG_MSM_WATCHDOG=y
+# CONFIG_MSM_WATCHDOG_V2 is not set
+# CONFIG_MSM_MEMORY_DUMP is not set
+CONFIG_MSM_DLOAD_MODE=y
+# CONFIG_MSM_JTAG is not set
+# CONFIG_MSM_JTAG_MM is not set
+# CONFIG_MSM_SLEEP_STATS_DEVICE is not set
+CONFIG_MSM_RUN_QUEUE_STATS=y
+CONFIG_MSM_STANDALONE_POWER_COLLAPSE=y
+# CONFIG_MSM_GSBI9_UART is not set
+CONFIG_MSM_SHOW_RESUME_IRQ=y
+# CONFIG_MSM_FAKE_BATTERY is not set
+CONFIG_MSM_QDSP6_APR=y
+# CONFIG_MSM_QDSP6_APRV2 is not set
+CONFIG_MSM_QDSP6_CODECS=y
+# CONFIG_MSM_QDSP6V2_CODECS is not set
+CONFIG_MSM_AUDIO_QDSP6=y
+# CONFIG_MSM_AUDIO_QDSP6V2 is not set
+# CONFIG_MSM_ULTRASOUND is not set
+# CONFIG_MSM_SPM_V1 is not set
+CONFIG_MSM_SPM_V2=y
+CONFIG_MSM_L2_SPM=y
+CONFIG_MSM_MULTIMEDIA_USE_ION=y
+# CONFIG_MSM_OCMEM is not set
+# CONFIG_MSM_RTB is not set
+# CONFIG_MSM_EBI_ERP is not set
+# CONFIG_MSM_CACHE_ERP is not set
+CONFIG_MSM_DCVS=y
+# CONFIG_MSM_CPR is not set
+CONFIG_HAVE_ARCH_HAS_CURRENT_TIMER=y
+# CONFIG_MSM_CACHE_DUMP is not set
+# CONFIG_MSM_HSIC_SYSMON is not set
+CONFIG_MSM_CPU_PWRCTL=y
+
+#
+# System MMU
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_V7=y
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV7=y
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_HAS_ASID=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+# CONFIG_ARM_LPAE is not set
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_ARM_THUMB=y
+# CONFIG_ARM_THUMBEE is not set
+CONFIG_SWP_EMULATE=y
+# CONFIG_CPU_ICACHE_DISABLE is not set
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+# CONFIG_CACHE_L2X0 is not set
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_DMA_MEM_BUFFERABLE=y
+# CONFIG_VCM is not set
+CONFIG_STRICT_MEMORY_RWX=y
+CONFIG_ARM_NR_BANKS=8
+# CONFIG_RESERVE_FIRST_PAGE is not set
+CONFIG_CPU_HAS_PMU=y
+CONFIG_MULTI_IRQ_HANDLER=y
+# CONFIG_ARM_ERRATA_430973 is not set
+# CONFIG_ARM_ERRATA_458693 is not set
+# CONFIG_ARM_ERRATA_460075 is not set
+# CONFIG_ARM_ERRATA_742230 is not set
+# CONFIG_ARM_ERRATA_742231 is not set
+# CONFIG_ARM_ERRATA_720789 is not set
+# CONFIG_ARM_ERRATA_743622 is not set
+# CONFIG_ARM_ERRATA_751472 is not set
+# CONFIG_ARM_ERRATA_754322 is not set
+# CONFIG_ARM_ERRATA_754327 is not set
+# CONFIG_ARM_ERRATA_764369 is not set
+# CONFIG_KSAPI is not set
+CONFIG_ARM_GIC=y
+# CONFIG_FIQ_DEBUGGER is not set
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_HAVE_SMP=y
+CONFIG_SMP=y
+# CONFIG_SMP_ON_UP is not set
+CONFIG_ARM_CPU_TOPOLOGY=y
+# CONFIG_SCHED_MC is not set
+# CONFIG_SCHED_SMT is not set
+CONFIG_HAVE_ARM_SCU=y
+# CONFIG_ARM_ARCH_TIMER is not set
+CONFIG_VMSPLIT_3G=y
+# CONFIG_VMSPLIT_2G is not set
+# CONFIG_VMSPLIT_1G is not set
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_NR_CPUS=2
+CONFIG_HOTPLUG_CPU=y
+CONFIG_LOCAL_TIMERS=y
+CONFIG_ARCH_NR_GPIO=0
+# CONFIG_PREEMPT_NONE is not set
+# CONFIG_PREEMPT_VOLUNTARY is not set
+CONFIG_PREEMPT=y
+CONFIG_PREEMPT_COUNT=y
+CONFIG_HZ=100
+# CONFIG_THUMB2_KERNEL is not set
+CONFIG_AEABI=y
+CONFIG_OABI_COMPAT=y
+CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_HAVE_ARCH_PFN_VALID=y
+CONFIG_HIGHMEM=y
+# CONFIG_HIGHPTE is not set
+CONFIG_HW_PERF_EVENTS=y
+CONFIG_VMALLOC_RESERVE=0x25800000
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_SPARSEMEM_MANUAL=y
+CONFIG_SPARSEMEM=y
+CONFIG_HAVE_MEMORY_PRESENT=y
+CONFIG_SPARSEMEM_EXTREME=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_COMPACTION=y
+CONFIG_MIGRATION=y
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_CLEANCACHE=y
+# CONFIG_ARCH_MEMORY_PROBE is not set
+# CONFIG_ARCH_MEMORY_REMOVE is not set
+# CONFIG_ENABLE_DMM is not set
+CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0=y
+CONFIG_HOLES_IN_ZONE=y
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_UACCESS_WITH_MEMCPY is not set
+# CONFIG_SECCOMP is not set
+CONFIG_CC_STACKPROTECTOR=y
+# CONFIG_DEPRECATED_PARAM_STRUCT is not set
+# CONFIG_ARM_FLUSH_CONSOLE_ON_RESTART is not set
+CONFIG_CP_ACCESS=y
+
+#
+# Boot options
+#
+# CONFIG_USE_OF is not set
+CONFIG_ZBOOT_ROM_TEXT=0
+CONFIG_ZBOOT_ROM_BSS=0
+CONFIG_CMDLINE=""
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
+# CONFIG_AUTO_ZRELADDR is not set
+
+#
+# CPU Power Management
+#
+
+#
+# CPU Frequency scaling
+#
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_TABLE=y
+CONFIG_CPU_FREQ_STAT=y
+# CONFIG_CPU_FREQ_STAT_DETAILS is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=y
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_INTERACTIVE=y
+# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
+
+#
+# ARM CPU frequency scaling drivers
+#
+# CONFIG_ARM_EXYNOS4210_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS4X12_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS5250_CPUFREQ is not set
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_IDLE_GOV_MENU=y
+CONFIG_CPU_FREQ_MSM=y
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+# CONFIG_FPE_NWFPE is not set
+# CONFIG_FPE_FASTFPE is not set
+CONFIG_VFP=y
+CONFIG_VFPv3=y
+CONFIG_NEON=y
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+CONFIG_HAVE_AOUT=y
+# CONFIG_BINFMT_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+
+#
+# Power management options
+#
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+CONFIG_HAS_WAKELOCK=y
+CONFIG_HAS_EARLYSUSPEND=y
+CONFIG_WAKELOCK=y
+CONFIG_WAKELOCK_STAT=y
+CONFIG_USER_WAKELOCK=y
+CONFIG_EARLYSUSPEND=y
+# CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL is not set
+CONFIG_FB_EARLYSUSPEND=y
+CONFIG_PM_SLEEP=y
+CONFIG_PM_SLEEP_SMP=y
+CONFIG_PM_RUNTIME=y
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_CLK=y
+CONFIG_CPU_PM=y
+# CONFIG_SUSPEND_TIME is not set
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+# CONFIG_UNIX_DIAG is not set
+CONFIG_XFRM=y
+CONFIG_XFRM_USER=y
+# CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
+CONFIG_XFRM_IPCOMP=y
+CONFIG_NET_KEY=y
+# CONFIG_NET_KEY_MIGRATE is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_ADVANCED_ROUTER=y
+# CONFIG_IP_FIB_TRIE_STATS is not set
+CONFIG_IP_MULTIPLE_TABLES=y
+# CONFIG_IP_ROUTE_MULTIPATH is not set
+# CONFIG_IP_ROUTE_VERBOSE is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE_DEMUX is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+CONFIG_INET_AH=y
+CONFIG_INET_ESP=y
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+CONFIG_INET_TUNNEL=y
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+CONFIG_IPV6=y
+CONFIG_IPV6_PRIVACY=y
+CONFIG_IPV6_ROUTER_PREF=y
+CONFIG_IPV6_ROUTE_INFO=y
+CONFIG_IPV6_OPTIMISTIC_DAD=y
+CONFIG_INET6_AH=y
+CONFIG_INET6_ESP=y
+CONFIG_INET6_IPCOMP=y
+CONFIG_IPV6_MIP6=y
+CONFIG_INET6_XFRM_TUNNEL=y
+CONFIG_INET6_TUNNEL=y
+CONFIG_INET6_XFRM_MODE_TRANSPORT=y
+CONFIG_INET6_XFRM_MODE_TUNNEL=y
+CONFIG_INET6_XFRM_MODE_BEET=y
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+CONFIG_IPV6_SIT=y
+# CONFIG_IPV6_SIT_6RD is not set
+CONFIG_IPV6_NDISC_NODETYPE=y
+# CONFIG_IPV6_TUNNEL is not set
+CONFIG_IPV6_MULTIPLE_TABLES=y
+CONFIG_IPV6_SUBTREES=y
+# CONFIG_IPV6_MROUTE is not set
+# CONFIG_ANDROID_PARANOID_NETWORK is not set
+CONFIG_NET_ACTIVITY_STATS=y
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+CONFIG_NETFILTER_ADVANCED=y
+
+#
+# Core Netfilter Configuration
+#
+CONFIG_NETFILTER_NETLINK=y
+# CONFIG_NETFILTER_NETLINK_ACCT is not set
+CONFIG_NETFILTER_NETLINK_QUEUE=y
+CONFIG_NETFILTER_NETLINK_LOG=y
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_CONNTRACK_MARK=y
+CONFIG_NF_CONNTRACK_PROCFS=y
+CONFIG_NF_CONNTRACK_EVENTS=y
+# CONFIG_NF_CONNTRACK_TIMEOUT is not set
+# CONFIG_NF_CONNTRACK_TIMESTAMP is not set
+CONFIG_NF_CT_PROTO_DCCP=y
+CONFIG_NF_CT_PROTO_GRE=y
+CONFIG_NF_CT_PROTO_SCTP=y
+CONFIG_NF_CT_PROTO_UDPLITE=y
+CONFIG_NF_CONNTRACK_AMANDA=y
+CONFIG_NF_CONNTRACK_FTP=y
+CONFIG_NF_CONNTRACK_H323=y
+CONFIG_NF_CONNTRACK_IRC=y
+CONFIG_NF_CONNTRACK_BROADCAST=y
+CONFIG_NF_CONNTRACK_NETBIOS_NS=y
+# CONFIG_NF_CONNTRACK_SNMP is not set
+CONFIG_NF_CONNTRACK_PPTP=y
+CONFIG_NF_CONNTRACK_SANE=y
+CONFIG_NF_CONNTRACK_SIP=y
+CONFIG_NF_CONNTRACK_TFTP=y
+CONFIG_NF_CT_NETLINK=y
+# CONFIG_NF_CT_NETLINK_TIMEOUT is not set
+CONFIG_NETFILTER_TPROXY=y
+CONFIG_NETFILTER_XTABLES=y
+
+#
+# Xtables combined modules
+#
+CONFIG_NETFILTER_XT_MARK=y
+CONFIG_NETFILTER_XT_CONNMARK=y
+
+#
+# Xtables targets
+#
+# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set
+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
+CONFIG_NETFILTER_XT_TARGET_CONNMARK=y
+# CONFIG_NETFILTER_XT_TARGET_CT is not set
+# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
+CONFIG_NETFILTER_XT_TARGET_HL=y
+# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set
+# CONFIG_NETFILTER_XT_TARGET_LOG is not set
+CONFIG_NETFILTER_XT_TARGET_MARK=y
+# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y
+# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set
+# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
+# CONFIG_NETFILTER_XT_TARGET_TEE is not set
+# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set
+# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
+CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
+# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
+
+#
+# Xtables matches
+#
+# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set
+# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set
+CONFIG_NETFILTER_XT_MATCH_COMMENT=y
+# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set
+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y
+CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
+# CONFIG_NETFILTER_XT_MATCH_CPU is not set
+# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
+# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set
+# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
+CONFIG_NETFILTER_XT_MATCH_ECN=y
+CONFIG_NETFILTER_XT_MATCH_ESP=y
+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y
+CONFIG_NETFILTER_XT_MATCH_HELPER=y
+CONFIG_NETFILTER_XT_MATCH_HL=y
+CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
+CONFIG_NETFILTER_XT_MATCH_LENGTH=y
+CONFIG_NETFILTER_XT_MATCH_LIMIT=y
+CONFIG_NETFILTER_XT_MATCH_MAC=y
+CONFIG_NETFILTER_XT_MATCH_MARK=y
+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
+# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set
+# CONFIG_NETFILTER_XT_MATCH_OSF is not set
+# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
+CONFIG_NETFILTER_XT_MATCH_POLICY=y
+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
+CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA2=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG=y
+# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
+# CONFIG_NETFILTER_XT_MATCH_REALM is not set
+# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
+# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
+CONFIG_NETFILTER_XT_MATCH_SOCKET=y
+CONFIG_NETFILTER_XT_MATCH_STATE=y
+CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
+CONFIG_NETFILTER_XT_MATCH_STRING=y
+CONFIG_NETFILTER_XT_MATCH_TCPMSS=y
+CONFIG_NETFILTER_XT_MATCH_TIME=y
+CONFIG_NETFILTER_XT_MATCH_U32=y
+# CONFIG_IP_SET is not set
+# CONFIG_IP_VS is not set
+
+#
+# IP: Netfilter Configuration
+#
+CONFIG_NF_DEFRAG_IPV4=y
+CONFIG_NF_CONNTRACK_IPV4=y
+CONFIG_NF_CONNTRACK_PROC_COMPAT=y
+# CONFIG_IP_NF_QUEUE is not set
+CONFIG_IP_NF_IPTABLES=y
+CONFIG_IP_NF_MATCH_AH=y
+CONFIG_IP_NF_MATCH_ECN=y
+# CONFIG_IP_NF_MATCH_RPFILTER is not set
+CONFIG_IP_NF_MATCH_TTL=y
+CONFIG_IP_NF_FILTER=y
+CONFIG_IP_NF_TARGET_REJECT=y
+# CONFIG_IP_NF_TARGET_REJECT_SKERR is not set
+# CONFIG_IP_NF_TARGET_ULOG is not set
+CONFIG_NF_NAT=y
+CONFIG_NF_NAT_NEEDED=y
+CONFIG_IP_NF_TARGET_MASQUERADE=y
+CONFIG_IP_NF_TARGET_NETMAP=y
+CONFIG_IP_NF_TARGET_REDIRECT=y
+CONFIG_NF_NAT_PROTO_DCCP=y
+CONFIG_NF_NAT_PROTO_GRE=y
+CONFIG_NF_NAT_PROTO_UDPLITE=y
+CONFIG_NF_NAT_PROTO_SCTP=y
+CONFIG_NF_NAT_FTP=y
+CONFIG_NF_NAT_IRC=y
+CONFIG_NF_NAT_TFTP=y
+CONFIG_NF_NAT_AMANDA=y
+CONFIG_NF_NAT_PPTP=y
+CONFIG_NF_NAT_H323=y
+CONFIG_NF_NAT_SIP=y
+CONFIG_IP_NF_MANGLE=y
+# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
+# CONFIG_IP_NF_TARGET_ECN is not set
+# CONFIG_IP_NF_TARGET_TTL is not set
+CONFIG_IP_NF_RAW=y
+CONFIG_IP_NF_ARPTABLES=y
+CONFIG_IP_NF_ARPFILTER=y
+CONFIG_IP_NF_ARP_MANGLE=y
+
+#
+# IPv6: Netfilter Configuration
+#
+CONFIG_NF_DEFRAG_IPV6=y
+CONFIG_NF_CONNTRACK_IPV6=y
+# CONFIG_IP6_NF_QUEUE is not set
+CONFIG_IP6_NF_IPTABLES=y
+CONFIG_IP6_NF_MATCH_AH=y
+CONFIG_IP6_NF_MATCH_EUI64=y
+CONFIG_IP6_NF_MATCH_FRAG=y
+CONFIG_IP6_NF_MATCH_OPTS=y
+CONFIG_IP6_NF_MATCH_HL=y
+CONFIG_IP6_NF_MATCH_IPV6HEADER=y
+CONFIG_IP6_NF_MATCH_MH=y
+# CONFIG_IP6_NF_MATCH_RPFILTER is not set
+CONFIG_IP6_NF_MATCH_RT=y
+CONFIG_IP6_NF_TARGET_HL=y
+CONFIG_IP6_NF_FILTER=y
+CONFIG_IP6_NF_TARGET_REJECT=y
+# CONFIG_IP6_NF_TARGET_REJECT_SKERR is not set
+CONFIG_IP6_NF_MANGLE=y
+CONFIG_IP6_NF_RAW=y
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_L2TP is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+CONFIG_NET_SCHED=y
+
+#
+# Queueing/Scheduling
+#
+# CONFIG_NET_SCH_CBQ is not set
+CONFIG_NET_SCH_HTB=y
+# CONFIG_NET_SCH_HFSC is not set
+CONFIG_NET_SCH_PRIO=y
+# CONFIG_NET_SCH_MULTIQ is not set
+# CONFIG_NET_SCH_RED is not set
+# CONFIG_NET_SCH_SFB is not set
+# CONFIG_NET_SCH_SFQ is not set
+# CONFIG_NET_SCH_TEQL is not set
+# CONFIG_NET_SCH_TBF is not set
+# CONFIG_NET_SCH_GRED is not set
+# CONFIG_NET_SCH_DSMARK is not set
+# CONFIG_NET_SCH_NETEM is not set
+# CONFIG_NET_SCH_DRR is not set
+# CONFIG_NET_SCH_MQPRIO is not set
+# CONFIG_NET_SCH_CHOKE is not set
+# CONFIG_NET_SCH_QFQ is not set
+# CONFIG_NET_SCH_INGRESS is not set
+# CONFIG_NET_SCH_PLUG is not set
+
+#
+# Classification
+#
+CONFIG_NET_CLS=y
+# CONFIG_NET_CLS_BASIC is not set
+# CONFIG_NET_CLS_TCINDEX is not set
+# CONFIG_NET_CLS_ROUTE4 is not set
+CONFIG_NET_CLS_FW=y
+CONFIG_NET_CLS_U32=y
+# CONFIG_CLS_U32_PERF is not set
+CONFIG_CLS_U32_MARK=y
+# CONFIG_NET_CLS_RSVP is not set
+# CONFIG_NET_CLS_RSVP6 is not set
+CONFIG_NET_CLS_FLOW=y
+# CONFIG_NET_CLS_CGROUP is not set
+CONFIG_NET_EMATCH=y
+CONFIG_NET_EMATCH_STACK=32
+CONFIG_NET_EMATCH_CMP=y
+CONFIG_NET_EMATCH_NBYTE=y
+CONFIG_NET_EMATCH_U32=y
+CONFIG_NET_EMATCH_META=y
+CONFIG_NET_EMATCH_TEXT=y
+CONFIG_NET_CLS_ACT=y
+# CONFIG_NET_ACT_POLICE is not set
+# CONFIG_NET_ACT_GACT is not set
+# CONFIG_NET_ACT_MIRRED is not set
+# CONFIG_NET_ACT_IPT is not set
+# CONFIG_NET_ACT_NAT is not set
+# CONFIG_NET_ACT_PEDIT is not set
+# CONFIG_NET_ACT_SIMP is not set
+# CONFIG_NET_ACT_SKBEDIT is not set
+# CONFIG_NET_ACT_CSUM is not set
+# CONFIG_NET_CLS_IND is not set
+CONFIG_NET_SCH_FIFO=y
+# CONFIG_DCB is not set
+CONFIG_DNS_RESOLVER=y
+# CONFIG_BATMAN_ADV is not set
+# CONFIG_OPENVSWITCH is not set
+CONFIG_RPS=y
+CONFIG_RFS_ACCEL=y
+CONFIG_XPS=y
+# CONFIG_NETPRIO_CGROUP is not set
+CONFIG_BQL=y
+CONFIG_HAVE_BPF_JIT=y
+# CONFIG_BPF_JIT is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NET_TCPPROBE is not set
+# CONFIG_NET_DROP_MONITOR is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_RFCOMM_TTY=y
+CONFIG_BT_BNEP=y
+CONFIG_BT_BNEP_MC_FILTER=y
+CONFIG_BT_BNEP_PROTO_FILTER=y
+CONFIG_BT_HIDP=y
+
+#
+# Bluetooth device drivers
+#
+CONFIG_BT_HCISMD=y
+# CONFIG_BT_HCIBTUSB is not set
+# CONFIG_BT_HCIBTSDIO is not set
+# CONFIG_BT_HCIUART is not set
+# CONFIG_BT_HCIBCM203X is not set
+# CONFIG_BT_HCIBPA10X is not set
+# CONFIG_BT_MSM_SLEEP is not set
+# CONFIG_BT_HCIBFUSB is not set
+# CONFIG_BT_HCIVHCI is not set
+# CONFIG_BT_MRVL is not set
+# CONFIG_MSM_BT_POWER is not set
+# CONFIG_AF_RXRPC is not set
+CONFIG_FIB_RULES=y
+CONFIG_WIRELESS=y
+CONFIG_WIRELESS_EXT=y
+CONFIG_WEXT_CORE=y
+CONFIG_WEXT_PROC=y
+CONFIG_WEXT_SPY=y
+CONFIG_WEXT_PRIV=y
+CONFIG_CFG80211=y
+# CONFIG_NL80211_TESTMODE is not set
+# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
+# CONFIG_CFG80211_REG_DEBUG is not set
+CONFIG_CFG80211_DEFAULT_PS=y
+# CONFIG_CFG80211_DEBUGFS is not set
+# CONFIG_CFG80211_INTERNAL_REGDB is not set
+# CONFIG_CFG80211_WEXT is not set
+CONFIG_WIRELESS_EXT_SYSFS=y
+# CONFIG_LIB80211 is not set
+# CONFIG_CFG80211_ALLOW_RECONNECT is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_WIMAX is not set
+CONFIG_RFKILL=y
+CONFIG_RFKILL_PM=y
+# CONFIG_RFKILL_INPUT is not set
+# CONFIG_RFKILL_REGULATOR is not set
+# CONFIG_RFKILL_GPIO is not set
+# CONFIG_NET_9P is not set
+# CONFIG_CAIF is not set
+# CONFIG_CEPH_LIB is not set
+# CONFIG_NFC is not set
+# CONFIG_BCM2079X is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH=""
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_GENERIC_CPU_DEVICES is not set
+CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
+CONFIG_REGMAP_SPI=y
+CONFIG_DMA_SHARED_BUFFER=y
+CONFIG_GENLOCK=y
+CONFIG_GENLOCK_MISCDEVICE=y
+CONFIG_SYNC=y
+CONFIG_SW_SYNC=y
+# CONFIG_SW_SYNC_USER is not set
+# CONFIG_CMA is not set
+# CONFIG_CONNECTOR is not set
+# CONFIG_MTD is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=4096
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_MG_DISK is not set
+# CONFIG_BLK_DEV_RBD is not set
+
+#
+# Misc devices
+#
+# CONFIG_SENSORS_LIS3LV02D is not set
+# CONFIG_AD525X_DPOT is not set
+CONFIG_ANDROID_PMEM=y
+# CONFIG_ATMEL_PWM is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_APDS9802ALS is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_ISL29020 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_SENSORS_BH1780 is not set
+# CONFIG_SENSORS_BH1770 is not set
+# CONFIG_SENSORS_APDS990X is not set
+# CONFIG_HMC6352 is not set
+CONFIG_SENSORS_AK8975=y
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
+CONFIG_UID_STAT=y
+# CONFIG_BMP085 is not set
+# CONFIG_USB_SWITCH_FSA9480 is not set
+# CONFIG_WL127X_RFKILL is not set
+# CONFIG_APANIC is not set
+# CONFIG_TSIF is not set
+# CONFIG_TSPP is not set
+# CONFIG_HAPTIC_ISA1200 is not set
+CONFIG_PMIC8XXX_VIBRATOR=y
+# CONFIG_PMIC8XXX_VIBRATOR_PWM is not set
+# CONFIG_ANDROID_VIBRATOR is not set
+# CONFIG_TOUCHSENSE_VIBRATOR is not set
+# CONFIG_PMIC8XXX_NFC is not set
+# CONFIG_PMIC8XXX_UPL is not set
+# CONFIG_QSEECOM is not set
+# CONFIG_QFP_FUSE is not set
+# CONFIG_BU52031NVX is not set
+CONFIG_CABLE_DETECT_8XXX=y
+CONFIG_CABLE_DETECT_ACCESSORY=y
+CONFIG_CABLE_DETECT_ACCESSORY_BY_ADC=y
+# CONFIG_VP_A1028 is not set
+CONFIG_SENSORS_NFC_PN544=y
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_AT25 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_EEPROM_93XX46 is not set
+# CONFIG_IWMC3200TOP is not set
+
+#
+# Texas Instruments shared transport line discipline
+#
+# CONFIG_TI_ST is not set
+# CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
+
+#
+# Altera FPGA firmware download module
+#
+# CONFIG_ALTERA_STAPL is not set
+# CONFIG_SLIMPORT_ANX7808 is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI_MOD=y
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+CONFIG_SCSI_TGT=y
+# CONFIG_SCSI_NETLINK is not set
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+CONFIG_CHR_DEV_SG=y
+CONFIG_CHR_DEV_SCH=y
+CONFIG_SCSI_MULTI_LUN=y
+CONFIG_SCSI_CONSTANTS=y
+CONFIG_SCSI_LOGGING=y
+CONFIG_SCSI_SCAN_ASYNC=y
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_ISCSI_BOOT_SYSFS is not set
+# CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
+# CONFIG_ATA is not set
+CONFIG_MD=y
+# CONFIG_BLK_DEV_MD is not set
+CONFIG_BLK_DEV_DM=y
+# CONFIG_DM_DEBUG is not set
+CONFIG_DM_CRYPT=y
+# CONFIG_DM_SNAPSHOT is not set
+# CONFIG_DM_THIN_PROVISIONING is not set
+# CONFIG_DM_MIRROR is not set
+# CONFIG_DM_RAID is not set
+# CONFIG_DM_ZERO is not set
+# CONFIG_DM_MULTIPATH is not set
+# CONFIG_DM_DELAY is not set
+# CONFIG_DM_UEVENT is not set
+# CONFIG_DM_FLAKEY is not set
+# CONFIG_DM_VERITY is not set
+# CONFIG_TARGET_CORE is not set
+CONFIG_NETDEVICES=y
+CONFIG_NET_CORE=y
+# CONFIG_BONDING is not set
+CONFIG_DUMMY=y
+# CONFIG_EQUALIZER is not set
+CONFIG_MII=y
+# CONFIG_IFB is not set
+# CONFIG_NET_TEAM is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+CONFIG_TUN=y
+# CONFIG_VETH is not set
+
+#
+# CAIF transport drivers
+#
+CONFIG_ETHERNET=y
+CONFIG_NET_VENDOR_BROADCOM=y
+# CONFIG_B44 is not set
+# CONFIG_NET_CALXEDA_XGMAC is not set
+CONFIG_NET_VENDOR_CHELSIO=y
+CONFIG_NET_VENDOR_CIRRUS=y
+# CONFIG_CS89x0 is not set
+# CONFIG_DM9000 is not set
+# CONFIG_DNET is not set
+CONFIG_NET_VENDOR_FARADAY=y
+# CONFIG_FTMAC100 is not set
+# CONFIG_FTGMAC100 is not set
+CONFIG_NET_VENDOR_INTEL=y
+CONFIG_NET_VENDOR_I825XX=y
+CONFIG_NET_VENDOR_MARVELL=y
+CONFIG_NET_VENDOR_MICREL=y
+# CONFIG_KS8851 is not set
+# CONFIG_KS8851_MLL is not set
+CONFIG_NET_VENDOR_MICROCHIP=y
+# CONFIG_ENC28J60 is not set
+# CONFIG_MSM_RMNET is not set
+CONFIG_MSM_RMNET_BAM=y
+# CONFIG_QFEC is not set
+CONFIG_NET_VENDOR_NATSEMI=y
+CONFIG_NET_VENDOR_8390=y
+# CONFIG_AX88796 is not set
+# CONFIG_ETHOC is not set
+CONFIG_NET_VENDOR_SEEQ=y
+# CONFIG_SEEQ8005 is not set
+CONFIG_NET_VENDOR_SMSC=y
+CONFIG_SMC91X=y
+CONFIG_SMC911X=y
+CONFIG_SMSC911X=y
+# CONFIG_SMSC911X_ARCH_HOOKS is not set
+CONFIG_NET_VENDOR_STMICRO=y
+# CONFIG_STMMAC_ETH is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_AMD_PHY is not set
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+# CONFIG_LXT_PHY is not set
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+# CONFIG_SMSC_PHY is not set
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_MICREL_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+# CONFIG_MICREL_KS8995MA is not set
+# CONFIG_PPP is not set
+CONFIG_SLIP=y
+CONFIG_SLHC=y
+CONFIG_SLIP_COMPRESSED=y
+# CONFIG_SLIP_SMART is not set
+CONFIG_SLIP_MODE_SLIP6=y
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_USB_HSO is not set
+# CONFIG_USB_IPHETH is not set
+CONFIG_WLAN=y
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_USB_NET_RNDIS_WLAN is not set
+# CONFIG_LIBRA_SDIOIF is not set
+# CONFIG_ATH6K_LEGACY_EXT is not set
+CONFIG_WCNSS_CORE=y
+# CONFIG_ATH_COMMON is not set
+# CONFIG_BCMDHD is not set
+# CONFIG_BRCMFMAC is not set
+# CONFIG_HOSTAP is not set
+# CONFIG_IWM is not set
+# CONFIG_LIBERTAS is not set
+# CONFIG_MWIFIEX is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+CONFIG_INPUT_KEYRESET=y
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+# CONFIG_KEYBOARD_ADP5589 is not set
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_QT1070 is not set
+# CONFIG_KEYBOARD_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_GPIO is not set
+# CONFIG_KEYBOARD_TCA6416 is not set
+# CONFIG_KEYBOARD_TCA8418 is not set
+# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_LM8323 is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_MCS is not set
+# CONFIG_KEYBOARD_MPR121 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+CONFIG_KEYBOARD_PMIC8XXX=y
+# CONFIG_KEYBOARD_SAMSUNG is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_OMAP4 is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_QCIKBD is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_SENTELIC is not set
+# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_APPLETOUCH is not set
+# CONFIG_MOUSE_BCM5974 is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_GPIO is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
+# CONFIG_MOUSE_QCITP is not set
+# CONFIG_MOUSE_SYNAPTICS_USB is not set
+CONFIG_INPUT_JOYSTICK=y
+# CONFIG_JOYSTICK_ANALOG is not set
+# CONFIG_JOYSTICK_A3D is not set
+# CONFIG_JOYSTICK_ADI is not set
+# CONFIG_JOYSTICK_COBRA is not set
+# CONFIG_JOYSTICK_GF2K is not set
+# CONFIG_JOYSTICK_GRIP is not set
+# CONFIG_JOYSTICK_GRIP_MP is not set
+# CONFIG_JOYSTICK_GUILLEMOT is not set
+# CONFIG_JOYSTICK_INTERACT is not set
+# CONFIG_JOYSTICK_SIDEWINDER is not set
+# CONFIG_JOYSTICK_TMDC is not set
+# CONFIG_JOYSTICK_IFORCE is not set
+# CONFIG_JOYSTICK_WARRIOR is not set
+# CONFIG_JOYSTICK_MAGELLAN is not set
+# CONFIG_JOYSTICK_SPACEORB is not set
+# CONFIG_JOYSTICK_SPACEBALL is not set
+# CONFIG_JOYSTICK_STINGER is not set
+# CONFIG_JOYSTICK_TWIDJOY is not set
+# CONFIG_JOYSTICK_ZHENHUA is not set
+# CONFIG_JOYSTICK_AS5011 is not set
+# CONFIG_JOYSTICK_JOYDUMP is not set
+# CONFIG_JOYSTICK_XPAD is not set
+# CONFIG_TOUCHDISC_VTD518_SHINETSU is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_ADS7846 is not set
+# CONFIG_TOUCHSCREEN_AD7877 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_MAXTOUCH is not set
+# CONFIG_TOUCHSCREEN_AD7879 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set
+# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_BU21013 is not set
+# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set
+# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set
+# CONFIG_TOUCHSCREEN_DYNAPRO is not set
+# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set
+# CONFIG_TOUCHSCREEN_EETI is not set
+# CONFIG_TOUCHSCREEN_EGALAX is not set
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+# CONFIG_TOUCHSCREEN_ILI210X is not set
+# CONFIG_TOUCHSCREEN_GUNZE is not set
+# CONFIG_TOUCHSCREEN_ELO is not set
+# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
+# CONFIG_TOUCHSCREEN_MAX11801 is not set
+# CONFIG_TOUCHSCREEN_MCS5000 is not set
+# CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_INEXIO is not set
+# CONFIG_TOUCHSCREEN_MK712 is not set
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
+# CONFIG_TOUCHSCREEN_TSC_SERIO is not set
+# CONFIG_TOUCHSCREEN_TSC2005 is not set
+# CONFIG_TOUCHSCREEN_TSC2007 is not set
+# CONFIG_TOUCHSCREEN_MSM_LEGACY is not set
+# CONFIG_TOUCHSCREEN_W90X900 is not set
+# CONFIG_TOUCHSCREEN_ST1232 is not set
+# CONFIG_TOUCHSCREEN_TPS6507X is not set
+# CONFIG_TOUCHSCREEN_CY8C_TS is not set
+# CONFIG_TOUCHSCREEN_CYTTSP_I2C_QC is not set
+# CONFIG_TOUCHSCREEN_FT5X06 is not set
+# CONFIG_TOUCHSCREEN_LGE_COMMON is not set
+# CONFIG_TOUCHSCREEN_LGE_SYNAPTICS is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set
+CONFIG_TOUCHSCREEN_ATMEL_224E=y
+# CONFIG_TOUCHSCREEN_CYPRESS_CS is not set
+CONFIG_TOUCHSCREEN_SYNAPTICS_3K=y
+CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_AD714X is not set
+# CONFIG_INPUT_BMA150 is not set
+# CONFIG_INPUT_PM8XXX_VIBRATOR is not set
+CONFIG_INPUT_PMIC8XXX_PWRKEY=y
+# CONFIG_INPUT_MMA8450 is not set
+# CONFIG_INPUT_MPU3050 is not set
+# CONFIG_INPUT_GP2A is not set
+# CONFIG_INPUT_GPIO_TILT_POLLED is not set
+# CONFIG_INPUT_ATI_REMOTE2 is not set
+CONFIG_INPUT_KEYCHORD=y
+# CONFIG_INPUT_KEYSPAN_REMOTE is not set
+# CONFIG_INPUT_KXTJ9 is not set
+# CONFIG_INPUT_POWERMATE is not set
+# CONFIG_INPUT_YEALINK is not set
+# CONFIG_INPUT_CM109 is not set
+CONFIG_INPUT_UINPUT=y
+CONFIG_INPUT_GPIO=y
+# CONFIG_INPUT_ISA1200_FF_MEMLESS is not set
+# CONFIG_INPUT_PCF8574 is not set
+# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
+# CONFIG_INPUT_ADXL34X is not set
+# CONFIG_INPUT_CMA3000 is not set
+# CONFIG_BOSCH_BMA150 is not set
+# CONFIG_STM_LIS3DH is not set
+# CONFIG_BMP18X is not set
+# CONFIG_SENSORS_AKM8975 is not set
+# CONFIG_SENSORS_AKM8975_PANA_GYRO is not set
+# CONFIG_SENSORS_PANASONIC_GYRO is not set
+CONFIG_SENSORS_BMA250=y
+CONFIG_INPUT_CAPELLA_CM3629=y
+# CONFIG_SENSORS_R3GD20 is not set
+# CONFIG_MPU_SENSORS_MPU3050 is not set
+# CONFIG_MPU_SENSORS_TIMERIRQ is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_SERPORT=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_SERIO_PS2MULT is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+# CONFIG_VT is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_N_GSM is not set
+# CONFIG_N_SMUX is not set
+# CONFIG_TRACE_SINK is not set
+CONFIG_DEVMEM=y
+CONFIG_DEVKMEM=y
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_MAX3100 is not set
+# CONFIG_SERIAL_MAX3107 is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_SERIAL_MSM=y
+# CONFIG_SERIAL_MSM_CONSOLE is not set
+CONFIG_SERIAL_MSM_HS=y
+# CONFIG_SERIAL_MSM_CLOCK_CONTROL is not set
+CONFIG_SERIAL_MSM_HSL=y
+CONFIG_SERIAL_MSM_HSL_CONSOLE=y
+# CONFIG_SERIAL_BCM_BT_LPM is not set
+# CONFIG_SERIAL_TIMBERDALE is not set
+# CONFIG_SERIAL_ALTERA_JTAGUART is not set
+# CONFIG_SERIAL_ALTERA_UART is not set
+# CONFIG_SERIAL_IFX6X60 is not set
+# CONFIG_SERIAL_MSM_SMD is not set
+# CONFIG_SERIAL_XILINX_PS_UART is not set
+
+#
+# Diag Support
+#
+CONFIG_DIAG_CHAR=y
+
+#
+# DIAG traffic over USB
+#
+CONFIG_DIAG_OVER_USB=y
+
+#
+# SDIO support for DIAG
+#
+
+#
+# HSIC/SMUX support for DIAG
+#
+# CONFIG_TTY_PRINTK is not set
+# CONFIG_HVC_DCC is not set
+# CONFIG_IPMI_HANDLER is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_HW_RANDOM_TIMERIOMEM is not set
+CONFIG_HW_RANDOM_MSM=y
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+# CONFIG_DCC_TTY is not set
+# CONFIG_RAMOOPS is not set
+CONFIG_MSM_ROTATOR=y
+CONFIG_MSM_ADSPRPC=y
+# CONFIG_MMC_GENERIC_CSDIO is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_MUX is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_MSM is not set
+CONFIG_I2C_QUP=y
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_PXA_PCI is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_XILINX is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_DIOLAN_U2C is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_ALTERA is not set
+# CONFIG_SPI_BITBANG is not set
+# CONFIG_SPI_GPIO is not set
+# CONFIG_SPI_OC_TINY is not set
+# CONFIG_SPI_PXA2XX_PCI is not set
+# CONFIG_SPI_XILINX is not set
+CONFIG_SPI_QUP=y
+# CONFIG_SPI_DESIGNWARE is not set
+
+#
+# SPI Protocol Masters
+#
+CONFIG_SPI_SPIDEV=y
+# CONFIG_SPI_TLE62X0 is not set
+# CONFIG_SPMI is not set
+CONFIG_SLIMBUS=y
+CONFIG_SLIMBUS_MSM_CTRL=y
+# CONFIG_HSI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+
+#
+# PPS generators support
+#
+
+#
+# PTP clock support
+#
+
+#
+# Enable Device Drivers -> PPS to see the PTP clock options.
+#
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_GPIOLIB=y
+CONFIG_DEBUG_GPIO=y
+CONFIG_GPIO_SYSFS=y
+
+#
+# Memory mapped GPIO drivers:
+#
+# CONFIG_GPIO_GENERIC_PLATFORM is not set
+# CONFIG_GPIO_MSM_V1 is not set
+CONFIG_GPIO_MSM_V2=y
+# CONFIG_GPIO_MSM_V3 is not set
+# CONFIG_GPIO_FSM9XXX is not set
+
+#
+# I2C GPIO expanders:
+#
+# CONFIG_GPIO_MAX7300 is not set
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCF857X is not set
+CONFIG_GPIO_SX150X=y
+# CONFIG_GPIO_ADP5588 is not set
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+# CONFIG_GPIO_MAX7301 is not set
+# CONFIG_GPIO_MCP23S08 is not set
+# CONFIG_GPIO_MC33880 is not set
+# CONFIG_GPIO_74X164 is not set
+
+#
+# AC97 GPIO expanders:
+#
+
+#
+# MODULbus GPIO expanders:
+#
+CONFIG_GPIO_PM8XXX=y
+CONFIG_GPIO_PM8XXX_MPP=y
+# CONFIG_GPIO_PM8XXX_RPC is not set
+# CONFIG_W1 is not set
+CONFIG_POWER_SUPPLY=y
+# CONFIG_POWER_SUPPLY_DEBUG is not set
+# CONFIG_PDA_POWER is not set
+# CONFIG_TEST_POWER is not set
+# CONFIG_BATTERY_DS2780 is not set
+# CONFIG_BATTERY_DS2781 is not set
+# CONFIG_BATTERY_DS2782 is not set
+# CONFIG_BATTERY_SBS is not set
+# CONFIG_BATTERY_BQ27x00 is not set
+# CONFIG_BATTERY_MAX17040 is not set
+# CONFIG_BATTERY_MAX17042 is not set
+# CONFIG_CHARGER_ISP1704 is not set
+# CONFIG_CHARGER_MAX8903 is not set
+# CONFIG_CHARGER_LP8727 is not set
+# CONFIG_CHARGER_GPIO is not set
+# CONFIG_CHARGER_MANAGER is not set
+# CONFIG_BATTERY_MSM is not set
+# CONFIG_BATTERY_MSM8X60 is not set
+# CONFIG_ISL9519_CHARGER is not set
+# CONFIG_SMB137B_CHARGER is not set
+# CONFIG_SMB349_CHARGER is not set
+# CONFIG_BATTERY_BQ27520 is not set
+# CONFIG_BATTERY_BQ27541 is not set
+CONFIG_PM8921_CHARGER=y
+CONFIG_PM8XXX_CCADC=y
+# CONFIG_LTC4088_CHARGER is not set
+CONFIG_PM8921_BMS=y
+# CONFIG_BATTERY_BCL is not set
+# CONFIG_CHARGER_SMB347 is not set
+CONFIG_HWMON=y
+# CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
+# CONFIG_SENSORS_AD7314 is not set
+# CONFIG_SENSORS_AD7414 is not set
+# CONFIG_SENSORS_AD7418 is not set
+# CONFIG_SENSORS_ADCXX is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ADT7411 is not set
+# CONFIG_SENSORS_ADT7462 is not set
+# CONFIG_SENSORS_ADT7470 is not set
+# CONFIG_SENSORS_ADT7475 is not set
+# CONFIG_SENSORS_ASC7621 is not set
+# CONFIG_SENSORS_ATXP1 is not set
+# CONFIG_SENSORS_DS620 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_F75375S is not set
+# CONFIG_SENSORS_G760A is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_GL520SM is not set
+# CONFIG_SENSORS_GPIO_FAN is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_JC42 is not set
+# CONFIG_SENSORS_LINEAGE is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_LM73 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_LM92 is not set
+# CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_LTC4151 is not set
+# CONFIG_SENSORS_LTC4215 is not set
+# CONFIG_SENSORS_LTC4245 is not set
+# CONFIG_SENSORS_LTC4261 is not set
+# CONFIG_SENSORS_LM95241 is not set
+# CONFIG_SENSORS_LM95245 is not set
+# CONFIG_SENSORS_MAX1111 is not set
+# CONFIG_SENSORS_MAX16065 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX1668 is not set
+# CONFIG_SENSORS_MAX6639 is not set
+# CONFIG_SENSORS_MAX6642 is not set
+# CONFIG_SENSORS_MAX6650 is not set
+# CONFIG_SENSORS_MCP3021 is not set
+# CONFIG_SENSORS_NTC_THERMISTOR is not set
+CONFIG_SENSORS_PM8XXX_ADC=y
+# CONFIG_SENSORS_EPM_ADC is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_PMBUS is not set
+# CONFIG_SENSORS_SHT15 is not set
+# CONFIG_SENSORS_SHT21 is not set
+# CONFIG_SENSORS_SMM665 is not set
+# CONFIG_SENSORS_DME1737 is not set
+# CONFIG_SENSORS_EMC1403 is not set
+# CONFIG_SENSORS_EMC2103 is not set
+# CONFIG_SENSORS_EMC6W201 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47M192 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_SCH56XX_COMMON is not set
+# CONFIG_SENSORS_SCH5627 is not set
+# CONFIG_SENSORS_SCH5636 is not set
+# CONFIG_SENSORS_ADS1015 is not set
+# CONFIG_SENSORS_ADS7828 is not set
+# CONFIG_SENSORS_ADS7871 is not set
+# CONFIG_SENSORS_AMC6821 is not set
+# CONFIG_SENSORS_THMC50 is not set
+# CONFIG_SENSORS_TMP102 is not set
+# CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
+# CONFIG_SENSORS_VT1211 is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83791D is not set
+# CONFIG_SENSORS_W83792D is not set
+# CONFIG_SENSORS_W83793 is not set
+# CONFIG_SENSORS_W83795 is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83L786NG is not set
+# CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+CONFIG_THERMAL=y
+CONFIG_THERMAL_HWMON=y
+# CONFIG_THERMAL_MSM_POPMEM is not set
+# CONFIG_THERMAL_TSENS is not set
+CONFIG_THERMAL_TSENS8960=y
+# CONFIG_THERMAL_TSENS8974 is not set
+CONFIG_THERMAL_PM8XXX=y
+CONFIG_THERMAL_MONITOR=y
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+CONFIG_BCMA_POSSIBLE=y
+
+#
+# Broadcom specific AMBA
+#
+# CONFIG_BCMA is not set
+
+#
+# Multifunction device drivers
+#
+CONFIG_MFD_CORE=y
+# CONFIG_MFD_88PM860X is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_MFD_ASIC3 is not set
+# CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_HTC_I2CPLD is not set
+# CONFIG_TPS6105X is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_PMIC8058 is not set
+# CONFIG_PMIC8901 is not set
+# CONFIG_TPS6507X is not set
+# CONFIG_MFD_TPS65217 is not set
+# CONFIG_MFD_TPS6586X is not set
+# CONFIG_MFD_TPS65910 is not set
+# CONFIG_MFD_TPS65912_I2C is not set
+# CONFIG_MFD_TPS65912_SPI is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_TWL6040_CORE is not set
+# CONFIG_MFD_STMPE is not set
+# CONFIG_MFD_TC3589X is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_T7L66XB is not set
+# CONFIG_MFD_TC6387XB is not set
+# CONFIG_MFD_TC6393XB is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_DA9052_SPI is not set
+# CONFIG_MFD_DA9052_I2C is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_MAX8925 is not set
+# CONFIG_MFD_MAX8997 is not set
+# CONFIG_MFD_MAX8998 is not set
+# CONFIG_MFD_S5M_CORE is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X_I2C is not set
+# CONFIG_MFD_WM831X_SPI is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_WM8994 is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_MFD_MC13XXX is not set
+# CONFIG_ABX500_CORE is not set
+# CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_WL1273_CORE is not set
+CONFIG_MFD_PM8XXX=y
+CONFIG_MFD_PM8921_CORE=y
+# CONFIG_MFD_PM8821_CORE is not set
+# CONFIG_MFD_PM8018_CORE is not set
+# CONFIG_MFD_PM8038_CORE is not set
+CONFIG_MFD_PM8XXX_IRQ=y
+# CONFIG_MFD_PM8821_IRQ is not set
+# CONFIG_MFD_TPS65090 is not set
+# CONFIG_MFD_AAT2870_CORE is not set
+CONFIG_MFD_PM8XXX_DEBUG=y
+CONFIG_MFD_PM8XXX_PWM=y
+CONFIG_MFD_PM8XXX_MISC=y
+CONFIG_MFD_PM8XXX_SPK=y
+CONFIG_MFD_PM8XXX_BATT_ALARM=y
+# CONFIG_WCD9304_CODEC is not set
+CONFIG_WCD9310_CODEC=y
+# CONFIG_WCD9320_CODEC is not set
+# CONFIG_MFD_RC5T583 is not set
+CONFIG_REGULATOR=y
+# CONFIG_REGULATOR_DEBUG is not set
+# CONFIG_REGULATOR_DUMMY is not set
+# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
+# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
+# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
+CONFIG_REGULATOR_GPIO=y
+# CONFIG_REGULATOR_AD5398 is not set
+# CONFIG_REGULATOR_ISL6271A is not set
+# CONFIG_REGULATOR_MAX1586 is not set
+# CONFIG_REGULATOR_MAX8649 is not set
+# CONFIG_REGULATOR_MAX8660 is not set
+# CONFIG_REGULATOR_MAX8952 is not set
+# CONFIG_REGULATOR_LP3971 is not set
+# CONFIG_REGULATOR_LP3972 is not set
+# CONFIG_REGULATOR_TPS62360 is not set
+# CONFIG_REGULATOR_TPS65023 is not set
+# CONFIG_REGULATOR_TPS6507X is not set
+# CONFIG_REGULATOR_TPS6524X is not set
+CONFIG_REGULATOR_PM8XXX=y
+# CONFIG_REGULATOR_MSM_GPIO is not set
+# CONFIG_REGULATOR_STUB is not set
+CONFIG_MEDIA_SUPPORT=y
+
+#
+# Multimedia core support
+#
+# CONFIG_MEDIA_CONTROLLER is not set
+CONFIG_VIDEO_DEV=y
+CONFIG_VIDEO_V4L2_COMMON=y
+# CONFIG_DVB_CORE is not set
+CONFIG_VIDEO_MEDIA=y
+
+#
+# Multimedia drivers
+#
+CONFIG_RC_CORE=y
+CONFIG_LIRC=y
+# CONFIG_USER_RC_INPUT is not set
+CONFIG_RC_MAP=y
+CONFIG_IR_NEC_DECODER=y
+CONFIG_IR_RC5_DECODER=y
+CONFIG_IR_RC6_DECODER=y
+CONFIG_IR_JVC_DECODER=y
+CONFIG_IR_SONY_DECODER=y
+CONFIG_IR_RC5_SZ_DECODER=y
+CONFIG_IR_SANYO_DECODER=y
+CONFIG_IR_MCE_KBD_DECODER=y
+CONFIG_IR_LIRC_CODEC=y
+# CONFIG_RC_ATI_REMOTE is not set
+# CONFIG_IR_IMON is not set
+# CONFIG_IR_MCEUSB is not set
+# CONFIG_IR_REDRAT3 is not set
+# CONFIG_IR_STREAMZAP is not set
+# CONFIG_RC_LOOPBACK is not set
+# CONFIG_IR_GPIO_CIR is not set
+# CONFIG_MEDIA_ATTACH is not set
+CONFIG_MEDIA_TUNER=y
+# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
+CONFIG_MEDIA_TUNER_SIMPLE=y
+CONFIG_MEDIA_TUNER_TDA8290=y
+CONFIG_MEDIA_TUNER_TDA827X=y
+CONFIG_MEDIA_TUNER_TDA18271=y
+CONFIG_MEDIA_TUNER_TDA9887=y
+CONFIG_MEDIA_TUNER_TEA5761=y
+CONFIG_MEDIA_TUNER_TEA5767=y
+CONFIG_MEDIA_TUNER_MT20XX=y
+CONFIG_MEDIA_TUNER_XC2028=y
+CONFIG_MEDIA_TUNER_XC5000=y
+CONFIG_MEDIA_TUNER_XC4000=y
+CONFIG_MEDIA_TUNER_MC44S803=y
+CONFIG_VIDEO_V4L2=y
+CONFIG_VIDEOBUF2_CORE=y
+CONFIG_VIDEOBUF2_MEMOPS=y
+CONFIG_VIDEOBUF2_DMA_CONTIG=y
+CONFIG_VIDEOBUF2_VMALLOC=y
+CONFIG_VIDEOBUF2_DMA_SG=y
+CONFIG_VIDEOBUF2_MSM_MEM=y
+CONFIG_VIDEO_CAPTURE_DRIVERS=y
+# CONFIG_VIDEO_ADV_DEBUG is not set
+# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
+CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
+CONFIG_VIDEO_IR_I2C=y
+
+#
+# Audio decoders, processors and mixers
+#
+
+#
+# RDS decoders
+#
+
+#
+# Video decoders
+#
+
+#
+# Video and audio decoders
+#
+
+#
+# MPEG video encoders
+#
+
+#
+# Video encoders
+#
+
+#
+# Camera sensor devices
+#
+
+#
+# Flash devices
+#
+
+#
+# Video improvement chips
+#
+
+#
+# Miscelaneous helper chips
+#
+# CONFIG_MSM_VCAP is not set
+# CONFIG_V4L_USB_DRIVERS is not set
+CONFIG_V4L_PLATFORM_DRIVERS=y
+# CONFIG_SOC_CAMERA is not set
+
+#
+# Qualcomm MSM Camera And Video
+#
+CONFIG_MSM_CAMERA=y
+# CONFIG_MSM_CAMERA_DEBUG is not set
+CONFIG_MSM_CAMERA_V4L2=y
+
+#
+# Camera Sensor Selection
+#
+# CONFIG_IMX074 is not set
+CONFIG_S5K3H2YX=y
+# CONFIG_S5K6A1GX is not set
+# CONFIG_AR0260 is not set
+# CONFIG_OV2722 is not set
+# CONFIG_OV5647 is not set
+# CONFIG_MT9M114 is not set
+# CONFIG_IMX074_ACT is not set
+CONFIG_IMX105_ACT=y
+CONFIG_S5K3H2YX_ACT=y
+# CONFIG_S5K4E1 is not set
+# CONFIG_MSM_CAMERA_FLASH_SC628A is not set
+# CONFIG_IMX072 is not set
+# CONFIG_OV2720 is not set
+CONFIG_MSM_CAMERA_FLASH=y
+CONFIG_MSM_CAMERA_SENSOR=y
+CONFIG_MSM_ACTUATOR=y
+CONFIG_MSM_GEMINI=y
+# CONFIG_RAWCHIP is not set
+CONFIG_QUP_EXCLUSIVE_TO_CAMERA=y
+# CONFIG_S5K3L1YX is not set
+# CONFIG_IMX091 is not set
+CONFIG_IMX105=y
+# CONFIG_IMX175 is not set
+# CONFIG_IMX135 is not set
+# CONFIG_OV8838 is not set
+# CONFIG_IMX175_ACT is not set
+# CONFIG_AD5823_ACT is not set
+# CONFIG_AD5816_ACT is not set
+# CONFIG_TI201_ACT is not set
+CONFIG_MT9V113=y
+# CONFIG_IMX175_2LANE is not set
+# CONFIG_OV5693_ACT is not set
+# CONFIG_OV5693 is not set
+# CONFIG_RAWCHIP_MCLK is not set
+# CONFIG_S5K6A2YA is not set
+# CONFIG_V4L_MEM2MEM_DRIVERS is not set
+# CONFIG_MSM_WFD is not set
+CONFIG_RADIO_ADAPTERS=y
+# CONFIG_RADIO_SI470X is not set
+# CONFIG_USB_MR800 is not set
+# CONFIG_USB_DSBR is not set
+# CONFIG_I2C_SI4713 is not set
+# CONFIG_RADIO_SI4713 is not set
+# CONFIG_USB_KEENE is not set
+# CONFIG_RADIO_TEA5764 is not set
+# CONFIG_RADIO_SAA7706H is not set
+# CONFIG_RADIO_TEF6862 is not set
+# CONFIG_RADIO_WL1273 is not set
+
+#
+# Texas Instruments WL128x FM driver (ST based)
+#
+# CONFIG_RADIO_WL128X is not set
+CONFIG_RADIO_IRIS=y
+CONFIG_RADIO_IRIS_TRANSPORT=m
+
+#
+# Graphics support
+#
+CONFIG_DRM=y
+CONFIG_DRM_USB=y
+CONFIG_DRM_KMS_HELPER=y
+# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
+
+#
+# I2C encoder or helper chips
+#
+# CONFIG_DRM_I2C_CH7006 is not set
+# CONFIG_DRM_I2C_SIL164 is not set
+CONFIG_DRM_UDL=y
+CONFIG_ION=y
+CONFIG_ION_MSM=y
+CONFIG_MSM_KGSL=y
+# CONFIG_MSM_KGSL_CFF_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_CP_STAT_NO_DETAIL is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_NO_IB_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_RB_HEX is not set
+CONFIG_MSM_KGSL_2D=y
+# CONFIG_MSM_KGSL_DRM is not set
+CONFIG_KGSL_PER_PROCESS_PAGE_TABLE=y
+CONFIG_MSM_KGSL_PAGE_TABLE_SIZE=0xFFF0000
+CONFIG_MSM_KGSL_PAGE_TABLE_COUNT=32
+CONFIG_MSM_KGSL_MMU_PAGE_FAULT=y
+# CONFIG_MSM_KGSL_DISABLE_SHADOW_WRITES is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+CONFIG_FB_SYS_FILLRECT=y
+CONFIG_FB_SYS_COPYAREA=y
+CONFIG_FB_SYS_IMAGEBLIT=y
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_WMT_GE_ROPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+# CONFIG_FB_TMIO is not set
+# CONFIG_FB_SMSCUFX is not set
+# CONFIG_FB_UDL is not set
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_BROADSHEET is not set
+CONFIG_MSM_VIDC=y
+CONFIG_MSM_VIDC_1080P=y
+CONFIG_MSM_VIDC_VENC=y
+CONFIG_MSM_VIDC_VDEC=y
+# CONFIG_MSM_VIDC_CONTENT_PROTECTION is not set
+CONFIG_FB_MSM=y
+# CONFIG_FB_MSM_BACKLIGHT is not set
+# CONFIG_FB_MSM_LOGO is not set
+CONFIG_FB_MSM_LCDC_HW=y
+CONFIG_FB_MSM_TRIPLE_BUFFER=y
+CONFIG_FB_MSM_MDP_HW=y
+# CONFIG_FB_MSM_MDP22 is not set
+# CONFIG_FB_MSM_MDP30 is not set
+# CONFIG_FB_MSM_MDP31 is not set
+CONFIG_FB_MSM_MDP40=y
+# CONFIG_FB_MSM_MDSS is not set
+# CONFIG_FB_MSM_MDP_NONE is not set
+# CONFIG_FB_MSM_EBI2 is not set
+# CONFIG_FB_MSM_MDDI is not set
+CONFIG_FB_MSM_MIPI_DSI=y
+# CONFIG_FB_MSM_LCDC is not set
+# CONFIG_FB_MSM_LVDS is not set
+CONFIG_FB_MSM_OVERLAY=y
+# CONFIG_FB_MSM_DTV is not set
+# CONFIG_FB_MSM_EXTMDDI is not set
+# CONFIG_FB_MSM_TVOUT is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_COMMON is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_COMMON_VGA is not set
+# CONFIG_FB_MSM_MDDI_ORISE is not set
+# CONFIG_FB_MSM_MDDI_QUICKVX is not set
+# CONFIG_FB_MSM_MDDI_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_PANEL is not set
+# CONFIG_FB_MSM_MIPI_DSI_TOSHIBA is not set
+# CONFIG_FB_MSM_MIPI_DSI_LGIT is not set
+# CONFIG_FB_MSM_MIPI_DSI_RENESAS is not set
+# CONFIG_FB_MSM_MIPI_DSI_SIMULATOR is not set
+# CONFIG_FB_MSM_MIPI_DSI_NOVATEK is not set
+# CONFIG_FB_MSM_MIPI_DSI_ORISE is not set
+# CONFIG_FB_MSM_LCDC_ST15_WXGA is not set
+# CONFIG_FB_MSM_LCDC_ST15_PANEL is not set
+# CONFIG_FB_MSM_LCDC_PRISM_WVGA is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_WSVGA is not set
+# CONFIG_FB_MSM_LCDC_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_LCDC_GORDON_VGA is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_WVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_FWVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_SHARP_WVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_AUO_WVGA is not set
+# CONFIG_FB_MSM_LCDC_TRULY_HVGA_IPS3P2335 is not set
+# CONFIG_FB_MSM_LCDC_TRULY_HVGA_IPS3P2335_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT is not set
+# CONFIG_FB_MSM_LCDC_NT35582_WVGA is not set
+# CONFIG_FB_MSM_LCDC_WXGA is not set
+# CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WXGA_PT is not set
+# CONFIG_FB_MSM_LVDS_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WSVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WUXGA is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_CMD_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_ORISE_VIDEO_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_ORISE_CMD_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_VIDEO_FWVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_CMD_FWVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35510_VIDEO_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35510_CMD_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35516_VIDEO_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35516_CMD_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35590_CMD_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35590_VIDEO_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WUXGA is not set
+# CONFIG_FB_MSM_MIPI_SIMULATOR_VIDEO is not set
+CONFIG_FB_MSM_NO_MDP_PIPE_CTRL=y
+CONFIG_FB_MSM_OVERLAY0_WRITEBACK=y
+CONFIG_FB_MSM_OVERLAY1_WRITEBACK=y
+CONFIG_FB_MSM_WRITEBACK_MSM_PANEL=y
+# CONFIG_FB_MSM_LCDC_PRISM_WVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_WSVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_GORDON_VGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SHARP_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_AUO_WVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_NT35582_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT_PANEL is not set
+# CONFIG_FB_MSM_LVDS_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_LVDS_FRC_FHD_PANEL is not set
+# CONFIG_FB_MSM_TRY_MDDI_CATCH_LCDC_PRISM is not set
+# CONFIG_FB_MSM_MIPI_PANEL_DETECT is not set
+# CONFIG_FB_MSM_MDDI_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LVDS_MIPI_PANEL_DETECT is not set
+# CONFIG_FB_MSM_MDDI_PRISM_WVGA is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_WVGA_PORTRAIT is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_VGA is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_WVGA is not set
+# CONFIG_FB_MSM_MDDI_SHARP_QVGA_128x128 is not set
+# CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WXGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WSVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WUXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_CMD_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_ORISE_VIDEO_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_ORISE_CMD_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_VIDEO_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_CMD_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WUXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TRULY_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35510_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35510_CMD_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35516_VIDEO_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35516_CMD_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35590_CMD_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35590_VIDEO_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_SIMULATOR_VIDEO_PANEL is not set
+# CONFIG_FB_MSM_EBI2_TMD_QVGA_EPSON_QCIF is not set
+CONFIG_FB_MSM_PANEL_NONE=y
+# CONFIG_FB_MSM_EXT_INTERFACE_COMMON is not set
+# CONFIG_FB_MSM_HDMI_COMMON is not set
+# CONFIG_FB_MSM_HDMI_3D is not set
+# CONFIG_FB_MSM_HDMI_ADV7520_PANEL is not set
+# CONFIG_FB_MSM_HDMI_MSM_PANEL is not set
+# CONFIG_FB_MSM_TVOUT_NTSC_M is not set
+# CONFIG_FB_MSM_TVOUT_NTSC_J is not set
+# CONFIG_FB_MSM_TVOUT_PAL_BDGHIN is not set
+# CONFIG_FB_MSM_TVOUT_PAL_M is not set
+# CONFIG_FB_MSM_TVOUT_PAL_N is not set
+CONFIG_FB_MSM_TVOUT_NONE=y
+# CONFIG_FB_MSM_DEFAULT_DEPTH_RGB565 is not set
+# CONFIG_FB_MSM_DEFAULT_DEPTH_ARGB8888 is not set
+CONFIG_FB_MSM_DEFAULT_DEPTH_RGBA8888=y
+# CONFIG_FB_MSM_EBI2_EPSON_S1D_QVGA_PANEL is not set
+# CONFIG_FB_MSM_EBI2_PANEL_DETECT is not set
+# CONFIG_EXYNOS_VIDEO is not set
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_LCD_CLASS_DEVICE=y
+# CONFIG_LCD_L4F00242T03 is not set
+# CONFIG_LCD_LMS283GF05 is not set
+# CONFIG_LCD_LTV350QV is not set
+# CONFIG_LCD_TDO24M is not set
+# CONFIG_LCD_VGG2432A4 is not set
+# CONFIG_LCD_PLATFORM is not set
+# CONFIG_LCD_S6E63M0 is not set
+# CONFIG_LCD_LD9040 is not set
+# CONFIG_LCD_AMS369FG06 is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_GENERIC=y
+# CONFIG_BACKLIGHT_ADP8860 is not set
+# CONFIG_BACKLIGHT_ADP8870 is not set
+# CONFIG_BACKLIGHT_LP855X is not set
+# CONFIG_BACKLIGHT_LM3530 is not set
+# CONFIG_BACKLIGHT_LM3533 is not set
+# CONFIG_LOGO is not set
+CONFIG_SOUND=y
+# CONFIG_SOUND_OSS_CORE is not set
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_HWDEP=y
+CONFIG_SND_RAWMIDI=y
+CONFIG_SND_JACK=y
+# CONFIG_SND_SEQUENCER is not set
+# CONFIG_SND_MIXER_OSS is not set
+# CONFIG_SND_PCM_OSS is not set
+# CONFIG_SND_HRTIMER is not set
+CONFIG_SND_DYNAMIC_MINORS=y
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_DRIVERS=y
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_ALOOP is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+# CONFIG_SND_ARM is not set
+# CONFIG_SND_SPI is not set
+CONFIG_SND_USB=y
+CONFIG_SND_USB_AUDIO=y
+# CONFIG_SND_USB_UA101 is not set
+# CONFIG_SND_USB_CAIAQ is not set
+# CONFIG_SND_USB_6FIRE is not set
+CONFIG_SND_SOC=y
+
+#
+# MSM SoC Audio support
+#
+CONFIG_SND_SOC_MSM_HOSTLESS_PCM=y
+CONFIG_SND_SOC_MSM_QDSP6_INTF=y
+# CONFIG_SND_SOC_MSM_QDSP6V2_INTF is not set
+CONFIG_SND_SOC_VOICE=y
+CONFIG_SND_SOC_QDSP6=y
+# CONFIG_SND_SOC_QDSP6V2 is not set
+CONFIG_SND_SOC_MSM8960=y
+# CONFIG_SND_SOC_DUAL_AMIC is not set
+CONFIG_SND_SOC_I2C_AND_SPI=y
+# CONFIG_SND_SOC_ALL_CODECS is not set
+CONFIG_SND_SOC_WCD9304=y
+CONFIG_SND_SOC_WCD9310=y
+CONFIG_SND_SOC_CS8427=y
+CONFIG_SND_SOC_MSM_STUB=y
+# CONFIG_SND_SOC_TPA2028D is not set
+CONFIG_SND_SOC_TPA2051D3=y
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_BATTERY_STRENGTH is not set
+# CONFIG_HIDRAW is not set
+# CONFIG_UHID is not set
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+# CONFIG_USB_HIDDEV is not set
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_ACRUX is not set
+CONFIG_HID_APPLE=y
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_PRODIKEYS is not set
+# CONFIG_HID_CYPRESS is not set
+CONFIG_HID_DRAGONRISE=y
+# CONFIG_DRAGONRISE_FF is not set
+# CONFIG_HID_EMS_FF is not set
+# CONFIG_HID_ELECOM is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_HOLTEK is not set
+# CONFIG_HID_KEYTOUCH is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_UCLOGIC is not set
+# CONFIG_HID_WALTOP is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LCPOWER is not set
+CONFIG_HID_LOGITECH=y
+CONFIG_HID_LOGITECH_DJ=y
+# CONFIG_LOGITECH_FF is not set
+# CONFIG_LOGIRUMBLEPAD2_FF is not set
+# CONFIG_LOGIG940_FF is not set
+# CONFIG_LOGIWHEELS_FF is not set
+CONFIG_HID_MAGICMOUSE=y
+CONFIG_HID_MICROSOFT=y
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_MULTITOUCH is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_ORTEK is not set
+CONFIG_HID_PANTHERLORD=y
+# CONFIG_PANTHERLORD_FF is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_PICOLCD is not set
+# CONFIG_HID_PRIMAX is not set
+# CONFIG_HID_ROCCAT is not set
+# CONFIG_HID_SAITEK is not set
+# CONFIG_HID_SAMSUNG is not set
+CONFIG_HID_SONY=y
+# CONFIG_HID_SPEEDLINK is not set
+# CONFIG_HID_SUNPLUS is not set
+CONFIG_HID_GREENASIA=y
+# CONFIG_GREENASIA_FF is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TIVO is not set
+# CONFIG_HID_TOPSEED is not set
+CONFIG_HID_THRUSTMASTER=y
+# CONFIG_THRUSTMASTER_FF is not set
+# CONFIG_HID_WACOM is not set
+# CONFIG_HID_WIIMOTE is not set
+CONFIG_HID_ZEROPLUS=y
+# CONFIG_ZEROPLUS_FF is not set
+# CONFIG_HID_ZYDACRON is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+CONFIG_USB_ARCH_HAS_EHCI=y
+# CONFIG_USB_ARCH_HAS_XHCI is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_COMMON=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+CONFIG_USB_SUSPEND=y
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_DWC3 is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_EHSET=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+# CONFIG_USB_EHCI_TT_NEWSCHED is not set
+CONFIG_USB_EHCI_MSM=y
+# CONFIG_USB_EHCI_MSM_HSIC is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+# CONFIG_USB_EHCI_HCD_PLATFORM is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_PEHCI_HCD is not set
+# CONFIG_USB_MUSB_HDRC is not set
+
+#
+# USB Device Class drivers
+#
+CONFIG_USB_ACM=y
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+
+#
+# also be needed; see USB_STORAGE Help for more info
+#
+CONFIG_USB_STORAGE=y
+CONFIG_USB_STORAGE_DEBUG=y
+# CONFIG_USB_STORAGE_REALTEK is not set
+CONFIG_USB_STORAGE_DATAFAB=y
+CONFIG_USB_STORAGE_FREECOM=y
+CONFIG_USB_STORAGE_ISD200=y
+CONFIG_USB_STORAGE_USBAT=y
+CONFIG_USB_STORAGE_SDDR09=y
+CONFIG_USB_STORAGE_SDDR55=y
+CONFIG_USB_STORAGE_JUMPSHOT=y
+CONFIG_USB_STORAGE_ALAUDA=y
+CONFIG_USB_STORAGE_ONETOUCH=y
+CONFIG_USB_STORAGE_KARMA=y
+CONFIG_USB_STORAGE_CYPRESS_ATACB=y
+# CONFIG_USB_STORAGE_ENE_UB6250 is not set
+# CONFIG_USB_UAS is not set
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+CONFIG_USB_EHSET_TEST_FIXTURE=y
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_YUREX is not set
+# CONFIG_USB_QCOM_DIAG_BRIDGE is not set
+# CONFIG_USB_QCOM_MDM_BRIDGE is not set
+# CONFIG_USB_QCOM_KS_BRIDGE is not set
+CONFIG_USB_GADGET=y
+# CONFIG_USB_GADGET_DEBUG is not set
+CONFIG_USB_GADGET_DEBUG_FILES=y
+# CONFIG_USB_GADGET_DEBUG_FS is not set
+CONFIG_USB_GADGET_VBUS_DRAW=500
+CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
+
+#
+# USB Peripheral Controller
+#
+# CONFIG_USB_FUSB300 is not set
+# CONFIG_USB_R8A66597 is not set
+# CONFIG_USB_MV_UDC is not set
+# CONFIG_USB_M66592 is not set
+# CONFIG_USB_NET2272 is not set
+CONFIG_USB_CI13XXX_MSM=y
+# CONFIG_USB_CI13XXX_MSM_HSIC is not set
+# CONFIG_USB_DWC3_MSM is not set
+# CONFIG_USB_MSM_72K is not set
+# CONFIG_USB_DUMMY_HCD is not set
+CONFIG_USB_GADGET_DUALSPEED=y
+# CONFIG_USB_GADGET_SUPERSPEED is not set
+# CONFIG_USB_ZERO is not set
+# CONFIG_USB_AUDIO is not set
+# CONFIG_USB_ETH is not set
+# CONFIG_USB_G_NCM is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FUNCTIONFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_MASS_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+# CONFIG_USB_G_PRINTER is not set
+CONFIG_USB_G_ANDROID=y
+# CONFIG_USB_CDC_COMPOSITE is not set
+# CONFIG_USB_G_ACM_MS is not set
+# CONFIG_USB_G_MULTI is not set
+# CONFIG_USB_G_HID is not set
+# CONFIG_USB_G_DBGP is not set
+# CONFIG_USB_G_WEBCAM is not set
+CONFIG_USB_CSW_HACK=y
+# CONFIG_USB_MSC_PROFILING is not set
+# CONFIG_MODEM_SUPPORT is not set
+CONFIG_RMNET_SMD_CTL_CHANNEL=""
+CONFIG_RMNET_SMD_DATA_CHANNEL=""
+CONFIG_USB_ANDROID_RMNET_CTRL_SMD=y
+# CONFIG_USB_ANDROID_CDC_ECM is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_USB_OTG_UTILS is not set
+# CONFIG_USB_OTG_WAKELOCK is not set
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_USB_ULPI is not set
+# CONFIG_USB_MSM_OTG_72K is not set
+# CONFIG_NOP_USB_XCEIV is not set
+# CONFIG_USB_MSM_OTG is not set
+# CONFIG_USB_MSM_ACA is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+CONFIG_MMC_PERF_PROFILING=y
+CONFIG_MMC_UNSAFE_RESUME=y
+# CONFIG_MMC_CLKGATE is not set
+# CONFIG_MMC_EMBEDDED_SDIO is not set
+CONFIG_MMC_PARANOID_SD_INIT=y
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_MINORS=64
+CONFIG_MMC_BLOCK_BOUNCE=y
+# CONFIG_MMC_BLOCK_DEFERRED_RESUME is not set
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+# CONFIG_MMC_SDHCI is not set
+# CONFIG_MMC_SDHCI_PXAV3 is not set
+# CONFIG_MMC_SDHCI_PXAV2 is not set
+CONFIG_MMC_MSM=y
+CONFIG_MMC_MSM_SDC1_SUPPORT=y
+CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT=y
+# CONFIG_MMC_MSM_SDC2_SUPPORT is not set
+CONFIG_MMC_MSM_SDC3_SUPPORT=y
+# CONFIG_MMC_MSM_SDC3_POLLING is not set
+# CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC3_WP_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC4_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC5_SUPPORT is not set
+CONFIG_MMC_MSM_SPS_SUPPORT=y
+# CONFIG_MMC_DW is not set
+# CONFIG_MMC_VUB300 is not set
+# CONFIG_MMC_USHC is not set
+# CONFIG_MEMSTICK is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_LM3530 is not set
+# CONFIG_LEDS_PCA9532 is not set
+# CONFIG_LEDS_GPIO is not set
+# CONFIG_LEDS_MSM_PDM is not set
+# CONFIG_LEDS_PMIC_MPP is not set
+# CONFIG_LEDS_MSM_TRICOLOR is not set
+# CONFIG_LEDS_LP3944 is not set
+# CONFIG_LEDS_CPLD is not set
+# CONFIG_LEDS_LP5521 is not set
+# CONFIG_LEDS_LP5523 is not set
+# CONFIG_LEDS_PCA955X is not set
+CONFIG_LEDS_PM8XXX=y
+# CONFIG_LEDS_PCA9633 is not set
+# CONFIG_LEDS_DAC124S085 is not set
+# CONFIG_LEDS_REGULATOR is not set
+# CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_MSM_PMIC is not set
+# CONFIG_LEDS_LT3593 is not set
+# CONFIG_LEDS_RENESAS_TPU is not set
+# CONFIG_LEDS_TCA6507 is not set
+# CONFIG_LEDS_OT200 is not set
+# CONFIG_LEDS_TRIGGERS is not set
+
+#
+# LED Triggers
+#
+
+#
+# LED Flashlights
+#
+CONFIG_FLASHLIGHT_TPS61310=y
+CONFIG_SWITCH=y
+# CONFIG_SWITCH_GPIO is not set
+# CONFIG_SWITCH_FSA8008 is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+CONFIG_RTC_INTF_ALARM=y
+CONFIG_RTC_INTF_ALARM_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# I2C RTC drivers
+#
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_DS3232 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_ISL12022 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
+# CONFIG_RTC_DRV_EM3027 is not set
+# CONFIG_RTC_DRV_RV3029C2 is not set
+
+#
+# SPI RTC drivers
+#
+# CONFIG_RTC_DRV_M41T93 is not set
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
+# CONFIG_RTC_DRV_MAX6902 is not set
+# CONFIG_RTC_DRV_R9701 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_DS3234 is not set
+# CONFIG_RTC_DRV_PCF2123 is not set
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# on-CPU RTC drivers
+#
+# CONFIG_RTC_DRV_MSM is not set
+# CONFIG_RTC_DRV_MSM7X00A is not set
+CONFIG_RTC_DRV_PM8XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+
+#
+# Virtio drivers
+#
+# CONFIG_VIRTIO_BALLOON is not set
+# CONFIG_VIRTIO_MMIO is not set
+
+#
+# Microsoft Hyper-V guest support
+#
+CONFIG_STAGING=y
+# CONFIG_USBIP_CORE is not set
+# CONFIG_PRISM2_USB is not set
+# CONFIG_ECHO is not set
+# CONFIG_ASUS_OLED is not set
+# CONFIG_RTLLIB is not set
+# CONFIG_R8712U is not set
+# CONFIG_RTS5139 is not set
+# CONFIG_TRANZPORT is not set
+# CONFIG_LINE6_USB is not set
+# CONFIG_VT6656 is not set
+# CONFIG_IIO is not set
+CONFIG_QCACHE=y
+# CONFIG_FB_SM7XX is not set
+# CONFIG_USB_ENESTORAGE is not set
+# CONFIG_BCM_WIMAX is not set
+# CONFIG_FT1000 is not set
+
+#
+# Speakup console speech
+#
+# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4_STAGING is not set
+# CONFIG_STAGING_MEDIA is not set
+
+#
+# Android
+#
+CONFIG_ANDROID=y
+CONFIG_ANDROID_BINDER_IPC=y
+CONFIG_ANDROID_LOGGER=y
+CONFIG_ANDROID_PERSISTENT_RAM=y
+CONFIG_ANDROID_RAM_CONSOLE=y
+CONFIG_ANDROID_RAM_CONSOLE_ENABLE_VERBOSE=y
+CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION=y
+CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_DATA_SIZE=128
+CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_ECC_SIZE=16
+CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE=8
+CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_POLYNOMIAL=0x11d
+# CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT is not set
+# CONFIG_PERSISTENT_TRACER is not set
+CONFIG_ANDROID_TIMED_OUTPUT=y
+CONFIG_ANDROID_TIMED_GPIO=y
+CONFIG_ANDROID_LOW_MEMORY_KILLER=y
+CONFIG_ANDROID_LOW_MEMORY_KILLER_AUTODETECT_OOM_ADJ_VALUES=y
+# CONFIG_ANDROID_SWITCH is not set
+# CONFIG_ANDROID_INTF_ALARM_DEV is not set
+# CONFIG_PHONE is not set
+# CONFIG_USB_WPAN_HCD is not set
+
+#
+# Qualcomm Atheros Prima WLAN module
+#
+CONFIG_PRIMA_WLAN=m
+# CONFIG_PRIMA_WLAN_BTAMP is not set
+CONFIG_HTC_WIFI_NVS=y
+
+#
+# Qualcomm MSM specific device drivers
+#
+CONFIG_MSM_SSBI=y
+CONFIG_SPS=y
+# CONFIG_USB_BAM is not set
+CONFIG_SPS_SUPPORT_BAMDMA=y
+# CONFIG_SPS_SUPPORT_NDP_BAM is not set
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_HAVE_CLK_PREPARE=y
+
+#
+# Hardware Spinlock drivers
+#
+CONFIG_IOMMU_SUPPORT=y
+CONFIG_MSM_IOMMU=y
+CONFIG_MSM_IOMMU_GPU_SYNC=y
+CONFIG_IOMMU_PGTABLES_L2=y
+
+#
+# Remoteproc drivers (EXPERIMENTAL)
+#
+
+#
+# Rpmsg drivers (EXPERIMENTAL)
+#
+# CONFIG_VIRT_DRIVERS is not set
+# CONFIG_PM_DEVFREQ is not set
+# CONFIG_MOBICORE_SUPPORT is not set
+# CONFIG_CORESIGHT is not set
+
+#
+# File systems
+#
+# CONFIG_EXT2_FS is not set
+# CONFIG_EXT3_FS is not set
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_USE_FOR_EXT23=y
+CONFIG_EXT4_FS_XATTR=y
+# CONFIG_EXT4_FS_POSIX_ACL is not set
+# CONFIG_EXT4_FS_SECURITY is not set
+# CONFIG_EXT4_DEBUG is not set
+CONFIG_JBD2=y
+# CONFIG_JBD2_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FS_POSIX_ACL=y
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_FANOTIFY is not set
+# CONFIG_QUOTA is not set
+# CONFIG_QUOTACTL is not set
+# CONFIG_AUTOFS4_FS is not set
+CONFIG_FUSE_FS=y
+# CONFIG_CUSE is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+# CONFIG_MSDOS_FS is not set
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_ECRYPT_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_LOGFS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_QNX6FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_PSTORE is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+# CONFIG_NFS_V4_1 is not set
+# CONFIG_ROOT_NFS is not set
+# CONFIG_NFS_USE_LEGACY_DNS is not set
+CONFIG_NFS_USE_KERNEL_DNS=y
+# CONFIG_NFSD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_ACL_SUPPORT=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+CONFIG_SUNRPC_GSS=y
+# CONFIG_SUNRPC_DEBUG is not set
+# CONFIG_CEPH_FS is not set
+CONFIG_CIFS=y
+# CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_UPCALL is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_DFS_UPCALL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+CONFIG_NLS_ASCII=y
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_UTF8 is not set
+
+#
+# Kernel hacking
+#
+CONFIG_PRINTK_TIME=y
+CONFIG_DEFAULT_MESSAGE_LOGLEVEL=1
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_SECTION_MISMATCH=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_LOCKUP_DETECTOR is not set
+# CONFIG_HARDLOCKUP_DETECTOR is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+CONFIG_TIMER_STATS=y
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
+CONFIG_DEBUG_KMEMLEAK=y
+CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
+# CONFIG_DEBUG_KMEMLEAK_TEST is not set
+CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
+# CONFIG_DEBUG_PREEMPT is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_SPARSE_RCU_POINTER is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_ATOMIC_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+CONFIG_STACKTRACE=y
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_HIGHMEM is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_INFO_REDUCED is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+CONFIG_DEBUG_MEMORY_INIT=y
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_TEST_LIST_SORT is not set
+# CONFIG_DEBUG_SG is not set
+CONFIG_DEBUG_NOTIFIERS=y
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+CONFIG_RCU_CPU_STALL_TIMEOUT=60
+CONFIG_RCU_CPU_STALL_VERBOSE=y
+# CONFIG_RCU_CPU_STALL_INFO is not set
+# CONFIG_RCU_TRACE is not set
+# CONFIG_KPROBES_SANITY_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_DEBUG_PER_CPU_MAPS is not set
+# CONFIG_LKDTM is not set
+# CONFIG_CPU_NOTIFIER_ERROR_INJECT is not set
+CONFIG_FAULT_INJECTION=y
+CONFIG_FAILSLAB=y
+CONFIG_FAIL_PAGE_ALLOC=y
+# CONFIG_FAIL_MAKE_REQUEST is not set
+# CONFIG_FAIL_IO_TIMEOUT is not set
+# CONFIG_FAIL_MMC_REQUEST is not set
+CONFIG_FAULT_INJECTION_DEBUG_FS=y
+CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
+# CONFIG_DEBUG_PAGEALLOC is not set
+CONFIG_NOP_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_RING_BUFFER=y
+CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
+CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_RING_BUFFER_ALLOW_SWAP=y
+CONFIG_TRACING=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_PREEMPT_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+CONFIG_ENABLE_DEFAULT_TRACERS=y
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_KPROBE_EVENT=y
+# CONFIG_CPU_FREQ_SWITCH_PROFILER is not set
+# CONFIG_RING_BUFFER_BENCHMARK is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_ATOMIC64_SELFTEST is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_TEST_KSTRTOX is not set
+# CONFIG_STRICT_DEVMEM is not set
+CONFIG_ARM_UNWIND=y
+CONFIG_DEBUG_USER=y
+# CONFIG_DEBUG_RODATA is not set
+# CONFIG_DEBUG_LL is not set
+# CONFIG_ARM_KPROBES_TEST is not set
+# CONFIG_PID_IN_CONTEXTIDR is not set
+
+#
+# Security options
+#
+CONFIG_KEYS=y
+# CONFIG_ENCRYPTED_KEYS is not set
+# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
+# CONFIG_SECURITY_DMESG_RESTRICT is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP2=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+# CONFIG_CRYPTO_USER is not set
+CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_PCRYPT is not set
+CONFIG_CRYPTO_WORKQUEUE=y
+# CONFIG_CRYPTO_CRYPTD is not set
+CONFIG_CRYPTO_AUTHENC=y
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+CONFIG_CRYPTO_CBC=y
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=y
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+CONFIG_CRYPTO_HMAC=y
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_GHASH is not set
+CONFIG_CRYPTO_MD4=y
+CONFIG_CRYPTO_MD5=y
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+CONFIG_CRYPTO_SHA1=y
+CONFIG_CRYPTO_SHA256=y
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+CONFIG_CRYPTO_AES=y
+# CONFIG_CRYPTO_ANUBIS is not set
+CONFIG_CRYPTO_ARC4=y
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+CONFIG_CRYPTO_TWOFISH=y
+CONFIG_CRYPTO_TWOFISH_COMMON=y
+
+#
+# Compression
+#
+CONFIG_CRYPTO_DEFLATE=y
+# CONFIG_CRYPTO_ZLIB is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+CONFIG_CRYPTO_ANSI_CPRNG=y
+# CONFIG_CRYPTO_USER_API_HASH is not set
+# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
+CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_DEV_QCE40=y
+CONFIG_CRYPTO_DEV_QCRYPTO=m
+CONFIG_CRYPTO_DEV_QCE=m
+CONFIG_CRYPTO_DEV_QCEDEV=m
+# CONFIG_CRYPTO_DEV_OTA_CRYPTO is not set
+CONFIG_BINARY_PRINTF=y
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_IO=y
+CONFIG_CRC_CCITT=y
+CONFIG_CRC16=y
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC32_SELFTEST is not set
+CONFIG_CRC32_SLICEBY8=y
+# CONFIG_CRC32_SLICEBY4 is not set
+# CONFIG_CRC32_SARWATE is not set
+# CONFIG_CRC32_BIT is not set
+# CONFIG_CRC7 is not set
+CONFIG_LIBCRC32C=y
+# CONFIG_CRC8 is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+# CONFIG_XZ_DEC is not set
+# CONFIG_XZ_DEC_BCJ is not set
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_DECOMPRESS_BZIP2=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_REED_SOLOMON=y
+CONFIG_REED_SOLOMON_ENC8=y
+CONFIG_REED_SOLOMON_DEC8=y
+CONFIG_TEXTSEARCH=y
+CONFIG_TEXTSEARCH_KMP=y
+CONFIG_TEXTSEARCH_BM=y
+CONFIG_TEXTSEARCH_FSM=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_CPU_RMAP=y
+CONFIG_DQL=y
+CONFIG_NLATTR=y
+# CONFIG_AVERAGE is not set
+# CONFIG_CORDIC is not set
diff --git a/arch/arm/configs/jet_defconfig b/arch/arm/configs/jet_defconfig
new file mode 100644
index 0000000..4f829a1
--- /dev/null
+++ b/arch/arm/configs/jet_defconfig
@@ -0,0 +1,3485 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux/arm 3.4.0 Kernel Configuration
+#
+CONFIG_ARM=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_KTIME_SCALAR=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_ARM_TICKET_LOCKS=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_ARCH_HAS_CPUFREQ=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_VECTORS_BASE=0xffff0000
+# CONFIG_ARM_PATCH_PHYS_VIRT is not set
+CONFIG_NEED_MACH_IO_H=y
+CONFIG_NEED_MACH_MEMORY_H=y
+CONFIG_PHYS_OFFSET=0x80400000
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_HAVE_IRQ_WORK=y
+CONFIG_IRQ_WORK=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=""
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_XZ=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_XZ is not set
+# CONFIG_KERNEL_LZO is not set
+CONFIG_DEFAULT_HOSTNAME="(none)"
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_FHANDLE is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+
+#
+# IRQ subsystem
+#
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_IRQ_DOMAIN=y
+# CONFIG_IRQ_DOMAIN_DEBUG is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_PREEMPT_RCU=y
+CONFIG_PREEMPT_RCU=y
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_RCU_FAST_NO_HZ is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_RCU_BOOST is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=17
+CONFIG_CGROUPS=y
+CONFIG_CGROUP_DEBUG=y
+CONFIG_CGROUP_FREEZER=y
+# CONFIG_CGROUP_DEVICE is not set
+# CONFIG_CPUSETS is not set
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_RESOURCE_COUNTERS=y
+# CONFIG_CGROUP_MEM_RES_CTLR is not set
+# CONFIG_CGROUP_PERF is not set
+CONFIG_CGROUP_SCHED=y
+CONFIG_FAIR_GROUP_SCHED=y
+# CONFIG_CFS_BANDWIDTH is not set
+CONFIG_RT_GROUP_SCHED=y
+# CONFIG_BLK_CGROUP is not set
+# CONFIG_CHECKPOINT_RESTORE is not set
+CONFIG_NAMESPACES=y
+# CONFIG_UTS_NS is not set
+# CONFIG_IPC_NS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+# CONFIG_NET_NS is not set
+# CONFIG_SCHED_AUTOGROUP is not set
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+CONFIG_RD_BZIP2=y
+CONFIG_RD_LZMA=y
+# CONFIG_RD_XZ is not set
+# CONFIG_RD_LZO is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_PANIC_TIMEOUT=5
+CONFIG_EXPERT=y
+CONFIG_UID16=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_ASHMEM=y
+CONFIG_AIO=y
+CONFIG_EMBEDDED=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_PERF_EVENTS=y
+# CONFIG_PERF_COUNTERS is not set
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+CONFIG_PROFILING=y
+CONFIG_TRACEPOINTS=y
+CONFIG_OPROFILE=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_KPROBES=y
+# CONFIG_JUMP_LABEL is not set
+CONFIG_KRETPROBES=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_CONTIGUOUS=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_HW_BREAKPOINT=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_STOP_MACHINE=y
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_BSGLIB is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_KARMA_PARTITION is not set
+CONFIG_EFI_PARTITION=y
+# CONFIG_SYSV68_PARTITION is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_TEST is not set
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_ROW=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_ROW=y
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="row"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_UNINLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
+CONFIG_FREEZER=y
+
+#
+# System Type
+#
+CONFIG_MMU=y
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_VEXPRESS is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_BCMRING is not set
+# CONFIG_ARCH_HIGHBANK is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CNS3XXX is not set
+# CONFIG_ARCH_GEMINI is not set
+# CONFIG_ARCH_PRIMA2 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_MXS is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_DOVE is not set
+# CONFIG_ARCH_KIRKWOOD is not set
+# CONFIG_ARCH_LPC32XX is not set
+# CONFIG_ARCH_MV78XX0 is not set
+# CONFIG_ARCH_ORION5X is not set
+# CONFIG_ARCH_MMP is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_W90X900 is not set
+# CONFIG_ARCH_TEGRA is not set
+# CONFIG_ARCH_PICOXCELL is not set
+# CONFIG_ARCH_PNX4008 is not set
+# CONFIG_ARCH_PXA is not set
+CONFIG_ARCH_MSM=y
+# CONFIG_ARCH_SHMOBILE is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C24XX is not set
+# CONFIG_ARCH_S3C64XX is not set
+# CONFIG_ARCH_S5P64X0 is not set
+# CONFIG_ARCH_S5PC100 is not set
+# CONFIG_ARCH_S5PV210 is not set
+# CONFIG_ARCH_EXYNOS is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_U300 is not set
+# CONFIG_ARCH_U8500 is not set
+# CONFIG_ARCH_NOMADIK is not set
+# CONFIG_ARCH_DAVINCI is not set
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_PLAT_SPEAR is not set
+# CONFIG_ARCH_VT8500 is not set
+# CONFIG_ARCH_ZYNQ is not set
+# CONFIG_GPIO_PCA953X is not set
+# CONFIG_KEYBOARD_GPIO_POLLED is not set
+
+#
+# MSM SoC Type
+#
+# CONFIG_ARCH_MSM7X01A is not set
+# CONFIG_ARCH_MSM7X25 is not set
+# CONFIG_ARCH_MSM7X27 is not set
+# CONFIG_ARCH_MSM7X30 is not set
+# CONFIG_ARCH_QSD8X50 is not set
+# CONFIG_ARCH_MSM8X60 is not set
+CONFIG_ARCH_MSM8960=y
+# CONFIG_ARCH_MSM8930 is not set
+# CONFIG_ARCH_APQ8064 is not set
+# CONFIG_ARCH_MSM8974 is not set
+# CONFIG_ARCH_MPQ8092 is not set
+# CONFIG_ARCH_MSM8226 is not set
+# CONFIG_ARCH_FSM9XXX is not set
+# CONFIG_ARCH_MSM9615 is not set
+# CONFIG_ARCH_MSM8625 is not set
+# CONFIG_ARCH_MSM9625 is not set
+CONFIG_MSM_SOC_REV_NONE=y
+# CONFIG_MSM_SOC_REV_A is not set
+CONFIG_MSM_KRAIT_TBB_ABORT_HANDLER=y
+CONFIG_ARCH_MSM_KRAIT=y
+CONFIG_MSM_SMP=y
+CONFIG_ARCH_MSM_KRAITMP=y
+CONFIG_MSM_KRAIT_WFE_FIXUP=y
+CONFIG_MSM_RPM=y
+# CONFIG_MSM_RPM_SMD is not set
+CONFIG_MSM_MPM=y
+CONFIG_MSM_XO=y
+CONFIG_MSM_REMOTE_SPINLOCK_SFPB=y
+
+#
+# MSM Board Selection
+#
+# CONFIG_MACH_MSM8960_CDP is not set
+# CONFIG_MACH_MSM8960_MTP is not set
+# CONFIG_MACH_MSM8960_FLUID is not set
+# CONFIG_MACH_MSM8960_LIQUID is not set
+# CONFIG_MACH_MSM_DUMMY is not set
+
+#
+# LGE Board Selection
+#
+CONFIG_BOARD_HEADER_FILE=""
+# CONFIG_MACH_LGE_DUMMY is not set
+
+#
+# LGE Specific Patches
+#
+# CONFIG_LGE_CRASH_HANDLER is not set
+CONFIG_MACH_HTC=y
+
+#
+# HTC Board Selection
+#
+# CONFIG_MACH_ELITE is not set
+CONFIG_MACH_JET=y
+# CONFIG_MACH_VILLE is not set
+# CONFIG_MACH_HTC_DUMMY is not set
+
+#
+# HTC Specific Patches
+#
+CONFIG_HTC_BATT_CORE=y
+CONFIG_HTC_BATT_8960=y
+CONFIG_HTC_HEADSET_MGR=y
+CONFIG_HTC_HEADSET_PMIC=y
+# CONFIG_HTC_HEADSET_ONE_WIRE is not set
+# CONFIG_MSM_STACKED_MEMORY is not set
+# CONFIG_KERNEL_MSM_CONTIG_MEM_REGION is not set
+CONFIG_MSM_AMSS_VERSION=6225
+# CONFIG_MSM_AMSS_VERSION_6210 is not set
+# CONFIG_MSM_AMSS_VERSION_6220 is not set
+CONFIG_MSM_AMSS_VERSION_6225=y
+CONFIG_MSM7X00A_USE_GP_TIMER=y
+# CONFIG_MSM7X00A_USE_DG_TIMER is not set
+CONFIG_MSM7X00A_SLEEP_MODE_POWER_COLLAPSE_SUSPEND=y
+# CONFIG_MSM7X00A_SLEEP_MODE_POWER_COLLAPSE is not set
+# CONFIG_MSM7X00A_SLEEP_MODE_APPS_SLEEP is not set
+# CONFIG_MSM7X00A_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT is not set
+# CONFIG_MSM7X00A_SLEEP_WAIT_FOR_INTERRUPT is not set
+CONFIG_MSM7X00A_SLEEP_MODE=0
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_POWER_COLLAPSE_SUSPEND is not set
+CONFIG_MSM7X00A_IDLE_SLEEP_MODE_POWER_COLLAPSE=y
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_APPS_SLEEP is not set
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT is not set
+# CONFIG_MSM7X00A_IDLE_SLEEP_WAIT_FOR_INTERRUPT is not set
+CONFIG_MSM7X00A_IDLE_SLEEP_MODE=1
+CONFIG_MSM7X00A_IDLE_SLEEP_MIN_TIME=20000000
+CONFIG_MSM7X00A_IDLE_SPIN_TIME=80000
+CONFIG_MSM_IDLE_STATS=y
+CONFIG_MSM_IDLE_STATS_FIRST_BUCKET=62500
+CONFIG_MSM_IDLE_STATS_BUCKET_SHIFT=2
+CONFIG_MSM_IDLE_STATS_BUCKET_COUNT=10
+CONFIG_MSM_SUSPEND_STATS_FIRST_BUCKET=1000000000
+CONFIG_CPU_HAS_L2_PMU=y
+# CONFIG_HTC_HEADSET is not set
+# CONFIG_HTC_PWRSINK is not set
+# CONFIG_MSM_FIQ_SUPPORT is not set
+# CONFIG_MSM_SERIAL_DEBUGGER is not set
+# CONFIG_MSM_PROC_COMM is not set
+CONFIG_MSM_SMD=y
+# CONFIG_MSM_SMD_PKG3 is not set
+CONFIG_MSM_SMD_PKG4=y
+CONFIG_MSM_SMD_DEBUG=y
+CONFIG_MSM_BAM_DMUX=y
+CONFIG_MSM_N_WAY_SMD=y
+CONFIG_MSM_N_WAY_SMSM=y
+CONFIG_MSM_RESET_MODEM=y
+CONFIG_MSM_SMD_LOGGING=y
+# CONFIG_MSM_IPC_LOGGING is not set
+CONFIG_MSM_SMD_NMEA=y
+# CONFIG_MSM_HSIC_TTY is not set
+CONFIG_MSM_SMD_TTY=y
+CONFIG_MSM_SMD_QMI=y
+CONFIG_MSM_SMD_PKT=y
+# CONFIG_MSM_DSPS is not set
+# CONFIG_MSM_ONCRPCROUTER is not set
+CONFIG_MSM_IPC_ROUTER=y
+CONFIG_MSM_IPC_ROUTER_SMD_XPRT=y
+# CONFIG_MSM_IPC_ROUTER_SECURITY is not set
+# CONFIG_MSM_DALRPC is not set
+# CONFIG_MSM_CPU_FREQ_SET_MIN_MAX is not set
+CONFIG_MSM_AVS_HW=y
+# CONFIG_MSM_HW3D is not set
+CONFIG_AMSS_7X25_VERSION_2009=y
+# CONFIG_AMSS_7X25_VERSION_2008 is not set
+CONFIG_RTAC=y
+# CONFIG_MSM_VREG_SWITCH_INVERTED is not set
+# CONFIG_MSM_DMA_TEST is not set
+# CONFIG_WIFI_CONTROL_FUNC is not set
+CONFIG_SURF_FFA_GPIO_KEYPAD=y
+CONFIG_MSM_SLEEP_TIME_OVERRIDE=y
+# CONFIG_MSM_MEMORY_LOW_POWER_MODE is not set
+CONFIG_MSM_PM_TIMEOUT_HALT=y
+# CONFIG_MSM_PM_TIMEOUT_RESET_MODEM is not set
+# CONFIG_MSM_PM_TIMEOUT_RESET_CHIP is not set
+CONFIG_MSM_IDLE_WAIT_ON_MODEM=0
+CONFIG_MSM_RPM_REGULATOR=y
+CONFIG_MSM_SUBSYSTEM_RESTART=y
+CONFIG_MSM_SYSMON_COMM=y
+CONFIG_MSM_PIL=y
+# CONFIG_MSM_PIL_MODEM is not set
+# CONFIG_MSM_PIL_QDSP6V3 is not set
+CONFIG_MSM_PIL_QDSP6V4=y
+# CONFIG_MSM_PIL_LPASS_QDSP6V5 is not set
+# CONFIG_MSM_PIL_MSS_QDSP6V5 is not set
+CONFIG_MSM_PIL_RIVA=y
+CONFIG_MSM_INSECURE_PIL_RIVA=y
+# CONFIG_MSM_PIL_TZAPPS is not set
+# CONFIG_MSM_PIL_DSPS is not set
+# CONFIG_MSM_PIL_VIDC is not set
+# CONFIG_MSM_PIL_VENUS is not set
+# CONFIG_MSM_PIL_GSS is not set
+# CONFIG_MSM_PIL_PRONTO is not set
+CONFIG_MSM_SCM=y
+CONFIG_MSM_MODEM_8960=y
+CONFIG_MSM_LPASS_8960=y
+CONFIG_MSM_WCNSS_SSR_8960=y
+CONFIG_MSM_BUSPM_DEV=y
+CONFIG_MSM_TZ_LOG=y
+CONFIG_MSM_RPM_LOG=y
+CONFIG_MSM_RPM_STATS_LOG=y
+# CONFIG_MSM_RPM_RBCPR_STATS_LOG is not set
+CONFIG_MSM_DIRECT_SCLK_ACCESS=y
+CONFIG_IOMMU_API=y
+CONFIG_MSM_GPIOMUX=y
+CONFIG_MSM_NATIVE_RESTART=y
+CONFIG_MSM_PM8X60=y
+# CONFIG_MSM_EVENT_TIMER is not set
+CONFIG_MSM_BUS_SCALING=y
+CONFIG_MSM_BUS_RPM_MULTI_TIER_ENABLED=y
+CONFIG_MSM_WATCHDOG=y
+# CONFIG_MSM_WATCHDOG_V2 is not set
+# CONFIG_MSM_MEMORY_DUMP is not set
+CONFIG_MSM_DLOAD_MODE=y
+# CONFIG_MSM_JTAG is not set
+# CONFIG_MSM_JTAG_MM is not set
+# CONFIG_MSM_SLEEP_STATS_DEVICE is not set
+CONFIG_MSM_RUN_QUEUE_STATS=y
+CONFIG_MSM_STANDALONE_POWER_COLLAPSE=y
+# CONFIG_MSM_GSBI9_UART is not set
+CONFIG_MSM_SHOW_RESUME_IRQ=y
+# CONFIG_MSM_FAKE_BATTERY is not set
+CONFIG_MSM_QDSP6_APR=y
+# CONFIG_MSM_QDSP6_APRV2 is not set
+CONFIG_MSM_QDSP6_CODECS=y
+# CONFIG_MSM_QDSP6V2_CODECS is not set
+CONFIG_MSM_AUDIO_QDSP6=y
+# CONFIG_MSM_AUDIO_QDSP6V2 is not set
+# CONFIG_MSM_ULTRASOUND is not set
+# CONFIG_MSM_SPM_V1 is not set
+CONFIG_MSM_SPM_V2=y
+CONFIG_MSM_L2_SPM=y
+CONFIG_MSM_MULTIMEDIA_USE_ION=y
+# CONFIG_MSM_OCMEM is not set
+# CONFIG_MSM_RTB is not set
+# CONFIG_MSM_EBI_ERP is not set
+# CONFIG_MSM_CACHE_ERP is not set
+CONFIG_MSM_DCVS=y
+# CONFIG_MSM_CPR is not set
+CONFIG_HAVE_ARCH_HAS_CURRENT_TIMER=y
+# CONFIG_MSM_CACHE_DUMP is not set
+# CONFIG_MSM_HSIC_SYSMON is not set
+CONFIG_MSM_CPU_PWRCTL=y
+
+#
+# System MMU
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_V7=y
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV7=y
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_HAS_ASID=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+# CONFIG_ARM_LPAE is not set
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_ARM_THUMB=y
+# CONFIG_ARM_THUMBEE is not set
+CONFIG_SWP_EMULATE=y
+# CONFIG_CPU_ICACHE_DISABLE is not set
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+# CONFIG_CACHE_L2X0 is not set
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_DMA_MEM_BUFFERABLE=y
+# CONFIG_VCM is not set
+CONFIG_STRICT_MEMORY_RWX=y
+CONFIG_ARM_NR_BANKS=8
+# CONFIG_RESERVE_FIRST_PAGE is not set
+CONFIG_CPU_HAS_PMU=y
+CONFIG_MULTI_IRQ_HANDLER=y
+# CONFIG_ARM_ERRATA_430973 is not set
+# CONFIG_ARM_ERRATA_458693 is not set
+# CONFIG_ARM_ERRATA_460075 is not set
+# CONFIG_ARM_ERRATA_742230 is not set
+# CONFIG_ARM_ERRATA_742231 is not set
+# CONFIG_ARM_ERRATA_720789 is not set
+# CONFIG_ARM_ERRATA_743622 is not set
+# CONFIG_ARM_ERRATA_751472 is not set
+# CONFIG_ARM_ERRATA_754322 is not set
+# CONFIG_ARM_ERRATA_754327 is not set
+# CONFIG_ARM_ERRATA_764369 is not set
+# CONFIG_KSAPI is not set
+CONFIG_ARM_GIC=y
+# CONFIG_FIQ_DEBUGGER is not set
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_HAVE_SMP=y
+CONFIG_SMP=y
+# CONFIG_SMP_ON_UP is not set
+CONFIG_ARM_CPU_TOPOLOGY=y
+# CONFIG_SCHED_MC is not set
+# CONFIG_SCHED_SMT is not set
+CONFIG_HAVE_ARM_SCU=y
+# CONFIG_ARM_ARCH_TIMER is not set
+CONFIG_VMSPLIT_3G=y
+# CONFIG_VMSPLIT_2G is not set
+# CONFIG_VMSPLIT_1G is not set
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_NR_CPUS=2
+CONFIG_HOTPLUG_CPU=y
+CONFIG_LOCAL_TIMERS=y
+CONFIG_ARCH_NR_GPIO=0
+# CONFIG_PREEMPT_NONE is not set
+# CONFIG_PREEMPT_VOLUNTARY is not set
+CONFIG_PREEMPT=y
+CONFIG_PREEMPT_COUNT=y
+CONFIG_HZ=100
+# CONFIG_THUMB2_KERNEL is not set
+CONFIG_AEABI=y
+CONFIG_OABI_COMPAT=y
+CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_HAVE_ARCH_PFN_VALID=y
+CONFIG_HIGHMEM=y
+# CONFIG_HIGHPTE is not set
+CONFIG_HW_PERF_EVENTS=y
+CONFIG_VMALLOC_RESERVE=0x25800000
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_SPARSEMEM_MANUAL=y
+CONFIG_SPARSEMEM=y
+CONFIG_HAVE_MEMORY_PRESENT=y
+CONFIG_SPARSEMEM_EXTREME=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_COMPACTION=y
+CONFIG_MIGRATION=y
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_CLEANCACHE=y
+# CONFIG_ARCH_MEMORY_PROBE is not set
+# CONFIG_ARCH_MEMORY_REMOVE is not set
+# CONFIG_ENABLE_DMM is not set
+CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0=y
+CONFIG_HOLES_IN_ZONE=y
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_UACCESS_WITH_MEMCPY is not set
+# CONFIG_SECCOMP is not set
+CONFIG_CC_STACKPROTECTOR=y
+# CONFIG_DEPRECATED_PARAM_STRUCT is not set
+# CONFIG_ARM_FLUSH_CONSOLE_ON_RESTART is not set
+CONFIG_CP_ACCESS=y
+
+#
+# Boot options
+#
+# CONFIG_USE_OF is not set
+CONFIG_ZBOOT_ROM_TEXT=0
+CONFIG_ZBOOT_ROM_BSS=0
+CONFIG_CMDLINE=""
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
+# CONFIG_AUTO_ZRELADDR is not set
+
+#
+# CPU Power Management
+#
+
+#
+# CPU Frequency scaling
+#
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_TABLE=y
+CONFIG_CPU_FREQ_STAT=y
+# CONFIG_CPU_FREQ_STAT_DETAILS is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=y
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_INTERACTIVE=y
+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
+
+#
+# ARM CPU frequency scaling drivers
+#
+# CONFIG_ARM_EXYNOS4210_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS4X12_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS5250_CPUFREQ is not set
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_IDLE_GOV_MENU=y
+CONFIG_CPU_FREQ_MSM=y
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+# CONFIG_FPE_NWFPE is not set
+# CONFIG_FPE_FASTFPE is not set
+CONFIG_VFP=y
+CONFIG_VFPv3=y
+CONFIG_NEON=y
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+CONFIG_HAVE_AOUT=y
+# CONFIG_BINFMT_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+
+#
+# Power management options
+#
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+CONFIG_HAS_WAKELOCK=y
+CONFIG_HAS_EARLYSUSPEND=y
+CONFIG_WAKELOCK=y
+CONFIG_WAKELOCK_STAT=y
+CONFIG_USER_WAKELOCK=y
+CONFIG_EARLYSUSPEND=y
+# CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL is not set
+CONFIG_FB_EARLYSUSPEND=y
+CONFIG_PM_SLEEP=y
+CONFIG_PM_SLEEP_SMP=y
+CONFIG_PM_RUNTIME=y
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_CLK=y
+CONFIG_CPU_PM=y
+# CONFIG_SUSPEND_TIME is not set
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+# CONFIG_UNIX_DIAG is not set
+CONFIG_XFRM=y
+CONFIG_XFRM_USER=y
+# CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
+CONFIG_XFRM_IPCOMP=y
+CONFIG_NET_KEY=y
+# CONFIG_NET_KEY_MIGRATE is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_ADVANCED_ROUTER=y
+# CONFIG_IP_FIB_TRIE_STATS is not set
+CONFIG_IP_MULTIPLE_TABLES=y
+# CONFIG_IP_ROUTE_MULTIPATH is not set
+# CONFIG_IP_ROUTE_VERBOSE is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE_DEMUX is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+CONFIG_INET_AH=y
+CONFIG_INET_ESP=y
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+CONFIG_INET_TUNNEL=y
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+CONFIG_IPV6=y
+CONFIG_IPV6_PRIVACY=y
+CONFIG_IPV6_ROUTER_PREF=y
+CONFIG_IPV6_ROUTE_INFO=y
+CONFIG_IPV6_OPTIMISTIC_DAD=y
+CONFIG_INET6_AH=y
+CONFIG_INET6_ESP=y
+CONFIG_INET6_IPCOMP=y
+CONFIG_IPV6_MIP6=y
+CONFIG_INET6_XFRM_TUNNEL=y
+CONFIG_INET6_TUNNEL=y
+CONFIG_INET6_XFRM_MODE_TRANSPORT=y
+CONFIG_INET6_XFRM_MODE_TUNNEL=y
+CONFIG_INET6_XFRM_MODE_BEET=y
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+CONFIG_IPV6_SIT=y
+# CONFIG_IPV6_SIT_6RD is not set
+CONFIG_IPV6_NDISC_NODETYPE=y
+# CONFIG_IPV6_TUNNEL is not set
+CONFIG_IPV6_MULTIPLE_TABLES=y
+CONFIG_IPV6_SUBTREES=y
+# CONFIG_IPV6_MROUTE is not set
+# CONFIG_ANDROID_PARANOID_NETWORK is not set
+CONFIG_NET_ACTIVITY_STATS=y
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+CONFIG_NETFILTER_ADVANCED=y
+
+#
+# Core Netfilter Configuration
+#
+CONFIG_NETFILTER_NETLINK=y
+# CONFIG_NETFILTER_NETLINK_ACCT is not set
+CONFIG_NETFILTER_NETLINK_QUEUE=y
+CONFIG_NETFILTER_NETLINK_LOG=y
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_CONNTRACK_MARK=y
+CONFIG_NF_CONNTRACK_PROCFS=y
+CONFIG_NF_CONNTRACK_EVENTS=y
+# CONFIG_NF_CONNTRACK_TIMEOUT is not set
+# CONFIG_NF_CONNTRACK_TIMESTAMP is not set
+CONFIG_NF_CT_PROTO_DCCP=y
+CONFIG_NF_CT_PROTO_GRE=y
+CONFIG_NF_CT_PROTO_SCTP=y
+CONFIG_NF_CT_PROTO_UDPLITE=y
+CONFIG_NF_CONNTRACK_AMANDA=y
+CONFIG_NF_CONNTRACK_FTP=y
+CONFIG_NF_CONNTRACK_H323=y
+CONFIG_NF_CONNTRACK_IRC=y
+CONFIG_NF_CONNTRACK_BROADCAST=y
+CONFIG_NF_CONNTRACK_NETBIOS_NS=y
+# CONFIG_NF_CONNTRACK_SNMP is not set
+CONFIG_NF_CONNTRACK_PPTP=y
+CONFIG_NF_CONNTRACK_SANE=y
+CONFIG_NF_CONNTRACK_SIP=y
+CONFIG_NF_CONNTRACK_TFTP=y
+CONFIG_NF_CT_NETLINK=y
+# CONFIG_NF_CT_NETLINK_TIMEOUT is not set
+CONFIG_NETFILTER_TPROXY=y
+CONFIG_NETFILTER_XTABLES=y
+
+#
+# Xtables combined modules
+#
+CONFIG_NETFILTER_XT_MARK=y
+CONFIG_NETFILTER_XT_CONNMARK=y
+
+#
+# Xtables targets
+#
+# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set
+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
+CONFIG_NETFILTER_XT_TARGET_CONNMARK=y
+# CONFIG_NETFILTER_XT_TARGET_CT is not set
+# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
+CONFIG_NETFILTER_XT_TARGET_HL=y
+# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set
+# CONFIG_NETFILTER_XT_TARGET_LOG is not set
+CONFIG_NETFILTER_XT_TARGET_MARK=y
+# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y
+# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set
+# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
+# CONFIG_NETFILTER_XT_TARGET_TEE is not set
+# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set
+# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
+CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
+# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
+
+#
+# Xtables matches
+#
+# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set
+# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set
+CONFIG_NETFILTER_XT_MATCH_COMMENT=y
+# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set
+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y
+CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
+# CONFIG_NETFILTER_XT_MATCH_CPU is not set
+# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
+# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set
+# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
+CONFIG_NETFILTER_XT_MATCH_ECN=y
+CONFIG_NETFILTER_XT_MATCH_ESP=y
+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y
+CONFIG_NETFILTER_XT_MATCH_HELPER=y
+CONFIG_NETFILTER_XT_MATCH_HL=y
+CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
+CONFIG_NETFILTER_XT_MATCH_LENGTH=y
+CONFIG_NETFILTER_XT_MATCH_LIMIT=y
+CONFIG_NETFILTER_XT_MATCH_MAC=y
+CONFIG_NETFILTER_XT_MATCH_MARK=y
+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
+# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set
+# CONFIG_NETFILTER_XT_MATCH_OSF is not set
+# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
+CONFIG_NETFILTER_XT_MATCH_POLICY=y
+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
+CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA2=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG=y
+# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
+# CONFIG_NETFILTER_XT_MATCH_REALM is not set
+# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
+# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
+CONFIG_NETFILTER_XT_MATCH_SOCKET=y
+CONFIG_NETFILTER_XT_MATCH_STATE=y
+CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
+CONFIG_NETFILTER_XT_MATCH_STRING=y
+CONFIG_NETFILTER_XT_MATCH_TCPMSS=y
+CONFIG_NETFILTER_XT_MATCH_TIME=y
+CONFIG_NETFILTER_XT_MATCH_U32=y
+# CONFIG_IP_SET is not set
+# CONFIG_IP_VS is not set
+
+#
+# IP: Netfilter Configuration
+#
+CONFIG_NF_DEFRAG_IPV4=y
+CONFIG_NF_CONNTRACK_IPV4=y
+CONFIG_NF_CONNTRACK_PROC_COMPAT=y
+# CONFIG_IP_NF_QUEUE is not set
+CONFIG_IP_NF_IPTABLES=y
+CONFIG_IP_NF_MATCH_AH=y
+CONFIG_IP_NF_MATCH_ECN=y
+# CONFIG_IP_NF_MATCH_RPFILTER is not set
+CONFIG_IP_NF_MATCH_TTL=y
+CONFIG_IP_NF_FILTER=y
+CONFIG_IP_NF_TARGET_REJECT=y
+# CONFIG_IP_NF_TARGET_REJECT_SKERR is not set
+# CONFIG_IP_NF_TARGET_ULOG is not set
+CONFIG_NF_NAT=y
+CONFIG_NF_NAT_NEEDED=y
+CONFIG_IP_NF_TARGET_MASQUERADE=y
+CONFIG_IP_NF_TARGET_NETMAP=y
+CONFIG_IP_NF_TARGET_REDIRECT=y
+CONFIG_NF_NAT_PROTO_DCCP=y
+CONFIG_NF_NAT_PROTO_GRE=y
+CONFIG_NF_NAT_PROTO_UDPLITE=y
+CONFIG_NF_NAT_PROTO_SCTP=y
+CONFIG_NF_NAT_FTP=y
+CONFIG_NF_NAT_IRC=y
+CONFIG_NF_NAT_TFTP=y
+CONFIG_NF_NAT_AMANDA=y
+CONFIG_NF_NAT_PPTP=y
+CONFIG_NF_NAT_H323=y
+CONFIG_NF_NAT_SIP=y
+CONFIG_IP_NF_MANGLE=y
+# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
+# CONFIG_IP_NF_TARGET_ECN is not set
+# CONFIG_IP_NF_TARGET_TTL is not set
+CONFIG_IP_NF_RAW=y
+CONFIG_IP_NF_ARPTABLES=y
+CONFIG_IP_NF_ARPFILTER=y
+CONFIG_IP_NF_ARP_MANGLE=y
+
+#
+# IPv6: Netfilter Configuration
+#
+CONFIG_NF_DEFRAG_IPV6=y
+CONFIG_NF_CONNTRACK_IPV6=y
+# CONFIG_IP6_NF_QUEUE is not set
+CONFIG_IP6_NF_IPTABLES=y
+CONFIG_IP6_NF_MATCH_AH=y
+CONFIG_IP6_NF_MATCH_EUI64=y
+CONFIG_IP6_NF_MATCH_FRAG=y
+CONFIG_IP6_NF_MATCH_OPTS=y
+CONFIG_IP6_NF_MATCH_HL=y
+CONFIG_IP6_NF_MATCH_IPV6HEADER=y
+CONFIG_IP6_NF_MATCH_MH=y
+# CONFIG_IP6_NF_MATCH_RPFILTER is not set
+CONFIG_IP6_NF_MATCH_RT=y
+CONFIG_IP6_NF_TARGET_HL=y
+CONFIG_IP6_NF_FILTER=y
+CONFIG_IP6_NF_TARGET_REJECT=y
+# CONFIG_IP6_NF_TARGET_REJECT_SKERR is not set
+CONFIG_IP6_NF_MANGLE=y
+CONFIG_IP6_NF_RAW=y
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_L2TP is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+CONFIG_NET_SCHED=y
+
+#
+# Queueing/Scheduling
+#
+# CONFIG_NET_SCH_CBQ is not set
+CONFIG_NET_SCH_HTB=y
+# CONFIG_NET_SCH_HFSC is not set
+CONFIG_NET_SCH_PRIO=y
+# CONFIG_NET_SCH_MULTIQ is not set
+# CONFIG_NET_SCH_RED is not set
+# CONFIG_NET_SCH_SFB is not set
+# CONFIG_NET_SCH_SFQ is not set
+# CONFIG_NET_SCH_TEQL is not set
+# CONFIG_NET_SCH_TBF is not set
+# CONFIG_NET_SCH_GRED is not set
+# CONFIG_NET_SCH_DSMARK is not set
+# CONFIG_NET_SCH_NETEM is not set
+# CONFIG_NET_SCH_DRR is not set
+# CONFIG_NET_SCH_MQPRIO is not set
+# CONFIG_NET_SCH_CHOKE is not set
+# CONFIG_NET_SCH_QFQ is not set
+# CONFIG_NET_SCH_INGRESS is not set
+# CONFIG_NET_SCH_PLUG is not set
+
+#
+# Classification
+#
+CONFIG_NET_CLS=y
+# CONFIG_NET_CLS_BASIC is not set
+# CONFIG_NET_CLS_TCINDEX is not set
+# CONFIG_NET_CLS_ROUTE4 is not set
+CONFIG_NET_CLS_FW=y
+CONFIG_NET_CLS_U32=y
+# CONFIG_CLS_U32_PERF is not set
+CONFIG_CLS_U32_MARK=y
+# CONFIG_NET_CLS_RSVP is not set
+# CONFIG_NET_CLS_RSVP6 is not set
+CONFIG_NET_CLS_FLOW=y
+# CONFIG_NET_CLS_CGROUP is not set
+CONFIG_NET_EMATCH=y
+CONFIG_NET_EMATCH_STACK=32
+CONFIG_NET_EMATCH_CMP=y
+CONFIG_NET_EMATCH_NBYTE=y
+CONFIG_NET_EMATCH_U32=y
+CONFIG_NET_EMATCH_META=y
+CONFIG_NET_EMATCH_TEXT=y
+CONFIG_NET_CLS_ACT=y
+# CONFIG_NET_ACT_POLICE is not set
+# CONFIG_NET_ACT_GACT is not set
+# CONFIG_NET_ACT_MIRRED is not set
+# CONFIG_NET_ACT_IPT is not set
+# CONFIG_NET_ACT_NAT is not set
+# CONFIG_NET_ACT_PEDIT is not set
+# CONFIG_NET_ACT_SIMP is not set
+# CONFIG_NET_ACT_SKBEDIT is not set
+# CONFIG_NET_ACT_CSUM is not set
+# CONFIG_NET_CLS_IND is not set
+CONFIG_NET_SCH_FIFO=y
+# CONFIG_DCB is not set
+CONFIG_DNS_RESOLVER=y
+# CONFIG_BATMAN_ADV is not set
+# CONFIG_OPENVSWITCH is not set
+CONFIG_RPS=y
+CONFIG_RFS_ACCEL=y
+CONFIG_XPS=y
+# CONFIG_NETPRIO_CGROUP is not set
+CONFIG_BQL=y
+CONFIG_HAVE_BPF_JIT=y
+# CONFIG_BPF_JIT is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NET_TCPPROBE is not set
+# CONFIG_NET_DROP_MONITOR is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_RFCOMM_TTY=y
+CONFIG_BT_BNEP=y
+CONFIG_BT_BNEP_MC_FILTER=y
+CONFIG_BT_BNEP_PROTO_FILTER=y
+CONFIG_BT_HIDP=y
+
+#
+# Bluetooth device drivers
+#
+CONFIG_BT_HCISMD=y
+# CONFIG_BT_HCIBTUSB is not set
+# CONFIG_BT_HCIBTSDIO is not set
+# CONFIG_BT_HCIUART is not set
+# CONFIG_BT_HCIBCM203X is not set
+# CONFIG_BT_HCIBPA10X is not set
+# CONFIG_BT_MSM_SLEEP is not set
+# CONFIG_BT_HCIBFUSB is not set
+# CONFIG_BT_HCIVHCI is not set
+# CONFIG_BT_MRVL is not set
+# CONFIG_MSM_BT_POWER is not set
+# CONFIG_AF_RXRPC is not set
+CONFIG_FIB_RULES=y
+CONFIG_WIRELESS=y
+CONFIG_WIRELESS_EXT=y
+CONFIG_WEXT_CORE=y
+CONFIG_WEXT_PROC=y
+CONFIG_WEXT_SPY=y
+CONFIG_WEXT_PRIV=y
+CONFIG_CFG80211=y
+# CONFIG_NL80211_TESTMODE is not set
+# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
+# CONFIG_CFG80211_REG_DEBUG is not set
+CONFIG_CFG80211_DEFAULT_PS=y
+# CONFIG_CFG80211_DEBUGFS is not set
+# CONFIG_CFG80211_INTERNAL_REGDB is not set
+# CONFIG_CFG80211_WEXT is not set
+CONFIG_WIRELESS_EXT_SYSFS=y
+# CONFIG_LIB80211 is not set
+# CONFIG_CFG80211_ALLOW_RECONNECT is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_WIMAX is not set
+CONFIG_RFKILL=y
+CONFIG_RFKILL_PM=y
+# CONFIG_RFKILL_INPUT is not set
+# CONFIG_RFKILL_REGULATOR is not set
+# CONFIG_RFKILL_GPIO is not set
+# CONFIG_NET_9P is not set
+# CONFIG_CAIF is not set
+# CONFIG_CEPH_LIB is not set
+# CONFIG_NFC is not set
+# CONFIG_BCM2079X is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH=""
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_GENERIC_CPU_DEVICES is not set
+CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
+CONFIG_REGMAP_SPI=y
+CONFIG_DMA_SHARED_BUFFER=y
+CONFIG_GENLOCK=y
+CONFIG_GENLOCK_MISCDEVICE=y
+CONFIG_SYNC=y
+CONFIG_SW_SYNC=y
+# CONFIG_SW_SYNC_USER is not set
+# CONFIG_CMA is not set
+# CONFIG_CONNECTOR is not set
+# CONFIG_MTD is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=4096
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_MG_DISK is not set
+# CONFIG_BLK_DEV_RBD is not set
+
+#
+# Misc devices
+#
+# CONFIG_SENSORS_LIS3LV02D is not set
+# CONFIG_AD525X_DPOT is not set
+CONFIG_ANDROID_PMEM=y
+# CONFIG_ATMEL_PWM is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_APDS9802ALS is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_ISL29020 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_SENSORS_BH1780 is not set
+# CONFIG_SENSORS_BH1770 is not set
+# CONFIG_SENSORS_APDS990X is not set
+# CONFIG_HMC6352 is not set
+# CONFIG_SENSORS_AK8975 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
+CONFIG_UID_STAT=y
+# CONFIG_BMP085 is not set
+# CONFIG_USB_SWITCH_FSA9480 is not set
+# CONFIG_WL127X_RFKILL is not set
+# CONFIG_APANIC is not set
+# CONFIG_TSIF is not set
+# CONFIG_TSPP is not set
+# CONFIG_HAPTIC_ISA1200 is not set
+CONFIG_PMIC8XXX_VIBRATOR=y
+# CONFIG_PMIC8XXX_VIBRATOR_PWM is not set
+# CONFIG_ANDROID_VIBRATOR is not set
+# CONFIG_TOUCHSENSE_VIBRATOR is not set
+# CONFIG_PMIC8XXX_NFC is not set
+# CONFIG_PMIC8XXX_UPL is not set
+# CONFIG_QSEECOM is not set
+# CONFIG_QFP_FUSE is not set
+# CONFIG_BU52031NVX is not set
+CONFIG_CABLE_DETECT_8XXX=y
+CONFIG_CABLE_DETECT_ACCESSORY=y
+CONFIG_CABLE_DETECT_ACCESSORY_BY_ADC=y
+# CONFIG_VP_A1028 is not set
+CONFIG_SENSORS_NFC_PN544=y
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_AT25 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_EEPROM_93XX46 is not set
+# CONFIG_IWMC3200TOP is not set
+
+#
+# Texas Instruments shared transport line discipline
+#
+# CONFIG_TI_ST is not set
+# CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
+
+#
+# Altera FPGA firmware download module
+#
+# CONFIG_ALTERA_STAPL is not set
+# CONFIG_SLIMPORT_ANX7808 is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI_MOD=y
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+CONFIG_SCSI_TGT=y
+# CONFIG_SCSI_NETLINK is not set
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+CONFIG_CHR_DEV_SG=y
+CONFIG_CHR_DEV_SCH=y
+CONFIG_SCSI_MULTI_LUN=y
+CONFIG_SCSI_CONSTANTS=y
+CONFIG_SCSI_LOGGING=y
+CONFIG_SCSI_SCAN_ASYNC=y
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_ISCSI_BOOT_SYSFS is not set
+# CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
+# CONFIG_ATA is not set
+CONFIG_MD=y
+# CONFIG_BLK_DEV_MD is not set
+CONFIG_BLK_DEV_DM=y
+# CONFIG_DM_DEBUG is not set
+CONFIG_DM_CRYPT=y
+# CONFIG_DM_SNAPSHOT is not set
+# CONFIG_DM_THIN_PROVISIONING is not set
+# CONFIG_DM_MIRROR is not set
+# CONFIG_DM_RAID is not set
+# CONFIG_DM_ZERO is not set
+# CONFIG_DM_MULTIPATH is not set
+# CONFIG_DM_DELAY is not set
+# CONFIG_DM_UEVENT is not set
+# CONFIG_DM_FLAKEY is not set
+# CONFIG_DM_VERITY is not set
+# CONFIG_TARGET_CORE is not set
+CONFIG_NETDEVICES=y
+CONFIG_NET_CORE=y
+# CONFIG_BONDING is not set
+CONFIG_DUMMY=y
+# CONFIG_EQUALIZER is not set
+CONFIG_MII=y
+# CONFIG_IFB is not set
+# CONFIG_NET_TEAM is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+CONFIG_TUN=y
+# CONFIG_VETH is not set
+
+#
+# CAIF transport drivers
+#
+CONFIG_ETHERNET=y
+CONFIG_NET_VENDOR_BROADCOM=y
+# CONFIG_B44 is not set
+# CONFIG_NET_CALXEDA_XGMAC is not set
+CONFIG_NET_VENDOR_CHELSIO=y
+CONFIG_NET_VENDOR_CIRRUS=y
+# CONFIG_CS89x0 is not set
+# CONFIG_DM9000 is not set
+# CONFIG_DNET is not set
+CONFIG_NET_VENDOR_FARADAY=y
+# CONFIG_FTMAC100 is not set
+# CONFIG_FTGMAC100 is not set
+CONFIG_NET_VENDOR_INTEL=y
+CONFIG_NET_VENDOR_I825XX=y
+CONFIG_NET_VENDOR_MARVELL=y
+CONFIG_NET_VENDOR_MICREL=y
+# CONFIG_KS8851 is not set
+# CONFIG_KS8851_MLL is not set
+CONFIG_NET_VENDOR_MICROCHIP=y
+# CONFIG_ENC28J60 is not set
+# CONFIG_MSM_RMNET is not set
+CONFIG_MSM_RMNET_BAM=y
+# CONFIG_QFEC is not set
+CONFIG_NET_VENDOR_NATSEMI=y
+CONFIG_NET_VENDOR_8390=y
+# CONFIG_AX88796 is not set
+# CONFIG_ETHOC is not set
+CONFIG_NET_VENDOR_SEEQ=y
+# CONFIG_SEEQ8005 is not set
+CONFIG_NET_VENDOR_SMSC=y
+CONFIG_SMC91X=y
+CONFIG_SMC911X=y
+CONFIG_SMSC911X=y
+# CONFIG_SMSC911X_ARCH_HOOKS is not set
+CONFIG_NET_VENDOR_STMICRO=y
+# CONFIG_STMMAC_ETH is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_AMD_PHY is not set
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+# CONFIG_LXT_PHY is not set
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+# CONFIG_SMSC_PHY is not set
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_MICREL_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+# CONFIG_MICREL_KS8995MA is not set
+# CONFIG_PPP is not set
+CONFIG_SLIP=y
+CONFIG_SLHC=y
+CONFIG_SLIP_COMPRESSED=y
+# CONFIG_SLIP_SMART is not set
+CONFIG_SLIP_MODE_SLIP6=y
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_USB_HSO is not set
+# CONFIG_USB_IPHETH is not set
+CONFIG_WLAN=y
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_USB_NET_RNDIS_WLAN is not set
+# CONFIG_LIBRA_SDIOIF is not set
+# CONFIG_ATH6K_LEGACY_EXT is not set
+CONFIG_WCNSS_CORE=y
+# CONFIG_ATH_COMMON is not set
+# CONFIG_BCMDHD is not set
+# CONFIG_BRCMFMAC is not set
+# CONFIG_HOSTAP is not set
+# CONFIG_IWM is not set
+# CONFIG_LIBERTAS is not set
+# CONFIG_MWIFIEX is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+CONFIG_INPUT_POLLDEV=y
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+CONFIG_INPUT_KEYRESET=y
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+# CONFIG_KEYBOARD_ADP5589 is not set
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_QT1070 is not set
+# CONFIG_KEYBOARD_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_GPIO is not set
+# CONFIG_KEYBOARD_TCA6416 is not set
+# CONFIG_KEYBOARD_TCA8418 is not set
+# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_LM8323 is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_MCS is not set
+# CONFIG_KEYBOARD_MPR121 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+CONFIG_KEYBOARD_PMIC8XXX=y
+# CONFIG_KEYBOARD_SAMSUNG is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_OMAP4 is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_QCIKBD is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_SENTELIC is not set
+# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_APPLETOUCH is not set
+# CONFIG_MOUSE_BCM5974 is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_GPIO is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
+# CONFIG_MOUSE_QCITP is not set
+# CONFIG_MOUSE_SYNAPTICS_USB is not set
+CONFIG_INPUT_JOYSTICK=y
+# CONFIG_JOYSTICK_ANALOG is not set
+# CONFIG_JOYSTICK_A3D is not set
+# CONFIG_JOYSTICK_ADI is not set
+# CONFIG_JOYSTICK_COBRA is not set
+# CONFIG_JOYSTICK_GF2K is not set
+# CONFIG_JOYSTICK_GRIP is not set
+# CONFIG_JOYSTICK_GRIP_MP is not set
+# CONFIG_JOYSTICK_GUILLEMOT is not set
+# CONFIG_JOYSTICK_INTERACT is not set
+# CONFIG_JOYSTICK_SIDEWINDER is not set
+# CONFIG_JOYSTICK_TMDC is not set
+# CONFIG_JOYSTICK_IFORCE is not set
+# CONFIG_JOYSTICK_WARRIOR is not set
+# CONFIG_JOYSTICK_MAGELLAN is not set
+# CONFIG_JOYSTICK_SPACEORB is not set
+# CONFIG_JOYSTICK_SPACEBALL is not set
+# CONFIG_JOYSTICK_STINGER is not set
+# CONFIG_JOYSTICK_TWIDJOY is not set
+# CONFIG_JOYSTICK_ZHENHUA is not set
+# CONFIG_JOYSTICK_AS5011 is not set
+# CONFIG_JOYSTICK_JOYDUMP is not set
+# CONFIG_JOYSTICK_XPAD is not set
+# CONFIG_TOUCHDISC_VTD518_SHINETSU is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_ADS7846 is not set
+# CONFIG_TOUCHSCREEN_AD7877 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_MAXTOUCH is not set
+# CONFIG_TOUCHSCREEN_AD7879 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set
+# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_BU21013 is not set
+# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set
+# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set
+# CONFIG_TOUCHSCREEN_DYNAPRO is not set
+# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set
+# CONFIG_TOUCHSCREEN_EETI is not set
+# CONFIG_TOUCHSCREEN_EGALAX is not set
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+# CONFIG_TOUCHSCREEN_ILI210X is not set
+# CONFIG_TOUCHSCREEN_GUNZE is not set
+# CONFIG_TOUCHSCREEN_ELO is not set
+# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
+# CONFIG_TOUCHSCREEN_MAX11801 is not set
+# CONFIG_TOUCHSCREEN_MCS5000 is not set
+# CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_INEXIO is not set
+# CONFIG_TOUCHSCREEN_MK712 is not set
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
+# CONFIG_TOUCHSCREEN_TSC_SERIO is not set
+# CONFIG_TOUCHSCREEN_TSC2005 is not set
+# CONFIG_TOUCHSCREEN_TSC2007 is not set
+# CONFIG_TOUCHSCREEN_MSM_LEGACY is not set
+# CONFIG_TOUCHSCREEN_W90X900 is not set
+# CONFIG_TOUCHSCREEN_ST1232 is not set
+# CONFIG_TOUCHSCREEN_TPS6507X is not set
+# CONFIG_TOUCHSCREEN_CY8C_TS is not set
+# CONFIG_TOUCHSCREEN_CYTTSP_I2C_QC is not set
+# CONFIG_TOUCHSCREEN_FT5X06 is not set
+# CONFIG_TOUCHSCREEN_LGE_COMMON is not set
+# CONFIG_TOUCHSCREEN_LGE_SYNAPTICS is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_224E is not set
+# CONFIG_TOUCHSCREEN_CYPRESS_CS is not set
+CONFIG_TOUCHSCREEN_SYNAPTICS_3K=y
+CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_AD714X is not set
+# CONFIG_INPUT_BMA150 is not set
+# CONFIG_INPUT_PM8XXX_VIBRATOR is not set
+CONFIG_INPUT_PMIC8XXX_PWRKEY=y
+# CONFIG_INPUT_MMA8450 is not set
+# CONFIG_INPUT_MPU3050 is not set
+# CONFIG_INPUT_GP2A is not set
+# CONFIG_INPUT_GPIO_TILT_POLLED is not set
+# CONFIG_INPUT_ATI_REMOTE2 is not set
+CONFIG_INPUT_KEYCHORD=y
+# CONFIG_INPUT_KEYSPAN_REMOTE is not set
+# CONFIG_INPUT_KXTJ9 is not set
+# CONFIG_INPUT_POWERMATE is not set
+# CONFIG_INPUT_YEALINK is not set
+# CONFIG_INPUT_CM109 is not set
+CONFIG_INPUT_UINPUT=y
+CONFIG_INPUT_GPIO=y
+# CONFIG_INPUT_ISA1200_FF_MEMLESS is not set
+# CONFIG_INPUT_PCF8574 is not set
+# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
+# CONFIG_INPUT_ADXL34X is not set
+# CONFIG_INPUT_CMA3000 is not set
+# CONFIG_BOSCH_BMA150 is not set
+# CONFIG_STM_LIS3DH is not set
+# CONFIG_BMP18X is not set
+# CONFIG_SENSORS_AKM8975 is not set
+CONFIG_SENSORS_AKM8975_PANA_GYRO=y
+CONFIG_SENSORS_PANASONIC_GYRO=y
+CONFIG_SENSORS_BMA250=y
+CONFIG_INPUT_CAPELLA_CM3629=y
+CONFIG_SENSORS_R3GD20=y
+CONFIG_MPU_SENSORS_MPU3050=y
+# CONFIG_MPU_SENSORS_ACCELEROMETER_NONE is not set
+# CONFIG_MPU_SENSORS_ADXL346 is not set
+# CONFIG_MPU_SENSORS_BMA150 is not set
+CONFIG_MPU_SENSORS_BMA250=y
+# CONFIG_MPU_SENSORS_BMA222 is not set
+# CONFIG_MPU_SENSORS_KXSD9 is not set
+# CONFIG_MPU_SENSORS_KXTF9 is not set
+# CONFIG_MPU_SENSORS_LIS331DLH is not set
+# CONFIG_MPU_SENSORS_LIS3DH is not set
+# CONFIG_MPU_SENSORS_LSM303DLHA is not set
+# CONFIG_MPU_SENSORS_MMA8450 is not set
+# CONFIG_MPU_SENSORS_MMA845X is not set
+# CONFIG_MPU_SENSORS_COMPASS_NONE is not set
+CONFIG_MPU_SENSORS_AK8975=y
+# CONFIG_MPU_SENSORS_AK8963 is not set
+# CONFIG_MPU_SENSORS_MMC314X is not set
+# CONFIG_MPU_SENSORS_AMI30X is not set
+# CONFIG_MPU_SENSORS_HMC5883 is not set
+# CONFIG_MPU_SENSORS_LSM303DLHM is not set
+# CONFIG_MPU_SENSORS_YAS529 is not set
+# CONFIG_MPU_SENSORS_HSCDTD002B is not set
+# CONFIG_MPU_SENSORS_HSCDTD004A is not set
+CONFIG_MPU_SENSORS_TIMERIRQ=y
+# CONFIG_MPU_SENSORS_DEBUG is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_SERPORT=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_SERIO_PS2MULT is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+# CONFIG_VT is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_N_GSM is not set
+# CONFIG_N_SMUX is not set
+# CONFIG_TRACE_SINK is not set
+CONFIG_DEVMEM=y
+CONFIG_DEVKMEM=y
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_MAX3100 is not set
+# CONFIG_SERIAL_MAX3107 is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_SERIAL_MSM=y
+# CONFIG_SERIAL_MSM_CONSOLE is not set
+CONFIG_SERIAL_MSM_HS=y
+# CONFIG_SERIAL_MSM_CLOCK_CONTROL is not set
+CONFIG_SERIAL_MSM_HSL=y
+CONFIG_SERIAL_MSM_HSL_CONSOLE=y
+# CONFIG_SERIAL_BCM_BT_LPM is not set
+# CONFIG_SERIAL_TIMBERDALE is not set
+# CONFIG_SERIAL_ALTERA_JTAGUART is not set
+# CONFIG_SERIAL_ALTERA_UART is not set
+# CONFIG_SERIAL_IFX6X60 is not set
+# CONFIG_SERIAL_MSM_SMD is not set
+# CONFIG_SERIAL_XILINX_PS_UART is not set
+
+#
+# Diag Support
+#
+CONFIG_DIAG_CHAR=y
+
+#
+# DIAG traffic over USB
+#
+CONFIG_DIAG_OVER_USB=y
+
+#
+# SDIO support for DIAG
+#
+
+#
+# HSIC/SMUX support for DIAG
+#
+# CONFIG_TTY_PRINTK is not set
+# CONFIG_HVC_DCC is not set
+# CONFIG_IPMI_HANDLER is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_HW_RANDOM_TIMERIOMEM is not set
+CONFIG_HW_RANDOM_MSM=y
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+# CONFIG_DCC_TTY is not set
+# CONFIG_RAMOOPS is not set
+CONFIG_MSM_ROTATOR=y
+CONFIG_MSM_ADSPRPC=y
+# CONFIG_MMC_GENERIC_CSDIO is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_MUX is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_MSM is not set
+CONFIG_I2C_QUP=y
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_PXA_PCI is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_XILINX is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_DIOLAN_U2C is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_ALTERA is not set
+# CONFIG_SPI_BITBANG is not set
+# CONFIG_SPI_GPIO is not set
+# CONFIG_SPI_OC_TINY is not set
+# CONFIG_SPI_PXA2XX_PCI is not set
+# CONFIG_SPI_XILINX is not set
+CONFIG_SPI_QUP=y
+# CONFIG_SPI_DESIGNWARE is not set
+
+#
+# SPI Protocol Masters
+#
+CONFIG_SPI_SPIDEV=y
+# CONFIG_SPI_TLE62X0 is not set
+# CONFIG_SPMI is not set
+CONFIG_SLIMBUS=y
+CONFIG_SLIMBUS_MSM_CTRL=y
+# CONFIG_HSI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+
+#
+# PPS generators support
+#
+
+#
+# PTP clock support
+#
+
+#
+# Enable Device Drivers -> PPS to see the PTP clock options.
+#
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_GPIOLIB=y
+CONFIG_DEBUG_GPIO=y
+CONFIG_GPIO_SYSFS=y
+
+#
+# Memory mapped GPIO drivers:
+#
+# CONFIG_GPIO_GENERIC_PLATFORM is not set
+# CONFIG_GPIO_MSM_V1 is not set
+CONFIG_GPIO_MSM_V2=y
+# CONFIG_GPIO_MSM_V3 is not set
+# CONFIG_GPIO_FSM9XXX is not set
+
+#
+# I2C GPIO expanders:
+#
+# CONFIG_GPIO_MAX7300 is not set
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCF857X is not set
+CONFIG_GPIO_SX150X=y
+# CONFIG_GPIO_ADP5588 is not set
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+# CONFIG_GPIO_MAX7301 is not set
+# CONFIG_GPIO_MCP23S08 is not set
+# CONFIG_GPIO_MC33880 is not set
+# CONFIG_GPIO_74X164 is not set
+
+#
+# AC97 GPIO expanders:
+#
+
+#
+# MODULbus GPIO expanders:
+#
+CONFIG_GPIO_PM8XXX=y
+CONFIG_GPIO_PM8XXX_MPP=y
+# CONFIG_GPIO_PM8XXX_RPC is not set
+# CONFIG_W1 is not set
+CONFIG_POWER_SUPPLY=y
+# CONFIG_POWER_SUPPLY_DEBUG is not set
+# CONFIG_PDA_POWER is not set
+# CONFIG_TEST_POWER is not set
+# CONFIG_BATTERY_DS2780 is not set
+# CONFIG_BATTERY_DS2781 is not set
+# CONFIG_BATTERY_DS2782 is not set
+# CONFIG_BATTERY_SBS is not set
+# CONFIG_BATTERY_BQ27x00 is not set
+# CONFIG_BATTERY_MAX17040 is not set
+# CONFIG_BATTERY_MAX17042 is not set
+# CONFIG_CHARGER_ISP1704 is not set
+# CONFIG_CHARGER_MAX8903 is not set
+# CONFIG_CHARGER_LP8727 is not set
+# CONFIG_CHARGER_GPIO is not set
+# CONFIG_CHARGER_MANAGER is not set
+# CONFIG_BATTERY_MSM is not set
+# CONFIG_BATTERY_MSM8X60 is not set
+# CONFIG_ISL9519_CHARGER is not set
+# CONFIG_SMB137B_CHARGER is not set
+# CONFIG_SMB349_CHARGER is not set
+# CONFIG_BATTERY_BQ27520 is not set
+# CONFIG_BATTERY_BQ27541 is not set
+CONFIG_PM8921_CHARGER=y
+CONFIG_PM8XXX_CCADC=y
+# CONFIG_LTC4088_CHARGER is not set
+CONFIG_PM8921_BMS=y
+# CONFIG_BATTERY_BCL is not set
+# CONFIG_CHARGER_SMB347 is not set
+CONFIG_HWMON=y
+# CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
+# CONFIG_SENSORS_AD7314 is not set
+# CONFIG_SENSORS_AD7414 is not set
+# CONFIG_SENSORS_AD7418 is not set
+# CONFIG_SENSORS_ADCXX is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ADT7411 is not set
+# CONFIG_SENSORS_ADT7462 is not set
+# CONFIG_SENSORS_ADT7470 is not set
+# CONFIG_SENSORS_ADT7475 is not set
+# CONFIG_SENSORS_ASC7621 is not set
+# CONFIG_SENSORS_ATXP1 is not set
+# CONFIG_SENSORS_DS620 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_F75375S is not set
+# CONFIG_SENSORS_G760A is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_GL520SM is not set
+# CONFIG_SENSORS_GPIO_FAN is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_JC42 is not set
+# CONFIG_SENSORS_LINEAGE is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_LM73 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_LM92 is not set
+# CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_LTC4151 is not set
+# CONFIG_SENSORS_LTC4215 is not set
+# CONFIG_SENSORS_LTC4245 is not set
+# CONFIG_SENSORS_LTC4261 is not set
+# CONFIG_SENSORS_LM95241 is not set
+# CONFIG_SENSORS_LM95245 is not set
+# CONFIG_SENSORS_MAX1111 is not set
+# CONFIG_SENSORS_MAX16065 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX1668 is not set
+# CONFIG_SENSORS_MAX6639 is not set
+# CONFIG_SENSORS_MAX6642 is not set
+# CONFIG_SENSORS_MAX6650 is not set
+# CONFIG_SENSORS_MCP3021 is not set
+# CONFIG_SENSORS_NTC_THERMISTOR is not set
+CONFIG_SENSORS_PM8XXX_ADC=y
+# CONFIG_SENSORS_EPM_ADC is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_PMBUS is not set
+# CONFIG_SENSORS_SHT15 is not set
+# CONFIG_SENSORS_SHT21 is not set
+# CONFIG_SENSORS_SMM665 is not set
+# CONFIG_SENSORS_DME1737 is not set
+# CONFIG_SENSORS_EMC1403 is not set
+# CONFIG_SENSORS_EMC2103 is not set
+# CONFIG_SENSORS_EMC6W201 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47M192 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_SCH56XX_COMMON is not set
+# CONFIG_SENSORS_SCH5627 is not set
+# CONFIG_SENSORS_SCH5636 is not set
+# CONFIG_SENSORS_ADS1015 is not set
+# CONFIG_SENSORS_ADS7828 is not set
+# CONFIG_SENSORS_ADS7871 is not set
+# CONFIG_SENSORS_AMC6821 is not set
+# CONFIG_SENSORS_THMC50 is not set
+# CONFIG_SENSORS_TMP102 is not set
+# CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
+# CONFIG_SENSORS_VT1211 is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83791D is not set
+# CONFIG_SENSORS_W83792D is not set
+# CONFIG_SENSORS_W83793 is not set
+# CONFIG_SENSORS_W83795 is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83L786NG is not set
+# CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+CONFIG_THERMAL=y
+CONFIG_THERMAL_HWMON=y
+# CONFIG_THERMAL_MSM_POPMEM is not set
+# CONFIG_THERMAL_TSENS is not set
+CONFIG_THERMAL_TSENS8960=y
+# CONFIG_THERMAL_TSENS8974 is not set
+CONFIG_THERMAL_PM8XXX=y
+CONFIG_THERMAL_MONITOR=y
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+CONFIG_BCMA_POSSIBLE=y
+
+#
+# Broadcom specific AMBA
+#
+# CONFIG_BCMA is not set
+
+#
+# Multifunction device drivers
+#
+CONFIG_MFD_CORE=y
+# CONFIG_MFD_88PM860X is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_MFD_ASIC3 is not set
+# CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_HTC_I2CPLD is not set
+# CONFIG_TPS6105X is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_PMIC8058 is not set
+# CONFIG_PMIC8901 is not set
+# CONFIG_TPS6507X is not set
+# CONFIG_MFD_TPS65217 is not set
+# CONFIG_MFD_TPS6586X is not set
+# CONFIG_MFD_TPS65910 is not set
+# CONFIG_MFD_TPS65912_I2C is not set
+# CONFIG_MFD_TPS65912_SPI is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_TWL6040_CORE is not set
+# CONFIG_MFD_STMPE is not set
+# CONFIG_MFD_TC3589X is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_T7L66XB is not set
+# CONFIG_MFD_TC6387XB is not set
+# CONFIG_MFD_TC6393XB is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_DA9052_SPI is not set
+# CONFIG_MFD_DA9052_I2C is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_MAX8925 is not set
+# CONFIG_MFD_MAX8997 is not set
+# CONFIG_MFD_MAX8998 is not set
+# CONFIG_MFD_S5M_CORE is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X_I2C is not set
+# CONFIG_MFD_WM831X_SPI is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_WM8994 is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_MFD_MC13XXX is not set
+# CONFIG_ABX500_CORE is not set
+# CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_WL1273_CORE is not set
+CONFIG_MFD_PM8XXX=y
+CONFIG_MFD_PM8921_CORE=y
+# CONFIG_MFD_PM8821_CORE is not set
+# CONFIG_MFD_PM8018_CORE is not set
+# CONFIG_MFD_PM8038_CORE is not set
+CONFIG_MFD_PM8XXX_IRQ=y
+# CONFIG_MFD_PM8821_IRQ is not set
+# CONFIG_MFD_TPS65090 is not set
+# CONFIG_MFD_AAT2870_CORE is not set
+CONFIG_MFD_PM8XXX_DEBUG=y
+CONFIG_MFD_PM8XXX_PWM=y
+CONFIG_MFD_PM8XXX_MISC=y
+CONFIG_MFD_PM8XXX_SPK=y
+CONFIG_MFD_PM8XXX_BATT_ALARM=y
+# CONFIG_WCD9304_CODEC is not set
+CONFIG_WCD9310_CODEC=y
+# CONFIG_WCD9320_CODEC is not set
+# CONFIG_MFD_RC5T583 is not set
+CONFIG_REGULATOR=y
+# CONFIG_REGULATOR_DEBUG is not set
+# CONFIG_REGULATOR_DUMMY is not set
+# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
+# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
+# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
+CONFIG_REGULATOR_GPIO=y
+# CONFIG_REGULATOR_AD5398 is not set
+# CONFIG_REGULATOR_ISL6271A is not set
+# CONFIG_REGULATOR_MAX1586 is not set
+# CONFIG_REGULATOR_MAX8649 is not set
+# CONFIG_REGULATOR_MAX8660 is not set
+# CONFIG_REGULATOR_MAX8952 is not set
+# CONFIG_REGULATOR_LP3971 is not set
+# CONFIG_REGULATOR_LP3972 is not set
+# CONFIG_REGULATOR_TPS62360 is not set
+# CONFIG_REGULATOR_TPS65023 is not set
+# CONFIG_REGULATOR_TPS6507X is not set
+# CONFIG_REGULATOR_TPS6524X is not set
+CONFIG_REGULATOR_PM8XXX=y
+# CONFIG_REGULATOR_MSM_GPIO is not set
+# CONFIG_REGULATOR_STUB is not set
+CONFIG_MEDIA_SUPPORT=y
+
+#
+# Multimedia core support
+#
+# CONFIG_MEDIA_CONTROLLER is not set
+CONFIG_VIDEO_DEV=y
+CONFIG_VIDEO_V4L2_COMMON=y
+# CONFIG_DVB_CORE is not set
+CONFIG_VIDEO_MEDIA=y
+
+#
+# Multimedia drivers
+#
+CONFIG_RC_CORE=y
+CONFIG_LIRC=y
+# CONFIG_USER_RC_INPUT is not set
+CONFIG_RC_MAP=y
+CONFIG_IR_NEC_DECODER=y
+CONFIG_IR_RC5_DECODER=y
+CONFIG_IR_RC6_DECODER=y
+CONFIG_IR_JVC_DECODER=y
+CONFIG_IR_SONY_DECODER=y
+CONFIG_IR_RC5_SZ_DECODER=y
+CONFIG_IR_SANYO_DECODER=y
+CONFIG_IR_MCE_KBD_DECODER=y
+CONFIG_IR_LIRC_CODEC=y
+# CONFIG_RC_ATI_REMOTE is not set
+# CONFIG_IR_IMON is not set
+# CONFIG_IR_MCEUSB is not set
+# CONFIG_IR_REDRAT3 is not set
+# CONFIG_IR_STREAMZAP is not set
+# CONFIG_RC_LOOPBACK is not set
+# CONFIG_IR_GPIO_CIR is not set
+# CONFIG_MEDIA_ATTACH is not set
+CONFIG_MEDIA_TUNER=y
+# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
+CONFIG_MEDIA_TUNER_SIMPLE=y
+CONFIG_MEDIA_TUNER_TDA8290=y
+CONFIG_MEDIA_TUNER_TDA827X=y
+CONFIG_MEDIA_TUNER_TDA18271=y
+CONFIG_MEDIA_TUNER_TDA9887=y
+CONFIG_MEDIA_TUNER_TEA5761=y
+CONFIG_MEDIA_TUNER_TEA5767=y
+CONFIG_MEDIA_TUNER_MT20XX=y
+CONFIG_MEDIA_TUNER_XC2028=y
+CONFIG_MEDIA_TUNER_XC5000=y
+CONFIG_MEDIA_TUNER_XC4000=y
+CONFIG_MEDIA_TUNER_MC44S803=y
+CONFIG_VIDEO_V4L2=y
+CONFIG_VIDEOBUF2_CORE=y
+CONFIG_VIDEOBUF2_MEMOPS=y
+CONFIG_VIDEOBUF2_DMA_CONTIG=y
+CONFIG_VIDEOBUF2_VMALLOC=y
+CONFIG_VIDEOBUF2_DMA_SG=y
+CONFIG_VIDEOBUF2_MSM_MEM=y
+CONFIG_VIDEO_CAPTURE_DRIVERS=y
+# CONFIG_VIDEO_ADV_DEBUG is not set
+# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
+CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
+CONFIG_VIDEO_IR_I2C=y
+
+#
+# Audio decoders, processors and mixers
+#
+
+#
+# RDS decoders
+#
+
+#
+# Video decoders
+#
+
+#
+# Video and audio decoders
+#
+
+#
+# MPEG video encoders
+#
+
+#
+# Video encoders
+#
+
+#
+# Camera sensor devices
+#
+
+#
+# Flash devices
+#
+
+#
+# Video improvement chips
+#
+
+#
+# Miscelaneous helper chips
+#
+# CONFIG_MSM_VCAP is not set
+# CONFIG_V4L_USB_DRIVERS is not set
+CONFIG_V4L_PLATFORM_DRIVERS=y
+# CONFIG_SOC_CAMERA is not set
+
+#
+# Qualcomm MSM Camera And Video
+#
+CONFIG_MSM_CAMERA=y
+# CONFIG_MSM_CAMERA_DEBUG is not set
+CONFIG_MSM_CAMERA_V4L2=y
+
+#
+# Camera Sensor Selection
+#
+# CONFIG_IMX074 is not set
+CONFIG_S5K3H2YX=y
+CONFIG_S5K6A1GX=y
+# CONFIG_AR0260 is not set
+# CONFIG_OV2722 is not set
+# CONFIG_OV5647 is not set
+# CONFIG_MT9M114 is not set
+# CONFIG_IMX074_ACT is not set
+CONFIG_S5K3H2YX_ACT=y
+# CONFIG_S5K4E1 is not set
+CONFIG_MSM_CAMERA_FLASH_SC628A=y
+# CONFIG_IMX072 is not set
+# CONFIG_OV2720 is not set
+CONFIG_MSM_CAMERA_FLASH=y
+CONFIG_MSM_CAMERA_SENSOR=y
+CONFIG_MSM_ACTUATOR=y
+CONFIG_MSM_GEMINI=y
+CONFIG_RAWCHIP=y
+CONFIG_QUP_EXCLUSIVE_TO_CAMERA=y
+# CONFIG_S5K3L1YX is not set
+# CONFIG_IMX091 is not set
+# CONFIG_IMX175 is not set
+# CONFIG_IMX135 is not set
+# CONFIG_OV8838 is not set
+CONFIG_IMX175_ACT=y
+# CONFIG_AD5823_ACT is not set
+# CONFIG_AD5816_ACT is not set
+# CONFIG_TI201_ACT is not set
+# CONFIG_MT9V113 is not set
+CONFIG_IMX175_2LANE=y
+# CONFIG_OV5693_ACT is not set
+# CONFIG_OV5693 is not set
+# CONFIG_RAWCHIP_MCLK is not set
+# CONFIG_S5K6A2YA is not set
+# CONFIG_V4L_MEM2MEM_DRIVERS is not set
+# CONFIG_MSM_WFD is not set
+CONFIG_RADIO_ADAPTERS=y
+# CONFIG_RADIO_SI470X is not set
+# CONFIG_USB_MR800 is not set
+# CONFIG_USB_DSBR is not set
+# CONFIG_I2C_SI4713 is not set
+# CONFIG_RADIO_SI4713 is not set
+# CONFIG_USB_KEENE is not set
+# CONFIG_RADIO_TEA5764 is not set
+# CONFIG_RADIO_SAA7706H is not set
+# CONFIG_RADIO_TEF6862 is not set
+# CONFIG_RADIO_WL1273 is not set
+
+#
+# Texas Instruments WL128x FM driver (ST based)
+#
+# CONFIG_RADIO_WL128X is not set
+CONFIG_RADIO_IRIS=y
+CONFIG_RADIO_IRIS_TRANSPORT=m
+
+#
+# Graphics support
+#
+CONFIG_DRM=y
+CONFIG_DRM_USB=y
+CONFIG_DRM_KMS_HELPER=y
+# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
+
+#
+# I2C encoder or helper chips
+#
+# CONFIG_DRM_I2C_CH7006 is not set
+# CONFIG_DRM_I2C_SIL164 is not set
+CONFIG_DRM_UDL=y
+CONFIG_ION=y
+CONFIG_ION_MSM=y
+CONFIG_MSM_KGSL=y
+# CONFIG_MSM_KGSL_CFF_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_CP_STAT_NO_DETAIL is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_NO_IB_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_RB_HEX is not set
+CONFIG_MSM_KGSL_2D=y
+# CONFIG_MSM_KGSL_DRM is not set
+CONFIG_KGSL_PER_PROCESS_PAGE_TABLE=y
+CONFIG_MSM_KGSL_PAGE_TABLE_SIZE=0xFFF0000
+CONFIG_MSM_KGSL_PAGE_TABLE_COUNT=32
+CONFIG_MSM_KGSL_MMU_PAGE_FAULT=y
+# CONFIG_MSM_KGSL_DISABLE_SHADOW_WRITES is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+CONFIG_FB_SYS_FILLRECT=y
+CONFIG_FB_SYS_COPYAREA=y
+CONFIG_FB_SYS_IMAGEBLIT=y
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_WMT_GE_ROPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+# CONFIG_FB_TMIO is not set
+# CONFIG_FB_SMSCUFX is not set
+# CONFIG_FB_UDL is not set
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_BROADSHEET is not set
+CONFIG_MSM_VIDC=y
+CONFIG_MSM_VIDC_1080P=y
+CONFIG_MSM_VIDC_VENC=y
+CONFIG_MSM_VIDC_VDEC=y
+# CONFIG_MSM_VIDC_CONTENT_PROTECTION is not set
+CONFIG_FB_MSM=y
+# CONFIG_FB_MSM_BACKLIGHT is not set
+# CONFIG_FB_MSM_LOGO is not set
+CONFIG_FB_MSM_LCDC_HW=y
+CONFIG_FB_MSM_TRIPLE_BUFFER=y
+CONFIG_FB_MSM_MDP_HW=y
+# CONFIG_FB_MSM_MDP22 is not set
+# CONFIG_FB_MSM_MDP30 is not set
+# CONFIG_FB_MSM_MDP31 is not set
+CONFIG_FB_MSM_MDP40=y
+# CONFIG_FB_MSM_MDSS is not set
+# CONFIG_FB_MSM_MDP_NONE is not set
+# CONFIG_FB_MSM_EBI2 is not set
+# CONFIG_FB_MSM_MDDI is not set
+CONFIG_FB_MSM_MIPI_DSI=y
+# CONFIG_FB_MSM_LCDC is not set
+# CONFIG_FB_MSM_LVDS is not set
+CONFIG_FB_MSM_OVERLAY=y
+CONFIG_FB_MSM_DTV=y
+# CONFIG_FB_MSM_EXTMDDI is not set
+# CONFIG_FB_MSM_TVOUT is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_COMMON is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_COMMON_VGA is not set
+# CONFIG_FB_MSM_MDDI_ORISE is not set
+# CONFIG_FB_MSM_MDDI_QUICKVX is not set
+# CONFIG_FB_MSM_MDDI_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_PANEL is not set
+# CONFIG_FB_MSM_MIPI_DSI_TOSHIBA is not set
+# CONFIG_FB_MSM_MIPI_DSI_LGIT is not set
+# CONFIG_FB_MSM_MIPI_DSI_RENESAS is not set
+# CONFIG_FB_MSM_MIPI_DSI_SIMULATOR is not set
+# CONFIG_FB_MSM_MIPI_DSI_NOVATEK is not set
+# CONFIG_FB_MSM_MIPI_DSI_ORISE is not set
+# CONFIG_FB_MSM_LCDC_ST15_WXGA is not set
+# CONFIG_FB_MSM_LCDC_ST15_PANEL is not set
+# CONFIG_FB_MSM_LCDC_PRISM_WVGA is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_WSVGA is not set
+# CONFIG_FB_MSM_LCDC_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_LCDC_GORDON_VGA is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_WVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_FWVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_SHARP_WVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_AUO_WVGA is not set
+# CONFIG_FB_MSM_LCDC_TRULY_HVGA_IPS3P2335 is not set
+# CONFIG_FB_MSM_LCDC_TRULY_HVGA_IPS3P2335_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT is not set
+# CONFIG_FB_MSM_LCDC_NT35582_WVGA is not set
+# CONFIG_FB_MSM_LCDC_WXGA is not set
+# CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WXGA_PT is not set
+# CONFIG_FB_MSM_LVDS_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WSVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WUXGA is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_CMD_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_ORISE_VIDEO_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_ORISE_CMD_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_VIDEO_FWVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_CMD_FWVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35510_VIDEO_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35510_CMD_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35516_VIDEO_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35516_CMD_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35590_CMD_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35590_VIDEO_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WUXGA is not set
+# CONFIG_FB_MSM_MIPI_SIMULATOR_VIDEO is not set
+CONFIG_FB_MSM_NO_MDP_PIPE_CTRL=y
+CONFIG_FB_MSM_OVERLAY0_WRITEBACK=y
+CONFIG_FB_MSM_OVERLAY1_WRITEBACK=y
+CONFIG_FB_MSM_WRITEBACK_MSM_PANEL=y
+# CONFIG_FB_MSM_LCDC_PRISM_WVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_WSVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_GORDON_VGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SHARP_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_AUO_WVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_NT35582_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT_PANEL is not set
+# CONFIG_FB_MSM_LVDS_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_LVDS_FRC_FHD_PANEL is not set
+# CONFIG_FB_MSM_TRY_MDDI_CATCH_LCDC_PRISM is not set
+# CONFIG_FB_MSM_MIPI_PANEL_DETECT is not set
+# CONFIG_FB_MSM_MDDI_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LVDS_MIPI_PANEL_DETECT is not set
+# CONFIG_FB_MSM_MDDI_PRISM_WVGA is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_WVGA_PORTRAIT is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_VGA is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_WVGA is not set
+# CONFIG_FB_MSM_MDDI_SHARP_QVGA_128x128 is not set
+# CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WXGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WSVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WUXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_CMD_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_ORISE_VIDEO_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_ORISE_CMD_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_VIDEO_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_CMD_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WUXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TRULY_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35510_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35510_CMD_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35516_VIDEO_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35516_CMD_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35590_CMD_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35590_VIDEO_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_SIMULATOR_VIDEO_PANEL is not set
+# CONFIG_FB_MSM_EBI2_TMD_QVGA_EPSON_QCIF is not set
+# CONFIG_FB_MSM_HDMI_AS_PRIMARY is not set
+CONFIG_FB_MSM_PANEL_NONE=y
+CONFIG_FB_MSM_EXT_INTERFACE_COMMON=y
+CONFIG_FB_MSM_HDMI_COMMON=y
+CONFIG_FB_MSM_HDMI_3D=y
+# CONFIG_FB_MSM_HDMI_ADV7520_PANEL is not set
+CONFIG_FB_MSM_HDMI_MSM_PANEL=y
+# CONFIG_FB_MSM_HDMI_MSM_PANEL_DVI_SUPPORT is not set
+# CONFIG_FB_MSM_HDMI_MSM_PANEL_CEC_SUPPORT is not set
+# CONFIG_FB_MSM_HDMI_MHL_9244 is not set
+# CONFIG_FB_MSM_HDMI_MHL_8334 is not set
+# CONFIG_FB_MSM_TVOUT_NTSC_M is not set
+# CONFIG_FB_MSM_TVOUT_NTSC_J is not set
+# CONFIG_FB_MSM_TVOUT_PAL_BDGHIN is not set
+# CONFIG_FB_MSM_TVOUT_PAL_M is not set
+# CONFIG_FB_MSM_TVOUT_PAL_N is not set
+CONFIG_FB_MSM_TVOUT_NONE=y
+# CONFIG_FB_MSM_DEFAULT_DEPTH_RGB565 is not set
+# CONFIG_FB_MSM_DEFAULT_DEPTH_ARGB8888 is not set
+CONFIG_FB_MSM_DEFAULT_DEPTH_RGBA8888=y
+# CONFIG_FB_MSM_EBI2_EPSON_S1D_QVGA_PANEL is not set
+# CONFIG_FB_MSM_EBI2_PANEL_DETECT is not set
+# CONFIG_EXYNOS_VIDEO is not set
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_LCD_CLASS_DEVICE=y
+# CONFIG_LCD_L4F00242T03 is not set
+# CONFIG_LCD_LMS283GF05 is not set
+# CONFIG_LCD_LTV350QV is not set
+# CONFIG_LCD_TDO24M is not set
+# CONFIG_LCD_VGG2432A4 is not set
+# CONFIG_LCD_PLATFORM is not set
+# CONFIG_LCD_S6E63M0 is not set
+# CONFIG_LCD_LD9040 is not set
+# CONFIG_LCD_AMS369FG06 is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_GENERIC=y
+# CONFIG_BACKLIGHT_ADP8860 is not set
+# CONFIG_BACKLIGHT_ADP8870 is not set
+# CONFIG_BACKLIGHT_LP855X is not set
+# CONFIG_BACKLIGHT_LM3530 is not set
+# CONFIG_BACKLIGHT_LM3533 is not set
+# CONFIG_LOGO is not set
+CONFIG_SOUND=y
+# CONFIG_SOUND_OSS_CORE is not set
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_HWDEP=y
+CONFIG_SND_RAWMIDI=y
+CONFIG_SND_JACK=y
+# CONFIG_SND_SEQUENCER is not set
+# CONFIG_SND_MIXER_OSS is not set
+# CONFIG_SND_PCM_OSS is not set
+# CONFIG_SND_HRTIMER is not set
+CONFIG_SND_DYNAMIC_MINORS=y
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_DRIVERS=y
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_ALOOP is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+# CONFIG_SND_ARM is not set
+# CONFIG_SND_SPI is not set
+CONFIG_SND_USB=y
+CONFIG_SND_USB_AUDIO=y
+# CONFIG_SND_USB_UA101 is not set
+# CONFIG_SND_USB_CAIAQ is not set
+# CONFIG_SND_USB_6FIRE is not set
+CONFIG_SND_SOC=y
+
+#
+# MSM SoC Audio support
+#
+CONFIG_SND_SOC_MSM_HOSTLESS_PCM=y
+CONFIG_SND_SOC_MSM_QDSP6_HDMI_AUDIO=y
+CONFIG_SND_SOC_MSM_QDSP6_INTF=y
+# CONFIG_SND_SOC_MSM_QDSP6V2_INTF is not set
+CONFIG_SND_SOC_VOICE=y
+CONFIG_SND_SOC_QDSP6=y
+# CONFIG_SND_SOC_QDSP6V2 is not set
+CONFIG_SND_SOC_MSM8960=y
+# CONFIG_SND_SOC_DUAL_AMIC is not set
+CONFIG_SND_SOC_I2C_AND_SPI=y
+# CONFIG_SND_SOC_ALL_CODECS is not set
+CONFIG_SND_SOC_WCD9304=y
+CONFIG_SND_SOC_WCD9310=y
+CONFIG_SND_SOC_CS8427=y
+CONFIG_SND_SOC_MSM_STUB=y
+# CONFIG_SND_SOC_TPA2028D is not set
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_BATTERY_STRENGTH is not set
+# CONFIG_HIDRAW is not set
+# CONFIG_UHID is not set
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+# CONFIG_USB_HIDDEV is not set
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_ACRUX is not set
+CONFIG_HID_APPLE=y
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_PRODIKEYS is not set
+# CONFIG_HID_CYPRESS is not set
+CONFIG_HID_DRAGONRISE=y
+# CONFIG_DRAGONRISE_FF is not set
+# CONFIG_HID_EMS_FF is not set
+# CONFIG_HID_ELECOM is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_HOLTEK is not set
+# CONFIG_HID_KEYTOUCH is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_UCLOGIC is not set
+# CONFIG_HID_WALTOP is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LCPOWER is not set
+CONFIG_HID_LOGITECH=y
+CONFIG_HID_LOGITECH_DJ=y
+# CONFIG_LOGITECH_FF is not set
+# CONFIG_LOGIRUMBLEPAD2_FF is not set
+# CONFIG_LOGIG940_FF is not set
+# CONFIG_LOGIWHEELS_FF is not set
+CONFIG_HID_MAGICMOUSE=y
+CONFIG_HID_MICROSOFT=y
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_MULTITOUCH is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_ORTEK is not set
+CONFIG_HID_PANTHERLORD=y
+# CONFIG_PANTHERLORD_FF is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_PICOLCD is not set
+# CONFIG_HID_PRIMAX is not set
+# CONFIG_HID_ROCCAT is not set
+# CONFIG_HID_SAITEK is not set
+# CONFIG_HID_SAMSUNG is not set
+CONFIG_HID_SONY=y
+# CONFIG_HID_SPEEDLINK is not set
+# CONFIG_HID_SUNPLUS is not set
+CONFIG_HID_GREENASIA=y
+# CONFIG_GREENASIA_FF is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TIVO is not set
+# CONFIG_HID_TOPSEED is not set
+CONFIG_HID_THRUSTMASTER=y
+# CONFIG_THRUSTMASTER_FF is not set
+# CONFIG_HID_WACOM is not set
+# CONFIG_HID_WIIMOTE is not set
+CONFIG_HID_ZEROPLUS=y
+# CONFIG_ZEROPLUS_FF is not set
+# CONFIG_HID_ZYDACRON is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+CONFIG_USB_ARCH_HAS_EHCI=y
+# CONFIG_USB_ARCH_HAS_XHCI is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_COMMON=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+CONFIG_USB_SUSPEND=y
+CONFIG_USB_OTG=y
+CONFIG_USB_OTG_WHITELIST=y
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_DWC3 is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_EHSET=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+# CONFIG_USB_EHCI_TT_NEWSCHED is not set
+CONFIG_USB_EHCI_MSM=y
+# CONFIG_USB_EHCI_MSM_HSIC is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+# CONFIG_USB_EHCI_HCD_PLATFORM is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_PEHCI_HCD is not set
+# CONFIG_USB_MUSB_HDRC is not set
+
+#
+# USB Device Class drivers
+#
+CONFIG_USB_ACM=y
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+
+#
+# also be needed; see USB_STORAGE Help for more info
+#
+CONFIG_USB_STORAGE=y
+CONFIG_USB_STORAGE_DEBUG=y
+# CONFIG_USB_STORAGE_REALTEK is not set
+CONFIG_USB_STORAGE_DATAFAB=y
+CONFIG_USB_STORAGE_FREECOM=y
+CONFIG_USB_STORAGE_ISD200=y
+CONFIG_USB_STORAGE_USBAT=y
+CONFIG_USB_STORAGE_SDDR09=y
+CONFIG_USB_STORAGE_SDDR55=y
+CONFIG_USB_STORAGE_JUMPSHOT=y
+CONFIG_USB_STORAGE_ALAUDA=y
+CONFIG_USB_STORAGE_ONETOUCH=y
+CONFIG_USB_STORAGE_KARMA=y
+CONFIG_USB_STORAGE_CYPRESS_ATACB=y
+# CONFIG_USB_STORAGE_ENE_UB6250 is not set
+# CONFIG_USB_UAS is not set
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+CONFIG_USB_EHSET_TEST_FIXTURE=y
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_YUREX is not set
+# CONFIG_USB_QCOM_DIAG_BRIDGE is not set
+# CONFIG_USB_QCOM_MDM_BRIDGE is not set
+# CONFIG_USB_QCOM_KS_BRIDGE is not set
+CONFIG_USB_GADGET=y
+# CONFIG_USB_GADGET_DEBUG is not set
+CONFIG_USB_GADGET_DEBUG_FILES=y
+# CONFIG_USB_GADGET_DEBUG_FS is not set
+CONFIG_USB_GADGET_VBUS_DRAW=500
+CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
+
+#
+# USB Peripheral Controller
+#
+# CONFIG_USB_FUSB300 is not set
+# CONFIG_USB_R8A66597 is not set
+# CONFIG_USB_MV_UDC is not set
+# CONFIG_USB_M66592 is not set
+# CONFIG_USB_NET2272 is not set
+CONFIG_USB_CI13XXX_MSM=y
+# CONFIG_USB_CI13XXX_MSM_HSIC is not set
+# CONFIG_USB_DWC3_MSM is not set
+# CONFIG_USB_MSM_72K is not set
+# CONFIG_USB_DUMMY_HCD is not set
+CONFIG_USB_GADGET_DUALSPEED=y
+# CONFIG_USB_GADGET_SUPERSPEED is not set
+# CONFIG_USB_ZERO is not set
+# CONFIG_USB_AUDIO is not set
+# CONFIG_USB_ETH is not set
+# CONFIG_USB_G_NCM is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FUNCTIONFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_MASS_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+# CONFIG_USB_G_PRINTER is not set
+CONFIG_USB_G_ANDROID=y
+# CONFIG_USB_CDC_COMPOSITE is not set
+# CONFIG_USB_G_ACM_MS is not set
+# CONFIG_USB_G_MULTI is not set
+# CONFIG_USB_G_HID is not set
+# CONFIG_USB_G_DBGP is not set
+# CONFIG_USB_G_WEBCAM is not set
+CONFIG_USB_CSW_HACK=y
+# CONFIG_USB_MSC_PROFILING is not set
+# CONFIG_MODEM_SUPPORT is not set
+CONFIG_RMNET_SMD_CTL_CHANNEL=""
+CONFIG_RMNET_SMD_DATA_CHANNEL=""
+CONFIG_USB_ANDROID_RMNET_CTRL_SMD=y
+# CONFIG_USB_ANDROID_CDC_ECM is not set
+
+#
+# OTG and related infrastructure
+#
+CONFIG_USB_OTG_UTILS=y
+# CONFIG_USB_OTG_WAKELOCK is not set
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_USB_ULPI is not set
+# CONFIG_USB_MSM_OTG_72K is not set
+# CONFIG_NOP_USB_XCEIV is not set
+CONFIG_USB_MSM_OTG=y
+# CONFIG_USB_MSM_ACA is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+CONFIG_MMC_PERF_PROFILING=y
+CONFIG_MMC_UNSAFE_RESUME=y
+# CONFIG_MMC_CLKGATE is not set
+# CONFIG_MMC_EMBEDDED_SDIO is not set
+CONFIG_MMC_PARANOID_SD_INIT=y
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_MINORS=64
+CONFIG_MMC_BLOCK_BOUNCE=y
+# CONFIG_MMC_BLOCK_DEFERRED_RESUME is not set
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+# CONFIG_MMC_SDHCI is not set
+# CONFIG_MMC_SDHCI_PXAV3 is not set
+# CONFIG_MMC_SDHCI_PXAV2 is not set
+CONFIG_MMC_MSM=y
+CONFIG_MMC_MSM_SDC1_SUPPORT=y
+CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT=y
+# CONFIG_MMC_MSM_SDC2_SUPPORT is not set
+CONFIG_MMC_MSM_SDC3_SUPPORT=y
+# CONFIG_MMC_MSM_SDC3_POLLING is not set
+# CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC3_WP_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC4_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC5_SUPPORT is not set
+CONFIG_MMC_MSM_SPS_SUPPORT=y
+# CONFIG_MMC_DW is not set
+# CONFIG_MMC_VUB300 is not set
+# CONFIG_MMC_USHC is not set
+# CONFIG_MEMSTICK is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_LM3530 is not set
+# CONFIG_LEDS_PCA9532 is not set
+# CONFIG_LEDS_GPIO is not set
+# CONFIG_LEDS_MSM_PDM is not set
+# CONFIG_LEDS_PMIC_MPP is not set
+# CONFIG_LEDS_MSM_TRICOLOR is not set
+# CONFIG_LEDS_LP3944 is not set
+# CONFIG_LEDS_CPLD is not set
+# CONFIG_LEDS_LP5521 is not set
+# CONFIG_LEDS_LP5523 is not set
+# CONFIG_LEDS_PCA955X is not set
+CONFIG_LEDS_PM8XXX=y
+# CONFIG_LEDS_PCA9633 is not set
+# CONFIG_LEDS_DAC124S085 is not set
+# CONFIG_LEDS_REGULATOR is not set
+# CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_MSM_PMIC is not set
+# CONFIG_LEDS_LT3593 is not set
+# CONFIG_LEDS_RENESAS_TPU is not set
+# CONFIG_LEDS_TCA6507 is not set
+# CONFIG_LEDS_OT200 is not set
+# CONFIG_LEDS_TRIGGERS is not set
+
+#
+# LED Triggers
+#
+
+#
+# LED Flashlights
+#
+CONFIG_FLASHLIGHT_TPS61310=y
+CONFIG_SWITCH=y
+# CONFIG_SWITCH_GPIO is not set
+# CONFIG_SWITCH_FSA8008 is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+CONFIG_RTC_INTF_ALARM=y
+CONFIG_RTC_INTF_ALARM_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# I2C RTC drivers
+#
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_DS3232 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_ISL12022 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
+# CONFIG_RTC_DRV_EM3027 is not set
+# CONFIG_RTC_DRV_RV3029C2 is not set
+
+#
+# SPI RTC drivers
+#
+# CONFIG_RTC_DRV_M41T93 is not set
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
+# CONFIG_RTC_DRV_MAX6902 is not set
+# CONFIG_RTC_DRV_R9701 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_DS3234 is not set
+# CONFIG_RTC_DRV_PCF2123 is not set
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# on-CPU RTC drivers
+#
+# CONFIG_RTC_DRV_MSM is not set
+# CONFIG_RTC_DRV_MSM7X00A is not set
+CONFIG_RTC_DRV_PM8XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+
+#
+# Virtio drivers
+#
+# CONFIG_VIRTIO_BALLOON is not set
+# CONFIG_VIRTIO_MMIO is not set
+
+#
+# Microsoft Hyper-V guest support
+#
+CONFIG_STAGING=y
+# CONFIG_USBIP_CORE is not set
+# CONFIG_PRISM2_USB is not set
+# CONFIG_ECHO is not set
+# CONFIG_ASUS_OLED is not set
+# CONFIG_RTLLIB is not set
+# CONFIG_R8712U is not set
+# CONFIG_RTS5139 is not set
+# CONFIG_TRANZPORT is not set
+# CONFIG_LINE6_USB is not set
+# CONFIG_VT6656 is not set
+# CONFIG_IIO is not set
+CONFIG_QCACHE=y
+# CONFIG_FB_SM7XX is not set
+# CONFIG_USB_ENESTORAGE is not set
+# CONFIG_BCM_WIMAX is not set
+# CONFIG_FT1000 is not set
+
+#
+# Speakup console speech
+#
+# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4_STAGING is not set
+# CONFIG_STAGING_MEDIA is not set
+
+#
+# Android
+#
+CONFIG_ANDROID=y
+CONFIG_ANDROID_BINDER_IPC=y
+CONFIG_ANDROID_LOGGER=y
+CONFIG_ANDROID_PERSISTENT_RAM=y
+CONFIG_ANDROID_RAM_CONSOLE=y
+CONFIG_ANDROID_RAM_CONSOLE_ENABLE_VERBOSE=y
+# CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION is not set
+# CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT is not set
+# CONFIG_PERSISTENT_TRACER is not set
+CONFIG_ANDROID_TIMED_OUTPUT=y
+CONFIG_ANDROID_TIMED_GPIO=y
+CONFIG_ANDROID_LOW_MEMORY_KILLER=y
+CONFIG_ANDROID_LOW_MEMORY_KILLER_AUTODETECT_OOM_ADJ_VALUES=y
+# CONFIG_ANDROID_SWITCH is not set
+# CONFIG_ANDROID_INTF_ALARM_DEV is not set
+# CONFIG_PHONE is not set
+# CONFIG_USB_WPAN_HCD is not set
+
+#
+# Qualcomm Atheros Prima WLAN module
+#
+CONFIG_PRIMA_WLAN=m
+# CONFIG_PRIMA_WLAN_BTAMP is not set
+CONFIG_HTC_WIFI_NVS=y
+
+#
+# Qualcomm MSM specific device drivers
+#
+CONFIG_MSM_SSBI=y
+CONFIG_SPS=y
+# CONFIG_USB_BAM is not set
+CONFIG_SPS_SUPPORT_BAMDMA=y
+# CONFIG_SPS_SUPPORT_NDP_BAM is not set
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_HAVE_CLK_PREPARE=y
+
+#
+# Hardware Spinlock drivers
+#
+CONFIG_IOMMU_SUPPORT=y
+CONFIG_MSM_IOMMU=y
+CONFIG_MSM_IOMMU_GPU_SYNC=y
+CONFIG_IOMMU_PGTABLES_L2=y
+
+#
+# Remoteproc drivers (EXPERIMENTAL)
+#
+
+#
+# Rpmsg drivers (EXPERIMENTAL)
+#
+# CONFIG_VIRT_DRIVERS is not set
+# CONFIG_PM_DEVFREQ is not set
+# CONFIG_MOBICORE_SUPPORT is not set
+# CONFIG_CORESIGHT is not set
+
+#
+# File systems
+#
+# CONFIG_EXT2_FS is not set
+# CONFIG_EXT3_FS is not set
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_USE_FOR_EXT23=y
+CONFIG_EXT4_FS_XATTR=y
+# CONFIG_EXT4_FS_POSIX_ACL is not set
+# CONFIG_EXT4_FS_SECURITY is not set
+# CONFIG_EXT4_DEBUG is not set
+CONFIG_JBD2=y
+# CONFIG_JBD2_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FS_POSIX_ACL=y
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_FANOTIFY is not set
+# CONFIG_QUOTA is not set
+# CONFIG_QUOTACTL is not set
+# CONFIG_AUTOFS4_FS is not set
+CONFIG_FUSE_FS=y
+# CONFIG_CUSE is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+# CONFIG_MSDOS_FS is not set
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_ECRYPT_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_LOGFS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_QNX6FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_PSTORE is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+# CONFIG_NFS_V4_1 is not set
+# CONFIG_ROOT_NFS is not set
+# CONFIG_NFS_USE_LEGACY_DNS is not set
+CONFIG_NFS_USE_KERNEL_DNS=y
+# CONFIG_NFSD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_ACL_SUPPORT=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+CONFIG_SUNRPC_GSS=y
+# CONFIG_SUNRPC_DEBUG is not set
+# CONFIG_CEPH_FS is not set
+CONFIG_CIFS=y
+# CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_UPCALL is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_DFS_UPCALL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+CONFIG_NLS_ASCII=y
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_UTF8 is not set
+
+#
+# Kernel hacking
+#
+CONFIG_PRINTK_TIME=y
+CONFIG_DEFAULT_MESSAGE_LOGLEVEL=1
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_SECTION_MISMATCH=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_LOCKUP_DETECTOR is not set
+# CONFIG_HARDLOCKUP_DETECTOR is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+CONFIG_TIMER_STATS=y
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
+CONFIG_DEBUG_KMEMLEAK=y
+CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
+# CONFIG_DEBUG_KMEMLEAK_TEST is not set
+CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
+# CONFIG_DEBUG_PREEMPT is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_SPARSE_RCU_POINTER is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_ATOMIC_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+CONFIG_STACKTRACE=y
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_HIGHMEM is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_INFO_REDUCED is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+CONFIG_DEBUG_MEMORY_INIT=y
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_TEST_LIST_SORT is not set
+# CONFIG_DEBUG_SG is not set
+CONFIG_DEBUG_NOTIFIERS=y
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+CONFIG_RCU_CPU_STALL_TIMEOUT=60
+CONFIG_RCU_CPU_STALL_VERBOSE=y
+# CONFIG_RCU_CPU_STALL_INFO is not set
+# CONFIG_RCU_TRACE is not set
+# CONFIG_KPROBES_SANITY_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_DEBUG_PER_CPU_MAPS is not set
+# CONFIG_LKDTM is not set
+# CONFIG_CPU_NOTIFIER_ERROR_INJECT is not set
+CONFIG_FAULT_INJECTION=y
+CONFIG_FAILSLAB=y
+CONFIG_FAIL_PAGE_ALLOC=y
+# CONFIG_FAIL_MAKE_REQUEST is not set
+# CONFIG_FAIL_IO_TIMEOUT is not set
+# CONFIG_FAIL_MMC_REQUEST is not set
+CONFIG_FAULT_INJECTION_DEBUG_FS=y
+CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
+# CONFIG_DEBUG_PAGEALLOC is not set
+CONFIG_NOP_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_RING_BUFFER=y
+CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
+CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_RING_BUFFER_ALLOW_SWAP=y
+CONFIG_TRACING=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_PREEMPT_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+CONFIG_ENABLE_DEFAULT_TRACERS=y
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_KPROBE_EVENT=y
+# CONFIG_CPU_FREQ_SWITCH_PROFILER is not set
+# CONFIG_RING_BUFFER_BENCHMARK is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_ATOMIC64_SELFTEST is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_TEST_KSTRTOX is not set
+# CONFIG_STRICT_DEVMEM is not set
+CONFIG_ARM_UNWIND=y
+CONFIG_DEBUG_USER=y
+# CONFIG_DEBUG_RODATA is not set
+# CONFIG_DEBUG_LL is not set
+# CONFIG_ARM_KPROBES_TEST is not set
+# CONFIG_PID_IN_CONTEXTIDR is not set
+
+#
+# Security options
+#
+CONFIG_KEYS=y
+# CONFIG_ENCRYPTED_KEYS is not set
+# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
+# CONFIG_SECURITY_DMESG_RESTRICT is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP2=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+# CONFIG_CRYPTO_USER is not set
+CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_PCRYPT is not set
+CONFIG_CRYPTO_WORKQUEUE=y
+# CONFIG_CRYPTO_CRYPTD is not set
+CONFIG_CRYPTO_AUTHENC=y
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+CONFIG_CRYPTO_CBC=y
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=y
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+CONFIG_CRYPTO_HMAC=y
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_GHASH is not set
+CONFIG_CRYPTO_MD4=y
+CONFIG_CRYPTO_MD5=y
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+CONFIG_CRYPTO_SHA1=y
+CONFIG_CRYPTO_SHA256=y
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+CONFIG_CRYPTO_AES=y
+# CONFIG_CRYPTO_ANUBIS is not set
+CONFIG_CRYPTO_ARC4=y
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+CONFIG_CRYPTO_TWOFISH=y
+CONFIG_CRYPTO_TWOFISH_COMMON=y
+
+#
+# Compression
+#
+CONFIG_CRYPTO_DEFLATE=y
+# CONFIG_CRYPTO_ZLIB is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+CONFIG_CRYPTO_ANSI_CPRNG=y
+# CONFIG_CRYPTO_USER_API_HASH is not set
+# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
+CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_DEV_QCE40=y
+CONFIG_CRYPTO_DEV_QCRYPTO=m
+CONFIG_CRYPTO_DEV_QCE=m
+CONFIG_CRYPTO_DEV_QCEDEV=m
+# CONFIG_CRYPTO_DEV_OTA_CRYPTO is not set
+CONFIG_BINARY_PRINTF=y
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_IO=y
+CONFIG_CRC_CCITT=y
+CONFIG_CRC16=y
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC32_SELFTEST is not set
+CONFIG_CRC32_SLICEBY8=y
+# CONFIG_CRC32_SLICEBY4 is not set
+# CONFIG_CRC32_SARWATE is not set
+# CONFIG_CRC32_BIT is not set
+# CONFIG_CRC7 is not set
+CONFIG_LIBCRC32C=y
+# CONFIG_CRC8 is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+# CONFIG_XZ_DEC is not set
+# CONFIG_XZ_DEC_BCJ is not set
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_DECOMPRESS_BZIP2=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_REED_SOLOMON=y
+CONFIG_REED_SOLOMON_ENC8=y
+CONFIG_REED_SOLOMON_DEC8=y
+CONFIG_TEXTSEARCH=y
+CONFIG_TEXTSEARCH_KMP=y
+CONFIG_TEXTSEARCH_BM=y
+CONFIG_TEXTSEARCH_FSM=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_CPU_RMAP=y
+CONFIG_DQL=y
+CONFIG_NLATTR=y
+# CONFIG_AVERAGE is not set
+# CONFIG_CORDIC is not set
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index 1ebbf45..70d0bf4 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -32,7 +32,6 @@
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_AEABI=y
-CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
 CONFIG_AUTO_ZRELADDR=y
 CONFIG_FPE_NWFPE=y
 CONFIG_NET=y
diff --git a/arch/arm/configs/ville_defconfig b/arch/arm/configs/ville_defconfig
new file mode 100644
index 0000000..4e136a9
--- /dev/null
+++ b/arch/arm/configs/ville_defconfig
@@ -0,0 +1,3453 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux/arm 3.4.0 Kernel Configuration
+#
+CONFIG_ARM=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_GENERIC_GPIO=y
+# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_KTIME_SCALAR=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_ARM_TICKET_LOCKS=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_ARCH_HAS_CPUFREQ=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_VECTORS_BASE=0xffff0000
+# CONFIG_ARM_PATCH_PHYS_VIRT is not set
+CONFIG_NEED_MACH_IO_H=y
+CONFIG_NEED_MACH_MEMORY_H=y
+CONFIG_PHYS_OFFSET=0x80400000
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_HAVE_IRQ_WORK=y
+CONFIG_IRQ_WORK=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=""
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_XZ=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_KERNEL_GZIP=y
+# CONFIG_KERNEL_LZMA is not set
+# CONFIG_KERNEL_XZ is not set
+# CONFIG_KERNEL_LZO is not set
+CONFIG_DEFAULT_HOSTNAME="(none)"
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_FHANDLE is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+
+#
+# IRQ subsystem
+#
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_IRQ_DOMAIN=y
+# CONFIG_IRQ_DOMAIN_DEBUG is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_PREEMPT_RCU=y
+CONFIG_PREEMPT_RCU=y
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_RCU_FAST_NO_HZ is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_RCU_BOOST is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=17
+CONFIG_CGROUPS=y
+CONFIG_CGROUP_DEBUG=y
+CONFIG_CGROUP_FREEZER=y
+# CONFIG_CGROUP_DEVICE is not set
+# CONFIG_CPUSETS is not set
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_RESOURCE_COUNTERS=y
+# CONFIG_CGROUP_MEM_RES_CTLR is not set
+# CONFIG_CGROUP_PERF is not set
+CONFIG_CGROUP_SCHED=y
+CONFIG_FAIR_GROUP_SCHED=y
+# CONFIG_CFS_BANDWIDTH is not set
+CONFIG_RT_GROUP_SCHED=y
+# CONFIG_BLK_CGROUP is not set
+# CONFIG_CHECKPOINT_RESTORE is not set
+CONFIG_NAMESPACES=y
+# CONFIG_UTS_NS is not set
+# CONFIG_IPC_NS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+# CONFIG_NET_NS is not set
+# CONFIG_SCHED_AUTOGROUP is not set
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+CONFIG_RD_BZIP2=y
+CONFIG_RD_LZMA=y
+# CONFIG_RD_XZ is not set
+# CONFIG_RD_LZO is not set
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_PANIC_TIMEOUT=5
+CONFIG_EXPERT=y
+CONFIG_UID16=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_ASHMEM=y
+CONFIG_AIO=y
+CONFIG_EMBEDDED=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_PERF_EVENTS=y
+# CONFIG_PERF_COUNTERS is not set
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+CONFIG_PROFILING=y
+CONFIG_TRACEPOINTS=y
+CONFIG_OPROFILE=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_KPROBES=y
+# CONFIG_JUMP_LABEL is not set
+CONFIG_KRETPROBES=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_CONTIGUOUS=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_HW_BREAKPOINT=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_STOP_MACHINE=y
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_BSGLIB is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_KARMA_PARTITION is not set
+CONFIG_EFI_PARTITION=y
+# CONFIG_SYSV68_PARTITION is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_TEST is not set
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_ROW=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_ROW=y
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="row"
+# CONFIG_INLINE_SPIN_TRYLOCK is not set
+# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK is not set
+# CONFIG_INLINE_SPIN_LOCK_BH is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
+CONFIG_UNINLINE_SPIN_UNLOCK=y
+# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
+# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_READ_TRYLOCK is not set
+# CONFIG_INLINE_READ_LOCK is not set
+# CONFIG_INLINE_READ_LOCK_BH is not set
+# CONFIG_INLINE_READ_LOCK_IRQ is not set
+# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_READ_UNLOCK is not set
+# CONFIG_INLINE_READ_UNLOCK_BH is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
+# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
+# CONFIG_INLINE_WRITE_TRYLOCK is not set
+# CONFIG_INLINE_WRITE_LOCK is not set
+# CONFIG_INLINE_WRITE_LOCK_BH is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
+# CONFIG_INLINE_WRITE_UNLOCK is not set
+# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
+# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
+CONFIG_MUTEX_SPIN_ON_OWNER=y
+CONFIG_FREEZER=y
+
+#
+# System Type
+#
+CONFIG_MMU=y
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_VEXPRESS is not set
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_BCMRING is not set
+# CONFIG_ARCH_HIGHBANK is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CNS3XXX is not set
+# CONFIG_ARCH_GEMINI is not set
+# CONFIG_ARCH_PRIMA2 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_MXS is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_DOVE is not set
+# CONFIG_ARCH_KIRKWOOD is not set
+# CONFIG_ARCH_LPC32XX is not set
+# CONFIG_ARCH_MV78XX0 is not set
+# CONFIG_ARCH_ORION5X is not set
+# CONFIG_ARCH_MMP is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_W90X900 is not set
+# CONFIG_ARCH_TEGRA is not set
+# CONFIG_ARCH_PICOXCELL is not set
+# CONFIG_ARCH_PNX4008 is not set
+# CONFIG_ARCH_PXA is not set
+CONFIG_ARCH_MSM=y
+# CONFIG_ARCH_SHMOBILE is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C24XX is not set
+# CONFIG_ARCH_S3C64XX is not set
+# CONFIG_ARCH_S5P64X0 is not set
+# CONFIG_ARCH_S5PC100 is not set
+# CONFIG_ARCH_S5PV210 is not set
+# CONFIG_ARCH_EXYNOS is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_U300 is not set
+# CONFIG_ARCH_U8500 is not set
+# CONFIG_ARCH_NOMADIK is not set
+# CONFIG_ARCH_DAVINCI is not set
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_PLAT_SPEAR is not set
+# CONFIG_ARCH_VT8500 is not set
+# CONFIG_ARCH_ZYNQ is not set
+# CONFIG_GPIO_PCA953X is not set
+# CONFIG_KEYBOARD_GPIO_POLLED is not set
+
+#
+# MSM SoC Type
+#
+# CONFIG_ARCH_MSM7X01A is not set
+# CONFIG_ARCH_MSM7X25 is not set
+# CONFIG_ARCH_MSM7X27 is not set
+# CONFIG_ARCH_MSM7X30 is not set
+# CONFIG_ARCH_QSD8X50 is not set
+# CONFIG_ARCH_MSM8X60 is not set
+CONFIG_ARCH_MSM8960=y
+# CONFIG_ARCH_MSM8930 is not set
+# CONFIG_ARCH_APQ8064 is not set
+# CONFIG_ARCH_MSM8974 is not set
+# CONFIG_ARCH_MPQ8092 is not set
+# CONFIG_ARCH_MSM8226 is not set
+# CONFIG_ARCH_FSM9XXX is not set
+# CONFIG_ARCH_MSM9615 is not set
+# CONFIG_ARCH_MSM8625 is not set
+# CONFIG_ARCH_MSM9625 is not set
+CONFIG_MSM_SOC_REV_NONE=y
+# CONFIG_MSM_SOC_REV_A is not set
+CONFIG_MSM_KRAIT_TBB_ABORT_HANDLER=y
+CONFIG_ARCH_MSM_KRAIT=y
+CONFIG_MSM_SMP=y
+CONFIG_ARCH_MSM_KRAITMP=y
+CONFIG_MSM_KRAIT_WFE_FIXUP=y
+CONFIG_MSM_RPM=y
+# CONFIG_MSM_RPM_SMD is not set
+CONFIG_MSM_MPM=y
+CONFIG_MSM_XO=y
+CONFIG_MSM_REMOTE_SPINLOCK_SFPB=y
+
+#
+# MSM Board Selection
+#
+# CONFIG_MACH_MSM8960_CDP is not set
+# CONFIG_MACH_MSM8960_MTP is not set
+# CONFIG_MACH_MSM8960_FLUID is not set
+# CONFIG_MACH_MSM8960_LIQUID is not set
+# CONFIG_MACH_MSM_DUMMY is not set
+
+#
+# LGE Board Selection
+#
+CONFIG_BOARD_HEADER_FILE=""
+# CONFIG_MACH_LGE_DUMMY is not set
+
+#
+# LGE Specific Patches
+#
+# CONFIG_LGE_CRASH_HANDLER is not set
+CONFIG_MACH_HTC=y
+
+#
+# HTC Board Selection
+#
+CONFIG_MACH_VILLE=y
+# CONFIG_MACH_HTC_DUMMY is not set
+
+#
+# HTC Specific Patches
+#
+CONFIG_HTC_BATT_CORE=y
+CONFIG_HTC_BATT_8960=y
+CONFIG_HTC_HEADSET_MGR=y
+CONFIG_HTC_HEADSET_PMIC=y
+# CONFIG_HTC_HEADSET_ONE_WIRE is not set
+# CONFIG_MSM_STACKED_MEMORY is not set
+# CONFIG_KERNEL_MSM_CONTIG_MEM_REGION is not set
+CONFIG_MSM_AMSS_VERSION=6225
+# CONFIG_MSM_AMSS_VERSION_6210 is not set
+# CONFIG_MSM_AMSS_VERSION_6220 is not set
+CONFIG_MSM_AMSS_VERSION_6225=y
+CONFIG_MSM7X00A_USE_GP_TIMER=y
+# CONFIG_MSM7X00A_USE_DG_TIMER is not set
+CONFIG_MSM7X00A_SLEEP_MODE_POWER_COLLAPSE_SUSPEND=y
+# CONFIG_MSM7X00A_SLEEP_MODE_POWER_COLLAPSE is not set
+# CONFIG_MSM7X00A_SLEEP_MODE_APPS_SLEEP is not set
+# CONFIG_MSM7X00A_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT is not set
+# CONFIG_MSM7X00A_SLEEP_WAIT_FOR_INTERRUPT is not set
+CONFIG_MSM7X00A_SLEEP_MODE=0
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_POWER_COLLAPSE_SUSPEND is not set
+CONFIG_MSM7X00A_IDLE_SLEEP_MODE_POWER_COLLAPSE=y
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_APPS_SLEEP is not set
+# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT is not set
+# CONFIG_MSM7X00A_IDLE_SLEEP_WAIT_FOR_INTERRUPT is not set
+CONFIG_MSM7X00A_IDLE_SLEEP_MODE=1
+CONFIG_MSM7X00A_IDLE_SLEEP_MIN_TIME=20000000
+CONFIG_MSM7X00A_IDLE_SPIN_TIME=80000
+CONFIG_MSM_IDLE_STATS=y
+CONFIG_MSM_IDLE_STATS_FIRST_BUCKET=62500
+CONFIG_MSM_IDLE_STATS_BUCKET_SHIFT=2
+CONFIG_MSM_IDLE_STATS_BUCKET_COUNT=10
+CONFIG_MSM_SUSPEND_STATS_FIRST_BUCKET=1000000000
+CONFIG_CPU_HAS_L2_PMU=y
+# CONFIG_HTC_HEADSET is not set
+# CONFIG_HTC_PWRSINK is not set
+# CONFIG_MSM_FIQ_SUPPORT is not set
+# CONFIG_MSM_SERIAL_DEBUGGER is not set
+# CONFIG_MSM_PROC_COMM is not set
+CONFIG_MSM_SMD=y
+# CONFIG_MSM_SMD_PKG3 is not set
+CONFIG_MSM_SMD_PKG4=y
+CONFIG_MSM_SMD_DEBUG=y
+CONFIG_MSM_BAM_DMUX=y
+CONFIG_MSM_N_WAY_SMD=y
+CONFIG_MSM_N_WAY_SMSM=y
+CONFIG_MSM_RESET_MODEM=y
+CONFIG_MSM_SMD_LOGGING=y
+# CONFIG_MSM_IPC_LOGGING is not set
+CONFIG_MSM_SMD_NMEA=y
+# CONFIG_MSM_HSIC_TTY is not set
+CONFIG_MSM_SMD_TTY=y
+CONFIG_MSM_SMD_QMI=y
+CONFIG_MSM_SMD_PKT=y
+# CONFIG_MSM_DSPS is not set
+# CONFIG_MSM_ONCRPCROUTER is not set
+CONFIG_MSM_IPC_ROUTER=y
+CONFIG_MSM_IPC_ROUTER_SMD_XPRT=y
+# CONFIG_MSM_IPC_ROUTER_SECURITY is not set
+# CONFIG_MSM_DALRPC is not set
+# CONFIG_MSM_CPU_FREQ_SET_MIN_MAX is not set
+CONFIG_MSM_AVS_HW=y
+# CONFIG_MSM_HW3D is not set
+CONFIG_AMSS_7X25_VERSION_2009=y
+# CONFIG_AMSS_7X25_VERSION_2008 is not set
+CONFIG_RTAC=y
+# CONFIG_MSM_VREG_SWITCH_INVERTED is not set
+# CONFIG_MSM_DMA_TEST is not set
+# CONFIG_WIFI_CONTROL_FUNC is not set
+CONFIG_SURF_FFA_GPIO_KEYPAD=y
+CONFIG_MSM_SLEEP_TIME_OVERRIDE=y
+# CONFIG_MSM_MEMORY_LOW_POWER_MODE is not set
+CONFIG_MSM_PM_TIMEOUT_HALT=y
+# CONFIG_MSM_PM_TIMEOUT_RESET_MODEM is not set
+# CONFIG_MSM_PM_TIMEOUT_RESET_CHIP is not set
+CONFIG_MSM_IDLE_WAIT_ON_MODEM=0
+CONFIG_MSM_RPM_REGULATOR=y
+CONFIG_MSM_SUBSYSTEM_RESTART=y
+CONFIG_MSM_SYSMON_COMM=y
+CONFIG_MSM_PIL=y
+# CONFIG_MSM_PIL_MODEM is not set
+# CONFIG_MSM_PIL_QDSP6V3 is not set
+CONFIG_MSM_PIL_QDSP6V4=y
+# CONFIG_MSM_PIL_LPASS_QDSP6V5 is not set
+# CONFIG_MSM_PIL_MSS_QDSP6V5 is not set
+CONFIG_MSM_PIL_RIVA=y
+CONFIG_MSM_INSECURE_PIL_RIVA=y
+# CONFIG_MSM_PIL_TZAPPS is not set
+# CONFIG_MSM_PIL_DSPS is not set
+# CONFIG_MSM_PIL_VIDC is not set
+# CONFIG_MSM_PIL_VENUS is not set
+# CONFIG_MSM_PIL_GSS is not set
+# CONFIG_MSM_PIL_PRONTO is not set
+CONFIG_MSM_SCM=y
+CONFIG_MSM_MODEM_8960=y
+CONFIG_MSM_LPASS_8960=y
+CONFIG_MSM_WCNSS_SSR_8960=y
+CONFIG_MSM_BUSPM_DEV=y
+CONFIG_MSM_TZ_LOG=y
+CONFIG_MSM_RPM_LOG=y
+CONFIG_MSM_RPM_STATS_LOG=y
+# CONFIG_MSM_RPM_RBCPR_STATS_LOG is not set
+CONFIG_MSM_DIRECT_SCLK_ACCESS=y
+CONFIG_IOMMU_API=y
+CONFIG_MSM_GPIOMUX=y
+CONFIG_MSM_NATIVE_RESTART=y
+CONFIG_MSM_PM8X60=y
+# CONFIG_MSM_EVENT_TIMER is not set
+CONFIG_MSM_BUS_SCALING=y
+CONFIG_MSM_BUS_RPM_MULTI_TIER_ENABLED=y
+CONFIG_MSM_WATCHDOG=y
+# CONFIG_MSM_WATCHDOG_V2 is not set
+# CONFIG_MSM_MEMORY_DUMP is not set
+CONFIG_MSM_DLOAD_MODE=y
+# CONFIG_MSM_JTAG is not set
+# CONFIG_MSM_JTAG_MM is not set
+# CONFIG_MSM_SLEEP_STATS_DEVICE is not set
+CONFIG_MSM_RUN_QUEUE_STATS=y
+CONFIG_MSM_STANDALONE_POWER_COLLAPSE=y
+# CONFIG_MSM_GSBI9_UART is not set
+CONFIG_MSM_SHOW_RESUME_IRQ=y
+# CONFIG_MSM_FAKE_BATTERY is not set
+CONFIG_MSM_QDSP6_APR=y
+# CONFIG_MSM_QDSP6_APRV2 is not set
+CONFIG_MSM_QDSP6_CODECS=y
+# CONFIG_MSM_QDSP6V2_CODECS is not set
+CONFIG_MSM_AUDIO_QDSP6=y
+# CONFIG_MSM_AUDIO_QDSP6V2 is not set
+# CONFIG_MSM_ULTRASOUND is not set
+# CONFIG_MSM_SPM_V1 is not set
+CONFIG_MSM_SPM_V2=y
+CONFIG_MSM_L2_SPM=y
+CONFIG_MSM_MULTIMEDIA_USE_ION=y
+# CONFIG_MSM_OCMEM is not set
+# CONFIG_MSM_RTB is not set
+# CONFIG_MSM_EBI_ERP is not set
+# CONFIG_MSM_CACHE_ERP is not set
+CONFIG_MSM_DCVS=y
+# CONFIG_MSM_CPR is not set
+CONFIG_HAVE_ARCH_HAS_CURRENT_TIMER=y
+# CONFIG_MSM_CACHE_DUMP is not set
+# CONFIG_MSM_HSIC_SYSMON is not set
+CONFIG_MSM_CPU_PWRCTL=y
+
+#
+# System MMU
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_V7=y
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV7=y
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_HAS_ASID=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+
+#
+# Processor Features
+#
+# CONFIG_ARM_LPAE is not set
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_ARM_THUMB=y
+# CONFIG_ARM_THUMBEE is not set
+CONFIG_SWP_EMULATE=y
+# CONFIG_CPU_ICACHE_DISABLE is not set
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+# CONFIG_CACHE_L2X0 is not set
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_DMA_MEM_BUFFERABLE=y
+# CONFIG_VCM is not set
+CONFIG_STRICT_MEMORY_RWX=y
+CONFIG_ARM_NR_BANKS=8
+# CONFIG_RESERVE_FIRST_PAGE is not set
+CONFIG_CPU_HAS_PMU=y
+CONFIG_MULTI_IRQ_HANDLER=y
+# CONFIG_ARM_ERRATA_430973 is not set
+# CONFIG_ARM_ERRATA_458693 is not set
+# CONFIG_ARM_ERRATA_460075 is not set
+# CONFIG_ARM_ERRATA_742230 is not set
+# CONFIG_ARM_ERRATA_742231 is not set
+# CONFIG_ARM_ERRATA_720789 is not set
+# CONFIG_ARM_ERRATA_743622 is not set
+# CONFIG_ARM_ERRATA_751472 is not set
+# CONFIG_ARM_ERRATA_754322 is not set
+# CONFIG_ARM_ERRATA_754327 is not set
+# CONFIG_ARM_ERRATA_764369 is not set
+# CONFIG_KSAPI is not set
+CONFIG_ARM_GIC=y
+# CONFIG_FIQ_DEBUGGER is not set
+
+#
+# Bus support
+#
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_HAVE_SMP=y
+CONFIG_SMP=y
+# CONFIG_SMP_ON_UP is not set
+CONFIG_ARM_CPU_TOPOLOGY=y
+# CONFIG_SCHED_MC is not set
+# CONFIG_SCHED_SMT is not set
+CONFIG_HAVE_ARM_SCU=y
+# CONFIG_ARM_ARCH_TIMER is not set
+CONFIG_VMSPLIT_3G=y
+# CONFIG_VMSPLIT_2G is not set
+# CONFIG_VMSPLIT_1G is not set
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_NR_CPUS=2
+CONFIG_HOTPLUG_CPU=y
+CONFIG_LOCAL_TIMERS=y
+CONFIG_ARCH_NR_GPIO=0
+# CONFIG_PREEMPT_NONE is not set
+# CONFIG_PREEMPT_VOLUNTARY is not set
+CONFIG_PREEMPT=y
+CONFIG_PREEMPT_COUNT=y
+CONFIG_HZ=100
+# CONFIG_THUMB2_KERNEL is not set
+CONFIG_AEABI=y
+CONFIG_OABI_COMPAT=y
+CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_HAVE_ARCH_PFN_VALID=y
+CONFIG_HIGHMEM=y
+# CONFIG_HIGHPTE is not set
+CONFIG_HW_PERF_EVENTS=y
+CONFIG_VMALLOC_RESERVE=0x25800000
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_SPARSEMEM_MANUAL=y
+CONFIG_SPARSEMEM=y
+CONFIG_HAVE_MEMORY_PRESENT=y
+CONFIG_SPARSEMEM_EXTREME=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_COMPACTION=y
+CONFIG_MIGRATION=y
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_CLEANCACHE=y
+# CONFIG_ARCH_MEMORY_PROBE is not set
+# CONFIG_ARCH_MEMORY_REMOVE is not set
+# CONFIG_ENABLE_DMM is not set
+CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0=y
+CONFIG_HOLES_IN_ZONE=y
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_ALIGNMENT_TRAP=y
+# CONFIG_UACCESS_WITH_MEMCPY is not set
+# CONFIG_SECCOMP is not set
+CONFIG_CC_STACKPROTECTOR=y
+# CONFIG_DEPRECATED_PARAM_STRUCT is not set
+# CONFIG_ARM_FLUSH_CONSOLE_ON_RESTART is not set
+CONFIG_CP_ACCESS=y
+
+#
+# Boot options
+#
+# CONFIG_USE_OF is not set
+CONFIG_ZBOOT_ROM_TEXT=0
+CONFIG_ZBOOT_ROM_BSS=0
+CONFIG_CMDLINE=""
+# CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
+# CONFIG_AUTO_ZRELADDR is not set
+
+#
+# CPU Power Management
+#
+
+#
+# CPU Frequency scaling
+#
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_TABLE=y
+CONFIG_CPU_FREQ_STAT=y
+# CONFIG_CPU_FREQ_STAT_DETAILS is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=y
+# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_INTERACTIVE=y
+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
+
+#
+# ARM CPU frequency scaling drivers
+#
+# CONFIG_ARM_EXYNOS4210_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS4X12_CPUFREQ is not set
+# CONFIG_ARM_EXYNOS5250_CPUFREQ is not set
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_IDLE_GOV_MENU=y
+CONFIG_CPU_FREQ_MSM=y
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+# CONFIG_FPE_NWFPE is not set
+# CONFIG_FPE_FASTFPE is not set
+CONFIG_VFP=y
+CONFIG_VFPv3=y
+CONFIG_NEON=y
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+CONFIG_HAVE_AOUT=y
+# CONFIG_BINFMT_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+
+#
+# Power management options
+#
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+CONFIG_HAS_WAKELOCK=y
+CONFIG_HAS_EARLYSUSPEND=y
+CONFIG_WAKELOCK=y
+CONFIG_WAKELOCK_STAT=y
+CONFIG_USER_WAKELOCK=y
+CONFIG_EARLYSUSPEND=y
+# CONFIG_NO_USER_SPACE_SCREEN_ACCESS_CONTROL is not set
+CONFIG_FB_EARLYSUSPEND=y
+CONFIG_PM_SLEEP=y
+CONFIG_PM_SLEEP_SMP=y
+CONFIG_PM_RUNTIME=y
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+# CONFIG_APM_EMULATION is not set
+CONFIG_PM_CLK=y
+CONFIG_CPU_PM=y
+# CONFIG_SUSPEND_TIME is not set
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+# CONFIG_UNIX_DIAG is not set
+CONFIG_XFRM=y
+CONFIG_XFRM_USER=y
+# CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
+CONFIG_XFRM_IPCOMP=y
+CONFIG_NET_KEY=y
+# CONFIG_NET_KEY_MIGRATE is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_ADVANCED_ROUTER=y
+# CONFIG_IP_FIB_TRIE_STATS is not set
+CONFIG_IP_MULTIPLE_TABLES=y
+# CONFIG_IP_ROUTE_MULTIPATH is not set
+# CONFIG_IP_ROUTE_VERBOSE is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE_DEMUX is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+CONFIG_INET_AH=y
+CONFIG_INET_ESP=y
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+CONFIG_INET_TUNNEL=y
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+CONFIG_IPV6=y
+CONFIG_IPV6_PRIVACY=y
+CONFIG_IPV6_ROUTER_PREF=y
+CONFIG_IPV6_ROUTE_INFO=y
+CONFIG_IPV6_OPTIMISTIC_DAD=y
+CONFIG_INET6_AH=y
+CONFIG_INET6_ESP=y
+CONFIG_INET6_IPCOMP=y
+CONFIG_IPV6_MIP6=y
+CONFIG_INET6_XFRM_TUNNEL=y
+CONFIG_INET6_TUNNEL=y
+CONFIG_INET6_XFRM_MODE_TRANSPORT=y
+CONFIG_INET6_XFRM_MODE_TUNNEL=y
+CONFIG_INET6_XFRM_MODE_BEET=y
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+CONFIG_IPV6_SIT=y
+# CONFIG_IPV6_SIT_6RD is not set
+CONFIG_IPV6_NDISC_NODETYPE=y
+# CONFIG_IPV6_TUNNEL is not set
+CONFIG_IPV6_MULTIPLE_TABLES=y
+CONFIG_IPV6_SUBTREES=y
+# CONFIG_IPV6_MROUTE is not set
+# CONFIG_ANDROID_PARANOID_NETWORK is not set
+CONFIG_NET_ACTIVITY_STATS=y
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+CONFIG_NETFILTER_ADVANCED=y
+
+#
+# Core Netfilter Configuration
+#
+CONFIG_NETFILTER_NETLINK=y
+# CONFIG_NETFILTER_NETLINK_ACCT is not set
+CONFIG_NETFILTER_NETLINK_QUEUE=y
+CONFIG_NETFILTER_NETLINK_LOG=y
+CONFIG_NF_CONNTRACK=y
+CONFIG_NF_CONNTRACK_MARK=y
+CONFIG_NF_CONNTRACK_PROCFS=y
+CONFIG_NF_CONNTRACK_EVENTS=y
+# CONFIG_NF_CONNTRACK_TIMEOUT is not set
+# CONFIG_NF_CONNTRACK_TIMESTAMP is not set
+CONFIG_NF_CT_PROTO_DCCP=y
+CONFIG_NF_CT_PROTO_GRE=y
+CONFIG_NF_CT_PROTO_SCTP=y
+CONFIG_NF_CT_PROTO_UDPLITE=y
+CONFIG_NF_CONNTRACK_AMANDA=y
+CONFIG_NF_CONNTRACK_FTP=y
+CONFIG_NF_CONNTRACK_H323=y
+CONFIG_NF_CONNTRACK_IRC=y
+CONFIG_NF_CONNTRACK_BROADCAST=y
+CONFIG_NF_CONNTRACK_NETBIOS_NS=y
+# CONFIG_NF_CONNTRACK_SNMP is not set
+CONFIG_NF_CONNTRACK_PPTP=y
+CONFIG_NF_CONNTRACK_SANE=y
+CONFIG_NF_CONNTRACK_SIP=y
+CONFIG_NF_CONNTRACK_TFTP=y
+CONFIG_NF_CT_NETLINK=y
+# CONFIG_NF_CT_NETLINK_TIMEOUT is not set
+CONFIG_NETFILTER_TPROXY=y
+CONFIG_NETFILTER_XTABLES=y
+
+#
+# Xtables combined modules
+#
+CONFIG_NETFILTER_XT_MARK=y
+CONFIG_NETFILTER_XT_CONNMARK=y
+
+#
+# Xtables targets
+#
+# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set
+CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
+CONFIG_NETFILTER_XT_TARGET_CONNMARK=y
+# CONFIG_NETFILTER_XT_TARGET_CT is not set
+# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
+CONFIG_NETFILTER_XT_TARGET_HL=y
+# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set
+# CONFIG_NETFILTER_XT_TARGET_LOG is not set
+CONFIG_NETFILTER_XT_TARGET_MARK=y
+# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
+CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y
+# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set
+# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
+# CONFIG_NETFILTER_XT_TARGET_TEE is not set
+# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set
+# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
+CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
+# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
+
+#
+# Xtables matches
+#
+# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set
+# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set
+CONFIG_NETFILTER_XT_MATCH_COMMENT=y
+# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set
+CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y
+CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
+# CONFIG_NETFILTER_XT_MATCH_CPU is not set
+# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
+# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set
+# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
+CONFIG_NETFILTER_XT_MATCH_ECN=y
+CONFIG_NETFILTER_XT_MATCH_ESP=y
+CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y
+CONFIG_NETFILTER_XT_MATCH_HELPER=y
+CONFIG_NETFILTER_XT_MATCH_HL=y
+CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
+CONFIG_NETFILTER_XT_MATCH_LENGTH=y
+CONFIG_NETFILTER_XT_MATCH_LIMIT=y
+CONFIG_NETFILTER_XT_MATCH_MAC=y
+CONFIG_NETFILTER_XT_MATCH_MARK=y
+CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
+# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set
+# CONFIG_NETFILTER_XT_MATCH_OSF is not set
+# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
+CONFIG_NETFILTER_XT_MATCH_POLICY=y
+CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
+CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA2=y
+CONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG=y
+# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
+# CONFIG_NETFILTER_XT_MATCH_REALM is not set
+# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
+# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
+CONFIG_NETFILTER_XT_MATCH_SOCKET=y
+CONFIG_NETFILTER_XT_MATCH_STATE=y
+CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
+CONFIG_NETFILTER_XT_MATCH_STRING=y
+CONFIG_NETFILTER_XT_MATCH_TCPMSS=y
+CONFIG_NETFILTER_XT_MATCH_TIME=y
+CONFIG_NETFILTER_XT_MATCH_U32=y
+# CONFIG_IP_SET is not set
+# CONFIG_IP_VS is not set
+
+#
+# IP: Netfilter Configuration
+#
+CONFIG_NF_DEFRAG_IPV4=y
+CONFIG_NF_CONNTRACK_IPV4=y
+CONFIG_NF_CONNTRACK_PROC_COMPAT=y
+# CONFIG_IP_NF_QUEUE is not set
+CONFIG_IP_NF_IPTABLES=y
+CONFIG_IP_NF_MATCH_AH=y
+CONFIG_IP_NF_MATCH_ECN=y
+# CONFIG_IP_NF_MATCH_RPFILTER is not set
+CONFIG_IP_NF_MATCH_TTL=y
+CONFIG_IP_NF_FILTER=y
+CONFIG_IP_NF_TARGET_REJECT=y
+# CONFIG_IP_NF_TARGET_REJECT_SKERR is not set
+# CONFIG_IP_NF_TARGET_ULOG is not set
+CONFIG_NF_NAT=y
+CONFIG_NF_NAT_NEEDED=y
+CONFIG_IP_NF_TARGET_MASQUERADE=y
+CONFIG_IP_NF_TARGET_NETMAP=y
+CONFIG_IP_NF_TARGET_REDIRECT=y
+CONFIG_NF_NAT_PROTO_DCCP=y
+CONFIG_NF_NAT_PROTO_GRE=y
+CONFIG_NF_NAT_PROTO_UDPLITE=y
+CONFIG_NF_NAT_PROTO_SCTP=y
+CONFIG_NF_NAT_FTP=y
+CONFIG_NF_NAT_IRC=y
+CONFIG_NF_NAT_TFTP=y
+CONFIG_NF_NAT_AMANDA=y
+CONFIG_NF_NAT_PPTP=y
+CONFIG_NF_NAT_H323=y
+CONFIG_NF_NAT_SIP=y
+CONFIG_IP_NF_MANGLE=y
+# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
+# CONFIG_IP_NF_TARGET_ECN is not set
+# CONFIG_IP_NF_TARGET_TTL is not set
+CONFIG_IP_NF_RAW=y
+CONFIG_IP_NF_ARPTABLES=y
+CONFIG_IP_NF_ARPFILTER=y
+CONFIG_IP_NF_ARP_MANGLE=y
+
+#
+# IPv6: Netfilter Configuration
+#
+CONFIG_NF_DEFRAG_IPV6=y
+CONFIG_NF_CONNTRACK_IPV6=y
+# CONFIG_IP6_NF_QUEUE is not set
+CONFIG_IP6_NF_IPTABLES=y
+CONFIG_IP6_NF_MATCH_AH=y
+CONFIG_IP6_NF_MATCH_EUI64=y
+CONFIG_IP6_NF_MATCH_FRAG=y
+CONFIG_IP6_NF_MATCH_OPTS=y
+CONFIG_IP6_NF_MATCH_HL=y
+CONFIG_IP6_NF_MATCH_IPV6HEADER=y
+CONFIG_IP6_NF_MATCH_MH=y
+# CONFIG_IP6_NF_MATCH_RPFILTER is not set
+CONFIG_IP6_NF_MATCH_RT=y
+CONFIG_IP6_NF_TARGET_HL=y
+CONFIG_IP6_NF_FILTER=y
+CONFIG_IP6_NF_TARGET_REJECT=y
+# CONFIG_IP6_NF_TARGET_REJECT_SKERR is not set
+CONFIG_IP6_NF_MANGLE=y
+CONFIG_IP6_NF_RAW=y
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_L2TP is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+CONFIG_NET_SCHED=y
+
+#
+# Queueing/Scheduling
+#
+# CONFIG_NET_SCH_CBQ is not set
+CONFIG_NET_SCH_HTB=y
+# CONFIG_NET_SCH_HFSC is not set
+CONFIG_NET_SCH_PRIO=y
+# CONFIG_NET_SCH_MULTIQ is not set
+# CONFIG_NET_SCH_RED is not set
+# CONFIG_NET_SCH_SFB is not set
+# CONFIG_NET_SCH_SFQ is not set
+# CONFIG_NET_SCH_TEQL is not set
+# CONFIG_NET_SCH_TBF is not set
+# CONFIG_NET_SCH_GRED is not set
+# CONFIG_NET_SCH_DSMARK is not set
+# CONFIG_NET_SCH_NETEM is not set
+# CONFIG_NET_SCH_DRR is not set
+# CONFIG_NET_SCH_MQPRIO is not set
+# CONFIG_NET_SCH_CHOKE is not set
+# CONFIG_NET_SCH_QFQ is not set
+# CONFIG_NET_SCH_INGRESS is not set
+# CONFIG_NET_SCH_PLUG is not set
+
+#
+# Classification
+#
+CONFIG_NET_CLS=y
+# CONFIG_NET_CLS_BASIC is not set
+# CONFIG_NET_CLS_TCINDEX is not set
+# CONFIG_NET_CLS_ROUTE4 is not set
+CONFIG_NET_CLS_FW=y
+CONFIG_NET_CLS_U32=y
+# CONFIG_CLS_U32_PERF is not set
+CONFIG_CLS_U32_MARK=y
+# CONFIG_NET_CLS_RSVP is not set
+# CONFIG_NET_CLS_RSVP6 is not set
+CONFIG_NET_CLS_FLOW=y
+# CONFIG_NET_CLS_CGROUP is not set
+CONFIG_NET_EMATCH=y
+CONFIG_NET_EMATCH_STACK=32
+CONFIG_NET_EMATCH_CMP=y
+CONFIG_NET_EMATCH_NBYTE=y
+CONFIG_NET_EMATCH_U32=y
+CONFIG_NET_EMATCH_META=y
+CONFIG_NET_EMATCH_TEXT=y
+CONFIG_NET_CLS_ACT=y
+# CONFIG_NET_ACT_POLICE is not set
+# CONFIG_NET_ACT_GACT is not set
+# CONFIG_NET_ACT_MIRRED is not set
+# CONFIG_NET_ACT_IPT is not set
+# CONFIG_NET_ACT_NAT is not set
+# CONFIG_NET_ACT_PEDIT is not set
+# CONFIG_NET_ACT_SIMP is not set
+# CONFIG_NET_ACT_SKBEDIT is not set
+# CONFIG_NET_ACT_CSUM is not set
+# CONFIG_NET_CLS_IND is not set
+CONFIG_NET_SCH_FIFO=y
+# CONFIG_DCB is not set
+CONFIG_DNS_RESOLVER=y
+# CONFIG_BATMAN_ADV is not set
+# CONFIG_OPENVSWITCH is not set
+CONFIG_RPS=y
+CONFIG_RFS_ACCEL=y
+CONFIG_XPS=y
+# CONFIG_NETPRIO_CGROUP is not set
+CONFIG_BQL=y
+CONFIG_HAVE_BPF_JIT=y
+# CONFIG_BPF_JIT is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NET_TCPPROBE is not set
+# CONFIG_NET_DROP_MONITOR is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=y
+CONFIG_BT_RFCOMM=y
+CONFIG_BT_RFCOMM_TTY=y
+CONFIG_BT_BNEP=y
+CONFIG_BT_BNEP_MC_FILTER=y
+CONFIG_BT_BNEP_PROTO_FILTER=y
+CONFIG_BT_HIDP=y
+
+#
+# Bluetooth device drivers
+#
+CONFIG_BT_HCISMD=y
+# CONFIG_BT_HCIBTUSB is not set
+# CONFIG_BT_HCIBTSDIO is not set
+# CONFIG_BT_HCIUART is not set
+# CONFIG_BT_HCIBCM203X is not set
+# CONFIG_BT_HCIBPA10X is not set
+# CONFIG_BT_MSM_SLEEP is not set
+# CONFIG_BT_HCIBFUSB is not set
+# CONFIG_BT_HCIVHCI is not set
+# CONFIG_BT_MRVL is not set
+# CONFIG_MSM_BT_POWER is not set
+# CONFIG_AF_RXRPC is not set
+CONFIG_FIB_RULES=y
+CONFIG_WIRELESS=y
+CONFIG_WIRELESS_EXT=y
+CONFIG_WEXT_CORE=y
+CONFIG_WEXT_PROC=y
+CONFIG_WEXT_SPY=y
+CONFIG_WEXT_PRIV=y
+CONFIG_CFG80211=y
+# CONFIG_NL80211_TESTMODE is not set
+# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
+# CONFIG_CFG80211_REG_DEBUG is not set
+CONFIG_CFG80211_DEFAULT_PS=y
+# CONFIG_CFG80211_DEBUGFS is not set
+# CONFIG_CFG80211_INTERNAL_REGDB is not set
+# CONFIG_CFG80211_WEXT is not set
+CONFIG_WIRELESS_EXT_SYSFS=y
+# CONFIG_LIB80211 is not set
+# CONFIG_CFG80211_ALLOW_RECONNECT is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_WIMAX is not set
+CONFIG_RFKILL=y
+CONFIG_RFKILL_PM=y
+# CONFIG_RFKILL_INPUT is not set
+# CONFIG_RFKILL_REGULATOR is not set
+# CONFIG_RFKILL_GPIO is not set
+# CONFIG_NET_9P is not set
+# CONFIG_CAIF is not set
+# CONFIG_CEPH_LIB is not set
+# CONFIG_NFC is not set
+# CONFIG_BCM2079X is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH=""
+# CONFIG_DEVTMPFS is not set
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_GENERIC_CPU_DEVICES is not set
+CONFIG_REGMAP=y
+CONFIG_REGMAP_I2C=y
+CONFIG_REGMAP_SPI=y
+CONFIG_DMA_SHARED_BUFFER=y
+CONFIG_GENLOCK=y
+CONFIG_GENLOCK_MISCDEVICE=y
+CONFIG_SYNC=y
+CONFIG_SW_SYNC=y
+# CONFIG_SW_SYNC_USER is not set
+# CONFIG_CMA is not set
+# CONFIG_CONNECTOR is not set
+# CONFIG_MTD is not set
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+
+#
+# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
+#
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=4096
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_MG_DISK is not set
+# CONFIG_BLK_DEV_RBD is not set
+
+#
+# Misc devices
+#
+# CONFIG_SENSORS_LIS3LV02D is not set
+# CONFIG_AD525X_DPOT is not set
+CONFIG_ANDROID_PMEM=y
+# CONFIG_ATMEL_PWM is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_APDS9802ALS is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_ISL29020 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_SENSORS_BH1780 is not set
+# CONFIG_SENSORS_BH1770 is not set
+# CONFIG_SENSORS_APDS990X is not set
+# CONFIG_HMC6352 is not set
+# CONFIG_SENSORS_AK8975 is not set
+# CONFIG_DS1682 is not set
+# CONFIG_TI_DAC7512 is not set
+CONFIG_UID_STAT=y
+# CONFIG_BMP085 is not set
+# CONFIG_USB_SWITCH_FSA9480 is not set
+# CONFIG_WL127X_RFKILL is not set
+# CONFIG_APANIC is not set
+# CONFIG_TSIF is not set
+# CONFIG_TSPP is not set
+# CONFIG_HAPTIC_ISA1200 is not set
+CONFIG_PMIC8XXX_VIBRATOR=y
+# CONFIG_ANDROID_VIBRATOR is not set
+# CONFIG_TOUCHSENSE_VIBRATOR is not set
+# CONFIG_PMIC8XXX_NFC is not set
+# CONFIG_PMIC8XXX_UPL is not set
+# CONFIG_QSEECOM is not set
+# CONFIG_QFP_FUSE is not set
+# CONFIG_BU52031NVX is not set
+CONFIG_CABLE_DETECT_8XXX=y
+CONFIG_CABLE_DETECT_ACCESSORY=y
+CONFIG_CABLE_DETECT_ACCESSORY_BY_ADC=y
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_AT25 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_EEPROM_93XX46 is not set
+# CONFIG_IWMC3200TOP is not set
+
+#
+# Texas Instruments shared transport line discipline
+#
+# CONFIG_TI_ST is not set
+# CONFIG_SENSORS_LIS3_SPI is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
+
+#
+# Altera FPGA firmware download module
+#
+# CONFIG_ALTERA_STAPL is not set
+# CONFIG_SLIMPORT_ANX7808 is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI_MOD=y
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+CONFIG_SCSI_TGT=y
+# CONFIG_SCSI_NETLINK is not set
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+CONFIG_CHR_DEV_SG=y
+CONFIG_CHR_DEV_SCH=y
+CONFIG_SCSI_MULTI_LUN=y
+CONFIG_SCSI_CONSTANTS=y
+CONFIG_SCSI_LOGGING=y
+CONFIG_SCSI_SCAN_ASYNC=y
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_ISCSI_BOOT_SYSFS is not set
+# CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
+# CONFIG_ATA is not set
+CONFIG_MD=y
+# CONFIG_BLK_DEV_MD is not set
+CONFIG_BLK_DEV_DM=y
+# CONFIG_DM_DEBUG is not set
+CONFIG_DM_CRYPT=y
+# CONFIG_DM_SNAPSHOT is not set
+# CONFIG_DM_THIN_PROVISIONING is not set
+# CONFIG_DM_MIRROR is not set
+# CONFIG_DM_RAID is not set
+# CONFIG_DM_ZERO is not set
+# CONFIG_DM_MULTIPATH is not set
+# CONFIG_DM_DELAY is not set
+# CONFIG_DM_UEVENT is not set
+# CONFIG_DM_FLAKEY is not set
+# CONFIG_DM_VERITY is not set
+# CONFIG_TARGET_CORE is not set
+CONFIG_NETDEVICES=y
+CONFIG_NET_CORE=y
+# CONFIG_BONDING is not set
+CONFIG_DUMMY=y
+# CONFIG_EQUALIZER is not set
+CONFIG_MII=y
+# CONFIG_IFB is not set
+# CONFIG_NET_TEAM is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+CONFIG_TUN=y
+# CONFIG_VETH is not set
+
+#
+# CAIF transport drivers
+#
+CONFIG_ETHERNET=y
+CONFIG_NET_VENDOR_BROADCOM=y
+# CONFIG_B44 is not set
+# CONFIG_NET_CALXEDA_XGMAC is not set
+CONFIG_NET_VENDOR_CHELSIO=y
+CONFIG_NET_VENDOR_CIRRUS=y
+# CONFIG_CS89x0 is not set
+# CONFIG_DM9000 is not set
+# CONFIG_DNET is not set
+CONFIG_NET_VENDOR_FARADAY=y
+# CONFIG_FTMAC100 is not set
+# CONFIG_FTGMAC100 is not set
+CONFIG_NET_VENDOR_INTEL=y
+CONFIG_NET_VENDOR_I825XX=y
+CONFIG_NET_VENDOR_MARVELL=y
+CONFIG_NET_VENDOR_MICREL=y
+# CONFIG_KS8851 is not set
+# CONFIG_KS8851_MLL is not set
+CONFIG_NET_VENDOR_MICROCHIP=y
+# CONFIG_ENC28J60 is not set
+# CONFIG_MSM_RMNET is not set
+CONFIG_MSM_RMNET_BAM=y
+# CONFIG_QFEC is not set
+CONFIG_NET_VENDOR_NATSEMI=y
+CONFIG_NET_VENDOR_8390=y
+# CONFIG_AX88796 is not set
+# CONFIG_ETHOC is not set
+CONFIG_NET_VENDOR_SEEQ=y
+# CONFIG_SEEQ8005 is not set
+CONFIG_NET_VENDOR_SMSC=y
+CONFIG_SMC91X=y
+CONFIG_SMC911X=y
+CONFIG_SMSC911X=y
+# CONFIG_SMSC911X_ARCH_HOOKS is not set
+CONFIG_NET_VENDOR_STMICRO=y
+# CONFIG_STMMAC_ETH is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_AMD_PHY is not set
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+# CONFIG_LXT_PHY is not set
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+# CONFIG_SMSC_PHY is not set
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_MICREL_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+# CONFIG_MICREL_KS8995MA is not set
+# CONFIG_PPP is not set
+CONFIG_SLIP=y
+CONFIG_SLHC=y
+CONFIG_SLIP_COMPRESSED=y
+# CONFIG_SLIP_SMART is not set
+CONFIG_SLIP_MODE_SLIP6=y
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_USB_HSO is not set
+# CONFIG_USB_IPHETH is not set
+CONFIG_WLAN=y
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_USB_NET_RNDIS_WLAN is not set
+# CONFIG_LIBRA_SDIOIF is not set
+# CONFIG_ATH6K_LEGACY_EXT is not set
+CONFIG_WCNSS_CORE=y
+# CONFIG_ATH_COMMON is not set
+# CONFIG_BCMDHD is not set
+# CONFIG_BRCMFMAC is not set
+# CONFIG_HOSTAP is not set
+# CONFIG_IWM is not set
+# CONFIG_LIBERTAS is not set
+# CONFIG_MWIFIEX is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+CONFIG_INPUT_KEYRESET=y
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+# CONFIG_KEYBOARD_ADP5589 is not set
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_QT1070 is not set
+# CONFIG_KEYBOARD_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_GPIO is not set
+# CONFIG_KEYBOARD_TCA6416 is not set
+# CONFIG_KEYBOARD_TCA8418 is not set
+# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_LM8323 is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_MCS is not set
+# CONFIG_KEYBOARD_MPR121 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+CONFIG_KEYBOARD_PMIC8XXX=y
+# CONFIG_KEYBOARD_SAMSUNG is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_OMAP4 is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_QCIKBD is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_SENTELIC is not set
+# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_APPLETOUCH is not set
+# CONFIG_MOUSE_BCM5974 is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_GPIO is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
+# CONFIG_MOUSE_QCITP is not set
+# CONFIG_MOUSE_SYNAPTICS_USB is not set
+CONFIG_INPUT_JOYSTICK=y
+# CONFIG_JOYSTICK_ANALOG is not set
+# CONFIG_JOYSTICK_A3D is not set
+# CONFIG_JOYSTICK_ADI is not set
+# CONFIG_JOYSTICK_COBRA is not set
+# CONFIG_JOYSTICK_GF2K is not set
+# CONFIG_JOYSTICK_GRIP is not set
+# CONFIG_JOYSTICK_GRIP_MP is not set
+# CONFIG_JOYSTICK_GUILLEMOT is not set
+# CONFIG_JOYSTICK_INTERACT is not set
+# CONFIG_JOYSTICK_SIDEWINDER is not set
+# CONFIG_JOYSTICK_TMDC is not set
+# CONFIG_JOYSTICK_IFORCE is not set
+# CONFIG_JOYSTICK_WARRIOR is not set
+# CONFIG_JOYSTICK_MAGELLAN is not set
+# CONFIG_JOYSTICK_SPACEORB is not set
+# CONFIG_JOYSTICK_SPACEBALL is not set
+# CONFIG_JOYSTICK_STINGER is not set
+# CONFIG_JOYSTICK_TWIDJOY is not set
+# CONFIG_JOYSTICK_ZHENHUA is not set
+# CONFIG_JOYSTICK_AS5011 is not set
+# CONFIG_JOYSTICK_JOYDUMP is not set
+# CONFIG_JOYSTICK_XPAD is not set
+# CONFIG_TOUCHDISC_VTD518_SHINETSU is not set
+# CONFIG_INPUT_TABLET is not set
+CONFIG_INPUT_TOUCHSCREEN=y
+# CONFIG_TOUCHSCREEN_ADS7846 is not set
+# CONFIG_TOUCHSCREEN_AD7877 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_MAXTOUCH is not set
+# CONFIG_TOUCHSCREEN_AD7879 is not set
+# CONFIG_TOUCHSCREEN_ATMEL_MXT is not set
+# CONFIG_TOUCHSCREEN_AUO_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_BU21013 is not set
+# CONFIG_TOUCHSCREEN_CY8CTMG110 is not set
+# CONFIG_TOUCHSCREEN_CYTTSP_CORE is not set
+# CONFIG_TOUCHSCREEN_DYNAPRO is not set
+# CONFIG_TOUCHSCREEN_HAMPSHIRE is not set
+# CONFIG_TOUCHSCREEN_EETI is not set
+# CONFIG_TOUCHSCREEN_EGALAX is not set
+# CONFIG_TOUCHSCREEN_FUJITSU is not set
+# CONFIG_TOUCHSCREEN_ILI210X is not set
+# CONFIG_TOUCHSCREEN_GUNZE is not set
+# CONFIG_TOUCHSCREEN_ELO is not set
+# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
+# CONFIG_TOUCHSCREEN_MAX11801 is not set
+# CONFIG_TOUCHSCREEN_MCS5000 is not set
+# CONFIG_TOUCHSCREEN_MTOUCH is not set
+# CONFIG_TOUCHSCREEN_INEXIO is not set
+# CONFIG_TOUCHSCREEN_MK712 is not set
+# CONFIG_TOUCHSCREEN_PENMOUNT is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_RMI4_I2C is not set
+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
+# CONFIG_TOUCHSCREEN_PIXCIR is not set
+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
+# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
+# CONFIG_TOUCHSCREEN_TSC_SERIO is not set
+# CONFIG_TOUCHSCREEN_TSC2005 is not set
+# CONFIG_TOUCHSCREEN_TSC2007 is not set
+# CONFIG_TOUCHSCREEN_MSM_LEGACY is not set
+# CONFIG_TOUCHSCREEN_W90X900 is not set
+# CONFIG_TOUCHSCREEN_ST1232 is not set
+# CONFIG_TOUCHSCREEN_TPS6507X is not set
+# CONFIG_TOUCHSCREEN_CY8C_TS is not set
+# CONFIG_TOUCHSCREEN_CYTTSP_I2C_QC is not set
+# CONFIG_TOUCHSCREEN_FT5X06 is not set
+# CONFIG_TOUCHSCREEN_LGE_COMMON is not set
+# CONFIG_TOUCHSCREEN_LGE_SYNAPTICS is not set
+# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4 is not set
+CONFIG_TOUCHSCREEN_ATMEL_224E=y
+CONFIG_TOUCHSCREEN_CYPRESS_CS=y
+CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_AD714X is not set
+# CONFIG_INPUT_BMA150 is not set
+# CONFIG_INPUT_PM8XXX_VIBRATOR is not set
+CONFIG_INPUT_PMIC8XXX_PWRKEY=y
+# CONFIG_INPUT_MMA8450 is not set
+# CONFIG_INPUT_MPU3050 is not set
+# CONFIG_INPUT_GP2A is not set
+# CONFIG_INPUT_GPIO_TILT_POLLED is not set
+# CONFIG_INPUT_ATI_REMOTE2 is not set
+CONFIG_INPUT_KEYCHORD=y
+# CONFIG_INPUT_KEYSPAN_REMOTE is not set
+# CONFIG_INPUT_KXTJ9 is not set
+# CONFIG_INPUT_POWERMATE is not set
+# CONFIG_INPUT_YEALINK is not set
+# CONFIG_INPUT_CM109 is not set
+CONFIG_INPUT_UINPUT=y
+CONFIG_INPUT_GPIO=y
+# CONFIG_INPUT_ISA1200_FF_MEMLESS is not set
+# CONFIG_INPUT_PCF8574 is not set
+# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
+# CONFIG_INPUT_ADXL34X is not set
+# CONFIG_INPUT_CMA3000 is not set
+# CONFIG_BOSCH_BMA150 is not set
+# CONFIG_STM_LIS3DH is not set
+# CONFIG_BMP18X is not set
+CONFIG_SENSORS_AKM8975_PANA_GYRO=y
+CONFIG_SENSORS_PANASONIC_GYRO=y
+CONFIG_SENSORS_BMA250=y
+CONFIG_INPUT_CAPELLA_CM3629=y
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_SERPORT=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_SERIO_PS2MULT is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+# CONFIG_VT is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_N_GSM is not set
+# CONFIG_N_SMUX is not set
+# CONFIG_TRACE_SINK is not set
+CONFIG_DEVMEM=y
+CONFIG_DEVKMEM=y
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_MAX3100 is not set
+# CONFIG_SERIAL_MAX3107 is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_SERIAL_MSM=y
+# CONFIG_SERIAL_MSM_CONSOLE is not set
+CONFIG_SERIAL_MSM_HS=y
+# CONFIG_SERIAL_MSM_CLOCK_CONTROL is not set
+CONFIG_SERIAL_MSM_HSL=y
+CONFIG_SERIAL_MSM_HSL_CONSOLE=y
+# CONFIG_SERIAL_BCM_BT_LPM is not set
+# CONFIG_SERIAL_TIMBERDALE is not set
+# CONFIG_SERIAL_ALTERA_JTAGUART is not set
+# CONFIG_SERIAL_ALTERA_UART is not set
+# CONFIG_SERIAL_IFX6X60 is not set
+# CONFIG_SERIAL_MSM_SMD is not set
+# CONFIG_SERIAL_XILINX_PS_UART is not set
+
+#
+# Diag Support
+#
+CONFIG_DIAG_CHAR=y
+
+#
+# DIAG traffic over USB
+#
+CONFIG_DIAG_OVER_USB=y
+
+#
+# SDIO support for DIAG
+#
+
+#
+# HSIC/SMUX support for DIAG
+#
+# CONFIG_TTY_PRINTK is not set
+# CONFIG_HVC_DCC is not set
+# CONFIG_IPMI_HANDLER is not set
+CONFIG_HW_RANDOM=y
+# CONFIG_HW_RANDOM_TIMERIOMEM is not set
+CONFIG_HW_RANDOM_MSM=y
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+# CONFIG_DCC_TTY is not set
+# CONFIG_RAMOOPS is not set
+CONFIG_MSM_ROTATOR=y
+# CONFIG_MSM_ADSPRPC is not set
+# CONFIG_MMC_GENERIC_CSDIO is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=y
+# CONFIG_I2C_MUX is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
+# CONFIG_I2C_GPIO is not set
+# CONFIG_I2C_MSM is not set
+CONFIG_I2C_QUP=y
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_PXA_PCI is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_XILINX is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_DIOLAN_U2C is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_STUB is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
+CONFIG_SPI_MASTER=y
+
+#
+# SPI Master Controller Drivers
+#
+# CONFIG_SPI_ALTERA is not set
+# CONFIG_SPI_BITBANG is not set
+# CONFIG_SPI_GPIO is not set
+# CONFIG_SPI_OC_TINY is not set
+# CONFIG_SPI_PXA2XX_PCI is not set
+# CONFIG_SPI_XILINX is not set
+CONFIG_SPI_QUP=y
+# CONFIG_SPI_DESIGNWARE is not set
+
+#
+# SPI Protocol Masters
+#
+CONFIG_SPI_SPIDEV=y
+# CONFIG_SPI_TLE62X0 is not set
+# CONFIG_SPMI is not set
+CONFIG_SLIMBUS=y
+CONFIG_SLIMBUS_MSM_CTRL=y
+# CONFIG_HSI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+
+#
+# PPS generators support
+#
+
+#
+# PTP clock support
+#
+
+#
+# Enable Device Drivers -> PPS to see the PTP clock options.
+#
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+CONFIG_GPIOLIB=y
+CONFIG_DEBUG_GPIO=y
+CONFIG_GPIO_SYSFS=y
+
+#
+# Memory mapped GPIO drivers:
+#
+# CONFIG_GPIO_GENERIC_PLATFORM is not set
+# CONFIG_GPIO_MSM_V1 is not set
+CONFIG_GPIO_MSM_V2=y
+# CONFIG_GPIO_MSM_V3 is not set
+# CONFIG_GPIO_FSM9XXX is not set
+
+#
+# I2C GPIO expanders:
+#
+# CONFIG_GPIO_MAX7300 is not set
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCF857X is not set
+CONFIG_GPIO_SX150X=y
+# CONFIG_GPIO_ADP5588 is not set
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+# CONFIG_GPIO_MAX7301 is not set
+# CONFIG_GPIO_MCP23S08 is not set
+# CONFIG_GPIO_MC33880 is not set
+# CONFIG_GPIO_74X164 is not set
+
+#
+# AC97 GPIO expanders:
+#
+
+#
+# MODULbus GPIO expanders:
+#
+CONFIG_GPIO_PM8XXX=y
+CONFIG_GPIO_PM8XXX_MPP=y
+# CONFIG_GPIO_PM8XXX_RPC is not set
+# CONFIG_W1 is not set
+CONFIG_POWER_SUPPLY=y
+# CONFIG_POWER_SUPPLY_DEBUG is not set
+# CONFIG_PDA_POWER is not set
+# CONFIG_TEST_POWER is not set
+# CONFIG_BATTERY_DS2780 is not set
+# CONFIG_BATTERY_DS2781 is not set
+# CONFIG_BATTERY_DS2782 is not set
+# CONFIG_BATTERY_SBS is not set
+# CONFIG_BATTERY_BQ27x00 is not set
+# CONFIG_BATTERY_MAX17040 is not set
+# CONFIG_BATTERY_MAX17042 is not set
+# CONFIG_CHARGER_ISP1704 is not set
+# CONFIG_CHARGER_MAX8903 is not set
+# CONFIG_CHARGER_LP8727 is not set
+# CONFIG_CHARGER_GPIO is not set
+# CONFIG_CHARGER_MANAGER is not set
+# CONFIG_BATTERY_MSM is not set
+# CONFIG_BATTERY_MSM8X60 is not set
+# CONFIG_ISL9519_CHARGER is not set
+# CONFIG_SMB137B_CHARGER is not set
+# CONFIG_SMB349_CHARGER is not set
+# CONFIG_BATTERY_BQ27520 is not set
+# CONFIG_BATTERY_BQ27541 is not set
+CONFIG_PM8921_CHARGER=y
+CONFIG_PM8XXX_CCADC=y
+# CONFIG_LTC4088_CHARGER is not set
+CONFIG_PM8921_BMS=y
+# CONFIG_BATTERY_BCL is not set
+# CONFIG_CHARGER_SMB347 is not set
+CONFIG_HWMON=y
+# CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
+# CONFIG_SENSORS_AD7314 is not set
+# CONFIG_SENSORS_AD7414 is not set
+# CONFIG_SENSORS_AD7418 is not set
+# CONFIG_SENSORS_ADCXX is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ADT7411 is not set
+# CONFIG_SENSORS_ADT7462 is not set
+# CONFIG_SENSORS_ADT7470 is not set
+# CONFIG_SENSORS_ADT7475 is not set
+# CONFIG_SENSORS_ASC7621 is not set
+# CONFIG_SENSORS_ATXP1 is not set
+# CONFIG_SENSORS_DS620 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_F75375S is not set
+# CONFIG_SENSORS_G760A is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_GL520SM is not set
+# CONFIG_SENSORS_GPIO_FAN is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_JC42 is not set
+# CONFIG_SENSORS_LINEAGE is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM70 is not set
+# CONFIG_SENSORS_LM73 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_LM92 is not set
+# CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_LTC4151 is not set
+# CONFIG_SENSORS_LTC4215 is not set
+# CONFIG_SENSORS_LTC4245 is not set
+# CONFIG_SENSORS_LTC4261 is not set
+# CONFIG_SENSORS_LM95241 is not set
+# CONFIG_SENSORS_LM95245 is not set
+# CONFIG_SENSORS_MAX1111 is not set
+# CONFIG_SENSORS_MAX16065 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX1668 is not set
+# CONFIG_SENSORS_MAX6639 is not set
+# CONFIG_SENSORS_MAX6642 is not set
+# CONFIG_SENSORS_MAX6650 is not set
+# CONFIG_SENSORS_MCP3021 is not set
+# CONFIG_SENSORS_NTC_THERMISTOR is not set
+CONFIG_SENSORS_PM8XXX_ADC=y
+# CONFIG_SENSORS_EPM_ADC is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_PMBUS is not set
+# CONFIG_SENSORS_SHT15 is not set
+# CONFIG_SENSORS_SHT21 is not set
+# CONFIG_SENSORS_SMM665 is not set
+# CONFIG_SENSORS_DME1737 is not set
+# CONFIG_SENSORS_EMC1403 is not set
+# CONFIG_SENSORS_EMC2103 is not set
+# CONFIG_SENSORS_EMC6W201 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47M192 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_SCH56XX_COMMON is not set
+# CONFIG_SENSORS_SCH5627 is not set
+# CONFIG_SENSORS_SCH5636 is not set
+# CONFIG_SENSORS_ADS1015 is not set
+# CONFIG_SENSORS_ADS7828 is not set
+# CONFIG_SENSORS_ADS7871 is not set
+# CONFIG_SENSORS_AMC6821 is not set
+# CONFIG_SENSORS_THMC50 is not set
+# CONFIG_SENSORS_TMP102 is not set
+# CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
+# CONFIG_SENSORS_VT1211 is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83791D is not set
+# CONFIG_SENSORS_W83792D is not set
+# CONFIG_SENSORS_W83793 is not set
+# CONFIG_SENSORS_W83795 is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83L786NG is not set
+# CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+CONFIG_THERMAL=y
+CONFIG_THERMAL_HWMON=y
+# CONFIG_THERMAL_MSM_POPMEM is not set
+# CONFIG_THERMAL_TSENS is not set
+CONFIG_THERMAL_TSENS8960=y
+# CONFIG_THERMAL_TSENS8974 is not set
+CONFIG_THERMAL_PM8XXX=y
+CONFIG_THERMAL_MONITOR=y
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+CONFIG_BCMA_POSSIBLE=y
+
+#
+# Broadcom specific AMBA
+#
+# CONFIG_BCMA is not set
+
+#
+# Multifunction device drivers
+#
+CONFIG_MFD_CORE=y
+# CONFIG_MFD_88PM860X is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_MFD_ASIC3 is not set
+# CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_HTC_I2CPLD is not set
+# CONFIG_TPS6105X is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_PMIC8058 is not set
+# CONFIG_PMIC8901 is not set
+# CONFIG_TPS6507X is not set
+# CONFIG_MFD_TPS65217 is not set
+# CONFIG_MFD_TPS6586X is not set
+# CONFIG_MFD_TPS65910 is not set
+# CONFIG_MFD_TPS65912_I2C is not set
+# CONFIG_MFD_TPS65912_SPI is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_TWL6040_CORE is not set
+# CONFIG_MFD_STMPE is not set
+# CONFIG_MFD_TC3589X is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_T7L66XB is not set
+# CONFIG_MFD_TC6387XB is not set
+# CONFIG_MFD_TC6393XB is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_DA9052_SPI is not set
+# CONFIG_MFD_DA9052_I2C is not set
+# CONFIG_PMIC_ADP5520 is not set
+# CONFIG_MFD_MAX8925 is not set
+# CONFIG_MFD_MAX8997 is not set
+# CONFIG_MFD_MAX8998 is not set
+# CONFIG_MFD_S5M_CORE is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X_I2C is not set
+# CONFIG_MFD_WM831X_SPI is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_WM8994 is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_MFD_MC13XXX is not set
+# CONFIG_ABX500_CORE is not set
+# CONFIG_EZX_PCAP is not set
+# CONFIG_MFD_WL1273_CORE is not set
+CONFIG_MFD_PM8XXX=y
+CONFIG_MFD_PM8921_CORE=y
+# CONFIG_MFD_PM8821_CORE is not set
+# CONFIG_MFD_PM8018_CORE is not set
+# CONFIG_MFD_PM8038_CORE is not set
+CONFIG_MFD_PM8XXX_IRQ=y
+# CONFIG_MFD_PM8821_IRQ is not set
+# CONFIG_MFD_TPS65090 is not set
+# CONFIG_MFD_AAT2870_CORE is not set
+CONFIG_MFD_PM8XXX_DEBUG=y
+CONFIG_MFD_PM8XXX_PWM=y
+CONFIG_MFD_PM8XXX_MISC=y
+CONFIG_MFD_PM8XXX_SPK=y
+CONFIG_MFD_PM8XXX_BATT_ALARM=y
+# CONFIG_WCD9304_CODEC is not set
+CONFIG_WCD9310_CODEC=y
+# CONFIG_WCD9320_CODEC is not set
+# CONFIG_MFD_RC5T583 is not set
+CONFIG_REGULATOR=y
+# CONFIG_REGULATOR_DEBUG is not set
+# CONFIG_REGULATOR_DUMMY is not set
+# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
+# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
+# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
+CONFIG_REGULATOR_GPIO=y
+# CONFIG_REGULATOR_AD5398 is not set
+# CONFIG_REGULATOR_ISL6271A is not set
+# CONFIG_REGULATOR_MAX1586 is not set
+# CONFIG_REGULATOR_MAX8649 is not set
+# CONFIG_REGULATOR_MAX8660 is not set
+# CONFIG_REGULATOR_MAX8952 is not set
+# CONFIG_REGULATOR_LP3971 is not set
+# CONFIG_REGULATOR_LP3972 is not set
+# CONFIG_REGULATOR_TPS62360 is not set
+# CONFIG_REGULATOR_TPS65023 is not set
+# CONFIG_REGULATOR_TPS6507X is not set
+# CONFIG_REGULATOR_TPS6524X is not set
+CONFIG_REGULATOR_PM8XXX=y
+# CONFIG_REGULATOR_MSM_GPIO is not set
+# CONFIG_REGULATOR_STUB is not set
+CONFIG_MEDIA_SUPPORT=y
+
+#
+# Multimedia core support
+#
+# CONFIG_MEDIA_CONTROLLER is not set
+CONFIG_VIDEO_DEV=y
+CONFIG_VIDEO_V4L2_COMMON=y
+# CONFIG_DVB_CORE is not set
+CONFIG_VIDEO_MEDIA=y
+
+#
+# Multimedia drivers
+#
+CONFIG_RC_CORE=y
+CONFIG_LIRC=y
+# CONFIG_USER_RC_INPUT is not set
+CONFIG_RC_MAP=y
+CONFIG_IR_NEC_DECODER=y
+CONFIG_IR_RC5_DECODER=y
+CONFIG_IR_RC6_DECODER=y
+CONFIG_IR_JVC_DECODER=y
+CONFIG_IR_SONY_DECODER=y
+CONFIG_IR_RC5_SZ_DECODER=y
+CONFIG_IR_SANYO_DECODER=y
+CONFIG_IR_MCE_KBD_DECODER=y
+CONFIG_IR_LIRC_CODEC=y
+# CONFIG_RC_ATI_REMOTE is not set
+# CONFIG_IR_IMON is not set
+# CONFIG_IR_MCEUSB is not set
+# CONFIG_IR_REDRAT3 is not set
+# CONFIG_IR_STREAMZAP is not set
+# CONFIG_RC_LOOPBACK is not set
+# CONFIG_IR_GPIO_CIR is not set
+# CONFIG_MEDIA_ATTACH is not set
+CONFIG_MEDIA_TUNER=y
+# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
+CONFIG_MEDIA_TUNER_SIMPLE=y
+CONFIG_MEDIA_TUNER_TDA8290=y
+CONFIG_MEDIA_TUNER_TDA827X=y
+CONFIG_MEDIA_TUNER_TDA18271=y
+CONFIG_MEDIA_TUNER_TDA9887=y
+CONFIG_MEDIA_TUNER_TEA5761=y
+CONFIG_MEDIA_TUNER_TEA5767=y
+CONFIG_MEDIA_TUNER_MT20XX=y
+CONFIG_MEDIA_TUNER_XC2028=y
+CONFIG_MEDIA_TUNER_XC5000=y
+CONFIG_MEDIA_TUNER_XC4000=y
+CONFIG_MEDIA_TUNER_MC44S803=y
+CONFIG_VIDEO_V4L2=y
+CONFIG_VIDEOBUF2_CORE=y
+CONFIG_VIDEOBUF2_MEMOPS=y
+CONFIG_VIDEOBUF2_DMA_CONTIG=y
+CONFIG_VIDEOBUF2_VMALLOC=y
+CONFIG_VIDEOBUF2_DMA_SG=y
+CONFIG_VIDEOBUF2_MSM_MEM=y
+CONFIG_VIDEO_CAPTURE_DRIVERS=y
+# CONFIG_VIDEO_ADV_DEBUG is not set
+# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
+CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
+CONFIG_VIDEO_IR_I2C=y
+
+#
+# Audio decoders, processors and mixers
+#
+
+#
+# RDS decoders
+#
+
+#
+# Video decoders
+#
+
+#
+# Video and audio decoders
+#
+
+#
+# MPEG video encoders
+#
+
+#
+# Video encoders
+#
+
+#
+# Camera sensor devices
+#
+
+#
+# Flash devices
+#
+
+#
+# Video improvement chips
+#
+
+#
+# Miscelaneous helper chips
+#
+# CONFIG_MSM_VCAP is not set
+# CONFIG_V4L_USB_DRIVERS is not set
+CONFIG_V4L_PLATFORM_DRIVERS=y
+# CONFIG_SOC_CAMERA is not set
+
+#
+# Qualcomm MSM Camera And Video
+#
+CONFIG_MSM_CAMERA=y
+# CONFIG_MSM_CAMERA_DEBUG is not set
+CONFIG_MSM_CAMERA_V4L2=y
+
+#
+# Camera Sensor Selection
+#
+# CONFIG_IMX074 is not set
+CONFIG_S5K3H2YX=y
+# CONFIG_S5K6A1GX is not set
+# CONFIG_AR0260 is not set
+# CONFIG_OV2722 is not set
+# CONFIG_OV5647 is not set
+# CONFIG_MT9M114 is not set
+# CONFIG_IMX074_ACT is not set
+CONFIG_S5K3H2YX_ACT=y
+# CONFIG_S5K4E1 is not set
+CONFIG_MSM_CAMERA_FLASH_SC628A=y
+# CONFIG_IMX072 is not set
+# CONFIG_OV2720 is not set
+CONFIG_MSM_CAMERA_FLASH=y
+CONFIG_MSM_CAMERA_SENSOR=y
+CONFIG_MSM_ACTUATOR=y
+CONFIG_MSM_GEMINI=y
+CONFIG_RAWCHIP=y
+CONFIG_QUP_EXCLUSIVE_TO_CAMERA=y
+# CONFIG_S5K3L1YX is not set
+# CONFIG_IMX091 is not set
+# CONFIG_IMX175 is not set
+# CONFIG_IMX135 is not set
+# CONFIG_OV8838 is not set
+# CONFIG_IMX175_ACT is not set
+# CONFIG_AD5823_ACT is not set
+# CONFIG_AD5816_ACT is not set
+# CONFIG_TI201_ACT is not set
+CONFIG_MT9V113=y
+# CONFIG_IMX175_2LANE is not set
+# CONFIG_OV5693_ACT is not set
+# CONFIG_OV5693 is not set
+# CONFIG_RAWCHIP_MCLK is not set
+# CONFIG_S5K6A2YA is not set
+# CONFIG_V4L_MEM2MEM_DRIVERS is not set
+# CONFIG_MSM_WFD is not set
+CONFIG_RADIO_ADAPTERS=y
+# CONFIG_RADIO_SI470X is not set
+# CONFIG_USB_MR800 is not set
+# CONFIG_USB_DSBR is not set
+# CONFIG_I2C_SI4713 is not set
+# CONFIG_RADIO_SI4713 is not set
+# CONFIG_USB_KEENE is not set
+# CONFIG_RADIO_TEA5764 is not set
+# CONFIG_RADIO_SAA7706H is not set
+# CONFIG_RADIO_TEF6862 is not set
+# CONFIG_RADIO_WL1273 is not set
+
+#
+# Texas Instruments WL128x FM driver (ST based)
+#
+# CONFIG_RADIO_WL128X is not set
+CONFIG_RADIO_IRIS=y
+CONFIG_RADIO_IRIS_TRANSPORT=m
+
+#
+# Graphics support
+#
+CONFIG_DRM=y
+CONFIG_DRM_USB=y
+CONFIG_DRM_KMS_HELPER=y
+# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
+
+#
+# I2C encoder or helper chips
+#
+# CONFIG_DRM_I2C_CH7006 is not set
+# CONFIG_DRM_I2C_SIL164 is not set
+CONFIG_DRM_UDL=y
+CONFIG_ION=y
+CONFIG_ION_MSM=y
+CONFIG_MSM_KGSL=y
+# CONFIG_MSM_KGSL_CFF_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_CP_STAT_NO_DETAIL is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_NO_IB_DUMP is not set
+# CONFIG_MSM_KGSL_PSTMRTMDMP_RB_HEX is not set
+CONFIG_MSM_KGSL_2D=y
+# CONFIG_MSM_KGSL_DRM is not set
+CONFIG_KGSL_PER_PROCESS_PAGE_TABLE=y
+CONFIG_MSM_KGSL_PAGE_TABLE_SIZE=0xFFF0000
+CONFIG_MSM_KGSL_PAGE_TABLE_COUNT=32
+CONFIG_MSM_KGSL_MMU_PAGE_FAULT=y
+# CONFIG_MSM_KGSL_DISABLE_SHADOW_WRITES is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+CONFIG_FB_SYS_FILLRECT=y
+CONFIG_FB_SYS_COPYAREA=y
+CONFIG_FB_SYS_IMAGEBLIT=y
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_WMT_GE_ROPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_S1D13XXX is not set
+# CONFIG_FB_TMIO is not set
+# CONFIG_FB_SMSCUFX is not set
+# CONFIG_FB_UDL is not set
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_FB_METRONOME is not set
+# CONFIG_FB_BROADSHEET is not set
+CONFIG_MSM_VIDC=y
+CONFIG_MSM_VIDC_1080P=y
+CONFIG_MSM_VIDC_VENC=y
+CONFIG_MSM_VIDC_VDEC=y
+# CONFIG_MSM_VIDC_CONTENT_PROTECTION is not set
+CONFIG_FB_MSM=y
+# CONFIG_FB_MSM_BACKLIGHT is not set
+# CONFIG_FB_MSM_LOGO is not set
+CONFIG_FB_MSM_LCDC_HW=y
+CONFIG_FB_MSM_TRIPLE_BUFFER=y
+CONFIG_FB_MSM_MDP_HW=y
+# CONFIG_FB_MSM_MDP22 is not set
+# CONFIG_FB_MSM_MDP30 is not set
+# CONFIG_FB_MSM_MDP31 is not set
+CONFIG_FB_MSM_MDP40=y
+# CONFIG_FB_MSM_MDSS is not set
+# CONFIG_FB_MSM_MDP_NONE is not set
+# CONFIG_FB_MSM_EBI2 is not set
+# CONFIG_FB_MSM_MDDI is not set
+CONFIG_FB_MSM_MIPI_DSI=y
+# CONFIG_FB_MSM_LCDC is not set
+# CONFIG_FB_MSM_LVDS is not set
+CONFIG_FB_MSM_OVERLAY=y
+CONFIG_FB_MSM_DTV=y
+# CONFIG_FB_MSM_EXTMDDI is not set
+# CONFIG_FB_MSM_TVOUT is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_COMMON is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_COMMON_VGA is not set
+# CONFIG_FB_MSM_MDDI_ORISE is not set
+# CONFIG_FB_MSM_MDDI_QUICKVX is not set
+# CONFIG_FB_MSM_MDDI_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_PANEL is not set
+# CONFIG_FB_MSM_MIPI_DSI_TOSHIBA is not set
+# CONFIG_FB_MSM_MIPI_DSI_LGIT is not set
+# CONFIG_FB_MSM_MIPI_DSI_RENESAS is not set
+# CONFIG_FB_MSM_MIPI_DSI_SIMULATOR is not set
+# CONFIG_FB_MSM_MIPI_DSI_NOVATEK is not set
+# CONFIG_FB_MSM_MIPI_DSI_ORISE is not set
+# CONFIG_FB_MSM_LCDC_ST15_WXGA is not set
+# CONFIG_FB_MSM_LCDC_ST15_PANEL is not set
+# CONFIG_FB_MSM_LCDC_PRISM_WVGA is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_WSVGA is not set
+# CONFIG_FB_MSM_LCDC_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_LCDC_GORDON_VGA is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_WVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_FWVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_SHARP_WVGA_PT is not set
+# CONFIG_FB_MSM_LCDC_AUO_WVGA is not set
+# CONFIG_FB_MSM_LCDC_TRULY_HVGA_IPS3P2335 is not set
+# CONFIG_FB_MSM_LCDC_TRULY_HVGA_IPS3P2335_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT is not set
+# CONFIG_FB_MSM_LCDC_NT35582_WVGA is not set
+# CONFIG_FB_MSM_LCDC_WXGA is not set
+# CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WXGA_PT is not set
+# CONFIG_FB_MSM_LVDS_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WSVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WUXGA is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_CMD_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_ORISE_VIDEO_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_ORISE_CMD_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_VIDEO_FWVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_CMD_FWVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35510_VIDEO_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35510_CMD_WVGA_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35516_VIDEO_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35516_CMD_QHD_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35590_CMD_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_NT35590_VIDEO_720P_PT is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WXGA is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WUXGA is not set
+# CONFIG_FB_MSM_MIPI_SIMULATOR_VIDEO is not set
+CONFIG_FB_MSM_NO_MDP_PIPE_CTRL=y
+CONFIG_FB_MSM_OVERLAY0_WRITEBACK=y
+CONFIG_FB_MSM_OVERLAY1_WRITEBACK=y
+CONFIG_FB_MSM_WRITEBACK_MSM_PANEL=y
+# CONFIG_FB_MSM_LCDC_PRISM_WVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_WSVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_GORDON_VGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_TOSHIBA_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SHARP_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_LCDC_AUO_WVGA_PANEL is not set
+# CONFIG_FB_MSM_LCDC_NT35582_PANEL is not set
+# CONFIG_FB_MSM_LCDC_SAMSUNG_OLED_PT_PANEL is not set
+# CONFIG_FB_MSM_LVDS_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_LVDS_FRC_FHD_PANEL is not set
+# CONFIG_FB_MSM_TRY_MDDI_CATCH_LCDC_PRISM is not set
+# CONFIG_FB_MSM_MIPI_PANEL_DETECT is not set
+# CONFIG_FB_MSM_MDDI_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LCDC_MIPI_PANEL_AUTO_DETECT is not set
+# CONFIG_FB_MSM_LVDS_MIPI_PANEL_DETECT is not set
+# CONFIG_FB_MSM_MDDI_PRISM_WVGA is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_WVGA_PORTRAIT is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_VGA is not set
+# CONFIG_FB_MSM_MDDI_TOSHIBA_WVGA is not set
+# CONFIG_FB_MSM_MDDI_SHARP_QVGA_128x128 is not set
+# CONFIG_FB_MSM_MIPI_LGIT_VIDEO_WXGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WSVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TOSHIBA_VIDEO_WUXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NOVATEK_CMD_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_ORISE_VIDEO_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_ORISE_CMD_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_VIDEO_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_RENESAS_CMD_FWVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_CHIMEI_WUXGA_PANEL is not set
+# CONFIG_FB_MSM_MIPI_TRULY_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35510_VIDEO_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35510_CMD_WVGA_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35516_VIDEO_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35516_CMD_QHD_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35590_CMD_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_NT35590_VIDEO_720P_PT_PANEL is not set
+# CONFIG_FB_MSM_MIPI_SIMULATOR_VIDEO_PANEL is not set
+# CONFIG_FB_MSM_EBI2_TMD_QVGA_EPSON_QCIF is not set
+# CONFIG_FB_MSM_HDMI_AS_PRIMARY is not set
+CONFIG_FB_MSM_PANEL_NONE=y
+CONFIG_FB_MSM_EXT_INTERFACE_COMMON=y
+CONFIG_FB_MSM_HDMI_COMMON=y
+CONFIG_FB_MSM_HDMI_3D=y
+# CONFIG_FB_MSM_HDMI_ADV7520_PANEL is not set
+CONFIG_FB_MSM_HDMI_MSM_PANEL=y
+# CONFIG_FB_MSM_HDMI_MSM_PANEL_DVI_SUPPORT is not set
+# CONFIG_FB_MSM_HDMI_MSM_PANEL_CEC_SUPPORT is not set
+# CONFIG_FB_MSM_HDMI_MHL_9244 is not set
+# CONFIG_FB_MSM_HDMI_MHL_8334 is not set
+# CONFIG_FB_MSM_TVOUT_NTSC_M is not set
+# CONFIG_FB_MSM_TVOUT_NTSC_J is not set
+# CONFIG_FB_MSM_TVOUT_PAL_BDGHIN is not set
+# CONFIG_FB_MSM_TVOUT_PAL_M is not set
+# CONFIG_FB_MSM_TVOUT_PAL_N is not set
+CONFIG_FB_MSM_TVOUT_NONE=y
+# CONFIG_FB_MSM_DEFAULT_DEPTH_RGB565 is not set
+# CONFIG_FB_MSM_DEFAULT_DEPTH_ARGB8888 is not set
+CONFIG_FB_MSM_DEFAULT_DEPTH_RGBA8888=y
+# CONFIG_FB_MSM_EBI2_EPSON_S1D_QVGA_PANEL is not set
+# CONFIG_FB_MSM_EBI2_PANEL_DETECT is not set
+# CONFIG_EXYNOS_VIDEO is not set
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_LCD_CLASS_DEVICE=y
+# CONFIG_LCD_L4F00242T03 is not set
+# CONFIG_LCD_LMS283GF05 is not set
+# CONFIG_LCD_LTV350QV is not set
+# CONFIG_LCD_TDO24M is not set
+# CONFIG_LCD_VGG2432A4 is not set
+# CONFIG_LCD_PLATFORM is not set
+# CONFIG_LCD_S6E63M0 is not set
+# CONFIG_LCD_LD9040 is not set
+# CONFIG_LCD_AMS369FG06 is not set
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_GENERIC=y
+# CONFIG_BACKLIGHT_ADP8860 is not set
+# CONFIG_BACKLIGHT_ADP8870 is not set
+# CONFIG_BACKLIGHT_LP855X is not set
+# CONFIG_BACKLIGHT_LM3530 is not set
+# CONFIG_BACKLIGHT_LM3533 is not set
+# CONFIG_LOGO is not set
+CONFIG_SOUND=y
+# CONFIG_SOUND_OSS_CORE is not set
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_HWDEP=y
+CONFIG_SND_RAWMIDI=y
+CONFIG_SND_JACK=y
+# CONFIG_SND_SEQUENCER is not set
+# CONFIG_SND_MIXER_OSS is not set
+# CONFIG_SND_PCM_OSS is not set
+# CONFIG_SND_HRTIMER is not set
+CONFIG_SND_DYNAMIC_MINORS=y
+CONFIG_SND_SUPPORT_OLD_API=y
+CONFIG_SND_VERBOSE_PROCFS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_DRIVERS=y
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_ALOOP is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+# CONFIG_SND_ARM is not set
+# CONFIG_SND_SPI is not set
+CONFIG_SND_USB=y
+CONFIG_SND_USB_AUDIO=y
+# CONFIG_SND_USB_UA101 is not set
+# CONFIG_SND_USB_CAIAQ is not set
+# CONFIG_SND_USB_6FIRE is not set
+CONFIG_SND_SOC=y
+
+#
+# MSM SoC Audio support
+#
+CONFIG_SND_SOC_MSM_HOSTLESS_PCM=y
+CONFIG_SND_SOC_MSM_QDSP6_HDMI_AUDIO=y
+CONFIG_SND_SOC_MSM_QDSP6_INTF=y
+# CONFIG_SND_SOC_MSM_QDSP6V2_INTF is not set
+CONFIG_SND_SOC_VOICE=y
+CONFIG_SND_SOC_QDSP6=y
+# CONFIG_SND_SOC_QDSP6V2 is not set
+CONFIG_SND_SOC_MSM8960=y
+# CONFIG_SND_SOC_DUAL_AMIC is not set
+CONFIG_SND_SOC_I2C_AND_SPI=y
+# CONFIG_SND_SOC_ALL_CODECS is not set
+CONFIG_SND_SOC_WCD9304=y
+CONFIG_SND_SOC_WCD9310=y
+CONFIG_SND_SOC_CS8427=y
+CONFIG_SND_SOC_MSM_STUB=y
+# CONFIG_SND_SOC_TPA2028D is not set
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_BATTERY_STRENGTH is not set
+# CONFIG_HIDRAW is not set
+# CONFIG_UHID is not set
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+# CONFIG_USB_HIDDEV is not set
+
+#
+# Special HID drivers
+#
+# CONFIG_HID_A4TECH is not set
+# CONFIG_HID_ACRUX is not set
+CONFIG_HID_APPLE=y
+# CONFIG_HID_BELKIN is not set
+# CONFIG_HID_CHERRY is not set
+# CONFIG_HID_CHICONY is not set
+# CONFIG_HID_PRODIKEYS is not set
+# CONFIG_HID_CYPRESS is not set
+CONFIG_HID_DRAGONRISE=y
+# CONFIG_DRAGONRISE_FF is not set
+# CONFIG_HID_EMS_FF is not set
+# CONFIG_HID_ELECOM is not set
+# CONFIG_HID_EZKEY is not set
+# CONFIG_HID_HOLTEK is not set
+# CONFIG_HID_KEYTOUCH is not set
+# CONFIG_HID_KYE is not set
+# CONFIG_HID_UCLOGIC is not set
+# CONFIG_HID_WALTOP is not set
+# CONFIG_HID_GYRATION is not set
+# CONFIG_HID_TWINHAN is not set
+# CONFIG_HID_KENSINGTON is not set
+# CONFIG_HID_LCPOWER is not set
+CONFIG_HID_LOGITECH=y
+CONFIG_HID_LOGITECH_DJ=y
+# CONFIG_LOGITECH_FF is not set
+# CONFIG_LOGIRUMBLEPAD2_FF is not set
+# CONFIG_LOGIG940_FF is not set
+# CONFIG_LOGIWHEELS_FF is not set
+CONFIG_HID_MAGICMOUSE=y
+CONFIG_HID_MICROSOFT=y
+# CONFIG_HID_MONTEREY is not set
+# CONFIG_HID_MULTITOUCH is not set
+# CONFIG_HID_NTRIG is not set
+# CONFIG_HID_ORTEK is not set
+CONFIG_HID_PANTHERLORD=y
+# CONFIG_PANTHERLORD_FF is not set
+# CONFIG_HID_PETALYNX is not set
+# CONFIG_HID_PICOLCD is not set
+# CONFIG_HID_PRIMAX is not set
+# CONFIG_HID_ROCCAT is not set
+# CONFIG_HID_SAITEK is not set
+# CONFIG_HID_SAMSUNG is not set
+CONFIG_HID_SONY=y
+# CONFIG_HID_SPEEDLINK is not set
+# CONFIG_HID_SUNPLUS is not set
+CONFIG_HID_GREENASIA=y
+# CONFIG_GREENASIA_FF is not set
+# CONFIG_HID_SMARTJOYPLUS is not set
+# CONFIG_HID_TIVO is not set
+# CONFIG_HID_TOPSEED is not set
+CONFIG_HID_THRUSTMASTER=y
+# CONFIG_THRUSTMASTER_FF is not set
+# CONFIG_HID_WACOM is not set
+# CONFIG_HID_WIIMOTE is not set
+CONFIG_HID_ZEROPLUS=y
+# CONFIG_ZEROPLUS_FF is not set
+# CONFIG_HID_ZYDACRON is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+CONFIG_USB_ARCH_HAS_EHCI=y
+# CONFIG_USB_ARCH_HAS_XHCI is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_COMMON=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+
+#
+# Miscellaneous USB options
+#
+# CONFIG_USB_DEVICEFS is not set
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+CONFIG_USB_SUSPEND=y
+CONFIG_USB_OTG=y
+CONFIG_USB_OTG_WHITELIST=y
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+# CONFIG_USB_DWC3 is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_EHSET=y
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
+# CONFIG_USB_EHCI_TT_NEWSCHED is not set
+CONFIG_USB_EHCI_MSM=y
+# CONFIG_USB_EHCI_MSM_HSIC is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
+# CONFIG_USB_EHCI_HCD_PLATFORM is not set
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_PEHCI_HCD is not set
+# CONFIG_USB_MUSB_HDRC is not set
+
+#
+# USB Device Class drivers
+#
+CONFIG_USB_ACM=y
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+
+#
+# also be needed; see USB_STORAGE Help for more info
+#
+CONFIG_USB_STORAGE=y
+CONFIG_USB_STORAGE_DEBUG=y
+# CONFIG_USB_STORAGE_REALTEK is not set
+CONFIG_USB_STORAGE_DATAFAB=y
+CONFIG_USB_STORAGE_FREECOM=y
+CONFIG_USB_STORAGE_ISD200=y
+CONFIG_USB_STORAGE_USBAT=y
+CONFIG_USB_STORAGE_SDDR09=y
+CONFIG_USB_STORAGE_SDDR55=y
+CONFIG_USB_STORAGE_JUMPSHOT=y
+CONFIG_USB_STORAGE_ALAUDA=y
+CONFIG_USB_STORAGE_ONETOUCH=y
+CONFIG_USB_STORAGE_KARMA=y
+CONFIG_USB_STORAGE_CYPRESS_ATACB=y
+# CONFIG_USB_STORAGE_ENE_UB6250 is not set
+# CONFIG_USB_UAS is not set
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+CONFIG_USB_EHSET_TEST_FIXTURE=y
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_YUREX is not set
+# CONFIG_USB_QCOM_DIAG_BRIDGE is not set
+# CONFIG_USB_QCOM_MDM_BRIDGE is not set
+# CONFIG_USB_QCOM_KS_BRIDGE is not set
+CONFIG_USB_GADGET=y
+# CONFIG_USB_GADGET_DEBUG is not set
+CONFIG_USB_GADGET_DEBUG_FILES=y
+# CONFIG_USB_GADGET_DEBUG_FS is not set
+CONFIG_USB_GADGET_VBUS_DRAW=500
+CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
+
+#
+# USB Peripheral Controller
+#
+# CONFIG_USB_FUSB300 is not set
+# CONFIG_USB_R8A66597 is not set
+# CONFIG_USB_MV_UDC is not set
+# CONFIG_USB_M66592 is not set
+# CONFIG_USB_NET2272 is not set
+CONFIG_USB_CI13XXX_MSM=y
+# CONFIG_USB_CI13XXX_MSM_HSIC is not set
+# CONFIG_USB_DWC3_MSM is not set
+# CONFIG_USB_MSM_72K is not set
+# CONFIG_USB_DUMMY_HCD is not set
+CONFIG_USB_GADGET_DUALSPEED=y
+# CONFIG_USB_GADGET_SUPERSPEED is not set
+# CONFIG_USB_ZERO is not set
+# CONFIG_USB_AUDIO is not set
+# CONFIG_USB_ETH is not set
+# CONFIG_USB_G_NCM is not set
+# CONFIG_USB_GADGETFS is not set
+# CONFIG_USB_FUNCTIONFS is not set
+# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_MASS_STORAGE is not set
+# CONFIG_USB_G_SERIAL is not set
+# CONFIG_USB_MIDI_GADGET is not set
+# CONFIG_USB_G_PRINTER is not set
+CONFIG_USB_G_ANDROID=y
+# CONFIG_USB_CDC_COMPOSITE is not set
+# CONFIG_USB_G_ACM_MS is not set
+# CONFIG_USB_G_MULTI is not set
+# CONFIG_USB_G_HID is not set
+# CONFIG_USB_G_DBGP is not set
+# CONFIG_USB_G_WEBCAM is not set
+CONFIG_USB_CSW_HACK=y
+# CONFIG_USB_MSC_PROFILING is not set
+# CONFIG_MODEM_SUPPORT is not set
+CONFIG_RMNET_SMD_CTL_CHANNEL=""
+CONFIG_RMNET_SMD_DATA_CHANNEL=""
+CONFIG_USB_ANDROID_RMNET_CTRL_SMD=y
+# CONFIG_USB_ANDROID_CDC_ECM is not set
+
+#
+# OTG and related infrastructure
+#
+CONFIG_USB_OTG_UTILS=y
+# CONFIG_USB_OTG_WAKELOCK is not set
+# CONFIG_USB_GPIO_VBUS is not set
+# CONFIG_USB_ULPI is not set
+# CONFIG_USB_MSM_OTG_72K is not set
+# CONFIG_NOP_USB_XCEIV is not set
+CONFIG_USB_MSM_OTG=y
+# CONFIG_USB_MSM_ACA is not set
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+CONFIG_MMC_PERF_PROFILING=y
+CONFIG_MMC_UNSAFE_RESUME=y
+# CONFIG_MMC_CLKGATE is not set
+# CONFIG_MMC_EMBEDDED_SDIO is not set
+CONFIG_MMC_PARANOID_SD_INIT=y
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_MINORS=64
+CONFIG_MMC_BLOCK_BOUNCE=y
+# CONFIG_MMC_BLOCK_DEFERRED_RESUME is not set
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+# CONFIG_MMC_SDHCI is not set
+# CONFIG_MMC_SDHCI_PXAV3 is not set
+# CONFIG_MMC_SDHCI_PXAV2 is not set
+CONFIG_MMC_MSM=y
+CONFIG_MMC_MSM_SDC1_SUPPORT=y
+CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT=y
+# CONFIG_MMC_MSM_SDC2_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC3_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC3_POLLING is not set
+# CONFIG_MMC_MSM_SDC4_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC5_SUPPORT is not set
+CONFIG_MMC_MSM_SPS_SUPPORT=y
+# CONFIG_MMC_DW is not set
+# CONFIG_MMC_VUB300 is not set
+# CONFIG_MMC_USHC is not set
+# CONFIG_MEMSTICK is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_LM3530 is not set
+# CONFIG_LEDS_PCA9532 is not set
+# CONFIG_LEDS_GPIO is not set
+# CONFIG_LEDS_MSM_PDM is not set
+# CONFIG_LEDS_PMIC_MPP is not set
+# CONFIG_LEDS_MSM_TRICOLOR is not set
+# CONFIG_LEDS_LP3944 is not set
+# CONFIG_LEDS_CPLD is not set
+# CONFIG_LEDS_LP5521 is not set
+# CONFIG_LEDS_LP5523 is not set
+# CONFIG_LEDS_PCA955X is not set
+CONFIG_LEDS_PM8XXX=y
+# CONFIG_LEDS_PCA9633 is not set
+# CONFIG_LEDS_DAC124S085 is not set
+# CONFIG_LEDS_REGULATOR is not set
+# CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_MSM_PMIC is not set
+# CONFIG_LEDS_LT3593 is not set
+# CONFIG_LEDS_RENESAS_TPU is not set
+# CONFIG_LEDS_TCA6507 is not set
+# CONFIG_LEDS_OT200 is not set
+# CONFIG_LEDS_TRIGGERS is not set
+
+#
+# LED Triggers
+#
+
+#
+# LED Flashlights
+#
+CONFIG_FLASHLIGHT_TPS61310=y
+CONFIG_SWITCH=y
+# CONFIG_SWITCH_GPIO is not set
+# CONFIG_SWITCH_FSA8008 is not set
+# CONFIG_ACCESSIBILITY is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+CONFIG_RTC_INTF_ALARM=y
+CONFIG_RTC_INTF_ALARM_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# I2C RTC drivers
+#
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_DS3232 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_ISL12022 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_BQ32K is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
+# CONFIG_RTC_DRV_EM3027 is not set
+# CONFIG_RTC_DRV_RV3029C2 is not set
+
+#
+# SPI RTC drivers
+#
+# CONFIG_RTC_DRV_M41T93 is not set
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
+# CONFIG_RTC_DRV_MAX6902 is not set
+# CONFIG_RTC_DRV_R9701 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_DS3234 is not set
+# CONFIG_RTC_DRV_PCF2123 is not set
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_MSM6242 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_RP5C01 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# on-CPU RTC drivers
+#
+# CONFIG_RTC_DRV_MSM is not set
+# CONFIG_RTC_DRV_MSM7X00A is not set
+CONFIG_RTC_DRV_PM8XXX=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+
+#
+# Virtio drivers
+#
+# CONFIG_VIRTIO_BALLOON is not set
+# CONFIG_VIRTIO_MMIO is not set
+
+#
+# Microsoft Hyper-V guest support
+#
+CONFIG_STAGING=y
+# CONFIG_USBIP_CORE is not set
+# CONFIG_PRISM2_USB is not set
+# CONFIG_ECHO is not set
+# CONFIG_ASUS_OLED is not set
+# CONFIG_RTLLIB is not set
+# CONFIG_R8712U is not set
+# CONFIG_RTS5139 is not set
+# CONFIG_TRANZPORT is not set
+# CONFIG_LINE6_USB is not set
+# CONFIG_VT6656 is not set
+# CONFIG_IIO is not set
+CONFIG_QCACHE=y
+# CONFIG_FB_SM7XX is not set
+# CONFIG_USB_ENESTORAGE is not set
+# CONFIG_BCM_WIMAX is not set
+# CONFIG_FT1000 is not set
+
+#
+# Speakup console speech
+#
+# CONFIG_TOUCHSCREEN_CLEARPAD_TM1217 is not set
+# CONFIG_STAGING_MEDIA is not set
+
+#
+# Android
+#
+CONFIG_ANDROID=y
+CONFIG_ANDROID_BINDER_IPC=y
+CONFIG_ANDROID_LOGGER=y
+CONFIG_ANDROID_PERSISTENT_RAM=y
+CONFIG_ANDROID_RAM_CONSOLE=y
+CONFIG_ANDROID_RAM_CONSOLE_ENABLE_VERBOSE=y
+CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION=y
+CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_DATA_SIZE=128
+CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_ECC_SIZE=16
+CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE=8
+CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_POLYNOMIAL=0x11d
+# CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT is not set
+# CONFIG_PERSISTENT_TRACER is not set
+CONFIG_ANDROID_TIMED_OUTPUT=y
+CONFIG_ANDROID_TIMED_GPIO=y
+CONFIG_ANDROID_LOW_MEMORY_KILLER=y
+CONFIG_ANDROID_LOW_MEMORY_KILLER_AUTODETECT_OOM_ADJ_VALUES=y
+# CONFIG_ANDROID_SWITCH is not set
+# CONFIG_ANDROID_INTF_ALARM_DEV is not set
+# CONFIG_PHONE is not set
+# CONFIG_USB_WPAN_HCD is not set
+
+#
+# Qualcomm Atheros Prima WLAN module
+#
+CONFIG_PRIMA_WLAN=m
+# CONFIG_PRIMA_WLAN_BTAMP is not set
+CONFIG_HTC_WIFI_NVS=y
+
+#
+# Qualcomm MSM specific device drivers
+#
+CONFIG_MSM_SSBI=y
+CONFIG_SPS=y
+# CONFIG_USB_BAM is not set
+CONFIG_SPS_SUPPORT_BAMDMA=y
+# CONFIG_SPS_SUPPORT_NDP_BAM is not set
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_HAVE_CLK_PREPARE=y
+
+#
+# Hardware Spinlock drivers
+#
+CONFIG_IOMMU_SUPPORT=y
+CONFIG_MSM_IOMMU=y
+CONFIG_MSM_IOMMU_GPU_SYNC=y
+CONFIG_IOMMU_PGTABLES_L2=y
+
+#
+# Remoteproc drivers (EXPERIMENTAL)
+#
+
+#
+# Rpmsg drivers (EXPERIMENTAL)
+#
+# CONFIG_VIRT_DRIVERS is not set
+# CONFIG_PM_DEVFREQ is not set
+# CONFIG_MOBICORE_SUPPORT is not set
+# CONFIG_CORESIGHT is not set
+
+#
+# File systems
+#
+# CONFIG_EXT2_FS is not set
+# CONFIG_EXT3_FS is not set
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_USE_FOR_EXT23=y
+CONFIG_EXT4_FS_XATTR=y
+# CONFIG_EXT4_FS_POSIX_ACL is not set
+# CONFIG_EXT4_FS_SECURITY is not set
+# CONFIG_EXT4_DEBUG is not set
+CONFIG_JBD2=y
+# CONFIG_JBD2_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FS_POSIX_ACL=y
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_FANOTIFY is not set
+# CONFIG_QUOTA is not set
+# CONFIG_QUOTACTL is not set
+# CONFIG_AUTOFS4_FS is not set
+CONFIG_FUSE_FS=y
+# CONFIG_CUSE is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+# CONFIG_MSDOS_FS is not set
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_ECRYPT_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_LOGFS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_QNX6FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_PSTORE is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+CONFIG_NFS_V3_ACL=y
+CONFIG_NFS_V4=y
+# CONFIG_NFS_V4_1 is not set
+# CONFIG_ROOT_NFS is not set
+# CONFIG_NFS_USE_LEGACY_DNS is not set
+CONFIG_NFS_USE_KERNEL_DNS=y
+# CONFIG_NFSD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_ACL_SUPPORT=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+CONFIG_SUNRPC_GSS=y
+# CONFIG_SUNRPC_DEBUG is not set
+# CONFIG_CEPH_FS is not set
+CONFIG_CIFS=y
+# CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_UPCALL is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_DFS_UPCALL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+CONFIG_NLS_ASCII=y
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_UTF8 is not set
+
+#
+# Kernel hacking
+#
+CONFIG_PRINTK_TIME=y
+CONFIG_DEFAULT_MESSAGE_LOGLEVEL=1
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_SECTION_MISMATCH=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+# CONFIG_LOCKUP_DETECTOR is not set
+# CONFIG_HARDLOCKUP_DETECTOR is not set
+# CONFIG_DETECT_HUNG_TASK is not set
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+CONFIG_TIMER_STATS=y
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
+CONFIG_DEBUG_KMEMLEAK=y
+CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
+# CONFIG_DEBUG_KMEMLEAK_TEST is not set
+CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
+# CONFIG_DEBUG_PREEMPT is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_SPARSE_RCU_POINTER is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_ATOMIC_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+CONFIG_STACKTRACE=y
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_HIGHMEM is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_INFO_REDUCED is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+CONFIG_DEBUG_MEMORY_INIT=y
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_TEST_LIST_SORT is not set
+# CONFIG_DEBUG_SG is not set
+CONFIG_DEBUG_NOTIFIERS=y
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+CONFIG_RCU_CPU_STALL_TIMEOUT=60
+CONFIG_RCU_CPU_STALL_VERBOSE=y
+# CONFIG_RCU_CPU_STALL_INFO is not set
+# CONFIG_RCU_TRACE is not set
+# CONFIG_KPROBES_SANITY_TEST is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_DEBUG_PER_CPU_MAPS is not set
+# CONFIG_LKDTM is not set
+# CONFIG_CPU_NOTIFIER_ERROR_INJECT is not set
+CONFIG_FAULT_INJECTION=y
+CONFIG_FAILSLAB=y
+CONFIG_FAIL_PAGE_ALLOC=y
+# CONFIG_FAIL_MAKE_REQUEST is not set
+# CONFIG_FAIL_IO_TIMEOUT is not set
+# CONFIG_FAIL_MMC_REQUEST is not set
+CONFIG_FAULT_INJECTION_DEBUG_FS=y
+CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
+# CONFIG_DEBUG_PAGEALLOC is not set
+CONFIG_NOP_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_RING_BUFFER=y
+CONFIG_EVENT_TRACING=y
+CONFIG_EVENT_POWER_TRACING_DEPRECATED=y
+CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_RING_BUFFER_ALLOW_SWAP=y
+CONFIG_TRACING=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_PREEMPT_TRACER is not set
+# CONFIG_SCHED_TRACER is not set
+CONFIG_ENABLE_DEFAULT_TRACERS=y
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_KPROBE_EVENT=y
+# CONFIG_CPU_FREQ_SWITCH_PROFILER is not set
+# CONFIG_RING_BUFFER_BENCHMARK is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+# CONFIG_DMA_API_DEBUG is not set
+# CONFIG_ATOMIC64_SELFTEST is not set
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_TEST_KSTRTOX is not set
+# CONFIG_STRICT_DEVMEM is not set
+CONFIG_ARM_UNWIND=y
+CONFIG_DEBUG_USER=y
+# CONFIG_DEBUG_RODATA is not set
+# CONFIG_DEBUG_LL is not set
+# CONFIG_ARM_KPROBES_TEST is not set
+# CONFIG_PID_IN_CONTEXTIDR is not set
+
+#
+# Security options
+#
+CONFIG_KEYS=y
+# CONFIG_ENCRYPTED_KEYS is not set
+# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
+# CONFIG_SECURITY_DMESG_RESTRICT is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+CONFIG_DEFAULT_SECURITY_DAC=y
+CONFIG_DEFAULT_SECURITY=""
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP2=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+# CONFIG_CRYPTO_USER is not set
+CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_PCRYPT is not set
+CONFIG_CRYPTO_WORKQUEUE=y
+# CONFIG_CRYPTO_CRYPTD is not set
+CONFIG_CRYPTO_AUTHENC=y
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+CONFIG_CRYPTO_CBC=y
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=y
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+CONFIG_CRYPTO_HMAC=y
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_GHASH is not set
+CONFIG_CRYPTO_MD4=y
+CONFIG_CRYPTO_MD5=y
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+CONFIG_CRYPTO_SHA1=y
+CONFIG_CRYPTO_SHA256=y
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+CONFIG_CRYPTO_AES=y
+# CONFIG_CRYPTO_ANUBIS is not set
+CONFIG_CRYPTO_ARC4=y
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+CONFIG_CRYPTO_TWOFISH=y
+CONFIG_CRYPTO_TWOFISH_COMMON=y
+
+#
+# Compression
+#
+CONFIG_CRYPTO_DEFLATE=y
+# CONFIG_CRYPTO_ZLIB is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+CONFIG_CRYPTO_ANSI_CPRNG=y
+# CONFIG_CRYPTO_USER_API_HASH is not set
+# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
+CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_DEV_QCE40=y
+CONFIG_CRYPTO_DEV_QCRYPTO=m
+CONFIG_CRYPTO_DEV_QCE=m
+CONFIG_CRYPTO_DEV_QCEDEV=m
+# CONFIG_CRYPTO_DEV_OTA_CRYPTO is not set
+CONFIG_BINARY_PRINTF=y
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_IO=y
+CONFIG_CRC_CCITT=y
+CONFIG_CRC16=y
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC32_SELFTEST is not set
+CONFIG_CRC32_SLICEBY8=y
+# CONFIG_CRC32_SLICEBY4 is not set
+# CONFIG_CRC32_SARWATE is not set
+# CONFIG_CRC32_BIT is not set
+# CONFIG_CRC7 is not set
+CONFIG_LIBCRC32C=y
+# CONFIG_CRC8 is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+CONFIG_LZO_COMPRESS=y
+CONFIG_LZO_DECOMPRESS=y
+# CONFIG_XZ_DEC is not set
+# CONFIG_XZ_DEC_BCJ is not set
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_DECOMPRESS_BZIP2=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_GENERIC_ALLOCATOR=y
+CONFIG_REED_SOLOMON=y
+CONFIG_REED_SOLOMON_ENC8=y
+CONFIG_REED_SOLOMON_DEC8=y
+CONFIG_TEXTSEARCH=y
+CONFIG_TEXTSEARCH_KMP=y
+CONFIG_TEXTSEARCH_BM=y
+CONFIG_TEXTSEARCH_FSM=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_CPU_RMAP=y
+CONFIG_DQL=y
+CONFIG_NLATTR=y
+# CONFIG_AVERAGE is not set
+# CONFIG_CORDIC is not set
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index d021905..31fd8cc 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -237,7 +237,9 @@
 static inline void
 vivt_flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
 {
-	if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm)))
+	struct mm_struct *mm = vma->vm_mm;
+
+	if (!mm || cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm)))
 		__cpuc_flush_user_range(start & PAGE_MASK, PAGE_ALIGN(end),
 					vma->vm_flags);
 }
@@ -245,7 +247,9 @@
 static inline void
 vivt_flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn)
 {
-	if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) {
+	struct mm_struct *mm = vma->vm_mm;
+
+	if (!mm || cpumask_test_cpu(smp_processor_id(), mm_cpumask(mm))) {
 		unsigned long addr = user_addr & PAGE_MASK;
 		__cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
 	}
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index d1f9709..fb4d8c4 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -18,6 +18,11 @@
 
 #define COMMAND_LINE_SIZE 1024
 
+#ifdef CONFIG_MACH_HTC
+/* information about the system we're running on */
+extern unsigned int system_rev;
+#endif
+
 /* The list ends with an ATAG_NONE node. */
 #define ATAG_NONE	0x00000000
 
@@ -143,6 +148,14 @@
 	__u32 fmemclk;
 };
 
+#ifdef CONFIG_MACH_HTC
+#define ATAG_ALS	0x5441001b
+
+struct tag_als_kadc {
+	__u32 kadc;
+};
+#endif
+
 struct tag {
 	struct tag_header hdr;
 	union {
@@ -155,6 +168,9 @@
 		struct tag_revision	revision;
 		struct tag_videolfb	videolfb;
 		struct tag_cmdline	cmdline;
+#ifdef CONFIG_MACH_HTC
+		struct tag_als_kadc als_kadc;
+#endif
 
 		/*
 		 * Acorn specific
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 7a8c2d6..9665b3e 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -244,6 +244,19 @@
 	b	1b
 #endif
 
+__und_fault:
+	@ Correct the PC such that it is pointing at the instruction
+	@ which caused the fault.  If the faulting instruction was ARM
+	@ the PC will be pointing at the next instruction, and have to
+	@ subtract 4.  Otherwise, it is Thumb, and the PC will be
+	@ pointing at the second half of the Thumb instruction.  We
+	@ have to subtract 2.
+	ldr	r2, [r0, #S_PC]
+	sub	r2, r2, r1
+	str	r2, [r0, #S_PC]
+	b	do_undefinstr
+ENDPROC(__und_fault)
+
 	.align	5
 __und_svc:
 #ifdef CONFIG_KPROBES
@@ -261,25 +274,32 @@
 	@
 	@  r0 - instruction
 	@
-#ifndef	CONFIG_THUMB2_KERNEL
+#ifndef CONFIG_THUMB2_KERNEL
 	ldr	r0, [r4, #-4]
 #else
+	mov	r1, #2
 	ldrh	r0, [r4, #-2]			@ Thumb instruction at LR - 2
 	cmp	r0, #0xe800			@ 32-bit instruction if xx >= 0
-	ldrhhs	r9, [r4]			@ bottom 16 bits
-	orrhs	r0, r9, r0, lsl #16
+	blo	__und_svc_fault
+	ldrh	r9, [r4]			@ bottom 16 bits
+	add	r4, r4, #2
+	str	r4, [sp, #S_PC]
+	orr	r0, r9, r0, lsl #16
 #endif
-	adr	r9, BSYM(1f)
+	adr	r9, BSYM(__und_svc_finish)
 	mov	r2, r4
 	bl	call_fpe
 
+	mov	r1, #4				@ PC correction to apply
+__und_svc_fault:
 	mov	r0, sp				@ struct pt_regs *regs
-	bl	do_undefinstr
+	bl	__und_fault
 
 	@
 	@ IRQs off again before pulling preserved data off the stack
 	@
-1:	disable_irq_notrace
+__und_svc_finish:
+	disable_irq_notrace
 
 	@
 	@ restore SPSR and restart the instruction
@@ -423,25 +443,33 @@
 	mov	r2, r4
 	mov	r3, r5
 
+	@ r2 = regs->ARM_pc, which is either 2 or 4 bytes ahead of the
+	@      faulting instruction depending on Thumb mode.
+	@ r3 = regs->ARM_cpsr
 	@
-	@ fall through to the emulation code, which returns using r9 if
-	@ it has emulated the instruction, or the more conventional lr
-	@ if we are to treat this as a real undefined instruction
-	@
-	@  r0 - instruction
+	@ The emulation code returns using r9 if it has emulated the
+	@ instruction, or the more conventional lr if we are to treat
+	@ this as a real undefined instruction
 	@
 	adr	r9, BSYM(ret_from_exception)
-	adr	lr, BSYM(__und_usr_unknown)
+
 	tst	r3, #PSR_T_BIT			@ Thumb mode?
-	itet	eq				@ explicit IT needed for the 1f label
-	subeq	r4, r2, #4			@ ARM instr at LR - 4
-	subne	r4, r2, #2			@ Thumb instr at LR - 2
-1:	ldreqt	r0, [r4]
+	bne	__und_usr_thumb
+	sub	r4, r2, #4			@ ARM instr at LR - 4
+1:	ldrt	r0, [r4]
 #ifdef CONFIG_CPU_ENDIAN_BE8
-	reveq	r0, r0				@ little endian instruction
+	rev	r0, r0				@ little endian instruction
 #endif
-	beq	call_fpe
+	@ r0 = 32-bit ARM instruction which caused the exception
+	@ r2 = PC value for the following instruction (:= regs->ARM_pc)
+	@ r4 = PC value for the faulting instruction
+	@ lr = 32-bit undefined instruction function
+	adr	lr, BSYM(__und_usr_fault_32)
+	b	call_fpe
+
+__und_usr_thumb:
 	@ Thumb instruction
+	sub	r4, r2, #2			@ First half of thumb instr at LR - 2
 #if CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7
 /*
  * Thumb-2 instruction handling.  Note that because pre-v6 and >= v6 platforms
@@ -455,7 +483,7 @@
 	ldr	r5, .LCcpu_architecture
 	ldr	r5, [r5]
 	cmp	r5, #CPU_ARCH_ARMv7
-	blo	__und_usr_unknown
+	blo	__und_usr_fault_16		@ 16bit undefined instruction
 /*
  * The following code won't get run unless the running CPU really is v7, so
  * coding round the lack of ldrht on older arches is pointless.  Temporarily
@@ -463,15 +491,18 @@
  */
 	.arch	armv6t2
 #endif
-2:
- ARM(	ldrht	r5, [r4], #2	)
- THUMB(	ldrht	r5, [r4]	)
- THUMB(	add	r4, r4, #2	)
+2:	ldrht	r5, [r4]
 	cmp	r5, #0xe800			@ 32bit instruction if xx != 0
-	blo	__und_usr_unknown
-3:	ldrht	r0, [r4]
+	blo	__und_usr_fault_16		@ 16bit undefined instruction
+3:	ldrht	r0, [r2]
 	add	r2, r2, #2			@ r2 is PC + 2, make it PC + 4
+	str	r2, [sp, #S_PC]			@ it's a 2x16bit instr, update
 	orr	r0, r0, r5, lsl #16
+	adr	lr, BSYM(__und_usr_fault_32)
+	@ r0 = the two 16-bit Thumb instructions which caused the exception
+	@ r2 = PC value for the following Thumb instruction (:= regs->ARM_pc)
+	@ r4 = PC value for the first 16-bit Thumb instruction
+	@ lr = 32bit undefined instruction function
 
 #if __LINUX_ARM_ARCH__ < 7
 /* If the target arch was overridden, change it back: */
@@ -482,17 +513,13 @@
 #endif
 #endif /* __LINUX_ARM_ARCH__ < 7 */
 #else /* !(CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7) */
-	b	__und_usr_unknown
+	b	__und_usr_fault_16
 #endif
- UNWIND(.fnend		)
+ UNWIND(.fnend)
 ENDPROC(__und_usr)
 
-	@
-	@ fallthrough to call_fpe
-	@
-
 /*
- * The out of line fixup for the ldrt above.
+ * The out of line fixup for the ldrt instructions above.
  */
 	.pushsection .fixup, "ax"
 4:	mov	pc, r9
@@ -523,11 +550,12 @@
  * NEON handler code.
  *
  * Emulators may wish to make use of the following registers:
- *  r0  = instruction opcode.
- *  r2  = PC+4
+ *  r0  = instruction opcode (32-bit ARM or two 16-bit Thumb)
+ *  r2  = PC value to resume execution after successful emulation
  *  r9  = normal "successful" return address
- *  r10 = this threads thread_info structure.
+ *  r10 = this threads thread_info structure
  *  lr  = unrecognised instruction return address
+ * IRQs disabled, FIQs enabled.
  */
 	@
 	@ Fall-through from Thumb-2 __und_usr
@@ -662,12 +690,17 @@
 	mov	pc, lr
 ENDPROC(no_fp)
 
-__und_usr_unknown:
-	enable_irq
+__und_usr_fault_32:
+	mov	r1, #4
+	b	1f
+__und_usr_fault_16:
+	mov	r1, #2
+1:	enable_irq
 	mov	r0, sp
 	adr	lr, BSYM(ret_from_exception)
-	b	do_undefinstr
-ENDPROC(__und_usr_unknown)
+	b	__und_fault
+ENDPROC(__und_usr_fault_32)
+ENDPROC(__und_usr_fault_16)
 
 	.align	5
 __pabt_usr:
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 55c683a..ddcb787 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -317,6 +317,7 @@
 void machine_halt(void)
 {
 	machine_shutdown();
+	local_irq_disable();
 	while (1);
 }
 
@@ -342,6 +343,7 @@
 
 	/* Whoops - the platform was unable to reboot. Tell the user! */
 	printk("Reboot failed -- System halted\n");
+	local_irq_disable();
 	while (1);
 }
 
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index d68d1b6..eb3a291 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -642,7 +642,7 @@
 		}
 	}
 
-	if (try_to_freeze())
+	if (try_to_freeze_nowarn())
 		goto no_signal;
 
 	/*
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 12e6fcb..75c9369 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -399,18 +399,10 @@
 
 asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
 {
-	unsigned int correction = thumb_mode(regs) ? 2 : 4;
 	unsigned int instr;
 	siginfo_t info;
 	void __user *pc;
 
-	/*
-	 * According to the ARM ARM, PC is 2 or 4 bytes ahead,
-	 * depending whether we're in Thumb mode or not.
-	 * Correct this offset.
-	 */
-	regs->ARM_pc -= correction;
-
 	pc = (void __user *)instruction_pointer(regs);
 
 	if (processor_mode(regs) == SVC_MODE) {
diff --git a/arch/arm/mach-dove/include/mach/bridge-regs.h b/arch/arm/mach-dove/include/mach/bridge-regs.h
index 226949d..f953bb5 100644
--- a/arch/arm/mach-dove/include/mach/bridge-regs.h
+++ b/arch/arm/mach-dove/include/mach/bridge-regs.h
@@ -50,5 +50,6 @@
 #define POWER_MANAGEMENT	(BRIDGE_VIRT_BASE | 0x011c)
 
 #define TIMER_VIRT_BASE		(BRIDGE_VIRT_BASE | 0x0300)
+#define TIMER_PHYS_BASE         (BRIDGE_PHYS_BASE | 0x0300)
 
 #endif
diff --git a/arch/arm/mach-dove/include/mach/dove.h b/arch/arm/mach-dove/include/mach/dove.h
index ad1165d..d52b0ef 100644
--- a/arch/arm/mach-dove/include/mach/dove.h
+++ b/arch/arm/mach-dove/include/mach/dove.h
@@ -78,6 +78,7 @@
 
 /* North-South Bridge */
 #define BRIDGE_VIRT_BASE	(DOVE_SB_REGS_VIRT_BASE | 0x20000)
+#define BRIDGE_PHYS_BASE	(DOVE_SB_REGS_PHYS_BASE | 0x20000)
 
 /* Cryptographic Engine */
 #define DOVE_CRYPT_PHYS_BASE	(DOVE_SB_REGS_PHYS_BASE | 0x30000)
diff --git a/arch/arm/mach-imx/crm-regs-imx5.h b/arch/arm/mach-imx/crm-regs-imx5.h
index 5e11ba7..5e3f1f0 100644
--- a/arch/arm/mach-imx/crm-regs-imx5.h
+++ b/arch/arm/mach-imx/crm-regs-imx5.h
@@ -23,7 +23,7 @@
 #define MX53_DPLL1_BASE		MX53_IO_ADDRESS(MX53_PLL1_BASE_ADDR)
 #define MX53_DPLL2_BASE		MX53_IO_ADDRESS(MX53_PLL2_BASE_ADDR)
 #define MX53_DPLL3_BASE		MX53_IO_ADDRESS(MX53_PLL3_BASE_ADDR)
-#define MX53_DPLL4_BASE		MX53_IO_ADDRESS(MX53_PLL3_BASE_ADDR)
+#define MX53_DPLL4_BASE		MX53_IO_ADDRESS(MX53_PLL4_BASE_ADDR)
 
 /* PLL Register Offsets */
 #define MXC_PLL_DP_CTL			0x00
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index 89493ab..20ed2d5 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -12,6 +12,7 @@
 
 #include <linux/errno.h>
 #include <asm/cacheflush.h>
+#include <asm/cp15.h>
 #include <mach/common.h>
 
 int platform_cpu_kill(unsigned int cpu)
@@ -19,6 +20,44 @@
 	return 1;
 }
 
+static inline void cpu_enter_lowpower(void)
+{
+	unsigned int v;
+
+	flush_cache_all();
+	asm volatile(
+		"mcr	p15, 0, %1, c7, c5, 0\n"
+	"	mcr	p15, 0, %1, c7, c10, 4\n"
+	/*
+	 * Turn off coherency
+	 */
+	"	mrc	p15, 0, %0, c1, c0, 1\n"
+	"	bic	%0, %0, %3\n"
+	"	mcr	p15, 0, %0, c1, c0, 1\n"
+	"	mrc	p15, 0, %0, c1, c0, 0\n"
+	"	bic	%0, %0, %2\n"
+	"	mcr	p15, 0, %0, c1, c0, 0\n"
+	  : "=&r" (v)
+	  : "r" (0), "Ir" (CR_C), "Ir" (0x40)
+	  : "cc");
+}
+
+static inline void cpu_leave_lowpower(void)
+{
+	unsigned int v;
+
+	asm volatile(
+		"mrc	p15, 0, %0, c1, c0, 0\n"
+	"	orr	%0, %0, %1\n"
+	"	mcr	p15, 0, %0, c1, c0, 0\n"
+	"	mrc	p15, 0, %0, c1, c0, 1\n"
+	"	orr	%0, %0, %2\n"
+	"	mcr	p15, 0, %0, c1, c0, 1\n"
+	  : "=&r" (v)
+	  : "Ir" (CR_C), "Ir" (0x40)
+	  : "cc");
+}
+
 /*
  * platform-specific code to shutdown a CPU
  *
@@ -26,9 +65,10 @@
  */
 void platform_cpu_die(unsigned int cpu)
 {
-	flush_cache_all();
+	cpu_enter_lowpower();
 	imx_enable_cpu(cpu, false);
 	cpu_do_idle();
+	cpu_leave_lowpower();
 
 	/* We should never return from idle */
 	panic("cpu %d unexpectedly exit from shutdown\n", cpu);
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
index e432d4a..4460d25 100644
--- a/arch/arm/mach-imx/mach-mx21ads.c
+++ b/arch/arm/mach-imx/mach-mx21ads.c
@@ -32,7 +32,7 @@
  * Memory-mapped I/O on MX21ADS base board
  */
 #define MX21ADS_MMIO_BASE_ADDR   0xf5000000
-#define MX21ADS_MMIO_SIZE        SZ_16M
+#define MX21ADS_MMIO_SIZE        0xc00000
 
 #define MX21ADS_REG_ADDR(offset)    (void __force __iomem *) \
 		(MX21ADS_MMIO_BASE_ADDR + (offset))
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index ebbd7fc..a9f8094 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -28,6 +28,7 @@
 #include <linux/clockchips.h>
 #include <linux/io.h>
 #include <linux/export.h>
+#include <linux/gpio.h>
 
 #include <mach/udc.h>
 #include <mach/hardware.h>
@@ -107,7 +108,7 @@
 	 7,  8,  9, 10, 11, 12, -1, -1,
 };
 
-int gpio_to_irq(int gpio)
+static int ixp4xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
 {
 	int irq;
 
@@ -117,7 +118,6 @@
 	}
 	return -EINVAL;
 }
-EXPORT_SYMBOL(gpio_to_irq);
 
 int irq_to_gpio(unsigned int irq)
 {
@@ -383,12 +383,56 @@
 unsigned long ixp4xx_exp_bus_size;
 EXPORT_SYMBOL(ixp4xx_exp_bus_size);
 
+static int ixp4xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
+{
+	gpio_line_config(gpio, IXP4XX_GPIO_IN);
+
+	return 0;
+}
+
+static int ixp4xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
+					int level)
+{
+	gpio_line_set(gpio, level);
+	gpio_line_config(gpio, IXP4XX_GPIO_OUT);
+
+	return 0;
+}
+
+static int ixp4xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
+{
+	int value;
+
+	gpio_line_get(gpio, &value);
+
+	return value;
+}
+
+static void ixp4xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio,
+				  int value)
+{
+	gpio_line_set(gpio, value);
+}
+
+static struct gpio_chip ixp4xx_gpio_chip = {
+	.label			= "IXP4XX_GPIO_CHIP",
+	.direction_input	= ixp4xx_gpio_direction_input,
+	.direction_output	= ixp4xx_gpio_direction_output,
+	.get			= ixp4xx_gpio_get_value,
+	.set			= ixp4xx_gpio_set_value,
+	.to_irq			= ixp4xx_gpio_to_irq,
+	.base			= 0,
+	.ngpio			= 16,
+};
+
 void __init ixp4xx_sys_init(void)
 {
 	ixp4xx_exp_bus_size = SZ_16M;
 
 	platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices));
 
+	gpiochip_add(&ixp4xx_gpio_chip);
+
 	if (cpu_is_ixp46x()) {
 		int region;
 
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h
index 83d6b4e..ef37f26 100644
--- a/arch/arm/mach-ixp4xx/include/mach/gpio.h
+++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h
@@ -1,79 +1,2 @@
-/*
- * arch/arm/mach-ixp4xx/include/mach/gpio.h
- *
- * IXP4XX GPIO wrappers for arch-neutral GPIO calls
- *
- * Written by Milan Svoboda <msvoboda@ra.rockwell.com>
- * Based on PXA implementation by Philipp Zabel <philipp.zabel@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#ifndef __ASM_ARCH_IXP4XX_GPIO_H
-#define __ASM_ARCH_IXP4XX_GPIO_H
-
-#include <linux/kernel.h>
-#include <mach/hardware.h>
-
-#define __ARM_GPIOLIB_COMPLEX
-
-static inline int gpio_request(unsigned gpio, const char *label)
-{
-	return 0;
-}
-
-static inline void gpio_free(unsigned gpio)
-{
-	might_sleep();
-
-	return;
-}
-
-static inline int gpio_direction_input(unsigned gpio)
-{
-	gpio_line_config(gpio, IXP4XX_GPIO_IN);
-	return 0;
-}
-
-static inline int gpio_direction_output(unsigned gpio, int level)
-{
-	gpio_line_set(gpio, level);
-	gpio_line_config(gpio, IXP4XX_GPIO_OUT);
-	return 0;
-}
-
-static inline int gpio_get_value(unsigned gpio)
-{
-	int value;
-
-	gpio_line_get(gpio, &value);
-
-	return value;
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-	gpio_line_set(gpio, value);
-}
-
-#include <asm-generic/gpio.h>			/* cansleep wrappers */
-
-extern int gpio_to_irq(int gpio);
-#define gpio_to_irq gpio_to_irq
-extern int irq_to_gpio(unsigned int irq);
-
-#endif
+/* empty */
 
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
index 957bd79..086f25e 100644
--- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
+++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
@@ -38,6 +38,7 @@
 #define IRQ_MASK_HIGH_OFF	0x0014
 
 #define TIMER_VIRT_BASE		(BRIDGE_VIRT_BASE | 0x0300)
+#define TIMER_PHYS_BASE		(BRIDGE_PHYS_BASE | 0x0300)
 
 #define L2_CONFIG_REG		(BRIDGE_VIRT_BASE | 0x0128)
 #define L2_WRITETHROUGH		0x00000010
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
index fede3d5..c5b6851 100644
--- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
+++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
@@ -80,6 +80,7 @@
 #define  UART1_VIRT_BASE	(DEV_BUS_VIRT_BASE | 0x2100)
 
 #define BRIDGE_VIRT_BASE	(KIRKWOOD_REGS_VIRT_BASE | 0x20000)
+#define BRIDGE_PHYS_BASE	(KIRKWOOD_REGS_PHYS_BASE | 0x20000)
 
 #define CRYPTO_PHYS_BASE	(KIRKWOOD_REGS_PHYS_BASE | 0x30000)
 
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index ec0336b..44472ea 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -135,6 +135,7 @@
 	select MSM_PM8X60 if PM
 	select MSM_RUN_QUEUE_STATS
 	select ARM_HAS_SG_CHAIN
+	select ARM_ERRATA_720789
 
 config ARCH_MSM8960
 	bool "MSM8960"
@@ -170,7 +171,7 @@
 	select MSM_RUN_QUEUE_STATS
 	select ARM_HAS_SG_CHAIN
 	select MSM_KRAIT_WFE_FIXUP
-	select MSM_IOMMU_GPU_SYNC
+	select MSM_IOMMU_GPU_SYNC if MSM_IOMMU
 	select MSM_CPU_PWRCTL
 
 config ARCH_MSM8930
@@ -204,7 +205,7 @@
 	select HOLES_IN_ZONE if SPARSEMEM
 	select ARM_HAS_SG_CHAIN
 	select MSM_KRAIT_WFE_FIXUP
-	select MSM_IOMMU_GPU_SYNC
+	select MSM_IOMMU_GPU_SYNC if MSM_IOMMU
 	select MSM_CPU_PWRCTL
 
 config ARCH_APQ8064
@@ -233,7 +234,7 @@
 	select ARCH_SUPPORTS_MSI
 	select ARM_HAS_SG_CHAIN
 	select MSM_KRAIT_WFE_FIXUP
-	select MSM_IOMMU_GPU_SYNC
+	select MSM_IOMMU_GPU_SYNC if MSM_IOMMU
 	select MSM_CPU_PWRCTL
 
 config ARCH_MSM8974
@@ -913,6 +914,8 @@
 
 source "arch/arm/mach-msm/lge/Kconfig"
 
+source "arch/arm/mach-msm/htc/Kconfig"
+
 config MSM_STACKED_MEMORY
 	bool "Stacked Memory"
 	default y
@@ -925,7 +928,8 @@
 	hex
 	default "0x40800000" if ARCH_MSM9615
 	default "0x80200000" if ARCH_APQ8064
-	default "0x80200000" if ARCH_MSM8960
+	default "0x80400000" if ARCH_MSM8960 && MACH_HTC
+	default "0x80200000" if ARCH_MSM8960 && !MACH_HTC
 	default "0x80200000" if ARCH_MSM8930
 	default "0x00000000" if ARCH_MSM8974
 	default "0x00000000" if ARCH_MPQ8092
@@ -1955,6 +1959,12 @@
 	  Riva is the wireless subsystem processor used in bluetooth, wireless
 	  LAN, and FM software applications.
 
+config MSM_INSECURE_PIL_RIVA
+	bool "Force Riva PIL to insecure mode"
+	depends on MSM_PIL_RIVA
+	help
+	  Force Riva PIL to use non-secure boot.
+
 config MSM_PIL_TZAPPS
 	tristate "TZApps Boot Support"
 	depends on MSM_PIL
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 7ad142b..6bf6958 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -307,6 +307,8 @@
 
 obj-$(CONFIG_MACH_LGE) += lge/
 
+obj-$(CONFIG_MACH_HTC) += htc/
+
 CFLAGS_msm_vibrator.o += -Idrivers/staging/android
 CFLAGS_board-9615.o += -Idrivers/usb/gadget
 
diff --git a/arch/arm/mach-msm/Makefile.boot b/arch/arm/mach-msm/Makefile.boot
index b57d4e1..bcf7f3b 100644
--- a/arch/arm/mach-msm/Makefile.boot
+++ b/arch/arm/mach-msm/Makefile.boot
@@ -37,7 +37,11 @@
    zreladdr-$(CONFIG_ARCH_MSM8X60)	:= 0x40208000
 
 # MSM8960
+ifeq ($(CONFIG_MACH_HTC),y)
+   zreladdr-$(CONFIG_ARCH_MSM8960)	:= 0x80408000
+else
    zreladdr-$(CONFIG_ARCH_MSM8960)	:= 0x80208000
+endif
 
 # MSM8930
    zreladdr-$(CONFIG_ARCH_MSM8930)	:= 0x80208000
diff --git a/arch/arm/mach-msm/clock-8960.c b/arch/arm/mach-msm/clock-8960.c
index 34407e3..61fd0cd 100755
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -5691,14 +5691,15 @@
 	CLK_LOOKUP("core_clk",		gsbi11_uart_clk.c,	""),
 	CLK_LOOKUP("core_clk",		gsbi12_uart_clk.c,	""),
 	CLK_LOOKUP("core_clk",		gsbi1_qup_clk.c,	"spi_qsd.0"),
-	CLK_LOOKUP("core_clk",		gsbi2_qup_clk.c,	""),
+	CLK_LOOKUP("core_clk",		gsbi2_qup_clk.c,	"qup_i2c.2"),
 	CLK_LOOKUP("core_clk",		gsbi3_qup_clk.c,	"qup_i2c.3"),
 	CLK_LOOKUP("core_clk",		gsbi4_qup_clk.c,	"qup_i2c.4"),
-	CLK_LOOKUP("core_clk",		gsbi5_qup_clk.c,	""),
+	CLK_LOOKUP("core_clk",		gsbi5_qup_clk.c,	"qup_i2c.5"),
 	CLK_LOOKUP("core_clk",		gsbi6_qup_clk.c,	""),
 	CLK_LOOKUP("core_clk",		gsbi7_qup_clk.c,	""),
-	CLK_LOOKUP("core_clk",		gsbi8_qup_clk.c,	""),
-	CLK_LOOKUP("core_clk",		gsbi9_qup_clk.c,	""),
+	CLK_LOOKUP("core_clk",		gsbi8_qup_clk.c,	"qup_i2c.8"),
+	CLK_LOOKUP("core_clk",		gsbi9_qup_clk.c,	"qup_i2c.9"),
+	CLK_LOOKUP("core_clk",		gsbi10_qup_clk.c,	"spi_qsd.1"),
 	CLK_LOOKUP("core_clk",		gsbi10_qup_clk.c,	"qup_i2c.10"),
 	CLK_LOOKUP("core_clk",		gsbi11_qup_clk.c,	""),
 	CLK_LOOKUP("core_clk",		gsbi12_qup_clk.c,	"qup_i2c.12"),
@@ -5731,17 +5732,20 @@
 	CLK_LOOKUP("core_clk",		ce1_core_clk.c,		"qcrypto.0"),
 	CLK_LOOKUP("dma_bam_pclk",	dma_bam_p_clk.c,	NULL),
 	CLK_LOOKUP("iface_clk",		gsbi1_p_clk.c,		"spi_qsd.0"),
-	CLK_LOOKUP("iface_clk",		gsbi2_p_clk.c,		""),
+	CLK_LOOKUP("iface_clk",		gsbi2_p_clk.c,		"qup_i2c.2"),
 	CLK_LOOKUP("iface_clk",		gsbi3_p_clk.c,		"qup_i2c.3"),
 	CLK_LOOKUP("iface_clk",		gsbi4_p_clk.c,		"qup_i2c.4"),
-	CLK_LOOKUP("iface_clk",		gsbi5_p_clk.c,	"msm_serial_hsl.0"),
+	CLK_LOOKUP("iface_clk",		gsbi5_p_clk.c,	"qup_i2c.5"),
 	CLK_LOOKUP("iface_clk",		gsbi6_p_clk.c,  "msm_serial_hs.0"),
 	CLK_LOOKUP("iface_clk",		gsbi7_p_clk.c,		""),
 	/* used on 8960 SGLTE for serial console */
 	CLK_LOOKUP("iface_clk",		gsbi8_p_clk.c,	"msm_serial_hsl.1"),
 	/* used on 8960 standalone with Atheros Bluetooth */
+	CLK_LOOKUP("iface_clk",		gsbi8_p_clk.c,  "qup_i2c.8"),
 	CLK_LOOKUP("iface_clk",		gsbi8_p_clk.c,	"msm_serial_hs.2"),
+	CLK_LOOKUP("iface_clk",		gsbi9_p_clk.c,  "qup_i2c.9"),
 	CLK_LOOKUP("iface_clk",		gsbi9_p_clk.c,  "msm_serial_hs.1"),
+	CLK_LOOKUP("iface_clk",		gsbi10_p_clk.c,		"spi_qsd.1"),
 	CLK_LOOKUP("iface_clk",		gsbi10_p_clk.c,		"qup_i2c.10"),
 	CLK_LOOKUP("iface_clk",		gsbi11_p_clk.c,		""),
 	CLK_LOOKUP("iface_clk",		gsbi12_p_clk.c,		"qup_i2c.12"),
@@ -5769,6 +5773,8 @@
 	CLK_LOOKUP("cam_clk",		cam2_clk.c,		NULL),
 	CLK_LOOKUP("cam_clk",		cam0_clk.c,	"4-0020"),
 	CLK_LOOKUP("cam_clk",		cam0_clk.c,	"4-0034"),
+	CLK_LOOKUP("cam_clk",		cam1_clk.c,	"4-0036"),
+	CLK_LOOKUP("cam_clk",		cam1_clk.c,	"4-003c"),
 	CLK_LOOKUP("csi_src_clk",	csi0_src_clk.c,		"msm_csid.0"),
 	CLK_LOOKUP("csi_src_clk",	csi1_src_clk.c,		"msm_csid.1"),
 	CLK_LOOKUP("csi_src_clk",	csi2_src_clk.c,		"msm_csid.2"),
diff --git a/arch/arm/mach-msm/devices-8960.c b/arch/arm/mach-msm/devices-8960.c
index 968a25e..daa4f0f 100644
--- a/arch/arm/mach-msm/devices-8960.c
+++ b/arch/arm/mach-msm/devices-8960.c
@@ -38,6 +38,7 @@
 #include <mach/clk-provider.h>
 #include <sound/msm-dai-q6.h>
 #include <sound/apr_audio.h>
+#include <asm/mach/flash.h>
 #include <mach/msm_tsif.h>
 #include <mach/msm_serial_hs_lite.h>
 #include "clock.h"
@@ -111,6 +112,13 @@
 #define MSM8960_PC_CNTR_PHYS	(MSM8960_IMEM_PHYS + 0x664)
 #define MSM8960_PC_CNTR_SIZE		0x40
 
+#ifdef CONFIG_MACH_HTC
+struct flash_platform_data msm_nand_data = {
+	.parts		= NULL,
+	.nr_parts	= 0,
+};
+#endif
+
 static struct resource msm8960_resources_pccntr[] = {
 	{
 		.start	= MSM8960_PC_CNTR_PHYS,
@@ -1784,6 +1792,34 @@
 	return platform_device_register(pdev);
 }
 
+static struct resource resources_qup_i2c_gsbi2[] = {
+	{
+		.name	= "gsbi_qup_i2c_addr",
+		.start	= MSM_GSBI2_PHYS,
+		.end	= MSM_GSBI2_PHYS + MSM_QUP_SIZE - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "qup_phys_addr",
+		.start	= MSM_GSBI2_QUP_PHYS,
+		.end	= MSM_GSBI2_QUP_PHYS + 4 - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "qup_err_intr",
+		.start	= MSM8960_GSBI2_QUP_IRQ,
+		.end	= MSM8960_GSBI2_QUP_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device msm8960_device_qup_i2c_gsbi2 = {
+	.name		= "qup_i2c",
+	.id		= 2,
+	.num_resources	= ARRAY_SIZE(resources_qup_i2c_gsbi2),
+	.resource	= resources_qup_i2c_gsbi2,
+};
+
 static struct resource resources_qup_i2c_gsbi4[] = {
 	{
 		.name	= "gsbi_qup_i2c_addr",
@@ -1868,6 +1904,34 @@
 	.resource	= resources_qup_i2c_gsbi3,
 };
 
+static struct resource resources_qup_i2c_gsbi5[] = {
+	{
+		.name	= "gsbi_qup_i2c_addr",
+		.start	= MSM_GSBI5_PHYS,
+		.end	= MSM_GSBI5_PHYS + MSM_QUP_SIZE - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "qup_phys_addr",
+		.start	= MSM_GSBI5_QUP_PHYS,
+		.end	= MSM_GSBI5_QUP_PHYS + 4 - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "qup_err_intr",
+		.start	= GSBI5_QUP_IRQ,
+		.end	= GSBI5_QUP_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+struct platform_device msm8960_device_qup_i2c_gsbi5 = {
+	.name		= "qup_i2c",
+	.id		= 5,
+	.num_resources	= ARRAY_SIZE(resources_qup_i2c_gsbi5),
+	.resource	= resources_qup_i2c_gsbi5,
+};
+
 static struct resource resources_qup_i2c_gsbi9[] = {
 	{
 		.name	= "gsbi_qup_i2c_addr",
@@ -1943,6 +2007,20 @@
 		.end	= GSBI12_QUP_IRQ,
 		.flags	= IORESOURCE_IRQ,
 	},
+#ifdef CONFIG_MACH_HTC
+	{
+		.name	= "i2c_sda",
+		.start	= 44,
+		.end	= 44,
+		.flags	= IORESOURCE_IO,
+	},
+	{
+		.name	= "i2c_clk",
+		.start	= 45,
+		.end	= 45,
+		.flags	= IORESOURCE_IO,
+	},
+#endif
 };
 
 struct platform_device msm8960_device_qup_i2c_gsbi12 = {
@@ -2352,6 +2430,61 @@
 	.resource	= resources_qup_spi_gsbi1,
 };
 
+static struct resource resources_qup_spi_gsbi10[] = {
+	{
+		.name	= "spi_base",
+		.start	= MSM_GSBI10_QUP_PHYS,
+		.end	= MSM_GSBI10_QUP_PHYS + SZ_4K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "gsbi_base",
+		.start	= MSM_GSBI10_PHYS,
+		.end	= MSM_GSBI10_PHYS + 4 - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "spi_irq_in",
+		.start	= GSBI10_QUP_IRQ,
+		.end	= GSBI10_QUP_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	},
+#if 0 /* move gpio config to board file */
+	{
+		.name   = "spi_clk",
+		.start  = 74,
+		.end    = 74,
+		.flags  = IORESOURCE_IO,
+	},
+	{
+		.name   = "spi_cs",
+		.start  = 73,
+		.end    = 73,
+		.flags  = IORESOURCE_IO,
+	},
+	{
+		.name   = "spi_miso",
+		.start  = 72,
+		.end    = 72,
+		.flags  = IORESOURCE_IO,
+	},
+	{
+		.name   = "spi_mosi",
+		.start  = 71,
+		.end    = 71,
+		.flags  = IORESOURCE_IO,
+	},
+#endif
+};
+
+/* Use GSBI10 QUP for SPI-1 */
+struct platform_device msm8960_device_qup_spi_gsbi10 = {
+	.name		= "spi_qsd",
+	.id		= 1,
+	.num_resources	= ARRAY_SIZE(resources_qup_spi_gsbi10),
+	.resource	= resources_qup_spi_gsbi10,
+};
+
 struct platform_device msm_pcm = {
 	.name	= "msm-pcm-dsp",
 	.id	= -1,
@@ -4317,6 +4450,26 @@
 struct msm_iommu_domain_name msm8960_iommu_ctx_names[] = {
 	/* Camera */
 	{
+		.name = "vpe_src",
+		.domain = CAMERA_DOMAIN,
+	},
+	/* Camera */
+	{
+		.name = "vpe_dst",
+		.domain = CAMERA_DOMAIN,
+	},
+	/* Camera */
+	{
+		.name = "vfe_imgwr",
+		.domain = CAMERA_DOMAIN,
+	},
+	/* Camera */
+	{
+		.name = "vfe_misc",
+		.domain = CAMERA_DOMAIN,
+	},
+	/* Camera */
+	{
 		.name = "ijpeg_src",
 		.domain = CAMERA_DOMAIN,
 	},
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h
index 5eb71ee..5e52c84 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -63,13 +63,16 @@
 extern struct platform_device msm8930_device_uart_gsbi10;
 extern struct platform_device msm8930_device_uart_gsbi11;
 extern struct platform_device msm8960_device_ssbi_pmic;
+extern struct platform_device msm8960_device_qup_i2c_gsbi2;
 extern struct platform_device msm8960_device_qup_i2c_gsbi3;
 extern struct platform_device msm8960_device_qup_i2c_gsbi4;
+extern struct platform_device msm8960_device_qup_i2c_gsbi5;
 extern struct platform_device msm8960_device_qup_i2c_gsbi8;
 extern struct platform_device msm8960_device_qup_i2c_gsbi9;
 extern struct platform_device msm8960_device_qup_i2c_gsbi10;
 extern struct platform_device msm8960_device_qup_i2c_gsbi12;
 extern struct platform_device msm8960_device_qup_spi_gsbi1;
+extern struct platform_device msm8960_device_qup_spi_gsbi10;
 extern struct platform_device msm8960_gemini_device;
 extern struct platform_device msm8960_mercury_device;
 extern struct platform_device msm8960_device_i2c_mux_gsbi4;
diff --git a/arch/arm/mach-msm/htc/Kconfig b/arch/arm/mach-msm/htc/Kconfig
new file mode 100644
index 0000000..94d546e
--- /dev/null
+++ b/arch/arm/mach-msm/htc/Kconfig
@@ -0,0 +1,42 @@
+config MACH_HTC
+	bool
+	select FB_MSM_MIPI_DSI
+
+menu "HTC Board Selection"
+source "arch/arm/mach-msm/htc/Kconfig.board"
+endmenu
+
+
+menu "HTC Specific Patches"
+
+config HTC_BATT_CORE
+	depends on POWER_SUPPLY
+	default n
+	bool "HTC battery core driver"
+
+config HTC_BATT_8960
+	depends on HTC_BATT_CORE
+	default n
+	bool "HTC battery driver for MSM8960"
+
+config HTC_HEADSET_MGR
+	tristate "HTC headset manager driver"
+	default n
+	help
+	  Provides support for HTC headset manager.
+
+config HTC_HEADSET_PMIC
+	tristate "HTC PMIC headset detection driver"
+	depends on HTC_HEADSET_MGR
+	default n
+	help
+	  Provides support for HTC PMIC headset detection.
+
+config HTC_HEADSET_ONE_WIRE
+	tristate "HTC 1-wire headset detection driver"
+	depends on HTC_HEADSET_MGR
+	default n
+	help
+	  Provides support for HTC 1-wire headset detection.
+
+endmenu
diff --git a/arch/arm/mach-msm/htc/Kconfig.board b/arch/arm/mach-msm/htc/Kconfig.board
new file mode 100644
index 0000000..dc2260b
--- /dev/null
+++ b/arch/arm/mach-msm/htc/Kconfig.board
@@ -0,0 +1,18 @@
+#
+# Include the specific Kconfig file for HTC board
+#
+
+# ELITE
+source "arch/arm/mach-msm/htc/elite/Kconfig"
+
+# FIGHTER
+source "arch/arm/mach-msm/htc/fighter/Kconfig"
+
+# JET
+source "arch/arm/mach-msm/htc/jet/Kconfig"
+
+# VILLE
+source "arch/arm/mach-msm/htc/ville/Kconfig"
+
+config MACH_HTC_DUMMY
+	bool "NONE (No device)"
diff --git a/arch/arm/mach-msm/htc/Makefile b/arch/arm/mach-msm/htc/Makefile
new file mode 100644
index 0000000..a74ba79
--- /dev/null
+++ b/arch/arm/mach-msm/htc/Makefile
@@ -0,0 +1,24 @@
+subdir-ccflags-$(CONFIG_ARCH_MSM) += -Iarch/arm/mach-msm
+
+-include $(src)/Makefile.board
+
+obj-y += devices_htc.o
+obj-y += radio_feedback.o
+obj-y += htc_port_list.o
+obj-y += htc_bdaddress.o
+obj-y += htc_ramdump.o
+obj-y += htc_awb_cal.o
+obj-y += htc_wifi_nvs.o
+obj-y += htc_sysinfo.o
+obj-y += emmc_partitions.o
+obj-y += htc_acoustic_8960.o
+
+obj-$(CONFIG_HTC_BATT_CORE) += htc_battery_core.o
+obj-$(CONFIG_HTC_BATT_8960) += htc_battery_8960.o htc_battery_cell.o
+obj-$(CONFIG_MSM_NATIVE_RESTART) += htc_restart_handler.o
+
+obj-$(CONFIG_HTC_HEADSET_MGR) += htc_headset_mgr.o
+obj-$(CONFIG_HTC_HEADSET_PMIC) += htc_headset_pmic.o
+obj-$(CONFIG_HTC_HEADSET_ONE_WIRE) += htc_headset_one_wire.o
+
+CFLAGS_devices_htc.o += -Idrivers/staging/android
diff --git a/arch/arm/mach-msm/htc/Makefile.board b/arch/arm/mach-msm/htc/Makefile.board
new file mode 100644
index 0000000..560196f
--- /dev/null
+++ b/arch/arm/mach-msm/htc/Makefile.board
@@ -0,0 +1,15 @@
+#
+# Makefile for the HTC board
+#
+
+# ELITE
+obj-$(CONFIG_MACH_ELITE) += elite/
+
+# FIGHTER
+obj-$(CONFIG_MACH_FIGHTER) += fighter/
+
+# JET
+obj-$(CONFIG_MACH_JET) += jet/
+
+# VILLE
+obj-$(CONFIG_MACH_VILLE) += ville/
diff --git a/arch/arm/mach-msm/htc/devices_htc.c b/arch/arm/mach-msm/htc/devices_htc.c
new file mode 100644
index 0000000..a45f696
--- /dev/null
+++ b/arch/arm/mach-msm/htc/devices_htc.c
@@ -0,0 +1,542 @@
+/* linux/arch/arm/mach-msm/devices.c
+ *
+ * Copyright (C) 2008 Google, Inc.
+ * Copyright (C) 2007-2009 HTC Corporation.
+ * Author: Thomas Tsai <thomas_tsai@htc.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include <mach/board.h>
+#include <asm/setup.h>
+#include <linux/mtd/nand.h>
+#include <linux/module.h>
+#define MFG_GPIO_TABLE_MAX_SIZE        0x400
+static unsigned char mfg_gpio_table[MFG_GPIO_TABLE_MAX_SIZE];
+
+#define ATAG_MEMSIZE 0x5441001e
+unsigned memory_size;
+int __init parse_tag_memsize(const struct tag *tags)
+{
+	int mem_size = 0, find = 0;
+	struct tag *t = (struct tag *)tags;
+
+	for (; t->hdr.size; t = tag_next(t)) {
+		if (t->hdr.tag == ATAG_MEMSIZE) {
+			printk(KERN_DEBUG "find the memsize tag\n");
+			find = 1;
+			break;
+		}
+	}
+
+	if (find) {
+		memory_size = t->u.revision.rev;
+		mem_size = t->u.revision.rev;
+	}
+	printk(KERN_DEBUG "parse_tag_memsize: %d\n", memory_size);
+	return mem_size;
+}
+__tagtable(ATAG_MEMSIZE, parse_tag_memsize);
+
+#define ATAG_SMI 0x4d534D71
+/* setup calls mach->fixup, then parse_tags, parse_cmdline
+ * We need to setup meminfo in mach->fixup, so this function
+ * will need to traverse each tag to find smi tag.
+ */
+int __init parse_tag_smi(const struct tag *tags)
+{
+	int smi_sz = 0, find = 0;
+	struct tag *t = (struct tag *)tags;
+
+	for (; t->hdr.size; t = tag_next(t)) {
+		if (t->hdr.tag == ATAG_SMI) {
+			printk(KERN_DEBUG "find the smi tag\n");
+			find = 1;
+			break;
+		}
+	}
+	if (!find)
+		return -1;
+
+	printk(KERN_DEBUG "parse_tag_smi: smi size = %d\n", t->u.mem.size);
+	smi_sz = t->u.mem.size;
+	return smi_sz;
+}
+__tagtable(ATAG_SMI, parse_tag_smi);
+
+
+#define ATAG_HWID 0x4d534D72
+int __init parse_tag_hwid(const struct tag *tags)
+{
+	int hwid = 0, find = 0;
+	struct tag *t = (struct tag *)tags;
+
+	for (; t->hdr.size; t = tag_next(t)) {
+		if (t->hdr.tag == ATAG_HWID) {
+			printk(KERN_DEBUG "find the hwid tag\n");
+			find = 1;
+			break;
+		}
+	}
+
+	if (find)
+		hwid = t->u.revision.rev;
+	printk(KERN_DEBUG "parse_tag_hwid: hwid = 0x%x\n", hwid);
+	return hwid;
+}
+__tagtable(ATAG_HWID, parse_tag_hwid);
+
+#define ATAG_SKUID 0x4d534D73
+int __init parse_tag_skuid(const struct tag *tags)
+{
+	int skuid = 0, find = 0;
+	struct tag *t = (struct tag *)tags;
+
+	for (; t->hdr.size; t = tag_next(t)) {
+		if (t->hdr.tag == ATAG_SKUID) {
+			printk(KERN_DEBUG "find the skuid tag\n");
+			find = 1;
+			break;
+		}
+	}
+
+	if (find)
+		skuid = t->u.revision.rev;
+	printk(KERN_DEBUG "parse_tag_skuid: hwid = 0x%x\n", skuid);
+	return skuid;
+}
+__tagtable(ATAG_SKUID, parse_tag_skuid);
+
+/* Proximity sensor calibration values */
+
+unsigned int als_kadc;
+EXPORT_SYMBOL(als_kadc);
+static int __init parse_tag_als_calibration(const struct tag *tag)
+{
+	als_kadc = tag->u.als_kadc.kadc;
+
+	return 0;
+}
+
+__tagtable(ATAG_ALS, parse_tag_als_calibration);
+
+#define ATAG_ENGINEERID 0x4d534D75
+unsigned engineerid;
+EXPORT_SYMBOL(engineerid);
+int __init parse_tag_engineerid(const struct tag *tags)
+{
+	int find = 0;
+	struct tag *t = (struct tag *)tags;
+
+	for (; t->hdr.size; t = tag_next(t)) {
+		if (t->hdr.tag == ATAG_ENGINEERID) {
+			printk(KERN_DEBUG "find the engineer tag\n");
+			find = 1;
+			break;
+		}
+	}
+
+	if (find)
+		engineerid = t->u.revision.rev;
+	printk(KERN_DEBUG "parse_tag_engineerid: hwid = 0x%x\n", engineerid);
+	return engineerid;
+}
+__tagtable(ATAG_ENGINEERID, parse_tag_engineerid);
+
+
+/* G-Sensor calibration value */
+#define ATAG_GS         0x5441001d
+
+unsigned int gs_kvalue;
+EXPORT_SYMBOL(gs_kvalue);
+
+static int __init parse_tag_gs_calibration(const struct tag *tag)
+{
+	gs_kvalue = tag->u.revision.rev;
+	printk(KERN_DEBUG "%s: gs_kvalue = 0x%x\n", __func__, gs_kvalue);
+	return 0;
+}
+
+__tagtable(ATAG_GS, parse_tag_gs_calibration);
+
+/* Proximity sensor calibration values */
+#define ATAG_PS         0x5441001c
+
+unsigned int ps_kparam1;
+EXPORT_SYMBOL(ps_kparam1);
+
+unsigned int ps_kparam2;
+EXPORT_SYMBOL(ps_kparam2);
+
+static int __init parse_tag_ps_calibration(const struct tag *tag)
+{
+	ps_kparam1 = tag->u.serialnr.low;
+	ps_kparam2 = tag->u.serialnr.high;
+
+	printk(KERN_INFO "%s: ps_kparam1 = 0x%x, ps_kparam2 = 0x%x\n",
+		__func__, ps_kparam1, ps_kparam2);
+
+	return 0;
+}
+
+__tagtable(ATAG_PS, parse_tag_ps_calibration);
+
+/* camera values */
+#define ATAG_CAM	0x54410021
+
+int __init parse_tag_cam(const struct tag *tags)
+{
+	int mem_size = 0, find = 0;
+	struct tag *t = (struct tag *)tags;
+
+	for (; t->hdr.size; t = tag_next(t)) {
+		if (t->hdr.tag == ATAG_CAM) {
+			printk(KERN_DEBUG "find the memsize tag\n");
+			find = 1;
+			break;
+		}
+	}
+
+	if (find)
+		mem_size = t->u.revision.rev;
+	printk(KERN_DEBUG "parse_tag_memsize: %d\n", mem_size);
+	return mem_size;
+}
+__tagtable(ATAG_CAM, parse_tag_cam);
+
+/* Gyro/G-senosr calibration values */
+#define ATAG_GRYO_GSENSOR	0x54410020
+unsigned char gyro_gsensor_kvalue[37];
+EXPORT_SYMBOL(gyro_gsensor_kvalue);
+
+static int __init parse_tag_gyro_gsensor_calibration(const struct tag *tag)
+{
+	int i;
+	unsigned char *ptr = (unsigned char *)&tag->u;
+	memcpy(&gyro_gsensor_kvalue[0], ptr, sizeof(gyro_gsensor_kvalue));
+
+	printk(KERN_DEBUG "gyro_gs data\n");
+	for (i = 0; i < sizeof(gyro_gsensor_kvalue); i++)
+		printk(KERN_DEBUG "[%d]:0x%x", i, gyro_gsensor_kvalue[i]);
+
+	return 0;
+}
+__tagtable(ATAG_GRYO_GSENSOR, parse_tag_gyro_gsensor_calibration);
+
+BLOCKING_NOTIFIER_HEAD(psensor_notifier_list);
+int register_notifier_by_psensor(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_register(&psensor_notifier_list, nb);
+}
+
+int unregister_notifier_by_psensor(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_unregister(&psensor_notifier_list, nb);
+}
+
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+BLOCKING_NOTIFIER_HEAD(touchkey_notifier_list);
+int register_notifier_by_touchkey(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_register(&touchkey_notifier_list, nb);
+}
+
+int unregister_notifier_by_touchkey(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_unregister(&touchkey_notifier_list, nb);
+}
+#endif
+
+#define ATAG_HERO_PANEL_TYPE 0x4d534D74
+int panel_type;
+int __init tag_panel_parsing(const struct tag *tags)
+{
+	panel_type = tags->u.revision.rev;
+
+	printk(KERN_DEBUG "%s: panel type = %d\n", __func__,
+		panel_type);
+
+	return panel_type;
+}
+__tagtable(ATAG_HERO_PANEL_TYPE, tag_panel_parsing);
+
+#define ATAG_MFG_GPIO_TABLE 0x59504551
+int __init parse_tag_mfg_gpio_table(const struct tag *tags)
+{
+       unsigned char *dptr = (unsigned char *)(&tags->u);
+       __u32 size;
+
+       size = min((__u32)(tags->hdr.size - 2) * sizeof(__u32), (__u32)MFG_GPIO_TABLE_MAX_SIZE);
+       memcpy(mfg_gpio_table, dptr, size);
+       return 0;
+}
+__tagtable(ATAG_MFG_GPIO_TABLE, parse_tag_mfg_gpio_table);
+
+char *board_get_mfg_sleep_gpio_table(void)
+{
+	return mfg_gpio_table;
+}
+EXPORT_SYMBOL(board_get_mfg_sleep_gpio_table);
+static int mfg_mode;
+static int fullramdump_flag;
+int __init board_mfg_mode_init(char *s)
+{
+	if (!strcmp(s, "normal"))
+		mfg_mode = 0;
+	else if (!strcmp(s, "factory2"))
+		mfg_mode = 1;
+	else if (!strcmp(s, "recovery"))
+		mfg_mode = 2;
+	else if (!strcmp(s, "charge"))
+		mfg_mode = 3;
+	else if (!strcmp(s, "power_test"))
+		mfg_mode = 4;
+	else if (!strcmp(s, "offmode_charging"))
+		mfg_mode = 5;
+	else if (!strcmp(s, "mfgkernel:diag58"))
+		mfg_mode = 6;
+	else if (!strcmp(s, "gift_mode"))
+		mfg_mode = 7;
+	else if (!strcmp(s, "mfgkernel"))
+		mfg_mode = 8;
+	else if (!strcmp(s, "mini") || !strcmp(s, "skip_9k_mini")) {
+		mfg_mode = 9;
+		fullramdump_flag = 0;
+	} else if (!strcmp(s, "mini:1gdump")) {
+		mfg_mode = 9;
+		fullramdump_flag = 1;
+	}
+	return 1;
+}
+__setup("androidboot.mode=", board_mfg_mode_init);
+
+
+int board_mfg_mode(void)
+{
+	return mfg_mode;
+}
+
+EXPORT_SYMBOL(board_mfg_mode);
+
+
+int board_fullramdump_flag(void)
+{
+	return fullramdump_flag;
+}
+
+EXPORT_SYMBOL(board_fullramdump_flag);
+
+static int build_flag;
+
+static int __init board_bootloader_setup(char *str)
+{
+	char temp[strlen(str) + 1];
+	char *p = NULL;
+	char *build = NULL;
+	char *args = temp;
+
+	printk(KERN_INFO "%s: %s\n", __func__, str);
+
+	strcpy(temp, str);
+
+	/*parse the last parameter*/
+	while ((p = strsep(&args, ".")) != NULL) build = p;
+
+	/* Sometime hboot version would change from .X000 to .X001, .X002,...
+	 * So compare the first character to avoid unnecessary error.
+	 */
+	if (build) {
+		if (build[0] == '0') {
+			printk(KERN_INFO "%s: SHIP BUILD\n", __func__);
+			build_flag = SHIP_BUILD;
+		} else if (build[0] == '2') {
+			printk(KERN_INFO "%s: ENG BUILD\n", __func__);
+			build_flag = ENG_BUILD;
+		} else if (build[0] == '1') {
+			printk(KERN_INFO "%s: MFG BUILD\n", __func__);
+			build_flag = MFG_BUILD;
+		} else {
+			printk(KERN_INFO "%s: default ENG BUILD\n", __func__);
+			build_flag = ENG_BUILD;
+		}
+	}
+	return 1;
+}
+__setup("androidboot.bootloader=", board_bootloader_setup);
+
+int board_build_flag(void)
+{
+	return build_flag;
+}
+EXPORT_SYMBOL(board_build_flag);
+
+/* ISL29028 ID values */
+#define ATAG_PS_TYPE 0x4d534D77
+int ps_type;
+EXPORT_SYMBOL(ps_type);
+int __init tag_ps_parsing(const struct tag *tags)
+{
+	ps_type = tags->u.revision.rev;
+
+	printk(KERN_DEBUG "%s: PS type = 0x%x\n", __func__,
+		ps_type);
+
+	return ps_type;
+}
+__tagtable(ATAG_PS_TYPE, tag_ps_parsing);
+
+/* Gyro ID values */
+#define ATAG_GY_TYPE 0x4d534D78
+int gy_type;
+EXPORT_SYMBOL(gy_type);
+int __init tag_gy_parsing(const struct tag *tags)
+{
+	gy_type = tags->u.revision.rev;
+
+	printk(KERN_DEBUG "%s: Gyro type = 0x%x\n", __func__,
+		gy_type);
+
+	return gy_type;
+}
+__tagtable(ATAG_GY_TYPE, tag_gy_parsing);
+
+static unsigned long radio_flag;
+int __init radio_flag_init(char *s)
+{
+	int ret = 0;
+	ret = strict_strtoul(s, 16, &radio_flag);
+	if (ret != 0)
+		pr_err("%s: radio flag cannot be parsed from `%s'\r\n", __func__, s);
+	return 1;
+}
+__setup("radioflag=", radio_flag_init);
+
+unsigned int get_radio_flag(void)
+{
+	return radio_flag;
+}
+
+static unsigned long kernel_flag;
+int __init kernel_flag_init(char *s)
+{
+	int ret;
+	ret = strict_strtoul(s, 16, &kernel_flag);
+	if (ret != 0)
+		pr_err("%s: kernel flag cannot be parsed from `%s'\r\n", __func__, s);
+	return 1;
+}
+__setup("kernelflag=", kernel_flag_init);
+
+unsigned long get_kernel_flag(void)
+{
+	return kernel_flag;
+}
+
+static char *sku_color_tag = NULL;
+static int __init board_set_qwerty_color_tag(char *get_sku_color)
+{
+	if (strlen(get_sku_color))
+		sku_color_tag = get_sku_color;
+	else
+		sku_color_tag = NULL;
+	return 1;
+}
+__setup("androidboot.qwerty_color=", board_set_qwerty_color_tag);
+
+void board_get_sku_color_tag(char **ret_data)
+{
+	*ret_data = sku_color_tag;
+}
+EXPORT_SYMBOL(board_get_sku_color_tag);
+
+static unsigned long boot_powerkey_debounce_ms;
+int __init boot_powerkey_debounce_time_init(char *s)
+{
+	int ret;
+	ret = strict_strtoul(s, 16, &boot_powerkey_debounce_ms);
+	if (ret != 0)
+		pr_err("%s: boot_powerkey_debounce_ms cannot be parsed from `%s'\r\n", __func__, s);
+	return 1;
+}
+__setup("bpht=", boot_powerkey_debounce_time_init);
+
+int board_get_boot_powerkey_debounce_time(void)
+{
+	return boot_powerkey_debounce_ms;
+}
+EXPORT_SYMBOL(board_get_boot_powerkey_debounce_time);
+
+static unsigned long usb_ats;
+int __init board_ats_init(char *s)
+{
+	int ret;
+	ret = strict_strtoul(s, 16, &usb_ats);
+	if (ret != 0)
+		pr_err("%s: usb_ats cannot be parsed from `%s'\r\n", __func__, s);
+	return 1;
+}
+__setup("ats=", board_ats_init);
+
+static char android_serialno[16] = {0};
+static int __init board_serialno_setup(char *serialno)
+{
+	pr_info("%s: set serial no to %s\r\n", __func__, serialno);
+	strncpy(android_serialno, serialno, sizeof(android_serialno)/sizeof(android_serialno[0]) - 1);
+	return 1;
+}
+__setup("androidboot.serialno=", board_serialno_setup);
+
+char *board_serialno(void)
+{
+	return android_serialno;
+}
+EXPORT_SYMBOL(board_serialno);
+
+int board_get_usb_ats(void)
+{
+	return usb_ats;
+}
+EXPORT_SYMBOL(board_get_usb_ats);
+
+static int tamper_sf;
+int __init check_tamper_sf(char *s)
+{
+	tamper_sf = simple_strtoul(s, 0, 10);
+	return 1;
+}
+__setup("td.sf=", check_tamper_sf);
+
+unsigned int get_tamper_sf(void)
+{
+	return tamper_sf;
+}
+EXPORT_SYMBOL(get_tamper_sf);
+
+#define MSM_RAM_CONSOLE_BASE   0x88900000
+#define MSM_RAM_CONSOLE_SIZE   (SZ_1M - SZ_128K) /* 128K for debug info */
+
+static struct resource ram_console_resources[] = {
+	{
+		.start	= MSM_RAM_CONSOLE_BASE,
+		.end	= MSM_RAM_CONSOLE_BASE + MSM_RAM_CONSOLE_SIZE - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device ram_console_device = {
+	.name		= "ram_console",
+	.id		= -1,
+        .num_resources	= ARRAY_SIZE(ram_console_resources),
+        .resource	= ram_console_resources,
+};
+
+void __init htc_add_ramconsole_devices(void)
+{
+	platform_device_register(&ram_console_device);
+}
diff --git a/arch/arm/mach-msm/htc/elite/Kconfig b/arch/arm/mach-msm/htc/elite/Kconfig
new file mode 100644
index 0000000..bb9d313
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/Kconfig
@@ -0,0 +1,10 @@
+config BOARD_HEADER_FILE
+	string "HTC board specific header file name"
+	default ""
+
+config MACH_ELITE
+	depends on ARCH_MSM8960
+	select MACH_HTC
+	bool "HTC Elite"
+	help
+	  Support for the HTC ELITE device.
diff --git a/arch/arm/mach-msm/htc/elite/Makefile b/arch/arm/mach-msm/htc/elite/Makefile
new file mode 100644
index 0000000..d3a75bf
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/Makefile
@@ -0,0 +1,10 @@
+obj-$(CONFIG_MACH_ELITE) += board-elite.o
+obj-$(CONFIG_MACH_ELITE) += board-elite-regulator.o
+obj-$(CONFIG_MACH_ELITE) += board-elite-gpiomux.o
+obj-$(CONFIG_MACH_ELITE) += board-elite-storage.o
+obj-$(CONFIG_MACH_ELITE) += board-elite-audio.o
+obj-$(CONFIG_MACH_ELITE) += board-elite-pmic.o
+obj-$(CONFIG_MACH_ELITE) += board-elite-keypad.o
+obj-$(CONFIG_MACH_ELITE) += board-elite-camera.o
+obj-$(CONFIG_MACH_ELITE) += display/
+CFLAGS_board-elite-display.o += -Idrivers/video
diff --git a/arch/arm/mach-msm/htc/elite/board-elite-audio.c b/arch/arm/mach-msm/htc/elite/board-elite-audio.c
new file mode 100644
index 0000000..3570a1d
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/board-elite-audio.c
@@ -0,0 +1,1810 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * HTC: elite machine driver which defines board-specific data
+ * Copy from sound/soc/msm/msm8960.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <sound/core.h>
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+#include <sound/pcm.h>
+#include <sound/jack.h>
+#include <asm/mach-types.h>
+#include <mach/socinfo.h>
+#include <linux/mfd/wcd9xxx/core.h>
+#include "../../../sound/soc/codecs/wcd9310.h"
+#include "../sound/soc/msm/msm-pcm-routing.h"
+#include "board-elite.h"
+
+#include <mach/cable_detect.h>
+#include <mach/board.h>
+
+#define MSM_SPK_ON 1
+#define MSM_SPK_OFF 0
+
+#define MSM_SLIM_0_RX_MAX_CHANNELS		2
+#define MSM_SLIM_0_TX_MAX_CHANNELS		4
+
+#define SAMPLE_RATE_8KHZ 8000
+#define SAMPLE_RATE_16KHZ 16000
+
+#define BOTTOM_SPK_AMP_POS	0x1
+#define BOTTOM_SPK_AMP_NEG	0x2
+#define TOP_SPK_AMP_POS		0x4
+#define TOP_SPK_AMP_NEG		0x8
+#define DOCK_SPK_AMP_POS	0x10
+#define DOCK_SPK_AMP_NEG	0x20
+
+#define GPIO_AUX_PCM_DOUT 63
+#define GPIO_AUX_PCM_DIN 64
+#define GPIO_AUX_PCM_SYNC 65
+#define GPIO_AUX_PCM_CLK 66
+
+#define TABLA_EXT_CLK_RATE 12288000
+
+#define ELITE_AUD_STEREO_REC	(PM8921_GPIO_PM_TO_SYS(3))
+#define top_spk_pamp_gpio       (PM8921_GPIO_PM_TO_SYS(19))
+#define bottom_spk_pamp_gpio    (PM8921_GPIO_PM_TO_SYS(18))
+#define DOCK_SPK_PAMP_GPIO	    (PM8921_GPIO_PM_TO_SYS(1))
+#define USB_ID_ADC_GPIO		    (PM8921_GPIO_PM_TO_SYS(4))
+
+static int msm_spk_control;
+static int msm_ext_bottom_spk_pamp;
+static int msm_ext_top_spk_pamp;
+static int msm_ext_dock_spk_pamp;
+static int msm_slim_0_rx_ch = 1;
+static int msm_slim_0_tx_ch = 1;
+
+static int msm_btsco_rate = SAMPLE_RATE_8KHZ;
+static int msm_btsco_ch = 1;
+
+static int msm_auxpcm_rate = SAMPLE_RATE_8KHZ;
+
+static int elite_stereo_control;
+
+static struct clk *codec_clk;
+static int clk_users;
+
+extern void msm_release_audio_dock_lock(void);
+
+static struct snd_soc_jack hs_jack;
+static struct snd_soc_jack button_jack;
+
+static int msm_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
+					bool dapm);
+
+
+extern void release_audio_dock_lock(void);
+static struct mutex cdc_mclk_mutex;
+
+static void msm_ext_spk_power_amp_off(u32);
+static void audio_dock_notifier_func(enum usb_connect_type online)
+{
+	if (cable_get_accessory_type() != DOCK_STATE_AUDIO_DOCK) {
+		pr_debug("accessory is not AUDIO_DOCK\n");
+		return;
+	}
+
+	switch(online) {
+	case CONNECT_TYPE_NONE:
+		pr_debug("%s, VBUS is removed\n", __func__);
+		
+		msm_ext_spk_power_amp_off(DOCK_SPK_AMP_POS|DOCK_SPK_AMP_NEG);
+		
+		release_audio_dock_lock();
+		break;
+	default:
+		break;
+	}
+
+	return;
+}
+
+static struct mutex audio_notifier_lock;
+static struct t_cable_status_notifier audio_dock_notifier =
+{
+	.name = "elite_audio_8960",
+	.func = audio_dock_notifier_func,
+};
+
+static void msm_enable_ext_spk_amp_gpio(u32 spk_amp_gpio)
+{
+	int ret = 0;
+
+	struct pm_gpio param = {
+		.direction      = PM_GPIO_DIR_OUT,
+		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
+		.output_value   = 1,
+		.pull      = PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength   = PM_GPIO_STRENGTH_MED,
+		.function       = PM_GPIO_FUNC_NORMAL,
+	};
+
+	if (spk_amp_gpio == bottom_spk_pamp_gpio) {
+
+		ret = gpio_request(bottom_spk_pamp_gpio, "BOTTOM_SPK_AMP");
+		if (ret) {
+			pr_err("%s: Error requesting BOTTOM SPK AMP GPIO %u\n",
+				__func__, bottom_spk_pamp_gpio);
+			return;
+		}
+		ret = pm8xxx_gpio_config(bottom_spk_pamp_gpio, &param);
+		if (ret)
+			pr_err("%s: Failed to configure Bottom Spk Ampl"
+				" gpio %u\n", __func__, bottom_spk_pamp_gpio);
+		else {
+			pr_debug("%s: enable Bottom spkr amp gpio\n", __func__);
+			gpio_direction_output(bottom_spk_pamp_gpio, 1);
+		}
+
+	} else if (spk_amp_gpio == top_spk_pamp_gpio) {
+
+		ret = gpio_request(top_spk_pamp_gpio, "TOP_SPK_AMP");
+		if (ret) {
+			pr_err("%s: Error requesting GPIO %d\n", __func__,
+				top_spk_pamp_gpio);
+			return;
+		}
+		ret = pm8xxx_gpio_config(top_spk_pamp_gpio, &param);
+		if (ret)
+			pr_err("%s: Failed to configure Top Spk Ampl"
+				" gpio %u\n", __func__, top_spk_pamp_gpio);
+		else {
+			pr_debug("%s: enable Top spkr amp gpio\n", __func__);
+			gpio_direction_output(top_spk_pamp_gpio, 1);
+		}
+
+	} else if (spk_amp_gpio == DOCK_SPK_PAMP_GPIO) {
+
+		ret = gpio_request(DOCK_SPK_PAMP_GPIO, "DOCK_SPK_AMP");
+		if (ret) {
+			pr_err("%s: Error requesting GPIO %d\n", __func__,
+				DOCK_SPK_PAMP_GPIO);
+			return;
+		}
+		ret = pm8xxx_gpio_config(DOCK_SPK_PAMP_GPIO, &param);
+		if (ret)
+			pr_err("%s: Failed to configure Dock Spk Ampl"
+				" gpio %u\n", __func__, DOCK_SPK_PAMP_GPIO);
+		else {
+			pr_debug("%s: enable dock amp gpio\n", __func__);
+			gpio_direction_output(DOCK_SPK_PAMP_GPIO, 1);
+		}
+
+		ret = gpio_request(USB_ID_ADC_GPIO, "USB_ID_ADC");
+		if (ret) {
+			pr_err("%s: Error requesting USB_ID_ADC PMIC GPIO %u\n",
+				__func__, USB_ID_ADC_GPIO);
+			return;
+		}
+		ret = pm8xxx_gpio_config(USB_ID_ADC_GPIO, &param);
+		if (ret)
+			pr_err("%s: Failed to configure USB_ID_ADC PMIC"
+				" gpio %u\n", __func__, USB_ID_ADC_GPIO);
+
+	} else {
+		pr_err("%s: ERROR : Invalid External Speaker Ampl GPIO."
+			" gpio = %u\n", __func__, spk_amp_gpio);
+		return;
+	}
+}
+
+static void msm_ext_spk_power_amp_on(u32 spk)
+{
+	if (spk & (BOTTOM_SPK_AMP_POS | BOTTOM_SPK_AMP_NEG)) {
+
+		if ((msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_POS) &&
+			(msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_NEG)) {
+
+			pr_debug("%s() External Bottom Speaker Ampl already "
+				"turned on. spk = 0x%08x\n", __func__, spk);
+			return;
+		}
+
+		msm_ext_bottom_spk_pamp |= spk;
+
+		if ((msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_POS) &&
+			(msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_NEG)) {
+
+			msm_enable_ext_spk_amp_gpio(bottom_spk_pamp_gpio);
+			pr_debug("%s: slepping 4 ms after turning on external "
+				" Bottom Speaker Ampl\n", __func__);
+			usleep_range(4000, 4000);
+		}
+
+	} else if  (spk & (TOP_SPK_AMP_POS | TOP_SPK_AMP_NEG)) {
+
+		if ((msm_ext_top_spk_pamp & TOP_SPK_AMP_POS) &&
+			(msm_ext_top_spk_pamp & TOP_SPK_AMP_NEG)) {
+
+			pr_debug("%s() External Top Speaker Ampl already"
+				"turned on. spk = 0x%08x\n", __func__, spk);
+			return;
+		}
+
+		msm_ext_top_spk_pamp |= spk;
+
+		if ((msm_ext_top_spk_pamp & TOP_SPK_AMP_POS) &&
+			(msm_ext_top_spk_pamp & TOP_SPK_AMP_NEG)) {
+
+			msm_enable_ext_spk_amp_gpio(top_spk_pamp_gpio);
+			pr_debug("%s: sleeping 4 ms after turning on "
+				" external HAC Ampl\n", __func__);
+			usleep_range(4000, 4000);
+		}
+
+	} else if (spk & (DOCK_SPK_AMP_POS | DOCK_SPK_AMP_NEG)) {
+
+		mutex_lock(&audio_notifier_lock);
+
+		if ((msm_ext_dock_spk_pamp & DOCK_SPK_AMP_POS) &&
+			(msm_ext_dock_spk_pamp & DOCK_SPK_AMP_NEG)) {
+
+			pr_debug("%s() External Dock Speaker Ampl already"
+				"turned on. spk = 0x%08x\n", __func__, spk);
+			return;
+		}
+
+		msm_ext_dock_spk_pamp |= spk;
+
+		if ((msm_ext_dock_spk_pamp & DOCK_SPK_AMP_POS) &&
+			(msm_ext_dock_spk_pamp & DOCK_SPK_AMP_NEG)) {
+
+			msm_enable_ext_spk_amp_gpio(DOCK_SPK_PAMP_GPIO);
+
+			pr_debug("%s: sleeping 4 ms after turning on "
+				" external DOCK Ampl\n", __func__);
+			usleep_range(4000, 4000);
+		}
+		mutex_unlock(&audio_notifier_lock);
+
+	} else  {
+
+		pr_err("%s: ERROR : Invalid External Speaker Ampl. spk = 0x%08x\n",
+			__func__, spk);
+		return;
+	}
+}
+
+static void msm_ext_spk_power_amp_off(u32 spk)
+{
+	struct pm_gpio param = {
+		.direction      = PM_GPIO_DIR_IN,
+		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
+		.pull      = PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength   = PM_GPIO_STRENGTH_MED,
+		.function       = PM_GPIO_FUNC_NORMAL,
+	};
+
+	pr_debug("%s, spk = %d\n", __func__, spk);
+
+	if (spk & (BOTTOM_SPK_AMP_POS | BOTTOM_SPK_AMP_NEG)) {
+
+		if (!msm_ext_bottom_spk_pamp)
+			return;
+
+		gpio_direction_output(bottom_spk_pamp_gpio, 0);
+		gpio_free(bottom_spk_pamp_gpio);
+		msm_ext_bottom_spk_pamp = 0;
+
+		pr_debug("%s: sleeping 4 ms after turning off external Bottom"
+			" Speaker Ampl\n", __func__);
+
+		usleep_range(4000, 4000);
+
+	} else if (spk & (TOP_SPK_AMP_POS | TOP_SPK_AMP_NEG)) {
+
+		if (!msm_ext_top_spk_pamp)
+			return;
+
+		gpio_direction_output(top_spk_pamp_gpio, 0);
+		gpio_free(top_spk_pamp_gpio);
+		msm_ext_top_spk_pamp = 0;
+
+		pr_debug("%s: sleeping 4 ms after turning off external"
+			" HAC Ampl\n", __func__);
+
+		usleep_range(4000, 4000);
+
+	} else if (spk & (DOCK_SPK_AMP_POS | DOCK_SPK_AMP_NEG)) {
+
+		mutex_lock(&audio_notifier_lock);
+
+		if (!msm_ext_dock_spk_pamp) {
+			mutex_unlock(&audio_notifier_lock);
+			return;
+		}
+
+		gpio_direction_input(DOCK_SPK_PAMP_GPIO);
+		gpio_free(DOCK_SPK_PAMP_GPIO);
+
+		gpio_direction_input(USB_ID_ADC_GPIO);
+		if (pm8xxx_gpio_config(USB_ID_ADC_GPIO, &param))
+			pr_err("%s: Failed to configure USB_ID_ADC PMIC"
+				" gpio %u\n", __func__, USB_ID_ADC_GPIO);
+		gpio_free(USB_ID_ADC_GPIO);
+		msm_ext_dock_spk_pamp = 0;
+
+		mutex_unlock(&audio_notifier_lock);
+
+		pr_debug("%s: sleeping 4 ms after turning off external"
+			" DOCK Ampl\n", __func__);
+
+		usleep_range(4000, 4000);
+
+	} else  {
+
+		pr_err("%s: ERROR : Invalid Ext Spk Ampl. spk = 0x%08x\n",
+			__func__, spk);
+		return;
+	}
+}
+
+static void msm_ext_control(struct snd_soc_codec *codec)
+{
+	struct snd_soc_dapm_context *dapm = &codec->dapm;
+
+	mutex_lock(&dapm->codec->mutex);
+
+	pr_debug("%s: msm_spk_control = %d", __func__, msm_spk_control);
+	if (msm_spk_control == MSM_SPK_ON) {
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Pos");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Neg");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Pos");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Neg");
+		snd_soc_dapm_enable_pin(dapm, "Dock Spk Pos");
+		snd_soc_dapm_enable_pin(dapm, "Dock Spk Neg");
+
+	} else {
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Bottom Pos");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Bottom Neg");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Top Pos");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Top Neg");
+		snd_soc_dapm_disable_pin(dapm, "Dock Spk Pos");
+		snd_soc_dapm_disable_pin(dapm, "Dock Spk Neg");
+	}
+
+	snd_soc_dapm_sync(dapm);
+	mutex_unlock(&dapm->codec->mutex);
+}
+
+static int msm_get_spk(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_spk_control = %d", __func__, msm_spk_control);
+	ucontrol->value.integer.value[0] = msm_spk_control;
+	return 0;
+}
+static int msm_set_spk(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+
+	pr_debug("%s()\n", __func__);
+	if (msm_spk_control == ucontrol->value.integer.value[0])
+		return 0;
+
+	msm_spk_control = ucontrol->value.integer.value[0];
+	msm_ext_control(codec);
+	return 1;
+}
+static int msm_spkramp_event(struct snd_soc_dapm_widget *w,
+	struct snd_kcontrol *k, int event)
+{
+	pr_debug("%s() %x\n", __func__, SND_SOC_DAPM_EVENT_ON(event));
+
+	if (SND_SOC_DAPM_EVENT_ON(event)) {
+		if (!strncmp(w->name, "Ext Spk Bottom Pos", 18))
+			msm_ext_spk_power_amp_on(BOTTOM_SPK_AMP_POS);
+		else if (!strncmp(w->name, "Ext Spk Bottom Neg", 18))
+			msm_ext_spk_power_amp_on(BOTTOM_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Ext Spk Top Pos", 15))
+			msm_ext_spk_power_amp_on(TOP_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Ext Spk Top Neg", 15))
+			msm_ext_spk_power_amp_on(TOP_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Dock Spk Pos", 12))
+			msm_ext_spk_power_amp_on(DOCK_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Dock Spk Neg", 12))
+			msm_ext_spk_power_amp_on(DOCK_SPK_AMP_NEG);
+		else {
+			pr_err("%s() Invalid Speaker Widget = %s\n",
+					__func__, w->name);
+			return -EINVAL;
+		}
+
+	} else {
+		if (!strncmp(w->name, "Ext Spk Bottom Pos", 18))
+			msm_ext_spk_power_amp_off(BOTTOM_SPK_AMP_POS);
+		else if (!strncmp(w->name, "Ext Spk Bottom Neg", 18))
+			msm_ext_spk_power_amp_off(BOTTOM_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Ext Spk Top Pos", 15))
+			msm_ext_spk_power_amp_off(TOP_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Ext Spk Top Neg", 15))
+			msm_ext_spk_power_amp_off(TOP_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Dock Spk Pos", 12))
+			msm_ext_spk_power_amp_off(DOCK_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Dock Spk Neg", 12))
+			msm_ext_spk_power_amp_off(DOCK_SPK_AMP_NEG);
+		else {
+			pr_err("%s() Invalid Speaker Widget = %s\n",
+					__func__, w->name);
+			return -EINVAL;
+		}
+	}
+	return 0;
+}
+
+static int msm_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
+					bool dapm)
+{
+	int r = 0;
+	pr_debug("%s: enable = %d\n", __func__, enable);
+
+	mutex_lock(&cdc_mclk_mutex);
+	if (enable) {
+		clk_users++;
+		pr_debug("%s: clk_users = %d\n", __func__, clk_users);
+		if (clk_users == 1) {
+			if (codec_clk) {
+				clk_set_rate(codec_clk, TABLA_EXT_CLK_RATE);
+				clk_prepare_enable(codec_clk);
+				tabla_mclk_enable(codec, 1, dapm);
+			} else {
+				pr_err("%s: Error setting Tabla MCLK\n",
+				       __func__);
+				clk_users--;
+				r = -EINVAL;
+			}
+		}
+	} else {
+		if (clk_users > 0) {
+			clk_users--;
+			pr_debug("%s: clk_users = %d\n", __func__, clk_users);
+			if (clk_users == 0) {
+				pr_debug("%s: disabling MCLK. clk_users = %d\n",
+					 __func__, clk_users);
+				tabla_mclk_enable(codec, 0, dapm);
+				clk_disable_unprepare(codec_clk);
+			}
+		} else {
+			pr_err("%s: Error releasing Tabla MCLK\n", __func__);
+			r = -EINVAL;
+		}
+	}
+	mutex_unlock(&cdc_mclk_mutex);
+	return r;
+}
+
+static int msm_mclk_event(struct snd_soc_dapm_widget *w,
+		struct snd_kcontrol *kcontrol, int event)
+{
+	pr_debug("%s: event = %d\n", __func__, event);
+
+	switch (event) {
+	case SND_SOC_DAPM_PRE_PMU:
+		return msm_enable_codec_ext_clk(w->codec, 1, true);
+	case SND_SOC_DAPM_POST_PMD:
+		return msm_enable_codec_ext_clk(w->codec, 0, true);
+	}
+	return 0;
+}
+
+enum {
+	RX_SWITCH_INDEX = 0,
+	TX_SWITCH_INDEX,
+	SWITCH_MAX,
+};
+
+static const struct snd_kcontrol_new extspk_switch_controls =
+	SOC_DAPM_SINGLE("Switch", RX_SWITCH_INDEX, 0, 1, 0);
+
+static const struct snd_kcontrol_new earamp_switch_controls =
+	SOC_DAPM_SINGLE("Switch", RX_SWITCH_INDEX, 0, 1, 0);
+
+static const struct snd_kcontrol_new spkamp_switch_controls =
+	SOC_DAPM_SINGLE("Switch", RX_SWITCH_INDEX, 0, 1, 0);
+
+static const struct snd_kcontrol_new micbias3_switch_controls =
+	SOC_DAPM_SINGLE("Switch", TX_SWITCH_INDEX, 0, 1, 0);
+
+static const struct snd_soc_dapm_widget elite_dapm_widgets[] = {
+	SND_SOC_DAPM_MIXER("Lineout Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
+	SND_SOC_DAPM_MIXER("SPK AMP EN", SND_SOC_NOPM, 0, 0, &spkamp_switch_controls, 1),
+	SND_SOC_DAPM_MIXER("HAC AMP EN", SND_SOC_NOPM, 0, 0, &earamp_switch_controls, 1),
+	SND_SOC_DAPM_MIXER("DOCK AMP EN", SND_SOC_NOPM, 0, 0, &extspk_switch_controls, 1),
+	SND_SOC_DAPM_MIXER("DUAL MICBIAS", SND_SOC_NOPM, 0, 0, &micbias3_switch_controls, 1),
+};
+
+static const struct snd_soc_dapm_widget msm_dapm_widgets[] = {
+	SND_SOC_DAPM_SUPPLY("MCLK",  SND_SOC_NOPM, 0, 0,
+	msm_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
+
+	SND_SOC_DAPM_SPK("Ext Spk Bottom Pos", msm_spkramp_event),
+	SND_SOC_DAPM_SPK("Ext Spk Bottom Neg", msm_spkramp_event),
+
+	SND_SOC_DAPM_SPK("Ext Spk Top Pos", msm_spkramp_event),
+	SND_SOC_DAPM_SPK("Ext Spk Top Neg", msm_spkramp_event),
+
+	SND_SOC_DAPM_SPK("Dock Spk Pos", msm_spkramp_event),
+	SND_SOC_DAPM_SPK("Dock Spk Neg", msm_spkramp_event),
+
+	SND_SOC_DAPM_MIC("Handset Mic", NULL),
+	SND_SOC_DAPM_MIC("Headset Mic", NULL),
+	SND_SOC_DAPM_MIC("Back Mic", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic1", NULL),
+	SND_SOC_DAPM_MIC("ANCRight Headset Mic", NULL),
+	SND_SOC_DAPM_MIC("ANCLeft Headset Mic", NULL),
+
+	SND_SOC_DAPM_MIC("Digital Mic1", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic2", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic3", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic4", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic5", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic6", NULL),
+
+};
+
+static const struct snd_soc_dapm_route tabla_1_x_audio_map[] = {
+
+	{"Lineout Mixer", NULL, "LINEOUT2"},
+	{"Lineout Mixer", NULL, "LINEOUT1"},
+};
+
+static const struct snd_soc_dapm_route tabla_2_x_audio_map[] = {
+
+	{"Lineout Mixer", NULL, "LINEOUT3"},
+	{"Lineout Mixer", NULL, "LINEOUT1"},
+};
+
+static const struct snd_soc_dapm_route common_audio_map[] = {
+
+	{"RX_BIAS", NULL, "MCLK"},
+	{"LDO_H", NULL, "MCLK"},
+
+	
+	{"Ext Spk Bottom Pos", NULL, "SPK AMP EN"},
+	{"Ext Spk Bottom Neg", NULL, "SPK AMP EN"},
+	{"SPK AMP EN", "Switch", "Lineout Mixer"},
+
+	
+	{"Ext Spk Top Pos", NULL, "HAC AMP EN"},
+	{"Ext Spk Top Neg", NULL, "HAC AMP EN"},
+	{"HAC AMP EN", "Switch", "Lineout Mixer"},
+
+	
+	{"Dock Spk Pos", NULL, "DOCK AMP EN"},
+	{"Dock Spk Neg", NULL, "DOCK AMP EN"},
+	{"DOCK AMP EN", "Switch", "Lineout Mixer"},
+
+	
+	{"AMIC1", NULL, "DUAL MICBIAS"},
+	{"DUAL MICBIAS", NULL, "MIC BIAS1 External"},
+	{"MIC BIAS1 External", NULL, "Handset Mic"},
+
+	{"DUAL MICBIAS", "Switch", "MIC BIAS3 External"},
+
+	{"AMIC2", NULL, "MIC BIAS2 External"},
+	{"MIC BIAS2 External", NULL, "Headset Mic"},
+
+	{"AMIC3", NULL, "MIC BIAS3 External"},
+	{"MIC BIAS3 External", NULL, "Back Mic"},
+
+	{"HEADPHONE", NULL, "LDO_H"},
+
+};
+
+static const char *spk_function[] = {"Off", "On"};
+static const char *slim0_rx_ch_text[] = {"One", "Two"};
+static const char *slim0_tx_ch_text[] = {"One", "Two", "Three", "Four"};
+
+static const struct soc_enum msm_enum[] = {
+	SOC_ENUM_SINGLE_EXT(2, spk_function),
+	SOC_ENUM_SINGLE_EXT(2, slim0_rx_ch_text),
+	SOC_ENUM_SINGLE_EXT(4, slim0_tx_ch_text),
+};
+
+static const char *stereo_mic_voice[] = {"Off", "On"};
+static const struct soc_enum elite_msm_enum[] = {
+	SOC_ENUM_SINGLE_EXT(2, stereo_mic_voice),
+};
+
+static const char *btsco_rate_text[] = {"8000", "16000"};
+static const struct soc_enum msm_btsco_enum[] = {
+		SOC_ENUM_SINGLE_EXT(2, btsco_rate_text),
+};
+
+static const char *auxpcm_rate_text[] = {"rate_8000", "rate_16000"};
+static const struct soc_enum msm_auxpcm_enum[] = {
+		SOC_ENUM_SINGLE_EXT(2, auxpcm_rate_text),
+};
+
+static int msm_slim_0_rx_ch_get(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_slim_0_rx_ch  = %d\n", __func__,
+			msm_slim_0_rx_ch);
+	ucontrol->value.integer.value[0] = msm_slim_0_rx_ch - 1;
+	return 0;
+}
+
+static int msm_slim_0_rx_ch_put(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	msm_slim_0_rx_ch = ucontrol->value.integer.value[0] + 1;
+
+	pr_debug("%s: msm_slim_0_rx_ch = %d\n", __func__,
+			msm_slim_0_rx_ch);
+	return 1;
+}
+
+static int msm_slim_0_tx_ch_get(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_slim_0_tx_ch  = %d\n", __func__,
+			msm_slim_0_tx_ch);
+	ucontrol->value.integer.value[0] = msm_slim_0_tx_ch - 1;
+	return 0;
+}
+
+static int msm_slim_0_tx_ch_put(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	msm_slim_0_tx_ch = ucontrol->value.integer.value[0] + 1;
+
+	pr_debug("%s: msm_slim_0_tx_ch = %d\n", __func__,
+			msm_slim_0_tx_ch);
+	return 1;
+}
+
+static int elite_stereo_voice_get(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: elite_stereo_control = %d\n", __func__,
+			elite_stereo_control);
+	ucontrol->value.integer.value[0] = elite_stereo_control;
+	return 0;
+}
+
+static int elite_stereo_voice_put(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	int ret = 0;
+	struct pm_gpio param = {
+		.direction      = PM_GPIO_DIR_OUT,
+		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
+		.output_value   = 1,
+		.pull      = PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_L17,
+		.out_strength   = PM_GPIO_STRENGTH_MED,
+		.function       = PM_GPIO_FUNC_NORMAL,
+	};
+
+	if (elite_stereo_control == ucontrol->value.integer.value[0])
+		return 0;
+
+	elite_stereo_control = ucontrol->value.integer.value[0];
+
+	pr_debug("%s: elite_stereo_control = %d\n", __func__,
+			elite_stereo_control);
+
+	switch (ucontrol->value.integer.value[0]) {
+	case 0:
+		
+		gpio_direction_output(ELITE_AUD_STEREO_REC, 1);
+		gpio_free(ELITE_AUD_STEREO_REC);
+
+		break;
+	case 1:
+		
+		ret = gpio_request(ELITE_AUD_STEREO_REC, "A1028_SWITCH");
+		if (ret) {
+			pr_err("%s: Failed to request gpio %d\n", __func__,
+					ELITE_AUD_STEREO_REC);
+			return ret;
+		}
+
+		ret = pm8xxx_gpio_config(ELITE_AUD_STEREO_REC, &param);
+
+		if (ret)
+			pr_err("%s: Failed to configure gpio %d\n", __func__,
+					ELITE_AUD_STEREO_REC);
+		else
+			gpio_direction_output(ELITE_AUD_STEREO_REC, 0);
+		break;
+	}
+	return ret;
+}
+
+static int msm_btsco_rate_get(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_btsco_rate  = %d", __func__, msm_btsco_rate);
+	ucontrol->value.integer.value[0] = msm_btsco_rate;
+	return 0;
+}
+
+static int msm_btsco_rate_put(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	switch (ucontrol->value.integer.value[0]) {
+	case 0:
+		msm_btsco_rate = SAMPLE_RATE_8KHZ;
+		break;
+	case 1:
+		msm_btsco_rate = SAMPLE_RATE_16KHZ;
+		break;
+	default:
+		msm_btsco_rate = SAMPLE_RATE_8KHZ;
+		break;
+	}
+	pr_debug("%s: msm_btsco_rate = %d\n", __func__, msm_btsco_rate);
+	return 0;
+}
+
+static int msm_auxpcm_rate_get(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_auxpcm_rate  = %d", __func__,
+		msm_auxpcm_rate);
+	ucontrol->value.integer.value[0] = msm_auxpcm_rate;
+	return 0;
+}
+
+static int msm_auxpcm_rate_put(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	switch (ucontrol->value.integer.value[0]) {
+	case 0:
+		msm_auxpcm_rate = SAMPLE_RATE_8KHZ;
+		break;
+	case 1:
+		msm_auxpcm_rate = SAMPLE_RATE_16KHZ;
+		break;
+	default:
+		msm_auxpcm_rate = SAMPLE_RATE_8KHZ;
+		break;
+	}
+	pr_debug("%s: msm_auxpcm_rate = %d"
+		"ucontrol->value.integer.value[0] = %d\n", __func__,
+		msm_auxpcm_rate,
+		(int)ucontrol->value.integer.value[0]);
+	return 0;
+}
+
+static const struct snd_kcontrol_new tabla_msm_controls[] = {
+	SOC_ENUM_EXT("Speaker Function", msm_enum[0], msm_get_spk,
+		msm_set_spk),
+	SOC_ENUM_EXT("SLIM_0_RX Channels", msm_enum[1],
+		msm_slim_0_rx_ch_get, msm_slim_0_rx_ch_put),
+	SOC_ENUM_EXT("SLIM_0_TX Channels", msm_enum[2],
+		msm_slim_0_tx_ch_get, msm_slim_0_tx_ch_put),
+	SOC_ENUM_EXT("Internal BTSCO SampleRate", msm_btsco_enum[0],
+		msm_btsco_rate_get, msm_btsco_rate_put),
+	SOC_ENUM_EXT("AUX PCM SampleRate", msm_auxpcm_enum[0],
+		msm_auxpcm_rate_get, msm_auxpcm_rate_put),
+	SOC_ENUM_EXT("Stereo Selection", elite_msm_enum[0], elite_stereo_voice_get,
+		elite_stereo_voice_put),
+};
+
+static int msm_hw_params(struct snd_pcm_substream *substream,
+				struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	int ret = 0;
+	unsigned int rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
+	unsigned int rx_ch_cnt = 0, tx_ch_cnt = 0;
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+
+		pr_debug("%s: %s  rx_dai_id = %d  num_ch = %d\n", __func__,
+			codec_dai->name, codec_dai->id, msm_slim_0_rx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+
+		ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
+				msm_slim_0_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai, 0, 0,
+				msm_slim_0_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	} else {
+
+		pr_debug("%s: %s  tx_dai_id = %d  num_ch = %d\n", __func__,
+			codec_dai->name, codec_dai->id, msm_slim_0_tx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(cpu_dai,
+				msm_slim_0_tx_ch, tx_ch, 0 , 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai,
+				msm_slim_0_tx_ch, tx_ch, 0, 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	}
+end:
+	return ret;
+}
+
+static int msm_slimbus_2_hw_params(struct snd_pcm_substream *substream,
+				struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	int ret = 0;
+	unsigned int rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
+	unsigned int rx_ch_cnt = 0, tx_ch_cnt = 0;
+	unsigned int num_tx_ch = 0;
+	unsigned int num_rx_ch = 0;
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+
+		num_rx_ch =  params_channels(params);
+
+		pr_debug("%s: %s rx_dai_id = %d  num_ch = %d\n", __func__,
+			codec_dai->name, codec_dai->id, num_rx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+
+		ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
+				num_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai, 0, 0,
+				num_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	} else {
+		num_tx_ch =  params_channels(params);
+
+		pr_debug("%s: %s  tx_dai_id = %d  num_ch = %d\n", __func__,
+			codec_dai->name, codec_dai->id, num_tx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+
+		ret = snd_soc_dai_set_channel_map(cpu_dai,
+				num_tx_ch, tx_ch, 0 , 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai,
+				num_tx_ch, tx_ch, 0, 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	}
+end:
+	return ret;
+}
+
+static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
+{
+	int err;
+	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_dapm_context *dapm = &codec->dapm;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+
+	pr_debug("%s(), dev_name: %s\n", __func__, dev_name(cpu_dai->dev));
+
+
+	snd_soc_dapm_new_controls(dapm, msm_dapm_widgets,
+				ARRAY_SIZE(msm_dapm_widgets));
+
+	snd_soc_dapm_new_controls(dapm, elite_dapm_widgets,
+				ARRAY_SIZE(elite_dapm_widgets));
+
+	snd_soc_dapm_add_routes(dapm, common_audio_map,
+		ARRAY_SIZE(common_audio_map));
+
+	pr_debug("%s(), %s\n", __func__, codec->name);
+	if (!strncmp(codec->name, "tabla1x_codec", 13))
+		snd_soc_dapm_add_routes(dapm, tabla_1_x_audio_map,
+			 ARRAY_SIZE(tabla_1_x_audio_map));
+	else
+		snd_soc_dapm_add_routes(dapm, tabla_2_x_audio_map,
+			 ARRAY_SIZE(tabla_2_x_audio_map));
+
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Pos");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Neg");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Pos");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Neg");
+	snd_soc_dapm_enable_pin(dapm, "Dock Spk Pos");
+	snd_soc_dapm_enable_pin(dapm, "Dock Spk Neg");
+
+	snd_soc_dapm_sync(dapm);
+
+	err = snd_soc_jack_new(codec, "Headset Jack",
+			       (SND_JACK_HEADSET | SND_JACK_OC_HPHL |
+				SND_JACK_OC_HPHR | SND_JACK_UNSUPPORTED),
+			       &hs_jack);
+	if (err) {
+		pr_err("failed to create new jack\n");
+		return err;
+	}
+
+	err = snd_soc_jack_new(codec, "Button Jack",
+			       TABLA_JACK_BUTTON_MASK, &button_jack);
+	if (err) {
+		pr_err("failed to create new jack\n");
+		return err;
+	}
+
+	codec_clk = clk_get(cpu_dai->dev, "osr_clk");
+
+
+	return err;
+}
+
+static int msm_slim_0_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+			SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+	channels->min = channels->max = msm_slim_0_rx_ch;
+
+	return 0;
+}
+
+static int msm_slim_0_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+			SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+	channels->min = channels->max = msm_slim_0_tx_ch;
+
+	return 0;
+}
+
+static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+
+	return 0;
+}
+
+static int msm_hdmi_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s channels->min %u channels->max %u ()\n", __func__,
+			channels->min, channels->max);
+
+	rate->min = rate->max = 48000;
+
+	return 0;
+}
+
+static int msm_btsco_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	rate->min = rate->max = msm_btsco_rate;
+	channels->min = channels->max = msm_btsco_ch;
+
+	return 0;
+}
+static int msm_auxpcm_be_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	rate->min = rate->max = msm_auxpcm_rate;
+	
+	channels->min = channels->max = 1;
+
+	return 0;
+}
+static int msm_aux_pcm_get_gpios(void)
+{
+	int ret = 0;
+
+	pr_debug("%s\n", __func__);
+
+	ret = gpio_request(GPIO_AUX_PCM_DOUT, "AUX PCM DOUT");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM DOUT",
+				__func__, GPIO_AUX_PCM_DOUT);
+		goto fail_dout;
+	}
+
+	ret = gpio_request(GPIO_AUX_PCM_DIN, "AUX PCM DIN");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM DIN",
+				__func__, GPIO_AUX_PCM_DIN);
+		goto fail_din;
+	}
+
+	ret = gpio_request(GPIO_AUX_PCM_SYNC, "AUX PCM SYNC");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM SYNC",
+				__func__, GPIO_AUX_PCM_SYNC);
+		goto fail_sync;
+	}
+	ret = gpio_request(GPIO_AUX_PCM_CLK, "AUX PCM CLK");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM CLK",
+				__func__, GPIO_AUX_PCM_CLK);
+		goto fail_clk;
+	}
+
+	return 0;
+
+fail_clk:
+	gpio_free(GPIO_AUX_PCM_SYNC);
+fail_sync:
+	gpio_free(GPIO_AUX_PCM_DIN);
+fail_din:
+	gpio_free(GPIO_AUX_PCM_DOUT);
+fail_dout:
+
+	return ret;
+}
+
+static int msm_aux_pcm_free_gpios(void)
+{
+	gpio_free(GPIO_AUX_PCM_DIN);
+	gpio_free(GPIO_AUX_PCM_DOUT);
+	gpio_free(GPIO_AUX_PCM_SYNC);
+	gpio_free(GPIO_AUX_PCM_CLK);
+
+	return 0;
+}
+static int msm_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
+	pr_debug("%s(): dai_link_str_name = %s cpu_dai = %s codec_dai = %s\n",
+		__func__, rtd->dai_link->stream_name,
+		rtd->dai_link->cpu_dai_name, rtd->dai_link->codec_dai_name);
+	return 0;
+}
+
+static int msm_auxpcm_startup(struct snd_pcm_substream *substream)
+{
+	int ret = 0;
+
+	pr_debug("%s(): substream = %s\n", __func__, substream->name);
+	ret = msm_aux_pcm_get_gpios();
+	if (ret < 0) {
+		pr_err("%s: Aux PCM GPIO request failed\n", __func__);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static void msm_auxpcm_shutdown(struct snd_pcm_substream *substream)
+{
+
+	pr_debug("%s(): substream = %s\n", __func__, substream->name);
+	msm_aux_pcm_free_gpios();
+}
+
+static void msm_shutdown(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
+	pr_debug("%s(): dai_link str_name = %s cpu_dai = %s codec_dai = %s\n",
+		__func__, rtd->dai_link->stream_name,
+		rtd->dai_link->cpu_dai_name, rtd->dai_link->codec_dai_name);
+}
+
+static struct snd_soc_ops msm_be_ops = {
+	.startup = msm_startup,
+	.hw_params = msm_hw_params,
+	.shutdown = msm_shutdown,
+};
+
+static struct snd_soc_ops msm_auxpcm_be_ops = {
+	.startup = msm_auxpcm_startup,
+	.shutdown = msm_auxpcm_shutdown,
+};
+
+static struct snd_soc_ops msm_slimbus_2_be_ops = {
+	.startup = msm_startup,
+	.hw_params = msm_slimbus_2_hw_params,
+	.shutdown = msm_shutdown,
+};
+
+static struct snd_soc_dai_link msm_dai_common[] = {
+	
+	{
+		.name = "MSM8960 Media1",
+		.stream_name = "MultiMedia1",
+		.cpu_dai_name	= "MultiMedia1",
+		.platform_name  = "msm-pcm-dsp",
+		.dynamic = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA1
+	},
+	{
+		.name = "MSM8960 Media2",
+		.stream_name = "MultiMedia2",
+		.cpu_dai_name	= "MultiMedia2",
+		.platform_name  = "msm-multi-ch-pcm-dsp",
+		.dynamic = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA2,
+	},
+	{
+		.name = "Circuit-Switch Voice",
+		.stream_name = "CS-Voice",
+		.cpu_dai_name   = "CS-VOICE",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_CS_VOICE,
+	},
+	{
+		.name = "MSM VoIP",
+		.stream_name = "VoIP",
+		.cpu_dai_name	= "VoIP",
+		.platform_name  = "msm-voip-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_VOIP,
+	},
+	{
+		.name = "MSM8960 LPA",
+		.stream_name = "LPA",
+		.cpu_dai_name	= "MultiMedia3",
+		.platform_name  = "msm-pcm-lpa",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA3,
+	},
+	
+	{
+		.name = "SLIMBUS_0 Hostless",
+		.stream_name = "SLIMBUS_0 Hostless",
+		.cpu_dai_name	= "SLIMBUS0_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	{
+		.name = "INT_FM Hostless",
+		.stream_name = "INT_FM Hostless",
+		.cpu_dai_name	= "INT_FM_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	{
+		.name = "MSM AFE-PCM RX",
+		.stream_name = "AFE-PROXY RX",
+		.cpu_dai_name = "msm-dai-q6.241",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.platform_name  = "msm-pcm-afe",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = "MSM AFE-PCM TX",
+		.stream_name = "AFE-PROXY TX",
+		.cpu_dai_name = "msm-dai-q6.240",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.platform_name  = "msm-pcm-afe",
+		.ignore_suspend = 1,
+	},
+	{
+		.name = "MSM8960 Compr",
+		.stream_name = "COMPR",
+		.cpu_dai_name	= "MultiMedia4",
+		.platform_name  = "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA4,
+	},
+	{
+		.name = "AUXPCM Hostless",
+		.stream_name = "AUXPCM Hostless",
+		.cpu_dai_name	= "AUXPCM_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	
+	{
+		.name = "HDMI_RX_HOSTLESS",
+		.stream_name = "HDMI_RX_HOSTLESS",
+		.cpu_dai_name = "HDMI_HOSTLESS",
+		.platform_name = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	{
+		.name = "VoLTE",
+		.stream_name = "VoLTE",
+		.cpu_dai_name   = "VoLTE",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.be_id = MSM_FRONTEND_DAI_VOLTE,
+	},
+	{
+		.name = "Voice2",
+		.stream_name = "Voice2",
+		.cpu_dai_name   = "Voice2",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.be_id = MSM_FRONTEND_DAI_VOICE2,
+	},
+	{
+		.name = "MSM8960 LowLatency",
+		.stream_name = "MultiMedia5",
+		.cpu_dai_name	= "MultiMedia5",
+		.platform_name  = "msm-lowlatency-pcm-dsp",
+		.dynamic = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.ignore_suspend = 1,
+		/* this dainlink has playback support */
+		.ignore_pmdown_time = 1,
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA5,
+	},
+	
+	{
+		.name = LPASS_BE_INT_BT_SCO_RX,
+		.stream_name = "Internal BT-SCO Playback",
+		.cpu_dai_name = "msm-dai-q6.12288",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name	= "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_BT_SCO_RX,
+		.be_hw_params_fixup = msm_btsco_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = LPASS_BE_INT_BT_SCO_TX,
+		.stream_name = "Internal BT-SCO Capture",
+		.cpu_dai_name = "msm-dai-q6.12289",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name	= "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_BT_SCO_TX,
+		.be_hw_params_fixup = msm_btsco_be_hw_params_fixup,
+	},
+	{
+		.name = LPASS_BE_INT_FM_RX,
+		.stream_name = "Internal FM Playback",
+		.cpu_dai_name = "msm-dai-q6.12292",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_FM_RX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = LPASS_BE_INT_FM_TX,
+		.stream_name = "Internal FM Capture",
+		.cpu_dai_name = "msm-dai-q6.12293",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_FM_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	
+	{
+		.name = LPASS_BE_HDMI,
+		.stream_name = "HDMI Playback",
+		.cpu_dai_name = "msm-dai-q6-hdmi.8",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_HDMI_RX,
+		.be_hw_params_fixup = msm_hdmi_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, 
+	},
+	
+	{
+		.name = LPASS_BE_AFE_PCM_RX,
+		.stream_name = "AFE Playback",
+		.cpu_dai_name = "msm-dai-q6.224",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AFE_PCM_RX,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = LPASS_BE_AFE_PCM_TX,
+		.stream_name = "AFE Capture",
+		.cpu_dai_name = "msm-dai-q6.225",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AFE_PCM_TX,
+	},
+	
+	{
+		.name = LPASS_BE_AUXPCM_RX,
+		.stream_name = "AUX PCM Playback",
+		.cpu_dai_name = "msm-dai-q6.2",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AUXPCM_RX,
+		.be_hw_params_fixup = msm_auxpcm_be_params_fixup,
+		.ops = &msm_auxpcm_be_ops,
+		.ignore_pmdown_time = 1,
+	},
+	{
+		.name = LPASS_BE_AUXPCM_TX,
+		.stream_name = "AUX PCM Capture",
+		.cpu_dai_name = "msm-dai-q6.3",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AUXPCM_TX,
+		.be_hw_params_fixup = msm_auxpcm_be_params_fixup,
+	},
+	
+	{
+		.name = LPASS_BE_VOICE_PLAYBACK_TX,
+		.stream_name = "Voice Farend Playback",
+		.cpu_dai_name = "msm-dai-q6.32773",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	
+	{
+		.name = LPASS_BE_INCALL_RECORD_TX,
+		.stream_name = "Voice Uplink Capture",
+		.cpu_dai_name = "msm-dai-q6.32772",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INCALL_RECORD_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	
+	{
+		.name = LPASS_BE_INCALL_RECORD_RX,
+		.stream_name = "Voice Downlink Capture",
+		.cpu_dai_name = "msm-dai-q6.32771",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INCALL_RECORD_RX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = "MSM8960 Media5",
+		.stream_name = "MultiMedia5",
+		.cpu_dai_name	= "MultiMedia5",
+		.platform_name	= "msm-multi-ch-pcm-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+							SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA5
+	},
+	{
+		.name = "MSM8960 Media6",
+		.stream_name = "MultiMedia6",
+		.cpu_dai_name	= "MultiMedia6",
+		.platform_name	= "msm-multi-ch-pcm-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA6
+	},
+	{
+		.name = "MSM8960 Compr2",
+		.stream_name = "COMPR2",
+		.cpu_dai_name	= "MultiMedia7",
+		.platform_name	= "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA7,
+	},
+	{
+		.name = "MSM8960 Compr3",
+		.stream_name = "COMPR3",
+		.cpu_dai_name	= "MultiMedia8",
+		.platform_name	= "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA8,
+	},
+};
+
+static struct snd_soc_dai_link msm_dai_delta_tabla1x[] = {
+	
+	{
+		.name = LPASS_BE_SLIMBUS_0_RX,
+		.stream_name = "Slimbus Playback",
+		.cpu_dai_name = "msm-dai-q6.16384",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla1x_codec",
+		.codec_dai_name	= "tabla_rx1",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
+		.init = &msm_audrx_init,
+		.be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = LPASS_BE_SLIMBUS_0_TX,
+		.stream_name = "Slimbus Capture",
+		.cpu_dai_name = "msm-dai-q6.16385",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla1x_codec",
+		.codec_dai_name	= "tabla_tx1",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
+		.be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+	},
+	
+	{
+		.name = "SLIMBUS_2 Hostless Capture",
+		.stream_name = "SLIMBUS_2 Hostless Capture",
+		.cpu_dai_name = "msm-dai-q6.16389",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla1x_codec",
+		.codec_dai_name = "tabla_tx2",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_slimbus_2_be_ops,
+	},
+	
+	{
+		.name = "SLIMBUS_2 Hostless Playback",
+		.stream_name = "SLIMBUS_2 Hostless Playback",
+		.cpu_dai_name = "msm-dai-q6.16388",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla1x_codec",
+		.codec_dai_name = "tabla_rx3",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_slimbus_2_be_ops,
+	},
+};
+
+
+static struct snd_soc_dai_link msm_dai_delta_tabla2x[] = {
+	
+	{
+		.name = LPASS_BE_SLIMBUS_0_RX,
+		.stream_name = "Slimbus Playback",
+		.cpu_dai_name = "msm-dai-q6.16384",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla_codec",
+		.codec_dai_name	= "tabla_rx1",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
+		.init = &msm_audrx_init,
+		.be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = LPASS_BE_SLIMBUS_0_TX,
+		.stream_name = "Slimbus Capture",
+		.cpu_dai_name = "msm-dai-q6.16385",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla_codec",
+		.codec_dai_name	= "tabla_tx1",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
+		.be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+	},
+	
+	{
+		.name = "SLIMBUS_2 Hostless Capture",
+		.stream_name = "SLIMBUS_2 Hostless Capture",
+		.cpu_dai_name = "msm-dai-q6.16389",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla_codec",
+		.codec_dai_name = "tabla_tx2",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_slimbus_2_be_ops,
+	},
+	
+	{
+		.name = "SLIMBUS_2 Hostless Playback",
+		.stream_name = "SLIMBUS_2 Hostless Playback",
+		.cpu_dai_name = "msm-dai-q6.16388",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla_codec",
+		.codec_dai_name = "tabla_rx3",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_slimbus_2_be_ops,
+	},
+};
+
+static struct snd_soc_dai_link msm_tabla1x_dai[
+					 ARRAY_SIZE(msm_dai_common) +
+					 ARRAY_SIZE(msm_dai_delta_tabla1x)];
+
+
+static struct snd_soc_dai_link msm_dai[
+					 ARRAY_SIZE(msm_dai_common) +
+					 ARRAY_SIZE(msm_dai_delta_tabla2x)];
+
+static struct snd_soc_card snd_soc_tabla1x_card_msm = {
+		.name		= "msm-tabla1x-snd-card",
+		.dai_link	= msm_tabla1x_dai,
+		.num_links	= ARRAY_SIZE(msm_tabla1x_dai),
+		.controls = tabla_msm_controls,
+		.num_controls = ARRAY_SIZE(tabla_msm_controls),
+};
+
+static struct snd_soc_card snd_soc_card_msm = {
+		.name		= "msm-snd-card",
+		.dai_link	= msm_dai,
+		.num_links	= ARRAY_SIZE(msm_dai),
+		.controls = tabla_msm_controls,
+		.num_controls = ARRAY_SIZE(tabla_msm_controls),
+};
+
+static struct platform_device *msm_snd_device;
+static struct platform_device *msm_snd_tabla1x_device;
+
+static int __init elite_audio_init(void)
+{
+	int ret;
+
+	if (!cpu_is_msm8960()) {
+		pr_err("%s: Not the right machine type\n", __func__);
+		return -ENODEV;
+	}
+	pr_debug("%s", __func__);
+
+	msm_snd_device = platform_device_alloc("soc-audio", 0);
+	if (!msm_snd_device) {
+		pr_err("Platform device allocation failed\n");
+		return -ENOMEM;
+	}
+
+	memcpy(msm_dai, msm_dai_common, sizeof(msm_dai_common));
+	memcpy(msm_dai + ARRAY_SIZE(msm_dai_common),
+		msm_dai_delta_tabla2x, sizeof(msm_dai_delta_tabla2x));
+
+	platform_set_drvdata(msm_snd_device, &snd_soc_card_msm);
+	ret = platform_device_add(msm_snd_device);
+	if (ret) {
+		platform_device_put(msm_snd_device);
+		return ret;
+	}
+
+	msm_snd_tabla1x_device = platform_device_alloc("soc-audio", 1);
+	if (!msm_snd_tabla1x_device) {
+		pr_err("Platform device allocation failed\n");
+		return -ENOMEM;
+	}
+
+	memcpy(msm_tabla1x_dai, msm_dai_common,
+		sizeof(msm_dai_common));
+	memcpy(msm_tabla1x_dai + ARRAY_SIZE(msm_dai_common),
+		msm_dai_delta_tabla1x, sizeof(msm_dai_delta_tabla1x));
+
+	platform_set_drvdata(msm_snd_tabla1x_device,
+		&snd_soc_tabla1x_card_msm);
+	ret = platform_device_add(msm_snd_tabla1x_device);
+	if (ret) {
+		platform_device_put(msm_snd_tabla1x_device);
+		return ret;
+	}
+
+	mutex_init(&audio_notifier_lock);
+	pr_debug("%s: register cable detect func for dock", __func__);
+	ret = cable_detect_register_notifier(&audio_dock_notifier);
+
+	mutex_init(&cdc_mclk_mutex);
+
+	return ret;
+
+}
+late_initcall(elite_audio_init);
+
+static void __exit elite_audio_exit(void)
+{
+
+	if (!cpu_is_msm8960()) {
+		pr_err("%s: Not the right machine type\n", __func__);
+		return;
+	}
+	pr_debug("%s", __func__);
+
+	platform_device_unregister(msm_snd_device);
+	platform_device_unregister(msm_snd_tabla1x_device);
+	mutex_destroy(&audio_notifier_lock);
+	mutex_destroy(&cdc_mclk_mutex);
+}
+module_exit(elite_audio_exit);
+
+MODULE_DESCRIPTION("ALSA Platform Elite");
+MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-msm/htc/elite/board-elite-camera.c b/arch/arm/mach-msm/htc/elite/board-elite-camera.c
new file mode 100644
index 0000000..02b3d70
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/board-elite-camera.c
@@ -0,0 +1,1470 @@
+/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <asm/mach-types.h>
+#include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <mach/board.h>
+#include <mach/msm_bus_board.h>
+#include <mach/gpiomux.h>
+#include <asm/setup.h>
+
+#include "devices.h"
+#include "board-elite.h"
+
+#include <linux/spi/spi.h>
+
+#include "board-mahimahi-flashlight.h"
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#include <linux/htc_flashlight.h>
+#endif
+
+#ifdef CONFIG_MSM_CAMERA
+#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4	
+static struct platform_device msm_camera_server = {
+	.name = "msm_cam_server",
+	.id = 0,
+};
+
+static struct gpiomux_setting cam_settings[11] = {
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_DOWN,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_1, 
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_OUT_LOW,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_1, 
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_2, 
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_4MA,
+		.pull = GPIOMUX_PULL_DOWN,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_2, 
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_OUT_HIGH,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_OUT_LOW,
+	},
+};
+
+static struct msm_gpiomux_config elite_cam_configs[] = {
+	{
+		.gpio = ELITE_GPIO_CAM_MCLK1,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[4], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[2], 
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_CAM_MCLK0,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[1], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[2], 
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_CAM_I2C_DAT,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[3], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[0],
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_CAM_I2C_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[3], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[0],
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_RAW_INTR0,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[7], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[8], 
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_RAW_INTR1,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[7], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[8], 
+		},
+	},
+	
+	{
+		.gpio      = ELITE_GPIO_MCAM_SPI_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[4], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[2], 
+		},
+	},
+	{
+		.gpio      = ELITE_GPIO_MCAM_SPI_CS0,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[6], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[10], 
+		},
+	},
+	{
+		.gpio      = ELITE_GPIO_MCAM_SPI_DI,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[4], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[0], 
+		},
+	},
+	{
+		.gpio      = ELITE_GPIO_MCAM_SPI_DO,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[4], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[2], 
+		},
+	},
+};
+
+static struct msm_bus_vectors cam_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+};
+
+static struct msm_bus_vectors cam_preview_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 96215040,
+		.ib  = 378224640,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+};
+
+static struct msm_bus_vectors cam_video_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 342150912,
+		.ib  = 1361968128,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 207747072,
+		.ib  = 489756672,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 60318720,
+		.ib  = 150796800,
+	},
+};
+
+static struct msm_bus_vectors cam_snapshot_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 147045888,
+		.ib  = 588183552,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 263678976,
+		.ib  = 659197440,
+	},
+};
+
+static struct msm_bus_vectors cam_zsl_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 319044096,
+		.ib  = 1271531520,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 239708160,
+		.ib  = 599270400,
+	},
+};
+
+static struct msm_bus_paths cam_bus_client_config[] = {
+	{
+		ARRAY_SIZE(cam_init_vectors),
+		cam_init_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_preview_vectors),
+		cam_preview_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_video_vectors),
+		cam_video_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_snapshot_vectors),
+		cam_snapshot_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_zsl_vectors),
+		cam_zsl_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata cam_bus_client_pdata = {
+		cam_bus_client_config,
+		ARRAY_SIZE(cam_bus_client_config),
+		.name = "msm_camera",
+};
+
+static int elite_csi_vreg_on(void);
+static int elite_csi_vreg_off(void);
+
+struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
+	{
+		.ioclk.mclk_clk_rate = 24000000,
+		.ioclk.vfe_clk_rate  = 228570000,
+		.csid_core = 0,
+		.camera_csi_on = elite_csi_vreg_on,
+		.camera_csi_off = elite_csi_vreg_off,
+		.cam_bus_scale_table = &cam_bus_client_pdata,
+		.csid_core = 0,
+		.is_csiphy = 1,
+		.is_csid   = 1,
+		.is_ispif  = 1,
+		.is_vpe    = 1,
+	},
+	{
+		.ioclk.mclk_clk_rate = 24000000,
+		.ioclk.vfe_clk_rate  = 228570000,
+		.csid_core = 1,
+		.camera_csi_on = elite_csi_vreg_on,
+		.camera_csi_off = elite_csi_vreg_off,
+		.cam_bus_scale_table = &cam_bus_client_pdata,
+		.csid_core = 1,
+		.is_csiphy = 1,
+		.is_csid   = 1,
+		.is_ispif  = 1,
+		.is_vpe    = 1,
+	},
+};
+
+#ifdef CONFIG_MSM_CAMERA_FLASH
+int flashlight_control(int mode)
+{
+pr_info("%s, linear led, mode=%d", __func__, mode);
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+	return tps61310_flashlight_control(mode);
+#else
+	return 0;
+#endif
+}
+
+static struct msm_camera_sensor_flash_src msm_flash_src = {
+	.flash_sr_type = MSM_CAMERA_FLASH_SRC_CURRENT_DRIVER,
+	.camera_flash = flashlight_control,
+};
+#endif /* CONFIG_MSM_CAMERA_FLASH */
+
+#ifdef CONFIG_RAWCHIP
+static int elite_use_ext_1v2(void)
+{
+	if (system_rev >= 1) 
+		return 1;
+	else 
+		return 0;
+}
+
+#define ELITE_V_RAW_1V2_EN PM8921_GPIO_PM_TO_SYS(ELITE_PMGPIO_V_RAW_1V2_EN)
+static int elite_rawchip_vreg_on(void)
+{
+	int rc;
+	pr_info("%s\n", __func__);
+
+	
+	rc = gpio_request(ELITE_GPIO_V_RAW_1V8_EN, "V_RAW_1V8_EN");
+	if (rc) {
+		pr_err("rawchip on\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_GPIO_V_RAW_1V8_EN, rc);
+		goto enable_1v8_fail;
+	}
+	gpio_direction_output(ELITE_GPIO_V_RAW_1V8_EN, 1);
+	gpio_free(ELITE_GPIO_V_RAW_1V8_EN);
+
+	mdelay(5);
+
+	if (system_rev >= 0 && system_rev <= 3) { 
+	
+	rc = gpio_request(ELITE_V_RAW_1V2_EN, "V_RAW_1V2_EN");
+	if (rc) {
+		pr_err("rawchip on\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_V_RAW_1V2_EN, rc);
+		goto enable_1v2_fail;
+	}
+	gpio_direction_output(ELITE_V_RAW_1V2_EN, 1);
+	gpio_free(ELITE_V_RAW_1V2_EN);
+	}
+
+	if (system_rev >= 1) { 
+		if (elite_use_ext_1v2()) { 
+			mdelay(1);
+
+			rc = gpio_request(ELITE_GPIO_V_CAM_D1V2_EN, "rawchip");
+			pr_info("rawchip external 1v2 gpio_request,%d\n", ELITE_GPIO_V_CAM_D1V2_EN);
+			if (rc < 0) {
+				pr_err("GPIO(%d) request failed", ELITE_GPIO_V_CAM_D1V2_EN);
+				goto enable_ext_1v2_fail;
+			}
+			gpio_direction_output(ELITE_GPIO_V_CAM_D1V2_EN, 1);
+			gpio_free(ELITE_GPIO_V_CAM_D1V2_EN);
+		}
+	}
+
+	return rc;
+
+enable_ext_1v2_fail:
+	if (system_rev >= 0 && system_rev <= 3) { 
+	rc = gpio_request(ELITE_V_RAW_1V2_EN, "V_RAW_1V2_EN");
+	if (rc)
+		pr_err("rawchip on\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_V_RAW_1V2_EN, rc);
+	gpio_direction_output(ELITE_V_RAW_1V2_EN, 0);
+	gpio_free(ELITE_V_RAW_1V2_EN);
+	}
+enable_1v2_fail:
+	rc = gpio_request(ELITE_GPIO_V_RAW_1V8_EN, "V_RAW_1V8_EN");
+	if (rc)
+		pr_err("rawchip on\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_GPIO_V_RAW_1V8_EN, rc);
+	gpio_direction_output(ELITE_GPIO_V_RAW_1V8_EN, 0);
+	gpio_free(ELITE_GPIO_V_RAW_1V8_EN);
+enable_1v8_fail:
+	return rc;
+}
+
+static int elite_rawchip_vreg_off(void)
+{
+	int rc = 0;
+
+	pr_info("%s\n", __func__);
+
+	if (system_rev >= 1) { 
+		if (elite_use_ext_1v2()) { 
+			rc = gpio_request(ELITE_GPIO_V_CAM_D1V2_EN, "rawchip");
+			if (rc)
+				pr_err("rawchip off(\
+					\"gpio %d\", 1.2V) FAILED %d\n",
+					ELITE_GPIO_V_CAM_D1V2_EN, rc);
+			gpio_direction_output(ELITE_GPIO_V_CAM_D1V2_EN, 0);
+			gpio_free(ELITE_GPIO_V_CAM_D1V2_EN);
+
+			mdelay(1);
+		}
+	}
+
+	if (system_rev >= 0 && system_rev <= 3) { 
+	rc = gpio_request(ELITE_V_RAW_1V2_EN, "V_RAW_1V2_EN");
+	if (rc)
+		pr_err("rawchip off(\
+			\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_V_RAW_1V2_EN, rc);
+	gpio_direction_output(ELITE_V_RAW_1V2_EN, 0);
+	gpio_free(ELITE_V_RAW_1V2_EN);
+	}
+
+	mdelay(5);
+
+	rc = gpio_request(ELITE_GPIO_V_RAW_1V8_EN, "V_RAW_1V8_EN");
+	if (rc)
+		pr_err("rawchip off\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_GPIO_V_RAW_1V8_EN, rc);
+	gpio_direction_output(ELITE_GPIO_V_RAW_1V8_EN, 0);
+	gpio_free(ELITE_GPIO_V_RAW_1V8_EN);
+
+	return rc;
+}
+
+static struct msm_camera_rawchip_info msm_rawchip_board_info = {
+	.rawchip_reset	= ELITE_GPIO_RAW_RSTN,
+	.rawchip_intr0	= MSM_GPIO_TO_INT(ELITE_GPIO_RAW_INTR0),
+	.rawchip_intr1	= MSM_GPIO_TO_INT(ELITE_GPIO_RAW_INTR1),
+	.rawchip_spi_freq = 27, 
+	.rawchip_mclk_freq = 24, 
+	.camera_rawchip_power_on = elite_rawchip_vreg_on,
+	.camera_rawchip_power_off = elite_rawchip_vreg_off,
+	.rawchip_use_ext_1v2 = elite_use_ext_1v2,
+};
+
+struct platform_device msm_rawchip_device = {
+	.name	= "rawchip",
+	.dev	= {
+		.platform_data = &msm_rawchip_board_info,
+	},
+};
+#endif /* CONFIG_RAWCHIP */
+
+static uint16_t msm_cam_gpio_tbl[] = {
+	ELITE_GPIO_CAM_MCLK0, 
+	ELITE_GPIO_CAM_MCLK1,
+	ELITE_GPIO_RAW_INTR0,
+	ELITE_GPIO_RAW_INTR1,
+	ELITE_GPIO_MCAM_SPI_CLK,
+	ELITE_GPIO_MCAM_SPI_CS0,
+	ELITE_GPIO_MCAM_SPI_DI,
+	ELITE_GPIO_MCAM_SPI_DO,
+};
+
+static struct msm_camera_gpio_conf gpio_conf = {
+	.cam_gpiomux_conf_tbl = NULL,
+	.cam_gpiomux_conf_tbl_size = 0,
+	.cam_gpio_tbl = msm_cam_gpio_tbl,
+	.cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_tbl),
+};
+
+static struct regulator *reg_8921_l2;
+static struct regulator *reg_8921_l8;
+static struct regulator *reg_8921_l9;
+static struct regulator *reg_8921_lvs5;
+static struct regulator *reg_8921_lvs6;
+
+static int camera_sensor_power_enable(char *power, unsigned volt, struct regulator **sensor_power)
+{
+	int rc;
+
+	if (power == NULL)
+		return -ENODEV;
+
+	*sensor_power = regulator_get(NULL, power);
+
+	if (IS_ERR(*sensor_power)) {
+		pr_info("%s: failed to Unable to get %s\n", __func__, power);
+		return -ENODEV;
+	}
+
+	if (volt != 1800000) {
+		rc = regulator_set_voltage(*sensor_power, volt, volt);
+		if (rc < 0) {
+			pr_info("%s: failed to unable to set %s voltage to %d rc:%d\n",
+					__func__, power, volt, rc);
+			regulator_put(*sensor_power);
+			*sensor_power = NULL;
+			return -ENODEV;
+		}
+	}
+
+	rc = regulator_enable(*sensor_power);
+	if (rc < 0) {
+		pr_info("%s: failed to Enable regulator %s failed\n", __func__, power);
+		regulator_put(*sensor_power);
+		*sensor_power = NULL;
+		return -ENODEV;
+	}
+
+	return rc;
+}
+
+static int camera_sensor_power_disable(struct regulator *sensor_power)
+{
+
+	int rc;
+	if (sensor_power == NULL)
+		return -ENODEV;
+
+	if (IS_ERR(sensor_power)) {
+		pr_info("%s: failed to Invalid requlator ptr\n", __func__);
+		return -ENODEV;
+	}
+
+	rc = regulator_disable(sensor_power);
+	if (rc < 0)
+		pr_info("%s: disable regulator failed\n", __func__);
+
+	regulator_put(sensor_power);
+	sensor_power = NULL;
+	return rc;
+}
+
+static int elite_csi_vreg_on(void)
+{
+	pr_info("%s\n", __func__);
+	return camera_sensor_power_enable("8921_l2", 1200000, &reg_8921_l2);
+}
+
+static int elite_csi_vreg_off(void)
+{
+	pr_info("%s\n", __func__);
+	return camera_sensor_power_disable(reg_8921_l2);
+}
+
+
+#ifdef CONFIG_S5K3H2YX
+static int elite_s5k3h2yx_vreg_on(void)
+{
+	int rc;
+	pr_info("%s\n", __func__);
+
+	
+	rc = camera_sensor_power_enable("8921_l9", 2800000, &reg_8921_l9);
+	if (rc < 0) {
+		pr_err("sensor_power_enable\
+			(\"8921_l9\", 2.8V) FAILED %d\n", rc);
+		goto enable_vcm_fail;
+	}
+	mdelay(1);
+
+	
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);
+	if (rc < 0) {
+		pr_err("sensor_power_enable\
+			(\"8921_l8\", 2.8V) FAILED %d\n", rc);
+		goto enable_analog_fail;
+	}
+	mdelay(1);
+
+	if (system_rev == 0 || !elite_use_ext_1v2()) { 
+	
+	rc = gpio_request(ELITE_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc) {
+		pr_err("sensor_power_enable\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_GPIO_V_CAM_D1V2_EN, rc);
+		goto enable_digital_fail;
+	}
+	gpio_direction_output(ELITE_GPIO_V_CAM_D1V2_EN, 1);
+	gpio_free(ELITE_GPIO_V_CAM_D1V2_EN);
+	mdelay(1);
+	}
+
+	
+	rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+	if (rc < 0) {
+		pr_err("sensor_power_enable\
+			(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+		goto enable_io_fail;
+	}
+
+	return rc;
+
+enable_io_fail:
+	if (system_rev == 0 || !elite_use_ext_1v2()) { 
+	rc = gpio_request(ELITE_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc < 0)
+		pr_err("sensor_power_disable\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_GPIO_V_CAM_D1V2_EN, rc);
+	else {
+		gpio_direction_output(ELITE_GPIO_V_CAM_D1V2_EN, 0);
+		gpio_free(ELITE_GPIO_V_CAM_D1V2_EN);
+	}
+	}
+enable_digital_fail:
+	camera_sensor_power_disable(reg_8921_l8);
+enable_analog_fail:
+	camera_sensor_power_disable(reg_8921_l9);
+enable_vcm_fail:
+	return rc;
+}
+
+static int elite_s5k3h2yx_vreg_off(void)
+{
+	int rc = 0;
+
+	pr_info("%s\n", __func__);
+
+	
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	if (rc < 0)
+		pr_err("sensor_power_disable\
+			(\"8921_l8\") FAILED %d\n", rc);
+	mdelay(1);
+
+	if (system_rev == 0 || !elite_use_ext_1v2()) { 
+	
+	rc = gpio_request(ELITE_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc < 0)
+		pr_err("sensor_power_disable\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_GPIO_V_CAM_D1V2_EN, rc);
+	else {
+		gpio_direction_output(ELITE_GPIO_V_CAM_D1V2_EN, 0);
+		gpio_free(ELITE_GPIO_V_CAM_D1V2_EN);
+	}
+	mdelay(1);
+	}
+
+	
+	rc = camera_sensor_power_disable(reg_8921_lvs6);
+	if (rc < 0)
+		pr_err("sensor_power_disable\
+			(\"8921_lvs6\") FAILED %d\n", rc);
+
+	mdelay(1);
+
+	
+	rc = camera_sensor_power_disable(reg_8921_l9);
+	if (rc < 0)
+		pr_err("sensor_power_disable\
+			(\"8921_l9\") FAILED %d\n", rc);
+
+	return rc;
+}
+
+#ifdef CONFIG_S5K3H2YX_ACT
+static struct i2c_board_info s5k3h2yx_actuator_i2c_info = {
+	I2C_BOARD_INFO("s5k3h2yx_act", 0x11),
+};
+
+static struct msm_actuator_info s5k3h2yx_actuator_info = {
+	.board_info     = &s5k3h2yx_actuator_i2c_info,
+	.bus_id         = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+	.vcm_pwd        = ELITE_GPIO_CAM_VCM_PD,
+	.vcm_enable     = 1,
+};
+#endif
+
+static struct msm_camera_csi_lane_params s5k3h2yx_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x3,
+};
+
+static struct msm_camera_sensor_platform_info sensor_s5k3h2yx_board_info = {
+	.mount_angle = 90,
+	.mirror_flip = CAMERA_SENSOR_NONE,
+	.sensor_reset_enable = 0,
+	.sensor_reset	= 0,
+	.sensor_pwd	= ELITE_GPIO_CAM_PWDN,
+	.vcm_pwd	= ELITE_GPIO_CAM_VCM_PD,
+	.vcm_enable	= 1,
+	.csi_lane_params = &s5k3h2yx_csi_lane_params,
+};
+
+static struct camera_led_est msm_camera_sensor_s5k3h2yx_led_table[] = {
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,
+		.min_step = 29,
+		.max_step = 128
+	},
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL3,
+		.current_ma = 300,
+		.lumen_value = 350,
+		.min_step = 27,
+		.max_step = 28
+	},
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL4,
+		.current_ma = 400,
+		.lumen_value = 440,
+		.min_step = 25,
+		.max_step = 26
+	},
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL6,
+		.current_ma = 600,
+		.lumen_value = 625,
+		.min_step = 23,
+		.max_step = 24
+	},
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 745,
+		.min_step = 0,
+		.max_step = 22    
+	},
+
+		{
+		.enable = 2,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,
+		.min_step = 0,
+		.max_step = 270
+	},
+		{
+		.enable = 0,
+		.led_state = FL_MODE_OFF,
+		.current_ma = 0,
+		.lumen_value = 0,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH,
+		.current_ma = 150,
+		.lumen_value = 150,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 2,     
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 745,
+		.min_step = 271,
+		.max_step = 317    
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL5,
+		.current_ma = 500,
+		.lumen_value = 500,
+		.min_step = 25,
+		.max_step = 26
+	},
+		{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 750,
+		.min_step = 271,
+		.max_step = 325
+	},
+
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH_LEVEL_2,
+		.current_ma = 200,
+		.lumen_value = 75,
+		.min_step = 0,
+		.max_step = 40
+	},};
+
+static struct camera_led_info msm_camera_sensor_s5k3h2yx_led_info = {
+	.enable = 1,
+	.low_limit_led_state = FL_MODE_TORCH,
+	.max_led_current_ma = 750,  
+	.num_led_est_table = ARRAY_SIZE(msm_camera_sensor_s5k3h2yx_led_table),
+};
+
+static struct camera_flash_info msm_camera_sensor_s5k3h2yx_flash_info = {
+	.led_info = &msm_camera_sensor_s5k3h2yx_led_info,
+	.led_est_table = msm_camera_sensor_s5k3h2yx_led_table,
+};
+
+static struct camera_flash_cfg msm_camera_sensor_s5k3h2yx_flash_cfg = {
+	.low_temp_limit		= 5,
+	.low_cap_limit		= 15,
+	.flash_info             = &msm_camera_sensor_s5k3h2yx_flash_info,
+};
+
+static struct msm_camera_sensor_flash_data flash_s5k3h2yx = {
+	.flash_type	= MSM_CAMERA_FLASH_LED,
+#ifdef CONFIG_MSM_CAMERA_FLASH
+	.flash_src	= &msm_flash_src,
+#endif
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_s5k3h2yx_data = {
+	.sensor_name	= "s5k3h2yx",
+	.camera_power_on = elite_s5k3h2yx_vreg_on,
+	.camera_power_off = elite_s5k3h2yx_vreg_off,
+	.pdata	= &msm_camera_csi_device_data[0],
+	.flash_data	= &flash_s5k3h2yx,
+	.sensor_platform_info = &sensor_s5k3h2yx_board_info,
+	.gpio_conf = &gpio_conf,
+	.csi_if	= 1,
+	.camera_type = BACK_CAMERA_2D,
+#ifdef CONFIG_S5K3H2YX_ACT
+	.actuator_info = &s5k3h2yx_actuator_info,
+#endif
+	.use_rawchip = RAWCHIP_ENABLE, 
+	.flash_cfg = &msm_camera_sensor_s5k3h2yx_flash_cfg, 
+};
+
+#endif /* CONFIG_S5K3H2YX */
+
+#ifdef CONFIG_IMX175_2LANE
+static int elite_imx175_vreg_on(void)
+{
+	int rc;
+	pr_info("[CAM] %s\n", __func__);
+
+	
+	rc = camera_sensor_power_enable("8921_l9", 2800000, &reg_8921_l9);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable\
+			(\"8921_l9\", 2.8V) FAILED %d\n", rc);
+		goto enable_vcm_fail;
+	}
+	mdelay(1);
+
+	
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable\
+			(\"8921_l8\", 2.8V) FAILED %d\n", rc);
+		goto enable_analog_fail;
+	}
+	mdelay(1);
+
+	if (system_rev == 0 || !elite_use_ext_1v2()) { 
+	
+	rc = gpio_request(ELITE_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc) {
+		pr_err("[CAM] sensor_power_enable\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_GPIO_V_CAM_D1V2_EN, rc);
+		goto enable_digital_fail;
+	}
+	gpio_direction_output(ELITE_GPIO_V_CAM_D1V2_EN, 1);
+	gpio_free(ELITE_GPIO_V_CAM_D1V2_EN);
+	mdelay(1);
+	}
+
+	
+	rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable\
+			(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+		goto enable_io_fail;
+	}
+
+	return rc;
+
+enable_io_fail:
+	if (system_rev == 0 || !elite_use_ext_1v2()) { 
+	rc = gpio_request(ELITE_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_GPIO_V_CAM_D1V2_EN, rc);
+	else {
+		gpio_direction_output(ELITE_GPIO_V_CAM_D1V2_EN, 0);
+		gpio_free(ELITE_GPIO_V_CAM_D1V2_EN);
+	}
+	}
+enable_digital_fail:
+	camera_sensor_power_disable(reg_8921_l8);
+enable_analog_fail:
+	camera_sensor_power_disable(reg_8921_l9);
+enable_vcm_fail:
+	return rc;
+}
+
+static int elite_imx175_vreg_off(void)
+{
+	int rc = 0;
+
+	pr_info("[CAM] %s\n", __func__);
+
+	
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable\
+			(\"8921_l8\") FAILED %d\n", rc);
+	mdelay(1);
+
+	if (system_rev == 0 || !elite_use_ext_1v2()) { 
+	
+	rc = gpio_request(ELITE_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			ELITE_GPIO_V_CAM_D1V2_EN, rc);
+	else {
+		gpio_direction_output(ELITE_GPIO_V_CAM_D1V2_EN, 0);
+		gpio_free(ELITE_GPIO_V_CAM_D1V2_EN);
+	}
+	mdelay(1);
+	}
+
+	
+	rc = camera_sensor_power_disable(reg_8921_lvs6);
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable\
+			(\"8921_lvs6\") FAILED %d\n", rc);
+
+	mdelay(1);
+
+	
+	rc = camera_sensor_power_disable(reg_8921_l9);
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable\
+			(\"8921_l9\") FAILED %d\n", rc);
+
+	return rc;
+}
+
+#ifdef CONFIG_IMX175_ACT
+static struct i2c_board_info imx175_actuator_i2c_info = {
+	I2C_BOARD_INFO("imx175_act", 0x11),
+};
+
+static struct msm_actuator_info imx175_actuator_info = {
+	.board_info     = &imx175_actuator_i2c_info,
+	.bus_id         = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+	.vcm_pwd        = ELITE_GPIO_CAM_VCM_PD,
+	.vcm_enable     = 1,
+};
+#endif
+
+static struct msm_camera_csi_lane_params imx175_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x3,
+};
+
+static struct msm_camera_sensor_platform_info sensor_imx175_board_info = {
+	.mount_angle = 90,
+	.mirror_flip = CAMERA_SENSOR_MIRROR_FLIP,
+	.sensor_reset_enable = 0,
+	.sensor_reset	= 0,
+	.sensor_pwd	= ELITE_GPIO_CAM_PWDN,
+	.vcm_pwd	= ELITE_GPIO_CAM_VCM_PD,
+	.vcm_enable	= 1,
+	.csi_lane_params = &imx175_csi_lane_params,
+};
+
+static struct camera_led_est msm_camera_sensor_imx175_led_table[] = {
+	{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,
+		.min_step = 58,
+		.max_step = 256
+	},
+	{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL3,
+		.current_ma = 300,
+		.lumen_value = 350,
+		.min_step = 54,
+		.max_step = 57
+	},
+	{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL4,
+		.current_ma = 400,
+		.lumen_value = 440,
+		.min_step = 50,
+		.max_step = 53
+	},
+	{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL6,
+		.current_ma = 600,
+		.lumen_value = 625,
+		.min_step = 46,
+		.max_step = 49
+	},
+	{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 745,
+		.min_step = 0,
+		.max_step = 45    
+	},
+	{
+		.enable = 2,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,
+		.min_step = 0,
+		.max_step = 270
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_OFF,
+		.current_ma = 0,
+		.lumen_value = 0,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH,
+		.current_ma = 150,
+		.lumen_value = 150,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 2,     
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 745,
+		.min_step = 271,
+		.max_step = 317    
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL5,
+		.current_ma = 500,
+		.lumen_value = 500,
+		.min_step = 25,
+		.max_step = 26
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 750,
+		.min_step = 271,
+		.max_step = 325
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH_LEVEL_2,
+		.current_ma = 200,
+		.lumen_value = 75,
+		.min_step = 0,
+		.max_step = 40
+	},
+};
+
+static struct camera_led_info msm_camera_sensor_imx175_led_info = {
+	.enable = 1,
+	.low_limit_led_state = FL_MODE_TORCH,
+	.max_led_current_ma = 750,  
+	.num_led_est_table = ARRAY_SIZE(msm_camera_sensor_imx175_led_table),
+};
+
+static struct camera_flash_info msm_camera_sensor_imx175_flash_info = {
+	.led_info = &msm_camera_sensor_imx175_led_info,
+	.led_est_table = msm_camera_sensor_imx175_led_table,
+};
+
+static struct camera_flash_cfg msm_camera_sensor_imx175_flash_cfg = {
+	.low_temp_limit		= 5,
+	.low_cap_limit		= 15,
+	.flash_info             = &msm_camera_sensor_imx175_flash_info,
+};
+
+static struct msm_camera_sensor_flash_data flash_imx175 = {
+	.flash_type	= MSM_CAMERA_FLASH_LED,
+#ifdef CONFIG_MSM_CAMERA_FLASH
+	.flash_src	= &msm_flash_src,
+#endif
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_imx175_data = {
+	.sensor_name	= "imx175",
+	.camera_power_on = elite_imx175_vreg_on,
+	.camera_power_off = elite_imx175_vreg_off,
+	.pdata	= &msm_camera_csi_device_data[0],
+	.flash_data	= &flash_imx175,
+	.sensor_platform_info = &sensor_imx175_board_info,
+	.gpio_conf = &gpio_conf,
+	.csi_if	= 1,
+	.camera_type = BACK_CAMERA_2D,
+#ifdef CONFIG_IMX175_ACT
+	.actuator_info = &imx175_actuator_info,
+#endif
+	.use_rawchip = RAWCHIP_ENABLE,
+	.flash_cfg = &msm_camera_sensor_imx175_flash_cfg, 
+};
+#endif /* CONFIG_IMX175_2LANE */
+
+#ifdef CONFIG_S5K6A1GX
+#define ELITE_XB_GPIO_V_CAM2_D1V2_EN 93
+static int elite_s5k6a1gx_vreg_on(void)
+{
+	int rc;
+	pr_info("%s\n", __func__);
+
+	
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);
+	pr_info("sensor_power_enable(\"8921_l8\", 2.8V) == %d\n", rc);
+	if (rc < 0) {
+		pr_err("sensor_power_enable(\"8921_l8\", 2.8V) FAILED %d\n", rc);
+		goto enable_analog_fail;
+	}
+	udelay(50);
+
+	
+	if (system_rev >= 1) { 
+		rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+		if (rc < 0) {
+			pr_err("sensor_power_enable\
+				(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+			goto enable_io_fail;
+		}
+	} else { 
+		rc = camera_sensor_power_enable("8921_lvs5", 1800000, &reg_8921_lvs5);
+		pr_info("sensor_power_enable(\"8921_lvs5\", 1.8V) == %d\n", rc);
+		if (rc < 0) {
+			pr_err("sensor_power_enable(\"8921_lvs5\", 1.8V) FAILED %d\n", rc);
+			goto enable_io_fail;
+		}
+
+	}
+	udelay(50);
+
+	if (system_rev == 0) { 
+		
+		rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+		if (rc < 0) {
+			pr_err("sensor_power_enable\
+				(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+			goto enable_i2c_pullup_fail;
+		}
+	}
+
+	
+	rc = gpio_request(ELITE_GPIO_CAM2_RSTz, "s5k6a1gx");
+	pr_info("reset pin gpio_request,%d\n", ELITE_GPIO_CAM2_RSTz);
+	if (rc < 0) {
+		pr_err("GPIO(%d) request failed", ELITE_GPIO_CAM2_RSTz);
+		goto enable_rst_fail;
+	}
+	gpio_direction_output(ELITE_GPIO_CAM2_RSTz, 1);
+	gpio_free(ELITE_GPIO_CAM2_RSTz);
+	udelay(50);
+
+	
+	if (system_rev >= 1) { 
+		rc = gpio_request(ELITE_XB_GPIO_V_CAM2_D1V2_EN, "s5k6a1gx");
+		pr_info("reset pin gpio_request,%d\n", ELITE_XB_GPIO_V_CAM2_D1V2_EN);
+		if (rc < 0) {
+			pr_err("GPIO(%d) request failed", ELITE_XB_GPIO_V_CAM2_D1V2_EN);
+			goto enable_digital_fail;
+		}
+		gpio_direction_output(ELITE_XB_GPIO_V_CAM2_D1V2_EN, 1);
+		gpio_free(ELITE_XB_GPIO_V_CAM2_D1V2_EN);
+	} else { 
+		rc = gpio_request(ELITE_GPIO_V_CAM_D1V2_EN, "s5k6a1gx");
+		pr_info("digital gpio_request,%d\n", ELITE_GPIO_V_CAM_D1V2_EN);
+		if (rc < 0) {
+			pr_err("GPIO(%d) request failed", ELITE_GPIO_V_CAM_D1V2_EN);
+			goto enable_digital_fail;
+		}
+		gpio_direction_output(ELITE_GPIO_V_CAM_D1V2_EN, 1);
+		gpio_free(ELITE_GPIO_V_CAM_D1V2_EN);
+	}
+	udelay(50);
+
+	return rc;
+
+enable_digital_fail:
+	rc = gpio_request(ELITE_GPIO_CAM2_RSTz, "s5k6a1gx");
+	if (rc < 0)
+		pr_err("GPIO(%d) request failed", ELITE_GPIO_CAM2_RSTz);
+	else {
+		gpio_direction_output(ELITE_GPIO_CAM2_RSTz, 0);
+		gpio_free(ELITE_GPIO_CAM2_RSTz);
+	}
+enable_rst_fail:
+	camera_sensor_power_disable(reg_8921_lvs6);
+enable_i2c_pullup_fail:
+	if (system_rev < 1) 
+	camera_sensor_power_disable(reg_8921_lvs5);
+enable_io_fail:
+	camera_sensor_power_disable(reg_8921_l8);
+enable_analog_fail:
+	return rc;
+}
+
+static int elite_s5k6a1gx_vreg_off(void)
+{
+	int rc;
+	pr_info("%s\n", __func__);
+
+	
+	if (system_rev >= 1) { 
+		rc = gpio_request(ELITE_XB_GPIO_V_CAM2_D1V2_EN, "s5k6a1gx");
+		if (rc < 0)
+			pr_err("GPIO(%d) request failed", ELITE_XB_GPIO_V_CAM2_D1V2_EN);
+		else {
+			gpio_direction_output(ELITE_XB_GPIO_V_CAM2_D1V2_EN, 0);
+			gpio_free(ELITE_XB_GPIO_V_CAM2_D1V2_EN);
+		}
+	} else { 
+		rc = gpio_request(ELITE_GPIO_V_CAM_D1V2_EN, "s5k6a1gx");
+		pr_info("digital gpio_request,%d\n", ELITE_GPIO_V_CAM_D1V2_EN);
+		if (rc < 0)
+			pr_err("GPIO(%d) request failed", ELITE_GPIO_V_CAM_D1V2_EN);
+		else {
+			gpio_direction_output(ELITE_GPIO_V_CAM_D1V2_EN, 0);
+			gpio_free(ELITE_GPIO_V_CAM_D1V2_EN);
+		}
+	}
+	udelay(50);
+
+	
+	rc = gpio_request(ELITE_GPIO_CAM2_RSTz, "s5k6a1gx");
+	pr_info("reset pin gpio_request,%d\n", ELITE_GPIO_CAM2_RSTz);
+	if (rc < 0)
+		pr_err("GPIO(%d) request failed", ELITE_GPIO_CAM2_RSTz);
+	else {
+		gpio_direction_output(ELITE_GPIO_CAM2_RSTz, 0);
+		gpio_free(ELITE_GPIO_CAM2_RSTz);
+	}
+	udelay(50);
+
+	if (system_rev == 0) { 
+		
+		rc = camera_sensor_power_disable(reg_8921_lvs6);
+		if (rc < 0)
+			pr_err("sensor_power_disable\
+				(\"8921_lvs6\") FAILED %d\n", rc);
+		mdelay(1);
+	}
+
+	
+	if (system_rev >= 1) { 
+		rc = camera_sensor_power_disable(reg_8921_lvs6);
+		if (rc < 0)
+			pr_err("sensor_power_disable(\"8921_lvs6\") FAILED %d\n", rc);
+	} else { 
+		rc = camera_sensor_power_disable(reg_8921_lvs5);
+		if (rc < 0)
+			pr_err("sensor_power_disable(\"8921_lvs5\") FAILED %d\n", rc);
+	}
+	udelay(50);
+
+	
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	if (rc < 0)
+		pr_err("sensor_power_disable(\"8921_l8\") FAILED %d\n", rc);
+	udelay(50);
+
+	return rc;
+}
+
+static struct msm_camera_csi_lane_params s5k6a1gx_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x1,
+};
+
+static struct msm_camera_sensor_platform_info sensor_s5k6a1gx_board_info = {
+	.mount_angle = 270,
+	.mirror_flip = CAMERA_SENSOR_NONE,
+	.sensor_reset_enable = 0,
+	.sensor_reset	= ELITE_GPIO_CAM2_RSTz,
+	.sensor_pwd	= ELITE_GPIO_CAM2_STANDBY,
+	.vcm_pwd	= 0,
+	.vcm_enable	= 0,
+	.csi_lane_params = &s5k6a1gx_csi_lane_params,
+};
+
+static struct msm_camera_sensor_flash_data flash_s5k6a1gx = {
+	.flash_type	= MSM_CAMERA_FLASH_NONE,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_s5k6a1gx_data = {
+	.sensor_name	= "s5k6a1gx",
+	.sensor_reset	= ELITE_GPIO_CAM2_RSTz,
+	.sensor_pwd	= ELITE_GPIO_CAM2_STANDBY,
+	.vcm_pwd	= 0,
+	.vcm_enable	= 0,
+	.camera_power_on = elite_s5k6a1gx_vreg_on,
+	.camera_power_off = elite_s5k6a1gx_vreg_off,
+	.pdata	= &msm_camera_csi_device_data[1],
+	.flash_data	= &flash_s5k6a1gx,
+	.sensor_platform_info = &sensor_s5k6a1gx_board_info,
+	.gpio_conf = &gpio_conf,
+	.csi_if	= 1,
+	.camera_type = FRONT_CAMERA_2D,
+	.use_rawchip = RAWCHIP_DISABLE, 
+};
+#endif /* CONFIG_S5K6A1GX */
+
+static void config_cam_id(int status)
+{
+	static uint32_t cam_id_gpio_start[] = {
+		GPIO_CFG(ELITE_GPIO_MAIN_CAM_ID, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
+	};
+
+	static uint32_t cam_id_gpio_end[] = {
+		GPIO_CFG(ELITE_GPIO_MAIN_CAM_ID, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
+	};
+	pr_info("config_cam_id(): status=%d\n",status);
+	if(status)
+		gpio_tlmm_config(cam_id_gpio_start[0], GPIO_CFG_ENABLE);
+	else
+		gpio_tlmm_config(cam_id_gpio_end[0], GPIO_CFG_ENABLE);
+}
+
+static struct i2c_board_info msm_camera_boardinfo[] = {
+#ifdef CONFIG_S5K3H2YX
+	{
+	I2C_BOARD_INFO("s5k3h2yx", 0x20 >> 1),
+	.platform_data = &msm_camera_sensor_s5k3h2yx_data,
+	},
+#endif
+#ifdef CONFIG_S5K6A1GX
+	{
+	I2C_BOARD_INFO("s5k6a1gx", 0x6C >> 1),
+	.platform_data = &msm_camera_sensor_s5k6a1gx_data,
+	},
+#endif
+};
+
+struct msm_camera_board_info elite_camera_board_info = {
+	.board_info = msm_camera_boardinfo,
+	.num_i2c_board_info = ARRAY_SIZE(msm_camera_boardinfo),
+};
+
+static struct i2c_board_info msm_camera_boardinfo_2nd[] = {
+#ifdef CONFIG_IMX175_2LANE
+	{
+	I2C_BOARD_INFO("imx175", 0x20 >> 1),
+	.platform_data = &msm_camera_sensor_imx175_data,
+	},
+#endif
+#ifdef CONFIG_S5K6A1GX
+	{
+	I2C_BOARD_INFO("s5k6a1gx", 0x6C >> 1),
+	.platform_data = &msm_camera_sensor_s5k6a1gx_data,
+	},
+#endif
+};
+
+struct msm_camera_board_info elite_camera_board_info_2nd = {
+	.board_info = msm_camera_boardinfo_2nd,
+	.num_i2c_board_info = ARRAY_SIZE(msm_camera_boardinfo_2nd),
+};
+#endif /* CONFIG_MSM_CAMERA */
+
+void __init elite_init_camera(void)
+{
+#ifdef CONFIG_MSM_CAMERA
+	pr_info("%s", __func__);
+
+	msm_gpiomux_install(elite_cam_configs,
+			ARRAY_SIZE(elite_cam_configs));
+
+	config_cam_id(1); 
+	msleep(2);
+
+	if (gpio_get_value(ELITE_GPIO_MAIN_CAM_ID) == 0){
+		i2c_register_board_info(MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+			elite_camera_board_info.board_info,
+			elite_camera_board_info.num_i2c_board_info);
+	}else{ 
+		i2c_register_board_info(MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+			elite_camera_board_info_2nd.board_info,
+			elite_camera_board_info_2nd.num_i2c_board_info);
+	}
+	config_cam_id(0); 
+
+	platform_device_register(&msm_rawchip_device);
+
+	platform_device_register(&msm_camera_server);
+	platform_device_register(&msm8960_device_i2c_mux_gsbi4);
+	platform_device_register(&msm8960_device_csiphy0);
+	platform_device_register(&msm8960_device_csiphy1);
+	platform_device_register(&msm8960_device_csid0);
+	platform_device_register(&msm8960_device_csid1);
+	platform_device_register(&msm8960_device_ispif);
+	platform_device_register(&msm8960_device_vfe);
+	platform_device_register(&msm8960_device_vpe);
+#endif /* CONFIG_MSM_CAMERA */
+}
diff --git a/arch/arm/mach-msm/htc/elite/board-elite-gpiomux.c b/arch/arm/mach-msm/htc/elite/board-elite-gpiomux.c
new file mode 100644
index 0000000..52d1b3a
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/board-elite-gpiomux.c
@@ -0,0 +1,404 @@
+/* arch/arm/mach-msm/board-elite-gpio.c
+ * Copyright (C) 2011 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+*/
+
+#include <mach/gpiomux.h>
+#include "board-elite.h"
+
+#if 0  /* GSBI2 is not used for I2C */
+static struct gpiomux_setting gsbi2 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+#endif /* GSBI2 is not used for I2C */
+
+static struct gpiomux_setting gsbi3 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+#if 0
+static struct gpiomux_setting gsbi4 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+#endif
+
+static struct gpiomux_setting gsbi5 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv  = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+#if 0
+/* The SPI configurations apply to GSBI 10*/
+static struct gpiomux_setting gsbi10 = {
+	.func = GPIOMUX_FUNC_2,
+	.drv = GPIOMUX_DRV_4MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+#endif
+
+static struct gpiomux_setting gsbi12 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting cdc_mclk = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting slimbus = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_KEEPER,
+};
+
+static struct msm_gpiomux_config elite_gsbi_configs[] __initdata = {
+#if 0 /* GSBI2 is not used for I2C */
+	{
+		.gpio      = ELITE_GPIO_VP_I2C_DAT,	/* GSBI2 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi2,
+		},
+	},
+	{
+		.gpio      = ELITE_GPIO_VP_I2C_CLK,	/* GSBI2 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi2,
+		},
+	},
+#endif /* GSBI2 is not used for I2C */
+	{
+		.gpio      = ELITE_GPIO_TP_I2C_DAT,	/* GSBI3 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi3,
+		},
+	},
+	{
+		.gpio      = ELITE_GPIO_TP_I2C_CLK,	/* GSBI3 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi3,
+		},
+	},
+#if 0
+	{
+		.gpio      = ELITE_GPIO_CAM_I2C_DAT,	/* GSBI4 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi4,
+		},
+	},
+	{
+		.gpio      = ELITE_GPIO_CAM_I2C_CLK,	/* GSBI4 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi4,
+		},
+	},
+#endif
+	{
+		.gpio      = ELITE_GPIO_NFC_I2C_SDA,	/* GSBI5 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi5,
+		},
+	},
+	{
+		.gpio      = ELITE_GPIO_NFC_I2C_SCL,	/* GSBI5 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi5,
+		},
+	},
+#if 0
+	{
+		/* GSBI10 SPI QUP ELITE_GPIO_MCAM_SPI_CLK */
+		.gpio      = ELITE_GPIO_MCAM_SPI_CLK,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+	{
+		/* GSBI10 SPI QUP ELITE_GPIO_MCAM_SPI_CS0 */
+		.gpio      = ELITE_GPIO_MCAM_SPI_CS0,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+	{
+		/* GSBI10 SPI QUP ELITE_GPIO_MCAM_SPI_DI */
+		.gpio      = ELITE_GPIO_MCAM_SPI_DI,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+	{
+		/* GSBI10 SPI QUP ELITE_GPIO_MCAM_SPI_DO */
+		.gpio      = ELITE_GPIO_MCAM_SPI_DO,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+#endif
+	{
+		.gpio      = ELITE_GPIO_SR_I2C_DAT,	/* GSBI12 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi12,
+		},
+	},
+	{
+		.gpio      = ELITE_GPIO_SR_I2C_CLK,	/* GSBI12 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi12,
+		},
+	},
+};
+
+static struct msm_gpiomux_config elite_slimbus_configs[] __initdata = {
+	{
+		.gpio	= ELITE_GPIO_AUD_WCD_SB_CLK,		/* slimbus data */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &slimbus,
+		},
+	},
+	{
+		.gpio	= ELITE_GPIO_AUD_WCD_SB_DATA,		/* slimbus clk */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &slimbus,
+		},
+	},
+};
+
+static struct msm_gpiomux_config elite_audio_codec_configs[] __initdata = {
+	{
+		.gpio = ELITE_GPIO_AUD_WCD_MCLK,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &cdc_mclk,
+		},
+	},
+};
+static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv  = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting wcnss_5wire_active_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv  = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct msm_gpiomux_config wcnss_5wire_interface[] = {
+	{
+		.gpio = ELITE_GPIO_WCN_CMD_DATA2,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_WCN_CMD_DATA1,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_WCN_CMD_DATA0,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_WCN_CMD_SET,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_WCN_CMD_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+};
+
+static struct gpiomux_setting mdp_vsync_suspend_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct gpiomux_setting mdp_vsync_active_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
+	{
+		.gpio = ELITE_GPIO_LCD_TE,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
+			[GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
+		},
+	}
+};
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+
+static struct gpiomux_setting mhl_suspend_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting mhl_active_1_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_UP,
+};
+
+static struct gpiomux_setting mhl_active_2_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_UP,
+};
+
+static struct msm_gpiomux_config elite_mhl_configs[] __initdata = {
+	{
+		.gpio = ELITE_GPIO_MHL_RSTz,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &mhl_active_1_cfg,
+			[GPIOMUX_SUSPENDED] = &mhl_suspend_cfg,
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_MHL_INT,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &mhl_active_2_cfg,
+			[GPIOMUX_SUSPENDED] = &mhl_suspend_cfg,
+		},
+	},
+};
+
+
+static struct gpiomux_setting hdmi_suspend_pd_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+static struct gpiomux_setting hdmi_suspend_np_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+
+static struct gpiomux_setting hdmi_active_1_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting hdmi_active_2_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct msm_gpiomux_config elite_hdmi_configs[] __initdata = {
+	{
+		.gpio = ELITE_GPIO_HDMI_DDC_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &hdmi_active_1_cfg,
+			[GPIOMUX_SUSPENDED] = &hdmi_suspend_np_cfg,
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_HDMI_DDC_DATA,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &hdmi_active_1_cfg,
+			[GPIOMUX_SUSPENDED] = &hdmi_suspend_np_cfg,
+		},
+	},
+	{
+		.gpio = ELITE_GPIO_HDMI_HPD,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &hdmi_active_2_cfg,
+			[GPIOMUX_SUSPENDED] = &hdmi_suspend_pd_cfg,
+		},
+	},
+};
+#endif
+
+static struct gpiomux_setting usb_id_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct msm_gpiomux_config cable_detect_usbid_config[] __initdata = {
+	{
+		.gpio = ELITE_GPIO_USB_ID1,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &usb_id_cfg,
+			[GPIOMUX_SUSPENDED] = &usb_id_cfg,
+		},
+	},
+};
+
+int __init elite_gpiomux_init(void)
+{
+	int rc;
+
+	rc = msm_gpiomux_init(NR_GPIO_IRQS);
+	if (rc) {
+		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
+		return rc;
+	}
+
+	msm_gpiomux_install(elite_gsbi_configs,
+			ARRAY_SIZE(elite_gsbi_configs));
+
+	msm_gpiomux_install(elite_slimbus_configs,
+			ARRAY_SIZE(elite_slimbus_configs));
+
+	msm_gpiomux_install(elite_audio_codec_configs,
+			ARRAY_SIZE(elite_audio_codec_configs));
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+	msm_gpiomux_install(elite_hdmi_configs,
+			ARRAY_SIZE(elite_hdmi_configs));
+
+	msm_gpiomux_install(elite_mhl_configs,
+			ARRAY_SIZE(elite_mhl_configs));
+#endif
+	msm_gpiomux_install(msm8960_mdp_vsync_configs,
+			ARRAY_SIZE(msm8960_mdp_vsync_configs));
+
+	msm_gpiomux_install(wcnss_5wire_interface,
+			ARRAY_SIZE(wcnss_5wire_interface));
+
+	msm_gpiomux_install(cable_detect_usbid_config,
+			ARRAY_SIZE(cable_detect_usbid_config));
+
+	return 0;
+}
+
diff --git a/arch/arm/mach-msm/htc/elite/board-elite-keypad.c b/arch/arm/mach-msm/htc/elite/board-elite-keypad.c
new file mode 100644
index 0000000..a84cc42
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/board-elite-keypad.c
@@ -0,0 +1,99 @@
+/* arch/arm/mach-msm/board-elite-keypad.c
+ * Copyright (C) 2010 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+*/
+
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/gpio_event.h>
+#include <linux/gpio.h>
+#include <linux/keyreset.h>
+#include <asm/mach-types.h>
+#include <mach/board_htc.h>
+#include <mach/gpio.h>
+#include <mach/proc_comm.h>
+#include <linux/moduleparam.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include "board-elite.h"
+
+static char *keycaps = "--qwerty";
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "board_elite."
+
+module_param_named(keycaps, keycaps, charp, 0);
+/* Direct Keys */
+
+static struct gpio_event_direct_entry elite_keypad_map[] = {
+	{
+		.gpio = ELITE_GPIO_VOL_DOWNz,
+		.code = KEY_VOLUMEDOWN,
+	},
+	{
+		.gpio = ELITE_GPIO_VOL_UPz,
+		.code = KEY_VOLUMEUP,
+	},
+};
+
+static struct gpio_event_input_info elite_keypad_power_info = {
+	.info.func = gpio_event_input_func,
+	.flags = GPIOEDF_PRINT_KEYS,
+	.type = EV_KEY,
+#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
+	.debounce_time.tv.nsec = 5 * NSEC_PER_MSEC,
+# else
+	.debounce_time.tv64 = 5 * NSEC_PER_MSEC,
+# endif
+	.keymap = elite_keypad_map,
+	.keymap_size = ARRAY_SIZE(elite_keypad_map),
+};
+
+static struct gpio_event_info *elite_keypad_info[] = {
+	&elite_keypad_power_info.info,
+};
+
+static struct gpio_event_platform_data elite_keypad_data = {
+	.name = "keypad_8960",
+	.info = elite_keypad_info,
+	.info_count = ARRAY_SIZE(elite_keypad_info),
+};
+
+static struct platform_device elite_keypad_device = {
+	.name = GPIO_EVENT_DEV_NAME,
+	.id = 0,
+	.dev		= {
+		.platform_data	= &elite_keypad_data,
+	},
+};
+
+static struct keyreset_platform_data elite_reset_keys_pdata = {
+	/*.keys_up = elite_reset_keys_up,*/
+	.keys_down = {
+		KEY_POWER,
+		KEY_VOLUMEDOWN,
+		KEY_VOLUMEUP,
+		0
+	},
+};
+
+static struct platform_device elite_reset_keys_device = {
+	.name = KEYRESET_NAME,
+	.dev.platform_data = &elite_reset_keys_pdata,
+};
+
+int __init elite_init_keypad(void)
+{
+	if (platform_device_register(&elite_reset_keys_device))
+		printk(KERN_WARNING "%s: register reset key fail\n", __func__);
+
+	return platform_device_register(&elite_keypad_device);
+}
+
diff --git a/arch/arm/mach-msm/htc/elite/board-elite-pmic.c b/arch/arm/mach-msm/htc/elite/board-elite-pmic.c
new file mode 100644
index 0000000..ec1c840
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/board-elite-pmic.c
@@ -0,0 +1,416 @@
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/bootmem.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/leds.h>
+#include <linux/leds-pm8xxx-htc.h>
+#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
+#include <asm/mach-types.h>
+#include <asm/mach/mmc.h>
+#include <asm/setup.h>
+#include <mach/msm_bus_board.h>
+#include <mach/board.h>
+#include <mach/gpio.h>
+#include <mach/gpiomux.h>
+#include <mach/restart.h>
+#include "devices.h"
+#include "board-elite.h"
+
+extern unsigned int system_rev;
+
+void elite_pm8xxx_adc_device_register(void);
+
+struct pm8xxx_gpio_init {
+	unsigned			gpio;
+	struct pm_gpio			config;
+};
+
+struct pm8xxx_mpp_init {
+	unsigned			mpp;
+	struct pm8xxx_mpp_config_data	config;
+};
+
+#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
+			_func, _inv, _disable) \
+{ \
+	.gpio	= PM8921_GPIO_PM_TO_SYS(_gpio), \
+	.config	= { \
+		.direction	= _dir, \
+		.output_buffer	= _buf, \
+		.output_value	= _val, \
+		.pull		= _pull, \
+		.vin_sel	= _vin, \
+		.out_strength	= _out_strength, \
+		.function	= _func, \
+		.inv_int_pol	= _inv, \
+		.disable_pin	= _disable, \
+	} \
+}
+
+#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
+{ \
+	.mpp	= PM8921_MPP_PM_TO_SYS(_mpp), \
+	.config	= { \
+		.type		= PM8XXX_MPP_TYPE_##_type, \
+		.level		= _level, \
+		.control	= PM8XXX_MPP_##_control, \
+	} \
+}
+
+#define PM8XXX_GPIO_DISABLE(_gpio) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
+			 0, 0, 0, 1)
+
+#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
+			_pull, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_NO, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			_func, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(_gpio, _val, _func) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_BB, \
+			PM_GPIO_STRENGTH_HIGH, \
+			_func, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_L17_FUNC(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_L17, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_S4_FUNC_XC(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+/* Initial PM8921 GPIO configurations */
+static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
+	PM8XXX_GPIO_INIT(ELITE_PMGPIO_HAPTIC_3V3_EN, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, 1, PM_GPIO_PULL_NO, PM_GPIO_VIN_L17, PM_GPIO_STRENGTH_HIGH, PM_GPIO_FUNC_NORMAL, 0, 0),
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(ELITE_PMGPIO_HAPTIC_PWM, 0, PM_GPIO_FUNC_2),
+
+	PM8XXX_GPIO_OUTPUT(ELITE_PMGPIO_AUD_CRADLE_EN, 0),
+	PM8XXX_GPIO_INPUT(ELITE_PMGPIO_USB_ID_ADC_PMIC, PM_GPIO_PULL_NO),
+	/* extend marco to replace power domain S4 with L17 */
+	PM8XXX_GPIO_INIT(ELITE_PMGPIO_AUD_STEREO_REC, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, 1, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_L17, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0),
+	PM8XXX_GPIO_OUTPUT(ELITE_PMGPIO_AUD_SPK_EN, 0),
+	PM8XXX_GPIO_OUTPUT(ELITE_PMGPIO_AUD_HAC_SD, 0),
+	PM8XXX_GPIO_INIT(ELITE_PMGPIO_EARPHONE_DETz, PM_GPIO_DIR_IN,
+			 PM_GPIO_OUT_BUF_CMOS, 0, PM_GPIO_PULL_UP_1P5,
+			 PM_GPIO_VIN_S4, PM_GPIO_STRENGTH_LOW,
+			 PM_GPIO_FUNC_NORMAL, 0, 0),
+};
+
+/* Initial PM8921 MPP configurations */
+static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
+	/* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_3, D_BI_DIR, PM8921_MPP_DIG_LEVEL_S4, BI_PULLUP_10KOHM),
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_4, D_BI_DIR, PM8921_MPP_DIG_LEVEL_L17, BI_PULLUP_10KOHM),
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_11, D_BI_DIR, PM8921_MPP_DIG_LEVEL_S4, BI_PULLUP_10KOHM),
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_12, D_BI_DIR, PM8921_MPP_DIG_LEVEL_L17, BI_PULLUP_10KOHM),
+};
+
+void elite_lcd_id_power(int pull)
+{
+	int rc;
+	struct pm8xxx_gpio_init pm8921_lcd_id0 = PM8XXX_GPIO_INIT(ELITE_PMGPIO_LCD_ID0, PM_GPIO_DIR_IN,
+			 PM_GPIO_OUT_BUF_CMOS, 0, pull, PM_GPIO_VIN_S4, PM_GPIO_STRENGTH_LOW,
+			 PM_GPIO_FUNC_NORMAL, 0, 0);
+	struct pm8xxx_gpio_init pm8921_lcd_id1 = PM8XXX_GPIO_INIT(ELITE_PMGPIO_LCD_ID1, PM_GPIO_DIR_IN,
+			 PM_GPIO_OUT_BUF_CMOS, 0, pull, PM_GPIO_VIN_S4, PM_GPIO_STRENGTH_LOW,
+			 PM_GPIO_FUNC_NORMAL, 0, 0);
+
+	rc = pm8xxx_gpio_config(pm8921_lcd_id0.gpio, &pm8921_lcd_id0.config);
+	if (rc) {
+		pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
+		return;
+	}
+
+	rc = pm8xxx_gpio_config(pm8921_lcd_id1.gpio, &pm8921_lcd_id0.config);
+	if (rc) {
+		pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
+		return;
+	}
+}
+
+void __init elite_pm8921_gpio_mpp_init(void)
+{
+	int i, rc;
+
+	for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
+		rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
+					&pm8921_gpios[i].config);
+		if (rc) {
+			pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
+			break;
+		}
+	}
+
+	for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
+		rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
+					&pm8921_mpps[i].config);
+		if (rc) {
+			pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
+			break;
+		}
+	}
+}
+
+static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
+	.irq_base		= PM8921_IRQ_BASE,
+	.devirq			= MSM_GPIO_TO_INT(104),
+	.irq_trigger_flag	= IRQF_TRIGGER_LOW,
+};
+
+static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
+	.gpio_base	= PM8921_GPIO_PM_TO_SYS(1),
+};
+
+static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
+	.mpp_base	= PM8921_MPP_PM_TO_SYS(1),
+};
+
+static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
+	.rtc_write_enable       = true,
+#ifdef CONFIG_HTC_OFFMODE_ALARM
+	.rtc_alarm_powerup	= true,
+#else
+	.rtc_alarm_powerup	= false,
+#endif
+};
+
+static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
+	.pull_up		= 1,
+	.kpd_trigger_delay_us   = 15625,
+	.wakeup			= 1,
+};
+
+static int pm8921_therm_mitigation[] = {
+	1100,
+	700,
+	600,
+	225,
+};
+
+static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
+	.safety_time		= 510,
+	.update_time		= 60000,
+	.max_voltage		= 4200,
+	.min_voltage		= 3200,
+	.resume_voltage_delta	= 50,
+	.term_current		= 50,
+	.cool_temp		= 0,
+	.warm_temp		= 48,
+	.temp_check_period	= 1,
+	.max_bat_chg_current	= 1025,
+	.cool_bat_chg_current	= 1025,
+	.warm_bat_chg_current	= 1025,
+	.cool_bat_voltage	= 4200,
+	.warm_bat_voltage	= 4000,
+	.mbat_in_gpio		= ELITE_GPIO_MBAT_IN,
+	.thermal_mitigation	= pm8921_therm_mitigation,
+	.thermal_levels		= ARRAY_SIZE(pm8921_therm_mitigation),
+	.cold_thr = PM_SMBC_BATT_TEMP_COLD_THR__HIGH,
+	.hot_thr = PM_SMBC_BATT_TEMP_HOT_THR__LOW,
+};
+
+static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
+	.priority		= 0,
+};
+
+static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
+	.r_sense		= 10,
+	.i_test			= 0, /* ori=2500 */
+	.v_failure		= 3000,
+	//	.calib_delay_ms		= 600000,
+	.max_voltage_uv		= 4200 * 1000,
+};
+
+static int __init check_dq_setup(char *str)
+{
+	if (!strcmp(str, "PASS")) {
+		pr_info("[BATT] overwrite HV battery config\n");
+                pm8921_chg_pdata.max_voltage = 4340;
+                pm8921_chg_pdata.cool_bat_voltage = 4340;
+		pm8921_bms_pdata.max_voltage_uv = 4340 * 1000;
+	} else {
+		pr_info("[BATT] use default battery config\n");
+		pm8921_chg_pdata.max_voltage = 4200;
+		pm8921_chg_pdata.cool_bat_voltage = 4200;
+		pm8921_bms_pdata.max_voltage_uv = 4200 * 1000;
+	}
+	return 1;
+}
+__setup("androidboot.dq=", check_dq_setup);
+
+static struct pm8xxx_gpio_init green_gpios[] = {
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(ELITE_PMGPIO_GREEN_LED, 1, PM_GPIO_FUNC_2),
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(ELITE_PMGPIO_GREEN_LED, 1, PM_GPIO_FUNC_NORMAL),
+};
+
+static struct pm8xxx_gpio_init amber_gpios[] = {
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(ELITE_PMGPIO_AMBER_LED, 1, PM_GPIO_FUNC_2),
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(ELITE_PMGPIO_AMBER_LED, 1, PM_GPIO_FUNC_NORMAL),
+};
+
+static void green_gpio_config(bool enable)
+{
+	if (enable)
+		pm8xxx_gpio_config(green_gpios[0].gpio, &green_gpios[0].config);
+	else
+		pm8xxx_gpio_config(green_gpios[1].gpio, &green_gpios[1].config);
+}
+
+static void amber_gpio_config(bool enable)
+{
+	if (enable)
+		pm8xxx_gpio_config(amber_gpios[0].gpio, &amber_gpios[0].config);
+	else
+		pm8xxx_gpio_config(amber_gpios[1].gpio, &amber_gpios[1].config);
+}
+
+static struct pm8xxx_led_configure pm8921_led_info[] = {
+	[0] = {
+		.name		= "button-backlight",
+		.flags		= PM8XXX_ID_LED_0,
+		.function_flags = LED_PWM_FUNCTION | LED_BRETH_FUNCTION,
+		.period_us 	= USEC_PER_SEC / 1000,
+		.start_index 	= 0,
+		.duites_size 	= 8,
+		.duty_time_ms 	= 64,
+		.lut_flag 	= PM_PWM_LUT_RAMP_UP | PM_PWM_LUT_PAUSE_HI_EN,
+		.out_current    = 40,
+		.duties		= {0, 9, 18, 27, 36, 45, 54, 60,
+				60, 54, 45, 36, 27, 18, 9, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0},
+	},
+	[1] = {
+		.name           = "green",
+		.flags		= PM8XXX_ID_GPIO24,
+		.function_flags = LED_PWM_FUNCTION | LED_BLINK_FUNCTION,
+		.gpio_status_switch = green_gpio_config,
+	},
+	[2] = {
+		.name           = "amber",
+		.flags		= PM8XXX_ID_GPIO25,
+		.function_flags = LED_PWM_FUNCTION | LED_BLINK_FUNCTION,
+		.gpio_status_switch = amber_gpio_config,
+	},
+};
+
+static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
+	.num_leds = ARRAY_SIZE(pm8921_led_info),
+	.leds = pm8921_led_info,
+};
+
+static struct pm8xxx_ccadc_platform_data pm8xxx_ccadc_pdata = {
+    .r_sense_uohm		= 10000,
+};
+
+static struct pm8xxx_adc_amux pm8xxx_adc_channels_data[] = {
+	{"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
+	{"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
+	{"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"pa_therm", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
+	{"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
+	{"mpp_amux6", ADC_MPP_1_AMUX6, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+};
+
+
+static struct pm8xxx_adc_properties pm8xxx_adc_data = {
+	.adc_vdd_reference	= 1800, /* milli-voltage for this adc */
+	.bitresolution		= 15,
+	.bipolar                = 0,
+};
+
+static struct pm8xxx_adc_platform_data pm8xxx_adc_pdata = {
+	.adc_channel			= pm8xxx_adc_channels_data,
+	.adc_num_board_channel		= ARRAY_SIZE(pm8xxx_adc_channels_data),
+	.adc_prop			= &pm8xxx_adc_data,
+	.adc_mpp_base			= PM8921_MPP_PM_TO_SYS(1),
+	.pm8xxx_adc_device_register	= elite_pm8xxx_adc_device_register,
+};
+
+static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
+	.irq_pdata		= &pm8xxx_irq_pdata,
+	.gpio_pdata		= &pm8xxx_gpio_pdata,
+	.mpp_pdata		= &pm8xxx_mpp_pdata,
+	.rtc_pdata              = &pm8xxx_rtc_pdata,
+	.pwrkey_pdata		= &pm8xxx_pwrkey_pdata,
+	.misc_pdata		= &pm8xxx_misc_pdata,
+	.regulator_pdatas	= msm_pm8921_regulator_pdata,
+	.charger_pdata		= &pm8921_chg_pdata,
+	.bms_pdata		= &pm8921_bms_pdata,
+	.adc_pdata		= &pm8xxx_adc_pdata,
+	.leds_pdata		= &pm8xxx_leds_pdata,
+	.ccadc_pdata		= &pm8xxx_ccadc_pdata,
+};
+
+static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
+	.controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
+	.slave	= {
+		.name			= "pm8921-core",
+		.platform_data		= &pm8921_platform_data,
+	},
+};
+
+void __init elite_init_pmic(void)
+{
+	pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
+
+
+	msm8960_device_ssbi_pmic.dev.platform_data =
+				&msm8960_ssbi_pm8921_pdata;
+	pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
+}
diff --git a/arch/arm/mach-msm/htc/elite/board-elite-regulator.c b/arch/arm/mach-msm/htc/elite/board-elite-regulator.c
new file mode 100644
index 0000000..dd90f21
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/board-elite-regulator.c
@@ -0,0 +1,614 @@
+/*
+ * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/regulator/pm8xxx-regulator.h>
+#include <linux/regulator/msm-gpio-regulator.h>
+#include <mach/rpm-regulator.h>
+
+#include "board-elite.h"
+
+#define VREG_CONSUMERS(_id) \
+	static struct regulator_consumer_supply vreg_consumers_##_id[]
+
+/*
+ * Consumer specific regulator names:
+ *			 regulator name		consumer dev_name
+ */
+VREG_CONSUMERS(L1) = {
+	REGULATOR_SUPPLY("8921_l1",		NULL),
+};
+VREG_CONSUMERS(L2) = {
+	REGULATOR_SUPPLY("8921_l2",		NULL),
+	REGULATOR_SUPPLY("dsi_vdda",		"mipi_dsi.1"),
+	REGULATOR_SUPPLY("dsi_pll_vdda",	"mdp.0"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.0"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.1"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.2"),
+};
+VREG_CONSUMERS(L3) = {
+	REGULATOR_SUPPLY("8921_l3",		NULL),
+	REGULATOR_SUPPLY("HSUSB_3p3",		"msm_otg"),
+};
+VREG_CONSUMERS(L4) = {
+	REGULATOR_SUPPLY("8921_l4",		NULL),
+	REGULATOR_SUPPLY("HSUSB_1p8",		"msm_otg"),
+	REGULATOR_SUPPLY("iris_vddxo",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(L5) = {
+	REGULATOR_SUPPLY("8921_l5",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.1"),
+};
+VREG_CONSUMERS(L6) = {
+	REGULATOR_SUPPLY("8921_l6",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.3"),
+};
+VREG_CONSUMERS(L7) = {
+	REGULATOR_SUPPLY("8921_l7",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd_io",		"msm_sdcc.3"),
+};
+VREG_CONSUMERS(L8) = {
+	REGULATOR_SUPPLY("8921_l8",		NULL),
+	REGULATOR_SUPPLY("dsi_vdc",		"mipi_dsi.1"),
+};
+VREG_CONSUMERS(L9) = {
+	REGULATOR_SUPPLY("8921_l9",		NULL),
+	REGULATOR_SUPPLY("vdd",			"3-0024"),
+	REGULATOR_SUPPLY("vdd_ana",		"3-004a"),
+};
+VREG_CONSUMERS(L10) = {
+	REGULATOR_SUPPLY("8921_l10",		NULL),
+	REGULATOR_SUPPLY("iris_vddpa",		"wcnss_wlan.0"),
+
+};
+VREG_CONSUMERS(L11) = {
+	REGULATOR_SUPPLY("8921_l11",		NULL),
+	REGULATOR_SUPPLY("cam_vana",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vana",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0034"),
+};
+VREG_CONSUMERS(L12) = {
+	REGULATOR_SUPPLY("8921_l12",		NULL),
+	REGULATOR_SUPPLY("cam_vdig",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0034"),
+};
+VREG_CONSUMERS(L14) = {
+	REGULATOR_SUPPLY("8921_l14",		NULL),
+	REGULATOR_SUPPLY("pa_therm",		"pm8xxx-adc"),
+};
+VREG_CONSUMERS(L15) = {
+	REGULATOR_SUPPLY("8921_l15",		NULL),
+};
+VREG_CONSUMERS(L16) = {
+	REGULATOR_SUPPLY("8921_l16",		NULL),
+	REGULATOR_SUPPLY("cam_vaf",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0034"),
+};
+VREG_CONSUMERS(L17) = {
+	REGULATOR_SUPPLY("8921_l17",		NULL),
+};
+VREG_CONSUMERS(L18) = {
+	REGULATOR_SUPPLY("8921_l18",		NULL),
+};
+VREG_CONSUMERS(L21) = {
+	REGULATOR_SUPPLY("8921_l21",		NULL),
+};
+VREG_CONSUMERS(L22) = {
+	REGULATOR_SUPPLY("8921_l22",		NULL),
+};
+VREG_CONSUMERS(L23) = {
+	REGULATOR_SUPPLY("8921_l23",		NULL),
+	REGULATOR_SUPPLY("dsi_vddio",		"mipi_dsi.1"),
+	REGULATOR_SUPPLY("dsi_pll_vddio",	"mdp.0"),
+	REGULATOR_SUPPLY("hdmi_avdd",		"hdmi_msm.0"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_riva"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_qdsp6v4.1"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_qdsp6v4.2"),
+};
+VREG_CONSUMERS(L24) = {
+	REGULATOR_SUPPLY("8921_l24",		NULL),
+	REGULATOR_SUPPLY("riva_vddmx",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(L25) = {
+	REGULATOR_SUPPLY("8921_l25",		NULL),
+	REGULATOR_SUPPLY("VDDD_CDC_D",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_A_1P2V",	"tabla-slim"),
+	REGULATOR_SUPPLY("VDDD_CDC_D",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_A_1P2V",	"tabla2x-slim"),
+};
+VREG_CONSUMERS(L26) = {
+	REGULATOR_SUPPLY("8921_l26",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.0"),
+};
+VREG_CONSUMERS(L27) = {
+	REGULATOR_SUPPLY("8921_l27",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.2"),
+};
+VREG_CONSUMERS(L28) = {
+	REGULATOR_SUPPLY("8921_l28",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.1"),
+};
+VREG_CONSUMERS(L29) = {
+	REGULATOR_SUPPLY("8921_l29",		NULL),
+};
+VREG_CONSUMERS(S1) = {
+	REGULATOR_SUPPLY("8921_s1",		NULL),
+};
+VREG_CONSUMERS(S2) = {
+	REGULATOR_SUPPLY("8921_s2",		NULL),
+	REGULATOR_SUPPLY("iris_vddrfa",		"wcnss_wlan.0"),
+
+};
+VREG_CONSUMERS(S3) = {
+	REGULATOR_SUPPLY("8921_s3",		NULL),
+	REGULATOR_SUPPLY("HSUSB_VDDCX",		"msm_otg"),
+	REGULATOR_SUPPLY("riva_vddcx",		"wcnss_wlan.0"),
+	REGULATOR_SUPPLY("HSIC_VDDCX",		"msm_hsic_host"),
+};
+VREG_CONSUMERS(S4) = {
+	REGULATOR_SUPPLY("8921_s4",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd_io",		"msm_sdcc.1"),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.2"),
+	REGULATOR_SUPPLY("sdc_vdd_io",            "msm_sdcc.4"),
+	REGULATOR_SUPPLY("riva_vddpx",		"wcnss_wlan.0"),
+	REGULATOR_SUPPLY("hdmi_vcc",		"hdmi_msm.0"),
+	REGULATOR_SUPPLY("VDDIO_CDC",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDD_CP",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_TX",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_RX",		"tabla-slim"),
+	REGULATOR_SUPPLY("VDDIO_CDC",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDD_CP",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_TX",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_RX",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-005b"),
+	REGULATOR_SUPPLY("EXT_HUB_VDDIO",	"msm_smsc_hub"),
+	REGULATOR_SUPPLY("vcc_i2c",		"10-0048"),
+};
+VREG_CONSUMERS(S5) = {
+	REGULATOR_SUPPLY("8921_s5",		NULL),
+	//	REGULATOR_SUPPLY("krait0",		"acpuclk-8960"),
+	REGULATOR_SUPPLY("krait0",		NULL),
+};
+VREG_CONSUMERS(S6) = {
+	REGULATOR_SUPPLY("8921_s6",		NULL),
+	//	REGULATOR_SUPPLY("krait1",		"acpuclk-8960"),
+	REGULATOR_SUPPLY("krait1",		NULL),
+};
+VREG_CONSUMERS(S7) = {
+	REGULATOR_SUPPLY("8921_s7",		NULL),
+};
+VREG_CONSUMERS(S8) = {
+	REGULATOR_SUPPLY("8921_s8",		NULL),
+};
+VREG_CONSUMERS(LVS1) = {
+	REGULATOR_SUPPLY("8921_lvs1",		NULL),
+	REGULATOR_SUPPLY("iris_vddio",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(LVS2) = {
+	REGULATOR_SUPPLY("8921_lvs2",		NULL),
+	REGULATOR_SUPPLY("iris_vdddig",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(LVS3) = {
+	REGULATOR_SUPPLY("8921_lvs3",		NULL),
+};
+VREG_CONSUMERS(LVS4) = {
+	REGULATOR_SUPPLY("8921_lvs4",		NULL),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-0024"),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-004a"),
+};
+VREG_CONSUMERS(LVS5) = {
+	REGULATOR_SUPPLY("8921_lvs5",		NULL),
+	REGULATOR_SUPPLY("cam_vio",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vio",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0034"),
+};
+VREG_CONSUMERS(LVS6) = {
+	REGULATOR_SUPPLY("8921_lvs6",		NULL),
+	REGULATOR_SUPPLY("vdd_io",		"spi0.0"),
+};
+VREG_CONSUMERS(LVS7) = {
+	REGULATOR_SUPPLY("8921_lvs7",		NULL),
+};
+VREG_CONSUMERS(USB_OTG) = {
+	REGULATOR_SUPPLY("8921_usb_otg",	NULL),
+	REGULATOR_SUPPLY("vbus_otg",		"msm_otg"),
+};
+VREG_CONSUMERS(HDMI_MVS) = {
+	REGULATOR_SUPPLY("8921_hdmi_mvs",	NULL),
+	REGULATOR_SUPPLY("hdmi_mvs",		"hdmi_msm.0"),
+};
+VREG_CONSUMERS(NCP) = {
+	REGULATOR_SUPPLY("8921_ncp",		NULL),
+};
+VREG_CONSUMERS(EXT_5V) = {
+	REGULATOR_SUPPLY("ext_5v",		NULL),
+};
+VREG_CONSUMERS(EXT_L2) = {
+	REGULATOR_SUPPLY("ext_l2",		NULL),
+	REGULATOR_SUPPLY("vdd_phy",		"spi0.0"),
+};
+
+VREG_CONSUMERS(EXT_3P3V) = {
+	REGULATOR_SUPPLY("ext_3p3v",		NULL),
+	REGULATOR_SUPPLY("vdd_ana",		"3-005b"),
+	REGULATOR_SUPPLY("vdd_lvds_3p3v",	"mipi_dsi.1"),
+	REGULATOR_SUPPLY("mhl_usb_hs_switch",	"msm_otg"),
+};
+#if 0
+VREG_CONSUMERS(EXT_OTG_SW) = {
+	REGULATOR_SUPPLY("ext_otg_sw",		NULL),
+	REGULATOR_SUPPLY("vbus_otg",		"msm_otg"),
+};
+#endif
+#define PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
+			 _apply_uV, _pull_down, _always_on, _supply_regulator, \
+			 _system_uA, _enable_time, _reg_id) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_modes_mask	= _modes, \
+				.valid_ops_mask		= _ops, \
+				.min_uV			= _min_uV, \
+				.max_uV			= _max_uV, \
+				.input_uV		= _max_uV, \
+				.apply_uV		= _apply_uV, \
+				.always_on		= _always_on, \
+				.name			= _name, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id			= _reg_id, \
+		.pull_down_enable	= _pull_down, \
+		.system_uA		= _system_uA, \
+		.enable_time		= _enable_time, \
+	}
+
+#define PM8XXX_LDO(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_NLDO1200(_id, _name, _always_on, _pull_down, _min_uV, \
+		_max_uV, _enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_SMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_FTSMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
+		REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
+		| REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_VS(_id, _name, _always_on, _pull_down, _enable_time, \
+		_supply_regulator, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
+		_pull_down, _always_on, _supply_regulator, 0, _enable_time, \
+		_reg_id)
+
+#define PM8XXX_VS300(_id, _name, _always_on, _pull_down, _enable_time, \
+		_supply_regulator, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
+		_pull_down, _always_on, _supply_regulator, 0, _enable_time, \
+		_reg_id)
+
+#define PM8XXX_NCP(_id, _name, _always_on, _min_uV, _max_uV, _enable_time, \
+		_supply_regulator, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, 0, \
+		REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, 0, \
+		_always_on, _supply_regulator, 0, _enable_time, _reg_id)
+
+/* Pin control initialization */
+#define PM8XXX_PC(_id, _name, _always_on, _pin_fn, _pin_ctrl, \
+		  _supply_regulator, _reg_id) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+				.always_on	= _always_on, \
+				.name		= _name, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id##_PC), \
+			.consumer_supplies	= vreg_consumers_##_id##_PC, \
+			.supply_regulator  = _supply_regulator, \
+		}, \
+		.id		= _reg_id, \
+		.pin_fn		= PM8XXX_VREG_PIN_FN_##_pin_fn, \
+		.pin_ctrl	= _pin_ctrl, \
+	}
+
+#define GPIO_VREG(_id, _reg_name, _gpio_label, _gpio, _supply_regulator) \
+	[GPIO_VREG_ID_##_id] = { \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.regulator_name = _reg_name, \
+		.gpio_label	= _gpio_label, \
+		.gpio		= _gpio, \
+	}
+
+#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
+	{ \
+		.constraints = { \
+			.name		= _name, \
+			.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE, \
+			.min_uV		= _min_uV, \
+			.max_uV		= _max_uV, \
+		}, \
+		.num_consumer_supplies	= ARRAY_SIZE(vreg_consumers_##_id), \
+		.consumer_supplies	= vreg_consumers_##_id, \
+	}
+
+#define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \
+		 _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \
+		 _force_mode, _sleep_set_force_mode, _power_mode, _state, \
+		 _sleep_selectable, _always_on, _supply_regulator, _system_uA) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_modes_mask	= _modes, \
+				.valid_ops_mask		= _ops, \
+				.min_uV			= _min_uV, \
+				.max_uV			= _max_uV, \
+				.input_uV		= _min_uV, \
+				.apply_uV		= _apply_uV, \
+				.always_on		= _always_on, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id			= RPM_VREG_ID_PM8921_##_id, \
+		.default_uV		= _default_uV, \
+		.peak_uA		= _peak_uA, \
+		.avg_uA			= _avg_uA, \
+		.pull_down_enable	= _pull_down, \
+		.pin_ctrl		= _pin_ctrl, \
+		.freq			= RPM_VREG_FREQ_##_freq, \
+		.pin_fn			= _pin_fn, \
+		.force_mode		= _force_mode, \
+		.sleep_set_force_mode	= _sleep_set_force_mode, \
+		.power_mode		= _power_mode, \
+		.state			= _state, \
+		.sleep_selectable	= _sleep_selectable, \
+		.system_uA		= _system_uA, \
+	}
+
+#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
+		_supply_regulator, _system_uA, _init_peak_uA) \
+	RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
+		 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, _system_uA)
+
+#define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
+		 _supply_regulator, _system_uA, _freq, _force_mode, \
+		 _sleep_set_force_mode) \
+	RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
+		 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _system_uA, 0, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_##_force_mode, \
+		 RPM_VREG_FORCE_MODE_8960_##_sleep_set_force_mode, \
+		 RPM_VREG_POWER_MODE_8960_PWM, RPM_VREG_STATE_OFF, \
+		 _sleep_selectable, _always_on, _supply_regulator, _system_uA)
+
+#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
+	RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, 0)
+
+#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
+		_supply_regulator, _freq) \
+	RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
+		 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, 0)
+
+/* Pin control initialization */
+#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+				.always_on	= _always_on, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id##_PC), \
+			.consumer_supplies	= vreg_consumers_##_id##_PC, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id	  = RPM_VREG_ID_PM8921_##_id##_PC, \
+		.pin_fn	  = RPM_VREG_PIN_FN_8960_##_pin_fn, \
+		.pin_ctrl = _pin_ctrl, \
+	}
+
+/* GPIO regulator constraints */
+struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] __devinitdata = {
+	/*        ID      vreg_name gpio_label   gpio                  supply */
+	GPIO_VREG(EXT_5V, "ext_5v", "ext_5v_en", PM8921_MPP_PM_TO_SYS(7), NULL),
+	GPIO_VREG(EXT_L2, "ext_l2", "ext_l2_en", 91, NULL),
+	GPIO_VREG(EXT_3P3V, "ext_3p3v", "ext_3p3v_en", PM8921_GPIO_PM_TO_SYS(17), NULL),
+};
+
+/* SAW regulator constraints */
+struct regulator_init_data msm_saw_regulator_pdata_s5 =
+	/*	      ID  vreg_name	       min_uV   max_uV */
+	SAW_VREG_INIT(S5, "8921_s5",	       850000, 1300000);
+struct regulator_init_data msm_saw_regulator_pdata_s6 =
+	SAW_VREG_INIT(S6, "8921_s6",	       850000, 1300000);
+
+/* PM8921 regulator constraints */
+struct pm8xxx_regulator_platform_data
+msm_pm8921_regulator_pdata[] __devinitdata = {
+	/*
+	 *		ID   name always_on pd min_uV   max_uV   en_t supply
+	 *	system_uA reg_ID
+	 */
+	PM8XXX_NLDO1200(L26, "8921_l26", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 1),
+	PM8XXX_NLDO1200(L27, "8921_l27", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 2),
+	PM8XXX_NLDO1200(L28, "8921_l28", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 3),
+	PM8XXX_LDO(L29,      "8921_l29", 0, 1, 2050000, 2100000, 200, "8921_s8",
+		0, 4),
+
+	/*	     ID        name      always_on pd en_t supply    reg_ID */
+	PM8XXX_VS300(USB_OTG,  "8921_usb_otg",  0, 1, 0,   "ext_5v", 5),
+	PM8XXX_VS300(HDMI_MVS, "8921_hdmi_mvs", 0, 1, 0,   "ext_5v", 6),
+};
+
+static struct rpm_regulator_init_data
+msm_rpm_regulator_init_data[] __devinitdata = {
+	/*	 ID    a_on pd ss min_uV   max_uV  supply sys_uA freq */
+  RPM_SMPS(S1,	 1, 1, 0, 1225000, 1225000, NULL, 100000, 3p20, NONE, NONE),
+	RPM_SMPS(S2,	 0, 1, 0, 1300000, 1300000, NULL, 0,	  1p60, NONE, NONE),
+	RPM_SMPS(S3,	 0, 1, 1,  500000, 1150000, NULL, 100000, 4p80, NONE, NONE),
+	RPM_SMPS(S4,	 1, 1, 0, 1800000, 1800000, NULL, 100000, 3p20, NONE, NONE),
+	RPM_SMPS(S7,	 0, 1, 0, 1150000, 1150000, NULL, 100000, 3p20, NONE, NONE),
+	RPM_SMPS(S8,	 1, 1, 1, 2050000, 2050000, NULL, 100000, 1p60, NONE, NONE),
+
+	/*	ID     a_on pd ss min_uV   max_uV  supply  sys_uA init_ip */
+	RPM_LDO(L1,	 1, 1, 0, 1050000, 1050000, "8921_s4", 0, 10000),
+	RPM_LDO(L2,	 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
+	RPM_LDO(L3,	 0, 1, 0, 3075000, 3075000, NULL,      0, 0),
+	RPM_LDO(L4,	 1, 1, 0, 1800000, 1800000, NULL,      10000, 10000),
+	RPM_LDO(L5,	 0, 1, 0, 2950000, 2950000, NULL,      0, 0),
+	RPM_LDO(L6,	 0, 1, 0, 2850000, 2950000, NULL,      0, 0),
+	RPM_LDO(L7,	 1, 1, 0, 1850000, 2950000, NULL,      10000, 10000),
+	RPM_LDO(L8,	 0, 1, 0, 2800000, 2800000, NULL,      0, 0),
+	RPM_LDO(L9,	 0, 1, 0, 2800000, 2800000, NULL,      0, 0),
+	RPM_LDO(L10,	 0, 1, 0, 3000000, 3000000, NULL,      0, 0),
+	RPM_LDO(L11,	 0, 1, 0, 3000000, 3200000, NULL,      0, 0), /* XA 3.2v, XB 3.0v */
+	RPM_LDO(L12,	 0, 1, 0, 1200000, 1500000, "8921_s4", 0, 0), /* XA 1.5v, XB 1.2v */
+	RPM_LDO(L14,	 0, 1, 0, 1800000, 1800000, NULL,      0, 0),
+	RPM_LDO(L15,	 0, 1, 0, 1800000, 2950000, NULL,      0, 0),
+	RPM_LDO(L16,	 0, 1, 0, 2850000, 3300000, NULL,      0, 0), /*XA 3.3v, XB 2.85v */
+	RPM_LDO(L17,	 0, 1, 0, 2850000, 2850000, NULL,      0, 0),
+	RPM_LDO(L18,	 0, 1, 0, 1300000, 1300000, "8921_s4", 0, 0),
+	RPM_LDO(L21,	 0, 1, 0, 1900000, 1900000, "8921_s8", 0, 0),
+	RPM_LDO(L22,	 0, 1, 0, 2800000, 2800000, NULL,      0, 0),
+	RPM_LDO(L23,	 1, 1, 1, 1800000, 1800000, "8921_s8", 10000, 10000),
+	RPM_LDO(L24,	 0, 1, 1,  750000, 1150000, "8921_s1", 10000, 10000),
+	RPM_LDO(L25,	 1, 1, 0, 1225000, 1225000, "8921_s1", 10000, 10000),
+
+	/*	ID     a_on pd ss		    supply */
+	RPM_VS(LVS1,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS2,	 0, 1, 0,		    "8921_s1"),
+	RPM_VS(LVS3,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS4,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS5,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS6,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS7,	 0, 1, 0,		    "8921_s4"),
+
+	/*	 ID      a_on  ss min_uV   max_uV   supply        freq */
+	RPM_NCP(NCP,	 0,    0, 1800000, 1800000, "8921_l6",    1p60),
+};
+
+int msm_pm8921_regulator_pdata_len __devinitdata =
+	ARRAY_SIZE(msm_pm8921_regulator_pdata);
+
+#define RPM_REG_MAP(_id, _sleep_also, _voter, _supply, _dev_name) \
+	{ \
+		.vreg_id = RPM_VREG_ID_PM8921_##_id, \
+		.sleep_also = _sleep_also, \
+		.voter = _voter, \
+		.supply = _supply, \
+		.dev_name = _dev_name, \
+	}
+static struct rpm_regulator_consumer_mapping
+	      msm_rpm_regulator_consumer_mapping[] __devinitdata = {
+	RPM_REG_MAP(L23, 0, 1, "krait0_l23", "acpuclk-8960"),
+	RPM_REG_MAP(L23, 0, 2, "krait1_l23", "acpuclk-8960"),
+	RPM_REG_MAP(L23, 0, 6, "l2_l23",     "acpuclk-8960"),
+	RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8960"),
+	RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8960"),
+	RPM_REG_MAP(S3,  0, 1, "krait0_dig", "acpuclk-8960"),
+	RPM_REG_MAP(S3,  0, 2, "krait1_dig", "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 1, "krait0_s8",  "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 2, "krait1_s8",  "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 6, "l2_s8",      "acpuclk-8960"),
+};
+
+struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
+	.name	= GPIO_REGULATOR_DEV_NAME,
+	.id	= PM8921_MPP_PM_TO_SYS(7),
+	.dev	= {
+		.platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
+	},
+};
+
+struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
+	.name	= GPIO_REGULATOR_DEV_NAME,
+	.id	= 91,
+	.dev	= {
+		.platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
+	},
+};
+
+struct rpm_regulator_platform_data elite_rpm_regulator_pdata __devinitdata = {
+	.init_data		= msm_rpm_regulator_init_data,
+	.num_regulators		= ARRAY_SIZE(msm_rpm_regulator_init_data),
+	.version		= RPM_VREG_VERSION_8960,
+	.vreg_id_vdd_mem	= RPM_VREG_ID_PM8921_L24,
+	.vreg_id_vdd_dig	= RPM_VREG_ID_PM8921_S3,
+	.consumer_map		= msm_rpm_regulator_consumer_mapping,
+	.consumer_map_len = ARRAY_SIZE(msm_rpm_regulator_consumer_mapping),
+};
diff --git a/arch/arm/mach-msm/htc/elite/board-elite-storage.c b/arch/arm/mach-msm/htc/elite/board-elite-storage.c
new file mode 100644
index 0000000..89b4bdd
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/board-elite-storage.c
@@ -0,0 +1,388 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/bootmem.h>
+#include <linux/gpio.h>
+#include <asm/mach-types.h>
+#include <asm/mach/mmc.h>
+#include <mach/board.h>
+#include <mach/gpiomux.h>
+#include "devices.h"
+#include "board-elite.h"
+#include "board-storage-common-a.h"
+
+/* MSM8960 has 5 SDCC controllers */
+enum sdcc_controllers {
+	SDCC1,
+	SDCC2,
+	SDCC3,
+	SDCC4,
+	SDCC5,
+	MAX_SDCC_CONTROLLER
+};
+
+/* All SDCC controllers require VDD/VCC voltage */
+static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
+	/* SDCC1 : eMMC card connected */
+	[SDCC1] = {
+		.name = "sdc_vdd",
+		.high_vol_level = 2950000,
+		.low_vol_level = 2950000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		.lpm_uA = 9000,
+		.hpm_uA = 200000, /* 200mA */
+	},
+	/* SDCC2 : SDIO slot connected */
+	[SDCC2] = {
+		.name = "sdc_vdd",
+		.high_vol_level = 1800000,
+		.low_vol_level = 1800000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		.lpm_uA = 9000,
+		.hpm_uA = 200000, /* 200mA */
+	},
+	/* SDCC3 : External card slot connected */
+	[SDCC3] = {
+		.name = "sdc_vdd",
+		.high_vol_level = 2950000,
+		.low_vol_level = 2950000,
+		.hpm_uA = 600000, /* 600mA */
+	}
+};
+
+/* SDCC controllers may require voting for IO operating voltage */
+static struct msm_mmc_reg_data mmc_vdd_io_reg_data[MAX_SDCC_CONTROLLER] = {
+	/* SDCC1 : eMMC card connected */
+	[SDCC1] = {
+		.name = "sdc_vdd_io",
+		.always_on = 1,
+		.high_vol_level = 1800000,
+		.low_vol_level = 1800000,
+		.hpm_uA = 200000, /* 200mA */
+	},
+	/* SDCC3 : External card slot connected */
+	[SDCC3] = {
+		.name = "sdc_vdd_io",
+		.high_vol_level = 2950000,
+		.low_vol_level = 1850000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		/* Max. Active current required is 16 mA */
+		.hpm_uA = 16000,
+		/*
+		 * Sleep current required is ~300 uA. But min. vote can be
+		 * in terms of mA (min. 1 mA). So let's vote for 2 mA
+		 * during sleep.
+		 */
+		.lpm_uA = 2000,
+	},
+	/* SDCC4 : SDIO slot connected */
+	[SDCC4] = {
+		.name = "sdc_vdd_io",
+		.high_vol_level = 1800000,
+		.low_vol_level = 1800000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		.hpm_uA = 200000, /* 200mA */
+		.lpm_uA = 2000,
+	},
+};
+
+static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
+	/* SDCC1 : eMMC card connected */
+	[SDCC1] = {
+		.vdd_data = &mmc_vdd_reg_data[SDCC1],
+		.vdd_io_data = &mmc_vdd_io_reg_data[SDCC1],
+	},
+	/* SDCC2 : SDIO card slot connected */
+	[SDCC2] = {
+		.vdd_data = &mmc_vdd_reg_data[SDCC2],
+	},
+	/* SDCC3 : External card slot connected */
+	[SDCC3] = {
+		.vdd_data = &mmc_vdd_reg_data[SDCC3],
+		.vdd_io_data = &mmc_vdd_io_reg_data[SDCC3],
+	},
+	/* SDCC4 : SDIO card slot connected */
+	[SDCC4] = {
+		.vdd_io_data = &mmc_vdd_io_reg_data[SDCC4],
+	},
+};
+
+/* SDC1 pad data */
+static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
+	{TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
+	{TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
+	{TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
+};
+
+static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
+	{TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
+};
+
+static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
+	{TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
+	{TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
+};
+
+/* SDC3 pad data */
+static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
+	{TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
+	{TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
+	{TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
+};
+
+static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
+	{TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
+};
+
+static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
+	{TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
+	{TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
+	/*
+	 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
+	 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
+	 * which would result in false card detection interrupts.
+	 */
+	{TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
+	/*
+	 * Keeping DATA lines status to PULL UP will make sure that
+	 * there is no current leak during sleep if external pull up
+	 * is connected to DATA lines.
+	 */
+	{TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.on = sdc1_pad_pull_on_cfg,
+		.off = sdc1_pad_pull_off_cfg,
+		.size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
+	},
+	[SDCC3] = {
+		.on = sdc3_pad_pull_on_cfg,
+		.off = sdc3_pad_pull_off_cfg,
+		.size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
+	},
+};
+
+static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.on = sdc1_pad_drv_on_cfg,
+		.off = sdc1_pad_drv_off_cfg,
+		.size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
+	},
+	[SDCC3] = {
+		.on = sdc3_pad_drv_on_cfg,
+		.off = sdc3_pad_drv_off_cfg,
+		.size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
+	},
+};
+
+struct msm_mmc_gpio sdc2_gpio[] = {
+	{92, "sdc2_dat_3"},
+	{91, "sdc2_dat_2"},
+	{90, "sdc2_dat_1"},
+	{89, "sdc2_dat_0"},
+	{97, "sdc2_cmd"},
+	{98, "sdc2_clk"}
+};
+
+struct msm_mmc_gpio sdc4_gpio[] = {
+	{83, "sdc4_dat_3"},
+	{84, "sdc4_dat_2"},
+	{85, "sdc4_dat_1"},
+	{86, "sdc4_dat_0"},
+	{87, "sdc4_cmd"},
+	{88, "sdc4_clk"}
+};
+
+struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC2] = {
+		.gpio = sdc2_gpio,
+		.size = ARRAY_SIZE(sdc2_gpio),
+	},
+	[SDCC4] = {
+		.gpio = sdc4_gpio,
+		.size = ARRAY_SIZE(sdc4_gpio),
+	},
+};
+
+static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.pull = &mmc_pad_pull_data[SDCC1],
+		.drv = &mmc_pad_drv_data[SDCC1]
+	},
+	[SDCC3] = {
+		.pull = &mmc_pad_pull_data[SDCC3],
+		.drv = &mmc_pad_drv_data[SDCC3]
+	},
+};
+
+static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.pad_data = &mmc_pad_data[SDCC1],
+	},
+	[SDCC2] = {
+		.is_gpio = 1,
+		.gpio_data = &mmc_gpio_data[SDCC2],
+	},
+	[SDCC3] = {
+		.pad_data = &mmc_pad_data[SDCC3],
+	},
+	[SDCC4] = {
+		.is_gpio = 1,
+		.gpio_data = &mmc_gpio_data[SDCC4],
+	},
+};
+
+#define MSM_MPM_PIN_SDC1_DAT1	17
+#define MSM_MPM_PIN_SDC3_DAT1	21
+
+static unsigned int sdc1_sup_clk_rates[] = {
+	400000, 24000000, 48000000, 96000000
+};
+
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+static unsigned int sdc3_sup_clk_rates[] = {
+	400000, 24000000, 48000000, 96000000, 192000000
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
+static struct mmc_platform_data msm8960_sdc1_data = {
+	.ocr_mask       = MMC_VDD_27_28 | MMC_VDD_28_29,
+#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
+	.mmc_bus_width  = MMC_CAP_8_BIT_DATA,
+#else
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+#endif
+	.sup_clk_table	= sdc1_sup_clk_rates,
+	.sup_clk_cnt	= ARRAY_SIZE(sdc1_sup_clk_rates),
+	.nonremovable	= 1,
+	.vreg_data	= &mmc_slot_vreg_data[SDCC1],
+	.pin_data	= &mmc_slot_pin_data[SDCC1],
+	.mpm_sdiowakeup_int = MSM_MPM_PIN_SDC1_DAT1,
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+	.uhs_caps2	= MMC_CAP2_HS200_1_8V_SDR,
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
+static unsigned int sdc2_sup_clk_rates[] = {
+	400000, 24000000, 48000000
+};
+
+static struct mmc_platform_data msm8960_sdc2_data = {
+	.ocr_mask       = MMC_VDD_165_195,
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+	.sup_clk_table  = sdc2_sup_clk_rates,
+	.sup_clk_cnt    = ARRAY_SIZE(sdc2_sup_clk_rates),
+	.vreg_data      = &mmc_slot_vreg_data[SDCC2],
+	.pin_data       = &mmc_slot_pin_data[SDCC2],
+	.sdiowakeup_irq = MSM_GPIO_TO_INT(90),
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+static struct mmc_platform_data msm8960_sdc3_data = {
+	.ocr_mask       = MMC_VDD_27_28 | MMC_VDD_28_29,
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+	.sup_clk_table	= sdc3_sup_clk_rates,
+	.sup_clk_cnt	= ARRAY_SIZE(sdc3_sup_clk_rates),
+#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
+	.wpswitch_gpio	= PM8921_GPIO_PM_TO_SYS(16),
+#endif
+	.vreg_data	= &mmc_slot_vreg_data[SDCC3],
+	.pin_data	= &mmc_slot_pin_data[SDCC3],
+	.status_gpio	= PM8921_GPIO_PM_TO_SYS(26),
+	.status_irq	= PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
+	.irq_flags	= IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+	.is_status_gpio_active_low = true,
+	.xpc_cap	= 1,
+	.uhs_caps	= (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
+			MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
+			MMC_CAP_UHS_SDR104 | MMC_CAP_MAX_CURRENT_600),
+	.mpm_sdiowakeup_int = MSM_MPM_PIN_SDC3_DAT1,
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
+static unsigned int sdc4_sup_clk_rates[] = {
+	400000, 24000000, 48000000
+};
+
+static struct mmc_platform_data msm8960_sdc4_data = {
+	.ocr_mask       = MMC_VDD_165_195,
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+	.sup_clk_table  = sdc4_sup_clk_rates,
+	.sup_clk_cnt    = ARRAY_SIZE(sdc4_sup_clk_rates),
+	.vreg_data      = &mmc_slot_vreg_data[SDCC4],
+	.pin_data       = &mmc_slot_pin_data[SDCC4],
+	.sdiowakeup_irq = MSM_GPIO_TO_INT(85),
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+};
+#endif
+
+void __init elite_init_mmc(void)
+{
+#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
+	/*
+	 * When eMMC runs in DDR mode on CDP platform, we have
+	 * seen instability due to DATA CRC errors. These errors are
+	 * attributed to long physical path between MSM and eMMC on CDP.
+	 * So let's not enable the DDR mode on CDP platform but let other
+	 * platforms take advantage of eMMC DDR mode.
+	 */
+	if (!machine_is_msm8960_cdp())
+		msm8960_sdc1_data.uhs_caps |= (MMC_CAP_1_8V_DDR |
+					       MMC_CAP_UHS_DDR50);
+	/* SDC1 : eMMC card connected */
+	msm_add_sdcc(1, &msm8960_sdc1_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
+	/* SDC2: SDIO slot for WLAN*/
+	msm_add_sdcc(2, &msm8960_sdc2_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+	/* SDC3: External card slot */
+	msm_add_sdcc(3, &msm8960_sdc3_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
+	/* SDC4: SDIO slot for WLAN */
+	msm_add_sdcc(4, &msm8960_sdc4_data);
+#endif
+}
diff --git a/arch/arm/mach-msm/htc/elite/board-elite.c b/arch/arm/mach-msm/htc/elite/board-elite.c
new file mode 100644
index 0000000..9af010b
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/board-elite.c
@@ -0,0 +1,4395 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/i2c.h>
+#include <linux/i2c/sx150x.h>
+#include <linux/gpio.h>
+#include <linux/usb/android.h>
+#include <linux/msm_ssbi.h>
+#include <linux/pn544.h>
+#include <linux/regulator/msm-gpio-regulator.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/regulator/consumer.h>
+#include <linux/spi/spi.h>
+#include <linux/slimbus/slimbus.h>
+#include <linux/bootmem.h>
+#ifdef CONFIG_ANDROID_PMEM
+#include <linux/android_pmem.h>
+#endif
+#include <linux/synaptics_i2c_rmi.h>
+#include <linux/dma-contiguous.h>
+#include <linux/dma-mapping.h>
+#include <linux/platform_data/qcom_crypto_device.h>
+#include <linux/platform_data/qcom_wcnss_device.h>
+#include <linux/leds.h>
+#include <linux/leds-pm8xxx-htc.h>
+#include <linux/msm_tsens.h>
+#include <linux/proc_fs.h>
+#include <linux/cm3629.h>
+#include <linux/memblock.h>
+#include <linux/msm_thermal.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/setup.h>
+#include <asm/hardware/gic.h>
+#include <asm/mach/mmc.h>
+
+#include <mach/board.h>
+#include <mach/msm_iomap.h>
+#include <mach/msm_spi.h>
+#ifdef CONFIG_USB_MSM_OTG_72K
+#include <mach/msm_hsusb.h>
+#else
+#include <linux/usb/msm_hsusb.h>
+#endif
+#include <mach/usbdiag.h>
+#include <mach/socinfo.h>
+#include <mach/rpm.h>
+#include <mach/gpio.h>
+#include <mach/msm_bus_board.h>
+#include <mach/msm_memtypes.h>
+#include <mach/dma.h>
+#include <mach/msm_dsps.h>
+#include <mach/msm_xo.h>
+#include <mach/restart.h>
+#include <mach/panel_id.h>
+#ifdef CONFIG_WCD9310_CODEC
+#include <linux/slimbus/slimbus.h>
+#include <linux/mfd/wcd9xxx/core.h>
+#include <linux/mfd/wcd9xxx/pdata.h>
+#endif
+#include <linux/a1028.h>
+#include <linux/msm_ion.h>
+#include <mach/ion.h>
+
+#include <mach/msm_rtb.h>
+#include <mach/msm_cache_dump.h>
+#include <mach/scm.h>
+#include <mach/iommu_domains.h>
+
+#include <mach/kgsl.h>
+#include <linux/fmem.h>
+
+#include <linux/mpu.h>
+#include <linux/r3gd20.h>
+#include <linux/akm8975.h>
+#include <linux/bma250.h>
+#include <linux/ewtzmu2.h>
+#ifdef CONFIG_BT
+#include <mach/htc_bdaddress.h>
+#endif
+#include <mach/htc_headset_mgr.h>
+#include <mach/htc_headset_pmic.h>
+#include <mach/cable_detect.h>
+
+#include "timer.h"
+#include "devices.h"
+#include "devices-msm8x60.h"
+#include "spm.h"
+#include "board-elite.h"
+#include "pm.h"
+#include <mach/cpuidle.h>
+#include "rpm_resources.h"
+#include <mach/mpm.h>
+#include "acpuclock.h"
+#include "rpm_log.h"
+#include "smd_private.h"
+#include "pm-boot.h"
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+#include <mach/mhl.h>
+#endif
+
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#include <linux/htc_flashlight.h>
+#endif
+
+#include <mach/board_htc.h>
+#include <linux/mfd/pm8xxx/pm8xxx-vibrator-pwm.h>
+#ifdef CONFIG_HTC_BATT_8960
+#include "mach/htc_battery_8960.h"
+#include "mach/htc_battery_cell.h"
+#include "linux/mfd/pm8xxx/pm8921-charger-htc.h"
+#endif
+
+#ifdef CONFIG_PERFLOCK
+#include <mach/perflock.h>
+#endif
+
+extern unsigned int engineerid; // bit 0
+
+#define HW_VER_ID_VIRT		(MSM_TLMM_BASE + 0x00002054)
+
+unsigned skuid;
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+static void config_flashlight_gpios(void)
+{
+	static uint32_t flashlight_gpio_table[] = {
+		GPIO_CFG(32, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+		GPIO_CFG(33, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	};
+
+	gpio_tlmm_config(flashlight_gpio_table[0], GPIO_CFG_ENABLE);
+	gpio_tlmm_config(flashlight_gpio_table[1], GPIO_CFG_ENABLE);
+}
+
+static struct TPS61310_flashlight_platform_data elite_flashlight_data = {
+	.gpio_init = config_flashlight_gpios,
+	.tps61310_strb0 = 33,
+	.tps61310_strb1 = 32,
+	.led_count = 1,
+	.flash_duration_ms = 600,
+};
+
+static struct i2c_board_info i2c_tps61310_flashlight[] = {
+	{
+		I2C_BOARD_INFO("TPS61310_FLASHLIGHT", 0x66 >> 1),
+		.platform_data = &elite_flashlight_data,
+	},
+};
+#endif
+#endif
+
+static struct platform_device msm_fm_platform_init = {
+	.name = "iris_fm",
+	.id   = -1,
+};
+
+#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
+enum {
+	GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
+	GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
+	/* CAM Expander */
+	GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
+	GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
+	GPIO_CAM_GP_AFBUSY,
+	GPIO_CAM_GP_STROBE_CE,
+	GPIO_CAM_GP_CAM1MP_XCLR,
+	GPIO_CAM_GP_CAMIF_RESET_N,
+	GPIO_CAM_GP_XMT_FLASH_INT,
+	GPIO_CAM_GP_LED_EN1,
+	GPIO_CAM_GP_LED_EN2,
+
+};
+#endif
+
+#ifdef CONFIG_I2C
+
+#define MSM_8960_GSBI5_QUP_I2C_BUS_ID 5
+#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
+#define MSM_8960_GSBI2_QUP_I2C_BUS_ID 2
+#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
+#define MSM_8960_GSBI8_QUP_I2C_BUS_ID 8
+#define MSM_8960_GSBI12_QUP_I2C_BUS_ID 12
+
+#endif
+
+#define MSM_PMEM_ADSP_SIZE         0x6D00000
+#define MSM_PMEM_AUDIO_SIZE        0x4CF000
+#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
+#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
+#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
+
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+#define HOLE_SIZE	0x20000
+#define MSM_CONTIG_MEM_SIZE  0x65000
+#ifdef CONFIG_MSM_IOMMU
+#define MSM_ION_MM_SIZE            0x3800000 /* Need to be multiple of 64K */
+#define MSM_ION_SF_SIZE            0x0
+#define MSM_ION_QSECOM_SIZE        0x780000 /* (7.5MB) */
+#define MSM_ION_HEAP_NUM	7
+#else
+#define MSM_ION_MM_SIZE            MSM_PMEM_ADSP_SIZE
+#define MSM_ION_SF_SIZE            MSM_PMEM_SIZE
+#define MSM_ION_QSECOM_SIZE        0x600000 /* (6MB) */
+#define MSM_ION_HEAP_NUM	8
+#endif
+#define MSM_ION_MM_FW_SIZE	(0x200000 - HOLE_SIZE) /* 128kb */
+#define MSM_ION_MFC_SIZE	SZ_8K
+#define MSM_ION_AUDIO_SIZE	MSM_PMEM_AUDIO_SIZE
+
+#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
+#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
+#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
+
+#define MSM_MM_FW_SIZE		(0x200000 - HOLE_SIZE) /* 2mb -128kb*/
+#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
+							HOLE_SIZE))
+#define MAX_FIXED_AREA_SIZE	0x10000000
+#define MSM8960_FW_START	MSM8960_FIXED_AREA_START
+#define MSM_ION_ADSP_SIZE	SZ_8M
+#else
+#define MSM_CONTIG_MEM_SIZE  0x110C000
+#define MSM_ION_HEAP_NUM	1
+#endif
+
+static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
+#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
+static int __init msm_contig_mem_size_setup(char *p)
+{
+	msm_contig_mem_size = memparse(p, NULL);
+	return 0;
+}
+early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
+#endif
+
+#ifdef CONFIG_ANDROID_PMEM
+static unsigned pmem_size = MSM_PMEM_SIZE;
+static unsigned pmem_param_set = 0;
+static int __init pmem_size_setup(char *p)
+{
+	pmem_size = memparse(p, NULL);
+	pmem_param_set = 1;
+	return 0;
+}
+early_param("pmem_size", pmem_size_setup);
+
+static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
+
+static int __init pmem_adsp_size_setup(char *p)
+{
+	pmem_adsp_size = memparse(p, NULL);
+	return 0;
+}
+early_param("pmem_adsp_size", pmem_adsp_size_setup);
+
+static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
+
+static int __init pmem_audio_size_setup(char *p)
+{
+	pmem_audio_size = memparse(p, NULL);
+	return 0;
+}
+early_param("pmem_audio_size", pmem_audio_size_setup);
+#endif
+
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+static struct android_pmem_platform_data android_pmem_pdata = {
+	.name = "pmem",
+	.allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
+	.cached = 1,
+	.memory_type = MEMTYPE_EBI1,
+};
+
+static struct platform_device android_pmem_device = {
+	.name = "android_pmem",
+	.id = 0,
+	.dev = {.platform_data = &android_pmem_pdata},
+};
+
+static struct android_pmem_platform_data android_pmem_adsp_pdata = {
+	.name = "pmem_adsp",
+	.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
+	.cached = 0,
+	.memory_type = MEMTYPE_EBI1,
+};
+
+static struct platform_device android_pmem_adsp_device = {
+	.name = "android_pmem",
+	.id = 2,
+	.dev = { .platform_data = &android_pmem_adsp_pdata },
+};
+
+static struct android_pmem_platform_data android_pmem_audio_pdata = {
+	.name = "pmem_audio",
+	.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
+	.cached = 0,
+	.memory_type = MEMTYPE_EBI1,
+};
+
+static struct platform_device android_pmem_audio_device = {
+	.name = "android_pmem",
+	.id = 4,
+	.dev = { .platform_data = &android_pmem_audio_pdata },
+};
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+
+struct fmem_platform_data fmem_pdata = {
+};
+
+static struct memtype_reserve msm8960_reserve_table[] __initdata = {
+	[MEMTYPE_SMI] = {
+	},
+	[MEMTYPE_EBI0] = {
+		.flags	=	MEMTYPE_FLAGS_1M_ALIGN,
+	},
+	[MEMTYPE_EBI1] = {
+		.flags	=	MEMTYPE_FLAGS_1M_ALIGN,
+	},
+};
+
+#if defined(CONFIG_MSM_RTB)
+static struct msm_rtb_platform_data msm_rtb_pdata = {
+	.size = SZ_1K,
+};
+
+static int __init msm_rtb_set_buffer_size(char *p)
+{
+	int s;
+
+	s = memparse(p, NULL);
+	msm_rtb_pdata.size = ALIGN(s, SZ_4K);
+	return 0;
+}
+early_param("msm_rtb_size", msm_rtb_set_buffer_size);
+
+
+static struct platform_device msm_rtb_device = {
+	.name           = "msm_rtb",
+	.id             = -1,
+	.dev            = {
+		.platform_data = &msm_rtb_pdata,
+	},
+};
+#endif
+
+static void __init reserve_rtb_memory(void)
+{
+#if defined(CONFIG_MSM_RTB)
+	msm8960_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
+#endif
+}
+
+static void __init size_pmem_devices(void)
+{
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	android_pmem_adsp_pdata.size = pmem_adsp_size;
+
+	if (!pmem_param_set && machine_is_msm8960_liquid())
+		pmem_size = MSM_LIQUID_PMEM_SIZE;
+	android_pmem_pdata.size = pmem_size;
+
+	android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+}
+
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+static void __init reserve_memory_for(struct android_pmem_platform_data *p)
+{
+	msm8960_reserve_table[p->memory_type].size += p->size;
+}
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+
+static void __init reserve_pmem_memory(void)
+{
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	reserve_memory_for(&android_pmem_adsp_pdata);
+	reserve_memory_for(&android_pmem_pdata);
+	reserve_memory_for(&android_pmem_audio_pdata);
+#endif
+	msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
+#endif
+}
+
+static int msm8960_paddr_to_memtype(unsigned int paddr)
+{
+	return MEMTYPE_EBI1;
+}
+
+#define FMEM_ENABLED 0
+
+#ifdef CONFIG_ION_MSM
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
+	.permission_type = IPT_TYPE_MM_CARVEOUT,
+	.align = PAGE_SIZE,
+	.reusable = FMEM_ENABLED,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_MIDDLE,
+	.iommu_map_all = 1,
+	.iommu_2x_map_domain = VIDEO_DOMAIN,
+#ifdef CONFIG_CMA
+	.is_cma = 1,
+#endif
+};
+
+static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
+	.permission_type = IPT_TYPE_MFC_SHAREDMEM,
+	.align = PAGE_SIZE,
+	.reusable = 0,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_HIGH,
+};
+
+static struct ion_co_heap_pdata co_ion_pdata = {
+	.adjacent_mem_id = INVALID_HEAP_ID,
+	.align = PAGE_SIZE,
+	.mem_is_fmem = 0,
+};
+
+static struct ion_co_heap_pdata fw_co_ion_pdata = {
+	.adjacent_mem_id = ION_CP_MM_HEAP_ID,
+	.align = SZ_128K,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_LOW,
+};
+#endif
+
+static u64 msm_dmamask = DMA_BIT_MASK(32);
+
+static struct platform_device ion_mm_heap_device = {
+	.name = "ion-mm-heap-device",
+	.id = -1,
+	.dev = {
+		.dma_mask = &msm_dmamask,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	}
+};
+
+#ifdef CONFIG_CMA
+static struct platform_device ion_adsp_heap_device = {
+	.name = "ion-adsp-heap-device",
+	.id = -1,
+	.dev = {
+		.dma_mask = &msm_dmamask,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	}
+};
+#endif
+
+/**
+ * These heaps are listed in the order they will be allocated. Due to
+ * video hardware restrictions and content protection the FW heap has to
+ * be allocated adjacent (below) the MM heap and the MFC heap has to be
+ * allocated after the MM heap to ensure MFC heap is not more than 256MB
+ * away from the base address of the FW heap.
+ * However, the order of FW heap and MM heap doesn't matter since these
+ * two heaps are taken care of by separate code to ensure they are adjacent
+ * to each other.
+ * Don't swap the order unless you know what you are doing!
+ */
+struct ion_platform_heap msm8960_heaps[] = {
+		{
+			.id	= ION_SYSTEM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_SYSTEM,
+			.name	= ION_VMALLOC_HEAP_NAME,
+		},
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+		{
+			.id	= ION_CP_MM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CP,
+			.name	= ION_MM_HEAP_NAME,
+			.size	= MSM_ION_MM_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &cp_mm_ion_pdata,
+			.priv	= &ion_mm_heap_device.dev,
+		},
+		{
+			.id	= ION_MM_FIRMWARE_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_MM_FIRMWARE_HEAP_NAME,
+			.size	= MSM_ION_MM_FW_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &fw_co_ion_pdata,
+		},
+		{
+			.id	= ION_CP_MFC_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CP,
+			.name	= ION_MFC_HEAP_NAME,
+			.size	= MSM_ION_MFC_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &cp_mfc_ion_pdata,
+		},
+#ifndef CONFIG_MSM_IOMMU
+		{
+			.id	= ION_SF_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_SF_HEAP_NAME,
+			.size	= MSM_ION_SF_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+#endif
+		{
+			.id	= ION_IOMMU_HEAP_ID,
+			.type	= ION_HEAP_TYPE_IOMMU,
+			.name	= ION_IOMMU_HEAP_NAME,
+		},
+		{
+			.id	= ION_QSECOM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_QSECOM_HEAP_NAME,
+			.size	= MSM_ION_QSECOM_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+		{
+			.id	= ION_AUDIO_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_AUDIO_HEAP_NAME,
+			.size	= MSM_ION_AUDIO_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+#ifdef CONFIG_CMA
+		{
+			.id	= ION_ADSP_HEAP_ID,
+			.type	= ION_HEAP_TYPE_DMA,
+			.name	= ION_ADSP_HEAP_NAME,
+			.size	= MSM_ION_ADSP_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+			.priv	= &ion_adsp_heap_device.dev,
+		},
+#endif
+#endif
+};
+
+static struct ion_platform_data msm8960_ion_pdata = {
+	.nr = MSM_ION_HEAP_NUM,
+	.heaps = msm8960_heaps,
+};
+
+static struct platform_device ion_dev = {
+	.name = "ion-msm",
+	.id = 1,
+	.dev = { .platform_data = &msm8960_ion_pdata },
+};
+#endif
+
+struct platform_device fmem_device = {
+	.name = "fmem",
+	.id = 1,
+	.dev = { .platform_data = &fmem_pdata },
+};
+
+static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
+				      unsigned long size)
+{
+	msm8960_reserve_table[MEMTYPE_EBI1].size += size;
+}
+
+static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
+{
+#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	int ret;
+
+	if (fixed_area_size > MAX_FIXED_AREA_SIZE)
+		panic("fixed area size is larger than %dM\n",
+			MAX_FIXED_AREA_SIZE >> 20);
+
+	reserve_info->fixed_area_size = fixed_area_size;
+	reserve_info->fixed_area_start = MSM8960_FW_START;
+
+	ret = memblock_remove(reserve_info->fixed_area_start,
+		reserve_info->fixed_area_size);
+	BUG_ON(ret);
+#endif
+}
+
+/**
+ * Reserve memory for ION and calculate amount of reusable memory for fmem.
+ * We only reserve memory for heaps that are not reusable. However, we only
+ * support one reusable heap at the moment so we ignore the reusable flag for
+ * other than the first heap with reusable flag set. Also handle special case
+ * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
+ * at a higher address than FW in addition to not more than 256MB away from the
+ * base address of the firmware. This means that if MM is reusable the other
+ * two heaps must be allocated in the same region as FW. This is handled by the
+ * mem_is_fmem flag in the platform data. In addition the MM heap must be
+ * adjacent to the FW heap for content protection purposes.
+ */
+static void __init reserve_ion_memory(void)
+{
+#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	unsigned int i;
+	int ret;
+	unsigned int fixed_size = 0;
+	unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
+	unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
+	unsigned long cma_alignment;
+	unsigned int low_use_cma = 0;
+	unsigned int middle_use_cma = 0;
+	unsigned int high_use_cma = 0;
+
+	fixed_low_size = 0;
+	fixed_middle_size = 0;
+	fixed_high_size = 0;
+
+	cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
+
+	for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
+		struct ion_platform_heap *heap =
+						&(msm8960_ion_pdata.heaps[i]);
+		int align = SZ_4K;
+		int iommu_map_all = 0;
+		int adjacent_mem_id = INVALID_HEAP_ID;
+		int use_cma = 0;
+
+		if (heap->extra_data) {
+			int fixed_position = NOT_FIXED;
+
+			switch ((int) heap->type) {
+			case ION_HEAP_TYPE_CP:
+				fixed_position = ((struct ion_cp_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				align = ((struct ion_cp_heap_pdata *)
+						heap->extra_data)->align;
+				iommu_map_all =
+					((struct ion_cp_heap_pdata *)
+					heap->extra_data)->iommu_map_all;
+				if (((struct ion_cp_heap_pdata *)
+					heap->extra_data)->is_cma) {
+					heap->size = ALIGN(heap->size,
+							cma_alignment);
+					use_cma = 1;
+				}
+				break;
+			case ION_HEAP_TYPE_DMA:
+					use_cma = 1;
+				/* Purposely fall through here */
+			case ION_HEAP_TYPE_CARVEOUT:
+				fixed_position = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				adjacent_mem_id = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->adjacent_mem_id;
+				break;
+			default:
+				break;
+			}
+
+			if (iommu_map_all) {
+				if (heap->size & (SZ_64K-1)) {
+					heap->size = ALIGN(heap->size, SZ_64K);
+					pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
+						heap->name, heap->size);
+				}
+			}
+
+			if (fixed_position != NOT_FIXED)
+				fixed_size += heap->size;
+			else
+				reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
+
+			if (fixed_position == FIXED_LOW) {
+				fixed_low_size += heap->size;
+				low_use_cma = use_cma;
+			} else if (fixed_position == FIXED_MIDDLE) {
+				fixed_middle_size += heap->size;
+				middle_use_cma = use_cma;
+			} else if (fixed_position == FIXED_HIGH) {
+				fixed_high_size += heap->size;
+				high_use_cma = use_cma;
+			} else if (use_cma) {
+				/*
+				 * Heaps that use CMA but are not part of the
+				 * fixed set. Create wherever.
+				 */
+				dma_declare_contiguous(
+					heap->priv,
+					heap->size,
+					0,
+					0xb0000000);
+			}
+		}
+	}
+
+	if (!fixed_size)
+		return;
+
+	/*
+	 * Given the setup for the fixed area, we can't round up all sizes.
+	 * Some sizes must be set up exactly and aligned correctly. Incorrect
+	 * alignments are considered a configuration issue
+	 */
+
+	fixed_low_start = MSM8960_FIXED_AREA_START;
+	if (low_use_cma) {
+		BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
+		BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
+	} else {
+		BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
+		ret = memblock_remove(fixed_low_start,
+				      fixed_low_size + HOLE_SIZE);
+		BUG_ON(ret);
+	}
+
+	fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
+	if (middle_use_cma) {
+		BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
+		BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
+	} else {
+		BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
+		ret = memblock_remove(fixed_middle_start, fixed_middle_size);
+		BUG_ON(ret);
+	}
+
+	fixed_high_start = fixed_middle_start + fixed_middle_size;
+	if (high_use_cma) {
+		fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
+		BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
+	} else {
+		/* This is the end of the fixed area so it's okay to round up */
+		fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
+		ret = memblock_remove(fixed_high_start, fixed_high_size);
+		BUG_ON(ret);
+	}
+
+
+
+	for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
+		struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
+
+		if (heap->extra_data) {
+			int fixed_position = NOT_FIXED;
+			struct ion_cp_heap_pdata *pdata = NULL;
+
+			switch ((int) heap->type) {
+			case ION_HEAP_TYPE_CP:
+				pdata =
+				(struct ion_cp_heap_pdata *)heap->extra_data;
+				fixed_position = pdata->fixed_position;
+				break;
+			case ION_HEAP_TYPE_CARVEOUT:
+			case ION_HEAP_TYPE_DMA:
+				fixed_position = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				break;
+			default:
+				break;
+			}
+
+			switch (fixed_position) {
+			case FIXED_LOW:
+				heap->base = fixed_low_start;
+				break;
+			case FIXED_MIDDLE:
+				heap->base = fixed_middle_start;
+				if (middle_use_cma) {
+					ret = dma_declare_contiguous(
+						&ion_mm_heap_device.dev,
+						heap->size,
+						fixed_middle_start,
+						0xa0000000);
+					WARN_ON(ret);
+				}
+				pdata->secure_base = fixed_middle_start
+							- HOLE_SIZE;
+				pdata->secure_size = HOLE_SIZE + heap->size;
+				break;
+			case FIXED_HIGH:
+				heap->base = fixed_high_start;
+				break;
+			default:
+				break;
+			}
+		}
+	}
+#endif
+}
+
+static void __init reserve_mdp_memory(void)
+{
+	msm8960_mdp_writeback(msm8960_reserve_table);
+}
+
+#if defined(CONFIG_MSM_CACHE_DUMP)
+static struct msm_cache_dump_platform_data msm_cache_dump_pdata = {
+	.l2_size = L2_BUFFER_SIZE,
+};
+
+static struct platform_device msm_cache_dump_device = {
+	.name		= "msm_cache_dump",
+	.id		= -1,
+	.dev		= {
+		.platform_data = &msm_cache_dump_pdata,
+	},
+};
+#endif
+
+static void reserve_cache_dump_memory(void)
+{
+#ifdef CONFIG_MSM_CACHE_DUMP
+	unsigned int spare;
+	unsigned int l1_size;
+	unsigned int total;
+	int ret;
+
+	ret = scm_call(L1C_SERVICE_ID, L1C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
+		sizeof(spare), &l1_size, sizeof(l1_size));
+
+	if (ret)
+		/* Fall back to something reasonable here */
+		l1_size = L1_BUFFER_SIZE;
+
+	total = l1_size + L2_BUFFER_SIZE;
+
+	msm8960_reserve_table[MEMTYPE_EBI1].size += total;
+	msm_cache_dump_pdata.l1_size = l1_size;
+#endif
+}
+
+static void __init msm8960_calculate_reserve_sizes(void)
+{
+	size_pmem_devices();
+	reserve_pmem_memory();
+	reserve_ion_memory();
+	reserve_mdp_memory();
+	reserve_rtb_memory();
+	reserve_cache_dump_memory();
+}
+
+static struct reserve_info msm8960_reserve_info __initdata = {
+	.memtype_reserve_table = msm8960_reserve_table,
+	.calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
+	.reserve_fixed_area = msm8960_reserve_fixed_area,
+	.paddr_to_memtype = msm8960_paddr_to_memtype,
+};
+
+static void __init elite_early_memory(void)
+{
+	reserve_info = &msm8960_reserve_info;
+}
+
+static void __init elite_reserve(void)
+{
+	msm_reserve();
+}
+
+static void __init msm8960_allocate_memory_regions(void)
+{
+	msm8960_allocate_fb_region();
+}
+
+#ifdef CONFIG_WCD9310_CODEC
+
+#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
+
+/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
+ * 4 micbiases are used to power various analog and digital
+ * microphones operating at 1800 mV. Technically, all micbiases
+ * can source from single cfilter since all microphones operate
+ * at the same voltage level. The arrangement below is to make
+ * sure all cfilters are exercised. LDO_H regulator ouput level
+ * does not need to be as high as 2.85V. It is choosen for
+ * microphone sensitivity purpose.
+ */
+static struct wcd9xxx_pdata tabla_platform_data = {
+	.slimbus_slave_device = {
+		.name = "tabla-slave",
+		.e_addr = {0, 0, 0x10, 0, 0x17, 2},
+	},
+	.irq = MSM_GPIO_TO_INT(62),
+	.irq_base = TABLA_INTERRUPT_BASE,
+	.num_irqs = NR_TABLA_IRQS,
+	.reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
+	.micbias = {
+		.ldoh_v = TABLA_LDOH_2P85_V,
+		.cfilt1_mv = 1800,
+		.cfilt2_mv = 1800,
+		.cfilt3_mv = 1800,
+		.bias1_cfilt_sel = TABLA_CFILT1_SEL,
+		.bias2_cfilt_sel = TABLA_CFILT2_SEL,
+		.bias3_cfilt_sel = TABLA_CFILT3_SEL,
+		.bias4_cfilt_sel = TABLA_CFILT3_SEL,
+	},
+	.regulator = {
+	{
+		.name = "CDC_VDD_CP",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_RX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_TX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
+	},
+	{
+		.name = "VDDIO_CDC",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
+	},
+	{
+		.name = "VDDD_CDC_D",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_A_1P2V",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
+	},
+	},
+};
+
+static struct slim_device msm_slim_tabla = {
+	.name = "tabla-slim",
+	.e_addr = {0, 1, 0x10, 0, 0x17, 2},
+	.dev = {
+		.platform_data = &tabla_platform_data,
+	},
+};
+static struct wcd9xxx_pdata tabla20_platform_data = {
+	.slimbus_slave_device = {
+		.name = "tabla-slave",
+		.e_addr = {0, 0, 0x60, 0, 0x17, 2},
+	},
+	.irq = MSM_GPIO_TO_INT(62),
+	.irq_base = TABLA_INTERRUPT_BASE,
+	.num_irqs = NR_TABLA_IRQS,
+	.reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
+	.amic_settings = {
+		.legacy_mode = 0x7F,
+		.use_pdata = 0x7F,
+	},
+	.micbias = {
+		.ldoh_v = TABLA_LDOH_2P85_V,
+		.cfilt1_mv = 1800,
+		.cfilt2_mv = 1800,
+		.cfilt3_mv = 1800,
+		.bias1_cfilt_sel = TABLA_CFILT1_SEL,
+		.bias2_cfilt_sel = TABLA_CFILT2_SEL,
+		.bias3_cfilt_sel = TABLA_CFILT3_SEL,
+		.bias4_cfilt_sel = TABLA_CFILT3_SEL,
+	},
+	.regulator = {
+	{
+		.name = "CDC_VDD_CP",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_RX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_TX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
+	},
+	{
+		.name = "VDDIO_CDC",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
+	},
+	{
+		.name = "VDDD_CDC_D",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_A_1P2V",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
+	},
+	},
+};
+
+static struct slim_device msm_slim_tabla20 = {
+	.name = "tabla2x-slim",
+	.e_addr = {0, 1, 0x60, 0, 0x17, 2},
+	.dev = {
+		.platform_data = &tabla20_platform_data,
+	},
+};
+#endif
+
+static struct slim_boardinfo msm_slim_devices[] = {
+#ifdef CONFIG_WCD9310_CODEC
+	{
+		.bus_num = 1,
+		.slim_slave = &msm_slim_tabla,
+	},
+	{
+		.bus_num = 1,
+		.slim_slave = &msm_slim_tabla20,
+	},
+#endif
+	/* add more slimbus slaves as needed */
+};
+
+static struct a1028_platform_data a1028_data = {
+	.gpio_a1028_wakeup = ELITE_GPIO_AUD_A1028_WAKE,
+	.gpio_a1028_reset = ELITE_GPIO_AUD_A1028_RSTz,
+};
+
+#define A1028_I2C_SLAVE_ADDR	(0x3E)
+
+static struct i2c_board_info msm_i2c_gsbi2_a1028_info[] = {
+	{
+		I2C_BOARD_INFO(A1028_I2C_NAME, A1028_I2C_SLAVE_ADDR),
+		.platform_data = &a1028_data,
+	},
+};
+
+#define MSM_WCNSS_PHYS	0x03000000
+#define MSM_WCNSS_SIZE	0x280000
+
+static struct resource resources_wcnss_wlan[] = {
+	{
+		.start	= RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
+		.end	= RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
+		.name	= "wcnss_wlanrx_irq",
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
+		.end	= RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
+		.name	= "wcnss_wlantx_irq",
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= MSM_WCNSS_PHYS,
+		.end	= MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
+		.name	= "wcnss_mmio",
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= 84,
+		.end	= 88,
+		.name	= "wcnss_gpios_5wire",
+		.flags	= IORESOURCE_IO,
+	},
+};
+
+static struct qcom_wcnss_opts qcom_wcnss_pdata = {
+	.has_48mhz_xo	= 1,
+};
+
+static struct platform_device msm_device_wcnss_wlan = {
+	.name		= "wcnss_wlan",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(resources_wcnss_wlan),
+	.resource	= resources_wcnss_wlan,
+	.dev		= {.platform_data = &qcom_wcnss_pdata},
+};
+
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+
+#define QCE_SIZE		0x10000
+#define QCE_0_BASE		0x18500000
+
+#define QCE_HW_KEY_SUPPORT	0
+#define QCE_SHA_HMAC_SUPPORT	1
+#define QCE_SHARE_CE_RESOURCE	1
+#define QCE_CE_SHARED		0
+
+/* Begin Bus scaling definitions */
+static struct msm_bus_vectors crypto_hw_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT1,
+		.dst = MSM_BUS_SLAVE_GSBI1_UART,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+
+static struct msm_bus_vectors crypto_hw_active_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 70000000UL,
+		.ib = 70000000UL,
+	},
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT1,
+		.dst = MSM_BUS_SLAVE_GSBI1_UART,
+		.ab = 2480000000UL,
+		.ib = 2480000000UL,
+	},
+};
+
+static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(crypto_hw_init_vectors),
+		crypto_hw_init_vectors,
+	},
+	{
+		ARRAY_SIZE(crypto_hw_active_vectors),
+		crypto_hw_active_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
+	crypto_hw_bus_scale_usecases,
+	ARRAY_SIZE(crypto_hw_bus_scale_usecases),
+	.name = "cryptohw",
+};
+/* End Bus Scaling Definitions*/
+
+static struct resource qcrypto_resources[] = {
+	[0] = {
+		.start = QCE_0_BASE,
+		.end = QCE_0_BASE + QCE_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.name = "crypto_channels",
+		.start = DMOV_CE_IN_CHAN,
+		.end = DMOV_CE_OUT_CHAN,
+		.flags = IORESOURCE_DMA,
+	},
+	[2] = {
+		.name = "crypto_crci_in",
+		.start = DMOV_CE_IN_CRCI,
+		.end = DMOV_CE_IN_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+	[3] = {
+		.name = "crypto_crci_out",
+		.start = DMOV_CE_OUT_CRCI,
+		.end = DMOV_CE_OUT_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+};
+
+static struct resource qcedev_resources[] = {
+	[0] = {
+		.start = QCE_0_BASE,
+		.end = QCE_0_BASE + QCE_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.name = "crypto_channels",
+		.start = DMOV_CE_IN_CHAN,
+		.end = DMOV_CE_OUT_CHAN,
+		.flags = IORESOURCE_DMA,
+	},
+	[2] = {
+		.name = "crypto_crci_in",
+		.start = DMOV_CE_IN_CRCI,
+		.end = DMOV_CE_IN_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+	[3] = {
+		.name = "crypto_crci_out",
+		.start = DMOV_CE_OUT_CRCI,
+		.end = DMOV_CE_OUT_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+};
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
+
+static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
+	.ce_shared = QCE_CE_SHARED,
+	.shared_ce_resource = QCE_SHARE_CE_RESOURCE,
+	.hw_key_support = QCE_HW_KEY_SUPPORT,
+	.sha_hmac = QCE_SHA_HMAC_SUPPORT,
+	.bus_scale_table = &crypto_hw_bus_scale_pdata,
+};
+
+static struct platform_device qcrypto_device = {
+	.name		= "qcrypto",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(qcrypto_resources),
+	.resource	= qcrypto_resources,
+	.dev		= {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data = &qcrypto_ce_hw_suppport,
+	},
+};
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+
+static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
+	.ce_shared = QCE_CE_SHARED,
+	.shared_ce_resource = QCE_SHARE_CE_RESOURCE,
+	.hw_key_support = QCE_HW_KEY_SUPPORT,
+	.sha_hmac = QCE_SHA_HMAC_SUPPORT,
+	.bus_scale_table = &crypto_hw_bus_scale_pdata,
+};
+
+static struct platform_device qcedev_device = {
+	.name		= "qce",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(qcedev_resources),
+	.resource	= qcedev_resources,
+	.dev		= {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data = &qcedev_ce_hw_suppport,
+	},
+};
+#endif
+
+#ifdef CONFIG_HTC_BATT_8960
+static struct htc_battery_platform_data htc_battery_pdev_data = {
+	.guage_driver = 0,
+	.chg_limit_active_mask = HTC_BATT_CHG_LIMIT_BIT_TALK |
+								HTC_BATT_CHG_LIMIT_BIT_NAVI,
+	.critical_low_voltage_mv = 3200,
+	.critical_alarm_voltage_mv = 3000,
+	.overload_vol_thr_mv = 4000,
+	.overload_curr_thr_ma = 0,
+	/* charger */
+	.icharger.name = "pm8921",
+	.icharger.get_charging_source = pm8921_get_charging_source,
+	.icharger.get_charging_enabled = pm8921_get_charging_enabled,
+	.icharger.set_charger_enable = pm8921_charger_enable,
+	.icharger.set_pwrsrc_enable = pm8921_pwrsrc_enable,
+	.icharger.set_pwrsrc_and_charger_enable =
+						pm8921_set_pwrsrc_and_charger_enable,
+	.icharger.set_limit_charge_enable = pm8921_limit_charge_enable,
+	.icharger.is_ovp = pm8921_is_charger_ovp,
+	.icharger.is_batt_temp_fault_disable_chg =
+						pm8921_is_batt_temp_fault_disable_chg,
+	.icharger.charger_change_notifier_register =
+						cable_detect_register_notifier,
+	.icharger.dump_all = pm8921_dump_all,
+	.icharger.get_attr_text = pm8921_charger_get_attr_text,
+	/* gauge */
+	.igauge.name = "pm8921",
+	.igauge.get_battery_voltage = pm8921_get_batt_voltage,
+	.igauge.get_battery_current = pm8921_bms_get_batt_current,
+	.igauge.get_battery_temperature = pm8921_get_batt_temperature,
+	.igauge.get_battery_id = pm8921_get_batt_id,
+	.igauge.get_battery_soc = pm8921_bms_get_batt_soc,
+	.igauge.get_battery_cc = pm8921_bms_get_batt_cc,
+	.igauge.is_battery_temp_fault = pm8921_is_batt_temperature_fault,
+	.igauge.is_battery_full = pm8921_is_batt_full,
+	.igauge.get_attr_text = pm8921_gauge_get_attr_text,
+	.igauge.register_lower_voltage_alarm_notifier =
+						pm8xxx_batt_lower_alarm_register_notifier,
+	.igauge.enable_lower_voltage_alarm = pm8xxx_batt_lower_alarm_enable,
+	.igauge.set_lower_voltage_alarm_threshold =
+						pm8xxx_batt_lower_alarm_threshold_set,
+};
+
+static struct platform_device htc_battery_pdev = {
+	.name = "htc_battery",
+	.id = -1,
+	.dev    = {
+		.platform_data = &htc_battery_pdev_data,
+	},
+};
+#endif /* CONFIG_HTC_BATT_8960 */
+
+/* HTC_HEADSET_PMIC Driver */
+static struct htc_headset_pmic_platform_data htc_headset_pmic_data = {
+	.driver_flag		= DRIVER_HS_PMIC_ADC,
+	.hpin_gpio		= PM8921_GPIO_PM_TO_SYS(
+					ELITE_PMGPIO_EARPHONE_DETz),
+	.hpin_irq		= 0,
+	.key_gpio		= PM8921_GPIO_PM_TO_SYS(
+					ELITE_PMGPIO_AUD_REMO_PRESz),
+	.key_irq		= 0,
+	.key_enable_gpio	= 0,
+	.adc_mic		= 0,
+	.adc_remote		= {0, 57, 58, 147, 148, 339},
+	.adc_mpp		= PM8XXX_AMUX_MPP_10,
+	.adc_amux		= ADC_MPP_1_AMUX6,
+	.hs_controller		= 0,
+	.hs_switch		= 0,
+};
+
+static struct htc_headset_pmic_platform_data htc_headset_pmic_data_xc = {
+	.driver_flag		= DRIVER_HS_PMIC_ADC,
+	.hpin_gpio		= PM8921_GPIO_PM_TO_SYS(
+					ELITE_PMGPIO_EARPHONE_DETz),
+	.hpin_irq		= 0,
+	.key_gpio		= PM8921_GPIO_PM_TO_SYS(
+					ELITE_PMGPIO_AUD_REMO_PRESz),
+	.key_irq		= 0,
+	.key_enable_gpio	= 0,
+	.adc_mic		= 0,
+	.adc_remote		= {0, 149, 150, 349, 350, 630},
+	.adc_mpp		= PM8XXX_AMUX_MPP_10,
+	.adc_amux		= ADC_MPP_1_AMUX6,
+	.hs_controller		= 0,
+	.hs_switch		= 0,
+};
+
+static struct platform_device htc_headset_pmic = {
+	.name	= "HTC_HEADSET_PMIC",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &htc_headset_pmic_data,
+	},
+};
+
+/* HTC_HEADSET_MGR Driver */
+static struct platform_device *headset_devices[] = {
+	&htc_headset_pmic,
+	/* Please put the headset detection driver on the last */
+};
+
+static struct headset_adc_config htc_headset_mgr_config[] = {
+	{
+		.type = HEADSET_MIC,
+		.adc_max = 1530,
+		.adc_min = 1223,
+	},
+	{
+		.type = HEADSET_BEATS,
+		.adc_max = 1222,
+		.adc_min = 916,
+	},
+	{
+		.type = HEADSET_BEATS_SOLO,
+		.adc_max = 915,
+		.adc_min = 566,
+	},
+	{
+		.type = HEADSET_METRICO, /* For MOS test */
+		.adc_max = 565,
+		.adc_min = 255,
+	},
+	{
+		.type = HEADSET_NO_MIC,
+		.adc_max = 254,
+		.adc_min = 0,
+	},
+};
+
+static struct headset_adc_config htc_headset_mgr_config_xc[] = {
+	{
+		.type = HEADSET_MIC,
+		.adc_max = 2700,
+		.adc_min = 1201,
+	},
+	{
+		.type = HEADSET_METRICO,
+		.adc_max = 1200,
+		.adc_min = 501,
+	},
+	{
+		.type = HEADSET_NO_MIC,
+		.adc_max = 500,
+		.adc_min = 0,
+	},
+};
+
+static struct htc_headset_mgr_platform_data htc_headset_mgr_data = {
+	.driver_flag		= DRIVER_HS_MGR_FLOAT_DET,
+	.headset_devices_num	= ARRAY_SIZE(headset_devices),
+	.headset_devices	= headset_devices,
+	.headset_config_num	= ARRAY_SIZE(htc_headset_mgr_config),
+	.headset_config		= htc_headset_mgr_config,
+};
+
+static struct platform_device htc_headset_mgr = {
+	.name	= "HTC_HEADSET_MGR",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &htc_headset_mgr_data,
+	},
+};
+
+static void headset_device_register(void)
+{
+	pr_info("[HS_BOARD] (%s) Headset device register\n", __func__);
+
+	pr_info("[HS_BOARD] (%s) system_rev = %d\n", __func__, system_rev);
+	if (system_rev == 2) {
+		htc_headset_pmic.dev.platform_data = &htc_headset_pmic_data_xc;
+		htc_headset_mgr_data.headset_config_num =
+					ARRAY_SIZE(htc_headset_mgr_config_xc);
+		htc_headset_mgr_data.headset_config = htc_headset_mgr_config_xc;
+	}
+
+	platform_device_register(&htc_headset_mgr);
+}
+
+static struct synaptics_i2c_rmi_platform_data syn_ts_3k_2p5D_3030_data[] = { /* Synaptics 2.5D 3030 sensor */
+	{
+		.version = 0x3332,
+		.packrat_number = 1293981,
+		.abs_x_min = 0,
+		.abs_x_max = 1088,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.display_width = 720,
+		.display_height = 1280,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.psensor_detection = 1,
+		.reduce_report_level = {60, 60, 50, 0, 0},
+		.config = {
+			0x30, 0x30, 0x00, 0x05, 0x00, 0x7F, 0x03, 0x1E,
+			0x05, 0x89, 0x00, 0x01, 0x01, 0x00, 0x10, 0x4C,
+			0x04, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05, 0x50,
+			0x7A, 0x2A, 0xEE, 0x02, 0x01, 0x3C, 0x1A, 0x01,
+			0x1B, 0x01, 0x66, 0x4E, 0x00, 0x50, 0x04, 0xBF,
+			0xD4, 0xC6, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x00,
+			0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x19, 0x01, 0x00, 0x0A, 0x16, 0x0C, 0x0A,
+			0x00, 0x14, 0x0A, 0x40, 0x64, 0x07, 0xF6, 0xC8,
+			0xBE, 0x43, 0x2A, 0x05, 0x00, 0x00, 0x00, 0x00,
+			0x4C, 0x75, 0x74, 0x3C, 0x32, 0x00, 0x00, 0x00,
+			0x4C, 0x75, 0x74, 0x1E, 0x05, 0x00, 0x02, 0x18,
+			0x01, 0x80, 0x03, 0x0E, 0x1F, 0x12, 0x62, 0x00,
+			0x13, 0x04, 0x1B, 0x00, 0x10, 0x0A, 0x60, 0x68,
+			0x60, 0x68, 0x60, 0x68, 0x60, 0x48, 0x33, 0x31,
+			0x30, 0x2E, 0x2C, 0x2A, 0x29, 0x27, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0xA0,
+			0x0F, 0x00, 0x3C, 0x00, 0xC8, 0x00, 0xCD, 0x0A,
+			0xC0, 0xA0, 0x0F, 0x00, 0xC0, 0x19, 0x05, 0x04,
+			0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x40, 0x30,
+			0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x68, 0x66,
+			0x5E, 0x62, 0x66, 0x6A, 0x6E, 0x56, 0x00, 0x78,
+			0x00, 0x10, 0x28, 0x00, 0x00, 0x00, 0x05, 0x0A,
+			0x10, 0x16, 0x1C, 0x22, 0x24, 0x00, 0x31, 0x04,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x51, 0x51, 0x51,
+			0x51, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D, 0x04,
+			0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17, 0x16,
+			0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12, 0x0F,
+			0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02, 0x06,
+			0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F, 0x12,
+			0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0x00, 0x10,
+			0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
+			0x0F, 0x01, 0x4F, 0x53,
+		},
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1100755,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.segmentation_bef_unlock = 0x50,
+		.reduce_report_level = {60, 60, 50, 0, 0},
+		.customer_register = {0xF9, 0x64, 0x05, 0x64},
+		.multitouch_calibration = 1,
+		.config = {0x30, 0x32, 0x30, 0x34, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x6C, 0x19, 0x7B, 0x07, 0x01, 0x3C, 0x1B,
+			0x01, 0x1C, 0x01, 0x66, 0x4E, 0x00, 0x50, 0x10,
+			0xB5, 0x3F, 0xBE, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x32,
+			0xA2, 0x02, 0x32, 0x05, 0x0F, 0x96, 0x16, 0x0C,
+			0x00, 0x02, 0x18, 0x01, 0x80, 0x03, 0x0E, 0x1F,
+			0x12, 0x63, 0x00, 0x13, 0x04, 0x00, 0x00, 0x08,
+			0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17,
+			0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12,
+			0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02,
+			0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F,
+			0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0x60, 0x60, 0x60,
+			0x68, 0x68, 0x68, 0x68, 0x68, 0x32, 0x31, 0x2F,
+			0x2E, 0x2C, 0x2B, 0x29, 0x28, 0x01, 0x06, 0x0B,
+			0x10, 0x15, 0x1A, 0x20, 0x26, 0x00, 0xA0, 0x0F,
+			0xCD, 0x3C, 0x00, 0xC8, 0x00, 0xB3, 0xC8, 0xCD,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x03, 0x03, 0x0B, 0x04, 0x03, 0x02, 0x02, 0x05,
+			0x20, 0x20, 0x70, 0x30, 0x20, 0x10, 0x10, 0x30,
+			0x58, 0x5C, 0x5B, 0x6F, 0x66, 0x4F, 0x52, 0x66,
+			0x00, 0xA0, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1100755,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.segmentation_bef_unlock = 0x50,
+		.reduce_report_level = {60, 60, 50, 0, 0},
+		.customer_register = {0xF9, 0x64, 0x05, 0x64},
+		.multitouch_calibration = 1,
+		.config = {0x30, 0x32, 0x30, 0x33, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x6C, 0x19, 0x7B, 0x07, 0x01, 0x3C, 0x1B,
+			0x01, 0x1C, 0x01, 0x66, 0x4E, 0x00, 0x50, 0x10,
+			0xB5, 0x3F, 0xBE, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x32,
+			0xA2, 0x02, 0x32, 0x05, 0x0F, 0x96, 0x16, 0x0C,
+			0x00, 0x02, 0x18, 0x01, 0x80, 0x03, 0x0E, 0x1F,
+			0x12, 0x63, 0x00, 0x13, 0x04, 0x00, 0x00, 0x08,
+			0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17,
+			0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12,
+			0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02,
+			0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F,
+			0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0xA0, 0xA0,
+			0xA8, 0xA8, 0xA8, 0xA8, 0x88, 0x47, 0x46, 0x44,
+			0x42, 0x40, 0x3F, 0x3D, 0x3B, 0x01, 0x04, 0x08,
+			0x0C, 0x10, 0x14, 0x18, 0x1C, 0x00, 0xA0, 0x0F,
+			0xCD, 0x3C, 0x00, 0xC8, 0x00, 0xB3, 0xC8, 0xCD,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x03, 0x04, 0x04, 0x03, 0x04, 0x08, 0x03, 0x02,
+			0x20, 0x30, 0x30, 0x20, 0x30, 0x50, 0x20, 0x10,
+			0x58, 0x66, 0x69, 0x60, 0x6F, 0x5F, 0x68, 0x50,
+			0x00, 0xA0, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1091741,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.config = {0x30, 0x32, 0x30, 0x32, 0x80, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x9F, 0x0C, 0x5C, 0x02, 0x01, 0x3C, 0x1B,
+			0x01, 0x1C, 0x01, 0x66, 0x4E, 0x00, 0x50, 0x10,
+			0xB5, 0x3F, 0xBE, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x32,
+			0xA2, 0x02, 0x32, 0x0F, 0x0F, 0x96, 0x16, 0x0C,
+			0x00, 0x02, 0xFC, 0x00, 0x80, 0x02, 0x0E, 0x1F,
+			0x12, 0x63, 0x00, 0x19, 0x08, 0x00, 0x00, 0x08,
+			0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17,
+			0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12,
+			0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02,
+			0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F,
+			0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x60, 0x60, 0x60, 0x3C, 0x3A, 0x38,
+			0x36, 0x34, 0x33, 0x31, 0x2F, 0x01, 0x06, 0x0C,
+			0x11, 0x16, 0x1B, 0x21, 0x27, 0x00, 0xA0, 0x0F,
+			0xCD, 0x64, 0x00, 0x20, 0x4E, 0xB3, 0xC8, 0xCD,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x03, 0x03, 0x03, 0x05, 0x02, 0x03, 0x05, 0x02,
+			0x20, 0x20, 0x20, 0x30, 0x10, 0x20, 0x30, 0x10,
+			0x5C, 0x60, 0x64, 0x5D, 0x50, 0x6E, 0x66, 0x58,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.config = {0x30, 0x32, 0x30, 0x31, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0F, 0x32, 0x32, 0x00, 0x00,
+			0x4C, 0x04, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x28, 0xF5, 0x28, 0x1E, 0x05, 0x01, 0x3C, 0x30,
+			0x00, 0x30, 0x00, 0xCD, 0x4C, 0x00, 0x50, 0xF4,
+			0xEB, 0x97, 0xED, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x00, 0x08,
+			0xA0, 0x01, 0x31, 0x02, 0x01, 0xA0, 0x16, 0x0C,
+			0x00, 0x02, 0x05, 0x01, 0x80, 0x03, 0x0E, 0x1F,
+			0x00, 0x51, 0x00, 0x19, 0x04, 0x00, 0x00, 0x10,
+			0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17,
+			0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12,
+			0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02,
+			0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F,
+			0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x60, 0x60, 0x60, 0x3C, 0x3A, 0x38,
+			0x36, 0x34, 0x33, 0x31, 0x2F, 0x01, 0x06, 0x0C,
+			0x11, 0x16, 0x1B, 0x21, 0x27, 0x00, 0xD0, 0x07,
+			0xFD, 0x3C, 0x00, 0x64, 0x00, 0xCD, 0xC8, 0x80,
+			0xD0, 0x07, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x02, 0x02, 0x04, 0x03, 0x04, 0x04, 0x03, 0x04,
+			0x20, 0x20, 0x30, 0x20, 0x30, 0x30, 0x20, 0x30,
+			0x77, 0x7C, 0x60, 0x58, 0x66, 0x69, 0x60, 0x6F,
+			0x00, 0x3C, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3230,
+		.abs_x_min = 0,
+		.abs_x_max = 1000,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 1,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.config = {0x30, 0x32, 0x30, 0x30, 0x84, 0x0F, 0x03, 0x1E,
+			0x05, 0x20, 0xB1, 0x08, 0x0B, 0x19, 0x19, 0x00,
+			0x00, 0xE8, 0x03, 0x75, 0x07, 0x1E, 0x05, 0x2D,
+			0x0E, 0x06, 0xD4, 0x01, 0x01, 0x48, 0xFD, 0x41,
+			0xFE, 0x00, 0x50, 0x65, 0x4E, 0xFF, 0xBA, 0xBF,
+			0xC0, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x0A,
+			0x04, 0xB2, 0x00, 0x02, 0xF1, 0x00, 0x80, 0x02,
+			0x0D, 0x1E, 0x00, 0x4D, 0x00, 0x19, 0x04, 0x1E,
+			0x00, 0x10, 0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B,
+			0x15, 0x17, 0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11,
+			0x14, 0x12, 0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02,
+			0x01, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04,
+			0x05, 0x02, 0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E,
+			0x10, 0x0F, 0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x60, 0x60, 0x60, 0x3C,
+			0x3A, 0x38, 0x36, 0x34, 0x33, 0x31, 0x2F, 0x01,
+			0x06, 0x0C, 0x11, 0x16, 0x1B, 0x21, 0x27, 0x00,
+			0x41, 0x04, 0x80, 0x41, 0x04, 0xE1, 0x28, 0xC0,
+			0x14, 0xCC, 0x81, 0x0D, 0x00, 0xC0, 0x80, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x02, 0x02, 0x02, 0x03, 0x07, 0x03,
+			0x0B, 0x03, 0x20, 0x20, 0x20, 0x20, 0x50, 0x20,
+			0x70, 0x20, 0x73, 0x77, 0x7B, 0x56, 0x5F, 0x5C,
+			0x5B, 0x64, 0x48, 0x41, 0x00, 0x1E, 0x19, 0x05,
+			0xFD, 0xFE, 0x3D, 0x08}
+	},
+	{
+		.version = 0x0000
+	},
+};
+
+static struct synaptics_i2c_rmi_platform_data syn_ts_3k_2p5D_7070_data[] = { /* Synaptics 2.5D 7070 sensor */
+	{
+		.version = 0x3332,
+		.packrat_number = 1293981,
+		.abs_x_min = 0,
+		.abs_x_max = 1088,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.display_width = 720,
+		.display_height = 1280,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.psensor_detection = 1,
+		.reduce_report_level = {60, 60, 50, 0, 0},
+		.config = {
+			0x30, 0x30, 0x30, 0x33, 0x00, 0x7F, 0x03, 0x1E,
+			0x05, 0x89, 0x00, 0x01, 0x01, 0x00, 0x10, 0x4C,
+			0x04, 0x75, 0x07, 0x02, 0x14, 0x41, 0x05, 0x50,
+			0xAE, 0x27, 0x04, 0x03, 0x01, 0x3C, 0x19, 0x01,
+			0x1E, 0x01, 0x66, 0x4E, 0x00, 0x50, 0x46, 0xBA,
+			0x1B, 0xC1, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x00,
+			0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x19, 0x01, 0x00, 0x0A, 0x16, 0x0C, 0x0A,
+			0x00, 0x14, 0x0A, 0x40, 0x64, 0x07, 0x56, 0xC8,
+			0xBE, 0x43, 0x2A, 0x05, 0x00, 0x00, 0x00, 0x00,
+			0x4C, 0x75, 0x74, 0x3C, 0x32, 0x00, 0x00, 0x00,
+			0x4C, 0x75, 0x74, 0x1E, 0x05, 0x00, 0x02, 0xFA,
+			0x00, 0x80, 0x03, 0x0E, 0x1F, 0x12, 0x64, 0x00,
+			0x13, 0x04, 0x1B, 0x00, 0x10, 0x0A, 0x60, 0x60,
+			0x68, 0x68, 0x60, 0x68, 0x60, 0x48, 0x32, 0x31,
+			0x2F, 0x2D, 0x2C, 0x2A, 0x29, 0x27, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xA0,
+			0x0F, 0x00, 0x3C, 0x00, 0xC8, 0x00, 0xCD, 0x0A,
+			0xC0, 0xA0, 0x0F, 0x00, 0xC0, 0x19, 0x03, 0x03,
+			0x0B, 0x04, 0x03, 0x03, 0x03, 0x09, 0x20, 0x20,
+			0x70, 0x20, 0x20, 0x20, 0x20, 0x50, 0x58, 0x5C,
+			0x5B, 0x4A, 0x66, 0x6A, 0x6E, 0x5F, 0x00, 0x78,
+			0x00, 0x10, 0x28, 0x00, 0x00, 0x00, 0x05, 0x0A,
+			0x0F, 0x14, 0x1A, 0x20, 0x24, 0x00, 0x31, 0x04,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x51, 0x51, 0x51,
+			0x51, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D, 0x04,
+			0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17, 0x16,
+			0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12, 0x0F,
+			0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02, 0x06,
+			0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F, 0x12,
+			0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0x00, 0x10,
+			0x00, 0x10, 0xCD, 0x0C, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x7A,
+			0x7C, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
+			0x0F, 0x01, 0x4F, 0x53,
+		},
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1100755,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.segmentation_bef_unlock = 0x50,
+		.reduce_report_level = {60, 60, 50, 0, 0},
+		.customer_register = {0xF9, 0x64, 0x05, 0x64},
+		.multitouch_calibration = 1,
+		.config = {0x30, 0x31, 0x30, 0x34, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x67, 0x12, 0x00, 0x03, 0x01, 0x3C, 0x19,
+			0x01, 0x1A, 0x01, 0x0A, 0x4F, 0x71, 0x51, 0xE0,
+			0xAB, 0xC8, 0xAF, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x32,
+			0xA2, 0x02, 0x2D, 0x05, 0x0F, 0x60, 0x16, 0x0C,
+			0x00, 0x02, 0x18, 0x01, 0x80, 0x03, 0x0E, 0x1F,
+			0x11, 0x62, 0x00, 0x13, 0x04, 0x1B, 0x00, 0x08,
+			0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17,
+			0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12,
+			0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02,
+			0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F,
+			0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0x60, 0x60, 0x60,
+			0x60, 0x60, 0x60, 0x60, 0x60, 0x33, 0x32, 0x30,
+			0x2E, 0x2D, 0x2B, 0x2A, 0x28, 0x00, 0x04, 0x09,
+			0x0E, 0x13, 0x18, 0x1E, 0x25, 0x00, 0xA0, 0x0F,
+			0x02, 0x3C, 0x00, 0xC8, 0x00, 0xDA, 0xC8, 0xCD,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x05, 0x03, 0x04, 0x05, 0x03, 0x05, 0x07, 0x02,
+			0x40, 0x20, 0x30, 0x40, 0x20, 0x30, 0x40, 0x10,
+			0x68, 0x5A, 0x69, 0x74, 0x64, 0x5D, 0x5C, 0x54,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1100755,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.segmentation_bef_unlock = 0x50,
+		.reduce_report_level = {60, 60, 50, 0, 0},
+		.customer_register = {0xF9, 0x64, 0x05, 0x64},
+		.multitouch_calibration = 1,
+		.config = {0x30, 0x31, 0x30, 0x33, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x67, 0x12, 0x00, 0x03, 0x01, 0x3C, 0x19,
+			0x01, 0x1A, 0x01, 0x0A, 0x4F, 0x71, 0x51, 0xE0,
+			0xAB, 0xC8, 0xAF, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x32,
+			0xA2, 0x02, 0x2D, 0x05, 0x0F, 0x60, 0x16, 0x0C,
+			0x00, 0x02, 0x18, 0x01, 0x80, 0x03, 0x0E, 0x1F,
+			0x11, 0x62, 0x00, 0x13, 0x04, 0x1B, 0x00, 0x08,
+			0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17,
+			0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12,
+			0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02,
+			0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F,
+			0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0xA0, 0xA0,
+			0xA0, 0xA0, 0xA0, 0x80, 0x80, 0x45, 0x44, 0x42,
+			0x40, 0x3F, 0x3D, 0x3B, 0x3A, 0x00, 0x04, 0x09,
+			0x0E, 0x13, 0x18, 0x1E, 0x25, 0x00, 0xA0, 0x0F,
+			0x02, 0x3C, 0x00, 0xC8, 0x00, 0xDA, 0xC8, 0xCD,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x05, 0x03, 0x04, 0x05, 0x03, 0x05, 0x07, 0x02,
+			0x40, 0x20, 0x30, 0x40, 0x20, 0x30, 0x40, 0x10,
+			0x68, 0x5A, 0x69, 0x74, 0x64, 0x5D, 0x5C, 0x54,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1091741,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.config = {0x30, 0x31, 0x30, 0x32, 0x80, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x9A, 0x0B, 0xD4, 0x01, 0x01, 0x3C, 0x1A,
+			0x01, 0x1A, 0x01, 0x0A, 0x4F, 0x71, 0x51, 0xE0,
+			0xAB, 0xC8, 0xAF, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x32,
+			0xA2, 0x02, 0x2D, 0x0F, 0x0F, 0x60, 0x16, 0x0C,
+			0x00, 0x02, 0x18, 0x01, 0x80, 0x01, 0x0E, 0x1F,
+			0x11, 0x62, 0x00, 0x19, 0x04, 0x1B, 0x00, 0x08,
+			0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17,
+			0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12,
+			0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02,
+			0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F,
+			0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0xA0, 0xA0,
+			0xA0, 0xA0, 0xA0, 0x80, 0x80, 0x45, 0x44, 0x42,
+			0x40, 0x3F, 0x3D, 0x3B, 0x3A, 0x00, 0x03, 0x07,
+			0x0B, 0x0F, 0x13, 0x17, 0x1C, 0x00, 0xD0, 0x07,
+			0x02, 0x3C, 0x00, 0x64, 0x00, 0xCD, 0xC8, 0x80,
+			0xD0, 0x07, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x04, 0x03, 0x02, 0x08, 0x02, 0x02, 0x0D, 0x02,
+			0x30, 0x20, 0x10, 0x50, 0x10, 0x10, 0x70, 0x10,
+			0x66, 0x5E, 0x49, 0x5F, 0x4F, 0x52, 0x5B, 0x57,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.config = {0x30, 0x31, 0x30, 0x31, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0F, 0x32, 0x32, 0x00, 0x00,
+			0x4C, 0x04, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x28, 0xF5, 0x28, 0x1E, 0x05, 0x01, 0x3C, 0x30,
+			0x00, 0x30, 0x00, 0xCD, 0x4C, 0x00, 0x50, 0xF4,
+			0xEB, 0x97, 0xED, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x00, 0x08,
+			0xA0, 0x01, 0x31, 0x02, 0x01, 0xA0, 0x16, 0x0C,
+			0x00, 0x02, 0x05, 0x01, 0x80, 0x03, 0x0E, 0x1F,
+			0x00, 0x51, 0x00, 0x19, 0x04, 0x00, 0x00, 0x10,
+			0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17,
+			0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12,
+			0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02,
+			0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F,
+			0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0xA0, 0xA0,
+			0xA0, 0xA0, 0xA0, 0x80, 0x80, 0x45, 0x44, 0x42,
+			0x40, 0x3F, 0x3D, 0x3B, 0x3A, 0x00, 0x03, 0x07,
+			0x0B, 0x0F, 0x13, 0x17, 0x1C, 0x00, 0xD0, 0x07,
+			0xFD, 0x3C, 0x00, 0x64, 0x00, 0xCD, 0xC8, 0x80,
+			0xD0, 0x07, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x02, 0x02, 0x04, 0x03, 0x04, 0x04, 0x03, 0x04,
+			0x20, 0x20, 0x30, 0x20, 0x30, 0x30, 0x20, 0x30,
+			0x77, 0x7C, 0x60, 0x58, 0x66, 0x69, 0x60, 0x6F,
+			0x00, 0x3C, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3230,
+		.abs_x_min = 0,
+		.abs_x_max = 1000,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 1,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.config = {0x30, 0x31, 0x30, 0x30, 0x84, 0x0F, 0x03, 0x1E,
+			0x05, 0x20, 0xB1, 0x08, 0x0B, 0x19, 0x19, 0x00,
+			0x00, 0xE8, 0x03, 0x75, 0x07, 0x1E, 0x05, 0x2D,
+			0x0E, 0x06, 0xD4, 0x01, 0x01, 0x48, 0xFD, 0x41,
+			0xFE, 0x00, 0x50, 0x65, 0x4E, 0xFF, 0xBA, 0xBF,
+			0xC0, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x0A,
+			0x04, 0xB2, 0x00, 0x02, 0xF1, 0x00, 0x80, 0x02,
+			0x0D, 0x1E, 0x00, 0x4D, 0x00, 0x19, 0x04, 0x1E,
+			0x00, 0x10, 0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B,
+			0x15, 0x17, 0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11,
+			0x14, 0x12, 0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02,
+			0x01, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04,
+			0x05, 0x02, 0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E,
+			0x10, 0x0F, 0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0,
+			0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0x80, 0x80, 0x45,
+			0x44, 0x42, 0x40, 0x3F, 0x3D, 0x3B, 0x3A, 0x00,
+			0x03, 0x07, 0x0B, 0x0F, 0x13, 0x17, 0x1C, 0x00,
+			0x41, 0x04, 0x80, 0x41, 0x04, 0xE1, 0x28, 0xC0,
+			0x14, 0xCC, 0x81, 0x0D, 0x00, 0xC0, 0x80, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x02, 0x02, 0x02, 0x03, 0x07, 0x03,
+			0x0B, 0x03, 0x20, 0x20, 0x20, 0x20, 0x50, 0x20,
+			0x70, 0x20, 0x73, 0x77, 0x7B, 0x56, 0x5F, 0x5C,
+			0x5B, 0x64, 0x48, 0x41, 0x00, 0x1E, 0x19, 0x05,
+			0xFD, 0xFE, 0x3D, 0x08}
+	},
+	{
+		.version = 0x0000
+	},
+};
+
+static struct synaptics_i2c_rmi_platform_data syn_ts_3k_data[] = { /* Synaptics sensor */
+	{
+		.version = 0x3332,
+		.packrat_number = 1293981,
+		.abs_x_min = 0,
+		.abs_x_max = 1088,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.display_width = 720,
+		.display_height = 1280,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.psensor_detection = 1,
+		.reduce_report_level = {60, 60, 50, 0, 0},
+		.config = {
+			0x30, 0x30, 0x00, 0x05, 0x00, 0x7F, 0x03, 0x1E,
+			0x05, 0x89, 0x00, 0x01, 0x01, 0x00, 0x10, 0x4C,
+			0x04, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05, 0x50,
+			0x7A, 0x2A, 0xEE, 0x02, 0x01, 0x3C, 0x1A, 0x01,
+			0x1B, 0x01, 0x66, 0x4E, 0x00, 0x50, 0x04, 0xBF,
+			0xD4, 0xC6, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x00,
+			0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x19, 0x01, 0x00, 0x0A, 0x16, 0x0C, 0x0A,
+			0x00, 0x14, 0x0A, 0x40, 0x64, 0x07, 0xF6, 0xC8,
+			0xBE, 0x43, 0x2A, 0x05, 0x00, 0x00, 0x00, 0x00,
+			0x4C, 0x75, 0x74, 0x3C, 0x32, 0x00, 0x00, 0x00,
+			0x4C, 0x75, 0x74, 0x1E, 0x05, 0x00, 0x02, 0x18,
+			0x01, 0x80, 0x03, 0x0E, 0x1F, 0x12, 0x62, 0x00,
+			0x13, 0x04, 0x1B, 0x00, 0x10, 0x0A, 0x60, 0x68,
+			0x60, 0x68, 0x60, 0x68, 0x60, 0x48, 0x33, 0x31,
+			0x30, 0x2E, 0x2C, 0x2A, 0x29, 0x27, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0xA0,
+			0x0F, 0x00, 0x3C, 0x00, 0xC8, 0x00, 0xCD, 0x0A,
+			0xC0, 0xA0, 0x0F, 0x00, 0xC0, 0x19, 0x05, 0x04,
+			0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x40, 0x30,
+			0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x68, 0x66,
+			0x5E, 0x62, 0x66, 0x6A, 0x6E, 0x56, 0x00, 0x78,
+			0x00, 0x10, 0x28, 0x00, 0x00, 0x00, 0x05, 0x0A,
+			0x10, 0x16, 0x1C, 0x22, 0x24, 0x00, 0x31, 0x04,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x51, 0x51, 0x51,
+			0x51, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D, 0x04,
+			0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17, 0x16,
+			0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12, 0x0F,
+			0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02, 0x06,
+			0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F, 0x12,
+			0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0x00, 0x10,
+			0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
+			0x0F, 0x01, 0x4F, 0x53,
+		},
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1100755,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.segmentation_bef_unlock = 0x50,
+		.reduce_report_level = {60, 60, 50, 0, 0},
+		.customer_register = {0xF9, 0x64, 0x05, 0x64},
+		.multitouch_calibration = 1,
+		.config = {0x30, 0x30, 0x30, 0x33, 0x80, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x75, 0x07, 0x02, 0x14, 0x24, 0x05,
+			0x2D, 0x66, 0x26, 0x9C, 0x04, 0x01, 0x3C, 0x1B,
+			0x01, 0x1A, 0x01, 0x0A, 0x4F, 0x71, 0x51, 0x80,
+			0xBB, 0x80, 0xBB, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x32,
+			0xA1, 0x02, 0x37, 0x05, 0x0F, 0xAE, 0x16, 0x0C,
+			0x00, 0x02, 0x5E, 0x01, 0x80, 0x02, 0x0E, 0x1F,
+			0x11, 0x63, 0x00, 0x19, 0x04, 0x1B, 0x00, 0x08,
+			0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17,
+			0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12,
+			0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02,
+			0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F,
+			0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0xA0, 0xA0,
+			0xA0, 0xA0, 0x80, 0x80, 0x80, 0x44, 0x43, 0x41,
+			0x3F, 0x3E, 0x3C, 0x3A, 0x38, 0x01, 0x04, 0x08,
+			0x0C, 0x10, 0x14, 0x1A, 0x1F, 0x00, 0xD0, 0x07,
+			0x02, 0x3C, 0x00, 0x64, 0x00, 0xCD, 0xC8, 0x80,
+			0xD0, 0x07, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x03, 0x03, 0x03, 0x05, 0x02, 0x03, 0x05, 0x02,
+			0x20, 0x20, 0x20, 0x30, 0x10, 0x20, 0x30, 0x10,
+			0x5C, 0x60, 0x64, 0x5D, 0x50, 0x6E, 0x66, 0x58,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1091741,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.config = {0x30, 0x30, 0x30, 0x32, 0x80, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x75, 0x07, 0x02, 0x14, 0x24, 0x05,
+			0x2D, 0x66, 0x26, 0x9C, 0x04, 0x01, 0x3C, 0x1B,
+			0x01, 0x1A, 0x01, 0x0A, 0x4F, 0x71, 0x51, 0x80,
+			0xBB, 0x80, 0xBB, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x32,
+			0xA1, 0x02, 0x37, 0x0F, 0x0F, 0xAE, 0x16, 0x0C,
+			0x00, 0x02, 0x5E, 0x01, 0x80, 0x02, 0x0E, 0x1F,
+			0x11, 0x63, 0x00, 0x19, 0x04, 0x1B, 0x00, 0x08,
+			0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17,
+			0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12,
+			0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02,
+			0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F,
+			0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0xA0, 0xA0,
+			0xA0, 0xA0, 0x80, 0x80, 0x80, 0x44, 0x43, 0x41,
+			0x3F, 0x3E, 0x3C, 0x3A, 0x38, 0x01, 0x04, 0x08,
+			0x0C, 0x10, 0x14, 0x1A, 0x1F, 0x00, 0xD0, 0x07,
+			0x02, 0x3C, 0x00, 0x64, 0x00, 0xCD, 0xC8, 0x80,
+			0xD0, 0x07, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x03, 0x03, 0x03, 0x05, 0x02, 0x03, 0x05, 0x02,
+			0x20, 0x20, 0x20, 0x30, 0x10, 0x20, 0x30, 0x10,
+			0x5C, 0x60, 0x64, 0x5D, 0x50, 0x6E, 0x66, 0x58,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 2,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.config = {0x30, 0x30, 0x30, 0x31, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x19, 0x19, 0x00, 0x00,
+			0x4C, 0x04, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0xA3, 0x07, 0xED, 0x01, 0x01, 0x3C, 0x26,
+			0x00, 0x26, 0x00, 0x00, 0x50, 0x00, 0x50, 0x30,
+			0xB9, 0x3E, 0xC5, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xB2, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x00, 0x08,
+			0xA2, 0x01, 0x30, 0x09, 0x03, 0x90, 0x16, 0x0C,
+			0x00, 0x02, 0x2F, 0x01, 0x80, 0x01, 0x0E, 0x1F,
+			0x12, 0x58, 0x00, 0x19, 0x04, 0x00, 0x00, 0x10,
+			0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B, 0x15, 0x17,
+			0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0x14, 0x12,
+			0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x05, 0x02,
+			0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E, 0x10, 0x0F,
+			0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0xA0, 0xA0,
+			0xA0, 0xA0, 0x80, 0x80, 0x80, 0x44, 0x43, 0x41,
+			0x3F, 0x3E, 0x3C, 0x3A, 0x38, 0x01, 0x04, 0x08,
+			0x0C, 0x10, 0x14, 0x1A, 0x1F, 0x00, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
+			0xFF, 0xFF, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x02, 0x03, 0x04, 0x04, 0x03, 0x04, 0x08, 0x02,
+			0x20, 0x20, 0x30, 0x30, 0x20, 0x30, 0x50, 0x10,
+			0x7E, 0x58, 0x66, 0x69, 0x60, 0x6F, 0x5F, 0x4F,
+			0x00, 0xFF, 0xFF, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3230,
+		.abs_x_min = 0,
+		.abs_x_max = 1000,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.gpio_irq = ELITE_GPIO_TP_ATTz,
+		.default_config = 1,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.config = {0x30, 0x30, 0x30, 0x30, 0x84, 0x0F, 0x03, 0x1E,
+			0x05, 0x20, 0xB1, 0x08, 0x0B, 0x19, 0x19, 0x00,
+			0x00, 0xE8, 0x03, 0x75, 0x07, 0x1E, 0x05, 0x2D,
+			0x0E, 0x06, 0xD4, 0x01, 0x01, 0x48, 0xFD, 0x41,
+			0xFE, 0x00, 0x50, 0x65, 0x4E, 0xFF, 0xBA, 0xBF,
+			0xC0, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x0A,
+			0x04, 0xB2, 0x00, 0x02, 0xF1, 0x00, 0x80, 0x02,
+			0x0D, 0x1E, 0x00, 0x4D, 0x00, 0x19, 0x04, 0x1E,
+			0x00, 0x10, 0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B,
+			0x15, 0x17, 0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11,
+			0x14, 0x12, 0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02,
+			0x01, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04,
+			0x05, 0x02, 0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E,
+			0x10, 0x0F, 0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0,
+			0xA0, 0xA0, 0xA0, 0xA0, 0x80, 0x80, 0x80, 0x44,
+			0x43, 0x41, 0x3F, 0x3E, 0x3C, 0x3A, 0x38, 0x01,
+			0x04, 0x08, 0x0C, 0x10, 0x14, 0x1A, 0x1F, 0x00,
+			0x41, 0x04, 0x80, 0x41, 0x04, 0xE1, 0x28, 0xC0,
+			0x14, 0xCC, 0x81, 0x0D, 0x00, 0xC0, 0x80, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x02, 0x02, 0x02, 0x03, 0x07, 0x03,
+			0x0B, 0x03, 0x20, 0x20, 0x20, 0x20, 0x50, 0x20,
+			0x70, 0x20, 0x73, 0x77, 0x7B, 0x56, 0x5F, 0x5C,
+			0x5B, 0x64, 0x48, 0x41, 0x00, 0x1E, 0x19, 0x05,
+			0xFD, 0xFE, 0x3D, 0x08}
+	},
+	{
+		.version = 0x0000
+	},
+};
+
+static struct i2c_board_info msm_i2c_gsbi3_info[] = {
+	{
+		I2C_BOARD_INFO(SYNAPTICS_3200_NAME, 0x40 >> 1),
+		.platform_data = &syn_ts_3k_data,
+		.irq = MSM_GPIO_TO_INT(ELITE_GPIO_TP_ATTz)
+	},
+};
+
+static ssize_t virtual_syn_keys_show(struct kobject *kobj,
+			struct kobj_attribute *attr, char *buf)
+{
+	return sprintf(buf,
+		__stringify(EV_KEY) ":" __stringify(KEY_HOME)	":87:1345:110:100"
+		":" __stringify(EV_KEY) ":" __stringify(KEY_MENU)	":273:1345:106:100"
+		":" __stringify(EV_KEY) ":" __stringify(KEY_BACK)	":470:1345:120:100"
+		":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":660:1345:110:100"
+		"\n");
+}
+
+static ssize_t virtual_syn_three_keys_show(struct kobject *kobj,
+			struct kobj_attribute *attr, char *buf)
+{
+	return sprintf(buf,
+		__stringify(EV_KEY) ":" __stringify(KEY_BACK)       ":112:1345:120:100"
+		":" __stringify(EV_KEY) ":" __stringify(KEY_HOME)   ":360:1345:120:100"
+		":" __stringify(EV_KEY) ":" __stringify(KEY_APP_SWITCH)   ":595:1345:120:100"
+		"\n");
+}
+
+static struct kobj_attribute syn_virtual_keys_attr = {
+	.attr = {
+		.name = "virtualkeys.synaptics-rmi-touchscreen",
+		.mode = S_IRUGO,
+	},
+	.show = &virtual_syn_keys_show,
+};
+
+static struct kobj_attribute syn_three_virtual_keys_attr = {
+	.attr = {
+		.name = "virtualkeys.synaptics-rmi-touchscreen",
+		.mode = S_IRUGO,
+	},
+	.show = &virtual_syn_three_keys_show,
+};
+
+static struct attribute *properties_attrs[] = {
+	&syn_virtual_keys_attr.attr,
+	NULL
+};
+
+static struct attribute *three_virtual_key_properties_attrs[] = {
+	&syn_three_virtual_keys_attr.attr,
+	NULL
+};
+
+static struct attribute_group properties_attr_group = {
+	.attrs = properties_attrs,
+};
+
+static struct attribute_group three_virtual_key_properties_attr_group = {
+	.attrs = three_virtual_key_properties_attrs,
+};
+
+static void config_gpio_table(uint32_t *table, int len)
+{
+	int n, rc;
+	for (n = 0; n < len; n++) {
+		rc = gpio_tlmm_config(table[n], GPIO_CFG_ENABLE);
+		if (rc) {
+			pr_err("[CAM] %s: gpio_tlmm_config(%#x)=%d\n",
+				__func__, table[n], rc);
+			break;
+		}
+	}
+}
+
+static struct bma250_platform_data gsensor_bma250_platform_data = {
+	.intr = ELITE_GPIO_GSENSOR_INT,
+	.chip_layout = 1,
+};
+
+static struct akm8975_platform_data compass_platform_data = {
+	.layouts = ELITE_LAYOUTS,
+};
+
+static struct r3gd20_gyr_platform_data gyro_platform_data = {
+	.fs_range = R3GD20_GYR_FS_2000DPS,
+	.axis_map_x = 0,
+	.axis_map_y = 1,
+	.axis_map_z = 2,
+	.negate_x = 0,
+	.negate_y = 0,
+	.negate_z = 0,
+
+	.poll_interval = 50,
+	.min_interval = R3GD20_MIN_POLL_PERIOD_MS, /*2 */
+
+	/*.gpio_int1 = DEFAULT_INT1_GPIO,*/
+	/*.gpio_int2 = DEFAULT_INT2_GPIO,*/             /* int for fifo */
+
+	.watermark = 0,
+	.fifomode = 0,
+};
+
+static struct i2c_board_info __initdata msm_i2c_sensor_gsbi12_info[] = {
+	{
+		I2C_BOARD_INFO(BMA250_I2C_NAME, 0x30 >> 1),
+		.platform_data = &gsensor_bma250_platform_data,
+		.irq = MSM_GPIO_TO_INT(ELITE_GPIO_GSENSOR_INT),
+	},
+	{
+		I2C_BOARD_INFO(AKM8975_I2C_NAME, 0x1A >> 1),
+		.platform_data = &compass_platform_data,
+		.irq = MSM_GPIO_TO_INT(ELITE_GPIO_COMPASS_INT),
+	},
+	{
+		I2C_BOARD_INFO(R3GD20_GYR_DEV_NAME, 0xD0 >> 1),
+		.platform_data = &gyro_platform_data,
+		/*.irq = MSM_GPIO_TO_INT(ELITE_GYRO_INT),*/
+	},
+};
+
+static struct mpu3050_platform_data mpu3050_data = {
+	.int_config = 0x10,
+	.orientation = { 1, 0, 0,
+			 0, 1, 0,
+			 0, 0, 1 },
+	.level_shifter = 0,
+
+	.accel = {
+		.get_slave_descr = get_accel_slave_descr,
+		.adapt_num = MSM_8960_GSBI12_QUP_I2C_BUS_ID, /* The i2c bus to which the mpu device is connected */
+		.bus = EXT_SLAVE_BUS_SECONDARY,
+		.address = 0x30 >> 1,
+		.orientation = { 1, 0, 0,
+				 0, 1, 0,
+				 0, 0, 1
+		},
+	},
+
+	.compass = {
+		.get_slave_descr = get_compass_slave_descr,
+		.adapt_num = MSM_8960_GSBI12_QUP_I2C_BUS_ID, /* The i2c bus to which the mpu device is connected */
+		.bus = EXT_SLAVE_BUS_PRIMARY,
+		.address = 0x1A >> 1,
+		.orientation = { -1, 0,  0,
+				  0, 1,  0,
+				  0, 0, -1
+		},
+	},
+};
+
+static struct i2c_board_info __initdata mpu3050_GSBI12_boardinfo[] = {
+	{
+		I2C_BOARD_INFO("mpu3050", 0xD0 >> 1),
+		.irq = MSM_GPIO_TO_INT(ELITE_GPIO_GYRO_INT),
+		.platform_data = &mpu3050_data,
+	},
+};
+
+static struct pn544_i2c_platform_data nfc_platform_data = {
+	.irq_gpio = ELITE_GPIO_NFC_IRQ,
+	.ven_gpio = ELITE_GPIO_NFC_VEN,
+	.firm_gpio = ELITE_GPIO_NFC_DL_MODE,
+	.ven_isinvert = 1,
+};
+
+static struct i2c_board_info pn544_i2c_boardinfo[] = {
+	{
+		I2C_BOARD_INFO(PN544_I2C_NAME, 0x50 >> 1),
+		.platform_data = &nfc_platform_data,
+		.irq = MSM_GPIO_TO_INT(ELITE_GPIO_NFC_IRQ),
+	},
+};
+
+static DEFINE_MUTEX(capella_cm36282_lock);
+static struct regulator *PL_sensor_pwr;
+static int capella_pl_sensor_lpm_power(uint8_t enable)
+{
+	int ret = 0;
+	int rc;
+
+	mutex_lock(&capella_cm36282_lock);
+	if (PL_sensor_pwr == NULL)
+	{
+		PL_sensor_pwr = regulator_get(NULL, "8921_l6");
+	}
+	if (IS_ERR(PL_sensor_pwr)) {
+		pr_err("[PS][cm3629] %s: Unable to get '8921_l6' \n", __func__);
+		mutex_unlock(&capella_cm36282_lock);
+		return -ENODEV;
+	}
+	if (enable == 1) {
+		rc = regulator_set_optimum_mode(PL_sensor_pwr, 100);
+		if (rc < 0)
+			pr_err("[PS][cm3629] %s: enter lmp,set_optimum_mode l6 failed, rc=%d\n", __func__, rc);
+		else
+			pr_info("[PS][cm3629] %s: enter lmp,OK\n", __func__);
+	} else {
+		rc = regulator_set_optimum_mode(PL_sensor_pwr, 100000);
+		if (rc < 0)
+			pr_err("[PS][cm3629] %s: leave lmp,set_optimum_mode l6 failed, rc=%d\n", __func__, rc);
+		else
+			pr_info("[PS][cm3629] %s: leave lmp,OK\n", __func__);
+		msleep(10);
+	}
+	mutex_unlock(&capella_cm36282_lock);
+	return ret;
+}
+
+static int capella_cm36282_power(int pwr_device, uint8_t enable)
+{
+	int ret = 0;
+	int rc;
+
+	mutex_lock(&capella_cm36282_lock);
+
+	if (PL_sensor_pwr == NULL)
+	{
+		PL_sensor_pwr = regulator_get(NULL, "8921_l6");
+	}
+	if (IS_ERR(PL_sensor_pwr)) {
+		pr_err("[PS][cm3629] %s: Unable to get '8921_l6' \n", __func__);
+		mutex_unlock(&capella_cm36282_lock);
+		return -ENODEV;
+	}
+	if (enable == 1) {
+		rc = regulator_set_voltage(PL_sensor_pwr, 2850000, 2850000);
+		if (rc)
+			pr_err("[PS][cm3629] %s: unable to regulator_set_voltage, rc:%d\n", __func__, rc);
+
+		rc = regulator_enable(PL_sensor_pwr);
+		if (rc)
+			pr_err("[PS][cm3629]'%s' regulator enable L6 failed, rc=%d\n", __func__,rc);
+		else
+			pr_info("[PS][cm3629]'%s' L6 power on\n", __func__);
+	}
+	mutex_unlock(&capella_cm36282_lock);
+	return ret;
+}
+
+static struct cm3629_platform_data cm36282_XD_pdata = {
+	.model = CAPELLA_CM36282,
+	.ps_select = CM3629_PS1_ONLY,
+	.intr = PM8921_GPIO_PM_TO_SYS(ELITE_PMGPIO_PROXIMITY_INTz),
+	.levels = { 0, 0, 23, 352, 1216, 3227, 5538, 8914, 10600, 65535},
+	.golden_adc = 3754,
+	.power = capella_cm36282_power,
+	.lpm_power = capella_pl_sensor_lpm_power,
+	.cm3629_slave_address = 0xC0>>1,
+	.ps1_thd_set = 11,
+	.ps1_thd_no_cal = 0xF1,
+	.ps1_thd_with_cal = 11,
+	.ps_calibration_rule = 1,
+	.ps_conf1_val = CM3629_PS_DR_1_80 | CM3629_PS_IT_1_6T |
+			CM3629_PS1_PERS_4,
+	.ps_conf2_val = CM3629_PS_ITB_1 | CM3629_PS_ITR_1 |
+			CM3629_PS2_INT_DIS | CM3629_PS1_INT_DIS,
+	.ps_conf3_val = CM3629_PS2_PROL_32,
+};
+
+static struct i2c_board_info i2c_CM36282_XD_devices[] = {
+	{
+		I2C_BOARD_INFO(CM3629_I2C_NAME, 0xC0 >> 1),
+		.platform_data = &cm36282_XD_pdata,
+		.irq =  PM8921_GPIO_IRQ(PM8921_IRQ_BASE, ELITE_PMGPIO_PROXIMITY_INTz),
+	},
+};
+
+static struct cm3629_platform_data cm36282_pdata = {
+	.model = CAPELLA_CM36282,
+	.ps_select = CM3629_PS1_ONLY,
+	.intr = PM8921_GPIO_PM_TO_SYS(ELITE_PMGPIO_PROXIMITY_INTz),
+	.levels = { 0, 0, 23, 352, 1216, 3227, 5538, 8914, 10600, 65535},
+	.golden_adc = 3754,
+	.power = capella_cm36282_power,
+	.lpm_power = capella_pl_sensor_lpm_power,
+	.cm3629_slave_address = 0xC0>>1,
+	.ps1_thd_set = 19,
+	.ps1_thd_no_cal = 0xF1,
+	.ps1_thd_with_cal = 19,
+	.ps_calibration_rule = 1,
+	.ps_conf1_val = CM3629_PS_DR_1_80 | CM3629_PS_IT_1_6T |
+			CM3629_PS1_PERS_4,
+	.ps_conf2_val = CM3629_PS_ITB_1 | CM3629_PS_ITR_1 |
+			CM3629_PS2_INT_DIS | CM3629_PS1_INT_DIS,
+	.ps_conf3_val = CM3629_PS2_PROL_32,
+};
+
+static struct i2c_board_info i2c_CM36282_devices[] = {
+	{
+		I2C_BOARD_INFO(CM3629_I2C_NAME, 0xC0 >> 1),
+		.platform_data = &cm36282_pdata,
+		.irq =  PM8921_GPIO_IRQ(PM8921_IRQ_BASE, ELITE_PMGPIO_PROXIMITY_INTz),
+	},
+};
+
+#define _GET_REGULATOR(var, name) do {				\
+	var = regulator_get(NULL, name);			\
+	if (IS_ERR(var)) {					\
+		pr_err("'%s' regulator not found, rc=%ld\n",	\
+			name, IS_ERR(var));			\
+		var = NULL;					\
+		return -ENODEV;					\
+	}							\
+} while (0)
+
+static uint32_t mhl_usb_switch_ouput_table[] = {
+	GPIO_CFG(ELITE_GPIO_MHL_USB_SELz, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA),
+};
+
+void config_elite_mhl_gpios(void)
+{
+	config_gpio_table(mhl_usb_switch_ouput_table, ARRAY_SIZE(mhl_usb_switch_ouput_table));
+}
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+
+static void elite_usb_dpdn_switch(int path)
+{
+	switch (path) {
+	case PATH_USB:
+	case PATH_MHL:
+	{
+		int polarity = 1; /* high = mhl */
+		int mhl = (path == PATH_MHL);
+
+		config_gpio_table(mhl_usb_switch_ouput_table,
+				ARRAY_SIZE(mhl_usb_switch_ouput_table));
+
+		pr_info("[CABLE] %s: Set %s path\n", __func__, mhl ? "MHL" : "USB");
+		gpio_set_value(ELITE_GPIO_MHL_USB_SELz, (mhl ^ !polarity) ? 1 : 0);
+		break;
+	}
+	}
+	#ifdef CONFIG_FB_MSM_HDMI_MHL
+	sii9234_change_usb_owner((path == PATH_MHL) ? 1 : 0);
+	#endif /*CONFIG_FB_MSM_HDMI_MHL*/
+}
+#endif
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+static struct regulator *reg_8921_l12;
+static struct regulator *reg_8921_s4;
+static struct regulator *reg_8921_l16;
+static struct regulator *reg_8921_l10;
+static struct regulator *reg_8921_s2;
+uint32_t msm_hdmi_off_gpio[] = {
+	GPIO_CFG(ELITE_GPIO_HDMI_DDC_CLK,  0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	GPIO_CFG(ELITE_GPIO_HDMI_DDC_DATA,  0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	GPIO_CFG(ELITE_GPIO_HDMI_HPD,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
+};
+
+uint32_t msm_hdmi_on_gpio[] = {
+	GPIO_CFG(ELITE_GPIO_HDMI_DDC_CLK,  1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_HDMI_DDC_DATA,  1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_HDMI_HPD,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
+};
+
+static int mhl_sii9234_power_vote(bool enable)
+{
+	int rc;
+
+	if (!reg_8921_l10) {
+		_GET_REGULATOR(reg_8921_l10, "8921_l10");
+		rc = regulator_set_voltage(reg_8921_l10, 3000000, 3000000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_l10 failed rc=%d\n",
+					__func__, rc);
+			return rc;
+		}
+	}
+	if (!reg_8921_s2) {
+		_GET_REGULATOR(reg_8921_s2, "8921_s2");
+		rc = regulator_set_voltage(reg_8921_s2, 1300000, 1300000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_s2 failed rc=%d\n",
+					__func__, rc);
+			return rc;
+		}
+	}
+
+	if (enable) {
+		if (reg_8921_l10) {
+			rc = regulator_enable(reg_8921_l10);
+			if (rc)
+				pr_warning("'%s' regulator enable failed, rc=%d\n",
+						"reg_8921_l10", rc);
+		}
+		if (reg_8921_s2) {
+			rc = regulator_enable(reg_8921_s2);
+			if (rc)
+				pr_warning("'%s' regulator enable failed, rc=%d\n",
+						"reg_8921_s2", rc);
+		}
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		if (reg_8921_l10) {
+			rc = regulator_disable(reg_8921_l10);
+			if (rc)
+				pr_warning("'%s' regulator disable failed, rc=%d\n",
+					"reg_8921_l10", rc);
+		}
+		if (reg_8921_s2) {
+			rc = regulator_disable(reg_8921_s2);
+			if (rc)
+				pr_warning("'%s' regulator disable failed, rc=%d\n",
+					"reg_8921_s2", rc);
+		}
+		pr_info("%s(off): success\n", __func__);
+	}
+	return 0;
+}
+
+static void mhl_sii9234_1v2_power(bool enable)
+{
+	static bool prev_on;
+
+	if (enable == prev_on)
+		return;
+
+	if (enable) {
+		config_gpio_table(msm_hdmi_on_gpio, ARRAY_SIZE(msm_hdmi_on_gpio));
+		hdmi_hpd_feature(1);
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		config_gpio_table(msm_hdmi_off_gpio, ARRAY_SIZE(msm_hdmi_off_gpio));
+		hdmi_hpd_feature(0);
+		pr_info("%s(off): success\n", __func__);
+	}
+
+	prev_on = enable;
+}
+
+static int mhl_sii9234_all_power(bool enable)
+{
+	static bool prev_on;
+	int rc;
+	if (enable == prev_on)
+		return 0;
+
+	if (!reg_8921_s4)
+		_GET_REGULATOR(reg_8921_s4, "8921_s4");
+	if (!reg_8921_l16)
+		_GET_REGULATOR(reg_8921_l16, "8921_l16");
+	if (!reg_8921_l12)
+		_GET_REGULATOR(reg_8921_l12, "8921_l12");
+
+	if (enable) {
+		rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_s4 failed rc=%d\n",
+				__func__, rc);
+			return rc;
+		}
+		rc = regulator_set_voltage(reg_8921_l16, 3300000, 3300000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_l16 failed rc=%d\n",
+				__func__, rc);
+			return rc;
+		}
+
+		rc = regulator_set_voltage(reg_8921_l12, 1200000, 1200000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_l12 failed rc=%d\n",
+				__func__, rc);
+			return rc;
+		}
+		rc = regulator_enable(reg_8921_s4);
+
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"reg_8921_s4", rc);
+			return rc;
+		}
+		rc = regulator_enable(reg_8921_l16);
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"reg_8921_l16", rc);
+			return rc;
+		}
+
+		rc = regulator_enable(reg_8921_l12);
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"reg_8921_l12", rc);
+			return rc;
+		}
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		rc = regulator_disable(reg_8921_s4);
+		if (rc)
+			pr_warning("'%s' regulator disable failed, rc=%d\n",
+				"reg_8921_s4", rc);
+		rc = regulator_disable(reg_8921_l16);
+		if (rc)
+			pr_warning("'%s' regulator disable failed, rc=%d\n",
+				"reg_8921_l16", rc);
+		rc = regulator_disable(reg_8921_l12);
+		if (rc)
+			pr_warning("'%s' regulator disable failed, rc=%d\n",
+				"reg_8921_l12", rc);
+		pr_info("%s(off): success\n", __func__);
+	}
+
+	prev_on = enable;
+
+	return 0;
+}
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+static uint32_t mhl_gpio_table[] = {
+	GPIO_CFG(ELITE_GPIO_MHL_RSTz, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	GPIO_CFG(ELITE_GPIO_MHL_INT, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
+};
+
+static int mhl_sii9234_power(int on)
+{
+	int rc = 0;
+
+	switch (on) {
+	case 0:
+		mhl_sii9234_1v2_power(false);
+		break;
+	case 1:
+		mhl_sii9234_all_power(true);
+		config_gpio_table(mhl_gpio_table, ARRAY_SIZE(mhl_gpio_table));
+		break;
+	default:
+		pr_warning("%s(%d) got unsupport parameter!!!\n", __func__, on);
+		break;
+	}
+	return rc;
+}
+
+static T_MHL_PLATFORM_DATA mhl_sii9234_device_data = {
+	.gpio_intr = ELITE_GPIO_MHL_INT,
+	.gpio_reset = ELITE_GPIO_MHL_RSTz,
+	.ci2ca = 0,
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+	.mhl_usb_switch = elite_usb_dpdn_switch,
+	.mhl_1v2_power = mhl_sii9234_1v2_power,
+	.enable_5v = hdmi_enable_5v,
+	.mhl_power_vote = mhl_sii9234_power_vote,
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SUPERDEMO
+	.abs_x_min = 941,/* 0 */
+	.abs_x_max = 31664,/* 32767 */
+	.abs_y_min = 417,/* 0 */
+	.abs_y_max = 32053,/* 32767 */
+	.abs_pressure_min = 0,
+	.abs_pressure_max = 255,
+	.abs_width_min = 0,
+	.abs_width_max = 20,
+#endif
+#endif
+	.power = mhl_sii9234_power,
+};
+
+static struct i2c_board_info msm_i2c_gsbi8_mhl_sii9234_info[] =
+{
+	{
+		I2C_BOARD_INFO(MHL_SII9234_I2C_NAME, 0x72 >> 1),
+		.platform_data = &mhl_sii9234_device_data,
+		.irq = ELITE_GPIO_MHL_INT
+	},
+};
+#endif
+#endif
+
+static uint32_t usb_ID_PIN_input_table[] = {
+	GPIO_CFG(ELITE_GPIO_USB_ID1, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+
+static uint32_t usb_ID_PIN_ouput_table[] = {
+	GPIO_CFG(ELITE_GPIO_USB_ID1, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+
+void config_elite_usb_id_gpios(bool output)
+{
+	if (output) {
+		gpio_tlmm_config(usb_ID_PIN_ouput_table[0], GPIO_CFG_ENABLE);
+		gpio_set_value(ELITE_GPIO_USB_ID1, 1);
+		pr_info("[CABLE] %s: %d output high\n",  __func__, ELITE_GPIO_USB_ID1);
+	} else {
+		gpio_tlmm_config(usb_ID_PIN_input_table[0], GPIO_CFG_ENABLE);
+		pr_info("[CABLE] %s: %d input none pull\n",  __func__, ELITE_GPIO_USB_ID1);
+	}
+}
+
+int64_t elite_get_usbid_adc(void)
+{
+	struct pm8xxx_adc_chan_result result;
+	int err = 0, adc = 0;
+
+	err = pm8xxx_adc_mpp_config_read(PM8XXX_AMUX_MPP_7,
+					ADC_MPP_1_AMUX6, &result);
+	if (err) {
+		pr_info("[CABLE] %s: get adc fail, err %d\n", __func__, err);
+		return err;
+	}
+	pr_info("[CABLE] chan=%d, adc_code=%d, measurement=%lld, \
+			physical=%lld\n", result.chan, result.adc_code,
+			result.measurement, result.physical);
+	adc = result.physical;
+	return adc/1000;
+}
+
+static struct cable_detect_platform_data cable_detect_pdata = {
+	.detect_type		= CABLE_TYPE_PMIC_ADC,
+	.usb_id_pin_gpio	= ELITE_GPIO_USB_ID1,
+	.get_adc_cb		= elite_get_usbid_adc,
+	.config_usb_id_gpios	= config_elite_usb_id_gpios,
+	.mhl_reset_gpio = ELITE_GPIO_MHL_RSTz,
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+	.mhl_1v2_power = mhl_sii9234_1v2_power,
+	.usb_dpdn_switch	= elite_usb_dpdn_switch,
+#endif
+};
+
+static struct platform_device cable_detect_device = {
+	.name   = "cable_detect",
+	.id     = -1,
+	.dev    = {
+		.platform_data = &cable_detect_pdata,
+	},
+};
+
+static void elite_cable_detect_register(void) {
+	pr_info("%s\n", __func__);
+	platform_device_register(&cable_detect_device);
+}
+
+void elite_pm8xxx_adc_device_register(void)
+{
+	pr_info("%s: Register PM8921 ADC device\n", __func__);
+	headset_device_register();
+}
+
+#define MSM_SHARED_RAM_PHYS 0x80000000
+
+static void __init elite_map_io(void)
+{
+	msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
+	msm_map_msm8960_io();
+	if (socinfo_init() < 0)
+		pr_err("socinfo_init() failed!\n");
+}
+
+static void __init elite_init_irq(void)
+{
+	struct msm_mpm_device_data *data = NULL;
+
+#ifdef CONFIG_MSM_MPM
+	data = &msm8960_mpm_dev_data;
+#endif
+
+	msm_mpm_irq_extn_init(data);
+	gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
+						(void *)MSM_QGIC_CPU_BASE);
+
+	/* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
+	writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
+
+	writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
+	mb();
+}
+
+static void __init msm8960_init_buses(void)
+{
+#ifdef CONFIG_MSM_BUS_SCALING
+	msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
+	msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
+	msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
+	msm_bus_apps_fabric.dev.platform_data =
+		&msm_bus_8960_apps_fabric_pdata;
+	msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
+	msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
+	msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
+	msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
+	msm_bus_rpm_set_mt_mask();
+#endif
+}
+
+static struct msm_spi_platform_data msm8960_qup_spi_gsbi10_pdata = {
+	.max_clock_speed = 27000000,
+};
+
+#ifdef CONFIG_USB_MSM_OTG_72K
+static struct msm_otg_platform_data msm_otg_pdata;
+#else
+#define USB_5V_EN		42
+static int msm_hsusb_vbus_power(bool on)
+{
+	int rc;
+	static bool vbus_is_on;
+	static struct regulator *mvs_otg_switch;
+	struct pm_gpio param = {
+		.direction	= PM_GPIO_DIR_OUT,
+		.output_buffer	= PM_GPIO_OUT_BUF_CMOS,
+		.output_value	= 1,
+		.pull		= PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength	= PM_GPIO_STRENGTH_MED,
+		.function	= PM_GPIO_FUNC_NORMAL,
+	};
+
+	if (vbus_is_on == on)
+		return 0;
+
+	printk(KERN_INFO "%s: %d\n", __func__, on);
+
+	if (on) {
+		mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
+					       "vbus_otg");
+		if (IS_ERR(mvs_otg_switch)) {
+			pr_err("Unable to get mvs_otg_switch\n");
+			return -1;
+		}
+
+		rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
+						"usb_5v_en");
+		if (rc < 0) {
+			pr_err("failed to request usb_5v_en gpio\n");
+			goto put_mvs_otg;
+		}
+
+		if (regulator_enable(mvs_otg_switch)) {
+			pr_err("unable to enable mvs_otg_switch\n");
+			goto free_usb_5v_en;
+		}
+
+		rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
+				&param);
+		if (rc < 0) {
+			pr_err("failed to configure usb_5v_en gpio\n");
+			goto disable_mvs_otg;
+		}
+		vbus_is_on = true;
+		return 0;
+	}
+disable_mvs_otg:
+		regulator_disable(mvs_otg_switch);
+free_usb_5v_en:
+		gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
+put_mvs_otg:
+		regulator_put(mvs_otg_switch);
+		vbus_is_on = false;
+		return -1;
+}
+
+static int phy_init_seq_v3[] = { 0x7f, 0x81, 0x3c, 0x82, -1};
+static int phy_init_seq_v3_2_1[] = { 0x5f, 0x81, 0x3c, 0x82, -1};
+
+static struct msm_otg_platform_data msm_otg_pdata = {
+	.phy_init_seq		= phy_init_seq_v3,
+	.mode			= USB_OTG,
+	.otg_control		= OTG_PMIC_CONTROL,
+	.phy_type		= SNPS_28NM_INTEGRATED_PHY,
+	/* .pmic_id_irq		= PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE), */
+	.vbus_power		= msm_hsusb_vbus_power,
+	.power_budget		= 750,
+	.ldo_power_collapse	= true,
+};
+#endif
+
+/* #ifdef CONFIG_USB_ANDROID_DIAG */
+#define PID_MAGIC_ID		0x71432909
+#define SERIAL_NUM_MAGIC_ID	0x61945374
+#define SERIAL_NUMBER_LENGTH	127
+#define DLOAD_USB_BASE_ADD	0x2A03F0C8
+
+struct magic_num_struct {
+	uint32_t pid;
+	uint32_t serial_num;
+};
+
+struct dload_struct {
+	uint32_t	reserved1;
+	uint32_t	reserved2;
+	uint32_t	reserved3;
+	uint16_t	reserved4;
+	uint16_t	pid;
+	char		serial_number[SERIAL_NUMBER_LENGTH];
+	uint16_t	reserved5;
+	struct magic_num_struct magic_struct;
+};
+
+static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
+{
+	struct dload_struct __iomem *dload = 0;
+
+	dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
+	if (!dload) {
+		pr_err("%s: cannot remap I/O memory region: %08x\n",
+					__func__, DLOAD_USB_BASE_ADD);
+		return -ENXIO;
+	}
+
+	pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
+				__func__, dload, pid, snum);
+	/* update pid */
+	dload->magic_struct.pid = PID_MAGIC_ID;
+	dload->pid = pid;
+
+	/* update serial number */
+	dload->magic_struct.serial_num = 0;
+	if (!snum) {
+		memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
+		goto out;
+	}
+
+	dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
+	strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
+out:
+	iounmap(dload);
+	return 0;
+}
+
+static struct android_usb_platform_data android_usb_pdata = {
+	.update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
+};
+
+static struct platform_device android_usb_device = {
+	.name	= "android_usb",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &android_usb_pdata,
+	},
+};
+
+#define VERSION_ID (readl(HW_VER_ID_VIRT) & 0xf0000000) >> 28
+#define HW_8960_V3_2_1   0x07
+void elite_add_usb_devices(void)
+{
+	if (VERSION_ID == HW_8960_V3_2_1) {
+		printk(KERN_INFO "%s rev: %d v3.2.1\n", __func__, system_rev);
+		msm_otg_pdata.phy_init_seq = phy_init_seq_v3_2_1;
+	} else {
+		printk(KERN_INFO "%s rev: %d\n", __func__, system_rev);
+		msm_otg_pdata.phy_init_seq = phy_init_seq_v3;
+	}
+	printk(KERN_INFO "%s: OTG_PMIC_CONTROL in rev: %d\n",
+			__func__, system_rev);
+}
+
+static uint8_t spm_wfi_cmd_sequence[] __initdata = {
+			0x03, 0x0f,
+};
+
+static uint8_t spm_retention_cmd_sequence[] __initdata = {
+			0x00, 0x05, 0x03, 0x0D,
+			0x0B, 0x00, 0x0f,
+};
+
+static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
+	0x42, 0x1B, 0x00,
+	0x05, 0x03, 0x0D, 0x0B,
+	0x00, 0x42, 0x1B,
+	0x0f,
+};
+
+static uint8_t spm_power_collapse_without_rpm[] __initdata = {
+			0x00, 0x24, 0x54, 0x10,
+			0x09, 0x03, 0x01,
+			0x10, 0x54, 0x30, 0x0C,
+			0x24, 0x30, 0x0f,
+};
+
+static uint8_t spm_power_collapse_with_rpm[] __initdata = {
+			0x00, 0x24, 0x54, 0x10,
+			0x09, 0x07, 0x01, 0x0B,
+			0x10, 0x54, 0x30, 0x0C,
+			0x24, 0x30, 0x0f,
+};
+
+/* 8960AB has a different command to assert apc_pdn */
+static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
+	0x00, 0x24, 0x84, 0x10,
+	0x09, 0x03, 0x01,
+	0x10, 0x84, 0x30, 0x0C,
+	0x24, 0x30, 0x0f,
+};
+
+static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
+	0x00, 0x24, 0x84, 0x10,
+	0x09, 0x07, 0x01, 0x0B,
+	0x10, 0x84, 0x30, 0x0C,
+	0x24, 0x30, 0x0f,
+};
+
+static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_MODE_CLOCK_GATING,
+		.notify_rpm = false,
+		.cmd = spm_wfi_cmd_sequence,
+	},
+
+	[1] = {
+		.mode = MSM_SPM_MODE_POWER_RETENTION,
+		.notify_rpm = false,
+		.cmd = spm_retention_cmd_sequence,
+	},
+
+	[2] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = false,
+		.cmd = spm_power_collapse_without_rpm,
+	},
+	[3] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = spm_power_collapse_with_rpm,
+	},
+};
+
+static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_MODE_CLOCK_GATING,
+		.notify_rpm = false,
+		.cmd = spm_wfi_cmd_sequence,
+	},
+
+	[1] = {
+		.mode = MSM_SPM_MODE_POWER_RETENTION,
+		.notify_rpm = false,
+		.cmd = spm_retention_cmd_sequence,
+	},
+
+	[2] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = false,
+		.cmd = spm_power_collapse_without_rpm,
+	},
+
+	[3] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = spm_power_collapse_with_rpm,
+	},
+};
+
+static struct msm_spm_platform_data msm_spm_data[] __initdata = {
+	[0] = {
+		.reg_base_addr = MSM_SAW0_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
+#if defined(CONFIG_MSM_AVS_HW)
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
+#endif
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
+		.vctl_timeout_us = 50,
+		.num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
+		.modes = msm_spm_boot_cpu_seq_list,
+	},
+	[1] = {
+		.reg_base_addr = MSM_SAW1_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
+#if defined(CONFIG_MSM_AVS_HW)
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
+#endif
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
+		.vctl_timeout_us = 50,
+		.num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
+		.modes = msm_spm_nonboot_cpu_seq_list,
+	},
+};
+
+static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
+			0x00, 0x20, 0x03, 0x20,
+			0x00, 0x0f,
+};
+
+static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
+			0x00, 0x20, 0x34, 0x64,
+			0x48, 0x07, 0x48, 0x20,
+			0x50, 0x64, 0x04, 0x34,
+			0x50, 0x0f,
+};
+static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
+			0x00, 0x10, 0x34, 0x64,
+			0x48, 0x07, 0x48, 0x10,
+			0x50, 0x64, 0x04, 0x34,
+			0x50, 0x0F,
+};
+
+static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_L2_MODE_RETENTION,
+		.notify_rpm = false,
+		.cmd = l2_spm_wfi_cmd_sequence,
+	},
+	[1] = {
+		.mode = MSM_SPM_L2_MODE_GDHS,
+		.notify_rpm = true,
+		.cmd = l2_spm_gdhs_cmd_sequence,
+	},
+	[2] = {
+		.mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = l2_spm_power_off_cmd_sequence,
+	},
+};
+
+static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
+	[0] = {
+		.reg_base_addr = MSM_SAW_L2_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
+		.modes = msm_spm_l2_seq_list,
+		.num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
+	},
+};
+
+#ifdef CONFIG_PERFLOCK
+static unsigned elite_perf_acpu_table[] = {
+	810000000, /* LOWEST */
+	918000000, /* LOW */
+	1026000000, /* MEDIUM */
+	1242000000,/* HIGH */
+	1512000000, /* HIGHEST */
+};
+
+static unsigned elite_cpufreq_ceiling_acpu_table[] = {
+	702000000,
+	918000000,
+	1026000000,
+};
+
+static struct perflock_data elite_perflock_data = {
+	.perf_acpu_table = elite_perf_acpu_table,
+	.table_size = ARRAY_SIZE(elite_perf_acpu_table),
+};
+
+static struct perflock_data elite_cpufreq_ceiling_data = {
+	.perf_acpu_table = elite_cpufreq_ceiling_acpu_table,
+	.table_size = ARRAY_SIZE(elite_cpufreq_ceiling_acpu_table),
+};
+
+static struct perflock_pdata perflock_pdata = {
+	.perf_floor = &elite_perflock_data,
+	.perf_ceiling = &elite_cpufreq_ceiling_data,
+};
+
+struct platform_device msm8960_device_perf_lock = {
+	.name = "perf_lock",
+	.id = -1,
+	.dev = {
+		.platform_data = &perflock_pdata,
+	},
+};
+#endif
+
+static uint32_t gsbi3_gpio_table[] = {
+	GPIO_CFG(ELITE_GPIO_TP_I2C_DAT, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_TP_I2C_CLK, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi3_gpio_table_gpio[] = {
+	GPIO_CFG(ELITE_GPIO_TP_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_TP_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+/* CAMERA setting */
+static uint32_t gsbi4_gpio_table[] = {
+	GPIO_CFG(ELITE_GPIO_CAM_I2C_DAT, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_CAM_I2C_CLK, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi4_gpio_table_gpio[] = {
+	GPIO_CFG(ELITE_GPIO_CAM_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_CAM_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi5_gpio_table[] = {
+	GPIO_CFG(ELITE_GPIO_NFC_I2C_SDA, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_NFC_I2C_SCL, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi5_gpio_table_gpio[] = {
+	GPIO_CFG(ELITE_GPIO_NFC_I2C_SDA, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_NFC_I2C_SCL, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi8_gpio_table[] = {
+	GPIO_CFG(ELITE_GPIO_MC_I2C_DAT, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_MC_I2C_CLK, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi8_gpio_table_gpio[] = {
+	GPIO_CFG(ELITE_GPIO_MC_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_MC_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi12_gpio_table[] = {
+	GPIO_CFG(ELITE_GPIO_SR_I2C_DAT, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_SR_I2C_CLK, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi12_gpio_table_gpio[] = {
+	GPIO_CFG(ELITE_GPIO_SR_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(ELITE_GPIO_SR_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
+{
+	printk(KERN_INFO "%s(): adap_id = %d, config_type = %d \n", __func__, adap_id, config_type);
+
+	if ((adap_id == MSM_8960_GSBI3_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi3_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi3_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI3_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi3_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi3_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+
+	/* CAMERA setting */
+	if ((adap_id == MSM_8960_GSBI4_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi4_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi4_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI4_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi4_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi4_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI5_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi5_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi5_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI5_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi5_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi5_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI8_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi8_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi8_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI8_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi8_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi8_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI12_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi12_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi12_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI12_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi12_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi12_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+}
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi5_pdata = {
+	.clk_freq = 100000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi8_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+//	.share_uart_flag = 1,	/* check if QUP-I2C and Uart share the gisb */
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct platform_device msm_device_saw_core0 = {
+	.name          = "saw-regulator",
+	.id            = 0,
+	.dev	= {
+		.platform_data = &msm_saw_regulator_pdata_s5,
+	},
+};
+
+static struct platform_device msm_device_saw_core1 = {
+	.name          = "saw-regulator",
+	.id            = 1,
+	.dev	= {
+		.platform_data = &msm_saw_regulator_pdata_s6,
+	},
+};
+
+static struct tsens_platform_data msm_tsens_pdata  = {
+		.slope			= {910, 910, 910, 910, 910},
+		.tsens_factor		= 1000,
+		.hw_type		= MSM_8960,
+		.tsens_num_sensor	= 5,
+};
+
+static struct platform_device msm_tsens_device = {
+	.name   = "tsens8960-tm",
+	.id = -1,
+};
+
+static struct msm_thermal_data msm_thermal_pdata = {
+	.sensor_id = 0,
+	.poll_ms = 1000,
+	.limit_temp_degC = 60,
+	.temp_hysteresis_degC = 10,
+	//	.limit_freq = 918000,
+	.freq_step = 2,
+};
+
+#ifdef CONFIG_MSM_FAKE_BATTERY
+static struct platform_device fish_battery_device = {
+	.name = "fish_battery",
+};
+#endif
+
+static struct platform_device scm_memchk_device = {
+	.name		= "scm-memchk",
+	.id		= -1,
+};
+
+static struct platform_device elite_device_rpm_regulator __devinitdata = {
+	.name	= "rpm-regulator",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &elite_rpm_regulator_pdata,
+	},
+};
+
+static struct pm8xxx_vibrator_pwm_platform_data pm8xxx_vib_pwm_pdata = {
+	.initial_vibrate_ms = 0,
+	.max_timeout_ms = 15000,
+	.duty_us = 49,
+	.PERIOD_US = 62,
+	.bank = 2,
+	.ena_gpio = ELITE_GPIO_HAPTIC_EN,
+	.vdd_gpio = PM8921_GPIO_PM_TO_SYS(ELITE_PMGPIO_HAPTIC_3V3_EN),
+};
+
+static struct platform_device vibrator_pwm_device = {
+	.name = PM8XXX_VIBRATOR_PWM_DEV_NAME,
+	.dev = {
+		.platform_data	= &pm8xxx_vib_pwm_pdata,
+	},
+};
+
+static struct platform_device *common_devices[] __initdata = {
+	&msm8960_device_acpuclk,
+	&msm8960_device_dmov,
+	&msm_device_smd,
+	&msm8960_device_uart_gsbi8,
+	&msm_device_uart_dm6,
+	&msm_device_saw_core0,
+	&msm_device_saw_core1,
+	&msm8960_device_ext_5v_vreg,
+	&msm8960_device_qup_i2c_gsbi3,
+	&msm8960_device_qup_i2c_gsbi4,
+	&msm8960_device_qup_i2c_gsbi5,
+	&msm8960_device_qup_i2c_gsbi8,
+	&msm8960_device_qup_spi_gsbi10,
+#ifndef CONFIG_MSM_DSPS
+	&msm8960_device_qup_i2c_gsbi12,
+#endif
+	&msm8960_device_ssbi_pmic,
+	&msm_slim_ctrl,
+	&msm_device_wcnss_wlan,
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
+	&qcrypto_device,
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+	&qcedev_device,
+#endif
+#ifdef CONFIG_MSM_ROTATOR
+	&msm_rotator_device,
+#endif
+	&msm8960_cpu_slp_status,
+	&msm_device_sps,
+#ifdef CONFIG_MSM_FAKE_BATTERY
+	&fish_battery_device,
+#endif
+	&fmem_device,
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	&android_pmem_device,
+	&android_pmem_adsp_device,
+	&android_pmem_audio_device,
+#endif
+#endif
+	&msm_device_vidc,
+	&msm_device_bam_dmux,
+	&msm_fm_platform_init,
+
+#ifdef CONFIG_HW_RANDOM_MSM
+	&msm_device_rng,
+#endif
+#ifdef CONFIG_ION_MSM
+	&ion_dev,
+#endif
+	&msm8960_rpm_device,
+	&msm8960_rpm_log_device,
+	&msm8960_rpm_stat_device,
+#ifdef CONFIG_MSM_QDSS
+	&msm_etb_device,
+	&msm_tpiu_device,
+	&msm_funnel_device,
+	&msm_etm_device,
+#endif
+	&msm8960_device_watchdog,
+#ifdef CONFIG_MSM_RTB
+	&msm_rtb_device,
+#endif
+	&msm8960_device_cache_erp,
+	&msm8960_iommu_domain_device,
+#ifdef CONFIG_MSM_CACHE_DUMP
+	&msm_cache_dump_device,
+#endif
+#ifdef CONFIG_HTC_BATT_8960
+	&htc_battery_pdev,
+#endif
+	&msm_tsens_device,
+	&vibrator_pwm_device,
+};
+
+static struct platform_device *elite_devices[] __initdata = {
+	&msm_8960_q6_lpass,
+	&msm_8960_q6_mss_fw,
+	&msm_8960_q6_mss_sw,
+	&msm_8960_riva,
+	&msm_pil_tzapps,
+	&msm8960_device_otg,
+	&msm_device_hsusb_host,
+	&msm8960_device_gadget_peripheral,
+	&android_usb_device,
+	&msm_pcm,
+	&msm_pcm_routing,
+	&msm_multi_ch_pcm,
+	&msm_cpudai0,
+	&msm_cpudai1,
+	&msm8960_cpudai_slimbus_2_tx,
+	&msm8960_cpudai_slimbus_2_rx,
+	&msm_cpudai_hdmi_rx,
+	&msm_cpudai_bt_rx,
+	&msm_cpudai_bt_tx,
+	&msm_cpudai_fm_rx,
+	&msm_cpudai_fm_tx,
+	&msm_cpudai_auxpcm_rx,
+	&msm_cpudai_auxpcm_tx,
+	&msm_cpu_fe,
+	&msm_stub_codec,
+#ifdef CONFIG_MSM_GEMINI
+	&msm8960_gemini_device,
+#endif
+	&msm_voice,
+	&msm_voip,
+	&msm_lpa_pcm,
+	&msm_cpudai_afe_01_rx,
+	&msm_cpudai_afe_01_tx,
+	&msm_cpudai_afe_02_rx,
+	&msm_cpudai_afe_02_tx,
+	&msm_pcm_afe,
+	&msm_compr_dsp,
+	&msm_cpudai_incall_music_rx,
+	&msm_cpudai_incall_record_rx,
+	&msm_cpudai_incall_record_tx,
+	&msm_pcm_hostless,
+	&msm_lowlatency_pcm,
+	&msm_bus_apps_fabric,
+	&msm_bus_sys_fabric,
+	&msm_bus_mm_fabric,
+	&msm_bus_sys_fpb,
+	&msm_bus_cpss_fpb,
+	&msm_device_tz_log,
+#ifdef CONFIG_PERFLOCK
+	&msm8960_device_perf_lock,
+#endif
+	&scm_memchk_device,
+};
+
+static void __init msm8960_i2c_init(void)
+{
+	msm8960_device_qup_i2c_gsbi4.dev.platform_data =
+					&msm8960_i2c_qup_gsbi4_pdata;
+
+	msm8960_device_qup_i2c_gsbi3.dev.platform_data =
+					&msm8960_i2c_qup_gsbi3_pdata;
+
+	msm8960_device_qup_i2c_gsbi5.dev.platform_data =
+					&msm8960_i2c_qup_gsbi5_pdata;
+
+	msm8960_device_qup_i2c_gsbi8.dev.platform_data =
+					&msm8960_i2c_qup_gsbi8_pdata;
+
+	msm8960_device_qup_i2c_gsbi12.dev.platform_data =
+					&msm8960_i2c_qup_gsbi12_pdata;
+}
+
+static void __init msm8960_gfx_init(void)
+{
+	struct kgsl_device_platform_data *kgsl_3d0_pdata =
+		msm_kgsl_3d0.dev.platform_data;
+	uint32_t soc_platform_version = socinfo_get_version();
+
+	/* Fixup data that needs to change based on GPU ID */
+	if (cpu_is_msm8960ab()) {
+		kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
+		/* 8960PRO nominal clock rate is 320Mhz */
+		kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 320000000;
+	} else {
+		kgsl_3d0_pdata->iommu_count = 1;
+		if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
+			kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
+			kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
+		}
+		if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
+			/* 8960v3 GPU registers returns 5 for patch release
+			 * but it should be 6, so dummy up the chipid here
+			 * based the platform type
+			 */
+			kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
+		}
+	}
+
+	/* Register the 3D core */
+	platform_device_register(&msm_kgsl_3d0);
+
+	/* Register the 2D cores if we are not 8960PRO */
+	if (!cpu_is_msm8960ab()) {
+		platform_device_register(&msm_kgsl_2d0);
+		platform_device_register(&msm_kgsl_2d1);
+	}
+}
+
+#ifdef CONFIG_HTC_BATT_8960
+static struct pm8921_charger_batt_param chg_batt_params[] = {
+	[0] = {
+		.max_voltage = 4200,
+		.cool_bat_voltage = 4200,
+		.warm_bat_voltage = 4000,
+	},
+	[1] = {
+		.max_voltage = 4340,
+		.cool_bat_voltage = 4340,
+		.warm_bat_voltage = 4000,
+	},
+	[2] = {
+		.max_voltage = 4300,
+		.cool_bat_voltage = 4300,
+		.warm_bat_voltage = 4000,
+	},
+	[3] = {
+		.max_voltage = 4350,
+		.cool_bat_voltage = 4350,
+		.warm_bat_voltage = 4000,
+	},
+};
+
+static struct single_row_lut fcc_temp_id_1 = {
+	.x	= {-20, -10, 0, 5, 10, 20, 30, 40},
+	.y	= {1268, 1269, 1270, 1470, 1580, 1760, 1801, 1802},
+	.cols	= 8,
+};
+
+static struct single_row_lut fcc_sf_id_1 = {
+	.x	= {100, 200, 300, 400, 500},
+	.y	= {100, 97, 96, 93, 90},
+	.cols	= 5,
+};
+
+static struct sf_lut pc_sf_id_1 = {
+	.rows		= 10,
+	.cols		= 5,
+	.row_entries	= {100, 200, 300, 400, 500},
+	.percent	= {100, 90, 80, 70, 60, 50, 40, 30, 20, 10},
+	.sf		= {
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100}
+	},
+};
+
+static struct pc_temp_ocv_lut  pc_temp_ocv_id_1 = {
+	.rows		= 29,
+	.cols		= 8,
+	.temp		= {-20, -10, 0, 5, 10, 20, 30, 40},
+	.percent	= {100, 95, 90, 85, 80, 75, 70, 65, 60, 55,
+				50, 45, 40, 35, 30, 25, 20, 15, 10, 9,
+				8, 7, 6, 5, 4, 3, 2, 1, 0
+	},
+	.ocv		= {
+			{4150 , 4150 , 4150 , 4150 , 4150 , 4150 , 4150 , 4150 },
+			{4130 , 4130 , 4130 , 4141 , 4138 , 4133 , 4130 , 4129 },
+			{4112 , 4112 , 4112 , 4104 , 4099 , 4090 , 4085 , 4084 },
+			{4082 , 4082 , 4082 , 4069 , 4062 , 4050 , 4044 , 4042 },
+			{4053 , 4053 , 4053 , 4037 , 4028 , 4013 , 4006 , 4000 },
+			{4025 , 4025 , 4025 , 4006 , 3996 , 3980 , 3972 , 3970 },
+			{3999 , 3999 , 3999 , 3979 , 3968 , 3951 , 3942 , 3940 },
+			{3975 , 3975 , 3975 , 3953 , 3942 , 3924 , 3915 , 3912 },
+			{3952 , 3952 , 3952 , 3929 , 3917 , 3898 , 3889 , 3887 },
+			{3929 , 3929 , 3929 , 3903 , 3889 , 3861 , 3846 , 3844 },
+			{3906 , 3906 , 3906 , 3874 , 3855 , 3826 , 3817 , 3816 },
+			{3881 , 3881 , 3881 , 3845 , 3828 , 3808 , 3800 , 3800 },
+			{3857 , 3857 , 3857 , 3824 , 3810 , 3794 , 3788 , 3787 },
+			{3836 , 3836 , 3836 , 3808 , 3797 , 3784 , 3777 , 3776 },
+			{3767 , 3767 , 3820 , 3796 , 3787 , 3776 , 3770 , 3767 },
+			{3754 , 3754 , 3807 , 3787 , 3779 , 3770 , 3762 , 3754 },
+			{3734 , 3734 , 3797 , 3781 , 3774 , 3761 , 3743 , 3734 },
+			{3705 , 3705 , 3789 , 3775 , 3768 , 3743 , 3713 , 3705 },
+			{3670 , 3670 , 3783 , 3769 , 3759 , 3707 , 3676 , 3670 },
+			{3668 , 3668 , 3782 , 3768 , 3756 , 3701 , 3674 , 3668 },
+			{3666 , 3666 , 3781 , 3766 , 3752 , 3695 , 3672 , 3666 },
+			{3664 , 3664 , 3780 , 3765 , 3749 , 3689 , 3669 , 3664 },
+			{3662 , 3662 , 3779 , 3763 , 3745 , 3683 , 3667 , 3662 },
+			{3660 , 3660 , 3777 , 3761 , 3741 , 3677 , 3664 , 3660 },
+			{3618 , 3618 , 3776 , 3758 , 3734 , 3674 , 3626 , 3618 },
+			{3576 , 3576 , 3775 , 3754 , 3726 , 3671 , 3587 , 3576 },
+			{3534 , 3534 , 3774 , 3751 , 3718 , 3668 , 3548 , 3534 },
+			{3491 , 3491 , 3772 , 3747 , 3710 , 3664 , 3509 , 3491 },
+			{3400 , 3400 , 3650 , 3650 , 3550 , 3500 , 3450 , 3400 }
+	},
+};
+
+struct pm8921_bms_battery_data  bms_battery_data_id_1 = {
+	.fcc			= 1800,
+	.fcc_temp_lut		= &fcc_temp_id_1,
+	.fcc_sf_lut		= &fcc_sf_id_1,
+	.pc_temp_ocv_lut	= &pc_temp_ocv_id_1,
+	.pc_sf_lut		= &pc_sf_id_1,
+};
+
+static struct single_row_lut fcc_temp_id_2 = {
+	.x	= {-20, -10, 0, 5, 10, 20, 30, 40},
+	.y	= {1540, 1543, 1623, 1715, 1759, 1794, 1785, 1780},
+	.cols	= 8,
+};
+
+static struct single_row_lut fcc_sf_id_2 = {
+	.x	= {100, 200, 300, 400, 500},
+	.y	= {100, 97, 96, 93, 90},
+	.cols	= 5,
+};
+
+static struct sf_lut pc_sf_id_2 = {
+	.rows		= 10,
+	.cols		= 5,
+	.row_entries	= {100, 200, 300, 400, 500},
+	.percent	= {100, 90, 80, 70, 60, 50, 40, 30, 20, 10},
+	.sf		= {
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100}
+	},
+};
+
+static struct pc_temp_ocv_lut  pc_temp_ocv_id_2 = {
+	.rows		= 29,
+	.cols		= 8,
+	.temp		= {-20, -10, 0, 5, 10, 20, 30, 40},
+	.percent	= {100, 95, 90, 85, 80, 75, 70, 65, 60, 55,
+				50, 45, 40, 35, 30, 25, 20, 15, 10, 9,
+				8, 7, 6, 5, 4, 3, 2, 1, 0
+	},
+	.ocv		= {
+			{4150 , 4150 , 4150 , 4150 , 4150 , 4150 , 4150 , 4150 },
+			{4141 , 4141 , 4140 , 4137 , 4135 , 4133 , 4132 , 4130 },
+			{4102 , 4102 , 4098 , 4094 , 4091 , 4088 , 4087 , 4085 },
+			{4066 , 4066 , 4061 , 4054 , 4051 , 4047 , 4046 , 4044 },
+			{4024 , 4024 , 4021 , 4013 , 4011 , 4007 , 4008 , 4006 },
+			{3986 , 3986 , 3987 , 3980 , 3977 , 3974 , 3974 , 3972 },
+			{3955 , 3955 , 3960 , 3952 , 3948 , 3944 , 3943 , 3941 },
+			{3926 , 3926 , 3930 , 3922 , 3920 , 3917 , 3916 , 3914 },
+			{3897 , 3897 , 3897 , 3887 , 3886 , 3887 , 3890 , 3889 },
+			{3871 , 3871 , 3866 , 3855 , 3849 , 3845 , 3846 , 3847 },
+			{3848 , 3848 , 3841 , 3829 , 3823 , 3819 , 3819 , 3819 },
+			{3829 , 3829 , 3821 , 3811 , 3806 , 3802 , 3802 , 3802 },
+			{3812 , 3812 , 3805 , 3797 , 3793 , 3790 , 3789 , 3789 },
+			{3798 , 3798 , 3793 , 3787 , 3784 , 3781 , 3779 , 3778 },
+			{3788 , 3788 , 3785 , 3780 , 3778 , 3774 , 3771 , 3768 },
+			{3781 , 3781 , 3780 , 3775 , 3772 , 3766 , 3758 , 3751 },
+			{3773 , 3773 , 3774 , 3765 , 3756 , 3742 , 3735 , 3731 },
+			{3763 , 3763 , 3762 , 3738 , 3721 , 3702 , 3697 , 3696 },
+			{3747 , 3747 , 3736 , 3703 , 3693 , 3684 , 3679 , 3674 },
+			{3743 , 3743 , 3730 , 3701 , 3691 , 3674 , 3669 , 3668 },
+			{3739 , 3739 , 3724 , 3698 , 3688 , 3664 , 3659 , 3661 },
+			{3735 , 3735 , 3718 , 3695 , 3685 , 3653 , 3649 , 3654 },
+			{3731 , 3731 , 3712 , 3692 , 3682 , 3643 , 3639 , 3647 },
+			{3726 , 3726 , 3705 , 3689 , 3679 , 3632 , 3628 , 3640 },
+			{3722 , 3722 , 3702 , 3669 , 3626 , 3592 , 3589 , 3599 },
+			{3717 , 3717 , 3698 , 3649 , 3573 , 3551 , 3550 , 3558 },
+			{3713 , 3713 , 3695 , 3629 , 3520 , 3511 , 3511 , 3517 },
+			{3708 , 3708 , 3691 , 3609 , 3467 , 3470 , 3472 , 3475 },
+			{3600 , 3600 , 3550 , 3500 , 3300 , 3300 , 3300 , 3300 }
+	},
+};
+
+struct pm8921_bms_battery_data  bms_battery_data_id_2 = {
+	.fcc			= 1780,
+	.fcc_temp_lut		= &fcc_temp_id_2,
+	.fcc_sf_lut		= &fcc_sf_id_2,
+	.pc_temp_ocv_lut	= &pc_temp_ocv_id_2,
+	.pc_sf_lut		= &pc_sf_id_2,
+};
+
+static struct htc_battery_cell htc_battery_cells[] = {
+	[0] = {
+		.model_name = "BJ83100",
+		.capacity = 1800,
+		.id = 1,
+		.id_raw_min = 73, /* unit:mV (10kohm) */
+		.id_raw_max = 204,
+		.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+		.voltage_max = 4200,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[0],
+		.gauge_param = &bms_battery_data_id_1,
+	},
+	[1] = {
+		.model_name = "BJ83100",
+		.capacity = 1800,
+		.id = 2,
+		.id_raw_min = 205, /* unit:mV (22kohm) */
+		.id_raw_max = 595,
+		.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+		.voltage_max = 4200,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[0],
+		.gauge_param = &bms_battery_data_id_2,
+	},
+	[2] = {
+		.model_name = "UNKNOWN",
+		.capacity = 1800,
+		.id = 255,
+		.id_raw_min = INT_MIN,
+		.id_raw_max = INT_MAX,
+		.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+		.voltage_max = 4200,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[0],
+		.gauge_param = NULL,
+	},
+};
+#endif /* CONFIG_HTC_BATT_8960 */
+
+static struct msm_rpmrs_level msm_rpmrs_levels[] = {
+	{
+		MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		1, 784, 180000, 100,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_RETENTION,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		415, 715, 340827, 475,
+	},
+#ifdef CONFIG_MSM_STANDALONE_POWER_COLLAPSE
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		1300, 228, 1200000, 2000,
+	},
+#endif
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
+		false,
+		2000, 138, 1208400, 3200,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
+		false,
+		6000, 119, 1850300, 9000,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
+		false,
+		9200, 68, 2839200, 16400,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
+		false,
+		10300, 63, 3128000, 18200,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
+		false,
+		18000, 10, 4602600, 27000,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
+		false,
+		20000, 2, 5752000, 32000,
+	},
+};
+
+
+static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
+	.levels = &msm_rpmrs_levels[0],
+	.num_levels = ARRAY_SIZE(msm_rpmrs_levels),
+	.vdd_mem_levels  = {
+		[MSM_RPMRS_VDD_MEM_RET_LOW]	= 750000,
+		[MSM_RPMRS_VDD_MEM_RET_HIGH]	= 750000,
+		[MSM_RPMRS_VDD_MEM_ACTIVE]	= 1050000,
+		[MSM_RPMRS_VDD_MEM_MAX]		= 1150000,
+	},
+	.vdd_dig_levels = {
+		[MSM_RPMRS_VDD_DIG_RET_LOW]	= 500000,
+		[MSM_RPMRS_VDD_DIG_RET_HIGH]	= 750000,
+		[MSM_RPMRS_VDD_DIG_ACTIVE]	= 950000,
+		[MSM_RPMRS_VDD_DIG_MAX]		= 1150000,
+	},
+	.vdd_mask = 0x7FFFFF,
+	.rpmrs_target_id = {
+		[MSM_RPMRS_ID_PXO_CLK]		= MSM_RPM_ID_PXO_CLK,
+		[MSM_RPMRS_ID_L2_CACHE_CTL]	= MSM_RPM_ID_LAST,
+		[MSM_RPMRS_ID_VDD_DIG_0]	= MSM_RPM_ID_PM8921_S3_0,
+		[MSM_RPMRS_ID_VDD_DIG_1]	= MSM_RPM_ID_PM8921_S3_1,
+		[MSM_RPMRS_ID_VDD_MEM_0]	= MSM_RPM_ID_PM8921_L24_0,
+		[MSM_RPMRS_ID_VDD_MEM_1]	= MSM_RPM_ID_PM8921_L24_1,
+		[MSM_RPMRS_ID_RPM_CTL]		= MSM_RPM_ID_RPM_CTL,
+	},
+};
+
+static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
+	.mode = MSM_PM_BOOT_CONFIG_TZ,
+};
+
+#ifdef CONFIG_I2C
+#define I2C_SURF 1
+#define I2C_FFA  (1 << 1)
+#define I2C_RUMI (1 << 2)
+#define I2C_SIM  (1 << 3)
+#define I2C_FLUID (1 << 4)
+
+struct i2c_registry {
+	u8                     machs;
+	int                    bus;
+	struct i2c_board_info *info;
+	int                    len;
+};
+
+static struct i2c_registry msm8960_i2c_devices[] __initdata = {
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI8_QUP_I2C_BUS_ID,
+		msm_i2c_gsbi8_mhl_sii9234_info,
+		ARRAY_SIZE(msm_i2c_gsbi8_mhl_sii9234_info),
+	},
+#endif
+#endif
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+		i2c_tps61310_flashlight,
+		ARRAY_SIZE(i2c_tps61310_flashlight),
+	},
+#endif
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI3_QUP_I2C_BUS_ID,
+		msm_i2c_gsbi3_info,
+		ARRAY_SIZE(msm_i2c_gsbi3_info),
+	},
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI2_QUP_I2C_BUS_ID,
+		msm_i2c_gsbi2_a1028_info,
+		ARRAY_SIZE(msm_i2c_gsbi2_a1028_info),
+	},
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI5_QUP_I2C_BUS_ID,
+		pn544_i2c_boardinfo,
+		ARRAY_SIZE(pn544_i2c_boardinfo),
+	},
+};
+#endif /* CONFIG_I2C */
+
+extern int gy_type; /* from devices_htc.c */
+static void __init register_i2c_devices(void)
+{
+#ifdef CONFIG_I2C
+	u8 mach_mask = 0;
+	int i, rc;
+
+	mach_mask = I2C_SURF;
+
+	/* Run the array and install devices as appropriate */
+	for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
+		if (msm8960_i2c_devices[i].machs & mach_mask) {
+			i2c_register_board_info(msm8960_i2c_devices[i].bus,
+						msm8960_i2c_devices[i].info,
+						msm8960_i2c_devices[i].len);
+		}
+	}
+
+	if ((engineerid & 0x03) == 1) {
+		for (rc = 0; rc < ARRAY_SIZE(msm_i2c_gsbi3_info); rc++) {
+			if (!strcmp(msm_i2c_gsbi3_info[rc].type, SYNAPTICS_3200_NAME))
+				msm_i2c_gsbi3_info[rc].platform_data = &syn_ts_3k_2p5D_7070_data;
+		}
+	} else if ((engineerid & 0x03) == 2) {
+		for (rc = 0; rc < ARRAY_SIZE(msm_i2c_gsbi3_info); rc++) {
+			if (!strcmp(msm_i2c_gsbi3_info[rc].type, SYNAPTICS_3200_NAME))
+				msm_i2c_gsbi3_info[rc].platform_data = &syn_ts_3k_2p5D_3030_data;
+		}
+	}
+
+	printk(KERN_DEBUG "%s: gy_type = %d\n", __func__, gy_type);
+
+	if (gy_type == 2) {
+		i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+				msm_i2c_sensor_gsbi12_info,
+				ARRAY_SIZE(msm_i2c_sensor_gsbi12_info));
+	} else {
+		i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+				mpu3050_GSBI12_boardinfo,
+				ARRAY_SIZE(mpu3050_GSBI12_boardinfo));
+	}
+
+	if (system_rev < 3) {
+		i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+				i2c_CM36282_devices, ARRAY_SIZE(i2c_CM36282_devices));
+		pr_info("%s: cm36282 PL-sensor for XA,XB,XC, system_rev %d ",
+				__func__, system_rev);
+	} else {
+		i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+				i2c_CM36282_XD_devices,	ARRAY_SIZE(i2c_CM36282_XD_devices));
+		pr_info("%s: cm36282 PL-sensor for XD and newer HW version, system_rev %d ",
+				__func__, system_rev);
+	}
+#endif
+}
+
+static void __init msm8960ab_update_krait_spm(void)
+{
+	int i;
+
+
+	/* Update the SPM sequences for SPC and PC */
+	for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
+		int j;
+		struct msm_spm_platform_data *pdata = &msm_spm_data[i];
+		for (j = 0; j < pdata->num_modes; j++) {
+			if (pdata->modes[j].cmd ==
+					spm_power_collapse_without_rpm)
+				pdata->modes[j].cmd =
+				spm_power_collapse_without_rpm_krait_v3;
+			else if (pdata->modes[j].cmd ==
+					spm_power_collapse_with_rpm)
+				pdata->modes[j].cmd =
+				spm_power_collapse_with_rpm_krait_v3;
+		}
+	}
+}
+
+static void __init msm8960ab_update_retention_spm(void)
+{
+	int i;
+
+	/* Update the SPM sequences for krait retention on all cores */
+	for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
+		int j;
+		struct msm_spm_platform_data *pdata = &msm_spm_data[i];
+		for (j = 0; j < pdata->num_modes; j++) {
+			if (pdata->modes[j].cmd ==
+					spm_retention_cmd_sequence)
+				pdata->modes[j].cmd =
+				spm_retention_with_krait_v3_cmd_sequence;
+		}
+	}
+}
+
+/*UART -> GSBI8*/
+static uint32_t msm_uart_gpio[] = {
+	GPIO_CFG(34, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(35, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA),
+};
+static void msm_uart_gsbi_gpio_init(void)
+{
+	gpio_tlmm_config(msm_uart_gpio[0], GPIO_CFG_ENABLE);
+	gpio_tlmm_config(msm_uart_gpio[1], GPIO_CFG_ENABLE);
+}
+
+static uint32_t msm_region_gpio[] = {
+	GPIO_CFG(ELITE_GPIO_REGION_ID, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, 0),
+};
+static void msm_region_id_gpio_init(void)
+{
+	gpio_tlmm_config(msm_region_gpio[0], GPIO_CFG_ENABLE);
+}
+
+#ifdef CONFIG_RAWCHIP
+static struct spi_board_info rawchip_spi_board_info[] __initdata = {
+	{
+		.modalias               = "spi_rawchip",
+		.max_speed_hz           = 27000000,
+		.bus_num                = 1,
+		.chip_select            = 0,
+		.mode                   = SPI_MODE_0,
+	},
+};
+#endif
+
+static void __init elite_init(void)
+{
+	int rc;
+	u32 hw_ver_id = 0;
+	struct kobject *properties_kobj;
+
+	if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
+		pr_err("meminfo_init() failed!\n");
+
+	htc_add_ramconsole_devices();
+	platform_device_register(&msm_gpio_device);
+
+	msm_tsens_early_init(&msm_tsens_pdata);
+	msm_thermal_init(&msm_thermal_pdata);
+	BUG_ON(msm_rpm_init(&msm8960_rpm_data));
+	BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
+
+	regulator_suppress_info_printing();
+	if (msm_xo_init())
+		pr_err("Failed to initialize XO votes\n");
+	platform_device_register(&elite_device_rpm_regulator);
+	msm_clock_init(&msm8960_clock_init_data);
+	msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
+	android_usb_pdata.swfi_latency = msm_rpmrs_levels[0].latency_us;
+	elite_gpiomux_init();
+	msm8960_device_qup_spi_gsbi10.dev.platform_data =
+		&msm8960_qup_spi_gsbi10_pdata;
+#ifdef CONFIG_RAWCHIP
+	spi_register_board_info(rawchip_spi_board_info,
+			ARRAY_SIZE(rawchip_spi_board_info));
+#endif
+	elite_init_pmic();
+	msm8960_i2c_init();
+	msm8960_gfx_init();
+	if (cpu_is_msm8960ab())
+		msm8960ab_update_krait_spm();
+	if (cpu_is_krait_v3()) {
+		msm_pm_set_tz_retention_flag(0);
+		msm8960ab_update_retention_spm();
+	} else {
+		msm_pm_set_tz_retention_flag(1);
+	}
+	msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
+	msm_spm_l2_init(msm_spm_l2_data);
+	msm8960_init_buses();
+
+	elite_cable_detect_register();
+
+#ifdef CONFIG_BT
+	bt_export_bd_address();
+#endif
+#ifdef CONFIG_HTC_BATT_8960
+	htc_battery_cell_init(htc_battery_cells, ARRAY_SIZE(htc_battery_cells));
+#endif /* CONFIG_HTC_BATT_8960 */
+
+	platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
+	platform_device_register(&msm8960_device_ext_l2_vreg);
+
+	platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
+
+	msm_uart_gsbi_gpio_init();
+	elite_pm8921_gpio_mpp_init();
+	msm_region_id_gpio_init();
+	platform_add_devices(elite_devices, ARRAY_SIZE(elite_devices));
+	elite_init_camera();
+	elite_init_mmc();
+	register_i2c_devices();
+	elite_init_fb();
+	slim_register_board_info(msm_slim_devices,
+			ARRAY_SIZE(msm_slim_devices));
+	BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
+
+//	msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
+
+	/*usb driver won't be loaded in MFG 58 station and gift mode*/
+	if (!(board_mfg_mode() == 6 || board_mfg_mode() == 7))
+		elite_add_usb_devices();
+
+	properties_kobj = kobject_create_and_add("board_properties", NULL);
+	if (properties_kobj) {
+		if (system_rev < 1)
+			rc = sysfs_create_group(properties_kobj, &properties_attr_group);
+		else
+			rc = sysfs_create_group(properties_kobj, &three_virtual_key_properties_attr_group);
+	}
+
+#ifdef CONFIG_PERFLOCK
+	perflock_init(&elite_perflock_data);
+	cpufreq_ceiling_init(&elite_cpufreq_ceiling_data);
+#endif
+
+	elite_init_keypad();
+	hw_ver_id = readl(HW_VER_ID_VIRT);
+	printk(KERN_INFO "hw_ver_id = %x\n", hw_ver_id);
+}
+
+#define PHY_BASE_ADDR1  0x80400000
+#define SIZE_ADDR1      (132 * 1024 * 1024)
+
+#define PHY_BASE_ADDR2  0x90000000
+#define SIZE_ADDR2      (768 * 1024 * 1024)
+
+static void __init elite_fixup(struct tag *tags,
+				 char **cmdline, struct meminfo *mi)
+{
+	engineerid = parse_tag_engineerid(tags);
+	mi->nr_banks = 2;
+	mi->bank[0].start = PHY_BASE_ADDR1;
+	mi->bank[0].size = SIZE_ADDR1;
+	mi->bank[1].start = PHY_BASE_ADDR2;
+	mi->bank[1].size = SIZE_ADDR2;
+
+	skuid = parse_tag_skuid((const struct tag *)tags);
+	printk(KERN_INFO "Elite_fixup:skuid=0x%x\n", skuid);
+}
+
+static int __init pm8921_late_init(void)
+{
+	return 0;
+}
+
+late_initcall(pm8921_late_init);
+
+MACHINE_START(ELITE, "elite")
+	.fixup = elite_fixup,
+	.map_io = elite_map_io,
+	.reserve = elite_reserve,
+	.init_irq = elite_init_irq,
+	.handle_irq = gic_handle_irq,
+	.timer = &msm_timer,
+	.init_machine = elite_init,
+	.init_early = msm8960_allocate_memory_regions,
+	.init_very_early = elite_early_memory,
+	.restart = msm_restart,
+MACHINE_END
diff --git a/arch/arm/mach-msm/htc/elite/board-elite.h b/arch/arm/mach-msm/htc/elite/board-elite.h
new file mode 100644
index 0000000..a535978
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/board-elite.h
@@ -0,0 +1,325 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ARCH_ARM_MACH_MSM_BOARD_ELITE_H
+#define __ARCH_ARM_MACH_MSM_BOARD_ELITE_H
+
+#include <mach/irqs.h>
+#include <mach/rpm-regulator.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <mach/msm_memtypes.h>
+#ifdef CONFIG_MSM_RTB
+#include <mach/msm_rtb.h>
+#endif
+#ifdef CONFIG_MSM_CACHE_DUMP
+#include <mach/msm_cache_dump.h>
+#endif
+
+
+/* Macros assume PMIC GPIOs and MPPs start at 1 */
+#define PM8921_GPIO_BASE		NR_GPIO_IRQS
+#define PM8921_GPIO_PM_TO_SYS(pm_gpio)	(pm_gpio - 1 + PM8921_GPIO_BASE)
+#define PM8921_MPP_BASE			(PM8921_GPIO_BASE + PM8921_NR_GPIOS)
+#define PM8921_MPP_PM_TO_SYS(pm_gpio)	(pm_gpio - 1 + PM8921_MPP_BASE)
+#define PM8921_IRQ_BASE			(NR_MSM_IRQS + NR_GPIO_IRQS)
+
+#define ELITE_LAYOUTS		{ \
+		{ { 0,  1, 0}, { 1,  0,  0}, {0, 0, -1} }, \
+		{ { 0, -1, 0}, { 1,  0,  0}, {0, 0, -1} }, \
+		{ { 1,  0, 0}, { 0, -1,  0}, {0, 0, -1} }, \
+		{ {-1,  0, 0}, { 0,  0, -1}, {0, 1,  0} }  \
+					}
+
+extern struct regulator_init_data msm_saw_regulator_pdata_s5;
+extern struct regulator_init_data msm_saw_regulator_pdata_s6;
+
+extern struct rpm_regulator_platform_data elite_rpm_regulator_pdata __devinitdata;
+
+extern struct platform_device msm8960_device_ext_5v_vreg __devinitdata;
+extern struct platform_device msm8960_device_ext_l2_vreg __devinitdata;
+extern struct platform_device msm8960_device_rpm_regulator __devinitdata;
+extern struct pm8xxx_regulator_platform_data
+	msm_pm8921_regulator_pdata[] __devinitdata;
+
+extern int msm_pm8921_regulator_pdata_len __devinitdata;
+
+#define GPIO_VREG_ID_EXT_5V		0
+#define GPIO_VREG_ID_EXT_L2		1
+#define GPIO_VREG_ID_EXT_3P3V           2
+
+#define PMGPIO(x) (x)
+
+#define ELITE_GPIO_LCD_TE                      (0)
+#define ELITE_GPIO_NC_1                        (1)
+#define ELITE_GPIO_NC_2                        (2)
+#define ELITE_GPIO_HAPTIC_EN                   (3)
+#define ELITE_GPIO_CAM_MCLK1                   (4)
+#define ELITE_GPIO_CAM_MCLK0                   (5)
+#define ELITE_GPIO_NFC_DL_MODE                 (6)
+#define ELITE_GPIO_NC_6                        (6)
+#define ELITE_GPIO_TP_ATTz                     (7)
+#define ELITE_GPIO_TP_RSTz                     (8)
+#define ELITE_GPIO_CAM_PWDN                    (9)
+#define ELITE_GPIO_RAFT_UP_EN_CPU              (10)
+#define ELITE_GPIO_NC_10                       (10)
+#define ELITE_GPIO_RESOUTz_CONTROL             (11)
+#define ELITE_GPIO_VP_I2C_DAT                  (12)
+#define ELITE_GPIO_VP_I2C_CLK                  (13)
+#define ELITE_GPIO_CHG_INT                     (14)
+#define ELITE_GPIO_AUD_1WIRE_DO                (14)
+#define ELITE_GPIO_NC_14                       (14)
+#define ELITE_GPIO_COVER_DETz                  (15)
+#define ELITE_GPIO_AUD_1WIRE_DI                (15)
+#define ELITE_GPIO_NC_15                       (15)
+#define ELITE_GPIO_TP_I2C_DAT                  (16)
+#define ELITE_GPIO_TP_I2C_CLK                  (17)
+#define ELITE_GPIO_V_HSMIC_2v85_EN             (18)
+#define ELITE_GPIO_NC_18                       (18)
+#define ELITE_GPIO_USB_ID1                     (19)
+#define ELITE_GPIO_CAM_I2C_DAT                 (20)
+#define ELITE_GPIO_CAM_I2C_CLK                 (21)
+#define ELITE_GPIO_NC_22                       (22)
+#define ELITE_GPIO_NC_23                       (23)
+#define ELITE_GPIO_NFC_I2C_SDA                 (24)
+#define ELITE_GPIO_NC_24                       (24)
+#define ELITE_GPIO_NFC_I2C_SCL                 (25)
+#define ELITE_GPIO_NC_25                       (25)
+#define ELITE_GPIO_FM_SSBI                     (26)
+#define ELITE_GPIO_FM_DATA                     (27)
+#define ELITE_GPIO_BT_STROBE                   (28)
+#define ELITE_GPIO_BT_DATA                     (29)
+#define ELITE_GPIO_UIM1_DATA_MSM               (30)
+#define ELITE_GPIO_UIM1_CLK_MSM                (31)
+#define ELITE_GPIO_TORCH_FLASHz                (32)
+#define ELITE_GPIO_DRIVER_EN                   (33)
+#define ELITE_GPIO_DEBUG_UART_TX               (34)
+#define ELITE_GPIO_DEBUG_UART_RX               (35)
+#define ELITE_GPIO_MHL_I2C_DAT                 (36)
+#define ELITE_GPIO_MC_I2C_DAT                  (36)
+#define ELITE_GPIO_NC_36                       (36)
+#define ELITE_GPIO_MHL_I2C_CLK                 (37)
+#define ELITE_GPIO_MC_I2C_CLK                  (37)
+#define ELITE_GPIO_NC_37                       (37)
+#define ELITE_GPIO_MSM_SPI_DO                  (38)
+#define ELITE_GPIO_NC_39                       (39)
+#define ELITE_GPIO_MSM_SPI_CS0                 (40)
+#define ELITE_GPIO_MSM_SPI_CLK                 (41)
+#define ELITE_GPIO_VOL_UPz                     (42)
+#define ELITE_GPIO_VOL_DOWNz                   (43)
+#define ELITE_GPIO_SR_I2C_DAT                  (44)
+#define ELITE_GPIO_SR_I2C_CLK                  (45)
+#define ELITE_GPIO_PWR_KEYz                    (46)
+#define ELITE_GPIO_MAIN_CAM_ID                 (47)
+#define ELITE_GPIO_LCD_RSTz                    (48)
+#define ELITE_GPIO_CAM_VCM_PD                  (49)
+#define ELITE_GPIO_NFC_VEN                     (50)
+#define ELITE_GPIO_NC_50                       (50)
+#define ELITE_GPIO_RAW_RSTN                    (51)
+#define ELITE_GPIO_RAW_INTR0                   (52)
+#define ELITE_GPIO_SEC_CAM_ID                  (53)
+#define ELITE_GPIO_NC_53                       (53)
+#define ELITE_GPIO_REGION_ID                   (54)
+#define ELITE_GPIO_NC_55                       (55)
+#define ELITE_GPIO_NC_56                       (56)
+#define ELITE_GPIO_V_3G_PA0_EN                 (57)
+#define ELITE_GPIO_RAW_INTR1                   (58)
+#define ELITE_GPIO_AUD_WCD_MCLK                (59)
+#define ELITE_GPIO_AUD_WCD_SB_CLK              (60)
+#define ELITE_GPIO_AUD_WCD_SB_DATA             (61)
+#define ELITE_GPIO_AUD_WCD_INTR_OUT            (62)
+#define ELITE_GPIO_NC_63                       (63)
+#define ELITE_GPIO_NC_64                       (64)
+#define ELITE_GPIO_NC_65                       (65)
+#define ELITE_GPIO_NC_66                       (66)
+#define ELITE_GPIO_MHL_USB_SELz_XB             (66)
+#define ELITE_GPIO_GSENSOR_INT                 (67)
+#define ELITE_GPIO_CAM2_RSTz                   (68)
+#define ELITE_GPIO_GYRO_INT                    (69)
+#define ELITE_GPIO_NC_69                       (69)
+#define ELITE_GPIO_COMPASS_INT                 (70)
+#define ELITE_GPIO_MCAM_SPI_DO                 (71)
+#define ELITE_GPIO_MCAM_SPI_DI                 (72)
+#define ELITE_GPIO_MCAM_SPI_CS0                (73)
+#define ELITE_GPIO_MCAM_SPI_CLK                (74)
+#define ELITE_GPIO_NC_75                       (75)
+#define ELITE_GPIO_CAM2_STANDBY                (76)
+#define ELITE_GPIO_OTG_EN                      (77)
+#define ELITE_GPIO_NC_77                       (77)
+#define ELITE_GPIO_MHL_INT                     (78)
+#define ELITE_GPIO_NC_78                       (78)
+#define ELITE_GPIO_V_RAW_1V8_EN                (79)
+#define ELITE_GPIO_MHL_RSTz                    (80)
+#define ELITE_GPIO_NC_80                       (80)
+#define ELITE_GPIO_V_TP_3V3_EN                 (81)
+#define ELITE_GPIO_MHL_USB_SELz                (82)
+#define ELITE_GPIO_NC_82                       (82)
+#define ELITE_GPIO_WCN_BT_SSBI                 (83)
+#define ELITE_GPIO_WCN_CMD_DATA2               (84)
+#define ELITE_GPIO_WCN_CMD_DATA1               (85)
+#define ELITE_GPIO_WCN_CMD_DATA0               (86)
+#define ELITE_GPIO_WCN_CMD_SET                 (87)
+#define ELITE_GPIO_WCN_CMD_CLK                 (88)
+#define ELITE_GPIO_MHL_USB_ENz                 (89)
+#define ELITE_GPIO_NC_89                       (89)
+#define ELITE_GPIO_AUD_A1028_WAKE              (90)
+#define ELITE_GPIO_AUD_A1028_RSTz              (91)
+#define ELITE_GPIO_AUD_A1028_INT               (92)
+#define ELITE_GPIO_V_LCMIO_1V8_EN              (93)
+#define ELITE_GPIO_MBAT_IN                     (94)
+#define ELITE_GPIO_V_CAM_D1V2_EN               (95)
+#define ELITE_GPIO_NC_95                       (95)
+#define ELITE_GPIO_V_BOOST_5V_EN               (96)
+#define ELITE_GPIO_NC_97                       (97)
+#define ELITE_GPIO_RIVA_TX                     (98)
+#define ELITE_GPIO_NC_99                       (99)
+#define ELITE_GPIO_HDMI_DDC_CLK                (100)
+#define ELITE_GPIO_NC_100                      (100)
+#define ELITE_GPIO_HDMI_DDC_DATA               (101)
+#define ELITE_GPIO_NC_101                      (101)
+#define ELITE_GPIO_HDMI_HPD                    (102)
+#define ELITE_GPIO_NC_102                      (102)
+#define ELITE_GPIO_PM_SEC_INTz                 (103)
+#define ELITE_GPIO_PM_USR_INTz                 (104)
+#define ELITE_GPIO_PM_MDM_INTz                 (105)
+#define ELITE_GPIO_NFC_IRQ                     (106)
+#define ELITE_GPIO_NC_106                      (106)
+#define ELITE_GPIO_NC_107                      (107)
+#define ELITE_GPIO_PS_HOLD                     (108)
+#define ELITE_GPIO_NC_109                      (109)
+#define ELITE_GPIO_NC_110                      (110)
+#define ELITE_GPIO_PRX_LB_SW_SEL               (111)
+#define ELITE_GPIO_BOOT_COINIG_6               (112)
+#define ELITE_GPIO_NC_103                      (113)
+#define ELITE_GPIO_DRX_MODE_SELB               (114)
+#define ELITE_GPIO_DRX_MODE_SELA               (115)
+#define ELITE_GPIO_ANT_SW_SEL3                 (116)
+#define ELITE_GPIO_ANT_SW_SEL2                 (117)
+#define ELITE_GPIO_ANT_SW_SEL1                 (118)
+#define ELITE_GPIO_ANT_SW_SEL0                 (119)
+#define ELITE_GPIO_NC_120                      (120)
+#define ELITE_GPIO_NC_121                      (121)
+#define ELITE_GPIO_PA0_R0                      (122)
+#define ELITE_GPIO_PA0_R1                      (123)
+#define ELITE_GPIO_NC_124                      (124)
+#define ELITE_GPIO_RTR0_RF_ON                  (125)
+#define ELITE_GPIO_RTR_RX_ON                   (126)
+#define ELITE_GPIO_TX_AGC_ADJ_CPU              (127)
+#define ELITE_GPIO_PA_ON8_U900                 (128)
+#define ELITE_GPIO_PA_ON7_U700                 (129)
+#define ELITE_GPIO_PA_ON6_AWS                  (130)
+#define ELITE_GPIO_NC_131                      (131)
+#define ELITE_GPIO_PA_ON4_MODE                 (132)
+#define ELITE_GPIO_NC_133                      (133)
+#define ELITE_GPIO_NC_134                      (134)
+#define ELITE_GPIO_PA_ON1_GSMHB                (135)
+#define ELITE_GPIO_PA_ON0_GSMLB                (136)
+#define ELITE_GPIO_EXT_GPS_LNA_EN              (137)
+#define ELITE_GPIO_NC_138                      (138)
+#define ELITE_GPIO_NC_139                      (139)
+#define ELITE_GPIO_NC_140                      (140)
+#define ELITE_GPIO_NC_141                      (141)
+#define ELITE_GPIO_RTR0_SSBI2                  (142)
+#define ELITE_GPIO_RTR0_SSBI1                  (143)
+#define ELITE_GPIO_RTR0_GP_CLK                 (144)
+#define ELITE_GPIO_RTR0_GPRSSYNC               (145)
+#define ELITE_GPIO_RTR0_GPDATA2                (146)
+#define ELITE_GPIO_RTR0_GPDATA1                (147)
+#define ELITE_GPIO_RTR0_GPDATA0                (148)
+#define ELITE_GPIO_NC_149                      (149)
+#define ELITE_GPIO_NC_150                      (150)
+#define ELITE_GPIO_NC_151                      (151)
+
+#define ELITE_PMGPIO_NC_1                      PMGPIO(1)
+#define ELITE_PMGPIO_AUD_CRADLE_EN             PMGPIO(1)
+#define ELITE_PMGPIO_LED_3V3_EN                PMGPIO(1)
+#define ELITE_PMGPIO_NC_2                      PMGPIO(2)
+#define ELITE_PMGPIO_HAPTIC_3V3_EN             PMGPIO(2)
+#define ELITE_PMGPIO_AUD_STEREO_REC            PMGPIO(3)
+#define ELITE_PMGPIO_NC_4                      PMGPIO(4)
+#define ELITE_PMGPIO_USB_ID_ADC_PMIC           PMGPIO(4)
+#define ELITE_PMGPIO_PM_SPI_CS0                PMGPIO(5)
+#define ELITE_PMGPIO_RAFT_uP_SPI_CS0           PMGPIO(6)
+#define ELITE_PMGPIO_AUD_REMO_PRESz            PMGPIO(7)
+#define ELITE_PMGPIO_NC_8                      PMGPIO(8)
+#define ELITE_PMGPIO_AUD_1WIRE_DO              PMGPIO(9)
+#define ELITE_PMGPIO_NC_9                      PMGPIO(9)
+#define ELITE_PMGPIO_RAFT_UP_RSTz              PMGPIO(10)
+#define ELITE_PMGPIO_AUD_1WIRE_O               PMGPIO(10)
+#define ELITE_PMGPIO_NC_10                     PMGPIO(10)
+#define ELITE_PMGPIO_PM_SPI_CLK                PMGPIO(11)
+#define ELITE_PMGPIO_RAFT_uP_SPI_CLK           PMGPIO(12)
+#define ELITE_PMGPIO_PM_SPI_DO                 PMGPIO(13)
+#define ELITE_PMGPIO_RAFT_uP_SPI_DO            PMGPIO(14)
+#define ELITE_PMGPIO_PM_RAFT_UP_EN_CPU         PMGPIO(15)
+#define ELITE_PMGPIO_AUD_REMO_PRES             PMGPIO(15)
+#define ELITE_PMGPIO_NC_15                     PMGPIO(15)
+#define ELITE_PMGPIO_RAFT_UP_EN                PMGPIO(16)
+#define ELITE_PMGPIO_AUD_1WIRE_DI              PMGPIO(16)
+#define ELITE_PMGPIO_NC_16                     PMGPIO(16)
+#define ELITE_PMGPIO_PROXIMITY_INTz            PMGPIO(17)
+#define ELITE_PMGPIO_AUD_SPK_EN                PMGPIO(18)
+#define ELITE_PMGPIO_AUD_HAC_SD                PMGPIO(19)
+#define ELITE_PMGPIO_NC_19                     PMGPIO(19)
+#define ELITE_PMGPIO_EARPHONE_DETz             PMGPIO(20)
+#define ELITE_PMGPIO_CHG_STAT                  PMGPIO(21)
+#define ELITE_PMGPIO_NC_21                     PMGPIO(21)
+#define ELITE_PMGPIO_NC_22                     PMGPIO(22)
+#define ELITE_PMGPIO_NC_23                     PMGPIO(23)
+#define ELITE_PMGPIO_SDC3_CDz                  PMGPIO(23)
+#define ELITE_PMGPIO_GREEN_LED                 PMGPIO(24)
+#define ELITE_PMGPIO_NC_24                     PMGPIO(24)
+#define ELITE_PMGPIO_AMBER_LED                 PMGPIO(25)
+#define ELITE_PMGPIO_NC_25                     PMGPIO(25)
+#define ELITE_PMGPIO_HAPTIC_PWM                PMGPIO(26)
+#define ELITE_PMGPIO_UIM1_RST                  PMGPIO(27)
+#define ELITE_PMGPIO_NC_28                     PMGPIO(28)
+#define ELITE_PMGPIO_UIM1_CLK_MSM              PMGPIO(29)
+#define ELITE_PMGPIO_UIM_CLK                   PMGPIO(30)
+#define ELITE_PMGPIO_NC_31                     PMGPIO(31)
+#define ELITE_PMGPIO_NC_32                     PMGPIO(32)
+#define ELITE_PMGPIO_LCD_ID0                   PMGPIO(33)
+#define ELITE_PMGPIO_AUD_CODEC_RSTz            PMGPIO(34)
+#define ELITE_PMGPIO_LCD_ID1                   PMGPIO(35)
+#define ELITE_PMGPIO_NC_36                     PMGPIO(36)
+#define ELITE_PMGPIO_NC_37                     PMGPIO(37)
+#define ELITE_PMGPIO_NC_38                     PMGPIO(38)
+#define ELITE_PMGPIO_SSBI_PMIC_FWD_CLK         PMGPIO(39)
+#define ELITE_PMGPIO_NC_40                     PMGPIO(40)
+#define ELITE_PMGPIO_NC_41                     PMGPIO(41)
+#define ELITE_PMGPIO_NC_42                     PMGPIO(42)
+#define ELITE_PMGPIO_V_RAW_1V2_EN              PMGPIO(43)
+#define ELITE_PMGPIO_NC_44                     PMGPIO(44)
+
+void elite_lcd_id_power(int pull);
+
+extern struct msm_camera_board_info elite_camera_board_info;
+
+void __init elite_init_camera(void);
+void elite_init_fb(void);
+void __init elite_init_pmic(void);
+void elite_init_mmc(void);
+int __init elite_gpiomux_init(void);
+void __init msm8960_allocate_fb_region(void);
+void __init elite_pm8921_gpio_mpp_init(void);
+void msm8960_mdp_writeback(struct memtype_reserve *reserve_table);
+int __init elite_init_keypad(void);
+
+#ifdef CONFIG_MSM_CACHE_DUMP
+extern struct msm_cache_dump_platform_data msm8960_cache_dump_pdata;
+#endif
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+int hdmi_enable_5v(int on);
+void hdmi_hpd_feature(int on);
+#endif
+
+#endif
diff --git a/arch/arm/mach-msm/htc/elite/display/Makefile b/arch/arm/mach-msm/htc/elite/display/Makefile
new file mode 100644
index 0000000..ef11fb1
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/display/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_MACH_ELITE) += mipi_elite.o mipi_elite_720p_pt.o board-elite-panel.o
\ No newline at end of file
diff --git a/arch/arm/mach-msm/htc/elite/display/board-elite-panel.c b/arch/arm/mach-msm/htc/elite/display/board-elite-panel.c
new file mode 100644
index 0000000..b43ba57
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/display/board-elite-panel.c
@@ -0,0 +1,660 @@
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include "../../../../drivers/video/msm/msm_fb.h"
+#include "../../../../drivers/video/msm/mipi_dsi.h"
+#include "../../../../drivers/video/msm/mdp.h"
+#include "../../../../drivers/video/msm/mdp4.h"
+#include "../../../../drivers/video/msm/msm_fb_panel.h"
+#include <linux/gpio.h>
+#include <mach/gpio.h>
+#include <mach/panel_id.h>
+#include <mach/msm_memtypes.h>
+#include <linux/bootmem.h>
+#include <video/msm_hdmi_modes.h>
+
+#include "../devices.h"
+#include "../board-elite.h"
+
+#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
+#define MSM_FB_PRIM_BUF_SIZE (1280 * 736 * 4 * 3) /* 4 bpp x 3 pages */
+#else
+#define MSM_FB_PRIM_BUF_SIZE (1280 * 736 * 4 * 2) /* 4 bpp x 2 pages */
+#endif
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
+#elif defined(CONFIG_FB_MSM_TVOUT)
+#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
+#else
+#define MSM_FB_EXT_BUF_SIZE 0
+#endif
+
+/* Note: must be multiple of 4096 */
+#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE, 4096)
+
+#ifdef CONFIG_FB_MSM_OVERLAY0_WRITEBACK
+#define MSM_FB_OVERLAY0_WRITEBACK_SIZE roundup((1280 * 736 * 3 * 2), 4096)
+#else
+#define MSM_FB_OVERLAY0_WRITEBACK_SIZE (0)
+#endif  /* CONFIG_FB_MSM_OVERLAY0_WRITEBACK */
+
+#ifdef CONFIG_FB_MSM_OVERLAY1_WRITEBACK
+#define MSM_FB_OVERLAY1_WRITEBACK_SIZE roundup((1920 * 1088 * 3 * 2), 4096)
+#else
+#define MSM_FB_OVERLAY1_WRITEBACK_SIZE (0)
+#endif  /* CONFIG_FB_MSM_OVERLAY1_WRITEBACK */
+
+static struct resource msm_fb_resources[] = {
+	{
+		.flags = IORESOURCE_DMA,
+	}
+};
+
+static struct msm_fb_platform_data msm_fb_pdata = {
+};
+
+static struct platform_device msm_fb_device = {
+	.name   = "msm_fb",
+	.id     = 0,
+	.num_resources     = ARRAY_SIZE(msm_fb_resources),
+	.resource          = msm_fb_resources,
+	.dev.platform_data = &msm_fb_pdata,
+};
+
+uint32_t cfg_panel_te_active[] = {
+	GPIO_CFG(ELITE_GPIO_LCD_TE, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA)
+};
+
+uint32_t cfg_panel_te_sleep[] = {
+	GPIO_CFG(ELITE_GPIO_LCD_TE, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA)
+};
+
+int elite_panel_first_init = 1;
+static bool dsi_power_on;
+
+static int mipi_dsi_panel_power(int on)
+{
+	static struct regulator *v_lcmio, *v_lcm, *v_dsivdd;
+	static bool bPanelPowerOn = false;
+	int rc;
+
+	char *lcm_str = "8921_l11";
+	char *lcmio_str = "8921_lvs5";
+	char *dsivdd_str = "8921_l2";
+
+	if (panel_type == PANEL_ID_NONE)
+		return -ENODEV;
+
+	printk(KERN_INFO "%s: state : %d\n", __func__, on);
+
+	if (!dsi_power_on) {
+
+		v_lcm = regulator_get(&msm_mipi_dsi1_device.dev,
+				lcm_str);
+		if (IS_ERR(v_lcm)) {
+			printk(KERN_ERR "could not get %s, rc = %ld\n",
+					lcm_str, PTR_ERR(v_lcm));
+			return -ENODEV;
+		}
+
+		v_dsivdd = regulator_get(&msm_mipi_dsi1_device.dev,
+				dsivdd_str);
+		if (IS_ERR(v_dsivdd)) {
+			printk(KERN_ERR "could not get %s, rc = %ld\n", dsivdd_str, PTR_ERR(v_dsivdd));
+			return -ENODEV;
+		}
+
+		if (system_rev == 0) { /*for XA*/
+			rc = gpio_request(ELITE_GPIO_V_LCMIO_1V8_EN, "LCMIO_1V8_EN");
+			if (rc) {
+				printk(KERN_ERR "%s:ELITE_GPIO_V_LCMIO_1V8_EN gpio %d request failed, rc=%d\n", __func__, ELITE_GPIO_V_LCMIO_1V8_EN, rc);
+				return -ENODEV;
+			}
+			gpio_direction_output(ELITE_GPIO_V_LCMIO_1V8_EN, 0);
+			/*gpio_free(ELITE_GPIO_V_LCMIO_1V8_EN);*/
+		} else {
+			v_lcmio = regulator_get(&msm_mipi_dsi1_device.dev,
+					lcmio_str);
+			if (IS_ERR(v_lcmio)) {
+				printk(KERN_ERR "could not get %s, rc = %ld\n",
+						lcmio_str, PTR_ERR(v_lcmio));
+				return -ENODEV;
+			}
+		}
+
+		if (panel_type == PANEL_ID_ELITE_SHARP_HX)
+			rc = regulator_set_voltage(v_lcm, 3200000, 3200000);
+		else
+			rc = regulator_set_voltage(v_lcm, 3000000, 3000000);
+		if (rc) {
+			printk(KERN_ERR "%s#%d: set_voltage %s failed, rc=%d\n", __func__, __LINE__, lcm_str, rc);
+			return -EINVAL;
+		}
+
+		rc = regulator_set_voltage(v_dsivdd, 1200000, 1200000);
+		if (rc) {
+			printk(KERN_ERR "%s#%d: set_voltage %s failed, rc=%d\n", __func__, __LINE__, dsivdd_str, rc);
+			return -EINVAL;
+		}
+
+		rc = gpio_request(ELITE_GPIO_LCD_RSTz, "LCM_RST_N");
+		if (rc) {
+			printk(KERN_ERR "%s:LCM gpio %d request failed, rc=%d\n", __func__,  ELITE_GPIO_LCD_RSTz, rc);
+			return -EINVAL;
+		}
+
+		dsi_power_on = true;
+	}
+
+	if (on) {
+		printk(KERN_INFO "%s: on\n", __func__);
+		rc = regulator_set_optimum_mode(v_lcm, 100000);
+		if (rc < 0) {
+			printk(KERN_ERR "set_optimum_mode %s failed, rc=%d\n", lcm_str, rc);
+			return -EINVAL;
+		}
+
+		rc = regulator_set_optimum_mode(v_dsivdd, 100000);
+		if (rc < 0) {
+			printk(KERN_ERR "set_optimum_mode %s failed, rc=%d\n", dsivdd_str, rc);
+			return -EINVAL;
+		}
+
+		rc = regulator_enable(v_dsivdd);
+		if (rc) {
+			printk(KERN_ERR "enable regulator %s failed, rc=%d\n", dsivdd_str, rc);
+			return -ENODEV;
+		}
+
+		if (system_rev == 0) { /*for XA*/
+			gpio_set_value(ELITE_GPIO_V_LCMIO_1V8_EN, 1);
+		} else {
+			rc = regulator_enable(v_lcmio);
+			if (rc) {
+				printk(KERN_ERR "enable regulator %s failed, rc=%d\n", lcmio_str, rc);
+				return -ENODEV;
+			}
+		}
+
+		rc = regulator_enable(v_lcm);
+		if (rc) {
+			printk(KERN_ERR "enable regulator %s failed, rc=%d\n", lcm_str, rc);
+			return -ENODEV;
+		}
+
+		elite_lcd_id_power(PM_GPIO_PULL_NO);
+
+		rc = gpio_tlmm_config(cfg_panel_te_active[0], GPIO_CFG_ENABLE);
+		if (rc) {
+			pr_err("%s: gpio_tlmm_config(%#x)=%d\n", __func__,
+					cfg_panel_te_active[0], rc);
+		}
+
+		if (panel_type != PANEL_ID_ELITE_SHARP_HX) {
+			if (!elite_panel_first_init) {
+				msleep(20);
+				gpio_set_value(ELITE_GPIO_LCD_RSTz, 1);
+				msleep(1);
+			}
+		} else {
+			if (!elite_panel_first_init) {
+				msleep(20);
+				gpio_set_value(ELITE_GPIO_LCD_RSTz, 1);
+				msleep(1);
+				gpio_set_value(ELITE_GPIO_LCD_RSTz, 0);
+				msleep(1);
+				gpio_set_value(ELITE_GPIO_LCD_RSTz, 1);
+			}
+			msleep(20);
+		}
+
+		bPanelPowerOn = true;
+
+	} else {
+		printk(KERN_INFO "%s: off\n", __func__);
+		if (!bPanelPowerOn) return 0;
+
+		elite_lcd_id_power(PM_GPIO_PULL_DN);
+
+		rc = gpio_tlmm_config(cfg_panel_te_sleep[0], GPIO_CFG_ENABLE);
+		if (rc) {
+			pr_err("%s: gpio_tlmm_config(%#x)=%d\n", __func__,
+					cfg_panel_te_sleep[0], rc);
+		}
+
+		gpio_set_value(ELITE_GPIO_LCD_RSTz, 0);
+		msleep(10);
+
+		if (regulator_disable(v_lcm)) {
+			printk(KERN_ERR "%s: Unable to disable the regulator: %s\n", __func__, lcm_str);
+			return -EINVAL;
+		}
+
+		if (system_rev == 0) { /*for XA*/
+			gpio_set_value(ELITE_GPIO_V_LCMIO_1V8_EN, 0);
+		} else {
+			if (regulator_disable(v_lcmio)) {
+				printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, lcmio_str);
+				return -EINVAL;
+			}
+		}
+
+		if (regulator_disable(v_dsivdd)) {
+			printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, dsivdd_str);
+			return -EINVAL;
+		}
+
+		rc = regulator_set_optimum_mode(v_dsivdd, 100);
+		if (rc < 0) {
+			printk(KERN_ERR "%s: Unable to disable the regulator: %s\n", __func__, dsivdd_str);
+			return -EINVAL;
+		}
+
+		bPanelPowerOn = false;
+	}
+	return 0;
+}
+
+static struct mipi_dsi_platform_data mipi_dsi_pdata = {
+	.vsync_gpio = ELITE_GPIO_LCD_TE,
+	.dsi_power_save = mipi_dsi_panel_power,
+};
+
+static struct platform_device mipi_dsi_elite_panel_device = {
+	.name = "mipi_elite",
+	.id = 0,
+};
+
+#ifdef CONFIG_MSM_BUS_SCALING
+static struct msm_bus_vectors dtv_bus_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+static struct msm_bus_vectors dtv_bus_def_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 566092800 * 2,
+		.ib = 707616000 * 2,
+	},
+};
+static struct msm_bus_paths dtv_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(dtv_bus_init_vectors),
+		dtv_bus_init_vectors,
+	},
+	{
+		ARRAY_SIZE(dtv_bus_def_vectors),
+		dtv_bus_def_vectors,
+	},
+};
+static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
+	dtv_bus_scale_usecases,
+	ARRAY_SIZE(dtv_bus_scale_usecases),
+	.name = "dtv",
+};
+
+static struct lcdc_platform_data dtv_pdata = {
+	.bus_scale_table = &dtv_bus_scale_pdata,
+};
+
+static struct msm_bus_vectors mdp_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+
+static struct msm_bus_vectors mdp_ui_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 216000000 * 2,
+		.ib = 270000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_vga_vectors[] = {
+	/* VGA and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 216000000 * 2,
+		.ib = 270000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_720p_vectors[] = {
+	/* 720p and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 230400000 * 2,
+		.ib = 288000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_1080p_vectors[] = {
+	/* 1080p and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 334080000 * 2,
+		.ib = 417600000 * 2,
+	},
+};
+
+static struct msm_bus_paths mdp_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(mdp_init_vectors),
+		mdp_init_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_ui_vectors),
+		mdp_ui_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_ui_vectors),
+		mdp_ui_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_vga_vectors),
+		mdp_vga_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_720p_vectors),
+		mdp_720p_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_1080p_vectors),
+		mdp_1080p_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
+	mdp_bus_scale_usecases,
+	ARRAY_SIZE(mdp_bus_scale_usecases),
+	.name = "mdp",
+};
+#endif
+
+int mdp_core_clk_rate_table[] = {
+	85330000,
+	85330000,
+	160000000,
+	200000000,
+};
+
+static struct msm_panel_common_pdata mdp_pdata = {
+	.gpio = ELITE_GPIO_LCD_TE,
+#ifdef CONFIG_MSM_BUS_SCALING
+	.mdp_bus_scale_table = &mdp_bus_scale_pdata,
+#endif
+	.mdp_rev = MDP_REV_42,
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+	.mem_hid = BIT(ION_CP_MM_HEAP_ID),
+#else
+	.mem_hid = MEMTYPE_EBI1,
+#endif
+	.mdp_max_clk = 200000000,
+};
+
+void __init msm8960_allocate_fb_region(void)
+{
+	void *addr;
+	unsigned long size;
+
+	size = MSM_FB_SIZE;
+	addr = alloc_bootmem_align(size, 0x1000);
+	msm_fb_resources[0].start = __pa(addr);
+	msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
+	pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
+			size, addr, __pa(addr));
+}
+
+void __init msm8960_mdp_writeback(struct memtype_reserve* reserve_table)
+{
+	mdp_pdata.ov0_wb_size = MSM_FB_OVERLAY0_WRITEBACK_SIZE;
+	mdp_pdata.ov1_wb_size = MSM_FB_OVERLAY1_WRITEBACK_SIZE;
+#if defined(CONFIG_ANDROID_PMEM) && !defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	reserve_table[mdp_pdata.mem_hid].size +=
+		mdp_pdata.ov0_wb_size;
+	reserve_table[mdp_pdata.mem_hid].size +=
+		mdp_pdata.ov1_wb_size;
+#endif
+}
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+static struct resource hdmi_msm_resources[] = {
+	{
+		.name  = "hdmi_msm_qfprom_addr",
+		.start = 0x00700000,
+		.end   = 0x007060FF,
+		.flags = IORESOURCE_MEM,
+	},
+	{
+		.name  = "hdmi_msm_hdmi_addr",
+		.start = 0x04A00000,
+		.end   = 0x04A00FFF,
+		.flags = IORESOURCE_MEM,
+	},
+	{
+		.name  = "hdmi_msm_irq",
+		.start = HDMI_IRQ,
+		.end   = HDMI_IRQ,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+static int hdmi_core_power(int on, int show);
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+static mhl_driving_params elite_driving_params[] = {
+	{
+		.format = HDMI_VFRMT_640x480p60_4_3,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_720x480p60_16_9,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_1280x720p60_16_9,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_720x576p50_16_9,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_1920x1080p24_16_9,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_1920x1080p30_16_9,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+};
+#endif
+
+static struct msm_hdmi_platform_data hdmi_msm_data = {
+	.irq = HDMI_IRQ,
+	.enable_5v = hdmi_enable_5v,
+	.core_power = hdmi_core_power,
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	.driving_params =  elite_driving_params,
+	.dirving_params_count = ARRAY_SIZE(elite_driving_params),
+#endif
+};
+
+static struct platform_device hdmi_msm_device = {
+	.name = "hdmi_msm",
+	.id = 0,
+	.num_resources = ARRAY_SIZE(hdmi_msm_resources),
+	.resource = hdmi_msm_resources,
+	.dev.platform_data = &hdmi_msm_data,
+};
+
+int hdmi_enable_5v(int on)
+{
+	static int prev_on;
+	int rc;
+
+	if (on == prev_on)
+		return 0;
+
+	if (on) {
+		rc = gpio_request(ELITE_GPIO_V_BOOST_5V_EN, "HDMI_BOOST_5V");
+		if (rc) {
+			pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
+				"HDMI_BOOST_5V", ELITE_GPIO_V_BOOST_5V_EN, rc);
+			goto error;
+		}
+		gpio_set_value(ELITE_GPIO_V_BOOST_5V_EN, 1);
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		gpio_set_value(ELITE_GPIO_V_BOOST_5V_EN, 0);
+		gpio_free(ELITE_GPIO_V_BOOST_5V_EN);
+		pr_info("%s(off): success\n", __func__);
+	}
+
+	prev_on = on;
+
+	return 0;
+error:
+	return rc;
+}
+
+static int hdmi_core_power(int on, int show)
+{
+	static struct regulator *reg_8921_l23;
+	static int prev_on;
+	int rc;
+
+	if (on == prev_on)
+		return 0;
+
+	if (!reg_8921_l23) {
+		reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
+		if (IS_ERR(reg_8921_l23)) {
+			pr_err("could not get reg_8921_l23, rc = %ld\n",
+				PTR_ERR(reg_8921_l23));
+			return -ENODEV;
+		}
+		rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
+		if (rc) {
+			pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
+			return -EINVAL;
+		}
+	}
+	if (on) {
+		rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
+		if (rc < 0) {
+			pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
+			return -EINVAL;
+		}
+		rc = regulator_enable(reg_8921_l23);
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"hdmi_avdd", rc);
+			return rc;
+		}
+
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		rc = regulator_disable(reg_8921_l23);
+		if (rc) {
+			pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
+			return -ENODEV;
+		}
+
+		rc = regulator_set_optimum_mode(reg_8921_l23, 100);
+		if (rc < 0) {
+			pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
+			return -EINVAL;
+		}
+		pr_info("%s(off): success\n", __func__);
+	}
+	prev_on = on;
+	return rc;
+}
+#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
+
+#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
+static char wfd_check_mdp_iommu_split_domain(void)
+{
+	return mdp_pdata.mdp_iommu_split_domain;
+}
+
+static struct msm_wfd_platform_data wfd_pdata = {
+	.wfd_check_mdp_iommu_split = wfd_check_mdp_iommu_split_domain,
+};
+
+static struct platform_device wfd_panel_device = {
+	.name = "wfd_panel",
+	.id = 0,
+	.dev.platform_data = NULL,
+};
+
+static struct platform_device wfd_device = {
+	.name          = "msm_wfd",
+	.id            = -1,
+	.dev.platform_data = &wfd_pdata,
+};
+#endif
+
+static void __init msm8960_set_display_params(char *prim_panel, char *ext_panel)
+{
+	if (strnlen(prim_panel, PANEL_NAME_MAX_LEN)) {
+		strlcpy(msm_fb_pdata.prim_panel_name, prim_panel,
+			PANEL_NAME_MAX_LEN);
+		pr_debug("msm_fb_pdata.prim_panel_name %s\n",
+			msm_fb_pdata.prim_panel_name);
+	}
+	if (strnlen(ext_panel, PANEL_NAME_MAX_LEN)) {
+		strlcpy(msm_fb_pdata.ext_panel_name, ext_panel,
+			PANEL_NAME_MAX_LEN);
+		pr_debug("msm_fb_pdata.ext_panel_name %s\n",
+			msm_fb_pdata.ext_panel_name);
+	}
+}
+
+void __init elite_init_fb(void)
+{
+	msm8960_set_display_params("mipi_elite", "hdmi_msm");
+	platform_device_register(&msm_fb_device);
+#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
+	platform_device_register(&wfd_panel_device);
+	platform_device_register(&wfd_device);
+#endif
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+	platform_device_register(&hdmi_msm_device);
+#endif
+	platform_device_register(&mipi_dsi_elite_panel_device);
+	msm_fb_register_device("mdp", &mdp_pdata);
+	msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
+	msm_fb_register_device("dtv", &dtv_pdata);
+}
diff --git a/arch/arm/mach-msm/htc/elite/display/mipi_elite.c b/arch/arm/mach-msm/htc/elite/display/mipi_elite.c
new file mode 100644
index 0000000..ccd1433
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/display/mipi_elite.c
@@ -0,0 +1,1737 @@
+#include <linux/gpio.h>
+#include <mach/gpio.h>
+#include <mach/panel_id.h>
+#include <mach/htc_battery_common.h>
+#include "../../../drivers/video/msm/msm_fb.h"
+#include "../../../drivers/video/msm/mipi_dsi.h"
+#include "../board-elite.h"
+#include "mipi_elite.h"
+
+
+#ifndef ELITE_USE_CMDLISTS
+static struct dsi_buf elite_tx_buf;
+static struct dsi_buf elite_rx_buf;
+#endif
+static struct msm_panel_common_pdata *mipi_elite_pdata;
+static int mipi_elite_lcd_init(void);
+static struct dcs_cmd_req cmdreq;
+static int mipi_lcd_on = 1;
+static int bl_level_prevset = 1;
+// Selected codes
+static struct dsi_cmd_desc *elite_video_on_cmds = NULL;
+int elite_video_on_cmds_count = 0;
+static struct dsi_cmd_desc *elite_display_on_cmds = NULL;
+int elite_display_on_cmds_count = 0;
+static struct dsi_cmd_desc *elite_display_off_cmds = NULL;
+int elite_display_off_cmds_count = 0;
+static struct dsi_cmd_desc *elite_cmd_backlight_cmds = NULL;
+int elite_cmd_backlight_cmds_count = 0;
+
+/* All MIPI codes .. */
+static char display_on[2] = {0x29, 0x00}; /* DTYPE_DCS_WRITE */
+
+static struct dsi_cmd_desc display_on_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 40, sizeof(display_on), display_on},
+};
+
+static char display_off[2] = {0x28, 0x00}; /* DTYPE_DCS_WRITE */
+static char enter_sleep[2] = {0x10, 0x00}; /* DTYPE_DCS_WRITE */
+
+static struct dsi_cmd_desc display_off_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 0,
+		sizeof(display_off), display_off},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10,
+		sizeof(enter_sleep), enter_sleep}
+};
+
+static char led_pwm1[2] = {0x51, 0xF0};
+
+static struct dsi_cmd_desc cmd_backlight_cmds[] = {
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(led_pwm1), led_pwm1}
+};
+
+static char set_threelane[2] = {0xBA, 0x02}; /* DTYPE_DCS_WRITE-1 */
+
+static char display_mode_video[2] = {0xC2, 0x03}; /* DTYPE_DCS_WRITE-1 */
+
+#ifdef EVA_CMD_MODE_PANEL
+static char display_mode_cmd[2] = {0xC2, 0x08}; /* DTYPE_DCS_WRITE-1 */
+#endif
+
+static char exit_sleep[2] = {0x11, 0x00}; /* DTYPE_DCS_WRITE */
+
+static char led_pwm2[2] = {0x53, 0x24};
+static char led_pwm3[2] = {0x55, 0x00};
+static char enable_te[2] = {0x35, 0x00};/* DTYPE_DCS_WRITE1 */
+static char pwm_freq[] = {0xC9, 0x0F, 0x04, 0x1E, 0x1E,
+	0x00, 0x00, 0x00, 0x10, 0x3E};/* 9.41kHz */
+static char swr01[2] = {0x01, 0x33};
+static char swr02[2] = {0x02, 0x53};
+
+static struct dsi_cmd_desc sony_panel_video_mode_cmds[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(set_threelane), set_threelane},
+#ifdef EVA_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_cmd), display_mode_cmd},
+#else
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_video), display_mode_video},
+#endif
+
+#if 1
+	/* vivi color ver 2 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x26}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x11}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x18}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x0C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x07}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+#endif
+
+#if 1
+	/* gamma 2.2 6b setting start */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr01), swr01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr02), swr02},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0xA3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xD5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0xF3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x17}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0xDC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x41}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x55}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0x6B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xC0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0xE5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0xA3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xD5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0xF3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x17}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0xDC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x41}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x55}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0x6B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xC0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEC, 0xE5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xED, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEE, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF0, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF2, 0x7F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF4, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF6, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF8, 0xBA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFA, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0xF2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x3D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x9F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0xE4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x10, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x11, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x14, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x15, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x16, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x17, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0xCC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1C, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1D, 0xEA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1E, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1F, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x20, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x3E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0x4F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2B, 0x8F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2F, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x30, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x31, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x32, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x33, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x34, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x35, 0x7F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x36, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x37, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x38, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3B, 0xBA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3F, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x40, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x41, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x42, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x43, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x44, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x45, 0xF2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x47, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x48, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x49, 0x3D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4B, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4D, 0x9F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4F, 0xE4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x50, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x51, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x52, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x54, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x56, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x58, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x59, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5A, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5C, 0xCC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0xEA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x60, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x61, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x62, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x63, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x64, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x65, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x66, 0x3E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x67, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x68, 0x4F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x69, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6C, 0x8F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6E, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x70, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x71, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x72, 0xAC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x73, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x74, 0xB2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0xD6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xEB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xF5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xFE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0x1F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0x3C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x52}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x8A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0x34}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x5B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0xAC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xB2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0xD6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xEB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xF5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xFE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0x1F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0x3C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x52}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x8A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0x34}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x5B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xFF}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x09}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	/* gamma 2.2 6b setting end */
+#endif
+
+#if 1
+#ifdef EVA_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x05}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x8E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x8E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x8E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+#endif
+#endif
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10, sizeof(exit_sleep), exit_sleep},
+
+	/* For random dot noise */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x50} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x60} },
+	//{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* Enable CABC setting */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x2D} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0xFF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0xF7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0xEF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0xE7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0xDF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0xD7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0xCF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0xC7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0xBF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0xB7} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x06}},
+
+	/* NVT: Enable vivid-color, but disable CABC, please set register(55h) as 0x80  */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x80}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC UI-Mode, please set register(55h) as 0x81 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x81}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Still-Mode, please set register(55h) as 0x82 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x82}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Moving-Mode, please set register(55h) as 0x83 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x83}},
+
+
+	/* {DTYPE_DCS_WRITE, 1, 0, 0, 150, sizeof(exit_sleep), exit_sleep},*/
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x24}},
+};
+
+static struct dsi_cmd_desc sony_panel_video_mode_cmds_id28103[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(set_threelane), set_threelane},
+#ifdef EVA_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_cmd), display_mode_cmd},
+#else
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_video), display_mode_video},
+#endif
+
+#if 1
+	/* vivi color ver 2 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x26}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x11}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x18}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x0C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x07}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+#endif
+
+#if 1
+	/* gamma 2.2 6b setting start */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr01), swr01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr02), swr02},
+
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0xA3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xD5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0xF3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x17}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0xDC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x41}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x55}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0x6B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xC0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0xE5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0xA3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xD5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0xF3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x17}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0xDC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x41}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x55}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0x6B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xC0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEC, 0xE5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xED, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEE, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF0, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF2, 0x7F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF4, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF6, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF8, 0xBA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFA, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0xF2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x3D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x9F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0xE4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x10, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x11, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x14, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x15, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x16, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x17, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0xCC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1C, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1D, 0xEA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1E, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1F, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x20, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x3E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0x4F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2B, 0x8F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2F, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x30, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x31, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x32, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x33, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x34, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x35, 0x7F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x36, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x37, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x38, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3B, 0xBA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3F, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x40, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x41, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x42, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x43, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x44, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x45, 0xF2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x47, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x48, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x49, 0x3D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4B, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4D, 0x9F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4F, 0xE4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x50, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x51, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x52, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x54, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x56, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x58, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x59, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5A, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5C, 0xCC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0xEA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x60, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x61, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x62, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x63, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x64, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x65, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x66, 0x3E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x67, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x68, 0x4F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x69, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6C, 0x8F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6E, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x70, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x71, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x72, 0xAC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x73, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x74, 0xB2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0xD6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xEB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xF5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xFE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0x1F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0x3C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x52}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x8A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0x34}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x5B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0xAC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xB2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0xD6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xEB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xF5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xFE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0x1F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0x3C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x52}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x8A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0x34}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x5B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xFF}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x09}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	/* gamma 2.2 6b setting end */
+#endif
+
+#if 1
+#ifdef EVA_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x05} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x8E} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x8E} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x8E} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+#endif
+#endif
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10, sizeof(exit_sleep), exit_sleep},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x33} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0x30} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0x34} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x00} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* For random dot noise */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x50} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x60} },
+	//{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* Enable CABC setting */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x2D} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0xFF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0xF7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0xEF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0xE7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0xDF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0xD7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0xCF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0xC7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0xBF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0xB7} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x06} },
+
+	/* NVT: Enable vivid-color, but disable CABC, please set register(55h) as 0x80  */
+	/*{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x80}},*/
+
+	/* NVT: Enable vivid-color, and enable CABC UI-Mode, please set register(55h) as 0x81 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x81}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Still-Mode, please set register(55h) as 0x82 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55, 0x82} }, */
+
+	/* NVT: Enable vivid-color, and enable CABC Moving-Mode, please set register(55h) as 0x83 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x83}},
+
+
+	/*    {DTYPE_DCS_WRITE, 1, 0, 0, 150, sizeof(exit_sleep), exit_sleep},*/
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x24} },
+};
+
+/* himax command begin */
+/* himax mipi commands */
+static char himax_max_pkt_size[2] = {0x03, 0x00};
+static char himax_password[4] = {0xB9, 0xFF, 0x83, 0x92}; /* DTYPE_DCS_LWRITE */
+
+struct dsi_cmd_desc sharp_nt_video_on_cmds_idA1B100[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(set_threelane), set_threelane},
+#ifdef EVA_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_cmd), display_mode_cmd},
+#else
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_video), display_mode_video},
+#endif
+#if 1
+	/* vivi color ver 2 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x66}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x11}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x18}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x0C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x07}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+#endif
+
+	/* gamma 2.2 6b setting start */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr01), swr01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr02), swr02},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x09}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	/* gamma 2.2 6b setting end */
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10, sizeof(exit_sleep), exit_sleep},
+
+	/* For NV1-3 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x05}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x8E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x06}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x0A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x10, 0x71}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x4D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6C, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6D, 0x00}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x37, 0x09}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x71, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x26}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x86}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x2B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x33}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0x34}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+
+	/* For random dot noise */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x50} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x60} },
+	//{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* Enable CABC setting */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x2D} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0xFF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0xF7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0xEF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0xE7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0xDF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0xD7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0xCF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0xC7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0xBF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0xB7} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x06}},
+
+	/* NVT: Enable vivid-color, but disable CABC, please set register(55h) as 0x80  */
+	/*{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x80}},*/
+
+	/* NVT: Enable vivid-color, and enable CABC UI-Mode, please set register(55h) as 0x81 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x81}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Still-Mode, please set register(55h) as 0x82 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x82}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Moving-Mode, please set register(55h) as 0x83 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x83}},
+
+
+	/* {DTYPE_DCS_WRITE, 1, 0, 0, 150, sizeof(exit_sleep), exit_sleep}, */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x24}},
+};
+
+struct dsi_cmd_desc sharp_nt_video_on_cmds_nv3[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(set_threelane), set_threelane},
+#ifdef EVA_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_cmd), display_mode_cmd},
+#else
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_video), display_mode_video},
+#endif
+#if 1
+	/* vivi color ver 2 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x66}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x11}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x18}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x0C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x07}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+#endif
+	/* gamma 2.2 6b setting start */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr01), swr01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr02), swr02},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x09}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	/* gamma 2.2 6b setting end */
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10, sizeof(exit_sleep), exit_sleep},
+
+	/* For NV3 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x33}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0x34}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x05}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x37, 0x09}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x8E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+
+	/* For random dot noise */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x50} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x60} },
+	//{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* Enable CABC setting */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x2D} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0xFF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0xF7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0xEF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0xE7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0xDF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0xD7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0xCF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0xC7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0xBF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0xB7} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x06}},
+
+	/* NVT: Enable vivid-color, but disable CABC, please set register(55h) as 0x80  */
+	/*{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x80}},*/
+
+	/* NVT: Enable vivid-color, and enable CABC UI-Mode, please set register(55h) as 0x81 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x81}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Still-Mode, please set register(55h) as 0x82 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x82}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Moving-Mode, please set register(55h) as 0x83 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x83}},
+
+	/* {DTYPE_DCS_WRITE, 1, 0, 0, 150, sizeof(exit_sleep), exit_sleep}, */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x24}},
+};
+
+struct dsi_cmd_desc sharp_nt_video_on_cmds_nv4[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(set_threelane), set_threelane},
+#ifdef EVA_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_cmd), display_mode_cmd},
+#else
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_video), display_mode_video},
+#endif
+#if 1
+	/* vivi color ver 2 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x66}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x11}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x18}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x0C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x07}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+#endif
+#if 1
+	/* gamma 2.2 6b setting start */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr01), swr01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr02), swr02},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x09}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	/* gamma 2.2 6b setting end */
+#endif
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x05} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0x01} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2F, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10, sizeof(exit_sleep), exit_sleep},
+
+	/* For random dot noise */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x50} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x60} },
+	//{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* Enable CABC setting */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x2D} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0xFF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0xF7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0xEF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0xE7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0xDF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0xD7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0xCF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0xC7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0xBF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0xB7} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x06}},
+
+	/* NVT: Enable vivid-color, but disable CABC, please set register(55h) as 0x80  */
+	/*{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x80}},*/
+
+	/* NVT: Enable vivid-color, and enable CABC UI-Mode, please set register(55h) as 0x81 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x81}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Still-Mode, please set register(55h) as 0x82 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x82}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Moving-Mode, please set register(55h) as 0x83 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x83}},
+
+	/* {DTYPE_DCS_WRITE, 1, 0, 0, 150, sizeof(exit_sleep), exit_sleep}, */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x24}},
+};
+
+struct dsi_cmd_desc himax_video_on_cmds_id311100[] = {
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 10, sizeof(himax_password), himax_password},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 1, sizeof(set_threelane), set_threelane},
+	{DTYPE_MAX_PKTSIZE, 1, 0, 0, 0, sizeof(himax_max_pkt_size), himax_max_pkt_size},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 10, sizeof(display_mode_video), display_mode_video},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 1, 13, (char[]){0xB2, 0x0F, 0xC8, 0x04, 0x0C,
+							   0x04, 0xF4, 0x00, 0xFF, 0x04,
+							   0x0C, 0x04, 0x20}},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 15, sizeof(exit_sleep), exit_sleep},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 1, sizeof(pwm_freq), pwm_freq},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 10, sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 10, sizeof(led_pwm3), led_pwm3},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 1, sizeof(enable_te), enable_te},
+};
+
+static struct dsi_cmd_desc nvt_LowTemp_wrkr_enter[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 1, 2, (char[]){0x26, 0x08}},
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}}, */
+};
+
+static struct dsi_cmd_desc nvt_LowTemp_wrkr_exit[] = {
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE}}, */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 10, 2, (char[]){0xFF, 0x00}},
+};
+
+/* himax command end */
+static char disable_dim_cmd[2] = {0x53, 0x24};/* DTYPE_DCS_WRITE1 */
+static struct dsi_cmd_desc disable_dim[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(disable_dim_cmd), disable_dim_cmd},};
+#ifdef CONFIG_FB_MSM_CABC
+static struct dsi_cmd_desc *dim_cmds = disable_dim; /* default disable dim */
+/* for cabc enable and disable seletion */
+static char cabc_off_cmd[2] = {0x55, 0x80};/* DTYPE_DCS_WRITE1 */
+static struct dsi_cmd_desc cabc_off[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(cabc_off_cmd), cabc_off_cmd},};
+static char cabc_on_ui_cmd[2] = {0x55, 0x81};/* DTYPE_DCS_WRITE1 */
+static struct dsi_cmd_desc cabc_on_ui[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(cabc_on_ui_cmd), cabc_on_ui_cmd},};
+static char cabc_on_still_cmd[2] = {0x55, 0x82};/* DTYPE_DCS_WRITE1 */
+static struct dsi_cmd_desc cabc_on_still[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(cabc_on_still_cmd), cabc_on_still_cmd},};
+static char cabc_on_moving_cmd[2] = {0x55, 0x83};/* DTYPE_DCS_WRITE1 */
+static struct dsi_cmd_desc cabc_on_moving[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(cabc_on_moving_cmd), cabc_on_moving_cmd},};
+/* for dimming enable and disable selection */
+static char enable_dim_cmd[2] = {0x53, 0x2C};/* DTYPE_DCS_WRITE1 */
+static struct dsi_cmd_desc enable_dim[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_dim_cmd), enable_dim_cmd},};
+static struct dsi_cmd_desc *cabc_cmds = cabc_off; /* default disable cabc */
+
+#endif
+
+static int elite_send_display_cmds(struct dsi_cmd_desc *cmd, int cnt)
+{
+	int ret = 0;
+#ifdef ELITE_USE_CMDLISTS
+	struct dcs_cmd_req cmdreq;
+
+	cmdreq.cmds = cmd;
+	cmdreq.cmds_cnt = cnt;
+	cmdreq.flags = CMD_REQ_COMMIT;
+	cmdreq.rlen = 0;
+	cmdreq.cb = NULL;
+
+	ret = mipi_dsi_cmdlist_put(&cmdreq);
+#else
+
+	MIPI_OUTP(MIPI_DSI_BASE + 0x38, 0x10000000);
+	ret = mipi_dsi_cmds_tx(&elite_tx_buf, cmd, cnt);
+	MIPI_OUTP(MIPI_DSI_BASE + 0x38, 0x14000000);
+#endif
+	if (ret < 0)
+		printk(KERN_ERR "[DISP] %s failed (%d)\n", __func__, ret);
+	return ret;
+}
+
+static void mipi_elite_per_panel_fcts_init(void)
+{
+	/* Common parts */
+
+	elite_display_on_cmds = display_on_cmds;
+	elite_display_on_cmds_count = ARRAY_SIZE(display_on_cmds);
+
+	elite_display_off_cmds = display_off_cmds;
+	elite_display_off_cmds_count = ARRAY_SIZE(display_off_cmds);
+
+	elite_cmd_backlight_cmds = cmd_backlight_cmds;
+	elite_cmd_backlight_cmds_count = ARRAY_SIZE(cmd_backlight_cmds);
+
+	if (panel_type == PANEL_ID_ELITE_SONY_NT
+			|| panel_type == PANEL_ID_ELITE_SONY_NT_C2) {
+		printk(KERN_INFO "%s: assign initial setting for SONY_NT*\n",
+				__func__);
+		elite_video_on_cmds = sony_panel_video_mode_cmds;
+		elite_video_on_cmds_count = ARRAY_SIZE(sony_panel_video_mode_cmds);
+	} else if (panel_type == PANEL_ID_ELITE_SONY_NT_C1) {
+		printk(KERN_INFO "%s: assign initial setting for SONY_NT id 0x28103 Cut1, %s\n",
+				__func__, "PANEL_ID_ELITE_SONY_NT_C1");
+		elite_video_on_cmds = sony_panel_video_mode_cmds_id28103;
+		elite_video_on_cmds_count = ARRAY_SIZE(sony_panel_video_mode_cmds_id28103);
+	} else if (panel_type == PANEL_ID_ELITE_SHARP_HX) {
+		printk(KERN_INFO "%s: assign initial setting for SHARP_HX, %s\n",
+				__func__, "PANEL_ID_ELITE_SHARP_HX");
+
+		elite_video_on_cmds = himax_video_on_cmds_id311100;
+		elite_video_on_cmds_count = ARRAY_SIZE(himax_video_on_cmds_id311100);
+	} else if (panel_type == PANEL_ID_ELITE_SHARP_NT) {
+		printk(KERN_INFO "%s: assign initial setting(NV1-3) for SHARP_NT id 0xA1B100, %s\n",
+				__func__, "PANEL_ID_ELITE_SHARP_NT");
+		elite_video_on_cmds = sharp_nt_video_on_cmds_idA1B100;
+		elite_video_on_cmds_count = ARRAY_SIZE(sharp_nt_video_on_cmds_idA1B100);
+	} else if (panel_type == PANEL_ID_ELITE_SHARP_NT_C1) {
+		printk(KERN_INFO "%s: assign initial setting(NV3) for SHARP_NT, %s\n",
+				__func__, "PANEL_ID_ELITE_SHARP_NT_C1");
+		elite_video_on_cmds = sharp_nt_video_on_cmds_nv3;
+		elite_video_on_cmds_count = ARRAY_SIZE(sharp_nt_video_on_cmds_nv3);
+	} else if (panel_type == PANEL_ID_ELITE_SHARP_NT_C2) {
+		printk(KERN_INFO "%s: assign initial setting(NV4) for SHARP_NT Cut2, %s\n",
+				__func__, "PANEL_ID_ELITE_SHARP_NT_C2");
+		elite_video_on_cmds = sharp_nt_video_on_cmds_nv4;
+		elite_video_on_cmds_count = ARRAY_SIZE(sharp_nt_video_on_cmds_nv4);
+	}
+}
+
+static int mipi_elite_lcd_on(struct platform_device *pdev)
+{
+	struct msm_fb_data_type *mfd;
+	struct mipi_panel_info *mipi;
+
+	mfd = platform_get_drvdata(pdev);
+	if (!mfd)
+		return -ENODEV;
+	if (mfd->key != MFD_KEY)
+		return -EINVAL;
+
+	mipi  = &mfd->panel_info.mipi;
+
+	if (panel_type != PANEL_ID_ELITE_SHARP_HX) {
+		if (!mipi_lcd_on) {
+			elite_send_display_cmds(nvt_LowTemp_wrkr_enter, ARRAY_SIZE(nvt_LowTemp_wrkr_enter));
+
+			elite_send_display_cmds(nvt_LowTemp_wrkr_exit, ARRAY_SIZE(nvt_LowTemp_wrkr_exit));
+
+			gpio_set_value(ELITE_GPIO_LCD_RSTz, 0);
+			msleep(1);
+			gpio_set_value(ELITE_GPIO_LCD_RSTz, 1);
+			msleep(20);
+		}
+	}
+	if (!mipi_lcd_on) {
+		if (panel_type != PANEL_ID_NONE) {
+			elite_send_display_cmds(elite_video_on_cmds, elite_video_on_cmds_count);
+			elite_send_display_cmds(elite_display_on_cmds, elite_display_on_cmds_count);
+			printk(KERN_INFO "%s: panel_type (%d)", __func__, panel_type);
+		} else
+			printk(KERN_INFO "%s: panel_type is not supported!(%d)", __func__, panel_type);
+	}
+
+	mipi_lcd_on = 1;
+	return 0;
+}
+
+static int mipi_elite_lcd_off(struct platform_device *pdev)
+{
+	struct msm_fb_data_type *mfd;
+
+	mfd = platform_get_drvdata(pdev);
+
+	if (!mfd)
+		return -ENODEV;
+	if (mfd->key != MFD_KEY)
+		return -EINVAL;
+
+	if (!mipi_lcd_on)
+		return 0;
+
+	if (panel_type != PANEL_ID_NONE)
+		elite_send_display_cmds(elite_display_off_cmds, elite_display_off_cmds_count);
+
+	bl_level_prevset = 0;
+	mipi_lcd_on = 0;
+
+	return 0;
+}
+
+static unsigned char elite_shrink_pwm(int val)
+{
+	unsigned char shrink_br = BRI_SETTING_MAX;
+
+	if (val <= 0) {
+		shrink_br = 0;
+	} else if (val > 0 && (val < BRI_SETTING_MIN)) {
+		shrink_br = PWM_MIN;
+	} else if ((val >= BRI_SETTING_MIN) && (val <= BRI_SETTING_DEF)) {
+		shrink_br = (val - BRI_SETTING_MIN) * (PWM_DEFAULT - PWM_MIN) /
+			(BRI_SETTING_DEF - BRI_SETTING_MIN) + PWM_MIN;
+	} else if (val > BRI_SETTING_DEF && val <= BRI_SETTING_MAX) {
+		shrink_br = (val - BRI_SETTING_DEF) * (PWM_MAX - PWM_DEFAULT) /
+			(BRI_SETTING_MAX - BRI_SETTING_DEF) + PWM_DEFAULT;
+	} else if (val > BRI_SETTING_MAX)
+		shrink_br = PWM_MAX;
+
+	printk(KERN_INFO "brightness orig=%d, transformed=%d\n", val, shrink_br);
+
+	return shrink_br;
+}
+
+inline void mipi_dsi_set_backlight(struct msm_fb_data_type *mfd, int level)
+{
+	printk(KERN_ERR "[DISP] %s level=%d\n", __func__, level);
+
+	led_pwm1[1] = elite_shrink_pwm(mfd->bl_level);
+
+	if (mfd->bl_level == 0 ||
+			board_mfg_mode() == 4 ||
+			(board_mfg_mode() == 5 && !(htc_battery_get_zcharge_mode()%2))) {
+		led_pwm1[1] = 0;
+	}
+
+	if (mfd->bl_level == 0) {
+		cmdreq.cmds = disable_dim;
+		cmdreq.cmds_cnt = ARRAY_SIZE(disable_dim);
+		cmdreq.flags = CMD_REQ_COMMIT;
+		cmdreq.rlen = 0;
+		cmdreq.cb = NULL;
+
+		mipi_dsi_cmdlist_put(&cmdreq);
+	}
+
+	cmdreq.cmds = elite_cmd_backlight_cmds;
+	cmdreq.cmds_cnt = elite_cmd_backlight_cmds_count;
+	cmdreq.flags = CMD_REQ_COMMIT;
+	cmdreq.rlen = 0;
+	cmdreq.cb = NULL;
+
+	mipi_dsi_cmdlist_put(&cmdreq);
+
+	bl_level_prevset = mfd->bl_level;
+
+	printk(KERN_DEBUG "%s+ bl_level=%d\n", __func__, mfd->bl_level);
+	return;
+}
+
+static void mipi_elite_set_backlight(struct msm_fb_data_type *mfd)
+{
+	mipi_dsi_set_backlight(mfd, mfd->bl_level);
+}
+
+static int __devinit mipi_elite_lcd_probe(struct platform_device *pdev)
+{
+	mipi_elite_per_panel_fcts_init();
+
+	if (pdev->id == 0) {
+		mipi_elite_pdata = pdev->dev.platform_data;
+		return 0;
+	}
+
+	msm_fb_add_device(pdev);
+	return 0;
+}
+
+/* HTC specific functionality */
+#ifdef CONFIG_FB_MSM_CABC
+void mipi_elite_enable_ic_cabc(int cabc, bool dim_on, struct msm_fb_data_type *mfd)
+{
+	if (dim_on)
+		dim_cmds = enable_dim;
+	if (cabc == 1)
+		cabc_cmds = cabc_on_ui;
+	else if (cabc == 2)
+		cabc_cmds = cabc_on_still;
+	else if (cabc == 3)
+		cabc_cmds = cabc_on_moving;
+
+	cmdreq.cmds = dim_cmds;
+	cmdreq.cmds_cnt = ARRAY_SIZE(enable_dim);
+	cmdreq.flags = CMD_REQ_COMMIT;
+	cmdreq.rlen = 0;
+	cmdreq.cb = NULL;
+
+	mipi_dsi_cmdlist_put(&cmdreq);
+
+	printk(KERN_INFO "%s: enable dimming and cabc\n", __func__);
+}
+#endif
+
+static struct platform_driver this_driver = {
+	.probe  = mipi_elite_lcd_probe,
+	.driver = {
+		.name   = "mipi_elite",
+	},
+};
+
+static struct msm_fb_panel_data elite_panel_data = {
+	.on = mipi_elite_lcd_on,
+	.off = mipi_elite_lcd_off,
+	.set_backlight = mipi_elite_set_backlight,
+	//  .display_on = mipi_elite_display_on,
+	//  .display_off = mipi_elite_display_off,
+#ifdef CONFIG_FB_MSM_CABC
+	.enable_cabc = mipi_elite_enable_ic_cabc,
+#endif
+};
+
+static int ch_used[3];
+
+int mipi_elite_device_register(struct msm_panel_info *pinfo,
+		u32 channel, u32 panel)
+{
+	struct platform_device *pdev = NULL;
+	int ret;
+
+	if ((channel >= 3) || ch_used[channel])
+		return -ENODEV;
+
+	ch_used[channel] = TRUE;
+
+	ret = mipi_elite_lcd_init();
+	if (ret) {
+		pr_err("mipi_elite_lcd_init() failed with ret %u\n", ret);
+		return ret;
+	}
+
+	pdev = platform_device_alloc("mipi_elite", (panel << 8)|channel);
+	if (!pdev)
+		return -ENOMEM;
+
+	elite_panel_data.panel_info = *pinfo;
+
+	ret = platform_device_add_data(pdev, &elite_panel_data,
+			sizeof(elite_panel_data));
+	if (ret) {
+		printk(KERN_ERR "%s: platform_device_add_data failed!\n", __func__);
+		goto err_device_put;
+	}
+
+	ret = platform_device_add(pdev);
+	if (ret) {
+		printk(KERN_ERR "%s: platform_device_register failed!\n", __func__);
+		goto err_device_put;
+	}
+
+	return 0;
+
+err_device_put:
+	platform_device_put(pdev);
+	return ret;
+}
+
+static int mipi_elite_lcd_init(void)
+{
+	printk(KERN_ERR  "[DISP] %s +++\n", __func__);
+#ifndef ELITE_USE_CMDLISTS
+	mipi_dsi_buf_alloc(&elite_tx_buf, DSI_BUF_SIZE);
+	mipi_dsi_buf_alloc(&elite_rx_buf, DSI_BUF_SIZE);
+#endif
+
+	printk(KERN_ERR  "[DISP] %s ---\n", __func__);
+	return platform_driver_register(&this_driver);
+}
diff --git a/arch/arm/mach-msm/htc/elite/display/mipi_elite.h b/arch/arm/mach-msm/htc/elite/display/mipi_elite.h
new file mode 100644
index 0000000..7c85d32
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/display/mipi_elite.h
@@ -0,0 +1,23 @@
+#ifndef MIPI_ELITE_H
+#define MIPI_ELITE_H
+
+#include <linux/pwm.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+
+int mipi_elite_device_register(struct msm_panel_info *pinfo,
+                                 u32 channel, u32 panel);
+
+#define ELITE_USE_CMDLISTS 1
+#define PWM_MIN                   6
+#define PWM_DEFAULT               91
+#define PWM_MAX                   255
+
+#define BRI_SETTING_MIN                 30
+#define BRI_SETTING_DEF                 143
+#define BRI_SETTING_MAX                 255
+
+#define EVA_CMD_MODE_PANEL
+#undef EVA_VIDEO_MODE_PANEL
+#undef EVA_SWITCH_MODE_PANEL
+
+#endif /* !MIPI_ELITE_H */
diff --git a/arch/arm/mach-msm/htc/elite/display/mipi_elite_720p_pt.c b/arch/arm/mach-msm/htc/elite/display/mipi_elite_720p_pt.c
new file mode 100644
index 0000000..34f8397
--- /dev/null
+++ b/arch/arm/mach-msm/htc/elite/display/mipi_elite_720p_pt.c
@@ -0,0 +1,269 @@
+#include "../../../drivers/video/msm/msm_fb.h"
+#include "../../../drivers/video/msm/mipi_dsi.h"
+#include "mipi_elite.h"
+#include <mach/panel_id.h>
+
+static struct mipi_dsi_phy_ctrl mipi_dsi_sony_panel_id28103_phy_ctrl_720p = {
+	/* DSI_BIT_CLK at 569MHz, 3 lane, RGB888 */
+	/* regulator *//* off=0x0500 */
+	{0x03, 0x08, 0x05, 0x00, 0x20},
+	/* timing *//* off=0x0440 */
+	{0x9B, 0x38, 0x18, 0x00, 0x4B, 0x51, 0x1C,
+		0x3B, 0x29, 0x03, 0x04, 0xA0},
+	/* phy ctrl *//* off=0x0470 */
+	{0x5F, 0x00, 0x00, 0x10},
+	/* strength *//* off=0x0480 */
+	{0xFF, 0x00, 0x06, 0x00},
+	/* pll control *//* off=0x0204 */
+	{0x0, 0x38, 0x32, 0xDA, 0x00, 0x10, 0x0F, 0x61,
+		0x41, 0x0F, 0x01,
+		0x00, 0x1A, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x02 },
+};
+
+static struct mipi_dsi_phy_ctrl mipi_dsi_sharp_panel_idA1B100_phy_ctrl_720p = {
+	/* DSI_BIT_CLK at 569MHz, 3 lane, RGB888 */
+	/* regulator *//* off=0x0500 */
+	{0x03, 0x08, 0x05, 0x00, 0x20},
+	/* timing *//* off=0x0440 */
+	{0x9B, 0x38, 0x18, 0x00, 0x4B, 0x51, 0x1C,
+		0x3B, 0x29, 0x03, 0x04, 0xA0},
+	/* phy ctrl *//* off=0x0470 */
+	{0x5F, 0x00, 0x00, 0x10},
+	/* strength *//* off=0x0480 */
+	{0xFF, 0x00, 0x06, 0x00},
+	/* pll control *//* off=0x0204 */
+	{0x0, 0x38, 0x32, 0xDA, 0x00, 0x10, 0x0F, 0x61,
+		0x41, 0x0F, 0x01,
+		0x00, 0x1A, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x02 },
+};
+
+static struct msm_panel_info pinfo;
+
+static int __init mipi_video_sony_hd720p_init(void)
+{
+	int ret;
+
+	printk(KERN_INFO "%s: enter mipi_video_sony init.\n", __func__);
+
+	/* 1:VIDEO MODE, 0:CMD MODE */
+#ifdef EVA_CMD_MODE_PANEL
+	printk(KERN_INFO "%s: CMD mode (AL)\n", __func__);
+	pinfo.type = MIPI_CMD_PANEL;
+	pinfo.mipi.mode = DSI_CMD_MODE;
+	pinfo.mipi.dst_format = DSI_CMD_DST_FORMAT_RGB888;
+	/*pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_NONE;*/
+	pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_SW;
+#ifdef CONFIG_FB_MSM_SELF_REFRESH
+	elite_panel_data.self_refresh_switch = NULL; /* CMD or VIDEO mode only */
+#endif
+	pinfo.lcd.vsync_enable = TRUE;
+	pinfo.lcd.hw_vsync_mode = TRUE;
+	pinfo.lcd.refx100 = 6096; /* adjust refx100 to prevent tearing */
+	pinfo.mipi.te_sel = 1; /* TE from vsycn gpio */
+	pinfo.mipi.interleave_max = 1;
+	pinfo.mipi.insert_dcs_cmd = TRUE;
+	pinfo.mipi.wr_mem_continue = 0x3c;
+	pinfo.mipi.wr_mem_start = 0x2c;
+
+#else
+	pinfo.type = MIPI_VIDEO_PANEL;
+	pinfo.mipi.mode = DSI_VIDEO_MODE;
+	pinfo.mipi.dst_format = DSI_VIDEO_DST_FORMAT_RGB888;
+	pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_SW;
+#ifdef CONFIG_FB_MSM_SELF_REFRESH
+	printk(KERN_INFO "%s: VIDEO mode (AL)\n", __func__);
+	elite_panel_data.self_refresh_switch = NULL; /* CMD or VIDEO mode only */
+#else
+	printk(KERN_INFO "%s: SWITCH mode (AL)\n", __func__);
+#endif
+
+	pinfo.mipi.pulse_mode_hsa_he = TRUE;
+	pinfo.mipi.hfp_power_stop = TRUE;
+	pinfo.mipi.hbp_power_stop = TRUE;
+	pinfo.mipi.hsa_power_stop = TRUE;
+	pinfo.mipi.eof_bllp_power_stop = TRUE;
+	pinfo.mipi.bllp_power_stop = TRUE;
+	pinfo.mipi.traffic_mode = DSI_NON_BURST_SYNCH_PULSE;
+
+#endif
+
+
+	pinfo.xres = 720;
+	pinfo.yres = 1280;
+
+	pinfo.pdest = DISPLAY_1;
+	pinfo.wait_cycle = 0;
+	pinfo.bpp = 24;
+
+	pinfo.lcdc.h_back_porch = 104;
+	pinfo.lcdc.h_front_porch = 95;
+	pinfo.lcdc.h_pulse_width = 1;
+	pinfo.lcdc.v_back_porch = 2;
+	pinfo.lcdc.v_front_porch = 6;
+	pinfo.lcdc.v_pulse_width = 1;
+
+	pinfo.lcd.v_back_porch = 2;
+	pinfo.lcd.v_front_porch = 6;
+	pinfo.lcd.v_pulse_width = 1;
+
+	pinfo.lcd.primary_vsync_init = pinfo.yres;
+	pinfo.lcd.primary_rdptr_irq = 0;
+	pinfo.lcd.primary_start_pos = pinfo.yres +
+		pinfo.lcd.v_back_porch + pinfo.lcd.v_front_porch - 1;
+
+	pinfo.lcdc.border_clr = 0;    /* blk */
+	pinfo.lcdc.underflow_clr = 0xff;      /* blue */
+	pinfo.lcdc.hsync_skew = 0;
+	pinfo.bl_max = 255;
+	pinfo.bl_min = 1;
+	pinfo.fb_num = 2;
+
+	pinfo.clk_rate = 569000000;
+
+	pinfo.mipi.vc = 0;
+	pinfo.mipi.rgb_swap = DSI_RGB_SWAP_RGB;
+	pinfo.mipi.data_lane0 = TRUE;
+	pinfo.mipi.data_lane1 = TRUE;
+	pinfo.mipi.data_lane2 = TRUE;
+	pinfo.mipi.tx_eot_append = TRUE;
+	pinfo.mipi.t_clk_post = 0x10;
+	pinfo.mipi.t_clk_pre = 0x21;
+	pinfo.mipi.stream = 0;        /* dma_p */
+
+	pinfo.mipi.dma_trigger = DSI_CMD_TRIGGER_SW;
+	pinfo.mipi.frame_rate = 60;
+	pinfo.mipi.dsi_phy_db = &mipi_dsi_sony_panel_id28103_phy_ctrl_720p;
+
+	ret = mipi_elite_device_register(&pinfo, MIPI_DSI_PRIM,
+			MIPI_DSI_PANEL_720P_PT);
+	if (ret)
+		printk(KERN_ERR "%s: failed to register device!\n", __func__);
+
+	return ret;
+}
+
+static int __init mipi_video_sharp_nt_720p_pt_init(void)
+{
+	int ret;
+
+	printk(KERN_INFO "%s: enter mipi_video_sharp_nt init.\n", __func__);
+
+	/* 1:VIDEO MODE, 0:CMD MODE */
+#ifdef EVA_CMD_MODE_PANEL
+	printk(KERN_INFO "%s: CMD mode (AL)\n", __func__);
+	pinfo.type = MIPI_CMD_PANEL;
+	pinfo.mipi.mode = DSI_CMD_MODE;
+	pinfo.mipi.dst_format = DSI_CMD_DST_FORMAT_RGB888;
+	/*pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_NONE;*/
+	pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_SW;
+#ifdef CONFIG_FB_MSM_SELF_REFRESH
+	elite_panel_data.self_refresh_switch = NULL; /* CMD or VIDEO mode only */
+#endif
+	pinfo.lcd.vsync_enable = TRUE;
+	pinfo.lcd.hw_vsync_mode = TRUE;
+	pinfo.lcd.refx100 = 6096; /* adjust refx100 to prevent tearing */
+	pinfo.mipi.te_sel = 1; /* TE from vsycn gpio */
+	pinfo.mipi.interleave_max = 1;
+	pinfo.mipi.insert_dcs_cmd = TRUE;
+	pinfo.mipi.wr_mem_continue = 0x3c;
+	pinfo.mipi.wr_mem_start = 0x2c;
+
+#else
+	pinfo.type = MIPI_VIDEO_PANEL;
+	pinfo.mipi.mode = DSI_VIDEO_MODE;
+	pinfo.mipi.dst_format = DSI_VIDEO_DST_FORMAT_RGB888;
+	pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_SW;
+#ifdef CONFIG_FB_MSM_SELF_REFRESH
+	printk(KERN_INFO "%s: VIDEO mode (AL)\n", __func__);
+	elite_panel_data.self_refresh_switch = NULL; /* CMD or VIDEO mode only */
+#else
+	printk(KERN_INFO "%s: SWITCH mode (AL)\n", __func__);
+#endif
+	pinfo.mipi.pulse_mode_hsa_he = TRUE;
+	pinfo.mipi.hfp_power_stop = TRUE;
+	pinfo.mipi.hbp_power_stop = TRUE;
+	pinfo.mipi.hsa_power_stop = TRUE;
+	pinfo.mipi.eof_bllp_power_stop = TRUE;
+	pinfo.mipi.bllp_power_stop = TRUE;
+	pinfo.mipi.traffic_mode = DSI_NON_BURST_SYNCH_PULSE;
+
+#endif
+
+	pinfo.xres = 720;
+	pinfo.yres = 1280;
+
+	pinfo.pdest = DISPLAY_1;
+	pinfo.wait_cycle = 0;
+	pinfo.bpp = 24;
+
+	pinfo.lcdc.h_back_porch = 125;
+	pinfo.lcdc.h_front_porch = 122;
+	pinfo.lcdc.h_pulse_width = 1;
+	pinfo.lcdc.v_back_porch = 2;
+	pinfo.lcdc.v_front_porch = 6;
+	pinfo.lcdc.v_pulse_width = 1;
+
+	pinfo.lcd.v_back_porch = 2;
+	pinfo.lcd.v_front_porch = 6;
+	pinfo.lcd.v_pulse_width = 1;
+
+	pinfo.lcd.primary_vsync_init = pinfo.yres;
+	pinfo.lcd.primary_rdptr_irq = 0;
+	pinfo.lcd.primary_start_pos = pinfo.yres +
+		pinfo.lcd.v_back_porch + pinfo.lcd.v_front_porch - 1;
+
+	pinfo.lcdc.border_clr = 0;    /* blk */
+	pinfo.lcdc.underflow_clr = 0xff;      /* blue */
+	pinfo.lcdc.hsync_skew = 0;
+	pinfo.bl_max = 255;
+	pinfo.bl_min = 1;
+	pinfo.fb_num = 2;
+
+	pinfo.clk_rate = 569000000;
+
+	pinfo.mipi.vc = 0;
+	pinfo.mipi.rgb_swap = DSI_RGB_SWAP_RGB;
+	pinfo.mipi.data_lane0 = TRUE;
+	pinfo.mipi.data_lane1 = TRUE;
+	pinfo.mipi.data_lane2 = TRUE;
+	pinfo.mipi.tx_eot_append = TRUE;
+	pinfo.mipi.t_clk_post = 0x10;
+	pinfo.mipi.t_clk_pre = 0x21;
+	pinfo.mipi.stream = 0; /* dma_p */
+
+	pinfo.mipi.dma_trigger = DSI_CMD_TRIGGER_SW;
+	pinfo.mipi.frame_rate = 57;
+	pinfo.mipi.dsi_phy_db = &mipi_dsi_sharp_panel_idA1B100_phy_ctrl_720p;
+
+	ret = mipi_elite_device_register(&pinfo, MIPI_DSI_PRIM,
+			MIPI_DSI_PANEL_720P_PT);
+	if (ret)
+		printk(KERN_ERR "%s: failed to register device!\n", __func__);
+
+	return ret;
+}
+
+static int __init mipi_elite_panel_init(void)
+{
+	int rc;
+
+	printk(KERN_INFO "%s: enter 0x%x\n", __func__, panel_type);
+	if (panel_type == PANEL_ID_ELITE_SONY_NT
+			|| panel_type == PANEL_ID_ELITE_SONY_NT_C1
+			|| panel_type == PANEL_ID_ELITE_SONY_NT_C2) {
+		rc = mipi_video_sony_hd720p_init();
+		printk(KERN_INFO "match PANEL_ID_ELITE_SONY_NT panel_type\n");
+		return rc;
+	} else if (panel_type == PANEL_ID_ELITE_SHARP_NT
+			|| panel_type == PANEL_ID_ELITE_SHARP_NT_C1
+			|| panel_type == PANEL_ID_ELITE_SHARP_NT_C2) {
+		printk(KERN_INFO "match PANEL_ID_ELITE_SHARP_NT panel_type\n");
+		rc = mipi_video_sharp_nt_720p_pt_init();
+		return rc;
+	} else
+		printk(KERN_INFO "Mis-match panel_type\n");
+
+	return -EINVAL;
+}
+
+late_initcall(mipi_elite_panel_init);
diff --git a/arch/arm/mach-msm/htc/emmc_partitions.c b/arch/arm/mach-msm/htc/emmc_partitions.c
new file mode 100644
index 0000000..2950083
--- /dev/null
+++ b/arch/arm/mach-msm/htc/emmc_partitions.c
@@ -0,0 +1,165 @@
+/* arch/arm/mach-msm/nand_partitions.c
+ *
+ * Code to extract partition information from ATAG set up by the
+ * bootloader.
+ *
+ * Copyright (C) 2007 Google, Inc.
+ * Author: Brian Swetland <swetland@google.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/module.h>
+
+#include <asm/mach/flash.h>
+#include <asm/io.h>
+
+#include <asm/setup.h>
+
+#include <linux/mtd/nand.h>
+#include <linux/mtd/partitions.h>
+
+#include <mach/msm_iomap.h>
+
+#include <mach/board.h>
+
+#ifdef CONFIG_MMC_MUST_PREVENT_WP_VIOLATION
+#include <linux/mmc/card.h>
+#endif	
+
+
+#define ATAG_MSM_PARTITION 0x4d534D70 
+
+struct msm_ptbl_entry {
+	char name[16];
+	__u32 offset;
+	__u32 size;
+	__u32 flags;
+};
+
+#define MSM_MAX_PARTITIONS 32
+
+static struct mtd_partition msm_nand_partitions[MSM_MAX_PARTITIONS];
+static char msm_nand_names[MSM_MAX_PARTITIONS * 16];
+
+int emmc_partition_read_proc(char *page, char **start, off_t off,
+			   int count, int *eof, void *data)
+{
+	struct mtd_partition *ptn = msm_nand_partitions;
+	char *p = page;
+	int i;
+	uint64_t offset;
+	uint64_t size;
+
+	p += sprintf(p, "dev:        size     erasesize name\n");
+	for (i = 0; i < MSM_MAX_PARTITIONS && ptn->name; i++, ptn++) {
+		offset = ptn->offset;
+		size = ptn->size;
+		p += sprintf(p, "mmcblk0p%llu: %08llx %08x \"%s\"\n", offset, size * 512, 512, ptn->name);
+	}
+
+	return p - page;
+}
+
+int get_partition_num_by_name(char *name)
+{
+	struct mtd_partition *ptn = msm_nand_partitions;
+	int i;
+
+	for (i = 0; i < MSM_MAX_PARTITIONS && ptn->name; i++, ptn++) {
+		if (strcmp(ptn->name, name) == 0)
+			return ptn->offset;
+	}
+	return -1;
+}
+EXPORT_SYMBOL(get_partition_num_by_name);
+
+static int __init parse_tag_msm_partition(const struct tag *tag)
+{
+	struct mtd_partition *ptn = msm_nand_partitions;
+	char *name = msm_nand_names;
+	struct msm_ptbl_entry *entry = (void *) &tag->u;
+	unsigned count, n;
+	unsigned have_kpanic = 0;
+
+	count = (tag->hdr.size - 2) /
+		(sizeof(struct msm_ptbl_entry) / sizeof(__u32));
+
+	if (count > MSM_MAX_PARTITIONS)
+		count = MSM_MAX_PARTITIONS;
+
+	for (n = 0; n < count; n++) {
+		memcpy(name, entry->name, 15);
+		name[15] = 0;
+
+		if (!strcmp(name, "kpanic"))
+			have_kpanic = 1;
+
+		ptn->name = name;
+		ptn->offset = entry->offset;
+		ptn->size = entry->size;
+
+#ifdef CONFIG_MMC_MUST_PREVENT_WP_VIOLATION
+		if (!strncmp(ptn->name, "system", 6))
+			mmc_blk_set_wp_prevention_partno((int) ptn->offset);
+#endif	
+
+		name += 16;
+		entry++;
+		ptn++;
+	}
+
+#ifdef CONFIG_VIRTUAL_KPANIC_PARTITION
+	if (!have_kpanic) {
+		int i;
+		uint64_t kpanic_off = 0;
+
+		if (count == MSM_MAX_PARTITIONS) {
+			printk(KERN_ERR "Cannot create virtual 'kpanic' partition\n");
+			goto out;
+		}
+
+		for (i = 0; i < count; i++) {
+			ptn = &msm_nand_partitions[i];
+			if (!strcmp(ptn->name, CONFIG_VIRTUAL_KPANIC_SRC)) {
+				ptn->size -= CONFIG_VIRTUAL_KPANIC_PSIZE;
+				kpanic_off = ptn->offset + ptn->size;
+				break;
+			}
+		}
+		if (i == count) {
+			printk(KERN_ERR "Partition %s not found\n",
+			       CONFIG_VIRTUAL_KPANIC_SRC);
+			goto out;
+		}
+
+		ptn = &msm_nand_partitions[count];
+		ptn->name = "kpanic";
+		ptn->offset = kpanic_off;
+		ptn->size = CONFIG_VIRTUAL_KPANIC_PSIZE;
+
+		printk(KERN_INFO "Virtual mtd partition '%s' created @%llx (%llu)\n",
+		       ptn->name, ptn->offset, ptn->size);
+
+		count++;
+	}
+out:
+#endif 
+	msm_nand_data.nr_parts = count;
+	msm_nand_data.parts = msm_nand_partitions;
+
+	return 0;
+}
+
+__tagtable(ATAG_MSM_PARTITION, parse_tag_msm_partition);
diff --git a/arch/arm/mach-msm/htc/fighter/Kconfig b/arch/arm/mach-msm/htc/fighter/Kconfig
new file mode 100644
index 0000000..f69b516
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/Kconfig
@@ -0,0 +1,10 @@
+config BOARD_HEADER_FILE
+	string "HTC board specific header file name"
+	default ""
+
+config MACH_FIGHTER
+	depends on ARCH_MSM8960
+	select MACH_HTC
+	bool "HTC FIGHTER"
+	help
+	  Support for the HTC FIGHTER device.
diff --git a/arch/arm/mach-msm/htc/fighter/Makefile b/arch/arm/mach-msm/htc/fighter/Makefile
new file mode 100644
index 0000000..4df2ccf
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/Makefile
@@ -0,0 +1,10 @@
+obj-$(CONFIG_MACH_FIGHTER) += board-fighter.o
+obj-$(CONFIG_MACH_FIGHTER) += board-fighter-regulator.o
+obj-$(CONFIG_MACH_FIGHTER) += board-fighter-gpiomux.o
+obj-$(CONFIG_MACH_FIGHTER) += board-fighter-storage.o
+obj-$(CONFIG_MACH_FIGHTER) += board-fighter-audio.o
+obj-$(CONFIG_MACH_FIGHTER) += board-fighter-pmic.o
+obj-$(CONFIG_MACH_FIGHTER) += board-fighter-keypad.o
+obj-$(CONFIG_MACH_FIGHTER) += board-fighter-camera.o
+obj-$(CONFIG_MACH_FIGHTER) += display/
+CFLAGS_board-fighter-display.o += -Idrivers/video
diff --git a/arch/arm/mach-msm/htc/fighter/board-fighter-audio.c b/arch/arm/mach-msm/htc/fighter/board-fighter-audio.c
new file mode 100644
index 0000000..5d8e7a1
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/board-fighter-audio.c
@@ -0,0 +1,1673 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/platform_device.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/slab.h>
+#include <sound/core.h>
+#include <sound/soc.h>
+#include <sound/tlv.h>
+#include <sound/soc-dapm.h>
+#include <sound/pcm.h>
+#include <sound/jack.h>
+#include <asm/mach-types.h>
+#include <mach/socinfo.h>
+#include <sound/tpa2051d3.h>
+#include <asm/system_info.h>
+#include <linux/mfd/wcd9xxx/core.h>
+#include "../sound/soc/msm/msm-pcm-routing.h"
+#include "../../../sound/soc/codecs/wcd9310.h"
+#include <linux/mfd/wcd9xxx/wcd9310_registers.h>
+
+/* 8960 machine driver */
+
+#define PM8921_GPIO_BASE		NR_GPIO_IRQS
+#define PM8921_IRQ_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
+#define PM8921_GPIO_PM_TO_SYS(pm_gpio)  (pm_gpio - 1 + PM8921_GPIO_BASE)
+
+#define MSM_SPK_ON 1
+#define MSM_SPK_OFF 0
+
+#define MSM_SLIM_0_RX_MAX_CHANNELS		2
+#define MSM_SLIM_0_TX_MAX_CHANNELS		4
+
+#define SAMPLE_RATE_8KHZ 8000
+#define SAMPLE_RATE_16KHZ 16000
+
+#define BOTTOM_SPK_AMP_POS	0x1
+#define BOTTOM_SPK_AMP_NEG	0x2
+#define TOP_SPK_AMP_POS		0x4
+#define TOP_SPK_AMP_NEG		0x8
+#define TOP_SPK_AMP		0x10
+
+#define GPIO_AUX_PCM_DOUT 63
+#define GPIO_AUX_PCM_DIN 64
+#define GPIO_AUX_PCM_SYNC 65
+#define GPIO_AUX_PCM_CLK 66
+
+#define TABLA_EXT_CLK_RATE 12288000
+
+#define TABLA_MBHC_DEF_BUTTONS 8
+#define TABLA_MBHC_DEF_RLOADS 5
+
+#define JACK_DETECT_GPIO 38
+#define JACK_DETECT_INT PM8921_GPIO_IRQ(PM8921_IRQ_BASE, JACK_DETECT_GPIO)
+#define JACK_US_EURO_SEL_GPIO 35
+
+static u32 top_spk_pamp_gpio  = PM8921_GPIO_PM_TO_SYS(19);
+static u32 bottom_spk_pamp_gpio = PM8921_GPIO_PM_TO_SYS(18);
+static int msm_spk_control;
+static int msm_ext_bottom_spk_pamp;
+static int msm_ext_top_spk_pamp;
+static int msm_slim_0_rx_ch = 1;
+static int msm_slim_0_tx_ch = 1;
+
+static int msm_btsco_rate = SAMPLE_RATE_8KHZ;
+static int msm_btsco_ch = 1;
+static int msm_auxpcm_rate = SAMPLE_RATE_8KHZ;
+
+static struct clk *codec_clk;
+static int clk_users;
+
+static int msm_headset_gpios_configured;
+
+static struct snd_soc_jack hs_jack;
+static struct snd_soc_jack button_jack;
+static atomic_t auxpcm_rsc_ref;
+
+static bool hs_detect_use_gpio;
+module_param(hs_detect_use_gpio, bool, 0444);
+MODULE_PARM_DESC(hs_detect_use_gpio, "Use GPIO for headset detection");
+
+static bool hs_detect_extn_cable;
+module_param(hs_detect_extn_cable, bool, 0444);
+MODULE_PARM_DESC(hs_detect_extn_cable, "Enable extension cable feature");
+
+
+static bool hs_detect_use_firmware;
+module_param(hs_detect_use_firmware, bool, 0444);
+MODULE_PARM_DESC(hs_detect_use_firmware, "Use firmware for headset detection");
+
+static int msm_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
+					bool dapm);
+
+static struct tabla_mbhc_config mbhc_cfg = {
+	.headset_jack = &hs_jack,
+	.button_jack = &button_jack,
+	.read_fw_bin = false,
+	.calibration = NULL,
+	.micbias = TABLA_MICBIAS2,
+	.mclk_cb_fn = msm_enable_codec_ext_clk,
+	.mclk_rate = TABLA_EXT_CLK_RATE,
+	.gpio = 0,
+	.gpio_irq = 0,
+	.gpio_level_insert = 1,
+	.swap_gnd_mic = NULL,
+	.detect_extn_cable = false,
+};
+
+static u32 us_euro_sel_gpio = PM8921_GPIO_PM_TO_SYS(JACK_US_EURO_SEL_GPIO);
+
+static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1);
+
+static struct mutex cdc_mclk_mutex;
+
+static void msm_enable_ext_spk_amp_gpio(u32 spk_amp_gpio)
+{
+	int ret = 0;
+
+	struct pm_gpio param = {
+		.direction      = PM_GPIO_DIR_OUT,
+		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
+		.output_value   = 1,
+		.pull      = PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength   = PM_GPIO_STRENGTH_MED,
+		.function       = PM_GPIO_FUNC_NORMAL,
+	};
+
+	if (spk_amp_gpio == bottom_spk_pamp_gpio) {
+
+		ret = gpio_request(bottom_spk_pamp_gpio, "BOTTOM_SPK_AMP");
+		if (ret) {
+			pr_err("%s: Error requesting BOTTOM SPK AMP GPIO %u\n",
+				__func__, bottom_spk_pamp_gpio);
+			return;
+		}
+		ret = pm8xxx_gpio_config(bottom_spk_pamp_gpio, &param);
+		if (ret)
+			pr_err("%s: Failed to configure Bottom Spk Ampl"
+				" gpio %u\n", __func__, bottom_spk_pamp_gpio);
+		else {
+			pr_debug("%s: enable Bottom spkr amp gpio\n", __func__);
+			gpio_direction_output(bottom_spk_pamp_gpio, 1);
+
+			if (system_rev < 3)
+				set_speaker_amp(1);
+		}
+	} else if (spk_amp_gpio == top_spk_pamp_gpio) {
+
+		ret = gpio_request(top_spk_pamp_gpio, "TOP_SPK_AMP");
+		if (ret) {
+			pr_err("%s: Error requesting GPIO %d\n", __func__,
+				top_spk_pamp_gpio);
+			return;
+		}
+		ret = pm8xxx_gpio_config(top_spk_pamp_gpio, &param);
+		if (ret)
+			pr_err("%s: Failed to configure Top Spk Ampl"
+				" gpio %u\n", __func__, top_spk_pamp_gpio);
+		else {
+			pr_debug("%s: enable Top spkr amp gpio\n", __func__);
+			gpio_direction_output(top_spk_pamp_gpio, 1);
+		}
+	} else {
+		pr_err("%s: ERROR : Invalid External Speaker Ampl GPIO."
+			" gpio = %u\n", __func__, spk_amp_gpio);
+		return;
+	}
+}
+
+static void msm_ext_spk_power_amp_on(u32 spk)
+{
+	if (spk & (BOTTOM_SPK_AMP_POS | BOTTOM_SPK_AMP_NEG)) {
+
+		if ((msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_POS) &&
+			(msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_NEG)) {
+
+			pr_debug("%s() External Bottom Speaker Ampl already "
+				"turned on. spk = 0x%08x\n", __func__, spk);
+			return;
+		}
+
+		msm_ext_bottom_spk_pamp |= spk;
+
+		if ((msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_POS) &&
+			(msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_NEG)) {
+
+			msm_enable_ext_spk_amp_gpio(bottom_spk_pamp_gpio);
+			pr_debug("%s: slepping 4 ms after turning on external "
+				" Bottom Speaker Ampl\n", __func__);
+			usleep_range(4000, 4000);
+		}
+
+	} else if  (spk & (TOP_SPK_AMP_POS | TOP_SPK_AMP_NEG | TOP_SPK_AMP)) {
+
+		pr_debug("%s: top_spk_amp_state = 0x%x spk_event = 0x%x\n",
+			__func__, msm_ext_top_spk_pamp, spk);
+
+		if (((msm_ext_top_spk_pamp & TOP_SPK_AMP_POS) &&
+			(msm_ext_top_spk_pamp & TOP_SPK_AMP_NEG)) ||
+				(msm_ext_top_spk_pamp & TOP_SPK_AMP)) {
+
+			pr_debug("%s() External Top Speaker Ampl already"
+				"turned on. spk = 0x%08x\n", __func__, spk);
+			return;
+		}
+
+		msm_ext_top_spk_pamp |= spk;
+
+		if (((msm_ext_top_spk_pamp & TOP_SPK_AMP_POS) &&
+			(msm_ext_top_spk_pamp & TOP_SPK_AMP_NEG)) ||
+				(msm_ext_top_spk_pamp & TOP_SPK_AMP)) {
+
+			msm_enable_ext_spk_amp_gpio(top_spk_pamp_gpio);
+			pr_debug("%s: sleeping 4 ms after turning on "
+				" external Top Speaker Ampl\n", __func__);
+			usleep_range(4000, 4000);
+		}
+	} else  {
+
+		pr_err("%s: ERROR : Invalid External Speaker Ampl. spk = 0x%08x\n",
+			__func__, spk);
+		return;
+	}
+}
+
+static void msm_ext_spk_power_amp_off(u32 spk)
+{
+	if (spk & (BOTTOM_SPK_AMP_POS | BOTTOM_SPK_AMP_NEG)) {
+
+		if (!msm_ext_bottom_spk_pamp)
+			return;
+
+		gpio_direction_output(bottom_spk_pamp_gpio, 0);
+		gpio_free(bottom_spk_pamp_gpio);
+		msm_ext_bottom_spk_pamp = 0;
+
+		if (system_rev < 3)
+			set_speaker_amp(0);
+
+		pr_debug("%s: sleeping 4 ms after turning off external Bottom"
+			" Speaker Ampl\n", __func__);
+
+		usleep_range(4000, 4000);
+
+	} else if (spk & (TOP_SPK_AMP_POS | TOP_SPK_AMP_NEG | TOP_SPK_AMP)) {
+
+		pr_debug("%s: top_spk_amp_state = 0x%x spk_event = 0x%x\n",
+				__func__, msm_ext_top_spk_pamp, spk);
+
+		if (!msm_ext_top_spk_pamp)
+			return;
+
+		if ((spk & TOP_SPK_AMP_POS) || (spk & TOP_SPK_AMP_NEG)) {
+
+			msm_ext_top_spk_pamp &= (~(TOP_SPK_AMP_POS |
+							TOP_SPK_AMP_NEG));
+		} else if (spk & TOP_SPK_AMP) {
+			msm_ext_top_spk_pamp &=  ~TOP_SPK_AMP;
+		}
+
+		if (msm_ext_top_spk_pamp)
+			return;
+
+		gpio_direction_output(top_spk_pamp_gpio, 0);
+		gpio_free(top_spk_pamp_gpio);
+		msm_ext_top_spk_pamp = 0;
+
+		pr_debug("%s: sleeping 4 ms after ext Top Spek Ampl is off\n",
+				__func__);
+
+		usleep_range(4000, 4000);
+	} else  {
+
+		pr_err("%s: ERROR : Invalid Ext Spk Ampl. spk = 0x%08x\n",
+			__func__, spk);
+		return;
+	}
+}
+
+static void msm_ext_control(struct snd_soc_codec *codec)
+{
+	struct snd_soc_dapm_context *dapm = &codec->dapm;
+
+	mutex_lock(&dapm->codec->mutex);
+
+	pr_debug("%s: msm_spk_control = %d", __func__, msm_spk_control);
+	if (msm_spk_control == MSM_SPK_ON) {
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Pos");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Neg");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Pos");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Neg");
+	} else {
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Bottom Pos");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Bottom Neg");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Top Pos");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Top Neg");
+	}
+
+	snd_soc_dapm_sync(dapm);
+	mutex_unlock(&dapm->codec->mutex);
+}
+
+static int msm_get_spk(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_spk_control = %d", __func__, msm_spk_control);
+	ucontrol->value.integer.value[0] = msm_spk_control;
+	return 0;
+}
+static int msm_set_spk(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+
+	pr_debug("%s()\n", __func__);
+	if (msm_spk_control == ucontrol->value.integer.value[0])
+		return 0;
+
+	msm_spk_control = ucontrol->value.integer.value[0];
+	msm_ext_control(codec);
+	return 1;
+}
+static int msm_spkramp_event(struct snd_soc_dapm_widget *w,
+	struct snd_kcontrol *k, int event)
+{
+	pr_debug("%s() %x\n", __func__, SND_SOC_DAPM_EVENT_ON(event));
+
+	if (SND_SOC_DAPM_EVENT_ON(event)) {
+		if (!strncmp(w->name, "Ext Spk Bottom Pos", 18))
+			msm_ext_spk_power_amp_on(BOTTOM_SPK_AMP_POS);
+		else if (!strncmp(w->name, "Ext Spk Bottom Neg", 18))
+			msm_ext_spk_power_amp_on(BOTTOM_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Ext Spk Top Pos", 15))
+			msm_ext_spk_power_amp_on(TOP_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Ext Spk Top Neg", 15))
+			msm_ext_spk_power_amp_on(TOP_SPK_AMP_NEG);
+		else if  (!strncmp(w->name, "Ext Spk Top", 12))
+			msm_ext_spk_power_amp_on(TOP_SPK_AMP);
+		else {
+			pr_err("%s() Invalid Speaker Widget = %s\n",
+					__func__, w->name);
+			return -EINVAL;
+		}
+
+	} else {
+		if (!strncmp(w->name, "Ext Spk Bottom Pos", 18))
+			msm_ext_spk_power_amp_off(BOTTOM_SPK_AMP_POS);
+		else if (!strncmp(w->name, "Ext Spk Bottom Neg", 18))
+			msm_ext_spk_power_amp_off(BOTTOM_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Ext Spk Top Pos", 15))
+			msm_ext_spk_power_amp_off(TOP_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Ext Spk Top Neg", 15))
+			msm_ext_spk_power_amp_off(TOP_SPK_AMP_NEG);
+		else if  (!strncmp(w->name, "Ext Spk Top", 12))
+			msm_ext_spk_power_amp_off(TOP_SPK_AMP);
+		else {
+			pr_err("%s() Invalid Speaker Widget = %s\n",
+					__func__, w->name);
+			return -EINVAL;
+		}
+	}
+	return 0;
+}
+
+static int msm_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
+					bool dapm)
+{
+	int r = 0;
+	pr_debug("%s: enable = %d\n", __func__, enable);
+
+	mutex_lock(&cdc_mclk_mutex);
+	if (enable) {
+		clk_users++;
+		pr_debug("%s: clk_users = %d\n", __func__, clk_users);
+		if (clk_users == 1) {
+			if (codec_clk) {
+				clk_set_rate(codec_clk, TABLA_EXT_CLK_RATE);
+				clk_prepare_enable(codec_clk);
+				tabla_mclk_enable(codec, 1, dapm);
+			} else {
+				pr_err("%s: Error setting Tabla MCLK\n",
+				       __func__);
+				clk_users--;
+				r = -EINVAL;
+			}
+		}
+	} else {
+		if (clk_users > 0) {
+			clk_users--;
+			pr_debug("%s: clk_users = %d\n", __func__, clk_users);
+			if (clk_users == 0) {
+				pr_debug("%s: disabling MCLK. clk_users = %d\n",
+					 __func__, clk_users);
+				tabla_mclk_enable(codec, 0, dapm);
+				clk_disable_unprepare(codec_clk);
+			}
+		} else {
+			pr_err("%s: Error releasing Tabla MCLK\n", __func__);
+			r = -EINVAL;
+		}
+	}
+	mutex_unlock(&cdc_mclk_mutex);
+	return r;
+}
+
+static int msm_mclk_event(struct snd_soc_dapm_widget *w,
+		struct snd_kcontrol *kcontrol, int event)
+{
+	pr_debug("%s: event = %d\n", __func__, event);
+
+	switch (event) {
+	case SND_SOC_DAPM_PRE_PMU:
+		return msm_enable_codec_ext_clk(w->codec, 1, true);
+	case SND_SOC_DAPM_POST_PMD:
+		return msm_enable_codec_ext_clk(w->codec, 0, true);
+	}
+	return 0;
+}
+
+static const struct snd_kcontrol_new earamp_switch_controls =
+	SOC_DAPM_SINGLE("Switch", 0, 0, 1, 0);
+
+static const struct snd_kcontrol_new spkamp_switch_controls =
+	SOC_DAPM_SINGLE("Switch", 0, 0, 1, 0);
+
+static const struct snd_soc_dapm_widget fighter_dapm_widgets[] = {
+	SND_SOC_DAPM_MIXER("Lineout Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
+	SND_SOC_DAPM_MIXER("SPK AMP EN", SND_SOC_NOPM, 0, 0, &spkamp_switch_controls, 1),
+	SND_SOC_DAPM_MIXER("EAR AMP EN", SND_SOC_NOPM, 0, 0, &earamp_switch_controls, 1),
+};
+
+static const struct snd_soc_dapm_widget msm_dapm_widgets[] = {
+	SND_SOC_DAPM_SUPPLY("MCLK",  SND_SOC_NOPM, 0, 0,
+	msm_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
+
+	SND_SOC_DAPM_SPK("Ext Spk Bottom Pos", msm_spkramp_event),
+	SND_SOC_DAPM_SPK("Ext Spk Bottom Neg", msm_spkramp_event),
+
+	SND_SOC_DAPM_SPK("Ext Spk Top Pos", msm_spkramp_event),
+	SND_SOC_DAPM_SPK("Ext Spk Top Neg", msm_spkramp_event),
+
+	SND_SOC_DAPM_MIC("Handset Mic", NULL),
+	SND_SOC_DAPM_MIC("Headset Mic", NULL),
+	SND_SOC_DAPM_MIC("Back Mic", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic1", NULL),
+	SND_SOC_DAPM_MIC("ANCRight Headset Mic", NULL),
+	SND_SOC_DAPM_MIC("ANCLeft Headset Mic", NULL),
+
+	SND_SOC_DAPM_MIC("Digital Mic1", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic2", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic3", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic4", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic5", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic6", NULL),
+
+};
+
+static const struct snd_soc_dapm_route tabla_1_x_audio_map[] = {
+
+	{"Lineout Mixer", NULL, "LINEOUT2"},
+	{"Lineout Mixer", NULL, "LINEOUT1"},
+};
+
+static const struct snd_soc_dapm_route tabla_2_x_audio_map[] = {
+
+	{"Lineout Mixer", NULL, "LINEOUT3"},
+	{"Lineout Mixer", NULL, "LINEOUT1"},
+};
+
+static const struct snd_soc_dapm_route common_audio_map[] = {
+
+	{"RX_BIAS", NULL, "MCLK"},
+	{"LDO_H", NULL, "MCLK"},
+
+	/* Speaker path */
+	{"Ext Spk Bottom Pos", NULL, "SPK AMP EN"},
+	{"Ext Spk Bottom Neg", NULL, "SPK AMP EN"},
+	{"SPK AMP EN", "Switch", "Lineout Mixer"},
+
+	/* Earpiece path */
+	{"Ext Spk Top Pos", NULL, "EAR AMP EN"},
+	{"Ext Spk Top Neg", NULL, "EAR AMP EN"},
+	{"EAR AMP EN", "Switch", "Lineout Mixer"},
+
+	/* Microphone path */
+	{"AMIC1", NULL, "MIC BIAS1 External"},
+	{"MIC BIAS1 External", NULL, "Handset Mic"},
+
+	{"AMIC2", NULL, "MIC BIAS2 External"},
+	{"MIC BIAS2 External", NULL, "Headset Mic"},
+
+	{"AMIC3", NULL, "MIC BIAS3 External"},
+	{"MIC BIAS3 External", NULL, "Back Mic"},
+
+	{"HEADPHONE", NULL, "LDO_H"},
+
+	/**
+	 * The digital Mic routes are setup considering
+	 * fluid as default device.
+	 */
+
+	/**
+	 * Digital Mic1. Front Bottom left Digital Mic on Fluid and MTP.
+	 * Digital Mic GM5 on CDP mainboard.
+	 * Conncted to DMIC2 Input on Tabla codec.
+	 */
+	{"DMIC2", NULL, "MIC BIAS1 External"},
+	{"MIC BIAS1 External", NULL, "Digital Mic1"},
+
+	/**
+	 * Digital Mic2. Front Bottom right Digital Mic on Fluid and MTP.
+	 * Digital Mic GM6 on CDP mainboard.
+	 * Conncted to DMIC1 Input on Tabla codec.
+	 */
+	{"DMIC1", NULL, "MIC BIAS1 External"},
+	{"MIC BIAS1 External", NULL, "Digital Mic2"},
+
+	/**
+	 * Digital Mic3. Back Bottom Digital Mic on Fluid.
+	 * Digital Mic GM1 on CDP mainboard.
+	 * Conncted to DMIC4 Input on Tabla codec.
+	 */
+	{"DMIC4", NULL, "MIC BIAS3 External"},
+	{"MIC BIAS3 External", NULL, "Digital Mic3"},
+
+	/**
+	 * Digital Mic4. Back top Digital Mic on Fluid.
+	 * Digital Mic GM2 on CDP mainboard.
+	 * Conncted to DMIC3 Input on Tabla codec.
+	 */
+	{"DMIC3", NULL, "MIC BIAS3 External"},
+	{"MIC BIAS3 External", NULL, "Digital Mic4"},
+
+	/**
+	 * Digital Mic5. Front top Digital Mic on Fluid.
+	 * Digital Mic GM3 on CDP mainboard.
+	 * Conncted to DMIC5 Input on Tabla codec.
+	 */
+	{"DMIC5", NULL, "MIC BIAS4 External"},
+	{"MIC BIAS4 External", NULL, "Digital Mic5"},
+
+};
+
+static const char *spk_function[] = {"Off", "On"};
+static const char *slim0_rx_ch_text[] = {"One", "Two"};
+static const char *slim0_tx_ch_text[] = {"One", "Two", "Three", "Four"};
+
+static const struct soc_enum msm_enum[] = {
+	SOC_ENUM_SINGLE_EXT(2, spk_function),
+	SOC_ENUM_SINGLE_EXT(2, slim0_rx_ch_text),
+	SOC_ENUM_SINGLE_EXT(4, slim0_tx_ch_text),
+};
+
+static const char *btsco_rate_text[] = {"8000", "16000"};
+static const struct soc_enum msm_btsco_enum[] = {
+		SOC_ENUM_SINGLE_EXT(2, btsco_rate_text),
+};
+
+static int msm_slim_0_rx_ch_get(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_slim_0_rx_ch  = %d\n", __func__,
+		 msm_slim_0_rx_ch);
+	ucontrol->value.integer.value[0] = msm_slim_0_rx_ch - 1;
+	return 0;
+}
+
+static int msm_slim_0_rx_ch_put(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	msm_slim_0_rx_ch = ucontrol->value.integer.value[0] + 1;
+
+	pr_debug("%s: msm_slim_0_rx_ch = %d\n", __func__,
+		 msm_slim_0_rx_ch);
+	return 1;
+}
+
+static int msm_slim_0_tx_ch_get(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_slim_0_tx_ch  = %d\n", __func__,
+		 msm_slim_0_tx_ch);
+	ucontrol->value.integer.value[0] = msm_slim_0_tx_ch - 1;
+	return 0;
+}
+
+static int msm_slim_0_tx_ch_put(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	msm_slim_0_tx_ch = ucontrol->value.integer.value[0] + 1;
+
+	pr_debug("%s: msm_slim_0_tx_ch = %d\n", __func__,
+		 msm_slim_0_tx_ch);
+	return 1;
+}
+
+static int msm_btsco_rate_get(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_btsco_rate  = %d", __func__, msm_btsco_rate);
+	ucontrol->value.integer.value[0] = msm_btsco_rate;
+	return 0;
+}
+
+static int msm_btsco_rate_put(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	switch (ucontrol->value.integer.value[0]) {
+	case 8000:
+		msm_btsco_rate = SAMPLE_RATE_8KHZ;
+		break;
+	case 16000:
+		msm_btsco_rate = SAMPLE_RATE_16KHZ;
+		break;
+	default:
+		msm_btsco_rate = SAMPLE_RATE_8KHZ;
+		break;
+	}
+	pr_debug("%s: msm_btsco_rate = %d\n", __func__, msm_btsco_rate);
+	return 0;
+}
+
+static const struct snd_kcontrol_new tabla_msm_controls[] = {
+	SOC_ENUM_EXT("Speaker Function", msm_enum[0], msm_get_spk,
+		msm_set_spk),
+	SOC_ENUM_EXT("SLIM_0_RX Channels", msm_enum[1],
+		msm_slim_0_rx_ch_get, msm_slim_0_rx_ch_put),
+	SOC_ENUM_EXT("SLIM_0_TX Channels", msm_enum[2],
+		msm_slim_0_tx_ch_get, msm_slim_0_tx_ch_put),
+};
+
+static void *def_tabla_mbhc_cal(void)
+{
+	void *tabla_cal;
+	struct tabla_mbhc_btn_detect_cfg *btn_cfg;
+	u16 *btn_low, *btn_high;
+	u8 *n_ready, *n_cic, *gain;
+
+	tabla_cal = kzalloc(TABLA_MBHC_CAL_SIZE(TABLA_MBHC_DEF_BUTTONS,
+						TABLA_MBHC_DEF_RLOADS),
+			    GFP_KERNEL);
+	if (!tabla_cal) {
+		pr_err("%s: out of memory\n", __func__);
+		return NULL;
+	}
+
+#define S(X, Y) ((TABLA_MBHC_CAL_GENERAL_PTR(tabla_cal)->X) = (Y))
+	S(t_ldoh, 100);
+	S(t_bg_fast_settle, 100);
+	S(t_shutdown_plug_rem, 255);
+	S(mbhc_nsa, 4);
+	S(mbhc_navg, 4);
+#undef S
+#define S(X, Y) ((TABLA_MBHC_CAL_PLUG_DET_PTR(tabla_cal)->X) = (Y))
+	S(mic_current, TABLA_PID_MIC_5_UA);
+	S(hph_current, TABLA_PID_MIC_5_UA);
+	S(t_mic_pid, 100);
+	S(t_ins_complete, 250);
+	S(t_ins_retry, 200);
+#undef S
+#define S(X, Y) ((TABLA_MBHC_CAL_PLUG_TYPE_PTR(tabla_cal)->X) = (Y))
+	S(v_no_mic, 30);
+	S(v_hs_max, 2400);
+#undef S
+#define S(X, Y) ((TABLA_MBHC_CAL_BTN_DET_PTR(tabla_cal)->X) = (Y))
+	S(c[0], 62);
+	S(c[1], 124);
+	S(nc, 1);
+	S(n_meas, 3);
+	S(mbhc_nsc, 11);
+	S(n_btn_meas, 1);
+	S(n_btn_con, 2);
+	S(num_btn, TABLA_MBHC_DEF_BUTTONS);
+	S(v_btn_press_delta_sta, 100);
+	S(v_btn_press_delta_cic, 50);
+#undef S
+	btn_cfg = TABLA_MBHC_CAL_BTN_DET_PTR(tabla_cal);
+	btn_low = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_V_BTN_LOW);
+	btn_high = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_V_BTN_HIGH);
+	btn_low[0] = -50;
+	btn_high[0] = 10;
+	btn_low[1] = 11;
+	btn_high[1] = 52;
+	btn_low[2] = 53;
+	btn_high[2] = 94;
+	btn_low[3] = 95;
+	btn_high[3] = 133;
+	btn_low[4] = 134;
+	btn_high[4] = 171;
+	btn_low[5] = 172;
+	btn_high[5] = 208;
+	btn_low[6] = 209;
+	btn_high[6] = 244;
+	btn_low[7] = 245;
+	btn_high[7] = 330;
+	n_ready = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_N_READY);
+	n_ready[0] = 80;
+	n_ready[1] = 68;
+	n_cic = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_N_CIC);
+	n_cic[0] = 60;
+	n_cic[1] = 47;
+	gain = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_GAIN);
+	gain[0] = 11;
+	gain[1] = 9;
+
+	return tabla_cal;
+}
+
+static int msm_hw_params(struct snd_pcm_substream *substream,
+				struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	int ret = 0;
+	unsigned int rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
+	unsigned int rx_ch_cnt = 0, tx_ch_cnt = 0;
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+
+		pr_debug("%s: rx_0_ch=%d\n", __func__, msm_slim_0_rx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+
+		ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
+				msm_slim_0_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai, 0, 0,
+				msm_slim_0_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	} else {
+
+		pr_debug("%s: %s  tx_dai_id = %d  num_ch = %d\n", __func__,
+			codec_dai->name, codec_dai->id, msm_slim_0_tx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(cpu_dai,
+				msm_slim_0_tx_ch, tx_ch, 0 , 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai,
+				msm_slim_0_tx_ch, tx_ch, 0, 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	}
+end:
+	return ret;
+}
+
+static const struct snd_kcontrol_new tabla_xbvol_controls[] = {
+         SOC_SINGLE_TLV("LINEOUT1XB Volume", TABLA_A_RX_LINE_1_GAIN, 0, 12, 1,
+                 line_gain),
+         SOC_SINGLE_TLV("LINEOUT3XB Volume", TABLA_A_RX_LINE_3_GAIN, 0, 12, 1,
+                 line_gain),
+};
+static const struct snd_kcontrol_new int_btsco_rate_mixer_controls[] = {
+	SOC_ENUM_EXT("Internal BTSCO SampleRate", msm_btsco_enum[0],
+		msm_btsco_rate_get, msm_btsco_rate_put),
+};
+
+static int msm_btsco_init(struct snd_soc_pcm_runtime *rtd)
+{
+	int err = 0;
+	struct snd_soc_platform *platform = rtd->platform;
+
+	err = snd_soc_add_platform_controls(platform,
+			int_btsco_rate_mixer_controls,
+		ARRAY_SIZE(int_btsco_rate_mixer_controls));
+	if (err < 0)
+		return err;
+	return 0;
+}
+
+static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
+{
+	int err;
+	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_dapm_context *dapm = &codec->dapm;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	u8 tabla_version;
+
+	pr_debug("%s(), dev_name%s\n", __func__, dev_name(cpu_dai->dev));
+
+	rtd->pmdown_time = 0;
+	if (system_rev == 1) 
+          {
+            //XB lower the receiver gain
+            err = snd_soc_add_codec_controls(codec, tabla_xbvol_controls,
+                                             ARRAY_SIZE(tabla_xbvol_controls));
+            if (err < 0)
+              return err;
+          }
+
+	snd_soc_dapm_new_controls(dapm, msm_dapm_widgets,
+				ARRAY_SIZE(msm_dapm_widgets));
+
+	snd_soc_dapm_new_controls(dapm, fighter_dapm_widgets,
+				ARRAY_SIZE(fighter_dapm_widgets));
+
+	snd_soc_dapm_add_routes(dapm, common_audio_map,
+		ARRAY_SIZE(common_audio_map));
+
+	/* determine HW connection based on codec revision */
+	tabla_version = snd_soc_read(codec, TABLA_A_CHIP_VERSION);
+	tabla_version &=  0x1F;
+	pr_err("%s : Tabla version %u\n", __func__, (u32)tabla_version);
+
+	if ((tabla_version == TABLA_VERSION_1_0) ||
+		(tabla_version == TABLA_VERSION_1_1)) {
+		snd_soc_dapm_add_routes(dapm, tabla_1_x_audio_map,
+			 ARRAY_SIZE(tabla_1_x_audio_map));
+	} else {
+		snd_soc_dapm_add_routes(dapm, tabla_2_x_audio_map,
+			 ARRAY_SIZE(tabla_2_x_audio_map));
+	}
+
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Pos");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Neg");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Pos");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Neg");
+
+	snd_soc_dapm_sync(dapm);
+
+	err = snd_soc_jack_new(codec, "Headset Jack",
+			       (SND_JACK_HEADSET | SND_JACK_OC_HPHL | SND_JACK_OC_HPHR),
+				&hs_jack);
+	if (err) {
+		pr_err("failed to create new jack\n");
+		return err;
+	}
+
+	err = snd_soc_jack_new(codec, "Button Jack",
+			       SND_JACK_BTN_0, &button_jack);
+	if (err) {
+		pr_err("failed to create new jack\n");
+		return err;
+	}
+
+	codec_clk = clk_get(cpu_dai->dev, "osr_clk");
+
+	/* Do not pass MBHC calibration data to disable HS detection.
+	 * Otherwise, sending project-based cal-data to enable
+	 * MBHC mechanism that tabla provides */
+	tabla_hs_detect(codec, &mbhc_cfg);
+
+	return 0;
+}
+
+static int msm_slim_0_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+			SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+	channels->min = channels->max = msm_slim_0_rx_ch;
+
+	return 0;
+}
+
+static int msm_slim_0_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+			SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+	channels->min = channels->max = msm_slim_0_tx_ch;
+
+	return 0;
+}
+
+static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+
+	return 0;
+}
+
+#if 0
+static int msm_hdmi_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s channels->min %u channels->max %u ()\n", __func__,
+			channels->min, channels->max);
+
+        rate->min = rate->max = 48000;
+
+	return 0;
+}
+#endif
+
+static int msm_btsco_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	rate->min = rate->max = msm_btsco_rate;
+	channels->min = channels->max = msm_btsco_ch;
+
+	return 0;
+}
+static int msm_auxpcm_be_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	rate->min = rate->max = msm_auxpcm_rate;
+	/* PCM only supports mono output */
+	channels->min = channels->max = 1;
+
+	return 0;
+}
+static int msm_aux_pcm_get_gpios(void)
+{
+	int ret = 0;
+
+	pr_debug("%s\n", __func__);
+
+	ret = gpio_request(GPIO_AUX_PCM_DOUT, "AUX PCM DOUT");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM DOUT",
+				__func__, GPIO_AUX_PCM_DOUT);
+		goto fail_dout;
+	}
+
+	ret = gpio_request(GPIO_AUX_PCM_DIN, "AUX PCM DIN");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM DIN",
+				__func__, GPIO_AUX_PCM_DIN);
+		goto fail_din;
+	}
+
+	ret = gpio_request(GPIO_AUX_PCM_SYNC, "AUX PCM SYNC");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM SYNC",
+				__func__, GPIO_AUX_PCM_SYNC);
+		goto fail_sync;
+	}
+	ret = gpio_request(GPIO_AUX_PCM_CLK, "AUX PCM CLK");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM CLK",
+				__func__, GPIO_AUX_PCM_CLK);
+		goto fail_clk;
+	}
+
+	return 0;
+
+fail_clk:
+	gpio_free(GPIO_AUX_PCM_SYNC);
+fail_sync:
+	gpio_free(GPIO_AUX_PCM_DIN);
+fail_din:
+	gpio_free(GPIO_AUX_PCM_DOUT);
+fail_dout:
+
+	return ret;
+}
+
+static int msm_aux_pcm_free_gpios(void)
+{
+	gpio_free(GPIO_AUX_PCM_DIN);
+	gpio_free(GPIO_AUX_PCM_DOUT);
+	gpio_free(GPIO_AUX_PCM_SYNC);
+	gpio_free(GPIO_AUX_PCM_CLK);
+
+	return 0;
+}
+static int msm_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
+	pr_debug("%s(): dai_link_str_name = %s cpu_dai = %s codec_dai = %s\n",
+		__func__, rtd->dai_link->stream_name,
+		rtd->dai_link->cpu_dai_name, rtd->dai_link->codec_dai_name);
+	return 0;
+}
+
+static int msm_auxpcm_startup(struct snd_pcm_substream *substream)
+{
+	int ret = 0;
+
+	pr_debug("%s(): substream = %s, auxpcm_rsc_ref counter = %d\n",
+		__func__, substream->name, atomic_read(&auxpcm_rsc_ref));
+	if (atomic_inc_return(&auxpcm_rsc_ref) == 1)
+		ret = msm_aux_pcm_get_gpios();
+
+	if (ret < 0) {
+		pr_err("%s: Aux PCM GPIO request failed\n", __func__);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static void msm_auxpcm_shutdown(struct snd_pcm_substream *substream)
+{
+	pr_debug("%s(): substream = %s, auxpcm_rsc_ref counter = %d\n",
+		__func__, substream->name, atomic_read(&auxpcm_rsc_ref));
+	if (atomic_dec_return(&auxpcm_rsc_ref) == 0)
+		msm_aux_pcm_free_gpios();
+}
+
+static void msm_shutdown(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
+	pr_debug("%s(): dai_link str_name = %s cpu_dai = %s codec_dai = %s\n",
+		__func__, rtd->dai_link->stream_name,
+		rtd->dai_link->cpu_dai_name, rtd->dai_link->codec_dai_name);
+}
+
+static struct snd_soc_ops msm_be_ops = {
+	.startup = msm_startup,
+	.hw_params = msm_hw_params,
+	.shutdown = msm_shutdown,
+};
+
+static struct snd_soc_ops msm_auxpcm_be_ops = {
+	.startup = msm_auxpcm_startup,
+	.shutdown = msm_auxpcm_shutdown,
+};
+
+/* Digital audio interface glue - connects codec <---> CPU */
+static struct snd_soc_dai_link msm_dai[] = {
+	/* FrontEnd DAI Links */
+	{
+		.name = "MSM8960 Media1",
+		.stream_name = "MultiMedia1",
+		.cpu_dai_name	= "MultiMedia1",
+		.platform_name  = "msm-pcm-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA1
+	},
+	{
+		.name = "MSM8960 Media2",
+		.stream_name = "MultiMedia2",
+		.cpu_dai_name	= "MultiMedia2",
+		.platform_name  = "msm-pcm-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA2,
+	},
+	{
+		.name = "Circuit-Switch Voice",
+		.stream_name = "CS-Voice",
+		.cpu_dai_name   = "CS-VOICE",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_CS_VOICE,
+	},
+	{
+		.name = "MSM VoIP",
+		.stream_name = "VoIP",
+		.cpu_dai_name	= "VoIP",
+		.platform_name  = "msm-voip-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_VOIP,
+	},
+	{
+		.name = "MSM8960 LPA",
+		.stream_name = "LPA",
+		.cpu_dai_name	= "MultiMedia3",
+		.platform_name  = "msm-pcm-lpa",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA3,
+	},
+	/* Hostless PMC purpose */
+	{
+		.name = "SLIMBUS_0 Hostless",
+		.stream_name = "SLIMBUS_0 Hostless",
+		.cpu_dai_name	= "SLIMBUS0_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		/* .be_id = do not care */
+	},
+	{
+		.name = "INT_FM Hostless",
+		.stream_name = "INT_FM Hostless",
+		.cpu_dai_name	= "INT_FM_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		/* .be_id = do not care */
+	},
+	{
+		.name = "MSM AFE-PCM RX",
+		.stream_name = "AFE-PROXY RX",
+		.cpu_dai_name = "msm-dai-q6.241",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.platform_name  = "msm-pcm-afe",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = "MSM AFE-PCM TX",
+		.stream_name = "AFE-PROXY TX",
+		.cpu_dai_name = "msm-dai-q6.240",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.platform_name  = "msm-pcm-afe",
+		.ignore_suspend = 1,
+	},
+	{
+		.name = "MSM8960 Compr",
+		.stream_name = "COMPR",
+		.cpu_dai_name	= "MultiMedia4",
+		.platform_name	= "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA4,
+	},
+	{
+		.name = "AUXPCM Hostless",
+		.stream_name = "AUXPCM Hostless",
+		.cpu_dai_name	= "AUXPCM_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	/* HDMI Hostless */
+	{
+		.name = "HDMI_RX_HOSTLESS",
+		.stream_name = "HDMI_RX_HOSTLESS",
+		.cpu_dai_name = "HDMI_HOSTLESS",
+		.platform_name = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	{
+		.name = "VoLTE",
+		.stream_name = "VoLTE",
+		.cpu_dai_name   = "VoLTE",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.be_id = MSM_FRONTEND_DAI_VOLTE,
+	},
+	{
+		.name = "Voice2",
+		.stream_name = "Voice2",
+		.cpu_dai_name   = "Voice2",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1,/* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.be_id = MSM_FRONTEND_DAI_VOICE2,
+	},
+	{
+		.name = "MSM8960 LowLatency",
+		.stream_name = "MultiMedia5",
+		.cpu_dai_name	= "MultiMedia5",
+		.platform_name  = "msm-lowlatency-pcm-dsp",
+		.dynamic = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.ignore_suspend = 1,
+		/* this dainlink has playback support */
+		.ignore_pmdown_time = 1,
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA5,
+	},
+	/* Backend BT/FM DAI Links */
+	{
+		.name = LPASS_BE_INT_BT_SCO_RX,
+		.stream_name = "Internal BT-SCO Playback",
+		.cpu_dai_name = "msm-dai-q6.12288",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name	= "msm-stub-rx",
+		.init = &msm_btsco_init,
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_BT_SCO_RX,
+		.be_hw_params_fixup = msm_btsco_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = LPASS_BE_INT_BT_SCO_TX,
+		.stream_name = "Internal BT-SCO Capture",
+		.cpu_dai_name = "msm-dai-q6.12289",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name	= "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_BT_SCO_TX,
+		.be_hw_params_fixup = msm_btsco_be_hw_params_fixup,
+	},
+	{
+		.name = LPASS_BE_INT_FM_RX,
+		.stream_name = "Internal FM Playback",
+		.cpu_dai_name = "msm-dai-q6.12292",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_FM_RX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = LPASS_BE_INT_FM_TX,
+		.stream_name = "Internal FM Capture",
+		.cpu_dai_name = "msm-dai-q6.12293",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_FM_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+#if 0
+	/* HDMI BACK END DAI Link */
+	{
+		.name = LPASS_BE_HDMI,
+		.stream_name = "HDMI Playback",
+		.cpu_dai_name = "msm-dai-q6-hdmi.8",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_HDMI_RX,
+		.be_hw_params_fixup = msm_hdmi_be_hw_params_fixup,
+	},
+#endif
+	/* Backend AFE DAI Links */
+	{
+		.name = LPASS_BE_AFE_PCM_RX,
+		.stream_name = "AFE Playback",
+		.cpu_dai_name = "msm-dai-q6.224",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AFE_PCM_RX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = LPASS_BE_AFE_PCM_TX,
+		.stream_name = "AFE Capture",
+		.cpu_dai_name = "msm-dai-q6.225",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AFE_PCM_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	/* AUX PCM Backend DAI Links */
+	{
+		.name = LPASS_BE_AUXPCM_RX,
+		.stream_name = "AUX PCM Playback",
+		.cpu_dai_name = "msm-dai-q6.2",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AUXPCM_RX,
+		.be_hw_params_fixup = msm_auxpcm_be_params_fixup,
+		.ops = &msm_auxpcm_be_ops,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = LPASS_BE_AUXPCM_TX,
+		.stream_name = "AUX PCM Capture",
+		.cpu_dai_name = "msm-dai-q6.3",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AUXPCM_TX,
+		.be_hw_params_fixup = msm_auxpcm_be_params_fixup,
+	},
+	/* Incall Music BACK END DAI Link */
+	{
+		.name = LPASS_BE_VOICE_PLAYBACK_TX,
+		.stream_name = "Voice Farend Playback",
+		.cpu_dai_name = "msm-dai-q6.32773",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	/* Incall Record Uplink BACK END DAI Link */
+	{
+		.name = LPASS_BE_INCALL_RECORD_TX,
+		.stream_name = "Voice Uplink Capture",
+		.cpu_dai_name = "msm-dai-q6.32772",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INCALL_RECORD_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	/* Incall Record Downlink BACK END DAI Link */
+	{
+		.name = LPASS_BE_INCALL_RECORD_RX,
+		.stream_name = "Voice Downlink Capture",
+		.cpu_dai_name = "msm-dai-q6.32771",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INCALL_RECORD_RX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	/* HTC_AUD_START LPA5 */
+	{
+		.name = "MSM8960 Media5",
+		.stream_name = "MultiMedia5",
+		.cpu_dai_name	= "MultiMedia5",
+		.platform_name	= "msm-pcm-routing",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dailink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA5
+	},
+	{
+		.name = "MSM8960 Media6",
+		.stream_name = "MultiMedia6",
+		.cpu_dai_name	= "MultiMedia6",
+		.platform_name	= "msm-pcm-routing",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dailink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA6
+	},
+	{
+		.name = "MSM8960 Compr2",
+		.stream_name = "COMPR2",
+		.cpu_dai_name	= "MultiMedia7",
+		.platform_name	= "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dailink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA7,
+	},
+	{
+		.name = "MultiMedia8 Playback",
+		.stream_name = "COMPR3",
+		.cpu_dai_name	= "MultiMedia8",
+		.platform_name	= "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dailink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA8,
+	},
+	/* HTC_AUD_END LPA5 */
+	/* Backend DAI Links */
+	{
+		.name = LPASS_BE_SLIMBUS_0_RX,
+		.stream_name = "Slimbus Playback",
+		.cpu_dai_name = "msm-dai-q6.16384",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla_codec",
+		.codec_dai_name	= "tabla_rx1",
+		.no_pcm = 1,
+                .dynamic = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
+		.init = &msm_audrx_init,
+		.be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = LPASS_BE_SLIMBUS_0_TX,
+		.stream_name = "Slimbus Capture",
+		.cpu_dai_name = "msm-dai-q6.16385",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla_codec",
+		.codec_dai_name	= "tabla_tx1",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
+		.be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+	},
+	/* Ultrasound TX Back End DAI Link */
+	{
+		.name = "SLIMBUS_2 Hostless",
+		.stream_name = "SLIMBUS_2 Hostless",
+		.cpu_dai_name = "msm-dai-q6.16389",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla_codec",
+		.codec_dai_name = "tabla_tx2",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_be_ops,
+	},
+	/* Ultrasound RX Back End DAI Link */
+	{
+		.name = "SLIMBUS_2 Hostless Playback",
+		.stream_name = "SLIMBUS_2 Hostless Playback",
+		.cpu_dai_name = "msm-dai-q6.16388",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla_codec",
+		.codec_dai_name = "tabla_rx3",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_be_ops,
+	},
+};
+
+static struct snd_soc_card snd_soc_card_msm8960 = {
+		.name		= "msm8960-snd-card",
+		.dai_link	= msm_dai,
+		.num_links	= ARRAY_SIZE(msm_dai),
+		.controls = tabla_msm_controls,
+		.num_controls = ARRAY_SIZE(tabla_msm_controls),
+};
+
+static struct platform_device *msm_snd_device;
+static struct platform_device *msm_snd_tabla1x_device;
+
+static int msm_configure_headset_mic_gpios(void)
+{
+	int ret;
+	struct pm_gpio param = {
+		.direction      = PM_GPIO_DIR_OUT,
+		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
+		.output_value   = 1,
+		.pull	   = PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength   = PM_GPIO_STRENGTH_MED,
+		.function       = PM_GPIO_FUNC_NORMAL,
+	};
+
+	ret = gpio_request(PM8921_GPIO_PM_TO_SYS(23), "AV_SWITCH");
+	if (ret) {
+		pr_err("%s: Failed to request gpio %d\n", __func__,
+			PM8921_GPIO_PM_TO_SYS(23));
+		return ret;
+	}
+
+	ret = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(23), &param);
+	if (ret)
+		pr_err("%s: Failed to configure gpio %d\n", __func__,
+			PM8921_GPIO_PM_TO_SYS(23));
+	else
+		gpio_direction_output(PM8921_GPIO_PM_TO_SYS(23), 0);
+
+	ret = gpio_request(us_euro_sel_gpio, "US_EURO_SWITCH");
+	if (ret) {
+		pr_err("%s: Failed to request gpio %d\n", __func__,
+		       us_euro_sel_gpio);
+		gpio_free(PM8921_GPIO_PM_TO_SYS(23));
+		return ret;
+	}
+	ret = pm8xxx_gpio_config(us_euro_sel_gpio, &param);
+	if (ret)
+		pr_err("%s: Failed to configure gpio %d\n", __func__,
+		       us_euro_sel_gpio);
+	else
+		gpio_direction_output(us_euro_sel_gpio, 0);
+
+	return 0;
+}
+static void msm_free_headset_mic_gpios(void)
+{
+	if (msm_headset_gpios_configured) {
+		gpio_free(PM8921_GPIO_PM_TO_SYS(23));
+		gpio_free(us_euro_sel_gpio);
+	}
+}
+
+static int __init msm_fighter_audio_init(void)
+{
+	int ret;
+
+	if (!soc_class_is_msm8960()) {
+		pr_debug("%s: Not the right machine type\n", __func__);
+		return -ENODEV ;
+	}        
+
+	mbhc_cfg.calibration = def_tabla_mbhc_cal();
+	if (!mbhc_cfg.calibration) {
+		pr_err("Calibration data allocation failed\n");
+		return -ENOMEM;
+	}
+	msm_snd_device = platform_device_alloc("soc-audio", 0);
+	if (!msm_snd_device) {
+		pr_err("Platform device allocation failed\n");
+		kfree(mbhc_cfg.calibration);
+		return -ENOMEM;
+	}
+	platform_set_drvdata(msm_snd_device, &snd_soc_card_msm8960);
+	ret = platform_device_add(msm_snd_device);
+	if (ret) {
+		platform_device_put(msm_snd_device);
+		kfree(mbhc_cfg.calibration);
+		return ret;
+	}
+
+	if (cpu_is_msm8960()) {
+		if (msm_configure_headset_mic_gpios()) {
+			pr_err("%s Fail to configure headset mic gpios\n",
+								__func__);
+			msm_headset_gpios_configured = 0;
+		} else
+			msm_headset_gpios_configured = 1;
+	} else {
+		msm_headset_gpios_configured = 0;
+		pr_debug("%s headset GPIO 23 and 35 not configured msm960ab",
+								__func__);
+	}
+
+	mutex_init(&cdc_mclk_mutex);
+	atomic_set(&auxpcm_rsc_ref, 0);
+	return ret;
+
+}
+module_init(msm_fighter_audio_init);
+
+static void __exit msm_audio_exit(void)
+{
+	if (!soc_class_is_msm8960()) {
+		pr_debug("%s: Not the right machine type\n", __func__);
+		return ;
+	}
+	msm_free_headset_mic_gpios();
+	platform_device_unregister(msm_snd_device);
+	platform_device_unregister(msm_snd_tabla1x_device);
+	kfree(mbhc_cfg.calibration);
+	mutex_destroy(&cdc_mclk_mutex);
+}
+module_exit(msm_audio_exit);
+
+MODULE_DESCRIPTION("ALSA SoC MSM8960");
+MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-msm/htc/fighter/board-fighter-camera.c b/arch/arm/mach-msm/htc/fighter/board-fighter-camera.c
new file mode 100644
index 0000000..343dd24
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/board-fighter-camera.c
@@ -0,0 +1,1135 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <asm/mach-types.h>
+#include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <mach/board.h>
+#include <mach/msm_bus_board.h>
+#include <mach/gpiomux.h>
+#include <asm/setup.h>
+
+#include "devices.h"
+#include "board-fighter.h"
+
+#include <linux/spi/spi.h>
+
+#include "board-mahimahi-flashlight.h"
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#include <linux/htc_flashlight.h>
+#endif
+
+#ifdef CONFIG_MSM_CAMERA
+#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
+static int camera_sensor_power_enable(char *power, unsigned volt, struct regulator **sensor_power);
+static int camera_sensor_power_disable(struct regulator *sensor_power);
+
+static struct platform_device msm_camera_server = {
+	.name = "msm_cam_server",
+	.id = 0,
+};
+
+static struct gpiomux_setting cam_settings[5] = {
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*suspend*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_DOWN,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_1, /*active 1*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*active 2*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_OUT_LOW,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_1, /*active 3*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_2, /*active 4*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+};
+
+static struct msm_gpiomux_config fighter_cam_configs[] = {
+	{
+		.gpio = FIGHTER_CAM_MCLK1,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[4],
+			[GPIOMUX_SUSPENDED] = &cam_settings[2],
+		},
+	},
+	{
+		.gpio = FIGHTER_CAM_MCLK0,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[1],
+			[GPIOMUX_SUSPENDED] = &cam_settings[2],
+		},
+	},
+	{
+		.gpio = FIGHTER_CAM_I2C_SDA,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[3],
+			[GPIOMUX_SUSPENDED] = &cam_settings[0],
+		},
+	},
+	{
+		.gpio = FIGHTER_CAM_I2C_SCL,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[3],
+			[GPIOMUX_SUSPENDED] = &cam_settings[0],
+		},
+	},
+};
+
+static struct msm_bus_vectors cam_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+};
+
+static struct msm_bus_vectors cam_preview_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 96215040,
+		.ib  = 378224640,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+};
+
+static struct msm_bus_vectors cam_video_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 342150912,
+		.ib  = 1361968128,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 207747072,
+		.ib  = 489756672,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 60318720,
+		.ib  = 150796800,
+	},
+};
+
+static struct msm_bus_vectors cam_snapshot_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 147045888,
+		.ib  = 588183552,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 263678976,
+		.ib  = 659197440,
+	},
+};
+
+static struct msm_bus_vectors cam_zsl_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 319044096,
+		.ib  = 1271531520,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 239708160,
+		.ib  = 599270400,
+	},
+};
+
+static struct msm_bus_paths cam_bus_client_config[] = {
+	{
+		ARRAY_SIZE(cam_init_vectors),
+		cam_init_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_preview_vectors),
+		cam_preview_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_video_vectors),
+		cam_video_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_snapshot_vectors),
+		cam_snapshot_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_zsl_vectors),
+		cam_zsl_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata cam_bus_client_pdata = {
+		cam_bus_client_config,
+		ARRAY_SIZE(cam_bus_client_config),
+		.name = "msm_camera",
+};
+
+static int fighter_csi_vreg_on(void);
+static int fighter_csi_vreg_off(void);
+
+struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
+	{
+		.ioclk.mclk_clk_rate = 24000000,
+		.ioclk.vfe_clk_rate  = 228570000,
+		.csid_core = 0,
+		.camera_csi_on = fighter_csi_vreg_on,
+		.camera_csi_off = fighter_csi_vreg_off,
+		.cam_bus_scale_table = &cam_bus_client_pdata,
+		.is_csiphy = 1,
+		.is_csid   = 1,
+		.is_ispif  = 1,
+		.is_vpe    = 1,
+	},
+	{
+		.ioclk.mclk_clk_rate = 24000000,
+		.ioclk.vfe_clk_rate  = 228570000,
+		.csid_core = 1,
+		.camera_csi_on = fighter_csi_vreg_on,
+		.camera_csi_off = fighter_csi_vreg_off,
+		.cam_bus_scale_table = &cam_bus_client_pdata,
+		.is_csiphy = 1,
+		.is_csid   = 1,
+		.is_ispif  = 1,
+		.is_vpe    = 1,
+	},
+};
+
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#define LED_ON				1
+#define LED_OFF				0
+
+int fighter_flashlight_control(int mode)
+{
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+	return tps61310_flashlight_control(mode);
+#else
+	return 0;
+#endif
+}
+
+static struct msm_camera_sensor_flash_src msm_flash_src = {
+	.flash_sr_type = MSM_CAMERA_FLASH_SRC_CURRENT_DRIVER,
+	.camera_flash = fighter_flashlight_control,
+};
+#endif /* CONFIG_MSM_CAMERA_FLASH */
+
+static struct regulator *reg_8921_l2;
+static struct regulator *reg_8921_l8;
+static struct regulator *reg_8921_l9;
+static struct regulator *reg_8921_l12;
+static struct regulator *reg_8921_lvs6;
+
+static uint16_t msm_cam_gpio_tbl[] = {
+	FIGHTER_CAM_MCLK0, /*CAMIF_MCLK*/
+	FIGHTER_CAM_MCLK1,
+#if 0
+	FIGHTER_CAM_I2C_DAT, /*CAMIF_I2C_DATA*/
+	FIGHTER_CAM_I2C_CLK, /*CAMIF_I2C_CLK*/
+#endif
+};
+
+static struct msm_camera_gpio_conf gpio_conf = {
+	.cam_gpiomux_conf_tbl = NULL,
+	.cam_gpiomux_conf_tbl_size = 0,
+	.cam_gpio_tbl = msm_cam_gpio_tbl,
+	.cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_tbl),
+};
+
+static int camera_sensor_power_enable(char *power, unsigned volt, struct regulator **sensor_power)
+{
+	int rc;
+
+	if (power == NULL)
+		return -ENODEV;
+
+	*sensor_power = regulator_get(NULL, power);
+
+	if (IS_ERR(*sensor_power)) {
+		pr_err("[CAM] %s: Unable to get %s\n", __func__, power);
+		return -ENODEV;
+	}
+
+	if (volt != 1800000) {
+		rc = regulator_set_voltage(*sensor_power, volt, volt);
+		if (rc < 0) {
+			pr_err("[CAM] %s: unable to set %s voltage to %d rc:%d\n",
+					__func__, power, volt, rc);
+			regulator_put(*sensor_power);
+			*sensor_power = NULL;
+			return -ENODEV;
+		}
+	}
+
+	rc = regulator_enable(*sensor_power);
+	if (rc < 0) {
+		pr_err("[CAM] %s: Enable regulator %s failed\n", __func__, power);
+		regulator_put(*sensor_power);
+		*sensor_power = NULL;
+		return -ENODEV;
+	}
+
+	return rc;
+}
+
+static int camera_sensor_power_disable(struct regulator *sensor_power)
+{
+
+	int rc;
+	if (sensor_power == NULL)
+		return -ENODEV;
+
+	if (IS_ERR(sensor_power)) {
+		pr_err("[CAM] %s: Invalid requlator ptr\n", __func__);
+		return -ENODEV;
+	}
+
+	rc = regulator_disable(sensor_power);
+	if (rc < 0)
+		pr_err("[CAM] %s: disable regulator failed\n", __func__);
+
+	regulator_put(sensor_power);
+	sensor_power = NULL;
+	return rc;
+}
+
+static int fighter_csi_vreg_on(void)
+{
+	pr_info("%s\n", __func__);
+	return camera_sensor_power_enable("8921_l2", 1200000, &reg_8921_l2);
+}
+
+static int fighter_csi_vreg_off(void)
+{
+	pr_info("%s\n", __func__);
+	return camera_sensor_power_disable(reg_8921_l2);
+}
+
+#ifdef CONFIG_S5K3H2YX
+static int fighter_s5k3h2yx_vreg_on(void)
+{
+	int rc;
+	pr_info("[CAM] %s\n", __func__);
+
+	/* VCM */
+	rc = camera_sensor_power_enable("8921_l9", 2800000, &reg_8921_l9);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"8921_l9\", 2.8V) FAILED %d\n", rc);
+		goto enable_vcm_fail;
+	}
+
+	/* IO */
+	rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+		goto enable_io_fail;
+	}
+
+	/* analog */
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"8921_l8\", 2.8V) FAILED %d\n", rc);
+		goto enable_analog_fail;
+	}
+
+	udelay(50);
+
+	/* digital */
+	if (system_rev >= 2) {	/* fighter use LDO by GPIO95 on XC */
+		rc = gpio_request(FIGHTER_CAM_EXT_LDO, "CAM_EXT_LDO");
+		if (rc < 0)
+			pr_err("[CAM] %s: gpio %d request failed, rc=%d\n", __func__,
+				FIGHTER_CAM_EXT_LDO, rc);
+		else {
+			gpio_direction_output(FIGHTER_CAM_EXT_LDO, 1);
+			gpio_free(FIGHTER_CAM_EXT_LDO);
+		}
+	}
+	else
+		rc = camera_sensor_power_enable("8921_l12", 1200000, &reg_8921_l12);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"8921_l12\", 1.5) FAILED %d\n", rc);
+		goto enable_digital_fail;
+	}
+
+	return rc;
+
+enable_digital_fail:
+	camera_sensor_power_disable(reg_8921_l8);
+enable_analog_fail:
+	camera_sensor_power_disable(reg_8921_lvs6);
+enable_io_fail:
+	camera_sensor_power_disable(reg_8921_l9);
+enable_vcm_fail:
+	return rc;
+}
+
+static int fighter_s5k3h2yx_vreg_off(void)
+{
+	int rc = 0;
+
+	pr_info("[CAM] %s\n", __func__);
+
+	/* VCM */
+	rc = camera_sensor_power_disable(reg_8921_l9);
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable(\"8921_l9\") FAILED %d\n", rc);
+
+	/* digital */
+	if (system_rev >= 2) {	/* fighter use LDO by GPIO95 on XC */
+		rc = gpio_request(FIGHTER_CAM_EXT_LDO, "CAM_EXT_LDO");
+		if (rc < 0)
+			pr_err("[CAM] %s: gpio %d request failed, rc=%d\n", __func__,
+				FIGHTER_CAM_EXT_LDO, rc);
+		else {
+			gpio_direction_output(FIGHTER_CAM_EXT_LDO, 0);
+			gpio_free(FIGHTER_CAM_EXT_LDO);
+		}
+	}
+	else
+		rc = camera_sensor_power_disable(reg_8921_l12);
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable(\"8921_l12\") FAILED %d\n", rc);
+
+	/* analog */
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable(\"8921_l8\") FAILED %d\n", rc);
+
+	udelay(50);
+
+	/* IO */
+	rc = camera_sensor_power_disable(reg_8921_lvs6);
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable(\"8921_lvs6\") FAILED %d\n", rc);
+
+	return rc;
+}
+
+#ifdef CONFIG_S5K3H2YX_ACT
+static struct i2c_board_info s5k3h2yx_actuator_i2c_info = {
+	I2C_BOARD_INFO("s5k3h2yx_act", 0x11),
+};
+
+static struct msm_actuator_info s5k3h2yx_actuator_info = {
+	.board_info     = &s5k3h2yx_actuator_i2c_info,
+	.bus_id         = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+	.vcm_pwd        = FIGHTER_CAM_VCM_PD,
+	.vcm_enable     = 1,
+};
+#endif
+
+static struct msm_camera_csi_lane_params s5k3h2yx_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x3,
+};
+
+static struct msm_camera_sensor_platform_info sensor_s5k3h2yx_board_info = {
+	.mount_angle = 90,
+	.mirror_flip = CAMERA_SENSOR_MIRROR_FLIP,
+	.sensor_reset_enable = 0,
+	.sensor_reset	= 0,
+	.sensor_pwd	= FIGHTER_CAM_PWDN,
+	.vcm_pwd	= FIGHTER_CAM_VCM_PD,
+	.vcm_enable	= 1,
+	.csi_lane_params = &s5k3h2yx_csi_lane_params,
+};
+
+/* Andrew_Cheng linear led 20111205 MB */
+static struct camera_led_est msm_camera_sensor_s5k3h2yx_led_table[] = {
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL1,
+		.current_ma = 150,
+		.lumen_value = 150,
+		.min_step = 50,
+		.max_step = 70
+	},
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,//245,//240,   //mk0118
+		.min_step = 44,
+		.max_step = 52
+	},
+		{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL3,
+		.current_ma = 300,
+		.lumen_value = 300,
+		.min_step = 29,
+		.max_step = 34
+	},
+		{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL4,
+		.current_ma = 400,
+		.lumen_value = 400,
+		.min_step = 27,
+		.max_step = 28
+	},
+		{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL5,
+		.current_ma = 500,
+		.lumen_value = 500,
+		.min_step = 25,
+		.max_step = 26
+	},
+		{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL6,
+		.current_ma = 600,
+		.lumen_value = 600,
+		.min_step = 23,
+		.max_step = 24
+	},
+		{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL7,
+		.current_ma = 700,
+		.lumen_value = 700,
+		.min_step = 21,
+		.max_step = 22
+	},
+	{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 750,//740,//725,   //mk0118
+		.min_step = 0,
+		.max_step = 43
+	},
+	{
+		.enable = 2,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,//245,
+		.min_step = 0,
+		.max_step = 270
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_OFF,
+		.current_ma = 0,
+		.lumen_value = 0,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH,
+		.current_ma = 150,
+		.lumen_value = 150,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 2,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 750,//740,//725,
+		.min_step = 271,
+		.max_step = 325
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL5,
+		.current_ma = 500,
+		.lumen_value = 500,
+		.min_step = 25,
+		.max_step = 26
+	},
+	{
+		.enable = 3,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 750,//740,//725,
+		.min_step = 271,
+		.max_step = 325
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH_LEVEL_2,
+		.current_ma = 200,
+		.lumen_value = 75,
+		.min_step = 0,
+		.max_step = 40
+	},
+};
+
+static struct camera_led_info msm_camera_sensor_s5k3h2yx_led_info = {
+	.enable = 1,
+	.low_limit_led_state = FL_MODE_TORCH,
+	.max_led_current_ma = 800,
+	.num_led_est_table = ARRAY_SIZE(msm_camera_sensor_s5k3h2yx_led_table),
+};
+
+static struct camera_flash_info msm_camera_sensor_s5k3h2yx_flash_info = {
+	.led_info = &msm_camera_sensor_s5k3h2yx_led_info,
+	.led_est_table = msm_camera_sensor_s5k3h2yx_led_table,
+};
+
+static struct camera_flash_cfg msm_camera_sensor_s5k3h2yx_flash_cfg = {
+	.low_temp_limit		= 5,
+	.low_cap_limit		= 15,
+	.flash_info             = &msm_camera_sensor_s5k3h2yx_flash_info,
+};
+/* Andrew_Cheng linear led 20111205 ME */
+
+static struct msm_camera_sensor_flash_data flash_s5k3h2yx = {
+	.flash_type	= MSM_CAMERA_FLASH_LED,
+#ifdef CONFIG_MSM_CAMERA_FLASH
+	.flash_src	= &msm_flash_src,
+#endif
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_s5k3h2yx_data = {
+	.sensor_name	= "s5k3h2yx",
+	.camera_power_on = fighter_s5k3h2yx_vreg_on,
+	.camera_power_off = fighter_s5k3h2yx_vreg_off,
+	.pdata	= &msm_camera_csi_device_data[0],
+	.flash_data	= &flash_s5k3h2yx,
+	.sensor_platform_info = &sensor_s5k3h2yx_board_info,
+	.gpio_conf = &gpio_conf,
+	.csi_if	= 1,
+#ifdef CONFIG_S5K3H2YX_ACT
+	.actuator_info = &s5k3h2yx_actuator_info,
+#endif
+	.use_rawchip = 0,
+	.flash_cfg = &msm_camera_sensor_s5k3h2yx_flash_cfg, /* Andrew_Cheng linear led 20111205 */
+	.camera_type = BACK_CAMERA_2D,
+};
+
+struct platform_device fighter_camera_sensor_s5k3h2yx = {
+	.name	= "msm_camera_s5k3h2yx",
+	.dev	= {
+		.platform_data = &msm_camera_sensor_s5k3h2yx_data,
+	},
+};
+#endif /* CONFIG_S5K3H2YX */
+
+//HTC start Tom Lin 2011/12/19
+#ifdef CONFIG_IMX105
+static int fighter_imx105_vreg_on(void)
+{
+	int rc;
+	pr_info("%s\n", __func__);
+
+	/* VCM */
+	rc = camera_sensor_power_enable("8921_l9", 2800000, &reg_8921_l9);//based on 8921_l9 definition needs to be between 2.8 to 2.85v
+	if (rc < 0) {
+		pr_err("sensor_power_enable(\"8921_l9\", 2.8V) FAILED %d\n", rc);
+		goto enable_vcm_fail;
+	}
+
+	pr_info("imx105 VCM on\n");
+
+
+	/* analog */
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);//based on 8921_l9 definition needs to be between 2.8 to 2.85v
+	if (rc < 0) {
+		pr_err("sensor_power_enable(\"8921_l8\", 2.8V) FAILED %d\n", rc);
+		goto enable_analog_fail;
+	}	   
+
+	pr_info("imx105 A on\n");
+
+	udelay(50);
+
+	/* digital */
+	if (system_rev >= 2) {	/* fighter use LDO by GPIO95 on XC */
+		pr_err("system_rev >=2:vreg on");
+		rc = gpio_request(FIGHTER_CAM_EXT_LDO, "CAM_EXT_LDO");
+		if (rc < 0)
+			pr_err(" %s: gpio %d request failed, rc=%d\n", __func__,
+					FIGHTER_CAM_EXT_LDO, rc);
+		else {
+			gpio_direction_output(FIGHTER_CAM_EXT_LDO, 1);
+			gpio_free(FIGHTER_CAM_EXT_LDO);
+		}
+	}
+	else{
+		pr_err("system_rev <2:vreg on");
+		rc = camera_sensor_power_enable("8921_l12", 1260000, &reg_8921_l12);/*Tom 20120224 increase to 1.26v for 876MHz*/
+	}
+
+	if (rc < 0) {
+		pr_err("sensor_power_enable(\"8921_l12\", 1.2V) FAILED %d\n", rc);
+		goto enable_digital_fail;
+	}
+
+	pr_info("imx105 D on\n");
+	/* IO */
+	rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+	if (rc < 0) {
+		pr_err("sensor_power_enable(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+		goto enable_io_fail;
+	}
+
+	pr_info("imx105 IO on\n");
+
+	return rc;
+
+enable_digital_fail:
+	camera_sensor_power_disable(reg_8921_l12);
+enable_analog_fail:
+	camera_sensor_power_disable(reg_8921_l8);
+enable_io_fail:
+	camera_sensor_power_disable(reg_8921_lvs6);
+enable_vcm_fail:
+	camera_sensor_power_disable(reg_8921_l9);
+	return rc;
+}
+
+static int fighter_imx105_vreg_off(void)
+{
+	int rc = 0;
+
+	pr_info("%s\n", __func__);
+
+	/* IO */
+	rc = camera_sensor_power_disable(reg_8921_lvs6);
+	pr_info("imx105 IO off\n");
+	if (rc < 0)
+		pr_err("sensor_power_disable(\"8921_lvs6\") FAILED %d\n", rc);
+
+	/* digital */
+	if (system_rev >= 2) {	/* fighter use LDO by GPIO95 on XC */
+		pr_err("system_rev >=2:vreg off");
+		rc = gpio_request(FIGHTER_CAM_EXT_LDO, "CAM_EXT_LDO");
+		if (rc < 0)
+			pr_err("%s: gpio %d request failed, rc=%d\n", __func__,
+					FIGHTER_CAM_EXT_LDO, rc);
+		else {
+			gpio_direction_output(FIGHTER_CAM_EXT_LDO, 0);
+			gpio_free(FIGHTER_CAM_EXT_LDO);
+		}
+	}
+	else{
+		pr_err("system_rev <2:vreg off");
+		rc = camera_sensor_power_disable(reg_8921_l12);
+		pr_info("imx105 D off\n");
+	}
+	if (rc < 0)
+		pr_err("sensor_power_disable(\"8921_l12\") FAILED %d\n", rc);	
+
+	/* analog */
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	pr_info("imx105 A off\n");
+	if (rc < 0)
+		pr_err("sensor_power_disable(\"8921_l8\") FAILED %d\n", rc);	
+
+	udelay(50);
+
+	/* VCM */
+	rc = camera_sensor_power_disable(reg_8921_l9);
+	pr_info("imx105 VCM off\n");
+	if (rc < 0)
+		pr_err("sensor_power_disable(\"8921_l9\") FAILED %d\n", rc);
+
+	return rc;
+}
+
+#ifdef CONFIG_IMX105_ACT
+static struct i2c_board_info imx105_actuator_i2c_info = {
+	I2C_BOARD_INFO("imx105_act", 0x1B),
+};
+
+static struct msm_actuator_info imx105_actuator_info = {
+	.board_info     = &imx105_actuator_i2c_info,
+	.bus_id         = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+	.vcm_pwd        = FIGHTER_CAM_VCM_PD,
+	.vcm_enable     = 1,
+};
+#endif
+
+static struct msm_camera_csi_lane_params imx105_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x1,
+};
+
+static struct msm_camera_sensor_platform_info sensor_imx105_board_info = {
+	.mount_angle = 90,
+	.mirror_flip = CAMERA_SENSOR_NONE,
+	.sensor_reset_enable = 0,
+	.sensor_reset	= 0,
+	.sensor_pwd	= FIGHTER_CAM_PWDN,
+	.vcm_pwd	= FIGHTER_CAM_VCM_PD,
+	.vcm_enable	= 1,
+	.csi_lane_params = &imx105_csi_lane_params,
+};
+
+/* Andrew_Cheng linear led 20111205 MB */
+static struct camera_led_est msm_camera_sensor_imx105_led_table[] = {
+	{
+		.enable = 0,
+		.led_state = FL_MODE_OFF,
+		.current_ma = 0,
+		.lumen_value = 0,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH,
+		.current_ma = 150,
+		.lumen_value = 150,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 800,
+		.lumen_value = 800,
+		.min_step = 33,
+		.max_step = 42
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_PRE_FLASH,
+		.current_ma = 100,
+		.lumen_value = 100,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 800,
+		.lumen_value = 800,
+		.min_step = 40,
+		.max_step = 52
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH_LEVEL_2,
+		.current_ma = 200,
+		.lumen_value = 264,
+		.min_step = 0,
+		.max_step = 39
+	},
+};
+
+static struct camera_led_info msm_camera_sensor_imx105_led_info = {
+	.enable = 1,
+	.low_limit_led_state = FL_MODE_TORCH,
+	.max_led_current_ma = 800,
+	.num_led_est_table = ARRAY_SIZE(msm_camera_sensor_imx105_led_table),
+};
+
+static struct camera_flash_info msm_camera_sensor_imx105_flash_info = {
+	.led_info = &msm_camera_sensor_imx105_led_info,
+	.led_est_table = msm_camera_sensor_imx105_led_table,
+};
+
+static struct camera_flash_cfg msm_camera_sensor_imx105_flash_cfg = {
+	.low_temp_limit		= 5,
+	.low_cap_limit		= 15,
+	.flash_info		= &msm_camera_sensor_imx105_flash_info,
+};
+/* Andrew_Cheng linear led 20111205 ME */
+
+static struct msm_camera_sensor_flash_data flash_imx105 = {
+	.flash_type	= MSM_CAMERA_FLASH_LED,
+#ifdef CONFIG_MSM_CAMERA_FLASH
+	.flash_src	= &msm_flash_src,
+#endif
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_imx105_data = {
+	.sensor_name		= "imx105",
+	.camera_power_on	= fighter_imx105_vreg_on,
+	.camera_power_off	= fighter_imx105_vreg_off,
+	.pdata			= &msm_camera_csi_device_data[0],
+	.flash_data		= &flash_imx105,
+	.sensor_platform_info	= &sensor_imx105_board_info,
+	.gpio_conf		= &gpio_conf,
+	.csi_if			= 1,
+#ifdef CONFIG_IMX105_ACT
+	.actuator_info		= &imx105_actuator_info,
+#endif
+	.use_rawchip		= 0,
+	.camera_type		= BACK_CAMERA_2D,
+	.flash_cfg		= &msm_camera_sensor_imx105_flash_cfg,
+	/* Andrew_Cheng linear led 20111205 */
+};
+
+struct platform_device fighter_camera_sensor_imx105 = {
+	.name	= "msm_camera_imx105",
+	.dev	= {
+		.platform_data = &msm_camera_sensor_imx105_data,
+	},
+};
+#endif /* CONFIG_IMX105 */
+//HTC end Tom Lin 2011/12/19
+
+#ifdef CONFIG_MT9V113
+static int fighter_mt9v113_vreg_on(void)
+{
+	int rc;
+
+	pr_info("[CAM] %s\n", __func__);
+
+	/* IO */
+	rc = gpio_request(FIGHTER_V_CAM2_D1V8_EN, "CAM_D1V8_EN");
+	pr_info("[CAM] fighter_mt9v113_vreg_on %d 1v8\n", FIGHTER_V_CAM2_D1V8_EN);
+	if (rc) {
+		pr_err("[CAM] %s:GPIO_CAM_D1V8_EN gpio %d request failed, rc=%d\n", __func__,  FIGHTER_V_CAM2_D1V8_EN, rc);
+		goto init_fail;
+	}
+	gpio_direction_output(FIGHTER_V_CAM2_D1V8_EN, 1);
+	gpio_free(FIGHTER_V_CAM2_D1V8_EN);
+
+	udelay(50);
+
+	/* Reset */
+	rc = gpio_request(FIGHTER_CAM2_RSTz, "mt9v113");
+	if (!rc) {
+		gpio_direction_output(FIGHTER_CAM2_RSTz, 1);
+		msleep(2);
+	}	else
+		pr_err("[CAM] %s:FIGHTER_CAM2_RSTz gpio %d request failed, rc=%d\n", __func__,  FIGHTER_CAM2_RSTz, rc);
+	gpio_free(FIGHTER_CAM2_RSTz);
+
+	udelay(50);
+
+	/* analog */
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);
+	pr_info("[CAM] sensor_power_enable(\"8921_l8\", 2.8V) == %d\n", rc);
+
+	if (rc < 0)
+		goto init_fail;
+
+	udelay(50);
+
+	/* digital */
+	rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+	pr_info("[CAM] sensor_power_enable(\"8921_lvs6\", 1.8V) == %d\n", rc);
+
+	if (rc < 0)
+		goto init_fail;
+
+	udelay(50);
+
+init_fail:
+	return rc;
+}
+
+static int fighter_mt9v113_vreg_off(void)
+{
+	int rc;
+
+	pr_info("[CAM] %s\n", __func__);
+
+	/* digital */
+	rc = camera_sensor_power_disable(reg_8921_lvs6);
+	pr_info("[CAM] camera_sensor_power_disable(\"8921_lvs6\", 1.8V) == %d\n", rc);
+
+	if (rc < 0)
+		goto init_fail;
+
+	udelay(50);
+
+	/* analog */
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	pr_info("[CAM] camera_sensor_power_disable(\"8921_l8\", 2.8V) == %d\n", rc);
+
+	if (rc < 0)
+		goto init_fail;
+
+	udelay(50);
+
+	/* IO */
+	rc = gpio_request(FIGHTER_V_CAM2_D1V8_EN, "CAM_D1V8_EN");
+	pr_info("[CAM] fighter_mt9v113_vreg_off %d 1v8\n", FIGHTER_V_CAM2_D1V8_EN);
+	if (rc) {
+		pr_err("[CAM] %s:GPIO_CAM_D1V8_EN gpio %d request failed, rc=%d\n", __func__,  FIGHTER_V_CAM2_D1V8_EN, rc);
+		goto init_fail;
+	}
+	gpio_direction_output(FIGHTER_V_CAM2_D1V8_EN, 0);
+	gpio_free(FIGHTER_V_CAM2_D1V8_EN);
+
+	udelay(50);
+
+	/* Reset */
+	rc = gpio_request(FIGHTER_CAM2_RSTz, "mt9v113");
+	if (!rc) {
+		gpio_direction_output(FIGHTER_CAM2_RSTz, 0);
+		msleep(2);
+	} else
+		pr_err("[CAM] %s:FIGHTER_CAM2_RSTz gpio %d request failed, rc=%d\n", __func__,	FIGHTER_CAM2_RSTz, rc);
+	gpio_free(FIGHTER_CAM2_RSTz);
+
+	udelay(50);
+
+init_fail:
+		return rc;
+}
+
+static struct msm_camera_csi_lane_params mt9v113_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x1,
+};
+
+static struct msm_camera_sensor_platform_info sensor_mt9v113_board_info = {
+	.mount_angle = 270,
+	.mirror_flip = CAMERA_SENSOR_NONE,
+	.sensor_reset_enable = 1,
+	.sensor_reset	= FIGHTER_CAM2_RSTz,
+	.sensor_pwd	= FIGHTER_CAM_PWDN,
+	.vcm_pwd	= 0,
+	.vcm_enable	= 1,
+	.csi_lane_params = &mt9v113_csi_lane_params,
+};
+
+static struct msm_camera_sensor_flash_data flash_mt9v113 = {
+	.flash_type	= MSM_CAMERA_FLASH_NONE,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_mt9v113_data = {
+	.sensor_name	= "mt9v113",
+	.sensor_reset	= FIGHTER_CAM2_RSTz,
+	.sensor_pwd	= FIGHTER_CAM_PWDN,
+	.vcm_pwd	= 0,
+	.vcm_enable	= 1,
+	.camera_power_on = fighter_mt9v113_vreg_on,
+	.camera_power_off = fighter_mt9v113_vreg_off,
+	.pdata	= &msm_camera_csi_device_data[1],
+	.flash_data	= &flash_mt9v113,
+	.sensor_platform_info = &sensor_mt9v113_board_info,
+	.gpio_conf = &gpio_conf,
+	.csi_if	= 1,
+	.camera_type = FRONT_CAMERA_2D,
+	.use_rawchip = 0,
+};
+
+struct platform_device fighter_camera_sensor_mt9v113 = {
+	.name	= "msm_camera_mt9v113",
+	.dev	= {
+		.platform_data = &msm_camera_sensor_mt9v113_data,
+	},
+};
+#endif /* CONFIG_MT9V113 */
+
+struct i2c_board_info fighter_camera_i2c_boardinfo[] = {
+#ifdef CONFIG_S5K3H2YX
+	{
+		I2C_BOARD_INFO("s5k3h2yx", 0x20 >> 1),
+		.platform_data = &msm_camera_sensor_s5k3h2yx_data,
+	},
+#endif
+	//HTC start Tom Lin 2011/12/19
+#ifdef CONFIG_IMX105
+	{
+		I2C_BOARD_INFO("imx105", 0x1A),
+		.platform_data = &msm_camera_sensor_imx105_data,
+	},
+#endif
+	//HTC end Tom Lin 2011/12/19
+#ifdef CONFIG_MT9V113
+	{
+		I2C_BOARD_INFO("mt9v113", 0x3C),
+		.platform_data = &msm_camera_sensor_mt9v113_data,
+	},
+#endif
+};
+
+struct msm_camera_board_info fighter_camera_board_info = {
+	.board_info = fighter_camera_i2c_boardinfo,
+	.num_i2c_board_info = ARRAY_SIZE(fighter_camera_i2c_boardinfo),
+};
+#endif /* CONFIG_MSM_CAMERA */
+
+void __init fighter_init_camera(void)
+{
+#ifdef CONFIG_MSM_CAMERA
+	msm_gpiomux_install(fighter_cam_configs,
+			ARRAY_SIZE(fighter_cam_configs));
+
+	platform_device_register(&msm_camera_server);
+	platform_device_register(&msm8960_device_i2c_mux_gsbi4);
+	platform_device_register(&msm8960_device_csiphy0);
+	platform_device_register(&msm8960_device_csiphy1);
+	platform_device_register(&msm8960_device_csid0);
+	platform_device_register(&msm8960_device_csid1);
+	platform_device_register(&msm8960_device_ispif);
+	platform_device_register(&msm8960_device_vfe);
+	platform_device_register(&msm8960_device_vpe);
+#endif /* CONFIG_MSM_CAMERA */
+}
diff --git a/arch/arm/mach-msm/htc/fighter/board-fighter-gpiomux.c b/arch/arm/mach-msm/htc/fighter/board-fighter-gpiomux.c
new file mode 100644
index 0000000..26f3527
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/board-fighter-gpiomux.c
@@ -0,0 +1,281 @@
+/* arch/arm/mach-msm/board-fighter-gpio.c
+ * Copyright (C) 2011 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+*/
+
+#include <mach/gpiomux.h>
+#include "board-fighter.h"
+
+static struct gpiomux_setting gsbi2 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting gsbi3 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+#if 0	/* active in cam_settings */
+static struct gpiomux_setting gsbi4 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+#endif
+
+static struct gpiomux_setting gsbi8 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting gsbi12 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct msm_gpiomux_config fighter_gsbi_configs[] __initdata = {
+	{
+		.gpio      = FIGHTER_NFC_I2C_SDA,	/* GSBI2 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi2,
+		},
+	},
+	{
+		.gpio      = FIGHTER_NFC_I2C_SCL,	/* GSBI2 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi2,
+		},
+	},
+	{
+		.gpio      = FIGHTER_TP_I2C_SDA,	/* GSBI3 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi3,
+		},
+	},
+	{
+		.gpio      = FIGHTER_TP_I2C_SCL,	/* GSBI3 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi3,
+		},
+	},
+#if 0	/* active in cam_settings */
+	{
+		.gpio      = FIGHTER_CAM_I2C_SDA,	/* GSBI4 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi4,
+		},
+	},
+	{
+		.gpio      = FIGHTER_CAM_I2C_SCL,	/* GSBI4 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi4,
+		},
+	},
+#endif
+	{
+		.gpio	   = FIGHTER_AC_I2C_SDA,	/* GSBI8 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi8,
+		},
+	},
+	{
+		.gpio	   = FIGHTER_AC_I2C_SCL,	/* GSBI8 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi8,
+		},
+	},
+	{
+		.gpio      = FIGHTER_SENSOR_I2C_SDA,	/* GSBI12 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi12,
+		},
+	},
+	{
+		.gpio      = FIGHTER_SENSOR_I2C_SCL,	/* GSBI12 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi12,
+		},
+	},
+};
+
+static struct gpiomux_setting cdc_mclk = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct msm_gpiomux_config fighter_audio_codec_configs[] __initdata = {
+	{
+		.gpio = FIGHTER_AUD_WCD_MCLK,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &cdc_mclk,
+		},
+	},
+};
+
+static struct gpiomux_setting slimbus = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_KEEPER,
+};
+
+static struct msm_gpiomux_config fighter_slimbus_configs[] __initdata = {
+	{
+		.gpio	= FIGHTER_AUD_WCD_SB_CLK,		/* slimbus data */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &slimbus,
+		},
+	},
+	{
+		.gpio	= FIGHTER_AUD_WCD_SB_DATA,		/* slimbus clk */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &slimbus,
+		},
+	},
+};
+
+static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv  = GPIOMUX_DRV_10MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting wcnss_5wire_active_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv  = GPIOMUX_DRV_10MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct msm_gpiomux_config wcnss_5wire_interface[] = {
+	{
+		.gpio = FIGHTER_WCN_CMD_DATA2,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = FIGHTER_WCN_CMD_DATA1,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = FIGHTER_WCN_CMD_DATA0,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = FIGHTER_WCN_CMD_SET,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = FIGHTER_WCN_CMD_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+};
+
+static struct gpiomux_setting mdp_vsync_active_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct gpiomux_setting mdp_vsync_suspend_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct msm_gpiomux_config fighter_mdp_vsync_configs[] __initdata = {
+	{
+		.gpio = FIGHTER_LCD_TE,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &mdp_vsync_active_cfg,
+			[GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
+		},
+	}
+};
+
+static struct gpiomux_setting usb_id_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting usb_audio_sw_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+	.dir = GPIOMUX_IN,
+};
+
+static struct msm_gpiomux_config cable_detect_usbid_config[] __initdata = {
+	{
+		.gpio = FIGHTER_USB_ID1,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &usb_id_cfg,
+			[GPIOMUX_SUSPENDED] = &usb_id_cfg,
+		},
+	},
+	{
+		.gpio = FIGHTER_USBz_AUDIO_SW,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &usb_audio_sw_cfg,
+			[GPIOMUX_SUSPENDED] = &usb_audio_sw_cfg,
+		},
+	},
+};
+
+int __init fighter_gpiomux_init(void)
+{
+	int rc;
+
+	rc = msm_gpiomux_init(NR_GPIO_IRQS);
+	if (rc) {
+		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
+		return rc;
+	}
+
+	msm_gpiomux_install(fighter_gsbi_configs,
+			ARRAY_SIZE(fighter_gsbi_configs));
+
+	msm_gpiomux_install(fighter_slimbus_configs,
+			ARRAY_SIZE(fighter_slimbus_configs));
+
+	msm_gpiomux_install(fighter_audio_codec_configs,
+			ARRAY_SIZE(fighter_audio_codec_configs));
+
+	msm_gpiomux_install(fighter_mdp_vsync_configs,
+			ARRAY_SIZE(fighter_mdp_vsync_configs));
+
+	msm_gpiomux_install(wcnss_5wire_interface,
+			ARRAY_SIZE(wcnss_5wire_interface));
+
+	msm_gpiomux_install(cable_detect_usbid_config,
+			ARRAY_SIZE(cable_detect_usbid_config));
+
+	return 0;
+}
diff --git a/arch/arm/mach-msm/htc/fighter/board-fighter-keypad.c b/arch/arm/mach-msm/htc/fighter/board-fighter-keypad.c
new file mode 100644
index 0000000..d7a120c
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/board-fighter-keypad.c
@@ -0,0 +1,99 @@
+/* arch/arm/mach-msm/board-ville-keypad.c
+ * Copyright (C) 2010 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+*/
+
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/gpio_event.h>
+#include <linux/gpio.h>
+#include <linux/keyreset.h>
+#include <asm/mach-types.h>
+#include <mach/board_htc.h>
+#include <mach/gpio.h>
+#include <mach/proc_comm.h>
+#include <linux/moduleparam.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include "board-fighter.h"
+
+static char *keycaps = "--qwerty";
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "board_fighter."
+
+module_param_named(keycaps, keycaps, charp, 0);
+/* Direct Keys */
+
+static struct gpio_event_direct_entry fighter_keypad_map[] = {
+	{
+		.gpio = FIGHTER_VOL_DOWNz,
+		.code = KEY_VOLUMEDOWN,
+	},
+	{
+		.gpio = FIGHTER_VOL_UPz,
+		.code = KEY_VOLUMEUP,
+	},
+};
+
+static struct gpio_event_input_info fighter_keypad_power_info = {
+	.info.func = gpio_event_input_func,
+	.flags = GPIOEDF_PRINT_KEYS,
+	.type = EV_KEY,
+#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
+	.debounce_time.tv.nsec = 5 * NSEC_PER_MSEC,
+# else
+	.debounce_time.tv64 = 5 * NSEC_PER_MSEC,
+# endif
+	.keymap = fighter_keypad_map,
+	.keymap_size = ARRAY_SIZE(fighter_keypad_map),
+};
+
+static struct gpio_event_info *fighter_keypad_info[] = {
+	&fighter_keypad_power_info.info,
+};
+
+static struct gpio_event_platform_data fighter_keypad_data = {
+	.name = "keypad_8960",
+	.info = fighter_keypad_info,
+	.info_count = ARRAY_SIZE(fighter_keypad_info),
+};
+
+static struct platform_device fighter_keypad_device = {
+	.name = GPIO_EVENT_DEV_NAME,
+	.id = 0,
+	.dev		= {
+		.platform_data	= &fighter_keypad_data,
+	},
+};
+
+static struct keyreset_platform_data fighter_reset_keys_pdata = {
+	/*.keys_up = fighter_reset_keys_up,*/
+	.keys_down = {
+		KEY_POWER,
+		KEY_VOLUMEDOWN,
+		KEY_VOLUMEUP,
+		0
+	},
+};
+
+static struct platform_device fighter_reset_keys_device = {
+	.name = KEYRESET_NAME,
+	.dev.platform_data = &fighter_reset_keys_pdata,
+};
+
+int __init fighter_init_keypad(void)
+{
+	if (platform_device_register(&fighter_reset_keys_device))
+		printk(KERN_WARNING "%s: register reset key fail\n", __func__);
+
+	return platform_device_register(&fighter_keypad_device);
+}
+
diff --git a/arch/arm/mach-msm/htc/fighter/board-fighter-pmic.c b/arch/arm/mach-msm/htc/fighter/board-fighter-pmic.c
new file mode 100644
index 0000000..1150aa0
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/board-fighter-pmic.c
@@ -0,0 +1,386 @@
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/bootmem.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/leds.h>
+#include <linux/leds-pm8xxx-htc.h>
+#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
+#include <asm/mach-types.h>
+#include <asm/mach/mmc.h>
+#include <asm/setup.h>
+#include <mach/msm_bus_board.h>
+#include <mach/board.h>
+#include <mach/gpio.h>
+#include <mach/gpiomux.h>
+#include <mach/restart.h>
+#include "devices.h"
+#include "board-fighter.h"
+
+void fighter_pm8xxx_adc_device_register(void);
+
+extern unsigned int system_rev;
+
+struct pm8xxx_gpio_init {
+	unsigned			gpio;
+	struct pm_gpio			config;
+};
+
+struct pm8xxx_mpp_init {
+	unsigned			mpp;
+	struct pm8xxx_mpp_config_data	config;
+};
+
+#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
+			_func, _inv, _disable) \
+{ \
+	.gpio	= PM8921_GPIO_PM_TO_SYS(_gpio), \
+	.config	= { \
+		.direction	= _dir, \
+		.output_buffer	= _buf, \
+		.output_value	= _val, \
+		.pull		= _pull, \
+		.vin_sel	= _vin, \
+		.out_strength	= _out_strength, \
+		.function	= _func, \
+		.inv_int_pol	= _inv, \
+		.disable_pin	= _disable, \
+	} \
+}
+
+#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
+{ \
+	.mpp	= PM8921_MPP_PM_TO_SYS(_mpp), \
+	.config	= { \
+		.type		= PM8XXX_MPP_TYPE_##_type, \
+		.level		= _level, \
+		.control	= PM8XXX_MPP_##_control, \
+	} \
+}
+
+#define PM8XXX_GPIO_DISABLE(_gpio) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
+			 0, 0, 0, 1)
+
+#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
+			_pull, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_NO, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			_func, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(_gpio, _val, _func) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_BB, \
+			PM_GPIO_STRENGTH_HIGH, \
+			_func, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_L17_FUNC(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_L17, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_S4_FUNC_XC(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+/* Initial PM8921 GPIO configurations */
+static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(FIGHTER_GREEN_LED, 1, PM_GPIO_FUNC_NORMAL),
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(FIGHTER_AMBER_LED, 1, PM_GPIO_FUNC_NORMAL),
+	PM8XXX_GPIO_INIT(FIGHTER_EARPHONE_DETz, PM_GPIO_DIR_IN,
+			 PM_GPIO_OUT_BUF_CMOS, 0, PM_GPIO_PULL_UP_1P5,
+			 PM_GPIO_VIN_S4, PM_GPIO_STRENGTH_LOW,
+			 PM_GPIO_FUNC_NORMAL, 0, 0),
+};
+
+/* Initial PM8921 MPP configurations */
+static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
+};
+
+void __init fighter_pm8921_gpio_mpp_init(void)
+{
+	int i, rc;
+
+	for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
+		rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
+					&pm8921_gpios[i].config);
+		if (rc) {
+			pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
+			break;
+		}
+	}
+
+	for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
+		rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
+					&pm8921_mpps[i].config);
+		if (rc) {
+			pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
+			break;
+		}
+	}
+}
+
+static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
+	.irq_base		= PM8921_IRQ_BASE,
+	.devirq			= MSM_GPIO_TO_INT(104),
+	.irq_trigger_flag	= IRQF_TRIGGER_LOW,
+};
+
+static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
+	.gpio_base	= PM8921_GPIO_PM_TO_SYS(1),
+};
+
+static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
+	.mpp_base	= PM8921_MPP_PM_TO_SYS(1),
+};
+
+static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
+	.rtc_write_enable       = true,
+#ifdef CONFIG_HTC_OFFMODE_ALARM
+	.rtc_alarm_powerup	= true,
+#else
+	.rtc_alarm_powerup	= false,
+#endif
+};
+
+static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
+	.pull_up		= 1,
+	.kpd_trigger_delay_us   = 15625,
+	.wakeup			= 1,
+};
+
+static int pm8921_therm_mitigation[] = {
+	1100,
+	700,
+	600,
+	225,
+};
+
+static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
+	.safety_time		= 510,
+	.update_time		= 60000,
+	.max_voltage		= 4200,
+	.min_voltage		= 3200,
+	.resume_voltage_delta	= 50,
+	.term_current		= 50,
+	.cool_temp		= 0,
+	.warm_temp		= 48,
+	.temp_check_period	= 1,
+	.max_bat_chg_current	= 1025,
+	.cool_bat_chg_current	= 1025,
+	.warm_bat_chg_current	= 1025,
+	.cool_bat_voltage	= 4200,
+	.warm_bat_voltage	= 4000,
+	.mbat_in_gpio		= FIGHTER_MBAT_IN,
+	.thermal_mitigation	= pm8921_therm_mitigation,
+	.thermal_levels		= ARRAY_SIZE(pm8921_therm_mitigation),
+	.cold_thr = PM_SMBC_BATT_TEMP_COLD_THR__HIGH,
+	.hot_thr = PM_SMBC_BATT_TEMP_HOT_THR__LOW,
+};
+
+static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
+	.priority		= 0,
+};
+
+static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
+	.r_sense		= 10,
+	.i_test			= 0, /* ori=2500 */
+	.v_failure		= 3000,
+        // .calib_delay_ms		= 600000,
+	.max_voltage_uv		= 4200 * 1000,
+};
+
+static int __init check_dq_setup(char *str)
+{
+	if (!strcmp(str, "PASS")) {
+		pr_info("[BATT] overwrite HV battery config\n");
+                pm8921_chg_pdata.max_voltage = 4340;
+                pm8921_chg_pdata.cool_bat_voltage = 4340;
+		pm8921_bms_pdata.max_voltage_uv = 4340 * 1000;
+	} else {
+		pr_info("[BATT] use default battery config\n");
+		pm8921_chg_pdata.max_voltage = 4200;
+		pm8921_chg_pdata.cool_bat_voltage = 4200;
+		pm8921_bms_pdata.max_voltage_uv = 4200 * 1000;
+	}
+	return 1;
+}
+__setup("androidboot.dq=", check_dq_setup);
+
+static struct pm8xxx_vibrator_platform_data pm8xxx_vib_pdata = {
+	.initial_vibrate_ms = 0,
+	.max_timeout_ms = 15000,
+	.level_mV = 3100,
+};
+
+static struct pm8xxx_gpio_init green_gpios[] = {
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(FIGHTER_GREEN_LED, 1, PM_GPIO_FUNC_2),
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(FIGHTER_GREEN_LED, 1, PM_GPIO_FUNC_NORMAL),
+};
+
+static struct pm8xxx_gpio_init amber_gpios[] = {
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(FIGHTER_AMBER_LED, 1, PM_GPIO_FUNC_2),
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(FIGHTER_AMBER_LED, 1, PM_GPIO_FUNC_NORMAL),
+};
+
+static void green_gpio_config(bool enable)
+{
+	if (enable)
+		pm8xxx_gpio_config(green_gpios[0].gpio, &green_gpios[0].config);
+	else
+		pm8xxx_gpio_config(green_gpios[1].gpio, &green_gpios[1].config);
+}
+
+static void amber_gpio_config(bool enable)
+{
+	if (enable)
+		pm8xxx_gpio_config(amber_gpios[0].gpio, &amber_gpios[0].config);
+	else
+		pm8xxx_gpio_config(amber_gpios[1].gpio, &amber_gpios[1].config);
+}
+
+
+static struct pm8xxx_led_configure pm8921_led_info[] = {
+	[0] = {
+		.name		= "button-backlight",
+		.flags		= PM8XXX_ID_LED_0,
+		.function_flags = LED_PWM_FUNCTION | LED_BRETH_FUNCTION,
+		.period_us 	= USEC_PER_SEC / 1000,
+		.start_index 	= 0,
+		.duites_size 	= 8,
+		.duty_time_ms 	= 64,
+		.lut_flag 	= PM_PWM_LUT_RAMP_UP | PM_PWM_LUT_PAUSE_HI_EN,
+		.out_current    = 40,
+		.duties		= {0, 15, 30, 45, 60, 75, 90, 100,
+				100, 90, 75, 60, 45, 30, 15, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0},
+	},
+	[1] = {
+		.name           = "green",
+		.flags		= PM8XXX_ID_GPIO24,
+		.function_flags = LED_PWM_FUNCTION | LED_BLINK_FUNCTION,
+		.gpio_status_switch = green_gpio_config,
+	},
+	[2] = {
+		.name           = "amber",
+		.flags		= PM8XXX_ID_GPIO25,
+		.function_flags = LED_PWM_FUNCTION | LED_BLINK_FUNCTION,
+		.gpio_status_switch = amber_gpio_config,
+	},
+};
+
+static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
+	.num_leds = ARRAY_SIZE(pm8921_led_info),
+	.leds = pm8921_led_info,
+};
+
+static struct pm8xxx_ccadc_platform_data pm8xxx_ccadc_pdata = {
+    .r_sense_uohm		= 10000,
+};
+
+static struct pm8xxx_adc_amux pm8xxx_adc_channels_data[] = {
+	{"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
+	{"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
+	{"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"pa_therm", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
+	{"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
+	{"mpp_amux6", ADC_MPP_1_AMUX6, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+};
+
+
+static struct pm8xxx_adc_properties pm8xxx_adc_data = {
+	.adc_vdd_reference	= 1800, /* milli-voltage for this adc */
+	.bitresolution		= 15,
+	.bipolar                = 0,
+};
+
+static struct pm8xxx_adc_platform_data pm8xxx_adc_pdata = {
+	.adc_channel			= pm8xxx_adc_channels_data,
+	.adc_num_board_channel		= ARRAY_SIZE(pm8xxx_adc_channels_data),
+	.adc_prop			= &pm8xxx_adc_data,
+	.adc_mpp_base			= PM8921_MPP_PM_TO_SYS(1),
+	.pm8xxx_adc_device_register	= fighter_pm8xxx_adc_device_register,
+};
+
+static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
+	.irq_pdata		= &pm8xxx_irq_pdata,
+	.gpio_pdata		= &pm8xxx_gpio_pdata,
+	.mpp_pdata		= &pm8xxx_mpp_pdata,
+	.rtc_pdata              = &pm8xxx_rtc_pdata,
+	.pwrkey_pdata		= &pm8xxx_pwrkey_pdata,
+	.misc_pdata		= &pm8xxx_misc_pdata,
+	.regulator_pdatas	= msm_pm8921_regulator_pdata,
+        .charger_pdata		= &pm8921_chg_pdata,
+	.bms_pdata		= &pm8921_bms_pdata,
+	.adc_pdata		= &pm8xxx_adc_pdata,
+        .leds_pdata		= &pm8xxx_leds_pdata,
+	.ccadc_pdata		= &pm8xxx_ccadc_pdata,
+	.vibrator_pdata         = &pm8xxx_vib_pdata,
+};
+
+static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
+	.controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
+	.slave	= {
+		.name			= "pm8921-core",
+		.platform_data		= &pm8921_platform_data,
+	},
+};
+
+void __init fighter_init_pmic(void)
+{
+	pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
+
+
+	msm8960_device_ssbi_pmic.dev.platform_data =
+				&msm8960_ssbi_pm8921_pdata;
+	pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
+}
diff --git a/arch/arm/mach-msm/htc/fighter/board-fighter-regulator.c b/arch/arm/mach-msm/htc/fighter/board-fighter-regulator.c
new file mode 100644
index 0000000..2d437ca
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/board-fighter-regulator.c
@@ -0,0 +1,595 @@
+/*
+ * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/regulator/pm8xxx-regulator.h>
+#include <linux/regulator/msm-gpio-regulator.h>
+#include <mach/rpm-regulator.h>
+
+#include "board-fighter.h"
+
+#define VREG_CONSUMERS(_id) \
+	static struct regulator_consumer_supply vreg_consumers_##_id[]
+
+/*
+ * Consumer specific regulator names:
+ *			 regulator name		consumer dev_name
+ */
+VREG_CONSUMERS(L1) = {
+	REGULATOR_SUPPLY("8921_l1",		NULL),
+};
+VREG_CONSUMERS(L2) = {
+	REGULATOR_SUPPLY("8921_l2",		NULL),
+	REGULATOR_SUPPLY("dsi_vdda",		"mipi_dsi.1"),
+	REGULATOR_SUPPLY("dsi_pll_vdda",	"mdp.0"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.0"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.1"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.2"),
+};
+VREG_CONSUMERS(L3) = {
+	REGULATOR_SUPPLY("8921_l3",		NULL),
+	REGULATOR_SUPPLY("HSUSB_3p3",		"msm_otg"),
+};
+VREG_CONSUMERS(L4) = {
+	REGULATOR_SUPPLY("8921_l4",		NULL),
+	REGULATOR_SUPPLY("HSUSB_1p8",		"msm_otg"),
+	REGULATOR_SUPPLY("iris_vddxo",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(L5) = {
+	REGULATOR_SUPPLY("8921_l5",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.1"),
+};
+VREG_CONSUMERS(L6) = {
+	REGULATOR_SUPPLY("8921_l6",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.3"),
+};
+VREG_CONSUMERS(L7) = {
+	REGULATOR_SUPPLY("8921_l7",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd_io",		"msm_sdcc.3"),
+};
+VREG_CONSUMERS(L8) = {
+	REGULATOR_SUPPLY("8921_l8",		NULL),
+	REGULATOR_SUPPLY("dsi_vdc",		"mipi_dsi.1"),
+};
+VREG_CONSUMERS(L9) = {
+	REGULATOR_SUPPLY("8921_l9",		NULL),
+	REGULATOR_SUPPLY("vdd",			"3-0024"),
+	REGULATOR_SUPPLY("vdd_ana",		"3-004a"),
+};
+VREG_CONSUMERS(L10) = {
+	REGULATOR_SUPPLY("8921_l10",		NULL),
+	REGULATOR_SUPPLY("iris_vddpa",		"wcnss_wlan.0"),
+
+};
+VREG_CONSUMERS(L11) = {
+	REGULATOR_SUPPLY("8921_l11",		NULL),
+	REGULATOR_SUPPLY("cam_vana",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vana",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0034"),
+};
+VREG_CONSUMERS(L12) = {
+	REGULATOR_SUPPLY("8921_l12",		NULL),
+	REGULATOR_SUPPLY("cam_vdig",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0034"),
+};
+VREG_CONSUMERS(L14) = {
+	REGULATOR_SUPPLY("8921_l14",		NULL),
+	REGULATOR_SUPPLY("pa_therm",		"pm8xxx-adc"),
+};
+VREG_CONSUMERS(L15) = {
+	REGULATOR_SUPPLY("8921_l15",		NULL),
+	REGULATOR_SUPPLY("vreg_xoadc",		"pm8921-charger"),
+};
+VREG_CONSUMERS(L16) = {
+	REGULATOR_SUPPLY("8921_l16",		NULL),
+	REGULATOR_SUPPLY("cam_vaf",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0034"),
+};
+VREG_CONSUMERS(L17) = {
+	REGULATOR_SUPPLY("8921_l17",		NULL),
+};
+VREG_CONSUMERS(L18) = {
+	REGULATOR_SUPPLY("8921_l18",		NULL),
+};
+VREG_CONSUMERS(L21) = {
+	REGULATOR_SUPPLY("8921_l21",		NULL),
+};
+VREG_CONSUMERS(L22) = {
+	REGULATOR_SUPPLY("8921_l22",		NULL),
+};
+VREG_CONSUMERS(L23) = {
+	REGULATOR_SUPPLY("8921_l23",		NULL),
+	REGULATOR_SUPPLY("dsi_vddio",		"mipi_dsi.1"),
+	REGULATOR_SUPPLY("dsi_pll_vddio",	"mdp.0"),
+	REGULATOR_SUPPLY("hdmi_avdd",		"hdmi_msm.0"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_riva"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_qdsp6v4.1"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_qdsp6v4.2"),
+};
+VREG_CONSUMERS(L24) = {
+	REGULATOR_SUPPLY("8921_l24",		NULL),
+	REGULATOR_SUPPLY("riva_vddmx",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(L25) = {
+	REGULATOR_SUPPLY("8921_l25",		NULL),
+	REGULATOR_SUPPLY("VDDD_CDC_D",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_A_1P2V",	"tabla-slim"),
+	REGULATOR_SUPPLY("VDDD_CDC_D",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_A_1P2V",	"tabla2x-slim"),
+};
+VREG_CONSUMERS(L26) = {
+	REGULATOR_SUPPLY("8921_l26",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.0"),
+};
+VREG_CONSUMERS(L27) = {
+	REGULATOR_SUPPLY("8921_l27",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.2"),
+};
+VREG_CONSUMERS(L28) = {
+	REGULATOR_SUPPLY("8921_l28",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.1"),
+};
+VREG_CONSUMERS(L29) = {
+	REGULATOR_SUPPLY("8921_l29",		NULL),
+};
+VREG_CONSUMERS(S1) = {
+	REGULATOR_SUPPLY("8921_s1",		NULL),
+};
+VREG_CONSUMERS(S2) = {
+	REGULATOR_SUPPLY("8921_s2",		NULL),
+	REGULATOR_SUPPLY("iris_vddrfa",		"wcnss_wlan.0"),
+
+};
+VREG_CONSUMERS(S3) = {
+	REGULATOR_SUPPLY("8921_s3",		NULL),
+	REGULATOR_SUPPLY("HSUSB_VDDCX",		"msm_otg"),
+	REGULATOR_SUPPLY("riva_vddcx",		"wcnss_wlan.0"),
+	REGULATOR_SUPPLY("HSIC_VDDCX",		"msm_hsic_host"),
+};
+VREG_CONSUMERS(S4) = {
+	REGULATOR_SUPPLY("8921_s4",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd_io",		"msm_sdcc.1"),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.2"),
+	REGULATOR_SUPPLY("sdc_vdd_io",            "msm_sdcc.4"),
+	REGULATOR_SUPPLY("riva_vddpx",		"wcnss_wlan.0"),
+	REGULATOR_SUPPLY("hdmi_vcc",		"hdmi_msm.0"),
+	REGULATOR_SUPPLY("VDDIO_CDC",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDD_CP",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_TX",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_RX",		"tabla-slim"),
+	REGULATOR_SUPPLY("VDDIO_CDC",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDD_CP",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_TX",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_RX",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-005b"),
+	REGULATOR_SUPPLY("EXT_HUB_VDDIO",	"msm_smsc_hub"),
+	REGULATOR_SUPPLY("vcc_i2c",		"10-0048"),
+};
+VREG_CONSUMERS(S5) = {
+	REGULATOR_SUPPLY("8921_s5",		NULL),
+	REGULATOR_SUPPLY("krait0",		NULL),
+};
+VREG_CONSUMERS(S6) = {
+	REGULATOR_SUPPLY("8921_s6",		NULL),
+	REGULATOR_SUPPLY("krait1",		NULL),
+};
+VREG_CONSUMERS(S7) = {
+	REGULATOR_SUPPLY("8921_s7",		NULL),
+};
+VREG_CONSUMERS(S8) = {
+	REGULATOR_SUPPLY("8921_s8",		NULL),
+};
+VREG_CONSUMERS(LVS1) = {
+	REGULATOR_SUPPLY("8921_lvs1",		NULL),
+	REGULATOR_SUPPLY("iris_vddio",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(LVS2) = {
+	REGULATOR_SUPPLY("8921_lvs2",		NULL),
+	REGULATOR_SUPPLY("iris_vdddig",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(LVS3) = {
+	REGULATOR_SUPPLY("8921_lvs3",		NULL),
+};
+VREG_CONSUMERS(LVS4) = {
+	REGULATOR_SUPPLY("8921_lvs4",		NULL),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-0024"),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-004a"),
+};
+VREG_CONSUMERS(LVS5) = {
+	REGULATOR_SUPPLY("8921_lvs5",		NULL),
+	REGULATOR_SUPPLY("cam_vio",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vio",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0034"),
+};
+VREG_CONSUMERS(LVS6) = {
+	REGULATOR_SUPPLY("8921_lvs6",		NULL),
+	REGULATOR_SUPPLY("vdd_io",		"spi0.0"),
+};
+VREG_CONSUMERS(LVS7) = {
+	REGULATOR_SUPPLY("8921_lvs7",		NULL),
+};
+VREG_CONSUMERS(NCP) = {
+	REGULATOR_SUPPLY("8921_ncp",		NULL),
+};
+VREG_CONSUMERS(EXT_5V) = {
+	REGULATOR_SUPPLY("ext_5v",		NULL),
+};
+VREG_CONSUMERS(EXT_L2) = {
+	REGULATOR_SUPPLY("ext_l2",		NULL),
+	REGULATOR_SUPPLY("vdd_phy",		"spi0.0"),
+};
+VREG_CONSUMERS(EXT_3P3V) = {
+	REGULATOR_SUPPLY("ext_3p3v",		NULL),
+	REGULATOR_SUPPLY("vdd_ana",		"3-005b"),
+	REGULATOR_SUPPLY("vdd_lvds_3p3v",	"mipi_dsi.1"),
+};
+
+#define PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
+			 _apply_uV, _pull_down, _always_on, _supply_regulator, \
+			 _system_uA, _enable_time, _reg_id) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_modes_mask	= _modes, \
+				.valid_ops_mask		= _ops, \
+				.min_uV			= _min_uV, \
+				.max_uV			= _max_uV, \
+				.input_uV		= _max_uV, \
+				.apply_uV		= _apply_uV, \
+				.always_on		= _always_on, \
+				.name			= _name, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id			= _reg_id, \
+		.pull_down_enable	= _pull_down, \
+		.system_uA		= _system_uA, \
+		.enable_time		= _enable_time, \
+	}
+
+#define PM8XXX_LDO(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_NLDO1200(_id, _name, _always_on, _pull_down, _min_uV, \
+		_max_uV, _enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_SMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_FTSMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
+		REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
+		| REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_VS(_id, _name, _always_on, _pull_down, _enable_time, \
+		_supply_regulator, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
+		_pull_down, _always_on, _supply_regulator, 0, _enable_time, \
+		_reg_id)
+
+#define PM8XXX_NCP(_id, _name, _always_on, _min_uV, _max_uV, _enable_time, \
+		_supply_regulator, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, 0, \
+		REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, 0, \
+		_always_on, _supply_regulator, 0, _enable_time, _reg_id)
+
+/* Pin control initialization */
+#define PM8XXX_PC(_id, _name, _always_on, _pin_fn, _pin_ctrl, \
+		_supply_regulator, _reg_id) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+				.always_on	= _always_on, \
+				.name		= _name, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id##_PC), \
+			.consumer_supplies	= vreg_consumers_##_id##_PC, \
+			.supply_regulator  = _supply_regulator, \
+		}, \
+		.id		= _reg_id, \
+		.pin_fn		= PM8XXX_VREG_PIN_FN_##_pin_fn, \
+		.pin_ctrl	= _pin_ctrl, \
+	}
+
+#define GPIO_VREG(_id, _reg_name, _gpio_label, _gpio, _supply_regulator) \
+	[GPIO_VREG_ID_##_id] = { \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.regulator_name = _reg_name, \
+		.gpio_label	= _gpio_label, \
+		.gpio		= _gpio, \
+	}
+
+#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
+	{ \
+		.constraints = { \
+			.name		= _name, \
+			.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE, \
+			.min_uV		= _min_uV, \
+			.max_uV		= _max_uV, \
+		}, \
+		.num_consumer_supplies	= ARRAY_SIZE(vreg_consumers_##_id), \
+		.consumer_supplies	= vreg_consumers_##_id, \
+	}
+
+#define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \
+		 _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \
+		 _force_mode, _sleep_set_force_mode, _power_mode, _state, \
+		 _sleep_selectable, _always_on, _supply_regulator, _system_uA) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_modes_mask	= _modes, \
+				.valid_ops_mask		= _ops, \
+				.min_uV			= _min_uV, \
+				.max_uV			= _max_uV, \
+				.input_uV		= _min_uV, \
+				.apply_uV		= _apply_uV, \
+				.always_on		= _always_on, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id			= RPM_VREG_ID_PM8921_##_id, \
+		.default_uV		= _default_uV, \
+		.peak_uA		= _peak_uA, \
+		.avg_uA			= _avg_uA, \
+		.pull_down_enable	= _pull_down, \
+		.pin_ctrl		= _pin_ctrl, \
+		.freq			= RPM_VREG_FREQ_##_freq, \
+		.pin_fn			= _pin_fn, \
+		.force_mode		= _force_mode, \
+		.sleep_set_force_mode	= _sleep_set_force_mode, \
+		.power_mode		= _power_mode, \
+		.state			= _state, \
+		.sleep_selectable	= _sleep_selectable, \
+		.system_uA		= _system_uA, \
+	}
+
+#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
+		_supply_regulator, _system_uA, _init_peak_uA) \
+	RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
+		 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, _system_uA)
+
+#define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
+		 _supply_regulator, _system_uA, _freq, _force_mode, \
+		 _sleep_set_force_mode) \
+	RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
+		 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _system_uA, 0, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_##_force_mode, \
+		 RPM_VREG_FORCE_MODE_8960_##_sleep_set_force_mode, \
+		 RPM_VREG_POWER_MODE_8960_PWM, RPM_VREG_STATE_OFF, \
+		 _sleep_selectable, _always_on, _supply_regulator, _system_uA)
+
+#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
+	RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, 0)
+
+#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
+		_supply_regulator, _freq) \
+	RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
+		 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, 0)
+
+/* Pin control initialization */
+#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+				.always_on	= _always_on, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id##_PC), \
+			.consumer_supplies	= vreg_consumers_##_id##_PC, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id	  = RPM_VREG_ID_PM8921_##_id##_PC, \
+		.pin_fn	  = RPM_VREG_PIN_FN_8960_##_pin_fn, \
+		.pin_ctrl = _pin_ctrl, \
+	}
+
+/* GPIO regulator constraints */
+struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] __devinitdata = {
+	GPIO_VREG(EXT_5V, "ext_5v", "ext_5v_en", PM8921_MPP_PM_TO_SYS(7), NULL),
+	GPIO_VREG(EXT_L2, "ext_l2", "ext_l2_en", 91, NULL),
+	GPIO_VREG(EXT_3P3V, "ext_3p3v", "ext_3p3v_en",
+		PM8921_GPIO_PM_TO_SYS(17), NULL),
+};
+
+/* SAW regulator constraints */
+struct regulator_init_data msm_saw_regulator_pdata_s5 =
+	/*	      ID  vreg_name	       min_uV   max_uV */
+	SAW_VREG_INIT(S5, "8921_s5",	       850000, 1300000);
+struct regulator_init_data msm_saw_regulator_pdata_s6 =
+	SAW_VREG_INIT(S6, "8921_s6",	       850000, 1300000);
+
+/* PM8921 regulator constraints */
+struct pm8xxx_regulator_platform_data
+msm_pm8921_regulator_pdata[] __devinitdata = {
+	/*
+	 *		ID   name always_on pd min_uV   max_uV   en_t supply
+	 *	system_uA reg_ID
+	 */
+	PM8XXX_NLDO1200(L26, "8921_l26", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 1),
+	PM8XXX_NLDO1200(L27, "8921_l27", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 2),
+	PM8XXX_NLDO1200(L28, "8921_l28", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 3),
+	PM8XXX_LDO(L29,      "8921_l29", 0, 1, 2050000, 2100000, 200, "8921_s8",
+		0, 4),
+};
+
+static struct rpm_regulator_init_data
+msm_rpm_regulator_init_data[] __devinitdata = {
+	RPM_SMPS(S1, 1, 1, 0, 1225000, 1225000, NULL, 100000, 3p20, NONE, NONE),
+	RPM_SMPS(S2, 0, 1, 0, 1300000, 1300000, NULL,      0, 1p60, NONE, NONE),
+	RPM_SMPS(S3, 0, 1, 1,  500000, 1150000, NULL, 100000, 4p80, NONE, NONE),
+	RPM_SMPS(S4, 1, 1, 0, 1800000, 1800000, NULL, 100000, 3p20, AUTO, AUTO),
+	RPM_SMPS(S7, 0, 1, 0, 1150000, 1150000, NULL, 100000, 3p20, NONE, NONE),
+	RPM_SMPS(S8, 1, 1, 1, 2050000, 2050000, NULL, 100000, 1p60, NONE, NONE),
+
+	
+	RPM_LDO(L1,	 1, 1, 0, 1050000, 1050000, "8921_s4", 0, 10000),
+	RPM_LDO(L2,	 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
+	RPM_LDO(L3,	 0, 1, 0, 3075000, 3075000, NULL,      0, 0),
+	RPM_LDO(L4,	 1, 1, 0, 1800000, 1800000, NULL,      10000, 10000),
+	RPM_LDO(L5,	 0, 1, 0, 2950000, 2950000, NULL,      0, 0),
+	RPM_LDO(L6,	 0, 1, 0, 2850000, 2950000, NULL,      0, 0),
+	RPM_LDO(L7,	 1, 1, 0, 1850000, 2950000, NULL,      10000, 10000),
+	RPM_LDO(L8,	 0, 1, 0, 2800000, 3000000, NULL,      0, 0),
+	RPM_LDO(L9,	 0, 1, 0, 2800000, 2850000, NULL,      0, 0),
+	RPM_LDO(L10,	 0, 1, 0, 3000000, 3000000, NULL,      0, 0),
+	RPM_LDO(L11,	 0, 1, 0, 3000000, 3000000, NULL,      0, 0),
+	RPM_LDO(L12,	 0, 1, 0, 1200000, 1500000, "8921_s4", 0, 0),
+	RPM_LDO(L14,	 0, 1, 0, 1800000, 1800000, NULL,      0, 0),
+	RPM_LDO(L15,	 0, 1, 0, 1800000, 2950000, NULL,      0, 0),
+	RPM_LDO(L16,	 0, 1, 0, 2850000, 2850000, NULL,      0, 0),
+	RPM_LDO(L17,	 0, 1, 0, 1800000, 2950000, NULL,      0, 0),
+	RPM_LDO(L18,	 0, 1, 0, 1300000, 1300000, "8921_s4", 0, 0),
+	RPM_LDO(L21,	 0, 1, 0, 1900000, 1900000, "8921_s8", 0, 0),
+	RPM_LDO(L22,	 0, 1, 0, 2750000, 2750000, NULL,      0, 0),
+	RPM_LDO(L23,	 1, 1, 1, 1800000, 1800000, "8921_s8", 10000, 10000),
+	RPM_LDO(L24,	 0, 1, 1,  750000, 1150000, "8921_s1", 10000, 10000),
+	RPM_LDO(L25,	 1, 1, 0, 1225000, 1225000, "8921_s1", 10000, 10000),
+
+	
+	RPM_VS(LVS1,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS2,	 0, 1, 0,		    "8921_s1"),
+	RPM_VS(LVS3,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS4,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS5,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS6,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS7,	 0, 1, 0,		    "8921_s4"),
+
+	
+	RPM_NCP(NCP,	 0,    0, 1800000, 1800000, "8921_l6",    1p60),
+};
+
+int msm_pm8921_regulator_pdata_len __devinitdata =
+	ARRAY_SIZE(msm_pm8921_regulator_pdata);
+
+#define RPM_REG_MAP(_id, _sleep_also, _voter, _supply, _dev_name) \
+	{ \
+		.vreg_id = RPM_VREG_ID_PM8921_##_id, \
+		.sleep_also = _sleep_also, \
+		.voter = _voter, \
+		.supply = _supply, \
+		.dev_name = _dev_name, \
+	}
+static struct rpm_regulator_consumer_mapping
+	      msm_rpm_regulator_consumer_mapping[] __devinitdata = {
+	RPM_REG_MAP(L23, 0, 1, "krait0_l23", "acpuclk-8960"),
+	RPM_REG_MAP(L23, 0, 2, "krait1_l23", "acpuclk-8960"),
+	RPM_REG_MAP(L23, 0, 6, "l2_l23",     "acpuclk-8960"),
+	RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8960"),
+	RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8960"),
+	RPM_REG_MAP(S3,  0, 1, "krait0_dig", "acpuclk-8960"),
+	RPM_REG_MAP(S3,  0, 2, "krait1_dig", "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 1, "krait0_s8",  "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 2, "krait1_s8",  "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 6, "l2_s8",      "acpuclk-8960"),
+};
+
+struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
+	.name	= GPIO_REGULATOR_DEV_NAME,
+	.id	= PM8921_MPP_PM_TO_SYS(7),
+	.dev	= {
+		.platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
+	},
+};
+
+struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
+	.name	= GPIO_REGULATOR_DEV_NAME,
+	.id	= 91,
+	.dev	= {
+		.platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
+	},
+};
+
+struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
+	.name	= GPIO_REGULATOR_DEV_NAME,
+	.id	= PM8921_GPIO_PM_TO_SYS(17),
+	.dev	= {
+		.platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
+	},
+};
+
+struct rpm_regulator_platform_data fighter_rpm_regulator_pdata __devinitdata = {
+	.init_data		= msm_rpm_regulator_init_data,
+	.num_regulators		= ARRAY_SIZE(msm_rpm_regulator_init_data),
+	.version		= RPM_VREG_VERSION_8960,
+	.vreg_id_vdd_mem	= RPM_VREG_ID_PM8921_L24,
+	.vreg_id_vdd_dig	= RPM_VREG_ID_PM8921_S3,
+	.consumer_map		= msm_rpm_regulator_consumer_mapping,
+	.consumer_map_len = ARRAY_SIZE(msm_rpm_regulator_consumer_mapping),
+};
diff --git a/arch/arm/mach-msm/htc/fighter/board-fighter-storage.c b/arch/arm/mach-msm/htc/fighter/board-fighter-storage.c
new file mode 100644
index 0000000..3273396
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/board-fighter-storage.c
@@ -0,0 +1,315 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/bootmem.h>
+#include <linux/gpio.h>
+#include <asm/mach-types.h>
+#include <asm/mach/mmc.h>
+#include <mach/board.h>
+#include <mach/gpiomux.h>
+#include "devices.h"
+#include "board-8960.h"
+#include "board-storage-common-a.h"
+
+enum sdcc_controllers {
+	SDCC1,
+	SDCC2,
+	SDCC3,
+	SDCC4,
+	SDCC5,
+	MAX_SDCC_CONTROLLER
+};
+
+static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
+	
+	[SDCC1] = {
+		.name = "sdc_vdd",
+		.high_vol_level = 2950000,
+		.low_vol_level = 2950000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		.lpm_uA = 9000,
+		.hpm_uA = 200000, 
+	},
+	
+	[SDCC3] = {
+		.name = "sdc_vdd",
+		.high_vol_level = 2850000,
+		.low_vol_level = 2850000,
+		.hpm_uA = 600000, 
+	}
+};
+
+static struct msm_mmc_reg_data mmc_vdd_io_reg_data[MAX_SDCC_CONTROLLER] = {
+	
+	[SDCC1] = {
+		.name = "sdc_vdd_io",
+		.always_on = 1,
+		.high_vol_level = 1800000,
+		.low_vol_level = 1800000,
+		.hpm_uA = 200000, 
+	},
+	
+	[SDCC3] = {
+		.name = "sdc_vdd_io",
+		.high_vol_level = 2850000,
+		.low_vol_level = 1850000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		
+		.hpm_uA = 16000,
+		.lpm_uA = 2000,
+	}
+};
+
+static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
+	
+	[SDCC1] = {
+		.vdd_data = &mmc_vdd_reg_data[SDCC1],
+		.vdd_io_data = &mmc_vdd_io_reg_data[SDCC1],
+	},
+	
+	[SDCC3] = {
+		.vdd_data = &mmc_vdd_reg_data[SDCC3],
+		.vdd_io_data = &mmc_vdd_io_reg_data[SDCC3]
+	}
+};
+
+static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
+	{TLMM_HDRV_SDC1_CLK, GPIO_CFG_10MA},
+	{TLMM_HDRV_SDC1_CMD, GPIO_CFG_6MA},
+	{TLMM_HDRV_SDC1_DATA, GPIO_CFG_8MA}
+};
+
+static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
+	{TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
+};
+
+static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
+	{TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
+	{TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
+	{TLMM_HDRV_SDC3_CLK, GPIO_CFG_12MA},
+	{TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
+	{TLMM_HDRV_SDC3_DATA, GPIO_CFG_10MA}
+};
+
+static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
+	{TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
+};
+
+static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
+	{TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
+	{TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
+	{TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
+};
+
+static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.on = sdc1_pad_pull_on_cfg,
+		.off = sdc1_pad_pull_off_cfg,
+		.size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
+	},
+	[SDCC3] = {
+		.on = sdc3_pad_pull_on_cfg,
+		.off = sdc3_pad_pull_off_cfg,
+		.size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
+	},
+};
+
+static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.on = sdc1_pad_drv_on_cfg,
+		.off = sdc1_pad_drv_off_cfg,
+		.size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
+	},
+	[SDCC3] = {
+		.on = sdc3_pad_drv_on_cfg,
+		.off = sdc3_pad_drv_off_cfg,
+		.size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
+	},
+};
+
+struct msm_mmc_gpio sdc2_gpio[] = {
+	{92, "sdc2_dat_3"},
+	{91, "sdc2_dat_2"},
+	{90, "sdc2_dat_1"},
+	{89, "sdc2_dat_0"},
+	{97, "sdc2_cmd"},
+	{98, "sdc2_clk"}
+};
+
+struct msm_mmc_gpio sdc4_gpio[] = {
+	{83, "sdc4_dat_3"},
+	{84, "sdc4_dat_2"},
+	{85, "sdc4_dat_1"},
+	{86, "sdc4_dat_0"},
+	{87, "sdc4_cmd"},
+	{88, "sdc4_clk"}
+};
+
+struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC2] = {
+		.gpio = sdc2_gpio,
+		.size = ARRAY_SIZE(sdc2_gpio),
+	},
+	[SDCC4] = {
+		.gpio = sdc4_gpio,
+		.size = ARRAY_SIZE(sdc4_gpio),
+	},
+};
+
+static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.pull = &mmc_pad_pull_data[SDCC1],
+		.drv = &mmc_pad_drv_data[SDCC1]
+	},
+	[SDCC3] = {
+		.pull = &mmc_pad_pull_data[SDCC3],
+		.drv = &mmc_pad_drv_data[SDCC3]
+	},
+};
+
+static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.pad_data = &mmc_pad_data[SDCC1],
+	},
+	[SDCC2] = {
+		.is_gpio = 1,
+		.gpio_data = &mmc_gpio_data[SDCC2],
+	},
+	[SDCC3] = {
+		.pad_data = &mmc_pad_data[SDCC3],
+	},
+	[SDCC4] = {
+		.is_gpio = 1,
+		.gpio_data = &mmc_gpio_data[SDCC4],
+	},
+};
+
+#define MSM_MPM_PIN_SDC1_DAT1	17
+#define MSM_MPM_PIN_SDC3_DAT1	21
+
+static unsigned int sdc1_sup_clk_rates[] = {
+	400000, 24000000, 48000000, 96000000
+};
+
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+static unsigned int sdc3_sup_clk_rates[] = {
+	400000, 24000000, 48000000, 96000000, 192000000
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
+static struct mmc_platform_data msm8960_sdc1_data = {
+	.ocr_mask       = MMC_VDD_27_28 | MMC_VDD_28_29,
+#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
+	.mmc_bus_width  = MMC_CAP_8_BIT_DATA,
+#else
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+#endif
+	.sup_clk_table	= sdc1_sup_clk_rates,
+	.sup_clk_cnt	= ARRAY_SIZE(sdc1_sup_clk_rates),
+	.nonremovable	= 1,
+	.vreg_data	= &mmc_slot_vreg_data[SDCC1],
+	.pin_data	= &mmc_slot_pin_data[SDCC1],
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+	.uhs_caps	= MMC_CAP_1_8V_DDR | MMC_CAP_UHS_DDR50,
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+static struct mmc_platform_data msm8960_sdc3_data = {
+	.ocr_mask       = MMC_VDD_27_28 | MMC_VDD_28_29,
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+	.sup_clk_table	= sdc3_sup_clk_rates,
+	.sup_clk_cnt	= ARRAY_SIZE(sdc3_sup_clk_rates),
+#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
+	.wpswitch_gpio	= PM8921_GPIO_PM_TO_SYS(16),
+#endif
+	.vreg_data	= &mmc_slot_vreg_data[SDCC3],
+	.pin_data	= &mmc_slot_pin_data[SDCC3],
+#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
+	.status_gpio	= PM8921_GPIO_PM_TO_SYS(26),
+	.status_irq	= PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
+	.irq_flags	= IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+	.is_status_gpio_active_low = true,
+#endif
+	.xpc_cap	= 1,
+	.uhs_caps	= (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
+			MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
+			MMC_CAP_UHS_SDR104 | MMC_CAP_MAX_CURRENT_600),
+	.mpm_sdiowakeup_int = MSM_MPM_PIN_SDC3_DAT1,
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
+static unsigned int sdc4_sup_clk_rates[] = {
+	400000, 24000000, 48000000
+};
+
+static struct mmc_platform_data msm8960_sdc4_data = {
+	.ocr_mask       = MMC_VDD_165_195,
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+	.sup_clk_table  = sdc4_sup_clk_rates,
+	.sup_clk_cnt    = ARRAY_SIZE(sdc4_sup_clk_rates),
+	.pclk_src_dfab  = 1,
+	.vreg_data      = &mmc_slot_vreg_data[SDCC4],
+	.pin_data       = &mmc_slot_pin_data[SDCC4],
+	.sdiowakeup_irq = MSM_GPIO_TO_INT(85),
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+};
+#endif
+
+void __init fighter_init_mmc(void)
+{
+#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
+	
+	msm_add_sdcc(1, &msm8960_sdc1_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
+	
+	msm_add_sdcc(2, &msm8960_sdc2_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+	
+	msm_add_sdcc(3, &msm8960_sdc3_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
+	
+	msm_add_sdcc(4, &msm8960_sdc4_data);
+#endif
+}
diff --git a/arch/arm/mach-msm/htc/fighter/board-fighter.c b/arch/arm/mach-msm/htc/fighter/board-fighter.c
new file mode 100644
index 0000000..09c3219
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/board-fighter.c
@@ -0,0 +1,3521 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/i2c.h>
+#include <linux/i2c/sx150x.h>
+#include <linux/gpio.h>
+#include <linux/usb/msm_hsusb.h>
+#include <linux/usb/android.h>
+#include <linux/msm_ssbi.h>
+#include <linux/pn544.h>
+#include <linux/regulator/msm-gpio-regulator.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/regulator/consumer.h>
+#include <linux/spi/spi.h>
+#include <linux/slimbus/slimbus.h>
+#include <sound/tpa2051d3.h>
+#ifdef CONFIG_ANDROID_PMEM
+#include <linux/android_pmem.h>
+#endif
+#include <linux/atmel_qt602240.h>
+#include <linux/synaptics_i2c_rmi.h>
+#include <linux/dma-contiguous.h>
+#include <linux/dma-mapping.h>
+#include <linux/platform_data/qcom_crypto_device.h>
+#include <linux/platform_data/qcom_wcnss_device.h>
+#include <linux/leds.h>
+#include <linux/leds-pm8xxx-htc.h>
+#include <linux/msm_tsens.h>
+#include <linux/proc_fs.h>
+#include <linux/cm3629.h>
+#include <linux/memblock.h>
+#include <linux/msm_thermal.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/setup.h>
+#include <asm/hardware/gic.h>
+#include <asm/mach/mmc.h>
+
+#include <mach/board.h>
+#include <mach/msm_iomap.h>
+#include <mach/msm_spi.h>
+#ifdef CONFIG_USB_MSM_OTG_72K
+#include <mach/msm_hsusb.h>
+#else
+#include <linux/usb/msm_hsusb.h>
+#endif
+#include <mach/htc_restart_handler.h>
+#include <mach/usbdiag.h>
+#include <mach/socinfo.h>
+#include <mach/rpm.h>
+#include <mach/gpio.h>
+#include <mach/msm_bus_board.h>
+#include <mach/msm_memtypes.h>
+#include <mach/dma.h>
+#include <mach/msm_dsps.h>
+#include <mach/msm_xo.h>
+#include <mach/restart.h>
+#include <mach/panel_id.h>
+#ifdef CONFIG_WCD9310_CODEC
+#include <linux/slimbus/slimbus.h>
+#include <linux/mfd/wcd9xxx/core.h>
+#include <linux/mfd/wcd9xxx/pdata.h>
+#endif
+#include <linux/msm_ion.h>
+#include <mach/ion.h>
+
+#include <mach/msm_rtb.h>
+#include <mach/msm_cache_dump.h>
+#include <mach/scm.h>
+#include <mach/iommu_domains.h>
+
+#include <mach/kgsl.h>
+#include <linux/fmem.h>
+
+#include <linux/akm8975.h>
+#include <linux/bma250.h>
+#include <linux/ewtzmu2.h>
+#ifdef CONFIG_BT
+#include <mach/htc_bdaddress.h>
+#endif
+#include <mach/htc_headset_mgr.h>
+#include <mach/htc_headset_pmic.h>
+#include <mach/cable_detect.h>
+
+#include "timer.h"
+#include "devices.h"
+#include "devices-msm8x60.h"
+#include "spm.h"
+#include "board-fighter.h"
+#include "pm.h"
+#include <mach/cpuidle.h>
+#include "rpm_resources.h"
+#include <mach/mpm.h>
+#include "acpuclock.h"
+#include "rpm_log.h"
+#include "smd_private.h"
+#include "pm-boot.h"
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+#include <mach/mhl.h>
+#endif
+
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#include <linux/htc_flashlight.h>
+#endif
+#include <mach/board_htc.h>
+#ifdef CONFIG_HTC_BATT_8960
+#include "mach/htc_battery_8960.h"
+#include "mach/htc_battery_cell.h"
+#include "linux/mfd/pm8xxx/pm8921-charger-htc.h"
+#endif
+
+#ifdef CONFIG_PERFLOCK
+#include <mach/perflock.h>
+#endif
+
+extern unsigned int engineerid; // bit 0
+
+#define HW_VER_ID_VIRT		(MSM_TLMM_BASE + 0x00002054)
+
+unsigned skuid;
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+static void config_flashlight_gpios(void)
+{
+	static uint32_t flashlight_gpio_table[] = {
+		GPIO_CFG(32, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+		GPIO_CFG(33, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	};
+
+	gpio_tlmm_config(flashlight_gpio_table[0], GPIO_CFG_ENABLE);
+	gpio_tlmm_config(flashlight_gpio_table[1], GPIO_CFG_ENABLE);
+}
+
+static struct TPS61310_flashlight_platform_data fighter_flashlight_data = {
+	.gpio_init = config_flashlight_gpios,
+	.tps61310_strb0 = 33,
+	.tps61310_strb1 = 32,
+	.led_count = 1,
+	.flash_duration_ms = 600,
+};
+
+static struct i2c_board_info i2c_tps61310_flashlight[] = {
+	{
+		I2C_BOARD_INFO("TPS61310_FLASHLIGHT", 0x66 >> 1),
+		.platform_data = &fighter_flashlight_data,
+	},
+};
+#endif
+#endif
+
+static struct platform_device msm_fm_platform_init = {
+	.name = "iris_fm",
+	.id   = -1,
+};
+
+#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
+enum {
+	GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
+	GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
+	/* CAM Expander */
+	GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
+	GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
+	GPIO_CAM_GP_AFBUSY,
+	GPIO_CAM_GP_STROBE_CE,
+	GPIO_CAM_GP_CAM1MP_XCLR,
+	GPIO_CAM_GP_CAMIF_RESET_N,
+	GPIO_CAM_GP_XMT_FLASH_INT,
+	GPIO_CAM_GP_LED_EN1,
+	GPIO_CAM_GP_LED_EN2,
+
+};
+#endif
+
+#ifdef CONFIG_I2C
+
+#define MSM_8960_GSBI2_QUP_I2C_BUS_ID 2
+#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
+#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
+#define MSM_8960_GSBI8_QUP_I2C_BUS_ID 8
+#define MSM_8960_GSBI12_QUP_I2C_BUS_ID 12
+
+#endif
+
+#define MSM_PMEM_ADSP_SIZE         0x6D00000
+#define MSM_PMEM_AUDIO_SIZE        0x4CF000
+#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
+#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
+#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
+
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+#define HOLE_SIZE	0x20000
+#define MSM_CONTIG_MEM_SIZE  0x65000
+#ifdef CONFIG_MSM_IOMMU
+#define MSM_ION_MM_SIZE            0x3800000 /* Need to be multiple of 64K */
+#define MSM_ION_SF_SIZE            0x0
+#define MSM_ION_QSECOM_SIZE        0x780000 /* (7.5MB) */
+#define MSM_ION_HEAP_NUM	7
+#else
+#define MSM_ION_MM_SIZE            MSM_PMEM_ADSP_SIZE
+#define MSM_ION_SF_SIZE            MSM_PMEM_SIZE
+#define MSM_ION_QSECOM_SIZE        0x600000 /* (6MB) */
+#define MSM_ION_HEAP_NUM	8
+#endif
+#define MSM_ION_MM_FW_SIZE	(0x200000 - HOLE_SIZE) /* 128kb */
+#define MSM_ION_MFC_SIZE	SZ_8K
+#define MSM_ION_AUDIO_SIZE	MSM_PMEM_AUDIO_SIZE
+
+#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
+#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
+#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
+
+#define MSM_MM_FW_SIZE		(0x200000 - HOLE_SIZE) /* 2mb -128kb*/
+#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
+							HOLE_SIZE))
+#define MAX_FIXED_AREA_SIZE	0x10000000
+#define MSM8960_FW_START	MSM8960_FIXED_AREA_START
+#define MSM_ION_ADSP_SIZE	SZ_8M
+#else
+#define MSM_CONTIG_MEM_SIZE  0x110C000
+#define MSM_ION_HEAP_NUM	1
+#endif
+
+static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
+#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
+static int __init msm_contig_mem_size_setup(char *p)
+{
+	msm_contig_mem_size = memparse(p, NULL);
+	return 0;
+}
+early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
+#endif
+
+#ifdef CONFIG_ANDROID_PMEM
+static unsigned pmem_size = MSM_PMEM_SIZE;
+static unsigned pmem_param_set = 0;
+static int __init pmem_size_setup(char *p)
+{
+	pmem_size = memparse(p, NULL);
+	pmem_param_set = 1;
+	return 0;
+}
+early_param("pmem_size", pmem_size_setup);
+
+static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
+
+static int __init pmem_adsp_size_setup(char *p)
+{
+	pmem_adsp_size = memparse(p, NULL);
+	return 0;
+}
+early_param("pmem_adsp_size", pmem_adsp_size_setup);
+
+static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
+
+static int __init pmem_audio_size_setup(char *p)
+{
+	pmem_audio_size = memparse(p, NULL);
+	return 0;
+}
+early_param("pmem_audio_size", pmem_audio_size_setup);
+#endif
+
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+static struct android_pmem_platform_data android_pmem_pdata = {
+	.name = "pmem",
+	.allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
+	.cached = 1,
+	.memory_type = MEMTYPE_EBI1,
+};
+
+static struct platform_device android_pmem_device = {
+	.name = "android_pmem",
+	.id = 0,
+	.dev = {.platform_data = &android_pmem_pdata},
+};
+
+static struct android_pmem_platform_data android_pmem_adsp_pdata = {
+	.name = "pmem_adsp",
+	.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
+	.cached = 0,
+	.memory_type = MEMTYPE_EBI1,
+};
+
+static struct platform_device android_pmem_adsp_device = {
+	.name = "android_pmem",
+	.id = 2,
+	.dev = { .platform_data = &android_pmem_adsp_pdata },
+};
+
+static struct android_pmem_platform_data android_pmem_audio_pdata = {
+	.name = "pmem_audio",
+	.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
+	.cached = 0,
+	.memory_type = MEMTYPE_EBI1,
+};
+
+static struct platform_device android_pmem_audio_device = {
+	.name = "android_pmem",
+	.id = 4,
+	.dev = { .platform_data = &android_pmem_audio_pdata },
+};
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+
+struct fmem_platform_data fmem_pdata = {
+};
+
+static struct memtype_reserve msm8960_reserve_table[] __initdata = {
+	[MEMTYPE_SMI] = {
+	},
+	[MEMTYPE_EBI0] = {
+		.flags	=	MEMTYPE_FLAGS_1M_ALIGN,
+	},
+	[MEMTYPE_EBI1] = {
+		.flags	=	MEMTYPE_FLAGS_1M_ALIGN,
+	},
+};
+
+static void __init reserve_rtb_memory(void)
+{
+#if defined(CONFIG_MSM_RTB)
+	msm8960_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
+#endif
+}
+
+static void __init size_pmem_devices(void)
+{
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	android_pmem_adsp_pdata.size = pmem_adsp_size;
+
+	if (!pmem_param_set && machine_is_msm8960_liquid())
+		pmem_size = MSM_LIQUID_PMEM_SIZE;
+	android_pmem_pdata.size = pmem_size;
+	android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+}
+
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+static void __init reserve_memory_for(struct android_pmem_platform_data *p)
+{
+	msm8960_reserve_table[p->memory_type].size += p->size;
+}
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+
+
+static void __init reserve_pmem_memory(void)
+{
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	reserve_memory_for(&android_pmem_adsp_pdata);
+	reserve_memory_for(&android_pmem_pdata);
+	reserve_memory_for(&android_pmem_audio_pdata);
+#endif
+	msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
+#endif
+}
+
+static int msm8960_paddr_to_memtype(unsigned int paddr)
+{
+	return MEMTYPE_EBI1;
+}
+
+#define FMEM_ENABLED 0
+
+#ifdef CONFIG_ION_MSM
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
+	.permission_type = IPT_TYPE_MM_CARVEOUT,
+	.align = PAGE_SIZE,
+	.reusable = FMEM_ENABLED,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_MIDDLE,
+	.iommu_map_all = 1,
+	.iommu_2x_map_domain = VIDEO_DOMAIN,
+#ifdef CONFIG_CMA
+	.is_cma = 1,
+#endif
+};
+
+static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
+	.permission_type = IPT_TYPE_MFC_SHAREDMEM,
+	.align = PAGE_SIZE,
+	.reusable = 0,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_HIGH,
+};
+
+static struct ion_co_heap_pdata co_ion_pdata = {
+	.adjacent_mem_id = INVALID_HEAP_ID,
+	.align = PAGE_SIZE,
+	.mem_is_fmem = 0,
+};
+
+static struct ion_co_heap_pdata fw_co_ion_pdata = {
+	.adjacent_mem_id = ION_CP_MM_HEAP_ID,
+	.align = SZ_128K,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_LOW,
+};
+#endif
+
+static u64 msm_dmamask = DMA_BIT_MASK(32);
+
+static struct platform_device ion_mm_heap_device = {
+	.name = "ion-mm-heap-device",
+	.id = -1,
+	.dev = {
+		.dma_mask = &msm_dmamask,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	}
+};
+
+#ifdef CONFIG_CMA
+static struct platform_device ion_adsp_heap_device = {
+	.name = "ion-adsp-heap-device",
+	.id = -1,
+	.dev = {
+		.dma_mask = &msm_dmamask,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	}
+};
+#endif
+
+/**
+ * These heaps are listed in the order they will be allocated. Due to
+ * video hardware restrictions and content protection the FW heap has to
+ * be allocated adjacent (below) the MM heap and the MFC heap has to be
+ * allocated after the MM heap to ensure MFC heap is not more than 256MB
+ * away from the base address of the FW heap.
+ * However, the order of FW heap and MM heap doesn't matter since these
+ * two heaps are taken care of by separate code to ensure they are adjacent
+ * to each other.
+ * Don't swap the order unless you know what you are doing!
+ */
+struct ion_platform_heap msm8960_heaps[] = {
+		{
+			.id	= ION_SYSTEM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_SYSTEM,
+			.name	= ION_VMALLOC_HEAP_NAME,
+		},
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+		{
+			.id	= ION_CP_MM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CP,
+			.name	= ION_MM_HEAP_NAME,
+			.size	= MSM_ION_MM_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &cp_mm_ion_pdata,
+			.priv	= &ion_mm_heap_device.dev,
+		},
+		{
+			.id	= ION_MM_FIRMWARE_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_MM_FIRMWARE_HEAP_NAME,
+			.size	= MSM_ION_MM_FW_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &fw_co_ion_pdata,
+		},
+		{
+			.id	= ION_CP_MFC_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CP,
+			.name	= ION_MFC_HEAP_NAME,
+			.size	= MSM_ION_MFC_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &cp_mfc_ion_pdata,
+		},
+#ifndef CONFIG_MSM_IOMMU
+		{
+			.id	= ION_SF_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_SF_HEAP_NAME,
+			.size	= MSM_ION_SF_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+#endif
+		{
+			.id	= ION_IOMMU_HEAP_ID,
+			.type	= ION_HEAP_TYPE_IOMMU,
+			.name	= ION_IOMMU_HEAP_NAME,
+		},
+		{
+			.id	= ION_QSECOM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_QSECOM_HEAP_NAME,
+			.size	= MSM_ION_QSECOM_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+		{
+			.id	= ION_AUDIO_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_AUDIO_HEAP_NAME,
+			.size	= MSM_ION_AUDIO_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+#ifdef CONFIG_CMA
+		{
+			.id	= ION_ADSP_HEAP_ID,
+			.type	= ION_HEAP_TYPE_DMA,
+			.name	= ION_ADSP_HEAP_NAME,
+			.size	= MSM_ION_ADSP_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+			.priv	= &ion_adsp_heap_device.dev,
+		},
+#endif
+#endif
+};
+
+static struct ion_platform_data msm8960_ion_pdata = {
+	.nr = MSM_ION_HEAP_NUM,
+	.heaps = msm8960_heaps,
+};
+
+static struct platform_device ion_dev = {
+	.name = "ion-msm",
+	.id = 1,
+	.dev = { .platform_data = &msm8960_ion_pdata },
+};
+#endif
+
+struct platform_device fmem_device = {
+	.name = "fmem",
+	.id = 1,
+	.dev = { .platform_data = &fmem_pdata },
+};
+
+static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
+				      unsigned long size)
+{
+	msm8960_reserve_table[MEMTYPE_EBI1].size += size;
+}
+
+static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
+{
+#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	int ret;
+
+	if (fixed_area_size > MAX_FIXED_AREA_SIZE)
+		panic("fixed area size is larger than %dM\n",
+			MAX_FIXED_AREA_SIZE >> 20);
+
+	reserve_info->fixed_area_size = fixed_area_size;
+	reserve_info->fixed_area_start = MSM8960_FW_START;
+
+	ret = memblock_remove(reserve_info->fixed_area_start,
+		reserve_info->fixed_area_size);
+	BUG_ON(ret);
+#endif
+}
+
+/**
+ * Reserve memory for ION and calculate amount of reusable memory for fmem.
+ * We only reserve memory for heaps that are not reusable. However, we only
+ * support one reusable heap at the moment so we ignore the reusable flag for
+ * other than the first heap with reusable flag set. Also handle special case
+ * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
+ * at a higher address than FW in addition to not more than 256MB away from the
+ * base address of the firmware. This means that if MM is reusable the other
+ * two heaps must be allocated in the same region as FW. This is handled by the
+ * mem_is_fmem flag in the platform data. In addition the MM heap must be
+ * adjacent to the FW heap for content protection purposes.
+ */
+static void __init reserve_ion_memory(void)
+{
+#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	unsigned int i;
+	int ret;
+	unsigned int fixed_size = 0;
+	unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
+	unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
+	unsigned long cma_alignment;
+	unsigned int low_use_cma = 0;
+	unsigned int middle_use_cma = 0;
+	unsigned int high_use_cma = 0;
+
+	fixed_low_size = 0;
+	fixed_middle_size = 0;
+	fixed_high_size = 0;
+
+	cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
+
+	for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
+		struct ion_platform_heap *heap =
+						&(msm8960_ion_pdata.heaps[i]);
+		int align = SZ_4K;
+		int iommu_map_all = 0;
+		int adjacent_mem_id = INVALID_HEAP_ID;
+		int use_cma = 0;
+
+		if (heap->extra_data) {
+			int fixed_position = NOT_FIXED;
+
+			switch ((int) heap->type) {
+			case ION_HEAP_TYPE_CP:
+				fixed_position = ((struct ion_cp_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				align = ((struct ion_cp_heap_pdata *)
+						heap->extra_data)->align;
+				iommu_map_all =
+					((struct ion_cp_heap_pdata *)
+					heap->extra_data)->iommu_map_all;
+				if (((struct ion_cp_heap_pdata *)
+					heap->extra_data)->is_cma) {
+					heap->size = ALIGN(heap->size,
+							cma_alignment);
+					use_cma = 1;
+				}
+				break;
+			case ION_HEAP_TYPE_DMA:
+					use_cma = 1;
+				/* Purposely fall through here */
+			case ION_HEAP_TYPE_CARVEOUT:
+				fixed_position = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				adjacent_mem_id = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->adjacent_mem_id;
+				break;
+			default:
+				break;
+			}
+
+			if (iommu_map_all) {
+				if (heap->size & (SZ_64K-1)) {
+					heap->size = ALIGN(heap->size, SZ_64K);
+					pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
+						heap->name, heap->size);
+				}
+			}
+
+			if (fixed_position != NOT_FIXED)
+				fixed_size += heap->size;
+			else
+				reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
+
+			if (fixed_position == FIXED_LOW) {
+				fixed_low_size += heap->size;
+				low_use_cma = use_cma;
+			} else if (fixed_position == FIXED_MIDDLE) {
+				fixed_middle_size += heap->size;
+				middle_use_cma = use_cma;
+			} else if (fixed_position == FIXED_HIGH) {
+				fixed_high_size += heap->size;
+				high_use_cma = use_cma;
+			} else if (use_cma) {
+				/*
+				 * Heaps that use CMA but are not part of the
+				 * fixed set. Create wherever.
+				 */
+				dma_declare_contiguous(
+					heap->priv,
+					heap->size,
+					0,
+					0xb0000000);
+			}
+		}
+	}
+
+	if (!fixed_size)
+		return;
+
+	/*
+	 * Given the setup for the fixed area, we can't round up all sizes.
+	 * Some sizes must be set up exactly and aligned correctly. Incorrect
+	 * alignments are considered a configuration issue
+	 */
+
+	fixed_low_start = MSM8960_FIXED_AREA_START;
+	if (low_use_cma) {
+		BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
+		BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
+	} else {
+		BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
+		ret = memblock_remove(fixed_low_start,
+				      fixed_low_size + HOLE_SIZE);
+		BUG_ON(ret);
+	}
+
+	fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
+	if (middle_use_cma) {
+		BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
+		BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
+	} else {
+		BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
+		ret = memblock_remove(fixed_middle_start, fixed_middle_size);
+		BUG_ON(ret);
+	}
+
+	fixed_high_start = fixed_middle_start + fixed_middle_size;
+	if (high_use_cma) {
+		fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
+		BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
+	} else {
+		/* This is the end of the fixed area so it's okay to round up */
+		fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
+		ret = memblock_remove(fixed_high_start, fixed_high_size);
+		BUG_ON(ret);
+	}
+
+
+
+	for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
+		struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
+
+		if (heap->extra_data) {
+			int fixed_position = NOT_FIXED;
+			struct ion_cp_heap_pdata *pdata = NULL;
+
+			switch ((int) heap->type) {
+			case ION_HEAP_TYPE_CP:
+				pdata =
+				(struct ion_cp_heap_pdata *)heap->extra_data;
+				fixed_position = pdata->fixed_position;
+				break;
+			case ION_HEAP_TYPE_CARVEOUT:
+			case ION_HEAP_TYPE_DMA:
+				fixed_position = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				break;
+			default:
+				break;
+			}
+
+			switch (fixed_position) {
+			case FIXED_LOW:
+				heap->base = fixed_low_start;
+				break;
+			case FIXED_MIDDLE:
+				heap->base = fixed_middle_start;
+				if (middle_use_cma) {
+					ret = dma_declare_contiguous(
+						&ion_mm_heap_device.dev,
+						heap->size,
+						fixed_middle_start,
+						0xa0000000);
+					WARN_ON(ret);
+				}
+				pdata->secure_base = fixed_middle_start
+							- HOLE_SIZE;
+				pdata->secure_size = HOLE_SIZE + heap->size;
+				break;
+			case FIXED_HIGH:
+				heap->base = fixed_high_start;
+				break;
+			default:
+				break;
+			}
+		}
+	}
+#endif
+}
+
+static void __init reserve_mdp_memory(void)
+{
+	msm8960_mdp_writeback(msm8960_reserve_table);
+}
+
+static void reserve_cache_dump_memory(void)
+{
+#ifdef CONFIG_MSM_CACHE_DUMP
+	unsigned int spare;
+	unsigned int l1_size;
+	unsigned int total;
+	int ret;
+
+	ret = scm_call(L1C_SERVICE_ID, L1C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
+		sizeof(spare), &l1_size, sizeof(l1_size));
+
+	if (ret)
+		/* Fall back to something reasonable here */
+		l1_size = L1_BUFFER_SIZE;
+
+	total = l1_size + L2_BUFFER_SIZE;
+
+	msm8960_reserve_table[MEMTYPE_EBI1].size += total;
+	msm_cache_dump_pdata.l1_size = l1_size;
+#endif
+}
+
+static void __init msm8960_calculate_reserve_sizes(void)
+{
+	size_pmem_devices();
+	reserve_pmem_memory();
+	reserve_ion_memory();
+	reserve_mdp_memory();
+	reserve_rtb_memory();
+	reserve_cache_dump_memory();
+}
+
+static struct reserve_info msm8960_reserve_info __initdata = {
+	.memtype_reserve_table = msm8960_reserve_table,
+	.calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
+	.reserve_fixed_area = msm8960_reserve_fixed_area,
+	.paddr_to_memtype = msm8960_paddr_to_memtype,
+};
+
+static void __init fighter_early_memory(void)
+{
+	reserve_info = &msm8960_reserve_info;
+}
+
+static void __init fighter_reserve(void)
+{
+	msm_reserve();
+}
+
+static void __init msm8960_allocate_memory_regions(void)
+{
+	msm8960_allocate_fb_region();
+}
+
+#ifdef CONFIG_WCD9310_CODEC
+
+#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
+
+/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
+ * 4 micbiases are used to power various analog and digital
+ * microphones operating at 1800 mV. Technically, all micbiases
+ * can source from single cfilter since all microphones operate
+ * at the same voltage level. The arrangement below is to make
+ * sure all cfilters are exercised. LDO_H regulator ouput level
+ * does not need to be as high as 2.85V. It is choosen for
+ * microphone sensitivity purpose.
+ */
+static struct wcd9xxx_pdata tabla_platform_data = {
+	.slimbus_slave_device = {
+		.name = "tabla-slave",
+		.e_addr = {0, 0, 0x10, 0, 0x17, 2},
+	},
+	.irq = MSM_GPIO_TO_INT(62),
+	.irq_base = TABLA_INTERRUPT_BASE,
+	.num_irqs = NR_TABLA_IRQS,
+	.reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
+	.micbias = {
+		.ldoh_v = TABLA_LDOH_2P85_V,
+		.cfilt1_mv = 1800,
+		.cfilt2_mv = 1800,
+		.cfilt3_mv = 1800,
+		.bias1_cfilt_sel = TABLA_CFILT1_SEL,
+		.bias2_cfilt_sel = TABLA_CFILT2_SEL,
+		.bias3_cfilt_sel = TABLA_CFILT3_SEL,
+		.bias4_cfilt_sel = TABLA_CFILT3_SEL,
+	},
+	.regulator = {
+	{
+		.name = "CDC_VDD_CP",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_RX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_TX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
+	},
+	{
+		.name = "VDDIO_CDC",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
+	},
+	{
+		.name = "VDDD_CDC_D",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_A_1P2V",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
+	},
+	},
+};
+
+static struct slim_device msm_slim_tabla = {
+	.name = "tabla-slim",
+	.e_addr = {0, 1, 0x10, 0, 0x17, 2},
+	.dev = {
+		.platform_data = &tabla_platform_data,
+	},
+};
+
+static struct wcd9xxx_pdata tabla20_platform_data = {
+	.slimbus_slave_device = {
+		.name = "tabla-slave",
+		.e_addr = {0, 0, 0x60, 0, 0x17, 2},
+	},
+	.irq = MSM_GPIO_TO_INT(62),
+	.irq_base = TABLA_INTERRUPT_BASE,
+	.num_irqs = NR_TABLA_IRQS,
+	.reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
+	.amic_settings = {
+		.legacy_mode = 0x7F,
+		.use_pdata = 0x7F,
+	},
+	.micbias = {
+		.ldoh_v = TABLA_LDOH_2P85_V,
+		.cfilt1_mv = 1800,
+		.cfilt2_mv = 1800,
+		.cfilt3_mv = 1800,
+		.bias1_cfilt_sel = TABLA_CFILT1_SEL,
+		.bias2_cfilt_sel = TABLA_CFILT2_SEL,
+		.bias3_cfilt_sel = TABLA_CFILT3_SEL,
+		.bias4_cfilt_sel = TABLA_CFILT3_SEL,
+	},
+	.regulator = {
+	{
+		.name = "CDC_VDD_CP",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_RX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_TX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
+	},
+	{
+		.name = "VDDIO_CDC",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
+	},
+	{
+		.name = "VDDD_CDC_D",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_A_1P2V",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
+	},
+	},
+};
+
+static struct slim_device msm_slim_tabla20 = {
+	.name = "tabla2x-slim",
+	.e_addr = {0, 1, 0x60, 0, 0x17, 2},
+	.dev = {
+		.platform_data = &tabla20_platform_data,
+	},
+};
+#endif
+
+static struct slim_boardinfo msm_slim_devices[] = {
+#ifdef CONFIG_WCD9310_CODEC
+	{
+		.bus_num = 1,
+		.slim_slave = &msm_slim_tabla,
+	},
+	{
+		.bus_num = 1,
+		.slim_slave = &msm_slim_tabla20,
+	},
+#endif
+	/* add more slimbus slaves as needed */
+};
+
+#define MSM_WCNSS_PHYS	0x03000000
+#define MSM_WCNSS_SIZE	0x280000
+
+static struct resource resources_wcnss_wlan[] = {
+	{
+		.start	= RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
+		.end	= RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
+		.name	= "wcnss_wlanrx_irq",
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
+		.end	= RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
+		.name	= "wcnss_wlantx_irq",
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= MSM_WCNSS_PHYS,
+		.end	= MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
+		.name	= "wcnss_mmio",
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start  = 84,
+		.end    = 88,
+		.name   = "wcnss_gpios_5wire",
+		.flags  = IORESOURCE_IO,
+	},
+};
+
+static struct qcom_wcnss_opts qcom_wcnss_pdata = {
+	.has_48mhz_xo	= 1,
+};
+
+static struct platform_device msm_device_wcnss_wlan = {
+	.name		= "wcnss_wlan",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(resources_wcnss_wlan),
+	.resource	= resources_wcnss_wlan,
+	.dev		= {.platform_data = &qcom_wcnss_pdata},
+};
+
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+
+#define QCE_SIZE		0x10000
+#define QCE_0_BASE		0x18500000
+
+#define QCE_HW_KEY_SUPPORT	0
+#define QCE_SHA_HMAC_SUPPORT	1
+#define QCE_SHARE_CE_RESOURCE	1
+#define QCE_CE_SHARED		0
+
+/* Begin Bus scaling definitions */
+static struct msm_bus_vectors crypto_hw_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT1,
+		.dst = MSM_BUS_SLAVE_GSBI1_UART,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+
+static struct msm_bus_vectors crypto_hw_active_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 70000000UL,
+		.ib = 70000000UL,
+	},
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT1,
+		.dst = MSM_BUS_SLAVE_GSBI1_UART,
+		.ab = 2480000000UL,
+		.ib = 2480000000UL,
+	},
+};
+
+static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(crypto_hw_init_vectors),
+		crypto_hw_init_vectors,
+	},
+	{
+		ARRAY_SIZE(crypto_hw_active_vectors),
+		crypto_hw_active_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
+	crypto_hw_bus_scale_usecases,
+	ARRAY_SIZE(crypto_hw_bus_scale_usecases),
+	.name = "cryptohw",
+};
+/* End Bus Scaling Definitions*/
+
+static struct resource qcrypto_resources[] = {
+	[0] = {
+		.start = QCE_0_BASE,
+		.end = QCE_0_BASE + QCE_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.name = "crypto_channels",
+		.start = DMOV_CE_IN_CHAN,
+		.end = DMOV_CE_OUT_CHAN,
+		.flags = IORESOURCE_DMA,
+	},
+	[2] = {
+		.name = "crypto_crci_in",
+		.start = DMOV_CE_IN_CRCI,
+		.end = DMOV_CE_IN_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+	[3] = {
+		.name = "crypto_crci_out",
+		.start = DMOV_CE_OUT_CRCI,
+		.end = DMOV_CE_OUT_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+};
+
+static struct resource qcedev_resources[] = {
+	[0] = {
+		.start = QCE_0_BASE,
+		.end = QCE_0_BASE + QCE_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.name = "crypto_channels",
+		.start = DMOV_CE_IN_CHAN,
+		.end = DMOV_CE_OUT_CHAN,
+		.flags = IORESOURCE_DMA,
+	},
+	[2] = {
+		.name = "crypto_crci_in",
+		.start = DMOV_CE_IN_CRCI,
+		.end = DMOV_CE_IN_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+	[3] = {
+		.name = "crypto_crci_out",
+		.start = DMOV_CE_OUT_CRCI,
+		.end = DMOV_CE_OUT_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+};
+
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
+
+static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
+	.ce_shared = QCE_CE_SHARED,
+	.shared_ce_resource = QCE_SHARE_CE_RESOURCE,
+	.hw_key_support = QCE_HW_KEY_SUPPORT,
+	.sha_hmac = QCE_SHA_HMAC_SUPPORT,
+	.bus_scale_table = &crypto_hw_bus_scale_pdata,
+};
+
+static struct platform_device qcrypto_device = {
+	.name		= "qcrypto",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(qcrypto_resources),
+	.resource	= qcrypto_resources,
+	.dev		= {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data = &qcrypto_ce_hw_suppport,
+	},
+};
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+
+static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
+	.ce_shared = QCE_CE_SHARED,
+	.shared_ce_resource = QCE_SHARE_CE_RESOURCE,
+	.hw_key_support = QCE_HW_KEY_SUPPORT,
+	.sha_hmac = QCE_SHA_HMAC_SUPPORT,
+	.bus_scale_table = &crypto_hw_bus_scale_pdata,
+};
+
+static struct platform_device qcedev_device = {
+	.name		= "qce",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(qcedev_resources),
+	.resource	= qcedev_resources,
+	.dev		= {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data = &qcedev_ce_hw_suppport,
+	},
+};
+#endif
+
+#ifdef CONFIG_HTC_BATT_8960
+static struct htc_battery_platform_data htc_battery_pdev_data = {
+	.guage_driver = 0,
+	.chg_limit_active_mask = HTC_BATT_CHG_LIMIT_BIT_TALK |
+								HTC_BATT_CHG_LIMIT_BIT_NAVI,
+	.critical_low_voltage_mv = 3200,
+	.critical_alarm_voltage_mv = 3000,
+	.overload_vol_thr_mv = 4000,
+	.overload_curr_thr_ma = 0,
+	/* charger */
+	.icharger.name = "pm8921",
+	.icharger.get_charging_source = pm8921_get_charging_source,
+	.icharger.get_charging_enabled = pm8921_get_charging_enabled,
+	.icharger.set_charger_enable = pm8921_charger_enable,
+	.icharger.set_pwrsrc_enable = pm8921_pwrsrc_enable,
+	.icharger.set_pwrsrc_and_charger_enable =
+						pm8921_set_pwrsrc_and_charger_enable,
+	.icharger.set_limit_charge_enable = pm8921_limit_charge_enable,
+	.icharger.is_ovp = pm8921_is_charger_ovp,
+	.icharger.is_batt_temp_fault_disable_chg =
+						pm8921_is_batt_temp_fault_disable_chg,
+	.icharger.charger_change_notifier_register =
+						cable_detect_register_notifier,
+	.icharger.dump_all = pm8921_dump_all,
+	.icharger.get_attr_text = pm8921_charger_get_attr_text,
+	/* gauge */
+	.igauge.name = "pm8921",
+	.igauge.get_battery_voltage = pm8921_get_batt_voltage,
+	.igauge.get_battery_current = pm8921_bms_get_batt_current,
+	.igauge.get_battery_temperature = pm8921_get_batt_temperature,
+	.igauge.get_battery_id = pm8921_get_batt_id,
+	.igauge.get_battery_soc = pm8921_bms_get_batt_soc,
+	.igauge.get_battery_cc = pm8921_bms_get_batt_cc,
+	.igauge.is_battery_temp_fault = pm8921_is_batt_temperature_fault,
+	.igauge.is_battery_full = pm8921_is_batt_full,
+	.igauge.get_attr_text = pm8921_gauge_get_attr_text,
+	.igauge.register_lower_voltage_alarm_notifier =
+						pm8xxx_batt_lower_alarm_register_notifier,
+	.igauge.enable_lower_voltage_alarm = pm8xxx_batt_lower_alarm_enable,
+	.igauge.set_lower_voltage_alarm_threshold =
+						pm8xxx_batt_lower_alarm_threshold_set,
+};
+
+static struct platform_device htc_battery_pdev = {
+	.name = "htc_battery",
+	.id = -1,
+	.dev    = {
+		.platform_data = &htc_battery_pdev_data,
+	},
+};
+#endif /* CONFIG_HTC_BATT_8960 */
+
+/* HTC_HEADSET_PMIC Driver */
+static struct htc_headset_pmic_platform_data htc_headset_pmic_data = {
+	.driver_flag		= DRIVER_HS_PMIC_ADC,
+	.hpin_gpio		= PM8921_GPIO_PM_TO_SYS(
+					FIGHTER_EARPHONE_DETz),
+	.hpin_irq		= 0,
+	.key_gpio		= PM8921_GPIO_PM_TO_SYS(
+					FIGHTER_HS_RX_PMIC_REMO),
+	.key_irq		= 0,
+	.key_enable_gpio	= 0,
+	.adc_mic		= 0,
+	.adc_remote		= {0, 57, 58, 147, 148, 339},
+	.adc_mpp		= PM8XXX_AMUX_MPP_10,
+	.adc_amux		= ADC_MPP_1_AMUX6,
+	.hs_controller		= 0,
+	.hs_switch		= 0,
+};
+
+static struct platform_device htc_headset_pmic = {
+	.name	= "HTC_HEADSET_PMIC",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &htc_headset_pmic_data,
+	},
+};
+
+/* HTC_HEADSET_MGR Driver */
+static struct platform_device *headset_devices[] = {
+	&htc_headset_pmic,
+	/* Please put the headset detection driver on the last */
+};
+
+static struct headset_adc_config htc_headset_mgr_config[] = {
+	{
+		.type = HEADSET_MIC,
+		.adc_max = 1560,
+		.adc_min = 1223,
+	},
+	{
+		.type = HEADSET_BEATS,
+		.adc_max = 1222,
+		.adc_min = 916,
+	},
+	{
+		.type = HEADSET_BEATS_SOLO,
+		.adc_max = 915,
+		.adc_min = 566,
+	},
+	{
+		.type = HEADSET_MIC, /* No Metrico device */
+		.adc_max = 565,
+		.adc_min = 255,
+	},
+	{
+		.type = HEADSET_NO_MIC,
+		.adc_max = 254,
+		.adc_min = 0,
+	},
+};
+
+static struct htc_headset_mgr_platform_data htc_headset_mgr_data = {
+	.driver_flag		= DRIVER_HS_MGR_FLOAT_DET,
+	.headset_devices_num	= ARRAY_SIZE(headset_devices),
+	.headset_devices	= headset_devices,
+	.headset_config_num	= ARRAY_SIZE(htc_headset_mgr_config),
+	.headset_config		= htc_headset_mgr_config,
+};
+
+static struct platform_device htc_headset_mgr = {
+	.name	= "HTC_HEADSET_MGR",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &htc_headset_mgr_data,
+	},
+};
+
+static void headset_device_register(void)
+{
+	pr_info("[HS_BOARD] (%s) Headset device register\n", __func__);
+
+	platform_device_register(&htc_headset_mgr);
+}
+
+static struct atmel_i2c_platform_data ts_atmel_data[] = {
+	{
+		.version = 0x0011,
+		.build = 0xAA,
+		.source = 1, /* YFO */
+		.abs_x_min = 0,
+		.abs_x_max = 1024,
+		.abs_y_min = 0,
+		.abs_y_max = 950,
+		.abs_pressure_min = 0,
+		.abs_pressure_max = 255,
+		.abs_width_min = 0,
+		.abs_width_max = 20,
+		.gpio_irq = FIGHTER_TP_ATTz,
+		.config_T6 = {0, 0, 0, 0, 0, 0},
+		.config_T7 = {15, 8, 50},
+		.config_T8 = {27, 0, 5, 20, 0, 0, 2, 30, 16, 192},
+		.config_T9 = {139, 0, 0, 19, 11, 0, 16, 40, 3, 1, 0, 5, 2, 0, 4, 20, 40, 10, 0, 0, 0, 0, 5, 10, 18, 40, 146, 50, 147, 80, 18, 17, 58, 59, 0},
+		.config_T15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T18 = {0, 0},
+		.config_T19 = {3, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T23 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T25 = {3, 0, 37, 103, 133, 87, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T40 = {0, 0, 0, 0, 0},
+		.config_T42 = {0, 0, 40, 35, 128, 2, 0, 10},
+		.config_T46 = {0, 3, 8, 8, 0, 0, 0, 0, 0},
+		.config_T47 = {0, 20, 50, 5, 2, 50, 40, 0, 0, 63},
+		.config_T48 = {15, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 100, 4, 64, 10, 0, 20, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T55 = {0, 0, 0, 0},
+		.config_T58 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+	},
+	{
+		.version = 0x0011,
+		.build = 0xAA,
+		.source = 0, /* TPK */
+		.abs_x_min = 0,
+		.abs_x_max = 1024,
+		.abs_y_min = 0,
+		.abs_y_max = 950,
+		.abs_pressure_min = 0,
+		.abs_pressure_max = 255,
+		.abs_width_min = 0,
+		.abs_width_max = 20,
+		.gpio_irq = FIGHTER_TP_ATTz,
+		.config_T6 = {0, 0, 0, 0, 0, 0},
+		.config_T7 = {15, 8, 50},
+		.config_T8 = {20, 0, 5, 20, 0, 0, 2, 30, 16, 192},
+		.config_T9 = {139, 0, 0, 19, 11, 0, 16, 40, 3, 1, 0, 5, 2, 0, 4, 20, 40, 10, 0, 0, 0, 0, 3, 6, 22, 38, 143, 55, 147, 82, 18, 17, 58, 59, 0},
+		.config_T15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T18 = {0, 0},
+		.config_T19 = {3, 0, 0, 60, 0, 0},
+		.config_T23 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T25 = {3, 0, 252, 98, 92, 83, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T40 = {0, 0, 0, 0, 0},
+		.config_T42 = {0, 0, 40, 35, 128, 2, 0, 10},
+		.config_T46 = {0, 3, 8, 8, 0, 0, 0, 0, 0},
+		.config_T47 = {0, 20, 50, 5, 2, 50, 40, 0, 0, 63},
+		.config_T48 = {15, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 100, 4, 64, 10, 0, 20, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T55 = {0, 0, 0, 0},
+		.config_T58 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+	},
+	{
+		.version = 0x0010,
+		.build = 0xAA,
+		.source = 1, /* YFO */
+		.abs_x_min = 0,
+		.abs_x_max = 1024,
+		.abs_y_min = 0,
+		.abs_y_max = 950,
+		.abs_pressure_min = 0,
+		.abs_pressure_max = 255,
+		.abs_width_min = 0,
+		.abs_width_max = 20,
+		.gpio_irq = FIGHTER_TP_ATTz,
+		.config_T6 = {0, 0, 0, 0, 0, 0},
+		.config_T7 = {15, 8, 50},
+		.config_T8 = {20, 0, 5, 20, 0, 0, 2, 30, 16, 192},
+		.config_T9 = {139, 0, 0, 19, 11, 0, 16, 40, 1, 1, 0, 5, 2, 0, 4, 20, 40, 10, 0, 0, 0, 0, 0, 0, 35, 35, 142, 60, 138, 75, 18, 17, 58, 59, 0},
+		.config_T15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T18 = {0, 0},
+		.config_T19 = {3, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T23 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T25 = {3, 0, 224, 110, 64, 95, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T40 = {0, 0, 0, 0, 0},
+		.config_T42 = {0, 0, 40, 35, 128, 2, 0, 10},
+		.config_T46 = {0, 3, 4, 8, 0, 0, 0, 0, 0},
+		.config_T47 = {0, 20, 50, 5, 2, 50, 40, 0, 0, 63},
+		.config_T48 = {3, 64, 196, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 100, 4, 64, 10, 0, 20, 0, 0, 38, 0, 25, 0, 0, 0, 0, 0, 0, 0, 35, 3, 5, 2, 1, 5, 20, 50, 0, 0, 0, 0, 0, 0, 0, 0, 18, 17, 4},
+	},
+	{
+		.version = 0x0010,
+		.build = 0xAA,
+		.source = 0, /* TPK */
+		.abs_x_min = 0,
+		.abs_x_max = 1024,
+		.abs_y_min = 0,
+		.abs_y_max = 950,
+		.abs_pressure_min = 0,
+		.abs_pressure_max = 255,
+		.abs_width_min = 0,
+		.abs_width_max = 20,
+		.gpio_irq = FIGHTER_TP_ATTz,
+		.config_T6 = {0, 0, 0, 0, 0, 0},
+		.config_T7 = {15, 8, 50},
+		.config_T8 = {20, 0, 5, 20, 0, 0, 2, 30, 16, 192},
+		.config_T9 = {139, 0, 0, 19, 11, 0, 16, 40, 1, 1, 0, 5, 2, 0, 4, 20, 40, 10, 0, 0, 0, 0, 10, 10, 40, 40, 138, 50, 139, 60, 18, 17, 58, 59, 0},
+		.config_T15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T18 = {0, 0},
+		.config_T19 = {3, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T23 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T25 = {3, 0, 224, 110, 64, 95, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T40 = {0, 0, 0, 0, 0},
+		.config_T42 = {0, 0, 40, 35, 128, 2, 0, 10},
+		.config_T46 = {0, 3, 4, 8, 0, 0, 0, 0, 0},
+		.config_T47 = {0, 20, 50, 5, 2, 50, 40, 0, 0, 63},
+		.config_T48 = {3, 64, 196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 4, 64, 10, 0, 20, 0, 0, 38, 0, 25, 0, 0, 0, 0, 0, 0, 0, 35, 3, 5, 2, 1, 5, 20, 50, 0, 0, 0, 0, 0, 0, 0, 0, 18, 17, 4},
+	},
+};
+
+static struct synaptics_i2c_rmi_platform_data syn_ts_3k_data[] = { /* Synatpics sensor */
+	{
+		.version = 0x3330,
+		.packrat_number = 1100754,
+		.abs_x_min = 0,
+		.abs_x_max = 1000,
+		.abs_y_min = 0,
+		.abs_y_max = 1760,
+		.flags = SYNAPTICS_FLIP_Y,
+		.gpio_irq = FIGHTER_TP_ATTz,
+		.gpio_reset = FIGHTER_TP_RSTz,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.reduce_report_level = {65, 65, 50, 0, 0},
+		.large_obj_check = 1,
+		.default_config = 2,
+		.customer_register = {0xF9, 0x32, 0x05, 0x64},
+		.tw_pin_mask = 0x0080,
+		.config = {0x41, 0x30, 0x31, 0x40, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0xE8, 0x03, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x28, 0xF4, 0x28, 0x1E, 0x05, 0x01, 0x3C, 0x17,
+			0x01, 0x1B, 0x01, 0x66, 0x4E, 0x66, 0x46, 0x7F,
+			0xBB, 0x30, 0xB7, 0x01, 0x40, 0x30, 0x30, 0x00,
+			0x00, 0x0A, 0x04, 0xB2, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x50, 0x32,
+			0xE2, 0x02, 0x32, 0x0A, 0x0A, 0x96, 0x0B, 0x13,
+			0x00, 0x02, 0x66, 0x01, 0x80, 0x02, 0x0E, 0x1F,
+			0x15, 0x3B, 0x00, 0x19, 0x04, 0x1B, 0x00, 0x10,
+			0xFF, 0x01, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+			0x18, 0x19, 0x1A, 0x1B, 0x11, 0xFF, 0xFF, 0xFF,
+			0x03, 0x05, 0x07, 0x13, 0x11, 0x0F, 0x0D, 0x0B,
+			0x0A, 0x09, 0x08, 0x01, 0x02, 0x04, 0x06, 0x0C,
+			0x0E, 0x10, 0x12, 0xFF, 0xA0, 0xA0, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x3F, 0x3D, 0x3C, 0x3A,
+			0x38, 0x37, 0x35, 0x34, 0x00, 0x03, 0x06, 0x09,
+			0x0C, 0x0F, 0x12, 0x15, 0x00, 0xD0, 0x07, 0xFD,
+			0x3C, 0x00, 0x64, 0x00, 0xCD, 0xC8, 0x80, 0xD0,
+			0x07, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00, 0x10,
+			0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x02, 0x02,
+			0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x20, 0x20,
+			0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x65,
+			0x68, 0x6B, 0x6E, 0x71, 0x74, 0x77, 0x00, 0xC8,
+			0x00, 0x10, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D, 0x04},
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1091743,
+		.abs_x_min = 0,
+		.abs_x_max = 1000,
+		.abs_y_min = 0,
+		.abs_y_max = 1760,
+		.flags = SYNAPTICS_FLIP_Y,
+		.gpio_irq = FIGHTER_TP_ATTz,
+		.gpio_reset = FIGHTER_TP_RSTz,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.reduce_report_level = {65, 65, 120, 15, 15},
+		.large_obj_check = 1,
+		.default_config = 2,
+		.tw_pin_mask = 0x0080,
+		.config = {0x41, 0x30, 0x31, 0x39, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0xE8, 0x03, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x28, 0xF4, 0x28, 0x1E, 0x05, 0x01, 0x3C, 0x17,
+			0x01, 0x1B, 0x01, 0x66, 0x4E, 0x66, 0x46, 0x7F,
+			0xBB, 0x30, 0xB7, 0x01, 0x40, 0x30, 0x30, 0x00,
+			0x00, 0x0A, 0x04, 0xB2, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x60, 0x32,
+			0xE2, 0x02, 0x32, 0x0A, 0x0A, 0x96, 0x0B, 0x13,
+			0x00, 0x02, 0x66, 0x01, 0x80, 0x02, 0x0E, 0x1F,
+			0x15, 0x3B, 0x00, 0x19, 0x04, 0x1B, 0x00, 0x10,
+			0xFF, 0x01, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+			0x18, 0x19, 0x1A, 0x1B, 0x11, 0xFF, 0xFF, 0xFF,
+			0x03, 0x05, 0x07, 0x13, 0x11, 0x0F, 0x0D, 0x0B,
+			0x0A, 0x09, 0x08, 0x01, 0x02, 0x04, 0x06, 0x0C,
+			0x0E, 0x10, 0x12, 0xFF, 0xA0, 0xA0, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x3F, 0x3D, 0x3C, 0x3A,
+			0x38, 0x37, 0x35, 0x34, 0x00, 0x03, 0x06, 0x09,
+			0x0C, 0x0F, 0x12, 0x15, 0x00, 0xD0, 0x07, 0xFD,
+			0x3C, 0x00, 0x64, 0x00, 0xCD, 0xC8, 0x80, 0xD0,
+			0x07, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00, 0x10,
+			0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x02, 0x02,
+			0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x20, 0x20,
+			0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x65,
+			0x68, 0x6B, 0x6E, 0x71, 0x74, 0x77, 0x00, 0xC8,
+			0x00, 0x10, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D, 0x04},
+	},
+	{
+		.version = 0x3330,
+		.abs_x_min = 0,
+		.abs_x_max = 1000,
+		.abs_y_min = 0,
+		.abs_y_max = 1760,
+		.flags = SYNAPTICS_FLIP_Y,
+		.gpio_irq = FIGHTER_TP_ATTz,
+		.gpio_reset = FIGHTER_TP_RSTz,
+		.report_type = SYN_AND_REPORT_TYPE_B,
+		.reduce_report_level = {65, 65, 120, 15, 15},
+		.large_obj_check = 1,
+		.default_config = 2,
+		.tw_pin_mask = 0x0080,
+		.config = {0x30, 0x30, 0x30, 0x33, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0xE8, 0x03, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0xD6, 0x09, 0x23, 0x02, 0x01, 0x3C, 0x29,
+			0x00, 0x22, 0x00, 0x00, 0x48, 0x00, 0x40, 0x5D,
+			0xBE, 0xC8, 0xB2, 0x00, 0x18, 0x20, 0x20, 0x00,
+			0x00, 0x0A, 0x04, 0xB2, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x32,
+			0xA3, 0x03, 0x32, 0x04, 0x04, 0x78, 0x0B, 0x13,
+			0x00, 0x02, 0x47, 0x01, 0x80, 0x03, 0x0E, 0x1F,
+			0x15, 0x2F, 0x00, 0x19, 0x04, 0x00, 0x00, 0x10,
+			0xFF, 0x01, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+			0x18, 0x19, 0x1A, 0x1B, 0x11, 0xFF, 0xFF, 0xFF,
+			0x03, 0x05, 0x07, 0x13, 0x11, 0x0F, 0x0D, 0x0B,
+			0x0A, 0x09, 0x08, 0x01, 0x02, 0x04, 0x06, 0x0C,
+			0x0E, 0x10, 0x12, 0xFF, 0xA0, 0xA0, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x3F, 0x3D, 0x3C, 0x3A,
+			0x38, 0x37, 0x35, 0x34, 0x00, 0x03, 0x06, 0x09,
+			0x0C, 0x0F, 0x12, 0x15, 0x00, 0xD0, 0x07, 0x01,
+			0x3C, 0x00, 0x64, 0x00, 0xCD, 0xC8, 0x80, 0xD0,
+			0x07, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00, 0x10,
+			0x00, 0x18, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+			0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+			0x55, 0x58, 0x5A, 0x5C, 0x5E, 0x60, 0x62, 0x64,
+			0x00, 0x4E, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04},
+	},
+	{
+		.version = 0x3230,
+		.abs_x_min = 0,
+		.abs_x_max = 1000,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.flags = SYNAPTICS_FLIP_Y,
+		.gpio_irq = FIGHTER_TP_ATTz,
+		.default_config = 1,
+		.config = {0x30, 0x30, 0x30, 0x34, 0x84, 0x0F, 0x03, 0x1E,
+			0x06, 0x20, 0xB1, 0x01, 0x0B, 0x19, 0x19, 0x00,
+			0x00, 0xE8, 0x03, 0x6C, 0x07, 0x1E, 0x05, 0x2D,
+			0xBF, 0x10, 0xBE, 0x01, 0x01, 0x33, 0x00, 0x43,
+			0xFF, 0x00, 0x48, 0x00, 0x48, 0xDD, 0xAF, 0xF7,
+			0xB0, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x14,
+			0x04, 0xAD, 0x00, 0x02, 0x6D, 0x01, 0x80, 0x03,
+			0x0D, 0x1E, 0x00, 0x29, 0x00, 0x1C, 0x04, 0x1E,
+			0x00, 0x10, 0x00, 0x01, 0x12, 0x13, 0x14, 0x15,
+			0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x11, 0xFF,
+			0xFF, 0xFF, 0x03, 0x05, 0x07, 0x13, 0x11, 0x0F,
+			0x0D, 0x0B, 0x0A, 0x09, 0x08, 0x01, 0x02, 0x04,
+			0x06, 0x0C, 0x0E, 0x10, 0x12, 0xFF, 0xA0, 0xA0,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x3F, 0x3D,
+			0x3C, 0x3A, 0x38, 0x37, 0x35, 0x34, 0x00, 0x03,
+			0x06, 0x09, 0x0C, 0x0F, 0x12, 0x15, 0x01, 0x40,
+			0x14, 0x80, 0x40, 0x14, 0x64, 0x1A, 0xC0, 0x14,
+			0xCC, 0x1A, 0x15, 0x00, 0xC0, 0x80, 0x00, 0x10,
+			0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+			0x02, 0x02, 0x20, 0x30, 0x20, 0x20, 0x20, 0x20,
+			0x20, 0x20, 0x51, 0x7E, 0x57, 0x5A, 0x5D, 0x60,
+			0x63, 0x66, 0x33, 0x43, 0x00, 0x1E, 0x19, 0x05,
+			0x00, 0xFF, 0x3D, 0x08},
+	},
+	{
+		.version = 0x0000,
+		.abs_x_min = 35,
+		.abs_x_max = 965,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.sensitivity_adjust = 0,
+		.finger_support = 10,
+		.flags = SYNAPTICS_FLIP_Y,
+		.gpio_irq = FIGHTER_TP_ATTz,
+		.config = {0x30, 0x30, 0x30, 0x31, 0x84, 0x0F, 0x03, 0x1E,
+			0x05, 0x01, 0x0B, 0x19, 0x19, 0x00, 0x00, 0xE8,
+			0x03, 0x75, 0x07, 0x1E, 0x05, 0x28, 0xF5, 0x28,
+			0x1E, 0x05, 0x01, 0x30, 0x00, 0x30, 0x00, 0x00,
+			0x48, 0x00, 0x48, 0x0D, 0xD6, 0x56, 0xBE, 0x00,
+			0x70, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x04, 0x00,
+			0x02, 0xCD, 0x00, 0x80, 0x03, 0x0D, 0x1F, 0x00,
+			0x21, 0x00, 0x15, 0x04, 0x1E, 0x00, 0x10, 0x02,
+			0x01, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+			0x19, 0x1A, 0x1B, 0x11, 0xFF, 0xFF, 0xFF, 0x05,
+			0x13, 0x0F, 0x0B, 0x09, 0x01, 0x04, 0x0C, 0x10,
+			0x03, 0x07, 0x11, 0x0D, 0x0A, 0x08, 0x02, 0x06,
+			0x0E, 0x12, 0xFF, 0xA0, 0xA0, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x3F, 0x3D, 0x3C, 0x3A, 0x38,
+			0x37, 0x35, 0x34, 0x00, 0x03, 0x06, 0x09, 0x0C,
+			0x0F, 0x12, 0x15, 0x00, 0x04, 0x08, 0x0C, 0x1E,
+			0x14, 0x3C, 0x1E, 0x00, 0x9B, 0x7F, 0x46, 0x20,
+			0x4E, 0x9B, 0x7F, 0x28, 0x80, 0xCC, 0xF4, 0x01,
+			0x00, 0xC0, 0x80, 0x00, 0x10, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x30, 0x30, 0x00, 0x1E, 0x19,
+			0x05, 0x00, 0x00, 0x3D, 0x08, 0x00, 0x00, 0x00,
+			0xBC, 0x02, 0x80},
+	},
+};
+
+
+struct i2c_board_info msm_i2c_gsbi3_info[] = {
+	{
+		I2C_BOARD_INFO(ATMEL_MXT224E_NAME, 0x94 >> 1),
+		.platform_data = &ts_atmel_data,
+		.irq = MSM_GPIO_TO_INT(FIGHTER_TP_ATTz)
+	},
+	{
+		I2C_BOARD_INFO(SYNAPTICS_3200_NAME, 0x40 >> 1),
+		.platform_data = &syn_ts_3k_data,
+		.irq = MSM_GPIO_TO_INT(FIGHTER_TP_ATTz)
+	},
+};
+
+static ssize_t virtual_atmel_keys_show(struct kobject *kobj,
+		struct kobj_attribute *attr, char *buf)
+{
+	return sprintf(buf,
+		__stringify(EV_KEY) ":" __stringify(KEY_HOME)   ":62:1015:110:100"
+			":" __stringify(EV_KEY) ":" __stringify(KEY_MENU)   ":200:1015:106:100"
+			":" __stringify(EV_KEY) ":" __stringify(KEY_BACK)   ":340:1015:120:100"
+			":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":482:1015:110:100"
+		"\n");
+}
+
+
+static ssize_t virtual_syn_keys_show(struct kobject *kobj,
+		struct kobj_attribute *attr, char *buf)
+{
+	return sprintf(buf,
+		__stringify(EV_KEY) ":" __stringify(KEY_BACK)   ":80:1040:110:110"
+			":" __stringify(EV_KEY) ":" __stringify(KEY_HOME)   ":270:1040:130:110"
+			":" __stringify(EV_KEY) ":" __stringify(KEY_APP_SWITCH)   ":460:1040:110:110"
+		"\n");
+}
+
+static struct kobj_attribute virtual_keys_atmel_attr = {
+	.attr = {
+		.name = "virtualkeys.atmel-touchscreen",
+		.mode = S_IRUGO,
+	},
+	.show = &virtual_atmel_keys_show,
+};
+
+static struct kobj_attribute virtual_keys_synaptics_attr = {
+	.attr = {
+		.name = "virtualkeys.synaptics-rmi-touchscreen",
+		.mode = S_IRUGO,
+	},
+	.show = &virtual_syn_keys_show,
+};
+
+static struct attribute *properties_attrs[] = {
+	&virtual_keys_atmel_attr.attr,
+	&virtual_keys_synaptics_attr.attr,
+	NULL
+};
+
+static struct attribute_group properties_attr_group = {
+	.attrs = properties_attrs,
+};
+
+static struct bma250_platform_data gsensor_bma250_platform_data = {
+	.intr = FIGHTER_GSENSOR_INT,
+	.chip_layout = 1,
+};
+
+static struct akm8975_platform_data compass_platform_data = {
+	.layouts = FIGHTER_LAYOUTS,
+};
+
+static struct pn544_i2c_platform_data nfc_platform_data = {
+	.irq_gpio = FIGHTER_NFC_IRQ,
+	.ven_gpio = FIGHTER_NFC_VEN,
+	.firm_gpio = FIGHTER_NFC_DL_MODE,
+	.ven_isinvert = 1,
+};
+
+static struct i2c_board_info pn544_i2c_boardinfo[] = {
+	{
+		I2C_BOARD_INFO(PN544_I2C_NAME, 0x50 >> 1),
+		.platform_data = &nfc_platform_data,
+		.irq = MSM_GPIO_TO_INT(FIGHTER_NFC_IRQ),
+	},
+};
+
+static struct i2c_board_info msm_i2c_gsbi12_info[] = {
+	{
+		I2C_BOARD_INFO(BMA250_I2C_NAME, 0x30 >> 1),
+		.platform_data = &gsensor_bma250_platform_data,
+		.irq = MSM_GPIO_TO_INT(FIGHTER_GSENSOR_INT),
+	},
+	{
+		I2C_BOARD_INFO(AKM8975_I2C_NAME, 0x1A >> 1),
+		.platform_data = &compass_platform_data,
+		.irq = MSM_GPIO_TO_INT(FIGHTER_COMPASS_INT),
+	},
+};
+
+
+static DEFINE_MUTEX(capella_cm36282_lock);
+static struct regulator *PL_sensor_pwr;
+static int capella_pl_sensor_lpm_power(uint8_t enable)
+{
+	int ret = 0;
+	int rc;
+
+	mutex_lock(&capella_cm36282_lock);
+	if (PL_sensor_pwr == NULL)
+	{
+		PL_sensor_pwr = regulator_get(NULL, "8921_l16");
+	}
+	if (IS_ERR(PL_sensor_pwr)) {
+		pr_err("[PS][cm3629] %s: Unable to get '8921_l16' \n", __func__);
+		mutex_unlock(&capella_cm36282_lock);
+		return -ENODEV;
+	}
+	if (enable == 1) {
+		rc = regulator_set_optimum_mode(PL_sensor_pwr, 100);
+		if (rc < 0)
+			pr_err("[PS][cm3629] %s: enter lmp,set_optimum_mode l16 failed, rc=%d\n", __func__, rc);
+		else
+			pr_info("[PS][cm3629] %s: enter lmp,OK\n", __func__);
+	} else {
+		rc = regulator_set_optimum_mode(PL_sensor_pwr, 100000);
+		if (rc < 0)
+			pr_err("[PS][cm3629] %s: leave lmp,set_optimum_mode l16 failed, rc=%d\n", __func__, rc);
+		else
+			pr_info("[PS][cm3629] %s: leave lmp,OK\n", __func__);
+		msleep(10);
+	}
+	mutex_unlock(&capella_cm36282_lock);
+	return ret;
+}
+
+static int capella_cm36282_power(int pwr_device, uint8_t enable)
+{
+	int ret = 0;
+	int rc;
+
+	mutex_lock(&capella_cm36282_lock);
+
+	if (PL_sensor_pwr == NULL)
+	{
+		PL_sensor_pwr = regulator_get(NULL, "8921_l16");
+	}
+	if (IS_ERR(PL_sensor_pwr)) {
+		pr_err("[PS][cm3629] %s: Unable to get '8921_l16' \n", __func__);
+		mutex_unlock(&capella_cm36282_lock);
+		return -ENODEV;
+	}
+	if (enable == 1) {
+		rc = regulator_set_voltage(PL_sensor_pwr, 2850000, 2850000);
+		if (rc)
+			pr_err("[PS][cm3629] %s: unable to regulator_set_voltage, rc:%d\n", __func__, rc);
+
+		rc = regulator_enable(PL_sensor_pwr);
+		if (rc)
+			pr_err("[PS][cm3629]'%s' regulator enable l16 failed, rc=%d\n", __func__,rc);
+		else
+			pr_info("[PS][cm3629]'%s' l16 power on\n", __func__);
+	}
+	mutex_unlock(&capella_cm36282_lock);
+	return ret;
+}
+
+static struct cm3629_platform_data cm36282_XD_pdata = {
+	.model = CAPELLA_CM36282,
+	.ps_select = CM3629_PS1_ONLY,
+	.intr = PM8921_GPIO_PM_TO_SYS(FIGHTER_PROXIMITY_INTz),
+	.levels = { 9, 19, 29, 399, 1000, 2575, 4200, 4428, 4655, 65535},
+	.golden_adc = 3295,
+	.power = capella_cm36282_power,
+	.lpm_power = capella_pl_sensor_lpm_power,
+	.cm3629_slave_address = 0xC0>>1,
+	.ps1_thd_set = 17,
+	.ps1_thd_no_cal = 0xF1,
+	.ps1_thd_with_cal = 17,
+	.ps_calibration_rule = 1,
+	.ps_conf1_val = CM3629_PS_DR_1_80 | CM3629_PS_IT_2T |
+			CM3629_PS1_PERS_3,
+	.ps_conf2_val = CM3629_PS_ITB_2 | CM3629_PS_ITR_1 |
+			CM3629_PS2_INT_DIS | CM3629_PS1_INT_DIS,
+	.ps_conf3_val = CM3629_PS2_PROL_32,
+};
+
+static struct i2c_board_info i2c_CM36282_XD_devices[] = {
+	{
+		I2C_BOARD_INFO(CM3629_I2C_NAME, 0xC0 >> 1),
+		.platform_data = &cm36282_XD_pdata,
+		.irq =  PM8921_GPIO_IRQ(PM8921_IRQ_BASE, FIGHTER_PROXIMITY_INTz),
+	},
+};
+
+static struct cm3629_platform_data cm36282_pdata = {
+	.model = CAPELLA_CM36282,
+	.ps_select = CM3629_PS1_ONLY,
+	.intr = PM8921_GPIO_PM_TO_SYS(FIGHTER_PROXIMITY_INTz),
+	.levels = { 9, 19, 29, 399, 1000, 2575, 4200, 4428, 4655, 65535},
+	.golden_adc = 3295,
+	.power = capella_cm36282_power,
+	.lpm_power = capella_pl_sensor_lpm_power,
+	.cm3629_slave_address = 0xC0>>1,
+	.ps1_thd_set = 17,
+	.ps1_thd_no_cal = 0xF1,
+	.ps1_thd_with_cal = 17,
+	.ps_calibration_rule = 1,
+	.ps_conf1_val = CM3629_PS_DR_1_80 | CM3629_PS_IT_1_6T |
+			CM3629_PS1_PERS_3,
+	.ps_conf2_val = CM3629_PS_ITB_1 | CM3629_PS_ITR_1 |
+			CM3629_PS2_INT_DIS | CM3629_PS1_INT_DIS,
+	.ps_conf3_val = CM3629_PS2_PROL_32,
+};
+
+static struct i2c_board_info i2c_CM36282_devices[] = {
+	{
+		I2C_BOARD_INFO(CM3629_I2C_NAME, 0xC0 >> 1),
+		.platform_data = &cm36282_pdata,
+		.irq =  PM8921_GPIO_IRQ(PM8921_IRQ_BASE, FIGHTER_PROXIMITY_INTz),
+	},
+};
+
+static uint32_t usb_ID_PIN_input_table[] = {
+	GPIO_CFG(FIGHTER_USB_ID1, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+
+static uint32_t usb_ID_PIN_ouput_table[] = {
+	GPIO_CFG(FIGHTER_USB_ID1, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+
+void config_fighter_usb_id_gpios(bool output)
+{
+	if (output) {
+		gpio_tlmm_config(usb_ID_PIN_ouput_table[0], GPIO_CFG_ENABLE);
+		gpio_set_value(FIGHTER_USB_ID1, 1);
+		pr_info("[CABLE] %s: %d output high\n",  __func__, FIGHTER_USB_ID1);
+	} else {
+		gpio_tlmm_config(usb_ID_PIN_input_table[0], GPIO_CFG_ENABLE);
+		pr_info("[CABLE] %s: %d input none pull\n",  __func__, FIGHTER_USB_ID1);
+	}
+}
+
+int64_t fighter_get_usbid_adc(void)
+{
+	struct pm8xxx_adc_chan_result result;
+	int err = 0, adc = 0;
+
+	err = pm8xxx_adc_mpp_config_read(PM8XXX_AMUX_MPP_7,
+					ADC_MPP_1_AMUX6, &result);
+	if (err) {
+		pr_info("[CABLE] %s: get adc fail, err %d\n", __func__, err);
+		return err;
+	}
+	pr_info("[CABLE] chan=%d, adc_code=%d, measurement=%lld, \
+			physical=%lld\n", result.chan, result.adc_code,
+			result.measurement, result.physical);
+	adc = result.physical;
+	return adc/1000;
+}
+
+static uint32_t usb_audio_switch_table[] = {
+	GPIO_CFG(FIGHTER_USBz_AUDIO_SW, 0, GPIO_CFG_OUTPUT,GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	GPIO_CFG(FIGHTER_USBz_AUDIO_SW, 0, GPIO_CFG_INPUT,GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+
+static uint32_t audio_uart_switch_table[] = {
+	GPIO_CFG(FIGHTER_AUDIOz_UART_SW, 0, GPIO_CFG_OUTPUT,
+		GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+
+static void fighter_usb_dpdn_switch(int path)
+{
+	if ((system_rev == 0x80 && engineerid == 1) || system_rev < 0x80) {
+		gpio_tlmm_config(audio_uart_switch_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(usb_audio_switch_table[1], GPIO_CFG_ENABLE);
+	} else {
+		gpio_tlmm_config(audio_uart_switch_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(usb_audio_switch_table[0], GPIO_CFG_ENABLE);
+	}
+
+	switch (path) {
+	case PATH_USB:
+		pr_info("[CABLE] %s: Set USB path\n", __func__);
+
+		if ((system_rev == 0x80 && engineerid == 1) || system_rev < 0x80) {
+			gpio_set_value(FIGHTER_AUDIOz_UART_SW, 1);
+		} else {
+			gpio_set_value(FIGHTER_AUDIOz_UART_SW, 1);
+			gpio_set_value(FIGHTER_USBz_AUDIO_SW, 0);
+		}
+		break;
+	case PATH_USB_AUD:
+		pr_info("[CABLE] %s: Set Audio path\n", __func__);
+
+		if ((system_rev == 0x80 && engineerid == 1) || system_rev < 0x80) {
+			gpio_set_value(FIGHTER_AUDIOz_UART_SW, 0);
+		} else {
+			gpio_set_value(FIGHTER_AUDIOz_UART_SW, 0);
+			gpio_set_value(FIGHTER_USBz_AUDIO_SW, 1);
+		}
+		break;
+	}
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+	sii9234_change_usb_owner((path == PATH_MHL) ? 1 : 0);
+#endif
+}
+
+static struct cable_detect_platform_data cable_detect_pdata = {
+	.detect_type		= CABLE_TYPE_PMIC_ADC,
+	.usb_id_pin_gpio	= FIGHTER_USB_ID1,
+	.get_adc_cb		= fighter_get_usbid_adc,
+	.config_usb_id_gpios	= config_fighter_usb_id_gpios,
+	.usb_dpdn_switch	= fighter_usb_dpdn_switch,
+	.ad_en_active_state = 1,
+	.ad_en_gpio = PM8921_GPIO_PM_TO_SYS(FIGHTER_AD_EN_MSM),
+	.ad_en_irq = PM8921_GPIO_PM_TO_SYS(FIGHTER_AD_EN_MSM),
+};
+
+static struct platform_device cable_detect_device = {
+	.name   = "cable_detect",
+	.id     = -1,
+	.dev    = {
+		.platform_data = &cable_detect_pdata,
+	},
+};
+
+static void fighter_cable_detect_register(void)
+{
+	pr_info("%s:\n", __func__);
+	platform_device_register(&cable_detect_device);
+}
+
+void fighter_pm8xxx_adc_device_register(void)
+{
+	pr_info("%s: Register PM8921 ADC device\n", __func__);
+	headset_device_register();
+}
+
+#define MSM_SHARED_RAM_PHYS 0x80000000
+
+static void __init fighter_map_io(void)
+{
+	msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
+	msm_map_msm8960_io();
+	if (socinfo_init() < 0)
+		pr_err("socinfo_init() failed!\n");
+}
+
+static void __init fighter_init_irq(void)
+{
+	struct msm_mpm_device_data *data = NULL;
+
+#ifdef CONFIG_MSM_MPM
+	data = &msm8960_mpm_dev_data;
+#endif
+
+	msm_mpm_irq_extn_init(data);
+	gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
+						(void *)MSM_QGIC_CPU_BASE);
+
+	/* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
+	writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
+
+	writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
+	mb();
+}
+
+static void __init msm8960_init_buses(void)
+{
+#ifdef CONFIG_MSM_BUS_SCALING
+	msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
+	msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
+	msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
+	msm_bus_apps_fabric.dev.platform_data =
+		&msm_bus_8960_apps_fabric_pdata;
+	msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
+	msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
+	msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
+	msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
+	msm_bus_rpm_set_mt_mask();
+#endif
+}
+
+static struct msm_spi_platform_data msm8960_qup_spi_gsbi10_pdata = {
+	.max_clock_speed = 27000000,
+};
+
+#ifdef CONFIG_USB_MSM_OTG_72K
+static struct msm_otg_platform_data msm_otg_pdata;
+#else
+#define USB_5V_EN		42
+static int msm_hsusb_vbus_power(bool on)
+{
+	int rc;
+	static bool vbus_is_on;
+	static struct regulator *mvs_otg_switch;
+	struct pm_gpio param = {
+		.direction	= PM_GPIO_DIR_OUT,
+		.output_buffer	= PM_GPIO_OUT_BUF_CMOS,
+		.output_value	= 1,
+		.pull		= PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength	= PM_GPIO_STRENGTH_MED,
+		.function	= PM_GPIO_FUNC_NORMAL,
+	};
+
+	printk(KERN_ERR "%s: vbus_is_on=%d\n", __func__, on);
+	if (vbus_is_on == on)
+		return 0;
+
+	printk(KERN_INFO "%s: %d\n", __func__, on);
+
+	if (on) {
+		mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
+					       "vbus_otg");
+		if (IS_ERR(mvs_otg_switch)) {
+			pr_err("Unable to get mvs_otg_switch\n");
+			return -1;
+		}
+
+		rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
+						"usb_5v_en");
+		if (rc < 0) {
+			pr_err("failed to request usb_5v_en gpio\n");
+			goto put_mvs_otg;
+		}
+
+		if (regulator_enable(mvs_otg_switch)) {
+			pr_err("unable to enable mvs_otg_switch\n");
+			goto free_usb_5v_en;
+		}
+
+		rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
+				&param);
+		if (rc < 0) {
+			pr_err("failed to configure usb_5v_en gpio\n");
+			goto disable_mvs_otg;
+		}
+		vbus_is_on = true;
+		return 0;
+	}
+disable_mvs_otg:
+		regulator_disable(mvs_otg_switch);
+free_usb_5v_en:
+		gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
+put_mvs_otg:
+		regulator_put(mvs_otg_switch);
+		vbus_is_on = false;
+		return -1;
+}
+
+static int phy_init_seq_v3[] = { 0x7f, 0x81, 0x3c, 0x82, -1};
+static int phy_init_seq_v3_2_1[] = { 0x5f, 0x81, 0x3c, 0x82, -1};
+
+static struct msm_otg_platform_data msm_otg_pdata = {
+	.phy_init_seq		= phy_init_seq_v3,
+	.mode			= USB_OTG,
+	.otg_control		= OTG_PMIC_CONTROL,
+	.phy_type		= SNPS_28NM_INTEGRATED_PHY,
+//	.pmic_id_irq		= PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
+	.vbus_power		= msm_hsusb_vbus_power,
+	.power_budget		= 750,
+//	.ldo_power_collapse	= true,
+};
+#endif
+
+#define PID_MAGIC_ID		0x71432909
+#define SERIAL_NUM_MAGIC_ID	0x61945374
+#define SERIAL_NUMBER_LENGTH	127
+#define DLOAD_USB_BASE_ADD	0x2A03F0C8
+
+struct magic_num_struct {
+	uint32_t pid;
+	uint32_t serial_num;
+};
+
+struct dload_struct {
+	uint32_t	reserved1;
+	uint32_t	reserved2;
+	uint32_t	reserved3;
+	uint16_t	reserved4;
+	uint16_t	pid;
+	char		serial_number[SERIAL_NUMBER_LENGTH];
+	uint16_t	reserved5;
+	struct magic_num_struct magic_struct;
+};
+
+static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
+{
+	struct dload_struct __iomem *dload = 0;
+
+	dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
+	if (!dload) {
+		pr_err("%s: cannot remap I/O memory region: %08x\n",
+					__func__, DLOAD_USB_BASE_ADD);
+		return -ENXIO;
+	}
+
+	pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
+				__func__, dload, pid, snum);
+	/* update pid */
+	dload->magic_struct.pid = PID_MAGIC_ID;
+	dload->pid = pid;
+
+	/* update serial number */
+	dload->magic_struct.serial_num = 0;
+	if (!snum) {
+		memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
+		goto out;
+	}
+
+	dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
+	strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
+out:
+	iounmap(dload);
+	return 0;
+}
+
+static struct android_usb_platform_data android_usb_pdata = {
+	.update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
+};
+
+static struct platform_device android_usb_device = {
+	.name	= "android_usb",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &android_usb_pdata,
+	},
+};
+
+#define VERSION_ID (readl(HW_VER_ID_VIRT) & 0xf0000000) >> 28
+#define HW_8960_V3_2_1   0x07
+void fighter_add_usb_devices(void)
+{
+	if (VERSION_ID == HW_8960_V3_2_1) {
+		printk(KERN_INFO "%s rev: %d v3.2.1\n", __func__, system_rev);
+		msm_otg_pdata.phy_init_seq = phy_init_seq_v3_2_1;
+	} else {
+		printk(KERN_INFO "%s rev: %d\n", __func__, system_rev);
+		msm_otg_pdata.phy_init_seq = phy_init_seq_v3;
+	}
+	printk(KERN_INFO "%s: OTG_PMIC_CONTROL in rev: %d\n",
+			__func__, system_rev);
+}
+
+static uint8_t spm_wfi_cmd_sequence[] __initdata = {
+			0x03, 0x0f,
+};
+
+static uint8_t spm_retention_cmd_sequence[] __initdata = {
+			0x00, 0x05, 0x03, 0x0D,
+			0x0B, 0x00, 0x0f,
+};
+
+static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
+	0x42, 0x1B, 0x00,
+	0x05, 0x03, 0x0D, 0x0B,
+	0x00, 0x42, 0x1B,
+	0x0f,
+};
+
+static uint8_t spm_power_collapse_without_rpm[] __initdata = {
+			0x00, 0x24, 0x54, 0x10,
+			0x09, 0x03, 0x01,
+			0x10, 0x54, 0x30, 0x0C,
+			0x24, 0x30, 0x0f,
+};
+
+static uint8_t spm_power_collapse_with_rpm[] __initdata = {
+			0x00, 0x24, 0x54, 0x10,
+			0x09, 0x07, 0x01, 0x0B,
+			0x10, 0x54, 0x30, 0x0C,
+			0x24, 0x30, 0x0f,
+};
+
+/* 8960AB has a different command to assert apc_pdn */
+static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
+	0x00, 0x24, 0x84, 0x10,
+	0x09, 0x03, 0x01,
+	0x10, 0x84, 0x30, 0x0C,
+	0x24, 0x30, 0x0f,
+};
+
+static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
+	0x00, 0x24, 0x84, 0x10,
+	0x09, 0x07, 0x01, 0x0B,
+	0x10, 0x84, 0x30, 0x0C,
+	0x24, 0x30, 0x0f,
+};
+
+static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_MODE_CLOCK_GATING,
+		.notify_rpm = false,
+		.cmd = spm_wfi_cmd_sequence,
+	},
+
+	[1] = {
+		.mode = MSM_SPM_MODE_POWER_RETENTION,
+		.notify_rpm = false,
+		.cmd = spm_retention_cmd_sequence,
+	},
+
+	[2] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = false,
+		.cmd = spm_power_collapse_without_rpm,
+	},
+	[3] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = spm_power_collapse_with_rpm,
+	},
+};
+
+static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_MODE_CLOCK_GATING,
+		.notify_rpm = false,
+		.cmd = spm_wfi_cmd_sequence,
+	},
+
+	[1] = {
+		.mode = MSM_SPM_MODE_POWER_RETENTION,
+		.notify_rpm = false,
+		.cmd = spm_retention_cmd_sequence,
+	},
+
+	[2] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = false,
+		.cmd = spm_power_collapse_without_rpm,
+	},
+
+	[3] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = spm_power_collapse_with_rpm,
+	},
+};
+
+static struct msm_spm_platform_data msm_spm_data[] __initdata = {
+	[0] = {
+		.reg_base_addr = MSM_SAW0_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
+#if defined(CONFIG_MSM_AVS_HW)
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
+#endif
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
+		.vctl_timeout_us = 50,
+		.num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
+		.modes = msm_spm_boot_cpu_seq_list,
+	},
+	[1] = {
+		.reg_base_addr = MSM_SAW1_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
+#if defined(CONFIG_MSM_AVS_HW)
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
+#endif
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
+		.vctl_timeout_us = 50,
+		.num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
+		.modes = msm_spm_nonboot_cpu_seq_list,
+	},
+};
+
+static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
+			0x00, 0x20, 0x03, 0x20,
+			0x00, 0x0f,
+};
+
+static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
+			0x00, 0x20, 0x34, 0x64,
+			0x48, 0x07, 0x48, 0x20,
+			0x50, 0x64, 0x04, 0x34,
+			0x50, 0x0f,
+};
+static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
+			0x00, 0x10, 0x34, 0x64,
+			0x48, 0x07, 0x48, 0x10,
+			0x50, 0x64, 0x04, 0x34,
+			0x50, 0x0F,
+};
+
+static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_L2_MODE_RETENTION,
+		.notify_rpm = false,
+		.cmd = l2_spm_wfi_cmd_sequence,
+	},
+	[1] = {
+		.mode = MSM_SPM_L2_MODE_GDHS,
+		.notify_rpm = true,
+		.cmd = l2_spm_gdhs_cmd_sequence,
+	},
+	[2] = {
+		.mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = l2_spm_power_off_cmd_sequence,
+	},
+};
+
+static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
+	[0] = {
+		.reg_base_addr = MSM_SAW_L2_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
+		.modes = msm_spm_l2_seq_list,
+		.num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
+	},
+};
+
+#ifdef CONFIG_PERFLOCK
+static unsigned fighter_perf_acpu_table[] = {
+	810000000, /* LOWEST */
+	918000000, /* LOW */
+	1026000000, /* MEDIUM */
+	1242000000,/* HIGH */
+	1512000000, /* HIGHEST */
+};
+
+static unsigned fighter_cpufreq_ceiling_acpu_table[] = {
+	702000000,
+	918000000,
+	1026000000,
+};
+
+static struct perflock_data fighter_perflock_data = {
+	.perf_acpu_table = fighter_perf_acpu_table,
+	.table_size = ARRAY_SIZE(fighter_perf_acpu_table),
+};
+
+static struct perflock_data fighter_cpufreq_ceiling_data = {
+	.perf_acpu_table = fighter_cpufreq_ceiling_acpu_table,
+	.table_size = ARRAY_SIZE(fighter_cpufreq_ceiling_acpu_table),
+};
+
+static struct perflock_pdata perflock_pdata = {
+	.perf_floor = &fighter_perflock_data,
+	.perf_ceiling = &fighter_cpufreq_ceiling_data,
+};
+
+struct platform_device msm8960_device_perf_lock = {
+	.name = "perf_lock",
+	.id = -1,
+	.dev = {
+		.platform_data = &perflock_pdata,
+	},
+};
+#endif
+
+static uint32_t gsbi2_gpio_table[] = {
+	GPIO_CFG(FIGHTER_NFC_I2C_SDA, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(FIGHTER_NFC_I2C_SCL, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi3_gpio_table[] = {
+	GPIO_CFG(FIGHTER_TP_I2C_SDA, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(FIGHTER_TP_I2C_SCL, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+/* CAMERA setting */
+static uint32_t gsbi4_gpio_table[] = {
+	GPIO_CFG(FIGHTER_CAM_I2C_SDA, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(FIGHTER_CAM_I2C_SCL, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi8_gpio_table[] = {
+	GPIO_CFG(FIGHTER_AC_I2C_SDA, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(FIGHTER_AC_I2C_SCL, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi12_gpio_table[] = {
+	GPIO_CFG(FIGHTER_SENSOR_I2C_SDA, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(FIGHTER_SENSOR_I2C_SCL, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
+{
+	printk(KERN_INFO "%s(): adap_id = %d, config_type = %d \n", __func__, adap_id, config_type);
+
+	if ((adap_id == MSM_8960_GSBI2_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi2_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi2_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI2_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi2_gpio_table[0], GPIO_CFG_DISABLE);
+		gpio_tlmm_config(gsbi2_gpio_table[1], GPIO_CFG_DISABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI3_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi3_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi3_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI3_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi3_gpio_table[0], GPIO_CFG_DISABLE);
+		gpio_tlmm_config(gsbi3_gpio_table[1], GPIO_CFG_DISABLE);
+	}
+
+	/* CAMERA setting */
+	if ((adap_id == MSM_8960_GSBI4_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi4_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi4_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI4_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi4_gpio_table[0], GPIO_CFG_DISABLE);
+		gpio_tlmm_config(gsbi4_gpio_table[1], GPIO_CFG_DISABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI8_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi8_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi8_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI8_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi8_gpio_table[0], GPIO_CFG_DISABLE);
+		gpio_tlmm_config(gsbi8_gpio_table[1], GPIO_CFG_DISABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI12_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi12_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi12_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI12_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi12_gpio_table[0], GPIO_CFG_DISABLE);
+		gpio_tlmm_config(gsbi12_gpio_table[1], GPIO_CFG_DISABLE);
+	}
+}
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi2_pdata = {
+	.clk_freq = 100000,	/* use 100Mhz first, then 400Mhz */
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi8_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+//	.share_uart_flag = 1,	/* check if QUP-I2C and Uart share the gisb */
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct platform_device msm_device_saw_core0 = {
+	.name          = "saw-regulator",
+	.id            = 0,
+	.dev	= {
+		.platform_data = &msm_saw_regulator_pdata_s5,
+	},
+};
+
+static struct platform_device msm_device_saw_core1 = {
+	.name          = "saw-regulator",
+	.id            = 1,
+	.dev	= {
+		.platform_data = &msm_saw_regulator_pdata_s6,
+	},
+};
+
+static struct tsens_platform_data msm_tsens_pdata  = {
+		.slope			= {910, 910, 910, 910, 910},
+		.tsens_factor		= 1000,
+		.hw_type		= MSM_8960,
+		.tsens_num_sensor	= 5,
+};
+
+static struct platform_device msm_tsens_device = {
+	.name   = "tsens8960-tm",
+	.id = -1,
+};
+
+static struct msm_thermal_data msm_thermal_pdata = {
+	.sensor_id = 0,
+	.poll_ms = 1000,
+	.limit_temp_degC = 60,
+	.temp_hysteresis_degC = 10,
+//	.limit_freq = 918000,
+	.freq_step = 2,
+};
+
+#ifdef CONFIG_MSM_FAKE_BATTERY
+static struct platform_device fish_battery_device = {
+	.name = "fish_battery",
+};
+#endif
+
+static struct platform_device scm_memchk_device = {
+	.name		= "scm-memchk",
+	.id		= -1,
+};
+
+static struct platform_device fighter_device_rpm_regulator __devinitdata = {
+	.name	= "rpm-regulator",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &fighter_rpm_regulator_pdata,
+	},
+};
+
+static struct platform_device *common_devices[] __initdata = {
+	&msm8960_device_acpuclk,
+	&msm8960_device_dmov,
+	&msm_device_smd,
+	&msm8960_device_uart_gsbi8,
+	&msm_device_uart_dm6,
+	&msm_device_saw_core0,
+	&msm_device_saw_core1,
+	&msm8960_device_ext_5v_vreg,
+	&msm8960_device_qup_i2c_gsbi2,
+	&msm8960_device_qup_i2c_gsbi3,
+	&msm8960_device_qup_i2c_gsbi4,
+	&msm8960_device_qup_i2c_gsbi8,
+	&msm8960_device_qup_spi_gsbi10,
+#ifndef CONFIG_MSM_DSPS
+	&msm8960_device_qup_i2c_gsbi12,
+#endif
+	&msm8960_device_ssbi_pmic,
+	&msm_slim_ctrl,
+	&msm_device_wcnss_wlan,
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
+	&qcrypto_device,
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+	&qcedev_device,
+#endif
+#ifdef CONFIG_MSM_ROTATOR
+	&msm_rotator_device,
+#endif
+	&msm8960_cpu_slp_status,
+	&msm_device_sps,
+#ifdef CONFIG_MSM_FAKE_BATTERY
+	&fish_battery_device,
+#endif
+	&fmem_device,
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	&android_pmem_device,
+	&android_pmem_adsp_device,
+	&android_pmem_audio_device,
+#endif
+#endif
+	&msm_device_vidc,
+	&msm_device_bam_dmux,
+	&msm_fm_platform_init,
+
+#ifdef CONFIG_HW_RANDOM_MSM
+	&msm_device_rng,
+#endif
+#ifdef CONFIG_ION_MSM
+	&ion_dev,
+#endif
+	&msm8960_rpm_device,
+	&msm8960_rpm_log_device,
+	&msm8960_rpm_stat_device,
+#ifdef CONFIG_MSM_QDSS
+	&msm_etb_device,
+	&msm_tpiu_device,
+	&msm_funnel_device,
+	&msm_etm_device,
+#endif
+	&msm8960_device_watchdog,
+#ifdef CONFIG_MSM_RTB
+	&msm_rtb_device,
+#endif
+	&msm8960_device_cache_erp,
+	&msm8960_iommu_domain_device,
+#ifdef CONFIG_MSM_CACHE_DUMP
+	&msm_cache_dump_device,
+#endif
+#ifdef CONFIG_HTC_BATT_8960
+	&htc_battery_pdev,
+#endif
+	&msm_tsens_device,
+};
+
+static struct platform_device *fighter_devices[] __initdata = {
+	&msm_8960_q6_lpass,
+	&msm_8960_q6_mss_fw,
+	&msm_8960_q6_mss_sw,
+	&msm_8960_riva,
+	&msm_pil_tzapps,
+	&msm8960_device_otg,
+	&msm8960_device_gadget_peripheral,
+	&msm_device_hsusb_host,
+	&android_usb_device,
+	&msm_pcm,
+	&msm_pcm_routing,
+	&msm_multi_ch_pcm,
+	&msm_cpudai0,
+	&msm_cpudai1,
+	&msm8960_cpudai_slimbus_2_tx,
+	&msm8960_cpudai_slimbus_2_rx,
+	&msm_cpudai_hdmi_rx,
+	&msm_cpudai_bt_rx,
+	&msm_cpudai_bt_tx,
+	&msm_cpudai_fm_rx,
+	&msm_cpudai_fm_tx,
+	&msm_cpudai_auxpcm_rx,
+	&msm_cpudai_auxpcm_tx,
+	&msm_cpu_fe,
+	&msm_stub_codec,
+#ifdef CONFIG_MSM_GEMINI
+	&msm8960_gemini_device,
+#endif
+	&msm_voice,
+	&msm_voip,
+	&msm_lpa_pcm,
+	&msm_cpudai_afe_01_rx,
+	&msm_cpudai_afe_01_tx,
+	&msm_cpudai_afe_02_rx,
+	&msm_cpudai_afe_02_tx,
+	&msm_pcm_afe,
+	&msm_compr_dsp,
+	&msm_cpudai_incall_music_rx,
+	&msm_cpudai_incall_record_rx,
+	&msm_cpudai_incall_record_tx,
+	&msm_pcm_hostless,
+	&msm_lowlatency_pcm,
+	&msm_bus_apps_fabric,
+	&msm_bus_sys_fabric,
+	&msm_bus_mm_fabric,
+	&msm_bus_sys_fpb,
+	&msm_bus_cpss_fpb,
+	&msm_device_tz_log,
+#ifdef CONFIG_PERFLOCK
+	&msm8960_device_perf_lock,
+#endif
+	&scm_memchk_device,
+};
+
+static void __init msm8960_i2c_init(void)
+{
+	msm8960_device_qup_i2c_gsbi4.dev.platform_data =
+					&msm8960_i2c_qup_gsbi4_pdata;
+
+	msm8960_device_qup_i2c_gsbi2.dev.platform_data =
+					&msm8960_i2c_qup_gsbi2_pdata;
+
+	msm8960_device_qup_i2c_gsbi3.dev.platform_data =
+					&msm8960_i2c_qup_gsbi3_pdata;
+
+	msm8960_device_qup_i2c_gsbi8.dev.platform_data =
+					&msm8960_i2c_qup_gsbi8_pdata;
+
+	msm8960_device_qup_i2c_gsbi12.dev.platform_data =
+					&msm8960_i2c_qup_gsbi12_pdata;
+}
+
+static void __init msm8960_gfx_init(void)
+{
+	struct kgsl_device_platform_data *kgsl_3d0_pdata =
+		msm_kgsl_3d0.dev.platform_data;
+	uint32_t soc_platform_version = socinfo_get_version();
+
+	/* Fixup data that needs to change based on GPU ID */
+	if (cpu_is_msm8960ab()) {
+		kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
+		/* 8960PRO nominal clock rate is 320Mhz */
+		kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 320000000;
+	} else {
+		kgsl_3d0_pdata->iommu_count = 1;
+		if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
+			kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
+			kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
+		}
+		if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
+			/* 8960v3 GPU registers returns 5 for patch release
+			 * but it should be 6, so dummy up the chipid here
+			 * based the platform type
+			 */
+			kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
+		}
+	}
+
+	/* Register the 3D core */
+	platform_device_register(&msm_kgsl_3d0);
+
+	/* Register the 2D cores if we are not 8960PRO */
+	if (!cpu_is_msm8960ab()) {
+		platform_device_register(&msm_kgsl_2d0);
+		platform_device_register(&msm_kgsl_2d1);
+	}
+}
+
+#ifdef CONFIG_HTC_BATT_8960
+static struct pm8921_charger_batt_param chg_batt_params[] = {
+	[0] = {
+		.max_voltage = 4200,
+		.cool_bat_voltage = 4200,
+		.warm_bat_voltage = 4000,
+	},
+	[1] = {
+		.max_voltage = 4340,
+		.cool_bat_voltage = 4340,
+		.warm_bat_voltage = 4000,
+	},
+	[2] = {
+		.max_voltage = 4300,
+		.cool_bat_voltage = 4300,
+		.warm_bat_voltage = 4000,
+	},
+	[3] = {
+		.max_voltage = 4350,
+		.cool_bat_voltage = 4350,
+		.warm_bat_voltage = 4000,
+	},
+};
+
+static struct single_row_lut fcc_temp_id_1 = {
+	.x		= {-20, -10, 0, 5, 10, 20, 30, 40},
+	.y		= {900, 1050, 1350, 1450, 1520, 1600, 1620, 1630},
+	.cols	= 8
+};
+
+static struct single_row_lut fcc_sf_id_1 = {
+	.x		= {100, 200, 300, 400, 500},
+	.y		= {100, 100, 100, 100, 100},
+	.cols	= 5
+};
+
+static struct sf_lut pc_sf_id_1 = {
+	.rows		= 10,
+	.cols		= 5,
+	.row_entries	= {100, 200, 300, 400, 500},
+	.percent	= {100, 90, 80, 70, 60, 50, 40, 30, 20, 10},
+	.sf		= {
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100}
+	},
+};
+
+static struct pc_temp_ocv_lut pc_temp_ocv_id_1 = {
+	.rows		= 29,
+	.cols		= 8,
+	.temp		= {-20, -10, 0, 5, 10, 20, 30, 40},
+	.percent	= {100, 95, 90, 85, 80, 75, 70, 65, 60, 55,
+				50, 45, 40, 35, 30, 25, 20, 15, 10, 9,
+				8, 7, 6, 5, 4, 3, 2, 1, 0
+	},
+	.ocv		= {
+			{4290, 4290, 4290, 4290, 4290, 4290, 4290, 4290},
+			{4268, 4268, 4268, 4268, 4266, 4263, 4263, 4259},
+			{4215, 4215, 4215, 4215, 4212, 4207, 4206, 4203},
+			{4166, 4166, 4166, 4166, 4161, 4153, 4152, 4148},
+			{4118, 4118, 4118, 4118, 4111, 4101, 4100, 4097},
+			{4073, 4073, 4073, 4073, 4065, 4053, 4051, 4048},
+			{4029, 4029, 4029, 4029, 4021, 4008, 4006, 4004},
+			{3989, 3989, 3989, 3989, 3981, 3969, 3966, 3964},
+			{3950, 3950, 3950, 3950, 3942, 3930, 3928, 3926},
+			{3903, 3903, 3903, 3903, 3892, 3875, 3872, 3872},
+			{3863, 3863, 3863, 3863, 3852, 3840, 3839, 3839},
+			{3836, 3836, 3836, 3836, 3827, 3818, 3817, 3816},
+			{3816, 3816, 3816, 3816, 3808, 3800, 3800, 3799},
+			{3799, 3799, 3799, 3799, 3793, 3787, 3785, 3785},
+			{3787, 3787, 3787, 3787, 3782, 3778, 3775, 3773},
+			{3779, 3779, 3779, 3779, 3776, 3770, 3760, 3754},
+			{3772, 3772, 3772, 3772, 3767, 3751, 3738, 3733},
+			{3759, 3759, 3759, 3759, 3746, 3716, 3699, 3698},
+			{3732, 3732, 3732, 3732, 3708, 3683, 3681, 3677},
+			{3725, 3725, 3725, 3725, 3702, 3676, 3671, 3665},
+			{3717, 3717, 3717, 3717, 3695, 3668, 3661, 3653},
+			{3710, 3710, 3710, 3710, 3689, 3660, 3651, 3641},
+			{3702, 3702, 3702, 3702, 3682, 3652, 3641, 3629},
+			{3694, 3694, 3694, 3694, 3675, 3644, 3630, 3616},
+			{3688, 3688, 3688, 3688, 3665, 3608, 3592, 3579},
+			{3682, 3682, 3682, 3682, 3654, 3571, 3554, 3542},
+			{3676, 3676, 3676, 3676, 3644, 3534, 3516, 3505},
+			{3670, 3670, 3670, 3670, 3633, 3497, 3478, 3468},
+			{3663, 3663, 3663, 3663, 3622, 3460, 3440, 3430}
+	}
+};
+
+struct pm8921_bms_battery_data bms_battery_data_id_1 = {
+	.fcc			= 1700,
+	.fcc_temp_lut		= &fcc_temp_id_1,
+	.fcc_sf_lut		= &fcc_sf_id_1,
+	.pc_temp_ocv_lut	= &pc_temp_ocv_id_1,
+	.pc_sf_lut		= &pc_sf_id_1
+};
+
+static struct single_row_lut fcc_temp_id_2 = {
+	.x		= {-20, -10, 0, 5, 10, 20, 30, 40},
+	.y		= {900, 1050, 1360, 1540, 1500, 1600, 1620, 1630},
+	.cols	= 8
+};
+
+static struct single_row_lut fcc_sf_id_2 = {
+	.x		= {100, 200, 300, 400, 500},
+	.y		= {100, 100, 100, 100, 100},
+	.cols	= 5
+};
+
+static struct sf_lut pc_sf_id_2 = {
+	.rows		= 10,
+	.cols		= 5,
+	.row_entries	= {100, 200, 300, 400, 500},
+	.percent	= {100, 90, 80, 70, 60, 50, 40, 30, 20, 10},
+	.sf		= {
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100}
+	},
+};
+
+static struct pc_temp_ocv_lut pc_temp_ocv_id_2 = {
+	.rows		= 29,
+	.cols		= 8,
+	.temp		= {-20, -10,  0, 5, 10, 20, 30, 40},
+	.percent	= {100, 95, 90, 85, 80, 75, 70, 65, 60, 55,
+				50, 45, 40, 35, 30, 25, 20, 15, 10, 9,
+				8, 7, 6, 5, 4, 3, 2, 1, 0
+	},
+	.ocv		= {
+			{4290, 4290, 4290, 4290, 4290, 4290, 4290, 4290},
+			{4264, 4264, 4264, 4264, 4263, 4260, 4259, 4257},
+			{4212, 4212, 4212, 4212, 4210, 4206, 4204, 4202},
+			{4163, 4163, 4163, 4163, 4160, 4154, 4151, 4150},
+			{4116, 4116, 4116, 4116, 4111, 4105, 4101, 4100},
+			{4072, 4072, 4072, 4072, 4066, 4057, 4054, 4053},
+			{4026, 4026, 4026, 4026, 4021, 4014, 4008, 4008},
+			{3979, 3979, 3979, 3979, 3977, 3972, 3967, 3967},
+			{3933, 3933, 3933, 3933, 3926, 3918, 3910, 3912},
+			{3893, 3893, 3893, 3893, 3884, 3876, 3871, 3873},
+			{3862, 3862, 3862, 3862, 3855, 3848, 3844, 3845},
+			{3838, 3838, 3838, 3838, 3831, 3825, 3821, 3822},
+			{3817, 3817, 3817, 3817, 3812, 3806, 3802, 3803},
+			{3800, 3800, 3800, 3800, 3795, 3790, 3786, 3789},
+			{3785, 3785, 3785, 3785, 3781, 3775, 3763, 3765},
+			{3773, 3773, 3773, 3773, 3767, 3754, 3734, 3740},
+			{3754, 3754, 3754, 3754, 3741, 3717, 3697, 3704},
+			{3724, 3724, 3724, 3724, 3708, 3696, 3690, 3688},
+			{3704, 3704, 3704, 3704, 3696, 3687, 3668, 3668},
+			{3702, 3702, 3702, 3702, 3691, 3666, 3646, 3646},
+			{3699, 3699, 3699, 3699, 3685, 3645, 3624, 3624},
+			{3697, 3697, 3697, 3697, 3680, 3624, 3601, 3601},
+			{3694, 3694, 3694, 3694, 3674, 3603, 3579, 3579},
+			{3691, 3691, 3691, 3691, 3668, 3582, 3556, 3556},
+			{3677, 3677, 3677, 3677, 3639, 3542, 3517, 3517},
+			{3663, 3663, 3663, 3663, 3609, 3501, 3477, 3478},
+			{3649, 3649, 3649, 3649, 3579, 3460, 3438, 3439},
+			{3635, 3635, 3635, 3635, 3549, 3419, 3398, 3400},
+			{3621, 3621, 3621, 3621, 3519, 3378, 3358, 3360}
+	}
+};
+
+struct pm8921_bms_battery_data bms_battery_data_id_2 = {
+	.fcc			= 1700,
+	.fcc_temp_lut		= &fcc_temp_id_2,
+	.fcc_sf_lut		= &fcc_sf_id_2,
+	.pc_temp_ocv_lut	= &pc_temp_ocv_id_2,
+	.pc_sf_lut		= &pc_sf_id_2
+};
+
+static struct single_row_lut fcc_temp_id_3 = {
+	.x		= {-20, -10, 0, 5, 10, 20, 30, 40},
+	.y		= {1450, 1750, 1890, 2000, 2080, 2150, 2150, 2150},
+	.cols	= 8
+};
+
+static struct single_row_lut fcc_sf_id_3 = {
+	.x		= {100, 200, 300, 400, 500},
+	.y		= {100, 97, 93, 92, 90},
+	.cols	= 5
+};
+
+static struct sf_lut pc_sf_id_3 = {
+	.rows		= 10,
+	.cols		= 5,
+	.row_entries	= {100, 200, 300, 400, 500},
+	.percent	= {100, 90, 80, 70, 60, 50, 40, 30, 20, 10},
+	.sf		= {
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100}
+	},
+};
+
+static struct pc_temp_ocv_lut pc_temp_ocv_id_3 = {
+	.rows		= 29,
+	.cols		= 8,
+	.temp		= {-20, -10, 0, 5, 10, 20, 30, 40},
+	.percent	= {100, 95, 90, 85, 80, 75, 70, 65, 60, 55,
+				50, 45, 40, 35, 30, 25, 20, 15, 10, 9,
+				8, 7, 6, 5, 4, 3, 2, 1, 0
+	},
+	.ocv		= {
+			{4150, 4150, 4150, 4150, 4150, 4150, 4150, 4150},
+			{4144, 4144, 4144, 4144, 4142, 4138, 4137, 4135},
+			{4103, 4103, 4103, 4103, 4100, 4094, 4093, 4090},
+			{4073, 4073, 4073, 4073, 4068, 4059, 4055, 4051},
+			{4023, 4023, 4023, 4023, 4015, 4007, 4007, 4007},
+			{3983, 3983, 3983, 3983, 3979, 3975, 3975, 3975},
+			{3959, 3959, 3959, 3959, 3956, 3949, 3946, 3944},
+			{3935, 3935, 3935, 3935, 3931, 3921, 3918, 3916},
+			{3905, 3905, 3905, 3905, 3900, 3890, 3887, 3888},
+			{3868, 3868, 3868, 3868, 3860, 3844, 3841, 3841},
+			{3840, 3840, 3840, 3840, 3832, 3821, 3820, 3819},
+			{3820, 3820, 3820, 3820, 3814, 3806, 3804, 3803},
+			{3806, 3806, 3806, 3806, 3801, 3793, 3791, 3790},
+			{3795, 3795, 3795, 3795, 3790, 3783, 3781, 3779},
+			{3786, 3786, 3786, 3786, 3782, 3777, 3773, 3770},
+			{3780, 3780, 3780, 3780, 3777, 3771, 3763, 3756},
+			{3774, 3774, 3774, 3774, 3770, 3756, 3743, 3737},
+			{3765, 3765, 3765, 3765, 3756, 3724, 3709, 3706},
+			{3745, 3745, 3745, 3745, 3726, 3694, 3687, 3681},
+			{3739, 3739, 3739, 3739, 3721, 3693, 3686, 3680},
+			{3733, 3733, 3733, 3733, 3716, 3692, 3684, 3679},
+			{3727, 3727, 3727, 3727, 3710, 3690, 3682, 3677},
+			{3721, 3721, 3721, 3721, 3705, 3689, 3680, 3676},
+			{3715, 3715, 3715, 3715, 3699, 3687, 3678, 3674},
+			{3712, 3712, 3712, 3712, 3698, 3654, 3634, 3624},
+			{3709, 3709, 3709, 3709, 3696, 3621, 3590, 3574},
+			{3706, 3706, 3706, 3706, 3694, 3588, 3546, 3524},
+			{3703, 3703, 3703, 3703, 3692, 3555, 3502, 3474},
+			{3699, 3699, 3699, 3699, 3690, 3521, 3457, 3423}
+	}
+};
+
+struct pm8921_bms_battery_data bms_battery_data_id_3 = {
+	.fcc			= 2150,
+	.fcc_temp_lut		= &fcc_temp_id_3,
+	.fcc_sf_lut		= &fcc_sf_id_3,
+	.pc_temp_ocv_lut	= &pc_temp_ocv_id_3,
+	.pc_sf_lut		= &pc_sf_id_3
+};
+
+static struct htc_battery_cell htc_battery_cells[] = {
+	[0] = { /* WTE/Sanyo R=10k */
+		.model_name = "BJ53100",
+		.capacity = 1700,
+		.id = 1,
+		.id_raw_min = 70, /* unit:mV (10kohm) */
+		.id_raw_max = 204,
+		.type = HTC_BATTERY_CELL_TYPE_HV,
+		.voltage_max = 4340,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[1],
+		.gauge_param = &bms_battery_data_id_1,
+	},
+	[1] = { /* TWS/Maxell R=22k */
+		.model_name = "BJ53100",
+		.capacity = 1700,
+		.id = 2,
+		.id_raw_min = 205, /* unit:mV (22kohm) */
+		.id_raw_max = 386,
+		.type = HTC_BATTERY_CELL_TYPE_HV,
+		.voltage_max = 4340,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[1],
+		.gauge_param = &bms_battery_data_id_2,
+	},
+	[2] = { /* WTC/Maxell R=47k */
+		.model_name = "BJ53200",
+		.capacity = 2150,
+		.id = 3,
+		.id_raw_min = 387, /* unit:mV (47kohm) */
+		.id_raw_max = 595,
+		.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+		.voltage_max = 4200,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[0],
+		.gauge_param = &bms_battery_data_id_3,
+	},
+	[3] = {
+		.model_name = "UNKNOWN",
+		.capacity = 1700,
+		.id = 255,
+		.id_raw_min = INT_MIN,
+		.id_raw_max = INT_MAX,
+		.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+		.voltage_max = 4200,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[0],
+		.gauge_param = NULL,
+	},
+};
+#endif /* CONFIG_HTC_BATT_8960 */
+
+static struct msm_rpmrs_level msm_rpmrs_levels[] = {
+	{
+		MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		1, 784, 180000, 100,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_RETENTION,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		415, 715, 340827, 475,
+	},
+#ifdef CONFIG_MSM_STANDALONE_POWER_COLLAPSE
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		1300, 228, 1200000, 2000,
+	},
+#endif
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
+		false,
+		2000, 138, 1208400, 3200,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
+		false,
+		6000, 119, 1850300, 9000,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
+		false,
+		9200, 68, 2839200, 16400,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
+		false,
+		10300, 63, 3128000, 18200,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
+		false,
+		18000, 10, 4602600, 27000,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
+		false,
+		20000, 2, 5752000, 32000,
+	},
+};
+
+
+static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
+	.levels = &msm_rpmrs_levels[0],
+	.num_levels = ARRAY_SIZE(msm_rpmrs_levels),
+	.vdd_mem_levels  = {
+		[MSM_RPMRS_VDD_MEM_RET_LOW]	= 750000,
+		[MSM_RPMRS_VDD_MEM_RET_HIGH]	= 750000,
+		[MSM_RPMRS_VDD_MEM_ACTIVE]	= 1050000,
+		[MSM_RPMRS_VDD_MEM_MAX]		= 1150000,
+	},
+	.vdd_dig_levels = {
+		[MSM_RPMRS_VDD_DIG_RET_LOW]	= 500000,
+		[MSM_RPMRS_VDD_DIG_RET_HIGH]	= 750000,
+		[MSM_RPMRS_VDD_DIG_ACTIVE]	= 950000,
+		[MSM_RPMRS_VDD_DIG_MAX]		= 1150000,
+	},
+	.vdd_mask = 0x7FFFFF,
+	.rpmrs_target_id = {
+		[MSM_RPMRS_ID_PXO_CLK]		= MSM_RPM_ID_PXO_CLK,
+		[MSM_RPMRS_ID_L2_CACHE_CTL]	= MSM_RPM_ID_LAST,
+		[MSM_RPMRS_ID_VDD_DIG_0]	= MSM_RPM_ID_PM8921_S3_0,
+		[MSM_RPMRS_ID_VDD_DIG_1]	= MSM_RPM_ID_PM8921_S3_1,
+		[MSM_RPMRS_ID_VDD_MEM_0]	= MSM_RPM_ID_PM8921_L24_0,
+		[MSM_RPMRS_ID_VDD_MEM_1]	= MSM_RPM_ID_PM8921_L24_1,
+		[MSM_RPMRS_ID_RPM_CTL]		= MSM_RPM_ID_RPM_CTL,
+	},
+};
+
+static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
+	.mode = MSM_PM_BOOT_CONFIG_TZ,
+};
+
+#ifdef CONFIG_I2C
+#define I2C_SURF 1
+#define I2C_FFA  (1 << 1)
+#define I2C_RUMI (1 << 2)
+#define I2C_SIM  (1 << 3)
+#define I2C_FLUID (1 << 4)
+
+struct i2c_registry {
+	u8                     machs;
+	int                    bus;
+	struct i2c_board_info *info;
+	int                    len;
+};
+
+#ifdef CONFIG_SND_SOC_TPA2051D3
+static struct tpa2051d3_platform_data tpa2051d3_pdata = {
+	.spkr_cmd = {0x00, 0x82, 0x27, 0x57, 0x13, 0x0D, 0x0D},
+	.hsed_cmd = {0x00, 0x0C, 0x25, 0x57, 0x6D, 0x4D, 0x0D},
+	.rece_cmd = {0x00, 0x82, 0x25, 0x57, 0x2D, 0x4D, 0x0D},
+};
+
+#define TPA2051D3_I2C_SLAVE_ADDR	(0xE0 >> 1)
+
+static struct i2c_board_info msm_i2c_gsbi8_tpa2051d3_info[] = {
+	{
+		I2C_BOARD_INFO(TPA2051D3_I2C_NAME, TPA2051D3_I2C_SLAVE_ADDR),
+		.platform_data = &tpa2051d3_pdata,
+	},
+};
+#endif
+
+static struct i2c_registry msm8960_i2c_devices[] __initdata = {
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+		msm_i2c_gsbi12_info,
+		ARRAY_SIZE(msm_i2c_gsbi12_info),
+	},
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+		i2c_tps61310_flashlight,
+		ARRAY_SIZE(i2c_tps61310_flashlight),
+	},
+#endif
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI3_QUP_I2C_BUS_ID,
+		msm_i2c_gsbi3_info,
+		ARRAY_SIZE(msm_i2c_gsbi3_info),
+	},
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI2_QUP_I2C_BUS_ID,
+		pn544_i2c_boardinfo,
+		ARRAY_SIZE(pn544_i2c_boardinfo),
+	},
+#ifdef CONFIG_SND_SOC_TPA2051D3
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI8_QUP_I2C_BUS_ID,
+		msm_i2c_gsbi8_tpa2051d3_info,
+		ARRAY_SIZE(msm_i2c_gsbi8_tpa2051d3_info),
+	},
+#endif
+};
+#endif /* CONFIG_I2C */
+
+static void __init register_i2c_devices(void)
+{
+#ifdef CONFIG_I2C
+	u8 mach_mask = 0;
+	int i;
+
+#ifdef CONFIG_MSM_CAMERA
+	struct i2c_registry fighter_camera_i2c_devices = {
+		I2C_SURF | I2C_FFA | I2C_FLUID | I2C_RUMI,
+		MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+		fighter_camera_board_info.board_info,
+		fighter_camera_board_info.num_i2c_board_info,
+	};
+#endif
+
+	mach_mask = I2C_SURF;
+
+	/* Run the array and install devices as appropriate */
+	for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
+		if (msm8960_i2c_devices[i].machs & mach_mask) {
+			i2c_register_board_info(msm8960_i2c_devices[i].bus,
+					msm8960_i2c_devices[i].info,
+					msm8960_i2c_devices[i].len);
+		}
+	}
+#ifdef CONFIG_MSM_CAMERA
+	/* HTC_START_Simon.Ti_Liu_20120711_IMPLEMENT_MCLK_SWITCH */
+	if (fighter_camera_i2c_devices.machs & mach_mask)
+		i2c_register_board_info(fighter_camera_i2c_devices.bus,
+				fighter_camera_i2c_devices.info,
+				fighter_camera_i2c_devices.len);
+#endif
+	if (system_rev < 3) {
+		i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+				i2c_CM36282_devices, ARRAY_SIZE(i2c_CM36282_devices));
+		pr_info("%s: cm36282 PL-sensor for XA,XB,XC, system_rev %d ",
+				__func__, system_rev);
+	} else {
+		i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+				i2c_CM36282_XD_devices,	ARRAY_SIZE(i2c_CM36282_XD_devices));
+		pr_info("%s: cm36282 PL-sensor for XD and newer HW version, system_rev %d ",
+				__func__, system_rev);
+	}
+#endif /* CONFIG_I2C */
+}
+
+static void __init msm8960ab_update_krait_spm(void)
+{
+	int i;
+
+
+	/* Update the SPM sequences for SPC and PC */
+	for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
+		int j;
+		struct msm_spm_platform_data *pdata = &msm_spm_data[i];
+		for (j = 0; j < pdata->num_modes; j++) {
+			if (pdata->modes[j].cmd ==
+					spm_power_collapse_without_rpm)
+				pdata->modes[j].cmd =
+				spm_power_collapse_without_rpm_krait_v3;
+			else if (pdata->modes[j].cmd ==
+					spm_power_collapse_with_rpm)
+				pdata->modes[j].cmd =
+				spm_power_collapse_with_rpm_krait_v3;
+		}
+	}
+}
+
+static void __init msm8960ab_update_retention_spm(void)
+{
+	int i;
+
+	/* Update the SPM sequences for krait retention on all cores */
+	for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
+		int j;
+		struct msm_spm_platform_data *pdata = &msm_spm_data[i];
+		for (j = 0; j < pdata->num_modes; j++) {
+			if (pdata->modes[j].cmd ==
+					spm_retention_cmd_sequence)
+				pdata->modes[j].cmd =
+				spm_retention_with_krait_v3_cmd_sequence;
+		}
+	}
+}
+
+
+/*UART -> GSBI8*/
+static uint32_t msm_uart_gpio[] = {
+	GPIO_CFG(34, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(35, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA),
+};
+static void msm_uart_gsbi_gpio_init(void)
+{
+	gpio_tlmm_config(msm_uart_gpio[0], GPIO_CFG_ENABLE);
+	gpio_tlmm_config(msm_uart_gpio[1], GPIO_CFG_ENABLE);
+}
+
+static uint32_t msm_region_gpio[] = {
+	GPIO_CFG(FIGHTER_REGION_ID, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, 0),
+};
+static void msm_region_id_gpio_init(void)
+{
+	gpio_tlmm_config(msm_region_gpio[0], GPIO_CFG_ENABLE);
+}
+
+#ifdef CONFIG_RAWCHIP
+static struct spi_board_info rawchip_spi_board_info[] __initdata = {
+	{
+		.modalias               = "spi_rawchip",
+		.max_speed_hz           = 27000000,
+		.bus_num                = 1,
+		.chip_select            = 0,
+		.mode                   = SPI_MODE_0,
+	},
+};
+#endif
+
+static void __init fighter_init(void)
+{
+	u32 hw_ver_id = 0, rc = 0;
+	struct kobject *properties_kobj;
+
+	if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
+		pr_err("meminfo_init() failed!\n");
+
+	htc_add_ramconsole_devices();
+	platform_device_register(&msm_gpio_device);
+
+	msm_tsens_early_init(&msm_tsens_pdata);
+	msm_thermal_init(&msm_thermal_pdata);
+	BUG_ON(msm_rpm_init(&msm8960_rpm_data));
+	BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
+
+	regulator_suppress_info_printing();
+	if (msm_xo_init())
+		pr_err("Failed to initialize XO votes\n");
+	platform_device_register(&fighter_device_rpm_regulator);
+	msm_clock_init(&msm8960_clock_init_data);
+	msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
+	android_usb_pdata.swfi_latency =
+		msm_rpmrs_levels[0].latency_us;
+	fighter_gpiomux_init();
+	msm8960_device_qup_spi_gsbi10.dev.platform_data =
+				&msm8960_qup_spi_gsbi10_pdata;
+#ifdef CONFIG_RAWCHIP
+	spi_register_board_info(rawchip_spi_board_info,
+				ARRAY_SIZE(rawchip_spi_board_info));
+#endif
+
+	fighter_init_pmic();
+	msm8960_i2c_init();
+	msm8960_gfx_init();
+	if (cpu_is_msm8960ab())
+		msm8960ab_update_krait_spm();
+	if (cpu_is_krait_v3()) {
+		msm_pm_set_tz_retention_flag(0);
+		msm8960ab_update_retention_spm();
+	} else {
+		msm_pm_set_tz_retention_flag(1);
+	}
+	msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
+	msm_spm_l2_init(msm_spm_l2_data);
+	msm8960_init_buses();
+
+	fighter_cable_detect_register();
+
+#ifdef CONFIG_BT
+	bt_export_bd_address();
+#endif
+#ifdef CONFIG_HTC_BATT_8960
+	htc_battery_cell_init(htc_battery_cells, ARRAY_SIZE(htc_battery_cells));
+#endif /* CONFIG_HTC_BATT_8960 */
+
+	platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
+	platform_device_register(&msm8960_device_ext_l2_vreg);
+
+	platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
+
+	msm_uart_gsbi_gpio_init();
+	fighter_pm8921_gpio_mpp_init();
+	msm_region_id_gpio_init();
+	platform_add_devices(fighter_devices, ARRAY_SIZE(fighter_devices));
+	fighter_init_camera();
+	fighter_init_mmc();
+	register_i2c_devices();
+	fighter_init_fb();
+	slim_register_board_info(msm_slim_devices,
+		ARRAY_SIZE(msm_slim_devices));
+	BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
+
+//	create_proc_read_entry("emmc", 0, NULL, emmc_partition_read_proc, NULL);
+//	create_proc_read_entry("dying_processes", 0, NULL, dying_processors_read_proc, NULL);
+
+	/*usb driver won't be loaded in MFG 58 station and gift mode*/
+	if (!(board_mfg_mode() == 6 || board_mfg_mode() == 7))
+		fighter_add_usb_devices();
+
+	properties_kobj = kobject_create_and_add("board_properties", NULL);
+	if (properties_kobj)
+		rc = sysfs_create_group(properties_kobj,
+			&properties_attr_group);
+
+	fighter_init_keypad();
+	hw_ver_id = readl(HW_VER_ID_VIRT);
+	printk(KERN_INFO "hw_ver_id = %x\n", hw_ver_id);
+}
+
+#define PHY_BASE_ADDR1  0x80400000
+#define SIZE_ADDR1      (132 * 1024 * 1024)
+
+#define PHY_BASE_ADDR2  0x90000000
+#define SIZE_ADDR2      (768 * 1024 * 1024)
+
+static void __init fighter_fixup(struct tag *tags,
+				 char **cmdline, struct meminfo *mi)
+{
+	engineerid = parse_tag_engineerid(tags);
+	mi->nr_banks = 2;
+	mi->bank[0].start = PHY_BASE_ADDR1;
+	mi->bank[0].size = SIZE_ADDR1;
+	mi->bank[1].start = PHY_BASE_ADDR2;
+	mi->bank[1].size = SIZE_ADDR2;
+
+	skuid = parse_tag_skuid((const struct tag *)tags);
+	printk(KERN_INFO "Fighter_fixup:skuid=0x%x\n", skuid);
+}
+
+static int __init pm8921_late_init(void)
+{
+	return 0;
+}
+
+late_initcall(pm8921_late_init);
+
+MACHINE_START(FIGHTER, "fighter")
+	.fixup = fighter_fixup,
+	.map_io = fighter_map_io,
+	.reserve = fighter_reserve,
+	.init_irq = fighter_init_irq,
+	.handle_irq = gic_handle_irq,
+	.timer = &msm_timer,
+	.init_machine = fighter_init,
+	.init_early = msm8960_allocate_memory_regions,
+	.init_very_early = fighter_early_memory,
+	.restart = msm_restart,
+MACHINE_END
diff --git a/arch/arm/mach-msm/htc/fighter/board-fighter.h b/arch/arm/mach-msm/htc/fighter/board-fighter.h
new file mode 100644
index 0000000..6090ea9
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/board-fighter.h
@@ -0,0 +1,286 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ARCH_ARM_MACH_MSM_BOARD_FIGHTER_H
+#define __ARCH_ARM_MACH_MSM_BOARD_FIGHTER_H
+
+#include <linux/regulator/msm-gpio-regulator.h>
+#include <mach/irqs.h>
+#include <mach/rpm-regulator.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/i2c.h>
+#include <mach/msm_memtypes.h>
+#ifdef CONFIG_MSM_RTB
+#include <mach/msm_rtb.h>
+#endif
+#ifdef CONFIG_MSM_CACHE_DUMP
+#include <mach/msm_cache_dump.h>
+#endif
+
+/* Macros assume PMIC GPIOs and MPPs start at 1 */
+#define PM8921_GPIO_BASE		NR_GPIO_IRQS
+#define PM8921_GPIO_PM_TO_SYS(pm_gpio)	(pm_gpio - 1 + PM8921_GPIO_BASE)
+#define PM8921_MPP_BASE			(PM8921_GPIO_BASE + PM8921_NR_GPIOS)
+#define PM8921_MPP_PM_TO_SYS(pm_gpio)	(pm_gpio - 1 + PM8921_MPP_BASE)
+#define PM8921_IRQ_BASE			(NR_MSM_IRQS + NR_GPIO_IRQS)
+
+#define FIGHTER_LAYOUTS			{\
+		{ { 0,  1, 0}, {-1,  0,  0}, {0, 0,  1} }, \
+		{ { 0, -1, 0}, { 1,  0,  0}, {0, 0, -1} }, \
+		{ {-1,  0, 0}, { 0, -1,  0}, {0, 0,  1} }, \
+		{ {-1,  0, 0}, { 0,  0, -1}, {0, 1,  0} }  \
+					}
+
+extern struct gpio_regulator_platform_data
+	msm_gpio_regulator_pdata[] __devinitdata;
+
+extern struct regulator_init_data msm_saw_regulator_pdata_s5;
+extern struct regulator_init_data msm_saw_regulator_pdata_s6;
+
+extern struct rpm_regulator_platform_data fighter_rpm_regulator_pdata __devinitdata;
+
+extern struct platform_device msm8960_device_ext_5v_vreg __devinitdata;
+extern struct platform_device msm8960_device_ext_l2_vreg __devinitdata;
+extern struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata;
+extern struct pm8xxx_regulator_platform_data
+	msm_pm8921_regulator_pdata[] __devinitdata;
+
+extern int msm_pm8921_regulator_pdata_len __devinitdata;
+
+#define GPIO_VREG_ID_EXT_5V		0
+#define GPIO_VREG_ID_EXT_L2		1
+#define GPIO_VREG_ID_EXT_3P3V		2
+
+#define FIGHTER_LCD_TE				(0) /* MDP_VSYNC_GPIO */
+#define FIGHTER_NC_GPIO_1			(1)
+#define FIGHTER_NC_GPIO_2			(2)
+#define FIGHTER_SIM_HOTSWAP			(3)
+#define FIGHTER_CAM_MCLK1			(4)
+#define FIGHTER_CAM_MCLK0			(5)
+#define FIGHTER_NFC_DL_MODE			(6)
+#define FIGHTER_TP_ATTz				(7)
+#define FIGHTER_TP_RSTz				(8)
+#define FIGHTER_CAM_PWDN			(9)
+#define FIGHTER_RAFT_UP_EN_CPU		(10)
+#define FIGHTER_RESOUTz_CONTROL		(11)
+#define FIGHTER_NC_GPIO_12			(12)
+#define FIGHTER_NC_GPIO_13			(13)
+#define FIGHTER_NFC_I2C_SDA			(12)
+#define FIGHTER_NFC_I2C_SCL			(13)
+#define FIGHTER_NC_GPIO_14			(14)
+#define FIGHTER_SIM_CD				(15)
+#define FIGHTER_TP_I2C_SDA			(16)
+#define FIGHTER_TP_I2C_SCL			(17)
+#define FIGHTER_NC_GPIO_18			(18)
+#define FIGHTER_USB_ID1				(19)
+#define FIGHTER_CAM_I2C_SDA			(20)
+#define FIGHTER_CAM_I2C_SCL			(21)
+#define FIGHTER_NC_GPIO_22			(22)
+#define FIGHTER_NC_GPIO_23			(23)
+#define FIGHTER_NC_GPIO_24			(24)
+#define FIGHTER_NC_GPIO_25			(25)
+#define FIGHTER_FM_SSBI				(26)
+#define FIGHTER_FM_DATA				(27)
+#define FIGHTER_BT_STROBE			(28)
+#define FIGHTER_BT_DATA				(29)
+#define FIGHTER_UIM1_DATA_MSM		(30)
+#define FIGHTER_UIM1_CLK_MSM		(31)
+#define FIGHTER_TORCH_FLASHz		(32)
+#define FIGHTER_DRIVER_EN			(33)
+#define FIGHTER_DEBUG_UART_TX		(34)
+#define FIGHTER_DEBUG_UART_RX		(35)
+#define FIGHTER_AC_I2C_SDA			(36)
+#define FIGHTER_AC_I2C_SCL			(37)
+#define FIGHTER_MSM_SPI_DO			(38)
+#define FIGHTER_NC_GPIO_39			(39)
+#define FIGHTER_MSM_SPI_CS0			(40)
+#define FIGHTER_MSM_SPI_CLK			(41)
+#define FIGHTER_VOL_UPz				(42)
+#define FIGHTER_VOL_DOWNz			(43)
+#define FIGHTER_SENSOR_I2C_SDA		(44)
+#define FIGHTER_SENSOR_I2C_SCL		(45)
+#define FIGHTER_PWR_KEYz 			(46)
+#define FIGHTER_MAIN_CAM_ID			(47)
+#define FIGHTER_LCD_RSTz			(48)
+#define FIGHTER_CAM_VCM_PD			(49)
+#define FIGHTER_NFC_VEN				(50)
+#define FIGHTER_NC_GPIO_51			(51)
+#define FIGHTER_NC_GPIO_52			(52)
+#define FIGHTER_NC_GPIO_53			(53)
+#define FIGHTER_REGION_ID			(54)
+#define FIGHTER_NC_GPIO_55			(55)
+#define FIGHTER_V_3G_PA1_EN			(56)
+#define FIGHTER_V_3G_PA0_EN			(57)
+#define FIGHTER_APT0_MODE_SEL		(58)
+#define FIGHTER_AUD_WCD_MCLK		(59)
+#define FIGHTER_AUD_WCD_SB_CLK		(60)
+#define FIGHTER_AUD_WCD_SB_DATA		(61)
+#define FIGHTER_AUD_WCD_INTR_OUT	(62)
+#define FIGHTER_NC_GPIO_63			(63)
+#define FIGHTER_NC_GPIO_64			(64)
+#define FIGHTER_NC_GPIO_65			(65)
+#define FIGHTER_NC_GPIO_66			(66)
+#define FIGHTER_GSENSOR_INT			(67)
+#define FIGHTER_CAM2_RSTz			(68)
+#define FIGHTER_NC_GPIO_69			(69)
+#define FIGHTER_COMPASS_INT			(70)
+#define FIGHTER_HS_TX_CPU			(71)
+#define FIGHTER_HS_RX_CPU			(72)
+#define FIGHTER_NC_GPIO_73			(73)
+#define FIGHTER_NC_GPIO_74			(74)
+#define FIGHTER_WC_INz				(75)
+#define FIGHTER_CAM2_STANDBY		(76)
+#define FIGHTER_NC_GPIO_77			(77)
+#define FIGHTER_NC_GPIO_78			(78)
+#define FIGHTER_V_CAM2_D1V8_EN		(79)
+#define FIGHTER_NC_GPIO_80			(80)
+#define FIGHTER_V_TP_3V3_EN			(81)
+#define FIGHTER_NC_GPIO_82			(82)
+#define FIGHTER_WCN_BT_SSBI			(83)
+#define FIGHTER_WCN_CMD_DATA2		(84)
+#define FIGHTER_WCN_CMD_DATA1		(85)
+#define FIGHTER_WCN_CMD_DATA0		(86)
+#define FIGHTER_WCN_CMD_SET			(87)
+#define FIGHTER_WCN_CMD_CLK			(88)
+#define FIGHTER_USBz_AUDIO_SW		(89)
+#define FIGHTER_NC_GPIO_90			(90)
+#define FIGHTER_NC_GPIO_91			(91)
+#define FIGHTER_NC_GPIO_92			(92)
+#define FIGHTER_HS_MIC_BIAS_EN			(93)
+#define FIGHTER_MBAT_IN				(94)
+#define FIGHTER_CAM_EXT_LDO			(95)
+#define FIGHTER_NC_GPIO_96			(96)
+#define FIGHTER_NC_GPIO_97			(97)
+#define FIGHTER_RIVA_TX				(98)
+#define FIGHTER_NC_GPIO_99			(99)
+#define FIGHTER_NC_GPIO_100			(100)
+#define FIGHTER_NC_GPIO_101			(101)
+#define FIGHTER_NC_GPIO_102			(102)
+#define FIGHTER_PM_SEC_INTz			(103)
+#define FIGHTER_PM_USR_INTz			(104)
+#define FIGHTER_PM_MDM_INTz			(105)
+#define FIGHTER_NFC_IRQ				(106)
+#define FIGHTER_AUDIOz_UART_SW		(107)
+#define FIGHTER_PS_HOLD				(108)
+#define FIGHTER_APT1_VCON			(109)
+#define FIGHTER_BC1_SW_SEL1			(110)
+#define FIGHTER_PRX_LB_SW_SEL		(111)
+#define FIGHTER_ANT_SW_SEL4			(112)
+#define FIGHTER_BC1_SW_SEL0			(113)
+#define FIGHTER_BC0_SW_SEL1			(114)
+#define FIGHTER_BC0_SW_SEL0			(115)
+#define FIGHTER_ANT_SW_SEL3			(116)
+#define FIGHTER_ANT_SW_SEL2			(117)
+#define FIGHTER_ANT_SW_SEL1			(118)
+#define FIGHTER_ANT_SW_SEL0			(119)
+#define FIGHTER_PA1_R0				(120)
+#define FIGHTER_PA1_R1				(121)
+#define FIGHTER_PA0_R0				(122)
+#define FIGHTER_PA0_R1				(123)
+#define FIGHTER_RTR1_RF_ON			(124)
+#define FIGHTER_RTR0_RF_ON			(125)
+#define FIGHTER_RTR_RX_ON			(126)
+#define FIGHTER_APT0_VCON			(127)
+#define FIGHTER_RTR0_PA_ON8_CELL	(128)
+#define FIGHTER_RTR0_PA_ON7_U700	(129)
+#define FIGHTER_NC_GPIO_130			(130)
+#define FIGHTER_RTR0_PA_ON5_PCS		(131)
+#define FIGHTER_PA_ON4_MODE			(132)
+#define FIGHTER_RTR1_PA_ON3_BC1_1X	(133)
+#define FIGHTER_RTR1_PA_ON2_BC0_1X	(134)
+#define FIGHTER_PA_ON1_GSMHB		(135)
+#define FIGHTER_PA_ON0_GSMLB		(136)
+#define FIGHTER_EXT_GPS_LNA_EN		(137)
+#define FIGHTER_NC_GPIO_138			(138)
+#define FIGHTER_G850_700_SEL		(139)
+#define FIGHTER_RTR1_SSBI2			(140)
+#define FIGHTER_RTR1_SSBI1			(141)
+#define FIGHTER_RTR0_SSBI2			(142)
+#define FIGHTER_RTR0_SSBI1			(143)
+#define FIGHTER_RTR0_GP_CLK			(144)
+#define FIGHTER_RTR0_GPRSSYNC		(145)
+#define FIGHTER_RTR0_GPDATA2		(146)
+#define FIGHTER_RTR0_GPDATA1		(147)
+#define FIGHTER_RTR0_GPDATA0		(148)
+#define FIGHTER_NC_GPIO_149			(149)
+#define FIGHTER_NC_GPIO_150			(150)
+#define FIGHTER_NC_GPIO_151			(151)
+
+#define PMGPIO(x) (x)
+
+#define FIGHTER_NC_PMGPIO_1			PMGPIO(1)
+#define FIGHTER_NC_PMGPIO_2			PMGPIO(2)
+#define FIGHTER_NC_PMGPIO_3			PMGPIO(3)
+#define FIGHTER_NC_PMGPIO_4			PMGPIO(4)
+#define FIGHTER_PM_SPI_CS0			PMGPIO(5)
+#define FIGHTER_RAFT_uP_SPI_CS0		PMGPIO(6)
+#define FIGHTER_HS_RX_PMIC_REMO			PMGPIO(7)
+#define FIGHTER_HS_RX_PMIC_UART			PMGPIO(8)
+#define FIGHTER_NC_PMGPIO_9			PMGPIO(9)
+#define FIGHTER_NC_PMGPIO_10		PMGPIO(10)
+#define FIGHTER_PM_SPI_CLK			PMGPIO(11)
+#define FIGHTER_RAFT_uP_SPI_CLK		PMGPIO(12)
+#define FIGHTER_PM_SPI_DO			PMGPIO(13)
+#define FIGHTER_RAFT_uP_SPI_DO		PMGPIO(14)
+#define FIGHTER_RAFT_UP_EN_CPU_PM	PMGPIO(15)
+#define FIGHTER_HS_TX_PMIC_UART			PMGPIO(15)
+#define FIGHTER_RAFT_UP_EN			PMGPIO(16)
+#define FIGHTER_HS_TX_PMIC_REMO			PMGPIO(16)
+#define FIGHTER_PROXIMITY_INTz		PMGPIO(17)
+#define FIGHTER_AUD_AMP_EN			PMGPIO(18)
+#define FIGHTER_AUD_HAC_SDz			PMGPIO(19)
+#define FIGHTER_EARPHONE_DETz		PMGPIO(20)
+#define FIGHTER_NC_PMGPIO_21		PMGPIO(21)
+#define FIGHTER_NC_PMGPIO_22		PMGPIO(22)
+#define FIGHTER_SDC3_CDz			PMGPIO(23)
+#define FIGHTER_GREEN_LED			PMGPIO(24)
+#define FIGHTER_AMBER_LED			PMGPIO(25)
+#define FIGHTER_NC_PMGPIO_26		PMGPIO(26)
+#define FIGHTER_UIM1_RST			PMGPIO(27)
+#define FIGHTER_NC_PMGPIO_28		PMGPIO(28)
+#define FIGHTER_SIM_CLK_MSM			PMGPIO(29)
+#define FIGHTER_UIM1_CLK			PMGPIO(30)
+#define FIGHTER_NC_PMGPIO_31		PMGPIO(31)
+#define FIGHTER_NC_PMGPIO_32		PMGPIO(32)
+#define FIGHTER_LCD_ID0				PMGPIO(33)
+#define FIGHTER_AUD_CODEC_RSTz		PMGPIO(34)
+#define FIGHTER_LCD_ID1				PMGPIO(35)
+#define FIGHTER_NC_PMGPIO_36		PMGPIO(36)
+#define FIGHTER_NC_PMGPIO_37		PMGPIO(37)
+#define FIGHTER_NC_PMGPIO_38		PMGPIO(38)
+#define FIGHTER_SSBI_PMIC_FWD_CLK	PMGPIO(39)
+#define FIGHTER_LS_EN			PMGPIO(40)
+#define FIGHTER_COVER_DETz			PMGPIO(41)
+#define FIGHTER_AD_EN_MSM			PMGPIO(42)
+#define FIGHTER_NC_PMGPIO_43		PMGPIO(43)
+#define FIGHTER_NC_PMGPIO_44		PMGPIO(44)
+
+extern struct msm_camera_board_info fighter_camera_board_info;
+
+void __init fighter_init_camera(void);
+void fighter_init_fb(void);
+void __init fighter_init_pmic(void);
+void fighter_init_mmc(void);
+int __init fighter_gpiomux_init(void);
+void __init msm8960_allocate_fb_region(void);
+void __init fighter_pm8921_gpio_mpp_init(void);
+void msm8960_mdp_writeback(struct memtype_reserve *reserve_table);
+int __init fighter_init_keypad(void);
+
+#ifdef CONFIG_MSM_RTB
+extern struct msm_rtb_platform_data msm8960_rtb_pdata;
+#endif
+#ifdef CONFIG_MSM_CACHE_DUMP
+extern struct msm_cache_dump_platform_data msm8960_cache_dump_pdata;
+#endif
+
+#endif
diff --git a/arch/arm/mach-msm/htc/fighter/display/Makefile b/arch/arm/mach-msm/htc/fighter/display/Makefile
new file mode 100644
index 0000000..67002dc
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/display/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_MACH_FIGHTER) += mipi_fighter.o mipi_fighter_cmd_qhd_pt.o board-fighter-panel.o
diff --git a/arch/arm/mach-msm/htc/fighter/display/board-fighter-panel.c b/arch/arm/mach-msm/htc/fighter/display/board-fighter-panel.c
new file mode 100644
index 0000000..93a756c
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/display/board-fighter-panel.c
@@ -0,0 +1,475 @@
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include "../../../../drivers/video/msm/msm_fb.h"
+#include "../../../../drivers/video/msm/mipi_dsi.h"
+#include "../../../../drivers/video/msm/mdp.h"
+#include "../../../../drivers/video/msm/mdp4.h"
+#include "../../../../drivers/video/msm/msm_fb_panel.h"
+#include <linux/gpio.h>
+#include <mach/gpio.h>
+#include <mach/panel_id.h>
+#include <mach/msm_memtypes.h>
+#include <linux/bootmem.h>
+#include <video/msm_hdmi_modes.h>
+#include "../devices.h"
+#include "../board-fighter.h"
+#if defined (CONFIG_FB_MSM_MDP_ABL)
+#include <linux/fb.h>
+#endif
+
+#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
+#define MSM_FB_PRIM_BUF_SIZE (960 * 544 * 4 * 3) /* 4 bpp x 3 pages */
+#else
+#define MSM_FB_PRIM_BUF_SIZE (960 * 544 * 4 * 2) /* 4 bpp x 2 pages */
+#endif
+
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
+#elif defined(CONFIG_FB_MSM_TVOUT)
+#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
+#else
+#define MSM_FB_EXT_BUF_SIZE 0
+#endif
+
+/* Note: must be multiple of 4096 */
+#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE, 4096)
+
+#ifdef CONFIG_FB_MSM_OVERLAY0_WRITEBACK
+#define MSM_FB_OVERLAY0_WRITEBACK_SIZE roundup((960 * 544 * 3 * 2), 4096)
+#else
+#define MSM_FB_OVERLAY0_WRITEBACK_SIZE (0)
+#endif  /* CONFIG_FB_MSM_OVERLAY0_WRITEBACK */
+
+#ifdef CONFIG_FB_MSM_OVERLAY1_WRITEBACK
+#define MSM_FB_OVERLAY1_WRITEBACK_SIZE roundup((1920 * 1088 * 3 * 2), 4096)
+#else
+#define MSM_FB_OVERLAY1_WRITEBACK_SIZE (0)
+#endif  /* CONFIG_FB_MSM_OVERLAY1_WRITEBACK */
+
+static struct resource msm_fb_resources[] = {
+	{
+		.flags = IORESOURCE_DMA,
+	}
+};
+
+static struct msm_fb_platform_data msm_fb_pdata;
+
+static struct platform_device msm_fb_device = {
+	.name   = "msm_fb",
+	.id     = 0,
+	.num_resources     = ARRAY_SIZE(msm_fb_resources),
+	.resource          = msm_fb_resources,
+	.dev.platform_data = &msm_fb_pdata,
+};
+
+static int isOrise(void)
+{
+  return (panel_type == PANEL_ID_FIGHTER_SONY_OTM || panel_type == PANEL_ID_FIGHTER_SONY_OTM_C1_1 || panel_type == PANEL_ID_FIGHTER_SONY_OTM_MP);
+}
+
+static void __init msm8960_set_display_params(char *prim_panel, char *ext_panel)
+{
+	if (strnlen(prim_panel, PANEL_NAME_MAX_LEN)) {
+		strlcpy(msm_fb_pdata.prim_panel_name, prim_panel,
+			PANEL_NAME_MAX_LEN);
+		pr_debug("msm_fb_pdata.prim_panel_name %s\n",
+			msm_fb_pdata.prim_panel_name);
+	}
+	if (strnlen(ext_panel, PANEL_NAME_MAX_LEN)) {
+		strlcpy(msm_fb_pdata.ext_panel_name, ext_panel,
+			PANEL_NAME_MAX_LEN);
+		pr_debug("msm_fb_pdata.ext_panel_name %s\n",
+			msm_fb_pdata.ext_panel_name);
+	}
+}
+
+int fighter_panel_first_init = 1;
+static bool dsi_power_on;
+
+static int mipi_dsi_panel_power(int on)
+{
+	static struct regulator *v_lcm, *v_lcmio, *v_dsivdd;
+	static bool bPanelPowerOn = false;
+	int rc;
+
+	char *lcm_str = "8921_l11";
+	char *lcmio_str = "8921_lvs5";
+	char *dsivdd_str = "8921_l2";
+        
+        printk(KERN_ERR  "[DISP] %s +++\n", __func__);
+	/* To avoid system crash in shutdown for non-panel case */
+	if (panel_type == PANEL_ID_NONE)
+		return -ENODEV;
+
+	printk(KERN_INFO "%s: state : %d\n", __func__, on);
+
+	if (!dsi_power_on) {
+		v_lcm = regulator_get(&msm_mipi_dsi1_device.dev,
+				lcm_str);
+		if (IS_ERR_OR_NULL(v_lcm)) {
+			printk(KERN_ERR "could not get %s, rc = %ld\n",
+				lcm_str, PTR_ERR(v_lcm));
+			return -ENODEV;
+		}
+
+		v_lcmio = regulator_get(&msm_mipi_dsi1_device.dev,
+				lcmio_str);
+		if (IS_ERR_OR_NULL(v_lcmio)) {
+			printk(KERN_ERR "could not get %s, rc = %ld\n",
+				lcmio_str, PTR_ERR(v_lcmio));
+			return -ENODEV;
+		}
+
+
+		v_dsivdd = regulator_get(&msm_mipi_dsi1_device.dev,
+				dsivdd_str);
+		if (IS_ERR_OR_NULL(v_dsivdd)) {
+			printk(KERN_ERR "could not get %s, rc = %ld\n",
+				dsivdd_str, PTR_ERR(v_dsivdd));
+			return -ENODEV;
+		}
+
+		rc = regulator_set_voltage(v_lcm, 3000000, 3000000);
+		if (rc) {
+			printk(KERN_ERR "%s#%d: set_voltage %s failed, rc=%d\n", __func__, __LINE__, lcm_str, rc);
+			return -EINVAL;
+		}
+
+		rc = regulator_set_voltage(v_dsivdd, 1200000, 1200000);
+		if (rc) {
+			printk(KERN_ERR "%s#%d: set_voltage %s failed, rc=%d\n", __func__, __LINE__, dsivdd_str, rc);
+			return -EINVAL;
+		}
+
+		rc = gpio_request(FIGHTER_LCD_RSTz, "LCM_RST_N");
+		if (rc) {
+			printk(KERN_ERR "%s:LCM gpio %d request failed, rc=%d\n", __func__,  FIGHTER_LCD_RSTz, rc);
+			return -EINVAL;
+		}
+
+		dsi_power_on = true;
+	}
+
+	if (on) {
+		printk(KERN_INFO "%s: on\n", __func__);
+		rc = regulator_set_optimum_mode(v_lcm, 100000);
+		if (rc < 0) {
+			printk(KERN_ERR "set_optimum_mode %s failed, rc=%d\n", lcm_str, rc);
+			return -EINVAL;
+		}
+
+		rc = regulator_set_optimum_mode(v_dsivdd, 100000);
+		if (rc < 0) {
+			printk(KERN_ERR "set_optimum_mode %s failed, rc=%d\n", dsivdd_str, rc);
+			return -EINVAL;
+		}
+
+                    rc = regulator_enable(v_dsivdd);
+                    if (rc) {
+                      printk(KERN_ERR "enable regulator %s failed, rc=%d\n", dsivdd_str, rc);
+                      return -ENODEV;
+                    }
+                if (isOrise())
+                  {
+                    //hr_msleep(1);
+                    rc = regulator_enable(v_lcmio);
+                    if (rc) {
+                      printk(KERN_ERR "enable regulator %s failed, rc=%d\n", lcmio_str, rc);
+                      return -ENODEV;
+                    }
+                  }
+                else
+                  {
+                    rc = regulator_enable(v_lcm);
+                    if (rc) {
+                      printk(KERN_ERR "enable regulator %s failed, rc=%d\n", lcm_str, rc);
+                      return -ENODEV;
+                    }
+                  }
+
+		if (!fighter_panel_first_init)
+                  {
+                    //                    hr_msleep(10);
+                    gpio_set_value(FIGHTER_LCD_RSTz, 1);
+                    //hr_msleep(1);
+                    gpio_set_value(FIGHTER_LCD_RSTz, 0);
+                    //hr_msleep(35);
+                    gpio_set_value(FIGHTER_LCD_RSTz, 1);
+		}
+		//hr_msleep(60);
+
+		bPanelPowerOn = true;
+	} 
+        else
+          {
+		printk(KERN_INFO "%s: off\n", __func__);
+		if (!bPanelPowerOn) return 0;
+		//hr_msleep(100);
+		gpio_set_value(FIGHTER_LCD_RSTz, 0);
+		//hr_msleep(10);
+
+		if (regulator_disable(v_dsivdd)) {
+			printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, dsivdd_str);
+			return -EINVAL;
+		}
+
+                if (isOrise())
+                  {
+                    //hr_msleep(5);
+                    if (regulator_disable(v_lcmio)) {
+                      printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, lcmio_str);
+                      return -EINVAL;
+                    }
+                  }
+                else
+                  {
+                    if (regulator_disable(v_lcm)) {
+                      printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, lcm_str);
+                      return -EINVAL;
+                    }
+                  }
+
+		rc = regulator_set_optimum_mode(v_dsivdd, 100);
+		if (rc < 0) {
+			printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, dsivdd_str);
+			return -EINVAL;
+		}
+
+		bPanelPowerOn = false;
+	}
+        //        if (bPanelPowerOn)
+        //          fighter_display_on(mfd);
+	return 0;
+}
+
+static struct mipi_dsi_platform_data mipi_dsi_pdata = {
+	.vsync_gpio = FIGHTER_LCD_TE,
+	.dsi_power_save = mipi_dsi_panel_power,
+};
+
+static struct platform_device mipi_dsi_fighter_panel_device = {
+	.name = "mipi_fighter",
+	.id = 0,
+};
+
+#ifdef CONFIG_MSM_BUS_SCALING
+
+static struct msm_bus_vectors mdp_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+
+static struct msm_bus_vectors mdp_ui_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 216000000 * 2,
+		.ib = 270000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_vga_vectors[] = {
+	/* VGA and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 216000000 * 2,
+		.ib = 270000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_720p_vectors[] = {
+	/* 720p and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 230400000 * 2,
+		.ib = 288000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_1080p_vectors[] = {
+	/* 1080p and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 334080000 * 2,
+		.ib = 417600000 * 2,
+	},
+};
+
+static struct msm_bus_paths mdp_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(mdp_init_vectors),
+		mdp_init_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_ui_vectors),
+		mdp_ui_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_ui_vectors),
+		mdp_ui_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_vga_vectors),
+		mdp_vga_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_720p_vectors),
+		mdp_720p_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_1080p_vectors),
+		mdp_1080p_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
+	mdp_bus_scale_usecases,
+	ARRAY_SIZE(mdp_bus_scale_usecases),
+	.name = "mdp",
+};
+
+static struct msm_bus_vectors dtv_bus_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+static struct msm_bus_vectors dtv_bus_def_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 566092800 * 2,
+		.ib = 707616000 * 2,
+	},
+};
+static struct msm_bus_paths dtv_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(dtv_bus_init_vectors),
+		dtv_bus_init_vectors,
+	},
+	{
+		ARRAY_SIZE(dtv_bus_def_vectors),
+		dtv_bus_def_vectors,
+	},
+};
+static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
+	dtv_bus_scale_usecases,
+	ARRAY_SIZE(dtv_bus_scale_usecases),
+	.name = "dtv",
+};
+
+static struct lcdc_platform_data dtv_pdata = {
+	.bus_scale_table = &dtv_bus_scale_pdata,
+};
+#endif
+
+int mdp_core_clk_rate_table[] = {
+	85330000,
+	85330000,
+	160000000,
+	200000000,
+};
+
+static struct msm_panel_common_pdata mdp_pdata = {
+	.gpio = FIGHTER_LCD_TE,
+	//	.mdp_core_clk_rate = 85330000,
+	//	.mdp_core_clk_table = mdp_core_clk_rate_table,
+	//	.num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
+#ifdef CONFIG_MSM_BUS_SCALING
+	.mdp_bus_scale_table = &mdp_bus_scale_pdata,
+#endif
+	.mdp_rev = MDP_REV_42,
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+	.mem_hid = BIT(ION_CP_MM_HEAP_ID),
+#else
+	.mem_hid = MEMTYPE_EBI1,
+#endif
+	.mdp_max_clk = 200000000,
+};
+
+void __init msm8960_allocate_fb_region(void)
+{
+	void *addr;
+	unsigned long size;
+
+	size = MSM_FB_SIZE;
+	addr = alloc_bootmem_align(size, 0x1000);
+	msm_fb_resources[0].start = __pa(addr);
+	msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
+	pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
+			size, addr, __pa(addr));
+
+}
+
+void __init msm8960_mdp_writeback(struct memtype_reserve* reserve_table)
+{
+	mdp_pdata.ov0_wb_size = MSM_FB_OVERLAY0_WRITEBACK_SIZE;
+	mdp_pdata.ov1_wb_size = MSM_FB_OVERLAY1_WRITEBACK_SIZE;
+#if defined(CONFIG_ANDROID_PMEM) && !defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	reserve_table[mdp_pdata.mem_hid].size +=
+		mdp_pdata.ov0_wb_size;
+	reserve_table[mdp_pdata.mem_hid].size +=
+		mdp_pdata.ov1_wb_size;
+#endif
+}
+
+static char wfd_check_mdp_iommu_split_domain(void)
+{
+	return mdp_pdata.mdp_iommu_split_domain;
+}
+
+#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
+static struct msm_wfd_platform_data wfd_pdata = {
+	.wfd_check_mdp_iommu_split = wfd_check_mdp_iommu_split_domain,
+};
+
+static struct platform_device wfd_panel_device = {
+	.name = "wfd_panel",
+	.id = 0,
+	.dev.platform_data = NULL,
+};
+
+static struct platform_device wfd_device = {
+	.name          = "msm_wfd",
+	.id            = -1,
+	.dev.platform_data = &wfd_pdata,
+};
+#endif
+
+void __init fighter_init_fb(void)
+{
+	msm8960_set_display_params("mipi_fighter", "hdmi_msm");
+	platform_device_register(&msm_fb_device);
+#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
+	platform_device_register(&wfd_panel_device);
+	platform_device_register(&wfd_device);
+#endif
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+	platform_device_register(&hdmi_msm_device);
+#endif
+	platform_device_register(&mipi_dsi_fighter_panel_device);
+	msm_fb_register_device("mdp", &mdp_pdata);
+	msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
+	msm_fb_register_device("dtv", &dtv_pdata);
+}
diff --git a/arch/arm/mach-msm/htc/fighter/display/mipi_fighter.c b/arch/arm/mach-msm/htc/fighter/display/mipi_fighter.c
new file mode 100644
index 0000000..3233e7e
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/display/mipi_fighter.c
@@ -0,0 +1,1742 @@
+#include <mach/panel_id.h>
+#include "../../../drivers/video/msm/msm_fb.h"
+#include "../../../drivers/video/msm/mipi_dsi.h"
+#include "mipi_fighter.h"
+
+#ifndef FIGHTER_USE_CMDLISTS
+static struct dsi_buf fighter_tx_buf;
+static struct dsi_buf fighter_rx_buf;
+#endif
+static struct mipi_dsi_panel_platform_data *mipi_fighter_pdata;
+static struct dsi_cmd_desc *display_on_cmds = NULL;
+static struct dsi_cmd_desc *display_off_cmds = NULL;
+static struct dsi_cmd_desc *cmd_on_cmds = NULL;
+static int display_on_cmds_count = 0;
+static int display_off_cmds_count = 0;
+static int cmd_on_cmds_count = 0;
+static int mipi_fighter_lcd_init(void);
+static void mipi_fighter_set_backlight(struct msm_fb_data_type *mfd);
+static int cur_bl_level = 0;
+
+static char sw_reset[2] = {0x01, 0x00}; /* DTYPE_DCS_WRITE */
+static char enter_sleep[2] = {0x10, 0x00}; /* DTYPE_DCS_WRITE */
+static char exit_sleep[2] = {0x11, 0x00}; /* DTYPE_DCS_WRITE */
+static char display_off[2] = {0x28, 0x00}; /* DTYPE_DCS_WRITE */
+static char display_on[2] = {0x29, 0x00}; /* DTYPE_DCS_WRITE */
+static char enable_te[2] = {0x35, 0x00}; /* DTYPE_DCS_WRITE1 */
+
+static char rgb_888[2] = {0x3A, 0x77}; /* DTYPE_DCS_WRITE1 */
+
+#define NOVATEK_TWO_LANE
+
+#if defined(NOVATEK_TWO_LANE)
+static char set_num_of_lanes[2] = {0xae, 0x03}; /* DTYPE_DCS_WRITE1 */
+#else  /* 1 lane */
+static char set_num_of_lanes[2] = {0xae, 0x01}; /* DTYPE_DCS_WRITE1 */
+#endif
+
+static char led_pwm1[2] = {0x51, 0xF0}; /* DTYPE_DCS_WRITE1 */
+static char led_pwm2[2] = {0x53, 0x24}; /* DTYPE_DCS_WRITE1 */
+static char led_pwm3[2] = {0x55, 0x00}; /* DTYPE_DCS_WRITE1 */
+
+static char max_pktsize[2] = {MIPI_DSI_MRPS, 0x00}; /* LSB tx first, 16 bytes */
+
+static char novatek_e0[3] = {0xE0, 0x01, 0x03}; /* DTYPE_DCS_LWRITE */
+
+static struct dsi_cmd_desc fighter_cmd_backlight_cmds[] = {
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 1, sizeof(led_pwm1), led_pwm1},
+};
+
+/**gamma 2.2***/
+static char fir_lg_gamma22_01_d1[] = {
+	0xD1,
+	0x01, 0x98, 0x01, 0xA7, 0x01, 0xB2, 0x01, 0xB7, 0x01, 0xB8, 0x01,
+	0xCD, 0x01, 0xCF, 0x01, 0xE3
+};
+
+static char fir_lg_gamma22_01_d5[] = {
+	0xD5,
+	0x00, 0xF6, 0x01, 0x08, 0x01, 0x1F, 0x01, 0x37, 0x01, 0x52, 0x01,
+	0x70, 0x01, 0x85, 0x01, 0xAA
+};
+
+static char fir_lg_gamma22_01_d9[] = {
+	0xD9,
+	0x01, 0x67, 0x01, 0x6E, 0x01, 0x7F, 0x01, 0x8D, 0x01, 0x93, 0x01,
+	0xA4, 0x01, 0xAB, 0x01, 0xC7
+};
+
+static char fir_lg_gamma22_01_e0[] = {
+	0xE0,
+	0x01, 0x98, 0x01, 0xA7, 0x01, 0xB2, 0x01, 0xB7, 0x01, 0xB8, 0x01,
+	0xCD, 0x01, 0xCF, 0x01, 0xE3
+};
+
+static char fir_lg_gamma22_01_e4[] = {
+	0xE4,
+	0x00, 0xF6, 0x01, 0x08, 0x01, 0x1F, 0x01, 0x37, 0x01, 0x52, 0x01,
+	0x70, 0x01, 0x85, 0x01, 0xAA
+};
+
+static char fir_lg_gamma22_01_e8[] = {
+	0xE8,
+	0x01, 0x67, 0x01, 0x6E, 0x01, 0x7F, 0x01, 0x8D, 0x01, 0x93, 0x01,
+	0xA4, 0x01, 0xAB, 0x01, 0xC7
+};
+
+static char fir_lg_gamma22_02_d2[] = {
+	0xD2,
+	0x01, 0xF4, 0x02, 0x13, 0x02, 0x31, 0x02, 0x67, 0x02, 0x95, 0x02,
+	0x96, 0x02, 0xC8, 0x03, 0x03
+};
+
+static char fir_lg_gamma22_02_d6[] = {
+	0xD6,
+	0x01, 0xC3, 0x01, 0xED, 0x02, 0x14, 0x02, 0x55, 0x02, 0x87, 0x02,
+	0x88, 0x02, 0xBD, 0x02, 0xF9
+};
+
+static char fir_lg_gamma22_02_dd[] = {
+	0xDD,
+	0x01, 0xD9, 0x01, 0xFE, 0x02, 0x1F, 0x02, 0x58, 0x02, 0x87, 0x02,
+	0x8A, 0x02, 0xC0, 0x02, 0xFF
+};
+
+static char fir_lg_gamma22_02_e1[] = {
+	0xE1,
+	0x01, 0xF4, 0x02, 0x13, 0x02, 0x31, 0x02, 0x67, 0x02, 0x95, 0x02,
+	0x96, 0x02, 0xC8, 0x03, 0x03
+};
+
+static char fir_lg_gamma22_02_e5[] = {
+	0xE5,
+	0x01, 0xC3, 0x01, 0xED, 0x02, 0x14, 0x02, 0x55, 0x02, 0x87, 0x02,
+	0x88, 0x02, 0xBD, 0x02, 0xF9
+};
+
+static char fir_lg_gamma22_02_e9[] = {
+	0xE9,
+	0x01, 0xD9, 0x01, 0xFE, 0x02, 0x1F, 0x02, 0x58, 0x02, 0x87, 0x02,
+	0x8A, 0x02, 0xC0, 0x02, 0xFF
+};
+
+static char fir_lg_gamma22_03_d3[] = {
+	0xD3,
+	0x03, 0x2B, 0x03, 0x53, 0x03, 0x6F, 0x03, 0x92, 0x03, 0x9E, 0x03,
+	0xAE, 0x03, 0xB3, 0x03, 0xBA
+};
+
+static char fir_lg_gamma22_03_d7[] = {
+	0xD7,
+	0x03, 0x21, 0x03, 0x49, 0x03, 0x64, 0x03, 0x87, 0x03, 0x93, 0x03,
+	0xA1, 0x03, 0xA4, 0x03, 0xA5
+};
+
+static char fir_lg_gamma22_03_de[] = {
+	0xDE,
+	0x03, 0x26, 0x03, 0x52, 0x03, 0x6F, 0x03, 0x9B, 0x03, 0xB1, 0x03,
+	0xC9, 0x03, 0xDF, 0x03, 0xEF
+};
+
+static char fir_lg_gamma22_03_e2[] = {
+	0xE2,
+	0x03, 0x2B, 0x03, 0x53, 0x03, 0x6F, 0x03, 0x92, 0x03, 0x9E, 0x03,
+	0xAE, 0x03, 0xB3, 0x03, 0xBA
+};
+
+static char fir_lg_gamma22_03_e6[] = {
+	0xE6,
+	0x03, 0x21, 0x03, 0x49, 0x03, 0x64, 0x03, 0x87, 0x03, 0x93, 0x03,
+	0xA1, 0x03, 0xA4, 0x03, 0xA5
+};
+
+static char fir_lg_gamma22_03_ea[] = {
+	0xEA,
+	0x03, 0x26, 0x03, 0x52, 0x03, 0x6F, 0x03, 0x9B, 0x03, 0xB1, 0x03,
+	0xC9, 0x03, 0xDF, 0x03, 0xEF
+};
+
+static char fir_lg_gamma22_04_d4[] = {
+	0xD4, 0x03, 0xBC, 0x03, 0xBD
+};
+
+static char fir_lg_gamma22_04_d8[] = {
+	0xD8, 0x03, 0xA6, 0x03, 0xA7
+};
+
+static char fir_lg_gamma22_04_df[] = {
+	0xDF, 0x03, 0xFF, 0x03, 0xFF
+};
+
+static char fir_lg_gamma22_04_e3[] = {
+	0xE3, 0x03, 0xBC, 0x03, 0xBD
+};
+
+static char fir_lg_gamma22_04_e7[] = {
+	0xE7, 0x03, 0xA6, 0x03, 0xA7
+};
+
+static char fir_lg_gamma22_04_eb[] = {
+	0xEB, 0x03, 0xFF, 0x03, 0xFF
+};
+
+static struct dsi_cmd_desc novatek_video_on_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 50,
+		sizeof(sw_reset), sw_reset},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10,
+		sizeof(exit_sleep), exit_sleep},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10,
+		sizeof(display_on), display_on},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 10,
+		sizeof(set_num_of_lanes), set_num_of_lanes},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 10,
+		sizeof(rgb_888), rgb_888},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 10,
+		sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 10,
+		sizeof(led_pwm3), led_pwm3},
+};
+
+static struct dsi_cmd_desc novatek_cmd_on_cmds[] = {
+	/* added by our own */
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10,
+		sizeof(sw_reset), sw_reset},
+
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xFF, 0xAA, 0x55, 0x25, 0x01} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xFA, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00,
+			0x00, 0x03, 0x20, 0x12,
+			0x20, 0xFF, 0xFF, 0xFF} } ,/* 90Hz -> 60Hz */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		8, (char[]){0xF3, 0x02, 0x03, 0x07, 0x44, 0x88, 0xD1, 0x0C} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xFF, 0xAA, 0x55, 0x25, 0x00} } ,
+
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x08, 0x00} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		ARRAY_SIZE(novatek_e0), novatek_e0},/* PWM frequency = 13kHz */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x00, 0x00} } ,
+
+	{DTYPE_DCS_WRITE, 1, 0, 0, 120,
+		sizeof(exit_sleep), exit_sleep},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(enable_te), enable_te},
+	/*
+	   {DTYPE_DCS_WRITE, 1, 0, 0, 40,
+	   sizeof(display_on), display_on},
+	   */
+	{DTYPE_MAX_PKTSIZE, 1, 0, 0, 0,
+		sizeof(max_pktsize), max_pktsize},
+	/*
+	   {DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+	   sizeof(led_pwm1), led_pwm1},
+	   */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm3), led_pwm3},
+};
+
+static struct dsi_cmd_desc novatek_c2_cmd_on_cmds[] = {
+	/* added by our own */
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10,
+		sizeof(sw_reset), sw_reset},
+
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xFF, 0xAA, 0x55, 0x25, 0x01} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		8, (char[]){0xF3, 0x02, 0x03, 0x07, 0x15, 0x88, 0xD1, 0x0C} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xFF, 0xAA, 0x55, 0x25, 0x00} } ,
+
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x08, 0x00} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xB8, 0x01, 0x03, 0x03, 0x03} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		ARRAY_SIZE(novatek_e0), novatek_e0},/* PWM frequency = 13kHz */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x08, 0x01} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xD0, 0x13, 0x11, 0x10, 0x10} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xD1, 0x00, 0x8F, 0x00, 0xC1, 0x00, 0xF0, 0x01,
+			0x0D, 0x01, 0x24, 0x01, 0x41, 0x01, 0x63, 0x01,
+			0x91} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xD2, 0x01, 0xB4, 0x01, 0xE9, 0x02, 0x12, 0x02,
+			0x57, 0x02, 0x8B, 0x02, 0x8D, 0x02, 0xBD, 0x02,
+			0xF5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xD3, 0x03, 0x19, 0x03, 0x46, 0x03, 0x63, 0x03,
+			0x88, 0x03, 0x9C, 0x03, 0xB6, 0x03, 0xC8, 0x03,
+			0xD5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xD4, 0x03, 0xDC, 0x03, 0xFF} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xD5, 0x00, 0x8F, 0x00, 0xC1, 0x00, 0xF0, 0x01,
+			0x0D, 0x01, 0x24, 0x01, 0x41, 0x01, 0x63, 0x01,
+			0x91} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xD6, 0x01, 0xB4, 0x01, 0xE9, 0x02, 0x12, 0x02,
+			0x57, 0x02, 0x8B, 0x02, 0x8D, 0x02, 0xBD, 0x02,
+			0xF5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xD7, 0x03, 0x19, 0x03, 0x46, 0x03, 0x63, 0x03,
+			0x88, 0x03, 0x9C, 0x03, 0xB6, 0x03, 0xC8, 0x03,
+			0xD5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xD8, 0x03, 0xDC, 0x03, 0xFF} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xD9, 0x00, 0x8F, 0x00, 0xC1, 0x00, 0xF0, 0x01,
+			0x0D, 0x01, 0x24, 0x01, 0x41, 0x01, 0x63, 0x01,
+			0x91} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xDD, 0x01, 0xB4, 0x01, 0xE9, 0x02, 0x12, 0x02,
+			0x57, 0x02, 0x8B, 0x02, 0x8D, 0x02, 0xBD, 0x02,
+			0xF5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xDE, 0x03, 0x19, 0x03, 0x46, 0x03, 0x63, 0x03,
+			0x88, 0x03, 0x9C, 0x03, 0xB6, 0x03, 0xC8, 0x03,
+			0xD5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xDF, 0x03, 0xDC, 0x03, 0xFF} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xE0, 0x00, 0x8F, 0x00, 0xC1, 0x00, 0xF0, 0x01,
+			0x0D, 0x01, 0x24, 0x01, 0x41, 0x01, 0x63, 0x01,
+			0x91} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xE1, 0x01, 0xB4, 0x01, 0xE9, 0x02, 0x12, 0x02,
+			0x57, 0x02, 0x8B, 0x02, 0x8D, 0x02, 0xBD, 0x02,
+			0xF5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xE2, 0x03, 0x19, 0x03, 0x46, 0x03, 0x63, 0x03,
+			0x88, 0x03, 0x9C, 0x03, 0xB6, 0x03, 0xC8, 0x03,
+			0xD5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xE3, 0x03, 0xDC, 0x03, 0xFF} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xE4, 0x00, 0x8F, 0x00, 0xC1, 0x00, 0xF0, 0x01,
+			0x0D, 0x01, 0x24, 0x01, 0x41, 0x01, 0x63, 0x01,
+			0x91} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xE5, 0x01, 0xB4, 0x01, 0xE9, 0x02, 0x12, 0x02,
+			0x57, 0x02, 0x8B, 0x02, 0x8D, 0x02, 0xBD, 0x02,
+			0xF5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xE6, 0x03, 0x19, 0x03, 0x46, 0x03, 0x63, 0x03,
+			0x88, 0x03, 0x9C, 0x03, 0xB6, 0x03, 0xC8, 0x03,
+			0xD5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xE7, 0x03, 0xDC, 0x03, 0xFF} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xE8, 0x00, 0x8F, 0x00, 0xC1, 0x00, 0xF0, 0x01,
+			0x0D, 0x01, 0x24, 0x01, 0x41, 0x01, 0x63, 0x01,
+			0x91} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xE9, 0x01, 0xB4, 0x01, 0xE9, 0x02, 0x12, 0x02,
+			0x57, 0x02, 0x8B, 0x02, 0x8D, 0x02, 0xBD, 0x02,
+			0xF5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		17, (char[]){0xEA, 0x03, 0x19, 0x03, 0x46, 0x03, 0x63, 0x03,
+			0x88, 0x03, 0x9C, 0x03, 0xB6, 0x03, 0xC8, 0x03,
+			0xD5} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 5,
+		5, (char[]){0xEB, 0x03, 0xDC, 0x03, 0xFF} } ,
+
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x00, 0x00} } ,
+
+	{DTYPE_DCS_WRITE, 1, 0, 0, 120,
+		sizeof(exit_sleep), exit_sleep},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(enable_te), enable_te},
+	/*
+	   {DTYPE_DCS_WRITE, 1, 0, 0, 40,
+	   sizeof(display_on), display_on},
+	   */
+	{DTYPE_MAX_PKTSIZE, 1, 0, 0, 0,
+		sizeof(max_pktsize), max_pktsize},
+	/*
+	   {DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+	   sizeof(led_pwm1), led_pwm1},
+	   */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm3), led_pwm3},
+};
+
+static struct dsi_cmd_desc novatek_c3_cmd_on_cmds[] = {
+	/* added by our own */
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10,
+		sizeof(sw_reset), sw_reset},
+
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x08, 0x00} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		ARRAY_SIZE(novatek_e0), novatek_e0},/* PWM frequency = 13kHz */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x08, 0x01} } ,
+
+	{DTYPE_DCS_WRITE, 1, 0, 0, 120,
+		sizeof(exit_sleep), exit_sleep},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(enable_te), enable_te},
+	/*
+	   {DTYPE_DCS_WRITE, 1, 0, 0, 40,
+	   sizeof(display_on), display_on},
+	   */
+	{DTYPE_MAX_PKTSIZE, 1, 0, 0, 0,
+		sizeof(max_pktsize), max_pktsize},
+	/*
+	   {DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+	   sizeof(led_pwm1), led_pwm1},
+	   */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm3), led_pwm3},
+};
+
+static struct dsi_cmd_desc lg_novatek_cmd_on_cmds[] = {
+	/* added by our own */
+	{DTYPE_DCS_WRITE, 1, 0, 0, 30,
+		sizeof(sw_reset), sw_reset},
+
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xFF, 0xAA, 0x55, 0x25, 0x01} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		8, (char[]){0xF3, 0x02, 0x03, 0x07,
+			0x15, 0x88, 0xD1, 0x0D} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xFF, 0xAA, 0x55, 0x25, 0x00} } ,
+	/* page 0 */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x08, 0x00} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xB8, 0x01, 0x02, 0x02, 0x02} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		7, (char[]){0xC9, 0x63, 0x06, 0x0D, 0x1A, 0x17, 0x00} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		ARRAY_SIZE(novatek_e0), novatek_e0},/* PWM frequency = 13kHz */
+	/* page 1 */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 1,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x08, 0x01} },/* select page 1 */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB0, 0x05, 0x05, 0x05} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB1, 0x05, 0x05, 0x05} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB2, 0x01, 0x01, 0x01} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB3, 0x0E, 0x0E, 0x0E} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB4, 0x08, 0x08, 0x08} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB6, 0x44, 0x44, 0x44} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB7, 0x34, 0x34, 0x34} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB8, 0x10, 0x10, 0x10} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB9, 0x26, 0x26, 0x26} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xBA, 0x34, 0x34, 0x34} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xBC, 0x00, 0xC8, 0x00} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xBD, 0x00, 0xC8, 0x00} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		3, (char[]){0xC0, 0x01, 0x03} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		4, (char[]){0xCA, 0x00, 0x15, 0x80} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xD0, 0x0A, 0x10, 0x0D, 0x0F} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_d1), fir_lg_gamma22_01_d1 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_d5), fir_lg_gamma22_01_d5 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_d9), fir_lg_gamma22_01_d9 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_e0), fir_lg_gamma22_01_e0 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_e4), fir_lg_gamma22_01_e4 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_e8), fir_lg_gamma22_01_e8 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_d2), fir_lg_gamma22_02_d2 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_d6), fir_lg_gamma22_02_d6 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_dd), fir_lg_gamma22_02_dd },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_e1), fir_lg_gamma22_02_e1 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_e5), fir_lg_gamma22_02_e5 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_e9), fir_lg_gamma22_02_e9 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_d3), fir_lg_gamma22_03_d3 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_d7), fir_lg_gamma22_03_d7 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_de), fir_lg_gamma22_03_de },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_e2), fir_lg_gamma22_03_e2 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_e6), fir_lg_gamma22_03_e6 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_ea), fir_lg_gamma22_03_ea },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_d4), fir_lg_gamma22_04_d4 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_d8), fir_lg_gamma22_04_d8 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_df), fir_lg_gamma22_04_df },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_e3), fir_lg_gamma22_04_e3 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_e7), fir_lg_gamma22_04_e7 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_eb), fir_lg_gamma22_04_eb },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x00, 0x00} },/* select page 0 */
+	{DTYPE_DCS_WRITE, 1, 0, 0, 120,
+		sizeof(exit_sleep), exit_sleep},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(enable_te), enable_te},
+	/*
+	   {DTYPE_DCS_WRITE, 1, 0, 0, 40,
+	   sizeof(display_on), display_on},
+	   */
+	{DTYPE_MAX_PKTSIZE, 1, 0, 0, 0,
+		sizeof(max_pktsize), max_pktsize},
+	/*
+	   {DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+	   sizeof(led_pwm1), led_pwm1},
+	   */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm3), led_pwm3},
+};
+
+static struct dsi_cmd_desc lg_novatek_c2_cmd_on_cmds[] = {
+	/* added by our own */
+	{DTYPE_DCS_WRITE, 1, 0, 0, 30,
+		sizeof(sw_reset), sw_reset},
+
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xFF, 0xAA, 0x55, 0x25, 0x01} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		8, (char[]){0xF3, 0x02, 0x03, 0x07,
+			0x45, 0x88, 0xD1, 0x0D} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xD0, 0x0A, 0x10, 0x0D, 0x0F} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_d1), fir_lg_gamma22_01_d1 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_d5), fir_lg_gamma22_01_d5 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_d9), fir_lg_gamma22_01_d9 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_e0), fir_lg_gamma22_01_e0 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_e4), fir_lg_gamma22_01_e4 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_e8), fir_lg_gamma22_01_e8 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_d2), fir_lg_gamma22_02_d2 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_d6), fir_lg_gamma22_02_d6 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_dd), fir_lg_gamma22_02_dd },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_e1), fir_lg_gamma22_02_e1 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_e5), fir_lg_gamma22_02_e5 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_e9), fir_lg_gamma22_02_e9 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_d3), fir_lg_gamma22_03_d3 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_d7), fir_lg_gamma22_03_d7 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_de), fir_lg_gamma22_03_de },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_e2), fir_lg_gamma22_03_e2 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_e6), fir_lg_gamma22_03_e6 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_ea), fir_lg_gamma22_03_ea },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_d4), fir_lg_gamma22_04_d4 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_d8), fir_lg_gamma22_04_d8 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_df), fir_lg_gamma22_04_df },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_e3), fir_lg_gamma22_04_e3 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_e7), fir_lg_gamma22_04_e7 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_eb), fir_lg_gamma22_04_eb },
+	{DTYPE_DCS_WRITE, 1, 0, 0, 120,
+		sizeof(exit_sleep), exit_sleep},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(enable_te), enable_te},
+	/*	{DTYPE_DCS_WRITE, 1, 0, 0, 40,
+		sizeof(display_on), display_on},*/
+	{DTYPE_MAX_PKTSIZE, 1, 0, 0, 0,
+		sizeof(max_pktsize), max_pktsize},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm3), led_pwm3},
+};
+
+static struct dsi_cmd_desc lg_novatek_mp_cmd_on_cmds[] = {
+	/* added by our own */
+	{DTYPE_DCS_WRITE, 1, 0, 0, 30,
+		sizeof(sw_reset), sw_reset},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(enable_te), enable_te},
+
+	/* page 1 */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 1,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x08, 0x01} },/* select page 1 */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 1,
+		5, (char[]){0xD0, 0x09, 0x10, 0x0C, 0x0F} },/* Grandient Control */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_d1), fir_lg_gamma22_01_d1 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_d5), fir_lg_gamma22_01_d5 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_d9), fir_lg_gamma22_01_d9 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_e0), fir_lg_gamma22_01_e0 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_e4), fir_lg_gamma22_01_e4 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_01_e8), fir_lg_gamma22_01_e8 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_d2), fir_lg_gamma22_02_d2 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_d6), fir_lg_gamma22_02_d6 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_dd), fir_lg_gamma22_02_dd },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_e1), fir_lg_gamma22_02_e1 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_e5), fir_lg_gamma22_02_e5 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_02_e9), fir_lg_gamma22_02_e9 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_d3), fir_lg_gamma22_03_d3 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_d7), fir_lg_gamma22_03_d7 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_de), fir_lg_gamma22_03_de },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_e2), fir_lg_gamma22_03_e2 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_e6), fir_lg_gamma22_03_e6 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_03_ea), fir_lg_gamma22_03_ea },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_d4), fir_lg_gamma22_04_d4 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_d8), fir_lg_gamma22_04_d8 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_df), fir_lg_gamma22_04_df },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_e3), fir_lg_gamma22_04_e3 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_e7), fir_lg_gamma22_04_e7 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma22_04_eb), fir_lg_gamma22_04_eb },
+
+	{DTYPE_DCS_WRITE, 1, 0, 0, 120,
+		sizeof(exit_sleep), exit_sleep},
+	/*
+	   {DTYPE_DCS_WRITE, 1, 0, 0, 40,
+	   sizeof(display_on), display_on},
+	   */
+	{DTYPE_MAX_PKTSIZE, 1, 0, 0, 0,
+		sizeof(max_pktsize), max_pktsize},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm3), led_pwm3},
+};
+
+static unsigned char pwm_freq_sel_cmds1[] = {0x00, 0xB4}; /* address shift to pwm_freq_sel */
+static unsigned char pwm_freq_sel_cmds2[] = {0xC6, 0x00}; /* CABC command with parameter 0 */
+
+static unsigned char pwm_dbf_cmds1[] = {0x00, 0xB1}; /* address shift to PWM DBF */
+static unsigned char pwm_dbf_cmds2[] = {0xC6, 0x04}; /* CABC command-- DBF: [2:1], force duty: [0] */
+
+/* disable video mdoe */
+static unsigned char no_video_mode1[] = {0x00, 0x93};
+static unsigned char no_video_mode2[] = {0xB0, 0xB7};
+/* disable TE wait VSYNC */
+static unsigned char no_wait_te1[] = {0x00, 0xA0};
+static unsigned char no_wait_te2[] = {0xC1, 0x00};
+
+static char set_tear_line[] = {0x44, 0x01, 0x68};/* DTYPE_DCS_LWRITE 0x01, 0x68: 3/8 of QHD screen*/
+
+static unsigned char sony_orise9608a_001[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_002[] = {
+	0xFF, 0x96, 0x08, 0x01,
+}; /* DTYPE_DCS_LWRITE*/
+
+static unsigned char sony_orise9608a_003[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_004[] = {
+	0xFF, 0x96, 0x08,
+}; /* DTYPE_DCS_LWRITE */
+
+static unsigned char sony_orise9608a_005[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_006[] = {0xA0, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_007[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_008[] = {
+	0xB3, 0x00, 0x00, 0x00,
+	0x21, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_009[] = {0x00, 0x92}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_010[] = {0xB3, 0x01}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_011[] = {0x00, 0xC0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_012[] = {0xB3, 0x11}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_013[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_014[] = {
+	0xC0, 0x00, 0x4A, 0x00,
+	0x0A, 0x0A, 0x00, 0x4A,
+	0x0A, 0x0A,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_015[] = {0x00, 0x92}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_016[] = {
+	0xC0, 0x00, 0x06, 0x00,
+	0x09,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_017[] = {0x00, 0xA2}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_018[] = {
+	0xC0, 0x00, 0x10, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_019[] = {0x00, 0xB3}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_020[] = {
+	0xC0, 0x00, 0x50,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_021[] = {0x00, 0x81}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_022[] = {0xC1, 0x55}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_023[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_024[] = {
+	0xC4, 0x00, 0x87,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_025[] = {0x00, 0xA0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_026[] = {
+	0xC4, 0x33, 0x09, 0x90,
+	0x2B, 0x33, 0x09, 0x90,
+	0x54,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_027[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_028[] = {
+	0xC5, 0x08, 0x00, 0xA0,
+	0x11,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_029[] = {0x00, 0x90}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_030[] = {
+	0xC5, 0x96, 0x81, 0x06,
+	0x81, 0x33, 0x33, 0x34,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_031[] = {0x00, 0xA0}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_032[] = {
+	0xC5, 0x96, 0x81, 0x06,
+	0x81, 0x33, 0x33, 0x34,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_033[] = {0x00, 0xB0}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_034[] = {
+	0xC5, 0x04, 0xA8,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_035[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_036[] = {0xC6, 0x64}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_037[] = {0x00, 0xB0}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_038[] = {
+	0xC6, 0x03, 0x09, 0x00,
+	0x1F, 0x12,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_039[] = {0x00, 0xE1}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_040[] = {0xC0, 0x96}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_041[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_042[] = {0xD0, 0x02}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_043[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_044[] = {
+	0xD1, 0x01, 0x01,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_045[] = {0x00, 0xB7}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_046[] = {0xB0, 0x10}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_047[] = {0x00, 0xC0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_048[] = {0xB0, 0x55}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_049[] = {0x00, 0xB1}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_050[] = {0xB0, 0x03}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_051[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_052[] = {
+	0xCB, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_053[] = {0x00, 0x90}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_054[] = {
+	0xCB, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_055[] = {0x00, 0xA0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_056[] = {
+	0xCB, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_057[] = {0x00, 0xB0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_058[] = {
+	0xCB, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xAA,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_059[] = {0x00, 0xC0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_060[] = {
+	0xCB, 0xA6, 0xA6, 0xA6,
+	0xA6, 0xA6, 0xA6, 0xAA,
+	0xAA, 0xA6, 0xA6, 0xA6,
+	0xA6, 0xA2, 0xA2, 0xA2,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_061[] = {0x00, 0xD0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_062[] = {
+	0xCB, 0xA2, 0xAA, 0xAA,
+	0xAA, 0xAA, 0xA6, 0xA6,
+	0xA6, 0xA6, 0xA6, 0xA6,
+	0xAA, 0xAA, 0xA6, 0xA6,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_063[] = {0x00, 0xE0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_064[] = {
+	0xCB, 0xA6, 0xA6, 0xA2,
+	0xA2, 0xA2, 0xA2, 0xAA,
+	0xAA, 0xAA, 0xAA,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_065[] = {0x00, 0xF0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_066[] = {
+	0xCB, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFF, 0xFF,
+	0xFF, 0xFF, 0xFF,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_067[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_068[] = {
+	0xCC, 0x00, 0x00, 0x25,
+	0x26, 0x02, 0x06, 0x00,
+	0x00, 0x0A, 0x0C,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_069[] = {0x00, 0x90}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_070[] = {
+	0xCC, 0x0E, 0x10, 0x12,
+	0x14, 0x16, 0x18, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x25, 0x26, 0x01,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_071[] = {0x00, 0xA0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_072[] = {
+	0xCC, 0x05, 0x00, 0x00,
+	0x09, 0x0B, 0x0D, 0x0F,
+	0x11, 0x13, 0x15, 0x17,
+	0x00, 0x00, 0x00, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_073[] = {0x00, 0xB0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_074[] = {
+	0xCC, 0x00, 0x00, 0x25,
+	0x26, 0x05, 0x01, 0x00,
+	0x00, 0x0F, 0x0D,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_075[] = {0x00, 0xC0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_076[] = {
+	0xCC, 0x0B, 0x09, 0x17,
+	0x15, 0x13, 0x11, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x25, 0x26, 0x06,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_077[] = {0x00, 0xD0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_078[] = {
+	0xCC, 0x02, 0x00, 0x00,
+	0x10, 0x0E, 0x0C, 0x0A,
+	0x18, 0x16, 0x14, 0x12,
+	0x00, 0x00, 0x00, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_079[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_080[] = {
+	0xCE, 0x86, 0x03, 0x18,
+	0x85, 0x03, 0x18, 0x00,
+	0x0F, 0x00, 0x00, 0x0F,
+	0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_081[] = {0x00, 0x90}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_082[] = {
+	0xCE, 0x33, 0xBF, 0x18,
+	0x33, 0xC0, 0x18, 0xF0,
+	0x00, 0x00, 0xF0, 0x00,
+	0x00, 0x00, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_083[] = {0x00, 0xA0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_084[] = {
+	0xCE, 0x38, 0x02, 0x83,
+	0xC1, 0x86, 0x18, 0x00,
+	0x38, 0x01, 0x83, 0xC2,
+	0x85, 0x18, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_085[] = {0x00, 0xB0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_086[] = {
+	0xCE, 0x30, 0x01, 0x83,
+	0xC5, 0x86, 0x18, 0x00,
+	0x30, 0x02, 0x83, 0xC6,
+	0x85, 0x18, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_087[] = {0x00, 0xC0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_088[] = {
+	0xCE, 0x38, 0x00, 0x83,
+	0xC3, 0x86, 0x18, 0x00,
+	0x30, 0x00, 0x83, 0xC4,
+	0x85, 0x18, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_089[] = {0x00, 0xD0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_090[] = {
+	0xCE, 0x30, 0x03, 0x83,
+	0xC7, 0x86, 0x18, 0x00,
+	0x30, 0x04, 0x83, 0xC8,
+	0x85, 0x18, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_091[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_092[] = {
+	0xCF, 0xF0, 0x00, 0x00,
+	0x10, 0x00, 0x00, 0x00,
+	0xF0, 0x00, 0x00, 0x10,
+	0x00, 0x00, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_093[] = {0x00, 0x90}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_094[] = {
+	0xCF, 0xF0, 0x00, 0x00,
+	0x10, 0x00, 0x00, 0x00,
+	0xF0, 0x00, 0x00, 0x10,
+	0x00, 0x00, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_095[] = {0x00, 0xA0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_096[] = {
+	0xCF, 0xF0, 0x00, 0x00,
+	0x10, 0x00, 0x00, 0x00,
+	0xF0, 0x00, 0x00, 0x10,
+	0x00, 0x00, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_097[] = {0x00, 0xB0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_098[] = {
+	0xCF, 0xF0, 0x00, 0x00,
+	0x10, 0x00, 0x00, 0x00,
+	0xF0, 0x00, 0x00, 0x10,
+	0x00, 0x00, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_099[] = {0x00, 0xC0}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_100[] = {
+	0xCF, 0x01, 0x01, 0x10,
+	0x10, 0x00, 0x00, 0x02,
+	0x01, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_101[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_102[] = {0xD6, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_103[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 : address shift*/
+static unsigned char sony_orise9608a_104[] = {
+	0xD7, 0x00, 0xD8, 0x1F,
+	0x1F, 0xD9, 0x24,
+}; /* DTYPE_DCS_LWRITE */
+
+static unsigned char sony_gamma22_00[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_gamma22_01[] = {
+	0xe1, 0x09, 0x10, 0x15,
+	0x0E, 0x07, 0x0E, 0x0B,
+	0x09, 0x04, 0x08, 0x0D,
+	0x08, 0x0E, 0x13, 0x0D,
+	0x08,
+	/*	0xe1, 0xff, 0xff, 0xff,
+		0xff, 0xff, 0xff, 0xff,
+		0xff, 0xff, 0xff, 0xff,
+		0xff, 0xff, 0xff, 0xff,
+		0x08,*/
+}; /* DTYPE_DCS_LWRITE :0xE100:0x11, 0xE101:0x19, 0xE102: 0x1e, ..., 0xff are padding for 4 bytes*/
+
+static unsigned char sony_gamma22_02[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_gamma22_03[] = {
+	0xe2, 0x09, 0x10, 0x15,
+	0x0E, 0x07, 0x0E, 0x0B,
+	0x09, 0x04, 0x08, 0x0D,
+	0x08, 0x0E, 0x13, 0x0D,
+	0x08,
+}; /* DTYPE_DCS_LWRITE :0xE200:0x11, 0xE201:0x19, 0xE202: 0x1e, ..., 0xff are padding for 4 bytes*/
+
+static unsigned char sony_gamma22_04[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_gamma22_05[] = {
+	0xec, 0x40, 0x43, 0x43,
+	0x44, 0x44, 0x44, 0x44,
+	0x44, 0x44, 0x43, 0x34,
+	0x44, 0x44, 0x44, 0x34,
+	0x44, 0x34, 0x44, 0x44,
+	0x44, 0x44, 0x44, 0x44,
+	0x34, 0x44, 0x43, 0x44,
+	0x44, 0x44, 0x44, 0x34,
+	0x44, 0x44, 0x00,
+}; /* DTYPE_DCS_LWRITE */
+
+static unsigned char sony_gamma22_06[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_gamma22_07[] = {
+	0xed, 0x40, 0x43, 0x44,
+	0x44, 0x44, 0x44, 0x44,
+	0x44, 0x44, 0x43, 0x34,
+	0x44, 0x44, 0x44, 0x34,
+	0x44, 0x34, 0x44, 0x44,
+	0x44, 0x44, 0x44, 0x44,
+	0x34, 0x44, 0x43, 0x44,
+	0x44, 0x44, 0x44, 0x34,
+	0x44, 0x44, 0x00,
+}; /* DTYPE_DCS_LWRITE :0xE200:0x11, 0xE201:0x19, 0xE202: 0x1e, ..., 0xff are padding for 4 bytes*/
+
+static unsigned char sony_gamma22_08[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_gamma22_09[] = {
+	0xee, 0x40, 0x43, 0x44,
+	0x44, 0x54, 0x44, 0x45,
+	0x44, 0x45, 0x44, 0x44,
+	0x44, 0x44, 0x44, 0x45,
+	0x44, 0x44, 0x44, 0x44,
+	0x54, 0x44, 0x44, 0x44,
+	0x43, 0x44, 0x44, 0x44,
+	0x44, 0x44, 0x43, 0x34,
+	0x34, 0x44, 0x00,
+}; /* DTYPE_DCS_LWRITE :0xE200:0x11, 0xE201:0x19, 0xE202: 0x1e, ..., 0xff are padding for 4 bytes*/
+
+static unsigned char sony_cabc_00[] = {0x00, 0x80}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_01[] = {
+	0xca, 0x01, 0x8e, 0x95,
+	0x9d, 0xa4, 0xab, 0xb2,
+	0xba, 0xc1, 0xc8, 0xcf,
+	0xd7, 0xde, 0xe5, 0xec,
+	0xec, 0xe8, 0xff, 0x87,
+	0xff, 0x87, 0xff, 0x05,
+	0x03, 0x05, 0x03, 0x05,
+	0x03,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_02[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_03[] = {0xC7, 0x10}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_04[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_05[] = {
+	0xc8, 0x90, 0xa9, 0xaa,
+	0xaa, 0xaa, 0xaa, 0xaa,
+	0xaa, 0x99, 0x88, 0x88,
+	0x88, 0x77, 0x66, 0x55,
+	0x55, 0x55, 0x55,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_06[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_07[] = {0xC7, 0x11}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_08[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_09[] = {
+	0xc8, 0x90, 0x99, 0xaa,
+	0xaa, 0xaa, 0xaa, 0xaa,
+	0x9a, 0x99, 0x88, 0x88,
+	0x88, 0x77, 0x66, 0x66,
+	0x55, 0x55, 0x55,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_10[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_11[] = {0xC7, 0x12}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_12[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_13[] = {
+	0xc8, 0x90, 0x99, 0xa9,
+	0xaa, 0xaa, 0xaa, 0xaa,
+	0x99, 0x99, 0x88, 0x88,
+	0x88, 0x77, 0x66, 0x66,
+	0x66, 0x55, 0x55,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_14[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_15[] = {0xC7, 0x13}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_16[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_17[] = {
+	0xc8, 0x90, 0x99, 0x99,
+	0xaa, 0xaa, 0xaa, 0x9a,
+	0x99, 0x99, 0x88, 0x88,
+	0x88, 0x77, 0x66, 0x66,
+	0x66, 0x66, 0x55,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_18[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_19[] = {0xC7, 0x14}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_20[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_21[] = {
+	0xc8, 0x90, 0x99, 0x99,
+	0xa9, 0xaa, 0xaa, 0x99,
+	0x99, 0x99, 0x88, 0x88,
+	0x88, 0x77, 0x66, 0x66,
+	0x66, 0x66, 0x66,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_22[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_23[] = {0xC7, 0x15}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_24[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_25[] = {
+	0xc8, 0x90, 0x99, 0x99,
+	0x99, 0xaa, 0x9a, 0x99,
+	0x99, 0x99, 0x88, 0x88,
+	0x88, 0x77, 0x77, 0x66,
+	0x66, 0x66, 0x66,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_26[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_27[] = {0xC7, 0x16}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_28[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_29[] = {
+	0xc8, 0x90, 0x99, 0x99,
+	0x99, 0xa9, 0x99, 0x99,
+	0x99, 0x99, 0x88, 0x88,
+	0x88, 0x77, 0x77, 0x77,
+	0x66, 0x66, 0x66,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_30[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_31[] = {0xC7, 0x17}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_32[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_33[] = {
+	0xc8, 0x80, 0x99, 0x99,
+	0x99, 0x99, 0x99, 0x99,
+	0x99, 0x99, 0x88, 0x88,
+	0x88, 0x77, 0x77, 0x77,
+	0x77, 0x66, 0x66,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_34[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_35[] = {0xC7, 0x18}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_36[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_37[] = {
+	0xc8, 0x80, 0x98, 0x99,
+	0x99, 0x99, 0x98, 0x99,
+	0x99, 0x99, 0x88, 0x88,
+	0x88, 0x77, 0x77, 0x77,
+	0x77, 0x77, 0x66,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_38[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_39[] = {0xC7, 0x19}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_40[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_41[] = {
+	0xc8, 0x80, 0x88, 0x99,
+	0x99, 0x99, 0x88, 0x99,
+	0x99, 0x99, 0x88, 0x88,
+	0x88, 0x77, 0x77, 0x77,
+	0x77, 0x77, 0x77,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_42[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_43[] = {0xC7, 0x1A}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_44[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_45[] = {
+	0xc8, 0x80, 0x88, 0x98,
+	0x99, 0x99, 0x88, 0x98,
+	0x99, 0x99, 0x88, 0x88,
+	0x88, 0x88, 0x77, 0x77,
+	0x77, 0x77, 0x77,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_46[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_47[] = {0xC7, 0x1B}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_48[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_49[] = {
+	0xc8, 0x80, 0x88, 0x88,
+	0x99, 0x99, 0x88, 0x88,
+	0x99, 0x99, 0x88, 0x88,
+	0x88, 0x88, 0x88, 0x77,
+	0x77, 0x77, 0x77,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_50[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_51[] = {0xC7, 0x1C}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_52[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_53[] = {
+	0xc8, 0x80, 0x88, 0x88,
+	0x98, 0x99, 0x88, 0x88,
+	0x98, 0x99, 0x88, 0x88,
+	0x88, 0x88, 0x88, 0x88,
+	0x77, 0x77, 0x77,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_54[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_55[] = {0xC7, 0x1D}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_56[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 :address shift*/
+static unsigned char sony_cabc_57[] = {
+	0xc8, 0x80, 0x88, 0x88,
+	0x88, 0x99, 0x88, 0x88,
+	0x88, 0x99, 0x88, 0x88,
+	0x88, 0x88, 0x88, 0x88,
+	0x88, 0x77, 0x77,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_cabc_58[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_cabc_59[] = {0xC7, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_105[] = {0x00, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_106[] = {
+	0xFF, 0xFF, 0xFF, 0xFF,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_107[] = {
+	0x2A, 0x00, 0x00, 0x02,
+	0x1B,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_108[] = {
+	0x2B, 0x00, 0x00, 0x03,
+	0xBF,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_109[] = {0x36, 0x00}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_110[] = {0x3A, 0x77}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_111[] = {
+	0x44, 0x01, 0x68,
+}; /* DTYPE_DCS_LWRITE */
+static unsigned char sony_orise9608a_112[] = {0x35, 0x00};
+
+static unsigned char sony_orise9608a_eot_eotp_1[] = {0x00, 0xB7}; /* DTYPE_DCS_WRITE1 */
+static unsigned char sony_orise9608a_eot_eotp_2[] = {0xB0, 0x10}; /* DTYPE_DCS_WRITE1 */
+
+static struct dsi_cmd_desc sony_orise9608a_mp_panel_cmd_mode_cmds[] = {
+
+	/* set driver ic to organize both EOT and EOTP */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_002), sony_orise9608a_002},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_003), sony_orise9608a_003},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_004), sony_orise9608a_004},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_eot_eotp_1), sony_orise9608a_eot_eotp_1},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_eot_eotp_2), sony_orise9608a_eot_eotp_2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_105), sony_orise9608a_105},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_106), sony_orise9608a_106},
+
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_107), sony_orise9608a_107},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_108), sony_orise9608a_108},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_109), sony_orise9608a_109},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_110), sony_orise9608a_110},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_111), sony_orise9608a_111},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 10, sizeof(sony_orise9608a_112), sony_orise9608a_112},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 100,
+		sizeof(exit_sleep), exit_sleep},
+	/*	{DTYPE_DCS_WRITE, 1, 0, 0, 40,
+		sizeof(display_on), display_on},*/
+	{DTYPE_MAX_PKTSIZE, 1, 0, 0, 0,
+		sizeof(max_pktsize), max_pktsize},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm3), led_pwm3},
+};
+
+static struct dsi_cmd_desc sony_orise9608a_c1_1_panel_cmd_mode_cmds[] = {
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_002), sony_orise9608a_002},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_003), sony_orise9608a_003},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_004), sony_orise9608a_004},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_eot_eotp_1), sony_orise9608a_eot_eotp_1},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_eot_eotp_2), sony_orise9608a_eot_eotp_2},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_gamma22_00), sony_gamma22_00},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_gamma22_01), sony_gamma22_01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_gamma22_02), sony_gamma22_02},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_gamma22_03), sony_gamma22_03},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_gamma22_04), sony_gamma22_04},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_gamma22_05), sony_gamma22_05},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_gamma22_06), sony_gamma22_06},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_gamma22_07), sony_gamma22_07},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_gamma22_08), sony_gamma22_08},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_gamma22_09), sony_gamma22_09},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_105), sony_orise9608a_105},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_106), sony_orise9608a_106},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_107), sony_orise9608a_107},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_108), sony_orise9608a_108},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_109), sony_orise9608a_109},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_110), sony_orise9608a_110},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_111), sony_orise9608a_111},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 10, sizeof(sony_orise9608a_112), sony_orise9608a_112},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 100,
+		sizeof(exit_sleep), exit_sleep},
+	/*
+	   {DTYPE_DCS_WRITE, 1, 0, 0, 40,
+	   sizeof(display_on), display_on},
+	   */
+	{DTYPE_MAX_PKTSIZE, 1, 0, 0, 0,
+		sizeof(max_pktsize), max_pktsize},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm3), led_pwm3},
+};
+
+static struct dsi_cmd_desc sony_orise9608a_panel_cmd_mode_cmds[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_001), sony_orise9608a_001},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_002), sony_orise9608a_002},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_003), sony_orise9608a_003},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_004), sony_orise9608a_004},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_005), sony_orise9608a_005},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_006), sony_orise9608a_006},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_007), sony_orise9608a_007},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_008), sony_orise9608a_008},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_009), sony_orise9608a_009},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_010), sony_orise9608a_010},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_011), sony_orise9608a_011},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_012), sony_orise9608a_012},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_013), sony_orise9608a_013},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_014), sony_orise9608a_014},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_015), sony_orise9608a_015},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_016), sony_orise9608a_016},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_017), sony_orise9608a_017},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_018), sony_orise9608a_018},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_019), sony_orise9608a_019},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_020), sony_orise9608a_020},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_021), sony_orise9608a_021},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_022), sony_orise9608a_022},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_023), sony_orise9608a_023},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_024), sony_orise9608a_024},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_025), sony_orise9608a_025},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_026), sony_orise9608a_026},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_027), sony_orise9608a_027},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_028), sony_orise9608a_028},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_029), sony_orise9608a_029},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_030), sony_orise9608a_030},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_031), sony_orise9608a_031},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_032), sony_orise9608a_032},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_033), sony_orise9608a_033},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_034), sony_orise9608a_034},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_035), sony_orise9608a_035},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_036), sony_orise9608a_036},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_037), sony_orise9608a_037},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_038), sony_orise9608a_038},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_039), sony_orise9608a_039},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_040), sony_orise9608a_040},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_041), sony_orise9608a_041},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_042), sony_orise9608a_042},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_043), sony_orise9608a_043},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_044), sony_orise9608a_044},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_045), sony_orise9608a_045},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_046), sony_orise9608a_046},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_047), sony_orise9608a_047},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_048), sony_orise9608a_048},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_049), sony_orise9608a_049},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_050), sony_orise9608a_050},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_051), sony_orise9608a_051},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_052), sony_orise9608a_052},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_053), sony_orise9608a_053},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_054), sony_orise9608a_054},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_055), sony_orise9608a_055},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_056), sony_orise9608a_056},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_057), sony_orise9608a_057},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_058), sony_orise9608a_058},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_059), sony_orise9608a_059},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_060), sony_orise9608a_060},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_061), sony_orise9608a_061},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_062), sony_orise9608a_062},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_063), sony_orise9608a_063},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_064), sony_orise9608a_064},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_065), sony_orise9608a_065},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_066), sony_orise9608a_066},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_067), sony_orise9608a_067},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_068), sony_orise9608a_068},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_069), sony_orise9608a_069},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_070), sony_orise9608a_070},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_071), sony_orise9608a_071},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_072), sony_orise9608a_072},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_073), sony_orise9608a_073},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_074), sony_orise9608a_074},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_075), sony_orise9608a_075},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_076), sony_orise9608a_076},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_077), sony_orise9608a_077},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_078), sony_orise9608a_078},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_079), sony_orise9608a_079},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_080), sony_orise9608a_080},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_081), sony_orise9608a_081},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_082), sony_orise9608a_082},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_083), sony_orise9608a_083},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_084), sony_orise9608a_084},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_085), sony_orise9608a_085},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_086), sony_orise9608a_086},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_087), sony_orise9608a_087},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_088), sony_orise9608a_088},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_089), sony_orise9608a_089},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_090), sony_orise9608a_090},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_091), sony_orise9608a_091},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_092), sony_orise9608a_092},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_093), sony_orise9608a_093},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_094), sony_orise9608a_094},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_095), sony_orise9608a_095},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_096), sony_orise9608a_096},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_097), sony_orise9608a_097},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_098), sony_orise9608a_098},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_099), sony_orise9608a_099},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_100), sony_orise9608a_100},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_101), sony_orise9608a_101},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_102), sony_orise9608a_102},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_103), sony_orise9608a_103},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_104), sony_orise9608a_104},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_gamma22_00), sony_gamma22_00},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_gamma22_01), sony_gamma22_01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_gamma22_02), sony_gamma22_02},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_gamma22_03), sony_gamma22_03},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_gamma22_04), sony_gamma22_04},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_gamma22_05), sony_gamma22_05},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_gamma22_06), sony_gamma22_06},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_gamma22_07), sony_gamma22_07},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_gamma22_08), sony_gamma22_08},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_gamma22_09), sony_gamma22_09},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_00), sony_cabc_00},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_01), sony_cabc_01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_02), sony_cabc_02},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_03), sony_cabc_03},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_04), sony_cabc_04},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_05), sony_cabc_05},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_06), sony_cabc_06},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_07), sony_cabc_07},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_08), sony_cabc_08},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_09), sony_cabc_09},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_10), sony_cabc_10},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_11), sony_cabc_11},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_12), sony_cabc_12},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_13), sony_cabc_13},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_14), sony_cabc_14},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_15), sony_cabc_15},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_16), sony_cabc_16},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_17), sony_cabc_17},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_18), sony_cabc_18},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_19), sony_cabc_19},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_20), sony_cabc_20},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_21), sony_cabc_21},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_22), sony_cabc_22},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_23), sony_cabc_23},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_24), sony_cabc_24},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_25), sony_cabc_25},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_26), sony_cabc_26},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_27), sony_cabc_27},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_28), sony_cabc_28},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_29), sony_cabc_29},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_30), sony_cabc_30},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_31), sony_cabc_31},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_32), sony_cabc_32},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_33), sony_cabc_33},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_34), sony_cabc_34},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_35), sony_cabc_35},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_36), sony_cabc_36},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_37), sony_cabc_37},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_38), sony_cabc_38},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_39), sony_cabc_39},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_40), sony_cabc_40},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_41), sony_cabc_41},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_42), sony_cabc_42},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_43), sony_cabc_43},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_44), sony_cabc_44},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_45), sony_cabc_45},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_46), sony_cabc_46},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_47), sony_cabc_47},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_48), sony_cabc_48},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_49), sony_cabc_49},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_50), sony_cabc_50},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_51), sony_cabc_51},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_52), sony_cabc_52},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_53), sony_cabc_53},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_54), sony_cabc_54},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_55), sony_cabc_55},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_56), sony_cabc_56},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_cabc_57), sony_cabc_57},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_58), sony_cabc_58},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_cabc_59), sony_cabc_59},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_105), sony_orise9608a_105},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_106), sony_orise9608a_106},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_107), sony_orise9608a_107},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(sony_orise9608a_108), sony_orise9608a_108},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_109), sony_orise9608a_109},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sony_orise9608a_110), sony_orise9608a_110},
+
+	{DTYPE_DCS_WRITE, 1, 0, 0, 100, sizeof(exit_sleep), exit_sleep},
+	/* {DTYPE_DCS_WRITE, 1, 0, 0, 0, sizeof(display_on), display_on}, */
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(pwm_freq_sel_cmds1), pwm_freq_sel_cmds1},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(pwm_freq_sel_cmds2), pwm_freq_sel_cmds2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(pwm_dbf_cmds1), pwm_dbf_cmds1},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(pwm_dbf_cmds2), pwm_dbf_cmds2},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(set_tear_line), set_tear_line},
+
+	{DTYPE_MAX_PKTSIZE, 1, 0, 0, 0, sizeof(max_pktsize), max_pktsize},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(no_video_mode1), no_video_mode1},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(no_video_mode2), no_video_mode2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(no_wait_te1), no_wait_te1},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(no_wait_te2), no_wait_te2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(led_pwm3), led_pwm3},
+};
+
+static struct dsi_cmd_desc sony_orise9608a_panel_display_on[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 0, sizeof(display_on), display_on},
+};
+static struct dsi_cmd_desc novatek_panel_display_on[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 40, sizeof(display_on), display_on},
+};
+
+static struct dsi_cmd_desc novatek_display_off_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 1,
+		sizeof(display_off), display_off},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 100,
+		sizeof(enter_sleep), enter_sleep}
+};
+
+static struct dsi_cmd_desc novatek_display_off_lg_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 40,
+		sizeof(display_off), display_off},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 120,
+		sizeof(enter_sleep), enter_sleep}
+};
+
+extern int fighter_panel_first_init;
+static int fighter_send_display_cmds(struct dsi_cmd_desc *cmd, int cnt)
+{
+	int ret = 0;
+#ifdef FIGHTER_USE_CMDLISTS
+	struct dcs_cmd_req cmdreq;
+
+	cmdreq.cmds = cmd;
+	cmdreq.cmds_cnt = cnt;
+	cmdreq.flags = CMD_REQ_COMMIT;
+	cmdreq.rlen = 0;
+	cmdreq.cb = NULL;
+
+	ret = mipi_dsi_cmdlist_put(&cmdreq);
+#else
+
+	MIPI_OUTP(MIPI_DSI_BASE + 0x38, 0x10000000);
+	ret = mipi_dsi_cmds_tx(&fighter_tx_buf, cmd, cnt);
+	MIPI_OUTP(MIPI_DSI_BASE + 0x38, 0x14000000);
+#endif
+	if (ret < 0)
+		printk(KERN_ERR "[DISP] %s failed (%d)\n", __func__, ret);
+	return ret;
+}
+
+static int mipi_fighter_lcd_on(struct platform_device *pdev)
+{
+	struct msm_fb_data_type *mfd;
+	struct mipi_panel_info *mipi;
+
+	printk(KERN_ERR  "[DISP] %s +++\n", __func__);
+	mfd = platform_get_drvdata(pdev);
+	if (!mfd)
+		return -ENODEV;
+	if (mfd->key != MFD_KEY)
+		return -EINVAL;
+
+	mipi  = &mfd->panel_info.mipi;
+
+	if (!fighter_panel_first_init) {
+		if (mipi->mode == DSI_CMD_MODE)
+			fighter_send_display_cmds(cmd_on_cmds, cmd_on_cmds_count);
+		else if (mipi->mode == DSI_VIDEO_MODE)
+			fighter_send_display_cmds(novatek_video_on_cmds,
+					ARRAY_SIZE(novatek_video_on_cmds));
+		fighter_send_display_cmds(display_on_cmds, display_on_cmds_count);
+	}
+	printk(KERN_ERR  "[DISP] %s ---\n", __func__);
+	fighter_panel_first_init = 0;
+	return 0;
+}
+
+static int mipi_fighter_lcd_off(struct platform_device *pdev)
+{
+	struct msm_fb_data_type *mfd;
+	printk(KERN_ERR  "[DISP] %s +++\n", __func__);
+	mfd = platform_get_drvdata(pdev);
+
+	if (!mfd)
+		return -ENODEV;
+	if (mfd->key != MFD_KEY)
+		return -EINVAL;
+
+	if (panel_type != PANEL_ID_NONE)
+		fighter_send_display_cmds(display_off_cmds, display_off_cmds_count);
+
+	return 0;
+}
+
+static unsigned char fighter_shrink_pwm(int val)
+{
+	unsigned char shrink_br = BRI_SETTING_MAX;
+
+	if (val <= 0) {
+		shrink_br = 0;
+	} else if (val > 0 && (val < BRI_SETTING_MIN)) {
+		shrink_br = PWM_MIN;
+	} else if ((val >= BRI_SETTING_MIN) && (val <= BRI_SETTING_DEF)) {
+		shrink_br = (val - BRI_SETTING_MIN) * (PWM_DEFAULT - PWM_MIN) /
+			(BRI_SETTING_DEF - BRI_SETTING_MIN) + PWM_MIN;
+	} else if (val > BRI_SETTING_DEF && val <= BRI_SETTING_MAX) {
+		shrink_br = (val - BRI_SETTING_DEF) * (PWM_MAX - PWM_DEFAULT) /
+			(BRI_SETTING_MAX - BRI_SETTING_DEF) + PWM_DEFAULT;
+	} else if (val > BRI_SETTING_MAX)
+		shrink_br = PWM_MAX;
+
+	printk(KERN_INFO "brightness orig=%d, transformed=%d\n", val, shrink_br);
+
+	return shrink_br;
+}
+
+inline void mipi_dsi_set_backlight(struct msm_fb_data_type *mfd, int level)
+{
+	struct mipi_panel_info *mipi;
+
+	mipi  = &mfd->panel_info.mipi;
+
+	printk(KERN_ERR "[DISP] %s level=%d\n", __func__, level);
+
+	led_pwm1[1] = fighter_shrink_pwm(mfd->bl_level);
+
+	fighter_send_display_cmds(fighter_cmd_backlight_cmds, ARRAY_SIZE(fighter_cmd_backlight_cmds));
+
+	printk(KERN_DEBUG "%s+ bl_level=%d\n", __func__, mfd->bl_level);
+	return;
+}
+
+static void mipi_fighter_set_backlight(struct msm_fb_data_type *mfd)
+{
+	mipi_dsi_set_backlight(mfd, mfd->bl_level);
+
+	cur_bl_level = mfd->bl_level;
+}
+
+static int __devinit mipi_fighter_lcd_probe(struct platform_device *pdev)
+{
+	printk(KERN_ERR "%s: probe ++ %d\n", __func__, panel_type);
+	if (panel_type == PANEL_ID_FIGHTER_SAMSUNG_NT) {
+		printk(KERN_INFO "fighter_lcd_on PANEL_ID_FIGHTER_SAMSUNG_NT\n");
+		cmd_on_cmds = novatek_cmd_on_cmds;
+		cmd_on_cmds_count = ARRAY_SIZE(novatek_cmd_on_cmds);
+	} else if (panel_type == PANEL_ID_FIGHTER_SAMSUNG_NT_C2) {
+		printk(KERN_INFO "fighter_lcd_on PANEL_ID_FIGHTER_SAMSUNG_NT_C2\n");
+		cmd_on_cmds = novatek_c2_cmd_on_cmds;
+		cmd_on_cmds_count = ARRAY_SIZE(novatek_c2_cmd_on_cmds);
+	} else if (panel_type == PANEL_ID_FIGHTER_SAMSUNG_NT_C3) {
+		printk(KERN_INFO "fighter_lcd_on PANEL_ID_FIGHTER_SAMSUNG_NT_C3\n");
+		cmd_on_cmds = novatek_c3_cmd_on_cmds;
+		cmd_on_cmds_count = ARRAY_SIZE(novatek_c3_cmd_on_cmds);
+	} else if (panel_type == PANEL_ID_FIGHTER_LG_NT) {
+		printk(KERN_INFO "fighter_lcd_on PANEL_ID_FIGHTER_LG_NT\n");
+		cmd_on_cmds = lg_novatek_cmd_on_cmds;
+		cmd_on_cmds_count = ARRAY_SIZE(lg_novatek_cmd_on_cmds);
+	} else if (panel_type == PANEL_ID_FIGHTER_LG_NT_C2) {
+		printk(KERN_INFO "fighter_lcd_on PANEL_ID_FIGHTER_LG_NT_C2\n");
+		cmd_on_cmds = lg_novatek_c2_cmd_on_cmds;
+		cmd_on_cmds_count = ARRAY_SIZE(lg_novatek_c2_cmd_on_cmds);
+	} else if (panel_type == PANEL_ID_FIGHTER_LG_NT_MP) {
+		printk(KERN_INFO "fighter_lcd_on PANEL_ID_FIGHTER_LG_NT_MP\n");
+		cmd_on_cmds = lg_novatek_mp_cmd_on_cmds;
+		cmd_on_cmds_count = ARRAY_SIZE(lg_novatek_mp_cmd_on_cmds);
+	} else if (panel_type == PANEL_ID_FIGHTER_SONY_OTM) {
+		printk(KERN_INFO "fighter_lcd_on PANEL_ID_FIGHTER_SONY_OTM\n");
+		cmd_on_cmds = sony_orise9608a_panel_cmd_mode_cmds;
+		cmd_on_cmds_count = ARRAY_SIZE(sony_orise9608a_panel_cmd_mode_cmds);
+	} else if (panel_type == PANEL_ID_FIGHTER_SONY_OTM_C1_1) {
+		printk(KERN_INFO "fighter_lcd_on PANEL_ID_FIGHTER_SONY_OTM_C1_1\n");
+		cmd_on_cmds = sony_orise9608a_c1_1_panel_cmd_mode_cmds;
+		cmd_on_cmds_count = ARRAY_SIZE(sony_orise9608a_c1_1_panel_cmd_mode_cmds);
+	} else if (panel_type == PANEL_ID_FIGHTER_SONY_OTM_MP) {
+		printk(KERN_INFO "fighter_lcd_on PANEL_ID_FIGHTER_SONY_OTM_MP\n");
+		cmd_on_cmds = sony_orise9608a_mp_panel_cmd_mode_cmds;
+		cmd_on_cmds_count = ARRAY_SIZE(sony_orise9608a_mp_panel_cmd_mode_cmds);
+	}
+
+	if (panel_type == PANEL_ID_FIGHTER_SONY_OTM ||
+			panel_type == PANEL_ID_FIGHTER_SONY_OTM_C1_1 ||
+			panel_type == PANEL_ID_FIGHTER_SONY_OTM_MP) {
+		display_on_cmds = sony_orise9608a_panel_display_on;
+		display_on_cmds_count = ARRAY_SIZE(sony_orise9608a_panel_display_on);
+		display_off_cmds = novatek_display_off_cmds;
+		display_off_cmds_count = ARRAY_SIZE(novatek_display_off_cmds);
+	} else {
+		display_on_cmds = novatek_panel_display_on;
+		display_on_cmds_count = ARRAY_SIZE(novatek_panel_display_on);
+		display_off_cmds = novatek_display_off_lg_cmds;
+		display_off_cmds_count = ARRAY_SIZE(novatek_display_off_lg_cmds);
+	}
+
+	if (pdev->id == 0) {
+		mipi_fighter_pdata = pdev->dev.platform_data;
+		return 0;
+	}
+	fighter_panel_first_init = 1;
+	msm_fb_add_device(pdev);
+	return 0;
+}
+
+static struct platform_driver this_driver = {
+	.probe  = mipi_fighter_lcd_probe,
+	.driver = {
+		.name   = "mipi_fighter",
+	},
+};
+
+static struct msm_fb_panel_data fighter_panel_data = {
+	.on		= mipi_fighter_lcd_on,
+	.off		= mipi_fighter_lcd_off,
+	.set_backlight = mipi_fighter_set_backlight,
+};
+
+static int ch_used[3];
+
+int mipi_fighter_device_register(struct msm_panel_info *pinfo,
+		u32 channel, u32 panel)
+{
+	struct platform_device *pdev = NULL;
+	int ret;
+
+	if ((channel >= 3) || ch_used[channel])
+		return -ENODEV;
+
+	ch_used[channel] = TRUE;
+
+	ret = mipi_fighter_lcd_init();
+	if (ret) {
+		pr_err("mipi_fighter_lcd_init() failed with ret %u\n", ret);
+		return ret;
+	}
+
+	pdev = platform_device_alloc("mipi_fighter", (panel << 8)|channel);
+	if (!pdev)
+		return -ENOMEM;
+
+	fighter_panel_data.panel_info = *pinfo;
+
+	ret = platform_device_add_data(pdev, &fighter_panel_data,
+			sizeof(fighter_panel_data));
+	if (ret) {
+		printk(KERN_ERR "%s: platform_device_add_data failed!\n", __func__);
+		goto err_device_put;
+	}
+
+	ret = platform_device_add(pdev);
+	if (ret) {
+		printk(KERN_ERR "%s: platform_device_register failed!\n", __func__);
+		goto err_device_put;
+	}
+
+	return 0;
+
+err_device_put:
+	platform_device_put(pdev);
+	return ret;
+}
+
+static int mipi_fighter_lcd_init(void)
+{
+	printk(KERN_ERR  "[DISP] %s +++\n", __func__);
+#ifndef FIGHTER_USE_CMDLISTS
+	mipi_dsi_buf_alloc(&fighter_tx_buf, DSI_BUF_SIZE);
+	mipi_dsi_buf_alloc(&fighter_rx_buf, DSI_BUF_SIZE);
+#endif
+
+	printk(KERN_ERR  "[DISP] %s ---\n", __func__);
+	return platform_driver_register(&this_driver);
+}
diff --git a/arch/arm/mach-msm/htc/fighter/display/mipi_fighter.h b/arch/arm/mach-msm/htc/fighter/display/mipi_fighter.h
new file mode 100644
index 0000000..a6638d8
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/display/mipi_fighter.h
@@ -0,0 +1,20 @@
+#ifndef MIPI_FIGHTER_H
+#define MIPI_FIGHTER_H
+
+#include <linux/pwm.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+
+int mipi_fighter_device_register(struct msm_panel_info *pinfo,
+                                 u32 channel, u32 panel);
+
+#define FIGHTER_USE_CMDLISTS 1
+
+#define PWM_MIN                   7
+#define PWM_DEFAULT               91
+#define PWM_MAX                   255
+
+#define BRI_SETTING_MIN                 30
+#define BRI_SETTING_DEF                 142
+#define BRI_SETTING_MAX                 255
+
+#endif
diff --git a/arch/arm/mach-msm/htc/fighter/display/mipi_fighter_cmd_qhd_pt.c b/arch/arm/mach-msm/htc/fighter/display/mipi_fighter_cmd_qhd_pt.c
new file mode 100644
index 0000000..c2680ea
--- /dev/null
+++ b/arch/arm/mach-msm/htc/fighter/display/mipi_fighter_cmd_qhd_pt.c
@@ -0,0 +1,93 @@
+#include "../../../drivers/video/msm/msm_fb.h"
+#include "../../../drivers/video/msm/mipi_dsi.h"
+#include "mipi_fighter.h"
+
+static struct mipi_dsi_phy_ctrl dsi_cmd_mode_phy_db = {
+	/* DSI_BIT_CLK at 482MHz, 2 lane, RGB888 */
+	/* regulator */
+	{0x03, 0x0a, 0x04, 0x00, 0x20},
+	/* timing */
+	/* clk_rate:482MHz */
+	{0xb7, 0x28, 0x1f, 0x00, 0x22, 0x95, 0x22, 0x28, 0x22,
+		0x03, 0x04, 0xa0},
+	/* phy ctrl */
+	{0x5f, 0x00, 0x00, 0x10},
+	/* strength */
+	{0xff, 0x00, 0x06, 0x00},
+	/* pll control */
+	{0x0, 0xf9, 0xb0, 0xda, 0x00, 0x50, 0x48, 0x63,
+		0x41, 0x0f, 0x01,
+		0x00, 0x14, 0x03, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01 },
+};
+
+static struct msm_panel_info pinfo;
+
+static int __init mipi_cmd_fighter_qhd_pt_init(void)
+{
+	int ret;
+#if defined (CONFIG_FB_MSM_MDP_ABL)
+	pinfo.panel_char = smd_gamma_tbl;
+#endif
+
+	pinfo.xres = 540;
+	pinfo.yres = 960;
+	pinfo.type = MIPI_CMD_PANEL;
+	pinfo.pdest = DISPLAY_1;
+	pinfo.wait_cycle = 0;
+	pinfo.bpp = 24;
+
+	pinfo.lcdc.h_back_porch = 64;
+	pinfo.lcdc.h_front_porch = 96;
+	pinfo.lcdc.h_pulse_width = 32;
+	pinfo.lcdc.v_back_porch = 16;
+	pinfo.lcdc.v_front_porch = 16;
+	pinfo.lcdc.v_pulse_width = 4;
+
+	pinfo.lcd.v_back_porch = 16;
+	pinfo.lcd.v_front_porch = 16;
+	pinfo.lcd.v_pulse_width = 4;
+
+	pinfo.lcd.primary_vsync_init = pinfo.yres;
+	pinfo.lcd.primary_rdptr_irq = 0;
+	pinfo.lcd.primary_start_pos = pinfo.yres +
+		pinfo.lcd.v_back_porch + pinfo.lcd.v_front_porch - 1;
+
+	pinfo.lcdc.border_clr = 0;	/* blk */
+	pinfo.lcdc.underflow_clr = 0xff;	/* blue */
+	pinfo.lcdc.hsync_skew = 0;
+	pinfo.bl_max = 255;
+	pinfo.bl_min = 1;
+	pinfo.fb_num = 2;
+	pinfo.clk_rate = 482000000;
+	pinfo.lcd.vsync_enable = TRUE;
+	pinfo.lcd.hw_vsync_mode = TRUE;
+	pinfo.lcd.refx100 = 6096; /* adjust refx100 to prevent tearing */
+
+	pinfo.mipi.mode = DSI_CMD_MODE;
+	pinfo.mipi.dst_format = DSI_CMD_DST_FORMAT_RGB888;
+	pinfo.mipi.vc = 0;
+	pinfo.mipi.rgb_swap = DSI_RGB_SWAP_RGB;
+	pinfo.mipi.esc_byte_ratio = 4;
+	pinfo.mipi.data_lane0 = TRUE;
+	pinfo.mipi.data_lane1 = TRUE;
+	pinfo.mipi.t_clk_post = 0x0a;
+	pinfo.mipi.t_clk_pre = 0x20;
+	pinfo.mipi.stream = 0;	/* dma_p */
+	pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_NONE;
+	pinfo.mipi.dma_trigger = DSI_CMD_TRIGGER_SW;
+	pinfo.mipi.te_sel = 1; /* TE from vsycn gpio */
+	pinfo.mipi.interleave_max = 1;
+	pinfo.mipi.insert_dcs_cmd = TRUE;
+	pinfo.mipi.wr_mem_continue = 0x3c;
+	pinfo.mipi.wr_mem_start = 0x2c;
+	pinfo.mipi.dsi_phy_db = &dsi_cmd_mode_phy_db;
+
+	ret = mipi_fighter_device_register(&pinfo, MIPI_DSI_PRIM,
+			MIPI_DSI_PANEL_QHD_PT);
+	if (ret)
+		printk(KERN_ERR "%s: failed to register device!\n", __func__);
+
+	return ret;
+}
+
+late_initcall(mipi_cmd_fighter_qhd_pt_init);
diff --git a/arch/arm/mach-msm/htc/htc_acoustic_8960.c b/arch/arm/mach-msm/htc/htc_acoustic_8960.c
new file mode 100644
index 0000000..cf2b156
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_acoustic_8960.c
@@ -0,0 +1,199 @@
+/* arch/arm/mach-msm/htc_acoustic_8960.c
+ *
+ * Copyright (C) 2012 HTC Corporation
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/device.h>
+#include <linux/fs.h>
+#include <linux/module.h>
+#include <linux/miscdevice.h>
+#include <linux/ioctl.h>
+#include <linux/mm.h>
+#include <linux/gfp.h>
+#include <linux/uaccess.h>
+#include <linux/slab.h>
+#include <linux/switch.h>
+#include <mach/htc_acoustic_8960.h>
+
+#define ACOUSTIC_IOCTL_MAGIC 'p'
+#define ACOUSTIC_SET_Q6_EFFECT		_IOW(ACOUSTIC_IOCTL_MAGIC, 43, unsigned)
+#define ACOUSTIC_GET_HTC_REVISION	_IOW(ACOUSTIC_IOCTL_MAGIC, 44, unsigned)
+#define ACOUSTIC_GET_HW_COMPONENT	_IOW(ACOUSTIC_IOCTL_MAGIC, 45, unsigned)
+#define ACOUSTIC_GET_DMIC_INFO   	_IOW(ACOUSTIC_IOCTL_MAGIC, 46, unsigned)
+#define ACOUSTIC_UPDATE_BEATS_STATUS	_IOW(ACOUSTIC_IOCTL_MAGIC, 47, unsigned)
+#define ACOUSTIC_RAMDUMP		_IOW(ACOUSTIC_IOCTL_MAGIC, 99, unsigned)
+#define D(fmt, args...) printk(KERN_INFO "[AUD] htc-acoustic: "fmt, ##args)
+#define E(fmt, args...) printk(KERN_ERR "[AUD] htc-acoustic: "fmt, ##args)
+
+static struct mutex api_lock;
+static struct acoustic_ops default_acoustic_ops;
+static struct acoustic_ops *the_ops = &default_acoustic_ops;
+static struct switch_dev sdev_beats;
+
+void acoustic_register_ops(struct acoustic_ops *ops)
+{
+        D("acoustic_register_ops \n");
+	the_ops = ops;
+}
+
+static int acoustic_open(struct inode *inode, struct file *file)
+{
+	D("open\n");
+	return 0;
+}
+
+static int acoustic_release(struct inode *inode, struct file *file)
+{
+	D("release\n");
+	return 0;
+}
+
+static long
+acoustic_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	int rc = 0;
+	int hw_rev = 0;
+	int mode = -1;
+	mutex_lock(&api_lock);
+	switch (cmd) {
+	case ACOUSTIC_SET_Q6_EFFECT: {
+		if (copy_from_user(&mode, (void *)arg, sizeof(mode))) {
+			rc = -EFAULT;
+			break;
+		}
+		D("Set Q6 Effect : %d\n", mode);
+		if (mode < -1 || mode > 1) {
+			E("unsupported Q6 mode: %d\n", mode);
+			rc = -EINVAL;
+			break;
+		}
+		if (the_ops->set_q6_effect)
+			the_ops->set_q6_effect(mode);
+		break;
+	}
+	case ACOUSTIC_GET_HTC_REVISION:
+		if (the_ops->get_htc_revision)
+			hw_rev = the_ops->get_htc_revision();
+		else
+			hw_rev = 1;
+
+		D("Audio HW revision:  %u\n", hw_rev);
+		if(copy_to_user((void *)arg, &hw_rev, sizeof(hw_rev))) {
+			E("acoustic_ioctl: copy to user failed\n");
+			rc = -EINVAL;
+		}
+		break;
+	case ACOUSTIC_GET_HW_COMPONENT:
+		if (the_ops->get_hw_component)
+			rc = the_ops->get_hw_component();
+
+		D("support components: 0x%x\n", rc);
+		if(copy_to_user((void *)arg, &rc, sizeof(rc))) {
+			E("acoustic_ioctl: copy to user failed\n");
+			rc = -EINVAL;
+		}
+		break;
+       case ACOUSTIC_GET_DMIC_INFO:
+		if (the_ops->enable_digital_mic)
+			rc = the_ops->enable_digital_mic();
+
+		D("support components: 0x%x\n", rc);
+		if(copy_to_user((void *)arg, &rc, sizeof(rc))) {
+			E("acoustic_ioctl: copy to user failed\n");
+			rc = -EINVAL;
+		}
+                break;
+	case ACOUSTIC_UPDATE_BEATS_STATUS: {
+		int new_state = -1;
+
+		if (copy_from_user(&new_state, (void *)arg, sizeof(new_state))) {
+			rc = -EFAULT;
+			break;
+		}
+		D("Update Beats Status : %d\n", new_state);
+		if (new_state < -1 || new_state > 1) {
+			E("Invalid Beats status update");
+			rc = -EINVAL;
+			break;
+		}
+
+		sdev_beats.state = -1;
+		switch_set_state(&sdev_beats, new_state);
+		break;
+	}
+       case ACOUSTIC_RAMDUMP:
+		pr_err("trigger ramdump by user space\n");
+		if (copy_from_user(&mode, (void *)arg, sizeof(mode))) {
+			rc = -EFAULT;
+			break;
+		}
+		if (mode >= 4100 && mode <= 4800) {
+			dump_stack();
+			pr_err("msgid = %d\n", mode);
+			BUG();
+		}
+                break;
+	default:
+		rc = -EINVAL;
+	}
+	mutex_unlock(&api_lock);
+	return rc;
+}
+
+static ssize_t beats_print_name(struct switch_dev *sdev, char *buf)
+{
+	return sprintf(buf, "Beats\n");
+}
+
+static struct file_operations acoustic_fops = {
+	.owner = THIS_MODULE,
+	.open = acoustic_open,
+	.release = acoustic_release,
+	.unlocked_ioctl = acoustic_ioctl,
+};
+
+static struct miscdevice acoustic_misc = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "htc-acoustic",
+	.fops = &acoustic_fops,
+};
+
+static int __init acoustic_init(void)
+{
+	int ret = 0;
+
+	mutex_init(&api_lock);
+	ret = misc_register(&acoustic_misc);
+	if (ret < 0) {
+		pr_err("failed to register misc device!\n");
+		return ret;
+	}
+
+	sdev_beats.name = "Beats";
+	sdev_beats.print_name = beats_print_name;
+
+	ret = switch_dev_register(&sdev_beats);
+	if (ret < 0) {
+		pr_err("failed to register beats switch device!\n");
+		return ret;
+	}
+	return 0;
+}
+
+static void __exit acoustic_exit(void)
+{
+	misc_deregister(&acoustic_misc);
+}
+
+module_init(acoustic_init);
+module_exit(acoustic_exit);
diff --git a/arch/arm/mach-msm/htc/htc_awb_cal.c b/arch/arm/mach-msm/htc/htc_awb_cal.c
new file mode 100644
index 0000000..ec49902
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_awb_cal.c
@@ -0,0 +1,195 @@
+/* Code to extract Camera AWB calibration information from ATAG
+set up by the bootloader.
+
+Copyright (C) 2008 Google, Inc.
+Author: Dmitry Shmidt <dimitrysh@google.com>
+
+This software is licensed under the terms of the GNU General Public
+License version 2, as published by the Free Software Foundation, and
+may be copied, distributed, and modified under those terms.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+*/
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/proc_fs.h>
+#include <asm/setup.h>
+
+#include <linux/fs.h>
+#include <linux/syscalls.h>
+
+#define ATAG_MSM_AWB_CAL	0x59504550 
+
+#define AWB_CAL_MAX_SIZE	0x2000U     
+
+struct qct_lsc_struct{
+	unsigned long int	lsc_verify;
+	unsigned long int	lsc_fuseid[4];
+	float 			pCalcParam[17*13*4];
+	unsigned long int	lsc_checksum;
+};
+
+struct qct_awb_lsc_struct{
+	unsigned long int caBuff[8];
+	struct qct_lsc_struct qct_lsc_data;
+	
+	unsigned long int flashcaBuff[8];  
+	
+
+};
+
+static unsigned char cam_awb_ram[AWB_CAL_MAX_SIZE];
+
+int gCAM_AWB_CAL_LEN;
+
+unsigned char *get_cam_awb_cal(void)
+{
+	return cam_awb_ram;
+}
+
+EXPORT_SYMBOL(get_cam_awb_cal);
+unsigned char *dummy(unsigned char *p)
+{
+    return p;
+}
+static int __init parse_tag_cam_awb_cal(const struct tag *tag)
+{
+	unsigned char *dptr = (unsigned char *)(&tag->u);
+	unsigned size;
+
+	size = min((tag->hdr.size - 2) * sizeof(__u32), AWB_CAL_MAX_SIZE);
+
+	printk(KERN_INFO "CAM_AWB_CAL Data size = %d , 0x%x, size = %d (%d,%d)\n",
+			tag->hdr.size, tag->hdr.tag, size,
+			((tag->hdr.size - 2) * sizeof(__u32)), (AWB_CAL_MAX_SIZE));
+
+	gCAM_AWB_CAL_LEN = size;
+	memcpy(cam_awb_ram, dummy(dptr), size); 
+
+
+#ifdef ATAG_CAM_AWB_CAL_DEBUG
+   {
+	 int *pint, i;
+
+	 printk(KERN_INFO "parse_tag_cam_awb_cal():\n");
+
+	 pint = (int *)cam_awb_ram;
+
+	 for (i = 0; i < 1024; i++)
+	   printk(KERN_INFO "%x\n", pint[i]);
+
+   }
+#endif
+
+	return 0;
+}
+
+__tagtable(ATAG_MSM_AWB_CAL, parse_tag_cam_awb_cal);
+
+
+static ssize_t awb_calibration_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+	unsigned char *ptr;
+
+	ptr = get_cam_awb_cal();
+	
+
+	ret = sizeof(struct qct_awb_lsc_struct);
+	
+	printk(KERN_INFO "awb_calibration_show(%d)\n", ret);
+	memcpy(buf, ptr, ret);
+
+#ifdef ATAG_CAM_AWB_CAL_DEBUG
+   {
+	 int i, *pint;
+	 printk(KERN_INFO "awb_calibration_show():\n");
+	 pint = (int *)buf;
+	 for (i = 0; i < 906; i++)
+	   printk(KERN_INFO "%d-%x\n", i, pint[i]);
+
+   }
+#endif
+
+	return ret;
+}
+
+static ssize_t awb_calibration_front_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+	unsigned char *ptr;
+
+	if (gCAM_AWB_CAL_LEN < AWB_CAL_MAX_SIZE)
+		return 0;
+
+	ptr = get_cam_awb_cal();
+	
+
+	ret = sizeof(struct qct_awb_lsc_struct);
+	
+	printk(KERN_INFO "awb_calibration_front_show(%d)\n", ret);
+	memcpy(buf, ptr + 0x1000U, ret);
+
+
+#ifdef ATAG_CAM_AWB_CAL_DEBUG
+   {
+	 int i, *pint;
+	 printk(KERN_INFO "awb_calibration_front_show():\n");
+	 pint = (int *)buf;
+	 for (i = 0; i < 898; i++)
+	   printk(KERN_INFO "%x\n", pint[i]);
+
+   }
+#endif
+
+	return ret;
+}
+
+
+static DEVICE_ATTR(awb_cal, 0444, awb_calibration_show, NULL);
+static DEVICE_ATTR(awb_cal_front, 0444, awb_calibration_front_show, NULL);
+
+
+static struct kobject *cam_awb_cal;
+
+static int cam_get_awb_cal(void)
+{
+	int ret ;
+
+	
+	cam_awb_cal = kobject_create_and_add("android_camera_awb_cal", NULL);
+	if (cam_awb_cal == NULL) {
+		pr_info("cam_get_awb_cal: subsystem_register failed\n");
+		ret = -ENOMEM;
+		return ret ;
+	}
+
+	ret = sysfs_create_file(cam_awb_cal, &dev_attr_awb_cal.attr);
+	if (ret) {
+		pr_info("cam_get_awb_cal:: sysfs_create_file failed\n");
+		kobject_del(cam_awb_cal);
+		goto end;
+	}
+
+	if (gCAM_AWB_CAL_LEN < AWB_CAL_MAX_SIZE)
+		goto end;
+
+	ret = sysfs_create_file(cam_awb_cal, &dev_attr_awb_cal_front.attr);
+	if (ret) {
+		pr_info("cam_get_awb_cal_front:: sysfs_create_file failed\n");
+		kobject_del(cam_awb_cal);
+		goto end;
+	}
+
+end:
+	return 0 ;
+}
+
+late_initcall(cam_get_awb_cal);
diff --git a/arch/arm/mach-msm/htc/htc_battery_8960.c b/arch/arm/mach-msm/htc/htc_battery_8960.c
new file mode 100644
index 0000000..32891ed
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_battery_8960.c
@@ -0,0 +1,1940 @@
+/* arch/arm/mach-msm/htc_battery_8960.c
+ *
+ * Copyright (C) 2011 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/debugfs.h>
+#include <linux/wakelock.h>
+#include <linux/gpio.h>
+#include <mach/board.h>
+#include <asm/mach-types.h>
+#include <mach/board_htc.h>
+#include <mach/htc_battery_core.h>
+#include <mach/htc_battery_8960.h>
+#include <linux/workqueue.h>
+#include <linux/slab.h>
+#include <linux/reboot.h>
+#include <linux/miscdevice.h>
+#include <linux/pmic8058-xoadc.h>
+#include <mach/mpp.h>
+#include <linux/android_alarm.h>
+#include <linux/suspend.h>
+#include <linux/earlysuspend.h>
+
+#include <mach/htc_gauge.h>
+#include <mach/htc_charger.h>
+#include <mach/htc_battery_cell.h>
+
+
+#define HTC_BATT_CHG_DIS_BIT_EOC	(1)
+#define HTC_BATT_CHG_DIS_BIT_ID		(1<<1)
+#define HTC_BATT_CHG_DIS_BIT_TMP	(1<<2)
+#define HTC_BATT_CHG_DIS_BIT_OVP	(1<<3)
+#define HTC_BATT_CHG_DIS_BIT_TMR	(1<<4)
+#define HTC_BATT_CHG_DIS_BIT_MFG	(1<<5)
+#define HTC_BATT_CHG_DIS_BIT_USR_TMR	(1<<6)
+static int chg_dis_reason;
+static int chg_dis_active_mask = HTC_BATT_CHG_DIS_BIT_ID
+								| HTC_BATT_CHG_DIS_BIT_MFG
+								| HTC_BATT_CHG_DIS_BIT_TMP
+								| HTC_BATT_CHG_DIS_BIT_USR_TMR;
+static int chg_dis_control_mask = HTC_BATT_CHG_DIS_BIT_ID
+								| HTC_BATT_CHG_DIS_BIT_MFG
+								| HTC_BATT_CHG_DIS_BIT_USR_TMR;
+#define HTC_BATT_PWRSRC_DIS_BIT_MFG		(1)
+#define HTC_BATT_PWRSRC_DIS_BIT_API		(1<<1)
+static int pwrsrc_dis_reason;
+
+static int chg_dis_user_timer;
+static int charger_dis_temp_fault;
+
+static int chg_limit_reason;
+static int chg_limit_active_mask;
+
+#define SUSPEND_HIGHFREQ_CHECK_BIT_TALK		(1)
+#define SUSPEND_HIGHFREQ_CHECK_BIT_SEARCH	(1<<1)
+static int suspend_highfreq_check_reason;
+
+#define CONTEXT_STATE_BIT_TALK			(1)
+#define CONTEXT_STATE_BIT_SEARCH		(1<<1)
+#define CONTEXT_STATE_BIT_NAVIGATION	(1<<2)
+static int context_state;
+
+#define STATE_WORKQUEUE_PENDING			(1)
+#define STATE_EARLY_SUSPEND			(1<<1)
+#define STATE_PREPARE			(1<<2)
+#define STATE_SUSPEND			(1<<3)
+
+#define BATT_SUSPEND_CHECK_TIME				(3600)
+#define BATT_SUSPEND_HIGHFREQ_CHECK_TIME	(300)
+#define BATT_TIMER_CHECK_TIME				(360)
+#define BATT_TIMER_UPDATE_TIME				(60)
+
+#ifdef CONFIG_ARCH_MSM8X60_LTE
+#endif
+
+static void mbat_in_func(struct work_struct *work);
+struct delayed_work mbat_in_struct;
+static struct kset *htc_batt_kset;
+
+#define BATT_REMOVED_SHUTDOWN_DELAY_MS (50)
+#define BATT_CRITICAL_VOL_SHUTDOWN_DELAY_MS (1000)
+static void shutdown_worker(struct work_struct *work);
+struct delayed_work shutdown_work;
+
+#define BATT_CRITICAL_LOW_VOLTAGE		(3000)
+#define BATT_CRITICAL_ALARM_STEP		(200)
+static int critical_shutdown = 0;
+static int critical_alarm_level = 2;
+static int critical_alarm_level_set = 2;
+struct wake_lock voltage_alarm_wake_lock;
+struct wake_lock batt_shutdown_wake_lock;
+
+static struct early_suspend early_suspend;
+#ifdef CONFIG_HTC_BATT_ALARM
+static int screen_state;
+
+static int ac_suspend_flag;
+#endif
+static int htc_ext_5v_output_now;
+static int htc_ext_5v_output_old;
+
+static int latest_chg_src = CHARGER_BATTERY;
+
+struct htc_battery_info {
+	int device_id;
+
+	
+	struct mutex info_lock;
+
+	spinlock_t batt_lock;
+	int is_open;
+
+	
+	int critical_low_voltage_mv;
+	
+	int critical_alarm_voltage_mv;
+	int overload_vol_thr_mv;
+	int overload_curr_thr_ma;
+
+	struct kobject batt_timer_kobj;
+	struct kobject batt_cable_kobj;
+
+	struct wake_lock vbus_wake_lock;
+	char debug_log[DEBUG_LOG_LENGTH];
+
+	struct battery_info_reply rep;
+	struct mpp_config_data *mpp_config;
+	struct battery_adc_reply adc_data;
+	int adc_vref[ADC_REPLY_ARRAY_SIZE];
+
+	int guage_driver;
+	int charger;
+	
+	struct htc_gauge *igauge;
+	struct htc_charger *icharger;
+	struct htc_battery_cell *bcell;
+	int state;
+};
+static struct htc_battery_info htc_batt_info;
+
+struct htc_battery_timer {
+	struct mutex schedule_lock;
+	unsigned long batt_system_jiffies;
+	unsigned long batt_suspend_ms;
+	unsigned long total_time_ms;	
+	unsigned int batt_alarm_status;
+#ifdef CONFIG_HTC_BATT_ALARM
+	unsigned int batt_critical_alarm_counter;
+#endif
+	unsigned int batt_alarm_enabled;
+	unsigned int alarm_timer_flag;
+	unsigned int time_out;
+	struct work_struct batt_work;
+	struct alarm batt_check_wakeup_alarm;
+	struct timer_list batt_timer;
+	struct workqueue_struct *batt_wq;
+	struct wake_lock battery_lock;
+};
+static struct htc_battery_timer htc_batt_timer;
+
+struct mutex cable_notifier_lock; 
+static void cable_status_notifier_func(int online);
+static struct t_cable_status_notifier cable_status_notifier = {
+	.name = "htc_battery_8960",
+	.func = cable_status_notifier_func,
+};
+
+static int htc_battery_initial;
+static int htc_full_level_flag;
+static int htc_battery_set_charging(int ctl);
+
+#ifdef CONFIG_HTC_BATT_ALARM
+static int battery_vol_alarm_mode;
+static struct battery_vol_alarm alarm_data;
+struct mutex batt_set_alarm_lock;
+#endif
+
+int htc_gauge_get_battery_voltage(int *result)
+{
+	if (htc_batt_info.igauge && htc_batt_info.igauge->get_battery_voltage)
+		return htc_batt_info.igauge->get_battery_voltage(result);
+	pr_warn("[BATT] interface doesn't exist\n");
+	return -EINVAL;
+}
+EXPORT_SYMBOL(htc_gauge_get_battery_voltage);
+
+int htc_is_wireless_charger(void)
+{
+	if (htc_battery_initial)
+		return (htc_batt_info.rep.charging_source == CHARGER_WIRELESS) ? 1 : 0;
+	else
+		return -1;
+}
+
+int htc_batt_schedule_batt_info_update(void)
+{
+	if (htc_batt_info.state & STATE_WORKQUEUE_PENDING) {
+		htc_batt_info.state &= ~STATE_WORKQUEUE_PENDING;
+		pr_debug("[BATT] %s(): Clear flag, htc_batt_info.state=0x%x\n",
+				__func__, htc_batt_info.state);
+	}
+
+	
+	wake_lock(&htc_batt_timer.battery_lock);
+	queue_work(htc_batt_timer.batt_wq, &htc_batt_timer.batt_work);
+	return 0;
+}
+
+static void batt_lower_voltage_alarm_handler(int status)
+{
+	wake_lock(&voltage_alarm_wake_lock);
+	if (status) {
+		htc_batt_info.igauge->enable_lower_voltage_alarm(0);
+		BATT_LOG("voltage_alarm level=%d (%d mV) triggered.",
+			critical_alarm_level,
+			htc_batt_info.critical_alarm_voltage_mv
+				+ BATT_CRITICAL_ALARM_STEP * critical_alarm_level);
+		if (critical_alarm_level == 0)
+			critical_shutdown = 1;
+		critical_alarm_level--;
+		htc_batt_schedule_batt_info_update();
+	} else {
+		pr_info("[BATT] voltage_alarm level=%d (%d mV) raised back.\n",
+			critical_alarm_level,
+			htc_batt_info.critical_alarm_voltage_mv
+				+ BATT_CRITICAL_ALARM_STEP * critical_alarm_level);
+	}
+	wake_unlock(&voltage_alarm_wake_lock);
+}
+
+int htc_gauge_event_notify(enum htc_gauge_event event)
+{
+	pr_info("[BATT] %s gauge event=%d\n", __func__, event);
+
+	switch (event) {
+	case HTC_GAUGE_EVENT_READY:
+		if (!htc_batt_info.igauge) {
+			pr_err("[BATT]err: htc_gauge is not hooked.\n");
+			break;
+		}
+		mutex_lock(&htc_batt_info.info_lock);
+		htc_batt_info.igauge->ready = 1;
+#if 0
+		if (htc_batt_info.icharger && htc_batt_info.icharger->ready)
+			htc_batt_info.rep.batt_state = 1;
+		if (htc_batt_info.rep.batt_state) {
+			cable_detect_register_notifier(&cable_status_notifier);
+			htc_batt_schedule_batt_info_update();
+		}
+#endif
+		
+		if (htc_batt_info.igauge && htc_batt_info.critical_alarm_voltage_mv) {
+			if (htc_batt_info.igauge->register_lower_voltage_alarm_notifier)
+				htc_batt_info.igauge->register_lower_voltage_alarm_notifier(
+									batt_lower_voltage_alarm_handler);
+			if (htc_batt_info.igauge->set_lower_voltage_alarm_threshold)
+				htc_batt_info.igauge->set_lower_voltage_alarm_threshold(
+					htc_batt_info.critical_alarm_voltage_mv
+					+ (BATT_CRITICAL_ALARM_STEP * critical_alarm_level));
+			if (htc_batt_info.igauge->enable_lower_voltage_alarm)
+				htc_batt_info.igauge->enable_lower_voltage_alarm(1);
+		}
+
+		mutex_unlock(&htc_batt_info.info_lock);
+		break;
+	case HTC_GAUGE_EVENT_TEMP_ZONE_CHANGE:
+		if (htc_batt_info.state & STATE_PREPARE) {
+			htc_batt_info.state |= STATE_WORKQUEUE_PENDING;
+			pr_info("[BATT] %s(): Skip due to htc_batt_info.state=0x%x\n",
+				__func__, htc_batt_info.state);
+		} else {
+			pr_debug("[BATT] %s(): Run, htc_batt_info.state=0x%x\n",
+					__func__, htc_batt_info.state);
+			htc_batt_schedule_batt_info_update();
+		}
+		break;
+	case HTC_GAUGE_EVENT_EOC:
+	case HTC_GAUGE_EVENT_OVERLOAD:
+		htc_batt_schedule_batt_info_update();
+		break;
+	case HTC_GAUGE_EVENT_BATT_REMOVED:
+		if (!(get_kernel_flag() & KERNEL_FLAG_TEST_PWR_SUPPLY)) {
+			wake_lock(&batt_shutdown_wake_lock);
+			schedule_delayed_work(&shutdown_work,
+					msecs_to_jiffies(BATT_REMOVED_SHUTDOWN_DELAY_MS));
+		}
+		break;
+	default:
+		pr_info("[BATT] unsupported gauge event(%d)\n", event);
+		break;
+	}
+	return 0;
+}
+
+int htc_charger_event_notify(enum htc_charger_event event)
+{
+	
+	pr_info("[BATT] %s charger event=%d\n", __func__, event);
+	switch (event) {
+	case HTC_CHARGER_EVENT_VBUS_IN:
+		
+		
+		break;
+	case HTC_CHARGER_EVENT_SRC_INTERNAL:
+		htc_ext_5v_output_now = 1;
+		BATT_LOG("%s htc_ext_5v_output_now:%d", __func__, htc_ext_5v_output_now);
+		htc_batt_schedule_batt_info_update();
+		break;
+	case HTC_CHARGER_EVENT_SRC_CLEAR:
+		latest_chg_src = CHARGER_BATTERY;
+		htc_ext_5v_output_now = 0;
+		BATT_LOG("%s htc_ext_5v_output_now:%d", __func__, htc_ext_5v_output_now);
+		htc_batt_schedule_batt_info_update();
+		break;
+	case HTC_CHARGER_EVENT_VBUS_OUT:
+	case HTC_CHARGER_EVENT_SRC_NONE: 
+		latest_chg_src = CHARGER_BATTERY;
+		htc_batt_schedule_batt_info_update();
+		break;
+	case HTC_CHARGER_EVENT_SRC_USB: 
+		latest_chg_src = CHARGER_USB;
+		htc_batt_schedule_batt_info_update();
+		break;
+	case HTC_CHARGER_EVENT_SRC_AC: 
+		latest_chg_src = CHARGER_AC;
+		htc_batt_schedule_batt_info_update();
+		break;
+	case HTC_CHARGER_EVENT_SRC_WIRELESS: 
+		latest_chg_src = CHARGER_WIRELESS;
+		htc_batt_schedule_batt_info_update();
+		break;
+	case HTC_CHARGER_EVENT_OVP:
+	case HTC_CHARGER_EVENT_OVP_RESOLVE:
+		htc_batt_schedule_batt_info_update();
+		break;
+	case HTC_CHARGER_EVENT_SRC_MHL_AC:
+		latest_chg_src = CHARGER_MHL_AC;
+		htc_batt_schedule_batt_info_update();
+		break;
+	case HTC_CHARGER_EVENT_READY:
+		if (!htc_batt_info.icharger) {
+			pr_err("[BATT]err: htc_charger is not hooked.\n");
+				
+			break;
+		}
+		mutex_lock(&htc_batt_info.info_lock);
+		htc_batt_info.icharger->ready = 1;
+#if 0
+		if (htc_batt_info.igauge && htc_batt_info.igauge->ready)
+			htc_batt_info.rep.batt_state = 1;
+		if (htc_batt_info.rep.batt_state) {
+			cable_detect_register_notifier(&cable_status_notifier);
+			htc_batt_schedule_batt_info_update();
+		}
+#endif
+		mutex_unlock(&htc_batt_info.info_lock);
+		break;
+	default:
+		pr_info("[BATT] unsupported charger event(%d)\n", event);
+		break;
+	}
+	return 0;
+}
+
+
+#if 0
+#ifdef CONFIG_HTC_BATT_ALARM
+static int batt_set_voltage_alarm(unsigned long lower_threshold,
+			unsigned long upper_threshold)
+#else
+static int batt_alarm_config(unsigned long lower_threshold,
+			unsigned long upper_threshold)
+#endif
+{
+	int rc = 0;
+
+	BATT_LOG("%s(lw = %lu, up = %lu)", __func__,
+		lower_threshold, upper_threshold);
+	rc = pm8058_batt_alarm_state_set(0, 0);
+	if (rc) {
+		BATT_ERR("state_set disabled failed, rc=%d", rc);
+		goto done;
+	}
+
+	rc = pm8058_batt_alarm_threshold_set(lower_threshold, upper_threshold);
+	if (rc) {
+		BATT_ERR("threshold_set failed, rc=%d!", rc);
+		goto done;
+	}
+
+#ifdef CONFIG_HTC_BATT_ALARM
+	rc = pm8058_batt_alarm_state_set(1, 0);
+	if (rc) {
+		BATT_ERR("state_set enabled failed, rc=%d", rc);
+		goto done;
+	}
+#endif
+
+done:
+	return rc;
+}
+#ifdef CONFIG_HTC_BATT_ALARM
+static int batt_clear_voltage_alarm(void)
+{
+	int rc = pm8058_batt_alarm_state_set(0, 0);
+	BATT_LOG("disable voltage alarm");
+	if (rc)
+		BATT_ERR("state_set disabled failed, rc=%d", rc);
+	return rc;
+}
+
+static int batt_set_voltage_alarm_mode(int mode)
+{
+	int rc = 0;
+
+
+	BATT_LOG("%s , mode:%d\n", __func__, mode);
+
+
+	mutex_lock(&batt_set_alarm_lock);
+	switch (mode) {
+	case BATT_ALARM_DISABLE_MODE:
+		rc = batt_clear_voltage_alarm();
+		break;
+	case BATT_ALARM_CRITICAL_MODE:
+		rc = batt_set_voltage_alarm(BATT_CRITICAL_LOW_VOLTAGE,
+			alarm_data.upper_threshold);
+		break;
+	default:
+	case BATT_ALARM_NORMAL_MODE:
+		rc = batt_set_voltage_alarm(alarm_data.lower_threshold,
+			alarm_data.upper_threshold);
+		break;
+	}
+	if (!rc)
+		battery_vol_alarm_mode = mode;
+	else {
+		battery_vol_alarm_mode = BATT_ALARM_DISABLE_MODE;
+		batt_clear_voltage_alarm();
+	}
+	mutex_unlock(&batt_set_alarm_lock);
+	return rc;
+}
+#endif
+
+static int battery_alarm_notifier_func(struct notifier_block *nfb,
+					unsigned long value, void *data);
+static struct notifier_block battery_alarm_notifier = {
+	.notifier_call = battery_alarm_notifier_func,
+};
+
+static int battery_alarm_notifier_func(struct notifier_block *nfb,
+					unsigned long status, void *data)
+{
+
+#ifdef CONFIG_HTC_BATT_ALARM
+	BATT_LOG("%s \n", __func__);
+
+	if (battery_vol_alarm_mode == BATT_ALARM_CRITICAL_MODE) {
+		BATT_LOG("%s(): CRITICAL_MODE counter = %d", __func__,
+			htc_batt_timer.batt_critical_alarm_counter + 1);
+		if (++htc_batt_timer.batt_critical_alarm_counter >= 3) {
+			BATT_LOG("%s: 3V voltage alarm is triggered.", __func__);
+			htc_batt_info.rep.level = 1;
+			
+			htc_battery_core_update_changed();
+		}
+		batt_set_voltage_alarm_mode(BATT_ALARM_CRITICAL_MODE);
+	} else if (battery_vol_alarm_mode == BATT_ALARM_NORMAL_MODE) {
+		htc_batt_timer.batt_alarm_status++;
+		BATT_LOG("%s: NORMAL_MODE batt alarm status = %u", __func__,
+			htc_batt_timer.batt_alarm_status);
+	} else { 
+		BATT_ERR("%s:Warning: batt alarm triggerred in disable mode ", __func__);
+	}
+#else
+	htc_batt_timer.batt_alarm_status++;
+	BATT_LOG("%s: batt alarm status %u", __func__, htc_batt_timer.batt_alarm_status);
+#endif
+	return 0;
+}
+#endif
+
+#if 0
+static void update_wake_lock(int status)
+{
+#ifdef CONFIG_HTC_BATT_ALARM
+	if (status != CHARGER_BATTERY && !ac_suspend_flag)
+		wake_lock(&htc_batt_info.vbus_wake_lock);
+	else if (status == CHARGER_USB && ac_suspend_flag)
+		
+		wake_lock(&htc_batt_info.vbus_wake_lock);
+	else
+		   wake_lock_timeout(&htc_batt_info.vbus_wake_lock, HZ * 5);
+#else
+	if (status == CHARGER_USB)
+		wake_lock(&htc_batt_info.vbus_wake_lock);
+	else
+		wake_lock_timeout(&htc_batt_info.vbus_wake_lock, HZ * 5);
+#endif
+}
+#endif
+
+static void cable_status_notifier_func(enum usb_connect_type online)
+{
+	static int first_update = 1;
+	mutex_lock(&cable_notifier_lock);
+	
+	htc_batt_info.rep.batt_state = 1;
+
+	BATT_LOG("%s(%d)", __func__, online);
+	
+	if (online == latest_chg_src && !first_update) {
+		BATT_LOG("%s: charger type (%u) same return.",
+			__func__, online);
+		mutex_unlock(&cable_notifier_lock);
+		return;
+	}
+	first_update = 0;
+
+	switch (online) {
+	case CONNECT_TYPE_USB:
+		BATT_LOG("USB charger");
+		htc_charger_event_notify(HTC_CHARGER_EVENT_SRC_USB);
+		
+		break;
+	case CONNECT_TYPE_AC:
+		BATT_LOG("5V AC charger");
+		htc_charger_event_notify(HTC_CHARGER_EVENT_SRC_AC);
+		
+		break;
+	case CONNECT_TYPE_WIRELESS:
+		BATT_LOG("wireless charger");
+		htc_charger_event_notify(HTC_CHARGER_EVENT_SRC_WIRELESS);
+		
+		break;
+	case CONNECT_TYPE_UNKNOWN:
+		BATT_ERR("unknown cable");
+		htc_charger_event_notify(HTC_CHARGER_EVENT_SRC_USB);
+		break;
+	case CONNECT_TYPE_INTERNAL:
+		BATT_LOG("delivers power to VBUS from battery (not supported)");
+		
+		htc_charger_event_notify(HTC_CHARGER_EVENT_SRC_INTERNAL);
+		break;
+	case CONNECT_TYPE_CLEAR:
+		BATT_LOG("stop 5V VBUS from battery (not supported)");
+		htc_charger_event_notify(HTC_CHARGER_EVENT_SRC_CLEAR);
+		break;
+
+	case CONNECT_TYPE_NONE:
+		BATT_LOG("No cable exists");
+		htc_charger_event_notify(HTC_CHARGER_EVENT_SRC_NONE);
+		
+		break;
+	case CONNECT_TYPE_MHL_AC:
+		BATT_LOG("mhl_ac");
+		htc_charger_event_notify(HTC_CHARGER_EVENT_SRC_MHL_AC);
+		break;
+	default:
+		BATT_LOG("unsupported connect_type=%d", online);
+		htc_charger_event_notify(HTC_CHARGER_EVENT_SRC_NONE);
+		
+		break;
+	}
+#if 0 
+	htc_batt_timer.alarm_timer_flag =
+			(unsigned int)htc_batt_info.rep.charging_source;
+
+	update_wake_lock(htc_batt_info.rep.charging_source);
+#endif
+	mutex_unlock(&cable_notifier_lock);
+}
+
+static int htc_battery_set_charging(int ctl)
+{
+	int rc = 0;
+	return rc;
+}
+
+static void __context_event_handler(enum batt_context_event event)
+{
+	pr_info("[BATT] handle context event(%d)\n", event);
+
+	switch (event) {
+	case EVENT_TALK_START:
+		if (chg_limit_active_mask & HTC_BATT_CHG_LIMIT_BIT_TALK) {
+			chg_limit_reason |= HTC_BATT_CHG_LIMIT_BIT_TALK;
+			if (htc_batt_info.icharger &&
+					htc_batt_info.icharger->set_limit_charge_enable)
+				htc_batt_info.icharger->set_limit_charge_enable(true);
+		}
+		suspend_highfreq_check_reason |= SUSPEND_HIGHFREQ_CHECK_BIT_TALK;
+		break;
+	case EVENT_TALK_STOP:
+		if (chg_limit_active_mask & HTC_BATT_CHG_LIMIT_BIT_TALK) {
+			chg_limit_reason &= ~HTC_BATT_CHG_LIMIT_BIT_TALK;
+			if (!chg_limit_reason &&
+					htc_batt_info.icharger &&
+					htc_batt_info.icharger->set_limit_charge_enable)
+				htc_batt_info.icharger->set_limit_charge_enable(false);
+		}
+		suspend_highfreq_check_reason &= ~SUSPEND_HIGHFREQ_CHECK_BIT_TALK;
+		break;
+	case EVENT_NAVIGATION_START:
+		if (chg_limit_active_mask & HTC_BATT_CHG_LIMIT_BIT_NAVI) {
+			chg_limit_reason |= HTC_BATT_CHG_LIMIT_BIT_NAVI;
+			if (htc_batt_info.icharger &&
+					htc_batt_info.icharger->set_limit_charge_enable)
+				htc_batt_info.icharger->set_limit_charge_enable(true);
+		}
+		break;
+	case EVENT_NAVIGATION_STOP:
+		if (chg_limit_active_mask & HTC_BATT_CHG_LIMIT_BIT_NAVI) {
+			chg_limit_reason &= ~HTC_BATT_CHG_LIMIT_BIT_NAVI;
+			if (!chg_limit_reason &&
+					htc_batt_info.icharger &&
+					htc_batt_info.icharger->set_limit_charge_enable)
+				htc_batt_info.icharger->set_limit_charge_enable(false);
+		}
+		break;
+	case EVENT_NETWORK_SEARCH_START:
+		suspend_highfreq_check_reason |= SUSPEND_HIGHFREQ_CHECK_BIT_SEARCH;
+		break;
+	case EVENT_NETWORK_SEARCH_STOP:
+		suspend_highfreq_check_reason &= ~SUSPEND_HIGHFREQ_CHECK_BIT_SEARCH;
+		break;
+	default:
+		pr_warn("unsupported context event (%d)\n", event);
+		return;
+	}
+
+	htc_batt_schedule_batt_info_update();
+}
+
+struct mutex context_event_handler_lock; 
+static int htc_batt_context_event_handler(enum batt_context_event event)
+{
+	int prev_context_state;
+
+	mutex_lock(&context_event_handler_lock);
+	prev_context_state = context_state;
+	
+	switch (event) {
+	case EVENT_TALK_START:
+		if (context_state & CONTEXT_STATE_BIT_TALK)
+			goto exit;
+		context_state |= CONTEXT_STATE_BIT_TALK;
+		break;
+	case EVENT_TALK_STOP:
+		if (!(context_state & CONTEXT_STATE_BIT_TALK))
+			goto exit;
+		context_state &= ~CONTEXT_STATE_BIT_TALK;
+		break;
+	case EVENT_NETWORK_SEARCH_START:
+		if (context_state & CONTEXT_STATE_BIT_SEARCH)
+			goto exit;
+		context_state |= CONTEXT_STATE_BIT_SEARCH;
+		break;
+	case EVENT_NETWORK_SEARCH_STOP:
+		if (!(context_state & CONTEXT_STATE_BIT_SEARCH))
+			goto exit;
+		context_state &= ~CONTEXT_STATE_BIT_SEARCH;
+		break;
+	case EVENT_NAVIGATION_START:
+		if (context_state & CONTEXT_STATE_BIT_NAVIGATION)
+			goto exit;
+		context_state |= CONTEXT_STATE_BIT_NAVIGATION;
+		break;
+	case EVENT_NAVIGATION_STOP:
+		if (!(context_state & CONTEXT_STATE_BIT_NAVIGATION))
+			goto exit;
+		context_state &= ~CONTEXT_STATE_BIT_NAVIGATION;
+		break;
+	default:
+		pr_warn("unsupported context event (%d)\n", event);
+		goto exit;
+	}
+	BATT_LOG("context_state: 0x%x -> 0x%x", prev_context_state, context_state);
+
+	
+	__context_event_handler(event);
+
+exit:
+	mutex_unlock(&context_event_handler_lock);
+	return 0;
+}
+
+static int htc_batt_charger_control(enum charger_control_flag control)
+{
+	int ret = 0;
+
+	BATT_LOG("%s: user switch charger to mode: %u", __func__, control);
+
+	switch (control) {
+		case STOP_CHARGER:
+			chg_dis_user_timer = 1;
+			break;
+		case ENABLE_CHARGER:
+			chg_dis_user_timer = 0;
+			break;
+		case DISABLE_PWRSRC:
+			pwrsrc_dis_reason |= HTC_BATT_PWRSRC_DIS_BIT_API;
+			break;
+		case ENABLE_PWRSRC:
+			pwrsrc_dis_reason &= ~HTC_BATT_PWRSRC_DIS_BIT_API;
+			break;
+
+		case ENABLE_LIMIT_CHARGER:
+		case DISABLE_LIMIT_CHARGER:
+			BATT_LOG("%s: skip charger_contorl(%d)", __func__, control);
+			return ret;
+			break;
+
+		default:
+			BATT_LOG("%s: unsupported charger_contorl(%d)", __func__, control);
+			ret =  -1;
+			break;
+
+	}
+
+	htc_batt_schedule_batt_info_update();
+
+	return ret;
+}
+
+static void htc_batt_set_full_level(int percent)
+{
+	if (percent < 0)
+		htc_batt_info.rep.full_level = 0;
+	else if (100 < percent)
+		htc_batt_info.rep.full_level = 100;
+	else
+		htc_batt_info.rep.full_level = percent;
+
+	BATT_LOG(" set full_level constraint as %d.", percent);
+
+	return;
+}
+
+static int htc_battery_get_rt_attr(enum htc_batt_rt_attr attr, int *val)
+{
+	int ret = 0;
+	switch (attr) {
+	case HTC_BATT_RT_VOLTAGE:
+		ret = htc_batt_info.igauge->get_battery_voltage(val);
+		break;
+	case HTC_BATT_RT_CURRENT:
+		ret = htc_batt_info.igauge->get_battery_current(val);
+		break;
+	case HTC_BATT_RT_TEMPERATURE:
+		ret = htc_batt_info.igauge->get_battery_temperature(val);
+		break;
+	default:
+		ret = -EINVAL;
+		break;
+	}
+	return ret;
+}
+
+static ssize_t htc_battery_show_batt_attr(struct device_attribute *attr,
+					char *buf)
+{
+	int len = 0;
+
+	
+	len += scnprintf(buf + len, PAGE_SIZE - len,
+			"charging_source: %d;\n"
+			"charging_enabled: %d;\n"
+			"overload: %d;\n"
+			"Percentage(%%): %d;\n"
+			"Percentage_raw(%%): %d;\n",
+			htc_batt_info.rep.charging_source,
+			htc_batt_info.rep.charging_enabled,
+			htc_batt_info.rep.overload,
+			htc_batt_info.rep.level,
+			htc_batt_info.rep.level_raw
+			);
+
+	
+	if (htc_batt_info.igauge) {
+#if 0
+		if (htc_batt_info.igauge->name)
+			len += scnprintf(buf + len, PAGE_SIZE - len,
+				"gauge: %s;\n", htc_batt_info.igauge->name);
+#endif
+		if (htc_batt_info.igauge->get_attr_text)
+			len += htc_batt_info.igauge->get_attr_text(buf + len,
+						PAGE_SIZE - len);
+	}
+
+	
+	if (htc_batt_info.icharger) {
+#if 0
+		if (htc_batt_info.icharger->name)
+			len += scnprintf(buf + len, PAGE_SIZE - len,
+				"charger: %s;\n", htc_batt_info.icharger->name);
+#endif
+		if (htc_batt_info.icharger->get_attr_text)
+			len += htc_batt_info.icharger->get_attr_text(buf + len,
+						PAGE_SIZE - len);
+	}
+	return len;
+}
+
+static ssize_t htc_battery_show_cc_attr(struct device_attribute *attr,
+					char *buf)
+{
+	int len = 0, cc_uah = 0;
+
+	
+	if (htc_batt_info.igauge) {
+		if (htc_batt_info.igauge->get_battery_cc) {
+			htc_batt_info.igauge->get_battery_cc(&cc_uah);
+			len += scnprintf(buf + len, PAGE_SIZE - len,
+				"cc:%d\n", cc_uah);
+		}
+	}
+
+	return len;
+}
+
+static int htc_batt_open(struct inode *inode, struct file *filp)
+{
+	int ret = 0;
+
+	BATT_LOG("%s: open misc device driver.", __func__);
+	spin_lock(&htc_batt_info.batt_lock);
+
+	if (!htc_batt_info.is_open)
+		htc_batt_info.is_open = 1;
+	else
+		ret = -EBUSY;
+
+	spin_unlock(&htc_batt_info.batt_lock);
+
+#ifdef CONFIG_ARCH_MSM8X60_LTE
+	if (board_mfg_mode() == 5)
+		cpu_down(1);
+
+#endif
+
+	return ret;
+}
+
+static int htc_batt_release(struct inode *inode, struct file *filp)
+{
+	BATT_LOG("%s: release misc device driver.", __func__);
+	spin_lock(&htc_batt_info.batt_lock);
+	htc_batt_info.is_open = 0;
+	spin_unlock(&htc_batt_info.batt_lock);
+
+	return 0;
+}
+
+static int htc_batt_get_battery_info(struct battery_info_reply *htc_batt_update)
+{
+	htc_batt_update->batt_vol = htc_batt_info.rep.batt_vol;
+	htc_batt_update->batt_id = htc_batt_info.rep.batt_id;
+	htc_batt_update->batt_temp = htc_batt_info.rep.batt_temp;
+	htc_batt_update->batt_current = htc_batt_info.rep.batt_current;
+#if 0
+	htc_batt_update->batt_current = htc_batt_info.rep.batt_current -
+			htc_batt_info.rep.batt_discharg_current;
+	htc_batt_update->batt_discharg_current =
+				htc_batt_info.rep.batt_discharg_current;
+#endif
+	htc_batt_update->level = htc_batt_info.rep.level;
+	htc_batt_update->level_raw = htc_batt_info.rep.level_raw;
+	htc_batt_update->charging_source =
+				htc_batt_info.rep.charging_source;
+	htc_batt_update->charging_enabled =
+				htc_batt_info.rep.charging_enabled;
+	htc_batt_update->full_bat = htc_batt_info.rep.full_bat;
+	htc_batt_update->full_level = htc_batt_info.rep.full_level;
+	htc_batt_update->over_vchg = htc_batt_info.rep.over_vchg;
+	htc_batt_update->temp_fault = htc_batt_info.rep.temp_fault;
+	htc_batt_update->batt_state = htc_batt_info.rep.batt_state;
+	htc_batt_update->overload = htc_batt_info.rep.overload;
+	return 0;
+}
+
+static void batt_set_check_timer(u32 seconds)
+{
+	pr_debug("[BATT] %s(%u sec)\n", __func__, seconds);
+	mod_timer(&htc_batt_timer.batt_timer,
+			jiffies + msecs_to_jiffies(seconds * 1000));
+}
+
+
+u32 htc_batt_getmidvalue(int32_t *value)
+{
+	int i, j, n, len;
+	len = ADC_REPLY_ARRAY_SIZE;
+	for (i = 0; i < len - 1; i++) {
+		for (j = i + 1; j < len; j++) {
+			if (value[i] > value[j]) {
+				n = value[i];
+				value[i] = value[j];
+				value[j] = n;
+			}
+		}
+	}
+
+	return value[len / 2];
+}
+
+#if 0
+static int32_t htc_batt_get_battery_adc(void)
+{
+	int ret = 0;
+	u32 vref = 0;
+	u32 battid_adc = 0;
+	struct battery_adc_reply adc;
+
+	
+	ret = pm8058_htc_config_mpp_and_adc_read(
+			adc.adc_voltage,
+			ADC_REPLY_ARRAY_SIZE,
+			CHANNEL_ADC_BATT_AMON,
+			htc_batt_info.mpp_config->vol[XOADC_MPP],
+			htc_batt_info.mpp_config->vol[PM_MPP_AIN_AMUX]);
+	if (ret)
+		goto get_adc_failed;
+	
+	ret = pm8058_htc_config_mpp_and_adc_read(
+			adc.adc_current,
+			ADC_REPLY_ARRAY_SIZE,
+			CHANNEL_ADC_BATT_AMON,
+			htc_batt_info.mpp_config->curr[XOADC_MPP],
+			htc_batt_info.mpp_config->curr[PM_MPP_AIN_AMUX]);
+	if (ret)
+		goto get_adc_failed;
+	
+	ret = pm8058_htc_config_mpp_and_adc_read(
+			adc.adc_temperature,
+			ADC_REPLY_ARRAY_SIZE,
+			CHANNEL_ADC_BATT_AMON,
+			htc_batt_info.mpp_config->temp[XOADC_MPP],
+			htc_batt_info.mpp_config->temp[PM_MPP_AIN_AMUX]);
+	if (ret)
+		goto get_adc_failed;
+	
+	ret = pm8058_htc_config_mpp_and_adc_read(
+			adc.adc_battid,
+			ADC_REPLY_ARRAY_SIZE,
+			CHANNEL_ADC_BATT_AMON,
+			htc_batt_info.mpp_config->battid[XOADC_MPP],
+			htc_batt_info.mpp_config->battid[PM_MPP_AIN_AMUX]);
+
+	vref = htc_batt_getmidvalue(adc.adc_voltage);
+	battid_adc = htc_batt_getmidvalue(adc.adc_battid);
+
+	BATT_LOG("%s , vref:%d, battid_adc:%d, battid:%d\n", __func__,  vref, battid_adc, battid_adc * 1000 / vref);
+
+	if (ret)
+		goto get_adc_failed;
+
+	memcpy(&htc_batt_info.adc_data, &adc,
+		sizeof(struct battery_adc_reply));
+
+get_adc_failed:
+	return ret;
+}
+#endif
+
+static void batt_regular_timer_handler(unsigned long data)
+{
+	if (htc_batt_info.state & STATE_PREPARE) {
+		htc_batt_info.state |= STATE_WORKQUEUE_PENDING;
+		pr_info("[BATT] %s(): Skip due to htc_batt_info.state=0x%x\n",
+				__func__, htc_batt_info.state);
+	} else {
+		htc_batt_info.state &= ~STATE_WORKQUEUE_PENDING;
+		pr_debug("[BATT] %s(): Run, htc_batt_info.state=0x%x\n",
+				__func__, htc_batt_info.state);
+		htc_batt_schedule_batt_info_update();
+	}
+}
+
+static void batt_check_alarm_handler(struct alarm *alarm)
+{
+	BATT_LOG("alarm handler, but do nothing.");
+	return;
+}
+
+static int bounding_fullly_charged_level(int upperbd, int current_level)
+{
+	static int pingpong = 1;
+	int lowerbd;
+	int b_is_charge_off_by_bounding = 0;
+
+	lowerbd = upperbd - 5; 
+
+	if (lowerbd < 0)
+		lowerbd = 0;
+
+	if (pingpong == 1 && upperbd <= current_level) {
+		pr_info("MFG: lowerbd=%d, upperbd=%d, current=%d,"
+				" pingpong:1->0 turn off\n", lowerbd, upperbd, current_level);
+		b_is_charge_off_by_bounding = 1;
+		pingpong = 0;
+	} else if (pingpong == 0 && lowerbd < current_level) {
+		pr_info("MFG: lowerbd=%d, upperbd=%d, current=%d,"
+				" toward 0, turn off\n", lowerbd, upperbd, current_level);
+		b_is_charge_off_by_bounding = 1;
+	} else if (pingpong == 0 && current_level <= lowerbd) {
+		pr_info("MFG: lowerbd=%d, upperbd=%d, current=%d,"
+				" pingpong:0->1 turn on\n", lowerbd, upperbd, current_level);
+		pingpong = 1;
+	} else {
+		pr_info("MFG: lowerbd=%d, upperbd=%d, current=%d,"
+				" toward %d, turn on\n", lowerbd, upperbd, current_level, pingpong);
+	}
+	return b_is_charge_off_by_bounding;
+}
+
+static inline int is_bounding_fully_charged_level(void)
+{
+	if (0 < htc_batt_info.rep.full_level &&
+			htc_batt_info.rep.full_level < 100)
+		return bounding_fullly_charged_level(
+				htc_batt_info.rep.full_level, htc_batt_info.rep.level);
+	return 0;
+}
+
+static void batt_update_info_from_charger(void)
+{
+	if (!htc_batt_info.icharger) {
+		BATT_LOG("warn: charger interface is not hooked.");
+		return;
+	}
+
+	if (htc_batt_info.icharger->is_batt_temp_fault_disable_chg)
+		htc_batt_info.icharger->is_batt_temp_fault_disable_chg(
+				&charger_dis_temp_fault);
+}
+
+static void batt_update_info_from_gauge(void)
+{
+	if (!htc_batt_info.igauge) {
+		BATT_LOG("warn: gauge interface is not hooked.");
+		return;
+	}
+
+	
+	
+	if (htc_batt_info.igauge->get_battery_voltage)
+		htc_batt_info.igauge->get_battery_voltage(
+				&htc_batt_info.rep.batt_vol);
+	
+	if (htc_batt_info.igauge->get_battery_current)
+		htc_batt_info.igauge->get_battery_current(
+				&htc_batt_info.rep.batt_current);
+	
+	if (htc_batt_info.igauge->get_battery_temperature)
+		htc_batt_info.igauge->get_battery_temperature(
+				&htc_batt_info.rep.batt_temp);
+	
+	if (htc_batt_info.igauge->is_battery_temp_fault)
+		htc_batt_info.igauge->is_battery_temp_fault(
+				&htc_batt_info.rep.temp_fault);
+	
+	if (htc_batt_info.igauge->get_battery_id)
+		htc_batt_info.igauge->get_battery_id(
+				&htc_batt_info.rep.batt_id);
+
+	
+	if (htc_battery_cell_get_cur_cell())
+		htc_batt_info.rep.full_bat = htc_battery_cell_get_cur_cell()->capacity;
+
+	htc_batt_info.igauge->get_battery_soc(
+		&htc_batt_info.rep.level_raw);
+	htc_batt_info.rep.level = htc_batt_info.rep.level_raw;
+	
+	if (htc_batt_info.icharger->is_ovp)
+		htc_batt_info.icharger->is_ovp(&htc_batt_info.rep.over_vchg);
+}
+
+inline static int is_voltage_critical_low(int voltage_mv)
+{
+	return (voltage_mv < htc_batt_info.critical_low_voltage_mv) ? 1 : 0;
+}
+
+static void batt_check_overload(void)
+{
+	static unsigned int overload_count;
+
+	pr_debug("[BATT] Chk overload by CS=%d V=%d I=%d count=%d overload=%d\n",
+			htc_batt_info.rep.charging_source, htc_batt_info.rep.batt_vol,
+			htc_batt_info.rep.batt_current, overload_count, htc_batt_info.rep.overload);
+	if ((htc_batt_info.rep.charging_source > 0) &&
+			(htc_batt_info.rep.batt_vol < htc_batt_info.overload_vol_thr_mv) &&
+			((htc_batt_info.rep.batt_current / 1000) >
+				htc_batt_info.overload_curr_thr_ma)) {
+		if (overload_count++ < 3) {
+			htc_batt_info.rep.overload = 0;
+		} else
+			htc_batt_info.rep.overload = 1;
+	} else { 
+			overload_count = 0;
+			htc_batt_info.rep.overload = 0;
+	}
+}
+
+#define ONE_PERCENT_LIMIT_PERIOD_MS		(1000 * (60 + 10))
+#define FIVE_PERCENT_LIMIT_PERIOD_MS	(1000 * (300 + 10))
+static void batt_level_adjust(unsigned long time_since_last_update_ms)
+{
+	static int first = 1;
+	static int critical_low_enter = 0;
+	int prev_level, drop_level;
+	int is_full = 0;
+	const struct battery_info_reply *prev_batt_info_rep =
+						htc_battery_core_get_batt_info_rep();
+
+	if (!first)
+		prev_level = prev_batt_info_rep->level;
+	else
+		prev_level = htc_batt_info.rep.level;
+	drop_level = prev_level - htc_batt_info.rep.level;
+
+	if (!prev_batt_info_rep->charging_enabled &&
+			!((prev_batt_info_rep->charging_source == 0) &&
+				htc_batt_info.rep.charging_source > 0)) {
+		if (is_voltage_critical_low(htc_batt_info.rep.batt_vol)) {
+			critical_low_enter = 1;
+			
+			pr_info("[BATT] battery level force decreses 6%% from %d%%"
+					" (soc=%d)on critical low (%d mV)\n", prev_level,
+						htc_batt_info.rep.level,
+						htc_batt_info.critical_low_voltage_mv);
+			htc_batt_info.rep.level =
+					(prev_level - 6 > 0) ? (prev_level - 6) :	0;
+		} else {
+			if (time_since_last_update_ms <= ONE_PERCENT_LIMIT_PERIOD_MS) {
+				if (2 < drop_level) {
+					pr_info("[BATT] soc drop = %d%% > 2%% in %lu ms.\n",
+								drop_level,time_since_last_update_ms);
+					htc_batt_info.rep.level = prev_level - 2;
+				} else if (drop_level < 0) {
+					if (critical_low_enter) {
+						pr_warn("[BATT] level increase because of"
+								" exit critical_low!\n");
+					}
+					htc_batt_info.rep.level = prev_level;
+				} else {
+					
+				}
+			} else if ((chg_limit_reason & HTC_BATT_CHG_LIMIT_BIT_TALK) &&
+				(time_since_last_update_ms <= FIVE_PERCENT_LIMIT_PERIOD_MS)) {
+				if (5 < drop_level) {
+					pr_info("[BATT] soc drop = %d%% > 5%% in %lu ms.\n",
+								drop_level,time_since_last_update_ms);
+					htc_batt_info.rep.level = prev_level - 5;
+				} else if (drop_level < 0) {
+					if (critical_low_enter) {
+						pr_warn("[BATT] level increase because of"
+								" exit critical_low!\n");
+					}
+					htc_batt_info.rep.level = prev_level;
+				} else {
+					
+				}
+			} else {
+				if (3 < drop_level) {
+					pr_info("[BATT] soc drop = %d%% > 3%% in %lu ms.\n",
+								drop_level,time_since_last_update_ms);
+					htc_batt_info.rep.level = prev_level - 3;
+				} else if (drop_level < 0) {
+					if (critical_low_enter) {
+						pr_warn("[BATT] level increase because of"
+								" exit critical_low!\n");
+					}
+					htc_batt_info.rep.level = prev_level;
+				} else {
+					
+				}
+			}
+
+			if (critical_low_enter) {
+				critical_low_enter = 0;
+				pr_warn("[BATT] exit critical_low without charge!\n");
+			}
+		}
+		if ((htc_batt_info.rep.level == 0) && (prev_level > 1)) {
+			htc_batt_info.rep.level = 1;
+			pr_info("[BATT] battery level forcely report %d%%"
+					" since prev_level=%d%%\n",
+					htc_batt_info.rep.level, prev_level);
+		}
+	} else {
+		if (htc_batt_info.igauge->is_battery_full) {
+			htc_batt_info.igauge->is_battery_full(&is_full);
+			if (!is_full) {
+				if (99 < htc_batt_info.rep.level)
+					htc_batt_info.rep.level = 99; 
+			} else
+				htc_batt_info.rep.level = 100; 
+		}
+		critical_low_enter = 0;
+	}
+	first = 0;
+}
+
+static void batt_worker(struct work_struct *work)
+{
+	static int first = 1;
+	static int prev_pwrsrc_enabled = 1;
+	static int prev_charging_enabled = 0;
+	int charging_enabled = prev_charging_enabled;
+	int pwrsrc_enabled = prev_pwrsrc_enabled;
+	int prev_chg_src;
+	unsigned long time_since_last_update_ms;
+	unsigned long cur_jiffies;
+
+	
+	cur_jiffies = jiffies;
+	time_since_last_update_ms = htc_batt_timer.total_time_ms +
+		((cur_jiffies - htc_batt_timer.batt_system_jiffies) * MSEC_PER_SEC / HZ);
+	BATT_LOG("%s: total_time since last batt update = %lu ms.",
+				__func__, time_since_last_update_ms);
+	htc_batt_timer.total_time_ms = 0; 
+	htc_batt_timer.batt_system_jiffies = cur_jiffies;
+
+	
+	
+	del_timer_sync(&htc_batt_timer.batt_timer);
+	batt_set_check_timer(htc_batt_timer.time_out);
+
+
+	htc_batt_timer.batt_alarm_status = 0;
+#ifdef CONFIG_HTC_BATT_ALARM
+	htc_batt_timer.batt_critical_alarm_counter = 0;
+#endif
+
+	
+	prev_chg_src = htc_batt_info.rep.charging_source;
+	htc_batt_info.rep.charging_source = latest_chg_src;
+
+	
+	batt_update_info_from_gauge();
+	batt_update_info_from_charger();
+
+	
+	batt_level_adjust(time_since_last_update_ms);
+
+	
+	if (critical_shutdown) {
+		BATT_LOG("critical shutdown (set level=0 to force shutdown)");
+		htc_batt_info.rep.level = 0;
+		critical_shutdown = 0;
+		wake_lock(&batt_shutdown_wake_lock);
+		schedule_delayed_work(&shutdown_work,
+				msecs_to_jiffies(BATT_CRITICAL_VOL_SHUTDOWN_DELAY_MS));
+	}
+	
+	if (critical_alarm_level < 0 && htc_batt_info.rep.level >= 5) {
+		pr_info("[BATT] critical_alarm_level: %d -> 2\n", critical_alarm_level);
+		critical_alarm_level = 2;
+		critical_alarm_level_set = critical_alarm_level + 1;
+	}
+
+	
+	batt_check_overload();
+
+	pr_debug("[BATT] context_state=0x%x, suspend_highfreq_check_reason=0x%x\n",
+			context_state, suspend_highfreq_check_reason);
+
+	
+	if (htc_batt_info.icharger &&
+			htc_batt_info.icharger->enable_5v_output)
+	{
+		if(htc_ext_5v_output_old != htc_ext_5v_output_now)
+		{
+			htc_batt_info.icharger->enable_5v_output(htc_ext_5v_output_now);
+			htc_ext_5v_output_old = htc_ext_5v_output_now;
+		}
+		pr_info("[BATT] enable_5v_output: %d\n", htc_ext_5v_output_now);
+	}
+
+	if (htc_batt_info.rep.charging_source > 0) {
+		
+		if (htc_batt_info.rep.batt_id == HTC_BATTERY_CELL_ID_UNKNOWN)
+			chg_dis_reason |= HTC_BATT_CHG_DIS_BIT_ID; 
+		else
+			chg_dis_reason &= ~HTC_BATT_CHG_DIS_BIT_ID;
+
+		if (charger_dis_temp_fault)
+			chg_dis_reason |= HTC_BATT_CHG_DIS_BIT_TMP;
+		else
+			chg_dis_reason &= ~HTC_BATT_CHG_DIS_BIT_TMP;
+
+		if (chg_dis_user_timer)
+			chg_dis_reason |= HTC_BATT_CHG_DIS_BIT_USR_TMR;
+		else
+			chg_dis_reason &= ~HTC_BATT_CHG_DIS_BIT_USR_TMR;
+
+		if (is_bounding_fully_charged_level()) {
+			chg_dis_reason |= HTC_BATT_CHG_DIS_BIT_MFG;
+			pwrsrc_dis_reason |= HTC_BATT_PWRSRC_DIS_BIT_MFG;
+		} else {
+			chg_dis_reason &= ~HTC_BATT_CHG_DIS_BIT_MFG;
+			pwrsrc_dis_reason &= ~HTC_BATT_PWRSRC_DIS_BIT_MFG;
+		}
+
+		if (htc_batt_info.rep.over_vchg)
+			chg_dis_reason |= HTC_BATT_CHG_DIS_BIT_OVP;
+		else
+			chg_dis_reason &= ~HTC_BATT_CHG_DIS_BIT_OVP;
+
+		
+		if (pwrsrc_dis_reason)
+			pwrsrc_enabled = 0;
+		else
+			pwrsrc_enabled = 1;
+
+		
+		if (chg_dis_reason & chg_dis_control_mask)
+			charging_enabled = HTC_PWR_SOURCE_TYPE_BATT;
+		else
+			charging_enabled = htc_batt_info.rep.charging_source;
+
+		
+		if (chg_dis_reason & chg_dis_active_mask)
+			htc_batt_info.rep.charging_enabled = HTC_PWR_SOURCE_TYPE_BATT;
+		else
+			htc_batt_info.rep.charging_enabled =
+										htc_batt_info.rep.charging_source;
+
+		
+		pr_info("[BATT] prev_chg_src=%d, prev_chg_en=%d,"
+				" chg_dis_reason/control/active=0x%x/0x%x/0x%x,"
+				" chg_limit_reason=0x%x,"
+				" pwrsrc_dis_reason=0x%x, prev_pwrsrc_enabled=%d,"
+				" context_state=0x%x\n",
+					prev_chg_src, prev_charging_enabled,
+					chg_dis_reason,
+					chg_dis_reason & chg_dis_control_mask,
+					chg_dis_reason & chg_dis_active_mask,
+					chg_limit_reason,
+					pwrsrc_dis_reason, prev_pwrsrc_enabled,
+					context_state);
+		if (charging_enabled != prev_charging_enabled ||
+				prev_chg_src != htc_batt_info.rep.charging_source ||
+				first ||
+				pwrsrc_enabled != prev_pwrsrc_enabled) {
+			
+			if (prev_chg_src != htc_batt_info.rep.charging_source ||
+					first) {
+				BATT_LOG("set_pwrsrc_and_charger_enable(%d, %d, %d)",
+							htc_batt_info.rep.charging_source,
+							charging_enabled,
+							pwrsrc_enabled);
+				if (htc_batt_info.icharger &&
+						htc_batt_info.icharger->set_pwrsrc_and_charger_enable)
+					htc_batt_info.icharger->set_pwrsrc_and_charger_enable(
+								htc_batt_info.rep.charging_source,
+								charging_enabled,
+								pwrsrc_enabled);
+			} else {
+				if (pwrsrc_enabled != prev_pwrsrc_enabled) {
+					BATT_LOG("set_pwrsrc_enable(%d)", pwrsrc_enabled);
+					if (htc_batt_info.icharger &&
+						htc_batt_info.icharger->set_pwrsrc_enable)
+						htc_batt_info.icharger->set_pwrsrc_enable(
+													pwrsrc_enabled);
+				}
+				if (charging_enabled != prev_charging_enabled) {
+					BATT_LOG("set_charger_enable(%d)", charging_enabled);
+					if (htc_batt_info.icharger &&
+						htc_batt_info.icharger->set_charger_enable)
+						htc_batt_info.icharger->set_charger_enable(
+													charging_enabled);
+				}
+			}
+		}
+	} else {
+		
+		if (prev_chg_src != htc_batt_info.rep.charging_source || first) {
+			chg_dis_reason = 0; 
+			charging_enabled = 0; 
+			pwrsrc_enabled = 0; 
+			BATT_LOG("set_pwrsrc_and_charger_enable(%d, %d, %d)",
+						HTC_PWR_SOURCE_TYPE_BATT,
+						charging_enabled,
+						pwrsrc_enabled);
+			if (htc_batt_info.icharger &&
+						htc_batt_info.icharger->set_pwrsrc_and_charger_enable)
+				htc_batt_info.icharger->set_pwrsrc_and_charger_enable(
+								HTC_PWR_SOURCE_TYPE_BATT,
+								charging_enabled, pwrsrc_enabled);
+			
+			htc_batt_info.rep.charging_enabled =
+								htc_batt_info.rep.charging_source;
+		}
+	}
+
+	
+	if (htc_batt_info.icharger) {
+		htc_batt_info.icharger->dump_all();
+	}
+
+
+	
+	htc_battery_core_update_changed();
+
+	
+	if (0 <= critical_alarm_level &&
+					critical_alarm_level < critical_alarm_level_set) {
+		critical_alarm_level_set = critical_alarm_level;
+		pr_info("[BATT] set voltage alarm level=%d\n", critical_alarm_level);
+		htc_batt_info.igauge->set_lower_voltage_alarm_threshold(
+					htc_batt_info.critical_alarm_voltage_mv
+					+ (BATT_CRITICAL_ALARM_STEP * critical_alarm_level));
+		htc_batt_info.igauge->enable_lower_voltage_alarm(1);
+	}
+
+	first = 0;
+	prev_charging_enabled = charging_enabled;
+	prev_pwrsrc_enabled = pwrsrc_enabled;
+
+	wake_unlock(&htc_batt_timer.battery_lock);
+	pr_info("[BATT] %s: done\n", __func__);
+	return;
+}
+
+static long htc_batt_ioctl(struct file *filp,
+			unsigned int cmd, unsigned long arg)
+{
+	int ret = 0;
+
+	wake_lock(&htc_batt_timer.battery_lock);
+
+	switch (cmd) {
+	case HTC_BATT_IOCTL_READ_SOURCE: {
+		if (copy_to_user((void __user *)arg,
+			&htc_batt_info.rep.charging_source, sizeof(u32)))
+			ret = -EFAULT;
+		break;
+	}
+	case HTC_BATT_IOCTL_SET_BATT_ALARM: {
+		u32 time_out = 0;
+		if (copy_from_user(&time_out, (void *)arg, sizeof(u32))) {
+			ret = -EFAULT;
+			break;
+		}
+
+		htc_batt_timer.time_out = time_out;
+		if (!htc_battery_initial) {
+			htc_battery_initial = 1;
+			batt_set_check_timer(htc_batt_timer.time_out);
+		}
+		break;
+	}
+	case HTC_BATT_IOCTL_GET_ADC_VREF: {
+		if (copy_to_user((void __user *)arg, &htc_batt_info.adc_vref,
+				sizeof(htc_batt_info.adc_vref))) {
+			BATT_ERR("copy_to_user failed!");
+			ret = -EFAULT;
+		}
+		break;
+	}
+	case HTC_BATT_IOCTL_GET_ADC_ALL: {
+		if (copy_to_user((void __user *)arg, &htc_batt_info.adc_data,
+					sizeof(struct battery_adc_reply))) {
+			BATT_ERR("copy_to_user failed!");
+			ret = -EFAULT;
+		}
+		break;
+	}
+	case HTC_BATT_IOCTL_CHARGER_CONTROL: {
+		u32 charger_mode = 0;
+		if (copy_from_user(&charger_mode, (void *)arg, sizeof(u32))) {
+			ret = -EFAULT;
+			break;
+		}
+		BATT_LOG("do charger control = %u", charger_mode);
+		htc_battery_set_charging(charger_mode);
+		break;
+	}
+	case HTC_BATT_IOCTL_UPDATE_BATT_INFO: {
+		mutex_lock(&htc_batt_info.info_lock);
+		if (copy_from_user(&htc_batt_info.rep, (void *)arg,
+					sizeof(struct battery_info_reply))) {
+			BATT_ERR("copy_from_user failed!");
+			ret = -EFAULT;
+			mutex_unlock(&htc_batt_info.info_lock);
+			break;
+		}
+		mutex_unlock(&htc_batt_info.info_lock);
+
+		BATT_LOG("ioctl: battery level update: %u",
+			htc_batt_info.rep.level);
+
+#ifdef CONFIG_HTC_BATT_ALARM
+		
+		if (screen_state == 1) {
+			if (battery_vol_alarm_mode !=
+				BATT_ALARM_CRITICAL_MODE)
+				batt_set_voltage_alarm_mode(
+					BATT_ALARM_CRITICAL_MODE);
+		}
+#endif
+		htc_battery_core_update_changed();
+		break;
+	}
+	case HTC_BATT_IOCTL_BATT_DEBUG_LOG:
+		if (copy_from_user(htc_batt_info.debug_log, (void *)arg,
+					DEBUG_LOG_LENGTH)) {
+			BATT_ERR("copy debug log from user failed!");
+			ret = -EFAULT;
+		}
+		break;
+	case HTC_BATT_IOCTL_SET_VOLTAGE_ALARM: {
+#ifdef CONFIG_HTC_BATT_ALARM
+#else
+		struct battery_vol_alarm alarm_data;
+
+#endif
+		if (copy_from_user(&alarm_data, (void *)arg,
+					sizeof(struct battery_vol_alarm))) {
+			BATT_ERR("user set batt alarm failed!");
+			ret = -EFAULT;
+			break;
+		}
+
+		htc_batt_timer.batt_alarm_status = 0;
+		htc_batt_timer.batt_alarm_enabled = alarm_data.enable;
+
+
+		BATT_LOG("Set lower threshold: %d, upper threshold: %d, "
+			"Enabled:%u.", alarm_data.lower_threshold,
+			alarm_data.upper_threshold, alarm_data.enable);
+		break;
+	}
+	case HTC_BATT_IOCTL_SET_ALARM_TIMER_FLAG: {
+		
+		unsigned int flag;
+		if (copy_from_user(&flag, (void *)arg, sizeof(unsigned int))) {
+			BATT_ERR("Set timer type into alarm failed!");
+			ret = -EFAULT;
+			break;
+		}
+		htc_batt_timer.alarm_timer_flag = flag;
+		BATT_LOG("Set alarm timer flag:%u", flag);
+		break;
+	}
+	default:
+		BATT_ERR("%s: no matched ioctl cmd", __func__);
+		break;
+	}
+
+	wake_unlock(&htc_batt_timer.battery_lock);
+
+	return ret;
+}
+
+static void shutdown_worker(struct work_struct *work)
+{
+	BATT_LOG("shutdown device");
+	kernel_power_off();
+	wake_unlock(&batt_shutdown_wake_lock);
+}
+
+static void mbat_in_func(struct work_struct *work)
+{
+#if defined(CONFIG_MACH_RUBY) || defined(CONFIG_MACH_HOLIDAY) || defined(CONFIG_MACH_VIGOR)
+	
+#define LTE_GPIO_MBAT_IN (61)
+	if (gpio_get_value(LTE_GPIO_MBAT_IN) == 0) {
+		pr_info("re-enable MBAT_IN irq!! due to false alarm\n");
+		enable_irq(MSM_GPIO_TO_INT(LTE_GPIO_MBAT_IN));
+		return;
+	}
+#endif
+
+	BATT_LOG("shut down device due to MBAT_IN interrupt");
+	htc_battery_set_charging(0);
+	machine_power_off();
+
+}
+#if 0
+static irqreturn_t mbat_int_handler(int irq, void *data)
+{
+	struct htc_battery_platform_data *pdata = data;
+
+	disable_irq_nosync(pdata->gpio_mbat_in);
+
+	schedule_delayed_work(&mbat_in_struct, msecs_to_jiffies(50));
+
+	return IRQ_HANDLED;
+}
+#endif
+
+const struct file_operations htc_batt_fops = {
+	.owner = THIS_MODULE,
+	.open = htc_batt_open,
+	.release = htc_batt_release,
+	.unlocked_ioctl = htc_batt_ioctl,
+};
+
+static struct miscdevice htc_batt_device_node = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "htc_batt",
+	.fops = &htc_batt_fops,
+};
+
+static void htc_batt_kobject_release(struct kobject *kobj)
+{
+	printk(KERN_ERR "htc_batt_kobject_release.\n");
+	return;
+}
+
+static struct kobj_type htc_batt_ktype = {
+	.release = htc_batt_kobject_release,
+};
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+static void htc_battery_early_suspend(struct early_suspend *h)
+{
+#ifdef CONFIG_HTC_BATT_ALARM
+	screen_state = 0;
+	batt_set_voltage_alarm_mode(BATT_ALARM_DISABLE_MODE);
+#endif
+	return;
+}
+
+static void htc_battery_late_resume(struct early_suspend *h)
+{
+#ifdef CONFIG_HTC_BATT_ALARM
+	screen_state = 1;
+	batt_set_voltage_alarm_mode(BATT_ALARM_CRITICAL_MODE);
+#endif
+	htc_batt_schedule_batt_info_update();
+}
+#endif 
+
+#define CHECH_TIME_TOLERANCE_MS	(1000)
+static int htc_battery_prepare(struct device *dev)
+{
+	ktime_t interval;
+	ktime_t slack = ktime_set(0, 0);
+	ktime_t next_alarm;
+	struct timespec xtime;
+	unsigned long cur_jiffies;
+	s64 next_alarm_sec = 0;
+	int check_time = 0;
+
+	htc_batt_info.state |= STATE_PREPARE;
+	xtime = CURRENT_TIME;
+	cur_jiffies = jiffies;
+	htc_batt_timer.total_time_ms += (cur_jiffies -
+			htc_batt_timer.batt_system_jiffies) * MSEC_PER_SEC / HZ;
+	htc_batt_timer.batt_system_jiffies = cur_jiffies;
+	htc_batt_timer.batt_suspend_ms = xtime.tv_sec * MSEC_PER_SEC +
+					xtime.tv_nsec / NSEC_PER_MSEC;
+
+	if (suspend_highfreq_check_reason)
+		check_time = BATT_SUSPEND_HIGHFREQ_CHECK_TIME;
+	else
+		check_time = BATT_SUSPEND_CHECK_TIME;
+
+	interval = ktime_set(check_time - htc_batt_timer.total_time_ms / 1000, 0);
+	next_alarm_sec = div_s64(interval.tv64, NSEC_PER_SEC);
+	
+	if (next_alarm_sec <= 1) {
+		BATT_LOG("%s: passing time:%lu ms, trigger batt_work immediately."
+			"(suspend_highfreq_check_reason=0x%x)", __func__,
+			htc_batt_timer.total_time_ms,
+			suspend_highfreq_check_reason);
+		htc_batt_schedule_batt_info_update();
+		return -EBUSY;
+	}
+
+	BATT_LOG("%s: passing time:%lu ms, alarm will be triggered after %lld sec."
+		"(suspend_highfreq_check_reason=0x%x, htc_batt_info.state=0x%x)",
+		__func__, htc_batt_timer.total_time_ms, next_alarm_sec,
+		suspend_highfreq_check_reason, htc_batt_info.state);
+
+	next_alarm = ktime_add(alarm_get_elapsed_realtime(), interval);
+	alarm_start_range(&htc_batt_timer.batt_check_wakeup_alarm,
+				next_alarm, ktime_add(next_alarm, slack));
+
+	return 0;
+}
+
+static void htc_battery_complete(struct device *dev)
+{
+	unsigned long resume_ms;
+	unsigned long sr_time_period_ms;
+	unsigned long check_time;
+	struct timespec xtime;
+
+	htc_batt_info.state &= ~STATE_PREPARE;
+	xtime = CURRENT_TIME;
+	htc_batt_timer.batt_system_jiffies = jiffies;
+	resume_ms = xtime.tv_sec * MSEC_PER_SEC + xtime.tv_nsec / NSEC_PER_MSEC;
+	sr_time_period_ms = resume_ms - htc_batt_timer.batt_suspend_ms;
+	htc_batt_timer.total_time_ms += sr_time_period_ms;
+
+	BATT_LOG("%s: sr_time_period=%lu ms; total passing time=%lu ms."
+			"htc_batt_info.state=0x%x",
+			__func__, sr_time_period_ms, htc_batt_timer.total_time_ms,
+			htc_batt_info.state);
+
+	if (suspend_highfreq_check_reason)
+		check_time = BATT_SUSPEND_HIGHFREQ_CHECK_TIME * MSEC_PER_SEC;
+	else
+		check_time = BATT_SUSPEND_CHECK_TIME * MSEC_PER_SEC;
+
+	check_time -= CHECH_TIME_TOLERANCE_MS;
+
+	if (htc_batt_timer.total_time_ms >= check_time ||
+			(htc_batt_info.state & STATE_WORKQUEUE_PENDING)) {
+		htc_batt_info.state &= ~STATE_WORKQUEUE_PENDING;
+		BATT_LOG("trigger batt_work while resume."
+				"(suspend_highfreq_check_reason=0x%x, "
+				"htc_batt_info.state=0x%x)",
+				suspend_highfreq_check_reason, htc_batt_info.state);
+		htc_batt_schedule_batt_info_update();
+	}
+
+	return;
+}
+
+static struct dev_pm_ops htc_battery_8960_pm_ops = {
+	.prepare = htc_battery_prepare,
+	.complete = htc_battery_complete,
+};
+
+static int htc_battery_probe(struct platform_device *pdev)
+{
+	int i, rc = 0;
+	struct htc_battery_platform_data *pdata = pdev->dev.platform_data;
+	struct htc_battery_core *htc_battery_core_ptr;
+	pr_info("[BATT] %s() in\n", __func__);
+
+	htc_battery_core_ptr = kmalloc(sizeof(struct htc_battery_core),
+					GFP_KERNEL);
+	if (!htc_battery_core_ptr) {
+		BATT_ERR("%s: kmalloc failed for htc_battery_core_ptr.",
+				__func__);
+		return -ENOMEM;
+	}
+
+	INIT_DELAYED_WORK(&mbat_in_struct, mbat_in_func);
+	INIT_DELAYED_WORK(&shutdown_work, shutdown_worker);
+#if 0
+	if (pdata->gpio_mbat_in_trigger_level == MBAT_IN_HIGH_TRIGGER)
+		rc = request_irq(pdata->gpio_mbat_in,
+				mbat_int_handler, IRQF_TRIGGER_HIGH,
+				"mbat_in", pdata);
+	else if (pdata->gpio_mbat_in_trigger_level == MBAT_IN_LOW_TRIGGER)
+		rc = request_irq(pdata->gpio_mbat_in,
+				mbat_int_handler, IRQF_TRIGGER_LOW,
+				"mbat_in", pdata);
+	if (rc)
+		BATT_ERR("request mbat_in irq failed!");
+	else
+		set_irq_wake(pdata->gpio_mbat_in, 1);
+#endif
+
+	htc_battery_core_ptr->func_get_batt_rt_attr = htc_battery_get_rt_attr;
+	htc_battery_core_ptr->func_show_batt_attr = htc_battery_show_batt_attr;
+	htc_battery_core_ptr->func_show_cc_attr = htc_battery_show_cc_attr;
+	htc_battery_core_ptr->func_get_battery_info = htc_batt_get_battery_info;
+	htc_battery_core_ptr->func_charger_control = htc_batt_charger_control;
+	htc_battery_core_ptr->func_set_full_level = htc_batt_set_full_level;
+	htc_battery_core_ptr->func_context_event_handler =
+											htc_batt_context_event_handler;
+
+	htc_battery_core_register(&pdev->dev, htc_battery_core_ptr);
+
+	htc_batt_info.device_id = pdev->id;
+#if 0
+	htc_batt_info.guage_driver = pdata->guage_driver;
+	htc_batt_info.charger = pdata->charger;
+#endif
+
+	htc_batt_info.is_open = 0;
+
+	for (i = 0; i < ADC_REPLY_ARRAY_SIZE; i++)
+		htc_batt_info.adc_vref[i] = 66;
+
+	
+	htc_batt_info.critical_low_voltage_mv = pdata->critical_low_voltage_mv;
+	htc_batt_info.critical_alarm_voltage_mv = pdata->critical_alarm_voltage_mv;
+	htc_batt_info.overload_vol_thr_mv = pdata->overload_vol_thr_mv;
+	htc_batt_info.overload_curr_thr_ma = pdata->overload_curr_thr_ma;
+	chg_limit_active_mask = pdata->chg_limit_active_mask;
+	htc_batt_info.igauge = &pdata->igauge;
+	htc_batt_info.icharger = &pdata->icharger;
+#if 0
+	htc_batt_info.mpp_config = &pdata->mpp_data;
+#endif
+
+	INIT_WORK(&htc_batt_timer.batt_work, batt_worker);
+	init_timer(&htc_batt_timer.batt_timer);
+	htc_batt_timer.batt_timer.function = batt_regular_timer_handler;
+	alarm_init(&htc_batt_timer.batt_check_wakeup_alarm,
+			ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
+			batt_check_alarm_handler);
+	htc_batt_timer.batt_wq = create_singlethread_workqueue("batt_timer");
+
+	rc = misc_register(&htc_batt_device_node);
+	if (rc) {
+		BATT_ERR("Unable to register misc device %d",
+			MISC_DYNAMIC_MINOR);
+		goto fail;
+	}
+
+	htc_batt_kset = kset_create_and_add("event_to_daemon", NULL,
+			kobject_get(&htc_batt_device_node.this_device->kobj));
+	if (!htc_batt_kset) {
+		rc = -ENOMEM;
+		goto fail;
+	}
+
+	htc_batt_info.batt_timer_kobj.kset = htc_batt_kset;
+	rc = kobject_init_and_add(&htc_batt_info.batt_timer_kobj,
+				&htc_batt_ktype, NULL, "htc_batt_timer");
+	if (rc) {
+		BATT_ERR("init kobject htc_batt_timer failed.");
+		kobject_put(&htc_batt_info.batt_timer_kobj);
+		goto fail;
+	}
+
+	htc_batt_info.batt_cable_kobj.kset = htc_batt_kset;
+	rc = kobject_init_and_add(&htc_batt_info.batt_cable_kobj,
+				&htc_batt_ktype, NULL, "htc_cable_detect");
+	if (rc) {
+		BATT_ERR("init kobject htc_cable_timer failed.");
+		kobject_put(&htc_batt_info.batt_timer_kobj);
+		goto fail;
+	}
+
+	if (htc_batt_info.icharger &&
+			htc_batt_info.icharger->charger_change_notifier_register)
+		htc_batt_info.icharger->charger_change_notifier_register(
+											&cable_status_notifier);
+
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+	early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 1;
+	early_suspend.suspend = htc_battery_early_suspend;
+	early_suspend.resume = htc_battery_late_resume;
+	register_early_suspend(&early_suspend);
+#endif
+
+htc_batt_timer.time_out = BATT_TIMER_UPDATE_TIME;
+batt_set_check_timer(htc_batt_timer.time_out);
+	BATT_LOG("htc_battery_probe(): finish");
+
+fail:
+	kfree(htc_battery_core_ptr);
+	return rc;
+}
+
+static struct platform_driver htc_battery_driver = {
+	.probe	= htc_battery_probe,
+	.driver	= {
+		.name	= "htc_battery",
+		.owner	= THIS_MODULE,
+		.pm = &htc_battery_8960_pm_ops,
+	},
+};
+
+static int __init htc_battery_init(void)
+{
+	htc_battery_initial = 0;
+	htc_ext_5v_output_old = 0;
+	htc_ext_5v_output_now = 0;
+	htc_full_level_flag = 0;
+	spin_lock_init(&htc_batt_info.batt_lock);
+	wake_lock_init(&htc_batt_info.vbus_wake_lock, WAKE_LOCK_SUSPEND,
+			"vbus_present");
+	wake_lock_init(&htc_batt_timer.battery_lock, WAKE_LOCK_SUSPEND,
+			"htc_battery_8960");
+	wake_lock_init(&voltage_alarm_wake_lock, WAKE_LOCK_SUSPEND,
+			"htc_voltage_alarm");
+	wake_lock_init(&batt_shutdown_wake_lock, WAKE_LOCK_SUSPEND,
+			"batt_shutdown");
+	mutex_init(&htc_batt_info.info_lock);
+	mutex_init(&htc_batt_timer.schedule_lock);
+	mutex_init(&cable_notifier_lock);
+	mutex_init(&context_event_handler_lock);
+#ifdef CONFIG_HTC_BATT_ALARM
+	mutex_init(&batt_set_alarm_lock);
+#endif
+
+	
+
+	platform_driver_register(&htc_battery_driver);
+
+	
+	htc_batt_info.rep.batt_vol = 3700;
+	htc_batt_info.rep.batt_id = 1;
+	htc_batt_info.rep.batt_temp = 250;
+	htc_batt_info.rep.level = 33;
+	htc_batt_info.rep.level_raw = 33;
+	htc_batt_info.rep.full_bat = 1579999;
+	htc_batt_info.rep.full_level = 100;
+	htc_batt_info.rep.batt_state = 0;
+	htc_batt_info.rep.temp_fault = -1;
+	htc_batt_info.rep.overload = 0;
+	htc_batt_timer.total_time_ms = 0;
+	htc_batt_timer.batt_system_jiffies = jiffies;
+	htc_batt_timer.batt_alarm_status = 0;
+	htc_batt_timer.alarm_timer_flag = 0;
+
+#ifdef CONFIG_HTC_BATT_ALARM
+	battery_vol_alarm_mode = BATT_ALARM_NORMAL_MODE;
+	screen_state = 1;
+	alarm_data.lower_threshold = 2800;
+	alarm_data.upper_threshold = 4400;
+#endif
+
+	return 0;
+}
+
+module_init(htc_battery_init);
+MODULE_DESCRIPTION("HTC Battery Driver");
+MODULE_LICENSE("GPL");
+
diff --git a/arch/arm/mach-msm/htc/htc_battery_cell.c b/arch/arm/mach-msm/htc/htc_battery_cell.c
new file mode 100644
index 0000000..d3d6404
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_battery_cell.c
@@ -0,0 +1,171 @@
+/* arch/arm/mach-msm/htc_battery_cell.c
+ *
+ * Copyright (C) 2011 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <mach/htc_battery_cell.h>
+
+static struct htc_battery_cell *cells;	
+static int cell_num;					
+static struct htc_battery_cell *cur_cell; 
+
+static unsigned int hv_authenticated;
+
+static struct htc_battery_cell default_cell = {
+	.model_name = "DEVELOPMENT",
+	.capacity = 1234,
+	.id = HTC_BATTERY_CELL_ID_DEVELOP,
+	.id_raw_min = INT_MIN,
+	.id_raw_max = INT_MAX,
+	.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+	.voltage_max = 4200,
+	.voltage_min = 3200,
+	.chg_param = NULL,
+	.gauge_param = NULL,
+};
+
+int htc_battery_cell_init(struct htc_battery_cell *ary, int ary_size)
+{
+	if (ary == NULL || ary_size == 0) {
+		pr_warn("[BATT] %s: default cell initiated\n", __func__);
+		cells = &default_cell;
+		cell_num = 1;
+		return 1;
+	}
+
+	cells = ary;
+	cell_num = ary_size;
+	pr_info("[BATT] %s: %d cells initiated.\n", __func__, cell_num);
+	return 0;
+}
+
+inline struct htc_battery_cell *htc_battery_cell_get_cur_cell(void)
+{
+	return cur_cell;
+}
+
+inline struct htc_battery_cell *htc_battery_cell_set_cur_cell(
+			struct htc_battery_cell *cell)
+{
+	cur_cell = cell;
+	return cur_cell;
+}
+
+inline int htc_battery_cell_set_cur_cell_by_id(int id)
+{
+	int i = 0;
+	struct htc_battery_cell *pcell = NULL;
+
+	pr_debug("%s: find id=%d\n", __func__, id);
+	for (i = 0; i < cell_num; i++) {
+		pcell = &cells[i];
+		pr_debug("    cell[%d].id=%d\n", i, pcell->id);
+		if (pcell->id == id) {
+			pr_info("%s: set_cur_cell(id=%d)\n", __func__, id);
+			cur_cell = pcell;
+			return 0;
+		}
+	}
+	pr_err("[BATT] %s: cell id=%d cannot be found\n", __func__, id);
+	return 1;
+}
+
+inline void *htc_battery_cell_get_cur_cell_charger_cdata(void)
+{
+	if (cur_cell)
+		return cur_cell->chg_param;
+	return NULL;
+}
+
+inline void *htc_battery_cell_get_cur_cell_gauge_cdata(void)
+{
+	if (cur_cell)
+		return cur_cell->gauge_param;
+	return NULL;
+}
+
+inline struct htc_battery_cell *htc_battery_cell_find(int id_raw)
+{
+	int i = 0;
+	struct htc_battery_cell *pcell = NULL;
+
+	pr_debug("%s: find id_raw=%d\n", __func__, id_raw);
+	for (i = 0; i < cell_num; i++) {
+		pcell = &cells[i];
+		pr_debug("    i=%d, (min,max)=(%d,%d)\n",
+				i, pcell->id_raw_min, pcell->id_raw_max);
+		if ((pcell->id_raw_min <= id_raw)
+				&& (id_raw <= pcell->id_raw_max))
+			return pcell;
+	}
+	pr_err("[BATT] %s: cell id can not be identified (id_raw=%d)\n",
+			__func__, id_raw);
+	
+	return pcell;
+}
+
+#define HTC_BATTERY_CELL_CHECK_UNKNOWN_COUNT	(2)
+inline int htc_battery_cell_find_and_set_id_auto(int id_raw)
+{
+	static int unknown_count = 0;
+	struct htc_battery_cell *pcell = NULL;
+
+	pcell = htc_battery_cell_find(id_raw);
+	if (!pcell) {
+		pr_err("[BATT] cell pointer is NULL so unknown ID is return.\n");
+		return HTC_BATTERY_CELL_ID_UNKNOWN;
+	}
+	
+	if (cur_cell == pcell)
+		return pcell->id;
+	
+	if (cur_cell) {
+		if (pcell->id == HTC_BATTERY_CELL_ID_UNKNOWN) {
+			unknown_count++;
+			if (unknown_count < HTC_BATTERY_CELL_CHECK_UNKNOWN_COUNT)
+				return cur_cell->id; 
+		} else
+			unknown_count = 0;
+	} else {
+		
+		pr_warn("[BATT]warn: cur_cell is initiated by %s", __func__);
+		cur_cell = pcell;
+		return pcell->id;
+	}
+	pr_debug("[BATT]dbg: battery cell id %d -> %d\n",
+			cur_cell->id, pcell->id);
+	cur_cell = pcell;
+	return pcell->id;
+}
+
+inline int htc_battery_cell_hv_authenticated(void)
+{
+	return hv_authenticated;
+}
+
+static int __init check_dq_setup(char *str)
+{
+	if (!strcmp(str, "PASS")) {
+		hv_authenticated = 1;
+		pr_info("[BATT] HV authentication passed.\n");
+	} else {
+		hv_authenticated = 0;
+		pr_info("[BATT] HV authentication failed.\n");
+	}
+	return 0; 
+}
+__setup("androidboot.dq=", check_dq_setup);
+
+
diff --git a/arch/arm/mach-msm/htc/htc_battery_core.c b/arch/arm/mach-msm/htc/htc_battery_core.c
new file mode 100644
index 0000000..a159293
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_battery_core.c
@@ -0,0 +1,992 @@
+/*
+ *
+ * Copyright (C) 2011 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/err.h>
+#include <linux/power_supply.h>
+#include <linux/platform_device.h>
+#include <linux/debugfs.h>
+#include <linux/wakelock.h>
+#include <linux/gpio.h>
+#include <linux/rtc.h>
+#include <linux/workqueue.h>
+#include <mach/htc_battery_core.h>
+#include <linux/android_alarm.h>
+#include <mach/board_htc.h>
+
+
+static ssize_t htc_battery_show_property(struct device *dev,
+					struct device_attribute *attr,
+					char *buf);
+
+static ssize_t htc_battery_rt_attr_show(struct device *dev,
+					struct device_attribute *attr,
+					char *buf);
+
+static int htc_power_get_property(struct power_supply *psy,
+				enum power_supply_property psp,
+				union power_supply_propval *val);
+
+static int htc_battery_get_property(struct power_supply *psy,
+				    enum power_supply_property psp,
+				    union power_supply_propval *val);
+
+static ssize_t htc_battery_charger_ctrl_timer(struct device *dev,
+				    struct device_attribute *attr,
+				    const char *buf, size_t count);
+
+#if 1
+#define HTC_BATTERY_ATTR(_name)                                             \
+{                                                                           \
+	.attr = { .name = #_name, .mode = S_IRUGO},  \
+	.show = htc_battery_show_property,                                  \
+	.store = NULL,                                                      \
+}
+#else
+#define HTC_BATTERY_ATTR(_name)                                             \
+{                                                                           \
+	.attr = { .name = #_name, .mode = S_IRUGO, .owner = THIS_MODULE },  \
+	.show = htc_battery_show_property,                                  \
+	.store = NULL,                                                      \
+}
+#endif
+
+struct htc_battery_core_info {
+	int present;
+	int htc_charge_full;
+	unsigned long update_time;
+	struct mutex info_lock;
+	struct battery_info_reply rep;
+	struct htc_battery_core func;
+};
+
+static struct htc_battery_core_info battery_core_info;
+static int battery_register = 1;
+static int battery_over_loading;
+
+static struct alarm batt_charger_ctrl_alarm;
+static struct work_struct batt_charger_ctrl_work;
+struct workqueue_struct *batt_charger_ctrl_wq;
+static unsigned int charger_ctrl_stat;
+
+static int test_power_monitor;
+
+static enum power_supply_property htc_battery_properties[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_OVERLOAD,
+};
+
+static enum power_supply_property htc_power_properties[] = {
+	POWER_SUPPLY_PROP_ONLINE,
+};
+
+static char *supply_list[] = {
+	"battery",
+};
+
+static struct power_supply htc_power_supplies[] = {
+	{
+		.name = "battery",
+		.type = POWER_SUPPLY_TYPE_BATTERY,
+		.properties = htc_battery_properties,
+		.num_properties = ARRAY_SIZE(htc_battery_properties),
+		.get_property = htc_battery_get_property,
+	},
+	{
+		.name = "usb",
+		.type = POWER_SUPPLY_TYPE_USB,
+		.supplied_to = supply_list,
+		.num_supplicants = ARRAY_SIZE(supply_list),
+		.properties = htc_power_properties,
+		.num_properties = ARRAY_SIZE(htc_power_properties),
+		.get_property = htc_power_get_property,
+	},
+	{
+		.name = "ac",
+		.type = POWER_SUPPLY_TYPE_MAINS,
+		.supplied_to = supply_list,
+		.num_supplicants = ARRAY_SIZE(supply_list),
+		.properties = htc_power_properties,
+		.num_properties = ARRAY_SIZE(htc_power_properties),
+		.get_property = htc_power_get_property,
+	},
+	{
+		.name = "wireless",
+		.type = POWER_SUPPLY_TYPE_WIRELESS,
+		.supplied_to = supply_list,
+		.num_supplicants = ARRAY_SIZE(supply_list),
+		.properties = htc_power_properties,
+		.num_properties = ARRAY_SIZE(htc_power_properties),
+		.get_property = htc_power_get_property,
+	},
+};
+
+static BLOCKING_NOTIFIER_HEAD(wireless_charger_notifier_list);
+int register_notifier_wireless_charger(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_register(&wireless_charger_notifier_list, nb);
+}
+
+int unregister_notifier_wireless_charger(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_unregister(&wireless_charger_notifier_list, nb);
+}
+
+static int zcharge_enabled;
+int htc_battery_get_zcharge_mode(void)
+{
+	return zcharge_enabled;
+}
+static int __init enable_zcharge_setup(char *str)
+{
+	int rc;
+	unsigned long cal;
+
+	rc = strict_strtoul(str, 10, &cal);
+
+	if (rc)
+		return rc;
+
+	zcharge_enabled = cal;
+	return 1;
+}
+__setup("enable_zcharge=", enable_zcharge_setup);
+
+static int htc_battery_get_charging_status(void)
+{
+	enum charger_type_t charger;
+	int ret;
+
+	mutex_lock(&battery_core_info.info_lock);
+	charger = battery_core_info.rep.charging_source;
+	mutex_unlock(&battery_core_info.info_lock);
+
+	if (battery_core_info.rep.batt_id == 255)
+		charger = CHARGER_UNKNOWN;
+
+	switch (charger) {
+	case CHARGER_BATTERY:
+		ret = POWER_SUPPLY_STATUS_NOT_CHARGING;
+		break;
+	case CHARGER_USB:
+	case CHARGER_AC:
+	case CHARGER_9V_AC:
+	case CHARGER_WIRELESS:
+	case CHARGER_MHL_AC:
+		if (battery_core_info.htc_charge_full)
+			ret = POWER_SUPPLY_STATUS_FULL;
+		else {
+			if (battery_core_info.rep.charging_enabled != 0)
+				ret = POWER_SUPPLY_STATUS_CHARGING;
+			else
+				ret = POWER_SUPPLY_STATUS_DISCHARGING;
+		}
+		break;
+	default:
+		ret = POWER_SUPPLY_STATUS_UNKNOWN;
+	}
+
+	return ret;
+}
+
+static ssize_t htc_battery_show_batt_attr(struct device *dev,
+					struct device_attribute *attr,
+					char *buf)
+{
+	return battery_core_info.func.func_show_batt_attr(attr, buf);
+}
+
+static ssize_t htc_battery_show_cc_attr(struct device *dev,
+					struct device_attribute *attr,
+					char *buf)
+{
+	return battery_core_info.func.func_show_cc_attr(attr, buf);
+}
+
+static ssize_t htc_battery_set_delta(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	unsigned long delta = 0;
+
+	delta = simple_strtoul(buf, NULL, 10);
+
+	if (delta > 100)
+		return -EINVAL;
+
+	return count;
+}
+
+static ssize_t htc_battery_debug_flag(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	unsigned long debug_flag;
+	debug_flag = simple_strtoul(buf, NULL, 10);
+
+	if (debug_flag > 100 || debug_flag == 0)
+		return -EINVAL;
+
+	return 0;
+}
+
+static ssize_t htc_battery_set_full_level(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	int rc = 0;
+	unsigned long percent = 100;
+
+	rc = strict_strtoul(buf, 10, &percent);
+	if (rc)
+		return rc;
+
+	if (percent > 100 || percent == 0)
+		return -EINVAL;
+
+	if (!battery_core_info.func.func_set_full_level) {
+		BATT_ERR("No set full level function!");
+		return -ENOENT;
+	}
+
+	battery_core_info.func.func_set_full_level(percent);
+
+	return count;
+}
+
+int htc_battery_charger_disable()
+{
+	int rc = 0;
+
+	if (!battery_core_info.func.func_charger_control) {
+		BATT_ERR("No charger control function!");
+		return -ENOENT;
+	}
+	rc = battery_core_info.func.func_charger_control(STOP_CHARGER);
+	if (rc < 0)
+		BATT_ERR("charger control failed!");
+
+	return rc;
+}
+
+int htc_battery_pwrsrc_disable()
+{
+	int rc = 0;
+
+	if (!battery_core_info.func.func_charger_control) {
+		BATT_ERR("No charger control function!");
+		return -ENOENT;
+	}
+	rc = battery_core_info.func.func_charger_control(DISABLE_PWRSRC);
+	if (rc < 0)
+		BATT_ERR("charger control failed!");
+
+	return rc;
+}
+
+static ssize_t htc_battery_charger_stat(struct device *dev,
+				struct device_attribute *attr,
+				char *buf)
+{
+	int i = 0;
+
+	i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n", charger_ctrl_stat);
+
+	return i;
+}
+
+static ssize_t htc_battery_charger_switch(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	unsigned long enable = 0;
+	int rc = 0;
+
+	rc = strict_strtoul(buf, 10, &enable);
+	if (rc)
+		return rc;
+
+	BATT_LOG("Set charger_control:%lu", enable);
+	if (enable >= END_CHARGER)
+		return -EINVAL;
+
+	if (!battery_core_info.func.func_charger_control) {
+		BATT_ERR("No charger control function!");
+		return -ENOENT;
+	}
+
+	rc = battery_core_info.func.func_charger_control(enable);
+	if (rc < 0) {
+		BATT_ERR("charger control failed!");
+		return rc;
+	}
+	charger_ctrl_stat = enable;
+
+	alarm_cancel(&batt_charger_ctrl_alarm);
+
+	return count;
+}
+
+static ssize_t htc_battery_set_phone_call(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	unsigned long phone_call = 0;
+	int rc = 0;
+
+	rc = strict_strtoul(buf, 10, &phone_call);
+	if (rc)
+		return rc;
+
+	BATT_LOG("set context phone_call=%lu", phone_call);
+
+	if (!battery_core_info.func.func_context_event_handler) {
+		BATT_ERR("No context_event_notify function!");
+		return -ENOENT;
+	}
+
+	if (phone_call)
+		battery_core_info.func.func_context_event_handler(EVENT_TALK_START);
+	else
+		battery_core_info.func.func_context_event_handler(EVENT_TALK_STOP);
+
+	return count;
+}
+static ssize_t htc_battery_set_network_search(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	unsigned long network_search = 0;
+	int rc = 0;
+
+	rc = strict_strtoul(buf, 10, &network_search);
+	if (rc)
+		return rc;
+
+	BATT_LOG("Set context network_search=%lu", network_search);
+
+	if (!battery_core_info.func.func_context_event_handler) {
+		BATT_ERR("No context_event_notify function!");
+		return -ENOENT;
+	}
+
+	if (network_search) {
+		battery_core_info.func.func_context_event_handler(
+									EVENT_NETWORK_SEARCH_START);
+	} else {
+		battery_core_info.func.func_context_event_handler(
+									EVENT_NETWORK_SEARCH_STOP);
+	}
+
+	return count;
+}
+static ssize_t htc_battery_set_navigation(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	unsigned long navigation = 0;
+	int rc = 0;
+
+	rc = strict_strtoul(buf, 10, &navigation);
+	if (rc)
+		return rc;
+
+	BATT_LOG("Set context navigation=%lu", navigation);
+
+	if (!battery_core_info.func.func_context_event_handler) {
+		BATT_ERR("No context_event_notify function!");
+		return -ENOENT;
+	}
+
+	if (navigation) {
+		battery_core_info.func.func_context_event_handler(
+									EVENT_NAVIGATION_START);
+	} else {
+		battery_core_info.func.func_context_event_handler(
+									EVENT_NAVIGATION_STOP);
+	}
+
+	return count;
+}
+
+static struct device_attribute htc_battery_attrs[] = {
+	HTC_BATTERY_ATTR(batt_id),
+	HTC_BATTERY_ATTR(batt_vol),
+	HTC_BATTERY_ATTR(batt_temp),
+	HTC_BATTERY_ATTR(batt_current),
+	HTC_BATTERY_ATTR(charging_source),
+	HTC_BATTERY_ATTR(charging_enabled),
+	HTC_BATTERY_ATTR(full_bat),
+	HTC_BATTERY_ATTR(over_vchg),
+	HTC_BATTERY_ATTR(batt_state),
+
+	__ATTR(batt_attr_text, S_IRUGO, htc_battery_show_batt_attr, NULL),
+	__ATTR(batt_power_meter, S_IRUGO, htc_battery_show_cc_attr, NULL),
+};
+
+static struct device_attribute htc_set_delta_attrs[] = {
+	__ATTR(delta, S_IWUSR | S_IWGRP, NULL, htc_battery_set_delta),
+	__ATTR(full_level, S_IWUSR | S_IWGRP, NULL,
+		htc_battery_set_full_level),
+	__ATTR(batt_debug_flag, S_IWUSR | S_IWGRP, NULL,
+		htc_battery_debug_flag),
+	__ATTR(charger_control, S_IWUSR | S_IWGRP, htc_battery_charger_stat,
+		htc_battery_charger_switch),
+	__ATTR(charger_timer, S_IWUSR | S_IWGRP, NULL,
+		htc_battery_charger_ctrl_timer),
+	__ATTR(phone_call, S_IWUSR | S_IWGRP, NULL,
+		htc_battery_set_phone_call),
+	__ATTR(network_search, S_IWUSR | S_IWGRP, NULL,
+		htc_battery_set_network_search),
+	__ATTR(navigation, S_IWUSR | S_IWGRP, NULL,
+		htc_battery_set_navigation),
+};
+
+static struct device_attribute htc_battery_rt_attrs[] = {
+	__ATTR(batt_vol_now, S_IRUGO, htc_battery_rt_attr_show, NULL),
+	__ATTR(batt_current_now, S_IRUGO, htc_battery_rt_attr_show, NULL),
+	__ATTR(batt_temp_now, S_IRUGO, htc_battery_rt_attr_show, NULL),
+};
+
+
+static int htc_battery_create_attrs(struct device *dev)
+{
+	int i = 0, j = 0, k = 0, rc = 0;
+
+	for (i = 0; i < ARRAY_SIZE(htc_battery_attrs); i++) {
+		rc = device_create_file(dev, &htc_battery_attrs[i]);
+		if (rc)
+			goto htc_attrs_failed;
+	}
+
+	for (j = 0; j < ARRAY_SIZE(htc_set_delta_attrs); j++) {
+		rc = device_create_file(dev, &htc_set_delta_attrs[j]);
+		if (rc)
+			goto htc_delta_attrs_failed;
+	}
+
+	for (k = 0; k < ARRAY_SIZE(htc_battery_rt_attrs); k++) {
+		rc = device_create_file(dev, &htc_battery_rt_attrs[k]);
+		if (rc)
+			goto htc_rt_attrs_failed;
+	}
+
+	goto succeed;
+
+htc_rt_attrs_failed:
+	while (k--)
+		device_remove_file(dev, &htc_battery_rt_attrs[k]);
+htc_delta_attrs_failed:
+	while (j--)
+		device_remove_file(dev, &htc_set_delta_attrs[j]);
+htc_attrs_failed:
+	while (i--)
+		device_remove_file(dev, &htc_battery_attrs[i]);
+succeed:
+	return rc;
+}
+
+static int htc_battery_get_property(struct power_supply *psy,
+				enum power_supply_property psp,
+				union power_supply_propval *val)
+{
+	switch (psp) {
+	case POWER_SUPPLY_PROP_STATUS:
+		val->intval = htc_battery_get_charging_status();
+		break;
+	case POWER_SUPPLY_PROP_HEALTH:
+		val->intval = POWER_SUPPLY_HEALTH_GOOD;
+		if (battery_core_info.rep.temp_fault != -1) {
+			if (battery_core_info.rep.temp_fault == 1)
+				val->intval =  POWER_SUPPLY_HEALTH_OVERHEAT;
+		}
+		else if (battery_core_info.rep.batt_temp >= 480 ||
+			battery_core_info.rep.batt_temp <= 0)
+			val->intval =  POWER_SUPPLY_HEALTH_OVERHEAT;
+		break;
+	case POWER_SUPPLY_PROP_PRESENT:
+		val->intval = battery_core_info.present;
+		break;
+	case POWER_SUPPLY_PROP_TECHNOLOGY:
+		val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
+		break;
+	case POWER_SUPPLY_PROP_CAPACITY:
+		mutex_lock(&battery_core_info.info_lock);
+		val->intval = battery_core_info.rep.level;
+		mutex_unlock(&battery_core_info.info_lock);
+		break;
+	case POWER_SUPPLY_PROP_OVERLOAD:
+		val->intval = battery_core_info.rep.overload;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int htc_power_get_property(struct power_supply *psy,
+				enum power_supply_property psp,
+				union power_supply_propval *val)
+{
+	enum charger_type_t charger;
+
+	mutex_lock(&battery_core_info.info_lock);
+
+	charger = battery_core_info.rep.charging_source;
+
+#if 0
+	if (battery_core_info.rep.batt_id == 255)
+		charger = CHARGER_BATTERY;
+#endif
+
+	mutex_unlock(&battery_core_info.info_lock);
+
+	switch (psp) {
+	case POWER_SUPPLY_PROP_ONLINE:
+		if (psy->type == POWER_SUPPLY_TYPE_MAINS) {
+			if (charger == CHARGER_AC ||
+			    charger == CHARGER_9V_AC
+			    ||  charger == CHARGER_MHL_AC)
+				val->intval = 1;
+			else
+				val->intval = 0;
+		} else if (psy->type == POWER_SUPPLY_TYPE_USB)
+			val->intval = (charger ==  CHARGER_USB ? 1 : 0);
+		else if (psy->type == POWER_SUPPLY_TYPE_WIRELESS)
+			val->intval = (charger ==  CHARGER_WIRELESS ? 1 : 0);
+		else
+			val->intval = 0;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static ssize_t htc_battery_show_property(struct device *dev,
+					struct device_attribute *attr,
+					char *buf)
+{
+	int i = 0;
+	const ptrdiff_t off = attr - htc_battery_attrs;
+
+	mutex_lock(&battery_core_info.info_lock);
+
+	switch (off) {
+	case BATT_ID:
+		i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n",
+				battery_core_info.rep.batt_id);
+		break;
+	case BATT_VOL:
+		i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n",
+				battery_core_info.rep.batt_vol);
+		break;
+	case BATT_TEMP:
+		i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n",
+				battery_core_info.rep.batt_temp);
+		break;
+	case BATT_CURRENT:
+		i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n",
+				battery_core_info.rep.batt_current);
+		break;
+	case CHARGING_SOURCE:
+		if(battery_core_info.rep.charging_source == CHARGER_MHL_AC) {
+			i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n", CHARGER_AC);
+		}
+		else {
+			i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n",
+				battery_core_info.rep.charging_source);
+		}
+		break;
+	case CHARGING_ENABLED:
+		i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n",
+				battery_core_info.rep.charging_enabled);
+		break;
+	case FULL_BAT:
+		i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n",
+				battery_core_info.rep.full_bat);
+		break;
+	case OVER_VCHG:
+		i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n",
+				battery_core_info.rep.over_vchg);
+		break;
+	case BATT_STATE:
+		i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n",
+				battery_core_info.rep.batt_state);
+		break;
+	case OVERLOAD:
+		i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n",
+				battery_core_info.rep.overload);
+		break;
+	default:
+		i = -EINVAL;
+	}
+	mutex_unlock(&battery_core_info.info_lock);
+
+	if (i < 0)
+		BATT_ERR("%s: battery: attribute is not supported: %d",
+			__func__, off);
+
+	return i;
+}
+
+static ssize_t htc_battery_rt_attr_show(struct device *dev,
+					struct device_attribute *attr,
+					char *buf)
+{
+	int i = 0;
+	int val = 0;
+	int rc = 0;
+	const ptrdiff_t attr_index = attr - htc_battery_rt_attrs;
+
+	if (!battery_core_info.func.func_get_batt_rt_attr) {
+		BATT_ERR("%s: func_get_batt_rt_attr does not exist", __func__);
+		return -EINVAL;
+	}
+
+	rc = battery_core_info.func.func_get_batt_rt_attr(attr_index, &val);
+	if (rc) {
+		BATT_ERR("%s: get_batt_rt_attrs[%d] failed", __func__, attr_index);
+		return -EINVAL;
+	}
+
+	i += scnprintf(buf + i, PAGE_SIZE - i, "%d\n", val);
+	return i;
+}
+
+static ssize_t htc_battery_charger_ctrl_timer(struct device *dev,
+					struct device_attribute *attr,
+					const char *buf, size_t count)
+{
+	int rc;
+	unsigned long time_out = 0;
+	ktime_t interval;
+	ktime_t next_alarm;
+
+	rc = strict_strtoul(buf, 10, &time_out);
+	if (rc)
+		return rc;
+
+	if (time_out > 65536)
+		return -EINVAL;
+
+	if (time_out > 0) {
+		rc = battery_core_info.func.func_charger_control(STOP_CHARGER);
+		if (rc < 0) {
+			BATT_ERR("charger control failed!");
+			return rc;
+		}
+		interval = ktime_set(time_out, 0);
+		next_alarm = ktime_add(alarm_get_elapsed_realtime(), interval);
+		alarm_start_range(&batt_charger_ctrl_alarm,
+					next_alarm, next_alarm);
+		charger_ctrl_stat = STOP_CHARGER;
+	} else if (time_out == 0) {
+		rc = battery_core_info.func.func_charger_control(
+							ENABLE_CHARGER);
+		if (rc < 0) {
+			BATT_ERR("charger control failed!");
+			return rc;
+		}
+		alarm_cancel(&batt_charger_ctrl_alarm);
+		charger_ctrl_stat = ENABLE_CHARGER;
+	}
+
+	return count;
+}
+
+static void batt_charger_ctrl_func(struct work_struct *work)
+{
+	int rc;
+
+	rc = battery_core_info.func.func_charger_control(ENABLE_CHARGER);
+	if (rc) {
+		BATT_ERR("charger control failed!");
+		return;
+	}
+
+	charger_ctrl_stat = (unsigned int)ENABLE_CHARGER;
+}
+
+static void batt_charger_ctrl_alarm_handler(struct alarm *alarm)
+{
+	BATT_LOG("charger control alarm is timeout.");
+
+	queue_work(batt_charger_ctrl_wq, &batt_charger_ctrl_work);
+}
+
+int htc_battery_core_update_changed(void)
+{
+	struct battery_info_reply new_batt_info_rep;
+	int is_send_batt_uevent = 0;
+	int is_send_usb_uevent = 0;
+	int is_send_ac_uevent = 0;
+	int is_send_wireless_charger_uevent = 0;
+	static int batt_temp_over_68c_count = 0;
+
+	if (battery_register) {
+		BATT_ERR("No battery driver exists.");
+		return -1;
+	}
+
+	mutex_lock(&battery_core_info.info_lock);
+	memcpy(&new_batt_info_rep, &battery_core_info.rep, sizeof(struct battery_info_reply));
+	mutex_unlock(&battery_core_info.info_lock);
+	if (battery_core_info.func.func_get_battery_info) {
+		battery_core_info.func.func_get_battery_info(&new_batt_info_rep);
+	} else {
+		BATT_ERR("no func_get_battery_info hooked.");
+		return -EINVAL;
+	}
+
+	mutex_lock(&battery_core_info.info_lock);
+	if (battery_core_info.rep.charging_source != new_batt_info_rep.charging_source) {
+		if (CHARGER_BATTERY == battery_core_info.rep.charging_source ||
+			CHARGER_BATTERY == new_batt_info_rep.charging_source)
+			is_send_batt_uevent = 1;
+		if (CHARGER_USB == battery_core_info.rep.charging_source ||
+			CHARGER_USB == new_batt_info_rep.charging_source)
+			is_send_usb_uevent = 1;
+		if (CHARGER_AC == battery_core_info.rep.charging_source ||
+			CHARGER_AC == new_batt_info_rep.charging_source)
+			is_send_ac_uevent = 1;
+		if (CHARGER_MHL_AC == battery_core_info.rep.charging_source ||
+			CHARGER_MHL_AC == new_batt_info_rep.charging_source)
+			is_send_ac_uevent = 1;
+		if (CHARGER_WIRELESS == battery_core_info.rep.charging_source ||
+			CHARGER_WIRELESS == new_batt_info_rep.charging_source)
+			is_send_wireless_charger_uevent = 1;
+
+	}
+	if ((!is_send_batt_uevent) &&
+		((battery_core_info.rep.level != new_batt_info_rep.level) ||
+		(battery_core_info.rep.batt_vol != new_batt_info_rep.batt_vol) ||
+		(battery_core_info.rep.over_vchg != new_batt_info_rep.over_vchg) ||
+		(battery_core_info.rep.batt_temp != new_batt_info_rep.batt_temp))) {
+		is_send_batt_uevent = 1;
+	}
+
+	if ((battery_core_info.rep.charging_enabled != 0) &&
+		(new_batt_info_rep.charging_enabled != 0)) {
+		if (battery_core_info.rep.level > new_batt_info_rep.level)
+			battery_over_loading++;
+		else
+			battery_over_loading = 0;
+	}
+
+	memcpy(&battery_core_info.rep, &new_batt_info_rep, sizeof(struct battery_info_reply));
+
+	if (battery_core_info.rep.batt_temp > 680) {
+		batt_temp_over_68c_count++;
+		if (batt_temp_over_68c_count < 3) {
+			pr_info("[BATT] batt_temp_over_68c_count=%d, (temp=%d)\n",
+					batt_temp_over_68c_count, battery_core_info.rep.batt_temp);
+			battery_core_info.rep.batt_temp = 680;
+		}
+	} else {
+		
+		batt_temp_over_68c_count = 0;
+	}
+
+	
+	if (test_power_monitor) {
+		BATT_LOG("test_power_monitor is set: overwrite fake batt info.");
+		battery_core_info.rep.batt_id = 77;
+		battery_core_info.rep.batt_temp = 330;
+		battery_core_info.rep.level = 77;
+		battery_core_info.rep.temp_fault = 0;
+	}
+
+	if (battery_core_info.rep.charging_source <= 0) {
+		if (battery_core_info.rep.batt_id == 255) {
+			pr_info("[BATT] Ignore invalid id when no charging_source");
+			battery_core_info.rep.batt_id = 66;
+		}
+	}
+#if 0
+	battery_core_info.rep.batt_vol = new_batt_info_rep.batt_vol;
+	battery_core_info.rep.batt_id = new_batt_info_rep.batt_id;
+	battery_core_info.rep.batt_temp = new_batt_info_rep.batt_temp;
+	battery_core_info.rep.batt_current = new_batt_info_rep.batt_current;
+	battery_core_info.rep.batt_discharg_current = new_batt_info_rep.batt_discharg_current;
+	battery_core_info.rep.level = new_batt_info_rep.level;
+	battery_core_info.rep.charging_source = new_batt_info_rep.charging_source;
+	battery_core_info.rep.charging_enabled = new_batt_info_rep.charging_enabled;
+	battery_core_info.rep.full_bat = new_batt_info_rep.full_bat;
+	battery_core_info.rep.over_vchg = new_batt_info_rep.over_vchg;
+	battery_core_info.rep.temp_fault = new_batt_info_rep.temp_fault;
+	battery_core_info.rep.batt_state = new_batt_info_rep.batt_state;
+#endif
+
+	if (battery_core_info.rep.charging_source == CHARGER_BATTERY)
+		battery_core_info.htc_charge_full = 0;
+	else {
+		if (battery_core_info.htc_charge_full &&
+				(battery_core_info.rep.level == 100))
+			battery_core_info.htc_charge_full = 1;
+		else {
+			if (battery_core_info.rep.level == 100)
+				battery_core_info.htc_charge_full = 1;
+			else
+				battery_core_info.htc_charge_full = 0;
+		}
+
+		
+		if (battery_over_loading >= 2) {
+			battery_core_info.htc_charge_full = 0;
+			battery_over_loading = 0;
+		}
+	}
+
+	battery_core_info.update_time = jiffies;
+	mutex_unlock(&battery_core_info.info_lock);
+
+	BATT_LOG("ID=%d,level=%d,level_raw=%d,vol=%d,temp=%d,current=%d,"
+		"chg_src=%d,chg_en=%d,full_bat=%d,over_vchg=%d,"
+		"batt_state=%d,overload=%d,ui_chg_full=%d",
+			battery_core_info.rep.batt_id,
+			battery_core_info.rep.level,
+			battery_core_info.rep.level_raw,
+			battery_core_info.rep.batt_vol,
+			battery_core_info.rep.batt_temp,
+			battery_core_info.rep.batt_current,
+			battery_core_info.rep.charging_source,
+			battery_core_info.rep.charging_enabled,
+			battery_core_info.rep.full_bat,
+			battery_core_info.rep.over_vchg,
+			battery_core_info.rep.batt_state,
+			battery_core_info.rep.overload,
+			battery_core_info.htc_charge_full);
+
+
+	
+	if (is_send_batt_uevent) {
+		power_supply_changed(&htc_power_supplies[BATTERY_SUPPLY]);
+		BATT_LOG("power_supply_changed: battery");
+	}
+	if (is_send_usb_uevent) {
+		power_supply_changed(&htc_power_supplies[USB_SUPPLY]);
+		BATT_LOG("power_supply_changed: usb");
+	}
+	if (is_send_ac_uevent) {
+		power_supply_changed(&htc_power_supplies[AC_SUPPLY]);
+		BATT_LOG("power_supply_changed: ac");
+	}
+	if (is_send_wireless_charger_uevent) {
+		power_supply_changed(&htc_power_supplies[WIRELESS_SUPPLY]);
+		BATT_LOG("power_supply_changed: wireless");
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(htc_battery_core_update_changed);
+
+int htc_battery_core_register(struct device *dev,
+				struct htc_battery_core *htc_battery)
+{
+	int i, rc = 0;
+
+	if (!battery_register) {
+		BATT_ERR("Only one battery driver could exist.");
+		return -1;
+	}
+	battery_register = 0;
+
+	test_power_monitor =
+		(get_kernel_flag() & KERNEL_FLAG_TEST_PWR_SUPPLY) ? 1 : 0;
+
+	mutex_init(&battery_core_info.info_lock);
+
+	if (htc_battery->func_get_batt_rt_attr)
+		battery_core_info.func.func_get_batt_rt_attr =
+					htc_battery->func_get_batt_rt_attr;
+	if (htc_battery->func_show_batt_attr)
+		battery_core_info.func.func_show_batt_attr =
+					htc_battery->func_show_batt_attr;
+	if (htc_battery->func_show_cc_attr)
+		battery_core_info.func.func_show_cc_attr =
+					htc_battery->func_show_cc_attr;
+	if (htc_battery->func_get_battery_info)
+		battery_core_info.func.func_get_battery_info =
+					htc_battery->func_get_battery_info;
+	if (htc_battery->func_charger_control)
+		battery_core_info.func.func_charger_control =
+					htc_battery->func_charger_control;
+	if (htc_battery->func_context_event_handler)
+		battery_core_info.func.func_context_event_handler =
+					htc_battery->func_context_event_handler;
+
+	if (htc_battery->func_set_full_level)
+		battery_core_info.func.func_set_full_level =
+					htc_battery->func_set_full_level;
+
+	
+	for (i = 0; i < ARRAY_SIZE(htc_power_supplies); i++) {
+		rc = power_supply_register(dev, &htc_power_supplies[i]);
+		if (rc)
+			BATT_ERR("Failed to register power supply"
+				" (%d)\n", rc);
+	}
+
+	
+	htc_battery_create_attrs(htc_power_supplies[CHARGER_BATTERY].dev);
+
+	
+	charger_ctrl_stat = ENABLE_CHARGER;
+	INIT_WORK(&batt_charger_ctrl_work, batt_charger_ctrl_func);
+	alarm_init(&batt_charger_ctrl_alarm,
+			ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
+			batt_charger_ctrl_alarm_handler);
+	batt_charger_ctrl_wq =
+			create_singlethread_workqueue("charger_ctrl_timer");
+
+	
+	battery_core_info.update_time = jiffies;
+	battery_core_info.present = 1;
+	battery_core_info.htc_charge_full = 0;
+	battery_core_info.rep.charging_source = CHARGER_BATTERY;
+	battery_core_info.rep.batt_id = 1;
+	battery_core_info.rep.batt_vol = 4000;
+	battery_core_info.rep.batt_temp = 285;
+	battery_core_info.rep.batt_current = 162;
+	battery_core_info.rep.level = 66;
+	battery_core_info.rep.level_raw = 0;
+	battery_core_info.rep.full_bat = 1580000;
+	battery_core_info.rep.full_level = 100;
+	
+	battery_core_info.rep.temp_fault = -1;
+	
+	battery_core_info.rep.batt_state = 0;
+	battery_core_info.rep.overload = 0;
+
+	battery_over_loading = 0;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(htc_battery_core_register);
+
+const struct battery_info_reply* htc_battery_core_get_batt_info_rep(void)
+{
+	return &battery_core_info.rep;
+}
+EXPORT_SYMBOL_GPL(htc_battery_core_get_batt_info_rep);
diff --git a/arch/arm/mach-msm/htc/htc_bdaddress.c b/arch/arm/mach-msm/htc/htc_bdaddress.c
new file mode 100644
index 0000000..d3b9a47
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_bdaddress.c
@@ -0,0 +1,68 @@
+/* arch/arm/mach-msm/htc_bluetooth.c
+ *
+ * Code to extract Bluetooth bd_address information
+ * from ATAG set up by the bootloader.
+ *
+ * Copyright (C) 2010 HTC Corporation
+ * Author:Yomin Lin <yomin_lin@htc.com>
+ * Author:Allen Ou <allen_ou@htc.com>
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <asm/setup.h>
+#include <mach/htc_bdaddress.h>
+
+#define ATAG_BT_DEBUG
+
+#define ATAG_BLUETOOTH 0x43294329
+#define MAX_BT_SIZE 0x8U
+
+static unsigned char bt_bd_ram[MAX_BT_SIZE];
+static char bdaddress[20];
+
+static unsigned char *get_bt_bd_ram(void)
+{
+	return (bt_bd_ram);
+}
+
+static int __init parse_tag_bt(const struct tag *tag)
+{
+	unsigned char *dptr = (unsigned char *)(&tag->u);
+	unsigned size;
+	#ifdef ATAG_BT_DEBUG
+    unsigned i;
+	#endif
+
+	size = min((tag->hdr.size-2)*sizeof(__u32), MAX_BT_SIZE);
+	memcpy((void *)bt_bd_ram, (void *)dptr, size);
+
+	#ifdef ATAG_BT_DEBUG
+	printk(KERN_INFO "BT Data size= %d, 0x%x,",
+			tag->hdr.size, tag->hdr.tag);
+
+	for (i = 0; i < size; i++)
+		printk(KERN_INFO "%02x,", bt_bd_ram[i]);
+	#endif
+
+	return 0;
+}
+__tagtable(ATAG_BLUETOOTH, parse_tag_bt);
+
+void bt_export_bd_address(void)
+{
+	unsigned char cTemp[6];
+
+	memcpy(cTemp, get_bt_bd_ram(), 6);
+	sprintf(bdaddress, "%02x:%02x:%02x:%02x:%02x:%02x",
+			cTemp[0], cTemp[1], cTemp[2],
+			cTemp[3], cTemp[4], cTemp[5]);
+
+	printk(KERN_INFO "YoYo--BD_ADDRESS=%s\n", bdaddress);
+}
+module_param_string(bdaddress, bdaddress, sizeof(bdaddress), S_IWUSR | S_IRUGO);
+MODULE_PARM_DESC(bdaddress, "BT MAC ADDRESS");
+
diff --git a/arch/arm/mach-msm/htc/htc_headset_mgr.c b/arch/arm/mach-msm/htc/htc_headset_mgr.c
new file mode 100644
index 0000000..96c6fc2
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_headset_mgr.c
@@ -0,0 +1,2111 @@
+/*
+ *
+ * /arch/arm/mach-msm/htc_headset_mgr.c
+ *
+ * HTC headset manager driver.
+ *
+ * Copyright (C) 2010 HTC, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/gpio.h>
+#include <linux/gpio_event.h>
+#include <linux/rtc.h>
+#include <linux/slab.h>
+
+#include <mach/htc_headset_mgr.h>
+
+#define DRIVER_NAME "HS_MGR"
+
+static struct workqueue_struct *detect_wq;
+static void insert_detect_work_func(struct work_struct *work);
+static DECLARE_DELAYED_WORK(insert_detect_work, insert_detect_work_func);
+static void remove_detect_work_func(struct work_struct *work);
+static DECLARE_DELAYED_WORK(remove_detect_work, remove_detect_work_func);
+static void mic_detect_work_func(struct work_struct *work);
+static DECLARE_DELAYED_WORK(mic_detect_work, mic_detect_work_func);
+
+static struct workqueue_struct *button_wq;
+static void button_35mm_work_func(struct work_struct *work);
+static DECLARE_DELAYED_WORK(button_35mm_work, button_35mm_work_func);
+
+static void button_1wire_work_func(struct work_struct *work);
+static DECLARE_DELAYED_WORK(button_1wire_work, button_1wire_work_func);
+
+static struct workqueue_struct *debug_wq;
+static void debug_work_func(struct work_struct *work);
+static DECLARE_WORK(debug_work, debug_work_func);
+
+static int hs_mgr_rpc_call(struct msm_rpc_server *server,
+			    struct rpc_request_hdr *req, unsigned len);
+
+static struct msm_rpc_server hs_rpc_server = {
+	.prog		= HS_RPC_SERVER_PROG,
+	.vers		= HS_RPC_SERVER_VERS,
+	.rpc_call	= hs_mgr_rpc_call,
+};
+
+struct button_work {
+	struct delayed_work key_work;
+	int key_code;
+};
+
+static struct htc_headset_mgr_info *hi;
+static struct hs_notifier_func hs_mgr_notifier;
+
+static int	hpin_report = 0,
+		hpin_bounce = 0,
+		key_report = 0,
+		key_bounce = 0;
+
+static void init_next_driver(void)
+{
+	int i = hi->driver_init_seq;
+
+	if (!hi->pdata.headset_devices_num)
+		return;
+
+	if (i < hi->pdata.headset_devices_num) {
+		hi->driver_init_seq++;
+		platform_device_register(hi->pdata.headset_devices[i]);
+	}
+}
+
+int hs_debug_log_state(void)
+{
+	return (hi->debug_flag & DEBUG_FLAG_LOG) ? 1 : 0;
+}
+
+void hs_notify_driver_ready(char *name)
+{
+	HS_LOG("%s ready", name);
+	init_next_driver();
+}
+
+void hs_notify_hpin_irq(void)
+{
+	hi->hpin_jiffies = jiffies;
+	HS_LOG("HPIN IRQ");
+	hpin_bounce++;
+}
+
+struct class *hs_get_attribute_class(void)
+{
+	return hi->htc_accessory_class;
+}
+
+int hs_hpin_stable(void)
+{
+	unsigned long last_hpin_jiffies = 0;
+	unsigned long unstable_jiffies = 1.2 * HZ;
+
+	HS_DBG();
+
+	last_hpin_jiffies = hi->hpin_jiffies;
+
+	if (time_before_eq(jiffies, last_hpin_jiffies + unstable_jiffies))
+		return 0;
+
+	return 1;
+}
+
+static int get_mic_state(void)
+{
+	HS_DBG();
+
+	switch (hi->hs_35mm_type) {
+	case HEADSET_MIC:
+	case HEADSET_METRICO:
+	case HEADSET_BEATS:
+	case HEADSET_BEATS_SOLO:
+		return 1;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+static void update_mic_status(int count)
+{
+	HS_DBG();
+
+	if (hi->is_ext_insert) {
+		HS_LOG("Start MIC status polling (%d)", count);
+		cancel_delayed_work_sync(&mic_detect_work);
+		hi->mic_detect_counter = count;
+		queue_delayed_work(detect_wq, &mic_detect_work,
+				   HS_JIFFIES_MIC_DETECT);
+	}
+}
+
+static void headset_notifier_update(int id)
+{
+	if (!hi) {
+		HS_LOG("HS_MGR driver is not ready");
+		return;
+	}
+
+	switch (id) {
+	case HEADSET_REG_HPIN_GPIO:
+		break;
+	case HEADSET_REG_REMOTE_ADC:
+		update_mic_status(HS_DEF_MIC_DETECT_COUNT);
+		break;
+	case HEADSET_REG_REMOTE_KEYCODE:
+	case HEADSET_REG_RPC_KEY:
+		break;
+	case HEADSET_REG_MIC_STATUS:
+		update_mic_status(HS_DEF_MIC_DETECT_COUNT);
+		break;
+	case HEADSET_REG_MIC_BIAS:
+		if (!hi->pdata.headset_power &&
+		    hi->hs_35mm_type != HEADSET_UNPLUG) {
+			hs_mgr_notifier.mic_bias_enable(1);
+			hi->mic_bias_state = 1;
+			msleep(HS_DELAY_MIC_BIAS);
+			update_mic_status(HS_DEF_MIC_DETECT_COUNT);
+		}
+		break;
+	case HEADSET_REG_MIC_SELECT:
+	case HEADSET_REG_KEY_INT_ENABLE:
+	case HEADSET_REG_KEY_ENABLE:
+	case HEADSET_REG_INDICATOR_ENABLE:
+		break;
+	default:
+		break;
+	}
+}
+
+int headset_notifier_register(struct headset_notifier *notifier)
+{
+	if (!notifier->func) {
+		HS_LOG("NULL register function");
+		return 0;
+	}
+
+	switch (notifier->id) {
+	case HEADSET_REG_HPIN_GPIO:
+		HS_LOG("Register HPIN_GPIO notifier");
+		hs_mgr_notifier.hpin_gpio = notifier->func;
+		break;
+	case HEADSET_REG_REMOTE_ADC:
+		HS_LOG("Register REMOTE_ADC notifier");
+		hs_mgr_notifier.remote_adc = notifier->func;
+		break;
+	case HEADSET_REG_REMOTE_KEYCODE:
+		HS_LOG("Register REMOTE_KEYCODE notifier");
+		hs_mgr_notifier.remote_keycode = notifier->func;
+		break;
+	case HEADSET_REG_RPC_KEY:
+		HS_LOG("Register RPC_KEY notifier");
+		hs_mgr_notifier.rpc_key = notifier->func;
+		break;
+	case HEADSET_REG_MIC_STATUS:
+		HS_LOG("Register MIC_STATUS notifier");
+		hs_mgr_notifier.mic_status = notifier->func;
+		break;
+	case HEADSET_REG_MIC_BIAS:
+		HS_LOG("Register MIC_BIAS notifier");
+		hs_mgr_notifier.mic_bias_enable = notifier->func;
+		break;
+	case HEADSET_REG_MIC_SELECT:
+		HS_LOG("Register MIC_SELECT notifier");
+		hs_mgr_notifier.mic_select = notifier->func;
+		break;
+	case HEADSET_REG_KEY_INT_ENABLE:
+		HS_LOG("Register KEY_INT_ENABLE notifier");
+		hs_mgr_notifier.key_int_enable = notifier->func;
+		break;
+	case HEADSET_REG_KEY_ENABLE:
+		HS_LOG("Register KEY_ENABLE notifier");
+		hs_mgr_notifier.key_enable = notifier->func;
+		break;
+	case HEADSET_REG_INDICATOR_ENABLE:
+		HS_LOG("Register INDICATOR_ENABLE notifier");
+		hs_mgr_notifier.indicator_enable = notifier->func;
+		break;
+	case HEADSET_REG_1WIRE_INIT:
+		HS_LOG("Register 1WIRE_INIT notifier");
+		hs_mgr_notifier.hs_1wire_init = notifier->func;
+		hi->driver_one_wire_exist = 1;
+		break;
+	case HEADSET_REG_1WIRE_QUERY:
+		HS_LOG("Register 1WIRE_QUERY notifier");
+		hs_mgr_notifier.hs_1wire_query = notifier->func;
+		break;
+	case HEADSET_REG_1WIRE_READ_KEY:
+		HS_LOG("Register 1WIRE_READ_KEY notifier");
+		hs_mgr_notifier.hs_1wire_read_key = notifier->func;
+		break;
+	case HEADSET_REG_1WIRE_DEINIT:
+		HS_LOG("Register 1WIRE_DEINIT notifier");
+		hs_mgr_notifier.hs_1wire_deinit = notifier->func;
+		break;
+	case HEADSET_REG_1WIRE_REPORT_TYPE:
+		HS_LOG("Register 1WIRE_REPORT_TYPE notifier");
+		hs_mgr_notifier.hs_1wire_report_type = notifier->func;
+		break;
+	default:
+		HS_LOG("Unknown register ID");
+		return 0;
+	}
+
+	headset_notifier_update(notifier->id);
+
+	return 1;
+}
+
+static int hs_mgr_rpc_call(struct msm_rpc_server *server,
+			    struct rpc_request_hdr *req, unsigned len)
+{
+	struct hs_rpc_server_args_key *args_key;
+
+	wake_lock_timeout(&hi->hs_wake_lock, HS_WAKE_LOCK_TIMEOUT);
+
+	HS_DBG();
+
+	switch (req->procedure) {
+	case HS_RPC_SERVER_PROC_NULL:
+		HS_LOG("RPC_SERVER_NULL");
+		break;
+	case HS_RPC_SERVER_PROC_KEY:
+		args_key = (struct hs_rpc_server_args_key *)(req + 1);
+		args_key->adc = be32_to_cpu(args_key->adc);
+		HS_LOG("RPC_SERVER_KEY ADC = %u (0x%X)",
+			args_key->adc, args_key->adc);
+		if (hs_mgr_notifier.rpc_key)
+			hs_mgr_notifier.rpc_key(args_key->adc);
+		else
+			HS_LOG("RPC_KEY notify function doesn't exist");
+		break;
+	default:
+		HS_LOG("Unknown RPC procedure");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static ssize_t h2w_print_name(struct switch_dev *sdev, char *buf)
+{
+	return sprintf(buf, "Headset\n");
+}
+
+static ssize_t usb_audio_print_name(struct switch_dev *sdev, char *buf)
+{
+	return sprintf(buf, "usb_audio\n");
+}
+
+static void get_key_name(int keycode, char *buf)
+{
+	switch (keycode) {
+	case HS_MGR_KEYCODE_END:
+		sprintf(buf, "END");
+		break;
+	case HS_MGR_KEYCODE_MUTE:
+		sprintf(buf, "MUTE");
+		break;
+	case HS_MGR_KEYCODE_VOLDOWN:
+		sprintf(buf, "VOLDOWN");
+		break;
+	case HS_MGR_KEYCODE_VOLUP:
+		sprintf(buf, "VOLUP");
+		break;
+	case HS_MGR_KEYCODE_FORWARD:
+		sprintf(buf, "FORWARD");
+		break;
+	case HS_MGR_KEYCODE_PLAY:
+		sprintf(buf, "PLAY");
+		break;
+	case HS_MGR_KEYCODE_BACKWARD:
+		sprintf(buf, "BACKWARD");
+		break;
+	case HS_MGR_KEYCODE_MEDIA:
+		sprintf(buf, "MEDIA");
+		break;
+	case HS_MGR_KEYCODE_SEND:
+		sprintf(buf, "SEND");
+		break;
+	case HS_MGR_KEYCODE_FF:
+		sprintf(buf, "FastForward");
+		break;
+	case HS_MGR_KEYCODE_RW:
+		sprintf(buf, "ReWind");
+		break;
+	default:
+		sprintf(buf, "%d", keycode);
+	}
+}
+
+void button_pressed(int type)
+{
+	char key_name[16];
+
+	get_key_name(type, key_name);
+	HS_LOG_TIME("%s (%d) pressed", key_name, type);
+	atomic_set(&hi->btn_state, type);
+	input_report_key(hi->input, type, 1);
+	input_sync(hi->input);
+	key_report++;
+}
+
+void button_released(int type)
+{
+	char key_name[16];
+
+	get_key_name(type, key_name);
+	HS_LOG_TIME("%s (%d) released", key_name, type);
+	atomic_set(&hi->btn_state, 0);
+	input_report_key(hi->input, type, 0);
+	input_sync(hi->input);
+	key_report++;
+}
+
+void headset_button_event(int is_press, int type)
+{
+	HS_DBG();
+
+	if (hi->hs_35mm_type == HEADSET_UNPLUG &&
+	    hi->h2w_35mm_type == HEADSET_UNPLUG) {
+		HS_LOG("IGNORE key %d (HEADSET_UNPLUG)", type);
+		return;
+	}
+
+	if (!hs_hpin_stable()) {
+		HS_LOG("IGNORE key %d (Unstable HPIN)", type);
+		return;
+	}
+
+	if (!get_mic_state()) {
+		HS_LOG("IGNORE key %d (Not support MIC)", type);
+		return;
+	}
+
+	if (!is_press)
+		button_released(type);
+	else if (!atomic_read(&hi->btn_state))
+		button_pressed(type);
+}
+
+void hs_set_mic_select(int state)
+{
+	HS_DBG();
+
+	if (hs_mgr_notifier.mic_select)
+		hs_mgr_notifier.mic_select(state);
+}
+
+static int get_mic_status(void)
+{
+	int i = 0;
+	int adc = 0;
+	int mic = HEADSET_UNKNOWN_MIC;
+
+	if (hi->pdata.headset_config_num && hs_mgr_notifier.remote_adc) {
+		hs_mgr_notifier.remote_adc(&adc);
+		for (i = 0; i < hi->pdata.headset_config_num; i++) {
+			if (adc >= hi->pdata.headset_config[i].adc_min &&
+			    adc <= hi->pdata.headset_config[i].adc_max)
+				return hi->pdata.headset_config[i].type;
+		}
+			if (hi->pdata.driver_flag & DRIVER_HS_MGR_FLOAT_DET) {
+				return HEADSET_UNPLUG;
+			}
+	} else if (hs_mgr_notifier.mic_status) {
+		mic = hs_mgr_notifier.mic_status();
+	}
+	else
+		HS_LOG("Failed to get MIC status");
+	return mic;
+}
+
+int headset_get_type(void)
+{
+	return hi->hs_35mm_type;
+}
+
+int headset_get_type_sync(int count, unsigned int interval)
+{
+	int current_type = hi->hs_35mm_type;
+	int new_type = HEADSET_UNKNOWN_MIC;
+
+	while (count--) {
+		new_type = get_mic_status();
+		if (new_type != current_type)
+			break;
+		if (count)
+			msleep(interval);
+	}
+
+	if (new_type != current_type) {
+		update_mic_status(HS_DEF_MIC_DETECT_COUNT);
+		return HEADSET_UNKNOWN_MIC;
+	}
+
+	return hi->hs_35mm_type;
+}
+
+static void set_35mm_hw_state(int state)
+{
+	HS_DBG();
+
+	if (hi->pdata.headset_power || hs_mgr_notifier.mic_bias_enable) {
+		if (hi->mic_bias_state != state) {
+			if (hi->pdata.headset_power)
+				hi->pdata.headset_power(state);
+			if (hs_mgr_notifier.mic_bias_enable)
+				hs_mgr_notifier.mic_bias_enable(state);
+
+			hi->mic_bias_state = state;
+			if (state) 
+				msleep(HS_DELAY_MIC_BIAS);
+		}
+	}
+
+	hs_set_mic_select(state);
+
+	if (hs_mgr_notifier.key_enable)
+		hs_mgr_notifier.key_enable(state);
+
+	if (hs_mgr_notifier.key_int_enable)
+		hs_mgr_notifier.key_int_enable(state);
+}
+
+static int tv_out_detect(void)
+{
+	int adc = 0;
+	int mic = HEADSET_NO_MIC;
+
+	HS_DBG();
+
+	if (!hs_mgr_notifier.remote_adc)
+		return HEADSET_NO_MIC;
+
+	if (!hi->pdata.hptv_det_hp_gpio || !hi->pdata.hptv_det_tv_gpio)
+		return HEADSET_NO_MIC;
+
+	gpio_set_value(hi->pdata.hptv_det_hp_gpio, 0);
+	gpio_set_value(hi->pdata.hptv_det_tv_gpio, 1);
+	msleep(HS_DELAY_MIC_BIAS);
+
+	hs_mgr_notifier.remote_adc(&adc);
+	if (adc >= HS_DEF_HPTV_ADC_16_BIT_MIN &&
+	    adc <= HS_DEF_HPTV_ADC_16_BIT_MAX)
+	mic = HEADSET_TV_OUT;
+
+	gpio_set_value(hi->pdata.hptv_det_hp_gpio, 1);
+	gpio_set_value(hi->pdata.hptv_det_tv_gpio, 0);
+
+	return mic;
+}
+
+#if 0
+static void insert_h2w_35mm(int *state)
+{
+	int mic = HEADSET_NO_MIC;
+
+	HS_LOG_TIME("Insert H2W 3.5mm headset");
+	set_35mm_hw_state(1);
+
+	mic = get_mic_status();
+
+	if (mic == HEADSET_NO_MIC) {
+		*state |= BIT_HEADSET_NO_MIC;
+		hi->h2w_35mm_type = HEADSET_NO_MIC;
+		HS_LOG_TIME("H2W 3.5mm without microphone");
+	} else {
+		*state |= BIT_HEADSET;
+		hi->h2w_35mm_type = HEADSET_MIC;
+		HS_LOG_TIME("H2W 3.5mm with microphone");
+	}
+}
+
+static void remove_h2w_35mm(void)
+{
+	HS_LOG_TIME("Remove H2W 3.5mm headset");
+
+	set_35mm_hw_state(0);
+
+	if (atomic_read(&hi->btn_state))
+		button_released(atomic_read(&hi->btn_state));
+	hi->h2w_35mm_type = HEADSET_UNPLUG;
+}
+#endif 
+
+static void enable_metrico_headset(int enable)
+{
+	HS_DBG();
+
+	if (enable && !hi->metrico_status) {
+#if 0
+		enable_mos_test(1);
+#endif
+		hi->metrico_status = 1;
+		HS_LOG("Enable metrico headset");
+	}
+
+	if (!enable && hi->metrico_status) {
+#if 0
+		enable_mos_test(0);
+#endif
+		hi->metrico_status = 0;
+		HS_LOG("Disable metrico headset");
+	}
+}
+
+static void mic_detect_work_func(struct work_struct *work)
+{
+	int mic = HEADSET_NO_MIC;
+	int old_state, new_state;
+
+	wake_lock_timeout(&hi->hs_wake_lock, HS_MIC_DETECT_TIMEOUT);
+
+	HS_DBG();
+
+	if (!hi->pdata.headset_config_num && !hs_mgr_notifier.mic_status) {
+		HS_LOG("Failed to get MIC status");
+		return;
+	}
+
+	mutex_lock(&hi->mutex_lock);
+
+	mic = get_mic_status();
+
+	if (mic == HEADSET_NO_MIC)
+		mic = tv_out_detect();
+
+	if (mic == HEADSET_TV_OUT && hi->pdata.hptv_sel_gpio)
+		gpio_set_value(hi->pdata.hptv_sel_gpio, 1);
+
+	if (mic == HEADSET_METRICO && !hi->metrico_status)
+		enable_metrico_headset(1);
+
+	if (mic == HEADSET_UNKNOWN_MIC || mic == HEADSET_UNPLUG) {
+		mutex_unlock(&hi->mutex_lock);
+		if (hi->mic_detect_counter--)
+			queue_delayed_work(detect_wq, &mic_detect_work,
+					   HS_JIFFIES_MIC_DETECT);
+		else
+			HS_LOG("MIC polling timeout (UNKNOWN/Floating MIC status)");
+		return;
+	}
+
+	if (hi->hs_35mm_type == HEADSET_UNSTABLE && hi->mic_detect_counter--) {
+		mutex_unlock(&hi->mutex_lock);
+		queue_delayed_work(detect_wq, &mic_detect_work,
+				   HS_JIFFIES_MIC_DETECT);
+		return;
+	}
+
+	old_state = switch_get_state(&hi->sdev_h2w);
+	if (!(old_state & MASK_35MM_HEADSET) && !(hi->is_ext_insert)) {
+		HS_LOG("Headset has been removed");
+		mutex_unlock(&hi->mutex_lock);
+		return;
+	}
+
+	new_state = old_state & ~MASK_35MM_HEADSET;
+
+	switch (mic) {
+	case HEADSET_UNPLUG:
+		new_state &= ~MASK_35MM_HEADSET;
+		HS_LOG("HEADSET_UNPLUG (FLOAT)");
+		break;
+	case HEADSET_NO_MIC:
+		new_state |= BIT_HEADSET_NO_MIC;
+		HS_LOG("HEADSET_NO_MIC");
+		break;
+	case HEADSET_MIC:
+		new_state |= BIT_HEADSET;
+		HS_LOG("HEADSET_MIC");
+		break;
+	case HEADSET_METRICO:
+		new_state |= BIT_HEADSET;
+		HS_LOG("HEADSET_METRICO");
+		break;
+	case HEADSET_TV_OUT:
+		new_state |= BIT_TV_OUT;
+		HS_LOG("HEADSET_TV_OUT");
+#if defined(CONFIG_FB_MSM_TVOUT) && defined(CONFIG_ARCH_MSM8X60)
+		tvout_enable_detection(1);
+#endif
+		break;
+	case HEADSET_BEATS:
+		new_state |= BIT_HEADSET;
+		HS_LOG("HEADSET_BEATS");
+		break;
+	case HEADSET_BEATS_SOLO:
+		new_state |= BIT_HEADSET;
+		HS_LOG("HEADSET_BEATS_SOLO");
+		break;
+	case HEADSET_INDICATOR:
+		HS_LOG("HEADSET_INDICATOR");
+		break;
+	}
+
+	if (new_state != old_state) {
+		HS_LOG_TIME("Plug/Unplug accessory, old_state 0x%x, new_state 0x%x", old_state, new_state);
+		switch_set_state(&hi->sdev_h2w, old_state & ~MASK_35MM_HEADSET);
+		hi->hs_35mm_type = mic;
+		HS_LOG_TIME("Plug accessory and update MIC status");
+		switch_set_state(&hi->sdev_h2w, new_state);
+		hpin_report++;
+	} else
+		HS_LOG("MIC status has not changed");
+
+	mutex_unlock(&hi->mutex_lock);
+}
+
+static void button_35mm_work_func(struct work_struct *work)
+{
+	int key;
+	struct button_work *works;
+
+	wake_lock_timeout(&hi->hs_wake_lock, HS_WAKE_LOCK_TIMEOUT);
+
+	HS_DBG();
+
+	works = container_of(work, struct button_work, key_work.work);
+	hi->key_level_flag = works->key_code;
+
+	if (hi->key_level_flag) {
+		switch (hi->key_level_flag) {
+		case 1:
+			key = HS_MGR_KEYCODE_MEDIA;
+			break;
+		case 2:
+			key = HS_MGR_KEYCODE_BACKWARD;
+			break;
+		case 3:
+			key = HS_MGR_KEYCODE_FORWARD;
+			break;
+		default:
+			HS_LOG("3.5mm RC: WRONG Button Pressed");
+			kfree(works);
+			return;
+		}
+		headset_button_event(1, key);
+	} else { 
+		if (atomic_read(&hi->btn_state))
+			headset_button_event(0, atomic_read(&hi->btn_state));
+		else
+			HS_LOG("3.5mm RC: WRONG Button Release");
+	}
+
+	kfree(works);
+}
+
+static void debug_work_func(struct work_struct *work)
+{
+	int flag = 0;
+	int adc = -EINVAL;
+	int hpin_gpio = -EINVAL;
+
+	HS_DBG();
+
+	while (hi->debug_flag & DEBUG_FLAG_ADC) {
+		flag = hi->debug_flag;
+		if (hs_mgr_notifier.hpin_gpio)
+			hpin_gpio = hs_mgr_notifier.hpin_gpio();
+		if (hs_mgr_notifier.remote_adc)
+			hs_mgr_notifier.remote_adc(&adc);
+		HS_LOG("Debug Flag %d, HP_DET %d, ADC %d", flag,
+		       hpin_gpio, adc);
+		msleep(HS_DELAY_SEC);
+	}
+}
+
+static void remove_detect_work_func(struct work_struct *work)
+{
+	int state;
+
+	wake_lock_timeout(&hi->hs_wake_lock, HS_WAKE_LOCK_TIMEOUT);
+
+	HS_DBG();
+
+	if (time_before_eq(jiffies, hi->insert_jiffies + HZ)) {
+		HS_LOG("Waiting for HPIN stable");
+		msleep(HS_DELAY_SEC - HS_DELAY_REMOVE);
+	}
+
+	if (hi->is_ext_insert) {
+		HS_LOG("Headset has been inserted");
+		return;
+	}
+
+	if (hi->hs_35mm_type == HEADSET_INDICATOR &&
+	    hs_mgr_notifier.indicator_enable)
+		hs_mgr_notifier.indicator_enable(0);
+
+	set_35mm_hw_state(0);
+#if defined(CONFIG_FB_MSM_TVOUT) && defined(CONFIG_ARCH_MSM8X60)
+	if (hi->hs_35mm_type == HEADSET_TV_OUT && hi->pdata.hptv_sel_gpio) {
+		HS_LOG_TIME("Remove 3.5mm TVOUT cable");
+		tvout_enable_detection(0);
+		gpio_set_value(hi->pdata.hptv_sel_gpio, 0);
+	}
+#endif
+	if (hi->metrico_status)
+		enable_metrico_headset(0);
+
+	if (atomic_read(&hi->btn_state))
+		button_released(atomic_read(&hi->btn_state));
+	hi->hs_35mm_type = HEADSET_UNPLUG;
+
+	mutex_lock(&hi->mutex_lock);
+
+	state = switch_get_state(&hi->sdev_h2w);
+	if (!(state & MASK_35MM_HEADSET)) {
+		HS_LOG("Headset has been removed");
+		mutex_unlock(&hi->mutex_lock);
+		return;
+	}
+
+#if 0
+	if (hi->cable_in1 && !gpio_get_value(hi->cable_in1)) {
+		state &= ~BIT_35MM_HEADSET;
+		switch_set_state(&hi->sdev_h2w, state);
+		queue_delayed_work(detect_wq, &detect_h2w_work,
+				   HS_DELAY_ZERO_JIFFIES);
+	} else {
+		state &= ~(MASK_35MM_HEADSET | MASK_FM_ATTRIBUTE);
+		switch_set_state(&hi->sdev_h2w, state);
+	}
+#else
+	state &= ~(MASK_35MM_HEADSET | MASK_FM_ATTRIBUTE);
+	switch_set_state(&hi->sdev_h2w, state);
+#endif
+	if (hi->one_wire_mode == 1) {
+		hs_mgr_notifier.hs_1wire_deinit();
+		hi->one_wire_mode = 0;
+	}
+	HS_LOG_TIME("Remove 3.5mm accessory");
+	hpin_report++;
+	mutex_unlock(&hi->mutex_lock);
+
+#ifdef HTC_HEADSET_CONFIG_QUICK_BOOT
+	if (gpio_event_get_quickboot_status())
+		HS_LOG("quick_boot_status = 1");
+#endif
+}
+
+static void insert_detect_work_func(struct work_struct *work)
+{
+	int state;
+	int mic = HEADSET_NO_MIC;
+	int adc = 0;
+
+	wake_lock_timeout(&hi->hs_wake_lock, HS_WAKE_LOCK_TIMEOUT);
+
+	HS_DBG();
+
+	if (!hi->is_ext_insert) {
+		HS_LOG("Headset has been removed");
+		return;
+	}
+	HS_LOG("Start 1-wire detecting sequence");
+	if (hi->pdata.uart_tx_gpo)
+		hi->pdata.uart_tx_gpo(0);
+	if (hi->pdata.uart_lv_shift_en)
+		hi->pdata.uart_lv_shift_en(0);
+	msleep(20);
+	if (hi->pdata.uart_lv_shift_en)
+		hi->pdata.uart_lv_shift_en(1);
+	if (hi->pdata.uart_tx_gpo)
+		hi->pdata.uart_tx_gpo(2);
+	hi->insert_jiffies = jiffies;
+	set_35mm_hw_state(1);
+	msleep(150);
+	if (hs_mgr_notifier.remote_adc)
+		hs_mgr_notifier.remote_adc(&adc);
+
+	mutex_lock(&hi->mutex_lock);
+
+	hi->one_wire_mode = 0;
+	if (hi->driver_one_wire_exist && adc > 915) {
+		HS_LOG("[HS_1wire]1wire driver exists, starting init");
+		if (hs_mgr_notifier.key_int_enable)
+			hs_mgr_notifier.key_int_enable(0);
+		if (hs_mgr_notifier.hs_1wire_init() == 0) {
+			hi->one_wire_mode = 1;
+		
+			state = switch_get_state(&hi->sdev_h2w);
+			state |= BIT_HEADSET;
+			switch_set_state(&hi->sdev_h2w, state);
+			hi->hs_35mm_type = HEADSET_BEATS;
+			mutex_unlock(&hi->mutex_lock);
+		if (hs_mgr_notifier.key_int_enable)
+			hs_mgr_notifier.key_int_enable(1);
+			return;
+		}
+		else {
+			hi->one_wire_mode = 0;
+			HS_LOG("Lagacy mode");
+			if (hi->pdata.uart_tx_gpo)
+				hi->pdata.uart_tx_gpo(2);
+			if (hs_mgr_notifier.key_int_enable)
+				hs_mgr_notifier.key_int_enable(1);
+		}
+	}
+	mic = get_mic_status();
+	if (hi->pdata.driver_flag & DRIVER_HS_MGR_FLOAT_DET) {
+		HS_LOG("Headset float detect enable");
+		if (mic == HEADSET_UNPLUG) {
+			mutex_unlock(&hi->mutex_lock);
+			update_mic_status(HS_DEF_MIC_DETECT_COUNT);
+			return;
+		}
+	}
+
+	if (mic == HEADSET_NO_MIC)
+		mic = tv_out_detect();
+
+	if (mic == HEADSET_TV_OUT && hi->pdata.hptv_sel_gpio)
+		gpio_set_value(hi->pdata.hptv_sel_gpio, 1);
+
+	if (mic == HEADSET_METRICO && !hi->metrico_status)
+		enable_metrico_headset(1);
+
+	state = switch_get_state(&hi->sdev_h2w);
+	state &= ~MASK_35MM_HEADSET;
+
+	switch (mic) {
+
+	case HEADSET_NO_MIC:
+		state |= BIT_HEADSET_NO_MIC;
+		HS_LOG_TIME("HEADSET_NO_MIC");
+		break;
+	case HEADSET_MIC:
+		state |= BIT_HEADSET;
+		HS_LOG_TIME("HEADSET_MIC");
+		break;
+	case HEADSET_METRICO:
+		mic = HEADSET_UNSTABLE;
+		HS_LOG_TIME("HEADSET_METRICO (UNSTABLE)");
+		break;
+	case HEADSET_UNKNOWN_MIC:
+		state |= BIT_HEADSET_NO_MIC;
+		HS_LOG_TIME("HEADSET_UNKNOWN_MIC");
+		break;
+	case HEADSET_TV_OUT:
+		state |= BIT_TV_OUT;
+		HS_LOG_TIME("HEADSET_TV_OUT");
+#if defined(CONFIG_FB_MSM_TVOUT) && defined(CONFIG_ARCH_MSM8X60)
+		tvout_enable_detection(1);
+#endif
+		break;
+	case HEADSET_BEATS:
+		state |= BIT_HEADSET;
+		HS_LOG_TIME("HEADSET_BEATS (UNSTABLE)");
+		break;
+	case HEADSET_BEATS_SOLO:
+		state |= BIT_HEADSET;
+		HS_LOG_TIME("HEADSET_BEATS_SOLO (UNSTABLE)");
+		break;
+	case HEADSET_INDICATOR:
+		HS_LOG_TIME("HEADSET_INDICATOR");
+		break;
+	}
+
+	hi->hs_35mm_type = mic;
+	switch_set_state(&hi->sdev_h2w, state);
+	hpin_report++;
+	mutex_unlock(&hi->mutex_lock);
+
+#ifdef HTC_HEADSET_CONFIG_QUICK_BOOT
+	if (gpio_event_get_quickboot_status())
+		HS_LOG("quick_boot_status = 1");
+#endif
+
+	if (mic == HEADSET_UNKNOWN_MIC)
+		update_mic_status(HS_DEF_MIC_DETECT_COUNT);
+	else if (mic == HEADSET_UNSTABLE)
+		update_mic_status(0);
+	else if (mic == HEADSET_INDICATOR) {
+		if (headset_get_type_sync(3, HS_DELAY_SEC) == HEADSET_INDICATOR)
+			HS_LOG("Delay check: HEADSET_INDICATOR");
+		else
+			HS_LOG("Delay check: HEADSET_UNKNOWN_MIC");
+	}
+}
+
+int hs_notify_plug_event(int insert)
+{
+	HS_DBG("Headset status %d", insert);
+
+	mutex_lock(&hi->mutex_lock);
+	hi->is_ext_insert = insert;
+	mutex_unlock(&hi->mutex_lock);
+
+	cancel_delayed_work_sync(&mic_detect_work);
+	cancel_delayed_work_sync(&insert_detect_work);
+	cancel_delayed_work_sync(&remove_detect_work);
+
+	if (hi->is_ext_insert)
+		queue_delayed_work(detect_wq, &insert_detect_work,
+				   HS_JIFFIES_INSERT);
+	else
+		queue_delayed_work(detect_wq, &remove_detect_work,
+				   HS_JIFFIES_REMOVE);
+
+	return 1;
+}
+
+int hs_notify_key_event(int key_code)
+{
+	struct button_work *work;
+
+	HS_DBG();
+
+	if (hi->hs_35mm_type == HEADSET_INDICATOR) {
+		HS_LOG("Not support remote control");
+		return 1;
+	}
+
+	if (hi->hs_35mm_type == HEADSET_UNKNOWN_MIC ||
+	    hi->hs_35mm_type == HEADSET_NO_MIC ||
+	    hi->h2w_35mm_type == HEADSET_NO_MIC)
+		update_mic_status(HS_DEF_MIC_DETECT_COUNT);
+	else if (hi->hs_35mm_type == HEADSET_UNSTABLE)
+		update_mic_status(0);
+	else if (!hs_hpin_stable()) {
+		HS_LOG("IGNORE key %d (Unstable HPIN)", key_code);
+		return 1;
+	} else if (hi->hs_35mm_type == HEADSET_UNPLUG && hi->is_ext_insert == 1) {
+		HS_LOG("MIC status is changed from float, re-polling to decide accessory type");
+		update_mic_status(HS_DEF_MIC_DETECT_COUNT);
+		return 1;
+	} else {
+		work = kzalloc(sizeof(struct button_work), GFP_KERNEL);
+		if (!work) {
+			HS_ERR("Failed to allocate button memory");
+			return 1;
+		}
+		work->key_code = key_code;
+		INIT_DELAYED_WORK(&work->key_work, button_35mm_work_func);
+		queue_delayed_work(button_wq, &work->key_work,
+				   HS_JIFFIES_BUTTON);
+	}
+
+	return 1;
+}
+
+static void proc_comb_keys(void)
+{
+	int j, k;
+	if (hi->key_code_1wire_index >= 5) {
+		for (j = 0; j <= hi->key_code_1wire_index - 5; j++) {
+			if (hi->key_code_1wire[j] == 1 && hi->key_code_1wire[j+2] == 1 && hi->key_code_1wire[j+4] == 1) {
+				hi->key_code_1wire[j] = HS_MGR_3X_KEY_MEDIA;
+				HS_LOG("key[%d] = %d", j, HS_MGR_3X_KEY_MEDIA);
+				for (k = j + 1; k < (hi->key_code_1wire_index - 4); k++) {
+					hi->key_code_1wire[k] = hi->key_code_1wire[k+4];
+					HS_LOG("key[%d] <= key[%d]", k, k+4);
+				}
+				hi->key_code_1wire_index -= 4;
+			}
+		}
+	}
+
+	if (hi->key_code_1wire_index >= 3) {
+		for (j = 0; j <= hi->key_code_1wire_index - 3; j++) {
+			if (hi->key_code_1wire[j] == 1 && hi->key_code_1wire[j+2] == 1) {
+				hi->key_code_1wire[j] = HS_MGR_2X_KEY_MEDIA;
+				HS_LOG("key[%d] = %d", j, HS_MGR_2X_KEY_MEDIA);
+				for (k = j + 1; k < (hi->key_code_1wire_index - 2); k++) {
+					hi->key_code_1wire[k] = hi->key_code_1wire[k+2];
+					HS_LOG("key[%d] <= key[%d]", k, k+2);
+				}
+				hi->key_code_1wire_index -= 2;
+			}
+		}
+	}
+}
+
+static void proc_long_press(void)
+{
+	if (hi->key_code_1wire[hi->key_code_1wire_index - 1] == HS_MGR_2X_KEY_MEDIA) {	
+		HS_LOG("long press key found, replace key[%d] = %d ==> %d", hi->key_code_1wire_index - 1,
+			hi->key_code_1wire[hi->key_code_1wire_index - 1], HS_MGR_2X_HOLD_MEDIA);
+		hi->key_code_1wire[hi->key_code_1wire_index - 1] = HS_MGR_2X_HOLD_MEDIA;
+	}
+
+	if (hi->key_code_1wire[hi->key_code_1wire_index - 1] == HS_MGR_3X_KEY_MEDIA) {	
+		HS_LOG("long press key found, replace key[%d] = %d ==> %d", hi->key_code_1wire_index - 1,
+			hi->key_code_1wire[hi->key_code_1wire_index - 1], HS_MGR_3X_HOLD_MEDIA);
+		hi->key_code_1wire[hi->key_code_1wire_index - 1] = HS_MGR_3X_HOLD_MEDIA;
+	}
+}
+
+
+static void button_1wire_work_func(struct work_struct *work)
+{
+	int i;
+	static int pre_key = 0;
+	if (hi->key_code_1wire_index >= 15)
+		HS_LOG("key_code_1wire buffer overflow");
+	proc_comb_keys();
+	proc_long_press();
+	for (i = 0; i < hi->key_code_1wire_index; i++) {
+		HS_LOG("1wire key [%d] = %d", i, hi->key_code_1wire[i]);
+		switch (hi->key_code_1wire[i]) {
+			case	1:
+					
+					button_pressed(HS_MGR_KEYCODE_MEDIA);
+					pre_key = HS_MGR_KEYCODE_MEDIA;
+					break;
+			case	2:
+					button_pressed(HS_MGR_KEYCODE_VOLUP);
+					pre_key = HS_MGR_KEYCODE_VOLUP;
+					break;
+			case	3:
+					button_pressed(HS_MGR_KEYCODE_VOLDOWN);
+					pre_key = HS_MGR_KEYCODE_VOLDOWN;
+					break;
+			case	HS_MGR_2X_KEY_MEDIA:
+					button_pressed(HS_MGR_KEYCODE_FORWARD);
+					pre_key = HS_MGR_KEYCODE_FORWARD;
+					
+					break;
+			case	HS_MGR_3X_KEY_MEDIA:
+					button_pressed(HS_MGR_KEYCODE_BACKWARD);
+					pre_key = HS_MGR_KEYCODE_BACKWARD;
+					
+					break;
+			case	HS_MGR_2X_HOLD_MEDIA:
+					button_pressed(HS_MGR_KEYCODE_FF);
+					pre_key = HS_MGR_KEYCODE_FF;
+					
+					break;
+			case	HS_MGR_3X_HOLD_MEDIA:
+					button_pressed(HS_MGR_KEYCODE_RW);
+					pre_key = HS_MGR_KEYCODE_RW;
+					
+					break;
+			case	0:
+					button_released(pre_key);
+					break;
+			default:
+					break;
+		}
+		msleep(10);
+	}
+	hi->key_code_1wire_index = 0;
+
+}
+
+
+int hs_notify_key_irq(void)
+{
+	int adc = 0;
+	int key_code = HS_MGR_KEY_INVALID;
+	static int pre_key = 0;
+
+	if (hi->one_wire_mode == 1 && hs_hpin_stable() && hi->is_ext_insert) {
+		wake_lock_timeout(&hi->hs_wake_lock, HS_WAKE_LOCK_TIMEOUT);
+		key_code = hs_mgr_notifier.hs_1wire_read_key();
+		if (key_code < 0)
+			return 1;
+		if (key_code == 2 || key_code == 3 || pre_key == 2 || pre_key == 3) {
+			queue_delayed_work(button_wq, &button_1wire_work, HS_JIFFIES_1WIRE_BUTTON_SHORT);
+			HS_LOG("Use short delay");
+		} else {
+			queue_delayed_work(button_wq, &button_1wire_work, hi->onewire_key_delay);
+			HS_LOG("Use long delay");
+		}
+
+		HS_LOG("key_code = 0x%x", key_code);
+		hi->key_code_1wire[hi->key_code_1wire_index++] = key_code;
+		pre_key = key_code;
+		return 1;
+	}
+
+	key_bounce++;
+	if (hi->hs_35mm_type == HEADSET_INDICATOR) {
+		HS_LOG("Not support remote control");
+		return 1;
+	}
+
+	if (!hs_mgr_notifier.remote_adc || !hs_mgr_notifier.remote_keycode) {
+		HS_LOG("Failed to get remote key code");
+		return 1;
+	}
+
+	if (hs_hpin_stable()) {
+		hs_mgr_notifier.remote_adc(&adc);
+		key_code = hs_mgr_notifier.remote_keycode(adc);
+		hs_notify_key_event(key_code);
+	} else if (hi->hs_35mm_type == HEADSET_NO_MIC ||
+		   hi->hs_35mm_type == HEADSET_UNKNOWN_MIC) {
+		HS_LOG("IGNORE key IRQ (Unstable HPIN)");
+		update_mic_status(HS_DEF_MIC_DETECT_COUNT);
+	}
+
+	return 1;
+}
+
+static void usb_headset_detect(int type)
+{
+	int state_h2w = 0;
+	int state_usb = 0;
+
+	HS_DBG();
+
+	mutex_lock(&hi->mutex_lock);
+	state_h2w = switch_get_state(&hi->sdev_h2w);
+
+	switch (type) {
+	case USB_NO_HEADSET:
+		hi->usb_headset.type = USB_NO_HEADSET;
+		hi->usb_headset.status = STATUS_DISCONNECTED;
+		state_h2w &= ~MASK_USB_HEADSET;
+		state_usb = GOOGLE_USB_AUDIO_UNPLUG;
+		HS_LOG_TIME("Remove USB_HEADSET (state %d, %d)",
+			    state_h2w, state_usb);
+		break;
+	case USB_AUDIO_OUT:
+		hi->usb_headset.type = USB_AUDIO_OUT;
+		hi->usb_headset.status = STATUS_CONNECTED_ENABLED;
+		state_h2w |= BIT_USB_AUDIO_OUT;
+		state_usb = GOOGLE_USB_AUDIO_ANLG;
+		HS_LOG_TIME("Insert USB_AUDIO_OUT (state %d, %d)",
+			    state_h2w, state_usb);
+		break;
+#ifdef CONFIG_SUPPORT_USB_SPEAKER
+	case USB_AUDIO_OUT_DGTL:
+		hi->usb_headset.type = USB_AUDIO_OUT;
+                hi->usb_headset.status = STATUS_CONNECTED_ENABLED;
+                state_h2w |= BIT_USB_AUDIO_OUT;
+                state_usb = GOOGLE_USB_AUDIO_DGTL;
+                HS_LOG_TIME("Insert USB_AUDIO_OUT DGTL (state %d, %d)",
+                            state_h2w, state_usb);
+                break;
+#endif
+	default:
+		HS_LOG("Unknown headset type");
+	}
+
+	switch_set_state(&hi->sdev_h2w, state_h2w);
+	switch_set_state(&hi->sdev_usb_audio, state_usb);
+	mutex_unlock(&hi->mutex_lock);
+}
+
+void headset_ext_detect(int type)
+{
+	HS_DBG();
+
+	switch (type) {
+	case H2W_NO_HEADSET:
+		
+	case H2W_HEADSET:
+	case H2W_35MM_HEADSET:
+	case H2W_REMOTE_CONTROL:
+	case H2W_USB_CRADLE:
+	case H2W_UART_DEBUG:
+	case H2W_TVOUT:
+		break;
+	case USB_NO_HEADSET:
+		
+	case USB_AUDIO_OUT:
+#ifdef CONFIG_SUPPORT_USB_SPEAKER
+	case USB_AUDIO_OUT_DGTL:
+#endif
+		usb_headset_detect(type);
+		break;
+	default:
+		HS_LOG("Unknown headset type");
+	}
+}
+
+void headset_ext_button(int headset_type, int key_code, int press)
+{
+	HS_LOG("Headset %d, Key %d, Press %d", headset_type, key_code, press);
+	headset_button_event(press, key_code);
+}
+
+int switch_send_event(unsigned int bit, int on)
+{
+	unsigned long state;
+
+	HS_DBG();
+
+	mutex_lock(&hi->mutex_lock);
+	state = switch_get_state(&hi->sdev_h2w);
+	state &= ~(bit);
+
+	if (on)
+		state |= bit;
+
+	switch_set_state(&hi->sdev_h2w, state);
+	mutex_unlock(&hi->mutex_lock);
+	return 0;
+}
+
+static ssize_t headset_state_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	int length = 0;
+	char *state = NULL;
+
+	HS_DBG();
+
+	switch (hi->hs_35mm_type) {
+	case HEADSET_UNPLUG:
+		state = "headset_unplug";
+		break;
+	case HEADSET_NO_MIC:
+		state = "headset_no_mic";
+		break;
+	case HEADSET_MIC:
+		state = "headset_mic";
+		break;
+	case HEADSET_METRICO:
+		state = "headset_metrico";
+		break;
+	case HEADSET_UNKNOWN_MIC:
+		state = "headset_unknown_mic";
+		break;
+	case HEADSET_TV_OUT:
+		state = "headset_tv_out";
+		break;
+	case HEADSET_UNSTABLE:
+		state = "headset_unstable";
+		break;
+	case HEADSET_BEATS:
+		if (hi->one_wire_mode == 1 && hs_mgr_notifier.hs_1wire_report_type)
+			hs_mgr_notifier.hs_1wire_report_type(&state);
+		else
+			state = "headset_beats";
+		break;
+	case HEADSET_BEATS_SOLO:
+		state = "headset_beats_solo";
+		break;
+	case HEADSET_INDICATOR:
+		state = "headset_indicator";
+		break;
+	default:
+		state = "error_state";
+	}
+
+	length = sprintf(buf, "%s\n", state);
+
+	return length;
+}
+
+static ssize_t headset_state_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	HS_DBG();
+	return 0;
+}
+
+static DEVICE_HEADSET_ATTR(state, 0644, headset_state_show,
+			   headset_state_store);
+
+static ssize_t headset_1wire_state_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf,"%d\n", hi->one_wire_mode);
+}
+
+static ssize_t headset_1wire_state_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	HS_DBG();
+	return 0;
+}
+
+static DEVICE_HEADSET_ATTR(1wire_state, 0644, headset_1wire_state_show,
+			   headset_1wire_state_store);
+
+static ssize_t headset_simulate_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	HS_DBG();
+	return sprintf(buf, "Command is not supported\n");
+}
+
+static ssize_t headset_simulate_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	unsigned long state = 0;
+
+	HS_DBG();
+
+	state = MASK_35MM_HEADSET | MASK_USB_HEADSET;
+	switch_send_event(state, 0);
+
+	if (strncmp(buf, "headset_unplug", count - 1) == 0) {
+		HS_LOG("Headset simulation: headset_unplug");
+		set_35mm_hw_state(0);
+		hi->hs_35mm_type = HEADSET_UNPLUG;
+		return count;
+	}
+
+	set_35mm_hw_state(1);
+	state = BIT_35MM_HEADSET;
+
+	if (strncmp(buf, "headset_no_mic", count - 1) == 0) {
+		HS_LOG("Headset simulation: headset_no_mic");
+		hi->hs_35mm_type = HEADSET_NO_MIC;
+		state |= BIT_HEADSET_NO_MIC;
+	} else if (strncmp(buf, "headset_mic", count - 1) == 0) {
+		HS_LOG("Headset simulation: headset_mic");
+		hi->hs_35mm_type = HEADSET_MIC;
+		state |= BIT_HEADSET;
+	} else if (strncmp(buf, "headset_metrico", count - 1) == 0) {
+		HS_LOG("Headset simulation: headset_metrico");
+		hi->hs_35mm_type = HEADSET_METRICO;
+		state |= BIT_HEADSET;
+	} else if (strncmp(buf, "headset_unknown_mic", count - 1) == 0) {
+		HS_LOG("Headset simulation: headset_unknown_mic");
+		hi->hs_35mm_type = HEADSET_UNKNOWN_MIC;
+		state |= BIT_HEADSET_NO_MIC;
+	} else if (strncmp(buf, "headset_tv_out", count - 1) == 0) {
+		HS_LOG("Headset simulation: headset_tv_out");
+		hi->hs_35mm_type = HEADSET_TV_OUT;
+		state |= BIT_TV_OUT;
+#if defined(CONFIG_FB_MSM_TVOUT) && defined(CONFIG_ARCH_MSM8X60)
+		tvout_enable_detection(1);
+#endif
+	} else if (strncmp(buf, "headset_indicator", count - 1) == 0) {
+		HS_LOG("Headset simulation: headset_indicator");
+		hi->hs_35mm_type = HEADSET_INDICATOR;
+	} else if (strncmp(buf, "headset_beats", count - 1) == 0) {
+		HS_LOG("Headset simulation: headset_beats");
+		hi->hs_35mm_type = HEADSET_BEATS;
+		state |= BIT_HEADSET;
+	} else if (strncmp(buf, "headset_beats_solo", count - 1) == 0) {
+		HS_LOG("Headset simulation: headset_beats_solo");
+		hi->hs_35mm_type = HEADSET_BEATS_SOLO;
+		state |= BIT_HEADSET;
+	} else {
+		HS_LOG("Invalid parameter");
+		return count;
+	}
+
+	switch_send_event(state, 1);
+
+	return count;
+}
+
+static DEVICE_HEADSET_ATTR(simulate, 0644, headset_simulate_show,
+			   headset_simulate_store);
+
+static ssize_t headset_1wire_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+	HS_DBG();
+	s += sprintf(s, "onewire key delay is %dms\n", jiffies_to_msecs(hi->onewire_key_delay));
+	return (s - buf);
+}
+
+static ssize_t headset_1wire_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	unsigned long ten_base = 1;
+	int i;
+	unsigned long delay_t = 0;
+	HS_DBG();
+
+		for(i = (count - 2); i >= 0; i--) {
+			HS_LOG("buf[%d] = %d, ten_base = %ld", i, *(buf + i) - 48, ten_base);
+			delay_t += (*(buf + i) - 48) * ten_base;
+			ten_base *= 10;
+		}
+	HS_LOG("delay_t = %ld", delay_t);
+	hi->onewire_key_delay = msecs_to_jiffies(delay_t);
+
+	return count;
+}
+
+static DEVICE_HEADSET_ATTR(onewire, 0644, headset_1wire_show,
+			   headset_1wire_store);
+
+static ssize_t tty_flag_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+
+	HS_DBG();
+
+	mutex_lock(&hi->mutex_lock);
+	s += sprintf(s, "%d\n", hi->tty_enable_flag);
+	mutex_unlock(&hi->mutex_lock);
+	return (s - buf);
+}
+
+static ssize_t tty_flag_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	int state;
+
+	HS_DBG();
+
+	mutex_lock(&hi->mutex_lock);
+	state = switch_get_state(&hi->sdev_h2w);
+	state &= ~(BIT_TTY_FULL | BIT_TTY_VCO | BIT_TTY_HCO);
+
+	if (count == (strlen("enable") + 1) &&
+	   strncmp(buf, "enable", strlen("enable")) == 0) {
+		hi->tty_enable_flag = 1;
+		switch_set_state(&hi->sdev_h2w, state | BIT_TTY_FULL);
+		mutex_unlock(&hi->mutex_lock);
+		HS_LOG("Enable TTY FULL");
+		return count;
+	}
+	if (count == (strlen("vco_enable") + 1) &&
+	   strncmp(buf, "vco_enable", strlen("vco_enable")) == 0) {
+		hi->tty_enable_flag = 2;
+		switch_set_state(&hi->sdev_h2w, state | BIT_TTY_VCO);
+		mutex_unlock(&hi->mutex_lock);
+		HS_LOG("Enable TTY VCO");
+		return count;
+	}
+	if (count == (strlen("hco_enable") + 1) &&
+	   strncmp(buf, "hco_enable", strlen("hco_enable")) == 0) {
+		hi->tty_enable_flag = 3;
+		switch_set_state(&hi->sdev_h2w, state | BIT_TTY_HCO);
+		mutex_unlock(&hi->mutex_lock);
+		HS_LOG("Enable TTY HCO");
+		return count;
+	}
+	if (count == (strlen("disable") + 1) &&
+	   strncmp(buf, "disable", strlen("disable")) == 0) {
+		hi->tty_enable_flag = 0;
+		switch_set_state(&hi->sdev_h2w, state);
+		mutex_unlock(&hi->mutex_lock);
+		HS_LOG("Disable TTY");
+		return count;
+	}
+
+	mutex_unlock(&hi->mutex_lock);
+	HS_LOG("Invalid TTY argument");
+
+	return -EINVAL;
+}
+
+static DEVICE_ACCESSORY_ATTR(tty, 0644, tty_flag_show, tty_flag_store);
+
+static ssize_t fm_flag_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+	char *state;
+
+	HS_DBG();
+
+	mutex_lock(&hi->mutex_lock);
+	switch (hi->fm_flag) {
+	case 0:
+		state = "disable";
+		break;
+	case 1:
+		state = "fm_headset";
+		break;
+	case 2:
+		state = "fm_speaker";
+		break;
+	default:
+		state = "unknown_fm_status";
+	}
+
+	s += sprintf(s, "%s\n", state);
+	mutex_unlock(&hi->mutex_lock);
+	return (s - buf);
+}
+
+static ssize_t fm_flag_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	int state;
+
+	HS_DBG();
+
+	mutex_lock(&hi->mutex_lock);
+	state = switch_get_state(&hi->sdev_h2w);
+	state &= ~(BIT_FM_HEADSET | BIT_FM_SPEAKER);
+
+	if (count == (strlen("fm_headset") + 1) &&
+	   strncmp(buf, "fm_headset", strlen("fm_headset")) == 0) {
+		hi->fm_flag = 1;
+		state |= BIT_FM_HEADSET;
+		HS_LOG("Enable FM HEADSET");
+	} else if (count == (strlen("fm_speaker") + 1) &&
+	   strncmp(buf, "fm_speaker", strlen("fm_speaker")) == 0) {
+		hi->fm_flag = 2;
+		state |= BIT_FM_SPEAKER;
+		HS_LOG("Enable FM SPEAKER");
+	} else if (count == (strlen("disable") + 1) &&
+	   strncmp(buf, "disable", strlen("disable")) == 0) {
+		hi->fm_flag = 0 ;
+		HS_LOG("Disable FM");
+	} else {
+		mutex_unlock(&hi->mutex_lock);
+		HS_LOG("Invalid FM argument");
+		return -EINVAL;
+	}
+
+	switch_set_state(&hi->sdev_h2w, state);
+	mutex_unlock(&hi->mutex_lock);
+
+	return count;
+}
+
+static DEVICE_ACCESSORY_ATTR(fm, 0644, fm_flag_show, fm_flag_store);
+
+static ssize_t debug_flag_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	int flag = hi->debug_flag;
+	int adc = -EINVAL;
+	int hpin_gpio = -EINVAL;
+	int len, i;
+	char *s;
+
+	HS_DBG();
+
+	if (hs_mgr_notifier.hpin_gpio)
+		hpin_gpio = hs_mgr_notifier.hpin_gpio();
+	if (hs_mgr_notifier.remote_adc)
+		hs_mgr_notifier.remote_adc(&adc);
+
+	s = buf;
+	len =  sprintf(buf, "Debug Flag = %d\nHP_DET = %d\nADC = %d\n", flag,
+		       hpin_gpio, adc);
+	buf += len;
+	len =  sprintf(buf, "DET report count = %d\nDET bounce count = %d\n", hpin_report, hpin_bounce);
+	buf += len;
+	len =  sprintf(buf, "KEY report count = %d\nKEY bounce count = %d\n", key_report, key_bounce);
+	buf += len;
+	for (i = 0; i < hi->pdata.headset_config_num; i++) {
+		switch (hi->pdata.headset_config[i].type) {
+			case HEADSET_NO_MIC:
+				len = sprintf(buf, "headset_no_mic_adc_max = %d\n", hi->pdata.headset_config[i].adc_max);
+				buf += len;
+				len = sprintf(buf, "headset_no_mic_adc_min = %d\n", hi->pdata.headset_config[i].adc_min);
+				buf += len;
+				break;
+			case HEADSET_BEATS_SOLO:
+				len = sprintf(buf, "headset_beats_solo_adc_max = %d\n", hi->pdata.headset_config[i].adc_max);
+				buf += len;
+				len = sprintf(buf, "headset_beats_solo_adc_min = %d\n", hi->pdata.headset_config[i].adc_min);
+				buf += len;
+				break;
+			case HEADSET_BEATS:
+				len = sprintf(buf, "headset_beats_adc_max = %d\n", hi->pdata.headset_config[i].adc_max);
+				buf += len;
+				len = sprintf(buf, "headset_beats_adc_min = %d\n", hi->pdata.headset_config[i].adc_min);
+				buf += len;
+				break;
+			case HEADSET_MIC:
+				len = sprintf(buf, "headset_mic_adc_max = %d\n", hi->pdata.headset_config[i].adc_max);
+				buf += len;
+				len = sprintf(buf, "headset_mic_adc_min = %d\n", hi->pdata.headset_config[i].adc_min);
+				buf += len;
+				break;
+			default:
+				break;
+		}
+	}
+	key_report = 0;
+	key_bounce = 0;
+	hpin_report = 0;
+	hpin_bounce = 0;
+	return (buf - s);
+}
+
+static ssize_t debug_flag_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	unsigned long state = 0;
+
+	HS_DBG();
+
+	if (strncmp(buf, "enable", count - 1) == 0) {
+		if (hi->debug_flag & DEBUG_FLAG_ADC) {
+			HS_LOG("Debug work is already running");
+			return count;
+		}
+		if (!debug_wq) {
+			debug_wq = create_workqueue("debug");
+			if (!debug_wq) {
+				HS_LOG("Failed to create debug workqueue");
+				return count;
+			}
+		}
+		HS_LOG("Enable headset debug");
+		mutex_lock(&hi->mutex_lock);
+		hi->debug_flag |= DEBUG_FLAG_ADC;
+		mutex_unlock(&hi->mutex_lock);
+		queue_work(debug_wq, &debug_work);
+	} else if (strncmp(buf, "disable", count - 1) == 0) {
+		if (!(hi->debug_flag & DEBUG_FLAG_ADC)) {
+			HS_LOG("Debug work has been stopped");
+			return count;
+		}
+		HS_LOG("Disable headset debug");
+		mutex_lock(&hi->mutex_lock);
+		hi->debug_flag &= ~DEBUG_FLAG_ADC;
+		mutex_unlock(&hi->mutex_lock);
+		if (debug_wq) {
+			flush_workqueue(debug_wq);
+			destroy_workqueue(debug_wq);
+			debug_wq = NULL;
+		}
+	} else if (strncmp(buf, "debug_log_enable", count - 1) == 0) {
+		HS_LOG("Enable headset debug log");
+		hi->debug_flag |= DEBUG_FLAG_LOG;
+	} else if (strncmp(buf, "debug_log_disable", count - 1) == 0) {
+		HS_LOG("Disable headset debug log");
+		hi->debug_flag &= ~DEBUG_FLAG_LOG;
+	} else if (strncmp(buf, "no_headset", count - 1) == 0) {
+		HS_LOG("Headset simulation: no_headset");
+		state = BIT_HEADSET | BIT_HEADSET_NO_MIC | BIT_35MM_HEADSET |
+			BIT_TV_OUT | BIT_USB_AUDIO_OUT;
+		switch_send_event(state, 0);
+	} else if (strncmp(buf, "35mm_mic", count - 1) == 0) {
+		HS_LOG("Headset simulation: 35mm_mic");
+		state = BIT_HEADSET | BIT_35MM_HEADSET;
+		switch_send_event(state, 1);
+	} else if (strncmp(buf, "35mm_no_mic", count - 1) == 0) {
+		HS_LOG("Headset simulation: 35mm_no_mic");
+		state = BIT_HEADSET_NO_MIC | BIT_35MM_HEADSET;
+		switch_send_event(state, 1);
+	} else if (strncmp(buf, "35mm_tv_out", count - 1) == 0) {
+		HS_LOG("Headset simulation: 35mm_tv_out");
+		state = BIT_TV_OUT | BIT_35MM_HEADSET;
+		switch_send_event(state, 1);
+	} else if (strncmp(buf, "usb_audio", count - 1) == 0) {
+		HS_LOG("Headset simulation: usb_audio");
+		state = BIT_USB_AUDIO_OUT;
+		switch_send_event(state, 1);
+	} else if (strncmp(buf, "1wire_init", count - 1) == 0) {
+		hs_mgr_notifier.hs_1wire_init();
+	} else if (strncmp(buf, "init_gpio", count - 1) == 0) {
+		hi->pdata.uart_lv_shift_en(0);
+		hi->pdata.uart_tx_gpo(2);
+	} else {
+		HS_LOG("Invalid parameter");
+		return count;
+	}
+
+	return count;
+}
+
+static DEVICE_ACCESSORY_ATTR(debug, 0644, debug_flag_show, debug_flag_store);
+
+static int register_attributes(void)
+{
+	int ret = 0;
+
+	hi->htc_accessory_class = class_create(THIS_MODULE, "htc_accessory");
+	if (IS_ERR(hi->htc_accessory_class)) {
+		ret = PTR_ERR(hi->htc_accessory_class);
+		hi->htc_accessory_class = NULL;
+		goto err_create_class;
+	}
+
+	
+	hi->headset_dev = device_create(hi->htc_accessory_class,
+					NULL, 0, "%s", "headset");
+	if (unlikely(IS_ERR(hi->headset_dev))) {
+		ret = PTR_ERR(hi->headset_dev);
+		hi->headset_dev = NULL;
+		goto err_create_headset_device;
+	}
+
+	ret = device_create_file(hi->headset_dev, &dev_attr_headset_state);
+	if (ret)
+		goto err_create_headset_state_device_file;
+
+	ret = device_create_file(hi->headset_dev, &dev_attr_headset_simulate);
+	if (ret)
+		goto err_create_headset_simulate_device_file;
+
+	ret = device_create_file(hi->headset_dev, &dev_attr_headset_1wire_state);
+	if (ret)
+		goto err_create_headset_state_device_file;
+
+	
+	hi->tty_dev = device_create(hi->htc_accessory_class,
+				    NULL, 0, "%s", "tty");
+	if (unlikely(IS_ERR(hi->tty_dev))) {
+		ret = PTR_ERR(hi->tty_dev);
+		hi->tty_dev = NULL;
+		goto err_create_tty_device;
+	}
+
+	ret = device_create_file(hi->tty_dev, &dev_attr_tty);
+	if (ret)
+		goto err_create_tty_device_file;
+
+	
+	hi->fm_dev = device_create(hi->htc_accessory_class,
+				   NULL, 0, "%s", "fm");
+	if (unlikely(IS_ERR(hi->fm_dev))) {
+		ret = PTR_ERR(hi->fm_dev);
+		hi->fm_dev = NULL;
+		goto err_create_fm_device;
+	}
+
+	ret = device_create_file(hi->fm_dev, &dev_attr_fm);
+	if (ret)
+		goto err_create_fm_device_file;
+
+	
+	hi->debug_dev = device_create(hi->htc_accessory_class,
+				      NULL, 0, "%s", "debug");
+	if (unlikely(IS_ERR(hi->debug_dev))) {
+		ret = PTR_ERR(hi->debug_dev);
+		hi->debug_dev = NULL;
+		goto err_create_debug_device;
+	}
+
+	
+	ret = device_create_file(hi->debug_dev, &dev_attr_debug);
+	if (ret)
+		goto err_create_debug_device_file;
+
+	ret = device_create_file(hi->debug_dev, &dev_attr_headset_onewire);
+	if (ret)
+		goto err_create_debug_device_file;
+
+	return 0;
+
+err_create_debug_device_file:
+	device_unregister(hi->debug_dev);
+
+err_create_debug_device:
+	device_remove_file(hi->fm_dev, &dev_attr_fm);
+
+err_create_fm_device_file:
+	device_unregister(hi->fm_dev);
+
+err_create_fm_device:
+	device_remove_file(hi->tty_dev, &dev_attr_tty);
+
+err_create_tty_device_file:
+	device_unregister(hi->tty_dev);
+
+err_create_tty_device:
+	device_remove_file(hi->headset_dev, &dev_attr_headset_simulate);
+
+err_create_headset_simulate_device_file:
+	device_remove_file(hi->headset_dev, &dev_attr_headset_state);
+
+err_create_headset_state_device_file:
+	device_unregister(hi->headset_dev);
+
+err_create_headset_device:
+	class_destroy(hi->htc_accessory_class);
+
+err_create_class:
+
+	return ret;
+}
+
+static void unregister_attributes(void)
+{
+	device_remove_file(hi->debug_dev, &dev_attr_debug);
+	device_unregister(hi->debug_dev);
+	device_remove_file(hi->fm_dev, &dev_attr_fm);
+	device_unregister(hi->fm_dev);
+	device_remove_file(hi->tty_dev, &dev_attr_tty);
+	device_unregister(hi->tty_dev);
+	device_remove_file(hi->headset_dev, &dev_attr_headset_simulate);
+	device_remove_file(hi->headset_dev, &dev_attr_headset_state);
+	device_unregister(hi->headset_dev);
+	class_destroy(hi->htc_accessory_class);
+}
+
+static void headset_mgr_init(void)
+{
+	if (hi->pdata.hptv_det_hp_gpio)
+		gpio_set_value(hi->pdata.hptv_det_hp_gpio, 1);
+	if (hi->pdata.hptv_det_tv_gpio)
+		gpio_set_value(hi->pdata.hptv_det_tv_gpio, 0);
+	if (hi->pdata.hptv_sel_gpio)
+		gpio_set_value(hi->pdata.hptv_sel_gpio, 0);
+}
+
+static void htc_headset_mgr_early_suspend(struct early_suspend *h)
+{
+	HS_DBG();
+}
+
+static void htc_headset_mgr_late_resume(struct early_suspend *h)
+{
+#ifdef HTC_HEADSET_CONFIG_QUICK_BOOT
+	int state = 0;
+
+	HS_DBG();
+
+	if (hi->quick_boot_status) {
+		mutex_lock(&hi->mutex_lock);
+		state = switch_get_state(&hi->sdev_h2w);
+		HS_LOG_TIME("Resend quick boot U-Event (state = %d)",
+			    state | BIT_UNDEFINED);
+		switch_set_state(&hi->sdev_h2w, state | BIT_UNDEFINED);
+		HS_LOG_TIME("Resend quick boot U-Event (state = %d)", state);
+		switch_set_state(&hi->sdev_h2w, state);
+		hi->quick_boot_status = 0;
+		mutex_unlock(&hi->mutex_lock);
+	}
+#else
+	HS_DBG();
+#endif
+}
+
+static int htc_headset_mgr_suspend(struct platform_device *pdev,
+				   pm_message_t mesg)
+{
+	HS_DBG();
+
+#ifdef HTC_HEADSET_CONFIG_QUICK_BOOT
+	if (gpio_event_get_quickboot_status())
+		hi->quick_boot_status = 1;
+#endif
+
+	return 0;
+}
+
+static int htc_headset_mgr_resume(struct platform_device *pdev)
+{
+	HS_DBG();
+
+	return 0;
+}
+
+static int htc_headset_mgr_probe(struct platform_device *pdev)
+{
+	int ret;
+
+	struct htc_headset_mgr_platform_data *pdata = pdev->dev.platform_data;
+
+	HS_LOG("++++++++++++++++++++");
+
+	hi = kzalloc(sizeof(struct htc_headset_mgr_info), GFP_KERNEL);
+	if (!hi)
+		return -ENOMEM;
+
+	hi->pdata.driver_flag = pdata->driver_flag;
+	hi->pdata.headset_devices_num = pdata->headset_devices_num;
+	hi->pdata.headset_devices = pdata->headset_devices;
+	hi->pdata.headset_config_num = pdata->headset_config_num;
+	hi->pdata.headset_config = pdata->headset_config;
+
+	hi->pdata.hptv_det_hp_gpio = pdata->hptv_det_hp_gpio;
+	hi->pdata.hptv_det_tv_gpio = pdata->hptv_det_tv_gpio;
+	hi->pdata.hptv_sel_gpio = pdata->hptv_sel_gpio;
+
+	hi->pdata.headset_init = pdata->headset_init;
+	hi->pdata.headset_power = pdata->headset_power;
+	hi->pdata.uart_lv_shift_en = pdata->uart_lv_shift_en;
+	hi->pdata.uart_tx_gpo = pdata->uart_tx_gpo;
+
+	if (hi->pdata.headset_init)
+		hi->pdata.headset_init();
+
+	hi->driver_init_seq = 0;
+
+	hi->early_suspend.suspend = htc_headset_mgr_early_suspend;
+	hi->early_suspend.resume = htc_headset_mgr_late_resume;
+	register_early_suspend(&hi->early_suspend);
+
+	wake_lock_init(&hi->hs_wake_lock, WAKE_LOCK_SUSPEND, DRIVER_NAME);
+
+	hi->hpin_jiffies = jiffies;
+	hi->usb_headset.type = USB_NO_HEADSET;
+	hi->usb_headset.status = STATUS_DISCONNECTED;
+
+	hi->hs_35mm_type = HEADSET_UNPLUG;
+	hi->h2w_35mm_type = HEADSET_UNPLUG;
+	hi->is_ext_insert = 0;
+	hi->mic_bias_state = 0;
+	hi->mic_detect_counter = 0;
+	hi->key_level_flag = -1;
+	hi->quick_boot_status = 0;
+	hi->driver_one_wire_exist = 0;
+	atomic_set(&hi->btn_state, 0);
+
+	hi->tty_enable_flag = 0;
+	hi->fm_flag = 0;
+	hi->debug_flag = 0;
+	hi->key_code_1wire_index = 0;
+	hi->onewire_key_delay = HS_JIFFIES_1WIRE_BUTTON;
+
+	mutex_init(&hi->mutex_lock);
+
+	hi->sdev_h2w.name = "h2w";
+	hi->sdev_h2w.print_name = h2w_print_name;
+
+	ret = switch_dev_register(&hi->sdev_h2w);
+	if (ret < 0)
+		goto err_h2w_switch_dev_register;
+
+	hi->sdev_usb_audio.name = "usb_audio";
+	hi->sdev_usb_audio.print_name = usb_audio_print_name;
+
+	ret = switch_dev_register(&hi->sdev_usb_audio);
+	if (ret < 0)
+		goto err_usb_audio_switch_dev_register;
+
+	detect_wq = create_workqueue("detect");
+	if (detect_wq == NULL) {
+		ret = -ENOMEM;
+		HS_ERR("Failed to create detect workqueue");
+		goto err_create_detect_work_queue;
+	}
+
+	button_wq = create_workqueue("button");
+	if (button_wq  == NULL) {
+		ret = -ENOMEM;
+		HS_ERR("Failed to create button workqueue");
+		goto err_create_button_work_queue;
+	}
+
+	hi->input = input_allocate_device();
+	if (!hi->input) {
+		ret = -ENOMEM;
+		goto err_request_input_dev;
+	}
+
+	hi->input->name = "h2w headset";
+	set_bit(EV_SYN, hi->input->evbit);
+	set_bit(EV_KEY, hi->input->evbit);
+	set_bit(KEY_END, hi->input->keybit);
+	set_bit(KEY_MUTE, hi->input->keybit);
+	set_bit(KEY_VOLUMEDOWN, hi->input->keybit);
+	set_bit(KEY_VOLUMEUP, hi->input->keybit);
+	set_bit(KEY_NEXTSONG, hi->input->keybit);
+	set_bit(KEY_PLAYPAUSE, hi->input->keybit);
+	set_bit(KEY_PREVIOUSSONG, hi->input->keybit);
+	set_bit(KEY_MEDIA, hi->input->keybit);
+	set_bit(KEY_SEND, hi->input->keybit);
+	set_bit(KEY_FASTFORWARD, hi->input->keybit);
+	set_bit(KEY_REWIND, hi->input->keybit);
+
+	ret = input_register_device(hi->input);
+	if (ret < 0)
+	goto err_register_input_dev;
+
+	ret = register_attributes();
+	if (ret)
+		goto err_register_attributes;
+
+#ifdef HTC_HEADSET_CONFIG_MSM_RPC
+	if (hi->pdata.driver_flag & DRIVER_HS_MGR_RPC_SERVER) {
+		
+		ret = msm_rpc_create_server(&hs_rpc_server);
+		if (ret < 0) {
+			HS_ERR("Failed to create RPC server");
+			goto err_create_rpc_server;
+		}
+		HS_LOG("Create RPC server successfully");
+	}
+#else
+	HS_DBG("NOT support RPC (%du, %du)", hs_rpc_server.prog,
+	       hs_rpc_server.vers);
+#endif
+
+	headset_mgr_init();
+	hs_notify_driver_ready(DRIVER_NAME);
+
+	HS_LOG("--------------------");
+
+	return 0;
+
+#ifdef HTC_HEADSET_CONFIG_MSM_RPC
+err_create_rpc_server:
+#endif
+
+err_register_attributes:
+	input_unregister_device(hi->input);
+
+err_register_input_dev:
+	input_free_device(hi->input);
+
+err_request_input_dev:
+	destroy_workqueue(button_wq);
+
+err_create_button_work_queue:
+	destroy_workqueue(detect_wq);
+
+err_create_detect_work_queue:
+	switch_dev_unregister(&hi->sdev_usb_audio);
+
+err_usb_audio_switch_dev_register:
+	switch_dev_unregister(&hi->sdev_h2w);
+
+err_h2w_switch_dev_register:
+	mutex_destroy(&hi->mutex_lock);
+	wake_lock_destroy(&hi->hs_wake_lock);
+	kfree(hi);
+
+	HS_ERR("Failed to register %s driver", DRIVER_NAME);
+
+	return ret;
+}
+
+static int htc_headset_mgr_remove(struct platform_device *pdev)
+{
+#if 0
+	if ((switch_get_state(&hi->sdev_h2w) & MASK_HEADSET) != 0)
+		remove_headset();
+#endif
+
+	unregister_attributes();
+	input_unregister_device(hi->input);
+	destroy_workqueue(button_wq);
+	destroy_workqueue(detect_wq);
+	switch_dev_unregister(&hi->sdev_usb_audio);
+	switch_dev_unregister(&hi->sdev_h2w);
+	mutex_destroy(&hi->mutex_lock);
+	wake_lock_destroy(&hi->hs_wake_lock);
+	kfree(hi);
+
+	return 0;
+}
+
+static struct platform_driver htc_headset_mgr_driver = {
+	.probe		= htc_headset_mgr_probe,
+	.remove		= htc_headset_mgr_remove,
+	.suspend	= htc_headset_mgr_suspend,
+	.resume		= htc_headset_mgr_resume,
+	.driver		= {
+		.name		= "HTC_HEADSET_MGR",
+		.owner		= THIS_MODULE,
+	},
+};
+
+
+static int __init htc_headset_mgr_init(void)
+{
+	return platform_driver_register(&htc_headset_mgr_driver);
+}
+
+static void __exit htc_headset_mgr_exit(void)
+{
+	platform_driver_unregister(&htc_headset_mgr_driver);
+}
+
+module_init(htc_headset_mgr_init);
+module_exit(htc_headset_mgr_exit);
+
+MODULE_DESCRIPTION("HTC headset manager driver");
+MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-msm/htc/htc_headset_one_wire.c b/arch/arm/mach-msm/htc/htc_headset_one_wire.c
new file mode 100644
index 0000000..ca414a4
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_headset_one_wire.c
@@ -0,0 +1,346 @@
+/*
+ *
+ * /arch/arm/mach-msm/include/mach/htc_headset_pmic.h
+ *
+ * HTC PMIC headset driver.
+ *
+ * Copyright (C) 2010 HTC, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#include <linux/gpio.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/rtc.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/termios.h>
+#include <linux/tty.h>
+
+#include <mach/htc_headset_mgr.h>
+#include <mach/htc_headset_one_wire.h>
+
+#define DRIVER_NAME "HS_1WIRE"
+static struct htc_35mm_1wire_info *hi;
+static struct file *fp;
+
+static struct file *openFile(char *path,int flag,int mode)
+{
+	mm_segment_t old_fs;
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	fp=filp_open(path, flag, mode);
+	set_fs(old_fs);
+	if(IS_ERR(fp))
+	   HS_LOG("File Open Error:%s",path);
+
+	if(!fp->f_op)
+	   HS_LOG("File Operation Method Error!!");
+
+	if (fp) return fp;
+	else return NULL;
+}
+
+static int readFile(struct file *fp,char *buf,int readlen)
+{
+	mm_segment_t old_fs;
+	int ret;
+
+	if (fp && fp->f_op && fp->f_op->read) {
+		old_fs = get_fs();
+		set_fs(KERNEL_DS);
+		ret = fp->f_op->read(fp, buf, readlen, &fp->f_pos);
+		set_fs(old_fs);
+		return ret;
+	}
+	return -1;
+}
+
+static int writeFile(struct file *fp,char *buf,int readlen)
+{
+	mm_segment_t old_fs;
+	int ret;
+
+	if (fp && fp->f_op && fp->f_op->write) {
+		old_fs = get_fs();
+		set_fs(KERNEL_DS);
+		ret = fp->f_op->write(fp, buf, readlen, &fp->f_pos);
+		set_fs(old_fs);
+		return ret;
+	}
+	return -1;
+}
+
+static void setup_hs_tty(struct file *tty_fp)
+{
+	struct termios hs_termios;
+	mm_segment_t old_fs;
+
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	tty_ioctl(tty_fp, TCGETS, (unsigned long)&hs_termios);
+	hs_termios.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+	hs_termios.c_oflag &= ~OPOST;
+	hs_termios.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+	hs_termios.c_cflag &= ~(CSIZE|CBAUD|PARENB|CSTOPB);
+	hs_termios.c_cflag |= (CREAD|CS8|CLOCAL|CRTSCTS|B38400);
+	tty_ioctl(tty_fp, TCSETS, (unsigned long)&hs_termios);
+	set_fs(old_fs);
+}
+
+int closeFile(struct file *fp)
+{
+	mm_segment_t old_fs;
+
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	filp_close(fp,NULL);
+	set_fs(old_fs);
+	return 0;
+}
+
+static int hs_read_aid(void)
+{
+	char in_buf[10];
+	int read_count, i;
+		read_count = readFile(fp, in_buf, 10);
+		HS_LOG("[1wire]read_count = %d", read_count);
+		if (read_count > 0) {
+			for (i = 0; i < read_count; i++) {
+				HS_LOG("[1wire]in_buf[%d] = 0x%x", i, in_buf[i]);
+				if ((in_buf[i] & 0xF0) == 0x80 && in_buf[i] > 0x80) {
+					hi->aid = in_buf[i];
+					return 0;
+				}
+			}
+		}
+	return -1;
+
+}
+
+static int hs_1wire_query(int type)
+{
+	return 0; 
+}
+
+static int hs_1wire_read_key(void)
+{
+	char key_code[10];
+	int read_count, i;
+	HS_LOG("[1-wire]hs_1wire_read_key");
+		read_count = readFile(fp, key_code, 10);
+		HS_LOG("[1wire]key read_count = %d", read_count);
+		if (read_count > 0) {
+			for (i = 0; i < read_count; i++) {
+				HS_LOG("[1wire]key_code[%d] = 0x%x", i, key_code[i]);
+				if (key_code[i] == hi->pdata.one_wire_remote[0])
+					return 1;
+				else if (key_code[i] == hi->pdata.one_wire_remote[2])
+					return 2;
+				else if (key_code[i] == hi->pdata.one_wire_remote[4])
+					return 3;
+				else if (key_code[i] == hi->pdata.one_wire_remote[1])
+					return 0;
+				else
+					HS_LOG("Non key data, dropped");
+			}
+		}
+	return -1;
+}
+
+static int hs_1wire_init(void)
+{
+	char all_zero = 0;
+	char send_data = 0x35;
+
+	HS_LOG("[1-wire]hs_1wire_init");
+	fp = openFile(hi->pdata.onewire_tty_dev,O_CREAT|O_RDWR|O_SYNC,0666);
+	HS_LOG("Open %s", hi->pdata.onewire_tty_dev);
+	if (!(fp->private_data)) {
+		HS_LOG("No private data");
+		return -1;
+	}
+	setup_hs_tty(fp);
+	HS_LOG("Setup HS tty");
+	if (hi->pdata.tx_level_shift_en) {
+		gpio_set_value_cansleep(hi->pdata.tx_level_shift_en, 0); 
+		HS_LOG("[HS]set tx_level_shift_en to 0");
+	}
+	if (hi->pdata.uart_sw)
+		gpio_set_value_cansleep(hi->pdata.uart_sw, 1); 
+	hi->aid = 0;
+	msleep(20);
+	writeFile(fp,&all_zero,1);
+	msleep(5);
+	writeFile(fp,&send_data,1);
+	if (hi->pdata.remote_press) {
+		while(gpio_get_value(hi->pdata.remote_press) == 1) {
+			HS_LOG("[HS]Polling remote_press low");
+		}
+	}
+	msleep(1);
+	if (hi->pdata.tx_level_shift_en)
+		gpio_set_value(hi->pdata.tx_level_shift_en, 1);
+	HS_LOG("[HS]Disable level shift");
+	msleep(22);
+	if (hs_read_aid() == 0) {
+		HS_LOG("[1-wire]Valid AID received, enter 1-wire mode");
+		return 0;
+	} else {
+		if (hi->pdata.tx_level_shift_en)
+			gpio_set_value_cansleep(hi->pdata.tx_level_shift_en, 1);
+		if (hi->pdata.uart_sw)
+			gpio_set_value_cansleep(hi->pdata.uart_sw, 0);
+		hi->aid = 0;
+		closeFile(fp);
+		return -1;
+	}
+}
+
+static void hs_1wire_deinit(void)
+{
+	char all_zero = 0xaa;
+	if (fp) {
+		if (hi->pdata.tx_level_shift_en)
+			gpio_set_value_cansleep(hi->pdata.tx_level_shift_en, 0);
+		msleep(20);
+		writeFile(fp, &all_zero, 1); 
+		HS_LOG("Write 0xaa to unblock");
+		msleep(10);
+		HS_LOG("close file");
+		closeFile(fp);
+		fp = NULL;
+		if (hi->pdata.tx_level_shift_en)
+			gpio_set_value_cansleep(hi->pdata.tx_level_shift_en, 1);
+	}
+}
+
+static int hs_1wire_report_type(char **string)
+{
+	const int type_num = 3; 
+	char *hs_type[] = {
+		"headset_beats_20", 
+		"headset_mic_midtier",
+		"headset_beats_solo_20", 
+	};
+	hi->aid &= 0x7f;
+	HS_LOG("[1wire]AID = 0x%x", hi->aid);
+	if (hi->aid > type_num || hi->aid < 1) {
+		*string = "1wire_unknown";
+		return 14;
+	}else {
+		*string = hs_type[hi->aid - 1];
+		HS_LOG("Report %s type, size %d", *string, sizeof(hs_type[hi->aid -1]));
+		return sizeof(hs_type[hi->aid -1]);
+	}
+}
+
+static void hs_1wire_register(void)
+{
+	struct headset_notifier notifier;
+
+		notifier.id = HEADSET_REG_1WIRE_INIT;
+		notifier.func = hs_1wire_init;
+		headset_notifier_register(&notifier);
+
+		notifier.id = HEADSET_REG_1WIRE_QUERY;
+		notifier.func = hs_1wire_query;
+		headset_notifier_register(&notifier);
+
+		notifier.id = HEADSET_REG_1WIRE_READ_KEY;
+		notifier.func = hs_1wire_read_key;
+		headset_notifier_register(&notifier);
+
+		notifier.id = HEADSET_REG_1WIRE_DEINIT;
+		notifier.func = hs_1wire_deinit;
+		headset_notifier_register(&notifier);
+
+		notifier.id = HEADSET_REG_1WIRE_REPORT_TYPE;
+		notifier.func = hs_1wire_report_type;
+		headset_notifier_register(&notifier);
+
+}
+
+void one_wire_gpio_tx(int enable)
+{
+	HS_LOG("Set gpio[%d] = %d", hi->pdata.uart_tx, enable);
+	gpio_set_value(hi->pdata.uart_tx, enable);
+}
+
+void one_wire_lv_en(int enable)
+{
+	gpio_set_value(hi->pdata.tx_level_shift_en, 0);
+}
+
+void one_wire_uart_sw(int enable)
+{
+	gpio_set_value(hi->pdata.uart_sw, enable);
+}
+
+static int htc_headset_1wire_probe(struct platform_device *pdev)
+{
+	struct htc_headset_1wire_platform_data *pdata = pdev->dev.platform_data;
+	HS_LOG("1-wire probe starts");
+
+	hi = kzalloc(sizeof(struct htc_35mm_1wire_info), GFP_KERNEL);
+	if (!hi)
+		return -ENOMEM;
+
+	hi->pdata.tx_level_shift_en = pdata->tx_level_shift_en;
+	hi->pdata.uart_sw = pdata->uart_sw;
+	if (pdata->one_wire_remote[5])
+		memcpy(hi->pdata.one_wire_remote, pdata->one_wire_remote,
+		       sizeof(hi->pdata.one_wire_remote));
+	hi->pdata.uart_tx = pdata->uart_tx;
+	hi->pdata.uart_rx = pdata->uart_rx;
+	hi->pdata.remote_press = pdata->remote_press;
+	strncpy(hi->pdata.onewire_tty_dev, pdata->onewire_tty_dev, 15);
+	HS_LOG("1wire tty device %s", hi->pdata.onewire_tty_dev);
+	hs_1wire_register();
+	hs_notify_driver_ready(DRIVER_NAME);
+
+	HS_LOG("--------------------");
+
+	return 0;
+}
+
+static int htc_headset_1wire_remove(struct platform_device *pdev)
+{
+	return 0;
+}
+
+
+static struct platform_driver htc_headset_1wire_driver = {
+	.probe	= htc_headset_1wire_probe,
+	.remove	= htc_headset_1wire_remove,
+	.driver	= {
+		.name	= "HTC_HEADSET_1WIRE",
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __init htc_headset_1wire_init(void)
+{
+	return platform_driver_register(&htc_headset_1wire_driver);
+}
+
+static void __exit htc_headset_1wire_exit(void)
+{
+	platform_driver_unregister(&htc_headset_1wire_driver);
+}
+
+module_init(htc_headset_1wire_init);
+module_exit(htc_headset_1wire_exit);
+
+MODULE_DESCRIPTION("HTC 1-wire headset driver");
+MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-msm/htc/htc_headset_pmic.c b/arch/arm/mach-msm/htc/htc_headset_pmic.c
new file mode 100644
index 0000000..ea054bd
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_headset_pmic.c
@@ -0,0 +1,618 @@
+/*
+ *
+ * /arch/arm/mach-msm/htc_headset_pmic.c
+ *
+ * HTC PMIC headset driver.
+ *
+ * Copyright (C) 2010 HTC, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/gpio.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/rtc.h>
+#include <linux/slab.h>
+
+#include <linux/mfd/pm8xxx/core.h>
+
+#include <mach/msm_rpcrouter.h>
+
+#include <mach/htc_headset_mgr.h>
+#include <mach/htc_headset_pmic.h>
+
+#ifdef HTC_HEADSET_CONFIG_PMIC_8XXX_ADC
+#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
+#endif
+
+#define DRIVER_NAME "HS_PMIC"
+
+static struct workqueue_struct *detect_wq;
+static void detect_pmic_work_func(struct work_struct *work);
+static DECLARE_DELAYED_WORK(detect_pmic_work, detect_pmic_work_func);
+
+static void irq_init_work_func(struct work_struct *work);
+static DECLARE_DELAYED_WORK(irq_init_work, irq_init_work_func);
+
+static struct workqueue_struct *button_wq;
+static void button_pmic_work_func(struct work_struct *work);
+static DECLARE_DELAYED_WORK(button_pmic_work, button_pmic_work_func);
+
+static struct htc_35mm_pmic_info *hi;
+
+#ifdef HTC_HEADSET_CONFIG_MSM_RPC
+static struct msm_rpc_endpoint *endpoint_adc;
+static struct msm_rpc_endpoint *endpoint_current;
+
+static struct hs_pmic_current_threshold current_threshold_lut[] = {
+	{
+		.adc_max = 14909, 
+		.adc_min = 0, 
+		.current_uA = 500,
+	},
+	{
+		.adc_max = 29825, 
+		.adc_min = 14910, 
+		.current_uA = 600,
+	},
+	{
+		.adc_max = 65535, 
+		.adc_min = 29826, 
+		.current_uA = 500,
+	},
+};
+#endif
+
+static int hs_pmic_hpin_state(void)
+{
+	HS_DBG();
+
+	return gpio_get_value(hi->pdata.hpin_gpio);
+}
+
+#ifdef HTC_HEADSET_CONFIG_MSM_RPC
+static int hs_pmic_remote_threshold(uint32_t adc)
+{
+	int i = 0;
+	int ret = 0;
+	int array_size = 0;
+	uint32_t status;
+	struct hs_pmic_rpc_request req;
+	struct hs_pmic_rpc_reply rep;
+
+	HS_DBG();
+
+	if (!(hi->pdata.driver_flag & DRIVER_HS_PMIC_DYNAMIC_THRESHOLD))
+		return 0;
+
+	req.hs_controller = cpu_to_be32(hi->pdata.hs_controller);
+	req.hs_switch = cpu_to_be32(hi->pdata.hs_switch);
+	req.current_uA = cpu_to_be32(HS_PMIC_HTC_CURRENT_THRESHOLD);
+
+	array_size = sizeof(current_threshold_lut) /
+		     sizeof(struct hs_pmic_current_threshold);
+
+	for (i = 0; i < array_size; i++) {
+		if (adc >= current_threshold_lut[i].adc_min &&
+		    adc <= current_threshold_lut[i].adc_max)
+			req.current_uA = cpu_to_be32(current_threshold_lut[i].
+						     current_uA);
+	}
+
+	ret = msm_rpc_call_reply(endpoint_current,
+				 HS_PMIC_RPC_CLIENT_PROC_THRESHOLD,
+				 &req, sizeof(req), &rep, sizeof(rep),
+				 HS_RPC_TIMEOUT);
+
+	if (ret < 0) {
+		HS_ERR("Failed to send remote threshold RPC");
+		return 0;
+	} else {
+		status = be32_to_cpu(rep.status);
+		if (status != HS_PMIC_RPC_ERR_SUCCESS) {
+			HS_ERR("Failed to set remote threshold");
+			return 0;
+		}
+	}
+
+	HS_LOG("Set remote threshold (%u, %u, %u)", hi->pdata.hs_controller,
+	       hi->pdata.hs_switch, be32_to_cpu(req.current_uA));
+
+	return 1;
+}
+#endif
+
+#ifdef HTC_HEADSET_CONFIG_MSM_RPC
+static int hs_pmic_remote_adc(int *adc)
+{
+	int ret = 0;
+	struct rpc_request_hdr req;
+	struct hs_rpc_client_rep_adc rep;
+
+	HS_DBG();
+
+	ret = msm_rpc_call_reply(endpoint_adc, HS_RPC_CLIENT_PROC_ADC,
+				 &req, sizeof(req), &rep, sizeof(rep),
+				 HS_RPC_TIMEOUT);
+	if (ret < 0) {
+		*adc = -1;
+		HS_LOG("Failed to read remote ADC");
+		return 0;
+	}
+
+	*adc = (int) be32_to_cpu(rep.adc);
+	HS_LOG("Remote ADC %d (0x%X)", *adc, *adc);
+
+	return 1;
+}
+#endif
+
+#ifdef HTC_HEADSET_CONFIG_PMIC_8XXX_ADC
+static int hs_pmic_remote_adc_pm8921(int *adc)
+{
+	struct pm8xxx_adc_chan_result result;
+
+	HS_DBG();
+
+	result.physical = -EINVAL;
+	pm8xxx_adc_mpp_config_read(hi->pdata.adc_mpp, hi->pdata.adc_amux,
+				   &result);
+	*adc = (int) result.physical;
+	*adc = *adc / 1000; 
+	HS_LOG("Remote ADC %d (0x%X)", *adc, *adc);
+
+	return 1;
+}
+#endif
+
+static int hs_pmic_mic_status(void)
+{
+	int adc = 0;
+	int mic = HEADSET_UNKNOWN_MIC;
+
+	HS_DBG();
+
+#ifdef HTC_HEADSET_CONFIG_MSM_RPC
+	if (!hs_pmic_remote_adc(&adc))
+		return HEADSET_UNKNOWN_MIC;
+
+	if (hi->pdata.driver_flag & DRIVER_HS_PMIC_DYNAMIC_THRESHOLD)
+		hs_pmic_remote_threshold((unsigned int) adc);
+#endif
+
+#ifdef HTC_HEADSET_CONFIG_PMIC_8XXX_ADC
+	if (!hs_pmic_remote_adc_pm8921(&adc))
+		return HEADSET_UNKNOWN_MIC;
+#endif
+
+	if (adc >= hi->pdata.adc_mic_bias[0] &&
+	    adc <= hi->pdata.adc_mic_bias[1])
+		mic = HEADSET_MIC;
+	else if (adc < hi->pdata.adc_mic_bias[0])
+		mic = HEADSET_NO_MIC;
+	else
+		mic = HEADSET_UNKNOWN_MIC;
+
+	return mic;
+}
+
+static int hs_pmic_adc_to_keycode(int adc)
+{
+	int key_code = HS_MGR_KEY_INVALID;
+
+	HS_DBG();
+
+	if (!hi->pdata.adc_remote[5])
+		return HS_MGR_KEY_INVALID;
+
+	if (adc >= hi->pdata.adc_remote[0] &&
+	    adc <= hi->pdata.adc_remote[1])
+		key_code = HS_MGR_KEY_PLAY;
+	else if (adc >= hi->pdata.adc_remote[2] &&
+		 adc <= hi->pdata.adc_remote[3])
+		key_code = HS_MGR_KEY_BACKWARD;
+	else if (adc >= hi->pdata.adc_remote[4] &&
+		 adc <= hi->pdata.adc_remote[5])
+		key_code = HS_MGR_KEY_FORWARD;
+	else if (adc > hi->pdata.adc_remote[5])
+		key_code = HS_MGR_KEY_NONE;
+
+	if (key_code != HS_MGR_KEY_INVALID)
+		HS_LOG("Key code %d", key_code);
+	else
+		HS_LOG("Unknown key code %d", key_code);
+
+	return key_code;
+}
+
+static void hs_pmic_rpc_key(int adc)
+{
+	int key_code = hs_pmic_adc_to_keycode(adc);
+
+	HS_DBG();
+
+	if (key_code != HS_MGR_KEY_INVALID)
+		hs_notify_key_event(key_code);
+}
+
+static void hs_pmic_key_enable(int enable)
+{
+	HS_DBG();
+
+	if (hi->pdata.key_enable_gpio)
+		gpio_set_value(hi->pdata.key_enable_gpio, enable);
+}
+
+static void detect_pmic_work_func(struct work_struct *work)
+{
+	int insert = 0;
+
+	HS_DBG();
+
+	insert = gpio_get_value_cansleep(hi->pdata.hpin_gpio) ? 0 : 1;
+	hs_notify_plug_event(insert);
+}
+
+static irqreturn_t detect_irq_handler(int irq, void *data)
+{
+	unsigned int irq_mask = IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW;
+
+	hs_notify_hpin_irq();
+
+	HS_DBG();
+
+	hi->hpin_irq_type ^= irq_mask;
+	set_irq_type(hi->pdata.hpin_irq, hi->hpin_irq_type);
+
+	wake_lock_timeout(&hi->hs_wake_lock, HS_WAKE_LOCK_TIMEOUT);
+	queue_delayed_work(detect_wq, &detect_pmic_work, hi->hpin_debounce);
+
+	return IRQ_HANDLED;
+}
+
+static void button_pmic_work_func(struct work_struct *work)
+{
+	HS_DBG();
+	hs_notify_key_irq();
+}
+
+static irqreturn_t button_irq_handler(int irq, void *dev_id)
+{
+	unsigned int irq_mask = IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW;
+
+	HS_DBG();
+
+	hi->key_irq_type ^= irq_mask;
+	set_irq_type(hi->pdata.key_irq, hi->key_irq_type);
+
+	wake_lock_timeout(&hi->hs_wake_lock, HS_WAKE_LOCK_TIMEOUT);
+	queue_delayed_work(button_wq, &button_pmic_work, HS_JIFFIES_ZERO);
+
+	return IRQ_HANDLED;
+}
+
+static void irq_init_work_func(struct work_struct *work)
+{
+	HS_DBG();
+
+	if (hi->pdata.hpin_gpio) {
+		HS_LOG("Enable detect IRQ");
+		hi->hpin_irq_type = IRQF_TRIGGER_LOW;
+		set_irq_type(hi->pdata.hpin_irq, hi->hpin_irq_type);
+		enable_irq(hi->pdata.hpin_irq);
+	}
+
+	if (hi->pdata.key_gpio) {
+		HS_LOG("Enable button IRQ");
+		hi->key_irq_type = IRQF_TRIGGER_LOW;
+		set_irq_type(hi->pdata.key_irq, hi->key_irq_type);
+		enable_irq(hi->pdata.key_irq);
+	}
+}
+
+static int hs_pmic_request_irq(unsigned int gpio, unsigned int *irq,
+			       irq_handler_t handler, unsigned long flags,
+			       const char *name, unsigned int wake)
+{
+	int ret = 0;
+
+	HS_DBG();
+
+	ret = gpio_request(gpio, name);
+	if (ret < 0)
+		return ret;
+
+	ret = gpio_direction_input(gpio);
+	if (ret < 0) {
+		gpio_free(gpio);
+		return ret;
+	}
+
+	if (!(*irq)) {
+		ret = gpio_to_irq(gpio);
+		if (ret < 0) {
+			gpio_free(gpio);
+			return ret;
+		}
+		*irq = (unsigned int) ret;
+	}
+
+	ret = request_any_context_irq(*irq, handler, flags, name, NULL);
+	if (ret < 0) {
+		gpio_free(gpio);
+		return ret;
+	}
+
+	ret = set_irq_wake(*irq, wake);
+	if (ret < 0) {
+		free_irq(*irq, 0);
+		gpio_free(gpio);
+		return ret;
+	}
+
+	return 1;
+}
+
+static void hs_pmic_register(void)
+{
+	struct headset_notifier notifier;
+
+	if (hi->pdata.hpin_gpio) {
+		notifier.id = HEADSET_REG_HPIN_GPIO;
+		notifier.func = hs_pmic_hpin_state;
+		headset_notifier_register(&notifier);
+	}
+
+	if ((hi->pdata.driver_flag & DRIVER_HS_PMIC_RPC_KEY) ||
+	    (hi->pdata.driver_flag & DRIVER_HS_PMIC_ADC)) {
+#ifdef HTC_HEADSET_CONFIG_MSM_RPC
+		notifier.id = HEADSET_REG_REMOTE_ADC;
+		notifier.func = hs_pmic_remote_adc;
+		headset_notifier_register(&notifier);
+#endif
+
+#ifdef HTC_HEADSET_CONFIG_PMIC_8XXX_ADC
+		notifier.id = HEADSET_REG_REMOTE_ADC;
+		notifier.func = hs_pmic_remote_adc_pm8921;
+		headset_notifier_register(&notifier);
+#endif
+
+		notifier.id = HEADSET_REG_REMOTE_KEYCODE;
+		notifier.func = hs_pmic_adc_to_keycode;
+		headset_notifier_register(&notifier);
+
+		notifier.id = HEADSET_REG_RPC_KEY;
+		notifier.func = hs_pmic_rpc_key;
+		headset_notifier_register(&notifier);
+
+		notifier.id = HEADSET_REG_MIC_STATUS;
+		notifier.func = hs_pmic_mic_status;
+		headset_notifier_register(&notifier);
+	}
+
+	if (hi->pdata.key_enable_gpio) {
+		notifier.id = HEADSET_REG_KEY_ENABLE;
+		notifier.func = hs_pmic_key_enable;
+		headset_notifier_register(&notifier);
+	}
+}
+
+static int htc_headset_pmic_probe(struct platform_device *pdev)
+{
+	int ret = 0;
+	struct htc_headset_pmic_platform_data *pdata = pdev->dev.platform_data;
+#ifdef HTC_HEADSET_CONFIG_MSM_RPC
+	uint32_t vers = 0;
+#endif
+
+	HS_LOG("++++++++++++++++++++");
+
+	hi = kzalloc(sizeof(struct htc_35mm_pmic_info), GFP_KERNEL);
+	if (!hi)
+		return -ENOMEM;
+
+	hi->pdata.driver_flag = pdata->driver_flag;
+	hi->pdata.hpin_gpio = pdata->hpin_gpio;
+	hi->pdata.hpin_irq = pdata->hpin_irq;
+	hi->pdata.key_gpio = pdata->key_gpio;
+	hi->pdata.key_irq = pdata->key_irq;
+	hi->pdata.key_enable_gpio = pdata->key_enable_gpio;
+	hi->pdata.adc_mpp = pdata->adc_mpp;
+	hi->pdata.adc_amux = pdata->adc_amux;
+	hi->pdata.hs_controller = pdata->hs_controller;
+	hi->pdata.hs_switch = pdata->hs_switch;
+	hi->pdata.adc_mic = pdata->adc_mic;
+
+	if (!hi->pdata.adc_mic)
+		hi->pdata.adc_mic = HS_DEF_MIC_ADC_16_BIT_MIN;
+
+	if (pdata->adc_mic_bias[0] && pdata->adc_mic_bias[1]) {
+		memcpy(hi->pdata.adc_mic_bias, pdata->adc_mic_bias,
+		       sizeof(hi->pdata.adc_mic_bias));
+		hi->pdata.adc_mic = hi->pdata.adc_mic_bias[0];
+	} else {
+		hi->pdata.adc_mic_bias[0] = hi->pdata.adc_mic;
+		hi->pdata.adc_mic_bias[1] = HS_DEF_MIC_ADC_16_BIT_MAX;
+	}
+
+	if (pdata->adc_remote[5])
+		memcpy(hi->pdata.adc_remote, pdata->adc_remote,
+		       sizeof(hi->pdata.adc_remote));
+
+	if (pdata->adc_metrico[0] && pdata->adc_metrico[1])
+		memcpy(hi->pdata.adc_metrico, pdata->adc_metrico,
+		       sizeof(hi->pdata.adc_metrico));
+
+	hi->hpin_irq_type = IRQF_TRIGGER_NONE;
+	hi->hpin_debounce = HS_JIFFIES_ZERO;
+	hi->key_irq_type = IRQF_TRIGGER_NONE;
+
+	wake_lock_init(&hi->hs_wake_lock, WAKE_LOCK_SUSPEND, DRIVER_NAME);
+
+	detect_wq = create_workqueue("HS_PMIC_DETECT");
+	if (detect_wq  == NULL) {
+		ret = -ENOMEM;
+		HS_ERR("Failed to create detect workqueue");
+		goto err_create_detect_work_queue;
+	}
+
+	button_wq = create_workqueue("HS_PMIC_BUTTON");
+	if (button_wq == NULL) {
+		ret = -ENOMEM;
+		HS_ERR("Failed to create button workqueue");
+		goto err_create_button_work_queue;
+	}
+
+	if (hi->pdata.hpin_gpio) {
+		ret = hs_pmic_request_irq(hi->pdata.hpin_gpio,
+				&hi->pdata.hpin_irq, detect_irq_handler,
+				hi->hpin_irq_type, "HS_PMIC_DETECT", 1);
+		if (ret < 0) {
+			HS_ERR("Failed to request PMIC HPIN IRQ (0x%X)", ret);
+			goto err_request_detect_irq;
+		}
+		disable_irq(hi->pdata.hpin_irq);
+	}
+
+	if (hi->pdata.key_gpio) {
+		ret = hs_pmic_request_irq(hi->pdata.key_gpio,
+				&hi->pdata.key_irq, button_irq_handler,
+				hi->key_irq_type, "HS_PMIC_BUTTON", 1);
+		if (ret < 0) {
+			HS_ERR("Failed to request PMIC button IRQ (0x%X)", ret);
+			goto err_request_button_irq;
+		}
+		disable_irq(hi->pdata.key_irq);
+	}
+
+#ifdef HTC_HEADSET_CONFIG_MSM_RPC
+	if (hi->pdata.driver_flag & DRIVER_HS_PMIC_RPC_KEY) {
+		
+		endpoint_adc = msm_rpc_connect(HS_RPC_CLIENT_PROG,
+					       HS_RPC_CLIENT_VERS, 0);
+		if (IS_ERR(endpoint_adc)) {
+			hi->pdata.driver_flag &= ~DRIVER_HS_PMIC_RPC_KEY;
+			HS_LOG("Failed to register ADC RPC client");
+		} else
+			HS_LOG("Register ADC RPC client successfully");
+	}
+
+	if (hi->pdata.driver_flag & DRIVER_HS_PMIC_DYNAMIC_THRESHOLD) {
+		
+		vers = HS_PMIC_RPC_CLIENT_VERS_3_1;
+		endpoint_current = msm_rpc_connect_compatible(
+				   HS_PMIC_RPC_CLIENT_PROG, vers, 0);
+		if (!endpoint_current) {
+			vers = HS_PMIC_RPC_CLIENT_VERS_2_1;
+			endpoint_current = msm_rpc_connect(
+					   HS_PMIC_RPC_CLIENT_PROG, vers, 0);
+		}
+		if (!endpoint_current) {
+			vers = HS_PMIC_RPC_CLIENT_VERS_1_1;
+			endpoint_current = msm_rpc_connect(
+					   HS_PMIC_RPC_CLIENT_PROG, vers, 0);
+		}
+		if (!endpoint_current) {
+			vers = HS_PMIC_RPC_CLIENT_VERS;
+			endpoint_current = msm_rpc_connect(
+					   HS_PMIC_RPC_CLIENT_PROG, vers, 0);
+		}
+		if (IS_ERR(endpoint_current)) {
+			hi->pdata.driver_flag &=
+				~DRIVER_HS_PMIC_DYNAMIC_THRESHOLD;
+			HS_LOG("Failed to register threshold RPC client");
+		} else
+			HS_LOG("Register threshold RPC client successfully"
+			       " (0x%X)", vers);
+	}
+#else
+	hi->pdata.driver_flag &= ~DRIVER_HS_PMIC_RPC_KEY;
+	hi->pdata.driver_flag &= ~DRIVER_HS_PMIC_DYNAMIC_THRESHOLD;
+#endif
+
+	queue_delayed_work(detect_wq, &irq_init_work, HS_JIFFIES_IRQ_INIT);
+
+	hs_pmic_register();
+	hs_notify_driver_ready(DRIVER_NAME);
+
+	HS_LOG("--------------------");
+
+	return 0;
+
+err_request_button_irq:
+	if (hi->pdata.hpin_gpio) {
+		free_irq(hi->pdata.hpin_irq, 0);
+		gpio_free(hi->pdata.hpin_gpio);
+	}
+
+err_request_detect_irq:
+	destroy_workqueue(button_wq);
+
+err_create_button_work_queue:
+	destroy_workqueue(detect_wq);
+
+err_create_detect_work_queue:
+	wake_lock_destroy(&hi->hs_wake_lock);
+	kfree(hi);
+
+	HS_ERR("Failed to register %s driver", DRIVER_NAME);
+
+	return ret;
+}
+
+static int htc_headset_pmic_remove(struct platform_device *pdev)
+{
+	if (hi->pdata.key_gpio) {
+		free_irq(hi->pdata.key_irq, 0);
+		gpio_free(hi->pdata.key_gpio);
+	}
+
+	if (hi->pdata.hpin_gpio) {
+		free_irq(hi->pdata.hpin_irq, 0);
+		gpio_free(hi->pdata.hpin_gpio);
+	}
+
+	destroy_workqueue(button_wq);
+	destroy_workqueue(detect_wq);
+	wake_lock_destroy(&hi->hs_wake_lock);
+
+	kfree(hi);
+
+	return 0;
+}
+
+static struct platform_driver htc_headset_pmic_driver = {
+	.probe	= htc_headset_pmic_probe,
+	.remove	= htc_headset_pmic_remove,
+	.driver	= {
+		.name	= "HTC_HEADSET_PMIC",
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __init htc_headset_pmic_init(void)
+{
+	return platform_driver_register(&htc_headset_pmic_driver);
+}
+
+static void __exit htc_headset_pmic_exit(void)
+{
+	platform_driver_unregister(&htc_headset_pmic_driver);
+}
+
+module_init(htc_headset_pmic_init);
+module_exit(htc_headset_pmic_exit);
+
+MODULE_DESCRIPTION("HTC PMIC headset driver");
+MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-msm/htc/htc_port_list.c b/arch/arm/mach-msm/htc/htc_port_list.c
new file mode 100644
index 0000000..55d2e5a
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_port_list.c
@@ -0,0 +1,521 @@
+/* arch/arm/mach-msm/htc_port_list.c
+ * Copyright (C) 2009 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/miscdevice.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/mutex.h>
+#include <linux/wakelock.h>
+#include <linux/list.h>
+#include <mach/msm_iomap.h>
+#include <mach/board_htc.h>
+#include <net/tcp.h>
+#include "smd_private.h"
+
+#ifdef CONFIG_ARCH_MSM8960
+	#define PACKET_FILTER_UDP
+#endif
+
+static struct mutex port_lock;
+static struct wake_lock port_suspend_lock;
+static uint16_t *port_list = NULL;
+#ifdef PACKET_FILTER_UDP
+static uint16_t *port_list_udp = NULL;
+#endif
+static int usb_enable = 0;
+struct p_list {
+	struct list_head list;
+	int no;
+};
+static struct p_list curr_port_list;
+#ifdef PACKET_FILTER_UDP
+static struct p_list curr_port_list_udp;
+static int port_updated = 0;
+#endif
+static int packet_filter_flag = 1;
+struct class *p_class;
+static struct miscdevice portlist_misc = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "htc-portlist",
+};
+
+static int ril_debug_flag = 0;
+
+#define PF_LOG_DBG(fmt, ...) do {                           \
+		if (ril_debug_flag)                                 \
+			printk(KERN_DEBUG "[K]" pr_fmt(fmt), ##__VA_ARGS__);  \
+	} while (0)
+
+#define PF_LOG_INFO(fmt, ...) do {                         \
+		if (ril_debug_flag)                                \
+			printk(KERN_INFO "[K]" pr_fmt(fmt), ##__VA_ARGS__);  \
+	} while (0)
+
+#define PF_LOG_ERR(fmt, ...) do {                     \
+	if (ril_debug_flag)                               \
+		printk(KERN_ERR "[K]" pr_fmt(fmt), ##__VA_ARGS__);  \
+	} while (0)
+
+static ssize_t htc_show(struct device *dev,  struct device_attribute *attr,  char *buf)
+{
+	char *s = buf;
+	mutex_lock(&port_lock);
+	s += sprintf(s, "%d\n", packet_filter_flag);
+	mutex_unlock(&port_lock);
+	return s - buf;
+}
+
+static ssize_t htc_store(struct device *dev, struct device_attribute *attr,  const char *buf, size_t count)
+{
+	int ret;
+
+	mutex_lock(&port_lock);
+	if (!strncmp(buf, "0", strlen("0"))) {
+		packet_filter_flag = 0;
+		PF_LOG_INFO("[Port list] Disable Packet filter\n");
+#ifdef PACKET_FILTER_UDP
+		if (port_list_udp != NULL)
+			port_list_udp[0] = packet_filter_flag;
+		else
+			PF_LOG_ERR("[Port list] port_list_udp == NULL\n");
+#endif
+		if (port_list != NULL)
+			port_list[0] = packet_filter_flag;
+		else
+			PF_LOG_ERR("[Port list] port_list == NULL\n");
+		ret = count;
+	} else if (!strncmp(buf, "1", strlen("1"))) {
+		packet_filter_flag = 1;
+		PF_LOG_INFO("[Port list] Enable Packet filter\n");
+#ifdef PACKET_FILTER_UDP
+		if (port_list_udp != NULL)
+			port_list_udp[0] = packet_filter_flag;
+		else
+			PF_LOG_ERR("[Port list] port_list_udp == NULL\n");
+#endif
+		if (port_list != NULL)
+			port_list[0] = packet_filter_flag;
+		else
+			PF_LOG_ERR("[Port list] port_list == NULL\n");
+		ret = count;
+	} else {
+		PF_LOG_ERR("[Port list] flag: invalid argument\n");
+		ret = -EINVAL;
+	}
+	mutex_unlock(&port_lock);
+
+	return ret;
+}
+
+static DEVICE_ATTR(flag, 0664, htc_show, htc_store);
+
+static int port_list_enable(int enable)
+{
+	if (port_list[0] != enable) {
+		port_list[0] = enable;
+		if (enable)
+			PF_LOG_INFO("[Port list] port_list is enabled.\n");
+		else
+			PF_LOG_INFO("[Port list] port_list is disabled.\n");
+	}
+	return 0;
+}
+
+#ifdef PACKET_FILTER_UDP
+static int port_list_enable_udp(int enable)
+{
+	if (port_list_udp[0] != enable) {
+		port_list_udp[0] = enable;
+		if (enable)
+			PF_LOG_INFO("[Port list] port_list_udp is enabled.\n");
+		else
+			PF_LOG_INFO("[Port list] port_list_udp is disabled.\n");
+	}
+	return 0;
+}
+#endif
+
+static void update_port_list(void)
+{
+	size_t count = 0;
+	size_t i = 0;
+	struct list_head *listptr;
+	struct p_list *entry;
+
+	list_for_each(listptr, &curr_port_list.list) {
+		entry = list_entry(listptr, struct p_list, list);
+		count++;
+		PF_LOG_INFO("[Port list] [%d] = %d\n", count, entry->no);
+		if (count <= 127)
+			port_list[count] = entry->no;
+	}
+	if (count < 127)
+		for (i = count + 1; i <= 127; i++)
+			port_list[i] = 0;
+
+	if (usb_enable) {
+		port_list_enable(0);
+	} else {
+		if (count <= 127)
+			port_list_enable(1);
+		else
+			port_list_enable(0);
+	}
+
+	#ifdef PACKET_FILTER_UDP
+	count = 0;
+	list_for_each(listptr, &curr_port_list_udp.list) {
+		entry = list_entry(listptr, struct p_list, list);
+		count++;
+		if (count <= 127)
+			port_list_udp[count] = entry->no;
+	}
+	PF_LOG_INFO("[Port list] Total UDP amount in linked-list = %d\n", count);
+
+	if (count < 127)
+		for (i = count + 1; i <= 127; i++)
+			port_list_udp[i] = 0;
+
+	if (usb_enable) {
+		port_list_enable_udp(0);
+	} else {
+		if (count <= 127)
+			port_list_enable_udp(1);
+		else
+			port_list_enable_udp(0);
+	}
+	#endif
+}
+
+static struct p_list *add_list(int no)
+{
+	struct p_list *ptr = NULL;
+	struct list_head *listptr;
+	struct p_list *entry;
+	int get_list = 0;
+
+	list_for_each(listptr, &curr_port_list.list) {
+		entry = list_entry(listptr, struct p_list, list);
+		if (entry->no == no) {
+			PF_LOG_INFO("[Port list] TCP port[%d] is already in the list!", entry->no);
+			get_list = 1;
+			break;
+		}
+	}
+	if (!get_list) {
+		ptr = kmalloc(sizeof(struct p_list), GFP_KERNEL);
+		if (ptr) {
+			ptr->no = no;
+			list_add_tail(&ptr->list, &curr_port_list.list);
+			PF_LOG_INFO("[Port list] TCP port[%d] added\n", no);
+		}
+	}
+	return (ptr);
+}
+#ifdef PACKET_FILTER_UDP
+static struct p_list *add_list_udp(int no)
+{
+	struct p_list *ptr = NULL;
+	struct list_head *listptr;
+	struct p_list *entry;
+	int get_list = 0;
+
+	list_for_each(listptr, &curr_port_list_udp.list) {
+		entry = list_entry(listptr, struct p_list, list);
+		if (entry->no == no) {
+			PF_LOG_INFO("[Port list] UDP port[%d] is already in the list!", entry->no);
+			get_list = 1;
+			break;
+		}
+	}
+	if (!get_list) {
+		ptr = kmalloc(sizeof(struct p_list), GFP_KERNEL);
+		if (ptr) {
+			ptr->no = no;
+			list_add_tail(&ptr->list, &curr_port_list_udp.list);
+			PF_LOG_INFO("[Port list] UDP port[%d] added\n", no);
+			port_updated = 1;
+		}
+	}
+	return (ptr);
+}
+#endif
+
+static void remove_list(int no)
+{
+	struct list_head *listptr;
+	struct p_list *entry;
+	int get_list = 0;
+
+	list_for_each(listptr, &curr_port_list.list) {
+		entry = list_entry(listptr, struct p_list, list);
+		if (entry->no == no) {
+			PF_LOG_INFO("[Port list] TCP port[%d] removed\n", entry->no);
+			list_del(&entry->list);
+			kfree(entry);
+			get_list = 1;
+			break;
+		}
+	}
+	if (!get_list)
+		PF_LOG_INFO("[Port list] TCP port[%d] failed to remove. Port number is not in list!\n", no);
+}
+#ifdef PACKET_FILTER_UDP
+static void remove_list_udp(int no)
+{
+	struct list_head *listptr;
+	struct p_list *entry;
+	int get_list = 0;
+
+	list_for_each(listptr, &curr_port_list_udp.list) {
+		entry = list_entry(listptr, struct p_list, list);
+		if (entry->no == no) {
+			PF_LOG_INFO("[Port list] UDP port[%d] removed\n", entry->no);
+			list_del(&entry->list);
+			kfree(entry);
+			get_list = 1;
+			port_updated = 1;
+			break;
+		}
+	}
+}
+#endif
+
+static int allocate_port_list(void)
+{
+	uint32_t port_list_phy_addr;
+
+	#if defined PACKET_FILTER_UDP
+	port_list = smem_alloc(SMEM_ID_VENDOR2, sizeof(uint16_t)*256);
+	#else
+	port_list = smem_alloc(SMEM_ID_VENDOR2, sizeof(uint16_t)*128);
+	#endif
+
+	port_list_phy_addr = MSM_SHARED_RAM_PHYS + ((uint32_t)port_list - (uint32_t)MSM_SHARED_RAM_BASE);
+	if (port_list == NULL) {
+		return -1;
+	} else {
+		PF_LOG_INFO("[Port list] Virtual Address of port_list: [%p]\n", port_list);
+		PF_LOG_INFO("[Port list] Physical Address of port_list: [%X]\n", port_list_phy_addr);
+
+		port_list[0] = packet_filter_flag;
+		#ifdef PACKET_FILTER_UDP
+		port_list_udp = port_list + 128;
+		port_list_udp[0] = packet_filter_flag;
+		PF_LOG_INFO("[Port list] Address of port_list: [%p]\n", port_list);
+		PF_LOG_INFO("[Port list] Address of port_list_udp: [%p]\n", port_list_udp);
+		#endif
+		return 0;
+	}
+}
+
+int add_or_remove_port(struct sock *sk, int add_or_remove)
+{
+	struct inet_sock *inet = inet_sk(sk);
+	__be32 src = inet->inet_rcv_saddr;
+	__u16 srcp = ntohs(inet->inet_sport);
+
+	wake_lock(&port_suspend_lock);
+	if (!packet_filter_flag) {
+		wake_unlock(&port_suspend_lock);
+		return 0;
+	}
+
+	
+	if (port_list == NULL) {
+		if(allocate_port_list()!=0) {
+			wake_unlock(&port_suspend_lock);
+			return 0;
+		}
+	}
+
+	
+	if (sk->sk_protocol == IPPROTO_TCP && src != 0x0100007F && srcp != 0) {
+		mutex_lock(&port_lock);
+		PF_LOG_INFO("[Port list] TCP port#: [%d]\n", srcp);
+		if (add_or_remove)
+			add_list(srcp);
+		else
+			remove_list(srcp);
+		update_port_list();
+		mutex_unlock(&port_lock);
+	}
+
+#ifdef PACKET_FILTER_UDP
+	
+	if (sk->sk_protocol == IPPROTO_UDP && src != 0x0100007F && srcp != 0) {
+		mutex_lock(&port_lock);
+		port_updated = 0;
+		if (add_or_remove)
+			add_list_udp(srcp);
+		else
+			remove_list_udp(srcp);
+		if(port_updated)
+			update_port_list();
+		mutex_unlock(&port_lock);
+	}
+#endif
+
+	wake_unlock(&port_suspend_lock);
+	return 0;
+}
+EXPORT_SYMBOL(add_or_remove_port);
+
+int update_port_list_charging_state(int enable)
+{
+	size_t count = 0;
+
+	wake_lock(&port_suspend_lock);
+	if (!packet_filter_flag) {
+		wake_unlock(&port_suspend_lock);
+		return 0;
+	}
+
+	if (port_list == NULL) {
+		PF_LOG_INFO("[Port list] port_list is NULL.\n");
+		wake_unlock(&port_suspend_lock);
+		return 0;
+	}
+
+	usb_enable = enable;
+	mutex_lock(&port_lock);
+	if (usb_enable) {
+		port_list_enable(0);
+	} else {
+		for (count = 1; count <= 127; count++) {
+			if (!port_list[count])
+				break;
+		}
+		if (count <= 127)
+			port_list_enable(1);
+		else
+			port_list_enable(0);
+	}
+	#ifdef PACKET_FILTER_UDP
+	if (usb_enable) {
+		port_list_enable_udp(0);
+	} else {
+		for (count = 1; count <= 127; count++) {
+			if (!port_list_udp[count])
+				break;
+		}
+		if (count <= 127)
+			port_list_enable_udp(1);
+		else
+			port_list_enable_udp(0);
+	}
+	#endif
+	mutex_unlock(&port_lock);
+	wake_unlock(&port_suspend_lock);
+	return 0;
+}
+EXPORT_SYMBOL(update_port_list_charging_state);
+
+static int __init port_list_init(void)
+{
+	int ret;
+	wake_lock_init(&port_suspend_lock, WAKE_LOCK_SUSPEND, "port_list");
+	mutex_init(&port_lock);
+
+	PF_LOG_INFO("[Port list] init()\n");
+
+	
+	if (get_kernel_flag() & KERNEL_FLAG_RIL_DBG_MEMCPY)
+		ril_debug_flag = 1;
+
+	
+	memset(&curr_port_list, 0, sizeof(curr_port_list));
+	INIT_LIST_HEAD(&curr_port_list.list);
+
+	#ifdef PACKET_FILTER_UDP
+	
+	memset(&curr_port_list_udp, 0, sizeof(curr_port_list_udp));
+	INIT_LIST_HEAD(&curr_port_list_udp.list);
+	#endif
+
+	
+	allocate_port_list();
+
+	ret = misc_register(&portlist_misc);
+	if (ret < 0) {
+		PF_LOG_ERR("[Port list] failed to register misc device!\n");
+		goto err_misc_register;
+	}
+
+	p_class = class_create(THIS_MODULE, "htc_portlist");
+	if (IS_ERR(p_class)) {
+		ret = PTR_ERR(p_class);
+		p_class = NULL;
+		PF_LOG_ERR("[Port list] class_create failed!\n");
+		goto err_class_create;
+	}
+
+	portlist_misc.this_device = device_create(p_class, NULL, 0 , NULL, "packet_filter");
+	if (IS_ERR(portlist_misc.this_device)) {
+		ret = PTR_ERR(portlist_misc.this_device);
+		portlist_misc.this_device = NULL;
+		PF_LOG_ERR("[Port list] device_create failed!\n");
+		goto err_device_create;
+	}
+
+	ret = device_create_file(portlist_misc.this_device, &dev_attr_flag);
+	if (ret < 0) {
+		PF_LOG_ERR("[Port list] devices_create_file failed!\n");
+		goto err_device_create_file;
+	}
+
+	return 0;
+
+err_device_create_file:
+	device_destroy(p_class, 0);
+err_device_create:
+	class_destroy(p_class);
+err_class_create:
+	misc_deregister(&portlist_misc);
+err_misc_register:
+	return ret;
+}
+
+static void __exit port_list_exit(void)
+{
+	int ret;
+	struct list_head *listptr;
+	struct p_list *entry;
+
+	device_remove_file(portlist_misc.this_device, &dev_attr_flag);
+	device_destroy(p_class, 0);
+	class_destroy(p_class);
+
+	ret = misc_deregister(&portlist_misc);
+	if (ret < 0)
+		PF_LOG_ERR("[Port list] failed to unregister misc device!\n");
+
+	list_for_each(listptr, &curr_port_list.list) {
+		entry = list_entry(listptr, struct p_list, list);
+		kfree(entry);
+	}
+	#ifdef PACKET_FILTER_UDP
+	list_for_each(listptr, &curr_port_list_udp.list) {
+		entry = list_entry(listptr, struct p_list, list);
+		kfree(entry);
+	}
+	#endif
+}
+
+late_initcall(port_list_init);
+module_exit(port_list_exit);
+
+MODULE_AUTHOR("Mio Su <Mio_Su@htc.com>");
+MODULE_DESCRIPTION("HTC port list driver");
+MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-msm/htc/htc_ramdump.c b/arch/arm/mach-msm/htc/htc_ramdump.c
new file mode 100644
index 0000000..011d0cc
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_ramdump.c
@@ -0,0 +1,217 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#include <linux/debugfs.h>
+#include <linux/errno.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <asm/uaccess.h>
+#include <mach/msm_iomap.h>
+#include <mach/htc_ramdump.h>
+#include <linux/miscdevice.h>
+
+#define COPY_LENGTH (1024*1024)
+
+struct ramdump_platform_data *pdata;
+
+int pointer;
+char * loc_buf;
+
+static int ramdump_open(struct inode *inode, struct file *file)
+{
+	pr_info("%s:\n", __func__);
+	return 0;
+}
+
+static int ramdump_release(struct inode *inode, struct file *file)
+{
+	pr_info("%s:\n", __func__);
+	return 0;
+}
+
+
+static int get_block_count(void)
+{
+	int i;
+	long totalblock;
+	i = 0;
+	totalblock = 0;
+	for (i = 0; i < pdata->count; i++)
+		totalblock += (pdata->region[i].size / COPY_LENGTH);
+
+	return totalblock;
+}
+
+static unsigned long dump_startaddress(void)
+{
+	unsigned long dump_address = 0;
+	unsigned long tmp_address;
+	int i, tmp;
+	int current_point = pointer;
+
+
+	if (pointer < get_block_count()) {
+		i = 0;
+		for (i = 0; i <  pdata->count; i++) {
+			tmp_address = pdata->region[i].start + current_point * COPY_LENGTH;
+
+			
+			
+			if ((tmp_address - pdata->region[i].start) >= pdata->region[i].size) {
+				tmp = pdata->region[i].size/COPY_LENGTH;
+				current_point -= tmp;
+			} else{
+				dump_address = tmp_address;
+			}
+		}
+	}
+
+	return dump_address;
+}
+
+static ssize_t htc_ramdump_read(struct file *fp, char __user *buf, size_t count, loff_t *pos)
+{
+	int ret;
+	int length;
+	void __iomem *start;
+	unsigned long dump_startaddr;
+
+
+	dump_startaddr = dump_startaddress();
+
+	pr_err("  %lx, pointer %d \n", dump_startaddr, pointer);
+	if (dump_startaddr == 0) {
+		ret = -1;
+		return ret;
+	}
+
+	start = ioremap(dump_startaddr, COPY_LENGTH);
+
+	memcpy_fromio(loc_buf, start, COPY_LENGTH);
+	if (count > COPY_LENGTH)
+		length = COPY_LENGTH;
+	else
+		length = count;
+
+	ret = copy_to_user(buf, loc_buf, length);
+	if (ret) {
+		pr_err("copy to user fail %d \n", ret);
+		goto copy_to_user_error;
+	}
+
+	pointer ++;
+copy_to_user_error:
+	iounmap(start);
+	return length;
+}
+
+static long ramdump_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	void __user *argp = (void __user *)arg;
+	int count;
+	switch (cmd) {
+		case GET_RAMDUMP_LENGTH:
+			count = get_block_count();
+			pr_err("total block number %d \n", count);
+			if (copy_to_user(argp, &count, sizeof(count)))
+				return -EFAULT;
+		break;
+		case JUMP_RAMUDMP_START:
+			pointer = 0;
+		break;
+	default:
+		break;
+
+	}
+	return 0;
+}
+
+static const struct file_operations ramdump_fops = {
+	.owner = THIS_MODULE,
+	.open = ramdump_open,
+	.read = htc_ramdump_read,
+	.release = ramdump_release,
+	.compat_ioctl = ramdump_ioctl,
+	.unlocked_ioctl = ramdump_ioctl,
+};
+
+
+static struct miscdevice ramdump_device = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "ramdump",
+	.fops = &ramdump_fops,
+};
+
+
+
+static int __devinit htc_ramdump_probe(struct platform_device *pdev)
+{
+	int err, ret;
+
+	pdata = pdev->dev.platform_data;
+	if (!pdata) {
+		pr_err("%s: pdata get fail\n", __func__);
+		return -ENOSYS;
+	}
+
+	err = misc_register(&ramdump_device);
+	if (err) {
+		pr_err("%s: ramdump device register failed\n", __func__);
+		ret = -EFAULT;
+		goto exit_misc_device_register_failed;
+	}
+
+	loc_buf = kzalloc(COPY_LENGTH, GFP_KERNEL);
+	if (loc_buf == NULL) {
+		pr_err("%s: kzalloc failed\n", __func__);
+		ret = -ENOMEM;
+		goto exit_kzalloc_fail;
+	}
+	pointer = 0;
+	return 0;
+
+exit_kzalloc_fail:
+	misc_deregister(&ramdump_device);
+exit_misc_device_register_failed:
+	return ret;
+}
+
+
+static struct platform_driver htc_ramdump_driver = {
+	.probe		= htc_ramdump_probe,
+	.driver		= {
+		.name = "htc_ramdump",
+		.owner = THIS_MODULE,
+	},
+};
+
+static int __init htc_ramdump_init(void)
+{
+	return platform_driver_register(&htc_ramdump_driver);
+}
+
+static void __exit htc_ramdump_exit(void)
+{
+	platform_driver_unregister(&htc_ramdump_driver);
+}
+
+module_init(htc_ramdump_init);
+module_exit(htc_ramdump_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("htc ramdump driver");
+MODULE_VERSION("1.1");
+MODULE_ALIAS("platform:htc_ramdump");
diff --git a/arch/arm/mach-msm/htc/htc_restart_handler.c b/arch/arm/mach-msm/htc/htc_restart_handler.c
new file mode 100644
index 0000000..7ffd1f3
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_restart_handler.c
@@ -0,0 +1,143 @@
+/* linux/arch/arm/mach-msm/htc_restart_handler.c
+ *
+ * Copyright (C) 2012 HTC Corporation.
+ * Author: Jimmy.CM Chen <jimmy.cm_chen@htc.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/reboot.h>
+#include <linux/io.h>
+
+#include <mach/msm_iomap.h>
+#include <mach/restart.h>
+#include <mach/scm.h>
+#include <mach/board_htc.h>
+#include <mach/htc_restart_handler.h>
+
+#define RESTART_REASON_ADDR	0xF00
+#define MSM_REBOOT_REASON_BASE	(MSM_IMEM_BASE + RESTART_REASON_ADDR)
+#define SZ_DIAG_ERR_MSG 	0xC8
+struct htc_reboot_params {
+	unsigned reboot_reason;
+	unsigned radio_flag;
+	char reserved[256 - SZ_DIAG_ERR_MSG - 8];
+	char msg[SZ_DIAG_ERR_MSG];
+};
+
+static struct htc_reboot_params *reboot_params;
+static atomic_t restart_counter = ATOMIC_INIT(0);
+
+/*
+   This function should not be called outsite
+   to ensure that others do no change restart reason.
+   Use mode & cmd to set reason & msg in arch_reset().
+*/
+static inline void set_restart_msg(const char *msg)
+{
+	if (msg) {
+		pr_info("%s: set restart msg = `%s'\r\n", __func__, msg);
+		strncpy(reboot_params->msg, msg, sizeof(reboot_params->msg)-1);
+	}
+	else {
+		strncpy(reboot_params->msg, "", sizeof(reboot_params->msg)-1);
+	}
+	mb();
+}
+
+unsigned get_restart_reason(void)
+{
+	return reboot_params->reboot_reason;
+}
+EXPORT_SYMBOL(get_restart_reason);
+
+/*
+   This function should not be called outside
+   to ensure that others do not change restart reason.
+   Use mode & cmd to set reason & msg in arch_reset().
+*/
+static inline void set_restart_reason(unsigned int reason)
+{
+	pr_info("%s: set restart reason = %08x\r\n", __func__, reason);
+	reboot_params->reboot_reason = reason;
+	mb();
+}
+
+static int panic_restart_action(struct notifier_block *this, unsigned long event, void *ptr)
+{
+	char kernel_panic_msg[SZ_DIAG_ERR_MSG] = "Kernel Panic";
+	/* ptr is a buffer declared in panic function. It's never be NULL.
+	   Reserve one space for trailing zero.
+	*/
+	if (ptr)
+		snprintf(kernel_panic_msg, SZ_DIAG_ERR_MSG-1, "KP: %s", (char *)ptr);
+	set_restart_to_ramdump(kernel_panic_msg);
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block panic_blk = {
+	.notifier_call  = panic_restart_action,
+};
+
+int set_restart_action(unsigned int reason, const char *msg)
+{
+	/* only allow write msg before entering arch_rest */
+	if (atomic_read(&restart_counter) != 0) {
+		pr_warn("%s: someone call this function before\r\n", __func__);
+		return 1;
+	}
+
+	atomic_set(&restart_counter, 1);
+
+	set_restart_reason(reason);
+	set_restart_msg(msg? msg: "");
+	return 0;
+}
+EXPORT_SYMBOL(set_restart_action);
+
+int set_restart_to_oem(unsigned int code, const char *msg)
+{
+	char oem_msg[SZ_DIAG_ERR_MSG] = "";
+
+	if (msg == NULL)
+		sprintf(oem_msg, "oem-%x", code);
+	else
+		strncpy(oem_msg, msg, (strlen(msg) >= SZ_DIAG_ERR_MSG)? (SZ_DIAG_ERR_MSG - 1): strlen(msg));
+
+	/* oem-94, 95, 96, 97, 98, 99 are RIL fatal */
+	if ((code >= 0x94) && (code <= 0x98))
+		code = 0x99;
+
+	return set_restart_action(RESTART_REASON_OEM_BASE | code, oem_msg);
+}
+int set_restart_to_ramdump(const char *msg)
+{
+	return set_restart_action(RESTART_REASON_RAMDUMP, msg);
+}
+EXPORT_SYMBOL(set_restart_to_ramdump);
+
+int htc_restart_handler_init(void)
+{
+	reboot_params = (void *)MSM_REBOOT_REASON_BASE;
+	reboot_params->radio_flag = get_radio_flag();
+	set_restart_reason(RESTART_REASON_RAMDUMP);
+	set_restart_msg("Unknown");
+
+	atomic_notifier_chain_register(&panic_notifier_list, &panic_blk);
+
+	return 0;
+}
+EXPORT_SYMBOL(htc_restart_handler_init);
+
diff --git a/arch/arm/mach-msm/htc/htc_sysinfo.c b/arch/arm/mach-msm/htc/htc_sysinfo.c
new file mode 100644
index 0000000..f74b257
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_sysinfo.c
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2010 HTC, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+#include <mach/board.h>
+
+#include <mach/gpio.h>			
+#include <linux/mfd/pm8xxx/gpio.h>	
+#include <linux/mfd/pm8xxx/mpp.h>	
+
+#include <mach/msm_iomap.h>
+
+#define GPIO_INFO_BUFFER_SIZE	20000
+#define REG(x)	{#x, MSM_EBI1_CH0_##x##_ADDR}
+#define REGI(x, n)	{#x "_" #n, MSM_EBI1_CH0_##x##_ADDR(n)}
+
+#define CHECK_PROC_ENTRY(name, entry) do { \
+				if (entry) { \
+					pr_info("Create /proc/%s OK.\n", name); \
+				} else { \
+					pr_err("Create /proc/%s FAILED.\n", name); \
+				} \
+			} while (0);
+
+
+static char gpio_info_buffer[GPIO_INFO_BUFFER_SIZE];
+
+static int sys_gpio_read_proc(char *page, char **start, off_t off,
+			int count, int *eof, void *data)
+{
+	char *p = page;
+	uint32_t len = 0;
+
+	pr_info("%s: page=0x%08x, start=0x%08x, off=%d, count=%d, eof=%d, data=0x%08x\n", __func__,
+			(uint32_t)page, (uint32_t)*start, (int)off, count, *eof, (uint32_t)data);
+
+	
+	*start = page;
+
+	if (!off) {
+		
+		memset(gpio_info_buffer, 0, sizeof(gpio_info_buffer));
+		len = 0;
+#if 0 
+		len = msm_dump_gpios(NULL, len, gpio_info_buffer);
+		len = pm8xxx_dump_gpios(NULL, len, gpio_info_buffer);
+		len = pm8xxx_dump_mpp(NULL, len, gpio_info_buffer);
+#endif
+		pr_info("%s: total bytes = %d.\n", __func__, len);
+	}
+	len = strlen(gpio_info_buffer + off);
+
+	
+	if (len > 0) {
+		
+		if (len >= count)
+			len = count;
+		pr_info("%s: transfer %d bytes.", __func__, len);
+		memcpy(p, gpio_info_buffer + off, len);
+	}
+
+	
+	if (len < count) {
+		pr_info("%s: end.", __func__);
+		*eof = 1;
+	}
+
+	return len;
+}
+
+extern int board_get_boot_powerkey_debounce_time(void);
+int sys_boot_powerkey_debounce_ms(char *page, char **start, off_t off,
+			   int count, int *eof, void *data)
+{
+	char *p = page;
+
+	p += sprintf(p, "%d\n", board_get_boot_powerkey_debounce_time());
+
+	return p - page;
+}
+
+static int __init sysinfo_proc_init(void)
+{
+	struct proc_dir_entry *entry = NULL;
+
+	pr_info("%s: Init HTC system info proc interface.\r\n", __func__);
+
+	
+	entry = create_proc_read_entry("emmc", 0, NULL, emmc_partition_read_proc, NULL);
+	CHECK_PROC_ENTRY("emmc", entry);
+
+	entry = create_proc_read_entry("gpio_info", 0, NULL, sys_gpio_read_proc, NULL);
+	CHECK_PROC_ENTRY("gpio_info", entry);
+
+	entry = create_proc_read_entry("powerkey_debounce_ms", 0, NULL, sys_boot_powerkey_debounce_ms, NULL);
+	CHECK_PROC_ENTRY("powerkey_debounce_ms", entry);
+
+#ifdef CONFIG_HTC_DYING_PROCESS_COUNT
+	entry = create_proc_read_entry("dying_processes", 0, NULL, dying_processors_read_proc, NULL);
+	CHECK_PROC_ENTRY("dying_processes", entry);
+#endif
+
+	return 0;
+}
+
+module_init(sysinfo_proc_init);
+MODULE_AUTHOR("Jimmy.CM Chen <jimmy.cm_chen@htc.com>");
+MODULE_DESCRIPTION("HTC System Info Interface");
+MODULE_VERSION("1.0");
+MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-msm/htc/htc_wifi_nvs.c b/arch/arm/mach-msm/htc/htc_wifi_nvs.c
new file mode 100644
index 0000000..0d7ce0d
--- /dev/null
+++ b/arch/arm/mach-msm/htc/htc_wifi_nvs.c
@@ -0,0 +1,153 @@
+/* arch/arm/mach-msm/htc_wifi_nvs.c
+ *
+ * Code to extract WiFi calibration information from ATAG set up 
+ * by the bootloader.
+ *
+ * Copyright (C) 2008 Google, Inc.
+ * Author: Dmitry Shmidt <dimitrysh@google.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/string.h>
+#include <linux/export.h>
+#include <linux/proc_fs.h>
+
+#include <asm/setup.h>
+#include <mach/htc_wifi_nvs.h>
+
+#define ATAG_MSM_WIFI	0x57494649 
+
+#define NVS_MAX_SIZE	0x800U
+#define NVS_LEN_OFFSET	0x0C
+#define NVS_DATA_OFFSET	0x40
+
+static unsigned char wifi_nvs_ram[NVS_MAX_SIZE];
+static struct proc_dir_entry *wifi_calibration;
+static struct proc_dir_entry *wifi_data;
+
+unsigned char *get_wifi_nvs_ram( void )
+{
+	return( wifi_nvs_ram );
+}
+EXPORT_SYMBOL(get_wifi_nvs_ram);
+
+unsigned char* wlan_random_mac(unsigned char *set_mac_addr)
+{
+	static unsigned char mac_addr[6]={0,0,0,0,0,0};
+	if(set_mac_addr != NULL){
+		mac_addr[0]=set_mac_addr[0];
+		mac_addr[1]=set_mac_addr[1];
+		mac_addr[2]=set_mac_addr[2];
+		mac_addr[3]=set_mac_addr[3];
+		mac_addr[4]=set_mac_addr[4];
+		mac_addr[5]=set_mac_addr[5];
+	}
+	return mac_addr;
+}
+EXPORT_SYMBOL(wlan_random_mac);
+
+static int __init parse_tag_msm_wifi(const struct tag *tag)
+{
+	unsigned char *dptr = (unsigned char *)(&tag->u);
+	unsigned size;
+#ifdef ATAG_MSM_WIFI_DEBUG
+	unsigned i;
+#endif
+
+	size = min((tag->hdr.size - 2) * sizeof(__u32), NVS_MAX_SIZE);
+#ifdef ATAG_MSM_WIFI_DEBUG
+	printk("WiFi Data size = %d , 0x%x\n", tag->hdr.size, tag->hdr.tag);
+	for(i=0;( i < size );i++) {
+		printk("%02x ", *dptr++);
+	}
+#endif	
+	memcpy(wifi_nvs_ram, dptr, size);
+	return 0;
+}
+
+__tagtable(ATAG_MSM_WIFI, parse_tag_msm_wifi);
+
+static unsigned wifi_get_nvs_size( void )
+{
+	unsigned char *ptr;
+	unsigned len;
+
+	ptr = get_wifi_nvs_ram();
+	
+	memcpy(&len, ptr + NVS_LEN_OFFSET, sizeof(len));
+	len = min(len, (NVS_MAX_SIZE - NVS_DATA_OFFSET));
+	return len;
+}
+
+int wifi_calibration_size_set(void)
+{
+	if (wifi_calibration != NULL)
+		wifi_calibration->size = wifi_get_nvs_size();
+	return 0;
+}
+
+int htc_get_wifi_calibration(char *buf, int count)
+{
+	unsigned char *ptr;
+	unsigned len;
+
+	ptr = get_wifi_nvs_ram();
+	len = min(wifi_get_nvs_size(), (unsigned) count);
+	memcpy(buf, ptr + NVS_DATA_OFFSET, len);
+	return len;
+}
+EXPORT_SYMBOL(htc_get_wifi_calibration);
+
+int htc_get_wifi_data(char *buf)
+{
+	unsigned char *ptr;
+
+	ptr = get_wifi_nvs_ram();
+	memcpy(buf, ptr, NVS_DATA_OFFSET);
+	return NVS_DATA_OFFSET;
+}
+EXPORT_SYMBOL(htc_get_wifi_data);
+
+static int wifi_calibration_read_proc(char *page, char **start, off_t off,
+					int count, int *eof, void *data)
+{
+	return htc_get_wifi_calibration(page, count);
+}
+
+static int wifi_data_read_proc(char *page, char **start, off_t off,
+		int count, int *eof, void *data)
+{
+	return htc_get_wifi_data(page);
+}
+
+static int __init wifi_nvs_init(void)
+{
+	wifi_calibration = create_proc_entry("calibration", 0444, NULL);
+	if (wifi_calibration != NULL) {
+		wifi_calibration->size = wifi_get_nvs_size();
+		wifi_calibration->read_proc = wifi_calibration_read_proc;
+		wifi_calibration->write_proc = NULL;
+	}
+
+	wifi_data = create_proc_entry("wifi_data", 0444, NULL);
+	if (wifi_data != NULL) {
+		wifi_data->size = NVS_DATA_OFFSET;
+		wifi_data->read_proc = wifi_data_read_proc;
+		wifi_data->write_proc = NULL;
+	}
+	return 0;
+}
+
+late_initcall(wifi_nvs_init);
diff --git a/arch/arm/mach-msm/htc/jet/Kconfig b/arch/arm/mach-msm/htc/jet/Kconfig
new file mode 100644
index 0000000..d289b58
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/Kconfig
@@ -0,0 +1,10 @@
+config BOARD_HEADER_FILE
+	string "HTC board specific header file name"
+	default ""
+
+config MACH_JET
+	depends on ARCH_MSM8960
+	select MACH_HTC
+	bool "HTC JET"
+	help
+	  Support for the HTC JET device.
diff --git a/arch/arm/mach-msm/htc/jet/Makefile b/arch/arm/mach-msm/htc/jet/Makefile
new file mode 100644
index 0000000..d354473
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/Makefile
@@ -0,0 +1,10 @@
+obj-$(CONFIG_MACH_JET) += board-jet.o
+obj-$(CONFIG_MACH_JET) += board-jet-regulator.o
+obj-$(CONFIG_MACH_JET) += board-jet-gpiomux.o
+obj-$(CONFIG_MACH_JET) += board-jet-storage.o
+obj-$(CONFIG_MACH_JET) += board-jet-audio.o
+obj-$(CONFIG_MACH_JET) += board-jet-pmic.o
+obj-$(CONFIG_MACH_JET) += board-jet-keypad.o
+obj-$(CONFIG_MACH_JET) += board-jet-camera.o
+obj-$(CONFIG_MACH_JET) += display/
+CFLAGS_board-jet-display.o += -Idrivers/video
diff --git a/arch/arm/mach-msm/htc/jet/board-jet-audio.c b/arch/arm/mach-msm/htc/jet/board-jet-audio.c
new file mode 100644
index 0000000..09e4ee2
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/board-jet-audio.c
@@ -0,0 +1,1810 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * HTC: jet machine driver which defines board-specific data
+ * Copy from sound/soc/msm/msm8960.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <sound/core.h>
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+#include <sound/pcm.h>
+#include <sound/jack.h>
+#include <asm/mach-types.h>
+#include <mach/socinfo.h>
+#include <linux/mfd/wcd9xxx/core.h>
+#include "../../../sound/soc/codecs/wcd9310.h"
+#include "../sound/soc/msm/msm-pcm-routing.h"
+#include "board-jet.h"
+
+#include <mach/cable_detect.h>
+#include <mach/board.h>
+
+#define MSM_SPK_ON 1
+#define MSM_SPK_OFF 0
+
+#define MSM_SLIM_0_RX_MAX_CHANNELS		2
+#define MSM_SLIM_0_TX_MAX_CHANNELS		4
+
+#define SAMPLE_RATE_8KHZ 8000
+#define SAMPLE_RATE_16KHZ 16000
+
+#define BOTTOM_SPK_AMP_POS	0x1
+#define BOTTOM_SPK_AMP_NEG	0x2
+#define TOP_SPK_AMP_POS		0x4
+#define TOP_SPK_AMP_NEG		0x8
+#define DOCK_SPK_AMP_POS	0x10
+#define DOCK_SPK_AMP_NEG	0x20
+
+#define GPIO_AUX_PCM_DOUT 63
+#define GPIO_AUX_PCM_DIN 64
+#define GPIO_AUX_PCM_SYNC 65
+#define GPIO_AUX_PCM_CLK 66
+
+#define TABLA_EXT_CLK_RATE 12288000
+
+#define JET_AUD_STEREO_REC	(PM8921_GPIO_PM_TO_SYS(3))
+#define top_spk_pamp_gpio       (PM8921_GPIO_PM_TO_SYS(19))
+#define bottom_spk_pamp_gpio    (PM8921_GPIO_PM_TO_SYS(18))
+#define DOCK_SPK_PAMP_GPIO	    (PM8921_GPIO_PM_TO_SYS(1))
+#define USB_ID_ADC_GPIO		    (PM8921_GPIO_PM_TO_SYS(4))
+
+static int msm_spk_control;
+static int msm_ext_bottom_spk_pamp;
+static int msm_ext_top_spk_pamp;
+static int msm_ext_dock_spk_pamp;
+static int msm_slim_0_rx_ch = 1;
+static int msm_slim_0_tx_ch = 1;
+
+static int msm_btsco_rate = SAMPLE_RATE_8KHZ;
+static int msm_btsco_ch = 1;
+
+static int msm_auxpcm_rate = SAMPLE_RATE_8KHZ;
+
+static int jet_stereo_control;
+
+static struct clk *codec_clk;
+static int clk_users;
+
+extern void msm_release_audio_dock_lock(void);
+
+static struct snd_soc_jack hs_jack;
+static struct snd_soc_jack button_jack;
+
+static int msm_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
+					bool dapm);
+
+
+extern void release_audio_dock_lock(void);
+static struct mutex cdc_mclk_mutex;
+
+static void msm_ext_spk_power_amp_off(u32);
+static void audio_dock_notifier_func(enum usb_connect_type online)
+{
+	if (cable_get_accessory_type() != DOCK_STATE_AUDIO_DOCK) {
+		pr_debug("accessory is not AUDIO_DOCK\n");
+		return;
+	}
+
+	switch(online) {
+	case CONNECT_TYPE_NONE:
+		pr_debug("%s, VBUS is removed\n", __func__);
+		
+		msm_ext_spk_power_amp_off(DOCK_SPK_AMP_POS|DOCK_SPK_AMP_NEG);
+		
+		release_audio_dock_lock();
+		break;
+	default:
+		break;
+	}
+
+	return;
+}
+
+static struct mutex audio_notifier_lock;
+static struct t_cable_status_notifier audio_dock_notifier =
+{
+	.name = "jet_audio_8960",
+	.func = audio_dock_notifier_func,
+};
+
+static void msm_enable_ext_spk_amp_gpio(u32 spk_amp_gpio)
+{
+	int ret = 0;
+
+	struct pm_gpio param = {
+		.direction      = PM_GPIO_DIR_OUT,
+		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
+		.output_value   = 1,
+		.pull      = PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength   = PM_GPIO_STRENGTH_MED,
+		.function       = PM_GPIO_FUNC_NORMAL,
+	};
+
+	if (spk_amp_gpio == bottom_spk_pamp_gpio) {
+
+		ret = gpio_request(bottom_spk_pamp_gpio, "BOTTOM_SPK_AMP");
+		if (ret) {
+			pr_err("%s: Error requesting BOTTOM SPK AMP GPIO %u\n",
+				__func__, bottom_spk_pamp_gpio);
+			return;
+		}
+		ret = pm8xxx_gpio_config(bottom_spk_pamp_gpio, &param);
+		if (ret)
+			pr_err("%s: Failed to configure Bottom Spk Ampl"
+				" gpio %u\n", __func__, bottom_spk_pamp_gpio);
+		else {
+			pr_debug("%s: enable Bottom spkr amp gpio\n", __func__);
+			gpio_direction_output(bottom_spk_pamp_gpio, 1);
+		}
+
+	} else if (spk_amp_gpio == top_spk_pamp_gpio) {
+
+		ret = gpio_request(top_spk_pamp_gpio, "TOP_SPK_AMP");
+		if (ret) {
+			pr_err("%s: Error requesting GPIO %d\n", __func__,
+				top_spk_pamp_gpio);
+			return;
+		}
+		ret = pm8xxx_gpio_config(top_spk_pamp_gpio, &param);
+		if (ret)
+			pr_err("%s: Failed to configure Top Spk Ampl"
+				" gpio %u\n", __func__, top_spk_pamp_gpio);
+		else {
+			pr_debug("%s: enable Top spkr amp gpio\n", __func__);
+			gpio_direction_output(top_spk_pamp_gpio, 1);
+		}
+
+	} else if (spk_amp_gpio == DOCK_SPK_PAMP_GPIO) {
+
+		ret = gpio_request(DOCK_SPK_PAMP_GPIO, "DOCK_SPK_AMP");
+		if (ret) {
+			pr_err("%s: Error requesting GPIO %d\n", __func__,
+				DOCK_SPK_PAMP_GPIO);
+			return;
+		}
+		ret = pm8xxx_gpio_config(DOCK_SPK_PAMP_GPIO, &param);
+		if (ret)
+			pr_err("%s: Failed to configure Dock Spk Ampl"
+				" gpio %u\n", __func__, DOCK_SPK_PAMP_GPIO);
+		else {
+			pr_debug("%s: enable dock amp gpio\n", __func__);
+			gpio_direction_output(DOCK_SPK_PAMP_GPIO, 1);
+		}
+
+		ret = gpio_request(USB_ID_ADC_GPIO, "USB_ID_ADC");
+		if (ret) {
+			pr_err("%s: Error requesting USB_ID_ADC PMIC GPIO %u\n",
+				__func__, USB_ID_ADC_GPIO);
+			return;
+		}
+		ret = pm8xxx_gpio_config(USB_ID_ADC_GPIO, &param);
+		if (ret)
+			pr_err("%s: Failed to configure USB_ID_ADC PMIC"
+				" gpio %u\n", __func__, USB_ID_ADC_GPIO);
+
+	} else {
+		pr_err("%s: ERROR : Invalid External Speaker Ampl GPIO."
+			" gpio = %u\n", __func__, spk_amp_gpio);
+		return;
+	}
+}
+
+static void msm_ext_spk_power_amp_on(u32 spk)
+{
+	if (spk & (BOTTOM_SPK_AMP_POS | BOTTOM_SPK_AMP_NEG)) {
+
+		if ((msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_POS) &&
+			(msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_NEG)) {
+
+			pr_debug("%s() External Bottom Speaker Ampl already "
+				"turned on. spk = 0x%08x\n", __func__, spk);
+			return;
+		}
+
+		msm_ext_bottom_spk_pamp |= spk;
+
+		if ((msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_POS) &&
+			(msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_NEG)) {
+
+			msm_enable_ext_spk_amp_gpio(bottom_spk_pamp_gpio);
+			pr_debug("%s: slepping 4 ms after turning on external "
+				" Bottom Speaker Ampl\n", __func__);
+			usleep_range(4000, 4000);
+		}
+
+	} else if  (spk & (TOP_SPK_AMP_POS | TOP_SPK_AMP_NEG)) {
+
+		if ((msm_ext_top_spk_pamp & TOP_SPK_AMP_POS) &&
+			(msm_ext_top_spk_pamp & TOP_SPK_AMP_NEG)) {
+
+			pr_debug("%s() External Top Speaker Ampl already"
+				"turned on. spk = 0x%08x\n", __func__, spk);
+			return;
+		}
+
+		msm_ext_top_spk_pamp |= spk;
+
+		if ((msm_ext_top_spk_pamp & TOP_SPK_AMP_POS) &&
+			(msm_ext_top_spk_pamp & TOP_SPK_AMP_NEG)) {
+
+			msm_enable_ext_spk_amp_gpio(top_spk_pamp_gpio);
+			pr_debug("%s: sleeping 4 ms after turning on "
+				" external HAC Ampl\n", __func__);
+			usleep_range(4000, 4000);
+		}
+
+	} else if (spk & (DOCK_SPK_AMP_POS | DOCK_SPK_AMP_NEG)) {
+
+		mutex_lock(&audio_notifier_lock);
+
+		if ((msm_ext_dock_spk_pamp & DOCK_SPK_AMP_POS) &&
+			(msm_ext_dock_spk_pamp & DOCK_SPK_AMP_NEG)) {
+
+			pr_debug("%s() External Dock Speaker Ampl already"
+				"turned on. spk = 0x%08x\n", __func__, spk);
+			return;
+		}
+
+		msm_ext_dock_spk_pamp |= spk;
+
+		if ((msm_ext_dock_spk_pamp & DOCK_SPK_AMP_POS) &&
+			(msm_ext_dock_spk_pamp & DOCK_SPK_AMP_NEG)) {
+
+			msm_enable_ext_spk_amp_gpio(DOCK_SPK_PAMP_GPIO);
+
+			pr_debug("%s: sleeping 4 ms after turning on "
+				" external DOCK Ampl\n", __func__);
+			usleep_range(4000, 4000);
+		}
+		mutex_unlock(&audio_notifier_lock);
+
+	} else  {
+
+		pr_err("%s: ERROR : Invalid External Speaker Ampl. spk = 0x%08x\n",
+			__func__, spk);
+		return;
+	}
+}
+
+static void msm_ext_spk_power_amp_off(u32 spk)
+{
+	struct pm_gpio param = {
+		.direction      = PM_GPIO_DIR_IN,
+		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
+		.pull      = PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength   = PM_GPIO_STRENGTH_MED,
+		.function       = PM_GPIO_FUNC_NORMAL,
+	};
+
+	pr_debug("%s, spk = %d\n", __func__, spk);
+
+	if (spk & (BOTTOM_SPK_AMP_POS | BOTTOM_SPK_AMP_NEG)) {
+
+		if (!msm_ext_bottom_spk_pamp)
+			return;
+
+		gpio_direction_output(bottom_spk_pamp_gpio, 0);
+		gpio_free(bottom_spk_pamp_gpio);
+		msm_ext_bottom_spk_pamp = 0;
+
+		pr_debug("%s: sleeping 4 ms after turning off external Bottom"
+			" Speaker Ampl\n", __func__);
+
+		usleep_range(4000, 4000);
+
+	} else if (spk & (TOP_SPK_AMP_POS | TOP_SPK_AMP_NEG)) {
+
+		if (!msm_ext_top_spk_pamp)
+			return;
+
+		gpio_direction_output(top_spk_pamp_gpio, 0);
+		gpio_free(top_spk_pamp_gpio);
+		msm_ext_top_spk_pamp = 0;
+
+		pr_debug("%s: sleeping 4 ms after turning off external"
+			" HAC Ampl\n", __func__);
+
+		usleep_range(4000, 4000);
+
+	} else if (spk & (DOCK_SPK_AMP_POS | DOCK_SPK_AMP_NEG)) {
+
+		mutex_lock(&audio_notifier_lock);
+
+		if (!msm_ext_dock_spk_pamp) {
+			mutex_unlock(&audio_notifier_lock);
+			return;
+		}
+
+		gpio_direction_input(DOCK_SPK_PAMP_GPIO);
+		gpio_free(DOCK_SPK_PAMP_GPIO);
+
+		gpio_direction_input(USB_ID_ADC_GPIO);
+		if (pm8xxx_gpio_config(USB_ID_ADC_GPIO, &param))
+			pr_err("%s: Failed to configure USB_ID_ADC PMIC"
+				" gpio %u\n", __func__, USB_ID_ADC_GPIO);
+		gpio_free(USB_ID_ADC_GPIO);
+		msm_ext_dock_spk_pamp = 0;
+
+		mutex_unlock(&audio_notifier_lock);
+
+		pr_debug("%s: sleeping 4 ms after turning off external"
+			" DOCK Ampl\n", __func__);
+
+		usleep_range(4000, 4000);
+
+	} else  {
+
+		pr_err("%s: ERROR : Invalid Ext Spk Ampl. spk = 0x%08x\n",
+			__func__, spk);
+		return;
+	}
+}
+
+static void msm_ext_control(struct snd_soc_codec *codec)
+{
+	struct snd_soc_dapm_context *dapm = &codec->dapm;
+
+	mutex_lock(&dapm->codec->mutex);
+
+	pr_debug("%s: msm_spk_control = %d", __func__, msm_spk_control);
+	if (msm_spk_control == MSM_SPK_ON) {
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Pos");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Neg");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Pos");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Neg");
+		snd_soc_dapm_enable_pin(dapm, "Dock Spk Pos");
+		snd_soc_dapm_enable_pin(dapm, "Dock Spk Neg");
+
+	} else {
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Bottom Pos");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Bottom Neg");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Top Pos");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Top Neg");
+		snd_soc_dapm_disable_pin(dapm, "Dock Spk Pos");
+		snd_soc_dapm_disable_pin(dapm, "Dock Spk Neg");
+	}
+
+	snd_soc_dapm_sync(dapm);
+	mutex_unlock(&dapm->codec->mutex);
+}
+
+static int msm_get_spk(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_spk_control = %d", __func__, msm_spk_control);
+	ucontrol->value.integer.value[0] = msm_spk_control;
+	return 0;
+}
+static int msm_set_spk(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+
+	pr_debug("%s()\n", __func__);
+	if (msm_spk_control == ucontrol->value.integer.value[0])
+		return 0;
+
+	msm_spk_control = ucontrol->value.integer.value[0];
+	msm_ext_control(codec);
+	return 1;
+}
+static int msm_spkramp_event(struct snd_soc_dapm_widget *w,
+	struct snd_kcontrol *k, int event)
+{
+	pr_debug("%s() %x\n", __func__, SND_SOC_DAPM_EVENT_ON(event));
+
+	if (SND_SOC_DAPM_EVENT_ON(event)) {
+		if (!strncmp(w->name, "Ext Spk Bottom Pos", 18))
+			msm_ext_spk_power_amp_on(BOTTOM_SPK_AMP_POS);
+		else if (!strncmp(w->name, "Ext Spk Bottom Neg", 18))
+			msm_ext_spk_power_amp_on(BOTTOM_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Ext Spk Top Pos", 15))
+			msm_ext_spk_power_amp_on(TOP_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Ext Spk Top Neg", 15))
+			msm_ext_spk_power_amp_on(TOP_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Dock Spk Pos", 12))
+			msm_ext_spk_power_amp_on(DOCK_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Dock Spk Neg", 12))
+			msm_ext_spk_power_amp_on(DOCK_SPK_AMP_NEG);
+		else {
+			pr_err("%s() Invalid Speaker Widget = %s\n",
+					__func__, w->name);
+			return -EINVAL;
+		}
+
+	} else {
+		if (!strncmp(w->name, "Ext Spk Bottom Pos", 18))
+			msm_ext_spk_power_amp_off(BOTTOM_SPK_AMP_POS);
+		else if (!strncmp(w->name, "Ext Spk Bottom Neg", 18))
+			msm_ext_spk_power_amp_off(BOTTOM_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Ext Spk Top Pos", 15))
+			msm_ext_spk_power_amp_off(TOP_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Ext Spk Top Neg", 15))
+			msm_ext_spk_power_amp_off(TOP_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Dock Spk Pos", 12))
+			msm_ext_spk_power_amp_off(DOCK_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Dock Spk Neg", 12))
+			msm_ext_spk_power_amp_off(DOCK_SPK_AMP_NEG);
+		else {
+			pr_err("%s() Invalid Speaker Widget = %s\n",
+					__func__, w->name);
+			return -EINVAL;
+		}
+	}
+	return 0;
+}
+
+static int msm_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
+					bool dapm)
+{
+	int r = 0;
+	pr_debug("%s: enable = %d\n", __func__, enable);
+
+	mutex_lock(&cdc_mclk_mutex);
+	if (enable) {
+		clk_users++;
+		pr_debug("%s: clk_users = %d\n", __func__, clk_users);
+		if (clk_users == 1) {
+			if (codec_clk) {
+				clk_set_rate(codec_clk, TABLA_EXT_CLK_RATE);
+				clk_prepare_enable(codec_clk);
+				tabla_mclk_enable(codec, 1, dapm);
+			} else {
+				pr_err("%s: Error setting Tabla MCLK\n",
+				       __func__);
+				clk_users--;
+				r = -EINVAL;
+			}
+		}
+	} else {
+		if (clk_users > 0) {
+			clk_users--;
+			pr_debug("%s: clk_users = %d\n", __func__, clk_users);
+			if (clk_users == 0) {
+				pr_debug("%s: disabling MCLK. clk_users = %d\n",
+					 __func__, clk_users);
+				tabla_mclk_enable(codec, 0, dapm);
+				clk_disable_unprepare(codec_clk);
+			}
+		} else {
+			pr_err("%s: Error releasing Tabla MCLK\n", __func__);
+			r = -EINVAL;
+		}
+	}
+	mutex_unlock(&cdc_mclk_mutex);
+	return r;
+}
+
+static int msm_mclk_event(struct snd_soc_dapm_widget *w,
+		struct snd_kcontrol *kcontrol, int event)
+{
+	pr_debug("%s: event = %d\n", __func__, event);
+
+	switch (event) {
+	case SND_SOC_DAPM_PRE_PMU:
+		return msm_enable_codec_ext_clk(w->codec, 1, true);
+	case SND_SOC_DAPM_POST_PMD:
+		return msm_enable_codec_ext_clk(w->codec, 0, true);
+	}
+	return 0;
+}
+
+enum {
+	RX_SWITCH_INDEX = 0,
+	TX_SWITCH_INDEX,
+	SWITCH_MAX,
+};
+
+static const struct snd_kcontrol_new extspk_switch_controls =
+	SOC_DAPM_SINGLE("Switch", RX_SWITCH_INDEX, 0, 1, 0);
+
+static const struct snd_kcontrol_new earamp_switch_controls =
+	SOC_DAPM_SINGLE("Switch", RX_SWITCH_INDEX, 0, 1, 0);
+
+static const struct snd_kcontrol_new spkamp_switch_controls =
+	SOC_DAPM_SINGLE("Switch", RX_SWITCH_INDEX, 0, 1, 0);
+
+static const struct snd_kcontrol_new micbias3_switch_controls =
+	SOC_DAPM_SINGLE("Switch", TX_SWITCH_INDEX, 0, 1, 0);
+
+static const struct snd_soc_dapm_widget jet_dapm_widgets[] = {
+	SND_SOC_DAPM_MIXER("Lineout Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
+	SND_SOC_DAPM_MIXER("SPK AMP EN", SND_SOC_NOPM, 0, 0, &spkamp_switch_controls, 1),
+	SND_SOC_DAPM_MIXER("HAC AMP EN", SND_SOC_NOPM, 0, 0, &earamp_switch_controls, 1),
+	SND_SOC_DAPM_MIXER("DOCK AMP EN", SND_SOC_NOPM, 0, 0, &extspk_switch_controls, 1),
+	SND_SOC_DAPM_MIXER("DUAL MICBIAS", SND_SOC_NOPM, 0, 0, &micbias3_switch_controls, 1),
+};
+
+static const struct snd_soc_dapm_widget msm_dapm_widgets[] = {
+	SND_SOC_DAPM_SUPPLY("MCLK",  SND_SOC_NOPM, 0, 0,
+	msm_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
+
+	SND_SOC_DAPM_SPK("Ext Spk Bottom Pos", msm_spkramp_event),
+	SND_SOC_DAPM_SPK("Ext Spk Bottom Neg", msm_spkramp_event),
+
+	SND_SOC_DAPM_SPK("Ext Spk Top Pos", msm_spkramp_event),
+	SND_SOC_DAPM_SPK("Ext Spk Top Neg", msm_spkramp_event),
+
+	SND_SOC_DAPM_SPK("Dock Spk Pos", msm_spkramp_event),
+	SND_SOC_DAPM_SPK("Dock Spk Neg", msm_spkramp_event),
+
+	SND_SOC_DAPM_MIC("Handset Mic", NULL),
+	SND_SOC_DAPM_MIC("Headset Mic", NULL),
+	SND_SOC_DAPM_MIC("Back Mic", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic1", NULL),
+	SND_SOC_DAPM_MIC("ANCRight Headset Mic", NULL),
+	SND_SOC_DAPM_MIC("ANCLeft Headset Mic", NULL),
+
+	SND_SOC_DAPM_MIC("Digital Mic1", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic2", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic3", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic4", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic5", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic6", NULL),
+
+};
+
+static const struct snd_soc_dapm_route tabla_1_x_audio_map[] = {
+
+	{"Lineout Mixer", NULL, "LINEOUT2"},
+	{"Lineout Mixer", NULL, "LINEOUT1"},
+};
+
+static const struct snd_soc_dapm_route tabla_2_x_audio_map[] = {
+
+	{"Lineout Mixer", NULL, "LINEOUT3"},
+	{"Lineout Mixer", NULL, "LINEOUT1"},
+};
+
+static const struct snd_soc_dapm_route common_audio_map[] = {
+
+	{"RX_BIAS", NULL, "MCLK"},
+	{"LDO_H", NULL, "MCLK"},
+
+	
+	{"Ext Spk Bottom Pos", NULL, "SPK AMP EN"},
+	{"Ext Spk Bottom Neg", NULL, "SPK AMP EN"},
+	{"SPK AMP EN", "Switch", "Lineout Mixer"},
+
+	
+	{"Ext Spk Top Pos", NULL, "HAC AMP EN"},
+	{"Ext Spk Top Neg", NULL, "HAC AMP EN"},
+	{"HAC AMP EN", "Switch", "Lineout Mixer"},
+
+	
+	{"Dock Spk Pos", NULL, "DOCK AMP EN"},
+	{"Dock Spk Neg", NULL, "DOCK AMP EN"},
+	{"DOCK AMP EN", "Switch", "Lineout Mixer"},
+
+	
+	{"AMIC1", NULL, "DUAL MICBIAS"},
+	{"DUAL MICBIAS", NULL, "MIC BIAS1 External"},
+	{"MIC BIAS1 External", NULL, "Handset Mic"},
+
+	{"DUAL MICBIAS", "Switch", "MIC BIAS3 External"},
+
+	{"AMIC2", NULL, "MIC BIAS2 External"},
+	{"MIC BIAS2 External", NULL, "Headset Mic"},
+
+	{"AMIC3", NULL, "MIC BIAS3 External"},
+	{"MIC BIAS3 External", NULL, "Back Mic"},
+
+	{"HEADPHONE", NULL, "LDO_H"},
+
+};
+
+static const char *spk_function[] = {"Off", "On"};
+static const char *slim0_rx_ch_text[] = {"One", "Two"};
+static const char *slim0_tx_ch_text[] = {"One", "Two", "Three", "Four"};
+
+static const struct soc_enum msm_enum[] = {
+	SOC_ENUM_SINGLE_EXT(2, spk_function),
+	SOC_ENUM_SINGLE_EXT(2, slim0_rx_ch_text),
+	SOC_ENUM_SINGLE_EXT(4, slim0_tx_ch_text),
+};
+
+static const char *stereo_mic_voice[] = {"Off", "On"};
+static const struct soc_enum jet_msm_enum[] = {
+	SOC_ENUM_SINGLE_EXT(2, stereo_mic_voice),
+};
+
+static const char *btsco_rate_text[] = {"8000", "16000"};
+static const struct soc_enum msm_btsco_enum[] = {
+		SOC_ENUM_SINGLE_EXT(2, btsco_rate_text),
+};
+
+static const char *auxpcm_rate_text[] = {"rate_8000", "rate_16000"};
+static const struct soc_enum msm_auxpcm_enum[] = {
+		SOC_ENUM_SINGLE_EXT(2, auxpcm_rate_text),
+};
+
+static int msm_slim_0_rx_ch_get(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_slim_0_rx_ch  = %d\n", __func__,
+			msm_slim_0_rx_ch);
+	ucontrol->value.integer.value[0] = msm_slim_0_rx_ch - 1;
+	return 0;
+}
+
+static int msm_slim_0_rx_ch_put(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	msm_slim_0_rx_ch = ucontrol->value.integer.value[0] + 1;
+
+	pr_debug("%s: msm_slim_0_rx_ch = %d\n", __func__,
+			msm_slim_0_rx_ch);
+	return 1;
+}
+
+static int msm_slim_0_tx_ch_get(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_slim_0_tx_ch  = %d\n", __func__,
+			msm_slim_0_tx_ch);
+	ucontrol->value.integer.value[0] = msm_slim_0_tx_ch - 1;
+	return 0;
+}
+
+static int msm_slim_0_tx_ch_put(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	msm_slim_0_tx_ch = ucontrol->value.integer.value[0] + 1;
+
+	pr_debug("%s: msm_slim_0_tx_ch = %d\n", __func__,
+			msm_slim_0_tx_ch);
+	return 1;
+}
+
+static int jet_stereo_voice_get(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: jet_stereo_control = %d\n", __func__,
+			jet_stereo_control);
+	ucontrol->value.integer.value[0] = jet_stereo_control;
+	return 0;
+}
+
+static int jet_stereo_voice_put(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	int ret = 0;
+	struct pm_gpio param = {
+		.direction      = PM_GPIO_DIR_OUT,
+		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
+		.output_value   = 1,
+		.pull      = PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_L17,
+		.out_strength   = PM_GPIO_STRENGTH_MED,
+		.function       = PM_GPIO_FUNC_NORMAL,
+	};
+
+	if (jet_stereo_control == ucontrol->value.integer.value[0])
+		return 0;
+
+	jet_stereo_control = ucontrol->value.integer.value[0];
+
+	pr_debug("%s: jet_stereo_control = %d\n", __func__,
+			jet_stereo_control);
+
+	switch (ucontrol->value.integer.value[0]) {
+	case 0:
+		
+		gpio_direction_output(JET_AUD_STEREO_REC, 1);
+		gpio_free(JET_AUD_STEREO_REC);
+
+		break;
+	case 1:
+		
+		ret = gpio_request(JET_AUD_STEREO_REC, "A1028_SWITCH");
+		if (ret) {
+			pr_err("%s: Failed to request gpio %d\n", __func__,
+					JET_AUD_STEREO_REC);
+			return ret;
+		}
+
+		ret = pm8xxx_gpio_config(JET_AUD_STEREO_REC, &param);
+
+		if (ret)
+			pr_err("%s: Failed to configure gpio %d\n", __func__,
+					JET_AUD_STEREO_REC);
+		else
+			gpio_direction_output(JET_AUD_STEREO_REC, 0);
+		break;
+	}
+	return ret;
+}
+
+static int msm_btsco_rate_get(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_btsco_rate  = %d", __func__, msm_btsco_rate);
+	ucontrol->value.integer.value[0] = msm_btsco_rate;
+	return 0;
+}
+
+static int msm_btsco_rate_put(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	switch (ucontrol->value.integer.value[0]) {
+	case 0:
+		msm_btsco_rate = SAMPLE_RATE_8KHZ;
+		break;
+	case 1:
+		msm_btsco_rate = SAMPLE_RATE_16KHZ;
+		break;
+	default:
+		msm_btsco_rate = SAMPLE_RATE_8KHZ;
+		break;
+	}
+	pr_debug("%s: msm_btsco_rate = %d\n", __func__, msm_btsco_rate);
+	return 0;
+}
+
+static int msm_auxpcm_rate_get(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_auxpcm_rate  = %d", __func__,
+		msm_auxpcm_rate);
+	ucontrol->value.integer.value[0] = msm_auxpcm_rate;
+	return 0;
+}
+
+static int msm_auxpcm_rate_put(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	switch (ucontrol->value.integer.value[0]) {
+	case 0:
+		msm_auxpcm_rate = SAMPLE_RATE_8KHZ;
+		break;
+	case 1:
+		msm_auxpcm_rate = SAMPLE_RATE_16KHZ;
+		break;
+	default:
+		msm_auxpcm_rate = SAMPLE_RATE_8KHZ;
+		break;
+	}
+	pr_debug("%s: msm_auxpcm_rate = %d"
+		"ucontrol->value.integer.value[0] = %d\n", __func__,
+		msm_auxpcm_rate,
+		(int)ucontrol->value.integer.value[0]);
+	return 0;
+}
+
+static const struct snd_kcontrol_new tabla_msm_controls[] = {
+	SOC_ENUM_EXT("Speaker Function", msm_enum[0], msm_get_spk,
+		msm_set_spk),
+	SOC_ENUM_EXT("SLIM_0_RX Channels", msm_enum[1],
+		msm_slim_0_rx_ch_get, msm_slim_0_rx_ch_put),
+	SOC_ENUM_EXT("SLIM_0_TX Channels", msm_enum[2],
+		msm_slim_0_tx_ch_get, msm_slim_0_tx_ch_put),
+	SOC_ENUM_EXT("Internal BTSCO SampleRate", msm_btsco_enum[0],
+		msm_btsco_rate_get, msm_btsco_rate_put),
+	SOC_ENUM_EXT("AUX PCM SampleRate", msm_auxpcm_enum[0],
+		msm_auxpcm_rate_get, msm_auxpcm_rate_put),
+	SOC_ENUM_EXT("Stereo Selection", jet_msm_enum[0], jet_stereo_voice_get,
+		jet_stereo_voice_put),
+};
+
+static int msm_hw_params(struct snd_pcm_substream *substream,
+				struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	int ret = 0;
+	unsigned int rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
+	unsigned int rx_ch_cnt = 0, tx_ch_cnt = 0;
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+
+		pr_debug("%s: %s  rx_dai_id = %d  num_ch = %d\n", __func__,
+			codec_dai->name, codec_dai->id, msm_slim_0_rx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+
+		ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
+				msm_slim_0_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai, 0, 0,
+				msm_slim_0_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	} else {
+
+		pr_debug("%s: %s  tx_dai_id = %d  num_ch = %d\n", __func__,
+			codec_dai->name, codec_dai->id, msm_slim_0_tx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(cpu_dai,
+				msm_slim_0_tx_ch, tx_ch, 0 , 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai,
+				msm_slim_0_tx_ch, tx_ch, 0, 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	}
+end:
+	return ret;
+}
+
+static int msm_slimbus_2_hw_params(struct snd_pcm_substream *substream,
+				struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	int ret = 0;
+	unsigned int rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
+	unsigned int rx_ch_cnt = 0, tx_ch_cnt = 0;
+	unsigned int num_tx_ch = 0;
+	unsigned int num_rx_ch = 0;
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+
+		num_rx_ch =  params_channels(params);
+
+		pr_debug("%s: %s rx_dai_id = %d  num_ch = %d\n", __func__,
+			codec_dai->name, codec_dai->id, num_rx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+
+		ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
+				num_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai, 0, 0,
+				num_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	} else {
+		num_tx_ch =  params_channels(params);
+
+		pr_debug("%s: %s  tx_dai_id = %d  num_ch = %d\n", __func__,
+			codec_dai->name, codec_dai->id, num_tx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+
+		ret = snd_soc_dai_set_channel_map(cpu_dai,
+				num_tx_ch, tx_ch, 0 , 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai,
+				num_tx_ch, tx_ch, 0, 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	}
+end:
+	return ret;
+}
+
+static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
+{
+	int err;
+	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_dapm_context *dapm = &codec->dapm;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+
+	pr_debug("%s(), dev_name: %s\n", __func__, dev_name(cpu_dai->dev));
+
+
+	snd_soc_dapm_new_controls(dapm, msm_dapm_widgets,
+				ARRAY_SIZE(msm_dapm_widgets));
+
+	snd_soc_dapm_new_controls(dapm, jet_dapm_widgets,
+				ARRAY_SIZE(jet_dapm_widgets));
+
+	snd_soc_dapm_add_routes(dapm, common_audio_map,
+		ARRAY_SIZE(common_audio_map));
+
+	pr_debug("%s(), %s\n", __func__, codec->name);
+	if (!strncmp(codec->name, "tabla1x_codec", 13))
+		snd_soc_dapm_add_routes(dapm, tabla_1_x_audio_map,
+			 ARRAY_SIZE(tabla_1_x_audio_map));
+	else
+		snd_soc_dapm_add_routes(dapm, tabla_2_x_audio_map,
+			 ARRAY_SIZE(tabla_2_x_audio_map));
+
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Pos");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Neg");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Pos");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Neg");
+	snd_soc_dapm_enable_pin(dapm, "Dock Spk Pos");
+	snd_soc_dapm_enable_pin(dapm, "Dock Spk Neg");
+
+	snd_soc_dapm_sync(dapm);
+
+	err = snd_soc_jack_new(codec, "Headset Jack",
+			       (SND_JACK_HEADSET | SND_JACK_OC_HPHL |
+				SND_JACK_OC_HPHR | SND_JACK_UNSUPPORTED),
+			       &hs_jack);
+	if (err) {
+		pr_err("failed to create new jack\n");
+		return err;
+	}
+
+	err = snd_soc_jack_new(codec, "Button Jack",
+			       TABLA_JACK_BUTTON_MASK, &button_jack);
+	if (err) {
+		pr_err("failed to create new jack\n");
+		return err;
+	}
+
+	codec_clk = clk_get(cpu_dai->dev, "osr_clk");
+
+
+	return err;
+}
+
+static int msm_slim_0_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+			SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+	channels->min = channels->max = msm_slim_0_rx_ch;
+
+	return 0;
+}
+
+static int msm_slim_0_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+			SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+	channels->min = channels->max = msm_slim_0_tx_ch;
+
+	return 0;
+}
+
+static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+
+	return 0;
+}
+
+static int msm_hdmi_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s channels->min %u channels->max %u ()\n", __func__,
+			channels->min, channels->max);
+
+	rate->min = rate->max = 48000;
+
+	return 0;
+}
+
+static int msm_btsco_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	rate->min = rate->max = msm_btsco_rate;
+	channels->min = channels->max = msm_btsco_ch;
+
+	return 0;
+}
+static int msm_auxpcm_be_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	rate->min = rate->max = msm_auxpcm_rate;
+	
+	channels->min = channels->max = 1;
+
+	return 0;
+}
+static int msm_aux_pcm_get_gpios(void)
+{
+	int ret = 0;
+
+	pr_debug("%s\n", __func__);
+
+	ret = gpio_request(GPIO_AUX_PCM_DOUT, "AUX PCM DOUT");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM DOUT",
+				__func__, GPIO_AUX_PCM_DOUT);
+		goto fail_dout;
+	}
+
+	ret = gpio_request(GPIO_AUX_PCM_DIN, "AUX PCM DIN");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM DIN",
+				__func__, GPIO_AUX_PCM_DIN);
+		goto fail_din;
+	}
+
+	ret = gpio_request(GPIO_AUX_PCM_SYNC, "AUX PCM SYNC");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM SYNC",
+				__func__, GPIO_AUX_PCM_SYNC);
+		goto fail_sync;
+	}
+	ret = gpio_request(GPIO_AUX_PCM_CLK, "AUX PCM CLK");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM CLK",
+				__func__, GPIO_AUX_PCM_CLK);
+		goto fail_clk;
+	}
+
+	return 0;
+
+fail_clk:
+	gpio_free(GPIO_AUX_PCM_SYNC);
+fail_sync:
+	gpio_free(GPIO_AUX_PCM_DIN);
+fail_din:
+	gpio_free(GPIO_AUX_PCM_DOUT);
+fail_dout:
+
+	return ret;
+}
+
+static int msm_aux_pcm_free_gpios(void)
+{
+	gpio_free(GPIO_AUX_PCM_DIN);
+	gpio_free(GPIO_AUX_PCM_DOUT);
+	gpio_free(GPIO_AUX_PCM_SYNC);
+	gpio_free(GPIO_AUX_PCM_CLK);
+
+	return 0;
+}
+static int msm_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
+	pr_debug("%s(): dai_link_str_name = %s cpu_dai = %s codec_dai = %s\n",
+		__func__, rtd->dai_link->stream_name,
+		rtd->dai_link->cpu_dai_name, rtd->dai_link->codec_dai_name);
+	return 0;
+}
+
+static int msm_auxpcm_startup(struct snd_pcm_substream *substream)
+{
+	int ret = 0;
+
+	pr_debug("%s(): substream = %s\n", __func__, substream->name);
+	ret = msm_aux_pcm_get_gpios();
+	if (ret < 0) {
+		pr_err("%s: Aux PCM GPIO request failed\n", __func__);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static void msm_auxpcm_shutdown(struct snd_pcm_substream *substream)
+{
+
+	pr_debug("%s(): substream = %s\n", __func__, substream->name);
+	msm_aux_pcm_free_gpios();
+}
+
+static void msm_shutdown(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
+	pr_debug("%s(): dai_link str_name = %s cpu_dai = %s codec_dai = %s\n",
+		__func__, rtd->dai_link->stream_name,
+		rtd->dai_link->cpu_dai_name, rtd->dai_link->codec_dai_name);
+}
+
+static struct snd_soc_ops msm_be_ops = {
+	.startup = msm_startup,
+	.hw_params = msm_hw_params,
+	.shutdown = msm_shutdown,
+};
+
+static struct snd_soc_ops msm_auxpcm_be_ops = {
+	.startup = msm_auxpcm_startup,
+	.shutdown = msm_auxpcm_shutdown,
+};
+
+static struct snd_soc_ops msm_slimbus_2_be_ops = {
+	.startup = msm_startup,
+	.hw_params = msm_slimbus_2_hw_params,
+	.shutdown = msm_shutdown,
+};
+
+static struct snd_soc_dai_link msm_dai_common[] = {
+	
+	{
+		.name = "MSM8960 Media1",
+		.stream_name = "MultiMedia1",
+		.cpu_dai_name	= "MultiMedia1",
+		.platform_name  = "msm-pcm-dsp",
+		.dynamic = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA1
+	},
+	{
+		.name = "MSM8960 Media2",
+		.stream_name = "MultiMedia2",
+		.cpu_dai_name	= "MultiMedia2",
+		.platform_name  = "msm-multi-ch-pcm-dsp",
+		.dynamic = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA2,
+	},
+	{
+		.name = "Circuit-Switch Voice",
+		.stream_name = "CS-Voice",
+		.cpu_dai_name   = "CS-VOICE",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_CS_VOICE,
+	},
+	{
+		.name = "MSM VoIP",
+		.stream_name = "VoIP",
+		.cpu_dai_name	= "VoIP",
+		.platform_name  = "msm-voip-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_VOIP,
+	},
+	{
+		.name = "MSM8960 LPA",
+		.stream_name = "LPA",
+		.cpu_dai_name	= "MultiMedia3",
+		.platform_name  = "msm-pcm-lpa",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA3,
+	},
+	
+	{
+		.name = "SLIMBUS_0 Hostless",
+		.stream_name = "SLIMBUS_0 Hostless",
+		.cpu_dai_name	= "SLIMBUS0_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	{
+		.name = "INT_FM Hostless",
+		.stream_name = "INT_FM Hostless",
+		.cpu_dai_name	= "INT_FM_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	{
+		.name = "MSM AFE-PCM RX",
+		.stream_name = "AFE-PROXY RX",
+		.cpu_dai_name = "msm-dai-q6.241",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.platform_name  = "msm-pcm-afe",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = "MSM AFE-PCM TX",
+		.stream_name = "AFE-PROXY TX",
+		.cpu_dai_name = "msm-dai-q6.240",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.platform_name  = "msm-pcm-afe",
+		.ignore_suspend = 1,
+	},
+	{
+		.name = "MSM8960 Compr",
+		.stream_name = "COMPR",
+		.cpu_dai_name	= "MultiMedia4",
+		.platform_name  = "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA4,
+	},
+	{
+		.name = "AUXPCM Hostless",
+		.stream_name = "AUXPCM Hostless",
+		.cpu_dai_name	= "AUXPCM_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	
+	{
+		.name = "HDMI_RX_HOSTLESS",
+		.stream_name = "HDMI_RX_HOSTLESS",
+		.cpu_dai_name = "HDMI_HOSTLESS",
+		.platform_name = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	{
+		.name = "VoLTE",
+		.stream_name = "VoLTE",
+		.cpu_dai_name   = "VoLTE",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.be_id = MSM_FRONTEND_DAI_VOLTE,
+	},
+	{
+		.name = "Voice2",
+		.stream_name = "Voice2",
+		.cpu_dai_name   = "Voice2",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.be_id = MSM_FRONTEND_DAI_VOICE2,
+	},
+	{
+		.name = "MSM8960 LowLatency",
+		.stream_name = "MultiMedia5",
+		.cpu_dai_name	= "MultiMedia5",
+		.platform_name  = "msm-lowlatency-pcm-dsp",
+		.dynamic = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.ignore_suspend = 1,
+		/* this dainlink has playback support */
+		.ignore_pmdown_time = 1,
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA5,
+	},
+	
+	{
+		.name = LPASS_BE_INT_BT_SCO_RX,
+		.stream_name = "Internal BT-SCO Playback",
+		.cpu_dai_name = "msm-dai-q6.12288",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name	= "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_BT_SCO_RX,
+		.be_hw_params_fixup = msm_btsco_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = LPASS_BE_INT_BT_SCO_TX,
+		.stream_name = "Internal BT-SCO Capture",
+		.cpu_dai_name = "msm-dai-q6.12289",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name	= "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_BT_SCO_TX,
+		.be_hw_params_fixup = msm_btsco_be_hw_params_fixup,
+	},
+	{
+		.name = LPASS_BE_INT_FM_RX,
+		.stream_name = "Internal FM Playback",
+		.cpu_dai_name = "msm-dai-q6.12292",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_FM_RX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = LPASS_BE_INT_FM_TX,
+		.stream_name = "Internal FM Capture",
+		.cpu_dai_name = "msm-dai-q6.12293",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_FM_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	
+	{
+		.name = LPASS_BE_HDMI,
+		.stream_name = "HDMI Playback",
+		.cpu_dai_name = "msm-dai-q6-hdmi.8",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_HDMI_RX,
+		.be_hw_params_fixup = msm_hdmi_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, 
+	},
+	
+	{
+		.name = LPASS_BE_AFE_PCM_RX,
+		.stream_name = "AFE Playback",
+		.cpu_dai_name = "msm-dai-q6.224",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AFE_PCM_RX,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = LPASS_BE_AFE_PCM_TX,
+		.stream_name = "AFE Capture",
+		.cpu_dai_name = "msm-dai-q6.225",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AFE_PCM_TX,
+	},
+	
+	{
+		.name = LPASS_BE_AUXPCM_RX,
+		.stream_name = "AUX PCM Playback",
+		.cpu_dai_name = "msm-dai-q6.2",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AUXPCM_RX,
+		.be_hw_params_fixup = msm_auxpcm_be_params_fixup,
+		.ops = &msm_auxpcm_be_ops,
+		.ignore_pmdown_time = 1,
+	},
+	{
+		.name = LPASS_BE_AUXPCM_TX,
+		.stream_name = "AUX PCM Capture",
+		.cpu_dai_name = "msm-dai-q6.3",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AUXPCM_TX,
+		.be_hw_params_fixup = msm_auxpcm_be_params_fixup,
+	},
+	
+	{
+		.name = LPASS_BE_VOICE_PLAYBACK_TX,
+		.stream_name = "Voice Farend Playback",
+		.cpu_dai_name = "msm-dai-q6.32773",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	
+	{
+		.name = LPASS_BE_INCALL_RECORD_TX,
+		.stream_name = "Voice Uplink Capture",
+		.cpu_dai_name = "msm-dai-q6.32772",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INCALL_RECORD_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	
+	{
+		.name = LPASS_BE_INCALL_RECORD_RX,
+		.stream_name = "Voice Downlink Capture",
+		.cpu_dai_name = "msm-dai-q6.32771",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INCALL_RECORD_RX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = "MSM8960 Media5",
+		.stream_name = "MultiMedia5",
+		.cpu_dai_name	= "MultiMedia5",
+		.platform_name	= "msm-multi-ch-pcm-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+							SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA5
+	},
+	{
+		.name = "MSM8960 Media6",
+		.stream_name = "MultiMedia6",
+		.cpu_dai_name	= "MultiMedia6",
+		.platform_name	= "msm-multi-ch-pcm-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA6
+	},
+	{
+		.name = "MSM8960 Compr2",
+		.stream_name = "COMPR2",
+		.cpu_dai_name	= "MultiMedia7",
+		.platform_name	= "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA7,
+	},
+	{
+		.name = "MSM8960 Compr3",
+		.stream_name = "COMPR3",
+		.cpu_dai_name	= "MultiMedia8",
+		.platform_name	= "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, 
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA8,
+	},
+};
+
+static struct snd_soc_dai_link msm_dai_delta_tabla1x[] = {
+	
+	{
+		.name = LPASS_BE_SLIMBUS_0_RX,
+		.stream_name = "Slimbus Playback",
+		.cpu_dai_name = "msm-dai-q6.16384",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla1x_codec",
+		.codec_dai_name	= "tabla_rx1",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
+		.init = &msm_audrx_init,
+		.be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = LPASS_BE_SLIMBUS_0_TX,
+		.stream_name = "Slimbus Capture",
+		.cpu_dai_name = "msm-dai-q6.16385",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla1x_codec",
+		.codec_dai_name	= "tabla_tx1",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
+		.be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+	},
+	
+	{
+		.name = "SLIMBUS_2 Hostless Capture",
+		.stream_name = "SLIMBUS_2 Hostless Capture",
+		.cpu_dai_name = "msm-dai-q6.16389",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla1x_codec",
+		.codec_dai_name = "tabla_tx2",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_slimbus_2_be_ops,
+	},
+	
+	{
+		.name = "SLIMBUS_2 Hostless Playback",
+		.stream_name = "SLIMBUS_2 Hostless Playback",
+		.cpu_dai_name = "msm-dai-q6.16388",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla1x_codec",
+		.codec_dai_name = "tabla_rx3",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_slimbus_2_be_ops,
+	},
+};
+
+
+static struct snd_soc_dai_link msm_dai_delta_tabla2x[] = {
+	
+	{
+		.name = LPASS_BE_SLIMBUS_0_RX,
+		.stream_name = "Slimbus Playback",
+		.cpu_dai_name = "msm-dai-q6.16384",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla_codec",
+		.codec_dai_name	= "tabla_rx1",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
+		.init = &msm_audrx_init,
+		.be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+		.ignore_pmdown_time = 1, 
+	},
+	{
+		.name = LPASS_BE_SLIMBUS_0_TX,
+		.stream_name = "Slimbus Capture",
+		.cpu_dai_name = "msm-dai-q6.16385",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla_codec",
+		.codec_dai_name	= "tabla_tx1",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
+		.be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+	},
+	
+	{
+		.name = "SLIMBUS_2 Hostless Capture",
+		.stream_name = "SLIMBUS_2 Hostless Capture",
+		.cpu_dai_name = "msm-dai-q6.16389",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla_codec",
+		.codec_dai_name = "tabla_tx2",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_slimbus_2_be_ops,
+	},
+	
+	{
+		.name = "SLIMBUS_2 Hostless Playback",
+		.stream_name = "SLIMBUS_2 Hostless Playback",
+		.cpu_dai_name = "msm-dai-q6.16388",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla_codec",
+		.codec_dai_name = "tabla_rx3",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_slimbus_2_be_ops,
+	},
+};
+
+static struct snd_soc_dai_link msm_tabla1x_dai[
+					 ARRAY_SIZE(msm_dai_common) +
+					 ARRAY_SIZE(msm_dai_delta_tabla1x)];
+
+
+static struct snd_soc_dai_link msm_dai[
+					 ARRAY_SIZE(msm_dai_common) +
+					 ARRAY_SIZE(msm_dai_delta_tabla2x)];
+
+static struct snd_soc_card snd_soc_tabla1x_card_msm = {
+		.name		= "msm-tabla1x-snd-card",
+		.dai_link	= msm_tabla1x_dai,
+		.num_links	= ARRAY_SIZE(msm_tabla1x_dai),
+		.controls = tabla_msm_controls,
+		.num_controls = ARRAY_SIZE(tabla_msm_controls),
+};
+
+static struct snd_soc_card snd_soc_card_msm = {
+		.name		= "msm-snd-card",
+		.dai_link	= msm_dai,
+		.num_links	= ARRAY_SIZE(msm_dai),
+		.controls = tabla_msm_controls,
+		.num_controls = ARRAY_SIZE(tabla_msm_controls),
+};
+
+static struct platform_device *msm_snd_device;
+static struct platform_device *msm_snd_tabla1x_device;
+
+static int __init jet_audio_init(void)
+{
+	int ret;
+
+	if (!cpu_is_msm8960()) {
+		pr_err("%s: Not the right machine type\n", __func__);
+		return -ENODEV;
+	}
+	pr_debug("%s", __func__);
+
+	msm_snd_device = platform_device_alloc("soc-audio", 0);
+	if (!msm_snd_device) {
+		pr_err("Platform device allocation failed\n");
+		return -ENOMEM;
+	}
+
+	memcpy(msm_dai, msm_dai_common, sizeof(msm_dai_common));
+	memcpy(msm_dai + ARRAY_SIZE(msm_dai_common),
+		msm_dai_delta_tabla2x, sizeof(msm_dai_delta_tabla2x));
+
+	platform_set_drvdata(msm_snd_device, &snd_soc_card_msm);
+	ret = platform_device_add(msm_snd_device);
+	if (ret) {
+		platform_device_put(msm_snd_device);
+		return ret;
+	}
+
+	msm_snd_tabla1x_device = platform_device_alloc("soc-audio", 1);
+	if (!msm_snd_tabla1x_device) {
+		pr_err("Platform device allocation failed\n");
+		return -ENOMEM;
+	}
+
+	memcpy(msm_tabla1x_dai, msm_dai_common,
+		sizeof(msm_dai_common));
+	memcpy(msm_tabla1x_dai + ARRAY_SIZE(msm_dai_common),
+		msm_dai_delta_tabla1x, sizeof(msm_dai_delta_tabla1x));
+
+	platform_set_drvdata(msm_snd_tabla1x_device,
+		&snd_soc_tabla1x_card_msm);
+	ret = platform_device_add(msm_snd_tabla1x_device);
+	if (ret) {
+		platform_device_put(msm_snd_tabla1x_device);
+		return ret;
+	}
+
+	mutex_init(&audio_notifier_lock);
+	pr_debug("%s: register cable detect func for dock", __func__);
+	ret = cable_detect_register_notifier(&audio_dock_notifier);
+
+	mutex_init(&cdc_mclk_mutex);
+
+	return ret;
+
+}
+late_initcall(jet_audio_init);
+
+static void __exit jet_audio_exit(void)
+{
+
+	if (!cpu_is_msm8960()) {
+		pr_err("%s: Not the right machine type\n", __func__);
+		return;
+	}
+	pr_debug("%s", __func__);
+
+	platform_device_unregister(msm_snd_device);
+	platform_device_unregister(msm_snd_tabla1x_device);
+	mutex_destroy(&audio_notifier_lock);
+	mutex_destroy(&cdc_mclk_mutex);
+}
+module_exit(jet_audio_exit);
+
+MODULE_DESCRIPTION("ALSA Platform Jet");
+MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-msm/htc/jet/board-jet-camera.c b/arch/arm/mach-msm/htc/jet/board-jet-camera.c
new file mode 100644
index 0000000..79a765a
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/board-jet-camera.c
@@ -0,0 +1,1432 @@
+/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <asm/mach-types.h>
+#include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <mach/board.h>
+#include <mach/msm_bus_board.h>
+#include <mach/gpiomux.h>
+#include <asm/setup.h>
+
+#include "devices.h"
+#include "board-jet.h"
+
+#include <linux/spi/spi.h>
+
+#include "board-mahimahi-flashlight.h"
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#include <linux/htc_flashlight.h>
+#endif
+
+#ifdef CONFIG_MSM_CAMERA
+#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4	
+static struct platform_device msm_camera_server = {
+	.name = "msm_cam_server",
+	.id = 0,
+};
+
+static struct gpiomux_setting cam_settings[11] = {
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_DOWN,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_1, 
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_OUT_LOW,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_1, 
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_2, 
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_4MA,
+		.pull = GPIOMUX_PULL_DOWN,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_2, 
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_OUT_HIGH,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, 
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_OUT_LOW,
+	},
+
+};
+
+static struct msm_gpiomux_config jet_cam_configs[] = {
+	{
+		.gpio = JET_GPIO_CAM_MCLK1,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[4], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[2], 
+		},
+	},
+	{
+		.gpio = JET_GPIO_CAM_MCLK0,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[1], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[2], 
+		},
+	},
+	{
+		.gpio = JET_GPIO_CAM_I2C_DAT,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[3], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[2],
+		},
+	},
+	{
+		.gpio = JET_GPIO_CAM_I2C_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[3], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[2],
+		},
+	},
+	{
+		.gpio = JET_GPIO_RAW_INTR0,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[7], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[8], 
+		},
+	},
+	{
+		.gpio = JET_GPIO_RAW_INTR1,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[7], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[8], 
+		},
+	},
+	
+	{
+		.gpio      = JET_GPIO_MCAM_SPI_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[6], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[10],
+		},
+	},
+	{
+		.gpio      = JET_GPIO_MCAM_SPI_CS0,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[6], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[10], 
+		},
+	},
+	{
+		.gpio      = JET_GPIO_MCAM_SPI_DI,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[6], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[10],
+		},
+	},
+	{
+		.gpio      = JET_GPIO_MCAM_SPI_DO,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[6], 
+			[GPIOMUX_SUSPENDED] = &cam_settings[10],
+		},
+	},
+};
+
+static struct msm_bus_vectors cam_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+};
+
+static struct msm_bus_vectors cam_preview_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 96215040,
+		.ib  = 378224640,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+};
+
+static struct msm_bus_vectors cam_video_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 342150912,
+		.ib  = 1361968128,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 207747072,
+		.ib  = 489756672,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 60318720,
+		.ib  = 150796800,
+	},
+};
+
+static struct msm_bus_vectors cam_snapshot_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 147045888,
+		.ib  = 588183552,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 263678976,
+		.ib  = 659197440,
+	},
+};
+
+static struct msm_bus_vectors cam_zsl_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 319044096,
+		.ib  = 1271531520,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 239708160,
+		.ib  = 599270400,
+	},
+};
+
+static struct msm_bus_paths cam_bus_client_config[] = {
+	{
+		ARRAY_SIZE(cam_init_vectors),
+		cam_init_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_preview_vectors),
+		cam_preview_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_video_vectors),
+		cam_video_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_snapshot_vectors),
+		cam_snapshot_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_zsl_vectors),
+		cam_zsl_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata cam_bus_client_pdata = {
+		cam_bus_client_config,
+		ARRAY_SIZE(cam_bus_client_config),
+		.name = "msm_camera",
+};
+
+static int jet_csi_vreg_on(void);
+static int jet_csi_vreg_off(void);
+
+struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
+	{
+		.ioclk.mclk_clk_rate = 24000000,
+		.ioclk.vfe_clk_rate  = 228570000,
+		.csid_core = 0,
+		.camera_csi_on = jet_csi_vreg_on,
+		.camera_csi_off = jet_csi_vreg_off,
+		.cam_bus_scale_table = &cam_bus_client_pdata,
+		.csid_core = 0,
+		.is_csiphy = 1,
+		.is_csid   = 1,
+		.is_ispif  = 1,
+		.is_vpe    = 1,
+	},
+	{
+		.ioclk.mclk_clk_rate = 24000000,
+		.ioclk.vfe_clk_rate  = 228570000,
+		.csid_core = 1,
+		.camera_csi_on = jet_csi_vreg_on,
+		.camera_csi_off = jet_csi_vreg_off,
+		.cam_bus_scale_table = &cam_bus_client_pdata,
+		.csid_core = 1,
+		.is_csiphy = 1,
+		.is_csid   = 1,
+		.is_ispif  = 1,
+		.is_vpe    = 1,
+	},
+};
+
+#ifdef CONFIG_MSM_CAMERA_FLASH
+int flashlight_control(int mode)
+{
+pr_info("%s, linear led, mode=%d", __func__, mode);
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+	return tps61310_flashlight_control(mode);
+#else
+	return 0;
+#endif
+}
+
+static struct msm_camera_sensor_flash_src msm_flash_src = {
+	.flash_sr_type = MSM_CAMERA_FLASH_SRC_CURRENT_DRIVER,
+	.camera_flash = flashlight_control,
+};
+#endif /* CONFIG_MSM_CAMERA_FLASH */
+
+#ifdef CONFIG_RAWCHIP
+static int jet_use_ext_1v2(void)
+{
+	if (system_rev >= 1) 
+		return 1;
+	else 
+		return 0;
+}
+
+#define JET_V_RAW_1V8_EN PM8921_GPIO_PM_TO_SYS(JET_GPIO_RAW_1V8_EN)
+#define JET_V_RAW_1V2_EN PM8921_GPIO_PM_TO_SYS(JET_GPIO_RAW_1V2_EN)
+static int jet_rawchip_vreg_on(void)
+{
+	int rc;
+	pr_info("%s\n", __func__);
+
+	
+	rc = gpio_request(JET_V_RAW_1V8_EN, "V_RAW_1V8_EN");
+	if (rc) {
+		pr_err("rawchip on\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			JET_V_RAW_1V8_EN, rc);
+		goto enable_1v8_fail;
+	}
+	gpio_direction_output(JET_V_RAW_1V8_EN, 1);
+	gpio_free(JET_V_RAW_1V8_EN);
+
+	mdelay(5);
+
+	
+	if (system_rev < 2) {	
+		rc = gpio_request(JET_V_RAW_1V2_EN, "V_RAW_1V2_EN");
+		if (rc) {
+			pr_err("rawchip on\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			JET_V_RAW_1V2_EN, rc);
+			goto enable_1v2_fail;
+		}
+		gpio_direction_output(JET_V_RAW_1V2_EN, 1);
+		gpio_free(JET_V_RAW_1V2_EN);
+	}
+
+	if (jet_use_ext_1v2()) { 
+		mdelay(1);
+
+		rc = gpio_request(JET_GPIO_V_CAM_D1V2_EN, "rawchip");
+		pr_info("rawchip external 1v2 gpio_request,%d\n",
+		JET_GPIO_V_CAM_D1V2_EN);
+		if (rc < 0) {
+			pr_err("GPIO(%d) request failed", JET_GPIO_V_CAM_D1V2_EN);
+			goto enable_1v2_fail;
+		}
+		gpio_direction_output(JET_GPIO_V_CAM_D1V2_EN, 1);
+		gpio_free(JET_GPIO_V_CAM_D1V2_EN);
+		mdelay(1);
+	}
+	return rc;
+
+enable_1v2_fail:
+	rc = gpio_request(JET_V_RAW_1V8_EN, "V_RAW_1V8_EN");
+	if (rc)
+		pr_err("rawchip on\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			JET_V_RAW_1V8_EN, rc);
+	gpio_direction_output(JET_V_RAW_1V8_EN, 0);
+	gpio_free(JET_V_RAW_1V8_EN);
+enable_1v8_fail:
+	return rc;
+}
+
+static int jet_rawchip_vreg_off(void)
+{
+	int rc = 0;
+
+	pr_info("%s\n", __func__);
+
+	if (jet_use_ext_1v2()) { 
+		rc = gpio_request(JET_GPIO_V_CAM_D1V2_EN, "rawchip");
+		if (rc)
+			pr_err("rawchip off(\
+				\"gpio %d\", 1.2V) FAILED %d\n",
+				JET_GPIO_V_CAM_D1V2_EN, rc);
+		gpio_direction_output(JET_GPIO_V_CAM_D1V2_EN, 0);
+		gpio_free(JET_GPIO_V_CAM_D1V2_EN);
+
+		mdelay(1);
+	}
+
+	if (system_rev < 2) {	
+		rc = gpio_request(JET_V_RAW_1V2_EN, "V_RAW_1V2_EN");
+		if (rc)
+			pr_err("rawchip off(\
+		\"gpio %d\", 1.2V) FAILED %d\n",
+		JET_V_RAW_1V2_EN, rc);
+		gpio_direction_output(JET_V_RAW_1V2_EN, 0);
+		gpio_free(JET_V_RAW_1V2_EN);
+
+		mdelay(5);
+	}
+
+	rc = gpio_request(JET_V_RAW_1V8_EN, "V_RAW_1V8_EN");
+	if (rc)
+		pr_err("rawchip off\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			JET_V_RAW_1V8_EN, rc);
+	gpio_direction_output(JET_V_RAW_1V8_EN, 0);
+	gpio_free(JET_V_RAW_1V8_EN);
+
+	return rc;
+}
+
+static struct msm_camera_rawchip_info msm_rawchip_board_info = {
+	.rawchip_reset	= JET_GPIO_RAW_RSTN,
+	.rawchip_intr0	= MSM_GPIO_TO_INT(JET_GPIO_RAW_INTR0),
+	.rawchip_intr1	= MSM_GPIO_TO_INT(JET_GPIO_RAW_INTR1),
+	.rawchip_spi_freq = 27, 
+	.rawchip_mclk_freq = 24, 
+	.camera_rawchip_power_on = jet_rawchip_vreg_on,
+	.camera_rawchip_power_off = jet_rawchip_vreg_off,
+	.rawchip_use_ext_1v2 = jet_use_ext_1v2,
+};
+
+struct platform_device msm_rawchip_device = {
+	.name	= "rawchip",
+	.dev	= {
+		.platform_data = &msm_rawchip_board_info,
+	},
+};
+#endif /* CONFIG_RAWCHIP */
+
+static uint16_t msm_cam_gpio_tbl[] = {
+	JET_GPIO_CAM_MCLK0, 
+	JET_GPIO_CAM_MCLK1,
+	JET_GPIO_RAW_INTR0,
+	JET_GPIO_RAW_INTR1,
+	JET_GPIO_MCAM_SPI_CLK,
+	JET_GPIO_MCAM_SPI_CS0,
+	JET_GPIO_MCAM_SPI_DI,
+	JET_GPIO_MCAM_SPI_DO,
+};
+
+
+static struct msm_camera_gpio_conf gpio_conf = {
+	.cam_gpiomux_conf_tbl = NULL,
+	.cam_gpiomux_conf_tbl_size = 0,
+	.cam_gpio_tbl = msm_cam_gpio_tbl,
+	.cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_tbl),
+};
+
+
+static struct regulator *reg_8921_l2;
+static struct regulator *reg_8921_l8;
+static struct regulator *reg_8921_l9;
+static struct regulator *reg_8921_l17;
+static struct regulator *reg_8921_lvs6;
+
+static int camera_sensor_power_enable(char *power, unsigned volt, struct regulator **sensor_power)
+{
+	int rc;
+
+	if (power == NULL)
+		return -ENODEV;
+
+	*sensor_power = regulator_get(NULL, power);
+
+	if (IS_ERR(*sensor_power)) {
+		pr_info("%s: failed to Unable to get %s\n", __func__, power);
+		return -ENODEV;
+	}
+
+	if (volt != 1800000) {
+		rc = regulator_set_voltage(*sensor_power, volt, volt);
+		if (rc < 0) {
+			pr_info("%s: failed to unable to set %s voltage to %d rc:%d\n",
+					__func__, power, volt, rc);
+			regulator_put(*sensor_power);
+			*sensor_power = NULL;
+			return -ENODEV;
+		}
+	}
+
+	rc = regulator_enable(*sensor_power);
+	if (rc < 0) {
+		pr_info("%s: failed to Enable regulator %s failed\n", __func__, power);
+		regulator_put(*sensor_power);
+		*sensor_power = NULL;
+		return -ENODEV;
+	}
+
+	return rc;
+}
+
+static int camera_sensor_power_disable(struct regulator *sensor_power)
+{
+
+	int rc;
+	if (sensor_power == NULL)
+		return -ENODEV;
+
+	if (IS_ERR(sensor_power)) {
+		pr_info("%s: failed to Invalid requlator ptr\n", __func__);
+		return -ENODEV;
+	}
+
+	rc = regulator_disable(sensor_power);
+	if (rc < 0)
+		pr_info("%s: disable regulator failed\n", __func__);
+
+	regulator_put(sensor_power);
+	sensor_power = NULL;
+	return rc;
+}
+
+static int jet_csi_vreg_on(void)
+{
+	pr_info("%s\n", __func__);
+	return camera_sensor_power_enable("8921_l2", 1200000, &reg_8921_l2);
+}
+
+static int jet_csi_vreg_off(void)
+{
+	pr_info("%s\n", __func__);
+	return camera_sensor_power_disable(reg_8921_l2);
+}
+
+
+#ifdef CONFIG_S5K3H2YX
+static int jet_s5k3h2yx_vreg_on(void)
+{
+	int rc;
+	pr_info("%s\n", __func__);
+
+	
+	if (jet_use_ext_1v2())
+		rc = camera_sensor_power_enable("8921_l17", 2850000, &reg_8921_l17);
+	else
+		rc = camera_sensor_power_enable("8921_l9", 2800000, &reg_8921_l9);
+
+	if (rc < 0) {
+		pr_err("sensor_power_enable\
+			(\"8921_l9\", 2.8V) FAILED %d\n", rc);
+		goto enable_vcm_fail;
+	}
+	mdelay(1);
+
+	
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);
+	if (rc < 0) {
+		pr_err("sensor_power_enable\
+			(\"8921_l8\", 2.8V) FAILED %d\n", rc);
+		goto enable_analog_fail;
+	}
+	mdelay(1);
+
+	
+	rc = gpio_request(JET_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc) {
+		pr_err("sensor_power_enable\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			JET_GPIO_V_CAM_D1V2_EN, rc);
+		goto enable_digital_fail;
+	}
+	gpio_direction_output(JET_GPIO_V_CAM_D1V2_EN, 1);
+	gpio_free(JET_GPIO_V_CAM_D1V2_EN);
+	mdelay(1);
+
+	
+	rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+	if (rc < 0) {
+		pr_err("sensor_power_enable\
+			(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+		goto enable_io_fail;
+	}
+
+	return rc;
+
+enable_io_fail:
+	rc = gpio_request(JET_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc < 0)
+		pr_err("sensor_power_disable\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			JET_GPIO_V_CAM_D1V2_EN, rc);
+	else {
+		gpio_direction_output(JET_GPIO_V_CAM_D1V2_EN, 0);
+		gpio_free(JET_GPIO_V_CAM_D1V2_EN);
+	}
+enable_digital_fail:
+	camera_sensor_power_disable(reg_8921_l8);
+enable_analog_fail:
+	camera_sensor_power_disable(reg_8921_l9);
+enable_vcm_fail:
+	return rc;
+}
+
+static int jet_s5k3h2yx_vreg_off(void)
+{
+	int rc = 0;
+
+	pr_info("%s\n", __func__);
+
+	
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	if (rc < 0)
+		pr_err("sensor_power_disable\
+			(\"8921_l8\") FAILED %d\n", rc);
+	mdelay(1);
+
+	
+	rc = gpio_request(JET_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc < 0)
+		pr_err("sensor_power_disable\
+			(\"gpio %d\", 1.2V) FAILED %d\n",
+			JET_GPIO_V_CAM_D1V2_EN, rc);
+	else {
+		gpio_direction_output(JET_GPIO_V_CAM_D1V2_EN, 0);
+		gpio_free(JET_GPIO_V_CAM_D1V2_EN);
+	}
+	mdelay(1);
+
+	
+	rc = camera_sensor_power_disable(reg_8921_lvs6);
+	if (rc < 0)
+		pr_err("sensor_power_disable\
+			(\"8921_lvs6\") FAILED %d\n", rc);
+
+	mdelay(1);
+
+	
+	if (jet_use_ext_1v2() == 0)
+		rc = camera_sensor_power_disable(reg_8921_l9);
+	else if (reg_8921_l17 != NULL) { 
+		regulator_put(reg_8921_l17);
+		reg_8921_l17 = NULL;
+	}
+
+	if (rc < 0)
+		pr_err("sensor_power_disable\
+			(\"8921_l9\") FAILED %d\n", rc);
+
+	return rc;
+}
+
+#ifdef CONFIG_S5K3H2YX_ACT
+static struct i2c_board_info s5k3h2yx_actuator_i2c_info = {
+	I2C_BOARD_INFO("s5k3h2yx_act", 0x11),
+};
+
+static struct msm_actuator_info s5k3h2yx_actuator_info = {
+	.board_info     = &s5k3h2yx_actuator_i2c_info,
+	.bus_id         = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+	.vcm_pwd        = JET_GPIO_CAM_VCM_PD,
+	.vcm_enable     = 1,
+};
+#endif
+
+static struct msm_camera_csi_lane_params s5k3h2yx_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x3,
+};
+
+static struct msm_camera_sensor_platform_info sensor_s5k3h2yx_board_info = {
+	.mount_angle = 90,
+	.mirror_flip = CAMERA_SENSOR_MIRROR_FLIP,
+	.sensor_reset_enable = 0,
+	.sensor_reset	= 0,
+	.sensor_pwd	= JET_GPIO_CAM_PWDN,
+	.vcm_pwd	= JET_GPIO_CAM_VCM_PD,
+	.vcm_enable	= 1,
+	.csi_lane_params = &s5k3h2yx_csi_lane_params,
+};
+
+static struct camera_led_est msm_camera_sensor_s5k3h2yx_led_table[] = {
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,
+		.min_step = 58,
+		.max_step = 256
+	},
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL3,
+		.current_ma = 300,
+		.lumen_value = 350,
+		.min_step = 54,
+		.max_step = 57
+	},
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL4,
+		.current_ma = 400,
+		.lumen_value = 440,
+		.min_step = 50,
+		.max_step = 53
+	},
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL6,
+		.current_ma = 600,
+		.lumen_value = 625,
+		.min_step = 46,
+		.max_step = 49
+	},
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 745,
+		.min_step = 0,
+		.max_step = 45    
+	},
+
+		{
+		.enable = 2,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,
+		.min_step = 0,
+		.max_step = 270
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_OFF,
+		.current_ma = 0,
+		.lumen_value = 0,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH,
+		.current_ma = 150,
+		.lumen_value = 150,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 2,     
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 745,
+		.min_step = 271,
+		.max_step = 317    
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL5,
+		.current_ma = 500,
+		.lumen_value = 500,
+		.min_step = 25,
+		.max_step = 26
+	},
+		{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 750,
+		.min_step = 271,
+		.max_step = 325
+	},
+
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH_LEVEL_2,
+		.current_ma = 200,
+		.lumen_value = 75,
+		.min_step = 0,
+		.max_step = 40
+	},};
+
+static struct camera_led_info msm_camera_sensor_s5k3h2yx_led_info = {
+	.enable = 1,
+	.low_limit_led_state = FL_MODE_TORCH,
+	.max_led_current_ma = 750,  
+	.num_led_est_table = ARRAY_SIZE(msm_camera_sensor_s5k3h2yx_led_table),
+};
+
+static struct camera_flash_info msm_camera_sensor_s5k3h2yx_flash_info = {
+	.led_info = &msm_camera_sensor_s5k3h2yx_led_info,
+	.led_est_table = msm_camera_sensor_s5k3h2yx_led_table,
+};
+
+static struct camera_flash_cfg msm_camera_sensor_s5k3h2yx_flash_cfg = {
+	.low_temp_limit		= 5,
+	.low_cap_limit		= 15,
+	.flash_info             = &msm_camera_sensor_s5k3h2yx_flash_info,
+};
+
+static struct msm_camera_sensor_flash_data flash_s5k3h2yx = {
+	.flash_type	= MSM_CAMERA_FLASH_LED,
+#ifdef CONFIG_MSM_CAMERA_FLASH
+	.flash_src	= &msm_flash_src,
+#endif
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_s5k3h2yx_data = {
+	.sensor_name	= "s5k3h2yx",
+	.camera_power_on = jet_s5k3h2yx_vreg_on,
+	.camera_power_off = jet_s5k3h2yx_vreg_off,
+	.pdata	= &msm_camera_csi_device_data[0],
+	.flash_data	= &flash_s5k3h2yx,
+	.sensor_platform_info = &sensor_s5k3h2yx_board_info,
+	.gpio_conf = &gpio_conf,
+	.csi_if	= 1,
+	.camera_type = BACK_CAMERA_2D,
+#ifdef CONFIG_S5K3H2YX_ACT
+	.actuator_info = &s5k3h2yx_actuator_info,
+#endif
+	.use_rawchip = RAWCHIP_ENABLE,
+	.flash_cfg = &msm_camera_sensor_s5k3h2yx_flash_cfg, 
+};
+#endif /* CONFIG_S5K3H2YX */
+
+#ifdef CONFIG_IMX175_2LANE
+static int jet_imx175_vreg_on(void)
+{
+	int rc;
+	pr_info("[CAM] %s\n", __func__);
+
+	
+	if (jet_use_ext_1v2())
+		rc = camera_sensor_power_enable("8921_l17", 2850000, &reg_8921_l17);
+	else
+		rc = camera_sensor_power_enable("8921_l9", 2800000, &reg_8921_l9);
+
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable\
+			(\"8921_l9\", 2.8V) FAILED %d\n", rc);
+		goto enable_vcm_fail;
+	}
+	mdelay(1);
+
+	
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable\
+			(\"8921_l8\", 2.8V) FAILED %d\n", rc);
+		goto enable_vana_fail;
+	}
+	mdelay(1);
+
+	
+	rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable\
+			(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+		goto enable_vdig_fail;
+	}
+
+	return rc;
+
+enable_vdig_fail:
+	camera_sensor_power_disable(reg_8921_l8);
+enable_vana_fail:
+	if (jet_use_ext_1v2() == 0)
+		camera_sensor_power_disable(reg_8921_l9);
+enable_vcm_fail:
+	return rc;
+}
+
+static int jet_imx175_vreg_off(void)
+{
+	int rc = 0;
+
+	pr_info("[CAM] %s\n", __func__);
+
+	
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable\
+			(\"8921_l8\") FAILED %d\n", rc);
+	mdelay(1);
+
+	
+	rc = camera_sensor_power_disable(reg_8921_lvs6);
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable\
+			(\"8921_lvs6\") FAILED %d\n", rc);
+
+	mdelay(1);
+
+	
+	if (jet_use_ext_1v2() == 0)
+		rc = camera_sensor_power_disable(reg_8921_l9);
+
+	if (rc < 0)
+		pr_err("[CAM] sensor_power_disable\
+			(\"8921_l9\") FAILED %d\n", rc);
+
+	return rc;
+}
+
+#ifdef CONFIG_IMX175_ACT
+static struct i2c_board_info imx175_actuator_i2c_info = {
+	I2C_BOARD_INFO("imx175_act", 0x11),
+};
+
+static struct msm_actuator_info imx175_actuator_info = {
+	.board_info     = &imx175_actuator_i2c_info,
+	.bus_id         = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+	.vcm_pwd        = JET_GPIO_CAM_VCM_PD,
+	.vcm_enable     = 1,
+};
+#endif
+
+static struct msm_camera_csi_lane_params imx175_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x3,
+};
+
+static struct msm_camera_sensor_platform_info sensor_imx175_board_info = {
+	.mount_angle = 90,
+	.mirror_flip = CAMERA_SENSOR_NONE,
+	.sensor_reset_enable = 0,
+	.sensor_reset	= 0,
+	.sensor_pwd	= JET_GPIO_CAM_PWDN,
+	.vcm_pwd	= JET_GPIO_CAM_VCM_PD,
+	.vcm_enable	= 1,
+	.csi_lane_params = &imx175_csi_lane_params,
+};
+
+static struct camera_led_est msm_camera_sensor_imx175_led_table[] = {
+	{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,
+		.min_step = 58,
+		.max_step = 256
+	},
+	{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL3,
+		.current_ma = 300,
+		.lumen_value = 350,
+		.min_step = 54,
+		.max_step = 57
+	},
+	{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL4,
+		.current_ma = 400,
+		.lumen_value = 440,
+		.min_step = 50,
+		.max_step = 53
+	},
+	{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL6,
+		.current_ma = 600,
+		.lumen_value = 625,
+		.min_step = 46,
+		.max_step = 49
+	},
+	{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 745,
+		.min_step = 0,
+		.max_step = 45    
+	},
+	{
+		.enable = 2,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,
+		.min_step = 0,
+		.max_step = 270
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_OFF,
+		.current_ma = 0,
+		.lumen_value = 0,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH,
+		.current_ma = 150,
+		.lumen_value = 150,
+		.min_step = 0,
+		.max_step = 0
+	},
+	{
+		.enable = 2,     
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 745,
+		.min_step = 271,
+		.max_step = 317    
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL5,
+		.current_ma = 500,
+		.lumen_value = 500,
+		.min_step = 25,
+		.max_step = 26
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 750,
+		.min_step = 271,
+		.max_step = 325
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_TORCH_LEVEL_2,
+		.current_ma = 200,
+		.lumen_value = 75,
+		.min_step = 0,
+		.max_step = 40
+	},
+};
+
+static struct camera_led_info msm_camera_sensor_imx175_led_info = {
+	.enable = 1,
+	.low_limit_led_state = FL_MODE_TORCH,
+	.max_led_current_ma = 750,  
+	.num_led_est_table = ARRAY_SIZE(msm_camera_sensor_imx175_led_table),
+};
+
+static struct camera_flash_info msm_camera_sensor_imx175_flash_info = {
+	.led_info = &msm_camera_sensor_imx175_led_info,
+	.led_est_table = msm_camera_sensor_imx175_led_table,
+};
+
+static struct camera_flash_cfg msm_camera_sensor_imx175_flash_cfg = {
+	.low_temp_limit		= 5,
+	.low_cap_limit		= 15,
+	.flash_info             = &msm_camera_sensor_imx175_flash_info,
+};
+
+static struct msm_camera_sensor_flash_data flash_imx175 = {
+	.flash_type	= MSM_CAMERA_FLASH_LED,
+#ifdef CONFIG_MSM_CAMERA_FLASH
+	.flash_src	= &msm_flash_src,
+#endif
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_imx175_data = {
+	.sensor_name	= "imx175",
+	.camera_power_on = jet_imx175_vreg_on,
+	.camera_power_off = jet_imx175_vreg_off,
+	.pdata	= &msm_camera_csi_device_data[0],
+	.flash_data	= &flash_imx175,
+	.sensor_platform_info = &sensor_imx175_board_info,
+	.gpio_conf = &gpio_conf,
+	.csi_if	= 1,
+	.camera_type = BACK_CAMERA_2D,
+#ifdef CONFIG_IMX175_ACT
+	.actuator_info = &imx175_actuator_info,
+#endif
+	.use_rawchip = RAWCHIP_ENABLE,
+	.flash_cfg = &msm_camera_sensor_imx175_flash_cfg, 
+};
+#endif /* CONFIG_IMX175_2LANE */
+
+#ifdef CONFIG_S5K6A1GX
+static int jet_s5k6a1gx_vreg_on(void)
+{
+	int rc;
+	pr_info("%s\n", __func__);
+
+	
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);
+	pr_info("sensor_power_enable(\"8921_l8\", 2.8V) == %d\n", rc);
+	if (rc < 0) {
+		pr_err("sensor_power_enable(\"8921_l8\", 2.8V) FAILED %d\n", rc);
+		goto enable_analog_fail;
+	}
+	udelay(50);
+
+	
+	if (jet_use_ext_1v2()) { 
+		rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+		if (rc < 0) {
+			pr_err("sensor_power_enable\
+				(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+			goto enable_io_fail;
+		}
+	} else {
+		rc = gpio_request(JET_GPIO_V_CAM2_D1V8_EN, "s5k6a1gx");
+		pr_info("power IO gpio_request,%d\n", JET_GPIO_V_CAM2_D1V8_EN);
+		if (rc < 0) {
+			pr_err("GPIO(%d) request failed", JET_GPIO_V_CAM2_D1V8_EN);
+			goto enable_io_fail;
+		}
+		gpio_direction_output(JET_GPIO_V_CAM2_D1V8_EN, 1);
+		gpio_free(JET_GPIO_V_CAM2_D1V8_EN);
+		udelay(50);
+
+		
+		rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+		if (rc < 0) {
+			pr_err("sensor_power_enable\
+				(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+			goto enable_i2c_pullup_fail;
+		}
+	}
+	udelay(50);
+	
+	rc = gpio_request(JET_GPIO_CAM2_RSTz, "s5k6a1gx");
+	pr_info("reset pin gpio_request,%d\n", JET_GPIO_CAM2_RSTz);
+	if (rc < 0) {
+		pr_err("GPIO(%d) request failed", JET_GPIO_CAM2_RSTz);
+		goto enable_rst_fail;
+	}
+	gpio_direction_output(JET_GPIO_CAM2_RSTz, 1);
+	gpio_free(JET_GPIO_CAM2_RSTz);
+	udelay(50);
+
+	
+	if (jet_use_ext_1v2()) { 
+		rc = gpio_request(JET_GPIO_V_CAM2_D1V8_EN, "s5k6a1gx");
+		pr_info("digital gpio_request,%d\n", JET_GPIO_V_CAM2_D1V8_EN);
+		if (rc < 0) {
+			pr_err("GPIO(%d) request failed", JET_GPIO_V_CAM2_D1V8_EN);
+			goto enable_digital_fail;
+		}
+		gpio_direction_output(JET_GPIO_V_CAM2_D1V8_EN, 1);
+		gpio_free(JET_GPIO_V_CAM2_D1V8_EN);
+		udelay(50);
+	} else {
+		rc = gpio_request(JET_GPIO_V_CAM_D1V2_EN, "s5k6a1gx");
+		pr_info("digital gpio_request,%d\n", JET_GPIO_V_CAM_D1V2_EN);
+		if (rc < 0) {
+			pr_err("GPIO(%d) request failed", JET_GPIO_V_CAM_D1V2_EN);
+			goto enable_digital_fail;
+		}
+		gpio_direction_output(JET_GPIO_V_CAM_D1V2_EN, 1);
+		gpio_free(JET_GPIO_V_CAM_D1V2_EN);
+	}
+	udelay(50);
+
+	return rc;
+
+enable_digital_fail:
+	rc = gpio_request(JET_GPIO_CAM2_RSTz, "s5k6a1gx");
+	if (rc < 0)
+		pr_err("GPIO(%d) request failed", JET_GPIO_CAM2_RSTz);
+	else {
+		gpio_direction_output(JET_GPIO_CAM2_RSTz, 0);
+		gpio_free(JET_GPIO_CAM2_RSTz);
+	}
+enable_rst_fail:
+	camera_sensor_power_disable(reg_8921_lvs6);
+enable_i2c_pullup_fail:
+	rc = gpio_request(JET_GPIO_V_CAM2_D1V8_EN, "s5k6a1gx");
+	if (rc < 0)
+		pr_err("GPIO(%d) request failed", JET_GPIO_V_CAM2_D1V8_EN);
+	else {
+		gpio_direction_output(JET_GPIO_V_CAM2_D1V8_EN, 0);
+		gpio_free(JET_GPIO_V_CAM2_D1V8_EN);
+	}
+enable_io_fail:
+	camera_sensor_power_disable(reg_8921_l8);
+enable_analog_fail:
+	return rc;
+}
+
+static int jet_s5k6a1gx_vreg_off(void)
+{
+	int rc;
+	pr_info("%s\n", __func__);
+
+	
+	if (jet_use_ext_1v2()) { 
+		rc = gpio_request(JET_GPIO_V_CAM2_D1V8_EN, "s5k6a1gx");
+		pr_info("digital gpio_request,%d\n", JET_GPIO_V_CAM2_D1V8_EN);
+		if (rc < 0)
+			pr_err("GPIO(%d) request failed", JET_GPIO_V_CAM2_D1V8_EN);
+		else {
+			gpio_direction_output(JET_GPIO_V_CAM2_D1V8_EN, 0);
+			gpio_free(JET_GPIO_V_CAM2_D1V8_EN);
+		}
+
+	} else {
+		rc = gpio_request(JET_GPIO_V_CAM_D1V2_EN, "s5k6a1gx");
+		pr_info("digital gpio_request,%d\n", JET_GPIO_V_CAM_D1V2_EN);
+		if (rc < 0)
+			pr_err("GPIO(%d) request failed", JET_GPIO_V_CAM_D1V2_EN);
+		else {
+			gpio_direction_output(JET_GPIO_V_CAM_D1V2_EN, 0);
+			gpio_free(JET_GPIO_V_CAM_D1V2_EN);
+		}
+	}
+	udelay(50);
+
+	
+	rc = gpio_request(JET_GPIO_CAM2_RSTz, "s5k6a1gx");
+	pr_info("reset pin gpio_request,%d\n", JET_GPIO_CAM2_RSTz);
+	if (rc < 0)
+		pr_err("GPIO(%d) request failed", JET_GPIO_CAM2_RSTz);
+	else {
+		gpio_direction_output(JET_GPIO_CAM2_RSTz, 0);
+		gpio_free(JET_GPIO_CAM2_RSTz);
+	}
+	udelay(50);
+
+	
+	if (jet_use_ext_1v2()) { 
+		rc = camera_sensor_power_disable(reg_8921_lvs6);
+		if (rc < 0)
+			pr_err("sensor_power_disable\
+				(\"8921_lvs6\") FAILED %d\n", rc);
+	} else {
+		rc = gpio_request(JET_GPIO_V_CAM2_D1V8_EN, "s5k6a1gx");
+		pr_info("power io gpio_request,%d\n", JET_GPIO_V_CAM2_D1V8_EN);
+		if (rc < 0)
+			pr_err("GPIO(%d) request failed", JET_GPIO_V_CAM2_D1V8_EN);
+		else {
+			gpio_direction_output(JET_GPIO_V_CAM2_D1V8_EN, 0);
+			gpio_free(JET_GPIO_V_CAM2_D1V8_EN);
+		}
+	}
+	udelay(50);
+
+	
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	if (rc < 0)
+		pr_err("sensor_power_disable(\"8921_l8\") FAILED %d\n", rc);
+	udelay(50);
+
+	return rc;
+}
+
+static struct msm_camera_csi_lane_params s5k6a1gx_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x1,
+};
+
+static struct msm_camera_sensor_platform_info sensor_s5k6a1gx_board_info = {
+	.mount_angle = 270,
+	.mirror_flip = CAMERA_SENSOR_MIRROR,
+	.sensor_reset_enable = 0,
+	.sensor_reset	= JET_GPIO_CAM2_RSTz,
+	.vcm_pwd	= 0,
+	.vcm_enable	= 0,
+	.csi_lane_params = &s5k6a1gx_csi_lane_params,
+};
+
+static struct msm_camera_sensor_flash_data flash_s5k6a1gx = {
+	.flash_type	= MSM_CAMERA_FLASH_NONE,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_s5k6a1gx_data = {
+	.sensor_name	= "s5k6a1gx",
+	.sensor_reset	= JET_GPIO_CAM2_RSTz,
+	.vcm_pwd	= 0,
+	.vcm_enable	= 0,
+	.camera_power_on = jet_s5k6a1gx_vreg_on,
+	.camera_power_off = jet_s5k6a1gx_vreg_off,
+	.pdata	= &msm_camera_csi_device_data[1],
+	.flash_data	= &flash_s5k6a1gx,
+	.sensor_platform_info = &sensor_s5k6a1gx_board_info,
+	.gpio_conf = &gpio_conf,
+	.csi_if	= 1,
+	.camera_type = FRONT_CAMERA_2D,
+	.use_rawchip = RAWCHIP_DISABLE,
+};
+#endif /* CONFIG_S5K6A1GX */
+
+static void config_cam_id(int status)
+{
+	static uint32_t cam_id_gpio_start[] = {
+		GPIO_CFG(JET_GPIO_CAM_ID, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
+	};
+
+	static uint32_t cam_id_gpio_end[] = {
+		GPIO_CFG(JET_GPIO_CAM_ID, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
+	};
+	pr_info("config_cam_id(): status=%d\n",status);
+	if(status)
+		gpio_tlmm_config(cam_id_gpio_start[0], GPIO_CFG_ENABLE);
+	else
+		gpio_tlmm_config(cam_id_gpio_end[0], GPIO_CFG_ENABLE);
+}
+
+static struct i2c_board_info msm_camera_boardinfo[] = {
+#ifdef CONFIG_S5K3H2YX
+	{
+	I2C_BOARD_INFO("s5k3h2yx", 0x20 >> 1),
+	.platform_data = &msm_camera_sensor_s5k3h2yx_data,
+	},
+#endif
+#ifdef CONFIG_S5K6A1GX
+	{
+	I2C_BOARD_INFO("s5k6a1gx", 0x6C >> 1),
+	.platform_data = &msm_camera_sensor_s5k6a1gx_data,
+	},
+#endif
+};
+
+struct msm_camera_board_info jet_camera_board_info = {
+	.board_info = msm_camera_boardinfo,
+	.num_i2c_board_info = ARRAY_SIZE(msm_camera_boardinfo),
+};
+
+static struct i2c_board_info msm_camera_boardinfo_2nd[] = {
+#ifdef CONFIG_IMX175_2LANE
+	{
+	I2C_BOARD_INFO("imx175", 0x20 >> 1),
+	.platform_data = &msm_camera_sensor_imx175_data,
+	},
+#endif
+#ifdef CONFIG_S5K6A1GX
+	{
+	I2C_BOARD_INFO("s5k6a1gx", 0x6C >> 1),
+	.platform_data = &msm_camera_sensor_s5k6a1gx_data,
+	},
+#endif
+};
+
+struct msm_camera_board_info jet_camera_board_info_2nd = {
+	.board_info = msm_camera_boardinfo_2nd,
+	.num_i2c_board_info = ARRAY_SIZE(msm_camera_boardinfo_2nd),
+};
+#endif /* CONFIG_MSM_CAMERA */
+
+void __init jet_init_camera(void)
+{
+#ifdef CONFIG_MSM_CAMERA
+	pr_info("%s", __func__);
+
+	msm_gpiomux_install(jet_cam_configs,
+			ARRAY_SIZE(jet_cam_configs));
+
+	config_cam_id(1); 
+	msleep(2);
+
+	if (gpio_get_value(JET_GPIO_CAM_ID) == 0){
+		i2c_register_board_info(MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+			jet_camera_board_info.board_info,
+			jet_camera_board_info.num_i2c_board_info);
+	}else{ 
+		i2c_register_board_info(MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+			jet_camera_board_info_2nd.board_info,
+			jet_camera_board_info_2nd.num_i2c_board_info);
+	}
+	config_cam_id(0); 
+
+	platform_device_register(&msm_rawchip_device);
+
+	platform_device_register(&msm_camera_server);
+	platform_device_register(&msm8960_device_i2c_mux_gsbi4);
+	platform_device_register(&msm8960_device_csiphy0);
+	platform_device_register(&msm8960_device_csiphy1);
+	platform_device_register(&msm8960_device_csid0);
+	platform_device_register(&msm8960_device_csid1);
+	platform_device_register(&msm8960_device_ispif);
+	platform_device_register(&msm8960_device_vfe);
+	platform_device_register(&msm8960_device_vpe);
+#endif /* CONFIG_MSM_CAMERA */
+}
diff --git a/arch/arm/mach-msm/htc/jet/board-jet-gpiomux.c b/arch/arm/mach-msm/htc/jet/board-jet-gpiomux.c
new file mode 100644
index 0000000..a8e4c92
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/board-jet-gpiomux.c
@@ -0,0 +1,422 @@
+/* arch/arm/mach-msm/board-elite-gpio.c
+ * Copyright (C) 2011 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+*/
+
+#include <mach/gpiomux.h>
+#include "board-jet.h"
+
+#if 0  /* GSBI2 is not used for I2C */
+static struct gpiomux_setting gsbi2 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+#endif /* GSBI2 is not used for I2C */
+
+static struct gpiomux_setting gsbi3 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+#if 0
+static struct gpiomux_setting gsbi4 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+#endif
+
+static struct gpiomux_setting gsbi5 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv  = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting gsbi8 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+#if 0
+/* The SPI configurations apply to GSBI 10*/
+static struct gpiomux_setting gsbi10 = {
+	.func = GPIOMUX_FUNC_2,
+	.drv = GPIOMUX_DRV_4MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+#endif
+
+static struct gpiomux_setting gsbi12 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting cdc_mclk = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting slimbus = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_KEEPER,
+};
+
+static struct msm_gpiomux_config jet_gsbi_configs[] __initdata = {
+#if 0 /* GSBI2 is not used for I2C */
+	{
+		.gpio      = JET_GPIO_VP_I2C_DAT,	/* GSBI2 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi2,
+		},
+	},
+	{
+		.gpio      = JET_GPIO_VP_I2C_CLK,	/* GSBI2 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi2,
+		},
+	},
+#endif /* GSBI2 is not used for I2C */
+	{
+		.gpio      = JET_GPIO_TP_I2C_DAT,	/* GSBI3 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi3,
+		},
+	},
+	{
+		.gpio      = JET_GPIO_TP_I2C_CLK,	/* GSBI3 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi3,
+		},
+	},
+#if 0
+	{
+		.gpio      = JET_GPIO_CAM_I2C_DAT,	/* GSBI4 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi4,
+		},
+	},
+	{
+		.gpio      = JET_GPIO_CAM_I2C_CLK,	/* GSBI4 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi4,
+		},
+	},
+#endif
+	{
+		.gpio      = JET_GPIO_NFC_I2C_SDA,	/* GSBI5 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi5,
+		},
+	},
+	{
+		.gpio      = JET_GPIO_NFC_I2C_SCL,	/* GSBI5 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi5,
+		},
+	},
+	{
+		.gpio	   = JET_GPIO_AC_I2C_SDA,	/* GSBI8 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi8,
+		},
+	},
+	{
+		.gpio	   = JET_GPIO_AC_I2C_SCL,	/* GSBI8 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi8,
+		},
+	},
+#if 0
+	{
+		/* GSBI10 SPI QUP JET_GPIO_MCAM_SPI_CLK */
+		.gpio      = JET_GPIO_MCAM_SPI_CLK,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+	{
+		/* GSBI10 SPI QUP JET_GPIO_MCAM_SPI_CS0 */
+		.gpio      = JET_GPIO_MCAM_SPI_CS0,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+	{
+		/* GSBI10 SPI QUP JET_GPIO_MCAM_SPI_DI */
+		.gpio      = JET_GPIO_MCAM_SPI_DI,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+	{
+		/* GSBI10 SPI QUP JET_GPIO_MCAM_SPI_DO */
+		.gpio      = JET_GPIO_MCAM_SPI_DO,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+#endif
+	{
+		.gpio      = JET_GPIO_SR_I2C_DAT,	/* GSBI12 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi12,
+		},
+	},
+	{
+		.gpio      = JET_GPIO_SR_I2C_CLK,	/* GSBI12 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi12,
+		},
+	},
+};
+
+static struct msm_gpiomux_config jet_slimbus_configs[] __initdata = {
+	{
+		.gpio	= JET_GPIO_AUD_WCD_SB_CLK,		/* slimbus data */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &slimbus,
+		},
+	},
+	{
+		.gpio	= JET_GPIO_AUD_WCD_SB_DATA,		/* slimbus clk */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &slimbus,
+		},
+	},
+};
+
+static struct msm_gpiomux_config jet_audio_codec_configs[] __initdata = {
+	{
+		.gpio = JET_GPIO_AUD_WCD_MCLK,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &cdc_mclk,
+		},
+	},
+};
+static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv  = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting wcnss_5wire_active_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv  = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct msm_gpiomux_config wcnss_5wire_interface[] = {
+	{
+		.gpio = JET_GPIO_WCN_CMD_DATA2,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = JET_GPIO_WCN_CMD_DATA1,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = JET_GPIO_WCN_CMD_DATA0,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = JET_GPIO_WCN_CMD_SET,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = JET_GPIO_WCN_CMD_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+};
+
+static struct gpiomux_setting mdp_vsync_suspend_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct gpiomux_setting mdp_vsync_active_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
+	{
+		.gpio = JET_GPIO_LCD_TE,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
+			[GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
+		},
+	}
+};
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+
+static struct gpiomux_setting mhl_suspend_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting mhl_active_1_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_UP,
+};
+
+static struct gpiomux_setting mhl_active_2_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_UP,
+};
+
+static struct msm_gpiomux_config jet_mhl_configs[] __initdata = {
+	{
+		.gpio = JET_GPIO_MHL_RSTz,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &mhl_active_1_cfg,
+			[GPIOMUX_SUSPENDED] = &mhl_suspend_cfg,
+		},
+	},
+	{
+		.gpio = JET_GPIO_MHL_INT,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &mhl_active_2_cfg,
+			[GPIOMUX_SUSPENDED] = &mhl_suspend_cfg,
+		},
+	},
+};
+
+
+static struct gpiomux_setting hdmi_suspend_pd_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+static struct gpiomux_setting hdmi_suspend_np_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+
+static struct gpiomux_setting hdmi_active_1_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting hdmi_active_2_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct msm_gpiomux_config jet_hdmi_configs[] __initdata = {
+	{
+		.gpio = JET_GPIO_HDMI_DDC_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &hdmi_active_1_cfg,
+			[GPIOMUX_SUSPENDED] = &hdmi_suspend_np_cfg,
+		},
+	},
+	{
+		.gpio = JET_GPIO_HDMI_DDC_DATA,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &hdmi_active_1_cfg,
+			[GPIOMUX_SUSPENDED] = &hdmi_suspend_np_cfg,
+		},
+	},
+	{
+		.gpio = JET_GPIO_HDMI_HPD,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &hdmi_active_2_cfg,
+			[GPIOMUX_SUSPENDED] = &hdmi_suspend_pd_cfg,
+		},
+	},
+};
+#endif
+
+static struct gpiomux_setting usb_id_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct msm_gpiomux_config cable_detect_usbid_config[] __initdata = {
+	{
+		.gpio = JET_GPIO_USB_ID1,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &usb_id_cfg,
+			[GPIOMUX_SUSPENDED] = &usb_id_cfg,
+		},
+	},
+};
+
+int __init jet_gpiomux_init(void)
+{
+	int rc;
+
+	rc = msm_gpiomux_init(NR_GPIO_IRQS);
+	if (rc) {
+		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
+		return rc;
+	}
+
+	msm_gpiomux_install(jet_gsbi_configs,
+			ARRAY_SIZE(jet_gsbi_configs));
+
+	msm_gpiomux_install(jet_slimbus_configs,
+			ARRAY_SIZE(jet_slimbus_configs));
+
+	msm_gpiomux_install(jet_audio_codec_configs,
+			ARRAY_SIZE(jet_audio_codec_configs));
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+	msm_gpiomux_install(jet_hdmi_configs,
+			ARRAY_SIZE(jet_hdmi_configs));
+
+	msm_gpiomux_install(jet_mhl_configs,
+			ARRAY_SIZE(jet_mhl_configs));
+#endif
+	msm_gpiomux_install(msm8960_mdp_vsync_configs,
+			ARRAY_SIZE(msm8960_mdp_vsync_configs));
+
+	msm_gpiomux_install(wcnss_5wire_interface,
+			ARRAY_SIZE(wcnss_5wire_interface));
+
+	msm_gpiomux_install(cable_detect_usbid_config,
+			ARRAY_SIZE(cable_detect_usbid_config));
+
+	return 0;
+}
+
diff --git a/arch/arm/mach-msm/htc/jet/board-jet-keypad.c b/arch/arm/mach-msm/htc/jet/board-jet-keypad.c
new file mode 100644
index 0000000..1a6e1ce
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/board-jet-keypad.c
@@ -0,0 +1,107 @@
+/* arch/arm/mach-msm/board-jet-keypad.c
+ * Copyright (C) 2010 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+*/
+
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/gpio_event.h>
+#include <linux/gpio.h>
+#include <linux/keyreset.h>
+#include <asm/mach-types.h>
+#include <mach/board_htc.h>
+#include <mach/gpio.h>
+#include <mach/proc_comm.h>
+#include <linux/moduleparam.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include "board-jet.h"
+
+static char *keycaps = "--qwerty";
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "board_jet."
+
+module_param_named(keycaps, keycaps, charp, 0);
+/* Direct Keys */
+
+static struct gpio_event_direct_entry jet_keypad_map[] = {
+	{
+		.gpio = JET_GPIO_VOL_UPz,
+		.code = KEY_VOLUMEUP,
+	},
+	{
+		.gpio = JET_GPIO_VOL_DOWNz,
+		.code = KEY_VOLUMEDOWN,
+	},
+	{
+		.gpio = JET_GPIO_CAM_STEP_1,
+		.code = KEY_HP,
+	},
+	{
+		.gpio = JET_GPIO_CAM_STEP_2,
+		.code = KEY_CAMERA,
+	},
+};
+
+static struct gpio_event_input_info jet_keypad_power_info = {
+	.info.func = gpio_event_input_func,
+	.flags = GPIOEDF_PRINT_KEYS,
+	.type = EV_KEY,
+#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
+	.debounce_time.tv.nsec = 5 * NSEC_PER_MSEC,
+# else
+	.debounce_time.tv64 = 5 * NSEC_PER_MSEC,
+# endif
+	.keymap = jet_keypad_map,
+	.keymap_size = ARRAY_SIZE(jet_keypad_map),
+};
+
+static struct gpio_event_info *jet_keypad_info[] = {
+	&jet_keypad_power_info.info,
+};
+
+static struct gpio_event_platform_data jet_keypad_data = {
+	.name = "keypad_8960",
+	.info = jet_keypad_info,
+	.info_count = ARRAY_SIZE(jet_keypad_info),
+};
+
+static struct platform_device jet_keypad_device = {
+	.name = GPIO_EVENT_DEV_NAME,
+	.id = 0,
+	.dev		= {
+		.platform_data	= &jet_keypad_data,
+	},
+};
+
+static struct keyreset_platform_data jet_reset_keys_pdata = {
+	/*.keys_up = jet_reset_keys_up,*/
+	.keys_down = {
+		KEY_POWER,
+		KEY_VOLUMEDOWN,
+		KEY_VOLUMEUP,
+		0
+	},
+};
+
+static struct platform_device jet_reset_keys_device = {
+	.name = KEYRESET_NAME,
+	.dev.platform_data = &jet_reset_keys_pdata,
+};
+
+int __init jet_init_keypad(void)
+{
+	if (platform_device_register(&jet_reset_keys_device))
+		printk(KERN_WARNING "%s: register reset key fail\n", __func__);
+
+	return platform_device_register(&jet_keypad_device);
+}
+
diff --git a/arch/arm/mach-msm/htc/jet/board-jet-pmic.c b/arch/arm/mach-msm/htc/jet/board-jet-pmic.c
new file mode 100644
index 0000000..7f830b7
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/board-jet-pmic.c
@@ -0,0 +1,441 @@
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/bootmem.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/leds.h>
+#include <linux/leds-pm8xxx-htc.h>
+#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
+#include <asm/mach-types.h>
+#include <asm/mach/mmc.h>
+#include <asm/setup.h>
+#include <mach/msm_bus_board.h>
+#include <mach/board.h>
+#include <mach/gpio.h>
+#include <mach/gpiomux.h>
+#include <mach/restart.h>
+#include "devices.h"
+#include "board-jet.h"
+
+extern unsigned int system_rev;
+
+void jet_pm8xxx_adc_device_register(void);
+
+struct pm8xxx_gpio_init {
+	unsigned			gpio;
+	struct pm_gpio			config;
+};
+
+struct pm8xxx_mpp_init {
+	unsigned			mpp;
+	struct pm8xxx_mpp_config_data	config;
+};
+
+#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
+			_func, _inv, _disable) \
+{ \
+	.gpio	= PM8921_GPIO_PM_TO_SYS(_gpio), \
+	.config	= { \
+		.direction	= _dir, \
+		.output_buffer	= _buf, \
+		.output_value	= _val, \
+		.pull		= _pull, \
+		.vin_sel	= _vin, \
+		.out_strength	= _out_strength, \
+		.function	= _func, \
+		.inv_int_pol	= _inv, \
+		.disable_pin	= _disable, \
+	} \
+}
+
+#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
+{ \
+	.mpp	= PM8921_MPP_PM_TO_SYS(_mpp), \
+	.config	= { \
+		.type		= PM8XXX_MPP_TYPE_##_type, \
+		.level		= _level, \
+		.control	= PM8XXX_MPP_##_control, \
+	} \
+}
+
+#define PM8XXX_GPIO_DISABLE(_gpio) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
+			 0, 0, 0, 1)
+
+#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
+			_pull, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_NO, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			_func, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(_gpio, _val, _func) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_BB, \
+			PM_GPIO_STRENGTH_HIGH, \
+			_func, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_L17_FUNC(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_L17, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_S4_FUNC_XC(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+/* Initial PM8921 GPIO configurations */
+static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
+	/*for pwm vibrator*/
+	PM8XXX_GPIO_INIT(JET_GPIO_HAPTIC_PWM, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, 0, PM_GPIO_PULL_UP_1P5, PM_GPIO_VIN_L17, PM_GPIO_STRENGTH_LOW, PM_GPIO_FUNC_2, 0, 0),
+	PM8XXX_GPIO_INIT(JET_GPIO_EARPHONE_DETz, PM_GPIO_DIR_IN,
+			 PM_GPIO_OUT_BUF_CMOS, 0, PM_GPIO_PULL_UP_1P5,
+			 PM_GPIO_VIN_S4, PM_GPIO_STRENGTH_LOW,
+			 PM_GPIO_FUNC_NORMAL, 0, 0),
+};
+
+/* Initial PM8921 MPP configurations */
+static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
+	/* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8, DOUT_CTRL_LOW),
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_4, D_BI_DIR, PM8901_MPP_DIG_LEVEL_L5, BI_PULLUP_10KOHM),
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_12, D_BI_DIR, PM8901_MPP_DIG_LEVEL_L5, BI_PULLUP_10KOHM),
+};
+
+void jet_lcd_id_power(int pull)
+{
+	int rc;
+	struct pm8xxx_gpio_init pm8921_lcd_id0 = PM8XXX_GPIO_INIT(JET_GPIO_LCD_ID0, PM_GPIO_DIR_IN,
+			 PM_GPIO_OUT_BUF_CMOS, 0, pull, PM_GPIO_VIN_S4, PM_GPIO_STRENGTH_LOW,
+			 PM_GPIO_FUNC_NORMAL, 0, 0);
+	struct pm8xxx_gpio_init pm8921_lcd_id1 = PM8XXX_GPIO_INIT(JET_GPIO_LCD_ID1, PM_GPIO_DIR_IN,
+			 PM_GPIO_OUT_BUF_CMOS, 0, pull, PM_GPIO_VIN_S4, PM_GPIO_STRENGTH_LOW,
+			 PM_GPIO_FUNC_NORMAL, 0, 0);
+
+	rc = pm8xxx_gpio_config(pm8921_lcd_id0.gpio, &pm8921_lcd_id0.config);
+	if (rc) {
+		pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
+		return;
+	}
+
+	rc = pm8xxx_gpio_config(pm8921_lcd_id1.gpio, &pm8921_lcd_id0.config);
+	if (rc) {
+		pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
+		return;
+	}
+}
+
+void __init jet_pm8921_gpio_mpp_init(void)
+{
+	int i, rc;
+
+	for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
+		rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
+					&pm8921_gpios[i].config);
+		if (rc) {
+			pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
+			break;
+		}
+	}
+
+	for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
+		rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
+					&pm8921_mpps[i].config);
+		if (rc) {
+			pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
+			break;
+		}
+	}
+}
+
+static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
+	.irq_base		= PM8921_IRQ_BASE,
+	.devirq			= MSM_GPIO_TO_INT(104),
+	.irq_trigger_flag	= IRQF_TRIGGER_LOW,
+};
+
+static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
+	.gpio_base	= PM8921_GPIO_PM_TO_SYS(1),
+};
+
+static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
+	.mpp_base	= PM8921_MPP_PM_TO_SYS(1),
+};
+
+static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
+	.rtc_write_enable       = true,
+#ifdef CONFIG_HTC_OFFMODE_ALARM
+	.rtc_alarm_powerup	= true,
+#else
+	.rtc_alarm_powerup	= false,
+#endif
+};
+
+static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
+	.pull_up		= 1,
+	.kpd_trigger_delay_us   = 15625,
+	.wakeup			= 1,
+};
+
+static int pm8921_therm_mitigation[] = {
+	1100,
+	700,
+	600,
+	225,
+};
+
+static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
+	.safety_time		= 510,
+	.update_time		= 60000,
+	.max_voltage		= 4200,
+	.min_voltage		= 3200,
+	.resume_voltage_delta	= 50,
+	.term_current		= 50,
+	.cool_temp		= 0,
+	.warm_temp		= 48,
+	.temp_check_period	= 1,
+	.max_bat_chg_current	= 1025,
+	.cool_bat_chg_current	= 1025,
+	.warm_bat_chg_current	= 1025,
+	.cool_bat_voltage	= 4200,
+	.warm_bat_voltage	= 4000,
+	.mbat_in_gpio		= JET_GPIO_MBAT_IN,
+	.thermal_mitigation	= pm8921_therm_mitigation,
+	.thermal_levels		= ARRAY_SIZE(pm8921_therm_mitigation),
+	.cold_thr = PM_SMBC_BATT_TEMP_COLD_THR__HIGH,
+	.hot_thr = PM_SMBC_BATT_TEMP_HOT_THR__LOW,
+};
+
+static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
+	.priority		= 0,
+};
+
+static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
+	.r_sense		= 10,
+	.i_test			= 0, /* ori=2500 */
+	.v_failure		= 3000,
+	//	.calib_delay_ms		= 600000,
+	.max_voltage_uv		= 4200 * 1000,
+};
+
+static int __init check_dq_setup(char *str)
+{
+	if (!strcmp(str, "PASS")) {
+		pr_info("[BATT] overwrite HV battery config\n");
+                pm8921_chg_pdata.max_voltage = 4340;
+                pm8921_chg_pdata.cool_bat_voltage = 4340;
+		pm8921_bms_pdata.max_voltage_uv = 4340 * 1000;
+	} else {
+		pr_info("[BATT] use default battery config\n");
+		pm8921_chg_pdata.max_voltage = 4200;
+		pm8921_chg_pdata.cool_bat_voltage = 4200;
+		pm8921_bms_pdata.max_voltage_uv = 4200 * 1000;
+	}
+	return 1;
+}
+__setup("androidboot.dq=", check_dq_setup);
+
+static struct pm8xxx_led_configure pm8921_led_info[] = {
+	[0] = {
+		.name		= "green",
+		.flags		= PM8XXX_ID_LED_1,
+		.function_flags = LED_PWM_FUNCTION | LED_BLINK_FUNCTION,
+		.period_us 	= USEC_PER_SEC / 1000,
+		.start_index 	= 0,
+		.duites_size 	= 2,
+		.duty_time_ms 	= 16,
+		.lut_flag 	= PM_PWM_LUT_RAMP_UP | PM_PWM_LUT_PAUSE_HI_EN,
+		.out_current    = 40,
+		.duties		= {0, 50, 100, 100, 50, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0},
+	},
+	[1] = {
+		.name		= "amber",
+		.flags		= PM8XXX_ID_LED_2,
+		.function_flags = LED_PWM_FUNCTION | LED_BLINK_FUNCTION,
+		.period_us 	= USEC_PER_SEC / 1000,
+		.start_index 	= 0,
+		.duites_size 	= 2,
+		.duty_time_ms 	= 16,
+		.lut_flag 	= PM_PWM_LUT_RAMP_UP | PM_PWM_LUT_PAUSE_HI_EN,
+		.out_current    = 40,
+		.duties		= {0, 50, 100, 100, 50, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0},
+	},
+	[2] = {
+		.name		= "button-backlight",
+		.flags		= PM8XXX_ID_LED_0,
+		.function_flags = LED_PWM_FUNCTION | LED_BRETH_FUNCTION,
+		.period_us 	= USEC_PER_SEC / 1000,
+		.start_index 	= 0,
+		.duites_size 	= 8,
+		.duty_time_ms 	= 64,
+		.lut_flag 	= PM_PWM_LUT_RAMP_UP | PM_PWM_LUT_PAUSE_HI_EN,
+		.out_current    = 40,
+		.duties		= {0, 15, 30, 45, 60, 75, 90, 100,
+				100, 90, 75, 60, 45, 30, 15, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0},
+	},
+};
+
+static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
+	.num_leds = ARRAY_SIZE(pm8921_led_info),
+	.leds = pm8921_led_info,
+};
+
+static struct pm8xxx_vibrator_platform_data pm8xxx_vib_pdata = {
+	.initial_vibrate_ms = 0,
+	.max_timeout_ms = 15000,
+	.level_mV = 3000,
+};
+
+static struct pm8xxx_ccadc_platform_data pm8xxx_ccadc_pdata = {
+    .r_sense_uohm		= 10,
+};
+
+static struct pm8xxx_adc_amux pm8xxx_adc_channels_data[] = {
+	{"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
+	{"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
+	{"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"pa_therm", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
+	{"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
+	{"mpp_amux6", ADC_MPP_1_AMUX6, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+};
+
+
+static struct pm8xxx_adc_properties pm8xxx_adc_data = {
+	.adc_vdd_reference	= 1800, /* milli-voltage for this adc */
+	.bitresolution		= 15,
+	.bipolar                = 0,
+};
+
+static struct pm8xxx_adc_platform_data pm8xxx_adc_pdata = {
+	.adc_channel			= pm8xxx_adc_channels_data,
+	.adc_num_board_channel		= ARRAY_SIZE(pm8xxx_adc_channels_data),
+	.adc_prop			= &pm8xxx_adc_data,
+	.adc_mpp_base			= PM8921_MPP_PM_TO_SYS(1),
+	.pm8xxx_adc_device_register	= jet_pm8xxx_adc_device_register,
+};
+
+static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
+	.irq_pdata		= &pm8xxx_irq_pdata,
+	.gpio_pdata		= &pm8xxx_gpio_pdata,
+	.mpp_pdata		= &pm8xxx_mpp_pdata,
+	.rtc_pdata              = &pm8xxx_rtc_pdata,
+	.pwrkey_pdata		= &pm8xxx_pwrkey_pdata,
+	.misc_pdata		= &pm8xxx_misc_pdata,
+	.regulator_pdatas	= msm_pm8921_regulator_pdata,
+	.charger_pdata		= &pm8921_chg_pdata,
+	.bms_pdata		= &pm8921_bms_pdata,
+	.adc_pdata		= &pm8xxx_adc_pdata,
+	.leds_pdata		= &pm8xxx_leds_pdata,
+	.ccadc_pdata		= &pm8xxx_ccadc_pdata,
+};
+
+static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
+	.controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
+	.slave	= {
+		.name			= "pm8921-core",
+		.platform_data		= &pm8921_platform_data,
+	},
+};
+
+static struct pm8921_platform_data pm8921_platform_data_XD __devinitdata = {
+	.irq_pdata		= &pm8xxx_irq_pdata,
+	.gpio_pdata		= &pm8xxx_gpio_pdata,
+	.mpp_pdata		= &pm8xxx_mpp_pdata,
+	.rtc_pdata              = &pm8xxx_rtc_pdata,
+	.pwrkey_pdata		= &pm8xxx_pwrkey_pdata,
+	.misc_pdata		= &pm8xxx_misc_pdata,
+	.regulator_pdatas	= msm_pm8921_regulator_pdata,
+	.charger_pdata		= &pm8921_chg_pdata,
+	.bms_pdata		= &pm8921_bms_pdata,
+	.adc_pdata		= &pm8xxx_adc_pdata,
+	.leds_pdata		= &pm8xxx_leds_pdata,
+	.ccadc_pdata		= &pm8xxx_ccadc_pdata,
+	.vibrator_pdata 	= &pm8xxx_vib_pdata,
+};
+
+static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata_XD __devinitdata = {
+	.controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
+	.slave	= {
+		.name			= "pm8921-core",
+		.platform_data		= &pm8921_platform_data_XD,
+	},
+};
+
+void __init jet_init_pmic(void)
+{
+	pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
+
+	if (system_rev < 3) {
+		msm8960_device_ssbi_pmic.dev.platform_data =
+				&msm8960_ssbi_pm8921_pdata;
+	        pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
+
+	} else {
+		msm8960_device_ssbi_pmic.dev.platform_data =
+				&msm8960_ssbi_pm8921_pdata_XD;
+		pm8921_platform_data_XD.num_regulators = msm_pm8921_regulator_pdata_len;
+	}
+}
diff --git a/arch/arm/mach-msm/htc/jet/board-jet-regulator.c b/arch/arm/mach-msm/htc/jet/board-jet-regulator.c
new file mode 100644
index 0000000..d3eb247
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/board-jet-regulator.c
@@ -0,0 +1,615 @@
+/*
+ * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/regulator/pm8xxx-regulator.h>
+#include <linux/regulator/msm-gpio-regulator.h>
+#include <mach/rpm-regulator.h>
+
+#include "board-jet.h"
+
+#define VREG_CONSUMERS(_id) \
+	static struct regulator_consumer_supply vreg_consumers_##_id[]
+
+/*
+ * Consumer specific regulator names:
+ *			 regulator name		consumer dev_name
+ */
+VREG_CONSUMERS(L1) = {
+	REGULATOR_SUPPLY("8921_l1",		NULL),
+};
+VREG_CONSUMERS(L2) = {
+	REGULATOR_SUPPLY("8921_l2",		NULL),
+	REGULATOR_SUPPLY("dsi_vdda",		"mipi_dsi.1"),
+	REGULATOR_SUPPLY("dsi_pll_vdda",	"mdp.0"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.0"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.1"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.2"),
+};
+VREG_CONSUMERS(L3) = {
+	REGULATOR_SUPPLY("8921_l3",		NULL),
+	REGULATOR_SUPPLY("HSUSB_3p3",		"msm_otg"),
+};
+VREG_CONSUMERS(L4) = {
+	REGULATOR_SUPPLY("8921_l4",		NULL),
+	REGULATOR_SUPPLY("HSUSB_1p8",		"msm_otg"),
+	REGULATOR_SUPPLY("iris_vddxo",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(L5) = {
+	REGULATOR_SUPPLY("8921_l5",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.1"),
+};
+VREG_CONSUMERS(L6) = {
+	REGULATOR_SUPPLY("8921_l6",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.3"),
+};
+VREG_CONSUMERS(L7) = {
+	REGULATOR_SUPPLY("8921_l7",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd_io",		"msm_sdcc.3"),
+};
+VREG_CONSUMERS(L8) = {
+	REGULATOR_SUPPLY("8921_l8",		NULL),
+	REGULATOR_SUPPLY("dsi_vdc",		"mipi_dsi.1"),
+};
+VREG_CONSUMERS(L9) = {
+	REGULATOR_SUPPLY("8921_l9",		NULL),
+	REGULATOR_SUPPLY("vdd",			"3-0024"),
+	REGULATOR_SUPPLY("vdd_ana",		"3-004a"),
+};
+VREG_CONSUMERS(L10) = {
+	REGULATOR_SUPPLY("8921_l10",		NULL),
+	REGULATOR_SUPPLY("iris_vddpa",		"wcnss_wlan.0"),
+
+};
+VREG_CONSUMERS(L11) = {
+	REGULATOR_SUPPLY("8921_l11",		NULL),
+	REGULATOR_SUPPLY("cam_vana",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vana",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0034"),
+};
+VREG_CONSUMERS(L12) = {
+	REGULATOR_SUPPLY("8921_l12",		NULL),
+	REGULATOR_SUPPLY("cam_vdig",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0034"),
+};
+VREG_CONSUMERS(L14) = {
+	REGULATOR_SUPPLY("8921_l14",		NULL),
+	REGULATOR_SUPPLY("pa_therm",		"pm8xxx-adc"),
+};
+VREG_CONSUMERS(L15) = {
+	REGULATOR_SUPPLY("8921_l15",		NULL),
+	REGULATOR_SUPPLY("vreg_xoadc",		"pm8921-charger"),
+};
+VREG_CONSUMERS(L16) = {
+	REGULATOR_SUPPLY("8921_l16",		NULL),
+	REGULATOR_SUPPLY("cam_vaf",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0034"),
+};
+VREG_CONSUMERS(L17) = {
+	REGULATOR_SUPPLY("8921_l17",		NULL),
+};
+VREG_CONSUMERS(L18) = {
+	REGULATOR_SUPPLY("8921_l18",		NULL),
+};
+VREG_CONSUMERS(L21) = {
+	REGULATOR_SUPPLY("8921_l21",		NULL),
+};
+VREG_CONSUMERS(L22) = {
+	REGULATOR_SUPPLY("8921_l22",		NULL),
+};
+VREG_CONSUMERS(L23) = {
+	REGULATOR_SUPPLY("8921_l23",		NULL),
+	REGULATOR_SUPPLY("dsi_vddio",		"mipi_dsi.1"),
+	REGULATOR_SUPPLY("dsi_pll_vddio",	"mdp.0"),
+	REGULATOR_SUPPLY("hdmi_avdd",		"hdmi_msm.0"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_riva"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_qdsp6v4.1"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_qdsp6v4.2"),
+};
+VREG_CONSUMERS(L24) = {
+	REGULATOR_SUPPLY("8921_l24",		NULL),
+	REGULATOR_SUPPLY("riva_vddmx",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(L25) = {
+	REGULATOR_SUPPLY("8921_l25",		NULL),
+	REGULATOR_SUPPLY("VDDD_CDC_D",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_A_1P2V",	"tabla-slim"),
+	REGULATOR_SUPPLY("VDDD_CDC_D",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_A_1P2V",	"tabla2x-slim"),
+};
+VREG_CONSUMERS(L26) = {
+	REGULATOR_SUPPLY("8921_l26",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.0"),
+};
+VREG_CONSUMERS(L27) = {
+	REGULATOR_SUPPLY("8921_l27",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.2"),
+};
+VREG_CONSUMERS(L28) = {
+	REGULATOR_SUPPLY("8921_l28",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.1"),
+};
+VREG_CONSUMERS(L29) = {
+	REGULATOR_SUPPLY("8921_l29",		NULL),
+};
+VREG_CONSUMERS(S1) = {
+	REGULATOR_SUPPLY("8921_s1",		NULL),
+};
+VREG_CONSUMERS(S2) = {
+	REGULATOR_SUPPLY("8921_s2",		NULL),
+	REGULATOR_SUPPLY("iris_vddrfa",		"wcnss_wlan.0"),
+
+};
+VREG_CONSUMERS(S3) = {
+	REGULATOR_SUPPLY("8921_s3",		NULL),
+	REGULATOR_SUPPLY("HSUSB_VDDCX",		"msm_otg"),
+	REGULATOR_SUPPLY("riva_vddcx",		"wcnss_wlan.0"),
+	REGULATOR_SUPPLY("HSIC_VDDCX",		"msm_hsic_host"),
+};
+VREG_CONSUMERS(S4) = {
+	REGULATOR_SUPPLY("8921_s4",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd_io",		"msm_sdcc.1"),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.2"),
+	REGULATOR_SUPPLY("sdc_vdd_io",            "msm_sdcc.4"),
+	REGULATOR_SUPPLY("riva_vddpx",		"wcnss_wlan.0"),
+	REGULATOR_SUPPLY("hdmi_vcc",		"hdmi_msm.0"),
+	REGULATOR_SUPPLY("VDDIO_CDC",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDD_CP",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_TX",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_RX",		"tabla-slim"),
+	REGULATOR_SUPPLY("VDDIO_CDC",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDD_CP",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_TX",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_RX",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-005b"),
+	REGULATOR_SUPPLY("EXT_HUB_VDDIO",	"msm_smsc_hub"),
+	REGULATOR_SUPPLY("vcc_i2c",		"10-0048"),
+};
+VREG_CONSUMERS(S5) = {
+	REGULATOR_SUPPLY("8921_s5",		NULL),
+	//	REGULATOR_SUPPLY("krait0",		"acpuclk-8960"),
+	REGULATOR_SUPPLY("krait0",		NULL),
+};
+VREG_CONSUMERS(S6) = {
+	REGULATOR_SUPPLY("8921_s6",		NULL),
+	//	REGULATOR_SUPPLY("krait1",		"acpuclk-8960"),
+	REGULATOR_SUPPLY("krait1",		NULL),
+};
+VREG_CONSUMERS(S7) = {
+	REGULATOR_SUPPLY("8921_s7",		NULL),
+};
+VREG_CONSUMERS(S8) = {
+	REGULATOR_SUPPLY("8921_s8",		NULL),
+};
+VREG_CONSUMERS(LVS1) = {
+	REGULATOR_SUPPLY("8921_lvs1",		NULL),
+	REGULATOR_SUPPLY("iris_vddio",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(LVS2) = {
+	REGULATOR_SUPPLY("8921_lvs2",		NULL),
+	REGULATOR_SUPPLY("iris_vdddig",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(LVS3) = {
+	REGULATOR_SUPPLY("8921_lvs3",		NULL),
+};
+VREG_CONSUMERS(LVS4) = {
+	REGULATOR_SUPPLY("8921_lvs4",		NULL),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-0024"),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-004a"),
+};
+VREG_CONSUMERS(LVS5) = {
+	REGULATOR_SUPPLY("8921_lvs5",		NULL),
+	REGULATOR_SUPPLY("cam_vio",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vio",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0034"),
+};
+VREG_CONSUMERS(LVS6) = {
+	REGULATOR_SUPPLY("8921_lvs6",		NULL),
+	REGULATOR_SUPPLY("vdd_io",		"spi0.0"),
+};
+VREG_CONSUMERS(LVS7) = {
+	REGULATOR_SUPPLY("8921_lvs7",		NULL),
+};
+VREG_CONSUMERS(USB_OTG) = {
+	REGULATOR_SUPPLY("8921_usb_otg",	NULL),
+	REGULATOR_SUPPLY("vbus_otg",		"msm_otg"),
+};
+VREG_CONSUMERS(HDMI_MVS) = {
+	REGULATOR_SUPPLY("8921_hdmi_mvs",	NULL),
+	REGULATOR_SUPPLY("hdmi_mvs",		"hdmi_msm.0"),
+};
+VREG_CONSUMERS(NCP) = {
+	REGULATOR_SUPPLY("8921_ncp",		NULL),
+};
+VREG_CONSUMERS(EXT_5V) = {
+	REGULATOR_SUPPLY("ext_5v",		NULL),
+};
+VREG_CONSUMERS(EXT_L2) = {
+	REGULATOR_SUPPLY("ext_l2",		NULL),
+	REGULATOR_SUPPLY("vdd_phy",		"spi0.0"),
+};
+
+VREG_CONSUMERS(EXT_3P3V) = {
+	REGULATOR_SUPPLY("ext_3p3v",		NULL),
+	REGULATOR_SUPPLY("vdd_ana",		"3-005b"),
+	REGULATOR_SUPPLY("vdd_lvds_3p3v",	"mipi_dsi.1"),
+	REGULATOR_SUPPLY("mhl_usb_hs_switch",	"msm_otg"),
+};
+#if 0
+VREG_CONSUMERS(EXT_OTG_SW) = {
+	REGULATOR_SUPPLY("ext_otg_sw",		NULL),
+	REGULATOR_SUPPLY("vbus_otg",		"msm_otg"),
+};
+#endif
+#define PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
+			 _apply_uV, _pull_down, _always_on, _supply_regulator, \
+			 _system_uA, _enable_time, _reg_id) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_modes_mask	= _modes, \
+				.valid_ops_mask		= _ops, \
+				.min_uV			= _min_uV, \
+				.max_uV			= _max_uV, \
+				.input_uV		= _max_uV, \
+				.apply_uV		= _apply_uV, \
+				.always_on		= _always_on, \
+				.name			= _name, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id			= _reg_id, \
+		.pull_down_enable	= _pull_down, \
+		.system_uA		= _system_uA, \
+		.enable_time		= _enable_time, \
+	}
+
+#define PM8XXX_LDO(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_NLDO1200(_id, _name, _always_on, _pull_down, _min_uV, \
+		_max_uV, _enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_SMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_FTSMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
+		REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
+		| REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_VS(_id, _name, _always_on, _pull_down, _enable_time, \
+		_supply_regulator, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
+		_pull_down, _always_on, _supply_regulator, 0, _enable_time, \
+		_reg_id)
+
+#define PM8XXX_VS300(_id, _name, _always_on, _pull_down, _enable_time, \
+		_supply_regulator, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
+		_pull_down, _always_on, _supply_regulator, 0, _enable_time, \
+		_reg_id)
+
+#define PM8XXX_NCP(_id, _name, _always_on, _min_uV, _max_uV, _enable_time, \
+		_supply_regulator, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, 0, \
+		REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, 0, \
+		_always_on, _supply_regulator, 0, _enable_time, _reg_id)
+
+/* Pin control initialization */
+#define PM8XXX_PC(_id, _name, _always_on, _pin_fn, _pin_ctrl, \
+		  _supply_regulator, _reg_id) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+				.always_on	= _always_on, \
+				.name		= _name, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id##_PC), \
+			.consumer_supplies	= vreg_consumers_##_id##_PC, \
+			.supply_regulator  = _supply_regulator, \
+		}, \
+		.id		= _reg_id, \
+		.pin_fn		= PM8XXX_VREG_PIN_FN_##_pin_fn, \
+		.pin_ctrl	= _pin_ctrl, \
+	}
+
+#define GPIO_VREG(_id, _reg_name, _gpio_label, _gpio, _supply_regulator) \
+	[GPIO_VREG_ID_##_id] = { \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.regulator_name = _reg_name, \
+		.gpio_label	= _gpio_label, \
+		.gpio		= _gpio, \
+	}
+
+#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
+	{ \
+		.constraints = { \
+			.name		= _name, \
+			.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE, \
+			.min_uV		= _min_uV, \
+			.max_uV		= _max_uV, \
+		}, \
+		.num_consumer_supplies	= ARRAY_SIZE(vreg_consumers_##_id), \
+		.consumer_supplies	= vreg_consumers_##_id, \
+	}
+
+#define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \
+		 _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \
+		 _force_mode, _sleep_set_force_mode, _power_mode, _state, \
+		 _sleep_selectable, _always_on, _supply_regulator, _system_uA) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_modes_mask	= _modes, \
+				.valid_ops_mask		= _ops, \
+				.min_uV			= _min_uV, \
+				.max_uV			= _max_uV, \
+				.input_uV		= _min_uV, \
+				.apply_uV		= _apply_uV, \
+				.always_on		= _always_on, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id			= RPM_VREG_ID_PM8921_##_id, \
+		.default_uV		= _default_uV, \
+		.peak_uA		= _peak_uA, \
+		.avg_uA			= _avg_uA, \
+		.pull_down_enable	= _pull_down, \
+		.pin_ctrl		= _pin_ctrl, \
+		.freq			= RPM_VREG_FREQ_##_freq, \
+		.pin_fn			= _pin_fn, \
+		.force_mode		= _force_mode, \
+		.sleep_set_force_mode	= _sleep_set_force_mode, \
+		.power_mode		= _power_mode, \
+		.state			= _state, \
+		.sleep_selectable	= _sleep_selectable, \
+		.system_uA		= _system_uA, \
+	}
+
+#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
+		_supply_regulator, _system_uA, _init_peak_uA) \
+	RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
+		 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, _system_uA)
+
+#define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
+		 _supply_regulator, _system_uA, _freq, _force_mode, \
+		 _sleep_set_force_mode) \
+	RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
+		 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _system_uA, 0, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_##_force_mode, \
+		 RPM_VREG_FORCE_MODE_8960_##_sleep_set_force_mode, \
+		 RPM_VREG_POWER_MODE_8960_PWM, RPM_VREG_STATE_OFF, \
+		 _sleep_selectable, _always_on, _supply_regulator, _system_uA)
+
+#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
+	RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, 0)
+
+#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
+		_supply_regulator, _freq) \
+	RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
+		 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, 0)
+
+/* Pin control initialization */
+#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+				.always_on	= _always_on, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id##_PC), \
+			.consumer_supplies	= vreg_consumers_##_id##_PC, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id	  = RPM_VREG_ID_PM8921_##_id##_PC, \
+		.pin_fn	  = RPM_VREG_PIN_FN_8960_##_pin_fn, \
+		.pin_ctrl = _pin_ctrl, \
+	}
+
+/* GPIO regulator constraints */
+struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] __devinitdata = {
+	/*        ID      vreg_name gpio_label   gpio                  supply */
+	GPIO_VREG(EXT_5V, "ext_5v", "ext_5v_en", PM8921_MPP_PM_TO_SYS(7), NULL),
+	GPIO_VREG(EXT_L2, "ext_l2", "ext_l2_en", 91, NULL),
+	GPIO_VREG(EXT_3P3V, "ext_3p3v", "ext_3p3v_en", PM8921_GPIO_PM_TO_SYS(17), NULL),
+};
+
+/* SAW regulator constraints */
+struct regulator_init_data msm_saw_regulator_pdata_s5 =
+	/*	      ID  vreg_name	       min_uV   max_uV */
+	SAW_VREG_INIT(S5, "8921_s5",	       850000, 1300000);
+struct regulator_init_data msm_saw_regulator_pdata_s6 =
+	SAW_VREG_INIT(S6, "8921_s6",	       850000, 1300000);
+
+/* PM8921 regulator constraints */
+struct pm8xxx_regulator_platform_data
+msm_pm8921_regulator_pdata[] __devinitdata = {
+	/*
+	 *		ID   name always_on pd min_uV   max_uV   en_t supply
+	 *	system_uA reg_ID
+	 */
+	PM8XXX_NLDO1200(L26, "8921_l26", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 1),
+	PM8XXX_NLDO1200(L27, "8921_l27", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 2),
+	PM8XXX_NLDO1200(L28, "8921_l28", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 3),
+	PM8XXX_LDO(L29,      "8921_l29", 0, 1, 2050000, 2100000, 200, "8921_s8",
+		0, 4),
+
+	/*	     ID        name      always_on pd en_t supply    reg_ID */
+	PM8XXX_VS300(USB_OTG,  "8921_usb_otg",  0, 1, 0,   "ext_5v", 5),
+	PM8XXX_VS300(HDMI_MVS, "8921_hdmi_mvs", 0, 1, 0,   "ext_5v", 6),
+};
+
+static struct rpm_regulator_init_data
+msm_rpm_regulator_init_data[] __devinitdata = {
+	/*	 ID    a_on pd ss min_uV   max_uV  supply sys_uA freq */
+  RPM_SMPS(S1,	 1, 1, 0, 1225000, 1225000, NULL, 100000, 3p20, NONE, NONE),
+	RPM_SMPS(S2,	 0, 1, 0, 1300000, 1300000, NULL, 0,	  1p60, NONE, NONE),
+	RPM_SMPS(S3,	 0, 1, 1,  500000, 1150000, NULL, 100000, 4p80, NONE, NONE),
+	RPM_SMPS(S4,	 1, 1, 0, 1800000, 1800000, NULL, 100000, 3p20, NONE, NONE),
+	RPM_SMPS(S7,	 0, 1, 0, 1150000, 1150000, NULL, 100000, 3p20, NONE, NONE),
+	RPM_SMPS(S8,	 1, 1, 1, 2050000, 2050000, NULL, 100000, 1p60, NONE, NONE),
+
+	/*	ID     a_on pd ss min_uV   max_uV  supply  sys_uA init_ip */
+	RPM_LDO(L1,	 1, 1, 0, 1050000, 1050000, "8921_s4", 0, 10000),
+	RPM_LDO(L2,	 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
+	RPM_LDO(L3,	 0, 1, 0, 3075000, 3075000, NULL,      0, 0),
+	RPM_LDO(L4,	 1, 1, 0, 1800000, 1800000, NULL,      10000, 10000),
+	RPM_LDO(L5,	 0, 1, 0, 2950000, 2950000, NULL,      0, 0),
+	RPM_LDO(L6,	 0, 1, 0, 2850000, 2950000, NULL,      0, 0),
+	RPM_LDO(L7,	 1, 1, 0, 1850000, 2950000, NULL,      10000, 10000),
+	RPM_LDO(L8,	 0, 1, 0, 2800000, 3000000, NULL,      0, 0),
+	RPM_LDO(L9,	 0, 1, 0, 2850000, 3300000, NULL,      0, 0),
+	RPM_LDO(L10,	 0, 1, 0, 3000000, 3000000, NULL,      0, 0),
+	RPM_LDO(L11,	 0, 1, 0, 3000000, 3200000, NULL,      0, 0), /* XA 3.2v, XB 3.0v */
+	RPM_LDO(L12,	 0, 1, 0, 1200000, 1500000, "8921_s4", 0, 0), /* XA 1.5v, XB 1.2v */
+	RPM_LDO(L14,	 0, 1, 0, 1800000, 1800000, NULL,      0, 0),
+	RPM_LDO(L15,	 0, 1, 0, 1800000, 2950000, NULL,      0, 0),
+	RPM_LDO(L16,	 0, 1, 0, 2850000, 3300000, NULL,      0, 0), /*XA 3.3v, XB 2.85v */
+	RPM_LDO(L17,	 0, 1, 0, 2850000, 3300000, NULL,      0, 0),
+	RPM_LDO(L18,	 0, 1, 0, 1300000, 1300000, "8921_s4", 0, 0),
+	RPM_LDO(L21,	 0, 1, 0, 1900000, 1900000, "8921_s8", 0, 0),
+	RPM_LDO(L22,	 0, 1, 0, 2750000, 2750000, NULL,      0, 0),
+	RPM_LDO(L23,	 1, 1, 1, 1800000, 1800000, "8921_s8", 10000, 10000),
+	RPM_LDO(L24,	 0, 1, 1,  750000, 1150000, "8921_s1", 10000, 10000),
+	RPM_LDO(L25,	 1, 1, 0, 1225000, 1225000, "8921_s1", 10000, 10000),
+
+	/*	ID     a_on pd ss		    supply */
+	RPM_VS(LVS1,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS2,	 0, 1, 0,		    "8921_s1"),
+	RPM_VS(LVS3,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS4,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS5,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS6,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS7,	 0, 1, 0,		    "8921_s4"),
+
+	/*	 ID      a_on  ss min_uV   max_uV   supply        freq */
+	RPM_NCP(NCP,	 0,    0, 1800000, 1800000, "8921_l6",    1p60),
+};
+
+int msm_pm8921_regulator_pdata_len __devinitdata =
+	ARRAY_SIZE(msm_pm8921_regulator_pdata);
+
+#define RPM_REG_MAP(_id, _sleep_also, _voter, _supply, _dev_name) \
+	{ \
+		.vreg_id = RPM_VREG_ID_PM8921_##_id, \
+		.sleep_also = _sleep_also, \
+		.voter = _voter, \
+		.supply = _supply, \
+		.dev_name = _dev_name, \
+	}
+static struct rpm_regulator_consumer_mapping
+	      msm_rpm_regulator_consumer_mapping[] __devinitdata = {
+	RPM_REG_MAP(L23, 0, 1, "krait0_l23", "acpuclk-8960"),
+	RPM_REG_MAP(L23, 0, 2, "krait1_l23", "acpuclk-8960"),
+	RPM_REG_MAP(L23, 0, 6, "l2_l23",     "acpuclk-8960"),
+	RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8960"),
+	RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8960"),
+	RPM_REG_MAP(S3,  0, 1, "krait0_dig", "acpuclk-8960"),
+	RPM_REG_MAP(S3,  0, 2, "krait1_dig", "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 1, "krait0_s8",  "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 2, "krait1_s8",  "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 6, "l2_s8",      "acpuclk-8960"),
+};
+
+struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
+	.name	= GPIO_REGULATOR_DEV_NAME,
+	.id	= PM8921_MPP_PM_TO_SYS(7),
+	.dev	= {
+		.platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
+	},
+};
+
+struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
+	.name	= GPIO_REGULATOR_DEV_NAME,
+	.id	= 91,
+	.dev	= {
+		.platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
+	},
+};
+
+struct rpm_regulator_platform_data jet_rpm_regulator_pdata __devinitdata = {
+	.init_data		= msm_rpm_regulator_init_data,
+	.num_regulators		= ARRAY_SIZE(msm_rpm_regulator_init_data),
+	.version		= RPM_VREG_VERSION_8960,
+	.vreg_id_vdd_mem	= RPM_VREG_ID_PM8921_L24,
+	.vreg_id_vdd_dig	= RPM_VREG_ID_PM8921_S3,
+	.consumer_map		= msm_rpm_regulator_consumer_mapping,
+	.consumer_map_len = ARRAY_SIZE(msm_rpm_regulator_consumer_mapping),
+};
diff --git a/arch/arm/mach-msm/htc/jet/board-jet-storage.c b/arch/arm/mach-msm/htc/jet/board-jet-storage.c
new file mode 100644
index 0000000..4bd2b33
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/board-jet-storage.c
@@ -0,0 +1,390 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/bootmem.h>
+#include <linux/gpio.h>
+#include <asm/mach-types.h>
+#include <asm/mach/mmc.h>
+#include <mach/board.h>
+#include <mach/gpiomux.h>
+#include "devices.h"
+#include "board-jet.h"
+#include "board-storage-common-a.h"
+
+/* MSM8960 has 5 SDCC controllers */
+enum sdcc_controllers {
+	SDCC1,
+	SDCC2,
+	SDCC3,
+	SDCC4,
+	SDCC5,
+	MAX_SDCC_CONTROLLER
+};
+
+/* All SDCC controllers require VDD/VCC voltage */
+static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
+	/* SDCC1 : eMMC card connected */
+	[SDCC1] = {
+		.name = "sdc_vdd",
+		.high_vol_level = 2950000,
+		.low_vol_level = 2950000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		.lpm_uA = 9000,
+		.hpm_uA = 200000, /* 200mA */
+	},
+	/* SDCC2 : SDIO slot connected */
+	[SDCC2] = {
+		.name = "sdc_vdd",
+		.high_vol_level = 1800000,
+		.low_vol_level = 1800000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		.lpm_uA = 9000,
+		.hpm_uA = 200000, /* 200mA */
+	},
+	/* SDCC3 : External card slot connected */
+	[SDCC3] = {
+		.name = "sdc_vdd",
+		.high_vol_level = 2950000,
+		.low_vol_level = 2950000,
+		.hpm_uA = 600000, /* 600mA */
+	}
+};
+
+/* SDCC controllers may require voting for IO operating voltage */
+static struct msm_mmc_reg_data mmc_vdd_io_reg_data[MAX_SDCC_CONTROLLER] = {
+	/* SDCC1 : eMMC card connected */
+	[SDCC1] = {
+		.name = "sdc_vdd_io",
+		.always_on = 1,
+		.high_vol_level = 1800000,
+		.low_vol_level = 1800000,
+		.hpm_uA = 200000, /* 200mA */
+	},
+	/* SDCC3 : External card slot connected */
+	[SDCC3] = {
+		.name = "sdc_vdd_io",
+		.high_vol_level = 2950000,
+		.low_vol_level = 1850000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		/* Max. Active current required is 16 mA */
+		.hpm_uA = 16000,
+		/*
+		 * Sleep current required is ~300 uA. But min. vote can be
+		 * in terms of mA (min. 1 mA). So let's vote for 2 mA
+		 * during sleep.
+		 */
+		.lpm_uA = 2000,
+	},
+	/* SDCC4 : SDIO slot connected */
+	[SDCC4] = {
+		.name = "sdc_vdd_io",
+		.high_vol_level = 1800000,
+		.low_vol_level = 1800000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		.hpm_uA = 200000, /* 200mA */
+		.lpm_uA = 2000,
+	},
+};
+
+static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
+	/* SDCC1 : eMMC card connected */
+	[SDCC1] = {
+		.vdd_data = &mmc_vdd_reg_data[SDCC1],
+		.vdd_io_data = &mmc_vdd_io_reg_data[SDCC1],
+	},
+	/* SDCC2 : SDIO card slot connected */
+	[SDCC2] = {
+		.vdd_data = &mmc_vdd_reg_data[SDCC2],
+	},
+	/* SDCC3 : External card slot connected */
+	[SDCC3] = {
+		.vdd_data = &mmc_vdd_reg_data[SDCC3],
+		.vdd_io_data = &mmc_vdd_io_reg_data[SDCC3],
+	},
+	/* SDCC4 : SDIO card slot connected */
+	[SDCC4] = {
+		.vdd_io_data = &mmc_vdd_io_reg_data[SDCC4],
+	},
+};
+
+/* SDC1 pad data */
+static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
+	{TLMM_HDRV_SDC1_CLK, GPIO_CFG_10MA},
+	{TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
+	{TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
+};
+
+static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
+	{TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
+};
+
+static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
+	{TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
+	{TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
+};
+
+/* SDC3 pad data */
+static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
+	{TLMM_HDRV_SDC3_CLK, GPIO_CFG_10MA},
+	{TLMM_HDRV_SDC3_CMD, GPIO_CFG_10MA},
+	{TLMM_HDRV_SDC3_DATA, GPIO_CFG_10MA}
+};
+
+static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
+	{TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
+};
+
+static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
+	{TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
+	{TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
+	/*
+	 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
+	 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
+	 * which would result in false card detection interrupts.
+	 */
+	{TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
+	/*
+	 * Keeping DATA lines status to PULL UP will make sure that
+	 * there is no current leak during sleep if external pull up
+	 * is connected to DATA lines.
+	 */
+	{TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.on = sdc1_pad_pull_on_cfg,
+		.off = sdc1_pad_pull_off_cfg,
+		.size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
+	},
+	[SDCC3] = {
+		.on = sdc3_pad_pull_on_cfg,
+		.off = sdc3_pad_pull_off_cfg,
+		.size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
+	},
+};
+
+static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.on = sdc1_pad_drv_on_cfg,
+		.off = sdc1_pad_drv_off_cfg,
+		.size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
+	},
+	[SDCC3] = {
+		.on = sdc3_pad_drv_on_cfg,
+		.off = sdc3_pad_drv_off_cfg,
+		.size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
+	},
+};
+
+struct msm_mmc_gpio sdc2_gpio[] = {
+	{92, "sdc2_dat_3"},
+	{91, "sdc2_dat_2"},
+	{90, "sdc2_dat_1"},
+	{89, "sdc2_dat_0"},
+	{97, "sdc2_cmd"},
+	{98, "sdc2_clk"}
+};
+
+struct msm_mmc_gpio sdc4_gpio[] = {
+	{83, "sdc4_dat_3"},
+	{84, "sdc4_dat_2"},
+	{85, "sdc4_dat_1"},
+	{86, "sdc4_dat_0"},
+	{87, "sdc4_cmd"},
+	{88, "sdc4_clk"}
+};
+
+struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC2] = {
+		.gpio = sdc2_gpio,
+		.size = ARRAY_SIZE(sdc2_gpio),
+	},
+	[SDCC4] = {
+		.gpio = sdc4_gpio,
+		.size = ARRAY_SIZE(sdc4_gpio),
+	},
+};
+
+static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.pull = &mmc_pad_pull_data[SDCC1],
+		.drv = &mmc_pad_drv_data[SDCC1]
+	},
+	[SDCC3] = {
+		.pull = &mmc_pad_pull_data[SDCC3],
+		.drv = &mmc_pad_drv_data[SDCC3]
+	},
+};
+
+static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.pad_data = &mmc_pad_data[SDCC1],
+	},
+	[SDCC2] = {
+		.is_gpio = 1,
+		.gpio_data = &mmc_gpio_data[SDCC2],
+	},
+	[SDCC3] = {
+		.pad_data = &mmc_pad_data[SDCC3],
+	},
+	[SDCC4] = {
+		.is_gpio = 1,
+		.gpio_data = &mmc_gpio_data[SDCC4],
+	},
+};
+
+#define MSM_MPM_PIN_SDC1_DAT1	17
+#define MSM_MPM_PIN_SDC3_DAT1	21
+
+static unsigned int sdc1_sup_clk_rates[] = {
+	400000, 24000000, 48000000, 96000000
+};
+
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+static unsigned int sdc3_sup_clk_rates[] = {
+	400000, 24000000, 48000000, 96000000, 192000000
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
+static struct mmc_platform_data msm8960_sdc1_data = {
+	.ocr_mask       = MMC_VDD_27_28 | MMC_VDD_28_29,
+#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
+	.mmc_bus_width  = MMC_CAP_8_BIT_DATA,
+#else
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+#endif
+	.sup_clk_table	= sdc1_sup_clk_rates,
+	.sup_clk_cnt	= ARRAY_SIZE(sdc1_sup_clk_rates),
+	.nonremovable	= 1,
+	.vreg_data	= &mmc_slot_vreg_data[SDCC1],
+	.pin_data	= &mmc_slot_pin_data[SDCC1],
+	.mpm_sdiowakeup_int = MSM_MPM_PIN_SDC1_DAT1,
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+	.uhs_caps2	= MMC_CAP2_HS200_1_8V_SDR,
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
+static unsigned int sdc2_sup_clk_rates[] = {
+	400000, 24000000, 48000000
+};
+
+static struct mmc_platform_data msm8960_sdc2_data = {
+	.ocr_mask       = MMC_VDD_165_195,
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+	.sup_clk_table  = sdc2_sup_clk_rates,
+	.sup_clk_cnt    = ARRAY_SIZE(sdc2_sup_clk_rates),
+	.vreg_data      = &mmc_slot_vreg_data[SDCC2],
+	.pin_data       = &mmc_slot_pin_data[SDCC2],
+	.sdiowakeup_irq = MSM_GPIO_TO_INT(90),
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+static struct mmc_platform_data msm8960_sdc3_data = {
+	.ocr_mask       = MMC_VDD_27_28 | MMC_VDD_28_29,
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+	.sup_clk_table	= sdc3_sup_clk_rates,
+	.sup_clk_cnt	= ARRAY_SIZE(sdc3_sup_clk_rates),
+#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
+	.wpswitch_gpio	= PM8921_GPIO_PM_TO_SYS(16),
+#endif
+	.vreg_data	= &mmc_slot_vreg_data[SDCC3],
+	.pin_data	= &mmc_slot_pin_data[SDCC3],
+	.status_gpio	= JET_GPIO_SD_CDETz,
+	.status_irq	= MSM_GPIO_TO_INT(JET_GPIO_SD_CDETz),
+	.irq_flags	= IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+	.is_status_gpio_active_low = true,
+#if 0
+	.xpc_cap	= 1,
+	.uhs_caps	= (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
+			MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
+			MMC_CAP_UHS_SDR104 | MMC_CAP_MAX_CURRENT_600),
+#endif
+	.mpm_sdiowakeup_int = MSM_MPM_PIN_SDC3_DAT1,
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
+static unsigned int sdc4_sup_clk_rates[] = {
+	400000, 24000000, 48000000
+};
+
+static struct mmc_platform_data msm8960_sdc4_data = {
+	.ocr_mask       = MMC_VDD_165_195,
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+	.sup_clk_table  = sdc4_sup_clk_rates,
+	.sup_clk_cnt    = ARRAY_SIZE(sdc4_sup_clk_rates),
+	.vreg_data      = &mmc_slot_vreg_data[SDCC4],
+	.pin_data       = &mmc_slot_pin_data[SDCC4],
+	.sdiowakeup_irq = MSM_GPIO_TO_INT(85),
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+};
+#endif
+
+void __init jet_init_mmc(void)
+{
+#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
+	/*
+	 * When eMMC runs in DDR mode on CDP platform, we have
+	 * seen instability due to DATA CRC errors. These errors are
+	 * attributed to long physical path between MSM and eMMC on CDP.
+	 * So let's not enable the DDR mode on CDP platform but let other
+	 * platforms take advantage of eMMC DDR mode.
+	 */
+	if (!machine_is_msm8960_cdp())
+		msm8960_sdc1_data.uhs_caps |= (MMC_CAP_1_8V_DDR |
+					       MMC_CAP_UHS_DDR50);
+	/* SDC1 : eMMC card connected */
+	msm_add_sdcc(1, &msm8960_sdc1_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
+	/* SDC2: SDIO slot for WLAN*/
+	msm_add_sdcc(2, &msm8960_sdc2_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+	/* SDC3: External card slot */
+	msm_add_sdcc(3, &msm8960_sdc3_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
+	/* SDC4: SDIO slot for WLAN */
+	msm_add_sdcc(4, &msm8960_sdc4_data);
+#endif
+}
diff --git a/arch/arm/mach-msm/htc/jet/board-jet.c b/arch/arm/mach-msm/htc/jet/board-jet.c
new file mode 100644
index 0000000..397ac29
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/board-jet.c
@@ -0,0 +1,4141 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/i2c.h>
+#include <linux/i2c/sx150x.h>
+#include <linux/gpio.h>
+#include <linux/usb/android.h>
+#include <linux/msm_ssbi.h>
+#include <linux/pn544.h>
+#include <linux/regulator/msm-gpio-regulator.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/regulator/consumer.h>
+#include <linux/spi/spi.h>
+#include <linux/slimbus/slimbus.h>
+#include <linux/bootmem.h>
+#ifdef CONFIG_ANDROID_PMEM
+#include <linux/android_pmem.h>
+#endif
+#include <linux/synaptics_i2c_rmi.h>
+#include <linux/dma-contiguous.h>
+#include <linux/dma-mapping.h>
+#include <linux/platform_data/qcom_crypto_device.h>
+#include <linux/platform_data/qcom_wcnss_device.h>
+#include <linux/leds.h>
+#include <linux/leds-pm8xxx-htc.h>
+#include <linux/msm_tsens.h>
+#include <linux/proc_fs.h>
+#include <linux/cm3629.h>
+#include <linux/memblock.h>
+#include <linux/msm_thermal.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/setup.h>
+#include <asm/hardware/gic.h>
+#include <asm/mach/mmc.h>
+
+#include <mach/board.h>
+#include <mach/msm_iomap.h>
+#include <mach/msm_spi.h>
+#ifdef CONFIG_USB_MSM_OTG_72K
+#include <mach/msm_hsusb.h>
+#else
+#include <linux/usb/msm_hsusb.h>
+#endif
+#include <mach/usbdiag.h>
+#include <mach/socinfo.h>
+#include <mach/rpm.h>
+#include <mach/gpio.h>
+#include <mach/msm_bus_board.h>
+#include <mach/msm_memtypes.h>
+#include <mach/dma.h>
+#include <mach/msm_dsps.h>
+#include <mach/msm_xo.h>
+#include <mach/restart.h>
+#include <mach/panel_id.h>
+#ifdef CONFIG_WCD9310_CODEC
+#include <linux/slimbus/slimbus.h>
+#include <linux/mfd/wcd9xxx/core.h>
+#include <linux/mfd/wcd9xxx/pdata.h>
+#endif
+#include <linux/a1028.h>
+#include <linux/msm_ion.h>
+#include <mach/ion.h>
+
+#include <mach/msm_rtb.h>
+#include <mach/msm_cache_dump.h>
+#include <mach/scm.h>
+#include <mach/iommu_domains.h>
+
+#include <mach/kgsl.h>
+#include <linux/fmem.h>
+
+#include <linux/mpu.h>
+#include <linux/r3gd20.h>
+#include <linux/akm8975.h>
+#include <linux/bma250.h>
+#include <linux/ewtzmu2.h>
+#ifdef CONFIG_BT
+#include <mach/htc_bdaddress.h>
+#endif
+#include <mach/htc_headset_mgr.h>
+#include <mach/htc_headset_pmic.h>
+#include <mach/cable_detect.h>
+
+#include "timer.h"
+#include "devices.h"
+#include "devices-msm8x60.h"
+#include "spm.h"
+#include "board-jet.h"
+#include "pm.h"
+#include <mach/cpuidle.h>
+#include "rpm_resources.h"
+#include <mach/mpm.h>
+#include "acpuclock.h"
+#include "rpm_log.h"
+#include "smd_private.h"
+#include "pm-boot.h"
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+#include <mach/mhl.h>
+#endif
+
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#include <linux/htc_flashlight.h>
+#endif
+#include <mach/board_htc.h>
+#ifdef CONFIG_HTC_BATT_8960
+#include "mach/htc_battery_8960.h"
+#include "mach/htc_battery_cell.h"
+#include "linux/mfd/pm8xxx/pm8921-charger-htc.h"
+#endif
+
+#ifdef CONFIG_PERFLOCK
+#include <mach/perflock.h>
+#endif
+
+extern unsigned int engineerid; // bit 0
+
+#define HW_VER_ID_VIRT		(MSM_TLMM_BASE + 0x00002054)
+
+unsigned skuid;
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+static void config_flashlight_gpios(void)
+{
+	static uint32_t flashlight_gpio_table[] = {
+		GPIO_CFG(32, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+		GPIO_CFG(33, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	};
+
+	gpio_tlmm_config(flashlight_gpio_table[0], GPIO_CFG_ENABLE);
+	gpio_tlmm_config(flashlight_gpio_table[1], GPIO_CFG_ENABLE);
+}
+
+static struct TPS61310_flashlight_platform_data jet_flashlight_data = {
+	.gpio_init = config_flashlight_gpios,
+	.tps61310_strb0 = 33,
+	.tps61310_strb1 = 32,
+	.led_count = 1,
+	.flash_duration_ms = 600,
+};
+
+static struct i2c_board_info i2c_tps61310_flashlight[] = {
+	{
+		I2C_BOARD_INFO("TPS61310_FLASHLIGHT", 0x66 >> 1),
+		.platform_data = &jet_flashlight_data,
+	},
+};
+#endif
+#endif
+
+static struct platform_device msm_fm_platform_init = {
+	.name = "iris_fm",
+	.id   = -1,
+};
+
+#if 0
+#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
+enum {
+	GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
+	GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
+	/* CAM Expander */
+	GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
+	GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
+	GPIO_CAM_GP_AFBUSY,
+	GPIO_CAM_GP_STROBE_CE,
+	GPIO_CAM_GP_CAM1MP_XCLR,
+	GPIO_CAM_GP_CAMIF_RESET_N,
+	GPIO_CAM_GP_XMT_FLASH_INT,
+	GPIO_CAM_GP_LED_EN1,
+	GPIO_CAM_GP_LED_EN2,
+
+};
+#endif
+#endif
+
+#ifdef CONFIG_I2C
+
+#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
+#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
+#define MSM_8960_GSBI8_QUP_I2C_BUS_ID 8
+#define MSM_8960_GSBI12_QUP_I2C_BUS_ID 12
+
+#endif
+
+#define MSM_PMEM_ADSP_SIZE         0x6D00000
+#define MSM_PMEM_AUDIO_SIZE        0x4CF000
+#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
+#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
+#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
+
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+#define HOLE_SIZE	0x20000
+#define MSM_CONTIG_MEM_SIZE  0x65000
+#ifdef CONFIG_MSM_IOMMU
+#define MSM_ION_MM_SIZE            0x3800000 /* Need to be multiple of 64K */
+#define MSM_ION_SF_SIZE            0x0
+#define MSM_ION_QSECOM_SIZE        0x780000 /* (7.5MB) */
+#define MSM_ION_HEAP_NUM	7
+#else
+#define MSM_ION_MM_SIZE            MSM_PMEM_ADSP_SIZE
+#define MSM_ION_SF_SIZE            MSM_PMEM_SIZE
+#define MSM_ION_QSECOM_SIZE        0x600000 /* (6MB) */
+#define MSM_ION_HEAP_NUM	8
+#endif
+#define MSM_ION_MM_FW_SIZE	(0x200000 - HOLE_SIZE) /* 128kb */
+#define MSM_ION_MFC_SIZE	SZ_8K
+#define MSM_ION_AUDIO_SIZE	MSM_PMEM_AUDIO_SIZE
+
+#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
+#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
+#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
+
+#define MSM_MM_FW_SIZE		(0x200000 - HOLE_SIZE) /* 2mb -128kb*/
+#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
+							HOLE_SIZE))
+#define MAX_FIXED_AREA_SIZE	0x10000000
+#define MSM8960_FW_START	MSM8960_FIXED_AREA_START
+#define MSM_ION_ADSP_SIZE	SZ_8M
+#else
+#define MSM_CONTIG_MEM_SIZE  0x110C000
+#define MSM_ION_HEAP_NUM	1
+#endif
+
+static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
+#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
+static int __init msm_contig_mem_size_setup(char *p)
+{
+	msm_contig_mem_size = memparse(p, NULL);
+	return 0;
+}
+early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
+#endif
+
+#ifdef CONFIG_ANDROID_PMEM
+static unsigned pmem_size = MSM_PMEM_SIZE;
+static unsigned pmem_param_set = 0;
+static int __init pmem_size_setup(char *p)
+{
+	pmem_size = memparse(p, NULL);
+	pmem_param_set = 1;
+	return 0;
+}
+early_param("pmem_size", pmem_size_setup);
+
+static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
+
+static int __init pmem_adsp_size_setup(char *p)
+{
+	pmem_adsp_size = memparse(p, NULL);
+	return 0;
+}
+early_param("pmem_adsp_size", pmem_adsp_size_setup);
+
+static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
+
+static int __init pmem_audio_size_setup(char *p)
+{
+	pmem_audio_size = memparse(p, NULL);
+	return 0;
+}
+early_param("pmem_audio_size", pmem_audio_size_setup);
+#endif
+
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+static struct android_pmem_platform_data android_pmem_pdata = {
+	.name = "pmem",
+	.allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
+	.cached = 1,
+	.memory_type = MEMTYPE_EBI1,
+};
+
+static struct platform_device android_pmem_device = {
+	.name = "android_pmem",
+	.id = 0,
+	.dev = {.platform_data = &android_pmem_pdata},
+};
+
+static struct android_pmem_platform_data android_pmem_adsp_pdata = {
+	.name = "pmem_adsp",
+	.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
+	.cached = 0,
+	.memory_type = MEMTYPE_EBI1,
+};
+
+static struct platform_device android_pmem_adsp_device = {
+	.name = "android_pmem",
+	.id = 2,
+	.dev = { .platform_data = &android_pmem_adsp_pdata },
+};
+
+static struct android_pmem_platform_data android_pmem_audio_pdata = {
+	.name = "pmem_audio",
+	.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
+	.cached = 0,
+	.memory_type = MEMTYPE_EBI1,
+};
+
+static struct platform_device android_pmem_audio_device = {
+	.name = "android_pmem",
+	.id = 4,
+	.dev = { .platform_data = &android_pmem_audio_pdata },
+};
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+
+struct fmem_platform_data msm8960_fmem_pdata = {
+};
+
+static struct memtype_reserve msm8960_reserve_table[] __initdata = {
+	[MEMTYPE_SMI] = {
+	},
+	[MEMTYPE_EBI0] = {
+		.flags	=	MEMTYPE_FLAGS_1M_ALIGN,
+	},
+	[MEMTYPE_EBI1] = {
+		.flags	=	MEMTYPE_FLAGS_1M_ALIGN,
+	},
+};
+
+#if defined(CONFIG_MSM_RTB)
+static struct msm_rtb_platform_data msm_rtb_pdata = {
+	.size = SZ_1K,
+};
+
+static int __init msm_rtb_set_buffer_size(char *p)
+{
+	int s;
+
+	s = memparse(p, NULL);
+	msm_rtb_pdata.size = ALIGN(s, SZ_4K);
+	return 0;
+}
+early_param("msm_rtb_size", msm_rtb_set_buffer_size);
+
+static struct platform_device msm_rtb_device = {
+	.name           = "msm_rtb",
+	.id             = -1,
+	.dev            = {
+		.platform_data = &msm_rtb_pdata,
+	},
+};
+#endif
+
+static void __init reserve_rtb_memory(void)
+{
+#if defined(CONFIG_MSM_RTB)
+	msm8960_reserve_table[MEMTYPE_EBI1].size += msm_rtb_pdata.size;
+#endif
+}
+
+static void __init size_pmem_devices(void)
+{
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	android_pmem_adsp_pdata.size = pmem_adsp_size;
+
+	if (!pmem_param_set && machine_is_msm8960_liquid())
+		pmem_size = MSM_LIQUID_PMEM_SIZE;
+	android_pmem_pdata.size = pmem_size;
+
+	android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+}
+
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+static void __init reserve_memory_for(struct android_pmem_platform_data *p)
+{
+	msm8960_reserve_table[p->memory_type].size += p->size;
+}
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+
+static void __init reserve_pmem_memory(void)
+{
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	reserve_memory_for(&android_pmem_adsp_pdata);
+	reserve_memory_for(&android_pmem_pdata);
+	reserve_memory_for(&android_pmem_audio_pdata);
+#endif
+	msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
+#endif
+}
+
+static int msm8960_paddr_to_memtype(unsigned int paddr)
+{
+	return MEMTYPE_EBI1;
+}
+
+#define FMEM_ENABLED 0
+
+#ifdef CONFIG_ION_MSM
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
+	.permission_type = IPT_TYPE_MM_CARVEOUT,
+	.align = PAGE_SIZE,
+	.reusable = FMEM_ENABLED,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_MIDDLE,
+	.iommu_map_all = 1,
+	.iommu_2x_map_domain = VIDEO_DOMAIN,
+#ifdef CONFIG_CMA
+	.is_cma = 1,
+#endif
+};
+
+static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
+	.permission_type = IPT_TYPE_MFC_SHAREDMEM,
+	.align = PAGE_SIZE,
+	.reusable = 0,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_HIGH,
+};
+
+static struct ion_co_heap_pdata co_ion_pdata = {
+	.adjacent_mem_id = INVALID_HEAP_ID,
+	.align = PAGE_SIZE,
+	.mem_is_fmem = 0,
+};
+
+static struct ion_co_heap_pdata fw_co_ion_pdata = {
+	.adjacent_mem_id = ION_CP_MM_HEAP_ID,
+	.align = SZ_128K,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_LOW,
+};
+#endif
+
+static u64 msm_dmamask = DMA_BIT_MASK(32);
+
+static struct platform_device ion_mm_heap_device = {
+	.name = "ion-mm-heap-device",
+	.id = -1,
+	.dev = {
+		.dma_mask = &msm_dmamask,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	}
+};
+
+#ifdef CONFIG_CMA
+static struct platform_device ion_adsp_heap_device = {
+	.name = "ion-adsp-heap-device",
+	.id = -1,
+	.dev = {
+		.dma_mask = &msm_dmamask,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	}
+};
+#endif
+
+/**
+ * These heaps are listed in the order they will be allocated. Due to
+ * video hardware restrictions and content protection the FW heap has to
+ * be allocated adjacent (below) the MM heap and the MFC heap has to be
+ * allocated after the MM heap to ensure MFC heap is not more than 256MB
+ * away from the base address of the FW heap.
+ * However, the order of FW heap and MM heap doesn't matter since these
+ * two heaps are taken care of by separate code to ensure they are adjacent
+ * to each other.
+ * Don't swap the order unless you know what you are doing!
+ */
+struct ion_platform_heap msm8960_heaps[] = {
+		{
+			.id	= ION_SYSTEM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_SYSTEM,
+			.name	= ION_VMALLOC_HEAP_NAME,
+		},
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+		{
+			.id	= ION_CP_MM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CP,
+			.name	= ION_MM_HEAP_NAME,
+			.size	= MSM_ION_MM_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &cp_mm_ion_pdata,
+			.priv	= &ion_mm_heap_device.dev
+		},
+		{
+			.id	= ION_MM_FIRMWARE_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_MM_FIRMWARE_HEAP_NAME,
+			.size	= MSM_ION_MM_FW_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &fw_co_ion_pdata,
+		},
+		{
+			.id	= ION_CP_MFC_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CP,
+			.name	= ION_MFC_HEAP_NAME,
+			.size	= MSM_ION_MFC_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &cp_mfc_ion_pdata,
+		},
+#ifndef CONFIG_MSM_IOMMU
+		{
+			.id	= ION_SF_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_SF_HEAP_NAME,
+			.size	= MSM_ION_SF_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+#endif
+		{
+			.id	= ION_IOMMU_HEAP_ID,
+			.type	= ION_HEAP_TYPE_IOMMU,
+			.name	= ION_IOMMU_HEAP_NAME,
+		},
+		{
+			.id	= ION_QSECOM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_QSECOM_HEAP_NAME,
+			.size	= MSM_ION_QSECOM_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+		{
+			.id	= ION_AUDIO_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_AUDIO_HEAP_NAME,
+			.size	= MSM_ION_AUDIO_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+#ifdef CONFIG_CMA
+		{
+			.id	= ION_ADSP_HEAP_ID,
+			.type	= ION_HEAP_TYPE_DMA,
+			.name	= ION_ADSP_HEAP_NAME,
+			.size	= MSM_ION_ADSP_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+			.priv	= &ion_adsp_heap_device.dev,
+		},
+#endif
+#endif
+};
+
+static struct ion_platform_data msm8960_ion_pdata = {
+	.nr = MSM_ION_HEAP_NUM,
+	.heaps = msm8960_heaps,
+};
+
+static struct platform_device ion_dev = {
+	.name = "ion-msm",
+	.id = 1,
+	.dev = { .platform_data = &msm8960_ion_pdata },
+};
+#endif
+
+struct platform_device fmem_device = {
+	.name = "fmem",
+	.id = 1,
+	.dev = { .platform_data = &msm8960_fmem_pdata },
+};
+
+static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
+				      unsigned long size)
+{
+	msm8960_reserve_table[MEMTYPE_EBI1].size += size;
+}
+
+static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
+{
+#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	int ret;
+
+	if (fixed_area_size > MAX_FIXED_AREA_SIZE)
+		panic("fixed area size is larger than %dM\n",
+			MAX_FIXED_AREA_SIZE >> 20);
+
+	reserve_info->fixed_area_size = fixed_area_size;
+	reserve_info->fixed_area_start = MSM8960_FW_START;
+
+	ret = memblock_remove(reserve_info->fixed_area_start,
+		reserve_info->fixed_area_size);
+	BUG_ON(ret);
+#endif
+}
+
+/**
+ * Reserve memory for ION and calculate amount of reusable memory for fmem.
+ * We only reserve memory for heaps that are not reusable. However, we only
+ * support one reusable heap at the moment so we ignore the reusable flag for
+ * other than the first heap with reusable flag set. Also handle special case
+ * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
+ * at a higher address than FW in addition to not more than 256MB away from the
+ * base address of the firmware. This means that if MM is reusable the other
+ * two heaps must be allocated in the same region as FW. This is handled by the
+ * mem_is_fmem flag in the platform data. In addition the MM heap must be
+ * adjacent to the FW heap for content protection purposes.
+ */
+static void __init reserve_ion_memory(void)
+{
+#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	unsigned int i;
+	int ret;
+	unsigned int fixed_size = 0;
+	unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
+	unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
+	unsigned long cma_alignment;
+	unsigned int low_use_cma = 0;
+	unsigned int middle_use_cma = 0;
+	unsigned int high_use_cma = 0;
+
+	fixed_low_size = 0;
+	fixed_middle_size = 0;
+	fixed_high_size = 0;
+
+	cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
+
+	for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
+		struct ion_platform_heap *heap =
+						&(msm8960_ion_pdata.heaps[i]);
+		int align = SZ_4K;
+		int iommu_map_all = 0;
+		int adjacent_mem_id = INVALID_HEAP_ID;
+		int use_cma = 0;
+
+		if (heap->extra_data) {
+			int fixed_position = NOT_FIXED;
+
+			switch ((int) heap->type) {
+			case ION_HEAP_TYPE_CP:
+				fixed_position = ((struct ion_cp_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				align = ((struct ion_cp_heap_pdata *)
+						heap->extra_data)->align;
+				iommu_map_all =
+					((struct ion_cp_heap_pdata *)
+					heap->extra_data)->iommu_map_all;
+				if (((struct ion_cp_heap_pdata *)
+					heap->extra_data)->is_cma) {
+					heap->size = ALIGN(heap->size,
+							cma_alignment);
+					use_cma = 1;
+				}
+				break;
+			case ION_HEAP_TYPE_DMA:
+					use_cma = 1;
+				/* Purposely fall through here */
+			case ION_HEAP_TYPE_CARVEOUT:
+				fixed_position = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				adjacent_mem_id = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->adjacent_mem_id;
+				break;
+			default:
+				break;
+			}
+
+			if (iommu_map_all) {
+				if (heap->size & (SZ_64K-1)) {
+					heap->size = ALIGN(heap->size, SZ_64K);
+					pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
+						heap->name, heap->size);
+				}
+			}
+
+			if (fixed_position != NOT_FIXED)
+				fixed_size += heap->size;
+			else
+				reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
+
+			if (fixed_position == FIXED_LOW) {
+				fixed_low_size += heap->size;
+				low_use_cma = use_cma;
+			} else if (fixed_position == FIXED_MIDDLE) {
+				fixed_middle_size += heap->size;
+				middle_use_cma = use_cma;
+			} else if (fixed_position == FIXED_HIGH) {
+				fixed_high_size += heap->size;
+				high_use_cma = use_cma;
+			} else if (use_cma) {
+				/*
+				 * Heaps that use CMA but are not part of the
+				 * fixed set. Create wherever.
+				 */
+				dma_declare_contiguous(
+					heap->priv,
+					heap->size,
+					0,
+					0xb0000000);
+			}
+		}
+	}
+
+	if (!fixed_size)
+		return;
+
+	/*
+	 * Given the setup for the fixed area, we can't round up all sizes.
+	 * Some sizes must be set up exactly and aligned correctly. Incorrect
+	 * alignments are considered a configuration issue
+	 */
+
+	fixed_low_start = MSM8960_FIXED_AREA_START;
+	if (low_use_cma) {
+		BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
+		BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
+	} else {
+		BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
+		ret = memblock_remove(fixed_low_start,
+				      fixed_low_size + HOLE_SIZE);
+		BUG_ON(ret);
+	}
+
+	fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
+	if (middle_use_cma) {
+		BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
+		BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
+	} else {
+		BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
+		ret = memblock_remove(fixed_middle_start, fixed_middle_size);
+		BUG_ON(ret);
+	}
+
+	fixed_high_start = fixed_middle_start + fixed_middle_size;
+	if (high_use_cma) {
+		fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
+		BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
+	} else {
+		/* This is the end of the fixed area so it's okay to round up */
+		fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
+		ret = memblock_remove(fixed_high_start, fixed_high_size);
+		BUG_ON(ret);
+	}
+
+
+
+	for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
+		struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
+
+		if (heap->extra_data) {
+			int fixed_position = NOT_FIXED;
+			struct ion_cp_heap_pdata *pdata = NULL;
+
+			switch ((int) heap->type) {
+			case ION_HEAP_TYPE_CP:
+				pdata =
+				(struct ion_cp_heap_pdata *)heap->extra_data;
+				fixed_position = pdata->fixed_position;
+				break;
+			case ION_HEAP_TYPE_CARVEOUT:
+			case ION_HEAP_TYPE_DMA:
+				fixed_position = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				break;
+			default:
+				break;
+			}
+
+			switch (fixed_position) {
+			case FIXED_LOW:
+				heap->base = fixed_low_start;
+				break;
+			case FIXED_MIDDLE:
+				heap->base = fixed_middle_start;
+				if (middle_use_cma) {
+					ret = dma_declare_contiguous(
+						&ion_mm_heap_device.dev,
+						heap->size,
+						fixed_middle_start,
+						0xa0000000);
+					WARN_ON(ret);
+				}
+				pdata->secure_base = fixed_middle_start
+							- HOLE_SIZE;
+				pdata->secure_size = HOLE_SIZE + heap->size;
+				break;
+			case FIXED_HIGH:
+				heap->base = fixed_high_start;
+				break;
+			default:
+				break;
+			}
+		}
+	}
+#endif
+}
+
+static void __init reserve_mdp_memory(void)
+{
+	msm8960_mdp_writeback(msm8960_reserve_table);
+}
+
+#if defined(CONFIG_MSM_CACHE_DUMP)
+static struct msm_cache_dump_platform_data msm_cache_dump_pdata = {
+	.l2_size = L2_BUFFER_SIZE,
+};
+
+static struct platform_device msm_cache_dump_device = {
+	.name		= "msm_cache_dump",
+	.id		= -1,
+	.dev		= {
+		.platform_data = &msm_cache_dump_pdata,
+	},
+};
+#endif
+
+static void reserve_cache_dump_memory(void)
+{
+#ifdef CONFIG_MSM_CACHE_DUMP
+	unsigned int spare;
+	unsigned int l1_size;
+	unsigned int total;
+	int ret;
+
+	ret = scm_call(L1C_SERVICE_ID, L1C_BUFFER_GET_SIZE_COMMAND_ID, &spare,
+		sizeof(spare), &l1_size, sizeof(l1_size));
+
+	if (ret)
+		/* Fall back to something reasonable here */
+		l1_size = L1_BUFFER_SIZE;
+
+	total = l1_size + L2_BUFFER_SIZE;
+
+	msm8960_reserve_table[MEMTYPE_EBI1].size += total;
+	msm_cache_dump_pdata.l1_size = l1_size;
+#endif
+}
+
+static void __init msm8960_calculate_reserve_sizes(void)
+{
+	size_pmem_devices();
+	reserve_pmem_memory();
+	reserve_ion_memory();
+	reserve_mdp_memory();
+	reserve_rtb_memory();
+	reserve_cache_dump_memory();
+}
+
+static struct reserve_info msm8960_reserve_info __initdata = {
+	.memtype_reserve_table = msm8960_reserve_table,
+	.calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
+	.reserve_fixed_area = msm8960_reserve_fixed_area,
+	.paddr_to_memtype = msm8960_paddr_to_memtype,
+};
+
+static void __init jet_early_memory(void)
+{
+	reserve_info = &msm8960_reserve_info;
+}
+
+static void __init jet_reserve(void)
+{
+	msm_reserve();
+}
+
+static void __init msm8960_allocate_memory_regions(void)
+{
+	msm8960_allocate_fb_region();
+}
+
+#ifdef CONFIG_WCD9310_CODEC
+
+#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
+
+/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
+ * 4 micbiases are used to power various analog and digital
+ * microphones operating at 1800 mV. Technically, all micbiases
+ * can source from single cfilter since all microphones operate
+ * at the same voltage level. The arrangement below is to make
+ * sure all cfilters are exercised. LDO_H regulator ouput level
+ * does not need to be as high as 2.85V. It is choosen for
+ * microphone sensitivity purpose.
+ */
+static struct wcd9xxx_pdata tabla_platform_data = {
+	.slimbus_slave_device = {
+		.name = "tabla-slave",
+		.e_addr = {0, 0, 0x10, 0, 0x17, 2},
+	},
+	.irq = MSM_GPIO_TO_INT(62),
+	.irq_base = TABLA_INTERRUPT_BASE,
+	.num_irqs = NR_TABLA_IRQS,
+	.reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
+	.micbias = {
+		.ldoh_v = TABLA_LDOH_2P85_V,
+		.cfilt1_mv = 1800,
+		.cfilt2_mv = 1800,
+		.cfilt3_mv = 1800,
+		.bias1_cfilt_sel = TABLA_CFILT1_SEL,
+		.bias2_cfilt_sel = TABLA_CFILT2_SEL,
+		.bias3_cfilt_sel = TABLA_CFILT3_SEL,
+		.bias4_cfilt_sel = TABLA_CFILT3_SEL,
+	},
+	.regulator = {
+	{
+		.name = "CDC_VDD_CP",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_RX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_TX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
+	},
+	{
+		.name = "VDDIO_CDC",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
+	},
+	{
+		.name = "VDDD_CDC_D",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_A_1P2V",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
+	},
+	},
+};
+
+static struct slim_device msm_slim_tabla = {
+	.name = "tabla-slim",
+	.e_addr = {0, 1, 0x10, 0, 0x17, 2},
+	.dev = {
+		.platform_data = &tabla_platform_data,
+	},
+};
+static struct wcd9xxx_pdata tabla20_platform_data = {
+	.slimbus_slave_device = {
+		.name = "tabla-slave",
+		.e_addr = {0, 0, 0x60, 0, 0x17, 2},
+	},
+	.irq = MSM_GPIO_TO_INT(62),
+	.irq_base = TABLA_INTERRUPT_BASE,
+	.num_irqs = NR_TABLA_IRQS,
+	.reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
+	.amic_settings = {
+		.legacy_mode = 0x7F,
+		.use_pdata = 0x7F,
+	},
+	.micbias = {
+		.ldoh_v = TABLA_LDOH_2P85_V,
+		.cfilt1_mv = 1800,
+		.cfilt2_mv = 1800,
+		.cfilt3_mv = 1800,
+		.bias1_cfilt_sel = TABLA_CFILT1_SEL,
+		.bias2_cfilt_sel = TABLA_CFILT2_SEL,
+		.bias3_cfilt_sel = TABLA_CFILT3_SEL,
+		.bias4_cfilt_sel = TABLA_CFILT3_SEL,
+	},
+	.regulator = {
+	{
+		.name = "CDC_VDD_CP",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_RX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_TX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
+	},
+	{
+		.name = "VDDIO_CDC",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
+	},
+	{
+		.name = "VDDD_CDC_D",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_A_1P2V",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
+	},
+	},
+};
+
+static struct slim_device msm_slim_tabla20 = {
+	.name = "tabla2x-slim",
+	.e_addr = {0, 1, 0x60, 0, 0x17, 2},
+	.dev = {
+		.platform_data = &tabla20_platform_data,
+	},
+};
+#endif
+
+static struct slim_boardinfo msm_slim_devices[] = {
+#ifdef CONFIG_WCD9310_CODEC
+	{
+		.bus_num = 1,
+		.slim_slave = &msm_slim_tabla,
+	},
+	{
+		.bus_num = 1,
+		.slim_slave = &msm_slim_tabla20,
+	},
+#endif
+	/* add more slimbus slaves as needed */
+};
+
+#define MSM_WCNSS_PHYS	0x03000000
+#define MSM_WCNSS_SIZE	0x280000
+
+static struct resource resources_wcnss_wlan[] = {
+	{
+		.start	= RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
+		.end	= RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
+		.name	= "wcnss_wlanrx_irq",
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
+		.end	= RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
+		.name	= "wcnss_wlantx_irq",
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= MSM_WCNSS_PHYS,
+		.end	= MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
+		.name	= "wcnss_mmio",
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= 84,
+		.end	= 88,
+		.name	= "wcnss_gpios_5wire",
+		.flags	= IORESOURCE_IO,
+	},
+};
+
+static struct qcom_wcnss_opts qcom_wcnss_pdata = {
+	.has_48mhz_xo = 1,
+};
+
+static struct platform_device msm_device_wcnss_wlan = {
+	.name		= "wcnss_wlan",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(resources_wcnss_wlan),
+	.resource	= resources_wcnss_wlan,
+	.dev		= {.platform_data = &qcom_wcnss_pdata},
+};
+
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+
+#define QCE_SIZE		0x10000
+#define QCE_0_BASE		0x18500000
+
+#define QCE_HW_KEY_SUPPORT	0
+#define QCE_SHA_HMAC_SUPPORT	1
+#define QCE_SHARE_CE_RESOURCE	1
+#define QCE_CE_SHARED		0
+
+/* Begin Bus scaling definitions */
+static struct msm_bus_vectors crypto_hw_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT1,
+		.dst = MSM_BUS_SLAVE_GSBI1_UART,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+
+static struct msm_bus_vectors crypto_hw_active_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 70000000UL,
+		.ib = 70000000UL,
+	},
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT1,
+		.dst = MSM_BUS_SLAVE_GSBI1_UART,
+		.ab = 2480000000UL,
+		.ib = 2480000000UL,
+	},
+};
+
+static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(crypto_hw_init_vectors),
+		crypto_hw_init_vectors,
+	},
+	{
+		ARRAY_SIZE(crypto_hw_active_vectors),
+		crypto_hw_active_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
+	crypto_hw_bus_scale_usecases,
+	ARRAY_SIZE(crypto_hw_bus_scale_usecases),
+	.name = "cryptohw",
+};
+/* End Bus Scaling Definitions*/
+
+static struct resource qcrypto_resources[] = {
+	[0] = {
+		.start = QCE_0_BASE,
+		.end = QCE_0_BASE + QCE_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.name = "crypto_channels",
+		.start = DMOV_CE_IN_CHAN,
+		.end = DMOV_CE_OUT_CHAN,
+		.flags = IORESOURCE_DMA,
+	},
+	[2] = {
+		.name = "crypto_crci_in",
+		.start = DMOV_CE_IN_CRCI,
+		.end = DMOV_CE_IN_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+	[3] = {
+		.name = "crypto_crci_out",
+		.start = DMOV_CE_OUT_CRCI,
+		.end = DMOV_CE_OUT_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+};
+
+static struct resource qcedev_resources[] = {
+	[0] = {
+		.start = QCE_0_BASE,
+		.end = QCE_0_BASE + QCE_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.name = "crypto_channels",
+		.start = DMOV_CE_IN_CHAN,
+		.end = DMOV_CE_OUT_CHAN,
+		.flags = IORESOURCE_DMA,
+	},
+	[2] = {
+		.name = "crypto_crci_in",
+		.start = DMOV_CE_IN_CRCI,
+		.end = DMOV_CE_IN_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+	[3] = {
+		.name = "crypto_crci_out",
+		.start = DMOV_CE_OUT_CRCI,
+		.end = DMOV_CE_OUT_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+};
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
+
+static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
+	.ce_shared = QCE_CE_SHARED,
+	.shared_ce_resource = QCE_SHARE_CE_RESOURCE,
+	.hw_key_support = QCE_HW_KEY_SUPPORT,
+	.sha_hmac = QCE_SHA_HMAC_SUPPORT,
+	.bus_scale_table = &crypto_hw_bus_scale_pdata,
+};
+
+static struct platform_device qcrypto_device = {
+	.name		= "qcrypto",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(qcrypto_resources),
+	.resource	= qcrypto_resources,
+	.dev		= {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data = &qcrypto_ce_hw_suppport,
+	},
+};
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+
+static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
+	.ce_shared = QCE_CE_SHARED,
+	.shared_ce_resource = QCE_SHARE_CE_RESOURCE,
+	.hw_key_support = QCE_HW_KEY_SUPPORT,
+	.sha_hmac = QCE_SHA_HMAC_SUPPORT,
+	.bus_scale_table = &crypto_hw_bus_scale_pdata,
+};
+
+static struct platform_device qcedev_device = {
+	.name		= "qce",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(qcedev_resources),
+	.resource	= qcedev_resources,
+	.dev		= {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data = &qcedev_ce_hw_suppport,
+	},
+};
+#endif
+
+#ifdef CONFIG_HTC_BATT_8960
+static struct htc_battery_platform_data htc_battery_pdev_data = {
+	.guage_driver = 0,
+	.chg_limit_active_mask = HTC_BATT_CHG_LIMIT_BIT_TALK |
+								HTC_BATT_CHG_LIMIT_BIT_NAVI,
+	.critical_low_voltage_mv = 3200,
+	.critical_alarm_voltage_mv = 3000,
+	.overload_vol_thr_mv = 4000,
+	.overload_curr_thr_ma = 0,
+	/* charger */
+	.icharger.name = "pm8921",
+	.icharger.get_charging_source = pm8921_get_charging_source,
+	.icharger.get_charging_enabled = pm8921_get_charging_enabled,
+	.icharger.set_charger_enable = pm8921_charger_enable,
+	.icharger.set_pwrsrc_enable = pm8921_pwrsrc_enable,
+	.icharger.set_pwrsrc_and_charger_enable =
+						pm8921_set_pwrsrc_and_charger_enable,
+	.icharger.set_limit_charge_enable = pm8921_limit_charge_enable,
+	.icharger.is_ovp = pm8921_is_charger_ovp,
+	.icharger.is_batt_temp_fault_disable_chg =
+						pm8921_is_batt_temp_fault_disable_chg,
+	.icharger.charger_change_notifier_register =
+						cable_detect_register_notifier,
+	.icharger.dump_all = pm8921_dump_all,
+	.icharger.get_attr_text = pm8921_charger_get_attr_text,
+	/* gauge */
+	.igauge.name = "pm8921",
+	.igauge.get_battery_voltage = pm8921_get_batt_voltage,
+	.igauge.get_battery_current = pm8921_bms_get_batt_current,
+	.igauge.get_battery_temperature = pm8921_get_batt_temperature,
+	.igauge.get_battery_id = pm8921_get_batt_id,
+	.igauge.get_battery_soc = pm8921_bms_get_batt_soc,
+	.igauge.get_battery_cc = pm8921_bms_get_batt_cc,
+	.igauge.is_battery_temp_fault = pm8921_is_batt_temperature_fault,
+	.igauge.is_battery_full = pm8921_is_batt_full,
+	.igauge.get_attr_text = pm8921_gauge_get_attr_text,
+	.igauge.register_lower_voltage_alarm_notifier =
+						pm8xxx_batt_lower_alarm_register_notifier,
+	.igauge.enable_lower_voltage_alarm = pm8xxx_batt_lower_alarm_enable,
+	.igauge.set_lower_voltage_alarm_threshold =
+						pm8xxx_batt_lower_alarm_threshold_set,
+};
+
+static struct platform_device htc_battery_pdev = {
+	.name = "htc_battery",
+	.id = -1,
+	.dev    = {
+		.platform_data = &htc_battery_pdev_data,
+	},
+};
+#endif /* CONFIG_HTC_BATT_8960 */
+
+/* HTC_HEADSET_PMIC Driver */
+static struct htc_headset_pmic_platform_data htc_headset_pmic_data = {
+	.driver_flag		= DRIVER_HS_PMIC_ADC,
+	.hpin_gpio		= PM8921_GPIO_PM_TO_SYS(
+					JET_GPIO_EARPHONE_DETz),
+	.hpin_irq		= 0,
+	.key_gpio		= PM8921_GPIO_PM_TO_SYS(
+					JET_GPIO_PM_AUD_REMO_PRESz),
+	.key_irq		= 0,
+	.key_enable_gpio	= 0,
+	.adc_mic		= 0,
+	.adc_remote		= {0, 57, 58, 147, 148, 339},
+	.adc_mpp		= PM8XXX_AMUX_MPP_10,
+	.adc_amux		= ADC_MPP_1_AMUX6,
+	.hs_controller		= 0,
+	.hs_switch		= 0,
+};
+
+static struct platform_device htc_headset_pmic = {
+	.name	= "HTC_HEADSET_PMIC",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &htc_headset_pmic_data,
+	},
+};
+
+/* HTC_HEADSET_MGR Driver */
+static struct platform_device *headset_devices[] = {
+	&htc_headset_pmic,
+	/* Please put the headset detection driver on the last */
+};
+
+static struct headset_adc_config htc_headset_mgr_config[] = {
+	{
+		.type = HEADSET_MIC,
+		.adc_max = 1530,
+		.adc_min = 1223,
+	},
+	{
+		.type = HEADSET_BEATS,
+		.adc_max = 1222,
+		.adc_min = 916,
+	},
+	{
+		.type = HEADSET_BEATS_SOLO,
+		.adc_max = 915,
+		.adc_min = 566,
+	},
+	{
+		.type = HEADSET_METRICO, /* For MOS test */
+		.adc_max = 565,
+		.adc_min = 255,
+	},
+	{
+		.type = HEADSET_NO_MIC,
+		.adc_max = 254,
+		.adc_min = 0,
+	},
+};
+
+static struct htc_headset_mgr_platform_data htc_headset_mgr_data = {
+	.driver_flag		= DRIVER_HS_MGR_FLOAT_DET,
+	.headset_devices_num	= ARRAY_SIZE(headset_devices),
+	.headset_devices	= headset_devices,
+	.headset_config_num	= ARRAY_SIZE(htc_headset_mgr_config),
+	.headset_config		= htc_headset_mgr_config,
+};
+
+static struct platform_device htc_headset_mgr = {
+	.name	= "HTC_HEADSET_MGR",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &htc_headset_mgr_data,
+	},
+};
+
+static void headset_device_register(void)
+{
+	pr_info("[HS_BOARD] (%s) Headset device register\n", __func__);
+
+	platform_device_register(&htc_headset_mgr);
+}
+
+static struct synaptics_i2c_rmi_platform_data syn_ts_3k_data[] = { 
+	{
+		.version = 0x3332,
+		.packrat_number = 1293981,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1750,
+		.display_width = 720,
+		.display_height = 1280,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.tw_pin_mask = 0x0088,
+		.sensor_id = SENSOR_ID_CHECKING_EN | 0x88,
+		.config = {0x33, 0x32, 0x31, 0x01, 0x00, 0x7F, 0x03, 0x1E,
+			0x05, 0x09, 0x00, 0x01, 0x01, 0x00, 0x10, 0x4C,
+			0x04, 0x6C, 0x07, 0x02, 0x14, 0x32, 0x05, 0x50,
+			0x78, 0x20, 0x96, 0x02, 0x01, 0x3C, 0x17, 0x01,
+			0x1A, 0x01, 0xFC, 0x48, 0x55, 0x4B, 0xD6, 0xB5,
+			0x6B, 0xBC, 0x00, 0xD0, 0x00, 0x00, 0x00, 0x00,
+			0x0A, 0x04, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x19, 0x01, 0x00, 0x0A, 0x18, 0x0D, 0x0A,
+			0x00, 0x14, 0x0A, 0x40, 0x64, 0x07, 0x66, 0x64,
+			0xC0, 0x43, 0x2A, 0x05, 0x00, 0x00, 0x00, 0x00,
+			0x4C, 0x6C, 0x74, 0x3C, 0x32, 0x00, 0x00, 0x00,
+			0x4C, 0x6C, 0x74, 0x1E, 0x05, 0x00, 0x02, 0x34,
+			0x01, 0x80, 0x03, 0x0E, 0x1F, 0x11, 0x6A, 0x00,
+			0x13, 0x04, 0x1B, 0x00, 0x10, 0x0A, 0x40, 0x48,
+			0x40, 0x48, 0x20, 0x28, 0x20, 0x28, 0x26, 0x25,
+			0x23, 0x22, 0x20, 0x1F, 0x1D, 0x1C, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0xA0,
+			0x0F, 0x00, 0x3C, 0x00, 0xFA, 0x00, 0xCD, 0x0A,
+			0xB3, 0xA0, 0x0F, 0x00, 0xC0, 0x19, 0x03, 0x03,
+			0x03, 0x03, 0x02, 0x09, 0x03, 0x07, 0x20, 0x20,
+			0x20, 0x20, 0x10, 0x50, 0x10, 0x40, 0x5C, 0x60,
+			0x64, 0x68, 0x52, 0x5F, 0x3C, 0x6C, 0x00, 0x78,
+			0x00, 0x10, 0x28, 0x00, 0x00, 0x00, 0x05, 0x0B,
+			0x11, 0x19, 0x20, 0x27, 0x2A, 0x00, 0x31, 0x04,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x51, 0x51, 0x51,
+			0x51, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D, 0x04,
+			0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09, 0x0A,
+			0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B, 0x1A,
+			0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D, 0x0C,
+			0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10, 0x0E,
+			0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05, 0x04,
+			0x0A, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0x00, 0x10,
+			0x00, 0x10, 0xCD, 0x0C, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
+			0x0F, 0x01, 0x4F, 0x53}
+	},
+	{
+		.version = 0x3332,
+		.packrat_number = 1293981,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1750,
+		.display_width = 720,
+		.display_height = 1280,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.tw_pin_mask = 0x0088,
+		.sensor_id = SENSOR_ID_CHECKING_EN | 0x0,
+		.config = {0x33, 0x32, 0x33, 0x01, 0x00, 0x7F, 0x03, 0x1E,
+			0x05, 0x09, 0x00, 0x01, 0x01, 0x00, 0x10, 0x4C,
+			0x04, 0x6C, 0x07, 0x02, 0x14, 0x1E, 0x05, 0x50,
+			0xD0, 0x21, 0xDD, 0x02, 0x01, 0x3C, 0x17, 0x01,
+			0x1B, 0x01, 0xFC, 0x48, 0x55, 0x4B, 0x7A, 0xB9,
+			0x00, 0xBF, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00,
+			0x0A, 0x04, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x19, 0x01, 0x00, 0x0A, 0x18, 0x0D, 0x0A,
+			0x00, 0x14, 0x0A, 0x40, 0x64, 0x07, 0x66, 0x64,
+			0xC0, 0x43, 0x2A, 0x05, 0x00, 0x00, 0x00, 0x00,
+			0x4C, 0x6C, 0x74, 0x3C, 0x32, 0x00, 0x00, 0x00,
+			0x4C, 0x6C, 0x74, 0x1E, 0x05, 0x00, 0x02, 0x10,
+			0x01, 0x9A, 0x03, 0x0E, 0x1F, 0x11, 0x67, 0x00,
+			0x13, 0x04, 0x1B, 0x00, 0x10, 0x0A, 0x40, 0x48,
+			0x40, 0x48, 0x20, 0x28, 0x20, 0x28, 0x26, 0x25,
+			0x24, 0x22, 0x21, 0x1F, 0x1D, 0x1C, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x05, 0x0D, 0x00, 0xD0,
+			0x07, 0x00, 0x3C, 0x00, 0x2C, 0x01, 0xCD, 0x0A,
+			0xC0, 0xD0, 0x07, 0x00, 0xC0, 0x19, 0x03, 0x02,
+			0x04, 0x07, 0x07, 0x05, 0x03, 0x02, 0x20, 0x10,
+			0x20, 0x40, 0x40, 0x30, 0x10, 0x10, 0x5A, 0x47,
+			0x4A, 0x58, 0x5C, 0x66, 0x3C, 0x60, 0x00, 0x78,
+			0x00, 0x10, 0x28, 0x00, 0x00, 0x00, 0x06, 0x0C,
+			0x12, 0x19, 0x22, 0x27, 0x2B, 0x00, 0x31, 0x04,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x51, 0x51, 0x51,
+			0x51, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D, 0x04,
+			0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09, 0x0A,
+			0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B, 0x1A,
+			0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D, 0x0C,
+			0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10, 0x0E,
+			0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05, 0x04,
+			0x0A, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0x00, 0x10,
+			0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
+			0x0F, 0x01, 0x4F, 0x53}
+	},
+	{
+		.version = 0x3332,
+		.packrat_number = 1293981,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1750,
+		.display_width = 720,
+		.display_height = 1280,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.tw_pin_mask = 0x0088,
+		.sensor_id = SENSOR_ID_CHECKING_EN | 0x8,
+		.config = {0x33, 0x32, 0x32, 0x01, 0x00, 0x7F, 0x03, 0x1E,
+			0x05, 0x09, 0x00, 0x01, 0x01, 0x00, 0x10, 0x4C,
+			0x04, 0x6C, 0x07, 0x02, 0x14, 0x1E, 0x05, 0x50,
+			0x00, 0x32, 0x08, 0x03, 0x01, 0x3C, 0x17, 0x01,
+			0x19, 0x01, 0xFC, 0x48, 0x55, 0x4B, 0x09, 0xA6,
+			0x34, 0xC6, 0x00, 0xA0, 0x00, 0x00, 0x00, 0x00,
+			0x0A, 0x04, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x19, 0x01, 0x00, 0x0A, 0x18, 0x0D, 0x0A,
+			0x00, 0x14, 0x0A, 0x40, 0x64, 0x07, 0x66, 0x64,
+			0xC0, 0x43, 0x2A, 0x05, 0x00, 0x00, 0x00, 0x00,
+			0x4C, 0x6C, 0x74, 0x3C, 0x32, 0x00, 0x00, 0x00,
+			0x4C, 0x6C, 0x74, 0x1E, 0x05, 0x00, 0x02, 0xEE,
+			0x00, 0x9A, 0x03, 0x0E, 0x1F, 0x14, 0x6D, 0x00,
+			0x13, 0x04, 0x1B, 0x00, 0x10, 0x0A, 0x40, 0x48,
+			0x40, 0x28, 0x20, 0x28, 0x20, 0x28, 0x25, 0x24,
+			0x23, 0x21, 0x20, 0x1F, 0x1D, 0x1C, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0xD0,
+			0x07, 0x00, 0x3C, 0x00, 0xFA, 0x00, 0xCD, 0x0A,
+			0xB3, 0xD0, 0x07, 0x00, 0xC0, 0x19, 0x03, 0x03,
+			0x03, 0x03, 0x03, 0x02, 0x03, 0x02, 0x20, 0x20,
+			0x20, 0x20, 0x20, 0x10, 0x10, 0x10, 0x5E, 0x62,
+			0x66, 0x6A, 0x6E, 0x56, 0x3C, 0x5E, 0x00, 0x78,
+			0x00, 0x10, 0x28, 0x00, 0x00, 0x00, 0x05, 0x0B,
+			0x11, 0x17, 0x1E, 0x26, 0x2A, 0x00, 0x31, 0x04,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x51, 0x51, 0x51,
+			0x51, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D, 0x04,
+			0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09, 0x0A,
+			0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B, 0x1A,
+			0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D, 0x0C,
+			0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10, 0x0E,
+			0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05, 0x04,
+			0x0A, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0x00, 0x10,
+			0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
+			0x0F, 0x01, 0x4F, 0x53}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1100755,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1750,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.sensor_id = SENSOR_ID_CHECKING_EN | 0x88,
+		.customer_register = {0xF9, 0x64, 0x04, 0x64},
+		.multitouch_calibration = 1,
+		.config = {0x30, 0x30, 0x31, 0x33, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x6C, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x83, 0x09, 0xDE, 0x01, 0x01, 0x3C, 0x17,
+			0x01, 0x18, 0x01, 0x00, 0x48, 0x33, 0x4B, 0xC1,
+			0xB4, 0x4E, 0xBB, 0x00, 0x45, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xB7, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x08,
+			0xA2, 0x02, 0x32, 0x02, 0x02, 0x96, 0x18, 0x0D,
+			0x00, 0x02, 0x4C, 0x01, 0x80, 0x02, 0x0E, 0x1F,
+			0x12, 0x6A, 0x00, 0x13, 0x08, 0x1B, 0x00, 0x10,
+			0xFF, 0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09,
+			0x0A, 0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B,
+			0x1A, 0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D,
+			0x0C, 0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10,
+			0x0E, 0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05,
+			0x04, 0x0A, 0xFF, 0xFF, 0xFF, 0x40, 0x20, 0x20,
+			0x20, 0x20, 0x20, 0x00, 0x00, 0x22, 0x21, 0x20,
+			0x1F, 0x1E, 0x1D, 0x1B, 0x1A, 0x00, 0x05, 0x0B,
+			0x10, 0x16, 0x1D, 0x24, 0x2B, 0x00, 0xA0, 0x0F,
+			0xFF, 0x28, 0x00, 0x20, 0x4E, 0xB3, 0xC8, 0x80,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x03, 0x03, 0x03, 0x05, 0x07, 0x02, 0x05, 0x02,
+			0x20, 0x20, 0x20, 0x30, 0x40, 0x10, 0x30, 0x10,
+			0x5C, 0x60, 0x64, 0x5D, 0x5C, 0x54, 0x69, 0x5B,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1100755,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1750,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.sensor_id = SENSOR_ID_CHECKING_EN | 0x0,
+		.customer_register = {0xF9, 0x64, 0x04, 0x64},
+		.multitouch_calibration = 1,
+		.config = {0x30, 0x30, 0x33, 0x33, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB5, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x6C, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x83, 0x09, 0xDE, 0x01, 0x01, 0x3C, 0x17,
+			0x01, 0x18, 0x01, 0x00, 0x48, 0x33, 0x4B, 0xCF,
+			0xB4, 0x4E, 0xBB, 0x00, 0x45, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xB7, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x08,
+			0xA2, 0x02, 0x32, 0x02, 0x02, 0x96, 0x18, 0x0D,
+			0x00, 0x02, 0x4C, 0x01, 0x80, 0x02, 0x0E, 0x1F,
+			0x12, 0x6A, 0x00, 0x13, 0x08, 0x1B, 0x00, 0x10,
+			0xFF, 0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09,
+			0x0A, 0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B,
+			0x1A, 0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D,
+			0x0C, 0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10,
+			0x0E, 0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05,
+			0x04, 0x0A, 0xFF, 0xFF, 0xFF, 0x40, 0x20, 0x20,
+			0x20, 0x28, 0x28, 0x08, 0x08, 0x22, 0x21, 0x20,
+			0x1F, 0x1E, 0x1D, 0x1B, 0x1A, 0x00, 0x05, 0x0B,
+			0x10, 0x16, 0x1D, 0x24, 0x2B, 0x00, 0xA0, 0x0F,
+			0xFF, 0x28, 0x00, 0x20, 0x4E, 0xB3, 0xC8, 0x80,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x03, 0x03, 0x03, 0x05, 0x07, 0x02, 0x05, 0x02,
+			0x20, 0x20, 0x20, 0x30, 0x40, 0x10, 0x30, 0x10,
+			0x5C, 0x60, 0x64, 0x5D, 0x5C, 0x54, 0x69, 0x5B,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1100755,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1750,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.sensor_id = SENSOR_ID_CHECKING_EN | 0x88,
+		.customer_register = {0xF9, 0x64, 0x04, 0x64},
+		.multitouch_calibration = 1,
+		.config = {0x30, 0x30, 0x31, 0x32, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x6C, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x83, 0x09, 0xDE, 0x01, 0x01, 0x3C, 0x17,
+			0x01, 0x18, 0x01, 0x00, 0x48, 0x33, 0x4B, 0xC1,
+			0xB4, 0x4E, 0xBB, 0x00, 0x45, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xB7, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x08,
+			0xA2, 0x02, 0x32, 0x02, 0x02, 0x96, 0x18, 0x0D,
+			0x00, 0x02, 0x4C, 0x01, 0x80, 0x02, 0x0E, 0x1F,
+			0x12, 0x6A, 0x00, 0x13, 0x08, 0x1B, 0x00, 0x10,
+			0xFF, 0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09,
+			0x0A, 0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B,
+			0x1A, 0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D,
+			0x0C, 0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10,
+			0x0E, 0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05,
+			0x04, 0x0A, 0xFF, 0xFF, 0xFF, 0x60, 0x60, 0x60,
+			0x60, 0x60, 0x60, 0x40, 0x40, 0x30, 0x2F, 0x2D,
+			0x2C, 0x2A, 0x28, 0x27, 0x25, 0x00, 0x05, 0x0B,
+			0x10, 0x16, 0x1D, 0x23, 0x2B, 0x00, 0xA0, 0x0F,
+			0xFF, 0x28, 0x00, 0x20, 0x4E, 0xB3, 0xC8, 0x80,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x03, 0x03, 0x03, 0x05, 0x07, 0x02, 0x02, 0x02,
+			0x20, 0x20, 0x20, 0x30, 0x40, 0x10, 0x10, 0x10,
+			0x5C, 0x60, 0x64, 0x5D, 0x5C, 0x54, 0x57, 0x5B,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04 }
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1100755,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1750,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.sensor_id = SENSOR_ID_CHECKING_EN | 0x8,
+		.customer_register = {0xF9, 0x64, 0x04, 0x64},
+		.multitouch_calibration = 1,
+		.config = {0x30, 0x30, 0x32, 0x32, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB5, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x6C, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x33, 0x13, 0xDE, 0x01, 0x01, 0x3C, 0x18,
+			0x01, 0x17, 0x02, 0x00, 0x48, 0x33, 0x4B, 0x01,
+			0xE8, 0x09, 0xE3, 0x01, 0x45, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x08,
+			0xA2, 0x02, 0x32, 0x02, 0x02, 0x96, 0x18, 0x0D,
+			0x00, 0x02, 0xBA, 0x00, 0x80, 0x02, 0x0E, 0x1F,
+			0x14, 0xA0, 0x00, 0x19, 0x08, 0x1B, 0x00, 0x10,
+			0xFF, 0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09,
+			0x0A, 0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B,
+			0x1A, 0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D,
+			0x0C, 0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10,
+			0x0E, 0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05,
+			0x04, 0x0A, 0xFF, 0xFF, 0xFF, 0x40, 0x20, 0x20,
+			0x20, 0x20, 0x00, 0x00, 0x00, 0x22, 0x21, 0x1F,
+			0x1E, 0x1C, 0x1B, 0x19, 0x18, 0x00, 0x08, 0x12,
+			0x1D, 0x29, 0x36, 0x44, 0x55, 0x00, 0xA0, 0x0F,
+			0xFF, 0x28, 0x00, 0x20, 0x4E, 0xB3, 0xC8, 0x80,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x02, 0x09, 0x07, 0x0C, 0x05, 0x0B, 0x03, 0x04,
+			0x10, 0x40, 0x30, 0x50, 0x20, 0x40, 0x10, 0x10,
+			0x63, 0x5C, 0x5D, 0x5F, 0x60, 0x5C, 0x59, 0x47,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1100755,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1750,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.sensor_id = SENSOR_ID_CHECKING_EN | 0x0,
+		.customer_register = {0xF9, 0x64, 0x04, 0x64},
+		.multitouch_calibration = 1,
+		.config = {0x30, 0x30, 0x33, 0x32, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB5, 0x09, 0x0B, 0x01, 0x01, 0x00, 0x00,
+			0x4C, 0x04, 0x6C, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x33, 0x13, 0xDE, 0x01, 0x01, 0x3C, 0x18,
+			0x01, 0x17, 0x02, 0x00, 0x48, 0x33, 0x4B, 0x01,
+			0xE8, 0x09, 0xE3, 0x01, 0x45, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x30, 0x08,
+			0xA2, 0x02, 0x32, 0x02, 0x02, 0x96, 0x18, 0x0D,
+			0x00, 0x02, 0xBA, 0x00, 0x80, 0x02, 0x0E, 0x1F,
+			0x14, 0xA0, 0x00, 0x19, 0x08, 0x1B, 0x00, 0x10,
+			0xFF, 0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09,
+			0x0A, 0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B,
+			0x1A, 0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D,
+			0x0C, 0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10,
+			0x0E, 0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05,
+			0x04, 0x0A, 0xFF, 0xFF, 0xFF, 0x40, 0x20, 0x20,
+			0x20, 0x20, 0x00, 0x00, 0x00, 0x22, 0x21, 0x1F,
+			0x1E, 0x1C, 0x1B, 0x19, 0x18, 0x00, 0x08, 0x12,
+			0x1D, 0x29, 0x36, 0x44, 0x55, 0x00, 0xA0, 0x0F,
+			0xFF, 0x28, 0x00, 0x20, 0x4E, 0xB3, 0xC8, 0x80,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x02, 0x09, 0x07, 0x0C, 0x05, 0x0B, 0x03, 0x04,
+			0x10, 0x40, 0x30, 0x50, 0x20, 0x40, 0x10, 0x10,
+			0x63, 0x5C, 0x5D, 0x5F, 0x60, 0x5C, 0x59, 0x47,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1091741,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.sensor_id = SENSOR_ID_CHECKING_EN | 0x88,
+		.config = {0x30, 0x30, 0x31, 0x31, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x05, 0x05, 0x00, 0x00,
+			0x4C, 0x04, 0x6C, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x83, 0x09, 0xDE, 0x01, 0x01, 0x3C, 0x17,
+			0x01, 0x18, 0x01, 0x00, 0x48, 0x33, 0x4B, 0xC1,
+			0xB4, 0x4E, 0xBB, 0x00, 0x45, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xB7, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x0F, 0x08,
+			0xA2, 0x02, 0x32, 0x02, 0x02, 0x96, 0x18, 0x0D,
+			0x00, 0x02, 0x4C, 0x01, 0x80, 0x02, 0x0E, 0x1F,
+			0x12, 0x6A, 0x00, 0x13, 0x08, 0x1B, 0x00, 0x10,
+			0xFF, 0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09,
+			0x0A, 0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B,
+			0x1A, 0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D,
+			0x0C, 0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10,
+			0x0E, 0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05,
+			0x04, 0x0A, 0xFF, 0xFF, 0xFF, 0x60, 0x60, 0x60,
+			0x60, 0x60, 0x60, 0x40, 0x40, 0x30, 0x2F, 0x2D,
+			0x2C, 0x2A, 0x28, 0x27, 0x25, 0x00, 0x05, 0x0B,
+			0x10, 0x16, 0x1D, 0x23, 0x2B, 0x00, 0xA0, 0x0F,
+			0xFF, 0x28, 0x00, 0x20, 0x4E, 0xB3, 0xC8, 0x80,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x03, 0x03, 0x03, 0x05, 0x07, 0x02, 0x02, 0x02,
+			0x20, 0x20, 0x20, 0x30, 0x40, 0x10, 0x10, 0x10,
+			0x5C, 0x60, 0x64, 0x5D, 0x5C, 0x54, 0x57, 0x5B,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1091741,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.sensor_id = SENSOR_ID_CHECKING_EN | 0x8,
+		.config = {0x30, 0x30, 0x32, 0x31, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB5, 0x09, 0x0B, 0x05, 0x05, 0x00, 0x00,
+			0x4C, 0x04, 0x6C, 0x07, 0x02, 0x14, 0x19, 0x05,
+			0x37, 0x83, 0x09, 0xDE, 0x01, 0x01, 0x3C, 0x18,
+			0x01, 0x17, 0x02, 0x00, 0x48, 0x33, 0x4B, 0x93,
+			0xA9, 0xB4, 0xC1, 0x00, 0x45, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xBC, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x0F, 0x08,
+			0xA2, 0x02, 0x32, 0x02, 0x02, 0x96, 0x18, 0x0D,
+			0x00, 0x02, 0xBA, 0x00, 0x4D, 0x02, 0x0E, 0x1F,
+			0x14, 0xA0, 0x00, 0x19, 0x08, 0x1B, 0x00, 0x10,
+			0xFF, 0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09,
+			0x0A, 0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B,
+			0x1A, 0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D,
+			0x0C, 0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10,
+			0x0E, 0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05,
+			0x04, 0x0A, 0xFF, 0xFF, 0xFF, 0x40, 0x20, 0x20,
+			0x20, 0x20, 0x00, 0x00, 0x00, 0x22, 0x21, 0x1F,
+			0x1E, 0x1C, 0x1B, 0x19, 0x18, 0x00, 0x08, 0x12,
+			0x1D, 0x29, 0x36, 0x44, 0x55, 0x00, 0xA0, 0x0F,
+			0xFF, 0x28, 0x00, 0x20, 0x4E, 0xB3, 0xC8, 0x80,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x02, 0x09, 0x07, 0x0C, 0x05, 0x0B, 0x03, 0x04,
+			0x10, 0x40, 0x30, 0x50, 0x20, 0x40, 0x10, 0x10,
+			0x63, 0x5C, 0x5D, 0x5F, 0x60, 0x5C, 0x59, 0x47,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.packrat_number = 1091741,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.tw_pin_mask = 0x0088,
+		.sensor_id = SENSOR_ID_CHECKING_EN | 0x0,
+		.config = {0x30, 0x30, 0x33, 0x31, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x09, 0x0B, 0x05, 0x05, 0x00, 0x00,
+			0x4C, 0x04, 0x6C, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x2D, 0x83, 0x09, 0xDE, 0x01, 0x01, 0x3C, 0x17,
+			0x01, 0x18, 0x01, 0x00, 0x48, 0x33, 0x4B, 0xC1,
+			0xB4, 0x4E, 0xBB, 0x00, 0x45, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xB7, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x0F, 0x08,
+			0xA2, 0x02, 0x32, 0x02, 0x02, 0x96, 0x18, 0x0D,
+			0x00, 0x02, 0x4C, 0x01, 0x80, 0x02, 0x0E, 0x1F,
+			0x12, 0x6A, 0x00, 0x13, 0x08, 0x1B, 0x00, 0x10,
+			0xFF, 0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09,
+			0x0A, 0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B,
+			0x1A, 0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D,
+			0x0C, 0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10,
+			0x0E, 0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05,
+			0x04, 0x0A, 0xFF, 0xFF, 0xFF, 0x60, 0x60, 0x60,
+			0x60, 0x60, 0x60, 0x40, 0x40, 0x30, 0x2F, 0x2D,
+			0x2C, 0x2A, 0x28, 0x27, 0x25, 0x00, 0x05, 0x0B,
+			0x10, 0x16, 0x1D, 0x23, 0x2B, 0x00, 0xA0, 0x0F,
+			0xFF, 0x28, 0x00, 0x20, 0x4E, 0xB3, 0xC8, 0x80,
+			0xA0, 0x0F, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x03, 0x03, 0x03, 0x05, 0x07, 0x02, 0x02, 0x02,
+			0x20, 0x20, 0x20, 0x30, 0x40, 0x10, 0x10, 0x10,
+			0x5C, 0x60, 0x64, 0x5D, 0x5C, 0x54, 0x57, 0x5B,
+			0x00, 0xC8, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3330,
+		.abs_x_min = 0,
+		.abs_x_max = 1000,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.config = {0x30, 0x30, 0x30, 0x31, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x08, 0x0B, 0x19, 0x19, 0x00, 0x00,
+			0xE8, 0x03, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x28, 0xF5, 0x28, 0x1E, 0x05, 0x01, 0x3C, 0x1D,
+			0x01, 0x20, 0x00, 0x9A, 0x49, 0x33, 0x4B, 0x15,
+			0xBF, 0x14, 0xC2, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xC0, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x00, 0x08,
+			0xA2, 0x02, 0x41, 0x31, 0x63, 0xFA, 0x18, 0x0D,
+			0x00, 0x02, 0x36, 0x01, 0x80, 0x01, 0x0E, 0x1F,
+			0x12, 0x4B, 0x00, 0x19, 0x04, 0x00, 0x00, 0x10,
+			0xFF, 0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09,
+			0x0A, 0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B,
+			0x1A, 0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D,
+			0x0C, 0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10,
+			0x0E, 0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05,
+			0x04, 0x0A, 0xFF, 0xFF, 0xFF, 0x60, 0x60, 0x60,
+			0x60, 0x60, 0x60, 0x60, 0x60, 0x2E, 0x2E, 0x2E,
+			0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x00, 0x03, 0x06,
+			0x09, 0x0C, 0x10, 0x14, 0x18, 0x00, 0xCD, 0x03,
+			0x01, 0x69, 0x00, 0xFF, 0xFF, 0xC0, 0x0A, 0xCD,
+			0x86, 0x0A, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x02, 0x02, 0x02, 0x02, 0x02, 0x05, 0x02, 0x03,
+			0x20, 0x20, 0x20, 0x20, 0x20, 0x40, 0x10, 0x20,
+			0x71, 0x75, 0x78, 0x7B, 0x7E, 0x68, 0x43, 0x5C,
+			0x00, 0x69, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3230,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.default_config = 1,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.config = {0x30, 0x30, 0x30, 0x31, 0x84, 0x0F, 0x03, 0x1E,
+			0x05, 0x20, 0xB1, 0x00, 0x0B, 0x19, 0x19, 0x00,
+			0x00, 0x4C, 0x04, 0x6C, 0x07, 0x1E, 0x05, 0x28,
+			0xF5, 0x28, 0x1E, 0x05, 0x01, 0x48, 0xFD, 0x41,
+			0xFE, 0x00, 0x48, 0x00, 0x48, 0xF1, 0xC5, 0x79,
+			0xC8, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x0A,
+			0x04, 0xC0, 0x00, 0x02, 0xF3, 0x00, 0x80, 0x03,
+			0x0D, 0x1E, 0x00, 0x32, 0x00, 0x19, 0x04, 0x1E,
+			0x00, 0x10, 0xFF, 0x00, 0x11, 0x14, 0x12, 0x0F,
+			0x0E, 0x09, 0x0A, 0x07, 0x02, 0x01, 0x00, 0x03,
+			0x10, 0x1B, 0x1A, 0x19, 0x18, 0x16, 0x17, 0x15,
+			0x0B, 0x0D, 0x0C, 0x06, 0xFF, 0xFF, 0xFF, 0x12,
+			0x0F, 0x10, 0x0E, 0x08, 0x07, 0x0C, 0x01, 0x06,
+			0x02, 0x05, 0x04, 0x0A, 0xFF, 0xFF, 0xFF, 0xC0,
+			0xC0, 0xC0, 0xC0, 0xA0, 0xA0, 0xA0, 0xA0, 0x4B,
+			0x4A, 0x48, 0x47, 0x45, 0x44, 0x42, 0x40, 0x00,
+			0x02, 0x04, 0x06, 0x08, 0x0A, 0x0D, 0x10, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xC0, 0x80, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+			0x02, 0x02, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+			0x20, 0x20, 0x58, 0x5B, 0x5D, 0x5F, 0x61, 0x63,
+			0x66, 0x69, 0x48, 0x41, 0x00, 0x1E, 0x19, 0x05,
+			0xFD, 0xFE, 0x3D, 0x08}
+	},
+	{
+		.version = 0x0000
+	},
+};
+
+static struct synaptics_i2c_rmi_platform_data evita_syn_ts_3k_data[] = { /* Evita Synatpics sensor */
+	{
+		.version = 0x3330,
+		.abs_x_min = 0,
+		.abs_x_max = 1000,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.default_config = 2,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.config = {0x30, 0x30, 0x30, 0x31, 0x00, 0x3F, 0x03, 0x1E,
+			0x05, 0xB1, 0x08, 0x0B, 0x19, 0x19, 0x00, 0x00,
+			0xE8, 0x03, 0x75, 0x07, 0x02, 0x14, 0x1E, 0x05,
+			0x28, 0xF5, 0x28, 0x1E, 0x05, 0x01, 0x3C, 0x1D,
+			0x01, 0x20, 0x00, 0x9A, 0x49, 0x33, 0x4B, 0x15,
+			0xBF, 0x14, 0xC2, 0x00, 0x70, 0x00, 0x00, 0x00,
+			0x00, 0x0A, 0x04, 0xC0, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x19, 0x01, 0x00, 0x0A, 0x00, 0x08,
+			0xA2, 0x02, 0x41, 0x31, 0x63, 0xFA, 0x18, 0x0D,
+			0x00, 0x02, 0x36, 0x01, 0x80, 0x01, 0x0E, 0x1F,
+			0x12, 0x4B, 0x00, 0x19, 0x04, 0x00, 0x00, 0x10,
+			0xFF, 0x00, 0x11, 0x14, 0x12, 0x0F, 0x0E, 0x09,
+			0x0A, 0x07, 0x02, 0x01, 0x00, 0x03, 0x10, 0x1B,
+			0x1A, 0x19, 0x18, 0x16, 0x17, 0x15, 0x0B, 0x0D,
+			0x0C, 0x06, 0xFF, 0xFF, 0xFF, 0x12, 0x0F, 0x10,
+			0x0E, 0x08, 0x07, 0x0C, 0x01, 0x06, 0x02, 0x05,
+			0x04, 0x0A, 0xFF, 0xFF, 0xFF, 0x60, 0x60, 0x60,
+			0x60, 0x60, 0x60, 0x60, 0x60, 0x2E, 0x2E, 0x2E,
+			0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x00, 0x03, 0x06,
+			0x09, 0x0C, 0x10, 0x14, 0x18, 0x00, 0xCD, 0x03,
+			0x01, 0x69, 0x00, 0xFF, 0xFF, 0xC0, 0x0A, 0xCD,
+			0x86, 0x0A, 0x00, 0xC0, 0x80, 0x00, 0x10, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x02, 0x02, 0x02, 0x02, 0x02, 0x05, 0x02, 0x03,
+			0x20, 0x20, 0x20, 0x20, 0x20, 0x40, 0x10, 0x20,
+			0x71, 0x75, 0x78, 0x7B, 0x7E, 0x68, 0x43, 0x5C,
+			0x00, 0x69, 0x00, 0x10, 0x0A, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0xFF, 0x51, 0x51, 0x51, 0x51, 0xCD, 0x0D,
+			0x04}
+	},
+	{
+		.version = 0x3230,
+		.abs_x_min = 0,
+		.abs_x_max = 1100,
+		.abs_y_min = 0,
+		.abs_y_max = 1770,
+		.default_config = 1,
+		.gpio_irq = JET_GPIO_TP_ATTz,
+		.support_htc_event = 1,
+		.large_obj_check = 1,
+		.config = {0x30, 0x30, 0x30, 0x31, 0x84, 0x0F, 0x03, 0x1E,
+			0x05, 0x20, 0xB1, 0x00, 0x0B, 0x19, 0x19, 0x00,
+			0x00, 0x4C, 0x04, 0x6C, 0x07, 0x1E, 0x05, 0x28,
+			0xF5, 0x28, 0x1E, 0x05, 0x01, 0x48, 0xFD, 0x41,
+			0xFE, 0x00, 0x48, 0x00, 0x48, 0xF1, 0xC5, 0x79,
+			0xC8, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x0A,
+			0x04, 0xC0, 0x00, 0x02, 0xF3, 0x00, 0x80, 0x03,
+			0x0D, 0x1E, 0x00, 0x32, 0x00, 0x19, 0x04, 0x1E,
+			0x00, 0x10, 0xFF, 0x00, 0x06, 0x0C, 0x0D, 0x0B,
+			0x15, 0x17, 0x16, 0x18, 0x19, 0x1A, 0x1B, 0x11,
+			0x14, 0x12, 0x0F, 0x0E, 0x09, 0x0A, 0x07, 0x02,
+			0x01, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x04,
+			0x05, 0x02, 0x06, 0x01, 0x0C, 0x07, 0x08, 0x0E,
+			0x10, 0x0F, 0x12, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0,
+			0xC0, 0xC0, 0xC0, 0xA0, 0xA0, 0xA0, 0xA0, 0x4B,
+			0x4A, 0x48, 0x47, 0x45, 0x44, 0x42, 0x40, 0x00,
+			0x02, 0x04, 0x06, 0x08, 0x0A, 0x0D, 0x10, 0x00,
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xC0, 0x80, 0x00,
+			0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+			0x80, 0x80, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+			0x02, 0x02, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+			0x20, 0x20, 0x58, 0x5B, 0x5D, 0x5F, 0x61, 0x63,
+			0x66, 0x69, 0x48, 0x41, 0x00, 0x1E, 0x19, 0x05,
+			0xFD, 0xFE, 0x3D, 0x08}
+	},
+	{
+		.version = 0x0000
+	},
+};
+
+static struct i2c_board_info msm_i2c_gsbi3_info[] = {
+	{
+		I2C_BOARD_INFO(SYNAPTICS_3200_NAME, 0x40 >> 1),
+		.platform_data = &syn_ts_3k_data,
+		.irq = MSM_GPIO_TO_INT(JET_GPIO_TP_ATTz)
+	},
+};
+
+static ssize_t virtual_syn_keys_show(struct kobject *kobj,
+			struct kobj_attribute *attr, char *buf)
+{
+	return sprintf(buf,
+		__stringify(EV_KEY) ":" __stringify(KEY_HOME)	":87:1345:110:100"
+		":" __stringify(EV_KEY) ":" __stringify(KEY_MENU)	":273:1345:106:100"
+		":" __stringify(EV_KEY) ":" __stringify(KEY_BACK)	":470:1345:120:100"
+		":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":660:1345:110:100"
+		"\n");
+}
+
+static ssize_t virtual_syn_three_keys_show(struct kobject *kobj,
+			struct kobj_attribute *attr, char *buf)
+{
+	return sprintf(buf,
+		__stringify(EV_KEY) ":" __stringify(KEY_BACK)       ":112:1345:120:100"
+		":" __stringify(EV_KEY) ":" __stringify(KEY_HOME)   ":360:1345:120:100"
+		":" __stringify(EV_KEY) ":" __stringify(KEY_APP_SWITCH)   ":595:1345:120:100"
+		"\n");
+}
+
+static struct kobj_attribute syn_virtual_keys_attr = {
+	.attr = {
+		.name = "virtualkeys.synaptics-rmi-touchscreen",
+		.mode = S_IRUGO,
+	},
+	.show = &virtual_syn_keys_show,
+};
+
+static struct kobj_attribute syn_three_virtual_keys_attr = {
+	.attr = {
+		.name = "virtualkeys.synaptics-rmi-touchscreen",
+		.mode = S_IRUGO,
+	},
+	.show = &virtual_syn_three_keys_show,
+};
+
+static struct attribute *properties_attrs[] = {
+	&syn_virtual_keys_attr.attr,
+	NULL
+};
+
+static struct attribute *three_virtual_key_properties_attrs[] = {
+	&syn_three_virtual_keys_attr.attr,
+	NULL
+};
+
+static struct attribute_group properties_attr_group = {
+	.attrs = properties_attrs,
+};
+
+static struct attribute_group three_virtual_key_properties_attr_group = {
+	.attrs = three_virtual_key_properties_attrs,
+};
+
+static void config_gpio_table(uint32_t *table, int len)
+{
+	int n, rc;
+	for (n = 0; n < len; n++) {
+		rc = gpio_tlmm_config(table[n], GPIO_CFG_ENABLE);
+		if (rc) {
+			pr_err("[CAM] %s: gpio_tlmm_config(%#x)=%d\n",
+				__func__, table[n], rc);
+			break;
+		}
+	}
+}
+
+static struct bma250_platform_data gsensor_bma250_platform_data = {
+	.intr = JET_GPIO_GSENSOR_INT,
+	.chip_layout = 1,
+};
+
+static struct akm8975_platform_data compass_platform_data = {
+	.layouts = JET_LAYOUTS,
+};
+
+static struct r3gd20_gyr_platform_data gyro_platform_data = {
+	.fs_range = R3GD20_GYR_FS_2000DPS,
+	.axis_map_x = 0,
+	.axis_map_y = 1,
+	.axis_map_z = 2,
+	.negate_x = 0,
+	.negate_y = 0,
+	.negate_z = 0,
+
+	.poll_interval = 50,
+	.min_interval = R3GD20_MIN_POLL_PERIOD_MS, /*2 */
+
+	/*.gpio_int1 = DEFAULT_INT1_GPIO,*/
+	/*.gpio_int2 = DEFAULT_INT2_GPIO,*/             /* int for fifo */
+
+	.watermark = 0,
+	.fifomode = 0,
+};
+
+static struct i2c_board_info __initdata msm_i2c_sensor_gsbi12_info[] = {
+	{
+		I2C_BOARD_INFO(BMA250_I2C_NAME, 0x30 >> 1),
+		.platform_data = &gsensor_bma250_platform_data,
+		.irq = MSM_GPIO_TO_INT(JET_GPIO_GSENSOR_INT),
+	},
+	{
+		I2C_BOARD_INFO(AKM8975_I2C_NAME, 0x1A >> 1),
+		.platform_data = &compass_platform_data,
+		.irq = MSM_GPIO_TO_INT(JET_GPIO_COMPASS_INT),
+	},
+	{
+		I2C_BOARD_INFO(R3GD20_GYR_DEV_NAME, 0xD0 >> 1),
+		.platform_data = &gyro_platform_data,
+		/*.irq = MSM_GPIO_TO_INT(JET_GYRO_INT),*/
+	},
+};
+
+static struct mpu3050_platform_data mpu3050_data = {
+	.int_config = 0x10,
+	.orientation = { 1, 0, 0,
+			 0, 1, 0,
+			 0, 0, 1 },
+	.level_shifter = 0,
+
+	.accel = {
+		.get_slave_descr = get_accel_slave_descr,
+		.adapt_num = MSM_8960_GSBI12_QUP_I2C_BUS_ID, /* The i2c bus to which the mpu device is connected */
+		.bus = EXT_SLAVE_BUS_SECONDARY,
+		.address = 0x30 >> 1,
+		.orientation = { 1, 0, 0,
+				 0, 1, 0,
+				 0, 0, 1
+		},
+	},
+
+	.compass = {
+		.get_slave_descr = get_compass_slave_descr,
+		.adapt_num = MSM_8960_GSBI12_QUP_I2C_BUS_ID, /* The i2c bus to which the mpu device is connected */
+		.bus = EXT_SLAVE_BUS_PRIMARY,
+		.address = 0x1A >> 1,
+		.orientation = { -1, 0,  0,
+				  0, 1,  0,
+				  0, 0, -1
+		},
+	},
+};
+
+static struct i2c_board_info __initdata mpu3050_GSBI12_boardinfo[] = {
+	{
+		I2C_BOARD_INFO("mpu3050", 0xD0 >> 1),
+		.irq = MSM_GPIO_TO_INT(JET_GPIO_GYRO_INT),
+		.platform_data = &mpu3050_data,
+	},
+};
+
+static struct pn544_i2c_platform_data nfc_platform_data = {
+	.irq_gpio = JET_GPIO_NFC_IRQ,
+	.ven_gpio = JET_GPIO_NFC_VEN,
+	.firm_gpio = JET_GPIO_NFC_DL_MODE,
+	.ven_isinvert = 1,
+};
+
+static struct i2c_board_info pn544_i2c_boardinfo[] = {
+	{
+		I2C_BOARD_INFO(PN544_I2C_NAME, 0x50 >> 1),
+		.platform_data = &nfc_platform_data,
+		.irq = MSM_GPIO_TO_INT(JET_GPIO_NFC_IRQ),
+	},
+};
+
+static uint8_t cm3629_mapping_table[] = {0x0, 0x3, 0x6, 0x9, 0xC,
+			0xF, 0x12, 0x15, 0x18, 0x1B,
+			0x1E, 0x21, 0x24, 0x27, 0x2A,
+			0x2D, 0x30, 0x33, 0x36, 0x39,
+			0x3C, 0x3F, 0x43, 0x47, 0x4B,
+			0x4F, 0x53, 0x57, 0x5B, 0x5F,
+			0x63, 0x67, 0x6B, 0x70, 0x75,
+			0x7A, 0x7F, 0x84, 0x89, 0x8E,
+			0x93, 0x98, 0x9D, 0xA2, 0xA8,
+			0xAE, 0xB4, 0xBA, 0xC0, 0xC6,
+			0xCC, 0xD3, 0xDA, 0xE1, 0xE8,
+			0xEF, 0xF6, 0xFF};
+
+static struct cm3629_platform_data cm36282_pdata = {
+	.model = CAPELLA_CM36282,
+	.ps_select = CM3629_PS1_ONLY,
+	.intr = PM8921_GPIO_PM_TO_SYS(JET_GPIO_PROXIMITY_INTz),
+	.levels = { 0, 0, 150, 383, 620, 4100, 6254, 7610, 8967, 65535},
+	.golden_adc = 0xE77,
+	.power = NULL,
+	.cm3629_slave_address = 0xC0>>1,
+	.ps1_thd_set = 0xD,
+	.ps1_thd_no_cal = 0xF1,
+	.ps1_thd_with_cal = 0xD,
+	.ps_calibration_rule = 1,
+	.ps_conf1_val = CM3629_PS_DR_1_80 | CM3629_PS_IT_1_6T |
+			CM3629_PS1_PERS_4,
+	.ps_conf2_val = CM3629_PS_ITB_1 | CM3629_PS_ITR_1 |
+			CM3629_PS2_INT_DIS | CM3629_PS1_INT_DIS,
+	.ps_conf3_val = CM3629_PS2_PROL_32,
+	.enable_polling_ignore = 1,
+	.mapping_table = cm3629_mapping_table,
+	.mapping_size = ARRAY_SIZE(cm3629_mapping_table),
+};
+
+static struct i2c_board_info i2c_CM36282_devices[] = {
+	{
+		I2C_BOARD_INFO(CM3629_I2C_NAME, 0xC0 >> 1),
+		.platform_data = &cm36282_pdata,
+		.irq =  PM8921_GPIO_IRQ(PM8921_IRQ_BASE, JET_GPIO_PROXIMITY_INTz),
+	},
+};
+
+#define _GET_REGULATOR(var, name) do {				\
+	var = regulator_get(NULL, name);			\
+	if (IS_ERR(var)) {					\
+		pr_err("'%s' regulator not found, rc=%ld\n",	\
+			name, IS_ERR(var));			\
+		var = NULL;					\
+		return -ENODEV;					\
+	}							\
+} while (0)
+
+static uint32_t mhl_usb_switch_ouput_table[] = {
+	GPIO_CFG(JET_GPIO_MHL_USBz_SEL, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+
+void config_jet_mhl_gpios(void)
+{
+	config_gpio_table(mhl_usb_switch_ouput_table, ARRAY_SIZE(mhl_usb_switch_ouput_table));
+}
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+static void jet_usb_dpdn_switch(int path)
+{
+	switch (path) {
+	case PATH_USB:
+	case PATH_MHL:
+	{
+		int polarity = 1; /* high = mhl */
+		int mhl = (path == PATH_MHL);
+
+		config_jet_mhl_gpios();
+
+		pr_info("[CABLE] %s: Set %s path\n", __func__, mhl ? "MHL" : "USB");
+		gpio_set_value(JET_GPIO_MHL_USBz_SEL, (mhl ^ !polarity) ? 1 : 0);
+		break;
+	}
+	}
+	#ifdef CONFIG_FB_MSM_HDMI_MHL
+	sii9234_change_usb_owner((path == PATH_MHL) ? 1 : 0);
+	#endif /*CONFIG_FB_MSM_HDMI_MHL*/
+}
+#endif
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+static struct regulator *reg_8921_l12;
+static struct regulator *reg_8921_s4;
+static struct regulator *reg_8921_l16;
+static struct regulator *reg_8921_l10;
+static struct regulator *reg_8921_s2;
+uint32_t msm_hdmi_off_gpio[] = {
+	GPIO_CFG(JET_GPIO_HDMI_DDC_CLK,  0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	GPIO_CFG(JET_GPIO_HDMI_DDC_DATA,  0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	GPIO_CFG(JET_GPIO_HDMI_HPD,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
+};
+
+uint32_t msm_hdmi_on_gpio[] = {
+	GPIO_CFG(JET_GPIO_HDMI_DDC_CLK,  1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(JET_GPIO_HDMI_DDC_DATA,  1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(JET_GPIO_HDMI_HPD,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
+};
+
+static int mhl_sii9234_power_vote(bool enable)
+{
+	int rc;
+
+	if (!reg_8921_l10) {
+		_GET_REGULATOR(reg_8921_l10, "8921_l10");
+		rc = regulator_set_voltage(reg_8921_l10, 3000000, 3000000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_l10 failed rc=%d\n",
+					__func__, rc);
+			return rc;
+		}
+	}
+	if (!reg_8921_s2) {
+		_GET_REGULATOR(reg_8921_s2, "8921_s2");
+		rc = regulator_set_voltage(reg_8921_s2, 1300000, 1300000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_s2 failed rc=%d\n",
+					__func__, rc);
+			return rc;
+		}
+	}
+
+	if (enable) {
+		if (reg_8921_l10) {
+			rc = regulator_enable(reg_8921_l10);
+			if (rc)
+				pr_warning("'%s' regulator enable failed, rc=%d\n",
+						"reg_8921_l10", rc);
+		}
+		if (reg_8921_s2) {
+			rc = regulator_enable(reg_8921_s2);
+			if (rc)
+				pr_warning("'%s' regulator enable failed, rc=%d\n",
+						"reg_8921_s2", rc);
+		}
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		if (reg_8921_l10) {
+			rc = regulator_disable(reg_8921_l10);
+			if (rc)
+				pr_warning("'%s' regulator disable failed, rc=%d\n",
+						"reg_8921_l10", rc);
+		}
+		if (reg_8921_s2) {
+			rc = regulator_disable(reg_8921_s2);
+			if (rc)
+				pr_warning("'%s' regulator disable failed, rc=%d\n",
+						"reg_8921_s2", rc);
+		}
+		pr_info("%s(off): success\n", __func__);
+	}
+	return 0;
+}
+
+static void mhl_sii9234_1v2_power(bool enable)
+{
+	static bool prev_on;
+
+	if (enable == prev_on)
+		return;
+
+	if (enable) {
+		config_gpio_table(msm_hdmi_on_gpio, ARRAY_SIZE(msm_hdmi_on_gpio));
+		hdmi_hpd_feature(1);
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		config_gpio_table(msm_hdmi_off_gpio, ARRAY_SIZE(msm_hdmi_off_gpio));
+		hdmi_hpd_feature(0);
+		pr_info("%s(off): success\n", __func__);
+	}
+
+	prev_on = enable;
+}
+
+static int mhl_sii9234_all_power(bool enable)
+{
+	static bool prev_on;
+	int rc;
+	if (enable == prev_on)
+		return 0;
+
+	if (!reg_8921_s4)
+		_GET_REGULATOR(reg_8921_s4, "8921_s4");
+	if (!reg_8921_l16)
+		_GET_REGULATOR(reg_8921_l16, "8921_l16");
+	if (!reg_8921_l12)
+		_GET_REGULATOR(reg_8921_l12, "8921_l12");
+
+	if (enable) {
+		rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_s4 failed rc=%d\n",
+				__func__, rc);
+			return rc;
+		}
+		rc = regulator_set_voltage(reg_8921_l16, 3300000, 3300000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_l16 failed rc=%d\n",
+				__func__, rc);
+			return rc;
+		}
+
+		rc = regulator_set_voltage(reg_8921_l12, 1200000, 1200000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_l12 failed rc=%d\n",
+				__func__, rc);
+			return rc;
+		}
+		rc = regulator_enable(reg_8921_s4);
+
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"reg_8921_s4", rc);
+			return rc;
+		}
+		rc = regulator_enable(reg_8921_l16);
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"reg_8921_l16", rc);
+			return rc;
+		}
+
+		rc = regulator_enable(reg_8921_l12);
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"reg_8921_l12", rc);
+			return rc;
+		}
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		rc = regulator_disable(reg_8921_s4);
+		if (rc)
+			pr_warning("'%s' regulator disable failed, rc=%d\n",
+				"reg_8921_s4", rc);
+		rc = regulator_disable(reg_8921_l16);
+		if (rc)
+			pr_warning("'%s' regulator disable failed, rc=%d\n",
+				"reg_8921_l16", rc);
+		rc = regulator_disable(reg_8921_l12);
+		if (rc)
+			pr_warning("'%s' regulator disable failed, rc=%d\n",
+				"reg_8921_l12", rc);
+		pr_info("%s(off): success\n", __func__);
+	}
+
+	prev_on = enable;
+
+	return 0;
+}
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+static uint32_t mhl_gpio_table[] = {
+	GPIO_CFG(JET_GPIO_MHL_RSTz, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	GPIO_CFG(JET_GPIO_MHL_INT, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
+};
+
+static int mhl_sii9234_power(int on)
+{
+	int rc = 0;
+
+	switch (on) {
+	case 0:
+		mhl_sii9234_1v2_power(false);
+		break;
+	case 1:
+		mhl_sii9234_all_power(true);
+		config_gpio_table(mhl_gpio_table, ARRAY_SIZE(mhl_gpio_table));
+		break;
+	default:
+		pr_warning("%s(%d) got unsupport parameter!!!\n", __func__, on);
+		break;
+	}
+	return rc;
+}
+
+static T_MHL_PLATFORM_DATA mhl_sii9234_device_data = {
+	.gpio_intr = JET_GPIO_MHL_INT,
+	.gpio_reset = JET_GPIO_MHL_RSTz,
+	.ci2ca = 0,
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+	.mhl_usb_switch = jet_usb_dpdn_switch,
+	.mhl_1v2_power = mhl_sii9234_1v2_power,
+	.enable_5v = hdmi_enable_5v,
+	.mhl_power_vote = mhl_sii9234_power_vote,
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SUPERDEMO
+	.abs_x_min = 941,/* 0 */
+	.abs_x_max = 31664,/* 32767 */
+	.abs_y_min = 417,/* 0 */
+	.abs_y_max = 32053,/* 32767 */
+	.abs_pressure_min = 0,
+	.abs_pressure_max = 255,
+	.abs_width_min = 0,
+	.abs_width_max = 20,
+#endif
+#endif
+	.power = mhl_sii9234_power,
+};
+
+static struct i2c_board_info msm_i2c_gsbi8_mhl_sii9234_info[] =
+{
+	{
+		I2C_BOARD_INFO(MHL_SII9234_I2C_NAME, 0x72 >> 1),
+		.platform_data = &mhl_sii9234_device_data,
+		.irq = JET_GPIO_MHL_INT
+	},
+};
+#endif
+#endif
+
+static uint32_t usb_ID_PIN_input_table[] = {
+	GPIO_CFG(JET_GPIO_USB_ID1, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+
+static uint32_t usb_ID_PIN_ouput_table[] = {
+	GPIO_CFG(JET_GPIO_USB_ID1, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+
+void config_jet_usb_id_gpios(bool output)
+{
+	if (output) {
+		gpio_tlmm_config(usb_ID_PIN_ouput_table[0], GPIO_CFG_ENABLE);
+		gpio_set_value(JET_GPIO_USB_ID1, 1);
+		pr_info("[CABLE] %s: %d output high\n",  __func__, JET_GPIO_USB_ID1);
+	} else {
+		gpio_tlmm_config(usb_ID_PIN_input_table[0], GPIO_CFG_ENABLE);
+		pr_info("[CABLE] %s: %d input none pull\n",  __func__, JET_GPIO_USB_ID1);
+	}
+}
+
+int64_t jet_get_usbid_adc(void)
+{
+	struct pm8xxx_adc_chan_result result;
+	int err = 0, adc = 0;
+
+	err = pm8xxx_adc_mpp_config_read(PM8XXX_AMUX_MPP_7,
+					ADC_MPP_1_AMUX6, &result);
+	if (err) {
+		pr_info("[CABLE] %s: get adc fail, err %d\n", __func__, err);
+		return err;
+	}
+	pr_info("[CABLE] chan=%d, adc_code=%d, measurement=%lld, \
+			physical=%lld\n", result.chan, result.adc_code,
+			result.measurement, result.physical);
+	adc = result.physical;
+	return adc/1000;
+}
+
+static struct cable_detect_platform_data cable_detect_pdata = {
+	.detect_type		= CABLE_TYPE_PMIC_ADC,
+	.usb_id_pin_gpio	= JET_GPIO_USB_ID1,
+	.get_adc_cb		= jet_get_usbid_adc,
+	.config_usb_id_gpios	= config_jet_usb_id_gpios,
+	.mhl_reset_gpio = JET_GPIO_MHL_RSTz,
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+	.mhl_1v2_power = mhl_sii9234_1v2_power,
+	.usb_dpdn_switch	= jet_usb_dpdn_switch,
+#endif
+};
+
+static struct platform_device cable_detect_device = {
+	.name   = "cable_detect",
+	.id     = -1,
+	.dev    = {
+		.platform_data = &cable_detect_pdata,
+	},
+};
+
+static void jet_cable_detect_register(void)
+{
+	pr_info("%s\n", __func__);
+	platform_device_register(&cable_detect_device);
+}
+
+void jet_pm8xxx_adc_device_register(void)
+{
+	pr_info("%s: Register PM8921 ADC device\n", __func__);
+	headset_device_register();
+}
+
+#define MSM_SHARED_RAM_PHYS 0x80000000
+
+static void __init jet_map_io(void)
+{
+	msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
+	msm_map_msm8960_io();
+
+	if (socinfo_init() < 0)
+		pr_err("socinfo_init() failed!\n");
+}
+
+static void __init jet_init_irq(void)
+{
+	struct msm_mpm_device_data *data = NULL;
+
+#ifdef CONFIG_MSM_MPM
+	data = &msm8960_mpm_dev_data;
+#endif
+
+	msm_mpm_irq_extn_init(data);
+	gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
+						(void *)MSM_QGIC_CPU_BASE);
+
+	/* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
+	writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
+
+	writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
+	mb();
+}
+
+static void __init msm8960_init_buses(void)
+{
+#ifdef CONFIG_MSM_BUS_SCALING
+	msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
+	msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
+	msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
+	msm_bus_apps_fabric.dev.platform_data =
+		&msm_bus_8960_apps_fabric_pdata;
+	msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
+	msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
+	msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
+	msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
+	msm_bus_rpm_set_mt_mask();
+#endif
+}
+
+static struct msm_spi_platform_data msm8960_qup_spi_gsbi10_pdata = {
+	.max_clock_speed = 27000000,
+};
+
+#ifdef CONFIG_USB_MSM_OTG_72K
+static struct msm_otg_platform_data msm_otg_pdata;
+#else
+#define USB_5V_EN		JET_GPIO_V_BOOST_5V_EN
+
+static int msm_hsusb_vbus_power(bool on)
+{
+	int rc;
+	static bool vbus_is_on;
+	static struct regulator *mvs_otg_switch;
+	struct pm_gpio param = {
+		.direction	= PM_GPIO_DIR_OUT,
+		.output_buffer	= PM_GPIO_OUT_BUF_CMOS,
+		.output_value	= 1,
+		.pull		= PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength	= PM_GPIO_STRENGTH_MED,
+		.function	= PM_GPIO_FUNC_NORMAL,
+	};
+
+	if (vbus_is_on == on)
+		return 0;
+
+	printk(KERN_INFO "%s: %d\n", __func__, on);
+
+	if (on) {
+		mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
+					       "vbus_otg");
+		if (IS_ERR(mvs_otg_switch)) {
+			pr_err("Unable to get mvs_otg_switch\n");
+			return -1;
+		}
+
+		rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
+						"usb_5v_en");
+		if (rc < 0) {
+			pr_err("failed to request usb_5v_en gpio\n");
+			goto put_mvs_otg;
+		}
+
+		if (regulator_enable(mvs_otg_switch)) {
+			pr_err("unable to enable mvs_otg_switch\n");
+			goto free_usb_5v_en;
+		}
+
+		rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
+				&param);
+		if (rc < 0) {
+			pr_err("failed to configure usb_5v_en gpio\n");
+			goto disable_mvs_otg;
+		}
+		vbus_is_on = true;
+		return 0;
+	}
+disable_mvs_otg:
+		regulator_disable(mvs_otg_switch);
+free_usb_5v_en:
+		gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
+put_mvs_otg:
+		regulator_put(mvs_otg_switch);
+		vbus_is_on = false;
+		return -1;
+}
+
+static int phy_init_seq_v3[] = { 0x7f, 0x81, 0x3c, 0x82, -1};
+static int phy_init_seq_v3_2_1[] = { 0x5f, 0x81, 0x3c, 0x82, -1};
+
+static struct msm_otg_platform_data msm_otg_pdata = {
+	.phy_init_seq		= phy_init_seq_v3,
+	.mode			= USB_OTG,
+	.otg_control		= OTG_PMIC_CONTROL,
+	.phy_type		= SNPS_28NM_INTEGRATED_PHY,
+	/* .pmic_id_irq		= PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE), */
+	.vbus_power		= msm_hsusb_vbus_power,
+	.power_budget		= 750,
+	.ldo_power_collapse	= true,
+};
+#endif
+
+/* #ifdef CONFIG_USB_ANDROID_DIAG */
+#define PID_MAGIC_ID		0x71432909
+#define SERIAL_NUM_MAGIC_ID	0x61945374
+#define SERIAL_NUMBER_LENGTH	127
+#define DLOAD_USB_BASE_ADD	0x2A03F0C8
+
+struct magic_num_struct {
+	uint32_t pid;
+	uint32_t serial_num;
+};
+
+struct dload_struct {
+	uint32_t	reserved1;
+	uint32_t	reserved2;
+	uint32_t	reserved3;
+	uint16_t	reserved4;
+	uint16_t	pid;
+	char		serial_number[SERIAL_NUMBER_LENGTH];
+	uint16_t	reserved5;
+	struct magic_num_struct magic_struct;
+};
+
+static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
+{
+	struct dload_struct __iomem *dload = 0;
+
+	dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
+	if (!dload) {
+		pr_err("%s: cannot remap I/O memory region: %08x\n",
+					__func__, DLOAD_USB_BASE_ADD);
+		return -ENXIO;
+	}
+
+	pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
+				__func__, dload, pid, snum);
+	/* update pid */
+	dload->magic_struct.pid = PID_MAGIC_ID;
+	dload->pid = pid;
+
+	/* update serial number */
+	dload->magic_struct.serial_num = 0;
+	if (!snum) {
+		memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
+		goto out;
+	}
+
+	dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
+	strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
+out:
+	iounmap(dload);
+	return 0;
+}
+
+static struct android_usb_platform_data android_usb_pdata = {
+	.update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
+};
+
+static struct platform_device android_usb_device = {
+	.name	= "android_usb",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &android_usb_pdata,
+	},
+};
+
+#define VERSION_ID (readl(HW_VER_ID_VIRT) & 0xf0000000) >> 28
+#define HW_8960_V3_2_1   0x07
+void jet_add_usb_devices(void)
+{
+	if (VERSION_ID == HW_8960_V3_2_1) {
+		printk(KERN_INFO "%s rev: %d v3.2.1\n", __func__, system_rev);
+		msm_otg_pdata.phy_init_seq = phy_init_seq_v3_2_1;
+	} else {
+		printk(KERN_INFO "%s rev: %d\n", __func__, system_rev);
+		msm_otg_pdata.phy_init_seq = phy_init_seq_v3;
+	}
+	printk(KERN_INFO "%s: OTG_PMIC_CONTROL in rev: %d\n",
+			__func__, system_rev);
+}
+
+static uint8_t spm_wfi_cmd_sequence[] __initdata = {
+			0x03, 0x0f,
+};
+
+static uint8_t spm_retention_cmd_sequence[] __initdata = {
+			0x00, 0x05, 0x03, 0x0D,
+			0x0B, 0x00, 0x0f,
+};
+
+static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
+	0x42, 0x1B, 0x00,
+	0x05, 0x03, 0x0D, 0x0B,
+	0x00, 0x42, 0x1B,
+	0x0f,
+};
+
+static uint8_t spm_power_collapse_without_rpm[] __initdata = {
+			0x00, 0x24, 0x54, 0x10,
+			0x09, 0x03, 0x01,
+			0x10, 0x54, 0x30, 0x0C,
+			0x24, 0x30, 0x0f,
+};
+
+static uint8_t spm_power_collapse_with_rpm[] __initdata = {
+			0x00, 0x24, 0x54, 0x10,
+			0x09, 0x07, 0x01, 0x0B,
+			0x10, 0x54, 0x30, 0x0C,
+			0x24, 0x30, 0x0f,
+};
+
+/* 8960AB has a different command to assert apc_pdn */
+static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
+	0x00, 0x24, 0x84, 0x10,
+	0x09, 0x03, 0x01,
+	0x10, 0x84, 0x30, 0x0C,
+	0x24, 0x30, 0x0f,
+};
+
+static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
+	0x00, 0x24, 0x84, 0x10,
+	0x09, 0x07, 0x01, 0x0B,
+	0x10, 0x84, 0x30, 0x0C,
+	0x24, 0x30, 0x0f,
+};
+
+static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_MODE_CLOCK_GATING,
+		.notify_rpm = false,
+		.cmd = spm_wfi_cmd_sequence,
+	},
+
+	[1] = {
+		.mode = MSM_SPM_MODE_POWER_RETENTION,
+		.notify_rpm = false,
+		.cmd = spm_retention_cmd_sequence,
+	},
+
+	[2] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = false,
+		.cmd = spm_power_collapse_without_rpm,
+	},
+	[3] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = spm_power_collapse_with_rpm,
+	},
+};
+
+static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_MODE_CLOCK_GATING,
+		.notify_rpm = false,
+		.cmd = spm_wfi_cmd_sequence,
+	},
+
+	[1] = {
+		.mode = MSM_SPM_MODE_POWER_RETENTION,
+		.notify_rpm = false,
+		.cmd = spm_retention_cmd_sequence,
+	},
+
+	[2] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = false,
+		.cmd = spm_power_collapse_without_rpm,
+	},
+
+	[3] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = spm_power_collapse_with_rpm,
+	},
+};
+
+static struct msm_spm_platform_data msm_spm_data[] __initdata = {
+	[0] = {
+		.reg_base_addr = MSM_SAW0_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
+#if defined(CONFIG_MSM_AVS_HW)
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
+#endif
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
+		.vctl_timeout_us = 50,
+		.num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
+		.modes = msm_spm_boot_cpu_seq_list,
+	},
+	[1] = {
+		.reg_base_addr = MSM_SAW1_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
+#if defined(CONFIG_MSM_AVS_HW)
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
+#endif
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
+		.vctl_timeout_us = 50,
+		.num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
+		.modes = msm_spm_nonboot_cpu_seq_list,
+	},
+};
+
+static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
+			0x00, 0x20, 0x03, 0x20,
+			0x00, 0x0f,
+};
+
+static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
+			0x00, 0x20, 0x34, 0x64,
+			0x48, 0x07, 0x48, 0x20,
+			0x50, 0x64, 0x04, 0x34,
+			0x50, 0x0f,
+};
+static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
+			0x00, 0x10, 0x34, 0x64,
+			0x48, 0x07, 0x48, 0x10,
+			0x50, 0x64, 0x04, 0x34,
+			0x50, 0x0F,
+};
+
+static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_L2_MODE_RETENTION,
+		.notify_rpm = false,
+		.cmd = l2_spm_wfi_cmd_sequence,
+	},
+	[1] = {
+		.mode = MSM_SPM_L2_MODE_GDHS,
+		.notify_rpm = true,
+		.cmd = l2_spm_gdhs_cmd_sequence,
+	},
+	[2] = {
+		.mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = l2_spm_power_off_cmd_sequence,
+	},
+};
+
+static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
+	[0] = {
+		.reg_base_addr = MSM_SAW_L2_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
+		.modes = msm_spm_l2_seq_list,
+		.num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
+	},
+};
+
+#ifdef CONFIG_PERFLOCK
+static unsigned jet_perf_acpu_table[] = {
+	810000000, /* LOWEST */
+	918000000, /* LOW */
+	1026000000, /* MEDIUM */
+	1242000000,/* HIGH */
+	1512000000, /* HIGHEST */
+};
+
+static unsigned jet_cpufreq_ceiling_acpu_table[] = {
+	702000000,
+	918000000,
+	1026000000,
+};
+
+static struct perflock_data jet_perflock_data = {
+	.perf_acpu_table = jet_perf_acpu_table,
+	.table_size = ARRAY_SIZE(jet_perf_acpu_table),
+};
+
+static struct perflock_data jet_cpufreq_ceiling_data = {
+	.perf_acpu_table = jet_cpufreq_ceiling_acpu_table,
+	.table_size = ARRAY_SIZE(jet_cpufreq_ceiling_acpu_table),
+};
+
+static struct perflock_pdata perflock_pdata = {
+	.perf_floor = &jet_perflock_data,
+	.perf_ceiling = &jet_cpufreq_ceiling_data,
+};
+
+struct platform_device msm8960_device_perf_lock = {
+	.name = "perf_lock",
+	.id = -1,
+	.dev = {
+		.platform_data = &perflock_pdata,
+	},
+};
+#endif
+
+static uint32_t gsbi3_gpio_table[] = {
+	GPIO_CFG(JET_GPIO_TP_I2C_DAT, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(JET_GPIO_TP_I2C_CLK, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi3_gpio_table_gpio[] = {
+	GPIO_CFG(JET_GPIO_TP_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(JET_GPIO_TP_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+/* CAMERA setting */
+static uint32_t gsbi4_gpio_table[] = {
+	GPIO_CFG(JET_GPIO_CAM_I2C_DAT, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(JET_GPIO_CAM_I2C_CLK, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi4_gpio_table_gpio[] = {
+	GPIO_CFG(JET_GPIO_CAM_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(JET_GPIO_CAM_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi8_gpio_table[] = {
+	GPIO_CFG(JET_GPIO_MC_I2C_DAT, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(JET_GPIO_MC_I2C_CLK, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi8_gpio_table_gpio[] = {
+	GPIO_CFG(JET_GPIO_MC_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(JET_GPIO_MC_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi12_gpio_table[] = {
+	GPIO_CFG(JET_GPIO_SR_I2C_DAT, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(JET_GPIO_SR_I2C_CLK, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi12_gpio_table_gpio[] = {
+	GPIO_CFG(JET_GPIO_SR_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(JET_GPIO_SR_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
+{
+	printk(KERN_INFO "%s(): adap_id = %d, config_type = %d \n", __func__, adap_id, config_type);
+
+	if ((adap_id == MSM_8960_GSBI3_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi3_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi3_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI3_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi3_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi3_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+
+	/* CAMERA setting */
+	if ((adap_id == MSM_8960_GSBI4_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi4_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi4_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI4_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi4_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi4_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI8_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi8_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi8_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI8_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi8_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi8_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI12_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi12_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi12_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI12_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi12_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi12_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+}
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi5_pdata = {
+	.clk_freq = 100000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi8_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+//	.share_uart_flag = 1,	/* check if QUP-I2C and Uart share the gisb */
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct platform_device msm_device_saw_core0 = {
+	.name          = "saw-regulator",
+	.id            = 0,
+	.dev	= {
+		.platform_data = &msm_saw_regulator_pdata_s5,
+	},
+};
+
+static struct platform_device msm_device_saw_core1 = {
+	.name          = "saw-regulator",
+	.id            = 1,
+	.dev	= {
+		.platform_data = &msm_saw_regulator_pdata_s6,
+	},
+};
+
+static struct tsens_platform_data msm_tsens_pdata  = {
+		.slope			= {910, 910, 910, 910, 910},
+		.tsens_factor		= 1000,
+		.hw_type		= MSM_8960,
+		.tsens_num_sensor	= 5,
+};
+
+static struct platform_device msm_tsens_device = {
+	.name   = "tsens8960-tm",
+	.id = -1,
+};
+
+static struct msm_thermal_data msm_thermal_pdata = {
+	.sensor_id = 0,
+	.poll_ms = 1000,
+	.limit_temp_degC = 60,
+	.temp_hysteresis_degC = 10,
+	//	.limit_freq = 918000,
+	.freq_step = 2,
+};
+
+#ifdef CONFIG_MSM_FAKE_BATTERY
+static struct platform_device fish_battery_device = {
+	.name = "fish_battery",
+};
+#endif
+
+static struct platform_device scm_memchk_device = {
+	.name		= "scm-memchk",
+	.id		= -1,
+};
+
+static struct platform_device jet_device_rpm_regulator __devinitdata = {
+	.name	= "rpm-regulator",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &jet_rpm_regulator_pdata,
+	},
+};
+
+static struct platform_device *common_devices[] __initdata = {
+	&msm8960_device_acpuclk,
+	&msm8960_device_dmov,
+	&msm_device_smd,
+	&msm8960_device_uart_gsbi8,
+	&msm_device_uart_dm6,
+	&msm_device_saw_core0,
+	&msm_device_saw_core1,
+	&msm8960_device_ext_5v_vreg,
+	&msm8960_device_qup_i2c_gsbi3,
+	&msm8960_device_qup_i2c_gsbi4,
+	&msm8960_device_qup_i2c_gsbi5,
+	&msm8960_device_qup_i2c_gsbi8,
+	&msm8960_device_qup_spi_gsbi10,
+#ifndef CONFIG_MSM_DSPS
+	&msm8960_device_qup_i2c_gsbi12,
+#endif
+	&msm8960_device_ssbi_pmic,
+	&msm_slim_ctrl,
+	&msm_device_wcnss_wlan,
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
+	&qcrypto_device,
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+	&qcedev_device,
+#endif
+#ifdef CONFIG_MSM_ROTATOR
+	&msm_rotator_device,
+#endif
+	&msm8960_cpu_slp_status,
+	&msm_device_sps,
+#ifdef CONFIG_MSM_FAKE_BATTERY
+	&fish_battery_device,
+#endif
+	&fmem_device,
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	&android_pmem_device,
+	&android_pmem_adsp_device,
+	&android_pmem_audio_device,
+#endif
+#endif
+	&msm_device_vidc,
+	&msm_device_bam_dmux,
+	&msm_fm_platform_init,
+#ifdef CONFIG_HW_RANDOM_MSM
+	&msm_device_rng,
+#endif
+#ifdef CONFIG_ION_MSM
+	&ion_dev,
+#endif
+	&msm8960_rpm_device,
+	&msm8960_rpm_log_device,
+	&msm8960_rpm_stat_device,
+#ifdef CONFIG_MSM_QDSS
+	&msm_etb_device,
+	&msm_tpiu_device,
+	&msm_funnel_device,
+	&msm_etm_device,
+#endif
+	&msm8960_device_watchdog,
+#ifdef CONFIG_MSM_RTB
+	&msm_rtb_device,
+#endif
+	&msm8960_device_cache_erp,
+	&msm8960_iommu_domain_device,
+#ifdef CONFIG_MSM_CACHE_DUMP
+	&msm_cache_dump_device,
+#endif
+#ifdef CONFIG_HTC_BATT_8960
+	&htc_battery_pdev,
+#endif
+	&msm_tsens_device,
+};
+
+static struct platform_device *jet_devices[] __initdata = {
+	&msm_8960_q6_lpass,
+	&msm_8960_q6_mss_fw,
+	&msm_8960_q6_mss_sw,
+	&msm_8960_riva,
+	&msm_pil_tzapps,
+	&msm8960_device_otg,
+	&msm8960_device_gadget_peripheral,
+	&msm_device_hsusb_host,
+	&android_usb_device,
+	&msm_pcm,
+	&msm_pcm_routing,
+	&msm_multi_ch_pcm,
+	&msm_cpudai0,
+	&msm_cpudai1,
+	&msm8960_cpudai_slimbus_2_tx,
+	&msm8960_cpudai_slimbus_2_rx,
+	&msm_cpudai_hdmi_rx,
+	&msm_cpudai_bt_rx,
+	&msm_cpudai_bt_tx,
+	&msm_cpudai_fm_rx,
+	&msm_cpudai_fm_tx,
+	&msm_cpudai_auxpcm_rx,
+	&msm_cpudai_auxpcm_tx,
+	&msm_cpu_fe,
+	&msm_stub_codec,
+#ifdef CONFIG_MSM_GEMINI
+	&msm8960_gemini_device,
+#endif
+	&msm_voice,
+	&msm_voip,
+	&msm_lpa_pcm,
+	&msm_cpudai_afe_01_rx,
+	&msm_cpudai_afe_01_tx,
+	&msm_cpudai_afe_02_rx,
+	&msm_cpudai_afe_02_tx,
+	&msm_pcm_afe,
+	&msm_compr_dsp,
+	&msm_cpudai_incall_music_rx,
+	&msm_cpudai_incall_record_rx,
+	&msm_cpudai_incall_record_tx,
+	&msm_pcm_hostless,
+	&msm_lowlatency_pcm,
+	&msm_bus_apps_fabric,
+	&msm_bus_sys_fabric,
+	&msm_bus_mm_fabric,
+	&msm_bus_sys_fpb,
+	&msm_bus_cpss_fpb,
+	&msm_device_tz_log,
+#ifdef CONFIG_PERFLOCK
+	&msm8960_device_perf_lock,
+#endif
+	&scm_memchk_device,
+};
+
+static void __init msm8960_i2c_init(void)
+{
+	msm8960_device_qup_i2c_gsbi4.dev.platform_data =
+					&msm8960_i2c_qup_gsbi4_pdata;
+
+	msm8960_device_qup_i2c_gsbi3.dev.platform_data =
+					&msm8960_i2c_qup_gsbi3_pdata;
+
+	msm8960_device_qup_i2c_gsbi5.dev.platform_data =
+					&msm8960_i2c_qup_gsbi5_pdata;
+
+	msm8960_device_qup_i2c_gsbi8.dev.platform_data =
+					&msm8960_i2c_qup_gsbi8_pdata;
+
+	msm8960_device_qup_i2c_gsbi12.dev.platform_data =
+					&msm8960_i2c_qup_gsbi12_pdata;
+}
+
+static void __init msm8960_gfx_init(void)
+{
+	struct kgsl_device_platform_data *kgsl_3d0_pdata =
+		msm_kgsl_3d0.dev.platform_data;
+	uint32_t soc_platform_version = socinfo_get_version();
+
+	/* Fixup data that needs to change based on GPU ID */
+	if (cpu_is_msm8960ab()) {
+		kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
+		/* 8960PRO nominal clock rate is 320Mhz */
+		kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 320000000;
+	} else {
+		kgsl_3d0_pdata->iommu_count = 1;
+		if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
+			kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
+			kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
+		}
+		if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
+			/* 8960v3 GPU registers returns 5 for patch release
+			 * but it should be 6, so dummy up the chipid here
+			 * based the platform type
+			 */
+			kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
+		}
+	}
+
+	/* Register the 3D core */
+	platform_device_register(&msm_kgsl_3d0);
+
+	/* Register the 2D cores if we are not 8960PRO */
+	if (!cpu_is_msm8960ab()) {
+		platform_device_register(&msm_kgsl_2d0);
+		platform_device_register(&msm_kgsl_2d1);
+	}
+}
+
+#ifdef CONFIG_HTC_BATT_8960
+static struct pm8921_charger_batt_param chg_batt_params[] = {
+	[0] = {
+		.max_voltage = 4200,
+		.cool_bat_voltage = 4200,
+		.warm_bat_voltage = 4000,
+	},
+	[1] = {
+		.max_voltage = 4340,
+		.cool_bat_voltage = 4340,
+		.warm_bat_voltage = 4000,
+	},
+	[2] = {
+		.max_voltage = 4300,
+		.cool_bat_voltage = 4300,
+		.warm_bat_voltage = 4000,
+	},
+	[3] = {
+		.max_voltage = 4350,
+		.cool_bat_voltage = 4350,
+		.warm_bat_voltage = 4000,
+	},
+};
+
+static struct single_row_lut fcc_temp_id_1 = {
+	.x	= {-20, -10, 0, 10, 20, 30, 40},
+	.y	= {1000, 1060, 1110, 1580, 1940, 1960, 1980},
+	.cols	= 7,
+};
+
+static struct single_row_lut fcc_sf_id_1 = {
+	.x	= {100, 200, 300, 400, 500},
+	.y	= {100, 100, 100, 100, 100},
+	.cols	= 5,
+};
+
+static struct sf_lut pc_sf_id_1 = {
+	.rows		= 10,
+	.cols		= 5,
+	.row_entries	= {100, 200, 300, 400, 500},
+	.percent	= {100, 90, 80, 70, 60, 50, 40, 30, 20, 10},
+	.sf		= {
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100}
+	},
+};
+
+static struct pc_temp_ocv_lut  pc_temp_ocv_id_1 = {
+	.rows		= 29,
+	.cols		= 7,
+	.temp		= {-20, -10,  0, 10, 20, 30, 40},
+	.percent	= {100, 95, 90, 85, 80, 75, 70, 65, 60, 55,
+				50, 45, 40, 35, 30, 25, 20, 15, 10, 9,
+				8, 7, 6, 5, 4, 3, 2, 1, 0
+	},
+	.ocv		= {
+			{4150, 4150, 4150, 4150, 4150, 4150, 4150},
+			{4147, 4146, 4144, 4134, 4133, 4133, 4133},
+			{4119, 4114, 4109, 4091, 4088, 4088, 4088},
+			{4090, 4084, 4077, 4052, 4047, 4047, 4047},
+			{4063, 4055, 4046, 4015, 4008, 4008, 4008},
+			{4037, 4027, 4017, 3982, 3974, 3974, 3974},
+			{4012, 4001, 3990, 3952, 3943, 3943, 3943},
+			{3989, 3977, 3965, 3925, 3916, 3916, 3916},
+			{3968, 3955, 3942, 3898, 3885, 3885, 3885},
+			{3947, 3933, 3918, 3859, 3843, 3843, 3843},
+			{3925, 3908, 3890, 3828, 3818, 3818, 3818},
+			{3902, 3882, 3862, 3809, 3801, 3801, 3801},
+			{3879, 3859, 3838, 3796, 3788, 3788, 3788},
+			{3857, 3839, 3821, 3785, 3778, 3778, 3778},
+			{3839, 3824, 3808, 3776, 3770, 3770, 3770},
+			{3824, 3810, 3796, 3770, 3759, 3759, 3759},
+			{3812, 3800, 3788, 3761, 3739, 3739, 3739},
+			{3801, 3791, 3781, 3745, 3707, 3707, 3707},
+			{3793, 3784, 3775, 3712, 3675, 3675, 3675},
+			{3792, 3783, 3774, 3706, 3668, 3668, 3668},
+			{3791, 3782, 3773, 3700, 3660, 3660, 3660},
+			{3789, 3781, 3772, 3693, 3653, 3653, 3653},
+			{3788, 3780, 3771, 3687, 3645, 3645, 3645},
+			{3786, 3778, 3769, 3680, 3637, 3637, 3637},
+			{3785, 3777, 3768, 3678, 3627, 3627, 3627},
+			{3784, 3776, 3767, 3675, 3616, 3616, 3616},
+			{3783, 3774, 3765, 3673, 3605, 3605, 3605},
+			{3781, 3772, 3763, 3668, 3584, 3584, 3584},
+			{3781, 3772, 3762, 3667, 3583, 3583, 3583}
+	},
+};
+
+struct pm8921_bms_battery_data  bms_battery_data_id_1 = {
+	.fcc			= 2000,
+	.fcc_temp_lut		= &fcc_temp_id_1,
+	.fcc_sf_lut		= &fcc_sf_id_1,
+	.pc_temp_ocv_lut	= &pc_temp_ocv_id_1,
+	.pc_sf_lut		= &pc_sf_id_1,
+};
+
+
+static struct single_row_lut fcc_temp_id_2 = {
+	.x	= {-20, -10, 0, 10, 20, 30, 40},
+	.y	= {1080, 1280, 1460, 1650, 1930, 1960, 1980},
+	.cols	= 7,
+};
+
+static struct single_row_lut fcc_sf_id_2 = {
+	.x	= {100, 200, 300, 400, 500},
+	.y	= {100, 100, 100, 100, 100},
+	.cols	= 5,
+};
+
+static struct sf_lut pc_sf_id_2 = {
+	.rows		= 10,
+	.cols		= 5,
+	.row_entries	= {100, 200, 300, 400, 500},
+	.percent	= {100, 90, 80, 70, 60, 50, 40, 30, 20, 10},
+	.sf		= {
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100}
+	},
+};
+
+static struct pc_temp_ocv_lut  pc_temp_ocv_id_2 = {
+	.rows		= 29,
+	.cols		= 7,
+	.temp		= {-20, -10,  0, 10, 20, 30, 40},
+	.percent	= {100, 95, 90, 85, 80, 75, 70, 65, 60, 55,
+				50, 45, 40, 35, 30, 25, 20, 15, 10, 9,
+				8, 7, 6, 5, 4, 3, 2, 1, 0
+	},
+	.ocv		= {
+			{4150, 4150, 4150, 4150, 4150, 4150, 4150},
+			{4155, 4155, 4152, 4149, 4146, 4142, 4142},
+			{4123, 4123, 4113, 4107, 4101, 4095, 4095},
+			{4091, 4091, 4078, 4068, 4061, 4053, 4053},
+			{4061, 4061, 4044, 4032, 4023, 4013, 4013},
+			{4034, 4034, 4014, 4000, 3990, 3979, 3979},
+			{4008, 4008, 3986, 3971, 3960, 3948, 3948},
+			{3983, 3983, 3959, 3943, 3931, 3919, 3919},
+			{3961, 3961, 3935, 3918, 3905, 3891, 3891},
+			{3928, 3928, 3899, 3878, 3859, 3840, 3840},
+			{3915, 3915, 3880, 3854, 3836, 3818, 3818},
+			{3895, 3895, 3855, 3829, 3816, 3802, 3802},
+			{3872, 3872, 3831, 3810, 3800, 3789, 3789},
+			{3851, 3851, 3815, 3798, 3789, 3779, 3779},
+			{3834, 3834, 3803, 3787, 3779, 3771, 3771},
+			{3814, 3814, 3786, 3773, 3767, 3760, 3760},
+			{3790, 3790, 3766, 3755, 3747, 3739, 3739},
+			{3759, 3759, 3739, 3729, 3716, 3703, 3703},
+			{3760, 3760, 3742, 3731, 3705, 3679, 3679},
+			{3762, 3762, 3744, 3732, 3704, 3676, 3676},
+			{3764, 3764, 3746, 3733, 3703, 3673, 3673},
+			{3767, 3767, 3750, 3736, 3703, 3671, 3671},
+			{3769, 3769, 3752, 3737, 3702, 3668, 3668},
+			{3771, 3771, 3754, 3738, 3702, 3665, 3665},
+			{3699, 3699, 3682, 3663, 3628, 3592, 3592},
+			{3628, 3628, 3611, 3589, 3554, 3519, 3519},
+			{3556, 3556, 3538, 3514, 3480, 3446, 3446},
+			{3486, 3486, 3468, 3438, 3406, 3373, 3373},
+			{3414, 3414, 3395, 3365, 3333, 3300, 3300}
+
+	},
+};
+
+struct pm8921_bms_battery_data  bms_battery_data_id_2 = {
+	.fcc			= 2000,
+	.fcc_temp_lut		= &fcc_temp_id_2,
+	.fcc_sf_lut		= &fcc_sf_id_2,
+	.pc_temp_ocv_lut	= &pc_temp_ocv_id_2,
+	.pc_sf_lut		= &pc_sf_id_2,
+};
+
+static struct htc_battery_cell htc_battery_cells[] = {
+	[0] = {
+		.model_name = "BJ83100",
+		.capacity = 2000,
+		.id = 1,
+		.id_raw_min = 73, /* unit:mV (10kohm) */
+		.id_raw_max = 204,
+		.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+		.voltage_max = 4200,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[0],
+		.gauge_param = &bms_battery_data_id_1,
+	},
+	[1] = {
+		.model_name = "BJ83100",
+		.capacity = 2000,
+		.id = 2,
+		.id_raw_min = 205, /* unit:mV (22kohm) */
+		.id_raw_max = 595,
+		.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+		.voltage_max = 4200,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[0],
+		.gauge_param = &bms_battery_data_id_2,
+	},
+	[2] = {
+		.model_name = "UNKNOWN",
+		.capacity = 2000,
+		.id = 255,
+		.id_raw_min = INT_MIN,
+		.id_raw_max = INT_MAX,
+		.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+		.voltage_max = 4200,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[0],
+		.gauge_param = NULL,
+	},
+};
+#endif /* CONFIG_HTC_BATT_8960 */
+
+/* HTC Change: Create wcnss gpio array since gpiomux table was moved
+ * to board-gpio file. Note that driver team can choose to either
+ * create such table or request each gpio by itself.
+ */
+#if 0
+static unsigned msm_wcnss_gpio_tbl[] = {
+	JET_GPIO_WCN_CMD_DATA2,
+	JET_GPIO_WCN_CMD_DATA1,
+	JET_GPIO_WCN_CMD_DATA0,
+	JET_GPIO_WCN_CMD_SET,
+	JET_GPIO_WCN_CMD_CLK,
+};
+static void msm8960_wcnss_init(void)
+{
+	int i, ret, j;
+
+	for (i = 0; i < ARRAY_SIZE(msm_wcnss_gpio_tbl); i++) {
+		ret = gpio_request(msm_wcnss_gpio_tbl[i],
+				"wcnss_5_wire");
+		if (ret) {
+			pr_err("wcnss_5_wire gpio %d failed: %d\n",
+				msm_wcnss_gpio_tbl[i], ret);
+			goto fail;
+		}
+	}
+
+	pr_info("%s: Iris 5-wire gpios configured\n", __func__);
+
+	return;
+
+fail:
+	for (j = 0; j < i; j++)
+		gpio_free(msm_wcnss_gpio_tbl[j]);
+}
+#endif
+
+static struct msm_rpmrs_level msm_rpmrs_levels[] = {
+	{
+		MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		1, 784, 180000, 100,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_RETENTION,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		415, 715, 340827, 475,
+	},
+#ifdef CONFIG_MSM_STANDALONE_POWER_COLLAPSE
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		1300, 228, 1200000, 2000,
+	},
+#endif
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
+		false,
+		2000, 138, 1208400, 3200,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
+		false,
+		6000, 119, 1850300, 9000,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
+		false,
+		9200, 68, 2839200, 16400,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
+		false,
+		10300, 63, 3128000, 18200,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
+		false,
+		18000, 10, 4602600, 27000,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
+		false,
+		20000, 2, 5752000, 32000,
+	},
+};
+
+
+static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
+	.levels = &msm_rpmrs_levels[0],
+	.num_levels = ARRAY_SIZE(msm_rpmrs_levels),
+	.vdd_mem_levels  = {
+		[MSM_RPMRS_VDD_MEM_RET_LOW]	= 750000,
+		[MSM_RPMRS_VDD_MEM_RET_HIGH]	= 750000,
+		[MSM_RPMRS_VDD_MEM_ACTIVE]	= 1050000,
+		[MSM_RPMRS_VDD_MEM_MAX]		= 1150000,
+	},
+	.vdd_dig_levels = {
+		[MSM_RPMRS_VDD_DIG_RET_LOW]	= 500000,
+		[MSM_RPMRS_VDD_DIG_RET_HIGH]	= 750000,
+		[MSM_RPMRS_VDD_DIG_ACTIVE]	= 950000,
+		[MSM_RPMRS_VDD_DIG_MAX]		= 1150000,
+	},
+	.vdd_mask = 0x7FFFFF,
+	.rpmrs_target_id = {
+		[MSM_RPMRS_ID_PXO_CLK]		= MSM_RPM_ID_PXO_CLK,
+		[MSM_RPMRS_ID_L2_CACHE_CTL]	= MSM_RPM_ID_LAST,
+		[MSM_RPMRS_ID_VDD_DIG_0]	= MSM_RPM_ID_PM8921_S3_0,
+		[MSM_RPMRS_ID_VDD_DIG_1]	= MSM_RPM_ID_PM8921_S3_1,
+		[MSM_RPMRS_ID_VDD_MEM_0]	= MSM_RPM_ID_PM8921_L24_0,
+		[MSM_RPMRS_ID_VDD_MEM_1]	= MSM_RPM_ID_PM8921_L24_1,
+		[MSM_RPMRS_ID_RPM_CTL]		= MSM_RPM_ID_RPM_CTL,
+	},
+};
+
+static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
+	.mode = MSM_PM_BOOT_CONFIG_TZ,
+};
+
+#ifdef CONFIG_I2C
+#define I2C_SURF 1
+#define I2C_FFA  (1 << 1)
+#define I2C_RUMI (1 << 2)
+#define I2C_SIM  (1 << 3)
+#define I2C_FLUID (1 << 4)
+
+struct i2c_registry {
+	u8                     machs;
+	int                    bus;
+	struct i2c_board_info *info;
+	int                    len;
+};
+
+static struct i2c_registry msm8960_i2c_devices[] __initdata = {
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI8_QUP_I2C_BUS_ID,
+		msm_i2c_gsbi8_mhl_sii9234_info,
+		ARRAY_SIZE(msm_i2c_gsbi8_mhl_sii9234_info),
+	},
+#endif
+#endif
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI3_QUP_I2C_BUS_ID,
+		msm_i2c_gsbi3_info,
+		ARRAY_SIZE(msm_i2c_gsbi3_info),
+	},
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+		i2c_CM36282_devices,
+		ARRAY_SIZE(i2c_CM36282_devices),
+	},
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+		pn544_i2c_boardinfo,
+		ARRAY_SIZE(pn544_i2c_boardinfo),
+	},
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+		i2c_tps61310_flashlight,
+		ARRAY_SIZE(i2c_tps61310_flashlight),
+	},
+#endif
+};
+#endif /* CONFIG_I2C */
+
+extern int gy_type; /* from devices_htc.c */
+static void __init register_i2c_devices(void)
+{
+#ifdef CONFIG_I2C
+	u8 mach_mask = 0;
+	int i, rc;
+
+	mach_mask = I2C_SURF;
+
+	/* Run the array and install devices as appropriate */
+	for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
+		if (msm8960_i2c_devices[i].machs & mach_mask) {
+			i2c_register_board_info(msm8960_i2c_devices[i].bus,
+						msm8960_i2c_devices[i].info,
+						msm8960_i2c_devices[i].len);
+		}
+	}
+
+	if ((system_rev < 1 && engineerid == 0) || (system_rev >= 1 && engineerid == 1)) {
+		if (board_mfg_mode() == 1) {
+			for (i = 0; i < ARRAY_SIZE(evita_syn_ts_3k_data); i++)
+				evita_syn_ts_3k_data[i].mfg_flag = 1;
+		}
+		for (rc = 0; rc < ARRAY_SIZE(msm_i2c_gsbi3_info); rc++) {
+			if (!strcmp(msm_i2c_gsbi3_info[rc].type, SYNAPTICS_3200_NAME))
+				msm_i2c_gsbi3_info[rc].platform_data = &evita_syn_ts_3k_data;
+		}
+	} else {
+		if (board_mfg_mode() == 1) {
+			for (i = 0; i < ARRAY_SIZE(syn_ts_3k_data);  i++)
+				syn_ts_3k_data[i].mfg_flag = 1;
+		}
+	}
+
+	printk(KERN_DEBUG "%s: gy_type = %d\n", __func__, gy_type);
+
+	if (gy_type == 2) {
+		i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+				msm_i2c_sensor_gsbi12_info,
+				ARRAY_SIZE(msm_i2c_sensor_gsbi12_info));
+	} else {
+		i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+				mpu3050_GSBI12_boardinfo,
+				ARRAY_SIZE(mpu3050_GSBI12_boardinfo));
+	}
+#endif
+}
+
+static void __init msm8960ab_update_krait_spm(void)
+{
+	int i;
+
+
+	/* Update the SPM sequences for SPC and PC */
+	for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
+		int j;
+		struct msm_spm_platform_data *pdata = &msm_spm_data[i];
+		for (j = 0; j < pdata->num_modes; j++) {
+			if (pdata->modes[j].cmd ==
+					spm_power_collapse_without_rpm)
+				pdata->modes[j].cmd =
+				spm_power_collapse_without_rpm_krait_v3;
+			else if (pdata->modes[j].cmd ==
+					spm_power_collapse_with_rpm)
+				pdata->modes[j].cmd =
+				spm_power_collapse_with_rpm_krait_v3;
+		}
+	}
+}
+
+static void __init msm8960ab_update_retention_spm(void)
+{
+	int i;
+
+	/* Update the SPM sequences for krait retention on all cores */
+	for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
+		int j;
+		struct msm_spm_platform_data *pdata = &msm_spm_data[i];
+		for (j = 0; j < pdata->num_modes; j++) {
+			if (pdata->modes[j].cmd ==
+					spm_retention_cmd_sequence)
+				pdata->modes[j].cmd =
+				spm_retention_with_krait_v3_cmd_sequence;
+		}
+	}
+}
+
+/*UART -> GSBI8*/
+static uint32_t msm_uart_gpio[] = {
+	GPIO_CFG(34, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(35, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA),
+};
+static void msm_uart_gsbi_gpio_init(void)
+{
+	gpio_tlmm_config(msm_uart_gpio[0], GPIO_CFG_ENABLE);
+	gpio_tlmm_config(msm_uart_gpio[1], GPIO_CFG_ENABLE);
+}
+
+static uint32_t msm_region_gpio[] = {
+	GPIO_CFG(JET_GPIO_REGION_ID, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, 0),
+};
+static void msm_region_id_gpio_init(void)
+{
+	gpio_tlmm_config(msm_region_gpio[0], GPIO_CFG_ENABLE);
+}
+
+#ifdef CONFIG_RAWCHIP
+static struct spi_board_info rawchip_spi_board_info[] __initdata = {
+	{
+		.modalias               = "spi_rawchip",
+		.max_speed_hz           = 27000000,
+		.bus_num                = 1,
+		.chip_select            = 0,
+		.mode                   = SPI_MODE_0,
+	},
+};
+#endif
+
+static void __init jet_init(void)
+{
+	int rc = 0;
+	u32 hw_ver_id = 0;
+	struct kobject *properties_kobj;
+
+	if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
+		pr_err("meminfo_init() failed!\n");
+
+	htc_add_ramconsole_devices();
+	platform_device_register(&msm_gpio_device);
+
+	msm_tsens_early_init(&msm_tsens_pdata);
+	msm_thermal_init(&msm_thermal_pdata);
+	BUG_ON(msm_rpm_init(&msm8960_rpm_data));
+	BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
+
+	regulator_suppress_info_printing();
+	if (msm_xo_init())
+		pr_err("Failed to initialize XO votes\n");
+	platform_device_register(&jet_device_rpm_regulator);
+	msm_clock_init(&msm8960_clock_init_data);
+	msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
+	android_usb_pdata.swfi_latency =
+		msm_rpmrs_levels[0].latency_us;
+	jet_gpiomux_init();
+	msm8960_device_qup_spi_gsbi10.dev.platform_data =
+		&msm8960_qup_spi_gsbi10_pdata;
+#ifdef CONFIG_RAWCHIP
+	spi_register_board_info(rawchip_spi_board_info,
+			ARRAY_SIZE(rawchip_spi_board_info));
+#endif
+	jet_init_pmic();
+	msm8960_i2c_init();
+	msm8960_gfx_init();
+	if (cpu_is_msm8960ab())
+		msm8960ab_update_krait_spm();
+	if (cpu_is_krait_v3()) {
+		msm_pm_set_tz_retention_flag(0);
+		msm8960ab_update_retention_spm();
+	} else {
+		msm_pm_set_tz_retention_flag(1);
+	}
+	msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
+	msm_spm_l2_init(msm_spm_l2_data);
+	msm8960_init_buses();
+
+	jet_cable_detect_register();
+
+#ifdef CONFIG_BT
+	bt_export_bd_address();
+#endif
+#ifdef CONFIG_HTC_BATT_8960
+	htc_battery_cell_init(htc_battery_cells, ARRAY_SIZE(htc_battery_cells));
+#endif /* CONFIG_HTC_BATT_8960 */
+
+	platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
+	platform_device_register(&msm8960_device_ext_l2_vreg);
+
+	platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
+
+	msm_uart_gsbi_gpio_init();
+	jet_pm8921_gpio_mpp_init();
+	msm_region_id_gpio_init();
+	platform_add_devices(jet_devices, ARRAY_SIZE(jet_devices));
+	jet_init_camera();
+	jet_init_mmc();
+	register_i2c_devices();
+	jet_init_fb();
+	slim_register_board_info(msm_slim_devices,
+			ARRAY_SIZE(msm_slim_devices));
+	BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
+
+//	msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
+
+	/*usb driver won't be loaded in MFG 58 station and gift mode*/
+	if (!(board_mfg_mode() == 6 || board_mfg_mode() == 7))
+		jet_add_usb_devices();
+
+	properties_kobj = kobject_create_and_add("board_properties", NULL);
+	if (properties_kobj) {
+		if (system_rev < 1)
+			rc = sysfs_create_group(properties_kobj, &properties_attr_group);
+		else
+			rc = sysfs_create_group(properties_kobj, &three_virtual_key_properties_attr_group);
+	}
+
+	jet_init_keypad();
+	hw_ver_id = readl(HW_VER_ID_VIRT);
+	printk(KERN_INFO "hw_ver_id = %x\n", hw_ver_id);
+}
+
+#define PHY_BASE_ADDR1  0x80400000
+#define SIZE_ADDR1      (132 * 1024 * 1024)
+
+#define PHY_BASE_ADDR2  0x90000000
+#define SIZE_ADDR2      (768 * 1024 * 1024)
+
+static void __init jet_fixup(struct tag *tags,
+		char **cmdline, struct meminfo *mi)
+{
+	engineerid = parse_tag_engineerid(tags);
+	mi->nr_banks = 2;
+	mi->bank[0].start = PHY_BASE_ADDR1;
+	mi->bank[0].size = SIZE_ADDR1;
+	mi->bank[1].start = PHY_BASE_ADDR2;
+	mi->bank[1].size = SIZE_ADDR2;
+
+	skuid = parse_tag_skuid((const struct tag *)tags);
+	printk(KERN_INFO "Jet_fixup:skuid=0x%x\n", skuid);
+}
+
+static int __init pm8921_late_init(void)
+{
+	return 0;
+}
+
+late_initcall(pm8921_late_init);
+
+MACHINE_START(JET, "jet")
+	.fixup = jet_fixup,
+	.map_io = jet_map_io,
+	.reserve = jet_reserve,
+	.init_irq = jet_init_irq,
+	.handle_irq = gic_handle_irq,
+	.timer = &msm_timer,
+	.init_machine = jet_init,
+	.init_early = msm8960_allocate_memory_regions,
+	.init_very_early = jet_early_memory,
+	.restart = msm_restart,
+MACHINE_END
diff --git a/arch/arm/mach-msm/htc/jet/board-jet.h b/arch/arm/mach-msm/htc/jet/board-jet.h
new file mode 100644
index 0000000..c09a0c0
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/board-jet.h
@@ -0,0 +1,362 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ARCH_ARM_MACH_MSM_BOARD_JET_H
+#define __ARCH_ARM_MACH_MSM_BOARD_JET_H
+
+#include <mach/irqs.h>
+#include <mach/rpm-regulator.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <mach/msm_memtypes.h>
+#ifdef CONFIG_MSM_RTB
+#include <mach/msm_rtb.h>
+#endif
+#ifdef CONFIG_MSM_CACHE_DUMP
+#include <mach/msm_cache_dump.h>
+#endif
+
+/* Macros assume PMIC GPIOs and MPPs start at 1 */
+#define PM8921_GPIO_BASE		NR_GPIO_IRQS
+#define PM8921_GPIO_PM_TO_SYS(pm_gpio)	(pm_gpio - 1 + PM8921_GPIO_BASE)
+#define PM8921_MPP_BASE			(PM8921_GPIO_BASE + PM8921_NR_GPIOS)
+#define PM8921_MPP_PM_TO_SYS(pm_gpio)	(pm_gpio - 1 + PM8921_MPP_BASE)
+#define PM8921_IRQ_BASE			(NR_MSM_IRQS + NR_GPIO_IRQS)
+
+#define JET_LAYOUTS			{\
+		{ { 0,  1, 0}, {-1,  0,  0}, {0, 0,  1} }, \
+		{ { 0, -1, 0}, { 1,  0,  0}, {0, 0, -1} }, \
+		{ {-1,  0, 0}, { 0, -1,  0}, {0, 0,  1} }, \
+		{ {-1,  0, 0}, { 0,  0, -1}, {0, 1,  0} }  \
+					}
+
+extern struct regulator_init_data msm_saw_regulator_pdata_s5;
+extern struct regulator_init_data msm_saw_regulator_pdata_s6;
+
+extern struct rpm_regulator_platform_data jet_rpm_regulator_pdata __devinitdata;
+
+extern struct platform_device msm8960_device_ext_5v_vreg __devinitdata;
+extern struct platform_device msm8960_device_ext_l2_vreg __devinitdata;
+extern struct platform_device msm8960_device_rpm_regulator __devinitdata;
+extern struct pm8xxx_regulator_platform_data
+	msm_pm8921_regulator_pdata[] __devinitdata;
+
+extern int msm_pm8921_regulator_pdata_len __devinitdata;
+
+#define GPIO_VREG_ID_EXT_5V		0
+#define GPIO_VREG_ID_EXT_L2		1
+#define GPIO_VREG_ID_EXT_3P3V           2
+
+/* EVM */
+#define JET_GPIO_SIM_HOTSWAP			(3)
+#define JET_GPIO_RAFT_UP_EN_CPU			(10)
+#define JET_GPIO_NFC_I2C_SDA			(12)
+#define JET_GPIO_NFC_I2C_SCL			(13)
+#define JET_GPIO_NC_GPIO_14			(14)
+#define JET_GPIO_SIM_CD				(15)
+#define JET_GPIO_TP_I2C_DAT			(16)
+#define JET_GPIO_TP_I2C_CLK			(17)
+#define JET_GPIO_CAM_I2C_DAT			(20)
+#define JET_GPIO_CAM_I2C_CLK			(21)
+#define JET_GPIO_AC_I2C_SDA			(36)
+#define JET_GPIO_AC_I2C_SCL			(37)
+#define JET_GPIO_SENSOR_I2C_SDA			(44)
+#define JET_GPIO_SENSOR_I2C_SCL			(45)
+#define JET_GPIO_MAIN_CAM_ID			(47)
+#define JET_GPIO_NC_GPIO_55			(55)
+#define JET_GPIO_NC_GPIO_69			(69)
+#define JET_GPIO_MCAM_CLK_ON			(75)
+#define JET_GPIO_CAM2_STANDBY			(76)
+#define JET_GPIO_NC_GPIO_80			(80)
+#define JET_GPIO_NC_GPIO_82			(82)
+#define JET_GPIO_USBz_AUDIO_SW			(89)
+#define JET_GPIO_NC_GPIO_90			(90)
+#define JET_GPIO_NC_GPIO_92			(92)
+#define JET_GPIO_NC_GPIO_93			(93)
+#define JET_GPIO_V_CAM_D1V2_EN			(95)
+#define JET_GPIO_NC_GPIO_96			(96)
+#define JET_GPIO_NC_GPIO_100			(100)
+#define JET_GPIO_NC_GPIO_101			(101)
+#define JET_GPIO_NC_GPIO_102			(102)
+#define JET_GPIO_PM_MDM_INTz			(105)
+#define JET_GPIO_AUDIOz_UART_SW			(107)
+#define JET_GPIO_PRX_LB_SW_SEL			(111)
+#define JET_GPIO_ANT_SW_SEL4			(112)
+#define JET_GPIO_BC1_SW_SEL0			(113)
+#define JET_GPIO_ANT_SW_SEL3			(116)
+#define JET_GPIO_ANT_SW_SEL2			(117)
+#define JET_GPIO_ANT_SW_SEL1			(118)
+#define JET_GPIO_ANT_SW_SEL0			(119)
+#define JET_GPIO_RTR0_PA_ON7_U700		(129)
+#define JET_GPIO_PA_ON4_MODE			(132)
+#define JET_GPIO_PA_ON1_GSMHB			(135)
+#define JET_GPIO_RTR0_PA_ON0_CELL		(136)
+#define JET_GPIO_G850_700_SEL			(139)
+#define JET_GPIO_RTR0_GP_CLK			(144)
+#define JET_GPIO_RTR0_GPRSSYNC			(145)
+#define JET_GPIO_RTR0_GPDATA2			(146)
+#define JET_GPIO_RTR0_GPDATA1			(147)
+#define JET_GPIO_RTR0_GPDATA0			(148)
+#define JET_GPIO_NC_GPIO_150			(150)
+#define JET_GPIO_NC_GPIO_151			(151)
+
+#define PMGPIO(x) (x)
+
+#define JET_GPIO_PM_SPI_CS0			PMGPIO(5)
+#define JET_GPIO_RAFT_uP_SPI_CS0		PMGPIO(6)
+#define JET_GPIO_AUD_REMO_PRESz			PMGPIO(7)
+#define JET_GPIO_NC_PMGPIO_8			PMGPIO(8)
+#define JET_GPIO_PM_SPI_CLK			PMGPIO(11)
+#define JET_GPIO_RAFT_uP_SPI_CLK		PMGPIO(12)
+#define JET_GPIO_PM_SPI_DO			PMGPIO(13)
+#define JET_GPIO_RAFT_uP_SPI_DO			PMGPIO(14)
+#define JET_GPIO_RAFT_UP_EN_CPU_PM		PMGPIO(15)
+#define JET_GPIO_RAFT_UP_EN			PMGPIO(16)
+#define JET_GPIO_AUD_AMP_EN			PMGPIO(18)
+#define JET_GPIO_AUD_HAC_SDz			PMGPIO(19)
+#define JET_GPIO_SDC3_CDz			PMGPIO(23)
+#define JET_GPIO_GREEN_LED			PMGPIO(24)
+#define JET_GPIO_AMBER_LED			PMGPIO(25)
+#define JET_GPIO_UIM1_RST			PMGPIO(27)
+#define JET_GPIO_UIM1_CLK			PMGPIO(30)
+#define JET_GPIO_COVER_DETz			PMGPIO(41)
+#define JET_GPIO_AD_EN_MSM			PMGPIO(42)
+
+
+/* XA */
+#define JET_GPIO_LCD_TE				(0) /* MDP_VSYNC_GPIO */
+#define JET_GPIO_NC_GPIO_1			(1)
+#define JET_GPIO_NC_GPIO_2			(2)
+#define JET_GPIO_HAPTIC_EN			(3)
+#define JET_GPIO_CAM_MCLK1			(4)
+#define JET_GPIO_CAM_MCLK0			(5)
+#define JET_GPIO_NFC_DL_MODE			(6)
+#define JET_GPIO_TP_ATTz			(7)
+#define JET_GPIO_TP_RSTz			(8)
+#define JET_GPIO_NC_GPIO_9			(9)
+#define JET_GPIO_SD_CDETz			(10)
+#define JET_GPIO_RESOUTz_CONTROL		(11)
+#define JET_GPIO_NC_GPIO_12			(12)
+#define JET_GPIO_NC_GPIO_13			(13)
+#define JET_GPIO_AUD_1WIRE_DO			(14)
+#define JET_GPIO_AUD_1WIRE_DI			(15)
+#define JET_GPIO_TP_I2C_DAT			(16)
+#define JET_GPIO_TP_I2C_CLK			(17)
+#define JET_GPIO_NC_GPIO_18			(18)
+#define JET_GPIO_USB_ID1			(19)
+#define JET_GPIO_CAM_I2C_DAT			(20)
+#define JET_GPIO_CAM_I2C_CLK			(21)
+#define JET_GPIO_NC_GPIO_22			(22)
+#define JET_GPIO_NC_GPIO_23			(23)
+#define JET_GPIO_NC_GPIO_24			(24)
+#define JET_GPIO_NC_GPIO_25			(25)
+#define JET_GPIO_FM_SSBI			(26)
+#define JET_GPIO_FM_DATA			(27)
+#define JET_GPIO_BT_STROBE			(28)
+#define JET_GPIO_BT_DATA			(29)
+#define JET_GPIO_UIM1_DATA_MSM			(30)
+#define JET_GPIO_UIM1_CLK_MSM			(31)
+#define JET_GPIO_TORCH_FLASHz			(32)
+#define JET_GPIO_DRIVER_EN			(33)
+#define JET_GPIO_DEBUG_UART_TX			(34)
+#define JET_GPIO_DEBUG_UART_RX			(35)
+#define JET_GPIO_MC_I2C_DAT			(36)
+#define JET_GPIO_MC_I2C_CLK			(37)
+#define JET_GPIO_MSM_SPI_DO			(38)
+#define JET_GPIO_NC_GPIO_39			(39)
+#define JET_GPIO_MSM_SPI_CSO			(40)
+#define JET_GPIO_MSM_SPI_CLK			(41)
+#define JET_GPIO_VOL_UPz			(42)
+#define JET_GPIO_VOL_DOWNz			(43)
+#define JET_GPIO_SR_I2C_DAT			(44)
+#define JET_GPIO_SR_I2C_CLK			(45)
+#define JET_GPIO_PWR_KEYz			(46)
+#define JET_GPIO_CAM_ID				(47)
+#define JET_GPIO_LCD_RSTz			(48)
+#define JET_GPIO_CAM_VCM_PD			(49)
+#define JET_GPIO_NFC_VEN			(50)
+#define JET_GPIO_RAW_RSTN			(51)
+#define JET_GPIO_RAW_INTR0			(52)
+#define JET_GPIO_NC_GPIO_53			(53)
+#define JET_GPIO_REGION_ID			(54)
+#define JET_GPIO_TAM_DET_EN			(55)
+#define JET_GPIO_V_3G_PA1_EN			(56)
+#define JET_GPIO_V_3G_PA0_EN			(57)
+#define JET_GPIO_NC_GPIO_58			(58)
+#define JET_GPIO_AUD_WCD_MCLK			(59)
+#define JET_GPIO_AUD_WCD_SB_CLK			(60)
+#define JET_GPIO_AUD_WCD_SB_DATA		(61)
+#define JET_GPIO_AUD_WCD_INTR_OUT		(62)
+#define JET_GPIO_NC_GPIO_63			(63)
+#define JET_GPIO_NC_GPIO_64			(64)
+#define JET_GPIO_RAW_INTR1			(65)
+#define JET_GPIO_NC_GPIO_66			(66)
+#define JET_GPIO_GSENSOR_INT			(67)
+#define JET_GPIO_CAM2_RSTz			(68)
+#define JET_GPIO_GYRO_INT			(69)
+#define JET_GPIO_COMPASS_INT			(70)
+#define JET_GPIO_MCAM_SPI_DO			(71)
+#define JET_GPIO_MCAM_SPI_DI			(72)
+#define JET_GPIO_MCAM_SPI_CS0			(73)
+#define JET_GPIO_MCAM_SPI_CLK			(74)
+#define JET_GPIO_NC_GPIO_75			(75)
+#define JET_GPIO_NC_GPIO_76			(76)
+#define JET_GPIO_V_HAPTIC_3V3_EN		(77)
+#define JET_GPIO_MHL_INT			(78)
+#define JET_GPIO_V_CAM2_D1V8_EN			(79)
+#define JET_GPIO_MHL_RSTz			(80)
+#define JET_GPIO_V_TP_3V3_EN			(81)
+#define JET_GPIO_MHL_USBz_SEL			(82)
+#define JET_GPIO_WCN_BT_SSBI			(83)
+#define JET_GPIO_WCN_CMD_DATA2			(84)
+#define JET_GPIO_WCN_CMD_DATA1			(85)
+#define JET_GPIO_WCN_CMD_DATA0			(86)
+#define JET_GPIO_WCN_CMD_SET			(87)
+#define JET_GPIO_WCN_CMD_CLK			(88)
+#define JET_GPIO_MHL_USB_ENz			(89)
+#define JET_GPIO_CAM_STEP_1			(90)
+#define JET_GPIO_NC_GPIO_91			(91)
+#define JET_GPIO_CAM_STEP_2			(92)
+#define JET_GPIO_V_HSMIC_2v85_EN		(93)
+#define JET_GPIO_MBAT_IN			(94)
+#define JET_GPIO_V_CAM_D1V2_EN			(95)
+#define JET_GPIO_V_BOOST_5V_EN			(96)
+#define JET_GPIO_NC_GPIO_97			(97)
+#define JET_GPIO_RIVA_TX			(98)
+#define JET_GPIO_NC_GPIO_99			(99)
+#define JET_GPIO_HDMI_DDC_CLK			(100)
+#define JET_GPIO_HDMI_DDC_DATA			(101)
+#define JET_GPIO_HDMI_HPD			(102)
+#define JET_GPIO_PM_SEC_INTz			(103)
+#define JET_GPIO_PM_USR_INTz			(104)
+#define JET_GPIO_PM_MSM_INTz			(105)
+#define JET_GPIO_NFC_IRQ			(106)
+#define JET_GPIO_CAM_PWDN			(107)
+#define JET_GPIO_PS_HOLD			(108)
+#define JET_GPIO_APT1_VCON			(109)
+#define JET_GPIO_BC1_SW_SEL1			(110)
+#define JET_GPIO_DRX_1X_EV_SEL			(111)
+#define JET_GPIO_BOOT_CONFIG_6			(112)
+#define JET_GPIO_NC_GPIO_113			(113)
+#define JET_GPIO_BC0_SW_SEL1			(114)
+#define JET_GPIO_BC0_SW_SEL0			(115)
+#define JET_GPIO_BOOT_CONFIG2			(116)
+#define JET_GPIO_BOOT_CONFIG1			(117)
+#define JET_GPIO_BOOT_CONFIG0			(118)
+#define JET_GPIO_NC_GPIO_119			(119)
+#define JET_GPIO_PA1_R0				(120)
+#define JET_GPIO_PA1_R1				(121)
+#define JET_GPIO_PA0_R0				(122)
+#define JET_GPIO_PA0_R1				(123)
+#define JET_GPIO_RTR1_RF_ON			(124)
+#define JET_GPIO_RTR0_RF_ON			(125)
+#define JET_GPIO_RTR_RX_ON			(126)
+#define JET_GPIO_APT0_VCON			(127)
+#define JET_GPIO_NC_GPIO_128			(128)
+#define JET_GPIO_NC_GPIO_129			(129)
+#define JET_GPIO_NC_GPIO_130			(130)
+#define JET_GPIO_RTR0_PA_ON5_PCS		(131)
+#define JET_GPIO_NC_GPIO_132			(132)
+#define JET_GPIO_RTR1_PA_ON3_BC1_1X		(133)
+#define JET_GPIO_RTR1_PA_ON2_BC0_1X		(134)
+#define JET_GPIO_NC_GPIO_135			(135)
+#define JET_GPIO_PTR0_PA_ON0_CELL		(136)
+#define JET_GPIO_EXT_GPS_LNA_EN			(137)
+#define JET_GPIO_NC_GPIO_138			(138)
+#define JET_GPIO_NC_GPIO_139			(139)
+#define JET_GPIO_RTR1_SSBI2			(140)
+#define JET_GPIO_RTR1_SSBI1			(141)
+#define JET_GPIO_RTR0_SSBI2			(142)
+#define JET_GPIO_RTR0_SSBI1			(143)
+#define JET_GPIO_NC_GPIO_144			(144)
+#define JET_GPIO_NC_GPIO_145			(145)
+#define JET_GPIO_NC_GPIO_146			(146)
+#define JET_GPIO_NC_GPIO_147			(147)
+#define JET_GPIO_NC_GPIO_148			(148)
+#define JET_GPIO_NC_GPIO_149			(149)
+#define JET_GPIO_HSIC_STROBE			(150)
+#define JET_GPIO_HSIC_DATA			(151)
+
+#define JET_GPIO_PM_HDMI_DDC_CLK	PMGPIO(1)
+#define JET_GPIO_HDMI_DDC_CLK_1		PMGPIO(2)
+#define JET_GPIO_NC_PMGPIO_3		PMGPIO(3)
+#define JET_GPIO_NC_PMGPIO_4		PMGPIO(4)
+#define JET_GPIO_MSM_SPI_CS0		PMGPIO(5)
+#define JET_GPIO_HVDAC_SPI_CS0		PMGPIO(6)
+#define JET_GPIO_PM_AUD_1WIRE_DO	PMGPIO(7)
+#define JET_GPIO_AUD_1WIRE_O		PMGPIO(8)
+#define JET_GPIO_NC_PMGPIO_9		PMGPIO(9)
+#define JET_GPIO_NC_PMGPIO_10		PMGPIO(10)
+#define JET_GPIO_PM_MSM_SPI_CLK		PMGPIO(11)
+#define JET_GPIO_HVDAC_SPI_CLK		PMGPIO(12)
+#define JET_GPIO_PM_MSM_SPI_DO		PMGPIO(13)
+#define JET_GPIO_HVDAC_SPI_DO		PMGPIO(14)
+#define JET_GPIO_PM_AUD_REMO_PRESz	PMGPIO(15)
+#define JET_GPIO_PM_AUD_1WIRE_DI	PMGPIO(16)
+#define JET_GPIO_PROXIMITY_INTz		PMGPIO(17)
+#define JET_GPIO_AUD_SPK_SDz		PMGPIO(18)
+#define JET_GPIO_NC_PMGPIO_19		PMGPIO(19)
+#define JET_GPIO_EARPHONE_DETz		PMGPIO(20)
+#define JET_GPIO_NC_PMGPIO_21		PMGPIO(21)
+#define JET_GPIO_NC_PMGPIO_22		PMGPIO(22)
+#define JET_GPIO_NC_PMGPIO_23		PMGPIO(23)
+#define JET_GPIO_NC_PMGPIO_24		PMGPIO(24)
+#define JET_GPIO_NC_PMGPIO_25		PMGPIO(25)
+#define JET_GPIO_HAPTIC_PWM		PMGPIO(26)
+#define JET_GPIO_UIM_RST		PMGPIO(27)
+#define JET_GPIO_NC_PMGPIO_28		PMGPIO(28)
+#define JET_GPIO_SIM_CLK_MSM		PMGPIO(29)
+#define JET_GPIO_UIM_CLK		PMGPIO(30)
+#define JET_GPIO_NC_PMGPIO_31		PMGPIO(31)
+#define JET_GPIO_NC_PMGPIO_32		PMGPIO(32)
+#define JET_GPIO_LCD_ID0		PMGPIO(33)
+#define JET_GPIO_AUD_CODEC_RSTz		PMGPIO(34)
+#define JET_GPIO_LCD_ID1		PMGPIO(35)
+#define JET_GPIO_NC_PMGPIO_36		PMGPIO(36)
+#define JET_GPIO_NC_PMGPIO_37		PMGPIO(37)
+#define JET_GPIO_NC_PMGPIO_38		PMGPIO(38)
+#define JET_GPIO_SSBI_PMIC_FWD_CLK	PMGPIO(39)
+#define JET_GPIO_NC_PMGPIO_40		PMGPIO(40)
+#define JET_GPIO_NC_PMGPIO_41		PMGPIO(41)
+#define JET_GPIO_NC_PMGPIO_42		PMGPIO(42)
+#define JET_GPIO_RAW_1V2_EN		PMGPIO(43)
+#define JET_GPIO_RAW_1V8_EN		PMGPIO(44)
+
+/* XB GPIO */
+#define JET_GPIO_V_CAM2_D1V2_EN		(79)
+
+#define JET_GPIO_NC_PMGPIO_1		PMGPIO(1)
+#define JET_GPIO_NC_PMGPIO_2		PMGPIO(2)
+
+void jet_lcd_id_power(int pull);
+
+extern struct msm_camera_board_info jet_camera_board_info;
+
+void __init jet_init_camera(void);
+void jet_init_fb(void);
+void __init jet_init_pmic(void);
+void jet_init_mmc(void);
+int __init jet_gpiomux_init(void);
+void __init msm8960_allocate_fb_region(void);
+void __init jet_pm8921_gpio_mpp_init(void);
+void msm8960_mdp_writeback(struct memtype_reserve *reserve_table);
+int __init jet_init_keypad(void);
+
+#ifdef CONFIG_MSM_CACHE_DUMP
+extern struct msm_cache_dump_platform_data msm8960_cache_dump_pdata;
+#endif
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+int hdmi_enable_5v(int on);
+void hdmi_hpd_feature(int on);
+#endif
+
+#endif
diff --git a/arch/arm/mach-msm/htc/jet/display/Makefile b/arch/arm/mach-msm/htc/jet/display/Makefile
new file mode 100644
index 0000000..c31afc3
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/display/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_MACH_JET) += mipi_jet.o mipi_jet_720p_pt.o board-jet-panel.o
\ No newline at end of file
diff --git a/arch/arm/mach-msm/htc/jet/display/board-jet-panel.c b/arch/arm/mach-msm/htc/jet/display/board-jet-panel.c
new file mode 100644
index 0000000..112f848
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/display/board-jet-panel.c
@@ -0,0 +1,697 @@
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include "../../../../drivers/video/msm/msm_fb.h"
+#include "../../../../drivers/video/msm/mipi_dsi.h"
+#include "../../../../drivers/video/msm/mdp4.h"
+#include <linux/gpio.h>
+#include <mach/gpio.h>
+#include <mach/panel_id.h>
+#include <mach/msm_memtypes.h>
+#include <linux/bootmem.h>
+#include <video/msm_hdmi_modes.h>
+
+#include "../devices.h"
+#include "../board-jet.h"
+
+#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
+#define MSM_FB_PRIM_BUF_SIZE (1280 * 720 * 4 * 3) /* 4bpp x 3 pages */
+#else
+#define MSM_FB_PRIM_BUF_SIZE (1280 * 720 * 4 * 3) /* 4bb x 2 pages */
+#endif
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
+#elif defined(CONFIG_FB_MSM_TVOUT)
+#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
+#else
+#define MSM_FB_EXT_BUF_SIZE 0
+#endif
+
+/* Note: must be multiple of 4096 */
+#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE, 4096)
+
+#ifdef CONFIG_FB_MSM_OVERLAY0_WRITEBACK
+#define MSM_FB_OVERLAY0_WRITEBACK_SIZE \
+		roundup((roundup(1280, 32) * roundup(720, 32) * 3 * 2), 4096)
+#else
+#define MSM_FB_OVERLAY0_WRITEBACK_SIZE (0)
+#endif  /* CONFIG_FB_MSM_OVERLAY0_WRITEBACK */
+
+#ifdef CONFIG_FB_MSM_OVERLAY1_WRITEBACK
+#define MSM_FB_OVERLAY1_WRITEBACK_SIZE \
+		roundup((roundup(1920, 32) * roundup(1080, 32) * 3 * 2), 4096)
+#else
+#define MSM_FB_OVERLAY1_WRITEBACK_SIZE (0)
+#endif  /* CONFIG_FB_MSM_OVERLAY1_WRITEBACK */
+
+static struct resource msm_fb_resources[] = {
+	{
+		.flags = IORESOURCE_DMA,
+	}
+};
+
+static struct msm_fb_platform_data msm_fb_pdata = {
+};
+
+static struct platform_device msm_fb_device = {
+	.name   = "msm_fb",
+	.id     = 0,
+	.num_resources     = ARRAY_SIZE(msm_fb_resources),
+	.resource          = msm_fb_resources,
+	.dev.platform_data = &msm_fb_pdata,
+};
+
+/* Select panel operate mode : CMD, VIDEO or SWITCH mode */
+
+int jet_panel_first_init = 1;
+static bool dsi_power_on;
+
+static int mipi_dsi_panel_power(int on)
+{
+	static struct regulator *v_lcm, *v_lcmio, *v_dsivdd;
+	static bool bPanelPowerOn = false;
+	int rc;
+
+	char *lcm_str = "8921_l11";
+	char *lcmio_str = "8921_lvs5";
+	char *dsivdd_str = "8921_l2";
+
+	printk(KERN_INFO "%s: state : %d\n", __func__, on);
+
+	if (!dsi_power_on) {
+
+		v_lcm = regulator_get(&msm_mipi_dsi1_device.dev,
+				lcm_str);
+		if (IS_ERR(v_lcm)) {
+			printk(KERN_ERR "could not get %s, rc = %ld\n",
+				lcm_str, PTR_ERR(v_lcm));
+			return -ENODEV;
+		}
+
+		v_lcmio = regulator_get(&msm_mipi_dsi1_device.dev,
+				lcmio_str);
+		if (IS_ERR(v_lcmio)) {
+			printk(KERN_ERR "could not get %s, rc = %ld\n",
+				lcmio_str, PTR_ERR(v_lcmio));
+			return -ENODEV;
+		}
+
+		v_dsivdd = regulator_get(&msm_mipi_dsi1_device.dev,
+				dsivdd_str);
+		if (IS_ERR(v_dsivdd)) {
+			printk(KERN_ERR "could not get %s, rc = %ld\n",
+				dsivdd_str, PTR_ERR(v_dsivdd));
+			return -ENODEV;
+		}
+		if (system_rev >= 2) /* XC */
+			rc = regulator_set_voltage(v_lcm, 3000000, 3000000);
+		else
+			rc = regulator_set_voltage(v_lcm, 3200000, 3200000);
+		if (rc) {
+			printk(KERN_ERR "%s#%d: set_voltage %s failed, rc=%d\n", __func__, __LINE__, lcm_str, rc);
+			return -EINVAL;
+		}
+
+		rc = regulator_set_voltage(v_dsivdd, 1200000, 1200000);
+		if (rc) {
+			printk(KERN_ERR "%s#%d: set_voltage %s failed, rc=%d\n", __func__, __LINE__, dsivdd_str, rc);
+			return -EINVAL;
+		}
+
+		rc = gpio_request(JET_GPIO_LCD_RSTz, "LCM_RST_N");
+		if (rc) {
+			printk(KERN_ERR "%s:LCM gpio %d request failed, rc=%d\n", __func__,  JET_GPIO_LCD_RSTz, rc);
+			return -EINVAL;
+		}
+
+		dsi_power_on = true;
+	}
+
+	if (on) {
+		printk(KERN_INFO "%s: on\n", __func__);
+		rc = regulator_set_optimum_mode(v_lcm, 100000);
+		if (rc < 0) {
+			printk(KERN_ERR "set_optimum_mode %s failed, rc=%d\n", lcm_str, rc);
+			return -EINVAL;
+		}
+
+		rc = regulator_set_optimum_mode(v_dsivdd, 100000);
+		if (rc < 0) {
+			printk(KERN_ERR "set_optimum_mode %s failed, rc=%d\n", dsivdd_str, rc);
+			return -EINVAL;
+		}
+
+		rc = regulator_enable(v_lcm);
+		if (rc) {
+			printk(KERN_ERR "enable regulator %s failed, rc=%d\n", lcm_str, rc);
+			return -ENODEV;
+		}
+
+		rc = regulator_enable(v_dsivdd);
+		if (rc) {
+			printk(KERN_ERR "enable regulator %s failed, rc=%d\n", dsivdd_str, rc);
+			return -ENODEV;
+		}
+		rc = regulator_enable(v_lcmio);
+		if (rc) {
+			printk(KERN_ERR "enable regulator %s failed, rc=%d\n", lcmio_str, rc);
+			return -ENODEV;
+		}
+
+		jet_lcd_id_power(PM_GPIO_PULL_NO);
+
+		if (!jet_panel_first_init) {
+                        msleep(20);
+			gpio_set_value(JET_GPIO_LCD_RSTz, 1);
+			msleep(1);
+		}
+
+		bPanelPowerOn = true;
+
+	} else {
+		printk(KERN_INFO "%s: off\n", __func__);
+		if (!bPanelPowerOn) return 0;
+		jet_lcd_id_power(PM_GPIO_PULL_DN);
+
+		gpio_set_value(JET_GPIO_LCD_RSTz, 0);
+		msleep(10);
+
+		if (regulator_disable(v_lcmio)) {
+			printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, lcmio_str);
+			return -EINVAL;
+		}
+
+		if (regulator_disable(v_dsivdd)) {
+			printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, dsivdd_str);
+			return -EINVAL;
+		}
+
+		if (regulator_disable(v_lcm)) {
+			printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, lcm_str);
+			return -EINVAL;
+		}
+
+		rc = regulator_set_optimum_mode(v_dsivdd, 100);
+		if (rc < 0) {
+			printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, dsivdd_str);
+			return -EINVAL;
+		}
+
+		bPanelPowerOn = false;
+	}
+	return 0;
+}
+
+static struct mipi_dsi_platform_data mipi_dsi_pdata = {
+	.vsync_gpio = JET_GPIO_LCD_TE,
+	.dsi_power_save = mipi_dsi_panel_power,
+};
+
+static struct platform_device mipi_dsi_jet_panel_device = {
+	.name = "mipi_jet",
+	.id = 0,
+};
+
+#ifdef CONFIG_MSM_BUS_SCALING
+static struct msm_bus_vectors dtv_bus_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+static struct msm_bus_vectors dtv_bus_def_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 566092800 * 2,
+		.ib = 707616000 * 2,
+	},
+};
+static struct msm_bus_paths dtv_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(dtv_bus_init_vectors),
+		dtv_bus_init_vectors,
+	},
+	{
+		ARRAY_SIZE(dtv_bus_def_vectors),
+		dtv_bus_def_vectors,
+	},
+};
+static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
+	dtv_bus_scale_usecases,
+	ARRAY_SIZE(dtv_bus_scale_usecases),
+	.name = "dtv",
+};
+
+static struct lcdc_platform_data dtv_pdata = {
+	.bus_scale_table = &dtv_bus_scale_pdata,
+};
+
+static struct msm_bus_vectors mdp_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+
+static struct msm_bus_vectors mdp_ui_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 216000000 * 2,
+		.ib = 270000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_vga_vectors[] = {
+	/* VGA and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 216000000 * 2,
+		.ib = 270000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_720p_vectors[] = {
+	/* 720p and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 230400000 * 2,
+		.ib = 288000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_1080p_vectors[] = {
+	/* 1080p and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 334080000 * 2,
+		.ib = 417600000 * 2,
+	},
+};
+
+static struct msm_bus_paths mdp_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(mdp_init_vectors),
+		mdp_init_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_ui_vectors),
+		mdp_ui_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_ui_vectors),
+		mdp_ui_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_vga_vectors),
+		mdp_vga_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_720p_vectors),
+		mdp_720p_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_1080p_vectors),
+		mdp_1080p_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
+	mdp_bus_scale_usecases,
+	ARRAY_SIZE(mdp_bus_scale_usecases),
+	.name = "mdp",
+};
+#endif
+
+int mdp_core_clk_rate_table[] = {
+	85330000,
+	96000000,
+	160000000,
+	200000000,
+};
+
+static struct msm_panel_common_pdata mdp_pdata = {
+	.gpio = JET_GPIO_LCD_TE,
+#ifdef CONFIG_MSM_BUS_SCALING
+	.mdp_bus_scale_table = &mdp_bus_scale_pdata,
+#endif
+	.mdp_rev = MDP_REV_42,
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+	.mem_hid = BIT(ION_CP_MM_HEAP_ID),
+#else
+	.mem_hid = MEMTYPE_EBI1,
+#endif
+	.mdp_max_clk = 200000000,
+};
+
+void __init msm8960_allocate_fb_region(void)
+{
+	void *addr;
+	unsigned long size;
+
+	size = MSM_FB_SIZE;
+	addr = alloc_bootmem_align(size, 0x1000);
+	msm_fb_resources[0].start = __pa(addr);
+	msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
+	pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
+			size, addr, __pa(addr));
+}
+
+void __init msm8960_mdp_writeback(struct memtype_reserve* reserve_table)
+{
+	mdp_pdata.ov0_wb_size = MSM_FB_OVERLAY0_WRITEBACK_SIZE;
+	mdp_pdata.ov1_wb_size = MSM_FB_OVERLAY1_WRITEBACK_SIZE;
+#if defined(CONFIG_ANDROID_PMEM) && !defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	reserve_table[mdp_pdata.mem_hid].size +=
+		mdp_pdata.ov0_wb_size;
+	reserve_table[mdp_pdata.mem_hid].size +=
+		mdp_pdata.ov1_wb_size;
+#endif
+}
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+static struct resource hdmi_msm_resources[] = {
+	{
+		.name  = "hdmi_msm_qfprom_addr",
+		.start = 0x00700000,
+		.end   = 0x007060FF,
+		.flags = IORESOURCE_MEM,
+	},
+	{
+		.name  = "hdmi_msm_hdmi_addr",
+		.start = 0x04A00000,
+		.end   = 0x04A00FFF,
+		.flags = IORESOURCE_MEM,
+	},
+	{
+		.name  = "hdmi_msm_irq",
+		.start = HDMI_IRQ,
+		.end   = HDMI_IRQ,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+static int hdmi_core_power(int on, int show);
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+static mhl_driving_params jet_driving_params[] = {
+	{
+		.format = HDMI_VFRMT_640x480p60_4_3,
+		.reg_a3 = 0xF4,
+		.reg_a6 = 0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_720x480p60_16_9,
+		.reg_a3 = 0xF4,
+		.reg_a6 = 0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_1280x720p60_16_9,
+		.reg_a3 = 0xF4,
+		.reg_a6 = 0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_720x576p50_16_9,
+		.reg_a3 = 0xF4,
+		.reg_a6 = 0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_1920x1080p24_16_9,
+		.reg_a3 = 0xF4,
+		.reg_a6 = 0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_1920x1080p30_16_9,
+		.reg_a3 = 0xF4,
+		.reg_a6 = 0x0C,
+	},
+};
+#endif
+
+static struct msm_hdmi_platform_data hdmi_msm_data = {
+	.irq = HDMI_IRQ,
+	.enable_5v = hdmi_enable_5v,
+	.core_power = hdmi_core_power,
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	.driving_params =  jet_driving_params,
+	.dirving_params_count = ARRAY_SIZE(jet_driving_params),
+#endif
+};
+
+static struct platform_device hdmi_msm_device = {
+	.name = "hdmi_msm",
+	.id = 0,
+	.num_resources = ARRAY_SIZE(hdmi_msm_resources),
+	.resource = hdmi_msm_resources,
+	.dev.platform_data = &hdmi_msm_data,
+};
+
+int hdmi_enable_5v(int on)
+{
+	static struct regulator *reg_8921_hdmi_mvs;
+	static int prev_on;
+	int rc;
+
+	if (on == prev_on)
+		return 0;
+
+	if (!reg_8921_hdmi_mvs) {
+		reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
+					"hdmi_mvs");
+		if (IS_ERR(reg_8921_hdmi_mvs)) {
+			pr_err("'%s' regulator not found, rc=%ld\n",
+				"hdmi_mvs", IS_ERR(reg_8921_hdmi_mvs));
+			reg_8921_hdmi_mvs = NULL;
+			return -ENODEV;
+		}
+	}
+
+	if (on) {
+		rc = regulator_enable(reg_8921_hdmi_mvs);
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"8921_hdmi_mvs", rc);
+			return rc;
+		}
+		pr_debug("%s(on): success\n", __func__);
+	} else {
+		rc = regulator_disable(reg_8921_hdmi_mvs);
+		if (rc)
+			pr_warning("'%s' regulator disable failed, rc=%d\n",
+				"8921_hdmi_mvs", rc);
+		pr_debug("%s(off): success\n", __func__);
+	}
+
+	prev_on = on;
+
+	return 0;
+}
+
+static int hdmi_core_power(int on, int show)
+{
+	static struct regulator *reg_8921_l23, *reg_8921_s4;
+	static int prev_on;
+	int rc;
+
+	if (on == prev_on)
+		return 0;
+
+	if (!reg_8921_l23) {
+		reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
+		if (IS_ERR(reg_8921_l23)) {
+			pr_err("could not get reg_8921_l23, rc = %ld\n",
+				PTR_ERR(reg_8921_l23));
+			return -ENODEV;
+		}
+		rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
+		if (rc) {
+			pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
+			return -EINVAL;
+		}
+	}
+	if (!reg_8921_s4) {
+		reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
+		if (IS_ERR(reg_8921_s4)) {
+			pr_err("could not get reg_8921_s4, rc = %ld\n",
+				PTR_ERR(reg_8921_s4));
+			return -ENODEV;
+		}
+		rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
+		if (rc) {
+			pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
+			return -EINVAL;
+		}
+	}
+
+	if (on) {
+		rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
+		if (rc < 0) {
+			pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
+			return -EINVAL;
+		}
+		rc = regulator_enable(reg_8921_l23);
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"hdmi_avdd", rc);
+			return rc;
+		}
+		rc = regulator_enable(reg_8921_s4);
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"hdmi_vcc", rc);
+			return rc;
+		}
+		rc = gpio_request(100, "HDMI_DDC_CLK");
+		if (rc) {
+			pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
+				"HDMI_DDC_CLK", 100, rc);
+			goto error1;
+		}
+		rc = gpio_request(101, "HDMI_DDC_DATA");
+		if (rc) {
+			pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
+				"HDMI_DDC_DATA", 101, rc);
+			goto error2;
+		}
+		rc = gpio_request(102, "HDMI_HPD");
+		if (rc) {
+			pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
+				"HDMI_HPD", 102, rc);
+			goto error3;
+		}
+		pr_debug("%s(on): success\n", __func__);
+	} else {
+		gpio_free(100);
+		gpio_free(101);
+		gpio_free(102);
+
+		rc = regulator_disable(reg_8921_l23);
+		if (rc) {
+			pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
+			return -ENODEV;
+		}
+		rc = regulator_disable(reg_8921_s4);
+		if (rc) {
+			pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
+			return -ENODEV;
+		}
+		rc = regulator_set_optimum_mode(reg_8921_l23, 100);
+		if (rc < 0) {
+			pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
+			return -EINVAL;
+		}
+		pr_debug("%s(off): success\n", __func__);
+	}
+
+	prev_on = on;
+
+	return 0;
+
+error3:
+	gpio_free(101);
+error2:
+	gpio_free(100);
+error1:
+	regulator_disable(reg_8921_l23);
+	regulator_disable(reg_8921_s4);
+	return rc;
+}
+#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
+
+#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
+static char wfd_check_mdp_iommu_split_domain(void)
+{
+	return mdp_pdata.mdp_iommu_split_domain;
+}
+
+static struct msm_wfd_platform_data wfd_pdata = {
+	.wfd_check_mdp_iommu_split = wfd_check_mdp_iommu_split_domain,
+};
+
+static struct platform_device wfd_panel_device = {
+	.name = "wfd_panel",
+	.id = 0,
+	.dev.platform_data = NULL,
+};
+
+static struct platform_device wfd_device = {
+	.name = "msm_wfd",
+	.id = -1,
+	.dev.platform_data = &wfd_pdata,
+};
+#endif
+
+static void __init msm8960_set_display_params(char *prim_panel, char *ext_panel)
+{
+	if (strnlen(prim_panel, PANEL_NAME_MAX_LEN)) {
+		strlcpy(msm_fb_pdata.prim_panel_name, prim_panel,
+			PANEL_NAME_MAX_LEN);
+		pr_debug("msm_fb_pdata.prim_panel_name %s\n",
+			msm_fb_pdata.prim_panel_name);
+	}
+	if (strnlen(ext_panel, PANEL_NAME_MAX_LEN)) {
+		strlcpy(msm_fb_pdata.ext_panel_name, ext_panel,
+			PANEL_NAME_MAX_LEN);
+		pr_debug("msm_fb_pdata.ext_panel_name %s\n",
+			msm_fb_pdata.ext_panel_name);
+	}
+}
+
+void __init jet_init_fb(void)
+{
+	msm8960_set_display_params("mipi_jet", "hdmi_msm");
+	platform_device_register(&msm_fb_device);
+#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
+	platform_device_register(&wfd_panel_device);
+	platform_device_register(&wfd_device);
+#endif
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+	platform_device_register(&hdmi_msm_device);
+#endif
+	platform_device_register(&mipi_dsi_jet_panel_device);
+	msm_fb_register_device("mdp", &mdp_pdata);
+	msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
+	msm_fb_register_device("dtv", &dtv_pdata);
+}
+
+static int __init jet_init_panel(void)
+{
+	printk(KERN_INFO "%s: panel type = 0x%x, hboot type = 0x%x, board_mfg_mode = 0x%x\n",
+			__func__, panel_type, board_build_flag(), board_mfg_mode());
+
+	if (panel_type == PANEL_ID_NONE) {
+		if (board_mfg_mode() == 8 || board_mfg_mode() == 4) {
+			printk(KERN_INFO "%s: enter mfgkernel/powettest \n", __func__);
+			return 0;
+		}
+		else if (board_build_flag() == SHIP_BUILD) {
+			/* For shipping produce, the main source panel can cover the most device */
+			printk(KERN_INFO "%s: Use PANEL_ID_JET_SONY_NT_C2 be default panel!\n", __func__);
+			panel_type = PANEL_ID_JET_SONY_NT_C2;
+		}
+		else
+			panic("[DISP] PANEL_ID_NONE! panic");
+	}
+	return 0;
+}
+
+module_init(jet_init_panel);
diff --git a/arch/arm/mach-msm/htc/jet/display/mipi_jet.c b/arch/arm/mach-msm/htc/jet/display/mipi_jet.c
new file mode 100644
index 0000000..25489ce
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/display/mipi_jet.c
@@ -0,0 +1,3370 @@
+#include <linux/gpio.h>
+#include <mach/gpio.h>
+#include <mach/panel_id.h>
+#include "../../../drivers/video/msm/msm_fb.h"
+#include "../../../drivers/video/msm/mipi_dsi.h"
+#include "../board-jet.h"
+#include "mipi_jet.h"
+
+#ifndef JET_USE_CMDLISTS
+static struct dsi_buf jet_tx_buf;
+static struct dsi_buf jet_rx_buf;
+#endif
+static struct msm_panel_common_pdata *mipi_jet_pdata;
+static int mipi_jet_lcd_init(void);
+static int mipi_lcd_on = 1;
+static int bl_level_prevset = 1;
+// Selected codes
+static struct dsi_cmd_desc *jet_video_on_cmds = NULL;
+int jet_video_on_cmds_count = 0;
+static struct dsi_cmd_desc *jet_command_on_cmds = NULL;
+int jet_command_on_cmds_count = 0;
+static struct dsi_cmd_desc *jet_display_on_cmds = NULL;
+int jet_display_on_cmds_count = 0;
+static struct dsi_cmd_desc *jet_display_off_cmds = NULL;
+int jet_display_off_cmds_count = 0;
+static struct dsi_cmd_desc *jet_cmd_backlight_cmds = NULL;
+int jet_cmd_backlight_cmds_count = 0;
+#if defined CONFIG_FB_MSM_SELF_REFRESH
+static struct dsi_cmd_desc *jet_video_to_cmd = NULL;
+int jet_video_to_cmd_cnt = 0;
+static struct dsi_cmd_desc *jet_cmd_to_video = NULL;
+int jet_cmd_to_video_cnt = 0;
+#endif
+
+static char led_pwm1[2] = {0x51, 0xFF};	/* DTYPE_DCS_WRITE1 */
+static char led_pwm2[2] = {0x53, 0x24}; /* DTYPE_DCS_WRITE1 */
+static char led_pwm3[2] = {0x55, 0x00}; /* DTYPE_DCS_WRITE1 */
+static char display_off[2] = {0x28, 0x00}; /* DTYPE_DCS_WRITE */
+static char novatek_e0[3] = {0xE0, 0x01, 0x03}; /* DTYPE_DCS_LWRITE */
+static char sw_reset[2] = {0x01, 0x00}; /* DTYPE_DCS_WRITE */
+static char enter_sleep[2] = {0x10, 0x00}; /* DTYPE_DCS_WRITE */
+static char exit_sleep[2] = {0x11, 0x00}; /* DTYPE_DCS_WRITE */
+static char display_on[2] = {0x29, 0x00}; /* DTYPE_DCS_WRITE */
+static char enable_te[2] = {0x35, 0x00};/* DTYPE_DCS_WRITE1 */
+static char max_pktsize[2] = {MIPI_DSI_MRPS, 0x00}; /* LSB tx first, 16 bytes */
+static char disable_dim_cmd[2] = {0x53, 0x24};/* DTYPE_DCS_WRITE1 */
+
+static struct dsi_cmd_desc display_on_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 40, sizeof(display_on), display_on},
+};
+
+
+static struct dsi_cmd_desc sony_display_off_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 0,
+		sizeof(display_off), display_off},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10,
+		sizeof(enter_sleep), enter_sleep}
+};
+
+static struct dsi_cmd_desc novatek_display_off_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10,
+		sizeof(display_off), display_off},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 12,
+		sizeof(enter_sleep), enter_sleep}
+};
+
+static char fir_lg_gamma_01_d1[] = {
+	0xD1, 0x00, 0x70, 0x00, 0xCE, 0x00, 0xF7, 0x01,
+	0x10, 0x01, 0x21, 0x01, 0x44, 0x01, 0x62, 0x01,
+	0x8D
+};
+
+static char fir_lg_gamma_01_d5[] = {
+	0xD5, 0x00, 0x70, 0x00, 0xCE, 0x00, 0xF7, 0x01,
+	0x10, 0x01, 0x21, 0x01, 0x44, 0x01, 0x62, 0x01,
+	0x8D
+};
+
+static char fir_lg_gamma_01_d9[] = {
+	0xD9, 0x00, 0x70, 0x00, 0xCE, 0x00, 0xF7, 0x01,
+	0x10, 0x01, 0x21, 0x01, 0x44, 0x01, 0x62, 0x01,
+	0x8D
+};
+
+static char fir_lg_gamma_01_e0[] = {
+	0xE0, 0x00, 0x70, 0x00, 0xCE, 0x00, 0xF7, 0x01,
+	0x10, 0x01, 0x21, 0x01, 0x44, 0x01, 0x62, 0x01,
+	0x8D
+};
+
+static char fir_lg_gamma_01_e4[] = {
+	0xE4, 0x00, 0x70, 0x00, 0xCE, 0x00, 0xF7, 0x01,
+	0x10, 0x01, 0x21, 0x01, 0x44, 0x01, 0x62, 0x01,
+	0x8D
+};
+
+static char fir_lg_gamma_01_e8[] = {
+	0xE8, 0x00, 0x70, 0x00, 0xCE, 0x00, 0xF7, 0x01,
+	0x10, 0x01, 0x21, 0x01, 0x44, 0x01, 0x62, 0x01,
+	0x8D
+};
+
+static char fir_lg_gamma_02_d2[] = {
+	0xD2, 0x01, 0xAF, 0x01, 0xE4, 0x02, 0x0C, 0x02,
+	0x4D, 0x02, 0x82, 0x02, 0x84, 0x02, 0xB8, 0x02,
+	0xF0
+};
+
+static char fir_lg_gamma_02_d6[] = {
+	0xD6, 0x01, 0xAF, 0x01, 0xE4, 0x02, 0x0C, 0x02,
+	0x4D, 0x02, 0x82, 0x02, 0x84, 0x02, 0xB8, 0x02,
+	0xF0
+};
+
+static char fir_lg_gamma_02_dd[] = {
+	0xDD, 0x01, 0xAF, 0x01, 0xE4, 0x02, 0x0C, 0x02,
+	0x4D, 0x02, 0x82, 0x02, 0x84, 0x02, 0xB8, 0x02,
+	0xF0
+};
+
+static char fir_lg_gamma_02_e1[] = {
+	0xE1, 0x01, 0xAF, 0x01, 0xE4, 0x02, 0x0C, 0x02,
+	0x4D, 0x02, 0x82, 0x02, 0x84, 0x02, 0xB8, 0x02,
+	0xF0
+};
+
+static char fir_lg_gamma_02_e5[] = {
+	0xE5, 0x01, 0xAF, 0x01, 0xE4, 0x02, 0x0C, 0x02,
+	0x4D, 0x02, 0x82, 0x02, 0x84, 0x02, 0xB8, 0x02,
+	0xF0
+};
+
+static char fir_lg_gamma_02_e9[] = {
+	0xE9, 0x01, 0xAF, 0x01, 0xE4, 0x02, 0x0C, 0x02,
+	0x4D, 0x02, 0x82, 0x02, 0x84, 0x02, 0xB8, 0x02,
+	0xF0
+};
+
+static char fir_lg_gamma_03_d3[] = {
+	0xD3, 0x03, 0x14, 0x03, 0x42, 0x03, 0x5E, 0x03,
+	0x80, 0x03, 0x97, 0x03, 0xB0, 0x03, 0xC0, 0x03,
+	0xDF
+};
+
+static char fir_lg_gamma_03_d7[] = {
+	0xD7, 0x03, 0x14, 0x03, 0x42, 0x03, 0x5E, 0x03,
+	0x80, 0x03, 0x97, 0x03, 0xB0, 0x03, 0xC0, 0x03,
+	0xDF
+};
+
+static char fir_lg_gamma_03_de[] = {
+	0xDE, 0x03, 0x14, 0x03, 0x42, 0x03, 0x5E, 0x03,
+	0x80, 0x03, 0x97, 0x03, 0xB0, 0x03, 0xC0, 0x03,
+	0xDF
+};
+
+static char fir_lg_gamma_03_e2[] = {
+	0xE2, 0x03, 0x14, 0x03, 0x42, 0x03, 0x5E, 0x03,
+	0x80, 0x03, 0x97, 0x03, 0xB0, 0x03, 0xC0, 0x03,
+	0xDF
+};
+
+static char fir_lg_gamma_03_e6[] = {
+	0xE6, 0x03, 0x14, 0x03, 0x42, 0x03, 0x5E, 0x03,
+	0x80, 0x03, 0x97, 0x03, 0xB0, 0x03, 0xC0, 0x03,
+	0xDF
+};
+
+static char fir_lg_gamma_03_ea[] = {
+	0xEA, 0x03, 0x14, 0x03, 0x42, 0x03, 0x5E, 0x03,
+	0x80, 0x03, 0x97, 0x03, 0xB0, 0x03, 0xC0, 0x03,
+	0xDF
+};
+
+static char fir_lg_gamma_04_d4[] = {
+	0xD4, 0x03, 0xFD, 0x03, 0xFF
+};
+
+static char fir_lg_gamma_04_d8[] = {
+	0xD8, 0x03, 0xFD, 0x03, 0xFF
+};
+
+static char fir_lg_gamma_04_df[] = {
+	0xDF, 0x03, 0xFD, 0x03, 0xFF
+};
+
+static char fir_lg_gamma_04_e3[] = {
+	0xE3, 0x03, 0xFD, 0x03, 0xFF
+};
+
+static char fir_lg_gamma_04_e7[] = {
+	0xE7, 0x03, 0xFD, 0x03, 0xFF
+};
+
+static char fir_lg_gamma_04_eb[] = {
+	0xEB, 0x03, 0xFD, 0x03, 0xFF
+};
+
+static char set_threelane[2] = {0xBA, 0x02}; /* DTYPE_DCS_WRITE-1 */
+
+static char swr01[2] = {0x01, 0x33};
+static char swr02[2] = {0x02, 0x53};
+
+static char cmd_page_0[2] = {0xff, 0x00};
+
+#ifdef JEL_CMD_MODE_PANEL
+static char display_mode_cmd[2] = {0xC2, 0x08}; /* DTYPE_DCS_WRITE-1 */
+#else
+static char display_mode_video[2] = {0xC2, 0x03}; /* DTYPE_DCS_WRITE-1 */
+#endif
+
+static struct dsi_cmd_desc disable_dim[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(disable_dim_cmd), disable_dim_cmd},};
+#ifdef CONFIG_FB_MSM_CABC
+static struct dsi_cmd_desc *dim_cmds = disable_dim; /* default disable dim */
+#endif
+
+static struct dsi_cmd_desc nvt_LowTemp_wrkr_enter[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 1, 2, (char[]){0x26, 0x08}},
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}}, */
+};
+
+static struct dsi_cmd_desc nvt_LowTemp_wrkr_exit[] = {
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE}}, */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 10, 2, (char[]){0xFF, 0x00}},
+};
+
+static struct dsi_cmd_desc cmd_bkl_cmds[] = {
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(led_pwm1), led_pwm1},
+};
+
+#ifdef CONFIG_FB_MSM_CABC
+/* for cabc enable and disable seletion */
+static char cabc_off_cmd[2] = {0x55, 0x80};/* DTYPE_DCS_WRITE1 */
+static struct dsi_cmd_desc cabc_off[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(cabc_off_cmd), cabc_off_cmd},};
+static char cabc_on_ui_cmd[2] = {0x55, 0x81};/* DTYPE_DCS_WRITE1 */
+static struct dsi_cmd_desc cabc_on_ui[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(cabc_on_ui_cmd), cabc_on_ui_cmd},};
+static char cabc_on_still_cmd[2] = {0x55, 0x82};/* DTYPE_DCS_WRITE1 */
+static struct dsi_cmd_desc cabc_on_still[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(cabc_on_still_cmd), cabc_on_still_cmd},};
+static char cabc_on_moving_cmd[2] = {0x55, 0x83};/* DTYPE_DCS_WRITE1 */
+static struct dsi_cmd_desc cabc_on_moving[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(cabc_on_moving_cmd), cabc_on_moving_cmd},};
+/* for dimming enable and disable selection */
+static char enable_dim_cmd[2] = {0x53, 0x2C};/* DTYPE_DCS_WRITE1 */
+static struct dsi_cmd_desc enable_dim[] = {{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_dim_cmd), enable_dim_cmd},};
+static struct dsi_cmd_desc *cabc_cmds = cabc_off; /* default disable cabc */
+#endif
+
+static struct dsi_cmd_desc lg_novatek_cmd_on_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 30,
+		sizeof(sw_reset), sw_reset},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xFF, 0xAA, 0x55, 0x25, 0x01} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		8, (char[]){0xF3, 0x02, 0x03, 0x07,
+					 0x15, 0x88, 0xD1, 0x0D} } ,
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xFF, 0xAA, 0x55, 0x25, 0x00} } ,
+	/* page 0 */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x08, 0x00} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xB8, 0x01, 0x02, 0x02, 0x02} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		7, (char[]){0xC9, 0x63, 0x06, 0x0D, 0x1A, 0x17, 0x00} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		ARRAY_SIZE(novatek_e0), novatek_e0},/* PWM frequency = 13kHz */
+	/* page 1 */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 1,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x08, 0x01} },/* select page 1 */
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB0, 0x05, 0x05, 0x05} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB1, 0x05, 0x05, 0x05} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB2, 0x01, 0x01, 0x01} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB3, 0x0E, 0x0E, 0x0E} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB4, 0x08, 0x08, 0x08} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB6, 0x44, 0x44, 0x44} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB7, 0x34, 0x34, 0x34} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB8, 0x10, 0x10, 0x10} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xB9, 0x26, 0x26, 0x26} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xBA, 0x34, 0x34, 0x34} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xBC, 0x00, 0xC8, 0x00} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		4, (char[]){0xBD, 0x00, 0xC8, 0x00} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		3, (char[]){0xC0, 0x01, 0x03} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		4, (char[]){0xCA, 0x00, 0x15, 0x80} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		5, (char[]){0xD0, 0x0A, 0x10, 0x0D, 0x0F} },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_01_d1), fir_lg_gamma_01_d1 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_01_d5), fir_lg_gamma_01_d5 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_01_d9), fir_lg_gamma_01_d9 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_01_e0), fir_lg_gamma_01_e0 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_01_e4), fir_lg_gamma_01_e4 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_01_e8), fir_lg_gamma_01_e8 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_02_d2), fir_lg_gamma_02_d2 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_02_d6), fir_lg_gamma_02_d6 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_02_dd), fir_lg_gamma_02_dd },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_02_e1), fir_lg_gamma_02_e1 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_02_e5), fir_lg_gamma_02_e5 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_02_e9), fir_lg_gamma_02_e9 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_03_d3), fir_lg_gamma_03_d3 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_03_d7), fir_lg_gamma_03_d7 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_03_de), fir_lg_gamma_03_de },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_03_e2), fir_lg_gamma_03_e2 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_03_e6), fir_lg_gamma_03_e6 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_03_ea), fir_lg_gamma_03_ea },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_04_d4), fir_lg_gamma_04_d4 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_04_d8), fir_lg_gamma_04_d8 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_04_df), fir_lg_gamma_04_df },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_04_e3), fir_lg_gamma_04_e3 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_04_e7), fir_lg_gamma_04_e7 },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		sizeof(fir_lg_gamma_04_eb), fir_lg_gamma_04_eb },
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,
+		6, (char[]){0xF0, 0x55, 0xAA, 0x52, 0x00, 0x00} },/* select page 0 */
+	{DTYPE_DCS_WRITE, 1, 0, 0, 12,
+		sizeof(exit_sleep), exit_sleep},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(enable_te), enable_te},
+	{DTYPE_MAX_PKTSIZE, 1, 0, 0, 0,
+		sizeof(max_pktsize), max_pktsize},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm1), led_pwm1},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm2), led_pwm2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,
+		sizeof(led_pwm3), led_pwm3},
+};
+
+static struct dsi_cmd_desc sony_c1_video_on_cmds[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(set_threelane), set_threelane},
+#ifdef JEL_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_cmd), display_mode_cmd},
+#else
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_video), display_mode_video},
+#endif
+
+#if 1
+	/* vivi color ver 2 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x26}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x11}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x18}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x0C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x07}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+#endif
+
+#if 1
+	/* gamma 2.2 6b setting start */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr01), swr01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr02), swr02},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0xA3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xD5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0xF3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x17}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0xDC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x41}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x55}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0x6B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xC0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0xE5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0xA3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xD5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0xF3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x17}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0xDC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x41}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x55}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0x6B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xC0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEC, 0xE5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xED, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEE, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF0, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF2, 0x7F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF4, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF6, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF8, 0xBA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFA, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0xF2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x3D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x9F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0xE4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x10, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x11, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x14, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x15, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x16, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x17, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0xCC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1C, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1D, 0xEA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1E, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1F, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x20, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x3E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0x4F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2B, 0x8F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2F, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x30, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x31, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x32, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x33, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x34, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x35, 0x7F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x36, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x37, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x38, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3B, 0xBA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3F, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x40, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x41, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x42, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x43, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x44, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x45, 0xF2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x47, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x48, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x49, 0x3D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4B, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4D, 0x9F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4F, 0xE4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x50, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x51, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x52, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x54, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x56, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x58, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x59, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5A, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5C, 0xCC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0xEA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x60, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x61, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x62, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x63, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x64, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x65, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x66, 0x3E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x67, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x68, 0x4F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x69, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6C, 0x8F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6E, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x70, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x71, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x72, 0xAC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x73, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x74, 0xB2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0xD6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xEB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xF5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xFE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0x1F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0x3C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x52}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x8A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0x34}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x5B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0xAC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xB2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0xD6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xEB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xF5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xFE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0x1F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0x3C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x52}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x8A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0x34}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x5B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xFF}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x08}},//PWMDIV=8
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	/* gamma 2.2 6b setting end */
+#endif
+
+#if 1
+	/* set Frame rate=60hz */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x05} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x8E} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x8E} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x8E} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+#endif
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10, sizeof(exit_sleep), exit_sleep},
+
+	/* For sony cut1 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x33} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0x30} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0x34} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x00} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* For random dot noise */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x50} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x60} },
+	//{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* Enable CABC setting */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x2D} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0xFF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0xF7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0xEF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0xE7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0xDF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0xD7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0xCF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0xC7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0xBF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0xB7} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x06} },
+
+	/* NVT: Enable vivid-color, but disable CABC, please set register(55h) as 0x80  */
+	/*{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x80}},*/
+
+	/* NVT: Enable vivid-color, and enable CABC UI-Mode, please set register(55h) as 0x81 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x81}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Still-Mode, please set register(55h) as 0x82 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55, 0x82} }, */
+
+	/* NVT: Enable vivid-color, and enable CABC Moving-Mode, please set register(55h) as 0x83 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x83}},
+
+
+	/* {DTYPE_DCS_WRITE, 1, 0, 0, 150, sizeof(exit_sleep), exit_sleep}, */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x24} },
+};
+
+static struct dsi_cmd_desc sony_panel_video_mode_cmds_c2[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(set_threelane), set_threelane},
+#ifdef JEL_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_cmd), display_mode_cmd},
+#else
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_video), display_mode_video},
+#endif
+
+#if 1
+	/* vivi color ver 2 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x26}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x11}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x18}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x0C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x07}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+#endif
+
+#if 1
+	/* gamma 2.2 6b setting start */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr01), swr01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr02), swr02},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0xA3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xD5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0xF3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x17}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0xDC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x41}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x55}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0x6B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xC0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0xE5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0xA3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xD5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0xF3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x17}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0xDC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x41}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x55}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0x6B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0x84}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xC0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEC, 0xE5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xED, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEE, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF0, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF2, 0x7F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF4, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF6, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF8, 0xBA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFA, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0xF2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x3D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x9F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0xE4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x10, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x11, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x14, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x15, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x16, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x17, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0xCC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1C, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1D, 0xEA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1E, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1F, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x20, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x3E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0x4F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2B, 0x8F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2F, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x30, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x31, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x32, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x33, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x34, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x35, 0x7F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x36, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x37, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x38, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3B, 0xBA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3F, 0xCA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x40, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x41, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x42, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x43, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x44, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x45, 0xF2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x47, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x48, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x49, 0x3D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4B, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4D, 0x9F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4F, 0xE4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x50, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x51, 0x1C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x52, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x54, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55, 0x4E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x56, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x58, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x59, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5A, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5C, 0xCC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0xEA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x60, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x61, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x62, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x63, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x64, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x65, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x66, 0x3E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x67, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x68, 0x4F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x69, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6C, 0x8F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6E, 0xDA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x70, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x71, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x72, 0xAC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x73, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x74, 0xB2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0xD6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xEB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xF5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xFE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0x1F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0x3C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x52}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x8A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0x34}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x5B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0xAC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xB2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0xD6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xEB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xF5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xFE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0x1F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0x3C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0xDF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x52}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x8A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0xD8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0x34}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x5B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x72}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xFF}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x08}},//PWMDIV=8
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	/* gamma 2.2 6b setting end */
+#endif
+
+	/* set Frame rate=60hz */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x05} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x8E} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x8E} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x8E} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10, sizeof(exit_sleep), exit_sleep},
+
+	/* For random dot noise */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x50} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x60} },
+	//{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* Enable CABC setting */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x2D} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0xFF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0xF7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0xEF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0xE7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0xDF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0xD7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0xCF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0xC7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0xBF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0xB7} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x06}},
+
+	/* NVT: Enable vivid-color, but disable CABC, please set register(55h) as 0x80  */
+	/*{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x80}},*/
+
+	/* NVT: Enable vivid-color, and enable CABC UI-Mode, please set register(55h) as 0x81 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x81}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Still-Mode, please set register(55h) as 0x82 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x82}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Moving-Mode, please set register(55h) as 0x83 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x83}},
+
+
+	/* {DTYPE_DCS_WRITE, 1, 0, 0, 150, sizeof(exit_sleep), exit_sleep}, */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x24}},
+};
+
+/* AUO timing fix */
+static char auo_fix_000[] = {0xFF, 0x01};
+static char auo_fix_001[] = {0xFB, 0x01};
+static char auo_fix_002[] = {0x00, 0x4A};
+static char auo_fix_003[] = {0x01, 0x44};
+static char auo_fix_004[] = {0x02, 0x54};
+static char auo_fix_005[] = {0x03, 0x55};
+static char auo_fix_006[] = {0x04, 0x55};
+static char auo_fix_007[] = {0x05, 0x33};
+static char auo_fix_008[] = {0x06, 0x22};
+static char auo_fix_009[] = {0x08, 0x56};
+static char auo_fix_010[] = {0x09, 0x8F};
+static char auo_fix_011[] = {0x0B, 0xAF};
+static char auo_fix_012[] = {0x0C, 0xAF};
+static char auo_fix_013[] = {0x0D, 0x2F};
+static char auo_fix_014[] = {0x0E, 0x1F};
+static char auo_fix_015[] = {0x11, 0x84};
+static char auo_fix_016[] = {0x12, 0x03};
+
+static char auo_fix_017[] = {0x71, 0x2C};
+static char auo_fix_018[] = {0x6F, 0x03};
+
+static char auo_fix_019[] = {0x0F, 0x0A};
+static char auo_fix_020[] = {0xFF, 0x05};
+static char auo_fix_021[] = {0xFB, 0x01};
+static char auo_fix_022[] = {0x01, 0x00};
+static char auo_fix_023[] = {0x02, 0x8D};
+static char auo_fix_024[] = {0x03, 0x8D};
+static char auo_fix_025[] = {0x04, 0x8D};
+static char auo_fix_026[] = {0x05, 0x30};
+static char auo_fix_027[] = {0x06, 0x33};
+static char auo_fix_028[] = {0x07, 0x01};
+static char auo_fix_029[] = {0x08, 0x00};
+static char auo_fix_030[] = {0x09, 0x30};
+static char auo_fix_031[] = {0x0A, 0x30};
+static char auo_fix_032[] = {0x0D, 0x11};
+static char auo_fix_033[] = {0x0E, 0x1A};
+static char auo_fix_034[] = {0x0F, 0x08};
+static char auo_fix_035[] = {0x10, 0x53};
+static char auo_fix_036[] = {0x11, 0x00};
+static char auo_fix_037[] = {0x12, 0x00};
+static char auo_fix_038[] = {0x14, 0x01};
+static char auo_fix_039[] = {0x15, 0x00};
+static char auo_fix_040[] = {0x16, 0x05};
+static char auo_fix_041[] = {0x17, 0x08};
+static char auo_fix_042[] = {0x19, 0x7F};
+static char auo_fix_043[] = {0x1A, 0xFF};
+static char auo_fix_044[] = {0x1B, 0x0F};
+static char auo_fix_045[] = {0x1C, 0x00};
+static char auo_fix_046[] = {0x1D, 0x00};
+static char auo_fix_047[] = {0x1E, 0x00};
+static char auo_fix_048[] = {0x1F, 0x07};
+static char auo_fix_049[] = {0x20, 0x00};
+static char auo_fix_050[] = {0x21, 0x00};
+static char auo_fix_051[] = {0x22, 0x55};
+static char auo_fix_052[] = {0x23, 0x0D};
+static char auo_fix_053[] = {0x2D, 0x02};
+static char auo_fix_054[] = {0x83, 0x01};
+static char auo_fix_055[] = {0x9E, 0x58};
+static char auo_fix_056[] = {0x9F, 0x6A};
+static char auo_fix_057[] = {0xA0, 0x01};
+static char auo_fix_058[] = {0xA2, 0x10};
+static char auo_fix_059[] = {0xBB, 0x0A};
+static char auo_fix_060[] = {0xBC, 0x0A};
+
+static char auo_fix_061[] = {0x23, 0x4D};
+static char auo_fix_062[] = {0x6C, 0x00};
+static char auo_fix_063[] = {0x6D, 0x00};
+
+static char auo_fix_064[] = {0x28, 0x00};
+static char auo_fix_065[] = {0x2F, 0x00};
+static char auo_fix_066[] = {0x32, 0x08};
+static char auo_fix_067[] = {0x33, 0xB8};
+static char auo_fix_068[] = {0x36, 0x01};
+static char auo_fix_069[] = {0x37, 0x00};
+static char auo_fix_070[] = {0x43, 0x00};
+static char auo_fix_071[] = {0x4B, 0x21};
+static char auo_fix_072[] = {0x4C, 0x03};
+static char auo_fix_073[] = {0x50, 0x21};
+static char auo_fix_074[] = {0x51, 0x03};
+static char auo_fix_075[] = {0x58, 0x21};
+static char auo_fix_076[] = {0x59, 0x03};
+static char auo_fix_077[] = {0x5D, 0x21};
+static char auo_fix_078[] = {0x5E, 0x03};
+
+static char sw_wr00[] = {0xFF, 0xEE};
+static char sw_wr01[] = {0xFB, 0x01};
+static char sw_wr02[] = {0x12, 0x33};
+static char sw_wr03[] = {0x13, 0x04};
+
+static struct dsi_cmd_desc auo_panel_video_mode_cmds[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_000), auo_fix_000},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_001),	auo_fix_001},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_002),	auo_fix_002},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_003),	auo_fix_003},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_004),	auo_fix_004},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_005),	auo_fix_005},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_006),	auo_fix_006},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_007),	auo_fix_007},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_008),	auo_fix_008},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_009),	auo_fix_009},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_010),	auo_fix_010},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_011),	auo_fix_011},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_012),	auo_fix_012},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_013),	auo_fix_013},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_014),	auo_fix_014},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_015),	auo_fix_015},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_016),	auo_fix_016},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_017),	auo_fix_017},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_018),	auo_fix_018},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_019),	auo_fix_019},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_020),	auo_fix_020},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_021),	auo_fix_021},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_022),	auo_fix_022},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_023),	auo_fix_023},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_024),	auo_fix_024},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_025),	auo_fix_025},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_026),	auo_fix_026},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_027),	auo_fix_027},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_028),	auo_fix_028},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_029),	auo_fix_029},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_030),	auo_fix_030},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_031),	auo_fix_031},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_032),	auo_fix_032},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_033),	auo_fix_033},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_034),	auo_fix_034},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_035),	auo_fix_035},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_036),	auo_fix_036},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_037),	auo_fix_037},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_038),	auo_fix_038},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_039),	auo_fix_039},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_040),	auo_fix_040},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_041),	auo_fix_041},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_042),	auo_fix_042},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_043),	auo_fix_043},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_044),	auo_fix_044},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_045),	auo_fix_045},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_046),	auo_fix_046},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_047),	auo_fix_047},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_048),	auo_fix_048},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_049),	auo_fix_049},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_050),	auo_fix_050},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_051),	auo_fix_051},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_052),	auo_fix_052},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_053),	auo_fix_053},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_054),	auo_fix_054},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_055),	auo_fix_055},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_056),	auo_fix_056},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_057),	auo_fix_057},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_058),	auo_fix_058},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_059),	auo_fix_059},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_060),	auo_fix_060},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_061),	auo_fix_061},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_062),	auo_fix_062},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_063),	auo_fix_063},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_064),	auo_fix_064},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_065),	auo_fix_065},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_066),	auo_fix_066},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_067),	auo_fix_067},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_068),	auo_fix_068},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_069),	auo_fix_069},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_070),	auo_fix_070},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_071),	auo_fix_071},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_072),	auo_fix_072},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_073),	auo_fix_073},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_074),	auo_fix_074},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_075),	auo_fix_075},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_076),	auo_fix_076},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_077),	auo_fix_077},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(auo_fix_078),	auo_fix_078},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(cmd_page_0), cmd_page_0},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(set_threelane), set_threelane},
+#ifdef JEL_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_cmd), display_mode_cmd},
+#else
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_video), display_mode_video},
+#endif
+
+#if 1
+	/* vivi color ver 2 */
+
+	// enable smart color
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x66}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x26}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x11}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x18}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x0C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x07}},
+
+	// add smart color
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0x06}},  // add redden
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1C, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1E, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x20, 0x00}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+#endif
+
+#if 1
+	/* New gamma setting start */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr01), swr01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr02), swr02},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0x32}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0x4B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0x92}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xA5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xB7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0xC6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0xD4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x29}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0xA2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x25}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0x5D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0x93}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0xB6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x37}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x5A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0x75}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0x8D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xA2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0xB9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0x32}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0x4B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0x92}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xA5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xB7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0xC6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0xD4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x29}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0xA2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x25}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0x5D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0x93}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0xB6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x37}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x5A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0x75}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0x8D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xA2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEC, 0xB9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xED, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEE, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF0, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF2, 0xD4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF4, 0xE0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF6, 0xEE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF8, 0xFA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFA, 0x05}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x10}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x1A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x64}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0xBD}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0xFD}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x10, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x11, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x32}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x14, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x15, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x16, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x17, 0x94}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0xB5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0xE2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1C, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1E, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1F, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x20, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0x38}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x56}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0x66}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0x7C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2B, 0x8D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2F, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x30, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x31, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x32, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x33, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x34, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x35, 0xD4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x36, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x37, 0xE0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x38, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0xEE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3B, 0xFA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3D, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3F, 0x05}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x40, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x41, 0x10}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x42, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x43, 0x1A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x44, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x45, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x47, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x48, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x49, 0x64}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4B, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4D, 0xBD}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4F, 0xFD}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x50, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x51, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x52, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x32}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x54, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x56, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x58, 0x94}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x59, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5A, 0xB5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5C, 0xE2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x60, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x61, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x62, 0x38}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x63, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x64, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x65, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x66, 0x56}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x67, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x68, 0x66}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x69, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x7C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6C, 0x8D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6E, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x70, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x71, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x72, 0x9B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x73, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x74, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0xC1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0xCF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0xDB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xE7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xF1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0x3F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0x2B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x63}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0xBB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0xE8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0x40}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x4C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x53}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x5C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0x5A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0x5F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0x9B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0xC1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0xCF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0xDB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xE7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xF1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0x3F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0x2B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x63}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0xBB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0xE8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0x40}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x4C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x53}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x5C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0x5A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0x5F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xCB}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x08}},//PWMDIV=8
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	/* New gamma setting end */
+
+#endif
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10, sizeof(exit_sleep), exit_sleep},
+
+	/* for cut 1 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sw_wr00), sw_wr00},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sw_wr01), sw_wr01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sw_wr02), sw_wr02},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(sw_wr03), sw_wr03},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(cmd_page_0), cmd_page_0},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x33}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0x34}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x00}},
+
+	/* For random dot noise */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x50} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x60} },
+	//{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* Enable CABC setting */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x2D} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0xFF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0xF7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0xEF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0xE7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0xDF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0xD7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0xCF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0xC7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0xBF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0xB7} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x06} },
+
+	/* NVT: Enable vivid-color, but disable CABC, please set register(55h) as 0x80  */
+	/*{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x80}},*/
+
+	/* NVT: Enable vivid-color, and enable CABC UI-Mode, please set register(55h) as 0x81 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x81}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Still-Mode, please set register(55h) as 0x82 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55, 0x82} }, */
+
+	/* NVT: Enable vivid-color, and enable CABC Moving-Mode, please set register(55h) as 0x83 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x83}},
+
+
+	/* {DTYPE_DCS_WRITE, 1, 0, 0, 150, sizeof(exit_sleep), exit_sleep}, */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x24} },
+};
+
+static struct dsi_cmd_desc auo_panel_video_mode_cmds_c2[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(set_threelane), set_threelane},
+#ifdef JEL_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_cmd), display_mode_cmd},
+#else
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_video), display_mode_video},
+#endif
+
+#if 1
+	/* vivi color ver 2 */
+
+	// enable smart color
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x66}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x26}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x11}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x18}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x0C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x07}},
+
+	// add smart color
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0x06}},  // add redden
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1C, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1E, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x20, 0x00}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+#endif
+
+#if 1
+	/* New gamma setting start */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr01), swr01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr02), swr02},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0x32}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0x4B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0x92}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xA5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xB7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0xC6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0xD4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x29}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0xA2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x25}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0x5D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0x93}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0xB6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x37}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x5A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0x75}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0x8D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xA2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0xB9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0x32}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0x4B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0x8C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0x92}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xA5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xB7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0xC6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0xD4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x29}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0xA2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0xE9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x25}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0x5D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0x93}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0xB6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0xE6}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x37}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x5A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0x6A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0x75}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0x8D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xA2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEC, 0xB9}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xED, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEE, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF0, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF2, 0xD4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF4, 0xE0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF6, 0xEE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF8, 0xFA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFA, 0x05}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x10}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x1A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x64}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0xBD}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0xFD}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x10, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x11, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x32}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x14, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x15, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x16, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x17, 0x94}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0xB5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0xE2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1C, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1E, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1F, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x20, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0x38}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x56}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0x66}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0x7C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2B, 0x8D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2F, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x30, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x31, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x32, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x33, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x34, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x35, 0xD4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x36, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x37, 0xE0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x38, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0xEE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3B, 0xFA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3D, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3F, 0x05}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x40, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x41, 0x10}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x42, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x43, 0x1A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x44, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x45, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x47, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x48, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x49, 0x64}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4B, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4D, 0xBD}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4F, 0xFD}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x50, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x51, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x52, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x32}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x54, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55, 0x61}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x56, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x58, 0x94}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x59, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5A, 0xB5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5C, 0xE2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x60, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x61, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x62, 0x38}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x63, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x64, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x65, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x66, 0x56}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x67, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x68, 0x66}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x69, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x7C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6C, 0x8D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6E, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x70, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x71, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x72, 0x9B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x73, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x74, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0xC1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0xCF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0xDB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xE7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xF1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0x3F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0x2B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x63}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0xBB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0xE8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0x40}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x4C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x53}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x5C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0x5A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0x5F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0x9B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xA1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0xB3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0xC1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0xCF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0xDB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xE7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xF1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xFC}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0x3F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x81}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0xAA}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0xF0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0x2B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x63}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0xBB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0xE8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0x40}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x4C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x53}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x5C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0x5A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0x5F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0x73}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xCB}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x08}},//PWMDIV=8
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	/* New gamma setting end */
+#endif
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+	{DTYPE_DCS_WRITE, 1, 0, 0, 100, sizeof(exit_sleep), exit_sleep},
+
+	/* For random dot noise */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x50} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x60} },
+	//{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* Enable CABC setting */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x2D} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0xFF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0xF7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0xEF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0xE7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0xDF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0xD7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0xCF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0xC7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0xBF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0xB7} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x06}},
+
+	/* NVT: Enable vivid-color, but disable CABC, please set register(55h) as 0x80  */
+	/*{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x80}},*/
+
+	/* NVT: Enable vivid-color, and enable CABC UI-Mode, please set register(55h) as 0x81 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x81}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Still-Mode, please set register(55h) as 0x82 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x82}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Moving-Mode, please set register(55h) as 0x83 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x83}},
+
+
+	/* {DTYPE_DCS_WRITE, 1, 0, 0, 150, sizeof(exit_sleep), exit_sleep}, */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x24}},
+};
+static struct dsi_cmd_desc auo_panel_video_mode_cmds_c3[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(set_threelane), set_threelane},
+#ifdef JEL_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_cmd), display_mode_cmd},
+#else
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_video), display_mode_video},
+#endif
+
+#if 1
+	/* vivi color ver 2 */
+
+	// enable smart color
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x66}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x26}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x11}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x18}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x0C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x07}},
+
+	// add smart color
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0x06}},  // add redden
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1C, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1E, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x20, 0x00}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+#endif
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x08}},//PWMDIV=8
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10, sizeof(exit_sleep), exit_sleep},
+
+	/* For random dot noise */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x50} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x60} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* Enable CABC setting */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x2D} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0xFF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0xF7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0xEF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0xE7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0xDF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0xD7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0xCF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0xC7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0xBF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0xB7} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x06}},
+
+	/* NVT: Enable vivid-color, but disable CABC, please set register(55h) as 0x80  */
+	/*{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x80}},*/
+
+	/* NVT: Enable vivid-color, and enable CABC UI-Mode, please set register(55h) as 0x81 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x81}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Still-Mode, please set register(55h) as 0x82 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x82}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Moving-Mode, please set register(55h) as 0x83 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x83}},
+
+
+	/* {DTYPE_DCS_WRITE, 1, 0, 0, 150, sizeof(exit_sleep), exit_sleep}, */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x24}},
+};
+
+static struct dsi_cmd_desc auo_panel_video_mode_cmds_c3_1[] = {
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(set_threelane), set_threelane},
+#ifdef JEL_CMD_MODE_PANEL
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_cmd), display_mode_cmd},
+#else
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(display_mode_video), display_mode_video},
+#endif
+
+#if 1
+	/* vivi color ver 2 */
+
+	// enable smart color
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x66}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x08}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x26}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x0B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x11}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x18}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x27}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x2E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x2C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x24}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x1B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x0C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0x07}},
+
+	// add smart color
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0x06}},  // add redden
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1C, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1E, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x20, 0x00}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFE, 0x01}},
+#endif
+
+#if 1
+	/* New gamma setting start */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr01), swr01},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(swr02), swr02},
+
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0x7D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0x8A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0xB1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xCF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xDD}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0xE8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0xF2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x1F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x41}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0x78}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0xA5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0xEE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x29}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0x5D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0x93}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0xB8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0xE7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x37}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x56}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0x66}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0x7A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0x93}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xA3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0xB4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0x7D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0x8A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0x9C}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0xB1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xBF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xCF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xDD}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0xE8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0xF2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x1F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x41}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0x78}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0xA5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0xEE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x29}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x2A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0x5D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0x93}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0xB8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0xE7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0x07}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x37}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x46}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x56}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0x66}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0x7A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0x93}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xA3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEC, 0xB4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xED, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEE, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF0, 0xED}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF2, 0xF3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF4, 0xFE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF6, 0x09}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF8, 0x13}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xF9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFA, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x00, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x01, 0x26}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x02, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x03, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x04, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x37}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x06, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x07, 0x56}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x08, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0B, 0x9D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0D, 0xC2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0F, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x10, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x11, 0x31}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x32}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x14, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x15, 0x60}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x16, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x17, 0x94}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x18, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x19, 0xB5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1A, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1B, 0xE3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1C, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1E, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x1F, 0x2D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x20, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0x3A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0x48}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0x57}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0x68}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0x7B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2B, 0x90}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2D, 0x03}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2F, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x30, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x31, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x32, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x33, 0xED}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x34, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x35, 0xF3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x36, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x37, 0xFE}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x38, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x39, 0x09}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3B, 0x13}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3D, 0x01}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x3F, 0x1D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x40, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x41, 0x26}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x42, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x43, 0x2F}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x44, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x45, 0x37}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x46, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x47, 0x56}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x48, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x49, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4B, 0x9D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4C, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4D, 0xC2}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4E, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x4F, 0xFF}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x50, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x51, 0x31}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x52, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x32}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x54, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55, 0x60}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x56, 0x02}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x58, 0x94}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x59, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5A, 0xB5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5B, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5C, 0xE3}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x60, 0x2D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x61, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x62, 0x3A}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x63, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x64, 0x48}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x65, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x66, 0x57}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x67, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x68, 0x68}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x69, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x7B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6C, 0x90}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6E, 0xA0}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x70, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x71, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x72, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x73, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x74, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x75, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x76, 0x55}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x77, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x78, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x79, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7A, 0x83}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7B, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7C, 0x99}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7D, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7E, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x7F, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x80, 0xB7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x81, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x82, 0xC5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x83, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x84, 0xF7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x85, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x86, 0x1E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x87, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x88, 0x60}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x89, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8A, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8B, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8C, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8D, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8E, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x8F, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x90, 0x23}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x91, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x92, 0x59}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x93, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x94, 0x94}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x95, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x96, 0xB4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x97, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x98, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x99, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9A, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9B, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9C, 0x28}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9D, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9E, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x9F, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA0, 0x37}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA2, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA3, 0x3B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA4, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA5, 0x40}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA6, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA7, 0x50}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xA9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAA, 0x6D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAC, 0x80}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAE, 0xCB}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xAF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB0, 0x19}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB2, 0x36}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB3, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB4, 0x55}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB5, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB6, 0x70}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB7, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB8, 0x83}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xB9, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBA, 0x99}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBB, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBC, 0xA8}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBD, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBE, 0xB7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xBF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC0, 0xC5}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC1, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC2, 0xF7}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC3, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC4, 0x1E}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC5, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC6, 0x60}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC7, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC8, 0x95}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xC9, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCA, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCB, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCC, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCD, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCE, 0x23}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xCF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD0, 0x59}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD1, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD2, 0x94}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD3, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD4, 0xB4}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD5, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD6, 0xE1}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD8, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xD9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDA, 0x28}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDB, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDC, 0x30}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDD, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDE, 0x37}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xDF, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE0, 0x3B}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE1, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE2, 0x40}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE3, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE4, 0x50}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE5, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE6, 0x6D}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE7, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE8, 0x80}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xE9, 0x03}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xEA, 0xCB}},
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x02}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	/* New gamma setting end */
+#endif
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFB, 0x01}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x09, 0x20}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x0A, 0x08}},//PWMDIV=8
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+
+	{DTYPE_DCS_WRITE, 1, 0, 0, 10, sizeof(exit_sleep), exit_sleep},
+
+	/* For random dot noise */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0xEE} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x12, 0x50} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x13, 0x02} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x6A, 0x60} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00} },
+
+	/* Enable CABC setting */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x04} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x05, 0x2D} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x21, 0xFF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x22, 0xF7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x23, 0xEF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x24, 0xE7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x25, 0xDF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x26, 0xD7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x27, 0xCF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x28, 0xC7} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x29, 0xBF} },
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x2A, 0xB7} },
+
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0xFF, 0x00}},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, sizeof(enable_te), enable_te},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x5E, 0x06}},
+
+	/* NVT: Enable vivid-color, but disable CABC, please set register(55h) as 0x80  */
+	/*{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x80}},*/
+
+	/* NVT: Enable vivid-color, and enable CABC UI-Mode, please set register(55h) as 0x81 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x81}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Still-Mode, please set register(55h) as 0x82 */
+	/* {DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x82}}, */
+
+	/* NVT: Enable vivid-color, and enable CABC Moving-Mode, please set register(55h) as 0x83 */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x55,0x83}},
+
+
+	/* {DTYPE_DCS_WRITE, 1, 0, 0, 150, sizeof(exit_sleep), exit_sleep}, */
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0, 2, (char[]){0x53, 0x24}},
+};
+
+static int jet_send_display_cmds(struct dsi_cmd_desc *cmd, int cnt)
+{
+	int ret = 0;
+#ifdef JET_USE_CMDLISTS
+	struct dcs_cmd_req cmdreq;
+
+	cmdreq.cmds = cmd;
+	cmdreq.cmds_cnt = cnt;
+	cmdreq.flags = CMD_REQ_COMMIT;
+	cmdreq.rlen = 0;
+	cmdreq.cb = NULL;
+
+	ret = mipi_dsi_cmdlist_put(&cmdreq);
+#else
+
+	MIPI_OUTP(MIPI_DSI_BASE + 0x38, 0x10000000);
+	ret = mipi_dsi_cmds_tx(&jet_tx_buf, cmd, cnt);
+	MIPI_OUTP(MIPI_DSI_BASE + 0x38, 0x14000000);
+#endif
+	if (ret < 0)
+		printk(KERN_ERR "[DISP] %s failed (%d)\n", __func__, ret);
+	return ret;
+}
+
+static void mipi_jet_per_panel_fcts_init(void)
+{
+	/* Common parts */
+	jet_display_on_cmds = display_on_cmds;
+	jet_display_on_cmds_count = ARRAY_SIZE(display_on_cmds);
+
+	jet_cmd_backlight_cmds = cmd_bkl_cmds;
+	jet_cmd_backlight_cmds_count = ARRAY_SIZE(cmd_bkl_cmds);
+
+	jet_display_off_cmds	= sony_display_off_cmds;
+	jet_display_off_cmds_count = ARRAY_SIZE(sony_display_off_cmds);
+
+	if (panel_type == PANEL_ID_FIGHTER_LG_NT) {
+		jet_display_off_cmds = novatek_display_off_cmds;
+		jet_display_off_cmds_count = ARRAY_SIZE(novatek_display_off_cmds);
+
+		jet_command_on_cmds = lg_novatek_cmd_on_cmds;
+		jet_command_on_cmds_count = ARRAY_SIZE(lg_novatek_cmd_on_cmds);
+	}
+	if (panel_type == PANEL_ID_JET_SONY_NT) {
+		jet_video_on_cmds = sony_c1_video_on_cmds;
+		jet_video_on_cmds_count = ARRAY_SIZE(sony_c1_video_on_cmds);
+
+		jet_command_on_cmds = sony_c1_video_on_cmds;
+		jet_command_on_cmds_count = ARRAY_SIZE(sony_c1_video_on_cmds);
+	}
+	else if (panel_type == PANEL_ID_JET_SONY_NT_C1) {
+		jet_video_on_cmds = sony_c1_video_on_cmds;
+		jet_video_on_cmds_count = ARRAY_SIZE(sony_c1_video_on_cmds);
+
+		jet_command_on_cmds = sony_c1_video_on_cmds;
+		jet_command_on_cmds_count = ARRAY_SIZE(sony_c1_video_on_cmds);
+	}
+	else if (panel_type == PANEL_ID_JET_SONY_NT_C2) {
+		jet_video_on_cmds = sony_panel_video_mode_cmds_c2;
+		jet_video_on_cmds_count = ARRAY_SIZE(sony_panel_video_mode_cmds_c2);
+
+		jet_command_on_cmds = sony_panel_video_mode_cmds_c2;
+		jet_command_on_cmds_count = ARRAY_SIZE(sony_panel_video_mode_cmds_c2);
+	}
+	else if (panel_type == PANEL_ID_JET_AUO_NT) {
+		jet_video_on_cmds = auo_panel_video_mode_cmds;
+		jet_video_on_cmds_count = ARRAY_SIZE(auo_panel_video_mode_cmds);
+
+		jet_command_on_cmds = auo_panel_video_mode_cmds;
+		jet_command_on_cmds_count = ARRAY_SIZE(auo_panel_video_mode_cmds);
+	}
+	else if (panel_type == PANEL_ID_JET_AUO_NT_C2) {
+		jet_video_on_cmds = auo_panel_video_mode_cmds_c2;
+		jet_video_on_cmds_count = ARRAY_SIZE(auo_panel_video_mode_cmds_c2);
+
+		jet_command_on_cmds = auo_panel_video_mode_cmds_c2;
+		jet_command_on_cmds_count = ARRAY_SIZE(auo_panel_video_mode_cmds_c2);
+	}
+	else if (panel_type == PANEL_ID_JET_AUO_NT_C3) {
+		jet_video_on_cmds = auo_panel_video_mode_cmds_c3;
+		jet_video_on_cmds_count = ARRAY_SIZE(auo_panel_video_mode_cmds_c3);
+
+		jet_command_on_cmds = auo_panel_video_mode_cmds_c3;
+		jet_command_on_cmds_count = ARRAY_SIZE(auo_panel_video_mode_cmds_c3);
+	}
+	else if (panel_type == PANEL_ID_JET_AUO_NT_C3_1) {
+		jet_video_on_cmds = auo_panel_video_mode_cmds_c3_1;
+		jet_video_on_cmds_count = ARRAY_SIZE(auo_panel_video_mode_cmds_c3_1);
+
+		jet_command_on_cmds = auo_panel_video_mode_cmds_c3_1;
+		jet_command_on_cmds_count = ARRAY_SIZE(auo_panel_video_mode_cmds_c3_1);
+	}
+}
+
+static int mipi_jet_lcd_on(struct platform_device *pdev)
+{
+	struct msm_fb_data_type *mfd;
+	struct mipi_panel_info *mipi;
+
+	mfd = platform_get_drvdata(pdev);
+	if (!mfd)
+		return -ENODEV;
+	if (mfd->key != MFD_KEY)
+		return -EINVAL;
+
+	mipi  = &mfd->panel_info.mipi;
+
+	if (!mipi_lcd_on) {
+		jet_send_display_cmds(nvt_LowTemp_wrkr_enter,
+				ARRAY_SIZE(nvt_LowTemp_wrkr_enter));
+
+		jet_send_display_cmds(nvt_LowTemp_wrkr_exit,
+				ARRAY_SIZE(nvt_LowTemp_wrkr_exit));
+
+		gpio_set_value(JET_GPIO_LCD_RSTz, 0);
+		msleep(1);
+		gpio_set_value(JET_GPIO_LCD_RSTz, 1);
+		msleep(20);
+	}
+
+	if (!mipi_lcd_on) {
+		if (panel_type != PANEL_ID_NONE) {
+			if (mipi->mode == DSI_VIDEO_MODE) {
+				jet_send_display_cmds(jet_video_on_cmds, jet_video_on_cmds_count);
+				printk(KERN_INFO "%s: panel_type video mode (%d)", __func__, panel_type);
+			} else {
+				jet_send_display_cmds(jet_command_on_cmds, jet_command_on_cmds_count);
+				printk(KERN_INFO "%s: panel_type command mode (%d)", __func__, panel_type);
+			}
+			jet_send_display_cmds(jet_display_on_cmds, jet_display_on_cmds_count);
+		} else
+			printk(KERN_INFO "%s: panel_type not supported!(%d)", __func__, panel_type);
+	}
+	mipi_lcd_on = 1;
+
+	return 0;
+}
+
+static int mipi_jet_lcd_off(struct platform_device *pdev)
+{
+	struct msm_fb_data_type *mfd;
+
+	mfd = platform_get_drvdata(pdev);
+
+	if (!mfd)
+		return -ENODEV;
+	if (mfd->key != MFD_KEY)
+		return -EINVAL;
+
+	if (!mipi_lcd_on)
+		return 0;
+
+	if (panel_type != PANEL_ID_NONE) {
+		printk(KERN_INFO "%s\n", __func__);
+		jet_send_display_cmds(jet_display_off_cmds,
+				jet_display_off_cmds_count);
+	}
+
+	bl_level_prevset = 0;
+	mipi_lcd_on = 0;
+
+	return 0;
+}
+
+static unsigned char jet_shrink_pwm(int val)
+{
+	unsigned char shrink_br = BRI_SETTING_MAX;
+
+	if (val <= 0) {
+		shrink_br = 0;
+	} else if (val > 0 && (val < BRI_SETTING_MIN)) {
+		shrink_br = PWM_MIN;
+	} else if ((val >= BRI_SETTING_MIN) && (val <= BRI_SETTING_DEF)) {
+		shrink_br = (val - BRI_SETTING_MIN) * (PWM_DEFAULT - PWM_MIN) /
+			(BRI_SETTING_DEF - BRI_SETTING_MIN) + PWM_MIN;
+	} else if (val > BRI_SETTING_DEF && val <= BRI_SETTING_MAX) {
+		shrink_br = (val - BRI_SETTING_DEF) * (PWM_MAX - PWM_DEFAULT) /
+			(BRI_SETTING_MAX - BRI_SETTING_DEF) + PWM_DEFAULT;
+	} else if (val > BRI_SETTING_MAX)
+		shrink_br = PWM_MAX;
+
+	printk(KERN_INFO "brightness orig=%d, transformed=%d\n", val, shrink_br);
+
+	return shrink_br;
+}
+
+inline void mipi_dsi_set_backlight(struct msm_fb_data_type *mfd, int level)
+{
+	printk(KERN_ERR "[DISP] %s level=%d\n", __func__, level);
+
+	led_pwm1[1] = jet_shrink_pwm(mfd->bl_level);
+
+	if (mfd->bl_level == 0)
+		jet_send_display_cmds(disable_dim, ARRAY_SIZE(disable_dim));
+
+	jet_send_display_cmds(jet_cmd_backlight_cmds, jet_cmd_backlight_cmds_count);
+
+	bl_level_prevset = mfd->bl_level;
+
+	printk(KERN_DEBUG "%s+ bl_level=%d\n", __func__, mfd->bl_level);
+	return;
+}
+
+static void mipi_jet_set_backlight(struct msm_fb_data_type *mfd)
+{
+	mipi_dsi_set_backlight(mfd, mfd->bl_level);
+}
+
+static int __devinit mipi_jet_lcd_probe(struct platform_device *pdev)
+{
+	mipi_jet_per_panel_fcts_init();
+
+	if (pdev->id == 0) {
+		mipi_jet_pdata = pdev->dev.platform_data;
+		return 0;
+	}
+
+	msm_fb_add_device(pdev);
+	return 0;
+}
+
+/* HTC specific functions */
+#ifdef CONFIG_FB_MSM_CABC
+void mipi_jet_enable_ic_cabc(int cabc, bool dim_on, struct msm_fb_data_type *mfd)
+{
+	if (dim_on)
+		dim_cmds = enable_dim;
+	if (cabc == 1)
+		cabc_cmds = cabc_on_ui;
+	else if (cabc == 2)
+		cabc_cmds = cabc_on_still;
+	else if (cabc == 3)
+		cabc_cmds = cabc_on_moving;
+
+	jet_send_display_cmds(dim_cmds, ARRAY_SIZE(dim_cmds));
+
+	printk(KERN_INFO "%s: enable dimming and cabc\n", __func__);
+}
+#endif
+
+static struct platform_driver this_driver = {
+	.probe  = mipi_jet_lcd_probe,
+	.driver = {
+		.name   = "mipi_jet",
+	},
+};
+
+static struct msm_fb_panel_data jet_panel_data = {
+	.on           = mipi_jet_lcd_on,
+	.off          = mipi_jet_lcd_off,
+	.set_backlight = mipi_jet_set_backlight,
+#ifdef CONFIG_FB_MSM_CABC
+	.enable_cabc = mipi_jet_enable_ic_cabc,
+#endif
+};
+
+static int ch_used[3];
+
+int mipi_jet_device_register(struct msm_panel_info *pinfo,
+		u32 channel, u32 panel)
+{
+	struct platform_device *pdev = NULL;
+	int ret;
+
+	if ((channel >= 3) || ch_used[channel])
+		return -ENODEV;
+
+	ch_used[channel] = TRUE;
+
+	ret = mipi_jet_lcd_init();
+	if (ret) {
+		pr_err("mipi_jet_lcd_init() failed with ret %u\n", ret);
+		return ret;
+	}
+
+	pdev = platform_device_alloc("mipi_jet", (panel << 8)|channel);
+	if (!pdev)
+		return -ENOMEM;
+
+	jet_panel_data.panel_info = *pinfo;
+
+	ret = platform_device_add_data(pdev, &jet_panel_data,
+			sizeof(jet_panel_data));
+	if (ret) {
+		printk(KERN_ERR "%s: platform_device_add_data failed!\n", __func__);
+		goto err_device_put;
+	}
+
+	ret = platform_device_add(pdev);
+	if (ret) {
+		printk(KERN_ERR "%s: platform_device_register failed!\n", __func__);
+		goto err_device_put;
+	}
+
+	return 0;
+
+err_device_put:
+	platform_device_put(pdev);
+	return ret;
+}
+
+static int mipi_jet_lcd_init(void)
+{
+	printk(KERN_ERR  "[DISP] %s +++\n", __func__);
+#ifndef JET_USE_CMDLISTS
+	mipi_dsi_buf_alloc(&jet_tx_buf, DSI_BUF_SIZE);
+	mipi_dsi_buf_alloc(&jet_rx_buf, DSI_BUF_SIZE);
+#endif
+
+	printk(KERN_ERR  "[DISP] %s ---\n", __func__);
+	return platform_driver_register(&this_driver);
+}
diff --git a/arch/arm/mach-msm/htc/jet/display/mipi_jet.h b/arch/arm/mach-msm/htc/jet/display/mipi_jet.h
new file mode 100644
index 0000000..f625b47
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/display/mipi_jet.h
@@ -0,0 +1,24 @@
+#ifndef MIPI_JET_H
+#define MIPI_JET_H
+
+#include <linux/pwm.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+
+int mipi_jet_device_register(struct msm_panel_info *pinfo,
+                                 u32 channel, u32 panel);
+
+#define JET_USE_CMDLISTS 1
+
+#define PWM_MIN                   6
+#define PWM_DEFAULT               91
+#define PWM_MAX                   255
+
+#define BRI_SETTING_MIN                 30
+#define BRI_SETTING_DEF                 143
+#define BRI_SETTING_MAX                 255
+
+#define JEL_CMD_MODE_PANEL
+#undef JEL_VIDEO_MODE_PANEL
+#undef JEL_SWITCH_MODE_PANEL
+
+#endif /* !MIPI_JET_H */
diff --git a/arch/arm/mach-msm/htc/jet/display/mipi_jet_720p_pt.c b/arch/arm/mach-msm/htc/jet/display/mipi_jet_720p_pt.c
new file mode 100644
index 0000000..28b8fb3
--- /dev/null
+++ b/arch/arm/mach-msm/htc/jet/display/mipi_jet_720p_pt.c
@@ -0,0 +1,237 @@
+#include "../../../drivers/video/msm/msm_fb.h"
+#include "../../../drivers/video/msm/mipi_dsi.h"
+#include "mipi_jet.h"
+#include <mach/panel_id.h>
+
+static struct mipi_dsi_phy_ctrl nova_dsi_video_mode_phy_db = {
+	/* DSI_BIT_CLK at 569MHz, 3 lane, RGB888 */
+	/* regulator *//* off=0x0500 */
+	{0x03, 0x08, 0x05, 0x00, 0x20},
+	/* timing *//* off=0x0440 */
+	{0x9B, 0x38, 0x18, 0x00, 0x4B, 0x51, 0x1C,
+		0x3B, 0x29, 0x03, 0x04, 0xA0},
+	/* phy ctrl *//* off=0x0470 */
+	{0x5F, 0x00, 0x00, 0x10},
+	/* strength *//* off=0x0480 */
+	{0xFF, 0x00, 0x06, 0x00},
+	/* pll control *//* off=0x0204 */
+	{0x0, 0x38, 0x32, 0xDA, 0x00, 0x10, 0x0F, 0x61,
+		0x41, 0x0F, 0x01,
+		0x00, 0x1A, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x02 },
+};
+
+static struct msm_panel_info pinfo;
+
+static int __init mipi_video_auo_hd720p_init(void)
+{
+	int ret;
+#ifdef JEL_CMD_MODE_PANEL
+	printk(KERN_INFO "%s: CMD mode (AL)\n", __func__);
+	pinfo.type = MIPI_CMD_PANEL;
+	pinfo.mipi.mode = DSI_CMD_MODE;
+	pinfo.mipi.dst_format = DSI_CMD_DST_FORMAT_RGB888;
+	/*pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_NONE;*/
+	pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_SW;
+#ifdef CONFIG_FB_MSM_SELF_REFRESH
+	jet_panel_data.self_refresh_switch = NULL; /* CMD or VIDEO mode only */
+#endif
+	pinfo.lcd.vsync_enable = TRUE;
+	pinfo.lcd.hw_vsync_mode = TRUE;
+	pinfo.lcd.refx100 = 6096; /* adjust refx100 to prevent tearing */
+	pinfo.mipi.te_sel = 1; /* TE from vsycn gpio */
+	pinfo.mipi.interleave_max = 1;
+	pinfo.mipi.insert_dcs_cmd = TRUE;
+	pinfo.mipi.wr_mem_continue = 0x3c;
+	pinfo.mipi.wr_mem_start = 0x2c;
+#else
+	pinfo.type = MIPI_VIDEO_PANEL;/*MIPI_VIDEO_PANEL;*/
+	pinfo.mipi.mode = DSI_VIDEO_MODE;
+	pinfo.mipi.dst_format = DSI_VIDEO_DST_FORMAT_RGB888;
+	pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_SW;
+#ifdef CONFIG_FB_MSM_SELF_REFRESH
+	printk(KERN_INFO "%s: VIDEO mode (AL)\n", __func__);
+	jet_panel_data.self_refresh_switch = NULL; /* CMD or VIDEO mode only */
+#else
+	printk(KERN_INFO "%s: SWITCH mode (AL)\n", __func__);
+#endif
+	pinfo.mipi.pulse_mode_hsa_he = TRUE;
+	pinfo.mipi.hfp_power_stop = TRUE;
+	pinfo.mipi.hbp_power_stop = TRUE;
+	pinfo.mipi.hsa_power_stop = TRUE;
+	pinfo.mipi.eof_bllp_power_stop = TRUE;
+	pinfo.mipi.bllp_power_stop = TRUE;
+	pinfo.mipi.traffic_mode = DSI_NON_BURST_SYNCH_PULSE;
+#endif
+
+	pinfo.xres = 720;
+	pinfo.yres = 1280;
+
+	pinfo.pdest = DISPLAY_1;
+	pinfo.wait_cycle = 0;
+	pinfo.bpp = 24;
+
+	pinfo.lcdc.h_back_porch = 104;	/* 660Mhz: 116 */
+	pinfo.lcdc.h_front_porch = 95;	/* 660Mhz: 184 */
+	pinfo.lcdc.h_pulse_width = 1;	/* 660Mhz: 24 */
+	pinfo.lcdc.v_back_porch = 2;
+	pinfo.lcdc.v_front_porch = 6;
+	pinfo.lcdc.v_pulse_width = 1;
+
+	pinfo.lcd.v_back_porch = 2;
+	pinfo.lcd.v_front_porch = 6;
+	pinfo.lcd.v_pulse_width = 1;
+
+	pinfo.lcd.primary_vsync_init = pinfo.yres;
+	pinfo.lcd.primary_rdptr_irq = 0;
+	pinfo.lcd.primary_start_pos = pinfo.yres +
+		pinfo.lcd.v_back_porch + pinfo.lcd.v_front_porch - 1;
+
+	pinfo.lcdc.border_clr = 0;	/* blk */
+	pinfo.lcdc.underflow_clr = 0xff;	/* blue */
+	pinfo.lcdc.hsync_skew = 0;
+	pinfo.bl_max = 255;
+	pinfo.bl_min = 1;
+	pinfo.fb_num = 2;
+	/*pinfo.clk_rate = 742500000;*/
+	/*pinfo.clk_rate = 482000000;*/
+	pinfo.clk_rate = 569000000;
+
+	pinfo.mipi.vc = 0;
+	pinfo.mipi.rgb_swap = DSI_RGB_SWAP_RGB;
+	pinfo.mipi.data_lane0 = TRUE;
+	pinfo.mipi.data_lane1 = TRUE;
+	pinfo.mipi.data_lane2 = TRUE;
+	pinfo.mipi.tx_eot_append = TRUE;
+	pinfo.mipi.t_clk_post = 0x10;	/* 660Mhz: 10 */
+	pinfo.mipi.t_clk_pre = 0x21;	/* 660Mhz: 30 */
+	pinfo.mipi.stream = 0;	/* dma_p */
+	pinfo.mipi.dma_trigger = DSI_CMD_TRIGGER_SW;
+	pinfo.mipi.frame_rate = 63;
+	pinfo.mipi.dsi_phy_db = &nova_dsi_video_mode_phy_db;
+
+	ret = mipi_jet_device_register(&pinfo, MIPI_DSI_PRIM,
+			MIPI_DSI_PANEL_WVGA_PT);
+	if (ret)
+		printk(KERN_ERR "%s: failed to register device!\n", __func__);
+
+	return ret;
+}
+
+static int __init mipi_video_sony_hd720p_init(void)
+{
+	int ret;
+
+	/* 1:VIDEO MODE, 0:CMD MODE */
+#ifdef JEL_CMD_MODE_PANEL
+	printk(KERN_INFO "%s: CMD mode (AL)\n", __func__);
+	pinfo.type = MIPI_CMD_PANEL;
+	pinfo.mipi.mode = DSI_CMD_MODE;
+	pinfo.mipi.dst_format = DSI_CMD_DST_FORMAT_RGB888;
+	/*pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_NONE;*/
+	pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_SW;
+#ifdef CONFIG_FB_MSM_SELF_REFRESH
+	jet_panel_data.self_refresh_switch = NULL; /* CMD or VIDEO mode only */
+#endif
+	pinfo.lcd.vsync_enable = TRUE;
+	pinfo.lcd.hw_vsync_mode = TRUE;
+	pinfo.lcd.refx100 = 5700; /* adjust refx100 to prevent tearing */
+	pinfo.mipi.te_sel = 1; /* TE from vsycn gpio */
+	pinfo.mipi.interleave_max = 1;
+	pinfo.mipi.insert_dcs_cmd = TRUE;
+	pinfo.mipi.wr_mem_continue = 0x3c;
+	pinfo.mipi.wr_mem_start = 0x2c;
+
+#else
+	pinfo.type = MIPI_VIDEO_PANEL;
+	pinfo.mipi.mode = DSI_VIDEO_MODE;
+	pinfo.mipi.dst_format = DSI_VIDEO_DST_FORMAT_RGB888;
+	pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_SW;
+#ifdef CONFIG_FB_MSM_SELF_REFRESH
+	printk(KERN_INFO "%s: VIDEO mode (AL)\n", __func__);
+	jet_panel_data.self_refresh_switch = NULL; /* CMD or VIDEO mode only */
+#else
+	printk(KERN_INFO "%s: SWITCH mode (AL)\n", __func__);
+#endif
+
+	pinfo.mipi.pulse_mode_hsa_he = TRUE;
+	pinfo.mipi.hfp_power_stop = TRUE;
+	pinfo.mipi.hbp_power_stop = TRUE;
+	pinfo.mipi.hsa_power_stop = TRUE;
+	pinfo.mipi.eof_bllp_power_stop = TRUE;
+	pinfo.mipi.bllp_power_stop = TRUE;
+	pinfo.mipi.traffic_mode = DSI_NON_BURST_SYNCH_PULSE;
+
+#endif
+
+	pinfo.xres = 720;
+	pinfo.yres = 1280;
+
+	pinfo.pdest = DISPLAY_1;
+	pinfo.wait_cycle = 0;
+	pinfo.bpp = 24;
+
+	pinfo.lcdc.h_back_porch = 104;
+	pinfo.lcdc.h_front_porch = 95;
+	pinfo.lcdc.h_pulse_width = 1;
+	pinfo.lcdc.v_back_porch = 2;
+	pinfo.lcdc.v_front_porch = 6;
+	pinfo.lcdc.v_pulse_width = 1;
+
+	pinfo.lcd.v_back_porch = 2;
+	pinfo.lcd.v_front_porch = 6;
+	pinfo.lcd.v_pulse_width = 1;
+
+	pinfo.lcd.primary_vsync_init = pinfo.yres;
+	pinfo.lcd.primary_rdptr_irq = 0;
+	pinfo.lcd.primary_start_pos = pinfo.yres +
+		pinfo.lcd.v_back_porch + pinfo.lcd.v_front_porch - 1;
+
+	pinfo.lcdc.border_clr = 0;	/* blk */
+	pinfo.lcdc.underflow_clr = 0xff;	/* blue */
+	pinfo.lcdc.hsync_skew = 0;
+	pinfo.bl_max = 255;
+	pinfo.bl_min = 1;
+	pinfo.fb_num = 2;
+	pinfo.clk_rate = 569000000;
+
+	pinfo.mipi.vc = 0;
+	pinfo.mipi.rgb_swap = DSI_RGB_SWAP_RGB;
+	pinfo.mipi.data_lane0 = TRUE;
+	pinfo.mipi.data_lane1 = TRUE;
+	pinfo.mipi.data_lane2 = TRUE;
+	pinfo.mipi.tx_eot_append = TRUE;
+	pinfo.mipi.t_clk_post = 0x10;
+	pinfo.mipi.t_clk_pre = 0x21;
+	pinfo.mipi.stream = 0;	/* dma_p */
+	pinfo.mipi.dma_trigger = DSI_CMD_TRIGGER_SW;
+	pinfo.mipi.frame_rate = 59;
+	pinfo.mipi.dsi_phy_db = &nova_dsi_video_mode_phy_db;
+
+	ret = mipi_jet_device_register(&pinfo, MIPI_DSI_PRIM,
+			MIPI_DSI_PANEL_WVGA_PT);
+	if (ret)
+		printk(KERN_ERR "%s: failed to register device!\n", __func__);
+
+	return ret;
+}
+
+static int __init mipi_jet_panel_init(void)
+{
+	int rc = 0;
+
+	if (panel_type == PANEL_ID_NONE) {
+		printk(KERN_INFO "No panel detected.\n");
+		return -EINVAL;
+	}
+	if (panel_type == PANEL_ID_JET_SONY_NT || panel_type == PANEL_ID_JET_SONY_NT_C1 ||
+			panel_type == PANEL_ID_JET_SONY_NT_C2)
+		rc = mipi_video_sony_hd720p_init();
+	else if (panel_type == PANEL_ID_JET_AUO_NT || panel_type ==
+			PANEL_ID_JET_AUO_NT_C2 || panel_type == PANEL_ID_JET_AUO_NT_C3 ||
+			panel_type == PANEL_ID_JET_AUO_NT_C3_1)
+		rc = mipi_video_auo_hd720p_init();
+
+	return rc;
+}
+
+late_initcall(mipi_jet_panel_init);
diff --git a/arch/arm/mach-msm/htc/radio_feedback.c b/arch/arm/mach-msm/htc/radio_feedback.c
new file mode 100644
index 0000000..686ddd9
--- /dev/null
+++ b/arch/arm/mach-msm/htc/radio_feedback.c
@@ -0,0 +1,214 @@
+/* arch/arm/mach-msm/radio_feedback.c
+ *
+ * Copyright (C) 2010 HTC Corporation.
+ * Author: YaWen Su <YaWen_Su@htc.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#include <linux/device.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/fs.h>
+#include <linux/module.h>
+#include <linux/miscdevice.h>
+#include <linux/mm.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+#include <linux/kernel.h>
+#include <linux/cpufreq.h>
+#include <linux/uaccess.h>
+#include <linux/mutex.h>
+#include <mach/msm_smd.h>
+#include <mach/msm_iomap.h>
+#include <linux/fcntl.h>
+
+#include "smd_private.h"
+#include "acpuclock.h"
+
+#define RADIO_FEEDBACK_IOCTL_MAGIC	'p'
+#define RADIO_FEEDBACK_GET_CDLOG_INFO	_IOW(RADIO_FEEDBACK_IOCTL_MAGIC, 89, unsigned)
+
+#define CONFIG_RADIO_FEEDBACK8660		1
+
+#ifdef CONFIG_RADIO_FEEDBACK8660
+typedef struct {
+
+	uint32_t		cmdseq;
+	uint32_t		rspseq;
+
+	uint32_t		opcode;
+	uint32_t		reserve;
+
+	uint32_t		parameter[4];
+	uint32_t		response[4];
+
+} htc_modem_request_type;
+
+typedef struct {
+	uint32_t      	version;
+	uint32_t      	struct_size;
+
+	uint32_t      	htc_smem_ce_radio_dbg_flag;
+	uint32_t      	htc_smem_app_run_mode;
+	uint32_t      	htc_smem_test_flag;
+	uint32_t		htc_smem_boot_reason;
+	int32_t			htc_cable_status;
+	uint8_t			reserve1[4];
+
+
+	uint32_t      	version_R;
+	uint32_t      	struct_size_R;
+
+	uint32_t      	htc_smem_erase_efs_flag;
+	uint32_t    		htc_smem_flight_mode_flag;
+	uint8_t      		htc_radio_version_addr[16];	
+	uint8_t      		htc_protocol_version_addr[16]; 
+	uint8_t      		reserve2[16];
+
+	htc_modem_request_type		htc_modem_request;		
+
+	uint32_t      	htc_emmc_magic_flag;
+	uint32_t      	htc_emmc_buff_addr;
+	uint32_t      	htc_emmc_buff_size;
+	uint32_t      	htc_emmc_config_offset;
+	uint32_t      	htc_emmc_efs_sync_status;
+	uint32_t      	htc_emmc_nv_calibrate_status;
+	uint32_t     	htc_emmc_is_dev_inited;
+
+	uint32_t      	htc_smem_user_time_offset;
+
+
+	uint32_t      	htc_tcxo_off_time_total;
+	uint32_t      	htc_tcxo_off_cnt_total;
+	uint32_t      	htc_tcxo_off_time_pwrc_suspend;
+	uint32_t      	htc_tcxo_off_cnt_pwrc_suspend;
+	uint32_t      	htc_global_garbage_cnt;
+	uint32_t      	htc_mssahb_reset_status;
+	uint32_t      	htc_watchdog_status;
+	uint32_t		htc_cdlog_start_addr_for_apps;
+	uint32_t		htc_cdlog_max_size_for_apps;
+
+	uint32_t		    htc_ciq_flag;
+} htc_smem_type;
+
+#if 1
+#define HTC_SMEM_PARAM_BASE_ADDR  	0x801F0000
+#else
+#define HTC_SMEM_PARAM_BASE_ADDR	0x400F0000
+#endif
+htc_smem_type *htc_smem_ram_addr;
+#else
+#define HTC_SMEM_PARAM_BASE_ADDR	0x004FC000
+#define HTC_SMEM_PARAM_SIZE		0x30C
+static uint32_t radio_feedback_addr;
+#endif
+
+struct msm_radio_feedback_config {
+	uint32_t start_addr;
+	uint32_t max_size;
+};
+struct mutex radio_feedback_lock;
+struct msm_radio_feedback_config config;
+
+int radio_set_cable_status(int charger_type)
+{
+#ifdef CONFIG_RADIO_FEEDBACK8660
+	if (htc_smem_ram_addr == NULL)
+		htc_smem_ram_addr = (htc_smem_type *)ioremap(HTC_SMEM_PARAM_BASE_ADDR, sizeof(htc_smem_type));
+
+	htc_smem_ram_addr->htc_cable_status = charger_type;
+	printk(KERN_INFO "[BATT] htc_cable_status:%d\n", htc_smem_ram_addr->htc_cable_status);
+#endif
+	return 0;
+}
+
+static long radio_feedback_ioctl(struct file *file, unsigned int cmd,
+				unsigned long arg)
+{
+	int rc = 0;
+	switch (cmd) {
+	case RADIO_FEEDBACK_GET_CDLOG_INFO:
+#ifdef CONFIG_RADIO_FEEDBACK8660
+		if (htc_smem_ram_addr == NULL)
+			htc_smem_ram_addr = (htc_smem_type *)ioremap(HTC_SMEM_PARAM_BASE_ADDR, sizeof(htc_smem_type));
+		config.start_addr = htc_smem_ram_addr->htc_cdlog_start_addr_for_apps;
+		config.max_size = htc_smem_ram_addr->htc_cdlog_max_size_for_apps;
+#else
+		radio_feedback_addr = (uint32_t)ioremap(HTC_SMEM_PARAM_BASE_ADDR, HTC_SMEM_PARAM_SIZE);
+		
+		memcpy(&config.start_addr, (void *)(radio_feedback_addr + 0x304), 4);
+		
+		memcpy(&config.max_size, (void *)(radio_feedback_addr + 0x308), 4);
+#endif
+		printk("start addr: 0x%x, max_size: 0x%x\n", config.start_addr, config.max_size);
+		if(copy_to_user((void *)arg, &config, sizeof(config)))
+			rc = -EFAULT;
+		break;
+	default:
+		rc = -EINVAL;
+	}
+	return rc;
+}
+
+static int radio_feedback_mmap(struct file *file, struct vm_area_struct *vma)
+{
+	unsigned long pgoff;
+	size_t size = vma->vm_end - vma->vm_start;
+	if (vma->vm_pgoff != 0)
+		return -EINVAL;
+
+	if (size <= config.max_size)
+		pgoff = config.start_addr >> PAGE_SHIFT;
+	else
+		return -EINVAL;
+
+	vma->vm_flags |= VM_IO | VM_RESERVED;
+	if (io_remap_pfn_range(vma, vma->vm_start, pgoff,
+			       size, vma->vm_page_prot))
+		return -EAGAIN;
+
+	return 0;
+}
+
+static struct file_operations radio_feedback_fops = {
+	.owner = THIS_MODULE,
+	.mmap = radio_feedback_mmap,
+	.unlocked_ioctl = radio_feedback_ioctl,
+};
+
+static struct miscdevice radio_feedback_misc = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "radio_feedback",
+	.fops = &radio_feedback_fops,
+};
+
+static int __init radio_feedback_init(void)
+{
+	int ret;
+	ret = misc_register(&radio_feedback_misc);
+	if (ret < 0) {
+		pr_err("failed to register misc device!\n");
+		return ret;
+	}
+	mutex_init(&radio_feedback_lock);
+	return ret;
+}
+
+static void __exit radio_feedback_exit(void)
+{
+	int ret;
+	ret = misc_deregister(&radio_feedback_misc);
+	if (ret < 0)
+		pr_err("failed to unregister misc device!\n");
+}
+
+module_init(radio_feedback_init);
+module_exit(radio_feedback_exit);
diff --git a/arch/arm/mach-msm/htc/ville/Kconfig b/arch/arm/mach-msm/htc/ville/Kconfig
new file mode 100644
index 0000000..e622198
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/Kconfig
@@ -0,0 +1,10 @@
+config BOARD_HEADER_FILE
+	string "HTC board specific header file name"
+	default ""
+
+config MACH_VILLE
+	depends on ARCH_MSM8960
+	select MACH_HTC
+	bool "HTC Ville"
+	help
+	  Support for the HTC VILLE device.
diff --git a/arch/arm/mach-msm/htc/ville/Makefile b/arch/arm/mach-msm/htc/ville/Makefile
new file mode 100644
index 0000000..25137c4
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/Makefile
@@ -0,0 +1,10 @@
+obj-$(CONFIG_MACH_VILLE) += board-ville.o
+obj-$(CONFIG_MACH_VILLE) += board-ville-regulator.o
+obj-$(CONFIG_MACH_VILLE) += board-ville-gpiomux.o
+obj-$(CONFIG_MACH_VILLE) += board-ville-storage.o
+obj-$(CONFIG_MACH_VILLE) += board-ville-audio.o
+obj-$(CONFIG_MACH_VILLE) += board-ville-pmic.o
+obj-$(CONFIG_MACH_VILLE) += board-ville-keypad.o
+obj-$(CONFIG_MACH_VILLE) += board-ville-camera.o
+obj-$(CONFIG_MACH_VILLE) += display/
+CFLAGS_board-ville-display.o += -Idrivers/video
diff --git a/arch/arm/mach-msm/htc/ville/board-ville-audio.c b/arch/arm/mach-msm/htc/ville/board-ville-audio.c
new file mode 100644
index 0000000..c78fc2b
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/board-ville-audio.c
@@ -0,0 +1,1661 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/platform_device.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/slab.h>
+#include <sound/core.h>
+#include <sound/soc.h>
+#include <sound/tlv.h>
+#include <sound/soc-dapm.h>
+#include <sound/pcm.h>
+#include <sound/jack.h>
+#include <asm/mach-types.h>
+#include <mach/socinfo.h>
+#include <asm/system_info.h>
+#include <linux/mfd/wcd9xxx/core.h>
+#include "../sound/soc/msm/msm-pcm-routing.h"
+#include "../../../sound/soc/codecs/wcd9310.h"
+#include <linux/mfd/wcd9xxx/wcd9310_registers.h>
+
+/* 8960 machine driver */
+
+#define PM8921_GPIO_BASE		NR_GPIO_IRQS
+#define PM8921_IRQ_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
+#define PM8921_GPIO_PM_TO_SYS(pm_gpio)  (pm_gpio - 1 + PM8921_GPIO_BASE)
+
+#define MSM_SPK_ON 1
+#define MSM_SPK_OFF 0
+
+#define MSM_SLIM_0_RX_MAX_CHANNELS		2
+#define MSM_SLIM_0_TX_MAX_CHANNELS		4
+
+#define SAMPLE_RATE_8KHZ 8000
+#define SAMPLE_RATE_16KHZ 16000
+
+#define BOTTOM_SPK_AMP_POS	0x1
+#define BOTTOM_SPK_AMP_NEG	0x2
+#define TOP_SPK_AMP_POS		0x4
+#define TOP_SPK_AMP_NEG		0x8
+#define TOP_SPK_AMP		0x10
+
+#define GPIO_AUX_PCM_DOUT 63
+#define GPIO_AUX_PCM_DIN 64
+#define GPIO_AUX_PCM_SYNC 65
+#define GPIO_AUX_PCM_CLK 66
+
+#define TABLA_EXT_CLK_RATE 12288000
+
+#define TABLA_MBHC_DEF_BUTTONS 8
+#define TABLA_MBHC_DEF_RLOADS 5
+
+#define JACK_DETECT_GPIO 38
+#define JACK_DETECT_INT PM8921_GPIO_IRQ(PM8921_IRQ_BASE, JACK_DETECT_GPIO)
+#define JACK_US_EURO_SEL_GPIO 35
+
+static u32 top_spk_pamp_gpio  = PM8921_GPIO_PM_TO_SYS(19);
+static u32 bottom_spk_pamp_gpio = PM8921_GPIO_PM_TO_SYS(18);
+static int msm_spk_control;
+static int msm_ext_bottom_spk_pamp;
+static int msm_ext_top_spk_pamp;
+static int msm_slim_0_rx_ch = 1;
+static int msm_slim_0_tx_ch = 1;
+
+static int msm_btsco_rate = SAMPLE_RATE_8KHZ;
+static int msm_btsco_ch = 1;
+static int msm_auxpcm_rate = SAMPLE_RATE_8KHZ;
+
+static struct clk *codec_clk;
+static int clk_users;
+
+static int msm_headset_gpios_configured;
+
+static struct snd_soc_jack hs_jack;
+static struct snd_soc_jack button_jack;
+static atomic_t auxpcm_rsc_ref;
+
+static bool hs_detect_use_gpio;
+module_param(hs_detect_use_gpio, bool, 0444);
+MODULE_PARM_DESC(hs_detect_use_gpio, "Use GPIO for headset detection");
+
+static bool hs_detect_extn_cable;
+module_param(hs_detect_extn_cable, bool, 0444);
+MODULE_PARM_DESC(hs_detect_extn_cable, "Enable extension cable feature");
+
+
+static bool hs_detect_use_firmware;
+module_param(hs_detect_use_firmware, bool, 0444);
+MODULE_PARM_DESC(hs_detect_use_firmware, "Use firmware for headset detection");
+
+static int msm_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
+					bool dapm);
+
+static struct tabla_mbhc_config mbhc_cfg = {
+	.headset_jack = &hs_jack,
+	.button_jack = &button_jack,
+	.read_fw_bin = false,
+	.calibration = NULL,
+	.micbias = TABLA_MICBIAS2,
+	.mclk_cb_fn = msm_enable_codec_ext_clk,
+	.mclk_rate = TABLA_EXT_CLK_RATE,
+	.gpio = 0,
+	.gpio_irq = 0,
+	.gpio_level_insert = 1,
+	.swap_gnd_mic = NULL,
+	.detect_extn_cable = false,
+};
+
+static u32 us_euro_sel_gpio = PM8921_GPIO_PM_TO_SYS(JACK_US_EURO_SEL_GPIO);
+
+static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1);
+
+static struct mutex cdc_mclk_mutex;
+
+static void msm_enable_ext_spk_amp_gpio(u32 spk_amp_gpio)
+{
+	int ret = 0;
+
+	struct pm_gpio param = {
+		.direction      = PM_GPIO_DIR_OUT,
+		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
+		.output_value   = 1,
+		.pull      = PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength   = PM_GPIO_STRENGTH_MED,
+		.function       = PM_GPIO_FUNC_NORMAL,
+	};
+
+	if (spk_amp_gpio == bottom_spk_pamp_gpio) {
+
+		ret = gpio_request(bottom_spk_pamp_gpio, "BOTTOM_SPK_AMP");
+		if (ret) {
+			pr_err("%s: Error requesting BOTTOM SPK AMP GPIO %u\n",
+				__func__, bottom_spk_pamp_gpio);
+			return;
+		}
+		ret = pm8xxx_gpio_config(bottom_spk_pamp_gpio, &param);
+		if (ret)
+			pr_err("%s: Failed to configure Bottom Spk Ampl"
+				" gpio %u\n", __func__, bottom_spk_pamp_gpio);
+		else {
+			pr_debug("%s: enable Bottom spkr amp gpio\n", __func__);
+			gpio_direction_output(bottom_spk_pamp_gpio, 1);
+		}
+	} else if (spk_amp_gpio == top_spk_pamp_gpio) {
+
+		ret = gpio_request(top_spk_pamp_gpio, "TOP_SPK_AMP");
+		if (ret) {
+			pr_err("%s: Error requesting GPIO %d\n", __func__,
+				top_spk_pamp_gpio);
+			return;
+		}
+		ret = pm8xxx_gpio_config(top_spk_pamp_gpio, &param);
+		if (ret)
+			pr_err("%s: Failed to configure Top Spk Ampl"
+				" gpio %u\n", __func__, top_spk_pamp_gpio);
+		else {
+			pr_debug("%s: enable Top spkr amp gpio\n", __func__);
+			gpio_direction_output(top_spk_pamp_gpio, 1);
+		}
+	} else {
+		pr_err("%s: ERROR : Invalid External Speaker Ampl GPIO."
+			" gpio = %u\n", __func__, spk_amp_gpio);
+		return;
+	}
+}
+
+static void msm_ext_spk_power_amp_on(u32 spk)
+{
+	if (spk & (BOTTOM_SPK_AMP_POS | BOTTOM_SPK_AMP_NEG)) {
+
+		if ((msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_POS) &&
+			(msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_NEG)) {
+
+			pr_debug("%s() External Bottom Speaker Ampl already "
+				"turned on. spk = 0x%08x\n", __func__, spk);
+			return;
+		}
+
+		msm_ext_bottom_spk_pamp |= spk;
+
+		if ((msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_POS) &&
+			(msm_ext_bottom_spk_pamp & BOTTOM_SPK_AMP_NEG)) {
+
+			msm_enable_ext_spk_amp_gpio(bottom_spk_pamp_gpio);
+			pr_debug("%s: slepping 4 ms after turning on external "
+				" Bottom Speaker Ampl\n", __func__);
+			usleep_range(4000, 4000);
+		}
+
+	} else if  (spk & (TOP_SPK_AMP_POS | TOP_SPK_AMP_NEG | TOP_SPK_AMP)) {
+
+		pr_debug("%s: top_spk_amp_state = 0x%x spk_event = 0x%x\n",
+			__func__, msm_ext_top_spk_pamp, spk);
+
+		if (((msm_ext_top_spk_pamp & TOP_SPK_AMP_POS) &&
+			(msm_ext_top_spk_pamp & TOP_SPK_AMP_NEG)) ||
+				(msm_ext_top_spk_pamp & TOP_SPK_AMP)) {
+
+			pr_debug("%s() External Top Speaker Ampl already"
+				"turned on. spk = 0x%08x\n", __func__, spk);
+			return;
+		}
+
+		msm_ext_top_spk_pamp |= spk;
+
+		if (((msm_ext_top_spk_pamp & TOP_SPK_AMP_POS) &&
+			(msm_ext_top_spk_pamp & TOP_SPK_AMP_NEG)) ||
+				(msm_ext_top_spk_pamp & TOP_SPK_AMP)) {
+
+			msm_enable_ext_spk_amp_gpio(top_spk_pamp_gpio);
+			pr_debug("%s: sleeping 4 ms after turning on "
+				" external Top Speaker Ampl\n", __func__);
+			usleep_range(4000, 4000);
+		}
+	} else  {
+
+		pr_err("%s: ERROR : Invalid External Speaker Ampl. spk = 0x%08x\n",
+			__func__, spk);
+		return;
+	}
+}
+
+static void msm_ext_spk_power_amp_off(u32 spk)
+{
+	if (spk & (BOTTOM_SPK_AMP_POS | BOTTOM_SPK_AMP_NEG)) {
+
+		if (!msm_ext_bottom_spk_pamp)
+			return;
+
+		gpio_direction_output(bottom_spk_pamp_gpio, 0);
+		gpio_free(bottom_spk_pamp_gpio);
+		msm_ext_bottom_spk_pamp = 0;
+
+		pr_debug("%s: sleeping 4 ms after turning off external Bottom"
+			" Speaker Ampl\n", __func__);
+
+		usleep_range(4000, 4000);
+
+	} else if (spk & (TOP_SPK_AMP_POS | TOP_SPK_AMP_NEG | TOP_SPK_AMP)) {
+
+		pr_debug("%s: top_spk_amp_state = 0x%x spk_event = 0x%x\n",
+				__func__, msm_ext_top_spk_pamp, spk);
+
+		if (!msm_ext_top_spk_pamp)
+			return;
+
+		if ((spk & TOP_SPK_AMP_POS) || (spk & TOP_SPK_AMP_NEG)) {
+
+			msm_ext_top_spk_pamp &= (~(TOP_SPK_AMP_POS |
+							TOP_SPK_AMP_NEG));
+		} else if (spk & TOP_SPK_AMP) {
+			msm_ext_top_spk_pamp &=  ~TOP_SPK_AMP;
+		}
+
+		if (msm_ext_top_spk_pamp)
+			return;
+
+		gpio_direction_output(top_spk_pamp_gpio, 0);
+		gpio_free(top_spk_pamp_gpio);
+		msm_ext_top_spk_pamp = 0;
+
+		pr_debug("%s: sleeping 4 ms after ext Top Spek Ampl is off\n",
+				__func__);
+
+		usleep_range(4000, 4000);
+	} else  {
+
+		pr_err("%s: ERROR : Invalid Ext Spk Ampl. spk = 0x%08x\n",
+			__func__, spk);
+		return;
+	}
+}
+
+static void msm_ext_control(struct snd_soc_codec *codec)
+{
+	struct snd_soc_dapm_context *dapm = &codec->dapm;
+
+	mutex_lock(&dapm->codec->mutex);
+
+	pr_debug("%s: msm_spk_control = %d", __func__, msm_spk_control);
+	if (msm_spk_control == MSM_SPK_ON) {
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Pos");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Neg");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Pos");
+		snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Neg");
+	} else {
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Bottom Pos");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Bottom Neg");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Top Pos");
+		snd_soc_dapm_disable_pin(dapm, "Ext Spk Top Neg");
+	}
+
+	snd_soc_dapm_sync(dapm);
+	mutex_unlock(&dapm->codec->mutex);
+}
+
+static int msm_get_spk(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_spk_control = %d", __func__, msm_spk_control);
+	ucontrol->value.integer.value[0] = msm_spk_control;
+	return 0;
+}
+static int msm_set_spk(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+
+	pr_debug("%s()\n", __func__);
+	if (msm_spk_control == ucontrol->value.integer.value[0])
+		return 0;
+
+	msm_spk_control = ucontrol->value.integer.value[0];
+	msm_ext_control(codec);
+	return 1;
+}
+static int msm_spkramp_event(struct snd_soc_dapm_widget *w,
+	struct snd_kcontrol *k, int event)
+{
+	pr_debug("%s() %x\n", __func__, SND_SOC_DAPM_EVENT_ON(event));
+
+	if (SND_SOC_DAPM_EVENT_ON(event)) {
+		if (!strncmp(w->name, "Ext Spk Bottom Pos", 18))
+			msm_ext_spk_power_amp_on(BOTTOM_SPK_AMP_POS);
+		else if (!strncmp(w->name, "Ext Spk Bottom Neg", 18))
+			msm_ext_spk_power_amp_on(BOTTOM_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Ext Spk Top Pos", 15))
+			msm_ext_spk_power_amp_on(TOP_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Ext Spk Top Neg", 15))
+			msm_ext_spk_power_amp_on(TOP_SPK_AMP_NEG);
+		else if  (!strncmp(w->name, "Ext Spk Top", 12))
+			msm_ext_spk_power_amp_on(TOP_SPK_AMP);
+		else {
+			pr_err("%s() Invalid Speaker Widget = %s\n",
+					__func__, w->name);
+			return -EINVAL;
+		}
+
+	} else {
+		if (!strncmp(w->name, "Ext Spk Bottom Pos", 18))
+			msm_ext_spk_power_amp_off(BOTTOM_SPK_AMP_POS);
+		else if (!strncmp(w->name, "Ext Spk Bottom Neg", 18))
+			msm_ext_spk_power_amp_off(BOTTOM_SPK_AMP_NEG);
+		else if (!strncmp(w->name, "Ext Spk Top Pos", 15))
+			msm_ext_spk_power_amp_off(TOP_SPK_AMP_POS);
+		else if  (!strncmp(w->name, "Ext Spk Top Neg", 15))
+			msm_ext_spk_power_amp_off(TOP_SPK_AMP_NEG);
+		else if  (!strncmp(w->name, "Ext Spk Top", 12))
+			msm_ext_spk_power_amp_off(TOP_SPK_AMP);
+		else {
+			pr_err("%s() Invalid Speaker Widget = %s\n",
+					__func__, w->name);
+			return -EINVAL;
+		}
+	}
+	return 0;
+}
+
+static int msm_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
+					bool dapm)
+{
+	int r = 0;
+	pr_debug("%s: enable = %d\n", __func__, enable);
+
+	mutex_lock(&cdc_mclk_mutex);
+	if (enable) {
+		clk_users++;
+		pr_debug("%s: clk_users = %d\n", __func__, clk_users);
+		if (clk_users == 1) {
+			if (codec_clk) {
+				clk_set_rate(codec_clk, TABLA_EXT_CLK_RATE);
+				clk_prepare_enable(codec_clk);
+				tabla_mclk_enable(codec, 1, dapm);
+			} else {
+				pr_err("%s: Error setting Tabla MCLK\n",
+				       __func__);
+				clk_users--;
+				r = -EINVAL;
+			}
+		}
+	} else {
+		if (clk_users > 0) {
+			clk_users--;
+			pr_debug("%s: clk_users = %d\n", __func__, clk_users);
+			if (clk_users == 0) {
+				pr_debug("%s: disabling MCLK. clk_users = %d\n",
+					 __func__, clk_users);
+				tabla_mclk_enable(codec, 0, dapm);
+				clk_disable_unprepare(codec_clk);
+			}
+		} else {
+			pr_err("%s: Error releasing Tabla MCLK\n", __func__);
+			r = -EINVAL;
+		}
+	}
+	mutex_unlock(&cdc_mclk_mutex);
+	return r;
+}
+
+static int msm_mclk_event(struct snd_soc_dapm_widget *w,
+		struct snd_kcontrol *kcontrol, int event)
+{
+	pr_debug("%s: event = %d\n", __func__, event);
+
+	switch (event) {
+	case SND_SOC_DAPM_PRE_PMU:
+		return msm_enable_codec_ext_clk(w->codec, 1, true);
+	case SND_SOC_DAPM_POST_PMD:
+		return msm_enable_codec_ext_clk(w->codec, 0, true);
+	}
+	return 0;
+}
+
+static const struct snd_kcontrol_new earamp_switch_controls =
+	SOC_DAPM_SINGLE("Switch", 0, 0, 1, 0);
+
+static const struct snd_kcontrol_new spkamp_switch_controls =
+	SOC_DAPM_SINGLE("Switch", 0, 0, 1, 0);
+
+static const struct snd_soc_dapm_widget ville_dapm_widgets[] = {
+	SND_SOC_DAPM_MIXER("Lineout Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
+	SND_SOC_DAPM_MIXER("SPK AMP EN", SND_SOC_NOPM, 0, 0, &spkamp_switch_controls, 1),
+	SND_SOC_DAPM_MIXER("EAR AMP EN", SND_SOC_NOPM, 0, 0, &earamp_switch_controls, 1),
+};
+
+static const struct snd_soc_dapm_widget msm_dapm_widgets[] = {
+	SND_SOC_DAPM_SUPPLY("MCLK",  SND_SOC_NOPM, 0, 0,
+	msm_mclk_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
+
+	SND_SOC_DAPM_SPK("Ext Spk Bottom Pos", msm_spkramp_event),
+	SND_SOC_DAPM_SPK("Ext Spk Bottom Neg", msm_spkramp_event),
+
+	SND_SOC_DAPM_SPK("Ext Spk Top Pos", msm_spkramp_event),
+	SND_SOC_DAPM_SPK("Ext Spk Top Neg", msm_spkramp_event),
+
+	SND_SOC_DAPM_MIC("Handset Mic", NULL),
+	SND_SOC_DAPM_MIC("Headset Mic", NULL),
+	SND_SOC_DAPM_MIC("Back Mic", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic1", NULL),
+	SND_SOC_DAPM_MIC("ANCRight Headset Mic", NULL),
+	SND_SOC_DAPM_MIC("ANCLeft Headset Mic", NULL),
+
+	SND_SOC_DAPM_MIC("Digital Mic1", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic2", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic3", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic4", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic5", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic6", NULL),
+
+};
+
+static const struct snd_soc_dapm_route tabla_1_x_audio_map[] = {
+
+	{"Lineout Mixer", NULL, "LINEOUT2"},
+	{"Lineout Mixer", NULL, "LINEOUT1"},
+};
+
+static const struct snd_soc_dapm_route tabla_2_x_audio_map[] = {
+
+	{"Lineout Mixer", NULL, "LINEOUT3"},
+	{"Lineout Mixer", NULL, "LINEOUT1"},
+};
+
+static const struct snd_soc_dapm_route common_audio_map[] = {
+
+	{"RX_BIAS", NULL, "MCLK"},
+	{"LDO_H", NULL, "MCLK"},
+
+	/* Speaker path */
+	{"Ext Spk Bottom Pos", NULL, "SPK AMP EN"},
+	{"Ext Spk Bottom Neg", NULL, "SPK AMP EN"},
+	{"SPK AMP EN", "Switch", "Lineout Mixer"},
+
+	/* Earpiece path */
+	{"Ext Spk Top Pos", NULL, "EAR AMP EN"},
+	{"Ext Spk Top Neg", NULL, "EAR AMP EN"},
+	{"EAR AMP EN", "Switch", "Lineout Mixer"},
+
+	/* Microphone path */
+	{"AMIC1", NULL, "MIC BIAS1 External"},
+	{"MIC BIAS1 External", NULL, "Handset Mic"},
+
+	{"AMIC2", NULL, "MIC BIAS2 External"},
+	{"MIC BIAS2 External", NULL, "Headset Mic"},
+
+	{"AMIC3", NULL, "MIC BIAS3 External"},
+	{"MIC BIAS3 External", NULL, "Back Mic"},
+
+	{"HEADPHONE", NULL, "LDO_H"},
+
+	/**
+	 * The digital Mic routes are setup considering
+	 * fluid as default device.
+	 */
+
+	/**
+	 * Digital Mic1. Front Bottom left Digital Mic on Fluid and MTP.
+	 * Digital Mic GM5 on CDP mainboard.
+	 * Conncted to DMIC2 Input on Tabla codec.
+	 */
+	{"DMIC2", NULL, "MIC BIAS1 External"},
+	{"MIC BIAS1 External", NULL, "Digital Mic1"},
+
+	/**
+	 * Digital Mic2. Front Bottom right Digital Mic on Fluid and MTP.
+	 * Digital Mic GM6 on CDP mainboard.
+	 * Conncted to DMIC1 Input on Tabla codec.
+	 */
+	{"DMIC1", NULL, "MIC BIAS1 External"},
+	{"MIC BIAS1 External", NULL, "Digital Mic2"},
+
+	/**
+	 * Digital Mic3. Back Bottom Digital Mic on Fluid.
+	 * Digital Mic GM1 on CDP mainboard.
+	 * Conncted to DMIC4 Input on Tabla codec.
+	 */
+	{"DMIC4", NULL, "MIC BIAS3 External"},
+	{"MIC BIAS3 External", NULL, "Digital Mic3"},
+
+	/**
+	 * Digital Mic4. Back top Digital Mic on Fluid.
+	 * Digital Mic GM2 on CDP mainboard.
+	 * Conncted to DMIC3 Input on Tabla codec.
+	 */
+	{"DMIC3", NULL, "MIC BIAS3 External"},
+	{"MIC BIAS3 External", NULL, "Digital Mic4"},
+
+	/**
+	 * Digital Mic5. Front top Digital Mic on Fluid.
+	 * Digital Mic GM3 on CDP mainboard.
+	 * Conncted to DMIC5 Input on Tabla codec.
+	 */
+	{"DMIC5", NULL, "MIC BIAS4 External"},
+	{"MIC BIAS4 External", NULL, "Digital Mic5"},
+
+};
+
+static const char *spk_function[] = {"Off", "On"};
+static const char *slim0_rx_ch_text[] = {"One", "Two"};
+static const char *slim0_tx_ch_text[] = {"One", "Two", "Three", "Four"};
+
+static const struct soc_enum msm_enum[] = {
+	SOC_ENUM_SINGLE_EXT(2, spk_function),
+	SOC_ENUM_SINGLE_EXT(2, slim0_rx_ch_text),
+	SOC_ENUM_SINGLE_EXT(4, slim0_tx_ch_text),
+};
+
+static const char *btsco_rate_text[] = {"8000", "16000"};
+static const struct soc_enum msm_btsco_enum[] = {
+		SOC_ENUM_SINGLE_EXT(2, btsco_rate_text),
+};
+
+static int msm_slim_0_rx_ch_get(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_slim_0_rx_ch  = %d\n", __func__,
+		 msm_slim_0_rx_ch);
+	ucontrol->value.integer.value[0] = msm_slim_0_rx_ch - 1;
+	return 0;
+}
+
+static int msm_slim_0_rx_ch_put(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	msm_slim_0_rx_ch = ucontrol->value.integer.value[0] + 1;
+
+	pr_debug("%s: msm_slim_0_rx_ch = %d\n", __func__,
+		 msm_slim_0_rx_ch);
+	return 1;
+}
+
+static int msm_slim_0_tx_ch_get(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_slim_0_tx_ch  = %d\n", __func__,
+		 msm_slim_0_tx_ch);
+	ucontrol->value.integer.value[0] = msm_slim_0_tx_ch - 1;
+	return 0;
+}
+
+static int msm_slim_0_tx_ch_put(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	msm_slim_0_tx_ch = ucontrol->value.integer.value[0] + 1;
+
+	pr_debug("%s: msm_slim_0_tx_ch = %d\n", __func__,
+		 msm_slim_0_tx_ch);
+	return 1;
+}
+
+static int msm_btsco_rate_get(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	pr_debug("%s: msm_btsco_rate  = %d", __func__, msm_btsco_rate);
+	ucontrol->value.integer.value[0] = msm_btsco_rate;
+	return 0;
+}
+
+static int msm_btsco_rate_put(struct snd_kcontrol *kcontrol,
+				struct snd_ctl_elem_value *ucontrol)
+{
+	switch (ucontrol->value.integer.value[0]) {
+	case 8000:
+		msm_btsco_rate = SAMPLE_RATE_8KHZ;
+		break;
+	case 16000:
+		msm_btsco_rate = SAMPLE_RATE_16KHZ;
+		break;
+	default:
+		msm_btsco_rate = SAMPLE_RATE_8KHZ;
+		break;
+	}
+	pr_debug("%s: msm_btsco_rate = %d\n", __func__, msm_btsco_rate);
+	return 0;
+}
+
+static const struct snd_kcontrol_new tabla_msm_controls[] = {
+	SOC_ENUM_EXT("Speaker Function", msm_enum[0], msm_get_spk,
+		msm_set_spk),
+	SOC_ENUM_EXT("SLIM_0_RX Channels", msm_enum[1],
+		msm_slim_0_rx_ch_get, msm_slim_0_rx_ch_put),
+	SOC_ENUM_EXT("SLIM_0_TX Channels", msm_enum[2],
+		msm_slim_0_tx_ch_get, msm_slim_0_tx_ch_put),
+};
+
+static void *def_tabla_mbhc_cal(void)
+{
+	void *tabla_cal;
+	struct tabla_mbhc_btn_detect_cfg *btn_cfg;
+	u16 *btn_low, *btn_high;
+	u8 *n_ready, *n_cic, *gain;
+
+	tabla_cal = kzalloc(TABLA_MBHC_CAL_SIZE(TABLA_MBHC_DEF_BUTTONS,
+						TABLA_MBHC_DEF_RLOADS),
+			    GFP_KERNEL);
+	if (!tabla_cal) {
+		pr_err("%s: out of memory\n", __func__);
+		return NULL;
+	}
+
+#define S(X, Y) ((TABLA_MBHC_CAL_GENERAL_PTR(tabla_cal)->X) = (Y))
+	S(t_ldoh, 100);
+	S(t_bg_fast_settle, 100);
+	S(t_shutdown_plug_rem, 255);
+	S(mbhc_nsa, 4);
+	S(mbhc_navg, 4);
+#undef S
+#define S(X, Y) ((TABLA_MBHC_CAL_PLUG_DET_PTR(tabla_cal)->X) = (Y))
+	S(mic_current, TABLA_PID_MIC_5_UA);
+	S(hph_current, TABLA_PID_MIC_5_UA);
+	S(t_mic_pid, 100);
+	S(t_ins_complete, 250);
+	S(t_ins_retry, 200);
+#undef S
+#define S(X, Y) ((TABLA_MBHC_CAL_PLUG_TYPE_PTR(tabla_cal)->X) = (Y))
+	S(v_no_mic, 30);
+	S(v_hs_max, 2400);
+#undef S
+#define S(X, Y) ((TABLA_MBHC_CAL_BTN_DET_PTR(tabla_cal)->X) = (Y))
+	S(c[0], 62);
+	S(c[1], 124);
+	S(nc, 1);
+	S(n_meas, 3);
+	S(mbhc_nsc, 11);
+	S(n_btn_meas, 1);
+	S(n_btn_con, 2);
+	S(num_btn, TABLA_MBHC_DEF_BUTTONS);
+	S(v_btn_press_delta_sta, 100);
+	S(v_btn_press_delta_cic, 50);
+#undef S
+	btn_cfg = TABLA_MBHC_CAL_BTN_DET_PTR(tabla_cal);
+	btn_low = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_V_BTN_LOW);
+	btn_high = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_V_BTN_HIGH);
+	btn_low[0] = -50;
+	btn_high[0] = 10;
+	btn_low[1] = 11;
+	btn_high[1] = 52;
+	btn_low[2] = 53;
+	btn_high[2] = 94;
+	btn_low[3] = 95;
+	btn_high[3] = 133;
+	btn_low[4] = 134;
+	btn_high[4] = 171;
+	btn_low[5] = 172;
+	btn_high[5] = 208;
+	btn_low[6] = 209;
+	btn_high[6] = 244;
+	btn_low[7] = 245;
+	btn_high[7] = 330;
+	n_ready = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_N_READY);
+	n_ready[0] = 80;
+	n_ready[1] = 68;
+	n_cic = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_N_CIC);
+	n_cic[0] = 60;
+	n_cic[1] = 47;
+	gain = tabla_mbhc_cal_btn_det_mp(btn_cfg, TABLA_BTN_DET_GAIN);
+	gain[0] = 11;
+	gain[1] = 9;
+
+	return tabla_cal;
+}
+
+static int msm_hw_params(struct snd_pcm_substream *substream,
+				struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	int ret = 0;
+	unsigned int rx_ch[SLIM_MAX_RX_PORTS], tx_ch[SLIM_MAX_TX_PORTS];
+	unsigned int rx_ch_cnt = 0, tx_ch_cnt = 0;
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+
+		pr_debug("%s: rx_0_ch=%d\n", __func__, msm_slim_0_rx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+
+		ret = snd_soc_dai_set_channel_map(cpu_dai, 0, 0,
+				msm_slim_0_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai, 0, 0,
+				msm_slim_0_rx_ch, rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	} else {
+
+		pr_debug("%s: %s  tx_dai_id = %d  num_ch = %d\n", __func__,
+			codec_dai->name, codec_dai->id, msm_slim_0_tx_ch);
+
+		ret = snd_soc_dai_get_channel_map(codec_dai,
+				&tx_ch_cnt, tx_ch, &rx_ch_cnt , rx_ch);
+		if (ret < 0) {
+			pr_err("%s: failed to get codec chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(cpu_dai,
+				msm_slim_0_tx_ch, tx_ch, 0 , 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set cpu chan map\n", __func__);
+			goto end;
+		}
+		ret = snd_soc_dai_set_channel_map(codec_dai,
+				msm_slim_0_tx_ch, tx_ch, 0, 0);
+		if (ret < 0) {
+			pr_err("%s: failed to set codec channel map\n",
+								__func__);
+			goto end;
+		}
+	}
+end:
+	return ret;
+}
+
+static const struct snd_kcontrol_new tabla_xbvol_controls[] = {
+         SOC_SINGLE_TLV("LINEOUT1XB Volume", TABLA_A_RX_LINE_1_GAIN, 0, 12, 1,
+                 line_gain),
+         SOC_SINGLE_TLV("LINEOUT3XB Volume", TABLA_A_RX_LINE_3_GAIN, 0, 12, 1,
+                 line_gain),
+};
+static const struct snd_kcontrol_new int_btsco_rate_mixer_controls[] = {
+	SOC_ENUM_EXT("Internal BTSCO SampleRate", msm_btsco_enum[0],
+		msm_btsco_rate_get, msm_btsco_rate_put),
+};
+
+static int msm_btsco_init(struct snd_soc_pcm_runtime *rtd)
+{
+	int err = 0;
+	struct snd_soc_platform *platform = rtd->platform;
+
+	err = snd_soc_add_platform_controls(platform,
+			int_btsco_rate_mixer_controls,
+		ARRAY_SIZE(int_btsco_rate_mixer_controls));
+	if (err < 0)
+		return err;
+	return 0;
+}
+
+static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
+{
+	int err;
+	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_dapm_context *dapm = &codec->dapm;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	u8 tabla_version;
+
+	pr_debug("%s(), dev_name%s\n", __func__, dev_name(cpu_dai->dev));
+
+	rtd->pmdown_time = 0;
+	if (system_rev == 1) 
+          {
+            //XB lower the receiver gain
+            err = snd_soc_add_codec_controls(codec, tabla_xbvol_controls,
+                                             ARRAY_SIZE(tabla_xbvol_controls));
+            if (err < 0)
+              return err;
+          }
+
+	snd_soc_dapm_new_controls(dapm, msm_dapm_widgets,
+				ARRAY_SIZE(msm_dapm_widgets));
+
+	snd_soc_dapm_new_controls(dapm, ville_dapm_widgets,
+				ARRAY_SIZE(ville_dapm_widgets));
+
+	snd_soc_dapm_add_routes(dapm, common_audio_map,
+		ARRAY_SIZE(common_audio_map));
+
+	/* determine HW connection based on codec revision */
+	tabla_version = snd_soc_read(codec, TABLA_A_CHIP_VERSION);
+	tabla_version &=  0x1F;
+	pr_err("%s : Tabla version %u\n", __func__, (u32)tabla_version);
+
+	if ((tabla_version == TABLA_VERSION_1_0) ||
+		(tabla_version == TABLA_VERSION_1_1)) {
+		snd_soc_dapm_add_routes(dapm, tabla_1_x_audio_map,
+			 ARRAY_SIZE(tabla_1_x_audio_map));
+	} else {
+		snd_soc_dapm_add_routes(dapm, tabla_2_x_audio_map,
+			 ARRAY_SIZE(tabla_2_x_audio_map));
+	}
+
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Pos");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Bottom Neg");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Pos");
+	snd_soc_dapm_enable_pin(dapm, "Ext Spk Top Neg");
+
+	snd_soc_dapm_sync(dapm);
+
+	err = snd_soc_jack_new(codec, "Headset Jack",
+			       (SND_JACK_HEADSET | SND_JACK_OC_HPHL | SND_JACK_OC_HPHR),
+				&hs_jack);
+	if (err) {
+		pr_err("failed to create new jack\n");
+		return err;
+	}
+
+	err = snd_soc_jack_new(codec, "Button Jack",
+			       SND_JACK_BTN_0, &button_jack);
+	if (err) {
+		pr_err("failed to create new jack\n");
+		return err;
+	}
+
+	codec_clk = clk_get(cpu_dai->dev, "osr_clk");
+
+	/* Do not pass MBHC calibration data to disable HS detection.
+	 * Otherwise, sending project-based cal-data to enable
+	 * MBHC mechanism that tabla provides */
+	tabla_hs_detect(codec, &mbhc_cfg);
+
+	return 0;
+}
+
+static int msm_slim_0_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+			SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+	channels->min = channels->max = msm_slim_0_rx_ch;
+
+	return 0;
+}
+
+static int msm_slim_0_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+			SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+	channels->min = channels->max = msm_slim_0_tx_ch;
+
+	return 0;
+}
+
+static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+	SNDRV_PCM_HW_PARAM_RATE);
+
+	pr_debug("%s()\n", __func__);
+	rate->min = rate->max = 48000;
+
+	return 0;
+}
+
+static int msm_hdmi_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	pr_debug("%s channels->min %u channels->max %u ()\n", __func__,
+			channels->min, channels->max);
+
+        rate->min = rate->max = 48000;
+
+	return 0;
+}
+
+static int msm_btsco_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	rate->min = rate->max = msm_btsco_rate;
+	channels->min = channels->max = msm_btsco_ch;
+
+	return 0;
+}
+static int msm_auxpcm_be_params_fixup(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params)
+{
+	struct snd_interval *rate = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_RATE);
+
+	struct snd_interval *channels = hw_param_interval(params,
+					SNDRV_PCM_HW_PARAM_CHANNELS);
+
+	rate->min = rate->max = msm_auxpcm_rate;
+	/* PCM only supports mono output */
+	channels->min = channels->max = 1;
+
+	return 0;
+}
+static int msm_aux_pcm_get_gpios(void)
+{
+	int ret = 0;
+
+	pr_debug("%s\n", __func__);
+
+	ret = gpio_request(GPIO_AUX_PCM_DOUT, "AUX PCM DOUT");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM DOUT",
+				__func__, GPIO_AUX_PCM_DOUT);
+		goto fail_dout;
+	}
+
+	ret = gpio_request(GPIO_AUX_PCM_DIN, "AUX PCM DIN");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM DIN",
+				__func__, GPIO_AUX_PCM_DIN);
+		goto fail_din;
+	}
+
+	ret = gpio_request(GPIO_AUX_PCM_SYNC, "AUX PCM SYNC");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM SYNC",
+				__func__, GPIO_AUX_PCM_SYNC);
+		goto fail_sync;
+	}
+	ret = gpio_request(GPIO_AUX_PCM_CLK, "AUX PCM CLK");
+	if (ret < 0) {
+		pr_err("%s: Failed to request gpio(%d): AUX PCM CLK",
+				__func__, GPIO_AUX_PCM_CLK);
+		goto fail_clk;
+	}
+
+	return 0;
+
+fail_clk:
+	gpio_free(GPIO_AUX_PCM_SYNC);
+fail_sync:
+	gpio_free(GPIO_AUX_PCM_DIN);
+fail_din:
+	gpio_free(GPIO_AUX_PCM_DOUT);
+fail_dout:
+
+	return ret;
+}
+
+static int msm_aux_pcm_free_gpios(void)
+{
+	gpio_free(GPIO_AUX_PCM_DIN);
+	gpio_free(GPIO_AUX_PCM_DOUT);
+	gpio_free(GPIO_AUX_PCM_SYNC);
+	gpio_free(GPIO_AUX_PCM_CLK);
+
+	return 0;
+}
+static int msm_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
+	pr_debug("%s(): dai_link_str_name = %s cpu_dai = %s codec_dai = %s\n",
+		__func__, rtd->dai_link->stream_name,
+		rtd->dai_link->cpu_dai_name, rtd->dai_link->codec_dai_name);
+	return 0;
+}
+
+static int msm_auxpcm_startup(struct snd_pcm_substream *substream)
+{
+	int ret = 0;
+
+	pr_debug("%s(): substream = %s, auxpcm_rsc_ref counter = %d\n",
+		__func__, substream->name, atomic_read(&auxpcm_rsc_ref));
+	if (atomic_inc_return(&auxpcm_rsc_ref) == 1)
+		ret = msm_aux_pcm_get_gpios();
+
+	if (ret < 0) {
+		pr_err("%s: Aux PCM GPIO request failed\n", __func__);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static void msm_auxpcm_shutdown(struct snd_pcm_substream *substream)
+{
+	pr_debug("%s(): substream = %s, auxpcm_rsc_ref counter = %d\n",
+		__func__, substream->name, atomic_read(&auxpcm_rsc_ref));
+	if (atomic_dec_return(&auxpcm_rsc_ref) == 0)
+		msm_aux_pcm_free_gpios();
+}
+
+static void msm_shutdown(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
+	pr_debug("%s(): dai_link str_name = %s cpu_dai = %s codec_dai = %s\n",
+		__func__, rtd->dai_link->stream_name,
+		rtd->dai_link->cpu_dai_name, rtd->dai_link->codec_dai_name);
+}
+
+static struct snd_soc_ops msm_be_ops = {
+	.startup = msm_startup,
+	.hw_params = msm_hw_params,
+	.shutdown = msm_shutdown,
+};
+
+static struct snd_soc_ops msm_auxpcm_be_ops = {
+	.startup = msm_auxpcm_startup,
+	.shutdown = msm_auxpcm_shutdown,
+};
+
+/* Digital audio interface glue - connects codec <---> CPU */
+static struct snd_soc_dai_link msm_dai[] = {
+	/* FrontEnd DAI Links */
+	{
+		.name = "MSM8960 Media1",
+		.stream_name = "MultiMedia1",
+		.cpu_dai_name	= "MultiMedia1",
+		.platform_name  = "msm-pcm-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA1
+	},
+	{
+		.name = "MSM8960 Media2",
+		.stream_name = "MultiMedia2",
+		.cpu_dai_name	= "MultiMedia2",
+		.platform_name  = "msm-pcm-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA2,
+	},
+	{
+		.name = "Circuit-Switch Voice",
+		.stream_name = "CS-Voice",
+		.cpu_dai_name   = "CS-VOICE",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_CS_VOICE,
+	},
+	{
+		.name = "MSM VoIP",
+		.stream_name = "VoIP",
+		.cpu_dai_name	= "VoIP",
+		.platform_name  = "msm-voip-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_VOIP,
+	},
+	{
+		.name = "MSM8960 LPA",
+		.stream_name = "LPA",
+		.cpu_dai_name	= "MultiMedia3",
+		.platform_name  = "msm-pcm-lpa",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA3,
+	},
+	/* Hostless PMC purpose */
+	{
+		.name = "SLIMBUS_0 Hostless",
+		.stream_name = "SLIMBUS_0 Hostless",
+		.cpu_dai_name	= "SLIMBUS0_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		/* .be_id = do not care */
+	},
+	{
+		.name = "INT_FM Hostless",
+		.stream_name = "INT_FM Hostless",
+		.cpu_dai_name	= "INT_FM_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		/* .be_id = do not care */
+	},
+	{
+		.name = "MSM AFE-PCM RX",
+		.stream_name = "AFE-PROXY RX",
+		.cpu_dai_name = "msm-dai-q6.241",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.platform_name  = "msm-pcm-afe",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = "MSM AFE-PCM TX",
+		.stream_name = "AFE-PROXY TX",
+		.cpu_dai_name = "msm-dai-q6.240",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.platform_name  = "msm-pcm-afe",
+		.ignore_suspend = 1,
+	},
+	{
+		.name = "MSM8960 Compr",
+		.stream_name = "COMPR",
+		.cpu_dai_name	= "MultiMedia4",
+		.platform_name	= "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA4,
+	},
+	{
+		.name = "AUXPCM Hostless",
+		.stream_name = "AUXPCM Hostless",
+		.cpu_dai_name	= "AUXPCM_HOSTLESS",
+		.platform_name  = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	/* HDMI Hostless */
+	{
+		.name = "HDMI_RX_HOSTLESS",
+		.stream_name = "HDMI_RX_HOSTLESS",
+		.cpu_dai_name = "HDMI_HOSTLESS",
+		.platform_name = "msm-pcm-hostless",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+	},
+	{
+		.name = "VoLTE",
+		.stream_name = "VoLTE",
+		.cpu_dai_name   = "VoLTE",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.be_id = MSM_FRONTEND_DAI_VOLTE,
+	},
+	{
+		.name = "Voice2",
+		.stream_name = "Voice2",
+		.cpu_dai_name   = "Voice2",
+		.platform_name  = "msm-pcm-voice",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1,/* this dainlink has playback support */
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.be_id = MSM_FRONTEND_DAI_VOICE2,
+	},
+	{
+		.name = "MSM8960 LowLatency",
+		.stream_name = "MultiMedia5",
+		.cpu_dai_name	= "MultiMedia5",
+		.platform_name  = "msm-lowlatency-pcm-dsp",
+		.dynamic = 1,
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.ignore_suspend = 1,
+		/* this dainlink has playback support */
+		.ignore_pmdown_time = 1,
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA5,
+	},
+	/* Backend BT/FM DAI Links */
+	{
+		.name = LPASS_BE_INT_BT_SCO_RX,
+		.stream_name = "Internal BT-SCO Playback",
+		.cpu_dai_name = "msm-dai-q6.12288",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name	= "msm-stub-rx",
+		.init = &msm_btsco_init,
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_BT_SCO_RX,
+		.be_hw_params_fixup = msm_btsco_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = LPASS_BE_INT_BT_SCO_TX,
+		.stream_name = "Internal BT-SCO Capture",
+		.cpu_dai_name = "msm-dai-q6.12289",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name	= "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_BT_SCO_TX,
+		.be_hw_params_fixup = msm_btsco_be_hw_params_fixup,
+	},
+	{
+		.name = LPASS_BE_INT_FM_RX,
+		.stream_name = "Internal FM Playback",
+		.cpu_dai_name = "msm-dai-q6.12292",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_FM_RX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = LPASS_BE_INT_FM_TX,
+		.stream_name = "Internal FM Capture",
+		.cpu_dai_name = "msm-dai-q6.12293",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INT_FM_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	/* HDMI BACK END DAI Link */
+	{
+		.name = LPASS_BE_HDMI,
+		.stream_name = "HDMI Playback",
+		.cpu_dai_name = "msm-dai-q6-hdmi.8",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_HDMI_RX,
+		.be_hw_params_fixup = msm_hdmi_be_hw_params_fixup,
+	},
+	/* Backend AFE DAI Links */
+	{
+		.name = LPASS_BE_AFE_PCM_RX,
+		.stream_name = "AFE Playback",
+		.cpu_dai_name = "msm-dai-q6.224",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AFE_PCM_RX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = LPASS_BE_AFE_PCM_TX,
+		.stream_name = "AFE Capture",
+		.cpu_dai_name = "msm-dai-q6.225",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AFE_PCM_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	/* AUX PCM Backend DAI Links */
+	{
+		.name = LPASS_BE_AUXPCM_RX,
+		.stream_name = "AUX PCM Playback",
+		.cpu_dai_name = "msm-dai-q6.2",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AUXPCM_RX,
+		.be_hw_params_fixup = msm_auxpcm_be_params_fixup,
+		.ops = &msm_auxpcm_be_ops,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = LPASS_BE_AUXPCM_TX,
+		.stream_name = "AUX PCM Capture",
+		.cpu_dai_name = "msm-dai-q6.3",
+		.platform_name = "msm-pcm-routing",
+		.codec_name = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_AUXPCM_TX,
+		.be_hw_params_fixup = msm_auxpcm_be_params_fixup,
+	},
+	/* Incall Music BACK END DAI Link */
+	{
+		.name = LPASS_BE_VOICE_PLAYBACK_TX,
+		.stream_name = "Voice Farend Playback",
+		.cpu_dai_name = "msm-dai-q6.32773",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-rx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	/* Incall Record Uplink BACK END DAI Link */
+	{
+		.name = LPASS_BE_INCALL_RECORD_TX,
+		.stream_name = "Voice Uplink Capture",
+		.cpu_dai_name = "msm-dai-q6.32772",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INCALL_RECORD_TX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+	},
+	/* Incall Record Downlink BACK END DAI Link */
+	{
+		.name = LPASS_BE_INCALL_RECORD_RX,
+		.stream_name = "Voice Downlink Capture",
+		.cpu_dai_name = "msm-dai-q6.32771",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "msm-stub-codec.1",
+		.codec_dai_name = "msm-stub-tx",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_INCALL_RECORD_RX,
+		.be_hw_params_fixup = msm_be_hw_params_fixup,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	/* HTC_AUD_START LPA5 */
+	{
+		.name = "MSM8960 Media5",
+		.stream_name = "MultiMedia5",
+		.cpu_dai_name	= "MultiMedia5",
+		.platform_name	= "msm-pcm-routing",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dailink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA5
+	},
+	{
+		.name = "MSM8960 Media6",
+		.stream_name = "MultiMedia6",
+		.cpu_dai_name	= "MultiMedia6",
+		.platform_name	= "msm-pcm-routing",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dailink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA6
+	},
+	{
+		.name = "MSM8960 Compr2",
+		.stream_name = "COMPR2",
+		.cpu_dai_name	= "MultiMedia7",
+		.platform_name	= "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dailink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA7,
+	},
+	{
+		.name = "MultiMedia8 Playback",
+		.stream_name = "COMPR3",
+		.cpu_dai_name	= "MultiMedia8",
+		.platform_name	= "msm-compr-dsp",
+		.dynamic = 1,
+		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
+					SND_SOC_DPCM_TRIGGER_POST},
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.codec_name = "snd-soc-dummy",
+		.ignore_suspend = 1,
+		.ignore_pmdown_time = 1, /* this dailink has playback support */
+		.be_id = MSM_FRONTEND_DAI_MULTIMEDIA8,
+	},
+	/* HTC_AUD_END LPA5 */
+	/* Backend DAI Links */
+	{
+		.name = LPASS_BE_SLIMBUS_0_RX,
+		.stream_name = "Slimbus Playback",
+		.cpu_dai_name = "msm-dai-q6.16384",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla_codec",
+		.codec_dai_name	= "tabla_rx1",
+		.no_pcm = 1,
+                .dynamic = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_RX,
+		.init = &msm_audrx_init,
+		.be_hw_params_fixup = msm_slim_0_rx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+		.ignore_pmdown_time = 1, /* this dainlink has playback support */
+	},
+	{
+		.name = LPASS_BE_SLIMBUS_0_TX,
+		.stream_name = "Slimbus Capture",
+		.cpu_dai_name = "msm-dai-q6.16385",
+		.platform_name = "msm-pcm-routing",
+		.codec_name     = "tabla_codec",
+		.codec_dai_name	= "tabla_tx1",
+		.no_pcm = 1,
+		.be_id = MSM_BACKEND_DAI_SLIMBUS_0_TX,
+		.be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup,
+		.ops = &msm_be_ops,
+	},
+	/* Ultrasound TX Back End DAI Link */
+	{
+		.name = "SLIMBUS_2 Hostless",
+		.stream_name = "SLIMBUS_2 Hostless",
+		.cpu_dai_name = "msm-dai-q6.16389",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla_codec",
+		.codec_dai_name = "tabla_tx2",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_be_ops,
+	},
+	/* Ultrasound RX Back End DAI Link */
+	{
+		.name = "SLIMBUS_2 Hostless Playback",
+		.stream_name = "SLIMBUS_2 Hostless Playback",
+		.cpu_dai_name = "msm-dai-q6.16388",
+		.platform_name = "msm-pcm-hostless",
+		.codec_name = "tabla_codec",
+		.codec_dai_name = "tabla_rx3",
+		.ignore_suspend = 1,
+		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
+		.ops = &msm_be_ops,
+	},
+};
+
+static struct snd_soc_card snd_soc_card_msm8960 = {
+		.name		= "msm8960-snd-card",
+		.dai_link	= msm_dai,
+		.num_links	= ARRAY_SIZE(msm_dai),
+		.controls = tabla_msm_controls,
+		.num_controls = ARRAY_SIZE(tabla_msm_controls),
+};
+
+static struct platform_device *msm_snd_device;
+static struct platform_device *msm_snd_tabla1x_device;
+
+static int msm_configure_headset_mic_gpios(void)
+{
+	int ret;
+	struct pm_gpio param = {
+		.direction      = PM_GPIO_DIR_OUT,
+		.output_buffer  = PM_GPIO_OUT_BUF_CMOS,
+		.output_value   = 1,
+		.pull	   = PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength   = PM_GPIO_STRENGTH_MED,
+		.function       = PM_GPIO_FUNC_NORMAL,
+	};
+
+	ret = gpio_request(PM8921_GPIO_PM_TO_SYS(23), "AV_SWITCH");
+	if (ret) {
+		pr_err("%s: Failed to request gpio %d\n", __func__,
+			PM8921_GPIO_PM_TO_SYS(23));
+		return ret;
+	}
+
+	ret = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(23), &param);
+	if (ret)
+		pr_err("%s: Failed to configure gpio %d\n", __func__,
+			PM8921_GPIO_PM_TO_SYS(23));
+	else
+		gpio_direction_output(PM8921_GPIO_PM_TO_SYS(23), 0);
+
+	ret = gpio_request(us_euro_sel_gpio, "US_EURO_SWITCH");
+	if (ret) {
+		pr_err("%s: Failed to request gpio %d\n", __func__,
+		       us_euro_sel_gpio);
+		gpio_free(PM8921_GPIO_PM_TO_SYS(23));
+		return ret;
+	}
+	ret = pm8xxx_gpio_config(us_euro_sel_gpio, &param);
+	if (ret)
+		pr_err("%s: Failed to configure gpio %d\n", __func__,
+		       us_euro_sel_gpio);
+	else
+		gpio_direction_output(us_euro_sel_gpio, 0);
+
+	return 0;
+}
+static void msm_free_headset_mic_gpios(void)
+{
+	if (msm_headset_gpios_configured) {
+		gpio_free(PM8921_GPIO_PM_TO_SYS(23));
+		gpio_free(us_euro_sel_gpio);
+	}
+}
+
+static int __init msm_ville_audio_init(void)
+{
+	int ret;
+
+	if (!soc_class_is_msm8960()) {
+		pr_debug("%s: Not the right machine type\n", __func__);
+		return -ENODEV ;
+	}        
+
+	mbhc_cfg.calibration = def_tabla_mbhc_cal();
+	if (!mbhc_cfg.calibration) {
+		pr_err("Calibration data allocation failed\n");
+		return -ENOMEM;
+	}
+	msm_snd_device = platform_device_alloc("soc-audio", 0);
+	if (!msm_snd_device) {
+		pr_err("Platform device allocation failed\n");
+		kfree(mbhc_cfg.calibration);
+		return -ENOMEM;
+	}
+	platform_set_drvdata(msm_snd_device, &snd_soc_card_msm8960);
+	ret = platform_device_add(msm_snd_device);
+	if (ret) {
+		platform_device_put(msm_snd_device);
+		kfree(mbhc_cfg.calibration);
+		return ret;
+	}
+
+	if (cpu_is_msm8960()) {
+		if (msm_configure_headset_mic_gpios()) {
+			pr_err("%s Fail to configure headset mic gpios\n",
+								__func__);
+			msm_headset_gpios_configured = 0;
+		} else
+			msm_headset_gpios_configured = 1;
+	} else {
+		msm_headset_gpios_configured = 0;
+		pr_debug("%s headset GPIO 23 and 35 not configured msm960ab",
+								__func__);
+	}
+	mutex_init(&cdc_mclk_mutex);
+	atomic_set(&auxpcm_rsc_ref, 0);
+	return ret;
+
+}
+module_init(msm_ville_audio_init);
+
+static void __exit msm_audio_exit(void)
+{
+	if (!soc_class_is_msm8960()) {
+		pr_debug("%s: Not the right machine type\n", __func__);
+		return ;
+	}
+	msm_free_headset_mic_gpios();
+	platform_device_unregister(msm_snd_device);
+	platform_device_unregister(msm_snd_tabla1x_device);
+	kfree(mbhc_cfg.calibration);
+	mutex_destroy(&cdc_mclk_mutex);
+}
+module_exit(msm_audio_exit);
+
+MODULE_DESCRIPTION("ALSA SoC MSM8960");
+MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-msm/htc/ville/board-ville-camera.c b/arch/arm/mach-msm/htc/ville/board-ville-camera.c
new file mode 100644
index 0000000..849fbd4
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/board-ville-camera.c
@@ -0,0 +1,1173 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <asm/mach-types.h>
+#include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <mach/board.h>
+#include <mach/msm_bus_board.h>
+#include <mach/gpiomux.h>
+#include <asm/setup.h>
+
+#include "devices.h"
+#include "board-ville.h"
+
+#include <linux/spi/spi.h>
+
+#include "board-mahimahi-flashlight.h"
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#include <linux/htc_flashlight.h>
+#endif
+
+#ifdef CONFIG_MSM_CAMERA
+#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
+static int camera_sensor_power_enable(char *power, unsigned volt, struct regulator **sensor_power);
+static int camera_sensor_power_disable(struct regulator *sensor_power);
+
+static struct platform_device msm_camera_server = {
+	.name = "msm_cam_server",
+	.id = 0,
+};
+
+static struct gpiomux_setting cam_settings[16] = {
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*suspend*/
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_1, /*active 1 - FUNC1 2MA*/
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*active 2*/
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_1, /*active 3 - FUNC1 8MA*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_2, /*active 4 - FUNC2 2MA*/
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*active 5 - I(L) 4MA*/
+		.drv = GPIOMUX_DRV_4MA,
+		.pull = GPIOMUX_PULL_DOWN,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_2, /*active 6 - A FUNC2 4MA*/
+		.drv = GPIOMUX_DRV_4MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*active 7 - I(NP) 2MA*/
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*active 8 - I(PD) 2MA*/
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*active 9 - O(H) 2MA*/
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_OUT_HIGH,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*active 10 - O(L) 8MA*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_OUT_LOW,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*active 11 - I(PU) 2MA*/
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_UP,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*active 12 - O(L) 2MA*/
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_OUT_LOW,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_2, /*active 13 - A FUNC2 8MA*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*active 14 - I(NP) 8MA*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_NONE,
+		.dir = GPIOMUX_IN,
+	},
+
+	{
+		.func = GPIOMUX_FUNC_GPIO, /*active 15 - I(PD) 8MA*/
+		.drv = GPIOMUX_DRV_8MA,
+		.pull = GPIOMUX_PULL_DOWN,
+		.dir = GPIOMUX_IN,
+	},
+};
+
+static struct msm_gpiomux_config ville_cam_configs[] = {
+	{
+		.gpio = VILLE_GPIO_CAM_MCLK1,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[13], /*A FUNC2 8MA*/
+			[GPIOMUX_SUSPENDED] = &cam_settings[10], /*O(L) 8MA*/
+		},
+	},
+	{
+		.gpio = VILLE_GPIO_CAM_MCLK0,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[3],  /*Fun1 8MA*/
+			[GPIOMUX_SUSPENDED] = &cam_settings[10], /*O(L) 8MA*/
+		},
+	},
+
+	{
+		.gpio = VILLE_GPIO_CAM_PWDN,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[9],       /*O(H) 2MA*/
+			[GPIOMUX_SUSPENDED] = &cam_settings[12],  /*O(L) 2MA*/
+		},
+	},
+
+	{
+		.gpio = VILLE_GPIO_CAM_I2C_DAT,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[3], /*FUNC1 8MA*/
+			[GPIOMUX_SUSPENDED] = &cam_settings[15], /*I(PD) 8MA*/
+		},
+	},
+	{
+		.gpio = VILLE_GPIO_CAM_I2C_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[3], /*FUNC1 8MA*/
+			[GPIOMUX_SUSPENDED] = &cam_settings[15], /*I(PD) 8MA*/
+		},
+	},
+	{
+		.gpio = VILLE_GPIO_RAW_INTR0,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[7], /*I(NP) 2MA*/
+			[GPIOMUX_SUSPENDED] = &cam_settings[8], /*I(PD) 2MA*/
+		},
+	},
+	{
+		.gpio = VILLE_GPIO_RAW_INTR1,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &cam_settings[7], /*I(NP) 2MA*/
+			[GPIOMUX_SUSPENDED] = &cam_settings[8], /*I(PD) 2MA*/
+		},
+	},
+	/* gpio config for Rawchip SPI - gsbi10 */
+	{
+		.gpio      = VILLE_GPIO_MCAM_SPI_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[13], /*A FUNC2 8MA*/
+			[GPIOMUX_SUSPENDED] = &cam_settings[15], /* I(PD) 8MA */
+		},
+	},
+	{
+		.gpio      = VILLE_GPIO_MCAM_SPI_CS0,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[13], /*A FUNC2 8MA*/
+			[GPIOMUX_SUSPENDED] = &cam_settings[15], /* I(PD) 8MA */
+		},
+	},
+	{
+		.gpio      = VILLE_GPIO_MCAM_SPI_DI,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[13], /*A FUNC2 8MA*/
+			[GPIOMUX_SUSPENDED] = &cam_settings[15], /* I(PD) 8MA */
+		},
+	},
+	{
+		.gpio      = VILLE_GPIO_MCAM_SPI_DO,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &cam_settings[13], /*A FUNC2 8MA*/
+			[GPIOMUX_SUSPENDED] = &cam_settings[15], /* I(PD) 8MA */
+		},
+	},
+};
+
+static struct msm_bus_vectors cam_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+};
+
+static struct msm_bus_vectors cam_preview_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 96215040,
+		.ib  = 378224640,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+};
+
+static struct msm_bus_vectors cam_video_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 342150912,
+		.ib  = 1361968128,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 207747072,
+		.ib  = 489756672,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 60318720,
+		.ib  = 150796800,
+	},
+};
+
+static struct msm_bus_vectors cam_snapshot_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 147045888,
+		.ib  = 588183552,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 263678976,
+		.ib  = 659197440,
+	},
+};
+
+static struct msm_bus_vectors cam_zsl_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_VFE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 319044096,
+		.ib  = 1271531520,
+	},
+	{
+		.src = MSM_BUS_MASTER_VPE,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 0,
+		.ib  = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_JPEG_ENC,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab  = 239708160,
+		.ib  = 599270400,
+	},
+};
+
+static struct msm_bus_paths cam_bus_client_config[] = {
+	{
+		ARRAY_SIZE(cam_init_vectors),
+		cam_init_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_preview_vectors),
+		cam_preview_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_video_vectors),
+		cam_video_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_snapshot_vectors),
+		cam_snapshot_vectors,
+	},
+	{
+		ARRAY_SIZE(cam_zsl_vectors),
+		cam_zsl_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata cam_bus_client_pdata = {
+		cam_bus_client_config,
+		ARRAY_SIZE(cam_bus_client_config),
+		.name = "msm_camera",
+};
+
+static int ville_csi_vreg_on(void);
+static int ville_csi_vreg_off(void);
+
+struct msm_camera_device_platform_data msm_camera_csi_device_data[] = {
+	{
+		.ioclk.mclk_clk_rate = 24000000,
+		.ioclk.vfe_clk_rate  = 228570000,
+		.csid_core = 0,
+		.camera_csi_on = ville_csi_vreg_on,
+		.camera_csi_off = ville_csi_vreg_off,
+		.cam_bus_scale_table = &cam_bus_client_pdata,
+		.is_csiphy = 1,
+		.is_csid   = 1,
+		.is_ispif  = 1,
+		.is_vpe    = 1,
+	},
+	{
+		.ioclk.mclk_clk_rate = 24000000,
+		.ioclk.vfe_clk_rate  = 228570000,
+		.csid_core = 1,
+		.camera_csi_on = ville_csi_vreg_on,
+		.camera_csi_off = ville_csi_vreg_off,
+		.cam_bus_scale_table = &cam_bus_client_pdata,
+		.is_csiphy = 1,
+		.is_csid   = 1,
+		.is_ispif  = 1,
+		.is_vpe    = 1,
+	},
+};
+
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#define LED_ON				1
+#define LED_OFF				0
+
+int ville_flashlight_control(int mode)
+{
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+	return tps61310_flashlight_control(mode);
+#else
+	return 0;
+#endif
+}
+
+static struct msm_camera_sensor_flash_src msm_flash_src = {
+	.flash_sr_type = MSM_CAMERA_FLASH_SRC_CURRENT_DRIVER,
+	.camera_flash = ville_flashlight_control,
+};
+#endif /* CONFIG_MSM_CAMERA_FLASH */
+
+/*
+8921_lvs6 == V_CAMIO_1V8
+GPIO#4 == CAM2_MCLK
+GPIO#93 == V_CAM_D1V8
+8921_l8 == V_CAM_A2V8
+8921_l9 == V_CAM_VCM2V8
+*/
+#ifdef CONFIG_RAWCHIP
+static int ville_use_ext_1v2(void)
+{
+	return 0;
+}
+
+static struct regulator *reg_8921_l2;
+static struct regulator *reg_8921_l8;
+static struct regulator *reg_8921_l9;
+static struct regulator *reg_8921_lvs6;
+
+static int ville_rawchip_vreg_on(void)
+{
+	int rc;
+	pr_info("[CAM] %s\n", __func__);
+
+	/* VCM */
+	rc = camera_sensor_power_enable("8921_l9", 2800000, &reg_8921_l9); // Mu Lee for sequence with raw chip 20120116
+	if (rc < 0) {
+		pr_err("[CAM] rawchip_power_enable(\"8921_l9\", 2.8V) FAILED %d\n", rc);
+		goto enable_VCM_fail;
+	}
+
+	/* PM8921_lvs6 1800000 */
+	rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+	if (rc < 0) {
+		pr_err("[CAM] rawchip_power_enable(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+		goto enable_1v8_fail;
+	}
+
+	mdelay(5);
+
+	/* digital */
+	rc = gpio_request(VILLE_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"gpio %d\", 1.2V) FAILED %d\n", VILLE_GPIO_V_CAM_D1V2_EN, rc);
+		goto enable_1v2_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_V_CAM_D1V2_EN, 1);
+	gpio_free(VILLE_GPIO_V_CAM_D1V2_EN);
+
+	/* analog */
+	/* Mu Lee for sequence with raw chip 20120116 */
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"8921_l8\", 2.8V) FAILED %d\n", rc);
+		goto enable_analog_fail;
+	}
+
+	/* LCMIO */
+	rc = gpio_request(VILLE_GPIO_V_LCMIO_1V8_EN, "CAM_D1V8_EN"); /* Mu Lee for sequence with raw chip 20120116 */
+	if (rc < 0) {
+		pr_err("[CAM] %s:GPIO_CAM_D1V8_EN gpio %d request failed, rc=%d\n", __func__,  VILLE_GPIO_V_LCMIO_1V8_EN, rc);
+		goto lcmio_hi_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_V_LCMIO_1V8_EN, 1); /* Mu Lee for sequence with raw chip 20120116 */
+	gpio_free(VILLE_GPIO_V_LCMIO_1V8_EN); /* Mu Lee for sequence with raw chip 20120116 */
+
+	return rc;
+
+lcmio_hi_fail:
+	camera_sensor_power_disable(reg_8921_l8);
+enable_analog_fail:
+	gpio_request(VILLE_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	gpio_direction_output(VILLE_GPIO_V_CAM_D1V2_EN, 0);
+	gpio_free(VILLE_GPIO_V_CAM_D1V2_EN);
+enable_1v2_fail:
+	camera_sensor_power_disable(reg_8921_lvs6);
+enable_1v8_fail:
+	camera_sensor_power_disable(reg_8921_l9);
+enable_VCM_fail:
+	return rc;
+}
+
+static int ville_rawchip_vreg_off(void)
+{
+	int rc = 0;
+
+	pr_info("[CAM] %s\n", __func__);
+
+	/* Mu Lee for sequence with raw chip 20120116 */
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_disable(\"8921_l8\") FAILED %d\n", rc);
+		goto ville_rawchip_vreg_off_fail;
+	}
+
+	rc = gpio_request(VILLE_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"gpio %d\", 1.2V) FAILED %d\n", VILLE_GPIO_V_CAM_D1V2_EN, rc);
+		goto ville_rawchip_vreg_off_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_V_CAM_D1V2_EN, 0);
+	gpio_free(VILLE_GPIO_V_CAM_D1V2_EN);
+
+	udelay(50);
+
+	rc = gpio_request(VILLE_GPIO_V_LCMIO_1V8_EN, "CAM_D1V8_EN");
+	if (rc < 0) {
+		pr_err("[CAM] %s:GPIO_CAM_D1V8_EN gpio %d request failed, rc=%d\n", __func__,  VILLE_GPIO_V_LCMIO_1V8_EN, rc);
+		goto ville_rawchip_vreg_off_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_V_LCMIO_1V8_EN, 0);
+	gpio_free(VILLE_GPIO_V_LCMIO_1V8_EN);
+
+	mdelay(5);
+
+	rc = camera_sensor_power_disable(reg_8921_lvs6);
+	if (rc < 0) {
+		pr_err("[CAM] rawchip_power_disable(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+		goto ville_rawchip_vreg_off_fail;
+	}
+
+	/* VCM */
+	/* Mu Lee for sequenc with raw chip 20120116 */
+	rc = camera_sensor_power_disable(reg_8921_l9);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_disable(\"8921_l9\") FAILED %d\n", rc);
+		goto ville_rawchip_vreg_off_fail;
+	}
+
+	return rc;
+
+ville_rawchip_vreg_off_fail:
+	return rc;
+}
+
+static struct msm_camera_rawchip_info msm_rawchip_board_info = {
+	.rawchip_reset	= VILLE_GPIO_RAW_RSTN,
+	.rawchip_intr0	= MSM_GPIO_TO_INT(VILLE_GPIO_RAW_INTR0),
+	.rawchip_intr1	= MSM_GPIO_TO_INT(VILLE_GPIO_RAW_INTR1),
+	.rawchip_spi_freq = 27, /* MHz, should be the same to spi max_speed_hz */
+	.rawchip_mclk_freq = 24, /* MHz, should be the same as cam csi0 mclk_clk_rate */
+	.camera_rawchip_power_on = ville_rawchip_vreg_on,
+	.camera_rawchip_power_off = ville_rawchip_vreg_off,
+	.rawchip_use_ext_1v2 = ville_use_ext_1v2,
+};
+
+static struct platform_device msm_rawchip_device = {
+	.name	= "rawchip",
+	.dev	= {
+		.platform_data = &msm_rawchip_board_info,
+	},
+};
+#endif /* CONFIG_RAWCHIP */
+
+static uint16_t msm_cam_gpio_tbl[] = {
+	VILLE_GPIO_CAM_MCLK0, /*CAMIF_MCLK*/
+	VILLE_GPIO_CAM_MCLK1,
+	VILLE_GPIO_RAW_INTR0,
+	VILLE_GPIO_RAW_INTR1,
+	VILLE_GPIO_MCAM_SPI_CLK,
+	VILLE_GPIO_MCAM_SPI_CS0,
+	VILLE_GPIO_MCAM_SPI_DI,
+	VILLE_GPIO_MCAM_SPI_DO,
+};
+
+static struct msm_camera_gpio_conf gpio_conf = {
+	.cam_gpiomux_conf_tbl = NULL,
+	.cam_gpiomux_conf_tbl_size = 0,
+	.cam_gpio_tbl = msm_cam_gpio_tbl,
+	.cam_gpio_tbl_size = ARRAY_SIZE(msm_cam_gpio_tbl),
+};
+
+static int camera_sensor_power_enable(char *power, unsigned volt, struct regulator **sensor_power)
+{
+	int rc;
+
+	if (power == NULL)
+		return -ENODEV;
+
+	*sensor_power = regulator_get(NULL, power);
+
+	if (IS_ERR(*sensor_power)) {
+		pr_err("[CAM] %s: Unable to get %s\n", __func__, power);
+		return -ENODEV;
+	}
+
+	if (volt != 1800000) {
+		rc = regulator_set_voltage(*sensor_power, volt, volt);
+		if (rc < 0) {
+			pr_err("[CAM] %s: unable to set %s voltage to %d rc:%d\n",
+					__func__, power, volt, rc);
+			regulator_put(*sensor_power);
+			*sensor_power = NULL;
+			return -ENODEV;
+		}
+	}
+
+	rc = regulator_enable(*sensor_power);
+	if (rc < 0) {
+		pr_err("[CAM] %s: Enable regulator %s failed\n", __func__, power);
+		regulator_put(*sensor_power);
+		*sensor_power = NULL;
+		return -ENODEV;
+	}
+
+	return rc;
+}
+
+static int camera_sensor_power_disable(struct regulator *sensor_power)
+{
+	int rc;
+	if (sensor_power == NULL)
+		return -ENODEV;
+
+	if (IS_ERR(sensor_power)) {
+		pr_err("[CAM] %s: Invalid requlator ptr\n", __func__);
+		return -ENODEV;
+	}
+
+	rc = regulator_disable(sensor_power);
+	if (rc < 0)
+		pr_err("[CAM] %s: disable regulator failed\n", __func__);
+
+	regulator_put(sensor_power);
+	sensor_power = NULL;
+	return rc;
+}
+
+static int ville_csi_vreg_on(void)
+{
+	pr_info("%s\n", __func__);
+	return camera_sensor_power_enable("8921_l2", 1200000, &reg_8921_l2);
+}
+
+static int ville_csi_vreg_off(void)
+{
+	pr_info("%s\n", __func__);
+	return camera_sensor_power_disable(reg_8921_l2);
+}
+
+#ifdef CONFIG_S5K3H2YX
+static int ville_s5k3h2yx_vreg_on(void)
+{
+	int rc = 0;
+	pr_info("[CAM] %s\n", __func__);
+
+#if 0
+	/* VCM */
+	rc = camera_sensor_power_enable("8921_l9", 2800000, &reg_8921_l9);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"8921_l9\", 2.85V) FAILED %d\n", rc);
+		goto enable_vcm_fail;
+	}
+
+	/* redundant setting...enable at rawchip */
+	/* IO */
+	rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"8921_lvs6\", 1.8V) FAILED %d\n", rc);
+		goto enable_io_fail;
+	}
+
+	/* analog */
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"8921_l8\", 2.8V) FAILED %d\n", rc);
+		goto enable_analog_fail;
+	}
+
+	udelay(50);
+
+	/* redundant setting...enable at rawchip */
+	/* digital */
+	rc = gpio_request(VILLE_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"gpio %d\", 1.2V) FAILED %d\n", VILLE_GPIO_V_CAM_D1V2_EN, rc);
+		goto enable_digital_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_V_CAM_D1V2_EN, 1);
+	gpio_free(VILLE_GPIO_V_CAM_D1V2_EN);
+
+	rc = gpio_request(VILLE_GPIO_V_LCMIO_1V8_EN, "CAM_D1V8_EN");
+	if (rc < 0) {
+		pr_err("[CAM] %s:GPIO_CAM_D1V8_EN gpio %d request failed, rc=%d\n", __func__,  VILLE_GPIO_V_LCMIO_1V8_EN, rc);
+		goto enable_digital_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_V_LCMIO_1V8_EN, 1);
+	gpio_free(VILLE_GPIO_V_LCMIO_1V8_EN);
+	return rc;
+
+enable_digital_fail:
+	camera_sensor_power_disable(reg_8921_l8);
+enable_analog_fail:
+	camera_sensor_power_disable(reg_8921_lvs6);
+enable_io_fail:
+	camera_sensor_power_disable(reg_8921_l9);
+enable_vcm_fail:
+#endif
+	return rc;
+}
+
+static int ville_s5k3h2yx_vreg_off(void)
+{
+	int rc = 0;
+
+	pr_info("[CAM] %s\n", __func__);
+#if 0
+	/* analog */
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_disable(\"8921_l8\") FAILED %d\n", rc);
+		goto ville_s5k3h2yx_vreg_off_fail;
+	}
+
+	udelay(50);
+	/* VCM */
+	rc = camera_sensor_power_disable(reg_8921_l9);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_disable(\"8921_l9\") FAILED %d\n", rc);
+		goto ville_s5k3h2yx_vreg_off_fail;
+	}
+
+	/* digital */
+	/* remove because rawchip will turn it off latter. */
+
+	rc = gpio_request(VILLE_GPIO_V_CAM_D1V2_EN, "CAM_D1V2_EN");
+	if (rc < 0) {
+		pr_err("[CAM] %s:GPIO_CAM_D1V2_EN gpio %d request failed, rc=%d\n", __func__,  VILLE_GPIO_V_CAM_D1V2_EN, rc);
+		goto ville_s5k3h2yx_vreg_off_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_V_CAM_D1V2_EN, 0);
+	gpio_free(VILLE_GPIO_V_CAM_D1V2_EN);
+
+	rc = gpio_request(VILLE_GPIO_V_LCMIO_1V8_EN, "CAM_D1V8_EN");
+	if (rc < 0) {
+		pr_err("[CAM] %s:GPIO_CAM_D1V8_EN gpio %d request failed, rc=%d\n", __func__,  VILLE_GPIO_V_LCMIO_1V8_EN, rc);
+		goto ville_s5k3h2yx_vreg_off_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_V_LCMIO_1V8_EN, 0);
+	gpio_free(VILLE_GPIO_V_LCMIO_1V8_EN);
+
+	/* IO */
+	rc = camera_sensor_power_disable(reg_8921_lvs6);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_disable(\"8921_lvs6\") FAILED %d\n", rc);
+		goto ville_s5k3h2yx_vreg_off_fail;
+	}
+
+ville_s5k3h2yx_vreg_off_fail:
+#endif
+
+	return rc;
+}
+
+#ifdef CONFIG_S5K3H2YX_ACT
+static struct i2c_board_info s5k3h2yx_actuator_i2c_info = {
+	I2C_BOARD_INFO("s5k3h2yx_act", 0x11),
+};
+
+static struct msm_actuator_info s5k3h2yx_actuator_info = {
+	.board_info     = &s5k3h2yx_actuator_i2c_info,
+	.bus_id         = MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+	.vcm_pwd        = VILLE_GPIO_CAM_VCM_PD,
+	.vcm_enable     = 1,
+};
+#endif
+
+static struct msm_camera_csi_lane_params s5k3h2yx_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x3,
+};
+
+static struct msm_camera_sensor_platform_info sensor_s5k3h2yx_board_info = {
+	.mount_angle = 90,
+	.sensor_reset_enable = 0,
+	.sensor_reset	= 0,
+	.sensor_pwd	= VILLE_GPIO_CAM_PWDN,
+	.vcm_pwd	= VILLE_GPIO_CAM_VCM_PD,
+	.vcm_enable	= 1,
+	.csi_lane_params = &s5k3h2yx_csi_lane_params,
+};
+
+/* Andrew_Cheng linear led 20111205 MB */ // Mu Lee sync EVA 20120127
+/*
+150 mA FL_MODE_FLASH_LEVEL1
+200 mA FL_MODE_FLASH_LEVEL2
+300 mA FL_MODE_FLASH_LEVEL3
+400 mA FL_MODE_FLASH_LEVEL4
+500 mA FL_MODE_FLASH_LEVEL5
+600 mA FL_MODE_FLASH_LEVEL6
+700 mA FL_MODE_FLASH_LEVEL7
+*/
+static struct camera_led_est msm_camera_sensor_s5k3h2yx_led_table[] = {
+//		{
+//		.enable = 0,
+//		.led_state = FL_MODE_FLASH_LEVEL1,
+//		.current_ma = 150,
+//		.lumen_value = 150,
+//		.min_step = 50,
+//		.max_step = 70
+//	},
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,
+		.min_step = 64,//31,/*26, //Mu L 0209 */
+		.max_step = 256
+	},
+		{
+		.enable = 1,//0, Mu L 0302
+		.led_state = FL_MODE_FLASH_LEVEL3,
+		.current_ma = 300,
+		.lumen_value = 350,//300,
+		.min_step = 60,//29,
+		.max_step = 63//34
+	},
+		{
+		.enable = 1,//0, Mu L 0302
+		.led_state = FL_MODE_FLASH_LEVEL4,
+		.current_ma = 400,
+		.lumen_value = 440,//400,
+		.min_step = 56,//27,
+		.max_step = 59//28
+	},
+//		{
+//		.enable = 0,
+//		.led_state = FL_MODE_FLASH_LEVEL5,
+//		.current_ma = 500,
+//		.lumen_value = 500,
+//		.min_step = 25,
+//		.max_step = 26
+//	},
+		{
+		.enable = 1,//0, Mu L 0302
+		.led_state = FL_MODE_FLASH_LEVEL6,
+		.current_ma = 600,
+		.lumen_value = 625,//600,
+		.min_step = 52,//23,
+		.max_step = 55//24
+	},
+	/*
+		{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL7,
+		.current_ma = 700,
+		.lumen_value = 700,
+		.min_step = 21,
+		.max_step = 22
+	},
+	*/
+		{
+		.enable = 1,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 745,//725,   //mk0217
+		.min_step = 0,
+		.max_step = 51//30/*25    //Mu L 0209*/
+	},
+
+		{
+		.enable = 2,
+		.led_state = FL_MODE_FLASH_LEVEL2,
+		.current_ma = 200,
+		.lumen_value = 250,//245,  //mk0127
+		.min_step = 0,
+		.max_step = 270
+	},
+		{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL3,
+		.current_ma = 300,
+		.lumen_value = 300,
+		.min_step = 0,
+		.max_step = 100
+	},
+		{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL4,
+		.current_ma = 400,
+		.lumen_value = 400,
+		.min_step = 101,
+		.max_step = 200
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL7,
+		.current_ma = 700,
+		.lumen_value = 700,
+		.min_step = 101,
+		.max_step = 200
+	},
+		{
+		.enable = 2,
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 745,//725,   //mk0217
+		.min_step = 271,
+		.max_step = 325
+	},
+	{
+		.enable = 0,
+		.led_state = FL_MODE_FLASH_LEVEL5,
+		.current_ma = 500,
+		.lumen_value = 500,
+		.min_step = 25,
+		.max_step = 26
+	},
+		{
+		.enable = 0,//3,  //mk0210
+		.led_state = FL_MODE_FLASH,
+		.current_ma = 750,
+		.lumen_value = 750,//740,//725,
+		.min_step = 271,
+		.max_step = 325
+	},
+};
+
+static struct camera_led_info msm_camera_sensor_s5k3h2yx_led_info = {
+	.enable = 1,
+	.low_limit_led_state = FL_MODE_TORCH,
+	.max_led_current_ma = 750,
+	.num_led_est_table = ARRAY_SIZE(msm_camera_sensor_s5k3h2yx_led_table),
+};
+
+static struct camera_flash_info msm_camera_sensor_s5k3h2yx_flash_info = {
+	.led_info = &msm_camera_sensor_s5k3h2yx_led_info,
+	.led_est_table = msm_camera_sensor_s5k3h2yx_led_table,
+};
+
+static struct camera_flash_cfg msm_camera_sensor_s5k3h2yx_flash_cfg = {
+	.low_temp_limit		= 5,
+	.low_cap_limit		= 15,
+	.flash_info             = &msm_camera_sensor_s5k3h2yx_flash_info,
+};
+/* Andrew_Cheng linear led 20111205 ME */
+
+static struct msm_camera_sensor_flash_data flash_s5k3h2yx = {
+	.flash_type	= MSM_CAMERA_FLASH_LED,
+#ifdef CONFIG_MSM_CAMERA_FLASH
+	.flash_src = &msm_flash_src,
+#endif
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_s5k3h2yx_data = {
+	.sensor_name = "s5k3h2yx",
+	.camera_power_on = ville_s5k3h2yx_vreg_on,
+	.camera_power_off = ville_s5k3h2yx_vreg_off,
+	.pdata = &msm_camera_csi_device_data[0],
+	.flash_data = &flash_s5k3h2yx,
+	.sensor_platform_info = &sensor_s5k3h2yx_board_info,
+	.gpio_conf = &gpio_conf,
+	.csi_if = 1,
+	.camera_type = BACK_CAMERA_2D,
+#ifdef CONFIG_S5K3H2YX_ACT
+	.actuator_info = &s5k3h2yx_actuator_info,
+#endif
+	.use_rawchip = RAWCHIP_ENABLE,
+	.flash_cfg = &msm_camera_sensor_s5k3h2yx_flash_cfg, /* Andrew_Cheng linear led 20111205 */
+};
+#endif /* CONFIG_S5K3H2YX */
+
+#ifdef CONFIG_MT9V113
+static int ville_mt9v113_vreg_on(void)
+{
+	int rc;
+
+	pr_info("[CAM] %s\n", __func__);
+	/* VCM */
+	/* Mu Lee for sequence with raw chip 20120116 */
+	rc = camera_sensor_power_enable("8921_l9", 2800000, &reg_8921_l9);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_enable(\"8921_l9\", 2.8V) FAILED %d\n", rc);
+		goto init_fail;
+	}
+
+	udelay(50);
+
+	/* digital */
+	rc = camera_sensor_power_enable("8921_lvs6", 1800000, &reg_8921_lvs6);
+	pr_info("[CAM] sensor_power_enable(\"8921_lvs6\", 1.8V) == %d\n", rc);
+	if (rc < 0)
+		goto init_fail;
+
+	udelay(50);
+
+	/* analog */
+	rc = camera_sensor_power_enable("8921_l8", 2800000, &reg_8921_l8);
+	pr_info("[CAM] sensor_power_enable(\"8921_l8\", 2.8V) == %d\n", rc);
+	if (rc < 0)
+		goto init_fail;
+
+	udelay(50);
+
+	/* IO */
+	rc = gpio_request(VILLE_GPIO_V_LCMIO_1V8_EN, "CAM_D1V8_EN");
+	pr_info("[CAM] ville_mt9v113_vreg_on %d 1v8\n", VILLE_GPIO_V_LCMIO_1V8_EN);
+	if (rc < 0) {
+		pr_err("[CAM] %s:GPIO_CAM_D1V8_EN gpio %d request failed, rc=%d\n", __func__,  VILLE_GPIO_V_LCMIO_1V8_EN, rc);
+		goto init_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_V_LCMIO_1V8_EN, 1);
+	gpio_free(VILLE_GPIO_V_LCMIO_1V8_EN);
+	udelay(50);
+
+	/* enable clock here?? */
+
+	/* Reset */
+#if 0
+	rc = gpio_request(VILLE_GPIO_CAM2_RSTz, "mt9v113");
+	if (rc < 0) {
+		pr_err("[CAM] %s:VILLE_GPIO_CAM2_RSTz gpio %d request failed, rc=%d\n", __func__,  VILLE_GPIO_CAM2_RSTz, rc);
+		goto init_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_CAM2_RSTz, 1);
+	msleep(2);
+	gpio_free(VILLE_GPIO_CAM2_RSTz);
+#endif
+	udelay(50);
+
+init_fail:
+	return rc;
+}
+
+static int ville_mt9v113_vreg_off(void)
+{
+	int rc;
+
+	pr_info("[CAM] %s\n", __func__);
+	/* Reset */
+#if 0
+	rc = gpio_request(VILLE_GPIO_CAM2_RSTz, "mt9v113");
+	if (rc < 0) {
+		pr_err("[CAM] %s:VILLE_GPIO_CAM2_RSTz gpio %d request failed, rc=%d\n", __func__,	VILLE_GPIO_CAM2_RSTz, rc);
+		goto init_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_CAM2_RSTz, 0);
+	msleep(2);
+	gpio_free(VILLE_GPIO_CAM2_RSTz);
+#endif
+	udelay(50);
+
+	/* disable clock here */
+
+	/* IO */
+	rc = gpio_request(VILLE_GPIO_V_LCMIO_1V8_EN, "CAM_D1V8_EN");
+	pr_info("[CAM] ville_mt9v113_vreg_off %d 1v8\n", VILLE_GPIO_V_LCMIO_1V8_EN);
+	if (rc < 0) {
+		pr_err("[CAM] %s:GPIO_CAM_D1V8_EN gpio %d request failed, rc=%d\n", __func__,  VILLE_GPIO_V_LCMIO_1V8_EN, rc);
+		goto init_fail;
+	}
+	gpio_direction_output(VILLE_GPIO_V_LCMIO_1V8_EN, 0);
+	gpio_free(VILLE_GPIO_V_LCMIO_1V8_EN);
+
+	udelay(50);
+
+	/* analog */
+	rc = camera_sensor_power_disable(reg_8921_l8);
+	pr_info("[CAM] camera_sensor_power_disable(\"8921_l8\", 2.8V) == %d\n", rc);
+	if (rc < 0)
+		goto init_fail;
+
+	udelay(50);
+
+	/* digital */
+	rc = camera_sensor_power_disable(reg_8921_lvs6);
+	pr_info("[CAM] camera_sensor_power_disable(\"8921_lvs6\", 1.8V) == %d\n", rc);
+	if (rc < 0)
+		goto init_fail;
+
+	udelay(50);
+
+	/* VCM */
+	rc = camera_sensor_power_disable(reg_8921_l9);
+	if (rc < 0) {
+		pr_err("[CAM] sensor_power_disable(\"8921_l9\") FAILED %d\n", rc);
+		goto init_fail;
+	}
+
+init_fail:
+		return rc;
+}
+
+static struct msm_camera_csi_lane_params mt9v113_csi_lane_params = {
+	.csi_lane_assign = 0xE4,
+	.csi_lane_mask = 0x1,
+};
+
+static struct msm_camera_sensor_platform_info sensor_mt9v113_board_info = {
+	.mount_angle = 270,
+	.sensor_reset_enable = 1,
+	.sensor_reset	= VILLE_GPIO_CAM2_RSTz,
+	.sensor_pwd	= VILLE_GPIO_CAM_PWDN,
+	.vcm_pwd	= 0,
+	.vcm_enable	= 1,
+	.csi_lane_params = &mt9v113_csi_lane_params,
+};
+
+static struct msm_camera_sensor_flash_data flash_mt9v113 = {
+	.flash_type	= MSM_CAMERA_FLASH_NONE,
+};
+
+static struct msm_camera_sensor_info msm_camera_sensor_mt9v113_data = {
+	.sensor_name = "mt9v113",
+	.sensor_reset_enable = 1,
+	.sensor_reset = VILLE_GPIO_CAM2_RSTz,
+	.sensor_pwd = VILLE_GPIO_CAM_PWDN,
+	.vcm_pwd = 0,
+	.vcm_enable = 1,
+	.camera_power_on = ville_mt9v113_vreg_on,
+	.camera_power_off = ville_mt9v113_vreg_off,
+	.pdata = &msm_camera_csi_device_data[1],
+	.flash_data = &flash_mt9v113,
+	.sensor_platform_info = &sensor_mt9v113_board_info,
+	.gpio_conf = &gpio_conf,
+	.csi_if = 1,
+	.camera_type = FRONT_CAMERA_2D,
+	.use_rawchip = RAWCHIP_DISABLE,
+};
+#endif /* CONFIG_MT9V113 */
+
+struct i2c_board_info ville_camera_i2c_boardinfo[] = {
+#ifdef CONFIG_S5K3H2YX
+	{
+		I2C_BOARD_INFO("s5k3h2yx", 0x20 >> 1),
+		.platform_data = &msm_camera_sensor_s5k3h2yx_data,
+	},
+#endif
+#ifdef CONFIG_MT9V113
+	{
+		I2C_BOARD_INFO("mt9v113", 0x3C),
+		.platform_data = &msm_camera_sensor_mt9v113_data,
+	},
+#endif
+};
+
+struct msm_camera_board_info ville_camera_board_info = {
+	.board_info = ville_camera_i2c_boardinfo,
+	.num_i2c_board_info = ARRAY_SIZE(ville_camera_i2c_boardinfo),
+};
+#endif /* CONFIG_MSM_CAMERA */
+
+void __init ville_init_camera(void)
+{
+#ifdef CONFIG_MSM_CAMERA
+	msm_gpiomux_install(ville_cam_configs,
+			ARRAY_SIZE(ville_cam_configs));
+
+	platform_device_register(&msm_rawchip_device);
+	platform_device_register(&msm_camera_server);
+	platform_device_register(&msm8960_device_i2c_mux_gsbi4);
+	platform_device_register(&msm8960_device_csiphy0);
+	platform_device_register(&msm8960_device_csiphy1);
+	platform_device_register(&msm8960_device_csid0);
+	platform_device_register(&msm8960_device_csid1);
+	platform_device_register(&msm8960_device_ispif);
+	platform_device_register(&msm8960_device_vfe);
+	platform_device_register(&msm8960_device_vpe);
+#endif /* CONFIG_MSM_CAMERA */
+}
diff --git a/arch/arm/mach-msm/htc/ville/board-ville-gpiomux.c b/arch/arm/mach-msm/htc/ville/board-ville-gpiomux.c
new file mode 100644
index 0000000..1047680
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/board-ville-gpiomux.c
@@ -0,0 +1,404 @@
+/* arch/arm/mach-msm/board-ville-gpio.c
+ * Copyright (C) 2011 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+*/
+
+#include <mach/gpiomux.h>
+#include "board-ville.h"
+
+#if 0  /* GSBI2 is not used for I2C */
+static struct gpiomux_setting gsbi2 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+#endif /* GSBI2 is not used for I2C */
+
+static struct gpiomux_setting gsbi3 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+#if 0
+static struct gpiomux_setting gsbi4 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+#endif
+
+static struct gpiomux_setting gsbi5 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv  = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+#if 0
+/* The SPI configurations apply to GSBI 10*/
+static struct gpiomux_setting gsbi10 = {
+	.func = GPIOMUX_FUNC_2,
+	.drv = GPIOMUX_DRV_4MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+#endif
+
+static struct gpiomux_setting gsbi12 = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting cdc_mclk = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting slimbus = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_KEEPER,
+};
+
+static struct msm_gpiomux_config ville_gsbi_configs[] __initdata = {
+#if 0 /* GSBI2 is not used for I2C */
+	{
+		.gpio      = VILLE_GPIO_VP_I2C_DAT,	/* GSBI2 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi2,
+		},
+	},
+	{
+		.gpio      = VILLE_GPIO_VP_I2C_CLK,	/* GSBI2 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi2,
+		},
+	},
+#endif /* GSBI2 is not used for I2C */
+	{
+		.gpio      = VILLE_GPIO_TP_I2C_DAT,	/* GSBI3 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi3,
+		},
+	},
+	{
+		.gpio      = VILLE_GPIO_TP_I2C_CLK,	/* GSBI3 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi3,
+		},
+	},
+#if 0
+	{
+		.gpio      = VILLE_GPIO_CAM_I2C_DAT,	/* GSBI4 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi4,
+		},
+	},
+	{
+		.gpio      = VILLE_GPIO_CAM_I2C_CLK,	/* GSBI4 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi4,
+		},
+	},
+#endif
+	{
+		.gpio      = VILLE_GPIO_CAP_I2C_DAT,	/* GSBI5 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi5,
+		},
+	},
+	{
+		.gpio      = VILLE_GPIO_CAP_I2C_CLK,	/* GSBI5 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi5,
+		},
+	},
+#if 0
+	{
+		/* GSBI10 SPI QUP VILLE_GPIO_MCAM_SPI_CLK */
+		.gpio      = VILLE_GPIO_MCAM_SPI_CLK,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+	{
+		/* GSBI10 SPI QUP VILLE_GPIO_MCAM_SPI_CS0 */
+		.gpio      = VILLE_GPIO_MCAM_SPI_CS0,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+	{
+		/* GSBI10 SPI QUP VILLE_GPIO_MCAM_SPI_DI */
+		.gpio      = VILLE_GPIO_MCAM_SPI_DI,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+	{
+		/* GSBI10 SPI QUP VILLE_GPIO_MCAM_SPI_DO */
+		.gpio      = VILLE_GPIO_MCAM_SPI_DO,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi10,
+		},
+	},
+#endif
+	{
+		.gpio      = VILLE_GPIO_SR_I2C_DAT,	/* GSBI12 I2C QUP SDA */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi12,
+		},
+	},
+	{
+		.gpio      = VILLE_GPIO_SR_I2C_CLK,	/* GSBI12 I2C QUP SCL */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &gsbi12,
+		},
+	},
+};
+
+static struct msm_gpiomux_config ville_slimbus_configs[] __initdata = {
+	{
+		.gpio	= VILLE_GPIO_AUD_WCD_SB_CLK,		/* slimbus data */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &slimbus,
+		},
+	},
+	{
+		.gpio	= VILLE_GPIO_AUD_WCD_SB_DATA,		/* slimbus clk */
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &slimbus,
+		},
+	},
+};
+
+static struct msm_gpiomux_config ville_audio_codec_configs[] __initdata = {
+	{
+		.gpio = VILLE_GPIO_AUD_WCD_MCLK,
+		.settings = {
+			[GPIOMUX_SUSPENDED] = &cdc_mclk,
+		},
+	},
+};
+static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv  = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting wcnss_5wire_active_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv  = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct msm_gpiomux_config wcnss_5wire_interface[] = {
+	{
+		.gpio = VILLE_GPIO_WCN_CMD_DATA2,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = VILLE_GPIO_WCN_CMD_DATA1,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = VILLE_GPIO_WCN_CMD_DATA0,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = VILLE_GPIO_WCN_CMD_SET,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+	{
+		.gpio = VILLE_GPIO_WCN_CMD_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &wcnss_5wire_active_cfg,
+			[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
+		},
+	},
+};
+
+static struct gpiomux_setting mdp_vsync_suspend_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct gpiomux_setting mdp_vsync_active_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
+	{
+		.gpio = VILLE_GPIO_LCD_TE,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
+			[GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
+		},
+	}
+};
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+
+static struct gpiomux_setting mhl_suspend_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting mhl_active_1_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_UP,
+};
+
+static struct gpiomux_setting mhl_active_2_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_UP,
+};
+
+static struct msm_gpiomux_config ville_mhl_configs[] __initdata = {
+	{
+		.gpio = VILLE_GPIO_MHL_RSTz,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &mhl_active_1_cfg,
+			[GPIOMUX_SUSPENDED] = &mhl_suspend_cfg,
+		},
+	},
+	{
+		.gpio = VILLE_GPIO_MHL_INT,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &mhl_active_2_cfg,
+			[GPIOMUX_SUSPENDED] = &mhl_suspend_cfg,
+		},
+	},
+};
+
+
+static struct gpiomux_setting hdmi_suspend_pd_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+static struct gpiomux_setting hdmi_suspend_np_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+
+static struct gpiomux_setting hdmi_active_1_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_8MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct gpiomux_setting hdmi_active_2_cfg = {
+	.func = GPIOMUX_FUNC_1,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_DOWN,
+};
+
+static struct msm_gpiomux_config ville_hdmi_configs[] __initdata = {
+	{
+		.gpio = VILLE_GPIO_HDMI_DDC_CLK,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &hdmi_active_1_cfg,
+			[GPIOMUX_SUSPENDED] = &hdmi_suspend_np_cfg,
+		},
+	},
+	{
+		.gpio = VILLE_GPIO_HDMI_DDC_DATA,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &hdmi_active_1_cfg,
+			[GPIOMUX_SUSPENDED] = &hdmi_suspend_np_cfg,
+		},
+	},
+	{
+		.gpio = VILLE_GPIO_HDMI_HPD,
+		.settings = {
+			[GPIOMUX_ACTIVE]    = &hdmi_active_2_cfg,
+			[GPIOMUX_SUSPENDED] = &hdmi_suspend_pd_cfg,
+		},
+	},
+};
+#endif
+
+static struct gpiomux_setting usb_id_cfg = {
+	.func = GPIOMUX_FUNC_GPIO,
+	.drv = GPIOMUX_DRV_2MA,
+	.pull = GPIOMUX_PULL_NONE,
+};
+
+static struct msm_gpiomux_config cable_detect_usbid_config[] __initdata = {
+	{
+		.gpio = VILLE_GPIO_USB_ID1,
+		.settings = {
+			[GPIOMUX_ACTIVE] = &usb_id_cfg,
+			[GPIOMUX_SUSPENDED] = &usb_id_cfg,
+		},
+	},
+};
+
+int __init ville_gpiomux_init(void)
+{
+	int rc;
+
+	rc = msm_gpiomux_init(NR_GPIO_IRQS);
+	if (rc) {
+		pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
+		return rc;
+	}
+
+	msm_gpiomux_install(ville_gsbi_configs,
+			ARRAY_SIZE(ville_gsbi_configs));
+
+	msm_gpiomux_install(ville_slimbus_configs,
+			ARRAY_SIZE(ville_slimbus_configs));
+
+	msm_gpiomux_install(ville_audio_codec_configs,
+			ARRAY_SIZE(ville_audio_codec_configs));
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+	msm_gpiomux_install(ville_hdmi_configs,
+			ARRAY_SIZE(ville_hdmi_configs));
+
+	msm_gpiomux_install(ville_mhl_configs,
+			ARRAY_SIZE(ville_mhl_configs));
+#endif
+	msm_gpiomux_install(msm8960_mdp_vsync_configs,
+			ARRAY_SIZE(msm8960_mdp_vsync_configs));
+
+	msm_gpiomux_install(wcnss_5wire_interface,
+			ARRAY_SIZE(wcnss_5wire_interface));
+
+	msm_gpiomux_install(cable_detect_usbid_config,
+			ARRAY_SIZE(cable_detect_usbid_config));
+
+	return 0;
+}
+
diff --git a/arch/arm/mach-msm/htc/ville/board-ville-keypad.c b/arch/arm/mach-msm/htc/ville/board-ville-keypad.c
new file mode 100644
index 0000000..ed524d7
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/board-ville-keypad.c
@@ -0,0 +1,99 @@
+/* arch/arm/mach-msm/board-ville-keypad.c
+ * Copyright (C) 2010 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+*/
+
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/gpio_event.h>
+#include <linux/gpio.h>
+#include <linux/keyreset.h>
+#include <asm/mach-types.h>
+#include <mach/board_htc.h>
+#include <mach/gpio.h>
+#include <mach/proc_comm.h>
+#include <linux/moduleparam.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include "board-ville.h"
+
+static char *keycaps = "--qwerty";
+#undef MODULE_PARAM_PREFIX
+#define MODULE_PARAM_PREFIX "board_ville."
+
+module_param_named(keycaps, keycaps, charp, 0);
+/* Direct Keys */
+
+static struct gpio_event_direct_entry ville_keypad_map[] = {
+	{
+		.gpio = VILLE_GPIO_VOL_DOWNz,
+		.code = KEY_VOLUMEDOWN,
+	},
+	{
+		.gpio = VILLE_GPIO_VOL_UPz,
+		.code = KEY_VOLUMEUP,
+	},
+};
+
+static struct gpio_event_input_info ville_keypad_power_info = {
+	.info.func = gpio_event_input_func,
+	.flags = GPIOEDF_PRINT_KEYS,
+	.type = EV_KEY,
+#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
+	.debounce_time.tv.nsec = 5 * NSEC_PER_MSEC,
+# else
+	.debounce_time.tv64 = 5 * NSEC_PER_MSEC,
+# endif
+	.keymap = ville_keypad_map,
+	.keymap_size = ARRAY_SIZE(ville_keypad_map),
+};
+
+static struct gpio_event_info *ville_keypad_info[] = {
+	&ville_keypad_power_info.info,
+};
+
+static struct gpio_event_platform_data ville_keypad_data = {
+	.name = "keypad_8960",
+	.info = ville_keypad_info,
+	.info_count = ARRAY_SIZE(ville_keypad_info),
+};
+
+static struct platform_device ville_keypad_device = {
+	.name = GPIO_EVENT_DEV_NAME,
+	.id = 0,
+	.dev		= {
+		.platform_data	= &ville_keypad_data,
+	},
+};
+
+static struct keyreset_platform_data ville_reset_keys_pdata = {
+	/*.keys_up = ville_reset_keys_up,*/
+	.keys_down = {
+		KEY_POWER,
+		KEY_VOLUMEDOWN,
+		KEY_VOLUMEUP,
+		0
+	},
+};
+
+static struct platform_device ville_reset_keys_device = {
+	.name = KEYRESET_NAME,
+	.dev.platform_data = &ville_reset_keys_pdata,
+};
+
+int __init ville_init_keypad(void)
+{
+	if (platform_device_register(&ville_reset_keys_device))
+		printk(KERN_WARNING "%s: register reset key fail\n", __func__);
+
+	return platform_device_register(&ville_keypad_device);
+}
+
diff --git a/arch/arm/mach-msm/htc/ville/board-ville-pmic.c b/arch/arm/mach-msm/htc/ville/board-ville-pmic.c
new file mode 100644
index 0000000..144e33d
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/board-ville-pmic.c
@@ -0,0 +1,409 @@
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/bootmem.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/leds.h>
+#include <linux/leds-pm8xxx-htc.h>
+#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
+#include <asm/mach-types.h>
+#include <asm/mach/mmc.h>
+#include <asm/setup.h>
+#include <mach/msm_bus_board.h>
+#include <mach/board.h>
+#include <mach/gpio.h>
+#include <mach/gpiomux.h>
+#include <mach/restart.h>
+#include "devices.h"
+#include "board-ville.h"
+
+void ville_pm8xxx_adc_device_register(void);
+
+extern unsigned int system_rev;
+
+struct pm8xxx_gpio_init {
+	unsigned			gpio;
+	struct pm_gpio			config;
+};
+
+struct pm8xxx_mpp_init {
+	unsigned			mpp;
+	struct pm8xxx_mpp_config_data	config;
+};
+
+#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
+			_func, _inv, _disable) \
+{ \
+	.gpio	= PM8921_GPIO_PM_TO_SYS(_gpio), \
+	.config	= { \
+		.direction	= _dir, \
+		.output_buffer	= _buf, \
+		.output_value	= _val, \
+		.pull		= _pull, \
+		.vin_sel	= _vin, \
+		.out_strength	= _out_strength, \
+		.function	= _func, \
+		.inv_int_pol	= _inv, \
+		.disable_pin	= _disable, \
+	} \
+}
+
+#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
+{ \
+	.mpp	= PM8921_MPP_PM_TO_SYS(_mpp), \
+	.config	= { \
+		.type		= PM8XXX_MPP_TYPE_##_type, \
+		.level		= _level, \
+		.control	= PM8XXX_MPP_##_control, \
+	} \
+}
+
+#define PM8XXX_GPIO_DISABLE(_gpio) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
+			 0, 0, 0, 1)
+
+#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
+			_pull, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_NO, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			_func, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(_gpio, _val, _func) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_BB, \
+			PM_GPIO_STRENGTH_HIGH, \
+			_func, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_L17_FUNC(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_L17, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+
+#define PM8XXX_GPIO_OUTPUT_VIN_S4_FUNC_XC(_gpio, _val) \
+	PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
+			PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
+			PM_GPIO_STRENGTH_HIGH, \
+			PM_GPIO_FUNC_NORMAL, 0, 0)
+/* Initial PM8921 GPIO configurations */
+static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
+	PM8XXX_GPIO_INIT(VILLE_PMGPIO_EARPHONE_DETz, PM_GPIO_DIR_IN,
+			 PM_GPIO_OUT_BUF_CMOS, 0, PM_GPIO_PULL_UP_1P5,
+			 PM_GPIO_VIN_S4, PM_GPIO_STRENGTH_LOW,
+			 PM_GPIO_FUNC_NORMAL, 0, 0),
+	PM8XXX_GPIO_INIT(VILLE_PMGPIO_AUD_REMO_PRESz, PM_GPIO_DIR_IN,
+			 PM_GPIO_OUT_BUF_CMOS, 0, PM_GPIO_PULL_NO,
+			 PM_GPIO_VIN_L17, PM_GPIO_STRENGTH_LOW,
+			 PM_GPIO_FUNC_NORMAL, 0, 0),
+	PM8XXX_GPIO_OUTPUT_VIN_L17_FUNC(VILLE_PMGPIO_CAP_RST, 0),
+};
+
+static struct  pm8xxx_gpio_init pm8921_gpios_cap_rst[] __initdata = {
+	PM8XXX_GPIO_OUTPUT_VIN_S4_FUNC_XC(VILLE_PMGPIO_CAP_RST, 0),
+};
+
+/* Initial PM8921 MPP configurations */
+static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
+	/* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
+	PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_3, D_BI_DIR, PM8921_MPP_DIG_LEVEL_S4, BI_PULLUP_10KOHM),
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_4, D_BI_DIR, PM8921_MPP_DIG_LEVEL_L17, BI_PULLUP_10KOHM),
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_11, D_BI_DIR, PM8921_MPP_DIG_LEVEL_S4, BI_PULLUP_10KOHM),
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_12, D_BI_DIR, PM8921_MPP_DIG_LEVEL_L17, BI_PULLUP_10KOHM),
+	PM8XXX_MPP_INIT(PM8XXX_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
+								DOUT_CTRL_LOW),
+};
+
+
+void __init ville_pm8921_gpio_mpp_init(void)
+{
+	int i, rc;
+
+	for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
+		rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
+					&pm8921_gpios[i].config);
+		if (rc) {
+			pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
+			break;
+		}
+	}
+
+	if (system_rev > 1) {	/*XC*/
+		rc = pm8xxx_gpio_config(pm8921_gpios_cap_rst[0].gpio,
+					&pm8921_gpios_cap_rst[0].config);
+		if (rc)
+			pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
+	}
+
+	for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
+		rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
+					&pm8921_mpps[i].config);
+		if (rc) {
+			pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
+			break;
+		}
+	}
+}
+
+static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
+	.irq_base		= PM8921_IRQ_BASE,
+	.devirq			= MSM_GPIO_TO_INT(104),
+	.irq_trigger_flag	= IRQF_TRIGGER_LOW,
+};
+
+static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
+	.gpio_base	= PM8921_GPIO_PM_TO_SYS(1),
+};
+
+static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
+	.mpp_base	= PM8921_MPP_PM_TO_SYS(1),
+};
+
+static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
+	.rtc_write_enable       = true,
+#ifdef CONFIG_HTC_OFFMODE_ALARM
+	.rtc_alarm_powerup	= true,
+#else
+	.rtc_alarm_powerup	= false,
+#endif
+};
+
+static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
+	.pull_up		= 1,
+	.kpd_trigger_delay_us	= 15625,
+	.wakeup			= 1,
+};
+
+static int pm8921_therm_mitigation[] = {
+	1100,
+	700,
+	600,
+	225,
+};
+
+static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
+	.safety_time		= 510,
+	.update_time		= 60000,
+	.max_voltage		= 4200,
+	.min_voltage		= 3200,
+	.resume_voltage_delta	= 50,
+	.term_current		= 50,
+	.cool_temp		= 0,
+	.warm_temp		= 48,
+	.temp_check_period	= 1,
+	.max_bat_chg_current	= 1025,
+	.cool_bat_chg_current	= 1025,
+	.warm_bat_chg_current	= 1025,
+	.cool_bat_voltage	= 4200,
+	.warm_bat_voltage	= 4000,
+	.mbat_in_gpio		= VILLE_GPIO_MBAT_IN,
+	.thermal_mitigation	= pm8921_therm_mitigation,
+	.thermal_levels		= ARRAY_SIZE(pm8921_therm_mitigation),
+	.cold_thr = PM_SMBC_BATT_TEMP_COLD_THR__HIGH,
+	.hot_thr = PM_SMBC_BATT_TEMP_HOT_THR__LOW,
+};
+
+static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
+	.priority		= 0,
+};
+
+static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
+	.r_sense		= 10,
+	.i_test			= 0, /* ori=2500 */
+	.v_failure		= 3000,
+	//	.calib_delay_ms		= 600000,
+	.max_voltage_uv		= 4200 * 1000,
+};
+
+static int __init check_dq_setup(char *str)
+{
+	if (!strcmp(str, "PASS")) {
+		pr_info("[BATT] overwrite HV battery config\n");
+                pm8921_chg_pdata.max_voltage = 4340;
+                pm8921_chg_pdata.cool_bat_voltage = 4340;
+		pm8921_bms_pdata.max_voltage_uv = 4340 * 1000;
+	} else {
+		pr_info("[BATT] use default battery config\n");
+		pm8921_chg_pdata.max_voltage = 4200;
+		pm8921_chg_pdata.cool_bat_voltage = 4200;
+		pm8921_bms_pdata.max_voltage_uv = 4200 * 1000;
+	}
+	return 1;
+}
+__setup("androidboot.dq=", check_dq_setup);
+
+static struct pm8xxx_vibrator_platform_data pm8xxx_vib_pdata = {
+	.initial_vibrate_ms = 0,
+	.max_timeout_ms = 15000,
+	.level_mV = 2500,
+};
+
+static struct pm8xxx_gpio_init green_gpios[] = {
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(VILLE_PMGPIO_GREEN_LED, 1, PM_GPIO_FUNC_2),
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(VILLE_PMGPIO_GREEN_LED, 1, PM_GPIO_FUNC_NORMAL),
+};
+
+static struct pm8xxx_gpio_init amber_gpios[] = {
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(VILLE_PMGPIO_AMBER_LED, 1, PM_GPIO_FUNC_2),
+	PM8XXX_GPIO_OUTPUT_VIN_BB_FUNC(VILLE_PMGPIO_AMBER_LED, 1, PM_GPIO_FUNC_NORMAL),
+};
+
+static void green_gpio_config(bool enable)
+{
+	if (enable)
+		pm8xxx_gpio_config(green_gpios[0].gpio, &green_gpios[0].config);
+	else
+		pm8xxx_gpio_config(green_gpios[1].gpio, &green_gpios[1].config);
+}
+
+static void amber_gpio_config(bool enable)
+{
+	if (enable)
+		pm8xxx_gpio_config(amber_gpios[0].gpio, &amber_gpios[0].config);
+	else
+		pm8xxx_gpio_config(amber_gpios[1].gpio, &amber_gpios[1].config);
+}
+
+
+static struct pm8xxx_led_configure pm8921_led_info[] = {
+	[0] = {
+		.name		= "button-backlight",
+		.flags		= PM8XXX_ID_LED_0,
+		.function_flags = LED_PWM_FUNCTION | LED_BRETH_FUNCTION,
+		.period_us 	= USEC_PER_SEC / 1000,
+		.start_index 	= 0,
+		.duites_size 	= 8,
+		.duty_time_ms 	= 64,
+		.lut_flag 	= PM_PWM_LUT_RAMP_UP | PM_PWM_LUT_PAUSE_HI_EN,
+		.out_current    = 40,
+		.duties		= {0, 9, 18, 27, 36, 45, 54, 60,
+				60, 54, 45, 36, 27, 18, 9, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0,
+				0, 0, 0, 0, 0, 0, 0, 0},
+	},
+	[1] = {
+		.name           = "green",
+		.flags		= PM8XXX_ID_GPIO24,
+		.function_flags = LED_PWM_FUNCTION | LED_BLINK_FUNCTION,
+		.gpio_status_switch = green_gpio_config,
+	},
+	[2] = {
+		.name           = "amber",
+		.flags		= PM8XXX_ID_GPIO25,
+		.function_flags = LED_PWM_FUNCTION | LED_BLINK_FUNCTION,
+		.gpio_status_switch = amber_gpio_config,
+	},
+};
+
+static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
+	.num_leds = ARRAY_SIZE(pm8921_led_info),
+	.leds = pm8921_led_info,
+};
+
+static struct pm8xxx_ccadc_platform_data pm8xxx_ccadc_pdata = {
+    .r_sense_uohm		= 10000,
+};
+
+static struct pm8xxx_adc_amux pm8xxx_adc_channels_data[] = {
+	{"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
+	{"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
+	{"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+	{"pa_therm", ADC_MPP_1_AMUX8, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
+	{"xo_therm", CHANNEL_MUXOFF, CHAN_PATH_SCALING1, AMUX_RSV0,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_XOTHERM},
+	{"mpp_amux6", ADC_MPP_1_AMUX6, CHAN_PATH_SCALING1, AMUX_RSV1,
+		ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
+};
+
+
+static struct pm8xxx_adc_properties pm8xxx_adc_data = {
+	.adc_vdd_reference	= 1800, /* milli-voltage for this adc */
+	.bitresolution		= 15,
+	.bipolar                = 0,
+};
+
+static struct pm8xxx_adc_platform_data pm8xxx_adc_pdata = {
+	.adc_channel			= pm8xxx_adc_channels_data,
+	.adc_num_board_channel		= ARRAY_SIZE(pm8xxx_adc_channels_data),
+	.adc_prop			= &pm8xxx_adc_data,
+	.adc_mpp_base			= PM8921_MPP_PM_TO_SYS(1),
+	.pm8xxx_adc_device_register	= ville_pm8xxx_adc_device_register,
+};
+
+static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
+	.irq_pdata		= &pm8xxx_irq_pdata,
+	.gpio_pdata		= &pm8xxx_gpio_pdata,
+	.mpp_pdata		= &pm8xxx_mpp_pdata,
+	.rtc_pdata              = &pm8xxx_rtc_pdata,
+	.pwrkey_pdata		= &pm8xxx_pwrkey_pdata,
+	.misc_pdata		= &pm8xxx_misc_pdata,
+	.regulator_pdatas	= msm_pm8921_regulator_pdata,
+        .charger_pdata		= &pm8921_chg_pdata,
+	.bms_pdata		= &pm8921_bms_pdata,
+	.adc_pdata		= &pm8xxx_adc_pdata,
+        .leds_pdata		= &pm8xxx_leds_pdata,
+	.ccadc_pdata		= &pm8xxx_ccadc_pdata,
+	.vibrator_pdata         = &pm8xxx_vib_pdata,
+};
+
+static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
+	.controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
+	.slave	= {
+		.name			= "pm8921-core",
+		.platform_data		= &pm8921_platform_data,
+	},
+};
+
+void __init ville_init_pmic(void)
+{
+	pmic_reset_irq = PM8921_IRQ_BASE + PM8921_RESOUT_IRQ;
+
+
+	msm8960_device_ssbi_pmic.dev.platform_data =
+				&msm8960_ssbi_pm8921_pdata;
+	pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
+}
diff --git a/arch/arm/mach-msm/htc/ville/board-ville-regulator.c b/arch/arm/mach-msm/htc/ville/board-ville-regulator.c
new file mode 100644
index 0000000..26b2165
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/board-ville-regulator.c
@@ -0,0 +1,613 @@
+/*
+ * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/regulator/pm8xxx-regulator.h>
+#include <linux/regulator/msm-gpio-regulator.h>
+#include <mach/rpm-regulator.h>
+
+#include "board-ville.h"
+
+#define VREG_CONSUMERS(_id) \
+	static struct regulator_consumer_supply vreg_consumers_##_id[]
+
+/*
+ * Consumer specific regulator names:
+ *			 regulator name		consumer dev_name
+ */
+VREG_CONSUMERS(L1) = {
+	REGULATOR_SUPPLY("8921_l1",		NULL),
+};
+VREG_CONSUMERS(L2) = {
+	REGULATOR_SUPPLY("8921_l2",		NULL),
+	REGULATOR_SUPPLY("dsi_vdda",		"mipi_dsi.1"),
+	REGULATOR_SUPPLY("dsi_pll_vdda",	"mdp.0"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.0"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.1"),
+	REGULATOR_SUPPLY("mipi_csi_vdd",	"msm_csiphy.2"),
+};
+VREG_CONSUMERS(L3) = {
+	REGULATOR_SUPPLY("8921_l3",		NULL),
+	REGULATOR_SUPPLY("HSUSB_3p3",		"msm_otg"),
+};
+VREG_CONSUMERS(L4) = {
+	REGULATOR_SUPPLY("8921_l4",		NULL),
+	REGULATOR_SUPPLY("HSUSB_1p8",		"msm_otg"),
+	REGULATOR_SUPPLY("iris_vddxo",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(L5) = {
+	REGULATOR_SUPPLY("8921_l5",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.1"),
+};
+VREG_CONSUMERS(L6) = {
+	REGULATOR_SUPPLY("8921_l6",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.3"),
+};
+VREG_CONSUMERS(L7) = {
+	REGULATOR_SUPPLY("8921_l7",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd_io",		"msm_sdcc.3"),
+};
+VREG_CONSUMERS(L8) = {
+	REGULATOR_SUPPLY("8921_l8",		NULL),
+	REGULATOR_SUPPLY("dsi_vdc",		"mipi_dsi.1"),
+};
+VREG_CONSUMERS(L9) = {
+	REGULATOR_SUPPLY("8921_l9",		NULL),
+	REGULATOR_SUPPLY("vdd",			"3-0024"),
+	REGULATOR_SUPPLY("vdd_ana",		"3-004a"),
+};
+VREG_CONSUMERS(L10) = {
+	REGULATOR_SUPPLY("8921_l10",		NULL),
+	REGULATOR_SUPPLY("iris_vddpa",		"wcnss_wlan.0"),
+
+};
+VREG_CONSUMERS(L11) = {
+	REGULATOR_SUPPLY("8921_l11",		NULL),
+	REGULATOR_SUPPLY("cam_vana",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vana",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vana",		"4-0034"),
+};
+VREG_CONSUMERS(L12) = {
+	REGULATOR_SUPPLY("8921_l12",		NULL),
+	REGULATOR_SUPPLY("cam_vdig",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vdig",		"4-0034"),
+};
+VREG_CONSUMERS(L14) = {
+	REGULATOR_SUPPLY("8921_l14",		NULL),
+	REGULATOR_SUPPLY("pa_therm",		"pm8xxx-adc"),
+};
+VREG_CONSUMERS(L15) = {
+	REGULATOR_SUPPLY("8921_l15",		NULL),
+};
+VREG_CONSUMERS(L16) = {
+	REGULATOR_SUPPLY("8921_l16",		NULL),
+	REGULATOR_SUPPLY("cam_vaf",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vaf",		"4-0034"),
+};
+VREG_CONSUMERS(L17) = {
+	REGULATOR_SUPPLY("8921_l17",		NULL),
+};
+VREG_CONSUMERS(L18) = {
+	REGULATOR_SUPPLY("8921_l18",		NULL),
+};
+VREG_CONSUMERS(L21) = {
+	REGULATOR_SUPPLY("8921_l21",		NULL),
+};
+VREG_CONSUMERS(L22) = {
+	REGULATOR_SUPPLY("8921_l22",		NULL),
+};
+VREG_CONSUMERS(L23) = {
+	REGULATOR_SUPPLY("8921_l23",		NULL),
+	REGULATOR_SUPPLY("dsi_vddio",		"mipi_dsi.1"),
+	REGULATOR_SUPPLY("dsi_pll_vddio",	"mdp.0"),
+	REGULATOR_SUPPLY("hdmi_avdd",		"hdmi_msm.0"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_riva"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_qdsp6v4.1"),
+	REGULATOR_SUPPLY("pll_vdd",		"pil_qdsp6v4.2"),
+};
+VREG_CONSUMERS(L24) = {
+	REGULATOR_SUPPLY("8921_l24",		NULL),
+	REGULATOR_SUPPLY("riva_vddmx",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(L25) = {
+	REGULATOR_SUPPLY("8921_l25",		NULL),
+	REGULATOR_SUPPLY("VDDD_CDC_D",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_A_1P2V",	"tabla-slim"),
+	REGULATOR_SUPPLY("VDDD_CDC_D",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_A_1P2V",	"tabla2x-slim"),
+};
+VREG_CONSUMERS(L26) = {
+	REGULATOR_SUPPLY("8921_l26",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.0"),
+};
+VREG_CONSUMERS(L27) = {
+	REGULATOR_SUPPLY("8921_l27",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.2"),
+};
+VREG_CONSUMERS(L28) = {
+	REGULATOR_SUPPLY("8921_l28",		NULL),
+	REGULATOR_SUPPLY("core_vdd",		"pil_qdsp6v4.1"),
+};
+VREG_CONSUMERS(L29) = {
+	REGULATOR_SUPPLY("8921_l29",		NULL),
+};
+VREG_CONSUMERS(S1) = {
+	REGULATOR_SUPPLY("8921_s1",		NULL),
+};
+VREG_CONSUMERS(S2) = {
+	REGULATOR_SUPPLY("8921_s2",		NULL),
+	REGULATOR_SUPPLY("iris_vddrfa",		"wcnss_wlan.0"),
+
+};
+VREG_CONSUMERS(S3) = {
+	REGULATOR_SUPPLY("8921_s3",		NULL),
+	REGULATOR_SUPPLY("HSUSB_VDDCX",		"msm_otg"),
+	REGULATOR_SUPPLY("riva_vddcx",		"wcnss_wlan.0"),
+	REGULATOR_SUPPLY("HSIC_VDDCX",		"msm_hsic_host"),
+};
+VREG_CONSUMERS(S4) = {
+	REGULATOR_SUPPLY("8921_s4",		NULL),
+	REGULATOR_SUPPLY("sdc_vdd_io",		"msm_sdcc.1"),
+	REGULATOR_SUPPLY("sdc_vdd",		"msm_sdcc.2"),
+	REGULATOR_SUPPLY("sdc_vdd_io",            "msm_sdcc.4"),
+	REGULATOR_SUPPLY("riva_vddpx",		"wcnss_wlan.0"),
+	REGULATOR_SUPPLY("hdmi_vcc",		"hdmi_msm.0"),
+	REGULATOR_SUPPLY("VDDIO_CDC",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDD_CP",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_TX",		"tabla-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_RX",		"tabla-slim"),
+	REGULATOR_SUPPLY("VDDIO_CDC",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDD_CP",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_TX",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("CDC_VDDA_RX",		"tabla2x-slim"),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-005b"),
+	REGULATOR_SUPPLY("EXT_HUB_VDDIO",	"msm_smsc_hub"),
+	REGULATOR_SUPPLY("vcc_i2c",		"10-0048"),
+};
+VREG_CONSUMERS(S5) = {
+	REGULATOR_SUPPLY("8921_s5",		NULL),
+	//	REGULATOR_SUPPLY("krait0",		"acpuclk-8960"),
+	REGULATOR_SUPPLY("krait0",		NULL),
+};
+VREG_CONSUMERS(S6) = {
+	REGULATOR_SUPPLY("8921_s6",		NULL),
+	//	REGULATOR_SUPPLY("krait1",		"acpuclk-8960"),
+	REGULATOR_SUPPLY("krait1",		NULL),
+};
+VREG_CONSUMERS(S7) = {
+	REGULATOR_SUPPLY("8921_s7",		NULL),
+};
+VREG_CONSUMERS(S8) = {
+	REGULATOR_SUPPLY("8921_s8",		NULL),
+};
+VREG_CONSUMERS(LVS1) = {
+	REGULATOR_SUPPLY("8921_lvs1",		NULL),
+	REGULATOR_SUPPLY("iris_vddio",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(LVS2) = {
+	REGULATOR_SUPPLY("8921_lvs2",		NULL),
+	REGULATOR_SUPPLY("iris_vdddig",		"wcnss_wlan.0"),
+};
+VREG_CONSUMERS(LVS3) = {
+	REGULATOR_SUPPLY("8921_lvs3",		NULL),
+};
+VREG_CONSUMERS(LVS4) = {
+	REGULATOR_SUPPLY("8921_lvs4",		NULL),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-0024"),
+	REGULATOR_SUPPLY("vcc_i2c",		"3-004a"),
+};
+VREG_CONSUMERS(LVS5) = {
+	REGULATOR_SUPPLY("8921_lvs5",		NULL),
+	REGULATOR_SUPPLY("cam_vio",		"4-001a"),
+	REGULATOR_SUPPLY("cam_vio",		"4-006c"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0048"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0020"),
+	REGULATOR_SUPPLY("cam_vio",		"4-0034"),
+};
+VREG_CONSUMERS(LVS6) = {
+	REGULATOR_SUPPLY("8921_lvs6",		NULL),
+	REGULATOR_SUPPLY("vdd_io",		"spi0.0"),
+};
+VREG_CONSUMERS(LVS7) = {
+	REGULATOR_SUPPLY("8921_lvs7",		NULL),
+};
+VREG_CONSUMERS(USB_OTG) = {
+	REGULATOR_SUPPLY("8921_usb_otg",	NULL),
+	REGULATOR_SUPPLY("vbus_otg",		"msm_otg"),
+};
+VREG_CONSUMERS(HDMI_MVS) = {
+	REGULATOR_SUPPLY("8921_hdmi_mvs",	NULL),
+	REGULATOR_SUPPLY("hdmi_mvs",		"hdmi_msm.0"),
+};
+VREG_CONSUMERS(NCP) = {
+	REGULATOR_SUPPLY("8921_ncp",		NULL),
+};
+VREG_CONSUMERS(EXT_5V) = {
+	REGULATOR_SUPPLY("ext_5v",		NULL),
+};
+VREG_CONSUMERS(EXT_L2) = {
+	REGULATOR_SUPPLY("ext_l2",		NULL),
+	REGULATOR_SUPPLY("vdd_phy",		"spi0.0"),
+};
+VREG_CONSUMERS(EXT_3P3V) = {
+	REGULATOR_SUPPLY("ext_3p3v",		NULL),
+	REGULATOR_SUPPLY("vdd_ana",		"3-005b"),
+	REGULATOR_SUPPLY("vdd_lvds_3p3v",	"mipi_dsi.1"),
+	REGULATOR_SUPPLY("mhl_usb_hs_switch",	"msm_otg"),
+};
+VREG_CONSUMERS(EXT_OTG_SW) = {
+	REGULATOR_SUPPLY("ext_otg_sw",		NULL),
+	REGULATOR_SUPPLY("vbus_otg",		"msm_otg"),
+};
+
+#define PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, _modes, _ops, \
+			 _apply_uV, _pull_down, _always_on, _supply_regulator, \
+			 _system_uA, _enable_time, _reg_id) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_modes_mask	= _modes, \
+				.valid_ops_mask		= _ops, \
+				.min_uV			= _min_uV, \
+				.max_uV			= _max_uV, \
+				.input_uV		= _max_uV, \
+				.apply_uV		= _apply_uV, \
+				.always_on		= _always_on, \
+				.name			= _name, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id			= _reg_id, \
+		.pull_down_enable	= _pull_down, \
+		.system_uA		= _system_uA, \
+		.enable_time		= _enable_time, \
+	}
+
+#define PM8XXX_LDO(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_NLDO1200(_id, _name, _always_on, _pull_down, _min_uV, \
+		_max_uV, _enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_SMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		| REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE | \
+		REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE | \
+		REGULATOR_CHANGE_DRMS, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_FTSMPS(_id, _name, _always_on, _pull_down, _min_uV, _max_uV, \
+		_enable_time, _supply_regulator, _system_uA, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, REGULATOR_MODE_NORMAL, \
+		REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS \
+		| REGULATOR_CHANGE_MODE, 0, _pull_down, _always_on, \
+		_supply_regulator, _system_uA, _enable_time, _reg_id)
+
+#define PM8XXX_VS(_id, _name, _always_on, _pull_down, _enable_time, \
+		_supply_regulator, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
+		_pull_down, _always_on, _supply_regulator, 0, _enable_time, \
+		_reg_id)
+
+#define PM8XXX_VS300(_id, _name, _always_on, _pull_down, _enable_time, \
+		_supply_regulator, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, \
+		_pull_down, _always_on, _supply_regulator, 0, _enable_time, \
+		_reg_id)
+
+#define PM8XXX_NCP(_id, _name, _always_on, _min_uV, _max_uV, _enable_time, \
+		_supply_regulator, _reg_id) \
+	PM8XXX_VREG_INIT(_id, _name, _min_uV, _max_uV, 0, \
+		REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, 0, 0, \
+		_always_on, _supply_regulator, 0, _enable_time, _reg_id)
+
+/* Pin control initialization */
+#define PM8XXX_PC(_id, _name, _always_on, _pin_fn, _pin_ctrl, \
+		  _supply_regulator, _reg_id) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+				.always_on	= _always_on, \
+				.name		= _name, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id##_PC), \
+			.consumer_supplies	= vreg_consumers_##_id##_PC, \
+			.supply_regulator  = _supply_regulator, \
+		}, \
+		.id		= _reg_id, \
+		.pin_fn		= PM8XXX_VREG_PIN_FN_##_pin_fn, \
+		.pin_ctrl	= _pin_ctrl, \
+	}
+
+#define GPIO_VREG(_id, _reg_name, _gpio_label, _gpio, _supply_regulator) \
+	[GPIO_VREG_ID_##_id] = { \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.regulator_name = _reg_name, \
+		.gpio_label	= _gpio_label, \
+		.gpio		= _gpio, \
+	}
+
+#define SAW_VREG_INIT(_id, _name, _min_uV, _max_uV) \
+	{ \
+		.constraints = { \
+			.name		= _name, \
+			.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE, \
+			.min_uV		= _min_uV, \
+			.max_uV		= _max_uV, \
+		}, \
+		.num_consumer_supplies	= ARRAY_SIZE(vreg_consumers_##_id), \
+		.consumer_supplies	= vreg_consumers_##_id, \
+	}
+
+#define RPM_INIT(_id, _min_uV, _max_uV, _modes, _ops, _apply_uV, _default_uV, \
+		 _peak_uA, _avg_uA, _pull_down, _pin_ctrl, _freq, _pin_fn, \
+		 _force_mode, _sleep_set_force_mode, _power_mode, _state, \
+		 _sleep_selectable, _always_on, _supply_regulator, _system_uA) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_modes_mask	= _modes, \
+				.valid_ops_mask		= _ops, \
+				.min_uV			= _min_uV, \
+				.max_uV			= _max_uV, \
+				.input_uV		= _min_uV, \
+				.apply_uV		= _apply_uV, \
+				.always_on		= _always_on, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id), \
+			.consumer_supplies	= vreg_consumers_##_id, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id			= RPM_VREG_ID_PM8921_##_id, \
+		.default_uV		= _default_uV, \
+		.peak_uA		= _peak_uA, \
+		.avg_uA			= _avg_uA, \
+		.pull_down_enable	= _pull_down, \
+		.pin_ctrl		= _pin_ctrl, \
+		.freq			= RPM_VREG_FREQ_##_freq, \
+		.pin_fn			= _pin_fn, \
+		.force_mode		= _force_mode, \
+		.sleep_set_force_mode	= _sleep_set_force_mode, \
+		.power_mode		= _power_mode, \
+		.state			= _state, \
+		.sleep_selectable	= _sleep_selectable, \
+		.system_uA		= _system_uA, \
+	}
+
+#define RPM_LDO(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
+		_supply_regulator, _system_uA, _init_peak_uA) \
+	RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
+		 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _init_peak_uA, 0, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, _system_uA)
+
+#define RPM_SMPS(_id, _always_on, _pd, _sleep_selectable, _min_uV, _max_uV, \
+		 _supply_regulator, _system_uA, _freq, _force_mode, \
+		 _sleep_set_force_mode) \
+	RPM_INIT(_id, _min_uV, _max_uV, REGULATOR_MODE_NORMAL \
+		 | REGULATOR_MODE_IDLE, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE \
+		 | REGULATOR_CHANGE_DRMS, 0, _max_uV, _system_uA, 0, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_##_force_mode, \
+		 RPM_VREG_FORCE_MODE_8960_##_sleep_set_force_mode, \
+		 RPM_VREG_POWER_MODE_8960_PWM, RPM_VREG_STATE_OFF, \
+		 _sleep_selectable, _always_on, _supply_regulator, _system_uA)
+
+#define RPM_VS(_id, _always_on, _pd, _sleep_selectable, _supply_regulator) \
+	RPM_INIT(_id, 0, 0, 0, REGULATOR_CHANGE_STATUS, 0, 0, 1000, 1000, _pd, \
+		 RPM_VREG_PIN_CTRL_NONE, NONE, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, 0)
+
+#define RPM_NCP(_id, _always_on, _sleep_selectable, _min_uV, _max_uV, \
+		_supply_regulator, _freq) \
+	RPM_INIT(_id, _min_uV, _max_uV, 0, REGULATOR_CHANGE_VOLTAGE \
+		 | REGULATOR_CHANGE_STATUS, 0, _max_uV, 1000, 1000, 0, \
+		 RPM_VREG_PIN_CTRL_NONE, _freq, RPM_VREG_PIN_FN_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, \
+		 RPM_VREG_FORCE_MODE_8960_NONE, RPM_VREG_POWER_MODE_8960_PWM, \
+		 RPM_VREG_STATE_OFF, _sleep_selectable, _always_on, \
+		 _supply_regulator, 0)
+
+/* Pin control initialization */
+#define RPM_PC_INIT(_id, _always_on, _pin_fn, _pin_ctrl, _supply_regulator) \
+	{ \
+		.init_data = { \
+			.constraints = { \
+				.valid_ops_mask	= REGULATOR_CHANGE_STATUS, \
+				.always_on	= _always_on, \
+			}, \
+			.num_consumer_supplies	= \
+					ARRAY_SIZE(vreg_consumers_##_id##_PC), \
+			.consumer_supplies	= vreg_consumers_##_id##_PC, \
+			.supply_regulator	= _supply_regulator, \
+		}, \
+		.id	  = RPM_VREG_ID_PM8921_##_id##_PC, \
+		.pin_fn	  = RPM_VREG_PIN_FN_8960_##_pin_fn, \
+		.pin_ctrl = _pin_ctrl, \
+	}
+
+/* GPIO regulator constraints */
+struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] __devinitdata = {
+	GPIO_VREG(EXT_5V, "ext_5v", "ext_5v_en", PM8921_MPP_PM_TO_SYS(7), NULL),
+	GPIO_VREG(EXT_L2, "ext_l2", "ext_l2_en", 91, NULL),
+	GPIO_VREG(EXT_3P3V, "ext_3p3v", "ext_3p3v_en",
+		PM8921_GPIO_PM_TO_SYS(17), NULL),
+	GPIO_VREG(EXT_OTG_SW, "ext_otg_sw", "ext_otg_sw_en",
+		PM8921_GPIO_PM_TO_SYS(42), "8921_usb_otg"),
+};
+
+/* SAW regulator constraints */
+struct regulator_init_data msm_saw_regulator_pdata_s5 =
+	/*	      ID  vreg_name	       min_uV   max_uV */
+	SAW_VREG_INIT(S5, "8921_s5",	       850000, 1300000);
+struct regulator_init_data msm_saw_regulator_pdata_s6 =
+	SAW_VREG_INIT(S6, "8921_s6",	       850000, 1300000);
+
+/* PM8921 regulator constraints */
+struct pm8xxx_regulator_platform_data
+msm_pm8921_regulator_pdata[] __devinitdata = {
+	/*
+	 *		ID   name always_on pd min_uV   max_uV   en_t supply
+	 *	system_uA reg_ID
+	 */
+	PM8XXX_NLDO1200(L26, "8921_l26", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 1),
+	PM8XXX_NLDO1200(L27, "8921_l27", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 2),
+	PM8XXX_NLDO1200(L28, "8921_l28", 0, 1, 375000, 1050000, 200, "8921_s7",
+		0, 3),
+	PM8XXX_LDO(L29,      "8921_l29", 0, 1, 1800000, 1800000, 200, "8921_s8",
+		0, 4),
+
+	/*	     ID        name      always_on pd en_t supply    reg_ID */
+	PM8XXX_VS300(USB_OTG,  "8921_usb_otg",  0, 0, 0,   "ext_5v", 5),
+	PM8XXX_VS300(HDMI_MVS, "8921_hdmi_mvs", 0, 1, 0,   "ext_5v", 6),
+};
+
+static struct rpm_regulator_init_data
+msm_rpm_regulator_init_data[] __devinitdata = {
+	RPM_SMPS(S1, 1, 1, 0, 1225000, 1225000, NULL, 100000, 3p20, NONE, NONE),
+	RPM_SMPS(S2, 0, 1, 0, 1300000, 1300000, NULL,      0, 1p60, NONE, NONE),
+	RPM_SMPS(S3, 0, 1, 1,  500000, 1150000, NULL, 100000, 4p80, NONE, NONE),
+	RPM_SMPS(S4, 1, 1, 0, 1800000, 1800000, NULL, 100000, 3p20, AUTO, AUTO),
+	RPM_SMPS(S7, 0, 1, 0, 1150000, 1150000, NULL, 100000, 3p20, NONE, NONE),
+	RPM_SMPS(S8, 1, 1, 1, 2050000, 2050000, NULL, 100000, 1p60, NONE, NONE),
+
+	
+	RPM_LDO(L1,	 1, 1, 0, 1050000, 1050000, "8921_s4", 0, 10000),
+	RPM_LDO(L2,	 0, 1, 0, 1200000, 1200000, "8921_s4", 0, 0),
+	RPM_LDO(L3,	 0, 1, 0, 3075000, 3075000, NULL,      0, 0),
+	RPM_LDO(L4,	 1, 1, 0, 1800000, 1800000, NULL,      10000, 10000),
+	RPM_LDO(L5,	 0, 1, 0, 2950000, 2950000, NULL,      0, 0),
+	RPM_LDO(L6,	 0, 1, 0, 2850000, 2950000, NULL,      0, 0),
+	RPM_LDO(L7,	 1, 1, 0, 1850000, 2950000, NULL,      10000, 10000),
+	RPM_LDO(L8,	 0, 1, 0, 2800000, 2800000, NULL,      0, 0),
+	RPM_LDO(L9,	 0, 1, 0, 2800000, 2800000, NULL,      0, 0),
+	RPM_LDO(L10,	 0, 1, 0, 3000000, 3000000, NULL,      0, 0),
+	RPM_LDO(L11,	 0, 1, 0, 3000000, 3200000, NULL,      0, 0), 
+	RPM_LDO(L12,	 0, 1, 0, 1200000, 1500000, "8921_s4", 0, 0), 
+	RPM_LDO(L14,	 0, 1, 0, 1800000, 1800000, NULL,      0, 0),
+	RPM_LDO(L15,	 0, 1, 0, 1800000, 2950000, NULL,      0, 0),
+	RPM_LDO(L16,	 0, 1, 0, 2850000, 3300000, NULL,      0, 0), 
+	RPM_LDO(L17,	 0, 1, 0, 2850000, 2850000, NULL,      0, 0),
+	RPM_LDO(L18,	 0, 1, 0, 1300000, 1300000, "8921_s4", 0, 0),
+	RPM_LDO(L21,	 0, 1, 0, 1900000, 1900000, "8921_s8", 0, 0),
+	RPM_LDO(L22,	 0, 1, 0, 2800000, 2800000, NULL,      0, 0),
+	RPM_LDO(L23,	 1, 1, 1, 1800000, 1800000, "8921_s8", 10000, 10000),
+	RPM_LDO(L24,	 0, 1, 1,  750000, 1150000, "8921_s1", 10000, 10000),
+	RPM_LDO(L25,	 1, 1, 0, 1225000, 1225000, "8921_s1", 10000, 10000),
+
+	
+	RPM_VS(LVS1,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS2,	 0, 1, 0,		    "8921_s1"),
+	RPM_VS(LVS3,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS4,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS5,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS6,	 0, 1, 0,		    "8921_s4"),
+	RPM_VS(LVS7,	 0, 1, 0,		    "8921_s4"),
+
+	
+	RPM_NCP(NCP,	 0,    0, 1800000, 1800000, "8921_l6",    1p60),
+};
+
+int msm_pm8921_regulator_pdata_len __devinitdata =
+	ARRAY_SIZE(msm_pm8921_regulator_pdata);
+
+#define RPM_REG_MAP(_id, _sleep_also, _voter, _supply, _dev_name) \
+	{ \
+		.vreg_id = RPM_VREG_ID_PM8921_##_id, \
+		.sleep_also = _sleep_also, \
+		.voter = _voter, \
+		.supply = _supply, \
+		.dev_name = _dev_name, \
+	}
+static struct rpm_regulator_consumer_mapping
+	      msm_rpm_regulator_consumer_mapping[] __devinitdata = {
+	RPM_REG_MAP(L23, 0, 1, "krait0_l23", "acpuclk-8960"),
+	RPM_REG_MAP(L23, 0, 2, "krait1_l23", "acpuclk-8960"),
+	RPM_REG_MAP(L23, 0, 6, "l2_l23",     "acpuclk-8960"),
+	RPM_REG_MAP(L24, 0, 1, "krait0_mem", "acpuclk-8960"),
+	RPM_REG_MAP(L24, 0, 2, "krait1_mem", "acpuclk-8960"),
+	RPM_REG_MAP(S3,  0, 1, "krait0_dig", "acpuclk-8960"),
+	RPM_REG_MAP(S3,  0, 2, "krait1_dig", "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 1, "krait0_s8",  "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 2, "krait1_s8",  "acpuclk-8960"),
+	RPM_REG_MAP(S8,  0, 6, "l2_s8",      "acpuclk-8960"),
+};
+
+struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
+	.name	= GPIO_REGULATOR_DEV_NAME,
+	.id	= PM8921_MPP_PM_TO_SYS(7),
+	.dev	= {
+		.platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
+	},
+};
+
+struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
+	.name	= GPIO_REGULATOR_DEV_NAME,
+	.id	= 91,
+	.dev	= {
+		.platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
+	},
+};
+
+struct rpm_regulator_platform_data ville_rpm_regulator_pdata __devinitdata = {
+	.init_data		= msm_rpm_regulator_init_data,
+	.num_regulators		= ARRAY_SIZE(msm_rpm_regulator_init_data),
+	.version		= RPM_VREG_VERSION_8960,
+	.vreg_id_vdd_mem	= RPM_VREG_ID_PM8921_L24,
+	.vreg_id_vdd_dig	= RPM_VREG_ID_PM8921_S3,
+	.consumer_map		= msm_rpm_regulator_consumer_mapping,
+	.consumer_map_len = ARRAY_SIZE(msm_rpm_regulator_consumer_mapping),
+};
diff --git a/arch/arm/mach-msm/htc/ville/board-ville-storage.c b/arch/arm/mach-msm/htc/ville/board-ville-storage.c
new file mode 100644
index 0000000..ce365b0
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/board-ville-storage.c
@@ -0,0 +1,334 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/platform_device.h>
+#include <linux/bootmem.h>
+#include <linux/gpio.h>
+#include <asm/mach-types.h>
+#include <asm/mach/mmc.h>
+#include <mach/board.h>
+#include <mach/gpiomux.h>
+#include "devices.h"
+#include "board-8960.h"
+#include "board-storage-common-a.h"
+
+enum sdcc_controllers {
+	SDCC1,
+	SDCC2,
+	SDCC3,
+	SDCC4,
+	SDCC5,
+	MAX_SDCC_CONTROLLER
+};
+
+static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
+	
+	[SDCC1] = {
+		.name = "sdc_vdd",
+		.high_vol_level = 2950000,
+		.low_vol_level = 2950000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		.lpm_uA = 9000,
+		.hpm_uA = 200000, 
+	},
+	
+	[SDCC3] = {
+		.name = "sdc_vdd",
+		.high_vol_level = 2950000,
+		.low_vol_level = 2950000,
+		.hpm_uA = 600000, 
+	}
+};
+
+static struct msm_mmc_reg_data mmc_vdd_io_reg_data[MAX_SDCC_CONTROLLER] = {
+	
+	[SDCC1] = {
+		.name = "sdc_vdd_io",
+		.always_on = 1,
+		.high_vol_level = 1800000,
+		.low_vol_level = 1800000,
+		.hpm_uA = 200000, 
+	},
+	
+	[SDCC3] = {
+		.name = "sdc_vdd_io",
+		.high_vol_level = 2950000,
+		.low_vol_level = 1850000,
+		.always_on = 1,
+		.lpm_sup = 1,
+		
+		.hpm_uA = 16000,
+		.lpm_uA = 2000,
+	}
+};
+
+static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
+	
+	[SDCC1] = {
+		.vdd_data = &mmc_vdd_reg_data[SDCC1],
+		.vdd_io_data = &mmc_vdd_io_reg_data[SDCC1],
+	},
+	
+	[SDCC3] = {
+		.vdd_data = &mmc_vdd_reg_data[SDCC3],
+		.vdd_io_data = &mmc_vdd_io_reg_data[SDCC3]
+	}
+};
+
+static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
+	{TLMM_HDRV_SDC1_CLK, GPIO_CFG_10MA},
+	{TLMM_HDRV_SDC1_CMD, GPIO_CFG_6MA},
+	{TLMM_HDRV_SDC1_DATA, GPIO_CFG_8MA}
+};
+
+static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
+	{TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
+};
+
+static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
+	{TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
+	{TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
+	{TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
+	{TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
+	{TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
+};
+
+static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
+	{TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
+	{TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
+};
+
+static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
+	{TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
+	{TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
+	{TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
+	{TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
+};
+
+static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.on = sdc1_pad_pull_on_cfg,
+		.off = sdc1_pad_pull_off_cfg,
+		.size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
+	},
+	[SDCC3] = {
+		.on = sdc3_pad_pull_on_cfg,
+		.off = sdc3_pad_pull_off_cfg,
+		.size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
+	},
+};
+
+static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.on = sdc1_pad_drv_on_cfg,
+		.off = sdc1_pad_drv_off_cfg,
+		.size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
+	},
+	[SDCC3] = {
+		.on = sdc3_pad_drv_on_cfg,
+		.off = sdc3_pad_drv_off_cfg,
+		.size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
+	},
+};
+
+struct msm_mmc_gpio sdc2_gpio[] = {
+	{92, "sdc2_dat_3"},
+	{91, "sdc2_dat_2"},
+	{90, "sdc2_dat_1"},
+	{89, "sdc2_dat_0"},
+	{97, "sdc2_cmd"},
+	{98, "sdc2_clk"}
+};
+
+struct msm_mmc_gpio sdc4_gpio[] = {
+	{83, "sdc4_dat_3"},
+	{84, "sdc4_dat_2"},
+	{85, "sdc4_dat_1"},
+	{86, "sdc4_dat_0"},
+	{87, "sdc4_cmd"},
+	{88, "sdc4_clk"}
+};
+
+struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC2] = {
+		.gpio = sdc2_gpio,
+		.size = ARRAY_SIZE(sdc2_gpio),
+	},
+	[SDCC4] = {
+		.gpio = sdc4_gpio,
+		.size = ARRAY_SIZE(sdc4_gpio),
+	},
+};
+
+static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.pull = &mmc_pad_pull_data[SDCC1],
+		.drv = &mmc_pad_drv_data[SDCC1]
+	},
+	[SDCC3] = {
+		.pull = &mmc_pad_pull_data[SDCC3],
+		.drv = &mmc_pad_drv_data[SDCC3]
+	},
+};
+
+static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
+	[SDCC1] = {
+		.pad_data = &mmc_pad_data[SDCC1],
+	},
+	[SDCC2] = {
+		.is_gpio = 1,
+		.gpio_data = &mmc_gpio_data[SDCC2],
+	},
+	[SDCC3] = {
+		.pad_data = &mmc_pad_data[SDCC3],
+	},
+	[SDCC4] = {
+		.is_gpio = 1,
+		.gpio_data = &mmc_gpio_data[SDCC4],
+	},
+};
+
+#define MSM_MPM_PIN_SDC1_DAT1	17
+#define MSM_MPM_PIN_SDC3_DAT1	21
+
+static unsigned int sdc1_sup_clk_rates[] = {
+	400000, 24000000, 48000000, 96000000
+};
+
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+static unsigned int sdc3_sup_clk_rates[] = {
+	400000, 24000000, 48000000, 96000000, 192000000
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
+static struct mmc_platform_data msm8960_sdc1_data = {
+	.ocr_mask       = MMC_VDD_27_28 | MMC_VDD_28_29,
+#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
+	.mmc_bus_width  = MMC_CAP_8_BIT_DATA,
+#else
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+#endif
+	.sup_clk_table	= sdc1_sup_clk_rates,
+	.sup_clk_cnt	= ARRAY_SIZE(sdc1_sup_clk_rates),
+	.nonremovable	= 1,
+	.vreg_data	= &mmc_slot_vreg_data[SDCC1],
+	.pin_data	= &mmc_slot_pin_data[SDCC1],
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+	.uhs_caps	= MMC_CAP_1_8V_DDR | MMC_CAP_UHS_DDR50,
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
+static unsigned int sdc2_sup_clk_rates[] = {
+	400000, 24000000, 48000000
+};
+
+static struct mmc_platform_data msm8960_sdc2_data = {
+	.ocr_mask       = MMC_VDD_165_195,
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+	.sup_clk_table  = sdc2_sup_clk_rates,
+	.sup_clk_cnt    = ARRAY_SIZE(sdc2_sup_clk_rates),
+	.pclk_src_dfab  = 1,
+	.vreg_data      = &mmc_slot_vreg_data[SDCC2],
+	.pin_data       = &mmc_slot_pin_data[SDCC2],
+	.sdiowakeup_irq = MSM_GPIO_TO_INT(90),
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+static struct mmc_platform_data msm8960_sdc3_data = {
+	.ocr_mask       = MMC_VDD_27_28 | MMC_VDD_28_29,
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+	.sup_clk_table	= sdc3_sup_clk_rates,
+	.sup_clk_cnt	= ARRAY_SIZE(sdc3_sup_clk_rates),
+	.pclk_src_dfab	= 1,
+#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
+	.wpswitch_gpio	= PM8921_GPIO_PM_TO_SYS(16),
+#endif
+	.vreg_data	= &mmc_slot_vreg_data[SDCC3],
+	.pin_data	= &mmc_slot_pin_data[SDCC3],
+#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
+	.status_gpio	= PM8921_GPIO_PM_TO_SYS(26),
+	.status_irq	= PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
+	.irq_flags	= IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+	.is_status_gpio_active_low = true,
+#endif
+	.xpc_cap	= 1,
+	.uhs_caps	= (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
+			MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
+			MMC_CAP_UHS_SDR104 | MMC_CAP_MAX_CURRENT_600),
+	.mpm_sdiowakeup_int = MSM_MPM_PIN_SDC3_DAT1,
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+};
+#endif
+
+#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
+static unsigned int sdc4_sup_clk_rates[] = {
+	400000, 24000000, 48000000
+};
+
+static struct mmc_platform_data msm8960_sdc4_data = {
+	.ocr_mask       = MMC_VDD_165_195,
+	.mmc_bus_width  = MMC_CAP_4_BIT_DATA,
+	.sup_clk_table  = sdc4_sup_clk_rates,
+	.sup_clk_cnt    = ARRAY_SIZE(sdc4_sup_clk_rates),
+	.pclk_src_dfab  = 1,
+	.vreg_data      = &mmc_slot_vreg_data[SDCC4],
+	.pin_data       = &mmc_slot_pin_data[SDCC4],
+	.sdiowakeup_irq = MSM_GPIO_TO_INT(85),
+	.msm_bus_voting_data = &sps_to_ddr_bus_voting_data,
+};
+#endif
+
+void __init ville_init_mmc(void)
+{
+#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
+	
+	msm_add_sdcc(1, &msm8960_sdc1_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
+	
+	msm_add_sdcc(2, &msm8960_sdc2_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
+	
+	msm_add_sdcc(3, &msm8960_sdc3_data);
+#endif
+#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
+	
+	msm_add_sdcc(4, &msm8960_sdc4_data);
+#endif
+}
diff --git a/arch/arm/mach-msm/htc/ville/board-ville.c b/arch/arm/mach-msm/htc/ville/board-ville.c
new file mode 100644
index 0000000..5cdc670
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/board-ville.c
@@ -0,0 +1,3590 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/i2c.h>
+#include <linux/i2c/sx150x.h>
+#include <linux/gpio.h>
+#include <linux/usb/msm_hsusb.h>
+#include <linux/usb/android.h>
+#include <linux/msm_ssbi.h>
+#include <linux/regulator/msm-gpio-regulator.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/regulator/consumer.h>
+#include <linux/spi/spi.h>
+#include <linux/slimbus/slimbus.h>
+#ifdef CONFIG_ANDROID_PMEM
+#include <linux/android_pmem.h>
+#endif
+#include <linux/atmel_qt602240.h>
+#include <linux/input/cy8c_cs.h>
+#include <linux/dma-contiguous.h>
+#include <linux/dma-mapping.h>
+#include <linux/platform_data/qcom_crypto_device.h>
+#include <linux/platform_data/qcom_wcnss_device.h>
+#include <linux/leds.h>
+#include <linux/leds-pm8xxx-htc.h>
+#include <linux/msm_tsens.h>
+#include <linux/proc_fs.h>
+#include <linux/cm3629.h>
+#include <linux/memblock.h>
+#include <linux/msm_thermal.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/setup.h>
+#include <asm/hardware/gic.h>
+#include <asm/mach/mmc.h>
+
+#include <mach/board.h>
+#include <mach/msm_iomap.h>
+#include <mach/msm_spi.h>
+#ifdef CONFIG_USB_MSM_OTG_72K
+#include <mach/msm_hsusb.h>
+#else
+#include <linux/usb/msm_hsusb.h>
+#endif
+#include <mach/htc_restart_handler.h>
+#include <mach/usbdiag.h>
+#include <mach/socinfo.h>
+#include <mach/rpm.h>
+#include <mach/gpio.h>
+#include <mach/msm_bus_board.h>
+#include <mach/msm_memtypes.h>
+#include <mach/dma.h>
+#include <mach/msm_dsps.h>
+#include <mach/msm_xo.h>
+#include <mach/restart.h>
+#include <mach/panel_id.h>
+#ifdef CONFIG_WCD9310_CODEC
+#include <linux/slimbus/slimbus.h>
+#include <linux/mfd/wcd9xxx/core.h>
+#include <linux/mfd/wcd9xxx/pdata.h>
+#endif
+#include <linux/msm_ion.h>
+#include <mach/ion.h>
+
+#include <mach/msm_rtb.h>
+#include <mach/msm_cache_dump.h>
+#include <mach/scm.h>
+#include <mach/iommu_domains.h>
+
+#include <mach/kgsl.h>
+#include <linux/fmem.h>
+
+#include <linux/akm8975.h>
+#include <linux/bma250.h>
+#include <linux/ewtzmu2.h>
+#ifdef CONFIG_BT
+#include <mach/htc_bdaddress.h>
+#endif
+#include <mach/htc_headset_mgr.h>
+#include <mach/htc_headset_pmic.h>
+#include <mach/cable_detect.h>
+
+#include "timer.h"
+#include "devices.h"
+#include "devices-msm8x60.h"
+#include "spm.h"
+#include "board-ville.h"
+#include "pm.h"
+#include <mach/cpuidle.h>
+#include "rpm_resources.h"
+#include <mach/mpm.h>
+#include "acpuclock.h"
+#include "rpm_log.h"
+#include "smd_private.h"
+#include "pm-boot.h"
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+#include <mach/mhl.h>
+#endif
+
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#include <linux/htc_flashlight.h>
+#endif
+#include <mach/board_htc.h>
+#ifdef CONFIG_HTC_BATT_8960
+#include "mach/htc_battery_8960.h"
+#include "mach/htc_battery_cell.h"
+#include "linux/mfd/pm8xxx/pm8921-charger-htc.h"
+#endif
+
+#ifdef CONFIG_PERFLOCK
+#include <mach/perflock.h>
+#endif
+
+extern unsigned int engineerid; // bit 0
+
+#define HW_VER_ID_VIRT		(MSM_TLMM_BASE + 0x00002054)
+
+unsigned skuid;
+#ifdef CONFIG_MSM_CAMERA_FLASH
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+static void config_flashlight_gpios(void)
+{
+	static uint32_t flashlight_gpio_table[] = {
+		GPIO_CFG(32, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+		GPIO_CFG(33, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	};
+
+	gpio_tlmm_config(flashlight_gpio_table[0], GPIO_CFG_ENABLE);
+	gpio_tlmm_config(flashlight_gpio_table[1], GPIO_CFG_ENABLE);
+}
+
+static struct TPS61310_flashlight_platform_data ville_flashlight_data = {
+	.gpio_init = config_flashlight_gpios,
+	.tps61310_strb0 = 33,
+	.tps61310_strb1 = 32,
+	.led_count = 1,
+	.flash_duration_ms = 600,
+};
+
+static struct i2c_board_info i2c_tps61310_flashlight[] = {
+	{
+		I2C_BOARD_INFO("TPS61310_FLASHLIGHT", 0x66 >> 1),
+		.platform_data = &ville_flashlight_data,
+	},
+};
+#endif
+#endif
+
+static struct platform_device msm_fm_platform_init = {
+	.name = "iris_fm",
+	.id   = -1,
+};
+
+#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
+enum {
+	GPIO_EXPANDER_IRQ_BASE = (PM8921_IRQ_BASE + PM8921_NR_IRQS),
+	GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
+	/* CAM Expander */
+	GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
+	GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
+	GPIO_CAM_GP_AFBUSY,
+	GPIO_CAM_GP_STROBE_CE,
+	GPIO_CAM_GP_CAM1MP_XCLR,
+	GPIO_CAM_GP_CAMIF_RESET_N,
+	GPIO_CAM_GP_XMT_FLASH_INT,
+	GPIO_CAM_GP_LED_EN1,
+	GPIO_CAM_GP_LED_EN2,
+
+};
+#endif
+
+#ifdef CONFIG_I2C
+
+#define MSM_8960_GSBI5_QUP_I2C_BUS_ID 5
+#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
+#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
+#define MSM_8960_GSBI8_QUP_I2C_BUS_ID 8
+#define MSM_8960_GSBI12_QUP_I2C_BUS_ID 12
+
+#endif
+
+#define MSM_PMEM_ADSP_SIZE         0x6D00000
+#define MSM_PMEM_AUDIO_SIZE        0x4CF000
+#define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */
+#define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */
+#define MSM_HDMI_PRIM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
+
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+#define HOLE_SIZE	0x20000
+#define MSM_CONTIG_MEM_SIZE  0x65000
+#ifdef CONFIG_MSM_IOMMU
+#define MSM_ION_MM_SIZE            0x3800000 /* Need to be multiple of 64K */
+#define MSM_ION_SF_SIZE            0x0
+#define MSM_ION_QSECOM_SIZE        0x780000 /* (7.5MB) */
+#define MSM_ION_HEAP_NUM	7
+#else
+#define MSM_ION_MM_SIZE            MSM_PMEM_ADSP_SIZE
+#define MSM_ION_SF_SIZE            MSM_PMEM_SIZE
+#define MSM_ION_QSECOM_SIZE        0x600000 /* (6MB) */
+#define MSM_ION_HEAP_NUM	8
+#endif
+#define MSM_ION_MM_FW_SIZE	(0x200000 - HOLE_SIZE) /* 128kb */
+#define MSM_ION_MFC_SIZE	SZ_8K
+#define MSM_ION_AUDIO_SIZE	MSM_PMEM_AUDIO_SIZE
+
+#define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000)
+#define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE
+#define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE
+
+#define MSM_MM_FW_SIZE		(0x200000 - HOLE_SIZE) /* 2mb -128kb*/
+#define MSM8960_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
+							HOLE_SIZE))
+#define MAX_FIXED_AREA_SIZE	0x10000000
+#define MSM8960_FW_START	MSM8960_FIXED_AREA_START
+#define MSM_ION_ADSP_SIZE	SZ_8M
+#else
+#define MSM_CONTIG_MEM_SIZE  0x110C000
+#define MSM_ION_HEAP_NUM	1
+#endif
+
+static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
+#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
+static int __init msm_contig_mem_size_setup(char *p)
+{
+	msm_contig_mem_size = memparse(p, NULL);
+	return 0;
+}
+early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
+#endif
+
+#ifdef CONFIG_ANDROID_PMEM
+static unsigned pmem_size = MSM_PMEM_SIZE;
+static unsigned pmem_param_set;
+static int __init pmem_size_setup(char *p)
+{
+	pmem_size = memparse(p, NULL);
+	pmem_param_set = 1;
+	return 0;
+}
+early_param("pmem_size", pmem_size_setup);
+
+static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
+
+static int __init pmem_adsp_size_setup(char *p)
+{
+	pmem_adsp_size = memparse(p, NULL);
+	return 0;
+}
+early_param("pmem_adsp_size", pmem_adsp_size_setup);
+
+static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
+
+static int __init pmem_audio_size_setup(char *p)
+{
+	pmem_audio_size = memparse(p, NULL);
+	return 0;
+}
+early_param("pmem_audio_size", pmem_audio_size_setup);
+#endif
+
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+static struct android_pmem_platform_data android_pmem_pdata = {
+	.name = "pmem",
+	.allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
+	.cached = 1,
+	.memory_type = MEMTYPE_EBI1,
+};
+
+static struct platform_device android_pmem_device = {
+	.name = "android_pmem",
+	.id = 0,
+	.dev = {.platform_data = &android_pmem_pdata},
+};
+
+static struct android_pmem_platform_data android_pmem_adsp_pdata = {
+	.name = "pmem_adsp",
+	.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
+	.cached = 0,
+	.memory_type = MEMTYPE_EBI1,
+};
+static struct platform_device android_pmem_adsp_device = {
+	.name = "android_pmem",
+	.id = 2,
+	.dev = { .platform_data = &android_pmem_adsp_pdata },
+};
+
+static struct android_pmem_platform_data android_pmem_audio_pdata = {
+	.name = "pmem_audio",
+	.allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
+	.cached = 0,
+	.memory_type = MEMTYPE_EBI1,
+};
+
+static struct platform_device android_pmem_audio_device = {
+	.name = "android_pmem",
+	.id = 4,
+	.dev = { .platform_data = &android_pmem_audio_pdata },
+};
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+
+struct fmem_platform_data msm8960_fmem_pdata = {
+};
+
+static struct memtype_reserve msm8960_reserve_table[] __initdata = {
+	[MEMTYPE_SMI] = {
+	},
+	[MEMTYPE_EBI0] = {
+		.flags	=	MEMTYPE_FLAGS_1M_ALIGN,
+	},
+	[MEMTYPE_EBI1] = {
+		.flags	=	MEMTYPE_FLAGS_1M_ALIGN,
+	},
+};
+
+static void __init reserve_rtb_memory(void)
+{
+#if defined(CONFIG_MSM_RTB)
+	msm8960_reserve_table[MEMTYPE_EBI1].size += msm8960_rtb_pdata.size;
+#endif
+}
+
+static void __init size_pmem_devices(void)
+{
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	android_pmem_adsp_pdata.size = pmem_adsp_size;
+
+	if (!pmem_param_set && machine_is_msm8960_liquid())
+		pmem_size = MSM_LIQUID_PMEM_SIZE;
+	android_pmem_pdata.size = pmem_size;
+
+	android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+}
+
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+static void __init reserve_memory_for(struct android_pmem_platform_data *p)
+{
+	msm8960_reserve_table[p->memory_type].size += p->size;
+}
+#endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/
+#endif /*CONFIG_ANDROID_PMEM*/
+
+static void __init reserve_pmem_memory(void)
+{
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	reserve_memory_for(&android_pmem_adsp_pdata);
+	reserve_memory_for(&android_pmem_pdata);
+	reserve_memory_for(&android_pmem_audio_pdata);
+#endif
+	msm8960_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
+#endif
+}
+
+static int msm8960_paddr_to_memtype(unsigned int paddr)
+{
+	return MEMTYPE_EBI1;
+}
+
+#define FMEM_ENABLED 0
+
+#ifdef CONFIG_ION_MSM
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+static struct ion_cp_heap_pdata cp_mm_ion_pdata = {
+	.permission_type = IPT_TYPE_MM_CARVEOUT,
+	.align = PAGE_SIZE,
+	.reusable = FMEM_ENABLED,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_MIDDLE,
+	.iommu_map_all = 1,
+	.iommu_2x_map_domain = VIDEO_DOMAIN,
+#ifdef CONFIG_CMA
+	.is_cma = 1,
+#endif
+};
+
+static struct ion_cp_heap_pdata cp_mfc_ion_pdata = {
+	.permission_type = IPT_TYPE_MFC_SHAREDMEM,
+	.align = PAGE_SIZE,
+	.reusable = 0,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_HIGH,
+};
+
+static struct ion_co_heap_pdata co_ion_pdata = {
+	.adjacent_mem_id = INVALID_HEAP_ID,
+	.align = PAGE_SIZE,
+	.mem_is_fmem = 0,
+};
+
+static struct ion_co_heap_pdata fw_co_ion_pdata = {
+	.adjacent_mem_id = ION_CP_MM_HEAP_ID,
+	.align = SZ_128K,
+	.mem_is_fmem = FMEM_ENABLED,
+	.fixed_position = FIXED_LOW,
+};
+#endif
+
+static u64 msm_dmamask = DMA_BIT_MASK(32);
+
+static struct platform_device ion_mm_heap_device = {
+	.name = "ion-mm-heap-device",
+	.id = -1,
+	.dev = {
+		.dma_mask = &msm_dmamask,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	}
+};
+
+#ifdef CONFIG_CMA
+static struct platform_device ion_adsp_heap_device = {
+	.name = "ion-adsp-heap-device",
+	.id = -1,
+	.dev = {
+		.dma_mask = &msm_dmamask,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	}
+};
+#endif
+
+/**
+ * These heaps are listed in the order they will be allocated. Due to
+ * video hardware restrictions and content protection the FW heap has to
+ * be allocated adjacent (below) the MM heap and the MFC heap has to be
+ * allocated after the MM heap to ensure MFC heap is not more than 256MB
+ * away from the base address of the FW heap.
+ * However, the order of FW heap and MM heap doesn't matter since these
+ * two heaps are taken care of by separate code to ensure they are adjacent
+ * to each other.
+ * Don't swap the order unless you know what you are doing!
+ */
+struct ion_platform_heap msm8960_heaps[] = {
+		{
+			.id	= ION_SYSTEM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_SYSTEM,
+			.name	= ION_VMALLOC_HEAP_NAME,
+		},
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+		{
+			.id	= ION_CP_MM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CP,
+			.name	= ION_MM_HEAP_NAME,
+			.size	= MSM_ION_MM_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &cp_mm_ion_pdata,
+			.priv	= &ion_mm_heap_device.dev,
+		},
+		{
+			.id	= ION_MM_FIRMWARE_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_MM_FIRMWARE_HEAP_NAME,
+			.size	= MSM_ION_MM_FW_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &fw_co_ion_pdata,
+		},
+		{
+			.id	= ION_CP_MFC_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CP,
+			.name	= ION_MFC_HEAP_NAME,
+			.size	= MSM_ION_MFC_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &cp_mfc_ion_pdata,
+		},
+#ifndef CONFIG_MSM_IOMMU
+		{
+			.id	= ION_SF_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_SF_HEAP_NAME,
+			.size	= MSM_ION_SF_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+#endif
+		{
+			.id	= ION_IOMMU_HEAP_ID,
+			.type	= ION_HEAP_TYPE_IOMMU,
+			.name	= ION_IOMMU_HEAP_NAME,
+		},
+		{
+			.id	= ION_QSECOM_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_QSECOM_HEAP_NAME,
+			.size	= MSM_ION_QSECOM_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+		{
+			.id	= ION_AUDIO_HEAP_ID,
+			.type	= ION_HEAP_TYPE_CARVEOUT,
+			.name	= ION_AUDIO_HEAP_NAME,
+			.size	= MSM_ION_AUDIO_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+		},
+#ifdef CONFIG_CMA
+		{
+			.id	= ION_ADSP_HEAP_ID,
+			.type	= ION_HEAP_TYPE_DMA,
+			.name	= ION_ADSP_HEAP_NAME,
+			.size	= MSM_ION_ADSP_SIZE,
+			.memory_type = ION_EBI_TYPE,
+			.extra_data = (void *) &co_ion_pdata,
+			.priv	= &ion_adsp_heap_device.dev,
+		},
+#endif
+#endif
+};
+
+static struct ion_platform_data msm8960_ion_pdata = {
+	.nr = MSM_ION_HEAP_NUM,
+	.heaps = msm8960_heaps,
+};
+
+static struct platform_device ion_dev = {
+	.name = "ion-msm",
+	.id = 1,
+	.dev = { .platform_data = &msm8960_ion_pdata },
+};
+#endif
+
+struct platform_device fmem_device = {
+	.name = "fmem",
+	.id = 1,
+	.dev = { .platform_data = &msm8960_fmem_pdata },
+};
+
+static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
+				      unsigned long size)
+{
+	msm8960_reserve_table[MEMTYPE_EBI1].size += size;
+}
+
+static void __init msm8960_reserve_fixed_area(unsigned long fixed_area_size)
+{
+#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	int ret;
+
+	if (fixed_area_size > MAX_FIXED_AREA_SIZE)
+		panic("fixed area size is larger than %dM\n",
+			MAX_FIXED_AREA_SIZE >> 20);
+
+	reserve_info->fixed_area_size = fixed_area_size;
+	reserve_info->fixed_area_start = MSM8960_FW_START;
+
+	ret = memblock_remove(reserve_info->fixed_area_start,
+		reserve_info->fixed_area_size);
+	BUG_ON(ret);
+#endif
+}
+
+/**
+ * Reserve memory for ION and calculate amount of reusable memory for fmem.
+ * We only reserve memory for heaps that are not reusable. However, we only
+ * support one reusable heap at the moment so we ignore the reusable flag for
+ * other than the first heap with reusable flag set. Also handle special case
+ * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
+ * at a higher address than FW in addition to not more than 256MB away from the
+ * base address of the firmware. This means that if MM is reusable the other
+ * two heaps must be allocated in the same region as FW. This is handled by the
+ * mem_is_fmem flag in the platform data. In addition the MM heap must be
+ * adjacent to the FW heap for content protection purposes.
+ */
+static void __init reserve_ion_memory(void)
+{
+#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	unsigned int i;
+	int ret;
+	unsigned int fixed_size = 0;
+	unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
+	unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
+	unsigned long cma_alignment;
+	unsigned int low_use_cma = 0;
+	unsigned int middle_use_cma = 0;
+	unsigned int high_use_cma = 0;
+
+	fixed_low_size = 0;
+	fixed_middle_size = 0;
+	fixed_high_size = 0;
+
+	cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
+
+	for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
+		struct ion_platform_heap *heap =
+						&(msm8960_ion_pdata.heaps[i]);
+		int align = SZ_4K;
+		int iommu_map_all = 0;
+		int adjacent_mem_id = INVALID_HEAP_ID;
+		int use_cma = 0;
+
+		if (heap->extra_data) {
+			int fixed_position = NOT_FIXED;
+
+			switch ((int) heap->type) {
+			case ION_HEAP_TYPE_CP:
+				fixed_position = ((struct ion_cp_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				align = ((struct ion_cp_heap_pdata *)
+						heap->extra_data)->align;
+				iommu_map_all =
+					((struct ion_cp_heap_pdata *)
+					heap->extra_data)->iommu_map_all;
+				if (((struct ion_cp_heap_pdata *)
+					heap->extra_data)->is_cma) {
+					heap->size = ALIGN(heap->size,
+							cma_alignment);
+					use_cma = 1;
+				}
+				break;
+			case ION_HEAP_TYPE_DMA:
+					use_cma = 1;
+				/* Purposely fall through here */
+			case ION_HEAP_TYPE_CARVEOUT:
+				fixed_position = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				adjacent_mem_id = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->adjacent_mem_id;
+				break;
+			default:
+				break;
+			}
+
+			if (iommu_map_all) {
+				if (heap->size & (SZ_64K-1)) {
+					heap->size = ALIGN(heap->size, SZ_64K);
+					pr_info("Heap %s not aligned to 64K. Adjusting size to %x\n",
+						heap->name, heap->size);
+				}
+			}
+
+			if (fixed_position != NOT_FIXED)
+				fixed_size += heap->size;
+			else
+				reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
+
+			if (fixed_position == FIXED_LOW) {
+				fixed_low_size += heap->size;
+				low_use_cma = use_cma;
+			} else if (fixed_position == FIXED_MIDDLE) {
+				fixed_middle_size += heap->size;
+				middle_use_cma = use_cma;
+			} else if (fixed_position == FIXED_HIGH) {
+				fixed_high_size += heap->size;
+				high_use_cma = use_cma;
+			} else if (use_cma) {
+				/*
+				 * Heaps that use CMA but are not part of the
+				 * fixed set. Create wherever.
+				 */
+				dma_declare_contiguous(
+					heap->priv,
+					heap->size,
+					0,
+					0xb0000000);
+			}
+		}
+	}
+
+	if (!fixed_size)
+		return;
+
+	/*
+	 * Given the setup for the fixed area, we can't round up all sizes.
+	 * Some sizes must be set up exactly and aligned correctly. Incorrect
+	 * alignments are considered a configuration issue
+	 */
+
+	fixed_low_start = MSM8960_FIXED_AREA_START;
+	if (low_use_cma) {
+		BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
+		BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
+	} else {
+		BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
+		ret = memblock_remove(fixed_low_start,
+				      fixed_low_size + HOLE_SIZE);
+		BUG_ON(ret);
+	}
+
+	fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
+	if (middle_use_cma) {
+		BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
+		BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
+	} else {
+		BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
+		ret = memblock_remove(fixed_middle_start, fixed_middle_size);
+		BUG_ON(ret);
+	}
+
+	fixed_high_start = fixed_middle_start + fixed_middle_size;
+	if (high_use_cma) {
+		fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
+		BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
+	} else {
+		/* This is the end of the fixed area so it's okay to round up */
+		fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
+		ret = memblock_remove(fixed_high_start, fixed_high_size);
+		BUG_ON(ret);
+	}
+
+
+
+	for (i = 0; i < msm8960_ion_pdata.nr; ++i) {
+		struct ion_platform_heap *heap = &(msm8960_ion_pdata.heaps[i]);
+
+		if (heap->extra_data) {
+			int fixed_position = NOT_FIXED;
+			struct ion_cp_heap_pdata *pdata = NULL;
+
+			switch ((int) heap->type) {
+			case ION_HEAP_TYPE_CP:
+				pdata =
+				(struct ion_cp_heap_pdata *)heap->extra_data;
+				fixed_position = pdata->fixed_position;
+				break;
+			case ION_HEAP_TYPE_CARVEOUT:
+			case ION_HEAP_TYPE_DMA:
+				fixed_position = ((struct ion_co_heap_pdata *)
+					heap->extra_data)->fixed_position;
+				break;
+			default:
+				break;
+			}
+
+			switch (fixed_position) {
+			case FIXED_LOW:
+				heap->base = fixed_low_start;
+				break;
+			case FIXED_MIDDLE:
+				heap->base = fixed_middle_start;
+				if (middle_use_cma) {
+					ret = dma_declare_contiguous(
+						&ion_mm_heap_device.dev,
+						heap->size,
+						fixed_middle_start,
+						0xa0000000);
+					WARN_ON(ret);
+				}
+				pdata->secure_base = fixed_middle_start
+							- HOLE_SIZE;
+				pdata->secure_size = HOLE_SIZE + heap->size;
+				break;
+			case FIXED_HIGH:
+				heap->base = fixed_high_start;
+				break;
+			default:
+				break;
+			}
+		}
+	}
+#endif
+}
+
+static void __init reserve_mdp_memory(void)
+{
+	msm8960_mdp_writeback(msm8960_reserve_table);
+}
+
+static void reserve_cache_dump_memory(void)
+{
+#ifdef CONFIG_MSM_CACHE_DUMP
+	unsigned int total;
+
+	total = msm8960_cache_dump_pdata.l1_size +
+		msm8960_cache_dump_pdata.l2_size;
+	msm8960_reserve_table[MEMTYPE_EBI1].size += total;
+#endif
+}
+
+static void __init msm8960_calculate_reserve_sizes(void)
+{
+	size_pmem_devices();
+	reserve_pmem_memory();
+	reserve_ion_memory();
+	reserve_mdp_memory();
+	reserve_rtb_memory();
+	reserve_cache_dump_memory();
+}
+
+static struct reserve_info msm8960_reserve_info __initdata = {
+	.memtype_reserve_table = msm8960_reserve_table,
+	.calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
+	.reserve_fixed_area = msm8960_reserve_fixed_area,
+	.paddr_to_memtype = msm8960_paddr_to_memtype,
+};
+
+static void __init ville_early_memory(void)
+{
+	reserve_info = &msm8960_reserve_info;
+}
+
+static void __init ville_reserve(void)
+{
+	msm_reserve();
+}
+
+static void __init msm8960_allocate_memory_regions(void)
+{
+	msm8960_allocate_fb_region();
+}
+
+#ifdef CONFIG_WCD9310_CODEC
+
+#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
+
+/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
+ * 4 micbiases are used to power various analog and digital
+ * microphones operating at 1800 mV. Technically, all micbiases
+ * can source from single cfilter since all microphones operate
+ * at the same voltage level. The arrangement below is to make
+ * sure all cfilters are exercised. LDO_H regulator ouput level
+ * does not need to be as high as 2.85V. It is choosen for
+ * microphone sensitivity purpose.
+ */
+static struct wcd9xxx_pdata tabla_platform_data = {
+	.slimbus_slave_device = {
+		.name = "tabla-slave",
+		.e_addr = {0, 0, 0x10, 0, 0x17, 2},
+	},
+	.irq = MSM_GPIO_TO_INT(62),
+	.irq_base = TABLA_INTERRUPT_BASE,
+	.num_irqs = NR_TABLA_IRQS,
+	.reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
+	.micbias = {
+		.ldoh_v = TABLA_LDOH_2P85_V,
+		.cfilt1_mv = 1800,
+		.cfilt2_mv = 1800,
+		.cfilt3_mv = 1800,
+		.bias1_cfilt_sel = TABLA_CFILT1_SEL,
+		.bias2_cfilt_sel = TABLA_CFILT2_SEL,
+		.bias3_cfilt_sel = TABLA_CFILT3_SEL,
+		.bias4_cfilt_sel = TABLA_CFILT3_SEL,
+	},
+	.regulator = {
+	{
+		.name = "CDC_VDD_CP",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_RX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_TX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
+	},
+	{
+		.name = "VDDIO_CDC",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
+	},
+	{
+		.name = "VDDD_CDC_D",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_A_1P2V",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
+	},
+	},
+};
+
+static struct slim_device msm_slim_tabla = {
+	.name = "tabla-slim",
+	.e_addr = {0, 1, 0x10, 0, 0x17, 2},
+	.dev = {
+		.platform_data = &tabla_platform_data,
+	},
+};
+
+static struct wcd9xxx_pdata tabla20_platform_data = {
+	.slimbus_slave_device = {
+		.name = "tabla-slave",
+		.e_addr = {0, 0, 0x60, 0, 0x17, 2},
+	},
+	.irq = MSM_GPIO_TO_INT(62),
+	.irq_base = TABLA_INTERRUPT_BASE,
+	.num_irqs = NR_TABLA_IRQS,
+	.reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
+	.amic_settings = {
+		.legacy_mode = 0x7F,
+		.use_pdata = 0x7F,
+	},
+	.micbias = {
+		.ldoh_v = TABLA_LDOH_2P85_V,
+		.cfilt1_mv = 1800,
+		.cfilt2_mv = 1800,
+		.cfilt3_mv = 1800,
+		.bias1_cfilt_sel = TABLA_CFILT1_SEL,
+		.bias2_cfilt_sel = TABLA_CFILT2_SEL,
+		.bias3_cfilt_sel = TABLA_CFILT3_SEL,
+		.bias4_cfilt_sel = TABLA_CFILT3_SEL,
+	},
+	.regulator = {
+	{
+		.name = "CDC_VDD_CP",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_RX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_TX",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
+	},
+	{
+		.name = "VDDIO_CDC",
+		.min_uV = 1800000,
+		.max_uV = 1800000,
+		.optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
+	},
+	{
+		.name = "VDDD_CDC_D",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
+	},
+	{
+		.name = "CDC_VDDA_A_1P2V",
+		.min_uV = 1225000,
+		.max_uV = 1250000,
+		.optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
+	},
+	},
+};
+
+static struct slim_device msm_slim_tabla20 = {
+	.name = "tabla2x-slim",
+	.e_addr = {0, 1, 0x60, 0, 0x17, 2},
+	.dev = {
+		.platform_data = &tabla20_platform_data,
+	},
+};
+#endif
+
+static struct slim_boardinfo msm_slim_devices[] = {
+#ifdef CONFIG_WCD9310_CODEC
+	{
+		.bus_num = 1,
+		.slim_slave = &msm_slim_tabla,
+	},
+	{
+		.bus_num = 1,
+		.slim_slave = &msm_slim_tabla20,
+	},
+#endif
+	/* add more slimbus slaves as needed */
+};
+
+#define MSM_WCNSS_PHYS	0x03000000
+#define MSM_WCNSS_SIZE	0x280000
+
+static struct resource resources_wcnss_wlan[] = {
+	{
+		.start	= RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
+		.end	= RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
+		.name	= "wcnss_wlanrx_irq",
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
+		.end	= RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
+		.name	= "wcnss_wlantx_irq",
+		.flags	= IORESOURCE_IRQ,
+	},
+	{
+		.start	= MSM_WCNSS_PHYS,
+		.end	= MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
+		.name	= "wcnss_mmio",
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start  = 84,
+		.end    = 88,
+		.name   = "wcnss_gpios_5wire",
+		.flags  = IORESOURCE_IO,
+	},
+};
+
+static struct qcom_wcnss_opts qcom_wcnss_pdata = {
+	.has_48mhz_xo	= 1,
+};
+
+static struct platform_device msm_device_wcnss_wlan = {
+	.name		= "wcnss_wlan",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(resources_wcnss_wlan),
+	.resource	= resources_wcnss_wlan,
+	.dev		= {.platform_data = &qcom_wcnss_pdata},
+};
+
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+
+#define QCE_SIZE		0x10000
+#define QCE_0_BASE		0x18500000
+
+#define QCE_HW_KEY_SUPPORT	0
+#define QCE_SHA_HMAC_SUPPORT	1
+#define QCE_SHARE_CE_RESOURCE	1
+#define QCE_CE_SHARED		0
+
+/* Begin Bus scaling definitions */
+static struct msm_bus_vectors crypto_hw_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT1,
+		.dst = MSM_BUS_SLAVE_GSBI1_UART,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+
+static struct msm_bus_vectors crypto_hw_active_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 70000000UL,
+		.ib = 70000000UL,
+	},
+	{
+		.src = MSM_BUS_MASTER_ADM_PORT1,
+		.dst = MSM_BUS_SLAVE_GSBI1_UART,
+		.ab = 2480000000UL,
+		.ib = 2480000000UL,
+	},
+};
+
+static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(crypto_hw_init_vectors),
+		crypto_hw_init_vectors,
+	},
+	{
+		ARRAY_SIZE(crypto_hw_active_vectors),
+		crypto_hw_active_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = {
+	crypto_hw_bus_scale_usecases,
+	ARRAY_SIZE(crypto_hw_bus_scale_usecases),
+	.name = "cryptohw",
+};
+/* End Bus Scaling Definitions*/
+
+static struct resource qcrypto_resources[] = {
+	[0] = {
+		.start = QCE_0_BASE,
+		.end = QCE_0_BASE + QCE_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.name = "crypto_channels",
+		.start = DMOV_CE_IN_CHAN,
+		.end = DMOV_CE_OUT_CHAN,
+		.flags = IORESOURCE_DMA,
+	},
+	[2] = {
+		.name = "crypto_crci_in",
+		.start = DMOV_CE_IN_CRCI,
+		.end = DMOV_CE_IN_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+	[3] = {
+		.name = "crypto_crci_out",
+		.start = DMOV_CE_OUT_CRCI,
+		.end = DMOV_CE_OUT_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+};
+
+static struct resource qcedev_resources[] = {
+	[0] = {
+		.start = QCE_0_BASE,
+		.end = QCE_0_BASE + QCE_SIZE - 1,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.name = "crypto_channels",
+		.start = DMOV_CE_IN_CHAN,
+		.end = DMOV_CE_OUT_CHAN,
+		.flags = IORESOURCE_DMA,
+	},
+	[2] = {
+		.name = "crypto_crci_in",
+		.start = DMOV_CE_IN_CRCI,
+		.end = DMOV_CE_IN_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+	[3] = {
+		.name = "crypto_crci_out",
+		.start = DMOV_CE_OUT_CRCI,
+		.end = DMOV_CE_OUT_CRCI,
+		.flags = IORESOURCE_DMA,
+	},
+};
+
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
+
+static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
+	.ce_shared = QCE_CE_SHARED,
+	.shared_ce_resource = QCE_SHARE_CE_RESOURCE,
+	.hw_key_support = QCE_HW_KEY_SUPPORT,
+	.sha_hmac = QCE_SHA_HMAC_SUPPORT,
+	.bus_scale_table = &crypto_hw_bus_scale_pdata,
+};
+
+static struct platform_device qcrypto_device = {
+	.name		= "qcrypto",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(qcrypto_resources),
+	.resource	= qcrypto_resources,
+	.dev		= {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data = &qcrypto_ce_hw_suppport,
+	},
+};
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+
+static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
+	.ce_shared = QCE_CE_SHARED,
+	.shared_ce_resource = QCE_SHARE_CE_RESOURCE,
+	.hw_key_support = QCE_HW_KEY_SUPPORT,
+	.sha_hmac = QCE_SHA_HMAC_SUPPORT,
+	.bus_scale_table = &crypto_hw_bus_scale_pdata,
+};
+
+static struct platform_device qcedev_device = {
+	.name		= "qce",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(qcedev_resources),
+	.resource	= qcedev_resources,
+	.dev		= {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+		.platform_data = &qcedev_ce_hw_suppport,
+	},
+};
+#endif
+
+#ifdef CONFIG_HTC_BATT_8960
+static struct htc_battery_platform_data htc_battery_pdev_data = {
+	.guage_driver = 0,
+	.chg_limit_active_mask = HTC_BATT_CHG_LIMIT_BIT_TALK |
+								HTC_BATT_CHG_LIMIT_BIT_NAVI,
+	.critical_low_voltage_mv = 3200,
+	.critical_alarm_voltage_mv = 3000,
+	.overload_vol_thr_mv = 4000,
+	.overload_curr_thr_ma = 0,
+	/* charger */
+	.icharger.name = "pm8921",
+	.icharger.get_charging_source = pm8921_get_charging_source,
+	.icharger.get_charging_enabled = pm8921_get_charging_enabled,
+	.icharger.set_charger_enable = pm8921_charger_enable,
+	.icharger.set_pwrsrc_enable = pm8921_pwrsrc_enable,
+	.icharger.set_pwrsrc_and_charger_enable =
+						pm8921_set_pwrsrc_and_charger_enable,
+	.icharger.set_limit_charge_enable = pm8921_limit_charge_enable,
+	.icharger.is_ovp = pm8921_is_charger_ovp,
+	.icharger.is_batt_temp_fault_disable_chg =
+						pm8921_is_batt_temp_fault_disable_chg,
+	.icharger.charger_change_notifier_register =
+						cable_detect_register_notifier,
+	.icharger.dump_all = pm8921_dump_all,
+	.icharger.get_attr_text = pm8921_charger_get_attr_text,
+	/* gauge */
+	.igauge.name = "pm8921",
+	.igauge.get_battery_voltage = pm8921_get_batt_voltage,
+	.igauge.get_battery_current = pm8921_bms_get_batt_current,
+	.igauge.get_battery_temperature = pm8921_get_batt_temperature,
+	.igauge.get_battery_id = pm8921_get_batt_id,
+	.igauge.get_battery_soc = pm8921_bms_get_batt_soc,
+	.igauge.get_battery_cc = pm8921_bms_get_batt_cc,
+	.igauge.is_battery_temp_fault = pm8921_is_batt_temperature_fault,
+	.igauge.is_battery_full = pm8921_is_batt_full,
+	.igauge.get_attr_text = pm8921_gauge_get_attr_text,
+	.igauge.register_lower_voltage_alarm_notifier =
+						pm8xxx_batt_lower_alarm_register_notifier,
+	.igauge.enable_lower_voltage_alarm = pm8xxx_batt_lower_alarm_enable,
+	.igauge.set_lower_voltage_alarm_threshold =
+						pm8xxx_batt_lower_alarm_threshold_set,
+};
+
+static struct platform_device htc_battery_pdev = {
+	.name = "htc_battery",
+	.id = -1,
+	.dev    = {
+		.platform_data = &htc_battery_pdev_data,
+	},
+};
+#endif /* CONFIG_HTC_BATT_8960 */
+
+/* HTC_HEADSET_PMIC Driver */
+static struct htc_headset_pmic_platform_data htc_headset_pmic_data = {
+	.driver_flag		= DRIVER_HS_PMIC_ADC,
+	.hpin_gpio		= PM8921_GPIO_PM_TO_SYS(
+					VILLE_PMGPIO_EARPHONE_DETz),
+	.hpin_irq		= 0,
+	.key_gpio		= PM8921_GPIO_PM_TO_SYS(
+					VILLE_PMGPIO_AUD_REMO_PRESz),
+	.key_irq		= 0,
+	.key_enable_gpio	= 0,
+	.adc_mic		= 0,
+	.adc_remote		= {0, 57, 58, 147, 148, 339},
+	.adc_mpp		= PM8XXX_AMUX_MPP_10,
+	.adc_amux		= ADC_MPP_1_AMUX6,
+	.hs_controller		= 0,
+	.hs_switch		= 0,
+};
+
+static struct htc_headset_pmic_platform_data htc_headset_pmic_data_xc = {
+	.driver_flag		= DRIVER_HS_PMIC_ADC,
+	.hpin_gpio		= PM8921_GPIO_PM_TO_SYS(
+					VILLE_PMGPIO_EARPHONE_DETz),
+	.hpin_irq		= 0,
+	.key_gpio		= PM8921_GPIO_PM_TO_SYS(
+					VILLE_PMGPIO_AUD_REMO_PRESz),
+	.key_irq		= 0,
+	.key_enable_gpio	= 0,
+	.adc_mic		= 0,
+	.adc_remote		= {0, 149, 150, 349, 350, 630},
+	.adc_mpp		= PM8XXX_AMUX_MPP_10,
+	.adc_amux		= ADC_MPP_1_AMUX6,
+	.hs_controller		= 0,
+	.hs_switch		= 0,
+};
+
+static struct platform_device htc_headset_pmic = {
+	.name	= "HTC_HEADSET_PMIC",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &htc_headset_pmic_data,
+	},
+};
+
+/* HTC_HEADSET_MGR Driver */
+static struct platform_device *headset_devices[] = {
+	&htc_headset_pmic,
+	/* Please put the headset detection driver on the last */
+};
+
+static struct headset_adc_config htc_headset_mgr_config[] = {
+	{
+		.type = HEADSET_MIC,
+		.adc_max = 1530,
+		.adc_min = 1223,
+	},
+	{
+		.type = HEADSET_BEATS,
+		.adc_max = 1222,
+		.adc_min = 916,
+	},
+	{
+		.type = HEADSET_BEATS_SOLO,
+		.adc_max = 915,
+		.adc_min = 566,
+	},
+	{
+		.type = HEADSET_METRICO, /* For MOS test */
+		.adc_max = 565,
+		.adc_min = 255,
+	},
+	{
+		.type = HEADSET_NO_MIC,
+		.adc_max = 254,
+		.adc_min = 0,
+	},
+};
+
+static struct headset_adc_config htc_headset_mgr_config_xc[] = {
+	{
+		.type = HEADSET_MIC,
+		.adc_max = 2700,
+		.adc_min = 1201,
+	},
+	{
+		.type = HEADSET_METRICO,
+		.adc_max = 1200,
+		.adc_min = 501,
+	},
+	{
+		.type = HEADSET_NO_MIC,
+		.adc_max = 500,
+		.adc_min = 0,
+	},
+};
+
+static struct htc_headset_mgr_platform_data htc_headset_mgr_data = {
+	.driver_flag		= DRIVER_HS_MGR_FLOAT_DET,
+	.headset_devices_num	= ARRAY_SIZE(headset_devices),
+	.headset_devices	= headset_devices,
+	.headset_config_num	= ARRAY_SIZE(htc_headset_mgr_config),
+	.headset_config		= htc_headset_mgr_config,
+};
+
+static struct platform_device htc_headset_mgr = {
+	.name	= "HTC_HEADSET_MGR",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &htc_headset_mgr_data,
+	},
+};
+
+static void headset_device_register(void)
+{
+	pr_info("[HS_BOARD] (%s) Headset device register\n", __func__);
+
+	pr_info("[HS_BOARD] (%s) system_rev = %d\n", __func__, system_rev);
+	if (system_rev == 2) {
+		htc_headset_pmic.dev.platform_data = &htc_headset_pmic_data_xc;
+		htc_headset_mgr_data.headset_config_num =
+					ARRAY_SIZE(htc_headset_mgr_config_xc);
+		htc_headset_mgr_data.headset_config = htc_headset_mgr_config_xc;
+	}
+
+	platform_device_register(&htc_headset_mgr);
+}
+
+static struct atmel_cfg ts_atmel_mferr_cfg_data[] = {
+	{.objid = GEN_POWERCONFIG_T7,		.byte = 1,     .value = 255,    .orival = 12},
+	{.objid = TOUCH_MULTITOUCHSCREEN_T9,    .byte = 7,     .value = 105,	.orival = 50},
+	{.objid = TOUCH_MULTITOUCHSCREEN_T9,    .byte = 13,    .value = 1,	.orival = 15},
+	{.objid = TOUCH_MULTITOUCHSCREEN_T9,    .byte = 31,    .value = 25,	.orival = 10},
+	{.objid = TOUCH_MULTITOUCHSCREEN_T9,    .byte = 34,    .value = 3,	.orival = 2},
+	{.objid = EXTRA_NOISE_SUPPRESSION_T58,  .byte = 0,     .value = 0,	.orival = 100},
+	{.objid = EXTRA_NOISE_SUPPRESSION_T58,  .byte = 1,     .value = 0, 	.orival = 20},
+	{.objid = EXTRA_NOISE_SUPPRESSION_T58,  .byte = 2,     .value = 0,	.orival = 3},
+	{.objid = EXTRA_NOISE_SUPPRESSION_T58,  .byte = 3,     .value = 0,	.orival = 1},
+	{.objid = EXTRA_NOISE_SUPPRESSION_T58,  .byte = 4,     .value = 0,	.orival = 50},
+	{.objid = SPT_CTECONFIG_T46,            .byte = 3,     .value = 63,	.orival = 16},
+	{.objid = PROCG_NOISESUPPRESSION_T48,   .byte = 8,     .value = 18,	.orival = 0},
+	{.objid = PROCG_NOISESUPPRESSION_T48,   .byte = 9,     .value = 30,	.orival = 0},
+	{.objid = PROCG_NOISESUPPRESSION_T48,   .byte = 11,    .value = 45,	.orival = 20},
+};
+
+static struct atmel_cfg ts_atmel_cfm_calb_data[] = {
+	{.objid = GEN_ACQUISITIONCONFIG_T8,    .byte = 6,    .value = 255,	.orival = 5},
+	{.objid = GEN_ACQUISITIONCONFIG_T8,    .byte = 7,    .value = 1,	.orival = 25},
+	{.objid = GEN_ACQUISITIONCONFIG_T8,    .byte = 8,    .value = 0,	.orival = 5},
+	{.objid = GEN_ACQUISITIONCONFIG_T8,    .byte = 9,    .value = 0,	.orival = 192},
+};
+
+static struct atmel_cfg ts_atmel_cable_cfg_data[] = {
+	{.objid = TOUCH_MULTITOUCHSCREEN_T9,    .byte = 8,    .value = 3,	.orival = 2},
+};
+
+static struct atmel_i2c_platform_data ts_atmel_data[] = {
+	{
+		.version          = 0x0011,
+		.build            = 0xAA,
+		.source 	  = 0,
+		.abs_x_min        = 0,
+		.abs_x_max        = 539,
+		.abs_y_min        = 0,
+		.abs_y_max        = 959,
+		.abs_pressure_min = 0,
+		.abs_pressure_max = 255,
+		.abs_width_min    = 0,
+		.abs_width_max    = 20,
+		.gpio_irq         = VILLE_GPIO_TP_ATTz,
+		.unlock_attr      = 0,
+		.config_T6        = {0, 0, 0, 0, 0, 0},
+		.config_T7        = {50, 12, 25},
+		.config_T8        = {30, 0, 5, 5, 0, 0, 5, 25, 5, 192},
+		.config_T9        = {131, 0, 0, 19, 11, 0, 32, 50, 2, 1,
+			0, 3, 1, 15, 5, 10, 10, 10, 191, 3,
+			27, 2, 6, 252, 30, 25, 184, 35, 180, 55,
+			20, 10, 0, 0, 2},
+		.config_T15       = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T18       = {0, 0},
+		.config_T19       = {0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+			0, 0, 0, 0, 0, 0},
+		.config_T23       = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+			0, 0, 0, 0, 0},
+		.config_T25       = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+			0, 0, 0, 0},
+		.config_T40       = {0, 0, 0, 0, 0},
+		.config_T42       = {0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T46       = {0, 3, 16, 16, 0, 0, 0, 0, 0},
+		.config_T47       = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T48       = {3, 0, 66, 0, 0, 0, 0, 0, 0, 0,
+			16, 20, 0, 6, 6, 0, 0, 100, 4, 64,
+			10, 0, 20, 5, 0, 38, 0, 5, 0, 0,
+			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+			0, 0, 0, 0},
+		.config_T55       = {0, 0, 0, 0},
+		.config_T58       = {100, 20, 3, 1, 50, 0, 0, 0, 0, 0,
+			0},
+		.object_crc       = {0x62, 0x28, 0x18},
+		.workaround 	  = TW_SHIFT,
+		.cable_config	  = {	.cnt = ARRAY_SIZE(ts_atmel_cable_cfg_data),
+			.cfg = ts_atmel_cable_cfg_data, },
+		.mferr_config 	  = { 	.cnt = ARRAY_SIZE(ts_atmel_mferr_cfg_data),
+			.cfg = ts_atmel_mferr_cfg_data, },
+		.cfm_calb	  = {	.cnt = ARRAY_SIZE(ts_atmel_cfm_calb_data),
+			.cfg = ts_atmel_cfm_calb_data, },
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+		.flt_th	  = 945,
+#endif
+	},
+	{
+		.version          = 0x0011,
+		.build            = 0xAA,
+		.source 	  = 1,
+		.abs_x_min        = 0,
+		.abs_x_max        = 539,
+		.abs_y_min        = 0,
+		.abs_y_max        = 959,
+		.abs_pressure_min = 0,
+		.abs_pressure_max = 255,
+		.abs_width_min    = 0,
+		.abs_width_max    = 20,
+		.gpio_irq         = VILLE_GPIO_TP_ATTz,
+		.unlock_attr      = 0,
+		.config_T6        = {0, 0, 0, 0, 0, 0},
+		.config_T7        = {50, 12, 25},
+		.config_T8        = {30, 0, 5, 5, 0, 0, 5, 25, 5, 192},
+		.config_T9        = {131, 0, 0, 19, 11, 0, 32, 50, 2, 5,
+			0, 3, 1, 15, 5, 10, 10, 10, 191, 3,
+			27, 2, 6, 0, 30, 25, 184, 35, 180, 55,
+			20, 10, 0, 0, 2},
+		.config_T15       = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T18       = {0, 0},
+		.config_T19       = {0, 0, 0, 60, 0, 0, 0, 0, 0, 0,
+			0, 0, 0, 0, 0, 0},
+		.config_T23       = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+			0, 0, 0, 0, 0},
+		.config_T25       = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+			0, 0, 0, 0},
+		.config_T40       = {0, 0, 0, 0, 0},
+		.config_T42       = {0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T46       = {0, 3, 16, 16, 0, 0, 0, 0, 0},
+		.config_T47       = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T48       = {3, 0, 66, 0, 0, 0, 0, 0, 0, 0,
+			16, 20, 0, 6, 6, 0, 0, 100, 4, 64,
+			10, 0, 20, 5, 0, 38, 0, 5, 0, 0,
+			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+			0, 0, 0, 0},
+		.config_T55       = {0, 0, 0, 0},
+		.config_T58       = {100, 20, 3, 1, 50, 0, 0, 0, 0, 0,
+			0},
+		/*                .object_crc       = {0x29, 0x66, 0xE9},*/
+		.workaround 	  = TW_SHIFT,
+		.cable_config	  = {	.cnt = ARRAY_SIZE(ts_atmel_cable_cfg_data),
+			.cfg = ts_atmel_cable_cfg_data, },
+		.mferr_config 	  = { 	.cnt = ARRAY_SIZE(ts_atmel_mferr_cfg_data),
+			.cfg = ts_atmel_mferr_cfg_data, },
+		.cfm_calb	  = {	.cnt = ARRAY_SIZE(ts_atmel_cfm_calb_data),
+			.cfg = ts_atmel_cfm_calb_data, },
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+		.flt_th	  = 945,
+#endif
+	},
+	{
+		.version = 0x0010,
+		.abs_x_min = 0,
+		.abs_x_max = 2047,
+		.abs_y_min = 0,
+		.abs_y_max = 2047,
+		.abs_pressure_min = 0,
+		.abs_pressure_max = 255,
+		.abs_width_min = 0,
+		.abs_width_max = 20,
+		.gpio_irq = VILLE_GPIO_TP_ATTz,
+		.config_T6 = {0, 0, 0, 0, 0, 0},
+		.config_T7 = {15, 8, 50},
+		.config_T8 = {30, 0, 5, 5, 0, 64, 5, 1, 0, 0},
+		.config_T9 = {139, 0, 0, 19, 11, 0, 16, 40, 0, 1, 0, 5, 2, 0, 5, 20, 20, 20, 255, 7, 255, 7, 5, 0, 30, 30, 141, 60, 153, 75, 18, 15, 54, 54, 0},
+		.config_T15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T18 = {0, 0},
+		.config_T19 = {0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T23 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T25 = {3, 0, 48, 117, 156, 99, 0, 0, 0, 0, 0, 0, 0, 0},
+		.config_T40 = {0, 0, 0, 0, 0},
+		.config_T42 = {0, 50, 23, 23, 250, 3, 0, 5},
+		.config_T46 = {0, 3, 8, 8, 0, 0, 0, 0, 0},
+		.config_T47 = {0, 20, 50, 5, 2, 50, 40, 0, 0, 63},
+		.config_T48 = {0, 196, 96, 20, 0, 0, 0, 0, 12, 12, 16, 22, 0, 6, 6, 0, 0, 100, 4, 64, 10, 0, 20, 5, 0, 38, 0, 20, 0, 0, 0, 0, 0, 0, 0, 35, 3, 5, 2, 0, 5, 10, 10, 239, 238, 35, 35, 143, 75, 138, 50, 18, 17, 4},
+
+		/*.cable_config = {35, 25, 8, 16},*/
+		.GCAF_level = {20, 24, 28, 40, 63},
+	},
+};
+
+static struct i2c_board_info msm_i2c_gsbi3_info[] = {
+	{
+		I2C_BOARD_INFO(ATMEL_MXT224E_NAME, 0x94 >> 1),
+		.platform_data = &ts_atmel_data,
+		.irq = MSM_GPIO_TO_INT(VILLE_GPIO_TP_ATTz)
+	},
+};
+
+int cy8c_cs_reset(void)
+{
+	pr_info("[cap]%s Enter\n", __func__);
+
+	gpio_set_value_cansleep(PM8921_GPIO_PM_TO_SYS(VILLE_PMGPIO_CAP_RST), 1);
+	msleep(5);
+	gpio_set_value_cansleep(PM8921_GPIO_PM_TO_SYS(VILLE_PMGPIO_CAP_RST), 0);
+
+	return 0;
+}
+
+struct cy8c_i2c_cs_platform_data cs_cy8c_data[] = {
+	{
+		.gpio_irq = VILLE_GPIO_CAP_SENSOR_INTz,
+		.gpio_rst = PM8921_GPIO_PM_TO_SYS(VILLE_PMGPIO_CAP_RST),
+		.reset    = cy8c_cs_reset,
+		.keycode  = {KEY_BACK, KEY_HOME, KEY_APP_SWITCH},
+		.func_support = CS_FUNC_PRINTRAW,
+		.id       = {
+			.config = CS_KEY_3,
+		},
+	},
+	{
+		.gpio_irq = VILLE_GPIO_CAP_SENSOR_INTz,
+		.gpio_rst = PM8921_GPIO_PM_TO_SYS(VILLE_PMGPIO_CAP_RST),
+		.reset    = cy8c_cs_reset,
+		.keycode  = {KEY_BACK, KEY_HOME, KEY_APP_SWITCH, KEY_WEIBO},
+		.func_support = CS_FUNC_PRINTRAW,
+		.id       = {
+			.config = CS_KEY_4,
+		},
+	},
+};
+
+static struct i2c_board_info msm_i2c_gsbi5_info[] = {
+	{
+		I2C_BOARD_INFO(CYPRESS_CS_NAME, 0x40 >> 1),
+		.platform_data = &cs_cy8c_data,
+		.irq = MSM_GPIO_TO_INT(VILLE_GPIO_CAP_SENSOR_INTz),
+	},
+};
+
+static void config_gpio_table(uint32_t *table, int len)
+{
+	int n, rc;
+	for (n = 0; n < len; n++) {
+		rc = gpio_tlmm_config(table[n], GPIO_CFG_ENABLE);
+		if (rc) {
+			pr_err("[CAM] %s: gpio_tlmm_config(%#x)=%d\n",
+				__func__, table[n], rc);
+			break;
+		}
+	}
+}
+static uint32_t gyro_DIAG_PIN_pull_down[] = {
+	GPIO_CFG(VILLE_GPIO_GYRO_DIAG, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
+};
+static uint32_t gyro_DIAG_PIN_no_pull[] = {
+	GPIO_CFG(VILLE_GPIO_GYRO_DIAG, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+void config_ville_gyro_diag_gpios(bool pulldown)
+{
+	if (pulldown) {
+		config_gpio_table(gyro_DIAG_PIN_pull_down, ARRAY_SIZE(gyro_DIAG_PIN_pull_down));
+		printk(KERN_INFO "%s %d pull down\n",  __func__, VILLE_GPIO_GYRO_DIAG);
+	} else {
+		config_gpio_table(gyro_DIAG_PIN_no_pull, ARRAY_SIZE(gyro_DIAG_PIN_no_pull));
+		printk(KERN_INFO "%s %d input none pull\n",  __func__, VILLE_GPIO_GYRO_DIAG);
+	}
+}
+
+static struct pana_gyro_platform_data pana_gyro_pdata = {
+	.acc_dir = 0x06,
+	.acc_polarity = 0x07,
+	.gyro_dir = 0x12,
+	.gyro_polarity = 0x05,
+	.mag_dir = 0x06,
+	.mag_polarity = 0x07,
+	.sleep_pin = VILLE_GPIO_PANA_GYRO_SLEEP,
+	.config_gyro_diag_gpios = config_ville_gyro_diag_gpios,
+};
+
+static struct bma250_platform_data gsensor_bma250_platform_data = {
+	.intr = VILLE_GPIO_GSENSOR_INT,
+	.chip_layout = 1,
+};
+
+static struct akm8975_platform_data compass_platform_data = {
+	.layouts = EVN_8960M_LAYOUTS,
+	.use_pana_gyro = 1,
+};
+
+static struct i2c_board_info __initdata msm_i2c_sensor_gsbi12_info[] = {
+	{
+		I2C_BOARD_INFO(BMA250_I2C_NAME, 0x30 >> 1),
+		.platform_data = &gsensor_bma250_platform_data,
+		.irq = MSM_GPIO_TO_INT(VILLE_GPIO_GSENSOR_INT),
+	},
+	{
+		I2C_BOARD_INFO(AKM8975_I2C_NAME, 0x1A >> 1),
+		.platform_data = &compass_platform_data,
+		.irq = MSM_GPIO_TO_INT(VILLE_GPIO_COMPASS_INT),
+	},
+	{
+		I2C_BOARD_INFO("ewtzmu2", 0xD2 >> 1),
+		.irq = MSM_GPIO_TO_INT(VILLE_GPIO_GYRO_INT),
+		.platform_data = &pana_gyro_pdata,
+	},
+};
+
+static struct cm3629_platform_data cm36282_TMO_EN1_pdata = {
+	.model = CAPELLA_CM36282,
+	.ps_select = CM3629_PS1_ONLY,
+	.intr = PM8921_GPIO_PM_TO_SYS(VILLE_PMGPIO_PROXIMITY_INTz),
+	.levels = { 8, 10, 12, 19, 283, 3094, 5313, 7847, 10383, 65535},
+	.golden_adc = 3857,
+	.power = NULL,
+	.cm3629_slave_address = 0xC0>>1,
+	.ps1_thd_set = 0x05,
+	.ps1_thd_no_cal = 0xF1,
+	.ps1_thd_with_cal = 0x05,
+	.ps_calibration_rule = 1,
+	.ps_conf1_val = CM3629_PS_DR_1_320 | CM3629_PS_IT_1_6T |
+			CM3629_PS1_PERS_1,
+	.ps_conf2_val = CM3629_PS_ITB_1 | CM3629_PS_ITR_1 |
+			CM3629_PS2_INT_DIS | CM3629_PS1_INT_DIS,
+	.ps_conf3_val = CM3629_PS2_PROL_32,
+	.no_need_change_setting = 1,
+};
+static struct i2c_board_info i2c_CM36282_TMO_EN1_devices[] = {
+	{
+		I2C_BOARD_INFO(CM3629_I2C_NAME, 0xC0 >> 1),
+		.platform_data = &cm36282_TMO_EN1_pdata,
+		.irq =  PM8921_GPIO_IRQ(PM8921_IRQ_BASE, VILLE_PMGPIO_PROXIMITY_INTz),
+	},
+};
+
+static struct cm3629_platform_data cm36282_TMO_pdata = {
+	.model = CAPELLA_CM36282,
+	.ps_select = CM3629_PS1_ONLY,
+	.intr = PM8921_GPIO_PM_TO_SYS(VILLE_PMGPIO_PROXIMITY_INTz),
+	.levels = { 8, 10, 12, 19, 283, 3094, 5313, 7847, 10383, 65535},
+	.golden_adc = 3857,
+	.power = NULL,
+	.cm3629_slave_address = 0xC0>>1,
+	.ps1_thd_set = 0x05,
+	.ps1_thd_no_cal = 0xF1,
+	.ps1_thd_with_cal = 0x05,
+	.ps_calibration_rule = 1,
+	.ps_conf1_val = CM3629_PS_DR_1_80 | CM3629_PS_IT_2T |
+			CM3629_PS1_PERS_1,
+	.ps_conf2_val = CM3629_PS_ITB_2 | CM3629_PS_ITR_1 |
+			CM3629_PS2_INT_DIS | CM3629_PS1_INT_DIS,
+	.ps_conf3_val = CM3629_PS2_PROL_32,
+};
+
+static struct i2c_board_info i2c_CM36282_TMO_devices[] = {
+	{
+		I2C_BOARD_INFO(CM3629_I2C_NAME, 0xC0 >> 1),
+		.platform_data = &cm36282_TMO_pdata,
+		.irq =  PM8921_GPIO_IRQ(PM8921_IRQ_BASE, VILLE_PMGPIO_PROXIMITY_INTz),
+	},
+};
+static struct cm3629_platform_data cm36282_XD_EN1_pdata = {
+	.model = CAPELLA_CM36282,
+	.ps_select = CM3629_PS1_ONLY,
+	.intr = PM8921_GPIO_PM_TO_SYS(VILLE_PMGPIO_PROXIMITY_INTz),
+	.levels = { 8, 10, 17, 134, 257, 2827, 4779, 6989, 9198, 65535},
+	.golden_adc = 3490,
+	.power = NULL,
+	.cm3629_slave_address = 0xC0>>1,
+	.ps1_thd_set = 0x05,
+	.ps1_thd_no_cal = 0xF1,
+	.ps1_thd_with_cal = 0x05,
+	.ps_calibration_rule = 1,
+	.ps_conf1_val = CM3629_PS_DR_1_320 | CM3629_PS_IT_1_6T |
+			CM3629_PS1_PERS_1,
+	.ps_conf2_val = CM3629_PS_ITB_1 | CM3629_PS_ITR_1 |
+			CM3629_PS2_INT_DIS | CM3629_PS1_INT_DIS,
+	.ps_conf3_val = CM3629_PS2_PROL_32,
+	.no_need_change_setting = 1,
+};
+
+static struct i2c_board_info i2c_CM36282_XD_EN1_devices[] = {
+	{
+		I2C_BOARD_INFO(CM3629_I2C_NAME, 0xC0 >> 1),
+		.platform_data = &cm36282_XD_EN1_pdata,
+		.irq =  PM8921_GPIO_IRQ(PM8921_IRQ_BASE, VILLE_PMGPIO_PROXIMITY_INTz),
+	},
+};
+
+static struct cm3629_platform_data cm36282_XD_pdata = {
+	.model = CAPELLA_CM36282,
+	.ps_select = CM3629_PS1_ONLY,
+	.intr = PM8921_GPIO_PM_TO_SYS(VILLE_PMGPIO_PROXIMITY_INTz),
+	.levels = { 8, 10, 17, 134, 257, 2827, 4779, 6989, 9198, 65535},
+	.golden_adc = 3490,
+	.power = NULL,
+	.cm3629_slave_address = 0xC0>>1,
+	.ps1_thd_set = 0x05,
+	.ps1_thd_no_cal = 0xF1,
+	.ps1_thd_with_cal = 0x05,
+	.ps_calibration_rule = 1,
+	.ps_conf1_val = CM3629_PS_DR_1_80 | CM3629_PS_IT_2T |
+			CM3629_PS1_PERS_1,
+	.ps_conf2_val = CM3629_PS_ITB_2 | CM3629_PS_ITR_1 |
+			CM3629_PS2_INT_DIS | CM3629_PS1_INT_DIS,
+	.ps_conf3_val = CM3629_PS2_PROL_32,
+};
+
+static struct i2c_board_info i2c_CM36282_XD_devices[] = {
+	{
+		I2C_BOARD_INFO(CM3629_I2C_NAME, 0xC0 >> 1),
+		.platform_data = &cm36282_XD_pdata,
+		.irq =  PM8921_GPIO_IRQ(PM8921_IRQ_BASE, VILLE_PMGPIO_PROXIMITY_INTz),
+	},
+};
+
+static struct cm3629_platform_data cm36282_pdata = {
+	.model = CAPELLA_CM36282,
+	.ps_select = CM3629_PS1_ONLY,
+	.intr = PM8921_GPIO_PM_TO_SYS(VILLE_PMGPIO_PROXIMITY_INTz),
+	.levels = { 8, 10, 33, 259, 516, 4881, 8411, 13023, 23251, 65535},
+	.golden_adc = 5573,
+	.power = NULL,
+	.cm3629_slave_address = 0xC0>>1,
+	.ps1_thd_set = 0x05,
+	.ps1_thd_no_cal = 0xF1,
+	.ps1_thd_with_cal = 0x05,
+	.ps_calibration_rule = 1,
+	.ps_conf1_val = CM3629_PS_DR_1_80 | CM3629_PS_IT_2T |
+			CM3629_PS1_PERS_1,
+	.ps_conf2_val = CM3629_PS_ITB_2 | CM3629_PS_ITR_1 |
+			CM3629_PS2_INT_DIS | CM3629_PS1_INT_DIS,
+	.ps_conf3_val = CM3629_PS2_PROL_32,
+};
+
+static struct i2c_board_info i2c_CM36282_devices[] = {
+	{
+		I2C_BOARD_INFO(CM3629_I2C_NAME, 0xC0 >> 1),
+		.platform_data = &cm36282_pdata,
+		.irq =  PM8921_GPIO_IRQ(PM8921_IRQ_BASE, VILLE_PMGPIO_PROXIMITY_INTz),
+	},
+};
+
+#define _GET_REGULATOR(var, name) do {				\
+	var = regulator_get(NULL, name);			\
+	if (IS_ERR(var)) {					\
+		pr_err("'%s' regulator not found, rc=%ld\n",	\
+			name, IS_ERR(var));			\
+		var = NULL;					\
+		return -ENODEV;					\
+	}							\
+} while (0)
+
+static uint32_t mhl_usb_switch_ouput_table[] = {
+	GPIO_CFG(VILLE_GPIO_MHL_USB_SELz, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_4MA),
+};
+
+void config_ville_mhl_gpios(void)
+{
+	config_gpio_table(mhl_usb_switch_ouput_table, ARRAY_SIZE(mhl_usb_switch_ouput_table));
+}
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+
+static void ville_usb_dpdn_switch(int path)
+{
+	switch (path) {
+	case PATH_USB:
+	case PATH_MHL:
+	{
+		int polarity = 1; /* high = mhl */
+		int mhl = (path == PATH_MHL);
+
+		config_gpio_table(mhl_usb_switch_ouput_table,
+				ARRAY_SIZE(mhl_usb_switch_ouput_table));
+
+		pr_info("[CABLE] %s: Set %s path\n", __func__, mhl ? "MHL" : "USB");
+		gpio_set_value(VILLE_GPIO_MHL_USB_SELz, (mhl ^ !polarity) ? 1 : 0);
+		break;
+	}
+	}
+	#ifdef CONFIG_FB_MSM_HDMI_MHL
+	sii9234_change_usb_owner((path == PATH_MHL) ? 1 : 0);
+	#endif /*CONFIG_FB_MSM_HDMI_MHL*/
+}
+#endif
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+static struct regulator *reg_8921_l12;
+static struct regulator *reg_8921_s4;
+static struct regulator *reg_8921_l16;
+static struct regulator *reg_8921_l10;
+static struct regulator *reg_8921_s2;
+uint32_t msm_hdmi_off_gpio[] = {
+	GPIO_CFG(VILLE_GPIO_HDMI_DDC_CLK,  0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	GPIO_CFG(VILLE_GPIO_HDMI_DDC_DATA,  0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	GPIO_CFG(VILLE_GPIO_HDMI_HPD,  0, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
+};
+
+uint32_t msm_hdmi_on_gpio[] = {
+	GPIO_CFG(VILLE_GPIO_HDMI_DDC_CLK,  1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_HDMI_DDC_DATA,  1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_HDMI_HPD,  1, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
+};
+
+static int mhl_sii9234_power_vote(bool enable)
+{
+	int rc;
+
+	if (!reg_8921_l10) {
+		_GET_REGULATOR(reg_8921_l10, "8921_l10");
+		rc = regulator_set_voltage(reg_8921_l10, 3000000, 3000000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_l10 failed rc=%d\n",
+					__func__, rc);
+			return rc;
+		}
+	}
+	if (!reg_8921_s2) {
+		_GET_REGULATOR(reg_8921_s2, "8921_s2");
+		rc = regulator_set_voltage(reg_8921_s2, 1300000, 1300000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_s2 failed rc=%d\n",
+					__func__, rc);
+			return rc;
+		}
+	}
+
+	if (enable) {
+		if (reg_8921_l10) {
+			rc = regulator_enable(reg_8921_l10);
+			if (rc)
+				pr_warning("'%s' regulator enable failed, rc=%d\n",
+						"reg_8921_l10", rc);
+		}
+		if (reg_8921_s2) {
+			rc = regulator_enable(reg_8921_s2);
+			if (rc)
+				pr_warning("'%s' regulator enable failed, rc=%d\n",
+						"reg_8921_s2", rc);
+		}
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		if (reg_8921_l10) {
+			rc = regulator_disable(reg_8921_l10);
+			if (rc)
+				pr_warning("'%s' regulator disable failed, rc=%d\n",
+						"reg_8921_l10", rc);
+		}
+		if (reg_8921_s2) {
+			rc = regulator_disable(reg_8921_s2);
+			if (rc)
+				pr_warning("'%s' regulator disable failed, rc=%d\n",
+						"reg_8921_s2", rc);
+		}
+		pr_info("%s(off): success\n", __func__);
+	}
+	return 0;
+}
+
+static void mhl_sii9234_1v2_power(bool enable)
+{
+	static bool prev_on;
+
+	if (enable == prev_on)
+		return;
+
+	if (enable) {
+		config_gpio_table(msm_hdmi_on_gpio, ARRAY_SIZE(msm_hdmi_on_gpio));
+		hdmi_hpd_feature(1);
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		config_gpio_table(msm_hdmi_off_gpio, ARRAY_SIZE(msm_hdmi_off_gpio));
+		hdmi_hpd_feature(0);
+		pr_info("%s(off): success\n", __func__);
+	}
+
+	prev_on = enable;
+}
+
+static int mhl_sii9234_all_power(bool enable)
+{
+	static bool prev_on;
+	int rc;
+	if (enable == prev_on)
+		return 0;
+
+	if (!reg_8921_s4)
+		_GET_REGULATOR(reg_8921_s4, "8921_s4");
+	if (!reg_8921_l16)
+		_GET_REGULATOR(reg_8921_l16, "8921_l16");
+	if (!reg_8921_l12)
+		_GET_REGULATOR(reg_8921_l12, "8921_l12");
+
+	if (enable) {
+		rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_s4 failed rc=%d\n",
+				__func__, rc);
+			return rc;
+		}
+		rc = regulator_set_voltage(reg_8921_l16, 3300000, 3300000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_l16 failed rc=%d\n",
+				__func__, rc);
+			return rc;
+		}
+
+		rc = regulator_set_voltage(reg_8921_l12, 1200000, 1200000);
+		if (rc) {
+			pr_err("%s: regulator_set_voltage reg_8921_l12 failed rc=%d\n",
+				__func__, rc);
+			return rc;
+		}
+		rc = regulator_enable(reg_8921_s4);
+
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"reg_8921_s4", rc);
+			return rc;
+		}
+		rc = regulator_enable(reg_8921_l16);
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"reg_8921_l16", rc);
+			return rc;
+		}
+
+		rc = regulator_enable(reg_8921_l12);
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"reg_8921_l12", rc);
+			return rc;
+		}
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		rc = regulator_disable(reg_8921_s4);
+		if (rc)
+			pr_warning("'%s' regulator disable failed, rc=%d\n",
+				"reg_8921_s4", rc);
+		rc = regulator_disable(reg_8921_l16);
+		if (rc)
+			pr_warning("'%s' regulator disable failed, rc=%d\n",
+				"reg_8921_l16", rc);
+		rc = regulator_disable(reg_8921_l12);
+		if (rc)
+			pr_warning("'%s' regulator disable failed, rc=%d\n",
+				"reg_8921_l12", rc);
+		pr_info("%s(off): success\n", __func__);
+	}
+
+	prev_on = enable;
+
+	return 0;
+}
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+static uint32_t mhl_gpio_table[] = {
+	GPIO_CFG(VILLE_GPIO_MHL_RSTz, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+	GPIO_CFG(VILLE_GPIO_MHL_INT, 0, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA),
+};
+
+
+static int mhl_sii9234_power(int on)
+{
+	int rc = 0;
+
+	switch (on) {
+	case 0:
+		mhl_sii9234_1v2_power(false);
+		break;
+	case 1:
+		mhl_sii9234_all_power(true);
+		config_gpio_table(mhl_gpio_table, ARRAY_SIZE(mhl_gpio_table));
+		break;
+	default:
+		pr_warning("%s(%d) got unsupport parameter!!!\n", __func__, on);
+		break;
+	}
+	return rc;
+}
+
+static T_MHL_PLATFORM_DATA mhl_sii9234_device_data = {
+	.gpio_intr = VILLE_GPIO_MHL_INT,
+	.gpio_reset = VILLE_GPIO_MHL_RSTz,
+	.ci2ca = 0,
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+	.mhl_usb_switch = ville_usb_dpdn_switch,
+	.mhl_1v2_power = mhl_sii9234_1v2_power,
+	.enable_5v = hdmi_enable_5v,
+	.mhl_power_vote = mhl_sii9234_power_vote,
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SUPERDEMO
+	.abs_x_min = 941,/* 0 */
+	.abs_x_max = 31664,/* 32767 */
+	.abs_y_min = 417,/* 0 */
+	.abs_y_max = 32053,/* 32767 */
+	.abs_pressure_min = 0,
+	.abs_pressure_max = 255,
+	.abs_width_min = 0,
+	.abs_width_max = 20,
+#endif
+#endif
+	.power = mhl_sii9234_power,
+};
+
+static struct i2c_board_info msm_i2c_gsbi8_mhl_sii9234_info[] =
+{
+	{
+		I2C_BOARD_INFO(MHL_SII9234_I2C_NAME, 0x72 >> 1),
+		.platform_data = &mhl_sii9234_device_data,
+		.irq = VILLE_GPIO_MHL_INT
+	},
+};
+
+#endif
+#endif
+
+static uint32_t usb_ID_PIN_input_table[] = {
+	GPIO_CFG(VILLE_GPIO_USB_ID1, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+
+static uint32_t usb_ID_PIN_ouput_table[] = {
+	GPIO_CFG(VILLE_GPIO_USB_ID1, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
+};
+
+void config_ville_usb_id_gpios(bool output)
+{
+	if (output) {
+		gpio_tlmm_config(usb_ID_PIN_ouput_table[0], GPIO_CFG_ENABLE);
+		gpio_set_value(VILLE_GPIO_USB_ID1, 1);
+		pr_info("[CABLE] %s: %d output high\n",  __func__, VILLE_GPIO_USB_ID1);
+	} else {
+		gpio_tlmm_config(usb_ID_PIN_input_table[0], GPIO_CFG_ENABLE);
+		pr_info("[CABLE] %s: %d input none pull\n",  __func__, VILLE_GPIO_USB_ID1);
+	}
+}
+
+int64_t ville_get_usbid_adc(void)
+{
+	struct pm8xxx_adc_chan_result result;
+	int err = 0, adc = 0;
+
+	err = pm8xxx_adc_mpp_config_read(PM8XXX_AMUX_MPP_7,
+					ADC_MPP_1_AMUX6, &result);
+	if (err) {
+		pr_info("[CABLE] %s: get adc fail, err %d\n", __func__, err);
+		return err;
+	}
+	pr_info("[CABLE] chan=%d, adc_code=%d, measurement=%lld, \
+			physical=%lld\n", result.chan, result.adc_code,
+			result.measurement, result.physical);
+	adc = result.physical;
+	return adc/1000;
+}
+
+static struct cable_detect_platform_data cable_detect_pdata = {
+	.detect_type		= CABLE_TYPE_PMIC_ADC,
+	.usb_id_pin_gpio	= VILLE_GPIO_USB_ID1,
+	.get_adc_cb		= ville_get_usbid_adc,
+	.config_usb_id_gpios	= config_ville_usb_id_gpios,
+	.mhl_reset_gpio = VILLE_GPIO_MHL_RSTz,
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+	.mhl_1v2_power = mhl_sii9234_1v2_power,
+	.usb_dpdn_switch	= ville_usb_dpdn_switch,
+#endif
+};
+
+static struct platform_device cable_detect_device = {
+	.name   = "cable_detect",
+	.id     = -1,
+	.dev    = {
+		.platform_data = &cable_detect_pdata,
+	},
+};
+
+static void ville_cable_detect_register(void)
+{
+	pr_info("%s\n", __func__);
+	platform_device_register(&cable_detect_device);
+}
+
+void ville_pm8xxx_adc_device_register(void)
+{
+	pr_info("%s: Register PM8921 ADC device\n", __func__);
+	headset_device_register();
+}
+
+#define MSM_SHARED_RAM_PHYS 0x80000000
+
+static void __init ville_map_io(void)
+{
+	msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
+	msm_map_msm8960_io();
+
+	if (socinfo_init() < 0)
+		pr_err("socinfo_init() failed!\n");
+}
+
+static void __init ville_init_irq(void)
+{
+	struct msm_mpm_device_data *data = NULL;
+
+#ifdef CONFIG_MSM_MPM
+	data = &msm8960_mpm_dev_data;
+#endif
+
+	msm_mpm_irq_extn_init(data);
+	gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
+						(void *)MSM_QGIC_CPU_BASE);
+
+	/* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
+	writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
+
+	writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
+	mb();
+}
+
+static void __init msm8960_init_buses(void)
+{
+#ifdef CONFIG_MSM_BUS_SCALING
+	msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
+	msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
+	msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
+	msm_bus_apps_fabric.dev.platform_data =
+		&msm_bus_8960_apps_fabric_pdata;
+	msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
+	msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
+	msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
+	msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
+	msm_bus_rpm_set_mt_mask();
+#endif
+}
+
+static struct msm_spi_platform_data msm8960_qup_spi_gsbi10_pdata = {
+  .max_clock_speed = 27000000,
+};
+
+#ifdef CONFIG_USB_MSM_OTG_72K
+static struct msm_otg_platform_data msm_otg_pdata;
+#else
+#define USB_5V_EN		42
+static int msm_hsusb_vbus_power(bool on)
+{
+	int rc;
+	static bool vbus_is_on;
+	static struct regulator *mvs_otg_switch;
+	struct pm_gpio param = {
+		.direction	= PM_GPIO_DIR_OUT,
+		.output_buffer	= PM_GPIO_OUT_BUF_CMOS,
+		.output_value	= 1,
+		.pull		= PM_GPIO_PULL_NO,
+		.vin_sel	= PM_GPIO_VIN_S4,
+		.out_strength	= PM_GPIO_STRENGTH_MED,
+		.function	= PM_GPIO_FUNC_NORMAL,
+	};
+
+	printk(KERN_ERR "%s: vbus_is_on=%d\n", __func__, on);
+	if (vbus_is_on == on)
+		return 0;
+
+	printk(KERN_INFO "%s: %d\n", __func__, on);
+
+	if (on) {
+		mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
+					       "vbus_otg");
+		if (IS_ERR(mvs_otg_switch)) {
+			pr_err("Unable to get mvs_otg_switch\n");
+			return -1;
+		}
+
+		rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
+						"usb_5v_en");
+		if (rc < 0) {
+			pr_err("failed to request usb_5v_en gpio\n");
+			goto put_mvs_otg;
+		}
+
+		if (regulator_enable(mvs_otg_switch)) {
+			pr_err("unable to enable mvs_otg_switch\n");
+			goto free_usb_5v_en;
+		}
+
+		rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
+				&param);
+		if (rc < 0) {
+			pr_err("failed to configure usb_5v_en gpio\n");
+			goto disable_mvs_otg;
+		}
+		vbus_is_on = true;
+		return 0;
+	}
+disable_mvs_otg:
+		regulator_disable(mvs_otg_switch);
+free_usb_5v_en:
+		gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
+put_mvs_otg:
+		regulator_put(mvs_otg_switch);
+		vbus_is_on = false;
+		return -1;
+}
+
+static int phy_init_seq_v3[] = { 0x7f, 0x81, 0x3c, 0x82, -1};
+static int phy_init_seq_v3_2_1[] = { 0x5f, 0x81, 0x3c, 0x82, -1};
+
+static struct msm_otg_platform_data msm_otg_pdata = {
+	.phy_init_seq		= phy_init_seq_v3,
+	.mode			= USB_OTG,
+	.otg_control		= OTG_PMIC_CONTROL,
+	.phy_type		= SNPS_28NM_INTEGRATED_PHY,
+//	.pmic_id_irq		= PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
+	.vbus_power		= msm_hsusb_vbus_power,
+	.power_budget		= 750,
+//	.ldo_power_collapse	= true,
+};
+#endif
+
+/* #ifdef CONFIG_USB_ANDROID_DIAG */
+#define PID_MAGIC_ID		0x71432909
+#define SERIAL_NUM_MAGIC_ID	0x61945374
+#define SERIAL_NUMBER_LENGTH	127
+#define DLOAD_USB_BASE_ADD	0x2A03F0C8
+
+struct magic_num_struct {
+	uint32_t pid;
+	uint32_t serial_num;
+};
+
+struct dload_struct {
+	uint32_t	reserved1;
+	uint32_t	reserved2;
+	uint32_t	reserved3;
+	uint16_t	reserved4;
+	uint16_t	pid;
+	char		serial_number[SERIAL_NUMBER_LENGTH];
+	uint16_t	reserved5;
+	struct magic_num_struct magic_struct;
+};
+
+static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
+{
+	struct dload_struct __iomem *dload = 0;
+
+	dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
+	if (!dload) {
+		pr_err("%s: cannot remap I/O memory region: %08x\n",
+					__func__, DLOAD_USB_BASE_ADD);
+		return -ENXIO;
+	}
+
+	pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
+				__func__, dload, pid, snum);
+	/* update pid */
+	dload->magic_struct.pid = PID_MAGIC_ID;
+	dload->pid = pid;
+
+	/* update serial number */
+	dload->magic_struct.serial_num = 0;
+	if (!snum) {
+		memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
+		goto out;
+	}
+
+	dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
+	strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
+out:
+	iounmap(dload);
+	return 0;
+}
+
+static struct android_usb_platform_data android_usb_pdata = {
+	.update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
+};
+
+static struct platform_device android_usb_device = {
+	.name	= "android_usb",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &android_usb_pdata,
+	},
+};
+
+#define VERSION_ID (readl(HW_VER_ID_VIRT) & 0xf0000000) >> 28
+#define HW_8960_V3_2_1   0x07
+void ville_add_usb_devices(void)
+{
+	if (VERSION_ID == HW_8960_V3_2_1) {
+		printk(KERN_INFO "%s rev: %d v3.2.1\n", __func__, system_rev);
+		msm_otg_pdata.phy_init_seq = phy_init_seq_v3_2_1;
+	} else {
+		printk(KERN_INFO "%s rev: %d\n", __func__, system_rev);
+		msm_otg_pdata.phy_init_seq = phy_init_seq_v3;
+	}
+	printk(KERN_INFO "%s: OTG_PMIC_CONTROL in rev: %d\n",
+			__func__, system_rev);
+}
+
+static uint8_t spm_wfi_cmd_sequence[] __initdata = {
+			0x03, 0x0f,
+};
+
+static uint8_t spm_retention_cmd_sequence[] __initdata = {
+			0x00, 0x05, 0x03, 0x0D,
+			0x0B, 0x00, 0x0f,
+};
+
+static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
+	0x42, 0x1B, 0x00,
+	0x05, 0x03, 0x0D, 0x0B,
+	0x00, 0x42, 0x1B,
+	0x0f,
+};
+
+static uint8_t spm_power_collapse_without_rpm[] __initdata = {
+			0x00, 0x24, 0x54, 0x10,
+			0x09, 0x03, 0x01,
+			0x10, 0x54, 0x30, 0x0C,
+			0x24, 0x30, 0x0f,
+};
+
+static uint8_t spm_power_collapse_with_rpm[] __initdata = {
+			0x00, 0x24, 0x54, 0x10,
+			0x09, 0x07, 0x01, 0x0B,
+			0x10, 0x54, 0x30, 0x0C,
+			0x24, 0x30, 0x0f,
+};
+
+/* 8960AB has a different command to assert apc_pdn */
+static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
+	0x00, 0x24, 0x84, 0x10,
+	0x09, 0x03, 0x01,
+	0x10, 0x84, 0x30, 0x0C,
+	0x24, 0x30, 0x0f,
+};
+
+static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
+	0x00, 0x24, 0x84, 0x10,
+	0x09, 0x07, 0x01, 0x0B,
+	0x10, 0x84, 0x30, 0x0C,
+	0x24, 0x30, 0x0f,
+};
+
+static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_MODE_CLOCK_GATING,
+		.notify_rpm = false,
+		.cmd = spm_wfi_cmd_sequence,
+	},
+
+	[1] = {
+		.mode = MSM_SPM_MODE_POWER_RETENTION,
+		.notify_rpm = false,
+		.cmd = spm_retention_cmd_sequence,
+	},
+
+	[2] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = false,
+		.cmd = spm_power_collapse_without_rpm,
+	},
+	[3] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = spm_power_collapse_with_rpm,
+	},
+};
+
+static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_MODE_CLOCK_GATING,
+		.notify_rpm = false,
+		.cmd = spm_wfi_cmd_sequence,
+	},
+
+	[1] = {
+		.mode = MSM_SPM_MODE_POWER_RETENTION,
+		.notify_rpm = false,
+		.cmd = spm_retention_cmd_sequence,
+	},
+
+	[2] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = false,
+		.cmd = spm_power_collapse_without_rpm,
+	},
+
+	[3] = {
+		.mode = MSM_SPM_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = spm_power_collapse_with_rpm,
+	},
+};
+
+static struct msm_spm_platform_data msm_spm_data[] __initdata = {
+	[0] = {
+		.reg_base_addr = MSM_SAW0_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
+#if defined(CONFIG_MSM_AVS_HW)
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
+#endif
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
+		.vctl_timeout_us = 50,
+		.num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
+		.modes = msm_spm_boot_cpu_seq_list,
+	},
+	[1] = {
+		.reg_base_addr = MSM_SAW1_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
+#if defined(CONFIG_MSM_AVS_HW)
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x58589464,
+		.reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00020000,
+#endif
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
+		.vctl_timeout_us = 50,
+		.num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
+		.modes = msm_spm_nonboot_cpu_seq_list,
+	},
+};
+
+static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
+			0x00, 0x20, 0x03, 0x20,
+			0x00, 0x0f,
+};
+
+static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
+			0x00, 0x20, 0x34, 0x64,
+			0x48, 0x07, 0x48, 0x20,
+			0x50, 0x64, 0x04, 0x34,
+			0x50, 0x0f,
+};
+static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
+			0x00, 0x10, 0x34, 0x64,
+			0x48, 0x07, 0x48, 0x10,
+			0x50, 0x64, 0x04, 0x34,
+			0x50, 0x0F,
+};
+
+static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
+	[0] = {
+		.mode = MSM_SPM_L2_MODE_RETENTION,
+		.notify_rpm = false,
+		.cmd = l2_spm_wfi_cmd_sequence,
+	},
+	[1] = {
+		.mode = MSM_SPM_L2_MODE_GDHS,
+		.notify_rpm = true,
+		.cmd = l2_spm_gdhs_cmd_sequence,
+	},
+	[2] = {
+		.mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
+		.notify_rpm = true,
+		.cmd = l2_spm_power_off_cmd_sequence,
+	},
+};
+
+static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
+	[0] = {
+		.reg_base_addr = MSM_SAW_L2_BASE,
+		.reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
+		.reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
+		.modes = msm_spm_l2_seq_list,
+		.num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
+	},
+};
+
+#ifdef CONFIG_PERFLOCK
+static unsigned ville_perf_acpu_table[] = {
+	810000000, /* LOWEST */
+	918000000, /* LOW */
+	1026000000, /* MEDIUM */
+	1242000000,/* HIGH */
+	1512000000, /* HIGHEST */
+};
+
+static unsigned ville_cpufreq_ceiling_acpu_table[] = {
+	702000000,
+	918000000,
+	1026000000,
+};
+
+static struct perflock_data ville_perflock_data = {
+	.perf_acpu_table = ville_perf_acpu_table,
+	.table_size = ARRAY_SIZE(ville_perf_acpu_table),
+};
+
+static struct perflock_data ville_cpufreq_ceiling_data = {
+	.perf_acpu_table = ville_cpufreq_ceiling_acpu_table,
+	.table_size = ARRAY_SIZE(ville_cpufreq_ceiling_acpu_table),
+};
+
+static struct perflock_pdata perflock_pdata = {
+	.perf_floor = &ville_perflock_data,
+	.perf_ceiling = &ville_cpufreq_ceiling_data,
+};
+
+struct platform_device msm8960_device_perf_lock = {
+	.name = "perf_lock",
+	.id = -1,
+	.dev = {
+		.platform_data = &perflock_pdata,
+	},
+};
+#endif
+
+static uint32_t gsbi3_gpio_table[] = {
+	GPIO_CFG(VILLE_GPIO_TP_I2C_DAT, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_TP_I2C_CLK, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi3_gpio_table_gpio[] = {
+	GPIO_CFG(VILLE_GPIO_TP_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_TP_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+/* CAMERA setting */
+static uint32_t gsbi4_gpio_table[] = {
+	GPIO_CFG(VILLE_GPIO_CAM_I2C_DAT, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_CAM_I2C_CLK, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi4_gpio_table_gpio[] = {
+	GPIO_CFG(VILLE_GPIO_CAM_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_CAM_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+/* cap sensor*/
+static uint32_t gsbi5_gpio_table[] = {
+	GPIO_CFG(VILLE_GPIO_CAP_I2C_DAT, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_CAP_I2C_CLK, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi5_gpio_table_gpio[] = {
+	GPIO_CFG(VILLE_GPIO_CAP_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_CAP_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi8_gpio_table[] = {
+	GPIO_CFG(VILLE_GPIO_MC_I2C_DAT, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_MC_I2C_CLK, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi8_gpio_table_gpio[] = {
+	GPIO_CFG(VILLE_GPIO_MC_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_MC_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi12_gpio_table[] = {
+	GPIO_CFG(VILLE_GPIO_SR_I2C_DAT, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_SR_I2C_CLK, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static uint32_t gsbi12_gpio_table_gpio[] = {
+	GPIO_CFG(VILLE_GPIO_SR_I2C_DAT, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(VILLE_GPIO_SR_I2C_CLK, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+};
+
+static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
+{
+	printk(KERN_INFO "%s(): adap_id = %d, config_type = %d \n", __func__, adap_id, config_type);
+
+	if ((adap_id == MSM_8960_GSBI3_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi3_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi3_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI3_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi3_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi3_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+
+	/* CAMERA setting */
+	if ((adap_id == MSM_8960_GSBI4_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi4_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi4_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI4_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi4_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi4_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI5_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi5_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi5_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI5_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi5_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi5_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI8_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi8_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi8_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI8_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi8_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi8_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI12_QUP_I2C_BUS_ID) && (config_type == 1)) {
+		gpio_tlmm_config(gsbi12_gpio_table[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi12_gpio_table[1], GPIO_CFG_ENABLE);
+	}
+
+	if ((adap_id == MSM_8960_GSBI12_QUP_I2C_BUS_ID) && (config_type == 0)) {
+		gpio_tlmm_config(gsbi12_gpio_table_gpio[0], GPIO_CFG_ENABLE);
+		gpio_tlmm_config(gsbi12_gpio_table_gpio[1], GPIO_CFG_ENABLE);
+	}
+}
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi5_pdata = {
+	.clk_freq = 100000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi8_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+//	.share_uart_flag = 1,	/* check if QUP-I2C and Uart share the gisb */
+};
+
+static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
+	.clk_freq = 400000,
+	.src_clk_rate = 24000000,
+	.msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
+};
+
+static struct platform_device msm_device_saw_core0 = {
+	.name          = "saw-regulator",
+	.id            = 0,
+	.dev	= {
+		.platform_data = &msm_saw_regulator_pdata_s5,
+	},
+};
+
+static struct platform_device msm_device_saw_core1 = {
+	.name          = "saw-regulator",
+	.id            = 1,
+	.dev	= {
+		.platform_data = &msm_saw_regulator_pdata_s6,
+	},
+};
+
+static struct tsens_platform_data msm_tsens_pdata  = {
+		.slope			= {910, 910, 910, 910, 910},
+		.tsens_factor		= 1000,
+		.hw_type		= MSM_8960,
+		.tsens_num_sensor	= 5,
+};
+
+static struct platform_device msm_tsens_device = {
+	.name   = "tsens8960-tm",
+	.id = -1,
+};
+
+static struct msm_thermal_data msm_thermal_pdata = {
+	.sensor_id = 0,
+	.poll_ms = 1000,
+	.limit_temp_degC = 60,
+	.temp_hysteresis_degC = 10,
+//	.limit_freq = 918000,
+	.freq_step = 2,
+};
+
+#ifdef CONFIG_MSM_FAKE_BATTERY
+static struct platform_device fish_battery_device = {
+	.name = "fish_battery",
+};
+#endif
+
+static struct platform_device scm_memchk_device = {
+	.name		= "scm-memchk",
+	.id		= -1,
+};
+
+static struct platform_device ville_device_rpm_regulator __devinitdata = {
+	.name	= "rpm-regulator",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &ville_rpm_regulator_pdata,
+	},
+};
+
+static struct platform_device *common_devices[] __initdata = {
+	&msm8960_device_acpuclk,
+	&msm8960_device_dmov,
+	&msm_device_smd,
+	&msm8960_device_uart_gsbi8,
+	&msm_device_uart_dm6,
+	&msm_device_saw_core0,
+	&msm_device_saw_core1,
+	&msm8960_device_ext_5v_vreg,
+	&msm8960_device_qup_i2c_gsbi3,
+	&msm8960_device_qup_i2c_gsbi4,
+	&msm8960_device_qup_i2c_gsbi5,
+	&msm8960_device_qup_i2c_gsbi8,
+	&msm8960_device_qup_spi_gsbi10,
+#ifndef CONFIG_MSM_DSPS
+	&msm8960_device_qup_i2c_gsbi12,
+#endif
+	&msm8960_device_ssbi_pmic,
+	&msm_slim_ctrl,
+	&msm_device_wcnss_wlan,
+#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
+		defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
+	&qcrypto_device,
+#endif
+
+#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
+		defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
+	&qcedev_device,
+#endif
+#ifdef CONFIG_MSM_ROTATOR
+	&msm_rotator_device,
+#endif
+	&msm8960_cpu_slp_status,
+	&msm_device_sps,
+#ifdef CONFIG_MSM_FAKE_BATTERY
+	&fish_battery_device,
+#endif
+	&fmem_device,
+#ifdef CONFIG_ANDROID_PMEM
+#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
+	&android_pmem_device,
+	&android_pmem_adsp_device,
+	&android_pmem_audio_device,
+#endif
+#endif
+	&msm_device_vidc,
+	&msm_device_bam_dmux,
+	&msm_fm_platform_init,
+#ifdef CONFIG_HW_RANDOM_MSM
+	&msm_device_rng,
+#endif
+#ifdef CONFIG_ION_MSM
+	&ion_dev,
+#endif
+	&msm8960_rpm_device,
+	&msm8960_rpm_log_device,
+	&msm8960_rpm_stat_device,
+#ifdef CONFIG_MSM_QDSS
+	&msm_etb_device,
+	&msm_tpiu_device,
+	&msm_funnel_device,
+	&msm_etm_device,
+#endif
+	&msm8960_device_watchdog,
+#ifdef CONFIG_MSM_RTB
+	&msm_rtb_device,
+#endif
+	&msm8960_device_cache_erp,
+	&msm8960_iommu_domain_device,
+#ifdef CONFIG_MSM_CACHE_DUMP
+	&msm_cache_dump_device,
+#endif
+#ifdef CONFIG_HTC_BATT_8960
+	&htc_battery_pdev,
+#endif
+	&msm_tsens_device,
+};
+
+static struct platform_device *ville_devices[] __initdata = {
+	&msm_8960_q6_lpass,
+	&msm_8960_q6_mss_fw,
+	&msm_8960_q6_mss_sw,
+	&msm_8960_riva,
+	&msm_pil_tzapps,
+	&msm8960_device_otg,
+	&msm8960_device_gadget_peripheral,
+	&msm_device_hsusb_host,
+	&android_usb_device,
+	&msm_pcm,
+	&msm_pcm_routing,
+	&msm_multi_ch_pcm,
+	&msm_cpudai0,
+	&msm_cpudai1,
+	&msm8960_cpudai_slimbus_2_tx,
+	&msm8960_cpudai_slimbus_2_rx,
+	&msm_cpudai_hdmi_rx,
+	&msm_cpudai_bt_rx,
+	&msm_cpudai_bt_tx,
+	&msm_cpudai_fm_rx,
+	&msm_cpudai_fm_tx,
+	&msm_cpudai_auxpcm_rx,
+	&msm_cpudai_auxpcm_tx,
+	&msm_cpu_fe,
+	&msm_stub_codec,
+#ifdef CONFIG_MSM_GEMINI
+	&msm8960_gemini_device,
+#endif
+	&msm_voice,
+	&msm_voip,
+	&msm_lpa_pcm,
+	&msm_cpudai_afe_01_rx,
+	&msm_cpudai_afe_01_tx,
+	&msm_cpudai_afe_02_rx,
+	&msm_cpudai_afe_02_tx,
+	&msm_pcm_afe,
+	&msm_compr_dsp,
+	&msm_cpudai_incall_music_rx,
+	&msm_cpudai_incall_record_rx,
+	&msm_cpudai_incall_record_tx,
+	&msm_pcm_hostless,
+	&msm_lowlatency_pcm,
+	&msm_bus_apps_fabric,
+	&msm_bus_sys_fabric,
+	&msm_bus_mm_fabric,
+	&msm_bus_sys_fpb,
+	&msm_bus_cpss_fpb,
+	&msm_device_tz_log,
+#ifdef CONFIG_PERFLOCK
+	&msm8960_device_perf_lock,
+#endif
+	&scm_memchk_device,
+};
+
+static void __init msm8960_i2c_init(void)
+{
+	msm8960_device_qup_i2c_gsbi4.dev.platform_data =
+					&msm8960_i2c_qup_gsbi4_pdata;
+
+	msm8960_device_qup_i2c_gsbi3.dev.platform_data =
+					&msm8960_i2c_qup_gsbi3_pdata;
+
+	msm8960_device_qup_i2c_gsbi5.dev.platform_data =
+					&msm8960_i2c_qup_gsbi5_pdata;
+
+	msm8960_device_qup_i2c_gsbi8.dev.platform_data =
+					&msm8960_i2c_qup_gsbi8_pdata;
+
+	msm8960_device_qup_i2c_gsbi12.dev.platform_data =
+					&msm8960_i2c_qup_gsbi12_pdata;
+}
+
+static void __init msm8960_gfx_init(void)
+{
+	struct kgsl_device_platform_data *kgsl_3d0_pdata =
+		msm_kgsl_3d0.dev.platform_data;
+	uint32_t soc_platform_version = socinfo_get_version();
+
+	/* Fixup data that needs to change based on GPU ID */
+	if (cpu_is_msm8960ab()) {
+		kgsl_3d0_pdata->chipid = ADRENO_CHIPID(3, 2, 1, 0);
+		/* 8960PRO nominal clock rate is 320Mhz */
+		kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 320000000;
+	} else {
+		kgsl_3d0_pdata->iommu_count = 1;
+		if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
+			kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
+			kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
+		}
+		if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) {
+			/* 8960v3 GPU registers returns 5 for patch release
+			 * but it should be 6, so dummy up the chipid here
+			 * based the platform type
+			 */
+			kgsl_3d0_pdata->chipid = ADRENO_CHIPID(2, 2, 0, 6);
+		}
+	}
+
+	/* Register the 3D core */
+	platform_device_register(&msm_kgsl_3d0);
+
+	/* Register the 2D cores if we are not 8960PRO */
+	if (!cpu_is_msm8960ab()) {
+		platform_device_register(&msm_kgsl_2d0);
+		platform_device_register(&msm_kgsl_2d1);
+	}
+}
+
+#ifdef CONFIG_HTC_BATT_8960
+static struct pm8921_charger_batt_param chg_batt_params[] = {
+	/* for normal type battery */
+	[0] = {
+		.max_voltage = 4200,
+		.cool_bat_voltage = 4200,
+		.warm_bat_voltage = 4000,
+	},
+	/* for HV type battery */
+	[1] = {
+		.max_voltage = 4340,
+		.cool_bat_voltage = 4340,
+		.warm_bat_voltage = 4000,
+	},
+	
+	[2] = {
+		.max_voltage = 4300,
+		.cool_bat_voltage = 4300,
+		.warm_bat_voltage = 4000,
+	},
+	
+	[3] = {
+		.max_voltage = 4350,
+		.cool_bat_voltage = 4350,
+		.warm_bat_voltage = 4000,
+	},
+};
+
+static struct single_row_lut fcc_temp_id_1 = {
+	.x		= {-20, 0, 25, 40, 65},
+	.y		= {1620, 1630, 1640, 1641, 1640},
+	.cols	= 5
+};
+
+static struct single_row_lut fcc_sf_id_1 = {
+	.x		= {0},
+	.y		= {100},
+	.cols	= 1
+};
+
+static struct sf_lut pc_sf_id_1 = {
+	.rows		= 10,
+	.cols		= 5,
+	
+	.row_entries	= {100, 200, 300, 400, 500},
+	.percent	= {100, 90, 80, 70, 60, 50, 40, 30, 20, 10},
+	.sf		= {
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100}
+	},
+};
+
+static struct pc_temp_ocv_lut pc_temp_ocv_id_1 = {
+	.rows		= 29,
+	.cols		= 5,
+	.temp		= {-20, 0, 25, 40, 65},
+	.percent	= {100, 95, 90, 85, 80, 75, 70, 65, 60, 55,
+				50, 45, 40, 35, 30, 25, 20, 15, 10, 9,
+				8, 7, 6, 5, 4, 3, 2, 1, 0},
+	.ocv		= {
+				{4157, 4174, 4172, 4169, 4165},
+				{4104, 4131, 4133, 4131, 4125},
+				{4041, 4086, 4093, 4092, 4087},
+				{3985, 4050, 4059, 4058, 4054},
+				{3939, 4002, 4016, 4015, 4010},
+				{3899, 3962, 3980, 3979, 3974},
+				{3869, 3925, 3948, 3947, 3942},
+				{3845, 3892, 3919, 3919, 3914},
+				{3825, 3862, 3884, 3886, 3883},
+				{3809, 3839, 3852, 3855, 3854},
+				{3792, 3818, 3826, 3827, 3827},
+				{3776, 3797, 3803, 3803, 3802},
+				{3762, 3786, 3792, 3792, 3791},
+				{3747, 3754, 3770, 3767, 3764},
+				{3730, 3735, 3762, 3758, 3741},
+				{3713, 3722, 3750, 3744, 3723},
+				{3692, 3715, 3726, 3720, 3704},
+				{3666, 3701, 3689, 3683, 3670},
+				{3626, 3671, 3664, 3659, 3646},
+				{3620, 3667, 3661, 3658, 3645},
+				{3612, 3663, 3659, 3655, 3642},
+				{3604, 3659, 3657, 3653, 3640},
+				{3595, 3651, 3653, 3648, 3633},
+				{3582, 3637, 3638, 3632, 3614},
+				{3566, 3616, 3611, 3602, 3587},
+				{3544, 3584, 3575, 3567, 3551},
+				{3514, 3538, 3527, 3521, 3508},
+				{3466, 3477, 3468, 3466, 3453},
+				{3357, 3370, 3369, 3367, 3362}
+	}
+};
+
+struct pm8921_bms_battery_data bms_battery_data_id_1 = {
+	.fcc			= 1650,
+	.fcc_temp_lut		= &fcc_temp_id_1,
+	.fcc_sf_lut		= &fcc_sf_id_1,
+	.pc_temp_ocv_lut	= &pc_temp_ocv_id_1,
+	.pc_sf_lut		= &pc_sf_id_1,
+};
+
+static struct single_row_lut fcc_temp_id_2 = {
+	.x		= {-20, 0, 25, 40, 65},
+	.y		= {1631, 1642, 1643, 1641, 1642},
+	.cols	= 5
+};
+
+static struct single_row_lut fcc_sf_id_2 = {
+	.x		= {0},
+	.y		= {100},
+	.cols	= 1
+};
+
+static struct sf_lut pc_sf_id_2 = {
+	.rows		= 10,
+	.cols		= 5,
+	
+	.row_entries	= {100, 200, 300, 400, 500},
+	.percent	= {100, 90, 80, 70, 60, 50, 40, 30, 20, 10},
+	.sf		= {
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100},
+			{100, 100, 100, 100, 100}
+	},
+};
+
+static struct pc_temp_ocv_lut  pc_temp_ocv_id_2 = {
+	.rows		= 29,
+	.cols		= 5,
+	.temp		= {-20, 0, 25, 40, 65},
+	.percent	= {100, 95, 90, 85, 80, 75, 70, 65, 60, 55,
+				50, 45, 40, 35, 30, 25, 20, 15, 10, 9,
+				8, 7, 6, 5, 4, 3, 2, 1, 0},
+	.ocv		= {
+				{4156 ,4154 ,4151 ,4147 ,4150},
+				{4112 ,4123 ,4123 ,4120 ,4125},
+				{4062 ,4074 ,4079 ,4076 ,4081},
+				{4007 ,4027 ,4038 ,4035 ,4039},
+				{3956 ,3981 ,4000 ,3998 ,4001},
+				{3921 ,3945 ,3966 ,3964 ,3965},
+				{3887 ,3913 ,3936 ,3935 ,3934},
+				{3855 ,3883 ,3905 ,3907 ,3906},
+				{3828 ,3857 ,3863 ,3876 ,3877},
+				{3807 ,3833 ,3837 ,3836 ,3841},
+				{3789 ,3813 ,3816 ,3815 ,3814},
+				{3775 ,3792 ,3801 ,3799 ,3799},
+				{3764 ,3774 ,3788 ,3785 ,3785},
+				{3752 ,3762 ,3778 ,3775 ,3774},
+				{3739 ,3750 ,3770 ,3767 ,3760},
+				{3724 ,3739 ,3762 ,3757 ,3741},
+				{3706 ,3727 ,3742 ,3735 ,3720},
+				{3681 ,3714 ,3711 ,3703 ,3687},
+				{3641 ,3685 ,3676 ,3668 ,3654},
+				{3635 ,3681 ,3675 ,3667 ,3653},
+				{3628 ,3677 ,3673 ,3666 ,3651},
+				{3620 ,3672 ,3672 ,3665 ,3650},
+				{3610 ,3666 ,3670 ,3662 ,3646},
+				{3599 ,3656 ,3662 ,3653 ,3633},
+				{3585 ,3639 ,3641 ,3632 ,3608},
+				{3566 ,3612 ,3608 ,3599 ,3574},
+				{3537 ,3571 ,3564 ,3556 ,3530},
+				{3487 ,3506 ,3502 ,3494 ,3468},
+				{3360 ,3371 ,3371 ,3368 ,3366}
+	}
+};
+
+struct pm8921_bms_battery_data bms_battery_data_id_2 = {
+	.fcc			= 1650,
+	.fcc_temp_lut		= &fcc_temp_id_2,
+	.fcc_sf_lut		= &fcc_sf_id_2,
+	.pc_temp_ocv_lut	= &pc_temp_ocv_id_2,
+	.pc_sf_lut		= &pc_sf_id_2,
+};
+
+static struct htc_battery_cell htc_battery_cells[] = {
+	[0] = {
+		.model_name = "BJ40100",
+		.capacity = 1650,
+		.id = 1,
+		.id_raw_min = 0, /* unit:mV (22kohm) */
+		.id_raw_max = 330,
+		.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+		.voltage_max = 4200,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[0],
+		.gauge_param = &bms_battery_data_id_1,
+	},
+	[1] = {
+		.model_name = "BJ40100",
+		.capacity = 1650,
+		.id = 2,
+		.id_raw_min = 331, /* unit:mV (33kohm) */
+		.id_raw_max = 540,
+		.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+		.voltage_max = 4200,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[0],
+		.gauge_param = &bms_battery_data_id_2,
+	},
+	[2] = {
+		.model_name = "UNKNOWN",
+		.capacity = 1650,
+		.id = 255,
+		.id_raw_min = INT_MIN,
+		.id_raw_max = INT_MAX,
+		.type = HTC_BATTERY_CELL_TYPE_NORMAL,
+		.voltage_max = 4200,
+		.voltage_min = 3200,
+		.chg_param = &chg_batt_params[0],
+		.gauge_param = NULL,
+	},
+};
+#endif /* CONFIG_HTC_BATT_8960 */
+
+static struct msm_rpmrs_level msm_rpmrs_levels[] = {
+	{
+		MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		1, 784, 180000, 100,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_RETENTION,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		415, 715, 340827, 475,
+	},
+#ifdef CONFIG_MSM_STANDALONE_POWER_COLLAPSE
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
+		MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
+		true,
+		1300, 228, 1200000, 2000,
+	},
+#endif
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
+		false,
+		2000, 138, 1208400, 3200,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
+		false,
+		6000, 119, 1850300, 9000,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
+		false,
+		9200, 68, 2839200, 16400,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
+		false,
+		10300, 63, 3128000, 18200,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
+		false,
+		18000, 10, 4602600, 27000,
+	},
+
+	{
+		MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
+		MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
+		false,
+		20000, 2, 5752000, 32000,
+	},
+};
+
+
+static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
+	.levels = &msm_rpmrs_levels[0],
+	.num_levels = ARRAY_SIZE(msm_rpmrs_levels),
+	.vdd_mem_levels  = {
+		[MSM_RPMRS_VDD_MEM_RET_LOW]	= 750000,
+		[MSM_RPMRS_VDD_MEM_RET_HIGH]	= 750000,
+		[MSM_RPMRS_VDD_MEM_ACTIVE]	= 1050000,
+		[MSM_RPMRS_VDD_MEM_MAX]		= 1150000,
+	},
+	.vdd_dig_levels = {
+		[MSM_RPMRS_VDD_DIG_RET_LOW]	= 500000,
+		[MSM_RPMRS_VDD_DIG_RET_HIGH]	= 750000,
+		[MSM_RPMRS_VDD_DIG_ACTIVE]	= 950000,
+		[MSM_RPMRS_VDD_DIG_MAX]		= 1150000,
+	},
+	.vdd_mask = 0x7FFFFF,
+	.rpmrs_target_id = {
+		[MSM_RPMRS_ID_PXO_CLK]		= MSM_RPM_ID_PXO_CLK,
+		[MSM_RPMRS_ID_L2_CACHE_CTL]	= MSM_RPM_ID_LAST,
+		[MSM_RPMRS_ID_VDD_DIG_0]	= MSM_RPM_ID_PM8921_S3_0,
+		[MSM_RPMRS_ID_VDD_DIG_1]	= MSM_RPM_ID_PM8921_S3_1,
+		[MSM_RPMRS_ID_VDD_MEM_0]	= MSM_RPM_ID_PM8921_L24_0,
+		[MSM_RPMRS_ID_VDD_MEM_1]	= MSM_RPM_ID_PM8921_L24_1,
+		[MSM_RPMRS_ID_RPM_CTL]		= MSM_RPM_ID_RPM_CTL,
+	},
+};
+
+static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
+	.mode = MSM_PM_BOOT_CONFIG_TZ,
+};
+
+#ifdef CONFIG_I2C
+#define I2C_SURF 1
+#define I2C_FFA  (1 << 1)
+#define I2C_RUMI (1 << 2)
+#define I2C_SIM  (1 << 3)
+#define I2C_FLUID (1 << 4)
+
+struct i2c_registry {
+	u8                     machs;
+	int                    bus;
+	struct i2c_board_info *info;
+	int                    len;
+};
+
+static struct i2c_registry msm8960_i2c_devices[] __initdata = {
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+		msm_i2c_sensor_gsbi12_info,
+		ARRAY_SIZE(msm_i2c_sensor_gsbi12_info),
+	},
+#ifdef CONFIG_FB_MSM_HDMI_MHL
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI8_QUP_I2C_BUS_ID,
+		msm_i2c_gsbi8_mhl_sii9234_info,
+		ARRAY_SIZE(msm_i2c_gsbi8_mhl_sii9234_info),
+	},
+#endif
+#endif
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+		i2c_tps61310_flashlight,
+		ARRAY_SIZE(i2c_tps61310_flashlight),
+	},
+#endif
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI3_QUP_I2C_BUS_ID,
+		msm_i2c_gsbi3_info,
+		ARRAY_SIZE(msm_i2c_gsbi3_info),
+	},
+	{
+		I2C_SURF | I2C_FFA,
+		MSM_8960_GSBI5_QUP_I2C_BUS_ID,
+		msm_i2c_gsbi5_info,
+		ARRAY_SIZE(msm_i2c_gsbi5_info),
+	},
+};
+#endif /* CONFIG_I2C */
+
+static void __init register_i2c_devices(void)
+{
+#ifdef CONFIG_I2C
+	u8 mach_mask = 0;
+	int i;
+
+#ifdef CONFIG_MSM_CAMERA
+	struct i2c_registry ville_camera_i2c_devices = {
+		I2C_SURF | I2C_FFA | I2C_FLUID | I2C_RUMI,
+		MSM_8960_GSBI4_QUP_I2C_BUS_ID,
+		ville_camera_board_info.board_info,
+		ville_camera_board_info.num_i2c_board_info,
+	};
+#endif
+
+	mach_mask = I2C_SURF;
+
+	/* Run the array and install devices as appropriate */
+	for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
+		if (msm8960_i2c_devices[i].machs & mach_mask) {
+			i2c_register_board_info(msm8960_i2c_devices[i].bus,
+						msm8960_i2c_devices[i].info,
+						msm8960_i2c_devices[i].len);
+		}
+	}
+
+	if (1 == board_mfg_mode())
+		if (cs_cy8c_data[1].id.config == CS_KEY_4)
+			cs_cy8c_data[1].keycode[3] = KEY_MENU;
+
+	if (system_rev < 2) {
+		if (cs_cy8c_data[1].id.config == CS_KEY_4) {
+			pr_info("[cap] Setting as old printing\n");
+			cs_cy8c_data[1].keycode[0] = KEY_HOME;
+			cs_cy8c_data[1].keycode[1] = KEY_MENU;
+			cs_cy8c_data[1].keycode[2] = KEY_BACK;
+			cs_cy8c_data[1].keycode[3] = KEY_SEARCH;
+		}
+	}
+#ifdef CONFIG_MSM_CAMERA
+	/* HTC_START_Simon.Ti_Liu_20120711_IMPLEMENT_MCLK_SWITCH */
+	if (ville_camera_i2c_devices.machs & mach_mask)
+		i2c_register_board_info(ville_camera_i2c_devices.bus,
+				ville_camera_i2c_devices.info,
+				ville_camera_i2c_devices.len);
+#endif
+	if (system_rev < 3) {
+		i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+			i2c_CM36282_devices, ARRAY_SIZE(i2c_CM36282_devices));
+		pr_info("%s: cm36282 PL-sensor for XA,XB,XC, system_rev %d ",
+				 __func__, system_rev);
+	} else {
+		if (skuid & 0x1) {
+			if (engineerid  & 0x1) {
+				i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+				i2c_CM36282_TMO_EN1_devices, ARRAY_SIZE(i2c_CM36282_TMO_EN1_devices));
+				pr_info("%s: cm36282 PL-sensor TMO EN1 system_rev %d, sku %x ",
+					 __func__, system_rev, skuid);
+			} else {
+				i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+					i2c_CM36282_TMO_devices, ARRAY_SIZE(i2c_CM36282_TMO_devices));
+				pr_info("%s: cm36282 PL-sensor TMO system_rev %d, sku %x ",
+					 __func__, system_rev, skuid);
+			}
+		} else {
+			if (engineerid  & 0x1) {
+				i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+					i2c_CM36282_XD_EN1_devices, ARRAY_SIZE(i2c_CM36282_XD_EN1_devices));
+				pr_info("%s: cm36282 PL-sensor for XD and newer HW version EN1, system_rev %d ",
+					__func__, system_rev);
+			} else {
+				i2c_register_board_info(MSM_8960_GSBI12_QUP_I2C_BUS_ID,
+					i2c_CM36282_XD_devices,	ARRAY_SIZE(i2c_CM36282_XD_devices));
+				pr_info("%s: cm36282 PL-sensor for XD and newer HW version, system_rev %d ",
+					__func__, system_rev);
+			}
+		}
+	}
+#endif /* CONFIG_I2C */
+}
+
+static void __init msm8960ab_update_krait_spm(void)
+{
+	int i;
+
+
+	/* Update the SPM sequences for SPC and PC */
+	for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
+		int j;
+		struct msm_spm_platform_data *pdata = &msm_spm_data[i];
+		for (j = 0; j < pdata->num_modes; j++) {
+			if (pdata->modes[j].cmd ==
+					spm_power_collapse_without_rpm)
+				pdata->modes[j].cmd =
+				spm_power_collapse_without_rpm_krait_v3;
+			else if (pdata->modes[j].cmd ==
+					spm_power_collapse_with_rpm)
+				pdata->modes[j].cmd =
+				spm_power_collapse_with_rpm_krait_v3;
+		}
+	}
+}
+
+static void __init msm8960ab_update_retention_spm(void)
+{
+	int i;
+
+	/* Update the SPM sequences for krait retention on all cores */
+	for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
+		int j;
+		struct msm_spm_platform_data *pdata = &msm_spm_data[i];
+		for (j = 0; j < pdata->num_modes; j++) {
+			if (pdata->modes[j].cmd ==
+					spm_retention_cmd_sequence)
+				pdata->modes[j].cmd =
+				spm_retention_with_krait_v3_cmd_sequence;
+		}
+	}
+}
+
+
+/*UART -> GSBI8*/
+static uint32_t msm_uart_gpio[] = {
+	GPIO_CFG(34, 1, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
+	GPIO_CFG(35, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_UP, GPIO_CFG_8MA),
+};
+static void msm_uart_gsbi_gpio_init(void)
+{
+	gpio_tlmm_config(msm_uart_gpio[0], GPIO_CFG_ENABLE);
+	gpio_tlmm_config(msm_uart_gpio[1], GPIO_CFG_ENABLE);
+}
+
+static uint32_t msm_region_gpio[] = {
+	GPIO_CFG(VILLE_GPIO_REGION_ID, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, 0),
+};
+static void msm_region_id_gpio_init(void)
+{
+	gpio_tlmm_config(msm_region_gpio[0], GPIO_CFG_ENABLE);
+}
+
+#ifdef CONFIG_RAWCHIP
+static struct spi_board_info rawchip_spi_board_info[] __initdata = {
+	{
+		.modalias               = "spi_rawchip",
+		.max_speed_hz           = 27000000,
+		.bus_num                = 1,
+		.chip_select            = 0,
+		.mode                   = SPI_MODE_0,
+	},
+};
+#endif
+
+static void __init ville_init(void)
+{
+	u32 hw_ver_id = 0;
+
+	if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
+		pr_err("meminfo_init() failed!\n");
+
+	htc_add_ramconsole_devices();
+	platform_device_register(&msm_gpio_device);
+
+	msm_tsens_early_init(&msm_tsens_pdata);
+	msm_thermal_init(&msm_thermal_pdata);
+	BUG_ON(msm_rpm_init(&msm8960_rpm_data));
+	BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
+
+	regulator_suppress_info_printing();
+	if (msm_xo_init())
+		pr_err("Failed to initialize XO votes\n");
+	platform_device_register(&ville_device_rpm_regulator);
+	msm_clock_init(&msm8960_clock_init_data);
+	msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
+	android_usb_pdata.swfi_latency =
+		msm_rpmrs_levels[0].latency_us;
+	ville_gpiomux_init();
+	msm8960_device_qup_spi_gsbi10.dev.platform_data =
+		&msm8960_qup_spi_gsbi10_pdata;
+#ifdef CONFIG_RAWCHIP
+	spi_register_board_info(rawchip_spi_board_info,
+			ARRAY_SIZE(rawchip_spi_board_info));
+#endif
+	ville_init_pmic();
+	msm8960_i2c_init();
+	msm8960_gfx_init();
+	if (cpu_is_msm8960ab())
+		msm8960ab_update_krait_spm();
+	if (cpu_is_krait_v3()) {
+		msm_pm_set_tz_retention_flag(0);
+		msm8960ab_update_retention_spm();
+	} else {
+		msm_pm_set_tz_retention_flag(1);
+	}
+	msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
+	msm_spm_l2_init(msm_spm_l2_data);
+	msm8960_init_buses();
+
+	ville_cable_detect_register();
+
+#ifdef CONFIG_BT
+	bt_export_bd_address();
+#endif
+#ifdef CONFIG_HTC_BATT_8960
+	htc_battery_cell_init(htc_battery_cells, ARRAY_SIZE(htc_battery_cells));
+#endif /* CONFIG_HTC_BATT_8960 */
+
+	platform_add_devices(msm8960_footswitch, msm8960_num_footswitch);
+	platform_device_register(&msm8960_device_ext_l2_vreg);
+
+	platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
+
+	msm_uart_gsbi_gpio_init();
+	ville_pm8921_gpio_mpp_init();
+	msm_region_id_gpio_init();
+	platform_add_devices(ville_devices, ARRAY_SIZE(ville_devices));
+	ville_init_camera();
+	ville_init_mmc();
+	register_i2c_devices();
+	ville_init_fb();
+	slim_register_board_info(msm_slim_devices,
+			ARRAY_SIZE(msm_slim_devices));
+	BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
+
+//	create_proc_read_entry("emmc", 0, NULL, emmc_partition_read_proc, NULL);
+//	create_proc_read_entry("dying_processes", 0, NULL, dying_processors_read_proc, NULL);
+
+	/*usb driver won't be loaded in MFG 58 station and gift mode*/
+	if (!(board_mfg_mode() == 6 || board_mfg_mode() == 7))
+		ville_add_usb_devices();
+
+	ville_init_keypad();
+	hw_ver_id = readl(HW_VER_ID_VIRT);
+	printk(KERN_INFO "hw_ver_id = %x\n", hw_ver_id);
+}
+
+#define PHY_BASE_ADDR1  0x80400000
+#define SIZE_ADDR1      (132 * 1024 * 1024)
+
+#define PHY_BASE_ADDR2  0x90000000
+#define SIZE_ADDR2      (768 * 1024 * 1024)
+
+static void __init ville_fixup(struct tag *tags,
+				 char **cmdline, struct meminfo *mi)
+{
+	engineerid = parse_tag_engineerid(tags);
+	mi->nr_banks = 2;
+	mi->bank[0].start = PHY_BASE_ADDR1;
+	mi->bank[0].size = SIZE_ADDR1;
+	mi->bank[1].start = PHY_BASE_ADDR2;
+	mi->bank[1].size = SIZE_ADDR2;
+
+	skuid = parse_tag_skuid((const struct tag *)tags);
+	printk(KERN_INFO "Ville_fixup:skuid=0x%x\n", skuid);
+}
+
+static int __init pm8921_late_init(void)
+{
+	return 0;
+}
+
+late_initcall(pm8921_late_init);
+
+MACHINE_START(VILLE, "ville")
+	.fixup = ville_fixup,
+	.map_io = ville_map_io,
+	.reserve = ville_reserve,
+	.init_irq = ville_init_irq,
+	.handle_irq = gic_handle_irq,
+	.timer = &msm_timer,
+	.init_machine = ville_init,
+	.init_early = msm8960_allocate_memory_regions,
+	.init_very_early = ville_early_memory,
+	.restart = msm_restart,
+MACHINE_END
diff --git a/arch/arm/mach-msm/htc/ville/board-ville.h b/arch/arm/mach-msm/htc/ville/board-ville.h
new file mode 100644
index 0000000..1223c94
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/board-ville.h
@@ -0,0 +1,309 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ARCH_ARM_MACH_MSM_BOARD_VILLE_H
+#define __ARCH_ARM_MACH_MSM_BOARD_VILLE_H
+
+#include <linux/regulator/msm-gpio-regulator.h>
+#include <mach/irqs.h>
+#include <mach/rpm-regulator.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <linux/i2c.h>
+#include <mach/msm_memtypes.h>
+#ifdef CONFIG_MSM_RTB
+#include <mach/msm_rtb.h>
+#endif
+#ifdef CONFIG_MSM_CACHE_DUMP
+#include <mach/msm_cache_dump.h>
+#endif
+
+/* Macros assume PMIC GPIOs and MPPs start at 1 */
+#define PM8921_GPIO_BASE		NR_GPIO_IRQS
+#define PM8921_GPIO_PM_TO_SYS(pm_gpio)	(pm_gpio - 1 + PM8921_GPIO_BASE)
+#define PM8921_MPP_BASE			(PM8921_GPIO_BASE + PM8921_NR_GPIOS)
+#define PM8921_MPP_PM_TO_SYS(pm_gpio)	(pm_gpio - 1 + PM8921_MPP_BASE)
+#define PM8921_IRQ_BASE			(NR_MSM_IRQS + NR_GPIO_IRQS)
+
+#define EVN_8960M_LAYOUTS			{ \
+			{ { 0,  1, 0}, {-1,  0,  0}, {0, 0, 1} }, \
+			{ { 0, -1, 0}, { 1,  0,  0}, {0, 0, -1} }, \
+			{ {-1,  0, 0}, { 0, -1,  0}, {0, 0,  1} }, \
+			{ {-1,  0, 0}, { 0,  0, -1}, {0, 1,  0} }   \
+				}
+
+extern struct gpio_regulator_platform_data
+	msm_gpio_regulator_pdata[] __devinitdata;
+
+extern struct regulator_init_data msm_saw_regulator_pdata_s5;
+extern struct regulator_init_data msm_saw_regulator_pdata_s6;
+
+extern struct rpm_regulator_platform_data ville_rpm_regulator_pdata __devinitdata;
+
+extern struct platform_device msm8960_device_ext_5v_vreg __devinitdata;
+extern struct platform_device msm8960_device_ext_l2_vreg __devinitdata;
+extern struct pm8xxx_regulator_platform_data
+	msm_pm8921_regulator_pdata[] __devinitdata;
+
+extern int msm_pm8921_regulator_pdata_len __devinitdata;
+
+#define GPIO_VREG_ID_EXT_5V		0
+#define GPIO_VREG_ID_EXT_L2		1
+#define GPIO_VREG_ID_EXT_3P3V           2
+#define GPIO_VREG_ID_EXT_OTG_SW		3
+
+#define PMGPIO(x) (x)
+
+#define VILLE_GPIO_LCD_TE                      (0)
+#define VILLE_GPIO_NC_1                        (1)
+#define VILLE_GPIO_NC_2                        (2)
+#define VILLE_GPIO_V_BOOST_5V_EN               (3)
+#define VILLE_GPIO_CAM_MCLK1                   (4)
+#define VILLE_GPIO_CAM_MCLK0                   (5)
+#define VILLE_GPIO_NFC_DL_MODE                 (6)
+#define VILLE_GPIO_NC_6                        (6)
+#define VILLE_GPIO_TP_ATTz                     (7)
+#define VILLE_GPIO_TP_RSTz                     (8)
+#define VILLE_GPIO_CAM_PWDN                    (9)
+#define VILLE_GPIO_RAFT_UP_EN_CPU              (10)
+#define VILLE_GPIO_RESOUTz_CONTROL             (11)
+#define VILLE_GPIO_VP_I2C_DAT                  (12)
+#define VILLE_GPIO_VP_I2C_CLK                  (13)
+#define VILLE_GPIO_CHG_INT                     (14)
+#define VILLE_GPIO_NC_14                       (14)
+#define VILLE_GPIO_NC_15                       (15)
+#define VILLE_GPIO_TP_I2C_DAT                  (16)
+#define VILLE_GPIO_TP_I2C_CLK                  (17)
+#define VILLE_GPIO_NC_18                       (18)
+#define VILLE_GPIO_USB_ID1                     (19)
+#define VILLE_GPIO_CAM_I2C_DAT                 (20)
+#define VILLE_GPIO_CAM_I2C_CLK                 (21)
+#define VILLE_GPIO_NC_22                       (22)
+#define VILLE_GPIO_CAP_SENSOR_INTz             (23)
+#define VILLE_GPIO_CAP_I2C_DAT                 (24)
+#define VILLE_GPIO_CAP_I2C_CLK                 (25)
+#define VILLE_GPIO_FM_SSBI                     (26)
+#define VILLE_GPIO_FM_DATA                     (27)
+#define VILLE_GPIO_BT_STROBE                   (28)
+#define VILLE_GPIO_BT_DATA                     (29)
+#define VILLE_GPIO_UIM1_DATA_MSM               (30)
+#define VILLE_GPIO_UIM1_CLK_MSM                (31)
+#define VILLE_GPIO_TORCH_FLASHz                (32)
+#define VILLE_GPIO_DRIVER_EN                   (33)
+#define VILLE_GPIO_DEBUG_UART_TX               (34)
+#define VILLE_GPIO_DEBUG_UART_RX               (35)
+#define VILLE_GPIO_MC_I2C_DAT                  (36)
+#define VILLE_GPIO_NC_36                       (36)
+#define VILLE_GPIO_MC_I2C_CLK                  (37)
+#define VILLE_GPIO_NC_37                       (37)
+#define VILLE_GPIO_MSM_SPI_DO                  (38)
+#define VILLE_GPIO_NC_39                       (39)
+#define VILLE_GPIO_MSM_SPI_CS0                 (40)
+#define VILLE_GPIO_MSM_SPI_CLK                 (41)
+#define VILLE_GPIO_VOL_UPz                     (42)
+#define VILLE_GPIO_VOL_DOWNz                   (43)
+#define VILLE_GPIO_SR_I2C_DAT                  (44)
+#define VILLE_GPIO_SR_I2C_CLK                  (45)
+#define VILLE_GPIO_PWR_KEYz                    (46)
+#define VILLE_GPIO_MAIN_CAM_ID                 (47)
+#define VILLE_GPIO_LCD_RSTz                    (48)
+#define VILLE_GPIO_CAM_VCM_PD                  (49)
+#define VILLE_GPIO_RAW_INTR0                   (50)
+#define VILLE_GPIO_NC_51                       (51)
+#define VILLE_GPIO_RAW_INTR1                   (52)
+#define VILLE_GPIO_NC_53                       (53)
+#define VILLE_GPIO_REGION_ID                   (54)
+#define VILLE_GPIO_PANA_GYRO_SLEEP                       (55)
+#define VILLE_GPIO_NC_56                       (56)
+#define VILLE_GPIO_V_3G_PA0_EN                 (57)
+#define VILLE_GPIO_GYRO_DIAG                       (58)
+#define VILLE_GPIO_AUD_WCD_MCLK                (59)
+#define VILLE_GPIO_AUD_WCD_SB_CLK              (60)
+#define VILLE_GPIO_AUD_WCD_SB_DATA             (61)
+#define VILLE_GPIO_AUD_WCD_INTR_OUT            (62)
+#define VILLE_GPIO_NC_63                       (63)
+#define VILLE_GPIO_RAW_RSTN                    (64)
+#define VILLE_GPIO_NC_64                       (64)
+#define VILLE_GPIO_NC_65                       (65)
+#define VILLE_GPIO_NC_66                       (66)
+#define VILLE_GPIO_GSENSOR_INT                 (67)
+#define VILLE_GPIO_CAM2_RSTz                   (68)
+#define VILLE_GPIO_GYRO_INT                    (69)
+#define VILLE_GPIO_NC_69                       (69)
+#define VILLE_GPIO_COMPASS_INT                 (70)
+#define VILLE_GPIO_MCAM_SPI_DO                 (71)
+#define VILLE_GPIO_MCAM_SPI_DI                 (72)
+#define VILLE_GPIO_MCAM_SPI_CS0                (73)
+#define VILLE_GPIO_MCAM_SPI_CLK                (74)
+#define VILLE_GPIO_NC_75                       (75)
+#define VILLE_GPIO_CAM2_STANDBY                (76)
+#define VILLE_GPIO_OTG_EN                      (77)
+#define VILLE_GPIO_NC_77                       (77)
+#define VILLE_GPIO_MHL_INT                     (78)
+#define VILLE_GPIO_NC_78                       (78)
+#define VILLE_GPIO_V_CAM2_D1V2_EN              (79)
+#define VILLE_GPIO_MHL_RSTz                    (80)
+#define VILLE_GPIO_NC_80                       (80)
+#define VILLE_GPIO_V_TP_3V3_EN                 (81)
+#define VILLE_GPIO_MHL_USB_SELz                (82)
+#define VILLE_GPIO_NC_82                       (82)
+#define VILLE_GPIO_WCN_BT_SSBI                 (83)
+#define VILLE_GPIO_WCN_CMD_DATA2               (84)
+#define VILLE_GPIO_WCN_CMD_DATA1               (85)
+#define VILLE_GPIO_WCN_CMD_DATA0               (86)
+#define VILLE_GPIO_WCN_CMD_SET                 (87)
+#define VILLE_GPIO_WCN_CMD_CLK                 (88)
+#define VILLE_GPIO_MHL_USB_ENz                 (89)
+#define VILLE_GPIO_NC_89                       (89)
+#define VILLE_GPIO_AUD_A1028_WAKE              (90)
+#define VILLE_GPIO_AUD_A1028_RSTz              (91)
+#define VILLE_GPIO_AUD_A1028_INT               (92)
+#define VILLE_GPIO_V_LCMIO_1V8_EN              (93)
+#define VILLE_GPIO_MBAT_IN                     (94)
+#define VILLE_GPIO_V_CAM_D1V2_EN               (95)
+#define VILLE_GPIO_NC_95                       (95)
+#define VILLE_GPIO_NC_96                       (96)
+#define VILLE_GPIO_NC_97                       (97)
+#define VILLE_GPIO_RIVA_TX                     (98)
+#define VILLE_GPIO_NC_99                       (99)
+#define VILLE_GPIO_HDMI_DDC_CLK                (100)
+#define VILLE_GPIO_NC_100                      (100)
+#define VILLE_GPIO_HDMI_DDC_DATA               (101)
+#define VILLE_GPIO_NC_101                      (101)
+#define VILLE_GPIO_HDMI_HPD                    (102)
+#define VILLE_GPIO_NC_102                      (102)
+#define VILLE_GPIO_PM_SEC_INTz                 (103)
+#define VILLE_GPIO_PM_USR_INTz                 (104)
+#define VILLE_GPIO_PM_MDM_INTz                 (105)
+#define VILLE_GPIO_NFC_IRQ                     (106)
+#define VILLE_GPIO_NC_106                      (106)
+#define VILLE_GPIO_NC_107                      (107)
+#define VILLE_GPIO_PS_HOLD                     (108)
+#define VILLE_GPIO_NC_109                      (109)
+#define VILLE_GPIO_NC_110                      (110)
+#define VILLE_GPIO_PRX_LB_SW_SEL               (111)
+#define VILLE_GPIO_BOOT_COINIG_6               (112)
+#define VILLE_GPIO_NC_103                      (113)
+#define VILLE_GPIO_DRX_MODE_SELB               (114)
+#define VILLE_GPIO_DRX_MODE_SELA               (115)
+#define VILLE_GPIO_ANT_SW_SEL3                 (116)
+#define VILLE_GPIO_ANT_SW_SEL2                 (117)
+#define VILLE_GPIO_ANT_SW_SEL1                 (118)
+#define VILLE_GPIO_ANT_SW_SEL0                 (119)
+#define VILLE_GPIO_NC_120                      (120)
+#define VILLE_GPIO_NC_121                      (121)
+#define VILLE_GPIO_PA0_R0                      (122)
+#define VILLE_GPIO_PA0_R1                      (123)
+#define VILLE_GPIO_NC_124                      (124)
+#define VILLE_GPIO_RTR0_RF_ON                  (125)
+#define VILLE_GPIO_RTR_RX_ON                   (126)
+#define VILLE_GPIO_TX_AGC_ADJ_CPU              (127)
+#define VILLE_GPIO_PA_ON8_U900                 (128)
+#define VILLE_GPIO_PA_ON7_U700                 (129)
+#define VILLE_GPIO_PA_ON6_AWS                  (130)
+#define VILLE_GPIO_NC_131                      (131)
+#define VILLE_GPIO_PA_ON4_MODE                 (132)
+#define VILLE_GPIO_NC_133                      (133)
+#define VILLE_GPIO_NC_134                      (134)
+#define VILLE_GPIO_PA_ON1_GSMHB                (135)
+#define VILLE_GPIO_PA_ON0_GSMLB                (136)
+#define VILLE_GPIO_EXT_GPS_LNA_EN              (137)
+#define VILLE_GPIO_NC_138                      (138)
+#define VILLE_GPIO_NC_139                      (139)
+#define VILLE_GPIO_NC_140                      (140)
+#define VILLE_GPIO_NC_141                      (141)
+#define VILLE_GPIO_RTR0_SSBI2                  (142)
+#define VILLE_GPIO_RTR0_SSBI1                  (143)
+#define VILLE_GPIO_RTR0_GP_CLK                 (144)
+#define VILLE_GPIO_RTR0_GPRSSYNC               (145)
+#define VILLE_GPIO_RTR0_GPDATA2                (146)
+#define VILLE_GPIO_RTR0_GPDATA1                (147)
+#define VILLE_GPIO_RTR0_GPDATA0                (148)
+#define VILLE_GPIO_NC_149                      (149)
+#define VILLE_GPIO_NC_150                      (150)
+#define VILLE_GPIO_NC_151                      (151)
+
+#define VILLE_PMGPIO_NC_1                      PMGPIO(1)
+#define VILLE_PMGPIO_LED_3V3_EN                PMGPIO(1)
+#define VILLE_PMGPIO_NC_2                      PMGPIO(2)
+#define VILLE_PMGPIO_HAPTIC_3V3_EN             PMGPIO(2)
+#define VILLE_PMGPIO_AUD_STEREO_REC            PMGPIO(3)
+#define VILLE_PMGPIO_RAFT_I2C_LS_EN            PMGPIO(4)
+#define VILLE_PMGPIO_NC_4                      PMGPIO(4)
+#define VILLE_PMGPIO_PM_SPI_CS0                PMGPIO(5)
+#define VILLE_PMGPIO_RAFT_uP_SPI_CS0           PMGPIO(6)
+#define VILLE_PMGPIO_AUD_REMO_PRESz            PMGPIO(7)
+#define VILLE_PMGPIO_NC_8                      PMGPIO(8)
+#define VILLE_PMGPIO_CAP_RST                   PMGPIO(9)
+#define VILLE_PMGPIO_RAFT_UP_RSTz              PMGPIO(10)
+#define VILLE_PMGPIO_PM_SPI_CLK                PMGPIO(11)
+#define VILLE_PMGPIO_RAFT_uP_SPI_CLK           PMGPIO(12)
+#define VILLE_PMGPIO_PM_SPI_DO                 PMGPIO(13)
+#define VILLE_PMGPIO_RAFT_uP_SPI_DO            PMGPIO(14)
+#define VILLE_PMGPIO_PM_RAFT_UP_EN_CPU         PMGPIO(15)
+#define VILLE_PMGPIO_RAFT_UP_EN                PMGPIO(16)
+#define VILLE_PMGPIO_PROXIMITY_INTz            PMGPIO(17)
+#define VILLE_PMGPIO_AUD_SPK_EN                PMGPIO(18)
+#define VILLE_PMGPIO_NC_19                     PMGPIO(19)
+#define VILLE_PMGPIO_EARPHONE_DETz             PMGPIO(20)
+#define VILLE_PMGPIO_CHG_STAT                  PMGPIO(21)
+#define VILLE_PMGPIO_NC_21                     PMGPIO(21)
+#define VILLE_PMGPIO_NC_22                     PMGPIO(22)
+#define VILLE_PMGPIO_NC_23                     PMGPIO(23)
+#define VILLE_PMGPIO_SDC3_CDz                  PMGPIO(23)
+#define VILLE_PMGPIO_GREEN_LED                 PMGPIO(24)
+#define VILLE_PMGPIO_AMBER_LED                 PMGPIO(25)
+#define VILLE_PMGPIO_HAPTIC_PWM                PMGPIO(26)
+#define VILLE_PMGPIO_UIM1_RST                  PMGPIO(27)
+#define VILLE_PMGPIO_NC_28                     PMGPIO(28)
+#define VILLE_PMGPIO_UIM1_CLK_MSM              PMGPIO(29)
+#define VILLE_PMGPIO_UIM_CLK                   PMGPIO(30)
+#define VILLE_PMGPIO_NC_31                     PMGPIO(31)
+#define VILLE_PMGPIO_NC_32                     PMGPIO(32)
+#define VILLE_PMGPIO_LCD_ID0                   PMGPIO(33)
+#define VILLE_PMGPIO_AUD_CODEC_RSTz            PMGPIO(34)
+#define VILLE_PMGPIO_LCD_ID1                   PMGPIO(35)
+#define VILLE_PMGPIO_NC_36                     PMGPIO(36)
+#define VILLE_PMGPIO_NC_37                     PMGPIO(37)
+#define VILLE_PMGPIO_NC_38                     PMGPIO(38)
+#define VILLE_PMGPIO_SSBI_PMIC_FWD_CLK         PMGPIO(39)
+#define VILLE_PMGPIO_NC_40                     PMGPIO(40)
+#define VILLE_PMGPIO_NC_41                     PMGPIO(41)
+#define VILLE_PMGPIO_NC_42                     PMGPIO(42)
+#define VILLE_PMGPIO_V_RAW_1V2_EN              PMGPIO(43)
+#define VILLE_PMGPIO_NC_43                     PMGPIO(43)
+#define VILLE_PMGPIO_NC_44                     PMGPIO(44)
+
+extern struct msm_camera_board_info ville_camera_board_info;
+
+void __init ville_init_camera(void);
+void ville_init_fb(void);
+void __init ville_init_pmic(void);
+void ville_init_mmc(void);
+int __init ville_gpiomux_init(void);
+void __init msm8960_allocate_fb_region(void);
+void __init ville_pm8921_gpio_mpp_init(void);
+void msm8960_mdp_writeback(struct memtype_reserve *reserve_table);
+int __init ville_init_keypad(void);
+
+#ifdef CONFIG_MSM_RTB
+extern struct msm_rtb_platform_data msm8960_rtb_pdata;
+#endif
+#ifdef CONFIG_MSM_CACHE_DUMP
+extern struct msm_cache_dump_platform_data msm8960_cache_dump_pdata;
+#endif
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+int hdmi_enable_5v(int on);
+void hdmi_hpd_feature(int on);
+#endif
+
+#endif
diff --git a/arch/arm/mach-msm/htc/ville/display/Makefile b/arch/arm/mach-msm/htc/ville/display/Makefile
new file mode 100644
index 0000000..cb74188
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/display/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_MACH_VILLE) += mipi_ville.o mipi_ville_cmd_qhd_pt.o board-ville-panel.o
diff --git a/arch/arm/mach-msm/htc/ville/display/board-ville-panel.c b/arch/arm/mach-msm/htc/ville/display/board-ville-panel.c
new file mode 100644
index 0000000..5b4c24a
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/display/board-ville-panel.c
@@ -0,0 +1,621 @@
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include "../../../../drivers/video/msm/msm_fb.h"
+#include "../../../../drivers/video/msm/mipi_dsi.h"
+#include "../../../../drivers/video/msm/mdp.h"
+#include "../../../../drivers/video/msm/mdp4.h"
+#include "../../../../drivers/video/msm/msm_fb_panel.h"
+#include <linux/gpio.h>
+#include <mach/gpio.h>
+#include <mach/panel_id.h>
+#include <mach/msm_memtypes.h>
+#include <linux/bootmem.h>
+#include <video/msm_hdmi_modes.h>
+
+#include "../devices.h"
+#include "../board-ville.h"
+#if defined (CONFIG_FB_MSM_MDP_ABL)
+#include <linux/fb.h>
+#endif
+
+#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
+#define MSM_FB_PRIM_BUF_SIZE (960 * 544 * 4 * 3) /* 4 bpp x 3 pages */
+#else
+#define MSM_FB_PRIM_BUF_SIZE (960 * 544 * 4 * 2) /* 4 bpp x 2 pages */
+#endif
+
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+#define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */
+#elif defined(CONFIG_FB_MSM_TVOUT)
+#define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */
+#else
+#define MSM_FB_EXT_BUF_SIZE 0
+#endif
+
+/* Note: must be multiple of 4096 */
+#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE, 4096)
+
+#ifdef CONFIG_FB_MSM_OVERLAY0_WRITEBACK
+#define MSM_FB_OVERLAY0_WRITEBACK_SIZE roundup((960 * 544 * 3 * 2), 4096)
+#else
+#define MSM_FB_OVERLAY0_WRITEBACK_SIZE (0)
+#endif  /* CONFIG_FB_MSM_OVERLAY0_WRITEBACK */
+
+#ifdef CONFIG_FB_MSM_OVERLAY1_WRITEBACK
+#define MSM_FB_OVERLAY1_WRITEBACK_SIZE roundup((1920 * 1088 * 3 * 2), 4096)
+#else
+#define MSM_FB_OVERLAY1_WRITEBACK_SIZE (0)
+#endif  /* CONFIG_FB_MSM_OVERLAY1_WRITEBACK */
+
+static struct resource msm_fb_resources[] = {
+	{
+		.flags = IORESOURCE_DMA,
+	}
+};
+
+static struct msm_fb_platform_data msm_fb_pdata = {
+};
+
+static struct platform_device msm_fb_device = {
+	.name   = "msm_fb",
+	.id     = 0,
+	.num_resources     = ARRAY_SIZE(msm_fb_resources),
+	.resource          = msm_fb_resources,
+	.dev.platform_data = &msm_fb_pdata,
+};
+
+int ville_panel_first_init = 1;
+static bool dsi_power_on;
+
+static int mipi_dsi_panel_power(int on)
+{
+	static struct regulator *v_lcm, *v_lcmio, *v_dsivdd;
+	static bool bPanelPowerOn = false;
+	int rc;
+
+	char *lcm_str = "8921_l11";
+	char *lcmio_str = "8921_lvs5";
+	char *dsivdd_str = "8921_l2";
+        
+        printk(KERN_ERR  "[DISP] %s +++\n", __func__);
+	/* To avoid system crash in shutdown for non-panel case */
+	if (panel_type == PANEL_ID_NONE)
+		return -ENODEV;
+
+	printk(KERN_INFO "%s: state : %d\n", __func__, on);
+
+	if (!dsi_power_on) {
+		v_lcm = regulator_get(&msm_mipi_dsi1_device.dev,
+				lcm_str);
+		if (IS_ERR_OR_NULL(v_lcm)) {
+			printk(KERN_ERR "could not get %s, rc = %ld\n",
+				lcm_str, PTR_ERR(v_lcm));
+			return -ENODEV;
+		}
+
+		v_lcmio = regulator_get(&msm_mipi_dsi1_device.dev,
+				lcmio_str);
+		if (IS_ERR_OR_NULL(v_lcmio)) {
+			printk(KERN_ERR "could not get %s, rc = %ld\n",
+				lcmio_str, PTR_ERR(v_lcmio));
+			return -ENODEV;
+		}
+
+
+		v_dsivdd = regulator_get(&msm_mipi_dsi1_device.dev,
+				dsivdd_str);
+		if (IS_ERR_OR_NULL(v_dsivdd)) {
+			printk(KERN_ERR "could not get %s, rc = %ld\n",
+				dsivdd_str, PTR_ERR(v_dsivdd));
+			return -ENODEV;
+		}
+
+		rc = regulator_set_voltage(v_lcm, 3000000, 3000000);
+		if (rc) {
+			printk(KERN_ERR "%s#%d: set_voltage %s failed, rc=%d\n", __func__, __LINE__, lcm_str, rc);
+			return -EINVAL;
+		}
+
+		rc = regulator_set_voltage(v_dsivdd, 1200000, 1200000);
+		if (rc) {
+			printk(KERN_ERR "%s#%d: set_voltage %s failed, rc=%d\n", __func__, __LINE__, dsivdd_str, rc);
+			return -EINVAL;
+		}
+
+		rc = gpio_request(VILLE_GPIO_LCD_RSTz, "LCM_RST_N");
+		if (rc) {
+			printk(KERN_ERR "%s:LCM gpio %d request failed, rc=%d\n", __func__,  VILLE_GPIO_LCD_RSTz, rc);
+			return -EINVAL;
+		}
+
+		dsi_power_on = true;
+	}
+
+	if (on) {
+		printk(KERN_INFO "%s: on\n", __func__);
+		rc = regulator_set_optimum_mode(v_lcm, 100000);
+		if (rc < 0) {
+			printk(KERN_ERR "set_optimum_mode %s failed, rc=%d\n", lcm_str, rc);
+			return -EINVAL;
+		}
+
+		rc = regulator_set_optimum_mode(v_dsivdd, 100000);
+		if (rc < 0) {
+			printk(KERN_ERR "set_optimum_mode %s failed, rc=%d\n", dsivdd_str, rc);
+			return -EINVAL;
+		}
+
+		rc = regulator_enable(v_dsivdd);
+		if (rc) {
+			printk(KERN_ERR "enable regulator %s failed, rc=%d\n", dsivdd_str, rc);
+			return -ENODEV;
+		}
+		msleep(1);
+		rc = regulator_enable(v_lcmio);
+		if (rc) {
+			printk(KERN_ERR "enable regulator %s failed, rc=%d\n", lcmio_str, rc);
+			return -ENODEV;
+		}
+
+		rc = regulator_enable(v_lcm);
+		if (rc) {
+			printk(KERN_ERR "enable regulator %s failed, rc=%d\n", lcm_str, rc);
+			return -ENODEV;
+		}
+
+		if (!ville_panel_first_init) {
+			msleep(10);
+			gpio_set_value(VILLE_GPIO_LCD_RSTz, 1);
+			msleep(1);
+			gpio_set_value(VILLE_GPIO_LCD_RSTz, 0);
+			msleep(35);
+			gpio_set_value(VILLE_GPIO_LCD_RSTz, 1);
+		}
+		msleep(60);
+
+		bPanelPowerOn = true;
+	} else {
+		printk(KERN_INFO "%s: off\n", __func__);
+		if (!bPanelPowerOn) return 0;
+		msleep(100);
+		gpio_set_value(VILLE_GPIO_LCD_RSTz, 0);
+		msleep(10);
+
+		if (regulator_disable(v_dsivdd)) {
+			printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, dsivdd_str);
+			return -EINVAL;
+		}
+
+		if (regulator_disable(v_lcm)) {
+			printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, lcm_str);
+			return -EINVAL;
+		}
+		msleep(5);
+		if (regulator_disable(v_lcmio)) {
+			printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, lcmio_str);
+			return -EINVAL;
+		}
+
+		rc = regulator_set_optimum_mode(v_dsivdd, 100);
+		if (rc < 0) {
+			printk(KERN_ERR "%s: Unable to enable the regulator: %s\n", __func__, dsivdd_str);
+			return -EINVAL;
+		}
+
+		bPanelPowerOn = false;
+	}
+	//        if (bPanelPowerOn)
+	//          ville_display_on(mfd);
+	return 0;
+}
+
+static struct mipi_dsi_platform_data mipi_dsi_pdata = {
+	.vsync_gpio = VILLE_GPIO_LCD_TE,
+	.dsi_power_save = mipi_dsi_panel_power,
+};
+
+static struct platform_device mipi_dsi_ville_panel_device = {
+	.name = "mipi_ville",
+	.id = 0,
+};
+
+#ifdef CONFIG_MSM_BUS_SCALING
+
+static struct msm_bus_vectors mdp_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+
+static struct msm_bus_vectors mdp_ui_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 216000000 * 2,
+		.ib = 270000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_vga_vectors[] = {
+	/* VGA and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 216000000 * 2,
+		.ib = 270000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_720p_vectors[] = {
+	/* 720p and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 230400000 * 2,
+		.ib = 288000000 * 2,
+	},
+};
+
+static struct msm_bus_vectors mdp_1080p_vectors[] = {
+	/* 1080p and less video */
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 334080000 * 2,
+		.ib = 417600000 * 2,
+	},
+};
+
+static struct msm_bus_paths mdp_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(mdp_init_vectors),
+		mdp_init_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_ui_vectors),
+		mdp_ui_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_ui_vectors),
+		mdp_ui_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_vga_vectors),
+		mdp_vga_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_720p_vectors),
+		mdp_720p_vectors,
+	},
+	{
+		ARRAY_SIZE(mdp_1080p_vectors),
+		mdp_1080p_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
+	mdp_bus_scale_usecases,
+	ARRAY_SIZE(mdp_bus_scale_usecases),
+	.name = "mdp",
+};
+
+static struct msm_bus_vectors dtv_bus_init_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+static struct msm_bus_vectors dtv_bus_def_vectors[] = {
+	{
+		.src = MSM_BUS_MASTER_MDP_PORT0,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 566092800 * 2,
+		.ib = 707616000 * 2,
+	},
+};
+static struct msm_bus_paths dtv_bus_scale_usecases[] = {
+	{
+		ARRAY_SIZE(dtv_bus_init_vectors),
+		dtv_bus_init_vectors,
+	},
+	{
+		ARRAY_SIZE(dtv_bus_def_vectors),
+		dtv_bus_def_vectors,
+	},
+};
+static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
+	dtv_bus_scale_usecases,
+	ARRAY_SIZE(dtv_bus_scale_usecases),
+	.name = "dtv",
+};
+
+static struct lcdc_platform_data dtv_pdata = {
+	.bus_scale_table = &dtv_bus_scale_pdata,
+};
+#endif
+
+int mdp_core_clk_rate_table[] = {
+	85330000,
+	85330000,
+	160000000,
+	200000000,
+};
+
+static struct msm_panel_common_pdata mdp_pdata = {
+	.gpio = VILLE_GPIO_LCD_TE,
+	//	.mdp_core_clk_rate = 85330000,
+	//	.mdp_core_clk_table = mdp_core_clk_rate_table,
+	//	.num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
+#ifdef CONFIG_MSM_BUS_SCALING
+	.mdp_bus_scale_table = &mdp_bus_scale_pdata,
+#endif
+	.mdp_rev = MDP_REV_42,
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+	.mem_hid = BIT(ION_CP_MM_HEAP_ID),
+#else
+	.mem_hid = MEMTYPE_EBI1,
+#endif
+	.mdp_max_clk = 200000000,
+};
+
+void __init msm8960_allocate_fb_region(void)
+{
+	void *addr;
+	unsigned long size;
+
+	size = MSM_FB_SIZE;
+	addr = alloc_bootmem_align(size, 0x1000);
+	msm_fb_resources[0].start = __pa(addr);
+	msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
+	pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
+			size, addr, __pa(addr));
+
+}
+
+void __init msm8960_mdp_writeback(struct memtype_reserve* reserve_table)
+{
+	mdp_pdata.ov0_wb_size = MSM_FB_OVERLAY0_WRITEBACK_SIZE;
+	mdp_pdata.ov1_wb_size = MSM_FB_OVERLAY1_WRITEBACK_SIZE;
+#if defined(CONFIG_ANDROID_PMEM) && !defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
+	reserve_table[mdp_pdata.mem_hid].size +=
+		mdp_pdata.ov0_wb_size;
+	reserve_table[mdp_pdata.mem_hid].size +=
+		mdp_pdata.ov1_wb_size;
+#endif
+}
+
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+static struct resource hdmi_msm_resources[] = {
+	{
+		.name  = "hdmi_msm_qfprom_addr",
+		.start = 0x00700000,
+		.end   = 0x007060FF,
+		.flags = IORESOURCE_MEM,
+	},
+	{
+		.name  = "hdmi_msm_hdmi_addr",
+		.start = 0x04A00000,
+		.end   = 0x04A00FFF,
+		.flags = IORESOURCE_MEM,
+	},
+	{
+		.name  = "hdmi_msm_irq",
+		.start = HDMI_IRQ,
+		.end   = HDMI_IRQ,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+static int hdmi_core_power(int on, int show);
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+static mhl_driving_params ville_driving_params[] = {
+	{
+		.format = HDMI_VFRMT_640x480p60_4_3,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_720x480p60_16_9,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_1280x720p60_16_9,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_720x576p50_16_9,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_1920x1080p24_16_9,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+	{
+		.format = HDMI_VFRMT_1920x1080p30_16_9,
+		.reg_a3=0xEC,
+		.reg_a6=0x0C,
+	},
+};
+#endif
+
+static struct msm_hdmi_platform_data hdmi_msm_data = {
+	.irq = HDMI_IRQ,
+	.enable_5v = hdmi_enable_5v,
+	.core_power = hdmi_core_power,
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	.driving_params = ville_driving_params,
+	.driving_params_count = ARRAY_SIZE(ville_driving_params),
+#endif
+};
+
+static struct platform_device hdmi_msm_device = {
+	.name = "hdmi_msm",
+	.id = 0,
+	.num_resources = ARRAY_SIZE(hdmi_msm_resources),
+	.resource = hdmi_msm_resources,
+	.dev.platform_data = &hdmi_msm_data,
+};
+
+int hdmi_enable_5v(int on)
+{
+	static int prev_on;
+	int rc;
+
+	if (on == prev_on)
+		return 0;
+
+	if (on) {
+		rc = gpio_request(VILLE_GPIO_V_BOOST_5V_EN, "HDMI_BOOST_5V");
+		if (rc) {
+			pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
+				"HDMI_BOOST_5V", VILLE_GPIO_V_BOOST_5V_EN, rc);
+			goto error;
+		}
+		gpio_set_value(VILLE_GPIO_V_BOOST_5V_EN, 1);
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		gpio_set_value(VILLE_GPIO_V_BOOST_5V_EN, 0);
+		gpio_free(VILLE_GPIO_V_BOOST_5V_EN);
+		pr_info("%s(off): success\n", __func__);
+	}
+
+	prev_on = on;
+
+	return 0;
+error:
+	return rc;
+}
+
+static int hdmi_core_power(int on, int show)
+{
+	static struct regulator *reg_8921_l23;
+	static int prev_on;
+	int rc;
+
+	if (on == prev_on)
+		return 0;
+
+	if (!reg_8921_l23) {
+		reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
+		if (IS_ERR(reg_8921_l23)) {
+			pr_err("could not get reg_8921_l23, rc = %ld\n",
+				PTR_ERR(reg_8921_l23));
+			return -ENODEV;
+		}
+		rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
+		if (rc) {
+			pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
+			return -EINVAL;
+		}
+	}
+	if (on) {
+		rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
+		if (rc < 0) {
+			pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
+			return -EINVAL;
+		}
+		rc = regulator_enable(reg_8921_l23);
+		if (rc) {
+			pr_err("'%s' regulator enable failed, rc=%d\n",
+				"hdmi_avdd", rc);
+			return rc;
+		}
+
+		pr_info("%s(on): success\n", __func__);
+	} else {
+		rc = regulator_disable(reg_8921_l23);
+		if (rc) {
+			pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
+			return -ENODEV;
+		}
+
+		rc = regulator_set_optimum_mode(reg_8921_l23, 100);
+		if (rc < 0) {
+			pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
+			return -EINVAL;
+		}
+		pr_info("%s(off): success\n", __func__);
+	}
+	prev_on = on;
+	return rc;
+}
+#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
+
+#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
+static char wfd_check_mdp_iommu_split_domain(void)
+{
+	return mdp_pdata.mdp_iommu_split_domain;
+}
+
+static struct msm_wfd_platform_data wfd_pdata = {
+	.wfd_check_mdp_iommu_split = wfd_check_mdp_iommu_split_domain,
+};
+
+static struct platform_device wfd_panel_device = {
+	.name = "wfd_panel",
+	.id = 0,
+	.dev.platform_data = NULL,
+};
+
+static struct platform_device wfd_device = {
+	.name = "msm_wfd",
+	.id = -1,
+	.dev.platform_data = &wfd_pdata,
+};
+#endif
+
+static void __init msm8960_set_display_params(char *prim_panel, char *ext_panel)
+{
+	if (strnlen(prim_panel, PANEL_NAME_MAX_LEN)) {
+		strlcpy(msm_fb_pdata.prim_panel_name, prim_panel,
+			PANEL_NAME_MAX_LEN);
+		pr_debug("msm_fb_pdata.prim_panel_name %s\n",
+			msm_fb_pdata.prim_panel_name);
+	}
+
+	if (strnlen(ext_panel, PANEL_NAME_MAX_LEN)) {
+		strlcpy(msm_fb_pdata.ext_panel_name, ext_panel,
+			PANEL_NAME_MAX_LEN);
+		pr_debug("msm_fb_pdata.ext_panel_name %s\n",
+			msm_fb_pdata.ext_panel_name);
+	}
+}
+
+void __init ville_init_fb(void)
+{
+	msm8960_set_display_params("mipi_ville", "hdmi_msm");
+	platform_device_register(&msm_fb_device);
+#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
+	platform_device_register(&wfd_panel_device);
+	platform_device_register(&wfd_device);
+#endif
+#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
+	platform_device_register(&hdmi_msm_device);
+#endif
+	platform_device_register(&mipi_dsi_ville_panel_device);
+	msm_fb_register_device("mdp", &mdp_pdata);
+	msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
+	msm_fb_register_device("dtv", &dtv_pdata);
+}
diff --git a/arch/arm/mach-msm/htc/ville/display/mipi_ville.c b/arch/arm/mach-msm/htc/ville/display/mipi_ville.c
new file mode 100644
index 0000000..82fd63e
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/display/mipi_ville.c
@@ -0,0 +1,637 @@
+#include <mach/panel_id.h>
+#include "../../../drivers/video/msm/msm_fb.h"
+#include "../../../drivers/video/msm/mipi_dsi.h"
+#include "mipi_ville.h"
+
+#ifndef VILLE_USE_CMDLISTS
+static struct dsi_buf ville_tx_buf;
+static struct dsi_buf ville_rx_buf;
+#endif
+static struct mipi_dsi_panel_platform_data *mipi_ville_pdata;
+static struct dsi_cmd_desc *display_on_cmds = NULL;
+static struct dsi_cmd_desc *display_off_cmds = NULL;
+static struct dsi_cmd_desc *cmd_on_cmds = NULL;
+static int display_on_cmds_count = 0;
+static int display_off_cmds_count = 0;
+static int cmd_on_cmds_count = 0;
+static int mipi_ville_lcd_init(void);
+static void mipi_ville_set_backlight(struct msm_fb_data_type *mfd);
+static int cur_bl_level = 0;
+
+static char enter_sleep[2] = {0x10, 0x00}; /* DTYPE_DCS_WRITE */
+static char exit_sleep[2] = {0x11, 0x00}; /* DTYPE_DCS_WRITE */
+static char display_off[2] = {0x28, 0x00}; /* DTYPE_DCS_WRITE */
+static char display_on[2] = {0x29, 0x00}; /* DTYPE_DCS_WRITE */
+static char enable_te[2] = {0x35, 0x00}; /* DTYPE_DCS_WRITE1 */
+
+static char ville_panel_width[] = {0x2A, 0x00, 0x1E, 0x02, 0x39}; /* DTYPE_DCS_LWRITE */
+static char ville_panel_height[] = {0x2B, 0x00, 0x00, 0x03, 0xBF}; /* DTYPE_DCS_LWRITE */
+static char ville_panel_vinit[] = {0xD1, 0x8A}; /* DTYPE_DCS_WRITE1 */
+
+static char vle_e0[] = {0xF0, 0x5A, 0x5A}; /* DTYPE_DCS_LWRITE */
+static char vle_e1[] = {0xF1, 0x5A, 0x5A}; /* DTYPE_DCS_LWRITE */
+static char vle_e22[] = {0xFC, 0x5A, 0x5A}; /* DTYPE_DCS_LWRITE */
+static char vle_g0[] = {
+	0xFA, 0x02, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; /* DTYPE_DCS_LWRITE */
+static char vle_g1[] = {0xFA, 0x03}; /* DTYPE_DCS_WRITE1 */
+static char vle_p0[] = {
+	0xF8, 0x27, 0x27, 0x08,
+	0x08, 0x4E, 0xAA, 0x5E,
+	0x8A, 0x10, 0x3F, 0x10, 0x10, 0x00}; /* DTYPE_DCS_LWRITE */
+static char vle_e2[] = {0xF6, 0x00, 0x84, 0x09}; /* DTYPE_DCS_LWRITE */
+static char vle_e3[] = {0xB0, 0x09}; /* DTYPE_DCS_WRITE1 */
+static char vle_e4[] = {0xD5, 0x64}; /* DTYPE_DCS_WRITE1 */
+static char vle_e5[] = {0xB0, 0x0B}; /* DTYPE_DCS_WRITE1 */
+static char vle_e6[] = {0xD5, 0xA4, 0x7E, 0x20}; /* DTYPE_DCS_LWRITE */
+static char vle_e7[] = {0xF7, 0x03}; /* DTYPE_DCS_WRITE1 */
+static char vle_e8[] = {0xB0, 0x02}; /* DTYPE_DCS_WRITE1 */
+static char vle_e9[] = {0xB3, 0xC3}; /* DTYPE_DCS_WRITE1 */
+static char vle_e10[] = {0xB0, 0x08}; /* DTYPE_DCS_WRITE1 */
+static char vle_e11[] = {0xFD, 0xF8}; /* DTYPE_DCS_WRITE1 */
+static char vle_e12[] = {0xB0, 0x04}; /* DTYPE_DCS_WRITE1 */
+static char vle_e13[] = {0xF2, 0x4D}; /* DTYPE_DCS_WRITE1 */
+static char vle_e14[] = {0xB0, 0x05}; /* DTYPE_DCS_WRITE1 */
+static char vle_e15[] = {0xFD, 0x1F}; /* DTYPE_DCS_WRITE1 */
+static char vle_e16[] = {0xB1, 0x01, 0x00, 0x16}; /* DTYPE_DCS_LWRITE */
+static char vle_e17[] = {0xB2, 0x10, 0x10, 0x10, 0x10}; /* DTYPE_DCS_LWRITE */
+static char vle_e17_C2[] = {0xB2, 0x15, 0x15, 0x15, 0x15}; /* DTYPE_DCS_LWRITE */
+
+static struct dsi_cmd_desc ville_cmd_on_cmds[] = {
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e0), vle_e0},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e1), vle_e1},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e22), vle_e22},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_g0), vle_g0},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_g1), vle_g1},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_p0), vle_p0},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e2), vle_e2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e3), vle_e3},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e4), vle_e4},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e5), vle_e5},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e6), vle_e6},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e7), vle_e7},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e8), vle_e8},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e9), vle_e9},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e10), vle_e10},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e11), vle_e11},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e12), vle_e12},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e13), vle_e13},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e14), vle_e14},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e15), vle_e15},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e16), vle_e16},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e17), vle_e17},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 120, sizeof(exit_sleep), exit_sleep},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(enable_te), enable_te},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(ville_panel_width), ville_panel_width},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(ville_panel_height), ville_panel_height},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(ville_panel_vinit), ville_panel_vinit},
+};
+
+static struct dsi_cmd_desc ville_cmd_on_cmds_c2[] = {
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e0), vle_e0},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e1), vle_e1},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e22), vle_e22},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_g0), vle_g0},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_g1), vle_g1},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_p0), vle_p0},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e2), vle_e2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e3), vle_e3},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e4), vle_e4},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e5), vle_e5},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e6), vle_e6},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e7), vle_e7},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e8), vle_e8},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e9), vle_e9},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e10), vle_e10},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e11), vle_e11},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e12), vle_e12},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e13), vle_e13},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e14), vle_e14},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_e15), vle_e15},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e16), vle_e16},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vle_e17_C2), vle_e17_C2},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 120, sizeof(exit_sleep), exit_sleep},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(enable_te), enable_te},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(ville_panel_width), ville_panel_width},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(ville_panel_height), ville_panel_height},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(ville_panel_vinit), ville_panel_vinit},
+};
+
+
+static struct dsi_cmd_desc ville_display_off_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 0,
+		sizeof(display_off), display_off},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 120,
+		sizeof(enter_sleep), enter_sleep}
+};
+
+static struct dsi_cmd_desc ville_display_on_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 0, sizeof(display_on), display_on},
+};
+
+/* AUO initial setting command */
+static char enable_page_cmd[6] = {0xF0, 0x55, 0xAA, 0x52, 0x08, 0x00};
+static char enable_page_cmd2[2] = {0xB5, 0x40};
+static char enable_page_cmd3[2] = {0xC7, 0x00};
+static char enable_page2_cmd[6] = {0xF0, 0x55, 0xAA, 0x52, 0x08, 0x02};
+static char eng_setting_cmd[3] = {0xFE, 0x08, 0x10};
+static char eng_setting_cmd2[2] = {0xEE, 0x1D};
+static char eng_setting_cmd3[3] = {0xC3, 0xF2, 0xD5};
+static char enable_page1_cmd[6] = {0xF0, 0x55, 0xAA, 0x52, 0x08, 0x01};
+static char avdd_cmd[4] = {0xB0, 0x05, 0x05, 0x05};
+static char vghr_cmd[4] = {0xB4, 0x05, 0x05, 0x05};
+static char vglr_cmd[4] = {0xB5, 0x08, 0x08, 0x08};
+static char avdd_boosting_cmds[4] = {0xB6, 0x44, 0x44, 0x44};
+static char vgh_boosting_cmd[4] = {0xB9, 0x04, 0x04, 0x04};
+static char vgl_boosting_cmds[4] = {0xBA, 0x14, 0x14, 0x14};
+static char vgsp_cmd[4] = {0xBC, 0x00, 0x60, 0x00};
+static char vrefn_cmd[4] = {0xBE, 0x22, 0x75, 0x70};
+static char hori_flip_cmd[] = {0x36, 0x02};
+static char turn_on_peri_cmd[2] = {0x32, 0x00};
+static char sleep_out_cmd[2] = {0x11, 0x00};
+static char auo_display_on_cmd[2] = {0x29, 0x00};
+
+static char display_off_cmd[2] = {0x28, 00};
+static char slpin_cmd[2] = {0x10, 00};
+
+static struct dsi_cmd_desc auo_cmd_on_cmds[] = {
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(enable_page_cmd), enable_page_cmd},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(enable_page_cmd2), enable_page_cmd2},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(enable_page_cmd3), enable_page_cmd3},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(enable_page2_cmd), enable_page2_cmd},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(eng_setting_cmd), eng_setting_cmd},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(eng_setting_cmd2), eng_setting_cmd2},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(eng_setting_cmd3), eng_setting_cmd3},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(enable_page1_cmd), enable_page1_cmd},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(avdd_cmd), avdd_cmd},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vghr_cmd), vghr_cmd},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vglr_cmd), vglr_cmd},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(avdd_boosting_cmds), avdd_boosting_cmds},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vgh_boosting_cmd), vgh_boosting_cmd},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vgl_boosting_cmds), vgl_boosting_cmds},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vgsp_cmd), vgsp_cmd},
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0,  sizeof(vrefn_cmd), vrefn_cmd},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(hori_flip_cmd), hori_flip_cmd},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(turn_on_peri_cmd), turn_on_peri_cmd},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 300,  sizeof(sleep_out_cmd), sleep_out_cmd},
+};
+
+static struct dsi_cmd_desc auo_display_on_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 0, sizeof(auo_display_on_cmd), auo_display_on_cmd},
+};
+
+static struct dsi_cmd_desc auo_display_off_cmds[] = {
+	{DTYPE_DCS_WRITE, 1, 0, 0, 0,
+		sizeof(display_off_cmd), display_off_cmd},
+	{DTYPE_DCS_WRITE, 1, 0, 0, 120,
+		sizeof(slpin_cmd), slpin_cmd}
+};
+
+#define AMOLED_NUM_LEVELS 	ARRAY_SIZE(ville_amoled_gamma_table)
+#define AMOLED_NUM_LEVELS_C2 	ARRAY_SIZE(ville_amoled_gamma_table_c2)
+
+
+static const char ville_amoled_gamma_table[][AMOLED_GAMMA_TABLE_SIZE] = {
+	/* level 10 */
+	{0xFA, 0x02, 0x10, 0x10, 0x10, 0x59, 0x5F, 0x66, 0x81, 0x80,
+		0x7F, 0xD9, 0xC3, 0xD5, 0xCD, 0xA3, 0xC7, 0xDB, 0xD2, 0xDD,
+		0x00, 0x42, 0x00, 0x2B, 0x00, 0x47},
+	/* level 40 */
+	{0xFA, 0x02, 0x10, 0x10, 0x10, 0x8B, 0x91, 0x98, 0xD1, 0xA8,
+		0xC9, 0xE3, 0xC5, 0xDD, 0xC5, 0xC2, 0xC8, 0xD6, 0xD2, 0xD3,
+		0x00, 0x62, 0x00, 0x49, 0x00, 0x60},
+	/* level 70 */
+	{0xFA, 0x02, 0x10, 0x10, 0x10, 0xAD, 0xA8, 0xB9, 0xD7, 0xAD,
+		0xCE, 0xDF, 0xD0, 0xDD, 0xBF, 0xBF, 0xC1, 0xD3, 0xCF, 0xCF,
+		0x00, 0x74, 0x00, 0x59, 0x00, 0x82},
+	/* level 100 */
+	{0xFA, 0x02, 0x10, 0x10, 0x10, 0xBD, 0xAC, 0xC6, 0xD4, 0xAC,
+		0xCC, 0xDF, 0xD9, 0xDF, 0xBE, 0xC0, 0xBD, 0xD0, 0xCC, 0xCB,
+		0x00, 0x81, 0x00, 0x65, 0x00, 0x92},
+	/* level 130 */
+	{0xFA, 0x02, 0x10, 0x10, 0x10, 0xC5, 0xAB, 0xCD, 0xD7, 0xB9,
+		0xD1, 0xDC, 0xD7, 0xDD, 0xBD, 0xC0, 0xBA, 0xCD, 0xC9, 0xC8,
+		0x00, 0x8C, 0x00, 0x6F, 0x00, 0xA0},
+	/* level 160 */
+	{0xFA, 0x02, 0x10, 0x10, 0x10, 0xD0, 0xB0, 0xD7, 0xD5, 0xBD,
+		0xD0, 0xDC, 0xD7, 0xDB, 0xBB, 0xBE, 0xB8, 0xCA, 0xC8, 0xC5,
+		0x00, 0x96, 0x00, 0x77, 0x00, 0xAC},
+	/* level 200 */
+	{0xFA, 0x02, 0x10, 0x10, 0x10, 0xEC, 0xB7, 0xEF, 0xD4, 0xC1,
+		0xD0, 0xDC, 0xD8, 0xDB, 0xB9, 0xBC, 0xB5, 0xC8, 0xC8, 0xC3,
+		0x00, 0xA1, 0x00, 0x80, 0x00, 0xBA},
+	/* level 250 */
+	{0xFA, 0x02, 0x10, 0x10, 0x10, 0xE8, 0xB9, 0xEC, 0xD2, 0xC5,
+		0xD0, 0xDA, 0xD8, 0xD8, 0xB7, 0xBA, 0xB2, 0xC6, 0xC7, 0xC0,
+		0x00, 0xAD, 0x00, 0x8A, 0x00, 0xCA},
+	/* level 300 */
+	{0xFA, 0x02, 0x10, 0x10, 0x10, 0xEC, 0xB7, 0xEF, 0xD1, 0xCA,
+		0xD1, 0xDB, 0xDA, 0xD8, 0xB5, 0xB8, 0xB0, 0xC5, 0xC8, 0xBF,
+		0x00, 0xB9, 0x00, 0x93, 0x00, 0xD9},
+};
+
+static const char ville_amoled_gamma_table_c2[][AMOLED_GAMMA_TABLE_SIZE] = {
+	/* level 10 */
+//	{0xFA, 0x02, 0x55, 0x43, 0x58, 0x5A, 0x5A, 0x5A, 0x80, 0x80,
+//		0x80, 0xBD, 0xC6, 0xBB, 0x96, 0xA6, 0x93, 0xBD, 0xCD, 0xC6,
+//		0x00, 0x4C, 0x00, 0x44, 0x00, 0x57},
+	/* level 20 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0x63, 0x63, 0x64, 0xA3, 0xA6,
+		0xA1, 0xB6, 0xC2, 0xB2, 0x97, 0xAA, 0x9C, 0xBD, 0xC8, 0xC0,
+		0x00, 0x5E, 0x00, 0x54, 0x00, 0x69},
+	/* level 40 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0x8C, 0x8C, 0x8C, 0xA1, 0xAF,
+		0x9D, 0xBF, 0xC8, 0xBC, 0x9A, 0xAF, 0xA4, 0xBB, 0xC3, 0xBA,
+		0x00, 0x73, 0x00, 0x68, 0x00, 0x81},
+	/* level 60 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0x91, 0x94, 0x90, 0xA7, 0xB5,
+		0xA3, 0xBD, 0xCA, 0xC0, 0x96, 0xA8, 0x9D, 0xBA, 0xC2, 0xB8,
+		0x00, 0x83, 0x00, 0x76, 0x00, 0x92},
+	/* level 80 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0x9B, 0xA0, 0x99, 0xA6, 0xB3,
+		0xA2, 0xBD, 0xCC, 0xC4, 0x96, 0xA5, 0x99, 0xBA, 0xC1, 0xB7,
+		0x00, 0x8F, 0x00, 0x81, 0x00, 0xA0},
+	/* level 100 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0xA3, 0xAC, 0xA1, 0xA5, 0xB2,
+		0xA2, 0xC0, 0xD0, 0xC8, 0x96, 0xA3, 0x97, 0xB7, 0xBE, 0xB5,
+		0x00, 0x9A, 0x00, 0x8B, 0x00, 0xAC},
+	/* level 120 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0xA6, 0xB1, 0xA3, 0xAA, 0xB8,
+		0xA9, 0xBF, 0xCE, 0xC7, 0x95, 0xA1, 0x95, 0xB6, 0xBC, 0xB4,
+		0x00, 0xA3, 0x00, 0x94, 0x00, 0xB7},
+	/* level 140 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0xA9, 0xB6, 0xA6, 0xAE, 0xBC,
+		0xB0, 0xBD, 0xCC, 0xC4, 0x97, 0xA2, 0x95, 0xB4, 0xBA, 0xB1,
+		0x00, 0xAC, 0x00, 0x9C, 0x00, 0xC1},
+	/* level 160 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0xA5, 0xB2, 0xA1, 0xAD, 0xBC,
+		0xB0, 0xBD, 0xCB, 0xC3, 0x95, 0xA0, 0x93, 0xB1, 0xB7, 0xAE,
+		0x00, 0xB5, 0x00, 0xA5, 0x00, 0xCC},
+	/* level 180 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0xAA, 0xB9, 0xA6, 0xAD, 0xBE,
+		0xB2, 0xBE, 0xCA, 0xC3, 0x94, 0x9E, 0x92, 0xB1, 0xB7, 0xAD,
+		0x00, 0xBC, 0x00, 0xAC, 0x00, 0xD5},
+	/* level 200 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0xA6, 0xB6, 0xA2, 0xAC, 0xBD,
+		0xB2, 0xBE, 0xC9, 0xC2, 0x93, 0x9E, 0x91, 0xAF, 0xB5, 0xAB,
+		0x00, 0xC4, 0x00, 0xB3, 0x00, 0xDD},
+	/* level 220 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0xAB, 0xBB, 0xA6, 0xAB, 0xBD,
+		0xB2, 0xBC, 0xC7, 0xBF, 0x93, 0x9D, 0x90, 0xAF, 0xB4, 0xAB,
+		0x00, 0xCA, 0x00, 0xB9, 0x00, 0xE5},
+	/* level 240 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0xAB, 0xBD, 0xA7, 0xAF, 0xC1,
+		0xB7, 0xBC, 0xC6, 0xBE, 0x92, 0x9D, 0x90, 0xAE, 0xB3, 0xA9,
+		0x00, 0xD1, 0x00, 0xBF, 0x00, 0xED},
+	/* level 260 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0xA8, 0xBA, 0xA3, 0xAE, 0xC0,
+		0xB7, 0xBC, 0xC5, 0xBD, 0x92, 0x9D, 0x90, 0xAC, 0xB1, 0xA7,
+		0x00, 0xD8, 0x00, 0xC5, 0x00, 0xF5},
+	/* level 280 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0xAC, 0xBF, 0xA7, 0xAC, 0xC0,
+		0xB7, 0xBE, 0xC6, 0xBE, 0x90, 0x9A, 0x8D, 0xAC, 0xB1, 0xA7,
+		0x00, 0xDE, 0x00, 0xCB, 0x00, 0xFC},
+	/* level 300 */
+	{0xFA, 0x02, 0x55, 0x43, 0x58, 0xA9, 0xBC, 0xA4, 0xAC, 0xC0,
+		0xB7, 0xBE, 0xC6, 0xBE, 0x91, 0x9B, 0x8E, 0xAB, 0xB0, 0xA6,
+		0x00, 0xE4, 0x00, 0xD1, 0x01, 0x04},
+};
+
+static const char black_gamma[AMOLED_GAMMA_TABLE_SIZE] = {
+	0xFA, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static char set_gamma[AMOLED_GAMMA_TABLE_SIZE] = {
+	0xFA, 0x02, 0x10, 0x10, 0x10, 0xC5, 0xAB, 0xCD, 0xD7, 0xB9,
+	0xD1, 0xDC, 0xD7, 0xDD, 0xBD, 0xC0, 0xBA, 0xCD, 0xC9, 0xC8,
+	0x00, 0x8C, 0x00, 0x6F, 0x00, 0xA0};
+
+static struct dsi_cmd_desc ville_cmd_backlight_cmds[] = {
+	{DTYPE_DCS_LWRITE, 1, 0, 0, 0, sizeof(set_gamma), set_gamma},
+	{DTYPE_DCS_WRITE1, 1, 0, 0, 0,  sizeof(vle_g1), vle_g1},
+};
+
+#if defined (CONFIG_FB_MSM_MDP_ABL)
+static struct gamma_curvy smd_gamma_tbl = {
+	.gamma_len = 33,
+	.bl_len = 8,
+	.ref_y_gamma = {0, 1, 2, 4, 8, 16, 24, 33, 45, 59, 74, 94,
+		112, 133, 157, 183, 212, 244, 275, 314, 348,
+		392, 439, 487, 537, 591, 645, 706, 764, 831,
+		896, 963, 1024},
+	.ref_y_shade = {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352,
+		384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704,
+		736, 768, 800, 832, 864, 896, 928, 960, 992, 1024},
+	.ref_bl_lvl = {0, 141, 233, 317, 462, 659, 843, 1024},
+	.ref_y_lvl = {0, 138, 218, 298, 424, 601, 818, 1024},
+};
+#endif
+
+extern int ville_panel_first_init;
+static int ville_send_display_cmds(struct dsi_cmd_desc *cmd, int cnt)
+{
+	int ret = 0;
+#ifdef VILLE_USE_CMDLISTS
+	struct dcs_cmd_req cmdreq;
+
+	cmdreq.cmds = cmd;
+	cmdreq.cmds_cnt = cnt;
+	cmdreq.flags = CMD_REQ_COMMIT;
+	cmdreq.rlen = 0;
+	cmdreq.cb = NULL;
+
+	ret = mipi_dsi_cmdlist_put(&cmdreq);
+#else
+	ret = mipi_dsi_cmds_tx(&ville_tx_buf, cmd, cnt);
+#endif
+	if (ret < 0)
+		printk(KERN_ERR "[DISP] %s failed (%d)\n", __func__, ret);
+	return ret;
+}
+
+static int mipi_ville_lcd_on(struct platform_device *pdev)
+{
+	struct msm_fb_data_type *mfd;
+	struct mipi_panel_info *mipi;
+
+	printk(KERN_ERR  "[DISP] %s +++\n", __func__);
+	mfd = platform_get_drvdata(pdev);
+	if (!mfd)
+		return -ENODEV;
+	if (mfd->key != MFD_KEY)
+		return -EINVAL;
+
+	mipi  = &mfd->panel_info.mipi;
+
+	ville_send_display_cmds(display_on_cmds, display_on_cmds_count);
+
+	if (!ville_panel_first_init) {
+		if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG ||
+				panel_type == PANEL_ID_VILLE_SAMSUNG_SG_C2 ||
+				panel_type == PANEL_ID_VILLE_AUO) {
+			if (mipi->mode == DSI_CMD_MODE)
+				ville_send_display_cmds(cmd_on_cmds, cmd_on_cmds_count);
+		} else {
+			printk(KERN_ERR "%s: panel_type is not supported!(%d)\n",
+				__func__, panel_type);
+			return -EINVAL;
+		}
+	}
+	printk(KERN_ERR  "[DISP] %s ---\n", __func__);
+	ville_panel_first_init = 0;
+	return 0;
+}
+
+static int mipi_ville_lcd_off(struct platform_device *pdev)
+{
+	struct msm_fb_data_type *mfd;
+	printk(KERN_ERR  "[DISP] %s +++\n", __func__);
+	mfd = platform_get_drvdata(pdev);
+
+	if (!mfd)
+		return -ENODEV;
+	if (mfd->key != MFD_KEY)
+		return -EINVAL;
+
+	if (panel_type != PANEL_ID_NONE)
+		ville_send_display_cmds(display_off_cmds, display_off_cmds_count);
+
+	return 0;
+}
+
+static unsigned char ville_shrink_pwm(int val)
+{
+	int i;
+	int level, frac, shrink_br = 255;
+	unsigned int prev_gamma, next_gammma, interpolate_gamma;
+
+	if(val == 0) {
+		for (i = 0; i < AMOLED_GAMMA_TABLE_SIZE; ++i) {
+			interpolate_gamma = black_gamma[i];
+			set_gamma[i] = (char) interpolate_gamma;
+		}
+		return val;
+	}
+
+	val = clamp(val, BRI_SETTING_MIN, BRI_SETTING_MAX);
+
+	if ((val >= BRI_SETTING_MIN) && (val <= BRI_SETTING_DEF)) {
+			shrink_br = (val - BRI_SETTING_MIN) * (PWM_DEFAULT - PWM_MIN) /
+		(BRI_SETTING_DEF - BRI_SETTING_MIN) + PWM_MIN;
+	} else if (val > BRI_SETTING_DEF && val <= BRI_SETTING_MAX) {
+			shrink_br = (val - BRI_SETTING_DEF) * (PWM_MAX - PWM_DEFAULT) /
+		(BRI_SETTING_MAX - BRI_SETTING_DEF) + PWM_DEFAULT;
+	} else if (val > BRI_SETTING_MAX)
+			shrink_br = PWM_MAX;
+
+	level = (shrink_br - AMOLED_MIN_VAL) / AMOLED_LEVEL_STEP;
+	frac = (shrink_br - AMOLED_MIN_VAL) % AMOLED_LEVEL_STEP;
+
+	for (i = 0 ; i < AMOLED_GAMMA_TABLE_SIZE ; ++i) {
+		if (frac == 0 || level == 8) {
+			interpolate_gamma = ville_amoled_gamma_table[level][i];
+		} else {
+			prev_gamma = ville_amoled_gamma_table[level][i];
+			next_gammma = ville_amoled_gamma_table[level+1][i];
+			interpolate_gamma = (prev_gamma * (AMOLED_LEVEL_STEP -
+									frac) + next_gammma * frac) /
+									AMOLED_LEVEL_STEP;
+		}
+		set_gamma[i] = (char) interpolate_gamma;
+	}
+
+	return val;
+}
+
+static unsigned char ville_shrink_pwm_c2(int val)
+{
+	int i;
+	int level, frac, shrink_br = 255;
+	unsigned int prev_gamma, next_gammma, interpolate_gamma;
+
+	if(val == 0) {
+		for (i = 0; i < AMOLED_GAMMA_TABLE_SIZE; ++i) {
+			interpolate_gamma = black_gamma[i];
+			set_gamma[i] = (char) interpolate_gamma;
+		}
+		return val;
+	}
+
+	val = clamp(val, BRI_SETTING_MIN, BRI_SETTING_MAX);
+
+	if ((val >= BRI_SETTING_MIN) && (val <= BRI_SETTING_DEF)) {
+			shrink_br = (val - BRI_SETTING_MIN) * (PWM_DEFAULT - PWM_MIN) /
+		(BRI_SETTING_DEF - BRI_SETTING_MIN) + PWM_MIN;
+	} else if (val > BRI_SETTING_DEF && val <= BRI_SETTING_MAX) {
+			shrink_br = (val - BRI_SETTING_DEF) * (PWM_MAX - PWM_DEFAULT) /
+		(BRI_SETTING_MAX - BRI_SETTING_DEF) + PWM_DEFAULT;
+	} else if (val > BRI_SETTING_MAX)
+			shrink_br = PWM_MAX;
+
+	level = (shrink_br - AMOLED_MIN_VAL) / AMOLED_LEVEL_STEP_C2;
+	frac = (shrink_br - AMOLED_MIN_VAL) % AMOLED_LEVEL_STEP_C2;
+
+	for (i = 0; i < AMOLED_GAMMA_TABLE_SIZE - 2; ++i) {
+		if (frac == 0 || level == 14) {
+			interpolate_gamma = ville_amoled_gamma_table_c2[level][i];
+		} else {
+			prev_gamma = ville_amoled_gamma_table_c2[level][i];
+			next_gammma = ville_amoled_gamma_table_c2[level+1][i];
+			interpolate_gamma = (prev_gamma * (AMOLED_LEVEL_STEP_C2 -
+									frac) + next_gammma * frac) /
+									AMOLED_LEVEL_STEP_C2;
+		}
+		set_gamma[i] = (char) interpolate_gamma;
+	}
+
+	/* special case for SMD gamma setting  */
+	if(frac == 0 || level == 14) {
+		set_gamma[24] = (char)(ville_amoled_gamma_table_c2[level][24]);
+		set_gamma[25] = (char)(ville_amoled_gamma_table_c2[level][25]);
+	} else {
+		prev_gamma = ville_amoled_gamma_table_c2[level][24] * 256 + ville_amoled_gamma_table_c2[level][25];
+		next_gammma = ville_amoled_gamma_table_c2[level+1][24] * 256 + ville_amoled_gamma_table_c2[level+1][25];
+		interpolate_gamma = (prev_gamma * (AMOLED_LEVEL_STEP_C2 -
+						frac) + next_gammma * frac) /
+						AMOLED_LEVEL_STEP_C2;
+		set_gamma[24] = interpolate_gamma / 256;
+		set_gamma[25] = interpolate_gamma % 256;
+	}
+
+	return val;
+}
+
+inline void mipi_dsi_set_backlight(struct msm_fb_data_type *mfd, int level)
+{
+	struct mipi_panel_info *mipi;
+
+	mipi  = &mfd->panel_info.mipi;
+
+	printk(KERN_ERR "[DISP] %s level=%d\n", __func__, level);
+	if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG_C2)
+		ville_shrink_pwm_c2(mfd->bl_level);
+	else if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG)
+		ville_shrink_pwm(mfd->bl_level);
+
+	if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG || panel_type == PANEL_ID_VILLE_SAMSUNG_SG_C2)
+		ville_send_display_cmds(ville_cmd_backlight_cmds, ARRAY_SIZE(ville_cmd_backlight_cmds));
+
+	printk(KERN_DEBUG "%s+ bl_level=%d\n", __func__, mfd->bl_level);
+	return;
+}
+
+static void mipi_ville_set_backlight(struct msm_fb_data_type *mfd)
+{
+	mipi_dsi_set_backlight(mfd, mfd->bl_level);
+
+	cur_bl_level = mfd->bl_level;
+}
+
+static int __devinit mipi_ville_lcd_probe(struct platform_device *pdev)
+{
+	printk(KERN_ERR "%s: probe ++ %d\n", __func__, panel_type);
+	if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG ||
+			panel_type == PANEL_ID_VILLE_SAMSUNG_SG_C2) {
+		display_on_cmds = ville_display_on_cmds;
+		display_on_cmds_count = ARRAY_SIZE(ville_display_on_cmds);
+		display_off_cmds = ville_display_off_cmds;
+		display_off_cmds_count = ARRAY_SIZE(ville_display_off_cmds);
+		if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG) {
+			cmd_on_cmds = ville_cmd_on_cmds;
+			cmd_on_cmds_count = ARRAY_SIZE(ville_cmd_on_cmds);
+		} else {
+			cmd_on_cmds = ville_cmd_on_cmds_c2;
+			cmd_on_cmds_count = ARRAY_SIZE(ville_cmd_on_cmds_c2);
+		}
+	} else if (panel_type == PANEL_ID_VILLE_AUO) {
+		display_on_cmds = auo_display_on_cmds;
+		display_on_cmds_count = ARRAY_SIZE(auo_display_on_cmds);
+		display_off_cmds = auo_display_off_cmds;
+		display_off_cmds_count = ARRAY_SIZE(auo_display_off_cmds);
+		cmd_on_cmds = auo_cmd_on_cmds;
+		cmd_on_cmds_count = ARRAY_SIZE(auo_cmd_on_cmds);
+	}
+
+	if (pdev->id == 0) {
+		mipi_ville_pdata = pdev->dev.platform_data;
+		return 0;
+	}
+	ville_panel_first_init = 1;
+	msm_fb_add_device(pdev);
+	return 0;
+}
+
+static struct platform_driver this_driver = {
+	.probe  = mipi_ville_lcd_probe,
+	.driver = {
+		.name = "mipi_ville",
+	},
+};
+
+static struct msm_fb_panel_data ville_panel_data = {
+	.on		= mipi_ville_lcd_on,
+	.off		= mipi_ville_lcd_off,
+	.set_backlight = mipi_ville_set_backlight,
+};
+
+static int ch_used[3];
+
+int mipi_ville_device_register(struct msm_panel_info *pinfo,
+					u32 channel, u32 panel)
+{
+	struct platform_device *pdev = NULL;
+	int ret;
+
+	if ((channel >= 3) || ch_used[channel])
+		return -ENODEV;
+
+	ch_used[channel] = TRUE;
+
+	ret = mipi_ville_lcd_init();
+	if (ret) {
+		pr_err("mipi_ville_lcd_init() failed with ret %u\n", ret);
+		return ret;
+	}
+
+	pdev = platform_device_alloc("mipi_ville", (panel << 8)|channel);
+	if (!pdev)
+		return -ENOMEM;
+
+	ville_panel_data.panel_info = *pinfo;
+
+	ret = platform_device_add_data(pdev, &ville_panel_data,
+		sizeof(ville_panel_data));
+	if (ret) {
+		printk(KERN_ERR "%s: platform_device_add_data failed!\n", __func__);
+		goto err_device_put;
+	}
+
+	ret = platform_device_add(pdev);
+	if (ret) {
+		printk(KERN_ERR "%s: platform_device_register failed!\n", __func__);
+		goto err_device_put;
+	}
+
+	return 0;
+
+err_device_put:
+	platform_device_put(pdev);
+	return ret;
+}
+
+static int mipi_ville_lcd_init(void)
+{
+	printk(KERN_ERR  "[DISP] %s +++\n", __func__);
+#ifndef VILLE_USE_CMDLISTS
+	mipi_dsi_buf_alloc(&ville_tx_buf, DSI_BUF_SIZE);
+	mipi_dsi_buf_alloc(&ville_rx_buf, DSI_BUF_SIZE);
+#endif
+	printk(KERN_ERR  "[DISP] %s ---\n", __func__);
+	return platform_driver_register(&this_driver);
+}
diff --git a/arch/arm/mach-msm/htc/ville/display/mipi_ville.h b/arch/arm/mach-msm/htc/ville/display/mipi_ville.h
new file mode 100644
index 0000000..aba3e50
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/display/mipi_ville.h
@@ -0,0 +1,30 @@
+#ifndef MIPI_SAMSUNG_H
+#define MIPI_SAMSUNG_H
+
+#include <linux/pwm.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+
+int mipi_ville_device_register(struct msm_panel_info *pinfo,
+                                 u32 channel, u32 panel);
+
+#define VILLE_USE_CMDLISTS 1
+
+#define PWM_MIN                   30
+#define PWM_DEFAULT               142
+#define PWM_MAX                   255
+
+#define BRI_SETTING_MIN                 30
+#define BRI_SETTING_DEF                 142
+#define BRI_SETTING_MAX                 255
+
+#define AMOLED_MIN_VAL 		30
+#define AMOLED_MAX_VAL 		255
+#define AMOLED_DEF_VAL 		(AMOLED_MIN_VAL + (AMOLED_MAX_VAL - \
+								AMOLED_MIN_VAL) / 2)
+#define AMOLED_LEVEL_STEP 	((AMOLED_MAX_VAL - AMOLED_MIN_VAL) /  \
+								(AMOLED_NUM_LEVELS - 1))
+#define AMOLED_LEVEL_STEP_C2 	((AMOLED_MAX_VAL - AMOLED_MIN_VAL) /  \
+								(AMOLED_NUM_LEVELS_C2 - 1))
+#define AMOLED_GAMMA_TABLE_SIZE 25+1
+
+#endif
diff --git a/arch/arm/mach-msm/htc/ville/display/mipi_ville_cmd_qhd_pt.c b/arch/arm/mach-msm/htc/ville/display/mipi_ville_cmd_qhd_pt.c
new file mode 100644
index 0000000..681fb43
--- /dev/null
+++ b/arch/arm/mach-msm/htc/ville/display/mipi_ville_cmd_qhd_pt.c
@@ -0,0 +1,92 @@
+#include "../../../drivers/video/msm/msm_fb.h"
+#include "../../../drivers/video/msm/mipi_dsi.h"
+#include "mipi_ville.h"
+
+static struct mipi_dsi_phy_ctrl dsi_cmd_mode_phy_db = {
+	/* DSI_BIT_CLK at 250MHz, 2 lane, RGB888 */
+	/* regulator */
+	{0x03, 0x0a, 0x04, 0x00, 0x20},
+	/* timing */
+	/* clk_rate:600MHz */
+	{0xb9, 0x8e, 0x20, 0x00, 0x24, 0x50,
+	0x11, 0x90, 0x24, 0x03, 0x04, 0xa0},
+	/* phy ctrl */
+	{0x5f, 0x00, 0x00, 0x10},
+	/* strength */
+	{0xff, 0x00, 0x06, 0x00},
+	/* pll control */
+	{0x0, 0xdf, 0xb1, 0xda, 0x00, 0x50, 0x48, 0x63, 0x41, 0x0f, 0x01,
+	0x00, 0x14, 0x03, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
+};
+
+static struct msm_panel_info pinfo;
+
+static int __init mipi_cmd_ville_qhd_pt_init(void)
+{
+	int ret;
+#if defined (CONFIG_FB_MSM_MDP_ABL)
+	pinfo.panel_char = smd_gamma_tbl;
+#endif
+
+	pinfo.xres = 540;
+	pinfo.yres = 960;
+	pinfo.type = MIPI_CMD_PANEL;
+	pinfo.pdest = DISPLAY_1;
+	pinfo.wait_cycle = 0;
+	pinfo.bpp = 24;
+
+	pinfo.lcdc.h_back_porch = 64;
+	pinfo.lcdc.h_front_porch = 96;
+	pinfo.lcdc.h_pulse_width = 32;
+	pinfo.lcdc.v_back_porch = 16;
+	pinfo.lcdc.v_front_porch = 16;
+	pinfo.lcdc.v_pulse_width = 4;
+
+	pinfo.lcd.v_back_porch = 16;
+	pinfo.lcd.v_front_porch = 16;
+	pinfo.lcd.v_pulse_width = 4;
+
+	pinfo.lcd.primary_vsync_init = pinfo.yres;
+	pinfo.lcd.primary_rdptr_irq = 0;
+	pinfo.lcd.primary_start_pos = pinfo.yres +
+		pinfo.lcd.v_back_porch + pinfo.lcd.v_front_porch - 1;
+
+	pinfo.lcdc.border_clr = 0;	/* blk */
+	pinfo.lcdc.underflow_clr = 0xff;	/* blue */
+	pinfo.lcdc.hsync_skew = 0;
+	pinfo.bl_max = 255;
+	pinfo.bl_min = 1;
+	pinfo.fb_num = 2;
+	pinfo.clk_rate = 482000000;
+	pinfo.lcd.vsync_enable = TRUE;
+	pinfo.lcd.hw_vsync_mode = TRUE;
+	pinfo.lcd.refx100 = 6096; /* adjust refx100 to prevent tearing */
+
+	pinfo.mipi.mode = DSI_CMD_MODE;
+	pinfo.mipi.dst_format = DSI_CMD_DST_FORMAT_RGB888;
+	pinfo.mipi.vc = 0;
+	pinfo.mipi.rgb_swap = DSI_RGB_SWAP_RGB;
+	pinfo.mipi.esc_byte_ratio = 4;
+	pinfo.mipi.data_lane0 = TRUE;
+	pinfo.mipi.data_lane1 = TRUE;
+	pinfo.mipi.t_clk_post = 0x0a;
+	pinfo.mipi.t_clk_pre = 0x20;
+	pinfo.mipi.stream = 0;	/* dma_p */
+	pinfo.mipi.mdp_trigger = DSI_CMD_TRIGGER_NONE;
+	pinfo.mipi.dma_trigger = DSI_CMD_TRIGGER_SW;
+	pinfo.mipi.te_sel = 1; /* TE from vsycn gpio */
+	pinfo.mipi.interleave_max = 1;
+	pinfo.mipi.insert_dcs_cmd = TRUE;
+	pinfo.mipi.wr_mem_continue = 0x3c;
+	pinfo.mipi.wr_mem_start = 0x2c;
+	pinfo.mipi.dsi_phy_db = &dsi_cmd_mode_phy_db;
+
+	ret = mipi_ville_device_register(&pinfo, MIPI_DSI_PRIM,
+						MIPI_DSI_PANEL_QHD_PT);
+	if (ret)
+		printk(KERN_ERR "%s: failed to register device!\n", __func__);
+
+	return ret;
+}
+
+late_initcall(mipi_cmd_ville_qhd_pt_init);
diff --git a/arch/arm/mach-msm/include/mach/board-ext-htc.h b/arch/arm/mach-msm/include/mach/board-ext-htc.h
new file mode 100644
index 0000000..d745440
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/board-ext-htc.h
@@ -0,0 +1,168 @@
+/* arch/arm/mach-msm/include/mach/board-ext-htc.h
+ *
+ * HTC board.h extensions
+ *
+ * Copyright (C) 2013 CyanogenMod
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ASM_ARCH_MSM_BOARD_EXT_HTC_H
+#define __ASM_ARCH_MSM_BOARD_EXT_HTC_H
+
+#define SHIP_BUILD	0
+#define MFG_BUILD	1
+#define ENG_BUILD	2
+
+#if defined(CONFIG_USB_FUNCTION_MSM_HSUSB) \
+	|| defined(CONFIG_USB_MSM_72K) || defined(CONFIG_USB_MSM_72K_MODULE) \
+	|| defined(CONFIG_USB_CI13XXX_MSM)
+void msm_otg_set_vbus_state(int online);
+
+enum usb_connect_type {
+	CONNECT_TYPE_CLEAR = -2,
+	CONNECT_TYPE_UNKNOWN = -1,
+	CONNECT_TYPE_NONE = 0,
+	CONNECT_TYPE_USB,
+	CONNECT_TYPE_AC,
+	CONNECT_TYPE_9V_AC,
+	CONNECT_TYPE_WIRELESS,
+	CONNECT_TYPE_INTERNAL,
+	CONNECT_TYPE_UNSUPPORTED,
+#ifdef CONFIG_MACH_VERDI_LTE
+	CONNECT_TYPE_USB_9V_AC,
+#endif
+	CONNECT_TYPE_MHL_AC,
+};
+#endif
+
+struct t_usb_status_notifier {
+	struct list_head notifier_link;
+	const char *name;
+	void (*func)(int cable_type);
+};
+int htc_usb_register_notifier(struct t_usb_status_notifier *notifer);
+int usb_get_connect_type(void);
+static LIST_HEAD(g_lh_usb_notifier_list);
+
+struct t_cable_status_notifier{
+	struct list_head cable_notifier_link;
+	const char *name;
+	void (*func)(int cable_type);
+};
+int cable_detect_register_notifier(struct t_cable_status_notifier *);
+static LIST_HEAD(g_lh_calbe_detect_notifier_list);
+
+int board_mfg_mode(void);
+
+int board_build_flag(void);
+
+extern struct flash_platform_data msm_nand_data;
+
+extern int emmc_partition_read_proc(char *page, char **start, off_t off,
+		int count, int *eof, void *data);
+
+extern int dying_processors_read_proc(char *page, char **start, off_t off,
+		int count, int *eof, void *data);
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+typedef struct {
+	uint8_t format;
+	uint8_t reg_a3;
+	uint8_t reg_a6;
+} mhl_driving_params;
+#endif
+
+#ifdef CONFIG_MSM_CAMERA
+enum msm_camera_csi_data_format {
+	CSI_8BIT,
+	CSI_10BIT,
+	CSI_12BIT,
+};
+
+struct msm_camera_csi_params {
+	enum msm_camera_csi_data_format data_format;
+	uint8_t lane_cnt;
+	uint8_t lane_assign;
+	uint8_t settle_cnt;
+	uint8_t dpcm_scheme;
+};
+
+struct camera_led_info {
+	uint16_t enable;
+	uint16_t low_limit_led_state;
+	uint16_t max_led_current_ma;
+	uint16_t num_led_est_table;
+};
+
+struct camera_led_est {
+	uint16_t enable;
+	uint16_t led_state;
+	uint16_t current_ma;
+	uint16_t lumen_value;
+	uint16_t min_step;
+	uint16_t max_step;
+};
+
+struct camera_flash_info {
+	struct camera_led_info *led_info;
+	struct camera_led_est *led_est_table;
+};
+
+struct camera_flash_cfg {
+	int num_flash_levels;
+	int (*camera_flash)(int level);
+	uint16_t low_temp_limit;
+	uint16_t low_cap_limit;
+	uint8_t postpone_led_mode;
+	struct camera_flash_info *flash_info;
+};
+
+struct msm_camera_rawchip_info {
+	int rawchip_reset;
+	int rawchip_intr0;
+	int rawchip_intr1;
+	uint8_t rawchip_spi_freq;
+	uint8_t rawchip_mclk_freq;
+	int (*camera_rawchip_power_on)(void);
+	int (*camera_rawchip_power_off)(void);
+	int (*rawchip_use_ext_1v2)(void);
+};
+
+enum rawchip_enable_type {
+	RAWCHIP_DISABLE,
+	RAWCHIP_ENABLE,
+	RAWCHIP_DXO_BYPASS,
+	RAWCHIP_MIPI_BYPASS,
+};
+
+enum camera_vreg_type {
+	REG_LDO,
+	REG_VS,
+	REG_GPIO,
+};
+
+enum sensor_flip_mirror_info {
+	CAMERA_SENSOR_NONE,
+	CAMERA_SENSOR_MIRROR,
+	CAMERA_SENSOR_FLIP,
+	CAMERA_SENSOR_MIRROR_FLIP,
+};
+
+struct camera_vreg_t {
+	char *reg_name;
+	enum camera_vreg_type type;
+	int min_voltage;
+	int max_voltage;
+	int op_mode;
+};
+#endif /* CONFIG_MSM_CAMERA */
+
+#endif /* __ASM_ARCH_MSM_BOARD_EXT_HTC_H */
diff --git a/arch/arm/mach-msm/include/mach/board.h b/arch/arm/mach-msm/include/mach/board.h
index 25f73c4..a400d43 100644
--- a/arch/arm/mach-msm/include/mach/board.h
+++ b/arch/arm/mach-msm/include/mach/board.h
@@ -26,6 +26,9 @@
 #include <linux/of_platform.h>
 #include <linux/msm_ssbi.h>
 #include <mach/msm_bus.h>
+#ifdef CONFIG_MACH_HTC
+#include <mach/board-ext-htc.h>
+#endif
 
 struct msm_camera_io_ext {
 	uint32_t mdcphy;
@@ -61,8 +64,18 @@
 	struct msm_camera_io_ext ioext;
 	struct msm_camera_io_clk ioclk;
 	uint8_t csid_core;
+#ifdef CONFIG_MACH_HTC
+	uint8_t is_csiphy;
+	uint8_t is_csic;
+	uint8_t is_csid;
+	uint8_t is_ispif;
+#endif
 	uint8_t is_vpe;
 	struct msm_bus_scale_pdata *cam_bus_scale_table;
+#ifdef CONFIG_MACH_HTC
+	int (*camera_csi_on) (void);
+	int (*camera_csi_off)(void);
+#endif
 };
 
 #ifdef CONFIG_SENSORS_MT9T013
@@ -128,6 +141,9 @@
 
 struct msm_camera_sensor_flash_src {
 	int flash_sr_type;
+#ifdef CONFIG_MACH_HTC
+	int (*camera_flash)(int level);
+#endif
 
 	union {
 		struct msm_camera_sensor_flash_pmic pmic_src;
@@ -194,6 +210,10 @@
 	uint8_t camera_off_table_size;
 	uint32_t *camera_on_table;
 	uint8_t camera_on_table_size;
+#ifdef CONFIG_MACH_HTC
+	uint16_t *cam_gpio_tbl;
+	uint8_t cam_gpio_tbl_size;
+#endif
 };
 
 enum msm_camera_i2c_mux_mode {
@@ -224,6 +244,15 @@
 	struct msm_camera_gpio_conf *gpio_conf;
 	struct msm_camera_i2c_conf *i2c_conf;
 	struct msm_camera_csi_lane_params *csi_lane_params;
+#ifdef CONFIG_MACH_HTC
+	int sensor_reset_enable;
+	int sensor_pwd;
+	int vcm_pwd;
+	int vcm_enable;
+	int privacy_light;
+	enum sensor_flip_mirror_info mirror_flip;
+	void *privacy_light_info;
+#endif
 };
 
 enum msm_camera_actuator_name {
@@ -244,14 +273,19 @@
 	int bus_id;
 	int vcm_pwd;
 	int vcm_enable;
+#ifdef CONFIG_MACH_HTC
+	int use_rawchip_af;
+#endif
 };
 
 struct msm_eeprom_info {
 	struct i2c_board_info const *board_info;
 	int bus_id;
+#ifndef CONFIG_MACH_HTC
 	int eeprom_reg_addr;
 	int eeprom_read_length;
 	int eeprom_i2c_slave_addr;
+#endif
 };
 
 struct msm_camera_sensor_info {
@@ -276,6 +310,15 @@
 	struct msm_actuator_info *actuator_info;
 	int pmic_gpio_enable;
 	struct msm_eeprom_info *eeprom_info;
+#ifdef CONFIG_MACH_HTC
+	struct msm_camera_gpio_conf *gpio_conf;
+	int (*camera_power_on)(void);
+	int (*camera_power_off)(void);
+	int use_rawchip;
+	int power_down_disable;
+	int mirror_mode;
+	struct camera_flash_cfg* flash_cfg;
+#endif
 };
 
 struct msm_camera_board_info {
@@ -494,6 +537,10 @@
 	bool (*check_hdcp_hw_support)(void);
 	bool (*source)(void);
 	bool is_mhl_enabled;
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	mhl_driving_params *driving_params;
+	int driving_params_count;
+#endif
 };
 
 struct msm_mhl_platform_data {
diff --git a/arch/arm/mach-msm/include/mach/board_htc.h b/arch/arm/mach-msm/include/mach/board_htc.h
index b537c91..d95a4e2 100644
--- a/arch/arm/mach-msm/include/mach/board_htc.h
+++ b/arch/arm/mach-msm/include/mach/board_htc.h
@@ -44,8 +44,101 @@
 	MSM_SERIAL_NUM,
 };
 
+enum {
+	KERNEL_FLAG_WATCHDOG_ENABLE = BIT(0),
+	KERNEL_FLAG_SERIAL_HSL_ENABLE = BIT(1),
+	KERNEL_FLAG_KEEP_CHARG_ON = BIT(2),
+	KERNEL_FLAG_APPSBARK = BIT(3),
+	KERNEL_FLAG_KMEMLEAK = BIT(4),
+	KERNEL_FLAG_RESERVED_5 = BIT(5),
+	KERNEL_FLAG_MDM_CHARM_DEBUG = BIT(6),
+	KERNEL_FLAG_MSM_SMD_DEBUG = BIT(7),
+#if defined(CONFIG_ARCH_APQ8064) || defined(CONFIG_ARCH_MSM8960)
+	KERNEL_FLAG_PVS_SLOW_CPU = BIT(8),
+	KERNEL_FLAG_PVS_NOM_CPU = BIT(9),
+	KERNEL_FLAG_PVS_FAST_CPU = BIT(10),
+#else
+	KERNEL_FLAG_RESERVED_8 = BIT(8),
+	KERNEL_FLAG_RESERVED_9 = BIT(9),
+	KERNEL_FLAG_RESERVED_10 = BIT(10),
+#endif
+	KERNEL_FLAG_ENABLE_SSR_MODEM = BIT(11),
+	KERNEL_FLAG_ENABLE_SSR_WCNSS = BIT(12),
+	KERNEL_FLAG_DISABLE_WAKELOCK = BIT(13),
+	KERNEL_FLAG_PA_RECHARG_TEST = BIT(14),
+	KERNEL_FLAG_TEST_PWR_SUPPLY = BIT(15),
+	KERNEL_FLAG_RIL_DBG_DMUX = BIT(16),
+	KERNEL_FLAG_RIL_DBG_RMNET = BIT(17),
+	KERNEL_FLAG_RIL_DBG_CMUX = BIT(18),
+	KERNEL_FLAG_RIL_DBG_DATA_LPM = BIT(19),
+	KERNEL_FLAG_RIL_DBG_CTL = BIT(20),
+	KERNEL_FLAG_RIL_DBG_ALDEBUG_LAWDATA = BIT(21),
+	KERNEL_FLAG_RIL_DBG_MEMCPY = BIT(22),
+	KERNEL_FLAG_RIL_DBG_RPC = BIT(23),
+	KERNEL_FLAG_RESERVED_24 = BIT(24),
+	KERNEL_FLAG_PM_MONITOR = BIT(25),
+	KERNEL_FLAG_ENABLE_FAST_CHARGE = BIT(26),
+	KERNEL_FLAG_WAKELOCK_DBG = BIT(27),
+	KERNEL_FLAG_RESERVED_28 = BIT(28),
+	KERNEL_FLAG_ENABLE_BMS_CHARGER_LOG = BIT(29),
+	KERNEL_FLAG_RPM_DISABLE_WATCHDOG = BIT(30),
+	KERNEL_FLAG_GPIO_DUMP = BIT(31),
+};
 
-/* common init routines for use by arch/arm/mach-msm/board-*.c */
+enum {
+	RADIO_FLAG_RESERVE_0 = BIT(0),
+	RADIO_FLAG_RESERVE_1 = BIT(1),
+	RADIO_FLAG_RESERVE_2 = BIT(2),
+	RADIO_FLAG_USB_UPLOAD = BIT(3),
+	RADIO_FLAG_OWN_SERIAL = BIT(8),
+	RADIO_FLAG_OWN_USB = BIT(9),
+	RADIO_FLAG_OWN_SD = BIT(10),
+	RADIO_FLAG_RESTART_EN = BIT(11),
+	RADIO_FLAG_ENABLE_CHARGE_SW_PROTECT = BIT(12),
+	RADIO_FLAG_HTC_SET_MIN_CLKRGM_PERF_LEVEL_2 = (1 << 13),
+	RADIO_FLAG_HTC_SET_MIN_CLKRGM_PERF_LEVEL_3 = (2 << 13),
+	RADIO_FLAG_HTC_SET_MIN_CLKRGM_PERF_LEVEL_4 = (3 << 13),
+	RADIO_FLAG_HTC_SET_MAX_CLKRGM_PERF_LEVEL_0 = (4 << 13),
+	RADIO_FLAG_HTC_SET_MAX_CLKRGM_PERF_LEVEL_1 = (5 << 13),
+	RADIO_FLAG_HTC_SET_MAX_CLKRGM_PERF_LEVEL_2 = (6 << 13),
+	RADIO_FLAG_HTC_SET_MAX_CLKRGM_PERF_LEVEL_3 = (7 << 13),
+	RADIO_FLAG_HTC_SET_MAX_CLKRGM_PERF_LEVEL_4 = (8 << 13),
+	RADIO_FLAG_HTC_SET_FIX_CLKRGM_PERF_LEVEL_0 = (9 << 13),
+	RADIO_FLAG_HTC_SET_FIX_CLKRGM_PERF_LEVEL_1 = (10 << 13),
+	RADIO_FLAG_HTC_SET_FIX_CLKRGM_PERF_LEVEL_2 = (11 << 13),
+	RADIO_FLAG_HTC_SET_FIX_CLKRGM_PERF_LEVEL_3 = (12 << 13),
+	RADIO_FLAG_HTC_SET_FIX_CLKRGM_PERF_LEVEL_4 = (13 << 13),
+	RADIO_FLAG_HTC_SET_FIX_CLKRGM_PERF_LEVEL_5 = (14 << 13),
+	RADIO_FLAG_RESERVE_16 = BIT(16),
+	RADIO_FLAG_RESERVE_17 = BIT(17),
+	RADIO_FLAG_RESERVE_18 = BIT(18),
+	RADIO_FLAG_RESTART_DEBUG_EN = BIT(19),
+	RADIO_FLAG_USB_IF_FLAG = BIT(20),
+	RADIO_FLAG_RESERVE_21 = BIT(21),
+	RADIO_FLAG_RESERVE_22 = BIT(22),
+	RADIO_FLAG_RESERVE_23 = BIT(23),
+	RADIO_FLAG_RESERVE_24 = BIT(24),
+	RADIO_FLAG_FATAL_POPUP_DIALOG = BIT(25),
+	RADIO_FLAG_FATAL_RESET_WHEN_FATAL = BIT(26),
+	RADIO_FLAG_RESERVE_27 = BIT(27),
+	RADIO_FLAG_DOG_2061_LOG_ENABLE = BIT(28),
+	RADIO_FLAG_SLEEP_LOG_ENABLE = BIT(29),
+	RADIO_FLAG_AUTO_DLMODE_WHEN_FATAL = BIT(30),
+	RADIO_FLAG_USE_EFS_NV = BIT(31),
+};
+
+enum {
+	MFG_MODE_NORMAL,
+	MFG_MODE_FACTORY2,
+	MFG_MODE_RECOVERY,
+	MFG_MODE_CHARGE,
+	MFG_MODE_POWER_TEST,
+	MFG_MODE_OFFMODE_CHARGING,
+	MFG_MODE_MFGKERNEL_DIAG58,
+	MFG_MODE_GIFT_MODE,
+	MFG_MODE_MFGKERNEL,
+	MFG_MODE_MINI,
+};
 
 void __init msm_add_usb_devices(void (*phy_reset) (void));
 void __init msm_add_mem_devices(struct msm_pmem_setting *setting);
@@ -56,17 +149,21 @@
 int __init msm_add_serial_devices(unsigned uart);
 
 #if defined(CONFIG_USB_FUNCTION_MSM_HSUSB)
-/* START: add USB connected notify function */
 struct t_usb_status_notifier{
 	struct list_head notifier_link;
 	const char *name;
 	void (*func)(int online);
 };
-	int usb_register_notifier(struct t_usb_status_notifier *);
+	int htc_usb_register_notifier(struct t_usb_status_notifier *);
 	static LIST_HEAD(g_lh_usb_notifier_list);
-/* END: add USB connected notify function */
 #endif
 
+#ifdef CONFIG_RESET_BY_CABLE_IN
+void reset_dflipflop(void);
+#endif
+
+void __init htc_add_ramconsole_devices(void);
+
 int __init board_mfg_mode(void);
 int __init parse_tag_smi(const struct tag *tags);
 int __init parse_tag_hwid(const struct tag * tags);
@@ -74,5 +171,8 @@
 int parse_tag_engineerid(const struct tag * tags);
 
 char *board_serialno(void);
+unsigned long get_kernel_flag(void);
+unsigned int get_radio_flag(void);
+unsigned int get_tamper_sf(void);
 
 #endif
diff --git a/arch/arm/mach-msm/include/mach/cable_detect.h b/arch/arm/mach-msm/include/mach/cable_detect.h
new file mode 100644
index 0000000..fdb1820
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/cable_detect.h
@@ -0,0 +1,97 @@
+#ifndef _CABLE_DETECT_H_
+#define _CABLE_DETECT_H_
+
+#define DOCK_STATE_UNDEFINED				-1
+#define DOCK_STATE_UNDOCKED				0
+#define DOCK_STATE_DESK					(1 << 0)
+#define DOCK_STATE_CAR						(1 << 1)
+#define DOCK_STATE_USB_HEADSET			(1 << 2)
+#define DOCK_STATE_MHL						(1 << 3)
+#define DOCK_STATE_USB_HOST				(1 << 4)
+#define DOCK_STATE_DMB						(1 << 5)
+#define DOCK_STATE_AUDIO_DOCK				(1 << 6)
+
+#define DOCK_DET_DELAY		HZ/4
+
+#define ADC_RETRY 3
+#define ADC_DELAY HZ/8
+
+#define PM8058ADC_15BIT(adc) ((adc * 2200) / 32767) 
+
+#define CABLE_ERR(fmt, args...) \
+	printk(KERN_ERR "[CABLE:ERR] " fmt, ## args)
+#define CABLE_WARNING(fmt, args...) \
+	printk(KERN_WARNING "[CABLE] " fmt, ## args)
+#define CABLE_INFO(fmt, args...) \
+	printk(KERN_INFO "[CABLE] " fmt, ## args)
+#define CABLE_DEBUG(fmt, args...) \
+	printk(KERN_DEBUG "[CABLE] " fmt, ## args)
+
+enum accessory_type {
+	CABLE_TYPE_UNKOWN = 0,
+	CABLE_TYPE_ID_PIN,
+	CABLE_TYPE_PMIC_ADC,
+};
+
+enum dpdn_path_type {
+	PATH_USB = 0,
+	PATH_MHL,
+	PATH_USB_AUD,
+	PATH_UART,
+};
+
+#if 0
+static struct switch_dev dock_switch = {
+	.name = "dock",
+};
+#endif
+
+struct usb_id_mpp_config_data {
+	u32 usbid_mpp;
+	u32 usbid_amux;
+};
+
+struct cable_detect_platform_data {
+	int vbus_mpp_gpio;
+	int vbus_mpp_irq;
+	void (*vbus_mpp_config)(void);
+	
+	void (*usb_uart_switch)(int);
+	void (*usb_dpdn_switch)(int);
+
+	int ad_en_active_state;
+	int ad_en_gpio;
+	int ad_en_irq;
+	
+	u8 accessory_type;
+	u8 mfg_usb_carkit_enable;
+	int usb_id_pin_gpio;
+	__u8 detect_type;
+	u8 mhl_reset_gpio;
+	bool mhl_version_ctrl_flag;
+	struct usb_id_mpp_config_data mpp_data;
+	void (*config_usb_id_gpios)(bool enable);
+	void (*mhl_1v2_power)(bool enable);
+	int (*is_wireless_charger)(void);
+	int64_t (*get_adc_cb)(void);
+
+	int ac_9v_gpio;
+	void (*configure_ac_9v_gpio) (int);
+	u8 mhl_internal_3v3;
+
+#ifdef CONFIG_CABLE_DETECT_GPIO_DOCK
+	bool dock_detect;
+	int dock_pin_gpio;
+#endif
+};
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+extern void sii9234_mhl_device_wakeup(void);
+#endif
+extern int cable_get_connect_type(void);
+extern void set_mfg_usb_carkit_enable(int enable);
+extern int cable_get_accessory_type(void);
+extern int cable_get_usb_id_level(void);
+extern void cable_set_uart_switch(int);
+extern irqreturn_t cable_detection_vbus_irq_handler(void);
+#endif
diff --git a/arch/arm/mach-msm/include/mach/camera.h b/arch/arm/mach-msm/include/mach/camera.h
index 1518cee..4da23ea 100644
--- a/arch/arm/mach-msm/include/mach/camera.h
+++ b/arch/arm/mach-msm/include/mach/camera.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -18,14 +18,14 @@
 #include <linux/poll.h>
 #include <linux/cdev.h>
 #include <linux/platform_device.h>
-#include <linux/pm_qos.h>
+#include <linux/wakelock.h>
 #include <linux/regulator/consumer.h>
 #include "linux/types.h"
 
 #include <mach/board.h>
 #include <media/msm_camera.h>
-#include <linux/msm_ion.h>
-#include <mach/iommu_domains.h>
+#include <mach/msm_subsystem_map.h>
+#include <linux/ion.h>
 
 #define CONFIG_MSM_CAMERA_DEBUG
 #ifdef CONFIG_MSM_CAMERA_DEBUG
@@ -34,6 +34,18 @@
 #define CDBG(fmt, args...) do { } while (0)
 #endif
 
+#ifdef pr_err
+#undef pr_err
+#endif
+#define pr_err(fmt, args...) \
+        printk(KERN_ERR "[CAM][ERR] " pr_fmt(fmt), ## args)
+
+#ifdef pr_info
+#undef pr_info
+#endif
+#define pr_info(fmt, args...) \
+        printk(KERN_INFO "[CAM] " pr_fmt(fmt), ## args)
+
 #define PAD_TO_2K(a, b) ((!b) ? a : (((a)+2047) & ~2047))
 
 #define MSM_CAMERA_MSG 0
@@ -57,50 +69,48 @@
 };
 
 enum msm_queue {
-	MSM_CAM_Q_CTRL,     /* control command or control command status */
-	MSM_CAM_Q_VFE_EVT,  /* adsp event */
-	MSM_CAM_Q_VFE_MSG,  /* adsp message */
-	MSM_CAM_Q_V4L2_REQ, /* v4l2 request */
-	MSM_CAM_Q_VPE_MSG,  /* vpe message */
-	MSM_CAM_Q_PP_MSG,  /* pp message */
+	MSM_CAM_Q_CTRL,     
+	MSM_CAM_Q_VFE_EVT,  
+	MSM_CAM_Q_VFE_MSG,  
+	MSM_CAM_Q_V4L2_REQ, 
+	MSM_CAM_Q_VPE_MSG,  
+	MSM_CAM_Q_PP_MSG,  
 };
 
 enum vfe_resp_msg {
 	VFE_EVENT,
 	VFE_MSG_GENERAL,
 	VFE_MSG_SNAPSHOT,
-	VFE_MSG_OUTPUT_P,   /* preview (continuous mode ) */
-	VFE_MSG_OUTPUT_T,   /* thumbnail (snapshot mode )*/
-	VFE_MSG_OUTPUT_S,   /* main image (snapshot mode )*/
-	VFE_MSG_OUTPUT_V,   /* video   (continuous mode ) */
+	VFE_MSG_OUTPUT_P,   
+	VFE_MSG_OUTPUT_T,   
+	VFE_MSG_OUTPUT_S,   
+	VFE_MSG_OUTPUT_V,   
 	VFE_MSG_STATS_AEC,
 	VFE_MSG_STATS_AF,
 	VFE_MSG_STATS_AWB,
-	VFE_MSG_STATS_RS, /* 10 */
+	VFE_MSG_STATS_RS, 
 	VFE_MSG_STATS_CS,
 	VFE_MSG_STATS_IHIST,
 	VFE_MSG_STATS_SKIN,
-	VFE_MSG_STATS_WE, /* AEC + AWB */
+	VFE_MSG_STATS_WE, 
 	VFE_MSG_SYNC_TIMER0,
 	VFE_MSG_SYNC_TIMER1,
 	VFE_MSG_SYNC_TIMER2,
 	VFE_MSG_COMMON,
-	VFE_MSG_START,
-	VFE_MSG_START_RECORDING, /* 20 */
-	VFE_MSG_CAPTURE,
-	VFE_MSG_JPEG_CAPTURE,
+	VFE_MSG_V32_START,
+	VFE_MSG_V32_START_RECORDING, 
+	VFE_MSG_V32_CAPTURE,
+	VFE_MSG_V32_JPEG_CAPTURE,
 	VFE_MSG_OUTPUT_IRQ,
-	VFE_MSG_PREVIEW,
+	VFE_MSG_V2X_PREVIEW,
+	VFE_MSG_V2X_CAPTURE,
 	VFE_MSG_OUTPUT_PRIMARY,
 	VFE_MSG_OUTPUT_SECONDARY,
-	VFE_MSG_OUTPUT_TERTIARY1,
-	VFE_MSG_OUTPUT_TERTIARY2,
-	VFE_MSG_OUTPUT_TERTIARY3,
 };
 
 enum vpe_resp_msg {
 	VPE_MSG_GENERAL,
-	VPE_MSG_OUTPUT_V,   /* video   (continuous mode ) */
+	VPE_MSG_OUTPUT_V,   
 	VPE_MSG_OUTPUT_ST_L,
 	VPE_MSG_OUTPUT_ST_R,
 };
@@ -116,6 +126,52 @@
 	STEREO_RAW_SNAP_STARTED,
 };
 
+enum msm_ispif_intftype {
+	PIX0,
+	RDI0,
+	PIX1,
+	RDI1,
+	PIX2,
+	RDI2,
+};
+
+enum msm_ispif_vc {
+	VC0,
+	VC1,
+	VC2,
+	VC3,
+};
+
+enum msm_ispif_cid {
+	CID0,
+	CID1,
+	CID2,
+	CID3,
+	CID4,
+	CID5,
+	CID6,
+	CID7,
+	CID8,
+	CID9,
+	CID10,
+	CID11,
+	CID12,
+	CID13,
+	CID14,
+	CID15,
+};
+
+struct msm_ispif_params {
+	uint8_t intftype;
+	uint16_t cid_mask;
+	uint8_t csid;
+};
+
+struct msm_ispif_params_list {
+	uint32_t len;
+	struct msm_ispif_params params[3];
+};
+
 struct msm_vpe_phy_info {
 	uint32_t sbuf_phy;
 	uint32_t planar0_off;
@@ -124,18 +180,56 @@
 	uint32_t p0_phy;
 	uint32_t p1_phy;
 	uint32_t p2_phy;
-	uint8_t  output_id; /* VFE31_OUTPUT_MODE_PT/S/V */
+	uint8_t  output_id; 
 	uint32_t frame_id;
 };
 
-#ifndef CONFIG_MSM_CAMERA_V4L2
+struct msm_camera_csid_vc_cfg {
+	uint8_t cid;
+	uint8_t dt;
+	uint8_t decode_format;
+};
+
+struct msm_camera_csid_lut_params {
+	uint8_t num_cid;
+	struct msm_camera_csid_vc_cfg *vc_cfg;
+};
+
+struct msm_camera_csid_params {
+	uint8_t lane_cnt;
+	uint8_t lane_assign;
+	struct msm_camera_csid_lut_params lut_params;
+};
+
+struct msm_camera_csiphy_params {
+	uint8_t lane_cnt;
+	uint8_t settle_cnt;
+	uint8_t lane_mask;
+};
+
+struct msm_camera_csi2_params {
+	struct msm_camera_csid_params csid_params;
+	struct msm_camera_csiphy_params csiphy_params;
+};
+
 #define VFE31_OUTPUT_MODE_PT (0x1 << 0)
 #define VFE31_OUTPUT_MODE_S (0x1 << 1)
 #define VFE31_OUTPUT_MODE_V (0x1 << 2)
 #define VFE31_OUTPUT_MODE_P (0x1 << 3)
 #define VFE31_OUTPUT_MODE_T (0x1 << 4)
 #define VFE31_OUTPUT_MODE_P_ALL_CHNLS (0x1 << 5)
-#endif
+
+#define CSI_EMBED_DATA 0x12
+#define CSI_RESERVED_DATA_0 0x13
+#define CSI_YUV422_8  0x1E
+#define CSI_RAW8    0x2A
+#define CSI_RAW10   0x2B
+#define CSI_RAW12   0x2C
+
+#define CSI_DECODE_6BIT 0
+#define CSI_DECODE_8BIT 1
+#define CSI_DECODE_10BIT 2
+#define CSI_DECODE_DPCM_10_8_10 5
 
 struct msm_vfe_phy_info {
 	uint32_t sbuf_phy;
@@ -145,7 +239,7 @@
 	uint32_t p0_phy;
 	uint32_t p1_phy;
 	uint32_t p2_phy;
-	uint8_t  output_id; /* VFE31_OUTPUT_MODE_PT/S/V */
+	uint8_t  output_id; 
 	uint32_t frame_id;
 };
 
@@ -259,6 +353,14 @@
 	enum msm_st_frame_packing s_snap_packing;
 };
 
+struct msm_actuator_ctrl {
+	int (*a_init_table)(void);
+	int (*a_power_up)(void *);
+	int (*a_power_down)(void *);
+	int (*a_create_subdevice)(void *, void *);
+	int (*a_config)(void __user *);
+};
+
 struct msm_strobe_flash_ctrl {
 	int (*strobe_flash_init)
 		(struct msm_camera_sensor_strobe_flash_data *);
@@ -267,95 +369,6 @@
 	int (*strobe_flash_charge)(int32_t, int32_t, uint32_t);
 };
 
-enum cci_i2c_master_t {
-	MASTER_0,
-	MASTER_1,
-};
-
-enum cci_i2c_queue_t {
-	QUEUE_0,
-	QUEUE_1,
-};
-
-struct msm_camera_cci_client {
-	struct v4l2_subdev *cci_subdev;
-	uint32_t freq;
-	enum cci_i2c_master_t cci_i2c_master;
-	uint16_t sid;
-	uint16_t cid;
-	uint32_t timeout;
-	uint16_t retries;
-	uint16_t id_map;
-};
-
-enum msm_cci_cmd_type {
-	MSM_CCI_INIT,
-	MSM_CCI_RELEASE,
-	MSM_CCI_SET_SID,
-	MSM_CCI_SET_FREQ,
-	MSM_CCI_SET_SYNC_CID,
-	MSM_CCI_I2C_READ,
-	MSM_CCI_I2C_WRITE,
-	MSM_CCI_GPIO_WRITE,
-};
-
-struct msm_camera_cci_wait_sync_cfg {
-	uint16_t line;
-	uint16_t delay;
-};
-
-struct msm_camera_cci_gpio_cfg {
-	uint16_t gpio_queue;
-	uint16_t i2c_queue;
-};
-
-enum msm_camera_i2c_cmd_type {
-	MSM_CAMERA_I2C_CMD_WRITE,
-	MSM_CAMERA_I2C_CMD_POLL,
-};
-
-struct msm_camera_i2c_reg_conf {
-	uint16_t reg_addr;
-	uint16_t reg_data;
-	enum msm_camera_i2c_data_type dt;
-	enum msm_camera_i2c_cmd_type cmd_type;
-	int16_t mask;
-};
-
-struct msm_camera_cci_i2c_write_cfg {
-	struct msm_camera_i2c_reg_conf *reg_conf_tbl;
-	enum msm_camera_i2c_reg_addr_type addr_type;
-	enum msm_camera_i2c_data_type data_type;
-	uint16_t size;
-};
-
-struct msm_camera_cci_i2c_read_cfg {
-	uint16_t addr;
-	enum msm_camera_i2c_reg_addr_type addr_type;
-	uint8_t *data;
-	uint16_t num_byte;
-};
-
-struct msm_camera_cci_i2c_queue_info {
-	uint32_t max_queue_size;
-	uint32_t report_id;
-	uint32_t irq_en;
-	uint32_t capture_rep_data;
-};
-
-struct msm_camera_cci_ctrl {
-	int32_t status;
-	struct msm_camera_cci_client *cci_info;
-	enum msm_cci_cmd_type cmd;
-	union {
-		struct msm_camera_cci_i2c_write_cfg cci_i2c_write_cfg;
-		struct msm_camera_cci_i2c_read_cfg cci_i2c_read_cfg;
-		struct msm_camera_cci_wait_sync_cfg cci_wait_sync_cfg;
-		struct msm_camera_cci_gpio_cfg gpio_cfg;
-	} cfg;
-};
-
-/* this structure is used in kernel */
 struct msm_queue_cmd {
 	struct list_head list_config;
 	struct list_head list_control;
@@ -368,7 +381,6 @@
 	atomic_t on_heap;
 	struct timespec ts;
 	uint32_t error_code;
-	uint32_t trans_code;
 };
 
 struct msm_device_queue {
@@ -386,30 +398,17 @@
 };
 
 struct msm_sync {
-	/* These two queues are accessed from a process context only
-	 * They contain pmem descriptors for the preview frames and the stats
-	 * coming from the camera sensor.
-	*/
 	struct hlist_head pmem_frames;
 	struct hlist_head pmem_stats;
 
-	/* The message queue is used by the control thread to send commands
-	 * to the config thread, and also by the DSP to send messages to the
-	 * config thread.  Thus it is the only queue that is accessed from
-	 * both interrupt and process context.
-	 */
 	struct msm_device_queue event_q;
 
-	/* This queue contains preview frames. It is accessed by the DSP (in
-	 * in interrupt context, and by the frame thread.
-	 */
 	struct msm_device_queue frame_q;
 	int unblock_poll_frame;
 	int unblock_poll_pic_frame;
 
-	/* This queue contains snapshot frames.  It is accessed by the DSP (in
-	 * interrupt context, and by the control thread.
-	 */
+
+
 	struct msm_device_queue pict_q;
 	int get_pic_abort;
 	struct msm_device_queue vpe_q;
@@ -419,7 +418,8 @@
 	struct msm_camvpe_fn vpefn;
 	struct msm_sensor_ctrl sctrl;
 	struct msm_strobe_flash_ctrl sfctrl;
-	struct pm_qos_request idle_pm_qos;
+	struct msm_actuator_ctrl actctrl;
+	struct wake_lock wake_lock;
 	struct platform_device *pdev;
 	int16_t ignore_qcmd_type;
 	uint8_t ignore_qcmd;
@@ -464,26 +464,20 @@
 #define MSM_APPS_ID_PROP "msm_qct"
 
 struct msm_cam_device {
-	struct msm_sync *sync; /* most-frequently accessed */
+	struct msm_sync *sync; 
 	struct device *device;
 	struct cdev cdev;
-	/* opened is meaningful only for the config and frame nodes,
-	 * which may be opened only once.
-	 */
 	atomic_t opened;
 };
 
 struct msm_control_device {
 	struct msm_cam_device *pmsm;
 
-	/* Used for MSM_CAM_IOCTL_CTRL_CMD_DONE responses */
+	
 	uint8_t ctrl_data[max_control_command_size];
 	struct msm_ctrl_cmd ctrl;
 	struct msm_queue_cmd qcmd;
 
-	/* This queue used by the config thread to send responses back to the
-	 * control thread.  It is accessed only from a process context.
-	 */
 	struct msm_device_queue ctrl_q;
 };
 
@@ -584,6 +578,7 @@
 	CAMIO_CSI1_PHY_CLK,
 	CAMIO_CSIPHY_TIMER_SRC_CLK,
 	CAMIO_IMEM_CLK,
+	CAMIO_CAM_RAWCHIP_MCLK_CLK, 
 
 	CAMIO_MAX_CLK
 };
@@ -608,13 +603,13 @@
 };
 
 enum msm_s_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
+	
 	S_REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
+	
 	S_UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
+	
 	S_UPDATE_ALL,
-	/* Not valid update */
+	
 	S_UPDATE_INVALID
 };
 
@@ -632,17 +627,18 @@
 	S_STEREO_VIDEO,
 	S_STEREO_CAPTURE,
 	S_DEFAULT,
-	S_LIVESHOT,
-	S_DUAL,
-	S_LOW_POWER,
 	S_EXIT
 };
 
+struct msm_cam_clk_info {
+	const char *clk_name;
+	long clk_rate;
+};
+
 int msm_camio_enable(struct platform_device *dev);
 int msm_camio_vpe_clk_enable(uint32_t);
 int msm_camio_vpe_clk_disable(void);
 
-void msm_camio_mode_config(enum msm_camera_i2c_mux_mode mode);
 int  msm_camio_clk_enable(enum msm_camio_clk_type clk);
 int  msm_camio_clk_disable(enum msm_camio_clk_type clk);
 int  msm_camio_clk_config(uint32_t freq);
@@ -656,30 +652,28 @@
 void msm_camio_camif_pad_reg_reset_2(void);
 
 void msm_camio_vfe_blk_reset(void);
-void msm_camio_vfe_blk_reset_2(void);
-void msm_camio_vfe_blk_reset_3(void);
 
-int32_t msm_camio_3d_enable(const struct msm_camera_sensor_info *sinfo);
-void msm_camio_3d_disable(void);
 void msm_camio_clk_sel(enum msm_camio_clk_src_type);
 void msm_camio_disable(struct platform_device *);
-int msm_camio_probe_on(struct platform_device *);
-int msm_camio_probe_off(struct platform_device *);
+int msm_camio_probe_on(void *s_info);
+int msm_camio_probe_off(void *s_info);
+int msm_camio_probe_on_bootup(void *s_info);
+int msm_camio_probe_off_bootup(void *s_info);
 int msm_camio_sensor_clk_off(struct platform_device *);
 int msm_camio_sensor_clk_on(struct platform_device *);
 int msm_camio_csi_config(struct msm_camera_csi_params *csi_params);
 int msm_camio_csiphy_config(struct msm_camera_csiphy_params *csiphy_params);
 int msm_camio_csid_config(struct msm_camera_csid_params *csid_params);
+void msm_io_read_interrupt(void);
 int add_axi_qos(void);
 int update_axi_qos(uint32_t freq);
 void release_axi_qos(void);
-void msm_camera_io_w(u32 data, void __iomem *addr);
-void msm_camera_io_w_mb(u32 data, void __iomem *addr);
-u32 msm_camera_io_r(void __iomem *addr);
-u32 msm_camera_io_r_mb(void __iomem *addr);
-void msm_camera_io_dump(void __iomem *addr, int size);
-void msm_camera_io_memcpy(void __iomem *dest_addr,
-		void __iomem *src_addr, u32 len);
+void msm_io_w(u32 data, void __iomem *addr);
+void msm_io_w_mb(u32 data, void __iomem *addr);
+u32 msm_io_r(void __iomem *addr);
+u32 msm_io_r_mb(void __iomem *addr);
+void msm_io_dump(void __iomem *addr, int size);
+void msm_io_memcpy(void __iomem *dest_addr, void __iomem *src_addr, u32 len);
 void msm_camio_set_perf_lvl(enum msm_bus_perf_setting);
 void msm_camio_bus_scale_cfg(
 	struct msm_bus_scale_pdata *, enum msm_bus_perf_setting);
@@ -693,16 +687,13 @@
 int msm_cam_core_reset(void);
 
 int msm_camera_config_vreg(struct device *dev, struct camera_vreg_t *cam_vreg,
-		int num_vreg, enum msm_camera_vreg_name_t *vreg_seq,
-		int num_vreg_seq, struct regulator **reg_ptr, int config);
+		int num_vreg, struct regulator **reg_ptr, int config);
 int msm_camera_enable_vreg(struct device *dev, struct camera_vreg_t *cam_vreg,
-		int num_vreg, enum msm_camera_vreg_name_t *vreg_seq,
-		int num_vreg_seq, struct regulator **reg_ptr, int enable);
+		int num_vreg, struct regulator **reg_ptr, int enable);
 
 int msm_camera_config_gpio_table
 	(struct msm_camera_sensor_info *sinfo, int gpio_en);
 int msm_camera_request_gpio_table
 	(struct msm_camera_sensor_info *sinfo, int gpio_en);
-void msm_camera_bus_scale_cfg(uint32_t bus_perf_client,
-		enum msm_bus_perf_setting perf_setting);
+
 #endif
diff --git a/arch/arm/mach-msm/include/mach/htc_acoustic_8960.h b/arch/arm/mach-msm/include/mach/htc_acoustic_8960.h
new file mode 100644
index 0000000..f6c4b8a
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_acoustic_8960.h
@@ -0,0 +1,34 @@
+/* include/asm/mach-msm/htc_acoustic_8960.h
+ *
+ * Copyright (C) 2012 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#ifndef _ARCH_ARM_MACH_MSM_HTC_ACOUSTIC_8960_H_
+#define _ARCH_ARM_MACH_MSM_HTC_ACOUSTIC_8960_H_
+
+#define HTC_AUDIO_TPA2051	0x01
+#define HTC_AUDIO_TPA2026	0x02
+#define HTC_AUDIO_TPA2028	0x04
+#define HTC_AUDIO_A1028		0x08
+#define HTC_AUDIO_TPA6185 (HTC_AUDIO_A1028 << 1)
+#define HTC_AUDIO_RT5501 (HTC_AUDIO_TPA6185 << 1)
+
+struct acoustic_ops {
+	void (*set_q6_effect)(int mode);
+	int (*get_htc_revision)(void);
+	int (*get_hw_component)(void);
+	int (*enable_digital_mic)(void);
+};
+
+void acoustic_register_ops(struct acoustic_ops *ops);
+#endif
+
diff --git a/arch/arm/mach-msm/include/mach/htc_battery_8960.h b/arch/arm/mach-msm/include/mach/htc_battery_8960.h
new file mode 100644
index 0000000..3a623c3
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_battery_8960.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2007 HTC Incorporated
+ * Author: Jay Tu (jay_tu@htc.com)
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef _HTC_BATTERY_H_
+#define _HTC_BATTERY_H_
+
+#include "htc_battery_common.h"
+#include "htc_gauge.h"
+#include "htc_charger.h"
+
+#define ADC_REPLY_ARRAY_SIZE		5
+
+#define HTC_BATT_IOCTL_MAGIC		0xba
+
+#define DEBUG_LOG_LENGTH		1024
+
+#define HTC_BATT_IOCTL_READ_SOURCE \
+	_IOR(HTC_BATT_IOCTL_MAGIC, 1, unsigned int)
+#define HTC_BATT_IOCTL_SET_BATT_ALARM \
+	_IOW(HTC_BATT_IOCTL_MAGIC, 2, unsigned int)
+#define HTC_BATT_IOCTL_GET_ADC_VREF \
+	_IOR(HTC_BATT_IOCTL_MAGIC, 3, unsigned int[ADC_REPLY_ARRAY_SIZE])
+#define HTC_BATT_IOCTL_GET_ADC_ALL \
+	_IOR(HTC_BATT_IOCTL_MAGIC, 4, struct battery_adc_reply)
+#define HTC_BATT_IOCTL_CHARGER_CONTROL \
+	_IOW(HTC_BATT_IOCTL_MAGIC, 5, unsigned int)
+#define HTC_BATT_IOCTL_UPDATE_BATT_INFO \
+	_IOW(HTC_BATT_IOCTL_MAGIC, 6, struct battery_info_reply)
+#define HTC_BATT_IOCTL_BATT_DEBUG_LOG \
+	_IOW(HTC_BATT_IOCTL_MAGIC, 7, char[DEBUG_LOG_LENGTH])
+#define HTC_BATT_IOCTL_SET_VOLTAGE_ALARM \
+	_IOW(HTC_BATT_IOCTL_MAGIC, 8, struct battery_vol_alarm)
+#define HTC_BATT_IOCTL_SET_ALARM_TIMER_FLAG \
+	_IOW(HTC_BATT_IOCTL_MAGIC, 9, unsigned int)
+
+#define REGULAR_BATTERRY_TIMER		"regular_timer"
+#define CABLE_DETECTION			"cable"
+#define CHARGER_IC_INTERRUPT		"charger_int"
+
+#define XOADC_MPP			0
+#define PM_MPP_AIN_AMUX			1
+
+#define MBAT_IN_LOW_TRIGGER		0
+#define MBAT_IN_HIGH_TRIGGER		1
+
+extern int radio_set_cable_status(int charger_type);
+
+struct battery_adc_reply {
+	u32 adc_voltage[ADC_REPLY_ARRAY_SIZE];
+	u32 adc_current[ADC_REPLY_ARRAY_SIZE];
+	u32 adc_temperature[ADC_REPLY_ARRAY_SIZE];
+	u32 adc_battid[ADC_REPLY_ARRAY_SIZE];
+};
+
+struct mpp_config_data {
+	u32 vol[2];
+	u32 curr[2];
+	u32 temp[2];
+	u32 battid[2];
+};
+
+struct battery_vol_alarm {
+	int lower_threshold;
+	int upper_threshold;
+	int enable;
+};
+
+extern unsigned int system_rev;
+
+enum {
+	GUAGE_NONE,
+	GUAGE_MODEM,
+	GUAGE_DS2784,
+	GUAGE_DS2746,
+	GUAGE_BQ27510,
+};
+
+enum {
+	LINEAR_CHARGER,
+	SWITCH_CHARGER_TPS65200,
+};
+
+enum {
+	BATT_TIMER_WAKE_LOCK = 0,
+	BATT_IOCTL_WAKE_LOCK,
+};
+
+enum {
+	HTC_BATT_DEBUG_UEVT = 1U << 1,
+	HTC_BATT_DEBUG_USER_QUERY = 1U << 2,
+	HTC_BATT_DEBUG_USB_NOTIFY = 1U << 3,
+	HTC_BATT_DEBUG_FULL_LOG = 1U << 4,
+};
+
+struct htc_battery_platform_data {
+	int gpio_mbat_in;
+	int gpio_mbat_in_trigger_level;
+	int gpio_mchg_en_n;
+	int gpio_iset;
+	int gpio_adp_9v;
+	int guage_driver;
+	int charger;
+	struct mpp_config_data mpp_data;
+	int chg_limit_active_mask;
+	int critical_low_voltage_mv;
+	int critical_alarm_voltage_mv;
+	int overload_vol_thr_mv;
+	int overload_curr_thr_ma;
+	struct htc_gauge igauge;
+	struct htc_charger icharger;
+};
+
+enum {
+	BATT_ALARM_DISABLE_MODE,
+	BATT_ALARM_NORMAL_MODE,
+	BATT_ALARM_CRITICAL_MODE,
+};
+
+#endif
diff --git a/arch/arm/mach-msm/include/mach/htc_battery_cell.h b/arch/arm/mach-msm/include/mach/htc_battery_cell.h
new file mode 100644
index 0000000..b8b55c2
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_battery_cell.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007 HTC Incorporated
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef __HTC_BATTERY_CELL_H__
+#define __HTC_BATTERY_CELL_H__
+
+enum htc_battery_cell_type {
+	HTC_BATTERY_CELL_TYPE_NORMAL,
+	HTC_BATTERY_CELL_TYPE_HV,
+};
+
+#define HTC_BATTERY_CELL_ID_UNKNOWN	(255)
+#define HTC_BATTERY_CELL_ID_DEVELOP	(254)
+
+struct htc_battery_cell {
+	const char *model_name;
+	const int	capacity;
+	const int	id;
+	const int	id_raw_min;
+	const int	id_raw_max;
+	const int	type;	
+	const int	voltage_max;
+	const int	voltage_min;
+	void *chg_param;	
+	void *gauge_param;	
+};
+
+
+int htc_battery_cell_init(struct htc_battery_cell *ary, int ary_aize);
+
+struct htc_battery_cell *htc_battery_cell_find(int id_raw);
+
+int htc_battery_cell_find_and_set_id_auto(int id_raw);
+
+struct htc_battery_cell *htc_battery_cell_get_cur_cell(void);
+
+struct htc_battery_cell *htc_battery_cell_set_cur_cell(
+				struct htc_battery_cell *cell);
+
+int htc_battery_cell_set_cur_cell_by_id(int id);
+
+void *htc_battery_cell_get_cur_cell_charger_cdata(void);
+
+void *htc_battery_cell_get_cur_cell_gauge_cdata(void);
+
+int htc_battery_cell_hv_authenticated(void);
+
+#endif
diff --git a/arch/arm/mach-msm/include/mach/htc_battery_common.h b/arch/arm/mach-msm/include/mach/htc_battery_common.h
new file mode 100644
index 0000000..211001d
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_battery_common.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2007 HTC Incorporated
+ * Author: Jay Tu (jay_tu@htc.com)
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef _HTC_BATTERY_COMMON_H_
+#define _HTC_BATTERY_COMMON_H_
+
+
+
+enum charger_type_t {
+	CHARGER_UNKNOWN = -1,
+	CHARGER_BATTERY = 0,
+	CHARGER_USB,
+	CHARGER_AC,
+	CHARGER_9V_AC,
+	CHARGER_WIRELESS,
+	CHARGER_MHL_AC
+};
+
+enum power_supplies_type {
+	BATTERY_SUPPLY,
+	USB_SUPPLY,
+	AC_SUPPLY,
+	WIRELESS_SUPPLY
+};
+
+enum charger_control_flag {
+	STOP_CHARGER = 0,
+	ENABLE_CHARGER,
+	ENABLE_LIMIT_CHARGER,
+	DISABLE_LIMIT_CHARGER,
+	DISABLE_PWRSRC,
+	ENABLE_PWRSRC,
+	END_CHARGER
+};
+
+#define HTC_BATT_CHG_LIMIT_BIT_TALK		(1)
+#define HTC_BATT_CHG_LIMIT_BIT_NAVI		(1<<1)
+
+enum batt_context_event {
+	EVENT_TALK_START = 0,
+	EVENT_TALK_STOP,
+	EVENT_NETWORK_SEARCH_START,
+	EVENT_NETWORK_SEARCH_STOP,
+	EVENT_NAVIGATION_START,
+	EVENT_NAVIGATION_STOP
+};
+
+
+int htc_battery_charger_disable(void);
+int htc_battery_pwrsrc_disable(void);
+int htc_battery_get_zcharge_mode(void);
+
+#endif
diff --git a/arch/arm/mach-msm/include/mach/htc_battery_core.h b/arch/arm/mach-msm/include/mach/htc_battery_core.h
new file mode 100644
index 0000000..12778ea
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_battery_core.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2010 HTC Incorporated
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef HTC_BATTERY_CORE_H
+#define HTC_BATTERY_CORE_H
+#include <mach/board.h>
+#include <linux/notifier.h>
+#include <linux/power_supply.h>
+#include <linux/rtc.h>
+#include <mach/htc_battery_common.h>
+
+#define BATT_LOG(x...) do { \
+struct timespec ts; \
+struct rtc_time tm; \
+getnstimeofday(&ts); \
+rtc_time_to_tm(ts.tv_sec, &tm); \
+printk(KERN_INFO "[BATT] " x); \
+printk(" at %lld (%d-%02d-%02d %02d:%02d:%02d.%09lu UTC)\n", \
+ktime_to_ns(ktime_get()), tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, \
+tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec); \
+} while (0)
+
+#define BATT_ERR(x...) do { \
+struct timespec ts; \
+struct rtc_time tm; \
+getnstimeofday(&ts); \
+rtc_time_to_tm(ts.tv_sec, &tm); \
+printk(KERN_ERR "[BATT] err:" x); \
+printk(" at %lld (%d-%02d-%02d %02d:%02d:%02d.%09lu UTC)\n", \
+ktime_to_ns(ktime_get()), tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, \
+tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec); \
+} while (0)
+
+enum {
+	BATT_ID = 0,
+	BATT_VOL,
+	BATT_TEMP,
+	BATT_CURRENT,
+	CHARGING_SOURCE,
+	CHARGING_ENABLED,
+	FULL_BAT,
+	OVER_VCHG,
+	BATT_STATE,
+	OVERLOAD,
+};
+
+enum htc_batt_rt_attr {
+	HTC_BATT_RT_VOLTAGE = 0,
+	HTC_BATT_RT_CURRENT,
+	HTC_BATT_RT_TEMPERATURE,
+};
+
+struct battery_info_reply {
+	u32 batt_vol;
+	u32 batt_id;
+	s32 batt_temp;
+	s32 batt_current;
+	u32 batt_discharg_current;
+	u32 level;
+	u32 level_raw;
+	u32 charging_source;
+	u32 charging_enabled;
+	u32 full_bat;
+	u32 full_level;
+	u32 over_vchg;
+	s32 temp_fault;
+	u32 batt_state;
+	u32 overload;
+};
+
+struct htc_battery_core {
+	int (*func_get_batt_rt_attr)(enum htc_batt_rt_attr attr, int* val);
+	int (*func_show_batt_attr)(struct device_attribute *attr, char *buf);
+	int (*func_show_cc_attr)(struct device_attribute *attr, char *buf);
+	int (*func_get_battery_info)(struct battery_info_reply *buffer);
+	int (*func_charger_control)(enum charger_control_flag);
+	int (*func_context_event_handler)(enum batt_context_event);
+	void (*func_set_full_level)(int full_level);
+};
+#ifdef CONFIG_HTC_BATT_CORE
+extern int htc_battery_core_update_changed(void);
+extern int htc_battery_core_register(struct device *dev, struct htc_battery_core *htc_battery);
+const struct battery_info_reply* htc_battery_core_get_batt_info_rep(void);
+#else
+static int htc_battery_core_update_changed(void) { return 0; }
+static int htc_battery_core_register(struct device *dev, struct htc_battery_core *htc_battery) { return 0; }
+static struct battery_info_reply* htc_battery_core_get_batt_info_rep(void)
+{ return NULL; }
+#endif
+#endif
diff --git a/arch/arm/mach-msm/include/mach/htc_bdaddress.h b/arch/arm/mach-msm/include/mach/htc_bdaddress.h
new file mode 100644
index 0000000..c85d6bb
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_bdaddress.h
@@ -0,0 +1,12 @@
+/* arch/arm/mach-msm/htc_bdaddress.c
+ *
+ * Code to extract Bluetooth bd_address information
+ * from ATAG set up by the bootloader.
+ *
+ * Copyright (C) 2010 HTC Corporation
+ * Author:Yomin Lin <yomin_lin@htc.com>
+ * Author:Allen Ou <allen_ou@htc.com>
+ *
+ */
+
+void bt_export_bd_address(void);
diff --git a/arch/arm/mach-msm/include/mach/htc_charger.h b/arch/arm/mach-msm/include/mach/htc_charger.h
new file mode 100644
index 0000000..577db17
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_charger.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2007 HTC Incorporated
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef __HTC_CHARGER_H__
+#define __HTC_CHARGER_H__
+
+#include <mach/board.h>
+
+enum htc_charger_event {
+	HTC_CHARGER_EVENT_READY = 0,
+	HTC_CHARGER_EVENT_VBUS_OUT,
+	HTC_CHARGER_EVENT_VBUS_IN,
+	HTC_CHARGER_EVENT_SRC_NONE,
+	HTC_CHARGER_EVENT_SRC_USB,
+	HTC_CHARGER_EVENT_SRC_AC,
+	HTC_CHARGER_EVENT_SRC_WIRELESS,
+	HTC_CHARGER_EVENT_OVP,
+	HTC_CHARGER_EVENT_OVP_RESOLVE,
+	HTC_CHARGER_EVENT_SRC_MHL_AC,
+	HTC_CHARGER_EVENT_SRC_INTERNAL,
+	HTC_CHARGER_EVENT_SRC_CLEAR,
+};
+
+enum htc_charging_cfg {
+	HTC_CHARGER_CFG_LIMIT = 0,	
+	HTC_CHARGER_CFG_SLOW,
+	HTC_CHARGER_CFG_FAST,
+};
+
+enum htc_power_source_type {
+	
+	
+	HTC_PWR_SOURCE_TYPE_BATT = 0,
+	HTC_PWR_SOURCE_TYPE_USB,
+	HTC_PWR_SOURCE_TYPE_AC,
+	HTC_PWR_SOURCE_TYPE_9VAC,
+	HTC_PWR_SOURCE_TYPE_WIRELESS,
+	HTC_PWR_SOURCE_TYPE_MHL_AC,
+	HTC_PWR_SOURCE_TYPE_PQM_FASTCHARGE,
+	HTC_PWR_SOURCE_TYPE_MAX = 255,
+};
+
+enum htc_extchg_event_type {
+	HTC_EXTCHG_EVENT_TYPE_TEMP_NORMAL = 1,
+	HTC_EXTCHG_EVENT_TYPE_TEMP_WARM,
+	HTC_EXTCHG_EVENT_TYPE_TEMP_COOL,
+	HTC_EXTCHG_EVENT_TYPE_TEMP_HOT,
+	HTC_EXTCHG_EVENT_TYPE_TEMP_COLD,
+	HTC_EXTCHG_EVENT_TYPE_EOC_START_CHARGE,
+	HTC_EXTCHG_EVENT_TYPE_EOC_STOP_CHARGE,
+	HTC_EXTCHG_EVENT_TYPE_MAX = 255,
+};
+
+struct htc_charger {
+	const char *name;
+	int ready;
+	int (*get_charging_source)(int *result);
+	int (*get_charging_enabled)(int *result);
+	int (*event_notify)(enum htc_extchg_event_type etype);
+	int (*set_charger_enable)(bool enable);
+	int (*set_pwrsrc_enable)(bool enable);
+	int (*set_pwrsrc_and_charger_enable)
+			(enum htc_power_source_type src,
+			 bool chg_enable, bool pwrsrc_enable);
+	int (*set_limit_charge_enable)(bool enable);
+	int (*toggle_charger)(void);
+	int (*is_ovp)(int *result);
+	int (*is_batt_temp_fault_disable_chg)(int *result);
+	int (*charger_change_notifier_register)
+			(struct t_cable_status_notifier *notifier);
+	int (*dump_all)(void);
+	int (*get_attr_text)(char *buf, int size);
+	int (*enable_5v_output)(bool enable);
+};
+
+int htc_charger_event_notify(enum htc_charger_event);
+
+
+#endif
diff --git a/arch/arm/mach-msm/include/mach/htc_gauge.h b/arch/arm/mach-msm/include/mach/htc_gauge.h
new file mode 100644
index 0000000..ea66143
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_gauge.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2007 HTC Incorporated
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#ifndef __HTC_GAUGE_H__
+#define __HTC_GAUGE_H__
+
+enum htc_gauge_event {
+	HTC_GAUGE_EVENT_READY = 0,
+	HTC_GAUGE_EVENT_TEMP_ZONE_CHANGE,
+	HTC_GAUGE_EVENT_ID_INVALID,
+	HTC_GAUGE_EVENT_ID_VALID,
+	HTC_GAUGE_EVENT_EOC,
+	HTC_GAUGE_EVENT_BATT_REMOVED,
+	HTC_GAUGE_EVENT_OVERLOAD,
+};
+
+struct htc_gauge {
+	const char *name;
+	int ready;
+	int (*get_battery_voltage)(int *result);
+	int (*get_battery_current)(int *result);
+	int (*get_battery_temperature)(int *result);
+	int (*get_battery_id)(int *result);
+	int (*get_battery_soc)(int *result);
+	int (*get_battery_cc)(int *result);
+	int (*is_battery_temp_fault)(int *result);
+	int (*is_battery_full)(int *result);
+#if 0
+	int (*dump_all)(void);
+#endif
+	int (*get_attr_text)(char *buf, int size);
+	
+	int (*register_lower_voltage_alarm_notifier)(void (*callback)(int));
+	int (*enable_lower_voltage_alarm)(int enable);
+	int (*set_lower_voltage_alarm_threshold)(int thres_mV);
+};
+
+int htc_gauge_event_notify(enum htc_gauge_event);
+int htc_gauge_get_battery_voltage(int *result);
+
+#endif
diff --git a/arch/arm/mach-msm/include/mach/htc_headset_config.h b/arch/arm/mach-msm/include/mach/htc_headset_config.h
new file mode 100644
index 0000000..9601ae3
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_headset_config.h
@@ -0,0 +1,36 @@
+/*
+ *
+ * /arch/arm/mach-msm/include/mach/htc_headset_config.h
+ *
+ * HTC headset configurations.
+ *
+ * Copyright (C) 2010 HTC, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef HTC_HEADSET_CONFIG_H
+#define HTC_HEADSET_CONFIG_H
+
+#define HTC_HEADSET_VERSION	6 
+#define HTC_HEADSET_BRANCH	"KERNEL_3_0_PROJECT_8960"
+
+#define HTC_HEADSET_KERNEL_3_0
+#define HTC_HEADSET_CONFIG_PMIC_8XXX_ADC
+
+#if 0 
+#define HTC_HEADSET_KERNEL_3_0
+#define HTC_HEADSET_CONFIG_MSM_RPC
+#define HTC_HEADSET_CONFIG_QUICK_BOOT
+#define HTC_HEADSET_CONFIG_PMIC_8XXX_ADC
+#endif
+
+#endif
diff --git a/arch/arm/mach-msm/include/mach/htc_headset_mgr.h b/arch/arm/mach-msm/include/mach/htc_headset_mgr.h
new file mode 100644
index 0000000..f3c402e
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_headset_mgr.h
@@ -0,0 +1,381 @@
+/*
+ *
+ * /arch/arm/mach-msm/include/mach/htc_headset_mgr.h
+ *
+ * HTC headset manager driver.
+ *
+ * Copyright (C) 2010 HTC, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef HTC_HEADSET_MGR_H
+#define HTC_HEADSET_MGR_H
+
+#include <linux/earlysuspend.h>
+#include <linux/input.h>
+#include <linux/switch.h>
+#include <linux/wakelock.h>
+
+#include <mach/msm_rpcrouter.h>
+#include <mach/htc_headset_config.h>
+
+#ifdef HTC_HEADSET_KERNEL_3_0
+#define set_irq_type(irq, type) irq_set_irq_type(irq, type)
+#define set_irq_wake(irq, on) irq_set_irq_wake(irq, on)
+#else
+#define set_irq_type(irq, type) set_irq_type(irq, type)
+#define set_irq_wake(irq, on) set_irq_wake(irq, on)
+#endif
+
+#define HS_ERR(fmt, arg...) \
+	printk(KERN_INFO "[" DRIVER_NAME "_ERR] (%s) " fmt "\n", \
+		__func__, ## arg)
+#define HS_LOG(fmt, arg...) \
+	printk(KERN_INFO "[" DRIVER_NAME "] (%s) " fmt "\n", __func__, ## arg)
+#define HS_LOG_TIME(fmt, arg...) do { \
+	struct timespec ts; \
+	struct rtc_time tm; \
+	getnstimeofday(&ts); \
+	rtc_time_to_tm(ts.tv_sec, &tm); \
+	printk(KERN_INFO "[" DRIVER_NAME "] (%s) " fmt \
+		" (%02d-%02d %02d:%02d:%02d.%03lu)\n", __func__, \
+		## arg, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, \
+		tm.tm_min, tm.tm_sec, ts.tv_nsec / 1000000); \
+	} while (0)
+#define HS_DBG(fmt, arg...) \
+	if (hs_debug_log_state()) {  \
+		printk(KERN_INFO "##### [" DRIVER_NAME "] (%s) " fmt "\n", \
+		       __func__, ## arg); \
+	}
+
+#define DEVICE_ACCESSORY_ATTR(_name, _mode, _show, _store) \
+	struct device_attribute dev_attr_##_name = \
+	__ATTR(flag, _mode, _show, _store)
+
+#define DEVICE_HEADSET_ATTR(_name, _mode, _show, _store) \
+	struct device_attribute dev_attr_headset_##_name = \
+	__ATTR(_name, _mode, _show, _store)
+
+#define DRIVER_HS_MGR_RPC_SERVER	(1 << 0)
+#define DRIVER_HS_MGR_FLOAT_DET		(1 << 1)
+
+#define DEBUG_FLAG_LOG		(1 << 0)
+#define DEBUG_FLAG_ADC		(1 << 1)
+
+#define BIT_HEADSET		(1 << 0)
+#define BIT_HEADSET_NO_MIC	(1 << 1)
+#define BIT_TTY_FULL		(1 << 2)
+#define BIT_FM_HEADSET		(1 << 3)
+#define BIT_FM_SPEAKER		(1 << 4)
+#define BIT_TTY_VCO		(1 << 5)
+#define BIT_TTY_HCO		(1 << 6)
+#define BIT_35MM_HEADSET	(1 << 7)
+#define BIT_TV_OUT		(1 << 8)
+#define BIT_USB_CRADLE		(1 << 9)
+#define BIT_TV_OUT_AUDIO	(1 << 10)
+#define BIT_HDMI_CABLE		(1 << 11)
+#define BIT_HDMI_AUDIO		(1 << 12)
+#define BIT_USB_AUDIO_OUT	(1 << 13)
+#define BIT_UNDEFINED		(1 << 14)
+
+#define MASK_HEADSET		(BIT_HEADSET | BIT_HEADSET_NO_MIC)
+#define MASK_35MM_HEADSET	(BIT_HEADSET | BIT_HEADSET_NO_MIC | \
+				BIT_35MM_HEADSET | BIT_TV_OUT)
+#define MASK_FM_ATTRIBUTE	(BIT_FM_HEADSET | BIT_FM_SPEAKER)
+#define MASK_USB_HEADSET	(BIT_USB_AUDIO_OUT)
+
+#define GOOGLE_BIT_HEADSET		(1 << 0)
+#define GOOGLE_BIT_HEADSET_NO_MIC	(1 << 1)
+#define GOOGLE_BIT_USB_HEADSET_ANLG	(1 << 2)
+#define GOOGLE_BIT_USB_HEADSET_DGTL	(1 << 3)
+#define GOOGLE_BIT_HDMI_AUDIO		(1 << 4)
+
+#define GOOGLE_SUPPORTED_HEADSETS	(GOOGLE_BIT_HEADSET | \
+					GOOGLE_BIT_HEADSET_NO_MIC | \
+					GOOGLE_BIT_USB_HEADSET_ANLG | \
+					GOOGLE_BIT_USB_HEADSET_DGTL | \
+					GOOGLE_BIT_HDMI_AUDIO)
+#define GOOGLE_HEADSETS_WITH_MIC	GOOGLE_BIT_HEADSET
+#define GOOGLE_USB_HEADSETS		(GOOGLE_BIT_USB_HEADSET_ANLG | \
+					GOOGLE_BIT_USB_HEADSET_DGTL)
+
+#define HS_DEF_MIC_ADC_10_BIT		200
+#define HS_DEF_MIC_ADC_15_BIT_MAX	25320
+#define HS_DEF_MIC_ADC_15_BIT_MIN	7447
+#define HS_DEF_MIC_ADC_16_BIT_MAX	50641
+#define HS_DEF_MIC_ADC_16_BIT_MIN	14894
+#define HS_DEF_MIC_ADC_16_BIT_MAX2	56007
+#define HS_DEF_MIC_ADC_16_BIT_MIN2	14894
+#define HS_DEF_HPTV_ADC_16_BIT_MAX	16509
+#define HS_DEF_HPTV_ADC_16_BIT_MIN	6456
+
+#define HS_DEF_MIC_DETECT_COUNT		10
+
+#define HS_DELAY_ZERO			0
+#define HS_DELAY_SEC			1000
+#define HS_DELAY_MIC_BIAS		200
+#define HS_DELAY_MIC_DETECT		1000
+#define HS_DELAY_INSERT			500
+#define HS_DELAY_REMOVE			200
+#define HS_DELAY_BUTTON			500
+#define HS_DELAY_1WIRE_BUTTON		800
+#define HS_DELAY_1WIRE_BUTTON_SHORT	20
+#define HS_DELAY_IRQ_INIT		(10 * HS_DELAY_SEC)
+
+#define HS_JIFFIES_ZERO			msecs_to_jiffies(HS_DELAY_ZERO)
+#define HS_JIFFIES_MIC_BIAS		msecs_to_jiffies(HS_DELAY_MIC_BIAS)
+#define HS_JIFFIES_MIC_DETECT		msecs_to_jiffies(HS_DELAY_MIC_DETECT)
+#define HS_JIFFIES_INSERT		msecs_to_jiffies(HS_DELAY_INSERT)
+#define HS_JIFFIES_REMOVE		msecs_to_jiffies(HS_DELAY_REMOVE)
+#define HS_JIFFIES_BUTTON		msecs_to_jiffies(HS_DELAY_BUTTON)
+#define HS_JIFFIES_1WIRE_BUTTON		msecs_to_jiffies(HS_DELAY_1WIRE_BUTTON)
+#define HS_JIFFIES_1WIRE_BUTTON_SHORT	msecs_to_jiffies(HS_DELAY_1WIRE_BUTTON_SHORT)
+#define HS_JIFFIES_IRQ_INIT		msecs_to_jiffies(HS_DELAY_IRQ_INIT)
+
+#define HS_WAKE_LOCK_TIMEOUT		(2 * HZ)
+#define HS_RPC_TIMEOUT			(5 * HZ)
+#define HS_MIC_DETECT_TIMEOUT		(HZ + HZ / 2)
+
+#define HS_RPC_SERVER_PROG		0x30100004
+#define HS_RPC_SERVER_VERS		0x00000000
+#define HS_RPC_SERVER_PROC_NULL		0
+#define HS_RPC_SERVER_PROC_KEY		1
+
+#define HS_RPC_CLIENT_PROG		0x30100005
+#define HS_RPC_CLIENT_VERS		0x00000000
+#define HS_RPC_CLIENT_PROC_NULL		0
+#define HS_RPC_CLIENT_PROC_ADC		1
+
+#define HS_MGR_KEYCODE_END	KEY_END			
+#define HS_MGR_KEYCODE_MUTE	KEY_MUTE		
+#define HS_MGR_KEYCODE_VOLDOWN	KEY_VOLUMEDOWN		
+#define HS_MGR_KEYCODE_VOLUP	KEY_VOLUMEUP		
+#define HS_MGR_KEYCODE_FORWARD	KEY_NEXTSONG		
+#define HS_MGR_KEYCODE_PLAY	KEY_PLAYPAUSE		
+#define HS_MGR_KEYCODE_BACKWARD	KEY_PREVIOUSSONG	
+#define HS_MGR_KEYCODE_MEDIA	KEY_MEDIA		
+#define HS_MGR_KEYCODE_SEND	KEY_SEND		
+#define HS_MGR_KEYCODE_FF	KEY_FASTFORWARD
+#define HS_MGR_KEYCODE_RW	KEY_REWIND
+
+#define HS_MGR_2X_KEY_MEDIA		(1 << 4)
+#define HS_MGR_3X_KEY_MEDIA		(1 << 8)
+#define HS_MGR_KEY_HOLD(x)	x | (x << 4)
+#define HS_MGR_2X_HOLD_MEDIA	HS_MGR_KEY_HOLD(HS_MGR_2X_KEY_MEDIA)
+#define HS_MGR_3X_HOLD_MEDIA	HS_MGR_KEY_HOLD(HS_MGR_3X_KEY_MEDIA)
+
+enum {
+	HEADSET_UNPLUG		= 0,
+	HEADSET_NO_MIC		= 1,
+	HEADSET_MIC		= 2,
+	HEADSET_METRICO		= 3,
+	HEADSET_UNKNOWN_MIC	= 4,
+	HEADSET_UNSTABLE	= 5,
+	HEADSET_TV_OUT		= 6,
+	HEADSET_INDICATOR	= 7,
+	HEADSET_BEATS		= 8,
+	HEADSET_BEATS_SOLO	= 9,
+};
+
+enum {
+	GOOGLE_USB_AUDIO_UNPLUG	= 0,
+	GOOGLE_USB_AUDIO_ANLG	= 1,
+#ifdef CONFIG_SUPPORT_USB_SPEAKER
+	GOOGLE_USB_AUDIO_DGTL	= 2,
+#endif
+};
+
+enum {
+	HEADSET_REG_HPIN_GPIO,
+	HEADSET_REG_REMOTE_ADC,
+	HEADSET_REG_REMOTE_KEYCODE,
+	HEADSET_REG_RPC_KEY,
+	HEADSET_REG_MIC_STATUS,
+	HEADSET_REG_MIC_BIAS,
+	HEADSET_REG_MIC_SELECT,
+	HEADSET_REG_KEY_INT_ENABLE,
+	HEADSET_REG_KEY_ENABLE,
+	HEADSET_REG_INDICATOR_ENABLE,
+	HEADSET_REG_1WIRE_INIT,
+	HEADSET_REG_1WIRE_QUERY,
+	HEADSET_REG_1WIRE_READ_KEY,
+	HEADSET_REG_1WIRE_DEINIT,
+	HEADSET_REG_1WIRE_REPORT_TYPE,
+};
+
+enum {
+	HS_MGR_KEY_INVALID	= -1,
+	HS_MGR_KEY_NONE		= 0,
+	HS_MGR_KEY_PLAY		= 1,
+	HS_MGR_KEY_BACKWARD	= 2,
+	HS_MGR_KEY_FORWARD	= 3,
+};
+
+enum {
+	STATUS_DISCONNECTED		= 0,
+	STATUS_CONNECTED_ENABLED	= 1,
+	STATUS_CONNECTED_DISABLED	= 2,
+};
+
+enum {
+	H2W_NO_HEADSET		= 0,
+	H2W_HEADSET		= 1,
+	H2W_35MM_HEADSET	= 2,
+	H2W_REMOTE_CONTROL	= 3,
+	H2W_USB_CRADLE		= 4,
+	H2W_UART_DEBUG		= 5,
+	H2W_TVOUT		= 6,
+	USB_NO_HEADSET		= 7,
+	USB_AUDIO_OUT		= 8,
+#ifdef CONFIG_SUPPORT_USB_SPEAKER
+	USB_AUDIO_OUT_DGTL	= 9,
+#endif
+};
+
+struct hs_rpc_server_args_key {
+	uint32_t adc;
+};
+
+struct hs_rpc_client_req_adc {
+	struct rpc_request_hdr hdr;
+};
+
+struct hs_rpc_client_rep_adc {
+	struct rpc_reply_hdr hdr;
+	uint32_t adc;
+};
+
+struct external_headset {
+	int type;
+	int status;
+};
+
+struct headset_adc_config {
+	int type;
+	uint32_t adc_max;
+	uint32_t adc_min;
+};
+
+struct headset_notifier {
+	int id;
+	void *func;
+};
+
+struct hs_notifier_func {
+	int (*hpin_gpio)(void);
+	int (*remote_adc)(int *);
+	int (*remote_keycode)(int);
+	void (*rpc_key)(int);
+	int (*mic_status)(void);
+	int (*mic_bias_enable)(int);
+	void (*mic_select)(int);
+	int (*key_int_enable)(int);
+	void (*key_enable)(int);
+	int (*indicator_enable)(int);
+	int (*hs_1wire_init)(void);
+	int (*hs_1wire_query)(int);
+	int (*hs_1wire_read_key)(void);
+	int (*hs_1wire_deinit)(void);
+	int (*hs_1wire_report_type)(char **);
+};
+
+struct htc_headset_mgr_platform_data {
+	unsigned int driver_flag;
+	int headset_devices_num;
+	struct platform_device **headset_devices;
+	int headset_config_num;
+	struct headset_adc_config *headset_config;
+
+	unsigned int hptv_det_hp_gpio;
+	unsigned int hptv_det_tv_gpio;
+	unsigned int hptv_sel_gpio;
+
+	void (*headset_init)(void);
+	void (*headset_power)(int);
+	void (*uart_lv_shift_en)(int);
+	void (*uart_tx_gpo)(int);
+};
+
+struct htc_headset_mgr_info {
+	struct htc_headset_mgr_platform_data pdata;
+	int driver_init_seq;
+	struct early_suspend early_suspend;
+	struct wake_lock hs_wake_lock;
+
+	unsigned long hpin_jiffies;
+	struct external_headset h2w_headset;
+	struct external_headset usb_headset;
+
+	struct class *htc_accessory_class;
+	struct device *headset_dev;
+	struct device *tty_dev;
+	struct device *fm_dev;
+	struct device *debug_dev;
+	struct mutex mutex_lock;
+
+	struct switch_dev sdev_h2w;
+	struct switch_dev sdev_usb_audio;
+	struct input_dev *input;
+	unsigned long insert_jiffies;
+
+	atomic_t btn_state;
+
+	int tty_enable_flag;
+	int fm_flag;
+	int debug_flag;
+
+	unsigned int irq_btn_35mm;
+
+	
+	int key_level_flag;
+	int hs_35mm_type;
+	int h2w_35mm_type;
+	int is_ext_insert;
+	int mic_bias_state;
+	int mic_detect_counter;
+	int metrico_status; 
+	int quick_boot_status;
+
+	
+	int driver_one_wire_exist;
+	int one_wire_mode;
+	int key_code_1wire[15];
+	int key_code_1wire_index;
+	unsigned int onewire_key_delay;
+};
+
+int headset_notifier_register(struct headset_notifier *notifier);
+
+void headset_ext_detect(int type);
+void headset_ext_button(int headset_type, int key_code, int press);
+
+void hs_notify_driver_ready(char *name);
+void hs_notify_hpin_irq(void);
+int hs_notify_plug_event(int insert);
+int hs_notify_key_event(int key_code);
+int hs_notify_key_irq(void);
+
+int hs_debug_log_state(void);
+
+void hs_set_mic_select(int state);
+struct class *hs_get_attribute_class(void);
+
+int headset_get_type(void);
+int headset_get_type_sync(int count, unsigned int interval);
+
+extern int switch_send_event(unsigned int bit, int on);
+
+#if defined(CONFIG_FB_MSM_TVOUT) && defined(CONFIG_ARCH_MSM8X60)
+extern void tvout_enable_detection(unsigned int on);
+#endif
+
+#endif
diff --git a/arch/arm/mach-msm/include/mach/htc_headset_one_wire.h b/arch/arm/mach-msm/include/mach/htc_headset_one_wire.h
new file mode 100644
index 0000000..80b82f9
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_headset_one_wire.h
@@ -0,0 +1,47 @@
+/*
+ *
+ * /arch/arm/mach-msm/include/mach/htc_headset_one_wire.h
+ *
+ * HTC 1-wire headset driver.
+ *
+ * Copyright (C) 2012 HTC, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#define		INIT_CMD_INT_5MS			0x35
+#define		INIT_CMD_INT_8MS			0x65
+#define		INIT_CMD_INT_10MS			0x75
+#define		INIT_CMD_INT_13MS			0xA5
+#define		INIT_CMD_INT_15MS			0xB5 
+#define		INIT_CMD_INT_18MS			0xE5
+#define		INIT_CMD_INT_30MS			0xF5
+#define 	QUERY_AID				0xD5
+#define		QUERY_CONFIG				0xE5
+#define		QUERY_KEYCODE				0xF5
+
+ 
+struct htc_headset_1wire_platform_data {
+	unsigned int tx_level_shift_en;
+	unsigned int uart_sw;
+	unsigned int uart_tx;
+	unsigned int uart_rx;
+	unsigned int remote_press;
+	char one_wire_remote[6]; 
+	char onewire_tty_dev[15];
+
+};
+
+struct htc_35mm_1wire_info {
+	struct htc_headset_1wire_platform_data pdata;
+	char aid;
+	struct wake_lock hs_wake_lock;
+};
diff --git a/arch/arm/mach-msm/include/mach/htc_headset_pmic.h b/arch/arm/mach-msm/include/mach/htc_headset_pmic.h
new file mode 100644
index 0000000..5f7f715
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_headset_pmic.h
@@ -0,0 +1,99 @@
+/*
+ *
+ * /arch/arm/mach-msm/include/mach/htc_headset_pmic.h
+ *
+ * HTC PMIC headset driver.
+ *
+ * Copyright (C) 2010 HTC, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef HTC_HEADSET_PMIC_H
+#define HTC_HEADSET_PMIC_H
+
+#define DRIVER_HS_PMIC_RPC_KEY			(1 << 0)
+#define DRIVER_HS_PMIC_DYNAMIC_THRESHOLD	(1 << 1)
+#define DRIVER_HS_PMIC_ADC			(1 << 2)
+
+#define HS_PMIC_HTC_CURRENT_THRESHOLD		500
+
+#define HS_PMIC_RPC_CLIENT_PROG			0x30000061
+#define HS_PMIC_RPC_CLIENT_VERS			0x00010001
+#define HS_PMIC_RPC_CLIENT_VERS_1_1		0x00010001
+#define HS_PMIC_RPC_CLIENT_VERS_2_1		0x00020001
+#define HS_PMIC_RPC_CLIENT_VERS_3_1		0x00030001
+
+#define HS_PMIC_RPC_CLIENT_PROC_NULL		0
+#define HS_PMIC_RPC_CLIENT_PROC_THRESHOLD	65
+
+enum {
+	HS_PMIC_RPC_ERR_SUCCESS,
+};
+
+enum {
+	HS_PMIC_CONTROLLER_0,
+	HS_PMIC_CONTROLLER_1,
+	HS_PMIC_CONTROLLER_2,
+};
+
+enum {
+	HS_PMIC_SC_SWITCH_TYPE,
+	HS_PMIC_OC_SWITCH_TYPE,
+};
+
+struct hs_pmic_rpc_request {
+	struct rpc_request_hdr hdr;
+	uint32_t hs_controller;
+	uint32_t hs_switch;
+	uint32_t current_uA;
+};
+
+struct hs_pmic_rpc_reply {
+	struct rpc_reply_hdr hdr;
+	uint32_t status;
+	uint32_t data;
+};
+
+struct hs_pmic_current_threshold {
+	uint32_t adc_max;
+	uint32_t adc_min;
+	uint32_t current_uA;
+};
+
+struct htc_headset_pmic_platform_data {
+	unsigned int driver_flag;
+	unsigned int hpin_gpio;
+	unsigned int hpin_irq;
+	unsigned int key_gpio;
+	unsigned int key_irq;
+	unsigned int key_enable_gpio;
+	unsigned int adc_mpp;
+	unsigned int adc_amux;
+	unsigned int hs_controller;
+	unsigned int hs_switch;
+
+	
+	uint32_t adc_mic;
+	uint32_t adc_mic_bias[2];
+	uint32_t adc_remote[6];
+	uint32_t adc_metrico[2];
+};
+
+struct htc_35mm_pmic_info {
+	struct htc_headset_pmic_platform_data pdata;
+	unsigned int hpin_irq_type;
+	unsigned int hpin_debounce;
+	unsigned int key_irq_type;
+	struct wake_lock hs_wake_lock;
+};
+
+#endif
diff --git a/arch/arm/mach-msm/include/mach/htc_ramdump.h b/arch/arm/mach-msm/include/mach/htc_ramdump.h
new file mode 100644
index 0000000..0cdc64e
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_ramdump.h
@@ -0,0 +1,17 @@
+
+#include <linux/types.h>
+
+
+#define GET_RAMDUMP_LENGTH	0x01
+#define JUMP_RAMUDMP_START	0x02
+
+
+struct ramdump_region {
+	unsigned long start;
+	unsigned long size;
+};
+
+struct ramdump_platform_data {
+	int count;
+	struct ramdump_region region[];
+};
diff --git a/arch/arm/mach-msm/include/mach/htc_restart_handler.h b/arch/arm/mach-msm/include/mach/htc_restart_handler.h
new file mode 100644
index 0000000..e97f49b
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_restart_handler.h
@@ -0,0 +1,37 @@
+/* linux/arch/arm/mach-msm/htc_restart_handler.c
+ *
+ * Copyright (C) 2012 HTC Corporation.
+ * Author: Jimmy.CM Chen <jimmy.cm_chen@htc.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/* This constant is used in bootloader to decide actions. */
+#define RESTART_REASON_BOOT_BASE        0x77665500
+#define RESTART_REASON_BOOTLOADER       (RESTART_REASON_BOOT_BASE | 0x00)
+#define RESTART_REASON_REBOOT           (RESTART_REASON_BOOT_BASE | 0x01)
+#define RESTART_REASON_RECOVERY         (RESTART_REASON_BOOT_BASE | 0x02)
+#define RESTART_REASON_RAMDUMP          (RESTART_REASON_BOOT_BASE | 0xAA)
+#define RESTART_REASON_POWEROFF         (RESTART_REASON_BOOT_BASE | 0xBB)
+#define RESTART_REASON_ERASE_FLASH      (RESTART_REASON_BOOT_BASE | 0xEF)
+
+/*
+   This restart constant is used for oem commands.
+   The actual value is parsed from reboot commands.
+   RIL FATAL will use oem-99 to restart a device.
+*/
+#define RESTART_REASON_OEM_BASE         0x6f656d00
+#define RESTART_REASON_RIL_FATAL        (RESTART_REASON_OEM_BASE | 0x99)
+
+int set_restart_action(unsigned int reason, const char *msg);
+int set_restart_to_oem(unsigned int code, const char *msg);
+int set_restart_to_ramdump(const char *msg);
+int htc_restart_handler_init(void);
+unsigned get_restart_reason(void);
\ No newline at end of file
diff --git a/arch/arm/mach-msm/include/mach/htc_wifi_nvs.h b/arch/arm/mach-msm/include/mach/htc_wifi_nvs.h
new file mode 100644
index 0000000..985844b
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/htc_wifi_nvs.h
@@ -0,0 +1,11 @@
+/* arch/arm/mach-msm/htc_wifi_nvs.c
+ *
+ * Code to extract WiFi calibration information
+ * from ATAG set up by the bootloader.
+ *
+ * Copyright (C) 2012 The CyanogenMod Project
+ *
+ */
+
+int htc_get_wifi_calibration(char *buf, int count);
+int htc_get_wifi_data(char *buf);
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h
index 2329540..33c5678 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h
@@ -110,4 +110,6 @@
 extern void msm_map_msm8960_io(void);
 #endif
 
+#define MSM_SHARED_RAM_PHYS		0x80000000
+
 #endif
diff --git a/arch/arm/mach-msm/include/mach/panel_id.h b/arch/arm/mach-msm/include/mach/panel_id.h
new file mode 100644
index 0000000..30d9ae7
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/panel_id.h
@@ -0,0 +1,164 @@
+/* arch/arm/mach-msm/panel_id.h
+ * Copyright (C) 2010 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+
+#ifndef __PANEL_ID_H
+#define __PANEL_ID_H
+
+extern int panel_type;
+
+
+#define BL_SHIFT        16
+#define BL_MASK         (0x7 << BL_SHIFT)
+
+#define BL_SPI          (0 << BL_SHIFT)
+#define BL_MDDI         (1 << BL_SHIFT)
+#define BL_I2C          (2 << BL_SHIFT)
+#define BL_UP           (3 << BL_SHIFT)
+#define BL_MIPI         (4 << BL_SHIFT)
+#define BL_PMIC         (5 << BL_SHIFT)
+
+#define IF_SHIFT        19
+#define IF_MASK         (0x7 << IF_SHIFT)
+
+#define IF_LCDC         (0 << IF_SHIFT)
+#define IF_MDDI         (1 << IF_SHIFT)
+#define IF_MIPI         (2 << IF_SHIFT)
+
+#define DEPTH_SHIFT     22
+#define DEPTH_MASK      (0x7 << DEPTH_SHIFT)
+
+#define DEPTH_RGB565    (0 << DEPTH_SHIFT)
+#define DEPTH_RGB666    (1 << DEPTH_SHIFT)
+#define DEPTH_RGB888    (2 << DEPTH_SHIFT)
+
+
+#define REV_SHIFT       25
+#define REV_MASK        (0x7 << REV_SHIFT)
+
+#define REV_0           (0 << REV_SHIFT)
+#define REV_1           (1 << REV_SHIFT)
+#define REV_2           (2 << REV_SHIFT)
+#define REV_3           (3 << REV_SHIFT)
+#define REV_4		(4 << REV_SHIFT)
+
+#define MIPI_MODE_SHIFT	28
+#define MIPI_MODE_MASK	(0x3 << MIPI_MODE_SHIFT)
+
+#define MIPI_CMD		(0 << MIPI_MODE_SHIFT)
+#define MIPI_VIDEO_ONLY	(1 << MIPI_MODE_SHIFT)
+
+#define PANEL_ID_NONE		(0x0)
+
+#define PANEL_ID_START          0x0F
+
+#define PANEL_ID_SAG_SONY      (0x10 | BL_SPI	| IF_LCDC | DEPTH_RGB666)
+#define PANEL_ID_SPADE_AUO_N90      	(0x11 | BL_UP | IF_LCDC | DEPTH_RGB888)
+#define PANEL_ID_SPADE_SHA_N90      	(0x12 | BL_UP | IF_LCDC | DEPTH_RGB888)
+#define PANEL_ID_SAG_HITACHI   (0x13 | BL_MDDI | IF_MDDI | DEPTH_RGB666)
+#define PANEL_ID_ICN_SHARP	(0x14 | BL_MDDI | IF_MDDI | DEPTH_RGB666)
+#define PANEL_ID_FLR_SMD_XC	(0x15 | BL_UP	| IF_LCDC | DEPTH_RGB888)
+#define PANEL_ID_ICN_TPO	(0x16 | BL_MDDI | IF_MDDI | DEPTH_RGB666)
+#define PANEL_ID_VIVOW_HITACHI	(0x17 | BL_MDDI | IF_MDDI | DEPTH_RGB666)
+#define PANEL_ID_BLS_HITACHI	(0x17 | BL_MDDI | IF_MDDI | DEPTH_RGB666)
+#define PANEL_ID_BLSC_HITACHI	(0x17 | BL_MDDI | IF_MDDI | DEPTH_RGB666)
+#define PANEL_ID_FLR_LG_XC	(0x18 | BL_UP	| IF_LCDC | DEPTH_RGB888)
+
+#define PANEL_ID_PYD_SHARP_WVGA	(0x20 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_PYD_SHARP	(0x21 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_PYD_AUO_NT	(0x22 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_PYD_AUO_OTM	(0x22 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_DOT_SONY	(0x24 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_DOT_SONY_C3	(0x24 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_DOT_HITACHI	(0x25 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_SHR_SHARP_NT	(0x26 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_EXP_SMD	(0x27 | BL_UP	| IF_LCDC | DEPTH_RGB888)
+#define PANEL_ID_EXP_LG	(0x28 | BL_UP	| IF_LCDC | DEPTH_RGB888)
+#define PANEL_ID_VERDI_AUO	(0x29 | BL_PMIC | IF_LCDC | DEPTH_RGB666)
+#define PANEL_ID_VERDI_AUO_RGB888	(0x29 | BL_PMIC | IF_LCDC | DEPTH_RGB888)
+#define PANEL_ID_VERDI_SAMSUNG	(0x2A | BL_PMIC | IF_LCDC | DEPTH_RGB888)
+#define PANEL_ID_KIM_SONY	(0x2B | BL_MDDI | IF_MDDI | DEPTH_RGB888)
+#define PANEL_ID_KIM_SONY_C2	(0x2B | BL_MDDI | IF_MDDI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_RIR_SHARP_NT (0x2C | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_SHR_SHARP_OTM (0x2D | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_SHR_SHARP_OTM_C2 (0x2D | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_RIR_AUO_OTM (0x2E | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_RIR_AUO_OTM_C2 (0x2E | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_RIR_AUO_OTM_C3 (0x2E | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_HOY_SONY_OTM (0x2F | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_EXP_LG_WS2	(0x30 | BL_UP	| IF_LCDC | DEPTH_RGB888)
+#define PANEL_ID_RIR_SHARP_OTM (0x31 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_RIR_AUO_NT (0x32 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_RUBY_SHARP (0x33 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_KIM_SAMSUNG	(0x36 | BL_MDDI | IF_MDDI | DEPTH_RGB888)
+#define PANEL_ID_BLS_SONY	(0x37 | BL_MDDI | IF_MDDI | DEPTH_RGB888)
+#define PANEL_ID_BLSC_SONY	(0x37 | BL_MDDI | IF_MDDI | DEPTH_RGB888)
+#define PANEL_ID_RUY_SHARP_NT	(0X38 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_RUY_SHARP_NT_C2 (0X38 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_RUY_SHARP_NT_C2O (0X38 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_VIG_SHARP_HX	(0x39 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_VIG_SHARP_HX_C2	(0x39 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_VIG_SHARP_HX_C25	(0x39 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_VIG_SHARP_HX_C3	(0x39 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_3)
+#define PANEL_ID_RUE_SONY_NT	(0x3A | BL_MDDI | IF_MDDI | DEPTH_RGB888)
+#define PANEL_ID_VIG_CHIMEI_HX	(0x3B | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_VIG_CHIMEI_HX_C25	(0x3B | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_VIG_CHIMEI_HX_C3	(0x3B | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_TAGH_HITACHI	(0x40 | BL_MDDI | IF_MDDI | DEPTH_RGB666)
+#define PANEL_ID_TAGH_HITACHI_LT	(0x40 | BL_MDDI | IF_MDDI | DEPTH_RGB666 | REV_1)
+#define PANEL_ID_FIGHTER_SAMSUNG_NT	(0x44 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_FIGHTER_SAMSUNG_NT_C2	(0x44 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_FIGHTER_SAMSUNG_NT_C3	(0x44 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_FIGHTER_SONY_OTM (0x45 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_FIGHTER_SONY_OTM_C1_1 (0x45 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_FIGHTER_SONY_OTM_MP (0x45 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_FIGHTER_LG_NT (0x46 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_FIGHTER_LG_NT_C2 (0x46 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_FIGHTER_LG_NT_MP (0x46 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_VILLE_SAMSUNG_SG (0x43 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_VILLE_SAMSUNG_SG_C2 (0x43 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_ELITE_SONY_NT (0x47 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_ELITE_SONY_NT_C1 (0x47 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_ELITE_SONY_NT_C2 (0x47 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_ELITE_SHARP_HX (0x48 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_TAI_HITACHI_NT (0x49 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_TAI_HITACHI_NT_C1 (0x49 | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_JET_SONY_NT (0x4B | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_JET_SONY_NT_C1 (0x4B | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_JET_SONY_NT_C2 (0x4B | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_JET_AUO_NT    (0x4C | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_JET_AUO_NT_C2    (0x4C | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_JET_AUO_NT_C3    (0x4C | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_3)
+#define PANEL_ID_JET_AUO_NT_C3_1    (0x4C | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_4)
+#define PANEL_ID_VALENTE_SAMSUNG_SG (0x4D | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_VALENTE_SAMSUNG_SG_C2 (0x4D | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_VALENTE_SAMSUNG_SG_C3 (0x4D | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_ELITE_SHARP_NT (0x4E | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_ELITE_SHARP_NT_C1 (0x4E | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_1)
+#define PANEL_ID_ELITE_SHARP_NT_C2 (0x4E | BL_MIPI | IF_MIPI | DEPTH_RGB888 | REV_2)
+#define PANEL_ID_VILLE_AUO (0x53 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_DLX_SHARP_RENESAS  (0x5B | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_DLX_SONY_RENESAS  (0x5C | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_K2_WL_AUO (0x5D | BL_MIPI | IF_MIPI | DEPTH_RGB888 | MIPI_VIDEO_ONLY)
+#define PANEL_ID_OPA_SHARP_HX  (0x5E | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_IMN_SHARP_HX (0x60 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_DLXJ_SHARP_RENESAS  (0x63 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_DLXJ_SONY_RENESAS  (0x64 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_M7_JDI_SAMSUNG  (0x65 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+#define PANEL_ID_M7_SHARP_NT  (0x66 | BL_MIPI | IF_MIPI | DEPTH_RGB888)
+
+#define PANEL_ID_END            0xFFFF
+
+#endif	
+
diff --git a/arch/arm/mach-msm/include/mach/restart.h b/arch/arm/mach-msm/include/mach/restart.h
index 618f94a..9e895ef 100644
--- a/arch/arm/mach-msm/include/mach/restart.h
+++ b/arch/arm/mach-msm/include/mach/restart.h
@@ -17,6 +17,11 @@
 #define RESTART_NORMAL 0x0
 #define RESTART_DLOAD  0x1
 
+enum RAMDUMP_STATUS {
+	RAMDUMP_BUG = 1,
+	RAMDUMP_UNKNOWN_INST
+};
+
 #if defined(CONFIG_LGE_CRASH_HANDLER)
 #define SUB_THD_F_PWR	0x0190
 #define SUB_THD_F_SD	0x0110
@@ -26,6 +31,24 @@
 #endif
 
 #if defined(CONFIG_MSM_NATIVE_RESTART)
+enum RESTART_MODE {
+	RESTART_MODE_LEGACY = 0,
+
+	RESTART_MODE_Q6_WATCHDOG_BITE,
+
+	RESTART_MODE_MODEM_CRASH,
+	RESTART_MODE_MODEM_USER_INVOKED,
+	RESTART_MODE_MODEM_UNWEDGE_TIMEOUT,
+	RESTART_MODE_MODEM_WATCHDOG_BITE,
+	RESTART_MODE_MODEM_ERROR_FATAL,
+
+	RESTART_MODE_MDM_DOG_BITE,
+	RESTART_MODE_MDM_FATAL,
+
+	RESTART_MODE_APP_WATCHDOG_BARK,
+	RESTART_MODE_ERASE_EFS,
+	RESTART_MODE_MAX
+};
 void msm_set_restart_mode(int mode);
 void msm_restart(char mode, const char *cmd);
 #elif defined(CONFIG_ARCH_FSM9XXX)
diff --git a/arch/arm/mach-msm/ipc_router.c b/arch/arm/mach-msm/ipc_router.c
index 2c91371..97d1f5d 100644
--- a/arch/arm/mach-msm/ipc_router.c
+++ b/arch/arm/mach-msm/ipc_router.c
@@ -2226,7 +2226,11 @@
 }
 
 int msm_ipc_router_lookup_server_name(struct msm_ipc_port_name *srv_name,
+#ifdef CONFIG_MACH_HTC
+				struct msm_ipc_port_addr *srv_info,
+#else
 				struct msm_ipc_server_info *srv_info,
+#endif
 				int num_entries_in_array,
 				uint32_t lookup_mask)
 {
@@ -2247,7 +2251,11 @@
 	mutex_lock(&server_list_lock);
 	if (!lookup_mask)
 		lookup_mask = 0xFFFFFFFF;
+#ifdef CONFIG_MACH_HTC
+	for (key = 0; key < SRV_HASH_SIZE; key++)
+#else
 	key = (srv_name->service & (SRV_HASH_SIZE - 1));
+#endif
 	list_for_each_entry(server, &server_list[key], list) {
 		if ((server->name.service != srv_name->service) ||
 		    ((server->name.instance & lookup_mask) !=
@@ -2261,8 +2269,10 @@
 					  server_port->server_addr.node_id;
 				srv_info[i].port_id =
 					  server_port->server_addr.port_id;
+#ifndef CONFIG_MACH_HTC
 				srv_info[i].service = server->name.service;
 				srv_info[i].instance = server->name.instance;
+#endif
 			}
 			i++;
 		}
diff --git a/arch/arm/mach-msm/ipc_router.h b/arch/arm/mach-msm/ipc_router.h
index d56c0dd..90456da 100644
--- a/arch/arm/mach-msm/ipc_router.h
+++ b/arch/arm/mach-msm/ipc_router.h
@@ -196,7 +196,11 @@
 int msm_ipc_router_get_curr_pkt_size(struct msm_ipc_port *port_ptr);
 int msm_ipc_router_bind_control_port(struct msm_ipc_port *port_ptr);
 int msm_ipc_router_lookup_server_name(struct msm_ipc_port_name *srv_name,
+#ifdef CONFIG_MACH_HTC
+				      struct msm_ipc_port_addr *srv_info,
+#else
 				      struct msm_ipc_server_info *srv_info,
+#endif
 				      int num_entries_in_array,
 				      uint32_t lookup_mask);
 int msm_ipc_router_close_port(struct msm_ipc_port *port_ptr);
diff --git a/arch/arm/mach-msm/ipc_socket.c b/arch/arm/mach-msm/ipc_socket.c
index f9aa9b2..0c91057 100644
--- a/arch/arm/mach-msm/ipc_socket.c
+++ b/arch/arm/mach-msm/ipc_socket.c
@@ -125,7 +125,11 @@
 
 	temp = skb_peek(msg_head);
 	hdr = (struct rr_header *)(temp->data);
+#ifdef CONFIG_MACH_HTC
+	if (addr || (hdr->src_port_id != IPC_ROUTER_ADDRESS)) {
+#else
 	if (addr && (hdr->src_port_id != IPC_ROUTER_ADDRESS)) {
+#endif
 		addr->family = AF_MSM_IPC;
 		addr->address.addrtype = MSM_IPC_ADDR_ID;
 		addr->address.addr.port_addr.node_id = hdr->src_node_id;
@@ -355,7 +359,11 @@
 	struct sock *sk = sock->sk;
 	struct msm_ipc_port *port_ptr;
 	struct server_lookup_args server_arg;
+#ifdef CONFIG_MACH_HTC
+	struct msm_ipc_port_addr *srv_info = NULL;
+#else
 	struct msm_ipc_server_info *srv_info = NULL;
+#endif
 	unsigned int n, srv_info_sz = 0;
 	int ret;
 	void *pil;
diff --git a/arch/arm/mach-msm/pil-riva.c b/arch/arm/mach-msm/pil-riva.c
index c7ae22b..59242e1 100644
--- a/arch/arm/mach-msm/pil-riva.c
+++ b/arch/arm/mach-msm/pil-riva.c
@@ -248,6 +248,7 @@
 	.proxy_unvote = pil_riva_remove_proxy_vote,
 };
 
+#ifndef CONFIG_MSM_INSECURE_PIL_RIVA
 static int pil_riva_init_image_trusted(struct pil_desc *pil,
 		const u8 *metadata, size_t size)
 {
@@ -271,6 +272,7 @@
 	.proxy_vote = pil_riva_make_proxy_vote,
 	.proxy_unvote = pil_riva_remove_proxy_vote,
 };
+#endif
 
 static int __devinit pil_riva_probe(struct platform_device *pdev)
 {
@@ -322,13 +324,17 @@
 	desc->owner = THIS_MODULE;
 	desc->proxy_timeout = 10000;
 
+#ifndef CONFIG_MSM_INSECURE_PIL_RIVA
 	if (pas_supported(PAS_WCNSS) > 0) {
 		desc->ops = &pil_riva_ops_trusted;
 		dev_info(&pdev->dev, "using secure boot\n");
 	} else {
+#endif
 		desc->ops = &pil_riva_ops;
 		dev_info(&pdev->dev, "using non-secure boot\n");
+#ifndef CONFIG_MSM_INSECURE_PIL_RIVA
 	}
+#endif
 
 	drv->xo = devm_clk_get(&pdev->dev, "cxo");
 	if (IS_ERR(drv->xo))
diff --git a/arch/arm/mach-msm/restart.c b/arch/arm/mach-msm/restart.c
index 7daf77d..33e55e2 100644
--- a/arch/arm/mach-msm/restart.c
+++ b/arch/arm/mach-msm/restart.c
@@ -18,12 +18,15 @@
 #include <linux/reboot.h>
 #include <linux/io.h>
 #include <linux/delay.h>
+#include <linux/workqueue.h>
 #include <linux/pm.h>
 #include <linux/cpu.h>
 #include <linux/interrupt.h>
 #include <linux/mfd/pmic8058.h>
 #include <linux/mfd/pmic8901.h>
 #include <linux/mfd/pm8xxx/misc.h>
+#include <linux/gpio.h>
+#include <linux/console.h>
 
 #include <asm/mach-types.h>
 
@@ -32,7 +35,11 @@
 #include <mach/socinfo.h>
 #include <mach/irqs.h>
 #include <mach/scm.h>
+#include <mach/board_htc.h>
+#include <mach/htc_restart_handler.h>
+
 #include "msm_watchdog.h"
+#include "smd_private.h"
 #include "timer.h"
 
 #define WDT0_RST	0x38
@@ -42,7 +49,7 @@
 
 #define PSHOLD_CTL_SU (MSM_TLMM_BASE + 0x820)
 
-#define RESTART_REASON_ADDR 0x65C
+#define RESTART_REASON_ADDR 0xF00
 #define DLOAD_MODE_ADDR     0x0
 
 #define SCM_IO_DISABLE_PMIC_ARBITER	1
@@ -56,20 +63,22 @@
 
 static int restart_mode;
 void *restart_reason;
+int ramdump_source=0;
 
 int pmic_reset_irq;
 static void __iomem *msm_tmr0_base;
 
-#ifdef CONFIG_MSM_DLOAD_MODE
+#ifdef CONFIG_MACH_HTC
+static int notify_efs_sync = 0;
+static int notify_efs_sync_set(const char *val, struct kernel_param *kp);
+module_param_call(notify_efs_sync, notify_efs_sync_set, param_get_int,
+		&notify_efs_sync, 0644);
+
+static void check_efs_sync_work(struct work_struct *work);
+static DECLARE_DELAYED_WORK(checkwork_struct, check_efs_sync_work);
+#endif
+
 static int in_panic;
-static void *dload_mode_addr;
-
-/* Download mode master kill-switch */
-static int dload_set(const char *val, struct kernel_param *kp);
-static int download_mode = 1;
-module_param_call(download_mode, dload_set, param_get_int,
-			&download_mode, 0644);
-
 static int panic_prep_restart(struct notifier_block *this,
 			      unsigned long event, void *ptr)
 {
@@ -81,6 +90,15 @@
 	.notifier_call	= panic_prep_restart,
 };
 
+#ifdef CONFIG_MSM_DLOAD_MODE
+static void *dload_mode_addr;
+
+/* Download mode master kill-switch */
+static int dload_set(const char *val, struct kernel_param *kp);
+static int download_mode = 1;
+module_param_call(download_mode, dload_set, param_get_int,
+			&download_mode, 0644);
+
 static void set_dload_mode(int on)
 {
 	if (dload_mode_addr) {
@@ -132,9 +150,137 @@
 }
 EXPORT_SYMBOL(msm_set_restart_mode);
 
+#ifdef CONFIG_MACH_HTC
+static void msm_flush_console(void)
+{
+	unsigned long flags;
+
+	printk("\n");
+	printk(KERN_EMERG "[K] Restarting %s\n", linux_banner);
+	if (console_trylock()) {
+		console_unlock();
+		return;
+	}
+
+	mdelay(50);
+
+	local_irq_save(flags);
+
+	if (console_trylock())
+		printk(KERN_EMERG "[K] restart: Console was locked! Busting\n");
+	else
+		printk(KERN_EMERG "[K] restart: Console was locked!\n");
+	console_unlock();
+
+	local_irq_restore(flags);
+}
+
+static void set_modem_efs_sync(void)
+{
+	smsm_change_state(SMSM_APPS_STATE, SMSM_APPS_REBOOT, SMSM_APPS_REBOOT);
+	printk(KERN_INFO "[K] %s: wait for modem efs_sync\n", __func__);
+}
+
+static int check_modem_efs_sync(void)
+{
+	return (smsm_get_state(SMSM_MODEM_STATE) & SMSM_SYSTEM_PWRDWN_USR);
+}
+
+static int efs_sync_work_timout;
+static void check_efs_sync_work(struct work_struct *work)
+{
+	if (--efs_sync_work_timout > 0 && !check_modem_efs_sync()) {
+		schedule_delayed_work(&checkwork_struct, msecs_to_jiffies(1000));
+	} else {
+		notify_efs_sync = 0;
+		if (efs_sync_work_timout <= 0)
+			pr_notice("%s: modem efs_sync timeout.\n", __func__);
+		else
+			pr_info("%s: modem efs_sync done.\n", __func__);
+	}
+}
+
+static void notify_modem_efs_sync_schedule(unsigned timeout)
+{
+	efs_sync_work_timout = timeout;
+	set_modem_efs_sync();
+	schedule_delayed_work(&checkwork_struct, msecs_to_jiffies(1000));
+}
+
+static void check_modem_efs_sync_timeout(unsigned timeout)
+{
+	while (timeout > 0 && !check_modem_efs_sync()) {
+		writel(1, msm_tmr0_base + WDT0_RST);
+		mdelay(1000);
+		timeout--;
+	}
+	if (timeout <= 0)
+		pr_notice("%s: modem efs_sync timeout.\n", __func__);
+	else
+		pr_info("%s: modem efs_sync done.\n", __func__);
+}
+
+static int notify_efs_sync_set(const char *val, struct kernel_param *kp)
+{
+	int ret;
+	int old_val = notify_efs_sync;
+
+	if (old_val == 1)
+		return -EINVAL;
+
+	ret = param_set_int(val, kp);
+
+	if (ret)
+		return ret;
+
+	if (notify_efs_sync != 1) {
+		notify_efs_sync = 0;
+		return -EINVAL;
+	}
+
+	notify_modem_efs_sync_schedule(10);
+
+	return 0;
+}
+
+static int notify_efs_sync_call
+	(struct notifier_block *this, unsigned long code, void *_cmd)
+{
+	unsigned long oem_code = 0;
+
+	switch (code) {
+		case SYS_RESTART:
+			if (_cmd && !strncmp(_cmd, "oem-", 4)) {
+				oem_code = simple_strtoul(_cmd + 4, 0, 16) & 0xff;
+			}
+
+			if (board_mfg_mode() <= 2) {
+				if (oem_code != 0x11) {
+					set_modem_efs_sync();
+					check_modem_efs_sync_timeout(10);
+				}
+			}
+
+		case SYS_POWER_OFF:
+			if (notify_efs_sync) {
+				pr_info("%s: userspace initiated efs_sync not finished...\n", __func__);
+				cancel_delayed_work(&checkwork_struct);
+				check_modem_efs_sync_timeout(efs_sync_work_timout - 1);
+			}
+			break;
+	}
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block notify_efs_sync_notifier = {
+   .notifier_call = notify_efs_sync_call,
+};
+#endif
+
 static void __msm_power_off(int lower_pshold)
 {
-	printk(KERN_CRIT "Powering off the SoC\n");
+	printk(KERN_CRIT "[K] Powering off the SoC\n");
 #ifdef CONFIG_MSM_DLOAD_MODE
 	set_dload_mode(0);
 #endif
@@ -143,7 +289,7 @@
 	if (lower_pshold) {
 		__raw_writel(0, PSHOLD_CTL_SU);
 		mdelay(10000);
-		printk(KERN_ERR "Powering off has failed\n");
+		printk(KERN_ERR "[K] Powering off has failed\n");
 	}
 	return;
 }
@@ -234,9 +380,11 @@
 
 void msm_restart(char mode, const char *cmd)
 {
+#ifdef CONFIG_MACH_HTC
+	unsigned long oem_code = 0;
+#endif
 
 #ifdef CONFIG_MSM_DLOAD_MODE
-
 	/* This looks like a normal reboot at this point. */
 	set_dload_mode(0);
 
@@ -257,10 +405,40 @@
 		set_dload_mode(0);
 #endif
 
-	printk(KERN_NOTICE "Going down for restart now\n");
+	printk(KERN_NOTICE "[K] Going down for restart now\n");
+
+	printk(KERN_NOTICE "%s: Kernel command line: %s\n", __func__, saved_command_line);
 
 	pm8xxx_reset_pwr_off(1);
 
+	pr_info("[K] %s: restart by command: [%s]\r\n", __func__, (cmd) ? cmd : "");
+
+#ifdef CONFIG_MACH_HTC
+	if (in_panic) {
+
+	} else if (!cmd) {
+		set_restart_action(RESTART_REASON_REBOOT, NULL);
+	} else if (!strncmp(cmd, "bootloader", 10)) {
+		set_restart_action(RESTART_REASON_BOOTLOADER, NULL);
+	} else if (!strncmp(cmd, "recovery", 8)) {
+		set_restart_action(RESTART_REASON_RECOVERY, NULL);
+	} else if (!strcmp(cmd, "eraseflash")) {
+		set_restart_action(RESTART_REASON_ERASE_FLASH, NULL);
+	} else if (!strncmp(cmd, "oem-", 4)) {
+		oem_code = simple_strtoul(cmd + 4, NULL, 16) & 0xff;
+		set_restart_to_oem(oem_code, NULL);
+	} else if (!strcmp(cmd, "force-hard") ||
+			(RESTART_MODE_LEGACY < mode && mode < RESTART_MODE_MAX)
+			) {
+		if (mode == RESTART_MODE_MODEM_USER_INVOKED)
+			set_restart_action(RESTART_REASON_REBOOT, NULL);
+		else {
+			set_restart_action(RESTART_REASON_RAMDUMP, cmd);
+		}
+	} else {
+		set_restart_action(RESTART_REASON_REBOOT, NULL);
+	}
+#else
 	if (cmd != NULL) {
 		if (!strncmp(cmd, "bootloader", 10)) {
 			__raw_writel(0x77665500, restart_reason);
@@ -276,33 +454,45 @@
 	} else {
 		__raw_writel(0x77665501, restart_reason);
 	}
+#endif
 #ifdef CONFIG_LGE_CRASH_HANDLER
 	if (in_panic == 1)
 		set_kernel_crash_magic_number();
 reset:
 #endif /* CONFIG_LGE_CRASH_HANDLER */
 
+#ifdef CONFIG_MACH_HTC
+	msm_flush_console();
+#endif
+
 	__raw_writel(0, msm_tmr0_base + WDT0_EN);
 	if (!(machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa())) {
 		mb();
 		__raw_writel(0, PSHOLD_CTL_SU); /* Actually reset the chip */
 		mdelay(5000);
-		pr_notice("PS_HOLD didn't work, falling back to watchdog\n");
+		pr_notice("[K] PS_HOLD didn't work, falling back to watchdog\n");
 	}
 
+	pr_info("[K] %s: Restarting by watchdog\r\n", __func__);
+
 	__raw_writel(1, msm_tmr0_base + WDT0_RST);
 	__raw_writel(5*0x31F3, msm_tmr0_base + WDT0_BARK_TIME);
 	__raw_writel(0x31F3, msm_tmr0_base + WDT0_BITE_TIME);
 	__raw_writel(1, msm_tmr0_base + WDT0_EN);
 
 	mdelay(10000);
-	printk(KERN_ERR "Restarting has failed\n");
+	printk(KERN_ERR "[K] Restarting has failed\n");
 }
 
 static int __init msm_pmic_restart_init(void)
 {
 	int rc;
 
+#ifdef CONFIG_MACH_HTC
+	htc_restart_handler_init();
+	register_reboot_notifier(&notify_efs_sync_notifier);
+#endif
+
 	if (pmic_reset_irq != 0) {
 		rc = request_any_context_irq(pmic_reset_irq,
 					resout_irq_handler, IRQF_TRIGGER_HIGH,
@@ -324,8 +514,8 @@
 
 static int __init msm_restart_init(void)
 {
-#ifdef CONFIG_MSM_DLOAD_MODE
 	atomic_notifier_chain_register(&panic_notifier_list, &panic_blk);
+#ifdef CONFIG_MSM_DLOAD_MODE
 	dload_mode_addr = MSM_IMEM_BASE + DLOAD_MODE_ADDR;
 #ifdef CONFIG_LGE_CRASH_HANDLER
 	lge_error_handler_cookie_addr = MSM_IMEM_BASE +
@@ -334,7 +524,6 @@
 	set_dload_mode(download_mode);
 #endif
 	msm_tmr0_base = msm_timer_get_timer0_base();
-	restart_reason = MSM_IMEM_BASE + RESTART_REASON_ADDR;
 	pm_power_off = msm_power_off;
 
 	return 0;
diff --git a/arch/arm/mach-msm/subsystem_restart.c b/arch/arm/mach-msm/subsystem_restart.c
index 747276c..0008629 100644
--- a/arch/arm/mach-msm/subsystem_restart.c
+++ b/arch/arm/mach-msm/subsystem_restart.c
@@ -114,6 +114,20 @@
 static const char * const _order_8x60_modems[] = {"external_modem", "modem"};
 DEFINE_SINGLE_RESTART_ORDER(orders_8x60_modems, _order_8x60_modems);
 
+#ifdef CONFIG_MACH_HTC
+/* MSM 8960 restart ordering info */
+static const char * const order_8960[] = {"modem", "lpass"};
+
+static struct subsys_soc_restart_order restart_orders_8960_one = {
+	.subsystem_list = order_8960,
+	.count = ARRAY_SIZE(order_8960),
+	.subsys_ptrs = {[ARRAY_SIZE(order_8960)] = NULL}
+	};
+
+static struct subsys_soc_restart_order *restart_orders_8960[] = {
+	&restart_orders_8960_one,
+	};
+#else
 /*SGLTE restart ordering info*/
 static const char * const order_8960_sglte[] = {"external_modem",
 						"modem"};
@@ -127,6 +141,7 @@
 static struct subsys_soc_restart_order *restart_orders_8960_sglte[] = {
 	&restart_orders_8960_fusion_sglte,
 	};
+#endif
 
 /* SGLTE2 restart ordering info*/
 static const char * const order_8064_sglte2[] = {"external_modem",
@@ -614,10 +629,15 @@
 		n_restart_orders = ARRAY_SIZE(orders_8x60_all);
 	}
 
+#ifdef CONFIG_MACH_HTC
+	restart_orders = restart_orders_8960;
+	n_restart_orders = ARRAY_SIZE(restart_orders_8960);
+#else
 	if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE) {
 		restart_orders = restart_orders_8960_sglte;
 		n_restart_orders = ARRAY_SIZE(restart_orders_8960_sglte);
 	}
+#endif
 
 	if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_SGLTE2) {
 		restart_orders = restart_orders_8064_sglte2;
diff --git a/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h b/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h
index c64dbb9..eb187e0 100644
--- a/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h
+++ b/arch/arm/mach-mv78xx0/include/mach/bridge-regs.h
@@ -31,5 +31,6 @@
 #define IRQ_MASK_HIGH_OFF	0x0014
 
 #define TIMER_VIRT_BASE		(BRIDGE_VIRT_BASE | 0x0300)
+#define TIMER_PHYS_BASE		(BRIDGE_PHYS_BASE | 0x0300)
 
 #endif
diff --git a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
index 3674497..e807c4c 100644
--- a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
+++ b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
@@ -42,6 +42,7 @@
 #define MV78XX0_CORE0_REGS_PHYS_BASE	0xf1020000
 #define MV78XX0_CORE1_REGS_PHYS_BASE	0xf1024000
 #define MV78XX0_CORE_REGS_VIRT_BASE	0xfe400000
+#define MV78XX0_CORE_REGS_PHYS_BASE	0xfe400000
 #define MV78XX0_CORE_REGS_SIZE		SZ_16K
 
 #define MV78XX0_PCIE_IO_PHYS_BASE(i)	(0xf0800000 + ((i) << 20))
@@ -59,6 +60,7 @@
  * Core-specific peripheral registers.
  */
 #define BRIDGE_VIRT_BASE	(MV78XX0_CORE_REGS_VIRT_BASE)
+#define BRIDGE_PHYS_BASE	(MV78XX0_CORE_REGS_PHYS_BASE)
 
 /*
  * Register Map
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c
index de6d464..d8f6dbf 100644
--- a/arch/arm/mach-omap2/opp.c
+++ b/arch/arm/mach-omap2/opp.c
@@ -53,7 +53,7 @@
 	omap_table_init = 1;
 
 	/* Lets now register with OPP library */
-	for (i = 0; i < opp_def_size; i++) {
+	for (i = 0; i < opp_def_size; i++, opp_def++) {
 		struct omap_hwmod *oh;
 		struct device *dev;
 
@@ -86,7 +86,6 @@
 					__func__, opp_def->freq,
 					opp_def->hwmod_name, i, r);
 		}
-		opp_def++;
 	}
 
 	return 0;
diff --git a/arch/arm/mach-orion5x/include/mach/bridge-regs.h b/arch/arm/mach-orion5x/include/mach/bridge-regs.h
index 96484bc..11a3c1e 100644
--- a/arch/arm/mach-orion5x/include/mach/bridge-regs.h
+++ b/arch/arm/mach-orion5x/include/mach/bridge-regs.h
@@ -35,5 +35,5 @@
 #define MAIN_IRQ_MASK		(ORION5X_BRIDGE_VIRT_BASE | 0x204)
 
 #define TIMER_VIRT_BASE		(ORION5X_BRIDGE_VIRT_BASE | 0x300)
-
+#define TIMER_PHYS_BASE		(ORION5X_BRIDGE_PHYS_BASE | 0x300)
 #endif
diff --git a/arch/arm/mach-orion5x/include/mach/orion5x.h b/arch/arm/mach-orion5x/include/mach/orion5x.h
index 2745f5d..683e085 100644
--- a/arch/arm/mach-orion5x/include/mach/orion5x.h
+++ b/arch/arm/mach-orion5x/include/mach/orion5x.h
@@ -82,6 +82,7 @@
 #define  UART1_VIRT_BASE		(ORION5X_DEV_BUS_VIRT_BASE | 0x2100)
 
 #define ORION5X_BRIDGE_VIRT_BASE	(ORION5X_REGS_VIRT_BASE | 0x20000)
+#define ORION5X_BRIDGE_PHYS_BASE	(ORION5X_REGS_PHYS_BASE | 0x20000)
 
 #define ORION5X_PCI_VIRT_BASE		(ORION5X_REGS_VIRT_BASE | 0x30000)
 
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index 5905ed1..d89d87ae 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -953,12 +953,12 @@
 
 static struct eeti_ts_platform_data eeti_ts_pdata = {
 	.irq_active_high = 1,
+	.irq_gpio = GPIO_TOUCH_IRQ,
 };
 
 static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = {
 	.type	= "eeti_ts",
 	.addr	= 0x0a,
-	.irq	= PXA_GPIO_TO_IRQ(GPIO_TOUCH_IRQ),
 	.platform_data = &eeti_ts_pdata,
 };
 
diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
index 4d6a2ee..5beb7eb 100644
--- a/arch/arm/mach-tegra/reset.c
+++ b/arch/arm/mach-tegra/reset.c
@@ -33,7 +33,7 @@
 
 static bool is_enabled;
 
-static void tegra_cpu_reset_handler_enable(void)
+static void __init tegra_cpu_reset_handler_enable(void)
 {
 	void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE);
 	void __iomem *evp_cpu_reset =
diff --git a/arch/arm/mm/tlb-v7.S b/arch/arm/mm/tlb-v7.S
index 0e88578..c202113 100644
--- a/arch/arm/mm/tlb-v7.S
+++ b/arch/arm/mm/tlb-v7.S
@@ -38,16 +38,16 @@
 	dsb
 	mov	r0, r0, lsr #PAGE_SHIFT		@ align address
 	mov	r1, r1, lsr #PAGE_SHIFT
-#ifdef CONFIG_ARCH_MSM8X60
-	mov	r0, r0, lsl #PAGE_SHIFT
+#ifdef CONFIG_ARM_ERRATA_720789
+	mov	r3, #0
 #else
 	asid	r3, r3				@ mask ASID
-	orr	r0, r3, r0, lsl #PAGE_SHIFT	@ Create initial MVA
 #endif
+	orr	r0, r3, r0, lsl #PAGE_SHIFT	@ Create initial MVA
 	mov	r1, r1, lsl #PAGE_SHIFT
 1:
-#ifdef CONFIG_ARCH_MSM8X60
-	ALT_SMP(mcr	p15, 0, r0, c8, c3, 3)	@ TLB invalidate U MVA (shareable)
+#ifdef CONFIG_ARM_ERRATA_720789
+	ALT_SMP(mcr	p15, 0, r0, c8, c3, 3)	@ TLB invalidate U MVA all ASID (shareable)
 #else
 	ALT_SMP(mcr	p15, 0, r0, c8, c3, 1)	@ TLB invalidate U MVA (shareable)
 #endif
@@ -75,8 +75,8 @@
 	mov	r0, r0, lsl #PAGE_SHIFT
 	mov	r1, r1, lsl #PAGE_SHIFT
 1:
-#ifdef CONFIG_ARCH_MSM8X60
-	ALT_SMP(mcr	p15, 0, r0, c8, c3, 3)	@ TLB invalidate U MVA (shareable)
+#ifdef CONFIG_ARM_ERRATA_720789
+	ALT_SMP(mcr	p15, 0, r0, c8, c3, 3)	@ TLB invalidate U MVA all ASID (shareable)
 #else
 	ALT_SMP(mcr	p15, 0, r0, c8, c3, 1)	@ TLB invalidate U MVA (shareable)
 #endif
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index 74daf5e..331f8bb 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -570,7 +570,7 @@
 static struct orion_wdt_platform_data orion_wdt_data;
 
 static struct resource orion_wdt_resource =
-		DEFINE_RES_MEM(TIMER_VIRT_BASE, 0x28);
+		DEFINE_RES_MEM(TIMER_PHYS_BASE, 0x28);
 
 static struct platform_device orion_wdt_device = {
 	.name		= "orion_wdt",
diff --git a/arch/arm/plat-s5p/clock.c b/arch/arm/plat-s5p/clock.c
index f68a9bb..b042795 100644
--- a/arch/arm/plat-s5p/clock.c
+++ b/arch/arm/plat-s5p/clock.c
@@ -38,6 +38,7 @@
 struct clk clk_xusbxti = {
 	.name		= "xusbxti",
 	.id		= -1,
+	.rate		= 24000000,
 };
 
 struct clk s5p_clk_27m = {
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 33ecd0c..b1e05cc 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -157,11 +157,13 @@
 		return -EINVAL;
 	}
 
-	if (client->is_ts && adc->ts_pend)
-		return -EAGAIN;
-
 	spin_lock_irqsave(&adc->lock, flags);
 
+	if (client->is_ts && adc->ts_pend) {
+		spin_unlock_irqrestore(&adc->lock, flags);
+		return -EAGAIN;
+	}
+
 	client->channel = channel;
 	client->nr_samples = nr_samples;
 
diff --git a/arch/arm/plat-samsung/include/plat/map-s3c.h b/arch/arm/plat-samsung/include/plat/map-s3c.h
index 7d04875..c0c70a8 100644
--- a/arch/arm/plat-samsung/include/plat/map-s3c.h
+++ b/arch/arm/plat-samsung/include/plat/map-s3c.h
@@ -22,7 +22,7 @@
 #define S3C24XX_VA_WATCHDOG	S3C_VA_WATCHDOG
 
 #define S3C2412_VA_SSMC		S3C_ADDR_CPU(0x00000000)
-#define S3C2412_VA_EBI		S3C_ADDR_CPU(0x00010000)
+#define S3C2412_VA_EBI		S3C_ADDR_CPU(0x00100000)
 
 #define S3C2410_PA_UART		(0x50000000)
 #define S3C24XX_PA_UART		S3C2410_PA_UART
diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
index f19aff1..bc4db9b 100644
--- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
+++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
@@ -25,7 +25,7 @@
 
 	__raw_writel(0, S3C2410_WTCON);	  /* disable watchdog, to be safe  */
 
-	if (s3c2410_wdtclk)
+	if (!IS_ERR(s3c2410_wdtclk))
 		clk_enable(s3c2410_wdtclk);
 
 	/* put initial values into count and data */
diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
index c1a9784..7788327 100644
--- a/arch/arm/vfp/entry.S
+++ b/arch/arm/vfp/entry.S
@@ -7,18 +7,20 @@
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
- *
- * Basic entry code, called from the kernel's undefined instruction trap.
- *  r0  = faulted instruction
- *  r2  = faulted PC+4
- *  r9  = successful return
- *  r10 = thread_info structure
- *  lr  = failure return
  */
 #include <asm/thread_info.h>
 #include <asm/vfpmacros.h>
 #include "../kernel/entry-header.S"
 
+@ VFP entry point.
+@
+@  r0  = instruction opcode (32-bit ARM or two 16-bit Thumb)
+@  r2  = PC value to resume execution after successful emulation
+@  r9  = normal "successful" return address
+@  r10 = this threads thread_info structure
+@  lr  = unrecognised instruction return address
+@  IRQs disabled.
+@
 ENTRY(do_vfp)
 #ifdef CONFIG_PREEMPT
 	ldr	r4, [r10, #TI_PREEMPT]	@ get preempt count
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index bd3d771..85b90b1 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -61,13 +61,13 @@
 
 @ VFP hardware support entry point.
 @
-@  r0  = faulted instruction
-@  r2  = faulted PC+4
-@  r9  = successful return
+@  r0  = instruction opcode (32-bit ARM or two 16-bit Thumb)
+@  r2  = PC value to resume execution after successful emulation
+@  r9  = normal "successful" return address
 @  r10 = vfp_state union
 @  r11 = CPU number
-@  lr  = failure return
-
+@  lr  = unrecognised instruction return address
+@  IRQs enabled.
 ENTRY(vfp_support_entry)
 	DBGSTR3	"instr %08x pc %08x state %p", r0, r2, r10
 
@@ -161,9 +161,12 @@
 					@ exception before retrying branch
 					@ out before setting an FPEXC that
 					@ stops us reading stuff
-	VFPFMXR	FPEXC, r1		@ restore FPEXC last
-	sub	r2, r2, #4
-	str	r2, [sp, #S_PC]		@ retry the instruction
+	VFPFMXR	FPEXC, r1		@ Restore FPEXC last
+	sub	r2, r2, #4		@ Retry current instruction - if Thumb
+	str	r2, [sp, #S_PC]		@ mode it's two 16-bit instructions,
+					@ else it's one 32-bit instruction, so
+					@ always subtract 4 from the following
+					@ instruction address.
 #ifdef CONFIG_PREEMPT
 	get_thread_info	r10
 	ldr	r4, [r10, #TI_PREEMPT]	@ get preempt count
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index 241d1c5..d4eb938 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -1,6 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
 header-y += break.h
+header-y += cmpxchg.h
 header-y += fpu.h
 header-y += gcc_intrin.h
 header-y += ia64regs.h
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h
index 7d91166..6e6fe18 100644
--- a/arch/ia64/include/asm/atomic.h
+++ b/arch/ia64/include/asm/atomic.h
@@ -17,8 +17,8 @@
 #include <asm/intrinsics.h>
 
 
-#define ATOMIC_INIT(i)		((atomic_t) { (i) })
-#define ATOMIC64_INIT(i)	((atomic64_t) { (i) })
+#define ATOMIC_INIT(i)		{ (i) }
+#define ATOMIC64_INIT(i)	{ (i) }
 
 #define atomic_read(v)		(*(volatile int *)&(v)->counter)
 #define atomic64_read(v)	(*(volatile long *)&(v)->counter)
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index 5c3e088..1034884 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -23,7 +23,6 @@
 #include <linux/ioport.h>
 #include <linux/kernel_stat.h>
 #include <linux/ptrace.h>
-#include <linux/random.h>	/* for rand_initialize_irq() */
 #include <linux/signal.h>
 #include <linux/smp.h>
 #include <linux/threads.h>
diff --git a/arch/m68k/include/asm/entry.h b/arch/m68k/include/asm/entry.h
index 622138d..34c2520 100644
--- a/arch/m68k/include/asm/entry.h
+++ b/arch/m68k/include/asm/entry.h
@@ -33,8 +33,8 @@
 
 /* the following macro is used when enabling interrupts */
 #if defined(MACH_ATARI_ONLY)
-	/* block out HSYNC on the atari */
-#define ALLOWINT	(~0x400)
+	/* block out HSYNC = ipl 2 on the atari */
+#define ALLOWINT	(~0x500)
 #define	MAX_NOINT_IPL	3
 #else
 	/* portable version */
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 8623f8d..9a5932e 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -479,9 +479,13 @@
 			goto bad_access;
 		}
 
-		mem_value = *mem;
+		/*
+		 * No need to check for EFAULT; we know that the page is
+		 * present and writable.
+		 */
+		__get_user(mem_value, mem);
 		if (mem_value == oldval)
-			*mem = newval;
+			__put_user(newval, mem);
 
 		pte_unmap_unlock(pte, ptl);
 		up_read(&mm->mmap_sem);
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index ac22dc7..333b85e 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -57,7 +57,7 @@
 	def_bool y
 
 config GENERIC_GPIO
-	def_bool y
+	bool
 
 config GENERIC_CSUM
 	def_bool y
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
index 3d5de96..1d7dd96 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
@@ -2,6 +2,7 @@
 #define BCM63XX_GPIO_H
 
 #include <linux/init.h>
+#include <bcm63xx_cpu.h>
 
 int __init bcm63xx_gpio_init(void);
 
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 0d85d8e..abb13e8 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -60,6 +60,8 @@
 register struct thread_info *__current_thread_info __asm__("$28");
 #define current_thread_info()  __current_thread_info
 
+#endif /* !__ASSEMBLY__ */
+
 /* thread information allocation */
 #if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_32BIT)
 #define THREAD_SIZE_ORDER (1)
@@ -97,8 +99,6 @@
 
 #define free_thread_info(info) kfree(info)
 
-#endif /* !__ASSEMBLY__ */
-
 #define PREEMPT_ACTIVE		0x10000000
 
 /*
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index 84d0639..b77f56b 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -323,7 +323,7 @@
 	fdt = files_fdtable(files);
 	for (;;) {
 		unsigned long set;
-		i = j * __NFDBITS;
+		i = j * BITS_PER_LONG;
 		if (i >= fdt->max_fds)
 			break;
 		set = fdt->open_fds[j++];
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 924da5e..df243a6 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -1,5 +1,6 @@
 #include <asm/asm-offsets.h>
 #include <asm/page.h>
+#include <asm/thread_info.h>
 #include <asm-generic/vmlinux.lds.h>
 
 #undef mips
@@ -72,7 +73,7 @@
 	.data : {	/* Data */
 		. = . + DATAOFFSET;		/* for CONFIG_MAPPED_KERNEL */
 
-		INIT_TASK_DATA(PAGE_SIZE)
+		INIT_TASK_DATA(THREAD_SIZE)
 		NOSAVE_DATA
 		CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
 		READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 5350342..07ef351 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -552,7 +552,7 @@
 	 * entry (identifying the physical page) and %r23 up with
 	 * the from tlb entry (or nothing if only a to entry---for
 	 * clear_user_page_asm) */
-	.macro		do_alias	spc,tmp,tmp1,va,pte,prot,fault
+	.macro		do_alias	spc,tmp,tmp1,va,pte,prot,fault,patype
 	cmpib,COND(<>),n 0,\spc,\fault
 	ldil		L%(TMPALIAS_MAP_START),\tmp
 #if defined(CONFIG_64BIT) && (TMPALIAS_MAP_START >= 0x80000000)
@@ -581,11 +581,15 @@
 	 */
 	cmpiclr,=	0x01,\tmp,%r0
 	ldi		(_PAGE_DIRTY|_PAGE_READ|_PAGE_WRITE),\prot
-#ifdef CONFIG_64BIT
+.ifc \patype,20
 	depd,z		\prot,8,7,\prot
-#else
+.else
+.ifc \patype,11
 	depw,z		\prot,8,7,\prot
-#endif
+.else
+	.error "undefined PA type to do_alias"
+.endif
+.endif
 	/*
 	 * OK, it is in the temp alias region, check whether "from" or "to".
 	 * Check "subtle" note in pacache.S re: r23/r26.
@@ -1189,7 +1193,7 @@
 	nop
 
 dtlb_check_alias_20w:
-	do_alias	spc,t0,t1,va,pte,prot,dtlb_fault
+	do_alias	spc,t0,t1,va,pte,prot,dtlb_fault,20
 
 	idtlbt          pte,prot
 
@@ -1213,7 +1217,7 @@
 	nop
 
 nadtlb_check_alias_20w:
-	do_alias	spc,t0,t1,va,pte,prot,nadtlb_emulate
+	do_alias	spc,t0,t1,va,pte,prot,nadtlb_emulate,20
 
 	idtlbt          pte,prot
 
@@ -1245,7 +1249,7 @@
 	nop
 
 dtlb_check_alias_11:
-	do_alias	spc,t0,t1,va,pte,prot,dtlb_fault
+	do_alias	spc,t0,t1,va,pte,prot,dtlb_fault,11
 
 	idtlba          pte,(va)
 	idtlbp          prot,(va)
@@ -1277,7 +1281,7 @@
 	nop
 
 nadtlb_check_alias_11:
-	do_alias	spc,t0,t1,va,pte,prot,nadtlb_emulate
+	do_alias	spc,t0,t1,va,pte,prot,nadtlb_emulate,11
 
 	idtlba          pte,(va)
 	idtlbp          prot,(va)
@@ -1304,7 +1308,7 @@
 	nop
 
 dtlb_check_alias_20:
-	do_alias	spc,t0,t1,va,pte,prot,dtlb_fault
+	do_alias	spc,t0,t1,va,pte,prot,dtlb_fault,20
 	
 	idtlbt          pte,prot
 
@@ -1330,7 +1334,7 @@
 	nop
 
 nadtlb_check_alias_20:
-	do_alias	spc,t0,t1,va,pte,prot,nadtlb_emulate
+	do_alias	spc,t0,t1,va,pte,prot,nadtlb_emulate,20
 
 	idtlbt          pte,prot
 
@@ -1457,7 +1461,7 @@
 	nop
 
 naitlb_check_alias_20w:
-	do_alias	spc,t0,t1,va,pte,prot,naitlb_fault
+	do_alias	spc,t0,t1,va,pte,prot,naitlb_fault,20
 
 	iitlbt		pte,prot
 
@@ -1511,7 +1515,7 @@
 	nop
 
 naitlb_check_alias_11:
-	do_alias	spc,t0,t1,va,pte,prot,itlb_fault
+	do_alias	spc,t0,t1,va,pte,prot,itlb_fault,11
 
 	iitlba          pte,(%sr0, va)
 	iitlbp          prot,(%sr0, va)
@@ -1557,7 +1561,7 @@
 	nop
 
 naitlb_check_alias_20:
-	do_alias	spc,t0,t1,va,pte,prot,naitlb_fault
+	do_alias	spc,t0,t1,va,pte,prot,naitlb_fault,20
 
 	iitlbt          pte,prot
 
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index fa6f2b8..64a9998 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -50,8 +50,10 @@
 	. = KERNEL_BINARY_TEXT_START;
 
 	_text = .;		/* Text and read-only data */
-	.text ALIGN(16) : {
+	.head ALIGN(16) : {
 		HEAD_TEXT
+	} = 0
+	.text ALIGN(16) : {
 		TEXT_TEXT
 		SCHED_TEXT
 		LOCK_TEXT
@@ -65,7 +67,7 @@
 		*(.fixup)
 		*(.lock.text)		/* out-of-line lock text */
 		*(.gnu.warning)
-	} = 0
+	}
 	/* End of text section */
 	_etext = .;
 
diff --git a/arch/powerpc/boot/dts/p1022ds.dtsi b/arch/powerpc/boot/dts/p1022ds.dtsi
index 7cdb505..1b0673e 100644
--- a/arch/powerpc/boot/dts/p1022ds.dtsi
+++ b/arch/powerpc/boot/dts/p1022ds.dtsi
@@ -33,22 +33,6 @@
  */
 
 &board_lbc {
-	/*
-	 * This node is used to access the pixis via "indirect" mode,
-	 * which is done by writing the pixis register index to chip
-	 * select 0 and the value to/from chip select 1.  Indirect
-	 * mode is the only way to access the pixis when DIU video
-	 * is enabled.  Note that this assumes that the first column
-	 * of the 'ranges' property above is the chip select number.
-	 */
-	board-control@0,0 {
-		compatible = "fsl,p1022ds-indirect-pixis";
-		reg = <0x0 0x0 1	/* CS0 */
-		       0x1 0x0 1>;	/* CS1 */
-		interrupt-parent = <&mpic>;
-		interrupts = <8 0 0 0>;
-	};
-
 	nor@0,0 {
 		#address-cells = <1>;
 		#size-cells = <1>;
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 51010bf..907e9fd 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -85,8 +85,8 @@
 }
 
 #ifdef CONFIG_PPC_BOOK3E
-#define __hard_irq_enable()	asm volatile("wrteei 1" : : : "memory");
-#define __hard_irq_disable()	asm volatile("wrteei 0" : : : "memory");
+#define __hard_irq_enable()	asm volatile("wrteei 1" : : : "memory")
+#define __hard_irq_disable()	asm volatile("wrteei 0" : : : "memory")
 #else
 #define __hard_irq_enable()	__mtmsrd(local_paca->kernel_msr | MSR_EE, 1)
 #define __hard_irq_disable()	__mtmsrd(local_paca->kernel_msr, 1)
@@ -99,6 +99,14 @@
 	get_paca()->irq_happened |= PACA_IRQ_HARD_DIS;
 }
 
+/* include/linux/interrupt.h needs hard_irq_disable to be a macro */
+#define hard_irq_disable	hard_irq_disable
+
+static inline bool lazy_irq_pending(void)
+{
+	return !!(get_paca()->irq_happened & ~PACA_IRQ_HARD_DIS);
+}
+
 /*
  * This is called by asynchronous interrupts to conditionally
  * re-enable hard interrupts when soft-disabled after having
@@ -116,6 +124,8 @@
 	return !regs->softe;
 }
 
+extern bool prep_irq_for_idle(void);
+
 #else /* CONFIG_PPC64 */
 
 #define SET_MSR_EE(x)	mtmsr(x)
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 9d7f0fb..cae0ed7 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1022,7 +1022,8 @@
 /* Macros for setting and retrieving special purpose registers */
 #ifndef __ASSEMBLY__
 #define mfmsr()		({unsigned long rval; \
-			asm volatile("mfmsr %0" : "=r" (rval)); rval;})
+			asm volatile("mfmsr %0" : "=r" (rval) : \
+						: "memory"); rval;})
 #ifdef CONFIG_PPC_BOOK3S_64
 #define __mtmsrd(v, l)	asm volatile("mtmsrd %0," __stringify(l) \
 				     : : "r" (v) : "memory")
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index bf99cfa..6324008 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -245,9 +245,9 @@
 
 	/*
 	 * On PPC32 the trampoline looks like:
-	 *  0x3d, 0x60, 0x00, 0x00  lis r11,sym@ha
-	 *  0x39, 0x6b, 0x00, 0x00  addi r11,r11,sym@l
-	 *  0x7d, 0x69, 0x03, 0xa6  mtctr r11
+	 *  0x3d, 0x80, 0x00, 0x00  lis r12,sym@ha
+	 *  0x39, 0x8c, 0x00, 0x00  addi r12,r12,sym@l
+	 *  0x7d, 0x89, 0x03, 0xa6  mtctr r12
 	 *  0x4e, 0x80, 0x04, 0x20  bctr
 	 */
 
@@ -262,9 +262,9 @@
 	pr_devel(" %08x %08x ", jmp[0], jmp[1]);
 
 	/* verify that this is what we expect it to be */
-	if (((jmp[0] & 0xffff0000) != 0x3d600000) ||
-	    ((jmp[1] & 0xffff0000) != 0x396b0000) ||
-	    (jmp[2] != 0x7d6903a6) ||
+	if (((jmp[0] & 0xffff0000) != 0x3d800000) ||
+	    ((jmp[1] & 0xffff0000) != 0x398c0000) ||
+	    (jmp[2] != 0x7d8903a6) ||
 	    (jmp[3] != 0x4e800420)) {
 		printk(KERN_ERR "Not a trampoline\n");
 		return -EINVAL;
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index 6d2209a..04d7909 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -113,6 +113,9 @@
 	}
 }
 
+static void do_nothing(void *unused)
+{
+}
 
 /*
  * cpu_idle_wait - Used to ensure that all the CPUs come out of the old
@@ -123,16 +126,9 @@
  */
 void cpu_idle_wait(void)
 {
-	int cpu;
 	smp_mb();
-
-	/* kick all the CPUs so that they exit out of old idle routine */
-	get_online_cpus();
-	for_each_online_cpu(cpu) {
-		if (cpu != smp_processor_id())
-			smp_send_reschedule(cpu);
-	}
-	put_online_cpus();
+	/* kick all the CPUs so that they exit out of pm_idle */
+	smp_call_function(do_nothing, NULL, 1);
 }
 EXPORT_SYMBOL_GPL(cpu_idle_wait);
 
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 641da9e..d7ebc58 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -229,7 +229,7 @@
 	 */
 	if (unlikely(irq_happened != PACA_IRQ_HARD_DIS))
 		__hard_irq_disable();
-#ifdef CONFIG_TRACE_IRQFLAG
+#ifdef CONFIG_TRACE_IRQFLAGS
 	else {
 		/*
 		 * We should already be hard disabled here. We had bugs
@@ -277,7 +277,7 @@
  * NOTE: This is called with interrupts hard disabled but not marked
  * as such in paca->irq_happened, so we need to resync this.
  */
-void restore_interrupts(void)
+void notrace restore_interrupts(void)
 {
 	if (irqs_disabled()) {
 		local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
@@ -286,6 +286,52 @@
 		__hard_irq_enable();
 }
 
+/*
+ * This is a helper to use when about to go into idle low-power
+ * when the latter has the side effect of re-enabling interrupts
+ * (such as calling H_CEDE under pHyp).
+ *
+ * You call this function with interrupts soft-disabled (this is
+ * already the case when ppc_md.power_save is called). The function
+ * will return whether to enter power save or just return.
+ *
+ * In the former case, it will have notified lockdep of interrupts
+ * being re-enabled and generally sanitized the lazy irq state,
+ * and in the latter case it will leave with interrupts hard
+ * disabled and marked as such, so the local_irq_enable() call
+ * in cpu_idle() will properly re-enable everything.
+ */
+bool prep_irq_for_idle(void)
+{
+	/*
+	 * First we need to hard disable to ensure no interrupt
+	 * occurs before we effectively enter the low power state
+	 */
+	hard_irq_disable();
+
+	/*
+	 * If anything happened while we were soft-disabled,
+	 * we return now and do not enter the low power state.
+	 */
+	if (lazy_irq_pending())
+		return false;
+
+	/* Tell lockdep we are about to re-enable */
+	trace_hardirqs_on();
+
+	/*
+	 * Mark interrupts as soft-enabled and clear the
+	 * PACA_IRQ_HARD_DIS from the pending mask since we
+	 * are about to hard enable as well as a side effect
+	 * of entering the low power state.
+	 */
+	local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS;
+	local_paca->soft_enabled = 1;
+
+	/* Tell the caller to enter the low power state */
+	return true;
+}
+
 #endif /* CONFIG_PPC64 */
 
 int arch_show_interrupts(struct seq_file *p, int prec)
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c
index 0b6d796..2e3200c 100644
--- a/arch/powerpc/kernel/module_32.c
+++ b/arch/powerpc/kernel/module_32.c
@@ -176,8 +176,8 @@
 
 static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val)
 {
-	if (entry->jump[0] == 0x3d600000 + ((val + 0x8000) >> 16)
-	    && entry->jump[1] == 0x396b0000 + (val & 0xffff))
+	if (entry->jump[0] == 0x3d800000 + ((val + 0x8000) >> 16)
+	    && entry->jump[1] == 0x398c0000 + (val & 0xffff))
 		return 1;
 	return 0;
 }
@@ -204,10 +204,9 @@
 		entry++;
 	}
 
-	/* Stolen from Paul Mackerras as well... */
-	entry->jump[0] = 0x3d600000+((val+0x8000)>>16);	/* lis r11,sym@ha */
-	entry->jump[1] = 0x396b0000 + (val&0xffff);	/* addi r11,r11,sym@l*/
-	entry->jump[2] = 0x7d6903a6;			/* mtctr r11 */
+	entry->jump[0] = 0x3d800000+((val+0x8000)>>16); /* lis r12,sym@ha */
+	entry->jump[1] = 0x398c0000 + (val&0xffff);     /* addi r12,r12,sym@l*/
+	entry->jump[2] = 0x7d8903a6;                    /* mtctr r12 */
 	entry->jump[3] = 0x4e800420;			/* bctr */
 
 	DEBUGP("Initialized plt for 0x%x at %p\n", val, entry);
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index f8df241..522c826 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -474,6 +474,7 @@
 	struct pt_regs *old_regs;
 	u64 *next_tb = &__get_cpu_var(decrementers_next_tb);
 	struct clock_event_device *evt = &__get_cpu_var(decrementers);
+	u64 now;
 
 	/* Ensure a positive value is written to the decrementer, or else
 	 * some CPUs will continue to take decrementer exceptions.
@@ -508,9 +509,16 @@
 		irq_work_run();
 	}
 
-	*next_tb = ~(u64)0;
-	if (evt->event_handler)
-		evt->event_handler(evt);
+	now = get_tb_or_rtc();
+	if (now >= *next_tb) {
+		*next_tb = ~(u64)0;
+		if (evt->event_handler)
+			evt->event_handler(evt);
+	} else {
+		now = *next_tb - now;
+		if (now <= DECREMENTER_MAX)
+			set_dec((int)now);
+	}
 
 #ifdef CONFIG_PPC64
 	/* collect purr register values often, for accurate calculations */
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index b70bf22..24b23a4 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -776,7 +776,7 @@
 	lwz	r3,VCORE_NAPPING_THREADS(r5)
 	lwz	r4,VCPU_PTID(r9)
 	li	r0,1
-	sldi	r0,r0,r4
+	sld	r0,r0,r4
 	andc.	r3,r3,r0		/* no sense IPI'ing ourselves */
 	beq	43f
 	mulli	r4,r4,PACA_SIZE		/* get paca for thread 0 */
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b6edbb3..6e8f677 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -635,7 +635,7 @@
  */
 static void __init parse_drconf_memory(struct device_node *memory)
 {
-	const u32 *dm, *usm;
+	const u32 *uninitialized_var(dm), *usm;
 	unsigned int n, rc, ranges, is_kexec_kdump = 0;
 	unsigned long lmb_size, base, size, sz;
 	int nid;
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index f700c81..978330c 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -27,6 +27,7 @@
 #include <sysdev/fsl_pci.h>
 #include <asm/udbg.h>
 #include <asm/fsl_guts.h>
+#include <asm/fsl_lbc.h>
 #include "smp.h"
 
 #include "mpc85xx.h"
@@ -142,17 +143,73 @@
 {
 }
 
+struct fsl_law {
+	u32	lawbar;
+	u32	reserved1;
+	u32	lawar;
+	u32	reserved[5];
+};
+
+#define LAWBAR_MASK	0x00F00000
+#define LAWBAR_SHIFT	12
+
+#define LAWAR_EN	0x80000000
+#define LAWAR_TGT_MASK	0x01F00000
+#define LAW_TRGT_IF_LBC	(0x04 << 20)
+
+#define LAWAR_MASK	(LAWAR_EN | LAWAR_TGT_MASK)
+#define LAWAR_MATCH	(LAWAR_EN | LAW_TRGT_IF_LBC)
+
+#define BR_BA		0xFFFF8000
+
+/*
+ * Map a BRx value to a physical address
+ *
+ * The localbus BRx registers only store the lower 32 bits of the address.  To
+ * obtain the upper four bits, we need to scan the LAW table.  The entry which
+ * maps to the localbus will contain the upper four bits.
+ */
+static phys_addr_t lbc_br_to_phys(const void *ecm, unsigned int count, u32 br)
+{
+#ifndef CONFIG_PHYS_64BIT
+	/*
+	 * If we only have 32-bit addressing, then the BRx address *is* the
+	 * physical address.
+	 */
+	return br & BR_BA;
+#else
+	const struct fsl_law *law = ecm + 0xc08;
+	unsigned int i;
+
+	for (i = 0; i < count; i++) {
+		u64 lawbar = in_be32(&law[i].lawbar);
+		u32 lawar = in_be32(&law[i].lawar);
+
+		if ((lawar & LAWAR_MASK) == LAWAR_MATCH)
+			/* Extract the upper four bits */
+			return (br & BR_BA) | ((lawbar & LAWBAR_MASK) << 12);
+	}
+
+	return 0;
+#endif
+}
+
 /**
  * p1022ds_set_monitor_port: switch the output to a different monitor port
- *
  */
 static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port)
 {
 	struct device_node *guts_node;
-	struct device_node *indirect_node = NULL;
+	struct device_node *lbc_node = NULL;
+	struct device_node *law_node = NULL;
 	struct ccsr_guts __iomem *guts;
+	struct fsl_lbc_regs *lbc = NULL;
+	void *ecm = NULL;
 	u8 __iomem *lbc_lcs0_ba = NULL;
 	u8 __iomem *lbc_lcs1_ba = NULL;
+	phys_addr_t cs0_addr, cs1_addr;
+	const __be32 *iprop;
+	unsigned int num_laws;
 	u8 b;
 
 	/* Map the global utilities registers. */
@@ -168,25 +225,43 @@
 		goto exit;
 	}
 
-	indirect_node = of_find_compatible_node(NULL, NULL,
-					     "fsl,p1022ds-indirect-pixis");
-	if (!indirect_node) {
-		pr_err("p1022ds: missing pixis indirect mode node\n");
+	lbc_node = of_find_compatible_node(NULL, NULL, "fsl,p1022-elbc");
+	if (!lbc_node) {
+		pr_err("p1022ds: missing localbus node\n");
 		goto exit;
 	}
 
-	lbc_lcs0_ba = of_iomap(indirect_node, 0);
-	if (!lbc_lcs0_ba) {
-		pr_err("p1022ds: could not map localbus chip select 0\n");
+	lbc = of_iomap(lbc_node, 0);
+	if (!lbc) {
+		pr_err("p1022ds: could not map localbus node\n");
 		goto exit;
 	}
 
-	lbc_lcs1_ba = of_iomap(indirect_node, 1);
-	if (!lbc_lcs1_ba) {
-		pr_err("p1022ds: could not map localbus chip select 1\n");
+	law_node = of_find_compatible_node(NULL, NULL, "fsl,ecm-law");
+	if (!law_node) {
+		pr_err("p1022ds: missing local access window node\n");
 		goto exit;
 	}
 
+	ecm = of_iomap(law_node, 0);
+	if (!ecm) {
+		pr_err("p1022ds: could not map local access window node\n");
+		goto exit;
+	}
+
+	iprop = of_get_property(law_node, "fsl,num-laws", 0);
+	if (!iprop) {
+		pr_err("p1022ds: LAW node is missing fsl,num-laws property\n");
+		goto exit;
+	}
+	num_laws = be32_to_cpup(iprop);
+
+	cs0_addr = lbc_br_to_phys(ecm, num_laws, in_be32(&lbc->bank[0].br));
+	cs1_addr = lbc_br_to_phys(ecm, num_laws, in_be32(&lbc->bank[1].br));
+
+	lbc_lcs0_ba = ioremap(cs0_addr, 1);
+	lbc_lcs1_ba = ioremap(cs1_addr, 1);
+
 	/* Make sure we're in indirect mode first. */
 	if ((in_be32(&guts->pmuxcr) & PMUXCR_ELBCDIU_MASK) !=
 	    PMUXCR_ELBCDIU_DIU) {
@@ -254,10 +329,15 @@
 		iounmap(lbc_lcs1_ba);
 	if (lbc_lcs0_ba)
 		iounmap(lbc_lcs0_ba);
+	if (lbc)
+		iounmap(lbc);
+	if (ecm)
+		iounmap(ecm);
 	if (guts)
 		iounmap(guts);
 
-	of_node_put(indirect_node);
+	of_node_put(law_node);
+	of_node_put(lbc_node);
 	of_node_put(guts_node);
 }
 
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
index efdacc8..d17e98b 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -42,11 +42,9 @@
 {
 	unsigned long ctrl, thread_switch_control;
 
-	/*
-	 * We need to hard disable interrupts, the local_irq_enable() done by
-	 * our caller upon return will hard re-enable.
-	 */
-	hard_irq_disable();
+	/* Ensure our interrupt state is properly tracked */
+	if (!prep_irq_for_idle())
+		return;
 
 	ctrl = mfspr(SPRN_CTRLF);
 
@@ -81,6 +79,9 @@
 	 */
 	ctrl &= ~(CTRL_RUNLATCH | CTRL_TE);
 	mtspr(SPRN_CTRLT, ctrl);
+
+	/* Re-enable interrupts in MSR */
+	__hard_irq_enable();
 }
 
 static int cbe_system_reset_exception(struct pt_regs *regs)
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c
index 4cb375c..fb50631 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -85,8 +85,10 @@
 	set_current_state(TASK_INTERRUPTIBLE);	/* Don't add to load average */
 	edev = handle_eeh_events(event);
 
-	eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING);
-	pci_dev_put(edev->pdev);
+	if (edev) {
+		eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING);
+		pci_dev_put(edev->pdev);
+	}
 
 	kfree(event);
 	mutex_unlock(&eeh_event_mutex);
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 0915b1a..2d311c0 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -106,7 +106,7 @@
 		tcep++;
 	}
 
-	if (tbl->it_type == TCE_PCI_SWINV_CREATE)
+	if (tbl->it_type & TCE_PCI_SWINV_CREATE)
 		tce_invalidate_pSeries_sw(tbl, tces, tcep - 1);
 	return 0;
 }
@@ -121,7 +121,7 @@
 	while (npages--)
 		*(tcep++) = 0;
 
-	if (tbl->it_type == TCE_PCI_SWINV_FREE)
+	if (tbl->it_type & TCE_PCI_SWINV_FREE)
 		tce_invalidate_pSeries_sw(tbl, tces, tcep - 1);
 }
 
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
index 41a34bc..c71be66 100644
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ b/arch/powerpc/platforms/pseries/processor_idle.c
@@ -99,15 +99,18 @@
 static void check_and_cede_processor(void)
 {
 	/*
-	 * Interrupts are soft-disabled at this point,
-	 * but not hard disabled. So an interrupt might have
-	 * occurred before entering NAP, and would be potentially
-	 * lost (edge events, decrementer events, etc...) unless
-	 * we first hard disable then check.
+	 * Ensure our interrupt state is properly tracked,
+	 * also checks if no interrupt has occurred while we
+	 * were soft-disabled
 	 */
-	hard_irq_disable();
-	if (get_paca()->irq_happened == 0)
+	if (prep_irq_for_idle()) {
 		cede_processor();
+#ifdef CONFIG_TRACE_IRQFLAGS
+		/* Ensure that H_CEDE returns with IRQs on */
+		if (WARN_ON(!(mfmsr() & MSR_EE)))
+			__hard_irq_enable();
+#endif
+	}
 }
 
 static int dedicated_cede_loop(struct cpuidle_device *dev,
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0f3ab06..eab3492 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -971,7 +971,7 @@
 		/* print cpus waiting or in xmon */
 		printf("cpus stopped:");
 		count = 0;
-		for (cpu = 0; cpu < NR_CPUS; ++cpu) {
+		for_each_possible_cpu(cpu) {
 			if (cpumask_test_cpu(cpu, &cpus_in_xmon)) {
 				if (count == 0)
 					printf(" %x", cpu);
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index 5d09e40..5d211f7 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -13,7 +13,6 @@
 #include <asm/uaccess.h>
 #include <asm/tlbflush.h>
 #include <asm/ctl_reg.h>
-#include <asm-generic/mm_hooks.h>
 
 static inline int init_new_context(struct task_struct *tsk,
 				   struct mm_struct *mm)
@@ -93,4 +92,17 @@
         switch_mm(prev, next, current);
 }
 
+static inline void arch_dup_mmap(struct mm_struct *oldmm,
+				 struct mm_struct *mm)
+{
+#ifdef CONFIG_64BIT
+	if (oldmm->context.asce_limit < mm->context.asce_limit)
+		crst_table_downgrade(mm, oldmm->context.asce_limit);
+#endif
+}
+
+static inline void arch_exit_mmap(struct mm_struct *mm)
+{
+}
+
 #endif /* __S390_MMU_CONTEXT_H */
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index d499b30..8b6f62e 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -129,7 +129,9 @@
 	regs->psw.mask	= psw_user_bits | PSW_MASK_BA;			\
 	regs->psw.addr	= new_psw | PSW_ADDR_AMODE;			\
 	regs->gprs[15]	= new_stackp;					\
+	__tlb_flush_mm(current->mm);					\
 	crst_table_downgrade(current->mm, 1UL << 31);			\
+	update_mm(current->mm, current);				\
 } while (0)
 
 /* Forward declaration, a strange C thing */
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index ab64bdb..36e6c30 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -612,7 +612,6 @@
 		return -EFAULT;
 	if (a.offset & ~PAGE_MASK)
 		return -EINVAL;
-	a.addr = (unsigned long) compat_ptr(a.addr);
 	return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
 			      a.offset >> PAGE_SHIFT);
 }
@@ -623,7 +622,6 @@
 
 	if (copy_from_user(&a, arg, sizeof(a)))
 		return -EFAULT;
-	a.addr = (unsigned long) compat_ptr(a.addr);
 	return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
 }
 
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index ff605a3..cfe3efd 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1636,7 +1636,7 @@
 	llgfr	%r6,%r6			# unsigned long
 	llgf	%r0,164(%r15)		# unsigned long
 	stg	%r0,160(%r15)
-	jg	sys_process_vm_readv
+	jg	compat_sys_process_vm_readv
 
 ENTRY(compat_sys_process_vm_writev_wrapper)
 	lgfr	%r2,%r2			# compat_pid_t
@@ -1646,4 +1646,4 @@
 	llgfr	%r6,%r6			# unsigned long
 	llgf	%r0,164(%r15)		# unsigned long
 	stg	%r0,160(%r15)
-	jg	sys_process_vm_writev
+	jg	compat_sys_process_vm_writev
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
index 6e0073e..07c7bf4 100644
--- a/arch/s390/kernel/processor.c
+++ b/arch/s390/kernel/processor.c
@@ -26,12 +26,14 @@
 void __cpuinit cpu_init(void)
 {
 	struct cpuid *id = &per_cpu(cpu_id, smp_processor_id());
+	struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
 
 	get_cpu_id(id);
 	atomic_inc(&init_mm.mm_count);
 	current->active_mm = &init_mm;
 	BUG_ON(current->mm);
 	enter_lazy_tlb(&init_mm, current);
+	memset(idle, 0, sizeof(*idle));
 }
 
 /*
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 1f77227..c7b8822 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -1034,14 +1034,11 @@
 	unsigned int cpu = (unsigned int)(long)hcpu;
 	struct cpu *c = &pcpu_devices[cpu].cpu;
 	struct device *s = &c->dev;
-	struct s390_idle_data *idle;
 	int err = 0;
 
 	switch (action) {
 	case CPU_ONLINE:
 	case CPU_ONLINE_FROZEN:
-		idle = &per_cpu(s390_idle, cpu);
-		memset(idle, 0, sizeof(struct s390_idle_data));
 		err = sysfs_create_group(&s->kobj, &cpu_online_attr_group);
 		break;
 	case CPU_DEAD:
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 46ef3fd..f2b11ee 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -443,6 +443,7 @@
 	struct pt_regs regs;
 	int access, fault;
 
+	/* Emulate a uaccess fault from kernel mode. */
 	regs.psw.mask = psw_kernel_bits | PSW_MASK_DAT | PSW_MASK_MCHECK;
 	if (!irqs_disabled())
 		regs.psw.mask |= PSW_MASK_IO | PSW_MASK_EXT;
@@ -452,12 +453,12 @@
 	regs.int_parm_long = (uaddr & PAGE_MASK) | 2;
 	access = write ? VM_WRITE : VM_READ;
 	fault = do_exception(&regs, access);
-	if (unlikely(fault)) {
-		if (fault & VM_FAULT_OOM)
-			return -EFAULT;
-		else if (fault & VM_FAULT_SIGBUS)
-			do_sigbus(&regs);
-	}
+	/*
+	 * Since the fault happened in kernel mode while performing a uaccess
+	 * all we need to do now is emulating a fixup in case "fault" is not
+	 * zero.
+	 * For the calling uaccess functions this results always in -EFAULT.
+	 */
 	return fault ? -EFAULT : 0;
 }
 
@@ -574,6 +575,7 @@
 			tsk->thread.pfault_wait = 0;
 			list_del(&tsk->thread.list);
 			wake_up_process(tsk);
+			put_task_struct(tsk);
 		} else {
 			/* Completion interrupt was faster than initial
 			 * interrupt. Set pfault_wait to -1 so the initial
@@ -588,14 +590,22 @@
 		put_task_struct(tsk);
 	} else {
 		/* signal bit not set -> a real page is missing. */
-		if (tsk->thread.pfault_wait == -1) {
+		if (tsk->thread.pfault_wait == 1) {
+			/* Already on the list with a reference: put to sleep */
+			set_task_state(tsk, TASK_UNINTERRUPTIBLE);
+			set_tsk_need_resched(tsk);
+		} else if (tsk->thread.pfault_wait == -1) {
 			/* Completion interrupt was faster than the initial
 			 * interrupt (pfault_wait == -1). Set pfault_wait
 			 * back to zero and exit. */
 			tsk->thread.pfault_wait = 0;
 		} else {
 			/* Initial interrupt arrived before completion
-			 * interrupt. Let the task sleep. */
+			 * interrupt. Let the task sleep.
+			 * An extra task reference is needed since a different
+			 * cpu may set the task state to TASK_RUNNING again
+			 * before the scheduler is reached. */
+			get_task_struct(tsk);
 			tsk->thread.pfault_wait = 1;
 			list_add(&tsk->thread.list, &pfault_list);
 			set_task_state(tsk, TASK_UNINTERRUPTIBLE);
@@ -620,6 +630,7 @@
 			list_del(&thread->list);
 			tsk = container_of(thread, struct task_struct, thread);
 			wake_up_process(tsk);
+			put_task_struct(tsk);
 		}
 		spin_unlock_irq(&pfault_lock);
 		break;
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index 2857c48..a64fe53 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -105,9 +105,15 @@
 
 int s390_mmap_check(unsigned long addr, unsigned long len)
 {
+	int rc;
+
 	if (!is_compat_task() &&
-	    len >= TASK_SIZE && TASK_SIZE < (1UL << 53))
-		return crst_table_upgrade(current->mm, 1UL << 53);
+	    len >= TASK_SIZE && TASK_SIZE < (1UL << 53)) {
+		rc = crst_table_upgrade(current->mm, 1UL << 53);
+		if (rc)
+			return rc;
+		update_mm(current->mm, current);
+	}
 	return 0;
 }
 
@@ -127,6 +133,7 @@
 		rc = crst_table_upgrade(mm, 1UL << 53);
 		if (rc)
 			return (unsigned long) rc;
+		update_mm(mm, current);
 		area = arch_get_unmapped_area(filp, addr, len, pgoff, flags);
 	}
 	return area;
@@ -149,6 +156,7 @@
 		rc = crst_table_upgrade(mm, 1UL << 53);
 		if (rc)
 			return (unsigned long) rc;
+		update_mm(mm, current);
 		area = arch_get_unmapped_area_topdown(filp, addr, len,
 						      pgoff, flags);
 	}
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 6e765bf..87f0efd 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -85,7 +85,6 @@
 		crst_table_free(mm, table);
 	if (mm->context.asce_limit < limit)
 		goto repeat;
-	update_mm(mm, current);
 	return 0;
 }
 
@@ -93,9 +92,6 @@
 {
 	pgd_t *pgd;
 
-	if (mm->context.asce_limit <= limit)
-		return;
-	__tlb_flush_mm(mm);
 	while (mm->context.asce_limit > limit) {
 		pgd = mm->pgd;
 		switch (pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) {
@@ -118,7 +114,6 @@
 		mm->task_size = mm->context.asce_limit;
 		crst_table_free(mm, (unsigned long *) pgd);
 	}
-	update_mm(mm, current);
 }
 #endif
 
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 6c0683d..76c7ccf 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -584,6 +584,9 @@
 	depends on COMPAT && SYSVIPC
 	default y
 
+config KEYS_COMPAT
+	def_bool y if COMPAT && KEYS
+
 endmenu
 
 source "net/Kconfig"
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index db86b1a..3a58e0d 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -74,7 +74,7 @@
 	.word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
 /*270*/	.word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
 	.word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
-/*280*/	.word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
+/*280*/	.word sys32_tee, sys_add_key, sys_request_key, compat_sys_keyctl, compat_sys_openat
 	.word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64
 /*290*/	.word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
 	.word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
diff --git a/arch/tile/include/asm/bitops.h b/arch/tile/include/asm/bitops.h
index 16f1fa5..bd186c4 100644
--- a/arch/tile/include/asm/bitops.h
+++ b/arch/tile/include/asm/bitops.h
@@ -77,6 +77,11 @@
 	return __builtin_ffs(x);
 }
 
+static inline int fls64(__u64 w)
+{
+	return (sizeof(__u64) * 8) - __builtin_clzll(w);
+}
+
 /**
  * fls - find last set bit in word
  * @x: the word to search
@@ -90,12 +95,7 @@
  */
 static inline int fls(int x)
 {
-	return (sizeof(int) * 8) - __builtin_clz(x);
-}
-
-static inline int fls64(__u64 w)
-{
-	return (sizeof(__u64) * 8) - __builtin_clzll(w);
+	return fls64((unsigned int) x);
 }
 
 static inline unsigned int __arch_hweight32(unsigned int w)
diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h
index 6a3f984..5888f1b 100644
--- a/arch/um/include/asm/pgtable.h
+++ b/arch/um/include/asm/pgtable.h
@@ -273,6 +273,12 @@
 }
 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 
+#define __HAVE_ARCH_PTE_SAME
+static inline int pte_same(pte_t pte_a, pte_t pte_b)
+{
+	return !((pte_val(pte_a) ^ pte_val(pte_b)) & ~_PAGE_NEWPAGE);
+}
+
 /*
  * Conversion functions: convert a page and protection to a page entry,
  * and a page entry and page directory to the page they refer to.
@@ -348,11 +354,11 @@
 #define update_mmu_cache(vma,address,ptep) do ; while (0)
 
 /* Encode and de-code a swap entry */
-#define __swp_type(x)			(((x).val >> 4) & 0x3f)
+#define __swp_type(x)			(((x).val >> 5) & 0x1f)
 #define __swp_offset(x)			((x).val >> 11)
 
 #define __swp_entry(type, offset) \
-	((swp_entry_t) { ((type) << 4) | ((offset) << 11) })
+	((swp_entry_t) { ((type) << 5) | ((offset) << 11) })
 #define __pte_to_swp_entry(pte) \
 	((swp_entry_t) { pte_val(pte_mkuptodate(pte)) })
 #define __swp_entry_to_pte(x)		((pte_t) { (x).val })
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 94e91e4..b1c611e 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -206,6 +206,7 @@
 	$(Q)rm -rf $(objtree)/arch/i386
 	$(Q)rm -rf $(objtree)/arch/x86_64
 	$(Q)$(MAKE) $(clean)=$(boot)
+	$(Q)$(MAKE) $(clean)=arch/x86/tools
 
 define archhelp
   echo  '* bzImage      - Compressed kernel image (arch/x86/boot/bzImage)'
diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S
index be6d9e3..3470624 100644
--- a/arch/x86/crypto/aesni-intel_asm.S
+++ b/arch/x86/crypto/aesni-intel_asm.S
@@ -2460,10 +2460,12 @@
 	pxor IN3, STATE4
 	movaps IN4, IV
 #else
-	pxor (INP), STATE2
-	pxor 0x10(INP), STATE3
 	pxor IN1, STATE4
 	movaps IN2, IV
+	movups (INP), IN1
+	pxor IN1, STATE2
+	movups 0x10(INP), IN2
+	pxor IN2, STATE3
 #endif
 	movups STATE1, (OUTP)
 	movups STATE2, 0x10(OUTP)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index a69245b..4f5bfac 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -38,7 +38,7 @@
 int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
 {
 	int err = 0;
-	bool ia32 = is_ia32_task();
+	bool ia32 = test_thread_flag(TIF_IA32);
 
 	if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
 		return -EFAULT;
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 340ee49..f91e80f 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -176,7 +176,7 @@
 #define X86_FEATURE_XSAVEOPT	(7*32+ 4) /* Optimized Xsave */
 #define X86_FEATURE_PLN		(7*32+ 5) /* Intel Power Limit Notification */
 #define X86_FEATURE_PTS		(7*32+ 6) /* Intel Package Thermal Status */
-#define X86_FEATURE_DTS		(7*32+ 7) /* Digital Thermal Sensor */
+#define X86_FEATURE_DTHERM	(7*32+ 7) /* Digital Thermal Sensor */
 #define X86_FEATURE_HW_PSTATE	(7*32+ 8) /* AMD HW-PState */
 
 /* Virtualization flags: Linux defined, word 8 */
diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
index effff47..cb00ccc 100644
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -31,6 +31,60 @@
 	ptep->pte_low = pte.pte_low;
 }
 
+#define pmd_read_atomic pmd_read_atomic
+/*
+ * pte_offset_map_lock on 32bit PAE kernels was reading the pmd_t with
+ * a "*pmdp" dereference done by gcc. Problem is, in certain places
+ * where pte_offset_map_lock is called, concurrent page faults are
+ * allowed, if the mmap_sem is hold for reading. An example is mincore
+ * vs page faults vs MADV_DONTNEED. On the page fault side
+ * pmd_populate rightfully does a set_64bit, but if we're reading the
+ * pmd_t with a "*pmdp" on the mincore side, a SMP race can happen
+ * because gcc will not read the 64bit of the pmd atomically. To fix
+ * this all places running pmd_offset_map_lock() while holding the
+ * mmap_sem in read mode, shall read the pmdp pointer using this
+ * function to know if the pmd is null nor not, and in turn to know if
+ * they can run pmd_offset_map_lock or pmd_trans_huge or other pmd
+ * operations.
+ *
+ * Without THP if the mmap_sem is hold for reading, the pmd can only
+ * transition from null to not null while pmd_read_atomic runs. So
+ * we can always return atomic pmd values with this function.
+ *
+ * With THP if the mmap_sem is hold for reading, the pmd can become
+ * trans_huge or none or point to a pte (and in turn become "stable")
+ * at any time under pmd_read_atomic. We could read it really
+ * atomically here with a atomic64_read for the THP enabled case (and
+ * it would be a whole lot simpler), but to avoid using cmpxchg8b we
+ * only return an atomic pmdval if the low part of the pmdval is later
+ * found stable (i.e. pointing to a pte). And we're returning a none
+ * pmdval if the low part of the pmd is none. In some cases the high
+ * and low part of the pmdval returned may not be consistent if THP is
+ * enabled (the low part may point to previously mapped hugepage,
+ * while the high part may point to a more recently mapped hugepage),
+ * but pmd_none_or_trans_huge_or_clear_bad() only needs the low part
+ * of the pmd to be read atomically to decide if the pmd is unstable
+ * or not, with the only exception of when the low part of the pmd is
+ * zero in which case we return a none pmd.
+ */
+static inline pmd_t pmd_read_atomic(pmd_t *pmdp)
+{
+	pmdval_t ret;
+	u32 *tmp = (u32 *)pmdp;
+
+	ret = (pmdval_t) (*tmp);
+	if (ret) {
+		/*
+		 * If the low part is null, we must not read the high part
+		 * or we can end up with a partial pmd.
+		 */
+		smp_rmb();
+		ret |= ((pmdval_t)*(tmp + 1)) << 32;
+	}
+
+	return (pmd_t) { ret };
+}
+
 static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
 {
 	set_64bit((unsigned long long *)(ptep), native_pte_val(pte));
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h
index becf47b..6149b47 100644
--- a/arch/x86/include/asm/uv/uv_bau.h
+++ b/arch/x86/include/asm/uv/uv_bau.h
@@ -149,7 +149,6 @@
 /* 4 bits of software ack period */
 #define UV2_ACK_MASK			0x7UL
 #define UV2_ACK_UNITS_SHFT		3
-#define UV2_LEG_SHFT UV2H_LB_BAU_MISC_CONTROL_USE_LEGACY_DESCRIPTOR_FORMATS_SHFT
 #define UV2_EXT_SHFT UV2H_LB_BAU_MISC_CONTROL_ENABLE_EXTENDED_SB_STATUS_SHFT
 
 /*
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 7c439fe..bbdffc2 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -422,12 +422,14 @@
 		return 0;
 	}
 
-	if (intsrc->source_irq == 0 && intsrc->global_irq == 2) {
+	if (intsrc->source_irq == 0) {
 		if (acpi_skip_timer_override) {
-			printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
+			printk(PREFIX "BIOS IRQ0 override ignored.\n");
 			return 0;
 		}
-		if (acpi_fix_pin2_polarity && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) {
+
+		if ((intsrc->global_irq == 2) && acpi_fix_pin2_polarity
+			&& (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) {
 			intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK;
 			printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n");
 		}
@@ -1334,17 +1336,12 @@
 }
 
 /*
- * Force ignoring BIOS IRQ0 pin2 override
+ * Force ignoring BIOS IRQ0 override
  */
 static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
 {
-	/*
-	 * The ati_ixp4x0_rev() early PCI quirk should have set
-	 * the acpi_skip_timer_override flag already:
-	 */
 	if (!acpi_skip_timer_override) {
-		WARN(1, KERN_ERR "ati_ixp4x0 quirk not complete.\n");
-		pr_notice("%s detected: Ignoring BIOS IRQ0 pin2 override\n",
+		pr_notice("%s detected: Ignoring BIOS IRQ0 override\n",
 			d->ident);
 		acpi_skip_timer_override = 1;
 	}
@@ -1438,7 +1435,7 @@
 	 * is enabled.  This input is incorrectly designated the
 	 * ISA IRQ 0 via an interrupt source override even though
 	 * it is wired to the output of the master 8259A and INTIN0
-	 * is not connected at all.  Force ignoring BIOS IRQ0 pin2
+	 * is not connected at all.  Force ignoring BIOS IRQ0
 	 * override in that cases.
 	 */
 	{
@@ -1473,6 +1470,14 @@
 		     DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
 		     },
 	 },
+	{
+	 .callback = dmi_ignore_irq0_timer_override,
+	 .ident = "FUJITSU SIEMENS",
+	 .matches = {
+		     DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+		     DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
+		     },
+	 },
 	{}
 };
 
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 1f84794..73ef56c 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -219,7 +219,7 @@
 			ideal_nops = intel_nops;
 #endif
 		}
-
+		break;
 	default:
 #ifdef CONFIG_X86_64
 		ideal_nops = k8_nops;
diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c
index 0c82091..1ccd453 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-severity.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c
@@ -165,15 +165,19 @@
 };
 
 /*
- * If the EIPV bit is set, it means the saved IP is the
- * instruction which caused the MCE.
+ * If mcgstatus indicated that ip/cs on the stack were
+ * no good, then "m->cs" will be zero and we will have
+ * to assume the worst case (IN_KERNEL) as we actually
+ * have no idea what we were executing when the machine
+ * check hit.
+ * If we do have a good "m->cs" (or a faked one in the
+ * case we were executing in VM86 mode) we can use it to
+ * distinguish an exception taken in user from from one
+ * taken in the kernel.
  */
 static int error_context(struct mce *m)
 {
-	if (m->mcgstatus & MCG_STATUS_EIPV)
-		return (m->ip && (m->cs & 3) == 3) ? IN_USER : IN_KERNEL;
-	/* Unknown, assume kernel */
-	return IN_KERNEL;
+	return ((m->cs & 3) == 3) ? IN_USER : IN_KERNEL;
 }
 
 int mce_severity(struct mce *m, int tolerant, char **msg)
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 11c9166..0d2db0e 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -437,6 +437,14 @@
 		if (m->mcgstatus & (MCG_STATUS_RIPV|MCG_STATUS_EIPV)) {
 			m->ip = regs->ip;
 			m->cs = regs->cs;
+
+			/*
+			 * When in VM86 mode make the cs look like ring 3
+			 * always. This is a lie, but it's better than passing
+			 * the additional vm86 bit around everywhere.
+			 */
+			if (v8086_mode(regs))
+				m->cs |= 3;
 		}
 		/* Use accurate RIP reporting if available. */
 		if (rip_msr)
@@ -1172,6 +1180,7 @@
 {
 	unsigned long pfn;
 	struct mce_info *mi = mce_find_info();
+	int flags = MF_ACTION_REQUIRED;
 
 	if (!mi)
 		mce_panic("Lost physical address for unconsumed uncorrectable error", NULL, NULL);
@@ -1186,8 +1195,9 @@
 	 * doomed. We still need to mark the page as poisoned and alert any
 	 * other users of the page.
 	 */
-	if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0 ||
-			   mi->restartable == 0) {
+	if (!mi->restartable)
+		flags |= MF_MUST_KILL;
+	if (memory_failure(pfn, MCE_VECTOR, flags) < 0) {
 		pr_err("Memory error not recovered");
 		force_sig(SIGBUS, current);
 	}
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 99b5717..2c1d178 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -51,6 +51,7 @@
 	unsigned int		cpu;
 	u32			address;
 	u16			interrupt_enable;
+	bool			interrupt_capable;
 	u16			threshold_limit;
 	struct kobject		kobj;
 	struct list_head	miscj;
@@ -83,6 +84,21 @@
 	u16			old_limit;
 };
 
+static bool lvt_interrupt_supported(unsigned int bank, u32 msr_high_bits)
+{
+	/*
+	 * bank 4 supports APIC LVT interrupts implicitly since forever.
+	 */
+	if (bank == 4)
+		return true;
+
+	/*
+	 * IntP: interrupt present; if this bit is set, the thresholding
+	 * bank can generate APIC LVT interrupts
+	 */
+	return msr_high_bits & BIT(28);
+}
+
 static int lvt_off_valid(struct threshold_block *b, int apic, u32 lo, u32 hi)
 {
 	int msr = (hi & MASK_LVTOFF_HI) >> 20;
@@ -104,8 +120,10 @@
 	return 1;
 };
 
-/* must be called with correct cpu affinity */
-/* Called via smp_call_function_single() */
+/*
+ * Called via smp_call_function_single(), must be called with correct
+ * cpu affinity.
+ */
 static void threshold_restart_bank(void *_tr)
 {
 	struct thresh_restart *tr = _tr;
@@ -128,6 +146,12 @@
 		    (new_count & THRESHOLD_MAX);
 	}
 
+	/* clear IntType */
+	hi &= ~MASK_INT_TYPE_HI;
+
+	if (!tr->b->interrupt_capable)
+		goto done;
+
 	if (tr->set_lvt_off) {
 		if (lvt_off_valid(tr->b, tr->lvt_off, lo, hi)) {
 			/* set new lvt offset */
@@ -136,9 +160,10 @@
 		}
 	}
 
-	tr->b->interrupt_enable ?
-	    (hi = (hi & ~MASK_INT_TYPE_HI) | INT_TYPE_APIC) :
-	    (hi &= ~MASK_INT_TYPE_HI);
+	if (tr->b->interrupt_enable)
+		hi |= INT_TYPE_APIC;
+
+ done:
 
 	hi |= MASK_COUNT_EN_HI;
 	wrmsr(tr->b->address, lo, hi);
@@ -202,14 +227,17 @@
 			if (shared_bank[bank] && c->cpu_core_id)
 				break;
 
-			offset = setup_APIC_mce(offset,
-						(high & MASK_LVTOFF_HI) >> 20);
-
 			memset(&b, 0, sizeof(b));
-			b.cpu		= cpu;
-			b.bank		= bank;
-			b.block		= block;
-			b.address	= address;
+			b.cpu			= cpu;
+			b.bank			= bank;
+			b.block			= block;
+			b.address		= address;
+			b.interrupt_capable	= lvt_interrupt_supported(bank, high);
+
+			if (b.interrupt_capable) {
+				int new = (high & MASK_LVTOFF_HI) >> 20;
+				offset  = setup_APIC_mce(offset, new);
+			}
 
 			mce_threshold_block_init(&b, offset);
 			mce_threshold_vector = amd_threshold_interrupt;
@@ -309,6 +337,9 @@
 	struct thresh_restart tr;
 	unsigned long new;
 
+	if (!b->interrupt_capable)
+		return -EINVAL;
+
 	if (strict_strtoul(buf, 0, &new) < 0)
 		return -EINVAL;
 
@@ -467,6 +498,7 @@
 	b->cpu			= cpu;
 	b->address		= address;
 	b->interrupt_enable	= 0;
+	b->interrupt_capable	= lvt_interrupt_supported(bank, high);
 	b->threshold_limit	= THRESHOLD_MAX;
 
 	INIT_LIST_HEAD(&b->miscj);
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 95e7fe1..9edc786 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -493,6 +493,7 @@
  * 0x023	DE	PERF_CTL[2:0]
  * 0x02D	LS	PERF_CTL[3]
  * 0x02E	LS	PERF_CTL[3,0]
+ * 0x031	LS	PERF_CTL[2:0] (**)
  * 0x043	CU	PERF_CTL[2:0]
  * 0x045	CU	PERF_CTL[2:0]
  * 0x046	CU	PERF_CTL[2:0]
@@ -506,10 +507,12 @@
  * 0x0DD	LS	PERF_CTL[5:0]
  * 0x0DE	LS	PERF_CTL[5:0]
  * 0x0DF	LS	PERF_CTL[5:0]
+ * 0x1C0	EX	PERF_CTL[5:3]
  * 0x1D6	EX	PERF_CTL[5:0]
  * 0x1D8	EX	PERF_CTL[5:0]
  *
- * (*) depending on the umask all FPU counters may be used
+ * (*)  depending on the umask all FPU counters may be used
+ * (**) only one unitmask enabled at a time
  */
 
 static struct event_constraint amd_f15_PMC0  = EVENT_CONSTRAINT(0, 0x01, 0);
@@ -559,6 +562,12 @@
 			return &amd_f15_PMC3;
 		case 0x02E:
 			return &amd_f15_PMC30;
+		case 0x031:
+			if (hweight_long(hwc->config & ARCH_PERFMON_EVENTSEL_UMASK) <= 1)
+				return &amd_f15_PMC20;
+			return &emptyconstraint;
+		case 0x1C0:
+			return &amd_f15_PMC53;
 		default:
 			return &amd_f15_PMC50;
 		}
diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
index addf9e8..ee8e9ab 100644
--- a/arch/x86/kernel/cpu/scattered.c
+++ b/arch/x86/kernel/cpu/scattered.c
@@ -31,7 +31,7 @@
 	const struct cpuid_bit *cb;
 
 	static const struct cpuid_bit __cpuinitconst cpuid_bits[] = {
-		{ X86_FEATURE_DTS,		CR_EAX, 0, 0x00000006, 0 },
+		{ X86_FEATURE_DTHERM,		CR_EAX, 0, 0x00000006, 0 },
 		{ X86_FEATURE_IDA,		CR_EAX, 1, 0x00000006, 0 },
 		{ X86_FEATURE_ARAT,		CR_EAX, 2, 0x00000006, 0 },
 		{ X86_FEATURE_PLN,		CR_EAX, 4, 0x00000006, 0 },
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index c9bda6d..24b852b 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -298,20 +298,31 @@
 			    const char *buf, size_t size)
 {
 	unsigned long val;
-	int cpu = dev->id;
-	int ret = 0;
-	char *end;
+	int cpu;
+	ssize_t ret = 0, tmp_ret;
 
-	val = simple_strtoul(buf, &end, 0);
-	if (end == buf)
+	/* allow reload only from the BSP */
+	if (boot_cpu_data.cpu_index != dev->id)
 		return -EINVAL;
 
-	if (val == 1) {
-		get_online_cpus();
-		if (cpu_online(cpu))
-			ret = reload_for_cpu(cpu);
-		put_online_cpus();
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
+
+	if (val != 1)
+		return size;
+
+	get_online_cpus();
+	for_each_online_cpu(cpu) {
+		tmp_ret = reload_for_cpu(cpu);
+		if (tmp_ret != 0)
+			pr_warn("Error reloading microcode on CPU %d\n", cpu);
+
+		/* save retval of the first encountered reload error */
+		if (!ret)
+			ret = tmp_ret;
 	}
+	put_online_cpus();
 
 	if (!ret)
 		ret = size;
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 47acaf3..32856fa 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -491,14 +491,16 @@
 	 */
 	if (unlikely(is_debug_stack(regs->sp))) {
 		debug_stack_set_zero();
-		__get_cpu_var(update_debug_stack) = 1;
+		this_cpu_write(update_debug_stack, 1);
 	}
 }
 
 static inline void nmi_nesting_postprocess(void)
 {
-	if (unlikely(__get_cpu_var(update_debug_stack)))
+	if (unlikely(this_cpu_read(update_debug_stack))) {
 		debug_stack_reset();
+		this_cpu_write(update_debug_stack, 0);
+	}
 }
 #endif
 
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 685845c..cf11783 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1211,12 +1211,6 @@
 					     0, sizeof(struct user_i387_struct),
 					     datap);
 
-		/* normal 64bit interface to access TLS data.
-		   Works just like arch_prctl, except that the arguments
-		   are reversed. */
-	case PTRACE_ARCH_PRCTL:
-		return do_arch_prctl(child, data, addr);
-
 	default:
 		return compat_ptrace_request(child, request, addr, data);
 	}
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index d840e69..3034ee5 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -471,6 +471,14 @@
 			DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"),
 		},
 	},
+	{	/* Handle problems with rebooting on the Precision M6600. */
+		.callback = set_pci_reboot,
+		.ident = "Dell OptiPlex 990",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Precision M6600"),
+		},
+	},
 	{ }
 };
 
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 7415aa9..56ab749 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -64,6 +64,10 @@
 	int shareable = 0;
 	char *name;
 
+	irq = xen_irq_from_gsi(gsi);
+	if (irq > 0)
+		return irq;
+
 	if (set_pirq)
 		pirq = gsi;
 
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index 3ae0e61..59880af 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -1295,7 +1295,6 @@
 		 */
 		mmr_image |= (1L << SOFTACK_MSHIFT);
 		if (is_uv2_hub()) {
-			mmr_image &= ~(1L << UV2_LEG_SHFT);
 			mmr_image |= (1L << UV2_EXT_SHFT);
 		}
 		write_mmr_misc_control(pnode, mmr_image);
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index b43cfcd..b685296 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -60,6 +60,18 @@
 	"__x86_cpu_dev_(start|end)|"
 	"(__parainstructions|__alt_instructions)(|_end)|"
 	"(__iommu_table|__apicdrivers|__smp_locks)(|_end)|"
+	"__(start|end)_pci_.*|"
+	"__(start|end)_builtin_fw|"
+	"__(start|stop)___ksymtab(|_gpl|_unused|_unused_gpl|_gpl_future)|"
+	"__(start|stop)___kcrctab(|_gpl|_unused|_unused_gpl|_gpl_future)|"
+	"__(start|stop)___param|"
+	"__(start|stop)___modver|"
+	"__(start|stop)___bug_table|"
+	"__tracedata_(start|end)|"
+	"__(start|stop)_notes|"
+	"__end_rodata|"
+	"__initramfs_start|"
+	"(jiffies|jiffies_64)|"
 	"_end)$"
 };
 
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 95dccce..40edfc3 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -207,6 +207,9 @@
 	       xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : "");
 }
 
+#define CPUID_THERM_POWER_LEAF 6
+#define APERFMPERF_PRESENT 0
+
 static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0;
 static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0;
 
@@ -240,6 +243,11 @@
 		*dx = cpuid_leaf5_edx_val;
 		return;
 
+	case CPUID_THERM_POWER_LEAF:
+		/* Disabling APERFMPERF for kernel usage */
+		maskecx = ~(1 << APERFMPERF_PRESENT);
+		break;
+
 	case 0xb:
 		/* Suppress extended topology stuff */
 		maskebx = 0;
@@ -1106,7 +1114,10 @@
 	.wbinvd = native_wbinvd,
 
 	.read_msr = native_read_msr_safe,
+	.rdmsr_regs = native_rdmsr_safe_regs,
 	.write_msr = xen_write_msr_safe,
+	.wrmsr_regs = native_wrmsr_safe_regs,
+
 	.read_tsc = native_read_tsc,
 	.read_pmc = native_read_pmc,
 
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 1b267e7..00a0385 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -686,6 +686,7 @@
 	unsigned long uninitialized_var(address);
 	unsigned level;
 	pte_t *ptep = NULL;
+	int ret = 0;
 
 	pfn = page_to_pfn(page);
 	if (!PageHighMem(page)) {
@@ -721,6 +722,24 @@
 	list_add(&page->lru,  &m2p_overrides[mfn_hash(mfn)]);
 	spin_unlock_irqrestore(&m2p_override_lock, flags);
 
+	/* p2m(m2p(mfn)) == mfn: the mfn is already present somewhere in
+	 * this domain. Set the FOREIGN_FRAME_BIT in the p2m for the other
+	 * pfn so that the following mfn_to_pfn(mfn) calls will return the
+	 * pfn from the m2p_override (the backend pfn) instead.
+	 * We need to do this because the pages shared by the frontend
+	 * (xen-blkfront) can be already locked (lock_page, called by
+	 * do_read_cache_page); when the userspace backend tries to use them
+	 * with direct_IO, mfn_to_pfn returns the pfn of the frontend, so
+	 * do_blockdev_direct_IO is going to try to lock the same pages
+	 * again resulting in a deadlock.
+	 * As a side effect get_user_pages_fast might not be safe on the
+	 * frontend pages while they are being shared with the backend,
+	 * because mfn_to_pfn (that ends up being called by GUPF) will
+	 * return the backend pfn rather than the frontend pfn. */
+	ret = __get_user(pfn, &machine_to_phys_mapping[mfn]);
+	if (ret == 0 && get_phys_to_machine(pfn) == mfn)
+		set_phys_to_machine(pfn, FOREIGN_FRAME(mfn));
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(m2p_add_override);
@@ -732,6 +751,7 @@
 	unsigned long uninitialized_var(address);
 	unsigned level;
 	pte_t *ptep = NULL;
+	int ret = 0;
 
 	pfn = page_to_pfn(page);
 	mfn = get_phys_to_machine(pfn);
@@ -801,6 +821,22 @@
 	} else
 		set_phys_to_machine(pfn, page->index);
 
+	/* p2m(m2p(mfn)) == FOREIGN_FRAME(mfn): the mfn is already present
+	 * somewhere in this domain, even before being added to the
+	 * m2p_override (see comment above in m2p_add_override).
+	 * If there are no other entries in the m2p_override corresponding
+	 * to this mfn, then remove the FOREIGN_FRAME_BIT from the p2m for
+	 * the original pfn (the one shared by the frontend): the backend
+	 * cannot do any IO on this page anymore because it has been
+	 * unshared. Removing the FOREIGN_FRAME_BIT from the p2m entry of
+	 * the original pfn causes mfn_to_pfn(mfn) to return the frontend
+	 * pfn again. */
+	mfn &= ~FOREIGN_FRAME_BIT;
+	ret = __get_user(pfn, &machine_to_phys_mapping[mfn]);
+	if (ret == 0 && get_phys_to_machine(pfn) == FOREIGN_FRAME(mfn) &&
+			m2p_find_override(mfn) == NULL)
+		set_phys_to_machine(pfn, mfn);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(m2p_remove_override);
diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched
index 4142d91..5fd98ea 100644
--- a/block/Kconfig.iosched
+++ b/block/Kconfig.iosched
@@ -32,6 +32,17 @@
 	  a new point in the service tree and doing a batch of IO from there
 	  in case of expiry.
 
+config IOSCHED_ROW
+	tristate "ROW I/O scheduler"
+	default y
+	---help---
+	  The ROW I/O scheduler gives priority to READ requests over the
+	  WRITE requests when dispatching, without starving WRITE requests.
+	  Requests are kept in priority queues. Dispatching is done in a RR
+	  manner when the dispatch quantum for each queue is calculated
+	  according to queue priority.
+	  Most suitable for mobile devices.
+
 config IOSCHED_CFQ
 	tristate "CFQ I/O scheduler"
 	# If BLK_CGROUP is a module, CFQ has to be built as module.
@@ -64,6 +75,16 @@
 	config DEFAULT_DEADLINE
 		bool "Deadline" if IOSCHED_DEADLINE=y
 
+	config DEFAULT_ROW
+		bool "ROW" if IOSCHED_ROW=y
+		help
+		  The ROW I/O scheduler gives priority to READ requests
+		  over the WRITE requests when dispatching, without starving
+		  WRITE requests. Requests are kept in priority queues.
+		  Dispatching is done in a RR manner when the dispatch quantum
+		  for each queue is defined according to queue priority.
+		  Most suitable for mobile devices.
+
 	config DEFAULT_CFQ
 		bool "CFQ" if IOSCHED_CFQ=y
 
@@ -75,6 +96,7 @@
 config DEFAULT_IOSCHED
 	string
 	default "deadline" if DEFAULT_DEADLINE
+	default "row" if DEFAULT_ROW
 	default "cfq" if DEFAULT_CFQ
 	default "noop" if DEFAULT_NOOP
 
diff --git a/block/Makefile b/block/Makefile
index 436b220..b5e6637 100644
--- a/block/Makefile
+++ b/block/Makefile
@@ -14,6 +14,7 @@
 obj-$(CONFIG_BLK_DEV_THROTTLING)	+= blk-throttle.o
 obj-$(CONFIG_IOSCHED_NOOP)	+= noop-iosched.o
 obj-$(CONFIG_IOSCHED_DEADLINE)	+= deadline-iosched.o
+obj-$(CONFIG_IOSCHED_ROW)	+= row-iosched.o
 obj-$(CONFIG_IOSCHED_CFQ)	+= cfq-iosched.o
 obj-$(CONFIG_IOSCHED_TEST)	+= test-iosched.o
 
diff --git a/block/blk-core.c b/block/blk-core.c
index fcb2a1b..f51b05a 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -298,13 +298,26 @@
  * Description:
  *    See @blk_run_queue. This variant must be called with the queue lock
  *    held and interrupts disabled.
+ *    Device driver will be notified of an urgent request
+ *    pending under the following conditions:
+ *    1. The driver and the current scheduler support urgent reques handling
+ *    2. There is an urgent request pending in the scheduler
+ *    3. There isn't already an urgent request in flight, meaning previously
+ *       notified urgent request completed (!q->notified_urgent)
  */
 void __blk_run_queue(struct request_queue *q)
 {
 	if (unlikely(blk_queue_stopped(q)))
 		return;
 
-	q->request_fn(q);
+	if (!q->notified_urgent &&
+		q->elevator->type->ops.elevator_is_urgent_fn &&
+		q->urgent_request_fn &&
+		q->elevator->type->ops.elevator_is_urgent_fn(q)) {
+		q->notified_urgent = true;
+		q->urgent_request_fn(q);
+	} else
+		q->request_fn(q);
 }
 EXPORT_SYMBOL(__blk_run_queue);
 
@@ -1071,6 +1084,50 @@
 }
 EXPORT_SYMBOL(blk_requeue_request);
 
+/**
+ * blk_reinsert_request() - Insert a request back to the scheduler
+ * @q:		request queue
+ * @rq:		request to be inserted
+ *
+ * This function inserts the request back to the scheduler as if
+ * it was never dispatched.
+ *
+ * Return: 0 on success, error code on fail
+ */
+int blk_reinsert_request(struct request_queue *q, struct request *rq)
+{
+	if (unlikely(!rq) || unlikely(!q))
+		return -EIO;
+
+	blk_delete_timer(rq);
+	blk_clear_rq_complete(rq);
+	trace_block_rq_requeue(q, rq);
+
+	if (blk_rq_tagged(rq))
+		blk_queue_end_tag(q, rq);
+
+	BUG_ON(blk_queued_rq(rq));
+
+	return elv_reinsert_request(q, rq);
+}
+EXPORT_SYMBOL(blk_reinsert_request);
+
+/**
+ * blk_reinsert_req_sup() - check whether the scheduler supports
+ *          reinsertion of requests
+ * @q:		request queue
+ *
+ * Returns true if the current scheduler supports reinserting
+ * request. False otherwise
+ */
+bool blk_reinsert_req_sup(struct request_queue *q)
+{
+	if (unlikely(!q))
+		return false;
+	return q->elevator->type->ops.elevator_reinsert_req_fn ? true : false;
+}
+EXPORT_SYMBOL(blk_reinsert_req_sup);
+
 static void add_acct_request(struct request_queue *q, struct request *rq,
 			     int where)
 {
@@ -2074,8 +2131,17 @@
 	struct request *rq;
 
 	rq = blk_peek_request(q);
-	if (rq)
+	if (rq) {
+		/*
+		 * Assumption: the next request fetched from scheduler after we
+		 * notified "urgent request pending" - will be the urgent one
+		 */
+		if (q->notified_urgent && !q->dispatched_urgent) {
+			q->dispatched_urgent = true;
+			(void)blk_mark_rq_urgent(rq);
+		}
 		blk_start_request(rq);
+	}
 	return rq;
 }
 EXPORT_SYMBOL(blk_fetch_request);
diff --git a/block/blk-settings.c b/block/blk-settings.c
index d3234fc..579328c 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -100,6 +100,18 @@
 EXPORT_SYMBOL_GPL(blk_queue_lld_busy);
 
 /**
+ * blk_urgent_request() - Set an urgent_request handler function for queue
+ * @q:		queue
+ * @fn:		handler for urgent requests
+ *
+ */
+void blk_urgent_request(struct request_queue *q, request_fn_proc *fn)
+{
+	q->urgent_request_fn = fn;
+}
+EXPORT_SYMBOL(blk_urgent_request);
+
+/**
  * blk_set_default_limits - reset limits to default values
  * @lim:  the queue_limits structure to reset
  *
diff --git a/block/blk.h b/block/blk.h
index d45be87..a52209f 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -39,6 +39,7 @@
  */
 enum rq_atomic_flags {
 	REQ_ATOM_COMPLETE = 0,
+	REQ_ATOM_URGENT = 1,
 };
 
 /*
@@ -55,6 +56,16 @@
 	clear_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags);
 }
 
+static inline int blk_mark_rq_urgent(struct request *rq)
+{
+	return test_and_set_bit(REQ_ATOM_URGENT, &rq->atomic_flags);
+}
+
+static inline void blk_clear_rq_urgent(struct request *rq)
+{
+	clear_bit(REQ_ATOM_URGENT, &rq->atomic_flags);
+}
+
 /*
  * Internal elevator interface
  */
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 3c38536..32629e2 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2305,6 +2305,9 @@
 {
 	struct cfq_group *cfqg = cfq_get_next_cfqg(cfqd);
 
+	if (!cfqg)
+		return;
+
 	cfqd->serving_group = cfqg;
 
 	/* Restore the workload type data */
diff --git a/block/elevator.c b/block/elevator.c
index 74fd51b..efec457 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -585,6 +585,41 @@
 	__elv_add_request(q, rq, ELEVATOR_INSERT_REQUEUE);
 }
 
+/**
+ * elv_reinsert_request() - Insert a request back to the scheduler
+ * @q:		request queue where request should be inserted
+ * @rq:		request to be inserted
+ *
+ * This function returns the request back to the scheduler to be
+ * inserted as if it was never dispatched
+ *
+ * Return: 0 on success, error code on failure
+ */
+int elv_reinsert_request(struct request_queue *q, struct request *rq)
+{
+	int res;
+
+	if (!q->elevator->type->ops.elevator_reinsert_req_fn)
+		return -EPERM;
+
+	res = q->elevator->type->ops.elevator_reinsert_req_fn(q, rq);
+	if (!res) {
+		/*
+		 * it already went through dequeue, we need to decrement the
+		 * in_flight count again
+		 */
+		if (blk_account_rq(rq)) {
+			q->in_flight[rq_is_sync(rq)]--;
+			if (rq->cmd_flags & REQ_SORTED)
+				elv_deactivate_rq(q, rq);
+		}
+		rq->cmd_flags &= ~REQ_STARTED;
+		q->nr_sorted++;
+	}
+
+	return res;
+}
+
 void elv_drain_elevator(struct request_queue *q)
 {
 	static int printed;
@@ -779,6 +814,11 @@
 {
 	struct elevator_queue *e = q->elevator;
 
+	if (test_bit(REQ_ATOM_URGENT, &rq->atomic_flags)) {
+		q->notified_urgent = false;
+		q->dispatched_urgent = false;
+		blk_clear_rq_urgent(rq);
+	}
 	/*
 	 * request is released from the driver, io must be done
 	 */
diff --git a/block/row-iosched.c b/block/row-iosched.c
new file mode 100644
index 0000000..e71f6af
--- /dev/null
+++ b/block/row-iosched.c
@@ -0,0 +1,1088 @@
+/*
+ * ROW (Read Over Write) I/O scheduler.
+ *
+ * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/* See Documentation/block/row-iosched.txt */
+
+#include <linux/kernel.h>
+#include <linux/fs.h>
+#include <linux/blkdev.h>
+#include <linux/elevator.h>
+#include <linux/bio.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/compiler.h>
+#include <linux/blktrace_api.h>
+#include <linux/hrtimer.h>
+
+/*
+ * enum row_queue_prio - Priorities of the ROW queues
+ *
+ * This enum defines the priorities (and the number of queues)
+ * the requests will be distributed to. The higher priority -
+ * the bigger is the "bus time" (or the dispatch quantum) given
+ * to that queue.
+ * ROWQ_PRIO_HIGH_READ - is the higher priority queue.
+ *
+ */
+enum row_queue_prio {
+	ROWQ_PRIO_HIGH_READ = 0,
+	ROWQ_PRIO_HIGH_SWRITE,
+	ROWQ_PRIO_REG_READ,
+	ROWQ_PRIO_REG_SWRITE,
+	ROWQ_PRIO_REG_WRITE,
+	ROWQ_PRIO_LOW_READ,
+	ROWQ_PRIO_LOW_SWRITE,
+	ROWQ_MAX_PRIO,
+};
+
+/*
+ * The following indexes define the distribution of ROW queues according to
+ * priorities. Each index defines the first queue in that priority group.
+ */
+#define ROWQ_HIGH_PRIO_IDX	ROWQ_PRIO_HIGH_READ
+#define ROWQ_REG_PRIO_IDX	ROWQ_PRIO_REG_READ
+#define ROWQ_LOW_PRIO_IDX	ROWQ_PRIO_LOW_READ
+
+/**
+ * struct row_queue_params - ROW queue parameters
+ * @idling_enabled: Flag indicating whether idling is enable on
+ *			the queue
+ * @quantum: Number of requests to be dispatched from this queue
+ *			in a dispatch cycle
+ * @is_urgent: Flags indicating whether the queue can notify on
+ *			urgent requests
+ *
+ */
+struct row_queue_params {
+	bool idling_enabled;
+	int quantum;
+	bool is_urgent;
+};
+
+/*
+ * This array holds the default values of the different configurables
+ * for each ROW queue. Each row of the array holds the following values:
+ * {idling_enabled, quantum, is_urgent}
+ * Each row corresponds to a queue with the same index (according to
+ * enum row_queue_prio)
+ * Note: The quantums are valid inside their priority type. For example:
+ *       For every 10 high priority read requests, 1 high priority sync
+ *       write will be dispatched.
+ *       For every 100 regular read requests 1 regular write request will
+ *       be dispatched.
+ */
+static const struct row_queue_params row_queues_def[] = {
+/* idling_enabled, quantum, is_urgent */
+	{true, 10, true},	/* ROWQ_PRIO_HIGH_READ */
+	{false, 1, false},	/* ROWQ_PRIO_HIGH_SWRITE */
+	{true, 100, true},	/* ROWQ_PRIO_REG_READ */
+	{false, 1, false},	/* ROWQ_PRIO_REG_SWRITE */
+	{false, 1, false},	/* ROWQ_PRIO_REG_WRITE */
+	{false, 1, false},	/* ROWQ_PRIO_LOW_READ */
+	{false, 1, false}	/* ROWQ_PRIO_LOW_SWRITE */
+};
+
+/* Default values for idling on read queues (in msec) */
+#define ROW_IDLE_TIME_MSEC 5
+#define ROW_READ_FREQ_MSEC 20
+
+/**
+ * struct rowq_idling_data -  parameters for idling on the queue
+ * @last_insert_time:	time the last request was inserted
+ *			to the queue
+ * @begin_idling:	flag indicating wether we should idle
+ *
+ */
+struct rowq_idling_data {
+	ktime_t			last_insert_time;
+	bool			begin_idling;
+};
+
+/**
+ * struct row_queue - requests grouping structure
+ * @rdata:		parent row_data structure
+ * @fifo:		fifo of requests
+ * @prio:		queue priority (enum row_queue_prio)
+ * @nr_dispatched:	number of requests already dispatched in
+ *			the current dispatch cycle
+ * @nr_req:		number of requests in queue
+ * @dispatch quantum:	number of requests this queue may
+ *			dispatch in a dispatch cycle
+ * @idle_data:		data for idling on queues
+ *
+ */
+struct row_queue {
+	struct row_data		*rdata;
+	struct list_head	fifo;
+	enum row_queue_prio	prio;
+
+	unsigned int		nr_dispatched;
+
+	unsigned int		nr_req;
+	int			disp_quantum;
+
+	/* used only for READ queues */
+	struct rowq_idling_data	idle_data;
+};
+
+/**
+ * struct idling_data - data for idling on empty rqueue
+ * @idle_time_ms:		idling duration (msec)
+ * @freq_ms:		min time between two requests that
+ *			triger idling (msec)
+ * @hr_timer:	idling timer
+ * @idle_work:	the work to be scheduled when idling timer expires
+ * @idling_queue_idx:	index of the queues we're idling on
+ *
+ */
+struct idling_data {
+	s64				idle_time_ms;
+	s64				freq_ms;
+
+	struct hrtimer			hr_timer;
+	struct work_struct		idle_work;
+	enum row_queue_prio		idling_queue_idx;
+};
+
+/**
+ * struct starvation_data - data for starvation management
+ * @starvation_limit:	number of times this priority class
+ *			can tolerate being starved
+ * @starvation_counter:	number of requests from higher
+ *			priority classes that were dispatched while this
+ *			priority request were pending
+ *
+ */
+struct starvation_data {
+	int				starvation_limit;
+	int				starvation_counter;
+};
+
+/**
+ * struct row_queue - Per block device rqueue structure
+ * @dispatch_queue:	dispatch rqueue
+ * @row_queues:		array of priority request queues
+ * @rd_idle_data:		data for idling after READ request
+ * @nr_reqs: nr_reqs[0] holds the number of all READ requests in
+ *			scheduler, nr_reqs[1] holds the number of all WRITE
+ *			requests in scheduler
+ * @urgent_in_flight: flag indicating that there is an urgent
+ *			request that was dispatched to driver and is yet to
+ *			complete.
+ * @pending_urgent_rq:	pointer to the pending urgent request
+ * @last_served_ioprio_class: I/O priority class that was last dispatched from
+ * @reg_prio_starvation: starvation data for REGULAR priority queues
+ * @low_prio_starvation: starvation data for LOW priority queues
+ * @cycle_flags:	used for marking unserved queueus
+ *
+ */
+struct row_data {
+	struct request_queue		*dispatch_queue;
+
+	struct row_queue row_queues[ROWQ_MAX_PRIO];
+
+	struct idling_data		rd_idle_data;
+	unsigned int			nr_reqs[2];
+	bool				urgent_in_flight;
+	struct request			*pending_urgent_rq;
+	int				last_served_ioprio_class;
+
+#define	ROW_REG_STARVATION_TOLLERANCE	5000
+	struct starvation_data		reg_prio_starvation;
+#define	ROW_LOW_STARVATION_TOLLERANCE	10000
+	struct starvation_data		low_prio_starvation;
+
+	unsigned int			cycle_flags;
+};
+
+#define RQ_ROWQ(rq) ((struct row_queue *) ((rq)->elv.priv[0]))
+
+#define row_log(q, fmt, args...)   \
+	blk_add_trace_msg(q, "%s():" fmt , __func__, ##args)
+#define row_log_rowq(rdata, rowq_id, fmt, args...)		\
+	blk_add_trace_msg(rdata->dispatch_queue, "rowq%d " fmt, \
+		rowq_id, ##args)
+
+static inline void row_mark_rowq_unserved(struct row_data *rd,
+					 enum row_queue_prio qnum)
+{
+	rd->cycle_flags |= (1 << qnum);
+}
+
+static inline void row_clear_rowq_unserved(struct row_data *rd,
+					  enum row_queue_prio qnum)
+{
+	rd->cycle_flags &= ~(1 << qnum);
+}
+
+static inline int row_rowq_unserved(struct row_data *rd,
+				   enum row_queue_prio qnum)
+{
+	return rd->cycle_flags & (1 << qnum);
+}
+
+static inline void __maybe_unused row_dump_queues_stat(struct row_data *rd)
+{
+	int i;
+
+	row_log(rd->dispatch_queue, " Queues status:");
+	for (i = 0; i < ROWQ_MAX_PRIO; i++)
+		row_log(rd->dispatch_queue,
+			"queue%d: dispatched= %d, nr_req=%d", i,
+			rd->row_queues[i].nr_dispatched,
+			rd->row_queues[i].nr_req);
+}
+
+/******************** Static helper functions ***********************/
+static void kick_queue(struct work_struct *work)
+{
+	struct idling_data *read_data =
+		container_of(work, struct idling_data, idle_work);
+	struct row_data *rd =
+		container_of(read_data, struct row_data, rd_idle_data);
+
+	blk_run_queue(rd->dispatch_queue);
+}
+
+
+static enum hrtimer_restart row_idle_hrtimer_fn(struct hrtimer *hr_timer)
+{
+	struct idling_data *read_data =
+		container_of(hr_timer, struct idling_data, hr_timer);
+	struct row_data *rd =
+		container_of(read_data, struct row_data, rd_idle_data);
+
+	row_log_rowq(rd, rd->rd_idle_data.idling_queue_idx,
+			 "Performing delayed work");
+	/* Mark idling process as done */
+	rd->row_queues[rd->rd_idle_data.idling_queue_idx].
+			idle_data.begin_idling = false;
+	rd->rd_idle_data.idling_queue_idx = ROWQ_MAX_PRIO;
+
+	if (!rd->nr_reqs[READ] && !rd->nr_reqs[WRITE])
+		row_log(rd->dispatch_queue, "No requests in scheduler");
+	else
+		kblockd_schedule_work(rd->dispatch_queue,
+			&read_data->idle_work);
+	return HRTIMER_NORESTART;
+}
+
+/*
+ * row_regular_req_pending() - Check if there are REGULAR priority requests
+ *				 Pending in scheduler
+ * @rd:		pointer to struct row_data
+ *
+ * Returns True if there are REGULAR priority requests in scheduler queues.
+ *		False, otherwise.
+ */
+static inline bool row_regular_req_pending(struct row_data *rd)
+{
+	int i;
+
+	for (i = ROWQ_REG_PRIO_IDX; i < ROWQ_LOW_PRIO_IDX; i++)
+		if (!list_empty(&rd->row_queues[i].fifo))
+			return true;
+	return false;
+}
+
+/*
+ * row_low_req_pending() - Check if there are LOW priority requests
+ *				 Pending in scheduler
+ * @rd:		pointer to struct row_data
+ *
+ * Returns True if there are LOW priority requests in scheduler queues.
+ *		False, otherwise.
+ */
+static inline bool row_low_req_pending(struct row_data *rd)
+{
+	int i;
+
+	for (i = ROWQ_LOW_PRIO_IDX; i < ROWQ_MAX_PRIO; i++)
+		if (!list_empty(&rd->row_queues[i].fifo))
+			return true;
+	return false;
+}
+
+/******************* Elevator callback functions *********************/
+
+/*
+ * row_add_request() - Add request to the scheduler
+ * @q:	requests queue
+ * @rq:	request to add
+ *
+ */
+static void row_add_request(struct request_queue *q,
+			    struct request *rq)
+{
+	struct row_data *rd = (struct row_data *)q->elevator->elevator_data;
+	struct row_queue *rqueue = RQ_ROWQ(rq);
+	s64 diff_ms;
+	bool queue_was_empty = list_empty(&rqueue->fifo);
+
+	list_add_tail(&rq->queuelist, &rqueue->fifo);
+	rd->nr_reqs[rq_data_dir(rq)]++;
+	rqueue->nr_req++;
+	rq_set_fifo_time(rq, jiffies); /* for statistics*/
+
+	if (rq->cmd_flags & REQ_URGENT) {
+		WARN_ON(1);
+		blk_dump_rq_flags(rq, "");
+		rq->cmd_flags &= ~REQ_URGENT;
+	}
+
+	if (row_queues_def[rqueue->prio].idling_enabled) {
+		if (rd->rd_idle_data.idling_queue_idx == rqueue->prio &&
+		    hrtimer_active(&rd->rd_idle_data.hr_timer)) {
+			(void)hrtimer_cancel(&rd->rd_idle_data.hr_timer);
+			row_log_rowq(rd, rqueue->prio,
+				"Canceled delayed work on %d",
+				rd->rd_idle_data.idling_queue_idx);
+			rd->rd_idle_data.idling_queue_idx = ROWQ_MAX_PRIO;
+		}
+		diff_ms = ktime_to_ms(ktime_sub(ktime_get(),
+				rqueue->idle_data.last_insert_time));
+		if (unlikely(diff_ms < 0)) {
+			pr_err("%s(): time delta error: diff_ms < 0",
+				__func__);
+			rqueue->idle_data.begin_idling = false;
+			return;
+		}
+		if (diff_ms < rd->rd_idle_data.freq_ms) {
+			rqueue->idle_data.begin_idling = true;
+			row_log_rowq(rd, rqueue->prio, "Enable idling");
+		} else {
+			rqueue->idle_data.begin_idling = false;
+			row_log_rowq(rd, rqueue->prio, "Disable idling (%ldms)",
+				(long)diff_ms);
+		}
+
+		rqueue->idle_data.last_insert_time = ktime_get();
+	}
+	if (row_queues_def[rqueue->prio].is_urgent &&
+	    !rd->pending_urgent_rq && !rd->urgent_in_flight) {
+		/* Handle High Priority queues */
+		if (rqueue->prio < ROWQ_REG_PRIO_IDX &&
+		    rd->last_served_ioprio_class != IOPRIO_CLASS_RT &&
+		    queue_was_empty) {
+			row_log_rowq(rd, rqueue->prio,
+				"added (high prio) urgent request");
+			rq->cmd_flags |= REQ_URGENT;
+			rd->pending_urgent_rq = rq;
+		} else  if (row_rowq_unserved(rd, rqueue->prio)) {
+			/* Handle Regular priotity queues */
+			row_log_rowq(rd, rqueue->prio,
+				"added urgent request (total on queue=%d)",
+				rqueue->nr_req);
+			rq->cmd_flags |= REQ_URGENT;
+			WARN_ON(rqueue->nr_req > 1);
+			rd->pending_urgent_rq = rq;
+		}
+	} else
+		row_log_rowq(rd, rqueue->prio,
+			"added request (total on queue=%d)", rqueue->nr_req);
+}
+
+/**
+ * row_reinsert_req() - Reinsert request back to the scheduler
+ * @q:	requests queue
+ * @rq:	request to add
+ *
+ * Reinsert the given request back to the queue it was
+ * dispatched from as if it was never dispatched.
+ *
+ * Returns 0 on success, error code otherwise
+ */
+static int row_reinsert_req(struct request_queue *q,
+			    struct request *rq)
+{
+	struct row_data    *rd = q->elevator->elevator_data;
+	struct row_queue   *rqueue = RQ_ROWQ(rq);
+
+	if (!rqueue || rqueue->prio >= ROWQ_MAX_PRIO)
+		return -EIO;
+
+	list_add(&rq->queuelist, &rqueue->fifo);
+	rd->nr_reqs[rq_data_dir(rq)]++;
+	rqueue->nr_req++;
+
+	row_log_rowq(rd, rqueue->prio,
+		"%s request reinserted (total on queue=%d)",
+		(rq_data_dir(rq) == READ ? "READ" : "write"), rqueue->nr_req);
+
+	if (rq->cmd_flags & REQ_URGENT) {
+		/*
+		 * It's not compliant with the design to re-insert
+		 * urgent requests. We want to be able to track this
+		 * down.
+		 */
+		WARN_ON(1);
+		if (!rd->urgent_in_flight) {
+			pr_err("%s(): no urgent in flight", __func__);
+		} else {
+			rd->urgent_in_flight = false;
+			pr_err("%s(): reinserting URGENT %s req",
+				__func__,
+				(rq_data_dir(rq) == READ ? "READ" : "WRITE"));
+			if (rd->pending_urgent_rq) {
+				pr_err("%s(): urgent rq is pending",
+					__func__);
+				rd->pending_urgent_rq->cmd_flags &= ~REQ_URGENT;
+			}
+			rd->pending_urgent_rq = rq;
+		}
+	}
+	return 0;
+}
+
+static void row_completed_req(struct request_queue *q, struct request *rq)
+{
+	struct row_data *rd = q->elevator->elevator_data;
+
+	 if (rq->cmd_flags & REQ_URGENT) {
+		if (!rd->urgent_in_flight) {
+			WARN_ON(1);
+			pr_err("%s(): URGENT req but urgent_in_flight = F",
+				__func__);
+		}
+		rd->urgent_in_flight = false;
+		rq->cmd_flags &= ~REQ_URGENT;
+	}
+	row_log(q, "completed %s %s req.",
+		(rq->cmd_flags & REQ_URGENT ? "URGENT" : "regular"),
+		(rq_data_dir(rq) == READ ? "READ" : "WRITE"));
+}
+
+/**
+ * row_urgent_pending() - Return TRUE if there is an urgent
+ *			  request on scheduler
+ * @q:	requests queue
+ */
+static bool row_urgent_pending(struct request_queue *q)
+{
+	struct row_data *rd = q->elevator->elevator_data;
+
+	if (rd->urgent_in_flight) {
+		row_log(rd->dispatch_queue, "%d urgent requests in flight",
+			rd->urgent_in_flight);
+		return false;
+	}
+
+	if (rd->pending_urgent_rq) {
+		row_log(rd->dispatch_queue, "Urgent request pending");
+		return true;
+	}
+
+	row_log(rd->dispatch_queue, "no urgent request pending/in flight");
+	return false;
+}
+
+/**
+ * row_remove_request() -  Remove given request from scheduler
+ * @q:	requests queue
+ * @rq:	request to remove
+ *
+ */
+static void row_remove_request(struct row_data *rd,
+			       struct request *rq)
+{
+	struct row_queue *rqueue = RQ_ROWQ(rq);
+
+	list_del_init(&(rq)->queuelist);
+	if (rd->pending_urgent_rq == rq)
+		rd->pending_urgent_rq = NULL;
+	else
+		BUG_ON(rq->cmd_flags & REQ_URGENT);
+	rqueue->nr_req--;
+	rd->nr_reqs[rq_data_dir(rq)]--;
+}
+
+/*
+ * row_dispatch_insert() - move request to dispatch queue
+ * @rd:		pointer to struct row_data
+ * @rq:		the request to dispatch
+ *
+ * This function moves the given request to the dispatch queue
+ *
+ */
+static void row_dispatch_insert(struct row_data *rd, struct request *rq)
+{
+	struct row_queue *rqueue = RQ_ROWQ(rq);
+
+	row_remove_request(rd, rq);
+	elv_dispatch_sort(rd->dispatch_queue, rq);
+	if (rq->cmd_flags & REQ_URGENT) {
+		WARN_ON(rd->urgent_in_flight);
+		rd->urgent_in_flight = true;
+	}
+	rqueue->nr_dispatched++;
+	row_clear_rowq_unserved(rd, rqueue->prio);
+	row_log_rowq(rd, rqueue->prio,
+		" Dispatched request %p nr_disp = %d", rq,
+		rqueue->nr_dispatched);
+	if (rqueue->prio < ROWQ_REG_PRIO_IDX) {
+		rd->last_served_ioprio_class = IOPRIO_CLASS_RT;
+		if (row_regular_req_pending(rd))
+			rd->reg_prio_starvation.starvation_counter++;
+		if (row_low_req_pending(rd))
+			rd->low_prio_starvation.starvation_counter++;
+	} else if (rqueue->prio < ROWQ_LOW_PRIO_IDX) {
+		rd->last_served_ioprio_class = IOPRIO_CLASS_BE;
+		rd->reg_prio_starvation.starvation_counter = 0;
+		if (row_low_req_pending(rd))
+			rd->low_prio_starvation.starvation_counter++;
+	} else {
+		rd->last_served_ioprio_class = IOPRIO_CLASS_IDLE;
+		rd->low_prio_starvation.starvation_counter = 0;
+	}
+}
+
+/*
+ * row_get_ioprio_class_to_serve() - Return the next I/O priority
+ *				      class to dispatch requests from
+ * @rd:	pointer to struct row_data
+ * @force:	flag indicating if forced dispatch
+ *
+ * This function returns the next I/O priority class to serve
+ * {IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE}.
+ * If there are no more requests in scheduler or if we're idling on some queue
+ * IOPRIO_CLASS_NONE will be returned.
+ * If idling is scheduled on a lower priority queue than the one that needs
+ * to be served, it will be canceled.
+ *
+ */
+static int row_get_ioprio_class_to_serve(struct row_data *rd, int force)
+{
+	int i;
+	int ret = IOPRIO_CLASS_NONE;
+
+	if (!rd->nr_reqs[READ] && !rd->nr_reqs[WRITE]) {
+		row_log(rd->dispatch_queue, "No more requests in scheduler");
+		goto check_idling;
+	}
+
+	/* First, go over the high priority queues */
+	for (i = 0; i < ROWQ_REG_PRIO_IDX; i++) {
+		if (!list_empty(&rd->row_queues[i].fifo)) {
+			if (hrtimer_active(&rd->rd_idle_data.hr_timer)) {
+				(void)hrtimer_cancel(
+					&rd->rd_idle_data.hr_timer);
+				row_log_rowq(rd,
+					rd->rd_idle_data.idling_queue_idx,
+					"Canceling delayed work on %d. RT pending",
+					rd->rd_idle_data.idling_queue_idx);
+				rd->rd_idle_data.idling_queue_idx =
+					ROWQ_MAX_PRIO;
+			}
+
+			if (row_regular_req_pending(rd) &&
+			    (rd->reg_prio_starvation.starvation_counter >=
+			     rd->reg_prio_starvation.starvation_limit))
+				ret = IOPRIO_CLASS_BE;
+			else if (row_low_req_pending(rd) &&
+			    (rd->low_prio_starvation.starvation_counter >=
+			     rd->low_prio_starvation.starvation_limit))
+				ret = IOPRIO_CLASS_IDLE;
+			else
+				ret = IOPRIO_CLASS_RT;
+
+			goto done;
+		}
+	}
+
+	/*
+	 * At the moment idling is implemented only for READ queues.
+	 * If enabled on WRITE, this needs updating
+	 */
+	if (hrtimer_active(&rd->rd_idle_data.hr_timer)) {
+		row_log(rd->dispatch_queue, "Delayed work pending. Exiting");
+		goto done;
+	}
+check_idling:
+	/* Check for (high priority) idling and enable if needed */
+	for (i = 0; i < ROWQ_REG_PRIO_IDX && !force; i++) {
+		if (rd->row_queues[i].idle_data.begin_idling &&
+		    row_queues_def[i].idling_enabled)
+			goto initiate_idling;
+	}
+
+	/* Regular priority queues */
+	for (i = ROWQ_REG_PRIO_IDX; i < ROWQ_LOW_PRIO_IDX; i++) {
+		if (list_empty(&rd->row_queues[i].fifo)) {
+			/* We can idle only if this is not a forced dispatch */
+			if (rd->row_queues[i].idle_data.begin_idling &&
+			    !force && row_queues_def[i].idling_enabled)
+				goto initiate_idling;
+		} else {
+			if (row_low_req_pending(rd) &&
+			    (rd->low_prio_starvation.starvation_counter >=
+			     rd->low_prio_starvation.starvation_limit))
+				ret = IOPRIO_CLASS_IDLE;
+			else
+				ret = IOPRIO_CLASS_BE;
+			goto done;
+		}
+	}
+
+	if (rd->nr_reqs[READ] || rd->nr_reqs[WRITE])
+		ret = IOPRIO_CLASS_IDLE;
+	goto done;
+
+initiate_idling:
+	hrtimer_start(&rd->rd_idle_data.hr_timer,
+		ktime_set(0, rd->rd_idle_data.idle_time_ms * NSEC_PER_MSEC),
+		HRTIMER_MODE_REL);
+
+	rd->rd_idle_data.idling_queue_idx = i;
+	row_log_rowq(rd, i, "Scheduled delayed work on %d. exiting", i);
+
+done:
+	return ret;
+}
+
+static void row_restart_cycle(struct row_data *rd,
+				int start_idx, int end_idx)
+{
+	int i;
+
+	row_dump_queues_stat(rd);
+	for (i = start_idx; i < end_idx; i++) {
+		if (rd->row_queues[i].nr_dispatched <
+		    rd->row_queues[i].disp_quantum)
+			row_mark_rowq_unserved(rd, i);
+		rd->row_queues[i].nr_dispatched = 0;
+	}
+	row_log(rd->dispatch_queue, "Restarting cycle for class @ %d-%d",
+		start_idx, end_idx);
+}
+
+/*
+ * row_get_next_queue() - selects the next queue to dispatch from
+ * @q:		requests queue
+ * @rd:		pointer to struct row_data
+ * @start_idx/end_idx: indexes in the row_queues array to select a queue
+ *                 from.
+ *
+ * Return index of the queues to dispatch from. Error code if fails.
+ *
+ */
+static int row_get_next_queue(struct request_queue *q, struct row_data *rd,
+				int start_idx, int end_idx)
+{
+	int i = start_idx;
+	bool restart = true;
+	int ret = -EIO;
+
+	do {
+		if (list_empty(&rd->row_queues[i].fifo) ||
+		    rd->row_queues[i].nr_dispatched >=
+		    rd->row_queues[i].disp_quantum) {
+			i++;
+			if (i == end_idx && restart) {
+				/* Restart cycle for this priority class */
+				row_restart_cycle(rd, start_idx, end_idx);
+				i = start_idx;
+				restart = false;
+			}
+		} else {
+			ret = i;
+			break;
+		}
+	} while (i < end_idx);
+
+	return ret;
+}
+
+/*
+ * row_dispatch_requests() - selects the next request to dispatch
+ * @q:		requests queue
+ * @force:		flag indicating if forced dispatch
+ *
+ * Return 0 if no requests were moved to the dispatch queue.
+ *	  1 otherwise
+ *
+ */
+static int row_dispatch_requests(struct request_queue *q, int force)
+{
+	struct row_data *rd = (struct row_data *)q->elevator->elevator_data;
+	int ret = 0, currq, ioprio_class_to_serve, start_idx, end_idx;
+
+	if (force && hrtimer_active(&rd->rd_idle_data.hr_timer)) {
+		(void)hrtimer_cancel(&rd->rd_idle_data.hr_timer);
+		row_log_rowq(rd, rd->rd_idle_data.idling_queue_idx,
+			"Canceled delayed work on %d - forced dispatch",
+			rd->rd_idle_data.idling_queue_idx);
+		rd->rd_idle_data.idling_queue_idx = ROWQ_MAX_PRIO;
+	}
+
+	if (rd->pending_urgent_rq) {
+		row_log(rd->dispatch_queue, "dispatching urgent request");
+		row_dispatch_insert(rd, rd->pending_urgent_rq);
+		ret = 1;
+		goto done;
+	}
+
+	ioprio_class_to_serve = row_get_ioprio_class_to_serve(rd, force);
+	row_log(rd->dispatch_queue, "Dispatching from %d priority class",
+		ioprio_class_to_serve);
+
+	switch (ioprio_class_to_serve) {
+	case IOPRIO_CLASS_NONE:
+		rd->last_served_ioprio_class = IOPRIO_CLASS_NONE;
+		goto done;
+	case IOPRIO_CLASS_RT:
+		start_idx = ROWQ_HIGH_PRIO_IDX;
+		end_idx = ROWQ_REG_PRIO_IDX;
+		break;
+	case IOPRIO_CLASS_BE:
+		start_idx = ROWQ_REG_PRIO_IDX;
+		end_idx = ROWQ_LOW_PRIO_IDX;
+		break;
+	case IOPRIO_CLASS_IDLE:
+		start_idx = ROWQ_LOW_PRIO_IDX;
+		end_idx = ROWQ_MAX_PRIO;
+		break;
+	default:
+		pr_err("%s(): Invalid I/O priority class", __func__);
+		goto done;
+	}
+
+	currq = row_get_next_queue(q, rd, start_idx, end_idx);
+
+	/* Dispatch */
+	if (currq >= 0) {
+		row_dispatch_insert(rd,
+			rq_entry_fifo(rd->row_queues[currq].fifo.next));
+		ret = 1;
+	}
+done:
+	return ret;
+}
+
+/*
+ * row_init_queue() - Init scheduler data structures
+ * @q:	requests queue
+ *
+ * Return pointer to struct row_data to be saved in elevator for
+ * this dispatch queue
+ *
+ */
+static void *row_init_queue(struct request_queue *q)
+{
+
+	struct row_data *rdata;
+	int i;
+
+	rdata = kmalloc_node(sizeof(*rdata),
+			     GFP_KERNEL | __GFP_ZERO, q->node);
+	if (!rdata)
+		return NULL;
+
+	memset(rdata, 0, sizeof(*rdata));
+	for (i = 0; i < ROWQ_MAX_PRIO; i++) {
+		INIT_LIST_HEAD(&rdata->row_queues[i].fifo);
+		rdata->row_queues[i].disp_quantum = row_queues_def[i].quantum;
+		rdata->row_queues[i].rdata = rdata;
+		rdata->row_queues[i].prio = i;
+		rdata->row_queues[i].idle_data.begin_idling = false;
+		rdata->row_queues[i].idle_data.last_insert_time =
+			ktime_set(0, 0);
+	}
+
+	rdata->reg_prio_starvation.starvation_limit =
+			ROW_REG_STARVATION_TOLLERANCE;
+	rdata->low_prio_starvation.starvation_limit =
+			ROW_LOW_STARVATION_TOLLERANCE;
+	/*
+	 * Currently idling is enabled only for READ queues. If we want to
+	 * enable it for write queues also, note that idling frequency will
+	 * be the same in both cases
+	 */
+	rdata->rd_idle_data.idle_time_ms = ROW_IDLE_TIME_MSEC;
+	rdata->rd_idle_data.freq_ms = ROW_READ_FREQ_MSEC;
+	hrtimer_init(&rdata->rd_idle_data.hr_timer,
+		CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+	rdata->rd_idle_data.hr_timer.function = &row_idle_hrtimer_fn;
+
+	INIT_WORK(&rdata->rd_idle_data.idle_work, kick_queue);
+	rdata->last_served_ioprio_class = IOPRIO_CLASS_NONE;
+	rdata->rd_idle_data.idling_queue_idx = ROWQ_MAX_PRIO;
+	rdata->dispatch_queue = q;
+
+	return rdata;
+}
+
+/*
+ * row_exit_queue() - called on unloading the RAW scheduler
+ * @e:	poiner to struct elevator_queue
+ *
+ */
+static void row_exit_queue(struct elevator_queue *e)
+{
+	struct row_data *rd = (struct row_data *)e->elevator_data;
+	int i;
+
+	for (i = 0; i < ROWQ_MAX_PRIO; i++)
+		BUG_ON(!list_empty(&rd->row_queues[i].fifo));
+	if (hrtimer_cancel(&rd->rd_idle_data.hr_timer))
+		pr_err("%s(): idle timer was active!", __func__);
+	rd->rd_idle_data.idling_queue_idx = ROWQ_MAX_PRIO;
+	kfree(rd);
+}
+
+/*
+ * row_merged_requests() - Called when 2 requests are merged
+ * @q:		requests queue
+ * @rq:		request the two requests were merged into
+ * @next:	request that was merged
+ */
+static void row_merged_requests(struct request_queue *q, struct request *rq,
+				 struct request *next)
+{
+	struct row_queue   *rqueue = RQ_ROWQ(next);
+
+	list_del_init(&next->queuelist);
+	rqueue->nr_req--;
+	if (rqueue->rdata->pending_urgent_rq == next) {
+		pr_err("\n\nROW_WARNING: merging pending urgent!");
+		rqueue->rdata->pending_urgent_rq = rq;
+		rq->cmd_flags |= REQ_URGENT;
+		WARN_ON(!(next->cmd_flags & REQ_URGENT));
+		next->cmd_flags &= ~REQ_URGENT;
+	}
+	rqueue->rdata->nr_reqs[rq_data_dir(rq)]--;
+}
+
+/*
+ * row_get_queue_prio() - Get queue priority for a given request
+ *
+ * This is a helping function which purpose is to determine what
+ * ROW queue the given request should be added to (and
+ * dispatched from later on)
+ *
+ */
+static enum row_queue_prio row_get_queue_prio(struct request *rq,
+				struct row_data *rd)
+{
+	const int data_dir = rq_data_dir(rq);
+	const bool is_sync = rq_is_sync(rq);
+	enum row_queue_prio q_type = ROWQ_MAX_PRIO;
+	int ioprio_class = IOPRIO_PRIO_CLASS(rq->elv.icq->ioc->ioprio);
+
+	switch (ioprio_class) {
+	case IOPRIO_CLASS_RT:
+		if (data_dir == READ)
+			q_type = ROWQ_PRIO_HIGH_READ;
+		else if (is_sync)
+			q_type = ROWQ_PRIO_HIGH_SWRITE;
+		else {
+			pr_err("%s:%s(): got a simple write from RT_CLASS. How???",
+				rq->rq_disk->disk_name, __func__);
+			q_type = ROWQ_PRIO_REG_WRITE;
+		}
+		break;
+	case IOPRIO_CLASS_IDLE:
+		if (data_dir == READ)
+			q_type = ROWQ_PRIO_LOW_READ;
+		else if (is_sync)
+			q_type = ROWQ_PRIO_LOW_SWRITE;
+		else {
+			pr_err("%s:%s(): got a simple write from IDLE_CLASS. How???",
+				rq->rq_disk->disk_name, __func__);
+			q_type = ROWQ_PRIO_REG_WRITE;
+		}
+		break;
+	case IOPRIO_CLASS_NONE:
+	case IOPRIO_CLASS_BE:
+	default:
+		if (data_dir == READ)
+			q_type = ROWQ_PRIO_REG_READ;
+		else if (is_sync)
+			q_type = ROWQ_PRIO_REG_SWRITE;
+		else
+			q_type = ROWQ_PRIO_REG_WRITE;
+		break;
+	}
+
+	return q_type;
+}
+
+/*
+ * row_set_request() - Set ROW data structures associated with this request.
+ * @q:		requests queue
+ * @rq:		pointer to the request
+ * @gfp_mask:	ignored
+ *
+ */
+static int
+row_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask)
+{
+	struct row_data *rd = (struct row_data *)q->elevator->elevator_data;
+	unsigned long flags;
+
+	spin_lock_irqsave(q->queue_lock, flags);
+	rq->elv.priv[0] =
+		(void *)(&rd->row_queues[row_get_queue_prio(rq, rd)]);
+	spin_unlock_irqrestore(q->queue_lock, flags);
+
+	return 0;
+}
+
+/********** Helping sysfs functions/defenitions for ROW attributes ******/
+static ssize_t row_var_show(int var, char *page)
+{
+	return snprintf(page, 100, "%d\n", var);
+}
+
+static ssize_t row_var_store(int *var, const char *page, size_t count)
+{
+	int err;
+	err = kstrtoul(page, 10, (unsigned long *)var);
+
+	return count;
+}
+
+#define SHOW_FUNCTION(__FUNC, __VAR)				\
+static ssize_t __FUNC(struct elevator_queue *e, char *page)		\
+{									\
+	struct row_data *rowd = e->elevator_data;			\
+	int __data = __VAR;						\
+	return row_var_show(__data, (page));			\
+}
+SHOW_FUNCTION(row_hp_read_quantum_show,
+	rowd->row_queues[ROWQ_PRIO_HIGH_READ].disp_quantum);
+SHOW_FUNCTION(row_rp_read_quantum_show,
+	rowd->row_queues[ROWQ_PRIO_REG_READ].disp_quantum);
+SHOW_FUNCTION(row_hp_swrite_quantum_show,
+	rowd->row_queues[ROWQ_PRIO_HIGH_SWRITE].disp_quantum);
+SHOW_FUNCTION(row_rp_swrite_quantum_show,
+	rowd->row_queues[ROWQ_PRIO_REG_SWRITE].disp_quantum);
+SHOW_FUNCTION(row_rp_write_quantum_show,
+	rowd->row_queues[ROWQ_PRIO_REG_WRITE].disp_quantum);
+SHOW_FUNCTION(row_lp_read_quantum_show,
+	rowd->row_queues[ROWQ_PRIO_LOW_READ].disp_quantum);
+SHOW_FUNCTION(row_lp_swrite_quantum_show,
+	rowd->row_queues[ROWQ_PRIO_LOW_SWRITE].disp_quantum);
+SHOW_FUNCTION(row_rd_idle_data_show, rowd->rd_idle_data.idle_time_ms);
+SHOW_FUNCTION(row_rd_idle_data_freq_show, rowd->rd_idle_data.freq_ms);
+SHOW_FUNCTION(row_reg_starv_limit_show,
+	rowd->reg_prio_starvation.starvation_limit);
+SHOW_FUNCTION(row_low_starv_limit_show,
+	rowd->low_prio_starvation.starvation_limit);
+#undef SHOW_FUNCTION
+
+#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX)			\
+static ssize_t __FUNC(struct elevator_queue *e,				\
+		const char *page, size_t count)				\
+{									\
+	struct row_data *rowd = e->elevator_data;			\
+	int __data;						\
+	int ret = row_var_store(&__data, (page), count);		\
+	if (__data < (MIN))						\
+		__data = (MIN);						\
+	else if (__data > (MAX))					\
+		__data = (MAX);						\
+	*(__PTR) = __data;						\
+	return ret;							\
+}
+STORE_FUNCTION(row_hp_read_quantum_store,
+&rowd->row_queues[ROWQ_PRIO_HIGH_READ].disp_quantum, 1, INT_MAX);
+STORE_FUNCTION(row_rp_read_quantum_store,
+			&rowd->row_queues[ROWQ_PRIO_REG_READ].disp_quantum,
+			1, INT_MAX);
+STORE_FUNCTION(row_hp_swrite_quantum_store,
+			&rowd->row_queues[ROWQ_PRIO_HIGH_SWRITE].disp_quantum,
+			1, INT_MAX);
+STORE_FUNCTION(row_rp_swrite_quantum_store,
+			&rowd->row_queues[ROWQ_PRIO_REG_SWRITE].disp_quantum,
+			1, INT_MAX);
+STORE_FUNCTION(row_rp_write_quantum_store,
+			&rowd->row_queues[ROWQ_PRIO_REG_WRITE].disp_quantum,
+			1, INT_MAX);
+STORE_FUNCTION(row_lp_read_quantum_store,
+			&rowd->row_queues[ROWQ_PRIO_LOW_READ].disp_quantum,
+			1, INT_MAX);
+STORE_FUNCTION(row_lp_swrite_quantum_store,
+			&rowd->row_queues[ROWQ_PRIO_LOW_SWRITE].disp_quantum,
+			1, INT_MAX);
+STORE_FUNCTION(row_rd_idle_data_store, &rowd->rd_idle_data.idle_time_ms,
+			1, INT_MAX);
+STORE_FUNCTION(row_rd_idle_data_freq_store, &rowd->rd_idle_data.freq_ms,
+			1, INT_MAX);
+STORE_FUNCTION(row_reg_starv_limit_store,
+			&rowd->reg_prio_starvation.starvation_limit,
+			1, INT_MAX);
+STORE_FUNCTION(row_low_starv_limit_store,
+			&rowd->low_prio_starvation.starvation_limit,
+			1, INT_MAX);
+
+#undef STORE_FUNCTION
+
+#define ROW_ATTR(name) \
+	__ATTR(name, S_IRUGO|S_IWUSR, row_##name##_show, \
+				      row_##name##_store)
+
+static struct elv_fs_entry row_attrs[] = {
+	ROW_ATTR(hp_read_quantum),
+	ROW_ATTR(rp_read_quantum),
+	ROW_ATTR(hp_swrite_quantum),
+	ROW_ATTR(rp_swrite_quantum),
+	ROW_ATTR(rp_write_quantum),
+	ROW_ATTR(lp_read_quantum),
+	ROW_ATTR(lp_swrite_quantum),
+	ROW_ATTR(rd_idle_data),
+	ROW_ATTR(rd_idle_data_freq),
+	ROW_ATTR(reg_starv_limit),
+	ROW_ATTR(low_starv_limit),
+	__ATTR_NULL
+};
+
+static struct elevator_type iosched_row = {
+	.ops = {
+		.elevator_merge_req_fn		= row_merged_requests,
+		.elevator_dispatch_fn		= row_dispatch_requests,
+		.elevator_add_req_fn		= row_add_request,
+		.elevator_reinsert_req_fn	= row_reinsert_req,
+		.elevator_is_urgent_fn		= row_urgent_pending,
+		.elevator_completed_req_fn	= row_completed_req,
+		.elevator_former_req_fn		= elv_rb_former_request,
+		.elevator_latter_req_fn		= elv_rb_latter_request,
+		.elevator_set_req_fn		= row_set_request,
+		.elevator_init_fn		= row_init_queue,
+		.elevator_exit_fn		= row_exit_queue,
+	},
+	.icq_size = sizeof(struct io_cq),
+	.icq_align = __alignof__(struct io_cq),
+	.elevator_attrs = row_attrs,
+	.elevator_name = "row",
+	.elevator_owner = THIS_MODULE,
+};
+
+static int __init row_init(void)
+{
+	elv_register(&iosched_row);
+	return 0;
+}
+
+static void __exit row_exit(void)
+{
+	elv_unregister(&iosched_row);
+}
+
+module_init(row_init);
+module_exit(row_exit);
+
+MODULE_LICENSE("GPLv2");
+MODULE_DESCRIPTION("Read Over Write IO scheduler");
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 6512b20..d1fcbc0 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -292,7 +292,9 @@
 	ac->charger.properties = ac_props;
 	ac->charger.num_properties = ARRAY_SIZE(ac_props);
 	ac->charger.get_property = get_ac_property;
-	power_supply_register(&ac->device->dev, &ac->charger);
+	result = power_supply_register(&ac->device->dev, &ac->charger);
+	if (result)
+		goto end;
 
 	printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
 	       acpi_device_name(device), acpi_device_bid(device),
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index a43fa1a..1502c502 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -36,6 +36,7 @@
 #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"
 #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80
 static DEFINE_MUTEX(isolated_cpus_lock);
+static DEFINE_MUTEX(round_robin_lock);
 
 static unsigned long power_saving_mwait_eax;
 
@@ -107,7 +108,7 @@
 	if (!alloc_cpumask_var(&tmp, GFP_KERNEL))
 		return;
 
-	mutex_lock(&isolated_cpus_lock);
+	mutex_lock(&round_robin_lock);
 	cpumask_clear(tmp);
 	for_each_cpu(cpu, pad_busy_cpus)
 		cpumask_or(tmp, tmp, topology_thread_cpumask(cpu));
@@ -116,7 +117,7 @@
 	if (cpumask_empty(tmp))
 		cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus);
 	if (cpumask_empty(tmp)) {
-		mutex_unlock(&isolated_cpus_lock);
+		mutex_unlock(&round_robin_lock);
 		return;
 	}
 	for_each_cpu(cpu, tmp) {
@@ -131,7 +132,7 @@
 	tsk_in_cpu[tsk_index] = preferred_cpu;
 	cpumask_set_cpu(preferred_cpu, pad_busy_cpus);
 	cpu_weight[preferred_cpu]++;
-	mutex_unlock(&isolated_cpus_lock);
+	mutex_unlock(&round_robin_lock);
 
 	set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu));
 }
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 0ed85ca..615996a 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -95,18 +95,6 @@
 		return_ACPI_STATUS(status);
 	}
 
-	if (sleep_state != ACPI_STATE_S5) {
-		/*
-		 * Disable BM arbitration. This feature is contained within an
-		 * optional register (PM2 Control), so ignore a BAD_ADDRESS
-		 * exception.
-		 */
-		status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1);
-		if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) {
-			return_ACPI_STATUS(status);
-		}
-	}
-
 	/*
 	 * 1) Disable/Clear all GPEs
 	 * 2) Enable all wakeup GPEs
@@ -364,16 +352,6 @@
 				    [ACPI_EVENT_POWER_BUTTON].
 				    status_register_id, ACPI_CLEAR_STATUS);
 
-	/*
-	 * Enable BM arbitration. This feature is contained within an
-	 * optional register (PM2 Control), so ignore a BAD_ADDRESS
-	 * exception.
-	 */
-	status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0);
-	if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) {
-		return_ACPI_STATUS(status);
-	}
-
 	acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING);
 	return_ACPI_STATUS(status);
 }
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 23ce096..fe66260 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -638,7 +638,7 @@
 			/* Create the new outer package and populate it */
 
 			status =
-			    acpi_ns_wrap_with_package(data, *elements,
+			    acpi_ns_wrap_with_package(data, return_object,
 						      return_object_ptr);
 			if (ACPI_FAILURE(status)) {
 				return (status);
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 5577762..00a7836 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -243,7 +243,7 @@
 	u8 ins = entry->instruction;
 
 	if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
-		return acpi_os_map_generic_address(&entry->register_region);
+		return apei_map_generic_address(&entry->register_region);
 
 	return 0;
 }
@@ -276,7 +276,7 @@
 	u8 ins = entry->instruction;
 
 	if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
-		acpi_os_unmap_generic_address(&entry->register_region);
+		apei_unmap_generic_address(&entry->register_region);
 
 	return 0;
 }
@@ -586,6 +586,11 @@
 	}
 	*access_bit_width = 1UL << (access_size_code + 2);
 
+	/* Fixup common BIOS bug */
+	if (bit_width == 32 && bit_offset == 0 && (*paddr & 0x03) == 0 &&
+	    *access_bit_width < 32)
+		*access_bit_width = 32;
+
 	if ((bit_width + bit_offset) > *access_bit_width) {
 		pr_warning(FW_BUG APEI_PFX
 			   "Invalid bit width + offset in GAR [0x%llx/%u/%u/%u/%u]\n",
@@ -606,6 +611,19 @@
 	return 0;
 }
 
+int apei_map_generic_address(struct acpi_generic_address *reg)
+{
+	int rc;
+	u32 access_bit_width;
+	u64 address;
+
+	rc = apei_check_gar(reg, &address, &access_bit_width);
+	if (rc)
+		return rc;
+	return acpi_os_map_generic_address(reg);
+}
+EXPORT_SYMBOL_GPL(apei_map_generic_address);
+
 /* read GAR in interrupt (including NMI) or process context */
 int apei_read(u64 *val, struct acpi_generic_address *reg)
 {
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h
index cca240a..f220d64 100644
--- a/drivers/acpi/apei/apei-internal.h
+++ b/drivers/acpi/apei/apei-internal.h
@@ -7,6 +7,8 @@
 #define APEI_INTERNAL_H
 
 #include <linux/cper.h>
+#include <linux/acpi.h>
+#include <linux/acpi_io.h>
 
 struct apei_exec_context;
 
@@ -68,6 +70,13 @@
 /* IP has been set in instruction function */
 #define APEI_EXEC_SET_IP	1
 
+int apei_map_generic_address(struct acpi_generic_address *reg);
+
+static inline void apei_unmap_generic_address(struct acpi_generic_address *reg)
+{
+	acpi_os_unmap_generic_address(reg);
+}
+
 int apei_read(u64 *val, struct acpi_generic_address *reg);
 int apei_write(u64 val, struct acpi_generic_address *reg);
 
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 9b3cac0..1599566 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -301,7 +301,7 @@
 	if (!ghes)
 		return ERR_PTR(-ENOMEM);
 	ghes->generic = generic;
-	rc = acpi_os_map_generic_address(&generic->error_status_address);
+	rc = apei_map_generic_address(&generic->error_status_address);
 	if (rc)
 		goto err_free;
 	error_block_length = generic->error_block_length;
@@ -321,7 +321,7 @@
 	return ghes;
 
 err_unmap:
-	acpi_os_unmap_generic_address(&generic->error_status_address);
+	apei_unmap_generic_address(&generic->error_status_address);
 err_free:
 	kfree(ghes);
 	return ERR_PTR(rc);
@@ -330,7 +330,7 @@
 static void ghes_fini(struct ghes *ghes)
 {
 	kfree(ghes->estatus);
-	acpi_os_unmap_generic_address(&ghes->generic->error_status_address);
+	apei_unmap_generic_address(&ghes->generic->error_status_address);
 }
 
 enum {
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 86933ca..7dd3f9f 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -643,11 +643,19 @@
 
 static void acpi_battery_refresh(struct acpi_battery *battery)
 {
+	int power_unit;
+
 	if (!battery->bat.dev)
 		return;
 
+	power_unit = battery->power_unit;
+
 	acpi_battery_get_info(battery);
-	/* The battery may have changed its reporting units. */
+
+	if (power_unit == battery->power_unit)
+		return;
+
+	/* The battery has changed its reporting units. */
 	sysfs_remove_battery(battery);
 	sysfs_add_battery(battery);
 }
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index c850de4..eff7222 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -189,10 +189,12 @@
 		 *     Processor (CPU3, 0x03, 0x00000410, 0x06) {}
 		 * }
 		 *
-		 * Ignores apic_id and always return 0 for CPU0's handle.
+		 * Ignores apic_id and always returns 0 for the processor
+		 * handle with acpi id 0 if nr_cpu_ids is 1.
+		 * This should be the case if SMP tables are not found.
 		 * Return -1 for other CPU's handle.
 		 */
-		if (acpi_id == 0)
+		if (nr_cpu_ids <= 1 && acpi_id == 0)
 			return acpi_id;
 		else
 			return apic_id;
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 0734086..bbac51e 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -442,7 +442,7 @@
 		/* Normal CPU soft online event */
 		} else {
 			acpi_processor_ppc_has_changed(pr, 0);
-			acpi_processor_cst_has_changed(pr);
+			acpi_processor_hotplug(pr);
 			acpi_processor_reevaluate_tstate(pr, action);
 			acpi_processor_tstate_has_changed(pr);
 		}
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index eb6fd23..2377445 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -732,8 +732,8 @@
 	 * can wake the system.  _S0W may be valid, too.
 	 */
 	if (acpi_target_sleep_state == ACPI_STATE_S0 ||
-	    (device_may_wakeup(dev) &&
-	     adev->wakeup.sleep_state <= acpi_target_sleep_state)) {
+	    (device_may_wakeup(dev) && adev->wakeup.flags.valid &&
+	     adev->wakeup.sleep_state >= acpi_target_sleep_state)) {
 		acpi_status status;
 
 		acpi_method[3] = 'W';
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 9f66181..240a244 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -173,7 +173,7 @@
 {
 	int result = 0;
 
-	if (!strncmp(val, "enable", strlen("enable") - 1)) {
+	if (!strncmp(val, "enable", strlen("enable"))) {
 		result = acpi_debug_trace(trace_method_name, trace_debug_level,
 					  trace_debug_layer, 0);
 		if (result)
@@ -181,7 +181,7 @@
 		goto exit;
 	}
 
-	if (!strncmp(val, "disable", strlen("disable") - 1)) {
+	if (!strncmp(val, "disable", strlen("disable"))) {
 		int name = 0;
 		result = acpi_debug_trace((char *)&name, trace_debug_level,
 					  trace_debug_layer, 0);
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 9577b6f..48b5a3c 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -558,6 +558,8 @@
 	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
 	struct acpi_object_list args = { 1, &arg0 };
 
+	if (!video->cap._DOS)
+		return 0;
 
 	if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1)
 		return -EINVAL;
@@ -1745,6 +1747,7 @@
 
 static int __init intel_opregion_present(void)
 {
+	int i915 = 0;
 #if defined(CONFIG_DRM_I915) || defined(CONFIG_DRM_I915_MODULE)
 	struct pci_dev *dev = NULL;
 	u32 address;
@@ -1757,10 +1760,10 @@
 		pci_read_config_dword(dev, 0xfc, &address);
 		if (!address)
 			continue;
-		return 1;
+		i915 = 1;
 	}
 #endif
-	return 0;
+	return i915;
 }
 
 int acpi_video_register(void)
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 7857e8f..3c809bf 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1554,6 +1554,39 @@
 	return false;
 }
 
+static int prefer_ms_hyperv = 1;
+module_param(prefer_ms_hyperv, int, 0);
+
+static void piix_ignore_devices_quirk(struct ata_host *host)
+{
+#if IS_ENABLED(CONFIG_HYPERV_STORAGE)
+	static const struct dmi_system_id ignore_hyperv[] = {
+		{
+			/* On Hyper-V hypervisors the disks are exposed on
+			 * both the emulated SATA controller and on the
+			 * paravirtualised drivers.  The CD/DVD devices
+			 * are only exposed on the emulated controller.
+			 * Request we ignore ATA devices on this host.
+			 */
+			.ident = "Hyper-V Virtual Machine",
+			.matches = {
+				DMI_MATCH(DMI_SYS_VENDOR,
+						"Microsoft Corporation"),
+				DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
+			},
+		},
+		{ }	/* terminate list */
+	};
+	const struct dmi_system_id *dmi = dmi_first_match(ignore_hyperv);
+
+	if (dmi && prefer_ms_hyperv) {
+		host->flags |= ATA_HOST_IGNORE_ATA;
+		dev_info(host->dev, "%s detected, ATA device ignore set\n",
+			dmi->ident);
+	}
+#endif
+}
+
 /**
  *	piix_init_one - Register PIIX ATA PCI device with kernel services
  *	@pdev: PCI device to register
@@ -1669,6 +1702,9 @@
 	}
 	host->flags |= ATA_HOST_PARALLEL_SCAN;
 
+	/* Allow hosts to specify device types to ignore when scanning. */
+	piix_ignore_devices_quirk(host);
+
 	pci_set_master(pdev);
 	return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht);
 }
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 23763a1..d31ee55 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1973,6 +1973,12 @@
 	if (class == ATA_DEV_ATA) {
 		if (!ata_id_is_ata(id) && !ata_id_is_cfa(id))
 			goto err_out;
+		if (ap->host->flags & ATA_HOST_IGNORE_ATA &&
+							ata_id_is_ata(id)) {
+			ata_dev_dbg(dev,
+				"host indicates ignore ATA devices, ignored\n");
+			return -ENOENT;
+		}
 	} else {
 		if (ata_id_is_ata(id))
 			goto err_out;
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index e8cd652..9851093 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -984,6 +984,7 @@
 			} else if (skb && card->using_dma) {
 				SKB_CB(skb)->dma_addr = pci_map_single(card->dev, skb->data,
 								       skb->len, PCI_DMA_TODEVICE);
+				card->tx_skb[port] = skb;
 				iowrite32(SKB_CB(skb)->dma_addr,
 					  card->config_regs + TX_DMA_ADDR(port));
 			}
@@ -1152,7 +1153,8 @@
 		db_fpga_upgrade = db_firmware_upgrade = 0;
 	}
 
-	if (card->fpga_version >= DMA_SUPPORTED){
+	if (card->fpga_version >= DMA_SUPPORTED) {
+		pci_set_master(dev);
 		card->using_dma = 1;
 	} else {
 		card->using_dma = 0;
diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c
index a058842..61ce405 100644
--- a/drivers/bcma/driver_chipcommon_pmu.c
+++ b/drivers/bcma/driver_chipcommon_pmu.c
@@ -139,7 +139,9 @@
 		bcma_chipco_chipctl_maskset(cc, 0, ~0, 0x7);
 		break;
 	case 0x4331:
-		/* BCM4331 workaround is SPROM-related, we put it in sprom.c */
+	case 43431:
+		/* Ext PA lines must be enabled for tx on BCM4331 */
+		bcma_chipco_bcm4331_ext_pa_lines_ctl(cc, true);
 		break;
 	case 43224:
 		if (bus->chipinfo.rev == 0) {
diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c
index 3e2a600..4588da2 100644
--- a/drivers/bcma/sprom.c
+++ b/drivers/bcma/sprom.c
@@ -432,13 +432,13 @@
 	if (!sprom)
 		return -ENOMEM;
 
-	if (bus->chipinfo.id == 0x4331)
+	if (bus->chipinfo.id == 0x4331 || bus->chipinfo.id == 43431)
 		bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false);
 
 	pr_debug("SPROM offset 0x%x\n", offset);
 	bcma_sprom_read(bus, offset, sprom);
 
-	if (bus->chipinfo.id == 0x4331)
+	if (bus->chipinfo.id == 0x4331 || bus->chipinfo.id == 43431)
 		bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true);
 
 	err = bcma_sprom_valid(sprom);
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index aa27120..9a72277 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -513,6 +513,44 @@
 	}
 }
 
+struct mm_plug_cb {
+	struct blk_plug_cb cb;
+	struct cardinfo *card;
+};
+
+static void mm_unplug(struct blk_plug_cb *cb)
+{
+	struct mm_plug_cb *mmcb = container_of(cb, struct mm_plug_cb, cb);
+
+	spin_lock_irq(&mmcb->card->lock);
+	activate(mmcb->card);
+	spin_unlock_irq(&mmcb->card->lock);
+	kfree(mmcb);
+}
+
+static int mm_check_plugged(struct cardinfo *card)
+{
+	struct blk_plug *plug = current->plug;
+	struct mm_plug_cb *mmcb;
+
+	if (!plug)
+		return 0;
+
+	list_for_each_entry(mmcb, &plug->cb_list, cb.list) {
+		if (mmcb->cb.callback == mm_unplug && mmcb->card == card)
+			return 1;
+	}
+	/* Not currently on the callback list */
+	mmcb = kmalloc(sizeof(*mmcb), GFP_ATOMIC);
+	if (!mmcb)
+		return 0;
+
+	mmcb->card = card;
+	mmcb->cb.callback = mm_unplug;
+	list_add(&mmcb->cb.list, &plug->cb_list);
+	return 1;
+}
+
 static void mm_make_request(struct request_queue *q, struct bio *bio)
 {
 	struct cardinfo *card = q->queuedata;
@@ -523,6 +561,8 @@
 	*card->biotail = bio;
 	bio->bi_next = NULL;
 	card->biotail = &bio->bi_next;
+	if (bio->bi_rw & REQ_SYNC || !mm_check_plugged(card))
+		activate(card);
 	spin_unlock_irq(&card->lock);
 
 	return;
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
index 773cf27..9ad3b5e 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -257,6 +257,7 @@
 		break;
 	case BLKIF_OP_DISCARD:
 		dst->u.discard.flag = src->u.discard.flag;
+		dst->u.discard.id = src->u.discard.id;
 		dst->u.discard.sector_number = src->u.discard.sector_number;
 		dst->u.discard.nr_sectors = src->u.discard.nr_sectors;
 		break;
@@ -287,6 +288,7 @@
 		break;
 	case BLKIF_OP_DISCARD:
 		dst->u.discard.flag = src->u.discard.flag;
+		dst->u.discard.id = src->u.discard.id;
 		dst->u.discard.sector_number = src->u.discard.sector_number;
 		dst->u.discard.nr_sectors = src->u.discard.nr_sectors;
 		break;
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 962e75d..4293c48 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -898,6 +898,7 @@
 	ID(PCI_DEVICE_ID_INTEL_B43_HB),
 	ID(PCI_DEVICE_ID_INTEL_B43_1_HB),
 	ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB),
+	ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D2_HB),
 	ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB),
 	ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB),
 	ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB),
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h
index 7ea18a5..439d7e7 100644
--- a/drivers/char/agp/intel-agp.h
+++ b/drivers/char/agp/intel-agp.h
@@ -211,6 +211,7 @@
 #define PCI_DEVICE_ID_INTEL_G41_HB          0x2E30
 #define PCI_DEVICE_ID_INTEL_G41_IG          0x2E32
 #define PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB	    0x0040
+#define PCI_DEVICE_ID_INTEL_IRONLAKE_D2_HB	    0x0069
 #define PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG	    0x0042
 #define PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB	    0x0044
 #define PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB	    0x0062
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
index f518b99..731c904 100644
--- a/drivers/char/hw_random/atmel-rng.c
+++ b/drivers/char/hw_random/atmel-rng.c
@@ -34,8 +34,15 @@
 	u32 *data = buf;
 
 	/* data ready? */
-	if (readl(trng->base + TRNG_ODATA) & 1) {
+	if (readl(trng->base + TRNG_ISR) & 1) {
 		*data = readl(trng->base + TRNG_ODATA);
+		/*
+		  ensure data ready is only set again AFTER the next data
+		  word is ready in case it got set between checking ISR
+		  and reading ODATA, so we don't risk re-reading the
+		  same word
+		*/
+		readl(trng->base + TRNG_ISR);
 		return 4;
 	} else
 		return 0;
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c
index 8b78750..845f97f 100644
--- a/drivers/char/mspec.c
+++ b/drivers/char/mspec.c
@@ -283,7 +283,7 @@
 	vdata->flags = flags;
 	vdata->type = type;
 	spin_lock_init(&vdata->lock);
-	vdata->refcnt = ATOMIC_INIT(1);
+	atomic_set(&vdata->refcnt, 1);
 	vma->vm_private_data = vdata;
 
 	vma->vm_flags |= (VM_IO | VM_RESERVED | VM_PFNMAP | VM_DONTEXPAND);
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 4ec04a7..d98b2a6 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -125,21 +125,26 @@
  * The current exported interfaces for gathering environmental noise
  * from the devices are:
  *
+ *	void add_device_randomness(const void *buf, unsigned int size);
  * 	void add_input_randomness(unsigned int type, unsigned int code,
  *                                unsigned int value);
- * 	void add_interrupt_randomness(int irq);
+ *	void add_interrupt_randomness(int irq, int irq_flags);
  * 	void add_disk_randomness(struct gendisk *disk);
  *
+ * add_device_randomness() is for adding data to the random pool that
+ * is likely to differ between two devices (or possibly even per boot).
+ * This would be things like MAC addresses or serial numbers, or the
+ * read-out of the RTC. This does *not* add any actual entropy to the
+ * pool, but it initializes the pool to different values for devices
+ * that might otherwise be identical and have very little entropy
+ * available to them (particularly common in the embedded world).
+ *
  * add_input_randomness() uses the input layer interrupt timing, as well as
  * the event type information from the hardware.
  *
- * add_interrupt_randomness() uses the inter-interrupt timing as random
- * inputs to the entropy pool.  Note that not all interrupts are good
- * sources of randomness!  For example, the timer interrupts is not a
- * good choice, because the periodicity of the interrupts is too
- * regular, and hence predictable to an attacker.  Network Interface
- * Controller interrupts are a better measure, since the timing of the
- * NIC interrupts are more unpredictable.
+ * add_interrupt_randomness() uses the interrupt timing as random
+ * inputs to the entropy pool. Using the cycle counters and the irq source
+ * as inputs, it feeds the randomness roughly once a second.
  *
  * add_disk_randomness() uses what amounts to the seek time of block
  * layer request events, on a per-disk_devt basis, as input to the
@@ -248,6 +253,8 @@
 #include <linux/percpu.h>
 #include <linux/cryptohash.h>
 #include <linux/fips.h>
+#include <linux/ptrace.h>
+#include <linux/kmemcheck.h>
 
 #ifdef CONFIG_GENERIC_HARDIRQS
 # include <linux/irq.h>
@@ -256,8 +263,12 @@
 #include <asm/processor.h>
 #include <asm/uaccess.h>
 #include <asm/irq.h>
+#include <asm/irq_regs.h>
 #include <asm/io.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/random.h>
+
 /*
  * Configuration information
  */
@@ -266,6 +277,8 @@
 #define SEC_XFER_SIZE 512
 #define EXTRACT_SIZE 10
 
+#define LONGS(x) (((x) + sizeof(unsigned long) - 1)/sizeof(unsigned long))
+
 /*
  * The minimum number of bits of entropy before we wake up a read on
  * /dev/random.  Should be enough to do a significant reseed.
@@ -420,8 +433,10 @@
 	/* read-write data: */
 	spinlock_t lock;
 	unsigned add_ptr;
+	unsigned input_rotate;
 	int entropy_count;
-	int input_rotate;
+	int entropy_total;
+	unsigned int initialized:1;
 	__u8 last_data[EXTRACT_SIZE];
 };
 
@@ -454,6 +469,10 @@
 	.pool = nonblocking_pool_data
 };
 
+static __u32 const twist_table[8] = {
+	0x00000000, 0x3b6e20c8, 0x76dc4190, 0x4db26158,
+	0xedb88320, 0xd6d6a3e8, 0x9b64c2b0, 0xa00ae278 };
+
 /*
  * This function adds bytes into the entropy "pool".  It does not
  * update the entropy estimate.  The caller should call
@@ -464,29 +483,24 @@
  * it's cheap to do so and helps slightly in the expected case where
  * the entropy is concentrated in the low-order bits.
  */
-static void mix_pool_bytes_extract(struct entropy_store *r, const void *in,
-				   int nbytes, __u8 out[64])
+static void _mix_pool_bytes(struct entropy_store *r, const void *in,
+			    int nbytes, __u8 out[64])
 {
-	static __u32 const twist_table[8] = {
-		0x00000000, 0x3b6e20c8, 0x76dc4190, 0x4db26158,
-		0xedb88320, 0xd6d6a3e8, 0x9b64c2b0, 0xa00ae278 };
 	unsigned long i, j, tap1, tap2, tap3, tap4, tap5;
 	int input_rotate;
 	int wordmask = r->poolinfo->poolwords - 1;
 	const char *bytes = in;
 	__u32 w;
-	unsigned long flags;
 
-	/* Taps are constant, so we can load them without holding r->lock.  */
 	tap1 = r->poolinfo->tap1;
 	tap2 = r->poolinfo->tap2;
 	tap3 = r->poolinfo->tap3;
 	tap4 = r->poolinfo->tap4;
 	tap5 = r->poolinfo->tap5;
 
-	spin_lock_irqsave(&r->lock, flags);
-	input_rotate = r->input_rotate;
-	i = r->add_ptr;
+	smp_rmb();
+	input_rotate = ACCESS_ONCE(r->input_rotate);
+	i = ACCESS_ONCE(r->add_ptr);
 
 	/* mix one byte at a time to simplify size handling and churn faster */
 	while (nbytes--) {
@@ -513,19 +527,61 @@
 		input_rotate += i ? 7 : 14;
 	}
 
-	r->input_rotate = input_rotate;
-	r->add_ptr = i;
+	ACCESS_ONCE(r->input_rotate) = input_rotate;
+	ACCESS_ONCE(r->add_ptr) = i;
+	smp_wmb();
 
 	if (out)
 		for (j = 0; j < 16; j++)
 			((__u32 *)out)[j] = r->pool[(i - j) & wordmask];
+}
 
+static void __mix_pool_bytes(struct entropy_store *r, const void *in,
+			     int nbytes, __u8 out[64])
+{
+	trace_mix_pool_bytes_nolock(r->name, nbytes, _RET_IP_);
+	_mix_pool_bytes(r, in, nbytes, out);
+}
+
+static void mix_pool_bytes(struct entropy_store *r, const void *in,
+			   int nbytes, __u8 out[64])
+{
+	unsigned long flags;
+
+	trace_mix_pool_bytes(r->name, nbytes, _RET_IP_);
+	spin_lock_irqsave(&r->lock, flags);
+	_mix_pool_bytes(r, in, nbytes, out);
 	spin_unlock_irqrestore(&r->lock, flags);
 }
 
-static void mix_pool_bytes(struct entropy_store *r, const void *in, int bytes)
+struct fast_pool {
+	__u32		pool[4];
+	unsigned long	last;
+	unsigned short	count;
+	unsigned char	rotate;
+	unsigned char	last_timer_intr;
+};
+
+/*
+ * This is a fast mixing routine used by the interrupt randomness
+ * collector.  It's hardcoded for an 128 bit pool and assumes that any
+ * locks that might be needed are taken by the caller.
+ */
+static void fast_mix(struct fast_pool *f, const void *in, int nbytes)
 {
-       mix_pool_bytes_extract(r, in, bytes, NULL);
+	const char	*bytes = in;
+	__u32		w;
+	unsigned	i = f->count;
+	unsigned	input_rotate = f->rotate;
+
+	while (nbytes--) {
+		w = rol32(*bytes++, input_rotate & 31) ^ f->pool[i & 3] ^
+			f->pool[(i + 1) & 3];
+		f->pool[i & 3] = (w >> 3) ^ twist_table[w & 7];
+		input_rotate += (i++ & 3) ? 7 : 14;
+	}
+	f->count = i;
+	f->rotate = input_rotate;
 }
 
 /*
@@ -533,30 +589,38 @@
  */
 static void credit_entropy_bits(struct entropy_store *r, int nbits)
 {
-	unsigned long flags;
-	int entropy_count;
+	int entropy_count, orig;
 
 	if (!nbits)
 		return;
 
-	spin_lock_irqsave(&r->lock, flags);
-
 	DEBUG_ENT("added %d entropy credits to %s\n", nbits, r->name);
-	entropy_count = r->entropy_count;
+retry:
+	entropy_count = orig = ACCESS_ONCE(r->entropy_count);
 	entropy_count += nbits;
+
 	if (entropy_count < 0) {
 		DEBUG_ENT("negative entropy/overflow\n");
 		entropy_count = 0;
 	} else if (entropy_count > r->poolinfo->POOLBITS)
 		entropy_count = r->poolinfo->POOLBITS;
-	r->entropy_count = entropy_count;
+	if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig)
+		goto retry;
+
+	if (!r->initialized && nbits > 0) {
+		r->entropy_total += nbits;
+		if (r->entropy_total > 128)
+			r->initialized = 1;
+	}
+
+	trace_credit_entropy_bits(r->name, nbits, entropy_count,
+				  r->entropy_total, _RET_IP_);
 
 	/* should we wake readers? */
 	if (r == &input_pool && entropy_count >= random_read_wakeup_thresh) {
 		wake_up_interruptible(&random_read_wait);
 		kill_fasync(&fasync, SIGIO, POLL_IN);
 	}
-	spin_unlock_irqrestore(&r->lock, flags);
 }
 
 /*********************************************************************
@@ -572,42 +636,24 @@
 	unsigned dont_count_entropy:1;
 };
 
-#ifndef CONFIG_GENERIC_HARDIRQS
-
-static struct timer_rand_state *irq_timer_state[NR_IRQS];
-
-static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
+/*
+ * Add device- or boot-specific data to the input and nonblocking
+ * pools to help initialize them to unique values.
+ *
+ * None of this adds any entropy, it is meant to avoid the
+ * problem of the nonblocking pool having similar initial state
+ * across largely identical devices.
+ */
+void add_device_randomness(const void *buf, unsigned int size)
 {
-	return irq_timer_state[irq];
+	unsigned long time = get_cycles() ^ jiffies;
+
+	mix_pool_bytes(&input_pool, buf, size, NULL);
+	mix_pool_bytes(&input_pool, &time, sizeof(time), NULL);
+	mix_pool_bytes(&nonblocking_pool, buf, size, NULL);
+	mix_pool_bytes(&nonblocking_pool, &time, sizeof(time), NULL);
 }
-
-static void set_timer_rand_state(unsigned int irq,
-				 struct timer_rand_state *state)
-{
-	irq_timer_state[irq] = state;
-}
-
-#else
-
-static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
-{
-	struct irq_desc *desc;
-
-	desc = irq_to_desc(irq);
-
-	return desc->timer_rand_state;
-}
-
-static void set_timer_rand_state(unsigned int irq,
-				 struct timer_rand_state *state)
-{
-	struct irq_desc *desc;
-
-	desc = irq_to_desc(irq);
-
-	desc->timer_rand_state = state;
-}
-#endif
+EXPORT_SYMBOL(add_device_randomness);
 
 static struct timer_rand_state input_timer_state;
 
@@ -637,13 +683,9 @@
 		goto out;
 
 	sample.jiffies = jiffies;
-
-	/* Use arch random value, fall back to cycles */
-	if (!arch_get_random_int(&sample.cycles))
-		sample.cycles = get_cycles();
-
+	sample.cycles = get_cycles();
 	sample.num = num;
-	mix_pool_bytes(&input_pool, &sample, sizeof(sample));
+	mix_pool_bytes(&input_pool, &sample, sizeof(sample), NULL);
 
 	/*
 	 * Calculate number of bits of randomness we probably added.
@@ -700,17 +742,48 @@
 }
 EXPORT_SYMBOL_GPL(add_input_randomness);
 
-void add_interrupt_randomness(int irq)
+static DEFINE_PER_CPU(struct fast_pool, irq_randomness);
+
+void add_interrupt_randomness(int irq, int irq_flags)
 {
-	struct timer_rand_state *state;
+	struct entropy_store	*r;
+	struct fast_pool	*fast_pool = &__get_cpu_var(irq_randomness);
+	struct pt_regs		*regs = get_irq_regs();
+	unsigned long		now = jiffies;
+	__u32			input[4], cycles = get_cycles();
 
-	state = get_timer_rand_state(irq);
+	input[0] = cycles ^ jiffies;
+	input[1] = irq;
+	if (regs) {
+		__u64 ip = instruction_pointer(regs);
+		input[2] = ip;
+		input[3] = ip >> 32;
+	}
 
-	if (state == NULL)
+	fast_mix(fast_pool, input, sizeof(input));
+
+	if ((fast_pool->count & 1023) &&
+	    !time_after(now, fast_pool->last + HZ))
 		return;
 
-	DEBUG_ENT("irq event %d\n", irq);
-	add_timer_randomness(state, 0x100 + irq);
+	fast_pool->last = now;
+
+	r = nonblocking_pool.initialized ? &input_pool : &nonblocking_pool;
+	__mix_pool_bytes(r, &fast_pool->pool, sizeof(fast_pool->pool), NULL);
+	/*
+	 * If we don't have a valid cycle counter, and we see
+	 * back-to-back timer interrupts, then skip giving credit for
+	 * any entropy.
+	 */
+	if (cycles == 0) {
+		if (irq_flags & __IRQF_TIMER) {
+			if (fast_pool->last_timer_intr)
+				return;
+			fast_pool->last_timer_intr = 1;
+		} else
+			fast_pool->last_timer_intr = 0;
+	}
+	credit_entropy_bits(r, 1);
 }
 
 #ifdef CONFIG_BLOCK
@@ -742,7 +815,7 @@
  */
 static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
 {
-	__u32 tmp[OUTPUT_POOL_WORDS];
+	__u32	tmp[OUTPUT_POOL_WORDS];
 
 	if (r->pull && r->entropy_count < nbytes * 8 &&
 	    r->entropy_count < r->poolinfo->POOLBITS) {
@@ -761,7 +834,7 @@
 
 		bytes = extract_entropy(r->pull, tmp, bytes,
 					random_read_wakeup_thresh / 8, rsvd);
-		mix_pool_bytes(r, tmp, bytes);
+		mix_pool_bytes(r, tmp, bytes, NULL);
 		credit_entropy_bits(r, bytes*8);
 	}
 }
@@ -820,13 +893,19 @@
 static void extract_buf(struct entropy_store *r, __u8 *out)
 {
 	int i;
-	__u32 hash[5], workspace[SHA_WORKSPACE_WORDS];
+	union {
+		__u32 w[5];
+		unsigned long l[LONGS(EXTRACT_SIZE)];
+	} hash;
+	__u32 workspace[SHA_WORKSPACE_WORDS];
 	__u8 extract[64];
+	unsigned long flags;
 
 	/* Generate a hash across the pool, 16 words (512 bits) at a time */
-	sha_init(hash);
+	sha_init(hash.w);
+	spin_lock_irqsave(&r->lock, flags);
 	for (i = 0; i < r->poolinfo->poolwords; i += 16)
-		sha_transform(hash, (__u8 *)(r->pool + i), workspace);
+		sha_transform(hash.w, (__u8 *)(r->pool + i), workspace);
 
 	/*
 	 * We mix the hash back into the pool to prevent backtracking
@@ -837,13 +916,14 @@
 	 * brute-forcing the feedback as hard as brute-forcing the
 	 * hash.
 	 */
-	mix_pool_bytes_extract(r, hash, sizeof(hash), extract);
+	__mix_pool_bytes(r, hash.w, sizeof(hash.w), extract);
+	spin_unlock_irqrestore(&r->lock, flags);
 
 	/*
 	 * To avoid duplicates, we atomically extract a portion of the
 	 * pool while mixing, and hash one final time.
 	 */
-	sha_transform(hash, extract, workspace);
+	sha_transform(hash.w, extract, workspace);
 	memset(extract, 0, sizeof(extract));
 	memset(workspace, 0, sizeof(workspace));
 
@@ -852,20 +932,32 @@
 	 * pattern, we fold it in half. Thus, we always feed back
 	 * twice as much data as we output.
 	 */
-	hash[0] ^= hash[3];
-	hash[1] ^= hash[4];
-	hash[2] ^= rol32(hash[2], 16);
-	memcpy(out, hash, EXTRACT_SIZE);
-	memset(hash, 0, sizeof(hash));
+	hash.w[0] ^= hash.w[3];
+	hash.w[1] ^= hash.w[4];
+	hash.w[2] ^= rol32(hash.w[2], 16);
+
+	/*
+	 * If we have a architectural hardware random number
+	 * generator, mix that in, too.
+	 */
+	for (i = 0; i < LONGS(EXTRACT_SIZE); i++) {
+		unsigned long v;
+		if (!arch_get_random_long(&v))
+			break;
+		hash.l[i] ^= v;
+	}
+
+	memcpy(out, &hash, EXTRACT_SIZE);
+	memset(&hash, 0, sizeof(hash));
 }
 
 static ssize_t extract_entropy(struct entropy_store *r, void *buf,
-			       size_t nbytes, int min, int reserved)
+				 size_t nbytes, int min, int reserved)
 {
 	ssize_t ret = 0, i;
 	__u8 tmp[EXTRACT_SIZE];
-	unsigned long flags;
 
+	trace_extract_entropy(r->name, nbytes, r->entropy_count, _RET_IP_);
 	xfer_secondary_pool(r, nbytes);
 	nbytes = account(r, nbytes, min, reserved);
 
@@ -873,6 +965,8 @@
 		extract_buf(r, tmp);
 
 		if (fips_enabled) {
+			unsigned long flags;
+
 			spin_lock_irqsave(&r->lock, flags);
 			if (!memcmp(tmp, r->last_data, EXTRACT_SIZE))
 				panic("Hardware RNG duplicated output!\n");
@@ -898,6 +992,7 @@
 	ssize_t ret = 0, i;
 	__u8 tmp[EXTRACT_SIZE];
 
+	trace_extract_entropy_user(r->name, nbytes, r->entropy_count, _RET_IP_);
 	xfer_secondary_pool(r, nbytes);
 	nbytes = account(r, nbytes, 0, 0);
 
@@ -931,17 +1026,35 @@
 
 /*
  * This function is the exported kernel interface.  It returns some
- * number of good random numbers, suitable for seeding TCP sequence
- * numbers, etc.
+ * number of good random numbers, suitable for key generation, seeding
+ * TCP sequence numbers, etc.  It does not use the hw random number
+ * generator, if available; use get_random_bytes_arch() for that.
  */
 void get_random_bytes(void *buf, int nbytes)
 {
+	extract_entropy(&nonblocking_pool, buf, nbytes, 0, 0);
+}
+EXPORT_SYMBOL(get_random_bytes);
+
+/*
+ * This function will use the architecture-specific hardware random
+ * number generator if it is available.  The arch-specific hw RNG will
+ * almost certainly be faster than what we can do in software, but it
+ * is impossible to verify that it is implemented securely (as
+ * opposed, to, say, the AES encryption of a sequence number using a
+ * key known by the NSA).  So it's useful if we need the speed, but
+ * only if we're willing to trust the hardware manufacturer not to
+ * have put in a back door.
+ */
+void get_random_bytes_arch(void *buf, int nbytes)
+{
 	char *p = buf;
 
+	trace_get_random_bytes(nbytes, _RET_IP_);
 	while (nbytes) {
 		unsigned long v;
 		int chunk = min(nbytes, (int)sizeof(unsigned long));
-		
+
 		if (!arch_get_random_long(&v))
 			break;
 		
@@ -950,9 +1063,11 @@
 		nbytes -= chunk;
 	}
 
-	extract_entropy(&nonblocking_pool, p, nbytes, 0, 0);
+	if (nbytes)
+		extract_entropy(&nonblocking_pool, p, nbytes, 0, 0);
 }
-EXPORT_SYMBOL(get_random_bytes);
+EXPORT_SYMBOL(get_random_bytes_arch);
+
 
 /*
  * init_std_data - initialize pool with system data
@@ -966,23 +1081,30 @@
 static void init_std_data(struct entropy_store *r)
 {
 	int i;
-	ktime_t now;
-	unsigned long flags;
+	ktime_t now = ktime_get_real();
+	unsigned long rv;
 
-	spin_lock_irqsave(&r->lock, flags);
 	r->entropy_count = 0;
-	spin_unlock_irqrestore(&r->lock, flags);
-
-	now = ktime_get_real();
-	mix_pool_bytes(r, &now, sizeof(now));
-	for (i = r->poolinfo->POOLBYTES; i > 0; i -= sizeof flags) {
-		if (!arch_get_random_long(&flags))
+	r->entropy_total = 0;
+	mix_pool_bytes(r, &now, sizeof(now), NULL);
+	for (i = r->poolinfo->POOLBYTES; i > 0; i -= sizeof(rv)) {
+		if (!arch_get_random_long(&rv))
 			break;
-		mix_pool_bytes(r, &flags, sizeof(flags));
+		mix_pool_bytes(r, &rv, sizeof(rv), NULL);
 	}
-	mix_pool_bytes(r, utsname(), sizeof(*(utsname())));
+	mix_pool_bytes(r, utsname(), sizeof(*(utsname())), NULL);
 }
 
+/*
+ * Note that setup_arch() may call add_device_randomness()
+ * long before we get here. This allows seeding of the pools
+ * with some platform dependent data very early in the boot
+ * process. But it limits our options here. We must use
+ * statically allocated structures that already have all
+ * initializations complete at compile time. We should also
+ * take care not to overwrite the precious per platform data
+ * we were given.
+ */
 static int rand_initialize(void)
 {
 	init_std_data(&input_pool);
@@ -992,24 +1114,6 @@
 }
 module_init(rand_initialize);
 
-void rand_initialize_irq(int irq)
-{
-	struct timer_rand_state *state;
-
-	state = get_timer_rand_state(irq);
-
-	if (state)
-		return;
-
-	/*
-	 * If kzalloc returns null, we just won't use that entropy
-	 * source.
-	 */
-	state = kzalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
-	if (state)
-		set_timer_rand_state(irq, state);
-}
-
 #ifdef CONFIG_BLOCK
 void rand_initialize_disk(struct gendisk *disk)
 {
@@ -1117,7 +1221,7 @@
 		count -= bytes;
 		p += bytes;
 
-		mix_pool_bytes(r, buf, bytes);
+		mix_pool_bytes(r, buf, bytes, NULL);
 		cond_resched();
 	}
 
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index ad7c732..08427ab 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -827,10 +827,10 @@
 int tpm_do_selftest(struct tpm_chip *chip)
 {
 	int rc;
-	u8 digest[TPM_DIGEST_SIZE];
 	unsigned int loops;
 	unsigned int delay_msec = 1000;
 	unsigned long duration;
+	struct tpm_cmd_t cmd;
 
 	duration = tpm_calc_ordinal_duration(chip,
 	                                     TPM_ORD_CONTINUE_SELFTEST);
@@ -845,7 +845,15 @@
 		return rc;
 
 	do {
-		rc = __tpm_pcr_read(chip, 0, digest);
+		/* Attempt to read a PCR value */
+		cmd.header.in = pcrread_header;
+		cmd.params.pcrread_in.pcr_idx = cpu_to_be32(0);
+		rc = tpm_transmit(chip, (u8 *) &cmd, READ_PCR_RESULT_SIZE);
+
+		if (rc < TPM_HEADER_SIZE)
+			return -EFAULT;
+
+		rc = be32_to_cpu(cmd.header.out.return_code);
 		if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
 			dev_info(chip->dev,
 				 "TPM is disabled/deactivated (0x%X)\n", rc);
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 9cf6f59..7f1ea56 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -834,18 +834,21 @@
 {
 	struct clk *child;
 	unsigned long old_rate;
+	unsigned long best_parent_rate = 0;
 	struct hlist_node *tmp;
 
 	old_rate = clk->rate;
 
+	if (clk->parent)
+		best_parent_rate = clk->parent->rate;
+
 	if (clk->ops->set_rate)
 		clk->ops->set_rate(clk->hw, clk->new_rate);
 
 	if (clk->ops->recalc_rate)
-		clk->rate = clk->ops->recalc_rate(clk->hw,
-				clk->parent->rate);
+		clk->rate = clk->ops->recalc_rate(clk->hw, best_parent_rate);
 	else
-		clk->rate = clk->parent->rate;
+		clk->rate = best_parent_rate;
 
 	if (clk->notifier_count && old_rate != clk->rate)
 		__clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate);
@@ -997,7 +1000,7 @@
 
 	if (!clk->parents)
 		clk->parents =
-			kmalloc((sizeof(struct clk*) * clk->num_parents),
+			kzalloc((sizeof(struct clk*) * clk->num_parents),
 					GFP_KERNEL);
 
 	if (!clk->parents)
@@ -1062,21 +1065,24 @@
 
 	old_parent = clk->parent;
 
-	/* find index of new parent clock using cached parent ptrs */
-	for (i = 0; i < clk->num_parents; i++)
-		if (clk->parents[i] == parent)
-			break;
+	if (!clk->parents)
+		clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents),
+								GFP_KERNEL);
 
 	/*
-	 * find index of new parent clock using string name comparison
-	 * also try to cache the parent to avoid future calls to __clk_lookup
+	 * find index of new parent clock using cached parent ptrs,
+	 * or if not yet cached, use string name comparison and cache
+	 * them now to avoid future calls to __clk_lookup.
 	 */
-	if (i == clk->num_parents)
-		for (i = 0; i < clk->num_parents; i++)
-			if (!strcmp(clk->parent_names[i], parent->name)) {
+	for (i = 0; i < clk->num_parents; i++) {
+		if (clk->parents && clk->parents[i] == parent)
+			break;
+		else if (!strcmp(clk->parent_names[i], parent->name)) {
+			if (clk->parents)
 				clk->parents[i] = __clk_lookup(parent->name);
-				break;
-			}
+			break;
+		}
+	}
 
 	if (i == clk->num_parents) {
 		pr_debug("%s: clock %s is not a possible parent of clock %s\n",
diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c
index f834ea8..726765b 100644
--- a/drivers/cpufreq/cpufreq_interactive.c
+++ b/drivers/cpufreq/cpufreq_interactive.c
@@ -20,97 +20,102 @@
 #include <linux/cpumask.h>
 #include <linux/cpufreq.h>
 #include <linux/module.h>
-#include <linux/mutex.h>
+#include <linux/moduleparam.h>
+#include <linux/rwsem.h>
 #include <linux/sched.h>
 #include <linux/tick.h>
 #include <linux/time.h>
 #include <linux/timer.h>
 #include <linux/workqueue.h>
 #include <linux/kthread.h>
-#include <linux/mutex.h>
 #include <linux/slab.h>
-#include <linux/input.h>
+#include <linux/kernel_stat.h>
 #include <asm/cputime.h>
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/cpufreq_interactive.h>
 
-static atomic_t active_count = ATOMIC_INIT(0);
+static int active_count;
 
 struct cpufreq_interactive_cpuinfo {
 	struct timer_list cpu_timer;
-	int timer_idlecancel;
+	struct timer_list cpu_slack_timer;
+	spinlock_t load_lock; /* protects the next 4 fields */
 	u64 time_in_idle;
-	u64 idle_exit_time;
-	u64 timer_run_time;
-	int idling;
-	u64 target_set_time;
-	u64 target_set_time_in_idle;
+	u64 time_in_idle_timestamp;
+	u64 cputime_speedadj;
+	u64 cputime_speedadj_timestamp;
 	struct cpufreq_policy *policy;
 	struct cpufreq_frequency_table *freq_table;
 	unsigned int target_freq;
 	unsigned int floor_freq;
 	u64 floor_validate_time;
 	u64 hispeed_validate_time;
+	struct rw_semaphore enable_sem;
 	int governor_enabled;
+	int cpu_load;
 };
 
 static DEFINE_PER_CPU(struct cpufreq_interactive_cpuinfo, cpuinfo);
 
-/* Workqueues handle frequency scaling */
-static struct task_struct *up_task;
-static struct workqueue_struct *down_wq;
-static struct work_struct freq_scale_down_work;
-static cpumask_t up_cpumask;
-static spinlock_t up_cpumask_lock;
-static cpumask_t down_cpumask;
-static spinlock_t down_cpumask_lock;
-static struct mutex set_speed_lock;
+/* realtime thread handles frequency scaling */
+static struct task_struct *speedchange_task;
+static cpumask_t speedchange_cpumask;
+static spinlock_t speedchange_cpumask_lock;
+static struct mutex gov_lock;
 
 /* Hi speed to bump to from lo speed when load burst (default max) */
-static u64 hispeed_freq;
+static unsigned int hispeed_freq;
 
 /* Go to hi speed when CPU load at or above this value. */
-#define DEFAULT_GO_HISPEED_LOAD 85
-static unsigned long go_hispeed_load;
+#define DEFAULT_GO_HISPEED_LOAD 99
+static unsigned long go_hispeed_load = DEFAULT_GO_HISPEED_LOAD;
+
+/* Target load.  Lower values result in higher CPU speeds. */
+#define DEFAULT_TARGET_LOAD 90
+static unsigned int default_target_loads[] = {DEFAULT_TARGET_LOAD};
+static spinlock_t target_loads_lock;
+static unsigned int *target_loads = default_target_loads;
+static int ntarget_loads = ARRAY_SIZE(default_target_loads);
 
 /*
  * The minimum amount of time to spend at a frequency before we can ramp down.
  */
 #define DEFAULT_MIN_SAMPLE_TIME (80 * USEC_PER_MSEC)
-static unsigned long min_sample_time;
+static unsigned long min_sample_time = DEFAULT_MIN_SAMPLE_TIME;
 
 /*
  * The sample rate of the timer used to increase frequency
  */
 #define DEFAULT_TIMER_RATE (20 * USEC_PER_MSEC)
-static unsigned long timer_rate;
+static unsigned long timer_rate = DEFAULT_TIMER_RATE;
 
 /*
  * Wait this long before raising speed above hispeed, by default a single
  * timer interval.
  */
 #define DEFAULT_ABOVE_HISPEED_DELAY DEFAULT_TIMER_RATE
-static unsigned long above_hispeed_delay_val;
+static unsigned int default_above_hispeed_delay[] = {
+	DEFAULT_ABOVE_HISPEED_DELAY };
+static spinlock_t above_hispeed_delay_lock;
+static unsigned int *above_hispeed_delay = default_above_hispeed_delay;
+static int nabove_hispeed_delay = ARRAY_SIZE(default_above_hispeed_delay);
 
-/*
- * Boost pulse to hispeed on touchscreen input.
- */
-
-static int input_boost_val;
-
-struct cpufreq_interactive_inputopen {
-	struct input_handle *handle;
-	struct work_struct inputopen_work;
-};
-
-static struct cpufreq_interactive_inputopen inputopen;
-
-/*
- * Non-zero means longer-term speed boost active.
- */
-
+/* Non-zero means indefinite speed boost active */
 static int boost_val;
+/* Duration of a boot pulse in usecs */
+static int boostpulse_duration_val = DEFAULT_MIN_SAMPLE_TIME;
+/* End time of boost pulse in ktime converted to usecs */
+static u64 boostpulse_endtime;
+
+/*
+ * Max additional time to wait in idle, beyond timer_rate, at speeds above
+ * minimum before wakeup to reduce speed, or -1 if unnecessary.
+ */
+#define DEFAULT_TIMER_SLACK (4 * DEFAULT_TIMER_RATE)
+static int timer_slack_val = DEFAULT_TIMER_SLACK;
+
+static bool io_is_busy;
 
 static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
 		unsigned int event);
@@ -125,104 +130,266 @@
 	.owner = THIS_MODULE,
 };
 
-static void cpufreq_interactive_timer(unsigned long data)
+static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,
+						  cputime64_t *wall)
 {
-	unsigned int delta_idle;
-	unsigned int delta_time;
-	int cpu_load;
-	int load_since_change;
-	u64 time_in_idle;
-	u64 idle_exit_time;
-	struct cpufreq_interactive_cpuinfo *pcpu =
-		&per_cpu(cpuinfo, data);
-	u64 now_idle;
-	unsigned int new_freq;
-	unsigned int index;
+	u64 idle_time;
+	u64 cur_wall_time;
+	u64 busy_time;
+
+	cur_wall_time = jiffies64_to_cputime64(get_jiffies_64());
+
+	busy_time  = kcpustat_cpu(cpu).cpustat[CPUTIME_USER];
+	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SYSTEM];
+	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_IRQ];
+	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_SOFTIRQ];
+	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL];
+	busy_time += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE];
+
+	idle_time = cur_wall_time - busy_time;
+	if (wall)
+		*wall = jiffies_to_usecs(cur_wall_time);
+
+	return jiffies_to_usecs(idle_time);
+}
+
+static inline cputime64_t get_cpu_idle_time(unsigned int cpu,
+					    cputime64_t *wall)
+{
+	u64 idle_time = get_cpu_idle_time_us(cpu, wall);
+
+	if (idle_time == -1ULL)
+		idle_time = get_cpu_idle_time_jiffy(cpu, wall);
+	else if (!io_is_busy)
+		idle_time += get_cpu_iowait_time_us(cpu, wall);
+
+	return idle_time;
+}
+
+static void cpufreq_interactive_timer_resched(
+	struct cpufreq_interactive_cpuinfo *pcpu)
+{
+	unsigned long expires = jiffies + usecs_to_jiffies(timer_rate);
 	unsigned long flags;
 
-	smp_rmb();
+	mod_timer_pinned(&pcpu->cpu_timer, expires);
+	if (timer_slack_val >= 0 && pcpu->target_freq > pcpu->policy->min) {
+		expires += usecs_to_jiffies(timer_slack_val);
+		mod_timer_pinned(&pcpu->cpu_slack_timer, expires);
+	}
 
+	spin_lock_irqsave(&pcpu->load_lock, flags);
+	pcpu->time_in_idle =
+		get_cpu_idle_time(smp_processor_id(),
+				     &pcpu->time_in_idle_timestamp);
+	pcpu->cputime_speedadj = 0;
+	pcpu->cputime_speedadj_timestamp = pcpu->time_in_idle_timestamp;
+	spin_unlock_irqrestore(&pcpu->load_lock, flags);
+}
+
+static unsigned int freq_to_above_hispeed_delay(unsigned int freq)
+{
+	int i;
+	unsigned int ret;
+	unsigned long flags;
+
+	spin_lock_irqsave(&above_hispeed_delay_lock, flags);
+
+	for (i = 0; i < nabove_hispeed_delay - 1 &&
+			freq >= above_hispeed_delay[i+1]; i += 2)
+		;
+
+	ret = above_hispeed_delay[i];
+	spin_unlock_irqrestore(&above_hispeed_delay_lock, flags);
+	return ret;
+}
+
+static unsigned int freq_to_targetload(unsigned int freq)
+{
+	int i;
+	unsigned int ret;
+	unsigned long flags;
+
+	spin_lock_irqsave(&target_loads_lock, flags);
+
+	for (i = 0; i < ntarget_loads - 1 && freq >= target_loads[i+1]; i += 2)
+		;
+
+	ret = target_loads[i];
+	spin_unlock_irqrestore(&target_loads_lock, flags);
+	return ret;
+}
+
+/*
+ * If increasing frequencies never map to a lower target load then
+ * choose_freq() will find the minimum frequency that does not exceed its
+ * target load given the current load.
+ */
+
+static unsigned int choose_freq(
+	struct cpufreq_interactive_cpuinfo *pcpu, unsigned int loadadjfreq)
+{
+	unsigned int freq = pcpu->policy->cur;
+	unsigned int prevfreq, freqmin, freqmax;
+	unsigned int tl;
+	int index;
+
+	freqmin = 0;
+	freqmax = UINT_MAX;
+
+	do {
+		prevfreq = freq;
+		tl = freq_to_targetload(freq);
+
+		/*
+		 * Find the lowest frequency where the computed load is less
+		 * than or equal to the target load.
+		 */
+
+		cpufreq_frequency_table_target(
+			pcpu->policy, pcpu->freq_table, loadadjfreq / tl,
+			CPUFREQ_RELATION_L, &index);
+		freq = pcpu->freq_table[index].frequency;
+
+		if (freq > prevfreq) {
+			/* The previous frequency is too low. */
+			freqmin = prevfreq;
+
+			if (freq >= freqmax) {
+				/*
+				 * Find the highest frequency that is less
+				 * than freqmax.
+				 */
+				cpufreq_frequency_table_target(
+					pcpu->policy, pcpu->freq_table,
+					freqmax - 1, CPUFREQ_RELATION_H,
+					&index);
+				freq = pcpu->freq_table[index].frequency;
+
+				if (freq == freqmin) {
+					/*
+					 * The first frequency below freqmax
+					 * has already been found to be too
+					 * low.  freqmax is the lowest speed
+					 * we found that is fast enough.
+					 */
+					freq = freqmax;
+					break;
+				}
+			}
+		} else if (freq < prevfreq) {
+			/* The previous frequency is high enough. */
+			freqmax = prevfreq;
+
+			if (freq <= freqmin) {
+				/*
+				 * Find the lowest frequency that is higher
+				 * than freqmin.
+				 */
+				cpufreq_frequency_table_target(
+					pcpu->policy, pcpu->freq_table,
+					freqmin + 1, CPUFREQ_RELATION_L,
+					&index);
+				freq = pcpu->freq_table[index].frequency;
+
+				/*
+				 * If freqmax is the first frequency above
+				 * freqmin then we have already found that
+				 * this speed is fast enough.
+				 */
+				if (freq == freqmax)
+					break;
+			}
+		}
+
+		/* If same frequency chosen as previous then done. */
+	} while (freq != prevfreq);
+
+	return freq;
+}
+
+static u64 update_load(int cpu)
+{
+	struct cpufreq_interactive_cpuinfo *pcpu = &per_cpu(cpuinfo, cpu);
+	u64 now;
+	u64 now_idle;
+	unsigned int delta_idle;
+	unsigned int delta_time;
+	u64 active_time;
+
+	now_idle = get_cpu_idle_time(cpu, &now);
+	delta_idle = (unsigned int)(now_idle - pcpu->time_in_idle);
+	delta_time = (unsigned int)(now - pcpu->time_in_idle_timestamp);
+	active_time = delta_time - delta_idle;
+	pcpu->cputime_speedadj += active_time * pcpu->policy->cur;
+
+	pcpu->time_in_idle = now_idle;
+	pcpu->time_in_idle_timestamp = now;
+	return now;
+}
+
+static void cpufreq_interactive_timer(unsigned long data)
+{
+	u64 now;
+	unsigned int delta_time;
+	u64 cputime_speedadj;
+	int cpu_load;
+	struct cpufreq_interactive_cpuinfo *pcpu =
+		&per_cpu(cpuinfo, data);
+	unsigned int new_freq;
+	unsigned int loadadjfreq;
+	unsigned int index;
+	unsigned long flags;
+	bool boosted;
+
+	if (!down_read_trylock(&pcpu->enable_sem))
+		return;
 	if (!pcpu->governor_enabled)
 		goto exit;
 
-	/*
-	 * Once pcpu->timer_run_time is updated to >= pcpu->idle_exit_time,
-	 * this lets idle exit know the current idle time sample has
-	 * been processed, and idle exit can generate a new sample and
-	 * re-arm the timer.  This prevents a concurrent idle
-	 * exit on that CPU from writing a new set of info at the same time
-	 * the timer function runs (the timer function can't use that info
-	 * until more time passes).
-	 */
-	time_in_idle = pcpu->time_in_idle;
-	idle_exit_time = pcpu->idle_exit_time;
-	now_idle = get_cpu_idle_time_us(data, &pcpu->timer_run_time);
-	smp_wmb();
+	spin_lock_irqsave(&pcpu->load_lock, flags);
+	now = update_load(data);
+	delta_time = (unsigned int)(now - pcpu->cputime_speedadj_timestamp);
+	cputime_speedadj = pcpu->cputime_speedadj;
+	spin_unlock_irqrestore(&pcpu->load_lock, flags);
 
-	/* If we raced with cancelling a timer, skip. */
-	if (!idle_exit_time)
-		goto exit;
-
-	delta_idle = (unsigned int)(now_idle - time_in_idle);
-	delta_time = (unsigned int)(pcpu->timer_run_time - idle_exit_time);
-
-	/*
-	 * If timer ran less than 1ms after short-term sample started, retry.
-	 */
-	if (delta_time < 1000)
+	if (WARN_ON_ONCE(!delta_time))
 		goto rearm;
 
-	if (delta_idle > delta_time)
-		cpu_load = 0;
-	else
-		cpu_load = 100 * (delta_time - delta_idle) / delta_time;
+	do_div(cputime_speedadj, delta_time);
+	loadadjfreq = (unsigned int)cputime_speedadj * 100;
+	cpu_load = loadadjfreq / pcpu->target_freq;
+	boosted = boost_val || now < boostpulse_endtime;
 
-	delta_idle = (unsigned int)(now_idle - pcpu->target_set_time_in_idle);
-	delta_time = (unsigned int)(pcpu->timer_run_time -
-				    pcpu->target_set_time);
+	pcpu->cpu_load = cpu_load;
 
-	if ((delta_time == 0) || (delta_idle > delta_time))
-		load_since_change = 0;
-	else
-		load_since_change =
-			100 * (delta_time - delta_idle) / delta_time;
-
-	/*
-	 * Choose greater of short-term load (since last idle timer
-	 * started or timer function re-armed itself) or long-term load
-	 * (since last frequency change).
-	 */
-	if (load_since_change > cpu_load)
-		cpu_load = load_since_change;
-
-	if (cpu_load >= go_hispeed_load || boost_val) {
-		if (pcpu->target_freq <= pcpu->policy->min) {
+	if (cpu_load >= go_hispeed_load || boosted) {
+		if (pcpu->target_freq < hispeed_freq) {
 			new_freq = hispeed_freq;
 		} else {
-			new_freq = pcpu->policy->max * cpu_load / 100;
+			new_freq = choose_freq(pcpu, loadadjfreq);
 
 			if (new_freq < hispeed_freq)
 				new_freq = hispeed_freq;
-
-			if (pcpu->target_freq == hispeed_freq &&
-			    new_freq > hispeed_freq &&
-			    pcpu->timer_run_time - pcpu->hispeed_validate_time
-			    < above_hispeed_delay_val) {
-				trace_cpufreq_interactive_notyet(data, cpu_load,
-								 pcpu->target_freq,
-								 new_freq);
-				goto rearm;
-			}
 		}
 	} else {
-		new_freq = pcpu->policy->max * cpu_load / 100;
+		new_freq = choose_freq(pcpu, loadadjfreq);
 	}
 
-	if (new_freq <= hispeed_freq)
-		pcpu->hispeed_validate_time = pcpu->timer_run_time;
+	if (pcpu->target_freq >= hispeed_freq &&
+	    new_freq > pcpu->target_freq &&
+	    now - pcpu->hispeed_validate_time <
+	    freq_to_above_hispeed_delay(pcpu->target_freq)) {
+		trace_cpufreq_interactive_notyet(
+			data, cpu_load, pcpu->target_freq,
+			pcpu->policy->cur, new_freq);
+		goto rearm;
+	}
+
+	pcpu->hispeed_validate_time = now;
 
 	if (cpufreq_frequency_table_target(pcpu->policy, pcpu->freq_table,
-					   new_freq, CPUFREQ_RELATION_H,
+					   new_freq, CPUFREQ_RELATION_L,
 					   &index)) {
 		pr_warn_once("timer %d: cpufreq_frequency_table_target error\n",
 			     (int) data);
@@ -236,41 +403,42 @@
 	 * floor frequency for the minimum sample time since last validated.
 	 */
 	if (new_freq < pcpu->floor_freq) {
-		if (pcpu->timer_run_time - pcpu->floor_validate_time
-		    < min_sample_time) {
-			trace_cpufreq_interactive_notyet(data, cpu_load,
-					 pcpu->target_freq, new_freq);
+		if (now - pcpu->floor_validate_time < min_sample_time) {
+			trace_cpufreq_interactive_notyet(
+				data, cpu_load, pcpu->target_freq,
+				pcpu->policy->cur, new_freq);
 			goto rearm;
 		}
 	}
 
-	pcpu->floor_freq = new_freq;
-	pcpu->floor_validate_time = pcpu->timer_run_time;
+	/*
+	 * Update the timestamp for checking whether speed has been held at
+	 * or above the selected frequency for a minimum of min_sample_time,
+	 * if not boosted to hispeed_freq.  If boosted to hispeed_freq then we
+	 * allow the speed to drop as soon as the boostpulse duration expires
+	 * (or the indefinite boost is turned off).
+	 */
+
+	if (!boosted || new_freq > hispeed_freq) {
+		pcpu->floor_freq = new_freq;
+		pcpu->floor_validate_time = now;
+	}
 
 	if (pcpu->target_freq == new_freq) {
-		trace_cpufreq_interactive_already(data, cpu_load,
-						  pcpu->target_freq, new_freq);
+		trace_cpufreq_interactive_already(
+			data, cpu_load, pcpu->target_freq,
+			pcpu->policy->cur, new_freq);
 		goto rearm_if_notmax;
 	}
 
 	trace_cpufreq_interactive_target(data, cpu_load, pcpu->target_freq,
-					 new_freq);
-	pcpu->target_set_time_in_idle = now_idle;
-	pcpu->target_set_time = pcpu->timer_run_time;
+					 pcpu->policy->cur, new_freq);
 
-	if (new_freq < pcpu->target_freq) {
-		pcpu->target_freq = new_freq;
-		spin_lock_irqsave(&down_cpumask_lock, flags);
-		cpumask_set_cpu(data, &down_cpumask);
-		spin_unlock_irqrestore(&down_cpumask_lock, flags);
-		queue_work(down_wq, &freq_scale_down_work);
-	} else {
-		pcpu->target_freq = new_freq;
-		spin_lock_irqsave(&up_cpumask_lock, flags);
-		cpumask_set_cpu(data, &up_cpumask);
-		spin_unlock_irqrestore(&up_cpumask_lock, flags);
-		wake_up_process(up_task);
-	}
+	pcpu->target_freq = new_freq;
+	spin_lock_irqsave(&speedchange_cpumask_lock, flags);
+	cpumask_set_cpu(data, &speedchange_cpumask);
+	spin_unlock_irqrestore(&speedchange_cpumask_lock, flags);
+	wake_up_process(speedchange_task);
 
 rearm_if_notmax:
 	/*
@@ -281,28 +449,11 @@
 		goto exit;
 
 rearm:
-	if (!timer_pending(&pcpu->cpu_timer)) {
-		/*
-		 * If already at min: if that CPU is idle, don't set timer.
-		 * Else cancel the timer if that CPU goes idle.  We don't
-		 * need to re-evaluate speed until the next idle exit.
-		 */
-		if (pcpu->target_freq == pcpu->policy->min) {
-			smp_rmb();
-
-			if (pcpu->idling)
-				goto exit;
-
-			pcpu->timer_idlecancel = 1;
-		}
-
-		pcpu->time_in_idle = get_cpu_idle_time_us(
-			data, &pcpu->idle_exit_time);
-		mod_timer(&pcpu->cpu_timer,
-			  jiffies + usecs_to_jiffies(timer_rate));
-	}
+	if (!timer_pending(&pcpu->cpu_timer))
+		cpufreq_interactive_timer_resched(pcpu);
 
 exit:
+	up_read(&pcpu->enable_sem);
 	return;
 }
 
@@ -312,15 +463,16 @@
 		&per_cpu(cpuinfo, smp_processor_id());
 	int pending;
 
-	if (!pcpu->governor_enabled)
+	if (!down_read_trylock(&pcpu->enable_sem))
 		return;
+	if (!pcpu->governor_enabled) {
+		up_read(&pcpu->enable_sem);
+		return;
+	}
 
-	pcpu->idling = 1;
-	smp_wmb();
 	pending = timer_pending(&pcpu->cpu_timer);
 
 	if (pcpu->target_freq != pcpu->policy->min) {
-#ifdef CONFIG_SMP
 		/*
 		 * Entering idle while not at lowest speed.  On some
 		 * platforms this can hold the other CPU(s) at that speed
@@ -329,33 +481,11 @@
 		 * min indefinitely.  This should probably be a quirk of
 		 * the CPUFreq driver.
 		 */
-		if (!pending) {
-			pcpu->time_in_idle = get_cpu_idle_time_us(
-				smp_processor_id(), &pcpu->idle_exit_time);
-			pcpu->timer_idlecancel = 0;
-			mod_timer(&pcpu->cpu_timer,
-				  jiffies + usecs_to_jiffies(timer_rate));
-		}
-#endif
-	} else {
-		/*
-		 * If at min speed and entering idle after load has
-		 * already been evaluated, and a timer has been set just in
-		 * case the CPU suddenly goes busy, cancel that timer.  The
-		 * CPU didn't go busy; we'll recheck things upon idle exit.
-		 */
-		if (pending && pcpu->timer_idlecancel) {
-			del_timer(&pcpu->cpu_timer);
-			/*
-			 * Ensure last timer run time is after current idle
-			 * sample start time, so next idle exit will always
-			 * start a new idle sampling period.
-			 */
-			pcpu->idle_exit_time = 0;
-			pcpu->timer_idlecancel = 0;
-		}
+		if (!pending)
+			cpufreq_interactive_timer_resched(pcpu);
 	}
 
+	up_read(&pcpu->enable_sem);
 }
 
 static void cpufreq_interactive_idle_end(void)
@@ -363,34 +493,26 @@
 	struct cpufreq_interactive_cpuinfo *pcpu =
 		&per_cpu(cpuinfo, smp_processor_id());
 
-	pcpu->idling = 0;
-	smp_wmb();
-
-	/*
-	 * Arm the timer for 1-2 ticks later if not already, and if the timer
-	 * function has already processed the previous load sampling
-	 * interval.  (If the timer is not pending but has not processed
-	 * the previous interval, it is probably racing with us on another
-	 * CPU.  Let it compute load based on the previous sample and then
-	 * re-arm the timer for another interval when it's done, rather
-	 * than updating the interval start time to be "now", which doesn't
-	 * give the timer function enough time to make a decision on this
-	 * run.)
-	 */
-	if (timer_pending(&pcpu->cpu_timer) == 0 &&
-	    pcpu->timer_run_time >= pcpu->idle_exit_time &&
-	    pcpu->governor_enabled) {
-		pcpu->time_in_idle =
-			get_cpu_idle_time_us(smp_processor_id(),
-					     &pcpu->idle_exit_time);
-		pcpu->timer_idlecancel = 0;
-		mod_timer(&pcpu->cpu_timer,
-			  jiffies + usecs_to_jiffies(timer_rate));
+	if (!down_read_trylock(&pcpu->enable_sem))
+		return;
+	if (!pcpu->governor_enabled) {
+		up_read(&pcpu->enable_sem);
+		return;
 	}
 
+	/* Arm the timer for 1-2 ticks later if not already. */
+	if (!timer_pending(&pcpu->cpu_timer)) {
+		cpufreq_interactive_timer_resched(pcpu);
+	} else if (time_after_eq(jiffies, pcpu->cpu_timer.expires)) {
+		del_timer(&pcpu->cpu_timer);
+		del_timer(&pcpu->cpu_slack_timer);
+		cpufreq_interactive_timer(smp_processor_id());
+	}
+
+	up_read(&pcpu->enable_sem);
 }
 
-static int cpufreq_interactive_up_task(void *data)
+static int cpufreq_interactive_speedchange_task(void *data)
 {
 	unsigned int cpu;
 	cpumask_t tmp_mask;
@@ -399,34 +521,35 @@
 
 	while (1) {
 		set_current_state(TASK_INTERRUPTIBLE);
-		spin_lock_irqsave(&up_cpumask_lock, flags);
+		spin_lock_irqsave(&speedchange_cpumask_lock, flags);
 
-		if (cpumask_empty(&up_cpumask)) {
-			spin_unlock_irqrestore(&up_cpumask_lock, flags);
+		if (cpumask_empty(&speedchange_cpumask)) {
+			spin_unlock_irqrestore(&speedchange_cpumask_lock,
+					       flags);
 			schedule();
 
 			if (kthread_should_stop())
 				break;
 
-			spin_lock_irqsave(&up_cpumask_lock, flags);
+			spin_lock_irqsave(&speedchange_cpumask_lock, flags);
 		}
 
 		set_current_state(TASK_RUNNING);
-		tmp_mask = up_cpumask;
-		cpumask_clear(&up_cpumask);
-		spin_unlock_irqrestore(&up_cpumask_lock, flags);
+		tmp_mask = speedchange_cpumask;
+		cpumask_clear(&speedchange_cpumask);
+		spin_unlock_irqrestore(&speedchange_cpumask_lock, flags);
 
 		for_each_cpu(cpu, &tmp_mask) {
 			unsigned int j;
 			unsigned int max_freq = 0;
 
 			pcpu = &per_cpu(cpuinfo, cpu);
-			smp_rmb();
-
-			if (!pcpu->governor_enabled)
+			if (!down_read_trylock(&pcpu->enable_sem))
 				continue;
-
-			mutex_lock(&set_speed_lock);
+			if (!pcpu->governor_enabled) {
+				up_read(&pcpu->enable_sem);
+				continue;
+			}
 
 			for_each_cpu(j, pcpu->policy->cpus) {
 				struct cpufreq_interactive_cpuinfo *pjcpu =
@@ -434,63 +557,25 @@
 
 				if (pjcpu->target_freq > max_freq)
 					max_freq = pjcpu->target_freq;
+
+				cpufreq_notify_utilization(pcpu->policy, (pcpu->cpu_load * pcpu->policy->cur) / pcpu->policy->cpuinfo.max_freq);
 			}
 
 			if (max_freq != pcpu->policy->cur)
 				__cpufreq_driver_target(pcpu->policy,
 							max_freq,
 							CPUFREQ_RELATION_H);
-			mutex_unlock(&set_speed_lock);
-			trace_cpufreq_interactive_up(cpu, pcpu->target_freq,
+			trace_cpufreq_interactive_setspeed(cpu,
+						     pcpu->target_freq,
 						     pcpu->policy->cur);
+
+			up_read(&pcpu->enable_sem);
 		}
 	}
 
 	return 0;
 }
 
-static void cpufreq_interactive_freq_down(struct work_struct *work)
-{
-	unsigned int cpu;
-	cpumask_t tmp_mask;
-	unsigned long flags;
-	struct cpufreq_interactive_cpuinfo *pcpu;
-
-	spin_lock_irqsave(&down_cpumask_lock, flags);
-	tmp_mask = down_cpumask;
-	cpumask_clear(&down_cpumask);
-	spin_unlock_irqrestore(&down_cpumask_lock, flags);
-
-	for_each_cpu(cpu, &tmp_mask) {
-		unsigned int j;
-		unsigned int max_freq = 0;
-
-		pcpu = &per_cpu(cpuinfo, cpu);
-		smp_rmb();
-
-		if (!pcpu->governor_enabled)
-			continue;
-
-		mutex_lock(&set_speed_lock);
-
-		for_each_cpu(j, pcpu->policy->cpus) {
-			struct cpufreq_interactive_cpuinfo *pjcpu =
-				&per_cpu(cpuinfo, j);
-
-			if (pjcpu->target_freq > max_freq)
-				max_freq = pjcpu->target_freq;
-		}
-
-		if (max_freq != pcpu->policy->cur)
-			__cpufreq_driver_target(pcpu->policy, max_freq,
-						CPUFREQ_RELATION_H);
-
-		mutex_unlock(&set_speed_lock);
-		trace_cpufreq_interactive_down(cpu, pcpu->target_freq,
-					       pcpu->policy->cur);
-	}
-}
-
 static void cpufreq_interactive_boost(void)
 {
 	int i;
@@ -498,17 +583,16 @@
 	unsigned long flags;
 	struct cpufreq_interactive_cpuinfo *pcpu;
 
-	spin_lock_irqsave(&up_cpumask_lock, flags);
+	spin_lock_irqsave(&speedchange_cpumask_lock, flags);
 
 	for_each_online_cpu(i) {
 		pcpu = &per_cpu(cpuinfo, i);
 
 		if (pcpu->target_freq < hispeed_freq) {
 			pcpu->target_freq = hispeed_freq;
-			cpumask_set_cpu(i, &up_cpumask);
-			pcpu->target_set_time_in_idle =
-				get_cpu_idle_time_us(i, &pcpu->target_set_time);
-			pcpu->hispeed_validate_time = pcpu->target_set_time;
+			cpumask_set_cpu(i, &speedchange_cpumask);
+			pcpu->hispeed_validate_time =
+				ktime_to_us(ktime_get());
 			anyboost = 1;
 		}
 
@@ -521,106 +605,182 @@
 		pcpu->floor_validate_time = ktime_to_us(ktime_get());
 	}
 
-	spin_unlock_irqrestore(&up_cpumask_lock, flags);
+	spin_unlock_irqrestore(&speedchange_cpumask_lock, flags);
 
 	if (anyboost)
-		wake_up_process(up_task);
+		wake_up_process(speedchange_task);
 }
 
-/*
- * Pulsed boost on input event raises CPUs to hispeed_freq and lets
- * usual algorithm of min_sample_time  decide when to allow speed
- * to drop.
- */
-
-static void cpufreq_interactive_input_event(struct input_handle *handle,
-					    unsigned int type,
-					    unsigned int code, int value)
+static int cpufreq_interactive_notifier(
+	struct notifier_block *nb, unsigned long val, void *data)
 {
-	if (input_boost_val && type == EV_SYN && code == SYN_REPORT) {
-		trace_cpufreq_interactive_boost("input");
-		cpufreq_interactive_boost();
+	struct cpufreq_freqs *freq = data;
+	struct cpufreq_interactive_cpuinfo *pcpu;
+	int cpu;
+	unsigned long flags;
+
+	if (val == CPUFREQ_POSTCHANGE) {
+		pcpu = &per_cpu(cpuinfo, freq->cpu);
+		if (!down_read_trylock(&pcpu->enable_sem))
+			return 0;
+		if (!pcpu->governor_enabled) {
+			up_read(&pcpu->enable_sem);
+			return 0;
+		}
+
+		for_each_cpu(cpu, pcpu->policy->cpus) {
+			struct cpufreq_interactive_cpuinfo *pjcpu =
+				&per_cpu(cpuinfo, cpu);
+			spin_lock_irqsave(&pjcpu->load_lock, flags);
+			update_load(cpu);
+			spin_unlock_irqrestore(&pjcpu->load_lock, flags);
+		}
+
+		up_read(&pcpu->enable_sem);
 	}
+	return 0;
 }
 
-static void cpufreq_interactive_input_open(struct work_struct *w)
+static struct notifier_block cpufreq_notifier_block = {
+	.notifier_call = cpufreq_interactive_notifier,
+};
+
+static unsigned int *get_tokenized_data(const char *buf, int *num_tokens)
 {
-	struct cpufreq_interactive_inputopen *io =
-		container_of(w, struct cpufreq_interactive_inputopen,
-			     inputopen_work);
-	int error;
+	const char *cp;
+	int i;
+	int ntokens = 1;
+	unsigned int *tokenized_data;
+	int err = -EINVAL;
 
-	error = input_open_device(io->handle);
-	if (error)
-		input_unregister_handle(io->handle);
-}
+	cp = buf;
+	while ((cp = strpbrk(cp + 1, " :")))
+		ntokens++;
 
-static int cpufreq_interactive_input_connect(struct input_handler *handler,
-					     struct input_dev *dev,
-					     const struct input_device_id *id)
-{
-	struct input_handle *handle;
-	int error;
-
-	pr_info("%s: connect to %s\n", __func__, dev->name);
-	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
-	if (!handle)
-		return -ENOMEM;
-
-	handle->dev = dev;
-	handle->handler = handler;
-	handle->name = "cpufreq_interactive";
-
-	error = input_register_handle(handle);
-	if (error)
+	if (!(ntokens & 0x1))
 		goto err;
 
-	inputopen.handle = handle;
-	queue_work(down_wq, &inputopen.inputopen_work);
-	return 0;
+	tokenized_data = kmalloc(ntokens * sizeof(unsigned int), GFP_KERNEL);
+	if (!tokenized_data) {
+		err = -ENOMEM;
+		goto err;
+	}
+
+	cp = buf;
+	i = 0;
+	while (i < ntokens) {
+		if (sscanf(cp, "%u", &tokenized_data[i++]) != 1)
+			goto err_kfree;
+
+		cp = strpbrk(cp, " :");
+		if (!cp)
+			break;
+		cp++;
+	}
+
+	if (i != ntokens)
+		goto err_kfree;
+
+	*num_tokens = ntokens;
+	return tokenized_data;
+
+err_kfree:
+	kfree(tokenized_data);
 err:
-	kfree(handle);
-	return error;
+	return ERR_PTR(err);
 }
 
-static void cpufreq_interactive_input_disconnect(struct input_handle *handle)
+static ssize_t show_target_loads(
+	struct kobject *kobj, struct attribute *attr, char *buf)
 {
-	input_close_device(handle);
-	input_unregister_handle(handle);
-	kfree(handle);
+	int i;
+	ssize_t ret = 0;
+	unsigned long flags;
+
+	spin_lock_irqsave(&target_loads_lock, flags);
+
+	for (i = 0; i < ntarget_loads; i++)
+		ret += sprintf(buf + ret, "%u%s", target_loads[i],
+			       i & 0x1 ? ":" : " ");
+
+	ret += sprintf(buf + ret, "\n");
+	spin_unlock_irqrestore(&target_loads_lock, flags);
+	return ret;
 }
 
-static const struct input_device_id cpufreq_interactive_ids[] = {
-	{
-		.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
-			 INPUT_DEVICE_ID_MATCH_ABSBIT,
-		.evbit = { BIT_MASK(EV_ABS) },
-		.absbit = { [BIT_WORD(ABS_MT_POSITION_X)] =
-			    BIT_MASK(ABS_MT_POSITION_X) |
-			    BIT_MASK(ABS_MT_POSITION_Y) },
-	}, /* multi-touch touchscreen */
-	{
-		.flags = INPUT_DEVICE_ID_MATCH_KEYBIT |
-			 INPUT_DEVICE_ID_MATCH_ABSBIT,
-		.keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
-		.absbit = { [BIT_WORD(ABS_X)] =
-			    BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) },
-	}, /* touchpad */
-	{ },
-};
+static ssize_t store_target_loads(
+	struct kobject *kobj, struct attribute *attr, const char *buf,
+	size_t count)
+{
+	int ntokens;
+	unsigned int *new_target_loads = NULL;
+	unsigned long flags;
 
-static struct input_handler cpufreq_interactive_input_handler = {
-	.event          = cpufreq_interactive_input_event,
-	.connect        = cpufreq_interactive_input_connect,
-	.disconnect     = cpufreq_interactive_input_disconnect,
-	.name           = "cpufreq_interactive",
-	.id_table       = cpufreq_interactive_ids,
-};
+	new_target_loads = get_tokenized_data(buf, &ntokens);
+	if (IS_ERR(new_target_loads))
+		return PTR_RET(new_target_loads);
+
+	spin_lock_irqsave(&target_loads_lock, flags);
+	if (target_loads != default_target_loads)
+		kfree(target_loads);
+	target_loads = new_target_loads;
+	ntarget_loads = ntokens;
+	spin_unlock_irqrestore(&target_loads_lock, flags);
+	return count;
+}
+
+static struct global_attr target_loads_attr =
+	__ATTR(target_loads, S_IRUGO | S_IWUSR,
+		show_target_loads, store_target_loads);
+
+static ssize_t show_above_hispeed_delay(
+	struct kobject *kobj, struct attribute *attr, char *buf)
+{
+	int i;
+	ssize_t ret = 0;
+	unsigned long flags;
+
+	spin_lock_irqsave(&above_hispeed_delay_lock, flags);
+
+	for (i = 0; i < nabove_hispeed_delay; i++)
+		ret += sprintf(buf + ret, "%u%s", above_hispeed_delay[i],
+			       i & 0x1 ? ":" : " ");
+
+	ret += sprintf(buf + ret, "\n");
+	spin_unlock_irqrestore(&above_hispeed_delay_lock, flags);
+	return ret;
+}
+
+static ssize_t store_above_hispeed_delay(
+	struct kobject *kobj, struct attribute *attr, const char *buf,
+	size_t count)
+{
+	int ntokens;
+	unsigned int *new_above_hispeed_delay = NULL;
+	unsigned long flags;
+
+	new_above_hispeed_delay = get_tokenized_data(buf, &ntokens);
+	if (IS_ERR(new_above_hispeed_delay))
+		return PTR_RET(new_above_hispeed_delay);
+
+	spin_lock_irqsave(&above_hispeed_delay_lock, flags);
+	if (above_hispeed_delay != default_above_hispeed_delay)
+		kfree(above_hispeed_delay);
+	above_hispeed_delay = new_above_hispeed_delay;
+	nabove_hispeed_delay = ntokens;
+	spin_unlock_irqrestore(&above_hispeed_delay_lock, flags);
+	return count;
+
+}
+
+static struct global_attr above_hispeed_delay_attr =
+	__ATTR(above_hispeed_delay, S_IRUGO | S_IWUSR,
+		show_above_hispeed_delay, store_above_hispeed_delay);
 
 static ssize_t show_hispeed_freq(struct kobject *kobj,
 				 struct attribute *attr, char *buf)
 {
-	return sprintf(buf, "%llu\n", hispeed_freq);
+	return sprintf(buf, "%u\n", hispeed_freq);
 }
 
 static ssize_t store_hispeed_freq(struct kobject *kobj,
@@ -628,9 +788,9 @@
 				  size_t count)
 {
 	int ret;
-	u64 val;
+	long unsigned int val;
 
-	ret = strict_strtoull(buf, 0, &val);
+	ret = strict_strtoul(buf, 0, &val);
 	if (ret < 0)
 		return ret;
 	hispeed_freq = val;
@@ -685,28 +845,6 @@
 static struct global_attr min_sample_time_attr = __ATTR(min_sample_time, 0644,
 		show_min_sample_time, store_min_sample_time);
 
-static ssize_t show_above_hispeed_delay(struct kobject *kobj,
-					struct attribute *attr, char *buf)
-{
-	return sprintf(buf, "%lu\n", above_hispeed_delay_val);
-}
-
-static ssize_t store_above_hispeed_delay(struct kobject *kobj,
-					 struct attribute *attr,
-					 const char *buf, size_t count)
-{
-	int ret;
-	unsigned long val;
-
-	ret = strict_strtoul(buf, 0, &val);
-	if (ret < 0)
-		return ret;
-	above_hispeed_delay_val = val;
-	return count;
-}
-
-define_one_global_rw(above_hispeed_delay);
-
 static ssize_t show_timer_rate(struct kobject *kobj,
 			struct attribute *attr, char *buf)
 {
@@ -729,26 +867,28 @@
 static struct global_attr timer_rate_attr = __ATTR(timer_rate, 0644,
 		show_timer_rate, store_timer_rate);
 
-static ssize_t show_input_boost(struct kobject *kobj, struct attribute *attr,
-				char *buf)
+static ssize_t show_timer_slack(
+	struct kobject *kobj, struct attribute *attr, char *buf)
 {
-	return sprintf(buf, "%u\n", input_boost_val);
+	return sprintf(buf, "%d\n", timer_slack_val);
 }
 
-static ssize_t store_input_boost(struct kobject *kobj, struct attribute *attr,
-				 const char *buf, size_t count)
+static ssize_t store_timer_slack(
+	struct kobject *kobj, struct attribute *attr, const char *buf,
+	size_t count)
 {
 	int ret;
 	unsigned long val;
 
-	ret = strict_strtoul(buf, 0, &val);
+	ret = kstrtol(buf, 10, &val);
 	if (ret < 0)
 		return ret;
-	input_boost_val = val;
+
+	timer_slack_val = val;
 	return count;
 }
 
-define_one_global_rw(input_boost);
+define_one_global_rw(timer_slack);
 
 static ssize_t show_boost(struct kobject *kobj, struct attribute *attr,
 			  char *buf)
@@ -790,6 +930,7 @@
 	if (ret < 0)
 		return ret;
 
+	boostpulse_endtime = ktime_to_us(ktime_get()) + boostpulse_duration_val;
 	trace_cpufreq_interactive_boost("pulse");
 	cpufreq_interactive_boost();
 	return count;
@@ -798,15 +939,63 @@
 static struct global_attr boostpulse =
 	__ATTR(boostpulse, 0200, NULL, store_boostpulse);
 
+static ssize_t show_boostpulse_duration(
+	struct kobject *kobj, struct attribute *attr, char *buf)
+{
+	return sprintf(buf, "%d\n", boostpulse_duration_val);
+}
+
+static ssize_t store_boostpulse_duration(
+	struct kobject *kobj, struct attribute *attr, const char *buf,
+	size_t count)
+{
+	int ret;
+	unsigned long val;
+
+	ret = kstrtoul(buf, 0, &val);
+	if (ret < 0)
+		return ret;
+
+	boostpulse_duration_val = val;
+	return count;
+}
+
+define_one_global_rw(boostpulse_duration);
+
+static ssize_t show_io_is_busy(struct kobject *kobj,
+			struct attribute *attr, char *buf)
+{
+	return sprintf(buf, "%u\n", io_is_busy);
+}
+
+static ssize_t store_io_is_busy(struct kobject *kobj,
+			struct attribute *attr, const char *buf, size_t count)
+{
+	int ret;
+	unsigned long val;
+
+	ret = kstrtoul(buf, 0, &val);
+	if (ret < 0)
+		return ret;
+	io_is_busy = val;
+	return count;
+}
+
+static struct global_attr io_is_busy_attr = __ATTR(io_is_busy, 0644,
+		show_io_is_busy, store_io_is_busy);
+
 static struct attribute *interactive_attributes[] = {
+	&target_loads_attr.attr,
+	&above_hispeed_delay_attr.attr,
 	&hispeed_freq_attr.attr,
 	&go_hispeed_load_attr.attr,
-	&above_hispeed_delay.attr,
 	&min_sample_time_attr.attr,
 	&timer_rate_attr.attr,
-	&input_boost.attr,
+	&timer_slack.attr,
 	&boost.attr,
 	&boostpulse.attr,
+	&boostpulse_duration.attr,
+	&io_is_busy_attr.attr,
 	NULL,
 };
 
@@ -815,102 +1004,6 @@
 	.name = "interactive",
 };
 
-static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
-		unsigned int event)
-{
-	int rc;
-	unsigned int j;
-	struct cpufreq_interactive_cpuinfo *pcpu;
-	struct cpufreq_frequency_table *freq_table;
-
-	switch (event) {
-	case CPUFREQ_GOV_START:
-		if (!cpu_online(policy->cpu))
-			return -EINVAL;
-
-		freq_table =
-			cpufreq_frequency_get_table(policy->cpu);
-
-		for_each_cpu(j, policy->cpus) {
-			pcpu = &per_cpu(cpuinfo, j);
-			pcpu->policy = policy;
-			pcpu->target_freq = policy->cur;
-			pcpu->freq_table = freq_table;
-			pcpu->target_set_time_in_idle =
-				get_cpu_idle_time_us(j,
-					     &pcpu->target_set_time);
-			pcpu->floor_freq = pcpu->target_freq;
-			pcpu->floor_validate_time =
-				pcpu->target_set_time;
-			pcpu->hispeed_validate_time =
-				pcpu->target_set_time;
-			pcpu->governor_enabled = 1;
-			pcpu->idle_exit_time = pcpu->target_set_time;
-			mod_timer(&pcpu->cpu_timer,
-				jiffies + usecs_to_jiffies(timer_rate));
-			smp_wmb();
-		}
-
-		if (!hispeed_freq)
-			hispeed_freq = policy->max;
-
-		/*
-		 * Do not register the idle hook and create sysfs
-		 * entries if we have already done so.
-		 */
-		if (atomic_inc_return(&active_count) > 1)
-			return 0;
-
-		rc = sysfs_create_group(cpufreq_global_kobject,
-				&interactive_attr_group);
-		if (rc)
-			return rc;
-
-		rc = input_register_handler(&cpufreq_interactive_input_handler);
-		if (rc)
-			pr_warn("%s: failed to register input handler\n",
-				__func__);
-
-		break;
-
-	case CPUFREQ_GOV_STOP:
-		for_each_cpu(j, policy->cpus) {
-			pcpu = &per_cpu(cpuinfo, j);
-			pcpu->governor_enabled = 0;
-			smp_wmb();
-			del_timer_sync(&pcpu->cpu_timer);
-
-			/*
-			 * Reset idle exit time since we may cancel the timer
-			 * before it can run after the last idle exit time,
-			 * to avoid tripping the check in idle exit for a timer
-			 * that is trying to run.
-			 */
-			pcpu->idle_exit_time = 0;
-		}
-
-		flush_work(&freq_scale_down_work);
-		if (atomic_dec_return(&active_count) > 0)
-			return 0;
-
-		input_unregister_handler(&cpufreq_interactive_input_handler);
-		sysfs_remove_group(cpufreq_global_kobject,
-				&interactive_attr_group);
-
-		break;
-
-	case CPUFREQ_GOV_LIMITS:
-		if (policy->max < policy->cur)
-			__cpufreq_driver_target(policy,
-					policy->max, CPUFREQ_RELATION_H);
-		else if (policy->min > policy->cur)
-			__cpufreq_driver_target(policy,
-					policy->min, CPUFREQ_RELATION_L);
-		break;
-	}
-	return 0;
-}
-
 static int cpufreq_interactive_idle_notifier(struct notifier_block *nb,
 					     unsigned long val,
 					     void *data)
@@ -931,54 +1024,149 @@
 	.notifier_call = cpufreq_interactive_idle_notifier,
 };
 
+static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
+		unsigned int event)
+{
+	int rc;
+	unsigned int j;
+	struct cpufreq_interactive_cpuinfo *pcpu;
+	struct cpufreq_frequency_table *freq_table;
+
+	switch (event) {
+	case CPUFREQ_GOV_START:
+		if (!cpu_online(policy->cpu))
+			return -EINVAL;
+
+		mutex_lock(&gov_lock);
+
+		freq_table =
+			cpufreq_frequency_get_table(policy->cpu);
+		if (!hispeed_freq)
+			hispeed_freq = policy->max;
+
+		for_each_cpu(j, policy->cpus) {
+			unsigned long expires;
+
+			pcpu = &per_cpu(cpuinfo, j);
+			pcpu->policy = policy;
+			pcpu->target_freq = policy->cur;
+			pcpu->freq_table = freq_table;
+			pcpu->floor_freq = pcpu->target_freq;
+			pcpu->floor_validate_time =
+				ktime_to_us(ktime_get());
+			pcpu->hispeed_validate_time =
+				pcpu->floor_validate_time;
+			down_write(&pcpu->enable_sem);
+			expires = jiffies + usecs_to_jiffies(timer_rate);
+			pcpu->cpu_timer.expires = expires;
+			add_timer_on(&pcpu->cpu_timer, j);
+			if (timer_slack_val >= 0) {
+				expires += usecs_to_jiffies(timer_slack_val);
+				pcpu->cpu_slack_timer.expires = expires;
+				add_timer_on(&pcpu->cpu_slack_timer, j);
+			}
+			pcpu->governor_enabled = 1;
+			up_write(&pcpu->enable_sem);
+		}
+
+		/*
+		 * Do not register the idle hook and create sysfs
+		 * entries if we have already done so.
+		 */
+		if (++active_count > 1) {
+			mutex_unlock(&gov_lock);
+			return 0;
+		}
+
+		rc = sysfs_create_group(cpufreq_global_kobject,
+				&interactive_attr_group);
+		if (rc) {
+			mutex_unlock(&gov_lock);
+			return rc;
+		}
+
+		idle_notifier_register(&cpufreq_interactive_idle_nb);
+		cpufreq_register_notifier(
+			&cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
+		mutex_unlock(&gov_lock);
+		break;
+
+	case CPUFREQ_GOV_STOP:
+		mutex_lock(&gov_lock);
+		for_each_cpu(j, policy->cpus) {
+			pcpu = &per_cpu(cpuinfo, j);
+			down_write(&pcpu->enable_sem);
+			pcpu->governor_enabled = 0;
+			del_timer_sync(&pcpu->cpu_timer);
+			del_timer_sync(&pcpu->cpu_slack_timer);
+			up_write(&pcpu->enable_sem);
+		}
+
+		if (--active_count > 0) {
+			mutex_unlock(&gov_lock);
+			return 0;
+		}
+
+		cpufreq_unregister_notifier(
+			&cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
+		idle_notifier_unregister(&cpufreq_interactive_idle_nb);
+		sysfs_remove_group(cpufreq_global_kobject,
+				&interactive_attr_group);
+		mutex_unlock(&gov_lock);
+
+		break;
+
+	case CPUFREQ_GOV_LIMITS:
+		if (policy->max < policy->cur)
+			__cpufreq_driver_target(policy,
+					policy->max, CPUFREQ_RELATION_H);
+		else if (policy->min > policy->cur)
+			__cpufreq_driver_target(policy,
+					policy->min, CPUFREQ_RELATION_L);
+		break;
+	}
+	return 0;
+}
+
+static void cpufreq_interactive_nop_timer(unsigned long data)
+{
+}
+
 static int __init cpufreq_interactive_init(void)
 {
 	unsigned int i;
 	struct cpufreq_interactive_cpuinfo *pcpu;
 	struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
 
-	go_hispeed_load = DEFAULT_GO_HISPEED_LOAD;
-	min_sample_time = DEFAULT_MIN_SAMPLE_TIME;
-	above_hispeed_delay_val = DEFAULT_ABOVE_HISPEED_DELAY;
-	timer_rate = DEFAULT_TIMER_RATE;
-
 	/* Initalize per-cpu timers */
 	for_each_possible_cpu(i) {
 		pcpu = &per_cpu(cpuinfo, i);
-		init_timer(&pcpu->cpu_timer);
+		init_timer_deferrable(&pcpu->cpu_timer);
 		pcpu->cpu_timer.function = cpufreq_interactive_timer;
 		pcpu->cpu_timer.data = i;
+		init_timer(&pcpu->cpu_slack_timer);
+		pcpu->cpu_slack_timer.function = cpufreq_interactive_nop_timer;
+		spin_lock_init(&pcpu->load_lock);
+		init_rwsem(&pcpu->enable_sem);
 	}
 
-	up_task = kthread_create(cpufreq_interactive_up_task, NULL,
-				 "kinteractiveup");
-	if (IS_ERR(up_task))
-		return PTR_ERR(up_task);
+	spin_lock_init(&target_loads_lock);
+	spin_lock_init(&speedchange_cpumask_lock);
+	spin_lock_init(&above_hispeed_delay_lock);
+	mutex_init(&gov_lock);
+	speedchange_task =
+		kthread_create(cpufreq_interactive_speedchange_task, NULL,
+			       "cfinteractive");
+	if (IS_ERR(speedchange_task))
+		return PTR_ERR(speedchange_task);
 
-	sched_setscheduler_nocheck(up_task, SCHED_FIFO, &param);
-	get_task_struct(up_task);
+	sched_setscheduler_nocheck(speedchange_task, SCHED_FIFO, &param);
+	get_task_struct(speedchange_task);
 
-	/* No rescuer thread, bind to CPU queuing the work for possibly
-	   warm cache (probably doesn't matter much). */
-	down_wq = alloc_workqueue("knteractive_down", 0, 1);
+	/* NB: wake up so the thread does not look hung to the freezer */
+	wake_up_process(speedchange_task);
 
-	if (!down_wq)
-		goto err_freeuptask;
-
-	INIT_WORK(&freq_scale_down_work,
-		  cpufreq_interactive_freq_down);
-
-	spin_lock_init(&up_cpumask_lock);
-	spin_lock_init(&down_cpumask_lock);
-	mutex_init(&set_speed_lock);
-
-	idle_notifier_register(&cpufreq_interactive_idle_nb);
-	INIT_WORK(&inputopen.inputopen_work, cpufreq_interactive_input_open);
 	return cpufreq_register_governor(&cpufreq_gov_interactive);
-
-err_freeuptask:
-	put_task_struct(up_task);
-	return -ENOMEM;
 }
 
 #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE
@@ -990,9 +1178,8 @@
 static void __exit cpufreq_interactive_exit(void)
 {
 	cpufreq_unregister_governor(&cpufreq_gov_interactive);
-	kthread_stop(up_task);
-	put_task_struct(up_task);
-	destroy_workqueue(down_wq);
+	kthread_stop(speedchange_task);
+	put_task_struct(speedchange_task);
 }
 
 module_exit(cpufreq_interactive_exit);
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index bb787d8..2ca8d3f 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -172,7 +172,8 @@
 	struct device_dma_parameters	dma_parms;
 	struct dma_device		dma_device;
 	void __iomem			*base;
-	struct clk			*dma_clk;
+	struct clk			*dma_ahb;
+	struct clk			*dma_ipg;
 	spinlock_t			lock;
 	struct imx_dma_2d_config	slots_2d[IMX_DMA_2D_SLOTS];
 	struct imxdma_channel		channel[IMX_DMA_CHANNELS];
@@ -976,10 +977,20 @@
 		return 0;
 	}
 
-	imxdma->dma_clk = clk_get(NULL, "dma");
-	if (IS_ERR(imxdma->dma_clk))
-		return PTR_ERR(imxdma->dma_clk);
-	clk_enable(imxdma->dma_clk);
+	imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg");
+	if (IS_ERR(imxdma->dma_ipg)) {
+		ret = PTR_ERR(imxdma->dma_ipg);
+		goto err_clk;
+	}
+
+	imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb");
+	if (IS_ERR(imxdma->dma_ahb)) {
+		ret = PTR_ERR(imxdma->dma_ahb);
+		goto err_clk;
+	}
+
+	clk_prepare_enable(imxdma->dma_ipg);
+	clk_prepare_enable(imxdma->dma_ahb);
 
 	/* reset DMA module */
 	imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR);
@@ -988,16 +999,14 @@
 		ret = request_irq(MX1_DMA_INT, dma_irq_handler, 0, "DMA", imxdma);
 		if (ret) {
 			dev_warn(imxdma->dev, "Can't register IRQ for DMA\n");
-			kfree(imxdma);
-			return ret;
+			goto err_enable;
 		}
 
 		ret = request_irq(MX1_DMA_ERR, imxdma_err_handler, 0, "DMA", imxdma);
 		if (ret) {
 			dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n");
 			free_irq(MX1_DMA_INT, NULL);
-			kfree(imxdma);
-			return ret;
+			goto err_enable;
 		}
 	}
 
@@ -1094,7 +1103,10 @@
 		free_irq(MX1_DMA_INT, NULL);
 		free_irq(MX1_DMA_ERR, NULL);
 	}
-
+err_enable:
+	clk_disable_unprepare(imxdma->dma_ipg);
+	clk_disable_unprepare(imxdma->dma_ahb);
+err_clk:
 	kfree(imxdma);
 	return ret;
 }
@@ -1114,7 +1126,9 @@
 		free_irq(MX1_DMA_ERR, NULL);
 	}
 
-        kfree(imxdma);
+	clk_disable_unprepare(imxdma->dma_ipg);
+	clk_disable_unprepare(imxdma->dma_ahb);
+	kfree(imxdma);
 
         return 0;
 }
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index fa3fb21..8c44f17 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2322,7 +2322,7 @@
 	/* Pick up ripe tomatoes */
 	list_for_each_entry_safe(desc, _dt, &pch->work_list, node)
 		if (desc->status == DONE) {
-			if (pch->cyclic)
+			if (!pch->cyclic)
 				dma_cookie_complete(&desc->txd);
 			list_move_tail(&desc->node, &list);
 		}
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 85226cc..0fe2277 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1932,12 +1932,6 @@
 	if (mce->bank != 8)
 		return NOTIFY_DONE;
 
-#ifdef CONFIG_SMP
-	/* Only handle if it is the right mc controller */
-	if (mce->socketid != pvt->i7core_dev->socket)
-		return NOTIFY_DONE;
-#endif
-
 	smp_rmb();
 	if ((pvt->mce_out + 1) % MCE_LOG_LEN == pvt->mce_in) {
 		smp_wmb();
@@ -2234,8 +2228,6 @@
 	if (pvt->enable_scrub)
 		disable_sdram_scrub_setting(mci);
 
-	mce_unregister_decode_chain(&i7_mce_dec);
-
 	/* Disable EDAC polling */
 	i7core_pci_ctl_release(pvt);
 
@@ -2336,8 +2328,6 @@
 	/* DCLK for scrub rate setting */
 	pvt->dclk_freq = get_dclk_freq();
 
-	mce_register_decode_chain(&i7_mce_dec);
-
 	return 0;
 
 fail0:
@@ -2481,8 +2471,10 @@
 
 	pci_rc = pci_register_driver(&i7core_driver);
 
-	if (pci_rc >= 0)
+	if (pci_rc >= 0) {
+		mce_register_decode_chain(&i7_mce_dec);
 		return 0;
+	}
 
 	i7core_printk(KERN_ERR, "Failed to register device with error %d.\n",
 		      pci_rc);
@@ -2498,6 +2490,7 @@
 {
 	debugf2("MC: " __FILE__ ": %s()\n", __func__);
 	pci_unregister_driver(&i7core_driver);
+	mce_unregister_decode_chain(&i7_mce_dec);
 }
 
 module_init(i7core_init);
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index a203536..0f9552d 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -599,7 +599,7 @@
 		pvt->is_close_pg = false;
 	}
 
-	pci_read_config_dword(pvt->pci_ta, RANK_CFG_A, &reg);
+	pci_read_config_dword(pvt->pci_ddrio, RANK_CFG_A, &reg);
 	if (IS_RDIMM_ENABLED(reg)) {
 		/* FIXME: Can also be LRDIMM */
 		debugf0("Memory is registered\n");
@@ -1669,8 +1669,6 @@
 	debugf0("MC: " __FILE__ ": %s(): mci = %p, dev = %p\n",
 		__func__, mci, &sbridge_dev->pdev[0]->dev);
 
-	mce_unregister_decode_chain(&sbridge_mce_dec);
-
 	/* Remove MC sysfs nodes */
 	edac_mc_del_mc(mci->dev);
 
@@ -1738,7 +1736,6 @@
 		goto fail0;
 	}
 
-	mce_register_decode_chain(&sbridge_mce_dec);
 	return 0;
 
 fail0:
@@ -1867,8 +1864,10 @@
 
 	pci_rc = pci_register_driver(&sbridge_driver);
 
-	if (pci_rc >= 0)
+	if (pci_rc >= 0) {
+		mce_register_decode_chain(&sbridge_mce_dec);
 		return 0;
+	}
 
 	sbridge_printk(KERN_ERR, "Failed to register device with error %d.\n",
 		      pci_rc);
@@ -1884,6 +1883,7 @@
 {
 	debugf2("MC: " __FILE__ ": %s()\n", __func__);
 	pci_unregister_driver(&sbridge_driver);
+	mce_unregister_decode_chain(&sbridge_mce_dec);
 }
 
 module_init(sbridge_init);
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 153980b..b298158 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -6,6 +6,7 @@
 #include <linux/dmi.h>
 #include <linux/efi.h>
 #include <linux/bootmem.h>
+#include <linux/random.h>
 #include <asm/dmi.h>
 
 /*
@@ -111,6 +112,8 @@
 
 	dmi_table(buf, dmi_len, dmi_num, decode, NULL);
 
+	add_device_randomness(buf, dmi_len);
+
 	dmi_iounmap(buf, dmi_len);
 	return 0;
 }
diff --git a/drivers/firmware/pcdp.c b/drivers/firmware/pcdp.c
index 51e0e2d..a330492 100644
--- a/drivers/firmware/pcdp.c
+++ b/drivers/firmware/pcdp.c
@@ -95,7 +95,7 @@
 	if (efi.hcdp == EFI_INVALID_TABLE_ADDR)
 		return -ENODEV;
 
-	pcdp = ioremap(efi.hcdp, 4096);
+	pcdp = early_ioremap(efi.hcdp, 4096);
 	printk(KERN_INFO "PCDP: v%d at 0x%lx\n", pcdp->rev, efi.hcdp);
 
 	if (strstr(cmdline, "console=hcdp")) {
@@ -131,6 +131,6 @@
 	}
 
 out:
-	iounmap(pcdp);
+	early_iounmap(pcdp, 4096);
 	return rc;
 }
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index e6568c1..5a1817e 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -163,7 +163,8 @@
 	if (mask)
 		generic_handle_irq(irq_linear_revmap(mpc8xxx_gc->irq,
 						     32 - ffs(mask)));
-	chip->irq_eoi(&desc->irq_data);
+	if (chip->irq_eoi)
+		chip->irq_eoi(&desc->irq_data);
 }
 
 static void mpc8xxx_irq_unmask(struct irq_data *d)
diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
index 92ea535..aa61ad2 100644
--- a/drivers/gpio/gpio-wm8994.c
+++ b/drivers/gpio/gpio-wm8994.c
@@ -89,8 +89,11 @@
 	struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
 	struct wm8994 *wm8994 = wm8994_gpio->wm8994;
 
+	if (value)
+		value = WM8994_GPN_LVL;
+
 	return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset,
-			       WM8994_GPN_DIR, 0);
+			       WM8994_GPN_DIR | WM8994_GPN_LVL, value);
 }
 
 static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 5a18b0d..6e38325 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -574,7 +574,7 @@
 drm_monitor_supports_rb(struct edid *edid)
 {
 	if (edid->revision >= 4) {
-		bool ret;
+		bool ret = false;
 		drm_for_each_detailed_block((u8 *)edid, is_rb, &ret);
 		return ret;
 	}
diff --git a/drivers/gpu/drm/gma500/psb_device.c b/drivers/gpu/drm/gma500/psb_device.c
index 95d163e..328a193 100644
--- a/drivers/gpu/drm/gma500/psb_device.c
+++ b/drivers/gpu/drm/gma500/psb_device.c
@@ -197,7 +197,8 @@
 	}
 
 	list_for_each_entry(connector, &dev->mode_config.connector_list, head)
-		connector->funcs->save(connector);
+		if (connector->funcs->save)
+			connector->funcs->save(connector);
 
 	mutex_unlock(&dev->mode_config.mutex);
 	return 0;
@@ -235,7 +236,8 @@
 			crtc->funcs->restore(crtc);
 
 	list_for_each_entry(connector, &dev->mode_config.connector_list, head)
-		connector->funcs->restore(connector);
+		if (connector->funcs->restore)
+			connector->funcs->restore(connector);
 
 	mutex_unlock(&dev->mode_config.mutex);
 	return 0;
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index c34adf9..09af2ff 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -349,7 +349,7 @@
 	PSB_WSGX32(0x30000000, PSB_CR_BIF_3D_REQ_BASE);
 
 /*	igd_opregion_init(&dev_priv->opregion_dev); */
-	acpi_video_register();
+/*	acpi_video_register(); */
 	if (dev_priv->lid_state)
 		psb_lid_timer_init(dev_priv);
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index afd4e03..26c67a7 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -424,14 +424,35 @@
 	mutex_unlock(&dev_priv->dev->struct_mutex);
 }
 
-static void pch_irq_handler(struct drm_device *dev)
+static void gen6_queue_rps_work(struct drm_i915_private *dev_priv,
+				u32 pm_iir)
+{
+	unsigned long flags;
+
+	/*
+	 * IIR bits should never already be set because IMR should
+	 * prevent an interrupt from being shown in IIR. The warning
+	 * displays a case where we've unsafely cleared
+	 * dev_priv->pm_iir. Although missing an interrupt of the same
+	 * type is not a problem, it displays a problem in the logic.
+	 *
+	 * The mask bit in IMR is cleared by rps_work.
+	 */
+
+	spin_lock_irqsave(&dev_priv->rps_lock, flags);
+	dev_priv->pm_iir |= pm_iir;
+	I915_WRITE(GEN6_PMIMR, dev_priv->pm_iir);
+	POSTING_READ(GEN6_PMIMR);
+	spin_unlock_irqrestore(&dev_priv->rps_lock, flags);
+
+	queue_work(dev_priv->wq, &dev_priv->rps_work);
+}
+
+static void pch_irq_handler(struct drm_device *dev, u32 pch_iir)
 {
 	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
-	u32 pch_iir;
 	int pipe;
 
-	pch_iir = I915_READ(SDEIIR);
-
 	if (pch_iir & SDE_AUDIO_POWER_MASK)
 		DRM_DEBUG_DRIVER("PCH audio power change on port %d\n",
 				 (pch_iir & SDE_AUDIO_POWER_MASK) >>
@@ -529,19 +550,11 @@
 	if (de_iir & DE_PCH_EVENT_IVB) {
 		if (pch_iir & SDE_HOTPLUG_MASK_CPT)
 			queue_work(dev_priv->wq, &dev_priv->hotplug_work);
-		pch_irq_handler(dev);
+		pch_irq_handler(dev, pch_iir);
 	}
 
-	if (pm_iir & GEN6_PM_DEFERRED_EVENTS) {
-		unsigned long flags;
-		spin_lock_irqsave(&dev_priv->rps_lock, flags);
-		WARN(dev_priv->pm_iir & pm_iir, "Missed a PM interrupt\n");
-		dev_priv->pm_iir |= pm_iir;
-		I915_WRITE(GEN6_PMIMR, dev_priv->pm_iir);
-		POSTING_READ(GEN6_PMIMR);
-		spin_unlock_irqrestore(&dev_priv->rps_lock, flags);
-		queue_work(dev_priv->wq, &dev_priv->rps_work);
-	}
+	if (pm_iir & GEN6_PM_DEFERRED_EVENTS)
+		gen6_queue_rps_work(dev_priv, pm_iir);
 
 	/* should clear PCH hotplug event before clear CPU irq */
 	I915_WRITE(SDEIIR, pch_iir);
@@ -629,7 +642,7 @@
 	if (de_iir & DE_PCH_EVENT) {
 		if (pch_iir & hotplug_mask)
 			queue_work(dev_priv->wq, &dev_priv->hotplug_work);
-		pch_irq_handler(dev);
+		pch_irq_handler(dev, pch_iir);
 	}
 
 	if (de_iir & DE_PCU_EVENT) {
@@ -637,25 +650,8 @@
 		i915_handle_rps_change(dev);
 	}
 
-	if (IS_GEN6(dev) && pm_iir & GEN6_PM_DEFERRED_EVENTS) {
-		/*
-		 * IIR bits should never already be set because IMR should
-		 * prevent an interrupt from being shown in IIR. The warning
-		 * displays a case where we've unsafely cleared
-		 * dev_priv->pm_iir. Although missing an interrupt of the same
-		 * type is not a problem, it displays a problem in the logic.
-		 *
-		 * The mask bit in IMR is cleared by rps_work.
-		 */
-		unsigned long flags;
-		spin_lock_irqsave(&dev_priv->rps_lock, flags);
-		WARN(dev_priv->pm_iir & pm_iir, "Missed a PM interrupt\n");
-		dev_priv->pm_iir |= pm_iir;
-		I915_WRITE(GEN6_PMIMR, dev_priv->pm_iir);
-		POSTING_READ(GEN6_PMIMR);
-		spin_unlock_irqrestore(&dev_priv->rps_lock, flags);
-		queue_work(dev_priv->wq, &dev_priv->rps_work);
-	}
+	if (IS_GEN6(dev) && pm_iir & GEN6_PM_DEFERRED_EVENTS)
+		gen6_queue_rps_work(dev_priv, pm_iir);
 
 	/* should clear PCH hotplug event before clear CPU irq */
 	I915_WRITE(SDEIIR, pch_iir);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index b114875..9419792 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -615,6 +615,21 @@
 
 #define GEN6_BSD_RNCID			0x12198
 
+#define GEN7_FF_THREAD_MODE		0x20a0
+#define   GEN7_FF_SCHED_MASK		0x0077070
+#define   GEN7_FF_TS_SCHED_HS1		(0x5<<16)
+#define   GEN7_FF_TS_SCHED_HS0		(0x3<<16)
+#define   GEN7_FF_TS_SCHED_LOAD_BALANCE	(0x1<<16)
+#define   GEN7_FF_TS_SCHED_HW		(0x0<<16) /* Default */
+#define   GEN7_FF_VS_SCHED_HS1		(0x5<<12)
+#define   GEN7_FF_VS_SCHED_HS0		(0x3<<12)
+#define   GEN7_FF_VS_SCHED_LOAD_BALANCE	(0x1<<12) /* Default */
+#define   GEN7_FF_VS_SCHED_HW		(0x0<<12)
+#define   GEN7_FF_DS_SCHED_HS1		(0x5<<4)
+#define   GEN7_FF_DS_SCHED_HS0		(0x3<<4)
+#define   GEN7_FF_DS_SCHED_LOAD_BALANCE	(0x1<<4)  /* Default */
+#define   GEN7_FF_DS_SCHED_HW		(0x0<<4)
+
 /*
  * Framebuffer compression (915+ only)
  */
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 2b5eb22..0d13778 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -740,8 +740,11 @@
 	if (HAS_PCH_SPLIT(dev)) {
 		I915_WRITE(BLC_PWM_PCH_CTL1, dev_priv->saveBLC_PWM_CTL);
 		I915_WRITE(BLC_PWM_PCH_CTL2, dev_priv->saveBLC_PWM_CTL2);
-		I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->saveBLC_CPU_PWM_CTL);
+		/* NOTE: BLC_PWM_CPU_CTL must be written after BLC_PWM_CPU_CTL2;
+		 * otherwise we get blank eDP screen after S3 on some machines
+		 */
 		I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->saveBLC_CPU_PWM_CTL2);
+		I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->saveBLC_CPU_PWM_CTL);
 		I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS);
 		I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS);
 		I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 1b1cf3b..3de3d9b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4982,17 +4982,6 @@
 			continue;
 		}
 
-		if (intel_encoder->type == INTEL_OUTPUT_EDP) {
-			/* Use VBT settings if we have an eDP panel */
-			unsigned int edp_bpc = dev_priv->edp.bpp / 3;
-
-			if (edp_bpc < display_bpc) {
-				DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc);
-				display_bpc = edp_bpc;
-			}
-			continue;
-		}
-
 		/* Not one of the known troublemakers, check the EDID */
 		list_for_each_entry(connector, &dev->mode_config.connector_list,
 				    head) {
@@ -7617,10 +7606,11 @@
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 reg, val;
+	int i;
 
 	/* Clear any frame start delays used for debugging left by the BIOS */
-	for_each_pipe(pipe) {
-		reg = PIPECONF(pipe);
+	for_each_pipe(i) {
+		reg = PIPECONF(i);
 		I915_WRITE(reg, I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK);
 	}
 
@@ -8367,7 +8357,7 @@
 	I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10);
 	I915_WRITE(GEN6_RP_CONTROL,
 		   GEN6_RP_MEDIA_TURBO |
-		   GEN6_RP_MEDIA_HW_MODE |
+		   GEN6_RP_MEDIA_HW_NORMAL_MODE |
 		   GEN6_RP_MEDIA_IS_GFX |
 		   GEN6_RP_ENABLE |
 		   GEN6_RP_UP_BUSY_AVG |
@@ -8612,6 +8602,18 @@
 	}
 }
 
+static void gen7_setup_fixed_func_scheduler(struct drm_i915_private *dev_priv)
+{
+	uint32_t reg = I915_READ(GEN7_FF_THREAD_MODE);
+
+	reg &= ~GEN7_FF_SCHED_MASK;
+	reg |= GEN7_FF_TS_SCHED_HW;
+	reg |= GEN7_FF_VS_SCHED_HW;
+	reg |= GEN7_FF_DS_SCHED_HW;
+
+	I915_WRITE(GEN7_FF_THREAD_MODE, reg);
+}
+
 static void ivybridge_init_clock_gating(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -8656,6 +8658,8 @@
 			   DISPPLANE_TRICKLE_FEED_DISABLE);
 		intel_flush_display_plane(dev_priv, pipe);
 	}
+
+	gen7_setup_fixed_func_scheduler(dev_priv);
 }
 
 static void g4x_init_clock_gating(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 4b63791..069725c 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -368,7 +368,7 @@
 	int recv_bytes;
 	uint32_t status;
 	uint32_t aux_clock_divider;
-	int try, precharge = 5;
+	int try, precharge;
 
 	intel_dp_check_edp(intel_dp);
 	/* The clock divider is based off the hrawclk,
@@ -388,6 +388,11 @@
 	else
 		aux_clock_divider = intel_hrawclk(dev) / 2;
 
+	if (IS_GEN6(dev))
+		precharge = 3;
+	else
+		precharge = 5;
+
 	/* Try to wait for any previous AUX channel activity */
 	for (try = 0; try < 3; try++) {
 		status = I915_READ(ch_ctl);
@@ -707,8 +712,8 @@
 
 	bpp = adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24;
 
-	for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) {
-		for (clock = 0; clock <= max_clock; clock++) {
+	for (clock = 0; clock <= max_clock; clock++) {
+		for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) {
 			int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count);
 
 			if (intel_dp_link_required(mode->clock, bpp)
@@ -1148,13 +1153,17 @@
 
 	DRM_DEBUG_KMS("Turn eDP power off\n");
 
-	WARN(intel_dp->want_panel_vdd, "Cannot turn power off while VDD is on\n");
+	WARN(!intel_dp->want_panel_vdd, "Need VDD to turn off panel\n");
 
 	pp = ironlake_get_pp_control(dev_priv);
+	/* We need to switch off panel power _and_ force vdd, for otherwise some
+	 * panels get very unhappy and cease to work. */
 	pp &= ~(POWER_TARGET_ON | EDP_FORCE_VDD | PANEL_POWER_RESET | EDP_BLC_ENABLE);
 	I915_WRITE(PCH_PP_CONTROL, pp);
 	POSTING_READ(PCH_PP_CONTROL);
 
+	intel_dp->want_panel_vdd = false;
+
 	ironlake_wait_panel_off(intel_dp);
 }
 
@@ -1259,18 +1268,14 @@
 {
 	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
-	ironlake_edp_backlight_off(intel_dp);
-	ironlake_edp_panel_off(intel_dp);
 
-	/* Wake up the sink first */
+	/* Make sure the panel is off before trying to change the mode. But also
+	 * ensure that we have vdd while we switch off the panel. */
 	ironlake_edp_panel_vdd_on(intel_dp);
+	ironlake_edp_backlight_off(intel_dp);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
+	ironlake_edp_panel_off(intel_dp);
 	intel_dp_link_down(intel_dp);
-	ironlake_edp_panel_vdd_off(intel_dp, false);
-
-	/* Make sure the panel is off before trying to
-	 * change the mode
-	 */
 }
 
 static void intel_dp_commit(struct drm_encoder *encoder)
@@ -1302,13 +1307,12 @@
 	uint32_t dp_reg = I915_READ(intel_dp->output_reg);
 
 	if (mode != DRM_MODE_DPMS_ON) {
-		ironlake_edp_backlight_off(intel_dp);
-		ironlake_edp_panel_off(intel_dp);
-
+		/* Switching the panel off requires vdd. */
 		ironlake_edp_panel_vdd_on(intel_dp);
+		ironlake_edp_backlight_off(intel_dp);
 		intel_dp_sink_dpms(intel_dp, mode);
+		ironlake_edp_panel_off(intel_dp);
 		intel_dp_link_down(intel_dp);
-		ironlake_edp_panel_vdd_off(intel_dp, false);
 
 		if (is_cpu_edp(intel_dp))
 			ironlake_edp_pll_off(encoder);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 9c71183..9fadd64 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -747,6 +747,14 @@
 	},
 	{
 		.callback = intel_no_lvds_dmi_callback,
+		.ident = "Hewlett-Packard HP t5740e Thin Client",
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "HP t5740e Thin Client"),
+		},
+	},
+	{
+		.callback = intel_no_lvds_dmi_callback,
 		.ident = "Hewlett-Packard t5745",
 		.matches = {
 			DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 62892a8..12a9e5f 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -258,8 +258,6 @@
 	I915_WRITE_HEAD(ring, 0);
 	ring->write_tail(ring, 0);
 
-	/* Initialize the ring. */
-	I915_WRITE_START(ring, obj->gtt_offset);
 	head = I915_READ_HEAD(ring) & HEAD_ADDR;
 
 	/* G45 ring initialization fails to reset head to zero */
@@ -285,6 +283,11 @@
 		}
 	}
 
+	/* Initialize the ring. This must happen _after_ we've cleared the ring
+	 * registers with the above sequence (the readback of the HEAD registers
+	 * also enforces ordering), otherwise the hw might lose the new ring
+	 * register values. */
+	I915_WRITE_START(ring, obj->gtt_offset);
 	I915_WRITE_CTL(ring,
 			((ring->size - PAGE_SIZE) & RING_NR_PAGES)
 			| RING_VALID);
@@ -309,6 +312,7 @@
 		ring->head = I915_READ_HEAD(ring);
 		ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR;
 		ring->space = ring_space(ring);
+		ring->last_retired_head = -1;
 	}
 
 	return 0;
@@ -1026,6 +1030,10 @@
 	if (ret)
 		goto err_unref;
 
+	ret = i915_gem_object_set_to_gtt_domain(obj, true);
+	if (ret)
+		goto err_unpin;
+
 	ring->map.size = ring->size;
 	ring->map.offset = dev->agp->base + obj->gtt_offset;
 	ring->map.type = 0;
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index ae5e748..eea58c6 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -769,10 +769,12 @@
 		((v_sync_len & 0x30) >> 4);
 
 	dtd->part2.dtd_flags = 0x18;
+	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
+		dtd->part2.dtd_flags |= DTD_FLAG_INTERLACE;
 	if (mode->flags & DRM_MODE_FLAG_PHSYNC)
-		dtd->part2.dtd_flags |= 0x2;
+		dtd->part2.dtd_flags |= DTD_FLAG_HSYNC_POSITIVE;
 	if (mode->flags & DRM_MODE_FLAG_PVSYNC)
-		dtd->part2.dtd_flags |= 0x4;
+		dtd->part2.dtd_flags |= DTD_FLAG_VSYNC_POSITIVE;
 
 	dtd->part2.sdvo_flags = 0;
 	dtd->part2.v_sync_off_high = v_sync_offset & 0xc0;
@@ -806,9 +808,11 @@
 	mode->clock = dtd->part1.clock * 10;
 
 	mode->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
-	if (dtd->part2.dtd_flags & 0x2)
+	if (dtd->part2.dtd_flags & DTD_FLAG_INTERLACE)
+		mode->flags |= DRM_MODE_FLAG_INTERLACE;
+	if (dtd->part2.dtd_flags & DTD_FLAG_HSYNC_POSITIVE)
 		mode->flags |= DRM_MODE_FLAG_PHSYNC;
-	if (dtd->part2.dtd_flags & 0x4)
+	if (dtd->part2.dtd_flags & DTD_FLAG_VSYNC_POSITIVE)
 		mode->flags |= DRM_MODE_FLAG_PVSYNC;
 }
 
diff --git a/drivers/gpu/drm/i915/intel_sdvo_regs.h b/drivers/gpu/drm/i915/intel_sdvo_regs.h
index 6b7b22f..9d03014 100644
--- a/drivers/gpu/drm/i915/intel_sdvo_regs.h
+++ b/drivers/gpu/drm/i915/intel_sdvo_regs.h
@@ -61,6 +61,11 @@
 	u16 output_flags;
 } __attribute__((packed));
 
+/* Note: SDVO detailed timing flags match EDID misc flags. */
+#define DTD_FLAG_HSYNC_POSITIVE (1 << 1)
+#define DTD_FLAG_VSYNC_POSITIVE (1 << 2)
+#define DTD_FLAG_INTERLACE	(1 << 7)
+
 /** This matches the EDID DTD structure, more or less */
 struct intel_sdvo_dtd {
 	struct {
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 05f765e..c82b1d4 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -674,6 +674,54 @@
 		.filter_table = filter_table,
 	},
 	{
+		.name       = "480p",
+		.clock		= 107520,
+		.refresh	= 59940,
+		.oversample     = TV_OVERSAMPLE_4X,
+		.component_only = 1,
+
+		.hsync_end      = 64,               .hblank_end         = 122,
+		.hblank_start   = 842,              .htotal             = 857,
+
+		.progressive    = true,		    .trilevel_sync = false,
+
+		.vsync_start_f1 = 12,               .vsync_start_f2     = 12,
+		.vsync_len      = 12,
+
+		.veq_ena        = false,
+
+		.vi_end_f1      = 44,               .vi_end_f2          = 44,
+		.nbr_end        = 479,
+
+		.burst_ena      = false,
+
+		.filter_table = filter_table,
+	},
+	{
+		.name       = "576p",
+		.clock		= 107520,
+		.refresh	= 50000,
+		.oversample     = TV_OVERSAMPLE_4X,
+		.component_only = 1,
+
+		.hsync_end      = 64,               .hblank_end         = 139,
+		.hblank_start   = 859,              .htotal             = 863,
+
+		.progressive    = true,		    .trilevel_sync = false,
+
+		.vsync_start_f1 = 10,               .vsync_start_f2     = 10,
+		.vsync_len      = 10,
+
+		.veq_ena        = false,
+
+		.vi_end_f1      = 48,               .vi_end_f2          = 48,
+		.nbr_end        = 575,
+
+		.burst_ena      = false,
+
+		.filter_table = filter_table,
+	},
+	{
 		.name       = "720p@60Hz",
 		.clock		= 148800,
 		.refresh	= 60000,
@@ -1185,6 +1233,11 @@
 
 	I915_WRITE(TV_DAC, save_tv_dac & ~TVDAC_STATE_CHG_EN);
 	I915_WRITE(TV_CTL, save_tv_ctl);
+	POSTING_READ(TV_CTL);
+
+	/* For unknown reasons the hw barfs if we don't do this vblank wait. */
+	intel_wait_for_vblank(intel_tv->base.base.dev,
+			      to_intel_crtc(intel_tv->base.base.crtc)->pipe);
 
 	/* Restore interrupt config */
 	if (connector->polled & DRM_CONNECTOR_POLL_HPD) {
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 7d15a77..12ce044 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1030,7 +1030,7 @@
 
 	nvbo->placement.fpfn = 0;
 	nvbo->placement.lpfn = dev_priv->fb_mappable_pages;
-	nouveau_bo_placement_set(nvbo, TTM_PL_VRAM, 0);
+	nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_VRAM, 0);
 	return nouveau_bo_validate(nvbo, false, true, false);
 }
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index fa86035..7b11edb 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -654,7 +654,13 @@
 	if (nv_connector->edid && connector->display_info.bpc)
 		return;
 
-	/* if not, we're out of options unless we're LVDS, default to 8bpc */
+	/* EDID 1.4 is *supposed* to be supported on eDP, but, Apple... */
+	if (nv_connector->type == DCB_CONNECTOR_eDP) {
+		connector->display_info.bpc = 6;
+		return;
+	}
+
+	/* we're out of options unless we're LVDS, default to 8bpc */
 	if (nv_encoder->dcb->type != OUTPUT_LVDS) {
 		connector->display_info.bpc = 8;
 		return;
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 8113e92..6fd2211 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -497,7 +497,7 @@
 	nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs;
 
 	ret = drm_fb_helper_init(dev, &nfbdev->helper,
-				 nv_two_heads(dev) ? 2 : 1, 4);
+				 dev->mode_config.num_crtc, 4);
 	if (ret) {
 		kfree(nfbdev);
 		return ret;
diff --git a/drivers/gpu/drm/nouveau/nva3_copy.fuc b/drivers/gpu/drm/nouveau/nva3_copy.fuc
index abc3662..219850d 100644
--- a/drivers/gpu/drm/nouveau/nva3_copy.fuc
+++ b/drivers/gpu/drm/nouveau/nva3_copy.fuc
@@ -119,9 +119,9 @@
 // mthd 0x030c-0x0340, various stuff
 .b16 0xc3 14
 .b32 #ctx_src_address_high           ~0x000000ff
-.b32 #ctx_src_address_low            ~0xfffffff0
+.b32 #ctx_src_address_low            ~0xffffffff
 .b32 #ctx_dst_address_high           ~0x000000ff
-.b32 #ctx_dst_address_low            ~0xfffffff0
+.b32 #ctx_dst_address_low            ~0xffffffff
 .b32 #ctx_src_pitch                  ~0x0007ffff
 .b32 #ctx_dst_pitch                  ~0x0007ffff
 .b32 #ctx_xcnt                       ~0x0000ffff
diff --git a/drivers/gpu/drm/nouveau/nva3_copy.fuc.h b/drivers/gpu/drm/nouveau/nva3_copy.fuc.h
index 1f33fbd..37d6de3 100644
--- a/drivers/gpu/drm/nouveau/nva3_copy.fuc.h
+++ b/drivers/gpu/drm/nouveau/nva3_copy.fuc.h
@@ -1,4 +1,72 @@
-uint32_t nva3_pcopy_data[] = {
+u32 nva3_pcopy_data[] = {
+/* 0x0000: ctx_object */
+	0x00000000,
+/* 0x0004: ctx_dma */
+/* 0x0004: ctx_dma_query */
+	0x00000000,
+/* 0x0008: ctx_dma_src */
+	0x00000000,
+/* 0x000c: ctx_dma_dst */
+	0x00000000,
+/* 0x0010: ctx_query_address_high */
+	0x00000000,
+/* 0x0014: ctx_query_address_low */
+	0x00000000,
+/* 0x0018: ctx_query_counter */
+	0x00000000,
+/* 0x001c: ctx_src_address_high */
+	0x00000000,
+/* 0x0020: ctx_src_address_low */
+	0x00000000,
+/* 0x0024: ctx_src_pitch */
+	0x00000000,
+/* 0x0028: ctx_src_tile_mode */
+	0x00000000,
+/* 0x002c: ctx_src_xsize */
+	0x00000000,
+/* 0x0030: ctx_src_ysize */
+	0x00000000,
+/* 0x0034: ctx_src_zsize */
+	0x00000000,
+/* 0x0038: ctx_src_zoff */
+	0x00000000,
+/* 0x003c: ctx_src_xoff */
+	0x00000000,
+/* 0x0040: ctx_src_yoff */
+	0x00000000,
+/* 0x0044: ctx_src_cpp */
+	0x00000000,
+/* 0x0048: ctx_dst_address_high */
+	0x00000000,
+/* 0x004c: ctx_dst_address_low */
+	0x00000000,
+/* 0x0050: ctx_dst_pitch */
+	0x00000000,
+/* 0x0054: ctx_dst_tile_mode */
+	0x00000000,
+/* 0x0058: ctx_dst_xsize */
+	0x00000000,
+/* 0x005c: ctx_dst_ysize */
+	0x00000000,
+/* 0x0060: ctx_dst_zsize */
+	0x00000000,
+/* 0x0064: ctx_dst_zoff */
+	0x00000000,
+/* 0x0068: ctx_dst_xoff */
+	0x00000000,
+/* 0x006c: ctx_dst_yoff */
+	0x00000000,
+/* 0x0070: ctx_dst_cpp */
+	0x00000000,
+/* 0x0074: ctx_format */
+	0x00000000,
+/* 0x0078: ctx_swz_const0 */
+	0x00000000,
+/* 0x007c: ctx_swz_const1 */
+	0x00000000,
+/* 0x0080: ctx_xcnt */
+	0x00000000,
+/* 0x0084: ctx_ycnt */
 	0x00000000,
 	0x00000000,
 	0x00000000,
@@ -30,39 +98,7 @@
 	0x00000000,
 	0x00000000,
 	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
+/* 0x0100: dispatch_table */
 	0x00010000,
 	0x00000000,
 	0x00000000,
@@ -73,6 +109,7 @@
 	0x00010162,
 	0x00000000,
 	0x00030060,
+/* 0x0128: dispatch_dma */
 	0x00010170,
 	0x00000000,
 	0x00010170,
@@ -118,11 +155,11 @@
 	0x0000001c,
 	0xffffff00,
 	0x00000020,
-	0x0000000f,
+	0x00000000,
 	0x00000048,
 	0xffffff00,
 	0x0000004c,
-	0x0000000f,
+	0x00000000,
 	0x00000024,
 	0xfff80000,
 	0x00000050,
@@ -146,7 +183,8 @@
 	0x00000800,
 };
 
-uint32_t nva3_pcopy_code[] = {
+u32 nva3_pcopy_code[] = {
+/* 0x0000: main */
 	0x04fe04bd,
 	0x3517f000,
 	0xf10010fe,
@@ -158,23 +196,31 @@
 	0x17f11031,
 	0x27f01200,
 	0x0012d003,
+/* 0x002f: spin */
 	0xf40031f4,
 	0x0ef40028,
+/* 0x0035: ih */
 	0x8001cffd,
 	0xf40812c4,
 	0x21f4060b,
+/* 0x0041: ih_no_chsw */
 	0x0412c472,
 	0xf4060bf4,
+/* 0x004a: ih_no_cmd */
 	0x11c4c321,
 	0x4001d00c,
+/* 0x0052: swctx */
 	0x47f101f8,
 	0x4bfe7700,
 	0x0007fe00,
 	0xf00204b9,
 	0x01f40643,
 	0x0604fa09,
+/* 0x006b: swctx_load */
 	0xfa060ef4,
+/* 0x006e: swctx_done */
 	0x03f80504,
+/* 0x0072: chsw */
 	0x27f100f8,
 	0x23cf1400,
 	0x1e3fc800,
@@ -183,18 +229,22 @@
 	0x1e3af052,
 	0xf00023d0,
 	0x24d00147,
+/* 0x0093: chsw_no_unload */
 	0xcf00f880,
 	0x3dc84023,
 	0x220bf41e,
 	0xf40131f4,
 	0x57f05221,
 	0x0367f004,
+/* 0x00a8: chsw_load_ctx_dma */
 	0xa07856bc,
 	0xb6018068,
 	0x87d00884,
 	0x0162b600,
+/* 0x00bb: chsw_finish_load */
 	0xf0f018f4,
 	0x23d00237,
+/* 0x00c3: dispatch */
 	0xf100f880,
 	0xcf190037,
 	0x33cf4032,
@@ -202,6 +252,7 @@
 	0x1024b607,
 	0x010057f1,
 	0x74bd64bd,
+/* 0x00dc: dispatch_loop */
 	0x58005658,
 	0x50b60157,
 	0x0446b804,
@@ -211,6 +262,7 @@
 	0xb60276bb,
 	0x57bb0374,
 	0xdf0ef400,
+/* 0x0100: dispatch_valid_mthd */
 	0xb60246bb,
 	0x45bb0344,
 	0x01459800,
@@ -220,31 +272,41 @@
 	0xb0014658,
 	0x1bf40064,
 	0x00538009,
+/* 0x0127: dispatch_cmd */
 	0xf4300ef4,
 	0x55f90132,
 	0xf40c01f4,
+/* 0x0132: dispatch_invalid_bitfield */
 	0x25f0250e,
+/* 0x0135: dispatch_illegal_mthd */
 	0x0125f002,
+/* 0x0138: dispatch_error */
 	0x100047f1,
 	0xd00042d0,
 	0x27f04043,
 	0x0002d040,
+/* 0x0148: hostirq_wait */
 	0xf08002cf,
 	0x24b04024,
 	0xf71bf400,
+/* 0x0154: dispatch_done */
 	0x1d0027f1,
 	0xd00137f0,
 	0x00f80023,
+/* 0x0160: cmd_nop */
+/* 0x0162: cmd_pm_trigger */
 	0x27f100f8,
 	0x34bd2200,
 	0xd00233f0,
 	0x00f80023,
+/* 0x0170: cmd_dma */
 	0x012842b7,
 	0xf00145b6,
 	0x43801e39,
 	0x0040b701,
 	0x0644b606,
 	0xf80043d0,
+/* 0x0189: cmd_exec_set_format */
 	0xf030f400,
 	0xb00001b0,
 	0x01b00101,
@@ -256,20 +318,26 @@
 	0x70b63847,
 	0x0232f401,
 	0x94bd84bd,
+/* 0x01b4: ncomp_loop */
 	0xb60f4ac4,
 	0xb4bd0445,
+/* 0x01bc: bpc_loop */
 	0xf404a430,
 	0xa5ff0f18,
 	0x00cbbbc0,
 	0xf40231f4,
+/* 0x01ce: cmp_c0 */
 	0x1bf4220e,
 	0x10c7f00c,
 	0xf400cbbb,
+/* 0x01da: cmp_c1 */
 	0xa430160e,
 	0x0c18f406,
 	0xbb14c7f0,
 	0x0ef400cb,
+/* 0x01e9: cmp_zero */
 	0x80c7f107,
+/* 0x01ed: bpc_next */
 	0x01c83800,
 	0xb60180b6,
 	0xb5b801b0,
@@ -280,6 +348,7 @@
 	0x98110680,
 	0x68fd2008,
 	0x0502f400,
+/* 0x0216: dst_xcnt */
 	0x75fd64bd,
 	0x1c078000,
 	0xf10078fd,
@@ -304,6 +373,7 @@
 	0x980056d0,
 	0x56d01f06,
 	0x1030f440,
+/* 0x0276: cmd_exec_set_surface_tiled */
 	0x579800f8,
 	0x6879c70a,
 	0xb66478c7,
@@ -311,9 +381,11 @@
 	0x0e76b060,
 	0xf0091bf4,
 	0x0ef40477,
+/* 0x0291: xtile64 */
 	0x027cf00f,
 	0xfd1170b6,
 	0x77f00947,
+/* 0x029d: xtileok */
 	0x0f5a9806,
 	0xfd115b98,
 	0xb7f000ab,
@@ -371,6 +443,7 @@
 	0x67d00600,
 	0x0060b700,
 	0x0068d004,
+/* 0x0382: cmd_exec_set_surface_linear */
 	0x6cf000f8,
 	0x0260b702,
 	0x0864b602,
@@ -381,13 +454,16 @@
 	0xb70067d0,
 	0x98040060,
 	0x67d00957,
+/* 0x03ab: cmd_exec_wait */
 	0xf900f800,
 	0xf110f900,
 	0xb6080007,
+/* 0x03b6: loop */
 	0x01cf0604,
 	0x0114f000,
 	0xfcfa1bf4,
 	0xf800fc10,
+/* 0x03c5: cmd_exec_query */
 	0x0d34c800,
 	0xf5701bf4,
 	0xf103ab21,
@@ -417,6 +493,7 @@
 	0x47f10153,
 	0x44b60800,
 	0x0045d006,
+/* 0x0438: query_counter */
 	0x03ab21f5,
 	0x080c47f1,
 	0x980644b6,
@@ -439,11 +516,13 @@
 	0x47f10153,
 	0x44b60800,
 	0x0045d006,
+/* 0x0492: cmd_exec */
 	0x21f500f8,
 	0x3fc803ab,
 	0x0e0bf400,
 	0x018921f5,
 	0x020047f1,
+/* 0x04a7: cmd_exec_no_format */
 	0xf11e0ef4,
 	0xb6081067,
 	0x77f00664,
@@ -451,19 +530,24 @@
 	0x981c0780,
 	0x67d02007,
 	0x4067d000,
+/* 0x04c2: cmd_exec_init_src_surface */
 	0x32f444bd,
 	0xc854bd02,
 	0x0bf4043f,
 	0x8221f50a,
 	0x0a0ef403,
+/* 0x04d4: src_tiled */
 	0x027621f5,
+/* 0x04db: cmd_exec_init_dst_surface */
 	0xf40749f0,
 	0x57f00231,
 	0x083fc82c,
 	0xf50a0bf4,
 	0xf4038221,
+/* 0x04ee: dst_tiled */
 	0x21f50a0e,
 	0x49f00276,
+/* 0x04f5: cmd_exec_kick */
 	0x0057f108,
 	0x0654b608,
 	0xd0210698,
@@ -473,6 +557,8 @@
 	0xc80054d0,
 	0x0bf40c3f,
 	0xc521f507,
+/* 0x0519: cmd_exec_done */
+/* 0x051b: cmd_wrcache_flush */
 	0xf100f803,
 	0xbd220027,
 	0x0133f034,
diff --git a/drivers/gpu/drm/nouveau/nvc0_copy.fuc.h b/drivers/gpu/drm/nouveau/nvc0_copy.fuc.h
index a8d1745..cd879f3 100644
--- a/drivers/gpu/drm/nouveau/nvc0_copy.fuc.h
+++ b/drivers/gpu/drm/nouveau/nvc0_copy.fuc.h
@@ -1,4 +1,65 @@
-uint32_t nvc0_pcopy_data[] = {
+u32 nvc0_pcopy_data[] = {
+/* 0x0000: ctx_object */
+	0x00000000,
+/* 0x0004: ctx_query_address_high */
+	0x00000000,
+/* 0x0008: ctx_query_address_low */
+	0x00000000,
+/* 0x000c: ctx_query_counter */
+	0x00000000,
+/* 0x0010: ctx_src_address_high */
+	0x00000000,
+/* 0x0014: ctx_src_address_low */
+	0x00000000,
+/* 0x0018: ctx_src_pitch */
+	0x00000000,
+/* 0x001c: ctx_src_tile_mode */
+	0x00000000,
+/* 0x0020: ctx_src_xsize */
+	0x00000000,
+/* 0x0024: ctx_src_ysize */
+	0x00000000,
+/* 0x0028: ctx_src_zsize */
+	0x00000000,
+/* 0x002c: ctx_src_zoff */
+	0x00000000,
+/* 0x0030: ctx_src_xoff */
+	0x00000000,
+/* 0x0034: ctx_src_yoff */
+	0x00000000,
+/* 0x0038: ctx_src_cpp */
+	0x00000000,
+/* 0x003c: ctx_dst_address_high */
+	0x00000000,
+/* 0x0040: ctx_dst_address_low */
+	0x00000000,
+/* 0x0044: ctx_dst_pitch */
+	0x00000000,
+/* 0x0048: ctx_dst_tile_mode */
+	0x00000000,
+/* 0x004c: ctx_dst_xsize */
+	0x00000000,
+/* 0x0050: ctx_dst_ysize */
+	0x00000000,
+/* 0x0054: ctx_dst_zsize */
+	0x00000000,
+/* 0x0058: ctx_dst_zoff */
+	0x00000000,
+/* 0x005c: ctx_dst_xoff */
+	0x00000000,
+/* 0x0060: ctx_dst_yoff */
+	0x00000000,
+/* 0x0064: ctx_dst_cpp */
+	0x00000000,
+/* 0x0068: ctx_format */
+	0x00000000,
+/* 0x006c: ctx_swz_const0 */
+	0x00000000,
+/* 0x0070: ctx_swz_const1 */
+	0x00000000,
+/* 0x0074: ctx_xcnt */
+	0x00000000,
+/* 0x0078: ctx_ycnt */
 	0x00000000,
 	0x00000000,
 	0x00000000,
@@ -33,36 +94,7 @@
 	0x00000000,
 	0x00000000,
 	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
-	0x00000000,
+/* 0x0100: dispatch_table */
 	0x00010000,
 	0x00000000,
 	0x00000000,
@@ -111,11 +143,11 @@
 	0x00000010,
 	0xffffff00,
 	0x00000014,
-	0x0000000f,
+	0x00000000,
 	0x0000003c,
 	0xffffff00,
 	0x00000040,
-	0x0000000f,
+	0x00000000,
 	0x00000018,
 	0xfff80000,
 	0x00000044,
@@ -139,7 +171,8 @@
 	0x00000800,
 };
 
-uint32_t nvc0_pcopy_code[] = {
+u32 nvc0_pcopy_code[] = {
+/* 0x0000: main */
 	0x04fe04bd,
 	0x3517f000,
 	0xf10010fe,
@@ -151,15 +184,20 @@
 	0x17f11031,
 	0x27f01200,
 	0x0012d003,
+/* 0x002f: spin */
 	0xf40031f4,
 	0x0ef40028,
+/* 0x0035: ih */
 	0x8001cffd,
 	0xf40812c4,
 	0x21f4060b,
+/* 0x0041: ih_no_chsw */
 	0x0412c4ca,
 	0xf5070bf4,
+/* 0x004b: ih_no_cmd */
 	0xc4010221,
 	0x01d00c11,
+/* 0x0053: swctx */
 	0xf101f840,
 	0xfe770047,
 	0x47f1004b,
@@ -188,8 +226,11 @@
 	0xf00204b9,
 	0x01f40643,
 	0x0604fa09,
+/* 0x00c3: swctx_load */
 	0xfa060ef4,
+/* 0x00c6: swctx_done */
 	0x03f80504,
+/* 0x00ca: chsw */
 	0x27f100f8,
 	0x23cf1400,
 	0x1e3fc800,
@@ -198,18 +239,22 @@
 	0x1e3af053,
 	0xf00023d0,
 	0x24d00147,
+/* 0x00eb: chsw_no_unload */
 	0xcf00f880,
 	0x3dc84023,
 	0x090bf41e,
 	0xf40131f4,
+/* 0x00fa: chsw_finish_load */
 	0x37f05321,
 	0x8023d002,
+/* 0x0102: dispatch */
 	0x37f100f8,
 	0x32cf1900,
 	0x0033cf40,
 	0x07ff24e4,
 	0xf11024b6,
 	0xbd010057,
+/* 0x011b: dispatch_loop */
 	0x5874bd64,
 	0x57580056,
 	0x0450b601,
@@ -219,6 +264,7 @@
 	0xbb0f08f4,
 	0x74b60276,
 	0x0057bb03,
+/* 0x013f: dispatch_valid_mthd */
 	0xbbdf0ef4,
 	0x44b60246,
 	0x0045bb03,
@@ -229,24 +275,33 @@
 	0x64b00146,
 	0x091bf400,
 	0xf4005380,
+/* 0x0166: dispatch_cmd */
 	0x32f4300e,
 	0xf455f901,
 	0x0ef40c01,
+/* 0x0171: dispatch_invalid_bitfield */
 	0x0225f025,
+/* 0x0174: dispatch_illegal_mthd */
+/* 0x0177: dispatch_error */
 	0xf10125f0,
 	0xd0100047,
 	0x43d00042,
 	0x4027f040,
+/* 0x0187: hostirq_wait */
 	0xcf0002d0,
 	0x24f08002,
 	0x0024b040,
+/* 0x0193: dispatch_done */
 	0xf1f71bf4,
 	0xf01d0027,
 	0x23d00137,
+/* 0x019f: cmd_nop */
 	0xf800f800,
+/* 0x01a1: cmd_pm_trigger */
 	0x0027f100,
 	0xf034bd22,
 	0x23d00233,
+/* 0x01af: cmd_exec_set_format */
 	0xf400f800,
 	0x01b0f030,
 	0x0101b000,
@@ -258,20 +313,26 @@
 	0x3847c701,
 	0xf40170b6,
 	0x84bd0232,
+/* 0x01da: ncomp_loop */
 	0x4ac494bd,
 	0x0445b60f,
+/* 0x01e2: bpc_loop */
 	0xa430b4bd,
 	0x0f18f404,
 	0xbbc0a5ff,
 	0x31f400cb,
 	0x220ef402,
+/* 0x01f4: cmp_c0 */
 	0xf00c1bf4,
 	0xcbbb10c7,
 	0x160ef400,
+/* 0x0200: cmp_c1 */
 	0xf406a430,
 	0xc7f00c18,
 	0x00cbbb14,
+/* 0x020f: cmp_zero */
 	0xf1070ef4,
+/* 0x0213: bpc_next */
 	0x380080c7,
 	0x80b601c8,
 	0x01b0b601,
@@ -283,6 +344,7 @@
 	0x1d08980e,
 	0xf40068fd,
 	0x64bd0502,
+/* 0x023c: dst_xcnt */
 	0x800075fd,
 	0x78fd1907,
 	0x1057f100,
@@ -307,15 +369,18 @@
 	0x1c069800,
 	0xf44056d0,
 	0x00f81030,
+/* 0x029c: cmd_exec_set_surface_tiled */
 	0xc7075798,
 	0x78c76879,
 	0x0380b664,
 	0xb06077c7,
 	0x1bf40e76,
 	0x0477f009,
+/* 0x02b7: xtile64 */
 	0xf00f0ef4,
 	0x70b6027c,
 	0x0947fd11,
+/* 0x02c3: xtileok */
 	0x980677f0,
 	0x5b980c5a,
 	0x00abfd0e,
@@ -374,6 +439,7 @@
 	0xb70067d0,
 	0xd0040060,
 	0x00f80068,
+/* 0x03a8: cmd_exec_set_surface_linear */
 	0xb7026cf0,
 	0xb6020260,
 	0x57980864,
@@ -384,12 +450,15 @@
 	0x0060b700,
 	0x06579804,
 	0xf80067d0,
+/* 0x03d1: cmd_exec_wait */
 	0xf900f900,
 	0x0007f110,
 	0x0604b608,
+/* 0x03dc: loop */
 	0xf00001cf,
 	0x1bf40114,
 	0xfc10fcfa,
+/* 0x03eb: cmd_exec_query */
 	0xc800f800,
 	0x1bf40d34,
 	0xd121f570,
@@ -419,6 +488,7 @@
 	0x0153f026,
 	0x080047f1,
 	0xd00644b6,
+/* 0x045e: query_counter */
 	0x21f50045,
 	0x47f103d1,
 	0x44b6080c,
@@ -442,11 +512,13 @@
 	0x080047f1,
 	0xd00644b6,
 	0x00f80045,
+/* 0x04b8: cmd_exec */
 	0x03d121f5,
 	0xf4003fc8,
 	0x21f50e0b,
 	0x47f101af,
 	0x0ef40200,
+/* 0x04cd: cmd_exec_no_format */
 	0x1067f11e,
 	0x0664b608,
 	0x800177f0,
@@ -454,18 +526,23 @@
 	0x1d079819,
 	0xd00067d0,
 	0x44bd4067,
+/* 0x04e8: cmd_exec_init_src_surface */
 	0xbd0232f4,
 	0x043fc854,
 	0xf50a0bf4,
 	0xf403a821,
+/* 0x04fa: src_tiled */
 	0x21f50a0e,
 	0x49f0029c,
+/* 0x0501: cmd_exec_init_dst_surface */
 	0x0231f407,
 	0xc82c57f0,
 	0x0bf4083f,
 	0xa821f50a,
 	0x0a0ef403,
+/* 0x0514: dst_tiled */
 	0x029c21f5,
+/* 0x051b: cmd_exec_kick */
 	0xf10849f0,
 	0xb6080057,
 	0x06980654,
@@ -475,7 +552,9 @@
 	0x54d00546,
 	0x0c3fc800,
 	0xf5070bf4,
+/* 0x053f: cmd_exec_done */
 	0xf803eb21,
+/* 0x0541: cmd_wrcache_flush */
 	0x0027f100,
 	0xf034bd22,
 	0x23d00133,
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c
index 0247250..8a555fb 100644
--- a/drivers/gpu/drm/nouveau/nvd0_display.c
+++ b/drivers/gpu/drm/nouveau/nvd0_display.c
@@ -790,7 +790,7 @@
 	struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
 	int ch = EVO_CURS(nv_crtc->index);
 
-	evo_piow(crtc->dev, ch, 0x0084, (y << 16) | x);
+	evo_piow(crtc->dev, ch, 0x0084, (y << 16) | (x & 0xffff));
 	evo_piow(crtc->dev, ch, 0x0080, 0x00000000);
 	return 0;
 }
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index af1054f..a53ca30 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -259,7 +259,7 @@
 		/* adjust pm to dpms changes BEFORE enabling crtcs */
 		radeon_pm_compute_clocks(rdev);
 		/* disable crtc pair power gating before programming */
-		if (ASIC_IS_DCE6(rdev))
+		if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set)
 			atombios_powergate_crtc(crtc, ATOM_DISABLE);
 		atombios_enable_crtc(crtc, ATOM_ENABLE);
 		if (ASIC_IS_DCE3(rdev) && !ASIC_IS_DCE6(rdev))
@@ -279,7 +279,7 @@
 		atombios_enable_crtc(crtc, ATOM_DISABLE);
 		radeon_crtc->enabled = false;
 		/* power gating is per-pair */
-		if (ASIC_IS_DCE6(rdev)) {
+		if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set) {
 			struct drm_crtc *other_crtc;
 			struct radeon_crtc *other_radeon_crtc;
 			list_for_each_entry(other_crtc, &rdev->ddev->mode_config.crtc_list, head) {
@@ -1634,18 +1634,28 @@
 static void atombios_crtc_prepare(struct drm_crtc *crtc)
 {
 	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
+	struct drm_device *dev = crtc->dev;
+	struct radeon_device *rdev = dev->dev_private;
 
+	radeon_crtc->in_mode_set = true;
 	/* pick pll */
 	radeon_crtc->pll_id = radeon_atom_pick_pll(crtc);
 
+	/* disable crtc pair power gating before programming */
+	if (ASIC_IS_DCE6(rdev))
+		atombios_powergate_crtc(crtc, ATOM_DISABLE);
+
 	atombios_lock_crtc(crtc, ATOM_ENABLE);
 	atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);
 }
 
 static void atombios_crtc_commit(struct drm_crtc *crtc)
 {
+	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
+
 	atombios_crtc_dpms(crtc, DRM_MODE_DPMS_ON);
 	atombios_lock_crtc(crtc, ATOM_DISABLE);
+	radeon_crtc->in_mode_set = false;
 }
 
 static void atombios_crtc_disable(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index c57d856..886b41f 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -22,6 +22,7 @@
  *
  * Authors: Dave Airlie
  *          Alex Deucher
+ *          Jerome Glisse
  */
 #include "drmP.h"
 #include "radeon_drm.h"
@@ -637,7 +638,6 @@
 	ret = radeon_dp_aux_native_read(radeon_connector, DP_LANE0_1_STATUS,
 					link_status, DP_LINK_STATUS_SIZE, 100);
 	if (ret <= 0) {
-		DRM_ERROR("displayport link status failed\n");
 		return false;
 	}
 
@@ -816,8 +816,10 @@
 		else
 			mdelay(dp_info->rd_interval * 4);
 
-		if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status))
+		if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status)) {
+			DRM_ERROR("displayport link status failed\n");
 			break;
+		}
 
 		if (dp_clock_recovery_ok(dp_info->link_status, dp_info->dp_lane_count)) {
 			clock_recovery = true;
@@ -879,8 +881,10 @@
 		else
 			mdelay(dp_info->rd_interval * 4);
 
-		if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status))
+		if (!radeon_dp_get_link_status(dp_info->radeon_connector, dp_info->link_status)) {
+			DRM_ERROR("displayport link status failed\n");
 			break;
+		}
 
 		if (dp_channel_eq_ok(dp_info->link_status, dp_info->dp_lane_count)) {
 			channel_eq = true;
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index 2d39f99..a3ae788 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1392,10 +1392,18 @@
 	case DRM_MODE_DPMS_ON:
 		/* some early dce3.2 boards have a bug in their transmitter control table */
 		if ((rdev->family == CHIP_RV710) || (rdev->family == CHIP_RV730) ||
-		    ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev))
+		    ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) {
+			if (ASIC_IS_DCE6(rdev)) {
+				/* It seems we need to call ATOM_ENCODER_CMD_SETUP again
+				 * before reenabling encoder on DPMS ON, otherwise we never
+				 * get picture
+				 */
+				atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0);
+			}
 			atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);
-		else
+		} else {
 			atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);
+		}
 		if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) {
 			if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
 				atombios_set_edp_panel_power(connector,
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index cfa372c..e5328da 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1029,6 +1029,11 @@
 		WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
 		WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
 		WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
+		if ((rdev->family == CHIP_JUNIPER) ||
+		    (rdev->family == CHIP_CYPRESS) ||
+		    (rdev->family == CHIP_HEMLOCK) ||
+		    (rdev->family == CHIP_BARTS))
+			WREG32(MC_VM_MD_L1_TLB3_CNTL, tmp);
 	}
 	WREG32(MC_VM_MB_L1_TLB0_CNTL, tmp);
 	WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp);
@@ -1112,24 +1117,8 @@
 
 void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *save)
 {
-	save->vga_control[0] = RREG32(D1VGA_CONTROL);
-	save->vga_control[1] = RREG32(D2VGA_CONTROL);
 	save->vga_render_control = RREG32(VGA_RENDER_CONTROL);
 	save->vga_hdp_control = RREG32(VGA_HDP_CONTROL);
-	save->crtc_control[0] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET);
-	save->crtc_control[1] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET);
-	if (rdev->num_crtc >= 4) {
-		save->vga_control[2] = RREG32(EVERGREEN_D3VGA_CONTROL);
-		save->vga_control[3] = RREG32(EVERGREEN_D4VGA_CONTROL);
-		save->crtc_control[2] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET);
-		save->crtc_control[3] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET);
-	}
-	if (rdev->num_crtc >= 6) {
-		save->vga_control[4] = RREG32(EVERGREEN_D5VGA_CONTROL);
-		save->vga_control[5] = RREG32(EVERGREEN_D6VGA_CONTROL);
-		save->crtc_control[4] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET);
-		save->crtc_control[5] = RREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET);
-	}
 
 	/* Stop all video */
 	WREG32(VGA_RENDER_CONTROL, 0);
@@ -1240,47 +1229,6 @@
 	/* Unlock host access */
 	WREG32(VGA_HDP_CONTROL, save->vga_hdp_control);
 	mdelay(1);
-	/* Restore video state */
-	WREG32(D1VGA_CONTROL, save->vga_control[0]);
-	WREG32(D2VGA_CONTROL, save->vga_control[1]);
-	if (rdev->num_crtc >= 4) {
-		WREG32(EVERGREEN_D3VGA_CONTROL, save->vga_control[2]);
-		WREG32(EVERGREEN_D4VGA_CONTROL, save->vga_control[3]);
-	}
-	if (rdev->num_crtc >= 6) {
-		WREG32(EVERGREEN_D5VGA_CONTROL, save->vga_control[4]);
-		WREG32(EVERGREEN_D6VGA_CONTROL, save->vga_control[5]);
-	}
-	WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 1);
-	WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 1);
-	if (rdev->num_crtc >= 4) {
-		WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 1);
-		WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 1);
-	}
-	if (rdev->num_crtc >= 6) {
-		WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 1);
-		WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 1);
-	}
-	WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC0_REGISTER_OFFSET, save->crtc_control[0]);
-	WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC1_REGISTER_OFFSET, save->crtc_control[1]);
-	if (rdev->num_crtc >= 4) {
-		WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC2_REGISTER_OFFSET, save->crtc_control[2]);
-		WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC3_REGISTER_OFFSET, save->crtc_control[3]);
-	}
-	if (rdev->num_crtc >= 6) {
-		WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, save->crtc_control[4]);
-		WREG32(EVERGREEN_CRTC_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, save->crtc_control[5]);
-	}
-	WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
-	WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
-	if (rdev->num_crtc >= 4) {
-		WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC2_REGISTER_OFFSET, 0);
-		WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC3_REGISTER_OFFSET, 0);
-	}
-	if (rdev->num_crtc >= 6) {
-		WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC4_REGISTER_OFFSET, 0);
-		WREG32(EVERGREEN_CRTC_UPDATE_LOCK + EVERGREEN_CRTC5_REGISTER_OFFSET, 0);
-	}
 	WREG32(VGA_RENDER_CONTROL, save->vga_render_control);
 }
 
@@ -2136,9 +2084,20 @@
 	/* num banks is 8 on all fusion asics. 0 = 4, 1 = 8, 2 = 16 */
 	if (rdev->flags & RADEON_IS_IGP)
 		rdev->config.evergreen.tile_config |= 1 << 4;
-	else
-		rdev->config.evergreen.tile_config |=
-			((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) << 4;
+	else {
+		switch ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) {
+		case 0: /* four banks */
+			rdev->config.evergreen.tile_config |= 0 << 4;
+			break;
+		case 1: /* eight banks */
+			rdev->config.evergreen.tile_config |= 1 << 4;
+			break;
+		case 2: /* sixteen banks */
+		default:
+			rdev->config.evergreen.tile_config |= 2 << 4;
+			break;
+		}
+	}
 	rdev->config.evergreen.tile_config |=
 		((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT) << 8;
 	rdev->config.evergreen.tile_config |=
@@ -2170,9 +2129,9 @@
 		WREG32(CC_SYS_RB_BACKEND_DISABLE, rb);
 		WREG32(GC_USER_RB_BACKEND_DISABLE, rb);
 		WREG32(CC_GC_SHADER_PIPE_CONFIG, sp);
-        }
+	}
 
-	grbm_gfx_index |= SE_BROADCAST_WRITES;
+	grbm_gfx_index = INSTANCE_BROADCAST_WRITES | SE_BROADCAST_WRITES;
 	WREG32(GRBM_GFX_INDEX, grbm_gfx_index);
 	WREG32(RLC_GFX_INDEX, grbm_gfx_index);
 
@@ -2202,6 +2161,9 @@
 	smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.evergreen.sx_num_of_sets);
 	WREG32(SMX_DC_CTL0, smx_dc_ctl0);
 
+	if (rdev->family <= CHIP_SUMO2)
+		WREG32(SMX_SAR_CTL0, 0x00010000);
+
 	WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_size / 4) - 1) |
 					POSITION_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_pos_size / 4) - 1) |
 					SMX_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_smx_size / 4) - 1)));
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 70089d3..ea69dae 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -52,6 +52,7 @@
 	u32			cb_color_view[12];
 	u32			cb_color_pitch[12];
 	u32			cb_color_slice[12];
+	u32			cb_color_slice_idx[12];
 	u32			cb_color_attrib[12];
 	u32			cb_color_cmask_slice[8];/* unused */
 	u32			cb_color_fmask_slice[8];/* unused */
@@ -127,12 +128,14 @@
 		track->cb_color_info[i] = 0;
 		track->cb_color_view[i] = 0xFFFFFFFF;
 		track->cb_color_pitch[i] = 0;
-		track->cb_color_slice[i] = 0;
+		track->cb_color_slice[i] = 0xfffffff;
+		track->cb_color_slice_idx[i] = 0;
 	}
 	track->cb_target_mask = 0xFFFFFFFF;
 	track->cb_shader_mask = 0xFFFFFFFF;
 	track->cb_dirty = true;
 
+	track->db_depth_slice = 0xffffffff;
 	track->db_depth_view = 0xFFFFC000;
 	track->db_depth_size = 0xFFFFFFFF;
 	track->db_depth_control = 0xFFFFFFFF;
@@ -250,10 +253,9 @@
 {
 	struct evergreen_cs_track *track = p->track;
 	unsigned palign, halign, tileb, slice_pt;
+	unsigned mtile_pr, mtile_ps, mtileb;
 
 	tileb = 64 * surf->bpe * surf->nsamples;
-	palign = track->group_size / (8 * surf->bpe * surf->nsamples);
-	palign = MAX(8, palign);
 	slice_pt = 1;
 	if (tileb > surf->tsplit) {
 		slice_pt = tileb / surf->tsplit;
@@ -262,7 +264,10 @@
 	/* macro tile width & height */
 	palign = (8 * surf->bankw * track->npipes) * surf->mtilea;
 	halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea;
-	surf->layer_size = surf->nbx * surf->nby * surf->bpe * slice_pt;
+	mtileb = (palign / 8) * (halign / 8) * tileb;;
+	mtile_pr = surf->nbx / palign;
+	mtile_ps = (mtile_pr * surf->nby) / halign;
+	surf->layer_size = mtile_ps * mtileb * slice_pt;
 	surf->base_align = (palign / 8) * (halign / 8) * tileb;
 	surf->palign = palign;
 	surf->halign = halign;
@@ -434,6 +439,39 @@
 
 	offset += surf.layer_size * mslice;
 	if (offset > radeon_bo_size(track->cb_color_bo[id])) {
+		/* old ddx are broken they allocate bo with w*h*bpp but
+		 * program slice with ALIGN(h, 8), catch this and patch
+		 * command stream.
+		 */
+		if (!surf.mode) {
+			volatile u32 *ib = p->ib->ptr;
+			unsigned long tmp, nby, bsize, size, min = 0;
+
+			/* find the height the ddx wants */
+			if (surf.nby > 8) {
+				min = surf.nby - 8;
+			}
+			bsize = radeon_bo_size(track->cb_color_bo[id]);
+			tmp = track->cb_color_bo_offset[id] << 8;
+			for (nby = surf.nby; nby > min; nby--) {
+				size = nby * surf.nbx * surf.bpe * surf.nsamples;
+				if ((tmp + size * mslice) <= bsize) {
+					break;
+				}
+			}
+			if (nby > min) {
+				surf.nby = nby;
+				slice = ((nby * surf.nbx) / 64) - 1;
+				if (!evergreen_surface_check(p, &surf, "cb")) {
+					/* check if this one works */
+					tmp += surf.layer_size * mslice;
+					if (tmp <= bsize) {
+						ib[track->cb_color_slice_idx[id]] = slice;
+						goto old_ddx_ok;
+					}
+				}
+			}
+		}
 		dev_warn(p->dev, "%s:%d cb[%d] bo too small (layer size %d, "
 			 "offset %d, max layer %d, bo size %ld, slice %d)\n",
 			 __func__, __LINE__, id, surf.layer_size,
@@ -446,6 +484,7 @@
 			surf.tsplit, surf.mtilea);
 		return -EINVAL;
 	}
+old_ddx_ok:
 
 	return 0;
 }
@@ -1532,6 +1571,7 @@
 	case CB_COLOR7_SLICE:
 		tmp = (reg - CB_COLOR0_SLICE) / 0x3c;
 		track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx);
+		track->cb_color_slice_idx[tmp] = idx;
 		track->cb_dirty = true;
 		break;
 	case CB_COLOR8_SLICE:
@@ -1540,6 +1580,7 @@
 	case CB_COLOR11_SLICE:
 		tmp = ((reg - CB_COLOR8_SLICE) / 0x1c) + 8;
 		track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx);
+		track->cb_color_slice_idx[tmp] = idx;
 		track->cb_dirty = true;
 		break;
 	case CB_COLOR0_ATTRIB:
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index b4eefc3..f62ccd3 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -232,6 +232,7 @@
 #define	MC_VM_MD_L1_TLB0_CNTL				0x2654
 #define	MC_VM_MD_L1_TLB1_CNTL				0x2658
 #define	MC_VM_MD_L1_TLB2_CNTL				0x265C
+#define	MC_VM_MD_L1_TLB3_CNTL				0x2698
 
 #define	FUS_MC_VM_MD_L1_TLB0_CNTL			0x265C
 #define	FUS_MC_VM_MD_L1_TLB1_CNTL			0x2660
@@ -272,6 +273,7 @@
 #define	SCRATCH_UMSK					0x8540
 #define	SCRATCH_ADDR					0x8544
 
+#define	SMX_SAR_CTL0					0xA008
 #define	SMX_DC_CTL0					0xA020
 #define		USE_HASH_FUNCTION				(1 << 0)
 #define		NUMBER_OF_SETS(x)				((x) << 1)
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index a48ca53..9934c9d 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -657,15 +657,28 @@
 		rdev->config.cayman.max_pipes_per_simd = 4;
 		rdev->config.cayman.max_tile_pipes = 2;
 		if ((rdev->pdev->device == 0x9900) ||
-		    (rdev->pdev->device == 0x9901)) {
+		    (rdev->pdev->device == 0x9901) ||
+		    (rdev->pdev->device == 0x9905) ||
+		    (rdev->pdev->device == 0x9906) ||
+		    (rdev->pdev->device == 0x9907) ||
+		    (rdev->pdev->device == 0x9908) ||
+		    (rdev->pdev->device == 0x9909) ||
+		    (rdev->pdev->device == 0x9910) ||
+		    (rdev->pdev->device == 0x9917)) {
 			rdev->config.cayman.max_simds_per_se = 6;
 			rdev->config.cayman.max_backends_per_se = 2;
 		} else if ((rdev->pdev->device == 0x9903) ||
-			   (rdev->pdev->device == 0x9904)) {
+			   (rdev->pdev->device == 0x9904) ||
+			   (rdev->pdev->device == 0x990A) ||
+			   (rdev->pdev->device == 0x9913) ||
+			   (rdev->pdev->device == 0x9918)) {
 			rdev->config.cayman.max_simds_per_se = 4;
 			rdev->config.cayman.max_backends_per_se = 2;
-		} else if ((rdev->pdev->device == 0x9990) ||
-			   (rdev->pdev->device == 0x9991)) {
+		} else if ((rdev->pdev->device == 0x9919) ||
+			   (rdev->pdev->device == 0x9990) ||
+			   (rdev->pdev->device == 0x9991) ||
+			   (rdev->pdev->device == 0x9994) ||
+			   (rdev->pdev->device == 0x99A0)) {
 			rdev->config.cayman.max_simds_per_se = 3;
 			rdev->config.cayman.max_backends_per_se = 1;
 		} else {
@@ -865,10 +878,21 @@
 
 	/* num banks is 8 on all fusion asics. 0 = 4, 1 = 8, 2 = 16 */
 	if (rdev->flags & RADEON_IS_IGP)
-		rdev->config.evergreen.tile_config |= 1 << 4;
-	else
-		rdev->config.cayman.tile_config |=
-			((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) << 4;
+		rdev->config.cayman.tile_config |= 1 << 4;
+	else {
+		switch ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) {
+		case 0: /* four banks */
+			rdev->config.cayman.tile_config |= 0 << 4;
+			break;
+		case 1: /* eight banks */
+			rdev->config.cayman.tile_config |= 1 << 4;
+			break;
+		case 2: /* sixteen banks */
+		default:
+			rdev->config.cayman.tile_config |= 2 << 4;
+			break;
+		}
+	}
 	rdev->config.cayman.tile_config |=
 		((gb_addr_config & PIPE_INTERLEAVE_SIZE_MASK) >> PIPE_INTERLEAVE_SIZE_SHIFT) << 8;
 	rdev->config.cayman.tile_config |=
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index c8187c4..b1ff9cc 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1906,6 +1906,7 @@
 	WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA |
 			       NUM_CLIP_SEQ(3)));
 	WREG32(PA_SC_ENHANCE, FORCE_EOV_MAX_CLK_CNT(4095));
+	WREG32(VC_ENHANCE, 0);
 }
 
 
diff --git a/drivers/gpu/drm/radeon/r600_audio.c b/drivers/gpu/drm/radeon/r600_audio.c
index ba66f30..24e3939 100644
--- a/drivers/gpu/drm/radeon/r600_audio.c
+++ b/drivers/gpu/drm/radeon/r600_audio.c
@@ -239,6 +239,7 @@
 	struct radeon_device *rdev = dev->dev_private;
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
 	struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
+	struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
 	int base_rate = 48000;
 
 	switch (radeon_encoder->encoder_id) {
@@ -264,8 +265,8 @@
 		WREG32(EVERGREEN_AUDIO_PLL1_DIV, clock * 10);
 		WREG32(EVERGREEN_AUDIO_PLL1_UNK, 0x00000071);
 
-		/* Some magic trigger or src sel? */
-		WREG32_P(0x5ac, 0x01, ~0x77);
+		/* Select DTO source */
+		WREG32(0x5ac, radeon_crtc->crtc_id);
 	} else {
 		switch (dig->dig_encoder) {
 		case 0:
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index 59f9c99..12ceb82 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -483,6 +483,7 @@
 #define		TC_L2_SIZE(x)					((x)<<5)
 #define		L2_DISABLE_LATE_HIT				(1<<9)
 
+#define	VC_ENHANCE					0x9714
 
 #define	VGT_CACHE_INVALIDATION				0x88C4
 #define		CACHE_INVALIDATION(x)				((x)<<0)
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 3d9f9f1..665df87 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -262,13 +262,10 @@
  * rv515
  */
 struct rv515_mc_save {
-	u32 d1vga_control;
-	u32 d2vga_control;
 	u32 vga_render_control;
 	u32 vga_hdp_control;
-	u32 d1crtc_control;
-	u32 d2crtc_control;
 };
+
 int rv515_init(struct radeon_device *rdev);
 void rv515_fini(struct radeon_device *rdev);
 uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg);
@@ -401,11 +398,10 @@
  * evergreen
  */
 struct evergreen_mc_save {
-	u32 vga_control[6];
 	u32 vga_render_control;
 	u32 vga_hdp_control;
-	u32 crtc_control[6];
 };
+
 void evergreen_pcie_gart_tlb_flush(struct radeon_device *rdev);
 int evergreen_init(struct radeon_device *rdev);
 void evergreen_fini(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index f6e69b8..b1e3820 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -444,7 +444,9 @@
 	 */
 	if ((dev->pdev->device == 0x9498) &&
 	    (dev->pdev->subsystem_vendor == 0x1682) &&
-	    (dev->pdev->subsystem_device == 0x2452)) {
+	    (dev->pdev->subsystem_device == 0x2452) &&
+	    (i2c_bus->valid == false) &&
+	    !(supported_device & (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT))) {
 		struct radeon_device *rdev = dev->dev_private;
 		*i2c_bus = radeon_lookup_i2c_gpio(rdev, 0x93);
 	}
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 3c2e7a0..3fb7ca9 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -64,14 +64,33 @@
 
 	/* just deal with DP (not eDP) here. */
 	if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
-		int saved_dpms = connector->dpms;
+		struct radeon_connector_atom_dig *dig_connector =
+			radeon_connector->con_priv;
 
-		/* Only turn off the display it it's physically disconnected */
-		if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
-			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
-		else if (radeon_dp_needs_link_train(radeon_connector))
-			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
-		connector->dpms = saved_dpms;
+		/* if existing sink type was not DP no need to retrain */
+		if (dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_DISPLAYPORT)
+			return;
+
+		/* first get sink type as it may be reset after (un)plug */
+		dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector);
+		/* don't do anything if sink is not display port, i.e.,
+		 * passive dp->(dvi|hdmi) adaptor
+		 */
+		if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
+			int saved_dpms = connector->dpms;
+			/* Only turn off the display if it's physically disconnected */
+			if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
+				drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
+			} else if (radeon_dp_needs_link_train(radeon_connector)) {
+				/* set it to OFF so that drm_helper_connector_dpms()
+				 * won't return immediately since the current state
+				 * is ON at this point.
+				 */
+				connector->dpms = DRM_MODE_DPMS_OFF;
+				drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
+			}
+			connector->dpms = saved_dpms;
+		}
 	}
 }
 
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 5cac832..cf723c4 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -158,6 +158,7 @@
 	return 0;
 }
 
+/* XXX: note that this is called from the legacy UMS CS ioctl as well */
 int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
 {
 	struct drm_radeon_cs *cs = data;
@@ -252,23 +253,25 @@
 		}
 	}
 
-	if ((p->cs_flags & RADEON_CS_USE_VM) &&
-	    !p->rdev->vm_manager.enabled) {
-		DRM_ERROR("VM not active on asic!\n");
-		return -EINVAL;
+	/* these are KMS only */
+	if (p->rdev) {
+		if ((p->cs_flags & RADEON_CS_USE_VM) &&
+		    !p->rdev->vm_manager.enabled) {
+			DRM_ERROR("VM not active on asic!\n");
+			return -EINVAL;
+		}
+
+		/* we only support VM on SI+ */
+		if ((p->rdev->family >= CHIP_TAHITI) &&
+		    ((p->cs_flags & RADEON_CS_USE_VM) == 0)) {
+			DRM_ERROR("VM required on SI+!\n");
+			return -EINVAL;
+		}
+
+		if (radeon_cs_get_ring(p, ring, priority))
+			return -EINVAL;
 	}
 
-	/* we only support VM on SI+ */
-	if ((p->rdev->family >= CHIP_TAHITI) &&
-	    ((p->cs_flags & RADEON_CS_USE_VM) == 0)) {
-		DRM_ERROR("VM required on SI+!\n");
-		return -EINVAL;
-	}
-
-	if (radeon_cs_get_ring(p, ring, priority))
-		return -EINVAL;
-
-
 	/* deal with non-vm */
 	if ((p->chunk_ib_idx != -1) &&
 	    ((p->cs_flags & RADEON_CS_USE_VM) == 0) &&
@@ -374,7 +377,7 @@
 	if (r) {
 		DRM_ERROR("Failed to schedule IB !\n");
 	}
-	return 0;
+	return r;
 }
 
 static int radeon_bo_vm_update_pte(struct radeon_cs_parser *parser,
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index 42acc64..711e95a 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -262,8 +262,14 @@
 				if (!(cursor_end & 0x7f))
 					w--;
 			}
-			if (w <= 0)
+			if (w <= 0) {
 				w = 1;
+				cursor_end = x - xorigin + w;
+				if (!(cursor_end & 0x7f)) {
+					x--;
+					WARN_ON_ONCE(x < 0);
+				}
+			}
 		}
 	}
 
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index ef7bb3f..15250fb 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -57,9 +57,10 @@
  *   2.13.0 - virtual memory support, streamout
  *   2.14.0 - add evergreen tiling informations
  *   2.15.0 - add max_pipes query
+ *   2.16.0 - fix evergreen 2D tiled surface calculation
  */
 #define KMS_DRIVER_MAJOR	2
-#define KMS_DRIVER_MINOR	15
+#define KMS_DRIVER_MINOR	16
 #define KMS_DRIVER_PATCHLEVEL	0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index c58a036..2a4c592 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -289,8 +289,9 @@
 	rdev->vm_manager.enabled = false;
 
 	/* mark first vm as always in use, it's the system one */
+	/* allocate enough for 2 full VM pts */
 	r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager,
-				      rdev->vm_manager.max_pfn * 8,
+				      rdev->vm_manager.max_pfn * 8 * 2,
 				      RADEON_GEM_DOMAIN_VRAM);
 	if (r) {
 		dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n",
@@ -478,12 +479,18 @@
 
 	mutex_lock(&vm->mutex);
 	if (last_pfn > vm->last_pfn) {
-		/* grow va space 32M by 32M */
-		unsigned align = ((32 << 20) >> 12) - 1;
+		/* release mutex and lock in right order */
+		mutex_unlock(&vm->mutex);
 		radeon_mutex_lock(&rdev->cs_mutex);
-		radeon_vm_unbind_locked(rdev, vm);
+		mutex_lock(&vm->mutex);
+		/* and check again */
+		if (last_pfn > vm->last_pfn) {
+			/* grow va space 32M by 32M */
+			unsigned align = ((32 << 20) >> 12) - 1;
+			radeon_vm_unbind_locked(rdev, vm);
+			vm->last_pfn = (last_pfn + align) & ~align;
+		}
 		radeon_mutex_unlock(&rdev->cs_mutex);
-		vm->last_pfn = (last_pfn + align) & ~align;
 	}
 	head = &vm->va;
 	last_offset = 0;
@@ -597,8 +604,8 @@
 	if (bo_va == NULL)
 		return 0;
 
-	mutex_lock(&vm->mutex);
 	radeon_mutex_lock(&rdev->cs_mutex);
+	mutex_lock(&vm->mutex);
 	radeon_vm_bo_update_pte(rdev, vm, bo, NULL);
 	radeon_mutex_unlock(&rdev->cs_mutex);
 	list_del(&bo_va->vm_list);
@@ -629,7 +636,15 @@
 	mutex_init(&vm->mutex);
 	INIT_LIST_HEAD(&vm->list);
 	INIT_LIST_HEAD(&vm->va);
-	vm->last_pfn = 0;
+	/* SI requires equal sized PTs for all VMs, so always set
+	 * last_pfn to max_pfn.  cayman allows variable sized
+	 * pts so we can grow then as needed.  Once we switch
+	 * to two level pts we can unify this again.
+	 */
+	if (rdev->family >= CHIP_TAHITI)
+		vm->last_pfn = rdev->vm_manager.max_pfn;
+	else
+		vm->last_pfn = 0;
 	/* map the ib pool buffer at 0 in virtual address space, set
 	 * read only
 	 */
@@ -643,9 +658,8 @@
 	struct radeon_bo_va *bo_va, *tmp;
 	int r;
 
-	mutex_lock(&vm->mutex);
-
 	radeon_mutex_lock(&rdev->cs_mutex);
+	mutex_lock(&vm->mutex);
 	radeon_vm_unbind_locked(rdev, vm);
 	radeon_mutex_unlock(&rdev->cs_mutex);
 
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index 210317c..9760e5a 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -1025,9 +1025,11 @@
 
 static void radeon_crtc_prepare(struct drm_crtc *crtc)
 {
+	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
 	struct drm_device *dev = crtc->dev;
 	struct drm_crtc *crtci;
 
+	radeon_crtc->in_mode_set = true;
 	/*
 	* The hardware wedges sometimes if you reconfigure one CRTC
 	* whilst another is running (see fdo bug #24611).
@@ -1038,6 +1040,7 @@
 
 static void radeon_crtc_commit(struct drm_crtc *crtc)
 {
+	struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
 	struct drm_device *dev = crtc->dev;
 	struct drm_crtc *crtci;
 
@@ -1048,6 +1051,7 @@
 		if (crtci->enabled)
 			radeon_crtc_dpms(crtci, DRM_MODE_DPMS_ON);
 	}
+	radeon_crtc->in_mode_set = false;
 }
 
 static const struct drm_crtc_helper_funcs legacy_helper_funcs = {
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 48dae40..6259322 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -266,6 +266,7 @@
 	u16 lut_r[256], lut_g[256], lut_b[256];
 	bool enabled;
 	bool can_tile;
+	bool in_mode_set;
 	uint32_t crtc_offset;
 	struct drm_gem_object *cursor_bo;
 	uint64_t cursor_addr;
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index df6a4db..80c6e8b 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -136,7 +136,6 @@
 	acc_size = ttm_bo_dma_acc_size(&rdev->mman.bdev, size,
 				       sizeof(struct radeon_bo));
 
-retry:
 	bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL);
 	if (bo == NULL)
 		return -ENOMEM;
@@ -150,6 +149,8 @@
 	bo->surface_reg = -1;
 	INIT_LIST_HEAD(&bo->list);
 	INIT_LIST_HEAD(&bo->va);
+
+retry:
 	radeon_ttm_placement_from_domain(bo, domain);
 	/* Kernel allocation are uninterruptible */
 	mutex_lock(&rdev->vram_mutex);
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index d8d78fe..43af363 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -281,12 +281,8 @@
 
 void rv515_mc_stop(struct radeon_device *rdev, struct rv515_mc_save *save)
 {
-	save->d1vga_control = RREG32(R_000330_D1VGA_CONTROL);
-	save->d2vga_control = RREG32(R_000338_D2VGA_CONTROL);
 	save->vga_render_control = RREG32(R_000300_VGA_RENDER_CONTROL);
 	save->vga_hdp_control = RREG32(R_000328_VGA_HDP_CONTROL);
-	save->d1crtc_control = RREG32(R_006080_D1CRTC_CONTROL);
-	save->d2crtc_control = RREG32(R_006880_D2CRTC_CONTROL);
 
 	/* Stop all video */
 	WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0);
@@ -311,15 +307,6 @@
 	/* Unlock host access */
 	WREG32(R_000328_VGA_HDP_CONTROL, save->vga_hdp_control);
 	mdelay(1);
-	/* Restore video state */
-	WREG32(R_000330_D1VGA_CONTROL, save->d1vga_control);
-	WREG32(R_000338_D2VGA_CONTROL, save->d2vga_control);
-	WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 1);
-	WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 1);
-	WREG32(R_006080_D1CRTC_CONTROL, save->d1crtc_control);
-	WREG32(R_006880_D2CRTC_CONTROL, save->d2crtc_control);
-	WREG32(R_0060E8_D1CRTC_UPDATE_LOCK, 0);
-	WREG32(R_0068E8_D2CRTC_UPDATE_LOCK, 0);
 	WREG32(R_000300_VGA_RENDER_CONTROL, save->vga_render_control);
 }
 
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index cdab1ae..591040b 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -151,6 +151,8 @@
 	WREG32(MC_VM_MD_L1_TLB0_CNTL, tmp);
 	WREG32(MC_VM_MD_L1_TLB1_CNTL, tmp);
 	WREG32(MC_VM_MD_L1_TLB2_CNTL, tmp);
+	if (rdev->family == CHIP_RV740)
+		WREG32(MC_VM_MD_L1_TLB3_CNTL, tmp);
 	WREG32(MC_VM_MB_L1_TLB0_CNTL, tmp);
 	WREG32(MC_VM_MB_L1_TLB1_CNTL, tmp);
 	WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp);
@@ -689,8 +691,12 @@
 
 	if (rdev->family == CHIP_RV770)
 		gb_tiling_config |= BANK_TILING(1);
-	else
-		gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT);
+	else {
+		if ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT)
+			gb_tiling_config |= BANK_TILING(1);
+		else
+			gb_tiling_config |= BANK_TILING(0);
+	}
 	rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3);
 	gb_tiling_config |= GROUP_SIZE((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT);
 	if ((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT)
@@ -776,6 +782,9 @@
 				       ACK_FLUSH_CTL(3) |
 				       SYNC_FLUSH_CTL));
 
+	if (rdev->family != CHIP_RV770)
+		WREG32(SMX_SAR_CTL0, 0x00003f3f);
+
 	db_debug3 = RREG32(DB_DEBUG3);
 	db_debug3 &= ~DB_CLK_OFF_DELAY(0x1f);
 	switch (rdev->family) {
@@ -954,7 +963,7 @@
 
 	WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA |
 					  NUM_CLIP_SEQ(3)));
-
+	WREG32(VC_ENHANCE, 0);
 }
 
 void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
diff --git a/drivers/gpu/drm/radeon/rv770d.h b/drivers/gpu/drm/radeon/rv770d.h
index 79fa588..7095a71 100644
--- a/drivers/gpu/drm/radeon/rv770d.h
+++ b/drivers/gpu/drm/radeon/rv770d.h
@@ -174,6 +174,7 @@
 #define	MC_VM_MD_L1_TLB0_CNTL				0x2654
 #define	MC_VM_MD_L1_TLB1_CNTL				0x2658
 #define	MC_VM_MD_L1_TLB2_CNTL				0x265C
+#define	MC_VM_MD_L1_TLB3_CNTL				0x2698
 #define	MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR		0x203C
 #define	MC_VM_SYSTEM_APERTURE_HIGH_ADDR			0x2038
 #define	MC_VM_SYSTEM_APERTURE_LOW_ADDR			0x2034
@@ -207,6 +208,7 @@
 #define	SCRATCH_UMSK					0x8540
 #define	SCRATCH_ADDR					0x8544
 
+#define	SMX_SAR_CTL0					0xA008
 #define	SMX_DC_CTL0					0xA020
 #define		USE_HASH_FUNCTION				(1 << 0)
 #define		CACHE_DEPTH(x)					((x) << 1)
@@ -306,6 +308,8 @@
 #define	TCP_CNTL					0x9610
 #define	TCP_CHAN_STEER					0x9614
 
+#define	VC_ENHANCE					0x9714
+
 #define	VGT_CACHE_INVALIDATION				0x88C4
 #define		CACHE_INVALIDATION(x)				((x)<<0)
 #define			VC_ONLY						0
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 27bda98..2af1ce6 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2527,12 +2527,12 @@
 	WREG32(0x15DC, 0);
 
 	/* empty context1-15 */
-	/* FIXME start with 1G, once using 2 level pt switch to full
+	/* FIXME start with 4G, once using 2 level pt switch to full
 	 * vm size space
 	 */
 	/* set vm size, must be a multiple of 4 */
 	WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0);
-	WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, (1 << 30) / RADEON_GPU_PAGE_SIZE);
+	WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn);
 	for (i = 1; i < 16; i++) {
 		if (i < 8)
 			WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2),
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index 30d98d1..dd14cd1 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -47,9 +47,9 @@
 	if (dev_priv == NULL)
 		return -ENOMEM;
 
+	idr_init(&dev_priv->object_idr);
 	dev->dev_private = (void *)dev_priv;
 	dev_priv->chipset = chipset;
-	idr_init(&dev->object_name_idr);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 1f5c67c..8b73ae8 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1193,6 +1193,7 @@
 			(*destroy)(bo);
 		else
 			kfree(bo);
+		ttm_mem_global_free(mem_glob, acc_size);
 		return -EINVAL;
 	}
 	bo->destroy = destroy;
@@ -1294,22 +1295,14 @@
 			struct ttm_buffer_object **p_bo)
 {
 	struct ttm_buffer_object *bo;
-	struct ttm_mem_global *mem_glob = bdev->glob->mem_glob;
 	size_t acc_size;
 	int ret;
 
-	acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object));
-	ret = ttm_mem_global_alloc(mem_glob, acc_size, false, false);
-	if (unlikely(ret != 0))
-		return ret;
-
 	bo = kzalloc(sizeof(*bo), GFP_KERNEL);
-
-	if (unlikely(bo == NULL)) {
-		ttm_mem_global_free(mem_glob, acc_size);
+	if (unlikely(bo == NULL))
 		return -ENOMEM;
-	}
 
+	acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object));
 	ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment,
 				buffer_start, interruptible,
 				persistent_swap_storage, acc_size, NULL);
@@ -1821,6 +1814,7 @@
 			spin_unlock(&glob->lru_lock);
 			(void) ttm_bo_cleanup_refs(bo, false, false, false);
 			kref_put(&bo->list_kref, ttm_bo_release_list);
+			spin_lock(&glob->lru_lock);
 			continue;
 		}
 
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
index 5367390..08eff0d 100644
--- a/drivers/gpu/drm/udl/udl_drv.c
+++ b/drivers/gpu/drm/udl/udl_drv.c
@@ -13,8 +13,21 @@
 
 static struct drm_driver driver;
 
+/*
+ * There are many DisplayLink-based graphics products, all with unique PIDs.
+ * So we match on DisplayLink's VID + Vendor-Defined Interface Class (0xff)
+ * We also require a match on SubClass (0x00) and Protocol (0x00),
+ * which is compatible with all known USB 2.0 era graphics chips and firmware,
+ * but allows DisplayLink to increment those for any future incompatible chips
+ */
 static struct usb_device_id id_table[] = {
-	{.idVendor = 0x17e9, .match_flags = USB_DEVICE_ID_MATCH_VENDOR,},
+	{.idVendor = 0x17e9, .bInterfaceClass = 0xff,
+	 .bInterfaceSubClass = 0x00,
+	 .bInterfaceProtocol = 0x00,
+	 .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
+			USB_DEVICE_ID_MATCH_INT_CLASS |
+			USB_DEVICE_ID_MATCH_INT_SUBCLASS |
+			USB_DEVICE_ID_MATCH_INT_PROTOCOL,},
 	{},
 };
 MODULE_DEVICE_TABLE(usb, id_table);
diff --git a/drivers/gpu/drm/via/via_map.c b/drivers/gpu/drm/via/via_map.c
index 1f18225..c126182 100644
--- a/drivers/gpu/drm/via/via_map.c
+++ b/drivers/gpu/drm/via/via_map.c
@@ -100,12 +100,11 @@
 	if (dev_priv == NULL)
 		return -ENOMEM;
 
+	idr_init(&dev_priv->object_idr);
 	dev->dev_private = (void *)dev_priv;
 
 	dev_priv->chipset = chipset;
 
-	idr_init(&dev->object_name_idr);
-
 	pci_set_master(dev->pdev);
 
 	ret = drm_vblank_init(dev, 1);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c
index 51c9ba5..21ee782 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c
@@ -66,7 +66,7 @@
 	cmd += sizeof(remap_cmd) / sizeof(uint32);
 
 	for (i = 0; i < num_pages; ++i) {
-		if (VMW_PPN_SIZE > 4)
+		if (VMW_PPN_SIZE <= 4)
 			*cmd = page_to_pfn(*pages++);
 		else
 			*((uint64_t *)cmd) = page_to_pfn(*pages++);
diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c
index d005605..e9b3bb3 100644
--- a/drivers/gpu/ion/ion.c
+++ b/drivers/gpu/ion/ion.c
@@ -1322,6 +1322,24 @@
 		}
 		break;
 	}
+	case ION_IOC_ALLOC_COMPAT:
+	{
+		struct ion_allocation_data_compat data;
+
+		if (copy_from_user(&data, (void __user *)arg, sizeof(data)))
+			return -EFAULT;
+		data.handle = ion_alloc(client, data.len, data.align,
+					     ion_full_heap_mask, 0);
+
+		if (IS_ERR(data.handle))
+			return PTR_ERR(data.handle);
+
+		if (copy_to_user((void __user *)arg, &data, sizeof(data))) {
+			ion_free(client, data.handle);
+			return -EFAULT;
+		}
+		break;
+	}
 	case ION_IOC_FREE:
 	{
 		struct ion_handle_data data;
@@ -1358,6 +1376,7 @@
 		break;
 	}
 	case ION_IOC_IMPORT:
+	case ION_IOC_IMPORT_COMPAT:
 	{
 		struct ion_fd_data data;
 		int ret = 0;
@@ -1389,15 +1408,19 @@
 		return dev->custom_ioctl(client, data.cmd, data.arg);
 	}
 	case ION_IOC_CLEAN_CACHES:
+	case ION_IOC_CLEAN_CACHES_COMPAT:
 		return client->dev->custom_ioctl(client,
 						ION_IOC_CLEAN_CACHES, arg);
 	case ION_IOC_INV_CACHES:
+	case ION_IOC_INV_CACHES_COMPAT:
 		return client->dev->custom_ioctl(client,
 						ION_IOC_INV_CACHES, arg);
 	case ION_IOC_CLEAN_INV_CACHES:
+	case ION_IOC_CLEAN_INV_CACHES_COMPAT:
 		return client->dev->custom_ioctl(client,
 						ION_IOC_CLEAN_INV_CACHES, arg);
 	case ION_IOC_GET_FLAGS:
+	case ION_IOC_GET_FLAGS_COMPAT:
 		return client->dev->custom_ioctl(client,
 						ION_IOC_GET_FLAGS, arg);
 	default:
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 299d238..899c712 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -514,6 +514,12 @@
 		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI),
+		.driver_data = APPLE_HAS_FN },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO),
+		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS),
+		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
diff --git a/drivers/hid/hid-chicony.c b/drivers/hid/hid-chicony.c
index b99af34..a2abb8e 100644
--- a/drivers/hid/hid-chicony.c
+++ b/drivers/hid/hid-chicony.c
@@ -60,6 +60,7 @@
 static const struct hid_device_id ch_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, ch_devices);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 4da66b4..41d4437 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1379,6 +1379,9 @@
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
@@ -1388,6 +1391,7 @@
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BAANTO, USB_DEVICE_ID_BAANTO_MT_190W2), },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
@@ -1400,12 +1404,14 @@
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_4) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) },
@@ -1914,6 +1920,7 @@
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MCT) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
@@ -2008,6 +2015,9 @@
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
 	{ }
diff --git a/drivers/hid/hid-cypress.c b/drivers/hid/hid-cypress.c
index 2f0be4c..9e43aac 100644
--- a/drivers/hid/hid-cypress.c
+++ b/drivers/hid/hid-cypress.c
@@ -129,6 +129,8 @@
 		.driver_data = CP_RDESC_SWAPPED_MIN_MAX },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3),
 		.driver_data = CP_RDESC_SWAPPED_MIN_MAX },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_4),
+		.driver_data = CP_RDESC_SWAPPED_MIN_MAX },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE),
 		.driver_data = CP_2WHEEL_MOUSE_HACK },
 	{ }
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index e39aecb..41ad6ff 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -125,6 +125,9 @@
 #define USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI	0x024c
 #define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO	0x024d
 #define USB_DEVICE_ID_APPLE_WELLSPRING6_JIS	0x024e
+#define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI	0x0262
+#define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO	0x0263
+#define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS	0x0264
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI  0x0239
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO   0x023a
 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS   0x023b
@@ -157,6 +160,9 @@
 #define USB_VENDOR_ID_AVERMEDIA		0x07ca
 #define USB_DEVICE_ID_AVER_FM_MR800	0xb800
 
+#define USB_VENDOR_ID_BAANTO		0x2453
+#define USB_DEVICE_ID_BAANTO_MT_190W2	0x0100
+
 #define USB_VENDOR_ID_BELKIN		0x050d
 #define USB_DEVICE_ID_FLIP_KVM		0x3201
 
@@ -196,6 +202,7 @@
 #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH	0xb19d
 #define USB_DEVICE_ID_CHICONY_WIRELESS	0x0618
 #define USB_DEVICE_ID_CHICONY_WIRELESS2	0x1123
+#define USB_DEVICE_ID_CHICONY_AK1D	0x1125
 
 #define USB_VENDOR_ID_CHUNGHWAT		0x2247
 #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH	0x0001
@@ -225,6 +232,7 @@
 #define USB_DEVICE_ID_CYPRESS_BARCODE_1	0xde61
 #define USB_DEVICE_ID_CYPRESS_BARCODE_2	0xde64
 #define USB_DEVICE_ID_CYPRESS_BARCODE_3	0xbca1
+#define USB_DEVICE_ID_CYPRESS_BARCODE_4	0xed81
 #define USB_DEVICE_ID_CYPRESS_TRUETOUCH	0xc001
 
 #define USB_VENDOR_ID_DEALEXTREAME	0x10c5
@@ -509,6 +517,9 @@
 #define USB_DEVICE_ID_CRYSTALTOUCH	0x0006
 #define USB_DEVICE_ID_CRYSTALTOUCH_DUAL	0x0007
 
+#define USB_VENDOR_ID_MADCATZ		0x0738
+#define USB_DEVICE_ID_MADCATZ_BEATPAD	0x4540
+
 #define USB_VENDOR_ID_MCC		0x09db
 #define USB_DEVICE_ID_MCC_PMD1024LS	0x0076
 #define USB_DEVICE_ID_MCC_PMD1208LS	0x007a
@@ -558,6 +569,9 @@
 #define USB_VENDOR_ID_NINTENDO		0x057e
 #define USB_DEVICE_ID_NINTENDO_WIIMOTE	0x0306
 
+#define USB_VENDOR_ID_NOVATEK		0x0603
+#define USB_DEVICE_ID_NOVATEK_PCT	0x0600
+
 #define USB_VENDOR_ID_NTRIG		0x1b96
 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN   0x0001
 #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1   0x0003
@@ -644,6 +658,9 @@
 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE	0x0001
 #define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE	0x0600
 
+#define USB_VENDOR_ID_SENNHEISER	0x1395
+#define USB_DEVICE_ID_SENNHEISER_BTD500USB	0x002c
+
 #define USB_VENDOR_ID_SIGMA_MICRO	0x1c4f
 #define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD	0x0002
 
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index c19bff7..4366973 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -290,6 +290,9 @@
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
 			       USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
 	  HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
+		USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI),
+	  HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
 	{}
 };
 
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 2b56efc..d44ea58 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -26,6 +26,7 @@
 #include <linux/hid.h>
 #include <linux/module.h>
 #include <linux/usb.h>
+#include <asm/unaligned.h>
 #include "usbhid/usbhid.h"
 #include "hid-ids.h"
 #include "hid-logitech-dj.h"
@@ -265,8 +266,8 @@
 		goto dj_device_allocate_fail;
 	}
 
-	dj_dev->reports_supported = le32_to_cpu(
-		dj_report->report_params[DEVICE_PAIRED_RF_REPORT_TYPE]);
+	dj_dev->reports_supported = get_unaligned_le32(
+		dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE);
 	dj_dev->hdev = dj_hiddev;
 	dj_dev->dj_receiver_dev = djrcv_dev;
 	dj_dev->device_index = dj_report->device_index;
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 2e6d187..7a180b9 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -70,9 +70,16 @@
 	bool is_indirect;	/* true for touchpads */
 };
 
+struct mt_fields {
+	unsigned usages[HID_MAX_FIELDS];
+	unsigned int length;
+};
+
 struct mt_device {
 	struct mt_slot curdata;	/* placeholder of incoming data */
 	struct mt_class mtclass;	/* our mt device class */
+	struct mt_fields *fields;	/* temporary placeholder for storing the
+					   multitouch fields */
 	unsigned last_field_index;	/* last field index of the report */
 	unsigned last_slot_field;	/* the last field of a slot */
 	__s8 inputmode;		/* InputMode HID feature, -1 if non-existent */
@@ -275,11 +282,15 @@
 	input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
 }
 
-static void set_last_slot_field(struct hid_usage *usage, struct mt_device *td,
+static void mt_store_field(struct hid_usage *usage, struct mt_device *td,
 		struct hid_input *hi)
 {
-	if (!test_bit(usage->hid, hi->input->absbit))
-		td->last_slot_field = usage->hid;
+	struct mt_fields *f = td->fields;
+
+	if (f->length >= HID_MAX_FIELDS)
+		return;
+
+	f->usages[f->length++] = usage->hid;
 }
 
 static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
@@ -340,7 +351,7 @@
 				cls->sn_move);
 			/* touchscreen emulation */
 			set_abs(hi->input, ABS_X, field, cls->sn_move);
-			set_last_slot_field(usage, td, hi);
+			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_GD_Y:
@@ -350,7 +361,7 @@
 				cls->sn_move);
 			/* touchscreen emulation */
 			set_abs(hi->input, ABS_Y, field, cls->sn_move);
-			set_last_slot_field(usage, td, hi);
+			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		}
@@ -359,24 +370,24 @@
 	case HID_UP_DIGITIZER:
 		switch (usage->hid) {
 		case HID_DG_INRANGE:
-			set_last_slot_field(usage, td, hi);
+			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_CONFIDENCE:
-			set_last_slot_field(usage, td, hi);
+			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_TIPSWITCH:
 			hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
 			input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
-			set_last_slot_field(usage, td, hi);
+			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_CONTACTID:
 			if (!td->maxcontacts)
 				td->maxcontacts = MT_DEFAULT_MAXCONTACT;
 			input_mt_init_slots(hi->input, td->maxcontacts);
-			td->last_slot_field = usage->hid;
+			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			td->touches_by_report++;
 			return 1;
@@ -385,7 +396,7 @@
 					EV_ABS, ABS_MT_TOUCH_MAJOR);
 			set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
 				cls->sn_width);
-			set_last_slot_field(usage, td, hi);
+			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_HEIGHT:
@@ -395,7 +406,7 @@
 				cls->sn_height);
 			input_set_abs_params(hi->input,
 					ABS_MT_ORIENTATION, 0, 1, 0, 0);
-			set_last_slot_field(usage, td, hi);
+			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_TIPPRESSURE:
@@ -406,7 +417,7 @@
 			/* touchscreen emulation */
 			set_abs(hi->input, ABS_PRESSURE, field,
 				cls->sn_pressure);
-			set_last_slot_field(usage, td, hi);
+			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_CONTACTCOUNT:
@@ -645,6 +656,16 @@
 	}
 }
 
+static void mt_post_parse(struct mt_device *td)
+{
+	struct mt_fields *f = td->fields;
+
+	if (td->touches_by_report > 0) {
+		int field_count_per_touch = f->length / td->touches_by_report;
+		td->last_slot_field = f->usages[field_count_per_touch - 1];
+	}
+}
+
 static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
 {
 	int ret, i;
@@ -676,6 +697,13 @@
 	td->maxcontact_report_id = -1;
 	hid_set_drvdata(hdev, td);
 
+	td->fields = kzalloc(sizeof(struct mt_fields), GFP_KERNEL);
+	if (!td->fields) {
+		dev_err(&hdev->dev, "cannot allocate multitouch fields data\n");
+		ret = -ENOMEM;
+		goto fail;
+	}
+
 	ret = hid_parse(hdev);
 	if (ret != 0)
 		goto fail;
@@ -684,6 +712,8 @@
 	if (ret)
 		goto fail;
 
+	mt_post_parse(td);
+
 	if (!id && td->touches_by_report == 1) {
 		/* the device has been sent by hid-generic */
 		mtclass = &td->mtclass;
@@ -707,9 +737,13 @@
 	mt_set_maxcontacts(hdev);
 	mt_set_input_mode(hdev);
 
+	kfree(td->fields);
+	td->fields = NULL;
+
 	return 0;
 
 fail:
+	kfree(td->fields);
 	kfree(td);
 	return ret;
 }
@@ -759,6 +793,10 @@
 		HID_USB_DEVICE(USB_VENDOR_ID_ATMEL,
 			USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },
 
+	/* Baanto multitouch devices */
+	{ .driver_data = MT_CLS_DEFAULT,
+		HID_USB_DEVICE(USB_VENDOR_ID_BAANTO,
+			USB_DEVICE_ID_BAANTO_MT_190W2) },
 	/* Cando panels */
 	{ .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
 		HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
@@ -912,6 +950,11 @@
 		HID_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
 			USB_DEVICE_ID_PANABOARD_UBT880) },
 
+	/* Novatek Panel */
+	{ .driver_data = MT_CLS_DEFAULT,
+		HID_USB_DEVICE(USB_VENDOR_ID_NOVATEK,
+			USB_DEVICE_ID_NOVATEK_PCT) },
+
 	/* PenMount panels */
 	{ .driver_data = MT_CLS_CONFIDENCE,
 		HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c
index cac3589..84e2fbe 100644
--- a/drivers/hid/hid-wiimote-core.c
+++ b/drivers/hid/hid-wiimote-core.c
@@ -769,7 +769,7 @@
 
 	/*
 	 * Basic IR data is encoded into 3 bytes. The first two bytes are the
-	 * upper 8 bit of the X/Y data, the 3rd byte contains the lower 2 bits
+	 * lower 8 bit of the X/Y data, the 3rd byte contains the upper 2 bits
 	 * of both.
 	 * If data is packed, then the 3rd byte is put first and slightly
 	 * reordered. This allows to interleave packed and non-packed data to
@@ -778,17 +778,11 @@
 	 */
 
 	if (packed) {
-		x = ir[1] << 2;
-		y = ir[2] << 2;
-
-		x |= ir[0] & 0x3;
-		y |= (ir[0] >> 2) & 0x3;
+		x = ir[1] | ((ir[0] & 0x03) << 8);
+		y = ir[2] | ((ir[0] & 0x0c) << 6);
 	} else {
-		x = ir[0] << 2;
-		y = ir[1] << 2;
-
-		x |= (ir[2] >> 4) & 0x3;
-		y |= (ir[2] >> 6) & 0x3;
+		x = ir[0] | ((ir[2] & 0x30) << 4);
+		y = ir[1] | ((ir[2] & 0xc0) << 2);
 	}
 
 	input_report_abs(wdata->ir, xid, x);
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 5bf91db..4bbb883 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -399,6 +399,16 @@
  * Output interrupt completion handler.
  */
 
+static int irq_out_pump_restart(struct hid_device *hid)
+{
+	struct usbhid_device *usbhid = hid->driver_data;
+
+	if (usbhid->outhead != usbhid->outtail)
+		return hid_submit_out(hid);
+	else
+		return -1;
+}
+
 static void hid_irq_out(struct urb *urb)
 {
 	struct hid_device *hid = urb->context;
@@ -428,7 +438,7 @@
 	else
 		usbhid->outtail = (usbhid->outtail + 1) & (HID_OUTPUT_FIFO_SIZE - 1);
 
-	if (usbhid->outhead != usbhid->outtail && !hid_submit_out(hid)) {
+	if (!irq_out_pump_restart(hid)) {
 		/* Successfully submitted next urb in queue */
 		spin_unlock_irqrestore(&usbhid->lock, flags);
 		return;
@@ -443,6 +453,15 @@
 /*
  * Control pipe completion handler.
  */
+static int ctrl_pump_restart(struct hid_device *hid)
+{
+	struct usbhid_device *usbhid = hid->driver_data;
+
+	if (usbhid->ctrlhead != usbhid->ctrltail)
+		return hid_submit_ctrl(hid);
+	else
+		return -1;
+}
 
 static void hid_ctrl(struct urb *urb)
 {
@@ -476,7 +495,7 @@
 	else
 		usbhid->ctrltail = (usbhid->ctrltail + 1) & (HID_CONTROL_FIFO_SIZE - 1);
 
-	if (usbhid->ctrlhead != usbhid->ctrltail && !hid_submit_ctrl(hid)) {
+	if (!ctrl_pump_restart(hid)) {
 		/* Successfully submitted next urb in queue */
 		spin_unlock(&usbhid->lock);
 		return;
@@ -535,11 +554,27 @@
 			 * the queue is known to run
 			 * but an earlier request may be stuck
 			 * we may need to time out
-			 * no race because this is called under
+			 * no race because the URB is blocked under
 			 * spinlock
 			 */
-			if (time_after(jiffies, usbhid->last_out + HZ * 5))
+			if (time_after(jiffies, usbhid->last_out + HZ * 5)) {
+				usb_block_urb(usbhid->urbout);
+				/* drop lock to not deadlock if the callback is called */
+				spin_unlock(&usbhid->lock);
 				usb_unlink_urb(usbhid->urbout);
+				spin_lock(&usbhid->lock);
+				usb_unblock_urb(usbhid->urbout);
+				/*
+				 * if the unlinking has already completed
+				 * the pump will have been stopped
+				 * it must be restarted now
+				 */
+				if (!test_bit(HID_OUT_RUNNING, &usbhid->iofl))
+					if (!irq_out_pump_restart(hid))
+						set_bit(HID_OUT_RUNNING, &usbhid->iofl);
+
+
+			}
 		}
 		return;
 	}
@@ -583,11 +618,25 @@
 		 * the queue is known to run
 		 * but an earlier request may be stuck
 		 * we may need to time out
-		 * no race because this is called under
+		 * no race because the URB is blocked under
 		 * spinlock
 		 */
-		if (time_after(jiffies, usbhid->last_ctrl + HZ * 5))
+		if (time_after(jiffies, usbhid->last_ctrl + HZ * 5)) {
+			usb_block_urb(usbhid->urbctrl);
+			/* drop lock to not deadlock if the callback is called */
+			spin_unlock(&usbhid->lock);
 			usb_unlink_urb(usbhid->urbctrl);
+			spin_lock(&usbhid->lock);
+			usb_unblock_urb(usbhid->urbctrl);
+			/*
+			 * if the unlinking has already completed
+			 * the pump will have been stopped
+			 * it must be restarted now
+			 */
+			if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl))
+				if (!ctrl_pump_restart(hid))
+					set_bit(HID_CTRL_RUNNING, &usbhid->iofl);
+		}
 	}
 }
 
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 782c639..82f61ee 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -76,6 +76,7 @@
 	{ USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET },
+	{ USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET },
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index f082e48..70d62f5 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -215,7 +215,7 @@
 	int i;
 
 	if (send_command(cmd) || send_argument(key)) {
-		pr_warn("%s: read arg fail\n", key);
+		pr_warn("%.4s: read arg fail\n", key);
 		return -EIO;
 	}
 
@@ -223,7 +223,7 @@
 
 	for (i = 0; i < len; i++) {
 		if (__wait_status(0x05)) {
-			pr_warn("%s: read data fail\n", key);
+			pr_warn("%.4s: read data fail\n", key);
 			return -EIO;
 		}
 		buffer[i] = inb(APPLESMC_DATA_PORT);
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index b9d5123..0f52799 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -664,7 +664,7 @@
 	 * sensors. We check this bit only, all the early CPUs
 	 * without thermal sensors will be filtered out.
 	 */
-	if (!cpu_has(c, X86_FEATURE_DTS))
+	if (!cpu_has(c, X86_FEATURE_DTHERM))
 		return;
 
 	if (!pdev) {
@@ -765,7 +765,7 @@
 };
 
 static const struct x86_cpu_id coretemp_ids[] = {
-	{ X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_DTS },
+	{ X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_DTHERM },
 	{}
 };
 MODULE_DEVICE_TABLE(x86cpu, coretemp_ids);
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 0b204e4..f524882 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -2157,7 +2157,7 @@
 
 	/* Start monitoring */
 	it87_write_value(data, IT87_REG_CONFIG,
-			 (it87_read_value(data, IT87_REG_CONFIG) & 0x36)
+			 (it87_read_value(data, IT87_REG_CONFIG) & 0x3e)
 			 | (update_vbat ? 0x41 : 0x01));
 }
 
diff --git a/drivers/hwmon/pm8xxx-adc.c b/drivers/hwmon/pm8xxx-adc.c
index 3633332..53387f2 100644
--- a/drivers/hwmon/pm8xxx-adc.c
+++ b/drivers/hwmon/pm8xxx-adc.c
@@ -1045,6 +1045,36 @@
 }
 EXPORT_SYMBOL_GPL(pm8xxx_adc_btm_end);
 
+#ifdef CONFIG_MACH_HTC
+int pm8xxx_adc_btm_is_cool(void)
+{
+	if (pmic_adc == NULL) {
+		pr_err("PMIC ADC not valid\n");
+		return 0;
+	}
+	if (pmic_adc->batt.btm_cool_fn == NULL) {
+		return 0;
+	}
+
+	return irq_read_line(pmic_adc->btm_cool_irq);
+}
+EXPORT_SYMBOL_GPL(pm8xxx_adc_btm_is_cool);
+
+int pm8xxx_adc_btm_is_warm(void)
+{
+	if (pmic_adc == NULL) {
+		pr_err("PMIC ADC not valid\n");
+		return 0;
+	}
+	if (pmic_adc->batt.btm_warm_fn == NULL) {
+		return 0;
+	}
+
+	return irq_read_line(pmic_adc->btm_warm_irq);
+}
+EXPORT_SYMBOL_GPL(pm8xxx_adc_btm_is_warm);
+#endif
+
 static ssize_t pm8xxx_adc_show(struct device *dev,
 			struct device_attribute *devattr, char *buf)
 {
@@ -1302,6 +1332,12 @@
 		pr_err("failed to request pa_therm vreg with error %d\n", rc);
 		pa_therm = NULL;
 	}
+
+#ifdef CONFIG_MACH_HTC
+	if (pdata->pm8xxx_adc_device_register)
+		pdata->pm8xxx_adc_device_register();
+#endif
+
 	return 0;
 }
 
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
index 61c9cf1..1201a15 100644
--- a/drivers/hwspinlock/hwspinlock_core.c
+++ b/drivers/hwspinlock/hwspinlock_core.c
@@ -345,7 +345,7 @@
 		spin_lock_init(&hwlock->lock);
 		hwlock->bank = bank;
 
-		ret = hwspin_lock_register_single(hwlock, i);
+		ret = hwspin_lock_register_single(hwlock, base_id + i);
 		if (ret)
 			goto reg_failed;
 	}
@@ -354,7 +354,7 @@
 
 reg_failed:
 	while (--i >= 0)
-		hwspin_lock_unregister_single(i);
+		hwspin_lock_unregister_single(base_id + i);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(hwspin_lock_register);
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index a76d85f..79b4bcb 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -755,7 +755,7 @@
 	dev->clk = NULL;
 
 	davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
-	free_irq(IRQ_I2C, dev);
+	free_irq(dev->irq, dev);
 	iounmap(dev->base);
 	kfree(dev);
 
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 55e5ea6..df19f3d 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -401,8 +401,6 @@
 			disable_irq_nosync(i2c_dev->irq);
 			i2c_dev->irq_disabled = 1;
 		}
-
-		complete(&i2c_dev->msg_complete);
 		goto err;
 	}
 
@@ -411,7 +409,6 @@
 			i2c_dev->msg_err |= I2C_ERR_NO_ACK;
 		if (status & I2C_INT_ARBITRATION_LOST)
 			i2c_dev->msg_err |= I2C_ERR_ARBITRATION_LOST;
-		complete(&i2c_dev->msg_complete);
 		goto err;
 	}
 
@@ -429,14 +426,14 @@
 			tegra_i2c_mask_irq(i2c_dev, I2C_INT_TX_FIFO_DATA_REQ);
 	}
 
+	i2c_writel(i2c_dev, status, I2C_INT_STATUS);
+	if (i2c_dev->is_dvc)
+		dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS);
+
 	if (status & I2C_INT_PACKET_XFER_COMPLETE) {
 		BUG_ON(i2c_dev->msg_buf_remaining);
 		complete(&i2c_dev->msg_complete);
 	}
-
-	i2c_writel(i2c_dev, status, I2C_INT_STATUS);
-	if (i2c_dev->is_dvc)
-		dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS);
 	return IRQ_HANDLED;
 err:
 	/* An error occurred, mask all interrupts */
@@ -446,6 +443,8 @@
 	i2c_writel(i2c_dev, status, I2C_INT_STATUS);
 	if (i2c_dev->is_dvc)
 		dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS);
+
+	complete(&i2c_dev->msg_complete);
 	return IRQ_HANDLED;
 }
 
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 71f0c0f..a841123 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -269,7 +269,7 @@
 	} else
 		down_write(&mm->mmap_sem);
 
-	current->mm->locked_vm -= diff;
+	current->mm->pinned_vm -= diff;
 	up_write(&mm->mmap_sem);
 	mmput(mm);
 	kfree(umem);
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 92b4c2b..4c7c62f 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -1593,7 +1593,7 @@
 					n, n->dev, 0);
 		if (!ep->l2t)
 			goto out;
-		ep->mtu = dst_mtu(ep->dst);
+		ep->mtu = dst_mtu(dst);
 		ep->tx_chan = cxgb4_port_chan(n->dev);
 		ep->smac_idx = (cxgb4_port_viid(n->dev) & 0x7F) << 1;
 		step = cdev->rdev.lldi.ntxq /
@@ -2656,6 +2656,12 @@
 	unsigned int tid = GET_TID(req);
 
 	ep = lookup_tid(t, tid);
+	if (!ep) {
+		printk(KERN_WARNING MOD
+		       "Abort on non-existent endpoint, tid %d\n", tid);
+		kfree_skb(skb);
+		return 0;
+	}
 	if (is_neg_adv_abort(req->status)) {
 		PDBG("%s neg_adv_abort ep %p tid %u\n", __func__, ep,
 		     ep->hwtid);
@@ -2667,11 +2673,8 @@
 
 	/*
 	 * Wake up any threads in rdma_init() or rdma_fini().
-	 * However, this is not needed if com state is just
-	 * MPA_REQ_SENT
 	 */
-	if (ep->com.state != MPA_REQ_SENT)
-		c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET);
+	c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET);
 	sched(dev, skb);
 	return 0;
 }
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index bcbf22e..1b5b0c7 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -586,24 +586,62 @@
 			scmnd->sc_data_direction);
 }
 
-static void srp_remove_req(struct srp_target_port *target,
-			   struct srp_request *req, s32 req_lim_delta)
+/**
+ * srp_claim_req - Take ownership of the scmnd associated with a request.
+ * @target: SRP target port.
+ * @req: SRP request.
+ * @scmnd: If NULL, take ownership of @req->scmnd. If not NULL, only take
+ *         ownership of @req->scmnd if it equals @scmnd.
+ *
+ * Return value:
+ * Either NULL or a pointer to the SCSI command the caller became owner of.
+ */
+static struct scsi_cmnd *srp_claim_req(struct srp_target_port *target,
+				       struct srp_request *req,
+				       struct scsi_cmnd *scmnd)
 {
 	unsigned long flags;
 
-	srp_unmap_data(req->scmnd, target, req);
+	spin_lock_irqsave(&target->lock, flags);
+	if (!scmnd) {
+		scmnd = req->scmnd;
+		req->scmnd = NULL;
+	} else if (req->scmnd == scmnd) {
+		req->scmnd = NULL;
+	} else {
+		scmnd = NULL;
+	}
+	spin_unlock_irqrestore(&target->lock, flags);
+
+	return scmnd;
+}
+
+/**
+ * srp_free_req() - Unmap data and add request to the free request list.
+ */
+static void srp_free_req(struct srp_target_port *target,
+			 struct srp_request *req, struct scsi_cmnd *scmnd,
+			 s32 req_lim_delta)
+{
+	unsigned long flags;
+
+	srp_unmap_data(scmnd, target, req);
+
 	spin_lock_irqsave(&target->lock, flags);
 	target->req_lim += req_lim_delta;
-	req->scmnd = NULL;
 	list_add_tail(&req->list, &target->free_reqs);
 	spin_unlock_irqrestore(&target->lock, flags);
 }
 
 static void srp_reset_req(struct srp_target_port *target, struct srp_request *req)
 {
-	req->scmnd->result = DID_RESET << 16;
-	req->scmnd->scsi_done(req->scmnd);
-	srp_remove_req(target, req, 0);
+	struct scsi_cmnd *scmnd = srp_claim_req(target, req, NULL);
+
+	if (scmnd) {
+		scmnd->result = DID_RESET << 16;
+		scmnd->scsi_done(scmnd);
+		srp_free_req(target, req, scmnd, 0);
+	}
 }
 
 static int srp_reconnect_target(struct srp_target_port *target)
@@ -1073,11 +1111,18 @@
 		complete(&target->tsk_mgmt_done);
 	} else {
 		req = &target->req_ring[rsp->tag];
-		scmnd = req->scmnd;
-		if (!scmnd)
+		scmnd = srp_claim_req(target, req, NULL);
+		if (!scmnd) {
 			shost_printk(KERN_ERR, target->scsi_host,
 				     "Null scmnd for RSP w/tag %016llx\n",
 				     (unsigned long long) rsp->tag);
+
+			spin_lock_irqsave(&target->lock, flags);
+			target->req_lim += be32_to_cpu(rsp->req_lim_delta);
+			spin_unlock_irqrestore(&target->lock, flags);
+
+			return;
+		}
 		scmnd->result = rsp->status;
 
 		if (rsp->flags & SRP_RSP_FLAG_SNSVALID) {
@@ -1092,7 +1137,9 @@
 		else if (rsp->flags & (SRP_RSP_FLAG_DIOVER | SRP_RSP_FLAG_DIUNDER))
 			scsi_set_resid(scmnd, be32_to_cpu(rsp->data_in_res_cnt));
 
-		srp_remove_req(target, req, be32_to_cpu(rsp->req_lim_delta));
+		srp_free_req(target, req, scmnd,
+			     be32_to_cpu(rsp->req_lim_delta));
+
 		scmnd->host_scribble = NULL;
 		scmnd->scsi_done(scmnd);
 	}
@@ -1631,25 +1678,17 @@
 {
 	struct srp_target_port *target = host_to_target(scmnd->device->host);
 	struct srp_request *req = (struct srp_request *) scmnd->host_scribble;
-	int ret = SUCCESS;
 
 	shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n");
 
-	if (!req || target->qp_in_error)
+	if (!req || target->qp_in_error || !srp_claim_req(target, req, scmnd))
 		return FAILED;
-	if (srp_send_tsk_mgmt(target, req->index, scmnd->device->lun,
-			      SRP_TSK_ABORT_TASK))
-		return FAILED;
+	srp_send_tsk_mgmt(target, req->index, scmnd->device->lun,
+			  SRP_TSK_ABORT_TASK);
+	srp_free_req(target, req, scmnd, 0);
+	scmnd->result = DID_ABORT << 16;
 
-	if (req->scmnd) {
-		if (!target->tsk_mgmt_status) {
-			srp_remove_req(target, req, 0);
-			scmnd->result = DID_ABORT << 16;
-		} else
-			ret = FAILED;
-	}
-
-	return ret;
+	return SUCCESS;
 }
 
 static int srp_reset_device(struct scsi_cmnd *scmnd)
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index fd7a0d5..42f7b25 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -142,6 +142,7 @@
 	{ 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX },
 	{ 0x0c12, 0x8810, "Zeroplus Xbox Controller", 0, XTYPE_XBOX },
 	{ 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX },
+	{ 0x0d2f, 0x0002, "Andamiro Pump It Up pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
 	{ 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX },
 	{ 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX },
 	{ 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX },
@@ -164,6 +165,7 @@
 	{ 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
 	{ 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
 	{ 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
+	{ 0x1689, 0xfd00, "Razer Onza Tournament Edition", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
 	{ 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
 	{ 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
 };
@@ -238,12 +240,14 @@
 	XPAD_XBOX360_VENDOR(0x045e),		/* Microsoft X-Box 360 controllers */
 	XPAD_XBOX360_VENDOR(0x046d),		/* Logitech X-Box 360 style controllers */
 	XPAD_XBOX360_VENDOR(0x0738),		/* Mad Catz X-Box 360 controllers */
+	{ USB_DEVICE(0x0738, 0x4540) },		/* Mad Catz Beat Pad */
 	XPAD_XBOX360_VENDOR(0x0e6f),		/* 0x0e6f X-Box 360 controllers */
 	XPAD_XBOX360_VENDOR(0x12ab),		/* X-Box 360 dance pads */
 	XPAD_XBOX360_VENDOR(0x1430),		/* RedOctane X-Box 360 controllers */
 	XPAD_XBOX360_VENDOR(0x146b),		/* BigBen Interactive Controllers */
 	XPAD_XBOX360_VENDOR(0x1bad),		/* Harminix Rock Band Guitar and Drums */
-	XPAD_XBOX360_VENDOR(0x0f0d),            /* Hori Controllers */
+	XPAD_XBOX360_VENDOR(0x0f0d),		/* Hori Controllers */
+	XPAD_XBOX360_VENDOR(0x1689),		/* Razer Onza */
 	{ }
 };
 
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index f6c647c..79d9fe6 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -675,3 +675,47 @@
          module will be called bmp18x-i2c.
 
 endif
+
+config SENSORS_AKM8975
+	tristate "AKM8975 compass driver"
+	depends on I2C
+	help
+	  AKM8975 compass driver for HTC.
+
+config SENSORS_AKM8975_PANA_GYRO
+	tristate "AKM8975 compass driver for Panasonic gyro"
+	depends on I2C
+	help
+	  AKM8975 compass driver for Panasonic gyroscope.
+
+config SENSORS_PANASONIC_GYRO
+	tristate "Panasonic gyroscope sensor support"
+	depends on I2C
+	help
+	  Panasonic gyroscope driver for HTC
+
+config SENSORS_BMA250
+	tristate "BMA250 accelerometer sensor support"
+	depends on I2C
+	help
+	  BMA250 G-sensor driver for HTC
+
+config INPUT_CAPELLA_CM3629
+	tristate "CM3629 proximity and light sensor"
+	help
+	  Say Y here to enable the CM3629 short distance proximity
+	  sensor with ambient light sensor.
+
+config SENSORS_R3GD20
+	tristate "ST R3GD20 3-axis gyroscope"
+	depends on I2C
+	help
+	  This driver provides support for the R3GD20 chip which is a 3-axis
+	  gyroscope.
+
+	  This driver can also be built as a module. If so the module for the
+	  gyroscope will be called r3gd20.
+
+	  Say Y here if you have a device containing the r3gd20 chip.
+
+source "drivers/input/misc/mpu3050/Kconfig"
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 97d9782..1505c89 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -63,3 +63,10 @@
 obj-$(CONFIG_STM_LIS3DH)		+= lis3dh_acc.o
 obj-$(CONFIG_BMP18X)			+= bmp18x-core.o
 obj-$(CONFIG_BMP18X_I2C)		+= bmp18x-i2c.o
+obj-$(CONFIG_SENSORS_AKM8975)		+= akm8975.o
+obj-$(CONFIG_SENSORS_AKM8975_PANA_GYRO)	+= akm8975_pana_gyro.o
+obj-$(CONFIG_SENSORS_PANASONIC_GYRO)	+= ewtzmu2.o
+obj-$(CONFIG_SENSORS_BMA250)		+= bma250.o
+obj-$(CONFIG_INPUT_CAPELLA_CM3629)	+= cm3629.o
+obj-$(CONFIG_SENSORS_R3GD20)		+= r3gd20.o
+obj-y 					+= mpu3050/
diff --git a/drivers/input/misc/akm8975.c b/drivers/input/misc/akm8975.c
new file mode 100644
index 0000000..c88687e
--- /dev/null
+++ b/drivers/input/misc/akm8975.c
@@ -0,0 +1,1119 @@
+/* drivers/i2c/chips/akm8975.c - akm8975 compass driver
+ *
+ * Copyright (C) 2008-2009 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <linux/slab.h>
+#include <linux/irq.h>
+#include <linux/miscdevice.h>
+#include <linux/gpio.h>
+#include <linux/uaccess.h>
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/workqueue.h>
+#include <linux/freezer.h>
+#include <linux/akm8975.h>
+#include <linux/earlysuspend.h>
+#include <linux/export.h>
+#include <linux/module.h>
+
+#define DEBUG 0
+#define MAX_FAILURE_COUNT 3
+
+#define D(x...) printk(KERN_DEBUG "[COMP][AKM8975] " x)
+#define I(x...) printk(KERN_INFO "[COMP][AKM8975] " x)
+#define E(x...) printk(KERN_ERR "[COMP][AKM8975 ERROR] " x)
+#define DIF(x...) {\
+		if (debug_flag) \
+			printk(KERN_DEBUG "[COMP][AKM8975 DEBUG] " x); }
+#define DIF_FATAL_ERR(x...) {\
+		if (debug_flag_fatal_err) \
+			printk(KERN_DEBUG "[COMP][AKM8975 DEBUG FATAL ERR] "\
+			 x); }
+
+#define DEVICE_ACCESSORY_ATTR(_name, _mode, _show, _store) \
+struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
+
+static struct i2c_client *this_client;
+
+struct akm8975_data {
+	struct input_dev *input_dev;
+	struct work_struct work;
+	struct early_suspend early_suspend_akm;
+	struct class *htc_ecompass_class;
+	struct device *ecompass_dev;
+};
+
+static char sense_data[RBUFF_SIZE_8975 + 1];
+static struct mutex sense_data_mutex;
+#define AKM8975_RETRY_COUNT 10
+static DECLARE_WAIT_QUEUE_HEAD(data_ready_wq);
+static DECLARE_WAIT_QUEUE_HEAD(open_wq);
+
+static atomic_t data_ready;
+static atomic_t open_count;
+static atomic_t open_flag;
+static atomic_t reserve_open_flag;
+
+static atomic_t m_flag;
+static atomic_t a_flag;
+static atomic_t t_flag;
+static atomic_t mv_flag;
+
+static int failure_count;
+
+static short akmd_delay;
+
+static int debug_flag;
+static int debug_flag_fatal_err;
+static int fatal_err_pr_count;
+
+static atomic_t suspend_flag = ATOMIC_INIT(0);
+static atomic_t PhoneOn_flag = ATOMIC_INIT(0);
+static struct akm8975_platform_data *pdata;
+
+static int disable_flag;
+static int reserve_a_flag;
+
+static int AKI2C_RxData(char *rxData, int length)
+{
+	uint8_t loop_i;
+	struct i2c_msg msgs[] = {
+		{
+		 .addr = this_client->addr,
+		 .flags = 0,
+		 .len = 1,
+		 .buf = rxData,
+		 },
+		{
+		 .addr = this_client->addr,
+		 .flags = I2C_M_RD,
+		 .len = length,
+		 .buf = rxData,
+		 },
+	};
+
+	
+
+	for (loop_i = 0; loop_i < AKM8975_RETRY_COUNT; loop_i++) {
+		if (i2c_transfer(this_client->adapter, msgs, 2) > 0)
+			break;
+
+		mdelay(10);
+	}
+
+
+	if (loop_i >= AKM8975_RETRY_COUNT) {
+		E("%s retry over %d\n",
+			__func__, AKM8975_RETRY_COUNT);
+		return -EIO;
+	}
+	return 0;
+}
+
+static int AKI2C_TxData(char *txData, int length)
+{
+	uint8_t loop_i;
+	struct i2c_msg msg[] = {
+		{
+		 .addr = this_client->addr,
+		 .flags = 0,
+		 .len = length,
+		 .buf = txData,
+		 },
+	};
+
+	for (loop_i = 0; loop_i < AKM8975_RETRY_COUNT; loop_i++) {
+		if (i2c_transfer(this_client->adapter, msg, 1) > 0)
+			break;
+
+		mdelay(10);
+	}
+
+
+	if (loop_i >= AKM8975_RETRY_COUNT) {
+		E("%s retry over %d\n",
+			__func__, AKM8975_RETRY_COUNT);
+		return -EIO;
+	}
+	return 0;
+}
+
+static int AKECS_StartMeasure(void)
+{
+	char buffer[2];
+	atomic_set(&data_ready, 0);
+
+	
+	buffer[0] = AK8975_REG_CNTL;
+	buffer[1] = AK8975_CNTL_SNG_MEASURE;
+
+	
+	return AKI2C_TxData(buffer, 2);
+}
+
+static int AKECS_PowerDown(void)
+{
+	char buffer[2];
+	int ret;
+
+	
+
+	
+	buffer[0] = AK8975_REG_CNTL;
+	buffer[1] = AK8975_CNTL_POWER_DOWN;
+	
+	ret = AKI2C_TxData(buffer, 2);
+	if (ret < 0)
+		return ret;
+
+	
+	buffer[0] = AK8975_REG_ST1;
+	
+	ret = AKI2C_RxData(buffer, 1);
+	if (ret < 0)
+		return ret;
+	return ret;
+}
+
+static int AKECS_StartFuseRead(void)
+{
+	char buffer[2];
+
+	
+
+	
+	buffer[0] = AK8975_REG_CNTL;
+	buffer[1] = AK8975_CNTL_FUSE_ACCESS;
+	
+	return AKI2C_TxData(buffer, 2);
+}
+
+static int AKECS_GetData(void)
+{
+	char buffer[RBUFF_SIZE_8975 + 1];
+	int ret;
+
+	memset(buffer, 0, RBUFF_SIZE_8975);
+	buffer[0] = AK8975_REG_ST1;
+	ret = AKI2C_RxData(buffer, RBUFF_SIZE_8975);
+	if (ret < 0)
+		return ret;
+
+	mutex_lock(&sense_data_mutex);
+	memcpy(sense_data, buffer, sizeof(buffer));
+	atomic_set(&data_ready, 1);
+	wake_up(&data_ready_wq);
+	mutex_unlock(&sense_data_mutex);
+
+	DIF("%s: GET_DATA, sense_data(0, 1, 2, 3, 4, 5, 6, 7) = "
+		"(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
+		__func__, sense_data[0], sense_data[1], sense_data[2]
+		, sense_data[3], sense_data[4], sense_data[5], sense_data[6]
+		, sense_data[7]);
+
+	DIF_FATAL_ERR("%s: GET_DATA, sense_data(0, 1, 2, 3, 4,"
+		" 5, 6, 7) = (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, "
+		"0x%x, 0x%x, 0x%x\n",
+		__func__, sense_data[0], sense_data[1],
+		sense_data[2], sense_data[3], sense_data[4],
+		sense_data[5], sense_data[6], sense_data[7]);
+
+	return 0;
+}
+
+static int AKECS_SetMode(char mode)
+{
+	int ret;
+
+	switch (mode) {
+	case AK8975_CNTL_SNG_MEASURE:
+		ret = AKECS_StartMeasure();
+		break;
+	case AK8975_CNTL_FUSE_ACCESS:
+		ret = AKECS_StartFuseRead();
+		break;
+	case AK8975_CNTL_POWER_DOWN:
+		ret = AKECS_PowerDown();
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	
+	mdelay(1);
+	return ret;
+}
+
+static int AKECS_TransRBuff(char *rbuf, int size)
+{
+	int err = -1;
+	err = wait_event_interruptible_timeout(data_ready_wq,
+					 atomic_read(&data_ready), 1000);
+	if (err == -ERESTARTSYS) {
+		I("%s interrupted by a signal.\n", __func__);
+		return -1;
+	} else if (err == 0)
+		E("%s data timeout.\n", __func__);
+
+	if (!atomic_read(&data_ready)) {
+		if (!atomic_read(&suspend_flag)) {
+			D("%s: DATA\n", __func__);
+			failure_count++;
+			if (failure_count >= MAX_FAILURE_COUNT) {
+				E("%s: successive %d failure.\n",
+				       __func__, failure_count);
+				debug_flag_fatal_err = 1;
+				atomic_set(&open_flag, -1);
+				wake_up(&open_wq);
+				failure_count = 0;
+			}
+		}
+		return -1;
+	}
+
+	mutex_lock(&sense_data_mutex);
+	memcpy(&rbuf[0], &sense_data[0], size);
+	atomic_set(&data_ready, 0);
+	mutex_unlock(&sense_data_mutex);
+
+	failure_count = 0;
+	return 0;
+}
+
+
+static void AKECS_Report_Value(short *rbuf)
+{
+	struct akm8975_data *data = i2c_get_clientdata(this_client);
+#if DEBUG
+	D("AKECS_Report_Value: yaw = %d, pitch = %d, roll = %d"
+		"\n", rbuf[0], rbuf[1], rbuf[2]);
+	D("                    tmp = %d, m_stat= %d, g_stat=%d"
+		"\n", rbuf[3], rbuf[4], rbuf[5]);
+	D("          G_Sensor:   x = %d LSB, y = %d LSB, z = "
+		"%d LSB\n", rbuf[6], rbuf[7], rbuf[8]);
+	D("          Compass:   x = %d LSB, y = %d LSB, z = %d"
+		" LSB\n", rbuf[9], rbuf[10], rbuf[11]);
+#endif
+	DIF(
+		"AKECS_Report_Value: yaw = %d, pitch = %d, roll = %d"
+		"\n", rbuf[0], rbuf[1], rbuf[2]);
+	DIF(
+	"          G_Sensor:   x = %d LSB, y = %d LSB, z = "
+		"%d LSB\n", rbuf[6], rbuf[7], rbuf[8]);
+	DIF(
+	"          Compass:   x = %d LSB, y = %d LSB, z = %d"
+		" LSB\n", rbuf[9], rbuf[10], rbuf[11]);
+
+	DIF("(m, a, t, mv) = (0x%x, 0x%x, 0x%x, 0x%x)\n",
+		atomic_read(&m_flag), atomic_read(&a_flag),
+		atomic_read(&t_flag), atomic_read(&mv_flag));
+
+	if (fatal_err_pr_count < 10) {
+		DIF_FATAL_ERR(
+			"AKECS_Report_Value: yaw = %d, pitch = %d,"
+			" roll = %d\n", rbuf[0], rbuf[1], rbuf[2]);
+		DIF_FATAL_ERR(
+		"          G_Sensor:   x = %d LSB, y = %d LSB, z = "
+			"%d LSB\n", rbuf[6], rbuf[7], rbuf[8]);
+		DIF_FATAL_ERR(
+		"          Compass:   x = %d LSB, y = %d LSB, z = %d"
+			" LSB\n", rbuf[9], rbuf[10], rbuf[11]);
+
+		DIF_FATAL_ERR("(m, a, t, mv) = (0x%x, 0x%x, 0x%x,"
+			" 0x%x)\n",
+			atomic_read(&m_flag), atomic_read(&a_flag),
+			atomic_read(&t_flag), atomic_read(&mv_flag));
+
+		fatal_err_pr_count++;
+	} else {
+		fatal_err_pr_count = 0;
+		debug_flag_fatal_err = 0;
+	}
+
+	
+	if (atomic_read(&m_flag)) {
+		input_report_abs(data->input_dev, ABS_RX, rbuf[0]);
+		input_report_abs(data->input_dev, ABS_RY, rbuf[1]);
+		input_report_abs(data->input_dev, ABS_RZ, rbuf[2]);
+		input_report_abs(data->input_dev, ABS_RUDDER, rbuf[4]);
+	}
+
+	
+	if (atomic_read(&a_flag)) {
+		input_report_abs(data->input_dev, ABS_X, rbuf[6]);
+		input_report_abs(data->input_dev, ABS_Y, rbuf[7]);
+		input_report_abs(data->input_dev, ABS_Z, rbuf[8]);
+		input_report_abs(data->input_dev, ABS_WHEEL, rbuf[5]);
+	}
+
+	
+	if (atomic_read(&t_flag))
+		input_report_abs(data->input_dev, ABS_THROTTLE, rbuf[3]);
+
+	if (atomic_read(&mv_flag)) {
+		input_report_abs(data->input_dev, ABS_HAT0X, rbuf[9]);
+		input_report_abs(data->input_dev, ABS_HAT0Y, rbuf[10]);
+		input_report_abs(data->input_dev, ABS_BRAKE, rbuf[11]);
+	}
+
+	input_sync(data->input_dev);
+}
+
+static int AKECS_GetOpenStatus(void)
+{
+	D("%s:\n", __func__);
+	wait_event_interruptible(open_wq, (atomic_read(&open_flag) != 0));
+	
+	return atomic_read(&open_flag);
+}
+
+static int AKECS_GetCloseStatus(void)
+{
+	D("%s:\n", __func__);
+	wait_event_interruptible(open_wq, (atomic_read(&open_flag) <= 0));
+	return atomic_read(&open_flag);
+}
+
+static void AKECS_CloseDone(void)
+{
+	I("%s:\n", __func__);
+	atomic_set(&m_flag, 0);
+	atomic_set(&a_flag, 0);
+	atomic_set(&t_flag, 0);
+	atomic_set(&mv_flag, 0);
+}
+
+static int akm_aot_open(struct inode *inode, struct file *file)
+{
+	int ret = -1;
+	struct akm8975_data *data = i2c_get_clientdata(this_client);
+
+	printk(KERN_INFO "[COMP] Compass enable\n");
+
+	DIF("%s: open_count = %d, open_flag = %d\n", __func__,
+		atomic_read(&open_count), atomic_read(&open_flag));
+
+	DIF_FATAL_ERR("%s: open_count = %d, open_flag = %d\n", __func__,
+		atomic_read(&open_count), atomic_read(&open_flag));
+
+	if (atomic_cmpxchg(&open_count, 0, 1) == 0) {
+		atomic_set(&open_flag, 1);
+		input_report_abs(data->input_dev, ABS_RUDDER, -1);
+		atomic_set(&reserve_open_flag, 1);
+		wake_up(&open_wq);
+		ret = 0;
+	}
+	return ret;
+}
+
+static int akm_aot_release(struct inode *inode, struct file *file)
+{
+	printk(KERN_INFO "[COMP] Compass disable\n");
+
+	debug_flag_fatal_err = 0;
+	fatal_err_pr_count = 0;
+
+	atomic_set(&reserve_open_flag, 0);
+	atomic_set(&open_flag, 0);
+	atomic_set(&open_count, 0);
+	wake_up(&open_wq);
+	return 0;
+}
+
+static long
+akm_aot_ioctl( struct file *file,
+	      unsigned int cmd, unsigned long arg)
+{
+	void __user *argp = (void __user *)arg;
+	short flag = 0;
+	int ret = -1;
+
+	ret = copy_from_user(&flag, argp, sizeof(flag));
+	if (ret)
+		return -EFAULT;
+	DIF("%s: cmd = 0x%x, flag = %d\n", __func__, cmd, flag);
+
+	switch (cmd) {
+	case ECS_IOCTL_APP_SET_MFLAG:
+	case ECS_IOCTL_APP_SET_AFLAG:
+	case ECS_IOCTL_APP_SET_TFLAG:
+	case ECS_IOCTL_APP_SET_MVFLAG:
+		if (copy_from_user(&flag, argp, sizeof(flag)))
+			return -EFAULT;
+		if (flag < 0 || flag > 1)
+			return -EINVAL;
+		break;
+	case ECS_IOCTL_APP_SET_DELAY:
+		if (copy_from_user(&flag, argp, sizeof(flag)))
+			return -EFAULT;
+		break;
+	default:
+		break;
+	}
+
+	switch (cmd) {
+	case ECS_IOCTL_APP_SET_MFLAG:
+		atomic_set(&m_flag, flag);
+		break;
+	case ECS_IOCTL_APP_GET_MFLAG:
+		flag = atomic_read(&m_flag);
+		break;
+	case ECS_IOCTL_APP_SET_AFLAG:
+		reserve_a_flag = flag;
+		if (disable_flag != 1)
+			atomic_set(&a_flag, flag);
+		else
+			atomic_set(&a_flag, 0);
+		break;
+	case ECS_IOCTL_APP_GET_AFLAG:
+		flag = atomic_read(&a_flag);
+		break;
+	case ECS_IOCTL_APP_SET_TFLAG:
+		atomic_set(&t_flag, flag);
+		break;
+	case ECS_IOCTL_APP_GET_TFLAG:
+		flag = atomic_read(&t_flag);
+		break;
+	case ECS_IOCTL_APP_SET_MVFLAG:
+		atomic_set(&mv_flag, flag);
+		break;
+	case ECS_IOCTL_APP_GET_MVFLAG:
+		flag = atomic_read(&mv_flag);
+		break;
+	case ECS_IOCTL_APP_SET_DELAY:
+		akmd_delay = flag;
+		break;
+	case ECS_IOCTL_APP_GET_DELAY:
+		flag = akmd_delay;
+		break;
+	default:
+		return -ENOTTY;
+	}
+
+	switch (cmd) {
+	case ECS_IOCTL_APP_GET_MFLAG:
+	case ECS_IOCTL_APP_GET_AFLAG:
+	case ECS_IOCTL_APP_GET_TFLAG:
+	case ECS_IOCTL_APP_GET_MVFLAG:
+	case ECS_IOCTL_APP_GET_DELAY:
+		if (copy_to_user(argp, &flag, sizeof(flag)))
+			return -EFAULT;
+		break;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+static int akmd_open(struct inode *inode, struct file *file)
+{
+	I("%s:\n", __func__);
+	return nonseekable_open(inode, file);
+}
+
+static int akmd_release(struct inode *inode, struct file *file)
+{
+	I("%s:\n", __func__);
+	AKECS_CloseDone();
+	return 0;
+}
+
+static long
+akmd_ioctl( struct file *file, unsigned int cmd,
+	   unsigned long arg)
+{
+
+	void __user *argp = (void __user *)arg;
+
+	char msg[RBUFF_SIZE_8975 + 1] = "", rwbuf[RBUFF_SIZE_8975 + 1] = "";
+	int ret = -1, status;
+	short mode = 0, value[12], delay;
+	short layouts[4][3][3];
+	int i, j, k;
+
+	DIF("%s: cmd = 0x%x\n", __func__, cmd);
+	
+
+	switch (cmd) {
+	case ECS_IOCTL_WRITE:
+	case ECS_IOCTL_READ:
+		if (copy_from_user(&rwbuf, argp, sizeof(rwbuf)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_SET_MODE:
+		if (copy_from_user(&mode, argp, sizeof(mode)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_SET_YPR:
+		if (copy_from_user(&value, argp, sizeof(value)))
+			return -EFAULT;
+		break;
+	default:
+		break;
+	}
+
+	switch (cmd) {
+	case ECS_IOCTL_WRITE:
+		if (rwbuf[0] < 2)
+			return -EINVAL;
+		ret = AKI2C_TxData(&rwbuf[1], rwbuf[0]);
+		if (ret < 0)
+			return ret;
+		break;
+	case ECS_IOCTL_READ:
+		if (rwbuf[0] < 1)
+			return -EINVAL;
+		ret = AKI2C_RxData(&rwbuf[1], rwbuf[0]);
+		if (ret < 0)
+			return ret;
+		break;
+	case ECS_IOCTL_SET_MODE:
+		ret = AKECS_SetMode((char)mode);
+		if (ret < 0)
+			return ret;
+		break;
+	case ECS_IOCTL_GETDATA:
+		
+		DIF_FATAL_ERR("%s: calling AKECS_TransRBuff\n", __func__);
+		ret = AKECS_TransRBuff(msg, RBUFF_SIZE_8975);
+		if (ret < 0)
+			return ret;
+		break;
+	case ECS_IOCTL_SET_YPR:
+		AKECS_Report_Value(value);
+		break;
+	case ECS_IOCTL_GET_COMP_FLAG:
+		status = atomic_read(&m_flag);
+		status |= atomic_read(&mv_flag);
+		DIF("%s: ECS_IOCTL_GET_COMP_FLAG, status = %d\n",
+			__func__, status);
+		break;
+	case ECS_IOCTL_GET_OPEN_STATUS:
+		status = AKECS_GetOpenStatus();
+		break;
+	case ECS_IOCTL_GET_CLOSE_STATUS:
+		status = AKECS_GetCloseStatus();
+		break;
+	case ECS_IOCTL_GET_DELAY:
+		delay = akmd_delay;
+		break;
+	case ECS_IOCTL_GET_MATRIX:
+		for (i = 0; i < 4; i++)
+			for (j = 0; j < 3; j++)
+				for (k = 0; k < 3; k++) {
+				layouts[i][j][k] = pdata->layouts[i][j][k];
+				}
+		break;
+	default:
+		return -ENOTTY;
+	}
+
+	switch (cmd) {
+	case ECS_IOCTL_READ:
+		if (copy_to_user(argp, &rwbuf, sizeof(rwbuf)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_GETDATA:
+		msg[8] = debug_flag;
+		if (copy_to_user(argp, &msg, sizeof(msg)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_GET_COMP_FLAG:
+	case ECS_IOCTL_GET_OPEN_STATUS:
+	case ECS_IOCTL_GET_CLOSE_STATUS:
+		if (copy_to_user(argp, &status, sizeof(status)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_GET_DELAY:
+		if (copy_to_user(argp, &delay, sizeof(delay)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_GET_MATRIX:
+		if (copy_to_user(argp, layouts, sizeof(layouts)))
+			return -EFAULT;
+		break;
+	default:
+		break;
+	}
+	return 0;
+}
+
+static void akm_work_func(struct work_struct *work)
+{
+	if (AKECS_GetData() < 0)
+		E("%s: Get data failed\n", __func__);
+	enable_irq(this_client->irq);
+}
+
+static irqreturn_t akm8975_interrupt(int irq, void *dev_id)
+{
+	struct akm8975_data *data = dev_id;
+
+	DIF_FATAL_ERR("%s\n", __func__);
+
+	disable_irq_nosync(this_client->irq);
+	schedule_work(&data->work);
+	return IRQ_HANDLED;
+}
+
+#ifdef AKM_EARLY_SUSPEND
+static void akm8975_early_suspend(struct early_suspend *handler)
+{
+	DIF("%s", __func__);
+
+	if (!atomic_read(&PhoneOn_flag)) {
+		atomic_set(&suspend_flag, 1);
+		atomic_set(&reserve_open_flag, atomic_read(&open_flag));
+		atomic_set(&open_flag, 0);
+		wake_up(&open_wq);
+		disable_irq(this_client->irq);
+	} else
+		D("AKM8975 akm8975_early_suspend: PhoneOn_flag is set\n");
+}
+
+static void akm8975_early_resume(struct early_suspend *handler)
+{
+	DIF("%s", __func__);
+
+	if (atomic_read(&suspend_flag)) {
+		enable_irq(this_client->irq);
+		atomic_set(&suspend_flag, 0);
+		atomic_set(&open_flag, atomic_read(&reserve_open_flag));
+		wake_up(&open_wq);
+	} else
+		D("AKM8975 akm8975_early_resume: PhoneOn_flag is set\n");
+}
+
+#else 
+
+static int akm8975_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+	DIF("%s", __func__);
+
+	DIF_FATAL_ERR("%s", __func__);
+
+	atomic_set(&suspend_flag, 1);
+	atomic_set(&reserve_open_flag, atomic_read(&open_flag));
+	atomic_set(&open_flag, 0);
+	wake_up(&open_wq);
+	disable_irq(this_client->irq);
+
+	return 0;
+}
+
+static int akm8975_resume(struct i2c_client *client)
+{
+	enable_irq(this_client->irq);
+	atomic_set(&suspend_flag, 0);
+	atomic_set(&open_flag, atomic_read(&reserve_open_flag));
+	wake_up(&open_wq);
+
+	D("%s: (m, a, t, mv) = (0x%x, 0x%x, 0x%x, 0x%x)\n",
+		__func__, atomic_read(&m_flag), atomic_read(&a_flag),
+		atomic_read(&t_flag), atomic_read(&mv_flag));
+
+	return 0;
+}
+#endif 
+
+static const struct file_operations akmd_fops = {
+	.owner = THIS_MODULE,
+	.open = akmd_open,
+	.release = akmd_release,
+	
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = akmd_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = akmd_ioctl,
+#endif
+};
+
+static const struct file_operations akm_aot_fops = {
+	.owner = THIS_MODULE,
+	.open = akm_aot_open,
+	.release = akm_aot_release,
+	
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = akm_aot_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = akm_aot_ioctl,
+#endif
+
+};
+
+
+static struct miscdevice akm_aot_device = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "akm8975_aot",
+	.fops = &akm_aot_fops,
+};
+
+
+static struct miscdevice akmd_device = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "akm8975_daemon",
+	.fops = &akmd_fops,
+};
+
+static ssize_t akm_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+	s += sprintf(s, "%d\n", atomic_read(&PhoneOn_flag));
+	return s - buf;
+}
+
+static ssize_t akm_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	if (count == (strlen("enable") + 1) &&
+	   strncmp(buf, "enable", strlen("enable")) == 0) {
+		atomic_set(&PhoneOn_flag, 1);
+		D("AKM8975 akm_store: PhoneOn_flag=%d\n",
+			atomic_read(&PhoneOn_flag));
+		return count;
+	}
+	if (count == (strlen("disable") + 1) &&
+	   strncmp(buf, "disable", strlen("disable")) == 0) {
+		atomic_set(&PhoneOn_flag, 0);
+		D("AKM8975 akm_store: PhoneOn_flag=%d\n",
+			atomic_read(&PhoneOn_flag));
+		return count;
+	}
+	E("akm_store: invalid argument\n");
+	return -EINVAL;
+}
+
+static DEVICE_ACCESSORY_ATTR(PhoneOnOffFlag, 0664, \
+	akm_show, akm_store);
+
+static ssize_t debug_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+	short lm_flag = -1;
+	short la_flag = -1;
+	short lt_flag = -1;
+	short lmv_flag = -1;
+	short ldelay_flag = -1;
+
+	lm_flag = atomic_read(&m_flag);
+	la_flag = atomic_read(&a_flag);
+	lt_flag = atomic_read(&t_flag);
+	lmv_flag = atomic_read(&mv_flag);
+	ldelay_flag = akmd_delay;
+
+	s += sprintf(s, "(m, a, t, mv, delay, debug_flag, "
+		"debug_flag_fatal_err) = (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x,"
+		" 0x%x)\n", lm_flag, la_flag, lt_flag, lmv_flag, ldelay_flag,
+		debug_flag, debug_flag_fatal_err);
+
+	return s - buf;
+}
+
+static ssize_t debug_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	debug_flag = -1;
+	sscanf(buf, "%d", &debug_flag);
+
+	D("%s: debug_flag = %d\n", __func__, debug_flag);
+
+	return count;
+}
+
+static DEVICE_ACCESSORY_ATTR(debug_en, 0664, \
+	debug_show, debug_store);
+
+static ssize_t disable_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+
+	s += sprintf(s, "disable_flag = 0x%x\n", disable_flag);
+
+	return s - buf;
+}
+
+static ssize_t disable_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	disable_flag = -1;
+	sscanf(buf, "%d", &disable_flag);
+
+	D("%s: disable_flag = %d\n", __func__, disable_flag);
+
+	if (disable_flag == 1)
+		atomic_set(&a_flag, 0);
+	else
+		atomic_set(&a_flag, reserve_a_flag);
+
+	return count;
+}
+
+static DEVICE_ACCESSORY_ATTR(disable_en, 0664, \
+	disable_show, disable_store);
+
+
+int akm8975_registerAttr(struct akm8975_data *akm)
+{
+	int ret;
+
+	akm->htc_ecompass_class = class_create(THIS_MODULE, "htc_ecompass");
+	if (IS_ERR(akm->htc_ecompass_class)) {
+		ret = PTR_ERR(akm->htc_ecompass_class);
+		akm->htc_ecompass_class = NULL;
+		goto err_create_class;
+	}
+
+	akm->ecompass_dev = device_create(akm->htc_ecompass_class,
+				NULL, 0, "%s", "ecompass");
+	if (unlikely(IS_ERR(akm->ecompass_dev))) {
+		ret = PTR_ERR(akm->ecompass_dev);
+		akm->ecompass_dev = NULL;
+		goto err_create_ecompass_device;
+	}
+
+	
+	ret = device_create_file(akm->ecompass_dev, &dev_attr_PhoneOnOffFlag);
+	if (ret)
+		goto err_create_ecompass_device_file;
+
+	
+	ret = device_create_file(akm->ecompass_dev, &dev_attr_debug_en);
+	if (ret)
+		goto err_create_ecompass_debug_device_file;
+
+	
+	ret = device_create_file(akm->ecompass_dev, &dev_attr_disable_en);
+	if (ret)
+		goto err_create_ecompass_disable_device_file;
+
+	return 0;
+
+err_create_ecompass_disable_device_file:
+err_create_ecompass_debug_device_file:
+err_create_ecompass_device_file:
+	device_unregister(akm->ecompass_dev);
+err_create_ecompass_device:
+	class_destroy(akm->htc_ecompass_class);
+err_create_class:
+
+	return ret;
+}
+
+
+int akm8975_probe(struct i2c_client *client, const struct i2c_device_id *id)
+{
+	struct akm8975_data *akm;
+	int err = 0;
+	char msg[RBUFF_SIZE_8975 + 1];
+	unsigned int irq_type;
+
+	
+
+	memset(msg, 0, RBUFF_SIZE_8975 + 1);
+
+	I("%s:\n", __func__);
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		err = -ENODEV;
+		goto exit_check_functionality_failed;
+	}
+
+	akm = kzalloc(sizeof(struct akm8975_data), GFP_KERNEL);
+	if (!akm) {
+		err = -ENOMEM;
+		goto exit_alloc_data_failed;
+	}
+
+	INIT_WORK(&akm->work, akm_work_func);
+	i2c_set_clientdata(client, akm);
+
+	mutex_init(&sense_data_mutex);
+
+	pdata = client->dev.platform_data;
+	if (pdata == NULL) {
+		E("%s: platform data is NULL\n", __func__);
+		goto exit_platform_data_null;
+	}
+	this_client = client;
+
+	err = AKECS_PowerDown();
+	if (err < 0) {
+		E("%s: set power down mode error\n", __func__);
+		goto exit_set_mode_failed;
+	}
+
+	akm->input_dev = input_allocate_device();
+
+	if (!akm->input_dev) {
+		err = -ENOMEM;
+		E("%s: Failed to allocate input device\n", __func__);
+		goto exit_input_dev_alloc_failed;
+	}
+
+	set_bit(EV_ABS, akm->input_dev->evbit);
+	
+	input_set_abs_params(akm->input_dev, ABS_RX, 0, 360, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_RY, -180, 180, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_RZ, -90, 90, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_X, -1872, 1872, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_Y, -1872, 1872, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_Z, -1872, 1872, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_THROTTLE, -30, 85, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_RUDDER, -32768, 3, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_WHEEL, -32768, 3, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_GAS, 0, 65535, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_HAT0X, -2048, 2032, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_HAT0Y, -2048, 2032, 0, 0);
+	
+	input_set_abs_params(akm->input_dev, ABS_BRAKE, -2048, 2032, 0, 0);
+
+	akm->input_dev->name = "compass";
+
+	err = input_register_device(akm->input_dev);
+
+	if (err) {
+		E("%s: Unable to register input device: %s\n", __func__,
+			akm->input_dev->name);
+		goto exit_input_register_device_failed;
+	}
+
+	err = misc_register(&akmd_device);
+	if (err) {
+		E("%s: akmd_device register failed\n", __func__);
+		goto exit_misc_device_register_failed;
+	}
+
+	err = misc_register(&akm_aot_device);
+	if (err) {
+		E("%s: akm_aot_device register failed\n", __func__);
+		goto exit_misc_device_register_failed;
+	}
+
+	init_waitqueue_head(&data_ready_wq);
+	init_waitqueue_head(&open_wq);
+
+	
+	atomic_set(&m_flag, 0);
+	atomic_set(&a_flag, 0);
+	atomic_set(&t_flag, 0);
+	atomic_set(&mv_flag, 0);
+
+	debug_flag = 0;
+	debug_flag_fatal_err = 0;
+	fatal_err_pr_count = 0;
+
+#ifdef AKM_EARLY_SUSPEND
+	akm->early_suspend_akm.suspend = akm8975_early_suspend;
+	akm->early_suspend_akm.resume = akm8975_early_resume;
+	register_early_suspend(&akm->early_suspend_akm);
+#endif
+	err = akm8975_registerAttr(akm);
+	if (err) {
+		E("%s: akm8975_registerAttr failed\n", __func__);
+		goto exit_registerAttr_failed;
+	}
+
+	disable_flag = 0;
+	reserve_a_flag = 0;
+
+	irq_type = (pdata->irq_trigger) ? IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH;
+
+	err = request_irq(client->irq, akm8975_interrupt, irq_type,
+			  "akm8975", akm);
+	if (err < 0) {
+		E("%s: request irq failed\n", __func__);
+		goto exit_irq_request_failed;
+	}
+
+	return 0;
+
+exit_irq_request_failed:
+exit_registerAttr_failed:
+exit_misc_device_register_failed:
+exit_input_register_device_failed:
+	input_free_device(akm->input_dev);
+exit_input_dev_alloc_failed:
+	free_irq(client->irq, akm);
+exit_set_mode_failed:
+exit_platform_data_null:
+	kfree(akm);
+exit_alloc_data_failed:
+exit_check_functionality_failed:
+	return err;
+
+}
+
+static int akm8975_remove(struct i2c_client *client)
+{
+	struct akm8975_data *akm = i2c_get_clientdata(client);
+	free_irq(client->irq, akm);
+	input_unregister_device(akm->input_dev);
+	kfree(akm);
+	return 0;
+}
+static const struct i2c_device_id akm8975_id[] = {
+	{ AKM8975_I2C_NAME, 0 },
+	{ }
+};
+
+static struct i2c_driver akm8975_driver = {
+	.probe 	= akm8975_probe,
+	.remove 	= akm8975_remove,
+	.id_table	= akm8975_id,
+
+#ifndef AKM_EARLY_SUSPEND
+	.suspend = akm8975_suspend,
+	.resume = akm8975_resume,
+#endif
+	.driver = {
+		   .name = AKM8975_I2C_NAME,
+		   },
+};
+
+static int __init akm8975_init(void)
+{
+	I("AKM8975 compass driver: init\n");
+	return i2c_add_driver(&akm8975_driver);
+}
+
+static void __exit akm8975_exit(void)
+{
+	i2c_del_driver(&akm8975_driver);
+}
+
+module_init(akm8975_init);
+module_exit(akm8975_exit);
+
+MODULE_DESCRIPTION("AKM8975 compass driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/input/misc/akm8975_pana_gyro.c b/drivers/input/misc/akm8975_pana_gyro.c
new file mode 100644
index 0000000..ff83aeb
--- /dev/null
+++ b/drivers/input/misc/akm8975_pana_gyro.c
@@ -0,0 +1,1174 @@
+/* drivers/i2c/chips/akm8975.c - akm8975 compass driver
+ *
+ * Copyright (C) 2008-2009 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <linux/slab.h>
+#include <linux/irq.h>
+#include <linux/miscdevice.h>
+#include <linux/gpio.h>
+#include <linux/uaccess.h>
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/workqueue.h>
+#include <linux/freezer.h>
+#include <linux/akm8975.h>
+#include<linux/earlysuspend.h>
+#include <linux/module.h>
+
+#define DEBUG 0
+#define MAX_FAILURE_COUNT 3
+
+#define D(x...) printk(KERN_DEBUG "[COMP][AKM8975] " x)
+#define I(x...) printk(KERN_INFO "[COMP][AKM8975] " x)
+#define E(x...) printk(KERN_ERR "[COMP][AKM8975 ERROR] " x)
+#define DIF(x...) \
+	{ if (debug_flag) \
+		printk(KERN_DEBUG "[COMP][AKM8975 DEBUG] " x); }
+#define DIF_FATAL_ERR(x...) \
+	{ if (debug_flag_fatal_err) \
+		printk(KERN_DEBUG "[COMP][AKM8975 DEBUG FATAL ERR] " x); }
+
+#define DEVICE_ACCESSORY_ATTR(_name, _mode, _show, _store) \
+struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
+
+static struct i2c_client *this_client;
+
+struct akm8975_data {
+	struct input_dev *input_dev;
+	struct work_struct work;
+	struct early_suspend early_suspend_akm;
+	struct class *htc_ecompass_class;
+	struct device *ecompass_dev;
+};
+
+static char sense_data[RBUFF_SIZE_8975 + 1];
+static struct mutex sense_data_mutex;
+#define AKM8975_RETRY_COUNT 10
+static DECLARE_WAIT_QUEUE_HEAD(data_ready_wq);
+static DECLARE_WAIT_QUEUE_HEAD(open_wq);
+
+static atomic_t data_ready;
+static atomic_t open_count;
+static atomic_t open_flag;
+static atomic_t reserve_open_flag;
+
+static atomic_t m_flag;
+static atomic_t a_flag;
+static atomic_t t_flag;
+static atomic_t mv_flag;
+static int gsensor_first_enable;
+static int failure_count;
+static int m_f_times;
+static short akmd_delay;
+
+static int debug_flag;
+static int debug_flag_fatal_err;
+static int fatal_err_pr_count;
+
+static atomic_t suspend_flag = ATOMIC_INIT(0);
+static atomic_t PhoneOn_flag = ATOMIC_INIT(0);
+static struct akm8975_platform_data *pdata;
+
+static int disable_flag;
+static int reserve_a_flag;
+
+static int AKI2C_RxData(char *rxData, int length)
+{
+	uint8_t loop_i;
+	struct i2c_msg msgs[] = {
+		{
+		 .addr = this_client->addr,
+		 .flags = 0,
+		 .len = 1,
+		 .buf = rxData,
+		 },
+		{
+		 .addr = this_client->addr,
+		 .flags = I2C_M_RD,
+		 .len = length,
+		 .buf = rxData,
+		 },
+	};
+
+	
+
+	for (loop_i = 0; loop_i < AKM8975_RETRY_COUNT; loop_i++) {
+		if (i2c_transfer(this_client->adapter, msgs, 2) > 0)
+			break;
+
+		mdelay(10);
+	}
+
+
+	if (loop_i >= AKM8975_RETRY_COUNT) {
+		E("%s retry over %d\n",
+			__func__, AKM8975_RETRY_COUNT);
+		return -EIO;
+	}
+	return 0;
+}
+
+static int AKI2C_TxData(char *txData, int length)
+{
+	uint8_t loop_i;
+	struct i2c_msg msg[] = {
+		{
+		 .addr = this_client->addr,
+		 .flags = 0,
+		 .len = length,
+		 .buf = txData,
+		 },
+	};
+
+	for (loop_i = 0; loop_i < AKM8975_RETRY_COUNT; loop_i++) {
+		if (i2c_transfer(this_client->adapter, msg, 1) > 0)
+			break;
+
+		mdelay(10);
+	}
+
+
+	if (loop_i >= AKM8975_RETRY_COUNT) {
+		E("%s retry over %d\n",
+			__func__, AKM8975_RETRY_COUNT);
+		return -EIO;
+	}
+	return 0;
+}
+
+static int AKECS_StartMeasure(void)
+{
+	char buffer[2];
+	atomic_set(&data_ready, 0);
+
+	
+	buffer[0] = AK8975_REG_CNTL;
+	buffer[1] = AK8975_CNTL_SNG_MEASURE;
+
+	
+	return AKI2C_TxData(buffer, 2);
+}
+
+static int AKECS_PowerDown(void)
+{
+	char buffer[2];
+	int ret;
+
+	
+
+	
+	buffer[0] = AK8975_REG_CNTL;
+	buffer[1] = AK8975_CNTL_POWER_DOWN;
+	
+	ret = AKI2C_TxData(buffer, 2);
+	if (ret < 0)
+		return ret;
+
+	
+	buffer[0] = AK8975_REG_ST1;
+	
+	ret = AKI2C_RxData(buffer, 1);
+	if (ret < 0)
+		return ret;
+	return ret;
+}
+
+static int AKECS_StartFuseRead(void)
+{
+	char buffer[2];
+
+	
+
+	
+	buffer[0] = AK8975_REG_CNTL;
+	buffer[1] = AK8975_CNTL_FUSE_ACCESS;
+	
+	return AKI2C_TxData(buffer, 2);
+}
+
+static int AKECS_GetData(void)
+{
+	char buffer[RBUFF_SIZE_8975 + 1];
+	int ret;
+
+	DIF_FATAL_ERR("%s: GET_DATA start\n", __func__);
+	memset(buffer, 0, RBUFF_SIZE_8975);
+	buffer[0] = AK8975_REG_ST1;
+	ret = AKI2C_RxData(buffer, RBUFF_SIZE_8975);
+	if (ret < 0)
+		return ret;
+
+	mutex_lock(&sense_data_mutex);
+	memcpy(sense_data, buffer, sizeof(buffer));
+	atomic_set(&data_ready, 1);
+	wake_up(&data_ready_wq);
+	mutex_unlock(&sense_data_mutex);
+
+	DIF("%s: GET_DATA, sense_data(0, 1, 2, 3, 4, 5, 6, 7) = "
+		"(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
+		__func__, sense_data[0], sense_data[1], sense_data[2]
+		, sense_data[3], sense_data[4], sense_data[5], sense_data[6]
+		, sense_data[7]);
+
+	DIF_FATAL_ERR("%s: GET_DATA, sense_data(0, 1, 2, 3, 4,"
+		" 5, 6, 7) = (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, "
+		"0x%x, 0x%x, 0x%x\n",
+		__func__, sense_data[0], sense_data[1],
+		sense_data[2], sense_data[3], sense_data[4],
+		sense_data[5], sense_data[6], sense_data[7]);
+
+	return 0;
+}
+
+static int AKECS_SetMode(char mode)
+{
+	int ret;
+
+	switch (mode) {
+	case AK8975_CNTL_SNG_MEASURE:
+		ret = AKECS_StartMeasure();
+		break;
+	case AK8975_CNTL_FUSE_ACCESS:
+		ret = AKECS_StartFuseRead();
+		break;
+	case AK8975_CNTL_POWER_DOWN:
+		ret = AKECS_PowerDown();
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	
+	mdelay(1);
+	return ret;
+}
+
+static int AKECS_TransRBuff(char *rbuf, int size)
+{
+	int err = -1;
+	err = wait_event_interruptible_timeout(data_ready_wq,
+					 atomic_read(&data_ready), 1000);
+	if (err == -ERESTARTSYS) {
+		I("%s interrupted by a signal.\n", __func__);
+		return -1;
+	} else if (err == 0)
+		E("%s data timeout.\n", __func__);
+
+	DIF_FATAL_ERR("%s: data_ready %d, suspend_flag %d\n",
+			__func__, atomic_read(&data_ready),
+			atomic_read(&suspend_flag));
+
+	if (!atomic_read(&data_ready)) {
+		if (!atomic_read(&suspend_flag)) {
+			D("%s: DATA\n", __func__);
+			failure_count++;
+			if (failure_count >= MAX_FAILURE_COUNT) {
+				E("%s: successive %d failure.\n",
+				       __func__, failure_count);
+				debug_flag_fatal_err = 1;
+				atomic_set(&open_flag, -1);
+				wake_up(&open_wq);
+				failure_count = 0;
+			}
+		}
+		return -1;
+	}
+
+	mutex_lock(&sense_data_mutex);
+	memcpy(&rbuf[0], &sense_data[0], size);
+	atomic_set(&data_ready, 0);
+	mutex_unlock(&sense_data_mutex);
+
+	failure_count = 0;
+	return 0;
+}
+
+
+static void AKECS_Report_Value(short *rbuf)
+{
+	struct akm8975_data *data = i2c_get_clientdata(this_client);
+#if DEBUG
+	D("AKECS_Report_Value: yaw = %d, pitch = %d, roll = %d"
+		"\n", rbuf[0], rbuf[1], rbuf[2]);
+	D("                    tmp = %d, m_stat= %d, g_stat=%d"
+		"\n", rbuf[3], rbuf[4], rbuf[5]);
+	D("          G_Sensor:   x = %d LSB, y = %d LSB, z = "
+		"%d LSB\n", rbuf[6], rbuf[7], rbuf[8]);
+	D("          Compass:   x = %d LSB, y = %d LSB, z = %d"
+		" LSB\n", rbuf[9], rbuf[10], rbuf[11]);
+#endif
+	DIF(
+		"AKECS_Report_Value: yaw = %d, pitch = %d, roll = %d"
+		"\n", rbuf[0], rbuf[1], rbuf[2]);
+	DIF(
+	"          G_Sensor:   x = %d LSB, y = %d LSB, z = "
+		"%d LSB\n", rbuf[6], rbuf[7], rbuf[8]);
+	DIF(
+	"          Compass:   x = %d LSB, y = %d LSB, z = %d"
+		" LSB\n", rbuf[9], rbuf[10], rbuf[11]);
+
+	DIF("(m, a, t, mv) = (0x%x, 0x%x, 0x%x, 0x%x)\n",
+		atomic_read(&m_flag), atomic_read(&a_flag),
+		atomic_read(&t_flag), atomic_read(&mv_flag));
+	if (pdata->use_pana_gyro == 0) {
+		if (fatal_err_pr_count < 10) {
+			DIF_FATAL_ERR(
+				"AKECS_Report_Value: yaw = %d, pitch = %d,"
+				" roll = %d\n", rbuf[0], rbuf[1], rbuf[2]);
+			DIF_FATAL_ERR(
+			"          G_Sensor:   x = %d LSB, y = %d LSB, z = "
+				"%d LSB\n", rbuf[6], rbuf[7], rbuf[8]);
+			DIF_FATAL_ERR(
+			"          Compass:   x = %d LSB, y = %d LSB, z = %d"
+				" LSB\n", rbuf[9], rbuf[10], rbuf[11]);
+
+			DIF_FATAL_ERR("(m, a, t, mv) = (0x%x, 0x%x, 0x%x,"
+				" 0x%x)\n",
+				atomic_read(&m_flag), atomic_read(&a_flag),
+				atomic_read(&t_flag), atomic_read(&mv_flag));
+
+			fatal_err_pr_count++;
+		} else {
+			fatal_err_pr_count = 0;
+			debug_flag_fatal_err = 0;
+		}
+
+		
+		if (atomic_read(&m_flag)) {
+			input_report_abs(data->input_dev, ABS_RX, rbuf[0]);
+			input_report_abs(data->input_dev, ABS_RY, rbuf[1]);
+			input_report_abs(data->input_dev, ABS_RZ, rbuf[2]);
+			input_report_abs(data->input_dev, ABS_RUDDER, rbuf[4]);
+		}
+
+		
+		if (atomic_read(&a_flag)) {
+			input_report_abs(data->input_dev, ABS_X, rbuf[6]);
+			input_report_abs(data->input_dev, ABS_Y, rbuf[7]);
+			input_report_abs(data->input_dev, ABS_Z, rbuf[8]);
+			input_report_abs(data->input_dev, ABS_WHEEL, rbuf[5]);
+		}
+
+		
+		if (atomic_read(&t_flag))
+			input_report_abs(data->input_dev, ABS_THROTTLE, rbuf[3]);
+
+		if (atomic_read(&mv_flag)) {
+			input_report_abs(data->input_dev, ABS_HAT0X, rbuf[9]);
+			input_report_abs(data->input_dev, ABS_HAT0Y, rbuf[10]);
+			input_report_abs(data->input_dev, ABS_BRAKE, rbuf[11]);
+		}
+
+		input_sync(data->input_dev);
+	} else if (atomic_read(&a_flag) ) {
+		EWTZMU2_Report_Value_akm(gsensor_first_enable, rbuf[6], rbuf[7], rbuf[8]);
+		if (gsensor_first_enable == 1)
+			gsensor_first_enable = 0;
+	}
+}
+
+static int AKECS_GetOpenStatus(void)
+{
+	D("%s:\n", __func__);
+	wait_event_interruptible(open_wq, (atomic_read(&open_flag) != 0));
+	
+	return atomic_read(&open_flag);
+}
+
+static int AKECS_GetCloseStatus(void)
+{
+	D("%s:\n", __func__);
+	wait_event_interruptible(open_wq, (atomic_read(&open_flag) <= 0));
+	return atomic_read(&open_flag);
+}
+
+static void AKECS_CloseDone(void)
+{
+	I("%s:\n", __func__);
+	atomic_set(&m_flag, 0);
+	atomic_set(&a_flag, 0);
+	atomic_set(&t_flag, 0);
+	atomic_set(&mv_flag, 0);
+}
+
+static int akm_aot_open(struct inode *inode, struct file *file)
+{
+	int ret = -1;
+	struct akm8975_data *data = i2c_get_clientdata(this_client);
+
+	printk(KERN_INFO "[COMP] Compass enable\n");
+
+	DIF("%s: open_count = %d, open_flag = %d\n", __func__,
+		atomic_read(&open_count), atomic_read(&open_flag));
+
+	DIF_FATAL_ERR("%s: open_count = %d, open_flag = %d\n", __func__,
+		atomic_read(&open_count), atomic_read(&open_flag));
+
+	if (atomic_cmpxchg(&open_count, 0, 1) == 0) {
+		atomic_set(&open_flag, 1);
+		if (pdata->use_pana_gyro == 0)
+			input_report_abs(data->input_dev, ABS_RUDDER, -1);
+		atomic_set(&reserve_open_flag, 1);
+		wake_up(&open_wq);
+		ret = 0;
+	}
+	return ret;
+}
+
+static int akm_aot_release(struct inode *inode, struct file *file)
+{
+	I("[COMP] Compass disable\n");
+
+	debug_flag_fatal_err = 0;
+	fatal_err_pr_count = 0;
+
+	atomic_set(&reserve_open_flag, 0);
+	atomic_set(&open_flag, 0);
+	atomic_set(&open_count, 0);
+	wake_up(&open_wq);
+	return 0;
+}
+
+static long
+akm_aot_ioctl( struct file *file,
+	      unsigned int cmd, unsigned long arg)
+{
+	void __user *argp = (void __user *)arg;
+	short flag = 0;
+	int ret = -1;
+
+	ret = copy_from_user(&flag, argp, sizeof(flag));
+	if (ret)
+		return -EFAULT;
+	DIF("%s: cmd = 0x%x, flag = %d\n", __func__, cmd, flag);
+
+	switch (cmd) {
+	case ECS_IOCTL_APP_SET_MFLAG:
+	case ECS_IOCTL_APP_SET_AFLAG:
+	case ECS_IOCTL_APP_SET_TFLAG:
+	case ECS_IOCTL_APP_SET_MVFLAG:
+		if (copy_from_user(&flag, argp, sizeof(flag)))
+			return -EFAULT;
+		if (flag < 0 || flag > 1)
+			return -EINVAL;
+		break;
+	case ECS_IOCTL_APP_SET_DELAY:
+		if (copy_from_user(&flag, argp, sizeof(flag)))
+			return -EFAULT;
+		break;
+	default:
+		break;
+	}
+
+	switch (cmd) {
+	case ECS_IOCTL_APP_SET_MFLAG:
+		atomic_set(&m_flag, flag);
+		if (flag == 0) {
+			m_f_times = 0;
+			I("ECS_IOCTL_APP_SET_MFLAG,(m, a, t, mv) = (0x%x, 0x%x, 0x%x, 0x%x), m_f_times %d\n",
+				atomic_read(&m_flag), atomic_read(&a_flag),
+				atomic_read(&t_flag), atomic_read(&mv_flag), m_f_times);
+		}
+		break;
+	case ECS_IOCTL_APP_GET_MFLAG:
+		flag = atomic_read(&m_flag);
+		break;
+	case ECS_IOCTL_APP_SET_AFLAG:
+		reserve_a_flag = flag;
+		if (disable_flag != 1) {
+			gsensor_first_enable = 1;
+			atomic_set(&a_flag, flag);
+		} else {
+			gsensor_first_enable = 0;
+			atomic_set(&a_flag, 0);
+		}
+		break;
+	case ECS_IOCTL_APP_GET_AFLAG:
+		flag = atomic_read(&a_flag);
+		break;
+	case ECS_IOCTL_APP_SET_TFLAG:
+		atomic_set(&t_flag, flag);
+		break;
+	case ECS_IOCTL_APP_GET_TFLAG:
+		flag = atomic_read(&t_flag);
+		break;
+	case ECS_IOCTL_APP_SET_MVFLAG:
+		atomic_set(&mv_flag, flag);
+		break;
+	case ECS_IOCTL_APP_GET_MVFLAG:
+		flag = atomic_read(&mv_flag);
+		break;
+	case ECS_IOCTL_APP_SET_DELAY:
+		akmd_delay = flag;
+		break;
+	case ECS_IOCTL_APP_GET_DELAY:
+		flag = akmd_delay;
+		break;
+	default:
+		return -ENOTTY;
+	}
+
+	switch (cmd) {
+	case ECS_IOCTL_APP_GET_MFLAG:
+	case ECS_IOCTL_APP_GET_AFLAG:
+	case ECS_IOCTL_APP_GET_TFLAG:
+	case ECS_IOCTL_APP_GET_MVFLAG:
+	case ECS_IOCTL_APP_GET_DELAY:
+		if (copy_to_user(argp, &flag, sizeof(flag)))
+			return -EFAULT;
+		break;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+static int akmd_open(struct inode *inode, struct file *file)
+{
+	I("%s:\n", __func__);
+	return nonseekable_open(inode, file);
+}
+
+static int akmd_release(struct inode *inode, struct file *file)
+{
+	I("%s:\n", __func__);
+	AKECS_CloseDone();
+	return 0;
+}
+static short report_to_gyro_value[12] = {0};
+
+void akm_get_akmd_data(short *getdata)
+{
+	int i;
+
+	for (i = 0; i < 12; i++)
+		*(getdata+i) = report_to_gyro_value[i];
+}
+
+int  akm_get_akmd_ready(void)
+{
+	return m_f_times;
+}
+static long
+akmd_ioctl( struct file *file, unsigned int cmd,
+	   unsigned long arg)
+{
+
+	void __user *argp = (void __user *)arg;
+
+	char msg[RBUFF_SIZE_8975 + 1] = "", rwbuf[RBUFF_SIZE_8975 + 1] = "";
+	int ret = -1, status;
+	short mode, value[12], delay;
+	short layouts[4][3][3];
+	int i, j, k;
+
+	DIF("%s: cmd = 0x%x\n", __func__, cmd);
+	
+
+	switch (cmd) {
+	case ECS_IOCTL_WRITE:
+	case ECS_IOCTL_READ:
+		if (copy_from_user(&rwbuf, argp, sizeof(rwbuf)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_SET_MODE:
+		if (copy_from_user(&mode, argp, sizeof(mode)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_SET_YPR:
+		if (copy_from_user(&value, argp, sizeof(value)))
+			return -EFAULT;
+		break;
+	default:
+		break;
+	}
+
+	switch (cmd) {
+	case ECS_IOCTL_WRITE:
+		if (rwbuf[0] < 2)
+			return -EINVAL;
+		ret = AKI2C_TxData(&rwbuf[1], rwbuf[0]);
+		if (ret < 0)
+			return ret;
+		break;
+	case ECS_IOCTL_READ:
+		if (rwbuf[0] < 1)
+			return -EINVAL;
+		ret = AKI2C_RxData(&rwbuf[1], rwbuf[0]);
+		if (ret < 0)
+			return ret;
+		break;
+	case ECS_IOCTL_SET_MODE:
+		ret = AKECS_SetMode((char)mode);
+		if (ret < 0)
+			return ret;
+		DIF_FATAL_ERR("%s: ECS_IOCTL_SET_MODE(%d) success\n",
+			__func__, mode);
+		break;
+	case ECS_IOCTL_GETDATA:
+		
+		DIF_FATAL_ERR("%s: calling AKECS_TransRBuff\n", __func__);
+		ret = AKECS_TransRBuff(msg, RBUFF_SIZE_8975);
+		if (ret < 0)
+			return ret;
+		break;
+	case ECS_IOCTL_SET_YPR:
+		for (i = 0; i < 12; i++)
+			report_to_gyro_value[i] = value[i];
+		if (atomic_read(&m_flag) && m_f_times == 0) {
+			m_f_times = 1;
+			I("(m, a, t, mv) = (0x%x, 0x%x, 0x%x, 0x%x), set m_f_times %d\n",
+				atomic_read(&m_flag), atomic_read(&a_flag),
+				atomic_read(&t_flag), atomic_read(&mv_flag), m_f_times);
+		}
+		if (atomic_read(&m_flag) == 0) {
+			if (m_f_times == 1)
+				I("(m, a, t, mv) = (0x%x, 0x%x, 0x%x, 0x%x),  set 0 to m_f_times %d\n",
+				atomic_read(&m_flag), atomic_read(&a_flag),
+				atomic_read(&t_flag), atomic_read(&mv_flag), m_f_times);
+			m_f_times = 0;
+		}
+
+		AKECS_Report_Value(value);
+		break;
+	case ECS_IOCTL_GET_COMP_FLAG:
+		status = atomic_read(&m_flag);
+		status |= atomic_read(&mv_flag);
+		DIF("%s: ECS_IOCTL_GET_COMP_FLAG, status = %d\n",
+			__func__, status);
+		break;
+	case ECS_IOCTL_GET_OPEN_STATUS:
+		status = AKECS_GetOpenStatus();
+		break;
+	case ECS_IOCTL_GET_CLOSE_STATUS:
+		status = AKECS_GetCloseStatus();
+		break;
+	case ECS_IOCTL_GET_DELAY:
+		delay = akmd_delay;
+		break;
+	case ECS_IOCTL_GET_MATRIX:
+		for (i = 0; i < 4; i++)
+			for (j = 0; j < 3; j++)
+				for (k = 0; k < 3; k++) {
+				layouts[i][j][k] = pdata->layouts[i][j][k];
+				}
+		break;
+	default:
+		return -ENOTTY;
+	}
+
+	switch (cmd) {
+	case ECS_IOCTL_READ:
+		if (copy_to_user(argp, &rwbuf, sizeof(rwbuf)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_GETDATA:
+		msg[8] = debug_flag;
+		if (copy_to_user(argp, &msg, sizeof(msg)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_GET_COMP_FLAG:
+	case ECS_IOCTL_GET_OPEN_STATUS:
+	case ECS_IOCTL_GET_CLOSE_STATUS:
+		if (copy_to_user(argp, &status, sizeof(status)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_GET_DELAY:
+		if (copy_to_user(argp, &delay, sizeof(delay)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_GET_MATRIX:
+		if (copy_to_user(argp, layouts, sizeof(layouts)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_GET_DATA_FOR_GYRO:
+		I("%s: ECS_IOCTL_GET_DATA_FOR_GYRO = 0x%x\n", __func__, ECS_IOCTL_GET_DATA_FOR_GYRO);
+		if (copy_to_user(argp, report_to_gyro_value, sizeof(report_to_gyro_value)))
+			return -EFAULT;
+		break;
+	default:
+		break;
+	}
+	return 0;
+}
+
+static void akm_work_func(struct work_struct *work)
+{
+	if (AKECS_GetData() < 0)
+		E("%s: Get data failed\n", __func__);
+	enable_irq(this_client->irq);
+}
+
+static irqreturn_t akm8975_interrupt(int irq, void *dev_id)
+{
+	struct akm8975_data *data = dev_id;
+
+	DIF_FATAL_ERR("%s\n", __func__);
+
+	disable_irq_nosync(this_client->irq);
+	schedule_work(&data->work);
+	return IRQ_HANDLED;
+}
+
+#ifdef AKM_EARLY_SUSPEND
+static void akm8975_early_suspend(struct early_suspend *handler)
+{
+	DIF("%s", __func__);
+
+	if (!atomic_read(&PhoneOn_flag)) {
+		atomic_set(&suspend_flag, 1);
+		atomic_set(&reserve_open_flag, atomic_read(&open_flag));
+		atomic_set(&open_flag, 0);
+		wake_up(&open_wq);
+		disable_irq(this_client->irq);
+	} else
+		D("AKM8975 akm8975_early_suspend: PhoneOn_flag is set\n");
+}
+
+static void akm8975_early_resume(struct early_suspend *handler)
+{
+	DIF("%s", __func__);
+
+	if (atomic_read(&suspend_flag)) {
+		enable_irq(this_client->irq);
+		atomic_set(&suspend_flag, 0);
+		atomic_set(&open_flag, atomic_read(&reserve_open_flag));
+		wake_up(&open_wq);
+	} else
+		D("AKM8975 akm8975_early_resume: PhoneOn_flag is set\n");
+}
+
+#else 
+
+static int akm8975_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+	DIF("%s", __func__);
+
+	DIF_FATAL_ERR("%s", __func__);
+
+	atomic_set(&suspend_flag, 1);
+	atomic_set(&reserve_open_flag, atomic_read(&open_flag));
+	atomic_set(&open_flag, 0);
+	wake_up(&open_wq);
+	disable_irq(this_client->irq);
+
+	return 0;
+}
+
+static int akm8975_resume(struct i2c_client *client)
+{
+	enable_irq(this_client->irq);
+	atomic_set(&suspend_flag, 0);
+	atomic_set(&open_flag, atomic_read(&reserve_open_flag));
+	wake_up(&open_wq);
+
+	D("%s: (m, a, t, mv) = (0x%x, 0x%x, 0x%x, 0x%x)\n",
+		__func__, atomic_read(&m_flag), atomic_read(&a_flag),
+		atomic_read(&t_flag), atomic_read(&mv_flag));
+
+	return 0;
+}
+#endif 
+
+static const struct file_operations akmd_fops = {
+	.owner = THIS_MODULE,
+	.open = akmd_open,
+	.release = akmd_release,
+	
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = akmd_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = akmd_ioctl,
+#endif
+};
+
+static const struct file_operations akm_aot_fops = {
+	.owner = THIS_MODULE,
+	.open = akm_aot_open,
+	.release = akm_aot_release,
+	
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = akm_aot_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = akm_aot_ioctl,
+#endif
+};
+
+
+static struct miscdevice akm_aot_device = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "akm8975_aot",
+	.fops = &akm_aot_fops,
+};
+
+
+static struct miscdevice akmd_device = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "akm8975_daemon",
+	.fops = &akmd_fops,
+};
+
+static ssize_t akm_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+	s += sprintf(s, "%d\n", atomic_read(&PhoneOn_flag));
+	return (s - buf);
+}
+
+static ssize_t akm_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	if (count == (strlen("enable") + 1) &&
+	   strncmp(buf, "enable", strlen("enable")) == 0) {
+		atomic_set(&PhoneOn_flag, 1);
+		D("AKM8975 akm_store: PhoneOn_flag=%d\n",
+			atomic_read(&PhoneOn_flag));
+		return count;
+	}
+	if (count == (strlen("disable") + 1) &&
+	   strncmp(buf, "disable", strlen("disable")) == 0) {
+		atomic_set(&PhoneOn_flag, 0);
+		D("AKM8975 akm_store: PhoneOn_flag=%d\n",
+			atomic_read(&PhoneOn_flag));
+		return count;
+	}
+	E("akm_store: invalid argument\n");
+	return -EINVAL;
+}
+
+static DEVICE_ACCESSORY_ATTR(PhoneOnOffFlag, 0664, \
+	akm_show, akm_store);
+
+static ssize_t debug_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+	short lm_flag = -1;
+	short la_flag = -1;
+	short lt_flag = -1;
+	short lmv_flag = -1;
+	short ldelay_flag = -1;
+
+	lm_flag = atomic_read(&m_flag);
+	la_flag = atomic_read(&a_flag);
+	lt_flag = atomic_read(&t_flag);
+	lmv_flag = atomic_read(&mv_flag);
+	ldelay_flag = akmd_delay;
+
+	s += sprintf(s, "(m, a, t, mv, delay, debug_flag, "
+		"debug_flag_fatal_err) = (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x,"
+		" 0x%x)\n", lm_flag, la_flag, lt_flag, lmv_flag, ldelay_flag,
+		debug_flag, debug_flag_fatal_err);
+
+	return s - buf;
+}
+
+static ssize_t debug_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	debug_flag = -1;
+	sscanf(buf, "%d", &debug_flag);
+
+	D("%s: debug_flag = %d\n", __func__, debug_flag);
+
+	return count;
+}
+
+static DEVICE_ACCESSORY_ATTR(debug_en, 0664, \
+	debug_show, debug_store);
+
+static ssize_t disable_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+
+	s += sprintf(s, "disable_flag = 0x%x\n", disable_flag);
+
+	return s - buf;
+}
+
+static ssize_t disable_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	disable_flag = -1;
+	sscanf(buf, "%d", &disable_flag);
+
+	D("%s: disable_flag = %d\n", __func__, disable_flag);
+
+	if (disable_flag == 1)
+		atomic_set(&a_flag, 0);
+	else
+		atomic_set(&a_flag, reserve_a_flag);
+
+	return count;
+}
+
+static DEVICE_ACCESSORY_ATTR(disable_en, 0664, \
+	disable_show, disable_store);
+
+
+int akm8975_registerAttr_pana(struct akm8975_data *akm)
+{
+	int ret;
+
+	akm->htc_ecompass_class = class_create(THIS_MODULE, "htc_ecompass");
+	if (IS_ERR(akm->htc_ecompass_class)) {
+		ret = PTR_ERR(akm->htc_ecompass_class);
+		akm->htc_ecompass_class = NULL;
+		goto err_create_class;
+	}
+
+	akm->ecompass_dev = device_create(akm->htc_ecompass_class,
+				NULL, 0, "%s", "ecompass");
+	if (unlikely(IS_ERR(akm->ecompass_dev))) {
+		ret = PTR_ERR(akm->ecompass_dev);
+		akm->ecompass_dev = NULL;
+		goto err_create_ecompass_device;
+	}
+
+	
+	ret = device_create_file(akm->ecompass_dev, &dev_attr_PhoneOnOffFlag);
+	if (ret)
+		goto err_create_ecompass_device_file;
+
+	
+	ret = device_create_file(akm->ecompass_dev, &dev_attr_debug_en);
+	if (ret)
+		goto err_create_ecompass_debug_device_file;
+
+	
+	ret = device_create_file(akm->ecompass_dev, &dev_attr_disable_en);
+	if (ret)
+		goto err_create_ecompass_disable_device_file;
+
+	return 0;
+
+err_create_ecompass_disable_device_file:
+err_create_ecompass_debug_device_file:
+err_create_ecompass_device_file:
+	device_unregister(akm->ecompass_dev);
+err_create_ecompass_device:
+	class_destroy(akm->htc_ecompass_class);
+err_create_class:
+
+	return ret;
+}
+
+
+int akm8975_probe_pana(struct i2c_client *client, const struct i2c_device_id *id)
+{
+	struct akm8975_data *akm;
+	int err = 0;
+	char msg[RBUFF_SIZE_8975 + 1];
+	unsigned int irq_type;
+
+	
+
+	memset(msg, 0, RBUFF_SIZE_8975 + 1);
+
+	I("%s:\n", __func__);
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		err = -ENODEV;
+		goto exit_check_functionality_failed;
+	}
+
+	akm = kzalloc(sizeof(struct akm8975_data), GFP_KERNEL);
+	if (!akm) {
+		err = -ENOMEM;
+		goto exit_alloc_data_failed;
+	}
+
+	INIT_WORK(&akm->work, akm_work_func);
+	i2c_set_clientdata(client, akm);
+
+	mutex_init(&sense_data_mutex);
+
+	pdata = client->dev.platform_data;
+	if (pdata == NULL) {
+		E("%s: platform data is NULL\n", __func__);
+		goto exit_platform_data_null;
+	}
+	this_client = client;
+
+	err = AKECS_PowerDown();
+	if (err < 0) {
+		E("%s: set power down mode error\n", __func__);
+		goto exit_set_mode_failed;
+	}
+	if (pdata->use_pana_gyro == 0) {
+		akm->input_dev = input_allocate_device();
+
+		if (!akm->input_dev) {
+			err = -ENOMEM;
+			E("%s: Failed to allocate input device\n", __func__);
+			goto exit_input_dev_alloc_failed;
+		}
+
+		set_bit(EV_ABS, akm->input_dev->evbit);
+		
+		input_set_abs_params(akm->input_dev, ABS_RX, 0, 360, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_RY, -180, 180, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_RZ, -90, 90, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_X, -1872, 1872, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_Y, -1872, 1872, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_Z, -1872, 1872, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_THROTTLE, -30, 85, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_RUDDER, -32768, 3, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_WHEEL, -32768, 3, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_GAS, 0, 65535, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_HAT0X, -2048, 2032, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_HAT0Y, -2048, 2032, 0, 0);
+		
+		input_set_abs_params(akm->input_dev, ABS_BRAKE, -2048, 2032, 0, 0);
+
+		akm->input_dev->name = "compass";
+
+		err = input_register_device(akm->input_dev);
+
+		if (err) {
+			E("%s: Unable to register input device: %s\n", __func__,
+				akm->input_dev->name);
+			goto exit_input_register_device_failed;
+		}
+	}
+	err = misc_register(&akmd_device);
+	if (err) {
+		E("%s: akmd_device register failed\n", __func__);
+		goto exit_misc_device_register_failed;
+	}
+
+	err = misc_register(&akm_aot_device);
+	if (err) {
+		E("%s: akm_aot_device register failed\n", __func__);
+		goto exit_misc_device_register_failed;
+	}
+
+	init_waitqueue_head(&data_ready_wq);
+	init_waitqueue_head(&open_wq);
+
+	
+	atomic_set(&m_flag, 0);
+	atomic_set(&a_flag, 0);
+	atomic_set(&t_flag, 0);
+	atomic_set(&mv_flag, 0);
+
+	debug_flag = 0;
+	debug_flag_fatal_err = 0;
+	fatal_err_pr_count = 0;
+
+#ifdef AKM_EARLY_SUSPEND
+	akm->early_suspend_akm.suspend = akm8975_early_suspend;
+	akm->early_suspend_akm.resume = akm8975_early_resume;
+	register_early_suspend(&akm->early_suspend_akm);
+#endif
+	err = akm8975_registerAttr_pana(akm);
+	if (err) {
+		E("%s: akm8975_registerAttr_pana failed\n", __func__);
+		goto exit_registerAttr_failed;
+	}
+
+	disable_flag = 0;
+	reserve_a_flag = 0;
+
+	irq_type = (pdata->irq_trigger) ? IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH;
+
+	err = request_irq(client->irq, akm8975_interrupt, irq_type,
+			  "akm8975", akm);
+	if (err < 0) {
+		E("%s: request irq failed\n", __func__);
+		goto exit_irq_request_failed;
+	}
+	I("%s:OK\n", __func__);
+	return 0;
+
+exit_irq_request_failed:
+exit_registerAttr_failed:
+exit_misc_device_register_failed:
+exit_input_register_device_failed:
+	if (pdata->use_pana_gyro == 0)
+		input_free_device(akm->input_dev);
+exit_input_dev_alloc_failed:
+	free_irq(client->irq, akm);
+exit_set_mode_failed:
+exit_platform_data_null:
+	kfree(akm);
+exit_alloc_data_failed:
+exit_check_functionality_failed:
+	return err;
+
+}
+
+static int akm8975_remove(struct i2c_client *client)
+{
+	struct akm8975_data *akm = i2c_get_clientdata(client);
+	free_irq(client->irq, akm);
+	if (pdata->use_pana_gyro == 0)
+		input_unregister_device(akm->input_dev);
+	kfree(akm);
+	return 0;
+}
+static const struct i2c_device_id akm8975_id[] = {
+	{ AKM8975_I2C_NAME, 0 },
+	{ }
+};
+
+static struct i2c_driver akm8975_driver = {
+	.probe 	= akm8975_probe_pana,
+	.remove 	= akm8975_remove,
+	.id_table	= akm8975_id,
+
+#ifndef AKM_EARLY_SUSPEND
+	.suspend = akm8975_suspend,
+	.resume = akm8975_resume,
+#endif
+	.driver = {
+		   .name = AKM8975_I2C_NAME,
+		   },
+};
+
+static int __init akm8975_init(void)
+{
+	I("AKM8975 compass driver for pana gyro: init\n");
+	return i2c_add_driver(&akm8975_driver);
+}
+
+static void __exit akm8975_exit(void)
+{
+	i2c_del_driver(&akm8975_driver);
+}
+
+module_init(akm8975_init);
+module_exit(akm8975_exit);
+
+MODULE_DESCRIPTION("AKM8975 compass driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/input/misc/bma250.c b/drivers/input/misc/bma250.c
new file mode 100644
index 0000000..902618b
--- /dev/null
+++ b/drivers/input/misc/bma250.c
@@ -0,0 +1,676 @@
+/* drivers/i2c/chips/bma250.c - bma250 G-sensor driver
+ *
+ * Copyright (C) 2008-2009 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/i2c.h>
+#include <linux/slab.h>
+#include <linux/miscdevice.h>
+#include <linux/uaccess.h>
+#include <linux/input.h>
+#include <linux/bma250.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include<linux/earlysuspend.h>
+#include <linux/export.h>
+#include <linux/module.h>
+
+
+#define D(x...) pr_info("[GSNR][BMA250] " x)
+#define E(x...) printk(KERN_ERR "[GSNR][BMA250 ERROR] " x)
+#define DIF(x...) {\
+		if (debug_flag)\
+			printk(KERN_DEBUG "[GSNR][BMA250 DEBUG] " x); }
+
+#define DEFAULT_RANGE	BMA_RANGE_2G
+#define DEFAULT_BW	BMA_BW_31_25HZ
+
+#define RETRY_TIMES	10
+
+static struct i2c_client *this_client;
+
+struct bma250_data {
+	struct input_dev *input_dev;
+	struct work_struct work;
+	struct early_suspend early_suspend;
+};
+
+static struct bma250_platform_data *pdata;
+static atomic_t PhoneOn_flag = ATOMIC_INIT(0);
+#define DEVICE_ACCESSORY_ATTR(_name, _mode, _show, _store) \
+struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
+
+static int debug_flag;
+static char update_user_calibrate_data;
+
+static int BMA_I2C_RxData(char *rxData, int length)
+{
+	int retry;
+	struct i2c_msg msgs[] = {
+		{
+		 .addr = this_client->addr,
+		 .flags = 0,
+		 .len = 1,
+		 .buf = rxData,
+		},
+		{
+		 .addr = this_client->addr,
+		 .flags = I2C_M_RD,
+		 .len = length,
+		 .buf = rxData,
+		 },
+	};
+
+	for (retry = 0; retry <= RETRY_TIMES; retry++) {
+		if (i2c_transfer(this_client->adapter, msgs, 2) > 0)
+			break;
+		else
+			mdelay(10);
+	}
+
+	if (retry > RETRY_TIMES) {
+		E("%s: retry over %d\n", __func__, RETRY_TIMES);
+		return -EIO;
+	} else
+		return 0;
+}
+
+static int BMA_I2C_TxData(char *txData, int length)
+{
+	int retry;
+	struct i2c_msg msg[] = {
+		{
+		 .addr = this_client->addr,
+		 .flags = 0,
+		 .len = length,
+		 .buf = txData,
+		 },
+	};
+
+	for (retry = 0; retry <= RETRY_TIMES; retry++) {
+		if (i2c_transfer(this_client->adapter, msg, 1) > 0)
+			break;
+		else
+			mdelay(10);
+	}
+
+	if (retry > RETRY_TIMES) {
+		E("%s: retry over %d\n", __func__, RETRY_TIMES);
+		return -EIO;
+	} else
+		return 0;
+}
+
+static int BMA_Init(void)
+{
+	char buffer[4] = "";
+	int ret;
+	unsigned char range = 0, bw = 0;
+
+	memset(buffer, 0, 4);
+
+	buffer[0] = bma250_RANGE_SEL_REG;
+	ret = BMA_I2C_RxData(buffer, 2);
+	if (ret < 0)
+		return -1;
+	D("%s: bma250_RANGE_SEL_REG++: range = 0x%02x, bw = 0x%02x\n",
+		__func__, buffer[0], buffer[1]);
+	range = (buffer[0] & 0xF0) | DEFAULT_RANGE;
+	bw = (buffer[1] & 0xE0) | DEFAULT_BW;
+
+	
+
+	buffer[1] = bw;
+	buffer[0] = bma250_BW_SEL_REG;
+	ret = BMA_I2C_TxData(buffer, 2);
+	if (ret < 0) {
+		E("%s: Write bma250_BW_SEL_REG fail\n", __func__);
+		return -1;
+	}
+
+	buffer[1] = range;
+	buffer[0] = bma250_RANGE_SEL_REG;
+	ret = BMA_I2C_TxData(buffer, 2);
+	if (ret < 0) {
+		E("%s: Write bma250_BW_SEL_REG fail\n", __func__);
+		return -1;
+	}
+
+	
+	buffer[0] = bma250_RANGE_SEL_REG;
+	ret = BMA_I2C_RxData(buffer, 2);
+	if (ret < 0)
+		return -1;
+
+	D("%s: bma250_RANGE_SEL_REG:use single write--: range = 0x%02x, bw = 0x%02x\n",
+		__func__, buffer[0], buffer[1]);
+
+	return 0;
+
+}
+
+static int BMA_TransRBuff(short *rbuf)
+{
+	char buffer[6];
+	int ret;
+
+	memset(buffer, 0, 6);
+
+	buffer[0] = bma250_X_AXIS_LSB_REG;
+	ret = BMA_I2C_RxData(buffer, 6);
+	if (ret < 0)
+		return ret;
+
+
+	rbuf[0] = (short)(buffer[1] << 8 | buffer[0]);
+	rbuf[0] >>= 6;
+	rbuf[1] = (short)(buffer[3] << 8 | buffer[2]);
+	rbuf[1] >>= 6;
+	rbuf[2] = (short)(buffer[5] << 8 | buffer[4]);
+	rbuf[2] >>= 6;
+
+	DIF("%s: (x, y, z) = (%d, %d, %d)\n",
+		__func__, rbuf[0], rbuf[1], rbuf[2]);
+
+	return 1;
+}
+
+static int BMA_set_mode(unsigned char mode)
+{
+	char buffer[2] = "";
+	int ret = 0;
+	unsigned char data1 = 0;
+
+	printk(KERN_INFO "[GSNR] Gsensor %s\n", mode ? "disable" : "enable");
+
+	memset(buffer, 0, 2);
+
+	D("%s: mode = 0x%02x\n", __func__, mode);
+	if (mode < 2) {
+		buffer[0] = bma250_MODE_CTRL_REG;
+		ret = BMA_I2C_RxData(buffer, 1);
+		if (ret < 0)
+			return -1;
+		
+
+		switch (mode) {
+		case bma250_MODE_NORMAL:
+			data1 = buffer[0] & 0x7F;
+			break;
+		case bma250_MODE_SUSPEND:
+			data1 = buffer[0] | 0x80;
+			break;
+		default:
+			break;
+		}
+
+		
+		buffer[0] = bma250_MODE_CTRL_REG;
+		buffer[1] = data1;
+		ret = BMA_I2C_TxData(buffer, 2);
+	} else
+		ret = E_OUT_OF_RANGE;
+
+	if (mode == bma250_MODE_NORMAL)
+		usleep(2000);
+	
+
+	return ret;
+}
+
+static int BMA_GET_INT(void)
+{
+	int ret;
+	ret = gpio_get_value(pdata->intr);
+	return ret;
+}
+
+static int bma_open(struct inode *inode, struct file *file)
+{
+	return nonseekable_open(inode, file);
+}
+
+static int bma_release(struct inode *inode, struct file *file)
+{
+	return 0;
+}
+
+static long bma_ioctl(struct file *file, unsigned int cmd,
+	   unsigned long arg)
+{
+
+	void __user *argp = (void __user *)arg;
+
+	char rwbuf[8] = "";
+	int ret = -1;
+	short buf[8], temp;
+	int kbuf = 0;
+
+	DIF("%s: cmd = 0x%x\n", __func__, cmd);
+
+	switch (cmd) {
+	case BMA_IOCTL_READ:
+	case BMA_IOCTL_WRITE:
+	case BMA_IOCTL_SET_MODE:
+	case BMA_IOCTL_SET_CALI_MODE:
+	case BMA_IOCTL_SET_UPDATE_USER_CALI_DATA:
+		if (copy_from_user(&rwbuf, argp, sizeof(rwbuf)))
+			return -EFAULT;
+		break;
+	case BMA_IOCTL_READ_ACCELERATION:
+		if (copy_from_user(&buf, argp, sizeof(buf)))
+			return -EFAULT;
+		break;
+	case BMA_IOCTL_WRITE_CALI_VALUE:
+		if (copy_from_user(&kbuf, argp, sizeof(kbuf)))
+			return -EFAULT;
+		break;
+	default:
+		break;
+	}
+
+	switch (cmd) {
+	case BMA_IOCTL_INIT:
+		ret = BMA_Init();
+		if (ret < 0)
+			return ret;
+		break;
+	case BMA_IOCTL_READ:
+		if (rwbuf[0] < 1)
+			return -EINVAL;
+		break;
+	case BMA_IOCTL_WRITE:
+		if (rwbuf[0] < 2)
+			return -EINVAL;
+		break;
+	case BMA_IOCTL_WRITE_CALI_VALUE:
+		pdata->gs_kvalue = kbuf;
+		printk(KERN_INFO "%s: Write calibration value: 0x%X\n",
+			__func__, pdata->gs_kvalue);
+		break;
+	case BMA_IOCTL_READ_ACCELERATION:
+		ret = BMA_TransRBuff(&buf[0]);
+		if (ret < 0)
+			return ret;
+		break;
+	case BMA_IOCTL_READ_CALI_VALUE:
+		if ((pdata->gs_kvalue & (0x67 << 24)) != (0x67 << 24)) {
+			rwbuf[0] = 0;
+			rwbuf[1] = 0;
+			rwbuf[2] = 0;
+		} else {
+			rwbuf[0] = (pdata->gs_kvalue >> 16) & 0xFF;
+			rwbuf[1] = (pdata->gs_kvalue >>  8) & 0xFF;
+			rwbuf[2] =  pdata->gs_kvalue        & 0xFF;
+		}
+		DIF("%s: CALI(x, y, z) = (%d, %d, %d)\n",
+			__func__, rwbuf[0], rwbuf[1], rwbuf[2]);
+		break;
+	case BMA_IOCTL_SET_MODE:
+		BMA_set_mode(rwbuf[0]);
+		break;
+	case BMA_IOCTL_GET_INT:
+		temp = BMA_GET_INT();
+		break;
+	case BMA_IOCTL_GET_CHIP_LAYOUT:
+		if (pdata)
+			temp = pdata->chip_layout;
+		break;
+	case BMA_IOCTL_GET_CALI_MODE:
+		if (pdata)
+			temp = pdata->calibration_mode;
+		break;
+	case BMA_IOCTL_SET_CALI_MODE:
+		if (pdata)
+			pdata->calibration_mode = rwbuf[0];
+		break;
+	case BMA_IOCTL_GET_UPDATE_USER_CALI_DATA:
+		temp = update_user_calibrate_data;
+		break;
+	case BMA_IOCTL_SET_UPDATE_USER_CALI_DATA:
+		update_user_calibrate_data = rwbuf[0];
+		break;
+
+	default:
+		return -ENOTTY;
+	}
+
+	switch (cmd) {
+	case BMA_IOCTL_READ:
+		break;
+	case BMA_IOCTL_READ_ACCELERATION:
+		if (copy_to_user(argp, &buf, sizeof(buf)))
+			return -EFAULT;
+		break;
+	case BMA_IOCTL_READ_CALI_VALUE:
+		if (copy_to_user(argp, &rwbuf, sizeof(rwbuf)))
+			return -EFAULT;
+		break;
+	case BMA_IOCTL_GET_INT:
+		if (copy_to_user(argp, &temp, sizeof(temp)))
+			return -EFAULT;
+		break;
+	case BMA_IOCTL_GET_CHIP_LAYOUT:
+		if (copy_to_user(argp, &temp, sizeof(temp)))
+			return -EFAULT;
+		break;
+	case BMA_IOCTL_GET_CALI_MODE:
+		if (copy_to_user(argp, &temp, sizeof(temp)))
+			return -EFAULT;
+		break;
+	case BMA_IOCTL_GET_UPDATE_USER_CALI_DATA:
+		if (copy_to_user(argp, &temp, sizeof(temp)))
+			return -EFAULT;
+		break;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+#ifdef EARLY_SUSPEND_BMA
+
+static void bma250_early_suspend(struct early_suspend *handler)
+{
+	if (!atomic_read(&PhoneOn_flag))
+		BMA_set_mode(bma250_MODE_SUSPEND);
+	else
+		printk(KERN_DEBUG "bma250_early_suspend: PhoneOn_flag is set\n");
+}
+
+static void bma250_late_resume(struct early_suspend *handler)
+{
+	BMA_set_mode(bma250_MODE_NORMAL);
+}
+
+#else 
+
+static int bma250_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+	BMA_set_mode(bma250_MODE_SUSPEND);
+
+	return 0;
+}
+
+static int bma250_resume(struct i2c_client *client)
+{
+	BMA_set_mode(bma250_MODE_NORMAL);
+	return 0;
+}
+#endif 
+
+static ssize_t bma250_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+	s += sprintf(s, "%d\n", atomic_read(&PhoneOn_flag));
+	return s - buf;
+}
+
+static ssize_t bma250_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	if (count == (strlen("enable") + 1) &&
+	   strncmp(buf, "enable", strlen("enable")) == 0) {
+		atomic_set(&PhoneOn_flag, 1);
+		printk(KERN_DEBUG "bma250_store: PhoneOn_flag=%d\n",
+			atomic_read(&PhoneOn_flag));
+		return count;
+	}
+	if (count == (strlen("disable") + 1) &&
+	   strncmp(buf, "disable", strlen("disable")) == 0) {
+		atomic_set(&PhoneOn_flag, 0);
+		printk(KERN_DEBUG "bma250_store: PhoneOn_flag=%d\n",
+			atomic_read(&PhoneOn_flag));
+		return count;
+	}
+	E("bma250_store: invalid argument\n");
+	return -EINVAL;
+
+}
+
+static DEVICE_ACCESSORY_ATTR(PhoneOnOffFlag, 0664, \
+	bma250_show, bma250_store);
+
+static ssize_t debug_flag_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+	char buffer, range = -1, bandwidth = -1, mode = -1;
+	int ret;
+
+	buffer = bma250_BW_SEL_REG;
+	ret = BMA_I2C_RxData(&buffer, 1);
+	if (ret < 0)
+		return -1;
+	bandwidth = (buffer & 0x1F);
+
+	buffer = bma250_RANGE_SEL_REG;
+	ret = BMA_I2C_RxData(&buffer, 1);
+	if (ret < 0)
+		return -1;
+	range = (buffer & 0xF);
+
+	buffer = bma250_MODE_CTRL_REG;
+	ret = BMA_I2C_RxData(&buffer, 1);
+	if (ret < 0)
+		return -1;
+	mode = ((buffer & 0x80) >> 7);
+
+	s += sprintf(s, "debug_flag = %d, range = 0x%x, bandwidth = 0x%x, "
+		"mode = 0x%x\n", debug_flag, range, bandwidth, mode);
+
+	return s - buf;
+}
+static ssize_t debug_flag_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	debug_flag = -1;
+	sscanf(buf, "%d", &debug_flag);
+
+	return count;
+
+}
+
+static DEVICE_ACCESSORY_ATTR(debug_en, 0664, \
+	debug_flag_show, debug_flag_store);
+
+int bma250_registerAttr(void)
+{
+	int ret;
+	struct class *htc_accelerometer_class;
+	struct device *accelerometer_dev;
+
+	htc_accelerometer_class = class_create(THIS_MODULE,
+					"htc_accelerometer");
+	if (IS_ERR(htc_accelerometer_class)) {
+		ret = PTR_ERR(htc_accelerometer_class);
+		htc_accelerometer_class = NULL;
+		goto err_create_class;
+	}
+
+	accelerometer_dev = device_create(htc_accelerometer_class,
+				NULL, 0, "%s", "accelerometer");
+	if (unlikely(IS_ERR(accelerometer_dev))) {
+		ret = PTR_ERR(accelerometer_dev);
+		accelerometer_dev = NULL;
+		goto err_create_accelerometer_device;
+	}
+
+	
+	ret = device_create_file(accelerometer_dev, &dev_attr_PhoneOnOffFlag);
+	if (ret)
+		goto err_create_accelerometer_device_file;
+
+	
+	ret = device_create_file(accelerometer_dev, &dev_attr_debug_en);
+	if (ret)
+		goto err_create_accelerometer_debug_en_device_file;
+
+	return 0;
+
+err_create_accelerometer_debug_en_device_file:
+	device_remove_file(accelerometer_dev, &dev_attr_PhoneOnOffFlag);
+err_create_accelerometer_device_file:
+	device_unregister(accelerometer_dev);
+err_create_accelerometer_device:
+	class_destroy(htc_accelerometer_class);
+err_create_class:
+
+	return ret;
+}
+
+static const struct file_operations bma_fops = {
+	.owner = THIS_MODULE,
+	.open = bma_open,
+	.release = bma_release,
+	
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = bma_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = bma_ioctl,
+#endif
+};
+
+static struct miscdevice bma_device = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "bma150",
+	.fops = &bma_fops,
+};
+
+int bma250_probe(struct i2c_client *client, const struct i2c_device_id *id)
+{
+	struct bma250_data *bma;
+	char buffer[2];
+	int err = 0;
+
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		err = -ENODEV;
+		goto exit_check_functionality_failed;
+	}
+
+	bma = kzalloc(sizeof(struct bma250_data), GFP_KERNEL);
+	if (!bma) {
+		err = -ENOMEM;
+		goto exit_alloc_data_failed;
+	}
+
+	i2c_set_clientdata(client, bma);
+
+	pdata = client->dev.platform_data;
+	if (pdata == NULL) {
+		E("bma250_init_client: platform data is NULL\n");
+		goto exit_platform_data_null;
+	}
+
+	pdata->gs_kvalue = gs_kvalue;
+	printk(KERN_INFO "BMA250 G-sensor I2C driver: gs_kvalue = 0x%X\n",
+		pdata->gs_kvalue);
+
+	this_client = client;
+
+	buffer[0] = bma250_CHIP_ID_REG;
+	err = BMA_I2C_RxData(buffer, 1);
+	if (err < 0)
+		goto exit_wrong_ID;
+	D("%s: CHIP ID = 0x%02x\n", __func__, buffer[0]);
+	if ((buffer[0] != 0x3) && (buffer[0] != 0xF9)) {
+		E("Wrong chip ID of BMA250 or BMA250E!!\n");
+		goto exit_wrong_ID;
+	}
+
+	err = BMA_Init();
+	if (err < 0) {
+		E("bma250_probe: bma_init failed\n");
+		goto exit_init_failed;
+	}
+
+	err = misc_register(&bma_device);
+	if (err) {
+		E("bma250_probe: device register failed\n");
+		goto exit_misc_device_register_failed;
+	}
+
+#ifdef EARLY_SUSPEND_BMA
+	bma->early_suspend.suspend = bma250_early_suspend;
+	bma->early_suspend.resume = bma250_late_resume;
+	register_early_suspend(&bma->early_suspend);
+#endif
+
+	err = bma250_registerAttr();
+	if (err) {
+		E("%s: set spi_bma150_registerAttr fail!\n", __func__);
+		goto err_registerAttr;
+	}
+	D("%s: I2C retry 10 times version. OK\n", __func__);
+	debug_flag = 0;
+
+	return 0;
+
+err_registerAttr:
+exit_misc_device_register_failed:
+exit_init_failed:
+exit_wrong_ID:
+exit_platform_data_null:
+	kfree(bma);
+exit_alloc_data_failed:
+exit_check_functionality_failed:
+	return err;
+}
+
+static int bma250_remove(struct i2c_client *client)
+{
+	struct bma250_data *bma = i2c_get_clientdata(client);
+	kfree(bma);
+	return 0;
+}
+
+static const struct i2c_device_id bma250_id[] = {
+	{ BMA250_I2C_NAME, 0 },
+	{ }
+};
+
+static struct i2c_driver bma250_driver = {
+	.probe = bma250_probe,
+	.remove = bma250_remove,
+	.id_table	= bma250_id,
+
+#ifndef EARLY_SUSPEND_BMA
+	.suspend = bma250_suspend,
+	.resume = bma250_resume,
+#endif
+	.driver = {
+		   .name = BMA250_I2C_NAME,
+		   },
+};
+
+static int __init bma250_init(void)
+{
+	printk(KERN_INFO "BMA250 G-sensor driver: init\n");
+	return i2c_add_driver(&bma250_driver);
+}
+
+static void __exit bma250_exit(void)
+{
+	i2c_del_driver(&bma250_driver);
+}
+
+module_init(bma250_init);
+module_exit(bma250_exit);
+
+MODULE_DESCRIPTION("BMA250 G-sensor driver");
+MODULE_LICENSE("GPL");
+
diff --git a/drivers/input/misc/cm3629.c b/drivers/input/misc/cm3629.c
new file mode 100644
index 0000000..67d3c5c
--- /dev/null
+++ b/drivers/input/misc/cm3629.c
@@ -0,0 +1,2665 @@
+/* drivers/i2c/chips/cm3629.c - cm3629 optical sensors driver
+ *
+ * Copyright (C) 2010 HTC, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/delay.h>
+#include <linux/earlysuspend.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/workqueue.h>
+#include <linux/irq.h>
+#include <linux/errno.h>
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/miscdevice.h>
+#include <linux/lightsensor.h>
+#include <linux/slab.h>
+#include <asm/uaccess.h>
+#include <asm/mach-types.h>
+#include <linux/cm3629.h>
+#include <linux/pl_sensor.h>
+#include <linux/capella_cm3602.h>
+#include <asm/setup.h>
+#include <linux/wakelock.h>
+#include <linux/jiffies.h>
+#include <mach/board.h>
+
+#define D(x...) pr_info(x)
+
+#define I2C_RETRY_COUNT 10
+
+#define POLLING_PROXIMITY 1
+#define NO_IGNORE_BOOT_MODE 1
+
+#define NEAR_DELAY_TIME ((100 * HZ) / 1000)
+
+#ifdef POLLING_PROXIMITY
+#define POLLING_DELAY		200
+#define TH_ADD			10
+#endif
+static int record_init_fail = 0;
+static void sensor_irq_do_work(struct work_struct *work);
+static DECLARE_WORK(sensor_irq_work, sensor_irq_do_work);
+
+#ifdef POLLING_PROXIMITY
+static void polling_do_work(struct work_struct *w);
+static DECLARE_DELAYED_WORK(polling_work, polling_do_work);
+#endif
+
+static uint8_t sensor_chipId[3] = {0};
+static void report_near_do_work(struct work_struct *w);
+static DECLARE_DELAYED_WORK(report_near_work, report_near_do_work);
+static int inter_error = 0;
+static int is_probe_success;
+
+struct cm3629_info {
+	struct class *cm3629_class;
+	struct device *ls_dev;
+	struct device *ps_dev;
+
+	struct input_dev *ls_input_dev;
+	struct input_dev *ps_input_dev;
+
+	struct early_suspend early_suspend;
+	struct i2c_client *i2c_client;
+	struct workqueue_struct *lp_wq;
+
+	int model;
+
+	int intr_pin;
+
+	int als_enable;
+
+	int ps_enable;
+	int ps_irq_flag;
+	int led;
+
+	uint16_t *adc_table;
+	uint16_t cali_table[10];
+	int irq;
+
+	int ls_calibrate;
+
+	int (*power)(int, uint8_t); 
+	int (*lpm_power)(uint8_t); 
+	uint32_t als_kadc;
+	uint32_t als_gadc;
+	uint16_t golden_adc;
+
+	struct wake_lock ps_wake_lock;
+	int psensor_opened;
+	int lightsensor_opened;
+	uint16_t cm3629_slave_address;
+	uint8_t ps_select;
+	uint8_t ps1_thd_set;
+	uint8_t ps1_thh_diff;
+	uint8_t ps2_thd_set;
+	uint8_t original_ps_thd_set;
+	int current_level;
+	uint16_t current_adc;
+	
+	uint8_t inte_ps1_canc;
+	uint8_t inte_ps2_canc;
+	uint8_t ps_conf1_val;
+	uint8_t ps_conf2_val;
+	uint8_t ps_conf1_val_from_board;
+	uint8_t ps_conf2_val_from_board;
+	uint8_t ps_conf3_val;
+	uint8_t ps_calibration_rule; 
+	int ps_pocket_mode;
+
+	unsigned long j_start;
+	unsigned long j_end;
+	int mfg_mode;
+
+	uint8_t *mapping_table;
+	uint8_t mapping_size;
+	uint8_t ps_base_index;
+
+	uint8_t ps1_thd_no_cal;
+	uint8_t ps1_thd_with_cal;
+	uint8_t ps2_thd_no_cal;
+	uint8_t ps2_thd_with_cal;
+	uint8_t enable_polling_ignore;
+	uint8_t ls_cmd;
+	uint8_t ps1_adc_offset;
+	uint8_t ps2_adc_offset;
+	uint8_t ps_debounce;
+	uint16_t ps_delay_time;
+	unsigned int no_need_change_setting;
+	int ps_th_add;
+	uint8_t dark_level;
+};
+
+static uint8_t ps1_canc_set;
+static uint8_t ps2_canc_set;
+static uint8_t ps1_offset_adc;
+static uint8_t ps2_offset_adc;
+static struct cm3629_info *lp_info;
+int enable_cm3629_log;
+int f_cm3629_level = -1;
+static struct mutex als_enable_mutex, als_disable_mutex, als_get_adc_mutex;
+static struct mutex ps_enable_mutex;
+static int ps_hal_enable, ps_drv_enable;
+static int lightsensor_enable(struct cm3629_info *lpi);
+static int lightsensor_disable(struct cm3629_info *lpi);
+static void psensor_initial_cmd(struct cm3629_info *lpi);
+static int ps_near;
+static int pocket_mode_flag, psensor_enable_by_touch;
+#if (0)
+static int I2C_RxData(uint16_t slaveAddr, uint8_t *rxData, int length)
+{
+	uint8_t loop_i;
+	struct cm3629_info *lpi = lp_info;
+
+	struct i2c_msg msgs[] = {
+		{
+		 .addr = slaveAddr,
+		 .flags = I2C_M_RD,
+		 .len = length,
+		 .buf = rxData,
+		 },
+	};
+
+	for (loop_i = 0; loop_i < I2C_RETRY_COUNT; loop_i++) {
+
+		if (i2c_transfer(lp_info->i2c_client->adapter, msgs, 1) > 0)
+			break;
+
+		
+
+		D("[PS][cm3629 warning] %s, i2c err, slaveAddr 0x%x ISR gpio %d , record_init_fail %d \n",
+				__func__, slaveAddr, lpi->intr_pin, record_init_fail);
+
+		msleep(10);
+	}
+	if (loop_i >= I2C_RETRY_COUNT) {
+		printk(KERN_ERR "[PS_ERR][cm3629 error] %s retry over %d\n",
+			__func__, I2C_RETRY_COUNT);
+		return -EIO;
+	}
+
+	return 0;
+}
+#endif
+
+static int I2C_RxData_2(char *rxData, int length)
+{
+	uint8_t loop_i;
+	struct cm3629_info *lpi = lp_info;
+
+	struct i2c_msg msgs[] = {
+		{
+		 .addr = lp_info->i2c_client->addr,
+		 .flags = 0,
+		 .len = 1,
+		 .buf = rxData,
+		 },
+		{
+		 .addr = lp_info->i2c_client->addr,
+		 .flags = I2C_M_RD,
+		 .len = length,
+		 .buf = rxData,
+		 },
+	};
+
+	for (loop_i = 0; loop_i < I2C_RETRY_COUNT; loop_i++) {
+		if (i2c_transfer(lp_info->i2c_client->adapter, msgs, 2) > 0)
+			break;
+
+		D("[PS][cm3629 warning] %s, i2c err, ISR gpio %d\n",
+				__func__, lpi->intr_pin);
+		msleep(10);
+	}
+
+	if (loop_i >= I2C_RETRY_COUNT) {
+		printk(KERN_ERR "[PS_ERR][cm3629 error] %s retry over %d\n",
+			__func__, I2C_RETRY_COUNT);
+		return -EIO;
+	}
+
+	return 0;
+}
+static int I2C_TxData(uint16_t slaveAddr, uint8_t *txData, int length)
+{
+	uint8_t loop_i;
+	struct cm3629_info *lpi = lp_info;
+	struct i2c_msg msg[] = {
+		{
+		 .addr = slaveAddr,
+		 .flags = 0,
+		 .len = length,
+		 .buf = txData,
+		 },
+	};
+
+	for (loop_i = 0; loop_i < I2C_RETRY_COUNT; loop_i++) {
+		if (i2c_transfer(lp_info->i2c_client->adapter, msg, 1) > 0)
+			break;
+
+		D("[PS][cm3629 warning] %s, i2c err, slaveAddr 0x%x, register 0x%x, value 0x%x, ISR gpio%d, record_init_fail %d\n",
+				__func__, slaveAddr, txData[0], txData[1], lpi->intr_pin, record_init_fail);
+
+		msleep(10);
+	}
+
+	if (loop_i >= I2C_RETRY_COUNT) {
+		printk(KERN_ERR "[PS_ERR][cm3629 error] %s retry over %d\n",
+			__func__, I2C_RETRY_COUNT);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int _cm3629_I2C_Read2(uint16_t slaveAddr,
+	uint8_t cmd, uint8_t *pdata, int length)
+{
+	char buffer[3] = {0};
+	int ret = 0, i;
+
+	if (pdata == NULL)
+		return -EFAULT;
+
+	if (length > 2) {
+		pr_err(
+			"[PS_ERR][cm3629 error]%s: length %d> 2: \n",
+			__func__, length);
+		return ret;
+	}
+	buffer[0] = cmd;
+	ret = I2C_RxData_2(buffer, length);
+	if (ret < 0) {
+		pr_err(
+			"[PS_ERR][cm3629 error]%s: I2C_RxData fail, slave addr: 0x%x\n",
+			__func__, slaveAddr);
+		return ret;
+	}
+
+	for (i = 0; i < length; i++) {
+		*(pdata+i) = buffer[i];
+	}
+#if 0
+	
+	printk(KERN_DEBUG "[cm3629] %s: I2C_RxData[0x%x] = 0x%x\n",
+		__func__, slaveAddr, buffer);
+#endif
+	return ret;
+}
+
+static int _cm3629_I2C_Write2(uint16_t SlaveAddress,
+				uint8_t cmd, uint8_t *data, int length)
+{
+	char buffer[3];
+	int ret = 0;
+#if 0
+	
+	printk(KERN_DEBUG
+	"[cm3629] %s: _cm3629_I2C_Write_Byte[0x%x, 0x%x, 0x%x]\n",
+		__func__, SlaveAddress, cmd, data);
+#endif
+	if (length > 3) {
+		pr_err(
+			"[PS_ERR][cm3629 error]%s: length %d> 2: \n",
+			__func__, length);
+		return ret;
+	}
+
+	buffer[0] = cmd;
+	buffer[1] = *data;
+	buffer[2] = *(data+1);
+	ret = I2C_TxData(SlaveAddress, buffer, length);
+	if (ret < 0) {
+		pr_err("[PS_ERR][cm3629 error]%s: I2C_TxData fail\n", __func__);
+		return -EIO;
+	}
+
+	return ret;
+}
+#if 0
+static int _cm3629_I2C_Read_Byte(uint16_t slaveAddr, uint8_t *pdata)
+{
+	uint8_t buffer = 0;
+	int ret = 0;
+
+	if (pdata == NULL)
+		return -EFAULT;
+	buffer = *pdata;
+	ret = I2C_RxData(slaveAddr, &buffer, 1);
+	if (ret < 0) {
+		pr_err(
+			"[CM3629_ error]%s: I2C_RxData fail, slave addr: 0x%x\n",
+			__func__, slaveAddr);
+		return ret;
+	}
+
+	*pdata = buffer;
+#if 0
+	
+	printk(KERN_DEBUG "[CM3629_] %s: I2C_RxData[0x%x] = 0x%x\n",
+		__func__, slaveAddr, buffer);
+#endif
+	return ret;
+}
+static int _cm3629_I2C_Write_Byte(uint16_t SlaveAddress,
+				uint8_t cmd, uint8_t data)
+{
+	char buffer[2];
+	int ret = 0;
+#if 0
+	
+	printk(KERN_DEBUG
+	"[cm3629] %s: _cm3629_I2C_Write_Byte[0x%x, 0x%x, 0x%x]\n",
+		__func__, SlaveAddress, cmd, data);
+#endif
+	buffer[0] = cmd;
+	buffer[1] = data;
+	ret = I2C_TxData(SlaveAddress, buffer, 2);
+	if (ret < 0) {
+		pr_err("[PS_ERR][cm3629 error]%s: I2C_TxData fail\n", __func__);
+		return -EIO;
+	}
+
+	return ret;
+}
+#endif
+static int sensor_lpm_power(int enable)
+{
+	struct cm3629_info *lpi = lp_info;
+
+	if (lpi->lpm_power)
+		lpi->lpm_power(enable);
+
+	return 0;
+}
+static int get_ls_adc_value(uint32_t *als_step, bool resume)
+{
+
+	struct cm3629_info *lpi = lp_info;
+	uint8_t	lsb, msb;
+	int ret = 0;
+	char cmd[3];
+	char ls_cmd;
+
+	if (als_step == NULL)
+		return -EFAULT;
+
+	if (resume) {
+		if (sensor_chipId[0] != 0x29)
+			ls_cmd = (CM3629_ALS_IT_80ms | CM3629_ALS_PERS_1);
+		else
+			ls_cmd = (CM3629_ALS_IT_50ms | CM3629_ALS_PERS_1);
+		D("[LS][cm3629] %s:resume %d\n",
+		__func__, resume);
+	} else
+		ls_cmd = (lpi->ls_cmd);
+
+	cmd[0] = ls_cmd;
+	cmd[1] = 0;
+	ret = _cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		ALS_config_cmd, cmd, 3);
+
+	if (ret < 0) {
+		pr_err(
+			"[LS][cm3629 error]%s: _cm3629_I2C_Write_Byte fail\n",
+			__func__);
+		return -EIO;
+	}
+
+	
+
+	ret = _cm3629_I2C_Read2(lpi->cm3629_slave_address, ALS_data, cmd, 2);
+	if (ret < 0) {
+		pr_err(
+			"[LS][cm3629 error]%s: _cm3629_I2C_Read_Byte  fail\n",
+			__func__);
+		return -EIO;
+	}
+	lsb = cmd[0];
+	msb = cmd[1];
+
+	*als_step = (uint32_t)msb;
+	*als_step <<= 8;
+	*als_step |= (uint32_t)lsb;
+
+	D("[LS][cm3629] %s: raw adc = 0x%X, ls_calibrate = %d\n",
+		__func__, *als_step, lpi->ls_calibrate);
+
+
+	if (!lpi->ls_calibrate) {
+		*als_step = (*als_step) * lpi->als_gadc / lpi->als_kadc;
+		if (*als_step > 0xFFFF)
+			*als_step = 0xFFFF;
+	}
+
+
+	return ret;
+}
+
+static int get_ps_adc_value(uint8_t *ps1_adc, uint8_t *ps2_adc)
+{
+	int ret = 0;
+	struct cm3629_info *lpi = lp_info;
+	char cmd[3];
+
+	if (ps1_adc == NULL || ps2_adc == NULL)
+		return -EFAULT;
+
+	ret = _cm3629_I2C_Read2(lpi->cm3629_slave_address, PS_data, cmd, 2);
+	if (ret < 0) {
+		pr_err("[PS_ERR][cm3629 error] %s: _cm3629_I2C_Read_Byte "
+		       "MSB fail\n", __func__);
+		return -EIO;
+	}
+
+	*ps1_adc = cmd[0];
+	*ps2_adc = cmd[1];
+	return ret;
+}
+
+static int set_lsensor_range(uint16_t low_thd, uint16_t high_thd)
+{
+	int ret = 0;
+	struct cm3629_info *lpi = lp_info;
+	char cmd[3] = {0};
+
+	uint8_t	high_msb;
+	uint8_t	high_lsb;
+	uint8_t	low_msb;
+	uint8_t	low_lsb;
+	D("[cm3629] %s: low_thd = 0x%X, high_thd = 0x%x \n",
+		__func__, low_thd, high_thd);
+	high_msb = (uint8_t) (high_thd >> 8);
+	high_lsb = (uint8_t) (high_thd & 0x00ff);
+	low_msb	 = (uint8_t) (low_thd >> 8);
+	low_lsb	 = (uint8_t) (low_thd & 0x00ff);
+
+	cmd[0] = high_lsb;
+	cmd[1] = high_msb;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		ALS_high_thd, cmd, 3);
+
+	cmd[0] = low_lsb;
+	cmd[1] = low_msb;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		ALS_low_thd, cmd, 3);
+	return ret;
+}
+
+static void report_near_do_work(struct work_struct *w)
+{
+	struct cm3629_info *lpi = lp_info;
+
+	D("[PS][cm3629]  %s: delay %dms, report proximity NEAR\n", __func__, lpi->ps_delay_time);
+
+	input_report_abs(lpi->ps_input_dev, ABS_DISTANCE, 0);
+	input_sync(lpi->ps_input_dev);
+	blocking_notifier_call_chain(&psensor_notifier_list, 2, NULL);
+}
+
+static void report_psensor_input_event(struct cm3629_info *lpi, int interrupt_flag)
+{
+	uint8_t ps_thd_set = 0;
+	uint8_t ps_adc = 0;
+	uint8_t ps1_adc = 0;
+	uint8_t ps2_adc = 0;
+	int val, ret = 0;
+	int index = 0;
+
+	if (interrupt_flag > 1 && lpi->ps_enable == 0) {
+		D("[PS][cm3629] P-sensor disable but intrrupt occur, "
+		  "record_init_fail %d.\n", record_init_fail);
+		return;
+	}
+
+	if (lpi->ps_debounce == 1 && lpi->mfg_mode != NO_IGNORE_BOOT_MODE)
+		cancel_delayed_work(&report_near_work);
+
+	lpi->j_end = jiffies;
+	
+
+	ret = get_ps_adc_value(&ps1_adc, &ps2_adc);
+	if (pocket_mode_flag == 1 || psensor_enable_by_touch == 1) {
+		D("[PS][cm3629] pocket_mode_flag: %d, psensor_enable_by_touch: %d", pocket_mode_flag, psensor_enable_by_touch);
+		while (index <= 10 && ps1_adc == 0) {
+			D("[PS][cm3629]ps1_adc = 0 retry");
+			get_ps_adc_value(&ps1_adc, &ps2_adc);
+			if(ps1_adc != 0) {
+				D("[PS][cm3629]retry work");
+				break;
+			}
+			mdelay(1);
+			index++;
+		}
+	}
+	if (lpi->ps_select == CM3629_PS2_ONLY) {
+		ps_thd_set = lpi->ps2_thd_set + 1;
+		ps_adc = ps2_adc;
+	} else {
+		if (lpi->ps1_thh_diff == 0)
+			ps_thd_set = lpi->ps1_thd_set + 1;
+		else
+			ps_thd_set = lpi->ps1_thd_set + lpi->ps1_thh_diff;
+		ps_adc = ps1_adc;
+	}
+	if (interrupt_flag == 0) {
+		if (ret == 0) {
+			val = (ps_adc >= ps_thd_set) ? 0 : 1;
+		} else {
+			val = 1;
+			ps_adc = 0;
+			D("[PS][cm3629] proximity i2c err, report %s, "
+			  "ps_adc=%d, record_init_fail %d\n",
+			  val ? "FAR" : "NEAR", ps_adc, record_init_fail);
+		}
+	} else {
+		val = (interrupt_flag == 2) ? 0 : 1;
+	}
+	ps_near = !val;
+
+	if (lpi->ps_debounce == 1 && lpi->mfg_mode != NO_IGNORE_BOOT_MODE) {
+		if (val == 0) {
+			D("[PS][cm3629] delay proximity %s, ps_adc=%d, High thd= %d, interrupt_flag %d\n",
+			  val ? "FAR" : "NEAR", ps_adc, ps_thd_set, interrupt_flag);
+			queue_delayed_work(lpi->lp_wq, &report_near_work,
+					msecs_to_jiffies(lpi->ps_delay_time));
+			return;
+		} else {
+			
+			input_report_abs(lpi->ps_input_dev, ABS_DISTANCE, -1);
+			input_sync(lpi->ps_input_dev);
+		}
+	}
+	D("[PS][cm3629] proximity %s, ps_adc=%d, , High thd= %d, interrupt_flag %d\n",
+	  val ? "FAR" : "NEAR", ps_adc, ps_thd_set, interrupt_flag);
+	if ((lpi->enable_polling_ignore == 1) && (val == 0) &&
+		(lpi->mfg_mode != NO_IGNORE_BOOT_MODE) &&
+	    (time_before(lpi->j_end, (lpi->j_start + NEAR_DELAY_TIME)))) {
+		D("[PS][cm3629] Ignore NEAR event\n");
+		lpi->ps_pocket_mode = 1;
+	} else {
+		
+		input_report_abs(lpi->ps_input_dev, ABS_DISTANCE, val);
+		input_sync(lpi->ps_input_dev);
+		blocking_notifier_call_chain(&psensor_notifier_list, val+2, NULL);
+	}
+}
+
+static void enable_als_interrupt(void)
+{
+	char cmd[3];
+	struct cm3629_info *lpi = lp_info;
+	int ret = 0;
+
+	cmd[0] = (lpi->ls_cmd | CM3629_ALS_INT_EN);
+	cmd[1] = 0;
+	ret = _cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		ALS_config_cmd, cmd, 3);
+	if (ret != 0) {
+		lpi->als_enable = 0;
+		D("[LS][cm3629] L-sensor i2c err, enable interrupt error\n");
+	} else
+		lpi->als_enable = 1;
+}
+
+static void report_lsensor_input_event(struct cm3629_info *lpi, bool resume)
+{
+	uint32_t adc_value = 0;
+	int level = 0, i, ret = 0;
+
+	mutex_lock(&als_get_adc_mutex);
+
+	ret = get_ls_adc_value(&adc_value, resume);
+	if (resume) {
+		if (sensor_chipId[0] != 0x29)
+			adc_value = adc_value*4;
+		else
+			adc_value = adc_value*8;
+	}
+	for (i = 0; i < 10; i++) {
+		if (adc_value <= (*(lpi->adc_table + i))) {
+			level = i;
+			if (*(lpi->adc_table + i))
+				break;
+		}
+		if (i == 9) {
+			level = i;
+			break;
+		}
+	}
+	ret = set_lsensor_range(((i == 0) || (adc_value == 0)) ? 0 :
+			*(lpi->cali_table + (i - 1)) + 1,
+		*(lpi->cali_table + i));
+
+	if (ret < 0)
+		printk(KERN_ERR "[LS][cm3629 error] %s fail\n", __func__);
+
+	if ((i == 0) || (adc_value == 0))
+		D("[LS][cm3629] %s: ADC=0x%03X, Level=%d, l_thd equal 0, h_thd = 0x%x \n",
+			__func__, adc_value, level, *(lpi->cali_table + i));
+	else
+		D("[LS][cm3629] %s: ADC=0x%03X, Level=%d, l_thd = 0x%x, h_thd = 0x%x \n",
+			__func__, adc_value, level, *(lpi->cali_table + (i - 1)) + 1, *(lpi->cali_table + i));
+
+	lpi->current_level = level;
+	lpi->current_adc = adc_value;
+	
+	if (f_cm3629_level >= 0) {
+		D("[LS][cm3629] L-sensor force level enable level=%d f_cm3629_level=%d\n", level, f_cm3629_level);
+		level = f_cm3629_level;
+	}
+	input_report_abs(lpi->ls_input_dev, ABS_MISC, level);
+	input_sync(lpi->ls_input_dev);
+	enable_als_interrupt();
+	mutex_unlock(&als_get_adc_mutex);
+
+}
+
+static void enable_ps_interrupt(char *ps_conf)
+{
+	struct cm3629_info *lpi = lp_info;
+	int ret;
+	char cmd[2] = {0};
+
+	lpi->ps_enable = 1;
+
+	cmd[0] = lpi->ps1_thd_set;
+	if (lpi->ps1_thh_diff == 0)
+		cmd[1] = lpi->ps1_thd_set + 1;
+	else
+		cmd[1] = lpi->ps1_thd_set + lpi->ps1_thh_diff;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		PS_1_thd, cmd, 3);
+
+	cmd[0] = lpi->ps2_thd_set;
+	cmd[1] = lpi->ps2_thd_set + 1;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		PS_2_thd, cmd, 3);
+
+	cmd[0] = ps_conf[2];
+	cmd[1] = CM3629_PS_255_STEPS;
+	ret = _cm3629_I2C_Write2(lpi->cm3629_slave_address,
+				 PS_config_ms, cmd, 3);
+
+	cmd[0] = ps_conf[0];
+	cmd[1] = ps_conf[1];
+	D("[PS][cm3629] %s, write cmd[0] = 0x%x, cmd[1] = 0x%x\n",
+		__func__, cmd[0], cmd[1]);
+	ret = _cm3629_I2C_Write2(lpi->cm3629_slave_address, PS_config, cmd, 3);
+
+	if (ret != 0) {
+		lpi->ps_enable = 0;
+		D("[PS][cm3629] P-sensor i2c err, enable interrupt error\n");
+	}
+	_cm3629_I2C_Read2(lpi->cm3629_slave_address, PS_config, cmd, 2);
+	D("[PS][cm3629] %s, read value => cmd[0] = 0x%x, cmd[1] = 0x%x\n", __func__, cmd[0], cmd[1]);
+}
+
+static void sensor_irq_do_work(struct work_struct *work)
+{
+	struct cm3629_info *lpi = lp_info;
+	uint8_t cmd[3];
+	uint8_t add = 0;
+
+	
+	wake_lock_timeout(&(lpi->ps_wake_lock), 3*HZ);
+	_cm3629_I2C_Read2(lpi->cm3629_slave_address, INT_FLAG, cmd, 2);
+	add = cmd[1];
+	
+	if ((add & CM3629_PS1_IF_AWAY) || (add & CM3629_PS1_IF_CLOSE) ||
+	    (add & CM3629_PS2_IF_AWAY) || (add & CM3629_PS2_IF_CLOSE)) {
+		inter_error = 0;
+		if ((add & CM3629_PS1_IF_AWAY) || (add & CM3629_PS2_IF_AWAY))
+			report_psensor_input_event(lpi, 1);
+		else
+			report_psensor_input_event(lpi, 2);
+	} else if (((add & CM3629_ALS_IF_L) == CM3629_ALS_IF_L) ||
+		     ((add & CM3629_ALS_IF_H) == CM3629_ALS_IF_H)) {
+		inter_error = 0;
+		report_lsensor_input_event(lpi, 0);
+	} else {
+		if (inter_error < 10) {
+			D("[PS][cm3629 warning]%s unkown interrupt: 0x%x!\n",
+			__func__, add);
+			inter_error++ ;
+		} else {
+                	pr_err("[PS][cm3629 error]%s error: unkown interrupt: 0x%x!\n",
+	                __func__, add);
+		}
+	}
+	enable_irq(lpi->irq);
+}
+
+#ifdef POLLING_PROXIMITY
+static uint8_t mid_value(uint8_t value[], uint8_t size)
+{
+	int i = 0, j = 0;
+	uint16_t temp = 0;
+
+	if (size < 3)
+		return 0;
+
+	for (i = 0; i < (size - 1); i++)
+		for (j = (i + 1); j < size; j++)
+			if (value[i] > value[j]) {
+				temp = value[i];
+				value[i] = value[j];
+				value[j] = temp;
+			}
+	return value[((size - 1) / 2)];
+}
+
+static int get_stable_ps_adc_value(uint8_t *ps_adc1, uint8_t *ps_adc2)
+{
+	int ret = 0;
+	int i = 0;
+	uint8_t mid_adc1 = 0;
+	uint8_t mid_adc2 = 0;
+	uint8_t adc1[3] = {0, 0, 0};
+	uint8_t adc2[3] = {0, 0, 0};
+
+	for (i = 0; i < 3; i++) {
+		ret = get_ps_adc_value(&adc1[i], &adc2[i]);
+		if (ret < 0) {
+			pr_err("[PS_ERR][cm3629 error]%s: get_ps_adc_value\n",
+				__func__);
+			return -EIO;
+		}
+	}
+
+	mid_adc1 = mid_value(adc1, 3);
+	mid_adc2 = mid_value(adc2, 3);
+
+	*ps_adc1 = mid_adc1;
+	*ps_adc2 = mid_adc2;
+
+	return 0;
+}
+
+static void polling_do_work(struct work_struct *w)
+{
+	struct cm3629_info *lpi = lp_info;
+	uint8_t ps_adc1 = 0;
+	uint8_t ps_adc2 = 0;
+	int i = 0;
+	int ret = 0;
+	char cmd[3];
+
+	
+	if (lpi->ps_enable == 0)
+		return;
+
+	ret = get_stable_ps_adc_value(&ps_adc1, &ps_adc2);
+
+	if ((ps_adc1 == 0) || (ret < 0)) {
+		queue_delayed_work(lpi->lp_wq, &polling_work,
+			msecs_to_jiffies(POLLING_DELAY));
+		return;
+	}
+
+	for (i = lpi->ps_base_index; i >= 1; i--) {
+		if (ps_adc1 > lpi->mapping_table[i])
+			break;
+		else if ((ps_adc1 > lpi->mapping_table[(i-1)]) &&
+		    (ps_adc1 <= lpi->mapping_table[i])) {
+			lpi->ps_base_index = (i-1);
+
+			if (i == (lpi->mapping_size - 1))
+				lpi->ps1_thd_set = 0xFF;
+			else
+				lpi->ps1_thd_set = (lpi->mapping_table[i] +
+						   lpi->ps_th_add);
+
+			if (lpi->ps1_thd_set <= ps_adc1)
+				lpi->ps1_thd_set = 0xFF;
+
+			
+			cmd[0] = lpi->ps1_thd_set;
+			if (lpi->ps1_thh_diff == 0)
+				cmd[1] = lpi->ps1_thd_set + 1;
+			else
+				cmd[1] = lpi->ps1_thd_set + lpi->ps1_thh_diff;
+
+			if (cmd[1] < cmd[0])
+				cmd[1] = cmd[0];
+
+			_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+				PS_1_thd, cmd, 3);
+			D("[PS][cm3629] SET THD: lpi->ps1_thd_set = %d,"
+				" cmd[0] = 0x%x, cmd[1] = 0x%x\n",
+				lpi->ps1_thd_set, cmd[0], cmd[1]);
+			break;
+		}
+	}
+
+	queue_delayed_work(lpi->lp_wq, &polling_work,
+		msecs_to_jiffies(POLLING_DELAY));
+}
+#endif
+
+static irqreturn_t cm3629_irq_handler(int irq, void *data)
+{
+	struct cm3629_info *lpi = data;
+
+	disable_irq_nosync(lpi->irq);
+	if (enable_cm3629_log)
+		D("[PS][cm3629] %s\n", __func__);
+
+	queue_work(lpi->lp_wq, &sensor_irq_work);
+
+	return IRQ_HANDLED;
+}
+
+static int als_power(int enable)
+{
+	struct cm3629_info *lpi = lp_info;
+
+	if (lpi->power)
+		lpi->power(LS_PWR_ON, enable);
+
+	return 0;
+}
+
+static void ls_initial_cmd(struct cm3629_info *lpi)
+{
+	char cmd[3] = {0};
+
+	cmd[0] = (lpi->ls_cmd | CM3629_ALS_SD);
+	cmd[1] = 0;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		ALS_config_cmd, cmd, 3);
+
+	_cm3629_I2C_Read2(lpi->cm3629_slave_address, ALS_config_cmd, cmd, 2);
+	D("[LS][cm3629] %s, cmd[0] = 0x%x, cmd[1] = 0x%x\n", __func__, cmd[0], cmd[1]);
+}
+
+static void psensor_intelligent_cancel_cmd(struct cm3629_info *lpi)
+{
+	char cmd[2] = {0};
+
+	cmd[0] = lpi->inte_ps1_canc;
+	cmd[1] = lpi->inte_ps2_canc;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address, PS_CANC, cmd, 3);
+}
+
+static void psensor_initial_cmd(struct cm3629_info *lpi)
+{
+	char cmd[2] = {0};
+
+	cmd[0] = lpi->ps_conf1_val;
+	cmd[1] = lpi->ps_conf2_val;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address, PS_config, cmd, 3);
+
+	cmd[0] = lpi->ps_conf3_val;
+	cmd[1] = CM3629_PS_255_STEPS;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address, PS_config_ms, cmd, 3);
+
+	cmd[0] = lpi->ps1_thd_set;
+	if (lpi->ps1_thh_diff == 0)
+		cmd[1] = lpi->ps1_thd_set + 1;
+	else
+		cmd[1] = lpi->ps1_thd_set + lpi->ps1_thh_diff;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		PS_1_thd, cmd, 3);
+
+	cmd[0] = lpi->ps2_thd_set;
+	cmd[1] = lpi->ps2_thd_set + 1;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		PS_2_thd, cmd, 3);
+
+	psensor_intelligent_cancel_cmd(lpi);
+
+	D("[PS][cm3629] %s, finish\n", __func__);
+}
+
+static int psensor_enable(struct cm3629_info *lpi)
+{
+	int ret;
+	char ps_conf[3];
+	char cmd[2];
+#ifdef POLLING_PROXIMITY
+	uint8_t ps_adc1 = 0;
+	uint8_t ps_adc2 = 0;
+#endif
+	mutex_lock(&ps_enable_mutex);
+
+	D("[PS][cm3629] %s +\n", __func__);
+	if (lpi->ps_enable) {
+		D("[PS][cm3629] %s: already enabled %d\n", __func__, lpi->ps_enable);
+		lpi->ps_enable++;
+		mutex_unlock(&ps_enable_mutex);
+		return 0;
+	}
+	sensor_lpm_power(0);
+	blocking_notifier_call_chain(&psensor_notifier_list, 1, NULL);
+	lpi->j_start = jiffies;
+	
+
+	
+	input_report_abs(lpi->ps_input_dev, ABS_DISTANCE, -1);
+	input_sync(lpi->ps_input_dev);
+
+	psensor_initial_cmd(lpi);
+
+	if (lpi->enable_polling_ignore == 1 &&
+		lpi->mfg_mode != NO_IGNORE_BOOT_MODE) {
+		
+		input_report_abs(lpi->ps_input_dev, ABS_DISTANCE, 1);
+		input_sync(lpi->ps_input_dev);
+		blocking_notifier_call_chain(&psensor_notifier_list, 1+2, NULL);
+	} else
+		report_psensor_input_event(lpi, 0);
+
+	cmd[0] = lpi->ps_conf1_val | CM3629_PS1_SD | CM3629_PS2_SD;
+	cmd[1] = lpi->ps_conf2_val;
+	ret = _cm3629_I2C_Write2(lpi->cm3629_slave_address,
+				PS_config, cmd, 3);
+
+	psensor_intelligent_cancel_cmd(lpi);
+
+	ps_conf[0] = lpi->ps_conf1_val;
+	ps_conf[1] = lpi->ps_conf2_val;
+	ps_conf[2] = lpi->ps_conf3_val;
+
+	if (lpi->ps_select == CM3629_PS2_ONLY)
+		ps_conf[1] = (lpi->ps_conf2_val | CM3629_PS2_INT_BOTH);
+	else if (lpi->ps_select == CM3629_PS1_ONLY)
+		ps_conf[1] = (lpi->ps_conf2_val | CM3629_PS1_INT_BOTH);
+
+	enable_ps_interrupt(ps_conf);
+
+	ret = irq_set_irq_wake(lpi->irq, 1);
+	if (ret < 0) {
+		pr_err(
+			"[PS][cm3629 error]%s: fail to enable irq %d as wake interrupt\n",
+			__func__, lpi->irq);
+		mutex_unlock(&ps_enable_mutex);
+		return ret;
+	}
+
+#ifdef POLLING_PROXIMITY
+	if (lpi->enable_polling_ignore == 1) {
+		if (lpi->mfg_mode != NO_IGNORE_BOOT_MODE) {
+			msleep(40);
+			ret = get_stable_ps_adc_value(&ps_adc1, &ps_adc2);
+			D("[PS][cm3629] INITIAL ps_adc1 = 0x%02X\n", ps_adc1);
+			if ((ret == 0) && (lpi->mapping_table != NULL) &&
+			    ((ps_adc1 >= lpi->ps1_thd_set - 1)))
+				queue_delayed_work(lpi->lp_wq, &polling_work,
+					msecs_to_jiffies(POLLING_DELAY));
+		}
+	}
+#endif
+	mutex_unlock(&ps_enable_mutex);
+	D("[PS][cm3629] %s -\n", __func__);
+	return ret;
+}
+
+static int psensor_disable(struct cm3629_info *lpi)
+{
+	int ret = -EIO;
+	char cmd[2];
+
+	mutex_lock(&ps_enable_mutex);
+
+	D("[PS][cm3629] %s %d\n", __func__, lpi->ps_enable);
+	if (lpi->ps_enable != 1) {
+		if (lpi->ps_enable > 1)
+			lpi->ps_enable--;
+		else
+			D("[PS][cm3629] %s: already disabled\n", __func__);
+		mutex_unlock(&ps_enable_mutex);
+		return 0;
+	}
+	lpi->ps_conf1_val = lpi->ps_conf1_val_from_board;
+	lpi->ps_conf2_val = lpi->ps_conf2_val_from_board;
+	lpi->ps_pocket_mode = 0;
+
+	ret = irq_set_irq_wake(lpi->irq, 0);
+	if (ret < 0) {
+		pr_err(
+			"[PS][cm3629 error]%s: fail to disable irq %d as wake interrupt\n",
+			__func__, lpi->irq);
+		mutex_unlock(&ps_enable_mutex);
+		return ret;
+	}
+
+	cmd[0] = lpi->ps_conf1_val | CM3629_PS1_SD | CM3629_PS2_SD;
+	cmd[1] = lpi->ps_conf2_val;
+	ret = _cm3629_I2C_Write2(lpi->cm3629_slave_address,
+				PS_config, cmd, 3);
+	if (ret < 0) {
+		pr_err("[PS][cm3629 error]%s: disable psensor fail\n", __func__);
+		mutex_unlock(&ps_enable_mutex);
+		return ret;
+	}
+
+	cmd[0] = lpi->ps_conf3_val;
+	cmd[1] = CM3629_PS_255_STEPS;
+	ret = _cm3629_I2C_Write2(lpi->cm3629_slave_address,
+				PS_config_ms, cmd, 3);
+
+	blocking_notifier_call_chain(&psensor_notifier_list, 0, NULL);
+	lpi->ps_enable = 0;
+
+#ifdef POLLING_PROXIMITY
+	if (lpi->enable_polling_ignore == 1 && lpi->mfg_mode != NO_IGNORE_BOOT_MODE) {
+		cancel_delayed_work(&polling_work);
+		lpi->ps_base_index = (lpi->mapping_size - 1);
+
+		lpi->ps1_thd_set = lpi->original_ps_thd_set;
+		
+		cmd[0] = lpi->ps1_thd_set;
+		if (lpi->ps1_thh_diff == 0)
+			cmd[1] = lpi->ps1_thd_set + 1;
+		else
+			cmd[1] = lpi->ps1_thd_set + lpi->ps1_thh_diff;
+		_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+			PS_1_thd, cmd, 3);
+	}
+#endif
+	mutex_unlock(&ps_enable_mutex);
+	D("[PS][cm3629] %s --%d\n", __func__, lpi->ps_enable);
+	return ret;
+}
+
+static int psensor_open(struct inode *inode, struct file *file)
+{
+	struct cm3629_info *lpi = lp_info;
+
+	D("[PS][cm3629] %s\n", __func__);
+
+	if (lpi->psensor_opened)
+		return -EBUSY;
+
+	lpi->psensor_opened = 1;
+
+	return 0;
+}
+
+static int psensor_release(struct inode *inode, struct file *file)
+{
+	struct cm3629_info *lpi = lp_info;
+
+	D("[PS][cm3629] %s\n", __func__);
+
+	lpi->psensor_opened = 0;
+
+	return ps_hal_enable ? psensor_disable(lpi) : 0 ;
+}
+
+static long psensor_ioctl(struct file *file, unsigned int cmd,
+			unsigned long arg)
+{
+	int val, err;
+	struct cm3629_info *lpi = lp_info;
+
+	D("[PS][cm3629] %s cmd %d\n", __func__, _IOC_NR(cmd));
+
+	switch (cmd) {
+	case CAPELLA_CM3602_IOCTL_ENABLE:
+		if (get_user(val, (unsigned long __user *)arg))
+			return -EFAULT;
+		if (val) {
+			err = psensor_enable(lpi);
+			if (!err)
+				ps_hal_enable = 1;
+			return err;
+		} else {
+			err = psensor_disable(lpi);
+			if (!err)
+				ps_hal_enable = 0;
+			return err;
+		}
+		break;
+	case CAPELLA_CM3602_IOCTL_GET_ENABLED:
+		return put_user(lpi->ps_enable, (unsigned long __user *)arg);
+		break;
+	default:
+		pr_err("[PS][cm3629 error]%s: invalid cmd %d\n",
+			__func__, _IOC_NR(cmd));
+		return -EINVAL;
+	}
+}
+
+static const struct file_operations psensor_fops = {
+	.owner = THIS_MODULE,
+	.open = psensor_open,
+	.release = psensor_release,
+	.unlocked_ioctl = psensor_ioctl
+};
+
+static struct miscdevice psensor_misc = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "cm3602",
+	.fops = &psensor_fops
+};
+
+static void lightsensor_set_kvalue(struct cm3629_info *lpi)
+{
+	if (!lpi) {
+		pr_err("[LS][cm3629 error]%s: ls_info is empty\n", __func__);
+		return;
+	}
+
+	D("[LS][cm3629] %s: ALS calibrated als_kadc=0x%x\n",
+			__func__, als_kadc);
+
+	if (als_kadc >> 16 == ALS_CALIBRATED)
+		lpi->als_kadc = als_kadc & 0xFFFF;
+	else {
+		lpi->als_kadc = 0;
+		D("[LS][cm3629] %s: no ALS calibrated\n", __func__);
+	}
+
+	if (lpi->als_kadc && lpi->golden_adc > 0) {
+		lpi->als_kadc = (lpi->als_kadc > 0) ?
+				lpi->als_kadc : lpi->golden_adc;
+		lpi->als_gadc = lpi->golden_adc;
+	} else {
+		lpi->als_kadc = 1;
+		lpi->als_gadc = 1;
+	}
+	D("[LS][cm3629] %s: als_kadc=0x%x, als_gadc=0x%x\n",
+		__func__, lpi->als_kadc, lpi->als_gadc);
+}
+
+static void psensor_set_kvalue(struct cm3629_info *lpi)
+{
+	uint8_t ps_conf1_val;
+
+	D("[PS][cm3629] %s: PS calibrated ps_kparam1 = 0x%04X, "
+	  "ps_kparam2 = 0x%04X\n", __func__, ps_kparam1, ps_kparam2);
+	ps_conf1_val = lpi->ps_conf1_val;
+	
+	if (ps_kparam1 >> 16 == PS_CALIBRATED) {
+		lpi->inte_ps1_canc = (uint8_t) (ps_kparam2 & 0xFF);
+		lpi->inte_ps2_canc = (uint8_t) ((ps_kparam2 >> 8) & 0xFF);
+		if (lpi->ps_calibration_rule == 3) {
+
+			if ((lpi->ps_conf1_val & CM3629_PS_IT_1_6T) == CM3629_PS_IT_1_6T) {
+				D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  CM3629_PS_IT_1_6T\n",
+				  __func__, lpi->ps_conf1_val);
+				lpi->ps_conf1_val = (lpi->ps_conf1_val & (~CM3629_PS_IT_1_6T));
+			} else if ((lpi->ps_conf1_val & CM3629_PS_IT_1_3T) == CM3629_PS_IT_1_3T) {
+				D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  CM3629_PS_IT_1_3T\n",
+				  __func__, lpi->ps_conf1_val);
+				lpi->ps_conf1_val = (lpi->ps_conf1_val & (~CM3629_PS_IT_1_3T));
+			} else if ((lpi->ps_conf1_val & CM3629_PS_IT_1T) == CM3629_PS_IT_1T) {
+				D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  CM3629_PS_IT_1T\n",
+				  __func__, lpi->ps_conf1_val);
+				lpi->ps_conf1_val = (lpi->ps_conf1_val & (~CM3629_PS_IT_1T));
+			} else
+				D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  2T or unknown\n",
+				  __func__, lpi->ps_conf1_val);
+
+			D("[PS][cm3629] %s: clear  lpi->ps_conf1_val  0x%x\n",
+				  __func__, lpi->ps_conf1_val);
+
+			if (((ps_kparam2 >> 16) & 0xFF) == 0)
+				lpi->ps_conf1_val = (lpi->ps_conf1_val | CM3629_PS_IT_1T);
+			else if (((ps_kparam2 >> 16) & 0xFF) == 0x1)
+				lpi->ps_conf1_val = (lpi->ps_conf1_val | CM3629_PS_IT_1_3T);
+			else if (((ps_kparam2 >> 16) & 0xFF) == 0x2)
+				lpi->ps_conf1_val = (lpi->ps_conf1_val | CM3629_PS_IT_1_6T);
+			else {
+				lpi->ps_conf1_val = ps_conf1_val;
+				D("[PS]%s: ((ps_kparam2 >> 16) & 0xFF)  = 0x%X is strange\n",
+				__func__, ((ps_kparam2 >> 16) & 0xFF));
+			}
+			D("[PS][cm3629] %s:   lpi->ps_conf1_val  0x%x\n",
+			  __func__, lpi->ps_conf1_val);
+		}
+		D("[PS][cm3629] %s: PS calibrated inte_ps1_canc = 0x%02X, "
+		  "inte_ps2_canc = 0x%02X, ((ps_kparam2 >> 16) & 0xFF) = 0x%X\n", __func__,
+		  lpi->inte_ps1_canc, lpi->inte_ps2_canc, ((ps_kparam2 >> 16) & 0xFF));
+	} else {
+		if (lpi->ps_calibration_rule >= 1) {
+			lpi->ps1_thd_set = lpi->ps1_thd_no_cal;
+			lpi->ps2_thd_set = lpi->ps2_thd_no_cal;
+			D("[PS][cm3629] %s: PS1_THD=%d, PS2_THD=%d, "
+			  "no calibration\n", __func__,
+			  lpi->ps1_thd_set, lpi->ps2_thd_set);
+		}
+		D("[PS][cm3629] %s: Proximity NOT calibrated\n", __func__);
+	}
+
+}
+
+static int lightsensor_update_table(struct cm3629_info *lpi)
+{
+	uint16_t data[10];
+	int i;
+	for (i = 0; i < 10; i++) {
+		if (*(lpi->adc_table + i) < 0xFFFF) {
+			data[i] = *(lpi->adc_table + i)
+					* lpi->als_kadc / lpi->als_gadc;
+		} else {
+			data[i] = *(lpi->adc_table + i);
+		}
+		D("[LS][cm3629] %s: Calibrated adc_table: data[%d], %x\n",
+			__func__, i, data[i]);
+	}
+	memcpy(lpi->cali_table, data, 20);
+	return 0;
+}
+
+static int lightsensor_enable(struct cm3629_info *lpi)
+{
+	int ret = 0;
+	char cmd[3] = {0};
+
+	mutex_lock(&als_enable_mutex);
+	sensor_lpm_power(0);
+	D("[LS][cm3629] %s\n", __func__);
+
+	if (sensor_chipId[0] != 0x29)
+		cmd[0] = (CM3629_ALS_IT_80ms | CM3629_ALS_PERS_1);
+	else
+		cmd[0] = (CM3629_ALS_IT_50ms | CM3629_ALS_PERS_1);
+
+	cmd[1] = 0;
+	ret = _cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		ALS_config_cmd, cmd, 3);
+	if (ret < 0)
+		pr_err(
+		"[LS][cm3629 error]%s: set auto light sensor fail\n",
+		__func__);
+	else {
+		if (lpi->mfg_mode != NO_IGNORE_BOOT_MODE)
+			msleep(160);
+		else
+			msleep(85);
+
+		input_report_abs(lpi->ls_input_dev, ABS_MISC, -1);
+		input_sync(lpi->ls_input_dev);
+		report_lsensor_input_event(lpi, 1);
+	}
+
+	mutex_unlock(&als_enable_mutex);
+	return ret;
+}
+
+static int lightsensor_disable(struct cm3629_info *lpi)
+{
+	int ret = 0;
+	char cmd[3] = {0};
+	mutex_lock(&als_disable_mutex);
+
+	D("[LS][cm3629] %s\n", __func__);
+
+	cmd[0] = lpi->ls_cmd | CM3629_ALS_SD;
+	cmd[1] = 0;
+	ret = _cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		ALS_config_cmd, cmd, 3);
+
+	if (ret < 0)
+		pr_err("[LS][cm3629 error]%s: disable auto light sensor fail\n",
+			__func__);
+	else
+		lpi->als_enable = 0;
+
+	mutex_unlock(&als_disable_mutex);
+	return ret;
+}
+
+static int lightsensor_open(struct inode *inode, struct file *file)
+{
+	struct cm3629_info *lpi = lp_info;
+	int rc = 0;
+
+	D("[LS][cm3629] %s\n", __func__);
+	if (lpi->lightsensor_opened) {
+		pr_err("[LS][cm3629 error]%s: already opened\n", __func__);
+		rc = -EBUSY;
+	}
+	lpi->lightsensor_opened = 1;
+	return rc;
+}
+
+static int lightsensor_release(struct inode *inode, struct file *file)
+{
+	struct cm3629_info *lpi = lp_info;
+
+	D("[LS][cm3629] %s\n", __func__);
+	lpi->lightsensor_opened = 0;
+	return 0;
+}
+
+static long lightsensor_ioctl(struct file *file, unsigned int cmd,
+		unsigned long arg)
+{
+	int rc, val;
+	struct cm3629_info *lpi = lp_info;
+
+	
+
+	switch (cmd) {
+	case LIGHTSENSOR_IOCTL_ENABLE:
+		if (get_user(val, (unsigned long __user *)arg)) {
+			rc = -EFAULT;
+			break;
+		}
+		D("[LS][cm3629] %s LIGHTSENSOR_IOCTL_ENABLE, value = %d\n",
+			__func__, val);
+		rc = val ? lightsensor_enable(lpi) : lightsensor_disable(lpi);
+		break;
+	case LIGHTSENSOR_IOCTL_GET_ENABLED:
+		val = lpi->als_enable;
+		D("[LS][cm3629] %s LIGHTSENSOR_IOCTL_GET_ENABLED, enabled %d\n",
+			__func__, val);
+		rc = put_user(val, (unsigned long __user *)arg);
+		break;
+	default:
+		pr_err("[LS][cm3629 error]%s: invalid cmd %d\n",
+			__func__, _IOC_NR(cmd));
+		rc = -EINVAL;
+	}
+
+	return rc;
+}
+
+static const struct file_operations lightsensor_fops = {
+	.owner = THIS_MODULE,
+	.open = lightsensor_open,
+	.release = lightsensor_release,
+	.unlocked_ioctl = lightsensor_ioctl
+};
+
+static struct miscdevice lightsensor_misc = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "lightsensor",
+	.fops = &lightsensor_fops
+};
+
+
+static ssize_t ps_adc_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+
+	uint8_t ps_adc1 = 0;
+	uint8_t ps_adc2 = 0;
+	int ret;
+	struct cm3629_info *lpi = lp_info;
+	int int_gpio;
+
+	int_gpio = gpio_get_value_cansleep(lpi->intr_pin);
+	get_ps_adc_value(&ps_adc1, &ps_adc2);
+
+	if (lpi->ps_calibration_rule == 1) {
+		D("[PS][cm3629] %s: PS1_ADC=0x%02X, PS2_ADC=0x%02X, "
+		  "PS1_Offset=0x%02X, PS2_Offset=0x%02X\n", __func__,
+		  ps_adc1, ps_adc2, lpi->ps1_adc_offset, lpi->ps2_adc_offset);
+		ps_adc1 = (ps_adc1 >= lpi->ps1_adc_offset) ?
+			  ps_adc1 - lpi->ps1_adc_offset : 0;
+		ps_adc2 = (ps_adc2 >= lpi->ps2_adc_offset) ?
+			  ps_adc2 - lpi->ps2_adc_offset : 0;
+	}
+
+	ret = sprintf(buf, "ADC[0x%02X], ENABLE = %d, intr_pin = %d, "
+		      "ps_pocket_mode = %d, model = %s, ADC2[0x%02X]\n",
+		      ps_adc1, lpi->ps_enable, int_gpio, lpi->ps_pocket_mode,
+		      (lpi->model == CAPELLA_CM36282) ? "CM36282" : "CM36292",
+		      ps_adc2);
+
+	return ret;
+}
+
+static ssize_t ps_enable_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	int ps_en, err;
+	struct cm3629_info *lpi = lp_info;
+
+	ps_en = -1;
+	sscanf(buf, "%d", &ps_en);
+
+	if (ps_en != 0 && ps_en != 1
+		&& ps_en != 10 && ps_en != 13 && ps_en != 16)
+		return -EINVAL;
+
+	if (lpi->ps_calibration_rule == 3 &&
+		(ps_en == 10 || ps_en == 13 || ps_en == 16)) {
+		if ((lpi->ps_conf1_val & CM3629_PS_IT_1_6T) == CM3629_PS_IT_1_6T) {
+			D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  CM3629_PS_IT_1_6T\n",
+			  __func__, lpi->ps_conf1_val);
+			lpi->ps_conf1_val = (lpi->ps_conf1_val & (~CM3629_PS_IT_1_6T));
+		} else if ((lpi->ps_conf1_val & CM3629_PS_IT_1_3T) == CM3629_PS_IT_1_3T) {
+			D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  CM3629_PS_IT_1_3T\n",
+			  __func__, lpi->ps_conf1_val);
+			lpi->ps_conf1_val = (lpi->ps_conf1_val & (~CM3629_PS_IT_1_3T));
+		} else if ((lpi->ps_conf1_val & CM3629_PS_IT_1T) == CM3629_PS_IT_1T) {
+			D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  CM3629_PS_IT_1T\n",
+			  __func__, lpi->ps_conf1_val);
+			lpi->ps_conf1_val = (lpi->ps_conf1_val & (~CM3629_PS_IT_1T));
+		} else
+			D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  2T or unknown\n",
+			  __func__, lpi->ps_conf1_val);
+
+		D("[PS][cm3629] %s: clear  lpi->ps_conf1_val  0x%x\n",
+			  __func__, lpi->ps_conf1_val);
+
+		if (ps_en == 10)
+			lpi->ps_conf1_val = lpi->ps_conf1_val | CM3629_PS_IT_1T;
+		else if (ps_en == 13)
+			lpi->ps_conf1_val = lpi->ps_conf1_val | CM3629_PS_IT_1_3T;
+		else if (ps_en == 16)
+			lpi->ps_conf1_val = lpi->ps_conf1_val | CM3629_PS_IT_1_6T;
+
+		D("[PS][cm3629] %s: change lpi->ps_conf1_val  0x%x\n",
+			  __func__, lpi->ps_conf1_val);
+	}
+	D("[PS][cm3629] %s: ps_en=%d\n",
+			__func__, ps_en);
+
+	if (ps_en && !ps_drv_enable) {
+		err = psensor_enable(lpi);
+		if (!err)
+			ps_drv_enable = 1;
+	} else if (!ps_en && ps_drv_enable) {
+		ps_drv_enable = 0;
+		psensor_disable(lpi);
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(ps_adc, 0664, ps_adc_show, ps_enable_store);
+static int kcalibrated;
+static ssize_t ps_kadc_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	struct cm3629_info *lpi = lp_info;
+
+	if ((ps_kparam1 >> 16 == PS_CALIBRATED) || kcalibrated == 1)
+		ret = sprintf(buf, "P-sensor calibrated,"
+			      "INTE_PS1_CANC = (0x%02X), "
+			      "INTE_PS2_CANC = (0x%02X)\n",
+			      lpi->inte_ps1_canc, lpi->inte_ps2_canc);
+	else
+		ret = sprintf(buf, "P-sensor NOT calibrated,"
+			      "INTE_PS1_CANC = (0x%02X), "
+			      "INTE_PS2_CANC = (0x%02X)\n",
+			      lpi->inte_ps1_canc, lpi->inte_ps2_canc);
+
+	return ret;
+}
+
+static ssize_t ps_kadc_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	int param1, param2;
+	char ps_conf[3];
+	struct cm3629_info *lpi = lp_info;
+	uint8_t ps_conf1_val;
+
+	sscanf(buf, "0x%x 0x%x", &param1, &param2);
+	D("[PS]%s: store value = 0x%X, 0x%X\n", __func__, param1, param2);
+	ps_conf1_val = lpi->ps_conf1_val;
+	if (lpi->ps_calibration_rule == 3) {
+
+		if ((lpi->ps_conf1_val & CM3629_PS_IT_1_6T) == CM3629_PS_IT_1_6T) {
+			D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  CM3629_PS_IT_1_6T\n",
+			  __func__, lpi->ps_conf1_val);
+			lpi->ps_conf1_val = (lpi->ps_conf1_val & (~CM3629_PS_IT_1_6T));
+		} else if ((lpi->ps_conf1_val & CM3629_PS_IT_1_3T) == CM3629_PS_IT_1_3T) {
+			D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  CM3629_PS_IT_1_3T\n",
+			  __func__, lpi->ps_conf1_val);
+			lpi->ps_conf1_val = (lpi->ps_conf1_val & (~CM3629_PS_IT_1_3T));
+		} else if ((lpi->ps_conf1_val & CM3629_PS_IT_1T) == CM3629_PS_IT_1T) {
+			D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  CM3629_PS_IT_1T\n",
+			  __func__, lpi->ps_conf1_val);
+			lpi->ps_conf1_val = (lpi->ps_conf1_val & (~CM3629_PS_IT_1T));
+		} else
+			D("[PS][cm3629] %s: lpi->ps_conf1_val  0x%x,  2T or unknown\n",
+			  __func__, lpi->ps_conf1_val);
+
+		D("[PS][cm3629] %s: clear  lpi->ps_conf1_val  0x%x\n",
+			  __func__, lpi->ps_conf1_val);
+
+		if (((param2 >> 16) & 0xFF) == 0)
+			lpi->ps_conf1_val = (lpi->ps_conf1_val | CM3629_PS_IT_1T);
+		else if (((param2 >> 16) & 0xFF) == 0x1)
+			lpi->ps_conf1_val = (lpi->ps_conf1_val | CM3629_PS_IT_1_3T);
+		else if (((param2 >> 16) & 0xFF) == 0x2)
+			lpi->ps_conf1_val = (lpi->ps_conf1_val | CM3629_PS_IT_1_6T);
+		else {
+			lpi->ps_conf1_val = ps_conf1_val;
+			D("[PS]%s: ((param2 >> 16) & 0xFF)  = 0x%X is diffrent\n",
+			__func__, ((param2 >> 16) & 0xFF));
+		}
+		D("[PS]%s: ((param2 >> 16) & 0xFF)  = 0x%X\n",
+		 __func__, ((param2 >> 16) & 0xFF));
+		D("[PS][cm3629] %s:   lpi->ps_conf1_val  0x%x\n",
+			  __func__, lpi->ps_conf1_val);
+	}
+	if (lpi->ps_calibration_rule >= 1) {
+		lpi->ps1_thd_set = lpi->ps1_thd_with_cal;
+		lpi->ps2_thd_set = lpi->ps2_thd_with_cal;
+		D("[PS][cm3629] %s: PS1_THD=%d, PS2_THD=%d, "
+		  "after calibration\n", __func__,
+		  lpi->ps1_thd_set, lpi->ps2_thd_set);
+	}
+	if (lpi->ps_enable) {
+		ps_conf[0] = lpi->ps_conf1_val;
+		ps_conf[1] = lpi->ps_conf2_val;
+		ps_conf[2] = lpi->ps_conf3_val;
+
+		if (lpi->ps_select == CM3629_PS2_ONLY)
+			ps_conf[1] = (lpi->ps_conf2_val | CM3629_PS2_INT_BOTH);
+		else if (lpi->ps_select == CM3629_PS1_ONLY)
+			ps_conf[1] = (lpi->ps_conf2_val | CM3629_PS1_INT_BOTH);
+
+		enable_ps_interrupt(ps_conf);
+	}
+
+	ps1_canc_set = lpi->inte_ps1_canc = (param2 & 0xFF);
+	ps2_canc_set = lpi->inte_ps2_canc = ((param2 >> 8) & 0xFF);
+	psensor_intelligent_cancel_cmd(lpi);
+
+	D("[PS]%s: inte_ps1_canc = 0x%02X, inte_ps2_canc = 0x%02X, lpi->ps_conf1_val  = 0x%02X\n",
+	  __func__, lpi->inte_ps1_canc, lpi->inte_ps2_canc, lpi->ps_conf1_val);
+	kcalibrated = 1;
+	return count;
+}
+
+static DEVICE_ATTR(ps_kadc, 0664, ps_kadc_show, ps_kadc_store);
+
+
+static ssize_t ps_canc_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	struct cm3629_info *lpi = lp_info;
+
+	ret = sprintf(buf, "PS1_CANC = 0x%02X, PS2_CANC = 0x%02X\n",
+		      lpi->inte_ps1_canc, lpi->inte_ps2_canc);
+
+	return ret;
+}
+static ssize_t ps_canc_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	int ps1_canc = 0;
+	int ps2_canc = 0;
+	struct cm3629_info *lpi = lp_info;
+
+	sscanf(buf, "0x%x 0x%x", &ps1_canc, &ps2_canc);
+
+	lpi->inte_ps1_canc = (uint8_t) ps1_canc;
+	lpi->inte_ps2_canc = (uint8_t) ps2_canc;
+	psensor_intelligent_cancel_cmd(lpi);
+
+	D("[PS] %s: PS1_CANC = 0x%02X, PS2_CANC = 0x%02X\n",
+	  __func__, lpi->inte_ps1_canc, lpi->inte_ps2_canc);
+
+	return count;
+}
+static DEVICE_ATTR(ps_canc, 0664, ps_canc_show, ps_canc_store);
+
+static ssize_t ps_i2c_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	int ret = 0, i;
+	struct cm3629_info *lpi = lp_info;
+	uint8_t chip_id[3] = {0};
+	uint8_t data[26] = {0};
+
+	for (i = 0; i <= CH_ID; i++) {
+		_cm3629_I2C_Read2(lpi->cm3629_slave_address, ALS_config_cmd + i,
+				  chip_id, 2);
+		data[i*2] = chip_id[0];
+		data[(i*2)+1] = chip_id[1];
+	}
+	ret = sprintf(buf,
+		"0x0L=0x%02X, 0x0H=0x%02X, 0x1L=0x%02X, 0x1H=0x%02X, "
+		"0x2L=0x%02X, 0x2H=0x%02X, 0x3L=0x%02X, 0x3H=0x%02X,\n"
+		"0x4L=0x%02X, 0x4H=0x%02X, 0x5L=0x%02X, 0x5H=0x%02X, "
+		"0x6L=0x%02X, 0x6H=0x%02X, 0x7L=0x%02X, 0x7H=0x%02X,\n"
+		"0x8L=0x%02X, 0x8H=0x%02X, 0x9L=0x%02X, 0x9H=0x%02X, "
+		"0xaL=0x%02X, 0xaH=0x%02X, 0xbL=0x%02X, 0xbH=0x%02X,\n"
+		"0xcL=0x%02X, 0xcH=0x%02X.\n",
+		data[0], data[1], data[2], data[3],
+		data[4], data[5], data[6], data[7],
+		data[8], data[9], data[10], data[11],
+		data[12], data[13], data[14], data[15],
+		data[16], data[17], data[18], data[19],
+		data[20], data[21], data[22], data[23],
+		data[24], data[25]);
+
+	return ret;
+}
+static ssize_t ps_i2c_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	struct cm3629_info *lpi = lp_info;
+	char *token[10];
+	int i, ret = 0;
+	uint8_t reg = 0, value[3] = {0}, read_value[3] = {0};
+	unsigned long ul_reg = 0, ul_value[3] = {0};
+
+	printk(KERN_INFO "[CM3629_] %s\n", buf);
+
+	for (i = 0; i < 3; i++) {
+		token[i] = strsep((char **)&buf, " ");
+		D("%s: token[%d] = %s\n", __func__, i, token[i]);
+	}
+
+	ret = strict_strtoul(token[0], 16, &ul_reg);
+	ret = strict_strtoul(token[1], 16, &(ul_value[0]));
+	ret = strict_strtoul(token[2], 16, &(ul_value[1]));
+
+	reg = ul_reg;
+	value[0] = ul_value[0];
+	value[1] = ul_value[1];
+
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+		reg, value, 3);
+
+	D("[CM3629] Set REG=0x%x, value[0]=0x%x, value[1]=0x%x\n",
+	  reg, value[0], value[1]);
+
+	_cm3629_I2C_Read2(lpi->cm3629_slave_address, reg, read_value, 2);
+
+	D("[CM3629] Get REG=0x%x, value[0]=0x%x, value[1]=0x%x\n",
+	  reg, read_value[0], read_value[1]);
+
+	switch (reg) {
+	case PS_1_thd:
+		lpi->ps1_thd_set = value[0];
+	case PS_2_thd:
+		lpi->ps2_thd_set = value[0];
+	default:
+		D("[CM3629] NO parameter update for register 0x%02X\n", reg);
+	}
+
+	return count;
+}
+static DEVICE_ATTR(ps_i2c, 0664, ps_i2c_show, ps_i2c_store);
+
+static ssize_t ps_hw_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	struct cm3629_info *lpi = lp_info;
+
+	ret = sprintf(buf, "PS: ps_conf1_val=0x%x, ps1_thd_set=0x%x, "
+		"inte_ps1_canc=0x%02X, inte_ps2_canc=0x%02X, "
+		"ps_conf2_val=0x%x, ps1_adc_offset=0x%02X, "
+		"ps2_adc_offset=0x%02X, LS: ls_cmd=0x%x\n",
+		lpi->ps_conf1_val, lpi->ps1_thd_set, lpi->inte_ps1_canc,
+		lpi->inte_ps2_canc, lpi->ps_conf2_val,
+		lpi->ps1_adc_offset, lpi->ps2_adc_offset, lpi->ls_cmd);
+
+	return ret;
+}
+static ssize_t ps_hw_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	int code;
+	struct cm3629_info *lpi = lp_info;
+
+	sscanf(buf, "0x%x", &code);
+
+	D("[PS]%s: store value = 0x%x\n", __func__, code);
+	if (code == 1) {
+		lpi->inte_ps1_canc = 0;
+		lpi->inte_ps2_canc = 0;
+		lpi->ps1_adc_offset = 0;
+		lpi->ps2_adc_offset = 0;
+		psensor_intelligent_cancel_cmd(lpi);
+		D("[PS]%s: Reset ps1_canc=%d, ps2_canc=%d, adc_offset1=%d, "
+		  "adc_offset2=%d\n", __func__, lpi->inte_ps1_canc,
+		  lpi->inte_ps2_canc, lpi->ps1_adc_offset, lpi->ps2_adc_offset);
+	} else {
+		lpi->inte_ps1_canc = ps1_canc_set;
+		lpi->inte_ps2_canc = ps2_canc_set;
+		lpi->ps1_adc_offset = ps1_offset_adc;
+		lpi->ps2_adc_offset = ps2_offset_adc;
+		psensor_intelligent_cancel_cmd(lpi);
+		D("[PS]%s: Recover ps1_canc=%d, ps2_canc=%d, adc_offset1=%d, "
+		  "adc_offset2=%d\n", __func__, lpi->inte_ps1_canc,
+		  lpi->inte_ps2_canc, lpi->ps1_adc_offset, lpi->ps2_adc_offset);
+	}
+
+	return count;
+}
+static DEVICE_ATTR(ps_hw, 0664, ps_hw_show, ps_hw_store);
+
+static ssize_t ps_headset_bt_plugin_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	struct cm3629_info *lpi = lp_info;
+
+	ret = sprintf(buf, "ps_conf1_val = 0x%02X, ps_conf2_val = 0x%02X\n",
+		      lpi->ps_conf1_val, lpi->ps_conf2_val);
+
+	return ret;
+}
+static ssize_t ps_headset_bt_plugin_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	int headset_bt_plugin = 0;
+	struct cm3629_info *lpi = lp_info;
+	char cmd[2] = {0};
+
+	sscanf(buf, "%d", &headset_bt_plugin);
+	D("[PS] %s: headset_bt_plugin = %d\n", __func__, headset_bt_plugin);
+
+	if (lpi->no_need_change_setting == 1) {
+		D("[PS] %s: no_need_change_setting = 0x%x.\n", __func__, lpi->no_need_change_setting);
+		return count;
+	} else {
+		if (headset_bt_plugin == 1) {
+			D("[PS][cm3629] %s, Headset or BT or Speaker ON\n", __func__);
+
+			_cm3629_I2C_Read2(lpi->cm3629_slave_address, PS_config, cmd, 2);
+			D("[PS][cm3629] %s, read value => cmd[0] = 0x%x, cmd[1] = 0x%x\n",
+				__func__, cmd[0], cmd[1]);
+
+			D("[PS][cm3629] %s, Before setting: ps_conf1_val = 0x%x\n",
+				__func__, lpi->ps_conf1_val);
+			lpi->ps_conf1_val = (cmd[0] & 0x3) | (CM3629_PS_DR_1_320 |
+							      CM3629_PS_IT_1_6T |
+							      CM3629_PS1_PERS_1);
+			D("[PS][cm3629] %s, After setting: ps_conf1_val = 0x%x\n",
+				__func__, lpi->ps_conf1_val);
+
+			D("[PS][cm3629] %s, Before setting: ps_conf2_val = 0x%x\n",
+				__func__, lpi->ps_conf2_val);
+			lpi->ps_conf2_val = (cmd[1] & 0xF) | (CM3629_PS_ITB_1 |
+							      CM3629_PS_ITR_1);
+			D("[PS][cm3629] %s, After setting: ps_conf2_val = 0x%x\n",
+				__func__, lpi->ps_conf2_val);
+
+			cmd[0] = lpi->ps_conf1_val;
+			cmd[1] = lpi->ps_conf2_val;
+			D("[PS][cm3629] %s, write cmd[0] = 0x%x, cmd[1] = 0x%x\n",
+				__func__, cmd[0], cmd[1]);
+			_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+						 PS_config, cmd, 3);
+
+			_cm3629_I2C_Read2(lpi->cm3629_slave_address, PS_config, cmd, 2);
+			D("[PS][cm3629] %s, read 0x3 cmd value after set =>"
+				" cmd[0] = 0x%x, cmd[1] = 0x%x\n",
+				__func__, cmd[0], cmd[1]);
+		} else {
+			D("[PS][cm3629] %s, Headset or BT or Speaker OFF\n", __func__);
+
+			_cm3629_I2C_Read2(lpi->cm3629_slave_address, PS_config, cmd, 2);
+			D("[PS][cm3629] %s, read value => cmd[0] = 0x%x, cmd[1] = 0x%x\n",
+				__func__, cmd[0], cmd[1]);
+
+			lpi->ps_conf1_val = lpi->ps_conf1_val_from_board;
+			lpi->ps_conf2_val = lpi->ps_conf2_val_from_board;
+
+			cmd[0] = ((cmd[0] & 0x3) | lpi->ps_conf1_val);
+			cmd[1] = ((cmd[1] & 0xF) | lpi->ps_conf2_val);
+			D("[PS][cm3629] %s, write cmd[0] = 0x%x, cmd[1] = 0x%x\n",
+				__func__, cmd[0], cmd[1]);
+			_cm3629_I2C_Write2(lpi->cm3629_slave_address,
+						 PS_config, cmd, 3);
+
+			_cm3629_I2C_Read2(lpi->cm3629_slave_address, PS_config, cmd, 2);
+			D("[PS][cm3629] %s, read 0x3 cmd value after set =>"
+				" cmd[0] = 0x%x, cmd[1] = 0x%x\n",
+				__func__, cmd[0], cmd[1]);
+		}
+
+	}
+
+	return count;
+}
+static DEVICE_ATTR(ps_headset_bt_plugin, 0664, ps_headset_bt_plugin_show, ps_headset_bt_plugin_store);
+
+static ssize_t ls_adc_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	int ret;
+	struct cm3629_info *lpi = lp_info;
+
+	
+	report_lsensor_input_event(lpi, 0);
+
+	D("[LS][cm3629] %s: ADC = 0x%04X, Level = %d \n",
+		__func__, lpi->current_adc, lpi->current_level);
+	ret = sprintf(buf, "ADC[0x%04X] => level %d\n",
+		lpi->current_adc, lpi->current_level);
+
+	return ret;
+}
+
+static DEVICE_ATTR(ls_adc, 0664, ls_adc_show, NULL);
+
+static ssize_t ls_enable_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	
+	int ret = 0;
+	struct cm3629_info *lpi = lp_info;
+
+	ret = sprintf(buf, "Light sensor Auto Enable = %d\n",
+			lpi->als_enable);
+
+	return ret;
+}
+
+static ssize_t ls_enable_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	int ret = 0;
+	int ls_auto;
+	struct cm3629_info *lpi = lp_info;
+
+	ls_auto = -1;
+	sscanf(buf, "%d", &ls_auto);
+
+	if (ls_auto != 0 && ls_auto != 1 && ls_auto != 147)
+		return -EINVAL;
+
+	if (ls_auto) {
+		lpi->ls_calibrate = (ls_auto == 147) ? 1 : 0;
+		ret = lightsensor_enable(lpi);
+	} else {
+		lpi->ls_calibrate = 0;
+		ret = lightsensor_disable(lpi);
+	}
+
+	D("[LS][cm3629] %s: lpi->als_enable = %d, lpi->ls_calibrate = %d, ls_auto=%d\n",
+		__func__, lpi->als_enable, lpi->ls_calibrate, ls_auto);
+
+	if (ret < 0)
+		pr_err(
+		"[LS][cm3629 error]%s: set auto light sensor fail\n",
+		__func__);
+
+	return count;
+}
+
+static DEVICE_ATTR(ls_auto, 0664,
+	ls_enable_show, ls_enable_store);
+
+static ssize_t ls_kadc_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	struct cm3629_info *lpi = lp_info;
+	int ret;
+
+	ret = sprintf(buf, "kadc = 0x%x, gadc = 0x%x, kadc while this boot"
+			" = 0x%x\n",
+			lpi->als_kadc, lpi->als_gadc, als_kadc);
+
+	return ret;
+}
+
+static ssize_t ls_kadc_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	struct cm3629_info *lpi = lp_info;
+	int kadc_temp = 0;
+
+	sscanf(buf, "%d", &kadc_temp);
+	if (kadc_temp <= 0 || lpi->golden_adc <= 0) {
+		printk(KERN_ERR "[LS][cm3629 error] %s: kadc_temp=0x%x, als_gadc=0x%x\n",
+			__func__, kadc_temp, lpi->golden_adc);
+		return -EINVAL;
+	}
+	mutex_lock(&als_get_adc_mutex);
+	lpi->als_kadc = kadc_temp;
+	lpi->als_gadc = lpi->golden_adc;
+	printk(KERN_INFO "[LS]%s: als_kadc=0x%x, als_gadc=0x%x\n",
+			__func__, lpi->als_kadc, lpi->als_gadc);
+
+	if (lightsensor_update_table(lpi) < 0)
+		printk(KERN_ERR "[LS][cm3629 error] %s: update ls table fail\n", __func__);
+	mutex_unlock(&als_get_adc_mutex);
+	return count;
+}
+
+static DEVICE_ATTR(ls_kadc, 0664, ls_kadc_show, ls_kadc_store);
+
+static ssize_t ls_adc_table_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	unsigned length = 0;
+	int i;
+
+	for (i = 0; i < 10; i++) {
+		length += sprintf(buf + length,
+			"[cm3629]Get adc_table[%d] =  0x%x ; %d, Get cali_table[%d] =  0x%x ; %d, \n",
+			i, *(lp_info->adc_table + i),
+			*(lp_info->adc_table + i),
+			i, *(lp_info->cali_table + i),
+			*(lp_info->cali_table + i));
+	}
+	return length;
+}
+
+static ssize_t ls_adc_table_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+
+	struct cm3629_info *lpi = lp_info;
+	char *token[10];
+	unsigned long tempdata[10];
+	int i, ret;
+
+	printk(KERN_INFO "[LS][cm3629]%s\n", buf);
+	for (i = 0; i < 10; i++) {
+		token[i] = strsep((char **)&buf, " ");
+		ret = strict_strtoul(token[i], 16, &(tempdata[i]));
+		if (tempdata[i] < 1 || tempdata[i] > 0xffff) {
+			printk(KERN_ERR
+			"[LS][cm3629 error] adc_table[%d] =  0x%lx Err\n",
+			i, tempdata[i]);
+			return count;
+		}
+	}
+	mutex_lock(&als_get_adc_mutex);
+	for (i = 0; i < 10; i++) {
+		lpi->adc_table[i] = tempdata[i];
+		printk(KERN_INFO
+		"[LS][cm3629]Set lpi->adc_table[%d] =  0x%x\n",
+		i, *(lp_info->adc_table + i));
+	}
+	if (lightsensor_update_table(lpi) < 0)
+		printk(KERN_ERR "[LS][cm3629 error] %s: update ls table fail\n",
+		__func__);
+	mutex_unlock(&als_get_adc_mutex);
+	D("[LS][cm3629] %s\n", __func__);
+
+	return count;
+}
+
+static DEVICE_ATTR(ls_adc_table, 0664,
+	ls_adc_table_show, ls_adc_table_store);
+
+
+static ssize_t ls_fLevel_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf, "fLevel = %d\n", f_cm3629_level);
+}
+static ssize_t ls_fLevel_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	struct cm3629_info *lpi = lp_info;
+	int value = 0;
+	sscanf(buf, "%d", &value);
+	(value >= 0)?(value = min(value, 10)):(value = max(value, -1));
+	f_cm3629_level = value;
+	input_report_abs(lpi->ls_input_dev, ABS_MISC, f_cm3629_level);
+	input_sync(lpi->ls_input_dev);
+	printk(KERN_INFO "[LS]set fLevel = %d\n", f_cm3629_level);
+
+	msleep(1000);
+	f_cm3629_level = -1;
+	return count;
+}
+static DEVICE_ATTR(ls_flevel, 0664, ls_fLevel_show, ls_fLevel_store);
+
+
+static ssize_t ps_workaround_table_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	struct cm3629_info *lpi = lp_info;
+	int i = 0;
+	char table_str[952] = "";
+	char temp_str[64] = "";
+
+	sprintf(table_str, "mapping table size = %d\n", lpi->mapping_size);
+	printk(KERN_DEBUG "%s: table_str = %s\n", __func__, table_str);
+	for (i = 0; i < lpi->mapping_size; i++) {
+		memset(temp_str, 0, 64);
+		if ((i == 0) || ((i % 10) == 1))
+			sprintf(temp_str, "[%d] = 0x%x", i, lpi->mapping_table[i]);
+		else
+			sprintf(temp_str, ", [%d] = 0x%x", i, lpi->mapping_table[i]);
+		strcat(table_str, temp_str);
+		printk(KERN_DEBUG "%s: [%d]: table_str = %s\n", __func__, i, table_str);
+		if ((i != 0) && (i % 10) == 0)
+			strcat(table_str, "\n");
+	}
+
+	return sprintf(buf, "%s\n", table_str);
+}
+static ssize_t ps_workaround_table_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	struct cm3629_info *lpi = lp_info;
+	int index = 0;
+	unsigned int value = 0;
+
+	sscanf(buf, "%d 0x%x", &index, &value);
+
+	D("%s: input: index = %d, value = 0x%x\n", __func__, index, value);
+
+	if ((index < lpi->mapping_size) && (index >= 0) && (value <= 255) && (index >= 0))
+		lpi->mapping_table[index] = value;
+
+	if ((index < lpi->mapping_size) && (index >= 0)) {
+		printk(KERN_INFO "%s: lpi->mapping_table[%d] = 0x%x, "
+			"lpi->mapping_size = %d\n",
+			__func__, index, lpi->mapping_table[index],
+			lpi->mapping_size);
+	}
+
+	return count;
+}
+static DEVICE_ATTR(ps_workaround_table, 0664, ps_workaround_table_show, ps_workaround_table_store);
+
+
+static ssize_t ps_fixed_thd_add_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	struct cm3629_info *lpi = lp_info;
+
+	return sprintf(buf, "Fixed added threshold = %d\n", lpi->ps_th_add);
+}
+static ssize_t ps_fixed_thd_add_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	struct cm3629_info *lpi = lp_info;
+	int value = 0;
+
+	sscanf(buf, "%d", &value);
+
+	D("%s: input: value = %d\n", __func__, value);
+
+	if ((value >= 0) && (value <= 255))
+		lpi->ps_th_add = value;
+
+	D("%s: lpi->ps_th_add = %d\n", __func__, lpi->ps_th_add);
+
+	return count;
+}
+static DEVICE_ATTR(ps_fixed_thd_add, 0664, ps_fixed_thd_add_show, ps_fixed_thd_add_store);
+
+static ssize_t ls_dark_level_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	struct cm3629_info *lpi = lp_info;
+
+	ret = sprintf(buf, "LS_dark_level = %d\n", lpi->dark_level);
+
+	return ret;
+}
+static ssize_t ls_dark_level_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	int ls_dark_level = 0;
+	struct cm3629_info *lpi = lp_info;
+
+	sscanf(buf, "%d" , &ls_dark_level);
+
+	lpi->dark_level = (uint8_t) ls_dark_level;
+
+	D("[LS] %s: LS_dark_level = %d\n",
+          __func__, lpi->dark_level);
+
+	return count;
+}
+static DEVICE_ATTR(ls_dark_level, 0664, ls_dark_level_show, ls_dark_level_store);
+
+static int lightsensor_setup(struct cm3629_info *lpi)
+{
+	int ret;
+
+	lpi->ls_input_dev = input_allocate_device();
+	if (!lpi->ls_input_dev) {
+		pr_err(
+			"[LS][cm3629 error]%s: could not allocate ls input device\n",
+			__func__);
+		return -ENOMEM;
+	}
+	lpi->ls_input_dev->name = "lightsensor-level";
+	set_bit(EV_ABS, lpi->ls_input_dev->evbit);
+	input_set_abs_params(lpi->ls_input_dev, ABS_MISC, 0, 9, 0, 0);
+
+	ret = input_register_device(lpi->ls_input_dev);
+	if (ret < 0) {
+		pr_err("[LS][cm3629 error]%s: can not register ls input device\n",
+				__func__);
+		goto err_free_ls_input_device;
+	}
+
+	ret = misc_register(&lightsensor_misc);
+	if (ret < 0) {
+		pr_err("[LS][cm3629 error]%s: can not register ls misc device\n",
+				__func__);
+		goto err_unregister_ls_input_device;
+	}
+
+	return ret;
+
+err_unregister_ls_input_device:
+	input_unregister_device(lpi->ls_input_dev);
+err_free_ls_input_device:
+	input_free_device(lpi->ls_input_dev);
+	return ret;
+}
+
+static int psensor_setup(struct cm3629_info *lpi)
+{
+	int ret;
+
+	lpi->ps_input_dev = input_allocate_device();
+	if (!lpi->ps_input_dev) {
+		pr_err(
+			"[PS][cm3629 error]%s: could not allocate ps input device\n",
+			__func__);
+		return -ENOMEM;
+	}
+	lpi->ps_input_dev->name = "proximity";
+	set_bit(EV_ABS, lpi->ps_input_dev->evbit);
+	input_set_abs_params(lpi->ps_input_dev, ABS_DISTANCE, 0, 1, 0, 0);
+
+	ret = input_register_device(lpi->ps_input_dev);
+	if (ret < 0) {
+		pr_err(
+			"[PS][cm3629 error]%s: could not register ps input device\n",
+			__func__);
+		goto err_free_ps_input_device;
+	}
+
+	ret = misc_register(&psensor_misc);
+	if (ret < 0) {
+		pr_err(
+			"[PS][cm3629 error]%s: could not register ps misc device\n",
+			__func__);
+		goto err_unregister_ps_input_device;
+	}
+
+	return ret;
+
+err_unregister_ps_input_device:
+	input_unregister_device(lpi->ps_input_dev);
+err_free_ps_input_device:
+	input_free_device(lpi->ps_input_dev);
+	return ret;
+}
+
+int power_key_check_in_pocket(void)
+{
+	struct cm3629_info *lpi = lp_info;
+	int ls_dark;
+
+	uint32_t ls_adc = 0;
+	int ls_level = 0;
+	int i;
+	if (!is_probe_success) {
+		D("[cm3629] %s return by cm3629 probe fail\n", __func__);
+		return 0;
+	}
+	pocket_mode_flag = 1;
+	D("[cm3629] %s +++\n", __func__);
+	
+	psensor_enable(lpi);
+	D("[cm3629] %s ps_near %d\n", __func__, ps_near);
+	psensor_disable(lpi);
+
+	
+	mutex_lock(&als_get_adc_mutex);
+	get_ls_adc_value(&ls_adc, 0);
+	enable_als_interrupt();
+	mutex_unlock(&als_get_adc_mutex);
+	for (i = 0; i < 10; i++) {
+		if (ls_adc <= (*(lpi->adc_table + i))) {
+			ls_level = i;
+			if (*(lpi->adc_table + i))
+				break;
+		}
+		if (i == 9) {
+			ls_level = i;
+			break;
+		}
+	}
+	D("[cm3629] %s ls_adc %d, ls_level %d\n", __func__, ls_adc, ls_level);
+	ls_dark = (ls_level <= lpi->dark_level) ? 1 : 0;
+
+	D("[cm3629] %s --- ls_dark %d\n", __func__, ls_dark);
+	pocket_mode_flag = 0;
+	return (ls_dark && ps_near);
+}
+
+int psensor_enable_by_touch_driver(int on)
+{
+	struct cm3629_info *lpi = lp_info;
+
+	if (!is_probe_success) {
+		D("[PS][cm3629] %s return by cm3629 probe fail\n", __func__);
+		return 0;
+	}
+	psensor_enable_by_touch = 1;
+
+	D("[PS][cm3629] %s on:%d\n", __func__, on);
+	if (on) {
+		psensor_enable(lpi);
+	} else {
+		psensor_disable(lpi);
+	}
+
+	psensor_enable_by_touch = 0;
+	return 0;
+}
+static int cm3629_read_chip_id(struct cm3629_info *lpi)
+{
+	uint8_t chip_id[3] = {0};
+	int ret = 0;
+
+	als_power(0);
+	msleep(5);
+	als_power(1);
+	msleep(5);
+
+	ret = _cm3629_I2C_Read2(lpi->cm3629_slave_address, CH_ID, chip_id, 2);
+	if (ret >= 0) {
+		if ((chip_id[0] != 0x29) && (chip_id[0] != 0x92) && (chip_id[0] != 0x82) && (chip_id[0] != 0x83)) {
+			ret = -1;
+			D("[PS][cm3629] %s, chip_id  Err value = 0x%x, 0x%x, ret %d\n",
+				__func__, chip_id[0], chip_id[1], ret);
+		} else
+			D("[PS][cm3629] %s, chip_id value = 0x%x, 0x%x, ret %d\n",
+				__func__, chip_id[0], chip_id[1], ret);
+	} else
+		D("[PS][cm3629] %s, read chip_id i2c err ret %d\n",
+				__func__, ret);
+	sensor_chipId[0] = chip_id[0];
+
+	return ret;
+}
+static int cm3629_setup(struct cm3629_info *lpi)
+{
+	int ret = 0;
+	char cmd[3] = {0};
+
+	ret = gpio_request(lpi->intr_pin, "gpio_cm3629_intr");
+	if (ret < 0) {
+		pr_err("[PS][cm3629 error]%s: gpio %d request failed (%d)\n",
+			__func__, lpi->intr_pin, ret);
+		return ret;
+	}
+
+	ret = gpio_direction_input(lpi->intr_pin);
+	if (ret < 0) {
+		pr_err(
+			"[PS][cm3629 error]%s: fail to set gpio %d as input (%d)\n",
+			__func__, lpi->intr_pin, ret);
+		goto fail_free_intr_pin;
+	}
+
+	ls_initial_cmd(lpi);
+	psensor_initial_cmd(lpi);
+
+	
+	cmd[0] = lpi->ps_conf1_val | CM3629_PS1_SD | CM3629_PS2_SD;
+	cmd[1] = lpi->ps_conf2_val;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address, PS_config, cmd, 3);
+
+	cmd[0] = lpi->ps_conf3_val;
+	cmd[1] = CM3629_PS_255_STEPS;
+	_cm3629_I2C_Write2(lpi->cm3629_slave_address, PS_config_ms, cmd, 3);
+
+	ret = request_any_context_irq(lpi->irq,
+			cm3629_irq_handler,
+			IRQF_TRIGGER_LOW,
+			"cm3629",
+			lpi);
+	if (ret < 0) {
+		pr_err(
+			"[PS][cm3629 error]%s: req_irq(%d) fail for gpio %d (%d)\n",
+			__func__, lpi->irq,
+			lpi->intr_pin, ret);
+		goto fail_free_intr_pin;
+	}
+
+	return ret;
+
+fail_free_intr_pin:
+	gpio_free(lpi->intr_pin);
+	return ret;
+}
+
+static void cm3629_early_suspend(struct early_suspend *h)
+{
+	struct cm3629_info *lpi = lp_info;
+
+	D("[LS][cm3629] %s\n", __func__);
+
+	if (lpi->ps_enable == 0)
+		sensor_lpm_power(1);
+	else
+		D("[PS][cm3629] %s: Psensor enable, so did not enter lpm\n", __func__);
+}
+
+static void cm3629_late_resume(struct early_suspend *h)
+{
+	sensor_lpm_power(0);
+	D("[LS][cm3629] %s\n", __func__);
+
+}
+
+static int cm3629_probe(struct i2c_client *client,
+	const struct i2c_device_id *id)
+{
+	int ret = 0;
+	struct cm3629_info *lpi;
+	struct cm3629_platform_data *pdata;
+
+	D("[PS][cm3629] %s\n", __func__);
+
+
+	lpi = kzalloc(sizeof(struct cm3629_info), GFP_KERNEL);
+	if (!lpi)
+		return -ENOMEM;
+
+	
+
+	lpi->i2c_client = client;
+	pdata = client->dev.platform_data;
+	if (!pdata) {
+		pr_err("[PS][cm3629 error]%s: Assign platform_data error!!\n",
+			__func__);
+		ret = -EBUSY;
+		goto err_platform_data_null;
+	}
+
+	lpi->irq = client->irq;
+
+	lpi->mfg_mode = board_mfg_mode();
+
+	i2c_set_clientdata(client, lpi);
+	lpi->model = pdata->model;
+	lpi->intr_pin = pdata->intr;
+	lpi->adc_table = pdata->levels;
+	lpi->golden_adc = pdata->golden_adc;
+	lpi->power = pdata->power;
+	lpi->lpm_power = pdata->lpm_power;
+	lpi->cm3629_slave_address = pdata->cm3629_slave_address;
+	lpi->ps_select = pdata->ps_select;
+	lpi->ps1_thd_set = pdata->ps1_thd_set;
+	lpi->ps1_thh_diff = pdata->ps1_thh_diff;
+	lpi->ps2_thd_set = pdata->ps2_thd_set;
+	lpi->ps_conf1_val = pdata->ps_conf1_val;
+	lpi->ps_conf2_val = pdata->ps_conf2_val;
+	lpi->ps_conf1_val_from_board = pdata->ps_conf1_val;
+	lpi->ps_conf2_val_from_board = pdata->ps_conf2_val;
+	lpi->ps_conf3_val = pdata->ps_conf3_val;
+	lpi->ps_calibration_rule = pdata->ps_calibration_rule;
+	lpi->j_start = 0;
+	lpi->j_end = 0;
+	lpi->mapping_table = pdata->mapping_table;
+	lpi->mapping_size = pdata->mapping_size;
+	lpi->ps_base_index = (pdata->mapping_size - 1);
+	lpi->enable_polling_ignore = pdata->enable_polling_ignore;
+	lpi->ps1_thd_no_cal = pdata->ps1_thd_no_cal;
+	lpi->ps1_thd_with_cal = pdata->ps1_thd_with_cal;
+	lpi->ps2_thd_no_cal = pdata->ps2_thd_no_cal;
+	lpi->ps2_thd_with_cal = pdata->ps2_thd_with_cal;
+	lpi->ls_cmd  = pdata->ls_cmd;
+	lpi->ps1_adc_offset = pdata->ps1_adc_offset;
+	lpi->ps2_adc_offset = pdata->ps2_adc_offset;
+	lpi->ps_debounce = pdata->ps_debounce;
+	lpi->ps_delay_time = pdata->ps_delay_time;
+	lpi->no_need_change_setting = pdata->no_need_change_setting;
+	lpi->ps_th_add = TH_ADD;
+	lpi->dark_level = pdata->dark_level;
+
+	lp_info = lpi;
+
+	ret = cm3629_read_chip_id(lpi);
+	if (ret < 0) {
+		pr_err("[PS_ERR][cm3629 error]%s: cm3629_read_chip_id error!\n", __func__);
+		goto err_cm3629_read_chip_id;
+	}
+
+	if (pdata->ls_cmd == 0) {
+		if (sensor_chipId[0] != 0x29)
+			lpi->ls_cmd  = CM3629_ALS_IT_320ms | CM3629_ALS_PERS_1;
+		else
+			lpi->ls_cmd  = CM3629_ALS_IT_400ms | CM3629_ALS_PERS_1;
+
+		pr_info("[PS][cm3629]%s: lp_info->ls_cmd = 0x%x!\n",
+			__func__, lp_info->ls_cmd);
+	}
+	D("[PS][cm3629] %s: ls_cmd 0x%x, ps1_adc_offset=0x%02X, "
+	  "ps2_adc_offset=0x%02X, ps_debounce=0x%x, ps1_thh_diff %d\n",
+	  __func__, lpi->ls_cmd, lpi->ps1_adc_offset,
+	  lpi->ps2_adc_offset, lpi->ps_debounce, lpi->ps1_thh_diff);
+
+	mutex_init(&als_enable_mutex);
+	mutex_init(&als_disable_mutex);
+	mutex_init(&als_get_adc_mutex);
+	mutex_init(&ps_enable_mutex);
+
+	ps_hal_enable = ps_drv_enable = 0;
+
+	ret = lightsensor_setup(lpi);
+	if (ret < 0) {
+		pr_err("[LS][cm3629 error]%s: lightsensor_setup error!!\n",
+			__func__);
+		goto err_lightsensor_setup;
+	}
+
+	ret = psensor_setup(lpi);
+	if (ret < 0) {
+		pr_err("[PS][cm3629 error]%s: psensor_setup error!!\n",
+			__func__);
+		goto err_psensor_setup;
+	}
+
+	lightsensor_set_kvalue(lpi);
+	ret = lightsensor_update_table(lpi);
+	if (ret < 0) {
+		pr_err("[LS][cm3629 error]%s: update ls table fail\n",
+			__func__);
+		goto err_lightsensor_update_table;
+	}
+
+	lpi->lp_wq = create_singlethread_workqueue("cm3629_wq");
+	if (!lpi->lp_wq) {
+		pr_err("[PS][cm3629 error]%s: can't create workqueue\n", __func__);
+		ret = -ENOMEM;
+		goto err_create_singlethread_workqueue;
+	}
+
+	wake_lock_init(&(lpi->ps_wake_lock), WAKE_LOCK_SUSPEND, "proximity");
+
+	psensor_set_kvalue(lpi);
+
+#ifdef POLLING_PROXIMITY
+	if (lpi->enable_polling_ignore == 1)
+		lpi->original_ps_thd_set = lpi->ps1_thd_set;
+#endif
+	ret = cm3629_setup(lpi);
+	if (ret < 0) {
+		pr_err("[PS_ERR][cm3629 error]%s: cm3629_setup error!\n", __func__);
+		goto err_cm3629_setup;
+	}
+	ps1_canc_set = lpi->inte_ps1_canc;
+	ps2_canc_set = lpi->inte_ps2_canc;
+	ps1_offset_adc = lpi->ps1_adc_offset;
+	ps2_offset_adc = lpi->ps2_adc_offset;
+	lpi->cm3629_class = class_create(THIS_MODULE, "optical_sensors");
+	if (IS_ERR(lpi->cm3629_class)) {
+		ret = PTR_ERR(lpi->cm3629_class);
+		lpi->cm3629_class = NULL;
+		goto err_create_class;
+	}
+
+	lpi->ls_dev = device_create(lpi->cm3629_class,
+				NULL, 0, "%s", "lightsensor");
+	if (unlikely(IS_ERR(lpi->ls_dev))) {
+		ret = PTR_ERR(lpi->ls_dev);
+		lpi->ls_dev = NULL;
+		goto err_create_ls_device;
+	}
+
+	
+	ret = device_create_file(lpi->ls_dev, &dev_attr_ls_adc);
+	if (ret)
+		goto err_create_ls_device_file;
+
+	
+	ret = device_create_file(lpi->ls_dev, &dev_attr_ls_auto);
+	if (ret)
+		goto err_create_ls_device_file;
+
+	
+	ret = device_create_file(lpi->ls_dev, &dev_attr_ls_kadc);
+	if (ret)
+		goto err_create_ls_device_file;
+
+	ret = device_create_file(lpi->ls_dev, &dev_attr_ls_adc_table);
+	if (ret)
+		goto err_create_ls_device_file;
+
+	ret = device_create_file(lpi->ls_dev, &dev_attr_ls_flevel);
+	if (ret)
+		goto err_create_ls_device_file;
+
+	ret = device_create_file(lpi->ls_dev, &dev_attr_ls_dark_level);
+	if (ret)
+		goto err_create_ls_device_file;
+
+	lpi->ps_dev = device_create(lpi->cm3629_class,
+				NULL, 0, "%s", "proximity");
+	if (unlikely(IS_ERR(lpi->ps_dev))) {
+		ret = PTR_ERR(lpi->ps_dev);
+		lpi->ps_dev = NULL;
+		goto err_create_ls_device_file;
+	}
+
+	
+	ret = device_create_file(lpi->ps_dev, &dev_attr_ps_adc);
+	if (ret)
+		goto err_create_ps_device;
+
+	
+	ret = device_create_file(lpi->ps_dev, &dev_attr_ps_kadc);
+	if (ret)
+		goto err_create_ps_device;
+
+	
+	ret = device_create_file(lpi->ps_dev, &dev_attr_ps_canc);
+	if (ret)
+		goto err_create_ps_device;
+
+	ret = device_create_file(lpi->ps_dev, &dev_attr_ps_hw);
+	if (ret)
+		goto err_create_ps_device;
+
+	ret = device_create_file(lpi->ps_dev, &dev_attr_ps_i2c);
+	if (ret)
+		goto err_create_ps_device;
+
+	ret = device_create_file(lpi->ps_dev, &dev_attr_ps_headset_bt_plugin);
+	if (ret)
+		goto err_create_ps_device;
+
+	ret = device_create_file(lpi->ps_dev, &dev_attr_ps_workaround_table);
+	if (ret)
+		goto err_create_ps_device;
+
+	ret = device_create_file(lpi->ps_dev, &dev_attr_ps_fixed_thd_add);
+	if (ret)
+		goto err_create_ps_device;
+
+	lpi->early_suspend.level =
+			EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
+	lpi->early_suspend.suspend = cm3629_early_suspend;
+	lpi->early_suspend.resume = cm3629_late_resume;
+	register_early_suspend(&lpi->early_suspend);
+	sensor_lpm_power(0);
+	D("[PS][cm3629] %s: Probe success!\n", __func__);
+	is_probe_success = 1;
+	return ret;
+
+err_create_ps_device:
+	device_unregister(lpi->ps_dev);
+err_create_ls_device_file:
+	device_unregister(lpi->ls_dev);
+err_create_ls_device:
+	class_destroy(lpi->cm3629_class);
+err_create_class:
+err_cm3629_setup:
+	destroy_workqueue(lpi->lp_wq);
+	wake_lock_destroy(&(lpi->ps_wake_lock));
+	input_unregister_device(lpi->ls_input_dev);
+	input_free_device(lpi->ls_input_dev);
+	input_unregister_device(lpi->ps_input_dev);
+	input_free_device(lpi->ps_input_dev);
+err_create_singlethread_workqueue:
+err_lightsensor_update_table:
+	misc_deregister(&psensor_misc);
+err_psensor_setup:
+	misc_deregister(&lightsensor_misc);
+err_lightsensor_setup:
+	mutex_destroy(&als_enable_mutex);
+	mutex_destroy(&als_disable_mutex);
+	mutex_destroy(&als_get_adc_mutex);
+err_cm3629_read_chip_id:
+err_platform_data_null:
+	kfree(lpi);
+	return ret;
+}
+
+static const struct i2c_device_id cm3629_i2c_id[] = {
+	{CM3629_I2C_NAME, 0},
+	{}
+};
+
+static struct i2c_driver cm3629_driver = {
+	.id_table = cm3629_i2c_id,
+	.probe = cm3629_probe,
+	.driver = {
+		.name = CM3629_I2C_NAME,
+		.owner = THIS_MODULE,
+	},
+};
+
+static int __init cm3629_init(void)
+{
+	return i2c_add_driver(&cm3629_driver);
+}
+
+static void __exit cm3629_exit(void)
+{
+	i2c_del_driver(&cm3629_driver);
+}
+
+module_init(cm3629_init);
+module_exit(cm3629_exit);
+
+MODULE_DESCRIPTION("cm3629 Driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/input/misc/ewtzmu2.c b/drivers/input/misc/ewtzmu2.c
new file mode 100644
index 0000000..f0ad0b3
--- /dev/null
+++ b/drivers/input/misc/ewtzmu2.c
@@ -0,0 +1,2654 @@
+/* drivers/i2c/chips/ewtzmu2.c - Panasonic Gyro driver
+ *
+ * Copyright (C) 2011 Prolific Technology Inc.
+ * Author: Kyle Chen
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#define HTC_VERSION  1
+
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <linux/slab.h>
+#include <linux/irq.h>
+#include <linux/miscdevice.h>
+#include <linux/uaccess.h>
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/workqueue.h>
+#include <linux/ewtzmu2.h>
+#include <linux/ewtzmu2_cal.h>
+#include <linux/kobject.h>
+#include <linux/poll.h>
+#include <linux/gpio.h>
+#include <linux/akm8975.h>
+#include <linux/module.h>
+
+#ifndef HTC_VERSION
+#include <linux/i2c/ak8973.h>
+#endif
+
+int debug_flag;
+#define D(x...) printk(KERN_DEBUG "[GYRO][PANASONIC] " x)
+#define I(x...) printk(KERN_INFO "[GYRO][PANASONIC] " x)
+#define E(x...) printk(KERN_ERR "[GYRO][PANASONIC ERROR] " x)
+#define DIF(x...) { \
+	if (debug_flag) \
+		printk(KERN_DEBUG "[GYRO][PANASONIC DEBUG] " x); }
+
+#define EWTZMU_DRV_NAME         "ewtzmu2"
+#define DRIVER_VERSION          "1.0.0.2"
+#define DEVICE_ACCESSORY_ATTR(_name, _mode, _show, _store) \
+struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
+
+static struct i2c_client *ewtzmu_i2c_client;
+int Gyro_samplerate_status = 1;
+static DECLARE_WAIT_QUEUE_HEAD(open_wq);
+static atomic_t open_flag;
+static bool Gyro_init_fail = 0;
+
+struct _ewtzmu_data {
+	rwlock_t lock;
+	int chipset;
+	int mode;
+	int i2c_read_addr;
+	int i2c_read_len;
+} ewtzmu_data;
+
+struct ewtzmu_vec_t {
+	int x;
+	int y;
+	int z;
+};
+
+struct ewtzmu_pedo_t {
+	unsigned long pedo_step;
+	unsigned long pedo_time;
+	int pedo_stat;
+};
+
+struct _ewtzmumid_data {
+	rwlock_t datalock;
+	rwlock_t ctrllock;
+	int controldata[EW_CB_LENGTH];
+	int dirpolarity[EW_DP_LENGTH];
+	int pedometerparam[EW_PD_LENGTH];
+	int yaw;
+	int roll;
+	int pitch;
+	struct ewtzmu_vec_t nm;
+	struct ewtzmu_vec_t na;
+	struct ewtzmu_vec_t gyro;
+	struct ewtzmu_pedo_t pedo;
+	struct ewtzmu_vec_t linear_accel;
+	struct ewtzmu_vec_t gravity;
+	int	rotationvector[4];
+	int status;
+	struct class *htc_gyro_class;
+	struct device *gyro_dev;
+	void (*config_gyro_diag_gpios)(bool enable);
+	int sleep_pin;
+} ewtzmumid_data;
+
+struct ewtzmu_i2c_data {
+	struct input_dev *input_dev_compass;
+	struct input_dev *input_dev_gyroscope;
+	struct i2c_client *client;
+#ifdef HTC_VERSION
+	struct pana_gyro_platform_data *pdata;
+#else
+	struct akm8973_platform_data *pdata;
+#endif
+};
+
+static atomic_t dev_open_count;
+#ifndef HTC_VERSION
+static atomic_t hal_open_count;
+#endif
+static atomic_t daemon_open_count;
+
+static atomic_t o_status;
+static atomic_t a_status;
+static atomic_t m_status;
+static atomic_t g_status;
+static atomic_t rv_status;
+static atomic_t la_status;
+static atomic_t gv_status;
+
+static atomic_t off_status;
+static atomic_t off_status_hal;
+static int m_o_times;
+
+static int EWTZMU2_I2C_Read(int reg_addr, int buf_len, int *buf)
+{
+	int res = 0;
+	u8  regaddr;
+	u8  readdata[64];
+
+	memset(readdata, 0x00, sizeof(readdata));
+
+	if (!ewtzmu_i2c_client) {
+	*buf = 0;
+	E("%s  error, ewtzmu_i2c_client = NULL\n", __func__);
+	return -2;
+	}
+
+	regaddr = (u8)reg_addr;
+
+	res = i2c_master_send(ewtzmu_i2c_client, &regaddr, 1);
+	if (res <= 0) {
+		E("%s EWTZMU2_I2C_Read error res = %d\n", __func__, res);
+		return res;
+	}
+
+	udelay(20);
+	res = i2c_master_recv(ewtzmu_i2c_client, readdata, buf_len);
+	if (res <= 0) {
+		E("%s EWTZMU2_I2C_Read error res = %d\n", __func__, res);
+		return res;
+	}
+
+	memcpy(buf, (int *)readdata, buf_len);
+	I("%s, ok, reg_addr = 0x%x,"
+		"buf_len = %d\n",
+		__func__, reg_addr, buf_len);
+	return 1;
+}
+
+static int EWTZMU2_I2C_Write(int reg_addr, int buf_len, int *buf)
+{
+	int res = 0;
+	u8 databuffer[64];
+
+	memset(databuffer, 0x00, sizeof(databuffer));
+
+	if ((buf_len+2) > 64) {
+		E("%s  error, (buf_len+2) > 64),"
+			"buf_len %d \n",
+			__func__, buf_len);
+		return -EINVAL;
+	}
+
+	if (!ewtzmu_i2c_client) {
+	E("%s  error, ewtzmu_i2c_client = NULL\n", __func__);
+	return -2;
+	}
+
+	databuffer[0] = (u8)reg_addr;
+	memcpy(&databuffer[1], (u8 *)buf, (buf_len-1));
+
+	res = i2c_master_send(ewtzmu_i2c_client, databuffer, buf_len);
+	if (res <= 0)
+		E("%s EWTZMU2_I2C_Write error res = %d\n", __func__, res);
+
+	I("%s, ok, reg_addr = 0x%x,"
+		"buf_len = %d\n",
+		__func__, reg_addr, buf_len);
+	return 1;
+}
+static int EWTZMU2_GetOpenStatus(void)
+{
+	I("%s:\n", __func__);
+	wait_event_interruptible(open_wq, (atomic_read(&open_flag) > 0));
+	I("%s:wait OK\n", __func__);
+	return atomic_read(&open_flag);
+}
+
+static int EWTZMU2_Chipset_Init(void)
+{
+	u8 databuf[10];
+	u8 regaddr;
+	u8 ctrl = 0;
+	int res = 0;
+
+	regaddr = EWTZMU_REG_PWR_MGM;
+	res = i2c_master_send(ewtzmu_i2c_client, &regaddr, 1);
+	if (res <= 0)
+		goto exit_EWTZMU2_Chipset_Init;
+	res = i2c_master_recv(ewtzmu_i2c_client, &ctrl, 1);
+	if (res <= 0)
+		goto exit_EWTZMU2_Chipset_Init;
+
+	databuf[0] = EWTZMU_REG_PWR_MGM;
+	databuf[1] = ctrl | EWTZMU_POWERON;
+	res = i2c_master_send(ewtzmu_i2c_client, databuf, 2);
+	if (res <= 0)
+		goto exit_EWTZMU2_Chipset_Init;
+
+	databuf[0] = EWTZMU_INT;
+	databuf[1] = EWTZMU_WTMON;
+	res = i2c_master_send(ewtzmu_i2c_client, databuf, 2);
+	if (res <= 0)
+		goto exit_EWTZMU2_Chipset_Init;
+
+	databuf[0] = EWTZMU_DLPF;
+	databuf[1] = EWTZMU_2000ds_1khz|EWTZMU_HPF;
+	res = i2c_master_send(ewtzmu_i2c_client, databuf, 2);
+	if (res <= 0)
+		goto exit_EWTZMU2_Chipset_Init;
+
+	databuf[0] = EWTZMU_SMPL;
+	databuf[1] = EWTZMU_100hz;
+	res = i2c_master_send(ewtzmu_i2c_client, databuf, 2);
+	if (res <= 0)
+		goto exit_EWTZMU2_Chipset_Init;
+
+	databuf[0] = EWTZMU_FIFO_CTR;
+	databuf[1] = EWTZMU_stream | EWTZMU_SAMPLE_50HZ;
+	res = i2c_master_send(ewtzmu_i2c_client, databuf, 2);
+	if (res <= 0)
+		goto exit_EWTZMU2_Chipset_Init;
+
+	I("init chipset: ret value=%d\n", res);
+exit_EWTZMU2_Chipset_Init:
+	if (res <= 0) {
+	E("Fail to init chipset(I2C error): ret value=%d\n", res);
+	Gyro_init_fail = 1;
+	return -1;
+	}
+	return 0;
+}
+
+static int EWTZMU2_Chip_Set_SampleRate(int sample_rate_state)
+{
+	u8 databuf[10];
+	int res = 0;
+
+	I("sample_rate_state=%d\n", sample_rate_state);
+	if (gpio_get_value(ewtzmumid_data.sleep_pin) == 1) {
+		I("Dont set sample_rate_state=%d, when gyro sleep\n", sample_rate_state);
+		Gyro_samplerate_status = sample_rate_state;
+		return 0;
+	}
+	if (sample_rate_state == 0) {
+		Gyro_samplerate_status = 0;
+		databuf[0] = EWTZMU_FIFO_CTR;
+		databuf[1] = EWTZMU_stream | EWTZMU_SAMPLE_100HZ;
+		res = i2c_master_send(ewtzmu_i2c_client, databuf, 2);
+		if (res <= 0)
+			goto exit_EWTZMU2_Chip_Set_SampleRate;
+	} else if (sample_rate_state == 1) {
+		Gyro_samplerate_status = 1;
+		databuf[0] = EWTZMU_FIFO_CTR;
+		databuf[1] = EWTZMU_stream | EWTZMU_SAMPLE_50HZ;
+		res = i2c_master_send(ewtzmu_i2c_client, databuf, 2);
+		if (res <= 0)
+			goto exit_EWTZMU2_Chip_Set_SampleRate;
+	} else if (sample_rate_state == 2) {
+		Gyro_samplerate_status = 2;
+		databuf[0] = EWTZMU_FIFO_CTR;
+		databuf[1] = EWTZMU_stream | EWTZMU_SAMPLE_16HZ;
+		res = i2c_master_send(ewtzmu_i2c_client, databuf, 2);
+		if (res <= 0)
+			goto exit_EWTZMU2_Chip_Set_SampleRate;
+	} else if (sample_rate_state == 3) {
+		Gyro_samplerate_status = 3;
+		databuf[0] = EWTZMU_FIFO_CTR;
+		databuf[1] = EWTZMU_stream | EWTZMU_SAMPLE_5HZ;
+		res = i2c_master_send(ewtzmu_i2c_client, databuf, 2);
+		if (res <= 0)
+			goto exit_EWTZMU2_Chip_Set_SampleRate;
+	} else {
+		goto exit_EWTZMU2_Chip_Set_SampleRate;
+	}
+
+exit_EWTZMU2_Chip_Set_SampleRate:
+	if (res <= 0) {
+		E("Fail to init chipset(I2C error): ret value=%d\n", res);
+		return -1;
+	}
+	return 0;
+}
+
+static int EWTZMU2_ReadChipInfo(char *buf, int bufsize)
+{
+	if ((!buf) || (bufsize <= 30))
+		return -1;
+
+	if (!ewtzmu_i2c_client) {
+		*buf = 0;
+		return -2;
+	}
+
+	sprintf(buf, "EWTZMU2 Chip");
+
+	return 0;
+}
+
+static int EWTZMU2_WIA(char *wia, int bufsize)
+{
+	unsigned char databuf[10];
+
+	databuf[0] = 0x1D;
+	sprintf(wia, "%02x", databuf[0]);
+	I("WIA=%x", databuf[0]);
+
+	return 0;
+}
+
+static int EWTZMU2_ReadSensorData(char *buf, int bufsize)
+{
+	char cmd;
+	int mode = 0;
+	unsigned char databuf[10];
+	int gyrox, gyroy, gyroz;
+	int res = EW_DRV_SUCCESS;
+
+	if ((!buf) || (bufsize <= 80))
+	return EW_BUFFER_PARAMS;
+
+	if (!ewtzmu_i2c_client) {
+		*buf = 0;
+		return EW_CLIENT_ERROR;
+	}
+
+	read_lock(&ewtzmu_data.lock);
+	mode = ewtzmu_data.mode;
+	read_unlock(&ewtzmu_data.lock);
+
+	gyrox = gyroy = gyroz = 0;
+	
+	cmd = EWTZMU_REG_GYROX_H;
+	res = i2c_master_send(ewtzmu_i2c_client, &cmd, 1);
+	if (res <= 0)
+		goto exit_EWTZMU2_ReadSensorData;
+	udelay(20);
+	res = i2c_master_recv(ewtzmu_i2c_client, &(databuf[0]), 6);
+	if (res <= 0)
+		goto exit_EWTZMU2_ReadSensorData;
+	
+	gyrox = (databuf[0] << 8) | databuf[1];
+	if (gyrox > 32768)
+		gyrox -= 65536;
+	gyroy = (databuf[2] << 8) | databuf[3];
+	if (gyroy > 32768)
+		gyroy -= 65536;
+	gyroz = (databuf[4] << 8) | databuf[5];
+	if (gyroz > 32768)
+		gyroz -= 65536;
+
+exit_EWTZMU2_ReadSensorData:
+	if (res <= 0) {
+		E("Fail to read sensor data(I2C error): ret value=%d\n", res);
+		return -3;
+	} else {
+		sprintf(buf, "%4x %4x %4x", gyrox, gyroy, gyroz);
+		res = EW_DRV_SUCCESS;
+	}
+	return res;
+}
+
+
+static int EWTZMU2_ReadSensorDataFIFO(unsigned char *buf, int bufsize)
+{
+	char cmd;
+	int mode = 0;
+	unsigned char databuf[200];
+	int res = EW_DRV_SUCCESS, databyte = 6;
+
+	if ((!buf) || (bufsize < 121))
+		return EW_BUFFER_PARAMS;
+
+	if (!ewtzmu_i2c_client) {
+		*buf = 0;
+		return EW_CLIENT_ERROR;
+	}
+
+	read_lock(&ewtzmu_data.lock);
+	mode = ewtzmu_data.mode;
+	read_unlock(&ewtzmu_data.lock);
+
+	cmd = EWTZMU_REG_GYROX_H;
+	res = i2c_master_send(ewtzmu_i2c_client, &cmd, 1);
+	if (res <= 0)
+		goto exit_EWTZMU2_ReadSensorDataFIFO;
+	udelay(20);
+
+	if (Gyro_samplerate_status == 0) {
+		databyte = 6;
+		res = i2c_master_recv(ewtzmu_i2c_client, &(databuf[0]), 6);
+	} else if (Gyro_samplerate_status == 1) {
+		databyte = 12;
+		res = i2c_master_recv(ewtzmu_i2c_client, &(databuf[0]), 12);
+	} else if (Gyro_samplerate_status == 2) {
+		databyte = 36;
+		res = i2c_master_recv(ewtzmu_i2c_client, &(databuf[0]), 36);
+	} else if (Gyro_samplerate_status == 3) {
+		databyte = 120;
+		res = i2c_master_recv(ewtzmu_i2c_client, &(databuf[0]), 120);
+	}
+
+	if (res <= 0)
+		goto exit_EWTZMU2_ReadSensorDataFIFO;
+exit_EWTZMU2_ReadSensorDataFIFO:
+	if (res <= 0) {
+	E("Fail to read sensor data(I2C error): ret value=%d\n", res);
+		res = EW_I2C_ERROR;
+	} else {
+		memcpy(&(buf[1]), databuf, databyte);
+		buf[0] = (unsigned char) databyte;
+		DIF("sensordata 1:%d %d ,%d %d, %d %d\n",
+		databuf[0], databuf[1], databuf[2],
+		databuf[3], databuf[4], databuf[5]);
+		DIF("sensordata 2:%d %d ,%d %d, %d %d\n",
+		databuf[6], databuf[7], databuf[8],
+		 databuf[9], databuf[10], databuf[11]);
+		res = EW_DRV_SUCCESS;
+	}
+	return res;
+}
+
+static int Set_Report_Sensor_Flag(int controldata_active_sensor)
+{
+	if (controldata_active_sensor & EW_BIT_ORIENTATION) {
+		atomic_set(&o_status, 1);
+	} else {
+		m_o_times = 0;
+		atomic_set(&o_status, 0);
+	}
+	if (controldata_active_sensor & EW_BIT_ACCELEROMETER)
+		atomic_set(&a_status, 1);
+	else
+		atomic_set(&a_status, 0);
+
+	if (controldata_active_sensor & EW_BIT_MAGNETIC_FIELD)
+		atomic_set(&m_status, 1);
+	else
+		atomic_set(&m_status, 0);
+
+	if (controldata_active_sensor & EW_BIT_GYROSCOPE)
+		atomic_set(&g_status, 1);
+	else
+		atomic_set(&g_status, 0);
+
+	if (controldata_active_sensor & EW_BIT_ROTATION_VECTOR)
+		atomic_set(&rv_status, 1);
+	else
+		atomic_set(&rv_status, 0);
+
+	if (controldata_active_sensor & EW_BIT_LINEAR_ACCELERATION)
+		atomic_set(&la_status, 1);
+	else
+		atomic_set(&la_status, 0);
+
+	if (controldata_active_sensor & EW_BIT_GRAVITY)
+		atomic_set(&gv_status, 1);
+	else
+		atomic_set(&gv_status, 0);
+	return 0;
+}
+
+static int EWTZMU2_ReadPostureData(char *buf, int bufsize)
+{
+	if ((!buf) || (bufsize <= 80))
+		return -1;
+
+	read_lock(&ewtzmumid_data.datalock);
+	sprintf(buf, "%d %d %d %d",
+		ewtzmumid_data.yaw, ewtzmumid_data.pitch,
+		ewtzmumid_data.roll, ewtzmumid_data.status);
+	read_unlock(&ewtzmumid_data.datalock);
+	return 0;
+}
+
+static int EWTZMU2_ReadCaliData(char *buf, int bufsize)
+{
+	if ((!buf) || (bufsize <= 80))
+		return -1;
+
+	read_lock(&ewtzmumid_data.datalock);
+	sprintf(buf, "%d %d %d %d %d %d %d",
+		ewtzmumid_data.nm.x, ewtzmumid_data.nm.y,
+		ewtzmumid_data.nm.z, ewtzmumid_data.na.x,
+		ewtzmumid_data.na.y, ewtzmumid_data.na.z, ewtzmumid_data.status);
+	read_unlock(&ewtzmumid_data.datalock);
+	return 0;
+}
+
+static int EWTZMU2_ReadGyroData(char *buf, int bufsize)
+{
+	if ((!buf) || (bufsize <= 80))
+		return -1;
+
+	read_lock(&ewtzmumid_data.datalock);
+	sprintf(buf, "%d %d %d", ewtzmumid_data.gyro.x,
+		ewtzmumid_data.gyro.y, ewtzmumid_data.gyro.z);
+	read_unlock(&ewtzmumid_data.datalock);
+	return 0;
+}
+
+static int EWTZMU2_ReadPedoData(char *buf, int bufsize)
+{
+	if ((!buf) || (bufsize <= 80))
+		return -1;
+
+	read_lock(&ewtzmumid_data.datalock);
+	sprintf(buf, "%ld %ld %d", ewtzmumid_data.pedo.pedo_step,
+	ewtzmumid_data.pedo.pedo_time,
+	ewtzmumid_data.pedo.pedo_stat);
+	read_unlock(&ewtzmumid_data.datalock);
+	return 0;
+}
+
+static int EWTZMU2_ReadMiddleControl(char *buf, int bufsize)
+{
+	if ((!buf) || (bufsize <= 80))
+		return -1;
+
+	read_lock(&ewtzmumid_data.ctrllock);
+	sprintf(buf, "%d %d %d %d %d %d %d %d %d %d",
+	ewtzmumid_data.controldata[EW_CB_LOOPDELAY],
+	ewtzmumid_data.controldata[EW_CB_RUN],
+	ewtzmumid_data.controldata[EW_CB_ACCCALI],
+	ewtzmumid_data.controldata[EW_CB_MAGCALI],
+	ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS],
+	ewtzmumid_data.controldata[EW_CB_PD_RESET],
+	ewtzmumid_data.controldata[EW_CB_PD_EN_PARAM],
+	ewtzmumid_data.controldata[EW_CB_GYROCALI],
+	ewtzmumid_data.controldata[EW_CB_ALGORITHMLOG],
+	ewtzmumid_data.controldata[EW_CB_UNDEFINE_1]);
+	read_unlock(&ewtzmumid_data.ctrllock);
+	return 0;
+}
+
+static int EWTZMU2_ReadRotationVector(char *buf, int bufsize)
+{
+	if ((!buf) || (bufsize <= 80))
+		return -1;
+
+	read_lock(&ewtzmumid_data.datalock);
+	sprintf(buf, "%d %d %d %d", ewtzmumid_data.rotationvector[0],
+	ewtzmumid_data.rotationvector[1], ewtzmumid_data.rotationvector[2],
+	ewtzmumid_data.rotationvector[3]);
+	read_unlock(&ewtzmumid_data.datalock);
+	return 0;
+}
+
+static int EWTZMU2_ReadLinearAccel(char *buf, int bufsize)
+{
+	if ((!buf) || (bufsize <= 80))
+		return -1;
+
+	read_lock(&ewtzmumid_data.datalock);
+	sprintf(buf, "%d %d %d", ewtzmumid_data.linear_accel.x,
+	ewtzmumid_data.linear_accel.y, ewtzmumid_data.linear_accel.z);
+	read_unlock(&ewtzmumid_data.datalock);
+	return 0;
+}
+
+static int EWTZMU2_ReadGravity(char *buf, int bufsize)
+{
+	if ((!buf) || (bufsize <= 80))
+		return -1;
+
+	read_lock(&ewtzmumid_data.datalock);
+	sprintf(buf, "%d %d %d", ewtzmumid_data.gravity.x,
+	ewtzmumid_data.gravity.y, ewtzmumid_data.gravity.z);
+	read_unlock(&ewtzmumid_data.datalock);
+	return 0;
+}
+int EWTZMU2_Report_Value_akm(int ifirst, int x, int y, int z)
+{
+	struct ewtzmu_i2c_data *data;
+	static int report_times;
+	static int x_data, y_data, z_data;
+
+	if (Gyro_init_fail) {
+		E("%s  error, init fail. do nothing\n", __func__);
+		return -1;
+	}
+
+	if (!ewtzmu_i2c_client) {
+		E("%s  error, ewtzmu_i2c_client = NULL\n", __func__);
+		return -1;
+	}
+	data = i2c_get_clientdata(ewtzmu_i2c_client);
+	if (ifirst == 1) {
+		if (x == x_data) {
+			x = x_data+1;
+			I("a_status : gsensor data x data same, so +1 : %d, %d \n", x, x_data);
+		}
+
+		if (y == y_data) {
+			y = y_data+1;
+			I("a_status : gsensor data y data same, so +1 : %d, %d \n", y, y_data);
+		}
+
+		if (z == z_data) {
+			z = z_data+1;
+			I("a_status : gsensor data z data same, so +1 : %d, %d \n", z, z_data);
+		}
+		I("a_status : first gsensor data: %d, %d, %d\n", x, z, y);
+	}
+	x_data = x;
+	y_data = y;
+	z_data = z;
+
+	report_times++;
+	if (report_times > ((200 - (Gyro_samplerate_status * 50)) / (1 + Gyro_samplerate_status))) {
+		I("a_status : gsensor data: %d, %d, %d\n", x, z, y);
+		report_times = 0;
+	}
+	input_report_abs(data->input_dev_compass, ABS_X, x);
+	input_report_abs(data->input_dev_compass, ABS_Y, y);
+	input_report_abs(data->input_dev_compass, ABS_Z, z);
+	input_sync(data->input_dev_compass);
+
+	return 0;
+}
+
+int EWTZMU2_Report_Value(void)
+{
+	struct ewtzmu_i2c_data *data = i2c_get_clientdata(ewtzmu_i2c_client);
+	int report_enable = 0;
+	static int report_gyro_times;
+	static int report_pitch_times;
+	static int report_rota_times;
+
+	DIF("EWTZMU2_Report_Value\n");
+	if (atomic_read(&o_status) && m_o_times) {
+		report_pitch_times++;
+		if (report_pitch_times > ((200 - (Gyro_samplerate_status * 50)) / (1 + Gyro_samplerate_status))) {
+			I("o_status, pitch %d, roll %d, , yaw %d\n",
+				ewtzmumid_data.pitch, ewtzmumid_data.roll, ewtzmumid_data.yaw);
+			report_pitch_times = 0;
+		}
+		DIF("EWTZMU2_Report_Value o_status, pitch %d, roll %d, , yaw %d\n",
+		ewtzmumid_data.pitch, ewtzmumid_data.roll, ewtzmumid_data.yaw);
+		input_report_abs(data->input_dev_compass, ABS_RX, ewtzmumid_data.yaw);
+		input_report_abs(data->input_dev_compass, ABS_RY, ewtzmumid_data.pitch);
+		input_report_abs(data->input_dev_compass, ABS_RZ, ewtzmumid_data.roll);
+		input_report_abs(data->input_dev_compass, ABS_RUDDER, ewtzmumid_data.status);
+				
+		report_enable = EW_REPORT_EN_COMPASS;
+	}
+
+	if (atomic_read(&m_status)) {
+		DIF("EWTZMU2_Report_Value m_status\n ");
+		input_report_abs(data->input_dev_compass,
+		ABS_HAT0X, ewtzmumid_data.nm.x);
+	input_report_abs(data->input_dev_compass,
+	 ABS_HAT0Y, ewtzmumid_data.nm.y);
+	input_report_abs(data->input_dev_compass, ABS_BRAKE,
+	ewtzmumid_data.nm.z);
+	input_report_abs(data->input_dev_compass, ABS_WHEEL,
+	ewtzmumid_data.status);
+	report_enable = EW_REPORT_EN_COMPASS;
+	}
+	if (atomic_read(&rv_status)) {
+		report_rota_times++;
+		if (report_rota_times > ((200 - (Gyro_samplerate_status * 50)) / (1 + Gyro_samplerate_status))) {
+			I("rv_status, %d, %d, %d, %d\n ",
+			 ewtzmumid_data.rotationvector[0],
+			ewtzmumid_data.rotationvector[1],
+			ewtzmumid_data.rotationvector[2],
+			ewtzmumid_data.rotationvector[3]);
+			report_rota_times = 0;
+		}
+		DIF("EWTZMU2_Report_Value rv_status, %d, %d, %d, %d\n ",
+			 ewtzmumid_data.rotationvector[0],
+			ewtzmumid_data.rotationvector[1],
+			ewtzmumid_data.rotationvector[2],
+			ewtzmumid_data.rotationvector[3]);
+		input_report_abs(data->input_dev_compass, ABS_HAT3X,
+		ewtzmumid_data.rotationvector[0]);
+		input_report_abs(data->input_dev_compass, ABS_HAT3Y,
+		ewtzmumid_data.rotationvector[1]);
+		input_report_abs(data->input_dev_compass, ABS_TILT_X,
+		ewtzmumid_data.rotationvector[2]);
+		input_report_abs(data->input_dev_compass, ABS_TILT_Y,
+		ewtzmumid_data.rotationvector[3]);
+		report_enable = EW_REPORT_EN_COMPASS;
+	}
+	if (atomic_read(&la_status)) {
+		DIF("EWTZMU2_Report_Value la_status\n ");
+		input_report_abs(data->input_dev_compass, ABS_HAT1X,
+		ewtzmumid_data.linear_accel.x);
+		input_report_abs(data->input_dev_compass, ABS_HAT1Y,
+		ewtzmumid_data.linear_accel.y);
+		input_report_abs(data->input_dev_compass, ABS_TOOL_WIDTH,
+		ewtzmumid_data.linear_accel.z);
+		report_enable = EW_REPORT_EN_COMPASS;
+	}
+
+	if (atomic_read(&gv_status)) {
+		DIF("EWTZMU2_Report_Value gv_status\n ");
+		input_report_abs(data->input_dev_compass, ABS_HAT2X,
+		ewtzmumid_data.gravity.x);
+		input_report_abs(data->input_dev_compass, ABS_HAT2Y,
+		ewtzmumid_data.gravity.y);
+		input_report_abs(data->input_dev_compass, ABS_VOLUME,
+		ewtzmumid_data.gravity.z);
+		report_enable = EW_REPORT_EN_COMPASS;
+	}
+
+	if (EW_REPORT_EN_COMPASS == report_enable) {
+		DIF("EWTZMU2_Report_Value EW_REPORT_EN_COMPASS, o = %d, a = %d, g =%d\n ",
+		atomic_read(&o_status), atomic_read(&a_status), atomic_read(&m_status));
+		input_event(data->input_dev_compass, EV_SYN, SYN_REPORT, 1);
+		input_sync(data->input_dev_compass);
+	}
+
+	if (atomic_read(&g_status)) {
+		report_gyro_times++;
+		if (report_gyro_times > ((200 - (Gyro_samplerate_status * 50)) / (1 + Gyro_samplerate_status))) {
+			I("gyro_status, %d, %d, %d\n ",
+			 ewtzmumid_data.gyro.x,
+			ewtzmumid_data.gyro.y,
+			ewtzmumid_data.gyro.z);
+			report_gyro_times = 0;
+		}
+		DIF("EWTZMU2_Report_Value g_status\n, ");
+		input_report_rel(data->input_dev_gyroscope, REL_RX,
+		ewtzmumid_data.gyro.x);
+		input_report_rel(data->input_dev_gyroscope, REL_RY,
+		ewtzmumid_data.gyro.y);
+		input_report_rel(data->input_dev_gyroscope, REL_RZ,
+		ewtzmumid_data.gyro.z);
+		report_enable = EW_REPORT_EN_GYROSCOPE;
+	}
+
+	if (EW_REPORT_EN_GYROSCOPE == report_enable) {
+		DIF("EWTZMU2_Report_Value EW_REPORT_EN_GYROSCOPE\n ");
+		input_event(data->input_dev_gyroscope, EV_SYN, SYN_REPORT, 1);
+		input_sync(data->input_dev_gyroscope);
+	}
+
+	return 0;
+}
+
+static int EWTZMU2_Power_Off(void)
+{
+	u8 databuf[10];
+	int res = 0;
+	ewtzmumid_data.config_gyro_diag_gpios(1);
+	if (!ewtzmu_i2c_client) {
+		E("%s, ewtzmu_i2c_client < 0 \n", __func__);
+		return -2;
+	}
+	
+	if (gpio_get_value(ewtzmumid_data.sleep_pin) == 0) {
+		databuf[0] = EWTZMU_REG_PWR_MGM;
+		databuf[1] = EWTZMU_SLEP;
+		res = i2c_master_send(ewtzmu_i2c_client, databuf, 2);
+		if (res <= 0)
+			E("Fail to power off chipset(I2C error): ret value=%d\n", res);
+		msleep(10);
+	}
+	gpio_set_value(ewtzmumid_data.sleep_pin, 1);
+	I("%s\n", __func__);
+	return 0;
+}
+
+static int EWTZMU2_Power_On(void)
+{
+	u8 databuf[10];
+	int res = 0;
+	int i = 0;
+
+	ewtzmumid_data.config_gyro_diag_gpios(0);
+	if (!ewtzmu_i2c_client) {
+		E("%s, ewtzmu_i2c_client < 0 \n", __func__);
+	return -2;
+	}
+	gpio_set_value(ewtzmumid_data.sleep_pin, 0);
+	msleep(50);
+	while (1) {
+		databuf[0] = EWTZMU_REG_PWR_MGM;
+		databuf[1] = EWTZMU_POWERON;
+		res = i2c_master_send(ewtzmu_i2c_client, databuf, 2);
+		msleep(10);
+		if (res > 0 || i > 10) {
+			if (res <= 0)
+				E("Fail to power on chipset(I2C error):ret value=%d\n", res);
+			break;
+		}
+		i++;
+	}
+	i = 0;
+	I("%s start\n", __func__);
+	while (1) {
+		res = EWTZMU2_Chipset_Init();
+		msleep(10);
+		if (res == 0 || i > 3)
+			break;
+		i++;
+	}
+	i = 0;
+	EWTZMU2_Chip_Set_SampleRate(Gyro_samplerate_status);
+	I("%s end\n", __func__);
+	msleep(50);
+	return 0;
+}
+
+static ssize_t show_chipinfo_value(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	char strbuf[EW_BUFSIZE];
+	EWTZMU2_ReadChipInfo(strbuf, EW_BUFSIZE);
+	return sprintf(buf, "%s\n", strbuf);
+}
+
+static ssize_t show_sensordata_value(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	char strbuf[EW_BUFSIZE];
+	EWTZMU2_ReadSensorData(strbuf, EW_BUFSIZE);
+return sprintf(buf, "%s\n", strbuf);
+}
+
+static ssize_t show_posturedata_value(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	char strbuf[EW_BUFSIZE];
+	EWTZMU2_ReadPostureData(strbuf, EW_BUFSIZE);
+	return sprintf(buf, "%s\n", strbuf);
+}
+
+static ssize_t show_calidata_value(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	char strbuf[EW_BUFSIZE];
+	EWTZMU2_ReadCaliData(strbuf, EW_BUFSIZE);
+	return sprintf(buf, "%s\n", strbuf);
+}
+
+static ssize_t show_gyrodata_value(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	char strbuf[EW_BUFSIZE];
+	EWTZMU2_ReadGyroData(strbuf, EW_BUFSIZE);
+	return sprintf(buf, "%s\n", strbuf);
+}
+
+static ssize_t show_rv_value(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	char strbuf[EW_BUFSIZE];
+	EWTZMU2_ReadRotationVector(strbuf, EW_BUFSIZE);
+	return sprintf(buf, "%s\n", strbuf);
+}
+
+static ssize_t show_ladata_value(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	char strbuf[EW_BUFSIZE];
+	EWTZMU2_ReadLinearAccel(strbuf, EW_BUFSIZE);
+	return sprintf(buf, "%s\n", strbuf);
+}
+
+static ssize_t show_gravitydata_value(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	char strbuf[EW_BUFSIZE];
+	EWTZMU2_ReadGravity(strbuf, EW_BUFSIZE);
+	return sprintf(buf, "%s\n", strbuf);
+}
+
+static ssize_t show_midcontrol_value(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	char strbuf[EW_BUFSIZE];
+	EWTZMU2_ReadMiddleControl(strbuf, EW_BUFSIZE);
+	return sprintf(buf, "%s\n", strbuf);
+}
+
+static ssize_t store_midcontrol_value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+	write_lock(&ewtzmumid_data.ctrllock);
+	memcpy(&ewtzmumid_data.controldata[0], buf, sizeof(int)*EW_CB_LENGTH);
+	write_unlock(&ewtzmumid_data.ctrllock);
+	return count;
+}
+
+static ssize_t show_mode_value(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	int mode = 0;
+	read_lock(&ewtzmu_data.lock);
+	mode = ewtzmu_data.mode;
+	read_unlock(&ewtzmu_data.lock);
+	return sprintf(buf, "%d\n", mode);
+}
+
+static ssize_t store_mode_value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+	int mode = 0;
+	sscanf(buf, "%d", &mode);
+	return count;
+}
+
+static ssize_t show_wia_value(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	char strbuf[EW_BUFSIZE];
+	EWTZMU2_WIA(strbuf, EW_BUFSIZE);
+	return sprintf(buf, "%s\n", strbuf);
+}
+
+static DEVICE_ATTR(chipinfo, S_IRUGO, show_chipinfo_value, NULL);
+static DEVICE_ATTR(sensordata, S_IRUGO, show_sensordata_value, NULL);
+static DEVICE_ATTR(posturedata, S_IRUGO, show_posturedata_value, NULL);
+static DEVICE_ATTR(calidata, S_IRUGO, show_calidata_value, NULL);
+static DEVICE_ATTR(gyrodata, S_IRUGO, show_gyrodata_value, NULL);
+static DEVICE_ATTR(rvdata, S_IRUGO, show_rv_value, NULL);
+static DEVICE_ATTR(ladata, S_IRUGO, show_ladata_value, NULL);
+static DEVICE_ATTR(gravitydata, S_IRUGO, show_gravitydata_value, NULL);
+static DEVICE_ATTR(midcontrol, S_IRUGO | S_IWUSR, show_midcontrol_value, store_midcontrol_value);
+static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, show_mode_value, store_mode_value);
+static DEVICE_ATTR(wia, S_IRUGO, show_wia_value, NULL);
+
+static struct attribute *ewtzmu2_attributes[] = {
+	&dev_attr_chipinfo.attr,
+	&dev_attr_sensordata.attr,
+	&dev_attr_posturedata.attr,
+	&dev_attr_calidata.attr,
+	&dev_attr_gyrodata.attr,
+	&dev_attr_rvdata.attr,
+	&dev_attr_ladata.attr,
+	&dev_attr_gravitydata.attr,
+	&dev_attr_midcontrol.attr,
+	&dev_attr_mode.attr,
+	&dev_attr_wia.attr,
+	NULL
+};
+
+static struct attribute_group ewtzmu2_attribute_group = {
+	.attrs = ewtzmu2_attributes
+};
+
+static int ewtzmu2_open(struct inode *inode, struct file *file)
+{
+	int ret = -1;
+	if (atomic_cmpxchg(&dev_open_count, 0, 1) == 0) {
+	I("Open device node:ewtzmu2\n");
+	ret = nonseekable_open(inode, file);
+	}
+	return ret;
+}
+
+static int ewtzmu2_release(struct inode *inode, struct file *file)
+{
+	atomic_set(&dev_open_count, 0);
+	I("Release device node:ewtzmu2\n");
+	return 0;
+}
+static long ewtzmu2_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	char strbuf[EW_BUFSIZE];
+	int controlbuf[EW_CB_LENGTH];
+	int dirpolarity[EW_DP_LENGTH];
+	int valuebuf[4];
+	int calidata[7];
+	int gyrodata[3];
+	long pedodata[3], ladata[3], gravitydata[3];
+	int pedoparam[EW_PD_LENGTH];
+	unsigned char databuf[EW_BUFSIZE];
+	void __user *data;
+	int retval = 0;
+	int mode = 0, chipset = 0;
+	int rotation_vector[4];
+	int gyro_sample_rate;
+	int i2creaddata[3];
+	int i2cwrdata[64];
+
+
+	switch (cmd) {
+
+	D("@@@ewtzmu2_ioctl & cmd = %d  \n", cmd);
+
+	case EW_IOCTL_SET_INIT:
+		read_lock(&ewtzmu_data.lock);
+		mode = ewtzmu_data.mode;
+		chipset = ewtzmu_data.chipset;
+		read_unlock(&ewtzmu_data.lock);
+		retval = EWTZMU2_Chipset_Init();
+		I("ewtzmu2_ioctl & cmd = %d,"
+			"EWTZMU2_Chipset_Init, retval = %d\n",
+			cmd, retval);
+	break;
+
+	case EW_IOCTL_SET_STANDBY:
+	break;
+
+	case EW_IOCTL_READ_CHIPINFO:
+		data = (void __user *) arg;
+		if (data == NULL)
+		break;
+		EWTZMU2_ReadChipInfo(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_READ_SENSORDATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		retval = EWTZMU2_ReadSensorData(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1))
+			goto err_out;
+	break;
+
+	case EW_IOCTL_READ_SENSORDATA_FIFO:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		retval = EWTZMU2_ReadSensorDataFIFO(databuf, EW_BUFSIZE);
+		if (copy_to_user(data, &(databuf[1]), databuf[0]))
+			goto err_out;
+	break;
+
+	case EW_IOCTL_READ_POSTUREDATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadPostureData(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_WRITE_POSTUREDATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(&valuebuf, data, sizeof(valuebuf))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.datalock);
+		ewtzmumid_data.yaw   = valuebuf[0];
+		ewtzmumid_data.pitch = valuebuf[1];
+		ewtzmumid_data.roll  = valuebuf[2];
+		ewtzmumid_data.status = valuebuf[3];
+		write_unlock(&ewtzmumid_data.datalock);
+	break;
+
+	case EW_IOCTL_READ_CALIDATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadCaliData(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_WRITE_CALIDATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(&calidata, data, sizeof(calidata))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.datalock);
+		ewtzmumid_data.nm.x = calidata[0];
+		ewtzmumid_data.nm.y = calidata[1];
+		ewtzmumid_data.nm.z = calidata[2];
+		ewtzmumid_data.na.x = calidata[3];
+		ewtzmumid_data.na.y = calidata[4];
+		ewtzmumid_data.na.z = calidata[5];
+		ewtzmumid_data.status = calidata[6];
+		write_unlock(&ewtzmumid_data.datalock);
+	break;
+	case EW_IOCTL_SET_SAMPLERATE:
+			data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(&gyro_sample_rate, data, sizeof(gyro_sample_rate))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		EWTZMU2_Chip_Set_SampleRate(gyro_sample_rate);
+
+	case EW_IOCTL_READ_GYRODATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadGyroData(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_WRITE_GYRODATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(&gyrodata, data, sizeof(gyrodata))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.datalock);
+		ewtzmumid_data.gyro.x = gyrodata[0];
+		ewtzmumid_data.gyro.y = gyrodata[1];
+		ewtzmumid_data.gyro.z = gyrodata[2];
+		write_unlock(&ewtzmumid_data.datalock);
+	break;
+
+	case EW_IOCTL_READ_PEDODATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadPedoData(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_WRITE_PEDODATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(&pedodata, data, sizeof(pedodata))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.datalock);
+		ewtzmumid_data.pedo.pedo_step = pedodata[0];
+		ewtzmumid_data.pedo.pedo_time = pedodata[1];
+		ewtzmumid_data.pedo.pedo_stat = (int)pedodata[2];
+		write_unlock(&ewtzmumid_data.datalock);
+	break;
+
+	case EW_IOCTL_READ_PEDOPARAM:
+		read_lock(&ewtzmumid_data.ctrllock);
+		memcpy(pedoparam, &ewtzmumid_data.pedometerparam[0], sizeof(pedoparam));
+		read_unlock(&ewtzmumid_data.ctrllock);
+		data = (void __user *) arg;
+		if (data == NULL)
+		break;
+		if (copy_to_user(data, pedoparam, sizeof(pedoparam))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_WRITE_PEDOPARAM:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(pedoparam, data, sizeof(pedoparam))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.ctrllock);
+		memcpy(&ewtzmumid_data.pedometerparam[0], pedoparam, sizeof(pedoparam));
+		write_unlock(&ewtzmumid_data.ctrllock);
+	break;
+
+	case EW_IOCTL_READ_CONTROL:
+		read_lock(&ewtzmumid_data.ctrllock);
+		memcpy(controlbuf, &ewtzmumid_data.controldata[0], sizeof(controlbuf));
+		read_unlock(&ewtzmumid_data.ctrllock);
+		I("@@@EW_IOCTL_READ_CONTROL \n");
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_to_user(data, controlbuf, sizeof(controlbuf))) {
+			retval = -EFAULT;
+			I("@@@EW_IOCTL_READ_CONTROL & retval = %d\n",
+			retval);
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_WRITE_CONTROL:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(controlbuf, data, sizeof(controlbuf))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.ctrllock);
+		memcpy(&ewtzmumid_data.controldata[0], controlbuf, sizeof(controlbuf));
+		write_unlock(&ewtzmumid_data.ctrllock);
+		Set_Report_Sensor_Flag(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS]);
+		if (!atomic_read(&g_status) && !atomic_read(&rv_status) &&
+		!atomic_read(&la_status) && !atomic_read(&gv_status) &&
+		!atomic_read(&o_status) && !atomic_read(&off_status_hal)) {
+
+				atomic_set(&off_status_hal, 1);
+				I("cal_Gyro power off:g_status=%d"
+					"off_status_hal=%d\n",
+					atomic_read(&g_status),
+					atomic_read(&off_status_hal));
+				return EWTZMU2_Power_Off();
+			} else if ((atomic_read(&g_status) || atomic_read(&rv_status) ||
+			atomic_read(&la_status) || atomic_read(&gv_status) ||
+			atomic_read(&o_status))  && atomic_read(&off_status_hal)) {
+
+				atomic_set(&off_status_hal, 0);
+				I("Cal_Gyro power on:g_status=%d"
+					"off_status_hal=%d\n",
+					atomic_read(&g_status),
+					atomic_read(&off_status_hal));
+				return EWTZMU2_Power_On();
+			}
+	break;
+
+	case EW_IOCTL_WRITE_MODE:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(&mode, data, sizeof(mode))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_WRITE_REPORT:
+		EWTZMU2_Report_Value();
+	break;
+
+	case EW_IOCTL_READ_WIA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_WIA(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_READ_AXISINTERFERENCE:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		memset(strbuf, 0x00, sizeof(strbuf));
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_GET_DIRPOLARITY:
+		read_lock(&ewtzmumid_data.ctrllock);
+		memcpy(dirpolarity, &ewtzmumid_data.dirpolarity[0], sizeof(dirpolarity));
+		read_unlock(&ewtzmumid_data.ctrllock);
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_to_user(data, dirpolarity, sizeof(dirpolarity))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_READ_ROTATION_VECTOR:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadRotationVector(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_WRITE_ROTATION_VECTOR:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(rotation_vector, data, sizeof(rotation_vector))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.ctrllock);
+		memcpy(&ewtzmumid_data.rotationvector[0], rotation_vector, sizeof(rotation_vector));
+		write_unlock(&ewtzmumid_data.ctrllock);
+	break;
+
+	case EW_IOCTL_READ_LINEAR_ACCEL:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadLinearAccel(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf)+1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EW_IOCTL_WRITE_LINEAR_ACCEL:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(ladata, data, sizeof(ladata))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.ctrllock);
+		ewtzmumid_data.linear_accel.x = ladata[0];
+		ewtzmumid_data.linear_accel.y = ladata[1];
+		ewtzmumid_data.linear_accel.z = ladata[2];
+		write_unlock(&ewtzmumid_data.ctrllock);
+	break;
+
+	case EW_IOCTL_READ_GRAVITY:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadGravity(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		break;
+
+	case EW_IOCTL_WRITE_GRAVITY:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(gravitydata, data, sizeof(gravitydata))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.ctrllock);
+		ewtzmumid_data.gravity.x = gravitydata[0];
+		ewtzmumid_data.gravity.y = gravitydata[1];
+		ewtzmumid_data.gravity.z = gravitydata[2];
+		write_unlock(&ewtzmumid_data.ctrllock);
+	break;
+
+	case EW_IOCTL_WRITE_I2CDATA:
+			data = (void __user *)arg;
+			if (data == NULL)
+				break;
+			if (copy_from_user(i2cwrdata,
+				data, sizeof(i2cwrdata))) {
+				retval = -EFAULT;
+				goto err_out;
+			}
+
+			I("%s: EW_IOCTL_WRITE_I2CDATA :"
+			"i2caddr=0x%x,len=%d,data=0x%x",
+			__func__, i2cwrdata[0],
+			i2cwrdata[1], i2cwrdata[2]);
+			retval = EWTZMU2_I2C_Write(i2cwrdata[0],
+				i2cwrdata[1], &i2cwrdata[2]);
+			if (retval != 1) {
+				E("%s: EW_IOCTL_WRITE_I2CDATA Error :"
+				"i2caddr=0x%x,len=%d,data=0x%x",
+					__func__, i2cwrdata[0],
+					i2cwrdata[1], i2cwrdata[2]);
+			}
+	break;
+
+	case EW_IOCTL_WRITE_I2CADDR:
+			data = (void __user *)arg;
+			if (data == NULL)
+				break;
+
+			if (copy_from_user(i2creaddata,
+				data, sizeof(i2creaddata))) {
+				retval = -EFAULT;
+				goto err_out;
+			}
+
+			read_lock(&ewtzmu_data.lock);
+			I("%s: WRITE_I2CADDR:"
+			"i2creaddata[0]=%d,i2creaddata[1]=%d",
+				__func__, i2creaddata[0],
+				i2creaddata[1]);
+			ewtzmu_data.i2c_read_addr = i2creaddata[0];
+			ewtzmu_data.i2c_read_len = i2creaddata[1];
+			read_unlock(&ewtzmu_data.lock);
+	break;
+
+	case EW_IOCTL_READ_I2CDATA:
+			data = (void __user *)arg;
+			if (data == NULL)
+				break;
+
+			retval = EWTZMU2_I2C_Read(ewtzmu_data.i2c_read_addr,
+				ewtzmu_data.i2c_read_len, &i2cwrdata[0]);
+			I("%s: EW_IOCTL_READ_I2CDATA :"
+				"R addr=0x%x,len=%d,data=0x%x",
+				__func__, ewtzmu_data.i2c_read_addr,
+				ewtzmu_data.i2c_read_len, i2cwrdata[0]);
+			if (retval) {
+				if (copy_to_user(data,
+				i2cwrdata, ewtzmu_data.i2c_read_len)) {
+					retval = -EFAULT;
+					goto err_out;
+				}
+			} else {
+				E("%s: EW_IOCTL_READ_I2CDATA :"
+					"error R addr=0x%x,len=%d,data=0x%x",
+				__func__,  ewtzmu_data.i2c_read_addr,
+				ewtzmu_data.i2c_read_len, i2cwrdata[0]);
+				retval = -EFAULT;
+				goto err_out;
+			}
+	break;
+	default:
+		E("%s not supported = 0x%04x", __func__, cmd);
+		retval = -ENOIOCTLCMD;
+		break;
+	}
+
+err_out:
+	return retval;
+}
+
+unsigned int ewtzmu2_poll(struct file *filp , poll_table *pwait)
+{
+	unsigned int mask = 0;
+
+	if ((ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_ORIENTATION) ||
+	(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_GYROSCOPE) ||
+	(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_MAGNETIC_FIELD) ||
+	(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_ACCELEROMETER) ||
+		(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_ROTATION_VECTOR) ||
+		(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_LINEAR_ACCELERATION) ||
+		(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_GRAVITY))
+		mask |= POLLIN | POLLRDNORM;
+
+    return mask;
+}
+
+static int ewtzmu2daemon_open(struct inode *inode, struct file *file)
+{
+    int ret = -1;
+    if (atomic_cmpxchg(&daemon_open_count, 0, 1) == 0) {
+	I("Open device node:ewtzmu2daemon\n");
+	ret = 0;
+    }
+    return ret;
+}
+
+static int ewtzmu2daemon_release(struct inode *inode, struct file *file)
+{
+    atomic_set(&daemon_open_count, 0);
+    I("Release device node:ewtzmu2daemon\n");
+    return 0;
+}
+
+
+
+static long ewtzmu2daemon_ioctl(
+struct file *file, unsigned int cmd,
+	unsigned long arg)
+{
+	int valuebuf[4];
+	int calidata[7];
+	int gyrodata[3];
+	long pedodata[3], ladata[3], gravitydata[3];
+	int controlbuf[EW_CB_LENGTH];
+	int dirpolarity[EW_DP_LENGTH];
+	unsigned char databuf[EW_BUFSIZE];
+	int pedoparam[EW_PD_LENGTH];
+	void __user *data;
+	int retval = 0, i;
+	int mode = 0, chipset = EW_CHIPSET;
+	int gyro_sample_rate[3];
+	int rotation_vector[4];
+	short report_to_gyro_value[12] = {0};
+	int akm_ready = 0;
+	unsigned char pana_gyro_gsensor_kvalue[12];
+	int i2creaddata[3];
+	int i2cwrdata[64];
+
+	switch (cmd) {
+
+	case EWDAE_IOCTL_SET_INIT:
+		read_lock(&ewtzmu_data.lock);
+		mode = ewtzmu_data.mode;
+		chipset = ewtzmu_data.chipset;
+		read_unlock(&ewtzmu_data.lock);
+		retval = EWTZMU2_Chipset_Init();
+	break;
+
+	case EWDAE_IOCTL_SET_STANDBY:
+		EWTZMU2_GetOpenStatus();
+		break;
+
+	case EWDAE_IOCTL_GET_SENSORDATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadSensorData(databuf, EW_BUFSIZE);
+		if (copy_to_user(data, databuf, strlen(databuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWDAE_IOCTL_GET_SENSORDATA_FIFO:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadSensorDataFIFO(databuf, EW_BUFSIZE);
+		DIF("sensordata 1:lenth:%d, data: %d ,%d %d, %d %d\n",
+			databuf[0], databuf[1], databuf[2],
+			databuf[3], databuf[4], databuf[5]);
+		DIF("sensordata 2:%d %d ,%d %d, %d %d, %d\n",
+			databuf[6], databuf[7], databuf[8],
+			databuf[9], databuf[10], databuf[11], databuf[12]);
+		if (copy_to_user(data, &(databuf[1]), databuf[0])) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWDAE_IOCTL_SET_POSTURE:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(&valuebuf, data, sizeof(valuebuf))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.datalock);
+		ewtzmumid_data.yaw   = valuebuf[0];
+		ewtzmumid_data.pitch = valuebuf[1];
+		ewtzmumid_data.roll  = valuebuf[2];
+		ewtzmumid_data.status = valuebuf[3];
+		write_unlock(&ewtzmumid_data.datalock);
+		if (atomic_read(&o_status) && m_o_times == 0) {
+			m_o_times = 1;
+			I("(o) = (0x%x), set m_o_times %d\n",
+				atomic_read(&o_status), m_o_times);
+		}
+		if (atomic_read(&o_status) == 0) {
+			if (m_o_times == 1)
+				I("(o) = (0x%x),  set 0 to m_o_times %d\n",
+					atomic_read(&o_status), m_o_times);
+			m_o_times = 0;
+		}
+	break;
+
+	case EWDAE_IOCTL_SET_CALIDATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(&calidata, data, sizeof(calidata))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		for (i = 0; i < 7; i++)
+			DIF("EWDAE_IOCTL_SET_CALIDATA :calidata[%d]: %d\n", i, calidata[i]);
+		write_lock(&ewtzmumid_data.datalock);
+		ewtzmumid_data.nm.x = calidata[0];
+		ewtzmumid_data.nm.y = calidata[1];
+		ewtzmumid_data.nm.z = calidata[2];
+		ewtzmumid_data.na.x = calidata[3];
+		ewtzmumid_data.na.y = calidata[4];
+		ewtzmumid_data.na.z = calidata[5];
+		ewtzmumid_data.status = calidata[6];
+		write_unlock(&ewtzmumid_data.datalock);
+	break;
+
+	case EWDAE_IOCTL_SET_GYRODATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(&gyrodata, data, sizeof(gyrodata))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.datalock);
+		ewtzmumid_data.gyro.x = gyrodata[0];
+		ewtzmumid_data.gyro.y = gyrodata[1];
+		ewtzmumid_data.gyro.z = gyrodata[2];
+		write_unlock(&ewtzmumid_data.datalock);
+	break;
+
+	case EWDAE_IOCTL_SET_PEDODATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(&pedodata, data, sizeof(pedodata))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.datalock);
+		ewtzmumid_data.pedo.pedo_step = pedodata[0];
+		ewtzmumid_data.pedo.pedo_time = pedodata[1];
+		ewtzmumid_data.pedo.pedo_stat = (int)pedodata[2];
+		write_unlock(&ewtzmumid_data.datalock);
+	break;
+
+	case EWDAE_IOCTL_GET_PEDOPARAM:
+		read_lock(&ewtzmumid_data.ctrllock);
+		memcpy(pedoparam, &ewtzmumid_data.pedometerparam[0], sizeof(pedoparam));
+		read_unlock(&ewtzmumid_data.ctrllock);
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_to_user(data, pedoparam, sizeof(pedoparam))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWDAE_IOCTL_SET_PEDOPARAM:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(pedoparam, data, sizeof(pedoparam))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.ctrllock);
+		memcpy(&ewtzmumid_data.pedometerparam[0], pedoparam, sizeof(pedoparam));
+		write_unlock(&ewtzmumid_data.ctrllock);
+	break;
+
+	case EWDAE_IOCTL_GET_CONTROL:
+		read_lock(&ewtzmumid_data.ctrllock);
+		memcpy(controlbuf, &ewtzmumid_data.controldata[0], sizeof(controlbuf));
+		read_unlock(&ewtzmumid_data.ctrllock);
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_to_user(data, controlbuf, sizeof(controlbuf))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWDAE_IOCTL_SET_SAMPLERATE:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(gyro_sample_rate, data, sizeof(gyro_sample_rate))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		EWTZMU2_Chip_Set_SampleRate(gyro_sample_rate[0]);
+	break;
+
+	case EWDAE_IOCTL_GET_DIRPOLARITY:
+		read_lock(&ewtzmumid_data.ctrllock);
+		memcpy(dirpolarity, &ewtzmumid_data.dirpolarity[0], sizeof(dirpolarity));
+		read_unlock(&ewtzmumid_data.ctrllock);
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_to_user(data, dirpolarity, sizeof(dirpolarity))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWDAE_IOCTL_SET_CONTROL:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(controlbuf, data, sizeof(controlbuf))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		DIF("@@@Gyro AP ewtzmu2daemon_ioctl EWDAE_IOCTL_SET_CONTROL\n");
+		return 0;
+	break;
+
+	case EWDAE_IOCTL_SET_MODE:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(&mode, data, sizeof(mode))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	
+	case EWDAE_IOCTL_SET_REPORT:
+		EWTZMU2_Report_Value();
+	break;
+
+	case EWDAE_IOCTL_GET_WIA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_WIA(databuf, EW_BUFSIZE);
+		if (copy_to_user(data, databuf, strlen(databuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWDAE_IOCTL_GET_AXISINTERFERENCE:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		memset(databuf, 0x00, sizeof(databuf));
+		if (copy_to_user(data, databuf, strlen(databuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWDAE_IOCTL_SET_ROTATION_VECTOR:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(rotation_vector, data, sizeof(rotation_vector))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.ctrllock);
+		memcpy(&ewtzmumid_data.rotationvector[0], rotation_vector, sizeof(rotation_vector));
+		write_unlock(&ewtzmumid_data.ctrllock);
+		DIF("rotationvector:%d %d ,%d %d\n",
+			ewtzmumid_data.rotationvector[0], ewtzmumid_data.rotationvector[1],
+			ewtzmumid_data.rotationvector[2], ewtzmumid_data.rotationvector[3]);
+	break;
+
+	case EWDAE_IOCTL_SET_LINEAR_ACCEL:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(ladata, data, sizeof(ladata))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.ctrllock);
+		ewtzmumid_data.linear_accel.x = ladata[0];
+		ewtzmumid_data.linear_accel.y = ladata[1];
+		ewtzmumid_data.linear_accel.z = ladata[2];
+		write_unlock(&ewtzmumid_data.ctrllock);
+	break;
+
+	case EWDAE_IOCTL_SET_GRAVITY:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(gravitydata, data, sizeof(gravitydata))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.ctrllock);
+		ewtzmumid_data.gravity.x = gravitydata[0];
+		ewtzmumid_data.gravity.y = gravitydata[1];
+		ewtzmumid_data.gravity.z = gravitydata[2];
+		write_unlock(&ewtzmumid_data.ctrllock);
+	break;
+	case EWDAE_IOCTL_GET_AKM_DATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		DIF("%s: EWDAE_IOCTL_GET_AKM_DATA = 0x%x\n", __func__, EWDAE_IOCTL_GET_AKM_DATA);
+		akm_get_akmd_data(report_to_gyro_value);
+		if (copy_to_user(data, report_to_gyro_value, sizeof(report_to_gyro_value))) {
+			E("%s: EWDAE_IOCTL_GET_AKM_DATA,"
+				"copy_to_user fail\n", __func__);
+			return -EFAULT;
+		}
+	break;
+	case EWDAE_IOCTL_GET_AKM_READY:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		akm_ready = akm_get_akmd_ready();
+		if (akm_ready == 0)
+			I("%s: EWDAE_IOCTL_GET_AKM_READY,"
+			"akm_ready= 0x%x\n",
+			__func__, akm_ready);
+		if (copy_to_user(data, &akm_ready, sizeof(akm_ready))) {
+			E("%s: EWDAE_IOCTL_GET_AKM_READY,"
+				"copy_to_user fail\n",
+				__func__);
+			return -EFAULT;
+		}
+	break;
+	case EWDAE_IOCTL_GET_GYRO_CAL_DATA:
+		data = (void __user *) arg;
+		if (data == NULL) {
+			retval = -EFAULT;
+			break;
+		}
+	   if (gyro_gsensor_kvalue[0] != 0x67) {
+		E("%s: EWDAE_IOCTL_GET_GYRO_CAL_DATA,"
+		"gyro_gsensor_kvalue[0] 0x%x != 0x67\n",
+			__func__, gyro_gsensor_kvalue[0]);
+			return -EFAULT;
+	   }
+	   for (i = 0; i < sizeof(pana_gyro_gsensor_kvalue); i++) {
+			pana_gyro_gsensor_kvalue[i] =
+				gyro_gsensor_kvalue[i + 1];
+			I("gyro_gsensor_kvalue[%d] = 0x%x\n",
+				i + 1, gyro_gsensor_kvalue[i + 1]);
+		}
+	   if (copy_to_user(data, pana_gyro_gsensor_kvalue, sizeof(pana_gyro_gsensor_kvalue))) {
+			E("%s: EWDAE_IOCTL_GET_GYRO_CAL_DATA,"
+			"copy_to_user fail\n", __func__);
+			return -EFAULT;
+		}
+	break;
+	case EWDAE_IOCTL_WRITE_I2CDATA:
+			data = (void __user *)arg;
+			if (data == NULL)
+				break;
+			if (copy_from_user(i2cwrdata,
+				data, sizeof(i2cwrdata))) {
+				retval = -EFAULT;
+				goto err_out;
+			}
+			I("%s: EWDAE_IOCTL_WRITE_I2CDATA :"
+			"i2caddr=0x%x,len=%d,data=0x%x",
+			__func__, i2cwrdata[0],
+			i2cwrdata[1], i2cwrdata[2]);
+			retval = EWTZMU2_I2C_Write(i2cwrdata[0],
+				i2cwrdata[1], &i2cwrdata[2]);
+			if (retval != 1) {
+				E("%s: EWDAE_IOCTL_WRITE_I2CDATA Error"
+					": i2caddr=0x%x,len=%d,data=0x%x",
+					__func__, i2cwrdata[0],
+					i2cwrdata[1], i2cwrdata[2]);
+			}
+	break;
+
+	case EWDAE_IOCTL_WRITE_I2CADDR:
+			data = (void __user *)arg;
+			if (data == NULL)
+				break;
+			if (copy_from_user(i2creaddata,
+				data, sizeof(i2creaddata))) {
+				retval = -EFAULT;
+				goto err_out;
+			}
+			read_lock(&ewtzmu_data.lock);
+			I("%s: EWDAE_IOCTL_WRITE_I2CADDR:"
+			"i2creaddata[0]=%d,i2creaddata[1]=%d",
+				__func__, i2creaddata[0],
+				i2creaddata[1]);
+			ewtzmu_data.i2c_read_addr = i2creaddata[0];
+			ewtzmu_data.i2c_read_len = i2creaddata[1];
+			read_unlock(&ewtzmu_data.lock);
+	break;
+
+	case EWDAE_IOCTL_READ_I2CDATA:
+			data = (void __user *)arg;
+			if (data == NULL)
+				break;
+			retval = EWTZMU2_I2C_Read(ewtzmu_data.i2c_read_addr,
+				ewtzmu_data.i2c_read_len, &i2cwrdata[0]);
+			I("%s: EWDAE_IOCTL_READ_I2CDATA :"
+				"R addr=0x%x,len=%d,data=0x%x",
+				__func__, ewtzmu_data.i2c_read_addr,
+				ewtzmu_data.i2c_read_len, i2cwrdata[0]);
+			if (retval) {
+				if (copy_to_user(data, i2cwrdata,
+					ewtzmu_data.i2c_read_len)) {
+					retval = -EFAULT;
+					goto err_out;
+				}
+			} else {
+				E("%s: EWDAE_IOCTL_READ_I2CDATA :"
+					"error R addr=0x%x,len=%d,data=0x%x",
+				__func__, ewtzmu_data.i2c_read_addr,
+				ewtzmu_data.i2c_read_len, i2cwrdata[0]);
+				retval = -EFAULT;
+				goto err_out;
+			}
+	break;
+	default:
+		E("%s not supported = 0x%04x", __func__, cmd);
+		retval = -ENOIOCTLCMD;
+	break;
+	}
+
+err_out:
+	return retval;
+}
+
+unsigned int ewtzmu2daemon_poll(struct file *filp , poll_table *pwait)
+{
+	unsigned int mask = 0;
+
+	if ((ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_ORIENTATION) ||
+	(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_GYROSCOPE) ||
+	(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_MAGNETIC_FIELD) ||
+	(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_ACCELEROMETER) ||
+		(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_ROTATION_VECTOR) ||
+		(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_LINEAR_ACCELERATION) ||
+		(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_GRAVITY))
+		mask |= POLLIN | POLLRDNORM;
+    return mask;
+}
+
+static int ewtzmu2hal_open(struct inode *inode, struct file *file)
+{
+
+    I("Open device node:ewtzmu2hal times.\n");
+    return 0;
+}
+
+static int ewtzmu2hal_release(struct inode *inode, struct file *file)
+{
+
+    I("Release ewtzmu2hal, remainder is  times.\n");
+    return 0;
+}
+
+static long ewtzmu2hal_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	int controlbuf[EW_CB_LENGTH];
+	char strbuf[EW_BUFSIZE];
+	int pedoparam[EW_PD_LENGTH];
+	 void __user *data;
+	int retval = 0, ret = 0;
+
+	DIF("ewtzmu2hal_ioctl, cmd is %d.\n", cmd);
+	switch (cmd) {
+
+	case EWHAL_IOCTL_GET_SENSORDATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadSensorData(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWHAL_IOCTL_GET_POSTURE:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadPostureData(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWHAL_IOCTL_GET_CALIDATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadCaliData(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWHAL_IOCTL_GET_GYRODATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadGyroData(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWHAL_IOCTL_GET_PEDODATA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadPedoData(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWHAL_IOCTL_GET_PEDOPARAM:
+		read_lock(&ewtzmumid_data.ctrllock);
+		memcpy(pedoparam, &ewtzmumid_data.pedometerparam[0], sizeof(pedoparam));
+		read_unlock(&ewtzmumid_data.ctrllock);
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_to_user(data, pedoparam, sizeof(pedoparam))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWHAL_IOCTL_SET_PEDOPARAM:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(pedoparam, data, sizeof(pedoparam))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		write_lock(&ewtzmumid_data.ctrllock);
+		memcpy(&ewtzmumid_data.pedometerparam[0], pedoparam, sizeof(pedoparam));
+		write_unlock(&ewtzmumid_data.ctrllock);
+	break;
+
+	case EWHAL_IOCTL_GET_CONTROL:
+		read_lock(&ewtzmumid_data.ctrllock);
+		memcpy(controlbuf, &ewtzmumid_data.controldata[0], sizeof(controlbuf));
+		read_unlock(&ewtzmumid_data.ctrllock);
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_to_user(data, controlbuf, sizeof(controlbuf))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWHAL_IOCTL_SET_CONTROL:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		if (copy_from_user(controlbuf, data, sizeof(controlbuf))) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	write_lock(&ewtzmumid_data.ctrllock);
+	memcpy(&ewtzmumid_data.controldata[0], controlbuf, sizeof(controlbuf));
+	write_unlock(&ewtzmumid_data.ctrllock);
+		I("Gyro AP on: controldata_active_sensor=0x%x\n",
+				ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS]);
+	Set_Report_Sensor_Flag(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS]);
+			I("Gyro AP on:off_status_hal=%d,"
+			"g_status=%d, o_status=%d, m_status=%d,"
+			"rv_status=%d, la_status=%d, gv_status=%d, \n",
+				atomic_read(&off_status_hal),
+				atomic_read(&g_status),
+				atomic_read(&o_status),
+				atomic_read(&m_status),
+				atomic_read(&rv_status),
+				atomic_read(&la_status),
+				atomic_read(&gv_status));
+
+			if (!atomic_read(&g_status) && !atomic_read(&rv_status) && !atomic_read(&la_status) && !atomic_read(&gv_status) && !atomic_read(&o_status)) {
+
+				I("Gyro power off:g_status=%d"
+					"off_status_hal=%d\n",
+				atomic_read(&g_status),
+				atomic_read(&off_status_hal));
+				if (!atomic_read(&off_status_hal)) {
+					atomic_set(&off_status_hal, 1);
+					ret = EWTZMU2_Power_Off();
+				}
+			} else if ((atomic_read(&g_status) || atomic_read(&rv_status) || atomic_read(&la_status) || atomic_read(&gv_status) || atomic_read(&o_status))) {
+
+				I("Gyro power on:g_status=%d"
+					"off_status_hal=%d\n",
+					atomic_read(&g_status),
+					atomic_read(&off_status_hal));
+				if (atomic_read(&off_status_hal)) {
+					atomic_set(&off_status_hal, 0);
+					ret = EWTZMU2_Power_On();
+				}
+			}
+			if (ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS]) {
+				atomic_set(&open_flag, 1);
+				wake_up(&open_wq);
+			} else {
+				atomic_set(&open_flag, 0);
+			}
+			return ret;
+	break;
+
+	case EWHAL_IOCTL_GET_WIA:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_WIA(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+	break;
+
+	case EWHAL_IOCTL_GET_ROTATION_VECTOR:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadRotationVector(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		break;
+
+	case EWHAL_IOCTL_GET_LINEAR_ACCEL:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadLinearAccel(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+			retval = -EFAULT;
+			goto err_out;
+		}
+		break;
+
+	case EWHAL_IOCTL_GET_GRAVITY:
+		data = (void __user *) arg;
+		if (data == NULL)
+			break;
+		EWTZMU2_ReadGravity(strbuf, EW_BUFSIZE);
+		if (copy_to_user(data, strbuf, strlen(strbuf) + 1)) {
+		retval = -EFAULT;
+		goto err_out;
+		}
+	break;
+
+	default:
+		E("%s not supported = 0x%04x", __func__, cmd);
+		retval = -ENOIOCTLCMD;
+		break;
+	}
+	return 0;
+err_out:
+	return retval;
+}
+
+unsigned int ewtzmu2hal_poll(struct file *filp , poll_table *pwait)
+{
+	unsigned int mask = 0;
+
+	if ((ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_ORIENTATION) ||
+	(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_GYROSCOPE) ||
+	(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_MAGNETIC_FIELD) ||
+	(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_ACCELEROMETER) ||
+		(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_ROTATION_VECTOR) ||
+		(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_LINEAR_ACCELERATION) ||
+		(ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] & EW_BIT_GRAVITY))
+			mask |= POLLIN | POLLRDNORM;
+
+    return mask;
+}
+
+static struct file_operations ewtzmu2_fops = {
+    .owner = THIS_MODULE,
+    .open = ewtzmu2_open,
+    .release = ewtzmu2_release,
+    
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = ewtzmu2_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = ewtzmu2_ioctl,
+#endif
+    .poll = ewtzmu2_poll,
+};
+
+static struct miscdevice ewtzmu2_device = {
+    .minor = MISC_DYNAMIC_MINOR,
+    .name = "ewtzmu2",
+    .fops = &ewtzmu2_fops,
+};
+
+
+static struct file_operations ewtzmu2daemon_fops = {
+    .owner = THIS_MODULE,
+    .open = ewtzmu2daemon_open,
+    .release = ewtzmu2daemon_release,
+    
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = ewtzmu2daemon_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = ewtzmu2daemon_ioctl,
+#endif
+    .poll = ewtzmu2daemon_poll,
+};
+
+static struct miscdevice ewtzmu2daemon_device = {
+    .minor = MISC_DYNAMIC_MINOR,
+    .name = "ewtzmu2daemon",
+    .fops = &ewtzmu2daemon_fops,
+};
+
+static struct file_operations ewtzmu2hal_fops = {
+    .owner = THIS_MODULE,
+    .open = ewtzmu2hal_open,
+    .release = ewtzmu2hal_release,
+    
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = ewtzmu2hal_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = ewtzmu2hal_ioctl,
+#endif
+    .poll = ewtzmu2hal_poll,
+};
+
+static struct miscdevice ewtzmu2hal_device = {
+    .minor = MISC_DYNAMIC_MINOR,
+    .name = "ewtzmu2hal",
+    .fops = &ewtzmu2hal_fops,
+};
+
+static int ewtzmu2_input_init(struct ewtzmu_i2c_data *data)
+{
+    int err = 0;
+
+    data->input_dev_compass = input_allocate_device();
+    if (!data->input_dev_compass) {
+	err = -ENOMEM;
+	E("ewtzmu2_input_init: Failed to allocate input device\n");
+	goto exit_input_dev_alloc_failed;
+    }
+    set_bit(EV_ABS, data->input_dev_compass->evbit);
+    
+    input_set_abs_params(data->input_dev_compass,
+	ABS_RX, 0, (360*10), 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass,
+	ABS_RY, -(180*10), (180*10), 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass,
+	ABS_RZ, -(90*10), (90*10), 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass,
+	ABS_RUDDER, 0, 5, 0, 0);
+
+    
+    input_set_abs_params(data->input_dev_compass, ABS_X,
+	-(1000*2), (1000*2), 0, 0);
+
+    
+    input_set_abs_params(data->input_dev_compass, ABS_Y,
+	-(1000*2), (1000*2), 0, 0);
+
+    
+    input_set_abs_params(data->input_dev_compass, ABS_Z,
+	-(1000*2), (1000*2), 0, 0);
+
+
+    
+    input_set_abs_params(data->input_dev_compass, ABS_HAT0X,
+	-(1000*3), (1000*3), 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass, ABS_HAT0Y,
+	-(1000*3), (1000*3), 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass, ABS_BRAKE,
+	-(1000*3), (1000*3), 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass, ABS_WHEEL,
+	0, 5, 0, 0);
+     
+    input_set_abs_params(data->input_dev_compass, ABS_HAT3X,
+	-1000000, 1000000, 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass, ABS_HAT3Y,
+	-1000000, 1000000, 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass, ABS_TILT_X,
+	-1000000, 1000000, 0, 0);
+	
+	input_set_abs_params(data->input_dev_compass, ABS_TILT_Y,
+	-1000000, 1000000, 0, 0);
+
+    
+    input_set_abs_params(data->input_dev_compass, ABS_HAT1X,
+	-(1000*2), (1000*2), 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass, ABS_HAT1Y,
+	-(1000*2), (1000*2), 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass, ABS_TOOL_WIDTH,
+	-(1000*2), (1000*2), 0, 0);
+
+	
+    input_set_abs_params(data->input_dev_compass, ABS_HAT2X,
+	-(1000*2), (1000*2), 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass,
+	ABS_HAT2Y, -(1000*2), (1000*2), 0, 0);
+    
+    input_set_abs_params(data->input_dev_compass,
+	ABS_VOLUME, -(1000*2), (1000*2), 0, 0);
+
+    data->input_dev_compass->name = "compass";
+
+    err = input_register_device(data->input_dev_compass);
+    if (err) {
+	E("ewtzmu2_input_init: Unable to register input device\n");
+	goto exit_input_register_compass_device_failed;
+    }
+
+
+    data->input_dev_gyroscope = input_allocate_device();
+    if (!data->input_dev_gyroscope) {
+	err = -ENOMEM;
+	E("ewtzmu2_input_init: Failed to allocate input device: %s\n",
+	data->input_dev_gyroscope->name);
+	goto exit_input_register_compass_device_failed;
+    }
+    set_bit(EV_REL, data->input_dev_gyroscope->evbit);
+
+    data->input_dev_gyroscope->relbit[0] = BIT(REL_RX) |
+	BIT(REL_RY) | BIT(REL_RZ);
+
+    data->input_dev_gyroscope->name = "ewtzmu2_gyroscope";
+
+    err = input_register_device(data->input_dev_gyroscope);
+    if (err) {
+	E("ewtzmu2_input_init: Unable to register input device: %s\n",
+	data->input_dev_gyroscope->name);
+	goto exit_input_register_gyro_device_failed;
+    }
+
+    return 0;
+exit_input_register_gyro_device_failed:
+    input_free_device(data->input_dev_gyroscope);
+
+exit_input_register_compass_device_failed:
+    input_free_device(data->input_dev_compass);
+
+exit_input_dev_alloc_failed:
+    return err;
+}
+
+static void ewtzmu2_dir_polarity(struct ewtzmu_i2c_data *data)
+{
+	int i = 0;
+	ewtzmumid_data.dirpolarity[0] = data->pdata->acc_dir;
+	ewtzmumid_data.dirpolarity[1] = data->pdata->acc_polarity;
+	ewtzmumid_data.dirpolarity[2] = data->pdata->gyro_dir;
+	ewtzmumid_data.dirpolarity[3] = data->pdata->gyro_polarity;
+	ewtzmumid_data.dirpolarity[4] = data->pdata->mag_dir;
+	ewtzmumid_data.dirpolarity[5] = data->pdata->mag_polarity;
+	for (i = 0; i < 6; i++) {
+		I("$$$ewtzmu2_dir_polarity [%d]=%d \n",
+			i, ewtzmumid_data.dirpolarity[i]);
+	}
+}
+
+int pana_gyro_enable = 1;
+
+static ssize_t pana_gyro_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+
+	s += sprintf(s, "pana_gyro_enable = 0x%x\n", pana_gyro_enable);
+
+	return s - buf;
+}
+
+static ssize_t pana_gyro_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	sscanf(buf, "%d", &pana_gyro_enable);
+	if (pana_gyro_enable == 2) {
+		ewtzmumid_data.controldata[EW_CB_ALGORITHMLOG] = 1;
+		debug_flag = 1;
+	} else if (pana_gyro_enable == 3) {
+		ewtzmumid_data.controldata[EW_CB_ALGORITHMLOG] = 0;
+		debug_flag = 0;
+	}
+	D("%s: pana_gyro_enable  = %d\n", __func__, pana_gyro_enable);
+
+	return count;
+}
+
+static DEVICE_ACCESSORY_ATTR(pana_gyro, 0664, pana_gyro_show, pana_gyro_store);
+
+
+int pana_gyro_registerAttr(void)
+{
+	int ret;
+
+	ewtzmumid_data.htc_gyro_class = class_create(THIS_MODULE, "htc_gyro");
+	if (IS_ERR(ewtzmumid_data.htc_gyro_class)) {
+		ret = PTR_ERR(ewtzmumid_data.htc_gyro_class);
+		ewtzmumid_data.htc_gyro_class = NULL;
+		goto err_create_class;
+	}
+
+	ewtzmumid_data.gyro_dev = device_create(ewtzmumid_data.htc_gyro_class,
+				NULL, 0, "%s", "gyro");
+	if (unlikely(IS_ERR(ewtzmumid_data.gyro_dev))) {
+		ret = PTR_ERR(ewtzmumid_data.gyro_dev);
+		ewtzmumid_data.gyro_dev = NULL;
+		goto err_create_gyro_device;
+	}
+
+
+	ret = device_create_file(ewtzmumid_data.gyro_dev, &dev_attr_pana_gyro);
+	if (ret)
+		goto err_create_gyro_device_file;
+	return 0;
+
+err_create_gyro_device_file:
+	device_unregister(ewtzmumid_data.gyro_dev);
+err_create_gyro_device:
+	class_destroy(ewtzmumid_data.htc_gyro_class);
+err_create_class:
+
+	return ret;
+}
+static int __devinit ewtzmu2_i2c_probe(struct i2c_client *client,
+const struct i2c_device_id *id)
+{
+    struct ewtzmu_i2c_data *data;
+    int err = 0;
+
+    I("\nEnter ewtzmu_i2c_probe!!\n");
+
+	if (client->dev.platform_data == NULL) {
+		E("platform data is NULL. exiting.\n");
+		err = -ENODEV;
+		goto exit;
+	}
+	data = kmalloc(sizeof(struct ewtzmu_i2c_data), GFP_KERNEL);
+    if (!(data)) {
+	err = -ENOMEM;
+	goto exit;
+    }
+    memset(data, 0, sizeof(struct ewtzmu_i2c_data));
+
+    data->client = client;
+	data->pdata = client->dev.platform_data;
+
+    i2c_set_clientdata(client, data);
+    ewtzmu_i2c_client = data->client;
+     gpio_set_value(data->pdata->sleep_pin, 0);
+	 ewtzmumid_data.sleep_pin = data->pdata->sleep_pin;
+    err = EWTZMU2_Chipset_Init();
+    if (err < 0) {
+	E("PANA:GYRO:init err\n");
+	err = -ENOMEM;
+	goto exit_kfree;
+    }
+
+    I("Register input device!\n");
+    err = ewtzmu2_input_init(data);
+    if (err)
+	goto exit_kfree;
+
+	
+     ewtzmu2_dir_polarity(data);
+     err = pana_gyro_registerAttr();
+     if (err) {
+		E("%s: pana_gyro_registerAttr failed\n", __func__);
+		goto exit_registerAttr_failed;
+      }
+    
+    err = misc_register(&ewtzmu2_device);
+    if (err) {
+	E("ewtzmu2_device register failed\n");
+	goto exit_misc_device_register_failed;
+    }
+    
+    err = misc_register(&ewtzmu2daemon_device);
+    if (err) {
+	E("ewtzmu2daemon_device register failed\n");
+	goto exit_misc_device_register_failed;
+    }
+    
+    err = misc_register(&ewtzmu2hal_device);
+    if (err) {
+	E("ewtzmu2hal_device register failed\n");
+	goto exit_misc_device_register_failed;
+    }
+
+    
+    err = sysfs_create_group(&client->dev.kobj, &ewtzmu2_attribute_group);
+    if (err)
+	goto exit_sysfs_create_group_failed;
+
+	if (data->pdata->config_gyro_diag_gpios != NULL)
+		ewtzmumid_data.config_gyro_diag_gpios =
+		data->pdata->config_gyro_diag_gpios;
+	atomic_set(&off_status_hal, 1);
+	EWTZMU2_Power_Off();
+
+	init_waitqueue_head(&open_wq);
+     I("PANA:GYRO:probe success\n");
+
+    return 0;
+exit_sysfs_create_group_failed:
+exit_misc_device_register_failed:
+    input_free_device(data->input_dev_compass);
+    input_free_device(data->input_dev_gyroscope);
+exit_registerAttr_failed:
+exit_kfree:
+    kfree(data);
+exit:
+	E("PANA:GYRO:probe fail\n");
+    return err;
+}
+
+static int __devexit ewtzmu2_i2c_remove(struct i2c_client *client)
+{
+    struct ewtzmu_i2c_data *data = i2c_get_clientdata(client);
+
+    sysfs_remove_group(&client->dev.kobj, &ewtzmu2_attribute_group);
+    input_unregister_device(data->input_dev_compass);
+    input_unregister_device(data->input_dev_gyroscope);
+    kfree(i2c_get_clientdata(client));
+    ewtzmu_i2c_client = NULL;
+    misc_deregister(&ewtzmu2hal_device);
+    misc_deregister(&ewtzmu2daemon_device);
+    misc_deregister(&ewtzmu2_device);
+    return 0;
+}
+
+static int ewtzmu2_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+    if (!atomic_read(&off_status)) {
+		atomic_set(&off_status, 1);
+		I("Gyro sys off on:g_status=%d off_status=%d\n",
+			atomic_read(&g_status),
+			atomic_read(&off_status));
+		
+	}
+	I("GyroB sys off on:g_status=%d off_status=%d\n",
+		atomic_read(&g_status),
+		atomic_read(&off_status));
+	return 0;
+}
+
+static int ewtzmu2_resume(struct i2c_client *client)
+{
+	if (atomic_read(&off_status)) {
+		atomic_set(&off_status, 0);
+		I("Gyro sys on on:g_status=%d off_status=%d\n",
+			atomic_read(&g_status),
+			atomic_read(&off_status));
+		
+	}
+	I("GyroB sys off on:g_status=%d off_status=%d\n",
+		atomic_read(&g_status),
+		atomic_read(&off_status));
+	return 0;
+}
+
+struct i2c_device_id ewtzmu2_idtable[] = {
+    { "ewtzmu2", 0 },
+    {}
+};
+
+MODULE_DEVICE_TABLE(i2c, ewtzmu2_idtable);
+
+static struct i2c_driver ewtzmu2_i2c_driver = {
+    .probe          = ewtzmu2_i2c_probe,
+    .remove         = __devexit_p(ewtzmu2_i2c_remove),
+    .id_table       = ewtzmu2_idtable,
+    .driver = {
+	.name   = EWTZMU_DRV_NAME,
+    },
+	.suspend		= ewtzmu2_suspend,
+	.resume			= ewtzmu2_resume,
+};
+
+static int __init ewtzmu2_init(void)
+{
+    int ret;
+
+    I("Panasonic Gyroscope sensor driver: init\n");
+    I("ewtzmu2: driver version:%s\n", DRIVER_VERSION);
+    rwlock_init(&ewtzmumid_data.ctrllock);
+    rwlock_init(&ewtzmumid_data.datalock);
+    rwlock_init(&ewtzmu_data.lock);
+    memset(&ewtzmumid_data.controldata[0], 0, sizeof(int)*EW_CB_LENGTH);
+    ewtzmumid_data.controldata[EW_CB_LOOPDELAY] = EW_DEFAULT_POLLING_TIME;
+    ewtzmumid_data.controldata[EW_CB_RUN] =           1;
+    ewtzmumid_data.controldata[EW_CB_ACCCALI] =       0;
+    ewtzmumid_data.controldata[EW_CB_MAGCALI] =       1;
+    ewtzmumid_data.controldata[EW_CB_ACTIVESENSORS] = 0;
+    ewtzmumid_data.controldata[EW_CB_PD_RESET] =      0;
+    ewtzmumid_data.controldata[EW_CB_PD_EN_PARAM] =   0;
+	memset(&ewtzmumid_data.dirpolarity[0], 0, sizeof(int)*EW_DP_LENGTH);
+    memset(&ewtzmumid_data.pedometerparam[0], 0, sizeof(int)*EW_PD_LENGTH);
+
+    atomic_set(&dev_open_count, 0);
+#ifndef HTC_VERSION
+	atomic_set(&hal_open_count, 0);
+#endif
+	atomic_set(&daemon_open_count, 0);
+
+	atomic_set(&o_status, 0);
+	atomic_set(&a_status, 0);
+	atomic_set(&m_status, 0);
+	atomic_set(&g_status, 0);
+	atomic_set(&rv_status, 0);
+	atomic_set(&la_status, 0);
+	atomic_set(&gv_status, 0);
+	atomic_set(&off_status, 0);
+
+	ret = i2c_add_driver(&ewtzmu2_i2c_driver);
+	if (ret != 0) {
+		E("can not add i2c driver\n");
+		return ret;
+	}
+
+	return ret;
+}
+
+static void __exit ewtzmu2_exit(void)
+{
+	atomic_set(&dev_open_count, 0);
+#ifndef HTC_VERSION
+	atomic_set(&hal_open_count, 0);
+#endif
+	atomic_set(&daemon_open_count, 0);
+
+	atomic_set(&o_status, 0);
+	atomic_set(&a_status, 0);
+	atomic_set(&m_status, 0);
+	atomic_set(&g_status, 0);
+	atomic_set(&rv_status, 0);
+	atomic_set(&la_status, 0);
+	atomic_set(&gv_status, 0);
+	atomic_set(&off_status, 0);
+
+	i2c_del_driver(&ewtzmu2_i2c_driver);
+}
+
+MODULE_AUTHOR("Kyle K.Y. Chen");
+MODULE_DESCRIPTION("Panasonic Gyroscope driver by Prolific");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(DRIVER_VERSION);
+
+module_init(ewtzmu2_init);
+module_exit(ewtzmu2_exit);
diff --git a/drivers/input/misc/gpio_input.c b/drivers/input/misc/gpio_input.c
index 6a0c315..f4b9a5a 100644
--- a/drivers/input/misc/gpio_input.c
+++ b/drivers/input/misc/gpio_input.c
@@ -22,6 +22,78 @@
 #include <linux/slab.h>
 #include <linux/wakelock.h>
 
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
+static uint8_t power_key_state;
+static spinlock_t power_key_state_lock;
+
+#define PWRKEY_PRESS_DUE 1*HZ
+#include <linux/module.h>
+static void init_power_key_api(void)
+{
+	spin_lock_init(&power_key_state_lock);
+	power_key_state = 0;
+}
+
+static void setPowerKeyState(uint8_t flag)
+{
+	spin_lock(&power_key_state_lock);
+	power_key_state = flag;
+	spin_unlock(&power_key_state_lock);
+}
+
+uint8_t getPowerKeyState(void)
+{
+	uint8_t value;
+
+	spin_lock(&power_key_state_lock);
+	value = power_key_state;
+	spin_unlock(&power_key_state_lock);
+
+	return value;
+}
+EXPORT_SYMBOL(getPowerKeyState);
+
+static void power_key_state_disable_work_func(struct work_struct *dummy)
+{
+	setPowerKeyState(0);
+	printk(KERN_INFO "[KEY][PWR][STATE]power key pressed outdated\n");
+}
+static DECLARE_DELAYED_WORK(power_key_state_disable_work, power_key_state_disable_work_func);
+
+static void handle_power_key_state(unsigned int code, int value)
+{
+	int ret = 0;
+	if (code == KEY_POWER && value == 1) {
+		printk(KERN_INFO "[PWR][STATE]try to schedule power key pressed due\n");
+		ret = schedule_delayed_work(&power_key_state_disable_work, PWRKEY_PRESS_DUE);
+		if (!ret) {
+			printk(KERN_INFO "[PWR][STATE]Schedule power key pressed due failed, seems already have one, try to cancel...\n");
+			ret = cancel_delayed_work(&power_key_state_disable_work);
+			if (!ret) {
+				setPowerKeyState(1);
+				if (schedule_delayed_work(&power_key_state_disable_work, PWRKEY_PRESS_DUE)) {
+					printk(KERN_INFO "[PWR][STATE]Re-schedule power key pressed due SCCUESS.\n");
+					printk(KERN_INFO "[PWR][STATE] start count for power key pressed due\n");
+					setPowerKeyState(1);
+				} else
+					printk(KERN_INFO "[PWR][STATE]Re-schedule power key pressed due FAILED, reason unknown, give up.\n");
+			} else {
+				printk(KERN_INFO "[PWR][STATE]Cancel scheduled power key due success, now re-schedule.\n");
+				if (schedule_delayed_work(&power_key_state_disable_work, PWRKEY_PRESS_DUE)) {
+					printk(KERN_INFO "[PWR][STATE]Re-schedule power key pressed due SCCUESS.\n");
+					printk(KERN_INFO "[PWR][STATE] start count for power key pressed due\n");
+					setPowerKeyState(1);
+				} else
+					printk(KERN_INFO "[PWR][STATE]Re-schedule power key pressed due FAILED, reason unknown, give up.\n");
+			}
+		} else {
+			printk(KERN_INFO "[PWR][STATE] start count for power key pressed due\n");
+			setPowerKeyState(1);
+		}
+	}
+}
+#endif /* CONFIG_TOUCHSCREEN_SYNAPTICS_3K */
+
 enum {
 	DEBOUNCE_UNSTABLE     = BIT(0),	/* Got irq, while debouncing */
 	DEBOUNCE_PRESSED      = BIT(1),
@@ -130,6 +202,9 @@
 			pr_info("gpio_keys_scan_keys: key %x-%x, %d (%d) "
 				"changed to %d\n", ds->info->type,
 				key_entry->code, i, key_entry->gpio, pressed);
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
+		handle_power_key_state(key_entry->code, pressed);
+#endif
 		input_event(ds->input_devs->dev[key_entry->dev], ds->info->type,
 			    key_entry->code, pressed);
 		sync_needed = true;
@@ -239,6 +314,9 @@
 			}
 		}
 	}
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
+	init_power_key_api();
+#endif
 	return 0;
 
 	for (i = ds->info->keymap_size - 1; i >= 0; i--) {
diff --git a/drivers/input/misc/mpu3050/Kconfig b/drivers/input/misc/mpu3050/Kconfig
new file mode 100644
index 0000000..91f1939
--- /dev/null
+++ b/drivers/input/misc/mpu3050/Kconfig
@@ -0,0 +1,176 @@
+config MPU_SENSORS_MPU3050
+    tristate "MPU3050"
+    depends on I2C
+    help
+      If you say yes here you get support for the MPU3050 Gyroscope driver
+      This driver can also be built as a module.  If so, the module
+      will be called mpu3050.
+
+choice
+    prompt "Accelerometer Type"
+    depends on MPU_SENSORS_MPU3050
+    default MPU_SENSORS_BMA150
+
+config MPU_SENSORS_ACCELEROMETER_NONE
+    bool "NONE"
+    depends on MPU_SENSORS_MPU3050 || MPU_SENSORS_MPU6000
+    help
+      This disables accelerometer support for the MPU3050
+
+config MPU_SENSORS_ADXL346
+    bool "ADI adxl346"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the ADI adxl346 accelerometer
+
+config MPU_SENSORS_BMA150
+    bool "Bosch BMA150"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Bosch BMA150 accelerometer
+
+config MPU_SENSORS_BMA250
+    bool "Bosch BMA250"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Bosch BMA250 accelerometer
+
+config MPU_SENSORS_BMA222
+    bool "Bosch BMA222"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Bosch BMA222 accelerometer
+
+config MPU_SENSORS_KXSD9
+    bool "Kionix KXSD9"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Kionix KXSD9 accelerometer
+
+config MPU_SENSORS_KXTF9
+    bool "Kionix KXTF9"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Kionix KXFT9 accelerometer
+
+config MPU_SENSORS_LIS331DLH
+    bool "ST lis331dlh"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the ST lis331dlh accelerometer
+
+config MPU_SENSORS_LIS3DH
+    bool "ST lis3dh"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the ST lis3dh accelerometer
+
+config MPU_SENSORS_LSM303DLHA
+    bool "ST lsm303dlh"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the ST lsm303dlh accelerometer
+
+config MPU_SENSORS_MMA8450
+    bool "Freescale mma8450"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Freescale mma8450 accelerometer
+
+config MPU_SENSORS_MMA845X
+    bool "Freescale mma8451/8452/8453"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Freescale mma8451/8452/8453 accelerometer
+
+endchoice
+
+choice
+    prompt "Compass Type"
+    depends on MPU_SENSORS_MPU6000 || MPU_SENSORS_MPU3050
+    default MPU_SENSORS_AK8963
+
+config MPU_SENSORS_COMPASS_NONE
+    bool "NONE"
+    depends on MPU_SENSORS_MPU6000 || MPU_SENSORS_MPU3050
+    help
+      This disables compass support for the MPU6000
+
+config MPU_SENSORS_AK8975
+    bool "AKM ak8975"
+    depends on MPU_SENSORS_MPU6000 || MPU_SENSORS_MPU3050
+    help
+      This enables support for the AKM ak8975 compass
+
+config MPU_SENSORS_AK8963
+    bool "AKM ak8963"
+    depends on MPU_SENSORS_MPU6000 || MPU_SENSORS_MPU3050
+    help
+      This enables support for the AKM ak8963 compass
+
+config MPU_SENSORS_MMC314X
+    bool "MEMSIC mmc314x"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the MEMSIC mmc314x compass
+
+config MPU_SENSORS_AMI30X
+    bool "Aichi Steel ami30X"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Aichi Steel ami304/ami305 compass
+
+config MPU_SENSORS_HMC5883
+    bool "Honeywell hmc5883"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Honeywell hmc5883 compass
+
+config MPU_SENSORS_LSM303DLHM
+    bool "ST lsm303dlh"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the ST lsm303dlh compass
+
+config MPU_SENSORS_MMC314X
+    bool "MEMSIC mmc314xMS"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the MEMSIC mmc314xMS compass
+
+config MPU_SENSORS_YAS529
+    bool "Yamaha yas529"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Yamaha yas529 compass
+
+config MPU_SENSORS_HSCDTD002B
+    bool "Alps hscdtd002b"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Alps hscdtd002b compass
+
+config MPU_SENSORS_HSCDTD004A
+    bool "Alps hscdtd004a"
+    depends on MPU_SENSORS_MPU3050
+    help
+      This enables support for the Alps hscdtd004a compass
+
+endchoice
+
+config MPU_SENSORS_TIMERIRQ
+    tristate "Timer IRQ"
+    help
+      If you say yes here you get access to the timerirq device handle which
+      can be used to select on.  This can be used instead of IRQ's, sleeping,
+      or timer threads.  Reading from this device returns the same type of
+      information as reading from the MPU and slave IRQ's.
+
+config MPU_SENSORS_DEBUG
+    bool "MPU debug"
+    depends on MPU_SENSORS_MPU3050 || MPU_SENSORS_MPU6000 || MPU_SENSORS_TIMERIRQ
+    help
+      If you say yes here you get extra debug messages from the MPU3050
+      and other slave sensors.
+
+
diff --git a/drivers/input/misc/mpu3050/Makefile b/drivers/input/misc/mpu3050/Makefile
new file mode 100644
index 0000000..94dc4be
--- /dev/null
+++ b/drivers/input/misc/mpu3050/Makefile
@@ -0,0 +1,140 @@
+
+# Kernel makefile for motions sensors
+#
+#
+
+# MPU
+obj-$(CONFIG_MPU_SENSORS_MPU3050)	+= mpu3050.o
+mpu3050-objs += mpuirq.o \
+	slaveirq.o \
+	mpu-dev.o \
+	mpu-i2c.o \
+	mlsl-kernel.o \
+	mlos-kernel.o \
+	$(MLLITE_DIR)mldl_cfg.o
+
+#
+# Accel options
+#
+ifdef CONFIG_MPU_SENSORS_ADXL346
+mpu3050-objs += $(MLLITE_DIR)accel/adxl346.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_BMA150
+mpu3050-objs += $(MLLITE_DIR)accel/bma150.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_BMA250
+mpu3050-objs += $(MLLITE_DIR)accel/bma250.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_BMA222
+mpu3050-objs += $(MLLITE_DIR)accel/bma222.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_KXSD9
+mpu3050-objs += $(MLLITE_DIR)accel/kxsd9.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_KXTF9
+mpu3050-objs += $(MLLITE_DIR)accel/kxtf9.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_LIS331DLH
+mpu3050-objs += $(MLLITE_DIR)accel/lis331.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_LIS3DH
+mpu3050-objs += $(MLLITE_DIR)accel/lis3dh.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_LSM303DLHA
+mpu3050-objs += $(MLLITE_DIR)accel/lsm303a.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_MMA8450
+mpu3050-objs += $(MLLITE_DIR)accel/mma8450.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_MMA845X
+mpu3050-objs += $(MLLITE_DIR)accel/mma845x.o
+endif
+
+#
+# Compass options
+#
+ifdef CONFIG_MPU_SENSORS_AK8975
+mpu3050-objs += $(MLLITE_DIR)compass/ak8975.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_AK8963
+mpu3050-objs += $(MLLITE_DIR)compass/ak8963.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_AMI30X
+mpu3050-objs += $(MLLITE_DIR)compass/ami30x.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_HMC5883
+mpu3050-objs += $(MLLITE_DIR)compass/hmc5883.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_LSM303DLHM
+mpu3050-objs += $(MLLITE_DIR)compass/lsm303m.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_MMC314X
+mpu3050-objs += $(MLLITE_DIR)compass/mmc314x.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_YAS529
+mpu3050-objs += $(MLLITE_DIR)compass/yas529-kernel.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_HSCDTD002B
+mpu3050-objs += $(MLLITE_DIR)compass/hscdtd002b.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_HSCDTD004A
+mpu3050-objs += $(MLLITE_DIR)compass/hscdtd004a.o
+endif
+#
+# Pressure options
+#
+ifdef CONFIG_MPU_SENSORS_BMA085
+mpu3050-objs += $(MLLITE_DIR)pressure/bma085.o
+endif
+
+EXTRA_CFLAGS += -I$(M)/$(MLLITE_DIR) \
+                -I$(M)/../../include \
+		-Idrivers/input/misc/mpu3050 \
+                -Iinclude/linux
+
+obj-$(CONFIG_MPU_SENSORS_MPU6000)+= mpu6000.o
+mpu6000-objs += mpuirq.o \
+	slaveirq.o \
+	mpu-dev.o \
+	mpu-i2c.o \
+	mlsl-kernel.o \
+	mlos-kernel.o \
+	$(MLLITE_DIR)mldl_cfg.o \
+	$(MLLITE_DIR)accel/mantis.o
+
+ifdef CONFIG_MPU_SENSORS_AK8975
+mpu6000-objs += $(MLLITE_DIR)compass/ak8975.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_AK8963
+mpu6000-objs += $(MLLITE_DIR)compass/ak8963.o
+endif
+
+ifdef CONFIG_MPU_SENSORS_MPU6000
+EXTRA_CFLAGS += -DM_HW
+endif
+
+obj-$(CONFIG_MPU_SENSORS_TIMERIRQ)+= timerirq.o
+
+ifdef CONFIG_MPU_SENSORS_DEBUG
+EXTRA_CFLAGS += -DDEBUG
+endif
+
diff --git a/drivers/input/misc/mpu3050/accel/bma250.c b/drivers/input/misc/mpu3050/accel/bma250.c
new file mode 100644
index 0000000..3f6a8ae
--- /dev/null
+++ b/drivers/input/misc/mpu3050/accel/bma250.c
@@ -0,0 +1,574 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+
+
+#ifdef __KERNEL__
+#include <linux/module.h>
+#endif
+#include <linux/delay.h>
+
+#include "mpu.h"
+#include "mlos.h"
+#include "mlsl.h"
+
+#include <log.h>
+#undef MPL_LOG_TAG
+#define MPL_LOG_TAG "MPL-acc"
+
+#define BOSCH_CTRL_REG      (0x0F)
+#define BOSCH_INT_REG       (0x16)
+#define BOSCH_PWR_REG       (0x11)
+#define BMA250_REG_SOFT_RESET (0x14)
+#define BMA250_BW_REG        (0x10)    
+
+#define ACCEL_BOSCH_CTRL_MASK              (0x0F)
+#define ACCEL_BOSCH_CTRL_MASK_FSR          (0xF8)
+#define ACCEL_BOSCH_INT_MASK_WUP           (0xF8)
+#define ACCEL_BOSCH_INT_MASK_IRQ           (0xDF)
+#define BMA250_BW_MASK      (0xE0)    
+
+#define D(x...) printk(KERN_DEBUG "[GSNR][BMA250] " x)
+#define I(x...) printk(KERN_INFO "[GSNR][BMA250] " x)
+#define E(x...) printk(KERN_ERR "[GSNR][BMA250 ERROR] " x)
+#define DIF(x...) \
+	if (debug_flag) \
+		printk(KERN_DEBUG "[GSNR][BMA250 DEBUG] " x)
+
+
+struct bma250_config {
+	unsigned int odr; 
+	unsigned int fsr; 
+	unsigned int irq_type;
+	unsigned int power_mode;
+	unsigned char ctrl_reg; 
+	unsigned char bw_reg; 
+	unsigned char int_reg;
+};
+
+struct bma250_private_data {
+	struct bma250_config suspend;
+	struct bma250_config resume;
+	unsigned char state;
+};
+
+static int set_normal_mode(void *mlsl_handle,
+			 struct ext_slave_platform_data *pdata)
+{
+	int result = 0;
+
+	result = MLSLSerialWriteSingle(mlsl_handle,
+		pdata->address,	BOSCH_PWR_REG, 0x00);
+	ERROR_CHECK(result);
+
+	usleep(2000);
+
+	return 0;
+}
+
+static int bma250_set_irq(void *mlsl_handle,
+			struct ext_slave_platform_data *pdata,
+			struct bma250_config *config,
+			int apply,
+			long irq_type)
+{
+	unsigned char irq_bits = 0;
+	int result = ML_SUCCESS;
+
+	
+	return ML_SUCCESS;
+
+	if (irq_type == MPU_SLAVE_IRQ_TYPE_MOTION)
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+
+	config->irq_type = (unsigned char)irq_type;
+
+	if (irq_type == MPU_SLAVE_IRQ_TYPE_DATA_READY) {
+		irq_bits = 0x20;
+		config->int_reg &= ACCEL_BOSCH_INT_MASK_WUP;
+	} else {
+		irq_bits = 0x00;
+		config->int_reg &= ACCEL_BOSCH_INT_MASK_WUP;
+	}
+
+	config->int_reg &= ACCEL_BOSCH_INT_MASK_IRQ;
+	config->int_reg |= irq_bits;
+
+	if (apply) {
+
+		if (!config->power_mode) {
+			
+			result = MLSLSerialWriteSingle(mlsl_handle,
+					pdata->address, BMA250_REG_SOFT_RESET,
+					0xB6);
+			ERROR_CHECK(result);
+			MLOSSleep(1);
+		}
+
+		result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+			BOSCH_CTRL_REG, config->ctrl_reg);
+		ERROR_CHECK(result);
+
+		result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+			BOSCH_INT_REG, config->int_reg);
+		ERROR_CHECK(result);
+
+		if (!config->power_mode) {
+			result = MLSLSerialWriteSingle(mlsl_handle,
+				pdata->address, BOSCH_PWR_REG, 0x80);
+			ERROR_CHECK(result);
+			MLOSSleep(1);
+		} else {
+			result = set_normal_mode(mlsl_handle, pdata);
+			ERROR_CHECK(result);
+		}
+	}
+	return result;
+}
+
+static int bma250_set_odr(void *mlsl_handle,
+			struct ext_slave_platform_data *pdata,
+			struct bma250_config *config,
+			int apply,
+			long odr)
+{
+	unsigned char odr_bits = 0;
+	unsigned char wup_bits = 0;
+	int result = ML_SUCCESS;
+
+	
+	if (odr > 100000) {
+		config->odr = 31250;
+		odr_bits = 0x0A;
+		config->power_mode = 1;
+	} else if (odr > 50000) {
+		config->odr = 31250;
+		odr_bits = 0x0A;
+		config->power_mode = 1;
+	} else if (odr > 20000) {
+		config->odr = 31250;
+		odr_bits = 0x0A;
+		config->power_mode = 1;
+	} else if (odr > 15000) {
+		config->odr = 31250;
+		odr_bits = 0x0A;
+		config->power_mode = 1;
+	} else if (odr > 0) {
+		config->odr = 31250;
+		odr_bits = 0x0A;
+		config->power_mode = 1;
+	} else {
+		config->odr = 0;
+		wup_bits = 0x00;
+		config->power_mode = 0;
+	}
+
+	switch (config->power_mode) {
+	case 1:
+		config->bw_reg &= BMA250_BW_MASK;
+		config->bw_reg |= odr_bits;
+		config->int_reg &= ACCEL_BOSCH_INT_MASK_WUP;
+		break;
+	case 0:
+		config->int_reg &= ACCEL_BOSCH_INT_MASK_WUP;
+		config->int_reg |= wup_bits;
+		break;
+	default:
+		break;
+	}
+
+	MPL_LOGV("ODR: %d \n", config->odr);
+	if (apply) {
+			
+			result = MLSLSerialWriteSingle(mlsl_handle,
+					pdata->address, BMA250_REG_SOFT_RESET,
+					0xB6);
+			ERROR_CHECK(result);
+			MLOSSleep(1);
+
+			result = MLSLSerialWriteSingle(mlsl_handle,
+					pdata->address, BMA250_BW_REG,
+					config->bw_reg);
+			ERROR_CHECK(result);
+
+			
+
+			if (!config->power_mode) {
+				result = MLSLSerialWriteSingle(mlsl_handle,
+						pdata->address,	BOSCH_PWR_REG,
+						0x80);
+				ERROR_CHECK(result);
+				MLOSSleep(1);
+			} else {
+				result = set_normal_mode(mlsl_handle, pdata);
+				ERROR_CHECK(result);
+			}
+	}
+
+	return result;
+}
+
+static int bma250_set_fsr(void *mlsl_handle,
+			struct ext_slave_platform_data *pdata,
+			struct bma250_config *config,
+			int apply,
+			long fsr)
+{
+	unsigned char fsr_bits;
+	int result = ML_SUCCESS;
+
+	
+	if (fsr <= 2048) {
+		fsr_bits = 0x03;
+		config->fsr = 2048;
+	} else if (fsr <= 4096) {
+		fsr_bits = 0x03;
+		config->fsr = 2048;
+	} else if (fsr <= 8192) {
+		fsr_bits = 0x03;
+		config->fsr = 2048;
+	} else if (fsr <= 16384) {
+		fsr_bits = 0x03;
+		config->fsr = 2048;
+	} else {
+		fsr_bits = 0x03;
+		config->fsr = 2048;
+	}
+
+	config->ctrl_reg &= ACCEL_BOSCH_CTRL_MASK_FSR;
+	config->ctrl_reg |= fsr_bits;
+
+	MPL_LOGV("FSR: %d \n", config->fsr);
+	if (apply) {
+
+		if (!config->power_mode) {
+			
+			result = MLSLSerialWriteSingle(mlsl_handle,
+				pdata->address, BMA250_REG_SOFT_RESET, 0xB6);
+			ERROR_CHECK(result);
+			MLOSSleep(1);
+		}
+
+		result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+			BOSCH_CTRL_REG, config->ctrl_reg);
+		ERROR_CHECK(result);
+
+		result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+			BOSCH_CTRL_REG, config->ctrl_reg);
+		ERROR_CHECK(result);
+
+		if (!config->power_mode) {
+			result = MLSLSerialWriteSingle(mlsl_handle,
+				pdata->address,	BOSCH_PWR_REG, 0x80);
+			ERROR_CHECK(result);
+			MLOSSleep(1);
+		} else {
+			result = set_normal_mode(mlsl_handle, pdata);
+			ERROR_CHECK(result);
+		}
+	}
+	return result;
+}
+
+static int bma250_suspend(void *mlsl_handle,
+			  struct ext_slave_descr *slave,
+			  struct ext_slave_platform_data *pdata)
+{
+
+	int result = 0;
+	unsigned char ctrl_reg;
+	unsigned char int_reg;
+
+	struct bma250_private_data *private_data = pdata->private_data;
+	ctrl_reg = private_data->suspend.ctrl_reg;
+	int_reg = private_data->suspend.int_reg;
+
+	private_data->state = 1;
+
+	
+	
+
+	
+
+	if (!private_data->suspend.power_mode) {
+		result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+			BOSCH_PWR_REG, 0x80);
+		ERROR_CHECK(result);
+	}
+
+	return result;
+}
+
+
+static int bma250_resume(void *mlsl_handle,
+			 struct ext_slave_descr *slave,
+			 struct ext_slave_platform_data *pdata)
+{
+
+	int result;
+	unsigned char ctrl_reg;
+	unsigned char bw_reg;
+	unsigned char int_reg;
+
+	struct bma250_private_data *private_data = pdata->private_data;
+	ctrl_reg = private_data->resume.ctrl_reg;
+	bw_reg = private_data->resume.bw_reg;
+	int_reg = private_data->resume.int_reg;
+
+	private_data->state = 0;
+
+	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+		BMA250_REG_SOFT_RESET, 0xB6);  
+	ERROR_CHECK(result);
+	MLOSSleep(1);
+
+	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+		BOSCH_CTRL_REG, ctrl_reg);
+	ERROR_CHECK(result);
+
+	result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+		BMA250_BW_REG, bw_reg);
+	ERROR_CHECK(result);
+
+	
+
+	if (!private_data->resume.power_mode) {
+		result = MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+			BOSCH_PWR_REG, 0x80);
+		ERROR_CHECK(result);
+	} else {
+		result = set_normal_mode(mlsl_handle, pdata);
+		ERROR_CHECK(result);
+	}
+
+	return result;
+}
+
+static int bma250_read(void *mlsl_handle,
+		       struct ext_slave_descr *slave,
+		       struct ext_slave_platform_data *pdata,
+		       unsigned char *data)
+{
+	int result;
+
+	result = MLSLSerialRead(mlsl_handle, pdata->address,
+		slave->reg, slave->len, data);
+
+	return result;
+}
+
+static int bma250_init(void *mlsl_handle,
+			  struct ext_slave_descr *slave,
+			  struct ext_slave_platform_data *pdata)
+{
+	tMLError result;
+	unsigned char reg = 0;
+	unsigned char bw_reg = 0;
+
+	struct bma250_private_data *private_data;
+	private_data = (struct bma250_private_data *)
+		MLOSMalloc(sizeof(struct bma250_private_data));
+
+	printk(KERN_DEBUG "%s\n", __func__);
+
+	if (!private_data)
+		return ML_ERROR_MEMORY_EXAUSTED;
+
+
+
+	pdata->private_data = private_data;
+
+	result =
+	    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+		BMA250_REG_SOFT_RESET, 0xB6);  
+	ERROR_CHECK(result);
+	MLOSSleep(1);
+
+	result =
+	    MLSLSerialRead(mlsl_handle, pdata->address, BOSCH_CTRL_REG, 1,
+				&reg);
+	ERROR_CHECK(result);
+
+	result =
+	    MLSLSerialRead(mlsl_handle, pdata->address, BMA250_BW_REG, 1,
+				&bw_reg);
+	ERROR_CHECK(result);
+
+	private_data->resume.ctrl_reg = reg;
+	private_data->suspend.ctrl_reg = reg;
+
+	private_data->resume.bw_reg = bw_reg;
+	private_data->suspend.bw_reg = bw_reg;
+
+	
+
+	private_data->resume.int_reg = reg;
+	private_data->suspend.int_reg = reg;
+
+	private_data->resume.power_mode = 1;
+	private_data->suspend.power_mode = 0;
+
+	private_data->state = 0;
+
+	bma250_set_odr(mlsl_handle, pdata, &private_data->suspend,
+			FALSE, 0);
+	bma250_set_odr(mlsl_handle, pdata, &private_data->resume,
+			TRUE, 25000);
+	bma250_set_fsr(mlsl_handle, pdata, &private_data->suspend,
+			FALSE, 2048);
+	bma250_set_fsr(mlsl_handle, pdata, &private_data->resume,
+			FALSE, 2048);
+
+	
+
+	result =
+	    MLSLSerialWriteSingle(mlsl_handle, pdata->address, BOSCH_PWR_REG,
+					0x80);
+	ERROR_CHECK(result);
+
+	return result;
+}
+
+static int bma250_exit(void *mlsl_handle,
+			  struct ext_slave_descr *slave,
+			  struct ext_slave_platform_data *pdata)
+{
+	if (pdata->private_data)
+		return MLOSFree(pdata->private_data);
+	else
+		return ML_SUCCESS;
+}
+
+static int bma250_config(void *mlsl_handle,
+			struct ext_slave_descr *slave,
+			struct ext_slave_platform_data *pdata,
+			struct ext_slave_config *data)
+{
+	struct bma250_private_data *private_data = pdata->private_data;
+	if (!data->data)
+		return ML_ERROR_INVALID_PARAMETER;
+
+	switch (data->key) {
+	case MPU_SLAVE_CONFIG_ODR_SUSPEND:
+		return bma250_set_odr(mlsl_handle, pdata,
+					&private_data->suspend,
+					data->apply,
+					*((long *)data->data));
+	case MPU_SLAVE_CONFIG_ODR_RESUME:
+		return bma250_set_odr(mlsl_handle, pdata,
+					&private_data->resume,
+					data->apply,
+					*((long *)data->data));
+	case MPU_SLAVE_CONFIG_FSR_SUSPEND:
+		return bma250_set_fsr(mlsl_handle, pdata,
+					&private_data->suspend,
+					data->apply,
+					*((long *)data->data));
+	case MPU_SLAVE_CONFIG_FSR_RESUME:
+		return bma250_set_fsr(mlsl_handle, pdata,
+					&private_data->resume,
+					data->apply,
+					*((long *)data->data));
+	case MPU_SLAVE_CONFIG_IRQ_SUSPEND:
+		return bma250_set_irq(mlsl_handle, pdata,
+					&private_data->suspend,
+					data->apply,
+					*((long *)data->data));
+	case MPU_SLAVE_CONFIG_IRQ_RESUME:
+		return bma250_set_irq(mlsl_handle, pdata,
+					&private_data->resume,
+					data->apply,
+					*((long *)data->data));
+	default:
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+	};
+	return ML_SUCCESS;
+}
+
+static int bma250_get_config(void *mlsl_handle,
+				struct ext_slave_descr *slave,
+				struct ext_slave_platform_data *pdata,
+				struct ext_slave_config *data)
+{
+	struct bma250_private_data *private_data = pdata->private_data;
+	if (!data->data)
+		return ML_ERROR_INVALID_PARAMETER;
+
+	switch (data->key) {
+	case MPU_SLAVE_CONFIG_ODR_SUSPEND:
+		(*(unsigned long *)data->data) =
+			(unsigned long) private_data->suspend.odr;
+		break;
+	case MPU_SLAVE_CONFIG_ODR_RESUME:
+		(*(unsigned long *)data->data) =
+			(unsigned long) private_data->resume.odr;
+		break;
+	case MPU_SLAVE_CONFIG_FSR_SUSPEND:
+		(*(unsigned long *)data->data) =
+			(unsigned long) private_data->suspend.fsr;
+		break;
+	case MPU_SLAVE_CONFIG_FSR_RESUME:
+		(*(unsigned long *)data->data) =
+			(unsigned long) private_data->resume.fsr;
+		break;
+	case MPU_SLAVE_CONFIG_IRQ_SUSPEND:
+		(*(unsigned long *)data->data) =
+			(unsigned long) private_data->suspend.irq_type;
+		break;
+	case MPU_SLAVE_CONFIG_IRQ_RESUME:
+		(*(unsigned long *)data->data) =
+			(unsigned long) private_data->resume.irq_type;
+		break;
+	default:
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+	};
+
+	return ML_SUCCESS;
+}
+
+static struct ext_slave_descr bma250_descr = {
+	 bma250_init,
+	 bma250_exit,
+	 bma250_suspend,
+	 bma250_resume,
+	 bma250_read,
+	 bma250_config,
+	 bma250_get_config,
+	 "bma250",
+	 EXT_SLAVE_TYPE_ACCELEROMETER,
+	 ACCEL_ID_BMA250,
+	 0x02,
+	 6,
+	 EXT_SLAVE_LITTLE_ENDIAN,
+	 {2, 0},
+};
+
+struct ext_slave_descr *bma250_get_slave_descr(void)
+{
+	return &bma250_descr;
+}
+EXPORT_SYMBOL(bma250_get_slave_descr);
+
+#ifdef __KERNEL__
+MODULE_AUTHOR("Invensense");
+MODULE_DESCRIPTION("User space IRQ handler for MPU3xxx devices");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("bma");
+#endif
+
diff --git a/drivers/input/misc/mpu3050/compass/ak8975.c b/drivers/input/misc/mpu3050/compass/ak8975.c
new file mode 100644
index 0000000..2a58f56
--- /dev/null
+++ b/drivers/input/misc/mpu3050/compass/ak8975.c
@@ -0,0 +1,205 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+
+
+#include <string.h>
+
+#ifdef __KERNEL__
+#include <linux/module.h>
+#endif
+
+#include "mpu.h"
+#include "mlsl.h"
+#include "mlos.h"
+
+#include <log.h>
+#undef MPL_LOG_TAG
+#define MPL_LOG_TAG "MPL-compass"
+
+
+#define AK8975_REG_ST1  (0x02)
+#define AK8975_REG_HXL  (0x03)
+#define AK8975_REG_ST2  (0x09)
+
+#define AK8975_REG_CNTL (0x0A)
+
+#define AK8975_CNTL_MODE_POWER_DOWN         (0x00)
+#define AK8975_CNTL_MODE_SINGLE_MEASUREMENT (0x01)
+
+int ak8975_suspend(void *mlsl_handle,
+		   struct ext_slave_descr *slave,
+		   struct ext_slave_platform_data *pdata)
+{
+	int result = ML_SUCCESS;
+	result =
+	    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+				  AK8975_REG_CNTL,
+				  AK8975_CNTL_MODE_POWER_DOWN);
+	MLOSSleep(1);		
+	ERROR_CHECK(result);
+	return result;
+}
+
+int ak8975_resume(void *mlsl_handle,
+		  struct ext_slave_descr *slave,
+		  struct ext_slave_platform_data *pdata)
+{
+	int result = ML_SUCCESS;
+	result =
+	    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+				  AK8975_REG_CNTL,
+				  AK8975_CNTL_MODE_SINGLE_MEASUREMENT);
+	ERROR_CHECK(result);
+	return result;
+}
+
+int ak8975_read(void *mlsl_handle,
+		struct ext_slave_descr *slave,
+		struct ext_slave_platform_data *pdata, unsigned char *data)
+{
+	unsigned char regs[8];
+	unsigned char *stat = &regs[0];
+	unsigned char *stat2 = &regs[7];
+	int result = ML_SUCCESS;
+	int status = ML_SUCCESS;
+
+	result =
+	    MLSLSerialRead(mlsl_handle, pdata->address, AK8975_REG_ST1,
+			   8, regs);
+	ERROR_CHECK(result);
+
+	if (*stat & 0x01) {
+		memcpy(data, &regs[1], 6);
+		status = ML_SUCCESS;
+	}
+
+	if (*stat2 & 0x04)
+		status = ML_ERROR_COMPASS_DATA_ERROR;
+	if (*stat2 & 0x08)
+		status = ML_ERROR_COMPASS_DATA_OVERFLOW;
+	if (*stat & 0x02) {
+		
+		status = ML_SUCCESS;
+	}
+
+	if (*stat != 0x00 || *stat2 != 0x00) {
+		result =
+		    MLSLSerialWriteSingle(mlsl_handle, pdata->address,
+					  AK8975_REG_CNTL,
+					  AK8975_CNTL_MODE_SINGLE_MEASUREMENT);
+		ERROR_CHECK(result);
+	}
+
+	return status;
+}
+
+static int ak8975_config(void *mlsl_handle,
+			struct ext_slave_descr *slave,
+			struct ext_slave_platform_data *pdata,
+			struct ext_slave_config *data)
+{
+	int result;
+	if (!data->data)
+		return ML_ERROR_INVALID_PARAMETER;
+
+	switch (data->key) {
+	case MPU_SLAVE_WRITE_REGISTERS:
+		result = MLSLSerialWrite(mlsl_handle, pdata->address,
+					data->len,
+					(unsigned char *)data->data);
+		ERROR_CHECK(result);
+		break;
+	case MPU_SLAVE_CONFIG_ODR_SUSPEND:
+	case MPU_SLAVE_CONFIG_ODR_RESUME:
+	case MPU_SLAVE_CONFIG_FSR_SUSPEND:
+	case MPU_SLAVE_CONFIG_FSR_RESUME:
+	case MPU_SLAVE_CONFIG_MOT_THS:
+	case MPU_SLAVE_CONFIG_NMOT_THS:
+	case MPU_SLAVE_CONFIG_MOT_DUR:
+	case MPU_SLAVE_CONFIG_NMOT_DUR:
+	case MPU_SLAVE_CONFIG_IRQ_SUSPEND:
+	case MPU_SLAVE_CONFIG_IRQ_RESUME:
+	default:
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+	};
+
+	return ML_SUCCESS;
+}
+
+static int ak8975_get_config(void *mlsl_handle,
+				struct ext_slave_descr *slave,
+				struct ext_slave_platform_data *pdata,
+				struct ext_slave_config *data)
+{
+	int result;
+	if (!data->data)
+		return ML_ERROR_INVALID_PARAMETER;
+
+	switch (data->key) {
+	case MPU_SLAVE_READ_REGISTERS:
+	{
+		unsigned char *serial_data = (unsigned char *)data->data;
+		result = MLSLSerialRead(mlsl_handle, pdata->address,
+					serial_data[0],
+					data->len - 1,
+					&serial_data[1]);
+		ERROR_CHECK(result);
+		break;
+	}
+	case MPU_SLAVE_CONFIG_ODR_SUSPEND:
+	case MPU_SLAVE_CONFIG_ODR_RESUME:
+	case MPU_SLAVE_CONFIG_FSR_SUSPEND:
+	case MPU_SLAVE_CONFIG_FSR_RESUME:
+	case MPU_SLAVE_CONFIG_MOT_THS:
+	case MPU_SLAVE_CONFIG_NMOT_THS:
+	case MPU_SLAVE_CONFIG_MOT_DUR:
+	case MPU_SLAVE_CONFIG_NMOT_DUR:
+	case MPU_SLAVE_CONFIG_IRQ_SUSPEND:
+	case MPU_SLAVE_CONFIG_IRQ_RESUME:
+	default:
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+	};
+
+	return ML_SUCCESS;
+}
+
+struct ext_slave_descr ak8975_descr = {
+	 NULL,
+	 NULL,
+	 ak8975_suspend,
+	 ak8975_resume,
+	 ak8975_read,
+	 ak8975_config,
+	 ak8975_get_config,
+	 "ak8975",
+	 EXT_SLAVE_TYPE_COMPASS,
+	 COMPASS_ID_AKM,
+	 0x01,
+	 9,
+	 EXT_SLAVE_LITTLE_ENDIAN,
+	 {9830, 4000}
+};
+
+struct ext_slave_descr *ak8975_get_slave_descr(void)
+{
+	return &ak8975_descr;
+}
+EXPORT_SYMBOL(ak8975_get_slave_descr);
+
diff --git a/drivers/input/misc/mpu3050/log.h b/drivers/input/misc/mpu3050/log.h
new file mode 100644
index 0000000..7b24aca
--- /dev/null
+++ b/drivers/input/misc/mpu3050/log.h
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2010 InvenSense Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _LIBS_CUTILS_MPL_LOG_H
+#define _LIBS_CUTILS_MPL_LOG_H
+
+#include <stdarg.h>
+
+#ifdef ANDROID
+#include <utils/Log.h>		
+#endif
+
+#ifdef __KERNEL__
+#include <linux/kernel.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifndef MPL_LOG_NDEBUG
+#ifdef NDEBUG
+#define MPL_LOG_NDEBUG 1
+#else
+#define MPL_LOG_NDEBUG 0
+#endif
+#endif
+
+#ifdef __KERNEL__
+#define MPL_LOG_UNKNOWN MPL_LOG_VERBOSE
+#define MPL_LOG_DEFAULT KERN_DEFAULT
+#define MPL_LOG_VERBOSE KERN_CONT
+#define MPL_LOG_DEBUG   KERN_NOTICE
+#define MPL_LOG_INFO    KERN_INFO
+#define MPL_LOG_WARN    KERN_WARNING
+#define MPL_LOG_ERROR   KERN_ERR
+#define MPL_LOG_SILENT  MPL_LOG_VERBOSE
+
+#else
+#define MPL_LOG_UNKNOWN (0)
+#define MPL_LOG_DEFAULT (1)
+#define MPL_LOG_VERBOSE (2)
+#define MPL_LOG_DEBUG (3)
+#define MPL_LOG_INFO (4)
+#define MPL_LOG_WARN (5)
+#define MPL_LOG_ERROR (6)
+#define MPL_LOG_SILENT (8)
+#endif
+
+
+#ifndef MPL_LOG_TAG
+#ifdef __KERNEL__
+#define MPL_LOG_TAG
+#else
+#define MPL_LOG_TAG NULL
+#endif
+#endif
+
+
+#ifndef MPL_LOGV
+#if MPL_LOG_NDEBUG
+#define MPL_LOGV(...) ((void)0)
+#else
+#define MPL_LOGV(...) ((void)MPL_LOG(LOG_VERBOSE, MPL_LOG_TAG, __VA_ARGS__))
+#endif
+#endif
+
+#ifndef CONDITION
+#define CONDITION(cond)     ((cond) != 0)
+#endif
+
+#ifndef MPL_LOGV_IF
+#if MPL_LOG_NDEBUG
+#define MPL_LOGV_IF(cond, ...)   ((void)0)
+#else
+#define MPL_LOGV_IF(cond, ...) \
+	((CONDITION(cond))						\
+		? ((void)MPL_LOG(LOG_VERBOSE, MPL_LOG_TAG, __VA_ARGS__)) \
+		: (void)0)
+#endif
+#endif
+
+#ifndef MPL_LOGD
+#define MPL_LOGD(...) ((void)MPL_LOG(LOG_DEBUG, MPL_LOG_TAG, __VA_ARGS__))
+#endif
+
+#ifndef MPL_LOGD_IF
+#define MPL_LOGD_IF(cond, ...) \
+	((CONDITION(cond))					       \
+		? ((void)MPL_LOG(LOG_DEBUG, MPL_LOG_TAG, __VA_ARGS__)) \
+		: (void)0)
+#endif
+
+#ifndef MPL_LOGI
+#define MPL_LOGI(...) ((void)MPL_LOG(LOG_INFO, MPL_LOG_TAG, __VA_ARGS__))
+#endif
+
+#ifndef MPL_LOGI_IF
+#define MPL_LOGI_IF(cond, ...) \
+	((CONDITION(cond))                                              \
+		? ((void)MPL_LOG(LOG_INFO, MPL_LOG_TAG, __VA_ARGS__))   \
+		: (void)0)
+#endif
+
+#ifndef MPL_LOGW
+#define MPL_LOGW(...) ((void)MPL_LOG(LOG_WARN, MPL_LOG_TAG, __VA_ARGS__))
+#endif
+
+#ifndef MPL_LOGW_IF
+#define MPL_LOGW_IF(cond, ...) \
+	((CONDITION(cond))					       \
+		? ((void)MPL_LOG(LOG_WARN, MPL_LOG_TAG, __VA_ARGS__))  \
+		: (void)0)
+#endif
+
+#ifndef MPL_LOGE
+#define MPL_LOGE(...) ((void)MPL_LOG(LOG_ERROR, MPL_LOG_TAG, __VA_ARGS__))
+#endif
+
+#ifndef MPL_LOGE_IF
+#define MPL_LOGE_IF(cond, ...) \
+	((CONDITION(cond))					       \
+		? ((void)MPL_LOG(LOG_ERROR, MPL_LOG_TAG, __VA_ARGS__)) \
+		: (void)0)
+#endif
+
+
+#define MPL_LOG_ALWAYS_FATAL_IF(cond, ...) \
+	((CONDITION(cond))					   \
+		? ((void)android_printAssert(#cond, MPL_LOG_TAG, __VA_ARGS__)) \
+		: (void)0)
+
+#define MPL_LOG_ALWAYS_FATAL(...) \
+	(((void)android_printAssert(NULL, MPL_LOG_TAG, __VA_ARGS__)))
+
+#if MPL_LOG_NDEBUG
+
+#define MPL_LOG_FATAL_IF(cond, ...) ((void)0)
+#define MPL_LOG_FATAL(...)          ((void)0)
+
+#else
+
+#define MPL_LOG_FATAL_IF(cond, ...) MPL_LOG_ALWAYS_FATAL_IF(cond, __VA_ARGS__)
+#define MPL_LOG_FATAL(...)          MPL_LOG_ALWAYS_FATAL(__VA_ARGS__)
+
+#endif
+
+#define MPL_LOG_ASSERT(cond, ...) MPL_LOG_FATAL_IF(!(cond), __VA_ARGS__)
+
+
+#ifndef MPL_LOG
+#define MPL_LOG(priority, tag, ...) \
+    MPL_LOG_PRI(priority, tag, __VA_ARGS__)
+#endif
+
+#ifndef MPL_LOG_PRI
+#ifdef ANDROID
+#define MPL_LOG_PRI(priority, tag, ...) \
+	LOG(priority, tag, __VA_ARGS__)
+#elif defined __KERNEL__
+#define MPL_LOG_PRI(priority, tag, ...) \
+	printk(MPL_##priority tag __VA_ARGS__)
+#else
+#define MPL_LOG_PRI(priority, tag, ...) \
+	_MLPrintLog(MPL_##priority, tag, __VA_ARGS__)
+#endif
+#endif
+
+#ifndef MPL_LOG_PRI_VA
+#ifdef ANDROID
+#define MPL_LOG_PRI_VA(priority, tag, fmt, args) \
+    android_vprintLog(priority, NULL, tag, fmt, args)
+#elif defined __KERNEL__
+#define MPL_LOG_PRI_VA(priority, tag, fmt, args) \
+    vprintk(MPL_##priority tag fmt, args)
+#else
+#define MPL_LOG_PRI_VA(priority, tag, fmt, args) \
+    _MLPrintVaLog(priority, NULL, tag, fmt, args)
+#endif
+#endif
+
+
+
+#ifndef ANDROID
+	int _MLPrintLog(int priority, const char *tag, const char *fmt,
+			...);
+	int _MLPrintVaLog(int priority, const char *tag, const char *fmt,
+			  va_list args);
+	int _MLWriteLog(const char *buf, int buflen);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif				
diff --git a/drivers/input/misc/mpu3050/mldl_cfg.c b/drivers/input/misc/mpu3050/mldl_cfg.c
new file mode 100644
index 0000000..6b12dda
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mldl_cfg.c
@@ -0,0 +1,1434 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+
+
+#include <stddef.h>
+
+#include "mldl_cfg.h"
+#include "mpu.h"
+
+#include "mlsl.h"
+#include "mlos.h"
+
+#include "log.h"
+#undef MPL_LOG_TAG
+#define MPL_LOG_TAG "mldl_cfg:"
+
+#ifdef M_HW
+#define SLEEP   0
+#define WAKE_UP 7
+#define RESET   1
+#define STANDBY 1
+#else
+#define SLEEP   1
+#define WAKE_UP 0
+#define RESET   1
+#define STANDBY 1
+#endif
+
+#define D(x...) printk(KERN_DEBUG "[GYRO][MPU3050] " x)
+#define I(x...) printk(KERN_INFO "[GYRO][MPU3050] " x)
+#define E(x...) printk(KERN_ERR "[GYRO][MPU3050 ERROR] " x)
+
+
+
+static int dmp_stop(struct mldl_cfg *mldl_cfg, void *gyro_handle)
+{
+	unsigned char userCtrlReg = 0;
+	int result;
+
+	if (!mldl_cfg->dmp_is_running)
+		return ML_SUCCESS;
+
+	result = MLSLSerialRead(gyro_handle, mldl_cfg->addr,
+				MPUREG_USER_CTRL, 1, &userCtrlReg);
+	ERROR_CHECK(result);
+	userCtrlReg = (userCtrlReg & (~BIT_FIFO_EN)) | BIT_FIFO_RST;
+	userCtrlReg = (userCtrlReg & (~BIT_DMP_EN)) | BIT_DMP_RST;
+
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				       MPUREG_USER_CTRL, userCtrlReg);
+	ERROR_CHECK(result);
+	mldl_cfg->dmp_is_running = 0;
+
+	return result;
+
+}
+static int dmp_start(struct mldl_cfg *pdata, void *mlsl_handle)
+{
+	unsigned char userCtrlReg = 0;
+	int result;
+
+	if (pdata->dmp_is_running == pdata->dmp_enable)
+		return ML_SUCCESS;
+
+	result = MLSLSerialRead(mlsl_handle, pdata->addr,
+				MPUREG_USER_CTRL, 1, &userCtrlReg);
+	ERROR_CHECK(result);
+
+	result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+				       MPUREG_USER_CTRL,
+				       ((userCtrlReg & (~BIT_FIFO_EN))
+						|   BIT_FIFO_RST));
+	ERROR_CHECK(result);
+
+	result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+				       MPUREG_USER_CTRL, userCtrlReg);
+	ERROR_CHECK(result);
+
+	result = MLSLSerialRead(mlsl_handle, pdata->addr,
+				MPUREG_USER_CTRL, 1, &userCtrlReg);
+	ERROR_CHECK(result);
+
+	if (pdata->dmp_enable)
+		userCtrlReg |= BIT_DMP_EN;
+	else
+		userCtrlReg &= ~BIT_DMP_EN;
+
+	if (pdata->fifo_enable)
+		userCtrlReg |= BIT_FIFO_EN;
+	else
+		userCtrlReg &= ~BIT_FIFO_EN;
+
+	userCtrlReg |= BIT_DMP_RST;
+
+	result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+				       MPUREG_USER_CTRL, userCtrlReg);
+	ERROR_CHECK(result);
+	pdata->dmp_is_running = pdata->dmp_enable;
+
+	return result;
+}
+
+static int MLDLSetI2CBypass(struct mldl_cfg *mldl_cfg,
+			    void *mlsl_handle,
+			    unsigned char enable)
+{
+	unsigned char b = 0;
+	int result;
+
+	if ((mldl_cfg->gyro_is_bypassed && enable) ||
+	    (!mldl_cfg->gyro_is_bypassed && !enable))
+		return ML_SUCCESS;
+
+	
+	result = MLSLSerialRead(mlsl_handle, mldl_cfg->addr,
+				MPUREG_USER_CTRL, 1, &b);
+	ERROR_CHECK(result);
+
+	b &= ~BIT_AUX_IF_EN;
+
+	if (!enable) {
+		result = MLSLSerialWriteSingle(mlsl_handle, mldl_cfg->addr,
+					       MPUREG_USER_CTRL,
+					       (b | BIT_AUX_IF_EN));
+		ERROR_CHECK(result);
+	} else {
+		result = MLSLSerialWriteSingle(mlsl_handle, mldl_cfg->addr,
+					       MPUREG_AUX_SLV_ADDR, 0x7F);
+		ERROR_CHECK(result);
+		MLOSSleep(2);
+		result = MLSLSerialWriteSingle(mlsl_handle, mldl_cfg->addr,
+					       MPUREG_USER_CTRL, (b));
+		ERROR_CHECK(result);
+		MLOSSleep(SAMPLING_PERIOD_US(mldl_cfg) / 1000);
+		result = MLSLSerialWriteSingle(mlsl_handle, mldl_cfg->addr,
+					       MPUREG_AUX_SLV_ADDR,
+					       mldl_cfg->pdata->
+					       accel.address);
+		ERROR_CHECK(result);
+
+#ifdef M_HW
+		result = MLSLSerialWriteSingle(mlsl_handle, mldl_cfg->addr,
+					       MPUREG_USER_CTRL,
+					       (b | BIT_I2C_MST_RST));
+
+#else
+		result = MLSLSerialWriteSingle(mlsl_handle, mldl_cfg->addr,
+					       MPUREG_USER_CTRL,
+					       (b | BIT_AUX_IF_RST));
+#endif
+		ERROR_CHECK(result);
+		MLOSSleep(2);
+	}
+	mldl_cfg->gyro_is_bypassed = enable;
+
+	return result;
+}
+
+struct tsProdRevMap {
+	unsigned char siliconRev;
+	unsigned short sensTrim;
+};
+
+#define NUM_OF_PROD_REVS (DIM(prodRevsMap))
+
+#ifdef M_HW
+#define OLDEST_PROD_REV_SUPPORTED 1
+static struct tsProdRevMap prodRevsMap[] = {
+	{0, 0},
+	{MPU_SILICON_REV_A1, 131},	
+	{MPU_SILICON_REV_A1, 131},	
+	{MPU_SILICON_REV_A1, 131},	
+	{MPU_SILICON_REV_A1, 131},	
+	{MPU_SILICON_REV_A1, 131},	
+	{MPU_SILICON_REV_A1, 131},	
+	{MPU_SILICON_REV_A1, 131},	
+	{MPU_SILICON_REV_A1, 131},	
+};
+
+#else				
+#define OLDEST_PROD_REV_SUPPORTED 11
+
+static struct tsProdRevMap prodRevsMap[] = {
+	{0, 0},
+	{MPU_SILICON_REV_A4, 131},	
+	{MPU_SILICON_REV_A4, 131},	
+	{MPU_SILICON_REV_A4, 131},	
+	{MPU_SILICON_REV_A4, 131},	
+	{MPU_SILICON_REV_A4, 131},	
+	{MPU_SILICON_REV_A4, 131},	
+	{MPU_SILICON_REV_A4, 131},	
+	{MPU_SILICON_REV_A4, 131},	
+	{MPU_SILICON_REV_A4, 131},	
+	{MPU_SILICON_REV_A4, 131},	
+	{MPU_SILICON_REV_B1, 131},	
+	{MPU_SILICON_REV_B1, 131},	
+	{MPU_SILICON_REV_B1, 131},	
+	{MPU_SILICON_REV_B1, 131},	
+	{MPU_SILICON_REV_B4, 131},	
+	{MPU_SILICON_REV_B4, 131},	
+	{MPU_SILICON_REV_B4, 131},	
+	{MPU_SILICON_REV_B4, 131},	
+	{MPU_SILICON_REV_B4, 115},	
+	{MPU_SILICON_REV_B4, 115},	
+	{MPU_SILICON_REV_B6, 131},	
+	{MPU_SILICON_REV_B4, 115},	
+	{MPU_SILICON_REV_B6, 0},	
+	{MPU_SILICON_REV_B6, 0},	
+	{MPU_SILICON_REV_B6, 0},	
+	{MPU_SILICON_REV_B6, 131},	
+};
+#endif				
+
+static int MLDLGetSiliconRev(struct mldl_cfg *pdata,
+			     void *mlsl_handle)
+{
+	int result;
+	unsigned char index = 0x00;
+	unsigned char bank =
+	    (BIT_PRFTCH_EN | BIT_CFG_USER_BANK | MPU_MEM_OTP_BANK_0);
+	unsigned short memAddr = ((bank << 8) | 0x06);
+
+	result = MLSLSerialReadMem(mlsl_handle, pdata->addr,
+				   memAddr, 1, &index);
+	ERROR_CHECK(result)
+	if (result)
+		return result;
+	index >>= 2;
+
+	
+	result =
+	    MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+				  MPUREG_BANK_SEL, 0);
+	ERROR_CHECK(result)
+	if (result)
+		return result;
+
+	if (index < OLDEST_PROD_REV_SUPPORTED || NUM_OF_PROD_REVS <= index) {
+		pdata->silicon_revision = 0;
+		pdata->trim = 0;
+		MPL_LOGE("Unsupported Product Revision Detected : %d\n", index);
+		return ML_ERROR_INVALID_MODULE;
+	}
+
+	pdata->silicon_revision = prodRevsMap[index].siliconRev;
+	pdata->trim = prodRevsMap[index].sensTrim;
+
+	if (pdata->trim == 0) {
+		MPL_LOGE("sensitivity trim is 0"
+			 " - unsupported non production part.\n");
+		return ML_ERROR_INVALID_MODULE;
+	}
+
+	return result;
+}
+
+static int MLDLSetLevelShifterBit(struct mldl_cfg *pdata,
+				  void *mlsl_handle,
+				  unsigned char enable)
+{
+#ifndef M_HW
+	int result;
+	unsigned char reg;
+	unsigned char mask;
+	unsigned char regval = 0;
+
+	if (0 == pdata->silicon_revision)
+		return ML_ERROR_INVALID_PARAMETER;
+
+	if ((pdata->silicon_revision & 0xf) < MPU_SILICON_REV_B6) {
+		reg = MPUREG_ACCEL_BURST_ADDR;
+		mask = 0x80;
+	} else {
+		reg = MPUREG_FIFO_EN2;
+		mask = 0x04;
+	}
+
+	result = MLSLSerialRead(mlsl_handle, pdata->addr, reg, 1, &regval);
+	if (result)
+		return result;
+
+	if (enable)
+		regval |= mask;
+	else
+		regval &= ~mask;
+
+	result =
+	    MLSLSerialWriteSingle(mlsl_handle, pdata->addr, reg, regval);
+
+	return result;
+#else
+	return ML_SUCCESS;
+#endif
+}
+
+
+#ifdef M_HW
+static tMLError mpu60xx_pwr_mgmt(struct mldl_cfg *pdata,
+				 void *mlsl_handle,
+				 unsigned char reset,
+				 unsigned char powerselection)
+{
+	unsigned char b;
+	tMLError result;
+
+	if (powerselection < 0 || powerselection > 7)
+		return ML_ERROR_INVALID_PARAMETER;
+
+	result =
+	    MLSLSerialRead(mlsl_handle, pdata->addr, MPUREG_PWR_MGMT_1, 1,
+			   &b);
+	ERROR_CHECK(result);
+
+	b &= ~(BITS_PWRSEL);
+
+	if (reset) {
+		result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+					       MPUREG_PWR_MGM, b | BIT_H_RESET);
+#define M_HW_RESET_ERRATTA
+#ifndef M_HW_RESET_ERRATTA
+		ERROR_CHECK(result);
+#else
+		MLOSSleep(50);
+#endif
+	}
+
+	b |= (powerselection << 4);
+
+	if (b & BITS_PWRSEL)
+		pdata->gyro_is_suspended = FALSE;
+	else
+		pdata->gyro_is_suspended = TRUE;
+
+	result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+				       MPUREG_PWR_MGM, b);
+	ERROR_CHECK(result);
+
+	return ML_SUCCESS;
+}
+
+static tMLError MLDLStandByGyros(struct mldl_cfg *pdata,
+				 void *mlsl_handle,
+				 unsigned char disable_gx,
+				 unsigned char disable_gy,
+				 unsigned char disable_gz)
+{
+	unsigned char b;
+	tMLError result;
+
+	result =
+	    MLSLSerialRead(mlsl_handle, pdata->addr, MPUREG_PWR_MGMT_2, 1,
+			   &b);
+	ERROR_CHECK(result);
+
+	b &= ~(BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG);
+	b |= (disable_gx << 2 | disable_gy << 1 | disable_gz);
+
+	result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+				       MPUREG_PWR_MGMT_2, b);
+	ERROR_CHECK(result);
+
+	return ML_SUCCESS;
+}
+
+static tMLError MLDLStandByAccels(struct mldl_cfg *pdata,
+				  void *mlsl_handle,
+				  unsigned char disable_ax,
+				  unsigned char disable_ay,
+				  unsigned char disable_az)
+{
+	unsigned char b;
+	tMLError result;
+
+	result =
+	    MLSLSerialRead(mlsl_handle, pdata->addr, MPUREG_PWR_MGMT_2, 1,
+			   &b);
+	ERROR_CHECK(result);
+
+	b &= ~(BIT_STBY_XA | BIT_STBY_YA | BIT_STBY_ZA);
+	b |= (disable_ax << 2 | disable_ay << 1 | disable_az);
+
+	result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+				       MPUREG_PWR_MGMT_2, b);
+	ERROR_CHECK(result);
+
+	return ML_SUCCESS;
+}
+
+#else				
+
+static int MLDLPowerMgmtMPU(struct mldl_cfg *pdata,
+			    void *mlsl_handle,
+			    unsigned char reset,
+			    unsigned char sleep,
+			    unsigned char disable_gx,
+			    unsigned char disable_gy,
+			    unsigned char disable_gz)
+{
+	unsigned char b = 0;
+	int result;
+
+	result =
+	    MLSLSerialRead(mlsl_handle, pdata->addr, MPUREG_PWR_MGM, 1,
+			   &b);
+	ERROR_CHECK(result);
+
+	
+	if ((!(b & BIT_SLEEP)) && reset)
+		result = MLDLSetI2CBypass(pdata, mlsl_handle, 1);
+
+	
+	if ((!(b & BIT_SLEEP)) && sleep)
+		dmp_stop(pdata, mlsl_handle);
+
+	
+	if (reset) {
+		MPL_LOGV("Reset MPU3050\n");
+		result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+					MPUREG_PWR_MGM, b | BIT_H_RESET);
+		ERROR_CHECK(result);
+		MLOSSleep(5);
+		pdata->gyro_needs_reset = FALSE;
+		result = MLSLSerialRead(mlsl_handle, pdata->addr,
+					MPUREG_PWR_MGM, 1, &b);
+		ERROR_CHECK(result);
+	}
+
+	
+	if (b & BIT_SLEEP)
+		pdata->gyro_is_suspended = TRUE;
+	else
+		pdata->gyro_is_suspended = FALSE;
+
+	
+	if ((b & (BIT_SLEEP | BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG)) ==
+		(((sleep != 0) * BIT_SLEEP) |
+		((disable_gx != 0) * BIT_STBY_XG) |
+		((disable_gy != 0) * BIT_STBY_YG) |
+		((disable_gz != 0) * BIT_STBY_ZG))) {
+		return ML_SUCCESS;
+	}
+
+	if ((b & (BIT_SLEEP | BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG)) ==
+		 (BIT_SLEEP | BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG)
+		&& ((!sleep) && disable_gx && disable_gy && disable_gz)) {
+		result = MLDLPowerMgmtMPU(pdata, mlsl_handle, 0, 1, 0, 0, 0);
+		if (result)
+			return result;
+		b |= BIT_SLEEP;
+		b &= ~(BIT_STBY_XG | BIT_STBY_YG | BIT_STBY_ZG);
+	}
+
+	if ((b & BIT_SLEEP) != ((sleep != 0) * BIT_SLEEP)) {
+		if (sleep) {
+			result = MLDLSetI2CBypass(pdata, mlsl_handle, 1);
+			ERROR_CHECK(result);
+			b |= BIT_SLEEP;
+			result =
+			    MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+						  MPUREG_PWR_MGM, b);
+			ERROR_CHECK(result);
+			pdata->gyro_is_suspended = TRUE;
+		} else {
+			b &= ~BIT_SLEEP;
+			result =
+			    MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+						  MPUREG_PWR_MGM, b);
+			ERROR_CHECK(result);
+			pdata->gyro_is_suspended = FALSE;
+			MLOSSleep(5);
+		}
+	}
+	if ((b & BIT_STBY_XG) != ((disable_gx != 0) * BIT_STBY_XG)) {
+		b ^= BIT_STBY_XG;
+		result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+						MPUREG_PWR_MGM, b);
+		ERROR_CHECK(result);
+	}
+	if ((b & BIT_STBY_YG) != ((disable_gy != 0) * BIT_STBY_YG)) {
+		b ^= BIT_STBY_YG;
+		result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+					       MPUREG_PWR_MGM, b);
+		ERROR_CHECK(result);
+	}
+	if ((b & BIT_STBY_ZG) != ((disable_gz != 0) * BIT_STBY_ZG)) {
+		b ^= BIT_STBY_ZG;
+		result = MLSLSerialWriteSingle(mlsl_handle, pdata->addr,
+					       MPUREG_PWR_MGM, b);
+		ERROR_CHECK(result);
+	}
+
+	return ML_SUCCESS;
+}
+#endif				
+
+
+void mpu_print_cfg(struct mldl_cfg *mldl_cfg)
+{
+	struct mpu3050_platform_data *pdata = mldl_cfg->pdata;
+	struct ext_slave_platform_data *accel = &mldl_cfg->pdata->accel;
+	struct ext_slave_platform_data *compass =
+	    &mldl_cfg->pdata->compass;
+	struct ext_slave_platform_data *pressure =
+	    &mldl_cfg->pdata->pressure;
+
+	MPL_LOGD("mldl_cfg.addr             = %02x\n", mldl_cfg->addr);
+	MPL_LOGD("mldl_cfg.int_config       = %02x\n",
+		 mldl_cfg->int_config);
+	MPL_LOGD("mldl_cfg.ext_sync         = %02x\n", mldl_cfg->ext_sync);
+	MPL_LOGD("mldl_cfg.full_scale       = %02x\n",
+		 mldl_cfg->full_scale);
+	MPL_LOGD("mldl_cfg.lpf              = %02x\n", mldl_cfg->lpf);
+	MPL_LOGD("mldl_cfg.clk_src          = %02x\n", mldl_cfg->clk_src);
+	MPL_LOGD("mldl_cfg.divider          = %02x\n", mldl_cfg->divider);
+	MPL_LOGD("mldl_cfg.dmp_enable       = %02x\n",
+		 mldl_cfg->dmp_enable);
+	MPL_LOGD("mldl_cfg.fifo_enable      = %02x\n",
+		 mldl_cfg->fifo_enable);
+	MPL_LOGD("mldl_cfg.dmp_cfg1         = %02x\n", mldl_cfg->dmp_cfg1);
+	MPL_LOGD("mldl_cfg.dmp_cfg2         = %02x\n", mldl_cfg->dmp_cfg2);
+	MPL_LOGD("mldl_cfg.offset_tc[0]     = %02x\n",
+		 mldl_cfg->offset_tc[0]);
+	MPL_LOGD("mldl_cfg.offset_tc[1]     = %02x\n",
+		 mldl_cfg->offset_tc[1]);
+	MPL_LOGD("mldl_cfg.offset_tc[2]     = %02x\n",
+		 mldl_cfg->offset_tc[2]);
+	MPL_LOGD("mldl_cfg.silicon_revision = %02x\n",
+		 mldl_cfg->silicon_revision);
+	MPL_LOGD("mldl_cfg.product_id       = %02x\n",
+		 mldl_cfg->product_id);
+	MPL_LOGD("mldl_cfg.trim             = %02x\n", mldl_cfg->trim);
+	MPL_LOGD("mldl_cfg.requested_sensors= %04lx\n",
+		 mldl_cfg->requested_sensors);
+
+	if (mldl_cfg->accel) {
+		MPL_LOGD("slave_accel->suspend      = %02x\n",
+			 (int) mldl_cfg->accel->suspend);
+		MPL_LOGD("slave_accel->resume       = %02x\n",
+			 (int) mldl_cfg->accel->resume);
+		MPL_LOGD("slave_accel->read         = %02x\n",
+			 (int) mldl_cfg->accel->read);
+		MPL_LOGD("slave_accel->type         = %02x\n",
+			 mldl_cfg->accel->type);
+		MPL_LOGD("slave_accel->reg          = %02x\n",
+			 mldl_cfg->accel->reg);
+		MPL_LOGD("slave_accel->len          = %02x\n",
+			 mldl_cfg->accel->len);
+		MPL_LOGD("slave_accel->endian       = %02x\n",
+			 mldl_cfg->accel->endian);
+		MPL_LOGD("slave_accel->range.mantissa= %02lx\n",
+			 mldl_cfg->accel->range.mantissa);
+		MPL_LOGD("slave_accel->range.fraction= %02lx\n",
+			 mldl_cfg->accel->range.fraction);
+	} else {
+		MPL_LOGD("slave_accel               = NULL\n");
+	}
+
+	if (mldl_cfg->compass) {
+		MPL_LOGD("slave_compass->suspend    = %02x\n",
+			 (int) mldl_cfg->compass->suspend);
+		MPL_LOGD("slave_compass->resume     = %02x\n",
+			 (int) mldl_cfg->compass->resume);
+		MPL_LOGD("slave_compass->read       = %02x\n",
+			 (int) mldl_cfg->compass->read);
+		MPL_LOGD("slave_compass->type       = %02x\n",
+			 mldl_cfg->compass->type);
+		MPL_LOGD("slave_compass->reg        = %02x\n",
+			 mldl_cfg->compass->reg);
+		MPL_LOGD("slave_compass->len        = %02x\n",
+			 mldl_cfg->compass->len);
+		MPL_LOGD("slave_compass->endian     = %02x\n",
+			 mldl_cfg->compass->endian);
+		MPL_LOGD("slave_compass->range.mantissa= %02lx\n",
+			 mldl_cfg->compass->range.mantissa);
+		MPL_LOGD("slave_compass->range.fraction= %02lx\n",
+			 mldl_cfg->compass->range.fraction);
+
+	} else {
+		MPL_LOGD("slave_compass             = NULL\n");
+	}
+
+	if (mldl_cfg->pressure) {
+		MPL_LOGD("slave_pressure->suspend    = %02x\n",
+			 (int) mldl_cfg->pressure->suspend);
+		MPL_LOGD("slave_pressure->resume     = %02x\n",
+			 (int) mldl_cfg->pressure->resume);
+		MPL_LOGD("slave_pressure->read       = %02x\n",
+			 (int) mldl_cfg->pressure->read);
+		MPL_LOGD("slave_pressure->type       = %02x\n",
+			 mldl_cfg->pressure->type);
+		MPL_LOGD("slave_pressure->reg        = %02x\n",
+			 mldl_cfg->pressure->reg);
+		MPL_LOGD("slave_pressure->len        = %02x\n",
+			 mldl_cfg->pressure->len);
+		MPL_LOGD("slave_pressure->endian     = %02x\n",
+			 mldl_cfg->pressure->endian);
+		MPL_LOGD("slave_pressure->range.mantissa= %02lx\n",
+			 mldl_cfg->pressure->range.mantissa);
+		MPL_LOGD("slave_pressure->range.fraction= %02lx\n",
+			 mldl_cfg->pressure->range.fraction);
+
+	} else {
+		MPL_LOGD("slave_pressure             = NULL\n");
+	}
+	MPL_LOGD("accel->get_slave_descr    = %x\n",
+		 (unsigned int) accel->get_slave_descr);
+	MPL_LOGD("accel->irq                = %02x\n", accel->irq);
+	MPL_LOGD("accel->adapt_num          = %02x\n", accel->adapt_num);
+	MPL_LOGD("accel->bus                = %02x\n", accel->bus);
+	MPL_LOGD("accel->address            = %02x\n", accel->address);
+	MPL_LOGD("accel->orientation        =\n"
+		 "                            %2d %2d %2d\n"
+		 "                            %2d %2d %2d\n"
+		 "                            %2d %2d %2d\n",
+		 accel->orientation[0], accel->orientation[1],
+		 accel->orientation[2], accel->orientation[3],
+		 accel->orientation[4], accel->orientation[5],
+		 accel->orientation[6], accel->orientation[7],
+		 accel->orientation[8]);
+	MPL_LOGD("compass->get_slave_descr  = %x\n",
+		 (unsigned int) compass->get_slave_descr);
+	MPL_LOGD("compass->irq              = %02x\n", compass->irq);
+	MPL_LOGD("compass->adapt_num        = %02x\n", compass->adapt_num);
+	MPL_LOGD("compass->bus              = %02x\n", compass->bus);
+	MPL_LOGD("compass->address          = %02x\n", compass->address);
+	MPL_LOGD("compass->orientation      =\n"
+		 "                            %2d %2d %2d\n"
+		 "                            %2d %2d %2d\n"
+		 "                            %2d %2d %2d\n",
+		 compass->orientation[0], compass->orientation[1],
+		 compass->orientation[2], compass->orientation[3],
+		 compass->orientation[4], compass->orientation[5],
+		 compass->orientation[6], compass->orientation[7],
+		 compass->orientation[8]);
+	MPL_LOGD("pressure->get_slave_descr  = %x\n",
+		 (unsigned int) pressure->get_slave_descr);
+	MPL_LOGD("pressure->irq             = %02x\n", pressure->irq);
+	MPL_LOGD("pressure->adapt_num       = %02x\n", pressure->adapt_num);
+	MPL_LOGD("pressure->bus             = %02x\n", pressure->bus);
+	MPL_LOGD("pressure->address         = %02x\n", pressure->address);
+	MPL_LOGD("pressure->orientation     =\n"
+		 "                            %2d %2d %2d\n"
+		 "                            %2d %2d %2d\n"
+		 "                            %2d %2d %2d\n",
+		 pressure->orientation[0], pressure->orientation[1],
+		 pressure->orientation[2], pressure->orientation[3],
+		 pressure->orientation[4], pressure->orientation[5],
+		 pressure->orientation[6], pressure->orientation[7],
+		 pressure->orientation[8]);
+
+	MPL_LOGD("pdata->int_config         = %02x\n", pdata->int_config);
+	MPL_LOGD("pdata->level_shifter      = %02x\n",
+		 pdata->level_shifter);
+	MPL_LOGD("pdata->orientation        =\n"
+		 "                            %2d %2d %2d\n"
+		 "                            %2d %2d %2d\n"
+		 "                            %2d %2d %2d\n",
+		 pdata->orientation[0], pdata->orientation[1],
+		 pdata->orientation[2], pdata->orientation[3],
+		 pdata->orientation[4], pdata->orientation[5],
+		 pdata->orientation[6], pdata->orientation[7],
+		 pdata->orientation[8]);
+
+	MPL_LOGD("Struct sizes: mldl_cfg: %d, "
+		 "ext_slave_descr:%d, "
+		 "mpu3050_platform_data:%d: RamOffset: %d\n",
+		 sizeof(struct mldl_cfg), sizeof(struct ext_slave_descr),
+		 sizeof(struct mpu3050_platform_data),
+		 offsetof(struct mldl_cfg, ram));
+}
+
+int mpu_set_slave(struct mldl_cfg *mldl_cfg,
+		void *gyro_handle,
+		struct ext_slave_descr *slave,
+		struct ext_slave_platform_data *slave_pdata)
+{
+	int result;
+	unsigned char reg = 0;
+	unsigned char slave_reg;
+	unsigned char slave_len;
+	unsigned char slave_endian;
+	unsigned char slave_address;
+
+	result = MLDLSetI2CBypass(mldl_cfg, gyro_handle, TRUE);
+
+	if (NULL == slave || NULL == slave_pdata) {
+		slave_reg = 0;
+		slave_len = 0;
+		slave_endian = 0;
+		slave_address = 0;
+	} else {
+		slave_reg = slave->reg;
+		slave_len = slave->len;
+		slave_endian = slave->endian;
+		slave_address = slave_pdata->address;
+	}
+
+	
+	result = MLSLSerialWriteSingle(gyro_handle,
+				mldl_cfg->addr,
+				MPUREG_AUX_SLV_ADDR,
+				slave_address);
+	ERROR_CHECK(result);
+	
+	result = MLSLSerialRead(gyro_handle, mldl_cfg->addr,
+				MPUREG_ACCEL_BURST_ADDR, 1,
+				&reg);
+	ERROR_CHECK(result);
+	reg = ((reg & 0x80) | slave_reg);
+	result = MLSLSerialWriteSingle(gyro_handle,
+				mldl_cfg->addr,
+				MPUREG_ACCEL_BURST_ADDR,
+				reg);
+	ERROR_CHECK(result);
+
+#ifdef M_HW
+	
+	if (slave_len > BITS_SLV_LENG) {
+		MPL_LOGW("Limiting slave burst read length to "
+			"the allowed maximum (15B, req. %d)\n",
+			slave_len);
+		slave_len = BITS_SLV_LENG;
+	}
+	reg = slave_len;
+	if (slave_endian == EXT_SLAVE_LITTLE_ENDIAN)
+		reg |= BIT_SLV_BYTE_SW;
+	reg |= BIT_SLV_GRP;
+	reg |= BIT_SLV_ENABLE;
+
+	result = MLSLSerialWriteSingle(gyro_handle,
+				mldl_cfg->addr,
+				MPUREG_I2C_SLV0_CTRL,
+				reg);
+#else
+	
+	result = MLSLSerialRead(gyro_handle, mldl_cfg->addr,
+				MPUREG_USER_CTRL, 1, &reg);
+	ERROR_CHECK(result);
+	reg = (reg & ~BIT_AUX_RD_LENG);
+	result = MLSLSerialWriteSingle(gyro_handle,
+				mldl_cfg->addr,
+				MPUREG_USER_CTRL, reg);
+	ERROR_CHECK(result);
+#endif
+
+	if (slave_address) {
+		result = MLDLSetI2CBypass(mldl_cfg, gyro_handle, FALSE);
+		ERROR_CHECK(result);
+	}
+	return result;
+}
+
+static int mpu_was_reset(struct mldl_cfg *mldl_cfg, void *gyro_handle)
+{
+	int result = ML_SUCCESS;
+	unsigned char reg = 0;
+
+	result = MLSLSerialRead(gyro_handle, mldl_cfg->addr,
+				MPUREG_DMP_CFG_2, 1, &reg);
+	ERROR_CHECK(result);
+
+	if (mldl_cfg->dmp_cfg2 != reg)
+		return TRUE;
+
+	if (0 != mldl_cfg->dmp_cfg1)
+		return FALSE;
+
+	result = MLSLSerialRead(gyro_handle, mldl_cfg->addr,
+				MPUREG_SMPLRT_DIV, 1, &reg);
+	ERROR_CHECK(result);
+	if (reg != mldl_cfg->divider)
+		return TRUE;
+
+	if (0 != mldl_cfg->divider)
+		return FALSE;
+
+	
+	return TRUE;
+}
+
+static int gyro_resume(struct mldl_cfg *mldl_cfg, void *gyro_handle)
+{
+	int result;
+	int ii;
+	int jj;
+	unsigned char reg = 0;
+	unsigned char regs[7];
+
+	
+#ifdef M_HW
+	result = mpu60xx_pwr_mgmt(mldl_cfg, gyro_handle, RESET,
+				WAKE_UP);
+	ERROR_CHECK(result);
+
+	
+	result = MLDLSetI2CBypass(mldl_cfg, gyro_handle, 1);
+	ERROR_CHECK(result);
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_INT_PIN_CFG,
+				(mldl_cfg->pdata->int_config |
+					BIT_BYPASS_EN));
+	ERROR_CHECK(result);
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_INT_ENABLE,
+				(mldl_cfg->int_config));
+	ERROR_CHECK(result);
+#else
+	result = MLDLPowerMgmtMPU(mldl_cfg, gyro_handle, 0, 0,
+				mldl_cfg->gyro_power & BIT_STBY_XG,
+				mldl_cfg->gyro_power & BIT_STBY_YG,
+				mldl_cfg->gyro_power & BIT_STBY_ZG);
+
+	if (!mldl_cfg->gyro_needs_reset &&
+	    !mpu_was_reset(mldl_cfg, gyro_handle)) {
+		return ML_SUCCESS;
+	}
+
+	result = MLDLPowerMgmtMPU(mldl_cfg, gyro_handle, 1, 0,
+				mldl_cfg->gyro_power & BIT_STBY_XG,
+				mldl_cfg->gyro_power & BIT_STBY_YG,
+				mldl_cfg->gyro_power & BIT_STBY_ZG);
+	ERROR_CHECK(result);
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_INT_CFG,
+				(mldl_cfg->int_config |
+					mldl_cfg->pdata->int_config));
+	ERROR_CHECK(result);
+#endif
+
+	result = MLSLSerialRead(gyro_handle, mldl_cfg->addr,
+				MPUREG_PWR_MGM, 1, &reg);
+	ERROR_CHECK(result);
+	reg &= ~BITS_CLKSEL;
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_PWR_MGM,
+				mldl_cfg->clk_src | reg);
+	ERROR_CHECK(result);
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_SMPLRT_DIV,
+				mldl_cfg->divider);
+	ERROR_CHECK(result);
+
+#ifdef M_HW
+	reg = DLPF_FS_SYNC_VALUE(0, mldl_cfg->full_scale, 0);
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_GYRO_CONFIG, reg);
+	reg = DLPF_FS_SYNC_VALUE(mldl_cfg->ext_sync, 0, mldl_cfg->lpf);
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_CONFIG, reg);
+#else
+	reg = DLPF_FS_SYNC_VALUE(mldl_cfg->ext_sync,
+				mldl_cfg->full_scale, mldl_cfg->lpf);
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_DLPF_FS_SYNC, reg);
+#endif
+	ERROR_CHECK(result);
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_DMP_CFG_1,
+				mldl_cfg->dmp_cfg1);
+	ERROR_CHECK(result);
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_DMP_CFG_2,
+				mldl_cfg->dmp_cfg2);
+	ERROR_CHECK(result);
+
+	
+	for (ii = 0; ii < MPU_MEM_NUM_RAM_BANKS; ii++) {
+		unsigned char read[MPU_MEM_BANK_SIZE] = {0};
+
+		result = MLSLSerialWriteMem(gyro_handle,
+					mldl_cfg->addr,
+					((ii << 8) | 0x00),
+					MPU_MEM_BANK_SIZE,
+					mldl_cfg->ram[ii]);
+		ERROR_CHECK(result);
+		result = MLSLSerialReadMem(gyro_handle, mldl_cfg->addr,
+					((ii << 8) | 0x00),
+					MPU_MEM_BANK_SIZE, read);
+		ERROR_CHECK(result);
+
+#ifdef M_HW
+#define ML_SKIP_CHECK 38
+#else
+#define ML_SKIP_CHECK 20
+#endif
+		for (jj = 0; jj < MPU_MEM_BANK_SIZE; jj++) {
+			
+			if (ii == 0 && jj < ML_SKIP_CHECK)
+				continue;
+			if (mldl_cfg->ram[ii][jj] != read[jj]) {
+				result = ML_ERROR_SERIAL_WRITE;
+				break;
+			}
+		}
+		ERROR_CHECK(result);
+	}
+
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_XG_OFFS_TC,
+				mldl_cfg->offset_tc[0]);
+	ERROR_CHECK(result);
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_YG_OFFS_TC,
+				mldl_cfg->offset_tc[1]);
+	ERROR_CHECK(result);
+	result = MLSLSerialWriteSingle(gyro_handle, mldl_cfg->addr,
+				MPUREG_ZG_OFFS_TC,
+				mldl_cfg->offset_tc[2]);
+	ERROR_CHECK(result);
+
+	regs[0] = MPUREG_X_OFFS_USRH;
+	for (ii = 0; ii < DIM(mldl_cfg->offset); ii++) {
+		regs[1 + ii * 2] =
+			(unsigned char)(mldl_cfg->offset[ii] >> 8)
+			& 0xff;
+		regs[1 + ii * 2 + 1] =
+			(unsigned char)(mldl_cfg->offset[ii] & 0xff);
+	}
+	result = MLSLSerialWrite(gyro_handle, mldl_cfg->addr, 7, regs);
+	ERROR_CHECK(result);
+
+	
+	result = MLDLSetLevelShifterBit(mldl_cfg, gyro_handle,
+					mldl_cfg->pdata->level_shifter);
+	ERROR_CHECK(result);
+	return result;
+}
+
+int mpu3050_open(struct mldl_cfg *mldl_cfg,
+		 void *mlsl_handle,
+		 void *accel_handle,
+		 void *compass_handle,
+		 void *pressure_handle)
+{
+	int result;
+	
+	mldl_cfg->int_config = BIT_INT_ANYRD_2CLEAR | BIT_DMP_INT_EN;
+	mldl_cfg->clk_src = MPU_CLK_SEL_PLLGYROZ;
+	mldl_cfg->lpf = MPU_FILTER_42HZ;
+	mldl_cfg->full_scale = MPU_FS_2000DPS;
+	mldl_cfg->divider = 4;
+	mldl_cfg->dmp_enable = 1;
+	mldl_cfg->fifo_enable = 1;
+	mldl_cfg->ext_sync = 0;
+	mldl_cfg->dmp_cfg1 = 0;
+	mldl_cfg->dmp_cfg2 = 0;
+	mldl_cfg->gyro_power = 0;
+	mldl_cfg->gyro_is_bypassed = TRUE;
+	mldl_cfg->dmp_is_running = FALSE;
+	mldl_cfg->gyro_is_suspended = TRUE;
+	mldl_cfg->accel_is_suspended = TRUE;
+	mldl_cfg->compass_is_suspended = TRUE;
+	mldl_cfg->pressure_is_suspended = TRUE;
+	mldl_cfg->gyro_needs_reset = FALSE;
+	if (mldl_cfg->addr == 0) {
+#ifdef __KERNEL__
+		return ML_ERROR_INVALID_PARAMETER;
+#else
+		mldl_cfg->addr = 0x68;
+#endif
+	}
+
+#ifdef M_HW
+	result = mpu60xx_pwr_mgmt(mldl_cfg, mlsl_handle,
+				  RESET, WAKE_UP);
+#else
+	result = MLDLPowerMgmtMPU(mldl_cfg, mlsl_handle, RESET, 0, 0, 0, 0);
+#endif
+	ERROR_CHECK(result);
+
+	result = MLDLGetSiliconRev(mldl_cfg, mlsl_handle);
+	ERROR_CHECK(result);
+#ifndef M_HW
+	result = MLSLSerialRead(mlsl_handle, mldl_cfg->addr,
+				MPUREG_PRODUCT_ID, 1,
+				&mldl_cfg->product_id);
+	ERROR_CHECK(result);
+#endif
+
+	
+	result = MLSLSerialRead(mlsl_handle, mldl_cfg->addr,
+				MPUREG_XG_OFFS_TC, 1,
+				&mldl_cfg->offset_tc[0]);
+	ERROR_CHECK(result);
+	result = MLSLSerialRead(mlsl_handle, mldl_cfg->addr,
+				MPUREG_YG_OFFS_TC, 1,
+				&mldl_cfg->offset_tc[1]);
+	ERROR_CHECK(result);
+	result = MLSLSerialRead(mlsl_handle, mldl_cfg->addr,
+				MPUREG_ZG_OFFS_TC, 1,
+				&mldl_cfg->offset_tc[2]);
+	ERROR_CHECK(result);
+
+	
+#ifdef M_HW
+	result = mpu60xx_pwr_mgmt(mldl_cfg, mlsl_handle,
+				  FALSE, SLEEP);
+#else
+	result =
+	    MLDLPowerMgmtMPU(mldl_cfg, mlsl_handle, 0, SLEEP, 0, 0, 0);
+#endif
+	ERROR_CHECK(result);
+
+	if (mldl_cfg->accel && mldl_cfg->accel->init) {
+		result = mldl_cfg->accel->init(accel_handle,
+					       mldl_cfg->accel,
+					       &mldl_cfg->pdata->accel);
+		ERROR_CHECK(result);
+	}
+
+	if (mldl_cfg->compass && mldl_cfg->compass->init) {
+		result = mldl_cfg->compass->init(compass_handle,
+						 mldl_cfg->compass,
+						 &mldl_cfg->pdata->compass);
+		if (ML_SUCCESS != result) {
+			MPL_LOGE("mldl_cfg->compass->init returned %d\n",
+				result);
+			goto out_accel;
+		}
+	}
+	if (mldl_cfg->pressure && mldl_cfg->pressure->init) {
+		result = mldl_cfg->pressure->init(pressure_handle,
+						  mldl_cfg->pressure,
+						  &mldl_cfg->pdata->pressure);
+		if (ML_SUCCESS != result) {
+			MPL_LOGE("mldl_cfg->pressure->init returned %d\n",
+				result);
+			goto out_compass;
+		}
+	}
+
+	mldl_cfg->requested_sensors = ML_THREE_AXIS_GYRO;
+	if (mldl_cfg->accel && mldl_cfg->accel->resume)
+		mldl_cfg->requested_sensors |= ML_THREE_AXIS_ACCEL;
+
+	if (mldl_cfg->compass && mldl_cfg->compass->resume)
+		mldl_cfg->requested_sensors |= ML_THREE_AXIS_COMPASS;
+
+	if (mldl_cfg->pressure && mldl_cfg->pressure->resume)
+		mldl_cfg->requested_sensors |= ML_THREE_AXIS_PRESSURE;
+
+	return result;
+
+out_compass:
+	if (mldl_cfg->compass->init)
+		mldl_cfg->compass->exit(compass_handle,
+				mldl_cfg->compass,
+				&mldl_cfg->pdata->compass);
+out_accel:
+	if (mldl_cfg->accel->init)
+		mldl_cfg->accel->exit(accel_handle,
+				mldl_cfg->accel,
+				&mldl_cfg->pdata->accel);
+	return result;
+
+}
+
+int mpu3050_close(struct mldl_cfg *mldl_cfg,
+		  void *mlsl_handle,
+		  void *accel_handle,
+		  void *compass_handle,
+		  void *pressure_handle)
+{
+	int result = ML_SUCCESS;
+	int ret_result = ML_SUCCESS;
+
+	if (mldl_cfg->accel && mldl_cfg->accel->exit) {
+		result = mldl_cfg->accel->exit(accel_handle,
+					mldl_cfg->accel,
+					&mldl_cfg->pdata->accel);
+		if (ML_SUCCESS != result)
+			MPL_LOGE("Accel exit failed %d\n", result);
+		ret_result = result;
+	}
+	if (ML_SUCCESS == ret_result)
+		ret_result = result;
+
+	if (mldl_cfg->compass && mldl_cfg->compass->exit) {
+		result = mldl_cfg->compass->exit(compass_handle,
+						mldl_cfg->compass,
+						&mldl_cfg->pdata->compass);
+		if (ML_SUCCESS != result)
+			MPL_LOGE("Compass exit failed %d\n", result);
+	}
+	if (ML_SUCCESS == ret_result)
+		ret_result = result;
+
+	if (mldl_cfg->pressure && mldl_cfg->pressure->exit) {
+		result = mldl_cfg->pressure->exit(pressure_handle,
+						mldl_cfg->pressure,
+						&mldl_cfg->pdata->pressure);
+		if (ML_SUCCESS != result)
+			MPL_LOGE("Pressure exit failed %d\n", result);
+	}
+	if (ML_SUCCESS == ret_result)
+		ret_result = result;
+
+	return ret_result;
+}
+
+int mpu3050_resume(struct mldl_cfg *mldl_cfg,
+		   void *gyro_handle,
+		   void *accel_handle,
+		   void *compass_handle,
+		   void *pressure_handle,
+		   bool resume_gyro,
+		   bool resume_accel,
+		   bool resume_compass,
+		   bool resume_pressure)
+{
+	int result = ML_SUCCESS;
+
+#ifdef CONFIG_MPU_SENSORS_DEBUG
+	mpu_print_cfg(mldl_cfg);
+#endif
+
+	if (resume_accel &&
+	    ((!mldl_cfg->accel) || (!mldl_cfg->accel->resume)))
+		return ML_ERROR_INVALID_PARAMETER;
+	if (resume_compass &&
+	    ((!mldl_cfg->compass) || (!mldl_cfg->compass->resume)))
+		return ML_ERROR_INVALID_PARAMETER;
+	if (resume_pressure &&
+	    ((!mldl_cfg->pressure) || (!mldl_cfg->pressure->resume)))
+		return ML_ERROR_INVALID_PARAMETER;
+
+	if (resume_gyro && mldl_cfg->gyro_is_suspended) {
+		result = gyro_resume(mldl_cfg, gyro_handle);
+		ERROR_CHECK(result);
+	}
+
+	if (resume_accel && mldl_cfg->accel_is_suspended) {
+		if (!mldl_cfg->gyro_is_suspended &&
+		    EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->accel.bus) {
+			result = MLDLSetI2CBypass(mldl_cfg, gyro_handle, TRUE);
+			ERROR_CHECK(result);
+		}
+		result = mldl_cfg->accel->resume(accel_handle,
+						 mldl_cfg->accel,
+						 &mldl_cfg->pdata->accel);
+		ERROR_CHECK(result);
+		mldl_cfg->accel_is_suspended = FALSE;
+	}
+
+	if (!mldl_cfg->gyro_is_suspended && !mldl_cfg->accel_is_suspended &&
+		EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->accel.bus) {
+		result = mpu_set_slave(mldl_cfg,
+				gyro_handle,
+				mldl_cfg->accel,
+				&mldl_cfg->pdata->accel);
+		ERROR_CHECK(result);
+	}
+
+	if (resume_compass && mldl_cfg->compass_is_suspended) {
+		if (!mldl_cfg->gyro_is_suspended &&
+		    EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->compass.bus) {
+			result = MLDLSetI2CBypass(mldl_cfg, gyro_handle, TRUE);
+			ERROR_CHECK(result);
+		}
+		result = mldl_cfg->compass->resume(compass_handle,
+						   mldl_cfg->compass,
+						   &mldl_cfg->pdata->
+						   compass);
+		ERROR_CHECK(result);
+		mldl_cfg->compass_is_suspended = FALSE;
+	}
+
+	if (!mldl_cfg->gyro_is_suspended && !mldl_cfg->compass_is_suspended &&
+		EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->compass.bus) {
+		result = mpu_set_slave(mldl_cfg,
+				gyro_handle,
+				mldl_cfg->compass,
+				&mldl_cfg->pdata->compass);
+		ERROR_CHECK(result);
+	}
+
+	if (resume_pressure && mldl_cfg->pressure_is_suspended) {
+		if (!mldl_cfg->gyro_is_suspended &&
+		    EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->pressure.bus) {
+			result = MLDLSetI2CBypass(mldl_cfg, gyro_handle, TRUE);
+			ERROR_CHECK(result);
+		}
+		result = mldl_cfg->pressure->resume(pressure_handle,
+						    mldl_cfg->pressure,
+						    &mldl_cfg->pdata->
+						    pressure);
+		ERROR_CHECK(result);
+		mldl_cfg->pressure_is_suspended = FALSE;
+	}
+
+	if (!mldl_cfg->gyro_is_suspended && !mldl_cfg->pressure_is_suspended &&
+		EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->pressure.bus) {
+		result = mpu_set_slave(mldl_cfg,
+				gyro_handle,
+				mldl_cfg->pressure,
+				&mldl_cfg->pdata->pressure);
+		ERROR_CHECK(result);
+	}
+
+	
+	if (resume_gyro) {
+		result = dmp_start(mldl_cfg, gyro_handle);
+		ERROR_CHECK(result);
+	}
+
+	return result;
+}
+
+int mpu3050_suspend(struct mldl_cfg *mldl_cfg,
+		    void *gyro_handle,
+		    void *accel_handle,
+		    void *compass_handle,
+		    void *pressure_handle,
+		    bool suspend_gyro,
+		    bool suspend_accel,
+		    bool suspend_compass,
+		    bool suspend_pressure)
+{
+	int result = ML_SUCCESS;
+
+	if (suspend_gyro && !mldl_cfg->gyro_is_suspended) {
+#ifdef M_HW
+		return ML_SUCCESS;
+		
+		result = MLDLSetI2CBypass(mldl_cfg, gyro_handle, 1);
+		ERROR_CHECK(result);
+		result = mpu60xx_pwr_mgmt(mldl_cfg, gyro_handle, 0, SLEEP);
+#else
+		result = MLDLPowerMgmtMPU(mldl_cfg, gyro_handle,
+					0, SLEEP, 0, 0, 0);
+#endif
+		ERROR_CHECK(result);
+	}
+
+	if (!mldl_cfg->accel_is_suspended && suspend_accel &&
+	    mldl_cfg->accel && mldl_cfg->accel->suspend) {
+		if (!mldl_cfg->gyro_is_suspended &&
+		    EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->accel.bus) {
+			result = mpu_set_slave(mldl_cfg, gyro_handle,
+					       NULL, NULL);
+			ERROR_CHECK(result);
+		}
+		result = mldl_cfg->accel->suspend(accel_handle,
+						  mldl_cfg->accel,
+						  &mldl_cfg->pdata->accel);
+		ERROR_CHECK(result);
+		mldl_cfg->accel_is_suspended = TRUE;
+	}
+
+	if (!mldl_cfg->compass_is_suspended && suspend_compass &&
+	    mldl_cfg->compass && mldl_cfg->compass->suspend) {
+		if (!mldl_cfg->gyro_is_suspended &&
+		    EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->compass.bus) {
+			result = mpu_set_slave(mldl_cfg, gyro_handle,
+					       NULL, NULL);
+			ERROR_CHECK(result);
+		}
+		result = mldl_cfg->compass->suspend(compass_handle,
+						    mldl_cfg->compass,
+						    &mldl_cfg->
+						    pdata->compass);
+		ERROR_CHECK(result);
+		mldl_cfg->compass_is_suspended = TRUE;
+	}
+
+	if (!mldl_cfg->pressure_is_suspended && suspend_pressure &&
+	    mldl_cfg->pressure && mldl_cfg->pressure->suspend) {
+		if (!mldl_cfg->gyro_is_suspended &&
+		    EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->pressure.bus) {
+			result = mpu_set_slave(mldl_cfg, gyro_handle,
+					       NULL, NULL);
+			ERROR_CHECK(result);
+		}
+		result = mldl_cfg->pressure->suspend(pressure_handle,
+						    mldl_cfg->pressure,
+						    &mldl_cfg->
+						    pdata->pressure);
+		ERROR_CHECK(result);
+		mldl_cfg->pressure_is_suspended = TRUE;
+	}
+	return result;
+}
+
+
+int mpu3050_read_accel(struct mldl_cfg *mldl_cfg,
+		       void *accel_handle, unsigned char *data)
+{
+	if (NULL != mldl_cfg->accel && NULL != mldl_cfg->accel->read)
+		if ((EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->accel.bus)
+			&& (!mldl_cfg->gyro_is_bypassed))
+			return ML_ERROR_FEATURE_NOT_ENABLED;
+		else
+			return mldl_cfg->accel->read(accel_handle,
+						     mldl_cfg->accel,
+						     &mldl_cfg->pdata->accel,
+						     data);
+	else
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+}
+
+int mpu3050_read_compass(struct mldl_cfg *mldl_cfg,
+			 void *compass_handle, unsigned char *data)
+{
+	if (NULL != mldl_cfg->compass && NULL != mldl_cfg->compass->read)
+		if ((EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->compass.bus)
+			&& (!mldl_cfg->gyro_is_bypassed))
+			return ML_ERROR_FEATURE_NOT_ENABLED;
+		else
+			return mldl_cfg->compass->read(compass_handle,
+						mldl_cfg->compass,
+						&mldl_cfg->pdata->compass,
+						data);
+	else
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+}
+
+int mpu3050_read_pressure(struct mldl_cfg *mldl_cfg,
+			 void *pressure_handle, unsigned char *data)
+{
+	if (NULL != mldl_cfg->pressure && NULL != mldl_cfg->pressure->read)
+		if ((EXT_SLAVE_BUS_SECONDARY == mldl_cfg->pdata->pressure.bus)
+			&& (!mldl_cfg->gyro_is_bypassed))
+			return ML_ERROR_FEATURE_NOT_ENABLED;
+		else
+			return mldl_cfg->pressure->read(
+				pressure_handle,
+				mldl_cfg->pressure,
+				&mldl_cfg->pdata->pressure,
+				data);
+	else
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+}
+
+int mpu3050_config_accel(struct mldl_cfg *mldl_cfg,
+			void *accel_handle,
+			struct ext_slave_config *data)
+{
+	if (NULL != mldl_cfg->accel && NULL != mldl_cfg->accel->config)
+		return mldl_cfg->accel->config(accel_handle,
+					       mldl_cfg->accel,
+					       &mldl_cfg->pdata->accel,
+					       data);
+	else
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+
+}
+
+int mpu3050_config_compass(struct mldl_cfg *mldl_cfg,
+			void *compass_handle,
+			struct ext_slave_config *data)
+{
+	if (NULL != mldl_cfg->compass && NULL != mldl_cfg->compass->config)
+		return mldl_cfg->compass->config(compass_handle,
+						 mldl_cfg->compass,
+						 &mldl_cfg->pdata->compass,
+						 data);
+	else
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+
+}
+
+int mpu3050_config_pressure(struct mldl_cfg *mldl_cfg,
+			void *pressure_handle,
+			struct ext_slave_config *data)
+{
+	if (NULL != mldl_cfg->pressure && NULL != mldl_cfg->pressure->config)
+		return mldl_cfg->pressure->config(pressure_handle,
+						  mldl_cfg->pressure,
+						  &mldl_cfg->pdata->pressure,
+						  data);
+	else
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+}
+
+int mpu3050_get_config_accel(struct mldl_cfg *mldl_cfg,
+			void *accel_handle,
+			struct ext_slave_config *data)
+{
+	if (NULL != mldl_cfg->accel && NULL != mldl_cfg->accel->get_config)
+		return mldl_cfg->accel->get_config(accel_handle,
+						mldl_cfg->accel,
+						&mldl_cfg->pdata->accel,
+						data);
+	else
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+
+}
+
+int mpu3050_get_config_compass(struct mldl_cfg *mldl_cfg,
+			void *compass_handle,
+			struct ext_slave_config *data)
+{
+	if (NULL != mldl_cfg->compass && NULL != mldl_cfg->compass->get_config)
+		return mldl_cfg->compass->get_config(compass_handle,
+						mldl_cfg->compass,
+						&mldl_cfg->pdata->compass,
+						data);
+	else
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+
+}
+
+int mpu3050_get_config_pressure(struct mldl_cfg *mldl_cfg,
+				void *pressure_handle,
+				struct ext_slave_config *data)
+{
+	if (NULL != mldl_cfg->pressure &&
+	    NULL != mldl_cfg->pressure->get_config)
+		return mldl_cfg->pressure->get_config(pressure_handle,
+						mldl_cfg->pressure,
+						&mldl_cfg->pdata->pressure,
+						data);
+	else
+		return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+}
+
+
diff --git a/drivers/input/misc/mpu3050/mldl_cfg.h b/drivers/input/misc/mpu3050/mldl_cfg.h
new file mode 100644
index 0000000..f838565
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mldl_cfg.h
@@ -0,0 +1,178 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+
+#ifndef __MLDL_CFG_H__
+#define __MLDL_CFG_H__
+
+
+#include "mlsl.h"
+#include "mpu.h"
+
+
+    
+    
+    
+
+#define ML_X_GYRO			(0x0001)
+#define ML_Y_GYRO			(0x0002)
+#define ML_Z_GYRO			(0x0004)
+#define ML_DMP_PROCESSOR		(0x0008)
+
+#define ML_X_ACCEL			(0x0010)
+#define ML_Y_ACCEL			(0x0020)
+#define ML_Z_ACCEL			(0x0040)
+
+#define ML_X_COMPASS			(0x0080)
+#define ML_Y_COMPASS			(0x0100)
+#define ML_Z_COMPASS			(0x0200)
+
+#define ML_X_PRESSURE			(0x0300)
+#define ML_Y_PRESSURE			(0x0800)
+#define ML_Z_PRESSURE			(0x1000)
+
+#define ML_TEMPERATURE			(0x2000)
+#define ML_TIME				(0x4000)
+
+#define ML_THREE_AXIS_GYRO		(0x000F)
+#define ML_THREE_AXIS_ACCEL		(0x0070)
+#define ML_THREE_AXIS_COMPASS		(0x0380)
+#define ML_THREE_AXIS_PRESSURE		(0x1C00)
+
+#define ML_FIVE_AXIS			(0x007B)
+#define ML_SIX_AXIS_GYRO_ACCEL		(0x007F)
+#define ML_SIX_AXIS_ACCEL_COMPASS	(0x03F0)
+#define ML_NINE_AXIS			(0x03FF)
+#define ML_ALL_SENSORS			(0x7FFF)
+
+#define SAMPLING_RATE_HZ(mldl_cfg)					\
+	((((((mldl_cfg)->lpf) == 0) || (((mldl_cfg)->lpf) == 7))	\
+		? (8000)						\
+		: (1000))						\
+		/ ((mldl_cfg)->divider + 1))
+
+#define SAMPLING_PERIOD_US(mldl_cfg)					\
+	((1000000L * ((mldl_cfg)->divider + 1)) /			\
+	(((((mldl_cfg)->lpf) == 0) || (((mldl_cfg)->lpf) == 7))		\
+		? (8000)						\
+		: (1000)))
+
+struct mldl_cfg {
+	
+	unsigned long requested_sensors;
+	unsigned char addr;
+	unsigned char int_config;
+	unsigned char ext_sync;
+	unsigned char full_scale;
+	unsigned char lpf;
+	unsigned char clk_src;
+	unsigned char divider;
+	unsigned char dmp_enable;
+	unsigned char fifo_enable;
+	unsigned char dmp_cfg1;
+	unsigned char dmp_cfg2;
+	unsigned char gyro_power;
+	unsigned char offset_tc[MPU_NUM_AXES];
+	unsigned short offset[MPU_NUM_AXES];
+	unsigned char ram[MPU_MEM_NUM_RAM_BANKS][MPU_MEM_BANK_SIZE];
+
+	
+	unsigned char silicon_revision;
+	unsigned char product_id;
+	unsigned short trim;
+
+	
+	int gyro_is_bypassed;
+	int dmp_is_running;
+	int gyro_is_suspended;
+	int accel_is_suspended;
+	int compass_is_suspended;
+	int pressure_is_suspended;
+	int gyro_needs_reset;
+
+	
+	struct ext_slave_descr *accel;
+	struct ext_slave_descr *compass;
+	struct ext_slave_descr *pressure;
+
+	
+	struct mpu3050_platform_data *pdata;
+};
+
+
+int mpu3050_open(struct mldl_cfg *mldl_cfg,
+		 void *mlsl_handle,
+		 void *accel_handle,
+		 void *compass_handle,
+		 void *pressure_handle);
+int mpu3050_close(struct mldl_cfg *mldl_cfg,
+		  void *mlsl_handle,
+		  void *accel_handle,
+		  void *compass_handle,
+		  void *pressure_handle);
+int mpu3050_resume(struct mldl_cfg *mldl_cfg,
+		   void *gyro_handle,
+		   void *accel_handle,
+		   void *compass_handle,
+		   void *pressure_handle,
+		   bool resume_gyro,
+		   bool resume_accel,
+		   bool resume_compass,
+		   bool resume_pressure);
+int mpu3050_suspend(struct mldl_cfg *mldl_cfg,
+		    void *gyro_handle,
+		    void *accel_handle,
+		    void *compass_handle,
+		    void *pressure_handle,
+		    bool suspend_gyro,
+		    bool suspend_accel,
+		    bool suspend_compass,
+		    bool suspend_pressure);
+int mpu3050_read_accel(struct mldl_cfg *mldl_cfg,
+		       void *accel_handle,
+		       unsigned char *data);
+int mpu3050_read_compass(struct mldl_cfg *mldl_cfg,
+			 void *compass_handle,
+			 unsigned char *data);
+int mpu3050_read_pressure(struct mldl_cfg *mldl_cfg, void *mlsl_handle,
+			  unsigned char *data);
+
+int mpu3050_config_accel(struct mldl_cfg *mldl_cfg,
+			 void *accel_handle,
+			 struct ext_slave_config *data);
+int mpu3050_config_compass(struct mldl_cfg *mldl_cfg,
+			   void *compass_handle,
+			   struct ext_slave_config *data);
+int mpu3050_config_pressure(struct mldl_cfg *mldl_cfg,
+			    void *pressure_handle,
+			    struct ext_slave_config *data);
+
+int mpu3050_get_config_accel(struct mldl_cfg *mldl_cfg,
+			     void *accel_handle,
+			     struct ext_slave_config *data);
+int mpu3050_get_config_compass(struct mldl_cfg *mldl_cfg,
+			       void *compass_handle,
+			       struct ext_slave_config *data);
+int mpu3050_get_config_pressure(struct mldl_cfg *mldl_cfg,
+				void *pressure_handle,
+				struct ext_slave_config *data);
+
+
+#endif				
+
diff --git a/drivers/input/misc/mpu3050/mlos-kernel.c b/drivers/input/misc/mpu3050/mlos-kernel.c
new file mode 100644
index 0000000..22c5e07
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mlos-kernel.c
@@ -0,0 +1,79 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+#include "mlos.h"
+#include <linux/delay.h>
+#include <linux/slab.h>
+
+void *MLOSMalloc(unsigned int numBytes)
+{
+	return kmalloc(numBytes, GFP_KERNEL);
+}
+
+tMLError MLOSFree(void *ptr)
+{
+	kfree(ptr);
+	return ML_SUCCESS;
+}
+
+tMLError MLOSCreateMutex(HANDLE *mutex)
+{
+	
+	return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+}
+
+tMLError MLOSLockMutex(HANDLE mutex)
+{
+	
+	return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+}
+
+tMLError MLOSUnlockMutex(HANDLE mutex)
+{
+	
+	return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+}
+
+tMLError MLOSDestroyMutex(HANDLE handle)
+{
+	
+	return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+}
+
+FILE *MLOSFOpen(char *filename)
+{
+	
+	return NULL;
+}
+
+void MLOSFClose(FILE *fp)
+{
+	
+}
+
+void MLOSSleep(int mSecs)
+{
+	msleep(mSecs);
+}
+
+unsigned long MLOSGetTickCount(void)
+{
+	
+	return ML_ERROR_FEATURE_NOT_IMPLEMENTED;
+}
diff --git a/drivers/input/misc/mpu3050/mlos.h b/drivers/input/misc/mpu3050/mlos.h
new file mode 100644
index 0000000..c0668574
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mlos.h
@@ -0,0 +1,73 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+#ifndef _MLOS_H
+#define _MLOS_H
+
+#ifndef __KERNEL__
+#include <stdio.h>
+#endif
+
+#include "mltypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+	
+	
+	
+
+	
+
+#define MLOS_GENERIC_READ         ((unsigned int)0x80000000)
+#define MLOS_GENERIC_WRITE        ((unsigned int)0x40000000)
+#define MLOS_FILE_SHARE_READ      ((unsigned int)0x00000001)
+#define MLOS_FILE_SHARE_WRITE     ((unsigned int)0x00000002)
+#define MLOS_OPEN_EXISTING        ((unsigned int)0x00000003)
+
+	
+	
+	
+
+	
+	
+	
+
+	
+	
+	
+
+	void *MLOSMalloc(unsigned int numBytes);
+	tMLError MLOSFree(void *ptr);
+	tMLError MLOSCreateMutex(HANDLE *mutex);
+	tMLError MLOSLockMutex(HANDLE mutex);
+	tMLError MLOSUnlockMutex(HANDLE mutex);
+	FILE *MLOSFOpen(char *filename);
+	void MLOSFClose(FILE *fp);
+
+	tMLError MLOSDestroyMutex(HANDLE handle);
+
+	void MLOSSleep(int mSecs);
+	unsigned long MLOSGetTickCount(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif				
diff --git a/drivers/input/misc/mpu3050/mlsl-kernel.c b/drivers/input/misc/mpu3050/mlsl-kernel.c
new file mode 100644
index 0000000..d5bc256
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mlsl-kernel.c
@@ -0,0 +1,229 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+#include "mlsl.h"
+#include "mpu-i2c.h"
+
+
+
+
+tMLError MLSLSerialOpen(char const *port, void **sl_handle)
+{
+	return ML_SUCCESS;
+}
+
+tMLError MLSLSerialReset(void *sl_handle)
+{
+	return ML_SUCCESS;
+}
+
+tMLError MLSLSerialClose(void *sl_handle)
+{
+	return ML_SUCCESS;
+}
+
+tMLError MLSLSerialWriteSingle(void *sl_handle,
+			       unsigned char slaveAddr,
+			       unsigned char registerAddr,
+			       unsigned char data)
+{
+	return sensor_i2c_write_register((struct i2c_adapter *) sl_handle,
+					 slaveAddr, registerAddr, data);
+}
+
+
+tMLError MLSLSerialWrite(void *sl_handle,
+			 unsigned char slaveAddr,
+			 unsigned short length, unsigned char const *data)
+{
+	tMLError result;
+	const unsigned short dataLength = length - 1;
+	const unsigned char startRegAddr = data[0];
+	unsigned char i2cWrite[SERIAL_MAX_TRANSFER_SIZE + 1];
+	unsigned short bytesWritten = 0;
+
+	while (bytesWritten < dataLength) {
+		unsigned short thisLen = min(SERIAL_MAX_TRANSFER_SIZE,
+					     dataLength - bytesWritten);
+		if (bytesWritten == 0) {
+			result = sensor_i2c_write((struct i2c_adapter *)
+						  sl_handle, slaveAddr,
+						  1 + thisLen, data);
+		} else {
+			
+			i2cWrite[0] = startRegAddr + bytesWritten;
+			memcpy(&i2cWrite[1], &data[1 + bytesWritten],
+			       thisLen);
+			result = sensor_i2c_write((struct i2c_adapter *)
+						  sl_handle, slaveAddr,
+						  1 + thisLen, i2cWrite);
+		}
+		if (ML_SUCCESS != result)
+			return result;
+		bytesWritten += thisLen;
+	}
+	return ML_SUCCESS;
+}
+
+
+tMLError MLSLSerialRead(void *sl_handle,
+			unsigned char slaveAddr,
+			unsigned char registerAddr,
+			unsigned short length, unsigned char *data)
+{
+	tMLError result;
+	unsigned short bytesRead = 0;
+
+	if (registerAddr == MPUREG_FIFO_R_W
+	    || registerAddr == MPUREG_MEM_R_W) {
+		return ML_ERROR_INVALID_PARAMETER;
+	}
+	while (bytesRead < length) {
+		unsigned short thisLen =
+		    min(SERIAL_MAX_TRANSFER_SIZE, length - bytesRead);
+		result =
+		    sensor_i2c_read((struct i2c_adapter *) sl_handle,
+				    slaveAddr, registerAddr + bytesRead,
+				    thisLen, &data[bytesRead]);
+		if (ML_SUCCESS != result)
+			return result;
+		bytesRead += thisLen;
+	}
+	return ML_SUCCESS;
+}
+
+
+tMLError MLSLSerialWriteMem(void *sl_handle,
+			    unsigned char slaveAddr,
+			    unsigned short memAddr,
+			    unsigned short length,
+			    unsigned char const *data)
+{
+	tMLError result;
+	unsigned short bytesWritten = 0;
+
+	if ((memAddr & 0xFF) + length > MPU_MEM_BANK_SIZE) {
+		printk
+		    ("memory read length (%d B) extends beyond its limits (%d) "
+		     "if started at location %d\n", length,
+		     MPU_MEM_BANK_SIZE, memAddr & 0xFF);
+		return ML_ERROR_INVALID_PARAMETER;
+	}
+	while (bytesWritten < length) {
+		unsigned short thisLen =
+		    min(SERIAL_MAX_TRANSFER_SIZE, length - bytesWritten);
+		result =
+		    mpu_memory_write((struct i2c_adapter *) sl_handle,
+				     slaveAddr, memAddr + bytesWritten,
+				     thisLen, &data[bytesWritten]);
+		if (ML_SUCCESS != result)
+			return result;
+		bytesWritten += thisLen;
+	}
+	return ML_SUCCESS;
+}
+
+
+tMLError MLSLSerialReadMem(void *sl_handle,
+			   unsigned char slaveAddr,
+			   unsigned short memAddr,
+			   unsigned short length, unsigned char *data)
+{
+	tMLError result;
+	unsigned short bytesRead = 0;
+
+	if ((memAddr & 0xFF) + length > MPU_MEM_BANK_SIZE) {
+		printk
+		    ("memory read length (%d B) extends beyond its limits (%d) "
+		     "if started at location %d\n", length,
+		     MPU_MEM_BANK_SIZE, memAddr & 0xFF);
+		return ML_ERROR_INVALID_PARAMETER;
+	}
+	while (bytesRead < length) {
+		unsigned short thisLen =
+		    min(SERIAL_MAX_TRANSFER_SIZE, length - bytesRead);
+		result =
+		    mpu_memory_read((struct i2c_adapter *) sl_handle,
+				    slaveAddr, memAddr + bytesRead,
+				    thisLen, &data[bytesRead]);
+		if (ML_SUCCESS != result)
+			return result;
+		bytesRead += thisLen;
+	}
+	return ML_SUCCESS;
+}
+
+
+tMLError MLSLSerialWriteFifo(void *sl_handle,
+			     unsigned char slaveAddr,
+			     unsigned short length,
+			     unsigned char const *data)
+{
+	tMLError result;
+	unsigned char i2cWrite[SERIAL_MAX_TRANSFER_SIZE + 1];
+	unsigned short bytesWritten = 0;
+
+	if (length > FIFO_HW_SIZE) {
+		printk(KERN_ERR
+		       "maximum fifo write length is %d\n", FIFO_HW_SIZE);
+		return ML_ERROR_INVALID_PARAMETER;
+	}
+	while (bytesWritten < length) {
+		unsigned short thisLen =
+		    min(SERIAL_MAX_TRANSFER_SIZE, length - bytesWritten);
+		i2cWrite[0] = MPUREG_FIFO_R_W;
+		memcpy(&i2cWrite[1], &data[bytesWritten], thisLen);
+		result = sensor_i2c_write((struct i2c_adapter *) sl_handle,
+					  slaveAddr, thisLen + 1,
+					  i2cWrite);
+		if (ML_SUCCESS != result)
+			return result;
+		bytesWritten += thisLen;
+	}
+	return ML_SUCCESS;
+}
+
+
+tMLError MLSLSerialReadFifo(void *sl_handle,
+			    unsigned char slaveAddr,
+			    unsigned short length, unsigned char *data)
+{
+	tMLError result;
+	unsigned short bytesRead = 0;
+
+	if (length > FIFO_HW_SIZE) {
+		printk(KERN_ERR
+		       "maximum fifo read length is %d\n", FIFO_HW_SIZE);
+		return ML_ERROR_INVALID_PARAMETER;
+	}
+	while (bytesRead < length) {
+		unsigned short thisLen =
+		    min(SERIAL_MAX_TRANSFER_SIZE, length - bytesRead);
+		result =
+		    sensor_i2c_read((struct i2c_adapter *) sl_handle,
+				    slaveAddr, MPUREG_FIFO_R_W, thisLen,
+				    &data[bytesRead]);
+		if (ML_SUCCESS != result)
+			return result;
+		bytesRead += thisLen;
+	}
+
+	return ML_SUCCESS;
+}
+
diff --git a/drivers/input/misc/mpu3050/mlsl.h b/drivers/input/misc/mpu3050/mlsl.h
new file mode 100644
index 0000000..e1e796c
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mlsl.h
@@ -0,0 +1,86 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+#ifndef __MSSL_H__
+#define __MSSL_H__
+
+#include "mltypes.h"
+#include "mpu.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define SERIAL_MAX_TRANSFER_SIZE 128
+
+
+
+	tMLError MLSLSerialOpen(char const *port,
+				void **sl_handle);
+	tMLError MLSLSerialReset(void *sl_handle);
+	tMLError MLSLSerialClose(void *sl_handle);
+
+	tMLError MLSLSerialWriteSingle(void *sl_handle,
+				       unsigned char slaveAddr,
+				       unsigned char registerAddr,
+				       unsigned char data);
+
+	tMLError MLSLSerialRead(void *sl_handle,
+				unsigned char slaveAddr,
+				unsigned char registerAddr,
+				unsigned short length,
+				unsigned char *data);
+
+	tMLError MLSLSerialWrite(void *sl_handle,
+				 unsigned char slaveAddr,
+				 unsigned short length,
+				 unsigned char const *data);
+
+	tMLError MLSLSerialReadMem(void *sl_handle,
+				   unsigned char slaveAddr,
+				   unsigned short memAddr,
+				   unsigned short length,
+				   unsigned char *data);
+
+	tMLError MLSLSerialWriteMem(void *sl_handle,
+				    unsigned char slaveAddr,
+				    unsigned short memAddr,
+				    unsigned short length,
+				    unsigned char const *data);
+
+	tMLError MLSLSerialReadFifo(void *sl_handle,
+				    unsigned char slaveAddr,
+				    unsigned short length,
+				    unsigned char *data);
+
+	tMLError MLSLSerialWriteFifo(void *sl_handle,
+				     unsigned char slaveAddr,
+				     unsigned short length,
+				     unsigned char const *data);
+
+	tMLError MLSLWriteCal(unsigned char *cal, unsigned int len);
+	tMLError MLSLReadCal(unsigned char *cal, unsigned int len);
+	tMLError MLSLGetCalLength(unsigned int *len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif				
diff --git a/drivers/input/misc/mpu3050/mltypes.h b/drivers/input/misc/mpu3050/mltypes.h
new file mode 100644
index 0000000..d3f4acc
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mltypes.h
@@ -0,0 +1,138 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+
+#ifndef MLTYPES_H
+#define MLTYPES_H
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include "stdint_invensense.h"
+#endif
+#include "log.h"
+
+
+typedef unsigned char tMLError;
+
+#if defined(LINUX) || defined(__KERNEL__)
+typedef unsigned int HANDLE;
+#endif
+
+#ifdef __KERNEL__
+typedef HANDLE FILE;
+#endif
+
+#ifndef __cplusplus
+#ifndef __KERNEL__
+typedef int_fast8_t bool;
+#endif
+#endif
+
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef DIM
+#define DIM(array) (sizeof(array)/sizeof((array)[0]))
+#endif
+
+#define ERROR_NAME(x)   (#x)
+#define ERROR_CHECK(x)                                                  \
+	{								\
+		if (ML_SUCCESS != x) {					\
+			MPL_LOGE("[mpu_err]%s|%s|%d returning %d\n",	\
+				__FILE__, __func__, __LINE__, x);	\
+			return x;					\
+		}							\
+	}
+
+#define ERROR_CHECK_FIRST(first, x)                                     \
+	{ if (ML_SUCCESS == first) first = x; }
+
+#define ML_SUCCESS                       (0)
+#define ML_ERROR                         (1)
+
+#define ML_ERROR_INVALID_PARAMETER       (2)
+#define ML_ERROR_FEATURE_NOT_ENABLED     (3)
+#define ML_ERROR_FEATURE_NOT_IMPLEMENTED (4)
+#define ML_ERROR_DMP_NOT_STARTED         (6)
+#define ML_ERROR_DMP_STARTED             (7)
+#define ML_ERROR_NOT_OPENED              (8)
+#define ML_ERROR_OPENED                  (9)
+#define ML_ERROR_INVALID_MODULE         (10)
+#define ML_ERROR_MEMORY_EXAUSTED        (11)
+#define ML_ERROR_DIVIDE_BY_ZERO         (12)
+#define ML_ERROR_ASSERTION_FAILURE      (13)
+#define ML_ERROR_FILE_OPEN              (14)
+#define ML_ERROR_FILE_READ              (15)
+#define ML_ERROR_FILE_WRITE             (16)
+#define ML_ERROR_INVALID_CONFIGURATION  (17)
+
+#define ML_ERROR_SERIAL_CLOSED          (20)
+#define ML_ERROR_SERIAL_OPEN_ERROR      (21)
+#define ML_ERROR_SERIAL_READ            (22)
+#define ML_ERROR_SERIAL_WRITE           (23)
+#define ML_ERROR_SERIAL_DEVICE_NOT_RECOGNIZED  (24)
+
+#define ML_ERROR_SM_TRANSITION          (25)
+#define ML_ERROR_SM_IMPROPER_STATE      (26)
+
+#define ML_ERROR_FIFO_OVERFLOW          (30)
+#define ML_ERROR_FIFO_FOOTER            (31)
+#define ML_ERROR_FIFO_READ_COUNT        (32)
+#define ML_ERROR_FIFO_READ_DATA         (33)
+
+#define ML_ERROR_MEMORY_SET             (40)
+
+#define ML_ERROR_LOG_MEMORY_ERROR       (50)
+#define ML_ERROR_LOG_OUTPUT_ERROR       (51)
+
+#define ML_ERROR_OS_BAD_PTR             (60)
+#define ML_ERROR_OS_BAD_HANDLE          (61)
+#define ML_ERROR_OS_CREATE_FAILED       (62)
+#define ML_ERROR_OS_LOCK_FAILED         (63)
+
+#define ML_ERROR_COMPASS_DATA_OVERFLOW  (70)
+#define ML_ERROR_COMPASS_DATA_UNDERFLOW (71)
+#define ML_ERROR_COMPASS_DATA_NOT_READY (72)
+#define ML_ERROR_COMPASS_DATA_ERROR     (73)
+
+#define ML_ERROR_CALIBRATION_LOAD       (75)
+#define ML_ERROR_CALIBRATION_STORE      (76)
+#define ML_ERROR_CALIBRATION_LEN        (77)
+#define ML_ERROR_CALIBRATION_CHECKSUM   (78)
+
+#define ML_ERROR_ACCEL_DATA_OVERFLOW    (79)
+#define ML_ERROR_ACCEL_DATA_UNDERFLOW   (80)
+#define ML_ERROR_ACCEL_DATA_NOT_READY   (81)
+#define ML_ERROR_ACCEL_DATA_ERROR       (82)
+
+
+
+#endif				
diff --git a/drivers/input/misc/mpu3050/mpu-dev.c b/drivers/input/misc/mpu3050/mpu-dev.c
new file mode 100644
index 0000000..a641af8
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mpu-dev.c
@@ -0,0 +1,1480 @@
+/*
+    mpu-dev.c - mpu3050 char device interface
+
+    Copyright (C) 1995-97 Simon G. Vogl
+    Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
+    Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <linux/i2c.h>
+#include <linux/i2c-dev.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/stat.h>
+#include <linux/irq.h>
+#include <linux/gpio.h>
+#include <linux/signal.h>
+#include <linux/miscdevice.h>
+#include <linux/slab.h>
+#include <linux/version.h>
+#include <linux/pm.h>
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#include <linux/earlysuspend.h>
+#endif
+
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
+
+#include "mpuirq.h"
+#include "slaveirq.h"
+#include "mlsl.h"
+#include "mpu-i2c.h"
+#include "mldl_cfg.h"
+#include "mpu.h"
+
+#define MPU3050_EARLY_SUSPEND_IN_DRIVER 0
+
+#define D(x...) printk(KERN_DEBUG "[GYRO][MPU3050] " x)
+#define I(x...) printk(KERN_INFO "[GYRO][MPU3050] " x)
+#define E(x...) printk(KERN_ERR "[GYRO][MPU3050 ERROR] " x)
+
+struct mpu_private_data {
+	struct mldl_cfg mldl_cfg;
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+	struct early_suspend early_suspend;
+#endif
+};
+
+static int pid;
+
+static struct i2c_client *this_client;
+
+int mpu_debug_flag;
+int mpu_sensors_reset;
+int mpu_lpm_flag;
+
+static int mpu_open(struct inode *inode, struct file *file)
+{
+	struct mpu_private_data *mpu =
+	    (struct mpu_private_data *) i2c_get_clientdata(this_client);
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+
+	dev_dbg(&this_client->adapter->dev, "mpu_open\n");
+	dev_dbg(&this_client->adapter->dev, "current->pid %d\n",
+		current->pid);
+	pid = current->pid;
+	file->private_data = this_client;
+	
+	
+	
+
+	
+	mldl_cfg->requested_sensors = ML_THREE_AXIS_GYRO;
+	if (mldl_cfg->accel && mldl_cfg->accel->resume)
+		mldl_cfg->requested_sensors |= ML_THREE_AXIS_ACCEL;
+
+	if (mldl_cfg->compass && mldl_cfg->compass->resume)
+		mldl_cfg->requested_sensors |= ML_THREE_AXIS_COMPASS;
+
+	if (mldl_cfg->pressure && mldl_cfg->pressure->resume)
+		mldl_cfg->requested_sensors |= ML_THREE_AXIS_PRESSURE;
+
+	return 0;
+}
+
+static int mpu_release(struct inode *inode, struct file *file)
+{
+	struct i2c_client *client =
+	    (struct i2c_client *) file->private_data;
+	struct mpu_private_data *mpu =
+	    (struct mpu_private_data *) i2c_get_clientdata(client);
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+	struct i2c_adapter *accel_adapter;
+	struct i2c_adapter *compass_adapter;
+	struct i2c_adapter *pressure_adapter;
+	int result = 0;
+
+	pid = 0;
+
+	accel_adapter = i2c_get_adapter(mldl_cfg->pdata->accel.adapt_num);
+	compass_adapter = i2c_get_adapter(mldl_cfg->pdata->compass.adapt_num);
+	pressure_adapter = i2c_get_adapter(mldl_cfg->pdata->pressure.adapt_num);
+	result = mpu3050_suspend(mldl_cfg, client->adapter,
+				 accel_adapter, compass_adapter,
+				 pressure_adapter,
+				 TRUE, TRUE, TRUE, TRUE);
+
+	dev_dbg(&this_client->adapter->dev, "mpu_release\n");
+	return result;
+}
+
+static noinline int mpudev_ioctl_rdrw(struct i2c_client *client,
+				      unsigned long arg)
+{
+	struct i2c_rdwr_ioctl_data rdwr_arg;
+	struct i2c_msg *rdwr_pa;
+	u8 __user **data_ptrs;
+	int i, res;
+
+	if (copy_from_user(&rdwr_arg,
+			   (struct i2c_rdwr_ioctl_data __user *) arg,
+			   sizeof(rdwr_arg)))
+		return -EFAULT;
+
+	if (rdwr_arg.nmsgs > I2C_RDRW_IOCTL_MAX_MSGS)
+		return -EINVAL;
+
+	rdwr_pa = (struct i2c_msg *)
+	    kmalloc(rdwr_arg.nmsgs * sizeof(struct i2c_msg), GFP_KERNEL);
+	if (!rdwr_pa)
+		return -ENOMEM;
+
+	if (copy_from_user(rdwr_pa, rdwr_arg.msgs,
+			   rdwr_arg.nmsgs * sizeof(struct i2c_msg))) {
+		kfree(rdwr_pa);
+		return -EFAULT;
+	}
+
+	data_ptrs =
+	    kmalloc(rdwr_arg.nmsgs * sizeof(u8 __user *), GFP_KERNEL);
+	if (data_ptrs == NULL) {
+		kfree(rdwr_pa);
+		return -ENOMEM;
+	}
+
+	res = 0;
+	for (i = 0; i < rdwr_arg.nmsgs; i++) {
+		if ((rdwr_pa[i].len > 8192) ||
+		    (rdwr_pa[i].flags & I2C_M_RECV_LEN)) {
+			res = -EINVAL;
+			break;
+		}
+		data_ptrs[i] = (u8 __user *) rdwr_pa[i].buf;
+		rdwr_pa[i].buf = kmalloc(rdwr_pa[i].len, GFP_KERNEL);
+		if (rdwr_pa[i].buf == NULL) {
+			res = -ENOMEM;
+			break;
+		}
+		if (copy_from_user(rdwr_pa[i].buf, data_ptrs[i],
+				   rdwr_pa[i].len)) {
+			++i;	
+			res = -EFAULT;
+			break;
+		}
+	}
+	if (res < 0) {
+		int j;
+		for (j = 0; j < i; ++j)
+			kfree(rdwr_pa[j].buf);
+		kfree(data_ptrs);
+		kfree(rdwr_pa);
+		return res;
+	}
+
+	res = i2c_transfer(client->adapter, rdwr_pa, rdwr_arg.nmsgs);
+	while (i-- > 0) {
+		if (res >= 0 && (rdwr_pa[i].flags & I2C_M_RD)) {
+			if (copy_to_user(data_ptrs[i], rdwr_pa[i].buf,
+					 rdwr_pa[i].len))
+				res = -EFAULT;
+		}
+		kfree(rdwr_pa[i].buf);
+	}
+	kfree(data_ptrs);
+	kfree(rdwr_pa);
+	return res;
+}
+
+static ssize_t mpu_read(struct file *file,
+			char __user *buf, size_t count, loff_t *offset)
+{
+	char *tmp;
+	int ret;
+
+	struct i2c_client *client =
+	    (struct i2c_client *) file->private_data;
+
+	if (count > 8192)
+		count = 8192;
+
+	tmp = kmalloc(count, GFP_KERNEL);
+	if (tmp == NULL)
+		return -ENOMEM;
+
+	pr_debug("i2c-dev: i2c-%d reading %zu bytes.\n",
+		 iminor(file->f_path.dentry->d_inode), count);
+
+	ret = i2c_master_recv(client, tmp, count);
+	if (ret >= 0) {
+		ret = copy_to_user(buf, tmp, count) ? -EFAULT : ret;
+		if (ret)
+			ret = -EFAULT;
+	}
+	kfree(tmp);
+	return ret;
+}
+
+static int
+mpu_ioctl_set_mpu_pdata(struct i2c_client *client, unsigned long arg)
+{
+	int ii;
+	struct mpu_private_data *mpu =
+	    (struct mpu_private_data *) i2c_get_clientdata(client);
+	struct mpu3050_platform_data *pdata = mpu->mldl_cfg.pdata;
+	struct mpu3050_platform_data local_pdata;
+
+	if (copy_from_user(&local_pdata, (unsigned char __user *) arg,
+				sizeof(local_pdata)))
+		return -EFAULT;
+
+	pdata->int_config = local_pdata.int_config;
+	for (ii = 0; ii < DIM(pdata->orientation); ii++)
+		pdata->orientation[ii] = local_pdata.orientation[ii];
+	pdata->level_shifter = local_pdata.level_shifter;
+
+	pdata->accel.address = local_pdata.accel.address;
+	for (ii = 0; ii < DIM(pdata->accel.orientation); ii++)
+		pdata->accel.orientation[ii] =
+			local_pdata.accel.orientation[ii];
+
+	pdata->compass.address = local_pdata.compass.address;
+	for (ii = 0; ii < DIM(pdata->compass.orientation); ii++)
+		pdata->compass.orientation[ii] =
+			local_pdata.compass.orientation[ii];
+
+	pdata->pressure.address = local_pdata.pressure.address;
+	for (ii = 0; ii < DIM(pdata->pressure.orientation); ii++)
+		pdata->pressure.orientation[ii] =
+			local_pdata.pressure.orientation[ii];
+
+	dev_dbg(&client->adapter->dev, "%s\n", __func__);
+
+	return ML_SUCCESS;
+}
+
+static int
+mpu_ioctl_set_mpu_config(struct i2c_client *client, unsigned long arg)
+{
+	int ii;
+	int result = ML_SUCCESS;
+	struct mpu_private_data *mpu =
+		(struct mpu_private_data *) i2c_get_clientdata(client);
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+	struct mldl_cfg *temp_mldl_cfg;
+
+	dev_dbg(&this_client->adapter->dev, "%s\n", __func__);
+
+	temp_mldl_cfg = kzalloc(sizeof(struct mldl_cfg), GFP_KERNEL);
+	if (NULL == temp_mldl_cfg)
+		return -ENOMEM;
+
+	if (copy_from_user(temp_mldl_cfg, (struct mldl_cfg __user *) arg,
+				offsetof(struct mldl_cfg, silicon_revision))) {
+		result = -EFAULT;
+		goto out;
+	}
+
+	if (mldl_cfg->gyro_is_suspended) {
+		if (mldl_cfg->addr != temp_mldl_cfg->addr)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (mldl_cfg->int_config != temp_mldl_cfg->int_config)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (mldl_cfg->ext_sync != temp_mldl_cfg->ext_sync)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (mldl_cfg->full_scale != temp_mldl_cfg->full_scale)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (mldl_cfg->lpf != temp_mldl_cfg->lpf)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (mldl_cfg->clk_src != temp_mldl_cfg->clk_src)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (mldl_cfg->divider != temp_mldl_cfg->divider)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (mldl_cfg->dmp_enable != temp_mldl_cfg->dmp_enable)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (mldl_cfg->fifo_enable != temp_mldl_cfg->fifo_enable)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (mldl_cfg->dmp_cfg1 != temp_mldl_cfg->dmp_cfg1)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (mldl_cfg->dmp_cfg2 != temp_mldl_cfg->dmp_cfg2)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (mldl_cfg->gyro_power != temp_mldl_cfg->gyro_power)
+			mldl_cfg->gyro_needs_reset = TRUE;
+
+		for (ii = 0; ii < MPU_NUM_AXES; ii++)
+			if (mldl_cfg->offset_tc[ii] !=
+			    temp_mldl_cfg->offset_tc[ii])
+				mldl_cfg->gyro_needs_reset = TRUE;
+
+		for (ii = 0; ii < MPU_NUM_AXES; ii++)
+			if (mldl_cfg->offset[ii] != temp_mldl_cfg->offset[ii])
+				mldl_cfg->gyro_needs_reset = TRUE;
+
+		if (memcmp(mldl_cfg->ram, temp_mldl_cfg->ram,
+				MPU_MEM_NUM_RAM_BANKS * MPU_MEM_BANK_SIZE *
+				sizeof(unsigned char)))
+			mldl_cfg->gyro_needs_reset = TRUE;
+	}
+
+	memcpy(mldl_cfg, temp_mldl_cfg,
+		offsetof(struct mldl_cfg, silicon_revision));
+
+out:
+	kfree(temp_mldl_cfg);
+	return result;
+}
+
+static int
+mpu_ioctl_get_mpu_config(struct i2c_client *client, unsigned long arg)
+{
+	struct mpu_private_data *mpu =
+	    (struct mpu_private_data *) i2c_get_clientdata(client);
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+	struct mldl_cfg *local_mldl_cfg;
+	int retval = 0;
+
+	local_mldl_cfg = kzalloc(sizeof(struct mldl_cfg), GFP_KERNEL);
+	if (NULL == local_mldl_cfg)
+		return -ENOMEM;
+
+	retval =
+	    copy_from_user(local_mldl_cfg, (struct mldl_cfg __user *) arg,
+			   sizeof(struct mldl_cfg));
+	if (retval) {
+		dev_err(&this_client->adapter->dev,
+			"%s|%s:%d: EFAULT on arg\n",
+			__FILE__, __func__, __LINE__);
+		retval = -EFAULT;
+		goto out;
+	}
+
+	
+	if (mldl_cfg->accel) {
+		retval = copy_to_user((void __user *)local_mldl_cfg->accel,
+				      mldl_cfg->accel,
+				      sizeof(*mldl_cfg->accel));
+		if (retval) {
+			dev_err(&this_client->adapter->dev,
+				"%s|%s:%d: EFAULT on accel\n",
+				__FILE__, __func__, __LINE__);
+			retval = -EFAULT;
+			goto out;
+		}
+	}
+
+	if (mldl_cfg->compass) {
+		retval = copy_to_user((void __user *)local_mldl_cfg->compass,
+				      mldl_cfg->compass,
+				      sizeof(*mldl_cfg->compass));
+		if (retval) {
+			dev_err(&this_client->adapter->dev,
+				"%s|%s:%d: EFAULT on compass\n",
+				__FILE__, __func__, __LINE__);
+			retval = -EFAULT;
+			goto out;
+		}
+	}
+
+	if (mldl_cfg->pressure) {
+		retval = copy_to_user((void __user *)local_mldl_cfg->pressure,
+				      mldl_cfg->pressure,
+				      sizeof(*mldl_cfg->pressure));
+		if (retval) {
+			dev_err(&this_client->adapter->dev,
+				"%s|%s:%d: EFAULT on pressure\n",
+				__FILE__, __func__, __LINE__);
+			retval = -EFAULT;
+			goto out;
+		}
+	}
+
+	if (mldl_cfg->pdata) {
+		retval = copy_to_user((void __user *)local_mldl_cfg->pdata,
+				      mldl_cfg->pdata,
+				      sizeof(*mldl_cfg->pdata));
+		if (retval) {
+			dev_err(&this_client->adapter->dev,
+				"%s|%s:%d: EFAULT on pdata\n",
+				__FILE__, __func__, __LINE__);
+			retval = -EFAULT;
+			goto out;
+		}
+	}
+
+	
+	retval = copy_to_user((struct mldl_cfg __user *) arg,
+			      mldl_cfg, offsetof(struct mldl_cfg, accel));
+
+	if (retval)
+		retval = -EFAULT;
+out:
+	kfree(local_mldl_cfg);
+	return retval;
+}
+
+static int slave_config(void *adapter,
+			struct mldl_cfg *mldl_cfg,
+			struct ext_slave_descr *slave,
+			struct ext_slave_platform_data *pdata,
+			struct ext_slave_config __user *usr_config)
+{
+	int retval = ML_SUCCESS;
+	if ((slave) && (slave->config)) {
+		struct ext_slave_config config;
+		retval = copy_from_user(
+			&config,
+			usr_config,
+			sizeof(config));
+		if (retval)
+			return -EFAULT;
+
+		if (config.len && config.data) {
+			int *data;
+			data = kzalloc(config.len, GFP_KERNEL);
+			if (!data)
+				return ML_ERROR_MEMORY_EXAUSTED;
+
+			retval = copy_from_user(data,
+						(void __user *)config.data,
+						config.len);
+			if (retval) {
+				retval = -EFAULT;
+				kfree(data);
+				return retval;
+			}
+			config.data = data;
+		}
+		retval = slave->config(adapter,
+				slave,
+				pdata,
+				&config);
+		kfree(config.data);
+	}
+	return retval;
+}
+
+static int slave_get_config(void *adapter,
+			struct mldl_cfg *mldl_cfg,
+			struct ext_slave_descr *slave,
+			struct ext_slave_platform_data *pdata,
+			struct ext_slave_config __user *usr_config)
+{
+	int retval = ML_SUCCESS;
+	if ((slave) && (slave->get_config)) {
+		struct ext_slave_config config;
+		void *user_data;
+		retval = copy_from_user(
+			&config,
+			usr_config,
+			sizeof(config));
+		if (retval)
+			return -EFAULT;
+
+		user_data = config.data;
+		if (config.len && config.data) {
+			int *data;
+			data = kzalloc(config.len, GFP_KERNEL);
+			if (!data)
+				return ML_ERROR_MEMORY_EXAUSTED;
+
+			retval = copy_from_user(data,
+						(void __user *)config.data,
+						config.len);
+			if (retval) {
+				retval = -EFAULT;
+				kfree(data);
+				return retval;
+			}
+			config.data = data;
+		}
+		retval = slave->get_config(adapter,
+				slave,
+				pdata,
+				&config);
+		if (retval) {
+			kfree(config.data);
+			return retval;
+		}
+		retval = copy_to_user((unsigned char __user *) user_data,
+				      config.data,
+				      config.len);
+		kfree(config.data);
+	}
+	return retval;
+}
+
+static long mpu_ioctl(struct file *file,
+		      unsigned int cmd, unsigned long arg)
+{
+	struct i2c_client *client =
+	    (struct i2c_client *) file->private_data;
+	struct mpu_private_data *mpu =
+	    (struct mpu_private_data *) i2c_get_clientdata(client);
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+	int retval = 0;
+	struct i2c_adapter *accel_adapter;
+	struct i2c_adapter *compass_adapter;
+	struct i2c_adapter *pressure_adapter;
+
+	accel_adapter = i2c_get_adapter(mldl_cfg->pdata->accel.adapt_num);
+	compass_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->compass.adapt_num);
+	pressure_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->pressure.adapt_num);
+
+	switch (cmd) {
+	case I2C_RDWR:
+		mpudev_ioctl_rdrw(client, arg);
+		break;
+	case I2C_SLAVE:
+		if ((arg & 0x7E) != (client->addr & 0x7E)) {
+			dev_err(&this_client->adapter->dev,
+				"[mpu_err]%s: Invalid I2C_SLAVE arg %lu\n",
+				__func__, arg);
+		}
+		break;
+	case MPU_SET_MPU_CONFIG:
+		retval = mpu_ioctl_set_mpu_config(client, arg);
+		break;
+	case MPU_SET_INT_CONFIG:
+		mldl_cfg->int_config = (unsigned char) arg;
+		break;
+	case MPU_SET_EXT_SYNC:
+		mldl_cfg->ext_sync = (enum mpu_ext_sync) arg;
+		break;
+	case MPU_SET_FULL_SCALE:
+		mldl_cfg->full_scale = (enum mpu_fullscale) arg;
+		break;
+	case MPU_SET_LPF:
+		mldl_cfg->lpf = (enum mpu_filter) arg;
+		break;
+	case MPU_SET_CLK_SRC:
+		mldl_cfg->clk_src = (enum mpu_clock_sel) arg;
+		break;
+	case MPU_SET_DIVIDER:
+		mldl_cfg->divider = (unsigned char) arg;
+		break;
+	case MPU_SET_LEVEL_SHIFTER:
+		mldl_cfg->pdata->level_shifter = (unsigned char) arg;
+		break;
+	case MPU_SET_DMP_ENABLE:
+		mldl_cfg->dmp_enable = (unsigned char) arg;
+		break;
+	case MPU_SET_FIFO_ENABLE:
+		mldl_cfg->fifo_enable = (unsigned char) arg;
+		break;
+	case MPU_SET_DMP_CFG1:
+		mldl_cfg->dmp_cfg1 = (unsigned char) arg;
+		break;
+	case MPU_SET_DMP_CFG2:
+		mldl_cfg->dmp_cfg2 = (unsigned char) arg;
+		break;
+	case MPU_SET_OFFSET_TC:
+		retval = copy_from_user(mldl_cfg->offset_tc,
+					(unsigned char __user *) arg,
+					sizeof(mldl_cfg->offset_tc));
+		if (retval)
+			retval = -EFAULT;
+
+		break;
+	case MPU_SET_RAM:
+		retval = copy_from_user(mldl_cfg->ram,
+					(unsigned char __user *) arg,
+					sizeof(mldl_cfg->ram));
+		if (retval)
+			retval = -EFAULT;
+		break;
+	case MPU_SET_PLATFORM_DATA:
+		retval = mpu_ioctl_set_mpu_pdata(client, arg);
+		break;
+	case MPU_GET_MPU_CONFIG:
+		retval = mpu_ioctl_get_mpu_config(client, arg);
+		break;
+	case MPU_GET_INT_CONFIG:
+		retval = put_user(mldl_cfg->int_config,
+				  (unsigned char __user *) arg);
+		break;
+	case MPU_GET_EXT_SYNC:
+		retval = put_user(mldl_cfg->ext_sync,
+				  (unsigned char __user *) arg);
+		break;
+	case MPU_GET_FULL_SCALE:
+		retval = put_user(mldl_cfg->full_scale,
+				  (unsigned char __user *) arg);
+		break;
+	case MPU_GET_LPF:
+		retval = put_user(mldl_cfg->lpf,
+				  (unsigned char __user *) arg);
+		break;
+	case MPU_GET_CLK_SRC:
+		retval = put_user(mldl_cfg->clk_src,
+				  (unsigned char __user *) arg);
+		break;
+	case MPU_GET_DIVIDER:
+		retval = put_user(mldl_cfg->divider,
+				  (unsigned char __user *) arg);
+		break;
+	case MPU_GET_LEVEL_SHIFTER:
+		retval = put_user(mldl_cfg->pdata->level_shifter,
+				  (unsigned char __user *) arg);
+		break;
+	case MPU_GET_DMP_ENABLE:
+		retval = put_user(mldl_cfg->dmp_enable,
+				  (unsigned char __user *) arg);
+		break;
+	case MPU_GET_FIFO_ENABLE:
+		retval = put_user(mldl_cfg->fifo_enable,
+				  (unsigned char __user *) arg);
+		break;
+	case MPU_GET_DMP_CFG1:
+		retval = put_user(mldl_cfg->dmp_cfg1,
+				  (unsigned char __user *) arg);
+		break;
+	case MPU_GET_DMP_CFG2:
+		retval = put_user(mldl_cfg->dmp_cfg2,
+				  (unsigned char __user *) arg);
+		break;
+	case MPU_GET_OFFSET_TC:
+		retval = copy_to_user((unsigned char __user *) arg,
+				      mldl_cfg->offset_tc,
+				      sizeof(mldl_cfg->offset_tc));
+		if (retval)
+			retval = -EFAULT;
+		break;
+	case MPU_GET_RAM:
+		retval = copy_to_user((unsigned char __user *) arg,
+				      mldl_cfg->ram,
+				      sizeof(mldl_cfg->ram));
+		if (retval)
+			retval = -EFAULT;
+		break;
+	case MPU_CONFIG_ACCEL:
+		retval = slave_config(accel_adapter, mldl_cfg,
+				mldl_cfg->accel,
+				&mldl_cfg->pdata->accel,
+				(struct ext_slave_config __user *) arg);
+		break;
+	case MPU_CONFIG_COMPASS:
+		retval = slave_config(compass_adapter, mldl_cfg,
+				mldl_cfg->compass,
+				&mldl_cfg->pdata->compass,
+				(struct ext_slave_config __user *) arg);
+		break;
+	case MPU_CONFIG_PRESSURE:
+		retval = slave_config(pressure_adapter, mldl_cfg,
+				mldl_cfg->pressure,
+				&mldl_cfg->pdata->pressure,
+				(struct ext_slave_config __user *) arg);
+		break;
+	case MPU_GET_CONFIG_ACCEL:
+		retval = slave_get_config(accel_adapter, mldl_cfg,
+					mldl_cfg->accel,
+					&mldl_cfg->pdata->accel,
+					(struct ext_slave_config __user *) arg);
+		break;
+	case MPU_GET_CONFIG_COMPASS:
+		retval = slave_get_config(compass_adapter, mldl_cfg,
+					mldl_cfg->compass,
+					&mldl_cfg->pdata->compass,
+					(struct ext_slave_config __user *) arg);
+		break;
+	case MPU_GET_CONFIG_PRESSURE:
+		retval = slave_get_config(pressure_adapter, mldl_cfg,
+					mldl_cfg->pressure,
+					&mldl_cfg->pdata->pressure,
+					(struct ext_slave_config __user *) arg);
+		break;
+	case MPU_SUSPEND:
+	{
+		unsigned long sensors;
+		sensors = ~(mldl_cfg->requested_sensors);
+		retval = mpu3050_suspend(mldl_cfg,
+					client->adapter,
+					accel_adapter,
+					compass_adapter,
+					pressure_adapter,
+					((sensors & ML_THREE_AXIS_GYRO)
+						== ML_THREE_AXIS_GYRO),
+					((sensors & ML_THREE_AXIS_ACCEL)
+						== ML_THREE_AXIS_ACCEL),
+					((sensors & ML_THREE_AXIS_COMPASS)
+						== ML_THREE_AXIS_COMPASS),
+					((sensors & ML_THREE_AXIS_PRESSURE)
+						== ML_THREE_AXIS_PRESSURE));
+	}
+	break;
+	case MPU_RESUME:
+	{
+		unsigned long sensors;
+
+
+		sensors = mldl_cfg->requested_sensors;
+		retval = mpu3050_resume(mldl_cfg,
+					client->adapter,
+					accel_adapter,
+					compass_adapter,
+					pressure_adapter,
+					sensors & ML_THREE_AXIS_GYRO,
+					sensors & ML_THREE_AXIS_ACCEL,
+					sensors & ML_THREE_AXIS_COMPASS,
+					sensors & ML_THREE_AXIS_PRESSURE);
+	}
+	break;
+	case MPU_READ_ACCEL:
+	{
+		unsigned char data[6];
+		retval = mpu3050_read_accel(mldl_cfg, client->adapter,
+					    data);
+		if ((ML_SUCCESS == retval) &&
+		    (copy_to_user((unsigned char __user *) arg,
+			    data, sizeof(data))))
+			retval = -EFAULT;
+	}
+	break;
+	case MPU_READ_COMPASS:
+	{
+		unsigned char data[6];
+		struct i2c_adapter *compass_adapt =
+			i2c_get_adapter(mldl_cfg->pdata->compass.
+					adapt_num);
+		retval = mpu3050_read_compass(mldl_cfg, compass_adapt,
+						 data);
+		if ((ML_SUCCESS == retval) &&
+			(copy_to_user((unsigned char *) arg,
+				data, sizeof(data))))
+			retval = -EFAULT;
+	}
+	break;
+	case MPU_READ_PRESSURE:
+	{
+		unsigned char data[3];
+		struct i2c_adapter *pressure_adapt =
+			i2c_get_adapter(mldl_cfg->pdata->pressure.
+					adapt_num);
+		retval =
+			mpu3050_read_pressure(mldl_cfg, pressure_adapt,
+					data);
+		if ((ML_SUCCESS == retval) &&
+		    (copy_to_user((unsigned char __user *) arg,
+			    data, sizeof(data))))
+			retval = -EFAULT;
+	}
+	break;
+#ifdef HTC_READ_CAL_DATA
+	case MPU_READ_CAL_DATA:
+	{
+		int index;
+		unsigned char mpu_gyro_gsensor_kvalue[37];
+
+		for (index = 0;
+		     index < sizeof(mpu_gyro_gsensor_kvalue);
+		     index++) {
+			mpu_gyro_gsensor_kvalue[index] =
+				gyro_gsensor_kvalue[index];
+			printk(KERN_DEBUG "gyro_gsensor_kvalue[%d] = 0x%x\n",
+			       index, gyro_gsensor_kvalue[index]);
+		}
+
+		retval =
+			copy_to_user((unsigned char *) arg,
+				     mpu_gyro_gsensor_kvalue,
+				     sizeof(mpu_gyro_gsensor_kvalue));
+	}
+	break;
+#endif
+	case MPU_READ_MEMORY:
+	case MPU_WRITE_MEMORY:
+	default:
+		dev_err(&this_client->adapter->dev,
+			"[mpu_err]%s: Unknown cmd %d, arg %lu\n", __func__, cmd,
+			arg);
+		retval = -EINVAL;
+	}
+
+	return retval;
+}
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+void mpu3050_early_suspend(struct early_suspend *h)
+{
+	struct mpu_private_data *mpu = container_of(h,
+						    struct
+						    mpu_private_data,
+						    early_suspend);
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+	struct i2c_adapter *accel_adapter;
+	struct i2c_adapter *compass_adapter;
+	struct i2c_adapter *pressure_adapter;
+
+	accel_adapter = i2c_get_adapter(mldl_cfg->pdata->accel.adapt_num);
+	compass_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->compass.adapt_num);
+	pressure_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->pressure.adapt_num);
+
+	dev_dbg(&this_client->adapter->dev, "%s: %d, %d\n", __func__,
+		h->level, mpu->mldl_cfg.gyro_is_suspended);
+	if (MPU3050_EARLY_SUSPEND_IN_DRIVER)
+		(void) mpu3050_suspend(mldl_cfg, this_client->adapter,
+				accel_adapter, compass_adapter,
+				pressure_adapter, TRUE, TRUE, TRUE, TRUE);
+}
+
+void mpu3050_early_resume(struct early_suspend *h)
+{
+	struct mpu_private_data *mpu = container_of(h,
+						    struct
+						    mpu_private_data,
+						    early_suspend);
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+	struct i2c_adapter *accel_adapter;
+	struct i2c_adapter *compass_adapter;
+	struct i2c_adapter *pressure_adapter;
+
+	accel_adapter = i2c_get_adapter(mldl_cfg->pdata->accel.adapt_num);
+	compass_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->compass.adapt_num);
+	pressure_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->pressure.adapt_num);
+
+	if (MPU3050_EARLY_SUSPEND_IN_DRIVER) {
+		if (pid) {
+			unsigned long sensors = mldl_cfg->requested_sensors;
+			(void) mpu3050_resume(mldl_cfg,
+					this_client->adapter,
+					accel_adapter,
+					compass_adapter,
+					pressure_adapter,
+					sensors & ML_THREE_AXIS_GYRO,
+					sensors & ML_THREE_AXIS_ACCEL,
+					sensors & ML_THREE_AXIS_COMPASS,
+					sensors & ML_THREE_AXIS_PRESSURE);
+			dev_dbg(&this_client->adapter->dev,
+				"%s for pid %d\n", __func__, pid);
+		}
+	}
+	dev_dbg(&this_client->adapter->dev, "%s: %d\n", __func__, h->level);
+}
+#endif
+
+void mpu_shutdown(struct i2c_client *client)
+{
+	struct mpu_private_data *mpu =
+	    (struct mpu_private_data *) i2c_get_clientdata(client);
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+	struct i2c_adapter *accel_adapter;
+	struct i2c_adapter *compass_adapter;
+	struct i2c_adapter *pressure_adapter;
+
+	accel_adapter = i2c_get_adapter(mldl_cfg->pdata->accel.adapt_num);
+	compass_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->compass.adapt_num);
+	pressure_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->pressure.adapt_num);
+
+	(void) mpu3050_suspend(mldl_cfg, this_client->adapter,
+			       accel_adapter, compass_adapter, pressure_adapter,
+			       TRUE, TRUE, TRUE, TRUE);
+	dev_dbg(&this_client->adapter->dev, "%s\n", __func__);
+}
+
+int mpu_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+	struct mpu_private_data *mpu =
+	    (struct mpu_private_data *) i2c_get_clientdata(client);
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+	struct i2c_adapter *accel_adapter;
+	struct i2c_adapter *compass_adapter;
+	struct i2c_adapter *pressure_adapter;
+
+	accel_adapter = i2c_get_adapter(mldl_cfg->pdata->accel.adapt_num);
+	compass_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->compass.adapt_num);
+	pressure_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->pressure.adapt_num);
+
+	if (!mpu->mldl_cfg.gyro_is_suspended) {
+		dev_dbg(&this_client->adapter->dev,
+			"%s: suspending on event %d\n", __func__,
+			mesg.event);
+		(void) mpu3050_suspend(mldl_cfg, this_client->adapter,
+				       accel_adapter, compass_adapter,
+				       pressure_adapter,
+				       TRUE, TRUE, TRUE, TRUE);
+	} else {
+		dev_dbg(&this_client->adapter->dev,
+			"%s: Already suspended %d\n", __func__,
+			mesg.event);
+	}
+
+	return 0;
+}
+
+int mpu_resume(struct i2c_client *client)
+{
+	struct mpu_private_data *mpu =
+	    (struct mpu_private_data *) i2c_get_clientdata(client);
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+	struct i2c_adapter *accel_adapter;
+	struct i2c_adapter *compass_adapter;
+	struct i2c_adapter *pressure_adapter;
+
+	accel_adapter = i2c_get_adapter(mldl_cfg->pdata->accel.adapt_num);
+	compass_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->compass.adapt_num);
+	pressure_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->pressure.adapt_num);
+
+	if (pid) {
+		unsigned long sensors = mldl_cfg->requested_sensors;
+		(void) mpu3050_resume(mldl_cfg, this_client->adapter,
+				      accel_adapter,
+				      compass_adapter,
+				      pressure_adapter,
+				      sensors & ML_THREE_AXIS_GYRO,
+				      sensors & ML_THREE_AXIS_ACCEL,
+				      sensors & ML_THREE_AXIS_COMPASS,
+				      sensors & ML_THREE_AXIS_PRESSURE);
+		dev_dbg(&this_client->adapter->dev,
+			"%s for pid %d\n", __func__, pid);
+	}
+
+	return 0;
+}
+
+static const struct file_operations mpu_fops = {
+	.owner = THIS_MODULE,
+	.read = mpu_read,
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = mpu_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = mpu_ioctl,
+#endif
+	.open = mpu_open,
+	.release = mpu_release,
+};
+
+static unsigned short normal_i2c[] = { I2C_CLIENT_END };
+
+static struct miscdevice i2c_mpu_device = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "mpu", 
+	.fops = &mpu_fops,
+};
+
+void *g_handler;
+int (*g_sensors_reset)(void);
+
+struct class *mpu3050_class;
+struct device *mpu3050_dev;
+
+static ssize_t pwr_reg_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	unsigned char b[2] = "";
+	int result;
+
+	unsigned char bma[8] = "";
+
+	result = MLSLSerialRead(g_handler, 0x68,
+				MPUREG_USER_CTRL, 2, b);
+
+	result = MLSLSerialRead(g_handler, 0x18,
+				0x0F, 3, bma);
+
+	result = sprintf(buf, "MPUREG_USER_CTRL = 0x%x, MPUREG_PWR_MGM = "
+			      "0x%x.\n"
+			      "BMA register 0x0F = 0x%x, "
+			      "BMA register 0x10 = 0x%x, "
+			      "BMA register 0x11 = 0x%x\n"
+			      "",
+			      b[0], b[1],
+			      bma[0], bma[1], bma[2]);
+
+	return result;
+}
+
+static ssize_t pwr_reg_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	return count;
+}
+
+static DEVICE_ATTR(pwr_reg, 0664, pwr_reg_show, pwr_reg_store);
+
+static ssize_t mpu_debug_flag_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+
+	s += sprintf(s, "mpu_debug_flag = 0x%x\n", mpu_debug_flag);
+
+	return s - buf;
+}
+
+static ssize_t mpu_debug_flag_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	mpu_debug_flag = -1;
+	sscanf(buf, "%d", &mpu_debug_flag);
+
+	D("%s: mpu_debug_flag = %d\n", __func__, mpu_debug_flag);
+
+	return count;
+}
+
+static DEVICE_ATTR(mpu_debug_flag, 0664, mpu_debug_flag_show, \
+		mpu_debug_flag_store);
+
+static ssize_t mpu_sensors_reset_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+
+	s += sprintf(s, "mpu_sensors_reset = 0x%x\n", mpu_sensors_reset);
+
+	return s - buf;
+}
+
+static ssize_t mpu_sensors_reset_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	int rc = 0;
+
+	mpu_sensors_reset = -1;
+	sscanf(buf, "%d", &mpu_sensors_reset);
+
+	D("%s: mpu_sensors_reset = %d\n", __func__, mpu_sensors_reset);
+
+	if ((mpu_sensors_reset == 1) && g_sensors_reset) {
+		rc = g_sensors_reset();
+		if (rc)
+			E("G-Sensor, Compass, Gyro reset error\n");
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(mpu_sensors_reset, 0664, mpu_sensors_reset_show, \
+		mpu_sensors_reset_store);
+
+
+static ssize_t mpu_lpm_flag_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+
+	s += sprintf(s, "%d", mpu_lpm_flag);
+
+	return s - buf;
+}
+
+static ssize_t mpu_lpm_flag_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	struct mpu_private_data *mpu =
+	    (struct mpu_private_data *) i2c_get_clientdata(this_client);
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+
+	mpu_lpm_flag = -1;
+	sscanf(buf, "%d", &mpu_lpm_flag);
+
+	if ((mpu_lpm_flag == 1) && mldl_cfg->pdata->power_LPM)
+		mldl_cfg->pdata->power_LPM(1);
+	else if (mldl_cfg->pdata->power_LPM)
+		mldl_cfg->pdata->power_LPM(0);
+
+	D("%s: mpu_lpm_flag = %d\n", __func__, mpu_lpm_flag);
+
+	return count;
+}
+
+static DEVICE_ATTR(mpu_lpm_flag, 0664, mpu_lpm_flag_show, \
+		mpu_lpm_flag_store);
+
+
+int mpu3050_probe(struct i2c_client *client,
+		  const struct i2c_device_id *devid)
+{
+	struct mpu3050_platform_data *pdata;
+	struct mpu_private_data *mpu;
+	struct mldl_cfg *mldl_cfg;
+	int res = 0;
+	struct i2c_adapter *accel_adapter = NULL;
+	struct i2c_adapter *compass_adapter = NULL;
+	struct i2c_adapter *pressure_adapter = NULL;
+
+	dev_dbg(&client->adapter->dev, "%s\n", __func__);
+
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		res = -ENODEV;
+		goto out_check_functionality_failed;
+	}
+
+	mpu = kzalloc(sizeof(struct mpu_private_data), GFP_KERNEL);
+	if (!mpu) {
+		res = -ENOMEM;
+		goto out_alloc_data_failed;
+	}
+
+	i2c_set_clientdata(client, mpu);
+	this_client = client;
+	mldl_cfg = &mpu->mldl_cfg;
+	pdata = (struct mpu3050_platform_data *) client->dev.platform_data;
+	if (!pdata) {
+		dev_warn(&this_client->adapter->dev,
+			 "Warning no platform data for mpu3050\n");
+	} else {
+		mldl_cfg->pdata = pdata;
+
+	g_sensors_reset = pdata->g_sensors_reset;
+
+#if defined(CONFIG_MPU_SENSORS_MPU3050_MODULE) || \
+    defined(CONFIG_MPU_SENSORS_MPU6000_MODULE)
+		pdata->accel.get_slave_descr = get_accel_slave_descr;
+		pdata->compass.get_slave_descr = get_compass_slave_descr;
+		pdata->pressure.get_slave_descr = get_pressure_slave_descr;
+#endif
+
+		if (pdata->accel.get_slave_descr) {
+			mldl_cfg->accel =
+			    pdata->accel.get_slave_descr();
+			dev_info(&this_client->adapter->dev,
+				 "%s: +%s\n", MPU_NAME,
+				 mldl_cfg->accel->name);
+			accel_adapter =
+				i2c_get_adapter(pdata->accel.adapt_num);
+			if (pdata->accel.irq > 0) {
+				dev_info(&this_client->adapter->dev,
+					"Installing Accel irq using %d\n",
+					pdata->accel.irq);
+				res = slaveirq_init(accel_adapter,
+						&pdata->accel,
+						"accelirq");
+				if (res)
+					goto out_accelirq_failed;
+			} else {
+				dev_info(&this_client->adapter->dev,
+					"Accel irq not needed\n");
+			}
+		} else {
+			dev_warn(&this_client->adapter->dev,
+				 "%s: No Accel Present\n", MPU_NAME);
+		}
+
+		if (pdata->compass.get_slave_descr) {
+			mldl_cfg->compass =
+			    pdata->compass.get_slave_descr();
+			dev_info(&this_client->adapter->dev,
+				 "%s: +%s\n", MPU_NAME,
+				 mldl_cfg->compass->name);
+			compass_adapter =
+				i2c_get_adapter(pdata->compass.adapt_num);
+			if (pdata->compass.irq > 0) {
+				dev_info(&this_client->adapter->dev,
+					"Installing Compass irq using %d\n",
+					pdata->compass.irq);
+				res = slaveirq_init(compass_adapter,
+						&pdata->compass,
+						"compassirq");
+				if (res)
+					goto out_compassirq_failed;
+			} else {
+				dev_info(&this_client->adapter->dev,
+					"Compass irq not needed\n");
+			}
+		} else {
+			dev_warn(&this_client->adapter->dev,
+				 "%s: No Compass Present\n", MPU_NAME);
+		}
+
+		if (pdata->pressure.get_slave_descr) {
+			mldl_cfg->pressure =
+			    pdata->pressure.get_slave_descr();
+			dev_info(&this_client->adapter->dev,
+				 "%s: +%s\n", MPU_NAME,
+				 mldl_cfg->pressure->name);
+			pressure_adapter =
+				i2c_get_adapter(pdata->pressure.adapt_num);
+
+			if (pdata->pressure.irq > 0) {
+				dev_info(&this_client->adapter->dev,
+					"Installing Pressure irq using %d\n",
+					pdata->pressure.irq);
+				res = slaveirq_init(pressure_adapter,
+						&pdata->pressure,
+						"pressureirq");
+				if (res)
+					goto out_pressureirq_failed;
+			} else {
+				dev_warn(&this_client->adapter->dev,
+					"WARNING: Pressure irq not assigned\n");
+			}
+		} else {
+			dev_info(&this_client->adapter->dev,
+				 "%s: No Pressure Present\n", MPU_NAME);
+		}
+	}
+
+	mldl_cfg->addr = client->addr;
+	res = mpu3050_open(&mpu->mldl_cfg, client->adapter,
+			accel_adapter, compass_adapter, pressure_adapter);
+
+	if (res) {
+		dev_err(&this_client->adapter->dev,
+			"[mpu_err] Unable to open %s %d\n", MPU_NAME, res);
+		res = -ENODEV;
+		goto out_whoami_failed;
+	}
+
+	g_handler = client->adapter;
+
+	res = misc_register(&i2c_mpu_device);
+	if (res < 0) {
+		dev_err(&this_client->adapter->dev,
+			"[mpu_err] ERROR: misc_register returned %d\n", res);
+		goto out_misc_register_failed;
+	}
+
+	if (this_client->irq > 0) {
+		dev_info(&this_client->adapter->dev,
+			 "Installing irq using %d\n", this_client->irq);
+		res = mpuirq_init(this_client);
+		if (res)
+			goto out_mpuirq_failed;
+	} else {
+		dev_warn(&this_client->adapter->dev,
+			 "WARNING: %s irq not assigned\n", MPU_NAME);
+	}
+
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+	mpu->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
+	mpu->early_suspend.suspend = mpu3050_early_suspend;
+	mpu->early_suspend.resume = mpu3050_early_resume;
+	register_early_suspend(&mpu->early_suspend);
+#endif
+
+	mpu3050_class = class_create(THIS_MODULE, "gyro_sensors");
+	if (IS_ERR(mpu3050_class)) {
+		res = PTR_ERR(mpu3050_class);
+		mpu3050_class = NULL;
+		E("%s, create mpu3050_class fail!\n", __func__);
+		goto out_mpuirq_failed;
+	}
+
+	mpu3050_dev = device_create(mpu3050_class,
+				NULL, 0, "%s", "gyro");
+	if (unlikely(IS_ERR(mpu3050_dev))) {
+		res = PTR_ERR(mpu3050_dev);
+		mpu3050_dev = NULL;
+		E("%s, create mpu3050_dev fail!\n", __func__);
+		goto err_create_mpu_device;
+	}
+
+	
+	res = device_create_file(mpu3050_dev, &dev_attr_pwr_reg);
+	if (res) {
+		E("%s, create mpu3050_device_create_file fail!\n", __func__);
+		goto err_create_mpu_device_file;
+	}
+
+	
+	res = device_create_file(mpu3050_dev, &dev_attr_mpu_debug_flag);
+	if (res) {
+		E("%s, create mpu3050_device_create_file fail!\n", __func__);
+		goto err_create_mpu_device_mpu_debug_flag_file;
+	}
+
+	
+	res = device_create_file(mpu3050_dev, &dev_attr_mpu_sensors_reset);
+	if (res) {
+		E("%s, create mpu3050_device_create_file fail!\n", __func__);
+		goto err_create_mpu_device_sensors_reset_flag_file;
+	}
+
+	
+	res = device_create_file(mpu3050_dev, &dev_attr_mpu_lpm_flag);
+	if (res) {
+		E("%s, create mpu3050_device_create_file fail!\n", __func__);
+		goto err_create_mpu_device_mpu_lpm_flag_file;
+	}
+
+	mpu_debug_flag = 0;
+	mpu_sensors_reset = 0;
+	mpu_lpm_flag = 0;
+
+	return res;
+
+err_create_mpu_device_mpu_lpm_flag_file:
+	device_remove_file(mpu3050_dev, &dev_attr_mpu_sensors_reset);
+err_create_mpu_device_sensors_reset_flag_file:
+	device_remove_file(mpu3050_dev, &dev_attr_mpu_debug_flag);
+err_create_mpu_device_mpu_debug_flag_file:
+	device_remove_file(mpu3050_dev, &dev_attr_pwr_reg);
+err_create_mpu_device_file:
+	device_unregister(mpu3050_dev);
+err_create_mpu_device:
+	class_destroy(mpu3050_class);
+out_mpuirq_failed:
+	misc_deregister(&i2c_mpu_device);
+out_misc_register_failed:
+	mpu3050_close(&mpu->mldl_cfg, client->adapter,
+		accel_adapter, compass_adapter, pressure_adapter);
+out_whoami_failed:
+	if (pdata &&
+	    pdata->pressure.get_slave_descr &&
+	    pdata->pressure.irq)
+		slaveirq_exit(&pdata->pressure);
+out_pressureirq_failed:
+	if (pdata &&
+	    pdata->compass.get_slave_descr &&
+	    pdata->compass.irq)
+		slaveirq_exit(&pdata->compass);
+out_compassirq_failed:
+	if (pdata &&
+	    pdata->accel.get_slave_descr &&
+	    pdata->accel.irq)
+		slaveirq_exit(&pdata->accel);
+out_accelirq_failed:
+	kfree(mpu);
+out_alloc_data_failed:
+out_check_functionality_failed:
+	dev_err(&this_client->adapter->dev, "[mpu_err]%s failed %d\n", __func__,
+		res);
+	return res;
+
+}
+
+static int mpu3050_remove(struct i2c_client *client)
+{
+	struct mpu_private_data *mpu = i2c_get_clientdata(client);
+	struct i2c_adapter *accel_adapter;
+	struct i2c_adapter *compass_adapter;
+	struct i2c_adapter *pressure_adapter;
+	struct mldl_cfg *mldl_cfg = &mpu->mldl_cfg;
+	struct mpu3050_platform_data *pdata = mldl_cfg->pdata;
+
+	accel_adapter = i2c_get_adapter(mldl_cfg->pdata->accel.adapt_num);
+	compass_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->compass.adapt_num);
+	pressure_adapter =
+	    i2c_get_adapter(mldl_cfg->pdata->pressure.adapt_num);
+
+	dev_dbg(&client->adapter->dev, "%s\n", __func__);
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+	unregister_early_suspend(&mpu->early_suspend);
+#endif
+	mpu3050_close(mldl_cfg, client->adapter,
+		accel_adapter, compass_adapter, pressure_adapter);
+
+	if (client->irq)
+		mpuirq_exit();
+
+	if (pdata &&
+	    pdata->pressure.get_slave_descr &&
+	    pdata->pressure.irq)
+		slaveirq_exit(&pdata->pressure);
+
+	if (pdata &&
+	    pdata->compass.get_slave_descr &&
+	    pdata->compass.irq)
+		slaveirq_exit(&pdata->compass);
+
+	if (pdata &&
+	    pdata->accel.get_slave_descr &&
+	    pdata->accel.irq)
+		slaveirq_exit(&pdata->accel);
+
+	misc_deregister(&i2c_mpu_device);
+	kfree(mpu);
+
+	return 0;
+}
+
+static const struct i2c_device_id mpu3050_id[] = {
+	{MPU_NAME, 0},
+	{}
+};
+
+MODULE_DEVICE_TABLE(i2c, mpu3050_id);
+
+static struct i2c_driver mpu3050_driver = {
+	.class = I2C_CLASS_HWMON,
+	.probe = mpu3050_probe,
+	.remove = mpu3050_remove,
+	.id_table = mpu3050_id,
+	.driver = {
+		   .owner = THIS_MODULE,
+		   .name = MPU_NAME,
+		   },
+	.address_list = normal_i2c,
+	.shutdown = mpu_shutdown,	
+	.suspend = mpu_suspend,	
+	.resume = mpu_resume,	
+
+};
+
+static int __init mpu_init(void)
+{
+	int res = i2c_add_driver(&mpu3050_driver);
+	pid = 0;
+	printk(KERN_DEBUG "%s\n", __func__);
+	if (res)
+		dev_err(&this_client->adapter->dev, "[mpu_err]%s failed\n",
+			__func__);
+	return res;
+}
+
+static void __exit mpu_exit(void)
+{
+	printk(KERN_DEBUG "%s\n", __func__);
+	i2c_del_driver(&mpu3050_driver);
+}
+
+module_init(mpu_init);
+module_exit(mpu_exit);
+
+MODULE_AUTHOR("Invensense Corporation");
+MODULE_DESCRIPTION("User space character device interface for MPU3050");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS(MPU_NAME);
diff --git a/drivers/input/misc/mpu3050/mpu-i2c.c b/drivers/input/misc/mpu3050/mpu-i2c.c
new file mode 100644
index 0000000..0953e6a
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mpu-i2c.c
@@ -0,0 +1,252 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include "mpu.h"
+#define MPU_I2C_RETRY_ENABLE 1
+#define MPU_I2C_RETRY_TIMES 10
+#define MPU_I2C_DELAY_TIMES_MS 10
+
+int sensor_i2c_write(struct i2c_adapter *i2c_adap,
+		     unsigned char address,
+		     unsigned int len, unsigned char const *data)
+{
+	struct i2c_msg msgs[1];
+	int res;
+	int i;
+
+	if (NULL == data || NULL == i2c_adap)
+		return -EINVAL;
+
+	msgs[0].addr = address;
+	msgs[0].flags = 0;	
+	msgs[0].buf = (unsigned char *) data;
+	msgs[0].len = len;
+
+#if MPU_I2C_RETRY_ENABLE
+		for (i = 0; i < MPU_I2C_RETRY_TIMES; i++) {
+			res = i2c_transfer(i2c_adap, msgs, 1);
+			if (res < 1) {
+				printk(KERN_ERR "I2c Slave address: %x,\
+				sensor_i2c_write fail,\
+				retry:%d\n", address, i);
+				mdelay(MPU_I2C_DELAY_TIMES_MS);
+			} else
+				return 0;
+
+		}
+		return res;
+#else
+	res = i2c_transfer(i2c_adap, msgs, 1);
+	if (res < 1)
+		return res;
+	else
+		return 0;
+#endif
+}
+
+int sensor_i2c_write_register(struct i2c_adapter *i2c_adap,
+			      unsigned char address,
+			      unsigned char reg, unsigned char value)
+{
+	unsigned char data[2];
+
+	data[0] = reg;
+	data[1] = value;
+	return sensor_i2c_write(i2c_adap, address, 2, data);
+}
+
+int sensor_i2c_read(struct i2c_adapter *i2c_adap,
+		    unsigned char address,
+		    unsigned char reg,
+		    unsigned int len, unsigned char *data)
+{
+	struct i2c_msg msgs[2];
+	int res;
+	int i;
+
+	if (NULL == data || NULL == i2c_adap)
+		return -EINVAL;
+
+	msgs[0].addr = address;
+	msgs[0].flags = 0;	
+	msgs[0].buf = &reg;
+	msgs[0].len = 1;
+
+	msgs[1].addr = address;
+	msgs[1].flags = I2C_M_RD;
+	msgs[1].buf = data;
+	msgs[1].len = len;
+
+#if MPU_I2C_RETRY_ENABLE
+		for (i = 0; i < MPU_I2C_RETRY_TIMES; i++) {
+			res = i2c_transfer(i2c_adap, msgs, 2);
+			if (res < 2) {
+				printk(KERN_ERR "I2c Slave address: %x,\
+				sensor_i2c_read fail,\
+				retry:%d\n", address, i);
+				mdelay(MPU_I2C_DELAY_TIMES_MS);
+			} else
+				return 0;
+
+		}
+		return res;
+#else
+	res = i2c_transfer(i2c_adap, msgs, 2);
+	if (res < 2)
+		return res;
+	else
+		return 0;
+#endif
+}
+
+int mpu_memory_read(struct i2c_adapter *i2c_adap,
+		    unsigned char mpu_addr,
+		    unsigned short mem_addr,
+		    unsigned int len, unsigned char *data)
+{
+	unsigned char bank[2];
+	unsigned char addr[2];
+	unsigned char buf;
+
+	struct i2c_msg msgs[4];
+	int ret;
+	int i;
+
+	if (NULL == data || NULL == i2c_adap)
+		return -EINVAL;
+
+	bank[0] = MPUREG_BANK_SEL;
+	bank[1] = mem_addr >> 8;
+
+	addr[0] = MPUREG_MEM_START_ADDR;
+	addr[1] = mem_addr & 0xFF;
+
+	buf = MPUREG_MEM_R_W;
+
+	
+	msgs[0].addr = mpu_addr;
+	msgs[0].flags = 0;
+	msgs[0].buf = bank;
+	msgs[0].len = sizeof(bank);
+
+	msgs[1].addr = mpu_addr;
+	msgs[1].flags = 0;
+	msgs[1].buf = addr;
+	msgs[1].len = sizeof(addr);
+
+	msgs[2].addr = mpu_addr;
+	msgs[2].flags = 0;
+	msgs[2].buf = &buf;
+	msgs[2].len = 1;
+
+	msgs[3].addr = mpu_addr;
+	msgs[3].flags = I2C_M_RD;
+	msgs[3].buf = data;
+	msgs[3].len = len;
+
+#if MPU_I2C_RETRY_ENABLE
+		for (i = 0; i < MPU_I2C_RETRY_TIMES; i++) {
+			ret = i2c_transfer(i2c_adap, msgs, 4);
+			if (ret != 4) {
+				printk(KERN_ERR "I2c Slave address: %x,\
+				mpu_memory_read,\
+				retry:%d\n", mpu_addr, i);
+				mdelay(MPU_I2C_DELAY_TIMES_MS);
+			} else
+				return 0;
+
+		}
+		return ret;
+#else
+	ret = i2c_transfer(i2c_adap, msgs, 4);
+	if (ret != 4)
+		return ret;
+	else
+		return 0;
+#endif
+}
+
+int mpu_memory_write(struct i2c_adapter *i2c_adap,
+		     unsigned char mpu_addr,
+		     unsigned short mem_addr,
+		     unsigned int len, unsigned char const *data)
+{
+	unsigned char bank[2];
+	unsigned char addr[2];
+	unsigned char buf[513];
+
+	struct i2c_msg msgs[3];
+	int ret;
+	int i;
+
+	if (NULL == data || NULL == i2c_adap)
+		return -EINVAL;
+	if (len >= (sizeof(buf) - 1))
+		return -ENOMEM;
+
+	bank[0] = MPUREG_BANK_SEL;
+	bank[1] = mem_addr >> 8;
+
+	addr[0] = MPUREG_MEM_START_ADDR;
+	addr[1] = mem_addr & 0xFF;
+
+	buf[0] = MPUREG_MEM_R_W;
+	memcpy(buf + 1, data, len);
+
+	
+	msgs[0].addr = mpu_addr;
+	msgs[0].flags = 0;
+	msgs[0].buf = bank;
+	msgs[0].len = sizeof(bank);
+
+	msgs[1].addr = mpu_addr;
+	msgs[1].flags = 0;
+	msgs[1].buf = addr;
+	msgs[1].len = sizeof(addr);
+
+	msgs[2].addr = mpu_addr;
+	msgs[2].flags = 0;
+	msgs[2].buf = (unsigned char *) buf;
+	msgs[2].len = len + 1;
+
+#if MPU_I2C_RETRY_ENABLE
+		for (i = 0; i < MPU_I2C_RETRY_TIMES; i++) {
+			ret = i2c_transfer(i2c_adap, msgs, 3);
+			if (ret != 3) {
+				printk(KERN_ERR "I2c Slave address: %x,\
+				mpu_memory_write,\
+				retry:%d\n", mpu_addr, i);
+				mdelay(MPU_I2C_DELAY_TIMES_MS);
+			} else
+				return 0;
+
+		}
+		return ret;
+#else
+	ret = i2c_transfer(i2c_adap, msgs, 3);
+	if (ret != 3)
+		return ret;
+	else
+		return 0;
+#endif
+}
+
diff --git a/drivers/input/misc/mpu3050/mpu-i2c.h b/drivers/input/misc/mpu3050/mpu-i2c.h
new file mode 100644
index 0000000..c26aafb
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mpu-i2c.h
@@ -0,0 +1,48 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+#ifndef __MPU_I2C_H__
+#define __MPU_I2C_H__
+
+#include <linux/i2c.h>
+
+int sensor_i2c_write(struct i2c_adapter *i2c_adap,
+		     unsigned char address,
+		     unsigned int len, unsigned char const *data);
+
+int sensor_i2c_write_register(struct i2c_adapter *i2c_adap,
+			      unsigned char address,
+			      unsigned char reg, unsigned char value);
+
+int sensor_i2c_read(struct i2c_adapter *i2c_adap,
+		    unsigned char address,
+		    unsigned char reg,
+		    unsigned int len, unsigned char *data);
+
+int mpu_memory_read(struct i2c_adapter *i2c_adap,
+		    unsigned char mpu_addr,
+		    unsigned short mem_addr,
+		    unsigned int len, unsigned char *data);
+
+int mpu_memory_write(struct i2c_adapter *i2c_adap,
+		     unsigned char mpu_addr,
+		     unsigned short mem_addr,
+		     unsigned int len, unsigned char const *data);
+
+#endif	
diff --git a/drivers/input/misc/mpu3050/mpuirq.c b/drivers/input/misc/mpu3050/mpuirq.c
new file mode 100644
index 0000000..561d6cf
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mpuirq.c
@@ -0,0 +1,319 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/stat.h>
+#include <linux/irq.h>
+#include <linux/signal.h>
+#include <linux/miscdevice.h>
+#include <linux/i2c.h>
+#include <linux/i2c-dev.h>
+#include <linux/workqueue.h>
+#include <linux/poll.h>
+
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
+
+#include "mpu.h"
+#include "mpuirq.h"
+#include "mldl_cfg.h"
+#include "mpu-i2c.h"
+
+#define MPUIRQ_NAME "mpuirq"
+
+
+DECLARE_WAIT_QUEUE_HEAD(mpuirq_wait);
+
+struct mpuirq_dev_data {
+	struct work_struct work;
+	struct i2c_client *mpu_client;
+	struct miscdevice *dev;
+	int irq;
+	int pid;
+	int accel_divider;
+	int data_ready;
+	int timeout;
+};
+
+static struct mpuirq_dev_data mpuirq_dev_data;
+static struct mpuirq_data mpuirq_data;
+static char *interface = MPUIRQ_NAME;
+
+static void mpu_accel_data_work_fcn(struct work_struct *work);
+
+static int mpuirq_open(struct inode *inode, struct file *file)
+{
+	dev_dbg(mpuirq_dev_data.dev->this_device,
+		"%s current->pid %d\n", __func__, current->pid);
+	mpuirq_dev_data.pid = current->pid;
+	file->private_data = &mpuirq_dev_data;
+	
+	
+	
+	return 0;
+}
+
+static int mpuirq_release(struct inode *inode, struct file *file)
+{
+	dev_dbg(mpuirq_dev_data.dev->this_device, "mpuirq_release\n");
+	return 0;
+}
+
+static ssize_t mpuirq_read(struct file *file,
+			   char *buf, size_t count, loff_t *ppos)
+{
+	int len, err;
+	struct mpuirq_dev_data *p_mpuirq_dev_data = file->private_data;
+
+	if (!mpuirq_dev_data.data_ready) {
+		wait_event_interruptible_timeout(mpuirq_wait,
+						 mpuirq_dev_data.
+						 data_ready,
+						 mpuirq_dev_data.timeout);
+	}
+
+	if (mpuirq_dev_data.data_ready && NULL != buf
+	    && count >= sizeof(mpuirq_data)) {
+		err = copy_to_user(buf, &mpuirq_data, sizeof(mpuirq_data));
+		mpuirq_data.data_type = 0;
+	} else {
+		return 0;
+	}
+	if (err != 0) {
+		dev_err(p_mpuirq_dev_data->dev->this_device,
+			"Copy to user returned %d\n", err);
+		return -EFAULT;
+	}
+	mpuirq_dev_data.data_ready = 0;
+	len = sizeof(mpuirq_data);
+	return len;
+}
+
+unsigned int mpuirq_poll(struct file *file, struct poll_table_struct *poll)
+{
+	int mask = 0;
+
+	poll_wait(file, &mpuirq_wait, poll);
+	if (mpuirq_dev_data.data_ready)
+		mask |= POLLIN | POLLRDNORM;
+	return mask;
+}
+
+static long mpuirq_ioctl(struct file *file,
+			 unsigned int cmd, unsigned long arg)
+{
+	int retval = 0;
+	int data;
+
+	switch (cmd) {
+	case MPUIRQ_SET_TIMEOUT:
+		mpuirq_dev_data.timeout = arg;
+		break;
+
+	case MPUIRQ_GET_INTERRUPT_CNT:
+		data = mpuirq_data.interruptcount - 1;
+		if (mpuirq_data.interruptcount > 1)
+			mpuirq_data.interruptcount = 1;
+
+		if (copy_to_user((int *) arg, &data, sizeof(int)))
+			return -EFAULT;
+		break;
+	case MPUIRQ_GET_IRQ_TIME:
+		if (copy_to_user((int *) arg, &mpuirq_data.irqtime,
+				 sizeof(mpuirq_data.irqtime)))
+			return -EFAULT;
+		mpuirq_data.irqtime = 0;
+		break;
+	case MPUIRQ_SET_FREQUENCY_DIVIDER:
+		mpuirq_dev_data.accel_divider = arg;
+		break;
+	case MPUIRQ_GET_DEBUG_FLAG:
+		if (copy_to_user((int *) arg, &mpu_debug_flag, sizeof(int)))
+			return -EFAULT;
+		break;
+	default:
+		retval = -EINVAL;
+	}
+	return retval;
+}
+
+static void mpu_accel_data_work_fcn(struct work_struct *work)
+{
+	struct mpuirq_dev_data *mpuirq_dev_data =
+	    (struct mpuirq_dev_data *) work;
+	struct mldl_cfg *mldl_cfg =
+	    (struct mldl_cfg *)
+	    i2c_get_clientdata(mpuirq_dev_data->mpu_client);
+	struct i2c_adapter *accel_adapter;
+	unsigned char wbuff[16];
+	unsigned char rbuff[16];
+	int ii;
+
+	accel_adapter = i2c_get_adapter(mldl_cfg->pdata->accel.adapt_num);
+	mldl_cfg->accel->read(accel_adapter,
+			      mldl_cfg->accel,
+			      &mldl_cfg->pdata->accel, rbuff);
+
+
+	
+	if (EXT_SLAVE_BIG_ENDIAN == mldl_cfg->accel->endian) {
+		for (ii = 0; ii < 3; ii++) {
+			wbuff[2 * ii + 1] = rbuff[2 * ii + 1];
+			wbuff[2 * ii + 2] = rbuff[2 * ii + 0];
+		}
+	} else {
+		memcpy(wbuff + 1, rbuff, mldl_cfg->accel->len);
+	}
+
+	wbuff[7] = 0;
+	wbuff[8] = 1;		
+
+	mpu_memory_write(mpuirq_dev_data->mpu_client->adapter,
+			 mldl_cfg->addr, 0x0108, 8, wbuff);
+}
+
+static irqreturn_t mpuirq_handler(int irq, void *dev_id)
+{
+	static int mycount;
+	struct timeval irqtime;
+	mycount++;
+
+	mpuirq_data.interruptcount++;
+
+	
+	
+	mpuirq_dev_data.data_ready = 1;
+
+	do_gettimeofday(&irqtime);
+	mpuirq_data.irqtime = (((long long) irqtime.tv_sec) << 32);
+	mpuirq_data.irqtime += irqtime.tv_usec;
+
+	if ((mpuirq_dev_data.accel_divider >= 0) &&
+		(0 == (mycount % (mpuirq_dev_data.accel_divider + 1)))) {
+		schedule_work((struct work_struct
+				*) (&mpuirq_dev_data));
+	}
+
+	wake_up_interruptible(&mpuirq_wait);
+
+	return IRQ_HANDLED;
+
+}
+
+const struct file_operations mpuirq_fops = {
+	.owner = THIS_MODULE,
+	.read = mpuirq_read,
+	.poll = mpuirq_poll,
+
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = mpuirq_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = mpuirq_ioctl,
+#endif
+	.open = mpuirq_open,
+	.release = mpuirq_release,
+};
+
+static struct miscdevice mpuirq_device = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = MPUIRQ_NAME,
+	.fops = &mpuirq_fops,
+};
+
+int mpuirq_init(struct i2c_client *mpu_client)
+{
+
+	int res;
+	struct mldl_cfg *mldl_cfg =
+	    (struct mldl_cfg *) i2c_get_clientdata(mpu_client);
+
+	
+	INIT_WORK((struct work_struct *) &mpuirq_dev_data,
+		  mpu_accel_data_work_fcn);
+	mpuirq_dev_data.mpu_client = mpu_client;
+
+	dev_info(&mpu_client->adapter->dev,
+		 "Module Param interface = %s\n", interface);
+
+	mpuirq_dev_data.irq = mpu_client->irq;
+	mpuirq_dev_data.pid = 0;
+	mpuirq_dev_data.accel_divider = -1;
+	mpuirq_dev_data.data_ready = 0;
+	mpuirq_dev_data.timeout = 0;
+	mpuirq_dev_data.dev = &mpuirq_device;
+
+	if (mpuirq_dev_data.irq) {
+		unsigned long flags;
+		if (BIT_ACTL_LOW ==
+		    ((mldl_cfg->pdata->int_config) & BIT_ACTL))
+			flags = IRQF_TRIGGER_FALLING;
+		else
+			flags = IRQF_TRIGGER_RISING;
+
+		res =
+		    request_irq(mpuirq_dev_data.irq, mpuirq_handler, flags,
+				interface, &mpuirq_dev_data.irq);
+		if (res) {
+			dev_err(&mpu_client->adapter->dev,
+				"myirqtest: cannot register IRQ %d\n",
+				mpuirq_dev_data.irq);
+		} else {
+			res = misc_register(&mpuirq_device);
+			if (res < 0) {
+				dev_err(&mpu_client->adapter->dev,
+					"misc_register returned %d\n",
+					res);
+				free_irq(mpuirq_dev_data.irq,
+					 &mpuirq_dev_data.irq);
+			}
+		}
+
+	} else {
+		res = 0;
+	}
+
+	return res;
+}
+
+void mpuirq_exit(void)
+{
+	
+	if (mpuirq_dev_data.irq > 0)
+		free_irq(mpuirq_dev_data.irq, &mpuirq_dev_data.irq);
+
+	flush_scheduled_work();
+
+	dev_info(mpuirq_device.this_device, "Unregistering %s\n",
+		 MPUIRQ_NAME);
+	misc_deregister(&mpuirq_device);
+
+	return;
+}
+
+module_param(interface, charp, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(interface, "The Interface name");
diff --git a/drivers/input/misc/mpu3050/mpuirq.h b/drivers/input/misc/mpu3050/mpuirq.h
new file mode 100644
index 0000000..54c2e88
--- /dev/null
+++ b/drivers/input/misc/mpu3050/mpuirq.h
@@ -0,0 +1,45 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+#ifndef __MPUIRQ__
+#define __MPUIRQ__
+
+#ifdef __KERNEL__
+#include <linux/i2c-dev.h>
+#endif
+
+#define MPUIRQ_ENABLE_DEBUG          (1)
+#define MPUIRQ_GET_INTERRUPT_CNT     (2)
+#define MPUIRQ_GET_IRQ_TIME          (3)
+#define MPUIRQ_GET_LED_VALUE         (4)
+#define MPUIRQ_SET_TIMEOUT           (5)
+#define MPUIRQ_SET_ACCEL_INFO        (6)
+#define MPUIRQ_SET_FREQUENCY_DIVIDER (7)
+#define MPUIRQ_GET_DEBUG_FLAG        (8)
+
+extern int mpu_debug_flag;
+
+#ifdef __KERNEL__
+
+void mpuirq_exit(void);
+int mpuirq_init(struct i2c_client *mpu_client);
+
+#endif
+
+#endif
diff --git a/drivers/input/misc/mpu3050/slaveirq.c b/drivers/input/misc/mpu3050/slaveirq.c
new file mode 100644
index 0000000..d985c26
--- /dev/null
+++ b/drivers/input/misc/mpu3050/slaveirq.c
@@ -0,0 +1,262 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/stat.h>
+#include <linux/irq.h>
+#include <linux/signal.h>
+#include <linux/miscdevice.h>
+#include <linux/i2c.h>
+#include <linux/i2c-dev.h>
+#include <linux/poll.h>
+
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
+#include <linux/wait.h>
+#include <linux/slab.h>
+
+#include "mpu.h"
+#include "slaveirq.h"
+#include "mldl_cfg.h"
+#include "mpu-i2c.h"
+
+
+struct slaveirq_dev_data {
+	struct miscdevice dev;
+	struct i2c_client *slave_client;
+	struct mpuirq_data data;
+	wait_queue_head_t slaveirq_wait;
+	int irq;
+	int pid;
+	int data_ready;
+	int timeout;
+};
+
+static int slaveirq_open(struct inode *inode, struct file *file)
+{
+	struct slaveirq_dev_data *data =
+		container_of(file->private_data, struct slaveirq_dev_data, dev);
+
+	dev_dbg(data->dev.this_device,
+		"%s current->pid %d\n", __func__, current->pid);
+	data->pid = current->pid;
+	return 0;
+}
+
+static int slaveirq_release(struct inode *inode, struct file *file)
+{
+	struct slaveirq_dev_data *data =
+		container_of(file->private_data, struct slaveirq_dev_data, dev);
+	dev_dbg(data->dev.this_device, "slaveirq_release\n");
+	return 0;
+}
+
+static ssize_t slaveirq_read(struct file *file,
+			   char *buf, size_t count, loff_t *ppos)
+{
+	int len, err;
+	struct slaveirq_dev_data *data =
+		container_of(file->private_data, struct slaveirq_dev_data, dev);
+
+	if (!data->data_ready) {
+		wait_event_interruptible_timeout(data->slaveirq_wait,
+						 data->data_ready,
+						 data->timeout);
+	}
+
+	if (data->data_ready && NULL != buf
+	    && count >= sizeof(data->data)) {
+		err = copy_to_user(buf, &data->data, sizeof(data->data));
+		data->data.data_type = 0;
+	} else {
+		return 0;
+	}
+	if (err != 0) {
+		dev_err(data->dev.this_device,
+			"Copy to user returned %d\n", err);
+		return -EFAULT;
+	}
+	data->data_ready = 0;
+	len = sizeof(data->data);
+	return len;
+}
+
+unsigned int slaveirq_poll(struct file *file, struct poll_table_struct *poll)
+{
+	int mask = 0;
+	struct slaveirq_dev_data *data =
+		container_of(file->private_data, struct slaveirq_dev_data, dev);
+
+	poll_wait(file, &data->slaveirq_wait, poll);
+	if (data->data_ready)
+		mask |= POLLIN | POLLRDNORM;
+	return mask;
+}
+
+static long slaveirq_ioctl(struct file *file,
+			   unsigned int cmd, unsigned long arg)
+{
+	int retval = 0;
+	int tmp;
+	struct slaveirq_dev_data *data =
+		container_of(file->private_data, struct slaveirq_dev_data, dev);
+
+	switch (cmd) {
+	case SLAVEIRQ_SET_TIMEOUT:
+		data->timeout = arg;
+		break;
+
+	case SLAVEIRQ_GET_INTERRUPT_CNT:
+		tmp = data->data.interruptcount - 1;
+		if (data->data.interruptcount > 1)
+			data->data.interruptcount = 1;
+
+		if (copy_to_user((int *) arg, &tmp, sizeof(int)))
+			return -EFAULT;
+		break;
+	case SLAVEIRQ_GET_IRQ_TIME:
+		if (copy_to_user((int *) arg, &data->data.irqtime,
+				 sizeof(data->data.irqtime)))
+			return -EFAULT;
+		data->data.irqtime = 0;
+		break;
+	default:
+		retval = -EINVAL;
+	}
+	return retval;
+}
+
+static irqreturn_t slaveirq_handler(int irq, void *dev_id)
+{
+	struct slaveirq_dev_data *data = (struct slaveirq_dev_data *)dev_id;
+	static int mycount;
+	struct timeval irqtime;
+	mycount++;
+
+	data->data.interruptcount++;
+
+	
+	
+	data->data_ready = 1;
+
+	do_gettimeofday(&irqtime);
+	data->data.irqtime = (((long long) irqtime.tv_sec) << 32);
+	data->data.irqtime += irqtime.tv_usec;
+	data->data.data_type |= 1;
+
+	wake_up_interruptible(&data->slaveirq_wait);
+
+	return IRQ_HANDLED;
+
+}
+
+static const struct file_operations slaveirq_fops = {
+	.owner = THIS_MODULE,
+	.read = slaveirq_read,
+	.poll = slaveirq_poll,
+
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = slaveirq_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = slaveirq_ioctl,
+#endif
+	.open = slaveirq_open,
+	.release = slaveirq_release,
+};
+
+int slaveirq_init(struct i2c_adapter *slave_adapter,
+		  struct ext_slave_platform_data *pdata,
+		  char *name)
+{
+
+	int res;
+	struct slaveirq_dev_data *data;
+
+	if (!pdata->irq)
+		return -EINVAL;
+
+	pdata->irq_data = kzalloc(sizeof(*data),
+				GFP_KERNEL);
+	data = (struct slaveirq_dev_data *) pdata->irq_data;
+	if (!data)
+		return -ENOMEM;
+
+	data->dev.minor = MISC_DYNAMIC_MINOR;
+	data->dev.name = name;
+	data->dev.fops = &slaveirq_fops;
+	data->irq = pdata->irq;
+	data->pid = 0;
+	data->data_ready = 0;
+	data->timeout = 0;
+
+	init_waitqueue_head(&data->slaveirq_wait);
+
+	res = request_irq(data->irq, slaveirq_handler, IRQF_TRIGGER_RISING,
+			  data->dev.name, data);
+
+	if (res) {
+		dev_err(&slave_adapter->dev,
+			"myirqtest: cannot register IRQ %d\n",
+			data->irq);
+		goto out_request_irq;
+	}
+
+	res = misc_register(&data->dev);
+	if (res < 0) {
+		dev_err(&slave_adapter->dev,
+			"misc_register returned %d\n",
+			res);
+		goto out_misc_register;
+	}
+
+	return res;
+
+out_misc_register:
+	free_irq(data->irq, data);
+out_request_irq:
+	kfree(pdata->irq_data);
+	pdata->irq_data = NULL;
+
+	return res;
+}
+
+void slaveirq_exit(struct ext_slave_platform_data *pdata)
+{
+	struct slaveirq_dev_data *data = pdata->irq_data;
+
+	if (!pdata->irq_data || data->irq <= 0)
+		return;
+
+	dev_info(data->dev.this_device, "Unregistering %s\n",
+		 data->dev.name);
+
+	free_irq(data->irq, data);
+	misc_deregister(&data->dev);
+	kfree(pdata->irq_data);
+	pdata->irq_data = NULL;
+}
diff --git a/drivers/input/misc/mpu3050/slaveirq.h b/drivers/input/misc/mpu3050/slaveirq.h
new file mode 100644
index 0000000..ca9c7e4
--- /dev/null
+++ b/drivers/input/misc/mpu3050/slaveirq.h
@@ -0,0 +1,46 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+#ifndef __SLAVEIRQ__
+#define __SLAVEIRQ__
+
+#ifdef __KERNEL__
+#include <linux/i2c-dev.h>
+#endif
+
+#include "mpu.h"
+#include "mpuirq.h"
+
+#define SLAVEIRQ_ENABLE_DEBUG          (1)
+#define SLAVEIRQ_GET_INTERRUPT_CNT     (2)
+#define SLAVEIRQ_GET_IRQ_TIME          (3)
+#define SLAVEIRQ_GET_LED_VALUE         (4)
+#define SLAVEIRQ_SET_TIMEOUT           (5)
+#define SLAVEIRQ_SET_SLAVE_INFO        (6)
+
+#ifdef __KERNEL__
+
+void slaveirq_exit(struct ext_slave_platform_data *pdata);
+int slaveirq_init(struct i2c_adapter *slave_adapter,
+		struct ext_slave_platform_data *pdata,
+		char *name);
+
+#endif
+
+#endif
diff --git a/drivers/input/misc/mpu3050/timerirq.c b/drivers/input/misc/mpu3050/timerirq.c
new file mode 100644
index 0000000..ce2b153
--- /dev/null
+++ b/drivers/input/misc/mpu3050/timerirq.c
@@ -0,0 +1,316 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/stat.h>
+#include <linux/signal.h>
+#include <linux/miscdevice.h>
+#include <linux/i2c.h>
+#include <linux/i2c-dev.h>
+#include <linux/poll.h>
+
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
+#include <linux/timer.h>
+#include <linux/slab.h>
+
+#include "mpu.h"
+#include "mltypes.h"
+#include "timerirq.h"
+
+struct timerirq_data {
+	int pid;
+	int data_ready;
+	int run;
+	int timeout;
+	unsigned long period;
+	struct mpuirq_data data;
+	struct completion timer_done;
+	wait_queue_head_t timerirq_wait;
+	struct timer_list timer;
+	struct miscdevice *dev;
+};
+
+static struct miscdevice *timerirq_dev_data;
+
+static void timerirq_handler(unsigned long arg)
+{
+	struct timerirq_data *data = (struct timerirq_data *)arg;
+	struct timeval irqtime;
+
+
+	data->data.interruptcount++;
+
+	data->data_ready = 1;
+
+	do_gettimeofday(&irqtime);
+	data->data.irqtime = (((long long) irqtime.tv_sec) << 32);
+	data->data.irqtime += irqtime.tv_usec;
+	data->data.data_type |= 1;
+
+	wake_up_interruptible(&data->timerirq_wait);
+
+	if (data->run)
+		mod_timer(&data->timer,
+			jiffies + msecs_to_jiffies(data->period));
+	else
+		complete(&data->timer_done);
+}
+
+static int start_timerirq(struct timerirq_data *data)
+{
+	dev_dbg(data->dev->this_device,
+		"%s current->pid %d\n", __func__, current->pid);
+
+	
+	if (data->run)
+		return 0;
+
+	
+	if (!data->period)
+		return -EINVAL;
+
+	if (data->period > 200)
+		data->period = 200;
+
+	printk(KERN_DEBUG "[GSNR][MPU3050][TIMERIRQ]%s: data->period = %lu\n",
+		__func__, data->period);
+
+	data->run = TRUE;
+	data->data_ready = FALSE;
+
+	return mod_timer(&data->timer,
+			jiffies + msecs_to_jiffies(data->period));
+}
+
+static int stop_timerirq(struct timerirq_data *data)
+{
+	int rc = -1;
+
+	dev_dbg(data->dev->this_device,
+		"%s current->pid %lx\n", __func__, (unsigned long)data);
+
+	printk(KERN_DEBUG "[GSNR][MPU3050][TIMERIRQ]%s: data->period = %lu, "
+			  "data->run = %d\n",
+			__func__, data->period, data->run);
+
+	if (data->run) {
+		data->run = FALSE;
+		mod_timer(&data->timer, jiffies + 1);
+		wait_for_completion(&data->timer_done);
+
+		rc = del_timer_sync(&(data->timer));
+	}
+	return 0;
+}
+
+static int timerirq_open(struct inode *inode, struct file *file)
+{
+	struct miscdevice *dev_data = file->private_data;
+	struct timerirq_data *data = kzalloc(sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	data->dev = dev_data;
+	file->private_data = data;
+	data->pid = current->pid;
+	init_waitqueue_head(&data->timerirq_wait);
+
+	dev_dbg(data->dev->this_device,
+		"%s current->pid %d\n", __func__, current->pid);
+
+	init_completion(&data->timer_done);
+	setup_timer(&data->timer, timerirq_handler, (unsigned long)data);
+
+	printk(KERN_DEBUG "[TIMERIRQ]%s: current->pid %d\n",
+		__func__, current->pid);
+
+	return 0;
+}
+
+static int timerirq_release(struct inode *inode, struct file *file)
+{
+	struct timerirq_data *data = file->private_data;
+	int rc = -1;
+
+	printk(KERN_DEBUG "[TIMERIRQ] %s: data->run = %d\n",
+				__func__, data->run);
+
+	
+
+	if (data->run)
+		stop_timerirq(data);
+
+	rc = del_timer_sync(&(data->timer));
+	printk(KERN_DEBUG "[TIMERIRQ]%s: del_timer_sync"
+		"() return = %d\n", __func__, rc);
+
+	kfree(data);
+	return 0;
+}
+
+static ssize_t timerirq_read(struct file *file,
+			   char *buf, size_t count, loff_t *ppos)
+{
+	int len, err;
+	struct timerirq_data *data = file->private_data;
+
+	if (!data->data_ready) {
+		wait_event_interruptible_timeout(data->timerirq_wait,
+						 data->data_ready,
+						 data->timeout);
+	}
+
+	if (data->data_ready && NULL != buf
+	    && count >= sizeof(data->data)) {
+		err = copy_to_user(buf, &data->data, sizeof(data->data));
+		data->data.data_type = 0;
+	} else {
+		return 0;
+	}
+	if (err != 0) {
+		dev_err(data->dev->this_device,
+			"Copy to user returned %d\n", err);
+		return -EFAULT;
+	}
+	data->data_ready = 0;
+	len = sizeof(data->data);
+	return len;
+}
+
+unsigned int timerirq_poll(struct file *file, struct poll_table_struct *poll)
+{
+	int mask = 0;
+	struct timerirq_data *data = file->private_data;
+
+	poll_wait(file, &data->timerirq_wait, poll);
+	if (data->data_ready)
+		mask |= POLLIN | POLLRDNORM;
+	return mask;
+}
+
+static long timerirq_ioctl(struct file *file,
+			   unsigned int cmd, unsigned long arg)
+{
+	int retval = 0;
+	int tmp;
+	struct timerirq_data *data = file->private_data;
+
+	dev_dbg(data->dev->this_device,
+		"%s current->pid %d, %d, %ld\n",
+		__func__, current->pid, cmd, arg);
+
+	if (!data)
+		return -EFAULT;
+
+	switch (cmd) {
+	case TIMERIRQ_SET_TIMEOUT:
+		data->timeout = arg;
+		break;
+	case TIMERIRQ_GET_INTERRUPT_CNT:
+		tmp = data->data.interruptcount - 1;
+		if (data->data.interruptcount > 1)
+			data->data.interruptcount = 1;
+
+		if (copy_to_user((int *) arg, &tmp, sizeof(int)))
+			return -EFAULT;
+		break;
+	case TIMERIRQ_START:
+		data->period = arg;
+		retval = start_timerirq(data);
+		break;
+	case TIMERIRQ_STOP:
+		retval = stop_timerirq(data);
+		break;
+	default:
+		retval = -EINVAL;
+	}
+	return retval;
+}
+
+static const struct file_operations timerirq_fops = {
+	.owner = THIS_MODULE,
+	.read = timerirq_read,
+	.poll = timerirq_poll,
+
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = timerirq_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = timerirq_ioctl,
+#endif
+	.open = timerirq_open,
+	.release = timerirq_release,
+};
+
+static int __init timerirq_init(void)
+{
+
+	int res;
+	static struct miscdevice *data;
+
+	data = kzalloc(sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+	timerirq_dev_data = data;
+	data->minor = MISC_DYNAMIC_MINOR;
+	data->name = "timerirq";
+	data->fops = &timerirq_fops;
+
+	res = misc_register(data);
+	if (res < 0) {
+		dev_err(data->this_device,
+			"misc_register returned %d\n",
+			res);
+		return res;
+	}
+
+	return res;
+}
+module_init(timerirq_init);
+
+static void __exit timerirq_exit(void)
+{
+	struct miscdevice *data = timerirq_dev_data;
+
+	dev_info(data->this_device, "Unregistering %s\n",
+		 data->name);
+
+	printk(KERN_DEBUG "[TIMERIRQ]%s: Unregistering %s\n",
+		__func__, data->name);
+
+	misc_deregister(data);
+	kfree(data);
+
+	timerirq_dev_data = NULL;
+}
+module_exit(timerirq_exit);
+
+MODULE_AUTHOR("Invensense Corporation");
+MODULE_DESCRIPTION("Timer IRQ device driver.");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("timerirq");
diff --git a/drivers/input/misc/mpu3050/timerirq.h b/drivers/input/misc/mpu3050/timerirq.h
new file mode 100644
index 0000000..a38b490
--- /dev/null
+++ b/drivers/input/misc/mpu3050/timerirq.h
@@ -0,0 +1,28 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+#ifndef __TIMERIRQ__
+#define __TIMERIRQ__
+
+#define TIMERIRQ_SET_TIMEOUT           (5)
+#define TIMERIRQ_GET_INTERRUPT_CNT     (7)
+#define TIMERIRQ_START                 (8)
+#define TIMERIRQ_STOP                  (9)
+
+#endif
diff --git a/drivers/input/misc/r3gd20.c b/drivers/input/misc/r3gd20.c
new file mode 100644
index 0000000..fc638f0
--- /dev/null
+++ b/drivers/input/misc/r3gd20.c
@@ -0,0 +1,1970 @@
+/******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
+*
+* File Name		: r3gd20_gyr_sysfs.c
+* Authors		: MH - C&I BU - Application Team
+*			: Carmine Iascone (carmine.iascone@st.com)
+*			: Matteo Dameno (matteo.dameno@st.com)
+*			: Both authors are willing to be considered the contact
+*			: and update points for the driver.
+* Version		: V 1.1.5 sysfs
+* Date			: 2011/Sep/24
+* Description		: R3GD20 digital output gyroscope sensor API
+*
+********************************************************************************
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2 as
+* published by the Free Software Foundation.
+*
+* THE PRESENT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES
+* OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, FOR THE SOLE
+* PURPOSE TO SUPPORT YOUR APPLICATION DEVELOPMENT.
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+*
+********************************************************************************
+* REVISON HISTORY
+*
+* VERSION	| DATE		| AUTHORS		| DESCRIPTION
+* 1.0		| 2010/May/02	| Carmine Iascone	| First Release
+* 1.1.3		| 2011/Jun/24	| Matteo Dameno		| Corrects ODR Bug
+* 1.1.4		| 2011/Sep/02	| Matteo Dameno		| SMB Bus Mng,
+* 		|		|			| forces BDU setting
+* 1.1.5		| 2011/Sep/24	| Matteo Dameno		| Introduces FIFO Feat.
+* 1.1.5.1 | 2011/Nov/6  | Morris Chen     | change name from l3g to r3g
+*                                         | change default FS to 2000DPS
+*                                         | change default poll_rate to 50ms
+*                                         | chage the attribute of sysfs file as 666
+*******************************************************************************/
+
+#include <linux/i2c.h>
+#include <linux/mutex.h>
+#include <linux/input-polldev.h>
+#include <linux/interrupt.h>
+#include <linux/gpio.h>
+#include <linux/slab.h>
+
+#include <linux/r3gd20.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/module.h>
+
+#define D(x...) printk(KERN_DEBUG "[GYRO][R3GD20] " x)
+#define I(x...) printk(KERN_INFO "[GYRO][R3GD20] " x)
+#define E(x...) printk(KERN_ERR "[GYRO][R3GD20 ERROR] " x)
+#define DIF(x...) \
+	if (debug_flag) \
+		printk(KERN_DEBUG "[GYRO][R3GD20 DEBUG] " x)
+
+#define FS_MAX			32768
+
+#define WHO_AM_I        0x0F
+
+#define CTRL_REG1       0x20    
+#define CTRL_REG2       0x21    
+#define CTRL_REG3       0x22    
+#define CTRL_REG4       0x23    
+#define CTRL_REG5       0x24    
+#define	REFERENCE	0x25    
+#define	FIFO_CTRL_REG	0x2E    
+#define FIFO_SRC_REG	0x2F    
+#define	OUT_X_L		0x28    
+
+#define AXISDATA_REG	OUT_X_L
+
+#define ALL_ZEROES	0x00
+#define PM_OFF		0x00
+#define PM_NORMAL	0x08
+#define ENABLE_ALL_AXES	0x07
+#define ENABLE_NO_AXES	0x00
+#define BW00		0x00
+#define BW01		0x10
+#define BW10		0x20
+#define BW11		0x30
+#define ODR095		0x00  
+#define ODR190		0x40  
+#define ODR380		0x80  
+#define ODR760		0xC0  
+
+#define	I2_DRDY		0x08
+#define	I2_WTM		0x04
+#define	I2_OVRUN	0x02
+#define	I2_EMPTY	0x01
+#define	I2_NONE		0x00
+#define	I2_MASK		0x0F
+
+#define	FS_MASK				0x30
+#define	BDU_ENABLE			0x80
+
+#define	FIFO_ENABLE	0x40
+#define HPF_ENALBE	0x11
+
+#define	FIFO_MODE_MASK		0xE0
+#define	FIFO_MODE_BYPASS	0x00
+#define	FIFO_MODE_FIFO		0x20
+#define	FIFO_MODE_STREAM	0x40
+#define	FIFO_MODE_STR2FIFO	0x60
+#define	FIFO_MODE_BYPASS2STR	0x80
+#define	FIFO_WATERMARK_MASK	0x1F
+
+#define FIFO_STORED_DATA_MASK	0x1F
+
+
+#define FUZZ			0
+#define FLAT			0
+#define I2C_AUTO_INCREMENT		0x80
+
+#define	RES_CTRL_REG1		0
+#define	RES_CTRL_REG2		1
+#define	RES_CTRL_REG3		2
+#define	RES_CTRL_REG4		3
+#define	RES_CTRL_REG5		4
+#define	RES_FIFO_CTRL_REG	5
+#define	RESUME_ENTRIES		6
+
+#define TOLERENCE		1071
+
+#define DEBUG 0
+
+#define HTC_WQ 1
+#define HTC_SUSPEND 1
+#define HTC_ATTR 1
+
+#define HW_WAKE_UP_TIME 160
+
+#define WHOAMI_R3GD20		0x00D4	
+
+
+struct r3gd20_triple {
+	short	x,	
+		y,	
+		z;	
+};
+
+struct output_rate {
+	int poll_rate_ms;
+	u8 mask;
+};
+
+static const struct output_rate odr_table[] = {
+
+	{	2,	ODR760|BW10},
+	{	3,	ODR380|BW01},
+	{	6,	ODR190|BW00},
+	{	11,	ODR095|BW00},
+};
+
+static int use_smbus;
+
+static const struct r3gd20_gyr_platform_data default_r3gd20_gyr_pdata = {
+	.fs_range = R3GD20_GYR_FS_2000DPS,
+	.axis_map_x = 0,
+	.axis_map_y = 1,
+	.axis_map_z = 2,
+	.negate_x = 0,
+	.negate_y = 0,
+	.negate_z = 0,
+
+	.poll_interval = 50,
+	.min_interval = R3GD20_MIN_POLL_PERIOD_MS, 
+
+	
+			
+
+	.watermark = 0,
+	.fifomode = 0,
+};
+
+#ifdef HTC_WQ
+static void polling_do_work(struct work_struct *w);
+static DECLARE_DELAYED_WORK(polling_work, polling_do_work);
+#endif 
+
+struct r3gd20_data {
+	struct i2c_client *client;
+	struct r3gd20_gyr_platform_data *pdata;
+
+	struct mutex lock;
+
+	struct input_polled_dev *input_poll_dev;
+	int hw_initialized;
+
+	atomic_t enabled;
+
+	u8 reg_addr;
+	u8 resume_state[RESUME_ENTRIES];
+
+	int irq2;
+	struct work_struct irq2_work;
+	struct workqueue_struct *irq2_work_queue;
+
+	bool polling_enabled;
+#ifdef HTC_WQ
+	struct workqueue_struct *gyro_wq;
+	struct input_dev *gyro_input_dev;
+#endif 
+
+#ifdef HTC_ATTR
+	struct class *htc_gyro_class;
+	struct device *gyro_dev;
+#endif 
+	int cali_data_x;
+	int cali_data_y;
+	int cali_data_z;
+};
+
+#ifdef HTC_WQ
+struct r3gd20_data *g_gyro;
+#endif 
+
+static int debug_flag;
+
+static int r3gd20_i2c_read(struct r3gd20_data *gyr,
+				u8 *buf, int len)
+{
+	int ret;
+	u8 reg = buf[0];
+	u8 cmd = reg;
+
+
+	if (use_smbus) {
+		if (len == 1) {
+			ret = i2c_smbus_read_byte_data(gyr->client, cmd);
+			buf[0] = ret & 0xff;
+#if DEBUG
+			dev_warn(&gyr->client->dev,
+				"i2c_smbus_read_byte_data: ret=0x%02x, len:%d ,"
+				"command=0x%02x, buf[0]=0x%02x\n",
+				ret, len, cmd , buf[0]);
+#endif
+		} else if (len > 1) {
+			
+			ret = i2c_smbus_read_i2c_block_data(gyr->client,
+								cmd, len, buf);
+#if DEBUG
+			dev_warn(&gyr->client->dev,
+				"i2c_smbus_read_i2c_block_data: ret:%d len:%d, "
+				"command=0x%02x, ",
+				ret, len, cmd);
+
+			unsigned int ii;
+			for (ii = 0; ii < len; ii++)
+				D("buf[%d]=0x%02x,", ii, buf[ii]);
+
+			D("\n");
+#endif
+		} else
+			ret = -1;
+
+		if (ret < 0) {
+			dev_err(&gyr->client->dev,
+				"read transfer error: len:%d, command=0x%02x\n",
+				len, cmd);
+			return 0; 
+		}
+		return len; 
+	}
+
+	
+	ret = i2c_master_send(gyr->client, &cmd, sizeof(cmd));
+	if (ret != sizeof(cmd))
+		return ret;
+
+	return i2c_master_recv(gyr->client, buf, len);
+}
+
+static int r3gd20_i2c_write(struct r3gd20_data *gyr, u8 *buf, int len)
+{
+	int ret;
+	u8 reg, value;
+
+	reg = buf[0];
+	value = buf[1];
+
+	if (use_smbus) {
+		if (len == 1) {
+			ret = i2c_smbus_write_byte_data(gyr->client, reg, value);
+#if DEBUG
+			dev_warn(&gyr->client->dev,
+				"i2c_smbus_write_byte_data: ret=%d, len:%d, "
+				"command=0x%02x, value=0x%02x\n",
+				ret, len, reg , value);
+#endif
+			return ret;
+		} else if (len > 1) {
+			ret = i2c_smbus_write_i2c_block_data(gyr->client,
+							reg, len, buf + 1);
+#if DEBUG
+			dev_warn(&gyr->client->dev,
+				"i2c_smbus_write_i2c_block_data: ret=%d, "
+				"len:%d, command=0x%02x, ",
+				ret, len, reg);
+			unsigned int ii;
+			for (ii = 0; ii < (len + 1); ii++)
+				D("value[%d]=0x%02x,", ii, buf[ii]);
+
+			D("\n");
+#endif
+			return ret;
+		}
+	}
+
+	ret = i2c_master_send(gyr->client, buf, len+1);
+	return (ret == len+1) ? 0 : ret;
+}
+
+
+static int r3gd20_register_write(struct r3gd20_data *gyro, u8 *buf,
+		u8 reg_address, u8 new_value)
+{
+	int err;
+
+		buf[0] = reg_address;
+		buf[1] = new_value;
+		err = r3gd20_i2c_write(gyro, buf, 1);
+		if (err < 0)
+			return err;
+
+	return err;
+}
+
+static int r3gd20_register_read(struct r3gd20_data *gyro, u8 *buf,
+		u8 reg_address)
+{
+
+	int err = -1;
+	buf[0] = (reg_address);
+	err = r3gd20_i2c_read(gyro, buf, 1);
+	return err;
+}
+
+static int r3gd20_register_update(struct r3gd20_data *gyro, u8 *buf,
+		u8 reg_address, u8 mask, u8 new_bit_values)
+{
+	int err = -1;
+	u8 init_val;
+	u8 updated_val;
+	err = r3gd20_register_read(gyro, buf, reg_address);
+	if (!(err < 0)) {
+		init_val = buf[0];
+		updated_val = ((mask & new_bit_values) | ((~mask) & init_val));
+		err = r3gd20_register_write(gyro, buf, reg_address,
+				updated_val);
+	}
+	return err;
+}
+
+#if 1
+static int r3gd20_update_watermark(struct r3gd20_data *gyro,
+								u8 watermark)
+{
+	int res = 0;
+	u8 buf[2];
+	u8 new_value;
+
+	mutex_lock(&gyro->lock);
+	new_value = (watermark % 0x20);
+	res = r3gd20_register_update(gyro, buf, FIFO_CTRL_REG,
+			 FIFO_WATERMARK_MASK, new_value);
+	if (res < 0) {
+		E("%s : failed to update watermark\n", __func__);
+		return res;
+	}
+	E("%s : new_value:0x%02x,watermark:0x%02x\n",
+			__func__, new_value, watermark);
+
+	gyro->resume_state[RES_FIFO_CTRL_REG] =
+		((FIFO_WATERMARK_MASK & new_value) |
+		(~FIFO_WATERMARK_MASK &
+				gyro->resume_state[RES_FIFO_CTRL_REG]));
+	gyro->pdata->watermark = new_value;
+	mutex_unlock(&gyro->lock);
+	return res;
+}
+
+static int r3gd20_update_fifomode(struct r3gd20_data *gyro, u8 fifomode)
+{
+	int res;
+	u8 buf[2];
+	u8 new_value;
+
+	new_value = fifomode;
+	res = r3gd20_register_update(gyro, buf, FIFO_CTRL_REG,
+					FIFO_MODE_MASK, new_value);
+	if (res < 0) {
+		E("%s : failed to update fifoMode\n", __func__);
+		return res;
+	}
+	gyro->resume_state[RES_FIFO_CTRL_REG] =
+		((FIFO_MODE_MASK & new_value) |
+		(~FIFO_MODE_MASK &
+				gyro->resume_state[RES_FIFO_CTRL_REG]));
+	gyro->pdata->fifomode = new_value;
+
+	return res;
+}
+
+static int r3gd20_fifo_reset(struct r3gd20_data *gyro)
+{
+	u8 oldmode;
+	int res;
+
+	oldmode = gyro->pdata->fifomode;
+	res = r3gd20_update_fifomode(gyro, FIFO_MODE_BYPASS);
+	if (res < 0)
+		return res;
+	res = r3gd20_update_fifomode(gyro, oldmode);
+	if (res >= 0)
+		I("%s : fifo reset to: 0x%02x\n", __func__, oldmode);
+	return res;
+}
+
+static int r3gd20_fifo_hwenable(struct r3gd20_data *gyro,
+								u8 enable)
+{
+	int res;
+	u8 buf[2];
+	u8 set = 0x00;
+	if (enable)
+		set = FIFO_ENABLE;
+	res = r3gd20_register_update(gyro, buf, CTRL_REG5,
+			FIFO_ENABLE, set);
+	if (res < 0) {
+		E("%s : fifo_hw switch to:0x%02x failed\n", __func__, set);
+		return res;
+	}
+	gyro->resume_state[RES_CTRL_REG5] =
+		((FIFO_ENABLE & set) |
+		(~FIFO_ENABLE & gyro->resume_state[RES_CTRL_REG5]));
+	I("%s : fifo_hw_enable set to:0x%02x\n", __func__, set);
+	return res;
+}
+
+static int r3gd20_manage_int2settings(struct r3gd20_data *gyro,
+								u8 fifomode)
+{
+	int res;
+	u8 buf[2];
+	bool enable_fifo_hw;
+	bool recognized_mode = false;
+	u8 int2bits = I2_NONE;
+
+
+	switch (fifomode) {
+	case FIFO_MODE_FIFO:
+
+		recognized_mode = true;
+		int2bits = (I2_WTM | I2_OVRUN);
+		res = r3gd20_register_update(gyro, buf, CTRL_REG3,
+					I2_MASK, int2bits);
+		if (res < 0) {
+			E("%s : failed to update CTRL_REG3:0x%02x\n",
+				__func__, fifomode);
+			goto err_mutex_unlock;
+		}
+		gyro->resume_state[RES_CTRL_REG3] =
+			((I2_MASK & int2bits) |
+			(~(I2_MASK) & gyro->resume_state[RES_CTRL_REG3]));
+		enable_fifo_hw = true;
+		break;
+
+	case FIFO_MODE_BYPASS:
+		recognized_mode = true;
+
+		if (gyro->polling_enabled)
+			int2bits = I2_NONE;
+		else
+			int2bits = I2_DRDY;
+		res = r3gd20_register_update(gyro, buf, CTRL_REG3,
+					I2_MASK, int2bits);
+		if (res < 0) {
+			E("%s : failed to update to CTRL_REG3:0x%02x\n",
+				__func__, fifomode);
+			goto err_mutex_unlock;
+		}
+		gyro->resume_state[RES_CTRL_REG3] =
+			((I2_MASK & int2bits) |
+			(~I2_MASK & gyro->resume_state[RES_CTRL_REG3]));
+		enable_fifo_hw = false;
+		break;
+	default:
+		recognized_mode = false;
+		res = r3gd20_register_update(gyro, buf, CTRL_REG3,
+					I2_MASK, I2_NONE);
+		if (res < 0) {
+			E("%s : failed to update CTRL_REG3:0x%02x\n",
+				__func__, fifomode);
+			goto err_mutex_unlock;
+		}
+		enable_fifo_hw = false;
+		gyro->resume_state[RES_CTRL_REG3] =
+			((I2_MASK & 0x00) |
+			(~I2_MASK & gyro->resume_state[RES_CTRL_REG3]));
+		break;
+
+	}
+	if (recognized_mode) {
+		res = r3gd20_update_fifomode(gyro, fifomode);
+		if (res < 0) {
+			E("%s : failed to set fifoMode\n", __func__);
+			goto err_mutex_unlock;
+		}
+	}
+	res = r3gd20_fifo_hwenable(gyro, enable_fifo_hw);
+
+err_mutex_unlock:
+
+	return res;
+}
+
+#endif
+static int r3gd20_update_fs_range(struct r3gd20_data *gyro,
+							u8 new_fs)
+{
+	int res ;
+	u8 buf[2];
+
+	buf[0] = CTRL_REG4;
+
+	res = r3gd20_register_update(gyro, buf, CTRL_REG4,
+							FS_MASK, new_fs);
+
+	if (res < 0) {
+		E("%s : failed to update fs:0x%02x\n",
+			__func__, new_fs);
+		return res;
+	}
+	gyro->resume_state[RES_CTRL_REG4] =
+		((FS_MASK & new_fs) |
+		(~FS_MASK & gyro->resume_state[RES_CTRL_REG4]));
+
+	return res;
+}
+
+
+static int r3gd20_update_odr(struct r3gd20_data *gyro,
+			unsigned int poll_interval_ms)
+{
+	int err = -1;
+	int i;
+	u8 config[2];
+
+	for (i = ARRAY_SIZE(odr_table) - 1; i >= 0; i--) {
+		if ((odr_table[i].poll_rate_ms <= poll_interval_ms) || (i == 0))
+			break;
+	}
+
+	config[1] = odr_table[i].mask;
+	config[1] |= (ENABLE_ALL_AXES + PM_NORMAL);
+
+	if (atomic_read(&gyro->enabled)) {
+		config[0] = CTRL_REG1;
+		err = r3gd20_i2c_write(gyro, config, 1);
+		if (err < 0)
+			return err;
+		gyro->resume_state[RES_CTRL_REG1] = config[1];
+	}
+
+
+	return err;
+}
+
+static int r3gd20_get_data(struct r3gd20_data *gyro,
+			     struct r3gd20_triple *data)
+{
+	int err;
+	unsigned char gyro_out[6];
+	
+	s16 hw_d[3] = { 0 };
+
+	gyro_out[0] = (I2C_AUTO_INCREMENT | AXISDATA_REG);
+
+	err = r3gd20_i2c_read(gyro, gyro_out, 6);
+
+	if (err < 0)
+		return err;
+
+	hw_d[0] = (s16) (((gyro_out[1]) << 8) | gyro_out[0]);
+	hw_d[1] = (s16) (((gyro_out[3]) << 8) | gyro_out[2]);
+	hw_d[2] = (s16) (((gyro_out[5]) << 8) | gyro_out[4]);
+
+	data->x = ((gyro->pdata->negate_x) ? (-hw_d[gyro->pdata->axis_map_x])
+		   : (hw_d[gyro->pdata->axis_map_x]));
+	data->y = ((gyro->pdata->negate_y) ? (-hw_d[gyro->pdata->axis_map_y])
+		   : (hw_d[gyro->pdata->axis_map_y]));
+	data->z = ((gyro->pdata->negate_z) ? (-hw_d[gyro->pdata->axis_map_z])
+		   : (hw_d[gyro->pdata->axis_map_z]));
+
+	DIF("gyro_out: x = %d, y = %d, z = %d\n",
+		data->x, data->y, data->z);
+
+	return err;
+}
+
+static void r3gd20_report_values(struct r3gd20_data *gyr,
+						struct r3gd20_triple *data)
+{
+	struct input_dev *input = gyr->input_poll_dev->input;
+
+#ifdef HTC_WQ
+	input = g_gyro->gyro_input_dev;
+#endif 
+
+	input_report_abs(input, ABS_X, data->x);
+	input_report_abs(input, ABS_Y, data->y);
+	input_report_abs(input, ABS_Z, data->z);
+	input_sync(input);
+}
+
+#ifdef HTC_WQ
+static void polling_do_work(struct work_struct *w)
+{
+	struct r3gd20_data *gyro = g_gyro;
+	struct r3gd20_triple data_out;
+	int err;
+
+	mutex_lock(&gyro->lock);
+	err = r3gd20_get_data(gyro, &data_out);
+	if (err < 0)
+		dev_err(&gyro->client->dev, "get_gyroscope_data failed\n");
+	else
+		r3gd20_report_values(gyro, &data_out);
+
+	mutex_unlock(&gyro->lock);
+
+	DIF("interval = %d\n", gyro->input_poll_dev->
+					 poll_interval);
+
+	queue_delayed_work(gyro->gyro_wq, &polling_work,
+		msecs_to_jiffies(gyro->input_poll_dev->
+					 poll_interval));
+}
+#endif 
+
+static int r3gd20_hw_init(struct r3gd20_data *gyro)
+{
+	int err;
+	u8 buf[6];
+
+	I("%s hw init\n", R3GD20_GYR_DEV_NAME);
+
+	buf[0] = (I2C_AUTO_INCREMENT | CTRL_REG1);
+	buf[1] = gyro->resume_state[RES_CTRL_REG1];
+	buf[2] = gyro->resume_state[RES_CTRL_REG2];
+	buf[3] = gyro->resume_state[RES_CTRL_REG3];
+	buf[4] = gyro->resume_state[RES_CTRL_REG4];
+	buf[5] = gyro->resume_state[RES_CTRL_REG5];
+
+	err = r3gd20_i2c_write(gyro, buf, 5);
+	if (err < 0)
+		return err;
+
+	buf[0] = FIFO_CTRL_REG;
+	buf[1] = gyro->resume_state[RES_FIFO_CTRL_REG];
+	err = r3gd20_i2c_write(gyro, buf, 1);
+	if (err < 0)
+			return err;
+
+	gyro->hw_initialized = 1;
+
+	return err;
+}
+
+static void r3gd20_device_power_off(struct r3gd20_data *dev_data)
+{
+	int err;
+	u8 buf[2];
+
+	I("%s:\n", __func__);
+
+	buf[0] = CTRL_REG1;
+	buf[1] = PM_OFF;
+	err = r3gd20_i2c_write(dev_data, buf, 1);
+	if (err < 0)
+		dev_err(&dev_data->client->dev, "soft power off failed\n");
+
+	if (dev_data->pdata->power_off) {
+		
+		disable_irq_nosync(dev_data->irq2);
+		dev_data->pdata->power_off();
+		dev_data->hw_initialized = 0;
+	}
+
+	if (dev_data->hw_initialized) {
+		
+		
+		if (dev_data->pdata->gpio_int2 > 0) {
+			disable_irq_nosync(dev_data->irq2);
+			I("%s: power off: irq2 disabled\n",
+						R3GD20_GYR_DEV_NAME);
+		}
+		dev_data->hw_initialized = 0;
+	}
+}
+
+static int r3gd20_device_power_on(struct r3gd20_data *dev_data)
+{
+	int err;
+
+	if (dev_data->pdata->power_on) {
+		err = dev_data->pdata->power_on();
+		if (err < 0)
+			return err;
+		if (dev_data->pdata->gpio_int2 > 0)
+			enable_irq(dev_data->irq2);
+	}
+
+
+	if (!dev_data->hw_initialized) {
+		err = r3gd20_hw_init(dev_data);
+		if (err < 0) {
+			r3gd20_device_power_off(dev_data);
+			return err;
+		}
+	}
+
+	if (dev_data->hw_initialized) {
+		D("dev_data->pdata->gpio_int2 = %d\n", dev_data->pdata->gpio_int2);
+		if (dev_data->pdata->gpio_int2 > 0) {
+			enable_irq(dev_data->irq2);
+			I("%s: power on: irq2 enabled\n",
+						R3GD20_GYR_DEV_NAME);
+		}
+	}
+
+	return 0;
+}
+
+static int r3gd20_enable(struct r3gd20_data *dev_data)
+{
+	int err;
+
+	D("%s: enabled = %d\n", __func__, atomic_read(&dev_data->enabled));
+
+	if (!atomic_cmpxchg(&dev_data->enabled, 0, 1)) {
+		if (dev_data->pdata->power_LPM)
+			dev_data->pdata->power_LPM(0);
+
+		err = r3gd20_device_power_on(dev_data);
+		if (err < 0) {
+			atomic_set(&dev_data->enabled, 0);
+			return err;
+		}
+#ifdef HTC_WQ
+		D("Manually queue work!! HW_WAKE_UP_TIME = %d\n",
+			HW_WAKE_UP_TIME);
+		queue_delayed_work(dev_data->gyro_wq, &polling_work,
+			msecs_to_jiffies(HW_WAKE_UP_TIME));
+#else
+		D("%s: queue work: interval = %d\n",
+				__func__, dev_data->input_poll_dev->poll_interval);
+		schedule_delayed_work(&dev_data->input_poll_dev->work,
+				      msecs_to_jiffies(dev_data->input_poll_dev->poll_interval));
+#endif 
+	}
+
+	return 0;
+}
+
+static int r3gd20_disable(struct r3gd20_data *dev_data)
+{
+	DIF("%s: dev_data->enabled = %d\n", __func__,
+		atomic_read(&dev_data->enabled));
+
+	if (atomic_cmpxchg(&dev_data->enabled, 1, 0))
+		r3gd20_device_power_off(dev_data);
+
+	I("%s: polling disabled\n", __func__);
+	DIF("%s: dev_data->enabled = %d\n", __func__,
+		atomic_read(&dev_data->enabled));
+
+	if (dev_data->pdata->power_LPM)
+		dev_data->pdata->power_LPM(1);
+
+#ifdef HTC_WQ
+	cancel_delayed_work_sync(&polling_work);
+#else
+	cancel_delayed_work_sync(&dev_data->input_poll_dev->work);
+#endif 
+
+	return 0;
+}
+
+static ssize_t attr_polling_rate_show(struct device *dev,
+				     struct device_attribute *attr,
+				     char *buf)
+{
+	int val;
+	
+	struct r3gd20_data *gyro = g_gyro;
+
+	mutex_lock(&gyro->lock);
+	val = gyro->input_poll_dev->poll_interval;
+	mutex_unlock(&gyro->lock);
+	return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t attr_polling_rate_store(struct device *dev,
+				     struct device_attribute *attr,
+				     const char *buf, size_t size)
+{
+	
+	struct r3gd20_data *gyro = g_gyro;
+	unsigned long interval_ms;
+
+	if (strict_strtoul(buf, 10, &interval_ms))
+		return -EINVAL;
+	if (!interval_ms)
+		return -EINVAL;
+	interval_ms = max((unsigned int)interval_ms, gyro->pdata->min_interval);
+	mutex_lock(&gyro->lock);
+	gyro->input_poll_dev->poll_interval = interval_ms;
+	gyro->pdata->poll_interval = interval_ms;
+	D("r3gd20: %s: gyro->input_poll_dev->poll_interval = %d\n", __func__, gyro->input_poll_dev->poll_interval);
+	r3gd20_update_odr(gyro, interval_ms);
+	mutex_unlock(&gyro->lock);
+	return size;
+}
+
+static ssize_t attr_range_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	
+	struct r3gd20_data *gyro = g_gyro;
+	int range = 0;
+	u8 val;
+	mutex_lock(&gyro->lock);
+	val = gyro->pdata->fs_range;
+
+	switch (val) {
+	case R3GD20_GYR_FS_250DPS:
+		range = 250;
+		break;
+	case R3GD20_GYR_FS_500DPS:
+		range = 500;
+		break;
+	case R3GD20_GYR_FS_2000DPS:
+		range = 2000;
+		break;
+	}
+	mutex_unlock(&gyro->lock);
+	
+	return sprintf(buf, "%d\n", range);
+}
+
+static ssize_t attr_range_store(struct device *dev,
+			      struct device_attribute *attr,
+			      const char *buf, size_t size)
+{
+	
+	struct r3gd20_data *gyro = g_gyro;
+	unsigned long val;
+	if (strict_strtoul(buf, 10, &val))
+		return -EINVAL;
+	mutex_lock(&gyro->lock);
+	gyro->pdata->fs_range = val;
+	r3gd20_update_fs_range(gyro, val);
+	mutex_unlock(&gyro->lock);
+	return size;
+}
+
+static ssize_t attr_enable_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	
+	struct r3gd20_data *gyro = g_gyro;
+	int val = atomic_read(&gyro->enabled);
+
+	return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t attr_enable_store(struct device *dev,
+			       struct device_attribute *attr,
+			       const char *buf, size_t size)
+{
+	
+	struct r3gd20_data *gyro = g_gyro;
+	unsigned long val;
+
+	DIF("%s: buf = %s", __func__, buf);
+
+	if (strict_strtoul(buf, 10, &val))
+		return -EINVAL;
+
+	if (val)
+		r3gd20_enable(gyro);
+	else
+		r3gd20_disable(gyro);
+
+	return size;
+}
+
+static ssize_t attr_polling_mode_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	int val = 0;
+	
+	struct r3gd20_data *gyro = g_gyro;
+
+	mutex_lock(&gyro->lock);
+	if (gyro->polling_enabled)
+		val = 1;
+	mutex_unlock(&gyro->lock);
+	return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t attr_polling_mode_store(struct device *dev,
+			       struct device_attribute *attr,
+			       const char *buf, size_t size)
+{
+	
+	struct r3gd20_data *gyro = g_gyro;
+	unsigned long val;
+
+	if (strict_strtoul(buf, 10, &val))
+		return -EINVAL;
+
+	mutex_lock(&gyro->lock);
+	if (val) {
+		gyro->polling_enabled = true;
+		r3gd20_manage_int2settings(gyro, FIFO_MODE_BYPASS);
+		if (gyro->polling_enabled) {
+			D("polling enabled\n");
+#ifdef HTC_WQ
+			queue_delayed_work(gyro->gyro_wq, &polling_work,
+					   msecs_to_jiffies(gyro->input_poll_dev->
+					   poll_interval));
+#else
+			schedule_delayed_work(&gyro->input_poll_dev->work,
+					msecs_to_jiffies(gyro->
+							pdata->poll_interval));
+#endif 
+		}
+	} else {
+		if (gyro->polling_enabled) {
+			D("polling disabled\n");
+#ifdef HTC_WQ
+			cancel_delayed_work_sync(&polling_work);
+#else
+			cancel_delayed_work_sync(&gyro->input_poll_dev->work);
+#endif 
+		}
+		gyro->polling_enabled = false;
+		r3gd20_manage_int2settings(gyro, gyro->pdata->fifomode);
+	}
+	mutex_unlock(&gyro->lock);
+	return size;
+}
+
+static ssize_t attr_watermark_store(struct device *dev,
+				     struct device_attribute *attr,
+				     const char *buf, size_t size)
+{
+	
+	struct r3gd20_data *gyro = g_gyro;
+	unsigned long watermark;
+	int res;
+
+	if (strict_strtoul(buf, 16, &watermark))
+		return -EINVAL;
+
+	res = r3gd20_update_watermark(gyro, watermark);
+	if (res < 0)
+		return res;
+
+	return size;
+}
+
+static ssize_t attr_watermark_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	
+	struct r3gd20_data *gyro = g_gyro;
+	int val = gyro->pdata->watermark;
+	return sprintf(buf, "0x%02x\n", val);
+}
+
+static ssize_t attr_fifomode_store(struct device *dev,
+				     struct device_attribute *attr,
+				     const char *buf, size_t size)
+{
+	
+	struct r3gd20_data *gyro = g_gyro;
+	unsigned long fifomode;
+	int res;
+
+	if (strict_strtoul(buf, 16, &fifomode))
+		return -EINVAL;
+
+	D("%s, got value:0x%02x\n", __func__, (u8)fifomode);
+
+	mutex_lock(&gyro->lock);
+	res = r3gd20_manage_int2settings(gyro, (u8) fifomode);
+	mutex_unlock(&gyro->lock);
+
+	if (res < 0)
+		return res;
+	return size;
+}
+
+static ssize_t attr_fifomode_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	
+	struct r3gd20_data *gyro = g_gyro;
+	u8 val = gyro->pdata->fifomode;
+	return sprintf(buf, "0x%02x\n", val);
+}
+
+#ifdef DEBUG
+static ssize_t attr_reg_set(struct device *dev, struct device_attribute *attr,
+				const char *buf, size_t size)
+{
+	int rc;
+	
+	struct r3gd20_data *gyro = g_gyro;
+	u8 x[2];
+	unsigned long val;
+
+	if (strict_strtoul(buf, 16, &val))
+		return -EINVAL;
+	mutex_lock(&gyro->lock);
+	x[0] = gyro->reg_addr;
+	mutex_unlock(&gyro->lock);
+	x[1] = val;
+	rc = r3gd20_i2c_write(gyro, x, 1);
+	return size;
+}
+
+static ssize_t attr_reg_get(struct device *dev, struct device_attribute *attr,
+				char *buf)
+{
+	ssize_t ret;
+	
+	struct r3gd20_data *gyro = g_gyro;
+	int rc;
+	u8 data;
+
+	mutex_lock(&gyro->lock);
+	data = gyro->reg_addr;
+	mutex_unlock(&gyro->lock);
+	rc = r3gd20_i2c_read(gyro, &data, 1);
+	ret = sprintf(buf, "0x%02x\n", data);
+	return ret;
+}
+
+static ssize_t attr_addr_set(struct device *dev, struct device_attribute *attr,
+				const char *buf, size_t size)
+{
+	
+	struct r3gd20_data *gyro = g_gyro;
+	unsigned long val;
+
+	if (strict_strtoul(buf, 16, &val))
+		return -EINVAL;
+
+	mutex_lock(&gyro->lock);
+
+	gyro->reg_addr = val;
+
+	mutex_unlock(&gyro->lock);
+
+	return size;
+}
+#endif 
+
+static ssize_t attr_debug_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+
+	s += sprintf(s, "debug_flag = %d\n", debug_flag);
+
+	return s - buf;
+}
+
+static ssize_t attr_debug_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	debug_flag = -1;
+	sscanf(buf, "%d", &debug_flag);
+
+	D("%s: debug_flag = %d\n", __func__, debug_flag);
+
+	return count;
+}
+
+static ssize_t attr_cali_data_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+	struct r3gd20_data *gyro = g_gyro;
+
+	s += sprintf(s, "Stored calibration data (x, y, z) = (%d, %d, %d)\n",
+		gyro->cali_data_x, gyro->cali_data_y,
+		gyro->cali_data_z);
+
+	D("%s: Calibration data (x, y, z) = (%d, %d, %d)\n",
+		__func__, gyro->cali_data_x, gyro->cali_data_y,
+			  gyro->cali_data_z);
+	return s - buf;
+}
+
+static int is_valid_cali(int cali_data)
+{
+	if ((cali_data < TOLERENCE) && (cali_data > -TOLERENCE))
+		return 1;
+	else
+		return 0;
+}
+
+static ssize_t attr_cali_data_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	struct r3gd20_data *gyro = g_gyro;
+
+	D("%s: \n", __func__);
+
+	if(sscanf(buf, "%d %d %d", &(gyro->cali_data_x), &(gyro->cali_data_y),
+		  &(gyro->cali_data_z)) != 3) {
+		E("%s: input format error!\n", __func__);
+		return count;
+	}
+
+	if (!is_valid_cali(gyro->cali_data_x) ||
+	    !is_valid_cali(gyro->cali_data_y) ||
+	    !is_valid_cali(gyro->cali_data_z)) {
+		E("%s: Invalid calibration data (x, y, z) = (%d, %d, %d)",
+			__func__, gyro->cali_data_x, gyro->cali_data_y,
+			gyro->cali_data_z);
+		return count;
+	}
+
+	D("%s: Stored calibration data (x, y, z) = (%d, %d, %d)\n",
+		__func__, gyro->cali_data_x, gyro->cali_data_y,
+			  gyro->cali_data_z);
+
+	return count;
+}
+
+static struct device_attribute attributes[] = {
+	__ATTR(pollrate_ms, 0664, attr_polling_rate_show,
+						attr_polling_rate_store),
+	__ATTR(range, 0664, attr_range_show, attr_range_store),
+	__ATTR(enable_device, 0664, attr_enable_show, attr_enable_store),
+	__ATTR(enable_polling, 0664, attr_polling_mode_show, attr_polling_mode_store),
+	__ATTR(fifo_samples, 0664, attr_watermark_show, attr_watermark_store),
+	__ATTR(fifo_mode, 0664, attr_fifomode_show, attr_fifomode_store),
+	__ATTR(cali_data, 0664, attr_cali_data_show, attr_cali_data_store),
+#ifdef DEBUG
+	__ATTR(reg_value, 0664, attr_reg_get, attr_reg_set),
+	__ATTR(reg_addr, 0664, NULL, attr_addr_set),
+	__ATTR(debug, 0664, attr_debug_show, attr_debug_store),
+#endif
+};
+
+static int create_sysfs_interfaces(struct device *dev)
+{
+	int i;
+
+#ifdef HTC_ATTR
+	struct r3gd20_data *gyro = g_gyro;
+	int ret = 0;
+
+	if (gyro == NULL) {
+		E("%s: g_gyro == NULL!!\n", __func__);
+		return -2;
+	}
+
+	gyro->htc_gyro_class = class_create(THIS_MODULE, "htc_gyro");
+	if (IS_ERR(gyro->htc_gyro_class)) {
+		ret = PTR_ERR(gyro->htc_gyro_class);
+		gyro->htc_gyro_class = NULL;
+		E("%s: could not allocate gyro->htc_gyro_class\n", __func__);
+		goto err_create_class;
+	}
+
+	gyro->gyro_dev = device_create(gyro->htc_gyro_class,
+				NULL, 0, "%s", "gyro");
+	if (unlikely(IS_ERR(gyro->gyro_dev))) {
+		ret = PTR_ERR(gyro->gyro_dev);
+		gyro->gyro_dev = NULL;
+		E("%s: could not allocate gyro->gyro_dev\n", __func__);
+		goto err_create_gyro_device;
+	}
+
+	for (i = 0; i < ARRAY_SIZE(attributes); i++)
+		if (device_create_file(gyro->gyro_dev, attributes + i)) {
+			E("%s: could not allocate attribute files\n",
+				__func__);
+			goto err_create_device_file;
+		}
+	return 0;
+
+err_create_device_file:
+	device_unregister(gyro->gyro_dev);
+err_create_gyro_device:
+	class_destroy(gyro->htc_gyro_class);
+err_create_class:
+	return ret;
+
+#else 
+
+	for (i = 0; i < ARRAY_SIZE(attributes); i++)
+		if (device_create_file(dev, attributes + i))
+			goto error;
+	return 0;
+
+error:
+	for ( ; i >= 0; i--)
+		device_remove_file(dev, attributes + i);
+	dev_err(dev, "%s:Unable to create interface\n", __func__);
+	return -1;
+
+#endif 
+
+}
+
+static int remove_sysfs_interfaces(struct device *dev)
+{
+	int i;
+	for (i = 0; i < ARRAY_SIZE(attributes); i++)
+		device_remove_file(dev, attributes + i);
+	return 0;
+}
+
+static void report_triple(struct r3gd20_data *gyro)
+{
+	int err;
+	struct r3gd20_triple data_out;
+
+	err = r3gd20_get_data(gyro, &data_out);
+	if (err < 0)
+		dev_err(&gyro->client->dev, "get_gyroscope_data failed\n");
+	else
+		r3gd20_report_values(gyro, &data_out);
+}
+
+static void r3gd20_input_poll_func(struct input_polled_dev *dev)
+{
+	struct r3gd20_data *gyro = dev->private;
+
+	struct r3gd20_triple data_out;
+
+	int err;
+
+	DIF("%s: gyro->enabled = %d\n",
+		__func__, atomic_read(&gyro->enabled));
+	if (atomic_read(&gyro->enabled) == 0)
+		return;
+
+	
+
+
+	mutex_lock(&gyro->lock);
+	err = r3gd20_get_data(gyro, &data_out);
+	if (err < 0)
+		dev_err(&gyro->client->dev, "get_gyroscope_data failed\n");
+	else
+		r3gd20_report_values(gyro, &data_out);
+
+	mutex_unlock(&gyro->lock);
+
+}
+
+static void r3gd20_irq2_fifo(struct r3gd20_data *gyro)
+{
+	int err;
+	u8 buf[2];
+	u8 int_source;
+	u8 samples;
+	u8 workingmode;
+	u8 stored_samples;
+
+	mutex_lock(&gyro->lock);
+
+	workingmode = gyro->pdata->fifomode;
+
+
+	
+
+
+	switch (workingmode) {
+	case FIFO_MODE_BYPASS:
+	{
+		report_triple(gyro);
+		break;
+	}
+	case FIFO_MODE_FIFO:
+		samples = (gyro->pdata->watermark)+1;
+		
+		err = r3gd20_register_read(gyro, buf, FIFO_SRC_REG);
+		if (err > 0)
+			dev_err(&gyro->client->dev, "error reading fifo source reg\n");
+
+		int_source = buf[0];
+		
+
+		stored_samples = int_source & FIFO_STORED_DATA_MASK;
+
+
+		for (; samples > 0; samples--) {
+#if DEBUG
+			input_report_abs(gyro->input_poll_dev->input, ABS_MISC, 1);
+			input_sync(gyro->input_poll_dev->input);
+#endif
+			
+			report_triple(gyro);
+
+#if DEBUG
+			input_report_abs(gyro->input_poll_dev->input, ABS_MISC, 0);
+			input_sync(gyro->input_poll_dev->input);
+#endif
+		}
+		r3gd20_fifo_reset(gyro);
+		break;
+	}
+#if DEBUG
+	input_report_abs(gyro->input_poll_dev->input, ABS_MISC, 3);
+	input_sync(gyro->input_poll_dev->input);
+#endif
+
+	mutex_unlock(&gyro->lock);
+}
+
+static irqreturn_t r3gd20_isr2(int irq, void *dev)
+{
+	struct r3gd20_data *gyro = dev;
+
+	disable_irq_nosync(irq);
+#if DEBUG
+	input_report_abs(gyro->input_poll_dev->input, ABS_MISC, 2);
+	input_sync(gyro->input_poll_dev->input);
+#endif
+	queue_work(gyro->irq2_work_queue, &gyro->irq2_work);
+	I("%s: isr2 queued\n", R3GD20_GYR_DEV_NAME);
+
+	return IRQ_HANDLED;
+}
+
+static void r3gd20_irq2_work_func(struct work_struct *work)
+{
+
+	struct r3gd20_data *gyro =
+	container_of(work, struct r3gd20_data, irq2_work);
+	r3gd20_irq2_fifo(gyro);
+	
+	I("%s: IRQ2 served\n", R3GD20_GYR_DEV_NAME);
+	enable_irq(gyro->irq2);
+}
+
+
+int r3gd20_input_open(struct input_dev *input)
+{
+	struct r3gd20_data *gyro = input_get_drvdata(input);
+
+	DIF("%s:\n", __func__);
+
+	
+	return 0;
+
+	return r3gd20_enable(gyro);
+}
+
+void r3gd20_input_close(struct input_dev *dev)
+{
+	struct r3gd20_data *gyro = input_get_drvdata(dev);
+
+	r3gd20_disable(gyro);
+}
+
+static int r3gd20_validate_pdata(struct r3gd20_data *gyro)
+{
+	
+	gyro->pdata->min_interval =
+		max((unsigned int) R3GD20_MIN_POLL_PERIOD_MS,
+						gyro->pdata->min_interval);
+
+	gyro->pdata->poll_interval = max(gyro->pdata->poll_interval,
+			gyro->pdata->min_interval);
+
+	if (gyro->pdata->axis_map_x > 2 ||
+	    gyro->pdata->axis_map_y > 2 ||
+	    gyro->pdata->axis_map_z > 2) {
+		dev_err(&gyro->client->dev,
+			"invalid axis_map value x:%u y:%u z%u\n",
+			gyro->pdata->axis_map_x,
+			gyro->pdata->axis_map_y,
+			gyro->pdata->axis_map_z);
+		return -EINVAL;
+	}
+
+	
+	if (gyro->pdata->negate_x > 1 ||
+	    gyro->pdata->negate_y > 1 ||
+	    gyro->pdata->negate_z > 1) {
+		dev_err(&gyro->client->dev,
+			"invalid negate value x:%u y:%u z:%u\n",
+			gyro->pdata->negate_x,
+			gyro->pdata->negate_y,
+			gyro->pdata->negate_z);
+		return -EINVAL;
+	}
+
+	
+	if (gyro->pdata->poll_interval < gyro->pdata->min_interval) {
+		dev_err(&gyro->client->dev,
+			"minimum poll interval violated\n");
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static int r3gd20_input_init(struct r3gd20_data *gyro)
+{
+	int err = -1;
+	struct input_dev *input;
+
+	
+
+	gyro->input_poll_dev = input_allocate_polled_device();
+	if (!gyro->input_poll_dev) {
+		err = -ENOMEM;
+		dev_err(&gyro->client->dev,
+			"input device allocation failed\n");
+		goto err0;
+	}
+
+	gyro->input_poll_dev->private = gyro;
+	gyro->input_poll_dev->poll = r3gd20_input_poll_func;
+	gyro->input_poll_dev->poll_interval = gyro->pdata->poll_interval;
+
+#ifdef HTC_WQ
+	input = input_allocate_device();
+	if (!input) {
+		E("%s: could not allocate ls input device\n", __func__);
+		return -ENOMEM;
+	}
+	gyro->gyro_input_dev = input;
+#else
+	input = gyro->input_poll_dev->input;
+#endif 
+
+	input->open = r3gd20_input_open;
+	input->close = r3gd20_input_close;
+
+	input->id.bustype = BUS_I2C;
+	input->dev.parent = &gyro->client->dev;
+
+#ifdef HTC_WQ
+	input_set_drvdata(input, gyro);
+#else
+	input_set_drvdata(gyro->input_poll_dev->input, gyro);
+#endif 
+
+	set_bit(EV_ABS, input->evbit);
+
+#if DEBUG
+	set_bit(EV_KEY, input->keybit);
+	set_bit(KEY_LEFT, input->keybit);
+	input_set_abs_params(input, ABS_MISC, 0, 1, 0, 0);
+#endif
+
+	input_set_abs_params(input, ABS_X, -FS_MAX, FS_MAX, FUZZ, FLAT);
+	input_set_abs_params(input, ABS_Y, -FS_MAX, FS_MAX, FUZZ, FLAT);
+	input_set_abs_params(input, ABS_Z, -FS_MAX, FS_MAX, FUZZ, FLAT);
+
+	input->name = R3GD20_GYR_DEV_NAME;
+
+#ifdef HTC_WQ
+	err = input_register_device(input);
+#else
+	err = input_register_polled_device(gyro->input_poll_dev);
+#endif
+	if (err) {
+		dev_err(&gyro->client->dev,
+			"unable to register input polled device %s\n",
+			gyro->input_poll_dev->input->name);
+		goto err1;
+	}
+
+	return 0;
+
+err1:
+	input_free_polled_device(gyro->input_poll_dev);
+err0:
+	return err;
+}
+
+static void r3gd20_input_cleanup(struct r3gd20_data *gyro)
+{
+	input_unregister_polled_device(gyro->input_poll_dev);
+	input_free_polled_device(gyro->input_poll_dev);
+}
+
+static int to_signed_int(char *value)
+{
+	int ret_int = 0;
+
+	if (value == NULL)
+		ret_int = 0;
+	else {
+		ret_int = value[0] | (value[1] << 8) |
+			  (value[2] << 16) |
+			  (value[3] << 24);
+	}
+
+	return ret_int;
+}
+
+static int r3gd20_probe(struct i2c_client *client,
+					const struct i2c_device_id *devid)
+{
+	struct r3gd20_data *gyro;
+
+	u32 smbus_func = I2C_FUNC_SMBUS_BYTE_DATA |
+			I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_I2C_BLOCK ;
+
+	int err = -1;
+
+	I("%s: probe start v03.\n", R3GD20_GYR_DEV_NAME);
+
+	
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		dev_warn(&client->dev, "client not i2c capable\n");
+		if (i2c_check_functionality(client->adapter, smbus_func)) {
+			use_smbus = 1;
+			dev_warn(&client->dev, "client using SMBUS\n");
+		} else {
+			err = -ENODEV;
+			dev_err(&client->dev, "client nor SMBUS capable\n");
+			goto err0;
+		}
+	}
+
+	
+
+	gyro = kzalloc(sizeof(*gyro), GFP_KERNEL);
+	if (gyro == NULL) {
+		dev_err(&client->dev,
+			"failed to allocate memory for module data\n");
+		err = -ENOMEM;
+		goto err0;
+	}
+
+	g_gyro = gyro;
+
+	mutex_init(&gyro->lock);
+	mutex_lock(&gyro->lock);
+	gyro->client = client;
+
+	gyro->pdata = kmalloc(sizeof(*gyro->pdata), GFP_KERNEL);
+	if (gyro->pdata == NULL) {
+		dev_err(&client->dev,
+			"failed to allocate memory for pdata: %d\n", err);
+		goto err1;
+	}
+
+	if (client->dev.platform_data == NULL) {
+		memcpy(gyro->pdata, &default_r3gd20_gyr_pdata,
+							sizeof(*gyro->pdata));
+	} else {
+		memcpy(gyro->pdata, client->dev.platform_data,
+						sizeof(*gyro->pdata));
+	}
+
+	err = r3gd20_validate_pdata(gyro);
+	if (err < 0) {
+		dev_err(&client->dev, "failed to validate platform data\n");
+		goto err1_1;
+	}
+
+	i2c_set_clientdata(client, gyro);
+
+	if (gyro->pdata->init) {
+		err = gyro->pdata->init();
+		if (err < 0) {
+			dev_err(&client->dev, "init failed: %d\n", err);
+			goto err1_1;
+		}
+	}
+
+
+	memset(gyro->resume_state, 0, ARRAY_SIZE(gyro->resume_state));
+
+	gyro->resume_state[RES_CTRL_REG1] = ALL_ZEROES | ENABLE_ALL_AXES;
+	gyro->resume_state[RES_CTRL_REG2] = ALL_ZEROES;
+	gyro->resume_state[RES_CTRL_REG3] = ALL_ZEROES;
+	gyro->resume_state[RES_CTRL_REG4] = ALL_ZEROES | BDU_ENABLE;
+	gyro->resume_state[RES_CTRL_REG5] = ALL_ZEROES;
+	gyro->resume_state[RES_FIFO_CTRL_REG] = ALL_ZEROES;
+
+	gyro->polling_enabled = true;
+
+	err = r3gd20_device_power_on(gyro);
+	if (err < 0) {
+		dev_err(&client->dev, "power on failed: %d\n", err);
+		goto err2;
+	}
+
+	atomic_set(&gyro->enabled, 1);
+
+	err = r3gd20_update_fs_range(gyro, gyro->pdata->fs_range);
+	if (err < 0) {
+		dev_err(&client->dev, "update_fs_range failed\n");
+		goto err2;
+	}
+
+	err = r3gd20_update_odr(gyro, gyro->pdata->poll_interval);
+	if (err < 0) {
+		dev_err(&client->dev, "update_odr failed\n");
+		goto err2;
+	}
+
+	err = r3gd20_input_init(gyro);
+	if (err < 0)
+		goto err3;
+
+	err = create_sysfs_interfaces(&client->dev);
+	if (err < 0) {
+		dev_err(&client->dev,
+			"%s device register failed\n", R3GD20_GYR_DEV_NAME);
+		goto err4;
+	}
+
+	r3gd20_device_power_off(gyro);
+
+	
+	atomic_set(&gyro->enabled, 0);
+
+
+	if (gyro->pdata->gpio_int2 > 0) {
+		gyro->irq2 = gpio_to_irq(gyro->pdata->gpio_int2);
+		I("%s: %s has set irq2 to irq:"
+						" %d mapped on gpio:%d\n",
+			R3GD20_GYR_DEV_NAME, __func__, gyro->irq2,
+							gyro->pdata->gpio_int2);
+
+		INIT_WORK(&gyro->irq2_work, r3gd20_irq2_work_func);
+		gyro->irq2_work_queue =
+			create_singlethread_workqueue("r3gd20_gyr_wq2");
+		if (!gyro->irq2_work_queue) {
+			err = -ENOMEM;
+			dev_err(&client->dev, "cannot create "
+						"work queue2: %d\n", err);
+			goto err5;
+		}
+
+		err = request_irq(gyro->irq2, r3gd20_isr2,
+				IRQF_TRIGGER_HIGH, "r3gd20_gyr_irq2", gyro);
+
+		if (err < 0) {
+			dev_err(&client->dev, "request irq2 failed: %d\n", err);
+			goto err6;
+		}
+		disable_irq_nosync(gyro->irq2);
+	}
+
+	mutex_unlock(&gyro->lock);
+
+	gyro->cali_data_x = to_signed_int(&gyro_gsensor_kvalue[4]);
+	gyro->cali_data_y = to_signed_int(&gyro_gsensor_kvalue[8]);
+	gyro->cali_data_z = to_signed_int(&gyro_gsensor_kvalue[12]);
+	D("%s: Calibration data (x, y, z) = (%d, %d, %d)\n",
+		__func__, gyro->cali_data_x, gyro->cali_data_y,
+			  gyro->cali_data_z);
+
+#ifdef HTC_WQ
+	gyro->gyro_wq = create_singlethread_workqueue("gyro_wq");
+	if (!gyro->gyro_wq) {
+		E("%s: can't create workqueue\n", __func__);
+		err = -ENOMEM;
+		goto err_create_singlethread_workqueue;
+	}
+#endif 
+	debug_flag = 0;
+
+	I("%s: %s probed: device created successfully\n",
+			__func__, R3GD20_GYR_DEV_NAME);
+
+	return 0;
+
+
+#ifdef HTC_WQ
+err_create_singlethread_workqueue:
+#endif 
+err6:
+	destroy_workqueue(gyro->irq2_work_queue);
+err5:
+	r3gd20_device_power_off(gyro);
+	remove_sysfs_interfaces(&client->dev);
+err4:
+	r3gd20_input_cleanup(gyro);
+err3:
+	r3gd20_device_power_off(gyro);
+err2:
+	if (gyro->pdata->exit)
+		gyro->pdata->exit();
+err1_1:
+	mutex_unlock(&gyro->lock);
+	kfree(gyro->pdata);
+err1:
+	kfree(gyro);
+err0:
+	E("%s: Driver Initialization failed\n", R3GD20_GYR_DEV_NAME);
+	return err;
+}
+
+static int r3gd20_remove(struct i2c_client *client)
+{
+	struct r3gd20_data *gyro = i2c_get_clientdata(client);
+#if DEBUG
+	I("R3GD20 driver removing\n");
+#endif
+
+	if (gyro->pdata->gpio_int2 > 0) {
+		free_irq(gyro->irq2, gyro);
+		gpio_free(gyro->pdata->gpio_int2);
+		destroy_workqueue(gyro->irq2_work_queue);
+	}
+
+	r3gd20_input_cleanup(gyro);
+	r3gd20_device_power_off(gyro);
+	remove_sysfs_interfaces(&client->dev);
+
+	kfree(gyro->pdata);
+	kfree(gyro);
+	return 0;
+}
+
+#ifdef HTC_SUSPEND
+
+static int r3gd20_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+#ifdef CONFIG_SUSPEND
+	struct r3gd20_data *data = i2c_get_clientdata(client);
+	u8 buf[2];
+	int err = -1;
+
+	DIF("%s: ++\n", __func__);
+
+#if DEBUG
+	I("r3gd20_suspend\n");
+#endif 
+
+	
+		mutex_lock(&data->lock);
+		if (data->polling_enabled) {
+			D("polling disabled\n");
+#ifdef HTC_WQ
+			cancel_delayed_work_sync(&polling_work);
+#else 
+			cancel_delayed_work_sync(&data->input_poll_dev->work);
+#endif 
+			
+		}
+
+#ifdef SLEEP
+		err = r3gd20_register_update(data, buf, CTRL_REG1,
+				0x0F, (ENABLE_NO_AXES | PM_NORMAL));
+#else
+		err = r3gd20_register_update(data, buf, CTRL_REG1,
+				0x08, PM_OFF);
+#endif 
+		mutex_unlock(&data->lock);
+	
+
+#endif 
+	D("%s:--\n", __func__);
+	return err;
+}
+
+static int r3gd20_resume(struct i2c_client *client)
+{
+#ifdef CONFIG_SUSPEND
+	struct r3gd20_data *data = i2c_get_clientdata(client);
+	u8 buf[2];
+	int err = -1;
+
+	D("%s:++\n", __func__);
+#if DEBUG
+	I("r3gd20_resume\n");
+#endif 
+
+	if (atomic_read(&data->enabled)) {
+		mutex_lock(&data->lock);
+
+		if (data->polling_enabled) {
+			D("polling enabled\n");
+#ifdef HTC_WQ
+			queue_delayed_work(data->gyro_wq, &polling_work,
+					   msecs_to_jiffies(data->input_poll_dev->
+					   poll_interval));
+#else
+			schedule_delayed_work(&data->input_poll_dev->work,
+					msecs_to_jiffies(data->
+							pdata->poll_interval));
+#endif
+		}
+#ifdef SLEEP
+		err = r3gd20_register_update(data, buf, CTRL_REG1,
+				0x0F, (ENABLE_ALL_AXES | PM_NORMAL));
+#else
+		err = r3gd20_register_update(data, buf, CTRL_REG1,
+				0x08, PM_NORMAL);
+#endif
+		mutex_unlock(&data->lock);
+
+	}
+
+#endif 
+	D("%s:--\n", __func__);
+	return 0;
+}
+
+#else 
+
+static int r3gd20_suspend(struct device *dev)
+{
+#define SLEEP
+#ifdef CONFIG_SUSPEND
+	struct i2c_client *client = to_i2c_client(dev);
+	struct r3gd20_data *data = i2c_get_clientdata(client);
+	u8 buf[2];
+	int err = -1;
+
+	D("%s:\n", __func__);
+
+#if DEBUG
+	I("r3gd20_suspend\n");
+#endif 
+	I("%s\n", __func__);
+	if (atomic_read(&data->enabled)) {
+		mutex_lock(&data->lock);
+		if (data->polling_enabled) {
+			D("polling disabled\n");
+#ifdef HTC_WQ
+			cancel_delayed_work_sync(&polling_work);
+#else
+			cancel_delayed_work_sync(&data->input_poll_dev->work);
+#endif 
+			
+		}
+#ifdef SLEEP
+		err = r3gd20_register_update(data, buf, CTRL_REG1,
+				0x0F, (ENABLE_NO_AXES | PM_NORMAL));
+#else
+		err = r3gd20_register_update(data, buf, CTRL_REG1,
+				0x08, PM_OFF);
+#endif 
+		mutex_unlock(&data->lock);
+	}
+
+#endif 
+	return err;
+}
+
+static int r3gd20_resume(struct device *dev)
+{
+#ifdef CONFIG_SUSPEND
+	struct i2c_client *client = to_i2c_client(dev);
+	struct r3gd20_data *data = i2c_get_clientdata(client);
+	u8 buf[2];
+	int err = -1;
+
+	D("%s:\n", __func__);
+#if DEBUG
+	I("r3gd20_resume\n");
+#endif 
+	I("%s\n", __func__);
+	if (atomic_read(&data->enabled)) {
+		mutex_lock(&data->lock);
+		if (data->polling_enabled) {
+			D("polling enabled\n");
+#ifdef HTC_WQ
+			queue_delayed_work(data->gyro_wq, &polling_work,
+					   msecs_to_jiffies(data->input_poll_dev->
+					   poll_interval));
+#else
+			schedule_delayed_work(&data->input_poll_dev->work,
+					msecs_to_jiffies(data->
+							pdata->poll_interval));
+#endif
+		}
+#ifdef SLEEP
+		err = r3gd20_register_update(data, buf, CTRL_REG1,
+				0x0F, (ENABLE_ALL_AXES | PM_NORMAL));
+#else
+		err = r3gd20_register_update(data, buf, CTRL_REG1,
+				0x08, PM_NORMAL);
+#endif
+		mutex_unlock(&data->lock);
+
+	}
+
+#endif 
+	return 0;
+}
+
+#endif 
+
+static const struct i2c_device_id r3gd20_id[] = {
+	{ R3GD20_GYR_DEV_NAME , 0 },
+	{},
+};
+
+MODULE_DEVICE_TABLE(i2c, r3gd20_id);
+
+#ifndef HTC_SUSPEND
+static struct dev_pm_ops r3gd20_pm = {
+	.suspend = r3gd20_suspend,
+	.resume = r3gd20_resume,
+};
+#endif 
+
+static struct i2c_driver r3gd20_driver = {
+	.driver = {
+			.owner = THIS_MODULE,
+			.name = R3GD20_GYR_DEV_NAME,
+#ifndef HTC_SUSPEND
+			.pm = &r3gd20_pm,
+#endif 
+	},
+	.probe = r3gd20_probe,
+	.remove = __devexit_p(r3gd20_remove),
+	.id_table = r3gd20_id,
+#ifdef HTC_SUSPEND
+	.suspend = r3gd20_suspend,
+	.resume = r3gd20_resume,
+#endif
+
+};
+
+static int __init r3gd20_init(void)
+{
+#if DEBUG
+	I("%s: gyroscope sysfs driver init\n", R3GD20_GYR_DEV_NAME);
+#endif
+	return i2c_add_driver(&r3gd20_driver);
+}
+
+static void __exit r3gd20_exit(void)
+{
+#if DEBUG
+	I("%s exit\n", R3GD20_GYR_DEV_NAME);
+#endif
+	i2c_del_driver(&r3gd20_driver);
+	return;
+}
+
+module_init(r3gd20_init);
+module_exit(r3gd20_exit);
+
+MODULE_DESCRIPTION("r3gd20 digital gyroscope sysfs driver");
+MODULE_AUTHOR("Matteo Dameno, Carmine Iascone, STMicroelectronics");
+MODULE_LICENSE("GPL");
+
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index f9e2758..e410b98 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -79,6 +79,10 @@
 #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI	0x0252
 #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO	0x0253
 #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS	0x0254
+/* MacbookPro10,1 (unibody, June 2012) */
+#define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI	0x0262
+#define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO	0x0263
+#define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS	0x0264
 
 #define BCM5974_DEVICE(prod) {					\
 	.match_flags = (USB_DEVICE_ID_MATCH_DEVICE |		\
@@ -128,6 +132,10 @@
 	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI),
 	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO),
 	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS),
+	/* MacbookPro10,1 */
+	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI),
+	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ISO),
+	BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_JIS),
 	/* Terminating entry */
 	{}
 };
@@ -354,6 +362,18 @@
 		{ DIM_X, DIM_X / SN_COORD, -4620, 5140 },
 		{ DIM_Y, DIM_Y / SN_COORD, -150, 6600 }
 	},
+	{
+		USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI,
+		USB_DEVICE_ID_APPLE_WELLSPRING7_ISO,
+		USB_DEVICE_ID_APPLE_WELLSPRING7_JIS,
+		HAS_INTEGRATED_BUTTON,
+		0x84, sizeof(struct bt_data),
+		0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
+		{ DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 },
+		{ DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
+		{ DIM_X, DIM_X / SN_COORD, -4750, 5280 },
+		{ DIM_Y, DIM_Y / SN_COORD, -150, 6730 }
+	},
 	{}
 };
 
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index cecd35c..c77032c 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -243,7 +243,7 @@
 		input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
 		input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
 		if (wacom->tool[0] != BTN_TOOL_MOUSE) {
-			input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x01) << 8));
+			input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x03) << 8));
 			input_report_key(input, BTN_TOUCH, data[1] & 0x01);
 			input_report_key(input, BTN_STYLUS, data[1] & 0x02);
 			input_report_key(input, BTN_STYLUS2, data[1] & 0x04);
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index bc987a6..388f977 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -1009,3 +1009,21 @@
 	  module will be called synaptics_dsx_fw_update.
 
 endif
+
+config TOUCHSCREEN_ATMEL_224E
+	tristate "Atmel i2c touchscreen"
+	depends on I2C
+	help
+	  This enables support for Atmel over I2C based touchscreens.
+
+config TOUCHSCREEN_CYPRESS_CS
+	tristate "Cypress CY8C20x34 based touchkey"
+	depends on I2C
+	help
+	  Enables support for Cypress CY8C_CS touchkeys.
+
+config TOUCHSCREEN_SYNAPTICS_3K
+	tristate "Synaptics 3K i2c touchscreen"
+	depends on I2C
+	help
+	  This enables support for Synaptics RMI4 over I2C based touchscreens.
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 6d5b4f1..ba0e55a 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -86,3 +86,6 @@
 obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4)		+= synaptics_i2c_rmi4.o
 obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI4_DEV)	+= synaptics_rmi_dev.o
 obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE) 	+= synaptics_fw_update.o
+obj-$(CONFIG_TOUCHSCREEN_ATMEL_224E)	+= atmel_224e.o
+obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CS)	+= cy8c_cs.o
+obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_3K)	+= synaptics_3200.o rmi_dev.o
diff --git a/drivers/input/touchscreen/atmel_224e.c b/drivers/input/touchscreen/atmel_224e.c
new file mode 100644
index 0000000..5d2e946
--- /dev/null
+++ b/drivers/input/touchscreen/atmel_224e.c
@@ -0,0 +1,2556 @@
+/* drivers/input/touchscreen/atmel_224e.c - ATMEL Touch driver
+ *
+ * Copyright (C) 2011 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/earlysuspend.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include <asm/io.h>
+#include <asm/gpio.h>
+#include <mach/board.h>
+#include <asm/mach-types.h>
+#include <linux/atmel_qt602240.h>
+#include <linux/input/mt.h>
+#include <linux/jiffies.h>
+#include <mach/msm_hsusb.h>
+#include <linux/stat.h>
+#include <linux/pl_sensor.h>
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+#include <linux/input/cy8c_cs.h>
+#endif
+
+#define ATMEL_EN_SYSFS
+#define ATMEL_I2C_RETRY_TIMES 10
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_CABLE)
+#include <mach/cable_detect.h>
+#endif
+
+#if (defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB) || defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS))
+#include <mach/htc_battery.h>
+#endif
+
+static DEFINE_MUTEX(reload_lock);
+
+/* config_setting */
+#define NONE                                    0
+#define CONNECTED                               1
+
+/* anti-touch calibration */
+#define RECALIB_NEED                            0
+#define RECALIB_NG                              1
+#define RECALIB_UNLOCK                          2
+#define RECALIB_DONE                            3
+#define ATCHCAL_DELAY                           200
+#define SAFE_TIMEOUT                            500
+
+struct atmel_ts_data {
+	struct i2c_client *client;
+	struct input_dev *input_dev;
+	struct input_dev *sr_input_dev;
+	struct workqueue_struct *atmel_wq;
+	struct workqueue_struct *atmel_delayed_wq;
+	struct workqueue_struct *atmel_cable_vbus_wq;
+	struct work_struct check_delta_work;
+	struct work_struct cable_vbus_work;
+	struct delayed_work unlock_work;
+	int (*power) (int on);
+	uint8_t unlock_attr;
+	struct early_suspend early_suspend;
+	struct info_id_t *id;
+	struct object_t *object_table;
+	uint8_t report_type;
+	uint8_t finger_count;
+	uint16_t abs_x_min;
+	uint16_t abs_x_max;
+	uint16_t abs_y_min;
+	uint16_t abs_y_max;
+	uint8_t abs_pressure_min;
+	uint8_t abs_pressure_max;
+	uint8_t abs_width_min;
+	uint8_t abs_width_max;
+	uint8_t first_pressed;
+	uint8_t valid_pressed_cnt;
+	uint8_t cal_after_unlock;
+	uint8_t debug_log_level;
+	struct atmel_finger_data finger_data[10];
+	uint8_t high_res_x_en;
+	uint8_t high_res_y_en;
+	uint8_t finger_type;
+	uint8_t finger_support;
+	uint16_t finger_pressed;
+	uint8_t face_suppression;
+	uint8_t grip_suppression;
+	uint8_t noise_state;
+	uint8_t noise_err_count;
+	uint16_t *filter_level;
+	uint8_t calibration_confirm;
+	uint64_t timestamp;
+	unsigned long valid_press_timeout;
+	unsigned long safe_unlock_timeout;
+	struct atmel_config_data config_setting[2];
+	struct atmel_finger_data pre_finger_data[10];
+	uint8_t repeat_flag;
+	struct atmel_mferr mferr_config;
+	struct atmel_mferr cfm_calb;
+	struct atmel_mferr cable_config;
+	uint8_t noiseLine_config[8];
+	int8_t wlc_config[7];
+	uint8_t wlc_freq[4];
+	uint8_t wlc_status;
+	int8_t noise_config[3];
+	uint8_t call_tchthr[2];
+	uint8_t locking_config[1];
+	uint8_t status;
+	uint8_t cable_vbus_status;
+	uint8_t diag_command;
+	uint8_t psensor_status;
+	uint8_t noiseLine_status;
+	uint8_t *ATCH_EXT;
+	int pre_data[11];
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+	uint8_t key_bypass;
+	uint16_t flt_th;
+#endif
+#ifdef ATMEL_EN_SYSFS
+	struct device dev;
+#endif
+	uint8_t workaround;
+};
+
+static struct atmel_ts_data *private_ts;
+static short htc_event_enable, disable_touch;
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+static void atmel_ts_early_suspend(struct early_suspend *h);
+static void atmel_ts_late_resume(struct early_suspend *h);
+#endif
+
+static void restore_normal_threshold(struct atmel_ts_data *ts);
+static void confirm_calibration(struct atmel_ts_data *ts, uint8_t recal, uint8_t reason);
+static void multi_input_report(struct atmel_ts_data *ts);
+
+static int i2c_atmel_read(struct i2c_client *client, uint16_t address, uint8_t *data, uint8_t length)
+{
+	int retry;
+	uint8_t addr[2];
+
+	struct i2c_msg msg[] = {
+		{
+			.addr = client->addr,
+			.flags = 0,
+			.len = 2,
+			.buf = addr,
+		},
+		{
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = length,
+			.buf = data,
+		}
+	};
+	addr[0] = address & 0xFF;
+	addr[1] = (address >> 8) & 0xFF;
+
+	for (retry = 0; retry < ATMEL_I2C_RETRY_TIMES; retry++) {
+		if (i2c_transfer(client->adapter, msg, 2) == 2)
+			break;
+		mdelay(10);
+	}
+	if (retry == ATMEL_I2C_RETRY_TIMES) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: i2c_read_block retry over %d\n",
+			ATMEL_I2C_RETRY_TIMES);
+		return -EIO;
+	}
+	return 0;
+
+}
+
+static int i2c_atmel_write(struct i2c_client *client, uint16_t address, uint8_t *data, uint8_t length)
+{
+	int retry, loop_i;
+	uint8_t buf[length + 2];
+
+	struct i2c_msg msg[] = {
+		{
+			.addr = client->addr,
+			.flags = 0,
+			.len = length + 2,
+			.buf = buf,
+		}
+	};
+
+	buf[0] = address & 0xFF;
+	buf[1] = (address >> 8) & 0xFF;
+
+	for (loop_i = 0; loop_i < length; loop_i++)
+		buf[loop_i + 2] = data[loop_i];
+
+	for (retry = 0; retry < ATMEL_I2C_RETRY_TIMES; retry++) {
+		if (i2c_transfer(client->adapter, msg, 1) == 1)
+			break;
+		mdelay(10);
+	}
+
+	if (retry == ATMEL_I2C_RETRY_TIMES) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: i2c_write_block retry over %d\n",
+			ATMEL_I2C_RETRY_TIMES);
+		return -EIO;
+	}
+	return 0;
+
+}
+
+static int i2c_atmel_write_byte_data(struct i2c_client *client, uint16_t address, uint8_t value)
+{
+	return i2c_atmel_write(client, address, &value, 1);
+}
+
+static uint16_t get_object_address(struct atmel_ts_data *ts, uint8_t object_type)
+{
+	uint8_t loop_i;
+	for (loop_i = 0; loop_i < ts->id->num_declared_objects; loop_i++) {
+		if (ts->object_table[loop_i].object_type == object_type)
+			return ts->object_table[loop_i].i2c_address;
+	}
+	return 0;
+}
+static uint8_t get_object_size(struct atmel_ts_data *ts, uint8_t object_type)
+{
+	uint8_t loop_i;
+	for (loop_i = 0; loop_i < ts->id->num_declared_objects; loop_i++) {
+		if (ts->object_table[loop_i].object_type == object_type)
+			return ts->object_table[loop_i].size;
+	}
+	return 0;
+}
+
+static uint8_t get_rid(struct atmel_ts_data *ts, uint8_t object_type)
+{
+	uint8_t loop_i;
+	for (loop_i = 0; loop_i < ts->id->num_declared_objects; loop_i++) {
+		if (ts->object_table[loop_i].object_type == object_type)
+			return ts->object_table[loop_i].report_ids;
+	}
+	return 0;
+}
+
+#ifdef ATMEL_EN_SYSFS
+
+enum SR_REG_STATE{
+	ALLOCATE_DEV_FAIL = -2,
+	REGISTER_DEV_FAIL,
+	SUCCESS,
+};
+
+static int register_sr_touch_device(void)
+{
+	struct atmel_ts_data *ts = private_ts;
+
+	ts->sr_input_dev = input_allocate_device();
+
+	if (ts->sr_input_dev == NULL) {
+		printk(KERN_ERR "[TP][TOUCH_ERR]%s: Failed to allocate SR input device\n", __func__);
+		return ALLOCATE_DEV_FAIL;
+	}
+	ts->sr_input_dev->name = "sr_touchscreen";
+	set_bit(EV_SYN, ts->sr_input_dev->evbit);
+	set_bit(EV_ABS, ts->sr_input_dev->evbit);
+	set_bit(EV_KEY, ts->sr_input_dev->evbit);
+
+	set_bit(KEY_BACK, ts->sr_input_dev->keybit);
+	set_bit(KEY_HOME, ts->sr_input_dev->keybit);
+	set_bit(KEY_MENU, ts->sr_input_dev->keybit);
+	set_bit(KEY_SEARCH, ts->sr_input_dev->keybit);
+	set_bit(BTN_TOUCH, ts->sr_input_dev->keybit);
+	set_bit(KEY_APP_SWITCH, ts->sr_input_dev->keybit);
+	set_bit(INPUT_PROP_DIRECT, ts->sr_input_dev->propbit);
+	ts->sr_input_dev->mtsize = ts->finger_support;
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_TRACKING_ID,
+		0, ts->finger_support - 1, 0, 0);
+	printk(KERN_INFO "[TP][SR]input_set_abs_params: mix_x %d, max_x %d,"
+		" min_y %d, max_y %d\n", ts->abs_x_min, ts->abs_x_max,
+		ts->abs_y_min, ts->abs_y_max);
+
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_POSITION_X,
+				ts->abs_x_min, ts->abs_x_max, 0, 0);
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_POSITION_Y,
+				ts->abs_y_min, ts->abs_y_max, 0, 0);
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_TOUCH_MAJOR,
+				0, 255, 0, 0);
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_WIDTH_MAJOR,
+				0, 30, 0, 0);
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_PRESSURE,
+				0, 30, 0, 0);
+
+	if (input_register_device(ts->sr_input_dev)) {
+                input_free_device(ts->sr_input_dev);
+		printk(KERN_ERR "[TP][SR][TOUCH_ERR]%s: Unable to register %s input device\n",
+			__func__, ts->sr_input_dev->name);
+		return REGISTER_DEV_FAIL;
+	}
+	return SUCCESS;
+}
+
+static ssize_t set_en_sr(struct device *dev, struct device_attribute *attr,
+						const char *buf, size_t count)
+{
+	struct atmel_ts_data *ts = private_ts;
+	if (buf[0]) {
+		if (ts->sr_input_dev)
+			printk(KERN_INFO "[TP]%s: SR device already exist!\n", __func__);
+		else
+			printk(KERN_INFO "[TP]%s: SR touch device enable result:%X\n", __func__, register_sr_touch_device());
+	}
+	return count;
+}
+
+static DEVICE_ATTR(sr_en, S_IWUSR, 0, set_en_sr);
+
+static ssize_t atmel_reset(struct device *dev, struct device_attribute *attr,
+			     const char *buf, size_t count)
+{
+	int i;
+	struct atmel_ts_data *ts;
+	struct atmel_i2c_platform_data *pdata;
+
+	ts = private_ts;
+	pdata = ts->client->dev.platform_data;
+
+	if (sscanf(buf, "%d", &i) == 1 && i < 2) {
+		if (pdata->gpio_rst) {
+			gpio_set_value(pdata->gpio_rst, 0);
+			msleep(5);
+			gpio_set_value(pdata->gpio_rst, 1);
+			msleep(40);
+
+			pr_info("[TP] Reset Atmel Chip\n");
+		} else
+			pr_info("[TP] Reset pin NOT ASSIGN\n");
+	} else
+		pr_info("[TP] Parameter Error\n");
+
+	return count;
+}
+static DEVICE_ATTR(reset, (S_IWUSR|S_IRUGO), NULL, atmel_reset);
+
+static ssize_t show_report_type(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct atmel_ts_data *ts;
+
+	ts = private_ts;
+
+	return sprintf(buf, "report_type = %d\n", ts->report_type);
+}
+DEVICE_ATTR(report_type, S_IRUGO, show_report_type, NULL);
+
+static ssize_t set_htc_event(struct device *dev, struct device_attribute *attr,
+			     const char *buf, size_t count)
+{
+	int ret;
+	unsigned long mode;
+	ret = strict_strtoul(buf, 10, &mode);
+	htc_event_enable = mode;
+	pr_info("[TP]htc event enable = %d\n", htc_event_enable);
+	return count;
+}
+
+static ssize_t show_htc_event(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf, "htc event enable = %d\n", htc_event_enable);
+}
+DEVICE_ATTR(htc_event, (S_IWUSR|S_IRUGO), show_htc_event, set_htc_event);
+
+static ssize_t stop_touch(struct device *dev, struct device_attribute *attr,
+			     const char *buf, size_t count)
+{
+	int i;
+	if (sscanf(buf, "%d", &i) == 1 && i < 2) {
+		disable_touch = i;
+		pr_info("[TP] Touch Report %s!!\n", i ? "STOP" : "Work");
+	} else
+		pr_info("[TP] Parameter Error\n");
+	return count;
+}
+static ssize_t stop_touch_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf, "Touch Report enable = %d\n", disable_touch);
+}
+
+DEVICE_ATTR(disable_touch, (S_IWUSR|S_IRUGO), stop_touch_show, stop_touch);
+
+static ssize_t atmel_gpio_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	struct atmel_ts_data *ts_data;
+	struct atmel_i2c_platform_data *pdata;
+
+	ts_data = private_ts;
+	pdata = ts_data->client->dev.platform_data;
+
+	ret = gpio_get_value(pdata->gpio_irq);
+	printk(KERN_DEBUG "[TP]GPIO_TP_INT_N=%d\n", pdata->gpio_irq);
+	sprintf(buf, "GPIO_TP_INT_N=%d\n", ret);
+	ret = strlen(buf) + 1;
+	return ret;
+}
+static DEVICE_ATTR(gpio, S_IRUGO, atmel_gpio_show, NULL);
+
+static ssize_t atmel_vendor_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	struct atmel_ts_data *ts_data;
+	ts_data = private_ts;
+	sprintf(buf, "%s_x%2.2X_x%2.2X_x%2.2X\n", "ATMEL",
+		ts_data->id->family_id, ts_data->id->version, ts_data->id->build);
+	ret = strlen(buf) + 1;
+	return ret;
+}
+
+static DEVICE_ATTR(vendor, S_IRUGO, atmel_vendor_show, NULL);
+
+static unsigned long atmel_reg_addr;
+
+static ssize_t atmel_register_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	uint8_t ptr[1] = { 0 };
+	struct atmel_ts_data *ts_data;
+	ts_data = private_ts;
+	if (i2c_atmel_read(ts_data->client, atmel_reg_addr, ptr, 1) < 0) {
+		printk(KERN_WARNING "[TP]%s: read fail\n", __func__);
+		return ret;
+	}
+	ret += sprintf(buf, "addr: %ld, data: %d\n", atmel_reg_addr, ptr[0]);
+	return ret;
+}
+
+static ssize_t atmel_register_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	int ret = 0;
+	struct atmel_ts_data *ts_data;
+	char buf_tmp[4], buf_zero[200];
+	unsigned long write_da = 0;
+
+	ts_data = private_ts;
+	memset(buf_tmp, 0x0, sizeof(buf_tmp));
+	if ((buf[0] == 'r' || buf[0] == 'w') && buf[1] == ':' &&
+		(buf[5] == ':' || buf[5] == '\n')) {
+		memcpy(buf_tmp, buf + 2, 3);
+		ret = strict_strtoul(buf_tmp, 10, &atmel_reg_addr);
+		printk(KERN_DEBUG "read addr: 0x%lX\n", atmel_reg_addr);
+		if (!atmel_reg_addr) {
+			printk(KERN_WARNING "[TP]%s: string to number fail\n",
+								__func__);
+			return count;
+		}
+		printk(KERN_DEBUG "[TP]%s: set atmel_reg_addr is: %ld\n",
+						__func__, atmel_reg_addr);
+		if (buf[0] == 'w' && buf[5] == ':' && buf[9] == '\n') {
+			memcpy(buf_tmp, buf + 6, 3);
+			ret = strict_strtoul(buf_tmp, 10, &write_da);
+			printk(KERN_DEBUG "[TP]write addr: 0x%lX, data: 0x%lX\n",
+						atmel_reg_addr, write_da);
+			ret = i2c_atmel_write_byte_data(ts_data->client,
+						atmel_reg_addr, write_da);
+			if (ret < 0) {
+				printk(KERN_WARNING "[TP]%s: write fail(%d)\n",
+								__func__, ret);
+			}
+		}
+	}
+	if ((buf[0] == '0') && (buf[1] == ':') && (buf[5] == ':')) {
+		unsigned long val = 0;
+		memcpy(buf_tmp, buf + 2, 3);
+		ret = strict_strtol(buf_tmp, 10, &atmel_reg_addr);
+		memcpy(buf_tmp, buf + 6, 3);
+		ret = strict_strtol(buf_tmp, 10, &val);
+		memset(buf_zero, 0x0, sizeof(buf_zero));
+		ret = i2c_atmel_write(ts_data->client, atmel_reg_addr,
+			buf_zero, val - atmel_reg_addr + 1);
+		if (buf[9] == 'r') {
+			i2c_atmel_write_byte_data(ts_data->client,
+				get_object_address(ts_data, GEN_COMMANDPROCESSOR_T6) +
+				T6_CFG_BACKUPNV, 0x55);
+			i2c_atmel_write_byte_data(ts_data->client,
+				get_object_address(ts_data, GEN_COMMANDPROCESSOR_T6) +
+				T6_CFG_RESET, 0x11);
+		}
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(register, (S_IWUSR|S_IRUGO),
+	atmel_register_show, atmel_register_store);
+
+static ssize_t atmel_regdump_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	int count = 0, ret_t = 0;
+	struct atmel_ts_data *ts_data;
+	uint16_t loop_i, startAddr, endAddr;
+	uint8_t numObj;
+	uint8_t ptr[1] = { 0 };
+
+	ts_data = private_ts;
+	if (!ts_data->id->num_declared_objects)
+		return count;
+	numObj = ts_data->id->num_declared_objects - 1;
+	startAddr = get_object_address(ts_data, GEN_POWERCONFIG_T7);
+	if (ts_data->id->version < 0x11) {
+		endAddr = get_object_address(ts_data, PROCG_NOISESUPPRESSION_T48);
+		endAddr += get_object_size(ts_data, PROCG_NOISESUPPRESSION_T48) - 1;
+	} else {
+		endAddr = get_object_address(ts_data, PROCI_ADAPTIVETHRESHOLD_T55);
+		endAddr += get_object_size(ts_data, PROCI_ADAPTIVETHRESHOLD_T55) - 1;
+	}
+	for (loop_i = startAddr; loop_i <= endAddr; loop_i++) {
+		ret_t = i2c_atmel_read(ts_data->client, loop_i, ptr, 1);
+		if (ret_t < 0) {
+			printk(KERN_WARNING "dump fail, addr: %d\n",
+							loop_i);
+		}
+		count += sprintf(buf + count, "addr[%3d]: %3d, ",
+							loop_i , *ptr);
+		if (((loop_i - startAddr) % 4) == 3)
+			count += sprintf(buf + count, "\n");
+	}
+	count += sprintf(buf + count, "\n");
+	return count;
+}
+
+#if (defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_CABLE) || defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB) || defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS) || defined(CONFIG_TOUCHSCREEN_ATMEL_WLS))
+#ifdef DEBUG
+static void regdump_to_kernel(void)
+{
+	int count = 0, ret_t = 0;
+	struct atmel_ts_data *ts_data;
+	char buf[80];
+	uint16_t loop_i, startAddr, endAddr;
+	uint8_t numObj;
+	uint8_t ptr[1] = { 0 };
+
+	ts_data = private_ts;
+	if (!ts_data->id->num_declared_objects)
+		return;
+	numObj = ts_data->id->num_declared_objects - 1;
+	startAddr = get_object_address(ts_data, GEN_POWERCONFIG_T7);
+	if (ts_data->id->version < 0x11) {
+		endAddr = get_object_address(ts_data, PROCG_NOISESUPPRESSION_T48);
+		endAddr += get_object_size(ts_data, PROCG_NOISESUPPRESSION_T48) - 1;
+	} else {
+		endAddr = get_object_address(ts_data, PROCI_ADAPTIVETHRESHOLD_T55);
+		endAddr += get_object_size(ts_data, PROCI_ADAPTIVETHRESHOLD_T55) - 1;
+	}
+	for (loop_i = startAddr; loop_i <= endAddr; loop_i++) {
+		ret_t = i2c_atmel_read(ts_data->client, loop_i, ptr, 1);
+		if (ret_t < 0) {
+			printk(KERN_WARNING "[TP]dump fail, addr: %d\n",
+							loop_i);
+		}
+		count += sprintf(buf + count, "addr[%3d]: %3d, ",
+							loop_i , *ptr);
+		if (((loop_i - startAddr) % 4) == 3) {
+			printk(KERN_INFO "%s\n", buf);
+			count = 0;
+		}
+	}
+	printk(KERN_INFO "%s\n", buf);
+	return;
+}
+#else
+static void regdump_to_kernel(void) { }
+#endif
+#endif
+
+static ssize_t atmel_regdump_dump(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct atmel_ts_data *ts_data;
+	ts_data = private_ts;
+	if (buf[0] >= '0' && buf[0] <= '9' && buf[1] == '\n')
+		ts_data->debug_log_level = buf[0] - '0';
+
+	return count;
+
+}
+
+static DEVICE_ATTR(regdump, (S_IWUSR|S_IRUGO),
+	atmel_regdump_show, atmel_regdump_dump);
+
+static ssize_t atmel_debug_level_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct atmel_ts_data *ts_data;
+	size_t count = 0;
+	ts_data = private_ts;
+
+	count += sprintf(buf, "%d\n", ts_data->debug_log_level);
+
+	return count;
+}
+
+static ssize_t atmel_debug_level_dump(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct atmel_ts_data *ts_data;
+	ts_data = private_ts;
+	if (buf[0] >= '0' && buf[0] <= '9' && buf[1] == '\n')
+		ts_data->debug_log_level = buf[0] - '0';
+
+	return count;
+}
+
+static DEVICE_ATTR(debug_level, (S_IWUSR|S_IRUGO),
+	atmel_debug_level_show, atmel_debug_level_dump);
+
+static ssize_t atmel_diag_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct atmel_ts_data *ts_data;
+	size_t count = 0;
+	uint8_t data[T37_PAGE_SIZE];
+	uint8_t loop_i, loop_j;
+	int16_t rawdata;
+	int x, y;
+	ts_data = private_ts;
+	memset(data, 0x0, sizeof(data));
+
+	if (ts_data->diag_command != T6_CFG_DIAG_CMD_DELTAS &&
+		ts_data->diag_command != T6_CFG_DIAG_CMD_REF)
+		return count;
+
+	i2c_atmel_write_byte_data(ts_data->client,
+		get_object_address(ts_data, GEN_COMMANDPROCESSOR_T6) + T6_CFG_DIAG,
+		ts_data->diag_command);
+
+	x = T46_CFG_MODE0_X + ts_data->config_setting[NONE].config_T46[T46_CFG_MODE];
+	y = T46_CFG_MODE0_Y - ts_data->config_setting[NONE].config_T46[T46_CFG_MODE];
+	count += sprintf(buf, "Channel: %d * %d\n", x, y);
+
+	for (loop_i = 0; loop_i < 4; loop_i++) {
+		for (loop_j = 0;
+			!(data[T37_MODE] == ts_data->diag_command && data[T37_PAGE] == loop_i) && loop_j < 10; loop_j++) {
+			msleep(5);
+			i2c_atmel_read(ts_data->client,
+				get_object_address(ts_data, DIAGNOSTIC_T37), data, 2);
+		}
+		if (loop_j == 10)
+			printk(KERN_INFO "[TP]%s: Diag data not ready\n", __func__);
+
+		i2c_atmel_read(ts_data->client,
+			get_object_address(ts_data, DIAGNOSTIC_T37) +
+			T37_DATA, data, T37_PAGE_SIZE);
+		for (loop_j = 0; loop_j < T37_PAGE_SIZE - 1; loop_j += 2) {
+			if ((loop_i * 64 + loop_j / 2) >= (x * y)) {
+				count += sprintf(buf + count, "\n");
+				return count;
+			} else {
+				rawdata = data[loop_j+1] << 8 | data[loop_j];
+				if (ts_data->diag_command == T6_CFG_DIAG_CMD_REF)
+					rawdata -= 0x4000; /* 16384 */
+				count += sprintf(buf + count, "%6d", rawdata);
+				if (((loop_i * 64 + loop_j / 2) % y) == (y - 1))
+					count += sprintf(buf + count, "\n");
+			}
+		}
+		i2c_atmel_write_byte_data(ts_data->client,
+			get_object_address(ts_data, GEN_COMMANDPROCESSOR_T6) +
+			T6_CFG_DIAG, T6_CFG_DIAG_CMD_PAGEUP);
+	}
+
+	return count;
+}
+
+static ssize_t atmel_diag_dump(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct atmel_ts_data *ts_data;
+	ts_data = private_ts;
+	if (buf[0] == '1')
+		ts_data->diag_command = T6_CFG_DIAG_CMD_DELTAS;
+	if (buf[0] == '2')
+		ts_data->diag_command = T6_CFG_DIAG_CMD_REF;
+
+	return count;
+}
+
+static DEVICE_ATTR(diag, (S_IWUSR|S_IRUGO),
+	atmel_diag_show, atmel_diag_dump);
+
+static ssize_t atmel_unlock_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct atmel_ts_data *ts_data;
+	int unlock = -1;
+	ts_data = private_ts;
+
+	if (buf[0] >= '0' && buf[0] <= '9' && buf[1] == '\n')
+		unlock = buf[0] - '0';
+
+	printk(KERN_INFO "[TP]unlock change to %d\n", unlock);
+
+	if (!ts_data->unlock_attr)
+		return count;
+
+	if ((unlock == 2 || unlock == 3) &&
+		(ts_data->first_pressed || ts_data->finger_count) &&
+		ts_data->pre_data[0] < RECALIB_UNLOCK) {
+
+		ts_data->valid_press_timeout = jiffies + msecs_to_jiffies(15);
+		if (ts_data->finger_count == 0)
+			ts_data->valid_pressed_cnt = 1;
+		else /* unlock direction: left to right */
+			ts_data->valid_pressed_cnt = 0;
+
+		ts_data->cal_after_unlock = 0;
+		ts_data->pre_data[0] = RECALIB_UNLOCK;
+		restore_normal_threshold(ts_data);
+		i2c_atmel_write_byte_data(ts_data->client,
+			get_object_address(ts_data, GEN_ACQUISITIONCONFIG_T8) +
+			T8_CFG_ATCHCALST, 0x01);
+		if (time_after(jiffies, ts_data->safe_unlock_timeout))
+			queue_delayed_work(ts_data->atmel_delayed_wq, &ts_data->unlock_work,
+				msecs_to_jiffies(ATCHCAL_DELAY));
+		else
+			printk(KERN_INFO "[TP]unsafe unlock, give up delta check\n");
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(unlock, (S_IWUSR|S_IRUGO), NULL, atmel_unlock_store);
+
+static ssize_t atmel_info_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	size_t count = 0;
+	count += sprintf(buf, "Type B/mtsize/new filter/INT\n");
+	count += sprintf(buf + count, "2012.02.23.\n");
+	return count;
+}
+
+static DEVICE_ATTR(info, S_IRUGO, atmel_info_show, NULL);
+
+static struct kobject *android_touch_kobj;
+
+static int atmel_touch_sysfs_init(void)
+{
+	int ret;
+	android_touch_kobj = kobject_create_and_add("android_touch", NULL);
+	if (android_touch_kobj == NULL) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: subsystem_register failed\n");
+		ret = -ENOMEM;
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_gpio.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file gpio failed\n");
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_vendor.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file vendor failed\n");
+		return ret;
+	}
+	atmel_reg_addr = 0;
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_register.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file register failed\n");
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_regdump.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file regdump failed\n");
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_debug_level.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file debug_level failed\n");
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_diag.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file diag failed\n");
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_unlock.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file unlock failed\n");
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_htc_event.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file htc_event failed\n");
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_report_type.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file report_type failed\n");
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_disable_touch.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file disable_touch failed\n");
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_reset.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file RESET failed\n");
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_info.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file info failed\n");
+		return ret;
+	}
+	ret = sysfs_create_file(android_touch_kobj, &dev_attr_sr_en.attr);
+	if (ret) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create_file SR_EN failed\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static void atmel_touch_sysfs_deinit(void)
+{
+	sysfs_remove_file(android_touch_kobj, &dev_attr_info.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_unlock.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_diag.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_debug_level.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_regdump.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_register.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_vendor.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_gpio.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_report_type.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_htc_event.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_disable_touch.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_reset.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_sr_en.attr);
+	kobject_del(android_touch_kobj);
+}
+
+#endif
+
+static int check_delta_full(struct atmel_ts_data *ts,
+		uint8_t delta, uint8_t percent, uint8_t print_log)
+{
+	int8_t data[T37_DATA + T37_PAGE_SIZE];
+	uint8_t loop_i, loop_j;
+	uint8_t cnt, pos_cnt, neg_cnt, node_thr_cnt;
+	uint8_t x, y;
+	int16_t rawdata;
+
+	cnt = pos_cnt = neg_cnt = 0;
+	i2c_atmel_write_byte_data(ts->client,
+		get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+		T6_CFG_DIAG, T6_CFG_DIAG_CMD_DELTAS);
+
+	x = T46_CFG_MODE0_X + ts->config_setting[NONE].config_T46[T46_CFG_MODE];
+	y = T46_CFG_MODE0_Y - ts->config_setting[NONE].config_T46[T46_CFG_MODE];
+	node_thr_cnt = (x * y) * percent / 100;
+
+	for (loop_i = 0; loop_i < 4; loop_i++) {
+		memset(data, 0xFF, sizeof(data));
+		for (loop_j = 0;
+			!(data[T37_MODE] == T6_CFG_DIAG_CMD_DELTAS && data[T37_PAGE] == loop_i) && loop_j < 10; loop_j++) {
+			msleep(5);
+			i2c_atmel_read(ts->client,
+				get_object_address(ts, DIAGNOSTIC_T37), data, 2);
+		}
+		if (loop_j == 10)
+			printk(KERN_WARNING "[TP]%s: Diag data not ready\n", __func__);
+
+		i2c_atmel_read(ts->client,
+			get_object_address(ts, DIAGNOSTIC_T37),
+			data, T37_DATA + T37_PAGE_SIZE);
+		for (loop_j = T37_DATA;
+			loop_j < (T37_DATA + T37_PAGE_SIZE - 1); loop_j += 2) {
+			rawdata = data[loop_j+1] << 8 | data[loop_j];
+			cnt++;
+			if (rawdata > delta)
+				pos_cnt++;
+			else if (rawdata < -(delta))
+				neg_cnt++;
+
+			if (cnt >= x * y)
+				break;
+		}
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+			T6_CFG_DIAG, T6_CFG_DIAG_CMD_PAGEUP);
+	}
+
+	if (pos_cnt + neg_cnt > node_thr_cnt) {
+		if (print_log)
+			printk(KERN_INFO "[TP]channels C=%d P=%d N=%d T=%d\n",
+				cnt, pos_cnt, neg_cnt, node_thr_cnt);
+		return 1;
+	}
+
+	return 0;
+}
+
+static void restore_normal_threshold(struct atmel_ts_data *ts)
+{
+	if (ts->call_tchthr[0]) {
+		if (ts->config_setting[ts->status].config[0])
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+				T9_CFG_TCHTHR,
+				ts->config_setting[ts->status].config[CB_TCHTHR]);
+		else if (ts->config_setting[ts->status].config_T9 != NULL)
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+				T9_CFG_TCHTHR,
+				ts->config_setting[ts->status].config_T9[T9_CFG_TCHTHR]);
+		else
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+				T9_CFG_TCHTHR,
+				ts->config_setting[NONE].config_T9[T9_CFG_TCHTHR]);
+
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, GEN_ACQUISITIONCONFIG_T8) +
+			T8_CFG_ATCHCALSTHR,
+			ts->config_setting[ts->status].config_T8[T8_CFG_ATCHCALSTHR]);
+	}
+	if (ts->locking_config[0]) {
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+			T9_CFG_MRGTHR,
+			ts->config_setting[NONE].config_T9[T9_CFG_MRGTHR]);
+	}
+}
+
+static void confirm_calibration(struct atmel_ts_data *ts,
+		uint8_t recal, uint8_t reason)
+{
+	uint8_t i;
+	uint8_t ATCH_NOR[4] = {0, 1, 0, 0};
+	if (ts->cfm_calb.cnt) {
+		for (i = 0; i < ts->cfm_calb.cnt; i++)
+			i2c_atmel_write_byte_data(ts->client,
+					get_object_address(ts, ts->cfm_calb.cfg[i].objid) +
+					ts->cfm_calb.cfg[i].byte,
+					ts->cfm_calb.cfg[i].value);
+	} else
+		i2c_atmel_write(ts->client,
+				get_object_address(ts, GEN_ACQUISITIONCONFIG_T8) +
+				T8_CFG_ATCHCALST, ATCH_NOR, 4);
+
+	ts->pre_data[0] = RECALIB_DONE;
+	if (recal)
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+			T6_CFG_CALIBRATE, 0x55);
+	printk(KERN_INFO "[TP]calibration confirm %sby %s\n",
+		recal ? "with recal " : "",
+		(reason == 0) ? "position" :
+		(reason == 1) ? "clicks" :
+		(reason == 2) ? "delta" :
+		(reason == 3) ? "suspend" : "unknown");
+}
+
+static void msg_process_finger_data(struct atmel_ts_data *ts,
+				struct atmel_finger_data *fdata, uint8_t *data, uint8_t idx)
+{
+	if (!ts->high_res_x_en)
+		fdata->x = data[T9_MSG_XPOSMSB] << 2 | data[T9_MSG_XYPOSLSB] >> 6;
+	else
+		fdata->x = data[T9_MSG_XPOSMSB] << 4 | data[T9_MSG_XYPOSLSB] >> 4;
+	if (!ts->high_res_y_en)
+		fdata->y = data[T9_MSG_YPOSMSB] << 2 | (data[T9_MSG_XYPOSLSB] & 0x0C) >> 2;
+	else
+		fdata->y = data[T9_MSG_YPOSMSB] << 4 | (data[T9_MSG_XYPOSLSB] & 0x0F);
+	fdata->w = data[T9_MSG_TCHAREA];
+	fdata->z = data[T9_MSG_TCHAMPLITUDE];
+	ts->repeat_flag = 0;
+	if (ts->finger_count == 1) {
+		if ((ts->pre_finger_data[idx].x == fdata->x) && (ts->pre_finger_data[idx].y == fdata->y)
+			&& (ts->pre_finger_data[idx].w == fdata->w) && (ts->pre_finger_data[idx].z == fdata->z))
+			ts->repeat_flag = 1;
+	}
+	ts->pre_finger_data[idx].x = fdata->x;
+	ts->pre_finger_data[idx].y = fdata->y;
+	ts->pre_finger_data[idx].w = fdata->w;
+	ts->pre_finger_data[idx].z = fdata->z;
+}
+
+static void msg_process_multitouch(struct atmel_ts_data *ts, uint8_t *data, uint8_t idx)
+{
+	msg_process_finger_data(ts, &ts->finger_data[idx], data, idx);
+	if (data[T9_MSG_STATUS] & T9_MSG_STATUS_RELEASE) {
+		if (ts->finger_pressed & BIT(idx)) {
+			if (data[T9_MSG_STATUS] & T9_MSG_STATUS_MOVE) {
+				if (ts->repeat_flag == 0) {
+					multi_input_report(ts);
+					if (htc_event_enable == 0)
+						input_sync(ts->input_dev);
+				}
+			}
+		}
+
+		if (ts->grip_suppression & BIT(idx))
+			ts->grip_suppression &= ~BIT(idx);
+
+		if (!(ts->finger_pressed & BIT(idx)))
+			/* end since finger was not pressed */
+			return;
+
+		if (ts->report_type == SYN_AND_REPORT_TYPE_B) {
+			input_mt_slot(ts->input_dev, idx);
+			input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0);
+			input_sync(ts->input_dev);
+		}
+
+		if (ts->finger_count == 0)
+			printk(KERN_ERR "[TP]TOUCH_ERR: finger count has reached zero\n");
+		else
+			ts->finger_count--;
+		ts->finger_pressed &= ~BIT(idx);
+
+		if (!ts->first_pressed) {
+			if (ts->finger_count == 0)
+				ts->first_pressed = 1;
+			printk(KERN_INFO "[TP]E%d@%d,%d\n",
+				idx + 1, ts->finger_data[idx].x, ts->finger_data[idx].y);
+		}
+
+		switch (ts->pre_data[0]) {
+			case RECALIB_NEED:
+				if (ts->finger_count == 0 && !ts->unlock_attr && idx == 0 &&
+					ts->finger_data[idx].y > 750 && ts->finger_data[idx].y - ts->pre_data[idx+1] > 135) {
+					/* recalibrate on last release */
+					restore_normal_threshold(ts);
+					confirm_calibration(ts, 1, 0);
+				}
+				break;
+			case RECALIB_UNLOCK:
+				if (ts->finger_count) {
+					i2c_atmel_write_byte_data(ts->client,
+						get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+						T6_CFG_CALIBRATE, 0x55);
+				} else if (ts->unlock_attr && idx == 0 &&
+						time_after(jiffies, ts->valid_press_timeout)) {
+					ts->valid_pressed_cnt++;
+					if (ts->valid_pressed_cnt > 2) {
+						cancel_delayed_work_sync(&ts->unlock_work);
+						confirm_calibration(ts, 0, 1);
+					}
+				}
+				break;
+			case RECALIB_NG:
+				if (ts->finger_count == 0)
+					ts->pre_data[0] = RECALIB_NEED;
+				break;
+			default:
+				break;
+		}
+	} else if (data[T9_MSG_STATUS] & (T9_MSG_STATUS_DETECT|T9_MSG_STATUS_PRESS)) {
+		if (ts->finger_pressed & BIT(idx))
+			/* end since finger is already pressed */
+			return;
+
+		if (ts->filter_level[0]) {
+			if (ts->finger_data[idx].x < ts->filter_level[FL_XLOGRIPMIN] ||
+				ts->finger_data[idx].x > ts->filter_level[FL_XHIGRIPMAX])
+				ts->grip_suppression |= BIT(idx);
+			else if ((ts->finger_data[idx].x < ts->filter_level[FL_XLOGRIPMAX] ||
+				ts->finger_data[idx].x > ts->filter_level[FL_XHIGRIPMIN]) &&
+				(ts->grip_suppression & BIT(idx)))
+				ts->grip_suppression |= BIT(idx);
+			else if (ts->finger_data[idx].x > ts->filter_level[FL_XLOGRIPMAX] &&
+				ts->finger_data[idx].x < ts->filter_level[FL_XHIGRIPMIN])
+				ts->grip_suppression &= ~BIT(idx);
+		}
+
+		if (!(ts->grip_suppression & BIT(idx))) {
+			ts->finger_pressed |= BIT(idx);
+
+			if (ts->finger_count < ts->finger_support)
+				ts->finger_count++;
+
+			switch (ts->pre_data[0]) {
+				case RECALIB_UNLOCK:
+					if (ts->unlock_attr && ts->finger_count > 1)
+						ts->valid_pressed_cnt = 0;
+					break;
+				case RECALIB_NG:
+				case RECALIB_NEED:
+					ts->pre_data[idx + 1] = ts->finger_data[idx].y;
+					if (ts->finger_count == ts->finger_support) {
+						i2c_atmel_write_byte_data(ts->client,
+							get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+							T6_CFG_CALIBRATE, 0x55);
+					} else if (ts->finger_count > 1) {
+						if (ts->pre_data[0] == RECALIB_NEED)
+							ts->pre_data[0] = RECALIB_NG;
+					}
+					break;
+				default:
+					break;
+			}
+		}
+	}
+}
+
+static void initial_freq_scan(struct atmel_ts_data *ts)
+{
+	uint8_t data = 0;
+	if (ts->id->version >= 0x11) {
+		i2c_atmel_read(ts->client, get_object_address(ts, PROCG_NOISESUPPRESSION_T48) +
+					T48_CFG_NOCALCFG, &data, 1);
+		data = data^0x20;
+		i2c_atmel_write_byte_data(ts->client,
+					get_object_address(ts, PROCG_NOISESUPPRESSION_T48) +
+					T48_CFG_NOCALCFG, data);
+		printk(KERN_INFO "[TP]%s: toggle = 0x%x\n", __func__, data);
+	}
+}
+
+static void msg_process_noisesuppression(struct atmel_ts_data *ts, uint8_t *data)
+{
+	uint8_t i;
+	ts->noise_state = data[T48_MSG_STATE];
+	if (ts->id->version >= 0x11 && ts->noiseLine_config[0] && ts->status == CONNECTED) {
+		if (!ts->noiseLine_status && data[5] >= 0x15) {
+			printk(KERN_INFO "[TP]noiseLine change\n");
+			ts->noiseLine_status = 1;
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+				T9_CFG_TCHTHR,
+				ts->noiseLine_config[CB_TCHTHR]);
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, PROCG_NOISESUPPRESSION_T48) +
+				T48_CFG_NLTHR,
+				ts->noiseLine_config[CB_NLTHR]);
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, SPT_CTECONFIG_T46) +
+				T46_CFG_IDLESYNCSPERX,
+				ts->noiseLine_config[CB_IDLESYNCSPERX]);
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, SPT_CTECONFIG_T46) +
+				T46_CFG_ACTVSYNCSPERX,
+				ts->noiseLine_config[CB_ACTVSYNCSPERX]);
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+				T9_CFG_TCHDI,
+				ts->noiseLine_config[CB_TCHDI]);
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+				T9_CFG_NEXTTCHDI,
+				ts->noiseLine_config[CB_NEXTTCHDI]);
+		}
+	}
+	if ((ts->id->version == 0x11 && (ts->id->build == 0x01 || ts->id->build == 0xAA)) && (ts->mferr_config.cnt) && ts->status == CONNECTED && ts->noise_state == T48_MSG_STATE_MF_ERR) {
+		if (ts->noise_err_count < 3)
+			ts->noise_err_count++;
+		if (ts->noise_err_count == 2) {
+			printk(KERN_INFO "[TP]mferr change\n");
+			if (ts->id->build == 0xAA) {
+				for (i = 0; i < ts->mferr_config.cnt; i++)
+					i2c_atmel_write_byte_data(ts->client,
+						get_object_address(ts, ts->mferr_config.cfg[i].objid) +
+						ts->mferr_config.cfg[i].byte,
+						ts->mferr_config.cfg[i].value);
+			}
+		}
+	}
+}
+
+
+static void compatible_input_report(struct input_dev *idev,
+				struct atmel_finger_data *fdata, uint8_t press, uint8_t last, uint8_t report_type, uint8_t slot_num)
+{
+	if (report_type == SYN_AND_REPORT_TYPE_B) {
+		if (!press) {
+			input_mt_slot(idev, slot_num);
+			input_mt_report_slot_state(idev, MT_TOOL_FINGER, 0);
+		} else {
+			input_mt_slot(idev, slot_num);
+			input_mt_report_slot_state(idev, MT_TOOL_FINGER, 1);
+			input_report_abs(idev, ABS_MT_PRESSURE, fdata->z);
+			input_report_abs(idev, ABS_MT_TOUCH_MAJOR, fdata->z);
+			input_report_abs(idev, ABS_MT_WIDTH_MAJOR, fdata->w);
+			input_report_abs(idev, ABS_MT_POSITION_X, fdata->x);
+			input_report_abs(idev, ABS_MT_POSITION_Y, fdata->y);
+		}
+	} else {
+		if (!press)
+			input_mt_sync(idev);
+		else {
+			input_report_abs(idev, ABS_MT_PRESSURE, fdata->z);
+			input_report_abs(idev, ABS_MT_TOUCH_MAJOR, fdata->z);
+			input_report_abs(idev, ABS_MT_WIDTH_MAJOR, fdata->w);
+			input_report_abs(idev, ABS_MT_POSITION_X, fdata->x);
+			input_report_abs(idev, ABS_MT_POSITION_Y, fdata->y);
+			input_mt_sync(idev);
+		}
+	}
+}
+
+static void htc_input_report(struct input_dev *idev,
+				struct atmel_finger_data *fdata, uint8_t press, uint8_t last)
+{
+	if (!press) {
+		input_report_abs(idev, ABS_MT_AMPLITUDE, 0);
+		input_report_abs(idev, ABS_MT_POSITION, BIT(31));
+	} else {
+		input_report_abs(idev, ABS_MT_AMPLITUDE, fdata->z << 16 | fdata->w);
+		input_report_abs(idev, ABS_MT_POSITION,
+			(last ? BIT(31) : 0) | fdata->x << 16 | fdata->y);
+	}
+}
+
+static void multi_input_report(struct atmel_ts_data *ts)
+{
+	uint8_t loop_i, finger_report = 0;
+
+	for (loop_i = 0; loop_i < ts->finger_support; loop_i++) {
+		if (ts->finger_pressed & BIT(loop_i)) {
+			if (disable_touch == 0) {
+				if (htc_event_enable == 0) {
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+					if (ts->finger_data[loop_i].y > ts->flt_th && ts->key_bypass == 1) {
+						pr_info("[TP] key_bypass\n");
+						ts->key_bypass = 0;
+					} else
+#endif
+						compatible_input_report(ts->input_dev, &ts->finger_data[loop_i],
+									1, (ts->finger_count == ++finger_report), ts->report_type, loop_i);
+				} else
+					htc_input_report(ts->input_dev, &ts->finger_data[loop_i],
+							1, (ts->finger_count == ++finger_report));
+				if (ts->debug_log_level & 0x2)
+					printk(KERN_INFO "[TP]Finger %d=> X:%d, Y:%d, w:%d, z:%d, F:%d\n",
+						loop_i + 1,
+						ts->finger_data[loop_i].x, ts->finger_data[loop_i].y,
+						ts->finger_data[loop_i].w, ts->finger_data[loop_i].z,
+						ts->finger_count);
+			} else
+				return;
+		}
+	}
+}
+
+static irqreturn_t atmel_irq_thread(int irq, void *ptr)
+{
+	int ret;
+	struct atmel_ts_data *ts = ptr;
+	uint8_t data[7];
+	int8_t report_num;
+	uint8_t loop_i, loop_j, msg_byte_num = 7;
+
+	memset(data, 0x0, sizeof(data));
+
+	ret = i2c_atmel_read(ts->client, get_object_address(ts,
+		GEN_MESSAGEPROCESSOR_T5), data, 7);
+
+	if (ts->debug_log_level & 0x1) {
+		printk(KERN_INFO "[TP]");
+		for (loop_i = 0; loop_i < 7; loop_i++)
+			printk("0x%2.2X ", data[loop_i]);
+		printk("\n");
+	}
+
+	report_num = data[MSG_RID] - ts->finger_type;
+	if (report_num >= 0 && report_num < ts->finger_support) {
+		msg_process_multitouch(ts, data, report_num);
+	} else {
+		if (data[MSG_RID] == get_rid(ts, GEN_COMMANDPROCESSOR_T6)) {
+			if ((data[T6_MSG_STATUS] & T6_MSG_STATUS_CAL) &&
+				ts->unlock_attr) {
+				if (ts->pre_data[0] == RECALIB_UNLOCK) {
+					ts->valid_pressed_cnt = 0;
+					ts->cal_after_unlock = 1;
+					ts->valid_press_timeout = jiffies +
+						msecs_to_jiffies(15 + ts->finger_count * 5);
+				} else if (ts->pre_data[0] < RECALIB_UNLOCK) {
+					ts->safe_unlock_timeout = jiffies +
+						msecs_to_jiffies(SAFE_TIMEOUT);
+				}
+			}
+			printk(KERN_INFO "[TP]Touch Status: ");
+			msg_byte_num = 5;
+		} else if (data[MSG_RID] == get_rid(ts, PROCI_TOUCHSUPPRESSION_T42)) {
+			ts->face_suppression = data[T42_MSG_STATUS];
+			printk(KERN_INFO "Touch suppression %s: ",
+				ts->face_suppression ? "Active" : "Inactive");
+			msg_byte_num = 2;
+		} else if (data[MSG_RID] == get_rid(ts, PROCG_NOISESUPPRESSION_T48)) {
+			if (ts->id->version < 0x11)
+				msg_byte_num = 5;
+			else if (ts->id->version == 0x11 && (ts->id->build == 0x01 || ts->id->build == 0xAA)) {
+				if ((data[T48_MSG_STATUS] & (T48_MSG_STATUS_FREQCHG|T48_MSG_STATUS_ALGOERR|T48_MSG_STATUS_STATCHG)))
+					msg_byte_num = 7;
+				else
+					msg_byte_num = 0;
+			} else
+				msg_byte_num = 6;
+			if (msg_byte_num)
+				printk(KERN_INFO "[TP]Touch Noise suppression: ");
+			msg_process_noisesuppression(ts, data);
+		} else
+			printk(KERN_INFO "[TP]Touch Unhandled: ");
+
+		if (data[MSG_RID] != 0xFF) {
+			for (loop_j = 0; loop_j < msg_byte_num; loop_j++)
+				printk("0x%2.2X ", data[loop_j]);
+			if (msg_byte_num)
+				printk("\n");
+		}
+		return IRQ_HANDLED;
+	}
+
+	if (ts->report_type == SYN_AND_REPORT_TYPE_B) {
+		if (!ts->finger_count || ts->face_suppression) {
+			ts->finger_pressed = 0;
+			ts->finger_count = 0;
+
+			if (ts->debug_log_level & 0x2)
+				printk(KERN_INFO "[TP]Finger leave\n");
+		} else {
+			if (ts->repeat_flag == 0) {
+				multi_input_report(ts);
+				if (htc_event_enable == 0 || disable_touch == 0)
+					input_sync(ts->input_dev);
+			}
+		}
+	} else {
+		if (!ts->finger_count || ts->face_suppression) {
+			printk(KERN_INFO "[TP] Total finger count: %d\n", ts->finger_count);
+			ts->finger_pressed = 0;
+			ts->finger_count = 0;
+			if (htc_event_enable == 0)
+				compatible_input_report(ts->input_dev, NULL, 0, 1, 0, 0);
+			else
+				htc_input_report(ts->input_dev, NULL, 0, 1);
+
+			if (htc_event_enable == 0 || disable_touch == 0)
+				input_sync(ts->input_dev);
+
+			if (ts->debug_log_level & 0x2)
+				printk(KERN_INFO "[TP]Finger leave\n");
+		} else {
+			if (ts->repeat_flag == 0) {
+				multi_input_report(ts);
+				if (htc_event_enable == 0 || disable_touch == 0)
+					input_sync(ts->input_dev);
+			}
+		}
+	}
+
+	return IRQ_HANDLED;
+}
+
+static void atmel_ts_check_delta_work_func(struct work_struct *work)
+{
+	struct atmel_ts_data *ts;
+	uint8_t delta = 0;
+
+	ts = container_of(work, struct atmel_ts_data, check_delta_work);
+
+	i2c_atmel_read(ts->client, get_object_address(ts,
+		TOUCH_MULTITOUCHSCREEN_T9) + T9_CFG_TCHTHR, &delta, 1);
+	delta = (delta >> 2) << 4;
+	if (check_delta_full(ts, delta, 50, 1)) {
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, GEN_ACQUISITIONCONFIG_T8) +
+			T8_CFG_ATCHCALST, ts->ATCH_EXT[0]);
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, GEN_ACQUISITIONCONFIG_T8) +
+			T8_CFG_ATCHCALSTHR, ts->ATCH_EXT[1]);
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, GEN_ACQUISITIONCONFIG_T8) +
+			T8_CFG_ATCHFRCCALTHR, 16);
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, GEN_ACQUISITIONCONFIG_T8) +
+			T8_CFG_ATCHFRCCALRATIO, 240);
+		msleep(1);
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+			T6_CFG_CALIBRATE, 0x55);
+	}
+}
+
+static void atmel_ts_unlock_work_func(struct work_struct *work)
+{
+	struct atmel_ts_data *ts;
+	uint8_t delta = 0;
+	int ret;
+
+	ts = container_of(work, struct atmel_ts_data, unlock_work.work);
+	if (ts->pre_data[0] != RECALIB_UNLOCK || ts->cal_after_unlock)
+		goto give_up;
+	else {
+		if (ts->finger_count)
+			ret = 1;
+		else {
+			i2c_atmel_read(ts->client, get_object_address(ts,
+				TOUCH_MULTITOUCHSCREEN_T9) + T9_CFG_TCHTHR, &delta, 1);
+			delta = (delta >> 2) << 4;
+			ret = check_delta_full(ts, delta, 2, 0);
+		}
+		if (ts->pre_data[0] != RECALIB_UNLOCK || ts->cal_after_unlock)
+			goto give_up;
+		else {
+			if (ret == 0)
+				confirm_calibration(ts, 0, 2);
+			else /* retry, schedule next work */
+				queue_delayed_work(ts->atmel_delayed_wq, &ts->unlock_work,
+					msecs_to_jiffies(ATCHCAL_DELAY));
+		}
+	}
+
+	return;
+
+give_up:
+	printk(KERN_INFO "[TP]give up delta check\n");
+}
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS)
+static void atmel_ts_cable_vbus_work_func(struct work_struct *work)
+{
+	struct atmel_ts_data *ts;
+
+	ts = container_of(work, struct atmel_ts_data, cable_vbus_work);
+
+	if (ts->cable_vbus_status) {
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, PROCG_NOISESUPPRESSION_T48) +
+			T48_CFG_SELFREQMAX, 30);
+		initial_freq_scan(ts);
+	} else {
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, PROCG_NOISESUPPRESSION_T48) +
+			T48_CFG_SELFREQMAX,
+			ts->config_setting[NONE].config[CB_SELFREQMAX]);
+		initial_freq_scan(ts);
+	}
+}
+#endif
+
+static int psensor_tp_status_handler_func(struct notifier_block *this,
+	unsigned long status, void *unused)
+{
+	struct atmel_ts_data *ts;
+
+	ts = private_ts;
+	printk(KERN_INFO "[TP]psensor status %d -> %lu\n",
+		ts->psensor_status, status);
+	if (ts->psensor_status == 0) {
+		if (status == 1)
+			ts->psensor_status = status;
+		else
+			ts->psensor_status = 0;
+	} else
+		ts->psensor_status = status;
+
+	return NOTIFY_OK;
+}
+
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+static int touchkey_tp_status_handler_func(struct notifier_block *this,
+						unsigned long status, void *unused)
+{
+	struct atmel_ts_data *ts;
+
+	ts = private_ts;
+	if (status == 1)
+		ts->key_bypass = status;
+	else
+		ts->key_bypass = 0;
+
+	return NOTIFY_OK;
+}
+#endif
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_WLS)
+static int wlc_tp_status_handler_func(struct notifier_block *this,
+	unsigned long connect_status, void *unused)
+{
+	struct atmel_ts_data *ts;
+	int wlc_status;
+
+	wlc_status = connect_status > 0 ? CONNECTED : NONE;
+	printk(KERN_INFO "[TP]wireless charger %d\n", wlc_status);
+
+	ts = private_ts;
+	if (ts->status)
+		printk(KERN_ERR "[TP]TOUCH_ERR:ambigurous wireless charger state\n");
+
+	if (wlc_status != ts->wlc_status) {
+		ts->wlc_status = wlc_status ? CONNECTED : NONE;
+		if (!ts->status && ts->wlc_freq[0]) {
+			if (ts->wlc_status) {
+				i2c_atmel_write_byte_data(ts->client,
+					get_object_address(ts, PROCG_NOISESUPPRESSION_T48) +
+					T48_CFG_BASEFREQ,
+					ts->wlc_freq[0]);
+				i2c_atmel_write(ts->client,
+					get_object_address(ts, PROCG_NOISESUPPRESSION_T48) +
+					T48_CFG_MFFREQ,
+					ts->wlc_freq + 1, 2);
+				i2c_atmel_write_byte_data(ts->client,
+					get_object_address(ts, PROCG_NOISESUPPRESSION_T48) +
+					T48_CFG_SELFREQMAX,
+					ts->wlc_freq[3]);
+			} else {
+				i2c_atmel_write(ts->client,
+					get_object_address(ts, PROCG_NOISESUPPRESSION_T48),
+					ts->config_setting[NONE].config_T48,
+					get_object_size(ts, PROCG_NOISESUPPRESSION_T48));
+			}
+			initial_freq_scan(ts);
+		}
+		regdump_to_kernel();
+	}
+
+	return NOTIFY_OK;
+}
+#endif
+
+#if (defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_CABLE) || defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB) || defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS))
+static void cable_tp_status_handler_func(int connect_status)
+{
+	uint8_t i;
+	struct atmel_ts_data *ts;
+	ts = private_ts;
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_WLS)
+	if (connect_status == 4 || (connect_status <= 0 && ts->wlc_status)) {
+		wlc_tp_status_handler_func(NULL, connect_status == 4 ? 1 : 0, NULL);
+		return;
+	}
+#endif
+
+	printk(KERN_INFO "[TP]cable change to %d\n", connect_status);
+
+	if (connect_status != ts->status) {
+		ts->status = connect_status ? CONNECTED : NONE;
+		printk(KERN_INFO "[TP]ts->status change to %d\n", ts->status);
+		if (!ts->status && ts->wlc_status)
+			printk(KERN_ERR "[TP]TOUCH_ERR:ambigurous wireless charger state\n");
+		if (ts->status && ts->wlc_status) {
+			mutex_lock(&reload_lock);
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, PROCG_NOISESUPPRESSION_T48),
+				ts->config_setting[NONE].config_T48,
+				get_object_size(ts, PROCG_NOISESUPPRESSION_T48));
+			mutex_unlock(&reload_lock);
+			printk(KERN_INFO "[TP]cable %s overrides wireless charger\n",
+				ts->status ? "in" : "out");
+			ts->wlc_status = NONE;
+		}
+		if (ts->config_setting[CONNECTED].config[0]) {
+			mutex_lock(&reload_lock);
+
+			for (i = 0; i < ts->cable_config.cnt; i++)
+				i2c_atmel_write_byte_data(ts->client,
+					get_object_address(ts, ts->cable_config.cfg[i].objid) +
+					ts->cable_config.cfg[i].byte,
+					ts->status ? (ts->cable_config.cfg[i].value) : (ts->cable_config.cfg[i].orival));
+
+			if (ts->status == NONE && ts->noiseLine_status) {
+				i2c_atmel_write_byte_data(ts->client,
+					get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+					T9_CFG_TCHDI,
+					ts->config_setting[NONE].config_T9[T9_CFG_TCHDI]);
+				i2c_atmel_write_byte_data(ts->client,
+					get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+					T9_CFG_NEXTTCHDI,
+					ts->config_setting[NONE].config_T9[T9_CFG_NEXTTCHDI]);
+				ts->noiseLine_status = 0;
+			}
+			if (ts->status == NONE && ts->noise_err_count >= 2) {
+				for (i = 0 ; i < ts->mferr_config.cnt ; i++)
+					i2c_atmel_write_byte_data(ts->client,
+							get_object_address(ts, ts->mferr_config.cfg[i].objid) +
+							ts->mferr_config.cfg[i].byte,
+							ts->mferr_config.cfg[i].orival);
+				ts->noise_err_count = 0;
+			}
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_CABLE)
+			initial_freq_scan(ts);
+#endif
+			mutex_unlock(&reload_lock);
+		}
+		regdump_to_kernel();
+	}
+}
+#endif
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS)
+void cable_tp_status_vbus_handler_func(int code)
+{
+	struct atmel_ts_data *ts;
+	int ret;
+	ts = private_ts;
+	ts->cable_vbus_status = code;
+	ret = queue_work(ts->atmel_cable_vbus_wq, &ts->cable_vbus_work);
+	printk(KERN_INFO "[TP]cable_tp_status_vbus_handler_func: %d, ret = %d\n", code, ret);
+}
+#endif
+
+static int read_object_table(struct atmel_ts_data *ts)
+{
+	uint8_t i, type_count = 0;
+	uint8_t data[6];
+	memset(data, 0x0, sizeof(data));
+
+	ts->object_table = kzalloc(sizeof(struct object_t)*ts->id->num_declared_objects, GFP_KERNEL);
+	if (ts->object_table == NULL) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: allocate object_table failed\n");
+		return -ENOMEM;
+	}
+
+	for (i = 0; i < ts->id->num_declared_objects; i++) {
+		i2c_atmel_read(ts->client, i * 6 + 0x07, data, 6);
+		ts->object_table[i].object_type = data[OBJ_TABLE_TYPE];
+		ts->object_table[i].i2c_address =
+			data[OBJ_TABLE_LSB] | data[OBJ_TABLE_MSB] << 8;
+		ts->object_table[i].size = data[OBJ_TABLE_SIZE] + 1;
+		ts->object_table[i].instances = data[OBJ_TABLE_INSTANCES];
+		ts->object_table[i].num_report_ids = data[OBJ_TABLE_RIDS];
+		if (data[OBJ_TABLE_RIDS]) {
+			ts->object_table[i].report_ids = type_count + 1;
+			type_count += data[OBJ_TABLE_RIDS];
+		}
+		if (data[OBJ_TABLE_TYPE] == TOUCH_MULTITOUCHSCREEN_T9)
+			ts->finger_type = ts->object_table[i].report_ids;
+		printk(KERN_INFO
+			"[TP]Type: %2.2X, Start: %4.4X, Size: %2X, Instance: %2X, RD#: %2X, %2X\n",
+			ts->object_table[i].object_type , ts->object_table[i].i2c_address,
+			ts->object_table[i].size, ts->object_table[i].instances,
+			ts->object_table[i].num_report_ids, ts->object_table[i].report_ids);
+	}
+
+	return 0;
+}
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_CABLE)
+static struct t_cable_status_notifier cable_status_handler = {
+	.name = "usb_tp_connected",
+	.func = cable_tp_status_handler_func,
+};
+#endif
+
+#if (defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB) || defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS))
+static struct t_usb_status_notifier cable_status_handler = {
+	.name = "usb_tp_connected",
+	.func = cable_tp_status_handler_func,
+};
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_WLS)
+static struct notifier_block wlc_status_handler = {
+	.notifier_call = wlc_tp_status_handler_func,
+};
+#endif
+#endif
+
+static struct notifier_block psensor_status_handler = {
+	.notifier_call = psensor_tp_status_handler_func,
+};
+
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+static struct notifier_block touchkey_status_handler = {
+	.notifier_call = touchkey_tp_status_handler_func,
+};
+#endif
+
+static void erase_config(struct atmel_ts_data *ts_data, int intr)
+{
+	uint16_t startAddr, endAddr, loop_i, ret;
+	uint8_t data[7] = {0};
+
+	printk(KERN_INFO "[TP]Erase Config\n");
+	startAddr = get_object_address(ts_data, GEN_POWERCONFIG_T7);
+	if (ts_data->id->version < 0x11) {
+		endAddr = get_object_address(ts_data, PROCG_NOISESUPPRESSION_T48);
+		endAddr += get_object_size(ts_data, PROCG_NOISESUPPRESSION_T48) - 1;
+	} else {
+		endAddr = get_object_address(ts_data, PROCI_ADAPTIVETHRESHOLD_T55);
+		endAddr += get_object_size(ts_data, PROCI_ADAPTIVETHRESHOLD_T55) - 1;
+	}
+	for (loop_i = startAddr; loop_i <= endAddr; loop_i++)
+		i2c_atmel_write_byte_data(ts_data->client, loop_i, 0);
+
+	ret = i2c_atmel_write_byte_data(ts_data->client,
+			get_object_address(ts_data, GEN_COMMANDPROCESSOR_T6) +
+						T6_CFG_BACKUPNV, 0x55);
+
+	for (loop_i = 0; loop_i < 10; loop_i++) {
+		if (!gpio_get_value(intr))
+			break;
+		printk(KERN_INFO "[TP]wait for Message(%d)\n", loop_i + 1);
+		msleep(10);
+	}
+
+	i2c_atmel_read(ts_data->client,
+		get_object_address(ts_data, GEN_MESSAGEPROCESSOR_T5), data, 7);
+	printk(KERN_INFO
+		"[TP]0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X\n",
+		data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
+
+	ret = i2c_atmel_write_byte_data(ts_data->client,
+		get_object_address(ts_data, GEN_COMMANDPROCESSOR_T6) +
+		T6_CFG_RESET, 0x11);
+	msleep(100);
+}
+
+static int atmel_224e_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
+{
+	struct atmel_ts_data *ts;
+	struct atmel_i2c_platform_data *pdata;
+	int ret = 0, intr = 0;
+	uint8_t loop_i;
+	struct i2c_msg msg[2];
+	uint8_t data[16], cfgdata[2] = {0};
+	uint8_t CRC_check = 0;
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_CABLE)
+	int cable_connect_type = 0;
+#endif
+	uint16_t x_range;
+	uint16_t y_range;
+	uint8_t config_err = 0;
+
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: need I2C_FUNC_I2C\n");
+		ret = -ENODEV;
+		goto err_check_functionality_failed;
+	}
+
+	ts = kzalloc(sizeof(struct atmel_ts_data), GFP_KERNEL);
+	if (ts == NULL) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: allocate atmel_ts_data failed\n");
+		ret = -ENOMEM;
+		goto err_alloc_data_failed;
+	}
+
+	ts->atmel_wq = create_singlethread_workqueue("atmel_wq");
+	if (!ts->atmel_wq) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create workqueue atmel_wq failed\n");
+		ret = -ENOMEM;
+		goto err_create_atmel_wq_failed;
+	}
+
+	ts->atmel_delayed_wq = create_singlethread_workqueue("atmel_delayed_wq");
+	if (!ts->atmel_delayed_wq) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create workqueue atmel_delayed_wq failed\n");
+		ret = -ENOMEM;
+		goto err_create_atmel_delayed_wq_failed;
+	}
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS)
+	ts->atmel_cable_vbus_wq = create_singlethread_workqueue("atmel_cable_vbus_wq");
+	if (!ts->atmel_cable_vbus_wq) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: create workqueue atmel_delayed_wq failed\n");
+		ret = -ENOMEM;
+		goto err_create_atmel_cable_vbus_wq_failed;
+	}
+#endif
+
+	INIT_WORK(&ts->check_delta_work, atmel_ts_check_delta_work_func);
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS)
+	INIT_WORK(&ts->cable_vbus_work, atmel_ts_cable_vbus_work_func);
+#endif
+
+	INIT_DELAYED_WORK(&ts->unlock_work, atmel_ts_unlock_work_func);
+	ts->client = client;
+	i2c_set_clientdata(client, ts);
+	pdata = client->dev.platform_data;
+
+	if (pdata) {
+		ts->power = pdata->power;
+		intr = pdata->gpio_irq;
+	} else {
+		printk(KERN_INFO "[TP]No pdata information\n");
+		goto err_detect_failed;
+	}
+
+	if (ts->power)
+		ret = ts->power(1);
+
+	for (loop_i = 0; loop_i < 10; loop_i++) {
+		if (!gpio_get_value(intr))
+			break;
+		msleep(10);
+	}
+
+	if (loop_i == 10)
+		printk(KERN_INFO "[TP]No Messages after reset\n");
+
+	htc_event_enable = 0;
+
+	/* read message*/
+	msg[0].addr = ts->client->addr;
+	msg[0].flags = I2C_M_RD;
+	msg[0].len = 7;
+	msg[0].buf = data;
+	ret = i2c_transfer(client->adapter, msg, 1);
+
+	if (ret < 0) {
+		printk(KERN_INFO "[TP]No Atmel chip inside\n");
+		goto err_detect_failed;
+	}
+
+#if !defined(CONFIG_ARCH_MSM8X60)
+	if (ts->power)
+		ret = ts->power(2);
+#endif
+
+	printk(KERN_INFO
+		"[TP]0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X\n",
+		data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
+
+	if (data[MSG_RID] == 0x01 &&
+		(data[T6_MSG_STATUS] & (T6_MSG_STATUS_SIGERR|T6_MSG_STATUS_COMSERR))) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: init err: %x\n", data[T6_MSG_STATUS]);
+		goto err_detect_failed;
+	} else {
+		for (loop_i = 0; loop_i < 10; loop_i++) {
+			if (gpio_get_value(intr)) {
+				printk(KERN_INFO "[TP]No more message\n");
+				break;
+			}
+			ret = i2c_transfer(client->adapter, msg, 1);
+			printk(KERN_INFO
+				"[TP]0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X\n",
+				data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
+
+			if (!config_err && data[MSG_RID] == 0x01 && (data[T6_MSG_STATUS] & T6_MSG_STATUS_CFGERR))
+				config_err = 1;
+
+			msleep(10);
+		}
+	}
+
+	/* Read the info block data. */
+	ts->id = kzalloc(sizeof(struct info_id_t), GFP_KERNEL);
+	if (ts->id == NULL) {
+		printk(KERN_ERR "[TP]TOUCH_ERR: allocate info_id_t failed\n");
+		goto err_alloc_failed;
+	}
+	ret = i2c_atmel_read(client, 0x00, data, 7);
+
+	ts->id->family_id = data[INFO_BLK_FID];
+	ts->id->variant_id = data[INFO_BLK_VID];
+	ts->id->version = data[INFO_BLK_VER];
+	ts->id->build = data[INFO_BLK_BUILD];
+	ts->id->matrix_x_size = data[INFO_BLK_XSIZE];
+	ts->id->matrix_y_size = data[INFO_BLK_YSIZE];
+	ts->id->num_declared_objects = data[INFO_BLK_OBJS];
+
+	printk(KERN_INFO
+		"[TP]info block: 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X\n",
+		ts->id->family_id, ts->id->variant_id,
+		ts->id->version, ts->id->build,
+		ts->id->matrix_x_size, ts->id->matrix_y_size,
+		ts->id->num_declared_objects);
+
+	ret = i2c_atmel_read(client, 258, cfgdata, 2);
+	if (cfgdata[0])
+		pr_info("[TP]reg[258]=%x\n", cfgdata[0]);
+
+	/* Read object table. */
+	ret = read_object_table(ts);
+	if (ret < 0)
+		goto err_alloc_failed;
+
+	if (pdata) {
+		while (pdata->version > ts->id->version)
+			pdata++;
+		if (ts->id->version == 0x11 && ts->id->build == 0xF8)
+			while (pdata->build != 0xF8)
+				pdata++;
+		if (cfgdata[0] > 0) {
+			pr_info("[TP]pdata++\n");
+			pdata++;
+		}
+
+		if (config_err) {
+			erase_config(ts, intr);
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, SPT_GPIOPWM_T19),
+				pdata->config_T19,
+				get_object_size(ts, SPT_GPIOPWM_T19));
+			msleep(10);
+			config_err = 0;
+		}
+		if (pdata->source) {
+			i2c_atmel_write_byte_data(client,
+				get_object_address(ts, SPT_GPIOPWM_T19) + T19_CFG_CTRL,
+										T19_CFG_CTRL_ENABLE |
+										T19_CFG_CTRL_RPTEN |
+										T19_CFG_CTRL_FORCERPT);
+			for (loop_i = 0; loop_i < 10; loop_i++) {
+				if (!gpio_get_value(intr))
+					break;
+				msleep(10);
+			}
+			if (loop_i == 10)
+				printk(KERN_ERR "[TP]TOUCH_ERR: No Messages when check source\n");
+			for (loop_i = 0; loop_i < 100; loop_i++) {
+				i2c_atmel_read(ts->client, get_object_address(ts,
+					GEN_MESSAGEPROCESSOR_T5), data, 2);
+				if (data[MSG_RID] == get_rid(ts, SPT_GPIOPWM_T19)) {
+					while (((data[T19_MSG_STATUS] >> 3) & 0x1) != pdata->source)
+						pdata++;
+					break;
+				}
+			}
+		}
+
+		if ((pdata->config_T9[T9_CFG_NUMTOUCH] > 0) && (pdata->config_T9[T9_CFG_NUMTOUCH] <= 10)) {
+			ts->finger_support = pdata->config_T9[T9_CFG_NUMTOUCH];
+		} else {
+			printk(KERN_INFO "[TP]T9_CFG_NUMTOUCH=%d is over range (1~10)!!\n", pdata->config_T9[T9_CFG_NUMTOUCH]);
+			goto err_alloc_failed;
+		}
+
+		x_range = ((uint8_t)(pdata->config_T9[T9_CFG_XRANGE + 1]) << 8) +
+					(uint8_t)(pdata->config_T9[T9_CFG_XRANGE]);
+		y_range = ((uint8_t)(pdata->config_T9[T9_CFG_YRANGE + 1]) << 8) +
+					(uint8_t)(pdata->config_T9[T9_CFG_YRANGE]);
+		if ((pdata->config_T9[T9_CFG_ORIENT] & 0x1) == 0) {
+			if (x_range >= 1024)
+				ts->high_res_x_en = 1;
+			if (y_range >= 1024)
+				ts->high_res_y_en = 1;
+		} else { /* Switches the X and Y */
+			if (x_range >= 1024)
+				ts->high_res_y_en = 1;
+			if (y_range >= 1024)
+				ts->high_res_x_en = 1;
+		}
+		printk(KERN_INFO
+			"[TP]finger_type: %d, max finger: %d%s%s\n",
+			ts->finger_type, ts->finger_support,
+			ts->high_res_x_en ? ", x: 12-bit" : "",
+			ts->high_res_y_en ? ", y: 12-bit" : "");
+
+		/* infoamtion block CRC check */
+		if (pdata->object_crc[0]) {
+			ret = i2c_atmel_write_byte_data(client,
+						get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+						T6_CFG_CALIBRATE, 0x55);
+			for (loop_i = 0; loop_i < 10; loop_i++) {
+				if (!gpio_get_value(intr)) {
+					ret = i2c_atmel_read(ts->client, get_object_address(ts,
+								GEN_MESSAGEPROCESSOR_T5), data, 5);
+					if (data[MSG_RID] == get_rid(ts, GEN_COMMANDPROCESSOR_T6))
+						break;
+				}
+				msleep(10);
+			}
+			if (loop_i == 10)
+				printk(KERN_INFO "[TP]No checksum read\n");
+			else {
+				for (loop_i = 0; loop_i < 3; loop_i++) {
+					if (pdata->object_crc[loop_i] !=
+						data[T6_MSG_CHECKSUM + loop_i]) {
+						printk(KERN_INFO
+							"[TP]CRC Error: DRV=0x%2.2X,0x%2.2X,0x%2.2X  NV=0x%2.2X,0x%2.2X,0x%2.2X\n",
+							pdata->object_crc[0],
+							pdata->object_crc[1],
+							pdata->object_crc[2],
+							data[T6_MSG_CHECKSUM + 0],
+							data[T6_MSG_CHECKSUM + 1],
+							data[T6_MSG_CHECKSUM + 2]);
+						break;
+					}
+				}
+				if (loop_i == 3) {
+					printk(KERN_INFO "[TP]CRC passed: ");
+					for (loop_i = 0; loop_i < 3; loop_i++)
+						printk("0x%2.2X ", pdata->object_crc[loop_i]);
+					printk("\n");
+					CRC_check = 1;
+				}
+			}
+		}
+		ts->abs_x_min = pdata->abs_x_min;
+		ts->abs_x_max = pdata->abs_x_max;
+		ts->abs_y_min = pdata->abs_y_min;
+		ts->abs_y_max = pdata->abs_y_max;
+		ts->abs_pressure_min = pdata->abs_pressure_min;
+		ts->abs_pressure_max = pdata->abs_pressure_max;
+		ts->abs_width_min = pdata->abs_width_min;
+		ts->abs_width_max = pdata->abs_width_max;
+		ts->ATCH_EXT = &pdata->config_T8[T8_CFG_ATCHCALST];
+		ts->filter_level = pdata->filter_level;
+		ts->unlock_attr = pdata->unlock_attr;
+		ts->noiseLine_status = 0;
+		ts->workaround = pdata->workaround;
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+		ts->flt_th = pdata->flt_th;
+#endif
+		ts->report_type = pdata->report_type;
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_CABLE)
+		cable_connect_type = cable_get_connect_type();
+		if (cable_connect_type == 4)
+			ts->wlc_status = CONNECTED;
+		if (cable_connect_type != 0)
+			ts->status = CONNECTED;
+#endif
+
+#if (defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB) || defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS))
+		if (usb_get_connect_type())
+			ts->status = CONNECTED;
+		else if (htc_is_wireless_charger())
+			ts->wlc_status = CONNECTED;
+#endif
+
+		ts->config_setting[NONE].config_T7
+			= ts->config_setting[CONNECTED].config_T7
+			= pdata->config_T7;
+		ts->config_setting[NONE].config_T8
+			= ts->config_setting[CONNECTED].config_T8
+			= pdata->config_T8;
+		ts->config_setting[NONE].config_T9 = pdata->config_T9;
+		ts->config_setting[NONE].config_T48 = pdata->config_T48;
+		ts->config_setting[NONE].config_T46 = pdata->config_T46;
+		ts->config_setting[NONE].config_T35 = pdata->config_T35;
+		ts->config_setting[NONE].config_T58 = pdata->config_T58;
+
+		if (pdata->wlc_freq[0])
+			for (loop_i = 0; loop_i < 4; loop_i++)
+				ts->wlc_freq[loop_i] = pdata->wlc_freq[loop_i];
+
+		if (pdata->noise_config[0])
+			for (loop_i = 0; loop_i < 3; loop_i++)
+				ts->noise_config[loop_i] = pdata->noise_config[loop_i];
+
+		pr_info("[TP] cable cnt = %d\n", pdata->cable_config.cnt);
+
+		if (pdata->cable_config.cnt) {
+			ts->cable_config = pdata->cable_config;
+			for (loop_i = 0; loop_i < ts->cable_config.cnt; loop_i++)
+				ts->config_setting[NONE].config[loop_i] =
+					pdata->cable_config.cfg[loop_i].orival;
+
+			for (loop_i = 0; loop_i < ts->cable_config.cnt; loop_i++)
+				ts->config_setting[CONNECTED].config[loop_i] =
+					pdata->cable_config.cfg[loop_i].value;
+		}
+
+		if (pdata->call_tchthr[0])
+			for (loop_i = 0; loop_i < 2; loop_i++)
+				ts->call_tchthr[loop_i] = pdata->call_tchthr[loop_i];
+
+		if (pdata->locking_config[0])
+			ts->locking_config[0] = pdata->locking_config[0];
+
+		if (pdata->mferr_config.cnt) {
+			pr_info("[TP] mferr count = %d\n", pdata->mferr_config.cnt);
+			ts->mferr_config = pdata->mferr_config;
+			for (loop_i = 0; loop_i < ts->mferr_config.cnt; loop_i++)
+				pr_info("[TP] mferr(%02d) obj = %02d, byte = %02d, vale = %02d\n",
+					loop_i,
+					ts->mferr_config.cfg[loop_i].objid,
+					ts->mferr_config.cfg[loop_i].byte,
+					ts->mferr_config.cfg[loop_i].value);
+		}
+
+		if (pdata->cfm_calb.cnt) {
+			pr_info("[TP] T8 setting :");
+			ts->cfm_calb = pdata->cfm_calb;
+			for (loop_i = 0; loop_i < ts->cfm_calb.cnt; loop_i++)
+				printk("%d, ", ts->cfm_calb.cfg[loop_i].value);
+			printk("\n");
+		}
+
+		if (pdata->noiseLine_config[0])
+			for (loop_i = 0; loop_i < 8; loop_i++)
+				ts->noiseLine_config[loop_i] = pdata->noiseLine_config[loop_i];
+		private_ts = ts;
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_CABLE)
+		pr_info("[TP] DETECT_CABLE\n");
+		cable_detect_register_notifier(&cable_status_handler);
+#endif
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS)
+		msm_hsusb_vbus_notif_register(&cable_tp_status_vbus_handler_func);
+#endif
+
+#if (defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB) || defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS))
+		usb_register_notifier(&cable_status_handler);
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_WLS)
+		if (ts->wlc_config[0])
+			register_notifier_wireless_charger(&wlc_status_handler);
+#endif
+#endif
+
+		if (!CRC_check) {
+			printk(KERN_INFO "[TP]Config reload\n");
+			mutex_lock(&reload_lock);
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, SPT_CTECONFIG_T46),
+				pdata->config_T46, get_object_size(ts, SPT_CTECONFIG_T46));
+
+			ret = i2c_atmel_write_byte_data(client,
+						get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+						T6_CFG_BACKUPNV, 0x55);
+			msleep(10);
+
+			ret = i2c_atmel_write_byte_data(client,
+						get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+						T6_CFG_RESET, 0x11);
+			msleep(100);
+
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, GEN_COMMANDPROCESSOR_T6),
+				pdata->config_T6,
+				get_object_size(ts, GEN_COMMANDPROCESSOR_T6));
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, GEN_POWERCONFIG_T7),
+				pdata->config_T7,
+				get_object_size(ts, GEN_POWERCONFIG_T7));
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, GEN_ACQUISITIONCONFIG_T8),
+				pdata->config_T8,
+				get_object_size(ts, GEN_ACQUISITIONCONFIG_T8));
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9),
+				pdata->config_T9,
+				get_object_size(ts, TOUCH_MULTITOUCHSCREEN_T9));
+			if (ts->id->version < 0x11)
+				i2c_atmel_write(ts->client,
+					get_object_address(ts, TOUCH_KEYARRAY_T15),
+					pdata->config_T15,
+					get_object_size(ts, TOUCH_KEYARRAY_T15));
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, SPT_COMCONFIG_T18),
+				pdata->config_T18,
+				get_object_size(ts, SPT_COMCONFIG_T18));
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, SPT_GPIOPWM_T19),
+				pdata->config_T19,
+				get_object_size(ts, SPT_GPIOPWM_T19));
+			if (ts->id->version < 0x11)
+				i2c_atmel_write(ts->client,
+					get_object_address(ts, PROCI_GRIPSUPPRESSION_T40),
+					pdata->config_T40,
+					get_object_size(ts, PROCI_GRIPSUPPRESSION_T40));
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, PROCI_TOUCHSUPPRESSION_T42),
+				pdata->config_T42,
+				get_object_size(ts, PROCI_TOUCHSUPPRESSION_T42));
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, PROCG_NOISESUPPRESSION_T48),
+				pdata->config_T48,
+				get_object_size(ts, PROCG_NOISESUPPRESSION_T48));
+			if (ts->id->version >= 0x11) {
+				i2c_atmel_write(ts->client,
+					get_object_address(ts, PROCI_ADAPTIVETHRESHOLD_T55),
+					pdata->config_T55,
+					get_object_size(ts, PROCI_ADAPTIVETHRESHOLD_T55));
+				if (ts->id->version == 0x11 && ts->id->build == 0x01)
+					i2c_atmel_write(ts->client,
+						get_object_address(ts, SPT_PROTOTYPE_T35),
+						pdata->config_T35,
+						get_object_size(ts, SPT_PROTOTYPE_T35));
+				if (ts->id->version == 0x11 && ts->id->build == 0xAA)
+					i2c_atmel_write(ts->client,
+						get_object_address(ts, EXTRA_NOISE_SUPPRESSION_T58),
+						pdata->config_T58,
+						get_object_size(ts, EXTRA_NOISE_SUPPRESSION_T58));
+			}
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, PROCI_STYLUS_T47),
+				pdata->config_T47,
+				get_object_size(ts, PROCI_STYLUS_T47));
+			if (ts->id->version < 0x11)
+				i2c_atmel_write(ts->client,
+					get_object_address(ts, TOUCH_PROXIMITY_T23),
+					pdata->config_T23,
+					get_object_size(ts, TOUCH_PROXIMITY_T23));
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, SPT_SELFTEST_T25),
+				pdata->config_T25,
+				get_object_size(ts, SPT_SELFTEST_T25));
+			i2c_atmel_write(ts->client,
+				get_object_address(ts, SPT_CTECONFIG_T46),
+				pdata->config_T46,
+				get_object_size(ts, SPT_CTECONFIG_T46));
+
+			ret = i2c_atmel_write_byte_data(client,
+						get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+						T6_CFG_BACKUPNV, 0x55);
+
+			for (loop_i = 0; loop_i < 10; loop_i++) {
+				if (!gpio_get_value(intr))
+					break;
+				printk(KERN_INFO "[TP]wait for Message(%d)\n", loop_i + 1);
+				msleep(10);
+			}
+
+			i2c_atmel_read(client,
+				get_object_address(ts, GEN_MESSAGEPROCESSOR_T5), data, 7);
+			printk(KERN_INFO
+				"[TP]0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X 0x%2.2X\n",
+				data[0], data[1], data[2], data[3], data[4], data[5], data[6]);
+
+			ret = i2c_atmel_write_byte_data(client,
+						get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+						T6_CFG_RESET, 0x11);
+			msleep(100);
+			mutex_unlock(&reload_lock);
+		}
+
+		if (ts->status == CONNECTED) {
+			printk(KERN_INFO "[TP]set cable config\n");
+			if (ts->config_setting[CONNECTED].config[0]) {
+
+				for (loop_i = 0; loop_i < ts->cable_config.cnt; loop_i++)
+					i2c_atmel_write_byte_data(ts->client,
+						get_object_address(ts, ts->cable_config.cfg[loop_i].objid) +
+						ts->cable_config.cfg[loop_i].byte,
+						ts->cable_config.cfg[loop_i].value);
+
+				if (ts->id->version == 0x11 && ts->id->build == 0xAA) {
+					if (ts->status == CONNECTED)
+						i2c_atmel_write_byte_data(ts->client,
+							get_object_address(ts, EXTRA_NOISE_SUPPRESSION_T58) +
+							T58_CFG_MAXNLTHR, 55);
+					else if (ts->status == NONE)
+						i2c_atmel_write_byte_data(ts->client,
+							get_object_address(ts, EXTRA_NOISE_SUPPRESSION_T58) +
+							T58_CFG_MAXNLTHR,
+							ts->config_setting[NONE].config_T58[T58_CFG_MAXNLTHR]);
+				}
+			}
+			initial_freq_scan(ts);
+		} else if (ts->wlc_status == CONNECTED) {
+			printk(KERN_INFO "[TP]set wireless charger config\n");
+			if (ts->wlc_freq[0]) {
+				i2c_atmel_write_byte_data(ts->client,
+					get_object_address(ts, PROCG_NOISESUPPRESSION_T48) +
+					T48_CFG_BASEFREQ,
+					ts->wlc_freq[0]);
+				i2c_atmel_write(ts->client,
+					get_object_address(ts, PROCG_NOISESUPPRESSION_T48) +
+					T48_CFG_MFFREQ,
+					ts->wlc_freq + 1, 2);
+				i2c_atmel_write_byte_data(ts->client,
+					get_object_address(ts, PROCG_NOISESUPPRESSION_T48) +
+					T48_CFG_SELFREQMAX,
+					ts->wlc_freq[3]);
+			}
+			initial_freq_scan(ts);
+		}
+
+		if (ts->call_tchthr[0]) {
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) + T9_CFG_TCHTHR,
+				ts->call_tchthr[ts->status]);
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, GEN_ACQUISITIONCONFIG_T8) + T8_CFG_ATCHCALSTHR,
+				ts->call_tchthr[ts->status] - 5);
+		}
+
+		if (ts->locking_config[0]) {
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+				T9_CFG_MRGTHR,
+				ts->locking_config[0]);
+		}
+	}
+	ts->input_dev = input_allocate_device();
+	if (ts->input_dev == NULL) {
+		ret = -ENOMEM;
+		dev_err(&client->dev, "[TP]TOUCH_ERR: Failed to allocate input device\n");
+		goto err_input_dev_alloc_failed;
+	}
+	ts->input_dev->name = "atmel-touchscreen";
+	ts->input_dev->id.version = (ts->id->version << 8 | ts->id->build);
+
+	set_bit(EV_SYN, ts->input_dev->evbit);
+	set_bit(EV_KEY, ts->input_dev->evbit);
+	set_bit(EV_ABS, ts->input_dev->evbit);
+
+	set_bit(KEY_BACK, ts->input_dev->keybit);
+	set_bit(KEY_HOME, ts->input_dev->keybit);
+	set_bit(KEY_MENU, ts->input_dev->keybit);
+	set_bit(KEY_SEARCH, ts->input_dev->keybit);
+
+	if (ts->report_type == SYN_AND_REPORT_TYPE_B) {
+		input_mt_init_slots(ts->input_dev, ts->finger_support);
+	} else {
+		ts->input_dev->mtsize = ts->finger_support;
+	}
+
+	input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X,
+				ts->abs_x_min, ts->abs_x_max, 0, 0);
+	input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y,
+				ts->abs_y_min, ts->abs_y_max, 0, 0);
+	input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR,
+				ts->abs_pressure_min, ts->abs_pressure_max,
+				0, 0);
+	input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR,
+				ts->abs_width_min, ts->abs_width_max, 0, 0);
+	input_set_abs_params(ts->input_dev, ABS_MT_PRESSURE,
+				ts->abs_pressure_min, ts->abs_pressure_max,
+				0, 0);
+	input_set_abs_params(ts->input_dev, ABS_MT_AMPLITUDE,
+		0, ((ts->abs_pressure_max << 16) | ts->abs_width_max), 0, 0);
+	input_set_abs_params(ts->input_dev, ABS_MT_POSITION,
+		0, (BIT(31) | (ts->abs_x_max << 16) | ts->abs_y_max), 0, 0);
+
+	ret = input_register_device(ts->input_dev);
+	if (ret) {
+		dev_err(&client->dev,
+			"[TP]TOUCH_ERR: Unable to register %s input device\n",
+			ts->input_dev->name);
+		goto err_input_register_device_failed;
+	}
+	ret = request_threaded_irq(client->irq, NULL, atmel_irq_thread,
+		IRQF_TRIGGER_LOW | IRQF_ONESHOT, client->name, ts);
+
+	if (ret)
+		dev_err(&client->dev, "[TP]TOUCH_ERR: request_irq failed\n");
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+	ts->early_suspend.level = EARLY_SUSPEND_LEVEL_STOP_DRAWING - 1;
+	ts->early_suspend.suspend = atmel_ts_early_suspend;
+	ts->early_suspend.resume = atmel_ts_late_resume;
+	register_early_suspend(&ts->early_suspend);
+#endif
+
+#ifdef ATMEL_EN_SYSFS
+	atmel_touch_sysfs_init();
+#endif
+
+	dev_info(&client->dev, "[TP]Start touchscreen %s in interrupt mode\n",
+			ts->input_dev->name);
+
+	register_notifier_by_psensor(&psensor_status_handler);
+
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+	register_notifier_by_touchkey(&touchkey_status_handler);
+#endif
+	return 0;
+
+err_input_register_device_failed:
+	input_free_device(ts->input_dev);
+
+err_input_dev_alloc_failed:
+err_alloc_failed:
+err_detect_failed:
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS)
+	destroy_workqueue(ts->atmel_cable_vbus_wq);
+err_create_atmel_cable_vbus_wq_failed:
+#endif
+
+	destroy_workqueue(ts->atmel_delayed_wq);
+err_create_atmel_delayed_wq_failed:
+	destroy_workqueue(ts->atmel_wq);
+
+err_create_atmel_wq_failed:
+	kfree(ts);
+
+err_alloc_data_failed:
+err_check_functionality_failed:
+
+	return ret;
+}
+
+static int atmel_224e_ts_remove(struct i2c_client *client)
+{
+	struct atmel_ts_data *ts = i2c_get_clientdata(client);
+
+#ifdef ATMEL_EN_SYSFS
+	atmel_touch_sysfs_deinit();
+#endif
+
+	unregister_early_suspend(&ts->early_suspend);
+	free_irq(client->irq, ts);
+
+	destroy_workqueue(ts->atmel_delayed_wq);
+	destroy_workqueue(ts->atmel_wq);
+	if (ts->sr_input_dev != NULL)
+		input_unregister_device(ts->sr_input_dev);
+	input_unregister_device(ts->input_dev);
+	kfree(ts);
+
+	return 0;
+}
+
+static int atmel_224e_ts_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+	struct atmel_ts_data *ts = i2c_get_clientdata(client);
+	printk(KERN_INFO "[TP]%s:enter unlock 0\n", __func__);
+
+	disable_irq(client->irq);
+
+	cancel_delayed_work_sync(&ts->unlock_work);
+	if (ts->pre_data[0] == RECALIB_UNLOCK && ts->psensor_status)
+		confirm_calibration(ts, 0, 3);
+
+#if defined(CONFIG_TOUCHSCREEN_ATMEL_DETECT_USB_VBUS)
+	cancel_work_sync(&ts->cable_vbus_work);
+#endif
+
+	cancel_work_sync(&ts->check_delta_work);
+
+	ts->finger_pressed = 0;
+	ts->finger_count = 0;
+	ts->first_pressed = 0;
+
+	if (ts->psensor_status == 0) {
+		ts->pre_data[0] = RECALIB_NEED;
+		i2c_atmel_write(client,
+			get_object_address(ts, GEN_ACQUISITIONCONFIG_T8) + T8_CFG_ATCHCALST,
+			ts->ATCH_EXT, 4);
+	}
+
+	if (ts->workaround & TW_SHIFT)
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+			T9_CFG_YHICLIP, ts->config_setting[NONE].config_T9[T9_CFG_YHICLIP] - 1);
+
+	i2c_atmel_write_byte_data(client,
+		get_object_address(ts, GEN_POWERCONFIG_T7) + T7_CFG_IDLEACQINT, 0x0);
+	i2c_atmel_write_byte_data(client,
+		get_object_address(ts, GEN_POWERCONFIG_T7) + T7_CFG_ACTVACQINT, 0x0);
+	return 0;
+}
+
+static int atmel_224e_ts_resume(struct i2c_client *client)
+{
+	struct atmel_ts_data *ts = i2c_get_clientdata(client);
+	uint8_t loop_i = 0;
+
+	printk(KERN_INFO "[TP] unlock change to 1\n");
+
+	if (ts->workaround & TW_SHIFT)
+		i2c_atmel_write_byte_data(ts->client,
+			get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+			T9_CFG_YHICLIP, ts->config_setting[NONE].config_T9[T9_CFG_YHICLIP]);
+
+	if (ts->pre_data[0] == RECALIB_NEED) {
+		if (ts->call_tchthr[0] && ts->psensor_status == 2 && !ts->wlc_status) {
+			printk(KERN_INFO "[TP]raise touch threshold\n");
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) + T9_CFG_TCHTHR,
+				ts->call_tchthr[ts->status]);
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, GEN_ACQUISITIONCONFIG_T8) + T8_CFG_ATCHCALSTHR,
+				ts->call_tchthr[ts->status] - 5);
+		}
+		if (ts->locking_config[0]) {
+			i2c_atmel_write_byte_data(ts->client,
+				get_object_address(ts, TOUCH_MULTITOUCHSCREEN_T9) +
+				T9_CFG_MRGTHR,
+				ts->locking_config[0]);
+		}
+	}
+
+	i2c_atmel_write(ts->client,
+		get_object_address(ts, GEN_POWERCONFIG_T7),
+		ts->config_setting[ts->status].config_T7,
+		get_object_size(ts, GEN_POWERCONFIG_T7));
+
+	if (ts->status == NONE) {
+		if (ts->noise_state == T48_MSG_STATE_GC_ERR ||
+			ts->noise_state == T48_MSG_STATE_MF_ERR)
+			initial_freq_scan(ts);
+	}
+
+	if (ts->pre_data[0] != RECALIB_NEED) {
+		printk(KERN_INFO "[TP]resume in call, psensor status %d\n",
+			ts->psensor_status);
+		queue_work(ts->atmel_wq, &ts->check_delta_work);
+	} else {
+		msleep(1);
+		i2c_atmel_write_byte_data(client,
+			get_object_address(ts, GEN_COMMANDPROCESSOR_T6) +
+			T6_CFG_CALIBRATE, 0x55);
+	}
+
+	if (ts->report_type == SYN_AND_REPORT_TYPE_B) {
+		for (loop_i = 0; loop_i < ts->finger_support; loop_i++) {
+			input_mt_slot(ts->input_dev, loop_i);
+			input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0);
+			input_sync(ts->input_dev);
+		}
+	}
+
+	enable_irq(client->irq);
+
+	return 0;
+}
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+static void atmel_ts_early_suspend(struct early_suspend *h)
+{
+	struct atmel_ts_data *ts;
+	ts = container_of(h, struct atmel_ts_data, early_suspend);
+	atmel_224e_ts_suspend(ts->client, PMSG_SUSPEND);
+}
+
+static void atmel_ts_late_resume(struct early_suspend *h)
+{
+	struct atmel_ts_data *ts;
+	ts = container_of(h, struct atmel_ts_data, early_suspend);
+	atmel_224e_ts_resume(ts->client);
+}
+#endif
+
+static const struct i2c_device_id atml_224e_ts_i2c_id[] = {
+	{ ATMEL_MXT224E_NAME, 0 },
+	{ }
+};
+
+static struct i2c_driver atmel_224e_ts_driver = {
+	.id_table = atml_224e_ts_i2c_id,
+	.probe = atmel_224e_ts_probe,
+	.remove = atmel_224e_ts_remove,
+#ifndef CONFIG_HAS_EARLYSUSPEND
+	.suspend = atmel_224e_ts_suspend,
+	.resume = atmel_224e_ts_resume,
+#endif
+	.driver = {
+			.name = ATMEL_MXT224E_NAME,
+	},
+};
+
+static int __devinit atmel_224e_ts_init(void)
+{
+	printk(KERN_INFO "[TP]atmel_224e_ts_init():\n");
+	return i2c_add_driver(&atmel_224e_ts_driver);
+}
+
+static void __exit atmel_224e_ts_exit(void)
+{
+	i2c_del_driver(&atmel_224e_ts_driver);
+}
+
+module_init(atmel_224e_ts_init);
+module_exit(atmel_224e_ts_exit);
+
+MODULE_DESCRIPTION("ATMEL Touch driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/input/touchscreen/cy8c_cs.c b/drivers/input/touchscreen/cy8c_cs.c
new file mode 100644
index 0000000..006c089
--- /dev/null
+++ b/drivers/input/touchscreen/cy8c_cs.c
@@ -0,0 +1,813 @@
+/* drivers/input/touchscreen/cy8c_cs.c
+ *
+ * Copyright (C) 2011 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/input/cy8c_cs.h>
+#include <linux/delay.h>
+#include <linux/earlysuspend.h>
+#include <linux/hrtimer.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/gpio.h>
+#include <linux/workqueue.h>
+
+#define CY8C_I2C_RETRY_TIMES 	(10)
+#define CY8C_KEYLOCKTIME    	(1500)
+#define CY8C_KEYLOCKRESET	(6)
+
+struct cy8c_cs_data {
+	struct i2c_client *client;
+	struct input_dev *input_dev;
+	struct workqueue_struct *cy8c_wq;
+	struct work_struct work;
+	struct early_suspend early_suspend;
+	int use_irq;
+	struct hrtimer timer;
+	uint16_t version;
+	struct infor id;
+	uint16_t intr;
+	uint8_t vk_id;
+	uint8_t debug_level;
+	int *keycode;
+	int (*power)(int on);
+	int (*reset)(void);
+	int func_support;
+	struct workqueue_struct *wq_raw;
+	struct delayed_work work_raw;
+};
+
+static struct cy8c_cs_data *private_cs;
+
+static irqreturn_t cy8c_cs_irq_handler(int, void *);
+static int disable_key;
+static int reset_cnt; 
+
+extern int board_build_flag(void);
+#ifdef CONFIG_HAS_EARLYSUSPEND
+static void cy8c_cs_early_suspend(struct early_suspend *h);
+static void cy8c_cs_late_resume(struct early_suspend *h);
+#endif
+
+int i2c_cy8c_read(struct i2c_client *client, uint8_t addr, uint8_t *data, uint8_t length)
+{
+	int retry;
+
+	struct i2c_msg msg[] = {
+		{
+			.addr = client->addr,
+			.flags = 0,
+			.len = 1,
+			.buf = &addr,
+		},
+		{
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = length,
+			.buf = data,
+		}
+	};
+
+	for (retry = 0; retry < CY8C_I2C_RETRY_TIMES; retry++) {
+		if (i2c_transfer(client->adapter, msg, 2) == 2)
+			break;
+		mdelay(10);
+	}
+	if (retry == CY8C_I2C_RETRY_TIMES) {
+		printk(KERN_INFO "[cap]i2c_read_block retry over %d\n",
+			CY8C_I2C_RETRY_TIMES);
+		return -EIO;
+	}
+	return 0;
+
+}
+
+int i2c_cy8c_write(struct i2c_client *client, uint8_t addr, uint8_t *data, uint8_t length)
+{
+	int retry, loop_i;
+	uint8_t buf[length + 1];
+
+	struct i2c_msg msg[] = {
+		{
+			.addr = client->addr,
+			.flags = 0,
+			.len = length + 1,
+			.buf = buf,
+		}
+	};
+
+	buf[0] = addr;
+	for (loop_i = 0; loop_i < length; loop_i++)
+		buf[loop_i + 1] = data[loop_i];
+
+	for (retry = 0; retry < CY8C_I2C_RETRY_TIMES; retry++) {
+		if (i2c_transfer(client->adapter, msg, 1) == 1)
+			break;
+		mdelay(10);
+	}
+
+	if (retry == CY8C_I2C_RETRY_TIMES) {
+		printk(KERN_ERR "[cap]i2c_write_block retry over %d\n",
+			CY8C_I2C_RETRY_TIMES);
+		return -EIO;
+	}
+	return 0;
+
+}
+
+int i2c_cy8c_write_byte_data(struct i2c_client *client, uint8_t addr, uint8_t value)
+{
+	return i2c_cy8c_write(client, addr, &value, 1);
+}
+
+static ssize_t diff(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	int ret = 0, i;
+	char data[8] = {0};
+	struct cy8c_cs_data *cs;
+
+	pr_info("[cap] %s", __func__);
+
+	cs = private_cs;
+	ret = i2c_cy8c_write_byte_data(cs->client, CS_SELECT, CS_CMD_BASELINE);
+	if (ret < 0) {
+		pr_err("[cap] i2c Write baseline Err\n");
+		return ret;
+	}
+	msleep(100);
+	ret = i2c_cy8c_read(cs->client, CS_BL_HB, data, ARRAY_SIZE(data));
+	if (ret < 0) {
+		pr_err("[cap] i2c Read baseline Err\n");
+		return ret;
+	}
+
+	for (i = 0; i < 8 ; i += 2)
+		ret += sprintf(buf+ret, "BTN(%d)=%d, ", (i/2),
+			       (data[i] << 8 | data[i+1]));
+	ret += sprintf(buf+ret, "\n");
+
+	return ret;
+}
+static DEVICE_ATTR(diff, S_IRUGO, diff, NULL);
+
+static ssize_t reset(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	struct cy8c_cs_data *cs;
+	cs = private_cs;
+
+	pr_info("[cap] reset\n");
+	cs->reset();
+	ret = sprintf(buf, "Reset chip");
+	return ret;
+}
+static DEVICE_ATTR(reset, S_IRUGO, reset, NULL);
+
+static ssize_t stop_report(struct device *dev, struct device_attribute *attr,
+			     const char *buf, size_t count)
+{
+	int err;
+	unsigned long i = 0;
+	err = strict_strtoul(buf, 10, &i);
+
+	if (disable_key < 2 || disable_key >= 0) {
+		disable_key = i;
+		pr_info("[cap] KEY Report %s!!\n", disable_key ?
+				"DISABLE" : "ENABLE");
+	} else
+		pr_info("[cap] Parameter Error\n");
+
+	return count;
+}
+
+static ssize_t show_flag(struct device *dev, struct device_attribute *attr,
+						 char *buf)
+{
+	return sprintf(buf, "[cap] disable_key = %d\n", disable_key);
+}
+static DEVICE_ATTR(diskey, (S_IWUSR|S_IRUGO), show_flag, stop_report);
+
+static int cy8c_printcs_raw(struct cy8c_cs_data *cs, char *buf)
+{
+	int ret = 0, pos = 0, i, j, cmd[4] = {CS_CMD_BTN1, CS_CMD_BTN2, CS_CMD_BTN3, CS_CMD_BTN4};
+	char data[6] = {0}, capstate[3][10] = {"BL", "Raw", "Dlt"};
+
+	for (i = 0; i < cs->id.config; i++) {
+		ret = i2c_cy8c_write_byte_data(cs->client, CS_SELECT, cmd[i]);
+		if (ret < 0) {
+			pr_err("[cap] i2c Write inform (%d_%#x) Err\n", i+1, cmd[i]);
+			return ret;
+		}
+		msleep(50);
+		ret = i2c_cy8c_read(cs->client, CS_BL_HB, data, ARRAY_SIZE(data));
+		if (ret < 0) {
+			pr_err("[cap] i2c Read inform (%d_%#x)) Err\n", i+1, cmd[i]);
+			return ret;
+		}
+		pos += sprintf(buf+pos, "BTN(%d)", i);
+		for (j = 0; j < 6 ; j += 2)
+			pos += sprintf(buf+pos, "%s=%d, ", capstate[j/2],
+				       (data[j] << 8 | data[j+1]));
+		pos += sprintf(buf+pos, "\n");
+		memset(data, 0, sizeof(ARRAY_SIZE(data)));
+	}
+	return pos;
+}
+
+static ssize_t inform(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	int ret = 0, pos = 0;
+	char data[2] = {0};
+	struct cy8c_cs_data *cs;
+
+	cs = private_cs;
+
+	if (cs->id.version < 0x10 && cs->id.version > 0x08)
+		cs->id.version = cs->id.version << 4;
+
+	if (cs->id.version >= 0x86) {
+		memset(data, 0, sizeof(ARRAY_SIZE(data)));
+		ret = i2c_cy8c_read(cs->client, CS_INT_STATUS, data, 2);
+		if (ret < 0) {
+			pr_err("[cap] i2c Read inform INT status Err\n");
+			return ret;
+		}
+		pos += sprintf(buf+pos, "Btn code = %x, INT status= %x\n", data[0], data[1]);
+	}
+	pos += cy8c_printcs_raw(cs, buf+pos);
+
+	return pos;
+}
+static DEVICE_ATTR(inform, S_IRUGO, inform, NULL);
+
+static ssize_t cs_vendor_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	char data[3] = {0};
+	int ret = 0;
+	struct cy8c_cs_data *cs;
+	cs = private_cs;
+
+	ret = i2c_cy8c_read(cs->client, CS_FW_VERSION, data, 2);
+	if (ret < 0) {
+		pr_err("[cap] i2c Read version Err\n");
+		return ret;
+	}
+	if (cs->id.chipid == CS_CHIPID)
+		sprintf(buf, "%s_V%x\n", CYPRESS_SS_NAME, data[0]);
+	else
+		sprintf(buf, "%s_V%x\n", CYPRESS_CS_NAME, data[0]);
+	ret += strlen(buf)+1;
+
+	return ret;
+}
+static DEVICE_ATTR(vendor, S_IRUGO, cs_vendor_show, NULL);
+
+static ssize_t cy8c_cs_gpio_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	struct cy8c_cs_data *cs_data;
+	struct cy8c_i2c_cs_platform_data *pdata;
+
+	cs_data = private_cs;
+	pdata = cs_data->client->dev.platform_data;
+
+	ret = gpio_get_value(pdata->gpio_irq);
+	printk(KERN_DEBUG "[cap] GPIO_CS_INT_N=%d\n", pdata->gpio_irq);
+	sprintf(buf, "GPIO_CS_INT_N=%d\n", ret);
+	ret = strlen(buf) + 1;
+	return ret;
+}
+static DEVICE_ATTR(gpio, S_IRUGO, cy8c_cs_gpio_show, NULL);
+
+static ssize_t cy8c_cs_read_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	struct cy8c_cs_data *cs_data;
+	struct cy8c_i2c_cs_platform_data *pdata;
+
+	cs_data = private_cs;
+	pdata = cs_data->client->dev.platform_data;
+
+	ret = gpio_get_value(pdata->gpio_irq);
+	printk(KERN_DEBUG "GPIO_CS_INT_N=%d\n", pdata->gpio_irq);
+	ret = strlen(buf) + 1;
+	return ret;
+}
+static DEVICE_ATTR(read, S_IRUGO, cy8c_cs_read_show, NULL);
+
+static ssize_t debug_level_set(struct device *dev, struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	int i;
+	struct cy8c_cs_data *cs_data;
+	cs_data = private_cs;
+	if (sscanf(buf, "%d", &i) == 1 && i < 2) {
+		cs_data->debug_level = i;
+		pr_info("[cap] debug_level = %d\b", cs_data->debug_level);
+	} else
+		pr_info("[cap] Parameter Error\n");
+	return count;
+}
+
+static ssize_t debug_level_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct cy8c_cs_data *cs_data;
+	cs_data = private_cs;
+	return sprintf(buf, "[cap] debug_level = %d\n", cs_data->debug_level);
+}
+DEVICE_ATTR(debug_level, (S_IWUSR|S_IRUGO), debug_level_show, debug_level_set);
+
+static struct kobject *android_touchkey_kobj;
+
+static int cy8c_touchkey_sysfs_init(void)
+{
+	int ret;
+	android_touchkey_kobj = kobject_create_and_add("android_key", NULL);
+	if (android_touchkey_kobj == NULL) {
+		printk(KERN_ERR "%s: subsystem_register failed\n", __func__);
+		ret = -ENOMEM;
+		return ret;
+	}
+	ret = sysfs_create_file(android_touchkey_kobj, &dev_attr_gpio.attr);
+	if (ret) {
+		printk(KERN_ERR "%s: sysfs_create_file gpio failed\n", __func__);
+		return ret;
+	}
+	ret = sysfs_create_file(android_touchkey_kobj, &dev_attr_read.attr);
+	if (ret) {
+		printk(KERN_ERR "%s: sysfs_create_file read failed\n", __func__);
+		return ret;
+	}
+	ret = sysfs_create_file(android_touchkey_kobj, &dev_attr_vendor.attr);
+	if (ret) {
+		printk(KERN_ERR "%s: sysfs_create_file vendor failed\n", __func__);
+		return ret;
+	}
+	ret = sysfs_create_file(android_touchkey_kobj, &dev_attr_inform.attr);
+	if (ret) {
+		printk(KERN_ERR "%s: sysfs_create_file inform failed\n", __func__);
+		return ret;
+	}
+	ret = sysfs_create_file(android_touchkey_kobj, &dev_attr_diff.attr);
+	if (ret) {
+		printk(KERN_ERR "%s: sysfs_create_file inform failed\n", __func__);
+		return ret;
+	}
+	ret = sysfs_create_file(android_touchkey_kobj, &dev_attr_debug_level.attr);
+	if (ret) {
+		printk(KERN_ERR "%s: sysfs_create_file debug_level failed\n", __func__);
+		return ret;
+	}
+	ret = sysfs_create_file(android_touchkey_kobj, &dev_attr_reset.attr);
+	if (ret) {
+		printk(KERN_ERR "%s: sysfs_create_file debug_level failed\n", __func__);
+		return ret;
+	}
+	ret = sysfs_create_file(android_touchkey_kobj, &dev_attr_diskey.attr);
+	if (ret) {
+		printk(KERN_ERR "%s: sysfs_create_file debug_level failed\n", __func__);
+		return ret;
+	}
+	return 0;
+}
+
+static void cy8c_touchkey_sysfs_deinit(void)
+{
+	sysfs_remove_file(android_touchkey_kobj, &dev_attr_gpio.attr);
+	sysfs_remove_file(android_touchkey_kobj, &dev_attr_read.attr);
+	sysfs_remove_file(android_touchkey_kobj, &dev_attr_vendor.attr);
+	sysfs_remove_file(android_touchkey_kobj, &dev_attr_inform.attr);
+	sysfs_remove_file(android_touchkey_kobj, &dev_attr_diff.attr);
+	sysfs_remove_file(android_touchkey_kobj, &dev_attr_debug_level.attr);
+	sysfs_remove_file(android_touchkey_kobj, &dev_attr_reset.attr);
+	sysfs_remove_file(android_touchkey_kobj, &dev_attr_diskey.attr);
+	kobject_del(android_touchkey_kobj);
+}
+
+static void cy8c_rawdata_print(struct work_struct *work)
+{
+	char buf[150] = {0};
+	int pos = 0;
+	struct cy8c_cs_data *cs = container_of(work, struct cy8c_cs_data,
+					       work_raw.work);
+	pos += cy8c_printcs_raw(cs, buf+pos);
+	pos = strlen(buf)+1;
+	pr_info("[cap]%s\n", buf);
+
+	if (cs->vk_id) {
+		reset_cnt++;
+		if (reset_cnt % CY8C_KEYLOCKRESET == 0) {
+			pr_info("[cap] keylock reset\n");
+			cs->reset();
+			reset_cnt = 0;
+			cs->vk_id = 0;
+		}
+		queue_delayed_work(cs->wq_raw, &cs->work_raw,
+				   msecs_to_jiffies(CY8C_KEYLOCKTIME-500));
+	}
+}
+
+static int cy8c_init_sensor(struct cy8c_cs_data *cs, struct cy8c_i2c_cs_platform_data *pdata)
+{
+	uint8_t ver[2] = {0}, chip[2] = {0};
+	int ret = 0;
+	pr_info("[cap] %s\n", __func__);
+
+	ret = i2c_cy8c_read(cs->client, CS_FW_CHIPID, chip, 1);
+	if (ret < 0) {
+		printk(KERN_ERR "[cap_err] Chip Read Err\n");
+		goto err_fw_get_fail;
+	}
+
+	ret = i2c_cy8c_read(cs->client, CS_FW_VERSION, ver, 1);
+	if (!ret)
+		cs->id.version = ver[0];
+	else {
+		printk(KERN_ERR "[cap_err] Ver Read Err\n");
+		goto err_fw_get_fail;
+	}
+
+	if (chip[0] == CS_CHIPID) {
+		cs->id.chipid = chip[0];
+		pr_info("[cap] CY8C_Smart_V%x\n", cs->id.version);
+	} else
+		pr_info("[cap] CY8C_Cap_V%x\n", cs->id.version);
+
+	ver[0] = 0;
+	ret = i2c_cy8c_read(cs->client, CS_FW_KEYCFG, ver, 1);
+	if (ret < 0) {
+		printk(KERN_ERR "[cap_err] Config Read Err\n");
+		goto err_fw_get_fail;
+	} else {
+		if ((ver[0] != 0) && (ver[0] == CS_KEY_3 || ver[0] == CS_KEY_4))
+			cs->id.config = ver[0];
+		else
+			cs->id.config = 0;
+		pr_info("[cap] config = %d\n", cs->id.config);
+	}
+	return 0;
+
+err_fw_get_fail:
+	return ret;
+}
+
+static void report_key_func(struct cy8c_cs_data *cs, uint8_t vk)
+{
+	int ret = 0;
+	if ((cs->debug_level & 0x01) || board_build_flag() > 0)
+		pr_info("[cap] vk = %x\n", vk);
+
+	if (vk) {
+		switch (vk) {
+		case 0x01:
+			input_report_key(cs->input_dev, cs->keycode[0], 1);
+			cs->vk_id = vk;
+			break;
+		case 0x02:
+			input_report_key(cs->input_dev, cs->keycode[1], 1);
+			cs->vk_id = vk;
+			break;
+		case 0x04:
+			input_report_key(cs->input_dev, cs->keycode[2], 1);
+			cs->vk_id = vk;
+			break;
+		case 0x08:
+			input_report_key(cs->input_dev, cs->keycode[3], 1);
+			cs->vk_id = vk;
+			break;
+		}
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+		blocking_notifier_call_chain(&touchkey_notifier_list, 1, NULL);
+#endif
+	} else {
+		switch (cs->vk_id) {
+		case 0x01:
+			input_report_key(cs->input_dev, cs->keycode[0], 0);
+			break;
+		case 0x02:
+			input_report_key(cs->input_dev, cs->keycode[1], 0);
+			break;
+		case 0x04:
+			input_report_key(cs->input_dev, cs->keycode[2], 0);
+			break;
+		case 0x08:
+			input_report_key(cs->input_dev, cs->keycode[3], 0);
+			break;
+		}
+		cs->vk_id = 0;
+	}
+	input_sync(cs->input_dev);
+
+	if (cs->func_support & CS_FUNC_PRINTRAW) {
+		if (cs->vk_id) {
+			queue_delayed_work(cs->wq_raw, &cs->work_raw,
+					   msecs_to_jiffies(CY8C_KEYLOCKTIME));
+		} else {
+			ret = cancel_delayed_work_sync(&cs->work_raw);
+			if (!ret)
+				cancel_delayed_work(&cs->work_raw);
+		}
+	}
+}
+
+static void cy8c_cs_work_func(struct work_struct *work)
+{
+	struct cy8c_cs_data *cs;
+	uint8_t buf[3] = {0};
+	static	uint8_t pre_buf[3] = {0};
+
+	cs = container_of(work, struct cy8c_cs_data, work);
+
+	if (i2c_cy8c_read(cs->client, CS_STATUS, buf, 2) < 0) {
+		memset(buf, 0, sizeof(buf));
+		memset(pre_buf, 0, sizeof(pre_buf));
+		pr_err("[cap_err] %s i2c read fail", __func__);
+		goto enableirq;
+	}
+
+	if (!disable_key)
+		report_key_func(cs, buf[0]);
+
+	memcpy(pre_buf, buf, 2);
+enableirq:
+	if (!cs->use_irq)
+		hrtimer_start(&cs->timer, ktime_set(0, 20000000), HRTIMER_MODE_REL);
+	else
+		enable_irq(cs->client->irq);
+}
+
+#if 1
+static enum hrtimer_restart cy8c_cs_timer_func(struct hrtimer *timer)
+{
+	struct cy8c_cs_data *cs;
+
+	cs = container_of(timer, struct cy8c_cs_data, timer);
+	queue_work(cs->cy8c_wq, &cs->work);
+	return HRTIMER_NORESTART;
+}
+#endif
+#if 1
+static irqreturn_t cy8c_cs_irq_handler(int irq, void *dev_id)
+{
+	struct cy8c_cs_data *cs = dev_id;
+
+	disable_irq_nosync(cs->client->irq);
+	queue_work(cs->cy8c_wq, &cs->work);
+	return IRQ_HANDLED;
+}
+#endif
+
+static int cy8c_cs_probe(struct i2c_client *client,
+					const struct i2c_device_id *id)
+{
+	struct cy8c_cs_data *cs;
+	struct cy8c_i2c_cs_platform_data *pdata;
+	int ret = 0;
+
+	printk(KERN_DEBUG "[cap] %s: enter\n", __func__);
+
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		printk(KERN_ERR "[cap_err] need I2C_FUNC_I2C\n");
+		ret = -ENODEV;
+		goto err_check_functionality_failed;
+	}
+
+	cs = kzalloc(sizeof(struct cy8c_cs_data), GFP_KERNEL);
+	if (cs == NULL) {
+		printk(KERN_ERR "[cap_err] allocate cy8c_cs_data failed\n");
+		ret = -ENOMEM;
+		goto err_alloc_data_failed;
+	}
+
+	cs->client = client;
+	i2c_set_clientdata(client, cs);
+	pdata = client->dev.platform_data;
+
+	if (pdata) {
+		pdata->reset();
+		msleep(50);
+		cs->intr = pdata->gpio_irq;
+	}
+
+	if (cy8c_init_sensor(cs, pdata) < 0) {
+		pr_err("[cap_err] init failure, not probe up driver\n");
+		goto err_init_sensor_failed;
+	}
+	if (pdata) {
+		if (pdata->id.config != cs->id.config) {
+			pr_info("[cap] pdata ++\n");
+			pdata++;
+		}
+	}
+
+	cs->cy8c_wq = create_singlethread_workqueue("cypress_touchkey");
+	if (!cs->cy8c_wq) {
+		printk(KERN_ERR "[cap_err] create_singlethread_workqueue cy8c_wq fail\n");
+		goto err_create_wq_failed;
+	}
+	INIT_WORK(&cs->work, cy8c_cs_work_func);
+
+	cs->input_dev = input_allocate_device();
+	if (cs->input_dev == NULL) {
+		ret = -ENOMEM;
+		printk(KERN_ERR "[cap_err] Failed to allocate input device\n");
+		goto err_input_dev_alloc_failed;
+	}
+	cs->input_dev->name       = "cy8c-touchkey";
+	cs->input_dev->id.product = cs->id.chipid;
+	cs->input_dev->id.version = cs->id.version;
+	cs->func_support          = pdata->func_support;
+	cs->keycode               = pdata->keycode;
+	cs->reset                 = pdata->reset;
+
+	set_bit(EV_SYN, cs->input_dev->evbit);
+	set_bit(EV_KEY, cs->input_dev->evbit);
+
+	set_bit(KEY_BACK, cs->input_dev->keybit);
+	set_bit(KEY_HOME, cs->input_dev->keybit);
+	set_bit(KEY_APP_SWITCH, cs->input_dev->keybit);
+	set_bit(KEY_MENU, cs->input_dev->keybit);
+
+	set_bit(KEY_SEARCH, cs->input_dev->keybit);
+	set_bit(KEY_WEIBO, cs->input_dev->keybit);
+
+	ret = input_register_device(cs->input_dev);
+	if (ret) {
+		printk(KERN_ERR "[cap_err] unable to register %s input device\n",
+			cs->input_dev->name);
+
+		goto err_input_register_device_failed;
+	}
+
+	private_cs = cs;
+
+	if (cs->func_support & CS_FUNC_PRINTRAW) {
+		pr_info("[cap]support_keylock(%x)\n", cs->func_support);
+		cs->wq_raw = create_singlethread_workqueue("CY8C_print_rawdata");
+		if (!cs->wq_raw) {
+			pr_err("[cap]allocate cy8c_cs_print_rawdata failed\n");
+			ret = -ENOMEM;
+			goto err_input_register_device_failed;
+		}
+		INIT_DELAYED_WORK(&cs->work_raw, cy8c_rawdata_print);
+	}
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+	cs->early_suspend.level   = EARLY_SUSPEND_LEVEL_STOP_DRAWING;
+	cs->early_suspend.suspend = cy8c_cs_early_suspend;
+	cs->early_suspend.resume  = cy8c_cs_late_resume;
+	register_early_suspend(&cs->early_suspend);
+#endif
+	cy8c_touchkey_sysfs_init();
+
+	cs->use_irq = 1;
+	if (client->irq && cs->use_irq) {
+		ret = request_irq(client->irq, cy8c_cs_irq_handler,
+				  IRQF_TRIGGER_FALLING,
+				  cs->id.chipid == CS_CHIPID ? CYPRESS_SS_NAME : CYPRESS_CS_NAME,
+				  cs);
+		if (ret < 0) {
+			dev_err(&client->dev, "[cap_err]request_irq failed\n");
+			printk(KERN_ERR "[cap_err] request_irq failed for gpio %d,"
+			       " irq %d\n", cs->intr, client->irq);
+		}
+	}
+
+	if (!cs->use_irq) {
+		hrtimer_init(&cs->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+		cs->timer.function = cy8c_cs_timer_func;
+		hrtimer_start(&cs->timer, ktime_set(1, 0), HRTIMER_MODE_REL);
+	}
+
+	return 0;
+
+err_input_register_device_failed:
+	input_free_device(cs->input_dev);
+
+err_input_dev_alloc_failed:
+	destroy_workqueue(cs->cy8c_wq);
+err_init_sensor_failed:
+err_create_wq_failed:
+	kfree(cs);
+
+err_alloc_data_failed:
+err_check_functionality_failed:
+	return ret;
+}
+
+static int cy8c_cs_remove(struct i2c_client *client)
+{
+	struct cy8c_cs_data *cs = i2c_get_clientdata(client);
+
+	cy8c_touchkey_sysfs_deinit();
+
+	unregister_early_suspend(&cs->early_suspend);
+	free_irq(client->irq, cs);
+	input_unregister_device(cs->input_dev);
+
+	kfree(cs);
+
+	return 0;
+}
+
+static int cy8c_cs_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+	int ret;
+	struct cy8c_cs_data *cs = i2c_get_clientdata(client);
+
+	pr_info("[cap] %s\n", __func__);
+
+	if (cs->func_support & CS_FUNC_PRINTRAW) {
+		ret = cancel_delayed_work_sync(&cs->work_raw);
+		if (!ret)
+			cancel_delayed_work(&cs->work_raw);
+	}
+	if (client->irq && cs->use_irq) {
+		disable_irq(client->irq);
+		ret = cancel_work_sync(&cs->work);
+		if (ret)
+			enable_irq(client->irq);
+	}
+	i2c_cy8c_write_byte_data(client, CS_MODE, CS_CMD_DSLEEP);
+	return 0;
+}
+
+static int cy8c_cs_resume(struct i2c_client *client)
+{
+	struct cy8c_cs_data *cs = i2c_get_clientdata(client);
+
+	pr_info("[cap] %s\n", __func__);
+	cs->reset();
+
+	msleep(50);
+
+	if (client->irq && cs->use_irq)
+		enable_irq(client->irq);
+	return 0;
+}
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+static void cy8c_cs_early_suspend(struct early_suspend *h)
+{
+	struct cy8c_cs_data *ts;
+	ts = container_of(h, struct cy8c_cs_data, early_suspend);
+	cy8c_cs_suspend(ts->client, PMSG_SUSPEND);
+}
+
+static void cy8c_cs_late_resume(struct early_suspend *h)
+{
+	struct cy8c_cs_data *ts;
+	ts = container_of(h, struct cy8c_cs_data, early_suspend);
+	cy8c_cs_resume(ts->client);
+}
+#endif
+
+static const struct i2c_device_id cy8c_cs_id[] = {
+	{ CYPRESS_CS_NAME, 0 },
+};
+
+static struct i2c_driver cy8c_cs_driver = {
+	.probe		= cy8c_cs_probe,
+	.remove		= cy8c_cs_remove,
+	.id_table	= cy8c_cs_id,
+#ifndef CONFIG_HAS_EARLYSUSPEND
+	.suspend	= cy8c_cs_suspend,
+	.resume		= cy8c_cs_resume,
+#endif
+	.driver		= {
+		.name = CYPRESS_CS_NAME,
+	},
+};
+
+static int __init cy8c_cs_init(void)
+{
+	printk(KERN_INFO "[cap] %s: enter\n", __func__);
+	return i2c_add_driver(&cy8c_cs_driver);
+}
+
+static void __exit cy8c_cs_exit(void)
+{
+	i2c_del_driver(&cy8c_cs_driver);
+}
+
+module_init(cy8c_cs_init);
+module_exit(cy8c_cs_exit);
+
+MODULE_DESCRIPTION("cy8c_cs driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 503c709..908407e 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -48,7 +48,7 @@
 	struct input_dev *input;
 	struct work_struct work;
 	struct mutex mutex;
-	int irq, irq_active_high;
+	int irq_gpio, irq, irq_active_high;
 };
 
 #define EETI_TS_BITDEPTH	(11)
@@ -62,7 +62,7 @@
 
 static inline int eeti_ts_irq_active(struct eeti_ts_priv *priv)
 {
-	return gpio_get_value(irq_to_gpio(priv->irq)) == priv->irq_active_high;
+	return gpio_get_value(priv->irq_gpio) == priv->irq_active_high;
 }
 
 static void eeti_ts_read(struct work_struct *work)
@@ -157,7 +157,7 @@
 static int __devinit eeti_ts_probe(struct i2c_client *client,
 				   const struct i2c_device_id *idp)
 {
-	struct eeti_ts_platform_data *pdata;
+	struct eeti_ts_platform_data *pdata = client->dev.platform_data;
 	struct eeti_ts_priv *priv;
 	struct input_dev *input;
 	unsigned int irq_flags;
@@ -199,9 +199,12 @@
 
 	priv->client = client;
 	priv->input = input;
-	priv->irq = client->irq;
+	priv->irq_gpio = pdata->irq_gpio;
+	priv->irq = gpio_to_irq(pdata->irq_gpio);
 
-	pdata = client->dev.platform_data;
+	err = gpio_request_one(pdata->irq_gpio, GPIOF_IN, client->name);
+	if (err < 0)
+		goto err1;
 
 	if (pdata)
 		priv->irq_active_high = pdata->irq_active_high;
@@ -215,13 +218,13 @@
 
 	err = input_register_device(input);
 	if (err)
-		goto err1;
+		goto err2;
 
 	err = request_irq(priv->irq, eeti_ts_isr, irq_flags,
 			  client->name, priv);
 	if (err) {
 		dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
-		goto err2;
+		goto err3;
 	}
 
 	/*
@@ -233,9 +236,11 @@
 	device_init_wakeup(&client->dev, 0);
 	return 0;
 
-err2:
+err3:
 	input_unregister_device(input);
 	input = NULL; /* so we dont try to free it below */
+err2:
+	gpio_free(pdata->irq_gpio);
 err1:
 	input_free_device(input);
 	kfree(priv);
diff --git a/drivers/input/touchscreen/rmi_dev.c b/drivers/input/touchscreen/rmi_dev.c
new file mode 100644
index 0000000..78aface
--- /dev/null
+++ b/drivers/input/touchscreen/rmi_dev.c
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2011 Synaptics Incorporated
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/fs.h>
+#include <linux/delay.h>
+#include <linux/uaccess.h>
+#include <linux/slab.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/syscalls.h>
+#include <linux/i2c.h>
+#include <linux/rmi.h>
+
+#define CHAR_DEVICE_NAME "rmi"
+
+#define REG_ADDR_LIMIT 0xFFFF
+
+static int rmi_char_dev_major_num;
+
+
+
+static loff_t rmi_char_dev_llseek(struct file *filp, loff_t off, int whence)
+{
+	loff_t newpos;
+	struct rmi_char_dev *my_char_dev = filp->private_data;
+
+	if (IS_ERR(my_char_dev)) {
+		pr_err("%s: pointer of char device is invalid", __func__);
+		return -EBADF;
+	}
+
+	mutex_lock(&(my_char_dev->mutex_file_op));
+
+	switch (whence) {
+	case SEEK_SET:
+		newpos = off;
+		break;
+
+	case SEEK_CUR:
+		newpos = filp->f_pos + off;
+		break;
+
+	case SEEK_END:
+		newpos = REG_ADDR_LIMIT + off;
+		break;
+
+	default:		
+		newpos = -EINVAL;
+		goto clean_up;
+	}
+
+	if (newpos < 0 || newpos > REG_ADDR_LIMIT) {
+		dev_err(my_char_dev->phys->dev, "newpos 0x%04x is invalid.\n",
+			(unsigned int)newpos);
+		newpos = -EINVAL;
+		goto clean_up;
+	}
+
+	filp->f_pos = newpos;
+
+clean_up:
+	mutex_unlock(&(my_char_dev->mutex_file_op));
+	return newpos;
+}
+
+static ssize_t rmi_char_dev_read(struct file *filp, char __user *buf,
+		size_t count, loff_t *f_pos)
+{
+	struct rmi_char_dev *my_char_dev = filp->private_data;
+	ssize_t ret_value  = 0;
+	unsigned char tmpbuf[count+1];
+	
+
+	
+	if (count > (REG_ADDR_LIMIT - *f_pos))
+		count = REG_ADDR_LIMIT - *f_pos;
+
+	if (count == 0)
+		return 0;
+
+	if (IS_ERR(my_char_dev)) {
+		pr_err("%s: pointer of char device is invalid", __func__);
+		ret_value = -EBADF;
+		return ret_value;
+	}
+
+	mutex_lock(&(my_char_dev->mutex_file_op));
+
+	
+
+	
+	ret_value = i2c_rmi_read(*f_pos, tmpbuf, count);
+
+
+	if (ret_value < 0)
+		goto clean_up;
+	else
+		*f_pos += ret_value;
+
+	if (copy_to_user(buf, tmpbuf, count))
+		ret_value = -EFAULT;
+
+clean_up:
+
+	mutex_unlock(&(my_char_dev->mutex_file_op));
+
+	return ret_value;
+}
+
+static ssize_t rmi_char_dev_write(struct file *filp, const char __user *buf,
+		size_t count, loff_t *f_pos)
+{
+	struct rmi_char_dev *my_char_dev = filp->private_data;
+	ssize_t ret_value  = 0;
+	unsigned char tmpbuf[count+1];
+	
+
+	
+	if (count > (REG_ADDR_LIMIT - *f_pos))
+		count = REG_ADDR_LIMIT - *f_pos;
+
+	if (count == 0)
+		return 0;
+
+	if (IS_ERR(my_char_dev)) {
+		pr_err("%s: pointer of char device is invalid", __func__);
+		ret_value = -EBADF;
+		return ret_value;
+	}
+
+	if (copy_from_user(tmpbuf, buf, count)) {
+		ret_value = -EFAULT;
+		return ret_value;
+	}
+
+	mutex_lock(&(my_char_dev->mutex_file_op));
+
+	
+
+	
+	ret_value = i2c_rmi_write(*f_pos, tmpbuf, count);
+
+	if (ret_value >= 0)
+		*f_pos += count;
+
+	mutex_unlock(&(my_char_dev->mutex_file_op));
+
+	return ret_value;
+}
+
+static int rmi_char_dev_open(struct inode *inp, struct file *filp)
+{
+	
+	struct rmi_char_dev *my_dev = container_of(inp->i_cdev,
+			struct rmi_char_dev, main_dev);
+	
+	int ret_value = 0;
+
+	filp->private_data = my_dev;
+
+	
+		
+
+	mutex_lock(&(my_dev->mutex_file_op));
+	if (my_dev->ref_count < 1)
+		my_dev->ref_count++;
+	else
+		ret_value = -EACCES;
+
+	mutex_unlock(&(my_dev->mutex_file_op));
+
+	return ret_value;
+}
+
+static int rmi_char_dev_release(struct inode *inp, struct file *filp)
+{
+	struct rmi_char_dev *my_dev = container_of(inp->i_cdev,
+			struct rmi_char_dev, main_dev);
+
+	mutex_lock(&(my_dev->mutex_file_op));
+
+	my_dev->ref_count--;
+	if (my_dev->ref_count < 0)
+		my_dev->ref_count = 0;
+
+	mutex_unlock(&(my_dev->mutex_file_op));
+
+	return 0;
+}
+
+static const struct file_operations rmi_char_dev_fops = {
+	.owner =    THIS_MODULE,
+	.llseek =   rmi_char_dev_llseek,
+	.read =     rmi_char_dev_read,
+	.write =    rmi_char_dev_write,
+	.open =     rmi_char_dev_open,
+	.release =  rmi_char_dev_release,
+};
+
+static void rmi_char_dev_clean_up(struct rmi_char_dev *char_dev,
+			struct class *char_device_class)
+{
+	dev_t devno;
+
+	
+	if (char_dev) {
+		devno = char_dev->main_dev.dev;
+
+		cdev_del(&char_dev->main_dev);
+		kfree(char_dev);
+
+		if (char_device_class) {
+			device_destroy(char_device_class, devno);
+			class_unregister(char_device_class);
+			class_destroy(char_device_class);
+		}
+
+		
+		unregister_chrdev_region(devno, 1);
+		pr_debug("%s: rmi_char_dev is removed\n", __func__);
+	}
+}
+
+static char *rmi_char_devnode(struct device *dev, mode_t *mode)
+{
+	if (!mode)
+		return NULL;
+	
+	
+	*mode = (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
+
+	return kasprintf(GFP_KERNEL, "rmi/%s", dev_name(dev));
+}
+
+int rmi_char_dev_register(void)
+{
+	struct rmi_char_dev *char_dev;
+	dev_t dev_no;
+	int err;
+	int result;
+	struct device *device_ptr;
+	struct class *rmi_char_device_class;
+
+	if (rmi_char_dev_major_num) {
+		dev_no = MKDEV(rmi_char_dev_major_num, 0);
+		result = register_chrdev_region(dev_no, 1, CHAR_DEVICE_NAME);
+	} else {
+		result = alloc_chrdev_region(&dev_no, 0, 1, CHAR_DEVICE_NAME);
+		
+		rmi_char_dev_major_num = MAJOR(dev_no);
+		printk(KERN_ERR "Major number of rmi_char_dev: %d\n",
+				 rmi_char_dev_major_num);
+	}
+	if (result < 0)
+		return result;
+
+	char_dev = kzalloc(sizeof(struct rmi_char_dev), GFP_KERNEL);
+	if (!char_dev) {
+		printk(KERN_ERR "Failed to allocate rmi_char_dev.\n");
+		
+		__unregister_chrdev(rmi_char_dev_major_num, MINOR(dev_no), 1,
+				CHAR_DEVICE_NAME);
+		return -ENOMEM;
+	}
+
+	mutex_init(&char_dev->mutex_file_op);
+
+
+	cdev_init(&char_dev->main_dev, &rmi_char_dev_fops);
+
+	err = cdev_add(&char_dev->main_dev, dev_no, 1);
+	if (err) {
+		printk(KERN_ERR "Error %d adding rmi_char_dev.\n", err);
+		
+		
+		return err;
+	}
+
+	
+	rmi_char_device_class =
+		class_create(THIS_MODULE, CHAR_DEVICE_NAME);
+
+	if (IS_ERR(rmi_char_device_class)) {
+		printk(KERN_INFO "Failed to create /dev/%s.\n",
+			CHAR_DEVICE_NAME);
+		rmi_char_dev_clean_up(char_dev,
+				 rmi_char_device_class);
+		return -ENODEV;
+	}
+	
+	rmi_char_device_class->devnode = rmi_char_devnode;
+
+	
+	device_ptr = device_create(
+			rmi_char_device_class,
+			NULL, dev_no, NULL,
+			CHAR_DEVICE_NAME"%d",
+			MINOR(dev_no));
+
+	if (IS_ERR(device_ptr)) {
+		printk(KERN_ERR "Failed to create rmi device.\n");
+		rmi_char_dev_clean_up(char_dev,
+				 rmi_char_device_class);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(rmi_char_dev_register);
+
+
+void rmi_char_dev_unregister(struct rmi_phys_device *phys)
+{
+	
+	if (phys)
+		rmi_char_dev_clean_up(phys->char_dev,
+				 phys->rmi_char_device_class);
+}
+EXPORT_SYMBOL(rmi_char_dev_unregister);
+
+MODULE_AUTHOR("Synaptics, Inc.");
+MODULE_DESCRIPTION("RMI4 Char Device");
+MODULE_LICENSE("GPL");
diff --git a/drivers/input/touchscreen/synaptics_3200.c b/drivers/input/touchscreen/synaptics_3200.c
new file mode 100644
index 0000000..f217a5f
--- /dev/null
+++ b/drivers/input/touchscreen/synaptics_3200.c
@@ -0,0 +1,2976 @@
+/* drivers/input/touchscreen/synaptics_3200.c - Synaptics 3200 serious touch panel driver
+ *
+ * Copyright (C) 2011 HTC Corporation.
+ *
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/earlysuspend.h>
+#include <linux/hrtimer.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <linux/synaptics_i2c_rmi.h>
+#include <linux/slab.h>
+#include <linux/rmi.h>
+#include <mach/board.h>
+#include <mach/msm_hsusb.h>
+#include <asm/gpio.h>
+#include <linux/input/mt.h>
+#include <linux/pl_sensor.h>
+
+#define SYN_I2C_RETRY_TIMES 10
+#define SHIFT_BITS 10
+#define SYN_WIRELESS_DEBUG
+
+struct synaptics_ts_data {
+	uint16_t addr;
+	struct i2c_client *client;
+	struct input_dev *input_dev;
+	struct input_dev *sr_input_dev;
+	struct workqueue_struct *syn_wq;
+	struct function_t *address_table;
+	int use_irq;
+	int gpio_irq;
+	int gpio_reset;
+	struct hrtimer timer;
+	struct work_struct  work;
+	uint16_t max[2];
+	uint32_t flags;
+	uint8_t num_function;
+	uint8_t finger_support;
+	uint16_t finger_pressed;
+	int (*power)(int on);
+	struct early_suspend early_suspend;
+	int pre_finger_data[11][4];
+	uint32_t debug_log_level;
+	uint32_t raw_base;
+	uint32_t raw_ref;
+	uint64_t timestamp;
+	uint16_t *filter_level;
+	uint8_t *reduce_report_level;
+	unsigned long tap_timeout[10];
+	int16_t *report_data;
+	uint8_t *temp_report_data;
+	uint8_t grip_suppression;
+	uint8_t grip_b_suppression;
+	uint16_t tap_suppression;
+	uint8_t ambiguous_state;
+	uint8_t diag_command;
+	uint8_t cable_support;
+	uint8_t cable_config;
+	uint8_t key_number;
+	uint16_t key_postion_x[4];
+	uint16_t key_postion_y;
+	uint8_t intr_bit;
+	uint8_t finger_count;
+	uint8_t page_select;
+	uint8_t config_table[SYN_CONFIG_SIZE];
+	uint8_t x_channel;
+	uint8_t y_channel;
+	uint8_t *config;
+	uint32_t config_version;
+	uint16_t package_id;
+	uint32_t packrat_number;
+	int layout[4];
+	uint8_t htc_event;
+	atomic_t data_ready;
+	uint8_t relaxation;
+	uint8_t irq_enabled;
+	uint8_t large_obj_check;
+	uint8_t default_large_obj;
+	uint16_t tw_vendor;
+	uint16_t tw_pin_mask;
+	uint8_t support_htc_event;
+	uint8_t mfg_flag;
+	uint8_t first_pressed;
+	uint8_t segmentation_bef_unlock;
+	uint8_t segmentation_aft_unlock;
+	uint8_t psensor_status;
+	uint8_t i2c_err_handler_en;
+	uint8_t threshold_bef_unlock;
+	uint8_t threshold_aft_unlock;
+	uint16_t saturation_bef_unlock;
+	uint16_t saturation_aft_unlock;
+	uint8_t energy_ratio_relaxation;
+	uint8_t multitouch_calibration;
+	uint32_t width_factor;
+	uint32_t height_factor;
+	uint8_t psensor_detection;
+	uint8_t psensor_resume_enable;
+	uint8_t psensor_phone_enable;
+	uint8_t PixelTouchThreshold_bef_unlock;
+	uint8_t PixelTouchThreshold_aft_unlock;
+	struct work_struct  psensor_work;
+	struct workqueue_struct *syn_psensor_wq;
+	struct synaptics_virtual_key *button;
+};
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+static void synaptics_ts_early_suspend(struct early_suspend *h);
+static void synaptics_ts_late_resume(struct early_suspend *h);
+#endif
+
+static DECLARE_WAIT_QUEUE_HEAD(syn_data_ready_wq);
+static DEFINE_MUTEX(syn_mutex);
+
+static struct synaptics_ts_data *gl_ts;
+static uint16_t syn_panel_version;
+static uint8_t vk_press;
+
+static int i2c_syn_write_byte_data(struct i2c_client *client, uint16_t addr, uint8_t value);
+static int syn_pdt_scan(struct synaptics_ts_data *ts, int num_page);
+static int synaptics_init_panel(struct synaptics_ts_data *ts);
+
+static irqreturn_t synaptics_irq_thread(int irq, void *ptr);
+
+extern unsigned int get_tamper_sf(void);
+
+static void syn_page_select(struct i2c_client *client, uint8_t page)
+{
+	struct synaptics_ts_data *ts = i2c_get_clientdata(client);
+	if (page ^ ts->page_select) {
+		i2c_smbus_write_byte_data(client, 0xFF, page);
+		ts->page_select = page;
+	}
+
+}
+
+static int i2c_syn_read(struct i2c_client *client, uint16_t addr, uint8_t *data, uint16_t length)
+{
+	uint8_t retry, buf;
+
+	struct i2c_msg msg[] = {
+		{
+			.addr = client->addr,
+			.flags = 0,
+			.len = 1,
+			.buf = &buf,
+		},
+		{
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = length,
+			.buf = data,
+		}
+	};
+	buf = addr & 0xFF;
+
+	mutex_lock(&syn_mutex);
+	syn_page_select(client, addr >> 8);
+	for (retry = 0; retry < SYN_I2C_RETRY_TIMES; retry++) {
+		if (i2c_transfer(client->adapter, msg, 2) == 2)
+			break;
+		msleep(10);
+	}
+	mutex_unlock(&syn_mutex);
+
+	if (retry == SYN_I2C_RETRY_TIMES) {
+		printk(KERN_INFO "[TP] i2c_read retry over %d\n",
+			SYN_I2C_RETRY_TIMES);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int i2c_syn_write(struct i2c_client *client, uint16_t addr, uint8_t *data, uint16_t length)
+{
+	uint8_t retry;
+	uint8_t buf[length + 1];
+
+	struct i2c_msg msg[] = {
+		{
+			.addr = client->addr,
+			.flags = 0,
+			.len = length + 1,
+			.buf = buf,
+		}
+	};
+
+	mutex_lock(&syn_mutex);
+	syn_page_select(client, addr >> 8);
+
+	buf[0] = addr & 0xFF;
+	memcpy(&buf[1], &data[0], length);
+
+	for (retry = 0; retry < SYN_I2C_RETRY_TIMES; retry++) {
+		if (i2c_transfer(client->adapter, msg, 1) == 1)
+			break;
+		mdelay(10);
+	}
+	mutex_unlock(&syn_mutex);
+
+	if (retry == SYN_I2C_RETRY_TIMES) {
+		printk(KERN_INFO "[TP] i2c_write retry over %d\n",
+			SYN_I2C_RETRY_TIMES);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+int i2c_rmi_read(uint16_t addr, uint8_t *data, uint16_t length)
+{
+	uint8_t retry, buf;
+	struct synaptics_ts_data *ts = gl_ts;
+	struct i2c_msg msg[] = {
+		{
+			.addr = ts->client->addr,
+			.flags = 0,
+			.len = 1,
+			.buf = &buf,
+		},
+		{
+			.addr = ts->client->addr,
+			.flags = I2C_M_RD,
+			.len = length,
+			.buf = data,
+		}
+	};
+	buf = addr & 0xFF;
+
+	mutex_lock(&syn_mutex);
+	syn_page_select(ts->client, addr >> 8);
+	for (retry = 0; retry < SYN_I2C_RETRY_TIMES; retry++) {
+		if (i2c_transfer(ts->client->adapter, msg, 2) == 2)
+			break;
+		msleep(10);
+	}
+	mutex_unlock(&syn_mutex);
+
+	if (retry == SYN_I2C_RETRY_TIMES) {
+		printk(KERN_INFO "[TP] i2c_read retry over %d\n",
+			SYN_I2C_RETRY_TIMES);
+		return -EIO;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(i2c_rmi_read);
+
+int i2c_rmi_write(uint16_t addr, uint8_t *data, uint16_t length)
+{
+	uint8_t retry;
+	uint8_t buf[length + 1];
+	struct synaptics_ts_data *ts = gl_ts;
+	struct i2c_msg msg[] = {
+		{
+			.addr = ts->client->addr,
+			.flags = 0,
+			.len = length + 1,
+			.buf = buf,
+		}
+	};
+
+	mutex_lock(&syn_mutex);
+	syn_page_select(ts->client, addr >> 8);
+
+	buf[0] = addr & 0xFF;
+	memcpy(&buf[1], &data[0], length);
+
+	for (retry = 0; retry < SYN_I2C_RETRY_TIMES; retry++) {
+		if (i2c_transfer(ts->client->adapter, msg, 1) == 1)
+			break;
+		mdelay(10);
+	}
+	mutex_unlock(&syn_mutex);
+
+	if (retry == SYN_I2C_RETRY_TIMES) {
+		printk(KERN_INFO "[TP] i2c_write retry over %d\n",
+			SYN_I2C_RETRY_TIMES);
+		return -EIO;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(i2c_rmi_write);
+
+static int i2c_syn_write_byte_data(struct i2c_client *client, uint16_t addr, uint8_t value)
+{
+	return i2c_syn_write(client, addr, &value, 1);
+}
+
+static int i2c_syn_error_handler(struct synaptics_ts_data *ts, uint8_t reset, char *reason, const char *fun_name)
+{
+	int ret;
+
+	if (reason && fun_name)
+		printk(KERN_ERR "[TP] TOUCH_ERR: I2C Error: %s:%s, reset = %d\n", fun_name, reason, reset);
+	else
+		printk(KERN_INFO "[TP] %s: rason and fun_name can't be null\n", __func__);
+
+	if (reset) {
+		if (ts->power) {
+			ret = ts->power(0);
+			if (ret < 0)
+				printk(KERN_ERR "[TP] TOUCH_ERR: synaptics i2c error handler power off failed\n");
+			msleep(10);
+			ret = ts->power(1);
+			if (ret < 0)
+				printk(KERN_ERR "[TP] TOUCH_ERR: synaptics i2c error handler power on failed\n");
+			ret = synaptics_init_panel(ts);
+			if (ret < 0)
+				printk(KERN_ERR "[TP] TOUCH_ERR: synaptics i2c error handler init panel failed\n");
+		} else if (ts->gpio_reset) {
+			gpio_direction_output(ts->gpio_reset, 0);
+			msleep(1);
+			gpio_direction_output(ts->gpio_reset, 1);
+			printk(KERN_INFO "[TP] %s: synaptics touch chip reseted.\n", __func__);
+		}
+
+		if (!ts->use_irq) {
+			hrtimer_cancel(&ts->timer);
+			hrtimer_start(&ts->timer, ktime_set(1, 0), HRTIMER_MODE_REL);
+		}
+	}
+
+	return -EIO;
+}
+
+static int get_address_base(struct synaptics_ts_data *ts, uint8_t command, uint8_t type)
+{
+	uint8_t i;
+	for (i = 0; i < ts->num_function; i++) {
+		if (ts->address_table[i].function_type == command) {
+			switch (type) {
+			case QUERY_BASE:
+				return ts->address_table[i].query_base;
+			case COMMAND_BASE:
+				return ts->address_table[i].command_base;
+			case CONTROL_BASE:
+				return ts->address_table[i].control_base;
+			case DATA_BASE:
+				return ts->address_table[i].data_base;
+			case INTR_SOURCE:
+				return ts->address_table[i].interrupt_source;
+			case FUNCTION:
+				return 1;
+			}
+		}
+	}
+	if (type == FUNCTION)
+		return 0;
+	else
+		return -1;
+}
+static int get_int_mask(uint8_t number, uint8_t offset)
+{
+	uint8_t i, mask = 0;
+	for (i = 0; i < number; i++)
+		mask |= BIT(i);
+	return mask << offset;
+}
+
+static uint32_t syn_crc(uint16_t *data, uint16_t len)
+{
+	uint32_t sum1, sum2;
+	sum1 = sum2 = 0xFFFF;
+	while (len--) {
+		sum1 += *data++;
+		sum2 += sum1;
+		sum1 = (sum1 & 0xFFFF) + (sum1 >> 16);
+		sum2 = (sum2 & 0xFFFF) + (sum2 >> 16);
+	}
+	return sum1 | (sum2 << 16);
+}
+
+static int wait_flash_interrupt(struct synaptics_ts_data *ts, int attr)
+{
+	uint8_t data = 0;
+	int i, ret;
+
+	for (i = 0; i < 5; i++) {
+#ifdef SYN_FLASH_PROGRAMMING_LOG
+		printk(KERN_INFO "[TP] ATT: %d\n", gpio_get_value(attr));
+#endif
+		if (!gpio_get_value(attr)) {
+			ret = i2c_syn_read(ts->client,
+				get_address_base(ts, 0x01, DATA_BASE) + 1, &data, 1);
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:1", __func__);
+			if ((data & 0x01) == 0x01) {
+#ifdef SYN_FLASH_PROGRAMMING_LOG
+				printk(KERN_INFO "[TP] ATT: %d, status: %x\n", gpio_get_value(attr), data);
+#endif
+				break;
+			}
+		}
+		msleep(20);
+	}
+
+	if (i == 5 && syn_panel_version == 0) {
+		ret = i2c_syn_read(ts->client, get_address_base(ts, 0x01, DATA_BASE) + 1, &data, 1);
+		if (ret < 0)
+			return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:2", __func__);
+	} else if (i == 5) {
+		printk(KERN_INFO "[TP] wait_flash_interrupt: interrupt over time!\n");
+		return SYN_PROCESS_ERR;
+	}
+
+	ret = i2c_syn_read(ts->client,
+		get_address_base(ts, 0x34, DATA_BASE) + 18, &data, 1);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:3", __func__);
+	
+	if (data != 0x80) {
+		printk(KERN_INFO "[TP] wait_flash_interrupt: block config fail!\n");
+		return SYN_PROCESS_ERR;
+	}
+	return 0;
+}
+
+static int enable_flash_programming(struct synaptics_ts_data *ts, int attr)
+{
+	int ret;
+	uint8_t data[2];
+
+	
+	ret = i2c_syn_read(ts->client,
+		get_address_base(ts, 0x34, QUERY_BASE), data, 2);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:1", __func__);
+	
+
+	ret = i2c_syn_write(ts->client,
+		get_address_base(ts, 0x34, DATA_BASE) + 2, data, 2);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:2", __func__);
+
+	ret = i2c_syn_write_byte_data(ts->client,
+		get_address_base(ts, 0x34, DATA_BASE) + 18, 0x0F);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:3", __func__);
+
+	ret = wait_flash_interrupt(ts, attr);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
+static int crc_comparison(struct synaptics_ts_data *ts, uint32_t config_crc, int attr)
+{
+	int ret;
+	uint8_t data[17];
+	uint32_t flash_crc;
+#ifdef SYN_FLASH_PROGRAMMING_LOG
+	uint8_t i, j;
+
+	for (i = 0; i < 0x20; i++) {
+		data[0] = i;
+		data[1] = 0x00;
+#else
+		data[0] = 0x1F;
+		data[1] = 0x00;
+#endif
+		ret = i2c_syn_write(ts->client,
+			get_address_base(ts, 0x34, DATA_BASE), data, 2);
+		if (ret < 0)
+			return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:1", __func__);
+
+		ret = i2c_syn_write_byte_data(ts->client,
+			get_address_base(ts, 0x34, DATA_BASE) + 18, 0x05);
+		if (ret < 0)
+			return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:2", __func__);
+
+		ret = wait_flash_interrupt(ts, attr);
+		if (ret < 0)
+			return ret;
+
+		ret = i2c_syn_read(ts->client,
+			get_address_base(ts, 0x34, DATA_BASE) + 2, data, 17);
+		if (ret < 0)
+			return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:3", __func__);
+
+		memcpy(&flash_crc, &data[12], 4);
+
+#ifdef SYN_FLASH_PROGRAMMING_LOG
+		printk(KERN_INFO "[TP] config_crc = %X, flash_crc = %X\n", config_crc, flash_crc);
+		for (j = 0; j < 0x11; j++)
+			printk(KERN_INFO " %d:%X ", j, data[j]);
+		printk(KERN_INFO "\n");
+	}
+#endif
+
+	if (flash_crc == config_crc)
+		return 0;
+	else
+		return 1;
+}
+
+static int program_config(struct synaptics_ts_data *ts, uint8_t *config, int attr)
+{
+	int ret;
+	uint8_t data[19];
+	uint16_t i;
+
+	ret = i2c_syn_read(ts->client,
+		get_address_base(ts, 0x34, QUERY_BASE), data, 2);
+	
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:1", __func__);
+
+	ret = i2c_syn_write(ts->client,
+		get_address_base(ts, 0x34, DATA_BASE) + 2, data, 2);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:2", __func__);
+
+	
+	ret = i2c_syn_write_byte_data(ts->client,
+		get_address_base(ts, 0x34, DATA_BASE) + 18, 0x07);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:3", __func__);
+
+	ret = wait_flash_interrupt(ts, attr);
+	if (ret < 0)
+		return ret;
+
+	for (i = 0; i < 0x20; i++) {
+		data[0] = i & 0xFF;
+		data[1] = (i & 0xFF00) >> 8;
+		memcpy(&data[2], &config[16 * i], 16);
+		data[18] = 0x06;
+		ret = i2c_syn_write(ts->client,
+			get_address_base(ts, 0x34, DATA_BASE), data, 19);
+		if (ret < 0)
+			return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:4", __func__);
+
+		ret = wait_flash_interrupt(ts, attr);
+		if (ret < 0)
+			return ret;
+	}
+
+	return 0;
+}
+
+static int disable_flash_programming(struct synaptics_ts_data *ts, int status)
+{
+	int ret;
+	uint8_t data = 0, i;
+
+	ret = i2c_syn_write_byte_data(ts->client,
+		get_address_base(ts, 0x01, COMMAND_BASE), 0x01);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:1", __func__);
+
+	for (i = 0; i < 25; i++) {
+		ret = i2c_syn_read(ts->client,
+			get_address_base(ts, 0x01, DATA_BASE), &data, 1);
+		if (ret < 0)
+			return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:2", __func__);
+
+		if ((data & 0x40) == 0)
+			break;
+		else
+			msleep(20);
+	}
+
+	if (i == 25) {
+		printk(KERN_INFO "[TP] Disable flash programming fail! F01_data: %X\n", data);
+		return SYN_PROCESS_ERR;
+	} else {
+		printk(KERN_INFO "[TP] Disable flash programming success! F01_data: %X\n", data);
+		return status;
+	}
+}
+
+static int syn_config_update(struct synaptics_ts_data *ts, int attr)
+{
+	uint8_t retry;
+	uint32_t crc_checksum;
+	int ret;
+
+	crc_checksum =
+		syn_crc((uint16_t *)ts->config, SYN_CONFIG_SIZE / 2 - 2);
+	memcpy(&ts->config[SYN_CONFIG_SIZE - 4], &crc_checksum, 4);
+	printk(KERN_INFO "[TP] CRC = %X\n" , syn_crc((uint16_t *)ts->config, SYN_CONFIG_SIZE / 2 - 2));
+
+	if (ts->tw_pin_mask == 0) {
+		ret = enable_flash_programming(ts, attr);
+		if (ret < 0) {
+			printk(KERN_INFO "[TP] syn_config_update: Enable flash programming fail!\n");
+			return disable_flash_programming(ts, ret);
+		}
+
+		ret = syn_pdt_scan(ts, SYN_BL_PAGE);
+		if (ret < 0) {
+			printk(KERN_INFO "[TP] syn_config_update: pdt scan failed\n");
+			return disable_flash_programming(ts, ret);
+		}
+	}
+
+	if ((ts->config != NULL && (ts->config[0] << 24 | ts->config[1] << 16 |
+		ts->config[2] << 8 | ts->config[3]) == ts->config_version)) {
+		ret = crc_comparison(ts, crc_checksum, attr);
+		if (ret < 0) {
+			printk(KERN_INFO "[TP] syn_config_update: CRC comparison fail!\n");
+			return disable_flash_programming(ts, ret);
+		} else if (ret == 0)
+			return disable_flash_programming(ts, 1);
+	}
+
+	for (retry = 0; retry < 3; retry++) {
+		ret = program_config(ts, ts->config, attr);
+		if (ret < 0) {
+#ifdef SYN_FLASH_PROGRAMMING_LOG
+			printk(KERN_INFO "[TP] syn_config_update: Program config fail %d!\n", retry + 1);
+#endif
+			continue;
+		}
+
+		ret = disable_flash_programming(ts, 0);
+		if (ret == 0)
+			break;
+		else
+			printk(KERN_INFO "[TP] syn_config_update: Disable flash programming fail %d\n", retry + 1);
+	}
+
+	if (retry == 3) {
+		printk(KERN_INFO "[TP] syn_config_update: Program config fail 3 times\n");
+		return ret;
+	}
+	return 0;
+}
+
+static int syn_get_tw_vendor(struct synaptics_ts_data *ts, int attr)
+{
+	uint8_t data[2] = {0};
+	int ret;
+
+	ret = enable_flash_programming(ts, attr);
+	if (ret < 0) {
+		printk(KERN_INFO "[TP] Enable flash programming fail!\n");
+		return disable_flash_programming(ts, -1);
+	}
+
+	ret = syn_pdt_scan(ts, SYN_BL_PAGE);
+	if (ret < 0) {
+		printk(KERN_INFO "[TP] syn_config_update: pdt scan failed\n");
+		return disable_flash_programming(ts, ret);
+	}
+
+	memcpy(&data, &ts->tw_pin_mask, sizeof(ts->tw_pin_mask));
+	printk(KERN_INFO "[TP] tw mask = %X %X , %X\n", data[0], data[1], ts->tw_pin_mask);
+	i2c_syn_write(ts->client,
+		get_address_base(ts, 0x34, DATA_BASE) + 2, data, 2);
+	i2c_syn_write(ts->client,
+		get_address_base(ts, 0x34, DATA_BASE) + 4, data, 2);
+	i2c_syn_write_byte_data(ts->client,
+		get_address_base(ts, 0x34, DATA_BASE) + 18, 0x08);
+
+	if (wait_flash_interrupt(ts, attr) < 0)
+		return disable_flash_programming(ts, -1);
+
+	i2c_syn_read(ts->client,
+		get_address_base(ts, 0x34, DATA_BASE) + 6, data, 2);
+	ts->tw_vendor = (data[1] << 8) | data[0];
+	printk(KERN_INFO "[TP] tw vendor= %x %x\n", data[1], data[0]);
+
+	return 0;
+}
+
+static int synaptics_input_register(struct synaptics_ts_data *ts)
+{
+	int ret;
+	ts->input_dev = input_allocate_device();
+	if (ts->input_dev == NULL) {
+		ret = -ENOMEM;
+		printk(KERN_ERR "[TP] TOUCH_ERR: %s: Failed to allocate input device\n", __func__);
+		return ret;
+	}
+	ts->input_dev->name = "synaptics-rmi-touchscreen";
+	set_bit(EV_SYN, ts->input_dev->evbit);
+	set_bit(EV_KEY, ts->input_dev->evbit);
+	set_bit(EV_ABS, ts->input_dev->evbit);
+
+	set_bit(KEY_BACK, ts->input_dev->keybit);
+	set_bit(KEY_HOME, ts->input_dev->keybit);
+	set_bit(KEY_MENU, ts->input_dev->keybit);
+	set_bit(KEY_SEARCH, ts->input_dev->keybit);
+	set_bit(KEY_APP_SWITCH, ts->input_dev->keybit);
+
+	printk(KERN_INFO "[TP] input_set_abs_params: mix_x %d, max_x %d, min_y %d, max_y %d\n",
+		ts->layout[0], ts->layout[1], ts->layout[2], ts->layout[3]);
+
+	if (ts->htc_event == SYN_AND_REPORT_TYPE_B) {
+		input_mt_init_slots(ts->input_dev, ts->finger_support);
+	} else {
+		ts->input_dev->mtsize = ts->finger_support;
+		input_set_abs_params(ts->input_dev, ABS_MT_TRACKING_ID, 0,
+			ts->finger_support - 1, 0, 0);
+	}
+	input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X,
+		ts->layout[0], ts->layout[1], 0, 0);
+	input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y,
+		ts->layout[2], ts->layout[3], 0, 0);
+
+	input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
+	input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 30, 0, 0);
+	input_set_abs_params(ts->input_dev, ABS_MT_PRESSURE, 0, 30, 0, 0);
+
+	input_set_abs_params(ts->input_dev, ABS_MT_AMPLITUDE,
+			0, ((255 << 16) | 15), 0, 0);
+	input_set_abs_params(ts->input_dev, ABS_MT_POSITION,
+		0, ((1 << 31) | (ts->layout[1] << 16) | ts->layout[3]), 0, 0);
+
+	return input_register_device(ts->input_dev);
+}
+
+static ssize_t touch_vendor_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+	char fw_version[2];
+	struct synaptics_ts_data *ts;
+
+	ts = gl_ts;
+	memcpy(fw_version, &syn_panel_version, 2);
+	ret = sprintf(buf, "synaptics-%d_%c.%c", ts->package_id, fw_version[1], fw_version[0]);
+	if (ts->tw_pin_mask != 0)
+		ret += sprintf(buf+ret, "_twID-%x", ts->tw_vendor);
+	else
+		ret += sprintf(buf+ret, "\n");
+	ret += sprintf(buf+ret, "_PR: %d\n", ts->packrat_number);
+
+	return ret;
+}
+
+static DEVICE_ATTR(vendor, S_IRUGO, touch_vendor_show, NULL);
+
+static ssize_t gpio_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	struct synaptics_ts_data *ts;
+
+	ts = gl_ts;
+
+	ret = gpio_get_value(ts->gpio_irq);
+	printk(KERN_DEBUG "[TP] GPIO_TP_INT_N=%d\n", ret);
+	sprintf(buf, "GPIO_TP_INT_N=%d\n", ret);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+
+static DEVICE_ATTR(gpio, S_IRUGO, gpio_show, NULL);
+
+static uint16_t syn_reg_addr;
+
+static ssize_t register_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	uint8_t data = 0;
+	struct synaptics_ts_data *ts;
+	ts = gl_ts;
+
+	ret = i2c_syn_read(ts->client, syn_reg_addr, &data, 1);
+	if (ret < 0) {
+		i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r", __func__);
+		ret += sprintf(buf, "addr: 0x , data: 0x \n");
+	} else {
+		ret += sprintf(buf, "addr: 0x%X, data: 0x%X\n", syn_reg_addr, data);
+	}
+	return ret;
+}
+
+static ssize_t register_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	int ret = 0;
+	struct synaptics_ts_data *ts;
+	char buf_tmp[4];
+	uint8_t write_da;
+	unsigned long addr;
+
+	ts = gl_ts;
+	memset(buf_tmp, 0x0, sizeof(buf_tmp));
+	if ((buf[0] == 'r' || buf[0] == 'w') && buf[1] == ':' &&
+		(buf[5] == ':' || buf[5] == '\n')) {
+		memcpy(buf_tmp, buf + 2, 3);
+		ret = strict_strtoul(buf_tmp, 16, &addr);
+		syn_reg_addr = addr;
+		printk(KERN_DEBUG "[TP] %s: set syn_reg_addr is: 0x%X\n",
+						__func__, syn_reg_addr);
+		if (buf[0] == 'w' && buf[5] == ':' && buf[9] == '\n') {
+			memcpy(buf_tmp, buf + 6, 3);
+			ret = strict_strtoul(buf_tmp, 16, &addr);
+			write_da = addr;
+			printk(KERN_DEBUG "[TP] write addr: 0x%X, data: 0x%X\n",
+						syn_reg_addr, write_da);
+			ret = i2c_syn_write_byte_data(ts->client,
+					syn_reg_addr, write_da);
+			if (ret < 0) {
+				i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w", __func__);
+			}
+		}
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(register, (S_IWUSR|S_IRUGO),
+	register_show, register_store);
+
+static ssize_t debug_level_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+
+	return sprintf(buf, "%d\n", ts->debug_log_level);
+}
+
+static ssize_t debug_level_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	int i;
+
+	ts->debug_log_level = 0;
+	for(i=0; i<count-1; i++)
+	{
+		if( buf[i]>='0' && buf[i]<='9' )
+			ts->debug_log_level |= (buf[i]-'0');
+		else if( buf[i]>='A' && buf[i]<='F' )
+			ts->debug_log_level |= (buf[i]-'A'+10);
+		else if( buf[i]>='a' && buf[i]<='f' )
+			ts->debug_log_level |= (buf[i]-'a'+10);
+
+		if(i!=count-2)
+			ts->debug_log_level <<= 4;
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(debug_level, (S_IWUSR|S_IRUGO),
+	debug_level_show, debug_level_store);
+
+static ssize_t syn_diag_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	size_t count = 0;
+	uint16_t i, j;
+	int ret;
+
+	ret = i2c_syn_write_byte_data(ts->client,
+		get_address_base(ts, 0x54, DATA_BASE), ts->diag_command);
+	if (ret < 0) {
+		i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:1", __func__);
+		count += sprintf(buf, "[TP] TOUCH_ERR: %s: i2c write fail(%d)\n", __func__, ret);
+		return count;
+	}
+
+	atomic_set(&ts->data_ready, 0);
+
+	ret = i2c_syn_write_byte_data(ts->client,
+		get_address_base(ts, 0x54, COMMAND_BASE), 0x01);
+	if (ret < 0) {
+		atomic_set(&ts->data_ready, 1);
+		i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:2", __func__);
+		count += sprintf(buf, "[TP] TOUCH_ERR: %s: i2c write fail(%d)\n", __func__, ret);
+		return count;
+	}
+
+	wait_event_interruptible_timeout(syn_data_ready_wq,
+					 atomic_read(&ts->data_ready), 50);
+
+	for (i = 0; i < ts->y_channel; i++) {
+		for (j = 0; j < ts->x_channel; j++) {
+			if(ts->package_id == 3201)
+				count += sprintf(buf + count, "%5d", ts->report_data[i*ts->x_channel + j]);
+			else
+				count += sprintf(buf + count, "%5d", ts->report_data[i + j*ts->y_channel]);
+		}
+		count += sprintf(buf + count, "\n");
+	}
+
+	return count;
+}
+
+static ssize_t syn_diag_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct synaptics_ts_data *ts;
+	ts = gl_ts;
+	if (buf[0] == '1')
+		ts->diag_command = 2;
+	else if (buf[0] == '2')
+		ts->diag_command = 3;
+
+	return count;
+}
+
+static DEVICE_ATTR(diag, (S_IWUSR|S_IRUGO),
+	syn_diag_show, syn_diag_store);
+
+static ssize_t syn_unlock_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct synaptics_ts_data *ts;
+	int unlock = -1;
+	int ret;
+
+	ts = gl_ts;
+
+	if (buf[0] >= '0' && buf[0] <= '9' && buf[1] == '\n')
+		unlock = buf[0] - '0';
+
+	printk(KERN_INFO "[TP] Touch: unlock change to %d\n", unlock);
+
+	if (unlock == 2 && ts->first_pressed && ts->pre_finger_data[0][0] < 2) {
+		ts->pre_finger_data[0][0] = 2;
+		if(ts->psensor_detection) {
+			if(ts->psensor_resume_enable == 1) {
+				printk(KERN_INFO "[TP] %s: Disable P-sensor by Touch\n", __func__);
+				psensor_enable_by_touch_driver(0);
+				ts->psensor_resume_enable = 0;
+			}
+			else if(ts->psensor_resume_enable == 2) {
+				ts->psensor_resume_enable = 0;
+			}
+		}
+		if (ts->packrat_number < SYNAPTICS_FW_NOCAL_PACKRAT) {
+			if (ts->large_obj_check) {
+				if (ts->package_id == 2200) {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x26, ts->default_large_obj);
+
+				} else {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x29, ts->default_large_obj);
+				}
+				if (ret < 0)
+					return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:7", __func__);
+				printk(KERN_INFO "[TP] %s: unlock confirmed. set large obj suppression: %x\n"
+					, __func__, ts->default_large_obj);
+			}
+
+			if (ts->segmentation_bef_unlock) {
+				if (ts->package_id == 2200) {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x25, ts->segmentation_aft_unlock);
+
+				} else {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x22, ts->segmentation_aft_unlock);
+				}
+				if (ret < 0)
+					return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:8", __func__);
+				printk(KERN_INFO "[TP] %s: unlock confirmed. set segmentation aggressiveness: %x\n"
+					, __func__, ts->segmentation_aft_unlock);
+			}
+
+			if (ts->threshold_bef_unlock) {
+				if (ts->package_id == 2200) {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x0A, ts->threshold_aft_unlock);
+				} else {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x0C, ts->threshold_aft_unlock);
+				}
+				if (ret < 0)
+					return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:9", __func__);
+				printk(KERN_INFO "[TP] %s: unlock confirmed. set Z Touch threshold: %x\n"
+					, __func__, ts->threshold_aft_unlock);
+			}
+		}
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(unlock, (S_IWUSR|S_IRUGO),
+	NULL, syn_unlock_store);
+
+static ssize_t syn_config_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	uint16_t i, length = 0;
+	uint8_t j, temp_func_cmd = 0, temp_func_query = 0, size = 0;
+	size_t count = 0;
+	int ret;
+
+	printk(KERN_INFO "[TP] ts->num_function: %d\n", ts->num_function);
+	for (i = 0; i < SYN_MAX_PAGE; i++) {
+		for (j = 0; j < ts->num_function; j++) {
+			if (((ts->address_table[j].control_base >> 8) & 0xFF) == i) {
+				temp_func_query = 0;
+				for (temp_func_cmd = j; temp_func_cmd < ts->num_function; temp_func_cmd++) {
+					uint16_t max_addr = (i << 8) | 0xFF;
+					uint16_t min_addr = (i << 8) | 0;
+					if ((ts->address_table[temp_func_cmd].command_base > min_addr) &&
+						(ts->address_table[temp_func_cmd].command_base <= max_addr))
+						break;
+					if ((ts->address_table[temp_func_cmd].query_base > min_addr) &&
+						(ts->address_table[temp_func_cmd].query_base <= max_addr)
+						&& temp_func_query == 0)
+						temp_func_query = temp_func_cmd;
+				}
+
+				if (temp_func_cmd != ts->num_function) {
+					size = ts->address_table[temp_func_cmd].command_base -
+						ts->address_table[j].control_base;
+					printk(KERN_INFO "[TP] page%d has command function, function: %X\n"
+						, i, ts->address_table[temp_func_cmd].function_type);
+				} else {
+					size = ts->address_table[temp_func_query].query_base -
+						ts->address_table[j].control_base;
+					printk(KERN_INFO "[TP] page%d has no command function, use query function, function: %X\n"
+						, i, ts->address_table[temp_func_query].function_type);
+				}
+
+				ret = i2c_syn_read(ts->client, ts->address_table[j].control_base,
+					&ts->config_table[length], size);
+				if (ret < 0) {
+					i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w", __func__);
+					count += sprintf(buf, "[TP] TOUCH_ERR: %s: i2c write fail(%d)\n", __func__, ret);
+					return count;
+				}
+
+				length += size;
+				printk(KERN_INFO "[TP] Size: %x, Length: %x\n", size, length);
+				break;
+			}
+		}
+	}
+	if(length > SYN_CONFIG_SIZE)
+		length = SYN_CONFIG_SIZE;
+
+	printk(KERN_INFO "");
+	for (i = 0; i < length; i++) {
+		printk(KERN_INFO "%2.2X ", ts->config_table[i]);
+		if ((i % 16) == 15)
+			printk(KERN_INFO "\n");
+	}
+
+	for (i = 0; i < length; i++) {
+		count += sprintf(buf + count, "%2.2X ", ts->config_table[i]);
+		if ((i % 16) == (16 - 1))
+			count += sprintf(buf + count, "\n");
+	}
+	count += sprintf(buf + count, "\n");
+
+	return count;
+}
+
+static ssize_t syn_config_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	uint8_t i, j, k = 0, length = 0;
+	printk(KERN_INFO "[TP] ts->num_function: %d\n", ts->num_function);
+	for (i = 0; i < SYN_MAX_PAGE; i++) {
+		for (j = 0; j < ts->num_function; j++) {
+			if (((ts->address_table[j].control_base >> 8) & 0xFF) == i) {
+				for (k = j; k < ts->num_function; k++)
+					if (ts->address_table[k].command_base != 0)
+						break;
+				length += ts->address_table[k].command_base -
+					ts->address_table[j].control_base;
+				printk(KERN_INFO "[%d]Length: %x\n", i, length);
+				break;
+			}
+		}
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(config, (S_IWUSR|S_IRUGO),
+	syn_config_show, syn_config_store);
+
+
+static ssize_t syn_layout_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	uint8_t i;
+	size_t count = 0;
+	for (i = 0; i < 4; i++)
+		count += sprintf(buf + count, "%d ", ts->layout[i]);
+	count += sprintf(buf + count, "\n");
+
+	return count;
+}
+
+static ssize_t syn_layout_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	char buf_tmp[5];
+	int i = 0, j = 0, k = 0, ret;
+	unsigned long value;
+	int layout[4] = {0};
+
+	for (i = 0; i < 20; i++) {
+		if (buf[i] == ',' || buf[i] == '\n') {
+			memset(buf_tmp, 0x0, sizeof(buf_tmp));
+			if (i - j <= 5)
+				memcpy(buf_tmp, buf + j, i - j);
+			else {
+				printk(KERN_INFO "[TP] buffer size is over 5 char\n");
+				return count;
+			}
+			j = i + 1;
+			if (k < 4) {
+				ret = strict_strtol(buf_tmp, 10, &value);
+				layout[k++] = value;
+			}
+		}
+	}
+	if (k == 4) {
+		memcpy(ts->layout, layout, sizeof(layout));
+		printk(KERN_INFO "[TP] %d, %d, %d, %d\n",
+			ts->layout[0], ts->layout[1], ts->layout[2], ts->layout[3]);
+		input_unregister_device(ts->input_dev);
+		synaptics_input_register(ts);
+	} else
+		printk(KERN_INFO "[TP] ERR@%d, %d, %d, %d\n",
+			ts->layout[0], ts->layout[1], ts->layout[2], ts->layout[3]);
+	return count;
+
+}
+
+static DEVICE_ATTR(layout, (S_IWUSR|S_IRUGO),
+	syn_layout_show, syn_layout_store);
+
+
+static ssize_t syn_pdt_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	uint8_t i;
+	size_t count = 0;
+	for (i = 0; i < ts->num_function; i++) {
+		count += sprintf(buf + count,
+			"Funtion: %2X, Query: %3X, Command: %3X, "
+			"Control: %3X, Data: %3X, INTR: %2X\n",
+			ts->address_table[i].function_type, ts->address_table[i].query_base ,
+			ts->address_table[i].command_base, ts->address_table[i].control_base,
+			ts->address_table[i].data_base, ts->address_table[i].interrupt_source);
+	}
+	return count;
+}
+
+static DEVICE_ATTR(pdt, S_IRUGO, syn_pdt_show, NULL);
+
+static ssize_t syn_htc_event_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+
+	return sprintf(buf, "%d\n", ts->htc_event);
+}
+
+static ssize_t syn_htc_event_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+
+	if (buf[0] >= '0' && buf[0] <= '9' && buf[1] == '\n')
+		ts->htc_event = buf[0] - '0';
+
+	return count;
+}
+
+static DEVICE_ATTR(htc_event, (S_IWUSR|S_IRUGO),
+	syn_htc_event_show, syn_htc_event_store);
+
+#ifdef SYN_WIRELESS_DEBUG
+static ssize_t syn_int_status_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	size_t count = 0;
+
+	count += sprintf(buf + count, "%d ", ts->irq_enabled);
+	count += sprintf(buf + count, "\n");
+
+	return count;
+}
+
+static ssize_t syn_int_status_store(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	int value, ret=0;
+
+	if (sysfs_streq(buf, "0"))
+		value = false;
+	else if (sysfs_streq(buf, "1"))
+		value = true;
+	else
+		return -EINVAL;
+
+	if (value) {
+		ret = request_threaded_irq(ts->client->irq, NULL, synaptics_irq_thread,
+			IRQF_TRIGGER_LOW | IRQF_ONESHOT, ts->client->name, ts);
+		if (ret == 0) {
+			ts->irq_enabled = 1;
+			ret = i2c_syn_read(ts->client,
+				get_address_base(ts, 0x01, CONTROL_BASE) + 1, &ts->intr_bit, 1);
+			printk(KERN_INFO "[TP] %s: interrupt enable: %x\n", __func__, ts->intr_bit);
+			if (ret)
+				free_irq(ts->client->irq, ts);
+		}
+	} else {
+		disable_irq(ts->client->irq);
+		free_irq(ts->client->irq, ts);
+		ts->irq_enabled = 0;
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(enabled, (S_IWUSR|S_IRUGO),
+	syn_int_status_show, syn_int_status_store);
+
+static ssize_t syn_reset(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+
+	if (buf[0] == '1' && ts->gpio_reset) {
+		gpio_direction_output(ts->gpio_reset, 0);
+		msleep(1);
+		gpio_direction_output(ts->gpio_reset, 1);
+		printk(KERN_INFO "[TP] %s: synaptics touch chip reseted.\n", __func__);
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(reset, (S_IWUSR),
+	0, syn_reset);
+
+#endif
+
+enum SR_REG_STATE{
+	ALLOCATE_DEV_FAIL = -2,
+	REGISTER_DEV_FAIL,
+	SUCCESS,
+};
+
+static char *vk_name = "virtualkeys.sr_touchscreen";
+static struct kobj_attribute vk_dev;
+
+static int register_sr_touch_device(void)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	struct synaptics_i2c_rmi_platform_data *pdata = ts->client->dev.platform_data;
+	int ret = 0;
+
+	ts->sr_input_dev = input_allocate_device();
+
+	if (ts->sr_input_dev == NULL) {
+		printk(KERN_ERR "[TP][TOUCH_ERR]%s: Failed to allocate SR input device\n", __func__);
+		return ALLOCATE_DEV_FAIL;
+	}
+
+	if (pdata->vk_obj) {
+		memcpy(&vk_dev, pdata->vk2Use, sizeof(struct kobj_attribute));
+		vk_dev.attr.name = vk_name;
+		ret = sysfs_create_file(pdata->vk_obj, &(vk_dev.attr));
+	}
+
+	ts->sr_input_dev->name = "sr_touchscreen";
+	set_bit(EV_SYN, ts->sr_input_dev->evbit);
+	set_bit(EV_ABS, ts->sr_input_dev->evbit);
+	set_bit(EV_KEY, ts->sr_input_dev->evbit);
+
+	set_bit(KEY_BACK, ts->sr_input_dev->keybit);
+	set_bit(KEY_HOME, ts->sr_input_dev->keybit);
+	set_bit(KEY_MENU, ts->sr_input_dev->keybit);
+	set_bit(KEY_SEARCH, ts->sr_input_dev->keybit);
+	set_bit(BTN_TOUCH, ts->sr_input_dev->keybit);
+	set_bit(KEY_APP_SWITCH, ts->sr_input_dev->keybit);
+	set_bit(INPUT_PROP_DIRECT, ts->sr_input_dev->propbit);
+	ts->sr_input_dev->mtsize = ts->finger_support;
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_TRACKING_ID,
+		0, ts->finger_support - 1, 0, 0);
+	printk(KERN_INFO "[TP][SR]input_set_abs_params: mix_x %d, max_x %d,"
+		" min_y %d, max_y %d\n", ts->layout[0],
+		 ts->layout[1], ts->layout[2], ts->layout[3]);
+
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_POSITION_X,
+		ts->layout[0], ts->layout[1], 0, 0);
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_POSITION_Y,
+		ts->layout[2], ts->layout[3], 0, 0);
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_TOUCH_MAJOR,
+		0, 255, 0, 0);
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_PRESSURE,
+		0, 30, 0, 0);
+	input_set_abs_params(ts->sr_input_dev, ABS_MT_WIDTH_MAJOR,
+		0, 30, 0, 0);
+
+	if (input_register_device(ts->sr_input_dev)) {
+		input_free_device(ts->sr_input_dev);
+		printk(KERN_ERR "[TP][SR][TOUCH_ERR]%s: Unable to register %s input device\n",
+			__func__, ts->sr_input_dev->name);
+		return REGISTER_DEV_FAIL;
+	}
+	return SUCCESS;
+}
+
+static ssize_t set_en_sr(struct device *dev, struct device_attribute *attr,
+						const char *buf, size_t count)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	if (buf[0]) {
+		if (ts->sr_input_dev)
+			printk(KERN_INFO "[TP]%s: SR device already exist!\n", __func__);
+		else
+			printk(KERN_INFO "[TP]%s: SR touch device enable result:%X\n", __func__, register_sr_touch_device());
+	}
+	return count;
+}
+
+static DEVICE_ATTR(sr_en, S_IWUSR, 0, set_en_sr);
+
+static struct kobject *android_touch_kobj;
+
+static int synaptics_touch_sysfs_init(void)
+{
+	int ret;
+#ifdef SYN_WIRELESS_DEBUG
+	struct synaptics_ts_data *ts = gl_ts;
+#endif
+
+	android_touch_kobj = kobject_create_and_add("android_touch", NULL);
+	if (android_touch_kobj == NULL) {
+		printk(KERN_ERR "[TP] TOUCH_ERR: %s: subsystem_register failed\n", __func__);
+		ret = -ENOMEM;
+		return ret;
+	}
+	syn_reg_addr = 0;
+	if (sysfs_create_file(android_touch_kobj, &dev_attr_vendor.attr) ||
+		sysfs_create_file(android_touch_kobj, &dev_attr_gpio.attr) ||
+		sysfs_create_file(android_touch_kobj, &dev_attr_debug_level.attr) ||
+		sysfs_create_file(android_touch_kobj, &dev_attr_register.attr) ||
+		sysfs_create_file(android_touch_kobj, &dev_attr_unlock.attr) ||
+		sysfs_create_file(android_touch_kobj, &dev_attr_config.attr) ||
+		sysfs_create_file(android_touch_kobj, &dev_attr_layout.attr) ||
+		sysfs_create_file(android_touch_kobj, &dev_attr_pdt.attr) ||
+		sysfs_create_file(android_touch_kobj, &dev_attr_htc_event.attr) ||
+		sysfs_create_file(android_touch_kobj, &dev_attr_reset.attr) ||
+		sysfs_create_file(android_touch_kobj, &dev_attr_sr_en.attr)
+#ifdef SYN_WIRELESS_DEBUG
+		|| sysfs_create_file(android_touch_kobj, &dev_attr_enabled.attr)
+#endif
+		)
+		return -ENOMEM;
+	if (get_address_base(gl_ts, 0x54, FUNCTION))
+		if (sysfs_create_file(android_touch_kobj, &dev_attr_diag.attr))
+			return -ENOMEM;
+
+#ifdef SYN_WIRELESS_DEBUG
+	ret= gpio_request(ts->gpio_irq, "synaptics_attn");
+	if (ret) {
+		printk(KERN_INFO "[TP]%s: Failed to obtain touchpad IRQ %d. Code: %d.", __func__, ts->gpio_irq, ret);
+		return ret;
+	}
+	if (ts->gpio_reset) {
+		ret = gpio_request(ts->gpio_reset, "synaptics_reset");
+		if (ret)
+			printk(KERN_INFO "[TP]%s: Failed to obtain reset pin: %d. Code: %d.", __func__, ts->gpio_reset, ret);
+	}
+	ret = gpio_export(ts->gpio_irq, true);
+	if (ret) {
+		printk(KERN_INFO "[TP]%s: Failed to "
+			"export ATTN gpio!\n", __func__);
+		ret = 0;
+	} else {
+		ret = gpio_export_link(&(ts->input_dev->dev), "attn",
+			ts->gpio_irq);
+		if (ret) {
+			printk(KERN_INFO "[TP]%s: Failed to "
+				"symlink ATTN gpio!\n", __func__);
+			ret = 0;
+		} else {
+			printk(KERN_INFO "[TP]%s: Exported GPIO %d.", __func__, ts->gpio_irq);
+		}
+	}
+#endif
+	return 0;
+}
+
+static void synaptics_touch_sysfs_remove(void)
+{
+	sysfs_remove_file(android_touch_kobj, &dev_attr_vendor.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_gpio.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_debug_level.attr);
+	if (get_address_base(gl_ts, 0x54, FUNCTION))
+		sysfs_remove_file(android_touch_kobj, &dev_attr_diag.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_register.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_unlock.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_config.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_layout.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_pdt.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_htc_event.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_reset.attr);
+	sysfs_remove_file(android_touch_kobj, &dev_attr_sr_en.attr);
+#ifdef SYN_WIRELESS_DEBUG
+	sysfs_remove_file(android_touch_kobj, &dev_attr_enabled.attr);
+#endif
+	kobject_del(android_touch_kobj);
+}
+
+static int synaptics_init_panel(struct synaptics_ts_data *ts)
+{
+	int ret = 0;
+
+	
+	ret = i2c_syn_write_byte_data(ts->client,
+			get_address_base(ts, 0x01, CONTROL_BASE), 0x80);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:1", __func__);
+	if (ts->pre_finger_data[0][0] < 2) {
+		if (ts->large_obj_check) {
+			if (ts->package_id == 2200) {
+				ret = i2c_syn_write_byte_data(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x26, ts->default_large_obj & 0x7F);
+			} else {
+				ret = i2c_syn_write_byte_data(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x29, ts->default_large_obj & 0x7F);
+			}
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:2", __func__);
+			printk(KERN_INFO "[TP] %s: set large obj suppression register to: %x\n", __func__, ts->default_large_obj & 0x7F);
+		}
+
+		if (ts->segmentation_bef_unlock) {
+			if (ts->package_id == 2200) {
+				ret = i2c_syn_write_byte_data(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x25, ts->segmentation_bef_unlock);
+			} else {
+				ret = i2c_syn_write_byte_data(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x22, ts->segmentation_bef_unlock);
+			}
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:3", __func__);
+			printk(KERN_INFO "[TP] %s: set segmentation aggressiveness to: %x\n", __func__, ts->segmentation_bef_unlock);
+		}
+
+		if (ts->threshold_bef_unlock) {
+			if (ts->package_id == 2200) {
+				ret = i2c_syn_write_byte_data(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x0A, ts->threshold_bef_unlock);
+			} else {
+				ret = i2c_syn_write_byte_data(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x0C, ts->threshold_bef_unlock);
+			}
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:4", __func__);
+			printk(KERN_INFO "[TP] %s: set Z Touch threshold to: %x\n", __func__, ts->threshold_bef_unlock);
+		}
+
+		if (ts->saturation_bef_unlock) {
+			ret = i2c_syn_write_byte_data(ts->client,
+				get_address_base(ts, 0x54, CONTROL_BASE) + 0x02, ts->saturation_bef_unlock & 0xFF);
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "saturation capacitance", __func__);
+			ret = i2c_syn_write_byte_data(ts->client,
+				get_address_base(ts, 0x54, CONTROL_BASE) + 0x03, (ts->saturation_bef_unlock & 0xFF00) >> 8);
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "saturation capacitance", __func__);
+			printk(KERN_INFO "[TP] %s: set saturation to: %x\n", __func__, ts->saturation_bef_unlock);
+			ret = i2c_syn_write_byte_data(ts->client,
+				get_address_base(ts, 0x54, COMMAND_BASE), 0x04);
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:5", __func__);
+		}
+
+		if ( ts->PixelTouchThreshold_bef_unlock ) {
+			ret = i2c_syn_write_byte_data(ts->client,
+				get_address_base(ts, 0x54, CONTROL_BASE) + 0x04, ts->PixelTouchThreshold_bef_unlock );
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "F54_ANALOG_CTRL03 Pixel Touch Threshold", __func__);
+			printk(KERN_INFO "[TP] %s: set F54_ANALOG_CTRL03 Pixel Touch Threshold: %x\n", __func__, ts->PixelTouchThreshold_bef_unlock);
+			ret = i2c_syn_write_byte_data(ts->client,
+				get_address_base(ts, 0x54, COMMAND_BASE), 0x04);
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:6", __func__);
+		}
+	}
+
+	return ret;
+}
+
+static void synaptics_ts_finger_func(struct synaptics_ts_data *ts)
+{
+	int ret;
+	uint8_t buf[((ts->finger_support * 21 + 3) / 4)];
+
+	memset(buf, 0x0, sizeof(buf));
+	ret = i2c_syn_read(ts->client,
+		get_address_base(ts, 0x11, DATA_BASE), buf, sizeof(buf));
+	if (ret < 0) {
+		i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:1", __func__);
+	} else {
+		int finger_data[ts->finger_support][4];
+		int base = (ts->finger_support + 3) / 4;
+		uint8_t i, j;
+		uint16_t finger_press_changed = 0, finger_release_changed = 0, finger_pressed = 0;
+
+		ts->finger_count = 0;
+		if (ts->debug_log_level & BIT(0)) {
+			printk(KERN_INFO "[TP] Touch:");
+			for (i = 0; i < sizeof(buf); i++)
+				printk(KERN_INFO " %2x", buf[i]);
+			printk(KERN_INFO "\n");
+		}
+		for (i = 0; i < ts->finger_support; i++) {
+			uint8_t finger_state = buf[(i / 4)] >> ((i * 2) % 8);
+			if (finger_state & 0x03) {
+				finger_pressed |= BIT(i);
+				ts->finger_count++;
+				if (finger_state == 0x02)
+					printk(KERN_INFO "[TP] Finger state[%d] = 0x02\n", i);
+				else if (finger_state == 0x03)
+					printk(KERN_INFO "[TP] Finger state[%d] = 0x03\n", i);
+			}
+#ifdef SYN_FILTER_CONTROL
+			else if ((ts->grip_suppression | ts->grip_b_suppression) & BIT(i)) {
+				ts->grip_suppression &= ~BIT(i);
+				ts->grip_b_suppression &= ~BIT(i);
+			}
+#endif
+		}
+		if (ts->finger_pressed != finger_pressed
+			) {
+			finger_press_changed = ts->finger_pressed ^ finger_pressed;
+			finger_release_changed = finger_press_changed & ts->finger_pressed;
+			finger_press_changed &= finger_pressed;
+			ts->finger_pressed = finger_pressed;
+		}
+
+		if(ts->debug_log_level & BIT(3)) {
+			for(i = 0; i < ts->finger_support; i++) {
+				if (finger_release_changed & BIT(i) ) {
+					uint32_t flip_flag = SYNAPTICS_FLIP_X;
+					uint8_t pos_mask = 0x0f;
+					for (j = 0; j < 2; j++) {
+						finger_data[i][j]
+							= (buf[base+2] & pos_mask) >> (j * 4) |
+							(uint16_t)buf[base + j] << 4;
+						if (ts->flags & flip_flag)
+							finger_data[i][j] = ts->max[j] - finger_data[i][j];
+						flip_flag <<= 1;
+						pos_mask <<= 4;
+					}
+					finger_data[i][2] = (buf[base+3] >> 4 & 0x0F) + (buf[base+3] & 0x0F);
+					finger_data[i][3] = buf[base+4];
+
+					if (ts->flags & SYNAPTICS_SWAP_XY)
+						swap(finger_data[i][0], finger_data[i][1]);
+
+					if (ts->layout[1] < finger_data[i][0])
+						finger_data[i][0] = ts->layout[1];
+					if(ts->width_factor && ts->height_factor){
+						printk(KERN_INFO
+							"[TP] Screen:F[%02d]:Up, X=%d, Y=%d, W=%d, Z=%d\n",
+							i+1, (finger_data[i][0]*ts->width_factor)>>SHIFT_BITS,
+							(finger_data[i][1]*ts->height_factor)>>SHIFT_BITS,
+							finger_data[i][2], finger_data[i][3]);
+					} else {
+						printk(KERN_INFO
+							"[TP] Raw:F[%02d]:Up, X=%d, Y=%d, W=%d, Z=%d\n",
+							i+1, finger_data[i][0], finger_data[i][1],
+							finger_data[i][2], finger_data[i][3]);
+					}
+				}
+				base += 5;
+			}
+		}
+
+		if (ts->htc_event == SYN_AND_REPORT_TYPE_B && finger_release_changed) {
+			for (i = 0; i < ts->finger_support; i++) {
+				if (finger_release_changed & BIT(i)) {
+					input_mt_slot(ts->input_dev, i);
+					input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0);
+					ts->tap_suppression &= ~BIT(i);
+				}
+			}
+		}
+
+		if (finger_pressed == 0 
+) {
+			if (ts->htc_event == SYN_AND_REPORT_TYPE_A) {
+				
+				if (ts->support_htc_event) {
+					input_report_abs(ts->input_dev, ABS_MT_AMPLITUDE, 0);
+					input_report_abs(ts->input_dev, ABS_MT_POSITION, 1 << 31);
+				}
+				input_mt_sync(ts->input_dev);
+			}
+			else if (ts->htc_event == SYN_AND_REPORT_TYPE_HTC) {
+				input_report_abs(ts->input_dev, ABS_MT_AMPLITUDE, 0);
+				input_report_abs(ts->input_dev, ABS_MT_POSITION, 1 << 31);
+			}
+
+#ifdef SYN_FILTER_CONTROL
+			if (ts->filter_level[0])
+				ts->ambiguous_state = 0;
+			ts->grip_b_suppression = 0;
+#endif
+			if (ts->reduce_report_level[0])
+				ts->tap_suppression = 0;
+			if (ts->debug_log_level & BIT(1))
+				printk(KERN_INFO "[TP] Finger leave\n");
+		}
+
+		if (ts->pre_finger_data[0][0] < 2 || finger_pressed) {
+			base = (ts->finger_support + 3) / 4;
+			for (i = 0; i < ts->finger_support; i++) {
+				uint32_t flip_flag = SYNAPTICS_FLIP_X;
+				if ((finger_pressed | finger_release_changed) & BIT(i)) {
+					uint8_t pos_mask = 0x0f;
+					for (j = 0; j < 2; j++) {
+						finger_data[i][j]
+							= (buf[base+2] & pos_mask) >> (j * 4) |
+							(uint16_t)buf[base + j] << 4;
+						if (ts->flags & flip_flag)
+							finger_data[i][j] = ts->max[j] - finger_data[i][j];
+						flip_flag <<= 1;
+						pos_mask <<= 4;
+					}
+					finger_data[i][2] = (buf[base+3] >> 4 & 0x0F) + (buf[base+3] & 0x0F);
+					finger_data[i][3] = buf[base+4];
+
+					if (ts->flags & SYNAPTICS_SWAP_XY)
+						swap(finger_data[i][0], finger_data[i][1]);
+
+					if (ts->layout[1] < finger_data[i][0])
+						finger_data[i][0] = ts->layout[1];
+
+					if ((finger_release_changed & BIT(i)) && ts->pre_finger_data[0][0] < 2) {
+						if (!ts->first_pressed) {
+							if (ts->finger_count == 0)
+								ts->first_pressed = 1;
+							printk(KERN_INFO "[TP] E%d@%d, %d\n", i + 1,
+							finger_data[i][0], finger_data[i][1]);
+						}
+					}
+#ifdef SYN_FILTER_CONTROL
+					if (abs((buf[base+3] >> 4 & 0x0F) - (buf[base+3] & 0x0F)) >= 10)
+						ts->grip_b_suppression |= BIT(i);
+
+					if (ts->filter_level[0] &&
+						((finger_press_changed | ts->grip_suppression) & BIT(i))) {
+						if ((finger_data[i][0] < (ts->filter_level[0] + ts->ambiguous_state * 20) ||
+							finger_data[i][0] > (ts->filter_level[3] - ts->ambiguous_state * 20)) &&
+							!(ts->grip_suppression & BIT(i))) {
+							ts->grip_suppression |= BIT(i);
+						} else if ((finger_data[i][0] < (ts->filter_level[1] + ts->ambiguous_state * 20) ||
+							finger_data[i][0] > (ts->filter_level[2] - ts->ambiguous_state * 20)) &&
+							(ts->grip_suppression & BIT(i)))
+							ts->grip_suppression |= BIT(i);
+						else if (finger_data[i][0] > (ts->filter_level[1] + ts->ambiguous_state * 20) &&
+							finger_data[i][0] < (ts->filter_level[2] - ts->ambiguous_state * 20)) {
+							ts->grip_suppression &= ~BIT(i);
+						}
+					}
+					if ((ts->grip_suppression | ts->grip_b_suppression) & BIT(i)) {
+						finger_pressed &= ~BIT(i);
+					} else
+#endif
+
+					if (ts->htc_event == SYN_AND_REPORT_TYPE_B && ts->reduce_report_level[0]) {
+						if (ts->tap_suppression & BIT(i) && finger_pressed & BIT(i)) {
+							int dx, dy = 0;
+							dx = abs(ts->pre_finger_data[i + 1][2] - finger_data[i][0]);
+							dy = abs(ts->pre_finger_data[i + 1][3] - finger_data[i][1]);
+							if (dx > ts->reduce_report_level[TAP_DX_OUTER] || dy > ts->reduce_report_level[TAP_DY_OUTER]) {
+								ts->tap_suppression &= ~BIT(i);
+							} else if (ts->reduce_report_level[TAP_TIMEOUT] && time_after(jiffies, ts->tap_timeout[i]) && (dx > ts->reduce_report_level[TAP_DX_INTER] || dy > ts->reduce_report_level[TAP_DY_INTER])) {
+								ts->tap_suppression &= ~BIT(i);
+							} else {
+								finger_pressed &= ~BIT(i);
+								if (ts->debug_log_level & (BIT(1) | BIT(3)))
+									printk(KERN_INFO
+										"[TP] Filtered Finger %d=> X:%d, Y:%d w:%d, z:%d\n",
+										i + 1, finger_data[i][0], finger_data[i][1],
+										finger_data[i][2], finger_data[i][3]);
+							}
+						}
+					}
+
+					if ((finger_pressed & BIT(i)) == BIT(i)) {
+						finger_pressed &= ~BIT(i);
+
+						if (ts->htc_event == SYN_AND_REPORT_TYPE_A) {
+							if (ts->support_htc_event) {
+								input_report_abs(ts->input_dev, ABS_MT_AMPLITUDE,
+									finger_data[i][3] << 16 | finger_data[i][2]);
+								input_report_abs(ts->input_dev, ABS_MT_POSITION,
+									(finger_pressed == 0) << 31 |
+									finger_data[i][0] << 16 | finger_data[i][1]);
+							}
+							input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, i);
+							input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR,
+								finger_data[i][3]);
+							input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR,
+								finger_data[i][2]);
+							input_report_abs(ts->input_dev, ABS_MT_PRESSURE,
+								finger_data[i][2]);
+							input_report_abs(ts->input_dev, ABS_MT_POSITION_X,
+								finger_data[i][0]);
+							input_report_abs(ts->input_dev, ABS_MT_POSITION_Y,
+								finger_data[i][1]);
+							input_mt_sync(ts->input_dev);
+						} else if (ts->htc_event == SYN_AND_REPORT_TYPE_B) {
+							if (ts->support_htc_event) {
+								input_report_abs(ts->input_dev, ABS_MT_AMPLITUDE,
+									finger_data[i][3] << 16 | finger_data[i][2]);
+								input_report_abs(ts->input_dev, ABS_MT_POSITION,
+									(finger_pressed == 0) << 31 |
+									finger_data[i][0] << 16 | finger_data[i][1]);
+							}
+							input_mt_slot(ts->input_dev, i);
+							input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER,
+							1);
+							input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR,
+								finger_data[i][3]);
+							input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR,
+								finger_data[i][2]);
+							input_report_abs(ts->input_dev, ABS_MT_PRESSURE,
+								finger_data[i][2]);
+							input_report_abs(ts->input_dev, ABS_MT_POSITION_X,
+								finger_data[i][0]);
+							input_report_abs(ts->input_dev, ABS_MT_POSITION_Y,
+								finger_data[i][1]);
+						} else if (ts->htc_event == SYN_AND_REPORT_TYPE_HTC) {
+							input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, i);
+							input_report_abs(ts->input_dev, ABS_MT_AMPLITUDE,
+								finger_data[i][3] << 16 | finger_data[i][2]);
+							input_report_abs(ts->input_dev, ABS_MT_POSITION,
+								(finger_pressed == 0) << 31 |
+								finger_data[i][0] << 16 | finger_data[i][1]);
+						}
+
+						if ((finger_press_changed & BIT(i)) && ts->debug_log_level & BIT(3)) {
+							if(ts->width_factor && ts->height_factor){
+								printk(KERN_INFO
+									"[TP] Screen:F[%02d]:Down, X=%d, Y=%d, W=%d, Z=%d\n",
+									i+1, (finger_data[i][0]*ts->width_factor)>>SHIFT_BITS,
+									(finger_data[i][1]*ts->height_factor)>>SHIFT_BITS,
+									finger_data[i][2], finger_data[i][3]);
+							} else {
+								printk(KERN_INFO
+									"[TP] Raw:F[%02d]:Down, X=%d, Y=%d, W=%d, Z=%d\n",
+									i+1, finger_data[i][0], finger_data[i][1],
+									finger_data[i][2], finger_data[i][3]);
+							}
+						}
+
+						if (ts->pre_finger_data[0][0] < 2) {
+							if (finger_press_changed & BIT(i)) {
+								ts->pre_finger_data[i + 1][0] = finger_data[i][0];
+								ts->pre_finger_data[i + 1][1] = finger_data[i][1];
+
+								if (!ts->first_pressed)
+									printk(KERN_INFO "[TP] S%d@%d, %d\n", i + 1,
+										finger_data[i][0], finger_data[i][1]);
+								if (ts->packrat_number < SYNAPTICS_FW_NOCAL_PACKRAT) {
+								}
+							}
+						}
+
+						if (ts->htc_event == SYN_AND_REPORT_TYPE_B && ts->reduce_report_level[TAP_DX_OUTER]) {
+							if (finger_press_changed & BIT(i)) {
+								ts->tap_suppression &= ~BIT(i);
+								ts->tap_suppression |= BIT(i);
+								ts->pre_finger_data[i + 1][2] = finger_data[i][0];
+								ts->pre_finger_data[i + 1][3] = finger_data[i][1];
+								if (ts->reduce_report_level[TAP_TIMEOUT] && (ts->tap_suppression))
+									ts->tap_timeout[i] = jiffies + msecs_to_jiffies(ts->reduce_report_level[TAP_TIMEOUT]);
+							}
+						}
+
+						if (ts->debug_log_level & BIT(1))
+							printk(KERN_INFO
+								"[TP] Finger %d=> X:%d, Y:%d w:%d, z:%d\n",
+								i + 1, finger_data[i][0], finger_data[i][1],
+								finger_data[i][2], finger_data[i][3]);
+					}
+					if (!ts->finger_count)
+						ts->pre_finger_data[0][0] = 0;
+				}
+				base += 5;
+			}
+#ifdef SYN_FILTER_CONTROL
+			if (ts->filter_level[0] && ts->grip_suppression) {
+				ts->ambiguous_state = 0;
+				for (i = 0; i < ts->finger_support; i++)
+					if (ts->grip_suppression & BIT(i))
+						ts->ambiguous_state++;
+			}
+			if (ts->debug_log_level & BIT(16))
+				printk(KERN_INFO "[TP] ts->grip_suppression: %x, ts->ambiguous_state: %x\n",
+					ts->grip_suppression, ts->ambiguous_state);
+#endif
+		}
+	}
+	input_sync(ts->input_dev);
+
+}
+
+static void synaptics_ts_report_func(struct synaptics_ts_data *ts)
+{
+	int ret;
+	uint8_t data[2] = {0};
+
+	ret = i2c_syn_write(ts->client,
+		get_address_base(ts, 0x54, DATA_BASE) + 1, &data[0], 2);
+
+	if (ret < 0)
+		i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:1", __func__);
+	else {
+		ret = i2c_syn_read(ts->client,
+			get_address_base(ts, 0x54, DATA_BASE) + 3, ts->temp_report_data,
+			ts->x_channel * ts->y_channel * 2);
+		if (ret >= 0)
+			memcpy(&ts->report_data[0], &ts->temp_report_data[0], ts->x_channel * ts->y_channel * 2);
+		else {
+			memset(&ts->report_data[0], 0x0, sizeof(ts->report_data));
+			i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:2", __func__);
+		}
+	}
+	atomic_set(&ts->data_ready, 1);
+	wake_up(&syn_data_ready_wq);
+
+}
+
+static void synaptics_ts_button_func(struct synaptics_ts_data *ts)
+{
+	int ret;
+	uint8_t data = 0;
+	uint16_t x_position = 0, y_position = 0;
+
+	ret = i2c_syn_read(ts->client,
+		get_address_base(ts, 0x1A, DATA_BASE), &data, 1);
+	if (data) {
+		if (data & 0x01) {
+			printk("[TP] back key pressed\n");
+			vk_press = 1;
+			if (ts->button) {
+				if (ts->button[0].index) {
+					x_position = (ts->button[0].x_range_min + ts->button[0].x_range_max) / 2;
+					y_position = (ts->button[0].y_range_min + ts->button[0].y_range_max) / 2;
+				}
+			}
+			if (ts->htc_event == SYN_AND_REPORT_TYPE_A) {
+				input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, 0);
+				input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_PRESSURE,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_POSITION_X,
+					x_position);
+				input_report_abs(ts->input_dev, ABS_MT_POSITION_Y,
+					y_position);
+				input_mt_sync(ts->input_dev);
+			} else if (ts->htc_event == SYN_AND_REPORT_TYPE_B) {
+				input_mt_slot(ts->input_dev, 0);
+				input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER,
+				1);
+				input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_PRESSURE,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_POSITION_X,
+					x_position);
+				input_report_abs(ts->input_dev, ABS_MT_POSITION_Y,
+					y_position);
+			}
+		}
+		else if (data & 0x02) {
+			printk("[TP] home key pressed\n");
+			vk_press = 1;
+			if (ts->button) {
+				if (ts->button[1].index) {
+					x_position = (ts->button[1].x_range_min + ts->button[1].x_range_max) / 2;
+					y_position = (ts->button[1].y_range_min + ts->button[1].y_range_max) / 2;
+				}
+			}
+			if (ts->htc_event == SYN_AND_REPORT_TYPE_A) {
+				input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, 0);
+				input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_PRESSURE,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_POSITION_X,
+					x_position);
+				input_report_abs(ts->input_dev, ABS_MT_POSITION_Y,
+					y_position);
+				input_mt_sync(ts->input_dev);
+			} else if (ts->htc_event == SYN_AND_REPORT_TYPE_B) {
+				input_mt_slot(ts->input_dev, 0);
+				input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER,
+				1);
+				input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_PRESSURE,
+					100);
+				input_report_abs(ts->input_dev, ABS_MT_POSITION_X,
+					x_position);
+				input_report_abs(ts->input_dev, ABS_MT_POSITION_Y,
+					y_position);
+			}
+		}
+	}else {
+		printk("[TP] virtual key released\n");
+		vk_press = 0;
+		if (ts->htc_event == SYN_AND_REPORT_TYPE_A) {
+			if (ts->support_htc_event) {
+				input_report_abs(ts->input_dev, ABS_MT_AMPLITUDE, 0);
+				input_report_abs(ts->input_dev, ABS_MT_POSITION, 1 << 31);
+			}
+			input_mt_sync(ts->input_dev);
+		}
+		else if (ts->htc_event == SYN_AND_REPORT_TYPE_B) {
+			input_mt_slot(ts->input_dev, 0);
+			input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0);
+		}
+	}
+	input_sync(ts->input_dev);
+}
+
+static void synaptics_ts_status_func(struct synaptics_ts_data *ts)
+{
+	int ret;
+	uint8_t data = 0;
+
+	ret = i2c_syn_read(ts->client, get_address_base(ts, 0x01, DATA_BASE), &data, 1);
+	if (ret < 0) {
+		i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r", __func__);
+	} else {
+		data &= 0x0F;
+		printk(KERN_INFO "[TP] Device Status = %x\n", data);
+		if (data == 1) {
+			mutex_lock(&syn_mutex);
+			ts->page_select = 0;
+			mutex_unlock(&syn_mutex);
+			printk(KERN_INFO "[TP] TOUCH: Page Select: %s: %d\n", __func__, ts->page_select);
+			ret = synaptics_init_panel(ts);
+			if (ret < 0)
+				printk(KERN_INFO "[TP]%s: synaptics_init_panel fail\n", __func__);
+		}
+	}
+
+}
+
+static void synaptics_ts_work_func(struct work_struct *work)
+{
+	struct synaptics_ts_data *ts = container_of(work, struct synaptics_ts_data, work);
+	int ret;
+	uint8_t buf = 0;
+	ret = i2c_syn_read(ts->client, get_address_base(ts, 0x01, DATA_BASE) + 1, &buf, 1);
+
+	if (ret < 0) {
+		i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r", __func__);
+	} else {
+		if (buf & get_address_base(ts, 0x11, INTR_SOURCE))
+			synaptics_ts_finger_func(ts);
+		if (buf & get_address_base(ts, 0x01, INTR_SOURCE))
+			synaptics_ts_status_func(ts);
+		if (buf & get_address_base(ts, 0x54, INTR_SOURCE))
+			synaptics_ts_report_func(ts);
+	}
+
+}
+
+static irqreturn_t synaptics_irq_thread(int irq, void *ptr)
+{
+	struct synaptics_ts_data *ts = ptr;
+	int ret;
+	uint8_t buf = 0;
+	struct timespec timeStart, timeEnd, timeDelta;
+
+	if (ts->debug_log_level & BIT(2)) {
+			getnstimeofday(&timeStart);
+	}
+
+	ret = i2c_syn_read(ts->client, get_address_base(ts, 0x01, DATA_BASE) + 1, &buf, 1);
+
+	if (ret < 0) {
+		i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r", __func__);
+	} else {
+		if (buf & get_address_base(ts, 0x1A, INTR_SOURCE)) {
+			if (!ts->finger_count)
+				synaptics_ts_button_func(ts);
+			else
+				printk("[TP] Ignore VK interrupt due to 2d points did not leave\n");
+		}
+		if (buf & get_address_base(ts, 0x11, INTR_SOURCE)) {
+			if (!vk_press) {
+				synaptics_ts_finger_func(ts);
+				if(ts->debug_log_level & BIT(2)) {
+					getnstimeofday(&timeEnd);
+					timeDelta.tv_nsec = (timeEnd.tv_sec*1000000000+timeEnd.tv_nsec)
+						-(timeStart.tv_sec*1000000000+timeStart.tv_nsec);
+					printk(KERN_INFO "[TP] Touch latency = %ld us\n", timeDelta.tv_nsec/1000);
+				}
+			}
+		}
+		if (buf & get_address_base(ts, 0x01, INTR_SOURCE))
+			synaptics_ts_status_func(ts);
+		if (buf & get_address_base(ts, 0x54, INTR_SOURCE))
+			synaptics_ts_report_func(ts);
+	}
+
+	return IRQ_HANDLED;
+}
+
+static enum hrtimer_restart synaptics_ts_timer_func(struct hrtimer *timer)
+{
+	struct synaptics_ts_data *ts = container_of(timer, struct synaptics_ts_data, timer);
+	queue_work(ts->syn_wq, &ts->work);
+	hrtimer_start(&ts->timer, ktime_set(0, 12500000), HRTIMER_MODE_REL);
+	return HRTIMER_NORESTART;
+}
+
+#ifdef SYN_CABLE_CONTROL
+static void cable_tp_status_handler_func(int connect_status)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	uint8_t data;
+	int ret;
+
+	printk(KERN_INFO "[TP] Touch: cable change to %d\n", connect_status);
+
+	if (connect_status)
+		connect_status = 1;
+	ret = i2c_syn_read(ts->client, get_address_base(ts, 0x01, CONTROL_BASE), &data, 1);
+	if (ret < 0) {
+		i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:1", __func__);
+	} else {
+		ts->cable_config = (data & 0xDF) | (connect_status << 5);
+		printk(KERN_INFO "[TP] %s: ts->cable_config: %x\n", __func__, ts->cable_config);
+		ret = i2c_syn_write_byte_data(ts->client,
+			get_address_base(ts, 0x01, CONTROL_BASE), ts->cable_config);
+		if (ret < 0) {
+			i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:2", __func__);
+		}
+	}
+}
+static struct t_usb_status_notifier cable_status_handler = {
+	.name = "usb_tp_connected",
+	.func = cable_tp_status_handler_func,
+};
+#endif
+
+static void synaptics_ts_close_psensor_func(struct work_struct *work)
+{
+	struct synaptics_ts_data *ts = container_of(work, struct synaptics_ts_data, psensor_work);
+	if(ts->psensor_resume_enable == 1) {
+		printk(KERN_INFO "[TP] %s: Disable P-sensor by Touch\n", __func__);
+		psensor_enable_by_touch_driver(0);
+		ts->psensor_resume_enable = 0;
+	}
+}
+
+static int psensor_tp_status_handler_func(struct notifier_block *this,
+	unsigned long status, void *unused)
+{
+	struct synaptics_ts_data *ts = gl_ts;
+	int ret;
+
+	printk(KERN_INFO "[TP] psensor status %d -> %lu\n",
+		ts->psensor_status, status);
+
+	if(ts->psensor_detection) {
+		if(status == 3 && ts->psensor_resume_enable >= 1) {
+			if(!(ts->psensor_status==1 && ts->psensor_resume_enable==1)) {
+				ret = i2c_syn_write_byte_data(ts->client, get_address_base(ts, 0x11, COMMAND_BASE), 0x01);
+				if (ret < 0)
+					i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "w:Rezero_1", __func__);
+				printk(KERN_INFO "[TP] %s: Touch Calibration Confirmed, rezero\n", __func__);
+			}
+
+			if(ts->psensor_resume_enable == 1)
+				queue_work(ts->syn_psensor_wq, &ts->psensor_work);
+			else
+				ts->psensor_resume_enable = 0;
+		}
+	}
+
+	if (ts->psensor_status == 0) {
+		if (status == 1)
+			ts->psensor_status = status;
+		else
+			ts->psensor_status = 0;
+	} else
+		ts->psensor_status = status;
+
+	if(ts->psensor_detection) {
+		if(ts->psensor_status == 0) {
+			ts->psensor_resume_enable = 0;
+			ts->psensor_phone_enable = 0;
+		}
+	}
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block psensor_status_handler = {
+	.notifier_call = psensor_tp_status_handler_func,
+};
+
+static int syn_pdt_scan(struct synaptics_ts_data *ts, int num_page)
+{
+	uint8_t intr_count = 0, data[6] = {0}, num_function[SYN_MAX_PAGE] = {0};
+	uint16_t i, j, k = 0;
+	int ret = 0;
+	ts->num_function = 0;
+
+	for (i = 0; i < num_page; i++) {
+		for (j = (0xEE | (i << 8)); j >= (0xBE | (i << 8)); j -= 6) {
+			ret = i2c_syn_read(ts->client, j, data, 1);
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r1", __func__);
+			if (data[0] == 0)
+				break;
+			else
+				num_function[i]++;
+		}
+		ts->num_function += num_function[i];
+	}
+
+	if (ts->address_table == NULL) {
+		ts->address_table = kzalloc(sizeof(struct function_t) * ts->num_function, GFP_KERNEL);
+		if (ts->address_table == NULL) {
+			printk(KERN_INFO "[TP] syn_pdt_scan: memory allocate fail\n");
+			return -ENOMEM;
+		}
+		printk(KERN_INFO "[TP] syn_pdt_scan: memory allocate success. ptr: %p\n", ts->address_table);
+	}
+
+	printk(KERN_INFO "[TP] synaptics: %d function supported\n", ts->num_function);
+	for (i = 0; i < num_page; i++) {
+		for (j = 0; j < num_function[i]; j++) {
+			ret = i2c_syn_read(ts->client, i << 8 | (0xE9 - 6*j), data, 6);
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:2", __func__);
+			ts->address_table[j + k].query_base = i << 8 | data[0];
+			ts->address_table[j + k].command_base = i << 8 | data[1];
+			ts->address_table[j + k].control_base = i << 8 | data[2];
+			ts->address_table[j + k].data_base = i << 8 | data[3];
+			if (data[4] & 0x07) {
+				ts->address_table[j + k].interrupt_source =
+					get_int_mask(data[4] & 0x07, intr_count);
+				intr_count += (data[4] & 0x07);
+			}
+			ts->address_table[j + k].function_type = data[5];
+			printk(KERN_INFO
+				"Query: %2.2X, Command: %4.4X, Control: %2X, Data: %2X, INTR: %2X, Funtion: %2X\n",
+				ts->address_table[j + k].query_base , ts->address_table[j + k].command_base,
+				ts->address_table[j + k].control_base, ts->address_table[j + k].data_base,
+				ts->address_table[j + k].interrupt_source, ts->address_table[j + k].function_type);
+		}
+		k += num_function[i];
+	}
+	return ts->num_function;
+}
+static int syn_get_version(struct synaptics_ts_data *ts)
+{
+	uint8_t data[16] = {0};
+	int ret = 0;
+	ret = i2c_syn_read(ts->client, get_address_base(ts, 0x01, QUERY_BASE) + 17, data, 4);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:1", __func__);
+	ts->package_id = data[1] << 8 | data[0];
+	printk(KERN_INFO "[TP] %s: package_id: %d\n", __func__, ts->package_id);
+
+	ret = i2c_syn_read(ts->client, get_address_base(ts, 0x01, QUERY_BASE) + 18, data, 3);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:3", __func__);
+	ts->packrat_number = data[2] << 16 | data[1] << 8 | data[0];
+	printk(KERN_INFO "[TP] %s: packrat_number: %d\n", __func__, ts->packrat_number);
+
+	if (ts->packrat_number < SYNAPTICS_FW_3_2_PACKRAT) {
+
+		ret = i2c_syn_read(ts->client, get_address_base(ts, 0x01, QUERY_BASE) + 16, data, 3);
+		if (ret < 0)
+			return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:2", __func__);
+		syn_panel_version = data[0] << 8 | data[2];
+		printk(KERN_INFO "[TP] %s: panel_version: %x\n", __func__, syn_panel_version);
+
+	} else {
+
+		ret = i2c_syn_read(ts->client, get_address_base(ts, 0x01, QUERY_BASE) + 28, data, 16);
+		if (ret < 0)
+			return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:2", __func__);
+		syn_panel_version = data[5] << 8 | data[7];
+		printk(KERN_INFO "[TP] %s: panel_version: %x\n", __func__, syn_panel_version);
+	}
+
+	ret = i2c_syn_read(ts->client, get_address_base(ts, 0x34, CONTROL_BASE), data, 4);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:4", __func__);
+	ts->config_version = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
+	printk(KERN_INFO "[TP] %s: config version: %x\n", __func__, ts->config_version);
+
+	return 0;
+}
+
+static int syn_get_information(struct synaptics_ts_data *ts)
+{
+	uint8_t data[4] = {0}, i, num_channel, *buf;
+	int ret = 0;
+	ret = i2c_syn_read(ts->client, get_address_base(ts, 0x11, QUERY_BASE) + 1, data, 1);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:1", __func__);
+	if ((data[0] & 0x07) == 5)
+		ts->finger_support = 10;
+	else if ((data[0] & 0x07) < 5)
+		ts->finger_support = (data[0] & 0x07) + 1;
+	else {
+		printk(KERN_INFO "[TP] %s: number of fingers not define: %x\n",
+			__func__, data[0] & 0x07);
+		return SYN_PROCESS_ERR;
+	}
+
+	printk(KERN_INFO "[TP] %s: finger_support: %d\n", __func__, ts->finger_support);
+
+	ret = i2c_syn_read(ts->client, get_address_base(ts, 0x11, CONTROL_BASE) + 6, data, 4);
+	if (ret < 0)
+		return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:2", __func__);
+
+	ts->max[0] = data[0] | data[1] << 8;
+	ts->max[1] = data[2] | data[3] << 8;
+	printk(KERN_INFO "[TP] %s: max_x: %d, max_y: %d\n", __func__, ts->max[0], ts->max[1]);
+
+	if (get_address_base(ts, 0x54, FUNCTION)) {
+		ret = i2c_syn_read(ts->client, get_address_base(ts, 0x54, QUERY_BASE), data, 2);
+		if (ret < 0)
+			return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:3", __func__);
+
+		ts->y_channel = data[0];
+		ts->x_channel = data[1];
+
+		num_channel = ts->y_channel + ts->x_channel;
+		buf = kzalloc(num_channel + 1, GFP_KERNEL);
+		if (buf == NULL) {
+			printk(KERN_INFO "[TP] %s: memory allocate fail\n", __func__);
+			return -ENOMEM;
+		}
+		if (ts->packrat_number < SYNAPTICS_FW_3_2_PACKRAT)
+			ret = i2c_syn_read(ts->client, get_address_base(ts, 0x54, CONTROL_BASE) + 17,
+				buf, num_channel + 1);
+		else
+			ret = i2c_syn_read(ts->client, get_address_base(ts, 0x55, CONTROL_BASE),
+				buf, num_channel + 1);
+		if (ret < 0) {
+			kfree(buf);
+			return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:4", __func__);
+		}
+
+		for (i = 1; i < num_channel + 1; i++) {
+			if (buf[i] == 0xFF) {
+				if (i <= num_channel - ts->x_channel)
+					ts->y_channel--;
+				else
+					ts->x_channel--;
+			}
+		}
+
+		if (buf[0] & 0x01)
+			swap(ts->y_channel, ts->x_channel);
+		printk(KERN_INFO "[TP] %s: X: %d, Y: %d\n", __func__,
+			ts->x_channel, ts->y_channel);
+		kfree(buf);
+
+		ts->temp_report_data = kzalloc(2 * ts->x_channel * ts->y_channel, GFP_KERNEL);
+		ts->report_data = kzalloc(2 * ts->x_channel * ts->y_channel, GFP_KERNEL);
+		if(ts->temp_report_data == NULL || ts->report_data == NULL)
+			return -ENOMEM;
+
+		ret = i2c_syn_read(ts->client,
+			get_address_base(ts, 0x54, CONTROL_BASE) + 0x10, &ts->relaxation, 1);
+		if (ret < 0)
+			return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:5", __func__);
+		printk(KERN_INFO "[TP] %s: ts->relaxation: %d\n", __func__, ts->relaxation);
+
+	}
+	if (ts->packrat_number < SYNAPTICS_FW_NOCAL_PACKRAT) {
+		if (ts->large_obj_check) {
+			if (ts->package_id == 2200) {
+				ret = i2c_syn_read(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x26, &ts->default_large_obj, 1);
+			} else {
+				ret = i2c_syn_read(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x29, &ts->default_large_obj, 1);
+			}
+			if (ret < 0)
+					return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:6", __func__);
+			printk(KERN_INFO "[TP] %s: ts->default_large_obj: %x\n", __func__, ts->default_large_obj);
+		}
+
+		if (ts->segmentation_bef_unlock) {
+			if (ts->package_id == 2200) {
+				ret = i2c_syn_read(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x25, &ts->segmentation_aft_unlock, 1);
+
+			} else {
+				ret = i2c_syn_read(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x22, &ts->segmentation_aft_unlock, 1);
+			}
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:7", __func__);
+			printk(KERN_INFO "[TP] %s: ts->segmentation_aft_unlock: %x\n", __func__, ts->segmentation_aft_unlock);
+		}
+
+		if (ts->threshold_bef_unlock) {
+			if (ts->package_id == 2200) {
+				ret = i2c_syn_read(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x0A, &ts->threshold_aft_unlock, 1);
+
+			} else {
+				ret = i2c_syn_read(ts->client,
+					get_address_base(ts, 0x11, CONTROL_BASE) + 0x0C, &ts->threshold_aft_unlock, 1);
+			}
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:8", __func__);
+			printk(KERN_INFO "[TP] %s: ts->z_threshold_aft_unlock: %x\n", __func__, ts->threshold_aft_unlock);
+		}
+
+		if (ts->saturation_bef_unlock) {
+			ret = i2c_syn_read(ts->client,
+				get_address_base(ts, 0x54, CONTROL_BASE) + 0x02, data, 2);
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:8", __func__);
+			ts->saturation_aft_unlock = (data[1] << 8) | data[0];
+			printk(KERN_INFO "[TP] %s: ts->saturation_aft_unlock: %x\n", __func__, ts->saturation_aft_unlock);
+		}
+
+		if (ts->PixelTouchThreshold_bef_unlock) {
+			ret = i2c_syn_read(ts->client,
+				get_address_base(ts, 0x54, CONTROL_BASE) + 0x04, &ts->PixelTouchThreshold_aft_unlock, 1);
+			if (ret < 0)
+				return i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "r:9", __func__);
+			printk(KERN_INFO "[TP] %s: ts->PixelTouchThreshold_aft_unlock: %x\n", __func__, ts->PixelTouchThreshold_aft_unlock);
+		}
+	}
+
+	return 0;
+}
+
+static int synaptics_ts_probe(
+	struct i2c_client *client, const struct i2c_device_id *id)
+{
+	struct synaptics_ts_data *ts;
+	uint8_t i;
+	int ret = 0;
+	struct synaptics_i2c_rmi_platform_data *pdata;
+	uint8_t data = 0;
+
+	printk(KERN_INFO "[TP] %s: enter", __func__);
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		printk(KERN_ERR "[TP] TOUCH_ERR: synaptics_ts_probe: need I2C_FUNC_I2C\n");
+		ret = -ENODEV;
+		goto err_check_functionality_failed;
+	}
+
+	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
+	if (ts == NULL) {
+		ret = -ENOMEM;
+		goto err_alloc_data_failed;
+	}
+	ts->client = client;
+	i2c_set_clientdata(client, ts);
+	pdata = client->dev.platform_data;
+
+	if (pdata == NULL) {
+		printk(KERN_INFO "[TP] pdata is NULL\n");
+		goto err_get_platform_data_fail;
+	}
+
+	ret = i2c_syn_read(ts->client, 0x00EE, &data, 1);
+	if (ret < 0) {
+		printk(KERN_INFO "[TP] No Synaptics chip\n");
+		goto err_detect_failed;
+	}
+
+	for (i = 0; i < 10; i++) {
+		ret = i2c_syn_read(ts->client, SYN_F01DATA_BASEADDR, &data, 1);
+		if (ret < 0) {
+			i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "read device status failed!", __func__);
+			goto err_detect_failed;
+		}
+		if (data & 0x44) {
+			msleep(20);
+#ifdef SYN_FLASH_PROGRAMMING_LOG
+			printk(KERN_INFO "[TP] synaptics probe: F01_data: %x touch controller stay in bootloader mode!\n", data);
+#endif
+		} else if (data & 0x40) {
+			printk(KERN_ERR "[TP] TOUCH_ERR: synaptics probe: F01_data: %x touch controller stay in bootloader mode!\n", data);
+			goto err_detect_failed;
+		} else
+			break;
+	}
+
+	if (i == 10) {
+		uint8_t num = 0;
+		printk(KERN_INFO "[TP] synaptics probe: touch controller doesn't enter UI mode! F01_data: %x\n", data);
+
+		if (syn_pdt_scan(ts, SYN_BL_PAGE) < 0) {
+			printk(KERN_ERR "[TP] TOUCH_ERR: PDT scan fail\n");
+			goto err_init_failed;
+		}
+
+		if (pdata) {
+			while (pdata->default_config != 1) {
+				if (pdata->default_config == 0) {
+					printk(KERN_ERR "[TP] TOUCH_ERR: touch controller stays in bootloader mode "
+						"and recovery method doesn't enable\n");
+					goto err_init_failed;
+				}
+				pdata++;
+				num++;
+			}
+			ts->config = pdata->config;
+
+			ret = syn_config_update(ts, pdata->gpio_irq);
+			if (ret < 0) {
+				printk(KERN_ERR "[TP] TOUCH_ERR: syn_config_update fail\n");
+				goto err_init_failed;
+			} else if (ret == 0)
+				printk(KERN_INFO "[TP] syn_config_update success\n");
+			else
+				printk(KERN_INFO "[TP] Warning: syn_config_update: the same "
+					"config version and CRC but touch controller always stay in bootloader mode\n");
+			pdata = pdata - num;
+		}
+
+		if (ts->address_table != NULL) {
+			kfree(ts->address_table);
+			ts->address_table = NULL;
+		}
+	}
+
+	if (syn_pdt_scan(ts, SYN_MAX_PAGE) < 0) {
+		printk(KERN_ERR "[TP] TOUCH_ERR: PDT scan fail\n");
+		goto err_init_failed;
+	}
+
+	if (syn_get_version(ts) < 0) {
+		printk(KERN_ERR "[TP] TOUCH_ERR: syn_get_version fail\n");
+		goto err_init_failed;
+	}
+
+	if (pdata) {
+		while (pdata->packrat_number && pdata->packrat_number > ts->packrat_number) {
+			pdata++;
+		}
+
+		if (pdata->tw_pin_mask) {
+			ts->tw_pin_mask = pdata->tw_pin_mask;
+			ret = syn_get_tw_vendor(ts, pdata->gpio_irq);
+			if (ret < 0) {
+				printk(KERN_ERR "[TP] TOUCH_ERR: syn_get_tw_vendor fail\n");
+				goto err_init_failed;
+			}
+		}
+
+		while (pdata->sensor_id > 0 && pdata->sensor_id != (SENSOR_ID_CHECKING_EN | ts->tw_vendor)) {
+			pdata++;
+		}
+
+		printk(KERN_INFO "[TP] synaptics_ts_probe: pdata->version = %x, pdata->packrat_number = %d,"
+				" pdata->sensor_id = %x\n", pdata->version, pdata->packrat_number, pdata->sensor_id);
+
+		if (!pdata->packrat_number) {
+			printk(KERN_ERR "[TP] TOUCH_ERR: get null platform data\n");
+				goto err_init_failed;
+		}
+
+		ts->power = pdata->power;
+		ts->flags = pdata->flags;
+		ts->htc_event = pdata->report_type;
+		ts->filter_level = pdata->filter_level;
+		ts->reduce_report_level = pdata->reduce_report_level;
+		ts->gpio_irq = pdata->gpio_irq;
+		ts->gpio_reset = pdata->gpio_reset;
+		ts->large_obj_check = pdata->large_obj_check;
+		ts->support_htc_event = pdata->support_htc_event;
+		ts->mfg_flag = pdata->mfg_flag;
+		ts->segmentation_bef_unlock = pdata->segmentation_bef_unlock;
+		ts->i2c_err_handler_en = pdata->i2c_err_handler_en;
+		ts->threshold_bef_unlock = pdata->threshold_bef_unlock;
+		ts->saturation_bef_unlock = pdata->saturation_bef_unlock;
+		ts->energy_ratio_relaxation = pdata->energy_ratio_relaxation;
+		ts->multitouch_calibration = pdata->multitouch_calibration;
+		ts->psensor_detection = pdata->psensor_detection;
+		ts->PixelTouchThreshold_bef_unlock = pdata->PixelTouchThreshold_bef_unlock;
+#ifdef SYN_CABLE_CONTROL
+		ts->cable_support = pdata->cable_support; 
+#endif
+		ts->config = pdata->config;
+		if (pdata->virtual_key)
+			ts->button = pdata->virtual_key;
+	}
+
+#ifndef SYN_DISABLE_CONFIG_UPDATE
+	ret = syn_config_update(ts, pdata->gpio_irq);
+	if (ret < 0) {
+		printk(KERN_ERR "[TP] TOUCH_ERR: syn_config_update fail\n");
+		goto err_init_failed;
+	} else if (ret == 0)
+		printk(KERN_INFO "[TP] syn_config_update success\n");
+	else
+		printk(KERN_INFO "[TP] syn_config_update: the same config version and CRC\n");
+#else
+	if (pdata->tw_pin_mask) {
+		ret = disable_flash_programming(ts, 0);
+		if (ret < 0) {
+			printk(KERN_ERR "[TP] TOUCH_ERR: disable_flash_programming fail\n");
+			goto err_init_failed;
+		}
+	}
+#endif
+	if (syn_pdt_scan(ts, SYN_MAX_PAGE) < 0) {
+		printk(KERN_ERR "[TP] TOUCH_ERR: PDT scan fail\n");
+		goto err_init_failed;
+	}
+
+#ifndef SYN_DISABLE_CONFIG_UPDATE
+	if (pdata->customer_register[CUS_REG_BASE]) {
+		ret = i2c_syn_write(ts->client, pdata->customer_register[CUS_REG_BASE],
+			&pdata->customer_register[CUS_BALLISTICS_CTRL], CUS_REG_SIZE - 1);
+		printk(KERN_INFO "[TP] Loads customer register\n");
+	}
+#endif
+
+	if (syn_get_information(ts) < 0) {
+		printk(KERN_ERR "[TP] TOUCH_ERR: syn_get_information fail\n");
+		goto err_syn_get_info_failed;
+	}
+
+	if (pdata->abs_x_max  == 0 && pdata->abs_y_max == 0) {
+		ts->layout[0] = ts->layout[2] = 0;
+		ts->layout[1] = ts->max[0];
+		ts->layout[3] = ts->max[1];
+	} else {
+		ts->layout[0] = pdata->abs_x_min;
+		ts->layout[1] = pdata->abs_x_max;
+		ts->layout[2] = pdata->abs_y_min;
+		ts->layout[3] = pdata->abs_y_max;
+	}
+
+	if(pdata->display_width && pdata->display_height){
+		printk(KERN_INFO "[TP] Load display resolution: %dx%d\n", pdata->display_width, pdata->display_height);
+		ts->width_factor = (pdata->display_width<<SHIFT_BITS)/(ts->layout[1]-ts->layout[0]);
+		ts->height_factor = (pdata->display_height<<SHIFT_BITS)/(ts->layout[3]-ts->layout[2]);
+	}
+
+	if(get_tamper_sf()==0) {
+		ts->debug_log_level |= BIT(3);
+		printk(KERN_INFO "[TP] Debug log level=0x%02X\n", ts->debug_log_level);
+	}
+
+	if (get_address_base(ts, 0x19, FUNCTION)) {
+		ret = i2c_syn_read(ts->client, get_address_base(ts, 0x19, QUERY_BASE) + 1,
+			&ts->key_number, 1);
+		if (ret < 0) {
+			i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "F19 Query fail", __func__);
+			goto err_F19_query_failed;
+		}
+		for (i = 0; i < ts->key_number; i++) {
+			ts->key_postion_x[i] =
+				(ts->layout[1] - ts->layout[0]) * (i * 2 + 1) / (ts->key_number * 2)
+				+ ts->layout[0];
+			printk(KERN_INFO "[TP] ts->key_postion_x[%d]: %d\n",
+				i, ts->key_postion_x[i]);
+		}
+		ts->key_postion_y = ts->layout[2] +
+			(21 * (ts->layout[3] - ts->layout[2]) / 20);
+		printk(KERN_INFO "[TP] ts->key_postion_y: %d\n", ts->key_postion_y);
+	}
+
+	ret = synaptics_init_panel(ts);
+	if (ret < 0) {
+		printk(KERN_ERR "[TP] TOUCH_ERR: synaptics_init_panel fail\n");
+		goto err_init_panel_failed;
+	}
+
+	init_waitqueue_head(&syn_data_ready_wq);
+
+	if(ts->psensor_detection) {
+		INIT_WORK(&ts->psensor_work, synaptics_ts_close_psensor_func);
+		ts->syn_psensor_wq = create_singlethread_workqueue("synaptics_psensor_wq");
+		if (!ts->syn_psensor_wq)
+			goto err_create_wq_failed;
+	}
+
+	ret = synaptics_input_register(ts);
+	if (ret) {
+		printk(KERN_ERR "[TP] TOUCH_ERR: synaptics_ts_probe: "
+				"Unable to register %s input device\n",
+				ts->input_dev->name);
+		goto err_input_register_device_failed;
+	}
+
+	gl_ts = ts;
+
+	ts->irq_enabled = 0;
+	if (client->irq) {
+		ts->use_irq = 1;
+		ret = request_threaded_irq(client->irq, NULL, synaptics_irq_thread,
+			IRQF_TRIGGER_LOW | IRQF_ONESHOT, client->name, ts);
+		if (ret == 0) {
+			ts->irq_enabled = 1;
+			ret = i2c_syn_read(ts->client,
+				get_address_base(ts, 0x01, CONTROL_BASE) + 1, &ts->intr_bit, 1);
+			if (ret < 0) {
+				free_irq(client->irq, ts);
+				i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "get interrupt bit failed", __func__);
+				goto err_get_intr_bit_failed;
+			}
+			printk(KERN_INFO "[TP] %s: interrupt enable: %x\n", __func__, ts->intr_bit);
+		} else {
+			dev_err(&client->dev, "[TP] TOUCH_ERR: request_irq failed\n");
+			ts->use_irq = 0;
+		}
+	}
+
+	if (!ts->use_irq) {
+
+		ts->syn_wq = create_singlethread_workqueue("synaptics_wq");
+		if (!ts->syn_wq)
+			goto err_create_wq_failed;
+
+		INIT_WORK(&ts->work, synaptics_ts_work_func);
+
+		hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+		ts->timer.function = synaptics_ts_timer_func;
+		hrtimer_start(&ts->timer, ktime_set(1, 0), HRTIMER_MODE_REL);
+	}
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+	ts->early_suspend.level = EARLY_SUSPEND_LEVEL_STOP_DRAWING - 1;
+	ts->early_suspend.suspend = synaptics_ts_early_suspend;
+	ts->early_suspend.resume = synaptics_ts_late_resume;
+	register_early_suspend(&ts->early_suspend);
+#endif
+
+#ifdef SYN_CABLE_CONTROL
+	if (ts->cable_support) {
+		usb_register_notifier(&cable_status_handler);
+		
+		ret = i2c_syn_read(ts->client,
+			get_address_base(ts, 0x11, CONTROL_BASE), &ts->cable_config, 1);
+		if (ret < 0) {
+			printk(KERN_ERR "[TP] TOUCH_ERR: get cable config failed\n");
+			goto err_get_cable_config_failed;
+		}
+		if (usb_get_connect_type())
+			cable_tp_status_handler_func(1);
+		printk(KERN_INFO "[TP] %s: ts->cable_config: %x\n", __func__, ts->cable_config);
+	}
+#endif
+	register_notifier_by_psensor(&psensor_status_handler);
+	synaptics_touch_sysfs_init();
+#ifdef SYN_WIRELESS_DEBUG
+	if (rmi_char_dev_register())
+		printk(KERN_INFO "[TP] %s: error register char device", __func__);
+#endif
+
+	printk(KERN_INFO "[TP] synaptics_ts_probe: Start touchscreen %s in %s mode\n", ts->input_dev->name, ts->use_irq ? "interrupt" : "polling");
+
+	return 0;
+
+#ifdef SYN_CABLE_CONTROL
+err_get_cable_config_failed:
+	if (ts->use_irq)
+		free_irq(client->irq, ts);
+	else
+		destroy_workqueue(ts->syn_wq);
+#endif
+
+err_create_wq_failed:
+
+err_get_intr_bit_failed:
+err_input_register_device_failed:
+	input_free_device(ts->input_dev);
+
+err_init_panel_failed:
+err_F19_query_failed:
+err_syn_get_info_failed:
+	if(ts->report_data != NULL)
+		kfree(ts->report_data);
+	if(ts->temp_report_data != NULL)
+		kfree(ts->temp_report_data);
+err_init_failed:
+	if(ts->address_table != NULL)
+		kfree(ts->address_table);
+err_detect_failed:
+err_get_platform_data_fail:
+	kfree(ts);
+
+err_alloc_data_failed:
+err_check_functionality_failed:
+	return ret;
+}
+
+static int synaptics_ts_remove(struct i2c_client *client)
+{
+	struct synaptics_ts_data *ts = i2c_get_clientdata(client);
+	unregister_early_suspend(&ts->early_suspend);
+	if (ts->use_irq)
+		free_irq(client->irq, ts);
+	else {
+		hrtimer_cancel(&ts->timer);
+		if (ts->syn_wq)
+			destroy_workqueue(ts->syn_wq);
+	}
+	if(ts->sr_input_dev != NULL)
+		input_unregister_device(ts->sr_input_dev);
+	input_unregister_device(ts->input_dev);
+
+	synaptics_touch_sysfs_remove();
+
+	if(ts->report_data != NULL)
+		kfree(ts->report_data);
+	if(ts->temp_report_data != NULL)
+		kfree(ts->temp_report_data);
+	if(ts->address_table != NULL)
+		kfree(ts->address_table);
+	kfree(ts);
+	return 0;
+}
+
+static int synaptics_ts_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+	int ret;
+	struct synaptics_ts_data *ts = i2c_get_clientdata(client);
+	printk(KERN_INFO "[TP] %s: enter\n", __func__);
+
+	if (ts->use_irq) {
+		disable_irq(client->irq);
+		ts->irq_enabled = 0;
+	} else {
+		hrtimer_cancel(&ts->timer);
+		ret = cancel_work_sync(&ts->work);
+	}
+
+	if(ts->psensor_detection) {
+		if(ts->psensor_resume_enable == 1){
+			printk(KERN_INFO "[TP] %s: Disable P-sensor by Touch\n", __func__);
+			psensor_enable_by_touch_driver(0);
+			ts->psensor_resume_enable = 0;
+		}
+	}
+
+	if (ts->psensor_status == 0) {
+		ts->pre_finger_data[0][0] = 0;
+		if (ts->packrat_number < SYNAPTICS_FW_NOCAL_PACKRAT) {
+			ts->first_pressed = 0;
+
+			if (ts->large_obj_check) {
+				if (ts->package_id == 2200) {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x26, ts->default_large_obj & 0x7F);
+
+				} else {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x29, ts->default_large_obj & 0x7F);
+				}
+				if (ret < 0)
+					i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "large obj suppression", __func__);
+				printk(KERN_INFO "[TP] touch suspend, set large obj suppression: %x\n", ts->default_large_obj & 0x7F);
+			}
+
+			if (ts->segmentation_bef_unlock) {
+				if (ts->package_id == 2200) {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x25, ts->segmentation_bef_unlock);
+				} else {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x22, ts->segmentation_bef_unlock);
+				}
+				if (ret < 0)
+					i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "segmentation aggressiveness", __func__);
+				printk(KERN_INFO "[TP] touch suspend, set segmentation aggressiveness: %x\n", ts->segmentation_bef_unlock);
+			}
+
+			if (ts->threshold_bef_unlock) {
+				if (ts->package_id == 2200) {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x0A, ts->threshold_bef_unlock);
+
+				} else {
+					ret = i2c_syn_write_byte_data(ts->client,
+						get_address_base(ts, 0x11, CONTROL_BASE) + 0x0C, ts->threshold_bef_unlock);
+				}
+				if (ret < 0)
+					i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "Z Touch threshold", __func__);
+				printk(KERN_INFO "[TP] touch suspend, set Z Touch threshold: %x\n", ts->threshold_bef_unlock);
+			}
+		}
+	}
+	else if(ts->psensor_detection)
+		ts->psensor_phone_enable = 1;
+
+	if (ts->packrat_number < SYNAPTICS_FW_NOCAL_PACKRAT)
+		printk(KERN_INFO "[TP][PWR][STATE] get power key state = %d\n", getPowerKeyState());
+
+	if (ts->power)
+		ts->power(0);
+	else {
+		if (ts->packrat_number >= SYNAPTICS_FW_NOCAL_PACKRAT) {
+			ret = i2c_syn_write_byte_data(client,
+					get_address_base(ts, 0x01, CONTROL_BASE), 0x01); 
+			if (ret < 0)
+				i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "sleep: 0x01", __func__);
+		} else {
+			if (ts->psensor_status > 0 && getPowerKeyState() == 0) {
+				ret = i2c_syn_write_byte_data(client,
+					get_address_base(ts, 0x01, CONTROL_BASE), 0x02); 
+				if (ret < 0)
+					i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "sleep: 0x02", __func__);
+			} else {
+				ret = i2c_syn_write_byte_data(client,
+					get_address_base(ts, 0x01, CONTROL_BASE), 0x01); 
+				if (ret < 0)
+					i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "sleep: 0x01", __func__);
+			}
+		}
+	}
+	return 0;
+}
+
+static int synaptics_ts_resume(struct i2c_client *client)
+{
+	int ret;
+	struct synaptics_ts_data *ts = i2c_get_clientdata(client);
+	printk(KERN_INFO "[TP] %s: enter\n", __func__);
+
+	if (ts->power) {
+		ts->power(1);
+		msleep(100);
+#ifdef SYN_CABLE_CONTROL
+		if (ts->cable_support) {
+			if (usb_get_connect_type())
+				cable_tp_status_handler_func(1);
+			printk(KERN_INFO "%s: ts->cable_config: %x\n", __func__, ts->cable_config);
+		}
+#endif
+	} else {
+		ret = i2c_syn_write_byte_data(client,
+			get_address_base(ts, 0x01, CONTROL_BASE), 0x00); 
+		if (ret < 0)
+			i2c_syn_error_handler(ts, ts->i2c_err_handler_en, "wake up", __func__);
+	}
+
+	if (ts->htc_event == SYN_AND_REPORT_TYPE_A) {
+		if (ts->support_htc_event) {
+			input_report_abs(ts->input_dev, ABS_MT_AMPLITUDE, 0);
+			input_report_abs(ts->input_dev, ABS_MT_POSITION, 1 << 31);
+			input_sync(ts->input_dev);
+		}
+		input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0);
+		input_sync(ts->input_dev);
+	} else if (ts->htc_event == SYN_AND_REPORT_TYPE_HTC) {
+		input_report_abs(ts->input_dev, ABS_MT_AMPLITUDE, 0);
+		input_report_abs(ts->input_dev, ABS_MT_POSITION, 1 << 31);
+	}
+	if (ts->psensor_detection) {
+		if(ts->psensor_status == 0) {
+			ts->psensor_resume_enable = 1;
+			printk(KERN_INFO "[TP] %s: Enable P-sensor by Touch\n", __func__);
+			psensor_enable_by_touch_driver(1);
+		}
+		else if(ts->psensor_phone_enable == 0) {
+			if(ts->psensor_status != 3)
+				ts->psensor_resume_enable = 2;
+
+			ts->psensor_phone_enable = 1;
+		}
+	}
+
+	if (ts->use_irq) {
+		enable_irq(client->irq);
+		ts->irq_enabled = 1;
+	}
+	else
+		hrtimer_start(&ts->timer, ktime_set(1, 0), HRTIMER_MODE_REL);
+
+	return 0;
+}
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+static void synaptics_ts_early_suspend(struct early_suspend *h)
+{
+	struct synaptics_ts_data *ts;
+	ts = container_of(h, struct synaptics_ts_data, early_suspend);
+	synaptics_ts_suspend(ts->client, PMSG_SUSPEND);
+}
+
+static void synaptics_ts_late_resume(struct early_suspend *h)
+{
+	struct synaptics_ts_data *ts;
+	ts = container_of(h, struct synaptics_ts_data, early_suspend);
+	synaptics_ts_resume(ts->client);
+}
+#endif
+
+static const struct i2c_device_id synaptics_ts_id[] = {
+	{ SYNAPTICS_3200_NAME, 0 },
+	{ }
+};
+
+static struct i2c_driver synaptics_ts_driver = {
+	.probe		= synaptics_ts_probe,
+	.remove		= synaptics_ts_remove,
+#ifndef CONFIG_HAS_EARLYSUSPEND
+	.suspend	= synaptics_ts_suspend,
+	.resume		= synaptics_ts_resume,
+#endif
+	.id_table	= synaptics_ts_id,
+	.driver = {
+		.name	= SYNAPTICS_3200_NAME,
+	},
+};
+
+static int __devinit synaptics_ts_init(void)
+{
+	return i2c_add_driver(&synaptics_ts_driver);
+}
+
+static void __exit synaptics_ts_exit(void)
+{
+	i2c_del_driver(&synaptics_ts_driver);
+}
+
+module_init(synaptics_ts_init);
+module_exit(synaptics_ts_exit);
+
+MODULE_DESCRIPTION("Synaptics Touchscreen Driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index a5bee8e..57ed244 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -83,6 +83,8 @@
 static ATOMIC_NOTIFIER_HEAD(ppr_notifier);
 int amd_iommu_max_glx_val = -1;
 
+static struct dma_map_ops amd_iommu_dma_ops;
+
 /*
  * general struct to manage commands send to an IOMMU
  */
@@ -450,12 +452,27 @@
 
 static void iommu_print_event(struct amd_iommu *iommu, void *__evt)
 {
-	u32 *event = __evt;
-	int type  = (event[1] >> EVENT_TYPE_SHIFT)  & EVENT_TYPE_MASK;
-	int devid = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK;
-	int domid = (event[1] >> EVENT_DOMID_SHIFT) & EVENT_DOMID_MASK;
-	int flags = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK;
-	u64 address = (u64)(((u64)event[3]) << 32) | event[2];
+	int type, devid, domid, flags;
+	volatile u32 *event = __evt;
+	int count = 0;
+	u64 address;
+
+retry:
+	type    = (event[1] >> EVENT_TYPE_SHIFT)  & EVENT_TYPE_MASK;
+	devid   = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK;
+	domid   = (event[1] >> EVENT_DOMID_SHIFT) & EVENT_DOMID_MASK;
+	flags   = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK;
+	address = (u64)(((u64)event[3]) << 32) | event[2];
+
+	if (type == 0) {
+		/* Did we hit the erratum? */
+		if (++count == LOOP_TIMEOUT) {
+			pr_err("AMD-Vi: No event written to event log\n");
+			return;
+		}
+		udelay(1);
+		goto retry;
+	}
 
 	printk(KERN_ERR "AMD-Vi: Event logged [");
 
@@ -508,6 +525,8 @@
 	default:
 		printk(KERN_ERR "UNKNOWN type=0x%02x]\n", type);
 	}
+
+	memset(__evt, 0, 4 * sizeof(u32));
 }
 
 static void iommu_poll_events(struct amd_iommu *iommu)
@@ -530,26 +549,12 @@
 	spin_unlock_irqrestore(&iommu->lock, flags);
 }
 
-static void iommu_handle_ppr_entry(struct amd_iommu *iommu, u32 head)
+static void iommu_handle_ppr_entry(struct amd_iommu *iommu, u64 *raw)
 {
 	struct amd_iommu_fault fault;
-	volatile u64 *raw;
-	int i;
 
 	INC_STATS_COUNTER(pri_requests);
 
-	raw = (u64 *)(iommu->ppr_log + head);
-
-	/*
-	 * Hardware bug: Interrupt may arrive before the entry is written to
-	 * memory. If this happens we need to wait for the entry to arrive.
-	 */
-	for (i = 0; i < LOOP_TIMEOUT; ++i) {
-		if (PPR_REQ_TYPE(raw[0]) != 0)
-			break;
-		udelay(1);
-	}
-
 	if (PPR_REQ_TYPE(raw[0]) != PPR_REQ_FAULT) {
 		pr_err_ratelimited("AMD-Vi: Unknown PPR request received\n");
 		return;
@@ -561,12 +566,6 @@
 	fault.tag       = PPR_TAG(raw[0]);
 	fault.flags     = PPR_FLAGS(raw[0]);
 
-	/*
-	 * To detect the hardware bug we need to clear the entry
-	 * to back to zero.
-	 */
-	raw[0] = raw[1] = 0;
-
 	atomic_notifier_call_chain(&ppr_notifier, 0, &fault);
 }
 
@@ -578,25 +577,62 @@
 	if (iommu->ppr_log == NULL)
 		return;
 
+	/* enable ppr interrupts again */
+	writel(MMIO_STATUS_PPR_INT_MASK, iommu->mmio_base + MMIO_STATUS_OFFSET);
+
 	spin_lock_irqsave(&iommu->lock, flags);
 
 	head = readl(iommu->mmio_base + MMIO_PPR_HEAD_OFFSET);
 	tail = readl(iommu->mmio_base + MMIO_PPR_TAIL_OFFSET);
 
 	while (head != tail) {
+		volatile u64 *raw;
+		u64 entry[2];
+		int i;
 
-		/* Handle PPR entry */
-		iommu_handle_ppr_entry(iommu, head);
+		raw = (u64 *)(iommu->ppr_log + head);
 
-		/* Update and refresh ring-buffer state*/
+		/*
+		 * Hardware bug: Interrupt may arrive before the entry is
+		 * written to memory. If this happens we need to wait for the
+		 * entry to arrive.
+		 */
+		for (i = 0; i < LOOP_TIMEOUT; ++i) {
+			if (PPR_REQ_TYPE(raw[0]) != 0)
+				break;
+			udelay(1);
+		}
+
+		/* Avoid memcpy function-call overhead */
+		entry[0] = raw[0];
+		entry[1] = raw[1];
+
+		/*
+		 * To detect the hardware bug we need to clear the entry
+		 * back to zero.
+		 */
+		raw[0] = raw[1] = 0UL;
+
+		/* Update head pointer of hardware ring-buffer */
 		head = (head + PPR_ENTRY_SIZE) % PPR_LOG_SIZE;
 		writel(head, iommu->mmio_base + MMIO_PPR_HEAD_OFFSET);
+
+		/*
+		 * Release iommu->lock because ppr-handling might need to
+		 * re-aquire it
+		 */
+		spin_unlock_irqrestore(&iommu->lock, flags);
+
+		/* Handle PPR entry */
+		iommu_handle_ppr_entry(iommu, entry);
+
+		spin_lock_irqsave(&iommu->lock, flags);
+
+		/* Refresh ring-buffer information */
+		head = readl(iommu->mmio_base + MMIO_PPR_HEAD_OFFSET);
 		tail = readl(iommu->mmio_base + MMIO_PPR_TAIL_OFFSET);
 	}
 
-	/* enable ppr interrupts again */
-	writel(MMIO_STATUS_PPR_INT_MASK, iommu->mmio_base + MMIO_STATUS_OFFSET);
-
 	spin_unlock_irqrestore(&iommu->lock, flags);
 }
 
@@ -2035,20 +2071,20 @@
 }
 
 /* FIXME: Move this to PCI code */
-#define PCI_PRI_TLP_OFF		(1 << 2)
+#define PCI_PRI_TLP_OFF		(1 << 15)
 
 bool pci_pri_tlp_required(struct pci_dev *pdev)
 {
-	u16 control;
+	u16 status;
 	int pos;
 
 	pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI);
 	if (!pos)
 		return false;
 
-	pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control);
+	pci_read_config_word(pdev, pos + PCI_PRI_STATUS, &status);
 
-	return (control & PCI_PRI_TLP_OFF) ? true : false;
+	return (status & PCI_PRI_TLP_OFF) ? true : false;
 }
 
 /*
@@ -2218,6 +2254,18 @@
 
 		iommu_init_device(dev);
 
+		/*
+		 * dev_data is still NULL and
+		 * got initialized in iommu_init_device
+		 */
+		dev_data = get_dev_data(dev);
+
+		if (iommu_pass_through || dev_data->iommu_v2) {
+			dev_data->passthrough = true;
+			attach_device(dev, pt_domain);
+			break;
+		}
+
 		domain = domain_for_device(dev);
 
 		/* allocate a protection domain if a device is added */
@@ -2233,6 +2281,10 @@
 		list_add_tail(&dma_domain->list, &iommu_pd_list);
 		spin_unlock_irqrestore(&iommu_pd_list_lock, flags);
 
+		dev_data = get_dev_data(dev);
+
+		dev->archdata.dma_ops = &amd_iommu_dma_ops;
+
 		break;
 	case BUS_NOTIFY_DEL_DEVICE:
 
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index c567903..c04ddca 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1029,6 +1029,9 @@
 	if (!iommu->dev)
 		return 1;
 
+	iommu->root_pdev = pci_get_bus_and_slot(iommu->dev->bus->number,
+						PCI_DEVFN(0, 0));
+
 	iommu->cap_ptr = h->cap_ptr;
 	iommu->pci_seg = h->pci_seg;
 	iommu->mmio_phys = h->mmio_phys;
@@ -1323,20 +1326,16 @@
 {
 	int i, j;
 	u32 ioc_feature_control;
-	struct pci_dev *pdev = NULL;
+	struct pci_dev *pdev = iommu->root_pdev;
 
 	/* RD890 BIOSes may not have completely reconfigured the iommu */
-	if (!is_rd890_iommu(iommu->dev))
+	if (!is_rd890_iommu(iommu->dev) || !pdev)
 		return;
 
 	/*
 	 * First, we need to ensure that the iommu is enabled. This is
 	 * controlled by a register in the northbridge
 	 */
-	pdev = pci_get_bus_and_slot(iommu->dev->bus->number, PCI_DEVFN(0, 0));
-
-	if (!pdev)
-		return;
 
 	/* Select Northbridge indirect register 0x75 and enable writing */
 	pci_write_config_dword(pdev, 0x60, 0x75 | (1 << 7));
@@ -1346,8 +1345,6 @@
 	if (!(ioc_feature_control & 0x1))
 		pci_write_config_dword(pdev, 0x64, ioc_feature_control | 1);
 
-	pci_dev_put(pdev);
-
 	/* Restore the iommu BAR */
 	pci_write_config_dword(iommu->dev, iommu->cap_ptr + 4,
 			       iommu->stored_addr_lo);
@@ -1644,6 +1641,8 @@
 
 	amd_iommu_init_api();
 
+	x86_platform.iommu_shutdown = disable_iommus;
+
 	if (iommu_pass_through)
 		goto out;
 
@@ -1652,8 +1651,6 @@
 	else
 		printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n");
 
-	x86_platform.iommu_shutdown = disable_iommus;
-
 out:
 	return ret;
 
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h
index 2452f3b..2435555 100644
--- a/drivers/iommu/amd_iommu_types.h
+++ b/drivers/iommu/amd_iommu_types.h
@@ -481,6 +481,9 @@
 	/* Pointer to PCI device of this IOMMU */
 	struct pci_dev *dev;
 
+	/* Cache pdev to root device for resume quirks */
+	struct pci_dev *root_pdev;
+
 	/* physical address of MMIO space */
 	u64 mmio_phys;
 	/* virtual address of MMIO space */
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c
index 036fe9b..a1f1bc8 100644
--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -681,6 +681,8 @@
 
 	atomic_set(&pasid_state->count, 1);
 	init_waitqueue_head(&pasid_state->wq);
+	spin_lock_init(&pasid_state->lock);
+
 	pasid_state->task         = task;
 	pasid_state->mm           = get_task_mm(task);
 	pasid_state->device_state = dev_state;
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 35c1e17..97b2e21 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1056,8 +1056,8 @@
 
 const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
 {
-	if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
-				     ARRAY_SIZE(intr_remap_fault_reasons))) {
+	if (fault_reason >= 0x20 && (fault_reason - 0x20 <
+					ARRAY_SIZE(intr_remap_fault_reasons))) {
 		*fault_type = INTR_REMAP;
 		return intr_remap_fault_reasons[fault_reason - 0x20];
 	} else if (fault_reason < ARRAY_SIZE(dma_remap_fault_reasons)) {
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index f93d5ac..5fda348 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2286,12 +2286,6 @@
 	if (!info)
 		return -ENOMEM;
 
-	ret = domain_context_mapping(domain, pdev, translation);
-	if (ret) {
-		free_devinfo_mem(info);
-		return ret;
-	}
-
 	info->segment = pci_domain_nr(pdev->bus);
 	info->bus = pdev->bus->number;
 	info->devfn = pdev->devfn;
@@ -2304,6 +2298,17 @@
 	pdev->dev.archdata.iommu = info;
 	spin_unlock_irqrestore(&device_domain_lock, flags);
 
+	ret = domain_context_mapping(domain, pdev, translation);
+	if (ret) {
+		spin_lock_irqsave(&device_domain_lock, flags);
+		list_del(&info->link);
+		list_del(&info->global);
+		pdev->dev.archdata.iommu = NULL;
+		spin_unlock_irqrestore(&device_domain_lock, flags);
+		free_devinfo_mem(info);
+		return ret;
+	}
+
 	return 0;
 }
 
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 05bb4a9..6a6e0e2 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -88,6 +88,7 @@
 
 void msm_iommu_remote_p0_spin_lock(void)
 {
+#ifndef CONFIG_MACH_HTC
 	msm_iommu_remote_lock.lock->flag[PROC_APPS] = 1;
 	msm_iommu_remote_lock.lock->turn = 1;
 
@@ -96,13 +97,16 @@
 	while (msm_iommu_remote_lock.lock->flag[PROC_GPU] == 1 &&
 	       msm_iommu_remote_lock.lock->turn == 1)
 		cpu_relax();
+#endif
 }
 
 void msm_iommu_remote_p0_spin_unlock(void)
 {
+#ifndef CONFIG_MACH_HTC
 	smp_mb();
 
 	msm_iommu_remote_lock.lock->flag[PROC_APPS] = 0;
+#endif
 }
 #endif
 
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index eb93c82..17ef6c4 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -550,13 +550,13 @@
 		return 0;
 
 	as->pte_count = devm_kzalloc(smmu->dev,
-		     sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_KERNEL);
+		     sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_ATOMIC);
 	if (!as->pte_count) {
 		dev_err(smmu->dev,
 			"failed to allocate smmu_device PTE cunters\n");
 		return -ENOMEM;
 	}
-	as->pdir_page = alloc_page(GFP_KERNEL | __GFP_DMA);
+	as->pdir_page = alloc_page(GFP_ATOMIC | __GFP_DMA);
 	if (!as->pdir_page) {
 		dev_err(smmu->dev,
 			"failed to allocate smmu_device page directory\n");
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index 343b5c8..579aa02 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -14,6 +14,7 @@
 #include "gigaset.h"
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <linux/ratelimit.h>
 #include <linux/isdn/capilli.h>
 #include <linux/isdn/capicmd.h>
 #include <linux/isdn/capiutil.h>
@@ -223,10 +224,14 @@
 static inline void dump_cmsg(enum debuglevel level, const char *tag, _cmsg *p)
 {
 #ifdef CONFIG_GIGASET_DEBUG
+	/* dump at most 20 messages in 20 secs */
+	static DEFINE_RATELIMIT_STATE(msg_dump_ratelimit, 20 * HZ, 20);
 	_cdebbuf *cdb;
 
 	if (!(gigaset_debuglevel & level))
 		return;
+	if (!___ratelimit(&msg_dump_ratelimit, tag))
+		return;
 
 	cdb = capi_cmsg2str(p);
 	if (cdb) {
@@ -1882,6 +1887,9 @@
 
 	/* check for active logical connection */
 	if (bcs->apconnstate >= APCONN_ACTIVE) {
+		/* clear it */
+		bcs->apconnstate = APCONN_SETUP;
+
 		/*
 		 * emit DISCONNECT_B3_IND with cause 0x3301
 		 * use separate cmsg structure, as the content of iif->acmsg
@@ -1906,6 +1914,7 @@
 		}
 		capi_cmsg2message(b3cmsg,
 				  __skb_put(b3skb, CAPI_DISCONNECT_B3_IND_BASELEN));
+		dump_cmsg(DEBUG_CMD, __func__, b3cmsg);
 		kfree(b3cmsg);
 		capi_ctr_handle_message(&iif->ctr, ap->id, b3skb);
 	}
@@ -2059,12 +2068,6 @@
 }
 
 /*
- * dump unsupported/ignored messages at most twice per minute,
- * some apps send those very frequently
- */
-static unsigned long ignored_msg_dump_time;
-
-/*
  * unsupported CAPI message handler
  */
 static void do_unsupported(struct gigaset_capi_ctr *iif,
@@ -2073,8 +2076,7 @@
 {
 	/* decode message */
 	capi_message2cmsg(&iif->acmsg, skb->data);
-	if (printk_timed_ratelimit(&ignored_msg_dump_time, 30 * 1000))
-		dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
+	dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
 	send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState);
 }
 
@@ -2085,11 +2087,9 @@
 		       struct gigaset_capi_appl *ap,
 		       struct sk_buff *skb)
 {
-	if (printk_timed_ratelimit(&ignored_msg_dump_time, 30 * 1000)) {
-		/* decode message */
-		capi_message2cmsg(&iif->acmsg, skb->data);
-		dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
-	}
+	/* decode message */
+	capi_message2cmsg(&iif->acmsg, skb->data);
+	dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
 	dev_kfree_skb_any(skb);
 }
 
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index 624a825..685638a 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -190,6 +190,7 @@
 								  ACT_INIT} },
 	{RSP_OK,	121, 121, -1,			  0,  0, {ACT_GOTVER,
 								  ACT_INIT} },
+	{RSP_NONE,	121, 121, -1,			120,  0, {ACT_GETSTRING} },
 
 /* leave dle mode */
 	{RSP_INIT,	  0,   0, SEQ_DLE0,		201,  5, {0},	"^SDLE=0\r"},
@@ -1314,8 +1315,9 @@
 		s = ev->ptr;
 
 		if (!strcmp(s, "OK")) {
+			/* OK without version string: assume old response */
 			*p_genresp = 1;
-			*p_resp_code = RSP_ERROR;
+			*p_resp_code = RSP_NONE;
 			break;
 		}
 
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 26e8496..19b18ac 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -585,4 +585,11 @@
 comment "iptables trigger is under Netfilter config (LED target)"
 	depends on LEDS_TRIGGERS
 
+comment "LED Flashlights"
+
+config FLASHLIGHT_TPS61310
+	tristate "TI TPS61310 flashlight"
+	help
+	  Say Y here to enable the TI TPS61310 flashlight.
+
 endif # NEW_LEDS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index c688898..430e0b0 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -18,7 +18,11 @@
 obj-$(CONFIG_LEDS_COBALT_RAQ)		+= leds-cobalt-raq.o
 obj-$(CONFIG_LEDS_SUNFIRE)		+= leds-sunfire.o
 obj-$(CONFIG_LEDS_PCA9532)		+= leds-pca9532.o
+ifeq ($(CONFIG_MACH_HTC),y)
+obj-$(CONFIG_LEDS_PM8XXX)		+= leds-pm8xxx-htc.o
+else
 obj-$(CONFIG_LEDS_PM8XXX)		+= leds-pm8xxx.o
+endif
 obj-$(CONFIG_LEDS_QPNP)			+= leds-qpnp.o
 obj-$(CONFIG_LEDS_GPIO_REGISTER)	+= leds-gpio-register.o
 obj-$(CONFIG_LEDS_GPIO)			+= leds-gpio.o
@@ -66,3 +70,6 @@
 obj-$(CONFIG_LEDS_TRIGGER_GPIO)		+= ledtrig-gpio.o
 obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON)	+= ledtrig-default-on.o
 obj-$(CONFIG_LEDS_TRIGGER_SLEEP)	+= ledtrig-sleep.o
+
+# Flashlight Drivers
+obj-$(CONFIG_FLASHLIGHT_TPS61310)	+= tps61310_flashlight.o
diff --git a/drivers/leds/leds-pm8xxx-htc.c b/drivers/leds/leds-pm8xxx-htc.c
new file mode 100644
index 0000000..1c72b1c
--- /dev/null
+++ b/drivers/leds/leds-pm8xxx-htc.c
@@ -0,0 +1,880 @@
+
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#define pr_fmt(fmt)	"%s: " fmt, __func__
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
+#include <linux/workqueue.h>
+#include <linux/err.h>
+#include <linux/wakelock.h>
+#include <linux/mfd/pm8xxx/core.h>
+#include <linux/mfd/pm8xxx/pwm.h>
+#include <linux/leds-pm8xxx-htc.h>
+
+#define SSBI_REG_ADDR_DRV_KEYPAD	0x48
+#define PM8XXX_DRV_KEYPAD_BL_MASK	0xf0
+#define PM8XXX_DRV_KEYPAD_BL_SHIFT	0x04
+
+#define SSBI_REG_ADDR_FLASH_DRV0        0x49
+#define PM8XXX_DRV_FLASH_MASK           0xf0
+#define PM8XXX_DRV_FLASH_SHIFT          0x04
+
+#define SSBI_REG_ADDR_FLASH_DRV1        0xFB
+
+#define SSBI_REG_ADDR_LED_CTRL_BASE	0x131
+#define SSBI_REG_ADDR_LED_CTRL(n)	(SSBI_REG_ADDR_LED_CTRL_BASE + (n))
+#define PM8XXX_DRV_LED_CTRL_MASK	0xf8
+#define PM8XXX_DRV_LED_CTRL_SHIFT	0x03
+
+#define MAX_FLASH_LED_CURRENT		300
+#define MAX_LC_LED_CURRENT		40
+#define MAX_KP_BL_LED_CURRENT		300
+
+#define PM8XXX_ID_LED_CURRENT_FACTOR	2  
+#define PM8XXX_ID_FLASH_CURRENT_FACTOR	20 
+
+#define PM8XXX_FLASH_MODE_DBUS1		1
+#define PM8XXX_FLASH_MODE_DBUS2		2
+#define PM8XXX_FLASH_MODE_PWM		3
+
+#define PM8XXX_LED_OFFSET(id) (PM8XXX_ID_LED_0 - (id))
+
+#define MAX_LC_LED_BRIGHTNESS		20
+#define MAX_FLASH_BRIGHTNESS		15
+#define MAX_KB_LED_BRIGHTNESS		15
+
+#define PM8XXX_LPG_CTL_REGS		7
+
+#define LED_DBG(fmt, ...) \
+		({ if (0) printk(KERN_DEBUG "[LED]" fmt, ##__VA_ARGS__); })
+#define LED_INFO(fmt, ...) \
+		printk(KERN_INFO "[LED]" fmt, ##__VA_ARGS__)
+#define LED_ERR(fmt, ...) \
+		printk(KERN_ERR "[LED][ERR]" fmt, ##__VA_ARGS__)
+
+static struct workqueue_struct *g_led_work_queue;
+struct wake_lock pmic_led_wake_lock;
+static struct pm8xxx_led_data *pm8xxx_leds	, *for_key_led_data, *green_back_led_data, *amber_back_led_data;
+static int flag_hold_virtual_key = 0;
+static int virtual_key_state;
+static int current_blink = 0;
+u8 pm8xxxx_led_pwm_mode(int flag)
+{
+	u8 mode = 0;
+	switch (flag) {
+	case PM8XXX_ID_LED_0:
+		mode = PM8XXX_LED_MODE_PWM3;
+		break;
+	case PM8XXX_ID_LED_1:
+		mode = PM8XXX_LED_MODE_PWM2;
+		break;
+	case PM8XXX_ID_LED_2:
+		mode = PM8XXX_LED_MODE_PWM1;
+		break;
+	}
+	return mode;
+}
+
+static void led_fade_do_work(struct work_struct *work)
+{
+	struct pm8xxx_led_data *led;
+	int rc, offset;
+	u8 level;
+
+	led = container_of(work, struct pm8xxx_led_data, fade_delayed_work.work);
+
+	level = (0 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+	offset = PM8XXX_LED_OFFSET(led->id);
+	led->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
+	led->reg |= level;
+	rc = pm8xxx_writeb(led->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), led->reg);
+	if (rc)
+		LED_ERR("%s can't set (%d) led value rc=%d\n", __func__, led->id, rc);
+}
+void pm8xxx_led_current_set_for_key(int brightness_key)
+{
+	int rc, offset;
+	static u8 level, register_key;
+
+	LED_INFO("%s brightness_key: %d\n", __func__,brightness_key);
+
+	if (brightness_key) {
+		flag_hold_virtual_key = 1;
+		level = (40 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+		offset = PM8XXX_LED_OFFSET(for_key_led_data->id);
+		register_key	= pm8xxxx_led_pwm_mode(for_key_led_data->id);
+		register_key &= ~PM8XXX_DRV_LED_CTRL_MASK;
+		register_key |= level;
+		rc = pm8xxx_writeb(for_key_led_data->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), register_key);
+		if (rc)
+			LED_ERR("%s can't set (%d) led value rc=%d\n", __func__, PM8XXX_ID_LED_0, rc);
+			pwm_config(for_key_led_data->pwm_led, 320000, 640000);
+			pwm_enable(for_key_led_data->pwm_led);
+	} else {
+		pwm_disable(for_key_led_data->pwm_led);
+		level = (0 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+		offset = PM8XXX_LED_OFFSET(for_key_led_data->id);
+		register_key	= pm8xxxx_led_pwm_mode(for_key_led_data->id);
+		register_key &= ~PM8XXX_DRV_LED_CTRL_MASK;
+		register_key |= level;
+		rc = pm8xxx_writeb(for_key_led_data->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), register_key);
+		if (rc)
+			LED_ERR("%s can't set (%d) led value rc=%d\n", __func__, PM8XXX_ID_LED_0, rc);
+		if (virtual_key_state != 0){
+			level = 0;
+			register_key = 0;
+			level = (40 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+			offset = PM8XXX_LED_OFFSET(for_key_led_data->id);
+			register_key    = pm8xxxx_led_pwm_mode(for_key_led_data->id);
+			register_key &= ~PM8XXX_DRV_LED_CTRL_MASK;
+			register_key |= level;
+			rc = pm8xxx_writeb(for_key_led_data->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), register_key);
+			if (rc)
+				LED_ERR("%s can't set (%d) led value rc=%d\n", __func__, PM8XXX_ID_LED_0, rc);
+			pwm_config(for_key_led_data->pwm_led, 64000, 64000);
+			pwm_enable(for_key_led_data->pwm_led);
+		}
+		flag_hold_virtual_key = 0;
+
+	}
+}
+static void pm8xxx_led_current_set(struct led_classdev *led_cdev, enum led_brightness brightness)
+{
+	struct pm8xxx_led_data *led = container_of(led_cdev,  struct pm8xxx_led_data, cdev);
+	int rc, offset;
+	u8 level;
+
+	int *pduties;
+
+	LED_INFO("%s, bank:%d, brightness:%d\n", __func__, led->bank, brightness);
+	cancel_delayed_work_sync(&led->fade_delayed_work);
+	virtual_key_state = brightness;
+	if (flag_hold_virtual_key == 1) {
+		LED_INFO("%s, key control \n", __func__);
+		return;
+	}
+
+	if(brightness) {
+		level = (led->out_current << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+		offset = PM8XXX_LED_OFFSET(led->id);
+		led->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
+		led->reg |= level;
+		rc = pm8xxx_writeb(led->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), led->reg);
+		if (rc)
+			LED_ERR("%s can't set (%d) led value rc=%d\n", __func__, led->id, rc);
+
+		if (led->function_flags & LED_BRETH_FUNCTION) {
+			pduties = led->duties;
+			pm8xxx_pwm_lut_config(led->pwm_led,
+						led->period_us,
+						pduties,
+						led->duty_time_ms,
+						led->start_index,
+						led->duites_size,
+						0, 0,
+						led->lut_flag);
+			pm8xxx_pwm_lut_enable(led->pwm_led, 0);
+			pm8xxx_pwm_lut_enable(led->pwm_led, 1);
+		} else {
+			pwm_config(led->pwm_led, 64000, 64000);
+			pwm_enable(led->pwm_led);
+		}
+	} else {
+		if (led->function_flags & LED_BRETH_FUNCTION) {
+			wake_lock_timeout(&pmic_led_wake_lock, HZ*2);
+			pduties = led->duties + led->duites_size;
+			pm8xxx_pwm_lut_config(led->pwm_led,
+						led->period_us,
+						pduties,
+						led->duty_time_ms,
+						led->start_index,
+						led->duites_size,
+						0, 0,
+						led->lut_flag);
+			pm8xxx_pwm_lut_enable(led->pwm_led, 0);
+			pm8xxx_pwm_lut_enable(led->pwm_led, 1);
+			queue_delayed_work(g_led_work_queue,
+						&led->fade_delayed_work,
+						msecs_to_jiffies(led->duty_time_ms*led->duites_size));
+		} else {
+			pwm_disable(led->pwm_led);
+			level = (0 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+			offset = PM8XXX_LED_OFFSET(led->id);
+			led->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
+			led->reg |= level;
+			rc = pm8xxx_writeb(led->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), led->reg);
+			if (rc)
+				LED_ERR("%s can't set (%d) led value rc=%d\n", __func__, led->id, rc);
+		}
+	}
+}
+
+static void pm8xxx_led_gpio_set(struct led_classdev *led_cdev, enum led_brightness brightness)
+{
+	int rc, offset;
+	u8 level;
+
+	struct pm8xxx_led_data *led = container_of(led_cdev,  struct pm8xxx_led_data, cdev);
+	LED_INFO("%s, bank:%d, brightness:%d sync: %d\n", __func__, led->bank, brightness, led->led_sync);
+	if (led->gpio_status_switch != NULL)
+		led->gpio_status_switch(0);
+	pwm_disable(led->pwm_led);
+	if(led->led_sync) {
+		if (!strcmp(led->cdev.name, "green")){
+			if (green_back_led_data->gpio_status_switch != NULL)
+				green_back_led_data->gpio_status_switch(0);
+			pwm_disable(green_back_led_data->pwm_led);
+			level = ( 0 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+			offset = PM8XXX_LED_OFFSET(green_back_led_data->id);
+			green_back_led_data->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
+			green_back_led_data->reg |= level;
+			rc = pm8xxx_writeb(green_back_led_data->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), green_back_led_data->reg);
+		}
+		if (!strcmp(led->cdev.name, "amber")){
+			if (amber_back_led_data->gpio_status_switch != NULL)
+				amber_back_led_data->gpio_status_switch(0);
+			pwm_disable(amber_back_led_data->pwm_led);
+			level = ( 0 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+			offset = PM8XXX_LED_OFFSET(amber_back_led_data->id);
+			amber_back_led_data->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
+			amber_back_led_data->reg |= level;
+			rc = pm8xxx_writeb(amber_back_led_data->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), amber_back_led_data->reg);
+		}
+	}
+	if (brightness) {
+		if (led->gpio_status_switch != NULL)
+			led->gpio_status_switch(1);
+		pwm_config(led->pwm_led, 6400 * led->pwm_coefficient / 100, 6400);
+		pwm_enable(led->pwm_led);
+		if(led->led_sync) {
+			if 	(!strcmp(led->cdev.name, "green")) {
+				if (green_back_led_data->gpio_status_switch != NULL)
+					green_back_led_data->gpio_status_switch(1);
+				level = (green_back_led_data->out_current << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+				offset = PM8XXX_LED_OFFSET(green_back_led_data->id);
+				green_back_led_data->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
+				green_back_led_data->reg |= level;
+				rc = pm8xxx_writeb(green_back_led_data->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), green_back_led_data->reg);
+				pwm_config(green_back_led_data->pwm_led, 64000, 64000);
+				pwm_enable(green_back_led_data->pwm_led);
+			}
+			if 	(!strcmp(led->cdev.name, "amber")) {
+				if (amber_back_led_data->gpio_status_switch != NULL)
+					amber_back_led_data->gpio_status_switch(1);
+				level = (amber_back_led_data->out_current << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+				offset = PM8XXX_LED_OFFSET(amber_back_led_data->id);
+				amber_back_led_data->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
+				amber_back_led_data->reg |= level;
+				rc = pm8xxx_writeb(amber_back_led_data->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), amber_back_led_data->reg);
+				pwm_config(amber_back_led_data->pwm_led, 64000, 64000);
+				pwm_enable(amber_back_led_data->pwm_led);
+			}
+		}
+	}
+}
+
+static void led_work_func(struct work_struct *work)
+{
+	struct pm8xxx_led_data *ldata;
+	int rc, offset;
+	u8 level;
+
+	ldata = container_of(work, struct pm8xxx_led_data, led_work);
+	LED_INFO("%s: bank %d sync %d\n", __func__, ldata->bank, ldata->led_sync);
+	pwm_disable(ldata->pwm_led);
+	if (ldata->gpio_status_switch != NULL)
+		ldata->gpio_status_switch(0);
+	if(ldata->led_sync) {
+		if (!strcmp(ldata->cdev.name, "green")){
+			if (green_back_led_data->gpio_status_switch != NULL)
+				green_back_led_data->gpio_status_switch(0);
+			pwm_disable(green_back_led_data->pwm_led);
+			level = ( 0 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+			offset = PM8XXX_LED_OFFSET(green_back_led_data->id);
+			green_back_led_data->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
+			green_back_led_data->reg |= level;
+			rc = pm8xxx_writeb(green_back_led_data->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), green_back_led_data->reg);
+		}
+		if (!strcmp(ldata->cdev.name, "amber")){
+			if (amber_back_led_data->gpio_status_switch != NULL)
+				amber_back_led_data->gpio_status_switch(0);
+			pwm_disable(amber_back_led_data->pwm_led);
+			level = ( 0 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+			offset = PM8XXX_LED_OFFSET(amber_back_led_data->id);
+			amber_back_led_data->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
+			amber_back_led_data->reg |= level;
+			rc = pm8xxx_writeb(amber_back_led_data->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), amber_back_led_data->reg);
+		}
+	}
+}
+
+static void led_alarm_handler(struct alarm *alarm)
+{
+	struct pm8xxx_led_data *ldata;
+
+	ldata = container_of(alarm, struct pm8xxx_led_data, led_alarm);
+	queue_work(g_led_work_queue, &ldata->led_work);
+}
+
+static void led_blink_do_work(struct work_struct *work)
+{
+	struct pm8xxx_led_data *led;
+
+	led = container_of(work, struct pm8xxx_led_data, blink_delayed_work.work);
+
+	if (led->gpio_status_switch != NULL)
+		led->gpio_status_switch(1);
+	pwm_config(led->pwm_led, led->duty_time_ms * 1000, led->period_us);
+	pwm_enable(led->pwm_led);
+	if(led->led_sync) {
+		if	(!strcmp(led->cdev.name, "green")) {
+			if (green_back_led_data->gpio_status_switch != NULL)
+				green_back_led_data->gpio_status_switch(1);
+			pwm_config(green_back_led_data->pwm_led, green_back_led_data->duty_time_ms * 1000, green_back_led_data->period_us);
+			pwm_enable(green_back_led_data->pwm_led);
+		}
+		if	(!strcmp(led->cdev.name, "amber")) {
+			if (amber_back_led_data->gpio_status_switch != NULL)
+				amber_back_led_data->gpio_status_switch(1);
+			pwm_config(amber_back_led_data->pwm_led, amber_back_led_data->duty_time_ms * 1000, amber_back_led_data->period_us);
+			pwm_enable(amber_back_led_data->pwm_led);
+		}
+	}
+
+}
+
+static ssize_t pm8xxx_led_blink_show(struct device *dev,
+					struct device_attribute *attr,
+					char *buf)
+{
+	return sprintf(buf, "%d\n", current_blink);
+}
+
+static ssize_t pm8xxx_led_blink_store(struct device *dev,
+				       struct device_attribute *attr,
+				       const char *buf, size_t count)
+{
+	struct led_classdev *led_cdev;
+	struct pm8xxx_led_data *ldata;
+	int val;
+	int level, offset;
+
+	val = -1;
+	sscanf(buf, "%u", &val);
+	if (val < 0 || val > 255)
+		return -EINVAL;
+	current_blink= val;
+	led_cdev = (struct led_classdev *) dev_get_drvdata(dev);
+	ldata = container_of(led_cdev, struct pm8xxx_led_data, cdev);
+
+	LED_INFO("%s: bank %d blink %d sync %d\n", __func__, ldata->bank, val, ldata->led_sync);
+
+	switch (val) {
+	case BLINK_STOP:
+		if (ldata->gpio_status_switch != NULL)
+			ldata->gpio_status_switch(0);
+		pwm_disable(ldata->pwm_led);
+
+		if(ldata->led_sync) {
+			if 	(!strcmp(ldata->cdev.name, "green")) {
+				if (green_back_led_data->gpio_status_switch != NULL)
+					green_back_led_data->gpio_status_switch(0);
+				pwm_disable(green_back_led_data->pwm_led);
+			}
+			if 	(!strcmp(ldata->cdev.name, "amber")) {
+				if (amber_back_led_data->gpio_status_switch != NULL)
+					amber_back_led_data->gpio_status_switch(0);
+				pwm_disable(amber_back_led_data->pwm_led);
+			}
+		}
+		break;
+	case BLINK_UNCHANGE:
+		pwm_disable(ldata->pwm_led);
+		if (led_cdev->brightness) {
+			if (ldata->gpio_status_switch != NULL)
+				ldata->gpio_status_switch(1);
+			pwm_config(ldata->pwm_led, 6400 * ldata->pwm_coefficient / 100, 6400);
+			pwm_enable(ldata->pwm_led);
+
+			if(ldata->led_sync) {
+				if	(!strcmp(ldata->cdev.name, "green")) {
+					if (green_back_led_data->gpio_status_switch != NULL)
+						green_back_led_data->gpio_status_switch(1);
+					pwm_config(green_back_led_data->pwm_led, 64000, 64000);
+					pwm_enable(green_back_led_data->pwm_led);
+				}
+				if	(!strcmp(ldata->cdev.name, "amber")) {
+					if (amber_back_led_data->gpio_status_switch != NULL)
+						amber_back_led_data->gpio_status_switch(1);
+					pwm_config(amber_back_led_data->pwm_led, 64000, 64000);
+					pwm_enable(amber_back_led_data->pwm_led);
+				}
+			}
+		} else {
+			pwm_disable(ldata->pwm_led);
+			if (ldata->gpio_status_switch != NULL)
+				ldata->gpio_status_switch(0);
+
+			if(ldata->led_sync) {
+				if (!strcmp(ldata->cdev.name, "green")){
+					if (green_back_led_data->gpio_status_switch != NULL)
+						green_back_led_data->gpio_status_switch(0);
+					pwm_disable(green_back_led_data->pwm_led);
+					level = ( 0 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+					offset = PM8XXX_LED_OFFSET(green_back_led_data->id);
+					green_back_led_data->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
+					green_back_led_data->reg |= level;
+					pm8xxx_writeb(green_back_led_data->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), green_back_led_data->reg);
+				}
+				if (!strcmp(ldata->cdev.name, "amber")){
+					if (amber_back_led_data->gpio_status_switch != NULL)
+						amber_back_led_data->gpio_status_switch(0);
+					pwm_disable(amber_back_led_data->pwm_led);
+					level = ( 0 << PM8XXX_DRV_LED_CTRL_SHIFT) & PM8XXX_DRV_LED_CTRL_MASK;
+					offset = PM8XXX_LED_OFFSET(amber_back_led_data->id);
+					amber_back_led_data->reg &= ~PM8XXX_DRV_LED_CTRL_MASK;
+					amber_back_led_data->reg |= level;
+					pm8xxx_writeb(amber_back_led_data->dev->parent, SSBI_REG_ADDR_LED_CTRL(offset), amber_back_led_data->reg);
+				}
+			}
+		}
+		break;
+	case BLINK_64MS_PER_2SEC:
+		if (ldata->gpio_status_switch != NULL)
+			ldata->gpio_status_switch(1);
+		pwm_disable(ldata->pwm_led);
+		pwm_config(ldata->pwm_led, 64000, 2000000);
+		pwm_enable(ldata->pwm_led);
+
+		if(ldata->led_sync) {
+			if	(!strcmp(ldata->cdev.name, "green")) {
+				if (green_back_led_data->gpio_status_switch != NULL)
+					green_back_led_data->gpio_status_switch(1);
+				pwm_disable(green_back_led_data->pwm_led);
+				pwm_config(green_back_led_data->pwm_led, 64000, 2000000);
+				pwm_enable(green_back_led_data->pwm_led);
+			}
+			if	(!strcmp(ldata->cdev.name, "amber")) {
+				if (amber_back_led_data->gpio_status_switch != NULL)
+					amber_back_led_data->gpio_status_switch(1);
+				pwm_disable(amber_back_led_data->pwm_led);
+				pwm_config(amber_back_led_data->pwm_led, 64000, 2000000);
+				pwm_enable(amber_back_led_data->pwm_led);
+			}
+		}
+		break;
+	case BLINK_64MS_ON_310MS_PER_2SEC:
+		cancel_delayed_work_sync(&ldata->blink_delayed_work);
+		pwm_disable(ldata->pwm_led);
+		ldata->duty_time_ms = 64;
+		ldata->period_us = 2000000;
+
+		if(ldata->led_sync) {
+			if	(!strcmp(ldata->cdev.name, "green")) {
+				pwm_disable(green_back_led_data->pwm_led);
+				green_back_led_data->duty_time_ms = 64;
+				green_back_led_data->period_us = 2000000;
+			}
+			if	(!strcmp(ldata->cdev.name, "amber")) {
+				pwm_disable(amber_back_led_data->pwm_led);
+				amber_back_led_data->duty_time_ms = 64;
+				amber_back_led_data->period_us = 2000000;
+			}
+		}
+		queue_delayed_work(g_led_work_queue, &ldata->blink_delayed_work,
+				   msecs_to_jiffies(310));
+		break;
+	case BLINK_64MS_ON_2SEC_PER_2SEC:
+		cancel_delayed_work_sync(&ldata->blink_delayed_work);
+		pwm_disable(ldata->pwm_led);
+		ldata->duty_time_ms = 64;
+		ldata->period_us = 2000000;
+
+		if(ldata->led_sync) {
+			if	(!strcmp(ldata->cdev.name, "green")) {
+				pwm_disable(green_back_led_data->pwm_led);
+				green_back_led_data->duty_time_ms = 64;
+				green_back_led_data->period_us = 2000000;
+			}
+			if	(!strcmp(ldata->cdev.name, "amber")) {
+				pwm_disable(amber_back_led_data->pwm_led);
+				amber_back_led_data->duty_time_ms = 64;
+				amber_back_led_data->period_us = 2000000;
+			}
+		}
+		queue_delayed_work(g_led_work_queue, &ldata->blink_delayed_work,
+				   msecs_to_jiffies(1000));
+		break;
+	case BLINK_1SEC_PER_2SEC:
+		pwm_disable(ldata->pwm_led);
+		pwm_config(ldata->pwm_led, 1000000, 2000000);
+		pwm_enable(ldata->pwm_led);
+
+		if(ldata->led_sync) {
+			if	(!strcmp(ldata->cdev.name, "green")) {
+				pwm_disable(green_back_led_data->pwm_led);
+				pwm_config(green_back_led_data->pwm_led, 1000000, 2000000);
+				pwm_enable(green_back_led_data->pwm_led);
+			}
+			if	(!strcmp(ldata->cdev.name, "amber")) {
+				pwm_disable(amber_back_led_data->pwm_led);
+				pwm_config(amber_back_led_data->pwm_led, 1000000, 2000000);
+				pwm_enable(amber_back_led_data->pwm_led);
+			}
+		}
+		break;
+	default:
+		LED_ERR("%s: bank %d did not support blink type %d\n", __func__, ldata->bank, val);
+		return -EINVAL;
+	}
+
+	return count;
+}
+static DEVICE_ATTR(blink, 0644, pm8xxx_led_blink_show, pm8xxx_led_blink_store);
+
+static ssize_t pm8xxx_led_off_timer_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	struct led_classdev *led_cdev;
+	struct pm8xxx_led_data *ldata;
+	int min, sec;
+	uint16_t off_timer;
+	ktime_t interval;
+	ktime_t next_alarm;
+
+	min = -1;
+	sec = -1;
+	sscanf(buf, "%d %d", &min, &sec);
+
+	if (min < 0 || min > 255)
+		return -EINVAL;
+	if (sec < 0 || sec > 255)
+		return -EINVAL;
+	led_cdev = (struct led_classdev *) dev_get_drvdata(dev);
+	ldata = container_of(led_cdev, struct pm8xxx_led_data, cdev);
+
+	LED_INFO("Setting %s off_timer to %d min %d sec \n", led_cdev->name, min, sec);
+	off_timer = min * 60 + sec;
+
+	alarm_cancel(&ldata->led_alarm);
+	cancel_work_sync(&ldata->led_work);
+	if (off_timer) {
+		interval = ktime_set(off_timer, 0);
+		next_alarm = ktime_add(alarm_get_elapsed_realtime(), interval);
+		alarm_start_range(&ldata->led_alarm, next_alarm, next_alarm);
+	}
+	return count;
+}
+static DEVICE_ATTR(off_timer, 0644, NULL, pm8xxx_led_off_timer_store);
+
+static ssize_t pm8xxx_led_currents_show(struct device *dev,
+					struct device_attribute *attr,
+					char *buf)
+{
+	struct led_classdev *led_cdev;
+	struct pm8xxx_led_data *ldata;
+
+	led_cdev = (struct led_classdev *) dev_get_drvdata(dev);
+	ldata = container_of(led_cdev, struct pm8xxx_led_data, cdev);
+
+	return sprintf(buf, "%d\n", ldata->out_current);
+}
+
+static ssize_t pm8xxx_led_currents_store(struct device *dev,
+					 struct device_attribute *attr,
+					 const char *buf, size_t count)
+{
+	int currents = 0;
+	struct led_classdev *led_cdev;
+	struct pm8xxx_led_data *ldata;
+
+	sscanf(buf, "%d", &currents);
+	if (currents < 0)
+		return -EINVAL;
+
+	led_cdev = (struct led_classdev *)dev_get_drvdata(dev);
+	ldata = container_of(led_cdev, struct pm8xxx_led_data, cdev);
+
+	LED_INFO("%s: bank %d currents %d\n", __func__, ldata->bank, currents);
+	ldata->out_current = currents;
+
+	ldata->cdev.brightness_set(led_cdev, 0);
+	if (currents)
+		ldata->cdev.brightness_set(led_cdev, 255);
+
+	return count;
+}
+static DEVICE_ATTR(currents, 0644, pm8xxx_led_currents_show, pm8xxx_led_currents_store);
+
+static ssize_t pm8xxx_led_pwm_coefficient_show(struct device *dev,
+					struct device_attribute *attr,
+					char *buf)
+{
+	struct led_classdev *led_cdev;
+	struct pm8xxx_led_data *ldata;
+
+	led_cdev = (struct led_classdev *) dev_get_drvdata(dev);
+	ldata = container_of(led_cdev, struct pm8xxx_led_data, cdev);
+
+	return sprintf(buf, "%d\n", ldata->pwm_coefficient);
+}
+
+static ssize_t pm8xxx_led_pwm_coefficient_store(struct device *dev,
+					 struct device_attribute *attr,
+					 const char *buf, size_t count)
+{
+	int pwm_coefficient1 = 0;
+	struct led_classdev *led_cdev;
+	struct pm8xxx_led_data *ldata;
+
+	sscanf(buf, "%d", &pwm_coefficient1);
+	if (pwm_coefficient1 < 0)
+		return -EINVAL;
+
+	led_cdev = (struct led_classdev *)dev_get_drvdata(dev);
+	ldata = container_of(led_cdev, struct pm8xxx_led_data, cdev);
+
+	LED_INFO("%s: pwm_coefficient %d\n", __func__, pwm_coefficient1);
+
+	ldata->pwm_coefficient = pwm_coefficient1;
+
+	return count;
+}
+static DEVICE_ATTR(pwm_coefficient, 0644, pm8xxx_led_pwm_coefficient_show, pm8xxx_led_pwm_coefficient_store);
+
+static int __devinit pm8xxx_led_probe(struct platform_device *pdev)
+{
+	const struct pm8xxx_led_platform_data *pdata = pdev->dev.platform_data;
+	struct pm8xxx_led_configure *curr_led;
+	struct pm8xxx_led_data *led, *led_dat;
+	int i, ret = -ENOMEM;
+
+	if (pdata == NULL) {
+		LED_ERR("platform data not supplied\n");
+		return -EINVAL;
+	}
+
+	led = kcalloc(pdata->num_leds + 1, sizeof(*led), GFP_KERNEL);
+	if (led == NULL) {
+		LED_ERR("failed to alloc memory\n");
+		return -ENOMEM;
+	}
+	wake_lock_init(&pmic_led_wake_lock, WAKE_LOCK_SUSPEND, "pmic_led");
+	g_led_work_queue = create_workqueue("pm8xxx-led");
+	if (g_led_work_queue == NULL) {
+		LED_ERR("failed to create workqueue\n");
+		goto err_create_work_queue;
+	}
+
+	for (i = 0; i < pdata->num_leds; i++) {
+		curr_led			= &pdata->leds[i];
+		led_dat				= &led[i];
+		led_dat->cdev.name		= curr_led->name;
+		led_dat->id     		= curr_led->flags;
+		led_dat->bank			= curr_led->flags;
+		led_dat->function_flags		= curr_led->function_flags;
+		led_dat->start_index		= curr_led->start_index;
+		led_dat->duty_time_ms		= curr_led->duty_time_ms;
+		led_dat->period_us		= curr_led->period_us;
+		led_dat->duites_size		= curr_led->duites_size;
+		led_dat->lut_flag		= curr_led->lut_flag;
+		led_dat->out_current		= curr_led->out_current;
+		led_dat->duties			= &(curr_led->duties[0]);
+		led_dat->led_sync		= curr_led->led_sync;
+		led_dat->pwm_led 		= pwm_request(led_dat->bank, led_dat->cdev.name);
+		if( curr_led->pwm_coefficient > 0 )
+			led_dat->pwm_coefficient	= curr_led->pwm_coefficient;
+		else
+			led_dat->pwm_coefficient	= 100;
+		switch (led_dat->id) {
+		case PM8XXX_ID_GPIO24:
+		case PM8XXX_ID_GPIO25:
+		case PM8XXX_ID_GPIO26:
+			led_dat->cdev.brightness_set = pm8xxx_led_gpio_set;
+			if (curr_led->gpio_status_switch != NULL)
+				led_dat->gpio_status_switch = curr_led->gpio_status_switch;
+			break;
+		case PM8XXX_ID_LED_0:
+		case PM8XXX_ID_LED_1:
+		case PM8XXX_ID_LED_2:
+			led_dat->cdev.brightness_set    = pm8xxx_led_current_set;
+			if (led_dat->function_flags & LED_PWM_FUNCTION) {
+				led_dat->reg		= pm8xxxx_led_pwm_mode(led_dat->id);
+				INIT_DELAYED_WORK(&led[i].fade_delayed_work, led_fade_do_work);
+			} else
+				led_dat->reg		= PM8XXX_LED_MODE_MANUAL;
+			break;
+		case PM8XXX_ID_LED_KB_LIGHT:
+			break;
+		}
+		led_dat->cdev.brightness	= LED_OFF;
+		led_dat->dev			= &pdev->dev;
+
+		ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
+		if (ret) {
+			LED_ERR("unable to register led %d,ret=%d\n", led_dat->id, ret);
+			goto err_register_led_cdev;
+		}
+
+		if (led_dat->id >= PM8XXX_ID_LED_2 && led_dat->id <= PM8XXX_ID_LED_0) {
+			ret = device_create_file(led_dat->cdev.dev, &dev_attr_currents);
+			if (ret < 0) {
+				LED_ERR("%s: Failed to create %d attr currents\n", __func__, i);
+				goto err_register_attr_currents;
+			}
+		}
+		if (led_dat->id <= PM8XXX_ID_GPIO26) {
+			ret = device_create_file(led_dat->cdev.dev, &dev_attr_pwm_coefficient);
+			if (ret < 0) {
+				LED_ERR("%s: Failed to create %d attr pwm_coefficient\n", __func__, i);
+				goto err_register_attr_pwm_coefficient;
+			}
+		}
+		if (led_dat->function_flags & LED_BLINK_FUNCTION) {
+			INIT_DELAYED_WORK(&led[i].blink_delayed_work, led_blink_do_work);
+			ret = device_create_file(led_dat->cdev.dev, &dev_attr_blink);
+			if (ret < 0) {
+				LED_ERR("%s: Failed to create %d attr blink\n", __func__, i);
+				goto err_register_attr_blink;
+			}
+
+			ret = device_create_file(led_dat->cdev.dev, &dev_attr_off_timer);
+			if (ret < 0) {
+				LED_ERR("%s: Failed to create %d attr off timer\n", __func__, i);
+				goto err_register_attr_off_timer;
+			}
+			alarm_init(&led[i].led_alarm, ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP, led_alarm_handler);
+			INIT_WORK(&led[i].led_work, led_work_func); 
+		}
+
+		if (!strcmp(led_dat->cdev.name, "button-backlight")) {
+			for_key_led_data = led_dat;
+		}
+		if (!strcmp(led_dat->cdev.name, "green-back")) {
+			LED_INFO("%s: matt green-back, 000 probe, led_dat = %x\n", __func__, (unsigned int)led_dat);
+			green_back_led_data = led_dat;
+		}
+		if (!strcmp(led_dat->cdev.name, "amber-back")) {
+			LED_INFO("%s: matt amber-back\n", __func__);
+			amber_back_led_data = led_dat;
+		}
+
+	}
+
+	pm8xxx_leds = led;
+
+	platform_set_drvdata(pdev, led);
+
+	return 0;
+
+err_register_attr_off_timer:
+	if (i > 0) {
+		for (i = i - 1; i >= 0; i--) {
+			if (led[i].function_flags & LED_BLINK_FUNCTION)
+				device_remove_file(led[i].cdev.dev, &dev_attr_off_timer);
+		}
+	}
+	i = pdata->num_leds;
+err_register_attr_blink:
+	if (i > 0) {
+		for (i = i - 1; i >= 0; i--) {
+			if (led[i].function_flags & LED_BLINK_FUNCTION)
+				device_remove_file(led[i].cdev.dev, &dev_attr_blink);
+		}
+	}
+	i = pdata->num_leds;
+err_register_attr_pwm_coefficient:
+	if (i > 0) {
+		for (i = i - 1; i >= 0; i--) {
+			if (led[i].function_flags <= PM8XXX_ID_GPIO26)
+				device_remove_file(led[i].cdev.dev, &dev_attr_pwm_coefficient);
+		}
+	}
+	i = pdata->num_leds;
+err_register_attr_currents:
+	if (i > 0) {
+		for (i = i - 1; i >= 0; i--) {
+			if (led[i].function_flags >= PM8XXX_ID_LED_2 && led[i].function_flags <= PM8XXX_ID_LED_0)
+				device_remove_file(led[i].cdev.dev, &dev_attr_currents);
+		}
+	}
+	i = pdata->num_leds;
+err_register_led_cdev:
+	if (i > 0) {
+		for (i = i - 1; i >= 0; i--) {
+			pwm_free(led[i].pwm_led);
+			led_classdev_unregister(&led[i].cdev);
+		}
+	}
+	destroy_workqueue(g_led_work_queue);
+err_create_work_queue:
+	kfree(led);
+	wake_lock_destroy(&pmic_led_wake_lock);
+	return ret;
+}
+
+static int __devexit pm8xxx_led_remove(struct platform_device *pdev)
+{
+	int i;
+	const struct led_platform_data *pdata =
+				pdev->dev.platform_data;
+	struct pm8xxx_led_data *led = platform_get_drvdata(pdev);
+
+	for (i = 0; i < pdata->num_leds; i++) {
+		led_classdev_unregister(&led[i].cdev);
+		if (led[i].function_flags >= PM8XXX_ID_LED_2 && led[i].function_flags <= PM8XXX_ID_LED_0)
+			device_remove_file(led[i].cdev.dev, &dev_attr_currents);
+		if (led[i].function_flags & LED_BLINK_FUNCTION)
+			device_remove_file(led[i].cdev.dev, &dev_attr_blink);
+		if (led[i].function_flags & LED_BLINK_FUNCTION)
+				device_remove_file(led[i].cdev.dev, &dev_attr_off_timer);
+	}
+
+	destroy_workqueue(g_led_work_queue);
+	wake_lock_destroy(&pmic_led_wake_lock);
+	kfree(led);
+
+	return 0;
+}
+
+static struct platform_driver pm8xxx_led_driver = {
+	.probe		= pm8xxx_led_probe,
+	.remove		= __devexit_p(pm8xxx_led_remove),
+	.driver		= {
+		.name	= PM8XXX_LEDS_DEV_NAME,
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __init pm8xxx_led_init(void)
+{
+	return platform_driver_register(&pm8xxx_led_driver);
+}
+subsys_initcall(pm8xxx_led_init);
+
+static void __exit pm8xxx_led_exit(void)
+{
+	platform_driver_unregister(&pm8xxx_led_driver);
+}
+module_exit(pm8xxx_led_exit);
+
+MODULE_DESCRIPTION("PM8XXX LEDs driver");
+MODULE_LICENSE("GPL v2");
+MODULE_VERSION("1.0");
+MODULE_ALIAS("platform:pm8xxx-led");
diff --git a/drivers/leds/tps61310_flashlight.c b/drivers/leds/tps61310_flashlight.c
new file mode 100644
index 0000000..4e6b40a
--- /dev/null
+++ b/drivers/leds/tps61310_flashlight.c
@@ -0,0 +1,604 @@
+/* drivers/i2c/chips/tps61310_flashlight.c
+ *
+ * Copyright (C) 2008-2009 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <mach/msm_iomap.h>
+#include <linux/i2c.h>
+#include <linux/delay.h>
+#include <linux/earlysuspend.h>
+#include <linux/platform_device.h>
+#include <linux/workqueue.h>
+#include <linux/leds.h>
+#include <linux/slab.h>
+#include <linux/gpio.h>
+#include <linux/htc_flashlight.h>
+#include <linux/module.h>
+
+#define FLT_DBG_LOG(fmt, ...) \
+		printk(KERN_DEBUG "[FLT]TPS " fmt, ##__VA_ARGS__)
+#define FLT_INFO_LOG(fmt, ...) \
+		printk(KERN_INFO "[FLT]TPS " fmt, ##__VA_ARGS__)
+#define FLT_ERR_LOG(fmt, ...) \
+		printk(KERN_ERR "[FLT][ERR]TPS " fmt, ##__VA_ARGS__)
+
+#define TPS61310_RETRY_COUNT 10
+
+struct tps61310_data {
+	struct led_classdev 		fl_lcdev;
+	struct early_suspend		fl_early_suspend;
+	enum flashlight_mode_flags 	mode_status;
+	uint32_t			flash_sw_timeout;
+	struct mutex 			tps61310_data_mutex;
+	uint32_t			strb0;
+	uint32_t			strb1;
+	uint8_t 			led_count;
+	uint8_t 			mode_pin_suspend_state_low;
+};
+
+static struct i2c_client *this_client;
+static struct tps61310_data *this_tps61310;
+struct delayed_work tps61310_delayed_work;
+static struct workqueue_struct *tps61310_work_queue;
+static struct mutex tps61310_mutex;
+
+static int switch_state = 1;
+
+static ssize_t switch_show(struct device *dev, struct device_attribute *attr,
+		char *buf)
+{
+	return sprintf(buf, "switch status:%d \n", switch_state);
+}
+
+static ssize_t switch_store(
+		struct device *dev, struct device_attribute *attr,
+		const char *buf, size_t size)
+{
+	int switch_status;
+	switch_status = -1;
+	sscanf(buf, "%d ",&switch_status);
+	FLT_INFO_LOG("%s: %d\n",__func__,switch_status);
+	switch_state = switch_status;
+	return size;
+}
+
+static DEVICE_ATTR(function_switch, S_IRUGO | S_IWUSR, switch_show, switch_store);
+
+static int TPS61310_I2C_TxData(char *txData, int length)
+{
+	uint8_t loop_i;
+	struct i2c_msg msg[] = {
+		{
+		 .addr = this_client->addr,
+		 .flags = 0,
+		 .len = length,
+		 .buf = txData,
+		 },
+	};
+
+	for (loop_i = 0; loop_i < TPS61310_RETRY_COUNT; loop_i++) {
+		if (i2c_transfer(this_client->adapter, msg, 1) > 0)
+			break;
+
+		mdelay(10);
+	}
+
+	if (loop_i >= TPS61310_RETRY_COUNT) {
+		FLT_ERR_LOG("%s retry over %d\n", __func__,
+							TPS61310_RETRY_COUNT);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int tps61310_i2c_command(uint8_t address, uint8_t data)
+{
+	uint8_t buffer[2];
+	int ret;
+
+	buffer[0] = address;
+	buffer[1] = data;
+	ret = TPS61310_I2C_TxData(buffer, 2);
+	if (ret < 0) {
+		FLT_ERR_LOG("%s error\n", __func__);
+		return ret;
+	}
+	return 0;
+}
+
+static int flashlight_turn_off(void)
+{
+	FLT_INFO_LOG("%s\n", __func__);
+	gpio_set_value_cansleep(this_tps61310->strb0, 0);
+	gpio_set_value_cansleep(this_tps61310->strb1, 1);
+	tps61310_i2c_command(0x01, 0x00);
+	this_tps61310->mode_status = FL_MODE_OFF;
+	return 0;
+}
+
+int tps61310_flashlight_control(int mode)
+{
+	int ret = 0;
+
+	mutex_lock(&tps61310_mutex);
+	if (this_tps61310->led_count == 1) {
+	switch (mode) {
+	case FL_MODE_OFF:
+		flashlight_turn_off();
+	break;
+	case FL_MODE_FLASH:
+		tps61310_i2c_command(0x05, 0x6A);
+		tps61310_i2c_command(0x00, 0x00);
+		tps61310_i2c_command(0x01, 0x9E);
+		gpio_set_value_cansleep(this_tps61310->strb1, 0);
+		gpio_set_value_cansleep(this_tps61310->strb0, 1);
+		queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+				   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL1:
+			tps61310_i2c_command(0x05, 0x6A);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x01, 0x86);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL2:
+			tps61310_i2c_command(0x05, 0x6A);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x01, 0x88);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL3:
+			tps61310_i2c_command(0x05, 0x6A);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x01, 0x8C);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL4:
+			tps61310_i2c_command(0x05, 0x6A);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x01, 0x90);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL5:
+			tps61310_i2c_command(0x05, 0x6A);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x01, 0x94);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL6:
+			tps61310_i2c_command(0x05, 0x6A);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x01, 0x98);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL7:
+			tps61310_i2c_command(0x05, 0x6A);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x01, 0x9C);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_PRE_FLASH:
+		tps61310_i2c_command(0x05, 0x6A);
+		tps61310_i2c_command(0x00, 0x04);
+		gpio_set_value_cansleep(this_tps61310->strb0, 0);
+		gpio_set_value_cansleep(this_tps61310->strb1, 1);
+		tps61310_i2c_command(0x01, 0x40);
+	break;
+	case FL_MODE_TORCH:
+		tps61310_i2c_command(0x05, 0x6A);
+		tps61310_i2c_command(0x00, 0x05);
+		gpio_set_value_cansleep(this_tps61310->strb0, 0);
+		gpio_set_value_cansleep(this_tps61310->strb1, 1);
+		tps61310_i2c_command(0x01, 0x40);
+	break;
+	case FL_MODE_TORCH_LEVEL_1:
+		tps61310_i2c_command(0x05, 0x6A);
+		tps61310_i2c_command(0x00, 0x01);
+		gpio_set_value_cansleep(this_tps61310->strb0, 0);
+		gpio_set_value_cansleep(this_tps61310->strb1, 1);
+		tps61310_i2c_command(0x01, 0x40);
+	break;
+	case FL_MODE_TORCH_LEVEL_2:
+		tps61310_i2c_command(0x05, 0x6A);
+		tps61310_i2c_command(0x00, 0x03);
+		gpio_set_value_cansleep(this_tps61310->strb0, 0);
+		gpio_set_value_cansleep(this_tps61310->strb1, 1);
+		tps61310_i2c_command(0x01, 0x40);
+	break;
+	default:
+		FLT_ERR_LOG("%s: unknown flash_light flags: %d\n",
+							__func__, mode);
+		ret = -EINVAL;
+	break;
+	}
+		} else if (this_tps61310->led_count == 2) {
+	switch (mode) {
+	case FL_MODE_OFF:
+		flashlight_turn_off();
+	break;
+	case FL_MODE_FLASH:
+		tps61310_i2c_command(0x05, 0x6B);
+		tps61310_i2c_command(0x00, 0x00);
+		tps61310_i2c_command(0x02, 0x90);
+		tps61310_i2c_command(0x01, 0x90);
+		gpio_set_value_cansleep(this_tps61310->strb1, 0);
+		gpio_set_value_cansleep(this_tps61310->strb0, 1);
+		queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+				   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL1:
+			tps61310_i2c_command(0x05, 0x6B);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x02, 0x83);
+			tps61310_i2c_command(0x01, 0x83);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL2:
+			tps61310_i2c_command(0x05, 0x6B);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x02, 0x84);
+			tps61310_i2c_command(0x01, 0x84);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL3:
+			tps61310_i2c_command(0x05, 0x6B);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x02, 0x86);
+			tps61310_i2c_command(0x01, 0x86);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL4:
+			tps61310_i2c_command(0x05, 0x6B);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x02, 0x88);
+			tps61310_i2c_command(0x01, 0x88);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL5:
+			tps61310_i2c_command(0x05, 0x6B);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x02, 0x8A);
+			tps61310_i2c_command(0x01, 0x8A);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL6:
+			tps61310_i2c_command(0x05, 0x6B);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x02, 0x8C);
+			tps61310_i2c_command(0x01, 0x8C);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_FLASH_LEVEL7:
+			tps61310_i2c_command(0x05, 0x6B);
+			tps61310_i2c_command(0x00, 0x00);
+			tps61310_i2c_command(0x02, 0x8E);
+			tps61310_i2c_command(0x01, 0x8E);
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+			gpio_set_value_cansleep(this_tps61310->strb0, 1);
+			queue_delayed_work(tps61310_work_queue, &tps61310_delayed_work,
+					   msecs_to_jiffies(this_tps61310->flash_sw_timeout));
+	break;
+	case FL_MODE_PRE_FLASH:
+		tps61310_i2c_command(0x05, 0x6B);
+		tps61310_i2c_command(0x00, 0x12);
+		gpio_set_value_cansleep(this_tps61310->strb0, 0);
+		gpio_set_value_cansleep(this_tps61310->strb1, 1);
+		tps61310_i2c_command(0x01, 0x40);
+	break;
+	case FL_MODE_TORCH:
+		tps61310_i2c_command(0x05, 0x6B);
+		tps61310_i2c_command(0x00, 0x1B);
+		gpio_set_value_cansleep(this_tps61310->strb0, 0);
+		gpio_set_value_cansleep(this_tps61310->strb1, 1);
+		tps61310_i2c_command(0x01, 0x40);
+	break;
+	case FL_MODE_TORCH_LEVEL_1:
+		tps61310_i2c_command(0x05, 0x6B);
+		tps61310_i2c_command(0x00, 0x09);
+		gpio_set_value_cansleep(this_tps61310->strb0, 0);
+		gpio_set_value_cansleep(this_tps61310->strb1, 1);
+		tps61310_i2c_command(0x01, 0x40);
+	break;
+	case FL_MODE_TORCH_LEVEL_2:
+		tps61310_i2c_command(0x05, 0x6B);
+		tps61310_i2c_command(0x00, 0x12);
+		gpio_set_value_cansleep(this_tps61310->strb0, 0);
+		gpio_set_value_cansleep(this_tps61310->strb1, 1);
+		tps61310_i2c_command(0x01, 0x40);
+	break;
+	case FL_MODE_TORCH_LED_A:
+		tps61310_i2c_command(0x05, 0x69);
+		tps61310_i2c_command(0x00, 0x09);
+		gpio_set_value_cansleep(this_tps61310->strb0, 0);
+		gpio_set_value_cansleep(this_tps61310->strb1, 1);
+		tps61310_i2c_command(0x01, 0x40);
+	break;
+	case FL_MODE_TORCH_LED_B:
+		tps61310_i2c_command(0x05, 0x6A);
+		tps61310_i2c_command(0x00, 0x09);
+		gpio_set_value_cansleep(this_tps61310->strb0, 0);
+		gpio_set_value_cansleep(this_tps61310->strb1, 1);
+		tps61310_i2c_command(0x01, 0x40);
+	break;
+
+	default:
+		FLT_ERR_LOG("%s: unknown flash_light flags: %d\n",
+							__func__, mode);
+		ret = -EINVAL;
+	break;
+	}
+		}
+	FLT_INFO_LOG("%s: mode: %d\n", __func__, mode);
+	this_tps61310->mode_status = mode;
+	mutex_unlock(&tps61310_mutex);
+
+	return ret;
+}
+
+static void fl_lcdev_brightness_set(struct led_classdev *led_cdev,
+						enum led_brightness brightness)
+{
+	enum flashlight_mode_flags mode;
+	int ret = -1;
+
+
+	if (brightness > 0 && brightness <= LED_HALF) {
+		if (brightness == (LED_HALF - 2))
+			mode = FL_MODE_TORCH_LEVEL_1;
+		else if (brightness == (LED_HALF - 1))
+			mode = FL_MODE_TORCH_LEVEL_2;
+		else if (brightness == 1 && this_tps61310->led_count ==2)
+			mode = FL_MODE_TORCH_LED_A;
+		else if (brightness == 2 && this_tps61310->led_count ==2)
+			mode = FL_MODE_TORCH_LED_B;
+		else
+			mode = FL_MODE_TORCH;
+	} else if (brightness > LED_HALF && brightness <= LED_FULL) {
+		if (brightness == (LED_HALF + 1))
+			mode = FL_MODE_PRE_FLASH; 
+		else if (brightness == (LED_HALF + 3))
+			mode = FL_MODE_FLASH_LEVEL1; 
+		else if (brightness == (LED_HALF + 4))
+			mode = FL_MODE_FLASH_LEVEL2; 
+		else if (brightness == (LED_HALF + 5))
+			mode = FL_MODE_FLASH_LEVEL3; 
+		else if (brightness == (LED_HALF + 6))
+			mode = FL_MODE_FLASH_LEVEL4; 
+		else if (brightness == (LED_HALF + 7))
+			mode = FL_MODE_FLASH_LEVEL5; 
+		else if (brightness == (LED_HALF + 8))
+			mode = FL_MODE_FLASH_LEVEL6; 
+		else if (brightness == (LED_HALF + 9))
+			mode = FL_MODE_FLASH_LEVEL7; 
+		else
+			mode = FL_MODE_FLASH; 
+	} else
+		
+		mode = FL_MODE_OFF;
+
+	if ((mode != FL_MODE_OFF) && switch_state == 0){
+		FLT_INFO_LOG("%s flashlight is disabled by switch, mode = %d\n",__func__, mode);
+		return;
+	}
+
+
+	ret = tps61310_flashlight_control(mode);
+	if (ret) {
+		FLT_ERR_LOG("%s: control failure rc:%d\n", __func__, ret);
+		return;
+	}
+}
+
+static void flashlight_early_suspend(struct early_suspend *handler)
+{
+	FLT_INFO_LOG("%s\n", __func__);
+	if (this_tps61310 != NULL && this_tps61310->mode_status)
+		flashlight_turn_off();
+}
+
+static void flashlight_late_resume(struct early_suspend *handler)
+{
+}
+
+static void flashlight_turn_off_work(struct work_struct *work)
+{
+	FLT_INFO_LOG("%s\n", __func__);
+	flashlight_turn_off();
+}
+
+static int tps61310_probe(struct i2c_client *client,
+					const struct i2c_device_id *id)
+{
+	struct tps61310_data *tps61310;
+	struct TPS61310_flashlight_platform_data *pdata;
+	int err = 0;
+
+	FLT_INFO_LOG("%s +\n", __func__);
+	pdata = client->dev.platform_data;
+	if (!pdata) {
+		FLT_ERR_LOG("%s: Assign platform_data error!!\n", __func__);
+		return -EINVAL;
+	}
+
+	if (pdata->gpio_init)
+		pdata->gpio_init();
+
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		err = -ENODEV;
+		goto check_functionality_failed;
+	}
+
+	tps61310 = kzalloc(sizeof(struct tps61310_data), GFP_KERNEL);
+	if (!tps61310) {
+		FLT_ERR_LOG("%s: kzalloc fail !!!\n", __func__);
+		return -ENOMEM;
+	}
+
+	i2c_set_clientdata(client, tps61310);
+	this_client = client;
+
+	INIT_DELAYED_WORK(&tps61310_delayed_work, flashlight_turn_off_work);
+	tps61310_work_queue = create_singlethread_workqueue("tps61310_wq");
+	if (!tps61310_work_queue)
+		goto err_create_tps61310_work_queue;
+
+	
+	tps61310->fl_lcdev.name           = FLASHLIGHT_NAME;
+	tps61310->fl_lcdev.brightness_set = fl_lcdev_brightness_set;
+	tps61310->strb0                   = pdata->tps61310_strb0;
+	tps61310->strb1                   = pdata->tps61310_strb1;
+	tps61310->flash_sw_timeout	  = pdata->flash_duration_ms;
+	tps61310->led_count = (pdata->led_count) ? pdata->led_count : 1;
+	tps61310->mode_pin_suspend_state_low = pdata->mode_pin_suspend_state_low;
+
+	if (tps61310->flash_sw_timeout <= 0)
+		tps61310->flash_sw_timeout = 600;
+
+	mutex_init(&tps61310_mutex);
+	err = led_classdev_register(&client->dev, &tps61310->fl_lcdev);
+	if (err < 0) {
+		FLT_ERR_LOG("%s: failed on led_classdev_register\n", __func__);
+		goto platform_data_null;
+	}
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+	tps61310->fl_early_suspend.suspend = flashlight_early_suspend;
+	tps61310->fl_early_suspend.resume  = flashlight_late_resume;
+	register_early_suspend(&tps61310->fl_early_suspend);
+#endif
+	this_tps61310 = tps61310;
+
+	err = device_create_file(tps61310->fl_lcdev.dev, &dev_attr_function_switch);
+	if (err < 0) {
+		FLT_ERR_LOG("%s, create function_switch sysfs fail\n", __func__);
+	}
+	
+	tps61310_i2c_command(0x01, 0x00);
+	
+	tps61310_i2c_command(0x07, 0xF6);
+
+	FLT_INFO_LOG("%s -\n", __func__);
+	return 0;
+
+
+platform_data_null:
+	destroy_workqueue(tps61310_work_queue);
+	mutex_destroy(&tps61310_mutex);
+err_create_tps61310_work_queue:
+	kfree(tps61310);
+check_functionality_failed:
+	return err;
+}
+
+static int tps61310_remove(struct i2c_client *client)
+{
+	struct tps61310_data *tps61310 = i2c_get_clientdata(client);
+
+	led_classdev_unregister(&tps61310->fl_lcdev);
+	destroy_workqueue(tps61310_work_queue);
+	mutex_destroy(&tps61310_mutex);
+	unregister_early_suspend(&tps61310->fl_early_suspend);
+	kfree(tps61310);
+
+	FLT_INFO_LOG("%s:\n", __func__);
+	return 0;
+}
+
+static const struct i2c_device_id tps61310_id[] = {
+	{ "TPS61310_FLASHLIGHT", 0 },
+	{ }
+};
+static int tps61310_resume(struct i2c_client *client)
+{
+
+		FLT_INFO_LOG("%s:\n", __func__);
+		if (this_tps61310->mode_pin_suspend_state_low)
+			gpio_set_value_cansleep(this_tps61310->strb1, 1);
+		return 0;
+}
+static int tps61310_suspend(struct i2c_client *client, pm_message_t state)
+{
+
+		FLT_INFO_LOG("%s:\n", __func__);
+		if (this_tps61310->mode_pin_suspend_state_low)
+			gpio_set_value_cansleep(this_tps61310->strb1, 0);
+
+		return 0;
+}
+
+static struct i2c_driver tps61310_driver = {
+	.probe		= tps61310_probe,
+	.remove		= tps61310_remove,
+	.suspend	= tps61310_suspend,
+	.resume		= tps61310_resume,
+	.id_table	= tps61310_id,
+	.driver		= {
+		.name = "TPS61310_FLASHLIGHT",
+	},
+};
+
+static int __init tps61310_init(void)
+{
+	FLT_INFO_LOG("tps61310 Led Flash driver: init\n");
+	return i2c_add_driver(&tps61310_driver);
+}
+
+static void __exit tps61310_exit(void)
+{
+	i2c_del_driver(&tps61310_driver);
+}
+
+module_init(tps61310_init);
+module_exit(tps61310_exit);
+
+MODULE_DESCRIPTION("TPS61310 Led Flash driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index d039de8..b58b7a3 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -1084,6 +1084,7 @@
 	ti->split_io = dm_rh_get_region_size(ms->rh);
 	ti->num_flush_requests = 1;
 	ti->num_discard_requests = 1;
+	ti->discard_zeroes_data_unsupported = 1;
 
 	ms->kmirrord_wq = alloc_workqueue("kmirrord",
 					  WQ_NON_REENTRANT | WQ_MEM_RECLAIM, 0);
@@ -1214,7 +1215,7 @@
 	 * We need to dec pending if this was a write.
 	 */
 	if (rw == WRITE) {
-		if (!(bio->bi_rw & REQ_FLUSH))
+		if (!(bio->bi_rw & (REQ_FLUSH | REQ_DISCARD)))
 			dm_rh_dec(ms->rh, map_context->ll);
 		return error;
 	}
diff --git a/drivers/md/dm-region-hash.c b/drivers/md/dm-region-hash.c
index 7771ed2..69732e0 100644
--- a/drivers/md/dm-region-hash.c
+++ b/drivers/md/dm-region-hash.c
@@ -404,6 +404,9 @@
 		return;
 	}
 
+	if (bio->bi_rw & REQ_DISCARD)
+		return;
+
 	/* We must inform the log that the sync count has changed. */
 	log->type->set_region_sync(log, region, 0);
 
@@ -524,7 +527,7 @@
 	struct bio *bio;
 
 	for (bio = bios->head; bio; bio = bio->bi_next) {
-		if (bio->bi_rw & REQ_FLUSH)
+		if (bio->bi_rw & (REQ_FLUSH | REQ_DISCARD))
 			continue;
 		rh_inc(rh, dm_rh_bio_to_region(rh, bio));
 	}
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index eb3d138..1555f0b 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -19,7 +19,7 @@
 /*
  * Tunable constants
  */
-#define ENDIO_HOOK_POOL_SIZE 10240
+#define ENDIO_HOOK_POOL_SIZE 1024
 #define DEFERRED_SET_SIZE 64
 #define MAPPING_POOL_SIZE 1024
 #define PRISON_CELLS 1024
@@ -855,7 +855,7 @@
 
 	if (m->err) {
 		cell_error(m->cell);
-		return;
+		goto out;
 	}
 
 	/*
@@ -867,7 +867,7 @@
 	if (r) {
 		DMERR("dm_thin_insert_block() failed");
 		cell_error(m->cell);
-		return;
+		goto out;
 	}
 
 	/*
@@ -882,6 +882,7 @@
 	} else
 		cell_defer(tc, m->cell, m->data_block);
 
+out:
 	list_del(&m->list);
 	mempool_free(m, tc->pool->mapping_pool);
 }
@@ -1240,7 +1241,10 @@
 
 			cell_release_singleton(cell, bio);
 			cell_release_singleton(cell2, bio);
-			remap_and_issue(tc, bio, lookup_result.block);
+			if ((!lookup_result.shared) && pool->pf.discard_passdown)
+				remap_and_issue(tc, bio, lookup_result.block);
+			else
+				bio_endio(bio, 0);
 		}
 		break;
 
@@ -2575,6 +2579,7 @@
 	if (tc->pool->pf.discard_enabled) {
 		ti->discards_supported = 1;
 		ti->num_discard_requests = 1;
+		ti->discard_zeroes_data_unsupported = 1;
 	}
 
 	dm_put(pool_md);
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 01233d8..9ee8ce3 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -452,7 +452,7 @@
 			atomic_inc(&rdev->nr_pending);
 			atomic_inc(&rdev->nr_pending);
 			rcu_read_unlock();
-			bi = bio_alloc_mddev(GFP_KERNEL, 0, mddev);
+			bi = bio_alloc_mddev(GFP_NOIO, 0, mddev);
 			bi->bi_end_io = md_end_flush;
 			bi->bi_private = rdev;
 			bi->bi_bdev = rdev->bdev;
@@ -3744,8 +3744,8 @@
 	return sprintf(page, "%s\n", array_states[st]);
 }
 
-static int do_md_stop(struct mddev * mddev, int ro, int is_open);
-static int md_set_readonly(struct mddev * mddev, int is_open);
+static int do_md_stop(struct mddev * mddev, int ro, struct block_device *bdev);
+static int md_set_readonly(struct mddev * mddev, struct block_device *bdev);
 static int do_md_run(struct mddev * mddev);
 static int restart_array(struct mddev *mddev);
 
@@ -3761,14 +3761,14 @@
 		/* stopping an active array */
 		if (atomic_read(&mddev->openers) > 0)
 			return -EBUSY;
-		err = do_md_stop(mddev, 0, 0);
+		err = do_md_stop(mddev, 0, NULL);
 		break;
 	case inactive:
 		/* stopping an active array */
 		if (mddev->pers) {
 			if (atomic_read(&mddev->openers) > 0)
 				return -EBUSY;
-			err = do_md_stop(mddev, 2, 0);
+			err = do_md_stop(mddev, 2, NULL);
 		} else
 			err = 0; /* already inactive */
 		break;
@@ -3776,7 +3776,7 @@
 		break; /* not supported yet */
 	case readonly:
 		if (mddev->pers)
-			err = md_set_readonly(mddev, 0);
+			err = md_set_readonly(mddev, NULL);
 		else {
 			mddev->ro = 1;
 			set_disk_ro(mddev->gendisk, 1);
@@ -3786,7 +3786,7 @@
 	case read_auto:
 		if (mddev->pers) {
 			if (mddev->ro == 0)
-				err = md_set_readonly(mddev, 0);
+				err = md_set_readonly(mddev, NULL);
 			else if (mddev->ro == 1)
 				err = restart_array(mddev);
 			if (err == 0) {
@@ -5124,15 +5124,17 @@
 }
 EXPORT_SYMBOL_GPL(md_stop);
 
-static int md_set_readonly(struct mddev *mddev, int is_open)
+static int md_set_readonly(struct mddev *mddev, struct block_device *bdev)
 {
 	int err = 0;
 	mutex_lock(&mddev->open_mutex);
-	if (atomic_read(&mddev->openers) > is_open) {
+	if (atomic_read(&mddev->openers) > !!bdev) {
 		printk("md: %s still in use.\n",mdname(mddev));
 		err = -EBUSY;
 		goto out;
 	}
+	if (bdev)
+		sync_blockdev(bdev);
 	if (mddev->pers) {
 		__md_stop_writes(mddev);
 
@@ -5154,18 +5156,26 @@
  *   0 - completely stop and dis-assemble array
  *   2 - stop but do not disassemble array
  */
-static int do_md_stop(struct mddev * mddev, int mode, int is_open)
+static int do_md_stop(struct mddev * mddev, int mode,
+		      struct block_device *bdev)
 {
 	struct gendisk *disk = mddev->gendisk;
 	struct md_rdev *rdev;
 
 	mutex_lock(&mddev->open_mutex);
-	if (atomic_read(&mddev->openers) > is_open ||
+	if (atomic_read(&mddev->openers) > !!bdev ||
 	    mddev->sysfs_active) {
 		printk("md: %s still in use.\n",mdname(mddev));
 		mutex_unlock(&mddev->open_mutex);
 		return -EBUSY;
 	}
+	if (bdev)
+		/* It is possible IO was issued on some other
+		 * open file which was closed before we took ->open_mutex.
+		 * As that was not the last close __blkdev_put will not
+		 * have called sync_blockdev, so we must.
+		 */
+		sync_blockdev(bdev);
 
 	if (mddev->pers) {
 		if (mddev->ro)
@@ -5239,7 +5249,7 @@
 	err = do_md_run(mddev);
 	if (err) {
 		printk(KERN_WARNING "md: do_md_run() returned %d\n", err);
-		do_md_stop(mddev, 0, 0);
+		do_md_stop(mddev, 0, NULL);
 	}
 }
 
@@ -6237,11 +6247,11 @@
 			goto done_unlock;
 
 		case STOP_ARRAY:
-			err = do_md_stop(mddev, 0, 1);
+			err = do_md_stop(mddev, 0, bdev);
 			goto done_unlock;
 
 		case STOP_ARRAY_RO:
-			err = md_set_readonly(mddev, 1);
+			err = md_set_readonly(mddev, bdev);
 			goto done_unlock;
 
 		case BLKROSET:
diff --git a/drivers/md/persistent-data/dm-space-map-checker.c b/drivers/md/persistent-data/dm-space-map-checker.c
index 50ed53b..fc90c11 100644
--- a/drivers/md/persistent-data/dm-space-map-checker.c
+++ b/drivers/md/persistent-data/dm-space-map-checker.c
@@ -8,6 +8,7 @@
 
 #include <linux/device-mapper.h>
 #include <linux/export.h>
+#include <linux/vmalloc.h>
 
 #ifdef CONFIG_DM_DEBUG_SPACE_MAPS
 
@@ -89,13 +90,23 @@
 
 	ca->nr = nr_blocks;
 	ca->nr_free = nr_blocks;
-	ca->counts = kzalloc(sizeof(*ca->counts) * nr_blocks, GFP_KERNEL);
-	if (!ca->counts)
-		return -ENOMEM;
+
+	if (!nr_blocks)
+		ca->counts = NULL;
+	else {
+		ca->counts = vzalloc(sizeof(*ca->counts) * nr_blocks);
+		if (!ca->counts)
+			return -ENOMEM;
+	}
 
 	return 0;
 }
 
+static void ca_destroy(struct count_array *ca)
+{
+	vfree(ca->counts);
+}
+
 static int ca_load(struct count_array *ca, struct dm_space_map *sm)
 {
 	int r;
@@ -126,12 +137,14 @@
 static int ca_extend(struct count_array *ca, dm_block_t extra_blocks)
 {
 	dm_block_t nr_blocks = ca->nr + extra_blocks;
-	uint32_t *counts = kzalloc(sizeof(*counts) * nr_blocks, GFP_KERNEL);
+	uint32_t *counts = vzalloc(sizeof(*counts) * nr_blocks);
 	if (!counts)
 		return -ENOMEM;
 
-	memcpy(counts, ca->counts, sizeof(*counts) * ca->nr);
-	kfree(ca->counts);
+	if (ca->counts) {
+		memcpy(counts, ca->counts, sizeof(*counts) * ca->nr);
+		ca_destroy(ca);
+	}
 	ca->nr = nr_blocks;
 	ca->nr_free += extra_blocks;
 	ca->counts = counts;
@@ -151,11 +164,6 @@
 	return 0;
 }
 
-static void ca_destroy(struct count_array *ca)
-{
-	kfree(ca->counts);
-}
-
 /*----------------------------------------------------------------*/
 
 struct sm_checker {
@@ -343,25 +351,25 @@
 	int r;
 	struct sm_checker *smc;
 
-	if (!sm)
-		return NULL;
+	if (IS_ERR_OR_NULL(sm))
+		return ERR_PTR(-EINVAL);
 
 	smc = kmalloc(sizeof(*smc), GFP_KERNEL);
 	if (!smc)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	memcpy(&smc->sm, &ops_, sizeof(smc->sm));
 	r = ca_create(&smc->old_counts, sm);
 	if (r) {
 		kfree(smc);
-		return NULL;
+		return ERR_PTR(r);
 	}
 
 	r = ca_create(&smc->counts, sm);
 	if (r) {
 		ca_destroy(&smc->old_counts);
 		kfree(smc);
-		return NULL;
+		return ERR_PTR(r);
 	}
 
 	smc->real_sm = sm;
@@ -371,7 +379,7 @@
 		ca_destroy(&smc->counts);
 		ca_destroy(&smc->old_counts);
 		kfree(smc);
-		return NULL;
+		return ERR_PTR(r);
 	}
 
 	r = ca_commit(&smc->old_counts, &smc->counts);
@@ -379,7 +387,7 @@
 		ca_destroy(&smc->counts);
 		ca_destroy(&smc->old_counts);
 		kfree(smc);
-		return NULL;
+		return ERR_PTR(r);
 	}
 
 	return &smc->sm;
@@ -391,25 +399,25 @@
 	int r;
 	struct sm_checker *smc;
 
-	if (!sm)
-		return NULL;
+	if (IS_ERR_OR_NULL(sm))
+		return ERR_PTR(-EINVAL);
 
 	smc = kmalloc(sizeof(*smc), GFP_KERNEL);
 	if (!smc)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	memcpy(&smc->sm, &ops_, sizeof(smc->sm));
 	r = ca_create(&smc->old_counts, sm);
 	if (r) {
 		kfree(smc);
-		return NULL;
+		return ERR_PTR(r);
 	}
 
 	r = ca_create(&smc->counts, sm);
 	if (r) {
 		ca_destroy(&smc->old_counts);
 		kfree(smc);
-		return NULL;
+		return ERR_PTR(r);
 	}
 
 	smc->real_sm = sm;
diff --git a/drivers/md/persistent-data/dm-space-map-disk.c b/drivers/md/persistent-data/dm-space-map-disk.c
index fc469ba..3d0ed53 100644
--- a/drivers/md/persistent-data/dm-space-map-disk.c
+++ b/drivers/md/persistent-data/dm-space-map-disk.c
@@ -290,7 +290,16 @@
 				       dm_block_t nr_blocks)
 {
 	struct dm_space_map *sm = dm_sm_disk_create_real(tm, nr_blocks);
-	return dm_sm_checker_create_fresh(sm);
+	struct dm_space_map *smc;
+
+	if (IS_ERR_OR_NULL(sm))
+		return sm;
+
+	smc = dm_sm_checker_create_fresh(sm);
+	if (IS_ERR(smc))
+		dm_sm_destroy(sm);
+
+	return smc;
 }
 EXPORT_SYMBOL_GPL(dm_sm_disk_create);
 
diff --git a/drivers/md/persistent-data/dm-transaction-manager.c b/drivers/md/persistent-data/dm-transaction-manager.c
index 6f8d387..ba54aac 100644
--- a/drivers/md/persistent-data/dm-transaction-manager.c
+++ b/drivers/md/persistent-data/dm-transaction-manager.c
@@ -138,6 +138,9 @@
 
 void dm_tm_destroy(struct dm_transaction_manager *tm)
 {
+	if (!tm->is_clone)
+		wipe_shadow_table(tm);
+
 	kfree(tm);
 }
 EXPORT_SYMBOL_GPL(dm_tm_destroy);
@@ -342,8 +345,10 @@
 		}
 
 		*sm = dm_sm_checker_create(inner);
-		if (!*sm)
+		if (IS_ERR(*sm)) {
+			r = PTR_ERR(*sm);
 			goto bad2;
+		}
 
 	} else {
 		r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location,
@@ -362,8 +367,10 @@
 		}
 
 		*sm = dm_sm_checker_create(inner);
-		if (!*sm)
+		if (IS_ERR(*sm)) {
+			r = PTR_ERR(*sm);
 			goto bad2;
+		}
 	}
 
 	return 0;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 15dd59b..23904d2 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1821,8 +1821,14 @@
 
 	if (atomic_dec_and_test(&r1_bio->remaining)) {
 		/* if we're here, all write(s) have completed, so clean up */
-		md_done_sync(mddev, r1_bio->sectors, 1);
-		put_buf(r1_bio);
+		int s = r1_bio->sectors;
+		if (test_bit(R1BIO_MadeGood, &r1_bio->state) ||
+		    test_bit(R1BIO_WriteError, &r1_bio->state))
+			reschedule_retry(r1_bio);
+		else {
+			put_buf(r1_bio);
+			md_done_sync(mddev, s, 1);
+		}
 	}
 }
 
@@ -2423,7 +2429,10 @@
 		/* There is nowhere to write, so all non-sync
 		 * drives must be failed - so we are finished
 		 */
-		sector_t rv = max_sector - sector_nr;
+		sector_t rv;
+		if (min_bad > 0)
+			max_sector = sector_nr + min_bad;
+		rv = max_sector - sector_nr;
 		*skipped = 1;
 		put_buf(r1_bio);
 		return rv;
@@ -2486,9 +2495,10 @@
 	 */
 	if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
 		atomic_set(&r1_bio->remaining, read_targets);
-		for (i = 0; i < conf->raid_disks * 2; i++) {
+		for (i = 0; i < conf->raid_disks * 2 && read_targets; i++) {
 			bio = r1_bio->bios[i];
 			if (bio->bi_end_io == end_sync_read) {
+				read_targets--;
 				md_sync_acct(bio->bi_bdev, nr_sectors);
 				generic_make_request(bio);
 			}
@@ -2548,6 +2558,7 @@
 	err = -EINVAL;
 	spin_lock_init(&conf->device_lock);
 	rdev_for_each(rdev, mddev) {
+		struct request_queue *q;
 		int disk_idx = rdev->raid_disk;
 		if (disk_idx >= mddev->raid_disks
 		    || disk_idx < 0)
@@ -2560,6 +2571,9 @@
 		if (disk->rdev)
 			goto abort;
 		disk->rdev = rdev;
+		q = bdev_get_queue(rdev->bdev);
+		if (q->merge_bvec_fn)
+			mddev->merge_check_needed = 1;
 
 		disk->head_position = 0;
 	}
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 3f91c2e..a954c95 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2209,7 +2209,7 @@
 			if (r10_sync_page_io(rdev,
 					     r10_bio->devs[sl].addr +
 					     sect,
-					     s<<9, conf->tmppage, WRITE)
+					     s, conf->tmppage, WRITE)
 			    == 0) {
 				/* Well, this device is dead */
 				printk(KERN_NOTICE
@@ -2246,7 +2246,7 @@
 			switch (r10_sync_page_io(rdev,
 					     r10_bio->devs[sl].addr +
 					     sect,
-					     s<<9, conf->tmppage,
+					     s, conf->tmppage,
 						 READ)) {
 			case 0:
 				/* Well, this device is dead */
@@ -2407,7 +2407,7 @@
 	slot = r10_bio->read_slot;
 	printk_ratelimited(
 		KERN_ERR
-		"md/raid10:%s: %s: redirecting"
+		"md/raid10:%s: %s: redirecting "
 		"sector %llu to another mirror\n",
 		mdname(mddev),
 		bdevname(rdev->bdev, b),
@@ -2772,6 +2772,12 @@
 			/* want to reconstruct this device */
 			rb2 = r10_bio;
 			sect = raid10_find_virt(conf, sector_nr, i);
+			if (sect >= mddev->resync_max_sectors) {
+				/* last stripe is not complete - don't
+				 * try to recover this sector.
+				 */
+				continue;
+			}
 			/* Unless we are doing a full sync, or a replacement
 			 * we only need to recover the block if it is set in
 			 * the bitmap
@@ -3311,7 +3317,7 @@
 				 (conf->raid_disks / conf->near_copies));
 
 	rdev_for_each(rdev, mddev) {
-
+		struct request_queue *q;
 		disk_idx = rdev->raid_disk;
 		if (disk_idx >= conf->raid_disks
 		    || disk_idx < 0)
@@ -3327,6 +3333,9 @@
 				goto out_free_conf;
 			disk->rdev = rdev;
 		}
+		q = bdev_get_queue(rdev->bdev);
+		if (q->merge_bvec_fn)
+			mddev->merge_check_needed = 1;
 
 		disk_stack_limits(mddev->gendisk, rdev->bdev,
 				  rdev->data_offset << 9);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index f351422..73a5800 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -196,12 +196,14 @@
 		BUG_ON(!list_empty(&sh->lru));
 		BUG_ON(atomic_read(&conf->active_stripes)==0);
 		if (test_bit(STRIPE_HANDLE, &sh->state)) {
-			if (test_bit(STRIPE_DELAYED, &sh->state))
+			if (test_bit(STRIPE_DELAYED, &sh->state) &&
+			    !test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
 				list_add_tail(&sh->lru, &conf->delayed_list);
 			else if (test_bit(STRIPE_BIT_DELAY, &sh->state) &&
 				   sh->bm_seq - conf->seq_write > 0)
 				list_add_tail(&sh->lru, &conf->bitmap_list);
 			else {
+				clear_bit(STRIPE_DELAYED, &sh->state);
 				clear_bit(STRIPE_BIT_DELAY, &sh->state);
 				list_add_tail(&sh->lru, &conf->handle_list);
 			}
@@ -583,6 +585,12 @@
 					 * a chance*/
 					md_check_recovery(conf->mddev);
 				}
+				/*
+				 * Because md_wait_for_blocked_rdev
+				 * will dec nr_pending, we must
+				 * increment it first.
+				 */
+				atomic_inc(&rdev->nr_pending);
 				md_wait_for_blocked_rdev(rdev, conf->mddev);
 			} else {
 				/* Acknowledged bad block - skip the write */
@@ -3842,7 +3850,6 @@
 		raid_bio->bi_next = (void*)rdev;
 		align_bi->bi_bdev =  rdev->bdev;
 		align_bi->bi_flags &= ~(1 << BIO_SEG_VALID);
-		align_bi->bi_sector += rdev->data_offset;
 
 		if (!bio_fits_rdev(align_bi) ||
 		    is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9,
@@ -3853,6 +3860,9 @@
 			return 0;
 		}
 
+		/* No reshape active, so we can trust rdev->data_offset */
+		align_bi->bi_sector += rdev->data_offset;
+
 		spin_lock_irq(&conf->device_lock);
 		wait_event_lock_irq(conf->wait_for_stripe,
 				    conf->quiesce == 0,
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 00a6732..39eab73 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -243,6 +243,7 @@
 	if (minor == MAX_DVB_MINORS) {
 		kfree(dvbdevfops);
 		kfree(dvbdev);
+		up_write(&minor_rwsem);
 		mutex_unlock(&dvbdev_register_lock);
 		return -EINVAL;
 	}
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
index b1fe513..664e460 100644
--- a/drivers/media/dvb/siano/smsusb.c
+++ b/drivers/media/dvb/siano/smsusb.c
@@ -542,6 +542,10 @@
 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
 	{ USB_DEVICE(0x2040, 0xc090),
 		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
+	{ USB_DEVICE(0x2040, 0xc0a0),
+		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
+	{ USB_DEVICE(0x2040, 0xf5a0),
+		.driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
 	{ } /* Terminating entry */
 	};
 
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index bef5296..647dd95 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -1018,6 +1018,8 @@
 
 	spin_lock_init(&dev->hw_lock);
 
+	dev->hw_io = pnp_port_start(pnp_dev, 0);
+
 	pnp_set_drvdata(pnp_dev, dev);
 	dev->pnp_dev = pnp_dev;
 
@@ -1072,7 +1074,6 @@
 
 	/* claim the resources */
 	error = -EBUSY;
-	dev->hw_io = pnp_port_start(pnp_dev, 0);
 	if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) {
 		dev->hw_io = -1;
 		dev->irq = -1;
diff --git a/drivers/media/video/cx231xx/cx231xx-audio.c b/drivers/media/video/cx231xx/cx231xx-audio.c
index a2c2b7d..e5742a0 100644
--- a/drivers/media/video/cx231xx/cx231xx-audio.c
+++ b/drivers/media/video/cx231xx/cx231xx-audio.c
@@ -307,7 +307,7 @@
 		urb->context = dev;
 		urb->pipe = usb_rcvisocpipe(dev->udev,
 						dev->adev.end_point_addr);
-		urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
+		urb->transfer_flags = URB_ISO_ASAP;
 		urb->transfer_buffer = dev->adev.transfer_buffer[i];
 		urb->interval = 1;
 		urb->complete = cx231xx_audio_isocirq;
@@ -368,7 +368,7 @@
 		urb->context = dev;
 		urb->pipe = usb_rcvbulkpipe(dev->udev,
 						dev->adev.end_point_addr);
-		urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
+		urb->transfer_flags = 0;
 		urb->transfer_buffer = dev->adev.transfer_buffer[i];
 		urb->complete = cx231xx_audio_bulkirq;
 		urb->transfer_buffer_length = sb_size;
diff --git a/drivers/media/video/cx231xx/cx231xx-vbi.c b/drivers/media/video/cx231xx/cx231xx-vbi.c
index 8cdee5f..9c5967e 100644
--- a/drivers/media/video/cx231xx/cx231xx-vbi.c
+++ b/drivers/media/video/cx231xx/cx231xx-vbi.c
@@ -452,7 +452,7 @@
 			return -ENOMEM;
 		}
 		dev->vbi_mode.bulk_ctl.urb[i] = urb;
-		urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
+		urb->transfer_flags = 0;
 
 		dev->vbi_mode.bulk_ctl.transfer_buffer[i] =
 		    kzalloc(sb_size, GFP_KERNEL);
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index ca5a2b1..4dc8852 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -1723,7 +1723,7 @@
 				enum v4l2_buf_type buf_type)
 {
 	struct gspca_dev *gspca_dev = priv;
-	int ret;
+	int i, ret;
 
 	if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
 		return -EINVAL;
@@ -1754,6 +1754,8 @@
 	wake_up_interruptible(&gspca_dev->wq);
 
 	/* empty the transfer queues */
+	for (i = 0; i < gspca_dev->nframes; i++)
+		gspca_dev->frame[i].v4l2_buf.flags &= ~BUF_ALL_FLAGS;
 	atomic_set(&gspca_dev->fr_q, 0);
 	atomic_set(&gspca_dev->fr_i, 0);
 	gspca_dev->fr_o = 0;
diff --git a/drivers/media/video/msm/Kconfig b/drivers/media/video/msm/Kconfig
index e08c673..146e74c 100644
--- a/drivers/media/video/msm/Kconfig
+++ b/drivers/media/video/msm/Kconfig
@@ -36,6 +36,38 @@
 	depends on MSM_CAMERA
 	---help---
 	SONY 13.5 MP Bayer Sensor
+
+config S5K3H2YX
+	bool "Sensor s5k3h2yx (Samsung 8M)"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  Support for S5K3H2YX samsung sensor driver.
+	  It is a Bayer 8MP sensor with auto focus and it supports
+	  two mipi lanes.
+
+config S5K6A1GX
+	bool "Sensor s5k6a1gx (Samsung 1.3M)"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  Support for S5K6A1GX samsung sensor driver.
+	  It is a Bayer 1.3MP sensor it supports one mipi lanes.
+
+config AR0260
+	bool "Sensor ar0260"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  Support for AR0260 sensor driver.
+
+config OV2722
+	bool "Sensor ov2722"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  Support for OV2722 sensor driver.
+
 config OV5640
 	bool "Sensor OV5640 (YUV 5M)"
 	depends on MSM_CAMERA && !MSM_CAMERA_V4L2
@@ -57,7 +89,7 @@
 	  Say Y here if this is msm7627A variant platform.
 config WEBCAM_OV7692_QRD
 	bool "Sensor OV7692 QRD(VGA YUV)"
-	depends on MSM_CAMERA && (ARCH_MSM7X27A || ARCH_MSM8X60)
+	depends on MSM_CAMERA && ARCH_MSM7X27A
 	default n
 	---help---
 	  Omni Vision VGA YUV Sensor for QRD Devices
@@ -82,7 +114,7 @@
 #	This uses the CSI interface.
 config VX6953
 	bool "Sensor VX6953 (BAYER 5M)"
-	depends on MSM_CAMERA && (ARCH_MSM7X30 || ARCH_MSM8X60) && !MSM_CAMERA_V4L2
+	depends on MSM_CAMERA && (ARCH_MSM7X30 || ARCH_MSM8X60)
 	default y
 	---help---
 	STM 5M Bayer Sensor with EDOF
@@ -136,6 +168,20 @@
 	---help---
 	Actuator for SONY 13.5 MP Bayer Sensor
 
+config IMX105_ACT
+	bool "Actuator IMX105 (BAYER 8M)"
+	depends on MSM_CAMERA && ARCH_MSM8960
+	default n
+	---help---
+	Actuator for SONY 8 MP Bayer Sensor
+
+config S5K3H2YX_ACT
+	bool "Sensor s5k3h2yx actuator"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  Autofocus of s5k3h2yx actuator
+
 config S5K3E2FX
 	bool "Sensor s5k3e2fx (Samsung 5M)"
 	depends on MSM_CAMERA && !ARCH_MSM8X60 && !MSM_CAMERA_V4L2
@@ -177,15 +223,6 @@
 	  supports spotlight and flash light modes with
 	  differrent current levels.
 
-config MSM_CAMERA_FLASH_TPS61310
-	bool "Qualcomm MSM camera tps61310 flash support"
-	depends on MSM_CAMERA
-	default n
-	---help---
-	  Enable support for LED flash for msm camera.
-	  It is a Texas Instruments multiple LED Flash
-	  for camera flash and video light applications.
-
 config IMX072
 	bool "Sensor imx072 (Sony 5M)"
 	default n
@@ -199,33 +236,6 @@
 	bool "Sensor ov2720 (Omnivision 2MP)"
 	depends on MSM_CAMERA
 
-config OV8825
-	bool "Sensor ov8825 (Omnivision 8M)"
-	depends on MSM_CAMERA
-	---help---
-	  Support for OV8825 sensor driver.
-	  It is a Bayer 8MP sensor with auto focus and it supports
-	  two mipi lanes, required for msm8625 platform.
-	  Say Y here if this is msm8625 variant platform.
-
-config IMX135
-	bool "Sensor imx135 (Sony 13MP)"
-	depends on MSM_CAMERA
-	---help---
-	  Support for IMX135 sensor driver.
-	  This is a Sony 13MP Bayer Sensor with autofocus and video HDR
-	  support.
-	  Say Y if the platform uses IMX135 sensor.
-
-config OV9724
-	bool "Sensor ov9724 (Omnivision 1.3M)"
-	depends on MSM_CAMERA
-	---help---
-	  Support for OV9724 sensor driver.
-	  It is a Bayer 1.3MP sensor with auto focus and it supports
-	  two mipi lanes, required for msm8625 platform.
-	  Say Y here if this is msm8625 variant platform.
-
 config VB6801
 	bool "Sensor vb6801"
 	depends on MSM_CAMERA && !ARCH_MSM8X60 && !MSM_CAMERA_V4L2
@@ -247,18 +257,6 @@
 	bool "Qualcomm MSM actuator support"
 	depends on MSM_CAMERA
 
-config MSM_EEPROM
-	bool "Qualcomm MSM EEPROM support"
-	depends on MSM_CAMERA
-
-config IMX074_EEPROM
-	bool "IMX074 EEPROM support"
-	depends on MSM_CAMERA
-
-config IMX091_EEPROM
-	bool "IMX091 EEPROM support"
-	depends on MSM_CAMERA
-
 config MSM_GEMINI
 	tristate "Qualcomm MSM Gemini Jpeg Engine support"
 	depends on MSM_CAMERA && (ARCH_MSM7X30 || ARCH_MSM8X60 || ARCH_MSM8960)
@@ -266,21 +264,6 @@
 	---help---
 	  Enable support for Gemini Jpeg Engine
 
-config MSM_MERCURY
-        tristate "Qualcomm MSM Mercury Jpeg Decoder Engine support"
-        depends on MSM_CAMERA && ARCH_MSM8960
-        ---help---
-          Enable support for Mercury Jpeg Engine
-
-config MSM_JPEG
-	tristate "Qualcomm MSM Jpeg Encoder Engine support"
-	depends on MSM_CAMERA && ARCH_MSM8974
-	---help---
-          Enable support for Jpeg Encoder/Decoder
-	  Engine for 8974.
-	  This module serves as the common driver
-	  for the JPEG 1.0 encoder and decoder.
-
 config MSM_VPE
 	tristate "Qualcomm MSM Video Pre-processing Engine support"
 	depends on MSM_CAMERA && (ARCH_MSM7X30 || ARCH_MSM8X60)
@@ -288,34 +271,12 @@
 	---help---
 	  Enable support for Video Pre-processing Engine
 
-config MSM_CAM_IRQ_ROUTER
-	bool "Enable MSM CAM IRQ Router"
+config RAWCHIP
+	bool "Rawchip"
 	depends on MSM_CAMERA
+	default n
 	---help---
-	Enable IRQ Router for Camera. Depending on the
-	configuration, this module can handle the
-	interrupts from multiple camera hardware
-	cores and composite them into a single
-	interrupt to the MSM.
-
-config MSM_CPP
-        bool "Qualcomm MSM Camera Post Processing Engine support"
-        depends on MSM_CAMERA && MSM_CAMERA_V4L2
-        ---help---
-          Enable support for Camera Post-processing Engine
-          The Post processing engine is capable of scaling
-          and cropping image. The driver support V4L2 subdev
-          APIs.
-
-config MSM_CCI
-        bool "Qualcomm MSM Camera Control Interface support"
-        depends on MSM_CAMERA
-        ---help---
-          Enable support for Camera Control Interface driver only
-          for those platforms that have hardware support. This driver
-          is responsible for handling I2C read and write on the I2C
-          bus. It is also responsible for synchronization with
-          GPIO and data frames.
+	  ST Yushan rawchip
 
 config QUP_EXCLUSIVE_TO_CAMERA
 	bool "QUP exclusive to camera"
@@ -328,63 +289,6 @@
 	  by QUP in the board file as QUP is used by
 	  applications other than camera.
 
-config MSM_CSI20_HEADER
-        bool "Qualcomm MSM CSI 2.0 Header"
-        depends on MSM_CAMERA
-        ---help---
-          Enable support for CSI drivers to include 2.0
-          header. This header has register macros and its
-          values and bit mask for register configuration bits
-          This config macro is required targets based on 8960,
-          8930 and 8064 platforms.
-
-config MSM_CSI30_HEADER
-        bool "Qualcomm MSM CSI 3.0 Header"
-        depends on MSM_CAMERA
-        ---help---
-          Enable support for CSI drivers to include 3.0
-          header. This header has register macros and its
-          values and bit mask for register configuration bits
-          This config macro is required for targets based on
-          8064 platforms.
-
-config MSM_CSIPHY
-        bool "Qualcomm MSM Camera Serial Interface Physical receiver support"
-        depends on MSM_CAMERA
-        ---help---
-          Enable support for Camera Serial Interface
-          Physical receiver. It deserializes packets and
-          supports detection of packet start and stop
-          signalling.
-
-config MSM_CSID
-        bool "Qualcomm MSM Camera Serial Interface decoder support"
-        depends on MSM_CAMERA
-        ---help---
-          Enable support for Camera Serial Interface decoder.
-          It supports lane merging and decoding of packets
-          based on cid which is mapped to a virtual channel
-          and datatype.
-
-config MSM_CSI2_REGISTER
-        bool "Qualcomm MSM CSI2 Register"
-        depends on MSM_CAMERA
-        ---help---
-          Register CSIPHY, CSID and ISPIF subdevices during
-          msm_open. Different CSI components are registered
-          based on platform. This macro specifies registering
-          of CSIPHY, CSID and ISPIF subdevices to receive data
-          from sensor.
-
-config MSM_ISPIF
-        bool "Qualcomm MSM Image Signal Processing interface support"
-        depends on MSM_CAMERA
-        ---help---
-          Enable support for Image Signal Processing interface module.
-          This module acts as a crossbar between CSID and VFE. Output
-          of any CID of CSID can be routed to of of pixel or raw
-          data interface in VFE.
-
 config S5K3L1YX
 	bool "Sensor S5K3L1YX (BAYER 12M)"
 	depends on MSM_CAMERA
@@ -395,22 +299,103 @@
 		hfr video at 60, 90 and 120 fps.
 
 config IMX091
-        bool "Sensor imx091 (Sony 13MP)"
-        depends on MSM_CAMERA
-	---help---
-	  Sony 13MP sensor back camera that uses 4 mipi lanes,
-	  runs at 30 fps preview and 14 fps snapshot
-
-config MSM_V4L2_VIDEO_OVERLAY_DEVICE
-	tristate "Qualcomm MSM V4l2 video overlay device"
-	---help---
-	  Enables support for the MSM V4L2 video
-	  overlay driver. This allows video rendering
-	  apps to render overlaid video using Video4Linux2
-	  APIs, by using /dev/videoX device
-
-config OV7692
-	bool "Sensor OV7692 (VGA YUV)"
+	bool "Sensor IMX091 (BAYER 13M)"
 	depends on MSM_CAMERA
 	---help---
-	  Omni Vision VGA YUV Sensor
+	SONY 13 MP Bayer Sensor
+
+config IMX105
+	bool "Sensor IMX105 (BAYER 8M)"
+	depends on MSM_CAMERA && (ARCH_MSM8X60 || ARCH_MSM8960)
+	default n
+	---help---
+	SONY 8 MP Bayer Sensor
+
+config IMX175
+	bool "Sensor IMX175 (BAYER 8M)"
+	depends on MSM_CAMERA
+	---help---
+	SONY 8 MP Bayer Sensor
+
+config IMX135
+	bool "Sensor IMX135 (BAYER 13M)"
+	depends on MSM_CAMERA
+	---help---
+	SONY 13 MP Bayer Sensor
+
+config OV8838
+	bool "Sensor OV8838 (OmniVision 8M)"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  Support for OV8838 OmniVision sensor driver.
+	  It is a Bayer 8MP sensor with auto focus and it supports
+	  four mipi lanes and BSI.
+
+config IMX175_ACT
+	bool "Sensor imx175 actuator"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  Autofocus of imx175 actuator
+
+config AD5823_ACT
+       bool "Lens actuator ad5823"
+       depends on MSM_CAMERA
+       ---help---
+         ad5823 lens actuator driver for SONY IMX175 and IMX091.
+
+config AD5816_ACT
+       bool "Lens actuator ad5816"
+       depends on MSM_CAMERA
+       ---help---
+         ad5816 lens actuator driver for SONY IMX175 and IMX091.
+
+config TI201_ACT
+       bool "Lens actuator ti201"
+       depends on MSM_CAMERA
+       ---help---
+         ti201 lens actuator driver for SONY IMX175 and IMX091.
+
+config MT9V113
+	bool "Sensor mt9v113 (VGA YUV)"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  Support for MT9V113 Micron sensor driver.
+	  It is a Bayer 0.3MP sensor it supports two mipi lanes.
+
+config IMX175_2LANE
+	bool "Sensor IMX175 2-Lane(BAYER 8M)"
+	depends on MSM_CAMERA
+	---help---
+	SONY 8 MP Bayer Sensor for 2-lane hardware
+
+config OV5693_ACT
+	bool "Sensor OV5693 actuator"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  Autofocus of ov5693 actuator
+
+config OV5693
+	bool "Sensor ov5693 (BAYER 5M)"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  OV 5M Bayer Sensor with AutoFocus
+
+config RAWCHIP_MCLK
+	bool "Rawchip MCLK"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  ST Yushan rawchip MCLK
+
+config S5K6A2YA
+	bool "Sensor s5k6a2ya (Samsung 1.6M)"
+	depends on MSM_CAMERA
+	default n
+	---help---
+	  Support for S5K6A2YA samsung sensor driver.
+	  It is a Bayer 1.6MP sensor it supports one mipi lanes.
diff --git a/drivers/media/video/msm/Makefile b/drivers/media/video/msm/Makefile
index 5921632..2352088 100644
--- a/drivers/media/video/msm/Makefile
+++ b/drivers/media/video/msm/Makefile
@@ -1,35 +1,30 @@
 GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
+ifeq ($(GCC_VERSION),0404)
+CFLAGS_REMOVE_msm_vfe8x.o = -Wframe-larger-than=1024
+endif
 
-ccflags-y += -Idrivers/media/video/msm/io
-ccflags-y += -Idrivers/media/video/msm/vfe
-obj-$(CONFIG_MSM_CAMERA) += io/
 ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
-  EXTRA_CFLAGS += -Idrivers/media/video/msm/cci
   EXTRA_CFLAGS += -Idrivers/media/video/msm/csi
-  EXTRA_CFLAGS += -Idrivers/media/video/msm/eeprom
+  EXTRA_CFLAGS += -Idrivers/media/video/msm/io
   EXTRA_CFLAGS += -Idrivers/media/video/msm/sensors
-  EXTRA_CFLAGS += -Idrivers/media/video/msm/actuators
-  EXTRA_CFLAGS += -Idrivers/media/video/msm/server
   obj-$(CONFIG_MSM_CAMERA) += msm_isp.o msm.o msm_mem.o msm_mctl.o msm_mctl_buf.o msm_mctl_pp.o
-  obj-$(CONFIG_MSM_CAMERA) += server/
-  obj-$(CONFIG_MSM_CAM_IRQ_ROUTER) += msm_camirq_router.o
-  obj-$(CONFIG_MSM_CAMERA) += cci/ eeprom/ sensors/ actuators/ csi/
-  obj-$(CONFIG_MSM_CPP) += cpp/
+  obj-$(CONFIG_MSM_CAMERA) += rawchip/ io/ sensors/ actuators/ csi/
   obj-$(CONFIG_MSM_CAMERA) += msm_gesture.o
 else
   obj-$(CONFIG_MSM_CAMERA) += msm_camera.o
 endif
-obj-$(CONFIG_MSM_CAMERA) += vfe/
-obj-$(CONFIG_MSM_CAMERA) += msm_axi_qos.o gemini/ mercury/ jpeg_10/
+obj-$(CONFIG_MSM_CAMERA) += msm_axi_qos.o gemini/
 obj-$(CONFIG_MSM_CAMERA_FLASH) += flash.o
+obj-$(CONFIG_ARCH_MSM_ARM11) += msm_vfe7x.o msm_io7x.o
 ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
-  obj-$(CONFIG_ARCH_MSM8X60) += msm_vpe.o
-  obj-$(CONFIG_ARCH_MSM7X30) += msm_vpe.o msm_axi_qos.o
+  obj-$(CONFIG_ARCH_MSM7X27A) += msm_vfe7x27a_v4l2.o msm_io_7x27a_v4l2.o
 else
-  obj-$(CONFIG_ARCH_MSM8X60) += msm_vpe1.o
-  obj-$(CONFIG_ARCH_MSM7X30) += msm_vpe1.o
+  obj-$(CONFIG_ARCH_MSM7X27A) += msm_vfe7x27a.o msm_io_7x27a.o
 endif
-obj-$(CONFIG_ARCH_MSM8960) += msm_vpe.o
+obj-$(CONFIG_ARCH_MSM7X30) += msm_vfe31.o msm_io_vfe31.o msm_vpe1.o
+obj-$(CONFIG_ARCH_QSD8X50) += msm_vfe8x.o msm_vfe8x_proc.o msm_io8x.o
+obj-$(CONFIG_ARCH_MSM8X60) += msm_vfe31.o msm_io_8x60.o msm_vpe1.o
+obj-$(CONFIG_ARCH_MSM8960) += msm_io_8960.o msm_vfe32.o msm_vpe.o
 obj-$(CONFIG_MT9T013) += mt9t013.o mt9t013_reg.o
 obj-$(CONFIG_SN12M0PZ) += sn12m0pz.o sn12m0pz_reg.o
 obj-$(CONFIG_MT9P012) += mt9p012_reg.o
@@ -38,7 +33,9 @@
 obj-$(CONFIG_MT9P012_KM) += mt9p012_km.o mt9p012_km_reg.o
 obj-$(CONFIG_S5K3E2FX) += s5k3e2fx.o
 #FIXME: Merge the two ifeq causes VX6953 preview not coming up.
-ifneq ($(CONFIG_MSM_CAMERA_V4L2),y)
+ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
+  obj-$(CONFIG_VX6953) += vx6953_v4l2.o vx6953_reg_v4l2.o
+else
   obj-$(CONFIG_VX6953) += vx6953.o vx6953_reg.o
   obj-$(CONFIG_IMX074) += imx074.o imx074_reg.o
   obj-$(CONFIG_MT9E013) += mt9e013.o mt9e013_reg.o
@@ -55,4 +52,3 @@
 obj-$(CONFIG_MT9D112) += mt9d112.o mt9d112_reg.o
 
 obj-$(CONFIG_MT9D113) += mt9d113.o mt9d113_reg.o
-obj-$(CONFIG_MSM_V4L2_VIDEO_OVERLAY_DEVICE) += msm_v4l2_video.o
diff --git a/drivers/media/video/msm/actuators/Makefile b/drivers/media/video/msm/actuators/Makefile
index 70a3a19..644dc21 100644
--- a/drivers/media/video/msm/actuators/Makefile
+++ b/drivers/media/video/msm/actuators/Makefile
@@ -2,3 +2,12 @@
 EXTRA_CFLAGS += -Idrivers/media/video/msm
 EXTRA_CFLAGS += -Idrivers/media/video/msm/io
 obj-$(CONFIG_MSM_ACTUATOR) += msm_actuator.o
+obj-$(CONFIG_IMX074_ACT) += imx074_act.o
+obj-$(CONFIG_IMX105_ACT) += imx105_act.o
+obj-$(CONFIG_AD5823_ACT) += ad5823_act.o
+obj-$(CONFIG_AD5816_ACT) += ad5816_act.o
+obj-$(CONFIG_TI201_ACT) += ti201_act.o
+obj-$(CONFIG_S5K3H2YX_ACT) += s5k3h2yx_act.o
+obj-$(CONFIG_DW9712_ACT) += dw9712_act.o
+obj-$(CONFIG_AD5046_ACT) += ad5046_act.o
+obj-$(CONFIG_IMX175_ACT) += imx175_act.o
diff --git a/drivers/media/video/msm/actuators/imx105_act.c b/drivers/media/video/msm/actuators/imx105_act.c
new file mode 100644
index 0000000..cd142e6
--- /dev/null
+++ b/drivers/media/video/msm/actuators/imx105_act.c
@@ -0,0 +1,435 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include "msm_actuator.h"
+#include "msm_camera_i2c.h"
+#include <mach/gpio.h>
+
+#ifdef USE_RAWCHIP_AF
+#define	IMX105_TOTAL_STEPS_NEAR_TO_FAR			128
+#else
+#define	IMX105_TOTAL_STEPS_NEAR_TO_FAR			58
+#endif
+
+
+#define REG_VCM_I2C_ADDR			0x34
+#define REG_VCM_CODE_MSB			0x3403
+#define REG_VCM_CODE_LSB			0x3402
+
+
+
+#define DIV_CEIL(x, y) (x/y + (x%y) ? 1 : 0)
+
+int32_t msm_camera_i2c_write_lens_position(int16_t lens_position);
+
+DEFINE_MUTEX(imx105_act_mutex);
+static struct msm_actuator_ctrl_t imx105_act_t;
+
+static struct region_params_t g_regions[] = {
+	/* step_bound[0] - macro side boundary
+	 * step_bound[1] - infinity side boundary
+	 */
+	/* Region 1 */
+	{
+		.step_bound = {IMX105_TOTAL_STEPS_NEAR_TO_FAR, 0},
+		.code_per_step = 2,
+	},
+};
+
+static uint16_t g_scenario[] = {
+	/* MOVE_NEAR and MOVE_FAR dir*/
+	IMX105_TOTAL_STEPS_NEAR_TO_FAR,
+};
+
+static struct damping_params_t g_damping[] = {
+	/* MOVE_NEAR Dir */
+	/* Scene 1 => Damping params */
+	{
+		.damping_step = 2,
+		.damping_delay = 0,
+	},
+};
+
+static struct damping_t g_damping_params[] = {
+	/* MOVE_NEAR and MOVE_FAR dir */
+	/* Region 1 */
+	{
+		.ringing_params = g_damping,
+	},
+};
+
+static struct msm_actuator_info *imx105_msm_actuator_info;
+
+static int32_t imx105_poweron_af(void)
+{
+	int32_t rc = 0;
+	pr_info("%s enable AF actuator, gpio = %d : E\n", __func__,
+			imx105_msm_actuator_info->vcm_pwd);
+	mdelay(1);
+	rc = gpio_request(imx105_msm_actuator_info->vcm_pwd, "imx105");
+	if (!rc)
+		gpio_direction_output(imx105_msm_actuator_info->vcm_pwd, 1);
+	else
+		pr_err("%s: AF PowerON gpio_request failed %d\n", __func__, rc);
+	gpio_free(imx105_msm_actuator_info->vcm_pwd);
+	mdelay(1);
+
+	pr_info("%s enable AF actuator, gpio = %d : X\n", __func__,
+			imx105_msm_actuator_info->vcm_pwd);	
+	return rc;
+}
+
+static void imx105_poweroff_af(void)
+{
+	int32_t rc = 0;
+
+	pr_info("%s disable AF actuator, gpio = %d\n", __func__,
+			imx105_msm_actuator_info->vcm_pwd);
+
+	msleep(1);
+	rc = gpio_request(imx105_msm_actuator_info->vcm_pwd, "imx105");
+	if (!rc)
+		gpio_direction_output(imx105_msm_actuator_info->vcm_pwd, 0);
+	else
+		pr_err("%s: AF PowerOFF gpio_request failed %d\n", __func__, rc);
+	gpio_free(imx105_msm_actuator_info->vcm_pwd);
+	msleep(1);
+}
+
+int32_t imx105_msm_actuator_init_table(
+		struct msm_actuator_ctrl_t *a_ctrl)
+{
+	int32_t rc = 0;
+
+	pr_info("%s called\n", __func__);
+
+	if (a_ctrl->func_tbl.actuator_set_params)
+		a_ctrl->func_tbl.actuator_set_params(a_ctrl);
+
+	if (imx105_act_t.step_position_table) {
+		pr_info("%s table inited\n", __func__);
+		return rc;
+	}
+
+	/* Fill step position table */
+	if (a_ctrl->step_position_table != NULL) {
+		kfree(a_ctrl->step_position_table);
+		a_ctrl->step_position_table = NULL;
+	}
+	a_ctrl->step_position_table =
+		kmalloc(sizeof(uint16_t) * (a_ctrl->set_info.total_steps + 1),
+				GFP_KERNEL);
+
+	if (a_ctrl->step_position_table != NULL) {
+		uint16_t i = 0;
+		uint16_t imx105_nl_region_boundary1 = 3;
+		uint16_t imx105_nl_region_code_per_step1 = 48;
+		uint16_t imx105_nl_region_boundary2 = 5;
+		uint16_t imx105_nl_region_code_per_step2 = 12;
+		uint16_t imx105_l_region_code_per_step = 16;
+		uint16_t imx105_max_value = 1023;
+
+		a_ctrl->step_position_table[0] = a_ctrl->initial_code;
+		for (i = 1; i <= a_ctrl->set_info.total_steps; i++){
+#ifdef USE_RAWCHIP_AF
+			if (imx105_msm_actuator_info->use_rawchip_af)
+				a_ctrl->step_position_table[i] =
+					a_ctrl->step_position_table[i-1] + 4;
+			else
+#endif
+			{
+				if (i <= imx105_nl_region_boundary1) {
+					a_ctrl->step_position_table[i] =
+						a_ctrl->step_position_table[i-1]
+						+ imx105_nl_region_code_per_step1;
+				} else if (i <= imx105_nl_region_boundary2) {
+					a_ctrl->step_position_table[i] =
+						a_ctrl->step_position_table[i-1]
+						+ imx105_nl_region_code_per_step2;
+				} else {
+					a_ctrl->step_position_table[i] =
+						a_ctrl->step_position_table[i-1]
+						+ imx105_l_region_code_per_step;
+				}
+
+				if (a_ctrl->step_position_table[i] > imx105_max_value)
+					a_ctrl->step_position_table[i] = imx105_max_value;
+
+				/*pr_info("%s step_position_table[%d] = %d\n", __func__,i,a_ctrl->step_position_table[i]);*/
+			}
+		}
+		a_ctrl->curr_step_pos = 0;
+		a_ctrl->curr_region_index = 0;
+	} else {
+		pr_err("%s table init failed\n", __func__);
+		rc = -EFAULT;
+	}
+
+	return rc;
+}
+
+int32_t imx105_msm_actuator_move_focus(
+		struct msm_actuator_ctrl_t *a_ctrl,
+		int dir,
+		int32_t num_steps)
+{
+	int32_t rc = 0;
+	int8_t sign_dir = 0;
+	int16_t dest_step_pos = 0;
+
+	pr_info("%s called, dir %d, num_steps %d\n",
+			__func__,
+			dir,
+			num_steps);
+
+	/* Determine sign direction */
+	if (dir == MOVE_NEAR){
+		sign_dir = 1;
+		pr_info("%s MOVE_NEAR\n",
+				__func__);
+	}
+	else if (dir == MOVE_FAR){
+		sign_dir = -1;
+		pr_info("%s MOVE_FAR\n",
+				__func__);
+	}
+	else {
+		pr_err("Illegal focus direction\n");
+		rc = -EINVAL;
+		return rc;
+	}
+
+	/* Determine destination step position */
+	dest_step_pos = a_ctrl->curr_step_pos +
+		(sign_dir * num_steps);
+
+	if (dest_step_pos < 0)
+		dest_step_pos = 0;
+	else if (dest_step_pos > a_ctrl->set_info.total_steps)
+		dest_step_pos = a_ctrl->set_info.total_steps;
+
+	if (dest_step_pos == a_ctrl->curr_step_pos)
+		return rc;
+
+	rc = a_ctrl->func_tbl.actuator_i2c_write(a_ctrl,
+			a_ctrl->step_position_table[dest_step_pos], NULL);
+	if (rc < 0) {
+		pr_err("%s focus move failed\n", __func__);
+		return rc;
+	} else {
+		a_ctrl->curr_step_pos = dest_step_pos;
+		pr_info("%s current step: %d\n", __func__, a_ctrl->curr_step_pos);
+	}
+
+	return rc;
+}
+
+int imx105_actuator_af_power_down(void *params)
+{
+	int rc = 0;
+	pr_info("%s called\n", __func__);
+
+	rc = (int) msm_actuator_af_power_down(&imx105_act_t);
+	imx105_poweroff_af();
+	return rc;
+}
+
+static int32_t imx105_wrapper_i2c_write(struct msm_actuator_ctrl_t *a_ctrl, int16_t next_lens_position, void *params)
+{
+	int32_t rc = 0;
+
+
+	pr_info("%s next_lens_position : %d\n", __func__, next_lens_position);
+
+	rc = msm_camera_i2c_write_lens_position(next_lens_position);
+
+	return rc;
+}
+
+int32_t imx105_act_write_focus(
+		struct msm_actuator_ctrl_t *a_ctrl,
+		uint16_t curr_lens_pos,
+		struct damping_params_t *damping_params,
+		int8_t sign_direction,
+		int16_t code_boundary)
+{
+	int32_t rc = 0;
+	uint16_t dac_value = 0;
+	/*
+	   pr_info("%s called, curr lens pos = %d, code_boundary = %d\n",
+	   __func__,
+	   curr_lens_pos,
+	   code_boundary);
+	   */
+	if (sign_direction == 1)
+		dac_value = (code_boundary - curr_lens_pos);
+	else
+		dac_value = (curr_lens_pos - code_boundary);
+	/*
+	   pr_info("%s dac_value = %d\n",
+	   __func__,
+	   dac_value);
+	   */
+	rc = a_ctrl->func_tbl.actuator_i2c_write(a_ctrl, dac_value, NULL);
+
+	return rc;
+}
+
+static int32_t imx105_act_init_focus(struct msm_actuator_ctrl_t *a_ctrl)
+{
+	int32_t rc = 0;
+
+	rc = a_ctrl->func_tbl.actuator_i2c_write(a_ctrl, a_ctrl->initial_code,
+			NULL);
+	if (rc < 0)
+		pr_err("%s i2c write failed\n", __func__);
+	else
+		a_ctrl->curr_step_pos = 0;
+
+	return rc;
+}
+
+static const struct i2c_device_id imx105_act_i2c_id[] = {
+	{"imx105_act", (kernel_ulong_t)&imx105_act_t},
+	{ }
+};
+
+static int imx105_act_config(
+		void __user *argp)
+{
+	pr_info("%s called\n", __func__);
+	return (int) msm_actuator_config(&imx105_act_t,
+			imx105_msm_actuator_info, argp); /* HTC Angie 20111212 - Rawchip */
+}
+
+static int imx105_i2c_add_driver_table(
+		void)
+{
+	int32_t rc = 0;
+
+	pr_info("%s called\n", __func__);
+
+	rc = imx105_poweron_af();
+	if (rc < 0) {
+		pr_err("%s power on failed\n", __func__);
+		return (int) rc;
+	}
+	imx105_act_t.step_position_table = NULL;
+	rc = imx105_act_t.func_tbl.actuator_init_table(&imx105_act_t);
+	if (rc < 0) {
+		pr_err("%s init table failed\n", __func__);
+		return (int) rc;
+	}
+
+	return (int) rc;
+}
+
+static struct i2c_driver imx105_act_i2c_driver = {
+	.id_table = imx105_act_i2c_id,
+	.probe  = msm_actuator_i2c_probe,
+	.remove = __exit_p(imx105_act_i2c_remove),
+	.driver = {
+		.name = "imx105_act",
+	},
+};
+
+static int __init imx105_i2c_add_driver(void)
+{
+	pr_info("%s called\n", __func__);
+	return i2c_add_driver(imx105_act_t.i2c_driver);
+}
+
+static struct v4l2_subdev_core_ops imx105_act_subdev_core_ops;
+
+static struct v4l2_subdev_ops imx105_act_subdev_ops = {
+	.core = &imx105_act_subdev_core_ops,
+};
+
+static int32_t imx105_act_create_subdevice(
+		void *board_info,
+		void *sdev)
+{
+	pr_info("%s called\n", __func__);
+
+	imx105_msm_actuator_info = (struct msm_actuator_info *)board_info;
+
+	return (int) msm_actuator_create_subdevice(&imx105_act_t,
+			imx105_msm_actuator_info->board_info,
+			(struct v4l2_subdev *)sdev);
+}
+
+static struct msm_actuator_ctrl_t imx105_act_t = {
+	.i2c_driver = &imx105_act_i2c_driver,
+	.i2c_addr = REG_VCM_I2C_ADDR,
+	.act_v4l2_subdev_ops = &imx105_act_subdev_ops,
+	.actuator_ext_ctrl = {
+		.a_init_table = imx105_i2c_add_driver_table,
+		.a_power_down = imx105_actuator_af_power_down,
+		.a_create_subdevice = imx105_act_create_subdevice,
+		.a_config = imx105_act_config,
+	},
+
+	.i2c_client = {
+		.addr_type = MSM_CAMERA_I2C_BYTE_ADDR,
+	},
+
+	.set_info = {
+		.total_steps = IMX105_TOTAL_STEPS_NEAR_TO_FAR,		
+		.gross_steps = 3,	/*[TBD]*/
+		.fine_steps = 1,	/*[TBD]*/
+
+	},
+
+	.curr_step_pos = 0,
+	.curr_region_index = 0,
+	.initial_code = 0,	/*[TBD]*/
+	.actuator_mutex = &imx105_act_mutex,
+
+	.func_tbl = {
+		.actuator_init_table = imx105_msm_actuator_init_table,
+		.actuator_move_focus = imx105_msm_actuator_move_focus,
+		.actuator_write_focus = imx105_act_write_focus,
+		.actuator_set_default_focus = msm_actuator_set_default_focus,
+		.actuator_init_focus = imx105_act_init_focus,
+		.actuator_i2c_write = imx105_wrapper_i2c_write,
+	},
+
+	.get_info = {
+		.focal_length_num = 46,
+		.focal_length_den = 10,
+		.f_number_num = 265,
+		.f_number_den = 100,
+		.f_pix_num = 14,
+		.f_pix_den = 10,
+		.total_f_dist_num = 197681,
+		.total_f_dist_den = 1000,
+	},
+
+	/* Initialize scenario */
+	.ringing_scenario[MOVE_NEAR] = g_scenario,
+	.scenario_size[MOVE_NEAR] = ARRAY_SIZE(g_scenario),
+	.ringing_scenario[MOVE_FAR] = g_scenario,
+	.scenario_size[MOVE_FAR] = ARRAY_SIZE(g_scenario),
+
+	/* Initialize region params */
+	.region_params = g_regions,
+	.region_size = ARRAY_SIZE(g_regions),
+
+	/* Initialize damping params */
+	.damping[MOVE_NEAR] = g_damping_params,
+	.damping[MOVE_FAR] = g_damping_params,
+};
+subsys_initcall(imx105_i2c_add_driver);
+
+MODULE_DESCRIPTION("imx105 actuator");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/actuators/imx175_act.c b/drivers/media/video/msm/actuators/imx175_act.c
new file mode 100644
index 0000000..33fabd7
--- /dev/null
+++ b/drivers/media/video/msm/actuators/imx175_act.c
@@ -0,0 +1,437 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include "msm_actuator.h"
+#include "msm_camera_i2c.h"
+#include <mach/gpio.h>
+
+#ifdef USE_RAWCHIP_AF
+#define	IMX175_TOTAL_STEPS_NEAR_TO_FAR			256
+#else
+#define	IMX175_TOTAL_STEPS_NEAR_TO_FAR			52
+#endif
+
+#define REG_VCM_NEW_CODE			0x30F2
+#define REG_VCM_I2C_ADDR			0x18
+#define REG_VCM_CODE_MSB			0x04
+#define REG_VCM_CODE_LSB			0x05
+#define REG_VCM_THRES_MSB			0x06
+#define REG_VCM_THRES_LSB			0x07
+#define REG_VCM_RING_CTRL			0x400
+
+#define DIV_CEIL(x, y) (x/y + (x%y) ? 1 : 0)
+
+DEFINE_MUTEX(imx175_act_mutex);
+static struct msm_actuator_ctrl_t imx175_act_t;
+
+static struct region_params_t g_regions[] = {
+	
+	{
+		.step_bound = {IMX175_TOTAL_STEPS_NEAR_TO_FAR, 0},
+		.code_per_step = 2,
+	},
+};
+
+static uint16_t g_scenario[] = {
+	
+	IMX175_TOTAL_STEPS_NEAR_TO_FAR,
+};
+
+static struct damping_params_t g_damping[] = {
+	
+	
+	{
+		.damping_step = 2,
+		.damping_delay = 0,
+	},
+};
+
+static struct damping_t g_damping_params[] = {
+	
+	
+	{
+		.ringing_params = g_damping,
+	},
+};
+
+static struct msm_actuator_info *imx175_msm_actuator_info;
+
+static int32_t imx175_poweron_af(void)
+{
+	int32_t rc = 0;
+	pr_info("%s enable AF actuator, gpio = %d\n", __func__,
+			imx175_msm_actuator_info->vcm_pwd);
+	mdelay(1);
+	rc = gpio_request(imx175_msm_actuator_info->vcm_pwd, "imx175");
+	if (!rc)
+		gpio_direction_output(imx175_msm_actuator_info->vcm_pwd, 1);
+	else
+		pr_err("%s: AF PowerON gpio_request failed %d\n", __func__, rc);
+	gpio_free(imx175_msm_actuator_info->vcm_pwd);
+	mdelay(1);
+	return rc;
+}
+
+static void imx175_poweroff_af(void)
+{
+	int32_t rc = 0;
+
+	pr_info("%s disable AF actuator, gpio = %d\n", __func__,
+			imx175_msm_actuator_info->vcm_pwd);
+
+	msleep(1);
+	rc = gpio_request(imx175_msm_actuator_info->vcm_pwd, "imx175");
+	if (!rc)
+		gpio_direction_output(imx175_msm_actuator_info->vcm_pwd, 0);
+	else
+		pr_err("%s: AF PowerOFF gpio_request failed %d\n", __func__, rc);
+	gpio_free(imx175_msm_actuator_info->vcm_pwd);
+	msleep(1);
+}
+
+int32_t imx175_msm_actuator_init_table(
+	struct msm_actuator_ctrl_t *a_ctrl)
+{
+	int32_t rc = 0;
+
+	LINFO("%s called\n", __func__);
+
+	if (a_ctrl->func_tbl.actuator_set_params)
+		a_ctrl->func_tbl.actuator_set_params(a_ctrl);
+
+	if (imx175_act_t.step_position_table) {
+		LINFO("%s table inited\n", __func__);
+		return rc;
+	}
+
+	
+	if (a_ctrl->step_position_table != NULL) {
+		kfree(a_ctrl->step_position_table);
+		a_ctrl->step_position_table = NULL;
+	}
+	a_ctrl->step_position_table =
+		kmalloc(sizeof(uint16_t) * (a_ctrl->set_info.total_steps + 1),
+			GFP_KERNEL);
+
+	if (a_ctrl->step_position_table != NULL) {
+		uint16_t i = 0;
+		uint16_t imx175_nl_region_boundary1 = 2;
+		uint16_t imx175_nl_region_code_per_step1 = 32;
+		uint16_t imx175_l_region_code_per_step = 16;
+		uint16_t imx175_max_value = 1023;
+
+		a_ctrl->step_position_table[0] = a_ctrl->initial_code;
+		for (i = 1; i <= a_ctrl->set_info.total_steps; i++) {
+#ifdef USE_RAWCHIP_AF
+			if (imx175_msm_actuator_info->use_rawchip_af)
+				a_ctrl->step_position_table[i] =
+					a_ctrl->step_position_table[i-1] + 4;
+			else
+#endif
+			{
+			if (i <= imx175_nl_region_boundary1) {
+				a_ctrl->step_position_table[i] =
+					a_ctrl->step_position_table[i-1]
+					+ imx175_nl_region_code_per_step1;
+			} else {
+				a_ctrl->step_position_table[i] =
+					a_ctrl->step_position_table[i-1]
+					+ imx175_l_region_code_per_step;
+			}
+
+			if (a_ctrl->step_position_table[i] > imx175_max_value)
+				a_ctrl->step_position_table[i] = imx175_max_value;
+			}
+		}
+		a_ctrl->curr_step_pos = 0;
+		a_ctrl->curr_region_index = 0;
+	} else {
+		pr_err("%s table init failed\n", __func__);
+		rc = -EFAULT;
+	}
+
+	return rc;
+}
+
+int32_t imx175_msm_actuator_move_focus(
+	struct msm_actuator_ctrl_t *a_ctrl,
+	int dir,
+	int32_t num_steps)
+{
+	int32_t rc = 0;
+	int8_t sign_dir = 0;
+	int16_t dest_step_pos = 0;
+
+	LINFO("%s called, dir %d, num_steps %d\n",
+		__func__,
+		dir,
+		num_steps);
+
+	
+	if (dir == MOVE_NEAR)
+		sign_dir = 1;
+	else if (dir == MOVE_FAR)
+		sign_dir = -1;
+	else {
+		pr_err("Illegal focus direction\n");
+		rc = -EINVAL;
+		return rc;
+	}
+
+	
+	dest_step_pos = a_ctrl->curr_step_pos +
+		(sign_dir * num_steps);
+
+	if (dest_step_pos < 0)
+		dest_step_pos = 0;
+	else if (dest_step_pos > a_ctrl->set_info.total_steps)
+		dest_step_pos = a_ctrl->set_info.total_steps;
+
+	if (dest_step_pos == a_ctrl->curr_step_pos)
+		return rc;
+
+	rc = a_ctrl->func_tbl.actuator_i2c_write(a_ctrl,
+		a_ctrl->step_position_table[dest_step_pos], NULL);
+	if (rc < 0) {
+		pr_err("%s focus move failed\n", __func__);
+		return rc;
+	} else {
+		a_ctrl->curr_step_pos = dest_step_pos;
+		LINFO("%s current step: %d\n", __func__, a_ctrl->curr_step_pos);
+	}
+
+	return rc;
+}
+
+int imx175_actuator_af_power_down(void *params)
+{
+	int rc = 0;
+	LINFO("%s called\n", __func__);
+
+	rc = (int) msm_actuator_af_power_down(&imx175_act_t);
+	imx175_poweroff_af();
+	return rc;
+}
+
+static int32_t imx175_wrapper_i2c_write(struct msm_actuator_ctrl_t *a_ctrl,
+	int16_t next_lens_position, void *params)
+{
+	int32_t rc = 0;
+
+	rc = msm_camera_i2c_write(&a_ctrl->i2c_client,
+		REG_VCM_CODE_MSB,
+		((next_lens_position & 0x0300) >> 8),
+		MSM_CAMERA_I2C_BYTE_DATA);
+	if (rc < 0) {
+		pr_err("%s VCM_CODE_MSB i2c write failed (%d)\n", __func__, rc);
+		return rc;
+	}
+
+	rc = msm_camera_i2c_write(&a_ctrl->i2c_client,
+		REG_VCM_CODE_LSB,
+		(next_lens_position & 0x00FF),
+		MSM_CAMERA_I2C_BYTE_DATA);
+	if (rc < 0) {
+		pr_err("%s VCM_CODE_LSB i2c write failed (%d)\n", __func__, rc);
+		return rc;
+	}
+
+	return rc;
+}
+
+int32_t imx175_act_write_focus(
+	struct msm_actuator_ctrl_t *a_ctrl,
+	uint16_t curr_lens_pos,
+	struct damping_params_t *damping_params,
+	int8_t sign_direction,
+	int16_t code_boundary)
+{
+	int32_t rc = 0;
+	uint16_t dac_value = 0;
+
+	LINFO("%s called, curr lens pos = %d, code_boundary = %d\n",
+		  __func__,
+		  curr_lens_pos,
+		  code_boundary);
+
+	if (sign_direction == 1)
+		dac_value = (code_boundary - curr_lens_pos);
+	else
+		dac_value = (curr_lens_pos - code_boundary);
+
+	LINFO("%s dac_value = %d\n",
+		  __func__,
+		  dac_value);
+
+	rc = a_ctrl->func_tbl.actuator_i2c_write(a_ctrl, dac_value, NULL);
+
+	return rc;
+}
+
+static int32_t imx175_act_init_focus(struct msm_actuator_ctrl_t *a_ctrl)
+{
+	int32_t rc = 0;
+
+	rc = a_ctrl->func_tbl.actuator_i2c_write(a_ctrl, a_ctrl->initial_code,
+		NULL);
+	if (rc < 0)
+		pr_err("%s i2c write failed\n", __func__);
+	else
+		a_ctrl->curr_step_pos = 0;
+
+	return rc;
+}
+
+static const struct i2c_device_id imx175_act_i2c_id[] = {
+	{"imx175_act", (kernel_ulong_t)&imx175_act_t},
+	{ }
+};
+
+static int imx175_act_config(
+	void __user *argp)
+{
+	LINFO("%s called\n", __func__);
+	return (int) msm_actuator_config(&imx175_act_t,
+		imx175_msm_actuator_info, argp); 
+}
+
+static int imx175_i2c_add_driver_table(
+	void)
+{
+	int32_t rc = 0;
+
+	LINFO("%s called\n", __func__);
+
+	rc = imx175_poweron_af();
+	if (rc < 0) {
+		pr_err("%s power on failed\n", __func__);
+		return (int) rc;
+	}
+
+	imx175_act_t.step_position_table = NULL;
+	rc = imx175_act_t.func_tbl.actuator_init_table(&imx175_act_t);
+	if (rc < 0) {
+		pr_err("%s init table failed\n", __func__);
+		return (int) rc;
+	}
+
+	rc = msm_camera_i2c_write(&(imx175_act_t.i2c_client),
+		0x0001, 0x01,
+		MSM_CAMERA_I2C_BYTE_DATA);
+	if (rc < 0) {
+		pr_err("%s i2c write failed\n", __func__);
+		return (int) rc;
+	}
+
+	return (int) rc;
+}
+
+static struct i2c_driver imx175_act_i2c_driver = {
+	.id_table = imx175_act_i2c_id,
+	.probe  = msm_actuator_i2c_probe,
+	.remove = __exit_p(imx175_act_i2c_remove),
+	.driver = {
+		.name = "imx175_act",
+	},
+};
+
+static int __init imx175_i2c_add_driver(
+	void)
+{
+	LINFO("%s called\n", __func__);
+	return i2c_add_driver(imx175_act_t.i2c_driver);
+}
+
+static struct v4l2_subdev_core_ops imx175_act_subdev_core_ops;
+
+static struct v4l2_subdev_ops imx175_act_subdev_ops = {
+	.core = &imx175_act_subdev_core_ops,
+};
+
+static int32_t imx175_act_create_subdevice(
+	void *board_info,
+	void *sdev)
+{
+	LINFO("%s called\n", __func__);
+
+	imx175_msm_actuator_info = (struct msm_actuator_info *)board_info;
+
+	return (int) msm_actuator_create_subdevice(&imx175_act_t,
+		imx175_msm_actuator_info->board_info,
+		(struct v4l2_subdev *)sdev);
+}
+
+static struct msm_actuator_ctrl_t imx175_act_t = {
+	.i2c_driver = &imx175_act_i2c_driver,
+	.i2c_addr = REG_VCM_I2C_ADDR,
+	.act_v4l2_subdev_ops = &imx175_act_subdev_ops,
+	.actuator_ext_ctrl = {
+		.a_init_table = imx175_i2c_add_driver_table,
+		.a_power_down = imx175_actuator_af_power_down,
+		.a_create_subdevice = imx175_act_create_subdevice,
+		.a_config = imx175_act_config,
+	},
+
+	.i2c_client = {
+		.addr_type = MSM_CAMERA_I2C_BYTE_ADDR,
+	},
+
+	.set_info = {
+		.total_steps = IMX175_TOTAL_STEPS_NEAR_TO_FAR,
+		.gross_steps = 3,	
+		.fine_steps = 1,	
+	},
+
+	.curr_step_pos = 0,
+	.curr_region_index = 0,
+	.initial_code = 0,	
+	.actuator_mutex = &imx175_act_mutex,
+
+	.func_tbl = {
+		.actuator_init_table = imx175_msm_actuator_init_table,
+		.actuator_move_focus = imx175_msm_actuator_move_focus,
+		.actuator_write_focus = imx175_act_write_focus,
+		.actuator_set_default_focus = msm_actuator_set_default_focus,
+		.actuator_init_focus = imx175_act_init_focus,
+		.actuator_i2c_write = imx175_wrapper_i2c_write,
+	},
+
+	.get_info = {	
+		.focal_length_num = 46,
+		.focal_length_den = 10,
+		.f_number_num = 265,
+		.f_number_den = 100,
+		.f_pix_num = 14,
+		.f_pix_den = 10,
+		.total_f_dist_num = 197681,
+		.total_f_dist_den = 1000,
+	},
+
+	
+	.ringing_scenario[MOVE_NEAR] = g_scenario,
+	.scenario_size[MOVE_NEAR] = ARRAY_SIZE(g_scenario),
+	.ringing_scenario[MOVE_FAR] = g_scenario,
+	.scenario_size[MOVE_FAR] = ARRAY_SIZE(g_scenario),
+
+	
+	.region_params = g_regions,
+	.region_size = ARRAY_SIZE(g_regions),
+
+	
+	.damping[MOVE_NEAR] = g_damping_params,
+	.damping[MOVE_FAR] = g_damping_params,
+};
+
+subsys_initcall(imx175_i2c_add_driver);
+MODULE_DESCRIPTION("IMX175 actuator");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/actuators/msm_actuator.c b/drivers/media/video/msm/actuators/msm_actuator.c
index f666e20..9468b0a 100644
--- a/drivers/media/video/msm/actuators/msm_actuator.c
+++ b/drivers/media/video/msm/actuators/msm_actuator.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -10,137 +10,9 @@
  * GNU General Public License for more details.
  */
 
-#include <linux/module.h>
 #include "msm_actuator.h"
 
-static struct msm_actuator_ctrl_t msm_actuator_t;
-static struct msm_actuator msm_vcm_actuator_table;
-static struct msm_actuator msm_piezo_actuator_table;
-
-static struct msm_actuator *actuators[] = {
-	&msm_vcm_actuator_table,
-	&msm_piezo_actuator_table,
-};
-
-static int32_t msm_actuator_piezo_set_default_focus(
-	struct msm_actuator_ctrl_t *a_ctrl,
-	struct msm_actuator_move_params_t *move_params)
-{
-	int32_t rc = 0;
-
-	if (a_ctrl->curr_step_pos != 0) {
-		a_ctrl->i2c_tbl_index = 0;
-		rc = a_ctrl->func_tbl->actuator_parse_i2c_params(a_ctrl,
-			a_ctrl->initial_code, 0, 0);
-		rc = a_ctrl->func_tbl->actuator_parse_i2c_params(a_ctrl,
-			a_ctrl->initial_code, 0, 0);
-		rc = msm_camera_i2c_write_table_w_microdelay(
-			&a_ctrl->i2c_client, a_ctrl->i2c_reg_tbl,
-			a_ctrl->i2c_tbl_index, a_ctrl->i2c_data_type);
-		if (rc < 0) {
-			pr_err("%s: i2c write error:%d\n",
-				__func__, rc);
-			return rc;
-		}
-		a_ctrl->i2c_tbl_index = 0;
-		a_ctrl->curr_step_pos = 0;
-	}
-	return rc;
-}
-
-static int32_t msm_actuator_parse_i2c_params(struct msm_actuator_ctrl_t *a_ctrl,
-	int16_t next_lens_position, uint32_t hw_params, uint16_t delay)
-{
-	struct msm_actuator_reg_params_t *write_arr = a_ctrl->reg_tbl;
-	uint32_t hw_dword = hw_params;
-	uint16_t i2c_byte1 = 0, i2c_byte2 = 0;
-	uint16_t value = 0;
-	uint32_t size = a_ctrl->reg_tbl_size, i = 0;
-	int32_t rc = 0;
-	struct msm_camera_i2c_reg_tbl *i2c_tbl = a_ctrl->i2c_reg_tbl;
-	CDBG("%s: IN\n", __func__);
-	for (i = 0; i < size; i++) {
-		if (write_arr[i].reg_write_type == MSM_ACTUATOR_WRITE_DAC) {
-			value = (next_lens_position <<
-				write_arr[i].data_shift) |
-				((hw_dword & write_arr[i].hw_mask) >>
-				write_arr[i].hw_shift);
-
-			if (write_arr[i].reg_addr != 0xFFFF) {
-				i2c_byte1 = write_arr[i].reg_addr;
-				i2c_byte2 = value;
-				if (size != (i+1)) {
-					i2c_byte2 = value & 0xFF;
-					CDBG("%s: byte1:0x%x, byte2:0x%x\n",
-					__func__, i2c_byte1, i2c_byte2);
-					i2c_tbl[a_ctrl->i2c_tbl_index].
-						reg_addr = i2c_byte1;
-					i2c_tbl[a_ctrl->i2c_tbl_index].
-						reg_data = i2c_byte2;
-					i2c_tbl[a_ctrl->i2c_tbl_index].
-						delay = 0;
-					a_ctrl->i2c_tbl_index++;
-					i++;
-					i2c_byte1 = write_arr[i].reg_addr;
-					i2c_byte2 = (value & 0xFF00) >> 8;
-				}
-			} else {
-				i2c_byte1 = (value & 0xFF00) >> 8;
-				i2c_byte2 = value & 0xFF;
-			}
-		} else {
-			i2c_byte1 = write_arr[i].reg_addr;
-			i2c_byte2 = (hw_dword & write_arr[i].hw_mask) >>
-				write_arr[i].hw_shift;
-		}
-		CDBG("%s: i2c_byte1:0x%x, i2c_byte2:0x%x\n", __func__,
-			i2c_byte1, i2c_byte2);
-		i2c_tbl[a_ctrl->i2c_tbl_index].reg_addr = i2c_byte1;
-		i2c_tbl[a_ctrl->i2c_tbl_index].reg_data = i2c_byte2;
-		i2c_tbl[a_ctrl->i2c_tbl_index].delay = delay;
-		a_ctrl->i2c_tbl_index++;
-	}
-		CDBG("%s: OUT\n", __func__);
-	return rc;
-}
-
-static int32_t msm_actuator_init_focus(struct msm_actuator_ctrl_t *a_ctrl,
-	uint16_t size, enum msm_actuator_data_type type,
-	struct reg_settings_t *settings)
-{
-	int32_t rc = -EFAULT;
-	int32_t i = 0;
-	CDBG("%s called\n", __func__);
-
-	for (i = 0; i < size; i++) {
-		switch (type) {
-		case MSM_ACTUATOR_BYTE_DATA:
-			rc = msm_camera_i2c_write(
-				&a_ctrl->i2c_client,
-				settings[i].reg_addr,
-				settings[i].reg_data, MSM_CAMERA_I2C_BYTE_DATA);
-			break;
-		case MSM_ACTUATOR_WORD_DATA:
-			rc = msm_camera_i2c_write(
-				&a_ctrl->i2c_client,
-				settings[i].reg_addr,
-				settings[i].reg_data, MSM_CAMERA_I2C_WORD_DATA);
-			break;
-		default:
-			pr_err("%s: Unsupport data type: %d\n",
-				__func__, type);
-			break;
-		}
-		if (rc < 0)
-			break;
-	}
-
-	a_ctrl->curr_step_pos = 0;
-	CDBG("%s Exit:%d\n", __func__, rc);
-	return rc;
-}
-
-static int32_t msm_actuator_write_focus(
+int32_t msm_actuator_write_focus(
 	struct msm_actuator_ctrl_t *a_ctrl,
 	uint16_t curr_lens_pos,
 	struct damping_params_t *damping_params,
@@ -155,7 +27,7 @@
 	damping_code_step = damping_params->damping_step;
 	wait_time = damping_params->damping_delay;
 
-	/* Write code based on damping_code_step in a loop */
+	
 	for (next_lens_pos =
 		curr_lens_pos + (sign_direction * damping_code_step);
 		(sign_direction * next_lens_pos) <=
@@ -163,80 +35,76 @@
 		next_lens_pos =
 			(next_lens_pos +
 				(sign_direction * damping_code_step))) {
-		rc = a_ctrl->func_tbl->
-			actuator_parse_i2c_params(a_ctrl, next_lens_pos,
-				damping_params->hw_params, wait_time);
-		if (rc < 0) {
-			pr_err("%s: error:%d\n",
-				__func__, rc);
-			return rc;
-		}
+		rc = a_ctrl->func_tbl.
+			actuator_i2c_write(a_ctrl, next_lens_pos,
+				(void *) damping_params->hw_params);
 		curr_lens_pos = next_lens_pos;
+		usleep(wait_time);
 	}
 
 	if (curr_lens_pos != code_boundary) {
-		rc = a_ctrl->func_tbl->
-			actuator_parse_i2c_params(a_ctrl, code_boundary,
-				damping_params->hw_params, wait_time);
+		rc = a_ctrl->func_tbl.
+			actuator_i2c_write(a_ctrl, code_boundary,
+				(void *) damping_params->hw_params);
+		usleep(wait_time);
 	}
 	return rc;
 }
 
-static int32_t msm_actuator_piezo_move_focus(
+
+int32_t msm_actuator_move_focus(
 	struct msm_actuator_ctrl_t *a_ctrl,
-	struct msm_actuator_move_params_t *move_params)
-{
-	int32_t dest_step_position = move_params->dest_step_pos;
-	int32_t rc = 0;
-	int32_t num_steps = move_params->num_steps;
-
-	if (num_steps == 0)
-		return rc;
-
-	a_ctrl->i2c_tbl_index = 0;
-	rc = a_ctrl->func_tbl->
-		actuator_parse_i2c_params(a_ctrl,
-		(num_steps *
-		a_ctrl->region_params[0].code_per_step),
-		move_params->ringing_params[0].hw_params, 0);
-
-	rc = msm_camera_i2c_write_table_w_microdelay(&a_ctrl->i2c_client,
-		a_ctrl->i2c_reg_tbl, a_ctrl->i2c_tbl_index,
-		a_ctrl->i2c_data_type);
-	if (rc < 0) {
-		pr_err("%s: i2c write error:%d\n",
-			__func__, rc);
-		return rc;
-	}
-	a_ctrl->i2c_tbl_index = 0;
-	a_ctrl->curr_step_pos = dest_step_position;
-	return rc;
-}
-
-static int32_t msm_actuator_move_focus(
-	struct msm_actuator_ctrl_t *a_ctrl,
-	struct msm_actuator_move_params_t *move_params)
+	int dir,
+	int32_t num_steps)
 {
 	int32_t rc = 0;
-	int8_t sign_dir = move_params->sign_dir;
+	int8_t sign_dir = 0;
+	uint16_t curr_scene = 0;
+	uint16_t scenario_size = 0;
+	uint16_t index = 0;
 	uint16_t step_boundary = 0;
 	uint16_t target_step_pos = 0;
 	uint16_t target_lens_pos = 0;
-	int16_t dest_step_pos = move_params->dest_step_pos;
+	int16_t dest_step_pos = 0;
 	uint16_t curr_lens_pos = 0;
-	int dir = move_params->dir;
-	int32_t num_steps = move_params->num_steps;
-
-	CDBG("%s called, dir %d, num_steps %d\n",
+	LINFO("%s called, dir %d, num_steps %d\n",
 		__func__,
 		dir,
 		num_steps);
 
+	
+	if (dir == MOVE_NEAR)
+		sign_dir = 1;
+	else if (dir == MOVE_FAR)
+		sign_dir = -1;
+	else {
+		pr_err("Illegal focus direction\n");
+		rc = -EINVAL;
+		return rc;
+	}
+
+	
+	dest_step_pos = a_ctrl->curr_step_pos +
+		(sign_dir * num_steps);
+
+	if (dest_step_pos < 0)
+		dest_step_pos = 0;
+	else if (dest_step_pos > a_ctrl->set_info.total_steps)
+		dest_step_pos = a_ctrl->set_info.total_steps;
+
 	if (dest_step_pos == a_ctrl->curr_step_pos)
 		return rc;
 
+	
+	scenario_size = a_ctrl->scenario_size[dir];
+	for (index = 0; index < scenario_size; index++) {
+		if (num_steps <= a_ctrl->ringing_scenario[dir][index]) {
+			curr_scene = index;
+			break;
+		}
+	}
+
 	curr_lens_pos = a_ctrl->step_position_table[a_ctrl->curr_step_pos];
-	a_ctrl->i2c_tbl_index = 0;
 	CDBG("curr_step_pos =%d dest_step_pos =%d curr_lens_pos=%d\n",
 		a_ctrl->curr_step_pos, dest_step_pos, curr_lens_pos);
 
@@ -250,87 +118,56 @@
 			target_step_pos = dest_step_pos;
 			target_lens_pos =
 				a_ctrl->step_position_table[target_step_pos];
-			rc = a_ctrl->func_tbl->
+			curr_lens_pos = a_ctrl->func_tbl.
 				actuator_write_focus(
 					a_ctrl,
 					curr_lens_pos,
-					&(move_params->
-						ringing_params[a_ctrl->
-						curr_region_index]),
+					&(a_ctrl->damping[dir]\
+						[a_ctrl->curr_region_index].
+						ringing_params[curr_scene]),
 					sign_dir,
 					target_lens_pos);
-			if (rc < 0) {
-				pr_err("%s: error:%d\n",
-					__func__, rc);
-				return rc;
-			}
-			curr_lens_pos = target_lens_pos;
 
 		} else {
 			target_step_pos = step_boundary;
 			target_lens_pos =
 				a_ctrl->step_position_table[target_step_pos];
-			rc = a_ctrl->func_tbl->
+			curr_lens_pos = a_ctrl->func_tbl.
 				actuator_write_focus(
 					a_ctrl,
 					curr_lens_pos,
-					&(move_params->
-						ringing_params[a_ctrl->
-						curr_region_index]),
+					&(a_ctrl->damping[dir]\
+						[a_ctrl->curr_region_index].
+						ringing_params[curr_scene]),
 					sign_dir,
 					target_lens_pos);
-			if (rc < 0) {
-				pr_err("%s: error:%d\n",
-					__func__, rc);
-				return rc;
-			}
-			curr_lens_pos = target_lens_pos;
 
 			a_ctrl->curr_region_index += sign_dir;
 		}
 		a_ctrl->curr_step_pos = target_step_pos;
 	}
 
-	rc = msm_camera_i2c_write_table_w_microdelay(&a_ctrl->i2c_client,
-		a_ctrl->i2c_reg_tbl, a_ctrl->i2c_tbl_index,
-		a_ctrl->i2c_data_type);
-	if (rc < 0) {
-		pr_err("%s: i2c write error:%d\n",
-			__func__, rc);
-		return rc;
-	}
-	a_ctrl->i2c_tbl_index = 0;
-
 	return rc;
 }
 
-static int32_t msm_actuator_init_step_table(struct msm_actuator_ctrl_t *a_ctrl,
-	struct msm_actuator_set_info_t *set_info)
+int32_t msm_actuator_init_table(
+	struct msm_actuator_ctrl_t *a_ctrl)
 {
 	int16_t code_per_step = 0;
 	int32_t rc = 0;
 	int16_t cur_code = 0;
 	int16_t step_index = 0, region_index = 0;
 	uint16_t step_boundary = 0;
-	uint32_t max_code_size = 1;
-	uint16_t data_size = set_info->actuator_params.data_size;
-	CDBG("%s called\n", __func__);
+	LINFO("%s called\n", __func__);
 
-	for (; data_size > 0; data_size--)
-		max_code_size *= 2;
+	if (a_ctrl->func_tbl.actuator_set_params)
+		a_ctrl->func_tbl.actuator_set_params(a_ctrl);
 
-	kfree(a_ctrl->step_position_table);
-	a_ctrl->step_position_table = NULL;
-
-	/* Fill step position table */
+	
 	a_ctrl->step_position_table =
-		kmalloc(sizeof(uint16_t) *
-		(set_info->af_tuning_params.total_steps + 1), GFP_KERNEL);
-
-	if (a_ctrl->step_position_table == NULL)
-		return -EFAULT;
-
-	cur_code = set_info->af_tuning_params.initial_code;
+		kmalloc(sizeof(uint16_t) * (a_ctrl->set_info.total_steps + 1),
+			GFP_KERNEL);
+	cur_code = a_ctrl->initial_code;
 	a_ctrl->step_position_table[step_index++] = cur_code;
 	for (region_index = 0;
 		region_index < a_ctrl->region_size;
@@ -343,163 +180,58 @@
 		for (; step_index <= step_boundary;
 			step_index++) {
 			cur_code += code_per_step;
-			if (cur_code < max_code_size)
-				a_ctrl->step_position_table[step_index] =
-					cur_code;
-			else {
-				for (; step_index <
-					set_info->af_tuning_params.total_steps;
-					step_index++)
-					a_ctrl->
-						step_position_table[
-						step_index] =
-						max_code_size;
-
-				return rc;
-			}
+			a_ctrl->step_position_table[step_index] = cur_code;
 		}
 	}
-
-	return rc;
-}
-
-static int32_t msm_actuator_set_default_focus(
-	struct msm_actuator_ctrl_t *a_ctrl,
-	struct msm_actuator_move_params_t *move_params)
-{
-	int32_t rc = 0;
-	CDBG("%s called\n", __func__);
-
-	if (a_ctrl->curr_step_pos != 0)
-		rc = a_ctrl->func_tbl->actuator_move_focus(a_ctrl, move_params);
-	return rc;
-}
-
-static int32_t msm_actuator_power_down(struct msm_actuator_ctrl_t *a_ctrl)
-{
-	int32_t rc = 0;
-	if (a_ctrl->vcm_enable) {
-		rc = gpio_direction_output(a_ctrl->vcm_pwd, 0);
-		if (!rc)
-			gpio_free(a_ctrl->vcm_pwd);
+	for (step_index = 0;
+		step_index < a_ctrl->set_info.total_steps;
+		step_index++) {
+		CDBG("step_position_table[%d]= %d\n",
+			step_index,
+			a_ctrl->step_position_table[step_index]);
 	}
 
-	kfree(a_ctrl->step_position_table);
-	a_ctrl->step_position_table = NULL;
-	kfree(a_ctrl->i2c_reg_tbl);
-	a_ctrl->i2c_reg_tbl = NULL;
-	a_ctrl->i2c_tbl_index = 0;
-	return rc;
-}
-
-static int32_t msm_actuator_init(struct msm_actuator_ctrl_t *a_ctrl,
-	struct msm_actuator_set_info_t *set_info) {
-	struct reg_settings_t *init_settings = NULL;
-	int32_t rc = -EFAULT;
-	uint16_t i = 0;
-	CDBG("%s: IN\n", __func__);
-
-	for (i = 0; i < ARRAY_SIZE(actuators); i++) {
-		if (set_info->actuator_params.act_type ==
-			actuators[i]->act_type) {
-			a_ctrl->func_tbl = &actuators[i]->func_tbl;
-			rc = 0;
-		}
-	}
-
-	if (rc < 0) {
-		pr_err("%s: Actuator function table not found\n", __func__);
-		return rc;
-	}
-
-	a_ctrl->region_size = set_info->af_tuning_params.region_size;
-	if (a_ctrl->region_size > MAX_ACTUATOR_REGION) {
-		pr_err("%s: MAX_ACTUATOR_REGION is exceeded.\n", __func__);
-		return -EFAULT;
-	}
-	a_ctrl->pwd_step = set_info->af_tuning_params.pwd_step;
-	a_ctrl->total_steps = set_info->af_tuning_params.total_steps;
-
-	if (copy_from_user(&a_ctrl->region_params,
-		(void *)set_info->af_tuning_params.region_params,
-		a_ctrl->region_size * sizeof(struct region_params_t)))
-		return -EFAULT;
-
-	a_ctrl->i2c_data_type = set_info->actuator_params.i2c_data_type;
-	a_ctrl->i2c_client.client->addr = set_info->actuator_params.i2c_addr;
-	a_ctrl->i2c_client.addr_type = set_info->actuator_params.i2c_addr_type;
-	a_ctrl->reg_tbl_size = set_info->actuator_params.reg_tbl_size;
-	if (a_ctrl->reg_tbl_size > MAX_ACTUATOR_REG_TBL_SIZE) {
-		pr_err("%s: MAX_ACTUATOR_REG_TBL_SIZE is exceeded.\n",
-			__func__);
-		return -EFAULT;
-	}
-
-	a_ctrl->i2c_reg_tbl =
-		kmalloc(sizeof(struct msm_camera_i2c_reg_tbl) *
-		(set_info->af_tuning_params.total_steps + 1), GFP_KERNEL);
-	if (!a_ctrl->i2c_reg_tbl) {
-		pr_err("%s kmalloc fail\n", __func__);
-		return -EFAULT;
-	}
-
-	if (copy_from_user(&a_ctrl->reg_tbl,
-		(void *)set_info->actuator_params.reg_tbl_params,
-		a_ctrl->reg_tbl_size *
-		sizeof(struct msm_actuator_reg_params_t))) {
-		kfree(a_ctrl->i2c_reg_tbl);
-		return -EFAULT;
-	}
-
-	if (set_info->actuator_params.init_setting_size) {
-		if (a_ctrl->func_tbl->actuator_init_focus) {
-			init_settings = kmalloc(sizeof(struct reg_settings_t) *
-				(set_info->actuator_params.init_setting_size),
-				GFP_KERNEL);
-			if (init_settings == NULL) {
-				kfree(a_ctrl->i2c_reg_tbl);
-				pr_err("%s Error allocating memory for init_settings\n",
-					__func__);
-				return -EFAULT;
-			}
-			if (copy_from_user(init_settings,
-				(void *)set_info->actuator_params.init_settings,
-				set_info->actuator_params.init_setting_size *
-				sizeof(struct reg_settings_t))) {
-				kfree(init_settings);
-				kfree(a_ctrl->i2c_reg_tbl);
-				pr_err("%s Error copying init_settings\n",
-					__func__);
-				return -EFAULT;
-			}
-			rc = a_ctrl->func_tbl->actuator_init_focus(a_ctrl,
-				set_info->actuator_params.init_setting_size,
-				a_ctrl->i2c_data_type,
-				init_settings);
-			kfree(init_settings);
-			if (rc < 0) {
-				kfree(a_ctrl->i2c_reg_tbl);
-				pr_err("%s Error actuator_init_focus\n",
-					__func__);
-				return -EFAULT;
-			}
-		}
-	}
-
-	a_ctrl->initial_code = set_info->af_tuning_params.initial_code;
-	if (a_ctrl->func_tbl->actuator_init_step_table)
-		rc = a_ctrl->func_tbl->
-			actuator_init_step_table(a_ctrl, set_info);
-
 	a_ctrl->curr_step_pos = 0;
 	a_ctrl->curr_region_index = 0;
 
 	return rc;
 }
 
+int32_t msm_actuator_set_default_focus(
+	struct msm_actuator_ctrl_t *a_ctrl)
+{
+	int32_t rc = 0;
+	LINFO("%s called\n", __func__);
 
-static int32_t msm_actuator_config(struct msm_actuator_ctrl_t *a_ctrl,
-							void __user *argp)
+	if (!a_ctrl->step_position_table)
+		a_ctrl->func_tbl.actuator_init_table(a_ctrl);
+
+	if (a_ctrl->curr_step_pos != 0)
+		rc = a_ctrl->func_tbl.actuator_move_focus(a_ctrl, MOVE_FAR,
+			a_ctrl->curr_step_pos);
+	else if (a_ctrl->func_tbl.actuator_init_focus)
+		rc = a_ctrl->func_tbl.actuator_init_focus(a_ctrl);
+	return rc;
+}
+
+int32_t msm_actuator_af_power_down(struct msm_actuator_ctrl_t *a_ctrl)
+{
+	int32_t rc = 0;
+	LINFO("%s called\n", __func__);
+
+	if (a_ctrl->step_position_table[a_ctrl->curr_step_pos] !=
+		a_ctrl->initial_code) {
+		rc = a_ctrl->func_tbl.actuator_set_default_focus(a_ctrl);
+		LINFO("%s after msm_actuator_set_default_focus\n", __func__);
+	}
+	kfree(a_ctrl->step_position_table);
+	return rc;
+}
+
+int32_t msm_actuator_config(
+	struct msm_actuator_ctrl_t *a_ctrl,
+	struct msm_actuator_info *board_info,
+	void __user *argp) 
 {
 	struct msm_actuator_cfg_data cdata;
 	int32_t rc = 0;
@@ -508,26 +240,47 @@
 		sizeof(struct msm_actuator_cfg_data)))
 		return -EFAULT;
 	mutex_lock(a_ctrl->actuator_mutex);
-	CDBG("%s called, type %d\n", __func__, cdata.cfgtype);
+	LINFO("%s called, type %d\n", __func__, cdata.cfgtype);
 	switch (cdata.cfgtype) {
+	case CFG_GET_ACTUATOR_INFO:
+		cdata.is_af_supported = 1;
+		cdata.cfg.get_info = a_ctrl->get_info;
+		if (copy_to_user((void *)argp,
+				 &cdata,
+				 sizeof(struct msm_actuator_cfg_data)))
+			rc = -EFAULT;
+		break;
 	case CFG_SET_ACTUATOR_INFO:
-		rc = msm_actuator_init(a_ctrl, &cdata.cfg.set_info);
+#ifdef USE_RAWCHIP_AF
+		if (board_info && !board_info->use_rawchip_af)
+#endif
+		a_ctrl->set_info = cdata.cfg.set_info;
+		rc = a_ctrl->func_tbl.actuator_init_table(a_ctrl);
 		if (rc < 0)
-			pr_err("%s init table failed %d\n", __func__, rc);
+			LERROR("%s init table failed %d\n", __func__, rc);
 		break;
 
 	case CFG_SET_DEFAULT_FOCUS:
-		rc = a_ctrl->func_tbl->actuator_set_default_focus(a_ctrl,
-			&cdata.cfg.move);
+		rc = a_ctrl->func_tbl.actuator_set_default_focus(a_ctrl);
 		if (rc < 0)
-			pr_err("%s move focus failed %d\n", __func__, rc);
+			LERROR("%s move focus failed %d\n", __func__, rc);
 		break;
 
 	case CFG_MOVE_FOCUS:
-		rc = a_ctrl->func_tbl->actuator_move_focus(a_ctrl,
-			&cdata.cfg.move);
+		rc = a_ctrl->func_tbl.actuator_move_focus(a_ctrl,
+			cdata.cfg.move.dir,
+			cdata.cfg.move.num_steps);
 		if (rc < 0)
-			pr_err("%s move focus failed %d\n", __func__, rc);
+			LERROR("%s move focus failed %d\n", __func__, rc);
+		break;
+
+	case CFG_GET_ACTUATOR_CURR_STEP_POS:
+		LINFO("%s current step: %d\n", __func__, a_ctrl->curr_step_pos);
+		cdata.cfg.curr_step_pos = a_ctrl->curr_step_pos;
+		if (copy_to_user((void *)argp,
+				 &cdata,
+				 sizeof(struct msm_actuator_cfg_data)))
+			rc = -EFAULT;
 		break;
 
 	default:
@@ -537,35 +290,32 @@
 	return rc;
 }
 
-static int32_t msm_actuator_i2c_probe(
+int32_t msm_actuator_i2c_probe(
 	struct i2c_client *client,
 	const struct i2c_device_id *id)
 {
 	int rc = 0;
 	struct msm_actuator_ctrl_t *act_ctrl_t = NULL;
-	CDBG("%s called\n", __func__);
+	LINFO("%s called\n", __func__);
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
 		pr_err("i2c_check_functionality failed\n");
-		rc = -EFAULT;
 		goto probe_failure;
 	}
 
 	act_ctrl_t = (struct msm_actuator_ctrl_t *)(id->driver_data);
-	CDBG("%s client = %x\n",
-		__func__, (unsigned int) client);
+	i2c_set_clientdata(client, (void *)&act_ctrl_t->actuator_ext_ctrl);
+	LINFO("%s client = %x act ctrl t = %x\n",
+		__func__,
+		(unsigned int) client,
+		(unsigned int)&act_ctrl_t->actuator_ext_ctrl);
 	act_ctrl_t->i2c_client.client = client;
+	if (act_ctrl_t->i2c_addr != 0)
+		act_ctrl_t->i2c_client.client->addr =
+			act_ctrl_t->i2c_addr;
 
-	/* Assign name for sub device */
-	snprintf(act_ctrl_t->sdev.name, sizeof(act_ctrl_t->sdev.name),
-			 "%s", act_ctrl_t->i2c_driver->driver.name);
-
-	/* Initialize sub device */
-	v4l2_i2c_subdev_init(&act_ctrl_t->sdev,
-		act_ctrl_t->i2c_client.client,
-		act_ctrl_t->act_v4l2_subdev_ops);
-
-	CDBG("%s succeeded\n", __func__);
+	
+	LINFO("%s succeeded\n", __func__);
 	return rc;
 
 probe_failure:
@@ -573,121 +323,24 @@
 	return rc;
 }
 
-static int32_t msm_actuator_power_up(struct msm_actuator_ctrl_t *a_ctrl)
+int32_t msm_actuator_create_subdevice(struct msm_actuator_ctrl_t *a_ctrl,
+	struct i2c_board_info const *board_info,
+	struct v4l2_subdev *sdev)
 {
-	int rc = 0;
-	CDBG("%s called\n", __func__);
+	int32_t rc = 0;
 
-	CDBG("vcm info: %x %x\n", a_ctrl->vcm_pwd,
-		a_ctrl->vcm_enable);
-	if (a_ctrl->vcm_enable) {
-		rc = gpio_request(a_ctrl->vcm_pwd, "msm_actuator");
-		if (!rc) {
-			CDBG("Enable VCM PWD\n");
-			gpio_direction_output(a_ctrl->vcm_pwd, 1);
-		}
-	}
+	LINFO("%s called\n", __func__);
+
+	
+	a_ctrl->sdev = sdev;
+
+	
+	snprintf(sdev->name, sizeof(sdev->name), "%s", board_info->type);
+
+	
+	v4l2_i2c_subdev_init(sdev,
+		a_ctrl->i2c_client.client,
+		a_ctrl->act_v4l2_subdev_ops);
+
 	return rc;
 }
-
-DEFINE_MUTEX(msm_actuator_mutex);
-
-static const struct i2c_device_id msm_actuator_i2c_id[] = {
-	{"msm_actuator", (kernel_ulong_t)&msm_actuator_t},
-	{ }
-};
-
-static struct i2c_driver msm_actuator_i2c_driver = {
-	.id_table = msm_actuator_i2c_id,
-	.probe  = msm_actuator_i2c_probe,
-	.remove = __exit_p(msm_actuator_i2c_remove),
-	.driver = {
-		.name = "msm_actuator",
-	},
-};
-
-static int __init msm_actuator_i2c_add_driver(
-	void)
-{
-	CDBG("%s called\n", __func__);
-	return i2c_add_driver(msm_actuator_t.i2c_driver);
-}
-
-static long msm_actuator_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int cmd, void *arg)
-{
-	struct msm_actuator_ctrl_t *a_ctrl = get_actrl(sd);
-	void __user *argp = (void __user *)arg;
-	switch (cmd) {
-	case VIDIOC_MSM_ACTUATOR_CFG:
-		return msm_actuator_config(a_ctrl, argp);
-	default:
-		return -ENOIOCTLCMD;
-	}
-}
-
-static int32_t msm_actuator_power(struct v4l2_subdev *sd, int on)
-{
-	int rc = 0;
-	struct msm_actuator_ctrl_t *a_ctrl = get_actrl(sd);
-	mutex_lock(a_ctrl->actuator_mutex);
-	if (on)
-		rc = msm_actuator_power_up(a_ctrl);
-	else
-		rc = msm_actuator_power_down(a_ctrl);
-	mutex_unlock(a_ctrl->actuator_mutex);
-	return rc;
-}
-
-struct msm_actuator_ctrl_t *get_actrl(struct v4l2_subdev *sd)
-{
-	return container_of(sd, struct msm_actuator_ctrl_t, sdev);
-}
-
-static struct v4l2_subdev_core_ops msm_actuator_subdev_core_ops = {
-	.ioctl = msm_actuator_subdev_ioctl,
-	.s_power = msm_actuator_power,
-};
-
-static struct v4l2_subdev_ops msm_actuator_subdev_ops = {
-	.core = &msm_actuator_subdev_core_ops,
-};
-
-static struct msm_actuator_ctrl_t msm_actuator_t = {
-	.i2c_driver = &msm_actuator_i2c_driver,
-	.act_v4l2_subdev_ops = &msm_actuator_subdev_ops,
-
-	.curr_step_pos = 0,
-	.curr_region_index = 0,
-	.actuator_mutex = &msm_actuator_mutex,
-
-};
-
-static struct msm_actuator msm_vcm_actuator_table = {
-	.act_type = ACTUATOR_VCM,
-	.func_tbl = {
-		.actuator_init_step_table = msm_actuator_init_step_table,
-		.actuator_move_focus = msm_actuator_move_focus,
-		.actuator_write_focus = msm_actuator_write_focus,
-		.actuator_set_default_focus = msm_actuator_set_default_focus,
-		.actuator_init_focus = msm_actuator_init_focus,
-		.actuator_parse_i2c_params = msm_actuator_parse_i2c_params,
-	},
-};
-
-static struct msm_actuator msm_piezo_actuator_table = {
-	.act_type = ACTUATOR_PIEZO,
-	.func_tbl = {
-		.actuator_init_step_table = NULL,
-		.actuator_move_focus = msm_actuator_piezo_move_focus,
-		.actuator_write_focus = NULL,
-		.actuator_set_default_focus =
-			msm_actuator_piezo_set_default_focus,
-		.actuator_init_focus = msm_actuator_init_focus,
-		.actuator_parse_i2c_params = msm_actuator_parse_i2c_params,
-	},
-};
-
-subsys_initcall(msm_actuator_i2c_add_driver);
-MODULE_DESCRIPTION("MSM ACTUATOR");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/actuators/msm_actuator.h b/drivers/media/video/msm/actuators/msm_actuator.h
index 19b71a6..daca93c 100644
--- a/drivers/media/video/msm/actuators/msm_actuator.h
+++ b/drivers/media/video/msm/actuators/msm_actuator.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -12,6 +12,7 @@
 #ifndef MSM_ACTUATOR_H
 #define MSM_ACTUATOR_H
 
+#include <linux/module.h>
 #include <linux/i2c.h>
 #include <mach/camera.h>
 #include <mach/gpio.h>
@@ -37,22 +38,31 @@
 #define LINFO(fmt, args...) CDBG(fmt, ##args)
 #endif
 
+#ifdef CONFIG_RAWCHIP
+#define USE_RAWCHIP_AF
+#endif
+
 struct msm_actuator_ctrl_t;
 
+struct damping_t {
+	struct damping_params_t *ringing_params;
+};
+
 struct msm_actuator_func_tbl {
 	int32_t (*actuator_i2c_write_b_af)(struct msm_actuator_ctrl_t *,
 			uint8_t,
 			uint8_t);
-	int32_t (*actuator_init_step_table)(struct msm_actuator_ctrl_t *,
-		struct msm_actuator_set_info_t *);
-	int32_t (*actuator_init_focus)(struct msm_actuator_ctrl_t *,
-		uint16_t, enum msm_actuator_data_type, struct reg_settings_t *);
-	int32_t (*actuator_set_default_focus) (struct msm_actuator_ctrl_t *,
-			struct msm_actuator_move_params_t *);
+	int32_t (*actuator_init_table)(struct msm_actuator_ctrl_t *);
+	int32_t (*actuator_init_focus)(struct msm_actuator_ctrl_t *);
+	int32_t (*actuator_set_default_focus) (struct msm_actuator_ctrl_t *);
+	int32_t (*actuator_set_params)(struct msm_actuator_ctrl_t *);
 	int32_t (*actuator_move_focus) (struct msm_actuator_ctrl_t *,
-			struct msm_actuator_move_params_t *);
-	int32_t (*actuator_parse_i2c_params)(struct msm_actuator_ctrl_t *,
-			int16_t, uint32_t, uint16_t);
+			int,
+			int32_t);
+	int (*actuator_power_down) (struct msm_actuator_ctrl_t *);
+	int32_t (*actuator_config)(void __user *);
+	int32_t (*actuator_i2c_write)(struct msm_actuator_ctrl_t *,
+			int16_t, void *);
 	int32_t (*actuator_write_focus)(struct msm_actuator_ctrl_t *,
 			uint16_t,
 			struct damping_params_t *,
@@ -60,40 +70,53 @@
 			int16_t);
 };
 
-struct msm_actuator {
-	enum actuator_type act_type;
-	struct msm_actuator_func_tbl func_tbl;
-};
-
 struct msm_actuator_ctrl_t {
+	uint32_t i2c_addr;
 	struct i2c_driver *i2c_driver;
 	struct msm_camera_i2c_client i2c_client;
 	struct mutex *actuator_mutex;
-	struct msm_actuator_func_tbl *func_tbl;
-	enum msm_actuator_data_type i2c_data_type;
-	struct v4l2_subdev sdev;
+	struct msm_actuator_ctrl actuator_ext_ctrl;
+	struct msm_actuator_func_tbl func_tbl;
+	struct v4l2_subdev *sdev;
 	struct v4l2_subdev_ops *act_v4l2_subdev_ops;
+	struct msm_actuator_set_info_t set_info;
+	struct msm_actuator_get_info_t get_info;
 
+	int16_t initial_code;
 	int16_t curr_step_pos;
 	uint16_t curr_region_index;
 	uint16_t *step_position_table;
-	struct region_params_t region_params[MAX_ACTUATOR_REGION];
-	uint16_t reg_tbl_size;
-	struct msm_actuator_reg_params_t reg_tbl[MAX_ACTUATOR_REG_TBL_SIZE];
+	uint16_t *ringing_scenario[2];
+	uint16_t scenario_size[2];
+	struct region_params_t *region_params;
 	uint16_t region_size;
+	struct damping_t *damping[2];
 	void *user_data;
 	uint32_t vcm_pwd;
 	uint32_t vcm_enable;
-	uint32_t total_steps;
-	uint16_t pwd_step;
-	uint16_t initial_code;
-	struct msm_camera_i2c_reg_tbl *i2c_reg_tbl;
-	uint16_t i2c_tbl_index;
 };
 
-struct msm_actuator_ctrl_t *get_actrl(struct v4l2_subdev *sd);
-
-#define VIDIOC_MSM_ACTUATOR_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 11, void __user *)
+int32_t msm_actuator_i2c_write_b_af(struct msm_actuator_ctrl_t *a_ctrl,
+		uint8_t msb,
+		uint8_t lsb);
+int32_t msm_actuator_config(struct msm_actuator_ctrl_t *a_ctrl,
+		struct msm_actuator_info *board_info,
+		void __user *cfg_data); 
+int32_t msm_actuator_move_focus(struct msm_actuator_ctrl_t *a_ctrl,
+		int direction,
+		int32_t num_steps);
+int32_t msm_actuator_init_table(struct msm_actuator_ctrl_t *a_ctrl);
+int32_t msm_actuator_set_default_focus(struct msm_actuator_ctrl_t *a_ctrl);
+int32_t msm_actuator_af_power_down(struct msm_actuator_ctrl_t *a_ctrl);
+int32_t msm_actuator_i2c_probe(struct i2c_client *client,
+		const struct i2c_device_id *id);
+int32_t msm_actuator_write_focus(struct msm_actuator_ctrl_t *a_ctrl,
+		uint16_t curr_lens_pos,
+		struct damping_params_t *damping_params,
+		int8_t sign_direction,
+		int16_t code_boundary);
+int32_t msm_actuator_create_subdevice(struct msm_actuator_ctrl_t *a_ctrl,
+		struct i2c_board_info const *board_info,
+		struct v4l2_subdev *sdev);
 
 #endif
diff --git a/drivers/media/video/msm/actuators/s5k3h2yx_act.c b/drivers/media/video/msm/actuators/s5k3h2yx_act.c
new file mode 100644
index 0000000..d9c152a
--- /dev/null
+++ b/drivers/media/video/msm/actuators/s5k3h2yx_act.c
@@ -0,0 +1,437 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include "msm_actuator.h"
+#include "msm_camera_i2c.h"
+#include <mach/gpio.h>
+
+#ifdef USE_RAWCHIP_AF
+#define	S5K3H2YX_TOTAL_STEPS_NEAR_TO_FAR			256
+#else
+#define	S5K3H2YX_TOTAL_STEPS_NEAR_TO_FAR			52
+#endif
+
+#define REG_VCM_NEW_CODE			0x30F2
+#define REG_VCM_I2C_ADDR			0x18
+#define REG_VCM_CODE_MSB			0x04
+#define REG_VCM_CODE_LSB			0x05
+#define REG_VCM_THRES_MSB			0x06
+#define REG_VCM_THRES_LSB			0x07
+#define REG_VCM_RING_CTRL			0x400
+
+#define DIV_CEIL(x, y) (x/y + (x%y) ? 1 : 0)
+
+DEFINE_MUTEX(s5k3h2yx_act_mutex);
+static struct msm_actuator_ctrl_t s5k3h2yx_act_t;
+
+static struct region_params_t g_regions[] = {
+	
+	{
+		.step_bound = {S5K3H2YX_TOTAL_STEPS_NEAR_TO_FAR, 0},
+		.code_per_step = 2,
+	},
+};
+
+static uint16_t g_scenario[] = {
+	
+	S5K3H2YX_TOTAL_STEPS_NEAR_TO_FAR,
+};
+
+static struct damping_params_t g_damping[] = {
+	
+	
+	{
+		.damping_step = 2,
+		.damping_delay = 0,
+	},
+};
+
+static struct damping_t g_damping_params[] = {
+	
+	
+	{
+		.ringing_params = g_damping,
+	},
+};
+
+static struct msm_actuator_info *s5k3h2yx_msm_actuator_info;
+
+static int32_t s5k3h2yx_poweron_af(void)
+{
+	int32_t rc = 0;
+	pr_info("%s enable AF actuator, gpio = %d\n", __func__,
+			s5k3h2yx_msm_actuator_info->vcm_pwd);
+	mdelay(1);
+	rc = gpio_request(s5k3h2yx_msm_actuator_info->vcm_pwd, "s5k3h2yx");
+	if (!rc)
+		gpio_direction_output(s5k3h2yx_msm_actuator_info->vcm_pwd, 1);
+	else
+		pr_err("%s: AF PowerON gpio_request failed %d\n", __func__, rc);
+	gpio_free(s5k3h2yx_msm_actuator_info->vcm_pwd);
+	mdelay(1);
+	return rc;
+}
+
+static void s5k3h2yx_poweroff_af(void)
+{
+	int32_t rc = 0;
+
+	pr_info("%s disable AF actuator, gpio = %d\n", __func__,
+			s5k3h2yx_msm_actuator_info->vcm_pwd);
+
+	msleep(1);
+	rc = gpio_request(s5k3h2yx_msm_actuator_info->vcm_pwd, "s5k3h2yx");
+	if (!rc)
+		gpio_direction_output(s5k3h2yx_msm_actuator_info->vcm_pwd, 0);
+	else
+		pr_err("%s: AF PowerOFF gpio_request failed %d\n", __func__, rc);
+	gpio_free(s5k3h2yx_msm_actuator_info->vcm_pwd);
+	msleep(1);
+}
+
+int32_t s5k3h2yx_msm_actuator_init_table(
+	struct msm_actuator_ctrl_t *a_ctrl)
+{
+	int32_t rc = 0;
+
+	LINFO("%s called\n", __func__);
+
+	if (a_ctrl->func_tbl.actuator_set_params)
+		a_ctrl->func_tbl.actuator_set_params(a_ctrl);
+
+	if (s5k3h2yx_act_t.step_position_table) {
+		LINFO("%s table inited\n", __func__);
+		return rc;
+	}
+
+	
+	if (a_ctrl->step_position_table != NULL) {
+		kfree(a_ctrl->step_position_table);
+		a_ctrl->step_position_table = NULL;
+	}
+	a_ctrl->step_position_table =
+		kmalloc(sizeof(uint16_t) * (a_ctrl->set_info.total_steps + 1),
+			GFP_KERNEL);
+
+	if (a_ctrl->step_position_table != NULL) {
+		uint16_t i = 0;
+		uint16_t s5k3h2yx_nl_region_boundary1 = 2;
+		uint16_t s5k3h2yx_nl_region_code_per_step1 = 32;
+		uint16_t s5k3h2yx_l_region_code_per_step = 16;
+		uint16_t s5k3h2yx_max_value = 1023;
+
+		a_ctrl->step_position_table[0] = a_ctrl->initial_code;
+		for (i = 1; i <= a_ctrl->set_info.total_steps; i++) {
+#ifdef USE_RAWCHIP_AF
+			if (s5k3h2yx_msm_actuator_info->use_rawchip_af)
+				a_ctrl->step_position_table[i] =
+					a_ctrl->step_position_table[i-1] + 4;
+			else
+#endif
+			{
+			if (i <= s5k3h2yx_nl_region_boundary1) {
+				a_ctrl->step_position_table[i] =
+					a_ctrl->step_position_table[i-1]
+					+ s5k3h2yx_nl_region_code_per_step1;
+			} else {
+				a_ctrl->step_position_table[i] =
+					a_ctrl->step_position_table[i-1]
+					+ s5k3h2yx_l_region_code_per_step;
+			}
+
+			if (a_ctrl->step_position_table[i] > s5k3h2yx_max_value)
+				a_ctrl->step_position_table[i] = s5k3h2yx_max_value;
+			}
+		}
+		a_ctrl->curr_step_pos = 0;
+		a_ctrl->curr_region_index = 0;
+	} else {
+		pr_err("%s table init failed\n", __func__);
+		rc = -EFAULT;
+	}
+
+	return rc;
+}
+
+int32_t s5k3h2yx_msm_actuator_move_focus(
+	struct msm_actuator_ctrl_t *a_ctrl,
+	int dir,
+	int32_t num_steps)
+{
+	int32_t rc = 0;
+	int8_t sign_dir = 0;
+	int16_t dest_step_pos = 0;
+
+	LINFO("%s called, dir %d, num_steps %d\n",
+		__func__,
+		dir,
+		num_steps);
+
+	
+	if (dir == MOVE_NEAR)
+		sign_dir = 1;
+	else if (dir == MOVE_FAR)
+		sign_dir = -1;
+	else {
+		pr_err("Illegal focus direction\n");
+		rc = -EINVAL;
+		return rc;
+	}
+
+	
+	dest_step_pos = a_ctrl->curr_step_pos +
+		(sign_dir * num_steps);
+
+	if (dest_step_pos < 0)
+		dest_step_pos = 0;
+	else if (dest_step_pos > a_ctrl->set_info.total_steps)
+		dest_step_pos = a_ctrl->set_info.total_steps;
+
+	if (dest_step_pos == a_ctrl->curr_step_pos)
+		return rc;
+
+	rc = a_ctrl->func_tbl.actuator_i2c_write(a_ctrl,
+		a_ctrl->step_position_table[dest_step_pos], NULL);
+	if (rc < 0) {
+		pr_err("%s focus move failed\n", __func__);
+		return rc;
+	} else {
+		a_ctrl->curr_step_pos = dest_step_pos;
+		LINFO("%s current step: %d\n", __func__, a_ctrl->curr_step_pos);
+	}
+
+	return rc;
+}
+
+int s5k3h2yx_actuator_af_power_down(void *params)
+{
+	int rc = 0;
+	LINFO("%s called\n", __func__);
+
+	rc = (int) msm_actuator_af_power_down(&s5k3h2yx_act_t);
+	s5k3h2yx_poweroff_af();
+	return rc;
+}
+
+static int32_t s5k3h2yx_wrapper_i2c_write(struct msm_actuator_ctrl_t *a_ctrl,
+	int16_t next_lens_position, void *params)
+{
+	int32_t rc = 0;
+
+	rc = msm_camera_i2c_write(&a_ctrl->i2c_client,
+		REG_VCM_CODE_MSB,
+		((next_lens_position & 0x0300) >> 8),
+		MSM_CAMERA_I2C_BYTE_DATA);
+	if (rc < 0) {
+		pr_err("%s VCM_CODE_MSB i2c write failed (%d)\n", __func__, rc);
+		return rc;
+	}
+
+	rc = msm_camera_i2c_write(&a_ctrl->i2c_client,
+		REG_VCM_CODE_LSB,
+		(next_lens_position & 0x00FF),
+		MSM_CAMERA_I2C_BYTE_DATA);
+	if (rc < 0) {
+		pr_err("%s VCM_CODE_LSB i2c write failed (%d)\n", __func__, rc);
+		return rc;
+	}
+
+	return rc;
+}
+
+int32_t s5k3h2yx_act_write_focus(
+	struct msm_actuator_ctrl_t *a_ctrl,
+	uint16_t curr_lens_pos,
+	struct damping_params_t *damping_params,
+	int8_t sign_direction,
+	int16_t code_boundary)
+{
+	int32_t rc = 0;
+	uint16_t dac_value = 0;
+
+	LINFO("%s called, curr lens pos = %d, code_boundary = %d\n",
+		  __func__,
+		  curr_lens_pos,
+		  code_boundary);
+
+	if (sign_direction == 1)
+		dac_value = (code_boundary - curr_lens_pos);
+	else
+		dac_value = (curr_lens_pos - code_boundary);
+
+	LINFO("%s dac_value = %d\n",
+		  __func__,
+		  dac_value);
+
+	rc = a_ctrl->func_tbl.actuator_i2c_write(a_ctrl, dac_value, NULL);
+
+	return rc;
+}
+
+static int32_t s5k3h2yx_act_init_focus(struct msm_actuator_ctrl_t *a_ctrl)
+{
+	int32_t rc = 0;
+
+	rc = a_ctrl->func_tbl.actuator_i2c_write(a_ctrl, a_ctrl->initial_code,
+		NULL);
+	if (rc < 0)
+		pr_err("%s i2c write failed\n", __func__);
+	else
+		a_ctrl->curr_step_pos = 0;
+
+	return rc;
+}
+
+static const struct i2c_device_id s5k3h2yx_act_i2c_id[] = {
+	{"s5k3h2yx_act", (kernel_ulong_t)&s5k3h2yx_act_t},
+	{ }
+};
+
+static int s5k3h2yx_act_config(
+	void __user *argp)
+{
+	LINFO("%s called\n", __func__);
+	return (int) msm_actuator_config(&s5k3h2yx_act_t,
+		s5k3h2yx_msm_actuator_info, argp); 
+}
+
+static int s5k3h2yx_i2c_add_driver_table(
+	void)
+{
+	int32_t rc = 0;
+
+	LINFO("%s called\n", __func__);
+
+	rc = s5k3h2yx_poweron_af();
+	if (rc < 0) {
+		pr_err("%s power on failed\n", __func__);
+		return (int) rc;
+	}
+
+	s5k3h2yx_act_t.step_position_table = NULL;
+	rc = s5k3h2yx_act_t.func_tbl.actuator_init_table(&s5k3h2yx_act_t);
+	if (rc < 0) {
+		pr_err("%s init table failed\n", __func__);
+		return (int) rc;
+	}
+
+	rc = msm_camera_i2c_write(&(s5k3h2yx_act_t.i2c_client),
+		0x0001, 0x01,
+		MSM_CAMERA_I2C_BYTE_DATA);
+	if (rc < 0) {
+		pr_err("%s i2c write failed\n", __func__);
+		return (int) rc;
+	}
+
+	return (int) rc;
+}
+
+static struct i2c_driver s5k3h2yx_act_i2c_driver = {
+	.id_table = s5k3h2yx_act_i2c_id,
+	.probe  = msm_actuator_i2c_probe,
+	.remove = __exit_p(s5k3h2yx_act_i2c_remove),
+	.driver = {
+		.name = "s5k3h2yx_act",
+	},
+};
+
+static int __init s5k3h2yx_i2c_add_driver(
+	void)
+{
+	LINFO("%s called\n", __func__);
+	return i2c_add_driver(s5k3h2yx_act_t.i2c_driver);
+}
+
+static struct v4l2_subdev_core_ops s5k3h2yx_act_subdev_core_ops;
+
+static struct v4l2_subdev_ops s5k3h2yx_act_subdev_ops = {
+	.core = &s5k3h2yx_act_subdev_core_ops,
+};
+
+static int32_t s5k3h2yx_act_create_subdevice(
+	void *act_info,
+	void *sdev)
+{
+	LINFO("%s called\n", __func__);
+
+	s5k3h2yx_msm_actuator_info = (struct msm_actuator_info *)act_info;
+
+	return (int) msm_actuator_create_subdevice(&s5k3h2yx_act_t,
+		s5k3h2yx_msm_actuator_info->board_info,
+		(struct v4l2_subdev *)sdev);
+}
+
+static struct msm_actuator_ctrl_t s5k3h2yx_act_t = {
+	.i2c_driver = &s5k3h2yx_act_i2c_driver,
+	.i2c_addr = REG_VCM_I2C_ADDR,
+	.act_v4l2_subdev_ops = &s5k3h2yx_act_subdev_ops,
+	.actuator_ext_ctrl = {
+		.a_init_table = s5k3h2yx_i2c_add_driver_table,
+		.a_power_down = s5k3h2yx_actuator_af_power_down,
+		.a_create_subdevice = s5k3h2yx_act_create_subdevice,
+		.a_config = s5k3h2yx_act_config,
+	},
+
+	.i2c_client = {
+		.addr_type = MSM_CAMERA_I2C_BYTE_ADDR,
+	},
+
+	.set_info = {
+		.total_steps = S5K3H2YX_TOTAL_STEPS_NEAR_TO_FAR,
+		.gross_steps = 3,	
+		.fine_steps = 1,	
+	},
+
+	.curr_step_pos = 0,
+	.curr_region_index = 0,
+	.initial_code = 0,	
+	.actuator_mutex = &s5k3h2yx_act_mutex,
+
+	.func_tbl = {
+		.actuator_init_table = s5k3h2yx_msm_actuator_init_table,
+		.actuator_move_focus = s5k3h2yx_msm_actuator_move_focus,
+		.actuator_write_focus = s5k3h2yx_act_write_focus,
+		.actuator_set_default_focus = msm_actuator_set_default_focus,
+		.actuator_init_focus = s5k3h2yx_act_init_focus,
+		.actuator_i2c_write = s5k3h2yx_wrapper_i2c_write,
+	},
+
+	.get_info = {	
+		.focal_length_num = 46,
+		.focal_length_den = 10,
+		.f_number_num = 265,
+		.f_number_den = 100,
+		.f_pix_num = 14,
+		.f_pix_den = 10,
+		.total_f_dist_num = 197681,
+		.total_f_dist_den = 1000,
+	},
+
+	
+	.ringing_scenario[MOVE_NEAR] = g_scenario,
+	.scenario_size[MOVE_NEAR] = ARRAY_SIZE(g_scenario),
+	.ringing_scenario[MOVE_FAR] = g_scenario,
+	.scenario_size[MOVE_FAR] = ARRAY_SIZE(g_scenario),
+
+	
+	.region_params = g_regions,
+	.region_size = ARRAY_SIZE(g_regions),
+
+	
+	.damping[MOVE_NEAR] = g_damping_params,
+	.damping[MOVE_FAR] = g_damping_params,
+};
+
+subsys_initcall(s5k3h2yx_i2c_add_driver);
+MODULE_DESCRIPTION("S5K3H2YX actuator");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/cci/Makefile b/drivers/media/video/msm/cci/Makefile
deleted file mode 100644
index 195a1b2..0000000
--- a/drivers/media/video/msm/cci/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-ccflags-y += -Idrivers/media/video/msm -Idrivers/media/video/msm/server
-obj-$(CONFIG_MSM_CCI) += msm_cci.o
diff --git a/drivers/media/video/msm/cci/msm_cam_cci_hwreg.h b/drivers/media/video/msm/cci/msm_cam_cci_hwreg.h
deleted file mode 100644
index 0262eb4..0000000
--- a/drivers/media/video/msm/cci/msm_cam_cci_hwreg.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __MSM_CAM_CCI_HWREG__
-#define __MSM_CAM_CCI_HWREG__
-
-#define CCI_HW_VERSION_ADDR                                         0x00000000
-#define CCI_RESET_CMD_ADDR                                          0x00000004
-#define CCI_RESET_CMD_RMSK                                          0xcf73f3f7
-#define CCI_M0_RESET_RMSK                                                0x3F1
-#define CCI_M1_RESET_RMSK                                              0x3F001
-#define CCI_QUEUE_START_ADDR                                        0x00000008
-#define CCI_SET_CID_SYNC_TIMER_0_ADDR                               0x00000010
-#define CCI_I2C_M0_SCL_CTL_ADDR                                     0x00000100
-#define CCI_I2C_M0_SDA_CTL_0_ADDR                                   0x00000104
-#define CCI_I2C_M0_SDA_CTL_1_ADDR                                   0x00000108
-#define CCI_I2C_M0_SDA_CTL_2_ADDR                                   0x0000010c
-#define CCI_I2C_M0_READ_DATA_ADDR                                   0x00000118
-#define CCI_I2C_M0_MISC_CTL_ADDR                                    0x00000110
-#define CCI_I2C_M0_READ_BUF_LEVEL_ADDR                              0x0000011C
-#define CCI_HALT_REQ_ADDR                                           0x00000034
-#define CCI_M0_HALT_REQ_RMSK                                               0x1
-#define CCI_M1_HALT_REQ_RMSK                                              0x01
-#define CCI_HALT_REQ_ADDR                                           0x00000034
-#define CCI_I2C_M1_SCL_CTL_ADDR                                     0x00000200
-#define CCI_I2C_M1_SDA_CTL_0_ADDR                                   0x00000204
-#define CCI_I2C_M1_SDA_CTL_1_ADDR                                   0x00000208
-#define CCI_I2C_M1_SDA_CTL_2_ADDR                                   0x0000020c
-#define CCI_I2C_M1_MISC_CTL_ADDR                                    0x00000210
-#define CCI_I2C_M0_Q0_CUR_WORD_CNT_ADDR                             0x00000304
-#define CCI_I2C_M0_Q0_CUR_CMD_ADDR                                  0x00000308
-#define CCI_I2C_M0_Q0_EXEC_WORD_CNT_ADDR                            0x00000300
-#define CCI_I2C_M0_Q0_LOAD_DATA_ADDR                                0x00000310
-#define CCI_IRQ_MASK_0_ADDR                                         0x00000c04
-#define CCI_IRQ_CLEAR_0_ADDR                                        0x00000c08
-#define CCI_IRQ_STATUS_0_ADDR                                       0x00000c0c
-#define CCI_IRQ_STATUS_0_I2C_M1_Q1_NACK_ERR_BMSK                    0x40000000
-#define CCI_IRQ_STATUS_0_I2C_M1_Q0_NACK_ERR_BMSK                    0x20000000
-#define CCI_IRQ_STATUS_0_I2C_M0_Q1_NACK_ERR_BMSK                    0x10000000
-#define CCI_IRQ_STATUS_0_I2C_M0_Q0_NACK_ERR_BMSK                     0x8000000
-#define CCI_IRQ_STATUS_0_I2C_M1_Q0Q1_HALT_ACK_BMSK                   0x4000000
-#define CCI_IRQ_STATUS_0_I2C_M0_Q0Q1_HALT_ACK_BMSK                   0x2000000
-#define CCI_IRQ_STATUS_0_RST_DONE_ACK_BMSK                           0x1000000
-#define CCI_IRQ_STATUS_0_I2C_M1_Q1_REPORT_BMSK                        0x100000
-#define CCI_IRQ_STATUS_0_I2C_M1_Q0_REPORT_BMSK                         0x10000
-#define CCI_IRQ_STATUS_0_I2C_M1_RD_DONE_BMSK                            0x1000
-#define CCI_IRQ_STATUS_0_I2C_M0_Q1_REPORT_BMSK                           0x100
-#define CCI_IRQ_STATUS_0_I2C_M0_Q0_REPORT_BMSK                            0x10
-#define CCI_IRQ_STATUS_0_I2C_M0_RD_DONE_BMSK                               0x1
-#define CCI_IRQ_GLOBAL_CLEAR_CMD_ADDR                               0x00000c00
-#endif /* __MSM_CAM_CCI_HWREG__ */
diff --git a/drivers/media/video/msm/cci/msm_cci.c b/drivers/media/video/msm/cci/msm_cci.c
deleted file mode 100644
index 4da5897..0000000
--- a/drivers/media/video/msm/cci/msm_cci.c
+++ /dev/null
@@ -1,769 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/module.h>
-#include <linux/of.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <media/msm_isp.h>
-#include "msm_cci.h"
-#include "msm.h"
-#include "msm_cam_server.h"
-#include "msm_cam_cci_hwreg.h"
-
-#define V4L2_IDENT_CCI 50005
-#define CCI_I2C_QUEUE_0_SIZE 64
-#define CCI_I2C_QUEUE_1_SIZE 16
-
-#define CCI_TIMEOUT msecs_to_jiffies(100)
-
-static void msm_cci_set_clk_param(struct cci_device *cci_dev)
-{
-	uint16_t THIGH = 78;
-	uint16_t TLOW = 114;
-	uint16_t TSUSTO = 28;
-	uint16_t TSUSTA = 28;
-	uint16_t THDDAT = 10;
-	uint16_t THDSTA = 77;
-	uint16_t TBUF = 118;
-	uint8_t HW_SCL_STRETCH_EN = 0; /*enable or disable SCL clock
-					* stretching */
-	uint8_t HW_RDHLD = 6; /* internal hold time 1-6 cycles of SDA to bridge
-			       * undefined falling SCL region */
-	uint8_t HW_TSP = 1; /* glitch filter 1-3 cycles */
-
-	msm_camera_io_w(THIGH << 16 | TLOW, cci_dev->base +
-		CCI_I2C_M0_SCL_CTL_ADDR);
-	msm_camera_io_w(TSUSTO << 16 | TSUSTA, cci_dev->base +
-		CCI_I2C_M0_SDA_CTL_0_ADDR);
-	msm_camera_io_w(THDDAT << 16 | THDSTA, cci_dev->base +
-		CCI_I2C_M0_SDA_CTL_1_ADDR);
-	msm_camera_io_w(TBUF, cci_dev->base +
-		CCI_I2C_M0_SDA_CTL_2_ADDR);
-	msm_camera_io_w(HW_SCL_STRETCH_EN << 8 | HW_RDHLD << 4 | HW_TSP,
-		cci_dev->base + CCI_I2C_M0_MISC_CTL_ADDR);
-	msm_camera_io_w(THIGH << 16 | TLOW, cci_dev->base +
-		CCI_I2C_M1_SCL_CTL_ADDR);
-	msm_camera_io_w(TSUSTO << 16 | TSUSTA, cci_dev->base +
-		CCI_I2C_M1_SDA_CTL_0_ADDR);
-	msm_camera_io_w(THDDAT << 16 | THDSTA, cci_dev->base +
-		CCI_I2C_M1_SDA_CTL_1_ADDR);
-	msm_camera_io_w(TBUF, cci_dev->base + CCI_I2C_M1_SDA_CTL_2_ADDR);
-	msm_camera_io_w(HW_SCL_STRETCH_EN << 8 | HW_RDHLD << 4 | HW_TSP,
-		cci_dev->base + CCI_I2C_M1_MISC_CTL_ADDR);
-}
-
-static int32_t msm_cci_i2c_config_sync_timer(struct v4l2_subdev *sd,
-	struct msm_camera_cci_ctrl *c_ctrl)
-{
-	struct cci_device *cci_dev;
-	cci_dev = v4l2_get_subdevdata(sd);
-	msm_camera_io_w(c_ctrl->cci_info->cid, cci_dev->base +
-		CCI_SET_CID_SYNC_TIMER_0_ADDR + (c_ctrl->cci_info->cid * 0x4));
-	return 0;
-}
-
-static int32_t msm_cci_i2c_set_freq(struct v4l2_subdev *sd,
-	struct msm_camera_cci_ctrl *c_ctrl)
-{
-	struct cci_device *cci_dev;
-	uint32_t val;
-	cci_dev = v4l2_get_subdevdata(sd);
-	val = c_ctrl->cci_info->freq;
-	msm_camera_io_w(val, cci_dev->base + CCI_I2C_M0_SCL_CTL_ADDR +
-		c_ctrl->cci_info->cci_i2c_master*0x100);
-	msm_camera_io_w(val, cci_dev->base + CCI_I2C_M0_SDA_CTL_0_ADDR +
-		c_ctrl->cci_info->cci_i2c_master*0x100);
-	msm_camera_io_w(val, cci_dev->base + CCI_I2C_M0_SDA_CTL_1_ADDR +
-		c_ctrl->cci_info->cci_i2c_master*0x100);
-	msm_camera_io_w(val, cci_dev->base + CCI_I2C_M0_SDA_CTL_2_ADDR +
-		c_ctrl->cci_info->cci_i2c_master*0x100);
-	msm_camera_io_w(val, cci_dev->base + CCI_I2C_M0_MISC_CTL_ADDR +
-		c_ctrl->cci_info->cci_i2c_master*0x100);
-	return 0;
-}
-
-static int32_t msm_cci_validate_queue(struct cci_device *cci_dev,
-	uint32_t len,
-	enum cci_i2c_master_t master,
-	enum cci_i2c_queue_t queue)
-{
-	int32_t rc = 0;
-	uint32_t read_val = 0;
-	uint32_t reg_offset = master * 0x200 + queue * 0x100;
-	read_val = msm_camera_io_r(cci_dev->base +
-		CCI_I2C_M0_Q0_CUR_WORD_CNT_ADDR + reg_offset);
-	CDBG("%s line %d CCI_I2C_M0_Q0_CUR_WORD_CNT_ADDR %d len %d max %d\n",
-		__func__, __LINE__, read_val, len,
-		cci_dev->cci_i2c_queue_info[master][queue].max_queue_size);
-	if ((read_val + len + 1) > cci_dev->
-		cci_i2c_queue_info[master][queue].max_queue_size) {
-		uint32_t reg_val = 0;
-		uint32_t report_val = CCI_I2C_REPORT_CMD | (1 << 8);
-		CDBG("%s:%d CCI_I2C_REPORT_CMD\n", __func__, __LINE__);
-		msm_camera_io_w(report_val,
-			cci_dev->base + CCI_I2C_M0_Q0_LOAD_DATA_ADDR +
-			reg_offset);
-		read_val++;
-		CDBG("%s:%d CCI_I2C_M0_Q0_EXEC_WORD_CNT_ADDR %d\n",
-			__func__, __LINE__, read_val);
-		msm_camera_io_w(read_val, cci_dev->base +
-			CCI_I2C_M0_Q0_EXEC_WORD_CNT_ADDR + reg_offset);
-		reg_val = 1 << ((master * 2) + queue);
-		CDBG("%s:%d CCI_QUEUE_START_ADDR\n", __func__, __LINE__);
-		msm_camera_io_w(reg_val, cci_dev->base + CCI_QUEUE_START_ADDR);
-		CDBG("%s line %d wait_for_completion_interruptible\n",
-			__func__, __LINE__);
-		wait_for_completion_interruptible_timeout(&cci_dev->
-			cci_master_info[master].reset_complete, CCI_TIMEOUT);
-
-		rc = cci_dev->cci_master_info[master].status;
-		if (rc < 0)
-			pr_err("%s failed rc %d\n", __func__, rc);
-	}
-	return rc;
-}
-
-static int32_t msm_cci_data_queue(struct cci_device *cci_dev,
-	struct msm_camera_cci_ctrl *c_ctrl, enum cci_i2c_queue_t queue)
-{
-	uint16_t i = 0, j = 0, k = 0, h = 0, len = 0;
-	uint32_t cmd = 0;
-	uint8_t data[10];
-	uint16_t reg_addr = 0;
-	struct msm_camera_cci_i2c_write_cfg *i2c_msg =
-		&c_ctrl->cfg.cci_i2c_write_cfg;
-	uint16_t cmd_size = i2c_msg->size;
-	struct msm_camera_i2c_reg_conf *i2c_cmd = i2c_msg->reg_conf_tbl;
-	enum cci_i2c_master_t master = c_ctrl->cci_info->cci_i2c_master;
-	CDBG("%s addr type %d data type %d\n", __func__,
-		i2c_msg->addr_type, i2c_msg->data_type);
-	/* assume total size within the max queue */
-	while (cmd_size) {
-		CDBG("%s cmd_size %d addr 0x%x data 0x%x", __func__,
-			cmd_size, i2c_cmd->reg_addr, i2c_cmd->reg_data);
-		data[i++] = CCI_I2C_WRITE_CMD;
-		if (i2c_cmd->reg_addr)
-			reg_addr = i2c_cmd->reg_addr;
-		/* either byte or word addr */
-		if (i2c_msg->addr_type == MSM_CAMERA_I2C_BYTE_ADDR)
-			data[i++] = reg_addr;
-		else {
-			data[i++] = (reg_addr & 0xFF00) >> 8;
-			data[i++] = reg_addr & 0x00FF;
-		}
-		/* max of 10 data bytes */
-		do {
-			if (i2c_msg->data_type == MSM_CAMERA_I2C_BYTE_DATA) {
-				data[i++] = i2c_cmd->reg_data;
-				reg_addr++;
-			} else {
-				if ((i + 1) <= 10) {
-					data[i++] = (i2c_cmd->reg_data &
-						0xFF00) >> 8; /* MSB */
-					data[i++] = i2c_cmd->reg_data &
-						0x00FF; /* LSB */
-					reg_addr += 2;
-				} else
-					break;
-			}
-			i2c_cmd++;
-		} while (--cmd_size && !i2c_cmd->reg_addr && (i <= 10));
-		data[0] |= ((i-1) << 4);
-		len = ((i-1)/4) + 1;
-		msm_cci_validate_queue(cci_dev, len, master, queue);
-		for (h = 0, k = 0; h < len; h++) {
-			cmd = 0;
-			for (j = 0; (j < 4 && k < i); j++)
-				cmd |= (data[k++] << (j * 8));
-			CDBG("%s CCI_I2C_M0_Q0_LOAD_DATA_ADDR 0x%x\n",
-				__func__, cmd);
-			msm_camera_io_w(cmd, cci_dev->base +
-				CCI_I2C_M0_Q0_LOAD_DATA_ADDR +
-				master * 0x200 + queue * 0x100);
-		}
-		i = 0;
-	}
-	return 0;
-}
-
-static int32_t msm_cci_write_i2c_queue(struct cci_device *cci_dev,
-	uint32_t val,
-	enum cci_i2c_master_t master,
-	enum cci_i2c_queue_t queue)
-{
-	int32_t rc = 0;
-	uint32_t reg_offset = master * 0x200 + queue * 0x100;
-	CDBG("%s:%d called\n", __func__, __LINE__);
-	msm_cci_validate_queue(cci_dev, 1, master, queue);
-	CDBG("%s CCI_I2C_M0_Q0_LOAD_DATA_ADDR:val %x:%x\n",
-		__func__, CCI_I2C_M0_Q0_LOAD_DATA_ADDR +
-		reg_offset, val);
-	msm_camera_io_w(val, cci_dev->base + CCI_I2C_M0_Q0_LOAD_DATA_ADDR +
-		reg_offset);
-	return rc;
-}
-
-static int32_t msm_cci_i2c_read(struct v4l2_subdev *sd,
-	struct msm_camera_cci_ctrl *c_ctrl)
-{
-	uint32_t rc = 0;
-	uint32_t val = 0;
-	int32_t read_words = 0, exp_words = 0;
-	int32_t index = 0, first_byte = 0;
-	uint32_t i = 0;
-	enum cci_i2c_master_t master;
-	enum cci_i2c_queue_t queue = QUEUE_1;
-	struct cci_device *cci_dev = NULL;
-	struct msm_camera_cci_i2c_read_cfg *read_cfg = NULL;
-	CDBG("%s line %d\n", __func__, __LINE__);
-	cci_dev = v4l2_get_subdevdata(sd);
-	master = c_ctrl->cci_info->cci_i2c_master;
-	read_cfg = &c_ctrl->cfg.cci_i2c_read_cfg;
-	mutex_lock(&cci_dev->cci_master_info[master].mutex);
-	CDBG("%s master %d, queue %d\n", __func__, master, queue);
-	CDBG("%s set param sid 0x%x retries %d id_map %d\n", __func__,
-		c_ctrl->cci_info->sid, c_ctrl->cci_info->retries,
-		c_ctrl->cci_info->id_map);
-	val = CCI_I2C_SET_PARAM_CMD | c_ctrl->cci_info->sid << 4 |
-		c_ctrl->cci_info->retries << 16 |
-		c_ctrl->cci_info->id_map << 18;
-	rc = msm_cci_write_i2c_queue(cci_dev, val, master, queue);
-	if (rc < 0) {
-		CDBG("%s failed line %d\n", __func__, __LINE__);
-		goto ERROR;
-	}
-
-	val = CCI_I2C_LOCK_CMD;
-	rc = msm_cci_write_i2c_queue(cci_dev, val, master, queue);
-	if (rc < 0) {
-		CDBG("%s failed line %d\n", __func__, __LINE__);
-		goto ERROR;
-	}
-
-	if (read_cfg->addr_type == MSM_CAMERA_I2C_BYTE_ADDR)
-		val = CCI_I2C_WRITE_CMD | (read_cfg->addr_type << 4) |
-			((read_cfg->addr & 0xFF) << 8);
-	if (read_cfg->addr_type == MSM_CAMERA_I2C_WORD_ADDR)
-		val = CCI_I2C_WRITE_CMD | (read_cfg->addr_type << 4) |
-			(((read_cfg->addr & 0xFF00) >> 8) << 8) |
-			((read_cfg->addr & 0xFF) << 16);
-	rc = msm_cci_write_i2c_queue(cci_dev, val, master, queue);
-	if (rc < 0) {
-		CDBG("%s failed line %d\n", __func__, __LINE__);
-		goto ERROR;
-	}
-
-	val = CCI_I2C_READ_CMD | (read_cfg->num_byte << 4);
-	rc = msm_cci_write_i2c_queue(cci_dev, val, master, queue);
-	if (rc < 0) {
-		CDBG("%s failed line %d\n", __func__, __LINE__);
-		goto ERROR;
-	}
-
-	val = CCI_I2C_UNLOCK_CMD;
-	rc = msm_cci_write_i2c_queue(cci_dev, val, master, queue);
-	if (rc < 0) {
-		CDBG("%s failed line %d\n", __func__, __LINE__);
-		goto ERROR;
-	}
-
-	val = msm_camera_io_r(cci_dev->base + CCI_I2C_M0_Q0_CUR_WORD_CNT_ADDR +
-		master * 0x200 + queue * 0x100);
-	CDBG("%s cur word cnt %x\n", __func__, val);
-	msm_camera_io_w(val, cci_dev->base + CCI_I2C_M0_Q0_EXEC_WORD_CNT_ADDR +
-		master * 0x200 + queue * 0x100);
-
-	val = 1 << ((master * 2) + queue);
-	msm_camera_io_w(val, cci_dev->base + CCI_QUEUE_START_ADDR);
-	wait_for_completion_interruptible_timeout(&cci_dev->
-		cci_master_info[master].reset_complete, CCI_TIMEOUT);
-
-	read_words = msm_camera_io_r(cci_dev->base +
-		CCI_I2C_M0_READ_BUF_LEVEL_ADDR + master * 0x100);
-	exp_words = ((read_cfg->num_byte / 4) + 1);
-	if (read_words != exp_words) {
-		pr_err("%s:%d read_words = %d, exp words = %d\n", __func__,
-			__LINE__, read_words, exp_words);
-		memset(read_cfg->data, 0, read_cfg->num_byte);
-		goto ERROR;
-	}
-	index = 0;
-	CDBG("%s index %d num_type %d\n", __func__, index,
-		read_cfg->num_byte);
-	first_byte = 0;
-	do {
-		val = msm_camera_io_r(cci_dev->base +
-			CCI_I2C_M0_READ_DATA_ADDR + master * 0x100);
-		CDBG("%s read val %x\n", __func__, val);
-		for (i = 0; (i < 4) && (index < read_cfg->num_byte); i++) {
-			CDBG("%s i %d index %d\n", __func__, i, index);
-			if (!first_byte) {
-				CDBG("%s sid %x\n", __func__, val & 0xFF);
-				first_byte++;
-			} else {
-				read_cfg->data[index] =
-					(val  >> (i * 8)) & 0xFF;
-				CDBG("%s data[%d] %x\n", __func__, index,
-					read_cfg->data[index]);
-				index++;
-			}
-		}
-	} while (--read_words > 0);
-ERROR:
-	mutex_unlock(&cci_dev->cci_master_info[master].mutex);
-	return rc;
-}
-
-static int32_t msm_cci_i2c_write(struct v4l2_subdev *sd,
-	struct msm_camera_cci_ctrl *c_ctrl)
-{
-	int32_t rc = 0;
-	struct cci_device *cci_dev;
-	uint32_t val;
-	enum cci_i2c_master_t master;
-	enum cci_i2c_queue_t queue = QUEUE_0;
-	cci_dev = v4l2_get_subdevdata(sd);
-	master = c_ctrl->cci_info->cci_i2c_master;
-	CDBG("%s master %d, queue %d\n", __func__, master, queue);
-	CDBG("%s set param sid 0x%x retries %d id_map %d\n", __func__,
-		c_ctrl->cci_info->sid, c_ctrl->cci_info->retries,
-		c_ctrl->cci_info->id_map);
-	mutex_lock(&cci_dev->cci_master_info[master].mutex);
-	val = CCI_I2C_SET_PARAM_CMD | c_ctrl->cci_info->sid << 4 |
-		c_ctrl->cci_info->retries << 16 |
-		c_ctrl->cci_info->id_map << 18;
-	CDBG("%s:%d CCI_I2C_SET_PARAM_CMD\n", __func__, __LINE__);
-	rc = msm_cci_write_i2c_queue(cci_dev, val, master, queue);
-	if (rc < 0) {
-		CDBG("%s failed line %d\n", __func__, __LINE__);
-		goto ERROR;
-	}
-
-	val = CCI_I2C_LOCK_CMD;
-	CDBG("%s:%d CCI_I2C_LOCK_CMD\n", __func__, __LINE__);
-	rc = msm_cci_write_i2c_queue(cci_dev, val, master, queue);
-	if (rc < 0) {
-		CDBG("%s failed line %d\n", __func__, __LINE__);
-		goto ERROR;
-	}
-
-	msm_cci_data_queue(cci_dev, c_ctrl, queue);
-	val = CCI_I2C_UNLOCK_CMD;
-	CDBG("%s:%d CCI_I2C_UNLOCK_CMD\n", __func__, __LINE__);
-	rc = msm_cci_write_i2c_queue(cci_dev, val, master, queue);
-	if (rc < 0) {
-		CDBG("%s failed line %d\n", __func__, __LINE__);
-		goto ERROR;
-	}
-
-	val = CCI_I2C_REPORT_CMD | (1 << 8);
-	CDBG("%s:%d CCI_I2C_REPORT_CMD\n", __func__, __LINE__);
-	rc = msm_cci_write_i2c_queue(cci_dev, val, master, queue);
-	if (rc < 0) {
-		CDBG("%s failed line %d\n", __func__, __LINE__);
-		goto ERROR;
-	}
-
-	val = msm_camera_io_r(cci_dev->base + CCI_I2C_M0_Q0_CUR_WORD_CNT_ADDR +
-		master * 0x200 + queue * 0x100);
-	CDBG("%s:%d cur word count %d\n", __func__, __LINE__, val);
-	CDBG("%s:%d CCI_I2C_M0_Q0_EXEC_WORD_CNT_ADDR\n", __func__, __LINE__);
-	msm_camera_io_w(val, cci_dev->base + CCI_I2C_M0_Q0_EXEC_WORD_CNT_ADDR +
-		master * 0x200 + queue * 0x100);
-
-	val = 1 << ((master * 2) + queue);
-	CDBG("%s:%d CCI_QUEUE_START_ADDR\n", __func__, __LINE__);
-	msm_camera_io_w(val, cci_dev->base + CCI_QUEUE_START_ADDR +
-		master*0x200 + queue * 0x100);
-
-	CDBG("%s line %d wait_for_completion_interruptible\n",
-		__func__, __LINE__);
-	wait_for_completion_interruptible_timeout(&cci_dev->
-		cci_master_info[master].reset_complete, CCI_TIMEOUT);
-
-ERROR:
-	mutex_unlock(&cci_dev->cci_master_info[master].mutex);
-	return rc;
-}
-
-static int msm_cci_subdev_g_chip_ident(struct v4l2_subdev *sd,
-			struct v4l2_dbg_chip_ident *chip)
-{
-	BUG_ON(!chip);
-	chip->ident = V4L2_IDENT_CCI;
-	chip->revision = 0;
-	return 0;
-}
-
-static struct msm_cam_clk_info cci_clk_info[] = {
-	{"camss_top_ahb_clk", -1},
-	{"cci_src_clk", 19200000},
-	{"cci_ahb_clk", -1},
-	{"cci_clk", -1},
-};
-
-static int32_t msm_cci_init(struct v4l2_subdev *sd)
-{
-	int rc = 0;
-	struct cci_device *cci_dev;
-	cci_dev = v4l2_get_subdevdata(sd);
-	CDBG("%s line %d\n", __func__, __LINE__);
-	if (cci_dev == NULL) {
-		rc = -ENOMEM;
-		return rc;
-	}
-	rc = msm_cam_clk_enable(&cci_dev->pdev->dev, cci_clk_info,
-		cci_dev->cci_clk, ARRAY_SIZE(cci_clk_info), 1);
-	if (rc < 0) {
-		CDBG("%s: clk enable failed\n", __func__);
-		goto clk_enable_failed;
-	}
-
-	enable_irq(cci_dev->irq->start);
-	cci_dev->hw_version = msm_camera_io_r(cci_dev->base +
-		CCI_HW_VERSION_ADDR);
-	cci_dev->cci_master_info[MASTER_0].reset_pending = TRUE;
-	msm_camera_io_w(0xFFFFFFFF, cci_dev->base + CCI_RESET_CMD_ADDR);
-	msm_camera_io_w(0x1, cci_dev->base + CCI_RESET_CMD_ADDR);
-	wait_for_completion_interruptible_timeout(
-		&cci_dev->cci_master_info[MASTER_0].reset_complete,
-		CCI_TIMEOUT);
-	msm_cci_set_clk_param(cci_dev);
-	msm_camera_io_w(0xFFFFFFFF, cci_dev->base + CCI_IRQ_MASK_0_ADDR);
-	msm_camera_io_w(0xFFFFFFFF, cci_dev->base + CCI_IRQ_CLEAR_0_ADDR);
-	msm_camera_io_w(0x1, cci_dev->base + CCI_IRQ_GLOBAL_CLEAR_CMD_ADDR);
-	msm_camera_io_w(0x0, cci_dev->base + CCI_IRQ_GLOBAL_CLEAR_CMD_ADDR);
-	msm_camera_io_w(0x0, cci_dev->base + CCI_IRQ_CLEAR_0_ADDR);
-	return 0;
-
-clk_enable_failed:
-	return rc;
-}
-
-static int32_t msm_cci_release(struct v4l2_subdev *sd)
-{
-	struct cci_device *cci_dev;
-	cci_dev = v4l2_get_subdevdata(sd);
-
-	disable_irq(cci_dev->irq->start);
-
-	msm_cam_clk_enable(&cci_dev->pdev->dev, cci_clk_info,
-		cci_dev->cci_clk, ARRAY_SIZE(cci_clk_info), 0);
-
-	return 0;
-}
-
-static int32_t msm_cci_config(struct v4l2_subdev *sd,
-	struct msm_camera_cci_ctrl *cci_ctrl)
-{
-	int32_t rc = 0;
-	CDBG("%s line %d cmd %d\n", __func__, __LINE__,
-		cci_ctrl->cmd);
-	switch (cci_ctrl->cmd) {
-	case MSM_CCI_INIT:
-		rc = msm_cci_init(sd);
-		break;
-	case MSM_CCI_RELEASE:
-		rc = msm_cci_release(sd);
-		break;
-	case MSM_CCI_SET_SID:
-		break;
-	case MSM_CCI_SET_FREQ:
-		rc = msm_cci_i2c_set_freq(sd, cci_ctrl);
-		break;
-	case MSM_CCI_SET_SYNC_CID:
-		rc = msm_cci_i2c_config_sync_timer(sd, cci_ctrl);
-		break;
-	case MSM_CCI_I2C_READ:
-		rc = msm_cci_i2c_read(sd, cci_ctrl);
-		break;
-	case MSM_CCI_I2C_WRITE:
-		rc = msm_cci_i2c_write(sd, cci_ctrl);
-		break;
-	case MSM_CCI_GPIO_WRITE:
-		break;
-	default:
-		rc = -ENOIOCTLCMD;
-	}
-	CDBG("%s line %d rc %d\n", __func__, __LINE__, rc);
-	cci_ctrl->status = rc;
-	return rc;
-}
-
-static irqreturn_t msm_cci_irq(int irq_num, void *data)
-{
-	uint32_t irq;
-	struct cci_device *cci_dev = data;
-	irq = msm_camera_io_r(cci_dev->base + CCI_IRQ_STATUS_0_ADDR);
-	msm_camera_io_w(irq, cci_dev->base + CCI_IRQ_CLEAR_0_ADDR);
-	msm_camera_io_w(0x1, cci_dev->base + CCI_IRQ_GLOBAL_CLEAR_CMD_ADDR);
-	msm_camera_io_w(0x0, cci_dev->base + CCI_IRQ_GLOBAL_CLEAR_CMD_ADDR);
-	CDBG("%s CCI_I2C_M0_STATUS_ADDR = 0x%x\n", __func__, irq);
-	if (irq & CCI_IRQ_STATUS_0_RST_DONE_ACK_BMSK) {
-		if (cci_dev->cci_master_info[MASTER_0].reset_pending == TRUE) {
-			cci_dev->cci_master_info[MASTER_0].reset_pending =
-				FALSE;
-			complete(&cci_dev->cci_master_info[MASTER_0].
-				reset_complete);
-		}
-		if (cci_dev->cci_master_info[MASTER_1].reset_pending == TRUE) {
-			cci_dev->cci_master_info[MASTER_1].reset_pending =
-				FALSE;
-			complete(&cci_dev->cci_master_info[MASTER_1].
-				reset_complete);
-		}
-	} else if ((irq & CCI_IRQ_STATUS_0_I2C_M0_RD_DONE_BMSK) ||
-		(irq & CCI_IRQ_STATUS_0_I2C_M0_Q0_REPORT_BMSK) ||
-		(irq & CCI_IRQ_STATUS_0_I2C_M0_Q1_REPORT_BMSK)) {
-		cci_dev->cci_master_info[MASTER_0].status = 0;
-		complete(&cci_dev->cci_master_info[MASTER_0].reset_complete);
-	} else if ((irq & CCI_IRQ_STATUS_0_I2C_M1_RD_DONE_BMSK) ||
-		(irq & CCI_IRQ_STATUS_0_I2C_M1_Q0_REPORT_BMSK) ||
-		(irq & CCI_IRQ_STATUS_0_I2C_M1_Q1_REPORT_BMSK)) {
-		cci_dev->cci_master_info[MASTER_1].status = 0;
-		complete(&cci_dev->cci_master_info[MASTER_1].reset_complete);
-	} else if ((irq & CCI_IRQ_STATUS_0_I2C_M0_Q0_NACK_ERR_BMSK) ||
-		(irq & CCI_IRQ_STATUS_0_I2C_M0_Q1_NACK_ERR_BMSK)) {
-		cci_dev->cci_master_info[MASTER_0].status = -EINVAL;
-		msm_camera_io_w(CCI_M0_HALT_REQ_RMSK,
-			cci_dev->base + CCI_HALT_REQ_ADDR);
-	} else if ((irq & CCI_IRQ_STATUS_0_I2C_M1_Q0_NACK_ERR_BMSK) ||
-		(irq & CCI_IRQ_STATUS_0_I2C_M1_Q1_NACK_ERR_BMSK)) {
-		cci_dev->cci_master_info[MASTER_1].status = -EINVAL;
-		msm_camera_io_w(CCI_M1_HALT_REQ_RMSK,
-			cci_dev->base + CCI_HALT_REQ_ADDR);
-	} else if (irq & CCI_IRQ_STATUS_0_I2C_M0_Q0Q1_HALT_ACK_BMSK) {
-		cci_dev->cci_master_info[MASTER_0].reset_pending = TRUE;
-		msm_camera_io_w(CCI_M0_RESET_RMSK,
-			cci_dev->base + CCI_RESET_CMD_ADDR);
-	} else if (irq & CCI_IRQ_STATUS_0_I2C_M1_Q0Q1_HALT_ACK_BMSK) {
-		cci_dev->cci_master_info[MASTER_1].reset_pending = TRUE;
-		msm_camera_io_w(CCI_M1_RESET_RMSK,
-			cci_dev->base + CCI_RESET_CMD_ADDR);
-	} else {
-		pr_err("%s unhandled irq 0x%x\n", __func__, irq);
-		cci_dev->cci_master_info[MASTER_0].status = 0;
-		complete(&cci_dev->cci_master_info[MASTER_0].reset_complete);
-		cci_dev->cci_master_info[MASTER_1].status = 0;
-		complete(&cci_dev->cci_master_info[MASTER_1].reset_complete);
-	}
-	return IRQ_HANDLED;
-}
-
-int msm_cci_irq_routine(struct v4l2_subdev *sd, u32 status, bool *handled)
-{
-	struct cci_device *cci_dev = v4l2_get_subdevdata(sd);
-	irqreturn_t ret;
-	CDBG("%s line %d\n", __func__, __LINE__);
-	ret = msm_cci_irq(cci_dev->irq->start, cci_dev);
-	*handled = TRUE;
-	return 0;
-}
-
-static long msm_cci_subdev_ioctl(struct v4l2_subdev *sd,
-	unsigned int cmd, void *arg)
-{
-	int32_t rc = 0;
-	CDBG("%s line %d\n", __func__, __LINE__);
-	switch (cmd) {
-	case VIDIOC_MSM_CCI_CFG:
-		rc = msm_cci_config(sd, arg);
-		break;
-	default:
-		rc = -ENOIOCTLCMD;
-	}
-	CDBG("%s line %d rc %d\n", __func__, __LINE__, rc);
-	return rc;
-}
-
-static struct v4l2_subdev_core_ops msm_cci_subdev_core_ops = {
-	.g_chip_ident = &msm_cci_subdev_g_chip_ident,
-	.ioctl = &msm_cci_subdev_ioctl,
-	.interrupt_service_routine = msm_cci_irq_routine,
-};
-
-static const struct v4l2_subdev_ops msm_cci_subdev_ops = {
-	.core = &msm_cci_subdev_core_ops,
-};
-
-static const struct v4l2_subdev_internal_ops msm_cci_internal_ops;
-
-static void msm_cci_initialize_cci_params(struct cci_device *new_cci_dev)
-{
-	uint8_t i = 0, j = 0;
-	for (i = 0; i < NUM_MASTERS; i++) {
-		new_cci_dev->cci_master_info[i].status = 0;
-		mutex_init(&new_cci_dev->cci_master_info[i].mutex);
-		init_completion(&new_cci_dev->
-			cci_master_info[i].reset_complete);
-		for (j = 0; j < NUM_QUEUES; j++) {
-			if (j == QUEUE_0)
-				new_cci_dev->cci_i2c_queue_info[i][j].
-					max_queue_size = CCI_I2C_QUEUE_0_SIZE;
-			else
-				new_cci_dev->cci_i2c_queue_info[i][j].
-					max_queue_size = CCI_I2C_QUEUE_1_SIZE;
-			}
-	}
-	return;
-}
-
-static int __devinit msm_cci_probe(struct platform_device *pdev)
-{
-	struct cci_device *new_cci_dev;
-	int rc = 0;
-	struct msm_cam_subdev_info sd_info;
-	struct intr_table_entry irq_req;
-	CDBG("%s: pdev %p device id = %d\n", __func__, pdev, pdev->id);
-	new_cci_dev = kzalloc(sizeof(struct cci_device), GFP_KERNEL);
-	if (!new_cci_dev) {
-		CDBG("%s: no enough memory\n", __func__);
-		return -ENOMEM;
-	}
-	v4l2_subdev_init(&new_cci_dev->subdev, &msm_cci_subdev_ops);
-	new_cci_dev->subdev.internal_ops = &msm_cci_internal_ops;
-	new_cci_dev->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(new_cci_dev->subdev.name,
-			ARRAY_SIZE(new_cci_dev->subdev.name), "msm_cci");
-	v4l2_set_subdevdata(&new_cci_dev->subdev, new_cci_dev);
-	platform_set_drvdata(pdev, &new_cci_dev->subdev);
-	CDBG("%s sd %p\n", __func__, &new_cci_dev->subdev);
-	if (pdev->dev.of_node)
-		of_property_read_u32((&pdev->dev)->of_node,
-			"cell-index", &pdev->id);
-
-	new_cci_dev->mem = platform_get_resource_byname(pdev,
-					IORESOURCE_MEM, "cci");
-	if (!new_cci_dev->mem) {
-		CDBG("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto cci_no_resource;
-	}
-	new_cci_dev->irq = platform_get_resource_byname(pdev,
-					IORESOURCE_IRQ, "cci");
-	CDBG("%s line %d cci irq start %d end %d\n", __func__,
-		__LINE__,
-		new_cci_dev->irq->start,
-		new_cci_dev->irq->end);
-	if (!new_cci_dev->irq) {
-		CDBG("%s: no irq resource?\n", __func__);
-		rc = -ENODEV;
-		goto cci_no_resource;
-	}
-	new_cci_dev->io = request_mem_region(new_cci_dev->mem->start,
-		resource_size(new_cci_dev->mem), pdev->name);
-	if (!new_cci_dev->io) {
-		CDBG("%s: no valid mem region\n", __func__);
-		rc = -EBUSY;
-		goto cci_no_resource;
-	}
-
-	new_cci_dev->base = ioremap(new_cci_dev->mem->start,
-		resource_size(new_cci_dev->mem));
-	if (!new_cci_dev->base) {
-		rc = -ENOMEM;
-		goto cci_release_mem;
-	}
-
-	sd_info.sdev_type = CCI_DEV;
-	sd_info.sd_index = pdev->id;
-	sd_info.irq_num = new_cci_dev->irq->start;
-	msm_cam_register_subdev_node(&new_cci_dev->subdev, &sd_info);
-
-	irq_req.cam_hw_idx       = MSM_CAM_HW_CCI;
-	irq_req.dev_name         = "msm_cci";
-	irq_req.irq_idx          = CAMERA_SS_IRQ_1;
-	irq_req.irq_num          = new_cci_dev->irq->start;
-	irq_req.is_composite     = 0;
-	irq_req.irq_trigger_type = IRQF_TRIGGER_RISING;
-	irq_req.num_hwcore       = 1;
-	irq_req.subdev_list[0]   = &new_cci_dev->subdev;
-	irq_req.data             = (void *)new_cci_dev;
-	rc = msm_cam_server_request_irq(&irq_req);
-	if (rc == -ENXIO) {
-		/* IRQ Router hardware is not present on this hardware.
-		 * Request for the IRQ and register the interrupt handler. */
-		rc = request_irq(new_cci_dev->irq->start, msm_cci_irq,
-			IRQF_TRIGGER_RISING, "cci", new_cci_dev);
-		if (rc < 0) {
-			CDBG("%s: irq request fail\n", __func__);
-			rc = -EBUSY;
-			goto cci_release_mem;
-		}
-		disable_irq(new_cci_dev->irq->start);
-	} else if (rc < 0) {
-		CDBG("%s Error registering irq ", __func__);
-		rc = -EBUSY;
-		goto cci_release_mem;
-	}
-
-	new_cci_dev->pdev = pdev;
-	msm_cci_initialize_cci_params(new_cci_dev);
-	rc = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
-	if (rc)
-		pr_err("%s: failed to add child nodes, rc=%d\n", __func__, rc);
-	CDBG("%s line %d\n", __func__, __LINE__);
-	return 0;
-
-cci_release_mem:
-	release_mem_region(new_cci_dev->mem->start,
-		resource_size(new_cci_dev->mem));
-cci_no_resource:
-	kfree(new_cci_dev);
-	return 0;
-}
-
-static int __exit msm_cci_exit(struct platform_device *pdev)
-{
-	struct v4l2_subdev *subdev = platform_get_drvdata(pdev);
-	struct cci_device *cci_dev =
-		v4l2_get_subdevdata(subdev);
-	release_mem_region(cci_dev->mem->start, resource_size(cci_dev->mem));
-	kfree(cci_dev);
-	return 0;
-}
-
-static const struct of_device_id msm_cci_dt_match[] = {
-	{.compatible = "qcom,cci"},
-	{}
-};
-
-MODULE_DEVICE_TABLE(of, msm_cci_dt_match);
-
-static struct platform_driver cci_driver = {
-	.probe = msm_cci_probe,
-	.remove = msm_cci_exit,
-	.driver = {
-		.name = MSM_CCI_DRV_NAME,
-		.owner = THIS_MODULE,
-		.of_match_table = msm_cci_dt_match,
-	},
-};
-
-static int __init msm_cci_init_module(void)
-{
-	return platform_driver_register(&cci_driver);
-}
-
-static void __exit msm_cci_exit_module(void)
-{
-	platform_driver_unregister(&cci_driver);
-}
-
-module_init(msm_cci_init_module);
-module_exit(msm_cci_exit_module);
-MODULE_DESCRIPTION("MSM CCI driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/cci/msm_cci.h b/drivers/media/video/msm/cci/msm_cci.h
deleted file mode 100644
index 827916d..0000000
--- a/drivers/media/video/msm/cci/msm_cci.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_CCI_H
-#define MSM_CCI_H
-
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <media/v4l2-subdev.h>
-#include <mach/camera.h>
-
-#define NUM_MASTERS 2
-#define NUM_QUEUES 2
-
-#define TRUE  1
-#define FALSE 0
-
-struct msm_camera_cci_master_info {
-	uint32_t status;
-	uint8_t reset_pending;
-	struct mutex mutex;
-	struct completion reset_complete;
-};
-
-struct cci_device {
-	struct platform_device *pdev;
-	struct v4l2_subdev subdev;
-	struct resource *mem;
-	struct resource *irq;
-	struct resource *io;
-	void __iomem *base;
-	uint32_t hw_version;
-	struct clk *cci_clk[5];
-	struct msm_camera_cci_i2c_queue_info
-		cci_i2c_queue_info[NUM_MASTERS][NUM_QUEUES];
-	struct msm_camera_cci_master_info cci_master_info[NUM_MASTERS];
-};
-
-enum msm_cci_i2c_cmd_type {
-	CCI_I2C_SET_PARAM_CMD = 1,
-	CCI_I2C_WAIT_CMD,
-	CCI_I2C_WAIT_SYNC_CMD,
-	CCI_I2C_WAIT_GPIO_EVENT_CMD,
-	CCI_I2C_TRIG_I2C_EVENT_CMD,
-	CCI_I2C_LOCK_CMD,
-	CCI_I2C_UNLOCK_CMD,
-	CCI_I2C_REPORT_CMD,
-	CCI_I2C_WRITE_CMD,
-	CCI_I2C_READ_CMD,
-	CCI_I2C_WRITE_DISABLE_P_CMD,
-	CCI_I2C_READ_DISABLE_P_CMD,
-	CCI_I2C_WRITE_CMD2,
-	CCI_I2C_WRITE_CMD3,
-	CCI_I2C_REPEAT_CMD,
-	CCI_I2C_INVALID_CMD,
-};
-
-enum msm_cci_gpio_cmd_type {
-	CCI_GPIO_SET_PARAM_CMD = 1,
-	CCI_GPIO_WAIT_CMD,
-	CCI_GPIO_WAIT_SYNC_CMD,
-	CCI_GPIO_WAIT_GPIO_IN_EVENT_CMD,
-	CCI_GPIO_WAIT_I2C_Q_TRIG_EVENT_CMD,
-	CCI_GPIO_OUT_CMD,
-	CCI_GPIO_TRIG_EVENT_CMD,
-	CCI_GPIO_REPORT_CMD,
-	CCI_GPIO_REPEAT_CMD,
-	CCI_GPIO_CONTINUE_CMD,
-	CCI_GPIO_INVALID_CMD,
-};
-
-#define VIDIOC_MSM_CCI_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 23, struct msm_camera_cci_ctrl *)
-
-#endif
-
diff --git a/drivers/media/video/msm/cpp/Makefile b/drivers/media/video/msm/cpp/Makefile
deleted file mode 100644
index b4f1fdf..0000000
--- a/drivers/media/video/msm/cpp/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-ccflags-y += -Idrivers/media/video/msm
-ccflags-y += -Idrivers/media/video/msm/io
-obj-$(CONFIG_MSM_CPP) += msm_cpp.o
-
diff --git a/drivers/media/video/msm/cpp/msm_cpp.c b/drivers/media/video/msm/cpp/msm_cpp.c
deleted file mode 100644
index cd932bd..0000000
--- a/drivers/media/video/msm/cpp/msm_cpp.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/module.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <mach/vreg.h>
-#include <media/msm_isp.h>
-#include <linux/proc_fs.h>
-#include <linux/debugfs.h>
-
-#include "msm_cpp.h"
-#include "msm.h"
-
-#define CONFIG_MSM_CPP_DBG 0
-
-#if CONFIG_MSM_CPP_DBG
-#define CPP_DBG(fmt, args...) pr_info(fmt, ##args)
-#else
-#define CPP_DBG(fmt, args...) pr_debug(fmt, ##args)
-#endif
-
-static int cpp_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
-{
-	uint32_t i;
-	struct cpp_device *cpp_dev = v4l2_get_subdevdata(sd);
-	CPP_DBG("%s\n", __func__);
-
-	mutex_lock(&cpp_dev->mutex);
-	if (cpp_dev->cpp_open_cnt == MAX_ACTIVE_CPP_INSTANCE) {
-		pr_err("No free CPP instance\n");
-		mutex_unlock(&cpp_dev->mutex);
-		return -ENODEV;
-	}
-
-	for (i = 0; i < MAX_ACTIVE_CPP_INSTANCE; i++) {
-		if (cpp_dev->cpp_subscribe_list[i].active == 0) {
-			cpp_dev->cpp_subscribe_list[i].active = 1;
-			cpp_dev->cpp_subscribe_list[i].vfh = &fh->vfh;
-			break;
-		}
-	}
-	if (i == MAX_ACTIVE_CPP_INSTANCE) {
-		pr_err("No free instance\n");
-		mutex_unlock(&cpp_dev->mutex);
-		return -ENODEV;
-	}
-
-	CPP_DBG("open %d %p\n", i, &fh->vfh);
-	cpp_dev->cpp_open_cnt++;
-	mutex_unlock(&cpp_dev->mutex);
-	return 0;
-}
-
-static int cpp_close_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
-{
-	uint32_t i;
-	struct cpp_device *cpp_dev = v4l2_get_subdevdata(sd);
-	mutex_lock(&cpp_dev->mutex);
-	for (i = 0; i < MAX_ACTIVE_CPP_INSTANCE; i++) {
-		if (cpp_dev->cpp_subscribe_list[i].vfh == &fh->vfh) {
-			cpp_dev->cpp_subscribe_list[i].active = 0;
-			cpp_dev->cpp_subscribe_list[i].vfh = NULL;
-			break;
-		}
-	}
-	if (i == MAX_ACTIVE_CPP_INSTANCE) {
-		pr_err("Invalid close\n");
-		mutex_unlock(&cpp_dev->mutex);
-		return -ENODEV;
-	}
-
-	CPP_DBG("close %d %p\n", i, &fh->vfh);
-	cpp_dev->cpp_open_cnt--;
-	mutex_unlock(&cpp_dev->mutex);
-	return 0;
-}
-
-static const struct v4l2_subdev_internal_ops msm_cpp_internal_ops = {
-	.open = cpp_open_node,
-	.close = cpp_close_node,
-};
-
-static int msm_cpp_notify_frame_done(struct cpp_device *cpp_dev)
-{
-	struct v4l2_event v4l2_evt;
-	struct msm_queue_cmd *frame_qcmd;
-	struct msm_queue_cmd *event_qcmd;
-	struct msm_cpp_frame_info_t *processed_frame;
-	struct msm_device_queue *queue = &cpp_dev->processing_q;
-
-	if (queue->len > 0) {
-		frame_qcmd = msm_dequeue(queue, list_frame);
-		processed_frame = frame_qcmd->command;
-
-		event_qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
-		if (!event_qcmd) {
-			pr_err("%s Insufficient memory. return", __func__);
-			return -ENOMEM;
-		}
-		atomic_set(&event_qcmd->on_heap, 1);
-		event_qcmd->command = processed_frame;
-		CPP_DBG("fid %d\n", processed_frame->frame_id);
-		msm_enqueue(&cpp_dev->eventData_q, &event_qcmd->list_eventdata);
-
-		v4l2_evt.id = processed_frame->inst_id;
-		v4l2_evt.type = V4L2_EVENT_CPP_FRAME_DONE;
-		v4l2_event_queue(cpp_dev->subdev.devnode, &v4l2_evt);
-	}
-	return 0;
-}
-
-static int msm_cpp_send_frame_to_hardware(struct cpp_device *cpp_dev)
-{
-	struct msm_queue_cmd *frame_qcmd;
-	struct msm_cpp_frame_info_t *process_frame;
-	struct msm_device_queue *queue;
-
-	if (cpp_dev->processing_q.len < MAX_CPP_PROCESSING_FRAME) {
-		while (cpp_dev->processing_q.len < MAX_CPP_PROCESSING_FRAME) {
-			if (cpp_dev->realtime_q.len != 0) {
-				queue = &cpp_dev->realtime_q;
-			} else if (cpp_dev->offline_q.len != 0) {
-				queue = &cpp_dev->offline_q;
-			} else {
-				pr_debug("%s: All frames queued\n", __func__);
-				break;
-			}
-			frame_qcmd = msm_dequeue(queue, list_frame);
-			/*TBD Code to actually sending to harware*/
-			process_frame = frame_qcmd->command;
-
-			msm_enqueue(&cpp_dev->processing_q,
-						&frame_qcmd->list_frame);
-		}
-	}
-	return 0;
-}
-
-long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int cmd, void *arg)
-{
-	struct cpp_device *cpp_dev = v4l2_get_subdevdata(sd);
-	struct msm_camera_v4l2_ioctl_t *ioctl_ptr = arg;
-	int rc = 0;
-
-	CPP_DBG("%s: %d\n", __func__, __LINE__);
-	mutex_lock(&cpp_dev->mutex);
-	CPP_DBG("%s cmd: %d\n", __func__, cmd);
-	switch (cmd) {
-	case VIDIOC_MSM_CPP_CFG: {
-		struct msm_queue_cmd *frame_qcmd;
-		struct msm_cpp_frame_info_t *new_frame =
-			kzalloc(sizeof(struct msm_cpp_frame_info_t),
-					GFP_KERNEL);
-		if (!new_frame) {
-			pr_err("%s Insufficient memory. return", __func__);
-			mutex_unlock(&cpp_dev->mutex);
-			return -ENOMEM;
-		}
-
-		COPY_FROM_USER(rc, new_frame,
-			       (void __user *)ioctl_ptr->ioctl_ptr,
-			       sizeof(struct msm_cpp_frame_info_t));
-		if (rc) {
-			ERR_COPY_FROM_USER();
-			kfree(new_frame);
-			mutex_unlock(&cpp_dev->mutex);
-			return -EINVAL;
-		}
-
-		frame_qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
-		if (!frame_qcmd) {
-			pr_err("%s Insufficient memory. return", __func__);
-			kfree(new_frame);
-			mutex_unlock(&cpp_dev->mutex);
-			return -ENOMEM;
-		}
-
-		atomic_set(&frame_qcmd->on_heap, 1);
-		frame_qcmd->command = new_frame;
-		if (new_frame->frame_type == MSM_CPP_REALTIME_FRAME) {
-			msm_enqueue(&cpp_dev->realtime_q,
-						&frame_qcmd->list_frame);
-		} else if (new_frame->frame_type == MSM_CPP_OFFLINE_FRAME) {
-			msm_enqueue(&cpp_dev->offline_q,
-						&frame_qcmd->list_frame);
-		} else {
-			pr_err("%s: Invalid frame type\n", __func__);
-			kfree(new_frame);
-			kfree(frame_qcmd);
-			mutex_unlock(&cpp_dev->mutex);
-			return -EINVAL;
-		}
-		break;
-	}
-	case VIDIOC_MSM_CPP_GET_EVENTPAYLOAD: {
-		struct msm_device_queue *queue = &cpp_dev->eventData_q;
-		struct msm_queue_cmd *event_qcmd;
-		struct msm_cpp_frame_info_t *process_frame;
-		event_qcmd = msm_dequeue(queue, list_eventdata);
-		process_frame = event_qcmd->command;
-		CPP_DBG("fid %d\n", process_frame->frame_id);
-		if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
-				process_frame,
-				sizeof(struct msm_cpp_frame_info_t))) {
-					mutex_unlock(&cpp_dev->mutex);
-					return -EINVAL;
-		}
-		kfree(process_frame);
-		kfree(event_qcmd);
-		break;
-	}
-	}
-	mutex_unlock(&cpp_dev->mutex);
-	CPP_DBG("%s: %d\n", __func__, __LINE__);
-	return 0;
-}
-
-int msm_cpp_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
-	struct v4l2_event_subscription *sub)
-{
-	CPP_DBG("%s\n", __func__);
-	return v4l2_event_subscribe(fh, sub, MAX_CPP_V4l2_EVENTS);
-}
-
-int msm_cpp_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
-	struct v4l2_event_subscription *sub)
-{
-	CPP_DBG("%s\n", __func__);
-	return v4l2_event_unsubscribe(fh, sub);
-}
-
-static struct v4l2_subdev_core_ops msm_cpp_subdev_core_ops = {
-	.ioctl = msm_cpp_subdev_ioctl,
-	.subscribe_event = msm_cpp_subscribe_event,
-	.unsubscribe_event = msm_cpp_unsubscribe_event,
-};
-
-static const struct v4l2_subdev_ops msm_cpp_subdev_ops = {
-	.core = &msm_cpp_subdev_core_ops,
-};
-
-static int msm_cpp_enable_debugfs(struct cpp_device *cpp_dev);
-
-static struct v4l2_file_operations msm_cpp_v4l2_subdev_fops;
-
-static long msm_cpp_subdev_do_ioctl(
-	struct file *file, unsigned int cmd, void *arg)
-{
-	struct video_device *vdev = video_devdata(file);
-	struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
-	struct v4l2_fh *vfh = file->private_data;
-
-	switch (cmd) {
-	case VIDIOC_DQEVENT:
-		if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS))
-			return -ENOIOCTLCMD;
-
-		return v4l2_event_dequeue(vfh, arg, file->f_flags & O_NONBLOCK);
-
-	case VIDIOC_SUBSCRIBE_EVENT:
-		return v4l2_subdev_call(sd, core, subscribe_event, vfh, arg);
-
-	case VIDIOC_UNSUBSCRIBE_EVENT:
-		return v4l2_subdev_call(sd, core, unsubscribe_event, vfh, arg);
-
-	case VIDIOC_MSM_CPP_GET_INST_INFO: {
-		uint32_t i;
-		struct cpp_device *cpp_dev = v4l2_get_subdevdata(sd);
-		struct msm_camera_v4l2_ioctl_t *ioctl_ptr = arg;
-		struct msm_cpp_frame_info_t inst_info;
-		for (i = 0; i < MAX_ACTIVE_CPP_INSTANCE; i++) {
-			if (cpp_dev->cpp_subscribe_list[i].vfh == vfh) {
-				inst_info.inst_id = i;
-				break;
-			}
-		}
-		if (copy_to_user(
-				(void __user *)ioctl_ptr->ioctl_ptr, &inst_info,
-				sizeof(struct msm_cpp_frame_info_t))) {
-			return -EINVAL;
-		}
-	}
-	break;
-	default:
-		return v4l2_subdev_call(sd, core, ioctl, cmd, arg);
-	}
-
-	return 0;
-}
-
-static long msm_cpp_subdev_fops_ioctl(struct file *file, unsigned int cmd,
-	unsigned long arg)
-{
-	return video_usercopy(file, cmd, arg, msm_cpp_subdev_do_ioctl);
-}
-
-static int __devinit cpp_probe(struct platform_device *pdev)
-{
-	struct cpp_device *cpp_dev;
-	struct msm_cam_subdev_info sd_info;
-	int rc = 0;
-	CDBG("%s: device id = %d\n", __func__, pdev->id);
-	cpp_dev = kzalloc(sizeof(struct cpp_device), GFP_KERNEL);
-	if (!cpp_dev) {
-		pr_err("%s: no enough memory\n", __func__);
-		return -ENOMEM;
-	}
-	v4l2_subdev_init(&cpp_dev->subdev, &msm_cpp_subdev_ops);
-	cpp_dev->subdev.internal_ops = &msm_cpp_internal_ops;
-	snprintf(cpp_dev->subdev.name, ARRAY_SIZE(cpp_dev->subdev.name),
-		 "cpp");
-	cpp_dev->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	cpp_dev->subdev.flags |= V4L2_SUBDEV_FL_HAS_EVENTS;
-	v4l2_set_subdevdata(&cpp_dev->subdev, cpp_dev);
-	platform_set_drvdata(pdev, &cpp_dev->subdev);
-	mutex_init(&cpp_dev->mutex);
-
-	cpp_dev->pdev = pdev;
-
-	media_entity_init(&cpp_dev->subdev.entity, 0, NULL, 0);
-	cpp_dev->subdev.entity.type = MEDIA_ENT_T_DEVNODE_V4L;
-	cpp_dev->subdev.entity.group_id = CPP_DEV;
-	cpp_dev->subdev.entity.name = pdev->name;
-	sd_info.sdev_type = CPP_DEV;
-	sd_info.sd_index = pdev->id;
-	msm_cam_register_subdev_node(&cpp_dev->subdev, &sd_info);
-	msm_cpp_v4l2_subdev_fops.owner = v4l2_subdev_fops.owner;
-	msm_cpp_v4l2_subdev_fops.open = v4l2_subdev_fops.open;
-	msm_cpp_v4l2_subdev_fops.unlocked_ioctl = msm_cpp_subdev_fops_ioctl;
-	msm_cpp_v4l2_subdev_fops.release = v4l2_subdev_fops.release;
-	msm_cpp_v4l2_subdev_fops.poll = v4l2_subdev_fops.poll;
-
-	cpp_dev->subdev.devnode->fops = &msm_cpp_v4l2_subdev_fops;
-	cpp_dev->subdev.entity.revision = cpp_dev->subdev.devnode->num;
-	msm_cpp_enable_debugfs(cpp_dev);
-	msm_queue_init(&cpp_dev->eventData_q, "eventdata");
-	msm_queue_init(&cpp_dev->offline_q, "frame");
-	msm_queue_init(&cpp_dev->realtime_q, "frame");
-	msm_queue_init(&cpp_dev->processing_q, "frame");
-	cpp_dev->cpp_open_cnt = 0;
-
-	return rc;
-}
-
-static struct platform_driver cpp_driver = {
-	.probe = cpp_probe,
-	.driver = {
-		.name = MSM_CPP_DRV_NAME,
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init msm_cpp_init_module(void)
-{
-	return platform_driver_register(&cpp_driver);
-}
-
-static void __exit msm_cpp_exit_module(void)
-{
-	platform_driver_unregister(&cpp_driver);
-}
-
-static int msm_cpp_debugfs_stream_s(void *data, u64 val)
-{
-	struct cpp_device *cpp_dev = data;
-	CPP_DBG("CPP processing frame E\n");
-	while (1) {
-		mutex_lock(&cpp_dev->mutex);
-		msm_cpp_notify_frame_done(cpp_dev);
-		msm_cpp_send_frame_to_hardware(cpp_dev);
-		mutex_unlock(&cpp_dev->mutex);
-		msleep(20);
-	}
-	CPP_DBG("CPP processing frame X\n");
-	return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(cpp_debugfs_stream, NULL,
-			msm_cpp_debugfs_stream_s, "%llu\n");
-
-static int msm_cpp_enable_debugfs(struct cpp_device *cpp_dev)
-{
-	struct dentry *debugfs_base;
-	debugfs_base = debugfs_create_dir("msm_camera", NULL);
-	if (!debugfs_base)
-		return -ENOMEM;
-
-	if (!debugfs_create_file("test", S_IRUGO | S_IWUSR, debugfs_base,
-			(void *)cpp_dev, &cpp_debugfs_stream))
-		return -ENOMEM;
-
-	return 0;
-}
-
-module_init(msm_cpp_init_module);
-module_exit(msm_cpp_exit_module);
-MODULE_DESCRIPTION("MSM CPP driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/cpp/msm_cpp.h b/drivers/media/video/msm/cpp/msm_cpp.h
deleted file mode 100644
index f585569..0000000
--- a/drivers/media/video/msm/cpp/msm_cpp.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/list.h>
-#include <media/v4l2-subdev.h>
-
-#define MAX_ACTIVE_CPP_INSTANCE 8
-#define MAX_CPP_PROCESSING_FRAME 2
-#define MAX_CPP_V4l2_EVENTS 30
-
-#define MSM_CPP_MICRO_BASE          0x4000
-#define MSM_CPP_MICRO_HW_VERSION    0x0000
-#define MSM_CPP_MICRO_IRQGEN_STAT   0x0004
-#define MSM_CPP_MICRO_IRQGEN_CLR    0x0008
-#define MSM_CPP_MICRO_IRQGEN_MASK   0x000C
-#define MSM_CPP_MICRO_FIFO_TX_DATA  0x0010
-#define MSM_CPP_MICRO_FIFO_TX_STAT  0x0014
-#define MSM_CPP_MICRO_FIFO_RX_DATA  0x0018
-#define MSM_CPP_MICRO_FIFO_RX_STAT  0x001C
-#define MSM_CPP_MICRO_BOOT_START    0x0020
-#define MSM_CPP_MICRO_BOOT_LDORG    0x0024
-#define MSM_CPP_MICRO_CLKEN_CTL     0x0030
-
-struct cpp_subscribe_info {
-	struct v4l2_fh *vfh;
-	uint32_t active;
-};
-
-struct cpp_device {
-	struct platform_device *pdev;
-	struct v4l2_subdev subdev;
-	struct resource *mem;
-	struct resource *irq;
-	struct resource *io;
-	void __iomem *base;
-	struct clk *cpp_clk[2];
-	struct mutex mutex;
-
-	struct cpp_subscribe_info cpp_subscribe_list[MAX_ACTIVE_CPP_INSTANCE];
-	uint32_t cpp_open_cnt;
-
-	struct msm_device_queue eventData_q; /*V4L2 Event Payload Queue*/
-
-	/*Offline Frame Queue
-	  process when realtime queue is empty*/
-	struct msm_device_queue offline_q;
-	/*Realtime Frame Queue
-	  process with highest priority*/
-	struct msm_device_queue realtime_q;
-	/*Processing Queue
-	  store frame info for frames sent to microcontroller*/
-	struct msm_device_queue processing_q;
-};
-
diff --git a/drivers/media/video/msm/csi/Makefile b/drivers/media/video/msm/csi/Makefile
index 5aaaff7..6e8eb122 100644
--- a/drivers/media/video/msm/csi/Makefile
+++ b/drivers/media/video/msm/csi/Makefile
@@ -1,15 +1,4 @@
 GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-ccflags-y += -Idrivers/media/video/msm -Idrivers/media/video/msm/server
-ifeq ($(CONFIG_MSM_CSI20_HEADER),y)
-  ccflags-y += -Idrivers/media/video/msm/csi/include/csi2.0
-else ifeq ($(CONFIG_MSM_CSI30_HEADER),y)
-  ccflags-y += -Idrivers/media/video/msm/csi/include/csi3.0
-endif
-obj-$(CONFIG_MSM_CSI2_REGISTER) += msm_csi2_register.o
-obj-$(CONFIG_MSM_CSIPHY) += msm_csiphy.o
-obj-$(CONFIG_MSM_CSID) += msm_csid.o
-obj-$(CONFIG_MSM_ISPIF) += msm_ispif.o
-obj-$(CONFIG_ARCH_MSM8960) += msm_csi2_register.o msm_csiphy.o msm_csid.o msm_ispif.o
-obj-$(CONFIG_ARCH_MSM7X27A) += msm_csic_register.o msm_csic.o
-obj-$(CONFIG_ARCH_MSM8X60) += msm_csic_register.o msm_csic.o
-obj-$(CONFIG_ARCH_MSM7X30) += msm_csic_register.o msm_csic.o
+EXTRA_CFLAGS += -Idrivers/media/video/msm
+obj-$(CONFIG_ARCH_MSM8960) += msm_csiphy.o msm_csid.o msm_ispif.o
+obj-$(CONFIG_ARCH_MSM7X27A) += msm_csic.o
diff --git a/drivers/media/video/msm/csi/include/csi2.0/msm_csid_hwreg.h b/drivers/media/video/msm/csi/include/csi2.0/msm_csid_hwreg.h
deleted file mode 100644
index cc8a9cf..0000000
--- a/drivers/media/video/msm/csi/include/csi2.0/msm_csid_hwreg.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_CSID_HWREG_H
-#define MSM_CSID_HWREG_H
-
-/* MIPI	CSID registers */
-#define CSID_HW_VERSION_ADDR                        0x0
-#define CSID_CORE_CTRL_0_ADDR                       0x4
-#define CSID_CORE_CTRL_1_ADDR                       0x4
-#define CSID_RST_CMD_ADDR                           0x8
-#define CSID_CID_LUT_VC_0_ADDR                      0xc
-#define CSID_CID_LUT_VC_1_ADDR                      0x10
-#define CSID_CID_LUT_VC_2_ADDR                      0x14
-#define CSID_CID_LUT_VC_3_ADDR                      0x18
-#define CSID_CID_n_CFG_ADDR                         0x1C
-#define CSID_IRQ_CLEAR_CMD_ADDR                     0x5c
-#define CSID_IRQ_MASK_ADDR                          0x60
-#define CSID_IRQ_STATUS_ADDR                        0x64
-#define CSID_CAPTURED_UNMAPPED_LONG_PKT_HDR_ADDR    0x68
-#define CSID_CAPTURED_MMAPPED_LONG_PKT_HDR_ADDR     0x6c
-#define CSID_CAPTURED_SHORT_PKT_ADDR                0x70
-#define CSID_CAPTURED_LONG_PKT_HDR_ADDR             0x74
-#define CSID_CAPTURED_LONG_PKT_FTR_ADDR             0x78
-#define CSID_PIF_MISR_DL0_ADDR                      0x7C
-#define CSID_PIF_MISR_DL1_ADDR                      0x80
-#define CSID_PIF_MISR_DL2_ADDR                      0x84
-#define CSID_PIF_MISR_DL3_ADDR                      0x88
-#define CSID_STATS_TOTAL_PKTS_RCVD_ADDR             0x8C
-#define CSID_STATS_ECC_ADDR                         0x90
-#define CSID_STATS_CRC_ADDR                         0x94
-#define CSID_TG_CTRL_ADDR                           0x9C
-#define CSID_TG_VC_CFG_ADDR                         0xA0
-#define CSID_TG_DT_n_CFG_0_ADDR                     0xA8
-#define CSID_TG_DT_n_CFG_1_ADDR                     0xAC
-#define CSID_TG_DT_n_CFG_2_ADDR                     0xB0
-#define CSID_RST_DONE_IRQ_BITSHIFT                  11
-#define CSID_RST_STB_ALL                            0x7FFF
-#define CSID_DL_INPUT_SEL_SHIFT                     0x2
-#define CSID_PHY_SEL_SHIFT                          17
-#define CSID_VERSION                                0x02000011
-
-#endif
diff --git a/drivers/media/video/msm/csi/include/csi2.0/msm_csiphy_hwreg.h b/drivers/media/video/msm/csi/include/csi2.0/msm_csiphy_hwreg.h
deleted file mode 100644
index 9263483..0000000
--- a/drivers/media/video/msm/csi/include/csi2.0/msm_csiphy_hwreg.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_CSIPHY_HWREG_H
-#define MSM_CSIPHY_HWREG_H
-
-/*MIPI CSI PHY registers*/
-#define MIPI_CSIPHY_HW_VERSION_ADDR              0x180
-#define MIPI_CSIPHY_LNn_CFG1_ADDR                0x0
-#define MIPI_CSIPHY_LNn_CFG2_ADDR                0x4
-#define MIPI_CSIPHY_LNn_CFG3_ADDR                0x8
-#define MIPI_CSIPHY_LNn_CFG4_ADDR                0xC
-#define MIPI_CSIPHY_LNn_CFG5_ADDR                0x10
-#define MIPI_CSIPHY_LNCK_CFG1_ADDR               0x100
-#define MIPI_CSIPHY_LNCK_CFG2_ADDR               0x104
-#define MIPI_CSIPHY_LNCK_CFG3_ADDR               0x108
-#define MIPI_CSIPHY_LNCK_CFG4_ADDR               0x10C
-#define MIPI_CSIPHY_LNCK_CFG5_ADDR               0x110
-#define MIPI_CSIPHY_LNCK_MISC1_ADDR              0x128
-#define MIPI_CSIPHY_GLBL_RESET_ADDR              0x140
-#define MIPI_CSIPHY_GLBL_PWR_CFG_ADDR            0x144
-#define MIPI_CSIPHY_GLBL_IRQ_CMD_ADDR            0x164
-#define MIPI_CSIPHY_INTERRUPT_STATUS0_ADDR       0x180
-#define MIPI_CSIPHY_INTERRUPT_MASK0_ADDR         0x1A0
-#define MIPI_CSIPHY_INTERRUPT_MASK_VAL           0x6F
-#define MIPI_CSIPHY_INTERRUPT_MASK_ADDR          0x1A4
-#define MIPI_CSIPHY_INTERRUPT_CLEAR0_ADDR        0x1C0
-#define MIPI_CSIPHY_INTERRUPT_CLEAR_ADDR         0x1C4
-#define MIPI_CSIPHY_MODE_CONFIG_SHIFT            0x4
-#define MIPI_CSIPHY_GLBL_T_INIT_CFG0_ADDR        0x1E0
-#define MIPI_CSIPHY_T_WAKEUP_CFG0_ADDR           0x1E8
-#define CSIPHY_VERSION                           0x0
-
-#endif
diff --git a/drivers/media/video/msm/csi/include/csi2.0/msm_ispif_hwreg.h b/drivers/media/video/msm/csi/include/csi2.0/msm_ispif_hwreg.h
deleted file mode 100644
index 1864d40..0000000
--- a/drivers/media/video/msm/csi/include/csi2.0/msm_ispif_hwreg.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_ISPIF_HWREG_H
-#define MSM_ISPIF_HWREG_H
-
-
-/* ISPIF registers */
-
-#define ISPIF_RST_CMD_ADDR                        0x00
-#define ISPIF_RST_CMD_1_ADDR                      0x00
-#define ISPIF_INTF_CMD_ADDR                       0x04
-#define ISPIF_INTF_CMD_1_ADDR                     0x30
-#define ISPIF_CTRL_ADDR                           0x08
-#define ISPIF_INPUT_SEL_ADDR                      0x0C
-#define ISPIF_PIX_0_INTF_CID_MASK_ADDR            0x10
-#define ISPIF_RDI_0_INTF_CID_MASK_ADDR            0x14
-#define ISPIF_PIX_1_INTF_CID_MASK_ADDR            0x38
-#define ISPIF_RDI_1_INTF_CID_MASK_ADDR            0x3C
-#define ISPIF_RDI_2_INTF_CID_MASK_ADDR            0x44
-#define ISPIF_PIX_0_STATUS_ADDR                   0x24
-#define ISPIF_RDI_0_STATUS_ADDR                   0x28
-#define ISPIF_PIX_1_STATUS_ADDR                   0x60
-#define ISPIF_RDI_1_STATUS_ADDR                   0x64
-#define ISPIF_RDI_2_STATUS_ADDR                   0x6C
-#define ISPIF_IRQ_MASK_ADDR                     0x0100
-#define ISPIF_IRQ_CLEAR_ADDR                    0x0104
-#define ISPIF_IRQ_STATUS_ADDR                   0x0108
-#define ISPIF_IRQ_MASK_1_ADDR                   0x010C
-#define ISPIF_IRQ_CLEAR_1_ADDR                  0x0110
-#define ISPIF_IRQ_STATUS_1_ADDR                 0x0114
-#define ISPIF_IRQ_MASK_2_ADDR                   0x0118
-#define ISPIF_IRQ_CLEAR_2_ADDR                  0x011C
-#define ISPIF_IRQ_STATUS_2_ADDR                 0x0120
-#define ISPIF_IRQ_GLOBAL_CLEAR_CMD_ADDR         0x0124
-
-/*ISPIF RESET BITS*/
-
-#define VFE_CLK_DOMAIN_RST           31
-#define RDI_CLK_DOMAIN_RST           30
-#define PIX_CLK_DOMAIN_RST           29
-#define AHB_CLK_DOMAIN_RST           28
-#define RDI_1_CLK_DOMAIN_RST         27
-#define RDI_2_VFE_RST_STB            19
-#define RDI_2_CSID_RST_STB           18
-#define RDI_1_VFE_RST_STB            13
-#define RDI_1_CSID_RST_STB           12
-#define RDI_0_VFE_RST_STB            7
-#define RDI_0_CSID_RST_STB           6
-#define PIX_1_VFE_RST_STB            10
-#define PIX_1_CSID_RST_STB           9
-#define PIX_0_VFE_RST_STB            4
-#define PIX_0_CSID_RST_STB           3
-#define SW_REG_RST_STB               2
-#define MISC_LOGIC_RST_STB           1
-#define STROBED_RST_EN               0
-
-#define ISPIF_RST_CMD_MASK           0xFE0F1FFF
-#define ISPIF_RST_CMD_1_MASK         0xFC0F1FF9
-
-#define PIX_INTF_0_OVERFLOW_IRQ      12
-#define RAW_INTF_0_OVERFLOW_IRQ      25
-#define RAW_INTF_1_OVERFLOW_IRQ      25
-#define RAW_INTF_2_OVERFLOW_IRQ      12
-#define RESET_DONE_IRQ               27
-
-#define ISPIF_IRQ_STATUS_MASK        0x0A493249
-#define ISPIF_IRQ_STATUS_1_MASK      0x02493249
-#define ISPIF_IRQ_STATUS_2_MASK      0x00001249
-
-#define ISPIF_IRQ_STATUS_PIX_SOF_MASK	0x249
-#define ISPIF_IRQ_STATUS_RDI0_SOF_MASK	0x492000
-#define ISPIF_IRQ_STATUS_RDI1_SOF_MASK	0x492000
-#define ISPIF_IRQ_STATUS_RDI2_SOF_MASK	0x249
-
-#define ISPIF_IRQ_STATUS_SOF_MASK	0x492249
-#define ISPIF_IRQ_GLOBAL_CLEAR_CMD     0x1
-
-#endif
diff --git a/drivers/media/video/msm/csi/include/csi3.0/msm_csid_hwreg.h b/drivers/media/video/msm/csi/include/csi3.0/msm_csid_hwreg.h
deleted file mode 100644
index 7f35c2c..0000000
--- a/drivers/media/video/msm/csi/include/csi3.0/msm_csid_hwreg.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_CSID_HWREG_H
-#define MSM_CSID_HWREG_H
-
-/* MIPI	CSID registers */
-#define CSID_HW_VERSION_ADDR                        0x0
-#define CSID_CORE_CTRL_0_ADDR                       0x4
-#define CSID_CORE_CTRL_1_ADDR                       0x8
-#define CSID_RST_CMD_ADDR                           0xC
-#define CSID_CID_LUT_VC_0_ADDR                      0x10
-#define CSID_CID_LUT_VC_1_ADDR                      0x14
-#define CSID_CID_LUT_VC_2_ADDR                      0x18
-#define CSID_CID_LUT_VC_3_ADDR                      0x1C
-#define CSID_CID_n_CFG_ADDR                         0x20
-#define CSID_IRQ_CLEAR_CMD_ADDR                     0x60
-#define CSID_IRQ_MASK_ADDR                          0x64
-#define CSID_IRQ_STATUS_ADDR                        0x68
-#define CSID_CAPTURED_UNMAPPED_LONG_PKT_HDR_ADDR    0x6C
-#define CSID_CAPTURED_MMAPPED_LONG_PKT_HDR_ADDR     0x70
-#define CSID_CAPTURED_SHORT_PKT_ADDR                0x74
-#define CSID_CAPTURED_LONG_PKT_HDR_ADDR             0x78
-#define CSID_CAPTURED_LONG_PKT_FTR_ADDR             0x7C
-#define CSID_PIF_MISR_DL0_ADDR                      0x80
-#define CSID_PIF_MISR_DL1_ADDR                      0x84
-#define CSID_PIF_MISR_DL2_ADDR                      0x88
-#define CSID_PIF_MISR_DL3_ADDR                      0x8C
-#define CSID_STATS_TOTAL_PKTS_RCVD_ADDR             0x90
-#define CSID_STATS_ECC_ADDR                         0x94
-#define CSID_STATS_CRC_ADDR                         0x98
-#define CSID_TG_CTRL_ADDR                           0xA0
-#define CSID_TG_VC_CFG_ADDR                         0xA4
-#define CSID_TG_DT_n_CFG_0_ADDR                     0xAC
-#define CSID_TG_DT_n_CFG_1_ADDR                     0xB0
-#define CSID_TG_DT_n_CFG_2_ADDR                     0xB4
-#define CSID_RST_DONE_IRQ_BITSHIFT                  11
-#define CSID_RST_STB_ALL                            0x7FFF
-#define CSID_DL_INPUT_SEL_SHIFT                     0x4
-#define CSID_PHY_SEL_SHIFT                          17
-#define CSID_VERSION                                0x30000000
-
-#endif
diff --git a/drivers/media/video/msm/csi/include/csi3.0/msm_csiphy_hwreg.h b/drivers/media/video/msm/csi/include/csi3.0/msm_csiphy_hwreg.h
deleted file mode 100644
index c290731..0000000
--- a/drivers/media/video/msm/csi/include/csi3.0/msm_csiphy_hwreg.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_CSIPHY_HWREG_H
-#define MSM_CSIPHY_HWREG_H
-
-/*MIPI CSI PHY registers*/
-#define MIPI_CSIPHY_LNn_CFG1_ADDR                0x0
-#define MIPI_CSIPHY_LNn_CFG2_ADDR                0x4
-#define MIPI_CSIPHY_LNn_CFG3_ADDR                0x8
-#define MIPI_CSIPHY_LNn_CFG4_ADDR                0xC
-#define MIPI_CSIPHY_LNn_CFG5_ADDR                0x10
-#define MIPI_CSIPHY_LNCK_CFG1_ADDR               0x100
-#define MIPI_CSIPHY_LNCK_CFG2_ADDR               0x104
-#define MIPI_CSIPHY_LNCK_CFG3_ADDR               0x108
-#define MIPI_CSIPHY_LNCK_CFG4_ADDR               0x10C
-#define MIPI_CSIPHY_LNCK_CFG5_ADDR               0x110
-#define MIPI_CSIPHY_LNCK_MISC1_ADDR              0x128
-#define MIPI_CSIPHY_GLBL_RESET_ADDR              0x140
-#define MIPI_CSIPHY_GLBL_PWR_CFG_ADDR            0x144
-#define MIPI_CSIPHY_GLBL_IRQ_CMD_ADDR            0x164
-#define MIPI_CSIPHY_HW_VERSION_ADDR              0x188
-#define MIPI_CSIPHY_INTERRUPT_STATUS0_ADDR       0x18C
-#define MIPI_CSIPHY_INTERRUPT_MASK0_ADDR         0x1AC
-#define MIPI_CSIPHY_INTERRUPT_MASK_VAL           0x3F
-#define MIPI_CSIPHY_INTERRUPT_MASK_ADDR          0x1AC
-#define MIPI_CSIPHY_INTERRUPT_CLEAR0_ADDR        0x1CC
-#define MIPI_CSIPHY_INTERRUPT_CLEAR_ADDR         0x1CC
-#define MIPI_CSIPHY_MODE_CONFIG_SHIFT            0x4
-#define MIPI_CSIPHY_GLBL_T_INIT_CFG0_ADDR        0x1EC
-#define MIPI_CSIPHY_T_WAKEUP_CFG0_ADDR           0x1F4
-#define CSIPHY_VERSION                           0x10
-
-#endif
diff --git a/drivers/media/video/msm/csi/include/csi3.0/msm_ispif_hwreg.h b/drivers/media/video/msm/csi/include/csi3.0/msm_ispif_hwreg.h
deleted file mode 100644
index 4b69dda..0000000
--- a/drivers/media/video/msm/csi/include/csi3.0/msm_ispif_hwreg.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_ISPIF_HWREG_H
-#define MSM_ISPIF_HWREG_H
-
-
-/* ISPIF registers */
-
-#define ISPIF_RST_CMD_ADDR                        0x08
-#define ISPIF_RST_CMD_1_ADDR                      0x0C
-#define ISPIF_INTF_CMD_ADDR                      0x248
-#define ISPIF_INTF_CMD_1_ADDR                    0x24C
-#define ISPIF_CTRL_ADDR                           0x08
-#define ISPIF_INPUT_SEL_ADDR                     0x244
-#define ISPIF_PIX_0_INTF_CID_MASK_ADDR           0x254
-#define ISPIF_RDI_0_INTF_CID_MASK_ADDR           0x264
-#define ISPIF_PIX_1_INTF_CID_MASK_ADDR           0x258
-#define ISPIF_RDI_1_INTF_CID_MASK_ADDR           0x268
-#define ISPIF_RDI_2_INTF_CID_MASK_ADDR           0x26C
-#define ISPIF_PIX_0_STATUS_ADDR                  0x2C0
-#define ISPIF_RDI_0_STATUS_ADDR                  0x2D0
-#define ISPIF_PIX_1_STATUS_ADDR                  0x2C4
-#define ISPIF_RDI_1_STATUS_ADDR                  0x2D4
-#define ISPIF_RDI_2_STATUS_ADDR                  0x2D8
-#define ISPIF_IRQ_MASK_ADDR                      0x208
-#define ISPIF_IRQ_CLEAR_ADDR                     0x230
-#define ISPIF_IRQ_STATUS_ADDR                    0x21C
-#define ISPIF_IRQ_MASK_1_ADDR                    0x20C
-#define ISPIF_IRQ_CLEAR_1_ADDR                   0x234
-#define ISPIF_IRQ_STATUS_1_ADDR                  0x220
-#define ISPIF_IRQ_MASK_2_ADDR                    0x210
-#define ISPIF_IRQ_CLEAR_2_ADDR                   0x238
-#define ISPIF_IRQ_STATUS_2_ADDR                  0x224
-#define ISPIF_IRQ_GLOBAL_CLEAR_CMD_ADDR           0x1C
-
-/* new */
-#define ISPIF_VFE_m_CTRL_0_ADDR                  0x200
-#define ISPIF_VFE_m_IRQ_MASK_0                   0x208
-#define ISPIF_VFE_m_IRQ_MASK_1                   0x20C
-#define ISPIF_VFE_m_IRQ_MASK_2                   0x210
-#define ISPIF_VFE_m_IRQ_STATUS_0                 0x21C
-#define ISPIF_VFE_m_IRQ_STATUS_1                 0x220
-#define ISPIF_VFE_m_IRQ_STATUS_2                 0x224
-#define ISPIF_VFE_m_IRQ_CLEAR_0                  0x230
-#define ISPIF_VFE_m_IRQ_CLEAR_1                  0x234
-#define ISPIF_VFE_m_IRQ_CLEAR_2                  0x238
-
-/*ISPIF RESET BITS*/
-
-#define VFE_CLK_DOMAIN_RST           31
-#define RDI_CLK_DOMAIN_RST           26
-#define RDI_1_CLK_DOMAIN_RST         27
-#define RDI_2_CLK_DOMAIN_RST         28
-#define PIX_CLK_DOMAIN_RST           29
-#define PIX_1_CLK_DOMAIN_RST         30
-#define AHB_CLK_DOMAIN_RST           25
-#define RDI_2_VFE_RST_STB            12
-#define RDI_2_CSID_RST_STB           11
-#define RDI_1_VFE_RST_STB            10
-#define RDI_1_CSID_RST_STB           9
-#define RDI_0_VFE_RST_STB            8
-#define RDI_0_CSID_RST_STB           7
-#define PIX_1_VFE_RST_STB            6
-#define PIX_1_CSID_RST_STB           5
-#define PIX_0_VFE_RST_STB            4
-#define PIX_0_CSID_RST_STB           3
-#define SW_REG_RST_STB               2
-#define MISC_LOGIC_RST_STB           1
-#define STROBED_RST_EN               0
-
-#define ISPIF_RST_CMD_MASK           0xFE0F1FFF
-#define ISPIF_RST_CMD_1_MASK         0xFC0F1FF9
-
-#define PIX_INTF_0_OVERFLOW_IRQ      12
-#define RAW_INTF_0_OVERFLOW_IRQ      25
-#define RAW_INTF_1_OVERFLOW_IRQ      25
-#define RAW_INTF_2_OVERFLOW_IRQ      12
-#define RESET_DONE_IRQ               27
-
-#define ISPIF_IRQ_STATUS_MASK        0x0A493249
-#define ISPIF_IRQ_STATUS_1_MASK      0x02493249
-#define ISPIF_IRQ_STATUS_2_MASK      0x00001249
-
-#define ISPIF_IRQ_STATUS_PIX_SOF_MASK	0x249
-#define ISPIF_IRQ_STATUS_RDI0_SOF_MASK	0x492000
-#define ISPIF_IRQ_STATUS_RDI1_SOF_MASK	0x492000
-#define ISPIF_IRQ_STATUS_RDI2_SOF_MASK	0x249
-
-#define ISPIF_IRQ_STATUS_SOF_MASK	0x492249
-#define ISPIF_IRQ_GLOBAL_CLEAR_CMD     0x1
-
-#endif
diff --git a/drivers/media/video/msm/csi/msm_csi2_register.c b/drivers/media/video/msm/csi/msm_csi2_register.c
deleted file mode 100644
index b10d820..0000000
--- a/drivers/media/video/msm/csi/msm_csi2_register.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/device.h>
-#include "msm.h"
-#include "msm_csi_register.h"
-
-int msm_csi_register_subdevs(struct msm_cam_media_controller *p_mctl,
-	int core_index, struct msm_cam_server_dev *server_dev)
-{
-	int rc = -ENODEV;
-
-	/* register csiphy subdev */
-	p_mctl->csiphy_sdev = server_dev->csiphy_device[core_index];
-	if (!p_mctl->csiphy_sdev)
-		goto out;
-	v4l2_set_subdev_hostdata(p_mctl->csiphy_sdev, p_mctl);
-
-	/* register csid subdev */
-	p_mctl->csid_sdev = server_dev->csid_device[core_index];
-	if (!p_mctl->csid_sdev)
-		goto out;
-	v4l2_set_subdev_hostdata(p_mctl->csid_sdev, p_mctl);
-
-	/* register ispif subdev */
-	p_mctl->ispif_sdev = server_dev->ispif_device[0];
-	if (!p_mctl->ispif_sdev)
-		goto out;
-	v4l2_set_subdev_hostdata(p_mctl->ispif_sdev, p_mctl);
-
-	rc = 0;
-	return rc;
-out:
-	p_mctl->ispif_sdev = NULL;
-	return rc;
-}
-
diff --git a/drivers/media/video/msm/csi/msm_csi_register.h b/drivers/media/video/msm/csi/msm_csi_register.h
deleted file mode 100644
index a744e1a..0000000
--- a/drivers/media/video/msm/csi/msm_csi_register.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-int msm_csi_register_subdevs(struct msm_cam_media_controller *p_mctl,
-	int core_index,
-	struct msm_cam_server_dev *server_dev);
diff --git a/drivers/media/video/msm/csi/msm_csic.c b/drivers/media/video/msm/csi/msm_csic.c
deleted file mode 100644
index 34489cb..0000000
--- a/drivers/media/video/msm/csi/msm_csic.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/module.h>
-#include <mach/clk.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <media/msm_isp.h>
-#include "msm_csic.h"
-#include "msm.h"
-
-#define DBG_CSIC 0
-
-#define V4L2_IDENT_CSIC			50004
-/* MIPI	CSI controller registers */
-#define	MIPI_PHY_CONTROL		0x00000000
-#define	MIPI_PROTOCOL_CONTROL		0x00000004
-#define	MIPI_INTERRUPT_STATUS		0x00000008
-#define	MIPI_INTERRUPT_MASK		0x0000000C
-#define	MIPI_CAMERA_CNTL		0x00000024
-#define	MIPI_CALIBRATION_CONTROL	0x00000018
-#define	MIPI_PHY_D0_CONTROL2		0x00000038
-#define	MIPI_PHY_D1_CONTROL2		0x0000003C
-#define	MIPI_PHY_D2_CONTROL2		0x00000040
-#define	MIPI_PHY_D3_CONTROL2		0x00000044
-#define	MIPI_PHY_CL_CONTROL		0x00000048
-#define	MIPI_PHY_D0_CONTROL		0x00000034
-#define	MIPI_PHY_D1_CONTROL		0x00000020
-#define	MIPI_PHY_D2_CONTROL		0x0000002C
-#define	MIPI_PHY_D3_CONTROL		0x00000030
-#define	MIPI_PWR_CNTL			0x00000054
-
-/*
- * MIPI_PROTOCOL_CONTROL register bits to enable/disable the features of
- * CSI Rx Block
- */
-
-/* DPCM scheme */
-#define	MIPI_PROTOCOL_CONTROL_DPCM_SCHEME_SHFT			0x1e
-/* SW_RST to issue a SW reset to the CSI core */
-#define	MIPI_PROTOCOL_CONTROL_SW_RST_BMSK			0x8000000
-/* To Capture Long packet Header Info in MIPI_PROTOCOL_STATUS register */
-#define	MIPI_PROTOCOL_CONTROL_LONG_PACKET_HEADER_CAPTURE_BMSK	0x200000
-/* Data format for unpacking purpose */
-#define	MIPI_PROTOCOL_CONTROL_DATA_FORMAT_SHFT			0x13
-/* Enable decoding of payload based on data type filed of packet hdr */
-#define	MIPI_PROTOCOL_CONTROL_DECODE_ID_BMSK			0x40000
-/* Enable error correction on packet headers */
-#define	MIPI_PROTOCOL_CONTROL_ECC_EN_BMSK			0x20000
-
-/*
- * MIPI_CALIBRATION_CONTROL register contains control info for
- * calibration impledence controller
-*/
-
-/* Enable bit for calibration pad */
-#define	MIPI_CALIBRATION_CONTROL_SWCAL_CAL_EN_SHFT		0x16
-/* With SWCAL_STRENGTH_OVERRIDE_EN, SW_CAL_EN and MANUAL_OVERRIDE_EN
- * the hardware calibration circuitry associated with CAL_SW_HW_MODE
- * is bypassed
-*/
-#define	MIPI_CALIBRATION_CONTROL_SWCAL_STRENGTH_OVERRIDE_EN_SHFT	0x15
-/* To indicate the Calibration process is in the control of HW/SW */
-#define	MIPI_CALIBRATION_CONTROL_CAL_SW_HW_MODE_SHFT		0x14
-/* When this is set the strength value of the data and clk lane impedence
- * termination is updated with MANUAL_STRENGTH settings and calibration
- * sensing logic is idle.
-*/
-#define	MIPI_CALIBRATION_CONTROL_MANUAL_OVERRIDE_EN_SHFT	0x7
-
-/* Data lane0 control */
-/* T-hs Settle count value  for Rx */
-#define	MIPI_PHY_D0_CONTROL2_SETTLE_COUNT_SHFT			0x18
-/* Rx termination control */
-#define	MIPI_PHY_D0_CONTROL2_HS_TERM_IMP_SHFT			0x10
-/* LP Rx enable */
-#define	MIPI_PHY_D0_CONTROL2_LP_REC_EN_SHFT			0x4
-/*
- * Enable for error in sync sequence
- * 1 - one bit error in sync seq
- * 0 - requires all 8 bit correct seq
-*/
-#define	MIPI_PHY_D0_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-
-/* Comments are same as D0 */
-#define	MIPI_PHY_D1_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D1_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D1_CONTROL2_LP_REC_EN_SHFT			0x4
-#define	MIPI_PHY_D1_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-
-/* Comments are same as D0 */
-#define	MIPI_PHY_D2_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D2_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D2_CONTROL2_LP_REC_EN_SHFT			0x4
-#define	MIPI_PHY_D2_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-
-/* Comments are same as D0 */
-#define	MIPI_PHY_D3_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D3_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D3_CONTROL2_LP_REC_EN_SHFT			0x4
-#define	MIPI_PHY_D3_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-
-/* PHY_CL_CTRL programs the parameters of clk lane of CSIRXPHY */
-/* HS Rx termination control */
-#define	MIPI_PHY_CL_CONTROL_HS_TERM_IMP_SHFT			0x18
-/* Start signal for T-hs delay */
-#define	MIPI_PHY_CL_CONTROL_LP_REC_EN_SHFT			0x2
-
-/* PHY DATA lane 0 control */
-/*
- * HS RX equalizer strength control
- * 00 - 0db 01 - 3db 10 - 5db 11 - 7db
-*/
-#define	MIPI_PHY_D0_CONTROL_HS_REC_EQ_SHFT			0x1c
-/* PHY DATA lane 1 control */
-/* Shutdown signal for MIPI clk phy line */
-#define	MIPI_PHY_D1_CONTROL_MIPI_CLK_PHY_SHUTDOWNB_SHFT		0x9
-/* Shutdown signal for MIPI data phy line */
-#define	MIPI_PHY_D1_CONTROL_MIPI_DATA_PHY_SHUTDOWNB_SHFT	0x8
-
-#define MSM_AXI_QOS_PREVIEW 200000
-#define MSM_AXI_QOS_SNAPSHOT 200000
-#define MSM_AXI_QOS_RECORDING 200000
-
-#define MIPI_PWR_CNTL_EN	0x07
-#define MIPI_PWR_CNTL_DIS	0x0
-
-static int msm_csic_config(struct v4l2_subdev *sd,
-	struct msm_camera_csi_params *csic_params)
-{
-	int rc = 0;
-	uint32_t val = 0;
-	struct csic_device *csic_dev;
-	void __iomem *csicbase;
-	int i;
-
-	csic_dev = v4l2_get_subdevdata(sd);
-	csicbase = csic_dev->base;
-
-	/* Enable error correction for DATA lane. Applies to all data lanes */
-	msm_camera_io_w(0x4, csicbase + MIPI_PHY_CONTROL);
-
-	msm_camera_io_w(MIPI_PROTOCOL_CONTROL_SW_RST_BMSK,
-		csicbase + MIPI_PROTOCOL_CONTROL);
-
-	val = MIPI_PROTOCOL_CONTROL_LONG_PACKET_HEADER_CAPTURE_BMSK |
-		MIPI_PROTOCOL_CONTROL_DECODE_ID_BMSK |
-		MIPI_PROTOCOL_CONTROL_ECC_EN_BMSK;
-	val |= (uint32_t)(csic_params->data_format) <<
-		MIPI_PROTOCOL_CONTROL_DATA_FORMAT_SHFT;
-	val |= csic_params->dpcm_scheme <<
-		MIPI_PROTOCOL_CONTROL_DPCM_SCHEME_SHFT;
-	CDBG("%s MIPI_PROTOCOL_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csicbase + MIPI_PROTOCOL_CONTROL);
-
-	val = (csic_params->settle_cnt <<
-		MIPI_PHY_D0_CONTROL2_SETTLE_COUNT_SHFT) |
-		(0x0F << MIPI_PHY_D0_CONTROL2_HS_TERM_IMP_SHFT) |
-		(0x1 << MIPI_PHY_D0_CONTROL2_LP_REC_EN_SHFT) |
-		(0x1 << MIPI_PHY_D0_CONTROL2_ERR_SOT_HS_EN_SHFT);
-	CDBG("%s MIPI_PHY_D0_CONTROL2 val=0x%x\n", __func__, val);
-	for (i = 0; i < csic_params->lane_cnt; i++)
-		msm_camera_io_w(val, csicbase + MIPI_PHY_D0_CONTROL2 + i * 4);
-
-
-	val = (0x0F << MIPI_PHY_CL_CONTROL_HS_TERM_IMP_SHFT) |
-		(0x1 << MIPI_PHY_CL_CONTROL_LP_REC_EN_SHFT);
-	CDBG("%s MIPI_PHY_CL_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csicbase + MIPI_PHY_CL_CONTROL);
-
-	val = 0 << MIPI_PHY_D0_CONTROL_HS_REC_EQ_SHFT;
-	msm_camera_io_w(val, csicbase + MIPI_PHY_D0_CONTROL);
-
-	val = (0x1 << MIPI_PHY_D1_CONTROL_MIPI_CLK_PHY_SHUTDOWNB_SHFT) |
-		(0x1 << MIPI_PHY_D1_CONTROL_MIPI_DATA_PHY_SHUTDOWNB_SHFT);
-	CDBG("%s MIPI_PHY_D1_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csicbase + MIPI_PHY_D1_CONTROL);
-
-	msm_camera_io_w(0x00000000, csicbase + MIPI_PHY_D2_CONTROL);
-	msm_camera_io_w(0x00000000, csicbase + MIPI_PHY_D3_CONTROL);
-
-	/* program number of lanes and lane mapping */
-	switch (csic_params->lane_cnt) {
-	case 1:
-		msm_camera_io_w(csic_params->lane_assign << 8 | 0x4,
-			csicbase + MIPI_CAMERA_CNTL);
-		break;
-	case 2:
-		msm_camera_io_w(csic_params->lane_assign << 8 | 0x5,
-			csicbase + MIPI_CAMERA_CNTL);
-		break;
-	case 3:
-		msm_camera_io_w(csic_params->lane_assign << 8 | 0x6,
-			csicbase + MIPI_CAMERA_CNTL);
-		break;
-	case 4:
-		msm_camera_io_w(csic_params->lane_assign << 8 | 0x7,
-			csicbase + MIPI_CAMERA_CNTL);
-		break;
-	}
-
-	msm_camera_io_w(0xF077F3C0, csicbase + MIPI_INTERRUPT_MASK);
-	/*clear IRQ bits*/
-	msm_camera_io_w(0xF077F3C0, csicbase + MIPI_INTERRUPT_STATUS);
-
-	return rc;
-}
-
-static irqreturn_t msm_csic_irq(int irq_num, void *data)
-{
-	uint32_t irq;
-	struct csic_device *csic_dev = data;
-
-	pr_info("msm_csic_irq: %x\n", (unsigned int)csic_dev->base);
-	irq = msm_camera_io_r(csic_dev->base + MIPI_INTERRUPT_STATUS);
-	pr_info("%s MIPI_INTERRUPT_STATUS = 0x%x 0x%x\n",
-		__func__, irq,
-		msm_camera_io_r(csic_dev->base + MIPI_PROTOCOL_CONTROL));
-	msm_camera_io_w(irq, csic_dev->base + MIPI_INTERRUPT_STATUS);
-
-	/* TODO: Needs to send this info to upper layers */
-	if ((irq >> 19) & 0x1)
-		pr_info("Unsupported packet format is received\n");
-	return IRQ_HANDLED;
-}
-
-static int msm_csic_subdev_g_chip_ident(struct v4l2_subdev *sd,
-			struct v4l2_dbg_chip_ident *chip)
-{
-	BUG_ON(!chip);
-	chip->ident = V4L2_IDENT_CSIC;
-	chip->revision = 0;
-	return 0;
-}
-
-static struct msm_cam_clk_info csic_8x_clk_info[] = {
-	{"csi_src_clk", 384000000},
-	{"csi_clk", -1},
-	{"csi_vfe_clk", -1},
-	{"csi_pclk", -1},
-};
-
-static struct msm_cam_clk_info csic_7x_clk_info[] = {
-	{"csi_clk", 400000000},
-	{"csi_vfe_clk", -1},
-	{"csi_pclk", -1},
-};
-
-static int msm_csic_init(struct v4l2_subdev *sd)
-{
-	int rc = 0;
-	struct csic_device *csic_dev;
-	csic_dev = v4l2_get_subdevdata(sd);
-	if (csic_dev == NULL) {
-		rc = -ENOMEM;
-		return rc;
-	}
-
-	csic_dev->base = ioremap(csic_dev->mem->start,
-		resource_size(csic_dev->mem));
-	if (!csic_dev->base) {
-		rc = -ENOMEM;
-		return rc;
-	}
-
-	csic_dev->hw_version = CSIC_8X;
-	rc = msm_cam_clk_enable(&csic_dev->pdev->dev, csic_8x_clk_info,
-		csic_dev->csic_clk, ARRAY_SIZE(csic_8x_clk_info), 1);
-	if (rc < 0) {
-		csic_dev->hw_version = CSIC_7X;
-		rc = msm_cam_clk_enable(&csic_dev->pdev->dev, csic_7x_clk_info,
-			csic_dev->csic_clk, ARRAY_SIZE(csic_7x_clk_info), 1);
-		if (rc < 0) {
-			csic_dev->hw_version = 0;
-			iounmap(csic_dev->base);
-			csic_dev->base = NULL;
-			return rc;
-		}
-	}
-	if (csic_dev->hw_version == CSIC_7X)
-		msm_camio_vfe_blk_reset_3();
-
-#if DBG_CSIC
-	enable_irq(csic_dev->irq->start);
-#endif
-
-	return 0;
-}
-
-static void msm_csic_disable(struct v4l2_subdev *sd)
-{
-	uint32_t val;
-	struct csic_device *csic_dev;
-	csic_dev = v4l2_get_subdevdata(sd);
-
-	val = 0x0;
-	if (csic_dev->base != NULL) {
-		CDBG("%s MIPI_PHY_D0_CONTROL2 val=0x%x\n", __func__, val);
-		msm_camera_io_w(val, csic_dev->base + MIPI_PHY_D0_CONTROL2);
-		msm_camera_io_w(val, csic_dev->base + MIPI_PHY_D1_CONTROL2);
-		msm_camera_io_w(val, csic_dev->base + MIPI_PHY_D2_CONTROL2);
-		msm_camera_io_w(val, csic_dev->base + MIPI_PHY_D3_CONTROL2);
-		CDBG("%s MIPI_PHY_CL_CONTROL val=0x%x\n", __func__, val);
-		msm_camera_io_w(val, csic_dev->base + MIPI_PHY_CL_CONTROL);
-		msleep(20);
-		val = msm_camera_io_r(csic_dev->base + MIPI_PHY_D1_CONTROL);
-		val &=
-		~((0x1 << MIPI_PHY_D1_CONTROL_MIPI_CLK_PHY_SHUTDOWNB_SHFT)
-		|(0x1 << MIPI_PHY_D1_CONTROL_MIPI_DATA_PHY_SHUTDOWNB_SHFT));
-		CDBG("%s MIPI_PHY_D1_CONTROL val=0x%x\n", __func__, val);
-		msm_camera_io_w(val, csic_dev->base + MIPI_PHY_D1_CONTROL);
-		usleep_range(5000, 6000);
-		msm_camera_io_w(0x0, csic_dev->base + MIPI_INTERRUPT_MASK);
-		msm_camera_io_w(0x0, csic_dev->base + MIPI_INTERRUPT_STATUS);
-		msm_camera_io_w(MIPI_PROTOCOL_CONTROL_SW_RST_BMSK,
-			csic_dev->base + MIPI_PROTOCOL_CONTROL);
-
-		msm_camera_io_w(0xE400, csic_dev->base + MIPI_CAMERA_CNTL);
-	}
-}
-
-static int msm_csic_release(struct v4l2_subdev *sd)
-{
-	struct csic_device *csic_dev;
-	csic_dev = v4l2_get_subdevdata(sd);
-
-	msm_csic_disable(sd);
-#if DBG_CSIC
-	disable_irq(csic_dev->irq->start);
-#endif
-
-	if (csic_dev->hw_version == CSIC_8X) {
-		msm_cam_clk_enable(&csic_dev->pdev->dev, csic_8x_clk_info,
-			csic_dev->csic_clk, ARRAY_SIZE(csic_8x_clk_info), 0);
-	} else if (csic_dev->hw_version == CSIC_7X) {
-		msm_cam_clk_enable(&csic_dev->pdev->dev, csic_7x_clk_info,
-			csic_dev->csic_clk, ARRAY_SIZE(csic_7x_clk_info), 0);
-	}
-
-	iounmap(csic_dev->base);
-	csic_dev->base = NULL;
-	return 0;
-}
-
-static long msm_csic_cmd(struct v4l2_subdev *sd, void *arg)
-{
-	long rc = 0;
-	struct csic_cfg_data cdata;
-	struct msm_camera_csi_params csic_params;
-	if (copy_from_user(&cdata,
-		(void *)arg,
-		sizeof(struct csic_cfg_data)))
-		return -EFAULT;
-	CDBG("%s cfgtype = %d\n", __func__, cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CSIC_INIT:
-		rc = msm_csic_init(sd);
-		break;
-	case CSIC_CFG:
-		if (copy_from_user(&csic_params,
-			(void *)cdata.csic_params,
-			sizeof(struct msm_camera_csi_params)))
-			return -EFAULT;
-		rc = msm_csic_config(sd, &csic_params);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-static long msm_csic_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int cmd, void *arg)
-{
-	switch (cmd) {
-	case VIDIOC_MSM_CSIC_CFG:
-		return msm_csic_cmd(sd, arg);
-	case VIDIOC_MSM_CSIC_RELEASE:
-		return msm_csic_release(sd);
-	default:
-		return -ENOIOCTLCMD;
-	}
-}
-
-static struct v4l2_subdev_core_ops msm_csic_subdev_core_ops = {
-	.g_chip_ident = &msm_csic_subdev_g_chip_ident,
-	.ioctl = &msm_csic_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_ops msm_csic_subdev_ops = {
-	.core = &msm_csic_subdev_core_ops,
-};
-
-static const struct v4l2_subdev_internal_ops msm_csic_internal_ops;
-
-static int __devinit csic_probe(struct platform_device *pdev)
-{
-	struct csic_device *new_csic_dev;
-	int rc = 0;
-	struct msm_cam_subdev_info sd_info;
-
-	CDBG("%s: device id = %d\n", __func__, pdev->id);
-	new_csic_dev = kzalloc(sizeof(struct csic_device), GFP_KERNEL);
-	if (!new_csic_dev) {
-		pr_err("%s: no enough memory\n", __func__);
-		return -ENOMEM;
-	}
-
-	v4l2_subdev_init(&new_csic_dev->subdev, &msm_csic_subdev_ops);
-	new_csic_dev->subdev.internal_ops = &msm_csic_internal_ops;
-	new_csic_dev->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(new_csic_dev->subdev.name,
-			ARRAY_SIZE(new_csic_dev->subdev.name), "msm_csic");
-	v4l2_set_subdevdata(&new_csic_dev->subdev, new_csic_dev);
-	platform_set_drvdata(pdev, &new_csic_dev->subdev);
-	mutex_init(&new_csic_dev->mutex);
-
-	new_csic_dev->mem = platform_get_resource_byname(pdev,
-					IORESOURCE_MEM, "csic");
-	if (!new_csic_dev->mem) {
-		pr_err("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto csic_no_resource;
-	}
-	new_csic_dev->irq = platform_get_resource_byname(pdev,
-					IORESOURCE_IRQ, "csic");
-	if (!new_csic_dev->irq) {
-		pr_err("%s: no irq resource?\n", __func__);
-		rc = -ENODEV;
-		goto csic_no_resource;
-	}
-	new_csic_dev->io = request_mem_region(new_csic_dev->mem->start,
-		resource_size(new_csic_dev->mem), pdev->name);
-	if (!new_csic_dev->io) {
-		pr_err("%s: no valid mem region\n", __func__);
-		rc = -EBUSY;
-		goto csic_no_resource;
-	}
-
-	rc = request_irq(new_csic_dev->irq->start, msm_csic_irq,
-		IRQF_TRIGGER_HIGH, "csic", new_csic_dev);
-	if (rc < 0) {
-		release_mem_region(new_csic_dev->mem->start,
-			resource_size(new_csic_dev->mem));
-		pr_err("%s: irq request fail\n", __func__);
-		rc = -EBUSY;
-		goto csic_no_resource;
-	}
-	disable_irq(new_csic_dev->irq->start);
-
-	new_csic_dev->pdev = pdev;
-
-	rc = msm_cam_clk_enable(&new_csic_dev->pdev->dev, &csic_7x_clk_info[2],
-				new_csic_dev->csic_clk, 1, 1);
-	new_csic_dev->base = ioremap(new_csic_dev->mem->start,
-		resource_size(new_csic_dev->mem));
-	if (!new_csic_dev->base) {
-		rc = -ENOMEM;
-		return rc;
-	}
-
-	msm_camera_io_w(MIPI_PWR_CNTL_DIS, new_csic_dev->base + MIPI_PWR_CNTL);
-
-	rc = msm_cam_clk_enable(&new_csic_dev->pdev->dev, &csic_7x_clk_info[2],
-				new_csic_dev->csic_clk, 1, 0);
-
-	iounmap(new_csic_dev->base);
-	new_csic_dev->base = NULL;
-	sd_info.sdev_type = CSIC_DEV;
-	sd_info.sd_index = pdev->id;
-	sd_info.irq_num = new_csic_dev->irq->start;
-	msm_cam_register_subdev_node(
-		&new_csic_dev->subdev, &sd_info);
-
-	media_entity_init(&new_csic_dev->subdev.entity, 0, NULL, 0);
-	new_csic_dev->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	new_csic_dev->subdev.entity.group_id = CSIC_DEV;
-	new_csic_dev->subdev.entity.name = pdev->name;
-	new_csic_dev->subdev.entity.revision =
-		new_csic_dev->subdev.devnode->num;
-	return 0;
-
-csic_no_resource:
-	mutex_destroy(&new_csic_dev->mutex);
-	kfree(new_csic_dev);
-	return 0;
-}
-
-static struct platform_driver csic_driver = {
-	.probe = csic_probe,
-	.driver = {
-		.name = MSM_CSIC_DRV_NAME,
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init msm_csic_init_module(void)
-{
-	return platform_driver_register(&csic_driver);
-}
-
-static void __exit msm_csic_exit_module(void)
-{
-	platform_driver_unregister(&csic_driver);
-}
-
-module_init(msm_csic_init_module);
-module_exit(msm_csic_exit_module);
-MODULE_DESCRIPTION("MSM csic driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/csi/msm_csic.h b/drivers/media/video/msm/csi/msm_csic.h
index f8aa92a..08dde52 100644
--- a/drivers/media/video/msm/csi/msm_csic.h
+++ b/drivers/media/video/msm/csi/msm_csic.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -17,9 +17,6 @@
 #include <linux/io.h>
 #include <media/v4l2-subdev.h>
 
-#define CSIC_7X 0x1
-#define CSIC_8X (0x1 << 1)
-
 struct csic_device {
 	struct platform_device *pdev;
 	struct v4l2_subdev subdev;
@@ -33,10 +30,19 @@
 	struct clk *csic_clk[5];
 };
 
-#define VIDIOC_MSM_CSIC_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct csic_cfg_data*)
+struct csic_cfg_params {
+	struct v4l2_subdev *subdev;
+	void *parms;
+};
 
-#define VIDIOC_MSM_CSIC_RELEASE \
+#define VIDIOC_MSM_CSIC_CFG \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct csic_cfg_params)
+
+#define VIDIOC_MSM_CSIC_INIT \
 	_IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct v4l2_subdev*)
 
+#define VIDIOC_MSM_CSIC_RELEASE \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct v4l2_subdev*)
+
 #endif
+
diff --git a/drivers/media/video/msm/csi/msm_csic_register.c b/drivers/media/video/msm/csi/msm_csic_register.c
deleted file mode 100644
index e3fe3d4..0000000
--- a/drivers/media/video/msm/csi/msm_csic_register.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/device.h>
-#include "msm.h"
-#include "msm_csi_register.h"
-
-int msm_csi_register_subdevs(struct msm_cam_media_controller *p_mctl,
-	int core_index, struct msm_cam_server_dev *server_dev)
-{
-	int rc = -ENODEV;
-
-	p_mctl->csic_sdev = server_dev->csic_device[core_index];
-	if (!p_mctl->csic_sdev)
-		goto out;
-	v4l2_set_subdev_hostdata(p_mctl->csic_sdev, p_mctl);
-
-	rc = 0;
-	p_mctl->ispif_sdev = NULL;
-	return rc;
-
-out:
-	p_mctl->ispif_sdev = NULL;
-	return rc;
-}
-
diff --git a/drivers/media/video/msm/csi/msm_csid.c b/drivers/media/video/msm/csi/msm_csid.c
index f3cb623..91ac3a5 100644
--- a/drivers/media/video/msm/csi/msm_csid.c
+++ b/drivers/media/video/msm/csi/msm_csid.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -10,26 +10,50 @@
  * GNU General Public License for more details.
  */
 
-#include <linux/delay.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/delay.h>
+#include <linux/clk.h>
+#include <linux/io.h>
 #include <mach/board.h>
 #include <mach/camera.h>
 #include <media/msm_isp.h>
 #include "msm_csid.h"
-#include "msm_csid_hwreg.h"
 #include "msm.h"
-#include "msm_cam_server.h"
 
 #define V4L2_IDENT_CSID                            50002
-#define CSID_VERSION_V2                      0x02000011
-#define CSID_VERSION_V3                      0x30000000
+
+#define CSID_HW_VERSION_ADDR                        0x0
+#define CSID_CORE_CTRL_ADDR                         0x4
+#define CSID_RST_CMD_ADDR                           0x8
+#define CSID_CID_LUT_VC_0_ADDR                      0xc
+#define CSID_CID_LUT_VC_1_ADDR                      0x10
+#define CSID_CID_LUT_VC_2_ADDR                      0x14
+#define CSID_CID_LUT_VC_3_ADDR                      0x18
+#define CSID_CID_n_CFG_ADDR                         0x1C
+#define CSID_IRQ_CLEAR_CMD_ADDR                     0x5c
+#define CSID_IRQ_MASK_ADDR                          0x60
+#define CSID_IRQ_STATUS_ADDR                        0x64
+#define CSID_CAPTURED_UNMAPPED_LONG_PKT_HDR_ADDR    0x68
+#define CSID_CAPTURED_MMAPPED_LONG_PKT_HDR_ADDR     0x6c
+#define CSID_CAPTURED_SHORT_PKT_ADDR                0x70
+#define CSID_CAPTURED_LONG_PKT_HDR_ADDR             0x74
+#define CSID_CAPTURED_LONG_PKT_FTR_ADDR             0x78
+#define CSID_PIF_MISR_DL0_ADDR                      0x7C
+#define CSID_PIF_MISR_DL1_ADDR                      0x80
+#define CSID_PIF_MISR_DL2_ADDR                      0x84
+#define CSID_PIF_MISR_DL3_ADDR                      0x88
+#define CSID_STATS_TOTAL_PKTS_RCVD_ADDR             0x8C
+#define CSID_STATS_ECC_ADDR                         0x90
+#define CSID_STATS_CRC_ADDR                         0x94
+#define CSID_TG_CTRL_ADDR                           0x9C
+#define CSID_TG_VC_CFG_ADDR                         0xA0
+#define CSID_TG_DT_n_CFG_0_ADDR                     0xA8
+#define CSID_TG_DT_n_CFG_1_ADDR                     0xAC
+#define CSID_TG_DT_n_CFG_2_ADDR                     0xB0
+#define CSID_TG_DT_n_CFG_3_ADDR                     0xD8
 
 #define DBG_CSID 0
 
-#define TRUE   1
-#define FALSE  0
-
 static int msm_csid_cid_lut(
 	struct msm_camera_csid_lut_params *csid_lut_params,
 	void __iomem *csidbase)
@@ -37,33 +61,22 @@
 	int rc = 0, i = 0;
 	uint32_t val = 0;
 
-	if (!csid_lut_params) {
-		pr_err("%s:%d csid_lut_params NULL\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	for (i = 0; i < csid_lut_params->num_cid && i < 16; i++) {
-		CDBG("%s lut params num_cid = %d, cid = %d, dt = %x, df = %d\n",
-			__func__,
-			csid_lut_params->num_cid,
-			csid_lut_params->vc_cfg[i].cid,
-			csid_lut_params->vc_cfg[i].dt,
-			csid_lut_params->vc_cfg[i].decode_format);
+	for (i = 0; i < csid_lut_params->num_cid && i < 4; i++) {
 		if (csid_lut_params->vc_cfg[i].dt < 0x12 ||
 			csid_lut_params->vc_cfg[i].dt > 0x37) {
 			CDBG("%s: unsupported data type 0x%x\n",
 				 __func__, csid_lut_params->vc_cfg[i].dt);
 			return rc;
 		}
-		val = msm_camera_io_r(csidbase + CSID_CID_LUT_VC_0_ADDR +
-			(csid_lut_params->vc_cfg[i].cid >> 2) * 4)
-			& ~(0xFF << ((csid_lut_params->vc_cfg[i].cid % 4) * 8));
-		val |= (csid_lut_params->vc_cfg[i].dt <<
-			((csid_lut_params->vc_cfg[i].cid % 4) * 8));
-		msm_camera_io_w(val, csidbase + CSID_CID_LUT_VC_0_ADDR +
+		val = msm_io_r(csidbase + CSID_CID_LUT_VC_0_ADDR +
+		(csid_lut_params->vc_cfg[i].cid >> 2) * 4)
+		& ~(0xFF << csid_lut_params->vc_cfg[i].cid * 8);
+		val |= csid_lut_params->vc_cfg[i].dt <<
+			csid_lut_params->vc_cfg[i].cid * 8;
+		msm_io_w(val, csidbase + CSID_CID_LUT_VC_0_ADDR +
 			(csid_lut_params->vc_cfg[i].cid >> 2) * 4);
-
-		val = (csid_lut_params->vc_cfg[i].decode_format << 4) | 0x3;
-		msm_camera_io_w(val, csidbase + CSID_CID_n_CFG_ADDR +
+		val = csid_lut_params->vc_cfg[i].decode_format << 4 | 0x3;
+		msm_io_w(val, csidbase + CSID_CID_n_CFG_ADDR +
 			(csid_lut_params->vc_cfg[i].cid * 4));
 	}
 	return rc;
@@ -83,41 +96,33 @@
 	struct msm_camera_csid_params *csid_params) {}
 #endif
 
-static int msm_csid_config(struct csid_device *csid_dev,
-	struct msm_camera_csid_params *csid_params)
+static int msm_csid_config(struct csid_cfg_params *cfg_params)
 {
 	int rc = 0;
 	uint32_t val = 0;
+	struct csid_device *csid_dev;
+	struct msm_camera_csid_params *csid_params;
 	void __iomem *csidbase;
+	csid_dev = v4l2_get_subdevdata(cfg_params->subdev);
 	csidbase = csid_dev->base;
-	if (!csidbase || !csid_params) {
-		pr_err("%s:%d csidbase %p, csid params %p\n", __func__,
-			__LINE__, csidbase, csid_params);
-		return -EINVAL;
-	}
-
-	CDBG("%s csid_params, lane_cnt = %d, lane_assign = %x, phy sel = %d\n",
-		__func__,
-		csid_params->lane_cnt,
-		csid_params->lane_assign,
-		csid_params->phy_sel);
+	if (csidbase == NULL)
+		return -ENOMEM;	
+	csid_params = cfg_params->parms;
 	val = csid_params->lane_cnt - 1;
-	val |= csid_params->lane_assign << CSID_DL_INPUT_SEL_SHIFT;
-	if (csid_dev->hw_version < 0x30000000) {
-		val |= (0xF << 10);
-		msm_camera_io_w(val, csidbase + CSID_CORE_CTRL_0_ADDR);
-	} else {
-		msm_camera_io_w(val, csidbase + CSID_CORE_CTRL_0_ADDR);
-		val = csid_params->phy_sel << CSID_PHY_SEL_SHIFT;
-		val |= 0xF;
-		msm_camera_io_w(val, csidbase + CSID_CORE_CTRL_1_ADDR);
-	}
+	val |= csid_params->lane_assign << 2;
+	val |= 0x1 << 10;
+	val |= 0x1 << 11;
+	val |= 0x1 << 12;
+	val |= 0x1 << 13;
+	val |= 0x1 << 28;
+	msm_io_w(val, csidbase + CSID_CORE_CTRL_ADDR);
 
 	rc = msm_csid_cid_lut(&csid_params->lut_params, csidbase);
 	if (rc < 0)
 		return rc;
 
 	msm_csid_set_debug_reg(csidbase, csid_params);
+
 	return rc;
 }
 
@@ -125,36 +130,12 @@
 {
 	uint32_t irq;
 	struct csid_device *csid_dev = data;
-	if (!csid_dev||!csid_dev->base) {
-		pr_err("%s:%d csid_dev NULL\n", __func__, __LINE__);
-		return IRQ_HANDLED;
-	}
-	irq = msm_camera_io_r(csid_dev->base + CSID_IRQ_STATUS_ADDR);
-	CDBG("%s CSID%d_IRQ_STATUS_ADDR = 0x%x\n",
-		 __func__, csid_dev->pdev->id, irq);
-	if (irq & (0x1 << CSID_RST_DONE_IRQ_BITSHIFT))
-			complete(&csid_dev->reset_complete);
-	msm_camera_io_w(irq, csid_dev->base + CSID_IRQ_CLEAR_CMD_ADDR);
+	irq = msm_io_r(csid_dev->base + CSID_IRQ_STATUS_ADDR);
+	CDBG("%s CSID_IRQ_STATUS_ADDR = 0x%x\n", __func__, irq);
+	msm_io_w(irq, csid_dev->base + CSID_IRQ_CLEAR_CMD_ADDR);
 	return IRQ_HANDLED;
 }
 
-int msm_csid_irq_routine(struct v4l2_subdev *sd, u32 status, bool *handled)
-{
-	struct csid_device *csid_dev = v4l2_get_subdevdata(sd);
-	irqreturn_t ret;
-	CDBG("%s E\n", __func__);
-	ret = msm_csid_irq(csid_dev->irq->start, csid_dev);
-	*handled = TRUE;
-	return 0;
-}
-
-static void msm_csid_reset(struct csid_device *csid_dev)
-{
-	msm_camera_io_w(CSID_RST_STB_ALL, csid_dev->base + CSID_RST_CMD_ADDR);
-	wait_for_completion_interruptible(&csid_dev->reset_complete);
-	return;
-}
-
 static int msm_csid_subdev_g_chip_ident(struct v4l2_subdev *sd,
 			struct v4l2_dbg_chip_ident *chip)
 {
@@ -164,344 +145,89 @@
 	return 0;
 }
 
-static struct msm_cam_clk_info csid_8960_clk_info[] = {
+static struct msm_cam_clk_info csid_clk_info[] = {
 	{"csi_src_clk", 177780000},
 	{"csi_clk", -1},
 	{"csi_phy_clk", -1},
 	{"csi_pclk", -1},
 };
 
-static struct msm_cam_clk_info csid0_8974_clk_info[] = {
-	{"csi0_ahb_clk", -1},
-	{"csi0_src_clk", 200000000},
-	{"csi0_clk", -1},
-	{"csi0_phy_clk", -1},
-	{"csi0_pix_clk", -1},
-	{"csi0_rdi_clk", -1},
-};
-
-static struct msm_cam_clk_info csid1_8974_clk_info[] = {
-	{"csi1_ahb_clk", -1},
-	{"csi1_src_clk", 200000000},
-	{"csi1_clk", -1},
-	{"csi1_phy_clk", -1},
-	{"csi1_pix_clk", -1},
-	{"csi1_rdi_clk", -1},
-};
-
-static struct msm_cam_clk_info csid2_8974_clk_info[] = {
-	{"csi2_ahb_clk", -1},
-	{"csi2_src_clk", 200000000},
-	{"csi2_clk", -1},
-	{"csi2_phy_clk", -1},
-	{"csi2_pix_clk", -1},
-	{"csi2_rdi_clk", -1},
-};
-
-static struct msm_cam_clk_info csid3_8974_clk_info[] = {
-	{"csi3_ahb_clk", -1},
-	{"csi3_src_clk", 200000000},
-	{"csi3_clk", -1},
-	{"csi3_phy_clk", -1},
-	{"csi3_pix_clk", -1},
-	{"csi3_rdi_clk", -1},
-};
-
-static struct msm_cam_clk_setting csid_8974_clk_info[] = {
-	{&csid0_8974_clk_info[0], ARRAY_SIZE(csid0_8974_clk_info)},
-	{&csid1_8974_clk_info[0], ARRAY_SIZE(csid1_8974_clk_info)},
-	{&csid2_8974_clk_info[0], ARRAY_SIZE(csid2_8974_clk_info)},
-	{&csid3_8974_clk_info[0], ARRAY_SIZE(csid3_8974_clk_info)},
-};
-
-static struct camera_vreg_t csid_8960_vreg_info[] = {
-	{"mipi_csi_vdd", REG_LDO, 1200000, 1200000, 20000},
-};
-
-static struct camera_vreg_t csid_8974_vreg_info[] = {
-	{"mipi_csi_vdd", REG_LDO, 1800000, 1800000, 12000},
-};
-
-static int msm_csid_init(struct csid_device *csid_dev, uint32_t *csid_version)
+static int msm_csid_init(struct v4l2_subdev *sd, uint32_t *csid_version)
 {
 	int rc = 0;
-	uint8_t core_id = 0;
-
-	if (!csid_version) {
-		pr_err("%s:%d csid_version NULL\n", __func__, __LINE__);
-		rc = -EINVAL;
-		return rc;
-	}
-
-	if (csid_dev->csid_state == CSID_POWER_UP) {
-		pr_err("%s: csid invalid state %d\n", __func__,
-			csid_dev->csid_state);
-		rc = -EINVAL;
+	struct csid_device *csid_dev;
+	csid_dev = v4l2_get_subdevdata(sd);
+	if (csid_dev == NULL) {
+		rc = -ENOMEM;
 		return rc;
 	}
 
 	csid_dev->base = ioremap(csid_dev->mem->start,
 		resource_size(csid_dev->mem));
 	if (!csid_dev->base) {
-		pr_err("%s csid_dev->base NULL\n", __func__);
 		rc = -ENOMEM;
 		return rc;
 	}
 
-	if (CSID_VERSION <= CSID_VERSION_V2) {
-		rc = msm_camera_config_vreg(&csid_dev->pdev->dev,
-			csid_8960_vreg_info, ARRAY_SIZE(csid_8960_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 1);
-		if (rc < 0) {
-			pr_err("%s: regulator on failed\n", __func__);
-			goto vreg_config_failed;
-		}
-
-		rc = msm_camera_enable_vreg(&csid_dev->pdev->dev,
-			csid_8960_vreg_info, ARRAY_SIZE(csid_8960_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 1);
-		if (rc < 0) {
-			pr_err("%s: regulator enable failed\n", __func__);
-			goto vreg_enable_failed;
-		}
-
-		rc = msm_cam_clk_enable(&csid_dev->pdev->dev,
-			csid_8960_clk_info, csid_dev->csid_clk,
-			ARRAY_SIZE(csid_8960_clk_info), 1);
-		if (rc < 0) {
-			pr_err("%s: clock enable failed\n", __func__);
-			goto clk_enable_failed;
-		}
-	} else if (CSID_VERSION == CSID_VERSION_V3) {
-		rc = msm_camera_config_vreg(&csid_dev->pdev->dev,
-			csid_8974_vreg_info, ARRAY_SIZE(csid_8974_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 1);
-		if (rc < 0) {
-			pr_err("%s: regulator on failed\n", __func__);
-			goto vreg_config_failed;
-		}
-
-		rc = msm_camera_enable_vreg(&csid_dev->pdev->dev,
-			csid_8974_vreg_info, ARRAY_SIZE(csid_8974_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 1);
-		if (rc < 0) {
-			pr_err("%s: regulator enable failed\n", __func__);
-			goto vreg_enable_failed;
-		}
-
-		rc = msm_cam_clk_enable(&csid_dev->pdev->dev,
-			csid_8974_clk_info[0].clk_info, csid_dev->csid0_clk,
-			csid_8974_clk_info[0].num_clk_info, 1);
-		if (rc < 0) {
-			pr_err("%s: clock enable failed\n", __func__);
-			goto csid0_clk_enable_failed;
-		}
-		core_id = csid_dev->pdev->id;
-		if (core_id) {
-			rc = msm_cam_clk_enable(&csid_dev->pdev->dev,
-				csid_8974_clk_info[core_id].clk_info,
-				csid_dev->csid_clk,
-				csid_8974_clk_info[core_id].num_clk_info, 1);
-			if (rc < 0) {
-				pr_err("%s: clock enable failed\n",
-					__func__);
-				goto clk_enable_failed;
-			}
-		}
+	rc = msm_cam_clk_enable(&csid_dev->pdev->dev, csid_clk_info,
+		csid_dev->csid_clk, ARRAY_SIZE(csid_clk_info), 1);
+	if (rc < 0) {
+		iounmap(csid_dev->base);
+		csid_dev->base = NULL;
+		return rc;
 	}
 
+#if DBG_CSID
+	enable_irq(csid_dev->irq->start);
+#endif
+
 	csid_dev->hw_version =
-		msm_camera_io_r(csid_dev->base + CSID_HW_VERSION_ADDR);
+		msm_io_r(csid_dev->base + CSID_HW_VERSION_ADDR);
+
 	*csid_version = csid_dev->hw_version;
 
-	init_completion(&csid_dev->reset_complete);
-
-	enable_irq(csid_dev->irq->start);
-
-	msm_csid_reset(csid_dev);
-	csid_dev->csid_state = CSID_POWER_UP;
-	return rc;
-
-clk_enable_failed:
-	if (CSID_VERSION == CSID_VERSION_V3) {
-		msm_cam_clk_enable(&csid_dev->pdev->dev,
-			csid_8974_clk_info[0].clk_info, csid_dev->csid0_clk,
-			csid_8974_clk_info[0].num_clk_info, 0);
-	}
-csid0_clk_enable_failed:
-	if (CSID_VERSION <= CSID_VERSION_V2) {
-		msm_camera_enable_vreg(&csid_dev->pdev->dev,
-			csid_8960_vreg_info, ARRAY_SIZE(csid_8960_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 0);
-	} else if (CSID_VERSION == CSID_VERSION_V3) {
-		msm_camera_enable_vreg(&csid_dev->pdev->dev,
-			csid_8974_vreg_info, ARRAY_SIZE(csid_8974_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 0);
-	}
-vreg_enable_failed:
-	if (CSID_VERSION <= CSID_VERSION_V2) {
-		msm_camera_config_vreg(&csid_dev->pdev->dev,
-			csid_8960_vreg_info, ARRAY_SIZE(csid_8960_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 0);
-	} else if (CSID_VERSION == CSID_VERSION_V3) {
-		msm_camera_config_vreg(&csid_dev->pdev->dev,
-			csid_8974_vreg_info, ARRAY_SIZE(csid_8974_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 0);
-	}
-vreg_config_failed:
-	iounmap(csid_dev->base);
-	csid_dev->base = NULL;
-	return rc;
-}
-
-static int msm_csid_release(struct csid_device *csid_dev)
-{
-	uint32_t irq;
-	uint8_t core_id = 0;
-
-	if (csid_dev->csid_state != CSID_POWER_UP) {
-		pr_err("%s: csid invalid state %d\n", __func__,
-			csid_dev->csid_state);
-		return -EINVAL;
-	}
-
-	irq = msm_camera_io_r(csid_dev->base + CSID_IRQ_STATUS_ADDR);
-	msm_camera_io_w(irq, csid_dev->base + CSID_IRQ_CLEAR_CMD_ADDR);
-	msm_camera_io_w(0, csid_dev->base + CSID_IRQ_MASK_ADDR);
-
-	disable_irq(csid_dev->irq->start);
-
-	if (csid_dev->hw_version <= CSID_VERSION_V2) {
-		msm_cam_clk_enable(&csid_dev->pdev->dev, csid_8960_clk_info,
-			csid_dev->csid_clk, ARRAY_SIZE(csid_8960_clk_info), 0);
-
-		msm_camera_enable_vreg(&csid_dev->pdev->dev,
-			csid_8960_vreg_info, ARRAY_SIZE(csid_8960_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 0);
-
-		msm_camera_config_vreg(&csid_dev->pdev->dev,
-			csid_8960_vreg_info, ARRAY_SIZE(csid_8960_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 0);
-	} else if (csid_dev->hw_version == CSID_VERSION_V3) {
-		core_id = csid_dev->pdev->id;
-		if (core_id)
-			msm_cam_clk_enable(&csid_dev->pdev->dev,
-				csid_8974_clk_info[core_id].clk_info,
-				csid_dev->csid_clk,
-				csid_8974_clk_info[core_id].num_clk_info, 0);
-
-		msm_cam_clk_enable(&csid_dev->pdev->dev,
-			csid_8974_clk_info[0].clk_info, csid_dev->csid0_clk,
-			csid_8974_clk_info[0].num_clk_info, 0);
-
-		msm_camera_enable_vreg(&csid_dev->pdev->dev,
-			csid_8974_vreg_info, ARRAY_SIZE(csid_8974_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 0);
-
-		msm_camera_config_vreg(&csid_dev->pdev->dev,
-			csid_8974_vreg_info, ARRAY_SIZE(csid_8974_vreg_info),
-			NULL, 0, &csid_dev->csi_vdd, 0);
-	}
-
-	iounmap(csid_dev->base);
-	csid_dev->base = NULL;
-	csid_dev->csid_state = CSID_POWER_DOWN;
 	return 0;
 }
 
-static long msm_csid_cmd(struct csid_device *csid_dev, void *arg)
+static int msm_csid_release(struct v4l2_subdev *sd)
 {
-	int rc = 0;
-	struct csid_cfg_data cdata;
+	struct csid_device *csid_dev;
+	csid_dev = v4l2_get_subdevdata(sd);
 
-	if (!csid_dev) {
-		pr_err("%s:%d csid_dev NULL\n", __func__, __LINE__);
-		return -EINVAL;
-	}
+#if DBG_CSID
+	disable_irq(csid_dev->irq->start);
+#endif
 
-	if (copy_from_user(&cdata,
-		(void *)arg,
-		sizeof(struct csid_cfg_data))) {
-		pr_err("%s: %d failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-	CDBG("%s cfgtype = %d\n", __func__, cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CSID_INIT:
-		rc = msm_csid_init(csid_dev, &cdata.cfg.csid_version);
-		if (copy_to_user((void *)arg,
-			&cdata,
-			sizeof(struct csid_cfg_data))) {
-			pr_err("%s: %d failed\n", __func__, __LINE__);
-			rc = -EFAULT;
-		}
-		break;
-	case CSID_CFG: {
-		struct msm_camera_csid_params csid_params;
-		struct msm_camera_csid_vc_cfg *vc_cfg = NULL;
-		if (copy_from_user(&csid_params,
-			(void *)cdata.cfg.csid_params,
-			sizeof(struct msm_camera_csid_params))) {
-			pr_err("%s: %d failed\n", __func__, __LINE__);
-			rc = -EFAULT;
-			break;
-		}
-		vc_cfg = kzalloc(csid_params.lut_params.num_cid *
-			sizeof(struct msm_camera_csid_vc_cfg),
-			GFP_KERNEL);
-		if (!vc_cfg) {
-			pr_err("%s: %d failed\n", __func__, __LINE__);
-			rc = -ENOMEM;
-			break;
-		}
-		if (copy_from_user(vc_cfg,
-			(void *)csid_params.lut_params.vc_cfg,
-			(csid_params.lut_params.num_cid *
-			sizeof(struct msm_camera_csid_vc_cfg)))) {
-			pr_err("%s: %d failed\n", __func__, __LINE__);
-			kfree(vc_cfg);
-			rc = -EFAULT;
-			break;
-		}
-		csid_params.lut_params.vc_cfg = vc_cfg;
-		rc = msm_csid_config(csid_dev, &csid_params);
-		kfree(vc_cfg);
-		break;
-	}
-	default:
-		pr_err("%s: %d failed\n", __func__, __LINE__);
-		rc = -ENOIOCTLCMD;
-		break;
-	}
-	return rc;
+	msm_cam_clk_enable(&csid_dev->pdev->dev, csid_clk_info,
+		csid_dev->csid_clk, ARRAY_SIZE(csid_clk_info), 0);
+
+	iounmap(csid_dev->base);
+	csid_dev->base = NULL;
+	return 0;
 }
 
 static long msm_csid_subdev_ioctl(struct v4l2_subdev *sd,
 			unsigned int cmd, void *arg)
 {
-	int rc = -ENOIOCTLCMD;
-	struct csid_device *csid_dev = v4l2_get_subdevdata(sd);
-	mutex_lock(&csid_dev->mutex);
+	struct csid_cfg_params cfg_params;
 	switch (cmd) {
 	case VIDIOC_MSM_CSID_CFG:
-		rc = msm_csid_cmd(csid_dev, arg);
-		break;
+		cfg_params.subdev = sd;
+		cfg_params.parms = arg;
+		return msm_csid_config((struct csid_cfg_params *)&cfg_params);
+	case VIDIOC_MSM_CSID_INIT:
+		return msm_csid_init(sd, (uint32_t *)arg);
 	case VIDIOC_MSM_CSID_RELEASE:
-		rc = msm_csid_release(csid_dev);
-		break;
+		return msm_csid_release(sd);
 	default:
-		pr_err("%s: command not found\n", __func__);
+		return -ENOIOCTLCMD;
 	}
-	mutex_unlock(&csid_dev->mutex);
-	return rc;
 }
-
 static const struct v4l2_subdev_internal_ops msm_csid_internal_ops;
 
 static struct v4l2_subdev_core_ops msm_csid_subdev_core_ops = {
 	.g_chip_ident = &msm_csid_subdev_g_chip_ident,
 	.ioctl = &msm_csid_subdev_ioctl,
-	.interrupt_service_routine = msm_csid_irq_routine,
 };
 
 static const struct v4l2_subdev_ops msm_csid_subdev_ops = {
@@ -511,11 +237,8 @@
 static int __devinit csid_probe(struct platform_device *pdev)
 {
 	struct csid_device *new_csid_dev;
-	struct msm_cam_subdev_info sd_info;
-	struct intr_table_entry irq_req;
-
 	int rc = 0;
-	CDBG("%s:%d called\n", __func__, __LINE__);
+	CDBG("%s: device id = %d\n", __func__, pdev->id);
 	new_csid_dev = kzalloc(sizeof(struct csid_device), GFP_KERNEL);
 	if (!new_csid_dev) {
 		pr_err("%s: no enough memory\n", __func__);
@@ -527,15 +250,11 @@
 	new_csid_dev->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	snprintf(new_csid_dev->subdev.name,
 			ARRAY_SIZE(new_csid_dev->subdev.name), "msm_csid");
+
 	v4l2_set_subdevdata(&new_csid_dev->subdev, new_csid_dev);
 	platform_set_drvdata(pdev, &new_csid_dev->subdev);
 	mutex_init(&new_csid_dev->mutex);
 
-	if (pdev->dev.of_node)
-		of_property_read_u32((&pdev->dev)->of_node,
-			"cell-index", &pdev->id);
-
-	CDBG("%s device id %d\n", __func__, pdev->id);
 	new_csid_dev->mem = platform_get_resource_byname(pdev,
 					IORESOURCE_MEM, "csid");
 	if (!new_csid_dev->mem) {
@@ -558,78 +277,44 @@
 		goto csid_no_resource;
 	}
 
-	new_csid_dev->pdev = pdev;
-	sd_info.sdev_type = CSID_DEV;
-	sd_info.sd_index = pdev->id;
-	sd_info.irq_num = new_csid_dev->irq->start;
-	msm_cam_register_subdev_node(&new_csid_dev->subdev, &sd_info);
-
-	media_entity_init(&new_csid_dev->subdev.entity, 0, NULL, 0);
-	new_csid_dev->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	new_csid_dev->subdev.entity.group_id = CSID_DEV;
-	new_csid_dev->subdev.entity.name = pdev->name;
-	new_csid_dev->subdev.entity.revision =
-		new_csid_dev->subdev.devnode->num;
-
-	/* Request for this device irq from the camera server. If the
-	 * IRQ Router is present on this target, the interrupt will be
-	 * handled by the camera server and the interrupt service
-	 * routine called. If the request_irq call returns ENXIO, then
-	 * the IRQ Router hardware is not present on this target. We
-	 * have to request for the irq ourselves and register the
-	 * appropriate interrupt handler. */
-	irq_req.cam_hw_idx       = MSM_CAM_HW_CSI0 + pdev->id;
-	irq_req.dev_name         = "csid";
-	irq_req.irq_idx          = CAMERA_SS_IRQ_2 + pdev->id;
-	irq_req.irq_num          = new_csid_dev->irq->start;
-	irq_req.is_composite     = 0;
-	irq_req.irq_trigger_type = IRQF_TRIGGER_RISING;
-	irq_req.num_hwcore       = 1;
-	irq_req.subdev_list[0]   = &new_csid_dev->subdev;
-	irq_req.data             = (void *)new_csid_dev;
-	rc = msm_cam_server_request_irq(&irq_req);
-	if (rc == -ENXIO) {
-		/* IRQ Router hardware is not present on this hardware.
-		 * Request for the IRQ and register the interrupt handler. */
-		rc = request_irq(new_csid_dev->irq->start, msm_csid_irq,
-			IRQF_TRIGGER_RISING, "csid", new_csid_dev);
-		if (rc < 0) {
-			release_mem_region(new_csid_dev->mem->start,
-				resource_size(new_csid_dev->mem));
-			pr_err("%s: irq request fail\n", __func__);
-			rc = -EBUSY;
-			goto csid_no_resource;
-		}
-		disable_irq(new_csid_dev->irq->start);
-	} else if (rc < 0) {
+	rc = request_irq(new_csid_dev->irq->start, msm_csid_irq,
+		IRQF_TRIGGER_RISING, "csid", new_csid_dev);
+	if (rc < 0) {
 		release_mem_region(new_csid_dev->mem->start,
 			resource_size(new_csid_dev->mem));
-		pr_err("%s Error registering irq ", __func__);
+		pr_err("%s: irq request fail\n", __func__);
+		rc = -EBUSY;
+		goto csid_no_resource;
+	}
+	disable_irq(new_csid_dev->irq->start);
+
+	new_csid_dev->base = ioremap(new_csid_dev->mem->start,
+		resource_size(new_csid_dev->mem));
+	if (!new_csid_dev->base) {
+		rc = -ENOMEM;
 		goto csid_no_resource;
 	}
 
-	new_csid_dev->csid_state = CSID_POWER_DOWN;
+	new_csid_dev->hw_version =
+		msm_io_r(new_csid_dev->base + CSID_HW_VERSION_ADDR);
+	iounmap(new_csid_dev->base);
+
+	new_csid_dev->pdev = pdev;
+	
+	msm_cam_register_subdev_node(&new_csid_dev->subdev, CSID_DEV, pdev->id);
 	return 0;
 
 csid_no_resource:
 	mutex_destroy(&new_csid_dev->mutex);
 	kfree(new_csid_dev);
-	return rc;
+	return 0;
 }
 
-static const struct of_device_id msm_csid_dt_match[] = {
-	{.compatible = "qcom,csid"},
-	{}
-};
-
-MODULE_DEVICE_TABLE(of, msm_csid_dt_match);
-
 static struct platform_driver csid_driver = {
 	.probe = csid_probe,
 	.driver = {
 		.name = MSM_CSID_DRV_NAME,
 		.owner = THIS_MODULE,
-		.of_match_table = msm_csid_dt_match,
 	},
 };
 
diff --git a/drivers/media/video/msm/csi/msm_csid.h b/drivers/media/video/msm/csi/msm_csid.h
index 252f5fd..f90abf2 100644
--- a/drivers/media/video/msm/csi/msm_csid.h
+++ b/drivers/media/video/msm/csi/msm_csid.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -16,12 +16,6 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <media/v4l2-subdev.h>
-#include <media/msm_camera.h>
-
-enum msm_csid_state_t {
-	CSID_POWER_UP,
-	CSID_POWER_DOWN,
-};
 
 struct csid_device {
 	struct platform_device *pdev;
@@ -29,21 +23,26 @@
 	struct resource *mem;
 	struct resource *irq;
 	struct resource *io;
-	struct regulator *csi_vdd;
 	void __iomem *base;
 	struct mutex mutex;
-	struct completion reset_complete;
 	uint32_t hw_version;
-	enum msm_csid_state_t csid_state;
 
-	struct clk *csid0_clk[6];
-	struct clk *csid_clk[6];
+	struct clk *csid_clk[5];
+};
+
+struct csid_cfg_params {
+	struct v4l2_subdev *subdev;
+	void *parms;
 };
 
 #define VIDIOC_MSM_CSID_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct csic_cfg_data*)
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct csid_cfg_params)
+
+#define VIDIOC_MSM_CSID_INIT \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct v4l2_subdev*)
 
 #define VIDIOC_MSM_CSID_RELEASE \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct v4l2_subdev*)
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct v4l2_subdev*)
+
 #endif
 
diff --git a/drivers/media/video/msm/csi/msm_csiphy.c b/drivers/media/video/msm/csi/msm_csiphy.c
index dbf674d..67c814f 100644
--- a/drivers/media/video/msm/csi/msm_csiphy.c
+++ b/drivers/media/video/msm/csi/msm_csiphy.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -10,130 +10,125 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/io.h>
-#include <linux/of.h>
-#include <linux/module.h>
 #include <mach/board.h>
+#include <mach/camera.h>
 #include <mach/vreg.h>
 #include <media/msm_isp.h>
 #include "msm_csiphy.h"
 #include "msm.h"
-#include "msm_csiphy_hwreg.h"
+
 #define DBG_CSIPHY 0
 
 #define V4L2_IDENT_CSIPHY                        50003
-#define CSIPHY_VERSION_V3                        0x10
 
-int msm_csiphy_lane_config(struct csiphy_device *csiphy_dev,
-	struct msm_camera_csiphy_params *csiphy_params)
+#define MIPI_CSIPHY_LNn_CFG1_ADDR                0x0
+#define MIPI_CSIPHY_LNn_CFG2_ADDR                0x4
+#define MIPI_CSIPHY_LNn_CFG3_ADDR                0x8
+#define MIPI_CSIPHY_LNn_CFG4_ADDR                0xC
+#define MIPI_CSIPHY_LNn_CFG5_ADDR                0x10
+#define MIPI_CSIPHY_LNCK_CFG1_ADDR               0x100
+#define MIPI_CSIPHY_LNCK_CFG2_ADDR               0x104
+#define MIPI_CSIPHY_LNCK_CFG3_ADDR               0x108
+#define MIPI_CSIPHY_LNCK_CFG4_ADDR               0x10C
+#define MIPI_CSIPHY_LNCK_CFG5_ADDR               0x110
+#define MIPI_CSIPHY_LNCK_MISC1_ADDR              0x128
+#define MIPI_CSIPHY_GLBL_T_INIT_CFG0_ADDR        0x1E0
+#define MIPI_CSIPHY_T_WAKEUP_CFG0_ADDR           0x1E8
+#define MIPI_CSIPHY_GLBL_PWR_CFG_ADDR           0x0144
+#define MIPI_CSIPHY_INTERRUPT_STATUS0_ADDR      0x0180
+#define MIPI_CSIPHY_INTERRUPT_STATUS1_ADDR      0x0184
+#define MIPI_CSIPHY_INTERRUPT_STATUS2_ADDR      0x0188
+#define MIPI_CSIPHY_INTERRUPT_STATUS3_ADDR      0x018C
+#define MIPI_CSIPHY_INTERRUPT_STATUS4_ADDR      0x0190
+#define MIPI_CSIPHY_INTERRUPT_MASK0_ADDR        0x01A0
+#define MIPI_CSIPHY_INTERRUPT_MASK1_ADDR        0x01A4
+#define MIPI_CSIPHY_INTERRUPT_MASK2_ADDR        0x01A8
+#define MIPI_CSIPHY_INTERRUPT_MASK3_ADDR        0x01AC
+#define MIPI_CSIPHY_INTERRUPT_MASK4_ADDR        0x01B0
+#define MIPI_CSIPHY_INTERRUPT_CLEAR0_ADDR       0x01C0
+#define MIPI_CSIPHY_INTERRUPT_CLEAR1_ADDR       0x01C4
+#define MIPI_CSIPHY_INTERRUPT_CLEAR2_ADDR       0x01C8
+#define MIPI_CSIPHY_INTERRUPT_CLEAR3_ADDR       0x01CC
+#define MIPI_CSIPHY_INTERRUPT_CLEAR4_ADDR       0x01D0
+
+int msm_csiphy_config(struct csiphy_cfg_params *cfg_params)
 {
 	int rc = 0;
-	int j = 0;
+	int i = 0;
 	uint32_t val = 0;
-	uint8_t lane_cnt = 0;
-	uint16_t lane_mask = 0;
+	struct csiphy_device *csiphy_dev;
+	struct msm_camera_csiphy_params *csiphy_params;
 	void __iomem *csiphybase;
+	csiphy_dev = v4l2_get_subdevdata(cfg_params->subdev);
 	csiphybase = csiphy_dev->base;
-	if (!csiphybase) {
-		pr_err("%s: csiphybase NULL\n", __func__);
-		return -EINVAL;
-	}
-
-	csiphy_dev->lane_mask[csiphy_dev->pdev->id] |= csiphy_params->lane_mask;
-	lane_mask = csiphy_dev->lane_mask[csiphy_dev->pdev->id];
-	lane_cnt = csiphy_params->lane_cnt;
+	if (csiphybase == NULL)
+		return -ENOMEM;
+	
+	csiphy_params = cfg_params->parms;
 	if (csiphy_params->lane_cnt < 1 || csiphy_params->lane_cnt > 4) {
-		pr_err("%s: unsupported lane cnt %d\n",
+		CDBG("%s: unsupported lane cnt %d\n",
 			__func__, csiphy_params->lane_cnt);
 		return rc;
 	}
 
-	CDBG("%s csiphy_params, mask = %x, cnt = %d, settle cnt = %x\n",
-		__func__,
-		csiphy_params->lane_mask,
-		csiphy_params->lane_cnt,
-		csiphy_params->settle_cnt);
-	msm_camera_io_w(0x1, csiphybase + MIPI_CSIPHY_GLBL_T_INIT_CFG0_ADDR);
-	msm_camera_io_w(0x1, csiphybase + MIPI_CSIPHY_T_WAKEUP_CFG0_ADDR);
+	val = 0x3;
+	msm_io_w((((1 << csiphy_params->lane_cnt) - 1) << 2) | val,
+			 csiphybase + MIPI_CSIPHY_GLBL_PWR_CFG_ADDR);
+	msm_io_w(0x1, csiphybase + MIPI_CSIPHY_GLBL_T_INIT_CFG0_ADDR);
+	msm_io_w(0x1, csiphybase + MIPI_CSIPHY_T_WAKEUP_CFG0_ADDR);
 
-	if (csiphy_dev->hw_version != CSIPHY_VERSION_V3) {
-		val = 0x3;
-		msm_camera_io_w((lane_mask << 2) | val,
-				csiphybase + MIPI_CSIPHY_GLBL_PWR_CFG_ADDR);
-		msm_camera_io_w(0x10, csiphybase + MIPI_CSIPHY_LNCK_CFG2_ADDR);
-		msm_camera_io_w(csiphy_params->settle_cnt,
+	for (i = 0; i < csiphy_params->lane_cnt; i++) {
+		msm_io_w(0x10, csiphybase + MIPI_CSIPHY_LNn_CFG2_ADDR + 0x40*i);
+		msm_io_w(csiphy_params->settle_cnt,
+			csiphybase + MIPI_CSIPHY_LNn_CFG3_ADDR + 0x40*i);
+	}
+
+	msm_io_w(0x10, csiphybase + MIPI_CSIPHY_LNCK_CFG2_ADDR);
+	msm_io_w(csiphy_params->settle_cnt,
 			 csiphybase + MIPI_CSIPHY_LNCK_CFG3_ADDR);
-		msm_camera_io_w(0x24,
-			csiphybase + MIPI_CSIPHY_INTERRUPT_MASK0_ADDR);
-		msm_camera_io_w(0x24,
-			csiphybase + MIPI_CSIPHY_INTERRUPT_CLEAR0_ADDR);
-	} else {
-		val = 0x1;
-		msm_camera_io_w((lane_mask << 1) | val,
-				csiphybase + MIPI_CSIPHY_GLBL_PWR_CFG_ADDR);
-		msm_camera_io_w(csiphy_params->combo_mode <<
-			MIPI_CSIPHY_MODE_CONFIG_SHIFT,
-			csiphybase + MIPI_CSIPHY_GLBL_RESET_ADDR);
-	}
 
-	lane_mask &= 0x1f;
-	while (lane_mask & 0x1f) {
-		if (!(lane_mask & 0x1)) {
-			j++;
-			lane_mask >>= 1;
-			continue;
-		}
-		msm_camera_io_w(0x10,
-			csiphybase + MIPI_CSIPHY_LNn_CFG2_ADDR + 0x40*j);
-		msm_camera_io_w(csiphy_params->settle_cnt,
-			csiphybase + MIPI_CSIPHY_LNn_CFG3_ADDR + 0x40*j);
-		msm_camera_io_w(MIPI_CSIPHY_INTERRUPT_MASK_VAL, csiphybase +
-			MIPI_CSIPHY_INTERRUPT_MASK_ADDR + 0x4*j);
-		msm_camera_io_w(MIPI_CSIPHY_INTERRUPT_MASK_VAL, csiphybase +
-			MIPI_CSIPHY_INTERRUPT_CLEAR_ADDR + 0x4*j);
-		j++;
-		lane_mask >>= 1;
+	msm_io_w(0x24,
+		csiphybase + MIPI_CSIPHY_INTERRUPT_MASK0_ADDR);
+	msm_io_w(0x24,
+		csiphybase + MIPI_CSIPHY_INTERRUPT_CLEAR0_ADDR);
+
+	for (i = 1; i <= csiphy_params->lane_cnt; i++) {
+		msm_io_w(0x6F,
+			csiphybase + MIPI_CSIPHY_INTERRUPT_MASK0_ADDR + 0x4*i);
+		msm_io_w(0x6F,
+			csiphybase + MIPI_CSIPHY_INTERRUPT_CLEAR0_ADDR + 0x4*i);
 	}
-	msleep(20);
 	return rc;
 }
 
 static irqreturn_t msm_csiphy_irq(int irq_num, void *data)
 {
 	uint32_t irq;
-	int i;
 	struct csiphy_device *csiphy_dev = data;
-	if(!csiphy_dev || !csiphy_dev->base)
-		return IRQ_HANDLED;
-	for (i = 0; i < 8; i++) {
-		irq = msm_camera_io_r(
-			csiphy_dev->base +
-			MIPI_CSIPHY_INTERRUPT_STATUS0_ADDR + 0x4*i);
-		msm_camera_io_w(irq,
-			csiphy_dev->base +
-			MIPI_CSIPHY_INTERRUPT_CLEAR0_ADDR + 0x4*i);
-		pr_err("%s MIPI_CSIPHY%d_INTERRUPT_STATUS%d = 0x%x\n",
-			 __func__, csiphy_dev->pdev->id, i, irq);
-		msm_camera_io_w(0x1, csiphy_dev->base +
-			MIPI_CSIPHY_GLBL_IRQ_CMD_ADDR);
-		msm_camera_io_w(0x0, csiphy_dev->base +
-			MIPI_CSIPHY_GLBL_IRQ_CMD_ADDR);
-		msm_camera_io_w(0x0,
-			csiphy_dev->base +
-			MIPI_CSIPHY_INTERRUPT_CLEAR0_ADDR + 0x4*i);
-	}
+	irq = msm_io_r(csiphy_dev->base + MIPI_CSIPHY_INTERRUPT_STATUS0_ADDR);
+	msm_io_w(irq, csiphy_dev->base + MIPI_CSIPHY_INTERRUPT_CLEAR0_ADDR);
+	CDBG("%s MIPI_CSIPHY_INTERRUPT_STATUS0 = 0x%x\n", __func__, irq);
+	irq = msm_io_r(csiphy_dev->base + MIPI_CSIPHY_INTERRUPT_STATUS1_ADDR);
+	msm_io_w(irq, csiphy_dev->base + MIPI_CSIPHY_INTERRUPT_CLEAR1_ADDR);
+	CDBG("%s MIPI_CSIPHY_INTERRUPT_STATUS1 = 0x%x\n", __func__, irq);
+	irq = msm_io_r(csiphy_dev->base + MIPI_CSIPHY_INTERRUPT_STATUS2_ADDR);
+	msm_io_w(irq, csiphy_dev->base + MIPI_CSIPHY_INTERRUPT_CLEAR2_ADDR);
+	CDBG("%s MIPI_CSIPHY_INTERRUPT_STATUS2 = 0x%x\n", __func__, irq);
+	irq = msm_io_r(csiphy_dev->base + MIPI_CSIPHY_INTERRUPT_STATUS3_ADDR);
+	msm_io_w(irq, csiphy_dev->base + MIPI_CSIPHY_INTERRUPT_CLEAR3_ADDR);
+	CDBG("%s MIPI_CSIPHY_INTERRUPT_STATUS3 = 0x%x\n", __func__, irq);
+	irq = msm_io_r(csiphy_dev->base + MIPI_CSIPHY_INTERRUPT_STATUS4_ADDR);
+	msm_io_w(irq, csiphy_dev->base + MIPI_CSIPHY_INTERRUPT_CLEAR4_ADDR);
+	CDBG("%s MIPI_CSIPHY_INTERRUPT_STATUS4 = 0x%x\n", __func__, irq);
+	msm_io_w(0x1, csiphy_dev->base + 0x164);
+	msm_io_w(0x0, csiphy_dev->base + 0x164);
 	return IRQ_HANDLED;
 }
 
-static void msm_csiphy_reset(struct csiphy_device *csiphy_dev)
-{
-	msm_camera_io_w(0x1, csiphy_dev->base + MIPI_CSIPHY_GLBL_RESET_ADDR);
-	usleep_range(5000, 8000);
-	msm_camera_io_w(0x0, csiphy_dev->base + MIPI_CSIPHY_GLBL_RESET_ADDR);
-}
-
 static int msm_csiphy_subdev_g_chip_ident(struct v4l2_subdev *sd,
 			struct v4l2_dbg_chip_ident *chip)
 {
@@ -143,60 +138,32 @@
 	return 0;
 }
 
-static struct msm_cam_clk_info csiphy_8960_clk_info[] = {
+static struct msm_cam_clk_info csiphy_clk_info[] = {
 	{"csiphy_timer_src_clk", 177780000},
 	{"csiphy_timer_clk", -1},
 };
 
-static struct msm_cam_clk_info csiphy_8974_clk_info[] = {
-	{"ispif_ahb_clk", -1},
-	{"csiphy_timer_src_clk", 200000000},
-	{"csiphy_timer_clk", -1},
-};
-
-static int msm_csiphy_init(struct csiphy_device *csiphy_dev)
+static int msm_csiphy_init(struct v4l2_subdev *sd)
 {
 	int rc = 0;
+	struct csiphy_device *csiphy_dev;
+	csiphy_dev = v4l2_get_subdevdata(sd);
 	if (csiphy_dev == NULL) {
-		pr_err("%s: csiphy_dev NULL\n", __func__);
 		rc = -ENOMEM;
 		return rc;
 	}
 
-	if (csiphy_dev->csiphy_state == CSIPHY_POWER_UP) {
-		pr_err("%s: csiphy invalid state %d\n", __func__,
-			csiphy_dev->csiphy_state);
-		rc = -EINVAL;
-		return rc;
-	}
-
-	if (csiphy_dev->ref_count++) {
-		CDBG("%s csiphy refcount = %d\n", __func__,
-			csiphy_dev->ref_count);
-		return rc;
-	}
-
 	csiphy_dev->base = ioremap(csiphy_dev->mem->start,
 		resource_size(csiphy_dev->mem));
 	if (!csiphy_dev->base) {
-		pr_err("%s: csiphy_dev->base NULL\n", __func__);
-		csiphy_dev->ref_count--;
 		rc = -ENOMEM;
 		return rc;
 	}
 
-	if (CSIPHY_VERSION != CSIPHY_VERSION_V3)
-		rc = msm_cam_clk_enable(&csiphy_dev->pdev->dev,
-			csiphy_8960_clk_info, csiphy_dev->csiphy_clk,
-			ARRAY_SIZE(csiphy_8960_clk_info), 1);
-	else
-		rc = msm_cam_clk_enable(&csiphy_dev->pdev->dev,
-			csiphy_8974_clk_info, csiphy_dev->csiphy_clk,
-			ARRAY_SIZE(csiphy_8974_clk_info), 1);
+	rc = msm_cam_clk_enable(&csiphy_dev->pdev->dev, csiphy_clk_info,
+			csiphy_dev->csiphy_clk, ARRAY_SIZE(csiphy_clk_info), 1);
 
 	if (rc < 0) {
-		pr_err("%s: csiphy clk enable failed\n", __func__);
-		csiphy_dev->ref_count--;
 		iounmap(csiphy_dev->base);
 		csiphy_dev->base = NULL;
 		return rc;
@@ -205,142 +172,51 @@
 #if DBG_CSIPHY
 	enable_irq(csiphy_dev->irq->start);
 #endif
-	msm_csiphy_reset(csiphy_dev);
 
-	csiphy_dev->hw_version =
-		msm_camera_io_r(csiphy_dev->base + MIPI_CSIPHY_HW_VERSION_ADDR);
-
-	csiphy_dev->csiphy_state = CSIPHY_POWER_UP;
 	return 0;
 }
 
-static int msm_csiphy_release(struct csiphy_device *csiphy_dev, void *arg)
+static int msm_csiphy_release(struct v4l2_subdev *sd)
 {
-	int i = 0;
-	struct msm_camera_csi_lane_params *csi_lane_params;
-	uint16_t csi_lane_mask;
-	csi_lane_params = (struct msm_camera_csi_lane_params *)arg;
-	csi_lane_mask = csi_lane_params->csi_lane_mask;
+	struct csiphy_device *csiphy_dev;
+	int i;
+	csiphy_dev = v4l2_get_subdevdata(sd);
+	for (i = 0; i < 4; i++)
+		msm_io_w(0x0, csiphy_dev->base +
+		MIPI_CSIPHY_LNn_CFG2_ADDR + 0x40*i);
 
-	if (!csiphy_dev || !csiphy_dev->ref_count) {
-		pr_err("%s csiphy dev NULL / ref_count ZERO\n", __func__);
-		return 0;
-	}
+	msm_io_w(0x0, csiphy_dev->base + MIPI_CSIPHY_LNCK_CFG2_ADDR);
+	msm_io_w(0x0, csiphy_dev->base + MIPI_CSIPHY_GLBL_PWR_CFG_ADDR);
 
-	if (csiphy_dev->csiphy_state != CSIPHY_POWER_UP) {
-		pr_err("%s: csiphy invalid state %d\n", __func__,
-			csiphy_dev->csiphy_state);
-		return -EINVAL;
-	}
-
-	CDBG("%s csiphy_params, lane assign %x mask = %x\n",
-		__func__,
-		csi_lane_params->csi_lane_assign,
-		csi_lane_params->csi_lane_mask);
-
-	if (csiphy_dev->hw_version != CSIPHY_VERSION_V3) {
-		csiphy_dev->lane_mask[csiphy_dev->pdev->id] = 0;
-		for (i = 0; i < 4; i++)
-			msm_camera_io_w(0x0, csiphy_dev->base +
-				MIPI_CSIPHY_LNn_CFG2_ADDR + 0x40*i);
-	} else {
-		csiphy_dev->lane_mask[csiphy_dev->pdev->id] &=
-			~(csi_lane_params->csi_lane_mask);
-		i = 0;
-		while (csi_lane_mask & 0x1F) {
-			if (csi_lane_mask & 0x1) {
-				msm_camera_io_w(0x0, csiphy_dev->base +
-					MIPI_CSIPHY_LNn_CFG2_ADDR + 0x40*i);
-			}
-			csi_lane_mask >>= 1;
-			i++;
-		}
-	}
-
-	if (--csiphy_dev->ref_count) {
-		CDBG("%s csiphy refcount = %d\n", __func__,
-			csiphy_dev->ref_count);
-		return 0;
-	}
-
-	msm_camera_io_w(0x0, csiphy_dev->base + MIPI_CSIPHY_LNCK_CFG2_ADDR);
-	msm_camera_io_w(0x0, csiphy_dev->base + MIPI_CSIPHY_GLBL_PWR_CFG_ADDR);
+	msm_cam_clk_enable(&csiphy_dev->pdev->dev, csiphy_clk_info,
+		csiphy_dev->csiphy_clk, ARRAY_SIZE(csiphy_clk_info), 0);
 
 #if DBG_CSIPHY
 	disable_irq(csiphy_dev->irq->start);
 #endif
-	if (CSIPHY_VERSION != CSIPHY_VERSION_V3)
-		msm_cam_clk_enable(&csiphy_dev->pdev->dev,
-			csiphy_8960_clk_info, csiphy_dev->csiphy_clk,
-			ARRAY_SIZE(csiphy_8960_clk_info), 0);
-	else
-		msm_cam_clk_enable(&csiphy_dev->pdev->dev,
-			csiphy_8974_clk_info, csiphy_dev->csiphy_clk,
-			ARRAY_SIZE(csiphy_8974_clk_info), 0);
-
 	iounmap(csiphy_dev->base);
 	csiphy_dev->base = NULL;
-	csiphy_dev->csiphy_state = CSIPHY_POWER_DOWN;
 	return 0;
 }
 
-static long msm_csiphy_cmd(struct csiphy_device *csiphy_dev, void *arg)
-{
-	int rc = 0;
-	struct csiphy_cfg_data cdata;
-	struct msm_camera_csiphy_params csiphy_params;
-	if (!csiphy_dev) {
-		pr_err("%s: csiphy_dev NULL\n", __func__);
-		return -EINVAL;
-	}
-	if (copy_from_user(&cdata,
-		(void *)arg,
-		sizeof(struct csiphy_cfg_data))) {
-		pr_err("%s: %d failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-	switch (cdata.cfgtype) {
-	case CSIPHY_INIT:
-		rc = msm_csiphy_init(csiphy_dev);
-		break;
-	case CSIPHY_CFG:
-		if (copy_from_user(&csiphy_params,
-			(void *)cdata.csiphy_params,
-			sizeof(struct msm_camera_csiphy_params))) {
-			pr_err("%s: %d failed\n", __func__, __LINE__);
-			rc = -EFAULT;
-			break;
-		}
-		rc = msm_csiphy_lane_config(csiphy_dev, &csiphy_params);
-		break;
-	default:
-		pr_err("%s: %d failed\n", __func__, __LINE__);
-		rc = -ENOIOCTLCMD;
-		break;
-	}
-	return rc;
-}
-
 static long msm_csiphy_subdev_ioctl(struct v4l2_subdev *sd,
 			unsigned int cmd, void *arg)
 {
-	int rc = -ENOIOCTLCMD;
-	struct csiphy_device *csiphy_dev = v4l2_get_subdevdata(sd);
-	mutex_lock(&csiphy_dev->mutex);
+	struct csiphy_cfg_params cfg_params;
 	switch (cmd) {
 	case VIDIOC_MSM_CSIPHY_CFG:
-		rc = msm_csiphy_cmd(csiphy_dev, arg);
-		break;
+		cfg_params.subdev = sd;
+		cfg_params.parms = arg;
+		return msm_csiphy_config(
+			(struct csiphy_cfg_params *)&cfg_params);
+	case VIDIOC_MSM_CSIPHY_INIT:
+		return msm_csiphy_init(sd);
 	case VIDIOC_MSM_CSIPHY_RELEASE:
-		rc = msm_csiphy_release(csiphy_dev, arg);
-		break;
+		return msm_csiphy_release(sd);
 	default:
-		pr_err("%s: command not found\n", __func__);
+		return -ENOIOCTLCMD;
 	}
-	mutex_unlock(&csiphy_dev->mutex);
-	return rc;
 }
-
 static const struct v4l2_subdev_internal_ops msm_csiphy_internal_ops;
 
 static struct v4l2_subdev_core_ops msm_csiphy_subdev_core_ops = {
@@ -356,8 +232,7 @@
 {
 	struct csiphy_device *new_csiphy_dev;
 	int rc = 0;
-	struct msm_cam_subdev_info sd_info;
-
+	CDBG("%s: device id = %d\n", __func__, pdev->id);
 	new_csiphy_dev = kzalloc(sizeof(struct csiphy_device), GFP_KERNEL);
 	if (!new_csiphy_dev) {
 		pr_err("%s: no enough memory\n", __func__);
@@ -369,16 +244,12 @@
 	new_csiphy_dev->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	snprintf(new_csiphy_dev->subdev.name,
 			ARRAY_SIZE(new_csiphy_dev->subdev.name), "msm_csiphy");
+	
 	v4l2_set_subdevdata(&new_csiphy_dev->subdev, new_csiphy_dev);
 	platform_set_drvdata(pdev, &new_csiphy_dev->subdev);
 
 	mutex_init(&new_csiphy_dev->mutex);
 
-	if (pdev->dev.of_node)
-		of_property_read_u32((&pdev->dev)->of_node,
-			"cell-index", &pdev->id);
-	CDBG("%s: device id = %d\n", __func__, pdev->id);
-
 	new_csiphy_dev->mem = platform_get_resource_byname(pdev,
 					IORESOURCE_MEM, "csiphy");
 	if (!new_csiphy_dev->mem) {
@@ -413,40 +284,22 @@
 	disable_irq(new_csiphy_dev->irq->start);
 
 	new_csiphy_dev->pdev = pdev;
-	sd_info.sdev_type = CSIPHY_DEV;
-	sd_info.sd_index = pdev->id;
-	sd_info.irq_num = new_csiphy_dev->irq->start;
+	
 	msm_cam_register_subdev_node(
-		&new_csiphy_dev->subdev, &sd_info);
-
-	media_entity_init(&new_csiphy_dev->subdev.entity, 0, NULL, 0);
-	new_csiphy_dev->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	new_csiphy_dev->subdev.entity.group_id = CSIPHY_DEV;
-	new_csiphy_dev->subdev.entity.name = pdev->name;
-	new_csiphy_dev->subdev.entity.revision =
-		new_csiphy_dev->subdev.devnode->num;
-	new_csiphy_dev->csiphy_state = CSIPHY_POWER_DOWN;
+		&new_csiphy_dev->subdev, CSIPHY_DEV, pdev->id);
 	return 0;
 
 csiphy_no_resource:
 	mutex_destroy(&new_csiphy_dev->mutex);
 	kfree(new_csiphy_dev);
-	return rc;
+	return 0;
 }
 
-static const struct of_device_id msm_csiphy_dt_match[] = {
-	{.compatible = "qcom,csiphy"},
-	{}
-};
-
-MODULE_DEVICE_TABLE(of, msm_csiphy_dt_match);
-
 static struct platform_driver csiphy_driver = {
 	.probe = csiphy_probe,
 	.driver = {
 		.name = MSM_CSIPHY_DRV_NAME,
 		.owner = THIS_MODULE,
-		.of_match_table = msm_csiphy_dt_match,
 	},
 };
 
diff --git a/drivers/media/video/msm/csi/msm_csiphy.h b/drivers/media/video/msm/csi/msm_csiphy.h
index 93c9758..522a1c1 100644
--- a/drivers/media/video/msm/csi/msm_csiphy.h
+++ b/drivers/media/video/msm/csi/msm_csiphy.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -16,14 +16,6 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <media/v4l2-subdev.h>
-#include <media/msm_camera.h>
-
-#define MAX_CSIPHY 3
-
-enum msm_csiphy_state_t {
-	CSIPHY_POWER_UP,
-	CSIPHY_POWER_DOWN,
-};
 
 struct csiphy_device {
 	struct platform_device *pdev;
@@ -33,17 +25,22 @@
 	struct resource *io;
 	void __iomem *base;
 	struct mutex mutex;
-	uint32_t hw_version;
-	enum msm_csiphy_state_t csiphy_state;
 
-	struct clk *csiphy_clk[3];
-	uint8_t ref_count;
-	uint16_t lane_mask[MAX_CSIPHY];
+	struct clk *csiphy_clk[2];
+};
+
+struct csiphy_cfg_params {
+	struct v4l2_subdev *subdev;
+	void *parms;
 };
 
 #define VIDIOC_MSM_CSIPHY_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct csiphy_cfg_data*)
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct csiphy_cfg_params)
+
+#define VIDIOC_MSM_CSIPHY_INIT \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 8, struct v4l2_subdev*)
 
 #define VIDIOC_MSM_CSIPHY_RELEASE \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 9, void *)
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 9, struct v4l2_subdev*)
+
 #endif
diff --git a/drivers/media/video/msm/csi/msm_ispif.c b/drivers/media/video/msm/csi/msm_ispif.c
index 108e631..b736ce7 100644
--- a/drivers/media/video/msm/csi/msm_ispif.c
+++ b/drivers/media/video/msm/csi/msm_ispif.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -10,34 +10,80 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/io.h>
-#include <linux/module.h>
-#include <linux/of.h>
 #include <mach/gpio.h>
 #include <mach/camera.h>
 #include "msm_ispif.h"
 #include "msm.h"
-#include "msm_ispif_hwreg.h"
 
-#define V4L2_IDENT_ISPIF                     50001
-#define CSID_VERSION_V2                      0x02000011
-#define CSID_VERSION_V3                      0x30000000
+#define V4L2_IDENT_ISPIF			50001
+#define CSID_VERSION_V2                      0x2000011
+
+
+#define ISPIF_RST_CMD_ADDR                        0X00
+#define ISPIF_INTF_CMD_ADDR                       0X04
+#define ISPIF_CTRL_ADDR                           0X08
+#define ISPIF_INPUT_SEL_ADDR                      0X0C
+#define ISPIF_PIX_INTF_CID_MASK_ADDR              0X10
+#define ISPIF_RDI_INTF_CID_MASK_ADDR              0X14
+#define ISPIF_PIX_1_INTF_CID_MASK_ADDR            0X38
+#define ISPIF_RDI_1_INTF_CID_MASK_ADDR            0X3C
+#define ISPIF_PIX_STATUS_ADDR                     0X24
+#define ISPIF_RDI_STATUS_ADDR                     0X28
+#define ISPIF_RDI_1_STATUS_ADDR                   0X64
+#define ISPIF_IRQ_MASK_ADDR                     0X0100
+#define ISPIF_IRQ_CLEAR_ADDR                    0X0104
+#define ISPIF_IRQ_STATUS_ADDR                   0X0108
+#define ISPIF_IRQ_MASK_1_ADDR                   0X010C
+#define ISPIF_IRQ_CLEAR_1_ADDR                  0X0110
+#define ISPIF_IRQ_STATUS_1_ADDR                 0X0114
+#define ISPIF_IRQ_GLOBAL_CLEAR_CMD_ADDR         0x0124
+
+
+#define VFE_CLK_DOMAIN_RST           31
+#define RDI_CLK_DOMAIN_RST           30
+#define PIX_CLK_DOMAIN_RST           29
+#define AHB_CLK_DOMAIN_RST           28
+#define RDI_1_CLK_DOMAIN_RST         27
+#define RDI_1_VFE_RST_STB            13
+#define RDI_1_CSID_RST_STB           12
+#define RDI_VFE_RST_STB              7
+#define RDI_CSID_RST_STB             6
+#define PIX_VFE_RST_STB              4
+#define PIX_CSID_RST_STB             3
+#define SW_REG_RST_STB               2
+#define MISC_LOGIC_RST_STB           1
+#define STROBED_RST_EN               0
+
+#define PIX_INTF_0_OVERFLOW_IRQ      12
+#define RAW_INTF_0_OVERFLOW_IRQ      25
+#define RAW_INTF_1_OVERFLOW_IRQ      25
+#define RESET_DONE_IRQ               27
+
+#define ISPIF_IRQ_STATUS_MASK        0xA493000
+#define ISPIF_IRQ_1_STATUS_MASK      0xA493000
+#define ISPIF_IRQ_STATUS_RDI_SOF_MASK	0x492000
+#define ISPIF_IRQ_GLOBAL_CLEAR_CMD     0x1
 
 #define MAX_CID 15
 
-static atomic_t ispif_irq_cnt;
-static spinlock_t ispif_tasklet_lock;
-static struct list_head ispif_tasklet_q;
 
-static int msm_ispif_intf_reset(struct ispif_device *ispif,
-	uint16_t intfmask, uint8_t vfe_intf)
+static struct ispif_device *ispif;
+atomic_t ispif_irq_cnt;
+spinlock_t  ispif_tasklet_lock;
+struct list_head ispif_tasklet_q;
+
+static uint32_t global_intf_cmd_mask = 0xFFFFFFFF;
+
+
+static int msm_ispif_intf_reset(uint8_t intfmask)
 {
 	int rc = 0;
-	uint32_t data = (0x1 << STROBED_RST_EN);
-	uint16_t intfnum = 0, mask = intfmask;
-
+	uint32_t data = 0x1;
+	uint8_t intfnum = 0, mask = intfmask;
 	while (mask != 0) {
 		if (!(intfmask & (0x1 << intfnum))) {
 			mask >>= 1;
@@ -46,32 +92,21 @@
 		}
 		switch (intfnum) {
 		case PIX0:
-			data |= (0x1 << PIX_0_VFE_RST_STB) |
-				(0x1 << PIX_0_CSID_RST_STB);
-			ispif->pix_sof_count = 0;
+			data = (0x1 << STROBED_RST_EN) +
+				(0x1 << PIX_VFE_RST_STB) +
+				(0x1 << PIX_CSID_RST_STB);
 			break;
 
 		case RDI0:
-			data |= (0x1 << RDI_0_VFE_RST_STB) |
-				(0x1 << RDI_0_CSID_RST_STB);
-			ispif->rdi0_sof_count = 0;
-			break;
-
-		case PIX1:
-			data |= (0x1 << PIX_1_VFE_RST_STB) |
-				(0x1 << PIX_1_CSID_RST_STB);
+			data = (0x1 << STROBED_RST_EN) +
+				(0x1 << RDI_VFE_RST_STB)  +
+				(0x1 << RDI_CSID_RST_STB);
 			break;
 
 		case RDI1:
-			data |= (0x1 << RDI_1_VFE_RST_STB) |
+			data = (0x1 << STROBED_RST_EN) +
+				(0x1 << RDI_1_VFE_RST_STB) +
 				(0x1 << RDI_1_CSID_RST_STB);
-			ispif->rdi1_sof_count = 0;
-			break;
-
-		case RDI2:
-			data |= (0x1 << RDI_2_VFE_RST_STB) |
-				(0x1 << RDI_2_CSID_RST_STB);
-			ispif->rdi2_sof_count = 0;
 			break;
 
 		default:
@@ -80,28 +115,28 @@
 		}
 		mask >>= 1;
 		intfnum++;
-	}	/*end while */
-	if (data > 0x1) {
-		if (vfe_intf == VFE0)
-			msm_camera_io_w(data, ispif->base + ISPIF_RST_CMD_ADDR);
-		else
-			msm_camera_io_w(data, ispif->base +
-				ISPIF_RST_CMD_1_ADDR);
+	}	
+	if (rc >= 0) {
+		msm_io_w(data, ispif->base + ISPIF_RST_CMD_ADDR);
 		rc = wait_for_completion_interruptible(&ispif->reset_complete);
 	}
+
 	return rc;
 }
 
-static int msm_ispif_reset(struct ispif_device *ispif)
+static int msm_ispif_reset(void)
 {
-	int rc = 0;
-	ispif->pix_sof_count = 0;
-	msm_camera_io_w(ISPIF_RST_CMD_MASK, ispif->base + ISPIF_RST_CMD_ADDR);
-	if (ispif->csid_version == CSID_VERSION_V3)
-		msm_camera_io_w(ISPIF_RST_CMD_1_MASK, ispif->base +
-				ISPIF_RST_CMD_1_ADDR);
-	rc = wait_for_completion_interruptible(&ispif->reset_complete);
-	return rc;
+	uint32_t data = (0x1 << STROBED_RST_EN) +
+		(0x1 << SW_REG_RST_STB) +
+		(0x1 << MISC_LOGIC_RST_STB) +
+		(0x1 << PIX_VFE_RST_STB) +
+		(0x1 << PIX_CSID_RST_STB) +
+		(0x1 << RDI_VFE_RST_STB) +
+		(0x1 << RDI_CSID_RST_STB) +
+		(0x1 << RDI_1_VFE_RST_STB) +
+		(0x1 << RDI_1_CSID_RST_STB);
+	msm_io_w(data, ispif->base + ISPIF_RST_CMD_ADDR);
+	return wait_for_completion_interruptible(&ispif->reset_complete);
 }
 
 static int msm_ispif_subdev_g_chip_ident(struct v4l2_subdev *sd,
@@ -113,228 +148,103 @@
 	return 0;
 }
 
-static void msm_ispif_sel_csid_core(struct ispif_device *ispif,
-	uint8_t intftype, uint8_t csid, uint8_t vfe_intf)
+static void msm_ispif_sel_csid_core(uint8_t intftype, uint8_t csid)
 {
 	int rc = 0;
-	uint32_t data = 0;
-
-	if (ispif->csid_version <= CSID_VERSION_V2) {
-		if (ispif->ispif_clk[intftype] == NULL) {
-			pr_err("%s: ispif NULL clk\n", __func__);
-			return;
-		}
-		rc = clk_set_rate(ispif->ispif_clk[intftype], csid);
-		if (rc < 0)
-			pr_err("%s: clk_set_rate failed %d\n", __func__, rc);
+	uint32_t data;
+	if (ispif->ispif_clk[intftype] == NULL) {
+		pr_err("%s: ispif NULL clk\n", __func__);
+		return;
 	}
-	data = msm_camera_io_r(ispif->base + ISPIF_INPUT_SEL_ADDR +
-		(0x200 * vfe_intf));
-	switch (intftype) {
-	case PIX0:
-		data &= ~(0x3);
-		data |= csid;
-		break;
 
-	case RDI0:
-		data &= ~(0x3 << 4);
-		data |= (csid << 4);
-		break;
+	rc = clk_set_rate(ispif->ispif_clk[intftype], csid);
+	if (rc < 0)
+		pr_err("%s: clk_set_rate failed %d\n", __func__, rc);
 
-	case PIX1:
-		data &= ~(0x3 << 8);
-		data |= (csid << 8);
-		break;
-
-	case RDI1:
-		data &= ~(0x3 << 12);
-		data |= (csid << 12);
-		break;
-
-	case RDI2:
-		data &= ~(0x3 << 20);
-		data |= (csid << 20);
-		break;
-	}
-	if (data) {
-		msm_camera_io_w(data, ispif->base + ISPIF_INPUT_SEL_ADDR +
-			(0x200 * vfe_intf));
-	}
+	data = msm_io_r(ispif->base + ISPIF_INPUT_SEL_ADDR);
+	data |= csid<<(intftype*4);
+	msm_io_w(data, ispif->base + ISPIF_INPUT_SEL_ADDR);
 }
 
-static void msm_ispif_enable_intf_cids(struct ispif_device *ispif,
-	uint8_t intftype, uint16_t cid_mask, uint8_t vfe_intf)
+static void msm_ispif_enable_intf_cids(uint8_t intftype, uint16_t cid_mask)
 {
-	uint32_t data = 0;
+	uint32_t data;
 	mutex_lock(&ispif->mutex);
 	switch (intftype) {
 	case PIX0:
-		data = msm_camera_io_r(ispif->base +
-			ISPIF_PIX_0_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
+		data = msm_io_r(ispif->base +
+				ISPIF_PIX_INTF_CID_MASK_ADDR);
 		data |= cid_mask;
-		msm_camera_io_w(data, ispif->base +
-			ISPIF_PIX_0_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
+		msm_io_w(data, ispif->base +
+				ISPIF_PIX_INTF_CID_MASK_ADDR);
 		break;
 
 	case RDI0:
-		data = msm_camera_io_r(ispif->base +
-			ISPIF_RDI_0_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
+		data = msm_io_r(ispif->base +
+				ISPIF_RDI_INTF_CID_MASK_ADDR);
 		data |= cid_mask;
-		msm_camera_io_w(data, ispif->base +
-			ISPIF_RDI_0_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
-		break;
-
-	case PIX1:
-		data = msm_camera_io_r(ispif->base +
-			ISPIF_PIX_1_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
-		data |= cid_mask;
-		msm_camera_io_w(data, ispif->base +
-			ISPIF_PIX_1_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
+		msm_io_w(data, ispif->base +
+				ISPIF_RDI_INTF_CID_MASK_ADDR);
 		break;
 
 	case RDI1:
-		data = msm_camera_io_r(ispif->base +
-			ISPIF_RDI_1_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
+		data = msm_io_r(ispif->base +
+				ISPIF_RDI_1_INTF_CID_MASK_ADDR);
 		data |= cid_mask;
-		msm_camera_io_w(data, ispif->base +
-			ISPIF_RDI_1_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
-		break;
-
-	case RDI2:
-		data = msm_camera_io_r(ispif->base +
-			ISPIF_RDI_2_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
-		data |= cid_mask;
-		msm_camera_io_w(data, ispif->base +
-			ISPIF_RDI_2_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
+		msm_io_w(data, ispif->base +
+				ISPIF_RDI_1_INTF_CID_MASK_ADDR);
 		break;
 	}
 	mutex_unlock(&ispif->mutex);
 }
 
-static int32_t msm_ispif_validate_intf_status(struct ispif_device *ispif,
-	uint8_t intftype, uint8_t vfe_intf)
-{
-	int32_t rc = 0;
-	uint32_t data = 0;
-	mutex_lock(&ispif->mutex);
-	switch (intftype) {
-	case PIX0:
-		data = msm_camera_io_r(ispif->base +
-				ISPIF_PIX_0_STATUS_ADDR + (0x200 * vfe_intf));
-		break;
-
-	case RDI0:
-		data = msm_camera_io_r(ispif->base +
-				ISPIF_RDI_0_STATUS_ADDR + (0x200 * vfe_intf));
-		break;
-
-	case PIX1:
-		data = msm_camera_io_r(ispif->base +
-				ISPIF_PIX_1_STATUS_ADDR + (0x200 * vfe_intf));
-		break;
-
-	case RDI1:
-		data = msm_camera_io_r(ispif->base +
-				ISPIF_RDI_1_STATUS_ADDR + (0x200 * vfe_intf));
-		break;
-
-	case RDI2:
-		data = msm_camera_io_r(ispif->base +
-				ISPIF_RDI_2_STATUS_ADDR + (0x200 * vfe_intf));
-		break;
-	}
-	if ((data & 0xf) != 0xf)
-		rc = -EBUSY;
-	mutex_unlock(&ispif->mutex);
-	return rc;
-}
-
-static int msm_ispif_config(struct ispif_device *ispif,
-	struct msm_ispif_params_list *params_list)
+static int msm_ispif_config(struct msm_ispif_params_list *params_list)
 {
 	uint32_t params_len;
 	struct msm_ispif_params *ispif_params;
+	uint32_t data, data1;
 	int rc = 0, i = 0;
-	uint8_t intftype;
-	uint8_t vfe_intf;
 	params_len = params_list->len;
 	ispif_params = params_list->params;
 	CDBG("Enable interface\n");
-	msm_camera_io_w(0x00000000, ispif->base + ISPIF_IRQ_MASK_ADDR);
-	msm_camera_io_w(0x00000000, ispif->base + ISPIF_IRQ_MASK_1_ADDR);
-	msm_camera_io_w(0x00000000, ispif->base + ISPIF_IRQ_MASK_2_ADDR);
+	data = msm_io_r(ispif->base + ISPIF_PIX_STATUS_ADDR);
+	data1 = msm_io_r(ispif->base + ISPIF_RDI_STATUS_ADDR);
+	if (((data & 0xf) != 0xf) || ((data1 & 0xf) != 0xf))
+		return -EBUSY;
+	msm_io_w(0x00000000, ispif->base + ISPIF_IRQ_MASK_ADDR);
 	for (i = 0; i < params_len; i++) {
-		intftype = ispif_params[i].intftype;
-		vfe_intf = ispif_params[i].vfe_intf;
-		CDBG("%s intftype %x, vfe_intf %d, csid %d\n", __func__,
-			intftype, vfe_intf, ispif_params[i].csid);
-		if ((intftype >= INTF_MAX) ||
-			(ispif->csid_version <= CSID_VERSION_V2 &&
-			vfe_intf > VFE0) ||
-			(ispif->csid_version == CSID_VERSION_V3 &&
-			vfe_intf >= VFE_MAX)) {
-			pr_err("%s: intftype / vfe intf not valid\n",
-				__func__);
-			return -EINVAL;
-		}
-
-		rc = msm_ispif_validate_intf_status(ispif, intftype, vfe_intf);
-		if (rc < 0) {
-			pr_err("%s:%d failed rc %d\n", __func__, __LINE__, rc);
-			return rc;
-		}
-		msm_ispif_sel_csid_core(ispif, intftype, ispif_params[i].csid,
-			vfe_intf);
-		msm_ispif_enable_intf_cids(ispif, intftype,
-			ispif_params[i].cid_mask, vfe_intf);
+		msm_ispif_sel_csid_core(ispif_params[i].intftype,
+			ispif_params[i].csid);
+		msm_ispif_enable_intf_cids(ispif_params[i].intftype,
+			ispif_params[i].cid_mask);
 	}
-	msm_camera_io_w(0x40, ispif->base + ISPIF_CTRL_ADDR);
 
-	msm_camera_io_w(ISPIF_IRQ_STATUS_MASK, ispif->base +
+	msm_io_w(ISPIF_IRQ_STATUS_MASK, ispif->base +
 					ISPIF_IRQ_MASK_ADDR);
-	msm_camera_io_w(ISPIF_IRQ_STATUS_MASK, ispif->base +
+	msm_io_w(ISPIF_IRQ_STATUS_MASK, ispif->base +
 					ISPIF_IRQ_CLEAR_ADDR);
-	msm_camera_io_w(ISPIF_IRQ_STATUS_1_MASK, ispif->base +
-					ISPIF_IRQ_MASK_1_ADDR);
-	msm_camera_io_w(ISPIF_IRQ_STATUS_1_MASK, ispif->base +
-					ISPIF_IRQ_CLEAR_1_ADDR);
-	msm_camera_io_w(ISPIF_IRQ_STATUS_2_MASK, ispif->base +
-					ISPIF_IRQ_MASK_2_ADDR);
-	msm_camera_io_w(ISPIF_IRQ_STATUS_2_MASK, ispif->base +
-					ISPIF_IRQ_CLEAR_2_ADDR);
-	msm_camera_io_w(ISPIF_IRQ_GLOBAL_CLEAR_CMD, ispif->base +
+	msm_io_w(ISPIF_IRQ_GLOBAL_CLEAR_CMD, ispif->base +
 		 ISPIF_IRQ_GLOBAL_CLEAR_CMD_ADDR);
 	return rc;
 }
 
-static uint32_t msm_ispif_get_cid_mask(struct ispif_device *ispif,
-	uint16_t intftype, uint8_t vfe_intf)
+static uint32_t msm_ispif_get_cid_mask(uint8_t intftype)
 {
 	uint32_t mask = 0;
 	switch (intftype) {
 	case PIX0:
-		mask = msm_camera_io_r(ispif->base +
-			ISPIF_PIX_0_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
+		mask = msm_io_r(ispif->base +
+			ISPIF_PIX_INTF_CID_MASK_ADDR);
 		break;
 
 	case RDI0:
-		mask = msm_camera_io_r(ispif->base +
-			ISPIF_RDI_0_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
-		break;
-
-	case PIX1:
-		mask = msm_camera_io_r(ispif->base +
-			ISPIF_PIX_1_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
+		mask = msm_io_r(ispif->base +
+			ISPIF_RDI_INTF_CID_MASK_ADDR);
 		break;
 
 	case RDI1:
-		mask = msm_camera_io_r(ispif->base +
-			ISPIF_RDI_1_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
-		break;
-
-	case RDI2:
-		mask = msm_camera_io_r(ispif->base +
-			ISPIF_RDI_2_INTF_CID_MASK_ADDR + (0x200 * vfe_intf));
+		mask = msm_io_r(ispif->base +
+			ISPIF_RDI_1_INTF_CID_MASK_ADDR);
 		break;
 
 	default:
@@ -343,13 +253,12 @@
 	return mask;
 }
 
-static void msm_ispif_intf_cmd(struct ispif_device *ispif, uint16_t intfmask,
-	uint8_t intf_cmd_mask, uint8_t vfe_intf)
+static void
+msm_ispif_intf_cmd(uint8_t intfmask, uint8_t intf_cmd_mask)
 {
 	uint8_t vc = 0, val = 0;
-	uint16_t mask = intfmask, intfnum = 0;
+	uint8_t mask = intfmask, intfnum = 0;
 	uint32_t cid_mask = 0;
-	uint32_t global_intf_cmd_mask1 = 0xFFFFFFFF;
 	while (mask != 0) {
 		if (!(intfmask & (0x1 << intfnum))) {
 			mask >>= 1;
@@ -357,23 +266,17 @@
 			continue;
 		}
 
-		cid_mask = msm_ispif_get_cid_mask(ispif, intfnum, vfe_intf);
+		cid_mask = msm_ispif_get_cid_mask(intfnum);
 		vc = 0;
 
 		while (cid_mask != 0) {
 			if ((cid_mask & 0xf) != 0x0) {
-				if (intfnum != RDI2) {
-					val = (intf_cmd_mask>>(vc*2)) & 0x3;
-					ispif->global_intf_cmd_mask |=
-						(0x3 << ((vc * 2) +
-						(intfnum * 8)));
-					ispif->global_intf_cmd_mask &=
-						~((0x3 & ~val) << ((vc * 2) +
-						(intfnum * 8)));
-				} else
-					global_intf_cmd_mask1 &=
-						~((0x3 & ~intf_cmd_mask)
-						<< ((vc * 2) + 8));
+				val = (intf_cmd_mask>>(vc*2)) & 0x3;
+				global_intf_cmd_mask |=
+					(0x3 << ((vc * 2) + (intfnum * 8)));
+				global_intf_cmd_mask &= ~((0x3 & ~val)
+					<< ((vc * 2) +
+					(intfnum * 8)));
 			}
 			vc++;
 			cid_mask >>= 4;
@@ -381,114 +284,75 @@
 		mask >>= 1;
 		intfnum++;
 	}
-	msm_camera_io_w(ispif->global_intf_cmd_mask,
-		ispif->base + ISPIF_INTF_CMD_ADDR + (0x200 * vfe_intf));
-	if (global_intf_cmd_mask1 != 0xFFFFFFFF)
-		msm_camera_io_w(global_intf_cmd_mask1,
-			ispif->base + ISPIF_INTF_CMD_1_ADDR +
-			(0x200 * vfe_intf));
+	msm_io_w(global_intf_cmd_mask, ispif->base + ISPIF_INTF_CMD_ADDR);
 }
 
-static int msm_ispif_abort_intf_transfer(struct ispif_device *ispif,
-	uint16_t intfmask, uint8_t vfe_intf)
+static int msm_ispif_abort_intf_transfer(uint8_t intfmask)
 {
 	int rc = 0;
 	uint8_t intf_cmd_mask = 0xAA;
-	uint16_t intfnum = 0, mask = intfmask;
+	uint8_t intfnum = 0, mask = intfmask;
 	mutex_lock(&ispif->mutex);
-	CDBG("%s intfmask %x intf_cmd_mask %x\n", __func__, intfmask,
-		intf_cmd_mask);
-	msm_ispif_intf_cmd(ispif, intfmask, intf_cmd_mask, vfe_intf);
+	msm_ispif_intf_cmd(intfmask, intf_cmd_mask);
 	while (mask != 0) {
 		if (intfmask & (0x1 << intfnum))
-			ispif->global_intf_cmd_mask |= (0xFF << (intfnum * 8));
+			global_intf_cmd_mask |= (0xFF << (intfnum * 8));
 		mask >>= 1;
 		intfnum++;
-		if (intfnum == RDI2)
-			break;
 	}
 	mutex_unlock(&ispif->mutex);
 	return rc;
 }
 
-static int msm_ispif_start_intf_transfer(struct ispif_device *ispif,
-	uint16_t intfmask, uint8_t vfe_intf)
+static int msm_ispif_start_intf_transfer(uint8_t intfmask)
 {
 	uint8_t intf_cmd_mask = 0x55;
 	int rc = 0;
 	mutex_lock(&ispif->mutex);
-	rc = msm_ispif_intf_reset(ispif, intfmask, vfe_intf);
-	CDBG("%s intfmask start after%x intf_cmd_mask %x\n", __func__, intfmask,
-		intf_cmd_mask);
-	msm_ispif_intf_cmd(ispif, intfmask, intf_cmd_mask, vfe_intf);
+	rc = msm_ispif_intf_reset(intfmask);
+	msm_ispif_intf_cmd(intfmask, intf_cmd_mask);
 	mutex_unlock(&ispif->mutex);
 	return rc;
 }
 
-static int msm_ispif_stop_intf_transfer(struct ispif_device *ispif,
-	uint16_t intfmask, uint8_t vfe_intf)
+static int msm_ispif_stop_intf_transfer(uint8_t intfmask)
 {
 	int rc = 0;
 	uint8_t intf_cmd_mask = 0x00;
-	uint16_t intfnum = 0, mask = intfmask;
+	uint8_t intfnum = 0, mask = intfmask;
 	mutex_lock(&ispif->mutex);
-	CDBG("%s intfmask %x intf_cmd_mask %x\n", __func__, intfmask,
-		intf_cmd_mask);
-	msm_ispif_intf_cmd(ispif, intfmask, intf_cmd_mask, vfe_intf);
+	msm_ispif_intf_cmd(intfmask, intf_cmd_mask);
 	while (mask != 0) {
 		if (intfmask & (0x1 << intfnum)) {
 			switch (intfnum) {
 			case PIX0:
-				while ((msm_camera_io_r(ispif->base +
-					ISPIF_PIX_0_STATUS_ADDR +
-					(0x200 * vfe_intf))
+				while ((msm_io_r(ispif->base +
+					ISPIF_PIX_STATUS_ADDR)
 					& 0xf) != 0xf) {
 					CDBG("Wait for pix0 Idle\n");
 				}
 				break;
 
 			case RDI0:
-				while ((msm_camera_io_r(ispif->base +
-					ISPIF_RDI_0_STATUS_ADDR +
-					(0x200 * vfe_intf))
+				while ((msm_io_r(ispif->base +
+					ISPIF_RDI_STATUS_ADDR)
 					& 0xf) != 0xf) {
 					CDBG("Wait for rdi0 Idle\n");
 				}
 				break;
 
-			case PIX1:
-				while ((msm_camera_io_r(ispif->base +
-					ISPIF_PIX_1_STATUS_ADDR +
-					(0x200 * vfe_intf))
-					& 0xf) != 0xf) {
-					CDBG("Wait for pix1 Idle\n");
-				}
-				break;
-
 			case RDI1:
-				while ((msm_camera_io_r(ispif->base +
-					ISPIF_RDI_1_STATUS_ADDR +
-					(0x200 * vfe_intf))
+				while ((msm_io_r(ispif->base +
+					ISPIF_RDI_1_STATUS_ADDR)
 					& 0xf) != 0xf) {
 					CDBG("Wait for rdi1 Idle\n");
 				}
 				break;
 
-			case RDI2:
-				while ((msm_camera_io_r(ispif->base +
-					ISPIF_RDI_2_STATUS_ADDR +
-					(0x200 * vfe_intf))
-					& 0xf) != 0xf) {
-					CDBG("Wait for rdi2 Idle\n");
-				}
-				break;
-
 			default:
 				break;
 			}
-			if (intfnum != RDI2)
-				ispif->global_intf_cmd_mask |= (0xFF <<
-					(intfnum * 8));
+			global_intf_cmd_mask |= (0xFF << (intfnum * 8));
 		}
 		mask >>= 1;
 		intfnum++;
@@ -497,33 +361,24 @@
 	return rc;
 }
 
-static int msm_ispif_subdev_video_s_stream(struct v4l2_subdev *sd,
-	int enable)
+static int msm_ispif_subdev_video_s_stream(struct v4l2_subdev *sd, int enable)
 {
 	struct ispif_device *ispif =
 			(struct ispif_device *)v4l2_get_subdevdata(sd);
-	uint32_t cmd = enable & ((1<<ISPIF_S_STREAM_SHIFT)-1);
-	uint16_t intf = enable >> ISPIF_S_STREAM_SHIFT;
-	uint8_t vfe_intf = enable >> ISPIF_VFE_INTF_SHIFT;
+	int32_t cmd = enable & ((1<<ISPIF_S_STREAM_SHIFT)-1);
+	enum msm_ispif_intftype intf = enable >> ISPIF_S_STREAM_SHIFT;
 	int rc = -EINVAL;
-	CDBG("%s enable %x, cmd %x, intf %x\n", __func__, enable, cmd, intf);
+
 	BUG_ON(!ispif);
-	if ((ispif->csid_version <= CSID_VERSION_V2 && vfe_intf > VFE0) ||
-		(ispif->csid_version == CSID_VERSION_V3 &&
-		vfe_intf >= VFE_MAX)) {
-		pr_err("%s invalid csid version %x && vfe intf %d\n", __func__,
-			ispif->csid_version, vfe_intf);
-		return rc;
-	}
 	switch (cmd) {
 	case ISPIF_ON_FRAME_BOUNDARY:
-		rc = msm_ispif_start_intf_transfer(ispif, intf, vfe_intf);
+		rc = msm_ispif_start_intf_transfer(intf);
 		break;
 	case ISPIF_OFF_FRAME_BOUNDARY:
-		rc = msm_ispif_stop_intf_transfer(ispif, intf, vfe_intf);
+		rc = msm_ispif_stop_intf_transfer(intf);
 		break;
 	case ISPIF_OFF_IMMEDIATELY:
-		rc = msm_ispif_abort_intf_transfer(ispif, intf, vfe_intf);
+		rc = msm_ispif_abort_intf_transfer(intf);
 		break;
 	default:
 		break;
@@ -531,24 +386,13 @@
 	return rc;
 }
 
-static void send_rdi_sof(struct ispif_device *ispif,
-	enum msm_ispif_intftype interface, int count)
-{
-	struct rdi_count_msg sof_msg;
-	sof_msg.rdi_interface = interface;
-	sof_msg.count = count;
-	v4l2_subdev_notify(&ispif->subdev, NOTIFY_AXI_RDI_SOF_COUNT,
-					   (void *)&sof_msg);
-}
-
 static void ispif_do_tasklet(unsigned long data)
 {
 	unsigned long flags;
 
 	struct ispif_isr_queue_cmd *qcmd = NULL;
-	struct ispif_device *ispif;
+	CDBG("=== ispif_do_tasklet start ===\n");
 
-	ispif = (struct ispif_device *)data;
 	while (atomic_read(&ispif_irq_cnt)) {
 		spin_lock_irqsave(&ispif_tasklet_lock, flags);
 		qcmd = list_first_entry(&ispif_tasklet_q,
@@ -563,17 +407,27 @@
 		list_del(&qcmd->list);
 		spin_unlock_irqrestore(&ispif_tasklet_lock,
 			flags);
-
+		if (qcmd->ispifInterruptStatus0 &
+			ISPIF_IRQ_STATUS_RDI_SOF_MASK) {
+			CDBG("ispif rdi irq status\n");
+		}
+		if (qcmd->ispifInterruptStatus1 &
+			ISPIF_IRQ_STATUS_RDI_SOF_MASK) {
+			CDBG("ispif rdi1 irq status\n");
+		}
 		kfree(qcmd);
 	}
+	CDBG("=== ispif_do_tasklet end ===\n");
 }
 
-static void ispif_process_irq(struct ispif_device *ispif,
-	struct ispif_irq_status *out)
+DECLARE_TASKLET(ispif_tasklet, ispif_do_tasklet, 0);
+
+static void ispif_process_irq(struct ispif_irq_status *out)
 {
 	unsigned long flags;
 	struct ispif_isr_queue_cmd *qcmd;
 
+	CDBG("ispif_process_irq\n");
 	qcmd = kzalloc(sizeof(struct ispif_isr_queue_cmd),
 		GFP_ATOMIC);
 	if (!qcmd) {
@@ -582,115 +436,54 @@
 	}
 	qcmd->ispifInterruptStatus0 = out->ispifIrqStatus0;
 	qcmd->ispifInterruptStatus1 = out->ispifIrqStatus1;
-	qcmd->ispifInterruptStatus2 = out->ispifIrqStatus2;
-
-	if (qcmd->ispifInterruptStatus0 &
-			ISPIF_IRQ_STATUS_PIX_SOF_MASK) {
-			CDBG("%s: ispif PIX irq status\n", __func__);
-			ispif->pix_sof_count++;
-			v4l2_subdev_notify(&ispif->subdev,
-				NOTIFY_VFE_PIX_SOF_COUNT,
-				(void *)&ispif->pix_sof_count);
-	}
-
-	if (qcmd->ispifInterruptStatus0 &
-			ISPIF_IRQ_STATUS_RDI0_SOF_MASK) {
-			ispif->rdi0_sof_count++;
-			CDBG("%s: ispif RDI0 irq status, counter = %d",
-				__func__, ispif->rdi0_sof_count);
-			send_rdi_sof(ispif, RDI_0, ispif->rdi0_sof_count);
-	}
-	if (qcmd->ispifInterruptStatus1 &
-		ISPIF_IRQ_STATUS_RDI1_SOF_MASK) {
-		ispif->rdi1_sof_count++;
-		CDBG("%s: ispif RDI1 irq status, counter = %d",
-			__func__, ispif->rdi1_sof_count);
-		send_rdi_sof(ispif, RDI_1, ispif->rdi1_sof_count);
-	}
-	if (qcmd->ispifInterruptStatus2 &
-		ISPIF_IRQ_STATUS_RDI2_SOF_MASK) {
-		ispif->rdi2_sof_count++;
-		CDBG("%s: ispif RDI2 irq status, counter = %d",
-			__func__, ispif->rdi2_sof_count);
-		send_rdi_sof(ispif, RDI_2, ispif->rdi2_sof_count);
-	}
 
 	spin_lock_irqsave(&ispif_tasklet_lock, flags);
 	list_add_tail(&qcmd->list, &ispif_tasklet_q);
 
 	atomic_add(1, &ispif_irq_cnt);
 	spin_unlock_irqrestore(&ispif_tasklet_lock, flags);
-	tasklet_schedule(&ispif->ispif_tasklet);
+	tasklet_schedule(&ispif_tasklet);
 	return;
 }
 
-static inline void msm_ispif_read_irq_status(struct ispif_irq_status *out,
-	void *data)
+static inline void msm_ispif_read_irq_status(struct ispif_irq_status *out)
 {
-	uint32_t status0 = 0, status1 = 0, status2 = 0;
-	struct ispif_device *ispif = (struct ispif_device *)data;
-	out->ispifIrqStatus0 = msm_camera_io_r(ispif->base +
+	out->ispifIrqStatus0 = msm_io_r(ispif->base +
 		ISPIF_IRQ_STATUS_ADDR);
-	out->ispifIrqStatus1 = msm_camera_io_r(ispif->base +
+	out->ispifIrqStatus1 = msm_io_r(ispif->base +
 		ISPIF_IRQ_STATUS_1_ADDR);
-	out->ispifIrqStatus2 = msm_camera_io_r(ispif->base +
-		ISPIF_IRQ_STATUS_2_ADDR);
-	msm_camera_io_w(out->ispifIrqStatus0,
+	msm_io_w(out->ispifIrqStatus0,
 		ispif->base + ISPIF_IRQ_CLEAR_ADDR);
-	msm_camera_io_w(out->ispifIrqStatus1,
+	msm_io_w(out->ispifIrqStatus1,
 		ispif->base + ISPIF_IRQ_CLEAR_1_ADDR);
-	msm_camera_io_w(out->ispifIrqStatus2,
-		ispif->base + ISPIF_IRQ_CLEAR_2_ADDR);
 
-	CDBG("%s: irq vfe0 Irq_status0 = 0x%x, 1 = 0x%x, 2 = 0x%x\n",
-		__func__, out->ispifIrqStatus0, out->ispifIrqStatus1,
-		out->ispifIrqStatus2);
-	if (out->ispifIrqStatus0 & ISPIF_IRQ_STATUS_MASK ||
-		out->ispifIrqStatus1 & ISPIF_IRQ_STATUS_1_MASK ||
-		out->ispifIrqStatus2 & ISPIF_IRQ_STATUS_2_MASK) {
+	CDBG("ispif->irq: Irq_status0 = 0x%x\n",
+		out->ispifIrqStatus0);
+	if (out->ispifIrqStatus0 & ISPIF_IRQ_STATUS_MASK) {
 		if (out->ispifIrqStatus0 & (0x1 << RESET_DONE_IRQ))
 			complete(&ispif->reset_complete);
 		if (out->ispifIrqStatus0 & (0x1 << PIX_INTF_0_OVERFLOW_IRQ))
 			pr_err("%s: pix intf 0 overflow.\n", __func__);
 		if (out->ispifIrqStatus0 & (0x1 << RAW_INTF_0_OVERFLOW_IRQ))
 			pr_err("%s: rdi intf 0 overflow.\n", __func__);
-		if (out->ispifIrqStatus1 & (0x1 << RAW_INTF_1_OVERFLOW_IRQ))
-			pr_err("%s: rdi intf 1 overflow.\n", __func__);
-		if (out->ispifIrqStatus2 & (0x1 << RAW_INTF_2_OVERFLOW_IRQ))
-			pr_err("%s: rdi intf 2 overflow.\n", __func__);
-		if ((out->ispifIrqStatus0 & ISPIF_IRQ_STATUS_SOF_MASK) ||
-			(out->ispifIrqStatus1 &	ISPIF_IRQ_STATUS_SOF_MASK) ||
-			(out->ispifIrqStatus2 & ISPIF_IRQ_STATUS_RDI2_SOF_MASK))
-			ispif_process_irq(ispif, out);
+		if ((out->ispifIrqStatus0 & ISPIF_IRQ_STATUS_RDI_SOF_MASK) ||
+			(out->ispifIrqStatus1 &
+				ISPIF_IRQ_STATUS_RDI_SOF_MASK)) {
+			ispif_process_irq(out);
+		}
 	}
-	if (ispif->csid_version == CSID_VERSION_V3) {
-		status0 = msm_camera_io_r(ispif->base +
-			ISPIF_IRQ_STATUS_ADDR + 0x200);
-		msm_camera_io_w(status0,
-			ispif->base + ISPIF_IRQ_CLEAR_ADDR + 0x200);
-		status1 = msm_camera_io_r(ispif->base +
-			ISPIF_IRQ_STATUS_1_ADDR + 0x200);
-		msm_camera_io_w(status1,
-			ispif->base + ISPIF_IRQ_CLEAR_1_ADDR + 0x200);
-		status2 = msm_camera_io_r(ispif->base +
-			ISPIF_IRQ_STATUS_2_ADDR + 0x200);
-		msm_camera_io_w(status2,
-			ispif->base + ISPIF_IRQ_CLEAR_2_ADDR + 0x200);
-		CDBG("%s: irq vfe1 Irq_status0 = 0x%x, 1 = 0x%x, 2 = 0x%x\n",
-			__func__, status0, status1, status2);
-	}
-	msm_camera_io_w(ISPIF_IRQ_GLOBAL_CLEAR_CMD, ispif->base +
+	msm_io_w(ISPIF_IRQ_GLOBAL_CLEAR_CMD, ispif->base +
 		ISPIF_IRQ_GLOBAL_CLEAR_CMD_ADDR);
 }
 
 static irqreturn_t msm_io_ispif_irq(int irq_num, void *data)
 {
 	struct ispif_irq_status irq;
-	msm_ispif_read_irq_status(&irq, data);
+	msm_ispif_read_irq_status(&irq);
 	return IRQ_HANDLED;
 }
 
-static struct msm_cam_clk_info ispif_8960_clk_info[] = {
+static struct msm_cam_clk_info ispif_clk_info[] = {
 	{"csi_pix_clk", 0},
 	{"csi_rdi_clk", 0},
 	{"csi_pix1_clk", 0},
@@ -698,119 +491,93 @@
 	{"csi_rdi2_clk", 0},
 };
 
-static int msm_ispif_init(struct ispif_device *ispif,
-	const uint32_t *csid_version)
+static int msm_ispif_init(const uint32_t *csid_version)
 {
 	int rc = 0;
-	CDBG("%s called %d\n", __func__, __LINE__);
-
-	if (ispif->ispif_state == ISPIF_POWER_UP) {
-		pr_err("%s: ispif invalid state %d\n", __func__,
-			ispif->ispif_state);
-		rc = -EINVAL;
-		return rc;
-	}
-
 	spin_lock_init(&ispif_tasklet_lock);
 	INIT_LIST_HEAD(&ispif_tasklet_q);
 	rc = request_irq(ispif->irq->start, msm_io_ispif_irq,
-		IRQF_TRIGGER_RISING, "ispif", ispif);
-	ispif->global_intf_cmd_mask = 0xFFFFFFFF;
+		IRQF_TRIGGER_RISING, "ispif", 0);
+
+	global_intf_cmd_mask = 0xFFFFFFFF;
 	init_completion(&ispif->reset_complete);
 
-	tasklet_init(&ispif->ispif_tasklet,
-		ispif_do_tasklet, (unsigned long)ispif);
-
 	ispif->csid_version = *csid_version;
-	if (ispif->csid_version < CSID_VERSION_V2) {
-		rc = msm_cam_clk_enable(&ispif->pdev->dev, ispif_8960_clk_info,
+	if (ispif->csid_version == CSID_VERSION_V2) {
+		rc = msm_cam_clk_enable(&ispif->pdev->dev, ispif_clk_info,
+			ispif->ispif_clk, ARRAY_SIZE(ispif_clk_info), 1);
+		if (rc < 0)
+			return rc;
+	} else {
+		rc = msm_cam_clk_enable(&ispif->pdev->dev, ispif_clk_info,
 			ispif->ispif_clk, 2, 1);
 		if (rc < 0)
 			return rc;
-	} else if (ispif->csid_version == CSID_VERSION_V2) {
-		rc = msm_cam_clk_enable(&ispif->pdev->dev, ispif_8960_clk_info,
-			ispif->ispif_clk, ARRAY_SIZE(ispif_8960_clk_info), 1);
-		if (rc < 0)
-			return rc;
 	}
-	rc = msm_ispif_reset(ispif);
-	ispif->ispif_state = ISPIF_POWER_UP;
+
+	rc = msm_ispif_reset();
 	return rc;
 }
 
-static void msm_ispif_release(struct ispif_device *ispif)
+static void msm_ispif_release(struct v4l2_subdev *sd)
 {
-	if (ispif->ispif_state != ISPIF_POWER_UP) {
-		pr_err("%s: ispif invalid state %d\n", __func__,
-			ispif->ispif_state);
-		return;
-	}
+	struct ispif_device *ispif =
+			(struct ispif_device *)v4l2_get_subdevdata(sd);
+
+	if (ispif->csid_version == CSID_VERSION_V2)
+		msm_cam_clk_enable(&ispif->pdev->dev, ispif_clk_info,
+			ispif->ispif_clk, ARRAY_SIZE(ispif_clk_info), 0);
+	else
+		msm_cam_clk_enable(&ispif->pdev->dev, ispif_clk_info,
+			ispif->ispif_clk, 2, 0);
 
 	CDBG("%s, free_irq\n", __func__);
-	free_irq(ispif->irq->start, ispif);
-	tasklet_kill(&ispif->ispif_tasklet);
-
-	if (ispif->csid_version < CSID_VERSION_V2) {
-		msm_cam_clk_enable(&ispif->pdev->dev, ispif_8960_clk_info,
-			ispif->ispif_clk, 2, 0);
-	} else if (ispif->csid_version == CSID_VERSION_V2) {
-		msm_cam_clk_enable(&ispif->pdev->dev, ispif_8960_clk_info,
-			ispif->ispif_clk, ARRAY_SIZE(ispif_8960_clk_info), 0);
-	}
-	ispif->ispif_state = ISPIF_POWER_DOWN;
+	free_irq(ispif->irq->start, 0);
+	tasklet_kill(&ispif_tasklet);
 }
 
-static long msm_ispif_cmd(struct v4l2_subdev *sd, void *arg)
+void msm_ispif_vfe_get_cid(uint8_t intftype, char *cids, int *num)
 {
-	long rc = 0;
-	struct ispif_cfg_data cdata;
-	struct ispif_device *ispif =
-		(struct ispif_device *)v4l2_get_subdevdata(sd);
-	if (copy_from_user(&cdata, (void *)arg, sizeof(struct ispif_cfg_data)))
-		return -EFAULT;
-	CDBG("%s cfgtype = %d\n", __func__, cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case ISPIF_INIT:
-		CDBG("%s csid_version = %x\n", __func__,
-			cdata.cfg.csid_version);
-		rc = msm_ispif_init(ispif, &cdata.cfg.csid_version);
-		break;
-	case ISPIF_SET_CFG:
-		CDBG("%s len = %d, intftype = %d,.cid_mask = %d, csid = %d\n",
-			__func__,
-			cdata.cfg.ispif_params.len,
-			cdata.cfg.ispif_params.params[0].intftype,
-			cdata.cfg.ispif_params.params[0].cid_mask,
-			cdata.cfg.ispif_params.params[0].csid);
-		rc = msm_ispif_config(ispif, &cdata.cfg.ispif_params);
+	uint32_t data = 0;
+	int i = 0, j = 0;
+	switch (intftype) {
+	case PIX0:
+		data = msm_io_r(ispif->base +
+			ISPIF_PIX_INTF_CID_MASK_ADDR);
 		break;
 
-	case ISPIF_SET_ON_FRAME_BOUNDARY:
-	case ISPIF_SET_OFF_FRAME_BOUNDARY:
-	case ISPIF_SET_OFF_IMMEDIATELY:
-		rc = msm_ispif_subdev_video_s_stream(sd, cdata.cfg.cmd);
+	case RDI0:
+		data = msm_io_r(ispif->base +
+			ISPIF_RDI_INTF_CID_MASK_ADDR);
 		break;
-	case ISPIF_RELEASE:
-		msm_ispif_release(ispif);
+
+	case RDI1:
+		data = msm_io_r(ispif->base +
+			ISPIF_RDI_1_INTF_CID_MASK_ADDR);
 		break;
+
 	default:
 		break;
 	}
-
-	return rc;
+	for (i = 0; i <= MAX_CID; i++) {
+		if ((data & 0x1) == 0x1) {
+			cids[j++] = i;
+			(*num)++;
+		}
+		data >>= 1;
+	}
 }
 
 static long msm_ispif_subdev_ioctl(struct v4l2_subdev *sd, unsigned int cmd,
 								void *arg)
 {
-	struct ispif_device *ispif;
 	switch (cmd) {
 	case VIDIOC_MSM_ISPIF_CFG:
-		return msm_ispif_cmd(sd, arg);
-	case VIDIOC_MSM_ISPIF_REL:
-		ispif =	(struct ispif_device *)v4l2_get_subdevdata(sd);
-		msm_ispif_release(ispif);
-		return 0;
+		return msm_ispif_config((struct msm_ispif_params_list *)arg);
+	case VIDIOC_MSM_ISPIF_INIT:
+		return msm_ispif_init((uint32_t *)arg);
+	case VIDIOC_MSM_ISPIF_RELEASE:
+		msm_ispif_release(sd);
 	default:
 		return -ENOIOCTLCMD;
 	}
@@ -829,15 +596,11 @@
 	.core = &msm_ispif_subdev_core_ops,
 	.video = &msm_ispif_subdev_video_ops,
 };
-
 static const struct v4l2_subdev_internal_ops msm_ispif_internal_ops;
 
 static int __devinit ispif_probe(struct platform_device *pdev)
 {
 	int rc = 0;
-	struct msm_cam_subdev_info sd_info;
-	struct ispif_device *ispif;
-
 	CDBG("%s\n", __func__);
 	ispif = kzalloc(sizeof(struct ispif_device), GFP_KERNEL);
 	if (!ispif) {
@@ -850,16 +613,13 @@
 	ispif->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	snprintf(ispif->subdev.name,
 			ARRAY_SIZE(ispif->subdev.name), "msm_ispif");
+	
 	v4l2_set_subdevdata(&ispif->subdev, ispif);
 	platform_set_drvdata(pdev, &ispif->subdev);
 	snprintf(ispif->subdev.name, sizeof(ispif->subdev.name),
 								"ispif");
 	mutex_init(&ispif->mutex);
 
-	if (pdev->dev.of_node)
-		of_property_read_u32((&pdev->dev)->of_node,
-			"cell-index", &pdev->id);
-
 	ispif->mem = platform_get_resource_byname(pdev,
 					IORESOURCE_MEM, "ispif");
 	if (!ispif->mem) {
@@ -889,17 +649,8 @@
 	}
 
 	ispif->pdev = pdev;
-	sd_info.sdev_type = ISPIF_DEV;
-	sd_info.sd_index = pdev->id;
-	sd_info.irq_num = ispif->irq->start;
-	msm_cam_register_subdev_node(&ispif->subdev, &sd_info);
-
-	media_entity_init(&ispif->subdev.entity, 0, NULL, 0);
-	ispif->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	ispif->subdev.entity.group_id = ISPIF_DEV;
-	ispif->subdev.entity.name = pdev->name;
-	ispif->subdev.entity.revision = ispif->subdev.devnode->num;
-	ispif->ispif_state = ISPIF_POWER_DOWN;
+	
+	msm_cam_register_subdev_node(&ispif->subdev, ISPIF_DEV, pdev->id);
 	return 0;
 
 ispif_no_mem:
@@ -911,18 +662,11 @@
 	return rc;
 }
 
-static const struct of_device_id msm_ispif_dt_match[] = {
-	{.compatible = "qcom,ispif"},
-};
-
-MODULE_DEVICE_TABLE(of, msm_ispif_dt_match);
-
 static struct platform_driver ispif_driver = {
 	.probe = ispif_probe,
 	.driver = {
 		.name = MSM_ISPIF_DRV_NAME,
 		.owner = THIS_MODULE,
-		.of_match_table = msm_ispif_dt_match,
 	},
 };
 
diff --git a/drivers/media/video/msm/csi/msm_ispif.h b/drivers/media/video/msm/csi/msm_ispif.h
index b8926f4..8f1dd12 100644
--- a/drivers/media/video/msm/csi/msm_ispif.h
+++ b/drivers/media/video/msm/csi/msm_ispif.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -20,12 +20,6 @@
 struct ispif_irq_status {
 	uint32_t ispifIrqStatus0;
 	uint32_t ispifIrqStatus1;
-	uint32_t ispifIrqStatus2;
-};
-
-enum msm_ispif_state_t {
-	ISPIF_POWER_UP,
-	ISPIF_POWER_DOWN,
 };
 
 struct ispif_device {
@@ -40,26 +34,35 @@
 	struct completion reset_complete;
 	uint32_t csid_version;
 	struct clk *ispif_clk[5];
-	uint32_t pix_sof_count;
-	uint32_t rdi0_sof_count;
-	uint32_t rdi1_sof_count;
-	uint32_t rdi2_sof_count;
-	uint32_t global_intf_cmd_mask;
-	struct tasklet_struct ispif_tasklet;
-	enum msm_ispif_state_t ispif_state;
 };
 
 struct ispif_isr_queue_cmd {
 	struct list_head list;
 	uint32_t    ispifInterruptStatus0;
 	uint32_t    ispifInterruptStatus1;
-	uint32_t    ispifInterruptStatus2;
 };
 
 #define VIDIOC_MSM_ISPIF_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 18, struct ispif_cfg_data*)
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct msm_ispif_params)
 
-#define VIDIOC_MSM_ISPIF_REL \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 19, struct ispif_cfg_data*)
+#define VIDIOC_MSM_ISPIF_INIT \
+	_IO('V', BASE_VIDIOC_PRIVATE + 2)
+
+#define VIDIOC_MSM_ISPIF_RELEASE \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct v4l2_subdev*)
+
+#define ISPIF_STREAM(intf, action) (((intf)<<ISPIF_S_STREAM_SHIFT)+(action))
+#define ISPIF_ON_FRAME_BOUNDARY	(0x01 << 0)
+#define ISPIF_OFF_FRAME_BOUNDARY    (0x01 << 1)
+#define ISPIF_OFF_IMMEDIATELY       (0x01 << 2)
+#define ISPIF_S_STREAM_SHIFT	4
+
+
+#define PIX_0 (0x01 << 0)
+#define RDI_0 (0x01 << 1)
+#define PIX_1 (0x01 << 2)
+#define RDI_1 (0x01 << 3)
+
+void msm_ispif_vfe_get_cid(uint8_t intftype, char *cids, int *num);
 
 #endif
diff --git a/drivers/media/video/msm/eeprom/Makefile b/drivers/media/video/msm/eeprom/Makefile
deleted file mode 100644
index f7b7f5d..0000000
--- a/drivers/media/video/msm/eeprom/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-EXTRA_CFLAGS += -Idrivers/media/video/msm/io
-obj-$(CONFIG_MSM_EEPROM) += msm_camera_eeprom.o
-obj-$(CONFIG_IMX074_EEPROM) += imx074_eeprom.o
-obj-$(CONFIG_IMX091_EEPROM) += imx091_eeprom.o
\ No newline at end of file
diff --git a/drivers/media/video/msm/eeprom/imx074_eeprom.c b/drivers/media/video/msm/eeprom/imx074_eeprom.c
deleted file mode 100644
index eafa9a8..0000000
--- a/drivers/media/video/msm/eeprom/imx074_eeprom.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/module.h>
-#include "msm_camera_eeprom.h"
-#include "msm_camera_i2c.h"
-
-DEFINE_MUTEX(imx074_eeprom_mutex);
-static struct msm_eeprom_ctrl_t imx074_eeprom_t;
-
-static const struct i2c_device_id imx074_eeprom_i2c_id[] = {
-	{"imx074_eeprom", (kernel_ulong_t)&imx074_eeprom_t},
-	{ }
-};
-
-static struct i2c_driver imx074_eeprom_i2c_driver = {
-	.id_table = imx074_eeprom_i2c_id,
-	.probe  = msm_eeprom_i2c_probe,
-	.remove = __exit_p(imx074_eeprom_i2c_remove),
-	.driver = {
-		.name = "imx074_eeprom",
-	},
-};
-
-static int __init imx074_eeprom_i2c_add_driver(void)
-{
-	int rc = 0;
-	rc = i2c_add_driver(imx074_eeprom_t.i2c_driver);
-	return rc;
-}
-
-static struct v4l2_subdev_core_ops imx074_eeprom_subdev_core_ops = {
-	.ioctl = msm_eeprom_subdev_ioctl,
-};
-
-static struct v4l2_subdev_ops imx074_eeprom_subdev_ops = {
-	.core = &imx074_eeprom_subdev_core_ops,
-};
-
-static uint8_t imx074_wbcalib_data[6];
-static struct msm_calib_wb imx074_wb_data;
-
-static struct msm_camera_eeprom_info_t imx074_calib_supp_info = {
-	{FALSE, 0, 0, 1},
-	{TRUE, 6, 0, 1024},
-	{FALSE, 0, 0, 1},
-	{FALSE, 0, 0, 1},
-	{FALSE, 0, 0, 1},
-};
-
-static struct msm_camera_eeprom_read_t imx074_eeprom_read_tbl[] = {
-	{0x10, &imx074_wbcalib_data[0], 6, 0},
-};
-
-
-static struct msm_camera_eeprom_data_t imx074_eeprom_data_tbl[] = {
-	{&imx074_wb_data, sizeof(struct msm_calib_wb)},
-};
-
-static void imx074_format_wbdata(void)
-{
-	imx074_wb_data.r_over_g = (uint16_t)(imx074_wbcalib_data[0] << 8) |
-		imx074_wbcalib_data[1];
-	imx074_wb_data.b_over_g = (uint16_t)(imx074_wbcalib_data[2] << 8) |
-		imx074_wbcalib_data[3];
-	imx074_wb_data.gr_over_gb = (uint16_t)(imx074_wbcalib_data[4] << 8) |
-		imx074_wbcalib_data[5];
-}
-
-void imx074_format_calibrationdata(void)
-{
-	imx074_format_wbdata();
-}
-static struct msm_eeprom_ctrl_t imx074_eeprom_t = {
-	.i2c_driver = &imx074_eeprom_i2c_driver,
-	.i2c_addr = 0xA4,
-	.eeprom_v4l2_subdev_ops = &imx074_eeprom_subdev_ops,
-
-	.i2c_client = {
-		.addr_type = MSM_CAMERA_I2C_BYTE_ADDR,
-	},
-
-	.eeprom_mutex = &imx074_eeprom_mutex,
-
-	.func_tbl = {
-		.eeprom_init = NULL,
-		.eeprom_release = NULL,
-		.eeprom_get_info = msm_camera_eeprom_get_info,
-		.eeprom_get_data = msm_camera_eeprom_get_data,
-		.eeprom_set_dev_addr = NULL,
-		.eeprom_format_data = imx074_format_calibrationdata,
-	},
-	.info = &imx074_calib_supp_info,
-	.info_size = sizeof(struct msm_camera_eeprom_info_t),
-	.read_tbl = imx074_eeprom_read_tbl,
-	.read_tbl_size = ARRAY_SIZE(imx074_eeprom_read_tbl),
-	.data_tbl = imx074_eeprom_data_tbl,
-	.data_tbl_size = ARRAY_SIZE(imx074_eeprom_data_tbl),
-};
-
-subsys_initcall(imx074_eeprom_i2c_add_driver);
-MODULE_DESCRIPTION("IMX074 EEPROM");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/eeprom/imx091_eeprom.c b/drivers/media/video/msm/eeprom/imx091_eeprom.c
deleted file mode 100644
index 20624ac..0000000
--- a/drivers/media/video/msm/eeprom/imx091_eeprom.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/module.h>
-#include "msm_camera_eeprom.h"
-#include "msm_camera_i2c.h"
-
-DEFINE_MUTEX(imx091_eeprom_mutex);
-static struct msm_eeprom_ctrl_t imx091_eeprom_t;
-
-static const struct i2c_device_id imx091_eeprom_i2c_id[] = {
-	{"imx091_eeprom", (kernel_ulong_t)&imx091_eeprom_t},
-	{ }
-};
-
-static struct i2c_driver imx091_eeprom_i2c_driver = {
-	.id_table = imx091_eeprom_i2c_id,
-	.probe  = msm_eeprom_i2c_probe,
-	.remove = __exit_p(imx091_eeprom_i2c_remove),
-	.driver = {
-		.name = "imx091_eeprom",
-	},
-};
-
-static int __init imx091_eeprom_i2c_add_driver(void)
-{
-	int rc = 0;
-	rc = i2c_add_driver(imx091_eeprom_t.i2c_driver);
-	return rc;
-}
-
-static struct v4l2_subdev_core_ops imx091_eeprom_subdev_core_ops = {
-	.ioctl = msm_eeprom_subdev_ioctl,
-};
-
-static struct v4l2_subdev_ops imx091_eeprom_subdev_ops = {
-	.core = &imx091_eeprom_subdev_core_ops,
-};
-
-static uint8_t imx091_wbcalib_data[6];
-static uint8_t imx091_afcalib_data[6];
-static struct msm_calib_wb imx091_wb_data;
-static struct msm_calib_af imx091_af_data;
-
-static struct msm_camera_eeprom_info_t imx091_calib_supp_info = {
-	{TRUE, 6, 1, 1},
-	{TRUE, 6, 0, 32768},
-	{FALSE, 0, 0, 1},
-	{FALSE, 0, 0, 1},
-	{FALSE, 0, 0, 1},
-};
-
-static struct msm_camera_eeprom_read_t imx091_eeprom_read_tbl[] = {
-	{0x05, &imx091_wbcalib_data[0], 6, 0},
-	{0x0B, &imx091_afcalib_data[0], 6, 0},
-};
-
-
-static struct msm_camera_eeprom_data_t imx091_eeprom_data_tbl[] = {
-	{&imx091_wb_data, sizeof(struct msm_calib_wb)},
-	{&imx091_af_data, sizeof(struct msm_calib_af)},
-};
-
-static void imx091_format_wbdata(void)
-{
-	imx091_wb_data.r_over_g = (uint16_t)(imx091_wbcalib_data[1] << 8) |
-		(imx091_wbcalib_data[0] - 0x32);
-	imx091_wb_data.b_over_g = (uint16_t)(imx091_wbcalib_data[3] << 8) |
-		(imx091_wbcalib_data[2] - 0x32);
-	imx091_wb_data.gr_over_gb = (uint16_t)(imx091_wbcalib_data[5] << 8) |
-		(imx091_wbcalib_data[4] - 0x32);
-}
-
-static void imx091_format_afdata(void)
-{
-	imx091_af_data.inf_dac = (uint16_t)(imx091_afcalib_data[1] << 8) |
-		imx091_afcalib_data[0];
-	imx091_af_data.macro_dac = (uint16_t)(imx091_afcalib_data[3] << 8) |
-		imx091_afcalib_data[2];
-	imx091_af_data.start_dac = (uint16_t)(imx091_afcalib_data[5] << 8) |
-		imx091_afcalib_data[4];
-}
-
-void imx091_format_calibrationdata(void)
-{
-	imx091_format_wbdata();
-	imx091_format_afdata();
-}
-static struct msm_eeprom_ctrl_t imx091_eeprom_t = {
-	.i2c_driver = &imx091_eeprom_i2c_driver,
-	.i2c_addr = 0xA1,
-	.eeprom_v4l2_subdev_ops = &imx091_eeprom_subdev_ops,
-
-	.i2c_client = {
-		.addr_type = MSM_CAMERA_I2C_BYTE_ADDR,
-	},
-
-	.eeprom_mutex = &imx091_eeprom_mutex,
-
-	.func_tbl = {
-		.eeprom_init = NULL,
-		.eeprom_release = NULL,
-		.eeprom_get_info = msm_camera_eeprom_get_info,
-		.eeprom_get_data = msm_camera_eeprom_get_data,
-		.eeprom_set_dev_addr = NULL,
-		.eeprom_format_data = imx091_format_calibrationdata,
-	},
-	.info = &imx091_calib_supp_info,
-	.info_size = sizeof(struct msm_camera_eeprom_info_t),
-	.read_tbl = imx091_eeprom_read_tbl,
-	.read_tbl_size = ARRAY_SIZE(imx091_eeprom_read_tbl),
-	.data_tbl = imx091_eeprom_data_tbl,
-	.data_tbl_size = ARRAY_SIZE(imx091_eeprom_data_tbl),
-};
-
-subsys_initcall(imx091_eeprom_i2c_add_driver);
-MODULE_DESCRIPTION("imx091 EEPROM");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/eeprom/msm_camera_eeprom.c b/drivers/media/video/msm/eeprom/msm_camera_eeprom.c
deleted file mode 100644
index a1b809f..0000000
--- a/drivers/media/video/msm/eeprom/msm_camera_eeprom.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-#include "msm_camera_eeprom.h"
-
-int32_t msm_camera_eeprom_read(struct msm_eeprom_ctrl_t *ectrl,
-	uint32_t reg_addr, void *data, uint32_t num_byte,
-	uint16_t convert_endian)
-{
-	int rc = 0;
-	if (ectrl->func_tbl.eeprom_set_dev_addr != NULL)
-		ectrl->func_tbl.eeprom_set_dev_addr(ectrl, &reg_addr);
-
-	if (!convert_endian) {
-		rc = msm_camera_i2c_read_seq(
-			&ectrl->i2c_client, reg_addr, data, num_byte);
-	} else {
-		unsigned char buf[num_byte];
-		uint8_t *data_ptr = (uint8_t *) data;
-		int i;
-		rc = msm_camera_i2c_read_seq(
-			&ectrl->i2c_client, reg_addr, buf, num_byte);
-		for (i = 0; i < num_byte; i += 2) {
-			data_ptr[i] = buf[i+1];
-			data_ptr[i+1] = buf[i];
-		}
-	}
-	return rc;
-}
-
-int32_t msm_camera_eeprom_read_tbl(struct msm_eeprom_ctrl_t *ectrl,
-	struct msm_camera_eeprom_read_t *read_tbl, uint16_t tbl_size)
-{
-	int i, rc = 0;
-	CDBG("%s: open\n", __func__);
-	if (read_tbl == NULL)
-		return rc;
-
-	for (i = 0; i < tbl_size; i++) {
-		rc = msm_camera_eeprom_read
-			(ectrl, read_tbl[i].reg_addr,
-			read_tbl[i].dest_ptr, read_tbl[i].num_byte,
-			read_tbl[i].convert_endian);
-		if (rc < 0) {
-			pr_err("%s: read failed\n", __func__);
-			return rc;
-		}
-	}
-	CDBG("%s: done\n", __func__);
-	return rc;
-}
-
-int32_t msm_camera_eeprom_get_info(struct msm_eeprom_ctrl_t *ectrl,
-	struct msm_camera_eeprom_info_t *einfo)
-{
-	int rc = 0;
-	CDBG("%s: open\n", __func__);
-	memcpy(einfo, ectrl->info, ectrl->info_size);
-	CDBG("%s: done =%d\n", __func__, rc);
-	return rc;
-}
-
-int32_t msm_camera_eeprom_get_data(struct msm_eeprom_ctrl_t *ectrl,
-	struct msm_eeprom_data_t *edata)
-{
-	int rc = 0;
-	if (edata->index >= ectrl->data_tbl_size)
-		return -EFAULT;
-	if (copy_to_user(edata->eeprom_data,
-		ectrl->data_tbl[edata->index].data,
-		ectrl->data_tbl[edata->index].size))
-		rc = -EFAULT;
-	return rc;
-}
-
-int32_t msm_eeprom_config(struct msm_eeprom_ctrl_t *e_ctrl,
-	void __user *argp)
-{
-	struct msm_eeprom_cfg_data cdata;
-	int32_t rc = 0;
-	if (copy_from_user(&cdata,
-		(void *)argp,
-		sizeof(struct msm_eeprom_cfg_data)))
-		return -EFAULT;
-	mutex_lock(e_ctrl->eeprom_mutex);
-
-	switch (cdata.cfgtype) {
-	case CFG_GET_EEPROM_INFO:
-		if (e_ctrl->func_tbl.eeprom_get_info == NULL) {
-			rc = -EFAULT;
-			break;
-		}
-		rc = e_ctrl->func_tbl.eeprom_get_info(e_ctrl,
-			&cdata.cfg.get_info);
-		cdata.is_eeprom_supported = 1;
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct msm_eeprom_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_EEPROM_DATA:
-		if (e_ctrl->func_tbl.eeprom_get_data == NULL) {
-			rc = -EFAULT;
-			break;
-		}
-		rc = e_ctrl->func_tbl.eeprom_get_data(e_ctrl,
-			&cdata.cfg.get_data);
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct msm_eeprom_cfg_data)))
-			rc = -EFAULT;
-		break;
-	default:
-		break;
-	}
-	mutex_unlock(e_ctrl->eeprom_mutex);
-	return rc;
-}
-
-struct msm_eeprom_ctrl_t *get_ectrl(struct v4l2_subdev *sd)
-{
-	return container_of(sd, struct msm_eeprom_ctrl_t, sdev);
-}
-
-long msm_eeprom_subdev_ioctl(struct v4l2_subdev *sd,
-	unsigned int cmd, void *arg)
-{
-	struct msm_eeprom_ctrl_t *e_ctrl = get_ectrl(sd);
-	void __user *argp = (void __user *)arg;
-	switch (cmd) {
-	case VIDIOC_MSM_EEPROM_CFG:
-		return msm_eeprom_config(e_ctrl, argp);
-	default:
-		return -ENOIOCTLCMD;
-	}
-}
-
-int32_t msm_eeprom_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	struct msm_eeprom_ctrl_t *e_ctrl_t = NULL;
-	CDBG("%s called\n", __func__);
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		pr_err("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	e_ctrl_t = (struct msm_eeprom_ctrl_t *)(id->driver_data);
-	e_ctrl_t->i2c_client.client = client;
-
-	if (e_ctrl_t->i2c_addr != 0)
-		e_ctrl_t->i2c_client.client->addr = e_ctrl_t->i2c_addr;
-
-	CDBG("%s client = %x\n", __func__, (unsigned int) client);
-
-	/* Assign name for sub device */
-	snprintf(e_ctrl_t->sdev.name, sizeof(e_ctrl_t->sdev.name),
-		"%s", e_ctrl_t->i2c_driver->driver.name);
-
-	if (e_ctrl_t->func_tbl.eeprom_init != NULL) {
-		rc = e_ctrl_t->func_tbl.eeprom_init(e_ctrl_t,
-			e_ctrl_t->i2c_client.client->adapter);
-	}
-	msm_camera_eeprom_read_tbl(e_ctrl_t,
-		e_ctrl_t->read_tbl,
-		e_ctrl_t->read_tbl_size);
-
-	if (e_ctrl_t->func_tbl.eeprom_format_data != NULL)
-		e_ctrl_t->func_tbl.eeprom_format_data();
-
-	if (e_ctrl_t->func_tbl.eeprom_release != NULL)
-		rc = e_ctrl_t->func_tbl.eeprom_release(e_ctrl_t);
-
-
-	/* Initialize sub device */
-	v4l2_i2c_subdev_init(&e_ctrl_t->sdev,
-		e_ctrl_t->i2c_client.client,
-		e_ctrl_t->eeprom_v4l2_subdev_ops);
-	CDBG("%s success resut=%d\n", __func__, rc);
-	return rc;
-
-probe_failure:
-	pr_err("%s failed! rc = %d\n", __func__, rc);
-	return rc;
-}
diff --git a/drivers/media/video/msm/eeprom/msm_camera_eeprom.h b/drivers/media/video/msm/eeprom/msm_camera_eeprom.h
deleted file mode 100644
index 05b4533..0000000
--- a/drivers/media/video/msm/eeprom/msm_camera_eeprom.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-#ifndef MSM_CAMERA_EEPROM_H
-#define MSM_CAMERA_EEPROM_H
-
-#include <linux/delay.h>
-#include <mach/camera.h>
-#include <media/v4l2-subdev.h>
-#include "msm_camera_i2c.h"
-
-#define TRUE  1
-#define FALSE 0
-
-struct msm_eeprom_ctrl_t;
-
-struct msm_camera_eeprom_fn_t {
-	int32_t (*eeprom_init)
-		(struct msm_eeprom_ctrl_t *ectrl,
-		struct i2c_adapter *adapter);
-	int32_t (*eeprom_release)
-		(struct msm_eeprom_ctrl_t *ectrl);
-	int32_t (*eeprom_get_info)
-		(struct msm_eeprom_ctrl_t *ectrl,
-		 struct msm_camera_eeprom_info_t *einfo);
-	int32_t (*eeprom_get_data)
-		(struct msm_eeprom_ctrl_t *ectrl,
-		 struct msm_eeprom_data_t *edata);
-	void (*eeprom_set_dev_addr)
-		(struct msm_eeprom_ctrl_t*, uint32_t*);
-	void (*eeprom_format_data)
-		(void);
-};
-
-struct msm_camera_eeprom_read_t {
-	uint32_t reg_addr;
-	void *dest_ptr;
-	uint32_t num_byte;
-	uint16_t convert_endian;
-};
-
-struct msm_camera_eeprom_data_t {
-	void *data;
-	uint16_t size;
-};
-
-struct msm_eeprom_ctrl_t {
-	struct msm_camera_i2c_client i2c_client;
-	uint16_t i2c_addr;
-	struct i2c_driver *i2c_driver;
-	struct mutex *eeprom_mutex;
-	struct v4l2_subdev sdev;
-	struct v4l2_subdev_ops *eeprom_v4l2_subdev_ops;
-	struct msm_camera_eeprom_fn_t func_tbl;
-	struct msm_camera_eeprom_info_t *info;
-	uint16_t info_size;
-	struct msm_camera_eeprom_read_t *read_tbl;
-	uint16_t read_tbl_size;
-	struct msm_camera_eeprom_data_t *data_tbl;
-	uint16_t data_tbl_size;
-};
-
-int32_t msm_camera_eeprom_get_data(struct msm_eeprom_ctrl_t *ectrl,
-	struct msm_eeprom_data_t *edata);
-int32_t msm_camera_eeprom_get_info(struct msm_eeprom_ctrl_t *ectrl,
-	struct msm_camera_eeprom_info_t *einfo);
-int32_t msm_eeprom_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id);
-long msm_eeprom_subdev_ioctl(struct v4l2_subdev *sd,
-	unsigned int cmd, void *arg);
-
-#define VIDIOC_MSM_EEPROM_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 12, void __user *)
-#endif
diff --git a/drivers/media/video/msm/flash.c b/drivers/media/video/msm/flash.c
index d17ceb4..835cb7e 100644
--- a/drivers/media/video/msm/flash.c
+++ b/drivers/media/video/msm/flash.c
@@ -1,5 +1,5 @@
 
-/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -11,37 +11,29 @@
  * GNU General Public License for more details.
  *
  */
+
+#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/leds-pmic8058.h>
 #include <linux/pwm.h>
 #include <linux/pmic8058-pwm.h>
 #include <linux/hrtimer.h>
-#include <linux/export.h>
-#include <linux/timer.h>
-#include <linux/workqueue.h>
+#include <linux/i2c.h>
 #include <mach/pmic.h>
 #include <mach/camera.h>
 #include <mach/gpio.h>
-#include "msm_camera_i2c.h"
+#include <linux/htc_flashlight.h>
 
-struct flash_work {
-	struct work_struct my_work;
-	int    x;
-};
-struct flash_work *work;
-static struct timer_list flash_timer;
-static int timer_state;
-static struct workqueue_struct *flash_wq;
 struct i2c_client *sx150x_client;
 struct timer_list timer_flash;
 static struct msm_camera_sensor_info *sensor_data;
-static struct msm_camera_i2c_client i2c_client;
 enum msm_cam_flash_stat{
 	MSM_CAM_FLASH_OFF,
 	MSM_CAM_FLASH_ON,
 };
 
+#if defined CONFIG_MSM_CAMERA_FLASH_SC628A
 static struct i2c_client *sc628a_client;
 
 static const struct i2c_device_id sc628a_i2c_id[] = {
@@ -49,6 +41,46 @@
 	{ }
 };
 
+static int32_t sc628a_i2c_txdata(unsigned short saddr,
+		unsigned char *txdata, int length)
+{
+	struct i2c_msg msg[] = {
+		{
+			.addr = saddr,
+			.flags = 0,
+			.len = length,
+			.buf = txdata,
+		},
+	};
+	if (i2c_transfer(sc628a_client->adapter, msg, 1) < 0) {
+		CDBG("sc628a_i2c_txdata faild 0x%x\n", saddr);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int32_t sc628a_i2c_write_b_flash(uint8_t waddr, uint8_t bdata)
+{
+	int32_t rc = -EFAULT;
+	unsigned char buf[2];
+	if (!sc628a_client)
+		return  -ENOTSUPP;
+
+	memset(buf, 0, sizeof(buf));
+	buf[0] = waddr;
+	buf[1] = bdata;
+
+	rc = sc628a_i2c_txdata(sc628a_client->addr>>1, buf, 2);
+	if (rc < 0) {
+		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
+				waddr, bdata);
+	}
+	usleep_range(4000, 5000);
+
+	return rc;
+}
+
 static int sc628a_i2c_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
@@ -62,7 +94,7 @@
 
 	sc628a_client = client;
 
-	CDBG("sc628a_probe success rc = %d\n", rc);
+	CDBG("sc628a_probe successed! rc = %d\n", rc);
 	return 0;
 
 probe_failure:
@@ -78,51 +110,7 @@
 		.name = "sc628a",
 	},
 };
-
-static struct i2c_client *tps61310_client;
-
-static const struct i2c_device_id tps61310_i2c_id[] = {
-	{"tps61310", 0},
-	{ }
-};
-
-static int tps61310_i2c_probe(struct i2c_client *client,
-		const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("%s enter\n", __func__);
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		pr_err("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	tps61310_client = client;
-	i2c_client.client = tps61310_client;
-	i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
-	rc = msm_camera_i2c_write(&i2c_client, 0x01, 0x00,
-		MSM_CAMERA_I2C_BYTE_DATA);
-	if (rc < 0) {
-		tps61310_client = NULL;
-		goto probe_failure;
-	}
-
-	CDBG("%s success! rc = %d\n", __func__, rc);
-	return 0;
-
-probe_failure:
-	pr_err("%s failed! rc = %d\n", __func__, rc);
-	return rc;
-}
-
-static struct i2c_driver tps61310_i2c_driver = {
-	.id_table = tps61310_i2c_id,
-	.probe  = tps61310_i2c_probe,
-	.remove = __exit_p(tps61310_i2c_remove),
-	.driver = {
-		.name = "tps61310",
-	},
-};
+#endif
 
 static int config_flash_gpio_table(enum msm_cam_flash_stat stat,
 			struct msm_camera_sensor_strobe_flash_data *sfdata)
@@ -160,6 +148,48 @@
 	return rc;
 }
 
+int msm_camera_flash(
+	struct msm_camera_sensor_flash_src *flash_src,
+	unsigned led_state)
+{
+	int flash_level = 0;
+	pr_info("[FLT] %s state %d\n", __func__, led_state);
+
+	if (!flash_src->camera_flash)  return 0;
+
+		switch (led_state) {
+		case MSM_CAMERA_LED_HIGH:
+			flash_level = FL_MODE_FLASH;
+			break;
+		case MSM_CAMERA_LED_LOW:
+			flash_level = FL_MODE_PRE_FLASH;
+			break;
+		case MSM_CAMERA_LED_OFF:
+		case MSM_CAMERA_LED_INIT:
+		case MSM_CAMERA_LED_RELEASE:
+			flash_level = FL_MODE_OFF;
+			break;
+		case FL_MODE_TORCH_LEVEL_1:
+		case FL_MODE_TORCH_LEVEL_2:
+		case FL_MODE_FLASH_LEVEL1:
+		case FL_MODE_FLASH_LEVEL2:
+		case FL_MODE_FLASH_LEVEL3:
+		case FL_MODE_FLASH_LEVEL4:
+		case FL_MODE_FLASH_LEVEL5:
+		case FL_MODE_FLASH_LEVEL6:
+		case FL_MODE_FLASH_LEVEL7:
+
+			flash_level = led_state;
+			break;
+		default:
+			pr_err("[FLT] %s: invalid flash level %d.\n", __func__, led_state);
+			return -EINVAL;
+		}
+
+	return flash_src->camera_flash(flash_level);
+}
+
+
 int msm_camera_flash_current_driver(
 	struct msm_camera_sensor_flash_current_driver *current_driver,
 	unsigned led_state)
@@ -173,7 +203,7 @@
 
 	CDBG("%s: led_state = %d\n", __func__, led_state);
 
-	/* Evenly distribute current across all channels */
+	
 	switch (led_state) {
 	case MSM_CAMERA_LED_OFF:
 		for (idx = 0; idx < num_leds; ++idx) {
@@ -224,7 +254,7 @@
 		break;
 	}
 	CDBG("msm_camera_flash_led_pmic8058: return %d\n", rc);
-#endif /* CONFIG_LEDS_PMIC8058 */
+#endif 
 	return rc;
 }
 
@@ -287,57 +317,24 @@
 	return rc;
 }
 
-static void flash_wq_function(struct work_struct *work)
-{
-	if (tps61310_client) {
-		i2c_client.client = tps61310_client;
-		i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
-		msm_camera_i2c_write(&i2c_client, 0x01,
-				0x46, MSM_CAMERA_I2C_BYTE_DATA);
-	}
-	return;
-}
-
-void flash_timer_callback(unsigned long data)
-{
-	queue_work(flash_wq, (struct work_struct *)work );
-	mod_timer(&flash_timer, jiffies + msecs_to_jiffies(10000));
-}
-
 int msm_camera_flash_external(
 	struct msm_camera_sensor_flash_external *external,
 	unsigned led_state)
 {
 	int rc = 0;
 
+#if defined CONFIG_MSM_CAMERA_FLASH_SC628A
 	switch (led_state) {
 
 	case MSM_CAMERA_LED_INIT:
-		if (external->flash_id == MAM_CAMERA_EXT_LED_FLASH_SC628A) {
-			if (!sc628a_client) {
-				rc = i2c_add_driver(&sc628a_i2c_driver);
-				if (rc < 0 || sc628a_client == NULL) {
-					pr_err("sc628a_i2c_driver add failed\n");
-					rc = -ENOTSUPP;
-					return rc;
-				}
+		if (!sc628a_client) {
+			rc = i2c_add_driver(&sc628a_i2c_driver);
+			if (rc < 0 || sc628a_client == NULL) {
+				rc = -ENOTSUPP;
+				CDBG("I2C add driver failed");
+				return rc;
 			}
-		} else if (external->flash_id ==
-			MAM_CAMERA_EXT_LED_FLASH_TPS61310) {
-			if (!tps61310_client) {
-				rc = i2c_add_driver(&tps61310_i2c_driver);
-				if (rc < 0 || tps61310_client == NULL) {
-					pr_err("tps61310_i2c_driver add failed\n");
-					rc = -ENOTSUPP;
-					return rc;
-				}
-			}
-		} else {
-			pr_err("Flash id not supported\n");
-			rc = -ENOTSUPP;
-			return rc;
 		}
-
 #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
 		if (external->expander_info && !sx150x_client) {
 			struct i2c_adapter *adapter =
@@ -346,77 +343,40 @@
 				sx150x_client = i2c_new_device(adapter,
 					external->expander_info->board_info);
 			if (!sx150x_client || !adapter) {
-				pr_err("sx150x_client is not available\n");
 				rc = -ENOTSUPP;
-				if (sc628a_client) {
-					i2c_del_driver(&sc628a_i2c_driver);
-					sc628a_client = NULL;
-				}
-				if (tps61310_client) {
-					i2c_del_driver(&tps61310_i2c_driver);
-					tps61310_client = NULL;
-				}
+				i2c_del_driver(&sc628a_i2c_driver);
+				sc628a_client = NULL;
 				return rc;
 			}
-			i2c_put_adapter(adapter);
 		}
 #endif
-		if (sc628a_client)
-			rc = gpio_request(external->led_en, "sc628a");
-		if (tps61310_client)
-			rc = gpio_request(external->led_en, "tps61310");
-
+		rc = gpio_request(external->led_en, "sc628a");
 		if (!rc) {
 			gpio_direction_output(external->led_en, 0);
 		} else {
-			goto error;
+			goto err1;
 		}
-
-		if (sc628a_client)
-			rc = gpio_request(external->led_flash_en, "sc628a");
-		if (tps61310_client)
-			rc = gpio_request(external->led_flash_en, "tps61310");
-
+		rc = gpio_request(external->led_flash_en, "sc628a");
 		if (!rc) {
 			gpio_direction_output(external->led_flash_en, 0);
 			break;
 		}
 
-		if (sc628a_client || tps61310_client) {
-			gpio_set_value_cansleep(external->led_en, 0);
-			gpio_free(external->led_en);
-		}
-error:
-		pr_err("%s gpio request failed\n", __func__);
-		if (sc628a_client) {
-			i2c_del_driver(&sc628a_i2c_driver);
-			sc628a_client = NULL;
-		}
-		if (tps61310_client) {
-			i2c_del_driver(&tps61310_i2c_driver);
-			tps61310_client = NULL;
-		}
+		gpio_set_value_cansleep(external->led_en, 0);
+		gpio_free(external->led_en);
+
+err1:
+		i2c_del_driver(&sc628a_i2c_driver);
+		sc628a_client = NULL;
+
 		break;
 
 	case MSM_CAMERA_LED_RELEASE:
-		if (sc628a_client || tps61310_client) {
+		if (sc628a_client) {
 			gpio_set_value_cansleep(external->led_en, 0);
 			gpio_free(external->led_en);
 			gpio_set_value_cansleep(external->led_flash_en, 0);
 			gpio_free(external->led_flash_en);
-			if (sc628a_client) {
-				i2c_del_driver(&sc628a_i2c_driver);
-				sc628a_client = NULL;
-			}
-			if (tps61310_client) {
-				if (timer_state) {
-					del_timer(&flash_timer);
-					kfree((void *)work);
-					timer_state = 0;
-				}
-				i2c_del_driver(&tps61310_i2c_driver);
-				tps61310_client = NULL;
-			}
 		}
 #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
 		if (external->expander_info && sx150x_client) {
@@ -427,79 +387,37 @@
 		break;
 
 	case MSM_CAMERA_LED_OFF:
-		if (sc628a_client || tps61310_client) {
-			if (sc628a_client) {
-				i2c_client.client = sc628a_client;
-				i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
-				rc = msm_camera_i2c_write(&i2c_client, 0x02,
-					0x00, MSM_CAMERA_I2C_BYTE_DATA);
-			}
-			if (tps61310_client) {
-				i2c_client.client = tps61310_client;
-				i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
-				rc = msm_camera_i2c_write(&i2c_client, 0x01,
-					0x00, MSM_CAMERA_I2C_BYTE_DATA);
-				if (timer_state) {
-					del_timer(&flash_timer);
-					kfree((void *)work);
-					timer_state = 0;
-				}
-			}
+		rc = sc628a_i2c_write_b_flash(0x02, 0x0);
+		if (sc628a_client) {
 			gpio_set_value_cansleep(external->led_en, 0);
 			gpio_set_value_cansleep(external->led_flash_en, 0);
 		}
 		break;
 
 	case MSM_CAMERA_LED_LOW:
-		if (sc628a_client || tps61310_client) {
+		if (sc628a_client) {
 			gpio_set_value_cansleep(external->led_en, 1);
 			gpio_set_value_cansleep(external->led_flash_en, 1);
 			usleep_range(2000, 3000);
-			if (sc628a_client) {
-				i2c_client.client = sc628a_client;
-				i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
-				rc = msm_camera_i2c_write(&i2c_client, 0x02,
-					0x06, MSM_CAMERA_I2C_BYTE_DATA);
-			}
-			if (tps61310_client) {
-				i2c_client.client = tps61310_client;
-				i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
-				rc = msm_camera_i2c_write(&i2c_client, 0x01,
-					0x46, MSM_CAMERA_I2C_BYTE_DATA);
-				flash_wq = create_workqueue("my_queue");
-				work = (struct flash_work *)kmalloc(sizeof(struct flash_work), GFP_KERNEL);
-				INIT_WORK( (struct work_struct *)work, flash_wq_function );
-				setup_timer(&flash_timer, flash_timer_callback, 0);
-				mod_timer(&flash_timer, jiffies + msecs_to_jiffies(10000));
-				timer_state = 1;
-			}
 		}
+		rc = sc628a_i2c_write_b_flash(0x02, 0x06);
 		break;
 
 	case MSM_CAMERA_LED_HIGH:
-		if (sc628a_client || tps61310_client) {
+		if (sc628a_client) {
 			gpio_set_value_cansleep(external->led_en, 1);
 			gpio_set_value_cansleep(external->led_flash_en, 1);
 			usleep_range(2000, 3000);
-			if (sc628a_client) {
-				i2c_client.client = sc628a_client;
-				i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
-				rc = msm_camera_i2c_write(&i2c_client, 0x02,
-					0x49, MSM_CAMERA_I2C_BYTE_DATA);
-			}
-			if (tps61310_client) {
-				i2c_client.client = tps61310_client;
-				i2c_client.addr_type = MSM_CAMERA_I2C_BYTE_ADDR;
-				rc = msm_camera_i2c_write(&i2c_client, 0x01,
-					0x8B, MSM_CAMERA_I2C_BYTE_DATA);
-			}
 		}
+		rc = sc628a_i2c_write_b_flash(0x02, 0x49);
 		break;
 
 	default:
 		rc = -EFAULT;
 		break;
 	}
+#endif
+
 	return rc;
 }
 
@@ -615,9 +533,12 @@
 		break;
 
 	case MSM_CAMERA_FLASH_SRC_CURRENT_DRIVER:
-		rc = msm_camera_flash_current_driver(
-			&fdata->flash_src->_fsrc.current_driver_src,
-			led_state);
+		if (fdata->flash_src->camera_flash)
+			rc = msm_camera_flash(fdata->flash_src, led_state);
+		else
+			rc = msm_camera_flash_current_driver(
+				&fdata->flash_src->_fsrc.current_driver_src,
+				led_state);
 		break;
 
 	case MSM_CAMERA_FLASH_SRC_EXT:
@@ -647,7 +568,7 @@
 	if (charge_enable) {
 		timer_flash.expires = jiffies +
 			msecs_to_jiffies(flash_recharge_duration);
-		/* add timer for the recharge */
+		
 		if (!timer_pending(&timer_flash))
 			add_timer(&timer_flash);
 	} else
@@ -674,7 +595,7 @@
 	struct msm_camera_sensor_strobe_flash_data *sfdata =
 		(struct msm_camera_sensor_strobe_flash_data *)data;
 
-	/* put the charge signal to low */
+	
 	gpio_set_value_cansleep(sfdata->flash_charge, 0);
 
 	return IRQ_HANDLED;
@@ -702,7 +623,7 @@
 		}
 
 		spin_lock_init(&sfdata->timer_lock);
-		/* setup timer */
+		
 		init_timer(&timer_flash);
 		timer_flash.function = strobe_flash_xenon_recharge_handler;
 		timer_flash.data = (unsigned long)sfdata;
diff --git a/drivers/media/video/msm/flash_lm3559.c b/drivers/media/video/msm/flash_lm3559.c
deleted file mode 100755
index 14872c5..0000000
--- a/drivers/media/video/msm/flash_lm3559.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Flash LED driver (LM3559)
- *
- * Copyright (C) 2011 LGE, Inc.
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/leds.h>
-#include <linux/errno.h>
-#include <linux/i2c.h>
-#include <linux/gpio.h>
-#include <linux/delay.h>
-#include <linux/hrtimer.h>
-#include <linux/types.h>
-#include <linux/platform_data/flash_lm3559.h>
-#include <mach/camera.h>
-
-
-#define LM3559_I2C_NAME  			"lm3559"
-
-#define LM3559_POWER_OFF			0
-#define LM3559_POWER_ON				1
-
-/* Register Descriptions */
-#define LM3559_REG_ENABLE			0x10
-#define LM3559_REG_GPIO				0x20
-#define LM3559_REG_VLED_MONITOR			0x30
-#define LM3559_REG_ADC_DELAY			0x31
-#define LM3559_REG_VIN_MONITOR			0x80
-#define LM3559_REG_LAST_FLASH			0x81
-#define LM3559_REG_TORCH_BRIGHTNESS		0xA0
-#define LM3559_REG_FLASH_BRIGHTNESS		0xB0
-#define LM3559_REG_FLASH_DURATION		0xC0
-#define LM3559_REG_FLAGS			0xD0
-#define LM3559_REG_CONFIGURATION1		0xE0
-#define LM3559_REG_CONFIGURATION2		0xF0
-#define LM3559_REG_PRIVACY			0x11
-#define LM3559_REG_MESSAGE_INDICATOR		0x12
-#define LM3559_REG_INDICATOR_BLINKING		0x13
-#define LM3559_REG_PRIVACY_PWM			0x14
-
-enum led_status {
-	LM3559_LED_OFF,
-	LM3559_LED_LOW,
-	LM3559_LED_HIGH,
-	LM3559_LED_MAX
-};
-
-static int lm3559_onoff_state = LM3559_POWER_OFF;
-
-static struct lm3559_flash_platform_data *lm3559_led_flash_pdata = NULL;
-static struct i2c_client *lm3559_i2c_client = NULL;
-
-int lm3559_write_reg(struct i2c_client *client, unsigned char addr, unsigned char data)
-{
-	int err = 0;
-
-	unsigned char buf[2] ={0,};
-
-	struct i2c_msg msg[] = {
-		{
-			.addr  = client->addr,
-			.flags = 0,
-			.len   = 2,
-			.buf   = buf,
-		},
-	};
-
-	buf[0] = addr;
-	buf[1] = data;
-
-	if ((err = i2c_transfer(client->adapter, &msg[0], 1)) < 0) {
-		dev_err(&client->dev, "i2c write error [%d]\n",err);
-	}
-
-	return err;
-
-}
-
-int lm3559_read_reg(struct i2c_client *client, unsigned char addr, unsigned char *data)
-{
-	int err = 0;
-	unsigned char buf[1] ={0};
-
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = client->addr,
-			.flags = I2C_M_RD,
-			.len   = 1,
-			.buf   = buf,
-		},
-	};
-
-	buf[0] = addr;
-
-	if ((err = i2c_transfer(client->adapter, &msgs[0], 1)) < 0) {
-		dev_err(&client->dev, "i2c read error [%d]\n",err);
-	}
-
-	*data = buf[0];
-
-	return err;
-
-}
-
-void lm3559_led_shutdown(void)
-{
-	lm3559_write_reg(lm3559_i2c_client, LM3559_REG_ENABLE, 0x18);
-}
-
-/*	Torch Current
-	 000 : 28.125 mA		100 : 140.625 mA
-	 001 : 56.25 mA 		101 : 168.75 mA
-	 010 : 84.375 mA 		110 : 196.875 mA
-	 011 : 112.5mA  		111 : 225 mA
-*/
-void lm3559_enable_torch_mode(enum led_status state)
-{
-	pr_err("%s: state = %d\n", __func__, state);
-
-	if (state == LM3559_LED_LOW) {
-		/* 011 011 : 112.5 mA */
-		lm3559_write_reg(lm3559_i2c_client, LM3559_REG_TORCH_BRIGHTNESS, 0x1B);
-	} else {
-		/* 111 111 : 225 mA */
-		lm3559_write_reg(lm3559_i2c_client, LM3559_REG_TORCH_BRIGHTNESS, 0x3F);
-	}
-
-	lm3559_write_reg(lm3559_i2c_client, LM3559_REG_ENABLE, 0x1A);
-}
-
-/*	 Flash Current
-	 0000 : 56.25 mA		1000 : 506.25 mA
-	 0001 : 112.5 mA 		1001 : 562.5 mA
-	 0010 : 168.75 mA 		1010 : 618.75 mA
-	 0011 : 225 mA  		1011 : 675 mA
-	 0100 : 281.25 mA		1100 : 731.25 mA
-	 0101 : 337.5 mA		1101 : 787.5 mA
-	 0110 : 393.75 mA		1110 : 843.75 mA
-	 0111 : 450 mA			1111 : 900 mA
-*/
-void lm3559_enable_flash_mode(enum led_status state)
-{
-	unsigned char data = 0;
-
-	pr_err("%s: state = %d\n", __func__, state);
-
-	lm3559_read_reg(lm3559_i2c_client, LM3559_REG_FLASH_DURATION, &data);
-
-	pr_err("%s: Before - LM3559_REG_FLASH_DURATION[0x%x]\n",__func__,data);
-	data = ((data & 0x1F) | 0x1F); /* 1.4A Peak Current & 1024ms Duration*/
-
-	pr_err("%s: After - LM3559_REG_FLASH_DURATION[0x%x]\n",__func__,data);
-	lm3559_write_reg(lm3559_i2c_client, LM3559_REG_FLASH_DURATION, data);
-
-	if (state == LM3559_LED_LOW) {
-		/* 0001 0001 : 112.5 mA => 0100 0100: 281.25 mA*/
-		CDBG("[LM3559_LED_LOW]LM3559_REG_FLASH_BRIGHTNESS \n");
-		lm3559_write_reg(lm3559_i2c_client, LM3559_REG_FLASH_BRIGHTNESS, 0x44);
-	}
-	else {
-		/*0011 0011 : 225 mA => 0110 0110 : 393.75 mA => 1010 1010: 618.75 mA*/
-		CDBG("[LM3559_LED_HIGH]LM3559_REG_FLASH_BRIGHTNESS \n");
-		lm3559_write_reg(lm3559_i2c_client, LM3559_REG_FLASH_BRIGHTNESS, 0xAA);
-	}
-	lm3559_write_reg(lm3559_i2c_client, LM3559_REG_ENABLE, 0x1B);
-}
-
-void lm3559_config_gpio_on(void)
-{
-	pr_err("%s: Start\n", __func__);
-
-	gpio_request(lm3559_led_flash_pdata->gpio_en, "cam_flash_en");
-	gpio_tlmm_config(GPIO_CFG(lm3559_led_flash_pdata->gpio_en, 0, GPIO_CFG_OUTPUT,
-		GPIO_CFG_PULL_UP, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
-	gpio_direction_output(lm3559_led_flash_pdata->gpio_en, 0);
-}
-
-void lm3559_config_gpio_off(void)
-{
-	pr_err("%s: Start\n", __func__);
-
-	gpio_direction_input(lm3559_led_flash_pdata->gpio_en);
-	gpio_free(lm3559_led_flash_pdata->gpio_en);
-}
-
-void lm3559_led_enable(void)
-{
-	pr_err("%s: Start\n", __func__);
-	gpio_set_value_cansleep(lm3559_led_flash_pdata->gpio_en, 1);
-	lm3559_onoff_state = LM3559_POWER_ON;
-}
-
-void lm3559_led_disable(void)
-{
-	pr_err("%s: Start\n", __func__);
-	gpio_set_value_cansleep(lm3559_led_flash_pdata->gpio_en, 0);
-	lm3559_onoff_state = LM3559_POWER_OFF;
-}
-
-int lm3559_flash_set_led_state(int led_state)
-{
-	int err = 0;
-
-	pr_err("%s: led_state = %d\n", __func__, led_state);
-
-	switch (led_state) {
-	case MSM_CAMERA_LED_OFF:
-		lm3559_led_disable();
-		break;
-	case MSM_CAMERA_LED_LOW:
-		lm3559_led_enable();
-		lm3559_enable_torch_mode(LM3559_LED_LOW);
-		break;
-	case MSM_CAMERA_LED_HIGH:
-		lm3559_led_enable();
-		lm3559_enable_flash_mode(LM3559_LED_HIGH);
-		break;
-	case MSM_CAMERA_LED_INIT:
-		lm3559_config_gpio_on();
-		break;
-	case MSM_CAMERA_LED_RELEASE:
-		lm3559_config_gpio_off();
-		break;
-	default:
-		err = -EINVAL;
-		break;
-	}
-
-	return err;
-}
-
-EXPORT_SYMBOL(lm3559_flash_set_led_state);
-
-static void lm3559_flash_led_set(struct led_classdev *led_cdev,
-	enum led_brightness value)
-{
-	pr_err("%s: led_cdev->brightness[%d]\n", __func__, value);
-
-	led_cdev->brightness = value;
-
-	if (value)
-		lm3559_enable_torch_mode(LM3559_LED_LOW);
-	else
-		lm3559_led_disable();
-}
-
-static struct led_classdev lm3559_flash_led = {
-	.name = "spotlight",
-	.brightness_set	= lm3559_flash_led_set,
-};
-
-static int lm3559_probe(struct i2c_client *client, const struct i2c_device_id *id)
-{
-	int err = 0;
-
-	lm3559_i2c_client = client;
-	lm3559_led_flash_pdata = client->dev.platform_data;
-
-	if (lm3559_led_flash_pdata == NULL) {
-	    pr_err("%s: platform_data is NULL\n", __func__);
-	    return -EINVAL;
-	}
-
-	err = led_classdev_register(&client->dev, &lm3559_flash_led);
-	if (err < 0) {
-		pr_err("%s: failed to register\n", __func__);
-		return err;
-	}
-
-	pr_err("%s: probe stop\n", __func__);
-
-	return err;
-}
-
-static int lm3559_remove(struct i2c_client *client)
-{
-	led_classdev_unregister(&lm3559_flash_led);
-
-	lm3559_i2c_client = NULL;
-	lm3559_led_flash_pdata = NULL;
-
-	return 0;
-}
-
-static const struct i2c_device_id lm3559_ids[] = {
-	{ LM3559_I2C_NAME, 0 },	/* lm3559 */
-	{ /* end of list */ },
-};
-
-static struct i2c_driver lm3559_driver = {
-	.probe    = lm3559_probe,
-	.remove   = lm3559_remove,
-	.id_table = lm3559_ids,
-	.driver   = {
-		.name =  LM3559_I2C_NAME,
-		.owner= THIS_MODULE,
-	},
-};
-static int __init lm3559_init(void)
-{
-	pr_err("%s: start\n", __func__);
-	return i2c_add_driver(&lm3559_driver);
-}
-
-static void __exit lm3559_exit(void)
-{
-	i2c_del_driver(&lm3559_driver);
-}
-
-module_init(lm3559_init);
-module_exit(lm3559_exit);
-
-MODULE_AUTHOR("LG Electronics");
-MODULE_DESCRIPTION("LM3559 Flash Driver");
-MODULE_LICENSE("GPL");
-
diff --git a/drivers/media/video/msm/gemini/msm_gemini_common.h b/drivers/media/video/msm/gemini/msm_gemini_common.h
index 95223d80..68ed162 100644
--- a/drivers/media/video/msm/gemini/msm_gemini_common.h
+++ b/drivers/media/video/msm/gemini/msm_gemini_common.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -36,4 +36,4 @@
 	GEMINI_ROTATION_270
 };
 
-#endif /* MSM_GEMINI_COMMON_H */
+#endif 
diff --git a/drivers/media/video/msm/gemini/msm_gemini_core.c b/drivers/media/video/msm/gemini/msm_gemini_core.c
index 51e4eaf..4f856dd 100644
--- a/drivers/media/video/msm/gemini/msm_gemini_core.c
+++ b/drivers/media/video/msm/gemini/msm_gemini_core.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -28,7 +28,7 @@
 {
 	unsigned long flags;
 	int rc = 0;
-	int tm = 500; /*500ms*/
+	int tm = 500; 
 	memset(&fe_pingpong_buf, 0, sizeof(fe_pingpong_buf));
 	fe_pingpong_buf.is_fe = 1;
 	we_pingpong_index = 0;
@@ -53,14 +53,14 @@
 	spin_unlock_irqrestore(&reset_lock, flags);
 
 	if (op_mode == MSM_GEMINI_MODE_REALTIME_ENCODE) {
-		/* Nothing needed for fe buffer cfg, config we only */
+		
 		msm_gemini_hw_we_buffer_cfg(1);
 	} else {
-		/* Nothing needed for fe buffer cfg, config we only */
+		
 		msm_gemini_hw_we_buffer_cfg(0);
 	}
 
-	/* @todo wait for reset done irq */
+	
 
 	return 0;
 }
@@ -88,7 +88,6 @@
 	return 0;
 }
 
-/* fetch engine */
 int msm_gemini_core_fe_buf_update(struct msm_gemini_core_buf *buf)
 {
 	GMN_DBG("%s:%d] 0x%08x %d 0x%08x %d\n", __func__, __LINE__,
@@ -102,7 +101,6 @@
 	return msm_gemini_hw_pingpong_irq(&fe_pingpong_buf);
 }
 
-/* write engine */
 int msm_gemini_core_we_buf_update(struct msm_gemini_core_buf *buf)
 {
 	int rc;
@@ -142,7 +140,7 @@
 	buf_p = msm_gemini_hw_pingpong_active_buffer(&we_pingpong_buf);
 	if (buf_p) {
 		buf_p->framedone_len = msm_gemini_hw_encode_output_size();
-		pr_err("%s:%d] framedone_len %d\n", __func__, __LINE__,
+		GMN_DBG("%s:%d] framedone_len %d\n", __func__, __LINE__,
 			buf_p->framedone_len);
 	}
 
@@ -151,7 +149,7 @@
 
 void *msm_gemini_core_reset_ack_irq(int gemini_irq_status, void *context)
 {
-	/* @todo return the status back to msm_gemini_core_reset */
+	
 	GMN_DBG("%s:%d]\n", __func__, __LINE__);
 	return NULL;
 }
@@ -177,10 +175,10 @@
 	spin_unlock_irqrestore(&reset_lock, flags);
 	gemini_irq_status = msm_gemini_hw_irq_get_status();
 
-	pr_err("%s:%d] gemini_irq_status = %0x\n", __func__, __LINE__,
+	GMN_DBG("%s:%d] gemini_irq_status = %0x\n", __func__, __LINE__,
 		gemini_irq_status);
 
-	/*For reset and framedone IRQs, clear all bits*/
+	
 	if (gemini_irq_status & 0x400) {
 		wake_up(&reset_wait);
 		msm_gemini_hw_irq_clear(HWIO_JPEG_IRQ_CLEAR_RMSK,
@@ -202,34 +200,6 @@
 				context, data);
 	}
 
-	if (msm_gemini_hw_irq_is_reset_ack(gemini_irq_status)) {
-		data = msm_gemini_core_reset_ack_irq(gemini_irq_status,
-			context);
-		if (msm_gemini_irq_handler)
-			msm_gemini_irq_handler(
-				MSM_GEMINI_HW_MASK_COMP_RESET_ACK,
-				context, data);
-	}
-
-	/* Unexpected/unintended HW interrupt */
-	if (msm_gemini_hw_irq_is_err(gemini_irq_status) &&
-		!msm_gemini_hw_irq_is_frame_done(gemini_irq_status)) {
-		data = msm_gemini_core_err_irq(gemini_irq_status, context);
-		if (msm_gemini_irq_handler) {
-			msm_gemini_irq_handler(MSM_GEMINI_HW_MASK_COMP_ERR,
-				context, data);
-			data = msm_gemini_core_fe_pingpong_irq(
-					gemini_irq_status, context);
-			msm_gemini_irq_handler(MSM_GEMINI_HW_MASK_COMP_FE,
-				context, data);
-			data = msm_gemini_core_we_pingpong_irq(
-					gemini_irq_status, context);
-			msm_gemini_irq_handler(MSM_GEMINI_HW_MASK_COMP_WE,
-				context, data);
-		}
-		return IRQ_HANDLED;
-	}
-
 	if (msm_gemini_hw_irq_is_fe_pingpong(gemini_irq_status)) {
 		data = msm_gemini_core_fe_pingpong_irq(gemini_irq_status,
 			context);
@@ -247,6 +217,23 @@
 				context, data);
 	}
 
+	if (msm_gemini_hw_irq_is_reset_ack(gemini_irq_status)) {
+		data = msm_gemini_core_reset_ack_irq(gemini_irq_status,
+			context);
+		if (msm_gemini_irq_handler)
+			msm_gemini_irq_handler(
+				MSM_GEMINI_HW_MASK_COMP_RESET_ACK,
+				context, data);
+	}
+
+	
+	if (msm_gemini_hw_irq_is_err(gemini_irq_status)) {
+		data = msm_gemini_core_err_irq(gemini_irq_status, context);
+		if (msm_gemini_irq_handler)
+			msm_gemini_irq_handler(MSM_GEMINI_HW_MASK_COMP_ERR,
+				context, data);
+	}
+
 	return IRQ_HANDLED;
 }
 
diff --git a/drivers/media/video/msm/gemini/msm_gemini_core.h b/drivers/media/video/msm/gemini/msm_gemini_core.h
index 62dd473..d702bd6 100644
--- a/drivers/media/video/msm/gemini/msm_gemini_core.h
+++ b/drivers/media/video/msm/gemini/msm_gemini_core.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -32,4 +32,4 @@
 
 void msm_gemini_core_release(int);
 void msm_gemini_core_init(void);
-#endif /* MSM_GEMINI_CORE_H */
+#endif 
diff --git a/drivers/media/video/msm/gemini/msm_gemini_dev.c b/drivers/media/video/msm/gemini/msm_gemini_dev.c
index 770a28f..01d45ed 100644
--- a/drivers/media/video/msm/gemini/msm_gemini_dev.c
+++ b/drivers/media/video/msm/gemini/msm_gemini_dev.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
diff --git a/drivers/media/video/msm/gemini/msm_gemini_hw.c b/drivers/media/video/msm/gemini/msm_gemini_hw.c
index ecd85af..19bf063 100644
--- a/drivers/media/video/msm/gemini/msm_gemini_hw.c
+++ b/drivers/media/video/msm/gemini/msm_gemini_hw.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -38,11 +38,11 @@
 	pingpong_hw->buf_status[buf_free_index] = 1;
 
 	if (pingpong_hw->is_fe) {
-		/* it is fe */
+		
 		msm_gemini_hw_fe_buffer_update(
 			&pingpong_hw->buf[buf_free_index], buf_free_index);
 	} else {
-		/* it is we */
+		
 		msm_gemini_hw_we_buffer_update(
 			&pingpong_hw->buf[buf_free_index], buf_free_index);
 	}
@@ -75,7 +75,7 @@
 }
 
 struct msm_gemini_hw_cmd hw_cmd_irq_get_status[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
+	
 	{MSM_GEMINI_HW_CMD_TYPE_READ, 1, HWIO_JPEG_IRQ_STATUS_ADDR,
 		HWIO_JPEG_IRQ_STATUS_RMSK, {0} },
 };
@@ -90,7 +90,7 @@
 }
 
 struct msm_gemini_hw_cmd hw_cmd_encode_output_size[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
+	
 	{MSM_GEMINI_HW_CMD_TYPE_READ, 1,
 		HWIO_JPEG_STATUS_ENCODE_OUTPUT_SIZE_ADDR,
 		HWIO_JPEG_STATUS_ENCODE_OUTPUT_SIZE_RMSK, {0} },
@@ -106,7 +106,7 @@
 }
 
 struct msm_gemini_hw_cmd hw_cmd_irq_clear[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
+	
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_IRQ_CLEAR_ADDR,
 		HWIO_JPEG_IRQ_CLEAR_RMSK, {JPEG_IRQ_CLEAR_ALL} },
 };
@@ -120,7 +120,7 @@
 }
 
 struct msm_gemini_hw_cmd hw_cmd_fe_ping_update[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
+	
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_FE_BUFFER_CFG_ADDR,
 		HWIO_JPEG_FE_BUFFER_CFG_RMSK, {0} },
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_FE_Y_PING_ADDR_ADDR,
@@ -132,7 +132,7 @@
 };
 
 struct msm_gemini_hw_cmd hw_cmd_fe_pong_update[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
+	
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_FE_BUFFER_CFG_ADDR,
 		HWIO_JPEG_FE_BUFFER_CFG_RMSK, {0} },
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_FE_Y_PONG_ADDR_ADDR,
@@ -199,14 +199,14 @@
 
 		msm_gemini_hw_write(hw_cmd_p);
 	} else {
-		/* shall not get to here */
+		
 	}
 
 	return;
 }
 
 struct msm_gemini_hw_cmd hw_cmd_fe_start[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
+	
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_FE_CMD_ADDR,
 		HWIO_JPEG_FE_CMD_RMSK, {JPEG_OFFLINE_CMD_START} },
 };
@@ -219,7 +219,7 @@
 }
 
 struct msm_gemini_hw_cmd hw_cmd_we_buffer_cfg[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
+	
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_WE_Y_THRESHOLD_ADDR,
 		HWIO_JPEG_WE_Y_THRESHOLD_RMSK, {0} },
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_WE_Y_UB_CFG_ADDR,
@@ -228,17 +228,11 @@
 		HWIO_JPEG_WE_CBCR_THRESHOLD_RMSK, {0} },
 };
 
-/* first dimension is WE_ASSERT_STALL_TH and WE_DEASSERT_STALL_TH
-   second dimension is for offline and real-time settings
- */
 static const uint32_t GEMINI_WE_Y_THRESHOLD[2][2] = {
 	{ 0x00000190, 0x000001ff },
 	{ 0x0000016a, 0x000001ff }
 };
 
-/* first dimension is WE_ASSERT_STALL_TH and WE_DEASSERT_STALL_TH
-   second dimension is for offline and real-time settings
- */
 static const uint32_t GEMINI_WE_CBCR_THRESHOLD[2][2] = {
 	{ 0x00000190, 0x000001ff },
 	{ 0x0000016a, 0x000001ff }
@@ -261,7 +255,7 @@
 
 	msm_gemini_hw_write(hw_cmd_p++);
 
-	/* @todo maybe not for realtime? */
+	
 	n_reg_val = (((GEMINI_WE_CBCR_THRESHOLD[1][is_realtime] <<
 		HWIO_JPEG_WE_CBCR_THRESHOLD_WE_DEASSERT_STALL_TH_SHFT) &
 		HWIO_JPEG_WE_CBCR_THRESHOLD_WE_DEASSERT_STALL_TH_BMSK) |
@@ -275,7 +269,7 @@
 }
 
 struct msm_gemini_hw_cmd hw_cmd_we_ping_update[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
+	
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_WE_Y_PING_BUFFER_CFG_ADDR,
 		HWIO_JPEG_WE_Y_PING_BUFFER_CFG_RMSK, {0} },
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_WE_Y_PING_ADDR_ADDR,
@@ -283,7 +277,7 @@
 };
 
 struct msm_gemini_hw_cmd hw_cmd_we_pong_update[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
+	
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_WE_Y_PONG_BUFFER_CFG_ADDR,
 		HWIO_JPEG_WE_Y_PONG_BUFFER_CFG_RMSK, {0} },
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_WE_Y_PONG_ADDR_ADDR,
@@ -297,7 +291,6 @@
 
 	struct msm_gemini_hw_cmd *hw_cmd_p;
 
-	GMN_DBG("%s:%d] pingpong index %d", __func__, __LINE__, pingpong_index);
 	if (pingpong_index == 0) {
 		hw_cmd_p = &hw_cmd_we_ping_update[0];
 
@@ -323,14 +316,14 @@
 		hw_cmd_p->data = n_reg_val;
 		msm_gemini_hw_write(hw_cmd_p++);
 	} else {
-		/* shall not get to here */
+		
 	}
 
 	return;
 }
 
 struct msm_gemini_hw_cmd hw_cmd_reset[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
+	
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_IRQ_MASK_ADDR,
 		HWIO_JPEG_IRQ_MASK_RMSK, {JPEG_IRQ_DISABLE_ALL} },
 	{MSM_GEMINI_HW_CMD_TYPE_WRITE, 1, HWIO_JPEG_IRQ_CLEAR_ADDR,
@@ -384,7 +377,7 @@
 	uint32_t *paddr;
 	uint32_t old_data, new_data;
 
-	/* type, repeat n times, offset, mask, data or pdata */
+	
 	GMN_DBG("%s:%d] type-%d n-%d offset-0x%4x mask-0x%8x data-0x%8x\n",
 		__func__, __LINE__, hw_cmd_p->type, hw_cmd_p->n,
 		hw_cmd_p->offset, hw_cmd_p->mask, hw_cmd_p->data);
@@ -403,18 +396,6 @@
 	writel(new_data, paddr);
 }
 
-void msm_gemini_io_w(uint32_t offset, uint32_t val)
-{
-	uint32_t *paddr = gemini_region_base + offset;
-	writel(val, paddr);
-}
-
-uint32_t msm_gemini_io_r(uint32_t offset)
-{
-	uint32_t *paddr = gemini_region_base + offset;
-	return readl(paddr);
-}
-
 int msm_gemini_hw_wait(struct msm_gemini_hw_cmd *hw_cmd_p, int m_us)
 {
 	int tm = hw_cmd_p->n;
@@ -499,21 +480,14 @@
 	return is_copy_to_user;
 }
 
-void msm_gemini_hw_region_dump(uint32_t size)
+void msm_gemini_hw_region_dump(int size)
 {
 	uint32_t *p;
 	uint8_t *p8;
 
-	if (size > gemini_region_size) {
+	if (size > gemini_region_size)
 		GMN_PR_ERR("%s:%d] wrong region dump size\n",
 			__func__, __LINE__);
-		return;
-	}
-	if (!gemini_region_base) {
-		GMN_PR_ERR("%s:%d] gemini region not setup yet\n",
-			__func__, __LINE__);
-		return;
-	}
 
 	p = (uint32_t *) gemini_region_base;
 	while (size >= 16) {
@@ -543,31 +517,3 @@
 	}
 }
 
-void msm_gemini_io_dump(int size)
-{
-	char line_str[128], *p_str;
-	void __iomem *addr = gemini_region_base;
-	int i;
-	u32 *p = (u32 *) addr;
-	u32 data;
-	pr_err("%s: %p %d reg_size %d\n", __func__, addr, size,
-							gemini_region_size);
-	line_str[0] = '\0';
-	p_str = line_str;
-	for (i = 0; i < size/4; i++) {
-		if (i % 4 == 0) {
-			snprintf(p_str, 12, "%08x: ", (u32) p);
-			p_str += 10;
-		}
-		data = readl_relaxed(p++);
-		snprintf(p_str, 12, "%08x ", data);
-		p_str += 9;
-		if ((i + 1) % 4 == 0) {
-			pr_err("%s\n", line_str);
-			line_str[0] = '\0';
-			p_str = line_str;
-		}
-	}
-	if (line_str[0] != '\0')
-		pr_err("%s\n", line_str);
-}
diff --git a/drivers/media/video/msm/gemini/msm_gemini_hw.h b/drivers/media/video/msm/gemini/msm_gemini_hw.h
index edcf3eb..6fac7c8 100644
--- a/drivers/media/video/msm/gemini/msm_gemini_hw.h
+++ b/drivers/media/video/msm/gemini/msm_gemini_hw.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -15,8 +15,8 @@
 
 #include <media/msm_gemini.h>
 #include "msm_gemini_hw_reg.h"
+#include <mach/msm_subsystem_map.h>
 #include <linux/msm_ion.h>
-#include <mach/iommu_domains.h>
 
 struct msm_gemini_hw_buf {
 	struct msm_gemini_buf vbuf;
@@ -31,7 +31,7 @@
 };
 
 struct msm_gemini_hw_pingpong {
-	uint8_t is_fe; /* 1: fe; 0: we */
+	uint8_t is_fe; 
 	struct  msm_gemini_hw_buf buf[2];
 	int     buf_status[2];
 	int     buf_active_index;
@@ -95,13 +95,10 @@
 int msm_gemini_hw_wait(struct msm_gemini_hw_cmd *hw_cmd_p, int m_us);
 void msm_gemini_hw_delay(struct msm_gemini_hw_cmd *hw_cmd_p, int m_us);
 int msm_gemini_hw_exec_cmds(struct msm_gemini_hw_cmd *hw_cmd_p, uint32_t m_cmds);
-void msm_gemini_hw_region_dump(uint32_t size);
-void msm_gemini_io_dump(int size);
-void msm_gemini_io_w(uint32_t offset, uint32_t val);
-uint32_t msm_gemini_io_r(uint32_t offset);
+void msm_gemini_hw_region_dump(int size);
 
-#define MSM_GEMINI_PIPELINE_CLK_128MHZ 128 /* 8MP  128MHz */
-#define MSM_GEMINI_PIPELINE_CLK_140MHZ 140 /* 9MP  140MHz */
-#define MSM_GEMINI_PIPELINE_CLK_200MHZ 153 /* 12MP 153MHz */
+#define MSM_GEMINI_PIPELINE_CLK_128MHZ 128 
+#define MSM_GEMINI_PIPELINE_CLK_140MHZ 140 
+#define MSM_GEMINI_PIPELINE_CLK_200MHZ 153 
 
-#endif /* MSM_GEMINI_HW_H */
+#endif 
diff --git a/drivers/media/video/msm/gemini/msm_gemini_hw_reg.h b/drivers/media/video/msm/gemini/msm_gemini_hw_reg.h
index 8f27892..231f06e 100644
--- a/drivers/media/video/msm/gemini/msm_gemini_hw_reg.h
+++ b/drivers/media/video/msm/gemini/msm_gemini_hw_reg.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -80,7 +80,7 @@
 
 #define JPEG_WE_YUB_ENCODE 0x01ff0000
 
-#define JPEG_RESET_DEFAULT 0x0004ffff /* cfff? */
+#define JPEG_RESET_DEFAULT 0x0004ffff 
 
 #define JPEG_IRQ_DISABLE_ALL 0x00000000
 #define JPEG_IRQ_CLEAR_ALL 0xffffffff
@@ -171,6 +171,6 @@
 #define HWIO_JPEG_IRQ_STATUS_RMSK 0xffffffff
 
 #define HWIO_JPEG_STATUS_ENCODE_OUTPUT_SIZE_ADDR (GEMINI_REG_BASE + 0x00000034)
-#define HWIO_JPEG_STATUS_ENCODE_OUTPUT_SIZE_RMSK 0xffffffff
+#define HWIO_JPEG_STATUS_ENCODE_OUTPUT_SIZE_RMSK 0xffffff
 
-#endif /* MSM_GEMINI_HW_REG_H */
+#endif 
diff --git a/drivers/media/video/msm/gemini/msm_gemini_platform.c b/drivers/media/video/msm/gemini/msm_gemini_platform.c
index d5a8098..2d846d0 100644
--- a/drivers/media/video/msm/gemini/msm_gemini_platform.c
+++ b/drivers/media/video/msm/gemini/msm_gemini_platform.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -17,14 +17,13 @@
 #include <linux/io.h>
 #include <linux/android_pmem.h>
 #include <mach/camera.h>
-#include <mach/iommu_domains.h>
+#include <mach/msm_subsystem_map.h>
 
 #include "msm_gemini_platform.h"
 #include "msm_gemini_sync.h"
 #include "msm_gemini_common.h"
 #include "msm_gemini_hw.h"
 
-/* AXI rate in KHz */
 #define MSM_SYSTEM_BUS_RATE	160000
 struct ion_client *gemini_client;
 
@@ -67,7 +66,7 @@
 		goto error1;
 	}
 
-	/* validate user input */
+	
 	if (len > size) {
 		GMN_PR_ERR("%s: invalid offset + len\n", __func__);
 		goto error1;
@@ -173,7 +172,7 @@
 				goto gemini_fs_failed;
 			}
 		}
-	}
+ 	}
 
 	msm_gemini_hw_init(gemini_base, resource_size(gemini_mem));
 	rc = request_irq(gemini_irq, handler, IRQF_TRIGGER_RISING, "gemini",
@@ -225,8 +224,8 @@
 	int result = 0;
 	struct msm_gemini_device *pgmn_dev =
 		(struct msm_gemini_device *) context;
-
-	free_irq(irq, context);
+ 
+ 	free_irq(irq, context);
 
 	if (pgmn_dev->hw_version != GEMINI_7X) {
 		regulator_disable(pgmn_dev->gemini_fs);
diff --git a/drivers/media/video/msm/gemini/msm_gemini_platform.h b/drivers/media/video/msm/gemini/msm_gemini_platform.h
index f6291dc..4ebfbcb 100644
--- a/drivers/media/video/msm/gemini/msm_gemini_platform.h
+++ b/drivers/media/video/msm/gemini/msm_gemini_platform.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -17,6 +17,7 @@
 #include <linux/platform_device.h>
 #include <linux/msm_ion.h>
 #include <linux/iommu.h>
+
 void msm_gemini_platform_p2v(struct file  *file,
 				struct ion_handle **ionhandle);
 uint32_t msm_gemini_platform_v2p(int fd, uint32_t len, struct file **file,
@@ -34,4 +35,4 @@
 int msm_gemini_platform_release(struct resource *mem, void *base, int irq,
 	void *context);
 
-#endif /* MSM_GEMINI_PLATFORM_H */
+#endif 
diff --git a/drivers/media/video/msm/gemini/msm_gemini_sync.c b/drivers/media/video/msm/gemini/msm_gemini_sync.c
index 3a674b4..e1216cf 100644
--- a/drivers/media/video/msm/gemini/msm_gemini_sync.c
+++ b/drivers/media/video/msm/gemini/msm_gemini_sync.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -20,16 +20,9 @@
 #include "msm_gemini_core.h"
 #include "msm_gemini_platform.h"
 #include "msm_gemini_common.h"
-#include <mach/msm_bus.h>
-#include <mach/msm_bus_board.h>
-#include <linux/delay.h>
 
 static int release_buf;
 
-/* size is based on 4k page size */
-static const int g_max_out_size = 0x7ff000;
-
-/*************** queue helper ****************/
 inline void msm_gemini_q_init(char const *name, struct msm_gemini_q *q_p)
 {
 	GMN_DBG("%s:%d] %s\n", __func__, __LINE__, name);
@@ -108,7 +101,7 @@
 
 inline int msm_gemini_q_wait(struct msm_gemini_q *q_p)
 {
-	int tm = MAX_SCHEDULE_TIMEOUT; /* 500ms */
+	int tm = MAX_SCHEDULE_TIMEOUT; 
 	int rc;
 
 	GMN_DBG("%s:%d] %s wait\n", __func__, __LINE__, q_p->name);
@@ -179,14 +172,13 @@
 	q_p->unblck = 0;
 }
 
-/*************** event queue ****************/
 
 int msm_gemini_framedone_irq(struct msm_gemini_device *pgmn_dev,
 	struct msm_gemini_core_buf *buf_in)
 {
 	int rc = 0;
 
-	GMN_PR_ERR("%s:%d] buf_in %p", __func__, __LINE__, buf_in);
+	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
 
 	if (buf_in) {
 		buf_in->vbuf.framedone_len = buf_in->framedone_len;
@@ -224,13 +216,9 @@
 		return -EAGAIN;
 	}
 
-	memset(&ctrl_cmd, 0, sizeof(struct msm_gemini_ctrl_cmd));
 	ctrl_cmd.type = buf_p->vbuf.type;
 	kfree(buf_p);
 
-	GMN_DBG("%s:%d] 0x%08x %d\n", __func__, __LINE__,
-		(int) ctrl_cmd.value, ctrl_cmd.len);
-
 	if (copy_to_user(to, &ctrl_cmd, sizeof(ctrl_cmd))) {
 		GMN_PR_ERR("%s:%d]\n", __func__, __LINE__);
 		return -EFAULT;
@@ -267,74 +255,9 @@
 	if (!rc)
 		GMN_PR_ERR("%s:%d] err err\n", __func__, __LINE__);
 
-	pgmn_dev->core_reset = 1;
 	return;
 }
 
-/*************** output queue ****************/
-
-int msm_gemini_get_out_buffer(struct msm_gemini_device *pgmn_dev,
-	struct msm_gemini_hw_buf *p_outbuf)
-{
-	int buf_size = 0;
-	int bytes_remaining = 0;
-	if (pgmn_dev->out_offset >= pgmn_dev->out_buf.y_len) {
-		GMN_PR_ERR("%s:%d] no more buffers", __func__, __LINE__);
-		return -EINVAL;
-	}
-	bytes_remaining = pgmn_dev->out_buf.y_len - pgmn_dev->out_offset;
-	buf_size = min(bytes_remaining, pgmn_dev->max_out_size);
-
-	pgmn_dev->out_frag_cnt++;
-	pr_err("%s:%d] buf_size[%d] %d", __func__, __LINE__,
-		pgmn_dev->out_frag_cnt, buf_size);
-	p_outbuf->y_len = buf_size;
-	p_outbuf->y_buffer_addr = pgmn_dev->out_buf.y_buffer_addr +
-		pgmn_dev->out_offset;
-	pgmn_dev->out_offset += buf_size;
-	return 0;
-}
-
-int msm_gemini_outmode_single_we_pingpong_irq(
-	struct msm_gemini_device *pgmn_dev,
-	struct msm_gemini_core_buf *buf_in)
-{
-	int rc = 0;
-	struct msm_gemini_core_buf out_buf;
-	int frame_done = buf_in &&
-		buf_in->vbuf.type == MSM_GEMINI_EVT_FRAMEDONE;
-	pr_err("%s:%d] framedone %d", __func__, __LINE__, frame_done);
-	if (!pgmn_dev->out_buf_set) {
-		GMN_PR_ERR("%s:%d] output buffer not set",
-			__func__, __LINE__);
-		return -EFAULT;
-	}
-	if (frame_done) {
-		/* send the buffer back */
-		pgmn_dev->out_buf.vbuf.framedone_len = buf_in->framedone_len;
-		pgmn_dev->out_buf.vbuf.type = MSM_GEMINI_EVT_FRAMEDONE;
-		rc = msm_gemini_q_in_buf(&pgmn_dev->output_rtn_q,
-			&pgmn_dev->out_buf);
-		if (rc) {
-			GMN_PR_ERR("%s:%d] cannot queue the output buffer",
-				 __func__, __LINE__);
-			return -EFAULT;
-		}
-		rc =  msm_gemini_q_wakeup(&pgmn_dev->output_rtn_q);
-		/* reset the output buffer since the ownership is
-			transferred to the rtn queue */
-		if (!rc)
-		  pgmn_dev->out_buf_set = 0;
-	} else {
-		/* configure ping/pong */
-		rc = msm_gemini_get_out_buffer(pgmn_dev, &out_buf);
-		if (rc)
-			msm_gemini_core_we_buf_reset(&out_buf);
-		else
-			msm_gemini_core_we_buf_update(&out_buf);
-	}
-	return rc;
-}
 
 int msm_gemini_we_pingpong_irq(struct msm_gemini_device *pgmn_dev,
 	struct msm_gemini_core_buf *buf_in)
@@ -342,13 +265,7 @@
 	int rc = 0;
 	struct msm_gemini_core_buf *buf_out;
 
-	GMN_DBG("%s:%d] Enter mode %d", __func__, __LINE__,
-		pgmn_dev->out_mode);
-
-	if (pgmn_dev->out_mode == MSM_GMN_OUTMODE_SINGLE)
-		return msm_gemini_outmode_single_we_pingpong_irq(pgmn_dev,
-			buf_in);
-
+	GMN_DBG("%s:%d] Enter\n", __func__, __LINE__);
 	if (buf_in) {
 		GMN_DBG("%s:%d] 0x%08x %d\n", __func__, __LINE__,
 			(int) buf_in->y_buffer_addr, buf_in->y_len);
@@ -357,7 +274,6 @@
 		GMN_DBG("%s:%d] no output return buffer\n", __func__,
 			__LINE__);
 		rc = -1;
-		return rc;
 	}
 
 	buf_out = msm_gemini_q_out(&pgmn_dev->output_buf_q);
@@ -366,7 +282,8 @@
 		rc = msm_gemini_core_we_buf_update(buf_out);
 		kfree(buf_out);
 	} else {
-		msm_gemini_core_we_buf_reset(buf_in);
+		if (buf_in)
+			msm_gemini_core_we_buf_reset(buf_in);
 		GMN_DBG("%s:%d] no output buffer\n", __func__, __LINE__);
 		rc = -2;
 	}
@@ -415,43 +332,6 @@
 	return 0;
 }
 
-int msm_gemini_set_output_buf(struct msm_gemini_device *pgmn_dev,
-	void __user *arg)
-{
-	struct msm_gemini_buf buf_cmd;
-
-	if (pgmn_dev->out_buf_set) {
-		GMN_PR_ERR("%s:%d] outbuffer buffer already provided",
-			__func__, __LINE__);
-		return -EINVAL;
-	}
-
-	if (copy_from_user(&buf_cmd, arg, sizeof(struct msm_gemini_buf))) {
-		GMN_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	GMN_DBG("%s:%d] output addr 0x%08x len %d", __func__, __LINE__,
-		(int) buf_cmd.vaddr,
-		buf_cmd.y_len);
-
-	pgmn_dev->out_buf.y_buffer_addr = msm_gemini_platform_v2p(
-		buf_cmd.fd,
-		buf_cmd.y_len,
-		&pgmn_dev->out_buf.file,
-		&pgmn_dev->out_buf.handle);
-	if (!pgmn_dev->out_buf.y_buffer_addr) {
-		GMN_PR_ERR("%s:%d] cannot map the output address",
-			__func__, __LINE__);
-		return -EFAULT;
-	}
-	pgmn_dev->out_buf.y_len = buf_cmd.y_len;
-	pgmn_dev->out_buf.vbuf = buf_cmd;
-	pgmn_dev->out_buf_set = 1;
-
-	return 0;
-}
-
 int msm_gemini_output_buf_enqueue(struct msm_gemini_device *pgmn_dev,
 	void __user *arg)
 {
@@ -487,7 +367,6 @@
 	return 0;
 }
 
-/*************** input queue ****************/
 
 int msm_gemini_fe_pingpong_irq(struct msm_gemini_device *pgmn_dev,
 	struct msm_gemini_core_buf *buf_in)
@@ -569,7 +448,6 @@
 	struct msm_gemini_core_buf *buf_p;
 	struct msm_gemini_buf buf_cmd;
 	int rc = 0;
-	struct msm_bus_scale_pdata *p_bus_scale_data = NULL;
 
 	if (copy_from_user(&buf_cmd, arg, sizeof(struct msm_gemini_buf))) {
 		GMN_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
@@ -582,8 +460,8 @@
 		return -1;
 	}
 
-	GMN_DBG("%s:%d] 0x%08x %d mode %d\n", __func__, __LINE__,
-		(int) buf_cmd.vaddr, buf_cmd.y_len, pgmn_dev->op_mode);
+	GMN_DBG("%s:%d] 0x%08x %d\n", __func__, __LINE__,
+		(int) buf_cmd.vaddr, buf_cmd.y_len);
 
 	if (pgmn_dev->op_mode == MSM_GEMINI_MODE_REALTIME_ENCODE) {
 		rc = msm_iommu_map_contig_buffer(
@@ -598,15 +476,15 @@
 			return rc;
 		}
 	} else {
-		buf_p->y_buffer_addr    = msm_gemini_platform_v2p(buf_cmd.fd,
-			buf_cmd.y_len + buf_cmd.cbcr_len, &buf_p->file,
-			&buf_p->handle)	+ buf_cmd.offset + buf_cmd.y_off;
+	buf_p->y_buffer_addr    = msm_gemini_platform_v2p(buf_cmd.fd,
+		buf_cmd.y_len + buf_cmd.cbcr_len, &buf_p->file,
+		&buf_p->handle)	+ buf_cmd.offset;
 	}
 	buf_p->y_len          = buf_cmd.y_len;
 
-	buf_p->cbcr_buffer_addr = buf_p->y_buffer_addr + buf_cmd.y_len +
-					buf_cmd.cbcr_off;
+	buf_p->cbcr_buffer_addr = buf_p->y_buffer_addr + buf_cmd.y_len;
 	buf_p->cbcr_len       = buf_cmd.cbcr_len;
+
 	buf_p->num_of_mcu_rows = buf_cmd.num_of_mcu_rows;
 	GMN_DBG("%s: y_addr=%x,y_len=%x,cbcr_addr=%x,cbcr_len=%x\n", __func__,
 		buf_p->y_buffer_addr, buf_p->y_len, buf_p->cbcr_buffer_addr,
@@ -618,30 +496,6 @@
 		return -1;
 	}
 	buf_p->vbuf           = buf_cmd;
-	buf_p->vbuf.type      = MSM_GEMINI_EVT_RESET;
-
-	/* Set bus vectors */
-	p_bus_scale_data = (struct msm_bus_scale_pdata *)
-		pgmn_dev->pdev->dev.platform_data;
-	if (pgmn_dev->bus_perf_client &&
-		(MSM_GMN_OUTMODE_SINGLE == pgmn_dev->out_mode)) {
-		int rc;
-		struct msm_bus_paths *path = &(p_bus_scale_data->usecase[1]);
-		GMN_DBG("%s:%d] Update bus bandwidth", __func__, __LINE__);
-		if (pgmn_dev->op_mode & MSM_GEMINI_MODE_OFFLINE_ENCODE) {
-			path->vectors[0].ab = (buf_p->y_len + buf_p->cbcr_len) *
-				15 * 2;
-			path->vectors[0].ib = path->vectors[0].ab;
-			path->vectors[1].ab = 0;
-			path->vectors[1].ib = 0;
-		}
-		rc = msm_bus_scale_client_update_request(
-			pgmn_dev->bus_perf_client, 1);
-		if (rc < 0) {
-			GMN_PR_ERR("%s:%d] update_request fails %d",
-				__func__, __LINE__, rc);
-		}
-	}
 
 	msm_gemini_q_in(&pgmn_dev->input_buf_q, buf_p);
 
@@ -683,13 +537,10 @@
 int __msm_gemini_open(struct msm_gemini_device *pgmn_dev)
 {
 	int rc;
-	struct msm_bus_scale_pdata *p_bus_scale_data =
-		(struct msm_bus_scale_pdata *)pgmn_dev->pdev->dev.
-			platform_data;
 
 	mutex_lock(&pgmn_dev->lock);
 	if (pgmn_dev->open_count) {
-		/* only open once */
+		
 		GMN_PR_ERR("%s:%d] busy\n", __func__, __LINE__);
 		mutex_unlock(&pgmn_dev->lock);
 		return -EBUSY;
@@ -717,24 +568,7 @@
 	msm_gemini_q_cleanup(&pgmn_dev->input_rtn_q);
 	msm_gemini_q_cleanup(&pgmn_dev->input_buf_q);
 	msm_gemini_core_init();
-	pgmn_dev->out_mode = MSM_GMN_OUTMODE_FRAGMENTED;
-	pgmn_dev->out_buf_set = 0;
-	pgmn_dev->out_offset = 0;
-	pgmn_dev->max_out_size = g_max_out_size;
-	pgmn_dev->out_frag_cnt = 0;
-	pgmn_dev->bus_perf_client = 0;
-	pgmn_dev->core_reset = 0;
 
-	if (p_bus_scale_data) {
-		GMN_DBG("%s:%d] register bus client", __func__, __LINE__);
-		pgmn_dev->bus_perf_client =
-			msm_bus_scale_register_client(p_bus_scale_data);
-		if (!pgmn_dev->bus_perf_client) {
-			GMN_PR_ERR("%s:%d] bus client register failed",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-	}
 	GMN_DBG("%s:%d] success\n", __func__, __LINE__);
 	return rc;
 }
@@ -751,33 +585,13 @@
 	pgmn_dev->open_count--;
 	mutex_unlock(&pgmn_dev->lock);
 
-	if (pgmn_dev->out_mode == MSM_GMN_OUTMODE_FRAGMENTED) {
-		msm_gemini_core_release(release_buf);
-	} else if (pgmn_dev->out_buf_set) {
-		msm_gemini_platform_p2v(pgmn_dev->out_buf.file,
-			&pgmn_dev->out_buf.handle);
-	}
-
-	if (pgmn_dev->core_reset) {
-		GMN_PR_ERR(KERN_ERR "gemini core reset cfg %x mode %d",
-			msm_gemini_io_r(0x8),
-			pgmn_dev->op_mode);
-		wmb();
-		msm_gemini_io_w(0x4, 0x8000);
-		msleep(5);
-		wmb();
-	}
+	msm_gemini_core_release(release_buf);
 	msm_gemini_q_cleanup(&pgmn_dev->evt_q);
 	msm_gemini_q_cleanup(&pgmn_dev->output_rtn_q);
 	msm_gemini_outbuf_q_cleanup(&pgmn_dev->output_buf_q);
 	msm_gemini_q_cleanup(&pgmn_dev->input_rtn_q);
 	msm_gemini_outbuf_q_cleanup(&pgmn_dev->input_buf_q);
 
-	if (pgmn_dev->bus_perf_client) {
-		msm_bus_scale_unregister_client(pgmn_dev->bus_perf_client);
-		pgmn_dev->bus_perf_client = 0;
-	}
-
 	if (pgmn_dev->open_count)
 		GMN_PR_ERR(KERN_ERR "%s: multiple opens\n", __func__);
 
@@ -877,59 +691,29 @@
 		}
 	}
 
-	if (pgmn_dev->out_mode == MSM_GMN_OUTMODE_FRAGMENTED) {
-		for (i = 0; i < 2; i++) {
-			buf_out_free[i] =
-				msm_gemini_q_out(&pgmn_dev->output_buf_q);
+	for (i = 0; i < 2; i++) {
+		buf_out_free[i] = msm_gemini_q_out(&pgmn_dev->output_buf_q);
 
-			if (buf_out_free[i]) {
-				msm_gemini_core_we_buf_update(buf_out_free[i]);
-			} else if (i == 1) {
-				/* set the pong to same address as ping */
-				buf_out_free[0]->y_len >>= 1;
-				buf_out_free[0]->y_buffer_addr +=
-					buf_out_free[0]->y_len;
-				msm_gemini_core_we_buf_update(buf_out_free[0]);
-				/* since ping and pong are same buf
-				*  release only once */
-				release_buf = 0;
-			} else {
-				GMN_DBG("%s:%d] no output buffer\n",
-					__func__, __LINE__);
-				break;
-			}
+		if (buf_out_free[i]) {
+			msm_gemini_core_we_buf_update(buf_out_free[i]);
+		} else if (i == 1) {
+			
+			buf_out_free[0]->y_len >>= 1;
+			buf_out_free[0]->y_buffer_addr +=
+				buf_out_free[0]->y_len;
+			msm_gemini_core_we_buf_update(buf_out_free[0]);
+			
+			release_buf = 0;
+		} else {
+			GMN_DBG("%s:%d] no output buffer\n",
+			__func__, __LINE__);
+			break;
 		}
-		for (i = 0; i < 2; i++)
-			kfree(buf_out_free[i]);
-	} else {
-		struct msm_gemini_core_buf out_buf;
-		/* Since the same buffer is fragmented, p2v need not be
-		called for all the buffers */
-		release_buf = 0;
-		if (!pgmn_dev->out_buf_set) {
-			GMN_PR_ERR("%s:%d] output buffer not set",
-				__func__, __LINE__);
-			return -EFAULT;
-		}
-		/* configure ping */
-		rc = msm_gemini_get_out_buffer(pgmn_dev, &out_buf);
-		if (rc) {
-			GMN_PR_ERR("%s:%d] no output buffer for ping",
-				__func__, __LINE__);
-			return rc;
-		}
-		msm_gemini_core_we_buf_update(&out_buf);
-		/* configure pong */
-		rc = msm_gemini_get_out_buffer(pgmn_dev, &out_buf);
-		if (rc) {
-			GMN_DBG("%s:%d] no output buffer for pong",
-				__func__, __LINE__);
-			/* fall through to configure same buffer */
-		}
-		msm_gemini_core_we_buf_update(&out_buf);
-		//msm_gemini_io_dump(0x150);
 	}
 
+	for (i = 0; i < 2; i++)
+		kfree(buf_out_free[i]);
+
 	rc = msm_gemini_ioctl_hw_cmds(pgmn_dev, arg);
 	GMN_DBG("%s:%d]\n", __func__, __LINE__);
 	return rc;
@@ -947,31 +731,13 @@
 		return -EFAULT;
 	}
 
-	pgmn_dev->op_mode = MSM_GEMINI_MODE_OFFLINE_ENCODE;
+	pgmn_dev->op_mode = ctrl_cmd.type;
 
 	rc = msm_gemini_core_reset(pgmn_dev->op_mode, pgmn_dev->base,
 		resource_size(pgmn_dev->mem));
 	return rc;
 }
 
-int msm_gemini_ioctl_set_outmode(struct msm_gemini_device *pgmn_dev,
-	void * __user arg)
-{
-	int rc = 0;
-	enum msm_gmn_out_mode mode;
-
-	if (copy_from_user(&mode, arg, sizeof(mode))) {
-		GMN_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-	GMN_DBG("%s:%d] mode %d", __func__, __LINE__, mode);
-
-	if ((mode == MSM_GMN_OUTMODE_FRAGMENTED)
-		||(mode == MSM_GMN_OUTMODE_SINGLE))
-		pgmn_dev->out_mode = mode;
-	return rc;
-}
-
 int msm_gemini_ioctl_test_dump_region(struct msm_gemini_device *pgmn_dev,
 	unsigned long arg)
 {
@@ -1016,12 +782,8 @@
 		break;
 
 	case MSM_GMN_IOCTL_OUTPUT_BUF_ENQUEUE:
-		if (pgmn_dev->out_mode == MSM_GMN_OUTMODE_FRAGMENTED)
-			rc = msm_gemini_output_buf_enqueue(pgmn_dev,
-				(void __user *) arg);
-		else
-			rc = msm_gemini_set_output_buf(pgmn_dev,
-				(void __user *) arg);
+		rc = msm_gemini_output_buf_enqueue(pgmn_dev,
+			(void __user *) arg);
 		break;
 
 	case MSM_GMN_IOCTL_OUTPUT_GET:
@@ -1052,10 +814,6 @@
 		rc = msm_gemini_ioctl_test_dump_region(pgmn_dev, arg);
 		break;
 
-	case MSM_GMN_IOCTL_SET_MODE:
-		rc = msm_gemini_ioctl_set_outmode(pgmn_dev, (void __user *)arg);
-		break;
-
 	default:
 		GMN_PR_ERR(KERN_INFO "%s:%d] cmd = %d not supported\n",
 			__func__, __LINE__, _IOC_NR(cmd));
diff --git a/drivers/media/video/msm/gemini/msm_gemini_sync.h b/drivers/media/video/msm/gemini/msm_gemini_sync.h
index fa84fa1..a8d93c5 100644
--- a/drivers/media/video/msm/gemini/msm_gemini_sync.h
+++ b/drivers/media/video/msm/gemini/msm_gemini_sync.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -53,38 +53,17 @@
 	char	  open_count;
 	uint8_t       op_mode;
 
-	/* event queue including frame done & err indications
-	 */
 	struct msm_gemini_q evt_q;
 
-	/* output return queue
-	 */
 	struct msm_gemini_q output_rtn_q;
 
-	/* output buf queue
-	 */
 	struct msm_gemini_q output_buf_q;
 
-	/* input return queue
-	 */
 	struct msm_gemini_q input_rtn_q;
 
-	/* input buf queue
-	 */
 	struct msm_gemini_q input_buf_q;
 
 	struct v4l2_subdev subdev;
-	enum msm_gmn_out_mode out_mode;
-
-	/*single out mode parameters*/
-	struct msm_gemini_hw_buf out_buf;
-	int out_offset;
-	int out_buf_set;
-	int max_out_size;
-	int out_frag_cnt;
-
-	uint32_t bus_perf_client;
-	uint32_t core_reset;
 };
 
 int __msm_gemini_open(struct msm_gemini_device *pgmn_dev);
@@ -96,4 +75,4 @@
 struct msm_gemini_device *__msm_gemini_init(struct platform_device *pdev);
 int __msm_gemini_exit(struct msm_gemini_device *pgmn_dev);
 
-#endif /* MSM_GEMINI_SYNC_H */
+#endif 
diff --git a/drivers/media/video/msm/imx072.c b/drivers/media/video/msm/imx072.c
deleted file mode 100644
index 29d2118..0000000
--- a/drivers/media/video/msm/imx072.c
+++ /dev/null
@@ -1,1184 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/debugfs.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/slab.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include "imx072.h"
-
-/* SENSOR REGISTER DEFINES */
-#define REG_GROUPED_PARAMETER_HOLD		0x0104
-#define GROUPED_PARAMETER_HOLD_OFF		0x00
-#define GROUPED_PARAMETER_HOLD			0x01
-/* Integration Time */
-#define REG_COARSE_INTEGRATION_TIME		0x0202
-/* Gain */
-#define REG_GLOBAL_GAIN					0x0204
-
-/* PLL registers */
-#define REG_FRAME_LENGTH_LINES			0x0340
-#define REG_LINE_LENGTH_PCK				0x0342
-
-/* 16bit address - 8 bit context register structure */
-#define Q8  0x00000100
-#define Q10 0x00000400
-#define IMX072_MASTER_CLK_RATE 24000000
-#define IMX072_OFFSET		3
-
-/* AF Total steps parameters */
-#define IMX072_AF_I2C_ADDR	0x18
-#define IMX072_TOTAL_STEPS_NEAR_TO_FAR    30
-
-static uint16_t imx072_step_position_table[IMX072_TOTAL_STEPS_NEAR_TO_FAR+1];
-static uint16_t imx072_nl_region_boundary1;
-static uint16_t imx072_nl_region_code_per_step1;
-static uint16_t imx072_l_region_code_per_step = 12;
-static uint16_t imx072_sw_damping_time_wait = 8;
-static uint16_t imx072_af_initial_code = 350;
-static uint16_t imx072_damping_threshold = 10;
-
-struct imx072_work_t {
-	struct work_struct work;
-};
-
-static struct imx072_work_t *imx072_sensorw;
-static struct i2c_client *imx072_client;
-
-struct imx072_ctrl_t {
-	const struct  msm_camera_sensor_info *sensordata;
-
-	uint32_t sensormode;
-	uint32_t fps_divider;/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;/* init to 1 * 0x00000400 */
-	uint16_t fps;
-
-	uint16_t curr_lens_pos;
-	uint16_t curr_step_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint16_t total_lines_per_frame;
-
-	enum imx072_resolution_t prev_res;
-	enum imx072_resolution_t pict_res;
-	enum imx072_resolution_t curr_res;
-	enum imx072_test_mode_t  set_test;
-	enum imx072_cam_mode_t cam_mode;
-};
-
-static uint16_t prev_line_length_pck;
-static uint16_t prev_frame_length_lines;
-static uint16_t snap_line_length_pck;
-static uint16_t snap_frame_length_lines;
-
-static bool CSI_CONFIG;
-static struct imx072_ctrl_t *imx072_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(imx072_wait_queue);
-DEFINE_MUTEX(imx072_mut);
-
-#ifdef CONFIG_DEBUG_FS
-static int cam_debug_init(void);
-static struct dentry *debugfs_base;
-#endif
-
-static int imx072_i2c_rxdata(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = length,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = length,
-			.buf   = rxdata,
-		},
-	};
-	if (i2c_transfer(imx072_client->adapter, msgs, 2) < 0) {
-		pr_err("imx072_i2c_rxdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-	return 0;
-}
-
-static int32_t imx072_i2c_txdata(unsigned short saddr,
-				unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		 },
-	};
-	if (i2c_transfer(imx072_client->adapter, msg, 1) < 0) {
-		pr_err("imx072_i2c_txdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t imx072_i2c_read(unsigned short raddr,
-	unsigned short *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-	if (!rdata)
-		return -EIO;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-	rc = imx072_i2c_rxdata(imx072_client->addr>>1, buf, rlen);
-	if (rc < 0) {
-		pr_err("imx072_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-	CDBG("imx072_i2c_read 0x%x val = 0x%x!\n", raddr, *rdata);
-	return rc;
-}
-
-static int32_t imx072_i2c_write_w_sensor(unsigned short waddr,
-	uint16_t wdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[4];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = (wdata & 0xFF00) >> 8;
-	buf[3] = (wdata & 0x00FF);
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, wdata);
-	rc = imx072_i2c_txdata(imx072_client->addr>>1, buf, 4);
-	if (rc < 0) {
-		pr_err("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, wdata);
-	}
-	return rc;
-}
-
-static int32_t imx072_i2c_write_b_sensor(unsigned short waddr,
-	uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[3];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = imx072_i2c_txdata(imx072_client->addr>>1, buf, 3);
-	if (rc < 0)
-		pr_err("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, bdata);
-	return rc;
-}
-
-static int32_t imx072_i2c_write_b_af(uint8_t msb, uint8_t lsb)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[2];
-
-	buf[0] = msb;
-	buf[1] = lsb;
-	rc = imx072_i2c_txdata(IMX072_AF_I2C_ADDR>>1, buf, 2);
-	if (rc < 0)
-		pr_err("af_i2c_write faield msb = 0x%x lsb = 0x%x",
-			msb, lsb);
-	return rc;
-}
-
-static int32_t imx072_i2c_write_w_table(struct imx072_i2c_reg_conf const
-					 *reg_conf_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-	for (i = 0; i < num; i++) {
-		rc = imx072_i2c_write_b_sensor(reg_conf_tbl->waddr,
-			reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-	return rc;
-}
-
-static void imx072_group_hold_on(void)
-{
-	imx072_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-						GROUPED_PARAMETER_HOLD);
-}
-
-static void imx072_group_hold_off(void)
-{
-	imx072_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-						GROUPED_PARAMETER_HOLD_OFF);
-}
-
-static void imx072_start_stream(void)
-{
-	imx072_i2c_write_b_sensor(0x0100, 0x01);
-}
-
-static void imx072_stop_stream(void)
-{
-	imx072_i2c_write_b_sensor(0x0100, 0x00);
-}
-
-static void imx072_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint32_t divider, d1, d2;
-
-	d1 = prev_frame_length_lines * 0x00000400 / snap_frame_length_lines;
-	d2 = prev_line_length_pck * 0x00000400 / snap_line_length_pck;
-	divider = d1 * d2 / 0x400;
-
-	/*Verify PCLK settings and frame sizes.*/
-	*pfps = (uint16_t) (fps * divider / 0x400);
-}
-
-static uint16_t imx072_get_prev_lines_pf(void)
-{
-	return prev_frame_length_lines;
-}
-
-static uint16_t imx072_get_prev_pixels_pl(void)
-{
-	return prev_line_length_pck;
-}
-
-static uint16_t imx072_get_pict_lines_pf(void)
-{
-	return snap_frame_length_lines;
-}
-
-static uint16_t imx072_get_pict_pixels_pl(void)
-{
-	return snap_line_length_pck;
-}
-
-static uint32_t imx072_get_pict_max_exp_lc(void)
-{
-	return snap_frame_length_lines  * 24;
-}
-
-static int32_t imx072_set_fps(struct fps_cfg   *fps)
-{
-	uint16_t total_lines_per_frame;
-	int32_t rc = 0;
-	total_lines_per_frame = (uint16_t)
-		((prev_frame_length_lines *
-		imx072_ctrl->fps_divider)/0x400);
-	imx072_ctrl->fps_divider = fps->fps_div;
-	imx072_ctrl->pict_fps_divider = fps->pict_fps_div;
-
-	imx072_group_hold_on();
-	rc = imx072_i2c_write_w_sensor(REG_FRAME_LENGTH_LINES,
-							total_lines_per_frame);
-	imx072_group_hold_off();
-	return rc;
-}
-
-static int32_t imx072_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	uint32_t fl_lines = 0;
-	uint8_t offset;
-	int32_t rc = 0;
-	if (imx072_ctrl->curr_res == imx072_ctrl->prev_res)
-		fl_lines = prev_frame_length_lines;
-	else if (imx072_ctrl->curr_res == imx072_ctrl->pict_res)
-		fl_lines = snap_frame_length_lines;
-	line = (line * imx072_ctrl->fps_divider) / Q10;
-	offset = IMX072_OFFSET;
-	if (line > (fl_lines - offset))
-		fl_lines = line + offset;
-
-	imx072_group_hold_on();
-	rc = imx072_i2c_write_w_sensor(REG_FRAME_LENGTH_LINES, fl_lines);
-	rc = imx072_i2c_write_w_sensor(REG_COARSE_INTEGRATION_TIME, line);
-	rc = imx072_i2c_write_w_sensor(REG_GLOBAL_GAIN, gain);
-	imx072_group_hold_off();
-	return rc;
-}
-
-static int32_t imx072_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-	rc = imx072_write_exp_gain(gain, line);
-	return rc;
-}
-
-static int32_t imx072_sensor_setting(int update_type, int rt)
-{
-
-	int32_t rc = 0;
-	struct msm_camera_csi_params imx072_csi_params;
-
-	imx072_stop_stream();
-	msleep(30);
-	if (update_type == REG_INIT) {
-		msleep(20);
-		CSI_CONFIG = 0;
-		imx072_i2c_write_w_table(imx072_regs.rec_settings,
-			imx072_regs.rec_size);
-	} else if (update_type == UPDATE_PERIODIC) {
-#ifdef CONFIG_DEBUG_FS
-		cam_debug_init();
-#endif
-		msleep(20);
-		if (!CSI_CONFIG) {
-			imx072_csi_params.lane_cnt = 2;
-			imx072_csi_params.data_format = CSI_10BIT;
-			imx072_csi_params.lane_assign = 0xe4;
-			imx072_csi_params.dpcm_scheme = 0;
-			imx072_csi_params.settle_cnt = 0x18;
-			msm_camio_vfe_clk_rate_set(192000000);
-			rc = msm_camio_csi_config(&imx072_csi_params);
-			msleep(100);
-			CSI_CONFIG = 1;
-		}
-		imx072_i2c_write_w_table(
-			imx072_regs.conf_array[rt].conf,
-			imx072_regs.conf_array[rt].size);
-		imx072_start_stream();
-		msleep(30);
-	}
-	return rc;
-}
-
-static int32_t imx072_video_config(int mode)
-{
-
-	int32_t rc = 0;
-	/* change sensor resolution if needed */
-	if (imx072_sensor_setting(UPDATE_PERIODIC,
-		imx072_ctrl->prev_res) < 0)
-		return rc;
-
-	imx072_ctrl->curr_res = imx072_ctrl->prev_res;
-	imx072_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t imx072_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	/*change sensor resolution if needed */
-	if (imx072_ctrl->curr_res != imx072_ctrl->pict_res) {
-		if (imx072_sensor_setting(UPDATE_PERIODIC,
-					imx072_ctrl->pict_res) < 0)
-			return rc;
-	}
-
-	imx072_ctrl->curr_res = imx072_ctrl->pict_res;
-	imx072_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t imx072_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	/* change sensor resolution if needed */
-	if (imx072_ctrl->curr_res != imx072_ctrl->pict_res) {
-		if (imx072_sensor_setting(UPDATE_PERIODIC,
-					imx072_ctrl->pict_res) < 0)
-			return rc;
-	}
-
-	imx072_ctrl->curr_res = imx072_ctrl->pict_res;
-	imx072_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t imx072_mode_init(int mode, struct sensor_init_cfg init_info)
-{
-	int32_t rc = 0;
-	CDBG("%s: %d\n", __func__, __LINE__);
-	if (mode != imx072_ctrl->cam_mode) {
-		imx072_ctrl->prev_res = init_info.prev_res;
-		imx072_ctrl->pict_res = init_info.pict_res;
-		imx072_ctrl->cam_mode = mode;
-
-		prev_frame_length_lines =
-			imx072_regs.conf_array[imx072_ctrl->prev_res].
-			conf[IMX072_FRAME_LENGTH_LINES_HI].wdata << 8 |
-			imx072_regs.conf_array[imx072_ctrl->prev_res].
-			conf[IMX072_FRAME_LENGTH_LINES_LO].wdata;
-		prev_line_length_pck =
-			imx072_regs.conf_array[imx072_ctrl->prev_res].
-			conf[IMX072_LINE_LENGTH_PCK_HI].wdata << 8 |
-			imx072_regs.conf_array[imx072_ctrl->prev_res].
-			conf[IMX072_LINE_LENGTH_PCK_LO].wdata;
-		snap_frame_length_lines =
-			imx072_regs.conf_array[imx072_ctrl->pict_res].
-			conf[IMX072_FRAME_LENGTH_LINES_HI].wdata << 8 |
-			imx072_regs.conf_array[imx072_ctrl->pict_res].
-			conf[IMX072_FRAME_LENGTH_LINES_LO].wdata;
-		snap_line_length_pck =
-			imx072_regs.conf_array[imx072_ctrl->pict_res].
-			conf[IMX072_LINE_LENGTH_PCK_HI].wdata << 8 |
-			imx072_regs.conf_array[imx072_ctrl->pict_res].
-			conf[IMX072_LINE_LENGTH_PCK_LO].wdata;
-
-		rc = imx072_sensor_setting(REG_INIT,
-			imx072_ctrl->prev_res);
-	}
-	return rc;
-}
-
-static int32_t imx072_set_sensor_mode(int mode,
-	int res)
-{
-	int32_t rc = 0;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		imx072_ctrl->prev_res = res;
-		rc = imx072_video_config(mode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-		imx072_ctrl->pict_res = res;
-		rc = imx072_snapshot_config(mode);
-		break;
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		imx072_ctrl->pict_res = res;
-		rc = imx072_raw_snapshot_config(mode);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-#define DIV_CEIL(x, y) ((x/y + ((x%y) ? 1 : 0)))
-static int32_t imx072_move_focus(int direction,
-	int32_t num_steps)
-{
-	int32_t rc = 0;
-	int16_t step_direction, dest_lens_position, dest_step_position;
-	uint8_t code_val_msb, code_val_lsb;
-	int16_t next_lens_position, target_dist, small_step;
-
-	if (direction == MOVE_NEAR)
-		step_direction = 1;
-	else if (direction == MOVE_FAR)
-		step_direction = -1;
-	else {
-		pr_err("Illegal focus direction\n");
-		return -EINVAL;
-	}
-	dest_step_position = imx072_ctrl->curr_step_pos +
-			(step_direction * num_steps);
-
-	if (dest_step_position < 0)
-		dest_step_position = 0;
-	else if (dest_step_position > IMX072_TOTAL_STEPS_NEAR_TO_FAR)
-		dest_step_position = IMX072_TOTAL_STEPS_NEAR_TO_FAR;
-
-	if (dest_step_position == imx072_ctrl->curr_step_pos) {
-		CDBG("imx072 same position No-Move exit\n");
-		return rc;
-	}
-	CDBG("%s Index = [%d]\n", __func__, dest_step_position);
-
-	dest_lens_position = imx072_step_position_table[dest_step_position];
-	CDBG("%s lens_position value = %d\n", __func__, dest_lens_position);
-	target_dist = step_direction * (dest_lens_position -
-		imx072_ctrl->curr_lens_pos);
-	if (step_direction < 0 && (target_dist >=
-		(imx072_step_position_table[imx072_damping_threshold]
-			- imx072_af_initial_code))) {
-		small_step = DIV_CEIL(target_dist, 10);
-		imx072_sw_damping_time_wait = 30;
-	} else {
-		small_step = DIV_CEIL(target_dist, 4);
-		imx072_sw_damping_time_wait = 20;
-	}
-
-	CDBG("%s: small_step:%d, wait_time:%d\n", __func__, small_step,
-		imx072_sw_damping_time_wait);
-	for (next_lens_position = imx072_ctrl->curr_lens_pos +
-		(step_direction * small_step);
-		(step_direction * next_lens_position) <=
-		(step_direction * dest_lens_position);
-		next_lens_position += (step_direction * small_step)) {
-
-		code_val_msb = ((next_lens_position & 0x03F0) >> 4);
-		code_val_lsb = ((next_lens_position & 0x000F) << 4);
-		CDBG("position value = %d\n", next_lens_position);
-		CDBG("movefocus vcm_msb = %d\n", code_val_msb);
-		CDBG("movefocus vcm_lsb = %d\n", code_val_lsb);
-		rc = imx072_i2c_write_b_af(code_val_msb, code_val_lsb);
-		if (rc < 0) {
-			pr_err("imx072_move_focus failed writing i2c\n");
-			return rc;
-			}
-		imx072_ctrl->curr_lens_pos = next_lens_position;
-		usleep(imx072_sw_damping_time_wait*100);
-	}
-	if (imx072_ctrl->curr_lens_pos != dest_lens_position) {
-		code_val_msb = ((dest_lens_position & 0x03F0) >> 4);
-		code_val_lsb = ((dest_lens_position & 0x000F) << 4);
-		CDBG("position value = %d\n", dest_lens_position);
-		CDBG("movefocus vcm_msb = %d\n", code_val_msb);
-		CDBG("movefocus vcm_lsb = %d\n", code_val_lsb);
-		rc = imx072_i2c_write_b_af(code_val_msb, code_val_lsb);
-		if (rc < 0) {
-			pr_err("imx072_move_focus failed writing i2c\n");
-			return rc;
-			}
-		usleep(imx072_sw_damping_time_wait * 100);
-	}
-	imx072_ctrl->curr_lens_pos = dest_lens_position;
-	imx072_ctrl->curr_step_pos = dest_step_position;
-	return rc;
-
-}
-
-static int32_t imx072_init_focus(void)
-{
-	uint8_t i;
-	int32_t rc = 0;
-
-	imx072_step_position_table[0] = imx072_af_initial_code;
-	for (i = 1; i <= IMX072_TOTAL_STEPS_NEAR_TO_FAR; i++) {
-		if (i <= imx072_nl_region_boundary1)
-			imx072_step_position_table[i] =
-				imx072_step_position_table[i-1]
-				+ imx072_nl_region_code_per_step1;
-		else
-			imx072_step_position_table[i] =
-				imx072_step_position_table[i-1]
-				+ imx072_l_region_code_per_step;
-
-		if (imx072_step_position_table[i] > 1023)
-			imx072_step_position_table[i] = 1023;
-	}
-	imx072_ctrl->curr_lens_pos = 0;
-
-	return rc;
-}
-
-static int32_t imx072_set_default_focus(void)
-{
-	int32_t rc = 0;
-	uint8_t code_val_msb, code_val_lsb;
-	int16_t dest_lens_position = 0;
-
-	CDBG("%s Index = [%d]\n", __func__, 0);
-	if (imx072_ctrl->curr_step_pos != 0)
-		rc = imx072_move_focus(MOVE_FAR,
-		imx072_ctrl->curr_step_pos);
-	else {
-		dest_lens_position = imx072_af_initial_code;
-		code_val_msb = ((dest_lens_position & 0x03F0) >> 4);
-		code_val_lsb = ((dest_lens_position & 0x000F) << 4);
-
-		CDBG("position value = %d\n", dest_lens_position);
-		CDBG("movefocus vcm_msb = %d\n", code_val_msb);
-		CDBG("movefocus vcm_lsb = %d\n", code_val_lsb);
-		rc = imx072_i2c_write_b_af(code_val_msb, code_val_lsb);
-		if (rc < 0) {
-			pr_err("imx072_set_default_focus failed writing i2c\n");
-			return rc;
-		}
-
-		imx072_ctrl->curr_lens_pos = dest_lens_position;
-		imx072_ctrl->curr_step_pos = 0;
-
-	}
-	usleep(5000);
-	return rc;
-}
-
-static int32_t imx072_af_power_down(void)
-{
-	int32_t rc = 0;
-	int32_t i = 0;
-	int16_t dest_lens_position = imx072_af_initial_code;
-
-	if (imx072_ctrl->curr_lens_pos != 0) {
-		rc = imx072_set_default_focus();
-		CDBG("%s after imx072_set_default_focus\n", __func__);
-		msleep(40);
-		/*to avoid the sound during the power off.
-		brings the actuator to mechanical infinity gradually.*/
-		for (i = 0; i < IMX072_TOTAL_STEPS_NEAR_TO_FAR; i++) {
-			dest_lens_position = dest_lens_position -
-				(imx072_af_initial_code /
-					IMX072_TOTAL_STEPS_NEAR_TO_FAR);
-			CDBG("position value = %d\n", dest_lens_position);
-			rc = imx072_i2c_write_b_af(
-				((dest_lens_position & 0x03F0) >> 4),
-				((dest_lens_position & 0x000F) << 4));
-			CDBG("count = %d\n", i);
-			msleep(20);
-			if (rc < 0) {
-				pr_err("imx072_set_default_focus failed writing i2c\n");
-				return rc;
-			}
-		}
-		rc = imx072_i2c_write_b_af(0x00, 00);
-		msleep(40);
-	}
-	rc = imx072_i2c_write_b_af(0x80, 00);
-	return rc;
-}
-
-static int32_t imx072_power_down(void)
-{
-	int32_t rc = 0;
-
-	rc = imx072_af_power_down();
-	return rc;
-}
-
-static int imx072_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	pr_err("probe done\n");
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int imx072_probe_init_sensor(
-	const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	uint16_t chipid = 0;
-
-	CDBG("%s: %d\n", __func__, __LINE__);
-	rc = gpio_request(data->sensor_reset, "imx072");
-	CDBG(" imx072_probe_init_sensor\n");
-	if (!rc) {
-		pr_err("sensor_reset = %d\n", rc);
-		gpio_direction_output(data->sensor_reset, 0);
-		msleep(50);
-		gpio_set_value_cansleep(data->sensor_reset, 1);
-		msleep(20);
-	} else
-		goto gpio_req_fail;
-
-	CDBG(" imx072_probe_init_sensor is called\n");
-	rc = imx072_i2c_read(0x0, &chipid, 2);
-	CDBG("ID: %d\n", chipid);
-	/* 4. Compare sensor ID to IMX072 ID: */
-	if (chipid != 0x0045) {
-		rc = -ENODEV;
-		pr_err("imx072_probe_init_sensor chip id doesnot match\n");
-		goto init_probe_fail;
-	}
-
-	return rc;
-init_probe_fail:
-	pr_err(" imx072_probe_init_sensor fails\n");
-	gpio_set_value_cansleep(data->sensor_reset, 0);
-	imx072_probe_init_done(data);
-	if (data->vcm_enable) {
-		int ret = gpio_request(data->vcm_pwd, "imx072_af");
-		if (!ret) {
-			gpio_direction_output(data->vcm_pwd, 0);
-			msleep(20);
-			gpio_free(data->vcm_pwd);
-		}
-	}
-gpio_req_fail:
-	return rc;
-}
-
-int imx072_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-
-	CDBG("%s: %d\n", __func__, __LINE__);
-	imx072_ctrl = kzalloc(sizeof(struct imx072_ctrl_t), GFP_KERNEL);
-	if (!imx072_ctrl) {
-		pr_err("imx072_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	imx072_ctrl->fps_divider = 1 * 0x00000400;
-	imx072_ctrl->pict_fps_divider = 1 * 0x00000400;
-	imx072_ctrl->set_test = TEST_OFF;
-	imx072_ctrl->cam_mode = MODE_INVALID;
-
-	if (data)
-		imx072_ctrl->sensordata = data;
-	if (rc < 0) {
-		pr_err("Calling imx072_sensor_open_init fail1\n");
-		return rc;
-	}
-	CDBG("%s: %d\n", __func__, __LINE__);
-	/* enable mclk first */
-	msm_camio_clk_rate_set(IMX072_MASTER_CLK_RATE);
-	rc = imx072_probe_init_sensor(data);
-	if (rc < 0)
-		goto init_fail;
-
-	imx072_init_focus();
-	imx072_ctrl->fps = 30*Q8;
-	if (rc < 0) {
-		gpio_set_value_cansleep(data->sensor_reset, 0);
-		goto init_fail;
-	} else
-		goto init_done;
-init_fail:
-	pr_err("init_fail\n");
-	imx072_probe_init_done(data);
-init_done:
-	pr_err("init_done\n");
-	return rc;
-}
-
-static int imx072_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&imx072_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id imx072_i2c_id[] = {
-	{"imx072", 0},
-	{ }
-};
-
-static int imx072_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("imx072_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		pr_err("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	imx072_sensorw = kzalloc(sizeof(struct imx072_work_t),
-			GFP_KERNEL);
-	if (!imx072_sensorw) {
-		pr_err("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, imx072_sensorw);
-	imx072_init_client(client);
-	imx072_client = client;
-
-	msleep(50);
-
-	CDBG("imx072_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	pr_err("imx072_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int imx072_send_wb_info(struct wb_info_cfg *wb)
-{
-	return 0;
-
-}
-
-static int __exit imx072_remove(struct i2c_client *client)
-{
-	struct imx072_work_t_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	imx072_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static struct i2c_driver imx072_i2c_driver = {
-	.id_table = imx072_i2c_id,
-	.probe  = imx072_i2c_probe,
-	.remove = __exit_p(imx072_i2c_remove),
-	.driver = {
-		.name = "imx072",
-	},
-};
-
-int imx072_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-	if (copy_from_user(&cdata,
-		(void *)argp,
-		sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(&imx072_mut);
-	CDBG("imx072_sensor_config: cfgtype = %d\n",
-		 cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		imx072_get_pict_fps(
-			cdata.cfg.gfps.prevfps,
-			&(cdata.cfg.gfps.pictfps));
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf =
-		imx072_get_prev_lines_pf();
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl =
-			imx072_get_prev_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf =
-			imx072_get_pict_lines_pf();
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl =
-			imx072_get_pict_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc =
-			imx072_get_pict_max_exp_lc();
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = imx072_set_fps(&(cdata.cfg.fps));
-		break;
-	case CFG_SET_EXP_GAIN:
-		rc = imx072_write_exp_gain(
-			cdata.cfg.exp_gain.gain,
-			cdata.cfg.exp_gain.line);
-		break;
-	case CFG_SET_PICT_EXP_GAIN:
-		rc = imx072_set_pict_exp_gain(
-			cdata.cfg.exp_gain.gain,
-			cdata.cfg.exp_gain.line);
-		break;
-	case CFG_SET_MODE:
-		rc = imx072_set_sensor_mode(cdata.mode, cdata.rs);
-		break;
-	case CFG_PWR_DOWN:
-		rc = imx072_power_down();
-		break;
-	case CFG_MOVE_FOCUS:
-		rc = imx072_move_focus(cdata.cfg.focus.dir,
-				cdata.cfg.focus.steps);
-		break;
-	case CFG_SET_DEFAULT_FOCUS:
-		imx072_set_default_focus();
-		break;
-	case CFG_GET_AF_MAX_STEPS:
-		cdata.max_steps = IMX072_TOTAL_STEPS_NEAR_TO_FAR;
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_SET_EFFECT:
-		break;
-	case CFG_SEND_WB_INFO:
-		rc = imx072_send_wb_info(
-			&(cdata.cfg.wb_info));
-	break;
-	case CFG_SENSOR_INIT:
-		rc = imx072_mode_init(cdata.mode,
-				cdata.cfg.init_info);
-	break;
-	case CFG_SET_LENS_SHADING:
-		break;
-	default:
-		rc = -EFAULT;
-		break;
-	}
-
-	mutex_unlock(&imx072_mut);
-
-	return rc;
-}
-
-static int imx072_sensor_release(void)
-{
-	int rc = -EBADF;
-	mutex_lock(&imx072_mut);
-	imx072_power_down();
-	gpio_set_value_cansleep(imx072_ctrl->sensordata->sensor_reset, 0);
-	msleep(20);
-	gpio_free(imx072_ctrl->sensordata->sensor_reset);
-	if (imx072_ctrl->sensordata->vcm_enable) {
-		gpio_set_value_cansleep(imx072_ctrl->sensordata->vcm_pwd, 0);
-		gpio_free(imx072_ctrl->sensordata->vcm_pwd);
-	}
-	kfree(imx072_ctrl);
-	imx072_ctrl = NULL;
-	pr_err("imx072_release completed\n");
-	mutex_unlock(&imx072_mut);
-
-	return rc;
-}
-
-static int imx072_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-	rc = i2c_add_driver(&imx072_i2c_driver);
-	if (rc < 0 || imx072_client == NULL) {
-		rc = -ENOTSUPP;
-		pr_err("I2C add driver failed");
-		goto probe_fail;
-	}
-	msm_camio_clk_rate_set(IMX072_MASTER_CLK_RATE);
-	rc = imx072_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-	s->s_init = imx072_sensor_open_init;
-	s->s_release = imx072_sensor_release;
-	s->s_config  = imx072_sensor_config;
-	s->s_mount_angle = info->sensor_platform_info->mount_angle;
-
-	gpio_set_value_cansleep(info->sensor_reset, 0);
-	imx072_probe_init_done(info);
-	if (info->vcm_enable) {
-		rc = gpio_request(info->vcm_pwd, "imx072_af");
-		if (!rc) {
-			gpio_direction_output(info->vcm_pwd, 0);
-			msleep(20);
-			gpio_free(info->vcm_pwd);
-		} else
-			return rc;
-	}
-	pr_info("imx072_sensor_probe : SUCCESS\n");
-	return rc;
-
-probe_fail:
-	pr_err("imx072_sensor_probe: SENSOR PROBE FAILS!\n");
-	return rc;
-}
-
-static int __imx072_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, imx072_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __imx072_probe,
-	.driver = {
-		.name = "msm_camera_imx072",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init imx072_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(imx072_init);
-void imx072_exit(void)
-{
-	i2c_del_driver(&imx072_i2c_driver);
-}
-MODULE_DESCRIPTION("Aptina 8 MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
-
-#ifdef CONFIG_DEBUG_FS
-static bool streaming = 1;
-
-static int cam_debug_stream_set(void *data, u64 val)
-{
-	int rc = 0;
-
-	if (val) {
-		imx072_start_stream();
-		streaming = 1;
-	} else {
-		imx072_stop_stream();
-		streaming = 0;
-	}
-
-	return rc;
-}
-
-static int cam_debug_stream_get(void *data, u64 *val)
-{
-	*val = streaming;
-	return 0;
-}
-DEFINE_SIMPLE_ATTRIBUTE(cam_stream, cam_debug_stream_get,
-			cam_debug_stream_set, "%llu\n");
-
-
-
-static int imx072_set_af_codestep(void *data, u64 val)
-{
-	imx072_l_region_code_per_step = val;
-	imx072_init_focus();
-	return 0;
-}
-
-static int imx072_get_af_codestep(void *data, u64 *val)
-{
-	*val = imx072_l_region_code_per_step;
-	return 0;
-}
-
-static uint16_t imx072_linear_total_step = IMX072_TOTAL_STEPS_NEAR_TO_FAR;
-static int imx072_set_linear_total_step(void *data, u64 val)
-{
-	imx072_linear_total_step = val;
-	return 0;
-}
-
-static int imx072_af_linearity_test(void *data, u64 *val)
-{
-	int i = 0;
-
-	imx072_set_default_focus();
-	msleep(3000);
-	for (i = 0; i < imx072_linear_total_step; i++) {
-		imx072_move_focus(MOVE_NEAR, 1);
-		CDBG("moved to index =[%d]\n", i);
-		msleep(1000);
-	}
-
-	for (i = 0; i < imx072_linear_total_step; i++) {
-		imx072_move_focus(MOVE_FAR, 1);
-		CDBG("moved to index =[%d]\n", i);
-		msleep(1000);
-	}
-	return 0;
-}
-
-static uint16_t imx072_step_val = IMX072_TOTAL_STEPS_NEAR_TO_FAR;
-static uint8_t imx072_step_dir = MOVE_NEAR;
-static int imx072_af_step_config(void *data, u64 val)
-{
-	imx072_step_val = val & 0xFFFF;
-	imx072_step_dir = (val >> 16) & 0x1;
-	return 0;
-}
-
-static int imx072_af_step(void *data, u64 *val)
-{
-	int i = 0;
-	int dir = MOVE_NEAR;
-	imx072_set_default_focus();
-	msleep(3000);
-	if (imx072_step_dir == 1)
-		dir = MOVE_FAR;
-
-	for (i = 0; i < imx072_step_val; i += 4) {
-		imx072_move_focus(dir, 4);
-		msleep(1000);
-	}
-	imx072_set_default_focus();
-	msleep(3000);
-	return 0;
-}
-
-static int imx072_af_set_resolution(void *data, u64 val)
-{
-	imx072_init_focus();
-	return 0;
-}
-
-static int imx072_af_get_resolution(void *data, u64 *val)
-{
-	*val = 0xFF;
-	return 0;
-}
-
-
-
-DEFINE_SIMPLE_ATTRIBUTE(af_codeperstep, imx072_get_af_codestep,
-			imx072_set_af_codestep, "%llu\n");
-
-DEFINE_SIMPLE_ATTRIBUTE(af_linear, imx072_af_linearity_test,
-			imx072_set_linear_total_step, "%llu\n");
-
-DEFINE_SIMPLE_ATTRIBUTE(af_step, imx072_af_step,
-			imx072_af_step_config, "%llu\n");
-
-DEFINE_SIMPLE_ATTRIBUTE(af_step_res, imx072_af_get_resolution,
-			imx072_af_set_resolution, "%llu\n");
-
-static int cam_debug_init(void)
-{
-	struct dentry *cam_dir;
-	debugfs_base = debugfs_create_dir("sensor", NULL);
-	if (!debugfs_base)
-		return -ENOMEM;
-
-	cam_dir = debugfs_create_dir("imx072", debugfs_base);
-	if (!cam_dir)
-		return -ENOMEM;
-
-	if (!debugfs_create_file("stream", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &cam_stream))
-		return -ENOMEM;
-
-	if (!debugfs_create_file("af_codeperstep", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &af_codeperstep))
-		return -ENOMEM;
-	if (!debugfs_create_file("af_linear", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &af_linear))
-		return -ENOMEM;
-	if (!debugfs_create_file("af_step", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &af_step))
-		return -ENOMEM;
-
-	if (!debugfs_create_file("af_step_res", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &af_step_res))
-		return -ENOMEM;
-
-	return 0;
-}
-#endif
diff --git a/drivers/media/video/msm/imx072.h b/drivers/media/video/msm/imx072.h
deleted file mode 100644
index 95f688c..0000000
--- a/drivers/media/video/msm/imx072.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef IMX072_H
-#define IMX072_H
-#include <linux/types.h>
-#include <mach/board.h>
-extern struct imx072_reg imx072_regs;
-
-struct imx072_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-struct imx072_i2c_conf_array {
-	struct imx072_i2c_reg_conf *conf;
-	unsigned short size;
-};
-
-enum imx072_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum imx072_resolution_t {
-	QTR_2D_SIZE,
-	FULL_2D_SIZE,
-	QTR_3D_SIZE,
-	FULL_3D_SIZE,
-	INVALID_SIZE
-};
-enum imx072_setting {
-	RES_PREVIEW,
-	RES_CAPTURE,
-	RES_3D_PREVIEW,
-	RES_3D_CAPTURE
-};
-enum imx072_cam_mode_t {
-	MODE_2D_RIGHT,
-	MODE_2D_LEFT,
-	MODE_3D,
-	MODE_INVALID
-};
-enum imx072_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-enum imx072_reg_mode {
-	IMX072_FRAME_LENGTH_LINES_HI = 0,
-	IMX072_FRAME_LENGTH_LINES_LO,
-	IMX072_LINE_LENGTH_PCK_HI,
-	IMX072_LINE_LENGTH_PCK_LO,
-};
-
-struct imx072_reg {
-	const struct imx072_i2c_reg_conf *rec_settings;
-	const unsigned short rec_size;
-	const struct imx072_i2c_conf_array *conf_array;
-};
-#endif /* IMX072_H */
diff --git a/drivers/media/video/msm/imx072_reg.c b/drivers/media/video/msm/imx072_reg.c
deleted file mode 100644
index fc07e0f..0000000
--- a/drivers/media/video/msm/imx072_reg.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "imx072.h"
-
-struct imx072_i2c_reg_conf imx072_prev_settings[] = {
-	{0x0340, 0x03},/*frame_length*/
-	{0x0341, 0xF7},/*frame_length*/
-	{0x0342, 0x0A},/*line_length*/
-	{0x0343, 0xE0},/*line_length*/
-	{0x0344, 0x00},/*x_addr_start*/
-	{0x0345, 0x00},/*x_addr_start*/
-	{0x0346, 0x00},/*y_addr_start*/
-	{0x0347, 0x00},/*y_addr_start*/
-	{0x0348, 0x0A},/*x_addr_end*/
-	{0x0349, 0x2F},/*x_addr_end*/
-	{0x034A, 0x07},/*y_addr_end*/
-	{0x034B, 0xA7},/*y_addr_end*/
-	{0x034C, 0x05},/*x_out_size*/
-	{0x034D, 0x18},/*x_out_size*/
-	{0x034E, 0x03},/*y_out_size*/
-	{0x034F, 0xD4},/*y_out_size*/
-	{0x0381, 0x01},/*x_even_inc*/
-	{0x0383, 0x03},/*x_odd_inc*/
-	{0x0385, 0x01},/*y_even_inc*/
-	{0x0387, 0x03},/*y_odd_inc*/
-	{0x3016, 0x06},/*VMODEADD*/
-	{0x3017, 0x40},
-	{0x3069, 0x24},
-	{0x306A, 0x00},
-	{0x306B, 0xCB},
-	{0x306C, 0x07},
-	{0x30E8, 0x86},
-	{0x3304, 0x03},
-	{0x3305, 0x02},
-	{0x3306, 0x0A},
-	{0x3307, 0x02},
-	{0x3308, 0x11},
-	{0x3309, 0x04},
-	{0x330A, 0x05},
-	{0x330B, 0x04},
-	{0x330C, 0x05},
-	{0x330D, 0x04},
-	{0x330E, 0x01},
-	{0x3301, 0x80},
-};
-
-struct imx072_i2c_reg_conf imx072_snap_settings[] = {
-	{0x0340, 0x07},/*frame_length*/
-	{0x0341, 0xEE},/*frame_length*/
-	{0x0342, 0x0A},/*line_length*/
-	{0x0343, 0xE0},/*line_length*/
-	{0x0344, 0x00},/*x_addr_start*/
-	{0x0345, 0x00},/*x_addr_start*/
-	{0x0346, 0x00},/*y_addr_start*/
-	{0x0347, 0x00},/*y_addr_start*/
-	{0x0348, 0x0A},/*x_addr_end*/
-	{0x0349, 0x2F},/*x_addr_end*/
-	{0x034A, 0x07},/*y_addr_end*/
-	{0x034B, 0xA7},/*y_addr_end*/
-	{0x034C, 0x0A},/*x_out_size*/
-	{0x034D, 0x30},/*x_out_size*/
-	{0x034E, 0x07},/*y_out_size*/
-	{0x034F, 0xA8},/*y_out_size*/
-	{0x0381, 0x01},/*x_even_inc*/
-	{0x0383, 0x01},/*x_odd_inc*/
-	{0x0385, 0x01},/*y_even_inc*/
-	{0x0387, 0x01},/*y_odd_inc*/
-	{0x3016, 0x06},/*VMODEADD*/
-	{0x3017, 0x40},
-	{0x3069, 0x24},
-	{0x306A, 0x00},
-	{0x306B, 0xCB},
-	{0x306C, 0x07},
-	{0x30E8, 0x06},
-	{0x3304, 0x05},
-	{0x3305, 0x04},
-	{0x3306, 0x15},
-	{0x3307, 0x02},
-	{0x3308, 0x11},
-	{0x3309, 0x07},
-	{0x330A, 0x05},
-	{0x330B, 0x04},
-	{0x330C, 0x05},
-	{0x330D, 0x04},
-	{0x330E, 0x01},
-	{0x3301, 0x00},
-};
-
-struct imx072_i2c_reg_conf imx072_recommend_settings[] = {
-	{0x0307, 0x12},
-	{0x302B, 0x4B},
-	{0x0101, 0x03},
-	{0x300A, 0x80},
-	{0x3014, 0x08},
-	{0x3015, 0x37},
-	{0x3017, 0x40},
-	{0x301C, 0x01},
-	{0x3031, 0x28},
-	{0x3040, 0x00},
-	{0x3041, 0x60},
-	{0x3051, 0x24},
-	{0x3053, 0x34},
-	{0x3055, 0x3B},
-	{0x3057, 0xC0},
-	{0x3060, 0x30},
-	{0x3065, 0x00},
-	{0x30AA, 0x88},
-	{0x30AB, 0x1C},
-	{0x30B0, 0x32},
-	{0x30B2, 0x83},
-	{0x30D3, 0x04},
-	{0x310E, 0xDD},
-	{0x31A4, 0xD8},
-	{0x31A6, 0x17},
-	{0x31AC, 0xCF},
-	{0x31AE, 0xF1},
-	{0x31B4, 0xD8},
-	{0x31B6, 0x17},
-	{0x3304, 0x05},
-	{0x3305, 0x04},
-	{0x3306, 0x15},
-	{0x3307, 0x02},
-	{0x3308, 0x11},
-	{0x3309, 0x07},
-	{0x330A, 0x05},
-	{0x330B, 0x04},
-	{0x330C, 0x05},
-	{0x330D, 0x04},
-	{0x330E, 0x01},
-	{0x30d8, 0x20},
-};
-
-struct imx072_i2c_conf_array imx072_confs[] = {
-	{&imx072_prev_settings[0], ARRAY_SIZE(imx072_prev_settings)},
-	{&imx072_snap_settings[0], ARRAY_SIZE(imx072_snap_settings)},
-};
-
-struct imx072_reg imx072_regs = {
-	.rec_settings = &imx072_recommend_settings[0],
-	.rec_size = ARRAY_SIZE(imx072_recommend_settings),
-	.conf_array = &imx072_confs[0],
-};
diff --git a/drivers/media/video/msm/imx074.c b/drivers/media/video/msm/imx074.c
deleted file mode 100644
index 511c7db..0000000
--- a/drivers/media/video/msm/imx074.c
+++ /dev/null
@@ -1,1414 +0,0 @@
-/* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/slab.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include <asm/mach-types.h>
-#include "imx074.h"
-
-/*SENSOR REGISTER DEFINES*/
-#define	IMX074_EEPROM_SLAVE_ADDR			0x52
-#define REG_GROUPED_PARAMETER_HOLD			0x0104
-#define GROUPED_PARAMETER_HOLD_OFF			0x00
-#define GROUPED_PARAMETER_HOLD				0x01
-#define REG_MODE_SELECT					0x100
-#define MODE_SELECT_STANDBY_MODE			0x00
-#define MODE_SELECT_STREAM				0x01
-/* Integration Time */
-#define REG_COARSE_INTEGRATION_TIME_HI			0x0202
-#define REG_COARSE_INTEGRATION_TIME_LO			0x0203
-/* Gain */
-#define REG_ANALOGUE_GAIN_CODE_GLOBAL_HI		0x0204
-#define REG_ANALOGUE_GAIN_CODE_GLOBAL_LO		0x0205
-/* PLL registers */
-#define REG_PLL_MULTIPLIER				0x0307
-#define REG_PRE_PLL_CLK_DIV				0x0305
-#define REG_PLSTATIM					0x302b
-#define REG_3024					0x3024
-#define REG_IMAGE_ORIENTATION				0x0101
-#define REG_VNDMY_ABLMGSHLMT				0x300a
-#define REG_Y_OPBADDR_START_DI				0x3014
-#define REG_3015					0x3015
-#define REG_301C					0x301C
-#define REG_302C					0x302C
-#define REG_3031					0x3031
-#define REG_3041					0x3041
-#define REG_3051					0x3051
-#define REG_3053					0x3053
-#define REG_3057					0x3057
-#define REG_305C					0x305C
-#define REG_305D					0x305D
-#define REG_3060					0x3060
-#define REG_3065					0x3065
-#define REG_30AA					0x30AA
-#define REG_30AB					0x30AB
-#define REG_30B0					0x30B0
-#define REG_30B2					0x30B2
-#define REG_30D3					0x30D3
-#define REG_3106					0x3106
-#define REG_310C					0x310C
-#define REG_3304					0x3304
-#define REG_3305					0x3305
-#define REG_3306					0x3306
-#define REG_3307					0x3307
-#define REG_3308					0x3308
-#define REG_3309					0x3309
-#define REG_330A					0x330A
-#define REG_330B					0x330B
-#define REG_330C					0x330C
-#define REG_330D					0x330D
-#define REG_330F					0x330F
-#define REG_3381					0x3381
-
-/* mode setting */
-#define REG_FRAME_LENGTH_LINES_HI			0x0340
-#define REG_FRAME_LENGTH_LINES_LO			0x0341
-#define REG_YADDR_START					0x0347
-#define REG_YAAAR_END					0x034b
-#define REG_X_OUTPUT_SIZE_MSB				0x034c
-#define REG_X_OUTPUT_SIZE_LSB				0x034d
-#define REG_Y_OUTPUT_SIZE_MSB				0x034e
-#define REG_Y_OUTPUT_SIZE_LSB				0x034f
-#define REG_X_EVEN_INC					0x0381
-#define REG_X_ODD_INC					0x0383
-#define REG_Y_EVEN_INC					0x0385
-#define REG_Y_ODD_INC					0x0387
-#define REG_HMODEADD					0x3001
-#define REG_VMODEADD					0x3016
-#define REG_VAPPLINE_START				0x3069
-#define REG_VAPPLINE_END				0x306b
-#define REG_SHUTTER					0x3086
-#define REG_HADDAVE					0x30e8
-#define REG_LANESEL					0x3301
-/* Test Pattern */
-#define REG_TEST_PATTERN_MODE				0x0601
-
-#define REG_LINE_LENGTH_PCK_HI				0x0342
-#define REG_LINE_LENGTH_PCK_LO				0x0343
-/*..... TYPE DECLARATIONS.....*/
-#define	IMX074_OFFSET					3
-#define	IMX074_DEFAULT_MASTER_CLK_RATE			24000000
-/* Full	Size */
-#define	IMX074_FULL_SIZE_WIDTH				4208
-#define	IMX074_FULL_SIZE_HEIGHT				3120
-#define	IMX074_FULL_SIZE_DUMMY_PIXELS			0
-#define	IMX074_FULL_SIZE_DUMMY_LINES			0
-/* Quarter Size	*/
-#define	IMX074_QTR_SIZE_WIDTH				2104
-#define	IMX074_QTR_SIZE_HEIGHT				1560
-#define	IMX074_QTR_SIZE_DUMMY_PIXELS			0
-#define	IMX074_QTR_SIZE_DUMMY_LINES			0
-/* Blanking as measured	on the scope */
-/* Full	Size */
-#define	IMX074_HRZ_FULL_BLK_PIXELS			264
-#define	IMX074_VER_FULL_BLK_LINES			96
-/* Quarter Size	*/
-#define	IMX074_HRZ_QTR_BLK_PIXELS			2368
-#define	IMX074_VER_QTR_BLK_LINES			21
-#define	Q8						0x100
-#define	Q10						0x400
-#define	IMX074_AF_I2C_SLAVE_ID				0x72
-#define	IMX074_STEPS_NEAR_TO_CLOSEST_INF		52
-#define	IMX074_TOTAL_STEPS_NEAR_TO_FAR			52
-static uint32_t imx074_l_region_code_per_step = 2;
-
-struct imx074_work_t {
-	struct work_struct work;
-};
-
-static struct imx074_work_t *imx074_sensorw;
-static struct i2c_client *imx074_client;
-
-struct imx074_ctrl_t {
-	const struct msm_camera_sensor_info *sensordata;
-	uint32_t sensormode;
-	uint32_t fps_divider;/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;/* init to 1 * 0x00000400 */
-	uint16_t fps;
-	int16_t curr_lens_pos;
-	uint16_t curr_step_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint16_t total_lines_per_frame;
-	enum imx074_resolution_t prev_res;
-	enum imx074_resolution_t pict_res;
-	enum imx074_resolution_t curr_res;
-	enum imx074_test_mode_t set_test;
-	unsigned short imgaddr;
-};
-static uint8_t imx074_delay_msecs_stdby = 5;
-static uint16_t imx074_delay_msecs_stream = 5;
-static int32_t config_csi;
-
-static struct imx074_ctrl_t *imx074_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(imx074_wait_queue);
-DEFINE_MUTEX(imx074_mut);
-
-/*=============================================================*/
-
-static int imx074_i2c_rxdata(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-	};
-	if (i2c_transfer(imx074_client->adapter, msgs, 2) < 0) {
-		CDBG("imx074_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-	return 0;
-}
-static int32_t imx074_i2c_txdata(unsigned short saddr,
-				unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		 },
-	};
-	if (i2c_transfer(imx074_client->adapter, msg, 1) < 0) {
-		CDBG("imx074_i2c_txdata faild 0x%x\n", imx074_client->addr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-
-static int32_t imx074_i2c_read(unsigned short raddr,
-	unsigned short *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-	if (!rdata)
-		return -EIO;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-	rc = imx074_i2c_rxdata(imx074_client->addr, buf, rlen);
-	if (rc < 0) {
-		CDBG("imx074_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-	return rc;
-}
-
-static int imx074_af_i2c_rxdata_b(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-		.addr  = saddr,
-		.flags = 0,
-		.len   = 1,
-		.buf   = rxdata,
-		},
-		{
-		.addr  = saddr,
-		.flags = I2C_M_RD,
-		.len   = 1,
-		.buf   = rxdata,
-		},
-	};
-
-	if (i2c_transfer(imx074_client->adapter, msgs, 2) < 0) {
-		CDBG("imx074_i2c_rxdata_b failed!\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t imx074_i2c_read_w_eeprom(unsigned short raddr,
-	unsigned short *rdata)
-{
-	int32_t rc;
-	unsigned char buf;
-	if (!rdata)
-		return -EIO;
-	/* Read 2 bytes in sequence */
-	buf = (raddr & 0x00FF);
-	rc = imx074_af_i2c_rxdata_b(IMX074_EEPROM_SLAVE_ADDR, &buf, 1);
-	if (rc < 0) {
-		CDBG("imx074_i2c_read_eeprom 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = buf<<8;
-
-	/* Read Second byte of data */
-	buf = (raddr & 0x00FF) + 1;
-	rc = imx074_af_i2c_rxdata_b(IMX074_EEPROM_SLAVE_ADDR, &buf, 1);
-	if (rc < 0) {
-		CDBG("imx074_i2c_read_eeprom 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata |= buf;
-	return rc;
-}
-
-static int32_t imx074_i2c_write_b_sensor(unsigned short waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[3];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = imx074_i2c_txdata(imx074_client->addr, buf, 3);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, bdata);
-	}
-	return rc;
-}
-static int16_t imx074_i2c_write_b_af(unsigned short saddr,
-	unsigned short baddr, unsigned short bdata)
-{
-	int32_t rc;
-	unsigned char buf[2];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = baddr;
-	buf[1] = bdata;
-	rc = imx074_i2c_txdata(saddr, buf, 2);
-	if (rc < 0)
-		CDBG("AFi2c_write failed, saddr = 0x%x addr = 0x%x, val =0x%x!",
-			saddr, baddr, bdata);
-	return rc;
-}
-
-static int32_t imx074_i2c_write_w_table(struct imx074_i2c_reg_conf const
-					 *reg_conf_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-	for (i = 0; i < num; i++) {
-		rc = imx074_i2c_write_b_sensor(reg_conf_tbl->waddr,
-			reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-	return rc;
-}
-static int16_t imx074_af_init(void)
-{
-	int32_t rc;
-	/* Initialize waveform */
-	rc = imx074_i2c_write_b_af(IMX074_AF_I2C_SLAVE_ID, 0x01, 0xA9);
-	rc = imx074_i2c_write_b_af(IMX074_AF_I2C_SLAVE_ID, 0x02, 0xD2);
-	rc = imx074_i2c_write_b_af(IMX074_AF_I2C_SLAVE_ID, 0x03, 0x0C);
-	rc = imx074_i2c_write_b_af(IMX074_AF_I2C_SLAVE_ID, 0x04, 0x14);
-	rc = imx074_i2c_write_b_af(IMX074_AF_I2C_SLAVE_ID, 0x05, 0xB6);
-	rc = imx074_i2c_write_b_af(IMX074_AF_I2C_SLAVE_ID, 0x06, 0x4F);
-	return rc;
-}
-
-static void imx074_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint16_t preview_frame_length_lines, snapshot_frame_length_lines;
-	uint32_t divider, d1;
-	uint32_t pclk_mult;/*Q10 */
-	/* Total frame_length_lines and line_length_pck for preview */
-	preview_frame_length_lines = IMX074_QTR_SIZE_HEIGHT +
-		IMX074_VER_QTR_BLK_LINES;
-	/* Total frame_length_lines and line_length_pck for snapshot */
-	snapshot_frame_length_lines = IMX074_FULL_SIZE_HEIGHT +
-		IMX074_VER_FULL_BLK_LINES;
-	d1 = preview_frame_length_lines * 0x00010000 /
-		snapshot_frame_length_lines;
-	pclk_mult =
-		(uint32_t) ((imx074_regs.reg_pat[RES_CAPTURE].pll_multiplier *
-		0x00010000) /
-		(imx074_regs.reg_pat[RES_PREVIEW].pll_multiplier));
-	divider = d1 * pclk_mult / 0x00010000;
-	*pfps = (uint16_t) (fps * divider / 0x00010000);
-}
-
-static uint16_t imx074_get_prev_lines_pf(void)
-{
-	if (imx074_ctrl->prev_res == QTR_SIZE)
-		return IMX074_QTR_SIZE_HEIGHT + IMX074_VER_QTR_BLK_LINES;
-	else
-		return IMX074_FULL_SIZE_HEIGHT + IMX074_VER_FULL_BLK_LINES;
-
-}
-
-static uint16_t imx074_get_prev_pixels_pl(void)
-{
-	if (imx074_ctrl->prev_res == QTR_SIZE)
-		return IMX074_QTR_SIZE_WIDTH + IMX074_HRZ_QTR_BLK_PIXELS;
-	else
-		return IMX074_FULL_SIZE_WIDTH + IMX074_HRZ_FULL_BLK_PIXELS;
-}
-
-static uint16_t imx074_get_pict_lines_pf(void)
-{
-		if (imx074_ctrl->pict_res == QTR_SIZE)
-			return IMX074_QTR_SIZE_HEIGHT +
-				IMX074_VER_QTR_BLK_LINES;
-		else
-			return IMX074_FULL_SIZE_HEIGHT +
-				IMX074_VER_FULL_BLK_LINES;
-}
-
-static uint16_t imx074_get_pict_pixels_pl(void)
-{
-	if (imx074_ctrl->pict_res == QTR_SIZE)
-		return IMX074_QTR_SIZE_WIDTH +
-			IMX074_HRZ_QTR_BLK_PIXELS;
-	else
-		return IMX074_FULL_SIZE_WIDTH +
-			IMX074_HRZ_FULL_BLK_PIXELS;
-}
-
-static uint32_t imx074_get_pict_max_exp_lc(void)
-{
-	if (imx074_ctrl->pict_res == QTR_SIZE)
-		return (IMX074_QTR_SIZE_HEIGHT +
-			IMX074_VER_QTR_BLK_LINES)*24;
-	else
-		return (IMX074_FULL_SIZE_HEIGHT +
-			IMX074_VER_FULL_BLK_LINES)*24;
-}
-
-static int32_t imx074_set_fps(struct fps_cfg	*fps)
-{
-	uint16_t total_lines_per_frame;
-	int32_t rc = 0;
-	imx074_ctrl->fps_divider = fps->fps_div;
-	imx074_ctrl->pict_fps_divider = fps->pict_fps_div;
-	if (imx074_ctrl->curr_res  == QTR_SIZE) {
-		total_lines_per_frame = (uint16_t)(((IMX074_QTR_SIZE_HEIGHT +
-			IMX074_VER_QTR_BLK_LINES) *
-			imx074_ctrl->fps_divider) / 0x400);
-	} else {
-		total_lines_per_frame = (uint16_t)(((IMX074_FULL_SIZE_HEIGHT +
-			IMX074_VER_FULL_BLK_LINES) *
-			imx074_ctrl->pict_fps_divider) / 0x400);
-	}
-	if (imx074_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_HI,
-		((total_lines_per_frame & 0xFF00) >> 8)) < 0)
-		return rc;
-	if (imx074_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_LO,
-		(total_lines_per_frame & 0x00FF)) < 0)
-		return rc;
-	return rc;
-}
-
-static int32_t imx074_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	static uint16_t max_legal_gain = 0x00E0;
-	uint8_t gain_msb, gain_lsb;
-	uint8_t intg_time_msb, intg_time_lsb;
-	uint8_t frame_length_line_msb, frame_length_line_lsb;
-	uint16_t frame_length_lines;
-	int32_t rc = -1;
-
-	CDBG("imx074_write_exp_gain : gain = %d line = %d", gain, line);
-	if (imx074_ctrl->curr_res  == QTR_SIZE) {
-		frame_length_lines = IMX074_QTR_SIZE_HEIGHT +
-			IMX074_VER_QTR_BLK_LINES;
-		frame_length_lines = frame_length_lines *
-			imx074_ctrl->fps_divider / 0x400;
-	} else {
-		frame_length_lines = IMX074_FULL_SIZE_HEIGHT +
-			IMX074_VER_FULL_BLK_LINES;
-		frame_length_lines = frame_length_lines *
-			imx074_ctrl->pict_fps_divider / 0x400;
-	}
-	if (line > (frame_length_lines - IMX074_OFFSET))
-		frame_length_lines = line + IMX074_OFFSET;
-
-	CDBG("imx074 setting line = %d\n", line);
-
-
-	CDBG("imx074 setting frame_length_lines = %d\n",
-					frame_length_lines);
-
-	if (gain > max_legal_gain)
-		/* range: 0 to 224 */
-		gain = max_legal_gain;
-
-	/* update gain registers */
-	gain_msb = (uint8_t) ((gain & 0xFF00) >> 8);
-	gain_lsb = (uint8_t) (gain & 0x00FF);
-
-	frame_length_line_msb = (uint8_t) ((frame_length_lines & 0xFF00) >> 8);
-	frame_length_line_lsb = (uint8_t) (frame_length_lines & 0x00FF);
-
-	/* update line count registers */
-	intg_time_msb = (uint8_t) ((line & 0xFF00) >> 8);
-	intg_time_lsb = (uint8_t) (line & 0x00FF);
-
-	rc = imx074_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-					GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return rc;
-	CDBG("imx074 setting REG_ANALOGUE_GAIN_CODE_GLOBAL_HI = 0x%X\n",
-					gain_msb);
-	rc = imx074_i2c_write_b_sensor(REG_ANALOGUE_GAIN_CODE_GLOBAL_HI,
-					gain_msb);
-	if (rc < 0)
-		return rc;
-	CDBG("imx074 setting REG_ANALOGUE_GAIN_CODE_GLOBAL_LO = 0x%X\n",
-					gain_lsb);
-	rc = imx074_i2c_write_b_sensor(REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-					gain_lsb);
-	if (rc < 0)
-		return rc;
-
-	CDBG("imx074 setting REG_FRAME_LENGTH_LINES_HI = 0x%X\n",
-					frame_length_line_msb);
-	rc = imx074_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_HI,
-			frame_length_line_msb);
-	if (rc < 0)
-		return rc;
-
-	CDBG("imx074 setting REG_FRAME_LENGTH_LINES_LO = 0x%X\n",
-			frame_length_line_lsb);
-	rc = imx074_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_LO,
-			frame_length_line_lsb);
-	if (rc < 0)
-		return rc;
-
-	CDBG("imx074 setting REG_COARSE_INTEGRATION_TIME_HI = 0x%X\n",
-					intg_time_msb);
-	rc = imx074_i2c_write_b_sensor(REG_COARSE_INTEGRATION_TIME_HI,
-					intg_time_msb);
-	if (rc < 0)
-		return rc;
-
-	CDBG("imx074 setting REG_COARSE_INTEGRATION_TIME_LO = 0x%X\n",
-					intg_time_lsb);
-	rc = imx074_i2c_write_b_sensor(REG_COARSE_INTEGRATION_TIME_LO,
-					intg_time_lsb);
-	if (rc < 0)
-		return rc;
-
-	rc = imx074_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-					GROUPED_PARAMETER_HOLD_OFF);
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-
-static int32_t imx074_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-	rc = imx074_write_exp_gain(gain, line);
-	return rc;
-}
-
-static int32_t imx074_move_focus(int direction,
-	int32_t num_steps)
-{
-	int32_t step_direction, dest_step_position, bit_mask;
-	int32_t rc = 0;
-
-	if (num_steps == 0)
-		return rc;
-
-	if (direction == MOVE_NEAR) {
-		step_direction = 1;
-		bit_mask = 0x80;
-	} else if (direction == MOVE_FAR) {
-		step_direction = -1;
-		bit_mask = 0x00;
-	} else {
-		CDBG("imx074_move_focus: Illegal focus direction");
-		return -EINVAL;
-	}
-	dest_step_position = imx074_ctrl->curr_step_pos +
-		(step_direction * num_steps);
-	if (dest_step_position < 0)
-		dest_step_position = 0;
-	else if (dest_step_position > IMX074_TOTAL_STEPS_NEAR_TO_FAR)
-		dest_step_position = IMX074_TOTAL_STEPS_NEAR_TO_FAR;
-	rc = imx074_i2c_write_b_af(IMX074_AF_I2C_SLAVE_ID, 0x00,
-		((num_steps * imx074_l_region_code_per_step) | bit_mask));
-	CDBG("%s: Index: %d\n", __func__, dest_step_position);
-	imx074_ctrl->curr_step_pos = dest_step_position;
-	return rc;
-}
-
-
-static int32_t imx074_set_default_focus(uint8_t af_step)
-{
-	int32_t rc;
-	/* Initialize to infinity */
-	rc = imx074_i2c_write_b_af(IMX074_AF_I2C_SLAVE_ID, 0x00, 0x7F);
-	rc = imx074_i2c_write_b_af(IMX074_AF_I2C_SLAVE_ID, 0x00, 0x7F);
-	imx074_ctrl->curr_step_pos = 0;
-	return rc;
-}
-static int32_t imx074_test(enum imx074_test_mode_t mo)
-{
-	int32_t rc = 0;
-	if (mo == TEST_OFF)
-		return rc;
-	else {
-		/* Set mo to 2 inorder to enable test pattern*/
-		if (imx074_i2c_write_b_sensor(REG_TEST_PATTERN_MODE,
-			(uint8_t) mo) < 0) {
-			return rc;
-		}
-	}
-	return rc;
-}
-static int32_t imx074_sensor_setting(int update_type, int rt)
-{
-	int32_t rc = 0;
-	struct msm_camera_csi_params imx074_csi_params;
-	switch (update_type) {
-	case REG_INIT:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct imx074_i2c_reg_conf init_tbl[] = {
-				{REG_PRE_PLL_CLK_DIV,
-					imx074_regs.reg_pat_init[0].
-					pre_pll_clk_div},
-				{REG_PLSTATIM,
-					imx074_regs.reg_pat_init[0].
-					plstatim},
-				{REG_3024,
-					imx074_regs.reg_pat_init[0].
-					reg_3024},
-				{REG_IMAGE_ORIENTATION,
-					imx074_regs.reg_pat_init[0].
-					image_orientation},
-				{REG_VNDMY_ABLMGSHLMT,
-					imx074_regs.reg_pat_init[0].
-					vndmy_ablmgshlmt},
-				{REG_Y_OPBADDR_START_DI,
-					imx074_regs.reg_pat_init[0].
-					y_opbaddr_start_di},
-				{REG_3015,
-					imx074_regs.reg_pat_init[0].
-					reg_0x3015},
-				{REG_301C,
-					imx074_regs.reg_pat_init[0].
-					reg_0x301c},
-				{REG_302C,
-					imx074_regs.reg_pat_init[0].
-					reg_0x302c},
-				{REG_3031,
-					imx074_regs.reg_pat_init[0].reg_0x3031},
-				{REG_3041,
-					imx074_regs.reg_pat_init[0].reg_0x3041},
-				{REG_3051,
-					imx074_regs.reg_pat_init[0].reg_0x3051},
-				{REG_3053,
-					imx074_regs.reg_pat_init[0].reg_0x3053},
-				{REG_3057,
-					imx074_regs.reg_pat_init[0].reg_0x3057},
-				{REG_305C,
-					imx074_regs.reg_pat_init[0].reg_0x305c},
-				{REG_305D,
-					imx074_regs.reg_pat_init[0].reg_0x305d},
-				{REG_3060,
-					imx074_regs.reg_pat_init[0].reg_0x3060},
-				{REG_3065,
-					imx074_regs.reg_pat_init[0].reg_0x3065},
-				{REG_30AA,
-					imx074_regs.reg_pat_init[0].reg_0x30aa},
-				{REG_30AB,
-					imx074_regs.reg_pat_init[0].reg_0x30ab},
-				{REG_30B0,
-					imx074_regs.reg_pat_init[0].reg_0x30b0},
-				{REG_30B2,
-					imx074_regs.reg_pat_init[0].reg_0x30b2},
-				{REG_30D3,
-					imx074_regs.reg_pat_init[0].reg_0x30d3},
-				{REG_3106,
-					imx074_regs.reg_pat_init[0].reg_0x3106},
-				{REG_310C,
-					imx074_regs.reg_pat_init[0].reg_0x310c},
-				{REG_3304,
-					imx074_regs.reg_pat_init[0].reg_0x3304},
-				{REG_3305,
-					imx074_regs.reg_pat_init[0].reg_0x3305},
-				{REG_3306,
-					imx074_regs.reg_pat_init[0].reg_0x3306},
-				{REG_3307,
-					imx074_regs.reg_pat_init[0].reg_0x3307},
-				{REG_3308,
-					imx074_regs.reg_pat_init[0].reg_0x3308},
-				{REG_3309,
-					imx074_regs.reg_pat_init[0].reg_0x3309},
-				{REG_330A,
-					imx074_regs.reg_pat_init[0].reg_0x330a},
-				{REG_330B,
-					imx074_regs.reg_pat_init[0].reg_0x330b},
-				{REG_330C,
-					imx074_regs.reg_pat_init[0].reg_0x330c},
-				{REG_330D,
-					imx074_regs.reg_pat_init[0].reg_0x330d},
-				{REG_330F,
-					imx074_regs.reg_pat_init[0].reg_0x330f},
-				{REG_3381,
-					imx074_regs.reg_pat_init[0].reg_0x3381},
-			};
-			struct imx074_i2c_reg_conf init_mode_tbl[] = {
-				{REG_GROUPED_PARAMETER_HOLD,
-					GROUPED_PARAMETER_HOLD},
-				{REG_PLL_MULTIPLIER,
-					imx074_regs.reg_pat[rt].
-					pll_multiplier},
-				{REG_FRAME_LENGTH_LINES_HI,
-					imx074_regs.reg_pat[rt].
-					frame_length_lines_hi},
-				{REG_FRAME_LENGTH_LINES_LO,
-					imx074_regs.reg_pat[rt].
-					frame_length_lines_lo},
-				{REG_YADDR_START ,
-					imx074_regs.reg_pat[rt].
-					y_addr_start},
-				{REG_YAAAR_END,
-					imx074_regs.reg_pat[rt].
-					y_add_end},
-				{REG_X_OUTPUT_SIZE_MSB,
-					imx074_regs.reg_pat[rt].
-					x_output_size_msb},
-				{REG_X_OUTPUT_SIZE_LSB,
-					imx074_regs.reg_pat[rt].
-					x_output_size_lsb},
-				{REG_Y_OUTPUT_SIZE_MSB,
-					imx074_regs.reg_pat[rt].
-					y_output_size_msb},
-				{REG_Y_OUTPUT_SIZE_LSB ,
-					imx074_regs.reg_pat[rt].
-					y_output_size_lsb},
-				{REG_X_EVEN_INC,
-					imx074_regs.reg_pat[rt].
-					x_even_inc},
-				{REG_X_ODD_INC,
-					imx074_regs.reg_pat[rt].
-					x_odd_inc},
-				{REG_Y_EVEN_INC,
-					imx074_regs.reg_pat[rt].
-					y_even_inc},
-				{REG_Y_ODD_INC,
-					imx074_regs.reg_pat[rt].
-					y_odd_inc},
-				{REG_HMODEADD,
-					imx074_regs.reg_pat[rt].
-					hmodeadd},
-				{REG_VMODEADD,
-					imx074_regs.reg_pat[rt].
-					vmodeadd},
-				{REG_VAPPLINE_START,
-					imx074_regs.reg_pat[rt].
-					vapplinepos_start},
-				{REG_VAPPLINE_END,
-					imx074_regs.reg_pat[rt].
-					vapplinepos_end},
-				{REG_SHUTTER,
-					imx074_regs.reg_pat[rt].
-					shutter},
-				{REG_HADDAVE,
-					imx074_regs.reg_pat[rt].
-					haddave},
-				{REG_LANESEL,
-					imx074_regs.reg_pat[rt].
-					lanesel},
-				{REG_GROUPED_PARAMETER_HOLD,
-					GROUPED_PARAMETER_HOLD_OFF},
-
-			};
-			/* reset fps_divider */
-			imx074_ctrl->fps = 30 * Q8;
-			imx074_ctrl->fps_divider = 1 * 0x400;
-			/* stop streaming */
-			rc = imx074_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STANDBY_MODE);
-			if (rc < 0)
-				return rc;
-			msleep(imx074_delay_msecs_stdby);
-			rc = imx074_i2c_write_w_table(&init_tbl[0],
-				ARRAY_SIZE(init_tbl));
-			if (rc < 0)
-				return rc;
-			rc = imx074_i2c_write_w_table(&init_mode_tbl[0],
-				ARRAY_SIZE(init_mode_tbl));
-			if (rc < 0)
-				return rc;
-			rc = imx074_test(imx074_ctrl->set_test);
-			return rc;
-		}
-		break;
-	case UPDATE_PERIODIC:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct imx074_i2c_reg_conf mode_tbl[] = {
-				{REG_GROUPED_PARAMETER_HOLD,
-					GROUPED_PARAMETER_HOLD},
-				{REG_PLL_MULTIPLIER,
-					imx074_regs.reg_pat[rt].
-					pll_multiplier},
-				{REG_FRAME_LENGTH_LINES_HI,
-					imx074_regs.reg_pat[rt].
-					frame_length_lines_hi},
-				{REG_FRAME_LENGTH_LINES_LO,
-					imx074_regs.reg_pat[rt].
-					frame_length_lines_lo},
-				{REG_YADDR_START ,
-					imx074_regs.reg_pat[rt].
-					y_addr_start},
-				{REG_YAAAR_END,
-					imx074_regs.reg_pat[rt].
-					y_add_end},
-				{REG_X_OUTPUT_SIZE_MSB,
-					imx074_regs.reg_pat[rt].
-					x_output_size_msb},
-				{REG_X_OUTPUT_SIZE_LSB,
-					imx074_regs.reg_pat[rt].
-					x_output_size_lsb},
-				{REG_Y_OUTPUT_SIZE_MSB,
-					imx074_regs.reg_pat[rt].
-					y_output_size_msb},
-				{REG_Y_OUTPUT_SIZE_LSB ,
-					imx074_regs.reg_pat[rt].
-					y_output_size_lsb},
-				{REG_X_EVEN_INC,
-					imx074_regs.reg_pat[rt].
-					x_even_inc},
-				{REG_X_ODD_INC,
-					imx074_regs.reg_pat[rt].
-					x_odd_inc},
-				{REG_Y_EVEN_INC,
-					imx074_regs.reg_pat[rt].
-					y_even_inc},
-				{REG_Y_ODD_INC,
-					imx074_regs.reg_pat[rt].
-					y_odd_inc},
-				{REG_HMODEADD,
-					imx074_regs.reg_pat[rt].
-					hmodeadd},
-				{REG_VMODEADD,
-					imx074_regs.reg_pat[rt].
-					vmodeadd},
-				{REG_VAPPLINE_START,
-					imx074_regs.reg_pat[rt].
-					vapplinepos_start},
-				{REG_VAPPLINE_END,
-					imx074_regs.reg_pat[rt].
-					vapplinepos_end},
-				{REG_SHUTTER,
-					imx074_regs.reg_pat[rt].
-					shutter},
-				{REG_HADDAVE,
-					imx074_regs.reg_pat[rt].
-					haddave},
-				{REG_LANESEL,
-					imx074_regs.reg_pat[rt].
-					lanesel},
-				{REG_GROUPED_PARAMETER_HOLD,
-					GROUPED_PARAMETER_HOLD_OFF},
-			};
-
-			/* stop streaming */
-			rc = imx074_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STANDBY_MODE);
-			msleep(imx074_delay_msecs_stdby);
-			if (config_csi == 0) {
-				imx074_csi_params.lane_cnt = 4;
-				imx074_csi_params.data_format = CSI_10BIT;
-				imx074_csi_params.lane_assign = 0xe4;
-				imx074_csi_params.dpcm_scheme = 0;
-				imx074_csi_params.settle_cnt = 0x14;
-				rc = msm_camio_csi_config(&imx074_csi_params);
-				/*imx074_delay_msecs_stdby*/
-				msleep(imx074_delay_msecs_stream);
-				config_csi = 1;
-			}
-			rc = imx074_i2c_write_w_table(&mode_tbl[0],
-				ARRAY_SIZE(mode_tbl));
-			if (rc < 0)
-				return rc;
-			rc = imx074_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STREAM);
-			if (rc < 0)
-				return rc;
-			msleep(imx074_delay_msecs_stream);
-		}
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	return rc;
-}
-
-
-static int32_t imx074_video_config(int mode)
-{
-
-	int32_t	rc = 0;
-	int	rt;
-	/* change sensor resolution	if needed */
-	if (imx074_ctrl->prev_res == QTR_SIZE) {
-		rt = RES_PREVIEW;
-	} else {
-		rt = RES_CAPTURE;
-	}
-	if (imx074_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-		return rc;
-	imx074_ctrl->curr_res = imx074_ctrl->prev_res;
-	imx074_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t imx074_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt = RES_PREVIEW; /* TODO: Used without initialization, guessing. */
-	/* change sensor resolution if needed */
-	if (imx074_ctrl->curr_res != imx074_ctrl->pict_res) {
-		if (imx074_ctrl->pict_res == QTR_SIZE) {
-			rt = RES_PREVIEW;
-		} else {
-			rt = RES_CAPTURE;
-		}
-	}
-	if (imx074_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-		return rc;
-	imx074_ctrl->curr_res = imx074_ctrl->pict_res;
-	imx074_ctrl->sensormode = mode;
-	return rc;
-}
-static int32_t imx074_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt = RES_PREVIEW; /* TODO: Used without initialization, guessing. */
-	/* change sensor resolution if needed */
-	if (imx074_ctrl->curr_res != imx074_ctrl->pict_res) {
-		if (imx074_ctrl->pict_res == QTR_SIZE) {
-			rt = RES_PREVIEW;
-		} else {
-			rt = RES_CAPTURE;
-		}
-	}
-	if (imx074_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-		return rc;
-	imx074_ctrl->curr_res = imx074_ctrl->pict_res;
-	imx074_ctrl->sensormode = mode;
-	return rc;
-}
-static int32_t imx074_set_sensor_mode(int mode,
-	int res)
-{
-	int32_t rc = 0;
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = imx074_video_config(mode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-		rc = imx074_snapshot_config(mode);
-		break;
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = imx074_raw_snapshot_config(mode);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-static int32_t imx074_power_down(void)
-{
-	imx074_i2c_write_b_sensor(REG_MODE_SELECT,
-		MODE_SELECT_STANDBY_MODE);
-	msleep(imx074_delay_msecs_stdby);
-	return 0;
-}
-static int imx074_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	gpio_set_value_cansleep(data->sensor_reset, 0);
-	gpio_direction_input(data->sensor_reset);
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int imx074_read_eeprom_data(struct sensor_cfg_data *cfg)
-{
-	int32_t rc = 0;
-	uint16_t eepromdata = 0;
-	uint8_t addr = 0;
-
-	addr = 0x10;
-	rc = imx074_i2c_read_w_eeprom(addr, &eepromdata);
-	if (rc < 0) {
-		CDBG("%s: Error Reading EEPROM @ 0x%x\n", __func__, addr);
-		return rc;
-	}
-	cfg->cfg.calib_info.r_over_g = eepromdata;
-
-	addr = 0x12;
-	rc = imx074_i2c_read_w_eeprom(addr, &eepromdata);
-	if (rc < 0) {
-		CDBG("%s: Error Reading EEPROM @ 0x%x\n", __func__, addr);
-		return rc;
-	}
-	cfg->cfg.calib_info.b_over_g = eepromdata;
-
-	addr = 0x14;
-	rc = imx074_i2c_read_w_eeprom(addr, &eepromdata);
-	if (rc < 0) {
-		CDBG("%s: Error Reading EEPROM @ 0x%x\n", __func__, addr);
-		return rc;
-	}
-	cfg->cfg.calib_info.gr_over_gb = eepromdata;
-
-	addr = 0x1A;
-	rc = imx074_i2c_read_w_eeprom(addr, &eepromdata);
-	if (rc < 0) {
-		CDBG("%s: Error Reading EEPROM @ 0x%x\n", __func__, addr);
-		return rc;
-	}
-	cfg->cfg.calib_info.macro_2_inf = eepromdata;
-
-	addr = 0x1C;
-	rc = imx074_i2c_read_w_eeprom(addr, &eepromdata);
-	if (rc < 0) {
-		CDBG("%s: Error Reading EEPROM @ 0x%x\n", __func__, addr);
-		return rc;
-	}
-	cfg->cfg.calib_info.inf_2_macro = eepromdata;
-
-	addr = 0x1E;
-	rc = imx074_i2c_read_w_eeprom(addr, &eepromdata);
-	if (rc < 0) {
-		CDBG("%s: Error Reading EEPROM @ 0x%x\n", __func__, addr);
-		return rc;
-	}
-	cfg->cfg.calib_info.stroke_amt = eepromdata;
-
-	addr = 0x20;
-	rc = imx074_i2c_read_w_eeprom(addr, &eepromdata);
-	if (rc < 0) {
-		CDBG("%s: Error Reading EEPROM @ 0x%x\n", __func__, addr);
-		return rc;
-	}
-	cfg->cfg.calib_info.af_pos_1m = eepromdata;
-
-	addr = 0x22;
-	rc = imx074_i2c_read_w_eeprom(addr, &eepromdata);
-	if (rc < 0) {
-		CDBG("%s: Error Reading EEPROM @ 0x%x\n", __func__, addr);
-		return rc;
-	}
-	cfg->cfg.calib_info.af_pos_inf = eepromdata;
-
-	return rc;
-}
-
-static int imx074_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	unsigned short chipidl, chipidh;
-	CDBG("%s: %d\n", __func__, __LINE__);
-	rc = gpio_request(data->sensor_reset, "imx074");
-	CDBG(" imx074_probe_init_sensor \n");
-	if (!rc) {
-		CDBG("sensor_reset = %d\n", rc);
-		gpio_direction_output(data->sensor_reset, 0);
-		usleep_range(5000, 6000);
-		gpio_set_value_cansleep(data->sensor_reset, 1);
-		usleep_range(5000, 6000);
-	} else {
-		CDBG("gpio reset fail");
-		goto init_probe_done;
-	}
-	CDBG("imx074_probe_init_sensor is called\n");
-	/* 3. Read sensor Model ID: */
-	rc = imx074_i2c_read(0x0000, &chipidh, 1);
-	if (rc < 0) {
-		CDBG("Model read failed\n");
-		goto init_probe_fail;
-	}
-	rc = imx074_i2c_read(0x0001, &chipidl, 1);
-	if (rc < 0) {
-		CDBG("Model read failed\n");
-		goto init_probe_fail;
-	}
-	CDBG("imx074 model_id = 0x%x  0x%x\n", chipidh, chipidl);
-	/* 4. Compare sensor ID to IMX074 ID: */
-	if (chipidh != 0x00 || chipidl != 0x74) {
-		rc = -ENODEV;
-		CDBG("imx074_probe_init_sensor fail chip id doesnot match\n");
-		goto init_probe_fail;
-	}
-	goto init_probe_done;
-init_probe_fail:
-	CDBG("imx074_probe_init_sensor fails\n");
-	imx074_probe_init_done(data);
-init_probe_done:
-	CDBG(" imx074_probe_init_sensor finishes\n");
-	return rc;
-	}
-static int32_t imx074_poweron_af(void)
-{
-	int32_t rc = 0;
-	CDBG("imx074 enable AF actuator, gpio = %d\n",
-			imx074_ctrl->sensordata->vcm_pwd);
-	rc = gpio_request(imx074_ctrl->sensordata->vcm_pwd, "imx074");
-	if (!rc) {
-		gpio_direction_output(imx074_ctrl->sensordata->vcm_pwd, 1);
-		msleep(20);
-		rc = imx074_af_init();
-		if (rc < 0)
-			CDBG("imx074 AF initialisation failed\n");
-	} else {
-		CDBG("%s: AF PowerON gpio_request failed %d\n", __func__, rc);
-	 }
-	return rc;
-}
-static void imx074_poweroff_af(void)
-{
-	gpio_set_value_cansleep(imx074_ctrl->sensordata->vcm_pwd, 0);
-	gpio_free(imx074_ctrl->sensordata->vcm_pwd);
-}
-/* camsensor_iu060f_imx074_reset */
-int imx074_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	CDBG("%s: %d\n", __func__, __LINE__);
-	CDBG("Calling imx074_sensor_open_init\n");
-	imx074_ctrl = kzalloc(sizeof(struct imx074_ctrl_t), GFP_KERNEL);
-	if (!imx074_ctrl) {
-		CDBG("imx074_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	imx074_ctrl->fps_divider = 1 * 0x00000400;
-	imx074_ctrl->pict_fps_divider = 1 * 0x00000400;
-	imx074_ctrl->fps = 30 * Q8;
-	imx074_ctrl->set_test = TEST_OFF;
-	imx074_ctrl->prev_res = QTR_SIZE;
-	imx074_ctrl->pict_res = FULL_SIZE;
-	imx074_ctrl->curr_res = INVALID_SIZE;
-	config_csi = 0;
-
-	if (data)
-		imx074_ctrl->sensordata = data;
-
-	/* enable mclk first */
-	msm_camio_clk_rate_set(IMX074_DEFAULT_MASTER_CLK_RATE);
-	usleep_range(1000, 2000);
-	rc = imx074_probe_init_sensor(data);
-	if (rc < 0) {
-		CDBG("Calling imx074_sensor_open_init fail\n");
-		goto probe_fail;
-	}
-
-	rc = imx074_sensor_setting(REG_INIT, RES_PREVIEW);
-	if (rc < 0) {
-		CDBG("imx074_sensor_setting failed\n");
-		goto init_fail;
-	}
-	if (machine_is_msm8x60_fluid())
-		rc = imx074_poweron_af();
-	else
-		rc = imx074_af_init();
-	if (rc < 0) {
-		CDBG("AF initialisation failed\n");
-		goto init_fail;
-	} else
-		goto init_done;
-probe_fail:
-	CDBG(" imx074_sensor_open_init probe fail\n");
-	kfree(imx074_ctrl);
-	return rc;
-init_fail:
-	CDBG(" imx074_sensor_open_init fail\n");
-	imx074_probe_init_done(data);
-	kfree(imx074_ctrl);
-init_done:
-	CDBG("imx074_sensor_open_init done\n");
-	return rc;
-}
-static int imx074_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&imx074_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id imx074_i2c_id[] = {
-	{"imx074", 0},
-	{ }
-};
-
-static int imx074_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("imx074_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	imx074_sensorw = kzalloc(sizeof(struct imx074_work_t), GFP_KERNEL);
-	if (!imx074_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, imx074_sensorw);
-	imx074_init_client(client);
-	imx074_client = client;
-
-
-	CDBG("imx074_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("imx074_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int __exit imx074_remove(struct i2c_client *client)
-{
-	struct imx074_work_t_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	imx074_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static struct i2c_driver imx074_i2c_driver = {
-	.id_table = imx074_i2c_id,
-	.probe  = imx074_i2c_probe,
-	.remove = __exit_p(imx074_i2c_remove),
-	.driver = {
-		.name = "imx074",
-	},
-};
-
-int imx074_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-	if (copy_from_user(&cdata,
-		(void *)argp,
-		sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(&imx074_mut);
-	CDBG("imx074_sensor_config: cfgtype = %d\n",
-	cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		imx074_get_pict_fps(
-			cdata.cfg.gfps.prevfps,
-			&(cdata.cfg.gfps.pictfps));
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-			break;
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf =
-			imx074_get_prev_lines_pf();
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-			break;
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl =
-			imx074_get_prev_pixels_pl();
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-			break;
-
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf =
-			imx074_get_pict_lines_pf();
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-			break;
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl =
-			imx074_get_pict_pixels_pl();
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-			break;
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc =
-			imx074_get_pict_max_exp_lc();
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-			break;
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = imx074_set_fps(&(cdata.cfg.fps));
-		break;
-	case CFG_SET_EXP_GAIN:
-		rc =
-			imx074_write_exp_gain(
-			cdata.cfg.exp_gain.gain,
-			cdata.cfg.exp_gain.line);
-			break;
-	case CFG_SET_PICT_EXP_GAIN:
-		rc =
-			imx074_set_pict_exp_gain(
-			cdata.cfg.exp_gain.gain,
-			cdata.cfg.exp_gain.line);
-			break;
-	case CFG_SET_MODE:
-		rc = imx074_set_sensor_mode(cdata.mode,
-			cdata.rs);
-			break;
-	case CFG_PWR_DOWN:
-		rc = imx074_power_down();
-			break;
-	case CFG_GET_CALIB_DATA:
-		rc = imx074_read_eeprom_data(&cdata);
-		if (rc < 0)
-			break;
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(cdata)))
-			rc = -EFAULT;
-		break;
-	case CFG_MOVE_FOCUS:
-		rc =
-			imx074_move_focus(
-			cdata.cfg.focus.dir,
-			cdata.cfg.focus.steps);
-			break;
-	case CFG_SET_DEFAULT_FOCUS:
-		rc =
-			imx074_set_default_focus(
-			cdata.cfg.focus.steps);
-			break;
-	case CFG_GET_AF_MAX_STEPS:
-		cdata.max_steps = IMX074_STEPS_NEAR_TO_CLOSEST_INF;
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-			break;
-	case CFG_SET_EFFECT:
-	default:
-		rc = -EFAULT;
-		break;
-	}
-
-	mutex_unlock(&imx074_mut);
-
-	return rc;
-}
-static int imx074_sensor_release(void)
-{
-	int rc = -EBADF;
-	mutex_lock(&imx074_mut);
-	if (machine_is_msm8x60_fluid())
-		imx074_poweroff_af();
-	imx074_power_down();
-	gpio_set_value_cansleep(imx074_ctrl->sensordata->sensor_reset, 0);
-	msleep(5);
-	gpio_direction_input(imx074_ctrl->sensordata->sensor_reset);
-	gpio_free(imx074_ctrl->sensordata->sensor_reset);
-	kfree(imx074_ctrl);
-	imx074_ctrl = NULL;
-	CDBG("imx074_release completed\n");
-	mutex_unlock(&imx074_mut);
-
-	return rc;
-}
-
-static int imx074_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-	rc = i2c_add_driver(&imx074_i2c_driver);
-	if (rc < 0 || imx074_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_fail;
-	}
-	msm_camio_clk_rate_set(IMX074_DEFAULT_MASTER_CLK_RATE);
-	rc = imx074_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-	s->s_init = imx074_sensor_open_init;
-	s->s_release = imx074_sensor_release;
-	s->s_config  = imx074_sensor_config;
-	s->s_mount_angle = info->sensor_platform_info->mount_angle;
-	imx074_probe_init_done(info);
-	return rc;
-
-probe_fail:
-	CDBG("imx074_sensor_probe: SENSOR PROBE FAILS!\n");
-	i2c_del_driver(&imx074_i2c_driver);
-	return rc;
-}
-
-static int __imx074_probe(struct platform_device *pdev)
-{
-
-	return msm_camera_drv_start(pdev, imx074_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __imx074_probe,
-	.driver = {
-		.name = "msm_camera_imx074",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init imx074_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(imx074_init);
-
-MODULE_DESCRIPTION("Sony 13 MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
-
diff --git a/drivers/media/video/msm/imx074.h b/drivers/media/video/msm/imx074.h
deleted file mode 100644
index 9468cb0..0000000
--- a/drivers/media/video/msm/imx074.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef IMX074_H
-#define IMX074_H
-#include <linux/types.h>
-#include <mach/board.h>
-extern struct imx074_reg imx074_regs;
-struct reg_struct_init {
-    /* PLL setting */
-	uint8_t pre_pll_clk_div; /* 0x0305 */
-	uint8_t plstatim; /* 0x302b */
-	uint8_t reg_3024; /*ox3024*/
-	uint8_t image_orientation;  /* 0x0101*/
-	uint8_t vndmy_ablmgshlmt; /*0x300a*/
-	uint8_t y_opbaddr_start_di; /*0x3014*/
-	uint8_t reg_0x3015; /*0x3015*/
-	uint8_t reg_0x301c; /*0x301c*/
-	uint8_t reg_0x302c; /*0x302c*/
-	uint8_t reg_0x3031; /*0x3031*/
-	uint8_t reg_0x3041; /* 0x3041 */
-	uint8_t reg_0x3051; /* 0x3051 */
-	uint8_t reg_0x3053; /* 0x3053 */
-	uint8_t reg_0x3057; /* 0x3057 */
-	uint8_t reg_0x305c; /* 0x305c */
-	uint8_t reg_0x305d; /* 0x305d */
-	uint8_t reg_0x3060; /* 0x3060 */
-	uint8_t reg_0x3065; /* 0x3065 */
-	uint8_t reg_0x30aa; /* 0x30aa */
-	uint8_t reg_0x30ab;
-	uint8_t reg_0x30b0;
-	uint8_t reg_0x30b2;
-	uint8_t reg_0x30d3;
-	uint8_t reg_0x3106;
-	uint8_t reg_0x310c;
-	uint8_t reg_0x3304;
-	uint8_t reg_0x3305;
-	uint8_t reg_0x3306;
-	uint8_t reg_0x3307;
-	uint8_t reg_0x3308;
-	uint8_t reg_0x3309;
-	uint8_t reg_0x330a;
-	uint8_t reg_0x330b;
-	uint8_t reg_0x330c;
-	uint8_t reg_0x330d;
-	uint8_t reg_0x330f;
-	uint8_t reg_0x3381;
-};
-
-struct reg_struct {
-	uint8_t pll_multiplier; /* 0x0307 */
-	uint8_t frame_length_lines_hi; /* 0x0340*/
-	uint8_t frame_length_lines_lo; /* 0x0341*/
-	uint8_t y_addr_start;  /* 0x347 */
-	uint8_t y_add_end;  /* 0x034b */
-	uint8_t x_output_size_msb;  /* 0x034c */
-	uint8_t x_output_size_lsb;  /* 0x034d */
-	uint8_t y_output_size_msb; /* 0x034e */
-	uint8_t y_output_size_lsb; /* 0x034f */
-	uint8_t x_even_inc;  /* 0x0381 */
-	uint8_t x_odd_inc; /* 0x0383 */
-	uint8_t y_even_inc;  /* 0x0385 */
-	uint8_t y_odd_inc; /* 0x0387 */
-	uint8_t hmodeadd;   /* 0x3001 */
-	uint8_t vmodeadd;   /* 0x3016 */
-	uint8_t vapplinepos_start;/*ox3069*/
-	uint8_t vapplinepos_end;/*306b*/
-	uint8_t shutter;	/* 0x3086 */
-	uint8_t haddave;	/* 0x30e8 */
-	uint8_t lanesel;    /* 0x3301 */
-};
-
-struct imx074_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-enum imx074_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum imx074_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-enum imx074_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-enum mt9p012_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-struct imx074_reg {
-	const struct reg_struct_init  *reg_pat_init;
-	const struct reg_struct  *reg_pat;
-};
-#endif /* IMX074_H */
diff --git a/drivers/media/video/msm/imx074_reg.c b/drivers/media/video/msm/imx074_reg.c
deleted file mode 100644
index a9d19f2..0000000
--- a/drivers/media/video/msm/imx074_reg.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include "imx074.h"
-const struct reg_struct_init imx074_reg_init[1] = {
-	{
-		/* PLL setting */
-		0x02,	/* pll_divider 0x0305 */
-		0x4B,	/* plstatim 0x302b */
-		0x03,	/* reg_3024 */
-		0x00,	/* image_orientation 0x0101 */
-		0x80,	/* vndmy_ablmgshlmt 0x300a*/
-		0x08,	/* y_opbaddr_start_di 3014*/
-		0x37,	/* 0x3015*/
-		0x01,	/* 0x301c*/
-		0x05,	/* 0x302c*/
-		0x26,	/* 0x3031*/
-		0x60,	/* 0x3041*/
-		0x24,	/* 0x3051 CLK DIV*/
-		0x34,	/* 0x3053*/
-		0xc0,	/* 0x3057*/
-		0x09,	/* 0x305c*/
-		0x07,	/* 0x305d */
-		0x30,	/* 0x3060 */
-		0x00,	/* 0x3065 */
-		0x08,	/* 0x30aa */
-		0x1c,	/* 0x30ab */
-		0x32,	/* 0x30b0 */
-		0x83,	/* 0x30b2 */
-		0x04,	/* 0x30d3 */
-		0x78,	/* 0x3106 */
-		0x82,	/* 0x310c */
-		0x05,	/* 0x3304 */
-		0x04,	/* 0x3305 */
-		0x11,	/* 0x3306 */
-		0x02,	/* 0x3307 */
-		0x0c,	/* 0x3308 */
-		0x06,	/* 0x3309 */
-		0x08,	/* 0x330a */
-		0x04,	/* 0x330b */
-		0x08,	/* 0x330c */
-		0x06,	/* 0x330d */
-		0x01,	/* 0x330f */
-		0x00,	/* 0x3381 */
-
-	}
-};
-
-/* Preview / Snapshot register settings	*/
-const struct reg_struct	imx074_reg_pat[2] = {
-	/*preview*/
-	{
-		0x2D, /*pll_multiplier*/
-		0x06, /*frame_length_lines_hi 0x0340*/
-		0x2D, /* frame_length_lines_lo 0x0341*/
-		0x00, /* y_addr_start 0x347 */
-		0x2F, /* y_add_end 0x034b */
-		0x08, /* x_output_size_msb0x034c */
-		0x38, /* x_output_size_lsb0x034d */
-		0x06, /*  y_output_size_msb0x034e */
-		0x18, /*  y_output_size_lsb0x034f */
-		0x01, /* x_even_inc 0x0381 */
-		0x03, /* x_odd_inc 0x0383 */
-		0x01, /* y_even_inc 0x0385 */
-		0x03, /* y_odd_inc 0x0387 */
-		0x80, /* hmodeadd0x3001 */
-		0x16, /* vmodeadd0x3016 */
-		0x24, /* vapplinepos_startox3069*/
-		0x53, /* vapplinepos_end306b*/
-		0x00,/*  shutter 0x3086 */
-		0x80, /* haddave 0x30e8 */
-		0x83, /* lanesel 0x3301 */
-	},
-
-	/*snapshot*/
-	{
-		0x26, /*pll_multiplier*/
-		0x0C, /* frame_length_lines_hi 0x0340*/
-		0x90, /* frame_length_lines_lo 0x0341*/
-		0x00, /* y_addr_start 0x347 */
-		0x2F, /* y_add_end 0x034b */
-		0x10, /* x_output_size_msb0x034c */
-		0x70, /* x_output_size_lsb0x034d */
-		0x0c, /* y_output_size_msb0x034e */
-		0x30, /* y_output_size_lsb0x034f */
-		0x01, /* x_even_inc 0x0381 */
-		0x01, /* x_odd_inc 0x0383 */
-		0x01, /* y_even_inc 0x0385 */
-		0x01, /* y_odd_inc 0x0387 */
-		0x00, /* hmodeadd0x3001 */
-		0x06, /* vmodeadd0x3016 */
-		0x24, /* vapplinepos_startox3069*/
-		0x53, /* vapplinepos_end306b*/
-		0x00, /* shutter 0x3086 */
-		0x00, /* haddave 0x30e8 */
-		0x03, /* lanesel 0x3301 */
-	}
-};
-struct imx074_reg imx074_regs = {
-	.reg_pat_init = &imx074_reg_init[0],
-	.reg_pat = &imx074_reg_pat[0],
-};
diff --git a/drivers/media/video/msm/io/Makefile b/drivers/media/video/msm/io/Makefile
index fdff226..c567be2 100644
--- a/drivers/media/video/msm/io/Makefile
+++ b/drivers/media/video/msm/io/Makefile
@@ -1,17 +1,4 @@
 GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-
-ccflags-y += -Idrivers/media/video/msm -Idrivers/media/video/msm/cci
-obj-$(CONFIG_MSM_CAMERA)   += msm_camera_io_util.o msm_camera_i2c.o
-ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
-  obj-$(CONFIG_MSM_CAMERA) += msm_camera_i2c_mux.o
-  obj-$(CONFIG_ARCH_MSM7X27A) += msm_io_7x27a_v4l2.o
-  obj-$(CONFIG_ARCH_MSM8X60) += msm_io_vfe31_v4l2.o
-  obj-$(CONFIG_ARCH_MSM7X30) += msm_io_vfe31_v4l2.o
-else
-  obj-$(CONFIG_ARCH_MSM7X27A) += msm_io_7x27a.o
-  obj-$(CONFIG_ARCH_MSM8X60) += msm_io_8x60.o
-  obj-$(CONFIG_ARCH_MSM7X30) += msm_io_vfe31.o
-endif
-obj-$(CONFIG_ARCH_MSM_ARM11) += msm_io7x.o
-obj-$(CONFIG_ARCH_QSD8X50) += msm_io8x.o
-obj-$(CONFIG_ARCH_MSM8960) += msm_io_8960.o
+EXTRA_CFLAGS += -Idrivers/media/video/msm
+obj-$(CONFIG_MSM_CAMERA) += msm_camera_i2c.o msm_camera_eeprom.o msm_camera_i2c_mux.o
+obj-$(CONFIG_MSM_CAMERA) += msm_io_util.o
diff --git a/drivers/media/video/msm/io/msm_camera_eeprom.c b/drivers/media/video/msm/io/msm_camera_eeprom.c
new file mode 100644
index 0000000..34dba26
--- /dev/null
+++ b/drivers/media/video/msm/io/msm_camera_eeprom.c
@@ -0,0 +1,96 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include "msm_camera_eeprom.h"
+
+int32_t msm_camera_eeprom_init(struct msm_camera_eeprom_client *ectrl,
+	struct i2c_adapter *adapter)
+{
+	CDBG("%s: open", __func__);
+	ectrl->i2c_client->client =
+		i2c_new_dummy(adapter, ectrl->i2c_addr >> 1);
+	if (ectrl->i2c_client->client == NULL) {
+		CDBG("%s: eeprom i2c get client failed\n", __func__);
+		return -EFAULT;
+	}
+	ectrl->i2c_client->client->addr = ectrl->i2c_addr;
+	CDBG("%s: done", __func__);
+	return 0;
+}
+
+int32_t msm_camera_eeprom_release(struct msm_camera_eeprom_client *ectrl)
+{
+	if (ectrl->i2c_client->client != NULL) {
+		i2c_unregister_device(ectrl->i2c_client->client);
+		ectrl->i2c_client->client = NULL;
+	}
+	return 0;
+}
+
+int32_t msm_camera_eeprom_read(struct msm_camera_eeprom_client *ectrl,
+	uint16_t reg_addr, void *data, uint32_t num_byte,
+	uint16_t convert_endian)
+{
+	int rc = 0;
+	if (ectrl->func_tbl.eeprom_set_dev_addr != NULL)
+		ectrl->func_tbl.eeprom_set_dev_addr(ectrl, &reg_addr);
+
+	if (!convert_endian) {
+		rc = msm_camera_i2c_read_seq(
+			ectrl->i2c_client, reg_addr, data, num_byte);
+	} else {
+		unsigned char buf[num_byte];
+		uint8_t *data_ptr = (uint8_t *) data;
+		int i;
+		rc = msm_camera_i2c_read_seq(
+			ectrl->i2c_client, reg_addr, buf, num_byte);
+		for (i = 0; i < num_byte; i++)
+			data_ptr[i] = buf[num_byte-i-1];
+	}
+	return rc;
+}
+
+int32_t msm_camera_eeprom_read_tbl(struct msm_camera_eeprom_client *ectrl,
+	struct msm_camera_eeprom_read_t *read_tbl, uint16_t tbl_size)
+{
+	int i, rc = 0;
+	CDBG("%s: open", __func__);
+	if (read_tbl == NULL)
+		return rc;
+
+	for (i = 0; i < tbl_size; i++) {
+		rc = msm_camera_eeprom_read
+			(ectrl, read_tbl[i].reg_addr,
+			read_tbl[i].dest_ptr, read_tbl[i].num_byte,
+			read_tbl[i].convert_endian);
+		if (rc < 0)	{
+			CDBG("%s: read failed\n", __func__);
+			return rc;
+		}
+	}
+	CDBG("%s: done", __func__);
+	return rc;
+}
+
+int32_t msm_camera_eeprom_get_data(struct msm_camera_eeprom_client *ectrl,
+	struct sensor_eeprom_data_t *edata)
+{
+	int rc = 0;
+	if (edata->index >= ectrl->data_tbl_size)
+		return -EFAULT;
+	if (copy_to_user(edata->eeprom_data,
+		ectrl->data_tbl[edata->index].data,
+		ectrl->data_tbl[edata->index].size))
+		rc = -EFAULT;
+	return rc;
+}
+
diff --git a/drivers/media/video/msm/io/msm_camera_eeprom.h b/drivers/media/video/msm/io/msm_camera_eeprom.h
new file mode 100644
index 0000000..9dd7b54
--- /dev/null
+++ b/drivers/media/video/msm/io/msm_camera_eeprom.h
@@ -0,0 +1,66 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/delay.h>
+#include <mach/camera.h>
+#include "msm_camera_i2c.h"
+
+struct msm_camera_eeprom_client;
+
+struct msm_camera_eeprom_fn_t {
+	int32_t (*eeprom_init)
+		(struct msm_camera_eeprom_client *ectrl,
+		struct i2c_adapter *adapter);
+	int32_t (*eeprom_release)
+		(struct msm_camera_eeprom_client *ectrl);
+	int32_t (*eeprom_get_data)
+		(struct msm_camera_eeprom_client *ectrl,
+		 struct sensor_eeprom_data_t *edata);
+	void (*eeprom_set_dev_addr)
+		(struct msm_camera_eeprom_client*, uint16_t*);
+};
+
+struct msm_camera_eeprom_read_t {
+	uint16_t reg_addr;
+	void *dest_ptr;
+	uint32_t num_byte;
+	uint16_t convert_endian;
+};
+
+struct msm_camera_eeprom_data_t {
+	void *data;
+	uint16_t size;
+};
+
+struct msm_camera_eeprom_client {
+	struct msm_camera_i2c_client *i2c_client;
+	uint16_t i2c_addr;
+	struct msm_camera_eeprom_fn_t func_tbl;
+	struct msm_camera_eeprom_read_t *read_tbl;
+	uint16_t read_tbl_size;
+	struct msm_camera_eeprom_data_t *data_tbl;
+	uint16_t data_tbl_size;
+};
+
+int32_t msm_camera_eeprom_init(struct msm_camera_eeprom_client *ectrl,
+	struct i2c_adapter *adapter);
+int32_t msm_camera_eeprom_release(struct msm_camera_eeprom_client *ectrl);
+int32_t msm_camera_eeprom_read(struct msm_camera_eeprom_client *ectrl,
+	uint16_t reg_addr, void *data, uint32_t num_byte,
+	uint16_t convert_endian);
+int32_t msm_camera_eeprom_read_tbl(struct msm_camera_eeprom_client *ectrl,
+	struct msm_camera_eeprom_read_t *read_tbl, uint16_t tbl_size);
+int32_t msm_camera_eeprom_get_data(struct msm_camera_eeprom_client *ectrl,
+	struct sensor_eeprom_data_t *edata);
+
+
+
diff --git a/drivers/media/video/msm/io/msm_camera_i2c.c b/drivers/media/video/msm/io/msm_camera_i2c.c
index ce1fafa..6fd656a 100644
--- a/drivers/media/video/msm/io/msm_camera_i2c.c
+++ b/drivers/media/video/msm/io/msm_camera_i2c.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -10,10 +10,7 @@
  * GNU General Public License for more details.
  */
 
-#include <mach/camera.h>
 #include "msm_camera_i2c.h"
-#include "msm.h"
-#include "msm_cci.h"
 
 int32_t msm_camera_i2c_rxdata(struct msm_camera_i2c_client *dev_client,
 	unsigned char *rxdata, int data_length)
@@ -59,6 +56,46 @@
 	return 0;
 }
 
+int32_t msm_camera_i2c_write_b(struct msm_camera_i2c_client *client,
+	uint16_t addr, uint16_t data )
+{
+	int32_t rc = -EFAULT;
+	uint8_t len = 0;
+	enum msm_camera_i2c_data_type data_type = MSM_CAMERA_I2C_BYTE_DATA;
+	unsigned char buf[client->addr_type+data_type];
+	client->addr_type = MSM_CAMERA_I2C_WORD_ADDR;
+	S_I2C_DBG("%s reg addr = 0x%x data type: %d\n",
+			  __func__, addr, data_type);
+	if (client->addr_type == MSM_CAMERA_I2C_BYTE_ADDR) {
+		buf[0] = addr;
+		S_I2C_DBG("%s byte %d: 0x%x\n", __func__, len, buf[len]);
+		len = 1;
+	} else if (client->addr_type == MSM_CAMERA_I2C_WORD_ADDR) {
+		buf[0] = addr >> BITS_PER_BYTE;
+		buf[1] = addr;
+		S_I2C_DBG("%s byte %d: 0x%x\n", __func__, len, buf[len]);
+		S_I2C_DBG("%s byte %d: 0x%x\n", __func__, len+1, buf[len+1]);
+		len = 2;
+	}
+	S_I2C_DBG("Data: 0x%x\n", data);
+	if (data_type == MSM_CAMERA_I2C_BYTE_DATA) {
+		buf[len] = data;
+		S_I2C_DBG("Byte %d: 0x%x\n", len, buf[len]);
+		len += 1;
+	} else if (data_type == MSM_CAMERA_I2C_WORD_DATA) {
+		buf[len] = data >> BITS_PER_BYTE;
+		buf[len+1] = data;
+		S_I2C_DBG("Byte %d: 0x%x\n", len, buf[len]);
+		S_I2C_DBG("Byte %d: 0x%x\n", len+1, buf[len+1]);
+		len += 2;
+	}
+
+	rc = msm_camera_i2c_txdata(client, buf, len);
+	if (rc < 0)
+		S_I2C_DBG("%s fail\n", __func__);
+	return rc;
+}
+
 int32_t msm_camera_i2c_write(struct msm_camera_i2c_client *client,
 	uint16_t addr, uint16_t data,
 	enum msm_camera_i2c_data_type data_type)
@@ -66,7 +103,6 @@
 	int32_t rc = -EFAULT;
 	unsigned char buf[client->addr_type+data_type];
 	uint8_t len = 0;
-
 	if ((client->addr_type != MSM_CAMERA_I2C_BYTE_ADDR
 		&& client->addr_type != MSM_CAMERA_I2C_WORD_ADDR)
 		|| (data_type != MSM_CAMERA_I2C_BYTE_DATA
@@ -75,52 +111,38 @@
 
 	S_I2C_DBG("%s reg addr = 0x%x data type: %d\n",
 			  __func__, addr, data_type);
-	if (client->cci_client) {
-		struct msm_camera_cci_ctrl cci_ctrl;
-		struct msm_camera_i2c_reg_conf reg_conf_tbl;
-		reg_conf_tbl.reg_addr = addr;
-		reg_conf_tbl.reg_data = data;
-		cci_ctrl.cmd = MSM_CCI_I2C_WRITE;
-		cci_ctrl.cci_info = client->cci_client;
-		cci_ctrl.cfg.cci_i2c_write_cfg.reg_conf_tbl = &reg_conf_tbl;
-		cci_ctrl.cfg.cci_i2c_write_cfg.data_type = data_type;
-		cci_ctrl.cfg.cci_i2c_write_cfg.addr_type = client->addr_type;
-		cci_ctrl.cfg.cci_i2c_write_cfg.size = 1;
-		rc = v4l2_subdev_call(client->cci_client->cci_subdev,
-				core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl);
-		CDBG("%s line %d rc = %d\n", __func__, __LINE__, rc);
-		rc = cci_ctrl.status;
-	} else {
-		if (client->addr_type == MSM_CAMERA_I2C_BYTE_ADDR) {
-			buf[0] = addr;
-			S_I2C_DBG("%s byte %d: 0x%x\n", __func__,
-				len, buf[len]);
-			len = 1;
-		} else if (client->addr_type == MSM_CAMERA_I2C_WORD_ADDR) {
-			buf[0] = addr >> BITS_PER_BYTE;
-			buf[1] = addr;
-			S_I2C_DBG("%s byte %d: 0x%x\n", __func__,
-				len, buf[len]);
-			S_I2C_DBG("%s byte %d: 0x%x\n", __func__,
-				len+1, buf[len+1]);
-			len = 2;
-		}
-		S_I2C_DBG("Data: 0x%x\n", data);
-		if (data_type == MSM_CAMERA_I2C_BYTE_DATA) {
-			buf[len] = data;
-			S_I2C_DBG("Byte %d: 0x%x\n", len, buf[len]);
-			len += 1;
-		} else if (data_type == MSM_CAMERA_I2C_WORD_DATA) {
-			buf[len] = data >> BITS_PER_BYTE;
-			buf[len+1] = data;
-			S_I2C_DBG("Byte %d: 0x%x\n", len, buf[len]);
-			S_I2C_DBG("Byte %d: 0x%x\n", len+1, buf[len+1]);
-			len += 2;
-		}
-		rc = msm_camera_i2c_txdata(client, buf, len);
-		if (rc < 0)
-			S_I2C_DBG("%s fail\n", __func__);
+	if (client->addr_type == MSM_CAMERA_I2C_BYTE_ADDR) {
+		buf[0] = addr;
+		S_I2C_DBG("%s byte %d: 0x%x\n", __func__, len, buf[len]);
+		len = 1;
+	} else if (client->addr_type == MSM_CAMERA_I2C_WORD_ADDR) {
+		buf[0] = addr >> BITS_PER_BYTE;
+		buf[1] = addr;
+		S_I2C_DBG("%s byte %d: 0x%x\n", __func__, len, buf[len]);
+		S_I2C_DBG("%s byte %d: 0x%x\n", __func__, len+1, buf[len+1]);
+		len = 2;
 	}
+	S_I2C_DBG("Data: 0x%x\n", data);
+	if (data_type == MSM_CAMERA_I2C_BYTE_DATA) {
+		buf[len] = data;
+		S_I2C_DBG("Byte %d: 0x%x\n", len, buf[len]);
+		len += 1;
+	} else if (data_type == MSM_CAMERA_I2C_WORD_DATA) {
+		buf[len] = data >> BITS_PER_BYTE;
+		buf[len+1] = data;
+		S_I2C_DBG("Byte %d: 0x%x\n", len, buf[len]);
+		S_I2C_DBG("Byte %d: 0x%x\n", len+1, buf[len+1]);
+		len += 2;
+	}
+
+ if (addr==0xffff) {
+  msleep(data);
+  return 0;
+ }
+  
+	rc = msm_camera_i2c_txdata(client, buf, len);
+	if (rc < 0)
+		S_I2C_DBG("%s fail\n", __func__);
 	return rc;
 }
 
@@ -138,44 +160,26 @@
 
 	S_I2C_DBG("%s reg addr = 0x%x num bytes: %d\n",
 			  __func__, addr, num_byte);
-	if (client->cci_client) {
-		struct msm_camera_cci_ctrl cci_ctrl;
-		struct msm_camera_i2c_reg_conf reg_conf_tbl[num_byte];
-		reg_conf_tbl[0].reg_addr = addr;
-		for (i = 0; i < num_byte; i++)
-			reg_conf_tbl[i].reg_data = data[i];
-		cci_ctrl.cmd = MSM_CCI_I2C_WRITE;
-		cci_ctrl.cci_info = client->cci_client;
-		cci_ctrl.cfg.cci_i2c_write_cfg.reg_conf_tbl = reg_conf_tbl;
-		cci_ctrl.cfg.cci_i2c_write_cfg.size = num_byte;
-		rc = v4l2_subdev_call(client->cci_client->cci_subdev,
-				core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl);
-		CDBG("%s line %d rc = %d\n", __func__, __LINE__, rc);
-		rc = cci_ctrl.status;
-	} else {
-		if (client->addr_type == MSM_CAMERA_I2C_BYTE_ADDR) {
-			buf[0] = addr;
-			S_I2C_DBG("%s byte %d: 0x%x\n", __func__,
-				len, buf[len]);
-			len = 1;
-		} else if (client->addr_type == MSM_CAMERA_I2C_WORD_ADDR) {
-			buf[0] = addr >> BITS_PER_BYTE;
-			buf[1] = addr;
-			S_I2C_DBG("%s byte %d: 0x%x\n", __func__,
-				len, buf[len]);
-			S_I2C_DBG("%s byte %d: 0x%x\n", __func__,
-				len+1, buf[len+1]);
-			len = 2;
-		}
-		for (i = 0; i < num_byte; i++) {
-			buf[i+len] = data[i];
-			S_I2C_DBG("Byte %d: 0x%x\n", i+len, buf[i+len]);
-			S_I2C_DBG("Data: 0x%x\n", data[i]);
-		}
-		rc = msm_camera_i2c_txdata(client, buf, len+num_byte);
-		if (rc < 0)
-			S_I2C_DBG("%s fail\n", __func__);
+	if (client->addr_type == MSM_CAMERA_I2C_BYTE_ADDR) {
+		buf[0] = addr;
+		S_I2C_DBG("%s byte %d: 0x%x\n", __func__, len, buf[len]);
+		len = 1;
+	} else if (client->addr_type == MSM_CAMERA_I2C_WORD_ADDR) {
+		buf[0] = addr >> BITS_PER_BYTE;
+		buf[1] = addr;
+		S_I2C_DBG("%s byte %d: 0x%x\n", __func__, len, buf[len]);
+		S_I2C_DBG("%s byte %d: 0x%x\n", __func__, len+1, buf[len+1]);
+		len = 2;
 	}
+	for (i = 0; i < num_byte; i++) {
+		buf[i+len] = data[i];
+		S_I2C_DBG("Byte %d: 0x%x\n", i+len, buf[i+len]);
+		S_I2C_DBG("Data: 0x%x\n", data[i]);
+	}
+
+	rc = msm_camera_i2c_txdata(client, buf, len+num_byte);
+	if (rc < 0)
+		S_I2C_DBG("%s fail\n", __func__);
 	return rc;
 }
 
@@ -206,6 +210,7 @@
 
 	return rc;
 }
+
 int32_t msm_camera_i2c_set_write_mask_data(struct msm_camera_i2c_client *client,
 	uint16_t addr, uint16_t data, int16_t mask,
 	enum msm_camera_i2c_data_type data_type)
@@ -232,6 +237,7 @@
 	return rc;
 }
 
+
 int32_t msm_camera_i2c_compare(struct msm_camera_i2c_client *client,
 	uint16_t addr, uint16_t data,
 	enum msm_camera_i2c_data_type data_type)
@@ -308,65 +314,50 @@
 	return rc;
 }
 
-int32_t msm_camera_i2c_write_table_w_microdelay(
-	struct msm_camera_i2c_client *client,
-	struct msm_camera_i2c_reg_tbl *reg_tbl, uint16_t size,
-	enum msm_camera_i2c_data_type data_type)
+int32_t msm_camera_i2c_poll2(struct msm_camera_i2c_client *client,
+	struct msm_camera_i2c_reg_conf *reg_conf_tbl)
 {
-	int i;
-	int32_t rc = -EFAULT;
+	int32_t rc = -EIO;
+	int i,done=0;
+	uint16_t addr = reg_conf_tbl->reg_addr;
+	uint16_t value = reg_conf_tbl->reg_data;
+	uint16_t mask = reg_conf_tbl->mask;
+	uint16_t readValue=0;
 
-	if (!client || !reg_tbl)
-		return rc;
+	
+	for (i=0;i<20 && !done ;++i)
+	{
+		rc = msm_camera_i2c_read (client, addr, &readValue, 2); 
+		if (rc < 0) {
+			printk("i2c read error\n");
+			
+			return rc;
+		}
+		
+		
 
-	if ((client->addr_type != MSM_CAMERA_I2C_BYTE_ADDR
-		&& client->addr_type != MSM_CAMERA_I2C_WORD_ADDR)
-		|| (data_type != MSM_CAMERA_I2C_BYTE_DATA
-		&& data_type != MSM_CAMERA_I2C_WORD_DATA))
-		return rc;
+		switch (reg_conf_tbl->cmd_type)
+		{
+			case MSM_CAMERA_I2C_CMD_POLL_EQUAL:
+				done = !((readValue&mask) == value);
+				break;
 
-	for (i = 0; i < size; i++) {
-		rc = msm_camera_i2c_write(client, reg_tbl->reg_addr,
-			reg_tbl->reg_data, data_type);
-		if (rc < 0)
-			break;
-		if (reg_tbl->delay)
-			usleep_range(reg_tbl->delay, reg_tbl->delay + 1000);
-		reg_tbl++;
+			case MSM_CAMERA_I2C_CMD_POLL_NOT_EQUAL:
+				done = !((readValue&mask) != value);
+				break;
+
+			case MSM_CAMERA_I2C_CMD_POLL_LESS:
+				done = !((readValue&mask) < value);
+				break;
+				
+			default:
+				break;
+		}
+
+		if (!done)
+			msleep(5);
 	}
-	return rc;
-}
 
-int32_t msm_camera_i2c_write_bayer_table(
-	struct msm_camera_i2c_client *client,
-	struct msm_camera_i2c_reg_setting *write_setting)
-{
-	int i;
-	int32_t rc = -EFAULT;
-	struct msm_camera_i2c_reg_array *reg_setting;
-
-	if (!client || !write_setting)
-		return rc;
-
-	reg_setting = write_setting->reg_setting;
-	client->addr_type = write_setting->addr_type;
-	if ((write_setting->addr_type != MSM_CAMERA_I2C_BYTE_ADDR
-		&& write_setting->addr_type != MSM_CAMERA_I2C_WORD_ADDR)
-		|| (write_setting->data_type != MSM_CAMERA_I2C_BYTE_DATA
-		&& write_setting->data_type != MSM_CAMERA_I2C_WORD_DATA))
-		return rc;
-	for (i = 0; i < write_setting->size; i++) {
-		rc = msm_camera_i2c_write(client, reg_setting->reg_addr,
-			reg_setting->reg_data, write_setting->data_type);
-		if (rc < 0)
-			break;
-		reg_setting++;
-	}
-	if (write_setting->delay > 20)
-		msleep(write_setting->delay);
-	else if (write_setting->delay)
-		usleep_range(write_setting->delay * 1000, (write_setting->delay
-			* 1000) + 1000);
 	return rc;
 }
 
@@ -376,85 +367,106 @@
 {
 	int i;
 	int32_t rc = -EFAULT;
-	if (client->cci_client) {
-		struct msm_camera_cci_ctrl cci_ctrl;
-		cci_ctrl.cmd = MSM_CCI_I2C_WRITE;
-		cci_ctrl.cci_info = client->cci_client;
-		cci_ctrl.cfg.cci_i2c_write_cfg.reg_conf_tbl = reg_conf_tbl;
-		cci_ctrl.cfg.cci_i2c_write_cfg.data_type = data_type;
-		cci_ctrl.cfg.cci_i2c_write_cfg.addr_type = client->addr_type;
-		cci_ctrl.cfg.cci_i2c_write_cfg.size = size;
-		rc = v4l2_subdev_call(client->cci_client->cci_subdev,
-				core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl);
-		CDBG("%s line %d rc = %d\n", __func__, __LINE__, rc);
-		rc = cci_ctrl.status;
-	} else {
-		for (i = 0; i < size; i++) {
-			enum msm_camera_i2c_data_type dt;
-			if (reg_conf_tbl->cmd_type == MSM_CAMERA_I2C_CMD_POLL) {
-				rc = msm_camera_i2c_poll(client,
+	for (i = 0; i < size; i++) {
+		enum msm_camera_i2c_data_type dt;
+		if (reg_conf_tbl->cmd_type == MSM_CAMERA_I2C_CMD_POLL) {
+			rc = msm_camera_i2c_poll(client, reg_conf_tbl->reg_addr,
+				reg_conf_tbl->reg_data, reg_conf_tbl->dt);
+		} 
+		else if (reg_conf_tbl->cmd_type == MSM_CAMERA_I2C_CMD_POLL_EQUAL ||
+				 reg_conf_tbl->cmd_type == MSM_CAMERA_I2C_CMD_POLL_NOT_EQUAL ||
+				 reg_conf_tbl->cmd_type == MSM_CAMERA_I2C_CMD_POLL_LESS) {
+		
+			rc = msm_camera_i2c_poll2(client, reg_conf_tbl);
+		
+		}
+
+		else {
+			if (reg_conf_tbl->dt == 0)
+				dt = data_type;
+			else
+				dt = reg_conf_tbl->dt;
+
+			switch (dt) {
+			case MSM_CAMERA_I2C_BYTE_DATA:
+			case MSM_CAMERA_I2C_WORD_DATA:
+				rc = msm_camera_i2c_write(
+					client,
+					reg_conf_tbl->reg_addr,
+					reg_conf_tbl->reg_data, dt);
+				break;
+			case MSM_CAMERA_I2C_SET_BYTE_MASK:
+				rc = msm_camera_i2c_set_mask(client,
 					reg_conf_tbl->reg_addr,
 					reg_conf_tbl->reg_data,
-					reg_conf_tbl->dt);
-			} else {
-				if (reg_conf_tbl->dt == 0)
-					dt = data_type;
-				else
-					dt = reg_conf_tbl->dt;
-				switch (dt) {
-				case MSM_CAMERA_I2C_BYTE_DATA:
-				case MSM_CAMERA_I2C_WORD_DATA:
-					rc = msm_camera_i2c_write(
-						client,
-						reg_conf_tbl->reg_addr,
-						reg_conf_tbl->reg_data, dt);
-					break;
-				case MSM_CAMERA_I2C_SET_BYTE_MASK:
-					rc = msm_camera_i2c_set_mask(client,
-						reg_conf_tbl->reg_addr,
-						reg_conf_tbl->reg_data,
-						MSM_CAMERA_I2C_BYTE_DATA, 1);
-					break;
-				case MSM_CAMERA_I2C_UNSET_BYTE_MASK:
-					rc = msm_camera_i2c_set_mask(client,
-						reg_conf_tbl->reg_addr,
-						reg_conf_tbl->reg_data,
-						MSM_CAMERA_I2C_BYTE_DATA, 0);
-					break;
-				case MSM_CAMERA_I2C_SET_WORD_MASK:
-					rc = msm_camera_i2c_set_mask(client,
-						reg_conf_tbl->reg_addr,
-						reg_conf_tbl->reg_data,
-						MSM_CAMERA_I2C_WORD_DATA, 1);
-					break;
-				case MSM_CAMERA_I2C_UNSET_WORD_MASK:
-					rc = msm_camera_i2c_set_mask(client,
-						reg_conf_tbl->reg_addr,
-						reg_conf_tbl->reg_data,
-						MSM_CAMERA_I2C_WORD_DATA, 0);
-					break;
-				case MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA:
-					rc = msm_camera_i2c_set_write_mask_data(
-						client,
-						reg_conf_tbl->reg_addr,
-						reg_conf_tbl->reg_data,
-						reg_conf_tbl->mask,
-						MSM_CAMERA_I2C_BYTE_DATA);
-					break;
-				default:
-					pr_err("%s: Unsupport data type: %d\n",
-						__func__, dt);
-					break;
-				}
-			}
-			if (rc < 0)
+					MSM_CAMERA_I2C_BYTE_DATA, 1);
 				break;
-			reg_conf_tbl++;
+			case MSM_CAMERA_I2C_UNSET_BYTE_MASK:
+				rc = msm_camera_i2c_set_mask(client,
+					reg_conf_tbl->reg_addr,
+					reg_conf_tbl->reg_data,
+					MSM_CAMERA_I2C_BYTE_DATA, 0);
+				break;
+			case MSM_CAMERA_I2C_SET_WORD_MASK:
+				rc = msm_camera_i2c_set_mask(client,
+					reg_conf_tbl->reg_addr,
+					reg_conf_tbl->reg_data,
+					MSM_CAMERA_I2C_WORD_DATA, 1);
+				break;
+			case MSM_CAMERA_I2C_UNSET_WORD_MASK:
+				rc = msm_camera_i2c_set_mask(client,
+					reg_conf_tbl->reg_addr,
+					reg_conf_tbl->reg_data,
+					MSM_CAMERA_I2C_WORD_DATA, 0);
+				break;
+			case MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA:
+				rc = msm_camera_i2c_set_write_mask_data(client,
+					reg_conf_tbl->reg_addr,
+					reg_conf_tbl->reg_data,
+					reg_conf_tbl->mask,
+					MSM_CAMERA_I2C_BYTE_DATA);
+				break;
+			default:
+				pr_err("%s: Unsupport data type: %d\n",
+					__func__, dt);
+				break;
+			}
 		}
+		if (rc < 0)
+			break;
+		reg_conf_tbl++;
 	}
 	return rc;
 }
 
+int32_t msm_camera_i2c_read_b(struct msm_camera_i2c_client *client,
+	uint16_t addr, uint16_t *data)
+{
+	int32_t rc = -EFAULT;
+	enum msm_camera_i2c_data_type data_type = MSM_CAMERA_I2C_BYTE_DATA;
+	unsigned char buf[client->addr_type+data_type];
+
+	client->addr_type = MSM_CAMERA_I2C_WORD_ADDR;
+	if (client->addr_type == MSM_CAMERA_I2C_BYTE_ADDR) {
+		buf[0] = addr;
+	} else if (client->addr_type == MSM_CAMERA_I2C_WORD_ADDR) {
+		buf[0] = addr >> BITS_PER_BYTE;
+		buf[1] = addr;
+	}
+	rc = msm_camera_i2c_rxdata(client, buf, data_type);
+	if (rc < 0) {
+		S_I2C_DBG("%s fail\n", __func__);
+		return rc;
+	}
+	if (data_type == MSM_CAMERA_I2C_BYTE_DATA)
+		*data = buf[0];
+	else
+		*data = buf[0] << 8 | buf[1];
+
+	S_I2C_DBG("%s addr = 0x%x data: 0x%x", __func__, addr, *data);
+	return rc;
+}
+
 int32_t msm_camera_i2c_read(struct msm_camera_i2c_client *client,
 	uint16_t addr, uint16_t *data,
 	enum msm_camera_i2c_data_type data_type)
@@ -468,30 +480,16 @@
 		&& data_type != MSM_CAMERA_I2C_WORD_DATA))
 		return rc;
 
-	if (client->cci_client) {
-		struct msm_camera_cci_ctrl cci_ctrl;
-		cci_ctrl.cmd = MSM_CCI_I2C_READ;
-		cci_ctrl.cci_info = client->cci_client;
-		cci_ctrl.cfg.cci_i2c_read_cfg.addr = addr;
-		cci_ctrl.cfg.cci_i2c_read_cfg.addr_type = client->addr_type;
-		cci_ctrl.cfg.cci_i2c_read_cfg.data = buf;
-		cci_ctrl.cfg.cci_i2c_read_cfg.num_byte = data_type;
-		rc = v4l2_subdev_call(client->cci_client->cci_subdev,
-				core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl);
-		CDBG("%s line %d rc = %d\n", __func__, __LINE__, rc);
-		rc = cci_ctrl.status;
-	} else {
-		if (client->addr_type == MSM_CAMERA_I2C_BYTE_ADDR) {
-			buf[0] = addr;
-		} else if (client->addr_type == MSM_CAMERA_I2C_WORD_ADDR) {
-			buf[0] = addr >> BITS_PER_BYTE;
-			buf[1] = addr;
-		}
-		rc = msm_camera_i2c_rxdata(client, buf, data_type);
-		if (rc < 0) {
-			S_I2C_DBG("%s fail\n", __func__);
-			return rc;
-		}
+	if (client->addr_type == MSM_CAMERA_I2C_BYTE_ADDR) {
+		buf[0] = addr;
+	} else if (client->addr_type == MSM_CAMERA_I2C_WORD_ADDR) {
+		buf[0] = addr >> BITS_PER_BYTE;
+		buf[1] = addr;
+	}
+	rc = msm_camera_i2c_rxdata(client, buf, data_type);
+	if (rc < 0) {
+		S_I2C_DBG("%s fail\n", __func__);
+		return rc;
 	}
 	if (data_type == MSM_CAMERA_I2C_BYTE_DATA)
 		*data = buf[0];
@@ -509,35 +507,22 @@
 	unsigned char buf[client->addr_type+num_byte];
 	int i;
 
+	memset(buf, 0, sizeof(buf));
 	if ((client->addr_type != MSM_CAMERA_I2C_BYTE_ADDR
 		&& client->addr_type != MSM_CAMERA_I2C_WORD_ADDR)
 		|| num_byte == 0)
 		return rc;
 
-	if (client->cci_client) {
-		struct msm_camera_cci_ctrl cci_ctrl;
-		cci_ctrl.cmd = MSM_CCI_I2C_READ;
-		cci_ctrl.cci_info = client->cci_client;
-		cci_ctrl.cfg.cci_i2c_read_cfg.addr = addr;
-		cci_ctrl.cfg.cci_i2c_read_cfg.addr_type = client->addr_type;
-		cci_ctrl.cfg.cci_i2c_read_cfg.data = buf;
-		cci_ctrl.cfg.cci_i2c_read_cfg.num_byte = num_byte;
-		rc = v4l2_subdev_call(client->cci_client->cci_subdev,
-				core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl);
-		CDBG("%s line %d rc = %d\n", __func__, __LINE__, rc);
-		rc = cci_ctrl.status;
-	} else {
-		if (client->addr_type == MSM_CAMERA_I2C_BYTE_ADDR) {
-			buf[0] = addr;
-		} else if (client->addr_type == MSM_CAMERA_I2C_WORD_ADDR) {
-			buf[0] = addr >> BITS_PER_BYTE;
-			buf[1] = addr;
-		}
-		rc = msm_camera_i2c_rxdata(client, buf, num_byte);
-		if (rc < 0) {
-			S_I2C_DBG("%s fail\n", __func__);
-			return rc;
-		}
+	if (client->addr_type == MSM_CAMERA_I2C_BYTE_ADDR) {
+		buf[0] = addr;
+	} else if (client->addr_type == MSM_CAMERA_I2C_WORD_ADDR) {
+		buf[0] = addr >> BITS_PER_BYTE;
+		buf[1] = addr;
+	}
+	rc = msm_camera_i2c_rxdata(client, buf, num_byte);
+	if (rc < 0) {
+		S_I2C_DBG("%s fail\n", __func__);
+		return rc;
 	}
 
 	S_I2C_DBG("%s addr = 0x%x", __func__, addr);
@@ -581,6 +566,7 @@
 
 	if (i >= conf->num_index)
 		return rc;
+
 	rc = msm_sensor_write_all_conf_array(client,
 		&conf->conf[i*conf->num_conf], conf->num_conf);
 
@@ -604,17 +590,4 @@
 	return rc;
 }
 
-int32_t msm_sensor_cci_util(struct msm_camera_i2c_client *client,
-	uint16_t cci_cmd)
-{
-	int32_t rc = 0;
-	struct msm_camera_cci_ctrl cci_ctrl;
 
-	CDBG("%s line %d\n", __func__, __LINE__);
-	cci_ctrl.cmd = cci_cmd;
-	cci_ctrl.cci_info = client->cci_client;
-	rc = v4l2_subdev_call(client->cci_client->cci_subdev,
-			core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl);
-	CDBG("%s line %d rc = %d\n", __func__, __LINE__, rc);
-	return cci_ctrl.status;
-}
diff --git a/drivers/media/video/msm/io/msm_camera_i2c.h b/drivers/media/video/msm/io/msm_camera_i2c.h
index ce42607..75dd986 100644
--- a/drivers/media/video/msm/io/msm_camera_i2c.h
+++ b/drivers/media/video/msm/io/msm_camera_i2c.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -16,8 +16,6 @@
 #include <linux/i2c.h>
 #include <linux/delay.h>
 #include <mach/camera.h>
-#include <media/v4l2-subdev.h>
-#include <media/msm_camera.h>
 
 #define CONFIG_MSM_CAMERA_I2C_DBG 0
 
@@ -27,16 +25,41 @@
 #define S_I2C_DBG(fmt, args...) CDBG(fmt, ##args)
 #endif
 
+enum msm_camera_i2c_reg_addr_type {
+	MSM_CAMERA_I2C_BYTE_ADDR = 1,
+	MSM_CAMERA_I2C_WORD_ADDR,
+};
+
 struct msm_camera_i2c_client {
 	struct i2c_client *client;
-	struct msm_camera_cci_client *cci_client;
 	enum msm_camera_i2c_reg_addr_type addr_type;
 };
 
-struct msm_camera_i2c_reg_tbl {
+enum msm_camera_i2c_data_type {
+	MSM_CAMERA_I2C_BYTE_DATA = 1,
+	MSM_CAMERA_I2C_WORD_DATA,
+	MSM_CAMERA_I2C_SET_BYTE_MASK,
+	MSM_CAMERA_I2C_UNSET_BYTE_MASK,
+	MSM_CAMERA_I2C_SET_WORD_MASK,
+	MSM_CAMERA_I2C_UNSET_WORD_MASK,
+	MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA,
+};
+
+enum msm_camera_i2c_cmd_type {
+	MSM_CAMERA_I2C_CMD_WRITE,
+	MSM_CAMERA_I2C_CMD_POLL,
+	MSM_CAMERA_I2C_CMD_POLL_EQUAL,
+	MSM_CAMERA_I2C_CMD_POLL_NOT_EQUAL,
+	MSM_CAMERA_I2C_CMD_POLL_LESS,
+
+};
+
+struct msm_camera_i2c_reg_conf {
 	uint16_t reg_addr;
 	uint16_t reg_data;
-	uint16_t delay;
+	enum msm_camera_i2c_data_type dt;
+	enum msm_camera_i2c_cmd_type cmd_type;
+	int16_t mask;
 };
 
 struct msm_camera_i2c_conf_array {
@@ -61,14 +84,16 @@
 
 int32_t msm_camera_i2c_txdata(struct msm_camera_i2c_client *client,
 	unsigned char *txdata, int length);
-
+int32_t msm_camera_i2c_read_b(struct msm_camera_i2c_client *client,
+	uint16_t addr, uint16_t *data);
 int32_t msm_camera_i2c_read(struct msm_camera_i2c_client *client,
 	uint16_t addr, uint16_t *data,
 	enum msm_camera_i2c_data_type data_type);
 
 int32_t msm_camera_i2c_read_seq(struct msm_camera_i2c_client *client,
 	uint16_t addr, uint8_t *data, uint16_t num_byte);
-
+int32_t msm_camera_i2c_write_b(struct msm_camera_i2c_client *client,
+	uint16_t addr, uint16_t data );
 int32_t msm_camera_i2c_write(struct msm_camera_i2c_client *client,
 	uint16_t addr, uint16_t data,
 	enum msm_camera_i2c_data_type data_type);
@@ -87,15 +112,9 @@
 int32_t msm_camera_i2c_poll(struct msm_camera_i2c_client *client,
 	uint16_t addr, uint16_t data,
 	enum msm_camera_i2c_data_type data_type);
-
-int32_t msm_camera_i2c_write_table_w_microdelay(
-	struct msm_camera_i2c_client *client,
-	struct msm_camera_i2c_reg_tbl *reg_tbl, uint16_t size,
-	enum msm_camera_i2c_data_type data_type);
-
-int32_t msm_camera_i2c_write_bayer_table(
-	struct msm_camera_i2c_client *client,
-	struct msm_camera_i2c_reg_setting *write_setting);
+	
+int32_t msm_camera_i2c_poll2(struct msm_camera_i2c_client *client,
+	struct msm_camera_i2c_reg_conf *reg_conf_tbl);
 
 int32_t msm_camera_i2c_write_tbl(struct msm_camera_i2c_client *client,
 	struct msm_camera_i2c_reg_conf *reg_conf_tbl, uint16_t size,
@@ -109,7 +128,4 @@
 
 int32_t msm_sensor_write_all_conf_array(struct msm_camera_i2c_client *client,
 	struct msm_camera_i2c_conf_array *array, uint16_t size);
-
-int32_t msm_sensor_cci_util(struct msm_camera_i2c_client *client,
-	uint16_t cci_cmd);
 #endif
diff --git a/drivers/media/video/msm/io/msm_camera_i2c_mux.c b/drivers/media/video/msm/io/msm_camera_i2c_mux.c
index 730cb78..18724c3 100644
--- a/drivers/media/video/msm/io/msm_camera_i2c_mux.c
+++ b/drivers/media/video/msm/io/msm_camera_i2c_mux.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -10,10 +10,10 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/io.h>
-#include <linux/module.h>
 #include <mach/board.h>
 #include <mach/camera.h>
 #include "msm.h"
@@ -22,16 +22,16 @@
 static int msm_i2c_mux_config(struct i2c_mux_device *mux_device, uint8_t *mode)
 {
 	uint32_t val;
-	val = msm_camera_io_r(mux_device->ctl_base);
+	val = msm_io_r(mux_device->ctl_base);
 	if (*mode == MODE_DUAL) {
-		msm_camera_io_w(val | 0x3, mux_device->ctl_base);
+		msm_io_w(val | 0x3, mux_device->ctl_base);
 	} else if (*mode == MODE_L) {
-		msm_camera_io_w(((val | 0x2) & ~(0x1)), mux_device->ctl_base);
-		val = msm_camera_io_r(mux_device->ctl_base);
+		msm_io_w(((val | 0x2) & ~(0x1)), mux_device->ctl_base);
+		val = msm_io_r(mux_device->ctl_base);
 		CDBG("the camio mode config left value is %d\n", val);
 	} else {
-		msm_camera_io_w(((val | 0x1) & ~(0x2)), mux_device->ctl_base);
-		val = msm_camera_io_r(mux_device->ctl_base);
+		msm_io_w(((val | 0x1) & ~(0x2)), mux_device->ctl_base);
+		val = msm_io_r(mux_device->ctl_base);
 		CDBG("the camio mode config right value is %d\n", val);
 	}
 	return 0;
@@ -54,8 +54,8 @@
 			iounmap(mux_device->ctl_base);
 			return rc;
 		}
-		val = msm_camera_io_r(mux_device->rw_base);
-		msm_camera_io_w((val | 0x200), mux_device->rw_base);
+		val = msm_io_r(mux_device->rw_base);
+		msm_io_w((val | 0x200), mux_device->rw_base);
 	}
 	mux_device->use_count++;
 	return 0;
@@ -66,8 +66,8 @@
 	int val = 0;
 	mux_device->use_count--;
 	if (mux_device->use_count == 0) {
-		val = msm_camera_io_r(mux_device->rw_base);
-		msm_camera_io_w((val & ~0x200), mux_device->rw_base);
+		val = msm_io_r(mux_device->rw_base);
+		msm_io_w((val & ~0x200), mux_device->rw_base);
 		iounmap(mux_device->rw_base);
 		iounmap(mux_device->ctl_base);
 	}
@@ -160,7 +160,7 @@
 i2c_mux_no_resource:
 	mutex_destroy(&mux_device->mutex);
 	kfree(mux_device);
-	return rc;
+	return 0;
 }
 
 static struct platform_driver i2c_mux_driver = {
diff --git a/drivers/media/video/msm/io/msm_camera_i2c_mux.h b/drivers/media/video/msm/io/msm_camera_i2c_mux.h
index 30f908b..94394fc 100644
--- a/drivers/media/video/msm/io/msm_camera_i2c_mux.h
+++ b/drivers/media/video/msm/io/msm_camera_i2c_mux.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
diff --git a/drivers/media/video/msm/io/msm_camera_io_util.c b/drivers/media/video/msm/io/msm_camera_io_util.c
deleted file mode 100644
index cede05d..0000000
--- a/drivers/media/video/msm/io/msm_camera_io_util.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/gpio.h>
-#include <linux/regulator/consumer.h>
-#include <linux/io.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <mach/gpiomux.h>
-
-#define BUFF_SIZE_128 128
-static int gpio_ref_count;
-
-void msm_camera_io_w(u32 data, void __iomem *addr)
-{
-	CDBG("%s: %08x %08x\n", __func__, (int) (addr), (data));
-	writel_relaxed((data), (addr));
-}
-
-void msm_camera_io_w_mb(u32 data, void __iomem *addr)
-{
-	CDBG("%s: %08x %08x\n", __func__, (int) (addr), (data));
-	wmb();
-	writel_relaxed((data), (addr));
-	wmb();
-}
-
-u32 msm_camera_io_r(void __iomem *addr)
-{
-	uint32_t data = readl_relaxed(addr);
-	CDBG("%s: %08x %08x\n", __func__, (int) (addr), (data));
-	return data;
-}
-
-u32 msm_camera_io_r_mb(void __iomem *addr)
-{
-	uint32_t data;
-	rmb();
-	data = readl_relaxed(addr);
-	rmb();
-	CDBG("%s: %08x %08x\n", __func__, (int) (addr), (data));
-	return data;
-}
-
-void msm_camera_io_memcpy_toio(void __iomem *dest_addr,
-	void __iomem *src_addr, u32 len)
-{
-	int i;
-	u32 *d = (u32 *) dest_addr;
-	u32 *s = (u32 *) src_addr;
-
-	for (i = 0; i < len; i++)
-		writel_relaxed(*s++, d++);
-}
-
-void msm_camera_io_dump(void __iomem *addr, int size)
-{
-	char line_str[BUFF_SIZE_128], *p_str;
-	int i;
-	u32 *p = (u32 *) addr;
-	u32 data;
-	CDBG("%s: %p %d\n", __func__, addr, size);
-	line_str[0] = '\0';
-	p_str = line_str;
-	for (i = 0; i < size/4; i++) {
-		if (i % 4 == 0) {
-			snprintf(p_str, 12, "%08x: ", (u32) p);
-			p_str += 10;
-		}
-		data = readl_relaxed(p++);
-		snprintf(p_str, 12, "%08x ", data);
-		p_str += 9;
-		if ((i + 1) % 4 == 0) {
-			CDBG("%s\n", line_str);
-			line_str[0] = '\0';
-			p_str = line_str;
-		}
-	}
-	if (line_str[0] != '\0')
-		CDBG("%s\n", line_str);
-}
-
-void msm_camera_io_memcpy(void __iomem *dest_addr,
-	void __iomem *src_addr, u32 len)
-{
-	CDBG("%s: %p %p %d\n", __func__, dest_addr, src_addr, len);
-	msm_camera_io_memcpy_toio(dest_addr, src_addr, len / 4);
-	msm_camera_io_dump(dest_addr, len);
-}
-
-int msm_cam_clk_enable(struct device *dev, struct msm_cam_clk_info *clk_info,
-		struct clk **clk_ptr, int num_clk, int enable)
-{
-	int i;
-	int rc = 0;
-	if (enable) {
-		for (i = 0; i < num_clk; i++) {
-			clk_ptr[i] = clk_get(dev, clk_info[i].clk_name);
-			if (IS_ERR(clk_ptr[i])) {
-				pr_err("%s get failed\n", clk_info[i].clk_name);
-				rc = PTR_ERR(clk_ptr[i]);
-				goto cam_clk_get_err;
-			}
-			if (clk_info[i].clk_rate >= 0) {
-				rc = clk_set_rate(clk_ptr[i],
-							clk_info[i].clk_rate);
-				if (rc < 0) {
-					pr_err("%s set failed\n",
-						   clk_info[i].clk_name);
-					goto cam_clk_set_err;
-				}
-			}
-			rc = clk_prepare(clk_ptr[i]);
-			if (rc < 0) {
-				pr_err("%s prepare failed\n",
-					   clk_info[i].clk_name);
-				goto cam_clk_prepare_err;
-			}
-
-			rc = clk_enable(clk_ptr[i]);
-			if (rc < 0) {
-				pr_err("%s enable failed\n",
-					   clk_info[i].clk_name);
-				goto cam_clk_enable_err;
-			}
-			if (clk_info[i].delay > 20) {
-				msleep(clk_info[i].delay);
-			} else if (clk_info[i].delay) {
-				usleep_range(clk_info[i].delay * 1000,
-					(clk_info[i].delay * 1000) + 1000);
-			}
-		}
-	} else {
-		for (i = num_clk - 1; i >= 0; i--) {
-			if (clk_ptr[i] != NULL) {
-				clk_disable(clk_ptr[i]);
-				clk_unprepare(clk_ptr[i]);
-				clk_put(clk_ptr[i]);
-			}
-		}
-	}
-	return rc;
-
-
-cam_clk_enable_err:
-	clk_unprepare(clk_ptr[i]);
-cam_clk_prepare_err:
-cam_clk_set_err:
-	clk_put(clk_ptr[i]);
-cam_clk_get_err:
-	for (i--; i >= 0; i--) {
-		if (clk_ptr[i] != NULL) {
-			clk_disable(clk_ptr[i]);
-			clk_unprepare(clk_ptr[i]);
-			clk_put(clk_ptr[i]);
-		}
-	}
-	return rc;
-}
-
-int msm_camera_config_vreg(struct device *dev, struct camera_vreg_t *cam_vreg,
-		int num_vreg, enum msm_camera_vreg_name_t *vreg_seq,
-		int num_vreg_seq, struct regulator **reg_ptr, int config)
-{
-	int i = 0, j = 0;
-	int rc = 0;
-	struct camera_vreg_t *curr_vreg;
-
-	if (num_vreg_seq > num_vreg) {
-		pr_err("%s:%d vreg sequence invalid\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	if (!num_vreg_seq)
-		num_vreg_seq = num_vreg;
-
-	if (config) {
-		for (i = 0; i < num_vreg_seq; i++) {
-			if (vreg_seq) {
-				j = vreg_seq[i];
-				if (j >= num_vreg)
-					continue;
-			} else
-				j = i;
-			curr_vreg = &cam_vreg[j];
-			reg_ptr[j] = regulator_get(dev,
-				curr_vreg->reg_name);
-			if (IS_ERR(reg_ptr[j])) {
-				pr_err("%s: %s get failed\n",
-					 __func__,
-					 curr_vreg->reg_name);
-				reg_ptr[j] = NULL;
-				goto vreg_get_fail;
-			}
-			if (curr_vreg->type == REG_LDO) {
-				rc = regulator_set_voltage(
-					reg_ptr[j],
-					curr_vreg->min_voltage,
-					curr_vreg->max_voltage);
-				if (rc < 0) {
-					pr_err("%s: %s set voltage failed\n",
-						__func__,
-						curr_vreg->reg_name);
-					goto vreg_set_voltage_fail;
-				}
-				if (curr_vreg->op_mode >= 0) {
-					rc = regulator_set_optimum_mode(
-						reg_ptr[j],
-						curr_vreg->op_mode);
-					if (rc < 0) {
-						pr_err(
-						"%s: %s set optimum mode failed\n",
-						__func__,
-						curr_vreg->reg_name);
-						goto vreg_set_opt_mode_fail;
-					}
-				}
-			}
-		}
-	} else {
-		for (i = num_vreg_seq-1; i >= 0; i--) {
-			if (vreg_seq) {
-				j = vreg_seq[i];
-				if (j >= num_vreg)
-					continue;
-			} else
-				j = i;
-			curr_vreg = &cam_vreg[j];
-			if (reg_ptr[j]) {
-				if (curr_vreg->type == REG_LDO) {
-					if (curr_vreg->op_mode >= 0) {
-						regulator_set_optimum_mode(
-							reg_ptr[j], 0);
-					}
-					regulator_set_voltage(
-						reg_ptr[j], 0, curr_vreg->
-						max_voltage);
-				}
-				regulator_put(reg_ptr[j]);
-				reg_ptr[j] = NULL;
-			}
-		}
-	}
-	return 0;
-
-vreg_unconfig:
-if (curr_vreg->type == REG_LDO)
-	regulator_set_optimum_mode(reg_ptr[j], 0);
-
-vreg_set_opt_mode_fail:
-if (curr_vreg->type == REG_LDO)
-	regulator_set_voltage(reg_ptr[j], 0,
-		curr_vreg->max_voltage);
-
-vreg_set_voltage_fail:
-	regulator_put(reg_ptr[j]);
-	reg_ptr[j] = NULL;
-
-vreg_get_fail:
-	for (i--; i >= 0; i--) {
-		if (vreg_seq) {
-			j = vreg_seq[i];
-			if (j >= num_vreg)
-				continue;
-		} else
-			j = i;
-		curr_vreg = &cam_vreg[j];
-		goto vreg_unconfig;
-	}
-	return -ENODEV;
-}
-
-int msm_camera_enable_vreg(struct device *dev, struct camera_vreg_t *cam_vreg,
-		int num_vreg, enum msm_camera_vreg_name_t *vreg_seq,
-		int num_vreg_seq, struct regulator **reg_ptr, int enable)
-{
-	int i = 0, j = 0, rc = 0;
-
-	if (num_vreg_seq > num_vreg) {
-		pr_err("%s:%d vreg sequence invalid\n", __func__, __LINE__);
-		return -EINVAL;
-	}
-	if (!num_vreg_seq)
-		num_vreg_seq = num_vreg;
-
-	if (enable) {
-		for (i = 0; i < num_vreg_seq; i++) {
-			if (vreg_seq) {
-				j = vreg_seq[i];
-				if (j >= num_vreg)
-					continue;
-			} else
-				j = i;
-			if (IS_ERR(reg_ptr[j])) {
-				pr_err("%s: %s null regulator\n",
-					__func__, cam_vreg[j].reg_name);
-				goto disable_vreg;
-			}
-			rc = regulator_enable(reg_ptr[j]);
-			if (rc < 0) {
-				pr_err("%s: %s enable failed\n",
-					__func__, cam_vreg[j].reg_name);
-				goto disable_vreg;
-			}
-			if (cam_vreg[j].delay > 20)
-				msleep(cam_vreg[j].delay);
-			else if (cam_vreg[j].delay)
-				usleep_range(cam_vreg[j].delay * 1000,
-					(cam_vreg[j].delay * 1000) + 1000);
-		}
-	} else {
-		for (i = num_vreg_seq-1; i >= 0; i--) {
-			if (vreg_seq) {
-				j = vreg_seq[i];
-				if (j >= num_vreg)
-					continue;
-			} else
-				j = i;
-			if (IS_ERR(reg_ptr[j])) {
-				pr_err("%s: %s null regulator\n",
-					__func__, cam_vreg[j].reg_name);
-				return -EINVAL;
-			}
-			regulator_disable(reg_ptr[j]);
-			if (cam_vreg[j].delay > 20)
-				msleep(cam_vreg[j].delay);
-			else if (cam_vreg[j].delay)
-				usleep_range(cam_vreg[j].delay * 1000,
-					(cam_vreg[j].delay * 1000) + 1000);
-		}
-	}
-	return rc;
-disable_vreg:
-	for (i--; i >= 0; i--) {
-		if (vreg_seq) {
-			j = vreg_seq[i];
-			if (j >= num_vreg)
-				continue;
-		} else
-			j = i;
-		if (IS_ERR(reg_ptr[j])) {
-			pr_err("%s: %s null regulator\n",
-				__func__, cam_vreg[j].reg_name);
-			return -EINVAL;
-		}
-		regulator_disable(reg_ptr[j]);
-		if (cam_vreg[j].delay > 20)
-			msleep(cam_vreg[j].delay);
-		else if (cam_vreg[j].delay)
-			usleep_range(cam_vreg[j].delay * 1000,
-				(cam_vreg[j].delay * 1000) + 1000);
-	}
-	return rc;
-}
-
-static int config_gpio_table(struct msm_camera_gpio_conf *gpio)
-{
-	int rc = 0, i = 0;
-	uint32_t *table_on;
-	uint32_t *table_off;
-	uint32_t len;
-
-	table_on = gpio->camera_on_table;
-	table_off = gpio->camera_off_table;
-	len = gpio->camera_on_table_size;
-
-	for (i = 0; i < len; i++) {
-		rc = gpio_tlmm_config(table_on[i], GPIO_CFG_ENABLE);
-		if (rc) {
-			pr_err("%s not able to get gpio\n", __func__);
-			for (i--; i >= 0; i--)
-				gpio_tlmm_config(table_off[i],
-					GPIO_CFG_ENABLE);
-			break;
-		}
-	}
-	return rc;
-}
-
-int msm_camera_request_gpio_table(struct msm_camera_sensor_info *sinfo,
-	int gpio_en)
-{
-	int rc = 0;
-	struct msm_camera_gpio_conf *gpio_conf =
-		sinfo->sensor_platform_info->gpio_conf;
-
-	if (!gpio_conf->gpio_no_mux) {
-		if (gpio_conf->cam_gpio_req_tbl == NULL ||
-			gpio_conf->cam_gpio_common_tbl == NULL) {
-			pr_err("%s: NULL camera gpio table\n", __func__);
-			return -EFAULT;
-		}
-	}
-	if (gpio_conf->gpio_no_mux)
-		config_gpio_table(gpio_conf);
-
-	if (gpio_en) {
-		if (!gpio_conf->gpio_no_mux && !gpio_ref_count) {
-			if (gpio_conf->cam_gpiomux_conf_tbl != NULL) {
-				msm_gpiomux_install(
-					(struct msm_gpiomux_config *)
-					gpio_conf->cam_gpiomux_conf_tbl,
-					gpio_conf->cam_gpiomux_conf_tbl_size);
-			}
-			rc = gpio_request_array(gpio_conf->cam_gpio_common_tbl,
-				gpio_conf->cam_gpio_common_tbl_size);
-			if (rc < 0) {
-				pr_err("%s common gpio request failed\n"
-						, __func__);
-				return rc;
-			}
-		}
-		gpio_ref_count++;
-		if (gpio_conf->cam_gpio_req_tbl_size) {
-			rc = gpio_request_array(gpio_conf->cam_gpio_req_tbl,
-				gpio_conf->cam_gpio_req_tbl_size);
-			if (rc < 0) {
-				pr_err("%s camera gpio"
-					"request failed\n", __func__);
-				gpio_free_array(gpio_conf->cam_gpio_common_tbl,
-					gpio_conf->cam_gpio_common_tbl_size);
-				return rc;
-			}
-		}
-	} else {
-		gpio_ref_count--;
-		gpio_free_array(gpio_conf->cam_gpio_req_tbl,
-				gpio_conf->cam_gpio_req_tbl_size);
-		if (!gpio_conf->gpio_no_mux && !gpio_ref_count)
-			gpio_free_array(gpio_conf->cam_gpio_common_tbl,
-				gpio_conf->cam_gpio_common_tbl_size);
-	}
-	return rc;
-}
-
-int msm_camera_config_gpio_table(struct msm_camera_sensor_info *sinfo,
-	int gpio_en)
-{
-	struct msm_camera_gpio_conf *gpio_conf =
-		sinfo->sensor_platform_info->gpio_conf;
-	int rc = 0, i;
-
-	if (gpio_en) {
-		for (i = 0; i < gpio_conf->cam_gpio_set_tbl_size; i++) {
-			gpio_set_value_cansleep(
-				gpio_conf->cam_gpio_set_tbl[i].gpio,
-				gpio_conf->cam_gpio_set_tbl[i].flags);
-			usleep_range(gpio_conf->cam_gpio_set_tbl[i].delay,
-				gpio_conf->cam_gpio_set_tbl[i].delay + 1000);
-		}
-	} else {
-		for (i = gpio_conf->cam_gpio_set_tbl_size - 1; i >= 0; i--) {
-			if (gpio_conf->cam_gpio_set_tbl[i].flags)
-				gpio_set_value_cansleep(
-					gpio_conf->cam_gpio_set_tbl[i].gpio,
-					GPIOF_OUT_INIT_LOW);
-		}
-	}
-	return rc;
-}
-
-void msm_camera_bus_scale_cfg(uint32_t bus_perf_client,
-		enum msm_bus_perf_setting perf_setting)
-{
-	int rc = 0;
-	if (!bus_perf_client) {
-		pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		return;
-	}
-
-	switch (perf_setting) {
-	case S_EXIT:
-		rc = msm_bus_scale_client_update_request(bus_perf_client, 1);
-		msm_bus_scale_unregister_client(bus_perf_client);
-		break;
-	case S_PREVIEW:
-		rc = msm_bus_scale_client_update_request(bus_perf_client, 1);
-		break;
-	case S_VIDEO:
-		rc = msm_bus_scale_client_update_request(bus_perf_client, 2);
-		break;
-	case S_CAPTURE:
-		rc = msm_bus_scale_client_update_request(bus_perf_client, 3);
-		break;
-	case S_ZSL:
-		rc = msm_bus_scale_client_update_request(bus_perf_client, 4);
-		break;
-	case S_LIVESHOT:
-		rc = msm_bus_scale_client_update_request(bus_perf_client, 5);
-		break;
-	case S_DEFAULT:
-		break;
-	default:
-		pr_warning("%s: INVALID CASE\n", __func__);
-	}
-}
diff --git a/drivers/media/video/msm/io/msm_io7x.c b/drivers/media/video/msm/io/msm_io7x.c
deleted file mode 100644
index ebdaeb1..0000000
--- a/drivers/media/video/msm/io/msm_io7x.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <mach/gpio.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <mach/clk.h>
-
-#define CAMIF_CFG_RMSK 0x1fffff
-#define CAM_SEL_BMSK 0x2
-#define CAM_PCLK_SRC_SEL_BMSK 0x60000
-#define CAM_PCLK_INVERT_BMSK 0x80000
-#define CAM_PAD_REG_SW_RESET_BMSK 0x100000
-
-#define EXT_CAM_HSYNC_POL_SEL_BMSK 0x10000
-#define EXT_CAM_VSYNC_POL_SEL_BMSK 0x8000
-#define MDDI_CLK_CHICKEN_BIT_BMSK  0x80
-
-#define CAM_SEL_SHFT 0x1
-#define CAM_PCLK_SRC_SEL_SHFT 0x11
-#define CAM_PCLK_INVERT_SHFT 0x13
-#define CAM_PAD_REG_SW_RESET_SHFT 0x14
-
-#define EXT_CAM_HSYNC_POL_SEL_SHFT 0x10
-#define EXT_CAM_VSYNC_POL_SEL_SHFT 0xF
-#define MDDI_CLK_CHICKEN_BIT_SHFT  0x7
-#define APPS_RESET_OFFSET 0x00000210
-
-static struct clk *camio_vfe_mdc_clk;
-static struct clk *camio_mdc_clk;
-static struct clk *camio_vfe_clk;
-
-static struct msm_camera_io_ext camio_ext;
-static struct resource *appio, *mdcio;
-void __iomem *appbase, *mdcbase;
-
-static struct resource *appio, *mdcio;
-void __iomem *appbase, *mdcbase;
-
-int msm_camio_clk_enable(enum msm_camio_clk_type clktype)
-{
-	int rc = -1;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_VFE_MDC_CLK:
-		clk = camio_vfe_mdc_clk = clk_get(NULL, "vfe_mdc_clk");
-		break;
-
-	case CAMIO_MDC_CLK:
-		clk = camio_mdc_clk = clk_get(NULL, "mdc_clk");
-		break;
-
-	case CAMIO_VFE_CLK:
-		clk = camio_vfe_clk = clk_get(NULL, "vfe_clk");
-		break;
-
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk)) {
-		clk_enable(clk);
-		rc = 0;
-	}
-
-	return rc;
-}
-
-int msm_camio_clk_disable(enum msm_camio_clk_type clktype)
-{
-	int rc = -1;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_VFE_MDC_CLK:
-		clk = camio_vfe_mdc_clk;
-		break;
-
-	case CAMIO_MDC_CLK:
-		clk = camio_mdc_clk;
-		break;
-
-	case CAMIO_VFE_CLK:
-		clk = camio_vfe_clk;
-		break;
-
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk)) {
-		clk_disable(clk);
-		clk_put(clk);
-		rc = 0;
-	}
-
-	return rc;
-}
-
-void msm_camio_clk_rate_set(int rate)
-{
-	struct clk *clk = camio_vfe_clk;
-
-	if (clk != ERR_PTR(-ENOENT))
-		clk_set_rate(clk, rate);
-}
-
-int msm_camio_enable(struct platform_device *pdev)
-{
-	int rc = 0;
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-
-	camio_ext = camdev->ioext;
-
-	appio = request_mem_region(camio_ext.appphy,
-		camio_ext.appsz, pdev->name);
-	if (!appio) {
-		rc = -EBUSY;
-		goto enable_fail;
-	}
-
-	appbase = ioremap(camio_ext.appphy,
-		camio_ext.appsz);
-	if (!appbase) {
-		rc = -ENOMEM;
-		goto apps_no_mem;
-	}
-
-	msm_camio_clk_enable(CAMIO_VFE_CLK);
-	msm_camio_clk_enable(CAMIO_MDC_CLK);
-	return 0;
-apps_no_mem:
-	release_mem_region(camio_ext.appphy, camio_ext.appsz);
-enable_fail:
-	return rc;
-}
-
-int msm_camio_sensor_clk_on(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	int32_t rc = 0;
-	camio_ext = camdev->ioext;
-	mdcio = request_mem_region(camio_ext.mdcphy,
-		camio_ext.mdcsz, pdev->name);
-	if (!mdcio)
-		rc = -EBUSY;
-	mdcbase = ioremap(camio_ext.mdcphy,
-		camio_ext.mdcsz);
-	if (!mdcbase) {
-		rc = -EINVAL;
-		goto mdc_no_mem;
-	}
-	camdev->camera_gpio_on();
-	return msm_camio_clk_enable(CAMIO_VFE_MDC_CLK);
-
-mdc_no_mem:
-	release_mem_region(camio_ext.mdcphy, camio_ext.mdcsz);
-	return rc;
-}
-
-int msm_camio_sensor_clk_off(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camdev->camera_gpio_off();
-	iounmap(mdcbase);
-	release_mem_region(camio_ext.mdcphy, camio_ext.mdcsz);
-	return msm_camio_clk_disable(CAMIO_VFE_MDC_CLK);
-}
-
-void msm_camio_disable(struct platform_device *pdev)
-{
-	iounmap(appbase);
-	release_mem_region(camio_ext.appphy, camio_ext.appsz);
-	msm_camio_clk_disable(CAMIO_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_MDC_CLK);
-}
-
-void msm_disable_io_gpio_clk(struct platform_device *pdev)
-{
-	return;
-}
-
-void msm_camio_camif_pad_reg_reset(void)
-{
-	uint32_t reg;
-	uint32_t mask, value;
-
-	/* select CLKRGM_VFE_SRC_CAM_VFE_SRC:  internal source */
-	msm_camio_clk_sel(MSM_CAMIO_CLK_SRC_INTERNAL);
-
-	reg = (msm_camera_io_r_mb(mdcbase)) & CAMIF_CFG_RMSK;
-
-	mask = CAM_SEL_BMSK |
-		CAM_PCLK_SRC_SEL_BMSK |
-		CAM_PCLK_INVERT_BMSK;
-
-	value = 1 << CAM_SEL_SHFT |
-		3 << CAM_PCLK_SRC_SEL_SHFT |
-		0 << CAM_PCLK_INVERT_SHFT;
-
-	msm_camera_io_w_mb((reg & (~mask)) | (value & mask), mdcbase);
-	usleep_range(10000, 11000);
-
-	reg = (msm_camera_io_r_mb(mdcbase)) & CAMIF_CFG_RMSK;
-	mask = CAM_PAD_REG_SW_RESET_BMSK;
-	value = 1 << CAM_PAD_REG_SW_RESET_SHFT;
-	msm_camera_io_w_mb((reg & (~mask)) | (value & mask), mdcbase);
-	usleep_range(10000, 11000);
-
-	reg = (msm_camera_io_r_mb(mdcbase)) & CAMIF_CFG_RMSK;
-	mask = CAM_PAD_REG_SW_RESET_BMSK;
-	value = 0 << CAM_PAD_REG_SW_RESET_SHFT;
-	msm_camera_io_w_mb((reg & (~mask)) | (value & mask), mdcbase);
-	usleep_range(10000, 11000);
-
-	msm_camio_clk_sel(MSM_CAMIO_CLK_SRC_EXTERNAL);
-	usleep_range(10000, 11000);
-}
-
-void msm_camio_vfe_blk_reset(void)
-{
-	uint32_t val;
-
-	/* do apps reset */
-	val = msm_camera_io_r_mb(appbase + 0x00000210);
-	val |= 0x1;
-	msm_camera_io_w_mb(val, appbase + 0x00000210);
-	usleep_range(10000, 11000);
-
-	val = msm_camera_io_r_mb(appbase + 0x00000210);
-	val &= ~0x1;
-	msm_camera_io_w_mb(val, appbase + 0x00000210);
-	usleep_range(10000, 11000);
-
-	/* do axi reset */
-	val = msm_camera_io_r_mb(appbase + 0x00000208);
-	val |= 0x1;
-	msm_camera_io_w_mb(val, appbase + 0x00000208);
-	usleep_range(10000, 11000);
-
-	val = msm_camera_io_r_mb(appbase + 0x00000208);
-	val &= ~0x1;
-	msm_camera_io_w_mb(val, appbase + 0x00000208);
-	usleep_range(10000, 11000);
-}
-
-void msm_camio_camif_pad_reg_reset_2(void)
-{
-	uint32_t reg;
-	uint32_t mask, value;
-
-	reg = (msm_camera_io_r_mb(mdcbase)) & CAMIF_CFG_RMSK;
-	mask = CAM_PAD_REG_SW_RESET_BMSK;
-	value = 1 << CAM_PAD_REG_SW_RESET_SHFT;
-	msm_camera_io_w_mb((reg & (~mask)) | (value & mask), mdcbase);
-	usleep_range(10000, 11000);
-
-	reg = (msm_camera_io_r_mb(mdcbase)) & CAMIF_CFG_RMSK;
-	mask = CAM_PAD_REG_SW_RESET_BMSK;
-	value = 0 << CAM_PAD_REG_SW_RESET_SHFT;
-	msm_camera_io_w_mb((reg & (~mask)) | (value & mask), mdcbase);
-	usleep_range(10000, 11000);
-}
-
-void msm_camio_clk_sel(enum msm_camio_clk_src_type srctype)
-{
-	struct clk *clk = NULL;
-
-	clk = camio_vfe_clk;
-
-	if (clk != NULL && clk != ERR_PTR(-ENOENT)) {
-		switch (srctype) {
-		case MSM_CAMIO_CLK_SRC_INTERNAL:
-			clk_set_flags(clk, 0x00000100 << 1);
-			break;
-
-		case MSM_CAMIO_CLK_SRC_EXTERNAL:
-			clk_set_flags(clk, 0x00000100);
-			break;
-
-		default:
-			break;
-		}
-	}
-}
-
-int msm_camio_probe_on(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camdev->camera_gpio_on();
-	return msm_camio_clk_enable(CAMIO_VFE_CLK);
-}
-
-int msm_camio_probe_off(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camdev->camera_gpio_off();
-	return msm_camio_clk_disable(CAMIO_VFE_CLK);
-}
diff --git a/drivers/media/video/msm/io/msm_io8x.c b/drivers/media/video/msm/io/msm_io8x.c
deleted file mode 100644
index dba93a0..0000000
--- a/drivers/media/video/msm/io/msm_io8x.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <mach/gpio.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <mach/clk.h>
-
-#define CAMIF_CFG_RMSK 0x1fffff
-#define CAM_SEL_BMSK 0x2
-#define CAM_PCLK_SRC_SEL_BMSK 0x60000
-#define CAM_PCLK_INVERT_BMSK 0x80000
-#define CAM_PAD_REG_SW_RESET_BMSK 0x100000
-
-#define EXT_CAM_HSYNC_POL_SEL_BMSK 0x10000
-#define EXT_CAM_VSYNC_POL_SEL_BMSK 0x8000
-#define MDDI_CLK_CHICKEN_BIT_BMSK  0x80
-
-#define CAM_SEL_SHFT 0x1
-#define CAM_PCLK_SRC_SEL_SHFT 0x11
-#define CAM_PCLK_INVERT_SHFT 0x13
-#define CAM_PAD_REG_SW_RESET_SHFT 0x14
-
-#define EXT_CAM_HSYNC_POL_SEL_SHFT 0x10
-#define EXT_CAM_VSYNC_POL_SEL_SHFT 0xF
-#define MDDI_CLK_CHICKEN_BIT_SHFT  0x7
-#define APPS_RESET_OFFSET 0x00000214
-
-static struct clk *camio_vfe_mdc_clk;
-static struct clk *camio_mdc_clk;
-static struct clk *camio_vfe_clk;
-static struct clk *camio_vfe_axi_clk;
-static struct msm_camera_io_ext camio_ext;
-static struct resource *appio, *mdcio;
-
-void __iomem *appbase, *mdcbase;
-
-
-int msm_camio_clk_enable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_VFE_MDC_CLK:
-		camio_vfe_mdc_clk = clk = clk_get(NULL, "vfe_mdc_clk");
-		break;
-
-	case CAMIO_MDC_CLK:
-		camio_mdc_clk = clk = clk_get(NULL, "mdc_clk");
-		break;
-
-	case CAMIO_VFE_CLK:
-		camio_vfe_clk = clk = clk_get(NULL, "vfe_clk");
-		break;
-
-	case CAMIO_VFE_AXI_CLK:
-		camio_vfe_axi_clk = clk = clk_get(NULL, "vfe_axi_clk");
-		break;
-
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk))
-		clk_enable(clk);
-	else
-		rc = -1;
-
-	return rc;
-}
-
-int msm_camio_clk_disable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_VFE_MDC_CLK:
-		clk = camio_vfe_mdc_clk;
-		break;
-
-	case CAMIO_MDC_CLK:
-		clk = camio_mdc_clk;
-		break;
-
-	case CAMIO_VFE_CLK:
-		clk = camio_vfe_clk;
-		break;
-
-	case CAMIO_VFE_AXI_CLK:
-		clk = camio_vfe_axi_clk;
-		break;
-
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk)) {
-		clk_disable(clk);
-		clk_put(clk);
-	} else
-		rc = -1;
-
-	return rc;
-}
-
-void msm_camio_clk_rate_set(int rate)
-{
-	struct clk *clk = camio_vfe_mdc_clk;
-
-	/* TODO: check return */
-	clk_set_rate(clk, rate);
-}
-
-int msm_camio_enable(struct platform_device *pdev)
-{
-	int rc = 0;
-
-	appio = request_mem_region(camio_ext.appphy,
-		camio_ext.appsz, pdev->name);
-	if (!appio) {
-		rc = -EBUSY;
-		goto enable_fail;
-	}
-
-	appbase = ioremap(camio_ext.appphy, camio_ext.appsz);
-	if (!appbase) {
-		rc = -ENOMEM;
-		goto apps_no_mem;
-	}
-	msm_camio_clk_enable(CAMIO_MDC_CLK);
-	msm_camio_clk_enable(CAMIO_VFE_AXI_CLK);
-	return 0;
-
-apps_no_mem:
-	release_mem_region(camio_ext.appphy, camio_ext.appsz);
-enable_fail:
-	return rc;
-}
-
-void msm_camio_disable(struct platform_device *pdev)
-{
-	iounmap(appbase);
-	release_mem_region(camio_ext.appphy, camio_ext.appsz);
-	msm_camio_clk_disable(CAMIO_MDC_CLK);
-	msm_camio_clk_disable(CAMIO_VFE_AXI_CLK);
-}
-
-int msm_camio_sensor_clk_on(struct platform_device *pdev)
-{
-
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	int32_t rc = 0;
-	camio_ext = camdev->ioext;
-
-	mdcio = request_mem_region(camio_ext.mdcphy,
-		camio_ext.mdcsz, pdev->name);
-	if (!mdcio)
-		rc = -EBUSY;
-	mdcbase = ioremap(camio_ext.mdcphy,
-		camio_ext.mdcsz);
-	if (!mdcbase)
-		goto mdc_no_mem;
-	camdev->camera_gpio_on();
-
-	msm_camio_clk_enable(CAMIO_VFE_CLK);
-	msm_camio_clk_enable(CAMIO_VFE_MDC_CLK);
-	return rc;
-
-
-mdc_no_mem:
-	release_mem_region(camio_ext.mdcphy, camio_ext.mdcsz);
-	return -EINVAL;
-}
-
-int msm_camio_sensor_clk_off(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camdev->camera_gpio_off();
-	iounmap(mdcbase);
-	release_mem_region(camio_ext.mdcphy, camio_ext.mdcsz);
-	msm_camio_clk_disable(CAMIO_VFE_CLK);
-	return msm_camio_clk_disable(CAMIO_VFE_MDC_CLK);
-
-}
-
-void msm_disable_io_gpio_clk(struct platform_device *pdev)
-{
-	return;
-}
-
-void msm_camio_camif_pad_reg_reset(void)
-{
-	uint32_t reg;
-	uint32_t mask, value;
-
-	/* select CLKRGM_VFE_SRC_CAM_VFE_SRC:  internal source */
-	msm_camio_clk_sel(MSM_CAMIO_CLK_SRC_INTERNAL);
-
-	reg = (msm_camera_io_r_mb(mdcbase)) & CAMIF_CFG_RMSK;
-
-	mask = CAM_SEL_BMSK |
-		CAM_PCLK_SRC_SEL_BMSK |
-		CAM_PCLK_INVERT_BMSK |
-		EXT_CAM_HSYNC_POL_SEL_BMSK |
-	    EXT_CAM_VSYNC_POL_SEL_BMSK | MDDI_CLK_CHICKEN_BIT_BMSK;
-
-	value = 1 << CAM_SEL_SHFT |
-		3 << CAM_PCLK_SRC_SEL_SHFT |
-		0 << CAM_PCLK_INVERT_SHFT |
-		0 << EXT_CAM_HSYNC_POL_SEL_SHFT |
-	    0 << EXT_CAM_VSYNC_POL_SEL_SHFT | 0 << MDDI_CLK_CHICKEN_BIT_SHFT;
-	msm_camera_io_w_mb((reg & (~mask)) | (value & mask), mdcbase);
-	usleep_range(10000, 11000);
-
-	reg = (msm_camera_io_r_mb(mdcbase)) & CAMIF_CFG_RMSK;
-	mask = CAM_PAD_REG_SW_RESET_BMSK;
-	value = 1 << CAM_PAD_REG_SW_RESET_SHFT;
-	msm_camera_io_w_mb((reg & (~mask)) | (value & mask), mdcbase);
-	usleep_range(10000, 11000);
-
-	reg = (msm_camera_io_r_mb(mdcbase)) & CAMIF_CFG_RMSK;
-	mask = CAM_PAD_REG_SW_RESET_BMSK;
-	value = 0 << CAM_PAD_REG_SW_RESET_SHFT;
-	msm_camera_io_w_mb((reg & (~mask)) | (value & mask), mdcbase);
-	usleep_range(10000, 11000);
-
-	msm_camio_clk_sel(MSM_CAMIO_CLK_SRC_EXTERNAL);
-
-	usleep_range(10000, 11000);
-
-	/* todo: check return */
-	if (camio_vfe_clk)
-		clk_set_rate(camio_vfe_clk, 96000000);
-}
-
-void msm_camio_vfe_blk_reset(void)
-{
-	uint32_t val;
-
-	val = msm_camera_io_r_mb(appbase + APPS_RESET_OFFSET);
-	val |= 0x1;
-	msm_camera_io_w_mb(val, appbase + APPS_RESET_OFFSET);
-	usleep_range(10000, 11000);
-
-	val = msm_camera_io_r_mb(appbase + APPS_RESET_OFFSET);
-	val &= ~0x1;
-	msm_camera_io_w_mb(val, appbase + APPS_RESET_OFFSET);
-	usleep_range(10000, 11000);
-}
-
-void msm_camio_camif_pad_reg_reset_2(void)
-{
-	uint32_t reg;
-	uint32_t mask, value;
-
-	reg = (msm_camera_io_r_mb(mdcbase)) & CAMIF_CFG_RMSK;
-	mask = CAM_PAD_REG_SW_RESET_BMSK;
-	value = 1 << CAM_PAD_REG_SW_RESET_SHFT;
-	msm_camera_io_w_mb((reg & (~mask)) | (value & mask), mdcbase);
-	usleep_range(10000, 11000);
-
-	reg = (msm_camera_io_r_mb(mdcbase)) & CAMIF_CFG_RMSK;
-	mask = CAM_PAD_REG_SW_RESET_BMSK;
-	value = 0 << CAM_PAD_REG_SW_RESET_SHFT;
-	msm_camera_io_w_mb((reg & (~mask)) | (value & mask), mdcbase);
-	usleep_range(10000, 11000);
-}
-
-void msm_camio_clk_sel(enum msm_camio_clk_src_type srctype)
-{
-	struct clk *clk = NULL;
-
-	clk = camio_vfe_clk;
-
-	if (clk != NULL) {
-		switch (srctype) {
-		case MSM_CAMIO_CLK_SRC_INTERNAL:
-			clk_set_flags(clk, 0x00000100 << 1);
-			break;
-
-		case MSM_CAMIO_CLK_SRC_EXTERNAL:
-			clk_set_flags(clk, 0x00000100);
-			break;
-
-		default:
-			break;
-		}
-	}
-}
-
-void msm_camio_clk_axi_rate_set(int rate)
-{
-	struct clk *clk = camio_vfe_axi_clk;
-	/* todo: check return */
-	clk_set_rate(clk, rate);
-}
-
-int msm_camio_probe_on(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-
-	camdev->camera_gpio_on();
-	return msm_camio_clk_enable(CAMIO_VFE_MDC_CLK);
-}
-
-int msm_camio_probe_off(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-
-	camdev->camera_gpio_off();
-	return msm_camio_clk_disable(CAMIO_VFE_MDC_CLK);
-}
diff --git a/drivers/media/video/msm/io/msm_io_7x27a.c b/drivers/media/video/msm/io/msm_io_7x27a.c
deleted file mode 100644
index 6e70d37..0000000
--- a/drivers/media/video/msm/io/msm_io_7x27a.c
+++ /dev/null
@@ -1,595 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/pm_qos.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <mach/camera.h>
-#include <mach/clk.h>
-#include <mach/msm_bus.h>
-#include <mach/msm_bus_board.h>
-
-
-/* MIPI	CSI controller registers */
-#define	MIPI_PHY_CONTROL		0x00000000
-#define	MIPI_PROTOCOL_CONTROL		0x00000004
-#define	MIPI_INTERRUPT_STATUS		0x00000008
-#define	MIPI_INTERRUPT_MASK		0x0000000C
-#define	MIPI_CAMERA_CNTL		0x00000024
-#define	MIPI_CALIBRATION_CONTROL	0x00000018
-#define	MIPI_PHY_D0_CONTROL2		0x00000038
-#define	MIPI_PHY_D1_CONTROL2		0x0000003C
-#define	MIPI_PHY_D2_CONTROL2		0x00000040
-#define	MIPI_PHY_D3_CONTROL2		0x00000044
-#define	MIPI_PHY_CL_CONTROL		0x00000048
-#define	MIPI_PHY_D0_CONTROL		0x00000034
-#define	MIPI_PHY_D1_CONTROL		0x00000020
-#define	MIPI_PHY_D2_CONTROL		0x0000002C
-#define	MIPI_PHY_D3_CONTROL		0x00000030
-#define	MIPI_PWR_CNTL			0x00000054
-
-/*
- * MIPI_PROTOCOL_CONTROL register bits to enable/disable the features of
- * CSI Rx Block
- */
-
-/* DPCM scheme */
-#define	MIPI_PROTOCOL_CONTROL_DPCM_SCHEME_SHFT			0x1e
-/* SW_RST to issue a SW reset to the CSI core */
-#define	MIPI_PROTOCOL_CONTROL_SW_RST_BMSK			0x8000000
-/* To Capture Long packet Header Info in MIPI_PROTOCOL_STATUS register */
-#define	MIPI_PROTOCOL_CONTROL_LONG_PACKET_HEADER_CAPTURE_BMSK	0x200000
-/* Data format for unpacking purpose */
-#define	MIPI_PROTOCOL_CONTROL_DATA_FORMAT_SHFT			0x13
-/* Enable decoding of payload based on data type filed of packet hdr */
-#define	MIPI_PROTOCOL_CONTROL_DECODE_ID_BMSK			0x00000
-/* Enable error correction on packet headers */
-#define	MIPI_PROTOCOL_CONTROL_ECC_EN_BMSK			0x20000
-
-/*
- * MIPI_CALIBRATION_CONTROL register contains control info for
- * calibration impledence controller
-*/
-
-/* Enable bit for calibration pad */
-#define	MIPI_CALIBRATION_CONTROL_SWCAL_CAL_EN_SHFT		0x16
-/* With SWCAL_STRENGTH_OVERRIDE_EN, SW_CAL_EN and MANUAL_OVERRIDE_EN
- * the hardware calibration circuitry associated with CAL_SW_HW_MODE
- * is bypassed
-*/
-#define	MIPI_CALIBRATION_CONTROL_SWCAL_STRENGTH_OVERRIDE_EN_SHFT	0x15
-/* To indicate the Calibration process is in the control of HW/SW */
-#define	MIPI_CALIBRATION_CONTROL_CAL_SW_HW_MODE_SHFT		0x14
-/* When this is set the strength value of the data and clk lane impedence
- * termination is updated with MANUAL_STRENGTH settings and calibration
- * sensing logic is idle.
-*/
-#define	MIPI_CALIBRATION_CONTROL_MANUAL_OVERRIDE_EN_SHFT	0x7
-
-/* Data lane0 control */
-/* T-hs Settle count value  for Rx */
-#define	MIPI_PHY_D0_CONTROL2_SETTLE_COUNT_SHFT			0x18
-/* Rx termination control */
-#define	MIPI_PHY_D0_CONTROL2_HS_TERM_IMP_SHFT			0x10
-/* LP Rx enable */
-#define	MIPI_PHY_D0_CONTROL2_LP_REC_EN_SHFT			0x4
-/*
- * Enable for error in sync sequence
- * 1 - one bit error in sync seq
- * 0 - requires all 8 bit correct seq
-*/
-#define	MIPI_PHY_D0_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-
-/* Comments are same as D0 */
-#define	MIPI_PHY_D1_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D1_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D1_CONTROL2_LP_REC_EN_SHFT			0x4
-#define	MIPI_PHY_D1_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-
-/* Comments are same as D0 */
-#define	MIPI_PHY_D2_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D2_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D2_CONTROL2_LP_REC_EN_SHFT			0x4
-#define	MIPI_PHY_D2_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-
-/* Comments are same as D0 */
-#define	MIPI_PHY_D3_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D3_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D3_CONTROL2_LP_REC_EN_SHFT			0x4
-#define	MIPI_PHY_D3_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-
-/* PHY_CL_CTRL programs the parameters of clk lane of CSIRXPHY */
-/* HS Rx termination control */
-#define	MIPI_PHY_CL_CONTROL_HS_TERM_IMP_SHFT			0x18
-/* Start signal for T-hs delay */
-#define	MIPI_PHY_CL_CONTROL_LP_REC_EN_SHFT			0x2
-
-/* PHY DATA lane 0 control */
-/*
- * HS RX equalizer strength control
- * 00 - 0db 01 - 3db 10 - 5db 11 - 7db
-*/
-#define	MIPI_PHY_D0_CONTROL_HS_REC_EQ_SHFT			0x1c
-
-/* PHY DATA lane 1 control */
-/* Shutdown signal for MIPI clk phy line */
-#define	MIPI_PHY_D1_CONTROL_MIPI_CLK_PHY_SHUTDOWNB_SHFT		0x9
-/* Shutdown signal for MIPI data phy line */
-#define	MIPI_PHY_D1_CONTROL_MIPI_DATA_PHY_SHUTDOWNB_SHFT	0x8
-
-#define MSM_AXI_QOS_PREVIEW 200000
-#define MSM_AXI_QOS_SNAPSHOT 200000
-#define MSM_AXI_QOS_RECORDING 200000
-
-#define MIPI_PWR_CNTL_ENA	0x07
-#define MIPI_PWR_CNTL_DIS	0x0
-
-static struct clk *camio_cam_clk;
-static struct clk *camio_vfe_clk;
-static struct clk *camio_csi_src_clk;
-static struct clk *camio_csi0_vfe_clk;
-static struct clk *camio_csi1_vfe_clk;
-static struct clk *camio_csi0_clk;
-static struct clk *camio_csi1_clk;
-static struct clk *camio_csi0_pclk;
-static struct clk *camio_csi1_pclk;
-
-static struct msm_camera_io_ext camio_ext;
-static struct msm_camera_io_clk camio_clk;
-static struct platform_device *camio_dev;
-void __iomem *csibase;
-void __iomem *appbase;
-
-
-int msm_camio_vfe_clk_rate_set(int rate)
-{
-	int rc = 0;
-	struct clk *clk = camio_vfe_clk;
-	if (rate > clk_get_rate(clk))
-		rc = clk_set_rate(clk, rate);
-	return rc;
-}
-
-int msm_camio_clk_enable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_CAM_MCLK_CLK:
-		clk = clk_get(NULL, "cam_m_clk");
-		camio_cam_clk = clk;
-		msm_camio_clk_rate_set_2(clk, camio_clk.mclk_clk_rate);
-		break;
-	case CAMIO_VFE_CLK:
-		clk = clk_get(NULL, "vfe_clk");
-		camio_vfe_clk = clk;
-		msm_camio_clk_rate_set_2(clk, camio_clk.vfe_clk_rate);
-		break;
-	case CAMIO_CSI0_VFE_CLK:
-		clk = clk_get(&camio_dev->dev, "csi_vfe_clk");
-		camio_csi0_vfe_clk = clk;
-		break;
-	case CAMIO_CSI1_VFE_CLK:
-		clk = clk_get(NULL, "csi_vfe_clk");
-		camio_csi1_vfe_clk = clk;
-		break;
-	case CAMIO_CSI_SRC_CLK:
-		clk = clk_get(NULL, "csi_src_clk");
-		camio_csi_src_clk = clk;
-		break;
-	case CAMIO_CSI0_CLK:
-		clk = clk_get(&camio_dev->dev, "csi_clk");
-		camio_csi0_clk = clk;
-		msm_camio_clk_rate_set_2(clk, 400000000);
-		break;
-	case CAMIO_CSI1_CLK:
-		clk = clk_get(NULL, "csi_clk");
-		camio_csi1_clk = clk;
-		break;
-	case CAMIO_CSI0_PCLK:
-		clk = clk_get(&camio_dev->dev, "csi_pclk");
-		camio_csi0_pclk = clk;
-		break;
-	case CAMIO_CSI1_PCLK:
-		clk = clk_get(NULL, "csi_pclk");
-		camio_csi1_pclk = clk;
-		break;
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk))
-		clk_enable(clk);
-	else
-		rc = -1;
-	return rc;
-}
-
-int msm_camio_clk_disable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_CAM_MCLK_CLK:
-		clk = camio_cam_clk;
-		break;
-	case CAMIO_VFE_CLK:
-		clk = camio_vfe_clk;
-		break;
-	case CAMIO_CSI_SRC_CLK:
-		clk = camio_csi_src_clk;
-		break;
-	case CAMIO_CSI0_VFE_CLK:
-		clk = camio_csi0_vfe_clk;
-		break;
-	case CAMIO_CSI1_VFE_CLK:
-		clk = camio_csi1_vfe_clk;
-		break;
-	case CAMIO_CSI0_CLK:
-		clk = camio_csi0_clk;
-		break;
-	case CAMIO_CSI1_CLK:
-		clk = camio_csi1_clk;
-		break;
-	case CAMIO_CSI0_PCLK:
-		clk = camio_csi0_pclk;
-		break;
-	case CAMIO_CSI1_PCLK:
-		clk = camio_csi1_pclk;
-		break;
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk)) {
-		clk_disable(clk);
-		clk_put(clk);
-	} else
-		rc = -1;
-	return rc;
-}
-
-void msm_camio_clk_rate_set(int rate)
-{
-	struct clk *clk = camio_cam_clk;
-	clk_set_rate(clk, rate);
-}
-
-void msm_camio_clk_rate_set_2(struct clk *clk, int rate)
-{
-	clk_set_rate(clk, rate);
-}
-
-static irqreturn_t msm_io_csi_irq(int irq_num, void *data)
-{
-	uint32_t irq;
-
-	irq = msm_camera_io_r(csibase + MIPI_INTERRUPT_STATUS);
-	CDBG("%s MIPI_INTERRUPT_STATUS = 0x%x\n", __func__, irq);
-	msm_camera_io_w(irq, csibase + MIPI_INTERRUPT_STATUS);
-
-	/* TODO: Needs to send this info to upper layers */
-	if ((irq >> 19) & 0x1)
-		pr_info("Unsupported packet format is received\n");
-	return IRQ_HANDLED;
-}
-
-int msm_camio_enable(struct platform_device *pdev)
-{
-	int rc = 0;
-	const struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	uint32_t val;
-
-	camio_dev = pdev;
-	camio_ext = camdev->ioext;
-	camio_clk = camdev->ioclk;
-
-	msm_camio_clk_enable(CAMIO_VFE_CLK);
-	msm_camio_clk_enable(CAMIO_CSI0_VFE_CLK);
-	msm_camio_clk_enable(CAMIO_CSI1_VFE_CLK);
-	msm_camio_clk_enable(CAMIO_CSI0_CLK);
-	msm_camio_clk_enable(CAMIO_CSI1_CLK);
-	msm_camio_clk_enable(CAMIO_CSI0_PCLK);
-	msm_camio_clk_enable(CAMIO_CSI1_PCLK);
-
-	csibase = ioremap(camio_ext.csiphy, camio_ext.csisz);
-	if (!csibase) {
-		rc = -ENOMEM;
-		goto csi_busy;
-	}
-	rc = request_irq(camio_ext.csiirq, msm_io_csi_irq,
-				IRQF_TRIGGER_RISING, "csi", 0);
-	if (rc < 0)
-		goto csi_irq_fail;
-
-	msleep(20);
-	val = (20 <<
-		MIPI_PHY_D0_CONTROL2_SETTLE_COUNT_SHFT) |
-		(0x0F << MIPI_PHY_D0_CONTROL2_HS_TERM_IMP_SHFT) |
-		(0x0 << MIPI_PHY_D0_CONTROL2_LP_REC_EN_SHFT) |
-		(0x1 << MIPI_PHY_D0_CONTROL2_ERR_SOT_HS_EN_SHFT);
-	CDBG("%s MIPI_PHY_D0_CONTROL2 val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D0_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D1_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D2_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D3_CONTROL2);
-
-	val = (0x0F << MIPI_PHY_CL_CONTROL_HS_TERM_IMP_SHFT) |
-		(0x0 << MIPI_PHY_CL_CONTROL_LP_REC_EN_SHFT);
-	CDBG("%s MIPI_PHY_CL_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PHY_CL_CONTROL);
-
-	appbase = ioremap(camio_ext.appphy,
-		camio_ext.appsz);
-	if (!appbase) {
-		rc = -ENOMEM;
-		goto csi_irq_fail;
-	}
-	return 0;
-
-csi_irq_fail:
-	iounmap(csibase);
-csi_busy:
-	msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
-	msm_camio_clk_disable(CAMIO_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_CSI0_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_CSI1_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_CSI0_CLK);
-	msm_camio_clk_disable(CAMIO_CSI1_CLK);
-	msm_camio_clk_disable(CAMIO_CSI0_PCLK);
-	msm_camio_clk_disable(CAMIO_CSI1_PCLK);
-	camdev->camera_gpio_off();
-	return rc;
-}
-
-void msm_camio_disable(struct platform_device *pdev)
-{
-	uint32_t val;
-
-	val = (20 <<
-		MIPI_PHY_D0_CONTROL2_SETTLE_COUNT_SHFT) |
-		(0x0F << MIPI_PHY_D0_CONTROL2_HS_TERM_IMP_SHFT) |
-		(0x0 << MIPI_PHY_D0_CONTROL2_LP_REC_EN_SHFT) |
-		(0x1 << MIPI_PHY_D0_CONTROL2_ERR_SOT_HS_EN_SHFT);
-	CDBG("%s MIPI_PHY_D0_CONTROL2 val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D0_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D1_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D2_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D3_CONTROL2);
-
-	val = (0x0F << MIPI_PHY_CL_CONTROL_HS_TERM_IMP_SHFT) |
-		(0x0 << MIPI_PHY_CL_CONTROL_LP_REC_EN_SHFT);
-	CDBG("%s MIPI_PHY_CL_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PHY_CL_CONTROL);
-	msleep(20);
-
-	free_irq(camio_ext.csiirq, 0);
-	iounmap(csibase);
-	iounmap(appbase);
-	CDBG("disable clocks\n");
-
-	msm_camio_clk_disable(CAMIO_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_CSI0_CLK);
-	msm_camio_clk_disable(CAMIO_CSI1_CLK);
-	msm_camio_clk_disable(CAMIO_CSI0_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_CSI1_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_CSI0_PCLK);
-	msm_camio_clk_disable(CAMIO_CSI1_PCLK);
-}
-
-int msm_camio_sensor_clk_on(struct platform_device *pdev)
-{
-	int rc = 0;
-	const struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camio_dev = pdev;
-	camio_ext = camdev->ioext;
-	camio_clk = camdev->ioclk;
-
-	rc = camdev->camera_gpio_on();
-	if (rc < 0)
-		return rc;
-	return msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
-}
-
-int msm_camio_sensor_clk_off(struct platform_device *pdev)
-{
-	const struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camdev->camera_gpio_off();
-	return msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
-
-}
-
-void msm_camio_vfe_blk_reset(void)
-{
-	uint32_t val;
-
-	/* do apps reset */
-	val = msm_camera_io_r(appbase + 0x00000210);
-	val |= 0x1;
-	msm_camera_io_w(val, appbase + 0x00000210);
-	usleep_range(10000, 11000);
-
-	val = msm_camera_io_r(appbase + 0x00000210);
-	val &= ~0x1;
-	msm_camera_io_w(val, appbase + 0x00000210);
-	usleep_range(10000, 11000);
-
-	/* do axi reset */
-	val = msm_camera_io_r(appbase + 0x00000208);
-	val |= 0x1;
-	msm_camera_io_w(val, appbase + 0x00000208);
-	usleep_range(10000, 11000);
-
-	val = msm_camera_io_r(appbase + 0x00000208);
-	val &= ~0x1;
-	msm_camera_io_w(val, appbase + 0x00000208);
-	mb();
-	usleep_range(10000, 11000);
-	return;
-}
-
-int msm_camio_probe_on(struct platform_device *pdev)
-{
-	int rc = 0;
-	const struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camio_dev = pdev;
-	camio_ext = camdev->ioext;
-	camio_clk = camdev->ioclk;
-
-	msm_camio_clk_enable(CAMIO_CSI0_PCLK);
-	msm_camio_clk_enable(CAMIO_CSI1_PCLK);
-
-	rc = camdev->camera_gpio_on();
-	if (rc < 0)
-		return rc;
-	return msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
-}
-
-int msm_camio_probe_off(struct platform_device *pdev)
-{
-	const struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camdev->camera_gpio_off();
-
-	csibase = ioremap(camdev->ioext.csiphy, camdev->ioext.csisz);
-	if (!csibase) {
-		pr_err("ioremap failed for CSIBASE\n");
-		goto ioremap_fail;
-	}
-	msm_camera_io_w(MIPI_PWR_CNTL_DIS, csibase + MIPI_PWR_CNTL);
-	iounmap(csibase);
-ioremap_fail:
-	msm_camio_clk_disable(CAMIO_CSI0_PCLK);
-	msm_camio_clk_disable(CAMIO_CSI1_PCLK);
-	return msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
-}
-
-int msm_camio_csi_config(struct msm_camera_csi_params *csi_params)
-{
-	int rc = 0;
-	uint32_t val = 0;
-
-	CDBG("msm_camio_csi_config\n");
-
-	/* Enable error correction for DATA lane. Applies to all data lanes */
-	msm_camera_io_w(0x4, csibase + MIPI_PHY_CONTROL);
-
-	msm_camera_io_w(MIPI_PROTOCOL_CONTROL_SW_RST_BMSK,
-		csibase + MIPI_PROTOCOL_CONTROL);
-
-	val = MIPI_PROTOCOL_CONTROL_LONG_PACKET_HEADER_CAPTURE_BMSK |
-		MIPI_PROTOCOL_CONTROL_DECODE_ID_BMSK |
-		MIPI_PROTOCOL_CONTROL_ECC_EN_BMSK;
-	val |= (uint32_t)(csi_params->data_format) <<
-		MIPI_PROTOCOL_CONTROL_DATA_FORMAT_SHFT;
-	val |= csi_params->dpcm_scheme <<
-		MIPI_PROTOCOL_CONTROL_DPCM_SCHEME_SHFT;
-	CDBG("%s MIPI_PROTOCOL_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PROTOCOL_CONTROL);
-
-	val = (0x1 << MIPI_CALIBRATION_CONTROL_SWCAL_CAL_EN_SHFT) |
-		(0x1 <<
-		MIPI_CALIBRATION_CONTROL_SWCAL_STRENGTH_OVERRIDE_EN_SHFT) |
-		(0x1 << MIPI_CALIBRATION_CONTROL_CAL_SW_HW_MODE_SHFT) |
-		(0x1 << MIPI_CALIBRATION_CONTROL_MANUAL_OVERRIDE_EN_SHFT);
-	CDBG("%s MIPI_CALIBRATION_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_CALIBRATION_CONTROL);
-
-	val = (csi_params->settle_cnt <<
-		MIPI_PHY_D0_CONTROL2_SETTLE_COUNT_SHFT) |
-		(0x0F << MIPI_PHY_D0_CONTROL2_HS_TERM_IMP_SHFT) |
-		(0x1 << MIPI_PHY_D0_CONTROL2_LP_REC_EN_SHFT) |
-		(0x1 << MIPI_PHY_D0_CONTROL2_ERR_SOT_HS_EN_SHFT);
-	CDBG("%s MIPI_PHY_D0_CONTROL2 val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D0_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D1_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D2_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D3_CONTROL2);
-
-
-	val = (0x0F << MIPI_PHY_CL_CONTROL_HS_TERM_IMP_SHFT) |
-		(0x1 << MIPI_PHY_CL_CONTROL_LP_REC_EN_SHFT);
-	CDBG("%s MIPI_PHY_CL_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PHY_CL_CONTROL);
-
-	val = 0 << MIPI_PHY_D0_CONTROL_HS_REC_EQ_SHFT;
-	msm_camera_io_w(val, csibase + MIPI_PHY_D0_CONTROL);
-
-	val = (0x1 << MIPI_PHY_D1_CONTROL_MIPI_CLK_PHY_SHUTDOWNB_SHFT) |
-		(0x1 << MIPI_PHY_D1_CONTROL_MIPI_DATA_PHY_SHUTDOWNB_SHFT);
-	CDBG("%s MIPI_PHY_D1_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D1_CONTROL);
-
-	msm_camera_io_w(0x00000000, csibase + MIPI_PHY_D2_CONTROL);
-	msm_camera_io_w(0x00000000, csibase + MIPI_PHY_D3_CONTROL);
-
-	/* program number of lanes and lane mapping */
-	switch (csi_params->lane_cnt) {
-	case 1:
-		msm_camera_io_w(csi_params->lane_assign << 8 | 0x4,
-			csibase + MIPI_CAMERA_CNTL);
-		break;
-	case 2:
-		msm_camera_io_w(csi_params->lane_assign << 8 | 0x5,
-			csibase + MIPI_CAMERA_CNTL);
-		break;
-	case 3:
-		msm_camera_io_w(csi_params->lane_assign << 8 | 0x6,
-			csibase + MIPI_CAMERA_CNTL);
-		break;
-	case 4:
-		msm_camera_io_w(csi_params->lane_assign << 8 | 0x7,
-			csibase + MIPI_CAMERA_CNTL);
-		break;
-	}
-
-	msm_camera_io_w(0xFFFFF3FF, csibase + MIPI_INTERRUPT_MASK);
-	/*clear IRQ bits - write 1 clears the status*/
-	msm_camera_io_w(0xFFFFF3FF, csibase + MIPI_INTERRUPT_STATUS);
-
-	return rc;
-}
-
-void msm_camio_set_perf_lvl(enum msm_bus_perf_setting perf_setting)
-{
-	switch (perf_setting) {
-	case S_INIT:
-		add_axi_qos();
-		break;
-	case S_PREVIEW:
-		update_axi_qos(MSM_AXI_QOS_PREVIEW);
-		break;
-	case S_VIDEO:
-		update_axi_qos(MSM_AXI_QOS_RECORDING);
-		break;
-	case S_CAPTURE:
-		update_axi_qos(MSM_AXI_QOS_SNAPSHOT);
-		break;
-	case S_DEFAULT:
-		update_axi_qos(PM_QOS_DEFAULT_VALUE);
-		break;
-	case S_EXIT:
-		release_axi_qos();
-		break;
-	default:
-		CDBG("%s: INVALID CASE\n", __func__);
-	}
-}
diff --git a/drivers/media/video/msm/io/msm_io_7x27a_v4l2.c b/drivers/media/video/msm/io/msm_io_7x27a_v4l2.c
deleted file mode 100644
index 483b4a6..0000000
--- a/drivers/media/video/msm/io/msm_io_7x27a_v4l2.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/pm_qos.h>
-#include <linux/module.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <mach/camera.h>
-#include <mach/clk.h>
-#include <mach/msm_bus.h>
-#include <mach/msm_bus_board.h>
-#include <mach/dal_axi.h>
-
-#define MSM_AXI_QOS_PREVIEW 200000
-#define MSM_AXI_QOS_SNAPSHOT 200000
-#define MSM_AXI_QOS_RECORDING 200000
-
-static struct clk *camio_cam_clk;
-static struct resource *clk_ctrl_mem;
-static struct msm_camera_io_clk camio_clk;
-static int apps_reset;
-void __iomem *appbase;
-
-void msm_camio_clk_rate_set_2(struct clk *clk, int rate)
-{
-	clk_set_rate(clk, rate);
-}
-int msm_camio_clk_enable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_CAM_MCLK_CLK:
-		clk = clk_get(NULL, "cam_m_clk");
-		camio_cam_clk = clk;
-		msm_camio_clk_rate_set_2(clk, camio_clk.mclk_clk_rate);
-		break;
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk))
-		clk_enable(clk);
-	else
-		rc = -1;
-	return rc;
-}
-
-int msm_camio_clk_disable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_CAM_MCLK_CLK:
-		clk = camio_cam_clk;
-		break;
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk)) {
-		clk_disable(clk);
-		clk_put(clk);
-	} else
-		rc = -1;
-	return rc;
-}
-
-void msm_camio_clk_rate_set(int rate)
-{
-	struct clk *clk = camio_cam_clk;
-	clk_set_rate(clk, rate);
-}
-
-void msm_camio_vfe_blk_reset_2(void)
-{
-	uint32_t val;
-
-	/* do apps reset */
-	val = readl_relaxed(appbase + 0x00000210);
-	val |= 0x1;
-	writel_relaxed(val, appbase + 0x00000210);
-	usleep_range(10000, 11000);
-
-	val = readl_relaxed(appbase + 0x00000210);
-	val &= ~0x1;
-	writel_relaxed(val, appbase + 0x00000210);
-	usleep_range(10000, 11000);
-
-	/* do axi reset */
-	val = readl_relaxed(appbase + 0x00000208);
-	val |= 0x1;
-	writel_relaxed(val, appbase + 0x00000208);
-	usleep_range(10000, 11000);
-
-	val = readl_relaxed(appbase + 0x00000208);
-	val &= ~0x1;
-	writel_relaxed(val, appbase + 0x00000208);
-	mb();
-	usleep_range(10000, 11000);
-}
-
-void msm_camio_vfe_blk_reset_3(void)
-{
-	uint32_t val;
-
-	if (!apps_reset)
-		return;
-
-	/* do apps reset */
-	val = readl_relaxed(appbase + 0x00000210);
-	val |= 0x10A0000;
-	writel_relaxed(val, appbase + 0x00000210);
-	usleep_range(10000, 11000);
-
-	val = readl_relaxed(appbase + 0x00000210);
-	val &= ~(0x10A0000);
-	writel_relaxed(val, appbase + 0x00000210);
-	usleep_range(10000, 11000);
-	mb();
-}
-
-void msm_camio_set_perf_lvl(enum msm_bus_perf_setting perf_setting)
-{
-	switch (perf_setting) {
-	case S_INIT:
-		add_axi_qos();
-		break;
-	case S_PREVIEW:
-		update_axi_qos(MSM_AXI_QOS_PREVIEW);
-		axi_allocate(AXI_FLOW_VIEWFINDER_HI);
-		break;
-	case S_VIDEO:
-		update_axi_qos(MSM_AXI_QOS_RECORDING);
-		break;
-	case S_CAPTURE:
-		update_axi_qos(MSM_AXI_QOS_SNAPSHOT);
-		break;
-	case S_DEFAULT:
-		update_axi_qos(PM_QOS_DEFAULT_VALUE);
-		break;
-	case S_EXIT:
-		axi_free(AXI_FLOW_VIEWFINDER_HI);
-		release_axi_qos();
-		break;
-	default:
-		CDBG("%s: INVALID CASE\n", __func__);
-	}
-}
-
-static int __devinit clkctl_probe(struct platform_device *pdev)
-{
-	int rc = 0;
-
-	apps_reset = *(int *)pdev->dev.platform_data;
-	clk_ctrl_mem = platform_get_resource_byname(pdev,
-					IORESOURCE_MEM, "clk_ctl");
-	if (!clk_ctrl_mem) {
-		pr_err("%s: no mem resource:3?\n", __func__);
-		return -ENODEV;
-	}
-
-	appbase = ioremap(clk_ctrl_mem->start,
-		resource_size(clk_ctrl_mem));
-	if (!appbase) {
-		pr_err("clkctl_probe: appbase:err\n");
-		rc = -ENOMEM;
-		goto ioremap_fail;
-	}
-	return 0;
-
-ioremap_fail:
-	msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
-	return rc;
-}
-
-static int clkctl_remove(struct platform_device *pdev)
-{
-	if (clk_ctrl_mem)
-		iounmap(clk_ctrl_mem);
-
-	return 0;
-}
-
-static struct platform_driver clkctl_driver = {
-	.probe  = clkctl_probe,
-	.remove = clkctl_remove,
-	.driver = {
-		.name = "msm_clk_ctl",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init msm_clkctl_init_module(void)
-{
-	return platform_driver_register(&clkctl_driver);
-}
-
-static void __exit msm_clkctl_exit_module(void)
-{
-	platform_driver_unregister(&clkctl_driver);
-}
-
-module_init(msm_clkctl_init_module);
-module_exit(msm_clkctl_exit_module);
-MODULE_DESCRIPTION("CAM IO driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/io/msm_io_8960.c b/drivers/media/video/msm/io/msm_io_8960.c
deleted file mode 100644
index 6ddd701..0000000
--- a/drivers/media/video/msm/io/msm_io_8960.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/regulator/consumer.h>
-#include <linux/mfd/pm8xxx/pm8921.h>
-#include <mach/gpio.h>
-#include <mach/gpiomux.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <mach/vreg.h>
-#include <mach/camera.h>
-#include <mach/clk.h>
-#include <mach/msm_bus.h>
-#include <mach/msm_bus_board.h>
-
-#define BUFF_SIZE_128 128
-
-void msm_camio_clk_rate_set_2(struct clk *clk, int rate)
-{
-	clk_set_rate(clk, rate);
-}
-
-void msm_camio_bus_scale_cfg(struct msm_bus_scale_pdata *cam_bus_scale_table,
-		enum msm_bus_perf_setting perf_setting)
-{
-	static uint32_t bus_perf_client;
-	int rc = 0;
-	switch (perf_setting) {
-	case S_INIT:
-		bus_perf_client =
-			msm_bus_scale_register_client(cam_bus_scale_table);
-		if (!bus_perf_client) {
-			CDBG("%s: Registration Failed!!!\n", __func__);
-			bus_perf_client = 0;
-			return;
-		}
-		CDBG("%s: S_INIT rc = %u\n", __func__, bus_perf_client);
-		break;
-	case S_EXIT:
-		if (bus_perf_client) {
-			CDBG("%s: S_EXIT\n", __func__);
-			msm_bus_scale_unregister_client(bus_perf_client);
-		} else
-			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_PREVIEW:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 1);
-			CDBG("%s: S_PREVIEW rc = %d\n", __func__, rc);
-		} else
-			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_VIDEO:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 2);
-			CDBG("%s: S_VIDEO rc = %d\n", __func__, rc);
-		} else
-			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_CAPTURE:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 3);
-			CDBG("%s: S_CAPTURE rc = %d\n", __func__, rc);
-		} else
-			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_ZSL:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 4);
-			CDBG("%s: S_ZSL rc = %d\n", __func__, rc);
-		} else
-			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_LIVESHOT:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 5);
-			CDBG("%s: S_LIVESHOT rc = %d\n", __func__, rc);
-		} else
-			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_DUAL:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 6);
-			CDBG("%s: S_DUAL rc = %d\n", __func__, rc);
-		} else
-			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_LOW_POWER:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 7);
-			CDBG("%s: S_LOW_POWER rc = %d\n", __func__, rc);
-		} else
-			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_DEFAULT:
-		break;
-	default:
-		pr_warning("%s: INVALID CASE\n", __func__);
-	}
-}
diff --git a/drivers/media/video/msm/io/msm_io_8x60.c b/drivers/media/video/msm/io/msm_io_8x60.c
deleted file mode 100644
index 6896538..0000000
--- a/drivers/media/video/msm/io/msm_io_8x60.c
+++ /dev/null
@@ -1,820 +0,0 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/regulator/consumer.h>
-#include <mach/gpio.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <mach/vreg.h>
-#include <mach/camera.h>
-#include <mach/clk.h>
-#include <mach/msm_bus.h>
-#include <mach/msm_bus_board.h>
-
-
-/* MIPI	CSI	controller registers */
-#define	MIPI_PHY_CONTROL			0x00000000
-#define	MIPI_PROTOCOL_CONTROL		0x00000004
-#define	MIPI_INTERRUPT_STATUS		0x00000008
-#define	MIPI_INTERRUPT_MASK			0x0000000C
-#define	MIPI_CAMERA_CNTL			0x00000024
-#define	MIPI_CALIBRATION_CONTROL	0x00000018
-#define	MIPI_PHY_D0_CONTROL2		0x00000038
-#define	MIPI_PHY_D1_CONTROL2		0x0000003C
-#define	MIPI_PHY_D2_CONTROL2		0x00000040
-#define	MIPI_PHY_D3_CONTROL2		0x00000044
-#define	MIPI_PHY_CL_CONTROL			0x00000048
-#define	MIPI_PHY_D0_CONTROL			0x00000034
-#define	MIPI_PHY_D1_CONTROL			0x00000020
-#define	MIPI_PHY_D2_CONTROL			0x0000002C
-#define	MIPI_PHY_D3_CONTROL			0x00000030
-#define	MIPI_PROTOCOL_CONTROL_SW_RST_BMSK			0x8000000
-#define	MIPI_PROTOCOL_CONTROL_LONG_PACKET_HEADER_CAPTURE_BMSK	0x200000
-#define	MIPI_PROTOCOL_CONTROL_DATA_FORMAT_BMSK			0x180000
-#define	MIPI_PROTOCOL_CONTROL_DECODE_ID_BMSK			0x40000
-#define	MIPI_PROTOCOL_CONTROL_ECC_EN_BMSK			0x20000
-#define	MIPI_CALIBRATION_CONTROL_SWCAL_CAL_EN_SHFT		0x16
-#define	MIPI_CALIBRATION_CONTROL_SWCAL_STRENGTH_OVERRIDE_EN_SHFT	0x15
-#define	MIPI_CALIBRATION_CONTROL_CAL_SW_HW_MODE_SHFT		0x14
-#define	MIPI_CALIBRATION_CONTROL_MANUAL_OVERRIDE_EN_SHFT	0x7
-#define	MIPI_PROTOCOL_CONTROL_DATA_FORMAT_SHFT			0x13
-#define	MIPI_PROTOCOL_CONTROL_DPCM_SCHEME_SHFT			0x1e
-#define	MIPI_PHY_D0_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D0_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D0_CONTROL2_LP_REC_EN_SHFT				0x4
-#define	MIPI_PHY_D0_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-#define	MIPI_PHY_D1_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D1_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D1_CONTROL2_LP_REC_EN_SHFT				0x4
-#define	MIPI_PHY_D1_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-#define	MIPI_PHY_D2_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D2_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D2_CONTROL2_LP_REC_EN_SHFT				0x4
-#define	MIPI_PHY_D2_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-#define	MIPI_PHY_D3_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D3_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D3_CONTROL2_LP_REC_EN_SHFT				0x4
-#define	MIPI_PHY_D3_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-#define	MIPI_PHY_CL_CONTROL_HS_TERM_IMP_SHFT			0x18
-#define	MIPI_PHY_CL_CONTROL_LP_REC_EN_SHFT				0x2
-#define	MIPI_PHY_D0_CONTROL_HS_REC_EQ_SHFT				0x1c
-#define	MIPI_PHY_D1_CONTROL_MIPI_CLK_PHY_SHUTDOWNB_SHFT		0x9
-#define	MIPI_PHY_D1_CONTROL_MIPI_DATA_PHY_SHUTDOWNB_SHFT	0x8
-#define	DBG_CSI	0
-
-static struct clk *camio_cam_clk;
-static struct clk *camio_vfe_clk;
-static struct clk *camio_csi_src_clk;
-static struct clk *camio_csi0_vfe_clk;
-static struct clk *camio_csi1_vfe_clk;
-static struct clk *camio_csi0_clk;
-static struct clk *camio_csi1_clk;
-static struct clk *camio_csi0_pclk;
-static struct clk *camio_csi1_pclk;
-static struct clk *camio_vfe_pclk;
-static struct clk *camio_vpe_clk;
-static struct clk *camio_vpe_pclk;
-static struct regulator *fs_vfe;
-static struct regulator *fs_vpe;
-static struct regulator *ldo15;
-static struct regulator *lvs0;
-static struct regulator *ldo25;
-
-static struct msm_camera_io_ext camio_ext;
-static struct msm_camera_io_clk camio_clk;
-static struct platform_device *camio_dev;
-static struct resource *csiio;
-void __iomem *csibase;
-static int vpe_clk_rate;
-struct msm_bus_scale_pdata *cam_bus_scale_table;
-
-static void msm_camera_vreg_enable(void)
-{
-	ldo15 = regulator_get(NULL, "8058_l15");
-	if (IS_ERR(ldo15)) {
-		pr_err("%s: VREG LDO15 get failed\n", __func__);
-		ldo15 = NULL;
-		return;
-	}
-	if (regulator_set_voltage(ldo15, 2850000, 2850000)) {
-		pr_err("%s: VREG LDO15 set voltage failed\n",  __func__);
-		goto ldo15_disable;
-	}
-	if (regulator_enable(ldo15)) {
-		pr_err("%s: VREG LDO15 enable failed\n", __func__);
-		goto ldo15_put;
-	}
-
-	lvs0 = regulator_get(NULL, "8058_lvs0");
-	if (IS_ERR(lvs0)) {
-		pr_err("%s: VREG LVS0 get failed\n", __func__);
-		lvs0 = NULL;
-		goto ldo15_disable;
-	}
-	if (regulator_enable(lvs0)) {
-		pr_err("%s: VREG LVS0 enable failed\n", __func__);
-		goto lvs0_put;
-	}
-
-	ldo25 = regulator_get(NULL, "8058_l25");
-	if (IS_ERR(ldo25)) {
-		pr_err("%s: VREG LDO25 get failed\n", __func__);
-		ldo25 = NULL;
-		goto lvs0_disable;
-	}
-	if (regulator_set_voltage(ldo25, 1200000, 1200000)) {
-		pr_err("%s: VREG LDO25 set voltage failed\n",  __func__);
-		goto ldo25_disable;
-	}
-	if (regulator_enable(ldo25)) {
-		pr_err("%s: VREG LDO25 enable failed\n", __func__);
-		goto ldo25_put;
-	}
-
-	fs_vfe = regulator_get(NULL, "fs_vfe");
-	if (IS_ERR(fs_vfe)) {
-		CDBG("%s: Regulator FS_VFE get failed %ld\n", __func__,
-			PTR_ERR(fs_vfe));
-		fs_vfe = NULL;
-	} else if (regulator_enable(fs_vfe)) {
-		CDBG("%s: Regulator FS_VFE enable failed\n", __func__);
-		regulator_put(fs_vfe);
-	}
-	return;
-
-ldo25_disable:
-	regulator_disable(ldo25);
-ldo25_put:
-	regulator_put(ldo25);
-lvs0_disable:
-	regulator_disable(lvs0);
-lvs0_put:
-	regulator_put(lvs0);
-ldo15_disable:
-	regulator_disable(ldo15);
-ldo15_put:
-	regulator_put(ldo15);
-}
-
-static void msm_camera_vreg_disable(void)
-{
-	if (ldo15) {
-		regulator_disable(ldo15);
-		regulator_put(ldo15);
-	}
-
-	if (lvs0) {
-		regulator_disable(lvs0);
-		regulator_put(lvs0);
-	}
-
-	if (ldo25) {
-		regulator_disable(ldo25);
-		regulator_put(ldo25);
-	}
-
-	if (fs_vfe) {
-		regulator_disable(fs_vfe);
-		regulator_put(fs_vfe);
-	}
-}
-
-int msm_camio_clk_enable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_CAM_MCLK_CLK:
-		camio_cam_clk =
-		clk = clk_get(NULL, "cam_clk");
-		msm_camio_clk_rate_set_2(clk, camio_clk.mclk_clk_rate);
-		break;
-
-	case CAMIO_VFE_CLK:
-		camio_vfe_clk =
-		clk = clk_get(NULL, "vfe_clk");
-		msm_camio_clk_rate_set_2(clk, camio_clk.vfe_clk_rate);
-		break;
-
-	case CAMIO_CSI0_VFE_CLK:
-		camio_csi0_vfe_clk =
-		clk = clk_get(NULL, "csi_vfe_clk");
-		break;
-
-	case CAMIO_CSI1_VFE_CLK:
-		camio_csi1_vfe_clk =
-		clk = clk_get(&camio_dev->dev, "csi_vfe_clk");
-		break;
-
-	case CAMIO_CSI_SRC_CLK:
-		camio_csi_src_clk =
-		clk = clk_get(NULL, "csi_src_clk");
-		msm_camio_clk_rate_set_2(clk, 384000000);
-		break;
-
-	case CAMIO_CSI0_CLK:
-		camio_csi0_clk =
-		clk = clk_get(NULL, "csi_clk");
-		break;
-
-	case CAMIO_CSI1_CLK:
-		camio_csi1_clk =
-		clk = clk_get(&camio_dev->dev, "csi_clk");
-		break;
-
-	case CAMIO_VFE_PCLK:
-		camio_vfe_pclk =
-		clk = clk_get(NULL, "vfe_pclk");
-		break;
-
-	case CAMIO_CSI0_PCLK:
-		camio_csi0_pclk =
-		clk = clk_get(NULL, "csi_pclk");
-		break;
-
-	case CAMIO_CSI1_PCLK:
-		camio_csi1_pclk =
-		clk = clk_get(&camio_dev->dev, "csi_pclk");
-		break;
-
-	case CAMIO_VPE_CLK:
-		camio_vpe_clk =
-		clk = clk_get(NULL, "vpe_clk");
-		vpe_clk_rate = clk_round_rate(camio_vpe_clk, vpe_clk_rate);
-		clk_set_rate(camio_vpe_clk, vpe_clk_rate);
-		break;
-
-	case CAMIO_VPE_PCLK:
-		camio_vpe_pclk =
-		clk = clk_get(NULL, "vpe_pclk");
-		break;
-
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk))
-		clk_enable(clk);
-	else
-		rc = -1;
-	return rc;
-}
-
-int msm_camio_clk_disable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_CAM_MCLK_CLK:
-		clk = camio_cam_clk;
-		break;
-
-	case CAMIO_VFE_CLK:
-		clk = camio_vfe_clk;
-		break;
-
-	case CAMIO_CSI_SRC_CLK:
-		clk = camio_csi_src_clk;
-		break;
-
-	case CAMIO_CSI0_VFE_CLK:
-		clk = camio_csi0_vfe_clk;
-		break;
-
-	case CAMIO_CSI1_VFE_CLK:
-		clk = camio_csi1_vfe_clk;
-		break;
-
-	case CAMIO_CSI0_CLK:
-		clk = camio_csi0_clk;
-		break;
-
-	case CAMIO_CSI1_CLK:
-		clk = camio_csi1_clk;
-		break;
-
-	case CAMIO_VFE_PCLK:
-		clk = camio_vfe_pclk;
-		break;
-
-	case CAMIO_CSI0_PCLK:
-		clk = camio_csi0_pclk;
-		break;
-
-	case CAMIO_CSI1_PCLK:
-		clk = camio_csi1_pclk;
-		break;
-
-	case CAMIO_VPE_CLK:
-		clk = camio_vpe_clk;
-		break;
-
-	case CAMIO_VPE_PCLK:
-		clk = camio_vpe_pclk;
-		break;
-
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk)) {
-		clk_disable(clk);
-		clk_put(clk);
-	} else
-		rc = -1;
-	return rc;
-}
-
-int msm_camio_vfe_clk_rate_set(int rate)
-{
-	int rc = 0;
-	struct clk *clk = camio_vfe_clk;
-	if (rate > clk_get_rate(clk))
-		rc = clk_set_rate(clk, rate);
-	return rc;
-}
-
-void msm_camio_clk_rate_set(int rate)
-{
-	struct clk *clk = camio_cam_clk;
-	clk_set_rate(clk, rate);
-}
-
-void msm_camio_clk_rate_set_2(struct clk *clk, int rate)
-{
-	clk_set_rate(clk, rate);
-}
-
-static irqreturn_t msm_io_csi_irq(int irq_num, void *data)
-{
-	uint32_t irq = 0;
-	if (csibase != NULL)
-		irq = msm_camera_io_r(csibase + MIPI_INTERRUPT_STATUS);
-	CDBG("%s MIPI_INTERRUPT_STATUS = 0x%x\n", __func__, irq);
-	if (csibase != NULL)
-		msm_camera_io_w(irq, csibase + MIPI_INTERRUPT_STATUS);
-	return IRQ_HANDLED;
-}
-
-int msm_camio_vpe_clk_disable(void)
-{
-	int rc = 0;
-	if (fs_vpe) {
-		regulator_disable(fs_vpe);
-		regulator_put(fs_vpe);
-	}
-
-	rc = msm_camio_clk_disable(CAMIO_VPE_CLK);
-	if (rc < 0)
-		return rc;
-	rc = msm_camio_clk_disable(CAMIO_VPE_PCLK);
-	return rc;
-}
-
-int msm_camio_vpe_clk_enable(uint32_t clk_rate)
-{
-	int rc = 0;
-	fs_vpe = regulator_get(NULL, "fs_vpe");
-	if (IS_ERR(fs_vpe)) {
-		CDBG("%s: Regulator FS_VPE get failed %ld\n", __func__,
-			PTR_ERR(fs_vpe));
-		fs_vpe = NULL;
-	} else if (regulator_enable(fs_vpe)) {
-		CDBG("%s: Regulator FS_VPE enable failed\n", __func__);
-		regulator_put(fs_vpe);
-	}
-
-	vpe_clk_rate = clk_rate;
-	rc = msm_camio_clk_enable(CAMIO_VPE_CLK);
-	if (rc < 0)
-		return rc;
-
-	rc = msm_camio_clk_enable(CAMIO_VPE_PCLK);
-	return rc;
-}
-
-#ifdef DBG_CSI
-static int csi_request_irq(void)
-{
-	return request_irq(camio_ext.csiirq, msm_io_csi_irq,
-		IRQF_TRIGGER_HIGH, "csi", 0);
-}
-#else
-static int csi_request_irq(void) { return 0; }
-#endif
-
-#ifdef DBG_CSI
-static void csi_free_irq(void)
-{
-	free_irq(camio_ext.csiirq, 0);
-}
-#else
-static void csi_free_irq(void) { return 0; }
-#endif
-
-int msm_camio_enable(struct platform_device *pdev)
-{
-	int rc = 0;
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camio_dev = pdev;
-	camio_ext = camdev->ioext;
-	camio_clk = camdev->ioclk;
-	cam_bus_scale_table = camdev->cam_bus_scale_table;
-
-	msm_camio_clk_enable(CAMIO_VFE_CLK);
-	msm_camio_clk_enable(CAMIO_CSI0_VFE_CLK);
-	msm_camio_clk_enable(CAMIO_CSI1_VFE_CLK);
-	msm_camio_clk_enable(CAMIO_CSI_SRC_CLK);
-	msm_camio_clk_enable(CAMIO_CSI0_CLK);
-	msm_camio_clk_enable(CAMIO_CSI1_CLK);
-	msm_camio_clk_enable(CAMIO_VFE_PCLK);
-	msm_camio_clk_enable(CAMIO_CSI0_PCLK);
-	msm_camio_clk_enable(CAMIO_CSI1_PCLK);
-
-	csiio = request_mem_region(camio_ext.csiphy,
-		camio_ext.csisz, pdev->name);
-	if (!csiio) {
-		rc = -EBUSY;
-		goto common_fail;
-	}
-	csibase = ioremap(camio_ext.csiphy,
-		camio_ext.csisz);
-	if (!csibase) {
-		rc = -ENOMEM;
-		goto csi_busy;
-	}
-	rc = csi_request_irq();
-	if (rc < 0)
-		goto csi_irq_fail;
-
-	return 0;
-
-csi_irq_fail:
-	iounmap(csibase);
-	csibase = NULL;
-csi_busy:
-	release_mem_region(camio_ext.csiphy, camio_ext.csisz);
-	csibase = NULL;
-common_fail:
-	msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
-	msm_camio_clk_disable(CAMIO_CSI0_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_CSI0_CLK);
-	msm_camio_clk_disable(CAMIO_CSI1_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_CSI1_CLK);
-	msm_camio_clk_disable(CAMIO_VFE_PCLK);
-	msm_camio_clk_disable(CAMIO_CSI0_PCLK);
-	msm_camio_clk_disable(CAMIO_CSI1_PCLK);
-	msm_camera_vreg_disable();
-	camdev->camera_gpio_off();
-	return rc;
-}
-
-static void msm_camio_csi_disable(void)
-{
-	uint32_t val;
-
-	val = 0x0;
-	if (csibase != NULL) {
-		CDBG("%s MIPI_PHY_D0_CONTROL2 val=0x%x\n", __func__, val);
-		msm_camera_io_w(val, csibase + MIPI_PHY_D0_CONTROL2);
-		msm_camera_io_w(val, csibase + MIPI_PHY_D1_CONTROL2);
-		msm_camera_io_w(val, csibase + MIPI_PHY_D2_CONTROL2);
-		msm_camera_io_w(val, csibase + MIPI_PHY_D3_CONTROL2);
-		CDBG("%s MIPI_PHY_CL_CONTROL val=0x%x\n", __func__, val);
-		msm_camera_io_w(val, csibase + MIPI_PHY_CL_CONTROL);
-		msleep(20);
-		val = msm_camera_io_r(csibase + MIPI_PHY_D1_CONTROL);
-		val &=
-		~((0x1 << MIPI_PHY_D1_CONTROL_MIPI_CLK_PHY_SHUTDOWNB_SHFT)
-		|(0x1 << MIPI_PHY_D1_CONTROL_MIPI_DATA_PHY_SHUTDOWNB_SHFT));
-		CDBG("%s MIPI_PHY_D1_CONTROL val=0x%x\n", __func__, val);
-		msm_camera_io_w(val, csibase + MIPI_PHY_D1_CONTROL);
-		usleep_range(5000, 6000);
-		msm_camera_io_w(0x0, csibase + MIPI_INTERRUPT_MASK);
-		msm_camera_io_w(0x0, csibase + MIPI_INTERRUPT_STATUS);
-		csi_free_irq();
-		iounmap(csibase);
-		csibase = NULL;
-		release_mem_region(camio_ext.csiphy, camio_ext.csisz);
-	}
-}
-void msm_camio_disable(struct platform_device *pdev)
-{
-	CDBG("disable mipi\n");
-	msm_camio_csi_disable();
-	CDBG("disable clocks\n");
-	msm_camio_clk_disable(CAMIO_CSI0_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_CSI0_CLK);
-	msm_camio_clk_disable(CAMIO_CSI1_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_CSI1_CLK);
-	msm_camio_clk_disable(CAMIO_VFE_PCLK);
-	msm_camio_clk_disable(CAMIO_CSI0_PCLK);
-	msm_camio_clk_disable(CAMIO_CSI1_PCLK);
-	msm_camio_clk_disable(CAMIO_CSI_SRC_CLK);
-	msm_camio_clk_disable(CAMIO_VFE_CLK);
-}
-
-int msm_camio_sensor_clk_on(struct platform_device *pdev)
-{
-	int rc = 0;
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camio_dev = pdev;
-	camio_ext = camdev->ioext;
-	camio_clk = camdev->ioclk;
-
-	msm_camera_vreg_enable();
-	usleep_range(10000, 11000);
-	rc = camdev->camera_gpio_on();
-	if (rc < 0)
-		return rc;
-	return msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
-}
-
-int msm_camio_sensor_clk_off(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	msm_camera_vreg_disable();
-	camdev->camera_gpio_off();
-	return msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
-
-}
-
-void msm_camio_vfe_blk_reset(void)
-{
-	return;
-}
-
-int msm_camio_probe_on(struct platform_device *pdev)
-{
-	int rc = 0;
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camio_dev = pdev;
-	camio_ext = camdev->ioext;
-	camio_clk = camdev->ioclk;
-
-	rc = camdev->camera_gpio_on();
-	if (rc < 0)
-		return rc;
-	msm_camera_vreg_enable();
-	return msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
-}
-
-int msm_camio_probe_off(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	msm_camera_vreg_disable();
-	camdev->camera_gpio_off();
-	return msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
-}
-
-int msm_camio_csi_config(struct msm_camera_csi_params *csi_params)
-{
-	int rc = 0;
-	uint32_t val = 0;
-	int i;
-
-	CDBG("msm_camio_csi_config\n");
-	if (csibase != NULL) {
-		/* SOT_ECC_EN enable error correction for SYNC (data-lane) */
-		msm_camera_io_w(0x4, csibase + MIPI_PHY_CONTROL);
-
-		/* SW_RST to the CSI core */
-		msm_camera_io_w(MIPI_PROTOCOL_CONTROL_SW_RST_BMSK,
-		csibase + MIPI_PROTOCOL_CONTROL);
-
-		/* PROTOCOL CONTROL */
-		val = MIPI_PROTOCOL_CONTROL_LONG_PACKET_HEADER_CAPTURE_BMSK |
-			MIPI_PROTOCOL_CONTROL_DECODE_ID_BMSK |
-			MIPI_PROTOCOL_CONTROL_ECC_EN_BMSK;
-		val |= (uint32_t)(csi_params->data_format) <<
-			MIPI_PROTOCOL_CONTROL_DATA_FORMAT_SHFT;
-		val |= csi_params->dpcm_scheme <<
-			MIPI_PROTOCOL_CONTROL_DPCM_SCHEME_SHFT;
-		CDBG("%s MIPI_PROTOCOL_CONTROL val=0x%x\n", __func__, val);
-		msm_camera_io_w(val, csibase + MIPI_PROTOCOL_CONTROL);
-
-		/* settle_cnt is very sensitive to speed!
-		increase this value to run at higher speeds */
-		val = (csi_params->settle_cnt <<
-			MIPI_PHY_D0_CONTROL2_SETTLE_COUNT_SHFT) |
-			(0x0F << MIPI_PHY_D0_CONTROL2_HS_TERM_IMP_SHFT) |
-			(0x1 << MIPI_PHY_D0_CONTROL2_LP_REC_EN_SHFT) |
-			(0x1 << MIPI_PHY_D0_CONTROL2_ERR_SOT_HS_EN_SHFT);
-		CDBG("%s MIPI_PHY_D0_CONTROL2 val=0x%x\n", __func__, val);
-		for (i = 0; i < csi_params->lane_cnt; i++)
-			msm_camera_io_w(val,
-				csibase + MIPI_PHY_D0_CONTROL2 + i * 4);
-
-		val = (0x0F << MIPI_PHY_CL_CONTROL_HS_TERM_IMP_SHFT) |
-			(0x1 << MIPI_PHY_CL_CONTROL_LP_REC_EN_SHFT);
-		CDBG("%s MIPI_PHY_CL_CONTROL val=0x%x\n", __func__, val);
-		msm_camera_io_w(val, csibase + MIPI_PHY_CL_CONTROL);
-
-		val = 0 << MIPI_PHY_D0_CONTROL_HS_REC_EQ_SHFT;
-		msm_camera_io_w(val, csibase + MIPI_PHY_D0_CONTROL);
-
-		val =
-		(0x1 << MIPI_PHY_D1_CONTROL_MIPI_CLK_PHY_SHUTDOWNB_SHFT)
-		|(0x1 << MIPI_PHY_D1_CONTROL_MIPI_DATA_PHY_SHUTDOWNB_SHFT);
-		CDBG("%s MIPI_PHY_D1_CONTROL val=0x%x\n", __func__, val);
-		msm_camera_io_w(val, csibase + MIPI_PHY_D1_CONTROL);
-
-		msm_camera_io_w(0x00000000, csibase + MIPI_PHY_D2_CONTROL);
-		msm_camera_io_w(0x00000000, csibase + MIPI_PHY_D3_CONTROL);
-
-		/* halcyon only supports 1 or 2 lane */
-		switch (csi_params->lane_cnt) {
-		case 1:
-			msm_camera_io_w(csi_params->lane_assign << 8 | 0x4,
-				csibase + MIPI_CAMERA_CNTL);
-			break;
-		case 2:
-			msm_camera_io_w(csi_params->lane_assign << 8 | 0x5,
-				csibase + MIPI_CAMERA_CNTL);
-			break;
-		case 3:
-			msm_camera_io_w(csi_params->lane_assign << 8 | 0x6,
-				csibase + MIPI_CAMERA_CNTL);
-			break;
-		case 4:
-			msm_camera_io_w(csi_params->lane_assign << 8 | 0x7,
-				csibase + MIPI_CAMERA_CNTL);
-			break;
-		}
-
-		/* mask out ID_ERROR[19], DATA_CMM_ERR[11]
-		and CLK_CMM_ERR[10] - de-featured */
-		msm_camera_io_w(0xF017F3C0, csibase + MIPI_INTERRUPT_MASK);
-		/*clear IRQ bits*/
-		msm_camera_io_w(0xF017F3C0, csibase + MIPI_INTERRUPT_STATUS);
-	} else {
-		pr_info("CSIBASE is NULL");
-	}
-
-	return rc;
-}
-
-void msm_camio_set_perf_lvl(enum msm_bus_perf_setting perf_setting)
-{
-	static uint32_t bus_perf_client;
-	int rc = 0;
-	switch (perf_setting) {
-	case S_INIT:
-		bus_perf_client =
-			msm_bus_scale_register_client(cam_bus_scale_table);
-		if (!bus_perf_client) {
-			pr_err("%s: Registration Failed!!!\n", __func__);
-			bus_perf_client = 0;
-			return;
-		}
-		CDBG("%s: S_INIT rc = %u\n", __func__, bus_perf_client);
-		break;
-	case S_EXIT:
-		if (bus_perf_client) {
-			CDBG("%s: S_EXIT\n", __func__);
-			msm_bus_scale_unregister_client(bus_perf_client);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_PREVIEW:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 1);
-			CDBG("%s: S_PREVIEW rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_VIDEO:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 2);
-			CDBG("%s: S_VIDEO rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_CAPTURE:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 3);
-			CDBG("%s: S_CAPTURE rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-
-	case S_ZSL:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 4);
-			CDBG("%s: S_ZSL rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_STEREO_VIDEO:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 5);
-			CDBG("%s: S_STEREO_VIDEO rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_STEREO_CAPTURE:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 6);
-			CDBG("%s: S_STEREO_VIDEO rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_DEFAULT:
-		break;
-	default:
-		pr_warning("%s: INVALID CASE\n", __func__);
-	}
-}
-
-int msm_cam_core_reset(void)
-{
-	struct clk *clk1;
-	int rc = 0;
-	clk1 = clk_get(&camio_dev->dev, "csi_vfe_clk");
-	if (IS_ERR(clk1)) {
-		pr_err("%s: did not get csi_vfe_clk\n", __func__);
-		return PTR_ERR(clk1);
-	}
-	rc = clk_reset(clk1, CLK_RESET_ASSERT);
-	if (rc) {
-		pr_err("%s:csi_vfe_clk assert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	usleep_range(1000, 1200);
-	rc = clk_reset(clk1, CLK_RESET_DEASSERT);
-	if (rc) {
-		pr_err("%s:csi_vfe_clk deassert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	clk_put(clk1);
-
-	clk1 = clk_get(&camio_dev->dev, "csi_clk");
-	if (IS_ERR(clk1)) {
-		pr_err("%s: did not get csi_clk\n", __func__);
-		return PTR_ERR(clk1);
-	}
-	rc = clk_reset(clk1, CLK_RESET_ASSERT);
-	if (rc) {
-		pr_err("%s:csi_clk assert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	usleep_range(1000, 1200);
-	rc = clk_reset(clk1, CLK_RESET_DEASSERT);
-	if (rc) {
-		pr_err("%s:csi_clk deassert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	clk_put(clk1);
-
-	clk1 = clk_get(&camio_dev->dev, "csi_pclk");
-	if (IS_ERR(clk1)) {
-		pr_err("%s: did not get csi_pclk\n", __func__);
-		return PTR_ERR(clk1);
-	}
-	rc = clk_reset(clk1, CLK_RESET_ASSERT);
-	if (rc) {
-		pr_err("%s:csi_pclk assert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	usleep_range(1000, 1200);
-	rc = clk_reset(clk1, CLK_RESET_DEASSERT);
-	if (rc) {
-		pr_err("%s:csi_pclk deassert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	clk_put(clk1);
-
-	return rc;
-}
diff --git a/drivers/media/video/msm/io/msm_io_util.c b/drivers/media/video/msm/io/msm_io_util.c
new file mode 100644
index 0000000..dfa543f
--- /dev/null
+++ b/drivers/media/video/msm/io/msm_io_util.c
@@ -0,0 +1,301 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/delay.h>
+#include <linux/clk.h>
+#include <linux/gpio.h>
+#include <linux/regulator/consumer.h>
+#include <mach/board.h>
+#include <mach/camera.h>
+#include <mach/gpiomux.h>
+
+int msm_cam_clk_enable(struct device *dev, struct msm_cam_clk_info *clk_info,
+		struct clk **clk_ptr, int num_clk, int enable)
+{
+	int i;
+	int rc = 0;
+	if (enable) {
+		for (i = 0; i < num_clk; i++) {
+			clk_ptr[i] = clk_get(dev, clk_info[i].clk_name);
+			if (IS_ERR(clk_ptr[i])) {
+				pr_err("%s get failed\n", clk_info[i].clk_name);
+				rc = PTR_ERR(clk_ptr[i]);
+				goto cam_clk_get_err;
+			}
+			if (clk_info[i].clk_rate >= 0) {
+				rc = clk_set_rate(clk_ptr[i],
+							clk_info[i].clk_rate);
+				if (rc < 0) {
+					pr_err("%s set failed rate %ld\n",
+						   clk_info[i].clk_name, clk_info[i].clk_rate);
+					goto cam_clk_set_err;
+				}
+			}
+			rc = clk_prepare(clk_ptr[i]);
+			if (rc < 0) {
+				pr_err("%s prepare failed\n",
+					   clk_info[i].clk_name);
+				goto cam_clk_prepare_err;
+			}
+
+			rc = clk_enable(clk_ptr[i]);
+			if (rc < 0) {
+				pr_err("%s enable failed\n",
+					   clk_info[i].clk_name);
+				goto cam_clk_enable_err;
+			}
+		}
+	} else {
+		for (i = num_clk - 1; i >= 0; i--) {
+			if (clk_ptr[i] != NULL) {
+				clk_disable(clk_ptr[i]);
+				clk_unprepare(clk_ptr[i]);
+				clk_put(clk_ptr[i]);
+			}
+		}
+	}
+	return rc;
+
+
+cam_clk_enable_err:
+	clk_unprepare(clk_ptr[i]);
+cam_clk_prepare_err:
+cam_clk_set_err:
+	clk_put(clk_ptr[i]);
+cam_clk_get_err:
+	for (i--; i >= 0; i--) {
+		if (clk_ptr[i] != NULL) {
+			clk_disable(clk_ptr[i]);
+			clk_unprepare(clk_ptr[i]);
+			clk_put(clk_ptr[i]);
+		}
+	}
+	return rc;
+}
+
+int msm_camera_config_vreg(struct device *dev, struct camera_vreg_t *cam_vreg,
+		int num_vreg, struct regulator **reg_ptr, int config)
+{
+	int i = 0;
+	int rc = 0;
+	struct camera_vreg_t *curr_vreg;
+	if (config) {
+		for (i = 0; i < num_vreg; i++) {
+			curr_vreg = &cam_vreg[i];
+			reg_ptr[i] = regulator_get(dev,
+				curr_vreg->reg_name);
+			if (IS_ERR(reg_ptr[i])) {
+				pr_err("%s: %s get failed\n",
+					 __func__,
+					 curr_vreg->reg_name);
+				reg_ptr[i] = NULL;
+				goto vreg_get_fail;
+			}
+			if (curr_vreg->type == REG_LDO) {
+				rc = regulator_set_voltage(
+					reg_ptr[i],
+					curr_vreg->min_voltage,
+					curr_vreg->max_voltage);
+				if (rc < 0) {
+					pr_err("%s: %s set voltage failed\n",
+						__func__,
+						curr_vreg->reg_name);
+					goto vreg_set_voltage_fail;
+				}
+				if (curr_vreg->op_mode) {
+					rc = regulator_set_optimum_mode(
+						reg_ptr[i],
+						curr_vreg->op_mode);
+					if (rc < 0) {
+						pr_err("%s: %s set optimum"
+							"mode failed\n",
+							__func__,
+							curr_vreg->reg_name);
+						goto vreg_set_opt_mode_fail;
+					}
+				}
+			}
+		}
+	} else {
+		for (i = num_vreg-1; i >= 0; i--) {
+			curr_vreg = &cam_vreg[i];
+			if (reg_ptr[i]) {
+				if (curr_vreg->type == REG_LDO) {
+					if (curr_vreg->op_mode)
+						regulator_set_optimum_mode(
+							reg_ptr[i], 0);
+					regulator_set_voltage(
+						reg_ptr[i], 0, curr_vreg->
+						max_voltage);
+				}
+				regulator_put(reg_ptr[i]);
+				reg_ptr[i] = NULL;
+			}
+		}
+	}
+	return 0;
+
+vreg_unconfig:
+if (curr_vreg->type == REG_LDO)
+	regulator_set_optimum_mode(reg_ptr[i], 0);
+
+vreg_set_opt_mode_fail:
+if (curr_vreg->type == REG_LDO)
+	regulator_set_voltage(reg_ptr[i], 0,
+		curr_vreg->max_voltage);
+
+vreg_set_voltage_fail:
+	regulator_put(reg_ptr[i]);
+	reg_ptr[i] = NULL;
+
+vreg_get_fail:
+	for (i--; i >= 0; i--) {
+		curr_vreg = &cam_vreg[i];
+		goto vreg_unconfig;
+	}
+	return -ENODEV;
+}
+
+int msm_camera_enable_vreg(struct device *dev, struct camera_vreg_t *cam_vreg,
+		int num_vreg, struct regulator **reg_ptr, int enable)
+{
+	int i = 0, rc = 0;
+	if (enable) {
+		for (i = 0; i < num_vreg; i++) {
+			if (IS_ERR(reg_ptr[i])) {
+				pr_err("%s: %s null regulator\n",
+					__func__, cam_vreg[i].reg_name);
+				goto disable_vreg;
+			}
+			rc = regulator_enable(reg_ptr[i]);
+			if (rc < 0) {
+				pr_err("%s: %s enable failed\n",
+					__func__, cam_vreg[i].reg_name);
+				goto disable_vreg;
+			}
+		}
+	} else {
+		for (i = num_vreg-1; i >= 0; i--)
+			regulator_disable(reg_ptr[i]);
+	}
+	return rc;
+disable_vreg:
+	for (i--; i >= 0; i--) {
+		regulator_disable(reg_ptr[i]);
+		goto disable_vreg;
+	}
+	return rc;
+}
+
+static int config_gpio_table(struct msm_camera_gpio_conf *gpio)
+{
+	int rc = 0, i = 0;
+	uint32_t *table_on;
+	uint32_t *table_off;
+	uint32_t len;
+
+	table_on = gpio->camera_on_table;
+	table_off = gpio->camera_off_table;
+	len = gpio->camera_on_table_size;
+
+	for (i = 0; i < len; i++) {
+		rc = gpio_tlmm_config(table_on[i], GPIO_CFG_ENABLE);
+		if (rc) {
+			pr_err("%s not able to get gpio\n", __func__);
+			for (i--; i >= 0; i--)
+				gpio_tlmm_config(table_off[i],
+					GPIO_CFG_ENABLE);
+			break;
+		}
+	}
+	return rc;
+}
+
+int msm_camera_request_gpio_table(struct msm_camera_sensor_info *sinfo,
+	int gpio_en)
+{
+	int rc = 0;
+	struct msm_camera_gpio_conf *gpio_conf =
+		sinfo->sensor_platform_info->gpio_conf;
+
+	if (!gpio_conf->gpio_no_mux) {
+		if (gpio_conf->cam_gpio_req_tbl == NULL ||
+			gpio_conf->cam_gpio_common_tbl == NULL) {
+			pr_err("%s: NULL camera gpio table\n", __func__);
+			return -EFAULT;
+		}
+	}
+	if (gpio_conf->gpio_no_mux)
+		config_gpio_table(gpio_conf);
+
+	if (gpio_en) {
+		if (!gpio_conf->gpio_no_mux) {
+			if (gpio_conf->cam_gpiomux_conf_tbl != NULL) {
+				msm_gpiomux_install(
+					(struct msm_gpiomux_config *)
+					gpio_conf->cam_gpiomux_conf_tbl,
+					gpio_conf->cam_gpiomux_conf_tbl_size);
+			}
+			rc = gpio_request_array(gpio_conf->cam_gpio_common_tbl,
+				gpio_conf->cam_gpio_common_tbl_size);
+			if (rc < 0) {
+				pr_err("%s common gpio request failed\n"
+						, __func__);
+				return rc;
+			}
+		}
+		if (gpio_conf->cam_gpio_req_tbl_size) {
+			rc = gpio_request_array(gpio_conf->cam_gpio_req_tbl,
+				gpio_conf->cam_gpio_req_tbl_size);
+			if (rc < 0) {
+				pr_err("%s camera gpio"
+					"request failed\n", __func__);
+				gpio_free_array(gpio_conf->cam_gpio_common_tbl,
+					gpio_conf->cam_gpio_common_tbl_size);
+				return rc;
+			}
+		}
+	} else {
+		gpio_free_array(gpio_conf->cam_gpio_req_tbl,
+				gpio_conf->cam_gpio_req_tbl_size);
+		if (!gpio_conf->gpio_no_mux)
+			gpio_free_array(gpio_conf->cam_gpio_common_tbl,
+				gpio_conf->cam_gpio_common_tbl_size);
+	}
+	return rc;
+}
+
+int msm_camera_config_gpio_table(struct msm_camera_sensor_info *sinfo,
+	int gpio_en)
+{
+	struct msm_camera_gpio_conf *gpio_conf =
+		sinfo->sensor_platform_info->gpio_conf;
+	int rc = 0, i;
+
+	if (gpio_en) {
+		for (i = 0; i < gpio_conf->cam_gpio_set_tbl_size; i++) {
+			gpio_set_value_cansleep(
+				gpio_conf->cam_gpio_set_tbl[i].gpio,
+				gpio_conf->cam_gpio_set_tbl[i].flags);
+			usleep_range(gpio_conf->cam_gpio_set_tbl[i].delay,
+				gpio_conf->cam_gpio_set_tbl[i].delay + 1000);
+		}
+	} else if (!gpio_conf->gpio_no_mux) {
+		for (i = gpio_conf->cam_gpio_set_tbl_size - 1; i >= 0; i--) {
+			if (gpio_conf->cam_gpio_set_tbl[i].flags)
+				gpio_set_value_cansleep(
+					gpio_conf->cam_gpio_set_tbl[i].gpio,
+					GPIOF_OUT_INIT_LOW);
+		}
+	}
+	return rc;
+}
diff --git a/drivers/media/video/msm/io/msm_io_vfe31.c b/drivers/media/video/msm/io/msm_io_vfe31.c
deleted file mode 100644
index 1cd2782..0000000
--- a/drivers/media/video/msm/io/msm_io_vfe31.c
+++ /dev/null
@@ -1,776 +0,0 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/pm_qos.h>
-#include <linux/regulator/consumer.h>
-#include <mach/gpio.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <mach/vreg.h>
-#include <mach/clk.h>
-
-#define CAMIF_CFG_RMSK             0x1fffff
-#define CAM_SEL_BMSK               0x2
-#define CAM_PCLK_SRC_SEL_BMSK      0x60000
-#define CAM_PCLK_INVERT_BMSK       0x80000
-#define CAM_PAD_REG_SW_RESET_BMSK  0x100000
-
-#define EXT_CAM_HSYNC_POL_SEL_BMSK 0x10000
-#define EXT_CAM_VSYNC_POL_SEL_BMSK 0x8000
-#define MDDI_CLK_CHICKEN_BIT_BMSK  0x80
-
-#define CAM_SEL_SHFT               0x1
-#define CAM_PCLK_SRC_SEL_SHFT      0x11
-#define CAM_PCLK_INVERT_SHFT       0x13
-#define CAM_PAD_REG_SW_RESET_SHFT  0x14
-
-#define EXT_CAM_HSYNC_POL_SEL_SHFT 0x10
-#define EXT_CAM_VSYNC_POL_SEL_SHFT 0xF
-#define MDDI_CLK_CHICKEN_BIT_SHFT  0x7
-
-/* MIPI	CSI	controller registers */
-#define	MIPI_PHY_CONTROL			0x00000000
-#define	MIPI_PROTOCOL_CONTROL		0x00000004
-#define	MIPI_INTERRUPT_STATUS		0x00000008
-#define	MIPI_INTERRUPT_MASK			0x0000000C
-#define	MIPI_CAMERA_CNTL			0x00000024
-#define	MIPI_CALIBRATION_CONTROL	0x00000018
-#define	MIPI_PHY_D0_CONTROL2		0x00000038
-#define	MIPI_PHY_D1_CONTROL2		0x0000003C
-#define	MIPI_PHY_D2_CONTROL2		0x00000040
-#define	MIPI_PHY_D3_CONTROL2		0x00000044
-#define	MIPI_PHY_CL_CONTROL			0x00000048
-#define	MIPI_PHY_D0_CONTROL			0x00000034
-#define	MIPI_PHY_D1_CONTROL			0x00000020
-#define	MIPI_PHY_D2_CONTROL			0x0000002C
-#define	MIPI_PHY_D3_CONTROL			0x00000030
-#define	MIPI_PROTOCOL_CONTROL_SW_RST_BMSK			0x8000000
-#define	MIPI_PROTOCOL_CONTROL_LONG_PACKET_HEADER_CAPTURE_BMSK	0x200000
-#define	MIPI_PROTOCOL_CONTROL_DATA_FORMAT_BMSK			0x180000
-#define	MIPI_PROTOCOL_CONTROL_DECODE_ID_BMSK			0x40000
-#define	MIPI_PROTOCOL_CONTROL_ECC_EN_BMSK			0x20000
-#define	MIPI_CALIBRATION_CONTROL_SWCAL_CAL_EN_SHFT		0x16
-#define	MIPI_CALIBRATION_CONTROL_SWCAL_STRENGTH_OVERRIDE_EN_SHFT	0x15
-#define	MIPI_CALIBRATION_CONTROL_CAL_SW_HW_MODE_SHFT		0x14
-#define	MIPI_CALIBRATION_CONTROL_MANUAL_OVERRIDE_EN_SHFT	0x7
-#define	MIPI_PROTOCOL_CONTROL_DATA_FORMAT_SHFT			0x13
-#define	MIPI_PROTOCOL_CONTROL_DPCM_SCHEME_SHFT			0x1e
-#define	MIPI_PHY_D0_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D0_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D0_CONTROL2_LP_REC_EN_SHFT				0x4
-#define	MIPI_PHY_D0_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-#define	MIPI_PHY_D1_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D1_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D1_CONTROL2_LP_REC_EN_SHFT				0x4
-#define	MIPI_PHY_D1_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-#define	MIPI_PHY_D2_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D2_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D2_CONTROL2_LP_REC_EN_SHFT				0x4
-#define	MIPI_PHY_D2_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-#define	MIPI_PHY_D3_CONTROL2_SETTLE_COUNT_SHFT			0x18
-#define	MIPI_PHY_D3_CONTROL2_HS_TERM_IMP_SHFT			0x10
-#define	MIPI_PHY_D3_CONTROL2_LP_REC_EN_SHFT				0x4
-#define	MIPI_PHY_D3_CONTROL2_ERR_SOT_HS_EN_SHFT			0x3
-#define	MIPI_PHY_CL_CONTROL_HS_TERM_IMP_SHFT			0x18
-#define	MIPI_PHY_CL_CONTROL_LP_REC_EN_SHFT				0x2
-#define	MIPI_PHY_D0_CONTROL_HS_REC_EQ_SHFT				0x1c
-#define	MIPI_PHY_D1_CONTROL_MIPI_CLK_PHY_SHUTDOWNB_SHFT		0x9
-#define	MIPI_PHY_D1_CONTROL_MIPI_DATA_PHY_SHUTDOWNB_SHFT	0x8
-
-#define	CAMIO_VFE_CLK_SNAP			122880000
-#define	CAMIO_VFE_CLK_PREV			122880000
-
-/* AXI rates in KHz */
-#define MSM_AXI_QOS_PREVIEW     192000
-#define MSM_AXI_QOS_SNAPSHOT    192000
-#define MSM_AXI_QOS_RECORDING   192000
-
-static struct clk *camio_vfe_mdc_clk;
-static struct clk *camio_mdc_clk;
-static struct clk *camio_vfe_clk;
-static struct clk *camio_vfe_camif_clk;
-static struct clk *camio_vfe_pbdg_clk;
-static struct clk *camio_cam_m_clk;
-static struct clk *camio_camif_pad_pbdg_clk;
-static struct clk *camio_csi_clk;
-static struct clk *camio_csi_pclk;
-static struct clk *camio_csi_vfe_clk;
-static struct clk *camio_vpe_clk;
-static struct regulator *fs_vpe;
-static struct msm_camera_io_ext camio_ext;
-static struct msm_camera_io_clk camio_clk;
-static struct resource *camifpadio, *csiio;
-void __iomem *camifpadbase, *csibase;
-static uint32_t vpe_clk_rate;
-
-static struct regulator_bulk_data regs[] = {
-	{ .supply = "gp2",  .min_uV = 2600000, .max_uV = 2600000 },
-	{ .supply = "lvsw1" },
-	{ .supply = "fs_vfe" },
-	/* sn12m0pz regulators */
-	{ .supply = "gp6",  .min_uV = 3050000, .max_uV = 3100000 },
-	{ .supply = "gp16", .min_uV = 1200000, .max_uV = 1200000 },
-};
-
-static int reg_count;
-
-static void msm_camera_vreg_enable(struct platform_device *pdev)
-{
-	int count, rc;
-
-	struct device *dev = &pdev->dev;
-
-	/* Use gp6 and gp16 if and only if dev name matches. */
-	if (!strncmp(pdev->name, "msm_camera_sn12m0pz", 20))
-		count = ARRAY_SIZE(regs);
-	else
-		count = ARRAY_SIZE(regs) - 2;
-
-	rc = regulator_bulk_get(dev, count, regs);
-
-	if (rc) {
-		dev_err(dev, "%s: could not get regulators: %d\n",
-				__func__, rc);
-		return;
-	}
-
-	rc = regulator_bulk_set_voltage(count, regs);
-
-	if (rc) {
-		dev_err(dev, "%s: could not set voltages: %d\n",
-				__func__, rc);
-		goto reg_free;
-	}
-
-	rc = regulator_bulk_enable(count, regs);
-
-	if (rc) {
-		dev_err(dev, "%s: could not enable regulators: %d\n",
-				__func__, rc);
-		goto reg_free;
-	}
-
-	reg_count = count;
-	return;
-
-reg_free:
-	regulator_bulk_free(count, regs);
-	return;
-}
-
-
-static void msm_camera_vreg_disable(void)
-{
-	regulator_bulk_disable(reg_count, regs);
-	regulator_bulk_free(reg_count, regs);
-	reg_count = 0;
-}
-
-int msm_camio_clk_enable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_VFE_MDC_CLK:
-		camio_vfe_mdc_clk =
-		clk = clk_get(NULL, "vfe_mdc_clk");
-		break;
-
-	case CAMIO_MDC_CLK:
-		camio_mdc_clk =
-		clk = clk_get(NULL, "mdc_clk");
-		break;
-
-	case CAMIO_VFE_CLK:
-		camio_vfe_clk =
-		clk = clk_get(NULL, "vfe_clk");
-		msm_camio_clk_rate_set_2(clk, camio_clk.vfe_clk_rate);
-		break;
-
-	case CAMIO_VFE_CAMIF_CLK:
-		camio_vfe_camif_clk =
-		clk = clk_get(NULL, "vfe_camif_clk");
-		break;
-
-	case CAMIO_VFE_PBDG_CLK:
-		camio_vfe_pbdg_clk =
-		clk = clk_get(NULL, "vfe_pclk");
-		break;
-
-	case CAMIO_CAM_MCLK_CLK:
-		camio_cam_m_clk =
-		clk = clk_get(NULL, "cam_m_clk");
-		msm_camio_clk_rate_set_2(clk, camio_clk.mclk_clk_rate);
-		break;
-
-	case CAMIO_CAMIF_PAD_PBDG_CLK:
-		camio_camif_pad_pbdg_clk =
-		clk = clk_get(NULL, "camif_pad_pclk");
-		break;
-
-	case CAMIO_CSI0_CLK:
-		camio_csi_clk =
-		clk = clk_get(NULL, "csi_clk");
-		msm_camio_clk_rate_set_2(clk, 153600000);
-		break;
-	case CAMIO_CSI0_VFE_CLK:
-		camio_csi_vfe_clk =
-		clk = clk_get(NULL, "csi_vfe_clk");
-		break;
-	case CAMIO_CSI0_PCLK:
-		camio_csi_pclk =
-		clk = clk_get(NULL, "csi_pclk");
-		break;
-
-	case CAMIO_VPE_CLK:
-		camio_vpe_clk =
-		clk = clk_get(NULL, "vpe_clk");
-		vpe_clk_rate = clk_round_rate(clk, vpe_clk_rate);
-		clk_set_rate(clk, vpe_clk_rate);
-		break;
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk))
-		clk_prepare_enable(clk);
-	else
-		rc = -1;
-	return rc;
-}
-
-int msm_camio_clk_disable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_VFE_MDC_CLK:
-		clk = camio_vfe_mdc_clk;
-		break;
-
-	case CAMIO_MDC_CLK:
-		clk = camio_mdc_clk;
-		break;
-
-	case CAMIO_VFE_CLK:
-		clk = camio_vfe_clk;
-		break;
-
-	case CAMIO_VFE_CAMIF_CLK:
-		clk = camio_vfe_camif_clk;
-		break;
-
-	case CAMIO_VFE_PBDG_CLK:
-		clk = camio_vfe_pbdg_clk;
-		break;
-
-	case CAMIO_CAM_MCLK_CLK:
-		clk = camio_cam_m_clk;
-		break;
-
-	case CAMIO_CAMIF_PAD_PBDG_CLK:
-		clk = camio_camif_pad_pbdg_clk;
-		break;
-	case CAMIO_CSI0_CLK:
-		clk = camio_csi_clk;
-		break;
-	case CAMIO_CSI0_VFE_CLK:
-		clk = camio_csi_vfe_clk;
-		break;
-	case CAMIO_CSI0_PCLK:
-		clk = camio_csi_pclk;
-		break;
-	case CAMIO_VPE_CLK:
-		clk = camio_vpe_clk;
-		break;
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk)) {
-		clk_disable_unprepare(clk);
-		clk_put(clk);
-	} else {
-		rc = -1;
-	}
-
-	return rc;
-}
-
-void msm_camio_clk_rate_set(int rate)
-{
-	struct clk *clk = camio_cam_m_clk;
-	clk_set_rate(clk, rate);
-}
-
-int msm_camio_vfe_clk_rate_set(int rate)
-{
-	struct clk *clk = camio_vfe_clk;
-	return clk_set_rate(clk, rate);
-}
-
-void msm_camio_clk_rate_set_2(struct clk *clk, int rate)
-{
-	clk_set_rate(clk, rate);
-}
-
-static irqreturn_t msm_io_csi_irq(int irq_num, void *data)
-{
-	uint32_t irq;
-	irq = msm_camera_io_r(csibase + MIPI_INTERRUPT_STATUS);
-	CDBG("%s MIPI_INTERRUPT_STATUS = 0x%x\n", __func__, irq);
-	msm_camera_io_w(irq, csibase + MIPI_INTERRUPT_STATUS);
-	return IRQ_HANDLED;
-}
-
-int msm_camio_vpe_clk_disable(void)
-{
-	msm_camio_clk_disable(CAMIO_VPE_CLK);
-
-	if (fs_vpe) {
-		regulator_disable(fs_vpe);
-		regulator_put(fs_vpe);
-	}
-
-	return 0;
-}
-
-int msm_camio_vpe_clk_enable(uint32_t clk_rate)
-{
-	fs_vpe = regulator_get(NULL, "fs_vpe");
-	if (IS_ERR(fs_vpe)) {
-		pr_err("%s: Regulator FS_VPE get failed %ld\n", __func__,
-			PTR_ERR(fs_vpe));
-		fs_vpe = NULL;
-	} else if (regulator_enable(fs_vpe)) {
-		pr_err("%s: Regulator FS_VPE enable failed\n", __func__);
-		regulator_put(fs_vpe);
-	}
-
-	vpe_clk_rate = clk_rate;
-	msm_camio_clk_enable(CAMIO_VPE_CLK);
-	return 0;
-}
-
-int msm_camio_enable(struct platform_device *pdev)
-{
-	int rc = 0;
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	msm_camio_clk_enable(CAMIO_VFE_PBDG_CLK);
-	if (!sinfo->csi_if)
-		msm_camio_clk_enable(CAMIO_VFE_CAMIF_CLK);
-	else {
-		msm_camio_clk_enable(CAMIO_VFE_CLK);
-		csiio = request_mem_region(camio_ext.csiphy,
-			camio_ext.csisz, pdev->name);
-		if (!csiio) {
-			rc = -EBUSY;
-			goto common_fail;
-		}
-		csibase = ioremap(camio_ext.csiphy,
-			camio_ext.csisz);
-		if (!csibase) {
-			rc = -ENOMEM;
-			goto csi_busy;
-		}
-		rc = request_irq(camio_ext.csiirq, msm_io_csi_irq,
-			IRQF_TRIGGER_RISING, "csi", 0);
-		if (rc < 0)
-			goto csi_irq_fail;
-		/* enable required clocks for CSI */
-		msm_camio_clk_enable(CAMIO_CSI0_PCLK);
-		msm_camio_clk_enable(CAMIO_CSI0_VFE_CLK);
-		msm_camio_clk_enable(CAMIO_CSI0_CLK);
-	}
-	return 0;
-csi_irq_fail:
-	iounmap(csibase);
-csi_busy:
-	release_mem_region(camio_ext.csiphy, camio_ext.csisz);
-common_fail:
-	msm_camio_clk_disable(CAMIO_VFE_PBDG_CLK);
-	msm_camio_clk_disable(CAMIO_VFE_CLK);
-	return rc;
-}
-
-static void msm_camio_csi_disable(void)
-{
-	uint32_t val;
-	val = 0x0;
-	CDBG("%s MIPI_PHY_D0_CONTROL2 val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D0_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D1_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D2_CONTROL2);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D3_CONTROL2);
-
-	CDBG("%s MIPI_PHY_CL_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PHY_CL_CONTROL);
-	usleep_range(9000, 10000);
-	free_irq(camio_ext.csiirq, 0);
-	iounmap(csibase);
-	release_mem_region(camio_ext.csiphy, camio_ext.csisz);
-}
-
-void msm_camio_disable(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	if (!sinfo->csi_if) {
-		msm_camio_clk_disable(CAMIO_VFE_CAMIF_CLK);
-	} else {
-		CDBG("disable mipi\n");
-		msm_camio_csi_disable();
-		CDBG("disable clocks\n");
-		msm_camio_clk_disable(CAMIO_CSI0_PCLK);
-		msm_camio_clk_disable(CAMIO_CSI0_VFE_CLK);
-		msm_camio_clk_disable(CAMIO_CSI0_CLK);
-		msm_camio_clk_disable(CAMIO_VFE_CLK);
-	}
-	msm_camio_clk_disable(CAMIO_VFE_PBDG_CLK);
-}
-
-void msm_camio_camif_pad_reg_reset(void)
-{
-	uint32_t reg;
-
-	msm_camio_clk_sel(MSM_CAMIO_CLK_SRC_INTERNAL);
-	usleep_range(10000, 11000);
-
-	reg = (msm_camera_io_r(camifpadbase)) & CAMIF_CFG_RMSK;
-	reg |= 0x3;
-	msm_camera_io_w(reg, camifpadbase);
-	usleep_range(10000, 11000);
-
-	reg = (msm_camera_io_r(camifpadbase)) & CAMIF_CFG_RMSK;
-	reg |= 0x10;
-	msm_camera_io_w(reg, camifpadbase);
-	usleep_range(10000, 11000);
-
-	reg = (msm_camera_io_r(camifpadbase)) & CAMIF_CFG_RMSK;
-	/* Need to be uninverted*/
-	reg &= 0x03;
-	msm_camera_io_w(reg, camifpadbase);
-	usleep_range(10000, 11000);
-}
-
-void msm_camio_vfe_blk_reset(void)
-{
-	return;
-
-
-}
-
-void msm_camio_camif_pad_reg_reset_2(void)
-{
-	uint32_t reg;
-	uint32_t mask, value;
-	reg = (msm_camera_io_r(camifpadbase)) & CAMIF_CFG_RMSK;
-	mask = CAM_PAD_REG_SW_RESET_BMSK;
-	value = 1 << CAM_PAD_REG_SW_RESET_SHFT;
-	msm_camera_io_w((reg & (~mask)) | (value & mask), camifpadbase);
-	usleep_range(10000, 11000);
-	reg = (msm_camera_io_r(camifpadbase)) & CAMIF_CFG_RMSK;
-	mask = CAM_PAD_REG_SW_RESET_BMSK;
-	value = 0 << CAM_PAD_REG_SW_RESET_SHFT;
-	msm_camera_io_w((reg & (~mask)) | (value & mask), camifpadbase);
-	usleep_range(10000, 11000);
-}
-
-void msm_camio_clk_sel(enum msm_camio_clk_src_type srctype)
-{
-	struct clk *clk = NULL;
-
-	clk = camio_vfe_clk;
-
-	if (clk != NULL) {
-		switch (srctype) {
-		case MSM_CAMIO_CLK_SRC_INTERNAL:
-			clk_set_flags(clk, 0x00000100 << 1);
-			break;
-
-		case MSM_CAMIO_CLK_SRC_EXTERNAL:
-			clk_set_flags(clk, 0x00000100);
-			break;
-
-		default:
-			break;
-		}
-	}
-}
-int msm_camio_probe_on(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camio_clk = camdev->ioclk;
-	camio_ext = camdev->ioext;
-	camdev->camera_gpio_on();
-	msm_camera_vreg_enable(pdev);
-	return msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
-}
-
-int msm_camio_probe_off(struct platform_device *pdev)
-{
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	msm_camera_vreg_disable();
-	camdev->camera_gpio_off();
-	return msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
-}
-
-int msm_camio_sensor_clk_on(struct platform_device *pdev)
-{
-	int rc = 0;
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camio_clk = camdev->ioclk;
-	camio_ext = camdev->ioext;
-	camdev->camera_gpio_on();
-	msm_camera_vreg_enable(pdev);
-	msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
-	msm_camio_clk_enable(CAMIO_CAMIF_PAD_PBDG_CLK);
-	if (!sinfo->csi_if) {
-		camifpadio = request_mem_region(camio_ext.camifpadphy,
-			camio_ext.camifpadsz, pdev->name);
-		msm_camio_clk_enable(CAMIO_VFE_CLK);
-		if (!camifpadio) {
-			rc = -EBUSY;
-			goto common_fail;
-		}
-		camifpadbase = ioremap(camio_ext.camifpadphy,
-			camio_ext.camifpadsz);
-		if (!camifpadbase) {
-			CDBG("msm_camio_sensor_clk_on fail\n");
-			rc = -ENOMEM;
-			goto parallel_busy;
-		}
-	}
-	return rc;
-parallel_busy:
-	release_mem_region(camio_ext.camifpadphy, camio_ext.camifpadsz);
-	goto common_fail;
-common_fail:
-	msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
-	msm_camio_clk_disable(CAMIO_VFE_CLK);
-	msm_camio_clk_disable(CAMIO_CAMIF_PAD_PBDG_CLK);
-	msm_camera_vreg_disable();
-	camdev->camera_gpio_off();
-	return rc;
-}
-
-int msm_camio_sensor_clk_off(struct platform_device *pdev)
-{
-	uint32_t rc = 0;
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-	camdev->camera_gpio_off();
-	msm_camera_vreg_disable();
-	rc = msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
-	rc = msm_camio_clk_disable(CAMIO_CAMIF_PAD_PBDG_CLK);
-	if (!sinfo->csi_if) {
-		iounmap(camifpadbase);
-		release_mem_region(camio_ext.camifpadphy, camio_ext.camifpadsz);
-		rc = msm_camio_clk_disable(CAMIO_VFE_CLK);
-	}
-	return rc;
-}
-
-int msm_camio_csi_config(struct msm_camera_csi_params *csi_params)
-{
-	int rc = 0;
-	uint32_t val = 0;
-	int i;
-
-	CDBG("msm_camio_csi_config\n");
-
-	/* SOT_ECC_EN enable error correction for SYNC (data-lane) */
-	msm_camera_io_w(0x4, csibase + MIPI_PHY_CONTROL);
-
-	/* SW_RST to the CSI core */
-	msm_camera_io_w(MIPI_PROTOCOL_CONTROL_SW_RST_BMSK,
-		csibase + MIPI_PROTOCOL_CONTROL);
-
-	/* PROTOCOL CONTROL */
-	val = MIPI_PROTOCOL_CONTROL_LONG_PACKET_HEADER_CAPTURE_BMSK |
-		MIPI_PROTOCOL_CONTROL_DECODE_ID_BMSK |
-		MIPI_PROTOCOL_CONTROL_ECC_EN_BMSK;
-	val |= (uint32_t)(csi_params->data_format) <<
-		MIPI_PROTOCOL_CONTROL_DATA_FORMAT_SHFT;
-	val |= csi_params->dpcm_scheme <<
-		MIPI_PROTOCOL_CONTROL_DPCM_SCHEME_SHFT;
-	CDBG("%s MIPI_PROTOCOL_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PROTOCOL_CONTROL);
-
-	/* SW CAL EN */
-	val = (0x1 << MIPI_CALIBRATION_CONTROL_SWCAL_CAL_EN_SHFT) |
-		(0x1 <<
-		MIPI_CALIBRATION_CONTROL_SWCAL_STRENGTH_OVERRIDE_EN_SHFT) |
-		(0x1 << MIPI_CALIBRATION_CONTROL_CAL_SW_HW_MODE_SHFT) |
-		(0x1 << MIPI_CALIBRATION_CONTROL_MANUAL_OVERRIDE_EN_SHFT);
-	CDBG("%s MIPI_CALIBRATION_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_CALIBRATION_CONTROL);
-
-	/* settle_cnt is very sensitive to speed!
-	increase this value to run at higher speeds */
-	val = (csi_params->settle_cnt <<
-			MIPI_PHY_D0_CONTROL2_SETTLE_COUNT_SHFT) |
-		(0x0F << MIPI_PHY_D0_CONTROL2_HS_TERM_IMP_SHFT) |
-		(0x1 << MIPI_PHY_D0_CONTROL2_LP_REC_EN_SHFT) |
-		(0x1 << MIPI_PHY_D0_CONTROL2_ERR_SOT_HS_EN_SHFT);
-	CDBG("%s MIPI_PHY_D0_CONTROL2 val=0x%x\n", __func__, val);
-	for (i = 0; i < csi_params->lane_cnt; i++)
-		msm_camera_io_w(val, csibase + MIPI_PHY_D0_CONTROL2 + i * 4);
-
-	val = (0x0F << MIPI_PHY_CL_CONTROL_HS_TERM_IMP_SHFT) |
-		(0x1 << MIPI_PHY_CL_CONTROL_LP_REC_EN_SHFT);
-	CDBG("%s MIPI_PHY_CL_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PHY_CL_CONTROL);
-
-	val = 0 << MIPI_PHY_D0_CONTROL_HS_REC_EQ_SHFT;
-	msm_camera_io_w(val, csibase + MIPI_PHY_D0_CONTROL);
-
-	val = (0x1 << MIPI_PHY_D1_CONTROL_MIPI_CLK_PHY_SHUTDOWNB_SHFT) |
-		(0x1 << MIPI_PHY_D1_CONTROL_MIPI_DATA_PHY_SHUTDOWNB_SHFT);
-	CDBG("%s MIPI_PHY_D1_CONTROL val=0x%x\n", __func__, val);
-	msm_camera_io_w(val, csibase + MIPI_PHY_D1_CONTROL);
-
-	msm_camera_io_w(0x00000000, csibase + MIPI_PHY_D2_CONTROL);
-	msm_camera_io_w(0x00000000, csibase + MIPI_PHY_D3_CONTROL);
-
-	/* halcyon only supports 1 or 2 lane */
-	switch (csi_params->lane_cnt) {
-	case 1:
-		msm_camera_io_w(csi_params->lane_assign << 8 | 0x4,
-			csibase + MIPI_CAMERA_CNTL);
-		break;
-	case 2:
-		msm_camera_io_w(csi_params->lane_assign << 8 | 0x5,
-			csibase + MIPI_CAMERA_CNTL);
-		break;
-	case 3:
-		msm_camera_io_w(csi_params->lane_assign << 8 | 0x6,
-			csibase + MIPI_CAMERA_CNTL);
-		break;
-	case 4:
-		msm_camera_io_w(csi_params->lane_assign << 8 | 0x7,
-			csibase + MIPI_CAMERA_CNTL);
-		break;
-	}
-
-	/* mask out ID_ERROR[19], DATA_CMM_ERR[11]
-	and CLK_CMM_ERR[10] - de-featured */
-	msm_camera_io_w(0xFFF7F3FF, csibase + MIPI_INTERRUPT_MASK);
-	/*clear IRQ bits*/
-	msm_camera_io_w(0xFFF7F3FF, csibase + MIPI_INTERRUPT_STATUS);
-
-	return rc;
-}
-void msm_camio_set_perf_lvl(enum msm_bus_perf_setting perf_setting)
-{
-	switch (perf_setting) {
-	case S_INIT:
-		add_axi_qos();
-		break;
-	case S_PREVIEW:
-		update_axi_qos(MSM_AXI_QOS_PREVIEW);
-		break;
-	case S_VIDEO:
-		update_axi_qos(MSM_AXI_QOS_RECORDING);
-		break;
-	case S_CAPTURE:
-		update_axi_qos(MSM_AXI_QOS_SNAPSHOT);
-		break;
-	case S_DEFAULT:
-		update_axi_qos(PM_QOS_DEFAULT_VALUE);
-		break;
-	case S_EXIT:
-		release_axi_qos();
-		break;
-	default:
-		CDBG("%s: INVALID CASE\n", __func__);
-	}
-}
-
-int msm_cam_core_reset(void)
-{
-	struct clk *clk1;
-	int rc = 0;
-
-	clk1 = clk_get(NULL, "csi_vfe_clk");
-	if (IS_ERR(clk1)) {
-		pr_err("%s: did not get csi_vfe_clk\n", __func__);
-		return PTR_ERR(clk1);
-	}
-
-	rc = clk_reset(clk1, CLK_RESET_ASSERT);
-	if (rc) {
-		pr_err("%s:csi_vfe_clk assert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	usleep_range(1000, 1200);
-	rc = clk_reset(clk1, CLK_RESET_DEASSERT);
-	if (rc) {
-		pr_err("%s:csi_vfe_clk deassert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	clk_put(clk1);
-
-	clk1 = clk_get(NULL, "csi_clk");
-	if (IS_ERR(clk1)) {
-		pr_err("%s: did not get csi_clk\n", __func__);
-		return PTR_ERR(clk1);
-	}
-
-	rc = clk_reset(clk1, CLK_RESET_ASSERT);
-	if (rc) {
-		pr_err("%s:csi_clk assert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	usleep_range(1000, 1200);
-	rc = clk_reset(clk1, CLK_RESET_DEASSERT);
-	if (rc) {
-		pr_err("%s:csi_clk deassert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	clk_put(clk1);
-
-	clk1 = clk_get(NULL, "csi_pclk");
-	if (IS_ERR(clk1)) {
-		pr_err("%s: did not get csi_pclk\n", __func__);
-		return PTR_ERR(clk1);
-	}
-
-	rc = clk_reset(clk1, CLK_RESET_ASSERT);
-	if (rc) {
-		pr_err("%s:csi_pclk assert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	usleep_range(1000, 1200);
-	rc = clk_reset(clk1, CLK_RESET_DEASSERT);
-	if (rc) {
-		pr_err("%s:csi_pclk deassert failed\n", __func__);
-		clk_put(clk1);
-		return rc;
-	}
-	clk_put(clk1);
-
-	return rc;
-}
diff --git a/drivers/media/video/msm/io/msm_io_vfe31_v4l2.c b/drivers/media/video/msm/io/msm_io_vfe31_v4l2.c
deleted file mode 100644
index acf87e4..0000000
--- a/drivers/media/video/msm/io/msm_io_vfe31_v4l2.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/regulator/consumer.h>
-#include <linux/export.h>
-#include <mach/gpio.h>
-#include <mach/board.h>
-#include <mach/camera.h>
-#include <mach/vreg.h>
-#include <mach/camera.h>
-#include <mach/clk.h>
-#include <mach/msm_bus.h>
-#include <mach/msm_bus_board.h>
-
-#include <linux/pm_qos.h>
-
-/* AXI rates in KHz */
-#define MSM_AXI_QOS_PREVIEW     192000
-#define MSM_AXI_QOS_SNAPSHOT    192000
-#define MSM_AXI_QOS_RECORDING   192000
-
-#define BUFF_SIZE_128 128
-
-static struct clk *camio_vfe_clk;
-static struct clk *camio_vpe_clk;
-static struct clk *camio_vpe_pclk;
-static struct regulator *fs_vpe;
-
-static int vpe_clk_rate;
-
-int msm_camio_clk_enable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_VPE_CLK:
-		camio_vpe_clk =
-		clk = clk_get(NULL, "vpe_clk");
-		vpe_clk_rate = clk_round_rate(camio_vpe_clk, vpe_clk_rate);
-		clk_set_rate(camio_vpe_clk, vpe_clk_rate);
-		break;
-
-	case CAMIO_VPE_PCLK:
-		camio_vpe_pclk =
-		clk = clk_get(NULL, "vpe_pclk");
-		break;
-
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk)) {
-		clk_prepare(clk);
-		clk_enable(clk);
-	} else {
-		rc = -1;
-	}
-	return rc;
-}
-
-int msm_camio_clk_disable(enum msm_camio_clk_type clktype)
-{
-	int rc = 0;
-	struct clk *clk = NULL;
-
-	switch (clktype) {
-	case CAMIO_VPE_CLK:
-		clk = camio_vpe_clk;
-		break;
-
-	case CAMIO_VPE_PCLK:
-		clk = camio_vpe_pclk;
-		break;
-
-	default:
-		break;
-	}
-
-	if (!IS_ERR(clk)) {
-		clk_disable(clk);
-		clk_unprepare(clk);
-		clk_put(clk);
-	} else {
-		rc = -1;
-	}
-
-	return rc;
-}
-
-int msm_camio_vfe_clk_rate_set(int rate)
-{
-	int rc = 0;
-	struct clk *clk = camio_vfe_clk;
-	if (rate > clk_get_rate(clk))
-		rc = clk_set_rate(clk, rate);
-	return rc;
-}
-
-void msm_camio_clk_rate_set_2(struct clk *clk, int rate)
-{
-	clk_set_rate(clk, rate);
-}
-
-int msm_camio_vpe_clk_disable(void)
-{
-	int rc = 0;
-	if (fs_vpe) {
-		regulator_disable(fs_vpe);
-		regulator_put(fs_vpe);
-	}
-
-	rc = msm_camio_clk_disable(CAMIO_VPE_CLK);
-	if (rc < 0)
-		return rc;
-	rc = msm_camio_clk_disable(CAMIO_VPE_PCLK);
-	return rc;
-}
-
-int msm_camio_vpe_clk_enable(uint32_t clk_rate)
-{
-	int rc = 0;
-	fs_vpe = regulator_get(NULL, "fs_vpe");
-	if (IS_ERR(fs_vpe)) {
-		CDBG("%s: Regulator FS_VPE get failed %ld\n", __func__,
-			PTR_ERR(fs_vpe));
-		fs_vpe = NULL;
-	} else if (regulator_enable(fs_vpe)) {
-		CDBG("%s: Regulator FS_VPE enable failed\n", __func__);
-		regulator_put(fs_vpe);
-	}
-
-	vpe_clk_rate = clk_rate;
-	rc = msm_camio_clk_enable(CAMIO_VPE_CLK);
-	if (rc < 0)
-		return rc;
-
-	rc = msm_camio_clk_enable(CAMIO_VPE_PCLK);
-	return rc;
-}
-
-void msm_camio_vfe_blk_reset(void)
-{
-	return;
-}
-
-void msm_camio_vfe_blk_reset_3(void)
-{
-	return;
-}
-
-static void msm_camio_axi_cfg(enum msm_bus_perf_setting perf_setting)
-{
-	switch (perf_setting) {
-	case S_INIT:
-		add_axi_qos();
-		break;
-	case S_PREVIEW:
-		update_axi_qos(MSM_AXI_QOS_PREVIEW);
-		break;
-	case S_VIDEO:
-		update_axi_qos(MSM_AXI_QOS_RECORDING);
-		break;
-	case S_CAPTURE:
-		update_axi_qos(MSM_AXI_QOS_SNAPSHOT);
-		break;
-	case S_DEFAULT:
-		update_axi_qos(PM_QOS_DEFAULT_VALUE);
-		break;
-	case S_EXIT:
-		release_axi_qos();
-		break;
-	default:
-		CDBG("%s: INVALID CASE\n", __func__);
-	}
-}
-
-void msm_camio_bus_scale_cfg(struct msm_bus_scale_pdata *cam_bus_scale_table,
-		enum msm_bus_perf_setting perf_setting)
-{
-	static uint32_t bus_perf_client;
-	int rc = 0;
-	if (cam_bus_scale_table == NULL) {
-		msm_camio_axi_cfg(perf_setting);
-		return;
-	}
-
-	switch (perf_setting) {
-	case S_INIT:
-		bus_perf_client =
-			msm_bus_scale_register_client(cam_bus_scale_table);
-		if (!bus_perf_client) {
-			pr_err("%s: Registration Failed!!!\n", __func__);
-			bus_perf_client = 0;
-			return;
-		}
-		CDBG("%s: S_INIT rc = %u\n", __func__, bus_perf_client);
-		break;
-	case S_EXIT:
-		if (bus_perf_client) {
-			CDBG("%s: S_EXIT\n", __func__);
-			msm_bus_scale_unregister_client(bus_perf_client);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_PREVIEW:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 1);
-			CDBG("%s: S_PREVIEW rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_VIDEO:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 2);
-			CDBG("%s: S_VIDEO rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_CAPTURE:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 3);
-			CDBG("%s: S_CAPTURE rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-
-	case S_ZSL:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 4);
-			CDBG("%s: S_ZSL rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_STEREO_VIDEO:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 5);
-			CDBG("%s: S_STEREO_VIDEO rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_STEREO_CAPTURE:
-		if (bus_perf_client) {
-			rc = msm_bus_scale_client_update_request(
-				bus_perf_client, 6);
-			CDBG("%s: S_STEREO_VIDEO rc = %d\n", __func__, rc);
-		} else
-			pr_err("%s: Bus Client NOT Registered!!!\n", __func__);
-		break;
-	case S_DEFAULT:
-		break;
-	default:
-		pr_warning("%s: INVALID CASE\n", __func__);
-	}
-}
-
diff --git a/drivers/media/video/msm/jpeg_10/Makefile b/drivers/media/video/msm/jpeg_10/Makefile
deleted file mode 100644
index d99d1a4..0000000
--- a/drivers/media/video/msm/jpeg_10/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-ccflags-y += -Idrivers/media/video/msm
-obj-$(CONFIG_MSM_JPEG) += msm_jpeg_dev.o msm_jpeg_sync.o msm_jpeg_core.o msm_jpeg_hw.o msm_jpeg_platform.o
diff --git a/drivers/media/video/msm/jpeg_10/msm_jpeg_common.h b/drivers/media/video/msm/jpeg_10/msm_jpeg_common.h
deleted file mode 100644
index 88ec1ad..0000000
--- a/drivers/media/video/msm/jpeg_10/msm_jpeg_common.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_JPEG_COMMON_H
-#define MSM_JPEG_COMMON_H
-
-#ifdef MSM_JPEG_DEBUG
-#define JPEG_DBG(fmt, args...) printk(fmt, ##args)
-#else
-#define JPEG_DBG(fmt, args...) do { } while (0)
-#endif
-
-#define JPEG_PR_ERR   pr_err
-
-enum JPEG_MODE {
-	JPEG_MODE_DISABLE,
-	JPEG_MODE_OFFLINE,
-	JPEG_MODE_REALTIME,
-	JPEG_MODE_REALTIME_ROTATION
-};
-
-enum JPEG_ROTATION {
-	JPEG_ROTATION_0,
-	JPEG_ROTATION_90,
-	JPEG_ROTATION_180,
-	JPEG_ROTATION_270
-};
-
-#endif /* MSM_JPEG_COMMON_H */
diff --git a/drivers/media/video/msm/jpeg_10/msm_jpeg_core.c b/drivers/media/video/msm/jpeg_10/msm_jpeg_core.c
deleted file mode 100644
index 7905ff3..0000000
--- a/drivers/media/video/msm/jpeg_10/msm_jpeg_core.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* Copyright (c) 2012,The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/module.h>
-#include <linux/sched.h>
-#include "msm_jpeg_hw.h"
-#include "msm_jpeg_core.h"
-#include "msm_jpeg_platform.h"
-#include "msm_jpeg_common.h"
-
-static struct msm_jpeg_hw_pingpong fe_pingpong_buf;
-static struct msm_jpeg_hw_pingpong we_pingpong_buf;
-static int we_pingpong_index;
-static int reset_done_ack;
-static spinlock_t reset_lock;
-static wait_queue_head_t reset_wait;
-
-int msm_jpeg_core_reset(uint8_t op_mode, void *base, int size)
-{
-	unsigned long flags;
-	int rc = 0;
-	int tm = 500; /*500ms*/
-	memset(&fe_pingpong_buf, 0, sizeof(fe_pingpong_buf));
-	fe_pingpong_buf.is_fe = 1;
-	we_pingpong_index = 0;
-	memset(&we_pingpong_buf, 0, sizeof(we_pingpong_buf));
-	spin_lock_irqsave(&reset_lock, flags);
-	reset_done_ack = 0;
-	msm_jpeg_hw_reset(base, size);
-	spin_unlock_irqrestore(&reset_lock, flags);
-	rc = wait_event_interruptible_timeout(
-			reset_wait,
-			reset_done_ack,
-			msecs_to_jiffies(tm));
-
-	if (!reset_done_ack) {
-		JPEG_DBG("%s: reset ACK failed %d", __func__, rc);
-		return -EBUSY;
-	}
-
-	JPEG_DBG("%s: reset_done_ack rc %d", __func__, rc);
-	spin_lock_irqsave(&reset_lock, flags);
-	reset_done_ack = 0;
-	spin_unlock_irqrestore(&reset_lock, flags);
-
-	return 0;
-}
-
-void msm_jpeg_core_release(int release_buf, int domain_num)
-{
-	int i = 0;
-	for (i = 0; i < 2; i++) {
-		if (we_pingpong_buf.buf_status[i] && release_buf)
-			msm_jpeg_platform_p2v(we_pingpong_buf.buf[i].file,
-				&we_pingpong_buf.buf[i].handle, domain_num);
-		we_pingpong_buf.buf_status[i] = 0;
-	}
-}
-
-void msm_jpeg_core_init(void)
-{
-	init_waitqueue_head(&reset_wait);
-	spin_lock_init(&reset_lock);
-}
-
-int msm_jpeg_core_fe_start(void)
-{
-	msm_jpeg_hw_fe_start();
-	return 0;
-}
-
-/* fetch engine */
-int msm_jpeg_core_fe_buf_update(struct msm_jpeg_core_buf *buf)
-{
-	JPEG_DBG("%s:%d] 0x%08x %d 0x%08x %d\n", __func__, __LINE__,
-		(int) buf->y_buffer_addr, buf->y_len,
-		(int) buf->cbcr_buffer_addr, buf->cbcr_len);
-	return msm_jpeg_hw_pingpong_update(&fe_pingpong_buf, buf);
-}
-
-void *msm_jpeg_core_fe_pingpong_irq(int jpeg_irq_status, void *context)
-{
-	return msm_jpeg_hw_pingpong_irq(&fe_pingpong_buf);
-}
-
-/* write engine */
-int msm_jpeg_core_we_buf_update(struct msm_jpeg_core_buf *buf)
-{
-	JPEG_DBG("%s:%d] 0x%08x 0x%08x %d\n", __func__, __LINE__,
-		(int) buf->y_buffer_addr, (int) buf->cbcr_buffer_addr,
-		buf->y_len);
-	we_pingpong_buf.buf[0] = *buf;
-	we_pingpong_buf.buf_status[0] = 1;
-	msm_jpeg_hw_we_buffer_update(
-			&we_pingpong_buf.buf[0], 0);
-
-	return 0;
-}
-
-int msm_jpeg_core_we_buf_reset(struct msm_jpeg_hw_buf *buf)
-{
-	int i = 0;
-	for (i = 0; i < 2; i++) {
-		if (we_pingpong_buf.buf[i].y_buffer_addr
-					== buf->y_buffer_addr)
-			we_pingpong_buf.buf_status[i] = 0;
-	}
-	return 0;
-}
-
-void *msm_jpeg_core_we_pingpong_irq(int jpeg_irq_status, void *context)
-{
-	JPEG_DBG("%s:%d]\n", __func__, __LINE__);
-
-	return msm_jpeg_hw_pingpong_irq(&we_pingpong_buf);
-}
-
-void *msm_jpeg_core_framedone_irq(int jpeg_irq_status, void *context)
-{
-	struct msm_jpeg_hw_buf *buf_p;
-
-	JPEG_DBG("%s:%d]\n", __func__, __LINE__);
-
-	buf_p = msm_jpeg_hw_pingpong_active_buffer(&we_pingpong_buf);
-	if (buf_p) {
-		buf_p->framedone_len = msm_jpeg_hw_encode_output_size();
-		JPEG_DBG("%s:%d] framedone_len %d\n", __func__, __LINE__,
-			buf_p->framedone_len);
-	}
-
-	return buf_p;
-}
-
-void *msm_jpeg_core_reset_ack_irq(int jpeg_irq_status, void *context)
-{
-	/* @todo return the status back to msm_jpeg_core_reset */
-	JPEG_DBG("%s:%d]\n", __func__, __LINE__);
-	return NULL;
-}
-
-void *msm_jpeg_core_err_irq(int jpeg_irq_status, void *context)
-{
-	JPEG_PR_ERR("%s:%d]\n", __func__, jpeg_irq_status);
-	return NULL;
-}
-
-static int (*msm_jpeg_irq_handler) (int, void *, void *);
-
-irqreturn_t msm_jpeg_core_irq(int irq_num, void *context)
-{
-	void *data = NULL;
-	unsigned long flags;
-	int jpeg_irq_status;
-
-	JPEG_DBG("%s:%d] irq_num = %d\n", __func__, __LINE__, irq_num);
-
-	jpeg_irq_status = msm_jpeg_hw_irq_get_status();
-
-	JPEG_DBG("%s:%d] jpeg_irq_status = %0x\n", __func__, __LINE__,
-		jpeg_irq_status);
-
-	/*For reset and framedone IRQs, clear all bits*/
-	if (jpeg_irq_status & 0x10000000) {
-		msm_jpeg_hw_irq_clear(JPEG_IRQ_CLEAR_BMSK,
-			JPEG_IRQ_CLEAR_ALL);
-	} else if (jpeg_irq_status & 0x1) {
-		msm_jpeg_hw_irq_clear(JPEG_IRQ_CLEAR_BMSK,
-			JPEG_IRQ_CLEAR_ALL);
-	} else {
-		msm_jpeg_hw_irq_clear(JPEG_IRQ_CLEAR_BMSK,
-			jpeg_irq_status);
-	}
-
-	if (msm_jpeg_hw_irq_is_frame_done(jpeg_irq_status)) {
-		data = msm_jpeg_core_framedone_irq(jpeg_irq_status,
-			context);
-		if (msm_jpeg_irq_handler)
-			msm_jpeg_irq_handler(
-				MSM_JPEG_HW_MASK_COMP_FRAMEDONE,
-				context, data);
-	}
-	if (msm_jpeg_hw_irq_is_reset_ack(jpeg_irq_status)) {
-		data = msm_jpeg_core_reset_ack_irq(jpeg_irq_status,
-			context);
-		spin_lock_irqsave(&reset_lock, flags);
-		reset_done_ack = 1;
-		spin_unlock_irqrestore(&reset_lock, flags);
-		wake_up(&reset_wait);
-		if (msm_jpeg_irq_handler)
-			msm_jpeg_irq_handler(
-				MSM_JPEG_HW_MASK_COMP_RESET_ACK,
-				context, data);
-	}
-
-	/* Unexpected/unintended HW interrupt */
-	if (msm_jpeg_hw_irq_is_err(jpeg_irq_status)) {
-		data = msm_jpeg_core_err_irq(jpeg_irq_status, context);
-		if (msm_jpeg_irq_handler)
-			msm_jpeg_irq_handler(MSM_JPEG_HW_MASK_COMP_ERR,
-				context, data);
-	}
-
-	return IRQ_HANDLED;
-}
-
-void msm_jpeg_core_irq_install(int (*irq_handler) (int, void *, void *))
-{
-	msm_jpeg_irq_handler = irq_handler;
-}
-
-void msm_jpeg_core_irq_remove(void)
-{
-	msm_jpeg_irq_handler = NULL;
-}
diff --git a/drivers/media/video/msm/jpeg_10/msm_jpeg_core.h b/drivers/media/video/msm/jpeg_10/msm_jpeg_core.h
deleted file mode 100644
index b5c725c..0000000
--- a/drivers/media/video/msm/jpeg_10/msm_jpeg_core.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_JPEG_CORE_H
-#define MSM_JPEG_CORE_H
-
-#include <linux/interrupt.h>
-#include "msm_jpeg_hw.h"
-
-#define msm_jpeg_core_buf msm_jpeg_hw_buf
-
-irqreturn_t msm_jpeg_core_irq(int irq_num, void *context);
-
-void msm_jpeg_core_irq_install(int (*irq_handler) (int, void *, void *));
-void msm_jpeg_core_irq_remove(void);
-
-int msm_jpeg_core_fe_buf_update(struct msm_jpeg_core_buf *buf);
-int msm_jpeg_core_we_buf_update(struct msm_jpeg_core_buf *buf);
-int msm_jpeg_core_we_buf_reset(struct msm_jpeg_hw_buf *buf);
-
-int msm_jpeg_core_reset(uint8_t op_mode, void *base, int size);
-int msm_jpeg_core_fe_start(void);
-
-void msm_jpeg_core_release(int, int);
-void msm_jpeg_core_init(void);
-#endif /* MSM_JPEG_CORE_H */
diff --git a/drivers/media/video/msm/jpeg_10/msm_jpeg_dev.c b/drivers/media/video/msm/jpeg_10/msm_jpeg_dev.c
deleted file mode 100644
index 45a9a38..0000000
--- a/drivers/media/video/msm/jpeg_10/msm_jpeg_dev.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <mach/board.h>
-#include <linux/of.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/device.h>
-#include <linux/uaccess.h>
-#include <media/msm_jpeg.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-subdev.h>
-
-#include "msm.h"
-#include "msm_jpeg_sync.h"
-#include "msm_jpeg_common.h"
-
-#define MSM_JPEG_NAME "jpeg"
-#define MSM_JPEGE1_NAME "jpege1"
-#define MSM_JPEGD_NAME "jpegd"
-
-
-static int msm_jpeg_open(struct inode *inode, struct file *filp)
-{
-	int rc = 0;
-
-	struct msm_jpeg_device *pgmn_dev = container_of(inode->i_cdev,
-		struct msm_jpeg_device, cdev);
-	filp->private_data = pgmn_dev;
-
-	JPEG_DBG("%s:%d]\n", __func__, __LINE__);
-
-	rc = __msm_jpeg_open(pgmn_dev);
-
-	JPEG_DBG(KERN_INFO "%s:%d] %s open_count = %d\n", __func__, __LINE__,
-		filp->f_path.dentry->d_name.name, pgmn_dev->open_count);
-
-	return rc;
-}
-
-static int msm_jpeg_release(struct inode *inode, struct file *filp)
-{
-	int rc;
-
-	struct msm_jpeg_device *pgmn_dev = filp->private_data;
-
-	JPEG_DBG(KERN_INFO "%s:%d]\n", __func__, __LINE__);
-
-	rc = __msm_jpeg_release(pgmn_dev);
-
-	JPEG_DBG(KERN_INFO "%s:%d] %s open_count = %d\n", __func__, __LINE__,
-		filp->f_path.dentry->d_name.name, pgmn_dev->open_count);
-	return rc;
-}
-
-static long msm_jpeg_ioctl(struct file *filp, unsigned int cmd,
-	unsigned long arg)
-{
-	int rc;
-	struct msm_jpeg_device *pgmn_dev = filp->private_data;
-
-	JPEG_DBG("%s:%d] cmd=%d pgmn_dev=0x%x arg=0x%x\n", __func__,
-		__LINE__, _IOC_NR(cmd), (uint32_t)pgmn_dev, (uint32_t)arg);
-
-	rc = __msm_jpeg_ioctl(pgmn_dev, cmd, arg);
-
-	JPEG_DBG("%s:%d]\n", __func__, __LINE__);
-	return rc;
-}
-
-static const struct file_operations msm_jpeg_fops = {
-	.owner		= THIS_MODULE,
-	.open		 = msm_jpeg_open,
-	.release	= msm_jpeg_release,
-	.unlocked_ioctl = msm_jpeg_ioctl,
-};
-
-
-int msm_jpeg_subdev_init(struct v4l2_subdev *jpeg_sd)
-{
-	int rc;
-	struct msm_jpeg_device *pgmn_dev =
-		(struct msm_jpeg_device *)jpeg_sd->host_priv;
-
-	JPEG_DBG("%s:%d: jpeg_sd=0x%x pgmn_dev=0x%x\n",
-		__func__, __LINE__, (uint32_t)jpeg_sd, (uint32_t)pgmn_dev);
-	rc = __msm_jpeg_open(pgmn_dev);
-	JPEG_DBG("%s:%d: rc=%d\n",
-		__func__, __LINE__, rc);
-	return rc;
-}
-
-static long msm_jpeg_subdev_ioctl(struct v4l2_subdev *sd,
-	unsigned int cmd, void *arg)
-{
-	long rc;
-	struct msm_jpeg_device *pgmn_dev =
-		(struct msm_jpeg_device *)sd->host_priv;
-
-	JPEG_DBG("%s: cmd=%d\n", __func__, cmd);
-
-	JPEG_DBG("%s: pgmn_dev 0x%x", __func__, (uint32_t)pgmn_dev);
-
-	JPEG_DBG("%s: Calling __msm_jpeg_ioctl\n", __func__);
-
-	rc = __msm_jpeg_ioctl(pgmn_dev, cmd, (unsigned long)arg);
-	pr_debug("%s: X\n", __func__);
-	return rc;
-}
-
-void msm_jpeg_subdev_release(struct v4l2_subdev *jpeg_sd)
-{
-	int rc;
-	struct msm_jpeg_device *pgmn_dev =
-		(struct msm_jpeg_device *)jpeg_sd->host_priv;
-	JPEG_DBG("%s:pgmn_dev=0x%x", __func__, (uint32_t)pgmn_dev);
-	rc = __msm_jpeg_release(pgmn_dev);
-	JPEG_DBG("%s:rc=%d", __func__, rc);
-}
-
-static const struct v4l2_subdev_core_ops msm_jpeg_subdev_core_ops = {
-	.ioctl = msm_jpeg_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_ops msm_jpeg_subdev_ops = {
-	.core = &msm_jpeg_subdev_core_ops,
-};
-
-static int msm_jpeg_init_dev(struct platform_device *pdev)
-{
-	int rc = -1;
-	struct device *dev;
-	struct msm_jpeg_device *msm_jpeg_device_p;
-	char devname[10];
-
-	msm_jpeg_device_p = kzalloc(sizeof(struct msm_jpeg_device), GFP_ATOMIC);
-	if (!msm_jpeg_device_p) {
-		JPEG_PR_ERR("%s: no mem\n", __func__);
-		return -EFAULT;
-	}
-
-	msm_jpeg_device_p->pdev = pdev;
-
-	if (pdev->dev.of_node)
-		of_property_read_u32((&pdev->dev)->of_node, "cell-index",
-								&pdev->id);
-
-	snprintf(devname, sizeof(devname), "%s%d", MSM_JPEG_NAME, pdev->id);
-
-	rc = __msm_jpeg_init(msm_jpeg_device_p);
-	if (rc < -1) {
-		JPEG_PR_ERR("%s: initialization failed\n", __func__);
-		goto fail;
-	}
-
-	v4l2_subdev_init(&msm_jpeg_device_p->subdev, &msm_jpeg_subdev_ops);
-	v4l2_set_subdev_hostdata(&msm_jpeg_device_p->subdev, msm_jpeg_device_p);
-	JPEG_DBG("%s: msm_jpeg_device_p 0x%x", __func__,
-			(uint32_t)msm_jpeg_device_p);
-
-	rc = alloc_chrdev_region(&msm_jpeg_device_p->msm_jpeg_devno, 0, 1,
-				devname);
-	if (rc < 0) {
-		JPEG_PR_ERR("%s: failed to allocate chrdev\n", __func__);
-		goto fail_1;
-	}
-
-	if (!msm_jpeg_device_p->msm_jpeg_class) {
-		msm_jpeg_device_p->msm_jpeg_class =
-				class_create(THIS_MODULE, devname);
-		if (IS_ERR(msm_jpeg_device_p->msm_jpeg_class)) {
-			rc = PTR_ERR(msm_jpeg_device_p->msm_jpeg_class);
-			JPEG_PR_ERR("%s: create device class failed\n",
-				__func__);
-			goto fail_2;
-		}
-	}
-
-	dev = device_create(msm_jpeg_device_p->msm_jpeg_class, NULL,
-		MKDEV(MAJOR(msm_jpeg_device_p->msm_jpeg_devno),
-		MINOR(msm_jpeg_device_p->msm_jpeg_devno)), NULL,
-		"%s%d", MSM_JPEG_NAME, pdev->id);
-	if (IS_ERR(dev)) {
-		JPEG_PR_ERR("%s: error creating device\n", __func__);
-		rc = -ENODEV;
-		goto fail_3;
-	}
-
-	cdev_init(&msm_jpeg_device_p->cdev, &msm_jpeg_fops);
-	msm_jpeg_device_p->cdev.owner = THIS_MODULE;
-	msm_jpeg_device_p->cdev.ops	 =
-		(const struct file_operations *) &msm_jpeg_fops;
-	rc = cdev_add(&msm_jpeg_device_p->cdev,
-			msm_jpeg_device_p->msm_jpeg_devno, 1);
-	if (rc < 0) {
-		JPEG_PR_ERR("%s: error adding cdev\n", __func__);
-		rc = -ENODEV;
-		goto fail_4;
-	}
-
-	platform_set_drvdata(pdev, &msm_jpeg_device_p);
-
-	JPEG_DBG("%s %s%d: success\n", __func__, MSM_JPEG_NAME, pdev->id);
-
-	return rc;
-
-fail_4:
-	device_destroy(msm_jpeg_device_p->msm_jpeg_class,
-			msm_jpeg_device_p->msm_jpeg_devno);
-
-fail_3:
-	class_destroy(msm_jpeg_device_p->msm_jpeg_class);
-
-fail_2:
-	unregister_chrdev_region(msm_jpeg_device_p->msm_jpeg_devno, 1);
-
-fail_1:
-	__msm_jpeg_exit(msm_jpeg_device_p);
-
-fail:
-	kfree(msm_jpeg_device_p);
-	return rc;
-
-}
-
-static void msm_jpeg_exit(struct msm_jpeg_device *msm_jpeg_device_p)
-{
-	cdev_del(&msm_jpeg_device_p->cdev);
-	device_destroy(msm_jpeg_device_p->msm_jpeg_class,
-			msm_jpeg_device_p->msm_jpeg_devno);
-	class_destroy(msm_jpeg_device_p->msm_jpeg_class);
-	unregister_chrdev_region(msm_jpeg_device_p->msm_jpeg_devno, 1);
-
-	__msm_jpeg_exit(msm_jpeg_device_p);
-}
-
-static int __msm_jpeg_probe(struct platform_device *pdev)
-{
-	return msm_jpeg_init_dev(pdev);
-}
-
-static int __msm_jpeg_remove(struct platform_device *pdev)
-{
-	struct msm_jpeg_device *msm_jpegd_device_p;
-
-	msm_jpegd_device_p = platform_get_drvdata(pdev);
-	if (msm_jpegd_device_p)
-		msm_jpeg_exit(msm_jpegd_device_p);
-
-	return 0;
-}
-
-static const struct of_device_id msm_jpeg_dt_match[] = {
-			{.compatible = "qcom,jpeg"},
-};
-
-MODULE_DEVICE_TABLE(of, msm_jpeg_dt_match);
-
-static struct platform_driver msm_jpeg_driver = {
-	.probe	= __msm_jpeg_probe,
-	.remove = __msm_jpeg_remove,
-	.driver = {
-		.name = MSM_JPEG_DRV_NAME,
-		.owner = THIS_MODULE,
-		.of_match_table = msm_jpeg_dt_match,
-	},
-};
-
-static int __init msm_jpeg_driver_init(void)
-{
-	int rc;
-	rc = platform_driver_register(&msm_jpeg_driver);
-	return rc;
-}
-
-static void __exit msm_jpeg_driver_exit(void)
-{
-	platform_driver_unregister(&msm_jpeg_driver);
-}
-
-MODULE_DESCRIPTION("msm jpeg jpeg driver");
-
-module_init(msm_jpeg_driver_init);
-module_exit(msm_jpeg_driver_exit);
diff --git a/drivers/media/video/msm/jpeg_10/msm_jpeg_hw.c b/drivers/media/video/msm/jpeg_10/msm_jpeg_hw.c
deleted file mode 100644
index d92caab..0000000
--- a/drivers/media/video/msm/jpeg_10/msm_jpeg_hw.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/module.h>
-#include <linux/delay.h>
-#include "msm_jpeg_hw.h"
-#include "msm_jpeg_common.h"
-
-#include <linux/io.h>
-
-static void *jpeg_region_base;
-static uint32_t jpeg_region_size;
-
-int msm_jpeg_hw_pingpong_update(struct msm_jpeg_hw_pingpong *pingpong_hw,
-	struct msm_jpeg_hw_buf *buf)
-{
-	int buf_free_index = -1;
-
-	if (!pingpong_hw->buf_status[0]) {
-		buf_free_index = 0;
-	} else if (!pingpong_hw->buf_status[1]) {
-		buf_free_index = 1;
-	} else {
-		JPEG_PR_ERR("%s:%d: pingpong buffer busy\n",
-		__func__, __LINE__);
-		return -EBUSY;
-	}
-
-	pingpong_hw->buf[buf_free_index] = *buf;
-	pingpong_hw->buf_status[buf_free_index] = 1;
-
-	if (pingpong_hw->is_fe) {
-		/* it is fe */
-		msm_jpeg_hw_fe_buffer_update(
-			&pingpong_hw->buf[buf_free_index], buf_free_index);
-	} else {
-		/* it is we */
-		msm_jpeg_hw_we_buffer_update(
-			&pingpong_hw->buf[buf_free_index], buf_free_index);
-	}
-	return 0;
-}
-
-void *msm_jpeg_hw_pingpong_irq(struct msm_jpeg_hw_pingpong *pingpong_hw)
-{
-	struct msm_jpeg_hw_buf *buf_p = NULL;
-
-	if (pingpong_hw->buf_status[pingpong_hw->buf_active_index]) {
-		buf_p = &pingpong_hw->buf[pingpong_hw->buf_active_index];
-		pingpong_hw->buf_status[pingpong_hw->buf_active_index] = 0;
-	}
-
-	pingpong_hw->buf_active_index = !pingpong_hw->buf_active_index;
-
-	return (void *) buf_p;
-}
-
-void *msm_jpeg_hw_pingpong_active_buffer(
-	struct msm_jpeg_hw_pingpong *pingpong_hw)
-{
-	struct msm_jpeg_hw_buf *buf_p = NULL;
-
-	if (pingpong_hw->buf_status[pingpong_hw->buf_active_index])
-		buf_p = &pingpong_hw->buf[pingpong_hw->buf_active_index];
-
-	return (void *) buf_p;
-}
-
-struct msm_jpeg_hw_cmd hw_cmd_irq_get_status[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
-	{MSM_JPEG_HW_CMD_TYPE_READ, 1, JPEG_IRQ_STATUS_ADDR,
-		JPEG_IRQ_STATUS_BMSK, {0} },
-};
-
-int msm_jpeg_hw_irq_get_status(void)
-{
-	uint32_t n_irq_status = 0;
-	rmb();
-	n_irq_status = msm_jpeg_hw_read(&hw_cmd_irq_get_status[0]);
-	rmb();
-	return n_irq_status;
-}
-
-struct msm_jpeg_hw_cmd hw_cmd_encode_output_size[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
-	{MSM_JPEG_HW_CMD_TYPE_READ, 1,
-	JPEG_ENCODE_OUTPUT_SIZE_STATUS_ADDR,
-	JPEG_ENCODE_OUTPUT_SIZE_STATUS_BMSK, {0} } ,
-};
-
-long msm_jpeg_hw_encode_output_size(void)
-{
-	uint32_t encode_output_size = 0;
-
-	encode_output_size = msm_jpeg_hw_read(&hw_cmd_encode_output_size[0]);
-
-	return encode_output_size;
-}
-
-struct msm_jpeg_hw_cmd hw_cmd_irq_clear[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_IRQ_CLEAR_ADDR,
-		JPEG_IRQ_CLEAR_BMSK, {JPEG_IRQ_CLEAR_ALL} },
-};
-
-void msm_jpeg_hw_irq_clear(uint32_t mask, uint32_t data)
-{
-	JPEG_DBG("%s:%d] mask %0x data %0x", __func__, __LINE__, mask, data);
-	hw_cmd_irq_clear[0].mask = mask;
-	hw_cmd_irq_clear[0].data = data;
-	msm_jpeg_hw_write(&hw_cmd_irq_clear[0]);
-}
-
-struct msm_jpeg_hw_cmd hw_cmd_fe_ping_update[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_IRQ_MASK_ADDR,
-		JPEG_IRQ_MASK_BMSK, {JPEG_IRQ_ALLSOURCES_ENABLE} },
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_CMD_ADDR,
-		JPEG_CMD_BMSK, {JPEG_CMD_CLEAR_WRITE_PLN_QUEUES} },
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_PLN0_RD_OFFSET_ADDR,
-		JPEG_PLN0_RD_OFFSET_BMSK, {0} },
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_PLN0_RD_PNTR_ADDR,
-		JPEG_PLN0_RD_PNTR_BMSK, {0} },
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_PLN1_RD_OFFSET_ADDR,
-		JPEG_PLN1_RD_OFFSET_BMSK, {0} },
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_PLN1_RD_PNTR_ADDR,
-		JPEG_PLN1_RD_PNTR_BMSK, {0} },
-};
-
-void msm_jpeg_hw_fe_buffer_update(struct msm_jpeg_hw_buf *p_input,
-	uint8_t pingpong_index)
-{
-	struct msm_jpeg_hw_cmd *hw_cmd_p;
-
-	if (pingpong_index == 0) {
-		hw_cmd_p = &hw_cmd_fe_ping_update[0];
-		wmb();
-		msm_jpeg_hw_write(hw_cmd_p++);
-		wmb();
-		msm_jpeg_hw_write(hw_cmd_p++);
-		wmb();
-		msm_jpeg_hw_write(hw_cmd_p++);
-		wmb();
-		hw_cmd_p->data = p_input->y_buffer_addr;
-		msm_jpeg_hw_write(hw_cmd_p++);
-		wmb();
-		msm_jpeg_hw_write(hw_cmd_p++);
-		wmb();
-		hw_cmd_p->data = p_input->cbcr_buffer_addr;
-		msm_jpeg_hw_write(hw_cmd_p++);
-		wmb();
-
-	}
-	return;
-}
-
-struct msm_jpeg_hw_cmd hw_cmd_fe_start[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_CMD_ADDR,
-		JPEG_CMD_BMSK, {JPEG_OFFLINE_CMD_START} },
-};
-
-void msm_jpeg_hw_fe_start(void)
-{
-	msm_jpeg_hw_write(&hw_cmd_fe_start[0]);
-
-	return;
-}
-
-struct msm_jpeg_hw_cmd hw_cmd_we_ping_update[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_PLN0_WR_PNTR_ADDR,
-		JPEG_PLN0_WR_PNTR_BMSK, {0} },
-};
-
-void msm_jpeg_hw_we_buffer_update(struct msm_jpeg_hw_buf *p_input,
-	uint8_t pingpong_index)
-{
-	struct msm_jpeg_hw_cmd *hw_cmd_p;
-
-	if (pingpong_index == 0) {
-		hw_cmd_p = &hw_cmd_we_ping_update[0];
-		hw_cmd_p->data = p_input->y_buffer_addr;
-		JPEG_PR_ERR("%s Output buffer address is %x\n", __func__,
-						p_input->y_buffer_addr);
-		msm_jpeg_hw_write(hw_cmd_p++);
-
-	}
-	return;
-}
-
-struct msm_jpeg_hw_cmd hw_cmd_reset[] = {
-	/* type, repeat n times, offset, mask, data or pdata */
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_IRQ_MASK_ADDR,
-		JPEG_IRQ_MASK_BMSK, {JPEG_IRQ_DISABLE_ALL} },
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_IRQ_CLEAR_ADDR,
-		JPEG_IRQ_MASK_BMSK, {JPEG_IRQ_CLEAR_ALL} },
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_IRQ_MASK_ADDR,
-		JPEG_IRQ_MASK_BMSK, {JPEG_IRQ_ALLSOURCES_ENABLE} },
-	{MSM_JPEG_HW_CMD_TYPE_WRITE, 1, JPEG_RESET_CMD_ADDR,
-		JPEG_RESET_CMD_RMSK, {JPEG_RESET_DEFAULT} },
-};
-
-void msm_jpeg_hw_init(void *base, int size)
-{
-	jpeg_region_base = base;
-	jpeg_region_size = size;
-}
-
-void msm_jpeg_hw_reset(void *base, int size)
-{
-	struct msm_jpeg_hw_cmd *hw_cmd_p;
-
-	hw_cmd_p = &hw_cmd_reset[0];
-	wmb();
-	msm_jpeg_hw_write(hw_cmd_p++);
-	wmb();
-	msm_jpeg_hw_write(hw_cmd_p++);
-	wmb();
-	msm_jpeg_hw_write(hw_cmd_p++);
-	wmb();
-	msm_jpeg_hw_write(hw_cmd_p);
-	wmb();
-
-	return;
-}
-
-uint32_t msm_jpeg_hw_read(struct msm_jpeg_hw_cmd *hw_cmd_p)
-{
-	uint32_t *paddr;
-	uint32_t data;
-
-	paddr = jpeg_region_base + hw_cmd_p->offset;
-
-	data = readl_relaxed(paddr);
-	data &= hw_cmd_p->mask;
-
-	return data;
-}
-
-void msm_jpeg_hw_write(struct msm_jpeg_hw_cmd *hw_cmd_p)
-{
-	uint32_t *paddr;
-	uint32_t old_data, new_data;
-
-	paddr = jpeg_region_base + hw_cmd_p->offset;
-
-	if (hw_cmd_p->mask == 0xffffffff) {
-		old_data = 0;
-	} else {
-		old_data = readl_relaxed(paddr);
-		old_data &= ~hw_cmd_p->mask;
-	}
-
-	new_data = hw_cmd_p->data & hw_cmd_p->mask;
-	new_data |= old_data;
-	writel_relaxed(new_data, paddr);
-}
-
-int msm_jpeg_hw_wait(struct msm_jpeg_hw_cmd *hw_cmd_p, int m_us)
-{
-	int tm = hw_cmd_p->n;
-	uint32_t data;
-	uint32_t wait_data = hw_cmd_p->data & hw_cmd_p->mask;
-
-	data = msm_jpeg_hw_read(hw_cmd_p);
-	if (data != wait_data) {
-		while (tm) {
-			udelay(m_us);
-			data = msm_jpeg_hw_read(hw_cmd_p);
-			if (data == wait_data)
-				break;
-			tm--;
-		}
-	}
-	hw_cmd_p->data = data;
-	return tm;
-}
-
-void msm_jpeg_hw_delay(struct msm_jpeg_hw_cmd *hw_cmd_p, int m_us)
-{
-	int tm = hw_cmd_p->n;
-	while (tm) {
-		udelay(m_us);
-		tm--;
-	}
-}
-
-int msm_jpeg_hw_exec_cmds(struct msm_jpeg_hw_cmd *hw_cmd_p, uint32_t m_cmds)
-{
-	int is_copy_to_user = -1;
-	uint32_t data;
-
-	while (m_cmds--) {
-		if (hw_cmd_p->offset > jpeg_region_size) {
-			JPEG_PR_ERR("%s:%d] %d exceed hw region %d\n", __func__,
-				__LINE__, hw_cmd_p->offset, jpeg_region_size);
-			return -EFAULT;
-		}
-
-		switch (hw_cmd_p->type) {
-		case MSM_JPEG_HW_CMD_TYPE_READ:
-			hw_cmd_p->data = msm_jpeg_hw_read(hw_cmd_p);
-			is_copy_to_user = 1;
-			break;
-
-		case MSM_JPEG_HW_CMD_TYPE_WRITE:
-			msm_jpeg_hw_write(hw_cmd_p);
-			break;
-
-		case MSM_JPEG_HW_CMD_TYPE_WRITE_OR:
-			data = msm_jpeg_hw_read(hw_cmd_p);
-			hw_cmd_p->data = (hw_cmd_p->data & hw_cmd_p->mask) |
-				data;
-			msm_jpeg_hw_write(hw_cmd_p);
-			break;
-
-		case MSM_JPEG_HW_CMD_TYPE_UWAIT:
-			msm_jpeg_hw_wait(hw_cmd_p, 1);
-			break;
-
-		case MSM_JPEG_HW_CMD_TYPE_MWAIT:
-			msm_jpeg_hw_wait(hw_cmd_p, 1000);
-			break;
-
-		case MSM_JPEG_HW_CMD_TYPE_UDELAY:
-			msm_jpeg_hw_delay(hw_cmd_p, 1);
-			break;
-
-		case MSM_JPEG_HW_CMD_TYPE_MDELAY:
-			msm_jpeg_hw_delay(hw_cmd_p, 1000);
-			break;
-
-		default:
-			JPEG_PR_ERR("wrong hw command type\n");
-			break;
-		}
-
-		hw_cmd_p++;
-	}
-	return is_copy_to_user;
-}
-
-void msm_jpeg_io_dump(int size)
-{
-	char line_str[128], *p_str;
-	void __iomem *addr = jpeg_region_base;
-	int i;
-	u32 *p = (u32 *) addr;
-	u32 data;
-	JPEG_PR_ERR("%s: %p %d reg_size %d\n", __func__, addr, size,
-							jpeg_region_size);
-	line_str[0] = '\0';
-	p_str = line_str;
-	for (i = 0; i < size/4; i++) {
-		if (i % 4 == 0) {
-			snprintf(p_str, 12, "%08x: ", (u32) p);
-			p_str += 10;
-		}
-		data = readl_relaxed(p++);
-		snprintf(p_str, 12, "%08x ", data);
-		p_str += 9;
-		if ((i + 1) % 4 == 0) {
-			JPEG_PR_ERR("%s\n", line_str);
-			line_str[0] = '\0';
-			p_str = line_str;
-		}
-	}
-	if (line_str[0] != '\0')
-		JPEG_PR_ERR("%s\n", line_str);
-}
diff --git a/drivers/media/video/msm/jpeg_10/msm_jpeg_hw.h b/drivers/media/video/msm/jpeg_10/msm_jpeg_hw.h
deleted file mode 100644
index 5545115..0000000
--- a/drivers/media/video/msm/jpeg_10/msm_jpeg_hw.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_JPEG_HW_H
-#define MSM_JPEG_HW_H
-
-#include <media/msm_jpeg.h>
-#include "msm_jpeg_hw_reg.h"
-#include <linux/ion.h>
-#include <mach/iommu_domains.h>
-
-struct msm_jpeg_hw_buf {
-	struct msm_jpeg_buf vbuf;
-	struct file  *file;
-	uint32_t framedone_len;
-	uint32_t y_buffer_addr;
-	uint32_t y_len;
-	uint32_t cbcr_buffer_addr;
-	uint32_t cbcr_len;
-	uint32_t num_of_mcu_rows;
-	struct ion_handle *handle;
-};
-
-struct msm_jpeg_hw_pingpong {
-	uint8_t is_fe; /* 1: fe; 0: we */
-	struct  msm_jpeg_hw_buf buf[2];
-	int     buf_status[2];
-	int     buf_active_index;
-};
-
-int msm_jpeg_hw_pingpong_update(struct msm_jpeg_hw_pingpong *pingpong_hw,
-	struct msm_jpeg_hw_buf *buf);
-void *msm_jpeg_hw_pingpong_irq(struct msm_jpeg_hw_pingpong *pingpong_hw);
-void *msm_jpeg_hw_pingpong_active_buffer(struct msm_jpeg_hw_pingpong
-	*pingpong_hw);
-
-void msm_jpeg_hw_irq_clear(uint32_t, uint32_t);
-int msm_jpeg_hw_irq_get_status(void);
-long msm_jpeg_hw_encode_output_size(void);
-#define MSM_JPEG_HW_MASK_COMP_FRAMEDONE \
-		MSM_JPEG_HW_IRQ_STATUS_FRAMEDONE_MASK
-#define MSM_JPEG_HW_MASK_COMP_FE \
-		MSM_JPEG_HW_IRQ_STATUS_FE_RD_DONE_MASK
-#define MSM_JPEG_HW_MASK_COMP_WE \
-		(MSM_JPEG_HW_IRQ_STATUS_WE_Y_PINGPONG_MASK | \
-		 MSM_JPEG_HW_IRQ_STATUS_WE_CBCR_PINGPONG_MASK)
-#define MSM_JPEG_HW_MASK_COMP_RESET_ACK \
-		MSM_JPEG_HW_IRQ_STATUS_RESET_ACK_MASK
-#define MSM_JPEG_HW_MASK_COMP_ERR \
-		(MSM_JPEG_HW_IRQ_STATUS_FE_RTOVF_MASK | \
-		MSM_JPEG_HW_IRQ_STATUS_FE_VFE_OVERFLOW_MASK | \
-		MSM_JPEG_HW_IRQ_STATUS_WE_Y_BUFFER_OVERFLOW_MASK | \
-		MSM_JPEG_HW_IRQ_STATUS_WE_CBCR_BUFFER_OVERFLOW_MASK | \
-		MSM_JPEG_HW_IRQ_STATUS_WE_CH0_DATAFIFO_OVERFLOW_MASK | \
-		MSM_JPEG_HW_IRQ_STATUS_WE_CH1_DATAFIFO_OVERFLOW_MASK | \
-		MSM_JPEG_HW_IRQ_STATUS_BUS_ERROR_MASK | \
-		MSM_JPEG_HW_IRQ_STATUS_VIOLATION_MASK)
-
-#define msm_jpeg_hw_irq_is_frame_done(jpeg_irq_status) \
-	(jpeg_irq_status & MSM_JPEG_HW_MASK_COMP_FRAMEDONE)
-#define msm_jpeg_hw_irq_is_fe_pingpong(jpeg_irq_status) \
-	(jpeg_irq_status & MSM_JPEG_HW_MASK_COMP_FE)
-#define msm_jpeg_hw_irq_is_we_pingpong(jpeg_irq_status) \
-	(jpeg_irq_status & MSM_JPEG_HW_MASK_COMP_WE)
-#define msm_jpeg_hw_irq_is_reset_ack(jpeg_irq_status) \
-	(jpeg_irq_status & MSM_JPEG_HW_MASK_COMP_RESET_ACK)
-#define msm_jpeg_hw_irq_is_err(jpeg_irq_status) \
-	(jpeg_irq_status & MSM_JPEG_HW_MASK_COMP_ERR)
-
-void msm_jpeg_hw_fe_buffer_update(struct msm_jpeg_hw_buf *p_input,
-	uint8_t pingpong_index);
-void msm_jpeg_hw_we_buffer_update(struct msm_jpeg_hw_buf *p_input,
-	uint8_t pingpong_index);
-
-void msm_jpeg_hw_we_buffer_cfg(uint8_t is_realtime);
-
-void msm_jpeg_hw_fe_start(void);
-void msm_jpeg_hw_clk_cfg(void);
-
-void msm_jpeg_hw_reset(void *base, int size);
-void msm_jpeg_hw_irq_cfg(void);
-void msm_jpeg_hw_init(void *base, int size);
-
-uint32_t msm_jpeg_hw_read(struct msm_jpeg_hw_cmd *hw_cmd_p);
-void msm_jpeg_hw_write(struct msm_jpeg_hw_cmd *hw_cmd_p);
-int msm_jpeg_hw_wait(struct msm_jpeg_hw_cmd *hw_cmd_p, int m_us);
-void msm_jpeg_hw_delay(struct msm_jpeg_hw_cmd *hw_cmd_p, int m_us);
-int msm_jpeg_hw_exec_cmds(struct msm_jpeg_hw_cmd *hw_cmd_p, uint32_t m_cmds);
-void msm_jpeg_hw_region_dump(int size);
-void msm_jpeg_io_dump(int size);
-
-#endif /* MSM_JPEG_HW_H */
diff --git a/drivers/media/video/msm/jpeg_10/msm_jpeg_hw_reg.h b/drivers/media/video/msm/jpeg_10/msm_jpeg_hw_reg.h
deleted file mode 100644
index ae64c32..0000000
--- a/drivers/media/video/msm/jpeg_10/msm_jpeg_hw_reg.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_JPEG_HW_REG_H
-#define MSM_JPEG_HW_REG_H
-
-#define JPEG_REG_BASE 0
-
-#define MSM_JPEG_HW_IRQ_MASK_ADDR 0x00000018
-#define MSM_JPEG_HW_IRQ_MASK_RMSK 0xFFFFFFFF
-#define MSM_JPEG_HW_IRQ_ENABLE 0xFFFFFFFF
-
-#define MSM_JPEG_HW_IRQ_STATUS_FRAMEDONE_MASK 0x00000001
-#define MSM_JPEG_HW_IRQ_STATUS_FRAMEDONE_SHIFT 0x00000000
-
-#define MSM_JPEG_HW_IRQ_STATUS_FE_RD_DONE_MASK 0x00000010
-#define MSM_JPEG_HW_IRQ_STATUS_FE_RD_DONE_SHIFT 0x00000001
-
-#define MSM_JPEG_HW_IRQ_STATUS_FE_RTOVF_MASK 0x00000004
-#define MSM_JPEG_HW_IRQ_STATUS_FE_RTOVF_SHIFT 0x00000002
-
-#define MSM_JPEG_HW_IRQ_STATUS_FE_VFE_OVERFLOW_MASK 0x00000008
-#define MSM_JPEG_HW_IRQ_STATUS_FE_VFE_OVERFLOW_SHIFT 0x00000003
-
-#define MSM_JPEG_HW_IRQ_STATUS_WE_Y_PINGPONG_MASK 0x00000010
-#define MSM_JPEG_HW_IRQ_STATUS_WE_Y_PINGPONG_SHIFT 0x00000004
-
-#define MSM_JPEG_HW_IRQ_STATUS_WE_CBCR_PINGPONG_MASK 0x00000020
-#define MSM_JPEG_HW_IRQ_STATUS_WE_CBCR_PINGPONG_SHIFT 0x00000005
-
-#define MSM_JPEG_HW_IRQ_STATUS_WE_Y_BUFFER_OVERFLOW_MASK 0x00000040
-#define MSM_JPEG_HW_IRQ_STATUS_WE_Y_BUFFER_OVERFLOW_SHIFT 0x00000006
-
-#define MSM_JPEG_HW_IRQ_STATUS_WE_CBCR_BUFFER_OVERFLOW_MASK 0x00000080
-#define MSM_JPEG_HW_IRQ_STATUS_WE_CBCR_BUFFER_OVERFLOW_SHIFT 0x00000007
-
-#define MSM_JPEG_HW_IRQ_STATUS_WE_CH0_DATAFIFO_OVERFLOW_MASK 0x00000100
-#define MSM_JPEG_HW_IRQ_STATUS_WE_CH0_DATAFIFO_OVERFLOW_SHIFT 0x00000008
-
-#define MSM_JPEG_HW_IRQ_STATUS_WE_CH1_DATAFIFO_OVERFLOW_MASK 0x00000200
-#define MSM_JPEG_HW_IRQ_STATUS_WE_CH1_DATAFIFO_OVERFLOW_SHIFT 0x00000009
-
-#define MSM_JPEG_HW_IRQ_STATUS_RESET_ACK_MASK 0x10000000
-#define MSM_JPEG_HW_IRQ_STATUS_RESET_ACK_SHIFT 0x0000000a
-
-#define MSM_JPEG_HW_IRQ_STATUS_BUS_ERROR_MASK 0x00000800
-#define MSM_JPEG_HW_IRQ_STATUS_BUS_ERROR_SHIFT 0x0000000b
-
-#define MSM_JPEG_HW_IRQ_STATUS_VIOLATION_MASK 0x00001000
-#define MSM_JPEG_HW_IRQ_STATUS_VIOLATION_SHIFT 0x0000000c
-
-#define JPEG_OFFLINE_CMD_START 0x00000001
-
-#define JPEG_RESET_DEFAULT 0x00000003 /* cfff? */
-
-#define JPEG_IRQ_DISABLE_ALL 0x00000000
-#define JPEG_IRQ_CLEAR_ALL 0xFFFFFFFF
-
-#define JPEG_PLN0_RD_PNTR_ADDR (JPEG_REG_BASE + 0x00000038)
-#define JPEG_PLN0_RD_PNTR_BMSK  0xFFFFFFFF
-
-#define JPEG_PLN0_RD_OFFSET_ADDR 0x0000003C
-#define JPEG_PLN0_RD_OFFSET_BMSK 0x1FFFFFFF
-
-#define JPEG_PLN1_RD_PNTR_ADDR (JPEG_REG_BASE + 0x00000044)
-#define JPEG_PLN1_RD_PNTR_BMSK 0xFFFFFFFF
-
-#define JPEG_PLN1_RD_OFFSET_ADDR 0x00000048
-#define JPEG_PLN1_RD_OFFSET_BMSK 0x1FFFFFFF
-
-#define JPEG_CMD_ADDR (JPEG_REG_BASE + 0x00000010)
-#define JPEG_CMD_BMSK 0x00000FFF
-#define JPEG_CMD_CLEAR_WRITE_PLN_QUEUES 0x700
-
-#define JPEG_PLN0_WR_PNTR_ADDR (JPEG_REG_BASE + 0x000000cc)
-#define JPEG_PLN0_WR_PNTR_BMSK 0xFFFFFFFF
-
-#define JPEG_PLN1_WR_PNTR_ADDR (JPEG_REG_BASE + 0x000000D0)
-#define JPEG_PLN1_WR_PNTR_BMSK 0xFFFFFFFF
-
-#define JPEG_IRQ_MASK_ADDR (JPEG_REG_BASE + 0x00000018)
-#define JPEG_IRQ_MASK_BMSK 0xFFFFFFFF
-#define JPEG_IRQ_ALLSOURCES_ENABLE 0xFFFFFFFF
-
-#define JPEG_IRQ_CLEAR_ADDR (JPEG_REG_BASE + 0x0000001c)
-#define JPEG_IRQ_CLEAR_BMSK 0xFFFFFFFF
-
-#define JPEG_RESET_CMD_ADDR (JPEG_REG_BASE + 0x00000008)
-#define JPEG_RESET_CMD_RMSK 0xFFFFFFFF
-
-#define JPEG_IRQ_STATUS_ADDR (JPEG_REG_BASE + 0x00000020)
-#define JPEG_IRQ_STATUS_BMSK 0xFFFFFFFF
-
-#define JPEG_ENCODE_OUTPUT_SIZE_STATUS_ADDR (JPEG_REG_BASE + 0x00000180)
-#define JPEG_ENCODE_OUTPUT_SIZE_STATUS_BMSK 0x1FFFFFFF
-
-
-#define VBIF_BASE_ADDRESS                      0xFDA60000
-#define VBIF_REGION_SIZE                       0xC30
-#define JPEG_VBIF_CLKON                        0x4
-#define JPEG_VBIF_IN_RD_LIM_CONF0              0xB0
-#define JPEG_VBIF_IN_RD_LIM_CONF1              0xB4
-#define JPEG_VBIF_IN_RD_LIM_CONF2              0xB8
-#define JPEG_VBIF_IN_WR_LIM_CONF0              0xC0
-#define JPEG_VBIF_IN_WR_LIM_CONF1              0xC4
-#define JPEG_VBIF_IN_WR_LIM_CONF2              0xC8
-#define JPEG_VBIF_OUT_RD_LIM_CONF0             0xD0
-#define JPEG_VBIF_OUT_WR_LIM_CONF0             0xD4
-#define JPEG_VBIF_DDR_OUT_MAX_BURST            0xD8
-#define JPEG_VBIF_OCMEM_OUT_MAX_BURST          0xDC
-
-#endif /* MSM_JPEG_HW_REG_H */
diff --git a/drivers/media/video/msm/jpeg_10/msm_jpeg_platform.c b/drivers/media/video/msm/jpeg_10/msm_jpeg_platform.c
deleted file mode 100644
index 981c56c..0000000
--- a/drivers/media/video/msm/jpeg_10/msm_jpeg_platform.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-
-
-#include <linux/module.h>
-#include <linux/pm_qos.h>
-#include <linux/clk.h>
-#include <mach/clk.h>
-#include <linux/io.h>
-#include <linux/android_pmem.h>
-#include <mach/camera.h>
-#include <mach/iommu_domains.h>
-
-#include "msm_jpeg_platform.h"
-#include "msm_jpeg_sync.h"
-#include "msm_jpeg_common.h"
-#include "msm_jpeg_hw.h"
-
-/* AXI rate in KHz */
-struct ion_client *jpeg_client;
-static void *jpeg_vbif;
-
-void msm_jpeg_platform_p2v(struct file  *file,
-				struct ion_handle **ionhandle, int domain_num)
-{
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_unmap_iommu(jpeg_client, *ionhandle, domain_num, 0);
-	ion_free(jpeg_client, *ionhandle);
-	*ionhandle = NULL;
-#elif CONFIG_ANDROID_PMEM
-	put_pmem_file(file);
-#endif
-}
-
-uint32_t msm_jpeg_platform_v2p(int fd, uint32_t len, struct file **file_p,
-				struct ion_handle **ionhandle, int domain_num)
-{
-	unsigned long paddr;
-	unsigned long size;
-	int rc;
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	*ionhandle = ion_import_dma_buf(jpeg_client, fd);
-	if (IS_ERR_OR_NULL(*ionhandle))
-		return 0;
-
-	rc = ion_map_iommu(jpeg_client, *ionhandle, domain_num, 0,
-			 SZ_4K, 0, &paddr, (unsigned long *)&size, UNCACHED, 0);
-	JPEG_DBG("%s:%d] addr 0x%x size %ld", __func__, __LINE__,
-							(uint32_t)paddr, size);
-
-#elif CONFIG_ANDROID_PMEM
-	unsigned long kvstart;
-	rc = get_pmem_file(fd, &paddr, &kvstart, &size, file_p);
-#else
-	rc = 0;
-	paddr = 0;
-	size = 0;
-#endif
-	if (rc < 0) {
-		JPEG_PR_ERR("%s: get_pmem_file fd %d error %d\n", __func__, fd,
-			rc);
-		goto error1;
-	}
-
-	/* validate user input */
-	if (len > size) {
-		JPEG_PR_ERR("%s: invalid offset + len\n", __func__);
-		goto error1;
-	}
-
-	return paddr;
-error1:
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_free(jpeg_client, *ionhandle);
-#endif
-	return 0;
-}
-
-static struct msm_cam_clk_info jpeg_8x_clk_info[] = {
-	{"core_clk", 228570000},
-	{"iface_clk", -1},
-	{"bus_clk0", -1},
-	{"alt_bus_clk", -1},
-	{"camss_top_ahb_clk", -1},
-};
-
-static void set_vbif_params(void *jpeg_vbif_base)
-{
-	writel_relaxed(0x1,
-		jpeg_vbif_base + JPEG_VBIF_CLKON);
-	writel_relaxed(0x10101010,
-		jpeg_vbif_base + JPEG_VBIF_IN_RD_LIM_CONF0);
-	writel_relaxed(0x10101010,
-		jpeg_vbif_base + JPEG_VBIF_IN_RD_LIM_CONF1);
-	writel_relaxed(0x10101010,
-		jpeg_vbif_base + JPEG_VBIF_IN_RD_LIM_CONF2);
-	writel_relaxed(0x10101010,
-		jpeg_vbif_base + JPEG_VBIF_IN_WR_LIM_CONF0);
-	writel_relaxed(0x10101010,
-		jpeg_vbif_base + JPEG_VBIF_IN_WR_LIM_CONF1);
-	writel_relaxed(0x10101010,
-		jpeg_vbif_base + JPEG_VBIF_IN_WR_LIM_CONF2);
-	writel_relaxed(0x00001010,
-		jpeg_vbif_base + JPEG_VBIF_OUT_RD_LIM_CONF0);
-	writel_relaxed(0x00001010,
-		jpeg_vbif_base + JPEG_VBIF_OUT_WR_LIM_CONF0);
-	writel_relaxed(0x00000707,
-		jpeg_vbif_base + JPEG_VBIF_DDR_OUT_MAX_BURST);
-	writel_relaxed(0x00000707,
-		jpeg_vbif_base + JPEG_VBIF_OCMEM_OUT_MAX_BURST);
-}
-
-
-int msm_jpeg_platform_init(struct platform_device *pdev,
-	struct resource **mem,
-	void **base,
-	int *irq,
-	irqreturn_t (*handler) (int, void *),
-	void *context)
-{
-	int rc = -1;
-	int i = 0;
-	int jpeg_irq;
-	struct resource *jpeg_mem, *jpeg_io, *jpeg_irq_res;
-	void *jpeg_base;
-	struct msm_jpeg_device *pgmn_dev =
-		(struct msm_jpeg_device *) context;
-
-	jpeg_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!jpeg_mem) {
-		JPEG_PR_ERR("%s: no mem resource?\n", __func__);
-		return -ENODEV;
-	}
-
-	jpeg_irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!jpeg_irq_res) {
-		JPEG_PR_ERR("no irq resource?\n");
-		return -ENODEV;
-	}
-	jpeg_irq = jpeg_irq_res->start;
-	JPEG_DBG("%s base address: 0x%x, jpeg irq number: %d\n", __func__,
-						jpeg_mem->start, jpeg_irq);
-
-	jpeg_io = request_mem_region(jpeg_mem->start,
-					resource_size(jpeg_mem), pdev->name);
-	if (!jpeg_io) {
-		JPEG_PR_ERR("%s: region already claimed\n", __func__);
-		return -EBUSY;
-	}
-
-	jpeg_base = ioremap(jpeg_mem->start, resource_size(jpeg_mem));
-	if (!jpeg_base) {
-		rc = -ENOMEM;
-		JPEG_PR_ERR("%s: ioremap failed\n", __func__);
-		goto fail1;
-	}
-
-	jpeg_vbif = ioremap(VBIF_BASE_ADDRESS, VBIF_REGION_SIZE);
-	if (!jpeg_vbif) {
-		rc = -ENOMEM;
-		JPEG_PR_ERR("%s:%d] ioremap failed\n", __func__, __LINE__);
-		goto fail1;
-	}
-	JPEG_DBG("%s:%d] jpeg_vbif 0x%x", __func__, __LINE__,
-						(uint32_t)jpeg_vbif);
-
-	pgmn_dev->jpeg_fs = regulator_get(&pgmn_dev->pdev->dev, "vdd");
-	rc = regulator_enable(pgmn_dev->jpeg_fs);
-	if (rc) {
-		JPEG_PR_ERR("%s:%d]jpeg regulator get failed\n",
-				__func__, __LINE__); }
-
-	pgmn_dev->hw_version = JPEG_8974;
-	rc = msm_cam_clk_enable(&pgmn_dev->pdev->dev, jpeg_8x_clk_info,
-	 pgmn_dev->jpeg_clk, ARRAY_SIZE(jpeg_8x_clk_info), 1);
-	if (rc < 0) {
-		JPEG_PR_ERR("%s: clk failed rc = %d\n", __func__, rc);
-		goto fail2;
-	}
-
-#ifdef CONFIG_MSM_IOMMU
-	for (i = 0; i < pgmn_dev->iommu_cnt; i++) {
-		rc = iommu_attach_device(pgmn_dev->domain,
-				pgmn_dev->iommu_ctx_arr[i]);
-		if (rc < 0) {
-			rc = -ENODEV;
-			JPEG_PR_ERR("%s: Device attach failed\n", __func__);
-			goto fail;
-		}
-		JPEG_DBG("%s:%d] dom 0x%x ctx 0x%x", __func__, __LINE__,
-					(uint32_t)pgmn_dev->domain,
-					(uint32_t)pgmn_dev->iommu_ctx_arr[i]);
-	}
-#endif
-	set_vbif_params(jpeg_vbif);
-
-	msm_jpeg_hw_init(jpeg_base, resource_size(jpeg_mem));
-	rc = request_irq(jpeg_irq, handler, IRQF_TRIGGER_RISING, "jpeg",
-		context);
-	if (rc) {
-		JPEG_PR_ERR("%s: request_irq failed, %d\n", __func__,
-			jpeg_irq);
-		goto fail3;
-	}
-
-	*mem  = jpeg_mem;
-	*base = jpeg_base;
-	*irq  = jpeg_irq;
-
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	jpeg_client = msm_ion_client_create(-1, "camera/jpeg");
-#endif
-	JPEG_DBG("%s:%d] success\n", __func__, __LINE__);
-
-	return rc;
-
-fail3:
-	msm_cam_clk_enable(&pgmn_dev->pdev->dev, jpeg_8x_clk_info,
-	pgmn_dev->jpeg_clk, ARRAY_SIZE(jpeg_8x_clk_info), 0);
-
-	regulator_put(pgmn_dev->jpeg_fs);
-	regulator_disable(pgmn_dev->jpeg_fs);
-	pgmn_dev->jpeg_fs = NULL;
-fail2:
-	iounmap(jpeg_base);
-fail1:
-#ifdef CONFIG_MSM_IOMMU
-	for (i = 0; i < pgmn_dev->iommu_cnt; i++) {
-		JPEG_PR_ERR("%s:%d] dom 0x%x ctx 0x%x", __func__, __LINE__,
-					(uint32_t)pgmn_dev->domain,
-					(uint32_t)pgmn_dev->iommu_ctx_arr[i]);
-		iommu_detach_device(pgmn_dev->domain,
-					pgmn_dev->iommu_ctx_arr[i]);
-	}
-#endif
-fail:
-	release_mem_region(jpeg_mem->start, resource_size(jpeg_mem));
-	JPEG_DBG("%s:%d] fail\n", __func__, __LINE__);
-	return rc;
-}
-
-int msm_jpeg_platform_release(struct resource *mem, void *base, int irq,
-	void *context)
-{
-	int result = 0;
-	int i = 0;
-	struct msm_jpeg_device *pgmn_dev =
-		(struct msm_jpeg_device *) context;
-
-	free_irq(irq, context);
-
-#ifdef CONFIG_MSM_IOMMU
-	for (i = 0; i < pgmn_dev->iommu_cnt; i++) {
-		iommu_detach_device(pgmn_dev->domain,
-				pgmn_dev->iommu_ctx_arr[i]);
-		JPEG_DBG("%s:%d]", __func__, __LINE__);
-	}
-#endif
-
-	msm_cam_clk_enable(&pgmn_dev->pdev->dev, jpeg_8x_clk_info,
-	pgmn_dev->jpeg_clk, ARRAY_SIZE(jpeg_8x_clk_info), 0);
-	JPEG_DBG("%s:%d] clock disbale done", __func__, __LINE__);
-
-	if (pgmn_dev->jpeg_fs) {
-		regulator_put(pgmn_dev->jpeg_fs);
-		regulator_disable(pgmn_dev->jpeg_fs);
-		pgmn_dev->jpeg_fs = NULL;
-	}
-	iounmap(jpeg_vbif);
-	iounmap(base);
-	release_mem_region(mem->start, resource_size(mem));
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_client_destroy(jpeg_client);
-#endif
-	JPEG_DBG("%s:%d] success\n", __func__, __LINE__);
-	return result;
-}
-
diff --git a/drivers/media/video/msm/jpeg_10/msm_jpeg_platform.h b/drivers/media/video/msm/jpeg_10/msm_jpeg_platform.h
deleted file mode 100644
index 8a37cef..0000000
--- a/drivers/media/video/msm/jpeg_10/msm_jpeg_platform.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_JPEG_PLATFORM_H
-#define MSM_JPEG_PLATFORM_H
-
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/ion.h>
-#include <linux/iommu.h>
-#include <mach/iommu.h>
-
-
-void msm_jpeg_platform_p2v(struct file  *file,
-				struct ion_handle **ionhandle, int domain_num);
-uint32_t msm_jpeg_platform_v2p(int fd, uint32_t len, struct file **file,
-				struct ion_handle **ionhandle, int domain_num);
-
-int msm_jpeg_platform_clk_enable(void);
-int msm_jpeg_platform_clk_disable(void);
-
-int msm_jpeg_platform_init(struct platform_device *pdev,
-	struct resource **mem,
-	void **base,
-	int *irq,
-	irqreturn_t (*handler) (int, void *),
-	void *context);
-int msm_jpeg_platform_release(struct resource *mem, void *base, int irq,
-	void *context);
-
-#endif /* MSM_JPEG_PLATFORM_H */
diff --git a/drivers/media/video/msm/jpeg_10/msm_jpeg_sync.c b/drivers/media/video/msm/jpeg_10/msm_jpeg_sync.c
deleted file mode 100644
index 6ac4a5e..0000000
--- a/drivers/media/video/msm/jpeg_10/msm_jpeg_sync.c
+++ /dev/null
@@ -1,897 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/list.h>
-#include <linux/uaccess.h>
-#include <linux/slab.h>
-#include <media/msm_jpeg.h>
-#include "msm_jpeg_sync.h"
-#include "msm_jpeg_core.h"
-#include "msm_jpeg_platform.h"
-#include "msm_jpeg_common.h"
-
-static int release_buf;
-
-inline void msm_jpeg_q_init(char const *name, struct msm_jpeg_q *q_p)
-{
-	JPEG_DBG("%s:%d] %s\n", __func__, __LINE__, name);
-	q_p->name = name;
-	spin_lock_init(&q_p->lck);
-	INIT_LIST_HEAD(&q_p->q);
-	init_waitqueue_head(&q_p->wait);
-	q_p->unblck = 0;
-}
-
-inline void *msm_jpeg_q_out(struct msm_jpeg_q *q_p)
-{
-	unsigned long flags;
-	struct msm_jpeg_q_entry *q_entry_p = NULL;
-	void *data = NULL;
-
-	JPEG_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-	spin_lock_irqsave(&q_p->lck, flags);
-	if (!list_empty(&q_p->q)) {
-		q_entry_p = list_first_entry(&q_p->q, struct msm_jpeg_q_entry,
-			list);
-		list_del_init(&q_entry_p->list);
-	}
-	spin_unlock_irqrestore(&q_p->lck, flags);
-
-	if (q_entry_p) {
-		data = q_entry_p->data;
-		kfree(q_entry_p);
-	} else {
-		JPEG_DBG("%s:%d] %s no entry\n", __func__, __LINE__,
-			q_p->name);
-	}
-
-	return data;
-}
-
-inline int msm_jpeg_q_in(struct msm_jpeg_q *q_p, void *data)
-{
-	unsigned long flags;
-
-	struct msm_jpeg_q_entry *q_entry_p;
-
-	JPEG_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-
-	q_entry_p = kmalloc(sizeof(struct msm_jpeg_q_entry), GFP_ATOMIC);
-	if (!q_entry_p) {
-		JPEG_PR_ERR("%s: no mem\n", __func__);
-		return -EFAULT;
-	}
-	q_entry_p->data = data;
-
-	spin_lock_irqsave(&q_p->lck, flags);
-	list_add_tail(&q_entry_p->list, &q_p->q);
-	spin_unlock_irqrestore(&q_p->lck, flags);
-
-	return 0;
-}
-
-inline int msm_jpeg_q_in_buf(struct msm_jpeg_q *q_p,
-	struct msm_jpeg_core_buf *buf)
-{
-	struct msm_jpeg_core_buf *buf_p;
-
-	JPEG_DBG("%s:%d]\n", __func__, __LINE__);
-	buf_p = kmalloc(sizeof(struct msm_jpeg_core_buf), GFP_ATOMIC);
-	if (!buf_p) {
-		JPEG_PR_ERR("%s: no mem\n", __func__);
-		return -EFAULT;
-	}
-
-	memcpy(buf_p, buf, sizeof(struct msm_jpeg_core_buf));
-
-	msm_jpeg_q_in(q_p, buf_p);
-	return 0;
-}
-
-inline int msm_jpeg_q_wait(struct msm_jpeg_q *q_p)
-{
-	int tm = MAX_SCHEDULE_TIMEOUT; /* 500ms */
-	int rc;
-
-	JPEG_DBG("%s:%d] %s wait\n", __func__, __LINE__, q_p->name);
-	rc = wait_event_interruptible_timeout(q_p->wait,
-		(!list_empty_careful(&q_p->q) || q_p->unblck),
-		msecs_to_jiffies(tm));
-	JPEG_DBG("%s:%d] %s wait done\n", __func__, __LINE__, q_p->name);
-	if (list_empty_careful(&q_p->q)) {
-		if (rc == 0) {
-			rc = -ETIMEDOUT;
-			JPEG_PR_ERR("%s:%d] %s timeout\n", __func__, __LINE__,
-				q_p->name);
-		} else if (q_p->unblck) {
-			JPEG_DBG("%s:%d] %s unblock is true\n", __func__,
-				__LINE__, q_p->name);
-			q_p->unblck = 0;
-			rc = -ECANCELED;
-		} else if (rc < 0) {
-			JPEG_PR_ERR("%s:%d] %s rc %d\n", __func__, __LINE__,
-				q_p->name, rc);
-		}
-	}
-	return rc;
-}
-
-inline int msm_jpeg_q_wakeup(struct msm_jpeg_q *q_p)
-{
-	JPEG_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-	wake_up(&q_p->wait);
-	return 0;
-}
-
-inline int msm_jpeg_q_unblock(struct msm_jpeg_q *q_p)
-{
-	JPEG_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-	q_p->unblck = 1;
-	wake_up(&q_p->wait);
-	return 0;
-}
-
-inline void msm_jpeg_outbuf_q_cleanup(struct msm_jpeg_q *q_p,
-				int domain_num)
-{
-	struct msm_jpeg_core_buf *buf_p;
-	JPEG_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-	do {
-		buf_p = msm_jpeg_q_out(q_p);
-		if (buf_p) {
-			msm_jpeg_platform_p2v(buf_p->file,
-				&buf_p->handle, domain_num);
-			JPEG_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-			kfree(buf_p);
-		}
-	} while (buf_p);
-	q_p->unblck = 0;
-}
-
-inline void msm_jpeg_q_cleanup(struct msm_jpeg_q *q_p)
-{
-	void *data;
-	JPEG_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-	do {
-		data = msm_jpeg_q_out(q_p);
-		if (data) {
-			JPEG_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-			kfree(data);
-		}
-	} while (data);
-	q_p->unblck = 0;
-}
-
-/*************** event queue ****************/
-
-int msm_jpeg_framedone_irq(struct msm_jpeg_device *pgmn_dev,
-	struct msm_jpeg_core_buf *buf_in)
-{
-	int rc = 0;
-
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-
-	if (buf_in) {
-		buf_in->vbuf.framedone_len = buf_in->framedone_len;
-		buf_in->vbuf.type = MSM_JPEG_EVT_SESSION_DONE;
-		JPEG_DBG("%s:%d] 0x%08x %d framedone_len %d\n",
-			__func__, __LINE__,
-			(int) buf_in->y_buffer_addr, buf_in->y_len,
-			buf_in->vbuf.framedone_len);
-		rc = msm_jpeg_q_in_buf(&pgmn_dev->evt_q, buf_in);
-	} else {
-		JPEG_PR_ERR("%s:%d] no output return buffer\n",
-			__func__, __LINE__);
-		rc = -1;
-	}
-
-	if (buf_in)
-		rc = msm_jpeg_q_wakeup(&pgmn_dev->evt_q);
-
-	return rc;
-}
-
-int msm_jpeg_evt_get(struct msm_jpeg_device *pgmn_dev,
-	void __user *to)
-{
-	struct msm_jpeg_core_buf *buf_p;
-	struct msm_jpeg_ctrl_cmd ctrl_cmd;
-
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-
-	msm_jpeg_q_wait(&pgmn_dev->evt_q);
-	buf_p = msm_jpeg_q_out(&pgmn_dev->evt_q);
-
-	if (!buf_p) {
-		JPEG_DBG("%s:%d] no buffer\n", __func__, __LINE__);
-		return -EAGAIN;
-	}
-
-	ctrl_cmd.type = buf_p->vbuf.type;
-	kfree(buf_p);
-
-	JPEG_DBG("%s:%d] 0x%08x %d\n", __func__, __LINE__,
-		(int) ctrl_cmd.value, ctrl_cmd.len);
-
-	if (copy_to_user(to, &ctrl_cmd, sizeof(ctrl_cmd))) {
-		JPEG_PR_ERR("%s:%d]\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	return 0;
-}
-
-int msm_jpeg_evt_get_unblock(struct msm_jpeg_device *pgmn_dev)
-{
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_jpeg_q_unblock(&pgmn_dev->evt_q);
-	return 0;
-}
-
-void msm_jpeg_reset_ack_irq(struct msm_jpeg_device *pgmn_dev)
-{
-	JPEG_DBG("%s:%d]\n", __func__, __LINE__);
-}
-
-void msm_jpeg_err_irq(struct msm_jpeg_device *pgmn_dev,
-	int event)
-{
-	int rc = 0;
-	struct msm_jpeg_core_buf buf;
-
-	JPEG_PR_ERR("%s:%d] error: %d\n", __func__, __LINE__, event);
-
-	buf.vbuf.type = MSM_JPEG_EVT_ERR;
-	rc = msm_jpeg_q_in_buf(&pgmn_dev->evt_q, &buf);
-	if (!rc)
-		rc = msm_jpeg_q_wakeup(&pgmn_dev->evt_q);
-
-	if (!rc)
-		JPEG_PR_ERR("%s:%d] err err\n", __func__, __LINE__);
-
-	return;
-}
-
-/*************** output queue ****************/
-
-int msm_jpeg_we_pingpong_irq(struct msm_jpeg_device *pgmn_dev,
-	struct msm_jpeg_core_buf *buf_in)
-{
-	int rc = 0;
-	struct msm_jpeg_core_buf *buf_out;
-
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	if (buf_in) {
-		JPEG_DBG("%s:%d] 0x%08x %d\n", __func__, __LINE__,
-			(int) buf_in->y_buffer_addr, buf_in->y_len);
-		rc = msm_jpeg_q_in_buf(&pgmn_dev->output_rtn_q, buf_in);
-	} else {
-		JPEG_DBG("%s:%d] no output return buffer\n", __func__,
-			__LINE__);
-		rc = -1;
-		return rc;
-	}
-
-	buf_out = msm_jpeg_q_out(&pgmn_dev->output_buf_q);
-
-	if (buf_out) {
-		JPEG_DBG("%s:%d] 0x%08x %d\n", __func__, __LINE__,
-			(int) buf_out->y_buffer_addr, buf_out->y_len);
-		rc = msm_jpeg_core_we_buf_update(buf_out);
-		kfree(buf_out);
-	} else {
-		msm_jpeg_core_we_buf_reset(buf_in);
-		JPEG_DBG("%s:%d] no output buffer\n", __func__, __LINE__);
-		rc = -2;
-	}
-
-	if (buf_in)
-		rc = msm_jpeg_q_wakeup(&pgmn_dev->output_rtn_q);
-
-	return rc;
-}
-
-int msm_jpeg_output_get(struct msm_jpeg_device *pgmn_dev, void __user *to)
-{
-	struct msm_jpeg_core_buf *buf_p;
-	struct msm_jpeg_buf buf_cmd;
-
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-
-	msm_jpeg_q_wait(&pgmn_dev->output_rtn_q);
-	buf_p = msm_jpeg_q_out(&pgmn_dev->output_rtn_q);
-
-	if (!buf_p) {
-		JPEG_DBG("%s:%d] no output buffer return\n",
-			__func__, __LINE__);
-		return -EAGAIN;
-	}
-
-	buf_cmd = buf_p->vbuf;
-	msm_jpeg_platform_p2v(buf_p->file, &buf_p->handle,
-		pgmn_dev->domain_num);
-	kfree(buf_p);
-
-	JPEG_DBG("%s:%d] 0x%08x %d\n", __func__, __LINE__,
-		(int) buf_cmd.vaddr, buf_cmd.y_len);
-
-	if (copy_to_user(to, &buf_cmd, sizeof(buf_cmd))) {
-		JPEG_PR_ERR("%s:%d]", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	return 0;
-}
-
-int msm_jpeg_output_get_unblock(struct msm_jpeg_device *pgmn_dev)
-{
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_jpeg_q_unblock(&pgmn_dev->output_rtn_q);
-	return 0;
-}
-
-int msm_jpeg_output_buf_enqueue(struct msm_jpeg_device *pgmn_dev,
-	void __user *arg)
-{
-	struct msm_jpeg_buf buf_cmd;
-	struct msm_jpeg_core_buf *buf_p;
-
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	if (copy_from_user(&buf_cmd, arg, sizeof(struct msm_jpeg_buf))) {
-		JPEG_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	buf_p = kmalloc(sizeof(struct msm_jpeg_core_buf), GFP_ATOMIC);
-	if (!buf_p) {
-		JPEG_PR_ERR("%s:%d] no mem\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	JPEG_DBG("%s:%d] vaddr = 0x%08x y_len = %d\n, fd = %d",
-		__func__, __LINE__, (int) buf_cmd.vaddr, buf_cmd.y_len,
-		buf_cmd.fd);
-
-	buf_p->y_buffer_addr = msm_jpeg_platform_v2p(buf_cmd.fd,
-		buf_cmd.y_len, &buf_p->file, &buf_p->handle,
-		pgmn_dev->domain_num);
-	if (!buf_p->y_buffer_addr) {
-		JPEG_PR_ERR("%s:%d] v2p wrong\n", __func__, __LINE__);
-		kfree(buf_p);
-		return -EFAULT;
-	}
-	JPEG_DBG("%s:%d]After v2p y_address =0x%08x, handle = %p\n",
-		__func__, __LINE__, buf_p->y_buffer_addr, buf_p->handle);
-	buf_p->y_len = buf_cmd.y_len;
-	buf_p->vbuf = buf_cmd;
-
-	msm_jpeg_q_in(&pgmn_dev->output_buf_q, buf_p);
-	return 0;
-}
-
-/*************** input queue ****************/
-
-int msm_jpeg_fe_pingpong_irq(struct msm_jpeg_device *pgmn_dev,
-	struct msm_jpeg_core_buf *buf_in)
-{
-	struct msm_jpeg_core_buf *buf_out;
-	int rc = 0;
-
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	if (buf_in) {
-		JPEG_DBG("%s:%d] 0x%08x %d\n", __func__, __LINE__,
-			(int) buf_in->y_buffer_addr, buf_in->y_len);
-		rc = msm_jpeg_q_in_buf(&pgmn_dev->input_rtn_q, buf_in);
-	} else {
-		JPEG_DBG("%s:%d] no input return buffer\n", __func__,
-			__LINE__);
-		rc = -EFAULT;
-	}
-
-	buf_out = msm_jpeg_q_out(&pgmn_dev->input_buf_q);
-
-	if (buf_out) {
-		rc = msm_jpeg_core_fe_buf_update(buf_out);
-		kfree(buf_out);
-		msm_jpeg_core_fe_start();
-	} else {
-		JPEG_DBG("%s:%d] no input buffer\n", __func__, __LINE__);
-		rc = -EFAULT;
-	}
-
-	if (buf_in)
-		rc = msm_jpeg_q_wakeup(&pgmn_dev->input_rtn_q);
-
-	return rc;
-}
-
-int msm_jpeg_input_get(struct msm_jpeg_device *pgmn_dev, void __user *to)
-{
-	struct msm_jpeg_core_buf *buf_p;
-	struct msm_jpeg_buf buf_cmd;
-
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_jpeg_q_wait(&pgmn_dev->input_rtn_q);
-	buf_p = msm_jpeg_q_out(&pgmn_dev->input_rtn_q);
-
-	if (!buf_p) {
-		JPEG_DBG("%s:%d] no input buffer return\n",
-			__func__, __LINE__);
-		return -EAGAIN;
-	}
-
-	buf_cmd = buf_p->vbuf;
-	msm_jpeg_platform_p2v(buf_p->file, &buf_p->handle,
-					pgmn_dev->domain_num);
-	kfree(buf_p);
-
-	JPEG_DBG("%s:%d] 0x%08x %d\n", __func__, __LINE__,
-		(int) buf_cmd.vaddr, buf_cmd.y_len);
-
-	if (copy_to_user(to, &buf_cmd, sizeof(buf_cmd))) {
-		JPEG_PR_ERR("%s:%d]\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	return 0;
-}
-
-int msm_jpeg_input_get_unblock(struct msm_jpeg_device *pgmn_dev)
-{
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_jpeg_q_unblock(&pgmn_dev->input_rtn_q);
-	return 0;
-}
-
-int msm_jpeg_input_buf_enqueue(struct msm_jpeg_device *pgmn_dev,
-	void __user *arg)
-{
-	struct msm_jpeg_core_buf *buf_p;
-	struct msm_jpeg_buf buf_cmd;
-
-	if (copy_from_user(&buf_cmd, arg, sizeof(struct msm_jpeg_buf))) {
-		JPEG_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	buf_p = kmalloc(sizeof(struct msm_jpeg_core_buf), GFP_ATOMIC);
-	if (!buf_p) {
-		JPEG_PR_ERR("%s:%d] no mem\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	JPEG_DBG("%s:%d] 0x%08x %d\n", __func__, __LINE__,
-		(int) buf_cmd.vaddr, buf_cmd.y_len);
-
-	buf_p->y_buffer_addr    = msm_jpeg_platform_v2p(buf_cmd.fd,
-		buf_cmd.y_len + buf_cmd.cbcr_len, &buf_p->file,
-		&buf_p->handle, pgmn_dev->domain_num) + buf_cmd.offset
-		+ buf_cmd.y_off;
-	buf_p->y_len          = buf_cmd.y_len;
-	buf_p->cbcr_buffer_addr = buf_p->y_buffer_addr + buf_cmd.y_len
-						+ buf_cmd.cbcr_off;
-	buf_p->cbcr_len       = buf_cmd.cbcr_len;
-	buf_p->num_of_mcu_rows = buf_cmd.num_of_mcu_rows;
-	JPEG_DBG("%s: y_addr=%x, y_len=%x, cbcr_addr=%x, cbcr_len=%x, fd =%d\n",
-		__func__, buf_p->y_buffer_addr, buf_p->y_len,
-		buf_p->cbcr_buffer_addr, buf_p->cbcr_len, buf_cmd.fd);
-
-	if (!buf_p->y_buffer_addr || !buf_p->cbcr_buffer_addr) {
-		JPEG_PR_ERR("%s:%d] v2p wrong\n", __func__, __LINE__);
-		kfree(buf_p);
-		return -EFAULT;
-	}
-	buf_p->vbuf           = buf_cmd;
-
-	msm_jpeg_q_in(&pgmn_dev->input_buf_q, buf_p);
-
-	return 0;
-}
-
-int msm_jpeg_irq(int event, void *context, void *data)
-{
-	struct msm_jpeg_device *pgmn_dev =
-		(struct msm_jpeg_device *) context;
-
-	switch (event) {
-	case MSM_JPEG_EVT_SESSION_DONE:
-		msm_jpeg_framedone_irq(pgmn_dev, data);
-		msm_jpeg_we_pingpong_irq(pgmn_dev, data);
-		break;
-
-	case MSM_JPEG_HW_MASK_COMP_FE:
-		msm_jpeg_fe_pingpong_irq(pgmn_dev, data);
-		break;
-
-	case MSM_JPEG_HW_MASK_COMP_WE:
-		msm_jpeg_we_pingpong_irq(pgmn_dev, data);
-		break;
-
-	case MSM_JPEG_HW_MASK_COMP_RESET_ACK:
-		msm_jpeg_reset_ack_irq(pgmn_dev);
-		break;
-
-	case MSM_JPEG_HW_MASK_COMP_ERR:
-	default:
-		msm_jpeg_err_irq(pgmn_dev, event);
-		break;
-	}
-
-	return 0;
-}
-
-int __msm_jpeg_open(struct msm_jpeg_device *pgmn_dev)
-{
-	int rc;
-
-	mutex_lock(&pgmn_dev->lock);
-	if (pgmn_dev->open_count) {
-		/* only open once */
-		JPEG_PR_ERR("%s:%d] busy\n", __func__, __LINE__);
-		mutex_unlock(&pgmn_dev->lock);
-		return -EBUSY;
-	}
-	pgmn_dev->open_count++;
-	mutex_unlock(&pgmn_dev->lock);
-
-	msm_jpeg_core_irq_install(msm_jpeg_irq);
-	rc = msm_jpeg_platform_init(pgmn_dev->pdev,
-		&pgmn_dev->mem, &pgmn_dev->base,
-		&pgmn_dev->irq, msm_jpeg_core_irq, pgmn_dev);
-	if (rc) {
-		JPEG_PR_ERR("%s:%d] platform_init fail %d\n", __func__,
-			__LINE__, rc);
-		return rc;
-	}
-
-	JPEG_DBG("%s:%d] platform resources - mem %p, base %p, irq %d\n",
-		__func__, __LINE__,
-		pgmn_dev->mem, pgmn_dev->base, pgmn_dev->irq);
-
-	msm_jpeg_q_cleanup(&pgmn_dev->evt_q);
-	msm_jpeg_q_cleanup(&pgmn_dev->output_rtn_q);
-	msm_jpeg_outbuf_q_cleanup(&pgmn_dev->output_buf_q,
-	pgmn_dev->domain_num); msm_jpeg_q_cleanup(&pgmn_dev->input_rtn_q);
-	msm_jpeg_q_cleanup(&pgmn_dev->input_buf_q);
-	msm_jpeg_core_init();
-
-	JPEG_DBG("%s:%d] success\n", __func__, __LINE__);
-	return rc;
-}
-
-int __msm_jpeg_release(struct msm_jpeg_device *pgmn_dev)
-{
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	mutex_lock(&pgmn_dev->lock);
-	if (!pgmn_dev->open_count) {
-		JPEG_PR_ERR(KERN_ERR "%s: not opened\n", __func__);
-		mutex_unlock(&pgmn_dev->lock);
-		return -EINVAL;
-	}
-	pgmn_dev->open_count--;
-	mutex_unlock(&pgmn_dev->lock);
-
-	msm_jpeg_core_release(release_buf, pgmn_dev->domain_num);
-	msm_jpeg_q_cleanup(&pgmn_dev->evt_q);
-	msm_jpeg_q_cleanup(&pgmn_dev->output_rtn_q);
-	msm_jpeg_outbuf_q_cleanup(&pgmn_dev->output_buf_q,
-					pgmn_dev->domain_num);
-	msm_jpeg_q_cleanup(&pgmn_dev->input_rtn_q);
-	msm_jpeg_outbuf_q_cleanup(&pgmn_dev->input_buf_q, pgmn_dev->domain_num);
-
-	JPEG_DBG("%s:%d]\n", __func__, __LINE__);
-	if (pgmn_dev->open_count)
-		JPEG_PR_ERR(KERN_ERR "%s: multiple opens\n", __func__);
-
-	msm_jpeg_platform_release(pgmn_dev->mem, pgmn_dev->base,
-		pgmn_dev->irq, pgmn_dev);
-
-	return 0;
-}
-
-int msm_jpeg_ioctl_hw_cmd(struct msm_jpeg_device *pgmn_dev,
-	void * __user arg)
-{
-	struct msm_jpeg_hw_cmd hw_cmd;
-	int is_copy_to_user;
-
-	if (copy_from_user(&hw_cmd, arg, sizeof(struct msm_jpeg_hw_cmd))) {
-		JPEG_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	is_copy_to_user = msm_jpeg_hw_exec_cmds(&hw_cmd, 1);
-	JPEG_DBG("%s:%d] type %d, n %d, offset %d, mask %x, data %x,pdata %x\n",
-		__func__, __LINE__, hw_cmd.type, hw_cmd.n, hw_cmd.offset,
-		hw_cmd.mask, hw_cmd.data, (int) hw_cmd.pdata);
-
-	if (is_copy_to_user >= 0) {
-		if (copy_to_user(arg, &hw_cmd, sizeof(hw_cmd))) {
-			JPEG_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-			return -EFAULT;
-		}
-	}
-
-	return 0;
-}
-
-int msm_jpeg_ioctl_hw_cmds(struct msm_jpeg_device *pgmn_dev,
-	void * __user arg)
-{
-	int is_copy_to_user;
-	int len;
-	uint32_t m;
-	struct msm_jpeg_hw_cmds *hw_cmds_p;
-	struct msm_jpeg_hw_cmd *hw_cmd_p;
-
-	if (copy_from_user(&m, arg, sizeof(m))) {
-		JPEG_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	len = sizeof(struct msm_jpeg_hw_cmds) +
-		sizeof(struct msm_jpeg_hw_cmd) * (m - 1);
-	hw_cmds_p = kmalloc(len, GFP_KERNEL);
-	if (!hw_cmds_p) {
-		JPEG_PR_ERR("%s:%d] no mem %d\n", __func__, __LINE__, len);
-		return -EFAULT;
-	}
-
-	if (copy_from_user(hw_cmds_p, arg, len)) {
-		JPEG_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		kfree(hw_cmds_p);
-		return -EFAULT;
-	}
-
-	hw_cmd_p = (struct msm_jpeg_hw_cmd *) &(hw_cmds_p->hw_cmd);
-
-	is_copy_to_user = msm_jpeg_hw_exec_cmds(hw_cmd_p, m);
-
-	if (is_copy_to_user >= 0) {
-		if (copy_to_user(arg, hw_cmds_p, len)) {
-			JPEG_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-			kfree(hw_cmds_p);
-			return -EFAULT;
-		}
-	}
-	kfree(hw_cmds_p);
-	return 0;
-}
-
-int msm_jpeg_start(struct msm_jpeg_device *pgmn_dev, void * __user arg)
-{
-	struct msm_jpeg_core_buf *buf_out;
-	struct msm_jpeg_core_buf *buf_out_free[2] = {NULL, NULL};
-	int i, rc;
-
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-
-	release_buf = 1;
-	for (i = 0; i < 2; i++) {
-		buf_out = msm_jpeg_q_out(&pgmn_dev->input_buf_q);
-
-		if (buf_out) {
-			msm_jpeg_core_fe_buf_update(buf_out);
-			kfree(buf_out);
-		} else {
-			JPEG_DBG("%s:%d] no input buffer\n", __func__,
-					__LINE__);
-			break;
-		}
-	}
-
-	for (i = 0; i < 2; i++) {
-		buf_out_free[i] = msm_jpeg_q_out(&pgmn_dev->output_buf_q);
-
-		if (buf_out_free[i]) {
-			msm_jpeg_core_we_buf_update(buf_out_free[i]);
-			release_buf = 0;
-		} else {
-			JPEG_DBG("%s:%d] no output buffer\n",
-			__func__, __LINE__);
-			break;
-		}
-	}
-
-	for (i = 0; i < 2; i++)
-		kfree(buf_out_free[i]);
-
-	rc = msm_jpeg_ioctl_hw_cmds(pgmn_dev, arg);
-	JPEG_DBG("%s:%d]\n", __func__, __LINE__);
-	return rc;
-}
-
-int msm_jpeg_ioctl_reset(struct msm_jpeg_device *pgmn_dev,
-	void * __user arg)
-{
-	int rc;
-	struct msm_jpeg_ctrl_cmd ctrl_cmd;
-
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	if (copy_from_user(&ctrl_cmd, arg, sizeof(ctrl_cmd))) {
-		JPEG_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	pgmn_dev->op_mode = ctrl_cmd.type;
-
-	rc = msm_jpeg_core_reset(pgmn_dev->op_mode, pgmn_dev->base,
-		resource_size(pgmn_dev->mem));
-	return rc;
-}
-
-int msm_jpeg_ioctl_test_dump_region(struct msm_jpeg_device *pgmn_dev,
-	unsigned long arg)
-{
-	JPEG_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_jpeg_io_dump(arg);
-	return 0;
-}
-
-long __msm_jpeg_ioctl(struct msm_jpeg_device *pgmn_dev,
-	unsigned int cmd, unsigned long arg)
-{
-	int rc = 0;
-	switch (cmd) {
-	case MSM_JPEG_IOCTL_GET_HW_VERSION:
-		JPEG_DBG("%s:%d] VERSION 1\n", __func__, __LINE__);
-		rc = msm_jpeg_ioctl_hw_cmd(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_JPEG_IOCTL_RESET:
-		rc = msm_jpeg_ioctl_reset(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_JPEG_IOCTL_STOP:
-		rc = msm_jpeg_ioctl_hw_cmds(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_JPEG_IOCTL_START:
-		rc = msm_jpeg_start(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_JPEG_IOCTL_INPUT_BUF_ENQUEUE:
-		rc = msm_jpeg_input_buf_enqueue(pgmn_dev,
-			(void __user *) arg);
-		break;
-
-	case MSM_JPEG_IOCTL_INPUT_GET:
-		rc = msm_jpeg_input_get(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_JPEG_IOCTL_INPUT_GET_UNBLOCK:
-		rc = msm_jpeg_input_get_unblock(pgmn_dev);
-		break;
-
-	case MSM_JPEG_IOCTL_OUTPUT_BUF_ENQUEUE:
-		rc = msm_jpeg_output_buf_enqueue(pgmn_dev,
-			(void __user *) arg);
-		break;
-
-	case MSM_JPEG_IOCTL_OUTPUT_GET:
-		rc = msm_jpeg_output_get(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_JPEG_IOCTL_OUTPUT_GET_UNBLOCK:
-		rc = msm_jpeg_output_get_unblock(pgmn_dev);
-		break;
-
-	case MSM_JPEG_IOCTL_EVT_GET:
-		rc = msm_jpeg_evt_get(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_JPEG_IOCTL_EVT_GET_UNBLOCK:
-		rc = msm_jpeg_evt_get_unblock(pgmn_dev);
-		break;
-
-	case MSM_JPEG_IOCTL_HW_CMD:
-		rc = msm_jpeg_ioctl_hw_cmd(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_JPEG_IOCTL_HW_CMDS:
-		rc = msm_jpeg_ioctl_hw_cmds(pgmn_dev, (void __user *) arg);
-		break;
-
-	case MSM_JPEG_IOCTL_TEST_DUMP_REGION:
-		rc = msm_jpeg_ioctl_test_dump_region(pgmn_dev, arg);
-		break;
-
-	default:
-		JPEG_PR_ERR(KERN_INFO "%s:%d] cmd = %d not supported\n",
-			__func__, __LINE__, _IOC_NR(cmd));
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-static int camera_register_domain(void)
-{
-	struct msm_iova_partition camera_fw_partition = {
-		.start = SZ_128K,
-		.size = SZ_2G - SZ_128K,
-	};
-
-	struct msm_iova_layout camera_fw_layout = {
-		.partitions = &camera_fw_partition,
-		.npartitions = 1,
-		.client_name = "camera_jpeg",
-		.domain_flags = 0,
-	};
-	return msm_register_domain(&camera_fw_layout);
-}
-#endif
-
-int __msm_jpeg_init(struct msm_jpeg_device *pgmn_dev)
-{
-	int rc = 0, i = 0;
-	int idx = 0;
-	char *iommu_name[3] = {"jpeg_enc0", "jpeg_enc1", "jpeg_dec"};
-
-	mutex_init(&pgmn_dev->lock);
-
-	pr_err("%s:%d] Jpeg Device id %d", __func__, __LINE__,
-		   pgmn_dev->pdev->id);
-	idx = pgmn_dev->pdev->id;
-	pgmn_dev->idx = idx;
-	pgmn_dev->iommu_cnt = 1;
-
-	msm_jpeg_q_init("evt_q", &pgmn_dev->evt_q);
-	msm_jpeg_q_init("output_rtn_q", &pgmn_dev->output_rtn_q);
-	msm_jpeg_q_init("output_buf_q", &pgmn_dev->output_buf_q);
-	msm_jpeg_q_init("input_rtn_q", &pgmn_dev->input_rtn_q);
-	msm_jpeg_q_init("input_buf_q", &pgmn_dev->input_buf_q);
-
-#ifdef CONFIG_MSM_IOMMU
-/*get device context for IOMMU*/
-	for (i = 0; i < pgmn_dev->iommu_cnt; i++) {
-		pgmn_dev->iommu_ctx_arr[i] = msm_iommu_get_ctx(iommu_name[i]);
-		JPEG_DBG("%s:%d] name %s", __func__, __LINE__, iommu_name[i]);
-		JPEG_DBG("%s:%d] ctx 0x%x", __func__, __LINE__,
-					(uint32_t)pgmn_dev->iommu_ctx_arr[i]);
-		if (!pgmn_dev->iommu_ctx_arr[i]) {
-			JPEG_PR_ERR("%s: No iommu fw context found\n",
-					__func__);
-			goto error;
-		}
-	}
-	pgmn_dev->domain_num = camera_register_domain();
-	JPEG_DBG("%s:%d] dom_num 0x%x", __func__, __LINE__,
-				pgmn_dev->domain_num);
-	if (pgmn_dev->domain_num < 0) {
-		JPEG_PR_ERR("%s: could not register domain\n", __func__);
-		goto error;
-	}
-	pgmn_dev->domain = msm_get_iommu_domain(pgmn_dev->domain_num);
-	JPEG_DBG("%s:%d] dom 0x%x", __func__, __LINE__,
-					(uint32_t)pgmn_dev->domain);
-	if (!pgmn_dev->domain) {
-		JPEG_PR_ERR("%s: cannot find domain\n", __func__);
-		goto error;
-	}
-#endif
-
-	return rc;
-error:
-	mutex_destroy(&pgmn_dev->lock);
-	return -EFAULT;
-}
-
-int __msm_jpeg_exit(struct msm_jpeg_device *pgmn_dev)
-{
-	mutex_destroy(&pgmn_dev->lock);
-	kfree(pgmn_dev);
-	return 0;
-}
diff --git a/drivers/media/video/msm/jpeg_10/msm_jpeg_sync.h b/drivers/media/video/msm/jpeg_10/msm_jpeg_sync.h
deleted file mode 100644
index 1d82060..0000000
--- a/drivers/media/video/msm/jpeg_10/msm_jpeg_sync.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-
-
-#ifndef MSM_JPEG_SYNC_H
-#define MSM_JPEG_SYNC_H
-
-#include <linux/fs.h>
-#include <linux/list.h>
-#include <linux/cdev.h>
-#include <linux/platform_device.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-subdev.h>
-#include "msm_jpeg_core.h"
-
-#define JPEG_7X 0x1
-#define JPEG_8X60 (0x1 << 1)
-#define JPEG_8960 (0x1 << 2)
-#define JPEG_8974 0x1
-
-struct msm_jpeg_q {
-	char const	*name;
-	struct list_head  q;
-	spinlock_t	lck;
-	wait_queue_head_t wait;
-	int	       unblck;
-};
-
-struct msm_jpeg_q_entry {
-	struct list_head list;
-	void   *data;
-};
-
-struct msm_jpeg_device {
-	struct platform_device *pdev;
-	struct resource        *mem;
-	int                     irq;
-	void                   *base;
-	struct clk *jpeg_clk[5];
-	struct regulator *jpeg_fs;
-	uint32_t hw_version;
-
-	struct device *device;
-	struct cdev   cdev;
-	struct mutex  lock;
-	char	  open_count;
-	uint8_t       op_mode;
-
-	/* event queue including frame done & err indications
-	 */
-	struct msm_jpeg_q evt_q;
-
-	/* output return queue
-	 */
-	struct msm_jpeg_q output_rtn_q;
-
-	/* output buf queue
-	 */
-	struct msm_jpeg_q output_buf_q;
-
-	/* input return queue
-	 */
-	struct msm_jpeg_q input_rtn_q;
-
-	/* input buf queue
-	 */
-	struct msm_jpeg_q input_buf_q;
-
-	struct v4l2_subdev subdev;
-
-	struct class *msm_jpeg_class;
-
-	dev_t msm_jpeg_devno;
-
-	/*iommu domain and context*/
-	int domain_num;
-	int idx;
-	struct iommu_domain *domain;
-	struct device *iommu_ctx_arr[3];
-	int iommu_cnt;
-};
-
-int __msm_jpeg_open(struct msm_jpeg_device *pgmn_dev);
-int __msm_jpeg_release(struct msm_jpeg_device *pgmn_dev);
-
-long __msm_jpeg_ioctl(struct msm_jpeg_device *pgmn_dev,
-	unsigned int cmd, unsigned long arg);
-
-int __msm_jpeg_init(struct msm_jpeg_device *pgmn_dev);
-int __msm_jpeg_exit(struct msm_jpeg_device *pgmn_dev);
-
-#endif /* MSM_JPEG_SYNC_H */
diff --git a/drivers/media/video/msm/mercury/Makefile b/drivers/media/video/msm/mercury/Makefile
deleted file mode 100644
index ce4c86d..0000000
--- a/drivers/media/video/msm/mercury/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-EXTRA_CFLAGS += -Idrivers/media/video/msm
-obj-$(CONFIG_MSM_MERCURY) += msm_mercury_dev.o msm_mercury_core.o msm_mercury_hw.o msm_mercury_platform.o msm_mercury_sync.o
diff --git a/drivers/media/video/msm/mercury/msm_mercury_common.h b/drivers/media/video/msm/mercury/msm_mercury_common.h
deleted file mode 100644
index 8ce7f7e..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_common.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_MERCURY_COMMON_H
-#define MSM_MERCURY_COMMON_H
-
-#define MSM_MERCURY_DEBUG
-#ifdef MSM_MERCURY_DEBUG
-#define MCR_DBG(fmt, args...) pr_debug(fmt, ##args)
-#else
-#define MCR_DBG(fmt, args...) do { } while (0)
-#endif
-
-#define MCR_PR_ERR   pr_err
-#endif /* MSM_MERCURY_COMMON_H */
diff --git a/drivers/media/video/msm/mercury/msm_mercury_core.c b/drivers/media/video/msm/mercury/msm_mercury_core.c
deleted file mode 100644
index b0630f0..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_core.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/delay.h>
-#include <linux/io.h>
-#include <linux/clk.h>
-#include <mach/clk.h>
-#include <mach/msm_bus.h>
-#include <mach/msm_bus_board.h>
-#include "msm_mercury_hw.h"
-#include "msm_mercury_core.h"
-#include "msm_mercury_platform.h"
-#include "msm_mercury_common.h"
-
-static int reset_done_ack;
-static spinlock_t reset_lock;
-static wait_queue_head_t reset_wait;
-
-int mercury_core_reset(void)
-{
-	struct clk *clk = NULL;
-
-	/*Resettting MMSS Fabric*/
-
-	clk = clk_get(NULL, "jpegd_clk");
-
-	if (!IS_ERR(clk))
-		clk_enable(clk);
-
-	msm_bus_axi_porthalt(MSM_BUS_MASTER_JPEG_DEC);
-	clk_reset(clk, CLK_RESET_ASSERT);
-
-	/*need to have some delay here, there is no
-	 other way to know if hardware reset is complete*/
-	usleep_range(1000, 1200);
-
-	msm_bus_axi_portunhalt(MSM_BUS_MASTER_JPEG_DEC);
-	clk_reset(clk, CLK_RESET_DEASSERT);
-
-	return 0;
-}
-
-int msm_mercury_core_reset(void)
-{
-	unsigned long flags;
-	int rc = 0;
-	int tm = 500;/*500ms*/
-	MCR_DBG("\n%s\n(%d)%s()\n", __FILE__, __LINE__, __func__);
-
-	spin_lock_irqsave(&reset_lock, flags);
-	reset_done_ack = 0;
-	spin_unlock_irqrestore(&reset_lock, flags);
-
-	msm_mercury_hw_reset();
-	rc = wait_event_interruptible_timeout(reset_wait,
-		reset_done_ack,
-		msecs_to_jiffies(tm));
-
-	if (!reset_done_ack) {
-		MCR_DBG("%s: reset ACK failed %d", __func__, rc);
-		return -EBUSY;
-	}
-
-	MCR_DBG("(%d)%s() reset_done_ack rc %d\n\n", __LINE__, __func__, rc);
-	spin_lock_irqsave(&reset_lock, flags);
-	reset_done_ack = 0;
-	spin_unlock_irqrestore(&reset_lock, flags);
-
-	return 0;
-}
-
-void msm_mercury_core_init(void)
-{
-	init_waitqueue_head(&reset_wait);
-	spin_lock_init(&reset_lock);
-}
-
-static int (*msm_mercury_irq_handler) (int, void *, void *);
-
-irqreturn_t msm_mercury_core_irq(int irq_num, void *context)
-{
-	void *data = NULL;
-	unsigned long flags;
-	uint16_t mcr_rd_irq;
-	uint16_t mcr_wr_irq;
-	uint32_t jpeg_status;
-
-	MCR_DBG("\n(%d)%s() irq_number = %d", __LINE__, __func__, irq_num);
-
-	spin_lock_irqsave(&reset_lock, flags);
-	reset_done_ack = 1;
-	spin_unlock_irqrestore(&reset_lock, flags);
-
-	msm_mercury_hw_irq_get_status(&mcr_rd_irq, &mcr_wr_irq);
-	msm_mercury_hw_get_jpeg_status(&jpeg_status);
-	MCR_DBG("mercury_rd_irq = 0x%08X\n", mcr_rd_irq);
-	MCR_DBG("mercury_wr_irq = 0x%08X\n", mcr_wr_irq);
-	MCR_DBG("jpeg_status = 0x%08X\n", jpeg_status);
-	if (mcr_wr_irq & MSM_MERCURY_HW_IRQ_SW_RESET_ACK) {
-		MCR_DBG("*** SW Reset IRQ received ***\n");
-		wake_up(&reset_wait);
-		msm_mercury_hw_wr_irq_clear(MSM_MERCURY_HW_IRQ_SW_RESET_ACK);
-	}
-	if (mcr_wr_irq & MSM_MERCURY_HW_IRQ_WR_ERR_ACK) {
-		MCR_DBG("   *** Error IRQ received ***\n");
-		msm_mercury_irq_handler(MSM_MERCURY_HW_IRQ_WR_ERR_ACK,
-								context, data);
-	}
-	if (mcr_wr_irq & MSM_MERCURY_HW_IRQ_WR_EOI_ACK) {
-		MCR_DBG("   *** WE_EOI IRQ received ***\n");
-		msm_mercury_irq_handler(MSM_MERCURY_HW_IRQ_WR_EOI_ACK,
-								context, data);
-	}
-	return IRQ_HANDLED;
-}
-
-void msm_mercury_core_irq_install(int (*irq_handler) (int, void *, void *))
-{
-	msm_mercury_irq_handler = irq_handler;
-}
-
-void msm_mercury_core_irq_remove(void)
-{
-	msm_mercury_irq_handler = NULL;
-}
diff --git a/drivers/media/video/msm/mercury/msm_mercury_core.h b/drivers/media/video/msm/mercury/msm_mercury_core.h
deleted file mode 100644
index 7237e7b..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_core.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_MERCURY_CORE_H
-#define MSM_MERCURY_CORE_H
-
-#include <linux/interrupt.h>
-#include "msm_mercury_hw.h"
-
-#define msm_mercury_core_buf msm_mercury_hw_buf
-
-irqreturn_t msm_mercury_core_irq(int irq_num, void *context);
-
-void msm_mercury_core_irq_install(int (*irq_handler) (int, void *, void *));
-void msm_mercury_core_irq_remove(void);
-
-int msm_mercury_core_reset(void);
-void msm_mercury_core_init(void);
-
-#endif /* MSM_MERCURY_CORE_H */
diff --git a/drivers/media/video/msm/mercury/msm_mercury_dev.c b/drivers/media/video/msm/mercury/msm_mercury_dev.c
deleted file mode 100644
index b245bfd..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_dev.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/device.h>
-#include <linux/uaccess.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-subdev.h>
-#include <media/msm_mercury.h>
-#include <mach/board.h>
-#include "msm_mercury_sync.h"
-#include "msm_mercury_common.h"
-#include "msm.h"
-
-#define MSM_MERCURY_NAME "mercury"
-
-static int msm_mercury_open(struct inode *inode, struct file *filp)
-{
-	int rc;
-
-	struct msm_mercury_device *pmercury_dev = container_of(inode->i_cdev,
-		struct msm_mercury_device, cdev);
-	filp->private_data = pmercury_dev;
-
-	MCR_DBG("\n---(%d)%s()\n", __LINE__, __func__);
-
-	rc = __msm_mercury_open(pmercury_dev);
-
-	MCR_DBG("%s:%d] %s open_count = %d\n", __func__, __LINE__,
-		filp->f_path.dentry->d_name.name, pmercury_dev->open_count);
-
-	return rc;
-}
-
-static int msm_mercury_release(struct inode *inode, struct file *filp)
-{
-	int rc;
-
-	struct msm_mercury_device *pmercury_dev = filp->private_data;
-
-	MCR_DBG("\n---(%d)%s()\n", __LINE__, __func__);
-
-	rc = __msm_mercury_release(pmercury_dev);
-
-	MCR_DBG("%s:%d] %s open_count = %d\n", __func__, __LINE__,
-		filp->f_path.dentry->d_name.name, pmercury_dev->open_count);
-	return rc;
-}
-
-static long msm_mercury_ioctl(struct file *filp, unsigned int cmd,
-	unsigned long arg) {
-	int rc;
-	struct msm_mercury_device *pmercury_dev = filp->private_data;
-	rc = __msm_mercury_ioctl(pmercury_dev, cmd, arg);
-	return rc;
-}
-
-static const struct file_operations msm_mercury_fops = {
-	.owner     = THIS_MODULE,
-	.open    = msm_mercury_open,
-	.release = msm_mercury_release,
-	.unlocked_ioctl = msm_mercury_ioctl,
-};
-
-static struct class *msm_mercury_class;
-static dev_t msm_mercury_devno;
-static struct msm_mercury_device *msm_mercury_device_p;
-
-int msm_mercury_subdev_init(struct v4l2_subdev *mercury_sd)
-{
-	int rc;
-	struct msm_mercury_device *pgmn_dev =
-		(struct msm_mercury_device *)mercury_sd->host_priv;
-
-	MCR_DBG("%s:%d: mercury_sd=0x%x pgmn_dev=0x%x\n",
-		__func__, __LINE__, (uint32_t)mercury_sd, (uint32_t)pgmn_dev);
-	rc = __msm_mercury_open(pgmn_dev);
-	MCR_DBG("%s:%d: rc=%d\n",
-		__func__, __LINE__, rc);
-	return rc;
-}
-
-static long msm_mercury_subdev_ioctl(struct v4l2_subdev *sd,
-	unsigned int cmd, void *arg)
-{
-	long rc;
-	struct msm_mercury_device *pgmn_dev =
-		(struct msm_mercury_device *)sd->host_priv;
-
-	MCR_DBG("%s: cmd=%d\n", __func__, cmd);
-
-	MCR_DBG("%s: pgmn_dev 0x%x", __func__, (uint32_t)pgmn_dev);
-
-	MCR_DBG("%s: Calling __msm_mercury_ioctl\n", __func__);
-
-	rc = __msm_mercury_ioctl(pgmn_dev, cmd, (unsigned long)arg);
-	pr_debug("%s: X\n", __func__);
-	return rc;
-}
-
-void msm_mercury_subdev_release(struct v4l2_subdev *mercury_sd)
-{
-	int rc;
-	struct msm_mercury_device *pgmn_dev =
-		(struct msm_mercury_device *)mercury_sd->host_priv;
-	MCR_DBG("%s:pgmn_dev=0x%x", __func__, (uint32_t)pgmn_dev);
-	rc = __msm_mercury_release(pgmn_dev);
-	MCR_DBG("%s:rc=%d", __func__, rc);
-}
-
-static const struct v4l2_subdev_core_ops msm_mercury_subdev_core_ops = {
-	.ioctl = msm_mercury_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_ops msm_mercury_subdev_ops = {
-	.core = &msm_mercury_subdev_core_ops,
-};
-
-static int msm_mercury_init(struct platform_device *pdev)
-{
-	int rc = -1;
-	struct device *dev;
-
-	MCR_DBG("%s:\n", __func__);
-	msm_mercury_device_p = __msm_mercury_init(pdev);
-	if (msm_mercury_device_p == NULL) {
-		MCR_PR_ERR("%s: initialization failed\n", __func__);
-		goto fail;
-	}
-
-	v4l2_subdev_init(&msm_mercury_device_p->subdev,
-		&msm_mercury_subdev_ops);
-	v4l2_set_subdev_hostdata(&msm_mercury_device_p->subdev,
-		msm_mercury_device_p);
-	pr_debug("%s: msm_mercury_device_p 0x%x", __func__,
-		(uint32_t)msm_mercury_device_p);
-	MCR_DBG("%s:mercury: platform_set_drvdata\n", __func__);
-	platform_set_drvdata(pdev, &msm_mercury_device_p->subdev);
-
-	rc = alloc_chrdev_region(&msm_mercury_devno, 0, 1, MSM_MERCURY_NAME);
-	if (rc < 0) {
-		MCR_PR_ERR("%s: failed to allocate chrdev\n", __func__);
-		goto fail_1;
-	}
-
-	if (!msm_mercury_class) {
-		msm_mercury_class = class_create(THIS_MODULE, MSM_MERCURY_NAME);
-		if (IS_ERR(msm_mercury_class)) {
-			rc = PTR_ERR(msm_mercury_class);
-			MCR_PR_ERR("%s: create device class failed\n",
-				__func__);
-			goto fail_2;
-		}
-	}
-
-	dev = device_create(msm_mercury_class, NULL,
-		MKDEV(MAJOR(msm_mercury_devno), MINOR(msm_mercury_devno)), NULL,
-		"%s%d", MSM_MERCURY_NAME, 0);
-
-	if (IS_ERR(dev)) {
-		MCR_PR_ERR("%s: error creating device\n", __func__);
-		rc = -ENODEV;
-		goto fail_3;
-	}
-
-	cdev_init(&msm_mercury_device_p->cdev, &msm_mercury_fops);
-	msm_mercury_device_p->cdev.owner = THIS_MODULE;
-	msm_mercury_device_p->cdev.ops   =
-		(const struct file_operations *) &msm_mercury_fops;
-	rc = cdev_add(&msm_mercury_device_p->cdev, msm_mercury_devno, 1);
-	if (rc < 0) {
-		MCR_PR_ERR("%s: error adding cdev\n", __func__);
-		rc = -ENODEV;
-		goto fail_4;
-	}
-
-	MCR_DBG("%s %s: success\n", __func__, MSM_MERCURY_NAME);
-
-	return rc;
-
-fail_4:
-	device_destroy(msm_mercury_class, msm_mercury_devno);
-
-fail_3:
-	class_destroy(msm_mercury_class);
-
-fail_2:
-	unregister_chrdev_region(msm_mercury_devno, 1);
-
-fail_1:
-	__msm_mercury_exit(msm_mercury_device_p);
-
-fail:
-	return rc;
-}
-
-static void msm_mercury_exit(void)
-{
-	cdev_del(&msm_mercury_device_p->cdev);
-	device_destroy(msm_mercury_class, msm_mercury_devno);
-	class_destroy(msm_mercury_class);
-	unregister_chrdev_region(msm_mercury_devno, 1);
-
-	__msm_mercury_exit(msm_mercury_device_p);
-}
-
-static int __msm_mercury_probe(struct platform_device *pdev)
-{
-	return msm_mercury_init(pdev);
-}
-
-static int __msm_mercury_remove(struct platform_device *pdev)
-{
-	msm_mercury_exit();
-	return 0;
-}
-
-static struct platform_driver msm_mercury_driver = {
-	.probe  = __msm_mercury_probe,
-	.remove = __msm_mercury_remove,
-	.driver = {
-		.name = MSM_MERCURY_DRV_NAME,
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init msm_mercury_driver_init(void)
-{
-	int rc;
-	rc = platform_driver_register(&msm_mercury_driver);
-	return rc;
-}
-
-static void __exit msm_mercury_driver_exit(void)
-{
-	platform_driver_unregister(&msm_mercury_driver);
-}
-
-MODULE_DESCRIPTION("msm mercury jpeg driver");
-
-module_init(msm_mercury_driver_init);
-module_exit(msm_mercury_driver_exit);
diff --git a/drivers/media/video/msm/mercury/msm_mercury_hw.c b/drivers/media/video/msm/mercury/msm_mercury_hw.c
deleted file mode 100644
index a940dd6..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_hw.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/io.h>
-#include "msm_mercury_hw.h"
-#include "msm_mercury_common.h"
-#include "msm_mercury_hw_reg.h"
-#include "msm_mercury_macros.h"
-
-static void *mercury_region_base;
-static uint32_t mercury_region_size;
-
-
-void msm_mercury_hw_write(struct msm_mercury_hw_cmd *hw_cmd_p)
-{
-	uint32_t *paddr;
-	uint32_t old_data, new_data;
-
-	paddr = mercury_region_base + hw_cmd_p->offset;
-
-	if (hw_cmd_p->mask == 0xffffffff) {
-		old_data = 0;
-	} else {
-		old_data = readl_relaxed(paddr);
-		old_data &= ~hw_cmd_p->mask;
-	}
-
-	new_data = hw_cmd_p->data & hw_cmd_p->mask;
-	new_data |= old_data;
-	writel_relaxed(new_data, paddr);
-}
-
-uint32_t msm_mercury_hw_read(struct msm_mercury_hw_cmd *hw_cmd_p)
-{
-	uint32_t *paddr;
-	uint32_t data;
-
-	paddr = mercury_region_base + hw_cmd_p->offset;
-
-	data = readl_relaxed(paddr);
-	data &= hw_cmd_p->mask;
-
-	MCR_DBG("MERCURY_READ: offset=0x%04X data=0x%08X\n",
-		hw_cmd_p->offset, data);
-
-	return data;
-}
-
-void msm_mercury_hw_start_decode(void)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	mercury_kread(JPEG_STATUS);
-	mercury_kread(RTDMA_JPEG_RD_STA_ACK);
-	mercury_kread(RTDMA_JPEG_WR_STA_ACK);
-	mercury_kread(RTDMA_JPEG_RD_BUF_Y_PNTR);
-	mercury_kread(RTDMA_JPEG_WR_BUF_Y_PNTR);
-	mercury_kread(RTDMA_JPEG_WR_BUF_U_PNTR);
-	mercury_kwrite(RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO, (7<<2));
-	return;
-}
-
-void msm_mercury_hw_bitstream_buf_cfg(uint32_t bitstream_buf_addr)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	mercury_kwrite(RTDMA_JPEG_RD_BUF_Y_PNTR, bitstream_buf_addr);
-	return;
-}
-
-
-void msm_mercury_hw_output_y_buf_cfg(uint32_t y_buf_addr)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	mercury_kwrite(RTDMA_JPEG_WR_BUF_Y_PNTR, y_buf_addr);
-	return;
-}
-
-void msm_mercury_hw_output_u_buf_cfg(uint32_t u_buf_addr)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	mercury_kwrite(RTDMA_JPEG_WR_BUF_U_PNTR, u_buf_addr);
-	return;
-}
-
-void msm_mercury_hw_output_v_buf_cfg(uint32_t v_buf_addr)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	mercury_kwrite(RTDMA_JPEG_WR_BUF_V_PNTR, v_buf_addr);
-	return;
-}
-
-int msm_mercury_hw_wait(struct msm_mercury_hw_cmd *hw_cmd_p, int m_us)
-{
-	int tm = hw_cmd_p->n;
-	uint32_t data;
-	uint32_t wait_data = hw_cmd_p->data & hw_cmd_p->mask;
-
-	data = msm_mercury_hw_read(hw_cmd_p);
-	if (data != wait_data) {
-		while (tm) {
-			udelay(m_us);
-			data = msm_mercury_hw_read(hw_cmd_p);
-			if (data == wait_data)
-				break;
-			tm--;
-		}
-	}
-	hw_cmd_p->data = data;
-	return tm;
-}
-
-void msm_mercury_hw_irq_get_status(uint16_t *rd_irq, uint16_t *wr_irq)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-	rmb();
-	mercury_kread(RTDMA_JPEG_RD_STA_ACK);
-	*rd_irq = hw_cmd.data;
-
-	mercury_kread(RTDMA_JPEG_WR_STA_ACK);
-	*wr_irq = hw_cmd.data;
-	rmb();
-}
-
-void msm_mercury_hw_get_jpeg_status(uint32_t *jpeg_status)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	rmb();
-	mercury_kread(JPEG_STATUS);
-	*jpeg_status = hw_cmd.data;
-	rmb();
-}
-
-uint32_t msm_mercury_get_restartInterval(void)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	rmb();
-	mercury_kread(JPEG_DRI);
-	rmb();
-	return hw_cmd.data;
-
-}
-
-void msm_mercury_hw_rd_irq_clear(uint32_t val)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-	mercury_kwrite(RTDMA_JPEG_RD_STA_ACK, val);
-}
-
-void msm_mercury_hw_wr_irq_clear(uint32_t val)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	mercury_kwrite(RTDMA_JPEG_WR_STA_ACK, val);
-}
-
-void msm_mercury_hw_set_rd_irq_mask(uint32_t val)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	mercury_kwrite(RTDMA_JPEG_RD_INT_EN, val);
-}
-
-void msm_mercury_hw_set_wr_irq_mask(uint32_t val)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	mercury_kwrite(RTDMA_JPEG_WR_INT_EN, val);
-}
-
-void msm_mercury_set_jpeg_ctl_common(uint32_t val)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	mercury_kwrite(JPEG_CTRL_COMMON, val);
-}
-
-void msm_mercury_hw_reset(void)
-{
-	uint32_t val;
-	struct msm_mercury_hw_cmd hw_cmd;
-
-	wmb();
-	/* disable all interrupts*/
-	mercury_kwrite(RTDMA_JPEG_RD_INT_EN, 0);
-
-	mercury_kwrite(RTDMA_JPEG_WR_INT_EN, 0);
-
-	/* clear pending interrupts*/
-	val = 0;
-	MEM_OUTF2(&val, RTDMA_JPEG_WR_STA_ACK,
-		SW_RESET_ABORT_RDY_ACK,
-		ERR_ACK, 1, 1);
-	MEM_OUTF2(&val, RTDMA_JPEG_WR_STA_ACK, EOF_ACK, SOF_ACK, 1, 1);
-	mercury_kwrite(RTDMA_JPEG_WR_STA_ACK, val);
-
-	val = 0;
-	MEM_OUTF2(&val, RTDMA_JPEG_RD_STA_ACK, EOF_ACK, SOF_ACK, 1, 1);
-	mercury_kwrite(RTDMA_JPEG_RD_STA_ACK, val);
-
-	/* enable SWResetAbortRdyInt for core reset*/
-	val = 0;
-	MEM_OUTF(&val, RTDMA_JPEG_WR_INT_EN, SW_RESET_ABORT_RDY_EN, 1);
-	mercury_kwrite(RTDMA_JPEG_WR_INT_EN, val);
-
-	/* Reset Core from MMSS Fabric*/
-	mercury_core_reset();
-
-	/* disable all interrupts*/
-	mercury_kwrite(RTDMA_JPEG_WR_INT_EN, 0);
-
-	/* clear pending interrupts*/
-	val = 0;
-	MEM_OUTF2(&val, RTDMA_JPEG_WR_STA_ACK,
-		SW_RESET_ABORT_RDY_ACK,
-		ERR_ACK, 1, 1);
-	MEM_OUTF2(&val, RTDMA_JPEG_WR_STA_ACK, EOF_ACK, SOF_ACK, 1, 1);
-	mercury_kwrite(RTDMA_JPEG_WR_STA_ACK, val);
-
-	val = 0;
-	MEM_OUTF2(&val, RTDMA_JPEG_RD_STA_ACK, EOF_ACK, SOF_ACK, 1, 1);
-	mercury_kwrite(RTDMA_JPEG_RD_STA_ACK, val);
-
-	/* enable neccessary interrupt source*/
-	val = 0;
-	MEM_OUTF2(&val, RTDMA_JPEG_WR_INT_EN, EOF_EN, ERR_EN, 1, 1);
-	MEM_OUTF(&val, RTDMA_JPEG_WR_INT_EN, SW_RESET_ABORT_RDY_EN, 1);
-	mercury_kwrite(RTDMA_JPEG_WR_INT_EN, val);
-
-	wmb();
-
-}
-
-void msm_mercury_hw_init(void *base, int size)
-{
-	mercury_region_base = base;
-	mercury_region_size = size;
-}
-
-
-void msm_mercury_hw_delay(struct msm_mercury_hw_cmd *hw_cmd_p, int m_us)
-{
-	int tm = hw_cmd_p->n;
-	while (tm) {
-		udelay(m_us);
-		tm--;
-	}
-}
-
-int msm_mercury_hw_exec_cmds(struct msm_mercury_hw_cmd *hw_cmd_p, uint32_t m_cmds)
-{
-	int is_copy_to_user = -1;
-	uint32_t data;
-	if (m_cmds > 1)
-		MCR_DBG("m_cmds = %d\n", m_cmds);
-
-	while (m_cmds--) {
-		if (hw_cmd_p->offset > mercury_region_size) {
-			MCR_PR_ERR("%s:%d] %d exceed hw region %d\n",
-					__func__, __LINE__, hw_cmd_p->offset,
-					mercury_region_size);
-			return -EFAULT;
-		}
-
-		switch (hw_cmd_p->type) {
-		case MSM_MERCURY_HW_CMD_TYPE_READ:
-			hw_cmd_p->data = msm_mercury_hw_read(hw_cmd_p);
-			is_copy_to_user = 1;
-			break;
-
-		case MSM_MERCURY_HW_CMD_TYPE_WRITE:
-			msm_mercury_hw_write(hw_cmd_p);
-			break;
-
-		case MSM_MERCURY_HW_CMD_TYPE_WRITE_OR:
-			data = msm_mercury_hw_read(hw_cmd_p);
-			hw_cmd_p->data = (hw_cmd_p->data & hw_cmd_p->mask) |
-				data;
-			msm_mercury_hw_write(hw_cmd_p);
-			break;
-
-		case MSM_MERCURY_HW_CMD_TYPE_UWAIT:
-			msm_mercury_hw_wait(hw_cmd_p, 1);
-			break;
-
-		case MSM_MERCURY_HW_CMD_TYPE_MWAIT:
-			msm_mercury_hw_wait(hw_cmd_p, 1000);
-			break;
-
-		case MSM_MERCURY_HW_CMD_TYPE_UDELAY:
-			msm_mercury_hw_delay(hw_cmd_p, 1);
-			break;
-
-		case MSM_MERCURY_HW_CMD_TYPE_MDELAY:
-			msm_mercury_hw_delay(hw_cmd_p, 1000);
-			break;
-
-		default:
-			MCR_DBG("wrong hw command type\n");
-			break;
-		}
-
-		hw_cmd_p++;
-	}
-	return is_copy_to_user;
-}
-
-void msm_mercury_hw_region_dump(int size)
-{
-	uint32_t *p;
-	uint8_t *p8;
-
-	MCR_DBG("(%d)%s()\n", __LINE__, __func__);
-	if (size > mercury_region_size)
-		MCR_DBG("%s:%d] wrong region dump size\n",
-			__func__, __LINE__);
-
-	p = (uint32_t *) mercury_region_base;
-	while (size >= 16) {
-		MCR_DBG("0x%08X] %08X %08X %08X %08X\n",
-			mercury_region_size - size,
-			readl_relaxed(p), readl_relaxed(p+1),
-			readl_relaxed(p+2), readl_relaxed(p+3));
-		p += 4;
-		size -= 16;
-	}
-
-	if (size > 0) {
-		uint32_t d;
-		MCR_DBG("0x%08X] ", mercury_region_size - size);
-		while (size >= 4) {
-			MCR_DBG("%08X ", readl_relaxed(p++));
-			size -= 4;
-		}
-
-		d = readl_relaxed(p);
-		p8 = (uint8_t *) &d;
-		while (size) {
-			MCR_DBG("%02X", *p8++);
-			size--;
-		}
-
-		MCR_DBG("\n");
-	}
-}
diff --git a/drivers/media/video/msm/mercury/msm_mercury_hw.h b/drivers/media/video/msm/mercury/msm_mercury_hw.h
deleted file mode 100644
index f69d8ba..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_hw.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_MERCURY_HW_H
-#define MSM_MERCURY_HW_H
-
-#include <media/msm_mercury.h>
-
-/*number of pel per block (horiz/vert)*/
-#define JPEGDEC_BLOCK_SIZE                 (8)
-/* Hardware alignment*/
-#define JPEGDEC_HW_ALIGN                   (8)
-#define JPEGDEC_HW_SAMPLING_RATIO_MAX      (4)
-
-#define MSM_MERCURY_HW_IRQ_SW_RESET_ACK    (1<<3)
-#define MSM_MERCURY_HW_IRQ_WR_ERR_ACK      (1<<2)
-#define MSM_MERCURY_HW_IRQ_WR_EOI_ACK      (1<<1)
-#define MSM_MERCURY_HW_IRQ_WR_SOF_ACK      (1<<0)
-
-#define MSM_MERCURY_HW_IRQ_RD_EOF_ACK      (1<<1)
-#define MSM_MERCURY_HW_IRQ_RD_SOF_ACK      (1<<0)
-
-extern int mercury_core_reset(void);
-
-struct msm_mercury_hw_buf {
-		struct msm_mercury_buf vbuf;
-		struct file  *file;
-		uint32_t framedone_len;
-		uint32_t y_buffer_addr;
-		uint32_t y_len;
-		uint32_t cbcr_buffer_addr;
-		uint32_t cbcr_len;
-		uint32_t num_of_mcu_rows;
-		struct msm_mapped_buffer *msm_buffer;
-		int *subsystem_id;
-		struct ion_handle *handle;
-};
-
-
-void msm_mercury_hw_reset(void);
-void msm_mercury_hw_init(void *base, int size);
-void msm_mercury_hw_rd_irq_clear(uint32_t val);
-void msm_mercury_hw_wr_irq_clear(uint32_t val);
-
-uint32_t msm_mercury_hw_read(struct msm_mercury_hw_cmd *hw_cmd_p);
-void msm_mercury_hw_write(struct msm_mercury_hw_cmd *hw_cmd_p);
-int msm_mercury_hw_wait(struct msm_mercury_hw_cmd *hw_cmd_p, int m_us);
-void msm_mercury_hw_delay(struct msm_mercury_hw_cmd *hw_cmd_p, int m_us);
-int msm_mercury_hw_exec_cmds(struct msm_mercury_hw_cmd *hw_cmd_p, uint32_t m_cmds);
-void msm_mercury_hw_region_dump(int size);
-
-
-void msm_mercury_hw_irq_get_status(uint16_t *rd_irq, uint16_t *wr_irq);
-void msm_mercury_hw_start_decode(void);
-void msm_mercury_hw_get_jpeg_status(uint32_t *jpeg_status);
-void msm_mercury_hw_output_y_buf_cfg(uint32_t y_buf_addr);
-void msm_mercury_hw_output_u_buf_cfg(uint32_t u_buf_addr);
-void msm_mercury_hw_output_v_buf_cfg(uint32_t v_buf_addr);
-void msm_mercury_hw_bitstream_buf_cfg(uint32_t bitstream_buf_addr);
-
-#endif /* MSM_MERCURY_HW_H */
diff --git a/drivers/media/video/msm/mercury/msm_mercury_hw_reg.h b/drivers/media/video/msm/mercury/msm_mercury_hw_reg.h
deleted file mode 100644
index 015bf49..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_hw_reg.h
+++ /dev/null
@@ -1,715 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_MERCURY_HW_REG_H
-#define MSM_MERCURY_HW_REG_H
-
-
-#define JPEGD_BASE  0x00000000
-
-/* Register ADDR, RMSK, and SHFT*/
-/* RW */
-#define JPEG_CTRL_COMMON                        JPEG_CTRL_COMMON
-#define HWIO_JPEG_CTRL_COMMON_ADDR            (JPEGD_BASE+0x00000000)
-#define HWIO_JPEG_CTRL_COMMON__POR                    0x00000000
-#define HWIO_JPEG_CTRL_COMMON__RMSK                   0x0000001F
-#define HWIO_JPEG_CTRL_COMMON__SHFT                            0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_CTRL_COMMON__JPEG_CTRL_COMMON_ZZ_OVERRIDE_EN__BMSK 0x00000010
-#define HWIO_JPEG_CTRL_COMMON__JPEG_CTRL_COMMON_ZZ_OVERRIDE_EN__SHFT          4
-#define HWIO_JPEG_CTRL_COMMON__JPEG_CTRL_COMMON_MODE__BMSK           0x0000000F
-#define HWIO_JPEG_CTRL_COMMON__JPEG_CTRL_COMMON_MODE__SHFT                    0
-
-/* Register Field FMSK and SHFT*/
-/* RW */
-#define JPEG_CTRL_ENCODE                     JPEG_CTRL_ENCODE
-#define HWIO_JPEG_CTRL_ENCODE_ADDR        (JPEGD_BASE+0x00000008)
-#define HWIO_JPEG_CTRL_ENCODE__POR                 0x00000000
-#define HWIO_JPEG_CTRL_ENCODE__RMSK                0x00000010
-#define HWIO_JPEG_CTRL_ENCODE__SHFT                         4
-/* Register Element MIN and MAX*/
-#define HWIO_JPEG_CTRL_ENCODE___S                           4
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_CTRL_ENCODE__JPEG_CTRL_ENCODE_EOI_MARKER_EN__BMSK  0x00000010
-#define HWIO_JPEG_CTRL_ENCODE__JPEG_CTRL_ENCODE_EOI_MARKER_EN__SHFT           4
-
-/* Register Field FMSK and SHFT*/
-#define JPEG_STATUS                        JPEG_STATUS
-#define HWIO_JPEG_STATUS_ADDR        (JPEGD_BASE+0x00000010)
-#define HWIO_JPEG_STATUS__POR               0x00000000
-#define HWIO_JPEG_STATUS__RMSK              0x00003FF0
-#define HWIO_JPEG_STATUS__SHFT                       4
-/* Register Element MIN and MAX*/
-#define HWIO_JPEG_STATUS___S                         4
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_STATUS__JPEG_STATUS_REGISTER_TIMEOUT__BMSK       0x00002000
-#define HWIO_JPEG_STATUS__JPEG_STATUS_REGISTER_TIMEOUT__SHFT               13
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_EOI__BMSK               0x00001000
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_EOI__SHFT                       12
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_UNESCAPED_FF__BMSK  0x00000800
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_UNESCAPED_FF__SHFT          11
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_INV_HUFFCODE__BMSK  0x00000400
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_INV_HUFFCODE__SHFT          10
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_INV_MARKER__BMSK    0x00000200
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_INV_MARKER__SHFT             9
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_RSTRT_SEQ__BMSK     0x00000100
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_RSTRT_SEQ__SHFT              8
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_RSTRT_OVRFLW__BMSK  0x00000080
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_RSTRT_OVRFLW__SHFT           7
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_RSTRT_UNDFLW__BMSK  0x00000040
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_RSTRT_UNDFLW__SHFT           6
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_SCAN_OVRFLW__BMSK   0x00000020
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_SCAN_OVRFLW__SHFT            5
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_SCAN_UNDFLW__BMSK   0x00000010
-#define HWIO_JPEG_STATUS__JPEG_STATUS_DHDQ_ERR_SCAN_UNDFLW__SHFT            4
-
-/* Register ADDR, RMSK, and SHFT*/
-/* R */
-#define JPEG_SOF_REG_0                               JPEG_SOF_REG_0
-#define HWIO_JPEG_SOF_REG_0_ADDR  /* RW */               (JPEGD_BASE+0x00000014)
-#define HWIO_JPEG_SOF_REG_0__POR                         0x00000000
-#define HWIO_JPEG_SOF_REG_0__RMSK                        0x000000FF
-#define HWIO_JPEG_SOF_REG_0__SHFT                                 0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_SOF_REG_0__JPEG_SOF_REG_0_NF__BMSK     0x000000FF
-#define HWIO_JPEG_SOF_REG_0__JPEG_SOF_REG_0_NF__SHFT              0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_SOF_REG_1                               JPEG_SOF_REG_1
-#define HWIO_JPEG_SOF_REG_1_ADDR  /* RW */               (JPEGD_BASE+0x00000018)
-#define HWIO_JPEG_SOF_REG_1__POR                         0x00000000
-#define HWIO_JPEG_SOF_REG_1__RMSK                        0x00FFFFFF
-#define HWIO_JPEG_SOF_REG_1__SHFT                                 0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_SOF_REG_1__JPEG_SOF_REG_1_C__BMSK      0x00FF0000
-#define HWIO_JPEG_SOF_REG_1__JPEG_SOF_REG_1_C__SHFT              16
-#define HWIO_JPEG_SOF_REG_1__JPEG_SOF_REG_1_H__BMSK      0x0000F000
-#define HWIO_JPEG_SOF_REG_1__JPEG_SOF_REG_1_H__SHFT              12
-#define HWIO_JPEG_SOF_REG_1__JPEG_SOF_REG_1_V__BMSK      0x00000F00
-#define HWIO_JPEG_SOF_REG_1__JPEG_SOF_REG_1_V__SHFT               8
-#define HWIO_JPEG_SOF_REG_1__JPEG_SOF_REG_1_TQ__BMSK     0x000000FF
-#define HWIO_JPEG_SOF_REG_1__JPEG_SOF_REG_1_TQ__SHFT              0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_SOF_REG_2                               JPEG_SOF_REG_2
-#define HWIO_JPEG_SOF_REG_2_ADDR  /* RW */               (JPEGD_BASE+0x0000001C)
-#define HWIO_JPEG_SOF_REG_2__POR                         0x00000000
-#define HWIO_JPEG_SOF_REG_2__RMSK                        0xFFFFFFFF
-#define HWIO_JPEG_SOF_REG_2__SHFT                                 0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_SOF_REG_2__JPEG_SOF_REG_2_Y__BMSK      0xFFFF0000
-#define HWIO_JPEG_SOF_REG_2__JPEG_SOF_REG_2_Y__SHFT              16
-#define HWIO_JPEG_SOF_REG_2__JPEG_SOF_REG_2_X__BMSK      0x0000FFFF
-#define HWIO_JPEG_SOF_REG_2__JPEG_SOF_REG_2_X__SHFT               0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_SOS_REG_0                               JPEG_SOS_REG_0
-#define HWIO_JPEG_SOS_REG_0_ADDR  /* RW */               (JPEGD_BASE+0x00000020)
-#define HWIO_JPEG_SOS_REG_0__POR                         0x00000000
-#define HWIO_JPEG_SOS_REG_0__RMSK                        0xFF000000
-#define HWIO_JPEG_SOS_REG_0__SHFT                                24
-/*Register Element MIN and MAX*/
-#define HWIO_JPEG_SOS_REG_0___S                                  24
-#define HWIO_JPEG_SOS_REG_0___S                                  24
-#define HWIO_JPEG_SOS_REG_0___S                                  24
-#define HWIO_JPEG_SOS_REG_0___S                                  24
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_SOS_REG_0__JPEG_SOS_REG_0_NS__BMSK       0xFF000000
-#define HWIO_JPEG_SOS_REG_0__JPEG_SOS_REG_0_NS__SHFT               24
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_SOS_REG_1                                   JPEG_SOS_REG_1
-#define HWIO_JPEG_SOS_REG_1_ADDR  /* RW */              (JPEGD_BASE+0x00000024)
-#define HWIO_JPEG_SOS_REG_1__POR                        0x00000000
-#define HWIO_JPEG_SOS_REG_1__RMSK                       0x0000FFFF
-#define HWIO_JPEG_SOS_REG_1__SHFT                                0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_SOS_REG_1__JPEG_SOS_REG_1_CS__BMSK    0x0000FF00
-#define HWIO_JPEG_SOS_REG_1__JPEG_SOS_REG_1_CS__SHFT             8
-#define HWIO_JPEG_SOS_REG_1__JPEG_SOS_REG_1_TD__BMSK    0x000000F0
-#define HWIO_JPEG_SOS_REG_1__JPEG_SOS_REG_1_TD__SHFT             4
-#define HWIO_JPEG_SOS_REG_1__JPEG_SOS_REG_1_TA__BMSK    0x0000000F
-#define HWIO_JPEG_SOS_REG_1__JPEG_SOS_REG_1_TA__SHFT             0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_QT_IDX                                       JPEG_QT_IDX
-#define HWIO_JPEG_QT_IDX_ADDR       (JPEGD_BASE+0x00000030)
-#define HWIO_JPEG_QT_IDX__POR                              0x00000000
-#define HWIO_JPEG_QT_IDX__RMSK                             0x0000FFFF
-#define HWIO_JPEG_QT_IDX__SHFT                                      0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_QT_IDX__JPEG_QT_IDX_TABLE_1__BMSK        0x0000FF00
-#define HWIO_JPEG_QT_IDX__JPEG_QT_IDX_TABLE_1__SHFT                  8
-#define HWIO_JPEG_QT_IDX__JPEG_QT_IDX_TABLE_0__BMSK         0x000000FF
-#define HWIO_JPEG_QT_IDX__JPEG_QT_IDX_TABLE_0__SHFT                  0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_DQT                                        JPEG_DQT
-#define HWIO_JPEG_DQT_ADDR  /* RW */                    (JPEGD_BASE+0x00000034)
-#define HWIO_JPEG_DQT__POR                              0x00000000
-#define HWIO_JPEG_DQT__RMSK                             0x0F00FFFF
-#define HWIO_JPEG_DQT__SHFT                             0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_DQT__JPEG_DQT_TQ__BMSK                0x0F000000
-#define HWIO_JPEG_DQT__JPEG_DQT_TQ__SHFT                24
-#define HWIO_JPEG_DQT__JPEG_DQT_QK__BMSK                0x0000FFFF
-#define HWIO_JPEG_DQT__JPEG_DQT_QK__SHFT                0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_DRI                                JPEG_DRI
-#define HWIO_JPEG_DRI_ADDR  /* RW */            (JPEGD_BASE+0x00000040)
-#define HWIO_JPEG_DRI__POR                      0x00000000
-#define HWIO_JPEG_DRI__RMSK                     0x0000FFFF
-#define HWIO_JPEG_DRI__SHFT                              0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_DRI__JPEG_DRI_RI__BMSK        0x0000FFFF
-#define HWIO_JPEG_DRI__JPEG_DRI_RI__SHFT                 0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_DHT_REG_0                               JPEG_DHT_REG_0
-#define HWIO_JPEG_DHT_REG_0_ADDR  /* RW */               (JPEGD_BASE+0x00000050)
-#define HWIO_JPEG_DHT_REG_0__POR                         0x00000000
-#define HWIO_JPEG_DHT_REG_0__RMSK                        0x000000FF
-#define HWIO_JPEG_DHT_REG_0__SHFT                                 0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_DHT_REG_0__JPEG_DHT_REG_0_TH__BMSK     0x000000F0
-#define HWIO_JPEG_DHT_REG_0__JPEG_DHT_REG_0_TH__SHFT              4
-#define HWIO_JPEG_DHT_REG_0__JPEG_DHT_REG_0_TC__BMSK     0x0000000F
-#define HWIO_JPEG_DHT_REG_0__JPEG_DHT_REG_0_TC__SHFT              0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_DHT_IDX                                        JPEG_DHT_IDX
-#define HWIO_JPEG_DHT_IDX_ADDR  /* RW */      (JPEGD_BASE+0x00000054)
-#define HWIO_JPEG_DHT_IDX__POR                                0x00000000
-#define HWIO_JPEG_DHT_IDX__RMSK                               0x00000FFF
-#define HWIO_JPEG_DHT_IDX__SHFT                                        0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_DHT_IDX__JPEG_DHT_IDX_CCC_MAX__BMSK         0x00000F00
-#define HWIO_JPEG_DHT_IDX__JPEG_DHT_IDX_CCC_MAX__SHFT                  8
-#define HWIO_JPEG_DHT_IDX__JPEG_DHT_IDX_VIJ__BMSK             0x000000FF
-#define HWIO_JPEG_DHT_IDX__JPEG_DHT_IDX_VIJ__SHFT                      0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_DHT_REG_1                          JPEG_DHT_REG_1
-#define HWIO_JPEG_DHT_REG_1_ADDR  /* RW */          (JPEGD_BASE+0x00000058)
-#define HWIO_JPEG_DHT_REG_1__POR                    0x00000000
-#define HWIO_JPEG_DHT_REG_1__RMSK                   0xFFFFFFFF
-#define HWIO_JPEG_DHT_REG_1__SHFT                            0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_DHT_REG_1__JPEG_DHT_REG_1_VIJ_0__BMSK       0xFF000000
-#define HWIO_JPEG_DHT_REG_1__JPEG_DHT_REG_1_VIJ_0__SHFT               24
-#define HWIO_JPEG_DHT_REG_1__JPEG_DHT_REG_1_VIJ_1__BMSK       0x00FF0000
-#define HWIO_JPEG_DHT_REG_1__JPEG_DHT_REG_1_VIJ_1__SHFT               16
-#define HWIO_JPEG_DHT_REG_1__JPEG_DHT_REG_1_VIJ_2__BMSK       0x0000FF00
-#define HWIO_JPEG_DHT_REG_1__JPEG_DHT_REG_1_VIJ_2__SHFT                8
-#define HWIO_JPEG_DHT_REG_1__JPEG_DHT_REG_1_VIJ_3__BMSK       0x000000FF
-#define HWIO_JPEG_DHT_REG_1__JPEG_DHT_REG_1_VIJ_3__SHFT                0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_DHT_CCC_MAX                          JPEG_DHT_CCC_MAX
-#define HWIO_JPEG_DHT_CCC_MAX_ADDR  /* RW */            (JPEGD_BASE+0x0000005C)
-#define HWIO_JPEG_DHT_CCC_MAX__POR                      0x00000000
-#define HWIO_JPEG_DHT_CCC_MAX__RMSK                     0xFFFFFFFF
-#define HWIO_JPEG_DHT_CCC_MAX__SHFT                              0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_DHT_CCC_MAX__JPEG_DHT_CCC_MAX_MAX__BMSK    0xFFFF0000
-#define HWIO_JPEG_DHT_CCC_MAX__JPEG_DHT_CCC_MAX_MAX__SHFT            16
-#define HWIO_JPEG_DHT_CCC_MAX__JPEG_DHT_CCC_MAX_CCC__BMSK    0x0000FFFF
-#define HWIO_JPEG_DHT_CCC_MAX__JPEG_DHT_CCC_MAX_CCC__SHFT             0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_DHT_CCC_MAX__JPEG_DHT_CCC_MAX_MAX__BMSK    0xFFFF0000
-#define HWIO_JPEG_DHT_CCC_MAX__JPEG_DHT_CCC_MAX_MAX__SHFT            16
-#define HWIO_JPEG_DHT_CCC_MAX__JPEG_DHT_CCC_MAX_CCC__BMSK    0x0000FFFF
-#define HWIO_JPEG_DHT_CCC_MAX__JPEG_DHT_CCC_MAX_CCC__SHFT             0
-#define HWIO_JPEG_DHT_CCC_MAX__JPEG_DHT_LI__BMSK       0x000000FF
-#define HWIO_JPEG_DHT_CCC_MAX__JPEG_DHT_LI__SHFT                0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_DEC_SCALE                       JPEG_DEC_SCALE
-#define HWIO_JPEG_DEC_SCALE_ADDR  /* RW */       (JPEGD_BASE+0x00000060)
-#define HWIO_JPEG_DEC_SCALE__POR                 0x00000000
-#define HWIO_JPEG_DEC_SCALE__RMSK                0x00000003
-#define HWIO_JPEG_DEC_SCALE__SHFT                         0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_DEC_SCALE__JPEG_DEC_SCALE_RATIO__BMSK       0x00000003
-#define HWIO_JPEG_DEC_SCALE__JPEG_DEC_SCALE_RATIO__SHFT                0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_CONVERT                         JPEG_CONVERT
-#define HWIO_JPEG_CONVERT_ADDR  /* RW */       (JPEGD_BASE+0x00000064)
-#define HWIO_JPEG_CONVERT__POR                 0x00000000
-#define HWIO_JPEG_CONVERT__RMSK                0xFFFF13FF
-#define HWIO_JPEG_CONVERT__SHFT                         0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_MONO_CB_VALUE__BMSK      0xFF000000
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_MONO_CB_VALUE__SHFT              24
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_MONO_CR_VALUE__BMSK      0x00FF0000
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_MONO_CR_VALUE__SHFT              16
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_CLAMP_EN__BMSK           0x00001000
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_CLAMP_EN__SHFT                   12
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_CBCR_SWITCH__BMSK        0x00000200
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_CBCR_SWITCH__SHFT                 9
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_MONOCHROME_EN__BMSK      0x00000100
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_MONOCHROME_EN__SHFT               8
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_MEM_ORG__BMSK            0x000000C0
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_MEM_ORG__SHFT                     6
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_422_MCU_TYPE__BMSK       0x00000030
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_422_MCU_TYPE__SHFT                4
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_OUTPUT_FORMAT__BMSK      0x0000000C
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_OUTPUT_FORMAT__SHFT               2
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_INPUT_FORMAT__BMSK       0x00000003
-#define HWIO_JPEG_CONVERT__JPEG_CONVERT_INPUT_FORMAT__SHFT                0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_ENC_BYTE_CNT                       JPEG_ENC_BYTE_CNT
-#define HWIO_JPEG_ENC_BYTE_CNT_ADDR  /* RW */          (JPEGD_BASE+0x00000070)
-#define HWIO_JPEG_ENC_BYTE_CNT__POR                    0x00000000
-#define HWIO_JPEG_ENC_BYTE_CNT__RMSK                   0xFFFFFFFF
-#define HWIO_JPEG_ENC_BYTE_CNT__SHFT                            0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_ENC_BYTE_CNT__JPEG_ENC_BYTE_CNT_TOT__BMSK     0xFFFFFFFF
-#define HWIO_JPEG_ENC_BYTE_CNT__JPEG_ENC_BYTE_CNT_TOT__SHFT              0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_DEBUG                                  JPEG_DEBUG
-#define HWIO_JPEG_DEBUG_ADDR  /* RW */              (JPEGD_BASE+0x00000080)
-#define HWIO_JPEG_DEBUG__POR                        0x4A504547
-#define HWIO_JPEG_DEBUG__RMSK                       0xFFFFFFFF
-#define HWIO_JPEG_DEBUG__SHFT                                0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_DEBUG__JPEG_DEBUG__BMSK            0xFFFFFFFF
-#define HWIO_JPEG_DEBUG__JPEG_DEBUG__SHFT                     0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_SPARE                                JPEG_SPARE
-#define HWIO_JPEG_SPARE_ADDR  /* RW */            (JPEGD_BASE+0x00000084)
-#define HWIO_JPEG_SPARE__POR                      0x00000000
-#define HWIO_JPEG_SPARE__RMSK                     0xFFFFFFFF
-#define HWIO_JPEG_SPARE__SHFT                              0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_SPARE__JPEG_SPARE_00__BMSK            0xFFFFFFFF
-#define HWIO_JPEG_SPARE__JPEG_SPARE_00__SHFT                     0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEG_REGISTER_TIMEOUT                       JPEG_REGISTER_TIMEOUT
-#define HWIO_JPEG_REGISTER_TIMEOUT_ADDR    (JPEGD_BASE+0x00000088)
-#define HWIO_JPEG_REGISTER_TIMEOUT__POR                        0x0000FFFF
-#define HWIO_JPEG_REGISTER_TIMEOUT__RMSK                       0x0000FFFF
-#define HWIO_JPEG_REGISTER_TIMEOUT__SHFT                                0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEG_REGISTER_TIMEOUT__JPEG_TIMEOUT_VALUE__BMSK        0x0000FFFF
-#define HWIO_JPEG_REGISTER_TIMEOUT__JPEG_TIMEOUT_VALUE__SHFT                 0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEGD_STATUS_BUS_DATA                     JPEGD_STATUS_BUS_DATA
-#define HWIO_JPEGD_STATUS_BUS_DATA_ADDR  /* RW */       (JPEGD_BASE+0x00000258)
-#define HWIO_JPEGD_STATUS_BUS_DATA__POR                      0x00000000
-#define HWIO_JPEGD_STATUS_BUS_DATA__RMSK                     0xFFFFFFFF
-#define HWIO_JPEGD_STATUS_BUS_DATA__SHFT                              0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEGD_STATUS_BUS_DATA__STATUS_BUS_DATA__BMSK      0xFFFFFFFF
-#define HWIO_JPEGD_STATUS_BUS_DATA__STATUS_BUS_DATA__SHFT               0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEGD_STATUS_BUS_CONFIG                     JPEGD_STATUS_BUS_CONFIG
-#define HWIO_JPEGD_STATUS_BUS_CONFIG_ADDR  /* RW */     (JPEGD_BASE+0x0000025C)
-#define HWIO_JPEGD_STATUS_BUS_CONFIG__POR                        0x00000000
-#define HWIO_JPEGD_STATUS_BUS_CONFIG__RMSK                       0x0000001F
-#define HWIO_JPEGD_STATUS_BUS_CONFIG__SHFT                                0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEGD_STATUS_BUS_CONFIG__STATUS_BUS_SEL__BMSK         0x0000001F
-#define HWIO_JPEGD_STATUS_BUS_CONFIG__STATUS_BUS_SEL__SHFT                  0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_AXI_CONFIG                       RTDMA_JPEG_AXI_CONFIG
-#define HWIO_RTDMA_JPEG_AXI_CONFIG_ADDR  /* RW */        (JPEGD_BASE+0x00000260)
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__POR                        0x00000024
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__RMSK                       0x00000FFF
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__SHFT                                0
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__OUT_OF_ORDER_WR__BMSK          0x00000800
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__OUT_OF_ORDER_WR__SHFT                  11
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__OUT_OF_ORDER_RD__BMSK          0x00000400
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__OUT_OF_ORDER_RD__SHFT                  10
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__BOUND_LIMIT__BMSK              0x00000300
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__BOUND_LIMIT__SHFT                       8
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__PACK_TIMEOUT__BMSK             0x000000F0
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__PACK_TIMEOUT__SHFT                      4
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__PACK_MAX_BLEN__BMSK            0x0000000F
-#define HWIO_RTDMA_JPEG_AXI_CONFIG__PACK_MAX_BLEN__SHFT                     0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define JPEGD_CLK_CONTROL                             JPEGD_CLK_CONTROL
-#define HWIO_JPEGD_CLK_CONTROL_ADDR  /* RW */   (JPEGD_BASE+0x00000264)
-#define HWIO_JPEGD_CLK_CONTROL__POR             0x00000005
-#define HWIO_JPEGD_CLK_CONTROL__RMSK                         0x0000000F
-#define HWIO_JPEGD_CLK_CONTROL__SHFT                                  0
-/* Register Field FMSK and SHFT*/
-#define HWIO_JPEGD_CLK_CONTROL__JPEG_CLKIDLE__BMSK           0x00000008
-#define HWIO_JPEGD_CLK_CONTROL__JPEG_CLKIDLE__SHFT                    3
-#define HWIO_JPEGD_CLK_CONTROL__JPEG_CLKON__BMSK             0x00000004
-#define HWIO_JPEGD_CLK_CONTROL__JPEG_CLKON__SHFT                      2
-#define HWIO_JPEGD_CLK_CONTROL__AXI_CLKIDLE__BMSK            0x00000002
-#define HWIO_JPEGD_CLK_CONTROL__AXI_CLKIDLE__SHFT                     1
-#define HWIO_JPEGD_CLK_CONTROL__AXI_CLKON__BMSK              0x00000001
-#define HWIO_JPEGD_CLK_CONTROL__AXI_CLKON__SHFT                       0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_WR_BUF_CONFIG                     RTDMA_JPEG_WR_BUF_CONFIG
-#define HWIO_RTDMA_JPEG_WR_BUF_CONFIG_ADDR  /* RW */   (JPEGD_BASE+0x00000200)
-#define HWIO_RTDMA_JPEG_WR_BUF_CONFIG__POR             0x00000000
-#define HWIO_RTDMA_JPEG_WR_BUF_CONFIG__RMSK            0x0000001F
-#define HWIO_RTDMA_JPEG_WR_BUF_CONFIG__SHFT                     0
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_WR_BUF_CONFIG__BUF_FORMAT__BMSK         0x0000001C
-#define HWIO_RTDMA_JPEG_WR_BUF_CONFIG__BUF_FORMAT__SHFT                  2
-#define HWIO_RTDMA_JPEG_WR_BUF_CONFIG__NUM_OF_PLANES__BMSK      0x00000003
-#define HWIO_RTDMA_JPEG_WR_BUF_CONFIG__NUM_OF_PLANES__SHFT               0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_WR_OP                               RTDMA_JPEG_WR_OP
-#define HWIO_RTDMA_JPEG_WR_OP_ADDR  /* RW */        (JPEGD_BASE+0x00000204)
-#define HWIO_RTDMA_JPEG_WR_OP__POR                  0x00000000
-#define HWIO_RTDMA_JPEG_WR_OP__RMSK                 0x00000013
-#define HWIO_RTDMA_JPEG_WR_OP__SHFT                          0
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_WR_OP__ALIGN__BMSK          0x00000010
-#define HWIO_RTDMA_JPEG_WR_OP__ALIGN__SHFT                   4
-#define HWIO_RTDMA_JPEG_WR_OP__FLIP__BMSK           0x00000002
-#define HWIO_RTDMA_JPEG_WR_OP__FLIP__SHFT                    1
-#define HWIO_RTDMA_JPEG_WR_OP__MIRROR__BMSK         0x00000001
-#define HWIO_RTDMA_JPEG_WR_OP__MIRROR__SHFT                  0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_WR_BUF_Y_PNTR                      RTDMA_JPEG_WR_BUF_Y_PNTR
-#define HWIO_RTDMA_JPEG_WR_BUF_Y_PNTR_ADDR    (JPEGD_BASE+0x00000208)
-#define HWIO_RTDMA_JPEG_WR_BUF_Y_PNTR__POR                0x00000000
-#define HWIO_RTDMA_JPEG_WR_BUF_Y_PNTR__RMSK               0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_WR_BUF_Y_PNTR__SHFT                        3
-/* Register Element MIN and MAX*/
-#define HWIO_RTDMA_JPEG_WR_BUF_Y_PNTR___S                          3
-#define HWIO_RTDMA_JPEG_WR_BUF_Y_PNTR___S                          3
-#define HWIO_RTDMA_JPEG_WR_BUF_Y_PNTR___S                          3
-#define HWIO_RTDMA_JPEG_WR_BUF_Y_PNTR___S                          3
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_WR_BUF_Y_PNTR__PNTR__BMSK         0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_WR_BUF_Y_PNTR__PNTR__SHFT                  3
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_WR_BUF_U_PNTR                      RTDMA_JPEG_WR_BUF_U_PNTR
-#define HWIO_RTDMA_JPEG_WR_BUF_U_PNTR_ADDR  /* RW */     (JPEGD_BASE+0x0000020C)
-#define HWIO_RTDMA_JPEG_WR_BUF_U_PNTR__POR               0x00000000
-#define HWIO_RTDMA_JPEG_WR_BUF_U_PNTR__RMSK              0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_WR_BUF_U_PNTR__SHFT                       3
-
-/* Register Element MIN and MAX*/
-#define HWIO_RTDMA_JPEG_WR_BUF_U_PNTR___S                         3
-#define HWIO_RTDMA_JPEG_WR_BUF_U_PNTR___S                         3
-#define HWIO_RTDMA_JPEG_WR_BUF_U_PNTR___S                         3
-#define HWIO_RTDMA_JPEG_WR_BUF_U_PNTR___S                         3
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_WR_BUF_U_PNTR__PNTR__BMSK        0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_WR_BUF_U_PNTR__PNTR__SHFT                 3
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_WR_BUF_V_PNTR                       RTDMA_JPEG_WR_BUF_V_PNTR
-#define HWIO_RTDMA_JPEG_WR_BUF_V_PNTR_ADDR   (JPEGD_BASE+0x00000210)
-#define HWIO_RTDMA_JPEG_WR_BUF_V_PNTR__POR                0x00000000
-#define HWIO_RTDMA_JPEG_WR_BUF_V_PNTR__RMSK               0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_WR_BUF_V_PNTR__SHFT                        3
-
-/* Register Element MIN and MAX*/
-#define HWIO_RTDMA_JPEG_WR_BUF_V_PNTR___S                          3
-#define HWIO_RTDMA_JPEG_WR_BUF_V_PNTR___S                          3
-#define HWIO_RTDMA_JPEG_WR_BUF_V_PNTR___S                          3
-#define HWIO_RTDMA_JPEG_WR_BUF_V_PNTR___S                          3
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_WR_BUF_V_PNTR__PNTR__BMSK         0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_WR_BUF_V_PNTR__PNTR__SHFT                  3
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_WR_BUF_PITCH                         RTDMA_JPEG_WR_BUF_PITCH
-#define HWIO_RTDMA_JPEG_WR_BUF_PITCH_ADDR  /* RW */    (JPEGD_BASE+0x00000214)
-#define HWIO_RTDMA_JPEG_WR_BUF_PITCH__POR              0x00000000
-#define HWIO_RTDMA_JPEG_WR_BUF_PITCH__RMSK             0x00003FF8
-#define HWIO_RTDMA_JPEG_WR_BUF_PITCH__SHFT                      3
-
-/* Register Element MIN and MAX*/
-#define HWIO_RTDMA_JPEG_WR_BUF_PITCH___S                        3
-#define HWIO_RTDMA_JPEG_WR_BUF_PITCH___S                        3
-#define HWIO_RTDMA_JPEG_WR_BUF_PITCH___S                        3
-#define HWIO_RTDMA_JPEG_WR_BUF_PITCH___S                        3
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_WR_BUF_PITCH__PITCH__BMSK          0x00003FF8
-#define HWIO_RTDMA_JPEG_WR_BUF_PITCH__PITCH__SHFT                   3
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_WR_PLANE_SIZE                      RTDMA_JPEG_WR_PLANE_SIZE
-#define HWIO_RTDMA_JPEG_WR_PLANE_SIZE_ADDR  /* RW */  (JPEGD_BASE+0x00000218)
-#define HWIO_RTDMA_JPEG_WR_PLANE_SIZE__POR            0x00000000
-#define HWIO_RTDMA_JPEG_WR_PLANE_SIZE__RMSK           0x1FFF1FFF
-#define HWIO_RTDMA_JPEG_WR_PLANE_SIZE__SHFT                    0
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_WR_PLANE_SIZE__PLANE_VSIZE__BMSK       0x1FFF0000
-#define HWIO_RTDMA_JPEG_WR_PLANE_SIZE__PLANE_VSIZE__SHFT               16
-#define HWIO_RTDMA_JPEG_WR_PLANE_SIZE__PLANE_HSIZE__BMSK       0x00001FFF
-#define HWIO_RTDMA_JPEG_WR_PLANE_SIZE__PLANE_HSIZE__SHFT                0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_WR_BLOCK_SIZE                      RTDMA_JPEG_WR_BLOCK_SIZE
-#define HWIO_RTDMA_JPEG_WR_BLOCK_SIZE_ADDR  /* RW */    (JPEGD_BASE+0x0000021C)
-#define HWIO_RTDMA_JPEG_WR_BLOCK_SIZE__POR              0x00000000
-#define HWIO_RTDMA_JPEG_WR_BLOCK_SIZE__RMSK             0x00000FFF
-#define HWIO_RTDMA_JPEG_WR_BLOCK_SIZE__SHFT                      0
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_WR_BLOCK_SIZE__BLOCK_VSIZE__BMSK           0x00000FC0
-#define HWIO_RTDMA_JPEG_WR_BLOCK_SIZE__BLOCK_VSIZE__SHFT                    6
-#define HWIO_RTDMA_JPEG_WR_BLOCK_SIZE__BLOCK_HSIZE__BMSK           0x0000003F
-#define HWIO_RTDMA_JPEG_WR_BLOCK_SIZE__BLOCK_HSIZE__SHFT                    0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_WR_BUFFER_SIZE                      RTDMA_JPEG_WR_BUFFER_SIZE
-#define HWIO_RTDMA_JPEG_WR_BUFFER_SIZE_ADDR  /* RW */   (JPEGD_BASE+0x00000220)
-#define HWIO_RTDMA_JPEG_WR_BUFFER_SIZE__POR             0x00000000
-#define HWIO_RTDMA_JPEG_WR_BUFFER_SIZE__RMSK            0x00001FFF
-#define HWIO_RTDMA_JPEG_WR_BUFFER_SIZE__SHFT                     0
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_WR_BUFFER_SIZE__BUFFER_VSIZE__BMSK         0x00001FFF
-#define HWIO_RTDMA_JPEG_WR_BUFFER_SIZE__BUFFER_VSIZE__SHFT                  0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_WR_STA_ACK                      RTDMA_JPEG_WR_STA_ACK
-#define HWIO_RTDMA_JPEG_WR_STA_ACK_ADDR  /* RW */   (JPEGD_BASE+0x00000224)
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__POR             0x00000000
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__RMSK            0x0000000F
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__SHFT                     3
-
-/* Register Element MIN and MAX*/
-#define HWIO_RTDMA_JPEG_WR_STA_ACK___S                       3
-#define HWIO_RTDMA_JPEG_WR_STA_ACK___S                       3
-#define HWIO_RTDMA_JPEG_WR_STA_ACK___S                       3
-#define HWIO_RTDMA_JPEG_WR_STA_ACK___S                       3
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__SW_RESET_ABORT_RDY_STA__BMSK   0x00000008
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__SW_RESET_ABORT_RDY_STA__SHFT            3
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__SW_RESET_ABORT_RDY_ACK__BMSK   0x00000008
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__SW_RESET_ABORT_RDY_ACK__SHFT            3
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__ERR_STA__BMSK                  0x00000004
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__ERR_STA__SHFT                           2
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__ERR_ACK__BMSK                  0x00000004
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__ERR_ACK__SHFT                           2
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__EOF_STA__BMSK                  0x00000002
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__EOF_STA__SHFT                           1
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__EOF_ACK__BMSK                  0x00000002
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__EOF_ACK__SHFT                           1
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__SOF_STA__BMSK                  0x00000001
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__SOF_STA__SHFT                           0
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__SOF_ACK__BMSK           0x00000001
-#define HWIO_RTDMA_JPEG_WR_STA_ACK__SOF_ACK__SHFT                    0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_WR_INT_EN                      RTDMA_JPEG_WR_INT_EN
-#define HWIO_RTDMA_JPEG_WR_INT_EN_ADDR  /* W */        (JPEGD_BASE+0x00000228)
-#define HWIO_RTDMA_JPEG_WR_INT_EN__POR                 0x00000000
-#define HWIO_RTDMA_JPEG_WR_INT_EN__RMSK                0x0000000F
-#define HWIO_RTDMA_JPEG_WR_INT_EN__SHFT                         0
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_WR_INT_EN__SW_RESET_ABORT_RDY_EN__BMSK 0x00000008
-#define HWIO_RTDMA_JPEG_WR_INT_EN__SW_RESET_ABORT_RDY_EN__SHFT          3
-#define HWIO_RTDMA_JPEG_WR_INT_EN__ERR_EN__BMSK                0x00000004
-#define HWIO_RTDMA_JPEG_WR_INT_EN__ERR_EN__SHFT                         2
-#define HWIO_RTDMA_JPEG_WR_INT_EN__EOF_EN__BMSK                0x00000002
-#define HWIO_RTDMA_JPEG_WR_INT_EN__EOF_EN__SHFT                         1
-#define HWIO_RTDMA_JPEG_WR_INT_EN__SOF_EN__BMSK                0x00000001
-#define HWIO_RTDMA_JPEG_WR_INT_EN__SOF_EN__SHFT                         0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_RD_BUF_CONFIG                     RTDMA_JPEG_RD_BUF_CONFIG
-#define HWIO_RTDMA_JPEG_RD_BUF_CONFIG_ADDR  /* RW */     (JPEGD_BASE+0x00000100)
-#define HWIO_RTDMA_JPEG_RD_BUF_CONFIG__POR               0x00000000
-#define HWIO_RTDMA_JPEG_RD_BUF_CONFIG__RMSK              0x0000001F
-#define HWIO_RTDMA_JPEG_RD_BUF_CONFIG__SHFT                       0
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_RD_BUF_CONFIG__BUF_FORMAT__BMSK          0x0000001C
-#define HWIO_RTDMA_JPEG_RD_BUF_CONFIG__BUF_FORMAT__SHFT                   2
-#define HWIO_RTDMA_JPEG_RD_BUF_CONFIG__NUM_OF_PLANES__BMSK       0x00000003
-#define HWIO_RTDMA_JPEG_RD_BUF_CONFIG__NUM_OF_PLANES__SHFT                0
-
-/* Register ADDR, RMSK, and SHFT, W */
-#define RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO   RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO_ADDR  (JPEGD_BASE+0x00000104)
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO__POR            0x00000000
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO__RMSK           0x0000001C
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO__SHFT                    2
-
-/* Register Element MIN and MAX*/
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO___S                      2
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO___S                      2
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO___S                      2
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO___S                      2
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO__BUF_APPLY__BMSK   0x00000010
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO__BUF_APPLY__SHFT            4
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO__BUF_EOF__BMSK     0x00000008
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO__BUF_EOF__SHFT              3
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO__BUF_SOF__BMSK     0x00000004
-#define HWIO_RTDMA_JPEG_RD_BUF_MNGR_BUF_ID_FIFO__BUF_SOF__SHFT              2
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_RD_BUF_Y_PNTR                        RTDMA_JPEG_RD_BUF_Y_PNTR
-#define HWIO_RTDMA_JPEG_RD_BUF_Y_PNTR_ADDR  /* RW */   (JPEGD_BASE+0x0000010C)
-#define HWIO_RTDMA_JPEG_RD_BUF_Y_PNTR__POR             0x00000000
-#define HWIO_RTDMA_JPEG_RD_BUF_Y_PNTR__RMSK            0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_RD_BUF_Y_PNTR__SHFT                     3
-
-/* Register Element MIN and MAX*/
-#define HWIO_RTDMA_JPEG_RD_BUF_Y_PNTR___S                       3
-#define HWIO_RTDMA_JPEG_RD_BUF_Y_PNTR___S                       3
-#define HWIO_RTDMA_JPEG_RD_BUF_Y_PNTR___S                       3
-#define HWIO_RTDMA_JPEG_RD_BUF_Y_PNTR___S                       3
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_RD_BUF_Y_PNTR__PNTR__BMSK      0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_RD_BUF_Y_PNTR__PNTR__SHFT               3
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_RD_BUF_U_PNTR                     RTDMA_JPEG_RD_BUF_U_PNTR
-#define HWIO_RTDMA_JPEG_RD_BUF_U_PNTR_ADDR  /* RW */ (JPEGD_BASE+0x00000110)
-#define HWIO_RTDMA_JPEG_RD_BUF_U_PNTR__POR           0x00000000
-#define HWIO_RTDMA_JPEG_RD_BUF_U_PNTR__RMSK          0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_RD_BUF_U_PNTR__SHFT                   3
-
-/* Register Element MIN and MAX*/
-#define HWIO_RTDMA_JPEG_RD_BUF_U_PNTR___S                     3
-#define HWIO_RTDMA_JPEG_RD_BUF_U_PNTR___S                     3
-#define HWIO_RTDMA_JPEG_RD_BUF_U_PNTR___S                     3
-#define HWIO_RTDMA_JPEG_RD_BUF_U_PNTR___S                     3
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_RD_BUF_U_PNTR__PNTR__BMSK        0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_RD_BUF_U_PNTR__PNTR__SHFT               3
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_RD_BUF_V_PNTR                     RTDMA_JPEG_RD_BUF_V_PNTR
-#define HWIO_RTDMA_JPEG_RD_BUF_V_PNTR_ADDR  /* RW */    (JPEGD_BASE+0x00000114)
-#define HWIO_RTDMA_JPEG_RD_BUF_V_PNTR__POR              0x00000000
-#define HWIO_RTDMA_JPEG_RD_BUF_V_PNTR__RMSK             0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_RD_BUF_V_PNTR__SHFT                      3
-
-/* Register Element MIN and MAX*/
-#define HWIO_RTDMA_JPEG_RD_BUF_V_PNTR___S                        3
-#define HWIO_RTDMA_JPEG_RD_BUF_V_PNTR___S                        3
-#define HWIO_RTDMA_JPEG_RD_BUF_V_PNTR___S                        3
-#define HWIO_RTDMA_JPEG_RD_BUF_V_PNTR___S                        3
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_RD_BUF_V_PNTR__PNTR__BMSK       0xFFFFFFF8
-#define HWIO_RTDMA_JPEG_RD_BUF_V_PNTR__PNTR__SHFT                3
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_RD_BUF_PITCH                       RTDMA_JPEG_RD_BUF_PITCH
-#define HWIO_RTDMA_JPEG_RD_BUF_PITCH_ADDR  /* RW */    (JPEGD_BASE+0x00000118)
-#define HWIO_RTDMA_JPEG_RD_BUF_PITCH__POR              0x00000000
-#define HWIO_RTDMA_JPEG_RD_BUF_PITCH__RMSK             0x00003FF8
-#define HWIO_RTDMA_JPEG_RD_BUF_PITCH__SHFT                      3
-
-/* Register Element MIN and MAX*/
-#define HWIO_RTDMA_JPEG_RD_BUF_PITCH___S                        3
-#define HWIO_RTDMA_JPEG_RD_BUF_PITCH___S                        3
-#define HWIO_RTDMA_JPEG_RD_BUF_PITCH___S                        3
-#define HWIO_RTDMA_JPEG_RD_BUF_PITCH___S                        3
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_RD_BUF_PITCH__PITCH__BMSK            0x00003FF8
-#define HWIO_RTDMA_JPEG_RD_BUF_PITCH__PITCH__SHFT                     3
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_RD_PLANE_SIZE                     RTDMA_JPEG_RD_PLANE_SIZE
-#define HWIO_RTDMA_JPEG_RD_PLANE_SIZE_ADDR  /* RW */  (JPEGD_BASE+0x0000011C)
-#define HWIO_RTDMA_JPEG_RD_PLANE_SIZE__POR            0x00000000
-#define HWIO_RTDMA_JPEG_RD_PLANE_SIZE__RMSK            0x1FFF1FFF
-#define HWIO_RTDMA_JPEG_RD_PLANE_SIZE__SHFT                     0
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_RD_PLANE_SIZE__PLANE_VSIZE__BMSK         0x1FFF0000
-#define HWIO_RTDMA_JPEG_RD_PLANE_SIZE__PLANE_VSIZE__SHFT                 16
-#define HWIO_RTDMA_JPEG_RD_PLANE_SIZE__PLANE_HSIZE__BMSK         0x00001FFF
-#define HWIO_RTDMA_JPEG_RD_PLANE_SIZE__PLANE_HSIZE__SHFT                  0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_RD_BLOCK_SIZE                       RTDMA_JPEG_RD_BLOCK_SIZE
-#define HWIO_RTDMA_JPEG_RD_BLOCK_SIZE_ADDR  /* RW */    (JPEGD_BASE+0x00000120)
-#define HWIO_RTDMA_JPEG_RD_BLOCK_SIZE__POR              0x000003CF
-#define HWIO_RTDMA_JPEG_RD_BLOCK_SIZE__RMSK             0x00000FFF
-#define HWIO_RTDMA_JPEG_RD_BLOCK_SIZE__SHFT                      0
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_RD_BLOCK_SIZE__BLOCK_VSIZE__BMSK       0x00000FC0
-#define HWIO_RTDMA_JPEG_RD_BLOCK_SIZE__BLOCK_VSIZE__SHFT                6
-#define HWIO_RTDMA_JPEG_RD_BLOCK_SIZE__BLOCK_HSIZE__BMSK       0x0000003F
-#define HWIO_RTDMA_JPEG_RD_BLOCK_SIZE__BLOCK_HSIZE__SHFT                0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_RD_BUFFER_SIZE               RTDMA_JPEG_RD_BUFFER_SIZE
-#define HWIO_RTDMA_JPEG_RD_BUFFER_SIZE_ADDR  (JPEGD_BASE+0x00000124)
-#define HWIO_RTDMA_JPEG_RD_BUFFER_SIZE__POR               0x00000000
-#define HWIO_RTDMA_JPEG_RD_BUFFER_SIZE__RMSK              0x00001FFF
-#define HWIO_RTDMA_JPEG_RD_BUFFER_SIZE__SHFT                       0
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_RD_BUFFER_SIZE__BUFFER_VSIZE__BMSK      0x00001FFF
-#define HWIO_RTDMA_JPEG_RD_BUFFER_SIZE__BUFFER_VSIZE__SHFT                0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_RD_STA_ACK                     RTDMA_JPEG_RD_STA_ACK
-#define HWIO_RTDMA_JPEG_RD_STA_ACK_ADDR         (JPEGD_BASE+0x00000128)
-#define HWIO_RTDMA_JPEG_RD_STA_ACK__POR                     0x00000000
-#define HWIO_RTDMA_JPEG_RD_STA_ACK__RMSK                    0x00000003
-#define HWIO_RTDMA_JPEG_RD_STA_ACK__SHFT                             0
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_RD_STA_ACK__EOF_STA__BMSK           0x00000002
-#define HWIO_RTDMA_JPEG_RD_STA_ACK__EOF_STA__SHFT                    1
-#define HWIO_RTDMA_JPEG_RD_STA_ACK__SOF_STA__BMSK           0x00000001
-#define HWIO_RTDMA_JPEG_RD_STA_ACK__SOF_STA__SHFT                    0
-#define HWIO_RTDMA_JPEG_RD_STA_ACK__EOF_ACK__BMSK           0x00000002
-#define HWIO_RTDMA_JPEG_RD_STA_ACK__EOF_ACK__SHFT                    1
-#define HWIO_RTDMA_JPEG_RD_STA_ACK__SOF_ACK__BMSK           0x00000001
-#define HWIO_RTDMA_JPEG_RD_STA_ACK__SOF_ACK__SHFT                    0
-
-/* Register ADDR, RMSK, and SHFT*/
-#define RTDMA_JPEG_RD_INT_EN                      RTDMA_JPEG_RD_INT_EN
-#define HWIO_RTDMA_JPEG_RD_INT_EN_ADDR  /* W */        (JPEGD_BASE+0x0000012C)
-#define HWIO_RTDMA_JPEG_RD_INT_EN__POR                      0x00000000
-#define HWIO_RTDMA_JPEG_RD_INT_EN__RMSK                     0x00000003
-#define HWIO_RTDMA_JPEG_RD_INT_EN__SHFT                              0
-
-/* Register Field FMSK and SHFT*/
-#define HWIO_RTDMA_JPEG_RD_INT_EN__EOF_EN__BMSK             0x00000002
-#define HWIO_RTDMA_JPEG_RD_INT_EN__EOF_EN__SHFT                      1
-#define HWIO_RTDMA_JPEG_RD_INT_EN__SOF_EN__BMSK             0x00000001
-#define HWIO_RTDMA_JPEG_RD_INT_EN__SOF_EN__SHFT                      0
-
-#endif /* MSM_MERCURY_HW_REG_H */
diff --git a/drivers/media/video/msm/mercury/msm_mercury_macros.h b/drivers/media/video/msm/mercury/msm_mercury_macros.h
deleted file mode 100644
index 0ab07cd..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_macros.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_MERCURY_MACROS_H
-#define MSM_MERCURY_MACROS_H
-
-#include <media/msm_mercury.h>
-
-#define mercury_kread(reg) \
-	hw_cmd.type = MSM_MERCURY_HW_CMD_TYPE_READ; \
-	hw_cmd.n = 1; \
-	hw_cmd.offset = HWIO_##reg##_ADDR; \
-	hw_cmd.mask = HWIO_##reg##__RMSK; \
-	hw_cmd.data = 0x0; \
-	msm_mercury_hw_exec_cmds(&hw_cmd, 1);
-
-#define mercury_kwrite(reg, val) \
-	hw_cmd.offset = HWIO_##reg##_ADDR; \
-	hw_cmd.mask = HWIO_##reg##__RMSK; \
-	hw_cmd.type = MSM_MERCURY_HW_CMD_TYPE_WRITE; \
-	hw_cmd.n = 1; \
-	hw_cmd.data = val; \
-	msm_mercury_hw_exec_cmds(&hw_cmd, 1);
-
-#define GET_FVAL(val, reg, field) ((val & HWIO_FMSK(reg, field)) >> \
-	HWIO_SHFT(reg, field))
-
-#define byte unsigned char
-#define word unsigned short
-#define dword unsigned long
-
-#define inp(port)    (*((dword *) (port)))
-#define inpb(port)     (*((byte *) (port)))
-#define inpw(port)   (*((word *) (port)))
-#define inpdw(port)   (*((dword *)(port)))
-
-#define outp(port, val)   (*((dword *) (port)) = ((dword) (val)))
-#define outpb(port, val)   (*((byte *) (port)) = ((byte) (val)))
-#define outpw(port, val)  (*((word *) (port)) = ((word) (val)))
-#define outpdw(port, val) (*((dword *) (port)) = ((dword) (val)))
-
-
-#define in_byte(addr)				(inp(addr))
-#define in_byte_masked(addr, mask)	(inp(addr) & (byte)mask)
-#define out_byte(addr, val)			 outp(addr, val)
-#define in_word(addr)				(inpw(addr))
-#define in_word_masked(addr, mask)	(inpw(addr) & (word)mask)
-#define out_word(addr, val)			 outpw(addr, val)
-#define in_dword(addr)				(inpdw(addr))
-#define in_dword_masked(addr, mask)	(inpdw(addr) & mask)
-#define out_dword(addr, val)			 outpdw(addr, val)
-
-/* shadowed, masked output for write-only registers */
-#define out_byte_masked(io, mask, val, shadow)  \
-	do { \
-		shadow = (shadow & (word)(~(mask))) | \
-		((word)((val) & (mask))); \
-		(void) out_byte(io, shadow);\
-	} while (0);
-
-#define out_word_masked(io, mask, val, shadow)  \
-	do { \
-		shadow = (shadow & (word)(~(mask))) | \
-		((word)((val) & (mask))); \
-		(void) out_word(io, shadow); \
-	} while (0);
-
-#define out_dword_masked(io, mask, val, shadow)  \
-	do { \
-		shadow = (shadow & (dword)(~(mask))) | \
-		((dword)((val) & (mask))); \
-		(void) out_dword(io, shadow);\
-	} while (0);
-
-#define out_byte_masked_ns(io, mask, val, current_reg_content)  \
-	(void) out_byte(io, ((current_reg_content & \
-	(word)(~(mask))) | ((word)((val) & (mask)))))
-
-#define out_word_masked_ns(io, mask, val, current_reg_content)  \
-	(void) out_word(io, ((current_reg_content & \
-	(word)(~(mask))) | ((word)((val) & (mask)))))
-
-#define out_dword_masked_ns(io, mask, val, current_reg_content) \
-	(void) out_dword(io, ((current_reg_content & \
-	(dword)(~(mask))) | ((dword)((val) & (mask)))))
-
-#define MEM_INF(val, reg, field)	((val & HWIO_FMSK(reg, field)) >> \
-	HWIO_SHFT(reg, field))
-
-#define MEM_OUTF(mem, reg, field, val)\
-	out_dword_masked_ns(mem, HWIO_FMSK(reg, field), \
-	(unsigned  int)val<<HWIO_SHFT(reg, field), in_dword(mem))
-
-#define MEM_OUTF2(mem, reg, field2, field1, val2, val1)  \
-	out_dword_masked_ns(mem, (HWIO_FMSK(reg, field2)| \
-	HWIO_FMSK(reg, field1)), \
-	(((unsigned int)val2<<HWIO_SHFT(reg, field2))| \
-	((unsigned int)val1<<HWIO_SHFT(reg, field1))), in_dword(mem))
-
-#define MEM_OUTF3(mem, reg, fld3, fld2, fld1, val3, val2, val1)  \
-	out_dword_masked_ns(mem, (HWIO_FMSK(reg, fld3)| \
-	HWIO_FMSK(reg, fld2)|HWIO_FMSK(reg, fld1)), \
-	(((unsigned int)val3<<HWIO_SHFT(reg, fld3))| \
-	((unsigned int)val2<<HWIO_SHFT(reg, fld2))| \
-	((unsigned int)val1<<HWIO_SHFT(reg, fld1))), in_dword(mem))
-
-#define HWIO_FMSK(reg, field)   HWIO_##reg##__##field##__BMSK
-#define HWIO_SHFT(reg, field)   HWIO_##reg##__##field##__SHFT
-#endif
diff --git a/drivers/media/video/msm/mercury/msm_mercury_platform.c b/drivers/media/video/msm/mercury/msm_mercury_platform.c
deleted file mode 100644
index e6392fe..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_platform.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/module.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/android_pmem.h>
-#include <mach/clk.h>
-#include <mach/camera.h>
-#include <mach/msm_subsystem_map.h>
-
-#include "msm_mercury_platform.h"
-#include "msm_mercury_sync.h"
-#include "msm_mercury_common.h"
-#include "msm_mercury_hw.h"
-
-
-struct ion_client *mercury_client;
-
-static struct msm_cam_clk_info mercury_jpegd_clk_info[] = {
-	{"core_clk", 200000000},
-	{"iface_clk", -1}
-};
-
-void msm_mercury_platform_p2v(struct file  *file,
-	struct ion_handle **ionhandle)
-{
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_unmap_iommu(mercury_client, *ionhandle, CAMERA_DOMAIN,
-		GEN_POOL);
-	ion_free(mercury_client, *ionhandle);
-	*ionhandle = NULL;
-#elif CONFIG_ANDROID_PMEM
-	put_pmem_file(file);
-#endif
-}
-
-uint32_t msm_mercury_platform_v2p(int fd, uint32_t len,
-	struct file **file_p,
-	struct ion_handle **ionhandle)
-{
-	unsigned long paddr;
-	unsigned long size;
-	int rc;
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	*ionhandle = ion_import_dma_buf(mercury_client, fd);
-	if (IS_ERR_OR_NULL(*ionhandle))
-		return 0;
-
-	rc = ion_map_iommu(mercury_client, *ionhandle, CAMERA_DOMAIN,
-		GEN_POOL, SZ_4K, 0, &paddr,
-		(unsigned long *)&size, 0, 0);
-#elif CONFIG_ANDROID_PMEM
-	unsigned long kvstart;
-	rc = get_pmem_file(fd, &paddr, &kvstart, &size, file_p);
-#else
-	rc = 0;
-	paddr = 0;
-	size = 0;
-#endif
-	if (rc < 0) {
-		MCR_PR_ERR("%s: get_pmem_file fd %d error %d\n", __func__, fd,
-			rc);
-		goto error1;
-	}
-
-	/* validate user input */
-	if (len > size) {
-		MCR_PR_ERR("%s: invalid offset + len\n", __func__);
-		goto error1;
-	}
-
-	return paddr;
-error1:
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_free(mercury_client, *ionhandle);
-#endif
-	return 0;
-}
-
-int msm_mercury_platform_init(struct platform_device *pdev,
-	struct resource **mem,
-	void **base,
-	int *irq,
-	irqreturn_t (*handler) (int, void *),
-	void *context)
-{
-	int rc = 0;
-	int mercury_irq;
-	struct resource *mercury_mem, *mercury_io, *mercury_irq_res;
-	void *mercury_base;
-	struct msm_mercury_device *pmercury_dev =
-		(struct msm_mercury_device *) context;
-
-	MCR_DBG("%s:%d]\n", __func__, __LINE__);
-
-	mercury_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!mercury_mem) {
-		MCR_PR_ERR("%s: no mem resource?\n", __func__);
-		return -ENODEV;
-	}
-
-	mercury_irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!mercury_irq_res) {
-		MCR_PR_ERR("no irq resource?\n");
-		return -ENODEV;
-	}
-	mercury_irq = mercury_irq_res->start;
-
-	mercury_io = request_mem_region(mercury_mem->start,
-		resource_size(mercury_mem), pdev->name);
-	if (!mercury_io) {
-		MCR_PR_ERR("%s: region already claimed\n", __func__);
-		return -EBUSY;
-	}
-	MCR_DBG("%s:%d]\n", __func__, __LINE__);
-	mercury_base = ioremap(mercury_mem->start,
-		resource_size(mercury_mem));
-	if (!mercury_base) {
-		rc = -ENOMEM;
-		MCR_PR_ERR("%s: ioremap failed\n", __func__);
-		goto fail1;
-	}
-	MCR_DBG("%s:%d]\n", __func__, __LINE__);
-
-	rc = msm_cam_clk_enable(&pmercury_dev->pdev->dev,
-		mercury_jpegd_clk_info, pmercury_dev->mercury_clk,
-		ARRAY_SIZE(mercury_jpegd_clk_info), 1);
-	if (rc < 0)
-		MCR_PR_ERR("%s:%d] rc = %d\n", __func__, __LINE__, rc);
-
-	MCR_DBG("%s:%d]\n", __func__, __LINE__);
-	msm_mercury_hw_init(mercury_base, resource_size(mercury_mem));
-	rc = request_irq(mercury_irq, handler, IRQF_TRIGGER_RISING,
-		"mercury", context);
-	if (rc) {
-		MCR_PR_ERR("%s: request_irq failed, %d\n", __func__,
-			mercury_irq);
-		goto fail3;
-	}
-	MCR_DBG("%s:%d]\n", __func__, __LINE__);
-	*mem  = mercury_mem;
-	*base = mercury_base;
-	*irq  = mercury_irq;
-	MCR_DBG("%s:%d]\n", __func__, __LINE__);
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	mercury_client = msm_ion_client_create(-1, "camera/mercury");
-#endif
-	MCR_PR_ERR("%s:%d] success\n", __func__, __LINE__);
-	return rc;
-fail3:
-	MCR_DBG("%s:%d]\n", __func__, __LINE__);
-	msm_cam_clk_enable(&pmercury_dev->pdev->dev, mercury_jpegd_clk_info,
-		pmercury_dev->mercury_clk,
-		ARRAY_SIZE(mercury_jpegd_clk_info), 0);
-	MCR_DBG("%s:%d]\n", __func__, __LINE__);
-	iounmap(mercury_base);
-fail1:
-	MCR_DBG("%s:%d]\n", __func__, __LINE__);
-	release_mem_region(mercury_mem->start, resource_size(mercury_mem));
-	MCR_DBG("%s:%d]\n", __func__, __LINE__);
-	return rc;
-}
-
-int msm_mercury_platform_release(struct resource *mem, void *base,
-	int irq, void *context)
-{
-	int result = 0;
-	struct msm_mercury_device *pmercury_dev =
-		(struct msm_mercury_device *) context;
-
-	free_irq(irq, context);
-	msm_cam_clk_enable(&pmercury_dev->pdev->dev, mercury_jpegd_clk_info,
-		pmercury_dev->mercury_clk, ARRAY_SIZE(mercury_jpegd_clk_info),
-		0);
-	iounmap(base);
-	release_mem_region(mem->start, resource_size(mem));
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_client_destroy(mercury_client);
-#endif
-	MCR_DBG("%s:%d] success\n", __func__, __LINE__);
-	return result;
-}
-
diff --git a/drivers/media/video/msm/mercury/msm_mercury_platform.h b/drivers/media/video/msm/mercury/msm_mercury_platform.h
deleted file mode 100644
index dfdea3c..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_platform.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_MERCURY_PLATFORM_H
-#define MSM_MERCURY_PLATFORM_H
-
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/msm_ion.h>
-
-int msm_mercury_platform_clk_enable(void);
-int msm_mercury_platform_clk_disable(void);
-
-void msm_mercury_platform_p2v(struct file  *file,
-	struct ion_handle **ionhandle);
-
-uint32_t msm_mercury_platform_v2p(int fd, uint32_t len, struct file **file,
-	struct ion_handle **ionhandle);
-
-int msm_mercury_platform_init(struct platform_device *pdev,
-	struct resource **mem,
-	void **base,
-	int *irq,
-	irqreturn_t (*handler) (int, void *),
-	void *context);
-
-int msm_mercury_platform_release(struct resource *mem, void *base, int irq,
-	void *context);
-
-#endif /* MSM_MERCURY_PLATFORM_H */
diff --git a/drivers/media/video/msm/mercury/msm_mercury_sync.c b/drivers/media/video/msm/mercury/msm_mercury_sync.c
deleted file mode 100644
index 9293aad..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_sync.c
+++ /dev/null
@@ -1,614 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/list.h>
-#include <linux/uaccess.h>
-#include <linux/slab.h>
-#include <media/msm_mercury.h>
-
-#include "msm_mercury_sync.h"
-#include "msm_mercury_core.h"
-#include "msm_mercury_platform.h"
-#include "msm_mercury_common.h"
-#include "msm_mercury_macros.h"
-#include "msm_mercury_hw_reg.h"
-
-static struct msm_mercury_core_buf out_buf_local;
-static struct msm_mercury_core_buf in_buf_local;
-
-/*************** queue helper ****************/
-inline void msm_mercury_q_init(char const *name, struct msm_mercury_q *q_p)
-{
-	MCR_DBG("%s:%d] %s\n", __func__, __LINE__, name);
-	q_p->name = name;
-	spin_lock_init(&q_p->lck);
-	INIT_LIST_HEAD(&q_p->q);
-	init_waitqueue_head(&q_p->wait);
-	q_p->unblck = 0;
-}
-
-inline void *msm_mercury_q_out(struct msm_mercury_q *q_p)
-{
-	unsigned long flags;
-	struct msm_mercury_q_entry *q_entry_p = NULL;
-	void *data = NULL;
-
-	MCR_DBG("(%d)%s()  %s\n", __LINE__, __func__, q_p->name);
-	spin_lock_irqsave(&q_p->lck, flags);
-	if (!list_empty(&q_p->q)) {
-		q_entry_p = list_first_entry(&q_p->q,
-			struct msm_mercury_q_entry,
-			list);
-		list_del_init(&q_entry_p->list);
-	}
-	spin_unlock_irqrestore(&q_p->lck, flags);
-
-	if (q_entry_p) {
-		data = q_entry_p->data;
-		kfree(q_entry_p);
-	} else {
-		MCR_DBG("%s:%d] %s no entry\n", __func__, __LINE__, q_p->name);
-	}
-
-	return data;
-}
-
-inline int msm_mercury_q_in(struct msm_mercury_q *q_p, void *data)
-{
-	unsigned long flags;
-
-	struct msm_mercury_q_entry *q_entry_p;
-
-	MCR_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-
-	q_entry_p = kmalloc(sizeof(struct msm_mercury_q_entry), GFP_ATOMIC);
-	if (!q_entry_p) {
-		MCR_PR_ERR("%s: no mem\n", __func__);
-		return -EFAULT;
-	}
-	q_entry_p->data = data;
-
-	spin_lock_irqsave(&q_p->lck, flags);
-	list_add_tail(&q_entry_p->list, &q_p->q);
-	spin_unlock_irqrestore(&q_p->lck, flags);
-
-	return 0;
-}
-
-inline int msm_mercury_q_in_buf(struct msm_mercury_q *q_p,
-	struct msm_mercury_core_buf *buf)
-{
-	struct msm_mercury_core_buf *buf_p;
-
-	MCR_DBG("%s:%d]\n", __func__, __LINE__);
-	buf_p = kmalloc(sizeof(struct msm_mercury_core_buf), GFP_ATOMIC);
-	if (!buf_p) {
-		MCR_PR_ERR("%s: no mem\n", __func__);
-		return -EFAULT;
-	}
-
-	memcpy(buf_p, buf, sizeof(struct msm_mercury_core_buf));
-
-	msm_mercury_q_in(q_p, buf_p);
-	return 0;
-}
-
-inline int msm_mercury_q_wait(struct msm_mercury_q *q_p)
-{
-	int tm = MAX_SCHEDULE_TIMEOUT; /* 500ms */
-	int rc;
-
-	MCR_DBG("%s:%d %s wait\n", __func__, __LINE__, q_p->name);
-	rc = wait_event_interruptible_timeout(q_p->wait,
-		(!list_empty_careful(&q_p->q) || q_p->unblck),
-		msecs_to_jiffies(tm));
-
-	MCR_DBG("%s:%d %s wait done (rc=%d)\n", __func__,
-		__LINE__, q_p->name, rc);
-	if (list_empty_careful(&q_p->q)) {
-		if (rc == 0) {
-			rc = -ETIMEDOUT;
-			MCR_PR_ERR("%s:%d] %s timeout\n", __func__,
-				__LINE__, q_p->name);
-		} else if (q_p->unblck) {
-			MCR_DBG("%s:%d %s unblock is true", __func__,
-				__LINE__, q_p->name);
-			rc = q_p->unblck;
-			q_p->unblck = 0;
-		} else if (rc < 0) {
-			MCR_PR_ERR("%s:%d %s rc %d\n", __func__, __LINE__,
-				q_p->name, rc);
-		}
-	}
-	return rc;
-}
-
-inline int msm_mercury_q_wakeup(struct msm_mercury_q *q_p)
-{
-	MCR_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-	wake_up(&q_p->wait);
-	return 0;
-}
-
-inline int msm_mercury_q_wr_eoi(struct msm_mercury_q *q_p)
-{
-	MCR_DBG("%s:%d] Wake up %s\n", __func__, __LINE__, q_p->name);
-	q_p->unblck = MSM_MERCURY_EVT_FRAMEDONE;
-	wake_up(&q_p->wait);
-	return 0;
-}
-
-inline int msm_mercury_q_wr_err(struct msm_mercury_q *q_p)
-{
-	MCR_DBG("%s:%d] Wake up %s\n", __func__, __LINE__, q_p->name);
-	q_p->unblck = MSM_MERCURY_EVT_ERR;
-	wake_up(&q_p->wait);
-	return 0;
-}
-
-inline int msm_mercury_q_unblock(struct msm_mercury_q *q_p)
-{
-	MCR_DBG("%s:%d] Wake up %s\n", __func__, __LINE__, q_p->name);
-	q_p->unblck = MSM_MERCURY_EVT_UNBLOCK;
-	wake_up(&q_p->wait);
-	return 0;
-}
-
-inline void msm_mercury_q_cleanup(struct msm_mercury_q *q_p)
-{
-	void *data;
-	MCR_DBG("\n%s:%d] %s\n", __func__, __LINE__, q_p->name);
-	do {
-		data = msm_mercury_q_out(q_p);
-		if (data) {
-			MCR_DBG("%s:%d] %s\n", __func__, __LINE__, q_p->name);
-			kfree(data);
-		}
-	} while (data);
-	q_p->unblck = 0;
-}
-
-/*************** event queue ****************/
-int msm_mercury_framedone_irq(struct msm_mercury_device *pmercury_dev)
-{
-	MCR_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_mercury_q_unblock(&pmercury_dev->evt_q);
-
-	MCR_DBG("%s:%d] Exit\n", __func__, __LINE__);
-	return 0;
-}
-
-int msm_mercury_evt_get(struct msm_mercury_device *pmercury_dev,
-	void __user *arg)
-{
-	struct msm_mercury_ctrl_cmd ctrl_cmd;
-	int rc = 0;
-
-	MCR_DBG("(%d)%s() Enter\n", __LINE__, __func__);
-	ctrl_cmd.type = (uint32_t)msm_mercury_q_wait(&pmercury_dev->evt_q);
-
-	rc = copy_to_user(arg, &ctrl_cmd, sizeof(ctrl_cmd));
-
-	if (rc) {
-		MCR_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	return 0;
-}
-
-int msm_mercury_evt_get_unblock(struct msm_mercury_device *pmercury_dev)
-{
-	MCR_DBG("--(%d)%s() Enter\n", __LINE__, __func__);
-	msm_mercury_q_unblock(&pmercury_dev->evt_q);
-	return 0;
-}
-
-int msm_mercury_output_buf_cfg(struct msm_mercury_device *pmercury_dev,
-	void __user *arg)
-{
-	struct msm_mercury_buf buf_cmd;
-
-
-	MCR_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	if (copy_from_user(&buf_cmd, arg, sizeof(struct msm_mercury_buf))) {
-		MCR_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	out_buf_local.y_buffer_addr = msm_mercury_platform_v2p(buf_cmd.fd,
-		buf_cmd.y_len, &out_buf_local.file, &out_buf_local.handle);
-	out_buf_local.cbcr_buffer_addr = out_buf_local.y_buffer_addr +
-		buf_cmd.y_len;
-
-	if (!out_buf_local.y_buffer_addr) {
-		MCR_PR_ERR("%s:%d] v2p wrong\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	msm_mercury_hw_output_y_buf_cfg(out_buf_local.y_buffer_addr);
-	msm_mercury_hw_output_u_buf_cfg(out_buf_local.cbcr_buffer_addr);
-
-	MCR_DBG("(%d)%s()\n  y_buf=0x%08X, y_len=0x%08X, vaddr=0x%08X\n"
-		"  u_buf=0x%08X, u_len=0x%08X\n\n", __LINE__, __func__,
-		out_buf_local.y_buffer_addr, buf_cmd.y_len, (int) buf_cmd.vaddr,
-		out_buf_local.cbcr_buffer_addr, buf_cmd.cbcr_len);
-
-	return 0;
-}
-
-int msm_mercury_input_buf_cfg(struct msm_mercury_device *pmercury_dev,
-	void __user *arg)
-{
-	struct msm_mercury_buf buf_cmd;
-
-
-	MCR_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	if (copy_from_user(&buf_cmd, arg, sizeof(struct msm_mercury_buf))) {
-		MCR_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	in_buf_local.y_buffer_addr = msm_mercury_platform_v2p(buf_cmd.fd,
-		buf_cmd.y_len, &in_buf_local.file, &in_buf_local.handle);
-
-	if (!in_buf_local.y_buffer_addr) {
-		MCR_PR_ERR("%s:%d] v2p wrong\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	msm_mercury_hw_bitstream_buf_cfg(in_buf_local.y_buffer_addr);
-
-	MCR_DBG("(%d)%s()\n  bitstream_buf=0x%08X, len=0x%08X, vaddr=0x%08X\n",
-		__LINE__, __func__, in_buf_local.y_buffer_addr, buf_cmd.y_len,
-		(int) buf_cmd.vaddr);
-
-	return 0;
-}
-
-int msm_mercury_output_get(struct msm_mercury_device *pmercury_dev,
-	void __user *to)
-{
-	MCR_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_mercury_platform_p2v(out_buf_local.file, &out_buf_local.handle);
-	return 0;
-}
-
-int msm_mercury_input_get(struct msm_mercury_device *pmercury_dev,
-	void __user *to)
-{
-
-
-	MCR_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	msm_mercury_platform_p2v(in_buf_local.file, &in_buf_local.handle);
-	return 0;
-}
-
-int msm_mercury_ioctl_dump_regs(void)
-{
-	uint32_t mercury_regs[] = {
-		0x0000, 0x0008, 0x0010, 0x0014, 0x0018, 0x001C, 0x0020, 0x0024,
-		0x0030, 0x0034, 0x0040, 0x0050, 0x0054, 0x0058, 0x005C, 0x0060,
-		0x0064, 0x0070, 0x0080, 0x0084, 0x0088, 0x0258, 0x025C, 0x0260,
-		0x0264, 0x0200, 0x0204, 0x0208, 0x020C, 0x0210, 0x0214, 0x0218,
-		0x021C, 0x0220, 0x0224, 0x0228, 0x0100, 0x0104, 0x010C, 0x0110,
-		0x0114, 0x0118, 0x011C, 0x0120, 0x0124, 0x0128, 0x012C};
-
-	struct msm_mercury_hw_cmd hw_cmd;
-	int len = sizeof(mercury_regs)/4;
-	int i;
-
-	MCR_DBG("\n%s\n  (%d)%s()\n", __FILE__, __LINE__, __func__);
-
-	hw_cmd.mask = 0xFFFFFFFF;
-	hw_cmd.type = MSM_MERCURY_HW_CMD_TYPE_READ;
-	hw_cmd.n = 1;
-
-	for (i = 0; i < len; i++) {
-		hw_cmd.offset = mercury_regs[i];
-		msm_mercury_hw_exec_cmds(&hw_cmd, 1);
-	}
-
-	return 0;
-}
-
-int msm_mercury_ioctl_magic_code(struct msm_mercury_device *pmercury_dev,
-	void * __user arg)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-	int rc = 0;
-
-	rc = copy_from_user(&hw_cmd, arg, sizeof(struct msm_mercury_hw_cmd));
-	if (rc) {
-		printk(KERN_ERR "%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	hw_cmd.data = 0x600D600D;
-	rc = copy_to_user(arg, &hw_cmd, sizeof(hw_cmd));
-
-	if (rc) {
-		printk(KERN_ERR "%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	return 0;
-}
-
-int msm_mercury_irq(int event, void *context, void *data)
-{
-	struct msm_mercury_device *pmercury_dev =
-		(struct msm_mercury_device *) context;
-
-	switch (event) {
-	case MSM_MERCURY_HW_IRQ_SW_RESET_ACK:
-		/* wake up evt_q*/
-		MCR_DBG("(%d)%s Wake up event q from Reset IRQ\n", __LINE__,
-			__func__);
-		msm_mercury_q_wakeup(&pmercury_dev->evt_q);
-		break;
-	case MSM_MERCURY_HW_IRQ_WR_EOI_ACK:
-		/*wake up evt_q*/
-		MCR_DBG("%d%s Wake up eventq from WR_EOI IRQ\n", __LINE__,
-			__func__);
-		msm_mercury_q_wr_eoi(&pmercury_dev->evt_q);
-		break;
-	case MSM_MERCURY_HW_IRQ_WR_ERR_ACK:
-		MCR_DBG("(%d)%s Wake up eventq from WR_ERR IRQ\n",
-			__LINE__, __func__);
-		msm_mercury_q_wr_err(&pmercury_dev->evt_q);
-		break;
-	default:
-		MCR_DBG("(%d)%s (default) Wake up event q from WR_ERR IRQ\n",
-			__LINE__, __func__);
-		msm_mercury_q_wr_err(&pmercury_dev->evt_q);
-	}
-	return 0;
-}
-
-int __msm_mercury_open(struct msm_mercury_device *pmercury_dev)
-{
-	int rc = 0;
-
-	mutex_lock(&pmercury_dev->lock);
-	if (pmercury_dev->open_count) {
-		/* only open once */
-		MCR_PR_ERR("%s:%d] busy\n", __func__, __LINE__);
-		mutex_unlock(&pmercury_dev->lock);
-		return -EBUSY;
-	}
-	pmercury_dev->open_count++;
-	mutex_unlock(&pmercury_dev->lock);
-
-	msm_mercury_core_irq_install(msm_mercury_irq);
-
-	rc = msm_mercury_platform_init(pmercury_dev->pdev,
-		&pmercury_dev->mem, &pmercury_dev->base,
-		&pmercury_dev->irq, msm_mercury_core_irq, pmercury_dev);
-	if (rc) {
-		MCR_PR_ERR("%s:%d] platform_init fail %d\n", __func__,
-			__LINE__, rc);
-		return rc;
-	}
-
-	MCR_DBG("\n%s:%d] platform resources - mem 0x%p, base 0x%p, irq %d\n",
-		__func__, __LINE__, pmercury_dev->mem, pmercury_dev->base,
-		pmercury_dev->irq);
-
-	msm_mercury_q_cleanup(&pmercury_dev->evt_q);
-	msm_mercury_core_init();
-
-	MCR_DBG("\n%s:%d] success\n", __func__, __LINE__);
-	return rc;
-}
-
-int __msm_mercury_release(struct msm_mercury_device *pmercury_dev)
-{
-	MCR_DBG("%s:%d] Enter\n", __func__, __LINE__);
-	mutex_lock(&pmercury_dev->lock);
-	if (!pmercury_dev->open_count) {
-		MCR_PR_ERR(KERN_ERR "%s: not opened\n", __func__);
-		mutex_unlock(&pmercury_dev->lock);
-		return -EINVAL;
-	}
-	pmercury_dev->open_count--;
-	mutex_unlock(&pmercury_dev->lock);
-
-	msm_mercury_q_cleanup(&pmercury_dev->evt_q);
-
-	if (pmercury_dev->open_count)
-		MCR_PR_ERR(KERN_ERR "%s: multiple opens\n", __func__);
-
-	if (pmercury_dev->open_count)
-		MCR_PR_ERR(KERN_ERR "%s: multiple opens\n", __func__);
-
-
-	msm_mercury_platform_release(pmercury_dev->mem, pmercury_dev->base,
-		pmercury_dev->irq, pmercury_dev);
-
-	return 0;
-}
-
-int msm_mercury_ioctl_hw_cmd(struct msm_mercury_device *pmercury_dev,
-	void * __user arg)
-{
-	struct msm_mercury_hw_cmd hw_cmd;
-	int is_copy_to_user;
-	int rc = 0;
-
-	rc = copy_from_user(&hw_cmd, arg, sizeof(struct msm_mercury_hw_cmd));
-	if (rc) {
-		MCR_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	is_copy_to_user = msm_mercury_hw_exec_cmds(&hw_cmd, 1);
-	if (is_copy_to_user >= 0) {
-		rc = copy_to_user(arg, &hw_cmd, sizeof(hw_cmd));
-
-		if (rc) {
-			MCR_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-			return -EFAULT;
-		}
-	}
-
-	return 0;
-}
-
-int msm_mercury_ioctl_hw_cmds(struct msm_mercury_device *pmercury_dev,
-	void * __user arg)
-{
-	int is_copy_to_user;
-	int len;
-	uint32_t m;
-	struct msm_mercury_hw_cmds *hw_cmds_p;
-	struct msm_mercury_hw_cmd *hw_cmd_p;
-
-	if (copy_from_user(&m, arg, sizeof(m))) {
-		MCR_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-		return -EFAULT;
-	}
-
-	len = sizeof(struct msm_mercury_hw_cmds) +
-		sizeof(struct msm_mercury_hw_cmd) * (m - 1);
-	hw_cmds_p = kmalloc(len, GFP_KERNEL);
-	if (!hw_cmds_p) {
-		MCR_PR_ERR("[%d]%s() no mem %d\n", __LINE__, __func__, len);
-		return -EFAULT;
-	}
-
-	if (copy_from_user(hw_cmds_p, arg, len)) {
-		MCR_PR_ERR("[%d]%s Fail to copy hw_cmds of len %d from user\n",
-			__LINE__, __func__, len);
-		kfree(hw_cmds_p);
-		return -EFAULT;
-	}
-
-	hw_cmd_p = (struct msm_mercury_hw_cmd *) &(hw_cmds_p->hw_cmd);
-
-	is_copy_to_user = msm_mercury_hw_exec_cmds(hw_cmd_p, m);
-
-	if (is_copy_to_user >= 0) {
-		if (copy_to_user(arg, hw_cmds_p, len)) {
-			MCR_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
-			kfree(hw_cmds_p);
-			return -EFAULT;
-		}
-	}
-	kfree(hw_cmds_p);
-	return 0;
-}
-
-int msm_mercury_ioctl_reset(struct msm_mercury_device *pmercury_dev,
-	void * __user arg)
-{
-	int rc = 0;
-
-	MCR_DBG("(%d)%s() Enter\n", __LINE__, __func__);
-	rc = msm_mercury_core_reset();
-
-	return rc;
-}
-
-long __msm_mercury_ioctl(struct msm_mercury_device *pmercury_dev,
-	unsigned int cmd, unsigned long arg)
-{
-	int rc = 0;
-
-	switch (cmd) {
-	case MSM_MCR_IOCTL_GET_HW_VERSION:
-		rc = msm_mercury_ioctl_magic_code(pmercury_dev,
-			(void __user *) arg);
-		break;
-
-	case MSM_MCR_IOCTL_RESET:
-		rc = msm_mercury_ioctl_reset(pmercury_dev, (void __user *) arg);
-		break;
-
-	case MSM_MCR_IOCTL_EVT_GET:
-		rc = msm_mercury_evt_get(pmercury_dev, (void __user *) arg);
-		break;
-
-	case MSM_MCR_IOCTL_EVT_GET_UNBLOCK:
-		rc = msm_mercury_evt_get_unblock(pmercury_dev);
-		break;
-
-	case MSM_MCR_IOCTL_HW_CMD:
-		rc = msm_mercury_ioctl_hw_cmd(pmercury_dev,
-			(void __user *) arg);
-		break;
-
-	case MSM_MCR_IOCTL_HW_CMDS:
-		rc = msm_mercury_ioctl_hw_cmds(pmercury_dev,
-			(void __user *) arg);
-		break;
-
-	case MSM_MCR_IOCTL_INPUT_BUF_CFG:
-		rc = msm_mercury_input_buf_cfg(pmercury_dev,
-			(void __user *) arg);
-		break;
-
-	case MSM_MCR_IOCTL_OUTPUT_BUF_CFG:
-		rc = msm_mercury_output_buf_cfg(pmercury_dev,
-			(void __user *) arg);
-		break;
-
-	case MSM_MCR_IOCTL_OUTPUT_GET:
-		rc = msm_mercury_output_get(pmercury_dev,
-			(void __user *) arg);
-		break;
-
-	case MSM_MCR_IOCTL_INPUT_GET:
-		rc = msm_mercury_input_get(pmercury_dev,
-			(void __user *) arg);
-		break;
-
-	case MSM_MCR_IOCTL_TEST_DUMP_REGION:
-		rc = msm_mercury_ioctl_dump_regs();
-		break;
-
-	default:
-		printk(KERN_ERR "(%d)%s()  cmd = %d not supported\n",
-			__LINE__, __func__, _IOC_NR(cmd));
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-struct msm_mercury_device *__msm_mercury_init(struct platform_device *pdev)
-{
-	struct msm_mercury_device *pmercury_dev;
-	pmercury_dev = kzalloc(sizeof(struct msm_mercury_device), GFP_ATOMIC);
-	if (!pmercury_dev) {
-		printk(KERN_ERR "%s:%d]no mem\n", __func__, __LINE__);
-		return NULL;
-	}
-
-	mutex_init(&pmercury_dev->lock);
-
-	pmercury_dev->pdev = pdev;
-
-	msm_mercury_q_init("evt_q", &pmercury_dev->evt_q);
-
-	return pmercury_dev;
-}
-
-int __msm_mercury_exit(struct msm_mercury_device *pmercury_dev)
-{
-	mutex_destroy(&pmercury_dev->lock);
-	kfree(pmercury_dev);
-	return 0;
-}
-
diff --git a/drivers/media/video/msm/mercury/msm_mercury_sync.h b/drivers/media/video/msm/mercury/msm_mercury_sync.h
deleted file mode 100644
index a44092f..0000000
--- a/drivers/media/video/msm/mercury/msm_mercury_sync.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_MERCURY_SYNC_H
-#define MSM_MERCURY_SYNC_H
-
-#include <linux/fs.h>
-#include <linux/list.h>
-#include <linux/cdev.h>
-#include <linux/platform_device.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-subdev.h>
-#include "msm_mercury_core.h"
-
-struct msm_mercury_q {
-		char const  *name;
-		struct list_head  q;
-		spinlock_t  lck;
-		wait_queue_head_t wait;
-		int        unblck;
-};
-
-struct msm_mercury_q_entry {
-		struct list_head list;
-		void   *data;
-};
-
-struct msm_mercury_device {
-		struct platform_device *pdev;
-		struct resource        *mem;
-		int                     irq;
-		void                   *base;
-		struct clk *mercury_clk[2];
-		struct device *device;
-		struct cdev   cdev;
-		struct mutex  lock;
-		char      open_count;
-		uint8_t       op_mode;
-
-		/* event queue including frame done & err indications*/
-		struct msm_mercury_q evt_q;
-		struct v4l2_subdev subdev;
-
-};
-
-int __msm_mercury_open(struct msm_mercury_device *pmcry_dev);
-int __msm_mercury_release(struct msm_mercury_device *pmcry_dev);
-
-long __msm_mercury_ioctl(struct msm_mercury_device *pmcry_dev,
-	unsigned int cmd, unsigned long arg);
-
-struct msm_mercury_device *__msm_mercury_init(struct platform_device *pdev);
-int __msm_mercury_exit(struct msm_mercury_device *pmcry_dev);
-int msm_mercury_ioctl_hw_cmds(struct msm_mercury_device *pmcry_dev,
-	void * __user arg);
-int msm_mercury_ioctl_hw_cmds_wo(struct msm_mercury_device *pmcry_dev,
-	void * __user arg);
-#endif /* MSM_MERCURY_SYNC_H */
diff --git a/drivers/media/video/msm/msm.c b/drivers/media/video/msm/msm.c
index eabff83..ffe0842 100644
--- a/drivers/media/video/msm/msm.c
+++ b/drivers/media/video/msm/msm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -20,10 +20,19 @@
 #include <linux/spinlock.h>
 #include <linux/proc_fs.h>
 #include "msm.h"
-#include "msm_cam_server.h"
+#include "msm_csid.h"
+#include "msm_csic.h"
+#include "msm_csiphy.h"
+#include "msm_ispif.h"
+
 #include "msm_sensor.h"
-#include "msm_actuator.h"
-#include "msm_camera_eeprom.h"
+#include "msm_vfe32.h"
+
+#include <linux/switch.h>
+
+#ifdef CONFIG_RAWCHIP
+#include "rawchip/rawchip.h"
+#endif
 
 #define MSM_MAX_CAMERA_SENSORS 5
 
@@ -34,12 +43,118 @@
 #endif
 
 static unsigned msm_camera_v4l2_nr = -1;
+static struct msm_cam_server_dev g_server_dev;
+static struct class *msm_class;
+static dev_t msm_devno;
 static int vnode_count;
 
 module_param(msm_camera_v4l2_nr, uint, 0644);
 MODULE_PARM_DESC(msm_camera_v4l2_nr, "videoX start number, -1 is autodetect");
 
-/* callback function from all subdevices of a msm_cam_v4l2_device */
+static long msm_server_send_v4l2_evt(void *evt);
+static void msm_cam_server_subdev_notify(struct v4l2_subdev *sd,
+	unsigned int notification, void *arg);
+
+static void msm_queue_init(struct msm_device_queue *queue, const char *name)
+{
+	D("%s\n", __func__);
+	spin_lock_init(&queue->lock);
+	queue->len = 0;
+	queue->max = 0;
+	queue->name = name;
+	INIT_LIST_HEAD(&queue->list);
+	init_waitqueue_head(&queue->wait);
+}
+
+static void msm_enqueue(struct msm_device_queue *queue,
+			struct list_head *entry)
+{
+	unsigned long flags;
+	spin_lock_irqsave(&queue->lock, flags);
+	queue->len++;
+	if (queue->len > queue->max) {
+		queue->max = queue->len;
+		pr_info("%s: queue %s new max is %d\n", __func__,
+			queue->name, queue->max);
+	}
+	list_add_tail(entry, &queue->list);
+	wake_up(&queue->wait);
+	D("%s: woke up %s\n", __func__, queue->name);
+	spin_unlock_irqrestore(&queue->lock, flags);
+}
+static void msm_drain_eventq(struct msm_device_queue *queue)
+{
+	unsigned long flags;
+	struct msm_queue_cmd *qcmd;
+	struct msm_isp_event_ctrl *isp_event;
+
+	spin_lock_irqsave(&queue->lock, flags);
+	while (!list_empty(&queue->list)) {
+		qcmd = list_first_entry(&queue->list,
+			struct msm_queue_cmd, list_eventdata);
+		list_del_init(&qcmd->list_eventdata);
+		isp_event =
+			(struct msm_isp_event_ctrl *)
+			qcmd->command;
+		if (isp_event->isp_data.ctrl.value != NULL)
+			kfree(isp_event->isp_data.ctrl.value);
+
+		kfree(qcmd->command);
+		free_qcmd(qcmd);
+	}
+	spin_unlock_irqrestore(&queue->lock, flags);
+}
+
+static int32_t msm_find_free_queue(void)
+{
+	int i;
+	for (i = 0; i < MAX_NUM_ACTIVE_CAMERA; i++) {
+		struct msm_cam_server_queue *queue;
+		queue = &g_server_dev.server_queue[i];
+		if (!queue->queue_active)
+			return i;
+	}
+	return -EINVAL;
+}
+
+uint32_t msm_camera_get_mctl_handle(void)
+{
+	uint32_t i;
+	if ((g_server_dev.mctl_handle_cnt << 8) == 0)
+		g_server_dev.mctl_handle_cnt++;
+	for (i = 0; i < MAX_NUM_ACTIVE_CAMERA; i++) {
+		if (g_server_dev.mctl[i].handle == 0) {
+			g_server_dev.mctl[i].handle =
+				(++g_server_dev.mctl_handle_cnt) << 8 | i;
+			memset(&g_server_dev.mctl[i].mctl,
+				   0, sizeof(g_server_dev.mctl[i].mctl));
+			return g_server_dev.mctl[i].handle;
+		}
+	}
+	return 0;
+}
+
+struct msm_cam_media_controller *msm_camera_get_mctl(uint32_t handle)
+{
+	uint32_t mctl_index;
+	mctl_index = handle & 0xff;
+	if ((mctl_index < MAX_NUM_ACTIVE_CAMERA) &&
+		(g_server_dev.mctl[mctl_index].handle == handle))
+		return &g_server_dev.mctl[mctl_index].mctl;
+	return NULL;
+}
+
+void msm_camera_free_mctl(uint32_t handle)
+{
+	uint32_t mctl_index;
+	mctl_index = handle & 0xff;
+	if ((mctl_index < MAX_NUM_ACTIVE_CAMERA) &&
+		(g_server_dev.mctl[mctl_index].handle == handle))
+		g_server_dev.mctl[mctl_index].handle = 0;
+	else
+		pr_err("%s: invalid free handle\n", __func__);
+}
+
 static void msm_cam_v4l2_subdev_notify(struct v4l2_subdev *sd,
 				unsigned int notification, void *arg)
 {
@@ -53,17 +168,750 @@
 
 	if (pcam == NULL)
 		return;
-
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
 	if (pmctl == NULL)
 		return;
+
 }
 
-/*
- *
- * implementation of v4l2_ioctl_ops
- *
- */
+static int msm_ctrl_cmd_done(void *arg)
+{
+	void __user *uptr;
+	struct msm_queue_cmd *qcmd;
+	struct msm_camera_v4l2_ioctl_t *ioctl_ptr = arg;
+	struct msm_ctrl_cmd *command;
+	D("%s\n", __func__);
+
+	command = kzalloc(sizeof(struct msm_ctrl_cmd), GFP_KERNEL);
+
+	if (!command) {
+		pr_err("%s Insufficient memory. return", __func__);
+		goto command_alloc_fail;
+	}
+ 
+ 	 qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
+ 	 if (!qcmd) {
+ 		 pr_err("%s Insufficient memory. return", __func__);
+ 		 goto qcmd_alloc_fail;
+ 	 }
+ 
+ 	 mutex_lock(&g_server_dev.server_queue_lock);
+	if (copy_from_user(command, (void __user *)ioctl_ptr->ioctl_ptr,
+					   sizeof(struct msm_ctrl_cmd))) {
+		pr_err("%s: copy_from_user failed, size=%d\n",
+			   __func__, sizeof(struct msm_ctrl_cmd));
+		goto ctrl_cmd_done_error;
+	}
+
+	if (!g_server_dev.server_queue[command->queue_idx].queue_active) {
+		pr_err("%s: Invalid queue\n", __func__);
+		goto ctrl_cmd_done_error;
+	}
+	D("%s qid %d evtid %d %d\n", __func__, command->queue_idx,
+		command->evt_id,
+		g_server_dev.server_queue[command->queue_idx].evt_id);
+
+	if (command->evt_id !=
+		g_server_dev.server_queue[command->queue_idx].evt_id) {
+		pr_err("%s Invalid event id from userspace cmd id %d %d qid %d\n",
+			__func__, command->evt_id,
+			g_server_dev.server_queue[command->queue_idx].evt_id,
+			command->queue_idx);
+		goto ctrl_cmd_done_error;
+	}
+	atomic_set(&qcmd->on_heap, 1);
+	uptr = command->value;
+	qcmd->command = command;
+
+	if (command->length > 0) {
+		command->value =
+			g_server_dev.server_queue[command->queue_idx].ctrl_data;
+		if (command->length > max_control_command_size) {
+			pr_err("%s: user data %d is too big (max %d)\n",
+				__func__, command->length,
+				max_control_command_size);
+			goto ctrl_cmd_done_error;
+		}
+		if (copy_from_user(command->value, uptr, command->length)) {
+			pr_err("%s: copy_from_user failed, size=%d\n",
+			__func__, sizeof(struct msm_ctrl_cmd));
+			goto ctrl_cmd_done_error;
+		}
+	}
+
+	msm_enqueue(&g_server_dev.server_queue
+		[command->queue_idx].ctrl_q, &qcmd->list_control);
+	mutex_unlock(&g_server_dev.server_queue_lock);
+	return 0;
+
+ctrl_cmd_done_error:
+	mutex_unlock(&g_server_dev.server_queue_lock);
+	free_qcmd(qcmd);
+qcmd_alloc_fail:
+	kfree(command);
+command_alloc_fail:
+	return -EINVAL;	
+}
+
+
+static void msm_cam_stop_hardware(struct msm_cam_v4l2_device *pcam)
+{
+	struct msm_cam_media_controller *pmctl;
+	int rc = 0;
+	if (pcam == NULL)
+		return;
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+	if (pmctl && pmctl->mctl_release) {
+		pr_err("%s: stopping hardware upon error\n", __func__);
+		
+		pmctl->mctl_cmd = NULL;
+	
+		rc = pmctl->mctl_release(pmctl);
+		if (rc < 0)
+			pr_err("mctl_release fails %d\n", rc);
+		pmctl->mctl_release = NULL;
+	}
+}
+
+
+static int msm_server_control(struct msm_cam_server_dev *server_dev,
+				struct msm_ctrl_cmd *out)
+{
+	int rc = 0;
+	void *value;
+	struct msm_queue_cmd *rcmd;
+	struct msm_queue_cmd *event_qcmd;	
+	struct msm_ctrl_cmd *ctrlcmd;
+	struct msm_device_queue *queue =
+		&server_dev->server_queue[out->queue_idx].ctrl_q;
+	struct msm_cam_v4l2_device *pcam = server_dev->pcam_active;
+	struct v4l2_event v4l2_evt;
+	struct msm_isp_event_ctrl *isp_event;
+	void *ctrlcmd_data;
+	int loop = 0; 
+
+	event_qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
+	if (!event_qcmd) {
+		pr_err("%s Insufficient memory. return", __func__);
+		rc = -ENOMEM;
+		goto event_qcmd_alloc_fail;
+	}
+
+	isp_event = kzalloc(sizeof(struct msm_isp_event_ctrl), GFP_KERNEL);
+	if (!isp_event) {
+		pr_err("%s Insufficient memory. return", __func__);
+		rc = -ENOMEM;
+		goto isp_event_alloc_fail;
+	}
+
+	D("%s\n", __func__);
+	mutex_lock(&server_dev->server_queue_lock);
+	if (++server_dev->server_evt_id == 0)
+		server_dev->server_evt_id++;
+ 
+	 D("%s qid %d evtid %d\n", __func__, out->queue_idx,
+		 server_dev->server_evt_id);
+	server_dev->server_queue[out->queue_idx].evt_id =
+		 server_dev->server_evt_id;
+	v4l2_evt.type = V4L2_EVENT_PRIVATE_START + MSM_CAM_RESP_V4L2;
+	v4l2_evt.u.data[0] = out->queue_idx;
+	
+	isp_event->resptype = MSM_CAM_RESP_V4L2;
+	isp_event->isp_data.ctrl = *out;
+	isp_event->isp_data.ctrl.evt_id = server_dev->server_evt_id;
+	if (out->value != NULL && out->length != 0) {
+		ctrlcmd_data = kzalloc(out->length, GFP_KERNEL);
+		if (!ctrlcmd_data) {
+			rc = -ENOMEM;
+			goto ctrlcmd_alloc_fail;
+		}
+		memcpy(ctrlcmd_data, out->value, out->length);
+		isp_event->isp_data.ctrl.value = ctrlcmd_data;
+	}
+
+	atomic_set(&event_qcmd->on_heap, 1);
+	event_qcmd->command = isp_event;
+
+	msm_enqueue(&server_dev->server_queue[out->queue_idx].eventData_q,
+				&event_qcmd->list_eventdata);
+
+	v4l2_event_queue(server_dev->server_command_queue.pvdev,
+					  &v4l2_evt);
+
+	D("%s v4l2_event_queue: type = 0x%x\n", __func__, v4l2_evt.type);
+	mutex_unlock(&server_dev->server_queue_lock);
+	
+	D("Waiting for config status\n");
+
+wait_event:
+	rc = wait_event_interruptible_timeout(queue->wait,
+		!list_empty_careful(&queue->list),
+		msecs_to_jiffies(out->timeout_ms));
+	D("Waiting is over for config status\n");
+	if (list_empty_careful(&queue->list)) {
+		if (!rc)
+			rc = -ETIMEDOUT;
+		if (rc == -ERESTARTSYS && loop < 20) {
+			loop++;
+			msleep(5);
+			pr_info("%s: goto wait_event loop %d\n", __func__, loop);
+			goto wait_event;
+		}
+		else if (rc < 0) {
+			if (++server_dev->server_evt_id == 0)
+				server_dev->server_evt_id++;
+			pr_err("%s: wait_event error %d\n", __func__, rc);
+			
+			pr_info("%s: ctrlcmd.type = %d\n", __func__, out->type);
+			if (out->type == MSM_V4L2_SET_CTRL_CMD) {
+				if (out->value)
+					pr_info("%s: ctrl_cmd.type = %d\n", __func__, 
+						((struct msm_ctrl_cmd *)out->value)->type);
+			}
+			
+			msm_cam_stop_hardware(pcam);
+
+			return rc;
+		}
+	}
+
+	rcmd = msm_dequeue(queue, list_control);
+	BUG_ON(!rcmd);
+	if(!rcmd) return -EINVAL;
+	D("%s Finished servicing ioctl\n", __func__);
+
+	ctrlcmd = (struct msm_ctrl_cmd *)(rcmd->command);
+	value = out->value;
+	if (ctrlcmd->length > 0 && value != NULL &&
+		ctrlcmd->length <= out->length)
+		memcpy(value, ctrlcmd->value, ctrlcmd->length);
+
+	memcpy(out, ctrlcmd, sizeof(struct msm_ctrl_cmd));
+	out->value = value;
+	kfree(ctrlcmd);
+
+	free_qcmd(rcmd);
+	D("%s: rc %d\n", __func__, rc);
+	
+	if (rc >= 0) {
+		
+		if (out->status == 0)
+			rc = -1;
+		else if (out->status == 1 || out->status == 4)
+			rc = 0;
+		else
+			rc = -EINVAL;
+	}
+	return rc;
+
+ctrlcmd_alloc_fail:
+	kfree(isp_event);
+isp_event_alloc_fail:
+	kfree(event_qcmd);
+event_qcmd_alloc_fail:
+	return rc;	
+}
+
+static int msm_send_open_server(struct msm_cam_v4l2_device *pcam)
+{
+	int rc = 0;
+	struct msm_ctrl_cmd ctrlcmd;
+	D("%s qid %d\n", __func__, pcam->server_queue_idx);
+
+	memset(&ctrlcmd, 0, sizeof(ctrlcmd)); 
+	ctrlcmd.type	   = MSM_V4L2_OPEN;
+	ctrlcmd.timeout_ms = 10000;
+	ctrlcmd.length	 = strnlen(g_server_dev.config_info.config_dev_name[0],
+				MAX_DEV_NAME_LEN)+1;
+	ctrlcmd.value    = (char *)g_server_dev.config_info.config_dev_name[0];
+	ctrlcmd.vnode_id = pcam->vnode_id;
+	ctrlcmd.queue_idx = pcam->server_queue_idx;
+	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
+
+	
+	rc = msm_server_control(&g_server_dev, &ctrlcmd);
+
+	return rc;
+}
+
+static int msm_send_close_server(struct msm_cam_v4l2_device *pcam)
+{
+	int rc = 0;
+	struct msm_ctrl_cmd ctrlcmd;
+	pr_info("%s qid %d\n", __func__, pcam->server_queue_idx);
+
+	memset(&ctrlcmd, 0, sizeof(ctrlcmd)); 
+	ctrlcmd.type	   = MSM_V4L2_CLOSE;
+	ctrlcmd.timeout_ms = 10000;
+	ctrlcmd.length	 = strnlen(g_server_dev.config_info.config_dev_name[0],
+				MAX_DEV_NAME_LEN)+1;
+	ctrlcmd.value    = (char *)g_server_dev.config_info.config_dev_name[0];
+	ctrlcmd.vnode_id = pcam->vnode_id;
+	ctrlcmd.queue_idx = pcam->server_queue_idx;
+	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
+
+	
+	rc = msm_server_control(&g_server_dev, &ctrlcmd);
+
+	return rc;
+}
+
+static int msm_server_set_fmt(struct msm_cam_v4l2_device *pcam, int idx,
+				 struct v4l2_format *pfmt)
+{
+	int rc = 0;
+	int i = 0;
+	struct v4l2_pix_format *pix = &pfmt->fmt.pix;
+	struct msm_ctrl_cmd ctrlcmd;
+	struct img_plane_info plane_info;
+
+	plane_info.width = pix->width;
+	plane_info.height = pix->height;
+	plane_info.pixelformat = pix->pixelformat;
+	plane_info.buffer_type = pfmt->type;
+	plane_info.ext_mode = pcam->dev_inst[idx]->image_mode;
+	plane_info.num_planes = 1;
+	D("%s: %d, %d, 0x%x\n", __func__,
+		pfmt->fmt.pix.width, pfmt->fmt.pix.height,
+		pfmt->fmt.pix.pixelformat);
+
+	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+		D("%s, Attention! Wrong buf-type %d\n", __func__, pfmt->type);
+
+	for (i = 0; i < pcam->num_fmts; i++)
+		if (pcam->usr_fmts[i].fourcc == pix->pixelformat)
+			break;
+	if (i == pcam->num_fmts) {
+		pr_err("%s: User requested pixelformat %x not supported\n",
+						__func__, pix->pixelformat);
+		return -EINVAL;
+	}
+
+	memset(&ctrlcmd, 0, sizeof(ctrlcmd)); 
+	ctrlcmd.type       = MSM_V4L2_VID_CAP_TYPE;
+	ctrlcmd.length     = sizeof(struct img_plane_info);
+	ctrlcmd.value      = (void *)&plane_info;
+	ctrlcmd.timeout_ms = 10000;
+	ctrlcmd.vnode_id   = pcam->vnode_id;
+	ctrlcmd.queue_idx = pcam->server_queue_idx;	
+	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
+
+	
+	rc = msm_server_control(&g_server_dev, &ctrlcmd);
+
+	if (rc >= 0) {
+		pcam->dev_inst[idx]->vid_fmt = *pfmt;
+		pcam->dev_inst[idx]->sensor_pxlcode
+					= pcam->usr_fmts[i].pxlcode;
+		D("%s:inst=0x%x,idx=%d,width=%d,heigth=%d\n",
+			 __func__, (u32)pcam->dev_inst[idx], idx,
+			 pcam->dev_inst[idx]->vid_fmt.fmt.pix.width,
+			 pcam->dev_inst[idx]->vid_fmt.fmt.pix.height);
+		pcam->dev_inst[idx]->plane_info = plane_info;
+	}
+
+	return rc;
+}
+
+static int msm_server_set_fmt_mplane(struct msm_cam_v4l2_device *pcam, int idx,
+				 struct v4l2_format *pfmt)
+{
+	int rc = 0;
+	int i = 0;
+	struct v4l2_pix_format_mplane *pix_mp = &pfmt->fmt.pix_mp;
+	struct msm_ctrl_cmd ctrlcmd;
+	struct img_plane_info plane_info;
+
+	plane_info.width = pix_mp->width;
+	plane_info.height = pix_mp->height;
+	plane_info.pixelformat = pix_mp->pixelformat;
+	plane_info.buffer_type = pfmt->type;
+	plane_info.ext_mode = pcam->dev_inst[idx]->image_mode;
+	plane_info.num_planes = pix_mp->num_planes;
+	if (plane_info.num_planes <= 0 ||
+		plane_info.num_planes > VIDEO_MAX_PLANES) {
+		pr_err("%s Invalid number of planes set %d", __func__,
+				plane_info.num_planes);
+		return -EINVAL;
+	}
+	D("%s: %d, %d, 0x%x\n", __func__,
+		pfmt->fmt.pix_mp.width, pfmt->fmt.pix_mp.height,
+		pfmt->fmt.pix_mp.pixelformat);
+
+	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
+		pr_err("%s, Attention! Wrong buf-type %d\n",
+			__func__, pfmt->type);
+		return -EINVAL;
+	}
+
+	for (i = 0; i < pcam->num_fmts; i++)
+		if (pcam->usr_fmts[i].fourcc == pix_mp->pixelformat)
+			break;
+	if (i == pcam->num_fmts) {
+		pr_err("%s: User requested pixelformat %x not supported\n",
+						__func__, pix_mp->pixelformat);
+		return -EINVAL;
+	}
+
+	memset(&ctrlcmd, 0, sizeof(ctrlcmd)); 
+	ctrlcmd.type       = MSM_V4L2_VID_CAP_TYPE;
+	ctrlcmd.length     = sizeof(struct img_plane_info);
+	ctrlcmd.value      = (void *)&plane_info;
+	ctrlcmd.timeout_ms = 10000;
+	ctrlcmd.vnode_id   = pcam->vnode_id;
+	ctrlcmd.queue_idx = pcam->server_queue_idx;
+
+	
+	rc = msm_server_control(&g_server_dev, &ctrlcmd);
+	if (rc >= 0) {
+		pcam->dev_inst[idx]->vid_fmt = *pfmt;
+		pcam->dev_inst[idx]->sensor_pxlcode
+					= pcam->usr_fmts[i].pxlcode;
+		D("%s:inst=0x%x,idx=%d,width=%d,heigth=%d\n",
+			 __func__, (u32)pcam->dev_inst[idx], idx,
+			 pcam->dev_inst[idx]->vid_fmt.fmt.pix_mp.width,
+			 pcam->dev_inst[idx]->vid_fmt.fmt.pix_mp.height);
+		pcam->dev_inst[idx]->plane_info = plane_info;
+	}
+
+	return rc;
+}
+
+static int msm_server_streamon(struct msm_cam_v4l2_device *pcam, int idx)
+{
+	int rc = 0;
+	struct msm_ctrl_cmd ctrlcmd;
+	D("%s\n", __func__);
+
+	memset(&ctrlcmd, 0, sizeof(ctrlcmd)); 
+	ctrlcmd.type	   = MSM_V4L2_STREAM_ON;
+	ctrlcmd.timeout_ms = 10000;
+	ctrlcmd.length	 = 0;
+	ctrlcmd.value    = NULL;
+	ctrlcmd.stream_type = pcam->dev_inst[idx]->image_mode;
+	ctrlcmd.vnode_id = pcam->vnode_id;
+	ctrlcmd.queue_idx = pcam->server_queue_idx;
+	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
+
+
+	
+	rc = msm_server_control(&g_server_dev, &ctrlcmd);
+
+	return rc;
+}
+
+static int msm_server_streamoff(struct msm_cam_v4l2_device *pcam, int idx)
+{
+	int rc = 0;
+	struct msm_ctrl_cmd ctrlcmd;
+
+	D("%s, pcam = 0x%x\n", __func__, (u32)pcam);
+	memset(&ctrlcmd, 0, sizeof(ctrlcmd));  
+	ctrlcmd.type        = MSM_V4L2_STREAM_OFF;
+	ctrlcmd.timeout_ms  = 10000;
+	ctrlcmd.length      = 0;
+	ctrlcmd.value       = NULL;
+	ctrlcmd.stream_type = pcam->dev_inst[idx]->image_mode;
+	ctrlcmd.vnode_id = pcam->vnode_id;
+	ctrlcmd.queue_idx = pcam->server_queue_idx;
+	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
+
+	
+	rc = msm_server_control(&g_server_dev, &ctrlcmd);
+
+	return rc;
+}
+
+static int msm_server_proc_ctrl_cmd(struct msm_cam_v4l2_device *pcam,
+				 struct v4l2_control *ctrl, int is_set_cmd)
+{
+	int rc = 0;
+	struct msm_ctrl_cmd ctrlcmd, *tmp_cmd;
+	uint8_t *ctrl_data = NULL;
+	void __user *uptr_cmd;
+	void __user *uptr_value;
+	uint32_t cmd_len = sizeof(struct msm_ctrl_cmd);
+	uint32_t value_len;
+
+	tmp_cmd = (struct msm_ctrl_cmd *)ctrl->value;
+	uptr_cmd = (void __user *)ctrl->value;
+	uptr_value = (void __user *)tmp_cmd->value;
+	value_len = tmp_cmd->length;
+
+	D("%s: cmd type = %d, up1=0x%x, ulen1=%d, up2=0x%x, ulen2=%d\n",
+		__func__, tmp_cmd->type, (uint32_t)uptr_cmd, cmd_len,
+		(uint32_t)uptr_value, tmp_cmd->length);
+
+	ctrl_data = kzalloc(value_len+cmd_len, GFP_KERNEL);
+	if (ctrl_data == 0) {
+		pr_err("%s could not allocate memory\n", __func__);
+		rc = -ENOMEM;
+		goto end;
+	}
+	tmp_cmd = (struct msm_ctrl_cmd *)ctrl_data;
+	if (copy_from_user((void *)ctrl_data, uptr_cmd,
+					cmd_len)) {
+		pr_err("%s: copy_from_user failed.\n", __func__);
+		rc = -EINVAL;
+		goto end;
+	}
+	tmp_cmd->value = (void *)(ctrl_data+cmd_len);
+	if (uptr_value && tmp_cmd->length > 0) {
+		if (copy_from_user((void *)tmp_cmd->value, uptr_value,
+						value_len)) {
+			pr_err("%s: copy_from_user failed, size=%d\n",
+				__func__, value_len);
+			rc = -EINVAL;
+			goto end;
+		}
+	} else
+	tmp_cmd->value = NULL;
+
+	memset(&ctrlcmd, 0, sizeof(ctrlcmd));  
+	ctrlcmd.type = MSM_V4L2_SET_CTRL_CMD;
+	ctrlcmd.length = cmd_len + value_len;
+	ctrlcmd.value = (void *)ctrl_data;
+	if (tmp_cmd->timeout_ms > 0)
+		ctrlcmd.timeout_ms = tmp_cmd->timeout_ms;
+	else
+		ctrlcmd.timeout_ms = 1000;
+	ctrlcmd.vnode_id = pcam->vnode_id;
+	ctrlcmd.queue_idx = pcam->server_queue_idx;
+	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
+	
+	rc = msm_server_control(&g_server_dev, &ctrlcmd);
+	D("%s: msm_server_control rc=%d\n", __func__, rc);
+	if (rc == 0) {
+		if (uptr_value && tmp_cmd->length > 0 &&
+			copy_to_user((void __user *)uptr_value,
+				(void *)(ctrl_data+cmd_len), tmp_cmd->length)) {
+			pr_err("%s: copy_to_user failed, size=%d\n",
+				__func__, tmp_cmd->length);
+			rc = -EINVAL;
+			goto end;
+		}
+		tmp_cmd->value = uptr_value;
+		if (copy_to_user((void __user *)uptr_cmd,
+			(void *)tmp_cmd, cmd_len)) {
+			pr_err("%s: copy_to_user failed in cpy, size=%d\n",
+				__func__, cmd_len);
+			rc = -EINVAL;
+			goto end;
+		}
+	}
+end:
+	D("%s: END, type = %d, vaddr = 0x%x, vlen = %d, status = %d, rc = %d\n",
+		__func__, tmp_cmd->type, (uint32_t)tmp_cmd->value,
+		tmp_cmd->length, tmp_cmd->status, rc);
+	kfree(ctrl_data);
+	ctrl_data = NULL;
+	return rc;
+}
+
+static int msm_server_s_ctrl(struct msm_cam_v4l2_device *pcam,
+				 struct v4l2_control *ctrl)
+{
+	int rc = 0;
+	struct msm_ctrl_cmd ctrlcmd;
+	uint8_t ctrl_data[max_control_command_size];
+
+	WARN_ON(ctrl == NULL);
+	if (ctrl == NULL) {
+		pr_err("%s Invalid control\n", __func__);
+		return -EINVAL;
+	}
+	if (ctrl->id == MSM_V4L2_PID_CTRL_CMD)
+		return msm_server_proc_ctrl_cmd(pcam, ctrl, 1);
+
+	memset(ctrl_data, 0, sizeof(ctrl_data));
+
+	memset(&ctrlcmd, 0, sizeof(ctrlcmd));  
+	ctrlcmd.type = MSM_V4L2_SET_CTRL;
+	ctrlcmd.length = sizeof(struct v4l2_control);
+	ctrlcmd.value = (void *)ctrl_data;
+	memcpy(ctrlcmd.value, ctrl, ctrlcmd.length);
+	ctrlcmd.timeout_ms = 1000;
+	ctrlcmd.vnode_id = pcam->vnode_id;
+	ctrlcmd.queue_idx = pcam->server_queue_idx;
+	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
+
+	
+	rc = msm_server_control(&g_server_dev, &ctrlcmd);
+
+	return rc;
+}
+
+static int msm_server_g_ctrl(struct msm_cam_v4l2_device *pcam,
+				 struct v4l2_control *ctrl)
+{
+	int rc = 0;
+	struct msm_ctrl_cmd ctrlcmd;
+	uint8_t ctrl_data[max_control_command_size];
+
+	WARN_ON(ctrl == NULL);
+	if (ctrl == NULL) {
+		pr_err("%s Invalid control\n", __func__);
+		return -EINVAL;
+	}
+	if (ctrl->id == MSM_V4L2_PID_CTRL_CMD)
+		return msm_server_proc_ctrl_cmd(pcam, ctrl, 0);
+
+	memset(ctrl_data, 0, sizeof(ctrl_data));
+
+	memset(&ctrlcmd, 0, sizeof(ctrlcmd));  
+	ctrlcmd.type = MSM_V4L2_GET_CTRL;
+	ctrlcmd.length = sizeof(struct v4l2_control);
+	ctrlcmd.value = (void *)ctrl_data;
+	memcpy(ctrlcmd.value, ctrl, ctrlcmd.length);
+	ctrlcmd.timeout_ms = 1000;
+	ctrlcmd.vnode_id = pcam->vnode_id;
+	ctrlcmd.queue_idx = pcam->server_queue_idx;
+	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
+
+	
+	rc = msm_server_control(&g_server_dev, &ctrlcmd);
+
+	ctrl->value = ((struct v4l2_control *)ctrlcmd.value)->value;
+
+	return rc;
+}
+
+static int msm_server_q_ctrl(struct msm_cam_v4l2_device *pcam,
+			struct v4l2_queryctrl *queryctrl)
+{
+	int rc = 0;
+	struct msm_ctrl_cmd ctrlcmd;
+	uint8_t ctrl_data[max_control_command_size];
+
+	WARN_ON(queryctrl == NULL);
+	memset(ctrl_data, 0, sizeof(ctrl_data));
+
+	memset(&ctrlcmd, 0, sizeof(ctrlcmd));  
+	ctrlcmd.type = MSM_V4L2_QUERY_CTRL;
+	ctrlcmd.length = sizeof(struct v4l2_queryctrl);
+	ctrlcmd.value = (void *)ctrl_data;
+	memcpy(ctrlcmd.value, queryctrl, ctrlcmd.length);
+	ctrlcmd.timeout_ms = 1000;
+	ctrlcmd.vnode_id = pcam->vnode_id;
+	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
+
+	
+	rc = msm_server_control(&g_server_dev, &ctrlcmd);
+	D("%s: rc = %d\n", __func__, rc);
+
+	if (rc >= 0)
+		memcpy(queryctrl, ctrlcmd.value, sizeof(struct v4l2_queryctrl));
+
+	return rc;
+}
+
+static int msm_server_get_fmt(struct msm_cam_v4l2_device *pcam,
+		 int idx, struct v4l2_format *pfmt)
+{
+	struct v4l2_pix_format *pix = &pfmt->fmt.pix;
+
+	pix->width        = pcam->dev_inst[idx]->vid_fmt.fmt.pix.width;
+	pix->height       = pcam->dev_inst[idx]->vid_fmt.fmt.pix.height;
+	pix->field        = pcam->dev_inst[idx]->vid_fmt.fmt.pix.field;
+	pix->pixelformat  = pcam->dev_inst[idx]->vid_fmt.fmt.pix.pixelformat;
+	pix->bytesperline = pcam->dev_inst[idx]->vid_fmt.fmt.pix.bytesperline;
+	pix->colorspace   = pcam->dev_inst[idx]->vid_fmt.fmt.pix.colorspace;
+	pix->sizeimage    = pix->height * pix->bytesperline;
+
+	return 0;
+}
+
+static int msm_server_get_fmt_mplane(struct msm_cam_v4l2_device *pcam,
+		 int idx, struct v4l2_format *pfmt)
+{
+	*pfmt = pcam->dev_inst[idx]->vid_fmt;
+	return 0;
+}
+
+static int msm_server_try_fmt(struct msm_cam_v4l2_device *pcam,
+				 struct v4l2_format *pfmt)
+{
+	int rc = 0;
+	int i = 0;
+	struct v4l2_pix_format *pix = &pfmt->fmt.pix;
+
+	D("%s: 0x%x\n", __func__, pix->pixelformat);
+	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
+		pr_err("%s: pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE!\n",
+							__func__);
+		return -EINVAL;
+	}
+
+	
+	for (i = 0; i < pcam->num_fmts; i++) {
+		D("%s: usr_fmts.fourcc: 0x%x\n", __func__,
+			pcam->usr_fmts[i].fourcc);
+		if (pcam->usr_fmts[i].fourcc == pix->pixelformat)
+			break;
+	}
+
+	if (i == pcam->num_fmts) {
+		pr_err("%s: Format %x not found\n", __func__, pix->pixelformat);
+		return -EINVAL;
+	}
+	return rc;
+}
+
+static int msm_server_try_fmt_mplane(struct msm_cam_v4l2_device *pcam,
+				 struct v4l2_format *pfmt)
+{
+	int rc = 0;
+	int i = 0;
+	struct v4l2_pix_format_mplane *pix_mp = &pfmt->fmt.pix_mp;
+
+	D("%s: 0x%x\n", __func__, pix_mp->pixelformat);
+	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
+		pr_err("%s: Incorrect format type %d ",
+			__func__, pfmt->type);
+		return -EINVAL;
+	}
+
+	
+	for (i = 0; i < pcam->num_fmts; i++) {
+		D("%s: usr_fmts.fourcc: 0x%x\n", __func__,
+			pcam->usr_fmts[i].fourcc);
+		if (pcam->usr_fmts[i].fourcc == pix_mp->pixelformat)
+			break;
+	}
+
+	if (i == pcam->num_fmts) {
+		pr_err("%s: Format %x not found\n",
+			__func__, pix_mp->pixelformat);
+		return -EINVAL;
+	}
+	return rc;
+}
+
+static int msm_camera_get_crop(struct msm_cam_v4l2_device *pcam,
+				int idx, struct v4l2_crop *crop)
+{
+	int rc = 0;
+	struct msm_ctrl_cmd ctrlcmd;
+
+	BUG_ON(crop == NULL);
+
+	memset(&ctrlcmd, 0, sizeof(ctrlcmd));  
+	ctrlcmd.type = MSM_V4L2_GET_CROP;
+	ctrlcmd.length = sizeof(struct v4l2_crop);
+	ctrlcmd.value = (void *)crop;
+	ctrlcmd.timeout_ms = 1000;
+	ctrlcmd.vnode_id = pcam->vnode_id;
+	ctrlcmd.queue_idx = pcam->server_queue_idx;
+	ctrlcmd.stream_type = pcam->dev_inst[idx]->image_mode;
+	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
+
+	
+	rc = msm_server_control(&g_server_dev, &ctrlcmd);
+	D("%s: rc = %d\n", __func__, rc);
+
+	return rc;
+}
+
 static int msm_camera_v4l2_querycap(struct file *f, void *pctx,
 				struct v4l2_capability *pcaps)
 {
@@ -71,8 +919,8 @@
 	D("%s\n", __func__);
 	WARN_ON(pctx != f->private_data);
 
-	/* some other day, some other time */
-	/*cap->version = LINUX_VERSION_CODE; */
+	
+	
 	pcaps->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
 	return 0;
 }
@@ -92,47 +940,6 @@
 	return rc;
 }
 
-static int msm_camera_v4l2_private_general(struct file *f, void *pctx,
-	struct msm_camera_v4l2_ioctl_t *ioctl_ptr)
-{
-	int rc = 0;
-	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
-
-	WARN_ON(pctx != f->private_data);
-
-	rc = msm_server_private_general(pcam, ioctl_ptr);
-	if (rc < 0)
-		pr_err("%s: Private command failed rc %d\n", __func__, rc);
-	return rc;
-}
-
-static int msm_camera_v4l2_private_g_ctrl(struct file *f, void *pctx,
-	struct msm_camera_v4l2_ioctl_t *ioctl_ptr)
-{
-	int rc = -EINVAL;
-	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	pcam_inst = container_of(f->private_data,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-
-	WARN_ON(pctx != f->private_data);
-
-	mutex_lock(&pcam->vid_lock);
-	switch (ioctl_ptr->id) {
-	case MSM_V4L2_PID_INST_HANDLE:
-		COPY_TO_USER(rc, (void __user *)ioctl_ptr->ioctl_ptr,
-			(void *)&pcam_inst->inst_handle, sizeof(uint32_t));
-		if (rc)
-			ERR_COPY_TO_USER();
-		break;
-	default:
-		pr_err("%s Unsupported ioctl %d ", __func__, ioctl_ptr->id);
-		break;
-	}
-	mutex_unlock(&pcam->vid_lock);
-	return rc;
-}
-
 static int msm_camera_v4l2_g_ctrl(struct file *f, void *pctx,
 					struct v4l2_control *c)
 {
@@ -149,25 +956,6 @@
 	return rc;
 }
 
-static int msm_camera_v4l2_private_s_ctrl(struct file *f, void *pctx,
-			struct msm_camera_v4l2_ioctl_t *ioctl_ptr)
-{
-	int rc = -EINVAL;
-	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	pcam_inst = container_of(f->private_data,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-	WARN_ON(pctx != f->private_data);
-	mutex_lock(&pcam->vid_lock);
-	switch (ioctl_ptr->id) {
-	case MSM_V4L2_PID_CTRL_CMD:
-		rc = msm_server_proc_ctrl_cmd(pcam, ioctl_ptr, 1);
-		break;
-	}
-	mutex_unlock(&pcam->vid_lock);
-	return rc;
-}
-
 static int msm_camera_v4l2_s_ctrl(struct file *f, void *pctx,
 					struct v4l2_control *ctrl)
 {
@@ -187,6 +975,17 @@
 			 __func__, pcam_inst, pcam_inst->my_index);
 		pcam_inst->is_mem_map_inst = 1;
 		break;
+	case MSM_V4L2_PID_MMAP_ENTRY:
+		if (copy_from_user(&pcam_inst->mem_map,
+			(void *)ctrl->value,
+			sizeof(struct msm_mem_map_info))) {
+			rc = -EFAULT;
+		} else
+			D("%s:mmap entry:cookie=0x%x,mem_type=%d,len=%d\n",
+				__func__, pcam_inst->mem_map.cookie,
+				pcam_inst->mem_map.mem_type,
+				pcam_inst->mem_map.length);
+		break;
 	default:
 		if (ctrl->id == MSM_V4L2_PID_CAM_MODE)
 			pcam->op_mode = ctrl->value;
@@ -203,25 +1002,12 @@
 {
 	int rc = 0, i, j;
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	struct msm_cam_media_controller *pmctl;
-	struct msm_cam_v4l2_device *pcam = video_drvdata(f);
 	pcam_inst = container_of(f->private_data,
 		struct msm_cam_v4l2_dev_inst, eventHandle);
 	D("%s\n", __func__);
 	WARN_ON(pctx != f->private_data);
 
 	mutex_lock(&pcam_inst->inst_lock);
-	if (!pcam_inst->vbqueue_initialized && pb->count) {
-		pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-		if (pmctl == NULL) {
-			pr_err("%s Invalid mctl ptr", __func__);
-			mutex_unlock(&pcam_inst->inst_lock);
-			return -EINVAL;
-		}
-		pmctl->mctl_vbqueue_init(pcam_inst, &pcam_inst->vid_bufq,
-			pb->type);
-		pcam_inst->vbqueue_initialized = 1;
-	}
 
 	rc = vb2_reqbufs(&pcam_inst->vid_bufq, pb);
 	if (rc < 0) {
@@ -230,8 +1016,8 @@
 		return rc;
 	}
 	if (!pb->count) {
-		/* Deallocation. free buf_offset array */
-		D("%s Inst %p freeing buffer offsets array",
+		
+		pr_info("%s Inst %p freeing buffer offsets array",
 			__func__, pcam_inst);
 		for (j = 0 ; j < pcam_inst->buf_count ; j++) {
 			kfree(pcam_inst->buf_offset[j]);
@@ -239,16 +1025,14 @@
 		}
 		kfree(pcam_inst->buf_offset);
 		pcam_inst->buf_offset = NULL;
-		/* If the userspace has deallocated all the
-		 * buffers, then release the vb2 queue */
 		if (pcam_inst->vbqueue_initialized) {
 			vb2_queue_release(&pcam_inst->vid_bufq);
 			pcam_inst->vbqueue_initialized = 0;
 		}
 	} else {
-		D("%s Inst %p Allocating buf_offset array",
+		pr_info("%s Inst %p Allocating buf_offset array",
 			__func__, pcam_inst);
-		/* Allocation. allocate buf_offset array */
+		
 		pcam_inst->buf_offset = (struct msm_cam_buf_offset **)
 			kzalloc(pb->count * sizeof(struct msm_cam_buf_offset *),
 							GFP_KERNEL);
@@ -282,9 +1066,9 @@
 static int msm_camera_v4l2_querybuf(struct file *f, void *pctx,
 					struct v4l2_buffer *pb)
 {
-	/* get the video device */
-	int rc = 0;
+	
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
+	int rc = 0;
 	pcam_inst = container_of(f->private_data,
 		struct msm_cam_v4l2_dev_inst, eventHandle);
 
@@ -300,7 +1084,7 @@
 					struct v4l2_buffer *pb)
 {
 	int rc = 0, i = 0;
-	/* get the camera device */
+	
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
 		struct msm_cam_v4l2_dev_inst, eventHandle);
@@ -310,22 +1094,23 @@
 	WARN_ON(pctx != f->private_data);
 
 	mutex_lock(&pcam_inst->inst_lock);
+
 	if (!pcam_inst->buf_offset) {
-		pr_err("%s Buffer is already released. Returning.\n", __func__);
+		pr_err("%s Buffer is already released. Returning. ", __func__);
 		mutex_unlock(&pcam_inst->inst_lock);
 		return -EINVAL;
 	}
 
 	if (pb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
-		/* Reject the buffer if planes array was not allocated */
+		
 		if (pb->m.planes == NULL) {
-			pr_err("%s Planes array is null\n", __func__);
+			pr_err("%s Planes array is null ", __func__);
 			mutex_unlock(&pcam_inst->inst_lock);
 			return -EINVAL;
 		}
 		for (i = 0; i < pcam_inst->plane_info.num_planes; i++) {
 			D("%s stored offsets for plane %d as"
-				"addr offset %d, data offset %d\n",
+				"addr offset %d, data offset %d",
 				__func__, i, pb->m.planes[i].reserved[0],
 				pb->m.planes[i].data_offset);
 			pcam_inst->buf_offset[pb->index][i].data_offset =
@@ -334,7 +1119,7 @@
 				pb->m.planes[i].reserved[0];
 		}
 	} else {
-		D("%s stored reserved info %d\n", __func__, pb->reserved);
+		D("%s stored reserved info %d", __func__, pb->reserved);
 		pcam_inst->buf_offset[pb->index][0].addr_offset = pb->reserved;
 	}
 
@@ -348,50 +1133,24 @@
 static int msm_camera_v4l2_dqbuf(struct file *f, void *pctx,
 					struct v4l2_buffer *pb)
 {
-	int rc = 0, i = 0;
-	/* get the camera device */
+	int rc = 0;
+	
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
 		struct msm_cam_v4l2_dev_inst, eventHandle);
 
 	D("%s\n", __func__);
 	WARN_ON(pctx != f->private_data);
-
 	mutex_lock(&pcam_inst->inst_lock);
-	if (0 == pcam_inst->streamon) {
+	if (pcam_inst->streamon == 0) {
 		mutex_unlock(&pcam_inst->inst_lock);
 		return -EACCES;
 	}
+
 	rc = vb2_dqbuf(&pcam_inst->vid_bufq, pb,  f->f_flags & O_NONBLOCK);
-	if (rc < 0) {
-		pr_err("%s, videobuf_dqbuf returns %d\n", __func__, rc);
-		mutex_unlock(&pcam_inst->inst_lock);
-		return rc;
-	}
-
-	if (pb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
-		/* Reject the buffer if planes array was not allocated */
-		if (pb->m.planes == NULL) {
-			pr_err("%s Planes array is null\n", __func__);
-			mutex_unlock(&pcam_inst->inst_lock);
-			return -EINVAL;
-		}
-		for (i = 0; i < pcam_inst->plane_info.num_planes; i++) {
-			pb->m.planes[i].data_offset =
-				pcam_inst->buf_offset[pb->index][i].data_offset;
-			pb->m.planes[i].reserved[0] =
-				pcam_inst->buf_offset[pb->index][i].addr_offset;
-			D("%s stored offsets for plane %d as "
-				"addr offset %d, data offset %d\n",
-				__func__, i, pb->m.planes[i].reserved[0],
-				pb->m.planes[i].data_offset);
-		}
-	} else {
-		D("%s stored reserved info %d\n", __func__, pb->reserved);
-		pb->reserved = pcam_inst->buf_offset[pb->index][0].addr_offset;
-	}
-
+	D("%s, videobuf_dqbuf returns %d\n", __func__, rc);
 	mutex_unlock(&pcam_inst->inst_lock);
+
 	return rc;
 }
 
@@ -399,7 +1158,7 @@
 					enum v4l2_buf_type buf_type)
 {
 	int rc = 0;
-	/* get the camera device */
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
@@ -407,9 +1166,9 @@
 
 	D("%s Inst %p\n", __func__, pcam_inst);
 	WARN_ON(pctx != f->private_data);
-
 	mutex_lock(&pcam->vid_lock);
 	mutex_lock(&pcam_inst->inst_lock);
+
 	if ((buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) &&
 		(buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE)) {
 		pr_err("%s Invalid buffer type ", __func__);
@@ -419,11 +1178,11 @@
 	}
 
 	D("%s Calling videobuf_streamon", __func__);
-	/* if HW streaming on is successful, start buffer streaming */
+	
 	rc = vb2_streamon(&pcam_inst->vid_bufq, buf_type);
 	D("%s, videobuf_streamon returns %d\n", __func__, rc);
 
-	/* turn HW (VFE/sensor) streaming */
+	
 	pcam_inst->streamon = 1;
 	rc = msm_server_streamon(pcam, pcam_inst->my_index);
 	mutex_unlock(&pcam_inst->inst_lock);
@@ -436,7 +1195,7 @@
 					enum v4l2_buf_type buf_type)
 {
 	int rc = 0;
-	/* get the camera device */
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
@@ -451,30 +1210,27 @@
 		return -EINVAL;
 	}
 
-	/* first turn of HW (VFE/sensor) streaming so that buffers are
-		not in use when we free the buffers */
 	mutex_lock(&pcam->vid_lock);
 	mutex_lock(&pcam_inst->inst_lock);
 	pcam_inst->streamon = 0;
-	if (msm_server_get_usecount() > 0)
+	if (g_server_dev.use_count > 0)
 		rc = msm_server_streamoff(pcam, pcam_inst->my_index);
-
 	if (rc < 0)
 		pr_err("%s: hw failed to stop streaming\n", __func__);
 
-	/* stop buffer streaming */
-	vb2_streamoff(&pcam_inst->vid_bufq, buf_type);
+	
+	rc = vb2_streamoff(&pcam_inst->vid_bufq, buf_type);
 	D("%s, videobuf_streamoff returns %d\n", __func__, rc);
-
 	mutex_unlock(&pcam_inst->inst_lock);
 	mutex_unlock(&pcam->vid_lock);
+
 	return rc;
 }
 
 static int msm_camera_v4l2_enum_fmt_cap(struct file *f, void *pctx,
 					struct v4l2_fmtdesc *pfmtdesc)
 {
-	/* get the video device */
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
 	const struct msm_isp_color_fmt *isp_fmt;
 
@@ -504,7 +1260,7 @@
 		void *pctx, struct v4l2_format *pfmt)
 {
 	int rc = 0;
-	/* get the video device */
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
@@ -526,7 +1282,7 @@
 		void *pctx, struct v4l2_format *pfmt)
 {
 	int rc = 0;
-	/* get the video device */
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
@@ -544,26 +1300,23 @@
 	return rc;
 }
 
-/* This function will readjust the format parameters based in HW
-  capabilities. Called by s_fmt_cap
-*/
 static int msm_camera_v4l2_try_fmt_cap(struct file *f, void *pctx,
 					struct v4l2_format *pfmt)
 {
 	int rc = 0;
-	/* get the video device */
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
 
 	D("%s\n", __func__);
 	WARN_ON(pctx != f->private_data);
-
 	mutex_lock(&pcam->vid_lock);
+
 	rc = msm_server_try_fmt(pcam, pfmt);
 	if (rc)
 		pr_err("Format %x not found, rc = %d\n",
 				pfmt->fmt.pix.pixelformat, rc);
-
 	mutex_unlock(&pcam->vid_lock);
+
 	return rc;
 }
 
@@ -571,31 +1324,28 @@
 					struct v4l2_format *pfmt)
 {
 	int rc = 0;
-	/* get the video device */
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
 
 	D("%s\n", __func__);
 	WARN_ON(pctx != f->private_data);
-
 	mutex_lock(&pcam->vid_lock);
+
 	rc = msm_server_try_fmt_mplane(pcam, pfmt);
 	if (rc)
 		pr_err("Format %x not found, rc = %d\n",
 				pfmt->fmt.pix_mp.pixelformat, rc);
-
 	mutex_unlock(&pcam->vid_lock);
 	return rc;
 }
 
-/* This function will reconfig the v4l2 driver and HW device, it should be
-   called after the streaming is stopped.
-*/
 static int msm_camera_v4l2_s_fmt_cap(struct file *f, void *pctx,
 					struct v4l2_format *pfmt)
 {
 	int rc;
-	/* get the video device */
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
+	struct msm_cam_media_controller *pmctl;
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
 		struct msm_cam_v4l2_dev_inst, eventHandle);
@@ -606,6 +1356,16 @@
 		(void *)pfmt->fmt.pix.priv);
 	WARN_ON(pctx != f->private_data);
 
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+	if (pmctl == NULL)
+		return -EINVAL;
+
+	if (!pcam_inst->vbqueue_initialized) {
+		pmctl->mctl_vbqueue_init(pcam_inst, &pcam_inst->vid_bufq,
+					V4L2_BUF_TYPE_VIDEO_CAPTURE);
+		pcam_inst->vbqueue_initialized = 1;
+	}
+
 	mutex_lock(&pcam->vid_lock);
 
 	rc = msm_server_set_fmt(pcam, pcam_inst->my_index, pfmt);
@@ -623,6 +1383,7 @@
 {
 	int rc;
 	struct msm_cam_v4l2_device *pcam = video_drvdata(f);
+	struct msm_cam_media_controller *pmctl;
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
 			struct msm_cam_v4l2_dev_inst, eventHandle);
@@ -630,6 +1391,16 @@
 	D("%s Inst %p\n", __func__, pcam_inst);
 	WARN_ON(pctx != f->private_data);
 
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+	if (pmctl == NULL)
+		return -EINVAL;
+
+	if (!pcam_inst->vbqueue_initialized) {
+		pmctl->mctl_vbqueue_init(pcam_inst, &pcam_inst->vid_bufq,
+					V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+		pcam_inst->vbqueue_initialized = 1;
+	}
+
 	mutex_lock(&pcam->vid_lock);
 	rc = msm_server_set_fmt_mplane(pcam, pcam_inst->my_index, pfmt);
 	mutex_unlock(&pcam->vid_lock);
@@ -673,7 +1444,7 @@
 	WARN_ON(pctx != f->private_data);
 
 	mutex_lock(&pcam->vid_lock);
-	rc = msm_server_get_crop(pcam, pcam_inst->my_index, crop);
+	rc = msm_camera_get_crop(pcam, pcam_inst->my_index, crop);
 	mutex_unlock(&pcam->vid_lock);
 	return rc;
 }
@@ -689,7 +1460,6 @@
 	return rc;
 }
 
-/* Stream type-dependent parameter ioctls */
 static int msm_camera_v4l2_g_parm(struct file *f, void *pctx,
 				struct v4l2_streamparm *a)
 {
@@ -705,22 +1475,6 @@
 		return OUTPUT_TYPE_S;
 	case MSM_V4L2_EXT_CAPTURE_MODE_VIDEO:
 		return OUTPUT_TYPE_V;
-	case MSM_V4L2_EXT_CAPTURE_MODE_RDI:
-		return OUTPUT_TYPE_R;
-	case MSM_V4L2_EXT_CAPTURE_MODE_RDI1:
-		return OUTPUT_TYPE_R1;
-	case MSM_V4L2_EXT_CAPTURE_MODE_RDI2:
-		return OUTPUT_TYPE_R2;
-	case MSM_V4L2_EXT_CAPTURE_MODE_AEC:
-		return OUTPUT_TYPE_SAEC;
-	case MSM_V4L2_EXT_CAPTURE_MODE_AF:
-		return OUTPUT_TYPE_SAFC;
-	case MSM_V4L2_EXT_CAPTURE_MODE_AWB:
-		return OUTPUT_TYPE_SAWB;
-	case MSM_V4L2_EXT_CAPTURE_MODE_IHIST:
-		return OUTPUT_TYPE_IHST;
-	case MSM_V4L2_EXT_CAPTURE_MODE_CSTA:
-		return OUTPUT_TYPE_CSTA;
 	case MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT:
 	case MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW:
 	default:
@@ -732,22 +1486,13 @@
 				struct v4l2_streamparm *a)
 {
 	int rc = 0;
-	int is_bayer_sensor = 0;
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
 		struct msm_cam_v4l2_dev_inst, eventHandle);
-	pcam_inst->image_mode = (a->parm.capture.extendedmode & 0x7F);
-	SET_DEVID_MODE(pcam_inst->inst_handle, pcam_inst->pcam->vnode_id);
-	SET_IMG_MODE(pcam_inst->inst_handle, pcam_inst->image_mode);
-	SET_VIDEO_INST_IDX(pcam_inst->inst_handle, pcam_inst->my_index);
+	pcam_inst->image_mode = a->parm.capture.extendedmode;
 	pcam_inst->pcam->dev_inst_map[pcam_inst->image_mode] = pcam_inst;
 	pcam_inst->path = msm_vidbuf_get_path(pcam_inst->image_mode);
-	if (pcam_inst->pcam->sdata->sensor_type == BAYER_SENSOR)
-		is_bayer_sensor = 1;
-	rc = msm_cam_server_config_interface_map(pcam_inst->image_mode,
-			pcam_inst->pcam->mctl_handle, pcam_inst->pcam->vnode_id,
-			is_bayer_sensor);
-	D("%s path=%d, rc=%d\n", __func__,
+	pr_info("%spath=%d,rc=%d\n", __func__,
 		pcam_inst->path, rc);
 	return rc;
 }
@@ -766,7 +1511,7 @@
 		return -EINVAL;
 	if (sub->type == V4L2_EVENT_ALL)
 		sub->type = V4L2_EVENT_PRIVATE_START+MSM_CAM_APP_NOTIFY_EVENT;
-	rc = v4l2_event_subscribe(fh, sub, 100);
+	rc = v4l2_event_subscribe(fh, sub);
 	if (rc < 0)
 		D("%s: failed for evtType = 0x%x, rc = %d\n",
 						__func__, sub->type, rc);
@@ -791,71 +1536,55 @@
 	return rc;
 }
 
-static long msm_camera_v4l2_private_ioctl(struct file *file, void *fh,
-					  bool valid_prio, int cmd,
-					  void *arg)
+static int msm_server_v4l2_subscribe_event(struct v4l2_fh *fh,
+			struct v4l2_event_subscription *sub)
 {
-	int rc = -EINVAL;
-	struct msm_camera_v4l2_ioctl_t *ioctl_ptr = arg;
-	struct msm_cam_v4l2_device *pcam  = video_drvdata(file);
-	D("%s: cmd %d\n", __func__, _IOC_NR(cmd));
+	int rc = 0;
 
-	switch (cmd) {
-	case MSM_CAM_V4L2_IOCTL_PRIVATE_S_CTRL:
-		rc = msm_camera_v4l2_private_s_ctrl(file, fh, ioctl_ptr);
-		break;
-	case MSM_CAM_V4L2_IOCTL_PRIVATE_G_CTRL:
-		rc = msm_camera_v4l2_private_g_ctrl(file, fh, ioctl_ptr);
-		break;
-	case MSM_CAM_V4L2_IOCTL_PRIVATE_GENERAL:
-		rc = msm_camera_v4l2_private_general(file, fh, ioctl_ptr);
-		break;
-	case MSM_CAM_V4L2_IOCTL_GET_EVENT_PAYLOAD: {
-		struct msm_queue_cmd *event_cmd;
-		void *payload;
-		mutex_lock(&pcam->event_lock);
-		event_cmd = msm_dequeue(&pcam->eventData_q, list_eventdata);
-		if (!event_cmd) {
-			pr_err("%s: No event payload\n", __func__);
-			rc = -EINVAL;
-			mutex_unlock(&pcam->event_lock);
+	D("%s: fh = 0x%x, type = 0x%x", __func__, (u32)fh, sub->type);
+	if (sub->type == V4L2_EVENT_ALL) {
+		
+		sub->type = V4L2_EVENT_PRIVATE_START + MSM_CAM_RESP_CTRL;
+		D("sub->type start = 0x%x\n", sub->type);
+		do {
+			rc = v4l2_event_subscribe(fh, sub);
+			if (rc < 0) {
+				D("%s: failed for evtType = 0x%x, rc = %d\n",
+						__func__, sub->type, rc);
+			
+			sub->type = V4L2_EVENT_ALL;
+			v4l2_event_unsubscribe(fh, sub);
 			return rc;
-		}
-		payload = event_cmd->command;
-		if (event_cmd->trans_code != ioctl_ptr->trans_code) {
-			pr_err("%s: Events don't match\n", __func__);
-			kfree(payload);
-			kfree(event_cmd);
-			rc = -EINVAL;
-			mutex_unlock(&pcam->event_lock);
-			break;
-		}
-		if (ioctl_ptr->len > 0) {
-			if (copy_to_user(ioctl_ptr->ioctl_ptr, payload,
-				 ioctl_ptr->len)) {
-				pr_err("%s Copy to user failed for cmd %d",
-					__func__, cmd);
-				kfree(payload);
-				kfree(event_cmd);
-				rc = -EINVAL;
-				mutex_unlock(&pcam->event_lock);
-				break;
-			}
-		}
-		kfree(payload);
-		kfree(event_cmd);
-		mutex_unlock(&pcam->event_lock);
-		rc = 0;
-		break;
+			} else
+				D("%s: subscribed evtType = 0x%x, rc = %d\n",
+						__func__, sub->type, rc);
+			sub->type++;
+			D("sub->type while = 0x%x\n", sub->type);
+		} while (sub->type !=
+			V4L2_EVENT_PRIVATE_START + MSM_SVR_RESP_MAX);
+	} else {
+		D("sub->type not V4L2_EVENT_ALL = 0x%x\n", sub->type);
+		rc = v4l2_event_subscribe(fh, sub);
+		if (rc < 0)
+			D("%s: failed for evtType = 0x%x, rc = %d\n",
+						__func__, sub->type, rc);
 	}
-	default:
-		pr_err("%s Unsupported ioctl cmd %d ", __func__, cmd);
-		break;
-	}
+
+	D("%s: rc = %d\n", __func__, rc);
 	return rc;
 }
 
-/* v4l2_ioctl_ops */
+static int msm_server_v4l2_unsubscribe_event(struct v4l2_fh *fh,
+			struct v4l2_event_subscription *sub)
+{
+	int rc = 0;
+
+	D("%s: fh = 0x%x\n", __func__, (u32)fh);
+	rc = v4l2_event_unsubscribe(fh, sub);
+	D("%s: rc = %d\n", __func__, rc);
+	return rc;
+}
+
 static const struct v4l2_ioctl_ops g_msm_ioctl_ops = {
 	.vidioc_querycap = msm_camera_v4l2_querycap,
 
@@ -874,7 +1603,7 @@
 	.vidioc_streamon = msm_camera_v4l2_streamon,
 	.vidioc_streamoff = msm_camera_v4l2_streamoff,
 
-	/* format ioctls */
+	
 	.vidioc_enum_fmt_vid_cap = msm_camera_v4l2_enum_fmt_cap,
 	.vidioc_enum_fmt_vid_cap_mplane = msm_camera_v4l2_enum_fmt_cap,
 	.vidioc_try_fmt_vid_cap = msm_camera_v4l2_try_fmt_cap,
@@ -887,36 +1616,235 @@
 	.vidioc_g_jpegcomp = msm_camera_v4l2_g_jpegcomp,
 	.vidioc_s_jpegcomp = msm_camera_v4l2_s_jpegcomp,
 
-	/* Stream type-dependent parameter ioctls */
+	
 	.vidioc_g_parm =  msm_camera_v4l2_g_parm,
 	.vidioc_s_parm =  msm_camera_v4l2_s_parm,
 
-	/* event subscribe/unsubscribe */
+	
 	.vidioc_subscribe_event = msm_camera_v4l2_subscribe_event,
 	.vidioc_unsubscribe_event = msm_camera_v4l2_unsubscribe_event,
-	.vidioc_default = msm_camera_v4l2_private_ioctl,
 };
 
-/* v4l2_file_operations */
+static int msm_cam_server_open_session(struct msm_cam_server_dev *ps,
+	struct msm_cam_v4l2_device *pcam)
+{
+	int rc = 0;
+	struct msm_cam_media_controller *pmctl;
+	D("%s\n", __func__);
+
+	if (!ps || !pcam) {
+		pr_err("%s NULL pointer passed in!\n", __func__);
+		return rc;
+	}
+
+	if (atomic_read(&ps->number_pcam_active) > 0) {
+		pr_err("%s Cannot have more than one active camera %d\n",
+			__func__, atomic_read(&ps->number_pcam_active));
+		return -EINVAL;
+	}
+	
+	ps->pcam_active = pcam;
+	atomic_inc(&ps->number_pcam_active);
+
+	D("config pcam = 0x%p\n", ps->pcam_active);
+
+	
+	msm_mctl_init(pcam);
+
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+	if(!pmctl) return -EINVAL;
+	pmctl->axi_sdev = ps->axi_device[0];
+	pmctl->isp_sdev = ps->isp_subdev[0];
+
+#ifdef CONFIG_PERFLOCK
+	pmctl->cam_perf_lock = &ps->cam_perf_lock;
+#endif
+
+	return rc;
+
+}
+
+static int msm_cam_server_close_session(struct msm_cam_server_dev *ps,
+	struct msm_cam_v4l2_device *pcam)
+{
+	int rc = 0;
+	D("%s\n", __func__);
+
+	if (!ps || !pcam) {
+		D("%s NULL pointer passed in!\n", __func__);
+		return rc;
+	}
+
+
+	atomic_dec(&ps->number_pcam_active);
+	ps->pcam_active = NULL;
+	msm_mctl_free(pcam);
+
+	return rc;
+}
+
+
+int msm_server_open_client(int *p_qidx)
+{
+	int rc = 0;
+	int server_q_idx = 0;
+	struct msm_cam_server_queue *queue = NULL;
+
+	mutex_lock(&g_server_dev.server_lock);
+	server_q_idx = msm_find_free_queue();
+	if (server_q_idx < 0) {
+		mutex_unlock(&g_server_dev.server_lock);
+		return server_q_idx;
+	}
+
+	*p_qidx = server_q_idx;
+	queue = &g_server_dev.server_queue[server_q_idx];
+	queue->ctrl_data = kzalloc(sizeof(uint8_t) *
+		max_control_command_size, GFP_KERNEL);
+	msm_queue_init(&queue->ctrl_q, "control");
+	msm_queue_init(&queue->eventData_q, "eventdata");
+	queue->queue_active = 1;
+	mutex_unlock(&g_server_dev.server_lock);
+	return rc;
+}
+
+int msm_server_send_ctrl(struct msm_ctrl_cmd *out,
+	int ctrl_id)
+{
+	int rc = 0;
+	void *value;
+	struct msm_queue_cmd *rcmd;
+	struct msm_queue_cmd *event_qcmd;
+	struct msm_ctrl_cmd *ctrlcmd;
+	struct msm_cam_server_dev *server_dev = &g_server_dev;
+	struct msm_device_queue *queue =
+		&server_dev->server_queue[out->queue_idx].ctrl_q;
+
+	struct v4l2_event v4l2_evt;
+	struct msm_isp_event_ctrl *isp_event;
+	isp_event = kzalloc(sizeof(struct msm_isp_event_ctrl), GFP_KERNEL);
+	if (!isp_event) {
+		pr_err("%s Insufficient memory. return", __func__);
+		return -ENOMEM;
+	}
+	event_qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
+	if (!event_qcmd) {
+		pr_err("%s Insufficient memory. return", __func__);
+		kfree(isp_event);
+		return -ENOMEM;
+	}
+
+	D("%s\n", __func__);
+	mutex_lock(&server_dev->server_queue_lock);
+	if (++server_dev->server_evt_id == 0)
+		server_dev->server_evt_id++;
+
+	D("%s qid %d evtid %d\n", __func__, out->queue_idx,
+		server_dev->server_evt_id);
+	server_dev->server_queue[out->queue_idx].evt_id =
+		server_dev->server_evt_id;
+	v4l2_evt.type = V4L2_EVENT_PRIVATE_START + ctrl_id;
+	v4l2_evt.u.data[0] = out->queue_idx;
+	
+	isp_event->resptype = MSM_CAM_RESP_V4L2;
+	isp_event->isp_data.ctrl = *out;
+	isp_event->isp_data.ctrl.evt_id = server_dev->server_evt_id;
+
+	atomic_set(&event_qcmd->on_heap, 1);
+	event_qcmd->command = isp_event;
+
+	msm_enqueue(&server_dev->server_queue[out->queue_idx].eventData_q,
+				&event_qcmd->list_eventdata);
+
+	v4l2_event_queue(server_dev->server_command_queue.pvdev,
+					  &v4l2_evt);
+	D("%s v4l2_event_queue: type = 0x%x\n", __func__, v4l2_evt.type);
+	mutex_unlock(&server_dev->server_queue_lock);
+
+	
+	D("Waiting for config status\n");
+	rc = wait_event_interruptible_timeout(queue->wait,
+		!list_empty_careful(&queue->list),
+		msecs_to_jiffies(out->timeout_ms));
+	D("Waiting is over for config status\n");
+	if (list_empty_careful(&queue->list)) {
+		if (!rc)
+			rc = -ETIMEDOUT;
+		if (rc < 0) {
+			kfree(isp_event);
+			pr_err("%s: wait_event error %d\n", __func__, rc);
+			return rc;
+		}
+	}
+
+	rcmd = msm_dequeue(queue, list_control);
+	BUG_ON(!rcmd);
+	if(!rcmd) return -EINVAL;
+	D("%s Finished servicing ioctl\n", __func__);
+
+	ctrlcmd = (struct msm_ctrl_cmd *)(rcmd->command);
+	value = out->value;
+	if (ctrlcmd->length > 0)
+		memcpy(value, ctrlcmd->value, ctrlcmd->length);
+
+	memcpy(out, ctrlcmd, sizeof(struct msm_ctrl_cmd));
+	out->value = value;
+
+	kfree(ctrlcmd);
+
+	free_qcmd(rcmd);
+	kfree(isp_event);
+	D("%s: rc %d\n", __func__, rc);
+	
+	if (rc >= 0) {
+		
+		if (out->status == 0)
+			rc = -1;
+		else if (out->status == 1 || out->status == 4)
+			rc = 0;
+		else
+			rc = -EINVAL;
+	}
+	return rc;
+}
+
+int msm_server_close_client(int idx)
+{
+	int rc = 0;
+	struct msm_cam_server_queue *queue = NULL;
+	mutex_lock(&g_server_dev.server_lock);
+	queue = &g_server_dev.server_queue[idx];
+	queue->queue_active = 0;
+	kfree(queue->ctrl_data);
+	queue->ctrl_data = NULL;
+	msm_queue_drain(&queue->ctrl_q, list_control);
+	msm_drain_eventq(&queue->eventData_q);
+	mutex_unlock(&g_server_dev.server_lock);
+	return rc;
+}
+
 static int msm_open(struct file *f)
 {
-	int i, rc = -EINVAL;
+	int i;
+	int rc = -EINVAL;
 #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
 	int ion_client_created = 0;
 #endif
 	int server_q_idx = 0;
-	/* get the video device */
+
+	
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	struct msm_cam_media_controller *pmctl = NULL;
-
+	struct msm_cam_server_queue *queue = NULL;
 	D("%s\n", __func__);
 
 	if (!pcam) {
 		pr_err("%s NULL pointer passed in!\n", __func__);
 		return rc;
 	}
-	if (!msm_server_get_usecount()) {
+	if (!g_server_dev.use_count) {
 		pr_err("%s: error, daemon not yet started.", __func__);
 		return -EINVAL;
 	}
@@ -926,7 +1854,11 @@
 			break;
 	}
 
-	/* if no instance is available, return error */
+	server_q_idx = msm_find_free_queue();
+	if (server_q_idx < 0)
+		return server_q_idx;
+
+	
 	if (i == MSM_DEV_INST_MAX) {
 		mutex_unlock(&pcam->vid_lock);
 		return rc;
@@ -946,54 +1878,79 @@
 			pcam_inst->my_index,
 			pcam->vnode_id, pcam->use_count);
 	pcam->use_count++;
-	D("%s Inst %p use_count %d\n", __func__, pcam_inst, pcam->use_count);
+	D("%s use_count %d\n", __func__, pcam->use_count);
 	if (pcam->use_count == 1) {
-		server_q_idx = msm_find_free_queue();
-		if (server_q_idx < 0) {
-			pr_err("%s No free queue available ", __func__);
-			goto msm_cam_server_begin_session_failed;
+		int ges_evt = MSM_V4L2_GES_CAM_OPEN;
+
+		pr_info("%s use_count %d\n", __func__, pcam->use_count); 
+
+		
+		if (atomic_read(&g_server_dev.number_pcam_active) > 0) {
+			pr_err("%s: Cannot have more than one active camera\n", __func__);
+			rc = -EINVAL;
+			goto more_than_one_active_cam_error;
 		}
-		rc = msm_server_begin_session(pcam, server_q_idx);
+		
+		pcam->server_queue_idx = server_q_idx;
+		queue = &g_server_dev.server_queue[server_q_idx];
+		queue->ctrl_data = kzalloc(sizeof(uint8_t) *
+			max_control_command_size, GFP_KERNEL);
+		msm_queue_init(&queue->ctrl_q, "control");
+		msm_queue_init(&queue->eventData_q, "eventdata");
+		queue->queue_active = 1;
+
+		msm_cam_server_subdev_notify(g_server_dev.gesture_device,
+			NOTIFY_GESTURE_CAM_EVT, &ges_evt);
+
+
+		rc = msm_cam_server_open_session(&g_server_dev, pcam);
 		if (rc < 0) {
-			pr_err("%s error starting server session ", __func__);
-			goto msm_cam_server_begin_session_failed;
+			pr_err("%s: cam_server_open_session failed %d\n",
+			__func__, rc);
+			goto msm_cam_server_open_session_failed;
 		}
-		pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-		if (!pmctl) {
-			pr_err("%s mctl ptr is null ", __func__);
-			goto msm_cam_server_get_mctl_failed;
+
+		pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+		if (!pmctl)  {
+			rc = -EINVAL;
+			goto msm_cam_server_open_session_failed;
 		}
+
 #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-		if (!pmctl->client) {
-			pmctl->client = msm_ion_client_create(-1, "camera");
-			kref_init(&pmctl->refcount);
+		{
+			char ion_debug_name[64];
+			snprintf(ion_debug_name, 64, "%u", task_pid_nr(current->group_leader));
+			pmctl->client = msm_ion_client_create(-1, ion_debug_name);
 		}
+		kref_init(&pmctl->refcount);
 		ion_client_created = 1;
 #endif
-
-		/* Should be set to sensor ops if any but right now its OK!! */
+		
 		if (!pmctl->mctl_open) {
 			D("%s: media contoller is not inited\n", __func__);
 			rc = -ENODEV;
 			goto mctl_open_failed;
 		}
 
-		/* Now we really have to activate the camera */
+		
 		D("%s: call mctl_open\n", __func__);
 		rc = pmctl->mctl_open(pmctl, MSM_APPS_ID_V4L2);
+
 		if (rc < 0) {
 			pr_err("%s: HW open failed rc = 0x%x\n",  __func__, rc);
 			goto mctl_open_failed;
 		}
 		pmctl->pcam_ptr = pcam;
 
-		msm_setup_v4l2_event_queue(&pcam_inst->eventHandle,
+		rc = msm_setup_v4l2_event_queue(&pcam_inst->eventHandle,
 			pcam->pvdev);
-		mutex_init(&pcam->event_lock);
-		msm_queue_init(&pcam->eventData_q, "eventData");
+		if (rc < 0) {
+			pr_err("%s: msm_setup_v4l2_event_queue failed %d",
+				__func__, rc);
+			goto mctl_event_q_setup_failed;
+		}
 	}
 	pcam_inst->vbqueue_initialized = 0;
-	pcam_inst->sequence = 0;
 	rc = 0;
 
 	f->private_data = &pcam_inst->eventHandle;
@@ -1001,6 +1958,7 @@
 	D("f->private_data = 0x%x, pcam = 0x%x\n",
 		(u32)f->private_data, (u32)pcam_inst);
 
+
 	if (pcam->use_count == 1) {
 		rc = msm_send_open_server(pcam);
 		if (rc < 0 && rc != -ERESTARTSYS) {
@@ -1012,39 +1970,125 @@
 	mutex_unlock(&pcam->vid_lock);
 	D("%s: end\n", __func__);
 	return rc;
-
+	
 msm_send_open_server_failed:
-	msm_drain_eventq(&pcam->eventData_q);
-	msm_destroy_v4l2_event_queue(&pcam_inst->eventHandle);
-
-	if (pmctl->mctl_release) {
-		pmctl->mctl_release(pmctl);
-		pmctl->mctl_release = NULL;
-	}
+	v4l2_fh_del(&pcam_inst->eventHandle);
+	v4l2_fh_exit(&pcam_inst->eventHandle);
+mctl_event_q_setup_failed:
+	if (pmctl->mctl_release)
+		if (pmctl->mctl_release(pmctl) < 0)
+			pr_err("%s: mctl_release failed\n", __func__);
 mctl_open_failed:
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	if (ion_client_created) {
-		D("%s: destroy ion client", __func__);
-		kref_put(&pmctl->refcount, msm_release_ion_client);
-	}
-#endif
-msm_cam_server_get_mctl_failed:
-	if (msm_server_end_session(pcam) < 0)
-		pr_err("%s: msm_server_end_session failed\n",
-			__func__);
-msm_cam_server_begin_session_failed:
+
 	if (pcam->use_count == 1) {
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+		if (ion_client_created) {
+			D("%s: destroy ion client", __func__);
+			kref_put(&pmctl->refcount, msm_release_ion_client);
+		}
+#endif
+		if (msm_cam_server_close_session(&g_server_dev, pcam) < 0)
+			pr_err("%s: msm_cam_server_close_session failed\n",
+				__func__);
+	}
+msm_cam_server_open_session_failed:
+	if (pcam->use_count == 1) {
+		if (queue) {
+			queue->queue_active = 0;
+			msm_drain_eventq(&queue->eventData_q);
+			kfree(queue->ctrl_data);
+			queue->ctrl_data = NULL;
+			msm_queue_drain(&queue->ctrl_q, list_control);
+			msm_drain_eventq(&queue->eventData_q);
+			queue = NULL;
+		}
+
 		pcam->dev_inst[i] = NULL;
 		pcam->use_count = 0;
 	}
+more_than_one_active_cam_error:
 	pcam->dev_inst[i] = NULL;
 	mutex_unlock(&pcam->vid_lock);
-	mutex_destroy(&pcam_inst->inst_lock);
 	kfree(pcam_inst);
 	pr_err("%s: error end", __func__);
 	return rc;
 }
 
+int msm_cam_server_close_mctl_session(struct msm_cam_v4l2_device *pcam)
+{
+	int rc = 0;
+	struct msm_cam_media_controller *pmctl = NULL;
+
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+	if (!pmctl) {
+		D("%s: invalid handle\n", __func__);
+		return -ENODEV;
+	}
+
+	if (pmctl->mctl_release) {
+		rc = pmctl->mctl_release(pmctl);
+		if (rc < 0)
+			pr_err("mctl_release fails %d\n", rc);
+	}
+
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+	kref_put(&pmctl->refcount, msm_release_ion_client);
+#endif
+
+	rc = msm_cam_server_close_session(&g_server_dev, pcam);
+	if (rc < 0)
+		pr_err("msm_cam_server_close_session fails %d\n", rc);
+
+	return rc;
+}
+
+int msm_cam_server_open_mctl_session(struct msm_cam_v4l2_device *pcam,
+	int *p_active)
+{
+	int rc = 0;
+	struct msm_cam_media_controller *pmctl = NULL;
+	pr_info("%s: %p", __func__, g_server_dev.pcam_active);
+	*p_active = 0;
+	if (g_server_dev.pcam_active) {
+		pr_info("%s: Active camera present return", __func__);
+		return 0;
+	}
+	rc = msm_cam_server_open_session(&g_server_dev, pcam);
+	if (rc < 0) {
+		pr_err("%s: cam_server_open_session failed %d\n",
+		__func__, rc);
+		return rc;
+	}
+
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+	
+	if (!pmctl) {
+		pr_err("%s: pmctl is NULL\n",
+			 __func__);
+		rc = -ENODEV;
+		return rc;
+	}
+	
+	
+	if (!pmctl->mctl_open) {
+		D("%s: media contoller is not inited\n",
+			 __func__);
+		rc = -ENODEV;
+		return rc;
+	}
+
+	D("%s: call mctl_open\n", __func__);
+	rc = pmctl->mctl_open(pmctl, MSM_APPS_ID_V4L2);
+
+	if (rc < 0) {
+		pr_err("%s: HW open failed rc = 0x%x\n",  __func__, rc);
+		return rc;
+	}
+	pmctl->pcam_ptr = pcam;
+	*p_active = 1;	
+	return rc;
+}
+
 static int msm_addr_remap(struct msm_cam_v4l2_dev_inst *pcam_inst,
 				struct vm_area_struct *vma)
 {
@@ -1054,7 +2098,7 @@
 	int rc = 0;
 	struct msm_cam_media_controller *mctl;
 
-	mctl = msm_cam_server_get_mctl(pcam_inst->pcam->mctl_handle);
+	mctl = msm_camera_get_mctl(pcam_inst->pcam->mctl_handle);
 	if (!mctl) {
 		pr_err("%s: invalid mctl pointer", __func__);
 		return -EFAULT;
@@ -1113,16 +2157,18 @@
 {
 	struct msm_cam_media_controller *mctl = container_of(ref,
 		struct msm_cam_media_controller, refcount);
-	pr_err("%s Calling ion_client_destroy\n", __func__);
-	ion_client_destroy(mctl->client);
-	mctl->client = NULL;
+	pr_info("%s Calling ion_client_destroy\n", __func__);
+
+	if (mctl)
+		ion_client_destroy(mctl->client);
 }
 
 static int msm_close(struct file *f)
 {
-	int rc = 0;
+	int rc = 0,i=0;
 	struct msm_cam_v4l2_device *pcam;
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
+	struct msm_cam_server_queue *queue;
 	struct msm_cam_media_controller *pmctl;
 	pcam_inst = container_of(f->private_data,
 		struct msm_cam_v4l2_dev_inst, eventHandle);
@@ -1132,66 +2178,96 @@
 		return -EINVAL;
 	}
 
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
 	if (!pmctl) {
 		pr_err("%s NULL mctl pointer\n", __func__);
 		return -EINVAL;
 	}
 
+
 	mutex_lock(&pcam->vid_lock);
 	mutex_lock(&pcam_inst->inst_lock);
 
 	if (pcam_inst->streamon) {
-		/*something went wrong since instance
-		is closing without streamoff*/
-		if (pmctl->mctl_release)
-			pmctl->mctl_release(pmctl);
-		pmctl->mctl_release = NULL;/*so that it isn't closed again*/
+		if (pmctl->mctl_release) {
+			rc = pmctl->mctl_release(pmctl);
+			if (rc < 0)
+				pr_err("mctl_release fails %d\n", rc);
+		}
+		pmctl->mctl_release = NULL;
+		
+		msm_cam_stop_hardware(pcam);
 	}
 
 	pcam_inst->streamon = 0;
 	pcam->use_count--;
 	pcam->dev_inst_map[pcam_inst->image_mode] = NULL;
+
+	
+	pr_info("%s Inst %p freeing buffer offsets array",__func__, pcam_inst);
+	if (pcam_inst->buf_offset) {
+		for (i = 0 ; i < pcam_inst->buf_count ; i++)
+			kfree(pcam_inst->buf_offset[i]);
+		kfree(pcam_inst->buf_offset);
+		pcam_inst->buf_offset = NULL;
+	}
+	
 	if (pcam_inst->vbqueue_initialized)
 		vb2_queue_release(&pcam_inst->vid_bufq);
-	D("%s Closing down instance %p ", __func__, pcam_inst);
+	pr_info("%s Closing down instance %p, [%d, %d]", __func__, pcam_inst, pcam->use_count , g_server_dev.use_count);
 	D("%s index %d nodeid %d count %d\n", __func__, pcam_inst->my_index,
-		pcam->vnode_id, pcam->use_count);
+	pcam->vnode_id, pcam->use_count);
+
 	pcam->dev_inst[pcam_inst->my_index] = NULL;
 	if (pcam_inst->my_index == 0) {
-		mutex_lock(&pcam->event_lock);
-		msm_drain_eventq(&pcam->eventData_q);
-		mutex_unlock(&pcam->event_lock);
-		mutex_destroy(&pcam->event_lock);
-		msm_destroy_v4l2_event_queue(&pcam_inst->eventHandle);
+		v4l2_fh_del(&pcam_inst->eventHandle);
+		v4l2_fh_exit(&pcam_inst->eventHandle);
 	}
-
-	CLR_VIDEO_INST_IDX(pcam_inst->inst_handle);
-	CLR_IMG_MODE(pcam_inst->inst_handle);
-	CLR_DEVID_MODE(pcam_inst->inst_handle);
 	mutex_unlock(&pcam_inst->inst_lock);
 	mutex_destroy(&pcam_inst->inst_lock);
 	kfree(pcam_inst);
 	f->private_data = NULL;
 
 	if (pcam->use_count == 0) {
-		if (msm_server_get_usecount() > 0) {
+		int ges_evt = MSM_V4L2_GES_CAM_CLOSE;
+		
+		struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(pmctl->sensor_sdev);
+		if(s_ctrl && s_ctrl->sensor_first_mutex)  {
+			mutex_lock(s_ctrl->sensor_first_mutex);
+			mutex_unlock(s_ctrl->sensor_first_mutex);
+		}
+
+		if (g_server_dev.use_count > 0) {
 			rc = msm_send_close_server(pcam);
 			if (rc < 0)
 				pr_err("msm_send_close_server failed %d\n", rc);
 		}
-
 		if (pmctl->mctl_release) {
-			pmctl->mctl_release(pmctl);
-			pmctl->mctl_release = NULL;
+			rc = pmctl->mctl_release(pmctl);
+			if (rc < 0)
+				pr_err("mctl_release fails %d\n", rc);
 		}
-
 #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
 		kref_put(&pmctl->refcount, msm_release_ion_client);
 #endif
-		rc = msm_server_end_session(pcam);
+		mutex_lock(&g_server_dev.server_queue_lock);
+		queue = &g_server_dev.server_queue[pcam->server_queue_idx];
+		if (queue) {
+			queue->queue_active = 0;
+			if(queue->ctrl_data)  kfree(queue->ctrl_data);
+			queue->ctrl_data = NULL;
+			msm_queue_drain(&queue->ctrl_q, list_control);
+			msm_drain_eventq(&queue->eventData_q);
+			
+		}
+		mutex_unlock(&g_server_dev.server_queue_lock);
+
+		rc = msm_cam_server_close_session(&g_server_dev, pcam);
 		if (rc < 0)
-			pr_err("msm_server_end_session fails %d\n", rc);
+			pr_err("msm_cam_server_close_session fails %d\n", rc);
+
+		msm_cam_server_subdev_notify(g_server_dev.gesture_device,
+			NOTIFY_GESTURE_CAM_EVT, &ges_evt);
 	}
 	mutex_unlock(&pcam->vid_lock);
 	return rc;
@@ -1211,7 +2287,7 @@
 		return -EINVAL;
 	}
 	if (pcam_inst->my_index == 0) {
-		poll_wait(f, &(pcam_inst->eventHandle.wait), wait);
+		poll_wait(f, &(pcam_inst->eventHandle.events->wait), wait);
 		if (v4l2_event_pending(&pcam_inst->eventHandle))
 			rc |= POLLPRI;
 	} else {
@@ -1226,71 +2302,589 @@
 	return rc;
 }
 
-long msm_v4l2_evt_notify(struct msm_cam_media_controller *mctl,
-	unsigned int cmd, unsigned long evt)
+static unsigned int msm_poll_server(struct file *fp,
+					struct poll_table_struct *wait)
+{
+	int rc = 0;
+
+	D("%s\n", __func__);
+	poll_wait(fp,
+		 &g_server_dev.server_command_queue.eventHandle.events->wait,
+		 wait);
+	if (v4l2_event_pending(&g_server_dev.server_command_queue.eventHandle))
+		rc |= POLLPRI;
+
+	return rc;
+}
+static long msm_ioctl_server(struct file *file, void *fh,
+		bool valid_prio, int cmd, void *arg)
+{
+	int rc = -EINVAL;
+	struct msm_camera_v4l2_ioctl_t *ioctl_ptr = arg;
+	struct msm_camera_info temp_cam_info;
+	struct msm_cam_config_dev_info temp_config_info;
+	struct msm_mctl_node_info temp_mctl_info;
+	int i;
+
+	D("%s: cmd %d\n", __func__, _IOC_NR(cmd));
+
+	switch (cmd) {
+	case MSM_CAM_V4L2_IOCTL_GET_CAMERA_INFO:
+		if (copy_from_user(&temp_cam_info,
+			(void __user *)ioctl_ptr->ioctl_ptr,
+			sizeof(struct msm_camera_info))) {
+			rc = -EINVAL;
+			return rc;
+		}
+		for (i = 0; i < g_server_dev.camera_info.num_cameras; i++) {
+			if (copy_to_user((void __user *)
+				temp_cam_info.video_dev_name[i],
+				g_server_dev.camera_info.video_dev_name[i],
+				strnlen(
+				g_server_dev.camera_info.video_dev_name[i],
+				MAX_DEV_NAME_LEN))) {
+				rc = -EINVAL;
+				return rc;
+			}
+			temp_cam_info.has_3d_support[i] =
+				g_server_dev.camera_info.has_3d_support[i];
+			temp_cam_info.is_internal_cam[i] =
+				g_server_dev.camera_info.is_internal_cam[i];
+			temp_cam_info.s_mount_angle[i] =
+				g_server_dev.camera_info.s_mount_angle[i];
+			temp_cam_info.sensor_type[i] =
+				g_server_dev.camera_info.sensor_type[i];
+
+		}
+		temp_cam_info.num_cameras =
+			g_server_dev.camera_info.num_cameras;
+		if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
+				&temp_cam_info,
+				sizeof(struct msm_camera_info))) {
+					rc = -EINVAL;
+					return rc;
+		}
+		rc = 0;
+		break;
+
+	case MSM_CAM_V4L2_IOCTL_GET_CONFIG_INFO:
+		if (copy_from_user(&temp_config_info,
+				(void __user *)ioctl_ptr->ioctl_ptr,
+				sizeof(struct msm_cam_config_dev_info))) {
+			rc = -EINVAL;
+			return rc;
+		}
+		for (i = 0;
+		 i < g_server_dev.config_info.num_config_nodes; i++) {
+			if (copy_to_user(
+			(void __user *)temp_config_info.config_dev_name[i],
+			g_server_dev.config_info.config_dev_name[i],
+			strlen(g_server_dev.config_info.config_dev_name[i]))) {
+				rc = -EINVAL;
+				return rc;
+			}
+		}
+		temp_config_info.num_config_nodes =
+			g_server_dev.config_info.num_config_nodes;
+		if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
+							  &temp_config_info,
+				sizeof(struct msm_cam_config_dev_info))) {
+			rc = -EINVAL;
+			return rc;
+		}
+		rc = 0;
+		break;
+	case MSM_CAM_V4L2_IOCTL_GET_MCTL_INFO:
+		if (copy_from_user(&temp_mctl_info,
+				(void __user *)ioctl_ptr->ioctl_ptr,
+				sizeof(struct msm_mctl_node_info))) {
+			rc = -EINVAL;
+			return rc;
+		}
+
+		for (i = 0; i < g_server_dev.mctl_node_info.num_mctl_nodes;
+				i++) {
+			if (copy_to_user((void __user *)
+			temp_mctl_info.mctl_node_name[i],
+			g_server_dev.mctl_node_info.mctl_node_name[i], strnlen(
+			g_server_dev.mctl_node_info.mctl_node_name[i],
+			MAX_DEV_NAME_LEN))) {
+				rc = -EINVAL;
+				return rc;
+			}
+		}
+		temp_mctl_info.num_mctl_nodes =
+			g_server_dev.mctl_node_info.num_mctl_nodes;
+		if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
+							  &temp_mctl_info,
+				sizeof(struct msm_mctl_node_info))) {
+			rc = -EINVAL;
+			return rc;
+		}
+		rc = 0;
+	break;
+
+	case MSM_CAM_V4L2_IOCTL_CTRL_CMD_DONE:
+		D("%s: MSM_CAM_IOCTL_CTRL_CMD_DONE\n", __func__);
+		rc = msm_ctrl_cmd_done(arg);
+		break;
+
+	case MSM_CAM_V4L2_IOCTL_GET_EVENT_PAYLOAD: {
+		struct msm_queue_cmd *event_cmd;
+		struct msm_isp_event_ctrl u_isp_event;
+		struct msm_isp_event_ctrl *k_isp_event;
+
+		struct msm_device_queue *queue;
+		void __user *u_ctrl_value = NULL;
+		if (copy_from_user(&u_isp_event,
+			(void __user *)ioctl_ptr->ioctl_ptr,
+			sizeof(struct msm_isp_event_ctrl))) {
+			rc = -EINVAL;
+			return rc;
+
+		}
+		mutex_lock(&g_server_dev.server_queue_lock);
+		if (!g_server_dev.server_queue
+			[u_isp_event.isp_data.ctrl.queue_idx].queue_active) {
+			pr_err("%s: Invalid queue\n", __func__);
+			mutex_unlock(&g_server_dev.server_queue_lock);
+			rc = -EINVAL;
+			return rc;
+		}		
+		queue = &g_server_dev.server_queue
+			[u_isp_event.isp_data.ctrl.queue_idx].eventData_q;
+		event_cmd = msm_dequeue(queue, list_eventdata);
+		if (!event_cmd) {
+			pr_err("%s: No event payload\n", __func__);
+			rc = -EINVAL;
+			mutex_unlock(&g_server_dev.server_queue_lock);
+			return rc;
+
+		}
+		k_isp_event = (struct msm_isp_event_ctrl *)
+				event_cmd->command;
+		free_qcmd(event_cmd);
+
+		
+		u_ctrl_value = u_isp_event.isp_data.ctrl.value;
+
+		
+		u_isp_event = *k_isp_event;
+
+		u_isp_event.isp_data.ctrl.value = u_ctrl_value;
+
+		
+		if (k_isp_event->isp_data.ctrl.length > 0 &&
+			k_isp_event->isp_data.ctrl.value != NULL) {
+			void *k_ctrl_value =
+				k_isp_event->isp_data.ctrl.value;
+			if (copy_to_user(u_ctrl_value, k_ctrl_value,
+				 k_isp_event->isp_data.ctrl.length)) {
+				kfree(k_isp_event->isp_data.ctrl.value);
+				kfree(k_isp_event);
+				rc = -EINVAL;
+				mutex_unlock(&g_server_dev.server_queue_lock);
+				break;
+			}
+			kfree(k_isp_event->isp_data.ctrl.value);
+		}
+
+		if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
+							  &u_isp_event,
+				sizeof(struct msm_isp_event_ctrl))) {
+			kfree(k_isp_event);
+			rc = -EINVAL;
+			mutex_unlock(&g_server_dev.server_queue_lock);
+			return rc;
+		}
+		kfree(k_isp_event);
+		mutex_unlock(&g_server_dev.server_queue_lock);
+	
+		rc = 0;
+		break;
+	}
+	
+	case MSM_CAM_IOCTL_SEND_EVENT:
+		rc = msm_server_send_v4l2_evt(arg);
+		break;
+
+	default:
+	
+		pr_err("%s: Invalid IOCTL = %d", __func__, cmd);
+		break;
+	}
+	return rc;
+}
+static long msm_server_send_v4l2_evt(void *evt)
+{
+	struct v4l2_event *v4l2_ev = (struct v4l2_event *)evt;
+	int rc = 0;
+
+	if (NULL == evt) {
+		pr_err("%s: evt is NULL\n", __func__);
+		return -EINVAL;
+	}
+
+	D("%s: evt type 0x%x\n", __func__, v4l2_ev->type);
+	if ((v4l2_ev->type >= MSM_GES_APP_EVT_MIN) &&
+		(v4l2_ev->type < MSM_GES_APP_EVT_MAX)) {
+		msm_cam_server_subdev_notify(g_server_dev.gesture_device,
+			NOTIFY_GESTURE_EVT, v4l2_ev);
+	} else {
+		pr_err("%s: Invalid evt %d\n", __func__, v4l2_ev->type);
+		rc = -EINVAL;
+	}
+	D("%s: end\n", __func__);
+
+	return rc;
+}
+
+static int msm_open_server(struct file *fp)
+{
+	int rc = 0;
+	D("%s: open %s\n", __func__, fp->f_path.dentry->d_name.name);
+	mutex_lock(&g_server_dev.server_lock);
+	
+	g_server_dev.use_count++;
+	if (g_server_dev.use_count == 1)
+		fp->private_data =
+			&g_server_dev.server_command_queue.eventHandle;
+	mutex_unlock(&g_server_dev.server_lock);
+	return rc;
+}
+
+static unsigned int msm_poll_config(struct file *fp,
+					struct poll_table_struct *wait)
+{
+	int rc = 0;
+	struct msm_cam_config_dev *config = fp->private_data;
+	if (config == NULL)
+		return -EINVAL;
+
+	D("%s\n", __func__);
+
+	poll_wait(fp,
+	&config->config_stat_event_queue.eventHandle.events->wait, wait);
+	if (v4l2_event_pending(&config->config_stat_event_queue.eventHandle))
+		rc |= POLLPRI;
+	return rc;
+}
+
+static int msm_close_server(struct file *fp)
+{
+	struct v4l2_event_subscription sub;
+
+	D("%s\n", __func__);
+
+	mutex_lock(&g_server_dev.server_lock);
+	if (g_server_dev.use_count > 0)
+		g_server_dev.use_count--;
+	mutex_unlock(&g_server_dev.server_lock);
+	if (g_server_dev.use_count == 0) {
+		mutex_lock(&g_server_dev.server_lock);
+		if (g_server_dev.pcam_active) {
+			struct v4l2_event v4l2_ev;
+			
+			msm_cam_stop_hardware(g_server_dev.pcam_active);
+
+
+			v4l2_ev.type = V4L2_EVENT_PRIVATE_START
+				+ MSM_CAM_APP_NOTIFY_ERROR_EVENT;
+			ktime_get_ts(&v4l2_ev.timestamp);
+			v4l2_event_queue(
+				g_server_dev.pcam_active->pvdev, &v4l2_ev);
+		}
+		
+		sub.type = V4L2_EVENT_ALL;
+		msm_server_v4l2_unsubscribe_event(
+			&g_server_dev.server_command_queue.eventHandle, &sub);
+		mutex_unlock(&g_server_dev.server_lock);
+	}
+	return 0;
+}
+
+
+static long msm_v4l2_evt_notify(struct msm_cam_media_controller *mctl,
+		unsigned int cmd, unsigned long evt)
 {
 	struct v4l2_event v4l2_ev;
-	struct v4l2_event_and_payload evt_payload;
 	struct msm_cam_v4l2_device *pcam = NULL;
-	int rc = 0;
-	struct msm_queue_cmd *event_qcmd;
-	void *payload;
+
 	if (!mctl) {
 		pr_err("%s: mctl is NULL\n", __func__);
 		return -EINVAL;
 	}
 
-	if (copy_from_user(&evt_payload, (void __user *)evt,
-		sizeof(struct v4l2_event_and_payload))) {
+	if (copy_from_user(&v4l2_ev, (void __user *)evt,
+		sizeof(struct v4l2_event))) {
 		ERR_COPY_FROM_USER();
 		return -EFAULT;
 	}
 
-	v4l2_ev = evt_payload.evt;
-	v4l2_ev.id = 0;
 	pcam = mctl->pcam_ptr;
-	if(!pcam) {
-		pr_err("%s: pcam is NULL\n", __func__);
-		return -EINVAL;
-	}
 	ktime_get_ts(&v4l2_ev.timestamp);
-	if (evt_payload.payload_length > 0 && evt_payload.payload != NULL) {
-		mutex_lock(&pcam->event_lock);
-		event_qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
-		if (!event_qcmd) {
-			pr_err("%s Insufficient memory. return", __func__);
-			rc = -ENOMEM;
-			goto event_qcmd_alloc_fail;
-		}
-		payload = kzalloc(evt_payload.payload_length, GFP_KERNEL);
-		if (!payload) {
-			pr_err("%s Insufficient memory. return", __func__);
-			rc = -ENOMEM;
-			goto payload_alloc_fail;
-		}
-		if (copy_from_user(payload,
-				(void __user *)evt_payload.payload,
-				evt_payload.payload_length)) {
-			ERR_COPY_FROM_USER();
-			rc = -EFAULT;
-			goto copy_from_user_failed;
-		}
-		event_qcmd->command = payload;
-		event_qcmd->trans_code = evt_payload.transaction_id;
-		msm_enqueue(&pcam->eventData_q, &event_qcmd->list_eventdata);
-		mutex_unlock(&pcam->event_lock);
-	}
 	v4l2_event_queue(pcam->pvdev, &v4l2_ev);
-	return rc;
-copy_from_user_failed:
-	kfree(payload);
-payload_alloc_fail:
-	kfree(event_qcmd);
-event_qcmd_alloc_fail:
-	mutex_unlock(&pcam->event_lock);
+	return 0;
+}
+
+static long msm_ioctl_config(struct file *fp, unsigned int cmd,
+	unsigned long arg)
+{
+
+	int rc = 0;
+	struct v4l2_event ev;
+	struct msm_cam_config_dev *config_cam = fp->private_data;
+	struct v4l2_event_subscription temp_sub;
+
+	D("%s: cmd %d\n", __func__, _IOC_NR(cmd));
+
+	switch (cmd) {
+	
+	case MSM_CAM_IOCTL_REGISTER_PMEM:
+		return msm_register_pmem(
+			&config_cam->p_mctl->stats_info.pmem_stats_list,
+			(void __user *)arg, config_cam->p_mctl->client);
+		break;
+
+	case MSM_CAM_IOCTL_UNREGISTER_PMEM:
+		return msm_pmem_table_del(
+			&config_cam->p_mctl->stats_info.pmem_stats_list,
+			(void __user *)arg, config_cam->p_mctl->client);
+		break;
+	case VIDIOC_SUBSCRIBE_EVENT:
+		if (copy_from_user(&temp_sub,
+			(void __user *)arg,
+			sizeof(struct v4l2_event_subscription))) {
+			rc = -EINVAL;
+			return rc;
+		}
+		rc = msm_server_v4l2_subscribe_event
+			(&config_cam->config_stat_event_queue.eventHandle,
+			&temp_sub);
+		if (rc < 0) {
+			pr_err("%s: cam_v4l2_subscribe_event failed rc=%d\n",
+				__func__, rc);
+			return rc;
+		}
+		break;
+
+	case VIDIOC_UNSUBSCRIBE_EVENT:
+		if (copy_from_user(&temp_sub, (void __user *)arg,
+			  sizeof(struct v4l2_event_subscription))) {
+			rc = -EINVAL;
+			return rc;
+		}
+		rc = msm_server_v4l2_unsubscribe_event
+			(&config_cam->config_stat_event_queue.eventHandle,
+			&temp_sub);
+		if (rc < 0) {
+			pr_err("%s: server_unsubscribe_event failed rc=%d\n",
+				__func__, rc);
+		}
+		break;
+
+	case VIDIOC_DQEVENT: {
+		void __user *u_msg_value = NULL, *user_ptr = NULL;
+		struct msm_isp_event_ctrl u_isp_event;
+		struct msm_isp_event_ctrl *k_isp_event;
+
+		
+		D("%s: VIDIOC_DQEVENT\n", __func__);
+		if (copy_from_user(&ev, (void __user *)arg,
+				sizeof(struct v4l2_event)))
+			break;
+		user_ptr = (void __user *)(*((uint32_t *)ev.u.data));
+
+		
+		if (copy_from_user((void *)&u_isp_event, user_ptr,
+				   sizeof(struct msm_isp_event_ctrl))) {
+			rc = -EFAULT;
+			break;
+		}
+		
+		u_msg_value = u_isp_event.isp_data.isp_msg.data;
+
+		
+		rc = v4l2_event_dequeue(
+			&config_cam->config_stat_event_queue.eventHandle,
+			&ev, fp->f_flags & O_NONBLOCK);
+		if (rc < 0) {
+			pr_err("no pending events?");
+			rc = -EFAULT;
+			break;
+		}
+		k_isp_event = (struct msm_isp_event_ctrl *)
+				(*((uint32_t *)ev.u.data));
+		
+		u_isp_event = *k_isp_event;
+		if (ev.type != (V4L2_EVENT_PRIVATE_START +
+				MSM_CAM_RESP_DIV_FRAME_EVT_MSG) &&
+				ev.type != (V4L2_EVENT_PRIVATE_START +
+				MSM_CAM_RESP_MCTL_PP_EVENT)) {
+
+			u_isp_event.isp_data.isp_msg.data = u_msg_value;
+
+			if (ev.type == (V4L2_EVENT_PRIVATE_START +
+					MSM_CAM_RESP_STAT_EVT_MSG)) {
+				if (k_isp_event->isp_data.isp_msg.len > 0) {
+					void *k_msg_value =
+					k_isp_event->isp_data.isp_msg.data;
+					if (copy_to_user(u_msg_value,
+							k_msg_value,
+					 k_isp_event->isp_data.isp_msg.len)) {
+						rc = -EINVAL;
+						break;
+					}
+					kfree(k_msg_value);
+				}
+			}
+		}
+		if (copy_to_user(user_ptr,
+				(void *)&u_isp_event, sizeof(
+				struct msm_isp_event_ctrl))) {
+			rc = -EINVAL;
+			break;
+		}
+		kfree(k_isp_event);
+
+		
+		if (copy_to_user((void __user *)arg, &ev,
+				sizeof(struct v4l2_event))) {
+			rc = -EINVAL;
+			break;
+		}
+		}
+
+		break;
+
+	case MSM_CAM_IOCTL_V4L2_EVT_NOTIFY:
+		rc = msm_v4l2_evt_notify(config_cam->p_mctl, cmd, arg);
+		break;
+
+	case MSM_CAM_IOCTL_SET_MEM_MAP_INFO:
+		if (copy_from_user(&config_cam->mem_map, (void __user *)arg,
+				sizeof(struct msm_mem_map_info)))
+			rc = -EINVAL;
+		break;
+
+	default:{
+		
+		struct msm_cam_media_controller *p_mctl = config_cam->p_mctl;
+		if (p_mctl && p_mctl->mctl_cmd) {
+			rc = config_cam->p_mctl->mctl_cmd(p_mctl, cmd, arg);
+		} else {
+			rc = -EINVAL;
+			pr_err("%s: media controller is null\n", __func__);
+		}
+
+		break;
+	} 
+	} 
 	return rc;
 }
 
+static int msm_mmap_config(struct file *fp, struct vm_area_struct *vma)
+{
+	struct msm_cam_config_dev *config_cam = fp->private_data;
+	int rc = 0;
+	int phyaddr;
+	int retval;
+	unsigned long size;
+
+	D("%s: phy_addr=0x%x", __func__, config_cam->mem_map.cookie);
+	phyaddr = (int)config_cam->mem_map.cookie;
+	if (!phyaddr) {
+		pr_err("%s: no physical memory to map", __func__);
+		return -EFAULT;
+	}
+	memset(&config_cam->mem_map, 0,
+		sizeof(struct msm_mem_map_info));
+	size = vma->vm_end - vma->vm_start;
+	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+	retval = remap_pfn_range(vma, vma->vm_start,
+					phyaddr >> PAGE_SHIFT,
+					size, vma->vm_page_prot);
+	if (retval) {
+		pr_err("%s: remap failed, rc = %d",
+					__func__, retval);
+		rc = -ENOMEM;
+		goto end;
+	}
+	D("%s: phy_addr=0x%x: %08lx-%08lx, pgoff %08lx\n",
+			__func__, (uint32_t)phyaddr,
+			vma->vm_start, vma->vm_end, vma->vm_pgoff);
+end:
+	return rc;
+}
+
+static int msm_open_config(struct inode *inode, struct file *fp)
+{
+	int rc;
+
+	struct msm_cam_config_dev *config_cam = container_of(inode->i_cdev,
+		struct msm_cam_config_dev, config_cdev);
+
+	D("%s: open %s\n", __func__, fp->f_path.dentry->d_name.name);
+
+	rc = nonseekable_open(inode, fp);
+	if (rc < 0) {
+		pr_err("%s: nonseekable_open error %d\n", __func__, rc);
+		return rc;
+	}
+	config_cam->use_count++;
+
+	
+	
+	config_cam->p_mctl =
+		msm_camera_get_mctl(g_server_dev.pcam_active->mctl_handle);
+
+	if(!config_cam->p_mctl)
+		return -EFAULT;
+
+		
+	INIT_HLIST_HEAD(&config_cam->p_mctl->stats_info.pmem_stats_list);
+	spin_lock_init(&config_cam->p_mctl->stats_info.pmem_stats_spinlock);
+
+	config_cam->p_mctl->config_device = config_cam;
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+	kref_get(&config_cam->p_mctl->refcount);
+#endif
+	fp->private_data = config_cam;
+	return rc;
+}
+
+static int msm_close_config(struct inode *node, struct file *f)
+{
+	struct v4l2_event ev;
+	struct v4l2_event_subscription sub;
+	struct msm_isp_event_ctrl *isp_event;
+	struct msm_cam_config_dev *config_cam = f->private_data;
+	
+#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
+	D("%s Decrementing ref count of config node ", __func__);
+	kref_put(&config_cam->p_mctl->refcount, msm_release_ion_client);
+#endif
+	sub.type = V4L2_EVENT_ALL;
+	msm_server_v4l2_unsubscribe_event(
+		&config_cam->config_stat_event_queue.eventHandle,
+		&sub);
+	while (v4l2_event_pending(
+		&config_cam->config_stat_event_queue.eventHandle)) {
+		v4l2_event_dequeue(
+			&config_cam->config_stat_event_queue.eventHandle,
+			&ev, O_NONBLOCK);
+		isp_event = (struct msm_isp_event_ctrl *)
+			(*((uint32_t *)ev.u.data));
+		if (isp_event) {
+			if (isp_event->isp_data.isp_msg.len != 0 &&
+				isp_event->isp_data.isp_msg.data != NULL)
+				kfree(isp_event->isp_data.isp_msg.data);
+			kfree(isp_event);
+		}
+	}
+
+	return 0;
+}
 
 static struct v4l2_file_operations g_msm_fops = {
 	.owner   = THIS_MODULE,
@@ -1301,25 +2895,671 @@
 	.ioctl   = video_ioctl2,
 };
 
+static const struct v4l2_file_operations msm_fops_server = {
+	.owner = THIS_MODULE,
+	.open  = msm_open_server,
+	.poll  = msm_poll_server,
+	.unlocked_ioctl = video_ioctl2,
+	.release = msm_close_server,
+};
+
+static const struct v4l2_ioctl_ops msm_ioctl_ops_server = {
+	.vidioc_subscribe_event = msm_server_v4l2_subscribe_event,
+	.vidioc_default = msm_ioctl_server,
+};
+
+static const struct file_operations msm_fops_config = {
+	.owner = THIS_MODULE,
+	.open  = msm_open_config,
+	.poll  = msm_poll_config,
+	.unlocked_ioctl = msm_ioctl_config,
+	.mmap	= msm_mmap_config,
+	.release = msm_close_config,
+};
+
+static struct camera_flash_info *p_flash_led_info;
+static struct kobject *led_status_obj; 
+
+static ssize_t flash_led_info_get(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	ssize_t length = 0;
+
+	if (p_flash_led_info != NULL)
+		length = sprintf(buf, "%d %d %d %d\n",
+			p_flash_led_info->led_info->enable,
+			p_flash_led_info->led_info->low_limit_led_state,
+			p_flash_led_info->led_info->max_led_current_ma,
+			p_flash_led_info->led_info->num_led_est_table);
+	else
+		length = sprintf(buf, "%d\n", 0);
+	
+	return length;
+}
+
+static ssize_t flash_led_tbl_get(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	ssize_t length = 0;
+	uint16_t i = 0;
+	char sub[64] = {0};
+	struct camera_led_est *sub_tbl = NULL;
+
+	if (p_flash_led_info != NULL)
+		for (i = 0; i < p_flash_led_info->led_info->num_led_est_table; i++) {
+			sub_tbl = (struct camera_led_est *)
+				(((char *)p_flash_led_info->led_est_table) +
+				(i * sizeof(struct camera_led_est)));
+			if (sub_tbl != NULL) {
+			length += sprintf(sub, "%d %d %d %d %d %d ",
+				sub_tbl->enable,
+				sub_tbl->led_state,
+				sub_tbl->current_ma,
+				sub_tbl->lumen_value,
+				sub_tbl->min_step,
+				sub_tbl->max_step);
+			strcat(buf, sub);
+			}
+		}
+	else
+		length = sprintf(buf, "%d\n", 0);
+	return length;
+}
+
+static DEVICE_ATTR(flash_led_info, 0444,
+	flash_led_info_get,
+	NULL);
+
+static DEVICE_ATTR(flash_led_tbl, 0444,
+	flash_led_tbl_get,
+	NULL);
+
+static uint32_t led_ril_status_value;
+static uint32_t led_wimax_status_value;
+static uint32_t led_hotspot_status_value;
+static uint16_t led_low_temp_limit;
+static uint16_t led_low_cap_limit;
+
+static ssize_t led_ril_status_get(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	ssize_t length;
+	length = sprintf(buf, "%d\n", led_ril_status_value);
+	return length;
+}
+
+static ssize_t led_ril_status_set(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	uint32_t tmp = 0;
+
+	if (buf[1] == '\n')
+		tmp = buf[0] - 0x30;
+
+	led_ril_status_value = tmp;
+	pr_info("led_ril_status_value = %d\n", led_ril_status_value);
+	return count;
+}
+
+static ssize_t led_wimax_status_get(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	ssize_t length;
+	length = sprintf(buf, "%d\n", led_wimax_status_value);
+	return length;
+}
+
+static ssize_t led_wimax_status_set(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	uint32_t tmp = 0;
+
+	if (buf[1] == '\n')
+		tmp = buf[0] - 0x30;
+
+	led_wimax_status_value = tmp;
+	pr_info("led_wimax_status_value = %d\n", led_wimax_status_value);
+	return count;
+}
+
+static ssize_t led_hotspot_status_get(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	ssize_t length;
+	length = sprintf(buf, "%d\n", led_hotspot_status_value);
+	return length;
+}
+
+static ssize_t led_hotspot_status_set(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	uint32_t tmp = 0;
+
+	tmp = buf[0] - 0x30; 
+
+	led_hotspot_status_value = tmp;
+	pr_info("led_hotspot_status_value = %d\n", led_hotspot_status_value);
+	return count;
+}
+
+static ssize_t low_temp_limit_get(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	ssize_t length;
+	length = sprintf(buf, "%d\n", led_low_temp_limit);
+	return length;
+}
+
+static ssize_t low_cap_limit_get(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	ssize_t length;
+	length = sprintf(buf, "%d\n", led_low_cap_limit);
+	return length;
+}
+
+static DEVICE_ATTR(led_ril_status, 0644,
+	led_ril_status_get,
+	led_ril_status_set);
+
+static DEVICE_ATTR(led_wimax_status, 0644,
+	led_wimax_status_get,
+	led_wimax_status_set);
+
+static DEVICE_ATTR(led_hotspot_status, 0644,
+	led_hotspot_status_get,
+	led_hotspot_status_set);
+
+static DEVICE_ATTR(low_temp_limit, 0444,
+	low_temp_limit_get,
+	NULL);
+
+static DEVICE_ATTR(low_cap_limit, 0444,
+	low_cap_limit_get,
+	NULL);
+
+static int msm_sensor_attr_node(struct msm_camera_sensor_info *sdata)
+{
+	int ret = 0;
+
+	led_status_obj = kobject_create_and_add("camera_led_status", NULL);
+	if (led_status_obj == NULL) {
+		pr_info("msm_camera: subsystem_register failed\n");
+		ret = -ENOMEM;
+		goto error;
+	}
+
+	ret = sysfs_create_file(led_status_obj,
+		&dev_attr_flash_led_info.attr);
+	if (ret) {
+		pr_info("msm_camera: sysfs_create_file flash_led_info failed\n");
+		ret = -EFAULT;
+		goto error;
+	}
+
+	ret = sysfs_create_file(led_status_obj,
+		&dev_attr_flash_led_tbl.attr);
+	if (ret) {
+		pr_info("msm_camera: sysfs_create_file flash_led_tbl failed\n");
+		ret = -EFAULT;
+		goto error;
+	}
+
+	ret = sysfs_create_file(led_status_obj,
+		&dev_attr_led_ril_status.attr);
+	if (ret) {
+		pr_info("msm_camera: sysfs_create_file dev_attr_led_ril_status failed\n");
+		ret = -EFAULT;
+		goto error;
+	}
+	ret = sysfs_create_file(led_status_obj,
+		&dev_attr_led_wimax_status.attr);
+	if (ret) {
+		pr_info("msm_camera: sysfs_create_file dev_attr_led_wimax_status failed\n");
+		ret = -EFAULT;
+		goto error;
+	}
+	ret = sysfs_create_file(led_status_obj,
+		&dev_attr_led_hotspot_status.attr);
+	if (ret) {
+		pr_info("msm_camera: sysfs_create_file dev_attr_led_hotspot_status failed\n");
+		ret = -EFAULT;
+		goto error;
+	}
+	ret = sysfs_create_file(led_status_obj,
+		&dev_attr_low_temp_limit.attr);
+	if (ret) {
+		pr_info("msm_camera: sysfs_create_file dev_attr_low_temp_limit failed\n");
+		ret = -EFAULT;
+		goto error;
+	}
+	ret = sysfs_create_file(led_status_obj,
+		&dev_attr_low_cap_limit.attr);
+	if (ret) {
+		pr_info("msm_camera: sysfs_create_file dev_attr_low_cap_limit failed\n");
+		ret = -EFAULT;
+		goto error;
+	}
+
+	if ((sdata->flash_data->flash_type != MSM_CAMERA_FLASH_NONE) &&
+		sdata->flash_cfg && sdata->flash_cfg->flash_info) {
+		p_flash_led_info = sdata->flash_cfg->flash_info;
+	} else {
+		p_flash_led_info = NULL;
+	}
+
+	led_low_temp_limit = sdata->flash_cfg->low_temp_limit;
+	led_low_cap_limit = sdata->flash_cfg->low_cap_limit;
+
+	return ret;
+
+error:
+	kobject_del(led_status_obj);
+	return ret;
+}
+
+#ifdef CONFIG_RAWCHIP
+static struct kobject *rawchip_status_obj;
+
+uint32_t rawchip_id;
+
+static ssize_t probed_rawchip_id_get(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	ssize_t length;
+	length = sprintf(buf, "0x%x\n", rawchip_id);
+	return length;
+}
+
+static DEVICE_ATTR(probed_rawchip_id, 0444,
+	probed_rawchip_id_get,
+	NULL);
+
+int msm_rawchip_attr_node(void)
+{
+	int ret = 0;
+
+	rawchip_status_obj = kobject_create_and_add("camera_rawchip_status", NULL);
+	if (rawchip_status_obj == NULL) {
+		pr_err("msm_camera: create camera_rawchip_status failed\n");
+		ret = -ENOMEM;
+		goto error;
+	}
+
+	ret = sysfs_create_file(rawchip_status_obj,
+		&dev_attr_probed_rawchip_id.attr);
+	if (ret) {
+		pr_info("msm_camera: sysfs_create_file dev_attr_probed_rawchip_id failed\n");
+		ret = -EFAULT;
+		goto error;
+	}
+
+	return ret;
+
+error:
+	kobject_del(rawchip_status_obj);
+	return ret;
+}
+#endif
+
+
+int msm_setup_v4l2_event_queue(struct v4l2_fh *eventHandle,
+	struct video_device *pvdev)
+{
+	int rc = 0;
+	
+	spin_lock_init(&pvdev->fh_lock);
+	INIT_LIST_HEAD(&pvdev->fh_list);
+
+	rc = v4l2_fh_init(eventHandle, pvdev);
+	if (rc < 0)
+		return rc;
+	if (eventHandle->events == NULL) {
+		rc = v4l2_event_init(eventHandle);
+		if (rc < 0)
+			return rc;
+	}
+
+	
+	
+	rc = v4l2_event_alloc(eventHandle, 200);
+	
+	if (rc < 0) {
+		pr_err("%s, v4l2_event_alloc failed, rc = %d", __func__, rc);
+		return rc;
+	}
+	v4l2_fh_add(eventHandle);
+	return rc;
+
+}
+
+static int msm_setup_config_dev(int node, char *device_name)
+{
+	int rc = -ENODEV;
+	struct device *device_config;
+	int dev_num = node;
+	dev_t devno;
+	struct msm_cam_config_dev *config_cam;
+
+	config_cam = kzalloc(sizeof(*config_cam), GFP_KERNEL);
+	if (!config_cam) {
+		pr_err("%s: could not allocate memory for msm_cam_config_device\n",
+			__func__);
+		return -ENOMEM;
+	}
+
+	D("%s\n", __func__);
+
+	devno = MKDEV(MAJOR(msm_devno), dev_num+1);
+	device_config = device_create(msm_class, NULL, devno, NULL, "%s%d",
+		device_name, dev_num);
+
+	if (IS_ERR(device_config)) {
+		rc = PTR_ERR(device_config);
+		pr_err("%s: error creating device: %d\n", __func__, rc);
+		goto config_setup_fail;
+	}
+
+	cdev_init(&config_cam->config_cdev, &msm_fops_config);
+	config_cam->config_cdev.owner = THIS_MODULE;
+
+	rc = cdev_add(&config_cam->config_cdev, devno, 1);
+	if (rc < 0) {
+		pr_err("%s: error adding cdev: %d\n", __func__, rc);
+		device_destroy(msm_class, devno);
+		goto config_setup_fail;
+	}
+
+	g_server_dev.config_info.config_dev_name[dev_num] =
+		dev_name(device_config);
+	D("%s Connected config device %s\n", __func__,
+		g_server_dev.config_info.config_dev_name[dev_num]);
+	g_server_dev.config_info.config_dev_id[dev_num] = dev_num;
+
+	config_cam->config_stat_event_queue.pvdev = video_device_alloc();
+	if (config_cam->config_stat_event_queue.pvdev == NULL) {
+		pr_err("%s: video_device_alloc failed\n", __func__);
+		goto config_setup_fail;
+	}
+
+	rc = msm_setup_v4l2_event_queue(
+		&config_cam->config_stat_event_queue.eventHandle,
+		config_cam->config_stat_event_queue.pvdev);
+	if (rc < 0) {
+		pr_err("%s failed to initialize event queue\n", __func__);
+		video_device_release(config_cam->config_stat_event_queue.pvdev);
+		goto config_setup_fail;
+	}
+
+	return rc;
+
+config_setup_fail:
+	kfree(config_cam);
+	return rc;
+
+}
+static void msm_cam_server_subdev_notify(struct v4l2_subdev *sd,
+				unsigned int notification, void *arg)
+{
+	int rc = -EINVAL;
+	struct msm_sensor_ctrl_t *s_ctrl;
+	struct msm_camera_sensor_info *sinfo;
+	struct msm_camera_device_platform_data *camdev;
+	uint8_t csid_core = 0;
+
+	if (notification == NOTIFY_CID_CHANGE ||
+		notification == NOTIFY_ISPIF_STREAM ||
+		notification == NOTIFY_PCLK_CHANGE ||
+		notification == NOTIFY_CSIPHY_CFG ||
+		notification == NOTIFY_CSID_CFG ||
+		notification == NOTIFY_CSIC_CFG) {
+		s_ctrl = get_sctrl(sd);
+		sinfo = (struct msm_camera_sensor_info *) s_ctrl->sensordata;
+		camdev = sinfo->pdata;
+		csid_core = camdev->csid_core;
+	}
+
+	switch (notification) {
+	case NOTIFY_CID_CHANGE:
+		
+		if (g_server_dev.ispif_device) {
+			struct msm_ispif_params_list ispif_params;
+			ispif_params.len = 1;
+			ispif_params.params[0].intftype = PIX0;
+			ispif_params.params[0].cid_mask = 0x0001;
+			ispif_params.params[0].csid = csid_core;
+
+			rc = v4l2_subdev_call(
+				g_server_dev.ispif_device, core, ioctl,
+				VIDIOC_MSM_ISPIF_CFG, &ispif_params);
+			if (rc < 0)
+				return;
+		}
+		break;
+	case NOTIFY_ISPIF_STREAM:
+		
+		rc = v4l2_subdev_call(g_server_dev.ispif_device, video,
+				s_stream, (int)arg);
+		if (rc < 0)
+			return;
+
+		break;
+	case NOTIFY_ISP_MSG_EVT:
+	case NOTIFY_VFE_MSG_OUT:
+	case NOTIFY_VFE_MSG_STATS:
+	case NOTIFY_VFE_MSG_COMP_STATS:
+	case NOTIFY_VFE_BUF_EVT:
+	case NOTIFY_VFE_BUF_FREE_EVT:
+		if (g_server_dev.isp_subdev[0] &&
+			g_server_dev.isp_subdev[0]->isp_notify) {
+			rc = g_server_dev.isp_subdev[0]->isp_notify(
+				g_server_dev.vfe_device[0], notification, arg);
+		}
+		break;
+	case NOTIFY_VPE_MSG_EVT: {
+		struct msm_cam_media_controller *pmctl =
+		(struct msm_cam_media_controller *)
+		v4l2_get_subdev_hostdata(sd);
+		struct msm_vpe_resp *vdata = (struct msm_vpe_resp *)arg;
+		msm_mctl_pp_notify(pmctl,
+		(struct msm_mctl_pp_frame_info *)
+		vdata->extdata);
+		break;
+	}
+	case NOTIFY_VFE_IRQ:{
+		struct msm_vfe_cfg_cmd cfg_cmd;
+		struct msm_camvfe_params vfe_params;
+		cfg_cmd.cmd_type = CMD_VFE_PROCESS_IRQ;
+		vfe_params.vfe_cfg = &cfg_cmd;
+		vfe_params.data = arg;
+		rc = v4l2_subdev_call(g_server_dev.vfe_device[0],
+			core, ioctl, 0, &vfe_params);
+	}
+		break;
+	case NOTIFY_AXI_IRQ:
+		rc = v4l2_subdev_call(g_server_dev.axi_device[0],
+			core, ioctl, VIDIOC_MSM_AXI_IRQ, arg);
+		break;
+	
+	case NOTIFY_PCLK_CHANGE:
+		if (g_server_dev.axi_device[0])
+			rc = v4l2_subdev_call(g_server_dev.axi_device[0], video,
+				s_crystal_freq, *(uint32_t *)arg, 0);
+		else
+			rc = v4l2_subdev_call(g_server_dev.vfe_device[0], video,
+				s_crystal_freq, *(uint32_t *)arg, 0);
+		break;
+	case NOTIFY_CSIPHY_CFG:
+		rc = v4l2_subdev_call(g_server_dev.csiphy_device[csid_core],
+			core, ioctl, VIDIOC_MSM_CSIPHY_CFG, arg);
+		break;
+	case NOTIFY_CSID_CFG:
+		rc = v4l2_subdev_call(g_server_dev.csid_device[csid_core],
+			core, ioctl, VIDIOC_MSM_CSID_CFG, arg);
+		break;
+	case NOTIFY_CSIC_CFG:
+		rc = v4l2_subdev_call(g_server_dev.csic_device[csid_core],
+			core, ioctl, VIDIOC_MSM_CSIC_CFG, arg);
+		break;
+	case NOTIFY_GESTURE_EVT:
+		rc = v4l2_subdev_call(g_server_dev.gesture_device,
+			core, ioctl, VIDIOC_MSM_GESTURE_EVT, arg);
+		break;
+	case NOTIFY_GESTURE_CAM_EVT:
+		rc = v4l2_subdev_call(g_server_dev.gesture_device,
+			core, ioctl, VIDIOC_MSM_GESTURE_CAM_EVT, arg);
+		break;		
+	default:
+		break;
+	}
+
+	return;
+}
+
+int msm_cam_register_subdev_node(struct v4l2_subdev *sd,
+	enum msm_cam_subdev_type sdev_type, uint8_t index)
+{
+	struct video_device *vdev;
+	int err = 0;
+
+	if (sdev_type == CSIPHY_DEV) {
+		if (index >= MAX_NUM_CSIPHY_DEV)
+			return -EINVAL;
+		g_server_dev.csiphy_device[index] = sd;
+	} else if (sdev_type == CSID_DEV) {
+		if (index >= MAX_NUM_CSID_DEV)
+			return -EINVAL;
+		g_server_dev.csid_device[index] = sd;
+	} else if (sdev_type == CSIC_DEV) {
+		if (index >= MAX_NUM_CSIC_DEV)
+			return -EINVAL;
+		g_server_dev.csic_device[index] = sd;
+	} else if (sdev_type == ISPIF_DEV) {
+		g_server_dev.ispif_device = sd;
+	} else if (sdev_type == VFE_DEV) {
+		if (index >= MAX_NUM_VFE_DEV)
+			return -EINVAL;
+		g_server_dev.vfe_device[index] = sd;
+	} else if (sdev_type == VPE_DEV) {
+		if (index >= MAX_NUM_VPE_DEV)
+			return -EINVAL;
+		g_server_dev.vpe_device[index] = sd;
+	} else if (sdev_type == AXI_DEV) {
+		if (index >= MAX_NUM_AXI_DEV)
+			return -EINVAL;
+		g_server_dev.axi_device[index] = sd;		
+	}
+	else if (sdev_type == GESTURE_DEV) {
+		g_server_dev.gesture_device = sd;
+	}
+
+	err = v4l2_device_register_subdev(&g_server_dev.v4l2_dev, sd);
+	if (err < 0)
+		return err;
+
+	if (!(sd->flags & V4L2_SUBDEV_FL_HAS_DEVNODE))
+		return err;
+
+	vdev = &sd->devnode;
+	strlcpy(vdev->name, sd->name, sizeof(vdev->name));
+	vdev->v4l2_dev = &g_server_dev.v4l2_dev;
+	vdev->fops = &v4l2_subdev_fops;
+	vdev->release = video_device_release_empty;
+	err = __video_register_device(vdev, VFL_TYPE_SUBDEV, -1, 1,
+						  sd->owner);
+	if (err < 0)
+		return err;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+	sd->entity.v4l.major = VIDEO_MAJOR;
+	sd->entity.v4l.minor = vdev->minor;
+#endif
+	return 0;
+}
+
+
+static int msm_setup_server_dev(struct platform_device *pdev)
+{
+	int rc = -ENODEV, i;
+
+	D("%s\n", __func__);
+	g_server_dev.server_pdev = pdev;
+	g_server_dev.v4l2_dev.dev = &pdev->dev;
+	g_server_dev.v4l2_dev.notify = msm_cam_server_subdev_notify;
+
+	rc = v4l2_device_register(g_server_dev.v4l2_dev.dev,
+			&g_server_dev.v4l2_dev);
+	if (rc < 0)
+		return -EINVAL;
+
+
+	g_server_dev.video_dev = video_device_alloc();
+	if (g_server_dev.video_dev == NULL) {
+		pr_err("%s: video_device_alloc failed\n", __func__);
+		return rc;
+	}
+
+	strlcpy(g_server_dev.video_dev->name, pdev->name,
+			sizeof(g_server_dev.video_dev->name));
+
+	g_server_dev.video_dev->v4l2_dev = &g_server_dev.v4l2_dev;
+	g_server_dev.video_dev->fops = &msm_fops_server;
+	g_server_dev.video_dev->ioctl_ops = &msm_ioctl_ops_server;
+	g_server_dev.video_dev->release   = video_device_release;
+	g_server_dev.video_dev->minor = 100;
+	g_server_dev.video_dev->vfl_type = 1;
+
+	video_set_drvdata(g_server_dev.video_dev, &g_server_dev);
+
+	strlcpy(g_server_dev.media_dev.model, "qcamera",
+		sizeof(g_server_dev.media_dev.model));
+	g_server_dev.media_dev.dev = &pdev->dev;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+	rc = media_device_register(&g_server_dev.media_dev);
+
+	g_server_dev.v4l2_dev.mdev = &g_server_dev.media_dev;
+#endif
+	rc = video_register_device(g_server_dev.video_dev,
+		VFL_TYPE_GRABBER, 100);
+
+
+	mutex_init(&g_server_dev.server_lock);
+	mutex_init(&g_server_dev.server_queue_lock);
+	g_server_dev.pcam_active = NULL;
+	g_server_dev.camera_info.num_cameras = 0;
+	atomic_set(&g_server_dev.number_pcam_active, 0);
+	g_server_dev.server_evt_id = 0;
+
+	
+
+	g_server_dev.server_command_queue.pvdev = g_server_dev.video_dev;
+
+	rc = msm_setup_v4l2_event_queue(
+		&g_server_dev.server_command_queue.eventHandle,
+		g_server_dev.server_command_queue.pvdev);
+	if (rc < 0) {
+		pr_err("%s failed to initialize event queue\n", __func__);
+		video_device_release(g_server_dev.server_command_queue.pvdev);
+		return rc;
+	}
+	for (i = 0; i < MAX_NUM_ACTIVE_CAMERA; i++) {
+		struct msm_cam_server_queue *queue;
+		queue = &g_server_dev.server_queue[i];
+		queue->queue_active = 0;
+		msm_queue_init(&queue->ctrl_q, "control");
+		msm_queue_init(&queue->eventData_q, "eventdata");
+	}
+	return rc;
+}
+
 static int msm_cam_dev_init(struct msm_cam_v4l2_device *pcam)
 {
 	int rc = -ENOMEM;
 	struct video_device *pvdev = NULL;
-	struct i2c_client *client = NULL;
-	struct platform_device *pdev = NULL;
+	struct i2c_client *client = v4l2_get_subdevdata(pcam->sensor_sdev);
 	D("%s\n", __func__);
 
-	/* first register the v4l2 device */
-	if (pcam->sensor_sdev->flags & V4L2_SUBDEV_FL_IS_I2C) {
-		client = v4l2_get_subdevdata(pcam->sensor_sdev);
-		pcam->v4l2_dev.dev = &client->dev;
-		pcam->media_dev.dev = &client->dev;
-	} else {
-		pdev = v4l2_get_subdevdata(pcam->sensor_sdev);
-		pcam->v4l2_dev.dev = &pdev->dev;
-		pcam->media_dev.dev = &pdev->dev;
-	}
-
+	
+	pcam->v4l2_dev.dev = &client->dev;
 	rc = v4l2_device_register(pcam->v4l2_dev.dev, &pcam->v4l2_dev);
 	if (rc < 0)
 		return -EINVAL;
@@ -1327,38 +3567,41 @@
 		pcam->v4l2_dev.notify = msm_cam_v4l2_subdev_notify;
 
 
-	/* now setup video device */
+	
 	pvdev = video_device_alloc();
 	if (pvdev == NULL) {
 		pr_err("%s: video_device_alloc failed\n", __func__);
 		return rc;
 	}
 
+#if defined(CONFIG_MEDIA_CONTROLLER)
 	strlcpy(pcam->media_dev.model, QCAMERA_NAME,
 			sizeof(pcam->media_dev.model));
+	pcam->media_dev.dev = &client->dev;
 	rc = media_device_register(&pcam->media_dev);
 	pvdev->v4l2_dev = &pcam->v4l2_dev;
 	pcam->v4l2_dev.mdev = &pcam->media_dev;
+#endif
 
-	/* init video device's driver interface */
+	
 	D("sensor name = %s, sizeof(pvdev->name)=%d\n",
 		pcam->sensor_sdev->name, sizeof(pvdev->name));
 
-	/* device info - strlcpy is safer than strncpy but
-	   only if architecture supports*/
 	strlcpy(pvdev->name, pcam->sensor_sdev->name, sizeof(pvdev->name));
 
 	pvdev->release   = video_device_release;
-	pvdev->fops	     = &g_msm_fops;
+	pvdev->fops	  = &g_msm_fops;
 	pvdev->ioctl_ops = &g_msm_ioctl_ops;
 	pvdev->minor	 = -1;
-	pvdev->vfl_type  = VFL_TYPE_GRABBER;
+	pvdev->vfl_type  = 1;
 
+#if defined(CONFIG_MEDIA_CONTROLLER)
 	media_entity_init(&pvdev->entity, 0, NULL, 0);
 	pvdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;
 	pvdev->entity.group_id = QCAMERA_VNODE_GROUP_ID;
+#endif
 
-	/* register v4l2 video device to kernel as /dev/videoXX */
+	
 	D("video_register_device\n");
 	rc = video_register_device(pvdev,
 					VFL_TYPE_GRABBER,
@@ -1367,15 +3610,22 @@
 		pr_err("%s: video_register_device failed\n", __func__);
 		goto reg_fail;
 	}
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
 	pvdev->entity.name = video_device_node_name(pvdev);
+#endif
+
 	D("%s: video device registered as /dev/video%d\n",
 		__func__, pvdev->num);
 
-	/* connect pcam and video dev to each other */
+	
 	pcam->pvdev	= pvdev;
 	video_set_drvdata(pcam->pvdev, pcam);
 
-	return rc;
+	
+	
+
+	return rc ;
 
 reg_fail:
 	video_device_release(pvdev);
@@ -1384,17 +3634,18 @@
 	return rc;
 }
 
-static struct v4l2_subdev *msm_actuator_probe(
-	struct msm_actuator_info *actuator_info)
+static int msm_actuator_probe(struct msm_actuator_info *actuator_info,
+			      struct v4l2_subdev *act_sdev,
+			      struct msm_actuator_ctrl *actctrl)
 {
-	struct v4l2_subdev *act_sdev;
+	int rc = 0;
 	struct i2c_adapter *adapter = NULL;
-	struct msm_actuator_ctrl_t *actrl;
 	void *act_client = NULL;
+	struct msm_actuator_ctrl *a_ext_ctrl = NULL;
 
 	D("%s called\n", __func__);
 
-	if (!actuator_info || !actuator_info->board_info)
+	if (!actuator_info)
 		goto probe_fail;
 
 	adapter = i2c_get_adapter(actuator_info->bus_id);
@@ -1405,19 +3656,14 @@
 	if (!act_client)
 		goto device_fail;
 
-	act_sdev = (struct v4l2_subdev *)i2c_get_clientdata(act_client);
-	if (act_sdev == NULL)
+	a_ext_ctrl = (struct msm_actuator_ctrl *)i2c_get_clientdata(act_client);
+	if (!a_ext_ctrl)
 		goto client_fail;
 
-	if (actuator_info->vcm_enable) {
-		actrl = get_actrl(act_sdev);
-		if (actrl) {
-			actrl->vcm_enable = actuator_info->vcm_enable;
-			actrl->vcm_pwd = actuator_info->vcm_pwd;
-		}
-	}
-
-	return act_sdev;
+	*actctrl = *a_ext_ctrl;
+	a_ext_ctrl->a_create_subdevice((void *)actuator_info,
+				       (void *)act_sdev);
+	return rc;
 
 client_fail:
 	i2c_unregister_device(act_client);
@@ -1425,60 +3671,26 @@
 	i2c_put_adapter(adapter);
 	adapter = NULL;
 probe_fail:
-	return NULL;
+	actctrl->a_init_table = NULL;
+	actctrl->a_power_up = NULL;
+	actctrl->a_power_down = NULL;
+	actctrl->a_config = NULL;
+	actctrl->a_create_subdevice = NULL;
+	return rc;
 }
 
-static struct v4l2_subdev *msm_eeprom_probe(
-	struct msm_eeprom_info *eeprom_info)
-{
-	struct v4l2_subdev *eeprom_sdev;
-	struct i2c_adapter *adapter = NULL;
-	void *eeprom_client = NULL;
-
-	D("%s called\n", __func__);
-
-	if (!eeprom_info || !eeprom_info->board_info)
-		goto probe_fail;
-
-	adapter = i2c_get_adapter(eeprom_info->bus_id);
-	if (!adapter)
-		goto probe_fail;
-
-	eeprom_client = i2c_new_device(adapter, eeprom_info->board_info);
-	if (!eeprom_client)
-		goto device_fail;
-
-	eeprom_sdev = (struct v4l2_subdev *)i2c_get_clientdata(eeprom_client);
-	if (eeprom_sdev == NULL)
-		goto client_fail;
-
-	return eeprom_sdev;
-client_fail:
-	pr_err("%s client_fail\n", __func__);
-	i2c_unregister_device(eeprom_client);
-device_fail:
-	pr_err("%s device_fail\n", __func__);
-	i2c_put_adapter(adapter);
-	adapter = NULL;
-probe_fail:
-	pr_err("%s probe_fail\n", __func__);
-	return NULL;
-}
-
-/* register a msm sensor into the msm device, which will probe the
- * sensor HW. if the HW exist then create a video device (/dev/videoX/)
- * to represent this sensor */
 int msm_sensor_register(struct v4l2_subdev *sensor_sd)
 {
 	int rc = -EINVAL;
 	struct msm_camera_sensor_info *sdata;
 	struct msm_cam_v4l2_device *pcam;
 	struct msm_sensor_ctrl_t *s_ctrl;
-	struct msm_cam_subdev_info sd_info;
+	struct v4l2_subdev *act_sdev = NULL;
+	struct msm_actuator_ctrl *actctrl = NULL;
 
 	D("%s for %s\n", __func__, sensor_sd->name);
 
-	/* allocate the memory for the camera device first */
+	
 	pcam = kzalloc(sizeof(*pcam), GFP_KERNEL);
 	if (!pcam) {
 		pr_err("%s: could not allocate mem for msm_cam_v4l2_device\n",
@@ -1488,21 +3700,47 @@
 
 	pcam->sensor_sdev = sensor_sd;
 	s_ctrl = get_sctrl(sensor_sd);
+	if(!s_ctrl) goto failure;
 	sdata = (struct msm_camera_sensor_info *) s_ctrl->sensordata;
+	if(!sdata) goto failure;
 
-	pcam->act_sdev = msm_actuator_probe(sdata->actuator_info);
-	pcam->eeprom_sdev = msm_eeprom_probe(sdata->eeprom_info);
+	pcam->act_sdev = kzalloc(sizeof(struct v4l2_subdev),
+								  GFP_KERNEL);
+	if (!pcam->act_sdev) {
+		pr_err("%s: could not allocate mem for actuator v4l2_subdev\n",
+			   __func__);
+		kfree(pcam);
+		return -ENOMEM;
+	}
 
-	D("%s: pcam =0x%p\n", __func__, pcam);
+	act_sdev = pcam->act_sdev;
+	actctrl = &pcam->actctrl;
+
+	
+	if (sdata->actuator_info) {
+		if (sdata->use_rawchip)
+			sdata->actuator_info->use_rawchip_af = 1;
+		else
+			sdata->actuator_info->use_rawchip_af = 0;
+	}
+	
+
+	msm_actuator_probe(sdata->actuator_info,
+					   act_sdev, actctrl);
 
 	pcam->sdata = sdata;
 
-	/* init the user count and lock*/
+	
+	if (pcam->sdata && pcam->sdata->flash_cfg )
+		msm_sensor_attr_node(pcam->sdata);
+	
+
+	
 	pcam->use_count = 0;
 	mutex_init(&pcam->vid_lock);
 	mutex_init(&pcam->mctl_node.dev_lock);
 
-	/* Initialize the formats supported */
+	
 	rc  = msm_mctl_init_user_formats(pcam);
 	if (rc < 0)
 		goto failure;
@@ -1517,22 +3755,54 @@
 			 __func__, rc);
 		goto failure;
 	}
-	msm_server_update_sensor_info(pcam, sdata);
 
-	sd_info.sdev_type = SENSOR_DEV;
-	sd_info.sd_index = vnode_count;
-	sd_info.irq_num = 0;
-	/* register the subdevice, must be done for callbacks */
-	rc = msm_cam_register_subdev_node(sensor_sd, &sd_info);
+	g_server_dev.camera_info.video_dev_name
+	[g_server_dev.camera_info.num_cameras]
+	= video_device_node_name(pcam->pvdev);
+	D("%s Connected video device %s\n", __func__,
+		g_server_dev.camera_info.video_dev_name
+		[g_server_dev.camera_info.num_cameras]);
+
+	g_server_dev.camera_info.s_mount_angle
+	[g_server_dev.camera_info.num_cameras]
+	= sdata->sensor_platform_info->mount_angle;
+
+	g_server_dev.camera_info.is_internal_cam
+	[g_server_dev.camera_info.num_cameras]
+	= sdata->camera_type;
+
+	g_server_dev.mctl_node_info.mctl_node_name
+	[g_server_dev.mctl_node_info.num_mctl_nodes]
+	= video_device_node_name(pcam->mctl_node.pvdev);
+
+	pr_info("%s mctl_node_name[%d] = %s\n", __func__,
+		g_server_dev.mctl_node_info.num_mctl_nodes,
+		g_server_dev.mctl_node_info.mctl_node_name
+		[g_server_dev.mctl_node_info.num_mctl_nodes]);
+
+	snprintf(pcam->media_dev.serial,
+			sizeof(pcam->media_dev.serial),
+			"%s-%d-%d", QCAMERA_NAME,
+			sdata->sensor_platform_info->mount_angle,
+			sdata->camera_type);
+
+	g_server_dev.camera_info.num_cameras++;
+	g_server_dev.mctl_node_info.num_mctl_nodes++;
+
+	D("%s done, rc = %d\n", __func__, rc);
+	D("%s number of sensors connected is %d\n", __func__,
+		g_server_dev.camera_info.num_cameras);
+
+	
+	rc = msm_cam_register_subdev_node(sensor_sd, SENSOR_DEV, vnode_count);
 	if (rc < 0) {
 		D("%s sensor sub device register failed\n",
 			__func__);
 		goto failure;
 	}
 
-	if (pcam->act_sdev) {
-		rc = v4l2_device_register_subdev(&pcam->v4l2_dev,
-				pcam->act_sdev);
+	if (sdata->actuator_info) {
+		rc = v4l2_device_register_subdev(&pcam->v4l2_dev, act_sdev);
 		if (rc < 0) {
 			D("%s actuator sub device register failed\n",
 			  __func__);
@@ -1540,21 +3810,201 @@
 		}
 	}
 
-	if (pcam->eeprom_sdev) {
-		rc = v4l2_device_register_subdev(&pcam->v4l2_dev,
-			pcam->eeprom_sdev);
-		if (rc < 0) {
-			D("%s eeprom sub device register failed\n", __func__);
-			goto failure;
-		}
-	}
-
 	pcam->vnode_id = vnode_count++;
 	return rc;
 
 failure:
+	kfree(act_sdev);
 	kzfree(pcam);
 	return rc;
 }
 EXPORT_SYMBOL(msm_sensor_register);
 
+static struct switch_dev htccallback_switch = {
+	.name = "htccallback",
+};
+
+static struct kobject *htccallback_obj;
+static struct kobject *camera_attrs_obj;
+
+static uint32_t htccallback_value;
+static uint32_t videochat_value;
+
+static ssize_t htccallback_set(struct device *dev,
+                struct device_attribute *attr, const char *buf, size_t count)
+{
+	char *tmp;
+	htccallback_value = simple_strtoul(buf, &tmp, 0);
+
+	switch_set_state(&htccallback_switch, htccallback_value);
+
+       pr_info("htccallback_value = %d\n", htccallback_value);
+
+       return count;
+}
+
+static ssize_t videochat_get(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	ssize_t length;
+	length = sprintf(buf, "%d\n", videochat_value);
+	return length;
+}
+
+static ssize_t videochat_set(struct device *dev,
+		struct device_attribute *attr, const char *buf, size_t count)
+{
+	uint32_t tmp = 0;
+
+	if (buf[1] == '\n')
+		tmp = buf[0] - 0x30;
+
+	videochat_value = tmp;
+	pr_info("videochat_value = %d\n", videochat_value);
+	return count;
+}
+
+static DEVICE_ATTR(htccallback, 0660,
+    NULL,
+    htccallback_set);
+
+static DEVICE_ATTR(videochat, 0660,
+    videochat_get,
+    videochat_set);
+
+static int msm_camera_sysfs_init(void)
+{
+	int ret = 0;
+	pr_info("htccallback:kobject creat and add\n");
+
+       htccallback_obj = kobject_create_and_add("camera_htccallback", NULL);
+       if (htccallback_obj == NULL) {
+              pr_info("htccallback: subsystem_register_htccallback failed\n");
+              ret = -ENOMEM;
+              goto error;
+       }
+
+       ret = sysfs_create_file(htccallback_obj,
+                  &dev_attr_htccallback.attr);
+	if (ret) {
+		pr_info("htccallback: sysfs_create_htccallback_file failed\n");
+		ret = -EFAULT;
+		goto error;
+	}
+	if (switch_dev_register(&htccallback_switch) < 0) {
+		pr_info("htccallback : switch_dev_register error\n");
+	}
+
+
+	pr_info("camera_attrs:kobject creat and add\n");
+
+       camera_attrs_obj = kobject_create_and_add("camera_attrs", NULL);
+       if (camera_attrs_obj == NULL) {
+              pr_info("camera_attrs: subsystem_register_camera_attrs failed\n");
+              ret = -ENOMEM;
+              goto error;
+       }
+
+       ret = sysfs_create_file(camera_attrs_obj,
+                  &dev_attr_videochat.attr);
+	if (ret) {
+		pr_info("dev_attr_videochat: sysfs_create_dev attr_videochat file failed\n");
+		ret = -EFAULT;
+		goto error;
+	}
+
+	return ret;
+error:
+	kobject_del(htccallback_obj);
+	kobject_del(camera_attrs_obj);
+	return ret;
+}
+extern int system_rev;
+
+static int __devinit msm_camera_probe(struct platform_device *pdev)
+{
+	int rc = 0, i;
+
+	pr_info("system rev = %d",system_rev);
+	g_server_dev.config_info.num_config_nodes = 1;
+
+	rc = msm_isp_init_module(g_server_dev.config_info.num_config_nodes);
+	if (rc < 0) {
+		pr_err("Failed to initialize isp\n");
+		return rc;
+	}
+
+	if (!msm_class) {
+		rc = alloc_chrdev_region(&msm_devno, 0,
+		g_server_dev.config_info.num_config_nodes+1, "msm_camera");
+		if (rc < 0) {
+			pr_err("%s: failed to allocate chrdev: %d\n", __func__,
+			rc);
+			return rc;
+		}
+
+		msm_class = class_create(THIS_MODULE, "msm_camera");
+		if (IS_ERR(msm_class)) {
+			rc = PTR_ERR(msm_class);
+			pr_err("%s: create device class failed: %d\n",
+			__func__, rc);
+			return rc;
+		}
+	}
+
+	D("creating server and config nodes\n");
+	rc = msm_setup_server_dev(pdev);
+	if (rc < 0) {
+		pr_err("%s: failed to create server dev: %d\n", __func__,
+		rc);
+		return rc;
+	}
+
+	for (i = 0; i < g_server_dev.config_info.num_config_nodes; i++) {
+		rc = msm_setup_config_dev(i, "config");
+		if (rc < 0) {
+			pr_err("%s:failed to create config dev: %d\n",
+			 __func__, rc);
+			return rc;
+		}
+	}
+
+	msm_camera_sysfs_init();
+
+#ifdef CONFIG_PERFLOCK
+	perf_lock_init(&g_server_dev.cam_perf_lock, TYPE_PERF_LOCK, PERF_LOCK_HIGHEST, "camera_v4l2");
+#endif
+
+	msm_isp_register(&g_server_dev);
+	return rc;
+}
+
+static int __exit msm_camera_exit(struct platform_device *pdev)
+{
+	msm_isp_unregister(&g_server_dev);
+	return 0;
+}
+
+
+static struct platform_driver msm_cam_server_driver = {
+	.probe = msm_camera_probe,
+	.remove = msm_camera_exit,
+	.driver = {
+		.name = "msm_cam_server",
+		.owner = THIS_MODULE,
+	},
+};
+
+static int __init msm_camera_init(void)
+{
+	return platform_driver_register(&msm_cam_server_driver);
+}
+
+static void __exit msm_cam_server_exit(void)
+{
+	platform_driver_unregister(&msm_cam_server_driver);	
+}
+
+module_init(msm_camera_init);
+module_exit(msm_cam_server_exit);
+
diff --git a/drivers/media/video/msm/msm.h b/drivers/media/video/msm/msm.h
index 380fdd1..8c2f598 100644
--- a/drivers/media/video/msm/msm.h
+++ b/drivers/media/video/msm/msm.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -16,11 +16,10 @@
 
 #ifdef __KERNEL__
 
-/* Header files */
+#include <linux/wakelock.h>
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <linux/pm_qos.h>
-#include <linux/wakelock.h>
 #include <media/v4l2-dev.h>
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-device.h>
@@ -31,25 +30,23 @@
 #include <media/videobuf2-msm-mem.h>
 #include <media/msm_isp.h>
 #include <mach/camera.h>
-#include <mach/iommu.h>
 #include <media/msm_isp.h>
 #include <linux/msm_ion.h>
-#include <linux/iommu.h>
 #include <media/msm_gestures.h>
+#include <linux/iommu.h>
+
+#ifdef CONFIG_PERFLOCK
+#include <mach/perflock.h>
+#endif
 
 #define MSM_V4L2_DIMENSION_SIZE 96
 #define MAX_DEV_NAME_LEN 50
 
-#define ERR_USER_COPY(to) pr_err("%s(%d): copy %s user\n", \
+#define ERR_USER_COPY(to) pr_debug("%s(%d): copy %s user\n", \
 				__func__, __LINE__, ((to) ? "to" : "from"))
 #define ERR_COPY_FROM_USER() ERR_USER_COPY(0)
 #define ERR_COPY_TO_USER() ERR_USER_COPY(1)
 
-#define COPY_FROM_USER(error, dest, src, size) \
-	(error = (copy_from_user(dest, src, size) ? -EFAULT : 0))
-#define COPY_TO_USER(error, dest, src, size) \
-	(error = (copy_to_user(dest, src, size) ? -EFAULT : 0))
-
 #define MSM_CSIPHY_DRV_NAME "msm_csiphy"
 #define MSM_CSID_DRV_NAME "msm_csid"
 #define MSM_CSIC_DRV_NAME "msm_csic"
@@ -57,26 +54,28 @@
 #define MSM_VFE_DRV_NAME "msm_vfe"
 #define MSM_VPE_DRV_NAME "msm_vpe"
 #define MSM_GEMINI_DRV_NAME "msm_gemini"
-#define MSM_MERCURY_DRV_NAME "msm_mercury"
-#define MSM_JPEG_DRV_NAME "msm_jpeg"
 #define MSM_I2C_MUX_DRV_NAME "msm_cam_i2c_mux"
-#define MSM_IRQ_ROUTER_DRV_NAME "msm_cam_irq_router"
-#define MSM_CPP_DRV_NAME "msm_cpp"
-#define MSM_CCI_DRV_NAME "msm_cci"
-
-#define MAX_NUM_SENSOR_DEV 3
 #define MAX_NUM_CSIPHY_DEV 3
-#define MAX_NUM_CSID_DEV 4
+#define MAX_NUM_CSID_DEV 3
 #define MAX_NUM_CSIC_DEV 3
 #define MAX_NUM_ISPIF_DEV 1
 #define MAX_NUM_VFE_DEV 2
 #define MAX_NUM_AXI_DEV 2
 #define MAX_NUM_VPE_DEV 1
-#define MAX_NUM_JPEG_DEV 3
-#define MAX_NUM_CPP_DEV 1
-#define MAX_NUM_CCI_DEV 1
 
-/* msm queue management APIs*/
+enum msm_cam_subdev_type {
+	CSIPHY_DEV,
+	CSID_DEV,
+	CSIC_DEV,
+	ISPIF_DEV,
+	VFE_DEV,
+	AXI_DEV,
+	VPE_DEV,
+	SENSOR_DEV,
+	GESTURE_DEV,
+};
+
+
 
 #define msm_dequeue(queue, member) ({	   \
 	unsigned long flags;		  \
@@ -102,7 +101,6 @@
 		qcmd = list_first_entry(&__q->list,   \
 			struct msm_queue_cmd, member);	\
 			list_del_init(&qcmd->member);	 \
-			kfree(qcmd->command);		\
 			free_qcmd(qcmd);		\
 	 };			  \
 	spin_unlock_irqrestore(&__q->lock, flags);	\
@@ -120,13 +118,10 @@
 	uint32_t    id;
 	uint32_t    buffer;
 	uint32_t    frameCounter;
-	int32_t     buf_idx;
-	int32_t     fd;
 };
 
 struct msm_free_buf {
 	uint8_t num_planes;
-	uint32_t inst_handle;
 	uint32_t ch_paddr[VIDEO_MAX_PLANES];
 	uint32_t vb;
 };
@@ -142,33 +137,28 @@
 	uint32_t  frameCounter;
 };
 
-struct rdi_count_msg {
-	uint32_t rdi_interface;
-	uint32_t count;
-};
-
-/* message id for v4l2_subdev_notify*/
 enum msm_camera_v4l2_subdev_notify {
-	NOTIFY_ISP_MSG_EVT, /* arg = enum ISP_MESSAGE_ID */
-	NOTIFY_VFE_MSG_OUT, /* arg = struct isp_msg_output */
-	NOTIFY_VFE_MSG_STATS,  /* arg = struct isp_msg_stats */
-	NOTIFY_VFE_MSG_COMP_STATS, /* arg = struct msm_stats_buf */
-	NOTIFY_VFE_BUF_EVT, /* arg = struct msm_vfe_resp */
-	NOTIFY_VFE_CAMIF_ERROR,
-	NOTIFY_VFE_PIX_SOF_COUNT, /*arg = int*/
-	NOTIFY_AXI_RDI_SOF_COUNT, /*arg = struct rdi_count_msg*/
-	NOTIFY_PCLK_CHANGE, /* arg = pclk */
+	NOTIFY_CID_CHANGE, 
+	NOTIFY_ISP_MSG_EVT, 
+	NOTIFY_VFE_MSG_OUT, 
+	NOTIFY_VFE_MSG_STATS,  
+	NOTIFY_VFE_MSG_COMP_STATS, 
+	NOTIFY_VFE_BUF_EVT, 
+	NOTIFY_ISPIF_STREAM, 
+	NOTIFY_VPE_MSG_EVT,
+	NOTIFY_PCLK_CHANGE, 
+	NOTIFY_CSIPHY_CFG, 
+	NOTIFY_CSID_CFG, 
+	NOTIFY_CSIC_CFG, 
+	NOTIFY_VFE_BUF_FREE_EVT, 
 	NOTIFY_VFE_IRQ,
 	NOTIFY_AXI_IRQ,
-	NOTIFY_GESTURE_EVT, /* arg = v4l2_event */
-	NOTIFY_GESTURE_CAM_EVT, /* arg = int */
+	NOTIFY_GESTURE_EVT, 
+	NOTIFY_GESTURE_CAM_EVT, 
 	NOTIFY_INVALID
 };
 
 enum isp_vfe_cmd_id {
-	/*
-	*Important! Command_ID are arranged in order.
-	*Don't change!*/
 	ISP_VFE_CMD_ID_STREAM_ON,
 	ISP_VFE_CMD_ID_STREAM_OFF,
 	ISP_VFE_CMD_ID_FRAME_BUF_RELEASE
@@ -176,7 +166,7 @@
 
 struct msm_cam_v4l2_device;
 struct msm_cam_v4l2_dev_inst;
-#define MSM_MAX_IMG_MODE                MSM_V4L2_EXT_CAPTURE_MODE_MAX
+#define MSM_MAX_IMG_MODE                8
 
 enum msm_buffer_state {
 	MSM_BUFFER_STATE_UNUSED,
@@ -187,9 +177,8 @@
 	MSM_BUFFER_STATE_DEQUEUED
 };
 
-/* buffer for one video frame */
 struct msm_frame_buffer {
-	/* common v4l buffer stuff -- must be first */
+	
 	struct vb2_buffer         vidbuf;
 	struct list_head		  list;
 	enum v4l2_mbus_pixelcode  pxlcode;
@@ -206,40 +195,11 @@
 	enum v4l2_colorspace colorspace;
 };
 
-struct msm_cam_return_frame_info {
-	int dirty;
-	int node_type;
-	struct timeval timestamp;
-	uint32_t frame_id;
-};
-
-struct msm_cam_timestamp {
-	uint8_t present;
-	struct timeval timestamp;
-	uint32_t frame_id;
-};
-
-struct msm_cam_buf_map_info {
-	int fd;
-	uint32_t data_offset;
-	unsigned long paddr;
-	unsigned long len;
-	struct file *file;
-	struct ion_handle *handle;
-};
-
-struct msm_cam_meta_frame {
-	struct msm_pp_frame frame;
-	/* Mapping information per plane */
-	struct msm_cam_buf_map_info map[VIDEO_MAX_PLANES];
-};
-
 struct msm_mctl_pp_frame_info {
 	int user_cmd;
-	struct msm_cam_meta_frame src_frame;
-	struct msm_cam_meta_frame dest_frame;
+	struct msm_pp_frame src_frame;
+	struct msm_pp_frame dest_frame;
 	struct msm_mctl_pp_frame_cmd pp_frame_cmd;
-	struct msm_cam_media_controller *p_mctl;
 };
 
 struct msm_mctl_pp_ctrl {
@@ -256,12 +216,6 @@
 	struct msm_mctl_pp_ctrl pp_ctrl;
 
 };
-/* "Media Controller" represents a camera steaming session,
- * which consists of a "sensor" device and an "isp" device
- * (such as VFE, if needed), connected via an "IO" device,
- * (such as IPIF on 8960, or none on 8660) plus other extra
- * sub devices such as VPE and flash.
- */
 
 struct msm_cam_media_controller {
 
@@ -270,59 +224,81 @@
 	int (*mctl_cb)(void);
 	int (*mctl_cmd)(struct msm_cam_media_controller *p_mctl,
 					unsigned int cmd, unsigned long arg);
-	void (*mctl_release)(struct msm_cam_media_controller *p_mctl);
+	int (*mctl_release)(struct msm_cam_media_controller *p_mctl);
 	int (*mctl_buf_init)(struct msm_cam_v4l2_dev_inst *pcam);
 	int (*mctl_vbqueue_init)(struct msm_cam_v4l2_dev_inst *pcam,
 				struct vb2_queue *q, enum v4l2_buf_type type);
 	int (*mctl_ufmt_init)(struct msm_cam_media_controller *p_mctl);
-	int (*isp_config)(struct msm_cam_media_controller *pmctl,
-		 unsigned int cmd, unsigned long arg);
-	int (*isp_notify)(struct msm_cam_media_controller *pmctl,
-		struct v4l2_subdev *sd, unsigned int notification, void *arg);
+ 	struct v4l2_subdev *sensor_sdev; 
 
-	/* the following reflect the HW topology information*/
-	struct v4l2_subdev *sensor_sdev; /* sensor sub device */
-	struct v4l2_subdev *act_sdev; /* actuator sub device */
-	struct v4l2_subdev *csiphy_sdev; /*csiphy sub device*/
-	struct v4l2_subdev *csid_sdev; /*csid sub device*/
-	struct v4l2_subdev *csic_sdev; /*csid sub device*/
-	struct v4l2_subdev *ispif_sdev; /* ispif sub device */
-	struct v4l2_subdev *gemini_sdev; /* gemini sub device */
-	struct v4l2_subdev *vpe_sdev; /* vpe sub device */
-	struct v4l2_subdev *axi_sdev; /* axi sub device */
-	struct v4l2_subdev *vfe_sdev; /* vfe sub device */
-	struct v4l2_subdev *eeprom_sdev; /* eeprom sub device */
-	struct v4l2_subdev *cpp_sdev;/*cpp sub device*/
+	struct v4l2_subdev *csiphy_sdev; 
+	struct v4l2_subdev *csid_sdev; 
+	struct v4l2_subdev *csic_sdev; 
+	struct v4l2_subdev *ispif_sdev; 
+	struct v4l2_subdev *act_sdev; 
+	struct v4l2_subdev *gemini_sdev; 
+	struct v4l2_subdev *vpe_sdev; 
+	struct v4l2_subdev *axi_sdev; 
 
+	struct msm_isp_ops *isp_sdev;	 
 	struct msm_cam_config_dev *config_device;
 
-	/*mctl session control information*/
-	uint8_t opencnt; /*mctl ref count*/
-	const char *apps_id; /*ID for app that open this session*/
+	
+	uint8_t opencnt; 
+	const char *apps_id; 
 	struct mutex lock;
-	struct wake_lock wake_lock; /*avoid low power mode when active*/
+	
+	
+	struct wake_lock wake_lock_suspend;
+
 	struct pm_qos_request pm_qos_req_list;
 	struct msm_mctl_pp_info pp_info;
-	struct msm_mctl_stats_t stats_info; /*stats pmem info*/
-	uint32_t vfe_output_mode; /* VFE output mode */
+	struct msm_mctl_stats_t stats_info; 
+	uint32_t vfe_output_mode; 
+
 	struct ion_client *client;
 	struct kref refcount;
+	atomic_t dropframe_enabled;
+	atomic_t snap_dropframe_num; 
+	atomic_t snap_dropframe; 
 
-	/*pcam ptr*/
+	
 	struct msm_cam_v4l2_device *pcam_ptr;
 
-	/*sensor info*/
+	
 	struct msm_camera_sensor_info *sdata;
+	struct msm_actuator_ctrl *actctrl;
 
-	/*IOMMU mapped IMEM addresses*/
+
+	
 	uint32_t ping_imem_y;
 	uint32_t ping_imem_cbcr;
 	uint32_t pong_imem_y;
 	uint32_t pong_imem_cbcr;
 
-	/*IOMMU domain for this session*/
-	int domain_num;
-	struct iommu_domain *domain;
+#ifdef CONFIG_PERFLOCK
+	struct perf_lock *cam_perf_lock;
+#endif
+};
+
+struct msm_isp_ops {
+	char *config_dev_name;
+
+	
+	int (*isp_open)(struct v4l2_subdev *sd,
+		struct msm_cam_media_controller *mctl);
+	int (*isp_config)(struct msm_cam_media_controller *pmctl,
+		 unsigned int cmd, unsigned long arg);
+	int (*isp_notify)(struct v4l2_subdev *sd,
+		unsigned int notification, void *arg);
+	void (*isp_release)(struct msm_cam_media_controller *mctl,
+		struct v4l2_subdev *sd);
+	int (*isp_pp_cmd)(struct msm_cam_media_controller *pmctl,
+		 struct msm_mctl_pp_cmd, void *data);
+
+	
+	struct v4l2_subdev *sd;
+	struct v4l2_subdev *sd_vpe;
 };
 
 struct msm_isp_buf_info {
@@ -335,21 +311,21 @@
 	uint32_t data_offset;
 };
 
-#define MSM_DEV_INST_MAX                    24
+#define MSM_DEV_INST_MAX                    16
 struct msm_cam_v4l2_dev_inst {
 	struct v4l2_fh  eventHandle;
 	struct vb2_queue vid_bufq;
 	spinlock_t vq_irqlock;
 	struct list_head free_vq;
 	struct v4l2_format vid_fmt;
-	/* sensor pixel code*/
+	
 	enum v4l2_mbus_pixelcode sensor_pxlcode;
 	struct msm_cam_v4l2_device *pcam;
 	int my_index;
-	uint32_t image_mode;
+	int image_mode;
 	int path;
 	int buf_count;
-	/* buffer offsets, if any */
+	
 	struct msm_cam_buf_offset **buf_offset;
 	struct v4l2_crop crop;
 	int streamon;
@@ -357,13 +333,12 @@
 	int is_mem_map_inst;
 	struct img_plane_info plane_info;
 	int vbqueue_initialized;
-	struct mutex inst_lock;
-	uint32_t inst_handle;
-	uint32_t sequence;
+    struct mutex inst_lock;
+	int no_free_buf_cnt; 
 };
 
 struct msm_cam_mctl_node {
-	/* MCTL V4l2 device */
+	
 	struct v4l2_device v4l2_dev;
 	struct video_device *pvdev;
 	struct msm_cam_v4l2_dev_inst *dev_inst[MSM_DEV_INST_MAX];
@@ -373,75 +348,58 @@
 	int use_count;
 };
 
-/* abstract camera device for each sensor successfully probed*/
 struct msm_cam_v4l2_device {
-
-	/* device node information */
+	
 	int vnode_id;
-	struct v4l2_device v4l2_dev; /* V4l2 device */
-	struct video_device *pvdev; /* registered as /dev/video*/
-	struct msm_cam_mctl_node mctl_node; /* node for buffer management */
-	struct media_device media_dev; /* node to get video node info*/
+	struct v4l2_device v4l2_dev; 
+	struct video_device *pvdev; 
+	struct msm_cam_mctl_node mctl_node; 
+	struct media_device media_dev; 
 
-	/* device session information */
+	
 	int use_count;
+
+
 	struct mutex vid_lock;
 	uint32_t server_queue_idx;
 	uint32_t mctl_handle;
+
 	struct msm_cam_v4l2_dev_inst *dev_inst[MSM_DEV_INST_MAX];
 	struct msm_cam_v4l2_dev_inst *dev_inst_map[MSM_MAX_IMG_MODE];
 	int op_mode;
 
-	/* v4l2 format support */
+	
 	struct msm_isp_color_fmt *usr_fmts;
 	int num_fmts;
 
-	struct v4l2_subdev *sensor_sdev; /* sensor sub device */
-	struct v4l2_subdev *act_sdev; /* actuator sub device */
-	struct v4l2_subdev *eeprom_sdev; /* actuator sub device */
+	struct v4l2_subdev *sensor_sdev; 
+	struct v4l2_subdev *act_sdev; 
 	struct msm_camera_sensor_info *sdata;
+	struct msm_actuator_ctrl actctrl;
 
-	struct msm_device_queue eventData_q; /*payload for events sent to app*/
-	struct mutex event_lock;
 };
-
 static inline struct msm_cam_v4l2_device *to_pcam(
 	struct v4l2_device *v4l2_dev)
 {
 	return container_of(v4l2_dev, struct msm_cam_v4l2_device, v4l2_dev);
 }
 
-/*pseudo v4l2 device and v4l2 event queue
-  for server and config cdevs*/
 struct v4l2_queue_util {
 	struct video_device *pvdev;
 	struct v4l2_fh  eventHandle;
 };
 
-/* abstract config device for all sensor successfully probed*/
 struct msm_cam_config_dev {
 	struct cdev config_cdev;
 	struct v4l2_queue_util config_stat_event_queue;
 	int use_count;
+	
 	struct msm_cam_media_controller *p_mctl;
 	struct msm_mem_map_info mem_map;
-	int dev_num;
-	int domain_num;
-	struct iommu_domain *domain;
 };
-
-struct msm_cam_subdev_info {
-	uint8_t sdev_type;
-	/* Subdev index. For eg: CSIPHY0, CSIPHY1 etc */
-	uint8_t sd_index;
-	/* This device/subdev's interrupt number, assigned
-	 * from the hardware document. */
-	uint8_t irq_num;
-};
-
-/* 2 for camera, 1 for gesture */
 #define MAX_NUM_ACTIVE_CAMERA 3
 
+
 struct msm_cam_server_queue {
 	uint32_t queue_active;
 	struct msm_device_queue ctrl_q;
@@ -455,169 +413,57 @@
 	uint32_t handle;
 };
 
-struct msm_cam_server_irqmap_entry {
-	int irq_num;
-	int irq_idx;
-	uint8_t cam_hw_idx;
-	uint8_t is_composite;
-};
 
-struct intr_table_entry {
-	/* irq_num as understood by msm.
-	 * Unique for every camera hw core & target. Use a mapping function
-	 * to map this irq number to its equivalent index in camera side. */
-	int irq_num;
-	/* Camera hw core idx, in case of non-composite IRQs*/
-	uint8_t cam_hw_idx;
-	/* Camera hw core mask, in case of composite IRQs. */
-	uint32_t cam_hw_mask;
-	/* Each interrupt is mapped to an index, which is used
-	 * to add/delete entries into the lookup table. Both the information
-	 * are needed in the lookup table to avoid another subdev call into
-	 * the IRQ Router subdev to get the irq_idx in the interrupt context */
-	int irq_idx;
-	/* Is this irq composite? */
-	uint8_t is_composite;
-	/* IRQ Trigger type: TRIGGER_RAISING, TRIGGER_HIGH, etc. */
-	uint32_t irq_trigger_type;
-	/* If IRQ Router hw is present,
-	 * this field holds the number of camera hw core
-	 * which are bundled together in the above
-	 * interrupt. > 1 in case of composite irqs.
-	 * If IRQ Router hw is not present, this field should be set to 1. */
-	int num_hwcore;
-	/* Pointers to the subdevs composited in this
-	 * irq. If not composite, the 0th index stores the subdev to which
-	 * this irq needs to be dispatched to. */
-	struct v4l2_subdev *subdev_list[CAMERA_SS_IRQ_MAX];
-	/* Device requesting the irq. */
-	const char *dev_name;
-	/* subdev private data, if any */
-	void *data;
-};
-
-struct irqmgr_intr_lkup_table {
-	/* Individual(hw) interrupt lookup table:
-	 * This table is populated during initialization and doesnt
-	 * change, unless the IRQ Router has been configured
-	 * for composite IRQs. If the IRQ Router has been configured
-	 * for composite IRQs, the is_composite field of that IRQ will
-	 * be set to 1(default 0). And when there is an interrupt on
-	 * that line, the composite interrupt lookup table is used
-	 * for handling the interrupt. */
-	struct intr_table_entry ind_intr_tbl[CAMERA_SS_IRQ_MAX];
-
-	/* Composite interrupt lookup table:
-	 * This table can be dynamically modified based on the usecase.
-	 * If the usecase requires two or more HW core IRQs to be bundled
-	 * into a single composite IRQ, then this table is populated
-	 * accordingly. Also when this is done, the composite field
-	 * in the intr_lookup_table has to be updated to reflect that
-	 * the irq 'irq_num' will now  be triggered in composite mode. */
-	struct intr_table_entry comp_intr_tbl[CAMERA_SS_IRQ_MAX];
-};
-
-struct interface_map {
-	/* The interface a particular stream belongs to.
-	 * PIX0, RDI0, RDI1, or RDI2
-	 */
-	int interface;
-	/* The handle of the mctl instance, interface runs on */
-	uint32_t mctl_handle;
-	int vnode_id;
-	int is_bayer_sensor;
-};
-
-/* abstract camera server device for all sensor successfully probed*/
 struct msm_cam_server_dev {
 
-	/* config node device*/
+	
 	struct platform_device *server_pdev;
-	/* server node v4l2 device */
+	
 	struct v4l2_device v4l2_dev;
 	struct video_device *video_dev;
 	struct media_device media_dev;
 
-	/* info of sensors successfully probed*/
+	
 	struct msm_camera_info camera_info;
-	/* info of configs successfully created*/
+	
 	struct msm_cam_config_dev_info config_info;
-	/* active working camera device - only one allowed at this time*/
-	struct msm_cam_v4l2_device *pcam_active[MAX_NUM_ACTIVE_CAMERA];
-	/* save the opened pcam for finding the mctl when doing buf lookup */
-	struct msm_cam_v4l2_device *opened_pcam[MAX_NUM_ACTIVE_CAMERA];
-	/* number of camera devices opened*/
+	
+	struct msm_cam_v4l2_device *pcam_active;
+	
 	atomic_t number_pcam_active;
 	struct v4l2_queue_util server_command_queue;
-
-	/* This queue used by the config thread to send responses back to the
-	 * control thread.  It is accessed only from a process context.
-	 */
 	struct msm_cam_server_queue server_queue[MAX_NUM_ACTIVE_CAMERA];
 	uint32_t server_evt_id;
-
 	struct msm_cam_server_mctl_inst mctl[MAX_NUM_ACTIVE_CAMERA];
 	uint32_t mctl_handle_cnt;
-
-	struct interface_map interface_map_table[INTF_MAX];
-
+	
 	int use_count;
-	/* all the registered ISP subdevice*/
+	
 	struct msm_isp_ops *isp_subdev[MSM_MAX_CAMERA_CONFIGS];
-	/* info of MCTL nodes successfully probed*/
+	
 	struct msm_mctl_node_info mctl_node_info;
 	struct mutex server_lock;
 	struct mutex server_queue_lock;
-	/*v4l2 subdevs*/
-	struct v4l2_subdev *sensor_device[MAX_NUM_SENSOR_DEV];
+	
 	struct v4l2_subdev *csiphy_device[MAX_NUM_CSIPHY_DEV];
 	struct v4l2_subdev *csid_device[MAX_NUM_CSID_DEV];
 	struct v4l2_subdev *csic_device[MAX_NUM_CSIC_DEV];
-	struct v4l2_subdev *ispif_device[MAX_NUM_ISPIF_DEV];
+	struct v4l2_subdev *ispif_device;
 	struct v4l2_subdev *vfe_device[MAX_NUM_VFE_DEV];
 	struct v4l2_subdev *axi_device[MAX_NUM_AXI_DEV];
 	struct v4l2_subdev *vpe_device[MAX_NUM_VPE_DEV];
 	struct v4l2_subdev *gesture_device;
-	struct v4l2_subdev *cpp_device[MAX_NUM_CPP_DEV];
-	struct v4l2_subdev *irqr_device;
-	struct v4l2_subdev *cci_device;
 
-	spinlock_t  intr_table_lock;
-	struct irqmgr_intr_lkup_table irq_lkup_table;
-	/* Stores the pointer to the subdev when the individual
-	 * subdevices register themselves with the server. This
-	 * will be used while dispatching composite irqs. The
-	 * cam_hw_idx will serve as the index into this array to
-	 * dispatch the irq to the corresponding subdev. */
-	struct v4l2_subdev *subdev_table[MSM_CAM_HW_MAX];
-	struct msm_cam_server_irqmap_entry hw_irqmap[CAMERA_SS_IRQ_MAX];
-
-    /*IOMMU domain (Page table)*/
-	int domain_num;
-	struct iommu_domain *domain;
+#ifdef CONFIG_PERFLOCK
+	struct perf_lock cam_perf_lock;
+#endif
 };
 
-enum msm_cam_buf_lookup_type {
-	BUF_LOOKUP_INVALID,
-	BUF_LOOKUP_BY_IMG_MODE,
-	BUF_LOOKUP_BY_INST_HANDLE,
-};
 
-struct msm_cam_buf_handle {
-	uint16_t buf_lookup_type;
-	uint32_t image_mode;
-	uint32_t inst_handle;
-};
 
-/* ISP related functions */
 void msm_isp_vfe_dev_init(struct v4l2_subdev *vd);
-int msm_isp_config(struct msm_cam_media_controller *pmctl,
-			 unsigned int cmd, unsigned long arg);
-int msm_isp_notify(struct msm_cam_media_controller *pmctl,
-	struct v4l2_subdev *sd, unsigned int notification, void *arg);
-/*
-int msm_isp_register(struct msm_cam_v4l2_device *pcam);
-*/
+int msm_isp_register(struct msm_cam_server_dev *psvr);
+void msm_isp_unregister(struct msm_cam_server_dev *psvr);
 int msm_sensor_register(struct v4l2_subdev *);
 int msm_isp_init_module(int g_num_config_nodes);
 
@@ -626,116 +472,123 @@
 int msm_mctl_buf_init(struct msm_cam_v4l2_device *pcam);
 int msm_mctl_init_user_formats(struct msm_cam_v4l2_device *pcam);
 int msm_mctl_buf_done(struct msm_cam_media_controller *pmctl,
-	struct msm_cam_buf_handle *buf_handle,
-	struct msm_free_buf *buf,
-	uint32_t frame_id);
+			int msg_type, struct msm_free_buf *buf,
+			uint32_t frame_id);
 int msm_mctl_buf_done_pp(struct msm_cam_media_controller *pmctl,
-	struct msm_cam_buf_handle *buf_handle,
-	struct msm_free_buf *frame,
-	struct msm_cam_return_frame_info *ret_frame);
+	int msg_type, struct msm_free_buf *frame, int dirty, int node_type);
 int msm_mctl_reserve_free_buf(struct msm_cam_media_controller *pmctl,
-	struct msm_cam_v4l2_dev_inst *pcam_inst,
-	struct msm_cam_buf_handle *buf_handle,
-	struct msm_free_buf *free_buf);
+				struct msm_cam_v4l2_dev_inst *pcam_inst,
+				int path, struct msm_free_buf *free_buf);
 int msm_mctl_release_free_buf(struct msm_cam_media_controller *pmctl,
-	struct msm_cam_v4l2_dev_inst *pcam_inst,
-	struct msm_free_buf *free_buf);
-/*Memory(PMEM) functions*/
+				struct msm_cam_v4l2_dev_inst *pcam_inst,
+				int path, struct msm_free_buf *free_buf);
+int msm_mctl_return_free_buf(struct msm_cam_media_controller *pmctl,
+				int path, struct msm_free_buf *free_buf);
 int msm_register_pmem(struct hlist_head *ptype, void __user *arg,
-	struct ion_client *client, int domain_num);
+				struct ion_client *client);
 int msm_pmem_table_del(struct hlist_head *ptype, void __user *arg,
-	struct ion_client *client, int domain_num);
+				struct ion_client *client);
 int msm_pmem_region_get_phy_addr(struct hlist_head *ptype,
 	struct msm_mem_map_info *mem_map, int32_t *phyaddr);
 uint8_t msm_pmem_region_lookup(struct hlist_head *ptype,
 	int pmem_type, struct msm_pmem_region *reg, uint8_t maxcount);
 uint8_t msm_pmem_region_lookup_2(struct hlist_head *ptype,
-	int pmem_type, struct msm_pmem_region *reg,
-	uint8_t maxcount);
+					int pmem_type,
+					struct msm_pmem_region *reg,
+					uint8_t maxcount);
 unsigned long msm_pmem_stats_vtop_lookup(
-	struct msm_cam_media_controller *mctl,
-	unsigned long buffer, int fd);
+				struct msm_cam_media_controller *mctl,
+				unsigned long buffer,
+				int fd);
 unsigned long msm_pmem_stats_ptov_lookup(
 	struct msm_cam_media_controller *mctl,
 	unsigned long addr, int *fd);
 
-int msm_vfe_subdev_init(struct v4l2_subdev *sd);
+int msm_vfe_subdev_init(struct v4l2_subdev *sd,
+			struct msm_cam_media_controller *mctl);
 void msm_vfe_subdev_release(struct v4l2_subdev *sd);
 
 int msm_isp_subdev_ioctl(struct v4l2_subdev *sd,
 	struct msm_vfe_cfg_cmd *cfgcmd, void *data);
-int msm_vpe_subdev_init(struct v4l2_subdev *sd);
+int msm_vpe_subdev_init(struct v4l2_subdev *sd,
+			struct msm_cam_media_controller *mctl);
 int msm_gemini_subdev_init(struct v4l2_subdev *gemini_sd);
-void msm_vpe_subdev_release(struct v4l2_subdev *sd);
+void msm_vpe_subdev_release(void);
 void msm_gemini_subdev_release(struct v4l2_subdev *gemini_sd);
 int msm_mctl_is_pp_msg_type(struct msm_cam_media_controller *p_mctl,
 	int msg_type);
 int msm_mctl_do_pp(struct msm_cam_media_controller *p_mctl,
-	int msg_type, uint32_t y_phy, uint32_t frame_id);
+			int msg_type, uint32_t y_phy, uint32_t frame_id);
 int msm_mctl_pp_ioctl(struct msm_cam_media_controller *p_mctl,
-	unsigned int cmd, unsigned long arg);
+			unsigned int cmd, unsigned long arg);
 int msm_mctl_pp_notify(struct msm_cam_media_controller *pmctl,
-	struct msm_mctl_pp_frame_info *pp_frame_info);
+			struct msm_mctl_pp_frame_info *pp_frame_info);
 int msm_mctl_img_mode_to_inst_index(struct msm_cam_media_controller *pmctl,
-	int out_type, int node_type);
+					int out_type, int node_type);
 struct msm_frame_buffer *msm_mctl_buf_find(
 	struct msm_cam_media_controller *pmctl,
 	struct msm_cam_v4l2_dev_inst *pcam_inst, int del_buf,
-	struct msm_free_buf *fbuf);
+	int msg_type, struct msm_free_buf *fbuf);
 void msm_mctl_gettimeofday(struct timeval *tv);
+struct msm_frame_buffer *msm_mctl_get_free_buf(
+		struct msm_cam_media_controller *pmctl,
+		int msg_type);
+int msm_mctl_put_free_buf(
+		struct msm_cam_media_controller *pmctl,
+		int msg_type, struct msm_frame_buffer *buf);
 int msm_mctl_check_pp(struct msm_cam_media_controller *p_mctl,
-	int msg_type, int *pp_divert_type, int *pp_type);
+		int msg_type, int *pp_divert_type, int *pp_type);
 int msm_mctl_do_pp_divert(
 	struct msm_cam_media_controller *p_mctl,
-	struct msm_cam_buf_handle *buf_handle,
-	struct msm_free_buf *fbuf,
+	int msg_type, struct msm_free_buf *fbuf,
 	uint32_t frame_id, int pp_type);
+int msm_mctl_buf_del(struct msm_cam_media_controller *pmctl,
+	int msg_type,
+	struct msm_frame_buffer *my_buf);
 int msm_mctl_pp_release_free_frame(
 	struct msm_cam_media_controller *p_mctl,
 	void __user *arg);
 int msm_mctl_pp_reserve_free_frame(
 	struct msm_cam_media_controller *p_mctl,
 	void __user *arg);
-int msm_mctl_set_pp_key(struct msm_cam_media_controller *p_mctl,
+int msm_mctl_pp_return_free_frame(
+	struct msm_cam_media_controller *p_mctl,
 	void __user *arg);
+int msm_mctl_set_pp_key(struct msm_cam_media_controller *p_mctl,
+				void __user *arg);
 int msm_mctl_pp_done(
 	struct msm_cam_media_controller *p_mctl,
 	void __user *arg);
 int msm_mctl_pp_divert_done(
 	struct msm_cam_media_controller *p_mctl,
 	void __user *arg);
-void msm_setup_v4l2_event_queue(struct v4l2_fh *eventHandle,
-	struct video_device *pvdev);
-void msm_destroy_v4l2_event_queue(struct v4l2_fh *eventHandle);
+int msm_setup_v4l2_event_queue(struct v4l2_fh *eventHandle,
+					struct video_device *pvdev);
 int msm_setup_mctl_node(struct msm_cam_v4l2_device *pcam);
 struct msm_cam_v4l2_dev_inst *msm_mctl_get_pcam_inst(
-	struct msm_cam_media_controller *pmctl,
-	struct msm_cam_buf_handle *buf_handle);
+		struct msm_cam_media_controller *pmctl,
+		int image_mode);
 int msm_mctl_buf_return_buf(struct msm_cam_media_controller *pmctl,
-	int image_mode, struct msm_frame_buffer *buf);
-int msm_mctl_map_user_frame(struct msm_cam_meta_frame *meta_frame,
-	struct ion_client *client, int domain_num);
-int msm_mctl_unmap_user_frame(struct msm_cam_meta_frame *meta_frame,
-	struct ion_client *client, int domain_num);
+			int image_mode, struct msm_frame_buffer *buf);
 int msm_mctl_pp_mctl_divert_done(struct msm_cam_media_controller *p_mctl,
-	void __user *arg);
+					void __user *arg);
 void msm_release_ion_client(struct kref *ref);
 int msm_cam_register_subdev_node(struct v4l2_subdev *sd,
-	struct msm_cam_subdev_info *sd_info);
-int msm_mctl_find_sensor_subdevs(struct msm_cam_media_controller *p_mctl,
-	int core_index);
+			enum msm_cam_subdev_type sdev_type, uint8_t index);
+
+#if 1	
+int msm_rawchip_attr_node(void);
+#endif	
+uint32_t msm_camera_get_mctl_handle(void);
+struct msm_cam_media_controller *msm_camera_get_mctl(uint32_t handle);
+void msm_camera_free_mctl(uint32_t handle);
 int msm_server_open_client(int *p_qidx);
 int msm_server_send_ctrl(struct msm_ctrl_cmd *out, int ctrl_id);
 int msm_server_close_client(int idx);
 int msm_cam_server_open_mctl_session(struct msm_cam_v4l2_device *pcam,
 	int *p_active);
 int msm_cam_server_close_mctl_session(struct msm_cam_v4l2_device *pcam);
-long msm_v4l2_evt_notify(struct msm_cam_media_controller *mctl,
-	unsigned int cmd, unsigned long evt);
-int msm_mctl_pp_get_vpe_buf_info(struct msm_mctl_pp_frame_info *zoom);
-void msm_queue_init(struct msm_device_queue *queue, const char *name);
-void msm_enqueue(struct msm_device_queue *queue, struct list_head *entry);
-void msm_drain_eventq(struct msm_device_queue *queue);
-#endif /* __KERNEL__ */
 
-#endif /* _MSM_H */
+#endif 
+
+#endif 
diff --git a/drivers/media/video/msm/msm_axi_qos.c b/drivers/media/video/msm/msm_axi_qos.c
index ac484d3..eaceceb 100644
--- a/drivers/media/video/msm/msm_axi_qos.c
+++ b/drivers/media/video/msm/msm_axi_qos.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
diff --git a/drivers/media/video/msm/msm_camera.c b/drivers/media/video/msm/msm_camera.c
deleted file mode 100644
index fd9dfe9..0000000
--- a/drivers/media/video/msm/msm_camera.c
+++ /dev/null
@@ -1,4128 +0,0 @@
-/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-//FIXME: most allocations need not be GFP_ATOMIC
-/* FIXME: management of mutexes */
-/* FIXME: msm_pmem_region_lookup return values */
-/* FIXME: way too many copy to/from user */
-/* FIXME: does region->active mean free */
-/* FIXME: check limits on command lenghts passed from userspace */
-/* FIXME: __msm_release: which queues should we flush when opencnt != 0 */
-
-#include <linux/slab.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <mach/board.h>
-
-#include <linux/uaccess.h>
-#include <linux/fs.h>
-#include <linux/list.h>
-#include <linux/uaccess.h>
-#include <linux/android_pmem.h>
-#include <linux/poll.h>
-#include <media/msm_camera.h>
-#include <mach/camera.h>
-#include <linux/syscalls.h>
-#include <linux/hrtimer.h>
-#include <linux/msm_ion.h>
-
-#include <mach/cpuidle.h>
-DEFINE_MUTEX(ctrl_cmd_lock);
-
-#define CAMERA_STOP_VIDEO 58
-spinlock_t pp_prev_spinlock;
-spinlock_t pp_stereocam_spinlock;
-spinlock_t st_frame_spinlock;
-
-#define ERR_USER_COPY(to) pr_err("%s(%d): copy %s user\n", \
-				__func__, __LINE__, ((to) ? "to" : "from"))
-#define ERR_COPY_FROM_USER() ERR_USER_COPY(0)
-#define ERR_COPY_TO_USER() ERR_USER_COPY(1)
-#define MAX_PMEM_CFG_BUFFERS 10
-
-static struct class *msm_class;
-static dev_t msm_devno;
-static LIST_HEAD(msm_sensors);
-struct  msm_control_device *g_v4l2_control_device;
-int g_v4l2_opencnt;
-static int camera_node;
-static enum msm_camera_type camera_type[MSM_MAX_CAMERA_SENSORS];
-static uint32_t sensor_mount_angle[MSM_MAX_CAMERA_SENSORS];
-
-struct ion_client *client_for_ion;
-
-static const char *vfe_config_cmd[] = {
-	"CMD_GENERAL",  /* 0 */
-	"CMD_AXI_CFG_OUT1",
-	"CMD_AXI_CFG_SNAP_O1_AND_O2",
-	"CMD_AXI_CFG_OUT2",
-	"CMD_PICT_T_AXI_CFG",
-	"CMD_PICT_M_AXI_CFG",  /* 5 */
-	"CMD_RAW_PICT_AXI_CFG",
-	"CMD_FRAME_BUF_RELEASE",
-	"CMD_PREV_BUF_CFG",
-	"CMD_SNAP_BUF_RELEASE",
-	"CMD_SNAP_BUF_CFG",  /* 10 */
-	"CMD_STATS_DISABLE",
-	"CMD_STATS_AEC_AWB_ENABLE",
-	"CMD_STATS_AF_ENABLE",
-	"CMD_STATS_AEC_ENABLE",
-	"CMD_STATS_AWB_ENABLE",  /* 15 */
-	"CMD_STATS_ENABLE",
-	"CMD_STATS_AXI_CFG",
-	"CMD_STATS_AEC_AXI_CFG",
-	"CMD_STATS_AF_AXI_CFG",
-	"CMD_STATS_AWB_AXI_CFG",  /* 20 */
-	"CMD_STATS_RS_AXI_CFG",
-	"CMD_STATS_CS_AXI_CFG",
-	"CMD_STATS_IHIST_AXI_CFG",
-	"CMD_STATS_SKIN_AXI_CFG",
-	"CMD_STATS_BUF_RELEASE",  /* 25 */
-	"CMD_STATS_AEC_BUF_RELEASE",
-	"CMD_STATS_AF_BUF_RELEASE",
-	"CMD_STATS_AWB_BUF_RELEASE",
-	"CMD_STATS_RS_BUF_RELEASE",
-	"CMD_STATS_CS_BUF_RELEASE",  /* 30 */
-	"CMD_STATS_IHIST_BUF_RELEASE",
-	"CMD_STATS_SKIN_BUF_RELEASE",
-	"UPDATE_STATS_INVALID",
-	"CMD_AXI_CFG_SNAP_GEMINI",
-	"CMD_AXI_CFG_SNAP",  /* 35 */
-	"CMD_AXI_CFG_PREVIEW",
-	"CMD_AXI_CFG_VIDEO",
-	"CMD_STATS_IHIST_ENABLE",
-	"CMD_STATS_RS_ENABLE",
-	"CMD_STATS_CS_ENABLE",  /* 40 */
-	"CMD_VPE",
-	"CMD_AXI_CFG_VPE",
-	"CMD_AXI_CFG_SNAP_VPE",
-	"CMD_AXI_CFG_SNAP_THUMB_VPE",
-};
-#define __CONTAINS(r, v, l, field) ({				\
-	typeof(r) __r = r;					\
-	typeof(v) __v = v;					\
-	typeof(v) __e = __v + l;				\
-	int res = __v >= __r->field &&				\
-		__e <= __r->field + __r->len;			\
-	res;							\
-})
-
-#define CONTAINS(r1, r2, field) ({				\
-	typeof(r2) __r2 = r2;					\
-	__CONTAINS(r1, __r2->field, __r2->len, field);		\
-})
-
-#define IN_RANGE(r, v, field) ({				\
-	typeof(r) __r = r;					\
-	typeof(v) __vv = v;					\
-	int res = ((__vv >= __r->field) &&			\
-		(__vv < (__r->field + __r->len)));		\
-	res;							\
-})
-
-#define OVERLAPS(r1, r2, field) ({				\
-	typeof(r1) __r1 = r1;					\
-	typeof(r2) __r2 = r2;					\
-	typeof(__r2->field) __v = __r2->field;			\
-	typeof(__v) __e = __v + __r2->len - 1;			\
-	int res = (IN_RANGE(__r1, __v, field) ||		\
-		   IN_RANGE(__r1, __e, field));                 \
-	res;							\
-})
-
-static inline void free_qcmd(struct msm_queue_cmd *qcmd)
-{
-	if (!qcmd || !atomic_read(&qcmd->on_heap))
-		return;
-	if (!atomic_sub_return(1, &qcmd->on_heap))
-		kfree(qcmd);
-}
-
-static void msm_region_init(struct msm_sync *sync)
-{
-	INIT_HLIST_HEAD(&sync->pmem_frames);
-	INIT_HLIST_HEAD(&sync->pmem_stats);
-	spin_lock_init(&sync->pmem_frame_spinlock);
-	spin_lock_init(&sync->pmem_stats_spinlock);
-}
-
-static void msm_queue_init(struct msm_device_queue *queue, const char *name)
-{
-	spin_lock_init(&queue->lock);
-	queue->len = 0;
-	queue->max = 0;
-	queue->name = name;
-	INIT_LIST_HEAD(&queue->list);
-	init_waitqueue_head(&queue->wait);
-}
-
-static void msm_enqueue(struct msm_device_queue *queue,
-		struct list_head *entry)
-{
-	unsigned long flags;
-	spin_lock_irqsave(&queue->lock, flags);
-	queue->len++;
-	if (queue->len > queue->max) {
-		queue->max = queue->len;
-		CDBG("%s: queue %s new max is %d\n", __func__,
-			queue->name, queue->max);
-	}
-	list_add_tail(entry, &queue->list);
-	wake_up(&queue->wait);
-	CDBG("%s: woke up %s\n", __func__, queue->name);
-	spin_unlock_irqrestore(&queue->lock, flags);
-}
-
-static void msm_enqueue_vpe(struct msm_device_queue *queue,
-		struct list_head *entry)
-{
-	unsigned long flags;
-	spin_lock_irqsave(&queue->lock, flags);
-	queue->len++;
-	if (queue->len > queue->max) {
-		queue->max = queue->len;
-		CDBG("%s: queue %s new max is %d\n", __func__,
-			queue->name, queue->max);
-	}
-	list_add_tail(entry, &queue->list);
-    CDBG("%s: woke up %s\n", __func__, queue->name);
-	spin_unlock_irqrestore(&queue->lock, flags);
-}
-
-#define msm_dequeue(queue, member) ({				\
-	unsigned long flags;					\
-	struct msm_device_queue *__q = (queue);			\
-	struct msm_queue_cmd *qcmd = 0;				\
-	spin_lock_irqsave(&__q->lock, flags);			\
-	if (!list_empty(&__q->list)) {				\
-		__q->len--;					\
-		qcmd = list_first_entry(&__q->list,		\
-				struct msm_queue_cmd, member);	\
-		if ((qcmd) && (&qcmd->member) && (&qcmd->member.next))	\
-			list_del_init(&qcmd->member);			\
-	}							\
-	spin_unlock_irqrestore(&__q->lock, flags);	\
-	qcmd;							\
-})
-
-#define msm_delete_entry(queue, member, q_cmd) ({		\
-	unsigned long flags;					\
-	struct msm_device_queue *__q = (queue);			\
-	struct msm_queue_cmd *qcmd = 0;				\
-	spin_lock_irqsave(&__q->lock, flags);			\
-	if (!list_empty(&__q->list)) {				\
-		list_for_each_entry(qcmd, &__q->list, member)	\
-		if (qcmd == q_cmd) {				\
-			__q->len--;				\
-			list_del_init(&qcmd->member);		\
-			CDBG("msm_delete_entry, match found\n");\
-			kfree(q_cmd);				\
-			q_cmd = NULL;				\
-			break;					\
-		}						\
-	}							\
-	spin_unlock_irqrestore(&__q->lock, flags);		\
-	q_cmd;		\
-})
-
-#define msm_queue_drain(queue, member) do {			\
-	unsigned long flags;					\
-	struct msm_device_queue *__q = (queue);			\
-	struct msm_queue_cmd *qcmd;				\
-	spin_lock_irqsave(&__q->lock, flags);			\
-	while (!list_empty(&__q->list)) {			\
-		__q->len--;					\
-		qcmd = list_first_entry(&__q->list,		\
-			struct msm_queue_cmd, member);		\
-		if (qcmd) {					\
-			if (&qcmd->member)	\
-				list_del_init(&qcmd->member);		\
-			free_qcmd(qcmd);				\
-		}							\
-	}							\
-	spin_unlock_irqrestore(&__q->lock, flags);		\
-} while (0)
-
-static int check_overlap(struct hlist_head *ptype,
-			unsigned long paddr,
-			unsigned long len)
-{
-	struct msm_pmem_region *region;
-	struct msm_pmem_region t = { .paddr = paddr, .len = len };
-	struct hlist_node *node;
-
-	hlist_for_each_entry(region, node, ptype, list) {
-		if (CONTAINS(region, &t, paddr) ||
-				CONTAINS(&t, region, paddr) ||
-				OVERLAPS(region, &t, paddr)) {
-			CDBG(" region (PHYS %p len %ld)"
-				" clashes with registered region"
-				" (paddr %p len %ld)\n",
-				(void *)t.paddr, t.len,
-				(void *)region->paddr, region->len);
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
-static int check_pmem_info(struct msm_pmem_info *info, int len)
-{
-	if (info->offset < len &&
-	    info->offset + info->len <= len &&
-	    info->planar0_off < len &&
-	    info->planar1_off < len &&
-	    info->planar2_off < len)
-		return 0;
-
-	pr_err("%s: check failed: off %d len %d y 0x%x cbcr_p1 0x%x p2_add 0x%x(total len %d)\n",
-		__func__,
-		info->offset,
-		info->len,
-		info->planar0_off,
-		info->planar1_off,
-		info->planar2_off,
-		len);
-	return -EINVAL;
-}
-static int msm_pmem_table_add(struct hlist_head *ptype,
-	struct msm_pmem_info *info, spinlock_t* pmem_spinlock,
-	struct msm_sync *sync)
-{
-	unsigned long paddr;
-#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
-	struct file *file;
-	unsigned long kvstart;
-#endif
-	unsigned long len;
-	int rc = -ENOMEM;
-	struct msm_pmem_region *region;
-	unsigned long flags;
-
-	region = kmalloc(sizeof(struct msm_pmem_region), GFP_KERNEL);
-	if (!region)
-		goto out;
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-		region->handle = ion_import_dma_buf(client_for_ion, info->fd);
-		if (IS_ERR_OR_NULL(region->handle))
-			goto out1;
-		ion_phys(client_for_ion, region->handle,
-			&paddr, (size_t *)&len);
-#else
-	rc = get_pmem_file(info->fd, &paddr, &kvstart, &len, &file);
-	if (rc < 0) {
-		pr_err("%s: get_pmem_file fd %d error %d\n",
-			__func__,
-			info->fd, rc);
-		goto out1;
-	}
-	region->file = file;
-#endif
-	if (!info->len)
-		info->len = len;
-
-	rc = check_pmem_info(info, len);
-	if (rc < 0)
-		goto out2;
-
-	paddr += info->offset;
-	len = info->len;
-
-	spin_lock_irqsave(pmem_spinlock, flags);
-	if (check_overlap(ptype, paddr, len) < 0) {
-		spin_unlock_irqrestore(pmem_spinlock, flags);
-		rc = -EINVAL;
-		goto out2;
-	}
-	spin_unlock_irqrestore(pmem_spinlock, flags);
-
-	spin_lock_irqsave(pmem_spinlock, flags);
-	INIT_HLIST_NODE(&region->list);
-
-	region->paddr = paddr;
-	region->len = len;
-	memcpy(&region->info, info, sizeof(region->info));
-
-	hlist_add_head(&(region->list), ptype);
-	spin_unlock_irqrestore(pmem_spinlock, flags);
-	CDBG("%s: type %d, paddr 0x%lx, vaddr 0x%lx p0_add = 0x%x"
-		"p1_addr = 0x%x p2_addr = 0x%x\n",
-		__func__, info->type, paddr, (unsigned long)info->vaddr,
-		info->planar0_off, info->planar1_off, info->planar2_off);
-	return 0;
-out2:
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_free(client_for_ion, region->handle);
-#else
-	put_pmem_file(region->file);
-#endif
-out1:
-	kfree(region);
-out:
-	return rc;
-}
-
-/* return of 0 means failure */
-static uint8_t msm_pmem_region_lookup(struct hlist_head *ptype,
-	int pmem_type, struct msm_pmem_region *reg, uint8_t maxcount,
-	spinlock_t *pmem_spinlock)
-{
-	struct msm_pmem_region *region;
-	struct msm_pmem_region *regptr;
-	struct hlist_node *node, *n;
-	unsigned long flags = 0;
-
-	uint8_t rc = 0;
-
-	regptr = reg;
-	spin_lock_irqsave(pmem_spinlock, flags);
-	hlist_for_each_entry_safe(region, node, n, ptype, list) {
-		if (region->info.type == pmem_type && region->info.active) {
-			*regptr = *region;
-			rc += 1;
-			if (rc >= maxcount)
-				break;
-			regptr++;
-		}
-	}
-	spin_unlock_irqrestore(pmem_spinlock, flags);
-	/* After lookup failure, dump all the list entries...*/
-	if (rc == 0) {
-		pr_err("%s: pmem_type = %d\n", __func__, pmem_type);
-		hlist_for_each_entry_safe(region, node, n, ptype, list) {
-			pr_err("listed region->info.type = %d, active = %d",
-				region->info.type, region->info.active);
-		}
-
-	}
-	return rc;
-}
-
-static uint8_t msm_pmem_region_lookup_2(struct hlist_head *ptype,
-					int pmem_type,
-					struct msm_pmem_region *reg,
-					uint8_t maxcount,
-					spinlock_t *pmem_spinlock)
-{
-	struct msm_pmem_region *region;
-	struct msm_pmem_region *regptr;
-	struct hlist_node *node, *n;
-	uint8_t rc = 0;
-	unsigned long flags = 0;
-	regptr = reg;
-	spin_lock_irqsave(pmem_spinlock, flags);
-	hlist_for_each_entry_safe(region, node, n, ptype, list) {
-		CDBG("%s:info.type=%d, pmem_type = %d,"
-						"info.active = %d\n",
-		__func__, region->info.type, pmem_type, region->info.active);
-
-		if (region->info.type == pmem_type && region->info.active) {
-			CDBG("%s:info.type=%d, pmem_type = %d,"
-							"info.active = %d,\n",
-				__func__, region->info.type, pmem_type,
-				region->info.active);
-			*regptr = *region;
-			region->info.type = MSM_PMEM_VIDEO;
-			rc += 1;
-			if (rc >= maxcount)
-				break;
-			regptr++;
-		}
-	}
-	spin_unlock_irqrestore(pmem_spinlock, flags);
-	return rc;
-}
-
-static int msm_pmem_frame_ptov_lookup(struct msm_sync *sync,
-		unsigned long p0addr,
-		unsigned long p1addr,
-		unsigned long p2addr,
-		struct msm_pmem_info *pmem_info,
-		int clear_active)
-{
-	struct msm_pmem_region *region;
-	struct hlist_node *node, *n;
-	unsigned long flags = 0;
-
-	spin_lock_irqsave(&sync->pmem_frame_spinlock, flags);
-	hlist_for_each_entry_safe(region, node, n, &sync->pmem_frames, list) {
-		if (p0addr == (region->paddr + region->info.planar0_off) &&
-			p1addr == (region->paddr + region->info.planar1_off) &&
-			p2addr == (region->paddr + region->info.planar2_off) &&
-			region->info.active) {
-			/* offset since we could pass vaddr inside
-			 * a registerd pmem buffer
-			 */
-			memcpy(pmem_info, &region->info, sizeof(*pmem_info));
-			if (clear_active)
-				region->info.active = 0;
-			spin_unlock_irqrestore(&sync->pmem_frame_spinlock,
-				flags);
-			return 0;
-		}
-	}
-	/* After lookup failure, dump all the list entries... */
-	pr_err("%s, for plane0 addr = 0x%lx, plane1 addr = 0x%lx  plane2 addr = 0x%lx\n",
-			__func__, p0addr, p1addr, p2addr);
-	hlist_for_each_entry_safe(region, node, n, &sync->pmem_frames, list) {
-		pr_err("listed p0addr 0x%lx, p1addr 0x%lx, p2addr 0x%lx, active = %d",
-				(region->paddr + region->info.planar0_off),
-				(region->paddr + region->info.planar1_off),
-				(region->paddr + region->info.planar2_off),
-				region->info.active);
-	}
-
-	spin_unlock_irqrestore(&sync->pmem_frame_spinlock, flags);
-	return -EINVAL;
-}
-
-static int msm_pmem_frame_ptov_lookup2(struct msm_sync *sync,
-		unsigned long p0_phy,
-		struct msm_pmem_info *pmem_info,
-		int clear_active)
-{
-	struct msm_pmem_region *region;
-	struct hlist_node *node, *n;
-	unsigned long flags = 0;
-
-	spin_lock_irqsave(&sync->pmem_frame_spinlock, flags);
-	hlist_for_each_entry_safe(region, node, n, &sync->pmem_frames, list) {
-		if (p0_phy == (region->paddr + region->info.planar0_off) &&
-				region->info.active) {
-			/* offset since we could pass vaddr inside
-			 * a registerd pmem buffer
-			 */
-			memcpy(pmem_info, &region->info, sizeof(*pmem_info));
-			if (clear_active)
-				region->info.active = 0;
-			spin_unlock_irqrestore(&sync->pmem_frame_spinlock,
-				flags);
-			return 0;
-		}
-	}
-
-	spin_unlock_irqrestore(&sync->pmem_frame_spinlock, flags);
-	return -EINVAL;
-}
-
-static unsigned long msm_pmem_stats_ptov_lookup(struct msm_sync *sync,
-		unsigned long addr, int *fd)
-{
-	struct msm_pmem_region *region;
-	struct hlist_node *node, *n;
-	unsigned long flags = 0;
-
-	spin_lock_irqsave(&sync->pmem_stats_spinlock, flags);
-	hlist_for_each_entry_safe(region, node, n, &sync->pmem_stats, list) {
-		if (addr == region->paddr && region->info.active) {
-			/* offset since we could pass vaddr inside a
-			 * registered pmem buffer */
-			*fd = region->info.fd;
-			region->info.active = 0;
-			spin_unlock_irqrestore(&sync->pmem_stats_spinlock,
-				flags);
-			return (unsigned long)(region->info.vaddr);
-		}
-	}
-	/* After lookup failure, dump all the list entries... */
-	pr_err("%s, lookup failure, for paddr 0x%lx\n",
-			__func__, addr);
-	hlist_for_each_entry_safe(region, node, n, &sync->pmem_stats, list) {
-		pr_err("listed paddr 0x%lx, active = %d",
-				region->paddr,
-				region->info.active);
-	}
-	spin_unlock_irqrestore(&sync->pmem_stats_spinlock, flags);
-
-	return 0;
-}
-
-static unsigned long msm_pmem_frame_vtop_lookup(struct msm_sync *sync,
-		unsigned long buffer, uint32_t p0_off, uint32_t p1_off,
-		uint32_t p2_off, int fd, int change_flag)
-{
-	struct msm_pmem_region *region;
-	struct hlist_node *node, *n;
-	unsigned long flags = 0;
-
-	spin_lock_irqsave(&sync->pmem_frame_spinlock, flags);
-	hlist_for_each_entry_safe(region,
-		node, n, &sync->pmem_frames, list) {
-		if (((unsigned long)(region->info.vaddr) == buffer) &&
-				(region->info.planar0_off == p0_off) &&
-				(region->info.planar1_off == p1_off) &&
-				(region->info.planar2_off == p2_off) &&
-				(region->info.fd == fd) &&
-				(region->info.active == 0)) {
-			if (change_flag)
-				region->info.active = 1;
-			spin_unlock_irqrestore(&sync->pmem_frame_spinlock,
-				flags);
-			return region->paddr;
-		}
-	}
-	/* After lookup failure, dump all the list entries... */
-	pr_err("%s, failed for vaddr 0x%lx, p0_off %d p1_off %d\n",
-			__func__, buffer, p0_off, p1_off);
-	hlist_for_each_entry_safe(region, node, n, &sync->pmem_frames, list) {
-		pr_err("%s, listed vaddr 0x%lx, r_p0 = 0x%x p0_off 0x%x"
-			"r_p1 = 0x%x, p1_off 0x%x, r_p2 = 0x%x, p2_off = 0x%x"
-			" active = %d\n", __func__, buffer,
-			region->info.planar0_off,
-			p0_off, region->info.planar1_off,
-			p1_off, region->info.planar2_off, p2_off,
-			region->info.active);
-	}
-
-	spin_unlock_irqrestore(&sync->pmem_frame_spinlock, flags);
-
-	return 0;
-}
-
-static unsigned long msm_pmem_stats_vtop_lookup(
-		struct msm_sync *sync,
-		unsigned long buffer,
-		int fd)
-{
-	struct msm_pmem_region *region;
-	struct hlist_node *node, *n;
-	unsigned long flags = 0;
-
-	spin_lock_irqsave(&sync->pmem_stats_spinlock, flags);
-	hlist_for_each_entry_safe(region, node, n, &sync->pmem_stats, list) {
-		if (((unsigned long)(region->info.vaddr) == buffer) &&
-				(region->info.fd == fd) &&
-				region->info.active == 0) {
-			region->info.active = 1;
-			spin_unlock_irqrestore(&sync->pmem_stats_spinlock,
-				flags);
-			return region->paddr;
-		}
-	}
-	/* After lookup failure, dump all the list entries... */
-	pr_err("%s,look up error for vaddr %ld\n",
-			__func__, buffer);
-	hlist_for_each_entry_safe(region, node, n, &sync->pmem_stats, list) {
-		pr_err("listed vaddr 0x%p, active = %d",
-				region->info.vaddr,
-				region->info.active);
-	}
-	spin_unlock_irqrestore(&sync->pmem_stats_spinlock, flags);
-
-	return 0;
-}
-
-static int __msm_pmem_table_del(struct msm_sync *sync,
-		struct msm_pmem_info *pinfo)
-{
-	int rc = 0;
-	struct msm_pmem_region *region;
-	struct hlist_node *node, *n;
-	unsigned long flags = 0;
-
-	switch (pinfo->type) {
-	case MSM_PMEM_PREVIEW:
-	case MSM_PMEM_THUMBNAIL:
-	case MSM_PMEM_MAINIMG:
-	case MSM_PMEM_RAW_MAINIMG:
-	case MSM_PMEM_C2D:
-	case MSM_PMEM_MAINIMG_VPE:
-	case MSM_PMEM_THUMBNAIL_VPE:
-		spin_lock_irqsave(&sync->pmem_frame_spinlock, flags);
-		hlist_for_each_entry_safe(region, node, n,
-			&sync->pmem_frames, list) {
-
-			if (pinfo->type == region->info.type &&
-					pinfo->vaddr == region->info.vaddr &&
-					pinfo->fd == region->info.fd) {
-				hlist_del(node);
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-				ion_free(client_for_ion, region->handle);
-#else
-				put_pmem_file(region->file);
-#endif
-				kfree(region);
-				CDBG("%s: type %d, vaddr  0x%p\n",
-					__func__, pinfo->type, pinfo->vaddr);
-			}
-		}
-		spin_unlock_irqrestore(&sync->pmem_frame_spinlock, flags);
-		break;
-
-	case MSM_PMEM_VIDEO:
-	case MSM_PMEM_VIDEO_VPE:
-		spin_lock_irqsave(&sync->pmem_frame_spinlock, flags);
-		hlist_for_each_entry_safe(region, node, n,
-			&sync->pmem_frames, list) {
-
-			if (((region->info.type == MSM_PMEM_VIDEO) ||
-				(region->info.type == MSM_PMEM_VIDEO_VPE)) &&
-				pinfo->vaddr == region->info.vaddr &&
-				pinfo->fd == region->info.fd) {
-				hlist_del(node);
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-				ion_free(client_for_ion, region->handle);
-#else
-				put_pmem_file(region->file);
-#endif
-				kfree(region);
-				CDBG("%s: type %d, vaddr  0x%p\n",
-					__func__, pinfo->type, pinfo->vaddr);
-			}
-		}
-		spin_unlock_irqrestore(&sync->pmem_frame_spinlock, flags);
-		break;
-
-	case MSM_PMEM_AEC_AWB:
-	case MSM_PMEM_AF:
-		spin_lock_irqsave(&sync->pmem_stats_spinlock, flags);
-		hlist_for_each_entry_safe(region, node, n,
-			&sync->pmem_stats, list) {
-
-			if (pinfo->type == region->info.type &&
-					pinfo->vaddr == region->info.vaddr &&
-					pinfo->fd == region->info.fd) {
-				hlist_del(node);
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-				ion_free(client_for_ion, region->handle);
-#else
-				put_pmem_file(region->file);
-#endif
-				kfree(region);
-				CDBG("%s: type %d, vaddr  0x%p\n",
-					__func__, pinfo->type, pinfo->vaddr);
-			}
-		}
-		spin_unlock_irqrestore(&sync->pmem_stats_spinlock, flags);
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	return rc;
-}
-
-static int msm_pmem_table_del(struct msm_sync *sync, void __user *arg)
-{
-	struct msm_pmem_info info;
-
-	if (copy_from_user(&info, arg, sizeof(info))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	return __msm_pmem_table_del(sync, &info);
-}
-
-static int __msm_get_frame(struct msm_sync *sync,
-		struct msm_frame *frame)
-{
-	int rc = 0;
-
-	struct msm_pmem_info pmem_info;
-	struct msm_queue_cmd *qcmd = NULL;
-	struct msm_vfe_resp *vdata;
-	struct msm_vfe_phy_info *pphy;
-
-	qcmd = msm_dequeue(&sync->frame_q, list_frame);
-
-	if (!qcmd) {
-		pr_err("%s: no preview frame.\n", __func__);
-		return -EAGAIN;
-	}
-
-	if ((!qcmd->command) && (qcmd->error_code & MSM_CAMERA_ERR_MASK)) {
-		frame->error_code = qcmd->error_code;
-		pr_err("%s: fake frame with camera error code = %d\n",
-			__func__, frame->error_code);
-		goto err;
-	}
-
-	vdata = (struct msm_vfe_resp *)(qcmd->command);
-	pphy = &vdata->phy;
-	CDBG("%s, pphy->p2_phy = 0x%x\n", __func__, pphy->p2_phy);
-
-	rc = msm_pmem_frame_ptov_lookup(sync,
-			pphy->p0_phy,
-			pphy->p1_phy,
-			pphy->p2_phy,
-			&pmem_info,
-			1); /* Clear the active flag */
-
-	if (rc < 0) {
-		pr_err("%s: cannot get frame, invalid lookup address"
-		"plane0 add %x plane1 add %x plane2 add%x\n",
-		__func__,
-		pphy->p0_phy,
-		pphy->p1_phy,
-		pphy->p2_phy);
-		goto err;
-	}
-
-	frame->ts = qcmd->ts;
-	frame->buffer = (unsigned long)pmem_info.vaddr;
-	frame->planar0_off = pmem_info.planar0_off;
-	frame->planar1_off = pmem_info.planar1_off;
-	frame->planar2_off = pmem_info.planar2_off;
-	frame->fd = pmem_info.fd;
-	frame->path = vdata->phy.output_id;
-	frame->frame_id = vdata->phy.frame_id;
-	CDBG("%s: plane0 %x, plane1 %x, plane2 %x,qcmd %x, virt_addr %x\n",
-		__func__, pphy->p0_phy, pphy->p1_phy, pphy->p2_phy,
-		(int) qcmd, (int) frame->buffer);
-
-err:
-	free_qcmd(qcmd);
-	return rc;
-}
-
-static int msm_get_frame(struct msm_sync *sync, void __user *arg)
-{
-	int rc = 0;
-	struct msm_frame frame;
-
-	if (copy_from_user(&frame,
-				arg,
-				sizeof(struct msm_frame))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	rc = __msm_get_frame(sync, &frame);
-	if (rc < 0)
-		return rc;
-
-	mutex_lock(&sync->lock);
-	if (sync->croplen && (!sync->stereocam_enabled)) {
-		if (frame.croplen != sync->croplen) {
-			pr_err("%s: invalid frame croplen %d,"
-				"expecting %d\n",
-				__func__,
-				frame.croplen,
-				sync->croplen);
-			mutex_unlock(&sync->lock);
-			return -EINVAL;
-		}
-
-		if (copy_to_user((void *)frame.cropinfo,
-				sync->cropinfo,
-				sync->croplen)) {
-			ERR_COPY_TO_USER();
-			mutex_unlock(&sync->lock);
-			return -EFAULT;
-		}
-	}
-
-	if (sync->fdroiinfo.info) {
-		if (copy_to_user((void *)frame.roi_info.info,
-			sync->fdroiinfo.info,
-			sync->fdroiinfo.info_len)) {
-			ERR_COPY_TO_USER();
-			mutex_unlock(&sync->lock);
-			return -EFAULT;
-		}
-	}
-
-	if (sync->stereocam_enabled) {
-		frame.stcam_conv_value = sync->stcam_conv_value;
-		frame.stcam_quality_ind = sync->stcam_quality_ind;
-	}
-
-	if (copy_to_user((void *)arg,
-				&frame, sizeof(struct msm_frame))) {
-		ERR_COPY_TO_USER();
-		rc = -EFAULT;
-	}
-
-	mutex_unlock(&sync->lock);
-	CDBG("%s: got frame\n", __func__);
-
-	return rc;
-}
-
-static int msm_enable_vfe(struct msm_sync *sync, void __user *arg)
-{
-	int rc = -EIO;
-	struct camera_enable_cmd cfg;
-
-	if (copy_from_user(&cfg,
-			arg,
-			sizeof(struct camera_enable_cmd))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	if (sync->vfefn.vfe_enable)
-		rc = sync->vfefn.vfe_enable(&cfg);
-
-	return rc;
-}
-
-static int msm_disable_vfe(struct msm_sync *sync, void __user *arg)
-{
-	int rc = -EIO;
-	struct camera_enable_cmd cfg;
-
-	if (copy_from_user(&cfg,
-			arg,
-			sizeof(struct camera_enable_cmd))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	if (sync->vfefn.vfe_disable)
-		rc = sync->vfefn.vfe_disable(&cfg, NULL);
-
-	return rc;
-}
-
-static struct msm_queue_cmd *__msm_control(struct msm_sync *sync,
-		struct msm_device_queue *queue,
-		struct msm_queue_cmd *qcmd,
-		int timeout)
-{
-	int rc;
-
-	CDBG("Inside __msm_control\n");
-	if (sync->event_q.len <= 100 && sync->frame_q.len <= 100) {
-		/* wake up config thread */
-		msm_enqueue(&sync->event_q, &qcmd->list_config);
-	} else {
-		pr_err("%s, Error Queue limit exceeded e_q = %d, f_q = %d\n",
-			__func__, sync->event_q.len, sync->frame_q.len);
-		free_qcmd(qcmd);
-		return NULL;
-	}
-	if (!queue)
-		return NULL;
-
-	/* wait for config status */
-	CDBG("Waiting for config status \n");
-	rc = wait_event_interruptible_timeout(
-			queue->wait,
-			!list_empty_careful(&queue->list),
-			timeout);
-	CDBG("Waiting over for config status\n");
-	if (list_empty_careful(&queue->list)) {
-		if (!rc) {
-			rc = -ETIMEDOUT;
-			pr_err("%s: wait_event error %d\n", __func__, rc);
-			return ERR_PTR(rc);
-		} else if (rc < 0) {
-			pr_err("%s: wait_event error %d\n", __func__, rc);
-			if (msm_delete_entry(&sync->event_q,
-				list_config, qcmd)) {
-				sync->ignore_qcmd = true;
-				sync->ignore_qcmd_type =
-					(int16_t)((struct msm_ctrl_cmd *)
-					(qcmd->command))->type;
-			}
-			return ERR_PTR(rc);
-		}
-	}
-	qcmd = msm_dequeue(queue, list_control);
-	BUG_ON(!qcmd);
-	CDBG("__msm_control done \n");
-	return qcmd;
-}
-
-static struct msm_queue_cmd *__msm_control_nb(struct msm_sync *sync,
-					struct msm_queue_cmd *qcmd_to_copy)
-{
-	/* Since this is a non-blocking command, we cannot use qcmd_to_copy and
-	 * its data, since they are on the stack.  We replicate them on the heap
-	 * and mark them on_heap so that they get freed when the config thread
-	 * dequeues them.
-	 */
-
-	struct msm_ctrl_cmd *udata;
-	struct msm_ctrl_cmd *udata_to_copy = qcmd_to_copy->command;
-
-	struct msm_queue_cmd *qcmd =
-			kmalloc(sizeof(*qcmd_to_copy) +
-				sizeof(*udata_to_copy) +
-				udata_to_copy->length,
-				GFP_KERNEL);
-	if (!qcmd) {
-		pr_err("%s: out of memory\n", __func__);
-		return ERR_PTR(-ENOMEM);
-	}
-	*qcmd = *qcmd_to_copy;
-	udata = qcmd->command = qcmd + 1;
-	memcpy(udata, udata_to_copy, sizeof(*udata));
-	udata->value = udata + 1;
-	memcpy(udata->value, udata_to_copy->value, udata_to_copy->length);
-
-	atomic_set(&qcmd->on_heap, 1);
-
-	/* qcmd_resp will be set to NULL */
-	return __msm_control(sync, NULL, qcmd, 0);
-}
-
-static int msm_control(struct msm_control_device *ctrl_pmsm,
-			int block,
-			void __user *arg)
-{
-	int rc = 0;
-
-	struct msm_sync *sync = ctrl_pmsm->pmsm->sync;
-	void __user *uptr;
-	struct msm_ctrl_cmd udata_resp;
-	struct msm_queue_cmd *qcmd_resp = NULL;
-	uint8_t data[max_control_command_size];
-	struct msm_ctrl_cmd *udata;
-	struct msm_queue_cmd *qcmd =
-		kmalloc(sizeof(struct msm_queue_cmd) +
-			sizeof(struct msm_ctrl_cmd), GFP_ATOMIC);
-	if (!qcmd) {
-		pr_err("%s: out of memory\n", __func__);
-		return -ENOMEM;
-	}
-	udata = (struct msm_ctrl_cmd *)(qcmd + 1);
-	atomic_set(&(qcmd->on_heap), 1);
-	CDBG("Inside msm_control\n");
-	if (copy_from_user(udata, arg, sizeof(struct msm_ctrl_cmd))) {
-		ERR_COPY_FROM_USER();
-		rc = -EFAULT;
-		goto end;
-	}
-
-	uptr = udata->value;
-	udata->value = data;
-	qcmd->type = MSM_CAM_Q_CTRL;
-	qcmd->command = udata;
-
-	if (udata->length) {
-		if (udata->length > sizeof(data)) {
-			pr_err("%s: user data too large (%d, max is %d)\n",
-					__func__,
-					udata->length,
-					sizeof(data));
-			rc = -EIO;
-			goto end;
-		}
-		if (copy_from_user(udata->value, uptr, udata->length)) {
-			ERR_COPY_FROM_USER();
-			rc = -EFAULT;
-			goto end;
-		}
-	}
-
-	if (unlikely(!block)) {
-		qcmd_resp = __msm_control_nb(sync, qcmd);
-		goto end;
-	}
-	msm_queue_drain(&ctrl_pmsm->ctrl_q, list_control);
-	qcmd_resp = __msm_control(sync,
-				  &ctrl_pmsm->ctrl_q,
-				  qcmd, msecs_to_jiffies(10000));
-
-	/* ownership of qcmd will be transfered to event queue */
-	qcmd = NULL;
-
-	if (!qcmd_resp || IS_ERR(qcmd_resp)) {
-		/* Do not free qcmd_resp here.  If the config thread read it,
-		 * then it has already been freed, and we timed out because
-		 * we did not receive a MSM_CAM_IOCTL_CTRL_CMD_DONE.  If the
-		 * config thread itself is blocked and not dequeueing commands,
-		 * then it will either eventually unblock and process them,
-		 * or when it is killed, qcmd will be freed in
-		 * msm_release_config.
-		 */
-		rc = PTR_ERR(qcmd_resp);
-		qcmd_resp = NULL;
-		goto end;
-	}
-
-	if (qcmd_resp->command) {
-		udata_resp = *(struct msm_ctrl_cmd *)qcmd_resp->command;
-		if (udata_resp.length > 0) {
-			if (copy_to_user(uptr,
-					 udata_resp.value,
-					 udata_resp.length)) {
-				ERR_COPY_TO_USER();
-				rc = -EFAULT;
-				goto end;
-			}
-		}
-		udata_resp.value = uptr;
-
-		if (copy_to_user((void *)arg, &udata_resp,
-				sizeof(struct msm_ctrl_cmd))) {
-			ERR_COPY_TO_USER();
-			rc = -EFAULT;
-			goto end;
-		}
-	}
-
-end:
-	free_qcmd(qcmd);
-	CDBG("%s: done rc = %d\n", __func__, rc);
-	return rc;
-}
-
-/* Divert frames for post-processing by delivering them to the config thread;
- * when post-processing is done, it will return the frame to the frame thread.
- */
-static int msm_divert_frame(struct msm_sync *sync,
-		struct msm_vfe_resp *data,
-		struct msm_stats_event_ctrl *se)
-{
-	struct msm_pmem_info pinfo;
-	struct msm_postproc buf;
-	int rc;
-
-	CDBG("%s: Frame PP sync->pp_mask %d\n", __func__, sync->pp_mask);
-
-	if (!(sync->pp_mask & PP_PREV)  && !(sync->pp_mask & PP_SNAP)) {
-		pr_err("%s: diverting frame, not in PP_PREV or PP_SNAP!\n",
-			__func__);
-		return -EINVAL;
-	}
-
-	rc = msm_pmem_frame_ptov_lookup(sync, data->phy.p0_phy,
-			data->phy.p1_phy, data->phy.p2_phy, &pinfo,
-			0); /* do not clear the active flag */
-
-	if (rc < 0) {
-		pr_err("%s: msm_pmem_frame_ptov_lookup failed\n", __func__);
-		return rc;
-	}
-
-	buf.fmain.buffer = (unsigned long)pinfo.vaddr;
-	buf.fmain.planar0_off = pinfo.planar0_off;
-	buf.fmain.planar1_off = pinfo.planar1_off;
-	buf.fmain.fd = pinfo.fd;
-
-	CDBG("%s: buf 0x%x fd %d\n", __func__, (unsigned int)buf.fmain.buffer,
-		 buf.fmain.fd);
-	if (copy_to_user((void *)(se->stats_event.data),
-			&(buf.fmain), sizeof(struct msm_frame))) {
-		ERR_COPY_TO_USER();
-		return -EFAULT;
-	}
-	return 0;
-}
-
-/* Divert stereo frames for post-processing by delivering
- * them to the config thread.
- */
-static int msm_divert_st_frame(struct msm_sync *sync,
-	struct msm_vfe_resp *data, struct msm_stats_event_ctrl *se, int path)
-{
-	struct msm_pmem_info pinfo;
-	struct msm_st_frame buf;
-	struct video_crop_t *crop = NULL;
-	int rc = 0;
-
-	if (se->stats_event.msg_id == OUTPUT_TYPE_ST_L) {
-		buf.type = OUTPUT_TYPE_ST_L;
-	} else if (se->stats_event.msg_id == OUTPUT_TYPE_ST_R) {
-		buf.type = OUTPUT_TYPE_ST_R;
-	} else {
-		if (se->resptype == MSM_CAM_RESP_STEREO_OP_1) {
-			rc = msm_pmem_frame_ptov_lookup(sync, data->phy.p0_phy,
-				data->phy.p1_phy, data->phy.p2_phy, &pinfo,
-				1);  /* do clear the active flag */
-			buf.buf_info.path = path;
-		} else if (se->resptype == MSM_CAM_RESP_STEREO_OP_2) {
-			rc = msm_pmem_frame_ptov_lookup(sync, data->phy.p0_phy,
-				data->phy.p1_phy, data->phy.p2_phy, &pinfo,
-				0); /* do not clear the active flag */
-			buf.buf_info.path = path;
-		} else
-			CDBG("%s: Invalid resptype = %d\n", __func__,
-				se->resptype);
-
-		if (rc < 0) {
-			CDBG("%s: msm_pmem_frame_ptov_lookup failed\n",
-				__func__);
-			return rc;
-		}
-
-		buf.type = OUTPUT_TYPE_ST_D;
-
-		if (sync->cropinfo != NULL) {
-			crop = sync->cropinfo;
-			switch (path) {
-			case OUTPUT_TYPE_P:
-			case OUTPUT_TYPE_T: {
-				buf.L.stCropInfo.in_w = crop->in1_w;
-				buf.L.stCropInfo.in_h = crop->in1_h;
-				buf.L.stCropInfo.out_w = crop->out1_w;
-				buf.L.stCropInfo.out_h = crop->out1_h;
-				buf.R.stCropInfo = buf.L.stCropInfo;
-				break;
-			}
-
-			case OUTPUT_TYPE_V:
-			case OUTPUT_TYPE_S: {
-				buf.L.stCropInfo.in_w = crop->in2_w;
-				buf.L.stCropInfo.in_h = crop->in2_h;
-				buf.L.stCropInfo.out_w = crop->out2_w;
-				buf.L.stCropInfo.out_h = crop->out2_h;
-				buf.R.stCropInfo = buf.L.stCropInfo;
-				break;
-			}
-			default: {
-				pr_warning("%s: invalid frame path %d\n",
-					__func__, path);
-				break;
-			}
-			}
-		} else {
-			buf.L.stCropInfo.in_w = 0;
-			buf.L.stCropInfo.in_h = 0;
-			buf.L.stCropInfo.out_w = 0;
-			buf.L.stCropInfo.out_h = 0;
-			buf.R.stCropInfo = buf.L.stCropInfo;
-		}
-
-		/* hardcode for now. */
-		if ((path == OUTPUT_TYPE_S) || (path == OUTPUT_TYPE_T))
-			buf.packing = sync->sctrl.s_snap_packing;
-		else
-			buf.packing = sync->sctrl.s_video_packing;
-
-		buf.buf_info.buffer = (unsigned long)pinfo.vaddr;
-		buf.buf_info.phy_offset = pinfo.offset;
-		buf.buf_info.planar0_off = pinfo.planar0_off;
-		buf.buf_info.planar1_off = pinfo.planar1_off;
-		buf.buf_info.planar2_off = pinfo.planar2_off;
-		buf.buf_info.fd = pinfo.fd;
-
-		CDBG("%s: buf 0x%x fd %d\n", __func__,
-			(unsigned int)buf.buf_info.buffer, buf.buf_info.fd);
-	}
-
-	if (copy_to_user((void *)(se->stats_event.data),
-			&buf, sizeof(struct msm_st_frame))) {
-		ERR_COPY_TO_USER();
-		return -EFAULT;
-	}
-	return 0;
-}
-
-static int msm_get_stats(struct msm_sync *sync, void __user *arg)
-{
-	int rc = 0;
-
-	struct msm_stats_event_ctrl se;
-
-	struct msm_queue_cmd *qcmd = NULL;
-	struct msm_ctrl_cmd  *ctrl = NULL;
-	struct msm_vfe_resp  *data = NULL;
-	struct msm_vpe_resp  *vpe_data = NULL;
-	struct msm_stats_buf stats;
-
-	if (copy_from_user(&se, arg,
-			sizeof(struct msm_stats_event_ctrl))) {
-		ERR_COPY_FROM_USER();
-		pr_err("%s, ERR_COPY_FROM_USER\n", __func__);
-		return -EFAULT;
-	}
-
-	rc = 0;
-
-	qcmd = msm_dequeue(&sync->event_q, list_config);
-	if (!qcmd) {
-		/* Should be associated with wait_event
-			error -512 from __msm_control*/
-		pr_err("%s, qcmd is Null\n", __func__);
-		rc = -ETIMEDOUT;
-		return rc;
-	}
-
-	CDBG("%s: received from DSP %d\n", __func__, qcmd->type);
-
-	switch (qcmd->type) {
-	case MSM_CAM_Q_VPE_MSG:
-		/* Complete VPE response. */
-		vpe_data = (struct msm_vpe_resp *)(qcmd->command);
-		se.resptype = MSM_CAM_RESP_STEREO_OP_2;
-		se.stats_event.type   = vpe_data->evt_msg.type;
-		se.stats_event.msg_id = vpe_data->evt_msg.msg_id;
-		se.stats_event.len    = vpe_data->evt_msg.len;
-
-		if (vpe_data->type == VPE_MSG_OUTPUT_ST_L) {
-			CDBG("%s: Change msg_id to OUTPUT_TYPE_ST_L\n",
-				__func__);
-			se.stats_event.msg_id = OUTPUT_TYPE_ST_L;
-			rc = msm_divert_st_frame(sync, data, &se,
-				OUTPUT_TYPE_V);
-		} else if (vpe_data->type == VPE_MSG_OUTPUT_ST_R) {
-			CDBG("%s: Change msg_id to OUTPUT_TYPE_ST_R\n",
-				__func__);
-			se.stats_event.msg_id = OUTPUT_TYPE_ST_R;
-			rc = msm_divert_st_frame(sync, data, &se,
-				OUTPUT_TYPE_V);
-		} else {
-			pr_warning("%s: invalid vpe_data->type = %d\n",
-				__func__, vpe_data->type);
-		}
-		break;
-
-	case MSM_CAM_Q_VFE_EVT:
-	case MSM_CAM_Q_VFE_MSG:
-		data = (struct msm_vfe_resp *)(qcmd->command);
-
-		/* adsp event and message */
-		se.resptype = MSM_CAM_RESP_STAT_EVT_MSG;
-
-		/* 0 - msg from aDSP, 1 - event from mARM */
-		se.stats_event.type   = data->evt_msg.type;
-		se.stats_event.msg_id = data->evt_msg.msg_id;
-		se.stats_event.len    = data->evt_msg.len;
-		se.stats_event.frame_id = data->evt_msg.frame_id;
-
-		CDBG("%s: qcmd->type %d length %d msd_id %d\n", __func__,
-			qcmd->type,
-			se.stats_event.len,
-			se.stats_event.msg_id);
-
-		if (data->type == VFE_MSG_COMMON) {
-			stats.status_bits = data->stats_msg.status_bits;
-			stats.awb_ymin = data->stats_msg.awb_ymin;
-
-			if (data->stats_msg.aec_buff) {
-				stats.aec.buff =
-				msm_pmem_stats_ptov_lookup(sync,
-						data->stats_msg.aec_buff,
-						&(stats.aec.fd));
-				if (!stats.aec.buff) {
-					pr_err("%s: msm_pmem_stats_ptov_lookup error\n",
-						__func__);
-					rc = -EINVAL;
-					goto failure;
-				}
-
-			} else {
-				stats.aec.buff = 0;
-			}
-			if (data->stats_msg.awb_buff) {
-				stats.awb.buff =
-				msm_pmem_stats_ptov_lookup(sync,
-						data->stats_msg.awb_buff,
-						&(stats.awb.fd));
-				if (!stats.awb.buff) {
-					pr_err("%s: msm_pmem_stats_ptov_lookup error\n",
-						__func__);
-					rc = -EINVAL;
-					goto failure;
-				}
-
-			} else {
-				stats.awb.buff = 0;
-			}
-			if (data->stats_msg.af_buff) {
-				stats.af.buff =
-				msm_pmem_stats_ptov_lookup(sync,
-						data->stats_msg.af_buff,
-						&(stats.af.fd));
-				if (!stats.af.buff) {
-					pr_err("%s: msm_pmem_stats_ptov_lookup error\n",
-						__func__);
-					rc = -EINVAL;
-					goto failure;
-				}
-
-			} else {
-				stats.af.buff = 0;
-			}
-			if (data->stats_msg.ihist_buff) {
-				stats.ihist.buff =
-				msm_pmem_stats_ptov_lookup(sync,
-						data->stats_msg.ihist_buff,
-						&(stats.ihist.fd));
-				if (!stats.ihist.buff) {
-					pr_err("%s: msm_pmem_stats_ptov_lookup error\n",
-						__func__);
-					rc = -EINVAL;
-					goto failure;
-				}
-
-			} else {
-				stats.ihist.buff = 0;
-			}
-
-			if (data->stats_msg.rs_buff) {
-				stats.rs.buff =
-				msm_pmem_stats_ptov_lookup(sync,
-						data->stats_msg.rs_buff,
-						&(stats.rs.fd));
-				if (!stats.rs.buff) {
-					pr_err("%s: msm_pmem_stats_ptov_lookup error\n",
-						__func__);
-					rc = -EINVAL;
-					goto failure;
-				}
-
-			} else {
-				stats.rs.buff = 0;
-			}
-
-			if (data->stats_msg.cs_buff) {
-				stats.cs.buff =
-				msm_pmem_stats_ptov_lookup(sync,
-						data->stats_msg.cs_buff,
-						&(stats.cs.fd));
-				if (!stats.cs.buff) {
-					pr_err("%s: msm_pmem_stats_ptov_lookup error\n",
-						__func__);
-					rc = -EINVAL;
-					goto failure;
-				}
-			} else {
-				stats.cs.buff = 0;
-			}
-
-			se.stats_event.frame_id = data->phy.frame_id;
-			if (copy_to_user((void *)(se.stats_event.data),
-					&stats,
-					sizeof(struct msm_stats_buf))) {
-				ERR_COPY_TO_USER();
-				rc = -EFAULT;
-				goto failure;
-			}
-		} else if ((data->type >= VFE_MSG_STATS_AEC) &&
-			(data->type <=  VFE_MSG_STATS_WE)) {
-			/* the check above includes all stats type. */
-			stats.awb_ymin = data->stats_msg.awb_ymin;
-			stats.buffer =
-				msm_pmem_stats_ptov_lookup(sync,
-						data->phy.sbuf_phy,
-						&(stats.fd));
-			if (!stats.buffer) {
-					pr_err("%s: msm_pmem_stats_ptov_lookup error\n",
-						__func__);
-					rc = -EINVAL;
-					goto failure;
-			}
-			se.stats_event.frame_id = data->phy.frame_id;
-			if (copy_to_user((void *)(se.stats_event.data),
-					&stats,
-					sizeof(struct msm_stats_buf))) {
-				ERR_COPY_TO_USER();
-				rc = -EFAULT;
-				goto failure;
-			}
-		} else if ((data->evt_msg.len > 0) &&
-				(data->type == VFE_MSG_GENERAL)) {
-			if (copy_to_user((void *)(se.stats_event.data),
-					data->evt_msg.data,
-					data->evt_msg.len)) {
-				ERR_COPY_TO_USER();
-				rc = -EFAULT;
-				goto failure;
-			}
-		} else {
-			if (sync->stereocam_enabled) {
-				if (data->type == VFE_MSG_OUTPUT_P) {
-					CDBG("%s: Preview mark as st op 1\n",
-						__func__);
-					se.resptype = MSM_CAM_RESP_STEREO_OP_1;
-					rc = msm_divert_st_frame(sync, data,
-						&se, OUTPUT_TYPE_P);
-					break;
-				} else if (data->type == VFE_MSG_OUTPUT_V) {
-					CDBG("%s: Video mark as st op 2\n",
-						__func__);
-					se.resptype = MSM_CAM_RESP_STEREO_OP_2;
-					rc = msm_divert_st_frame(sync, data,
-						&se, OUTPUT_TYPE_V);
-					break;
-				} else if (data->type == VFE_MSG_OUTPUT_S) {
-					CDBG("%s: Main img mark as st op 2\n",
-						__func__);
-					se.resptype = MSM_CAM_RESP_STEREO_OP_2;
-					rc = msm_divert_st_frame(sync, data,
-						&se, OUTPUT_TYPE_S);
-					break;
-				} else if (data->type == VFE_MSG_OUTPUT_T) {
-					CDBG("%s: Thumb img mark as st op 2\n",
-						__func__);
-					se.resptype = MSM_CAM_RESP_STEREO_OP_2;
-					rc = msm_divert_st_frame(sync, data,
-						&se, OUTPUT_TYPE_T);
-					break;
-				} else
-					CDBG("%s: VFE_MSG Fall Through\n",
-						__func__);
-			}
-			if ((sync->pp_frame_avail == 1) &&
-				(sync->pp_mask & PP_PREV) &&
-				(data->type == VFE_MSG_OUTPUT_P)) {
-					CDBG("%s:%d:preiew PP\n",
-					__func__, __LINE__);
-					se.stats_event.frame_id =
-							data->phy.frame_id;
-					rc = msm_divert_frame(sync, data, &se);
-					sync->pp_frame_avail = 0;
-			} else {
-				if ((sync->pp_mask & PP_PREV) &&
-					(data->type == VFE_MSG_OUTPUT_P)) {
-					se.stats_event.frame_id =
-							data->phy.frame_id;
-					free_qcmd(qcmd);
-					return 0;
-				} else
-					CDBG("%s:indication type is %d\n",
-						__func__, data->type);
-			}
-			if (sync->pp_mask & PP_SNAP)
-				if (data->type == VFE_MSG_OUTPUT_S ||
-					data->type == VFE_MSG_OUTPUT_T)
-					rc = msm_divert_frame(sync, data, &se);
-		}
-		break;
-
-	case MSM_CAM_Q_CTRL:
-		/* control command from control thread */
-		ctrl = (struct msm_ctrl_cmd *)(qcmd->command);
-
-		CDBG("%s: qcmd->type %d length %d\n", __func__,
-			qcmd->type, ctrl->length);
-
-		if (ctrl->length > 0) {
-			if (copy_to_user((void *)(se.ctrl_cmd.value),
-						ctrl->value,
-						ctrl->length)) {
-				ERR_COPY_TO_USER();
-				rc = -EFAULT;
-				goto failure;
-			}
-		}
-
-		se.resptype = MSM_CAM_RESP_CTRL;
-
-		/* what to control */
-		se.ctrl_cmd.type = ctrl->type;
-		se.ctrl_cmd.length = ctrl->length;
-		se.ctrl_cmd.resp_fd = ctrl->resp_fd;
-		break;
-
-	case MSM_CAM_Q_V4L2_REQ:
-		/* control command from v4l2 client */
-		ctrl = (struct msm_ctrl_cmd *)(qcmd->command);
-		if (ctrl->length > 0) {
-			if (copy_to_user((void *)(se.ctrl_cmd.value),
-					ctrl->value, ctrl->length)) {
-				ERR_COPY_TO_USER();
-				rc = -EFAULT;
-				goto failure;
-			}
-		}
-
-		/* 2 tells config thread this is v4l2 request */
-		se.resptype = MSM_CAM_RESP_V4L2;
-
-		/* what to control */
-		se.ctrl_cmd.type   = ctrl->type;
-		se.ctrl_cmd.length = ctrl->length;
-		break;
-
-	default:
-		rc = -EFAULT;
-		goto failure;
-	} /* switch qcmd->type */
-	if (copy_to_user((void *)arg, &se, sizeof(se))) {
-		ERR_COPY_TO_USER();
-		rc = -EFAULT;
-		goto failure;
-	}
-
-failure:
-	free_qcmd(qcmd);
-
-	CDBG("%s: %d\n", __func__, rc);
-	return rc;
-}
-
-static int msm_ctrl_cmd_done(struct msm_control_device *ctrl_pmsm,
-		void __user *arg)
-{
-	void __user *uptr;
-	struct msm_queue_cmd *qcmd = &ctrl_pmsm->qcmd;
-	struct msm_ctrl_cmd *command = &ctrl_pmsm->ctrl;
-
-	if (copy_from_user(command, arg, sizeof(*command))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	atomic_set(&qcmd->on_heap, 0);
-	qcmd->command = command;
-	uptr = command->value;
-
-	if (command->length > 0) {
-		command->value = ctrl_pmsm->ctrl_data;
-		if (command->length > sizeof(ctrl_pmsm->ctrl_data)) {
-			pr_err("%s: user data %d is too big (max %d)\n",
-				__func__, command->length,
-				sizeof(ctrl_pmsm->ctrl_data));
-			return -EINVAL;
-		}
-
-		if (copy_from_user(command->value,
-					uptr,
-					command->length)) {
-			ERR_COPY_FROM_USER();
-			return -EFAULT;
-		}
-	} else
-		command->value = NULL;
-
-	/* Ignore the command if the ctrl cmd has
-	   return back due to signaling */
-	/* Should be associated with wait_event
-	   error -512 from __msm_control*/
-	if (ctrl_pmsm->pmsm->sync->ignore_qcmd == true &&
-	   ctrl_pmsm->pmsm->sync->ignore_qcmd_type == (int16_t)command->type) {
-		ctrl_pmsm->pmsm->sync->ignore_qcmd = false;
-		ctrl_pmsm->pmsm->sync->ignore_qcmd_type = -1;
-	} else /* wake up control thread */
-		msm_enqueue(&ctrl_pmsm->ctrl_q, &qcmd->list_control);
-
-	return 0;
-}
-
-static int msm_config_vpe(struct msm_sync *sync, void __user *arg)
-{
-	struct msm_vpe_cfg_cmd cfgcmd;
-	if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-	CDBG("%s: cmd_type %s\n", __func__, vfe_config_cmd[cfgcmd.cmd_type]);
-	switch (cfgcmd.cmd_type) {
-	case CMD_VPE:
-		return sync->vpefn.vpe_config(&cfgcmd, NULL);
-	default:
-		pr_err("%s: unknown command type %d\n",
-			__func__, cfgcmd.cmd_type);
-	}
-	return -EINVAL;
-}
-
-static int msm_config_vfe(struct msm_sync *sync, void __user *arg)
-{
-	struct msm_vfe_cfg_cmd cfgcmd;
-	struct msm_pmem_region region[8];
-	struct axidata axi_data;
-
-	if (!sync->vfefn.vfe_config) {
-		pr_err("%s: no vfe_config!\n", __func__);
-		return -EIO;
-	}
-
-	if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	memset(&axi_data, 0, sizeof(axi_data));
-	CDBG("%s: cmd_type %s\n", __func__, vfe_config_cmd[cfgcmd.cmd_type]);
-	switch (cfgcmd.cmd_type) {
-	case CMD_STATS_ENABLE:
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_stats,
-				MSM_PMEM_AEC_AWB, &region[0],
-				NUM_STAT_OUTPUT_BUFFERS,
-				&sync->pmem_stats_spinlock);
-		axi_data.bufnum2 =
-			msm_pmem_region_lookup(&sync->pmem_stats,
-				MSM_PMEM_AF, &region[axi_data.bufnum1],
-				NUM_STAT_OUTPUT_BUFFERS,
-				&sync->pmem_stats_spinlock);
-		if (!axi_data.bufnum1 || !axi_data.bufnum2) {
-			pr_err("%s: pmem region lookup error\n", __func__);
-			return -EINVAL;
-		}
-		axi_data.region = &region[0];
-		return sync->vfefn.vfe_config(&cfgcmd, &axi_data);
-	case CMD_STATS_AF_ENABLE:
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_stats,
-				MSM_PMEM_AF, &region[0],
-				NUM_STAT_OUTPUT_BUFFERS,
-				&sync->pmem_stats_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		axi_data.region = &region[0];
-		return sync->vfefn.vfe_config(&cfgcmd, &axi_data);
-	case CMD_STATS_AEC_AWB_ENABLE:
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_stats,
-				MSM_PMEM_AEC_AWB, &region[0],
-				NUM_STAT_OUTPUT_BUFFERS,
-				&sync->pmem_stats_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		axi_data.region = &region[0];
-		return sync->vfefn.vfe_config(&cfgcmd, &axi_data);
-	case CMD_STATS_AEC_ENABLE:
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_stats,
-			MSM_PMEM_AEC, &region[0],
-			NUM_STAT_OUTPUT_BUFFERS,
-			&sync->pmem_stats_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		axi_data.region = &region[0];
-		return sync->vfefn.vfe_config(&cfgcmd, &axi_data);
-	case CMD_STATS_AWB_ENABLE:
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_stats,
-			MSM_PMEM_AWB, &region[0],
-			NUM_STAT_OUTPUT_BUFFERS,
-			&sync->pmem_stats_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		axi_data.region = &region[0];
-		return sync->vfefn.vfe_config(&cfgcmd, &axi_data);
-
-
-	case CMD_STATS_IHIST_ENABLE:
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_stats,
-			MSM_PMEM_IHIST, &region[0],
-			NUM_STAT_OUTPUT_BUFFERS,
-			&sync->pmem_stats_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		axi_data.region = &region[0];
-		return sync->vfefn.vfe_config(&cfgcmd, &axi_data);
-
-	case CMD_STATS_RS_ENABLE:
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_stats,
-			MSM_PMEM_RS, &region[0],
-			NUM_STAT_OUTPUT_BUFFERS,
-			&sync->pmem_stats_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		axi_data.region = &region[0];
-		return sync->vfefn.vfe_config(&cfgcmd, &axi_data);
-
-	case CMD_STATS_CS_ENABLE:
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_stats,
-			MSM_PMEM_CS, &region[0],
-			NUM_STAT_OUTPUT_BUFFERS,
-			&sync->pmem_stats_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		axi_data.region = &region[0];
-		return sync->vfefn.vfe_config(&cfgcmd, &axi_data);
-
-	case CMD_GENERAL:
-	case CMD_STATS_DISABLE:
-		return sync->vfefn.vfe_config(&cfgcmd, NULL);
-	default:
-		pr_err("%s: unknown command type %d\n",
-			__func__, cfgcmd.cmd_type);
-	}
-
-	return -EINVAL;
-}
-static int msm_vpe_frame_cfg(struct msm_sync *sync,
-				void *cfgcmdin)
-{
-	int rc = -EIO;
-	struct axidata axi_data;
-	void *data = &axi_data;
-	struct msm_pmem_region region[8];
-	int pmem_type;
-
-	struct msm_vpe_cfg_cmd *cfgcmd;
-	cfgcmd = (struct msm_vpe_cfg_cmd *)cfgcmdin;
-
-	memset(&axi_data, 0, sizeof(axi_data));
-	CDBG("In vpe_frame_cfg cfgcmd->cmd_type = %s\n",
-		vfe_config_cmd[cfgcmd->cmd_type]);
-	switch (cfgcmd->cmd_type) {
-	case CMD_AXI_CFG_VPE:
-		pmem_type = MSM_PMEM_VIDEO_VPE;
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup_2(&sync->pmem_frames, pmem_type,
-				&region[0], 8, &sync->pmem_frame_spinlock);
-		CDBG("axi_data.bufnum1 = %d\n", axi_data.bufnum1);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		pmem_type = MSM_PMEM_VIDEO;
-		break;
-	case CMD_AXI_CFG_SNAP_THUMB_VPE:
-		CDBG("%s: CMD_AXI_CFG_SNAP_THUMB_VPE", __func__);
-		pmem_type = MSM_PMEM_THUMBNAIL_VPE;
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
-			&region[0], 8, &sync->pmem_frame_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s: THUMBNAIL_VPE pmem region lookup error\n",
-				__func__);
-			return -EINVAL;
-		}
-		break;
-	case CMD_AXI_CFG_SNAP_VPE:
-		CDBG("%s: CMD_AXI_CFG_SNAP_VPE", __func__);
-		pmem_type = MSM_PMEM_MAINIMG_VPE;
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
-				&region[0], 8, &sync->pmem_frame_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s: MAINIMG_VPE pmem region lookup error\n",
-				__func__);
-			return -EINVAL;
-		}
-		break;
-	default:
-		pr_err("%s: unknown command type %d\n",
-			__func__, cfgcmd->cmd_type);
-		break;
-	}
-	axi_data.region = &region[0];
-	CDBG("out vpe_frame_cfg cfgcmd->cmd_type = %s\n",
-		vfe_config_cmd[cfgcmd->cmd_type]);
-	/* send the AXI configuration command to driver */
-	if (sync->vpefn.vpe_config)
-		rc = sync->vpefn.vpe_config(cfgcmd, data);
-	return rc;
-}
-
-static int msm_frame_axi_cfg(struct msm_sync *sync,
-		struct msm_vfe_cfg_cmd *cfgcmd)
-{
-	int rc = -EIO;
-	struct axidata axi_data;
-	void *data = &axi_data;
-	struct msm_pmem_region region[MAX_PMEM_CFG_BUFFERS];
-	int pmem_type;
-
-	memset(&axi_data, 0, sizeof(axi_data));
-
-	switch (cfgcmd->cmd_type) {
-
-	case CMD_AXI_CFG_PREVIEW:
-		pmem_type = MSM_PMEM_PREVIEW;
-		axi_data.bufnum2 =
-			msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
-				&region[0], MAX_PMEM_CFG_BUFFERS,
-				&sync->pmem_frame_spinlock);
-		if (!axi_data.bufnum2) {
-			pr_err("%s %d: pmem region lookup error (empty %d)\n",
-				__func__, __LINE__,
-				hlist_empty(&sync->pmem_frames));
-			return -EINVAL;
-		}
-		break;
-
-	case CMD_AXI_CFG_VIDEO_ALL_CHNLS:
-	case CMD_AXI_CFG_VIDEO:
-		pmem_type = MSM_PMEM_PREVIEW;
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
-				&region[0], MAX_PMEM_CFG_BUFFERS,
-				&sync->pmem_frame_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-
-		pmem_type = MSM_PMEM_VIDEO;
-		axi_data.bufnum2 =
-			msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
-				&region[axi_data.bufnum1],
-				(MAX_PMEM_CFG_BUFFERS-(axi_data.bufnum1)),
-				&sync->pmem_frame_spinlock);
-		if (!axi_data.bufnum2) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		break;
-
-	case CMD_AXI_CFG_SNAP:
-		CDBG("%s, CMD_AXI_CFG_SNAP, type=%d\n", __func__,
-			cfgcmd->cmd_type);
-		pmem_type = MSM_PMEM_THUMBNAIL;
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
-				&region[0], MAX_PMEM_CFG_BUFFERS,
-				&sync->pmem_frame_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-
-		pmem_type = MSM_PMEM_MAINIMG;
-		axi_data.bufnum2 =
-			msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
-				&region[axi_data.bufnum1],
-				(MAX_PMEM_CFG_BUFFERS-(axi_data.bufnum1)),
-				 &sync->pmem_frame_spinlock);
-		if (!axi_data.bufnum2) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		break;
-
-	case CMD_AXI_CFG_ZSL_ALL_CHNLS:
-	case CMD_AXI_CFG_ZSL:
-		CDBG("%s, CMD_AXI_CFG_ZSL, type = %d\n", __func__,
-			cfgcmd->cmd_type);
-		pmem_type = MSM_PMEM_PREVIEW;
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
-				&region[0], MAX_PMEM_CFG_BUFFERS,
-				&sync->pmem_frame_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-
-		pmem_type = MSM_PMEM_THUMBNAIL;
-		axi_data.bufnum2 =
-			msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
-				&region[axi_data.bufnum1],
-				(MAX_PMEM_CFG_BUFFERS-(axi_data.bufnum1)),
-				 &sync->pmem_frame_spinlock);
-		if (!axi_data.bufnum2) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-
-		pmem_type = MSM_PMEM_MAINIMG;
-		axi_data.bufnum3 =
-			msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
-				&region[axi_data.bufnum1 + axi_data.bufnum2],
-				(MAX_PMEM_CFG_BUFFERS - axi_data.bufnum1 -
-				axi_data.bufnum2), &sync->pmem_frame_spinlock);
-		if (!axi_data.bufnum3) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		break;
-
-	case CMD_RAW_PICT_AXI_CFG:
-		pmem_type = MSM_PMEM_RAW_MAINIMG;
-		axi_data.bufnum2 =
-			msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
-				&region[0], MAX_PMEM_CFG_BUFFERS,
-				&sync->pmem_frame_spinlock);
-		if (!axi_data.bufnum2) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-		break;
-
-	case CMD_GENERAL:
-		data = NULL;
-		break;
-
-	default:
-		pr_err("%s: unknown command type %d\n",
-			__func__, cfgcmd->cmd_type);
-		return -EINVAL;
-	}
-
-	axi_data.region = &region[0];
-
-	/* send the AXI configuration command to driver */
-	if (sync->vfefn.vfe_config)
-		rc = sync->vfefn.vfe_config(cfgcmd, data);
-
-	return rc;
-}
-
-static int msm_get_sensor_info(struct msm_sync *sync, void __user *arg)
-{
-	int rc = 0;
-	struct msm_camsensor_info info;
-	struct msm_camera_sensor_info *sdata;
-
-	if (copy_from_user(&info,
-			arg,
-			sizeof(struct msm_camsensor_info))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	sdata = sync->pdev->dev.platform_data;
-	if (sync->sctrl.s_camera_type == BACK_CAMERA_3D)
-		info.support_3d = true;
-	else
-		info.support_3d = false;
-	memcpy(&info.name[0],
-		sdata->sensor_name,
-		MAX_SENSOR_NAME);
-	info.flash_enabled = sdata->flash_data->flash_type !=
-		MSM_CAMERA_FLASH_NONE;
-
-	/* copy back to user space */
-	if (copy_to_user((void *)arg,
-			&info,
-			sizeof(struct msm_camsensor_info))) {
-		ERR_COPY_TO_USER();
-		rc = -EFAULT;
-	}
-
-	return rc;
-}
-
-static int msm_get_camera_info(void __user *arg)
-{
-	int rc = 0;
-	int i = 0;
-	struct msm_camera_info info;
-
-	if (copy_from_user(&info, arg, sizeof(struct msm_camera_info))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	CDBG("%s: camera_node %d\n", __func__, camera_node);
-	info.num_cameras = camera_node;
-
-	for (i = 0; i < camera_node; i++) {
-		info.has_3d_support[i] = 0;
-		info.is_internal_cam[i] = 0;
-		info.s_mount_angle[i] = sensor_mount_angle[i];
-		switch (camera_type[i]) {
-		case FRONT_CAMERA_2D:
-			info.is_internal_cam[i] = 1;
-			break;
-		case BACK_CAMERA_3D:
-			info.has_3d_support[i] = 1;
-			break;
-		case BACK_CAMERA_2D:
-		default:
-			break;
-		}
-	}
-	/* copy back to user space */
-	if (copy_to_user((void *)arg, &info, sizeof(struct msm_camera_info))) {
-		ERR_COPY_TO_USER();
-		rc = -EFAULT;
-	}
-	return rc;
-}
-
-static int __msm_put_frame_buf(struct msm_sync *sync,
-		struct msm_frame *pb)
-{
-	unsigned long pphy;
-	struct msm_vfe_cfg_cmd cfgcmd;
-
-	int rc = -EIO;
-
-	/* Change the active flag. */
-	pphy = msm_pmem_frame_vtop_lookup(sync,
-		pb->buffer,
-		pb->planar0_off, pb->planar1_off, pb->planar2_off, pb->fd, 1);
-
-	if (pphy != 0) {
-		CDBG("%s: rel: vaddr %lx, paddr %lx\n",
-			__func__,
-			pb->buffer, pphy);
-		cfgcmd.cmd_type = CMD_FRAME_BUF_RELEASE;
-		cfgcmd.value    = (void *)pb;
-		if (sync->vfefn.vfe_config)
-			rc = sync->vfefn.vfe_config(&cfgcmd, &pphy);
-	} else {
-		pr_err("%s: msm_pmem_frame_vtop_lookup failed\n",
-			__func__);
-		rc = -EINVAL;
-	}
-
-	return rc;
-}
-static int __msm_put_pic_buf(struct msm_sync *sync,
-		struct msm_frame *pb)
-{
-	unsigned long pphy;
-	struct msm_vfe_cfg_cmd cfgcmd;
-
-	int rc = -EIO;
-
-	pphy = msm_pmem_frame_vtop_lookup(sync,
-		pb->buffer,
-		pb->planar0_off, pb->planar1_off, pb->planar2_off, pb->fd, 1);
-
-	if (pphy != 0) {
-		CDBG("%s: rel: vaddr %lx, paddr %lx\n",
-			__func__,
-			pb->buffer, pphy);
-		cfgcmd.cmd_type = CMD_SNAP_BUF_RELEASE;
-		cfgcmd.value    = (void *)pb;
-		if (sync->vfefn.vfe_config)
-			rc = sync->vfefn.vfe_config(&cfgcmd, &pphy);
-	} else {
-		pr_err("%s: msm_pmem_frame_vtop_lookup failed\n",
-			__func__);
-		rc = -EINVAL;
-	}
-
-	return rc;
-}
-
-
-static int msm_put_frame_buffer(struct msm_sync *sync, void __user *arg)
-{
-	struct msm_frame buf_t;
-
-	if (copy_from_user(&buf_t,
-				arg,
-				sizeof(struct msm_frame))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	return __msm_put_frame_buf(sync, &buf_t);
-}
-
-
-static int msm_put_pic_buffer(struct msm_sync *sync, void __user *arg)
-{
-	struct msm_frame buf_t;
-
-	if (copy_from_user(&buf_t,
-				arg,
-				sizeof(struct msm_frame))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	return __msm_put_pic_buf(sync, &buf_t);
-}
-
-static int __msm_register_pmem(struct msm_sync *sync,
-		struct msm_pmem_info *pinfo)
-{
-	int rc = 0;
-
-	switch (pinfo->type) {
-	case MSM_PMEM_VIDEO:
-	case MSM_PMEM_PREVIEW:
-	case MSM_PMEM_THUMBNAIL:
-	case MSM_PMEM_MAINIMG:
-	case MSM_PMEM_RAW_MAINIMG:
-	case MSM_PMEM_VIDEO_VPE:
-	case MSM_PMEM_C2D:
-	case MSM_PMEM_MAINIMG_VPE:
-	case MSM_PMEM_THUMBNAIL_VPE:
-		rc = msm_pmem_table_add(&sync->pmem_frames, pinfo,
-			&sync->pmem_frame_spinlock, sync);
-		break;
-
-	case MSM_PMEM_AEC_AWB:
-	case MSM_PMEM_AF:
-	case MSM_PMEM_AEC:
-	case MSM_PMEM_AWB:
-	case MSM_PMEM_RS:
-	case MSM_PMEM_CS:
-	case MSM_PMEM_IHIST:
-	case MSM_PMEM_SKIN:
-
-		rc = msm_pmem_table_add(&sync->pmem_stats, pinfo,
-			 &sync->pmem_stats_spinlock, sync);
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	return rc;
-}
-
-static int msm_register_pmem(struct msm_sync *sync, void __user *arg)
-{
-	struct msm_pmem_info info;
-
-	if (copy_from_user(&info, arg, sizeof(info))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	return __msm_register_pmem(sync, &info);
-}
-
-static int msm_stats_axi_cfg(struct msm_sync *sync,
-		struct msm_vfe_cfg_cmd *cfgcmd)
-{
-	int rc = -EIO;
-	struct axidata axi_data;
-	void *data = &axi_data;
-
-	struct msm_pmem_region region[3];
-	int pmem_type = MSM_PMEM_MAX;
-
-	memset(&axi_data, 0, sizeof(axi_data));
-
-	switch (cfgcmd->cmd_type) {
-	case CMD_STATS_AXI_CFG:
-		pmem_type = MSM_PMEM_AEC_AWB;
-		break;
-	case CMD_STATS_AF_AXI_CFG:
-		pmem_type = MSM_PMEM_AF;
-		break;
-	case CMD_GENERAL:
-		data = NULL;
-		break;
-	default:
-		pr_err("%s: unknown command type %d\n",
-			__func__, cfgcmd->cmd_type);
-		return -EINVAL;
-	}
-
-	if (cfgcmd->cmd_type != CMD_GENERAL) {
-		axi_data.bufnum1 =
-			msm_pmem_region_lookup(&sync->pmem_stats, pmem_type,
-				&region[0], NUM_STAT_OUTPUT_BUFFERS,
-				&sync->pmem_stats_spinlock);
-		if (!axi_data.bufnum1) {
-			pr_err("%s %d: pmem region lookup error\n",
-				__func__, __LINE__);
-			return -EINVAL;
-		}
-	axi_data.region = &region[0];
-	}
-
-	/* send the AEC/AWB STATS configuration command to driver */
-	if (sync->vfefn.vfe_config)
-		rc = sync->vfefn.vfe_config(cfgcmd, &axi_data);
-
-	return rc;
-}
-
-static int msm_put_stats_buffer(struct msm_sync *sync, void __user *arg)
-{
-	int rc = -EIO;
-
-	struct msm_stats_buf buf;
-	unsigned long pphy;
-	struct msm_vfe_cfg_cmd cfgcmd;
-
-	if (copy_from_user(&buf, arg,
-				sizeof(struct msm_stats_buf))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	CDBG("%s\n", __func__);
-	pphy = msm_pmem_stats_vtop_lookup(sync, buf.buffer, buf.fd);
-
-	if (pphy != 0) {
-		if (buf.type == STAT_AEAW)
-			cfgcmd.cmd_type = CMD_STATS_BUF_RELEASE;
-		else if (buf.type == STAT_AF)
-			cfgcmd.cmd_type = CMD_STATS_AF_BUF_RELEASE;
-		else if (buf.type == STAT_AEC)
-			cfgcmd.cmd_type = CMD_STATS_AEC_BUF_RELEASE;
-		else if (buf.type == STAT_AWB)
-			cfgcmd.cmd_type = CMD_STATS_AWB_BUF_RELEASE;
-		else if (buf.type == STAT_IHIST)
-			cfgcmd.cmd_type = CMD_STATS_IHIST_BUF_RELEASE;
-		else if (buf.type == STAT_RS)
-			cfgcmd.cmd_type = CMD_STATS_RS_BUF_RELEASE;
-		else if (buf.type == STAT_CS)
-			cfgcmd.cmd_type = CMD_STATS_CS_BUF_RELEASE;
-
-		else {
-			pr_err("%s: invalid buf type %d\n",
-				__func__,
-				buf.type);
-			rc = -EINVAL;
-			goto put_done;
-		}
-
-		cfgcmd.value = (void *)&buf;
-
-		if (sync->vfefn.vfe_config) {
-			rc = sync->vfefn.vfe_config(&cfgcmd, &pphy);
-			if (rc < 0)
-				pr_err("%s: vfe_config error %d\n",
-					__func__, rc);
-		} else
-			pr_err("%s: vfe_config is NULL\n", __func__);
-	} else {
-		pr_err("%s: NULL physical address\n", __func__);
-		rc = -EINVAL;
-	}
-
-put_done:
-	return rc;
-}
-
-static int msm_axi_config(struct msm_sync *sync, void __user *arg)
-{
-	struct msm_vfe_cfg_cmd cfgcmd;
-
-	if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	switch (cfgcmd.cmd_type) {
-	case CMD_AXI_CFG_VIDEO:
-	case CMD_AXI_CFG_PREVIEW:
-	case CMD_AXI_CFG_SNAP:
-	case CMD_RAW_PICT_AXI_CFG:
-	case CMD_AXI_CFG_ZSL:
-	case CMD_AXI_CFG_VIDEO_ALL_CHNLS:
-	case CMD_AXI_CFG_ZSL_ALL_CHNLS:
-		CDBG("%s, cfgcmd.cmd_type = %d\n", __func__, cfgcmd.cmd_type);
-		return msm_frame_axi_cfg(sync, &cfgcmd);
-
-	case CMD_AXI_CFG_VPE:
-	case CMD_AXI_CFG_SNAP_VPE:
-	case CMD_AXI_CFG_SNAP_THUMB_VPE:
-		return msm_vpe_frame_cfg(sync, (void *)&cfgcmd);
-
-	case CMD_STATS_AXI_CFG:
-	case CMD_STATS_AF_AXI_CFG:
-		return msm_stats_axi_cfg(sync, &cfgcmd);
-
-	default:
-		pr_err("%s: unknown command type %d\n",
-			__func__,
-			cfgcmd.cmd_type);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static int __msm_get_pic(struct msm_sync *sync,
-		struct msm_frame *frame)
-{
-
-	int rc = 0;
-	struct msm_queue_cmd *qcmd = NULL;
-	struct msm_vfe_resp *vdata;
-	struct msm_vfe_phy_info *pphy;
-	struct msm_pmem_info pmem_info;
-	struct msm_frame *pframe;
-
-	qcmd = msm_dequeue(&sync->pict_q, list_pict);
-
-	if (!qcmd) {
-		pr_err("%s: no pic frame.\n", __func__);
-		return -EAGAIN;
-	}
-
-	if (MSM_CAM_Q_PP_MSG != qcmd->type) {
-		vdata = (struct msm_vfe_resp *)(qcmd->command);
-		pphy = &vdata->phy;
-
-		rc = msm_pmem_frame_ptov_lookup2(sync,
-				pphy->p0_phy,
-				&pmem_info,
-				1); /* mark pic frame in use */
-
-		if (rc < 0) {
-			pr_err("%s: cannot get pic frame, invalid lookup"
-				" address p0_phy add  %x p1_phy add%x\n",
-				__func__, pphy->p0_phy, pphy->p1_phy);
-			goto err;
-		}
-
-		frame->ts = qcmd->ts;
-		frame->buffer = (unsigned long)pmem_info.vaddr;
-		frame->planar0_off = pmem_info.planar0_off;
-		frame->planar1_off = pmem_info.planar1_off;
-		frame->fd = pmem_info.fd;
-		if (sync->stereocam_enabled &&
-			sync->stereo_state != STEREO_RAW_SNAP_STARTED) {
-			if (pmem_info.type == MSM_PMEM_THUMBNAIL_VPE)
-				frame->path = OUTPUT_TYPE_T;
-			else
-				frame->path = OUTPUT_TYPE_S;
-		} else
-			frame->path = vdata->phy.output_id;
-
-		CDBG("%s:p0_phy add %x, p0_phy add %x, qcmd %x, virt_addr %x\n",
-			__func__, pphy->p0_phy,
-			pphy->p1_phy, (int) qcmd, (int) frame->buffer);
-	} else { /* PP */
-		pframe = (struct msm_frame *)(qcmd->command);
-		frame->ts = qcmd->ts;
-		frame->buffer = pframe->buffer;
-		frame->planar0_off = pframe->planar0_off;
-		frame->planar1_off = pframe->planar1_off;
-		frame->fd = pframe->fd;
-		frame->path = pframe->path;
-		CDBG("%s: PP y_off %x, cbcr_off %x, path %d vaddr 0x%x\n",
-		__func__, frame->planar0_off, frame->planar1_off, frame->path,
-		(int) frame->buffer);
-	}
-
-err:
-	free_qcmd(qcmd);
-
-	return rc;
-}
-
-static int msm_get_pic(struct msm_sync *sync, void __user *arg)
-{
-	int rc = 0;
-	struct msm_frame frame;
-
-	if (copy_from_user(&frame,
-				arg,
-				sizeof(struct msm_frame))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	}
-
-	rc = __msm_get_pic(sync, &frame);
-	if (rc < 0)
-		return rc;
-
-	if (sync->croplen && (!sync->stereocam_enabled)) {
-		if (frame.croplen != sync->croplen) {
-			pr_err("%s: invalid frame croplen %d,"
-				"expecting %d\n",
-				__func__,
-				frame.croplen,
-				sync->croplen);
-			return -EINVAL;
-		}
-
-		if (copy_to_user((void *)frame.cropinfo,
-				sync->cropinfo,
-				sync->croplen)) {
-			ERR_COPY_TO_USER();
-			return -EFAULT;
-		}
-	}
-	CDBG("%s: copy snapshot frame to user\n", __func__);
-	if (copy_to_user((void *)arg,
-				&frame, sizeof(struct msm_frame))) {
-		ERR_COPY_TO_USER();
-		rc = -EFAULT;
-	}
-
-	CDBG("%s: got pic frame\n", __func__);
-
-	return rc;
-}
-
-static int msm_set_crop(struct msm_sync *sync, void __user *arg)
-{
-	struct crop_info crop;
-
-	mutex_lock(&sync->lock);
-	if (copy_from_user(&crop,
-				arg,
-				sizeof(struct crop_info))) {
-		ERR_COPY_FROM_USER();
-		mutex_unlock(&sync->lock);
-		return -EFAULT;
-	}
-
-	if (crop.len != CROP_LEN) {
-		mutex_unlock(&sync->lock);
-		return -EINVAL;
-	}
-
-	if (!sync->croplen) {
-		sync->cropinfo = kmalloc(crop.len, GFP_KERNEL);
-		if (!sync->cropinfo) {
-			mutex_unlock(&sync->lock);
-			return -ENOMEM;
-		}
-	}
-
-	if (copy_from_user(sync->cropinfo,
-				crop.info,
-				crop.len)) {
-		ERR_COPY_FROM_USER();
-		sync->croplen = 0;
-		kfree(sync->cropinfo);
-		mutex_unlock(&sync->lock);
-		return -EFAULT;
-	}
-
-	sync->croplen = crop.len;
-
-	mutex_unlock(&sync->lock);
-	return 0;
-}
-
-static int msm_error_config(struct msm_sync *sync, void __user *arg)
-{
-	struct msm_queue_cmd *qcmd =
-		kmalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
-
-	qcmd->command = NULL;
-
-	if (qcmd)
-		atomic_set(&(qcmd->on_heap), 1);
-
-	if (copy_from_user(&(qcmd->error_code), arg, sizeof(uint32_t))) {
-		ERR_COPY_FROM_USER();
-		free_qcmd(qcmd);
-		return -EFAULT;
-	}
-
-	pr_err("%s: Enqueue Fake Frame with error code = %d\n", __func__,
-		qcmd->error_code);
-	msm_enqueue(&sync->frame_q, &qcmd->list_frame);
-	return 0;
-}
-
-static int msm_set_fd_roi(struct msm_sync *sync, void __user *arg)
-{
-	struct fd_roi_info fd_roi;
-
-	mutex_lock(&sync->lock);
-	if (copy_from_user(&fd_roi,
-			arg,
-			sizeof(struct fd_roi_info))) {
-		ERR_COPY_FROM_USER();
-		mutex_unlock(&sync->lock);
-		return -EFAULT;
-	}
-	if (fd_roi.info_len <= 0) {
-		mutex_unlock(&sync->lock);
-		return -EFAULT;
-	}
-
-	if (!sync->fdroiinfo.info) {
-		sync->fdroiinfo.info = kmalloc(fd_roi.info_len, GFP_KERNEL);
-		if (!sync->fdroiinfo.info) {
-			mutex_unlock(&sync->lock);
-			return -ENOMEM;
-		}
-		sync->fdroiinfo.info_len = fd_roi.info_len;
-	} else if (sync->fdroiinfo.info_len < fd_roi.info_len) {
-		mutex_unlock(&sync->lock);
-		return -EINVAL;
-    }
-
-	if (copy_from_user(sync->fdroiinfo.info,
-			fd_roi.info,
-			fd_roi.info_len)) {
-		ERR_COPY_FROM_USER();
-		kfree(sync->fdroiinfo.info);
-		sync->fdroiinfo.info = NULL;
-		mutex_unlock(&sync->lock);
-		return -EFAULT;
-	}
-	mutex_unlock(&sync->lock);
-	return 0;
-}
-
-static int msm_pp_grab(struct msm_sync *sync, void __user *arg)
-{
-	uint32_t enable;
-	if (copy_from_user(&enable, arg, sizeof(enable))) {
-		ERR_COPY_FROM_USER();
-		return -EFAULT;
-	} else {
-		enable &= PP_MASK;
-		if (enable & (enable - 1)) {
-			CDBG("%s: more than one PP request!\n",
-				__func__);
-		}
-		if (sync->pp_mask) {
-			if (enable) {
-				CDBG("%s: postproc %x is already enabled\n",
-					__func__, sync->pp_mask & enable);
-			} else {
-				sync->pp_mask &= enable;
-				CDBG("%s: sync->pp_mask %d enable %d\n",
-					__func__, sync->pp_mask, enable);
-			}
-		}
-
-		CDBG("%s: sync->pp_mask %d enable %d\n", __func__,
-			sync->pp_mask, enable);
-		sync->pp_mask |= enable;
-	}
-
-	return 0;
-}
-
-static int msm_put_st_frame(struct msm_sync *sync, void __user *arg)
-{
-	unsigned long flags;
-	unsigned long st_pphy;
-	if (sync->stereocam_enabled) {
-		/* Make stereo frame ready for VPE. */
-		struct msm_st_frame stereo_frame_half;
-
-		if (copy_from_user(&stereo_frame_half, arg,
-			sizeof(stereo_frame_half))) {
-			ERR_COPY_FROM_USER();
-			return -EFAULT;
-		}
-
-		if (stereo_frame_half.type == OUTPUT_TYPE_ST_L) {
-			struct msm_vfe_resp *vfe_rp;
-			struct msm_queue_cmd *qcmd;
-
-			spin_lock_irqsave(&pp_stereocam_spinlock, flags);
-			if (!sync->pp_stereocam) {
-				pr_warning("%s: no stereo frame to deliver!\n",
-					__func__);
-				spin_unlock_irqrestore(&pp_stereocam_spinlock,
-					flags);
-				return -EINVAL;
-			}
-			CDBG("%s: delivering left frame to VPE\n", __func__);
-
-			qcmd = sync->pp_stereocam;
-			sync->pp_stereocam = NULL;
-			spin_unlock_irqrestore(&pp_stereocam_spinlock, flags);
-
-			vfe_rp = (struct msm_vfe_resp *)qcmd->command;
-
-			CDBG("%s: Left Py = 0x%x y_off = %d cbcr_off = %d\n",
-				__func__, vfe_rp->phy.p0_phy,
-				stereo_frame_half.L.buf_p0_off,
-				stereo_frame_half.L.buf_p1_off);
-
-			sync->vpefn.vpe_cfg_offset(stereo_frame_half.packing,
-			vfe_rp->phy.p0_phy + stereo_frame_half.L.buf_p0_off,
-			vfe_rp->phy.p1_phy + stereo_frame_half.L.buf_p1_off,
-			&(qcmd->ts), OUTPUT_TYPE_ST_L, stereo_frame_half.L,
-			stereo_frame_half.frame_id);
-
-			free_qcmd(qcmd);
-		} else if (stereo_frame_half.type == OUTPUT_TYPE_ST_R) {
-			CDBG("%s: delivering right frame to VPE\n", __func__);
-			spin_lock_irqsave(&st_frame_spinlock, flags);
-
-			sync->stcam_conv_value =
-				stereo_frame_half.buf_info.stcam_conv_value;
-			sync->stcam_quality_ind =
-				stereo_frame_half.buf_info.stcam_quality_ind;
-
-			st_pphy = msm_pmem_frame_vtop_lookup(sync,
-				stereo_frame_half.buf_info.buffer,
-				stereo_frame_half.buf_info.planar0_off,
-				stereo_frame_half.buf_info.planar1_off,
-				stereo_frame_half.buf_info.planar2_off,
-				stereo_frame_half.buf_info.fd,
-				0); /* Do not change the active flag. */
-
-			sync->vpefn.vpe_cfg_offset(stereo_frame_half.packing,
-				st_pphy + stereo_frame_half.R.buf_p0_off,
-				st_pphy + stereo_frame_half.R.buf_p1_off,
-				NULL, OUTPUT_TYPE_ST_R, stereo_frame_half.R,
-				stereo_frame_half.frame_id);
-
-			spin_unlock_irqrestore(&st_frame_spinlock, flags);
-		} else {
-			CDBG("%s: Invalid Msg\n", __func__);
-		}
-	}
-
-	return 0;
-}
-
-static struct msm_queue_cmd *msm_get_pp_qcmd(struct msm_frame* frame)
-{
-	struct msm_queue_cmd *qcmd =
-		kmalloc(sizeof(struct msm_queue_cmd) +
-			sizeof(struct msm_frame), GFP_ATOMIC);
-	qcmd->command = (struct msm_frame *)(qcmd + 1);
-
-	qcmd->type = MSM_CAM_Q_PP_MSG;
-
-	ktime_get_ts(&(qcmd->ts));
-	memcpy(qcmd->command, frame, sizeof(struct msm_frame));
-	atomic_set(&(qcmd->on_heap), 1);
-	return qcmd;
-}
-
-static int msm_pp_release(struct msm_sync *sync, void __user *arg)
-{
-	unsigned long flags;
-
-	if (!sync->pp_mask) {
-		pr_warning("%s: pp not in progress for\n", __func__);
-		return -EINVAL;
-	}
-	if (sync->pp_mask & PP_PREV) {
-
-
-		spin_lock_irqsave(&pp_prev_spinlock, flags);
-		if (!sync->pp_prev) {
-			pr_err("%s: no preview frame to deliver!\n",
-				__func__);
-			spin_unlock_irqrestore(&pp_prev_spinlock,
-				flags);
-			return -EINVAL;
-		}
-		CDBG("%s: delivering pp_prev\n", __func__);
-
-			if (sync->frame_q.len <= 100 &&
-				sync->event_q.len <= 100) {
-					msm_enqueue(&sync->frame_q,
-						&sync->pp_prev->list_frame);
-			} else {
-				pr_err("%s, Error Queue limit exceeded f_q=%d,\
-					e_q = %d\n",
-					__func__, sync->frame_q.len,
-					sync->event_q.len);
-				free_qcmd(sync->pp_prev);
-				goto done;
-			}
-
-			sync->pp_prev = NULL;
-			spin_unlock_irqrestore(&pp_prev_spinlock, flags);
-		goto done;
-	}
-
-	if ((sync->pp_mask & PP_SNAP) ||
-		(sync->pp_mask & PP_RAW_SNAP)) {
-		struct msm_frame frame;
-		struct msm_queue_cmd *qcmd;
-
-		if (copy_from_user(&frame,
-			arg,
-			sizeof(struct msm_frame))) {
-			ERR_COPY_FROM_USER();
-			return -EFAULT;
-		}
-		qcmd = msm_get_pp_qcmd(&frame);
-		if (!qcmd) {
-			pr_err("%s: no snapshot to deliver!\n", __func__);
-			return -EINVAL;
-		}
-		CDBG("%s: delivering pp snap\n", __func__);
-		msm_enqueue(&sync->pict_q, &qcmd->list_pict);
-	}
-
-done:
-	return 0;
-}
-
-static long msm_ioctl_common(struct msm_cam_device *pmsm,
-		unsigned int cmd,
-		void __user *argp)
-{
-	switch (cmd) {
-	case MSM_CAM_IOCTL_REGISTER_PMEM:
-		CDBG("%s cmd = MSM_CAM_IOCTL_REGISTER_PMEM\n", __func__);
-		return msm_register_pmem(pmsm->sync, argp);
-	case MSM_CAM_IOCTL_UNREGISTER_PMEM:
-		CDBG("%s cmd = MSM_CAM_IOCTL_UNREGISTER_PMEM\n", __func__);
-		return msm_pmem_table_del(pmsm->sync, argp);
-	case MSM_CAM_IOCTL_RELEASE_FRAME_BUFFER:
-		CDBG("%s cmd = MSM_CAM_IOCTL_RELEASE_FRAME_BUFFER\n", __func__);
-		return msm_put_frame_buffer(pmsm->sync, argp);
-		break;
-	default:
-		CDBG("%s cmd invalid\n", __func__);
-		return -EINVAL;
-	}
-}
-
-static long msm_ioctl_config(struct file *filep, unsigned int cmd,
-	unsigned long arg)
-{
-	int rc = -EINVAL;
-	void __user *argp = (void __user *)arg;
-	struct msm_cam_device *pmsm = filep->private_data;
-
-	CDBG("%s: cmd %d\n", __func__, _IOC_NR(cmd));
-
-	switch (cmd) {
-	case MSM_CAM_IOCTL_GET_SENSOR_INFO:
-		rc = msm_get_sensor_info(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_CONFIG_VFE:
-		/* Coming from config thread for update */
-		rc = msm_config_vfe(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_CONFIG_VPE:
-		/* Coming from config thread for update */
-		rc = msm_config_vpe(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_GET_STATS:
-		/* Coming from config thread wait
-		 * for vfe statistics and control requests */
-		rc = msm_get_stats(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_ENABLE_VFE:
-		/* This request comes from control thread:
-		 * enable either QCAMTASK or VFETASK */
-		rc = msm_enable_vfe(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_DISABLE_VFE:
-		/* This request comes from control thread:
-		 * disable either QCAMTASK or VFETASK */
-		rc = msm_disable_vfe(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_VFE_APPS_RESET:
-		msm_camio_vfe_blk_reset();
-		rc = 0;
-		break;
-
-	case MSM_CAM_IOCTL_RELEASE_STATS_BUFFER:
-		rc = msm_put_stats_buffer(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_AXI_CONFIG:
-	case MSM_CAM_IOCTL_AXI_VPE_CONFIG:
-		rc = msm_axi_config(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_SET_CROP:
-		rc = msm_set_crop(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_SET_FD_ROI:
-		rc = msm_set_fd_roi(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_PICT_PP:
-		/* Grab one preview frame or one snapshot
-		 * frame.
-		 */
-		rc = msm_pp_grab(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_PICT_PP_DONE:
-		/* Release the preview of snapshot frame
-		 * that was grabbed.
-		 */
-		rc = msm_pp_release(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_PUT_ST_FRAME:
-		/* Release the left or right frame
-		 * that was sent for stereo processing.
-		 */
-		rc = msm_put_st_frame(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_SENSOR_IO_CFG:
-		rc = pmsm->sync->sctrl.s_config(argp);
-		break;
-
-	case MSM_CAM_IOCTL_FLASH_LED_CFG: {
-		uint32_t led_state;
-		if (copy_from_user(&led_state, argp, sizeof(led_state))) {
-			ERR_COPY_FROM_USER();
-			rc = -EFAULT;
-		} else
-			rc = msm_camera_flash_set_led_state(pmsm->sync->
-					sdata->flash_data, led_state);
-		break;
-	}
-
-	case MSM_CAM_IOCTL_STROBE_FLASH_CFG: {
-		uint32_t flash_type;
-		if (copy_from_user(&flash_type, argp, sizeof(flash_type))) {
-			pr_err("msm_strobe_flash_init failed");
-			ERR_COPY_FROM_USER();
-			rc = -EFAULT;
-		} else {
-			CDBG("msm_strobe_flash_init enter");
-			rc = msm_strobe_flash_init(pmsm->sync, flash_type);
-		}
-		break;
-	}
-
-	case MSM_CAM_IOCTL_STROBE_FLASH_RELEASE:
-		if (pmsm->sync->sdata->strobe_flash_data) {
-			rc = pmsm->sync->sfctrl.strobe_flash_release(
-				pmsm->sync->sdata->strobe_flash_data, 0);
-		}
-		break;
-
-	case MSM_CAM_IOCTL_STROBE_FLASH_CHARGE: {
-		uint32_t charge_en;
-		if (copy_from_user(&charge_en, argp, sizeof(charge_en))) {
-			ERR_COPY_FROM_USER();
-			rc = -EFAULT;
-		} else
-			rc = pmsm->sync->sfctrl.strobe_flash_charge(
-			pmsm->sync->sdata->strobe_flash_data->flash_charge,
-			charge_en, pmsm->sync->sdata->strobe_flash_data->
-				flash_recharge_duration);
-		break;
-	}
-
-	case MSM_CAM_IOCTL_FLASH_CTRL: {
-		struct flash_ctrl_data flash_info;
-		if (copy_from_user(&flash_info, argp, sizeof(flash_info))) {
-			ERR_COPY_FROM_USER();
-			rc = -EFAULT;
-		} else
-			rc = msm_flash_ctrl(pmsm->sync->sdata, &flash_info);
-
-		break;
-	}
-
-	case MSM_CAM_IOCTL_ERROR_CONFIG:
-		rc = msm_error_config(pmsm->sync, argp);
-		break;
-
-	case MSM_CAM_IOCTL_ABORT_CAPTURE: {
-		unsigned long flags = 0;
-		CDBG("get_pic:MSM_CAM_IOCTL_ABORT_CAPTURE\n");
-		spin_lock_irqsave(&pmsm->sync->abort_pict_lock, flags);
-		pmsm->sync->get_pic_abort = 1;
-		spin_unlock_irqrestore(&pmsm->sync->abort_pict_lock, flags);
-		wake_up(&(pmsm->sync->pict_q.wait));
-		rc = 0;
-		break;
-	}
-
-	default:
-		rc = msm_ioctl_common(pmsm, cmd, argp);
-		break;
-	}
-
-	CDBG("%s: cmd %d DONE\n", __func__, _IOC_NR(cmd));
-	return rc;
-}
-
-static int msm_unblock_poll_frame(struct msm_sync *);
-
-static long msm_ioctl_frame(struct file *filep, unsigned int cmd,
-	unsigned long arg)
-{
-	int rc = -EINVAL;
-	void __user *argp = (void __user *)arg;
-	struct msm_cam_device *pmsm = filep->private_data;
-
-
-	switch (cmd) {
-	case MSM_CAM_IOCTL_GETFRAME:
-		/* Coming from frame thread to get frame
-		 * after SELECT is done */
-		rc = msm_get_frame(pmsm->sync, argp);
-		break;
-	case MSM_CAM_IOCTL_RELEASE_FRAME_BUFFER:
-		rc = msm_put_frame_buffer(pmsm->sync, argp);
-		break;
-	case MSM_CAM_IOCTL_UNBLOCK_POLL_FRAME:
-		rc = msm_unblock_poll_frame(pmsm->sync);
-		break;
-	default:
-		break;
-	}
-
-	return rc;
-}
-
-static int msm_unblock_poll_pic(struct msm_sync *sync);
-static long msm_ioctl_pic(struct file *filep, unsigned int cmd,
-	unsigned long arg)
-{
-	int rc = -EINVAL;
-	void __user *argp = (void __user *)arg;
-	struct msm_cam_device *pmsm = filep->private_data;
-
-
-	switch (cmd) {
-	case MSM_CAM_IOCTL_GET_PICTURE:
-		rc = msm_get_pic(pmsm->sync, argp);
-		break;
-	case MSM_CAM_IOCTL_RELEASE_PIC_BUFFER:
-		rc = msm_put_pic_buffer(pmsm->sync, argp);
-		break;
-	case MSM_CAM_IOCTL_UNBLOCK_POLL_PIC_FRAME:
-		rc = msm_unblock_poll_pic(pmsm->sync);
-		break;
-	default:
-		break;
-	}
-
-	return rc;
-}
-
-
-static long msm_ioctl_control(struct file *filep, unsigned int cmd,
-	unsigned long arg)
-{
-	int rc = -EINVAL;
-	void __user *argp = (void __user *)arg;
-	struct msm_control_device *ctrl_pmsm = filep->private_data;
-	struct msm_cam_device *pmsm = ctrl_pmsm->pmsm;
-
-	switch (cmd) {
-	case MSM_CAM_IOCTL_CTRL_COMMAND:
-		/* Coming from control thread, may need to wait for
-		 * command status */
-		CDBG("calling msm_control kernel msm_ioctl_control\n");
-		mutex_lock(&ctrl_cmd_lock);
-		rc = msm_control(ctrl_pmsm, 1, argp);
-		mutex_unlock(&ctrl_cmd_lock);
-		break;
-	case MSM_CAM_IOCTL_CTRL_COMMAND_2:
-		/* Sends a message, returns immediately */
-		rc = msm_control(ctrl_pmsm, 0, argp);
-		break;
-	case MSM_CAM_IOCTL_CTRL_CMD_DONE:
-		/* Config thread calls the control thread to notify it
-		 * of the result of a MSM_CAM_IOCTL_CTRL_COMMAND.
-		 */
-		rc = msm_ctrl_cmd_done(ctrl_pmsm, argp);
-		break;
-	case MSM_CAM_IOCTL_GET_SENSOR_INFO:
-		rc = msm_get_sensor_info(pmsm->sync, argp);
-		break;
-	case MSM_CAM_IOCTL_GET_CAMERA_INFO:
-		rc = msm_get_camera_info(argp);
-		break;
-	default:
-		rc = msm_ioctl_common(pmsm, cmd, argp);
-		break;
-	}
-
-	return rc;
-}
-
-static int __msm_release(struct msm_sync *sync)
-{
-	struct msm_pmem_region *region;
-	struct hlist_node *hnode;
-	struct hlist_node *n;
-
-	mutex_lock(&sync->lock);
-	if (sync->opencnt)
-		sync->opencnt--;
-	pr_info("%s, open count =%d\n", __func__, sync->opencnt);
-	if (!sync->opencnt) {
-		/* need to clean up system resource */
-		pr_info("%s, release VFE\n", __func__);
-		if (sync->core_powered_on) {
-			if (sync->vfefn.vfe_release)
-				sync->vfefn.vfe_release(sync->pdev);
-			/*sensor release */
-			pr_info("%s, release Sensor\n", __func__);
-			sync->sctrl.s_release();
-			CDBG("%s, msm_camio_sensor_clk_off\n", __func__);
-			msm_camio_sensor_clk_off(sync->pdev);
-			if (sync->sfctrl.strobe_flash_release) {
-				CDBG("%s, strobe_flash_release\n", __func__);
-				sync->sfctrl.strobe_flash_release(
-				sync->sdata->strobe_flash_data, 1);
-			}
-		}
-		kfree(sync->cropinfo);
-		sync->cropinfo = NULL;
-		sync->croplen = 0;
-		CDBG("%s, free frame pmem region\n", __func__);
-		hlist_for_each_entry_safe(region, hnode, n,
-				&sync->pmem_frames, list) {
-			hlist_del(hnode);
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-				ion_free(client_for_ion, region->handle);
-#else
-			put_pmem_file(region->file);
-#endif
-			kfree(region);
-		}
-		CDBG("%s, free stats pmem region\n", __func__);
-		hlist_for_each_entry_safe(region, hnode, n,
-				&sync->pmem_stats, list) {
-			hlist_del(hnode);
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-				ion_free(client_for_ion, region->handle);
-#else
-			put_pmem_file(region->file);
-#endif
-			kfree(region);
-		}
-		msm_queue_drain(&sync->pict_q, list_pict);
-		msm_queue_drain(&sync->event_q, list_config);
-
-		pm_qos_update_request(&sync->idle_pm_qos, PM_QOS_DEFAULT_VALUE);
-		sync->apps_id = NULL;
-		sync->core_powered_on = 0;
-	}
-	mutex_unlock(&sync->lock);
-	ion_client_destroy(client_for_ion);
-
-	return 0;
-}
-
-static int msm_release_config(struct inode *node, struct file *filep)
-{
-	int rc;
-	struct msm_cam_device *pmsm = filep->private_data;
-	pr_info("%s: %s\n", __func__, filep->f_path.dentry->d_name.name);
-	rc = __msm_release(pmsm->sync);
-	if (!rc) {
-		msm_queue_drain(&pmsm->sync->event_q, list_config);
-		atomic_set(&pmsm->opened, 0);
-	}
-	return rc;
-}
-
-static int msm_release_control(struct inode *node, struct file *filep)
-{
-	int rc;
-	struct msm_control_device *ctrl_pmsm = filep->private_data;
-	struct msm_cam_device *pmsm = ctrl_pmsm->pmsm;
-	pr_info("%s: %s\n", __func__, filep->f_path.dentry->d_name.name);
-	g_v4l2_opencnt--;
-	mutex_lock(&pmsm->sync->lock);
-	if (pmsm->sync->core_powered_on && pmsm->sync->vfefn.vfe_stop) {
-		pr_info("%s, stop vfe if active\n", __func__);
-		pmsm->sync->vfefn.vfe_stop();
-	}
-	mutex_unlock(&pmsm->sync->lock);
-	rc = __msm_release(pmsm->sync);
-	if (!rc) {
-		msm_queue_drain(&ctrl_pmsm->ctrl_q, list_control);
-		kfree(ctrl_pmsm);
-	}
-	return rc;
-}
-
-static int msm_release_frame(struct inode *node, struct file *filep)
-{
-	int rc;
-	struct msm_cam_device *pmsm = filep->private_data;
-	pr_info("%s: %s\n", __func__, filep->f_path.dentry->d_name.name);
-	rc = __msm_release(pmsm->sync);
-	if (!rc) {
-		msm_queue_drain(&pmsm->sync->frame_q, list_frame);
-		atomic_set(&pmsm->opened, 0);
-	}
-	return rc;
-}
-
-
-static int msm_release_pic(struct inode *node, struct file *filep)
-{
-	int rc;
-	struct msm_cam_device *pmsm = filep->private_data;
-	CDBG("%s: %s\n", __func__, filep->f_path.dentry->d_name.name);
-	rc = __msm_release(pmsm->sync);
-	if (!rc) {
-		msm_queue_drain(&pmsm->sync->pict_q, list_pict);
-		atomic_set(&pmsm->opened, 0);
-	}
-	return rc;
-}
-
-static int msm_unblock_poll_pic(struct msm_sync *sync)
-{
-	unsigned long flags;
-	CDBG("%s\n", __func__);
-	spin_lock_irqsave(&sync->pict_q.lock, flags);
-	sync->unblock_poll_pic_frame = 1;
-	wake_up(&sync->pict_q.wait);
-	spin_unlock_irqrestore(&sync->pict_q.lock, flags);
-	return 0;
-}
-
-static int msm_unblock_poll_frame(struct msm_sync *sync)
-{
-	unsigned long flags;
-	CDBG("%s\n", __func__);
-	spin_lock_irqsave(&sync->frame_q.lock, flags);
-	sync->unblock_poll_frame = 1;
-	wake_up(&sync->frame_q.wait);
-	spin_unlock_irqrestore(&sync->frame_q.lock, flags);
-	return 0;
-}
-
-static unsigned int __msm_poll_frame(struct msm_sync *sync,
-		struct file *filep,
-		struct poll_table_struct *pll_table)
-{
-	int rc = 0;
-	unsigned long flags;
-
-	poll_wait(filep, &sync->frame_q.wait, pll_table);
-
-	spin_lock_irqsave(&sync->frame_q.lock, flags);
-	if (!list_empty_careful(&sync->frame_q.list))
-		/* frame ready */
-		rc = POLLIN | POLLRDNORM;
-	if (sync->unblock_poll_frame) {
-		CDBG("%s: sync->unblock_poll_frame is true\n", __func__);
-		rc |= POLLPRI;
-		sync->unblock_poll_frame = 0;
-	}
-	spin_unlock_irqrestore(&sync->frame_q.lock, flags);
-
-	return rc;
-}
-
-static unsigned int __msm_poll_pic(struct msm_sync *sync,
-		struct file *filep,
-		struct poll_table_struct *pll_table)
-{
-	int rc = 0;
-	unsigned long flags;
-
-	poll_wait(filep, &sync->pict_q.wait , pll_table);
-	spin_lock_irqsave(&sync->abort_pict_lock, flags);
-	if (sync->get_pic_abort == 1) {
-		/* TODO: need to pass an error case */
-		sync->get_pic_abort = 0;
-	}
-	spin_unlock_irqrestore(&sync->abort_pict_lock, flags);
-
-	spin_lock_irqsave(&sync->pict_q.lock, flags);
-	if (!list_empty_careful(&sync->pict_q.list))
-		/* frame ready */
-		rc = POLLIN | POLLRDNORM;
-	if (sync->unblock_poll_pic_frame) {
-		CDBG("%s: sync->unblock_poll_pic_frame is true\n", __func__);
-		rc |= POLLPRI;
-		sync->unblock_poll_pic_frame = 0;
-	}
-	spin_unlock_irqrestore(&sync->pict_q.lock, flags);
-
-	return rc;
-}
-
-static unsigned int msm_poll_frame(struct file *filep,
-	struct poll_table_struct *pll_table)
-{
-	struct msm_cam_device *pmsm = filep->private_data;
-	return __msm_poll_frame(pmsm->sync, filep, pll_table);
-}
-
-static unsigned int msm_poll_pic(struct file *filep,
-	struct poll_table_struct *pll_table)
-{
-	struct msm_cam_device *pmsm = filep->private_data;
-	return __msm_poll_pic(pmsm->sync, filep, pll_table);
-}
-
-static unsigned int __msm_poll_config(struct msm_sync *sync,
-		struct file *filep,
-		struct poll_table_struct *pll_table)
-{
-	int rc = 0;
-	unsigned long flags;
-
-	poll_wait(filep, &sync->event_q.wait, pll_table);
-
-	spin_lock_irqsave(&sync->event_q.lock, flags);
-	if (!list_empty_careful(&sync->event_q.list))
-		/* event ready */
-		rc = POLLIN | POLLRDNORM;
-	spin_unlock_irqrestore(&sync->event_q.lock, flags);
-
-	return rc;
-}
-
-static unsigned int msm_poll_config(struct file *filep,
-	struct poll_table_struct *pll_table)
-{
-	struct msm_cam_device *pmsm = filep->private_data;
-	return __msm_poll_config(pmsm->sync, filep, pll_table);
-}
-
-/*
- * This function executes in interrupt context.
- */
-
-static void *msm_vfe_sync_alloc(int size,
-			void *syncdata __attribute__((unused)),
-			gfp_t gfp)
-{
-	struct msm_queue_cmd *qcmd =
-		kzalloc(sizeof(struct msm_queue_cmd) + size, gfp);
-	if (qcmd) {
-		atomic_set(&qcmd->on_heap, 1);
-		return qcmd + 1;
-	}
-	return NULL;
-}
-
-static void *msm_vpe_sync_alloc(int size,
-			void *syncdata __attribute__((unused)),
-			gfp_t gfp)
-{
-	struct msm_queue_cmd *qcmd =
-		kzalloc(sizeof(struct msm_queue_cmd) + size, gfp);
-	if (qcmd) {
-		atomic_set(&qcmd->on_heap, 1);
-		return qcmd + 1;
-	}
-	return NULL;
-}
-
-static void msm_vfe_sync_free(void *ptr)
-{
-	if (ptr) {
-		struct msm_queue_cmd *qcmd =
-			(struct msm_queue_cmd *)ptr;
-		qcmd--;
-		if (atomic_read(&qcmd->on_heap))
-			kfree(qcmd);
-	}
-}
-
-static void msm_vpe_sync_free(void *ptr)
-{
-	if (ptr) {
-		struct msm_queue_cmd *qcmd =
-			(struct msm_queue_cmd *)ptr;
-		qcmd--;
-		if (atomic_read(&qcmd->on_heap))
-			kfree(qcmd);
-	}
-}
-
-/*
- * This function executes in interrupt context.
- */
-
-static void msm_vfe_sync(struct msm_vfe_resp *vdata,
-		enum msm_queue qtype, void *syncdata,
-		gfp_t gfp)
-{
-	struct msm_queue_cmd *qcmd = NULL;
-	struct msm_sync *sync = (struct msm_sync *)syncdata;
-	unsigned long flags;
-
-	if (!sync) {
-		pr_err("%s: no context in dsp callback.\n", __func__);
-		return;
-	}
-
-	qcmd = ((struct msm_queue_cmd *)vdata) - 1;
-	qcmd->type = qtype;
-	qcmd->command = vdata;
-
-	ktime_get_ts(&(qcmd->ts));
-
-	if (qtype != MSM_CAM_Q_VFE_MSG)
-		goto vfe_for_config;
-
-	CDBG("%s: vdata->type %d\n", __func__, vdata->type);
-
-	switch (vdata->type) {
-	case VFE_MSG_OUTPUT_P:
-		if (sync->pp_mask & PP_PREV) {
-			CDBG("%s: PP_PREV in progress: p0_add %x p1_add %x\n",
-				__func__,
-				vdata->phy.p0_phy,
-				vdata->phy.p1_phy);
-			spin_lock_irqsave(&pp_prev_spinlock, flags);
-			if (sync->pp_prev)
-				CDBG("%s: overwriting pp_prev!\n",
-					__func__);
-			CDBG("%s: sending preview to config\n", __func__);
-			sync->pp_prev = qcmd;
-			spin_unlock_irqrestore(&pp_prev_spinlock, flags);
-			sync->pp_frame_avail = 1;
-			if (atomic_read(&qcmd->on_heap))
-				atomic_add(1, &qcmd->on_heap);
-			break;
-		}
-		CDBG("%s: msm_enqueue frame_q\n", __func__);
-		if (sync->stereocam_enabled)
-			CDBG("%s: Enqueue VFE_MSG_OUTPUT_P to event_q for "
-				"stereo processing\n", __func__);
-		else {
-			if (sync->frame_q.len <= 100 &&
-				sync->event_q.len <= 100) {
-				if (atomic_read(&qcmd->on_heap))
-					atomic_add(1, &qcmd->on_heap);
-				msm_enqueue(&sync->frame_q, &qcmd->list_frame);
-			} else {
-				pr_err("%s, Error Queue limit exceeded "
-					"f_q = %d, e_q = %d\n",	__func__,
-					sync->frame_q.len, sync->event_q.len);
-				free_qcmd(qcmd);
-				return;
-			}
-		}
-		break;
-
-	case VFE_MSG_OUTPUT_T:
-		if (sync->stereocam_enabled) {
-			spin_lock_irqsave(&pp_stereocam_spinlock, flags);
-
-			/* if out1/2 is currently in progress, save the qcmd
-			and issue only ionce the 1st one completes the 3D
-			pipeline */
-			if (STEREO_SNAP_BUFFER1_PROCESSING ==
-				sync->stereo_state) {
-				sync->pp_stereocam2 = qcmd;
-				spin_unlock_irqrestore(&pp_stereocam_spinlock,
-					flags);
-				if (atomic_read(&qcmd->on_heap))
-					atomic_add(1, &qcmd->on_heap);
-				CDBG("%s: snapshot stereo in progress\n",
-					__func__);
-				return;
-			}
-
-			if (sync->pp_stereocam)
-				CDBG("%s: overwriting pp_stereocam!\n",
-					__func__);
-
-			CDBG("%s: sending stereo frame to config\n", __func__);
-			sync->pp_stereocam = qcmd;
-			sync->stereo_state =
-				STEREO_SNAP_BUFFER1_PROCESSING;
-
-			spin_unlock_irqrestore(&pp_stereocam_spinlock, flags);
-
-			/* Increament on_heap by one because the same qcmd will
-			be used for VPE in msm_pp_release. */
-			if (atomic_read(&qcmd->on_heap))
-				atomic_add(1, &qcmd->on_heap);
-			CDBG("%s: Enqueue VFE_MSG_OUTPUT_T to event_q for "
-				"stereo processing.\n", __func__);
-			break;
-		}
-		if (sync->pp_mask & PP_SNAP) {
-			CDBG("%s: pp sending thumbnail to config\n",
-				__func__);
-		} else {
-			msm_enqueue(&sync->pict_q, &qcmd->list_pict);
-			return;
-		}
-
-	case VFE_MSG_OUTPUT_S:
-		if (sync->stereocam_enabled &&
-			sync->stereo_state != STEREO_RAW_SNAP_STARTED) {
-			spin_lock_irqsave(&pp_stereocam_spinlock, flags);
-
-			/* if out1/2 is currently in progress, save the qcmd
-			and issue only once the 1st one completes the 3D
-			pipeline */
-			if (STEREO_SNAP_BUFFER1_PROCESSING ==
-				sync->stereo_state) {
-				sync->pp_stereocam2 = qcmd;
-				spin_unlock_irqrestore(&pp_stereocam_spinlock,
-					flags);
-				if (atomic_read(&qcmd->on_heap))
-					atomic_add(1, &qcmd->on_heap);
-				CDBG("%s: snapshot stereo in progress\n",
-					__func__);
-				return;
-			}
-			if (sync->pp_stereocam)
-				CDBG("%s: overwriting pp_stereocam!\n",
-					__func__);
-
-			CDBG("%s: sending stereo frame to config\n", __func__);
-			sync->pp_stereocam = qcmd;
-			sync->stereo_state =
-				STEREO_SNAP_BUFFER1_PROCESSING;
-
-			spin_unlock_irqrestore(&pp_stereocam_spinlock, flags);
-
-			/* Increament on_heap by one because the same qcmd will
-			be used for VPE in msm_pp_release. */
-			if (atomic_read(&qcmd->on_heap))
-				atomic_add(1, &qcmd->on_heap);
-			CDBG("%s: Enqueue VFE_MSG_OUTPUT_S to event_q for "
-				"stereo processing.\n", __func__);
-			break;
-		}
-		if (sync->pp_mask & PP_SNAP) {
-			CDBG("%s: pp sending main image to config\n",
-				__func__);
-		} else {
-			CDBG("%s: enqueue to picture queue\n", __func__);
-			msm_enqueue(&sync->pict_q, &qcmd->list_pict);
-			return;
-		}
-		break;
-
-	case VFE_MSG_OUTPUT_V:
-		if (sync->stereocam_enabled) {
-			spin_lock_irqsave(&pp_stereocam_spinlock, flags);
-
-			if (sync->pp_stereocam)
-				CDBG("%s: overwriting pp_stereocam!\n",
-					__func__);
-
-			CDBG("%s: sending stereo frame to config\n", __func__);
-			sync->pp_stereocam = qcmd;
-
-			spin_unlock_irqrestore(&pp_stereocam_spinlock, flags);
-
-			/* Increament on_heap by one because the same qcmd will
-			be used for VPE in msm_pp_release. */
-			if (atomic_read(&qcmd->on_heap))
-				atomic_add(1, &qcmd->on_heap);
-			CDBG("%s: Enqueue VFE_MSG_OUTPUT_V to event_q for "
-				"stereo processing.\n", __func__);
-			break;
-		}
-		if (sync->vpefn.vpe_cfg_update) {
-			CDBG("dis_en = %d\n", *sync->vpefn.dis);
-			if (*(sync->vpefn.dis)) {
-				memset(&(vdata->vpe_bf), 0,
-					sizeof(vdata->vpe_bf));
-
-				if (sync->cropinfo != NULL)
-					vdata->vpe_bf.vpe_crop =
-				*(struct video_crop_t *)(sync->cropinfo);
-
-				vdata->vpe_bf.p0_phy = vdata->phy.p0_phy;
-				vdata->vpe_bf.p1_phy = vdata->phy.p1_phy;
-				vdata->vpe_bf.ts = (qcmd->ts);
-				vdata->vpe_bf.frame_id = vdata->phy.frame_id;
-				qcmd->command = vdata;
-				msm_enqueue_vpe(&sync->vpe_q,
-					&qcmd->list_vpe_frame);
-				return;
-			} else if (sync->vpefn.vpe_cfg_update(sync->cropinfo)) {
-				CDBG("%s: msm_enqueue video frame to vpe time "
-					"= %ld\n", __func__, qcmd->ts.tv_nsec);
-
-				sync->vpefn.send_frame_to_vpe(
-					vdata->phy.p0_phy,
-					vdata->phy.p1_phy,
-					&(qcmd->ts), OUTPUT_TYPE_V);
-
-				free_qcmd(qcmd);
-				return;
-			} else {
-				CDBG("%s: msm_enqueue video frame_q\n",
-					__func__);
-				if (sync->liveshot_enabled) {
-					CDBG("%s: msm_enqueue liveshot\n",
-						__func__);
-					vdata->phy.output_id |= OUTPUT_TYPE_L;
-					sync->liveshot_enabled = false;
-				}
-				if (sync->frame_q.len <= 100 &&
-					sync->event_q.len <= 100) {
-						msm_enqueue(&sync->frame_q,
-							&qcmd->list_frame);
-				} else {
-					pr_err("%s, Error Queue limit exceeded\
-						f_q = %d, e_q = %d\n",
-						__func__, sync->frame_q.len,
-						sync->event_q.len);
-					free_qcmd(qcmd);
-				}
-
-				return;
-			}
-		} else {
-			CDBG("%s: msm_enqueue video frame_q\n",	__func__);
-			if (sync->frame_q.len <= 100 &&
-				sync->event_q.len <= 100) {
-				msm_enqueue(&sync->frame_q, &qcmd->list_frame);
-			} else {
-				pr_err("%s, Error Queue limit exceeded\
-					f_q = %d, e_q = %d\n",
-					__func__, sync->frame_q.len,
-					sync->event_q.len);
-				free_qcmd(qcmd);
-			}
-
-			return;
-		}
-
-	case VFE_MSG_SNAPSHOT:
-		if (sync->pp_mask & (PP_SNAP | PP_RAW_SNAP)) {
-			CDBG("%s: PP_SNAP in progress: pp_mask %x\n",
-				__func__, sync->pp_mask);
-		} else {
-			if (atomic_read(&qcmd->on_heap))
-				atomic_add(1, &qcmd->on_heap);
-			CDBG("%s: VFE_MSG_SNAPSHOT store\n",
-				__func__);
-			if (sync->stereocam_enabled &&
-				sync->stereo_state != STEREO_RAW_SNAP_STARTED) {
-				sync->pp_stereosnap = qcmd;
-				return;
-			}
-		}
-		break;
-
-	case VFE_MSG_COMMON:
-		CDBG("%s: qtype %d, comp stats, enqueue event_q.\n",
-			__func__, vdata->type);
-		break;
-
-	case VFE_MSG_GENERAL:
-		CDBG("%s: qtype %d, general msg, enqueue event_q.\n",
-			__func__, vdata->type);
-		break;
-
-	default:
-		CDBG("%s: qtype %d not handled\n", __func__, vdata->type);
-		/* fall through, send to config. */
-	}
-
-vfe_for_config:
-	CDBG("%s: msm_enqueue event_q\n", __func__);
-	if (sync->frame_q.len <= 100 && sync->event_q.len <= 100) {
-		msm_enqueue(&sync->event_q, &qcmd->list_config);
-	} else if (sync->event_q.len > 100) {
-		pr_err("%s, Error Event Queue limit exceeded f_q = %d, e_q = %d\n",
-			__func__, sync->frame_q.len, sync->event_q.len);
-		qcmd->error_code = 0xffffffff;
-		qcmd->command = NULL;
-		msm_enqueue(&sync->frame_q, &qcmd->list_frame);
-	} else {
-		pr_err("%s, Error Queue limit exceeded f_q = %d, e_q = %d\n",
-			__func__, sync->frame_q.len, sync->event_q.len);
-		free_qcmd(qcmd);
-	}
-
-}
-
-static void msm_vpe_sync(struct msm_vpe_resp *vdata,
-	enum msm_queue qtype, void *syncdata, void *ts, gfp_t gfp)
-{
-	struct msm_queue_cmd *qcmd = NULL;
-	unsigned long flags;
-
-	struct msm_sync *sync = (struct msm_sync *)syncdata;
-	if (!sync) {
-		pr_err("%s: no context in dsp callback.\n", __func__);
-		return;
-	}
-
-	qcmd = ((struct msm_queue_cmd *)vdata) - 1;
-	qcmd->type = qtype;
-	qcmd->command = vdata;
-	qcmd->ts = *((struct timespec *)ts);
-
-	if (qtype != MSM_CAM_Q_VPE_MSG) {
-		pr_err("%s: Invalid qcmd type = %d.\n", __func__, qcmd->type);
-		free_qcmd(qcmd);
-		return;
-	}
-
-	CDBG("%s: vdata->type %d\n", __func__, vdata->type);
-	switch (vdata->type) {
-	case VPE_MSG_OUTPUT_V:
-		if (sync->liveshot_enabled) {
-			CDBG("%s: msm_enqueue liveshot %d\n", __func__,
-				sync->liveshot_enabled);
-			vdata->phy.output_id |= OUTPUT_TYPE_L;
-			sync->liveshot_enabled = false;
-		}
-		vdata->phy.p2_phy = vdata->phy.p0_phy;
-		if (sync->frame_q.len <= 100 && sync->event_q.len <= 100) {
-			CDBG("%s: enqueue to frame_q from VPE\n", __func__);
-			msm_enqueue(&sync->frame_q, &qcmd->list_frame);
-		} else {
-			pr_err("%s, Error Queue limit exceeded f_q = %d, "
-				"e_q = %d\n", __func__, sync->frame_q.len,
-				sync->event_q.len);
-			free_qcmd(qcmd);
-		}
-		return;
-
-	case VPE_MSG_OUTPUT_ST_L:
-		CDBG("%s: enqueue left frame done msg to event_q from VPE\n",
-			__func__);
-		msm_enqueue(&sync->event_q, &qcmd->list_config);
-		return;
-
-	case VPE_MSG_OUTPUT_ST_R:
-		spin_lock_irqsave(&pp_stereocam_spinlock, flags);
-		CDBG("%s: received VPE_MSG_OUTPUT_ST_R state %d\n", __func__,
-			sync->stereo_state);
-
-		if (STEREO_SNAP_BUFFER1_PROCESSING == sync->stereo_state) {
-			msm_enqueue(&sync->pict_q, &qcmd->list_pict);
-			qcmd = sync->pp_stereocam2;
-			sync->pp_stereocam = sync->pp_stereocam2;
-			sync->pp_stereocam2 = NULL;
-			msm_enqueue(&sync->event_q, &qcmd->list_config);
-			sync->stereo_state =
-				STEREO_SNAP_BUFFER2_PROCESSING;
-		} else if (STEREO_SNAP_BUFFER2_PROCESSING ==
-				sync->stereo_state) {
-			sync->stereo_state = STEREO_SNAP_IDLE;
-			/* Send snapshot DONE */
-			msm_enqueue(&sync->pict_q, &qcmd->list_pict);
-			qcmd = sync->pp_stereosnap;
-			sync->pp_stereosnap = NULL;
-			CDBG("%s: send SNAPSHOT_DONE message\n", __func__);
-			msm_enqueue(&sync->event_q, &qcmd->list_config);
-		} else {
-			if (atomic_read(&qcmd->on_heap))
-				atomic_add(1, &qcmd->on_heap);
-			msm_enqueue(&sync->event_q, &qcmd->list_config);
-			if (sync->stereo_state == STEREO_VIDEO_ACTIVE) {
-				CDBG("%s: st frame to frame_q from VPE\n",
-					__func__);
-				msm_enqueue(&sync->frame_q, &qcmd->list_frame);
-			}
-		}
-		spin_unlock_irqrestore(&pp_stereocam_spinlock, flags);
-		return;
-
-	default:
-		pr_err("%s: qtype %d not handled\n", __func__, vdata->type);
-	}
-	pr_err("%s: Should not come here. Error.\n", __func__);
-}
-
-static struct msm_vpe_callback msm_vpe_s = {
-	.vpe_resp = msm_vpe_sync,
-	.vpe_alloc = msm_vpe_sync_alloc,
-	.vpe_free = msm_vpe_sync_free,
-};
-
-static struct msm_vfe_callback msm_vfe_s = {
-	.vfe_resp = msm_vfe_sync,
-	.vfe_alloc = msm_vfe_sync_alloc,
-	.vfe_free = msm_vfe_sync_free,
-};
-
-static int __msm_open(struct msm_cam_device *pmsm, const char *const apps_id,
-			int is_controlnode)
-{
-	int rc = 0;
-	struct msm_sync *sync = pmsm->sync;
-
-	mutex_lock(&sync->lock);
-	if (sync->apps_id && strcmp(sync->apps_id, apps_id)
-				&& (!strcmp(MSM_APPS_ID_V4L2, apps_id))) {
-		pr_err("%s(%s): sensor %s is already opened for %s\n",
-			__func__,
-			apps_id,
-			sync->sdata->sensor_name,
-			sync->apps_id);
-		rc = -EBUSY;
-		goto msm_open_done;
-	}
-
-	sync->apps_id = apps_id;
-
-	if (!sync->core_powered_on && !is_controlnode) {
-		pm_qos_update_request(&sync->idle_pm_qos,
-			msm_cpuidle_get_deep_idle_latency());
-
-		msm_camvfe_fn_init(&sync->vfefn, sync);
-		if (sync->vfefn.vfe_init) {
-			sync->pp_frame_avail = 0;
-			sync->get_pic_abort = 0;
-			rc = msm_camio_sensor_clk_on(sync->pdev);
-			if (rc < 0) {
-				pr_err("%s: setting sensor clocks failed: %d\n",
-					__func__, rc);
-				goto msm_open_err;
-			}
-			rc = sync->sctrl.s_init(sync->sdata);
-			if (rc < 0) {
-				pr_err("%s: sensor init failed: %d\n",
-					__func__, rc);
-				msm_camio_sensor_clk_off(sync->pdev);
-				goto msm_open_err;
-			}
-			rc = sync->vfefn.vfe_init(&msm_vfe_s,
-				sync->pdev);
-			if (rc < 0) {
-				pr_err("%s: vfe_init failed at %d\n",
-					__func__, rc);
-				sync->sctrl.s_release();
-				msm_camio_sensor_clk_off(sync->pdev);
-				goto msm_open_err;
-			}
-		} else {
-			pr_err("%s: no sensor init func\n", __func__);
-			rc = -ENODEV;
-			goto msm_open_err;
-		}
-		msm_camvpe_fn_init(&sync->vpefn, sync);
-
-		spin_lock_init(&sync->abort_pict_lock);
-		spin_lock_init(&pp_prev_spinlock);
-		spin_lock_init(&pp_stereocam_spinlock);
-		spin_lock_init(&st_frame_spinlock);
-		if (rc >= 0) {
-			msm_region_init(sync);
-			if (sync->vpefn.vpe_reg)
-				sync->vpefn.vpe_reg(&msm_vpe_s);
-			sync->unblock_poll_frame = 0;
-			sync->unblock_poll_pic_frame = 0;
-		}
-		sync->core_powered_on = 1;
-	}
-	sync->opencnt++;
-	client_for_ion = msm_ion_client_create(-1, "camera");
-
-msm_open_done:
-	mutex_unlock(&sync->lock);
-	return rc;
-
-msm_open_err:
-	atomic_set(&pmsm->opened, 0);
-	mutex_unlock(&sync->lock);
-	return rc;
-}
-
-static int msm_open_common(struct inode *inode, struct file *filep,
-			int once, int is_controlnode)
-{
-	int rc;
-	struct msm_cam_device *pmsm =
-		container_of(inode->i_cdev, struct msm_cam_device, cdev);
-
-	CDBG("%s: open %s\n", __func__, filep->f_path.dentry->d_name.name);
-
-	if (atomic_cmpxchg(&pmsm->opened, 0, 1) && once) {
-		pr_err("%s: %s is already opened.\n",
-			__func__,
-			filep->f_path.dentry->d_name.name);
-		return -EBUSY;
-	}
-
-	rc = nonseekable_open(inode, filep);
-	if (rc < 0) {
-		pr_err("%s: nonseekable_open error %d\n", __func__, rc);
-		return rc;
-	}
-
-	rc = __msm_open(pmsm, MSM_APPS_ID_PROP, is_controlnode);
-	if (rc < 0)
-		return rc;
-	filep->private_data = pmsm;
-	CDBG("%s: rc %d\n", __func__, rc);
-	return rc;
-}
-
-static int msm_open_frame(struct inode *inode, struct file *filep)
-{
-	struct msm_cam_device *pmsm =
-		container_of(inode->i_cdev, struct msm_cam_device, cdev);
-	msm_queue_drain(&pmsm->sync->frame_q, list_frame);
-	return msm_open_common(inode, filep, 1, 0);
-}
-
-static int msm_open(struct inode *inode, struct file *filep)
-{
-	return msm_open_common(inode, filep, 1, 0);
-}
-
-static int msm_open_control(struct inode *inode, struct file *filep)
-{
-	int rc;
-
-	struct msm_control_device *ctrl_pmsm =
-		kmalloc(sizeof(struct msm_control_device), GFP_KERNEL);
-	if (!ctrl_pmsm)
-		return -ENOMEM;
-
-	rc = msm_open_common(inode, filep, 0, 1);
-	if (rc < 0) {
-		kfree(ctrl_pmsm);
-		return rc;
-	}
-	ctrl_pmsm->pmsm = filep->private_data;
-	filep->private_data = ctrl_pmsm;
-
-	msm_queue_init(&ctrl_pmsm->ctrl_q, "control");
-
-	if (!g_v4l2_opencnt)
-		g_v4l2_control_device = ctrl_pmsm;
-	g_v4l2_opencnt++;
-	CDBG("%s: rc %d\n", __func__, rc);
-	return rc;
-}
-
-static const struct file_operations msm_fops_config = {
-	.owner = THIS_MODULE,
-	.open = msm_open,
-	.unlocked_ioctl = msm_ioctl_config,
-	.release = msm_release_config,
-	.poll = msm_poll_config,
-};
-
-static const struct file_operations msm_fops_control = {
-	.owner = THIS_MODULE,
-	.open = msm_open_control,
-	.unlocked_ioctl = msm_ioctl_control,
-	.release = msm_release_control,
-};
-
-static const struct file_operations msm_fops_frame = {
-	.owner = THIS_MODULE,
-	.open = msm_open_frame,
-	.unlocked_ioctl = msm_ioctl_frame,
-	.release = msm_release_frame,
-	.poll = msm_poll_frame,
-};
-
-static const struct file_operations msm_fops_pic = {
-	.owner = THIS_MODULE,
-	.open = msm_open,
-	.unlocked_ioctl = msm_ioctl_pic,
-	.release = msm_release_pic,
-	.poll = msm_poll_pic,
-};
-
-static int msm_setup_cdev(struct msm_cam_device *msm,
-			int node,
-			dev_t devno,
-			const char *suffix,
-			const struct file_operations *fops)
-{
-	int rc = -ENODEV;
-
-	struct device *device =
-		device_create(msm_class, NULL,
-			devno, NULL,
-			"%s%d", suffix, node);
-
-	if (IS_ERR(device)) {
-		rc = PTR_ERR(device);
-		pr_err("%s: error creating device: %d\n", __func__, rc);
-		return rc;
-	}
-
-	cdev_init(&msm->cdev, fops);
-	msm->cdev.owner = THIS_MODULE;
-
-	rc = cdev_add(&msm->cdev, devno, 1);
-	if (rc < 0) {
-		pr_err("%s: error adding cdev: %d\n", __func__, rc);
-		device_destroy(msm_class, devno);
-		return rc;
-	}
-
-	return rc;
-}
-
-static int msm_tear_down_cdev(struct msm_cam_device *msm, dev_t devno)
-{
-	cdev_del(&msm->cdev);
-	device_destroy(msm_class, devno);
-	return 0;
-}
-
-static int msm_sync_init(struct msm_sync *sync,
-		struct platform_device *pdev,
-		int (*sensor_probe)(const struct msm_camera_sensor_info *,
-				struct msm_sensor_ctrl *))
-{
-	int rc = 0;
-	struct msm_sensor_ctrl sctrl;
-	sync->sdata = pdev->dev.platform_data;
-
-	msm_queue_init(&sync->event_q, "event");
-	msm_queue_init(&sync->frame_q, "frame");
-	msm_queue_init(&sync->pict_q, "pict");
-	msm_queue_init(&sync->vpe_q, "vpe");
-
-	pm_qos_add_request(&sync->idle_pm_qos, PM_QOS_CPU_DMA_LATENCY,
-					   PM_QOS_DEFAULT_VALUE);
-
-	rc = msm_camio_probe_on(pdev);
-	if (rc < 0) {
-		pm_qos_remove_request(&sync->idle_pm_qos);
-		return rc;
-	}
-	rc = sensor_probe(sync->sdata, &sctrl);
-	if (rc >= 0) {
-		sync->pdev = pdev;
-		sync->sctrl = sctrl;
-	}
-	msm_camio_probe_off(pdev);
-	if (rc < 0) {
-		pr_err("%s: failed to initialize %s\n",
-			__func__,
-			sync->sdata->sensor_name);
-		pm_qos_remove_request(&sync->idle_pm_qos);
-		return rc;
-	}
-
-	sync->opencnt = 0;
-	sync->core_powered_on = 0;
-	sync->ignore_qcmd = false;
-	sync->ignore_qcmd_type = -1;
-	mutex_init(&sync->lock);
-	if (sync->sdata->strobe_flash_data) {
-		sync->sdata->strobe_flash_data->state = 0;
-		spin_lock_init(&sync->sdata->strobe_flash_data->spin_lock);
-	}
-	CDBG("%s: initialized %s\n", __func__, sync->sdata->sensor_name);
-	return rc;
-}
-
-static int msm_sync_destroy(struct msm_sync *sync)
-{
-	pm_qos_remove_request(&sync->idle_pm_qos);
-	return 0;
-}
-
-static int msm_device_init(struct msm_cam_device *pmsm,
-		struct msm_sync *sync,
-		int node)
-{
-	int dev_num = 4 * node;
-	int rc = msm_setup_cdev(pmsm, node,
-		MKDEV(MAJOR(msm_devno), dev_num),
-		"control", &msm_fops_control);
-	if (rc < 0) {
-		pr_err("%s: error creating control node: %d\n", __func__, rc);
-		return rc;
-	}
-
-	rc = msm_setup_cdev(pmsm + 1, node,
-		MKDEV(MAJOR(msm_devno), dev_num + 1),
-		"config", &msm_fops_config);
-	if (rc < 0) {
-		pr_err("%s: error creating config node: %d\n", __func__, rc);
-		msm_tear_down_cdev(pmsm, MKDEV(MAJOR(msm_devno),
-				dev_num));
-		return rc;
-	}
-
-	rc = msm_setup_cdev(pmsm + 2, node,
-		MKDEV(MAJOR(msm_devno), dev_num + 2),
-		"frame", &msm_fops_frame);
-	if (rc < 0) {
-		pr_err("%s: error creating frame node: %d\n", __func__, rc);
-		msm_tear_down_cdev(pmsm,
-			MKDEV(MAJOR(msm_devno), dev_num));
-		msm_tear_down_cdev(pmsm + 1,
-			MKDEV(MAJOR(msm_devno), dev_num + 1));
-		return rc;
-	}
-
-	rc = msm_setup_cdev(pmsm + 3, node,
-		MKDEV(MAJOR(msm_devno), dev_num + 3),
-		"pic", &msm_fops_pic);
-	if (rc < 0) {
-		pr_err("%s: error creating pic node: %d\n", __func__, rc);
-		msm_tear_down_cdev(pmsm,
-			MKDEV(MAJOR(msm_devno), dev_num));
-		msm_tear_down_cdev(pmsm + 1,
-			MKDEV(MAJOR(msm_devno), dev_num + 1));
-		msm_tear_down_cdev(pmsm + 2,
-			MKDEV(MAJOR(msm_devno), dev_num + 2));
-		return rc;
-	}
-
-
-	atomic_set(&pmsm[0].opened, 0);
-	atomic_set(&pmsm[1].opened, 0);
-	atomic_set(&pmsm[2].opened, 0);
-	atomic_set(&pmsm[3].opened, 0);
-
-	pmsm[0].sync = sync;
-	pmsm[1].sync = sync;
-	pmsm[2].sync = sync;
-	pmsm[3].sync = sync;
-
-	return rc;
-}
-
-int msm_camera_drv_start(struct platform_device *dev,
-		int (*sensor_probe)(const struct msm_camera_sensor_info *,
-			struct msm_sensor_ctrl *))
-{
-	struct msm_cam_device *pmsm = NULL;
-	struct msm_sync *sync;
-	int rc = -ENODEV;
-
-	if (camera_node >= MSM_MAX_CAMERA_SENSORS) {
-		pr_err("%s: too many camera sensors\n", __func__);
-		return rc;
-	}
-
-	if (!msm_class) {
-		/* There are three device nodes per sensor */
-		rc = alloc_chrdev_region(&msm_devno, 0,
-				4 * MSM_MAX_CAMERA_SENSORS,
-				"msm_camera");
-		if (rc < 0) {
-			pr_err("%s: failed to allocate chrdev: %d\n", __func__,
-				rc);
-			return rc;
-		}
-
-		msm_class = class_create(THIS_MODULE, "msm_camera");
-		if (IS_ERR(msm_class)) {
-			rc = PTR_ERR(msm_class);
-			pr_err("%s: create device class failed: %d\n",
-				__func__, rc);
-			return rc;
-		}
-	}
-
-	pmsm = kzalloc(sizeof(struct msm_cam_device) * 4 +
-			sizeof(struct msm_sync), GFP_ATOMIC);
-	if (!pmsm)
-		return -ENOMEM;
-	sync = (struct msm_sync *)(pmsm + 4);
-
-	rc = msm_sync_init(sync, dev, sensor_probe);
-	if (rc < 0) {
-		kfree(pmsm);
-		return rc;
-	}
-
-	CDBG("%s: setting camera node %d\n", __func__, camera_node);
-	rc = msm_device_init(pmsm, sync, camera_node);
-	if (rc < 0) {
-		msm_sync_destroy(sync);
-		kfree(pmsm);
-		return rc;
-	}
-
-	camera_type[camera_node] = sync->sctrl.s_camera_type;
-	sensor_mount_angle[camera_node] = sync->sctrl.s_mount_angle;
-	camera_node++;
-
-	list_add(&sync->list, &msm_sensors);
-	return rc;
-}
-EXPORT_SYMBOL(msm_camera_drv_start);
diff --git a/drivers/media/video/msm/msm_camirq_router.c b/drivers/media/video/msm/msm_camirq_router.c
deleted file mode 100644
index 37dd6c2..0000000
--- a/drivers/media/video/msm/msm_camirq_router.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/of.h>
-#include <mach/irqs.h>
-#include <media/msm_isp.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-subdev.h>
-#include "msm.h"
-#include "server/msm_cam_server.h"
-#include "msm_camirq_router.h"
-
-#ifdef CONFIG_MSM_CAMERA_DEBUG
-#define D(fmt, args...) pr_debug("msm: " fmt, ##args)
-#else
-#define D(fmt, args...) do {} while (0)
-#endif
-
-static void msm_irqrouter_update_irqmap_entry(
-	struct msm_cam_server_irqmap_entry *entry,
-	int is_composite, int irq_idx, int cam_hw_idx)
-{
-	int rc = 0;
-	entry->irq_idx = irq_idx;
-	entry->is_composite = is_composite;
-	entry->cam_hw_idx = cam_hw_idx;
-	rc = msm_cam_server_update_irqmap(entry);
-	if (rc < 0)
-		pr_err("%s Error updating irq %d information ",
-			__func__, irq_idx);
-}
-
-static void msm_irqrouter_send_default_irqmap(
-	struct irqrouter_ctrl_type *irqrouter_ctrl)
-{
-	struct msm_cam_server_irqmap_entry *irqmap =
-		&irqrouter_ctrl->def_hw_irqmap[0];
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_0],
-		0, CAMERA_SS_IRQ_0, MSM_CAM_HW_MICRO);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_1],
-		0, CAMERA_SS_IRQ_1, MSM_CAM_HW_CCI);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_2],
-		0, CAMERA_SS_IRQ_2, MSM_CAM_HW_CSI0);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_3],
-		0, CAMERA_SS_IRQ_3, MSM_CAM_HW_CSI1);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_4],
-		0, CAMERA_SS_IRQ_4, MSM_CAM_HW_CSI2);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_5],
-		0, CAMERA_SS_IRQ_5, MSM_CAM_HW_CSI3);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_6],
-		0, CAMERA_SS_IRQ_6, MSM_CAM_HW_ISPIF);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_7],
-		0, CAMERA_SS_IRQ_7, MSM_CAM_HW_CPP);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_8],
-		0, CAMERA_SS_IRQ_8, MSM_CAM_HW_VFE0);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_9],
-		0, CAMERA_SS_IRQ_9, MSM_CAM_HW_VFE1);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_10],
-		0, CAMERA_SS_IRQ_10, MSM_CAM_HW_JPEG0);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_11],
-		0, CAMERA_SS_IRQ_11, MSM_CAM_HW_JPEG1);
-
-	msm_irqrouter_update_irqmap_entry(&irqmap[CAMERA_SS_IRQ_12],
-		0, CAMERA_SS_IRQ_12, MSM_CAM_HW_JPEG2);
-}
-
-static int msm_irqrouter_open(struct v4l2_subdev *sd,
-	struct v4l2_subdev_fh *fh)
-{
-	struct irqrouter_ctrl_type *irqrouter_ctrl = v4l2_get_subdevdata(sd);
-	/* Only one object of IRQ Router allowed. */
-	if (atomic_read(&irqrouter_ctrl->active) != 0) {
-		pr_err("%s IRQ router is already opened\n", __func__);
-		return -EINVAL;
-	}
-
-	D("%s E ", __func__);
-	atomic_inc(&irqrouter_ctrl->active);
-
-	return 0;
-}
-
-static int msm_irqrouter_close(struct v4l2_subdev *sd,
-	struct v4l2_subdev_fh *fh)
-{
-	struct irqrouter_ctrl_type *irqrouter_ctrl = v4l2_get_subdevdata(sd);
-	if (atomic_read(&irqrouter_ctrl->active) == 0) {
-		pr_err("%s IRQ router is already closed\n", __func__);
-		return -EINVAL;
-	}
-	D("%s E ", __func__);
-	atomic_dec(&irqrouter_ctrl->active);
-	return 0;
-}
-
-static const struct v4l2_subdev_internal_ops msm_irqrouter_internal_ops = {
-	.open = msm_irqrouter_open,
-	.close = msm_irqrouter_close,
-};
-
-long msm_irqrouter_subdev_ioctl(struct v4l2_subdev *sd,
-	unsigned int cmd, void *arg)
-{
-	struct irqrouter_ctrl_type *irqrouter_ctrl = v4l2_get_subdevdata(sd);
-	struct msm_camera_irq_cfg *irq_cfg;
-	struct intr_table_entry irq_req;
-	int rc = 0;
-
-	/* Handle all IRQ Router Subdev IOCTLs here.
-	 * Userspace sends the composite irq configuration.
-	 * IRQ Router subdev then configures the registers to group
-	 * together individual core hw irqs into a composite IRQ
-	 * to the MSM IRQ controller. It also registers them with
-	 * the irq manager in the camera server. */
-	switch (cmd) {
-	case MSM_IRQROUTER_CFG_COMPIRQ:
-		COPY_FROM_USER(rc, &irq_cfg, (void __user *)arg,
-			sizeof(struct msm_camera_irq_cfg));
-		if (rc) {
-			ERR_COPY_FROM_USER();
-			break;
-		}
-
-		if (!irq_cfg ||
-			(irq_cfg->irq_idx < CAMERA_SS_IRQ_0) ||
-			(irq_cfg->irq_idx >= CAMERA_SS_IRQ_MAX)) {
-			pr_err("%s Invalid input", __func__);
-			return -EINVAL;
-		} else {
-			irq_req.cam_hw_mask      = irq_cfg->cam_hw_mask;
-			irq_req.irq_idx          = irq_cfg->irq_idx;
-			irq_req.irq_num          =
-			irqrouter_ctrl->def_hw_irqmap[irq_cfg->irq_idx].irq_num;
-			irq_req.is_composite     = 1;
-			irq_req.irq_trigger_type = IRQF_TRIGGER_RISING;
-			irq_req.num_hwcore       = irq_cfg->num_hwcore;
-			irq_req.data             = NULL;
-			rc = msm_cam_server_request_irq(&irq_req);
-			if (rc < 0) {
-				pr_err("%s Error requesting comp irq %d ",
-					__func__, irq_req.irq_idx);
-				return rc;
-			}
-			irqrouter_ctrl->def_hw_irqmap
-				[irq_cfg->irq_idx].is_composite = 1;
-		}
-		break;
-	default:
-		pr_err("%s Invalid cmd %d ", __func__, cmd);
-		break;
-	}
-
-	return rc;
-}
-
-static const struct v4l2_subdev_core_ops msm_irqrouter_subdev_core_ops = {
-	.ioctl = msm_irqrouter_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_ops msm_irqrouter_subdev_ops = {
-	.core = &msm_irqrouter_subdev_core_ops,
-};
-
-static int __devinit irqrouter_probe(struct platform_device *pdev)
-{
-	int rc = 0;
-	struct irqrouter_ctrl_type *irqrouter_ctrl;
-	struct msm_cam_subdev_info sd_info;
-
-	D("%s: device id = %d\n", __func__, pdev->id);
-
-	irqrouter_ctrl = kzalloc(sizeof(struct irqrouter_ctrl_type),
-				GFP_KERNEL);
-	if (!irqrouter_ctrl) {
-		pr_err("%s: not enough memory\n", __func__);
-		return -ENOMEM;
-	}
-
-	v4l2_subdev_init(&irqrouter_ctrl->subdev, &msm_irqrouter_subdev_ops);
-	irqrouter_ctrl->subdev.internal_ops = &msm_irqrouter_internal_ops;
-	irqrouter_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(irqrouter_ctrl->subdev.name,
-			 sizeof(irqrouter_ctrl->subdev.name), "msm_irqrouter");
-	v4l2_set_subdevdata(&irqrouter_ctrl->subdev, irqrouter_ctrl);
-	irqrouter_ctrl->pdev = pdev;
-
-	if (pdev->dev.of_node)
-		of_property_read_u32((&pdev->dev)->of_node,
-			"cell-index", &pdev->id);
-
-	msm_irqrouter_send_default_irqmap(irqrouter_ctrl);
-
-	media_entity_init(&irqrouter_ctrl->subdev.entity, 0, NULL, 0);
-	irqrouter_ctrl->subdev.entity.type = MEDIA_ENT_T_DEVNODE_V4L;
-	irqrouter_ctrl->subdev.entity.group_id = IRQ_ROUTER_DEV;
-	irqrouter_ctrl->subdev.entity.name = pdev->name;
-
-	sd_info.sdev_type = IRQ_ROUTER_DEV;
-	sd_info.sd_index = 0;
-	sd_info.irq_num = 0;
-	/* Now register this subdev with the camera server. */
-	rc = msm_cam_register_subdev_node(&irqrouter_ctrl->subdev, &sd_info);
-	if (rc < 0) {
-		pr_err("%s Error registering irqr subdev %d", __func__, rc);
-		goto error;
-	}
-	irqrouter_ctrl->subdev.entity.revision =
-		irqrouter_ctrl->subdev.devnode->num;
-	atomic_set(&irqrouter_ctrl->active, 0);
-
-	platform_set_drvdata(pdev, &irqrouter_ctrl->subdev);
-
-	return rc;
-error:
-	kfree(irqrouter_ctrl);
-	return rc;
-}
-
-static int __exit irqrouter_exit(struct platform_device *pdev)
-{
-	struct v4l2_subdev *subdev = dev_get_drvdata(&pdev->dev);
-	struct irqrouter_ctrl_type *irqrouter_ctrl =
-		v4l2_get_subdevdata(subdev);
-	kfree(irqrouter_ctrl);
-	return 0;
-}
-
-static const struct of_device_id msm_irqrouter_dt_match[] = {
-	{.compatible = "qcom,irqrouter"},
-	{}
-};
-
-MODULE_DEVICE_TABLE(of, msm_irqrouter_dt_match);
-
-static struct platform_driver msm_irqrouter_driver = {
-	.probe = irqrouter_probe,
-	.remove = irqrouter_exit,
-	.driver = {
-		.name = MSM_IRQ_ROUTER_DRV_NAME,
-		.owner = THIS_MODULE,
-		.of_match_table = msm_irqrouter_dt_match,
-	},
-};
-
-static int __init msm_irqrouter_init_module(void)
-{
-	return platform_driver_register(&msm_irqrouter_driver);
-}
-
-static void __exit msm_irqrouter_exit_module(void)
-{
-	platform_driver_unregister(&msm_irqrouter_driver);
-}
-
-module_init(msm_irqrouter_init_module);
-module_exit(msm_irqrouter_exit_module);
-MODULE_DESCRIPTION("msm camera irq router");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/msm_camirq_router.h b/drivers/media/video/msm/msm_camirq_router.h
deleted file mode 100644
index 3ea3cec..0000000
--- a/drivers/media/video/msm/msm_camirq_router.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MSM_CAM_IRQROUTER_H__
-#define __MSM_CAM_IRQROUTER_H__
-
-#include <linux/bitops.h>
-
-/* Camera SS common registers defines - Start */
-/* These registers are not directly related to
- * IRQ Router, but are common to the Camera SS.
- * IRQ Router registers dont have a unique base address
- * in the memory mapped address space. It is offset from
- * the Camera SS base address. So keep the common Camera
- * SS registers also in the IRQ Router subdev for now. */
-
-/* READ ONLY: Camera Subsystem HW version */
-#define CAMSS_HW_VERSION			0x00000000
-
-/* Bits 4:0 of this register can be used to select a desired
- * camera core test bus to drive the Camera_SS test bus output */
-#define CAMSS_TESTBUS_SEL			0x00000004
-
-/* Bits 4:0 of this register is used to allow either Microcontroller
- * or the CCI drive the corresponding GPIO output.
- * For eg: Setting bit 0 of this register allows Microcontroller to
- * drive GPIO #0. Clearing the bit allows CCI to drive GPIO #0. */
-#define CAMSS_GPIO_MUX_SEL			0x00000008
-
-/* Bit 0 of this register is used to set the default AHB master
- * for the AHB Arbiter. 0 - AHB Master 0, 1 - AHB Master 1*/
-#define CAMSS_AHB_ARB_CTL			0x0000000C
-
-/* READ ONLY */
-#define CAMSS_XPU2_STATUS			0x00000010
-
-/* Select the appropriate CSI clock for CSID Pixel pipes */
-#define CAMSS_CSI_PIX_CLK_MUX_SEL		0x00000020
-#define CAMSS_CSI_PIX_CLK_CGC_EN		0x00000024
-
-/* Select the appropriate CSI clock for CSID RDI pipes */
-#define CAMSS_CSI_RDI_CLK_MUX_SEL		0x00000028
-#define CAMSS_CSI_RDI_CLK_CGC_EN		0x0000002C
-
-/* Select the appropriate CSI clock for CSI Phy0 */
-#define CAMSS_CSI_PHY_0_CLK_MUX_SEL		0x00000030
-#define CAMSS_CSI_PHY_0_CLK_CGC_EN		0x00000034
-
-/* Select the appropriate CSI clock for CSI Phy1 */
-#define CAMSS_CSI_PHY_1_CLK_MUX_SEL		0x00000038
-#define CAMSS_CSI_PHY_1_CLK_CGC_EN		0x0000003C
-
-/* Select the appropriate CSI clock for CSI Phy2 */
-#define CAMSS_CSI_PHY_2_CLK_MUX_SEL		0x00000040
-#define CAMSS_CSI_PHY_2_CLK_CGC_EN		0x00000044
-/* Camera SS common registers defines - End */
-
-/* IRQ Router registers defines - Start */
-/* This register is used to reset the composite
- * IRQ outputs of the Camera_SS IRQ Router */
-#define CAMSS_IRQ_COMPOSITE_RESET_CTRL		0x00000060
-
-/* By default, this 'allows' the interrupts from
- * Micro to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_0		0x00000064
-
-/* By default, this 'allows' the interrupts from
- * CCI to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_1		0x00000068
-
-/* By default, this 'allows' the interrupts from
- * CSI_0 to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_2		0x0000006C
-
-/* By default, this 'allows' the interrupts from
- * CSI_1 to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_3		0x00000070
-
-/* By default, this 'allows' the interrupts from
- * CSI_2 to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_4		0x00000074
-
-/* By default, this 'allows' the interrupts from
- * CSI_3 to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_5		0x00000078
-
-/* By default, this 'allows' the interrupts from
- * ISPIF to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_6		0x0000007C
-
-/* By default, this 'allows' the interrupts from
- * CPP to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_7		0x00000080
-
-/* By default, this 'allows' the interrupts from
- * VFE_0 to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_8		0x00000084
-
-/* By default, this 'allows' the interrupts from
- * VFE_1 to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_9		0x00000088
-
-/* By default, this 'allows' the interrupts from
- * JPEG_0 to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_10		0x0000008C
-
-/* By default, this 'allows' the interrupts from
- * JPEG_1 to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_11		0x00000090
-
-/* By default, this 'allows' the interrupts from
- * JPEG_2 to pass through, unless configured in
- * composite mode. */
-#define CAMSS_IRQ_COMPOSITE_MASK_12		0x00000094
-
-/* The following IRQ_COMPOSITE_MICRO_MASK registers
- * allow the interrupts from the individual hw
- * cores to be composited into an IRQ for Micro. */
-#define CAMSS_IRQ_COMPOSITE_MICRO_MASK_0	0x000000A4
-#define CAMSS_IRQ_COMPOSITE_MICRO_MASK_1	0x000000A8
-#define CAMSS_IRQ_COMPOSITE_MICRO_MASK_2	0x000000AC
-#define CAMSS_IRQ_COMPOSITE_MICRO_MASK_3	0x000000B0
-#define CAMSS_IRQ_COMPOSITE_MICRO_MASK_4	0x000000B4
-#define CAMSS_IRQ_COMPOSITE_MICRO_MASK_5	0x000000B8
-/* IRQ Router register defines - End */
-
-/* Writing this mask will reset all the composite
- * IRQs of the Camera_SS IRQ Router */
-#define CAMSS_IRQ_COMPOSITE_RESET_MASK		0x003F1FFF
-
-/* Use this to enable Micro IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_MICRO_IRQ_IN_COMPOSITE		BIT(0)
-/* Use this to enable CCI IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_CCI_IRQ_IN_COMPOSITE		BIT(1)
-/* Use this to enable CSI0 IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_CSI0_IRQ_IN_COMPOSITE		BIT(2)
-/* Use this to enable CSI1 IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_CSI1_IRQ_IN_COMPOSITE		BIT(3)
-/* Use this to enable CSI2 IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_CSI2_IRQ_IN_COMPOSITE		BIT(4)
-/* Use this to enable CSI3 IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_CSI3_IRQ_IN_COMPOSITE		BIT(5)
-/* Use this to enable ISPIF IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_ISPIF_IRQ_IN_COMPOSITE		BIT(6)
-/* Use this to enable CPP IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_CPP_IRQ_IN_COMPOSITE		BIT(7)
-/* Use this to enable VFE0 IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_VFE0_IRQ_IN_COMPOSITE		BIT(8)
-/* Use this to enable VFE1 IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_VFE1_IRQ_IN_COMPOSITE		BIT(9)
-/* Use this to enable JPEG0 IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_JPEG0_IRQ_IN_COMPOSITE		BIT(10)
-/* Use this to enable JPEG1 IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_JPEG1_IRQ_IN_COMPOSITE		BIT(11)
-/* Use this to enable JPEG2 IRQ from IRQ Router
- * composite interrupt */
-#define ENABLE_JPEG2_IRQ_IN_COMPOSITE		BIT(12)
-
-struct irqrouter_ctrl_type {
-	/* v4l2 subdev */
-	struct v4l2_subdev subdev;
-	struct platform_device *pdev;
-
-	void __iomem *irqr_dev_base;
-
-	struct resource	*irqr_dev_mem;
-	struct resource *irqr_dev_io;
-	atomic_t active;
-	struct msm_cam_server_irqmap_entry def_hw_irqmap[CAMERA_SS_IRQ_MAX];
-};
-
-#endif /* __MSM_CAM_IRQROUTER_H__ */
diff --git a/drivers/media/video/msm/msm_gesture.c b/drivers/media/video/msm/msm_gesture.c
index cbccbad..2839e43 100644
--- a/drivers/media/video/msm/msm_gesture.c
+++ b/drivers/media/video/msm/msm_gesture.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -11,12 +11,12 @@
  */
 
 #include <linux/module.h>
+#include <mach/camera.h>
 #include <media/v4l2-subdev.h>
+#include "msm.h"
 #include <media/msm_camera.h>
 #include <media/msm_gestures.h>
 #include <media/v4l2-ctrls.h>
-#include <mach/camera.h>
-#include "msm.h"
 
 #ifdef CONFIG_MSM_CAMERA_DEBUG
 #define D(fmt, args...) pr_debug("msm_gesture: " fmt, ##args)
@@ -43,7 +43,7 @@
 	D("%s\n", __func__);
 	if (sub->type == V4L2_EVENT_ALL)
 		sub->type = MSM_GES_APP_NOTIFY_EVENT;
-	return v4l2_event_subscribe(fh, sub, 30);
+	return v4l2_event_subscribe(fh, sub);
 }
 
 static int msm_gesture_send_ctrl(struct msm_gesture_ctrl *p_gesture_ctrl,
@@ -78,12 +78,6 @@
 	tmp_cmd = (struct msm_ctrl_cmd *)ctrl->value;
 	uptr_cmd = (void __user *)ctrl->value;
 	uptr_value = (void __user *)tmp_cmd->value;
-
-	if(tmp_cmd->length > 0xffff) {
-                pr_err("%s Integer Overflow occurred \n",__func__);
-                rc = -EINVAL;
-                goto end;
-       }
 	value_len = tmp_cmd->length;
 
 	D("%s: cmd type = %d, up1=0x%x, ulen1=%d, up2=0x%x, ulen2=%d\n",
@@ -115,7 +109,7 @@
 	} else
 		tmp_cmd->value = NULL;
 
-	/* send command to config thread in usersspace, and get return value */
+	
 	rc = msm_server_send_ctrl((struct msm_ctrl_cmd *)ctrl_data,
 			MSM_GES_RESP_V4L2);
 	D("%s: msm_server_control rc=%d\n", __func__, rc);
@@ -206,38 +200,39 @@
 	D("%s: Received gesture evt 0x%x ", __func__, evt->type);
 	p_gesture_ctrl->event.evt_len = 0;
 	p_gesture_ctrl->event.evt_data = NULL;
+	if (0 != evt->u.data[0]) {
+		p_ges_evt = (struct msm_ges_evt *)evt->u.data;
+		D("%s: event data %p len %d", __func__,
+			p_ges_evt->evt_data,
+			p_ges_evt->evt_len);
 
-	p_ges_evt = (struct msm_ges_evt *)evt->u.data;
-	D("%s: event data %p len %d", __func__,
-		p_ges_evt->evt_data,
-		p_ges_evt->evt_len);
+		if (p_ges_evt->evt_len > 0) {
+			p_gesture_ctrl->event.evt_data =
+				kzalloc(p_ges_evt->evt_len, GFP_KERNEL);
 
-	if (p_ges_evt->evt_len > 0) {
-		p_gesture_ctrl->event.evt_data =
-			kzalloc(p_ges_evt->evt_len, GFP_KERNEL);
-
-		if (NULL == p_gesture_ctrl->event.evt_data) {
-			pr_err("%s: cannot allocate event", __func__);
-			rc = -ENOMEM;
-		} else {
-			if (copy_from_user(
-				(void *)p_gesture_ctrl->event.evt_data,
-				(void __user *)p_ges_evt->evt_data,
-				p_ges_evt->evt_len)) {
-				pr_err("%s: copy_from_user failed",
-					__func__);
-				rc = -EFAULT;
+			if (NULL == p_gesture_ctrl->event.evt_data) {
+				pr_err("%s: cannot allocate event", __func__);
+				rc = -ENOMEM;
 			} else {
-				D("%s: copied the event", __func__);
-				p_gesture_ctrl->event.evt_len =
-					p_ges_evt->evt_len;
+				if (copy_from_user(
+					(void *)p_gesture_ctrl->event.evt_data,
+					(void __user *)p_ges_evt->evt_data,
+					p_ges_evt->evt_len)) {
+					pr_err("%s: copy_from_user failed",
+							__func__);
+					rc = -EFAULT;
+				} else {
+					D("%s: copied the event", __func__);
+					p_gesture_ctrl->event.evt_len =
+						p_ges_evt->evt_len;
+				}
 			}
 		}
 	}
 
 	if (rc == 0) {
 		ktime_get_ts(&evt->timestamp);
-		v4l2_event_queue(sd->devnode, evt);
+		v4l2_event_queue(&sd->devnode, evt);
 	}
 	D("%s: exit rc %d ", __func__, rc);
 	return rc;
@@ -461,8 +456,6 @@
 	struct msm_gesture_ctrl *p_gesture_ctrl = &g_gesture_ctrl;
 	struct v4l2_subdev *gesture_subdev =
 		kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);
-	struct msm_cam_subdev_info sd_info;
-
 	D("%s\n", __func__);
 	if (!gesture_subdev) {
 		pr_err("%s: no enough memory\n", __func__);
@@ -475,21 +468,22 @@
 	snprintf(gesture_subdev->name,
 			 sizeof(gesture_subdev->name), "gesture");
 
+#if defined(CONFIG_MEDIA_CONTROLLER)
+
 	media_entity_init(&gesture_subdev->entity, 0, NULL, 0);
 	gesture_subdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;
 	gesture_subdev->entity.group_id = GESTURE_DEV;
 	gesture_subdev->entity.name = gesture_subdev->name;
-
-	/* events */
+#endif
+	
 	gesture_subdev->flags |= V4L2_SUBDEV_FL_HAS_EVENTS;
+	gesture_subdev->nevents = MAX_GES_EVENTS;
 
-	sd_info.sdev_type = GESTURE_DEV;
-	sd_info.sd_index = 0;
-	sd_info.irq_num = 0;
-	msm_cam_register_subdev_node(gesture_subdev, &sd_info);
+	msm_cam_register_subdev_node(gesture_subdev, GESTURE_DEV, 0);
+#if defined(CONFIG_MEDIA_CONTROLLER)
 
-	gesture_subdev->entity.revision = gesture_subdev->devnode->num;
-
+	gesture_subdev->entity.revision = gesture_subdev->devnode.num;
+#endif
 	atomic_set(&p_gesture_ctrl->active, 0);
 	p_gesture_ctrl->queue_id = -1;
 	p_gesture_ctrl->event.evt_data = NULL;
@@ -505,3 +499,4 @@
 module_init(msm_gesture_init_module);
 MODULE_DESCRIPTION("MSM Gesture driver");
 MODULE_LICENSE("GPL v2");
+
diff --git a/drivers/media/video/msm/msm_io_8960.c b/drivers/media/video/msm/msm_io_8960.c
new file mode 100644
index 0000000..030c8c0
--- /dev/null
+++ b/drivers/media/video/msm/msm_io_8960.c
@@ -0,0 +1,706 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/delay.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/regulator/consumer.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+#include <mach/gpio.h>
+#include <mach/gpiomux.h>
+#include <mach/board.h>
+#include <mach/camera.h>
+#include <mach/vreg.h>
+#include <mach/camera.h>
+#include <mach/clk.h>
+#include <mach/msm_bus.h>
+#include <mach/msm_bus_board.h>
+
+#include <msm_sensor.h>
+
+#define BUFF_SIZE_128 128
+
+#if 1	
+#define CAM_VAF_MINUV                 2800000
+#define CAM_VAF_MAXUV                 2800000
+#define CAM_VDIG_MINUV                    1200000
+#define CAM_VDIG_MAXUV                    1200000
+#define CAM_VANA_MINUV                    2800000
+#define CAM_VANA_MAXUV                    2850000
+#define CAM_CSI_VDD_MINUV                  1200000
+#define CAM_CSI_VDD_MAXUV                  1200000
+
+#define CAM_VAF_LOAD_UA               300000
+#define CAM_VDIG_LOAD_UA                  105000
+#define CAM_VANA_LOAD_UA                  85600
+#define CAM_CSI_LOAD_UA                    20000
+
+static struct clk *camio_cam_clk;
+static struct clk *camio_cam_rawchip_clk;
+
+#endif	
+static struct clk *camio_jpeg_clk;
+static struct clk *camio_jpeg_pclk;
+static struct clk *camio_imem_clk;
+static struct regulator *fs_ijpeg;
+#if 1	
+static struct msm_camera_io_clk camio_clk;
+static struct msm_sensor_ctrl_t *camio_sctrl;
+struct msm_bus_scale_pdata *cam_bus_scale_table;
+#endif	
+
+void msm_io_w(u32 data, void __iomem *addr)
+{
+	CDBG("%s: %08x %08x\n", __func__, (int) (addr), (data));
+	writel_relaxed((data), (addr));
+}
+
+void msm_io_w_mb(u32 data, void __iomem *addr)
+{
+	CDBG("%s: %08x %08x\n", __func__, (int) (addr), (data));
+	wmb();
+	writel_relaxed((data), (addr));
+	wmb();
+}
+
+u32 msm_io_r(void __iomem *addr)
+{
+	uint32_t data = readl_relaxed(addr);
+	CDBG("%s: %08x %08x\n", __func__, (int) (addr), (data));
+	return data;
+}
+
+u32 msm_io_r_mb(void __iomem *addr)
+{
+	uint32_t data;
+	rmb();
+	data = readl_relaxed(addr);
+	rmb();
+	CDBG("%s: %08x %08x\n", __func__, (int) (addr), (data));
+	return data;
+}
+
+void msm_io_memcpy_toio(void __iomem *dest_addr,
+	void __iomem *src_addr, u32 len)
+{
+	int i;
+	u32 *d = (u32 *) dest_addr;
+	u32 *s = (u32 *) src_addr;
+	
+	for (i = 0; i < len; i++)
+		writel_relaxed(*s++, d++);
+}
+
+void msm_io_dump(void __iomem *addr, int size)
+{
+	char line_str[BUFF_SIZE_128], *p_str;
+	int i;
+	u32 *p = (u32 *) addr;
+	u32 data;
+	CDBG("%s: %p %d\n", __func__, addr, size);
+	line_str[0] = '\0';
+	p_str = line_str;
+	for (i = 0; i < size/4; i++) {
+		if (i % 4 == 0) {
+			snprintf(p_str, 12, "%08x: ", (u32) p);
+			p_str += 10;
+		}
+		data = readl_relaxed(p++);
+		snprintf(p_str, 12, "%08x ", data);
+		p_str += 9;
+		if ((i + 1) % 4 == 0) {
+			CDBG("%s\n", line_str);
+			line_str[0] = '\0';
+			p_str = line_str;
+		}
+	}
+	if (line_str[0] != '\0')
+		CDBG("%s\n", line_str);
+}
+
+void msm_io_memcpy(void __iomem *dest_addr, void __iomem *src_addr, u32 len)
+{
+	CDBG("%s: %p %p %d\n", __func__, dest_addr, src_addr, len);
+	if (dest_addr && src_addr) {
+		msm_io_memcpy_toio(dest_addr, src_addr, len / 4);
+		msm_io_dump(dest_addr, len);
+	} else
+		pr_err("%s: invalid address %p %p", __func__, dest_addr, src_addr);
+}
+
+#if 1	
+static int msm_camera_vreg_enable(struct msm_camera_sensor_info *s_info)
+{
+#if 0 
+	if (mipi_csi_vdd == NULL) {
+		mipi_csi_vdd = regulator_get(&pdev->dev, "mipi_csi_vdd");
+		if (IS_ERR(mipi_csi_vdd)) {
+			CDBG("%s: VREG MIPI CSI VDD get failed\n", __func__);
+			mipi_csi_vdd = NULL;
+			return -ENODEV;
+		}
+		if (regulator_set_voltage(mipi_csi_vdd, CAM_CSI_VDD_MINUV,
+			CAM_CSI_VDD_MAXUV)) {
+			CDBG("%s: VREG MIPI CSI VDD set voltage failed\n",
+				__func__);
+			goto mipi_csi_vdd_put;
+		}
+		if (regulator_set_optimum_mode(mipi_csi_vdd,
+			CAM_CSI_LOAD_UA) < 0) {
+			CDBG("%s: VREG MIPI CSI set optimum mode failed\n",
+				__func__);
+			goto mipi_csi_vdd_release;
+		}
+		if (regulator_enable(mipi_csi_vdd)) {
+			CDBG("%s: VREG MIPI CSI VDD enable failed\n",
+				__func__);
+			goto mipi_csi_vdd_disable;
+		}
+	}
+	if (cam_vana == NULL) {
+		cam_vana = regulator_get(&pdev->dev, "cam_vana");
+		if (IS_ERR(cam_vana)) {
+			CDBG("%s: VREG CAM VANA get failed\n", __func__);
+			cam_vana = NULL;
+			goto mipi_csi_vdd_disable;
+		}
+		if (regulator_set_voltage(cam_vana, CAM_VANA_MINUV,
+			CAM_VANA_MAXUV)) {
+			CDBG("%s: VREG CAM VANA set voltage failed\n",
+				__func__);
+			goto cam_vana_put;
+		}
+		if (regulator_set_optimum_mode(cam_vana,
+			CAM_VANA_LOAD_UA) < 0) {
+			CDBG("%s: VREG CAM VANA set optimum mode failed\n",
+				__func__);
+			goto cam_vana_release;
+		}
+		if (regulator_enable(cam_vana)) {
+			CDBG("%s: VREG CAM VANA enable failed\n", __func__);
+			goto cam_vana_disable;
+		}
+	}
+	if (cam_vio == NULL) {
+		cam_vio = regulator_get(&pdev->dev, "cam_vio");
+		if (IS_ERR(cam_vio)) {
+			CDBG("%s: VREG VIO get failed\n", __func__);
+			cam_vio = NULL;
+			goto cam_vana_disable;
+		}
+		if (regulator_enable(cam_vio)) {
+			CDBG("%s: VREG VIO enable failed\n", __func__);
+			goto cam_vio_put;
+		}
+	}
+	if (cam_vdig == NULL) {
+		cam_vdig = regulator_get(&pdev->dev, "cam_vdig");
+		if (IS_ERR(cam_vdig)) {
+			CDBG("%s: VREG CAM VDIG get failed\n", __func__);
+			cam_vdig = NULL;
+			goto cam_vio_disable;
+		}
+		if (regulator_set_voltage(cam_vdig, CAM_VDIG_MINUV,
+			CAM_VDIG_MAXUV)) {
+			CDBG("%s: VREG CAM VDIG set voltage failed\n",
+				__func__);
+			goto cam_vdig_put;
+		}
+		if (regulator_set_optimum_mode(cam_vdig,
+			CAM_VDIG_LOAD_UA) < 0) {
+			CDBG("%s: VREG CAM VDIG set optimum mode failed\n",
+				__func__);
+			goto cam_vdig_release;
+		}
+		if (regulator_enable(cam_vdig)) {
+			CDBG("%s: VREG CAM VDIG enable failed\n", __func__);
+			goto cam_vdig_disable;
+		}
+	}
+	if (cam_vaf == NULL) {
+		cam_vaf = regulator_get(&pdev->dev, "cam_vaf");
+		if (IS_ERR(cam_vaf)) {
+			CDBG("%s: VREG CAM VAF get failed\n", __func__);
+			cam_vaf = NULL;
+			goto cam_vdig_disable;
+		}
+		if (regulator_set_voltage(cam_vaf, CAM_VAF_MINUV,
+			CAM_VAF_MAXUV)) {
+			CDBG("%s: VREG CAM VAF set voltage failed\n",
+				__func__);
+			goto cam_vaf_put;
+		}
+		if (regulator_set_optimum_mode(cam_vaf,
+			CAM_VAF_LOAD_UA) < 0) {
+			CDBG("%s: VREG CAM VAF set optimum mode failed\n",
+				__func__);
+			goto cam_vaf_release;
+		}
+		if (regulator_enable(cam_vaf)) {
+			CDBG("%s: VREG CAM VAF enable failed\n", __func__);
+			goto cam_vaf_disable;
+		}
+	}
+#endif 
+	return 0;
+
+#if 0 
+cam_vaf_disable:
+	regulator_set_optimum_mode(cam_vaf, 0);
+cam_vaf_release:
+	regulator_set_voltage(cam_vaf, 0, CAM_VAF_MAXUV);
+	regulator_disable(cam_vaf);
+cam_vaf_put:
+	regulator_put(cam_vaf);
+	cam_vaf = NULL;
+cam_vdig_disable:
+	regulator_set_optimum_mode(cam_vdig, 0);
+cam_vdig_release:
+	regulator_set_voltage(cam_vdig, 0, CAM_VDIG_MAXUV);
+	regulator_disable(cam_vdig);
+cam_vdig_put:
+	regulator_put(cam_vdig);
+	cam_vdig = NULL;
+cam_vio_disable:
+	regulator_disable(cam_vio);
+cam_vio_put:
+	regulator_put(cam_vio);
+	cam_vio = NULL;
+cam_vana_disable:
+	regulator_set_optimum_mode(cam_vana, 0);
+cam_vana_release:
+	regulator_set_voltage(cam_vana, 0, CAM_VANA_MAXUV);
+	regulator_disable(cam_vana);
+cam_vana_put:
+	regulator_put(cam_vana);
+	cam_vana = NULL;
+mipi_csi_vdd_disable:
+	regulator_set_optimum_mode(mipi_csi_vdd, 0);
+mipi_csi_vdd_release:
+	regulator_set_voltage(mipi_csi_vdd, 0, CAM_CSI_VDD_MAXUV);
+	regulator_disable(mipi_csi_vdd);
+
+mipi_csi_vdd_put:
+	regulator_put(mipi_csi_vdd);
+	mipi_csi_vdd = NULL;
+	return -ENODEV;
+#endif 
+}
+
+static void msm_camera_vreg_disable(void)
+{
+#if 0 
+	if (mipi_csi_vdd) {
+		regulator_set_voltage(mipi_csi_vdd, 0, CAM_CSI_VDD_MAXUV);
+		regulator_set_optimum_mode(mipi_csi_vdd, 0);
+		regulator_disable(mipi_csi_vdd);
+		regulator_put(mipi_csi_vdd);
+		mipi_csi_vdd = NULL;
+	}
+
+	if (cam_vana) {
+		regulator_set_voltage(cam_vana, 0, CAM_VANA_MAXUV);
+		regulator_set_optimum_mode(cam_vana, 0);
+		regulator_disable(cam_vana);
+		regulator_put(cam_vana);
+		cam_vana = NULL;
+	}
+
+	if (cam_vio) {
+		regulator_disable(cam_vio);
+		regulator_put(cam_vio);
+		cam_vio = NULL;
+	}
+
+	if (cam_vdig) {
+		regulator_set_voltage(cam_vdig, 0, CAM_VDIG_MAXUV);
+		regulator_set_optimum_mode(cam_vdig, 0);
+		regulator_disable(cam_vdig);
+		regulator_put(cam_vdig);
+		cam_vdig = NULL;
+	}
+
+	if (cam_vaf) {
+		regulator_set_voltage(cam_vaf, 0, CAM_VAF_MAXUV);
+		regulator_set_optimum_mode(cam_vaf, 0);
+		regulator_disable(cam_vaf);
+		regulator_put(cam_vaf);
+		cam_vaf = NULL;
+	}
+#endif 
+}
+
+#endif	
+int msm_camio_clk_enable(enum msm_camio_clk_type clktype)
+{
+	int rc = 0;
+	struct clk *clk = NULL;
+
+	switch (clktype) {
+#if 1	
+	case CAMIO_CAM_MCLK_CLK:
+		camio_cam_clk =
+		clk = clk_get(&(camio_sctrl->sensor_i2c_client->client->dev), "cam_clk");
+		pr_info("%s: clk(%p) obj.name:%s", __func__, clk, camio_sctrl->sensor_i2c_client->client->dev.kobj.name);
+		if (!IS_ERR(clk))
+			msm_camio_clk_rate_set_2(clk, camio_clk.mclk_clk_rate);
+		break;
+#endif	
+	case CAMIO_CAM_RAWCHIP_MCLK_CLK:
+		camio_cam_rawchip_clk =
+		clk = clk_get(NULL, "cam0_clk");
+		pr_info("[CAM] %s: enable CAMIO_CAM_RAWCHIP_MCLK_CLK", __func__);
+		if (!IS_ERR(clk))
+			clk_set_rate(clk, 24000000);
+		break;
+
+	case CAMIO_JPEG_CLK:
+		camio_jpeg_clk =
+		clk = clk_get(NULL, "ijpeg_clk");
+		clk_set_rate(clk, 228571000);
+		break;
+
+	case CAMIO_JPEG_PCLK:
+		camio_jpeg_pclk =
+		clk = clk_get(NULL, "ijpeg_pclk");
+		break;
+
+	case CAMIO_IMEM_CLK:
+		camio_imem_clk =
+		clk = clk_get(NULL, "imem_clk");
+		break;
+
+	default:
+		break;
+	}
+
+	if (!IS_ERR(clk))
+		rc = clk_prepare_enable(clk);
+	else
+		rc = PTR_ERR(clk);
+
+	if (rc < 0)
+		pr_err("%s(%d) failed %d\n", __func__, clktype, rc);
+
+	return rc;
+}
+
+int msm_camio_clk_disable(enum msm_camio_clk_type clktype)
+{
+	int rc = 0;
+	struct clk *clk = NULL;
+
+	switch (clktype) {
+#if 1	
+	case CAMIO_CAM_MCLK_CLK:
+		clk = camio_cam_clk;
+		break;
+#endif	
+	case CAMIO_CAM_RAWCHIP_MCLK_CLK:
+		clk = camio_cam_rawchip_clk;
+		break;
+
+	case CAMIO_JPEG_CLK:
+		clk = camio_jpeg_clk;
+		break;
+
+	case CAMIO_JPEG_PCLK:
+		clk = camio_jpeg_pclk;
+		break;
+
+	case CAMIO_IMEM_CLK:
+		clk = camio_imem_clk;
+		break;
+
+	default:
+		break;
+	}
+
+	if (!IS_ERR(clk)) {
+		clk_disable_unprepare(clk);
+		clk_put(clk);
+	} else
+		rc = PTR_ERR(clk);
+
+	if (rc < 0)
+		pr_err("%s(%d) failed %d\n", __func__, clktype, rc);
+
+	return rc;
+}
+
+#if 1	
+void msm_camio_clk_rate_set(int rate)
+{
+	struct clk *clk = camio_cam_clk;
+	clk_set_rate(clk, rate);
+}
+#endif	
+
+void msm_camio_clk_rate_set_2(struct clk *clk, int rate)
+{
+	clk_set_rate(clk, rate);
+}
+
+int msm_camio_jpeg_clk_disable(void)
+{
+	int rc = 0;
+	rc = msm_camio_clk_disable(CAMIO_JPEG_PCLK);
+	if (rc < 0)
+		return rc;
+	rc = msm_camio_clk_disable(CAMIO_JPEG_CLK);
+	if (rc < 0)
+		return rc;
+	rc = msm_camio_clk_disable(CAMIO_IMEM_CLK);
+	if (rc < 0)
+		return rc;
+
+	if (fs_ijpeg) {
+		rc = regulator_disable(fs_ijpeg);
+		if (rc < 0) {
+			pr_err("%s: Regulator disable failed %d\n",
+						__func__, rc);
+			return rc;
+		}
+		regulator_put(fs_ijpeg);
+	}
+	CDBG("%s: exit %d\n", __func__, rc);
+	return rc;
+}
+
+int msm_camio_jpeg_clk_enable(void)
+{
+	int rc = 0;
+	fs_ijpeg = regulator_get(NULL, "fs_ijpeg");
+	if (IS_ERR(fs_ijpeg)) {
+		pr_err("%s: Regulator FS_IJPEG get failed %ld\n",
+			__func__, PTR_ERR(fs_ijpeg));
+		fs_ijpeg = NULL;
+	} else if (regulator_enable(fs_ijpeg)) {
+		pr_err("%s: Regulator FS_IJPEG enable failed\n", __func__);
+		regulator_put(fs_ijpeg);
+	}
+
+	rc = msm_camio_clk_enable(CAMIO_JPEG_CLK);
+	if (rc < 0)
+		return rc;
+	rc = msm_camio_clk_enable(CAMIO_JPEG_PCLK);
+	if (rc < 0)
+		return rc;
+
+	rc = msm_camio_clk_enable(CAMIO_IMEM_CLK);
+	if (rc < 0)
+		return rc;
+
+	CDBG("%s: exit %d\n", __func__, rc);
+	return rc;
+}
+
+#if 1	
+int msm_camio_config_gpio_table(int gpio_en)
+{
+	struct msm_camera_sensor_info *sinfo = camio_sctrl->sensordata;
+	struct msm_camera_gpio_conf *gpio_conf = sinfo->gpio_conf;
+	int rc = 0, i = 0;
+
+#if 1 
+	if (gpio_conf == NULL || gpio_conf->cam_gpio_tbl == NULL) {
+		pr_err("%s: Invalid NULL cam gpio config table\n", __func__);
+		return -EFAULT;
+	}
+
+	if (gpio_en) {
+		msm_gpiomux_install((struct msm_gpiomux_config *)gpio_conf->
+			cam_gpiomux_conf_tbl,
+			gpio_conf->cam_gpiomux_conf_tbl_size);
+		for (i = 0; i < gpio_conf->cam_gpio_tbl_size; i++) {
+			rc = gpio_request(gpio_conf->cam_gpio_tbl[i],
+				 "CAM_GPIO");
+			if (rc < 0) {
+				pr_err("%s not able to get gpio\n", __func__);
+				for (i--; i >= 0; i--)
+					gpio_free(gpio_conf->cam_gpio_tbl[i]);
+					break;
+			}
+		}
+	} else {
+		for (i = 0; i < gpio_conf->cam_gpio_tbl_size; i++)
+			gpio_free(gpio_conf->cam_gpio_tbl[i]);
+	}
+
+	if (gpio_conf->cam_gpiomux_conf_tbl	== NULL) {
+		pr_info("%s: no cam gpio config table\n", __func__);
+		return rc;
+	}
+#else
+	if (gpio_en) {
+		msm_gpiomux_install((struct msm_gpiomux_config *)gpio_conf->
+			cam_gpiomux_conf_tbl,
+			gpio_conf->cam_gpiomux_conf_tbl_size);
+		for (i = 0; i < gpio_conf->cam_gpio_tbl_size; i++) {
+			rc = gpio_request(gpio_conf->cam_gpio_tbl[i],
+				 "CAM_GPIO");
+			if (rc < 0) {
+				pr_err("%s not able to get gpio\n", __func__);
+				for (i--; i >= 0; i--)
+					gpio_free(gpio_conf->cam_gpio_tbl[i]);
+					break;
+			}
+		}
+	} else {
+		for (i = 0; i < gpio_conf->cam_gpio_tbl_size; i++)
+			gpio_free(gpio_conf->cam_gpio_tbl[i]);
+	}
+#endif 
+	return rc;
+}
+
+void msm_camio_vfe_blk_reset(void)
+{
+	return;
+}
+
+int msm_camio_probe_on(void *s_ctrl)
+{
+	int rc = 0;
+	struct msm_sensor_ctrl_t* sctrl = (struct msm_sensor_ctrl_t *)s_ctrl;
+	struct msm_camera_sensor_info *sinfo = sctrl->sensordata;
+	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
+
+	camio_sctrl = sctrl;
+	camio_clk = camdev->ioclk;
+
+	pr_info("%s: sinfo sensor name - %s\n", __func__, sinfo->sensor_name);
+	pr_info("%s: camio_clk m(%d) v(%d)\n", __func__, camio_clk.mclk_clk_rate, camio_clk.vfe_clk_rate);
+
+	rc = msm_camio_config_gpio_table(1);
+	if (rc < 0)
+		return rc;
+
+	msm_camera_vreg_enable(sinfo);
+	if (camdev && camdev->camera_csi_on)
+		rc = camdev->camera_csi_on();
+	if (rc < 0)
+		pr_info("%s camera_csi_on failed\n", __func__);
+
+	return rc;
+}
+
+int msm_camio_probe_off(void *s_ctrl)
+{
+	int rc = 0;
+	struct msm_sensor_ctrl_t* sctrl = (struct msm_sensor_ctrl_t *)s_ctrl;
+	struct msm_camera_sensor_info *sinfo = sctrl->sensordata;
+	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
+
+	msm_camera_vreg_disable();
+
+	if (camdev && camdev->camera_csi_off)
+		rc = camdev->camera_csi_off();
+	if (rc < 0)
+		pr_info("%s camera_csi_off failed\n", __func__);
+
+	rc = msm_camio_config_gpio_table(0);
+
+	return rc;
+}
+
+int msm_camio_probe_on_bootup(void *s_ctrl)
+{
+	int rc = 0;
+	struct msm_sensor_ctrl_t* sctrl = (struct msm_sensor_ctrl_t *)s_ctrl;
+	struct msm_camera_sensor_info *sinfo = sctrl->sensordata;
+	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
+
+	camio_sctrl = sctrl;
+	camio_clk = camdev->ioclk;
+
+	pr_info("%s: sinfo sensor name - %s\n", __func__, sinfo->sensor_name);
+	pr_info("%s: camio_clk m(%d) v(%d)\n", __func__, camio_clk.mclk_clk_rate, camio_clk.vfe_clk_rate);
+
+	rc = msm_camio_config_gpio_table(1);
+	if (rc < 0)
+		return rc;
+
+	return rc;
+}
+
+int msm_camio_probe_off_bootup(void *s_ctrl)
+{
+	int rc = 0;
+	rc = msm_camio_config_gpio_table(0);
+
+	return rc;
+}
+#endif	
+
+void msm_camio_bus_scale_cfg(struct msm_bus_scale_pdata *cam_bus_scale_table,
+		enum msm_bus_perf_setting perf_setting)
+{
+	static uint32_t bus_perf_client;
+	int rc = 0;
+	switch (perf_setting) {
+	case S_INIT:
+		bus_perf_client =
+			msm_bus_scale_register_client(cam_bus_scale_table);
+		if (!bus_perf_client) {
+			CDBG("%s: Registration Failed!!!\n", __func__);
+			bus_perf_client = 0;
+			return;
+		}
+		CDBG("%s: S_INIT rc = %u\n", __func__, bus_perf_client);
+		break;
+	case S_EXIT:
+		if (bus_perf_client) {
+			CDBG("%s: S_EXIT\n", __func__);
+			msm_bus_scale_unregister_client(bus_perf_client);
+		} else
+			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
+		break;
+	case S_PREVIEW:
+		if (bus_perf_client) {
+			rc = msm_bus_scale_client_update_request(
+				bus_perf_client, 1);
+			CDBG("%s: S_PREVIEW rc = %d\n", __func__, rc);
+		} else
+			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
+		break;
+	case S_VIDEO:
+		if (bus_perf_client) {
+			rc = msm_bus_scale_client_update_request(
+				bus_perf_client, 2);
+			CDBG("%s: S_VIDEO rc = %d\n", __func__, rc);
+		} else
+			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
+		break;
+	case S_CAPTURE:
+		if (bus_perf_client) {
+			rc = msm_bus_scale_client_update_request(
+				bus_perf_client, 3);
+			CDBG("%s: S_CAPTURE rc = %d\n", __func__, rc);
+		} else
+			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
+		break;
+	case S_ZSL:
+		if (bus_perf_client) {
+			rc = msm_bus_scale_client_update_request(
+				bus_perf_client, 4);
+			CDBG("%s: S_ZSL rc = %d\n", __func__, rc);
+		} else
+			CDBG("%s: Bus Client NOT Registered!!!\n", __func__);
+		break;
+	case S_DEFAULT:
+		break;
+	default:
+		pr_warning("%s: INVALID CASE\n", __func__);
+	}
+}
+
diff --git a/drivers/media/video/msm/msm_isp.c b/drivers/media/video/msm/msm_isp.c
index 25b5f52..e7fb1a3 100644
--- a/drivers/media/video/msm/msm_isp.c
+++ b/drivers/media/video/msm/msm_isp.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -11,7 +11,7 @@
  *
  */
 
-#include <linux/export.h>
+#include <linux/module.h>
 #include <linux/workqueue.h>
 #include <linux/delay.h>
 #include <linux/types.h>
@@ -39,9 +39,6 @@
 
 #define MSM_FRAME_AXI_MAX_BUF 32
 
-/*
- * This function executes in interrupt context.
- */
 
 void *msm_isp_sync_alloc(int size,
 	  gfp_t gfp)
@@ -67,16 +64,16 @@
 	}
 }
 
-static int msm_isp_notify_VFE_SOF_COUNT_EVT(struct v4l2_subdev *sd, void *arg)
+static int msm_isp_notify_VFE_BUF_FREE_EVT(struct v4l2_subdev *sd, void *arg)
 {
 	struct msm_vfe_cfg_cmd cfgcmd;
 	struct msm_camvfe_params vfe_params;
 	int rc;
 
-	cfgcmd.cmd_type = CMD_VFE_PIX_SOF_COUNT_UPDATE;
+	cfgcmd.cmd_type = CMD_VFE_BUFFER_RELEASE;
 	cfgcmd.value = NULL;
 	vfe_params.vfe_cfg = &cfgcmd;
-	vfe_params.data = arg;
+	vfe_params.data = NULL;
 	rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params);
 	return 0;
 }
@@ -85,11 +82,8 @@
 				int vfe_msg)
 {
 	int image_mode;
-	uint32_t vfe_output_mode = pmctl->vfe_output_mode;
-	vfe_output_mode &= ~(VFE_OUTPUTS_RDI0|
-		VFE_OUTPUTS_RDI1|VFE_OUTPUTS_RDI2);
 	if (vfe_msg == VFE_MSG_OUTPUT_PRIMARY) {
-		switch (vfe_output_mode) {
+		switch (pmctl->vfe_output_mode) {
 		case VFE_OUTPUTS_MAIN_AND_PREVIEW:
 		case VFE_OUTPUTS_MAIN_AND_VIDEO:
 		case VFE_OUTPUTS_MAIN_AND_THUMB:
@@ -113,7 +107,7 @@
 			break;
 		}
 	} else if (vfe_msg == VFE_MSG_OUTPUT_SECONDARY) {
-		switch (vfe_output_mode) {
+		switch (pmctl->vfe_output_mode) {
 		case VFE_OUTPUTS_MAIN_AND_PREVIEW:
 		case VFE_OUTPUTS_VIDEO_AND_PREVIEW:
 			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW;
@@ -139,21 +133,6 @@
 			image_mode = -1;
 			break;
 		}
-	} else if (vfe_msg == VFE_MSG_OUTPUT_TERTIARY1) {
-		if (pmctl->vfe_output_mode & VFE_OUTPUTS_RDI0)
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_RDI;
-		else
-			image_mode = -1;
-	} else if (vfe_msg == VFE_MSG_OUTPUT_TERTIARY2) {
-		if (pmctl->vfe_output_mode & VFE_OUTPUTS_RDI1)
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_RDI1;
-		else
-			image_mode = -1;
-	} else if (vfe_msg == VFE_MSG_OUTPUT_TERTIARY3) {
-		if (pmctl->vfe_output_mode & VFE_OUTPUTS_RDI2)
-			image_mode = MSM_V4L2_EXT_CAPTURE_MODE_RDI2;
-		else
-			image_mode = -1;
 	} else
 		image_mode = -1;
 
@@ -162,62 +141,54 @@
 	return image_mode;
 }
 
-static int msm_isp_notify_VFE_BUF_EVT(struct msm_cam_media_controller *pmctl,
-					struct v4l2_subdev *sd, void *arg)
+static int msm_isp_notify_VFE_BUF_EVT(struct v4l2_subdev *sd, void *arg)
 {
-	int rc = -EINVAL;
+	int rc = -EINVAL, image_mode;
 	struct msm_vfe_resp *vdata = (struct msm_vfe_resp *)arg;
 	struct msm_free_buf free_buf, temp_free_buf;
 	struct msm_camvfe_params vfe_params;
 	struct msm_vfe_cfg_cmd cfgcmd;
+	struct msm_cam_media_controller *pmctl =
+		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
 	struct msm_cam_v4l2_device *pcam = pmctl->pcam_ptr;
-	struct msm_frame_info *frame_info =
-		(struct msm_frame_info *)vdata->evt_msg.data;
-	uint32_t vfe_id;
-	struct msm_cam_buf_handle buf_handle;
+	
 
+	int vfe_id = vdata->evt_msg.msg_id;
 	if (!pcam) {
-		pr_err("%s pcam is null. return\n", __func__);
+		pr_debug("%s pcam is null. return\n", __func__);
 		msm_isp_sync_free(vdata);
 		return rc;
 	}
-	if (frame_info) {
-		vfe_id = frame_info->path;
-		buf_handle.buf_lookup_type = BUF_LOOKUP_BY_INST_HANDLE;
-		buf_handle.inst_handle = frame_info->inst_handle;
-	} else {
-		vfe_id = vdata->evt_msg.msg_id;
-		buf_handle.buf_lookup_type = BUF_LOOKUP_BY_IMG_MODE;
-		buf_handle.image_mode =
-			msm_isp_vfe_msg_to_img_mode(pmctl, vfe_id);
-	}
-
+	
+	image_mode = msm_isp_vfe_msg_to_img_mode(pmctl, vfe_id);
+	BUG_ON(image_mode < 0);
 	switch (vdata->type) {
-	case VFE_MSG_START:
-	case VFE_MSG_START_RECORDING:
-	case VFE_MSG_PREVIEW:
+	case VFE_MSG_V32_START:
+	case VFE_MSG_V32_START_RECORDING:
+	case VFE_MSG_V2X_PREVIEW:
 		D("%s Got V32_START_*: Getting ping addr id = %d",
 						__func__, vfe_id);
 		msm_mctl_reserve_free_buf(pmctl, NULL,
-					&buf_handle, &free_buf);
+					image_mode, &free_buf);
 		cfgcmd.cmd_type = CMD_CONFIG_PING_ADDR;
 		cfgcmd.value = &vfe_id;
 		vfe_params.vfe_cfg = &cfgcmd;
 		vfe_params.data = (void *)&free_buf;
 		rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params);
 		msm_mctl_reserve_free_buf(pmctl, NULL,
-					&buf_handle, &free_buf);
+					image_mode, &free_buf);
 		cfgcmd.cmd_type = CMD_CONFIG_PONG_ADDR;
 		cfgcmd.value = &vfe_id;
 		vfe_params.vfe_cfg = &cfgcmd;
 		vfe_params.data = (void *)&free_buf;
 		rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params);
 		break;
-	case VFE_MSG_CAPTURE:
+	case VFE_MSG_V32_CAPTURE:
+	case VFE_MSG_V2X_CAPTURE:
 		pr_debug("%s Got V32_CAPTURE: getting buffer for id = %d",
 						__func__, vfe_id);
 		msm_mctl_reserve_free_buf(pmctl, NULL,
-					&buf_handle, &free_buf);
+					image_mode, &free_buf);
 		cfgcmd.cmd_type = CMD_CONFIG_PING_ADDR;
 		cfgcmd.value = &vfe_id;
 		vfe_params.vfe_cfg = &cfgcmd;
@@ -225,8 +196,8 @@
 		rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params);
 		temp_free_buf = free_buf;
 		if (msm_mctl_reserve_free_buf(pmctl, NULL,
-					&buf_handle, &free_buf)) {
-			/* Write the same buffer into PONG */
+					image_mode, &free_buf)) {
+			
 			free_buf = temp_free_buf;
 		}
 		cfgcmd.cmd_type = CMD_CONFIG_PONG_ADDR;
@@ -235,8 +206,8 @@
 		vfe_params.data = (void *)&free_buf;
 		rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params);
 		break;
-	case VFE_MSG_JPEG_CAPTURE:
-		D("%s:VFE_MSG_JPEG_CAPTURE vdata->type %d\n", __func__,
+	case VFE_MSG_V32_JPEG_CAPTURE:
+		D("%s:VFE_MSG_V32_JPEG_CAPTURE vdata->type %d\n", __func__,
 			vdata->type);
 		free_buf.num_planes = 2;
 		free_buf.ch_paddr[0] = pmctl->ping_imem_y;
@@ -245,17 +216,17 @@
 		cfgcmd.value = &vfe_id;
 		vfe_params.vfe_cfg = &cfgcmd;
 		vfe_params.data = (void *)&free_buf;
-		D("%s:VFE_MSG_JPEG_CAPTURE y_ping=%x cbcr_ping=%x\n",
+		D("%s:VFE_MSG_V32_JPEG_CAPTURE y_ping=%x cbcr_ping=%x\n",
 			__func__, free_buf.ch_paddr[0], free_buf.ch_paddr[1]);
 		rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params);
-		/* Write the same buffer into PONG */
+		
 		free_buf.ch_paddr[0] = pmctl->pong_imem_y;
 		free_buf.ch_paddr[1] = pmctl->pong_imem_cbcr;
 		cfgcmd.cmd_type = CMD_CONFIG_PONG_ADDR;
 		cfgcmd.value = &vfe_id;
 		vfe_params.vfe_cfg = &cfgcmd;
 		vfe_params.data = (void *)&free_buf;
-		D("%s:VFE_MSG_JPEG_CAPTURE y_pong=%x cbcr_pong=%x\n",
+		D("%s:VFE_MSG_V32_JPEG_CAPTURE y_pong=%x cbcr_pong=%x\n",
 			__func__, free_buf.ch_paddr[0], free_buf.ch_paddr[1]);
 		rc = v4l2_subdev_call(sd, core, ioctl, 0, &vfe_params);
 		break;
@@ -263,7 +234,7 @@
 		D("%s Got OUTPUT_IRQ: Getting free buf id = %d",
 						__func__, vfe_id);
 		msm_mctl_reserve_free_buf(pmctl, NULL,
-					&buf_handle, &free_buf);
+					image_mode, &free_buf);
 		cfgcmd.cmd_type = CMD_CONFIG_FREE_BUF_ADDR;
 		cfgcmd.value = &vfe_id;
 		vfe_params.vfe_cfg = &cfgcmd;
@@ -277,15 +248,93 @@
 	return rc;
 }
 
-/*
- * This function executes in interrupt context.
- */
-static int msm_isp_notify_vfe(struct msm_cam_media_controller *pmctl,
-	struct v4l2_subdev *sd,	unsigned int notification,  void *arg)
+static int msm_enable_dropframe(struct v4l2_subdev *sd,
+			struct msm_cam_media_controller *pmctl, void __user *arg)
+{
+	int dropframe_enabled;
+
+	if (copy_from_user(&dropframe_enabled, arg, sizeof(dropframe_enabled))) {
+		ERR_COPY_FROM_USER();
+		return -EFAULT;
+	} else {
+		atomic_set(&pmctl->dropframe_enabled, dropframe_enabled);
+		pr_info("%s: set dropframe_enabled %d", __func__, atomic_read(&pmctl->dropframe_enabled));
+
+		
+		if (!dropframe_enabled)
+			atomic_set(&pmctl->snap_dropframe_num, 0);
+	}
+
+	return 0;
+}
+
+static int msm_set_dropframe_num(struct v4l2_subdev *sd,
+			struct msm_cam_media_controller *pmctl, void __user *arg)
+{
+	int snap_dropframe_num;
+
+	if (copy_from_user(&snap_dropframe_num, arg, sizeof(snap_dropframe_num))) {
+		ERR_COPY_FROM_USER();
+		return -EFAULT;
+	} else {
+		atomic_set(&pmctl->snap_dropframe_num, snap_dropframe_num);
+		pr_info("%s: set snap_dropframe_num %d", __func__, atomic_read(&pmctl->snap_dropframe_num));
+	}
+
+	return 0;
+}
+
+static int msm_isp_should_drop_frame(struct msm_cam_media_controller *pmctl, uint8_t msgid)
+{
+	int drop_frame = 0;
+
+	switch (msgid) {
+	case VFE_MSG_OUTPUT_PRIMARY:
+		{
+			atomic_set(&pmctl->snap_dropframe, 0);
+
+			if (atomic_read(&pmctl->dropframe_enabled)) {
+				if (atomic_read(&pmctl->snap_dropframe_num) == 0) { 
+					atomic_sub(1, &pmctl->snap_dropframe_num);
+				} else { 
+					atomic_set(&pmctl->snap_dropframe, 1);
+					
+					if (atomic_read(&pmctl->snap_dropframe_num) > 0)
+						atomic_sub(1, &pmctl->snap_dropframe_num);
+					drop_frame = 1;
+				}
+			}
+		}
+		break;
+	case VFE_MSG_OUTPUT_SECONDARY:
+		{
+			
+			if (atomic_read(&pmctl->snap_dropframe))
+				drop_frame = 1;
+		}
+		break;
+	default:
+		break;
+	}
+
+	if (atomic_read(&pmctl->dropframe_enabled))
+		pr_info("%s: FRAME (%d): drop_frame %d [enable %d num %d drop_snap %d]",
+				__func__, msgid, drop_frame,
+				atomic_read(&pmctl->dropframe_enabled),
+				atomic_read(&pmctl->snap_dropframe_num),
+				atomic_read(&pmctl->snap_dropframe));
+
+	return drop_frame;
+}
+
+static int msm_isp_notify_vfe(struct v4l2_subdev *sd,
+	unsigned int notification,  void *arg)
 {
 	int rc = 0;
 	struct v4l2_event v4l2_evt;
 	struct msm_isp_event_ctrl *isp_event;
+	struct msm_cam_media_controller *pmctl =
+		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
 	struct msm_free_buf buf;
 
 	if (!pmctl) {
@@ -295,10 +344,10 @@
 	}
 
 	if (notification == NOTIFY_VFE_BUF_EVT)
-		return msm_isp_notify_VFE_BUF_EVT(pmctl, sd, arg);
+		return msm_isp_notify_VFE_BUF_EVT(sd, arg);
 
-	if (notification == NOTIFY_VFE_PIX_SOF_COUNT)
-		return msm_isp_notify_VFE_SOF_COUNT_EVT(sd, arg);
+	if (notification == NOTIFY_VFE_BUF_FREE_EVT)
+		return msm_isp_notify_VFE_BUF_FREE_EVT(sd, arg);
 
 	isp_event = kzalloc(sizeof(struct msm_isp_event_ctrl), GFP_ATOMIC);
 	if (!isp_event) {
@@ -308,8 +357,6 @@
 
 	v4l2_evt.type = V4L2_EVENT_PRIVATE_START +
 					MSM_CAM_RESP_STAT_EVT_MSG;
-	v4l2_evt.id = 0;
-
 	*((uint32_t *)v4l2_evt.u.data) = (uint32_t)isp_event;
 
 	isp_event->resptype = MSM_CAM_RESP_STAT_EVT_MSG;
@@ -322,66 +369,70 @@
 
 		isp_event->isp_data.isp_msg.msg_id = isp_msg->msg_id;
 		isp_event->isp_data.isp_msg.frame_id = isp_msg->sof_count;
-		getnstimeofday(&(isp_event->isp_data.isp_msg.timestamp));
+        getnstimeofday(&(isp_event->isp_data.isp_msg.timestamp));
+		if(atomic_read(&pmctl->dropframe_enabled) &&
+			atomic_read(&pmctl->snap_dropframe_num) == 0 &&
+			isp_msg->msg_id == MSG_ID_SOF_ACK)
+		{
+			isp_event->isp_data.isp_msg.msg_id = MSG_ID_HDR_SOF_ACK;
+			pr_info("%s MSG_ID_HDR_SOF_ACK", __func__);
+		}
+
 		break;
 	}
 	case NOTIFY_VFE_MSG_OUT: {
-		uint8_t msgid;
-		struct msm_cam_buf_handle buf_handle;
+		
+		int8_t msgid;
+		
+		int image_mode; 
 		struct isp_msg_output *isp_output =
 				(struct isp_msg_output *)arg;
-		if (!isp_output->buf.inst_handle) {
-			switch (isp_output->output_id) {
-			case MSG_ID_OUTPUT_P:
-				msgid = VFE_MSG_OUTPUT_P;
-				break;
-			case MSG_ID_OUTPUT_V:
-				msgid = VFE_MSG_OUTPUT_V;
-				break;
-			case MSG_ID_OUTPUT_T:
-				msgid = VFE_MSG_OUTPUT_T;
-				break;
-			case MSG_ID_OUTPUT_S:
-				msgid = VFE_MSG_OUTPUT_S;
-				break;
-			case MSG_ID_OUTPUT_PRIMARY:
-				msgid = VFE_MSG_OUTPUT_PRIMARY;
-				break;
-			case MSG_ID_OUTPUT_SECONDARY:
-				msgid = VFE_MSG_OUTPUT_SECONDARY;
-				break;
-			case MSG_ID_OUTPUT_TERTIARY1:
-				msgid = VFE_MSG_OUTPUT_TERTIARY1;
-				break;
-			case MSG_ID_OUTPUT_TERTIARY2:
-				msgid = VFE_MSG_OUTPUT_TERTIARY2;
-				break;
-			case MSG_ID_OUTPUT_TERTIARY3:
-				msgid = VFE_MSG_OUTPUT_TERTIARY3;
-				break;
-			default:
-				pr_err("%s: Invalid VFE output id: %d\n",
-					   __func__, isp_output->output_id);
-				rc = -EINVAL;
-				break;
-			}
-			if (!rc) {
-				buf_handle.buf_lookup_type =
-					BUF_LOOKUP_BY_IMG_MODE;
-				buf_handle.image_mode =
-				msm_isp_vfe_msg_to_img_mode(pmctl, msgid);
-			}
-		} else {
-			buf_handle.buf_lookup_type = BUF_LOOKUP_BY_INST_HANDLE;
-			buf_handle.inst_handle = isp_output->buf.inst_handle;
+		switch (isp_output->output_id) {
+		case MSG_ID_OUTPUT_P:
+			msgid = VFE_MSG_OUTPUT_P;
+			break;
+		case MSG_ID_OUTPUT_V:
+			msgid = VFE_MSG_OUTPUT_V;
+			break;
+		case MSG_ID_OUTPUT_T:
+			msgid = VFE_MSG_OUTPUT_T;
+			break;
+		case MSG_ID_OUTPUT_S:
+			msgid = VFE_MSG_OUTPUT_S;
+			break;
+		case MSG_ID_OUTPUT_PRIMARY:
+			msgid = VFE_MSG_OUTPUT_PRIMARY;
+			break;
+		case MSG_ID_OUTPUT_SECONDARY:
+			msgid = VFE_MSG_OUTPUT_SECONDARY;
+			break;
+		default:
+			pr_err("%s: Invalid VFE output id: %d\n",
+				__func__, isp_output->output_id);
+			rc = -EINVAL;
+			break;
 		}
-		isp_event->isp_data.isp_msg.msg_id =
-			isp_output->output_id;
-		isp_event->isp_data.isp_msg.frame_id =
-			isp_output->frameCounter;
-		buf = isp_output->buf;
-		msm_mctl_buf_done(pmctl, &buf_handle,
-			&buf, isp_output->frameCounter);
+
+		if (!rc) {
+            if (msm_isp_should_drop_frame(pmctl, msgid)) {
+                msgid = msm_isp_vfe_msg_to_img_mode(pmctl, msgid);
+                
+                msm_mctl_return_free_buf(pmctl, msgid, &(isp_output->buf));
+                return rc;
+            } else {
+			isp_event->isp_data.isp_msg.msg_id =
+				isp_output->output_id;
+			isp_event->isp_data.isp_msg.frame_id =
+				isp_output->frameCounter;
+			buf = isp_output->buf;
+			
+			image_mode  = msm_isp_vfe_msg_to_img_mode(pmctl, msgid);
+			BUG_ON(image_mode  < 0);
+			msm_mctl_buf_done(pmctl, image_mode ,
+				&buf, isp_output->frameCounter);
+			
+            }
+		}
 		}
 		break;
 	case NOTIFY_VFE_MSG_COMP_STATS: {
@@ -389,16 +440,18 @@
 		struct msm_stats_buf *stats_buf = NULL;
 
 		isp_event->isp_data.isp_msg.msg_id = MSG_ID_STATS_COMPOSITE;
-		CDBG("%s: aec (%d, %x) awb (%d, %x) af (%d, %x) ", __func__,
-			stats->aec.fd, (uint32_t)stats->aec.buff,
-			stats->awb.fd, (uint32_t)stats->awb.buff,
-			stats->af.fd, (uint32_t)stats->af.buff);
-		CDBG("%s: rs (%d, %x) cs(%d, %x) ihist(%d, %x)", __func__,
-			stats->rs.fd, (uint32_t)stats->rs.buff,
-			stats->cs.fd, (uint32_t)stats->cs.buff,
-			stats->ihist.fd, (uint32_t)stats->ihist.buff);
-		CDBG("%s:bhist/skin(%d, %x) ", __func__,
-			stats->skin.fd, (uint32_t)stats->skin.buff);
+		stats->aec.buff = msm_pmem_stats_ptov_lookup(pmctl,
+					stats->aec.buff, &(stats->aec.fd));
+		stats->awb.buff = msm_pmem_stats_ptov_lookup(pmctl,
+					stats->awb.buff, &(stats->awb.fd));
+		stats->af.buff = msm_pmem_stats_ptov_lookup(pmctl,
+					stats->af.buff, &(stats->af.fd));
+		stats->ihist.buff = msm_pmem_stats_ptov_lookup(pmctl,
+					stats->ihist.buff, &(stats->ihist.fd));
+		stats->rs.buff = msm_pmem_stats_ptov_lookup(pmctl,
+					stats->rs.buff, &(stats->rs.fd));
+		stats->cs.buff = msm_pmem_stats_ptov_lookup(pmctl,
+					stats->cs.buff, &(stats->cs.fd));
 
 		stats_buf = kmalloc(sizeof(struct msm_stats_buf), GFP_ATOMIC);
 		if (!stats_buf) {
@@ -416,22 +469,18 @@
 		struct msm_stats_buf stats;
 		struct isp_msg_stats *isp_stats = (struct isp_msg_stats *)arg;
 
-		memset(&stats, 0, sizeof(stats));
 		isp_event->isp_data.isp_msg.msg_id = isp_stats->id;
 		isp_event->isp_data.isp_msg.frame_id =
 			isp_stats->frameCounter;
-		stats.buffer = isp_stats->buffer;
-		stats.fd = isp_stats->fd;
-		/* buf_idx used for O(0) lookup */
-		stats.buf_idx = isp_stats->buf_idx;
+		stats.buffer = msm_pmem_stats_ptov_lookup(pmctl,
+						isp_stats->buffer,
+						&(stats.fd));
 		switch (isp_stats->id) {
 		case MSG_ID_STATS_AEC:
-		case MSG_ID_STATS_BG:
 			stats.aec.buff = stats.buffer;
 			stats.aec.fd = stats.fd;
 			break;
 		case MSG_ID_STATS_AF:
-		case MSG_ID_STATS_BF:
 			stats.af.buff = stats.buffer;
 			stats.af.fd = stats.fd;
 			break;
@@ -451,10 +500,6 @@
 			stats.cs.buff = stats.buffer;
 			stats.cs.fd = stats.fd;
 			break;
-		case MSG_ID_STATS_BHIST:
-			stats.skin.buff = stats.buffer;
-			stats.skin.fd = stats.fd;
-			break;
 		case MSG_ID_STATS_AWB_AEC:
 			break;
 		default:
@@ -471,8 +516,8 @@
 				kmalloc(sizeof(struct msm_stats_buf),
 							GFP_ATOMIC);
 			if (!stats_buf) {
-				pr_err("%s: out of memory. stats_id = %d\n",
-					__func__, isp_stats->id);
+				pr_err("%s: out of memory.\n",
+							__func__);
 				rc = -ENOMEM;
 			} else {
 				*stats_buf = stats;
@@ -496,17 +541,81 @@
 	return rc;
 }
 
-int msm_isp_notify(struct msm_cam_media_controller *pmctl,
-	struct v4l2_subdev *sd,	unsigned int notification, void *arg)
+static int msm_isp_notify(struct v4l2_subdev *sd,
+	unsigned int notification, void *arg)
 {
-	return msm_isp_notify_vfe(pmctl, sd, notification, arg);
+	return msm_isp_notify_vfe(sd, notification, arg);
 }
-EXPORT_SYMBOL(msm_isp_notify);
+
+static int msm_isp_open(struct v4l2_subdev *sd,
+	struct msm_cam_media_controller *mctl)
+{
+	
+	int rc = 0;
+	D("%s\n", __func__);
+	if (!mctl) {
+		pr_err("%s: param is NULL", __func__);
+		return -EINVAL;
+	}
+
+	rc = msm_iommu_map_contig_buffer(
+		(unsigned long)IMEM_Y_PING_OFFSET, CAMERA_DOMAIN, GEN_POOL,
+		((IMEM_Y_SIZE + IMEM_CBCR_SIZE + 4095) & (~4095)),
+		SZ_4K, IOMMU_WRITE | IOMMU_READ,
+		(unsigned long *)&mctl->ping_imem_y);
+	mctl->ping_imem_cbcr = mctl->ping_imem_y + IMEM_Y_SIZE;
+	if (rc < 0) {
+		pr_err("%s: ping iommu mapping returned error %d\n",
+			__func__, rc);
+		mctl->ping_imem_y = 0;
+		mctl->ping_imem_cbcr = 0;
+	}
+	msm_iommu_map_contig_buffer(
+		(unsigned long)IMEM_Y_PONG_OFFSET, CAMERA_DOMAIN, GEN_POOL,
+		((IMEM_Y_SIZE + IMEM_CBCR_SIZE + 4095) & (~4095)),
+		SZ_4K, IOMMU_WRITE | IOMMU_READ,
+		(unsigned long *)&mctl->pong_imem_y);
+	mctl->pong_imem_cbcr = mctl->pong_imem_y + IMEM_Y_SIZE;
+	if (rc < 0) {
+		pr_err("%s: pong iommu mapping returned error %d\n",
+			 __func__, rc);
+		mctl->pong_imem_y = 0;
+		mctl->pong_imem_cbcr = 0;
+	}
+
+
+	rc = msm_vfe_subdev_init(sd, mctl);
+	if (rc < 0) {
+		pr_err("%s: vfe_init failed at %d\n",
+				__func__, rc);
+	}
+	return rc;
+}
+
+static void msm_isp_release(struct msm_cam_media_controller *mctl,
+	struct v4l2_subdev *sd)
+{
+	D("%s\n", __func__);
+	msm_vfe_subdev_release(sd);
+	if (mctl->ping_imem_y)
+		msm_iommu_unmap_contig_buffer(mctl->ping_imem_y,
+			CAMERA_DOMAIN, GEN_POOL,
+			((IMEM_Y_SIZE + IMEM_CBCR_SIZE + 4095) & (~4095)));
+	if (mctl->pong_imem_y)
+		msm_iommu_unmap_contig_buffer(mctl->pong_imem_y,
+			CAMERA_DOMAIN, GEN_POOL,
+			((IMEM_Y_SIZE + IMEM_CBCR_SIZE + 4095) & (~4095)));
+	mctl->ping_imem_y = 0;
+	mctl->ping_imem_cbcr = 0;
+	mctl->pong_imem_y = 0;
+	mctl->pong_imem_cbcr = 0;
+}
 
 static int msm_config_vfe(struct v4l2_subdev *sd,
 	struct msm_cam_media_controller *mctl, void __user *arg)
 {
 	struct msm_vfe_cfg_cmd cfgcmd;
+	struct msm_pmem_region region[8];
 	struct axidata axi_data;
 
 	if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
@@ -517,17 +626,104 @@
 	memset(&axi_data, 0, sizeof(axi_data));
 	CDBG("%s: cmd_type %d\n", __func__, cfgcmd.cmd_type);
 	switch (cfgcmd.cmd_type) {
-	case CMD_STATS_BG_ENABLE:
-	case CMD_STATS_BF_ENABLE:
-	case CMD_STATS_BHIST_ENABLE:
 	case CMD_STATS_AF_ENABLE:
+		axi_data.bufnum1 =
+			msm_pmem_region_lookup(
+				&mctl->stats_info.pmem_stats_list,
+				MSM_PMEM_AF, &region[0],
+				NUM_STAT_OUTPUT_BUFFERS);
+		if (!axi_data.bufnum1) {
+			pr_err("%s %d: pmem region lookup error\n",
+				__func__, __LINE__);
+			return -EINVAL;
+		}
+		axi_data.region = &region[0];
+		return msm_isp_subdev_ioctl(sd, &cfgcmd,
+							&axi_data);
 	case CMD_STATS_AEC_ENABLE:
+		axi_data.bufnum1 =
+			msm_pmem_region_lookup(
+				&mctl->stats_info.pmem_stats_list,
+				MSM_PMEM_AEC, &region[0],
+				NUM_STAT_OUTPUT_BUFFERS);
+		if (!axi_data.bufnum1) {
+			pr_err("%s %d: pmem region lookup error\n",
+				__func__, __LINE__);
+			return -EINVAL;
+		}
+		axi_data.region = &region[0];
+		return msm_isp_subdev_ioctl(sd, &cfgcmd,
+							&axi_data);
 	case CMD_STATS_AWB_ENABLE:
+		axi_data.bufnum1 =
+			msm_pmem_region_lookup(
+				&mctl->stats_info.pmem_stats_list,
+				MSM_PMEM_AWB, &region[0],
+				NUM_STAT_OUTPUT_BUFFERS);
+		if (!axi_data.bufnum1) {
+			pr_err("%s %d: pmem region lookup error\n",
+				__func__, __LINE__);
+			return -EINVAL;
+		}
+		axi_data.region = &region[0];
+		return msm_isp_subdev_ioctl(sd, &cfgcmd,
+							&axi_data);
 	case CMD_STATS_AEC_AWB_ENABLE:
+		axi_data.bufnum1 =
+			msm_pmem_region_lookup(
+				&mctl->stats_info.pmem_stats_list,
+				MSM_PMEM_AEC_AWB, &region[0],
+				NUM_STAT_OUTPUT_BUFFERS);
+		if (!axi_data.bufnum1) {
+			pr_err("%s %d: pmem region lookup error\n",
+				__func__, __LINE__);
+			return -EINVAL;
+		}
+		axi_data.region = &region[0];
+		return msm_isp_subdev_ioctl(sd, &cfgcmd,
+							&axi_data);
 	case CMD_STATS_IHIST_ENABLE:
+		axi_data.bufnum1 =
+			msm_pmem_region_lookup(
+				&mctl->stats_info.pmem_stats_list,
+				MSM_PMEM_IHIST, &region[0],
+				NUM_STAT_OUTPUT_BUFFERS);
+		if (!axi_data.bufnum1) {
+			pr_err("%s %d: pmem region lookup error\n",
+				__func__, __LINE__);
+			return -EINVAL;
+		}
+		axi_data.region = &region[0];
+		return msm_isp_subdev_ioctl(sd, &cfgcmd,
+							&axi_data);
 	case CMD_STATS_RS_ENABLE:
+		axi_data.bufnum1 =
+			msm_pmem_region_lookup(
+				&mctl->stats_info.pmem_stats_list,
+				MSM_PMEM_RS, &region[0],
+				NUM_STAT_OUTPUT_BUFFERS);
+		if (!axi_data.bufnum1) {
+			pr_err("%s %d: pmem region lookup error\n",
+				__func__, __LINE__);
+			return -EINVAL;
+		}
+		axi_data.region = &region[0];
+		return msm_isp_subdev_ioctl(sd, &cfgcmd,
+							&axi_data);
 	case CMD_STATS_CS_ENABLE:
-		return msm_isp_subdev_ioctl(sd, &cfgcmd, NULL);
+		axi_data.bufnum1 =
+			msm_pmem_region_lookup(
+				&mctl->stats_info.pmem_stats_list,
+				MSM_PMEM_CS, &region[0],
+				NUM_STAT_OUTPUT_BUFFERS);
+		if (!axi_data.bufnum1) {
+			pr_err("%s %d: pmem region lookup error\n",
+				__func__, __LINE__);
+			return -EINVAL;
+		}
+		axi_data.region = &region[0];
+		return msm_isp_subdev_ioctl(sd, &cfgcmd,
+							&axi_data);
 	case CMD_GENERAL:
 	case CMD_STATS_DISABLE:
 		return msm_isp_subdev_ioctl(sd, &cfgcmd,
@@ -540,6 +736,7 @@
 	return -EINVAL;
 }
 
+
 static int msm_axi_config(struct v4l2_subdev *sd,
 		struct msm_cam_media_controller *mctl, void __user *arg)
 {
@@ -559,15 +756,6 @@
 	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC:
 	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC_ALL_CHNLS:
 	case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC:
-	case CMD_AXI_START:
-	case CMD_AXI_STOP:
-	case CMD_AXI_CFG_TERT1:
-	case CMD_AXI_CFG_TERT2:
-	case CMD_AXI_CFG_TERT3:
-		/* Dont need to pass buffer information.
-		 * subdev will get the buffer from media
-		 * controller free queue.
-		 */
 		return msm_isp_subdev_ioctl(sd, &cfgcmd, NULL);
 
 	default:
@@ -613,12 +801,6 @@
 			cfgcmd.cmd_type = CMD_STATS_CS_BUF_RELEASE;
 		else if (buf.type == STAT_AEAW)
 			cfgcmd.cmd_type = CMD_STATS_BUF_RELEASE;
-		else if (buf.type == STAT_BG)
-			cfgcmd.cmd_type = CMD_STATS_BG_BUF_RELEASE;
-		else if (buf.type == STAT_BF)
-			cfgcmd.cmd_type = CMD_STATS_BF_BUF_RELEASE;
-		else if (buf.type == STAT_BHIST)
-			cfgcmd.cmd_type = CMD_STATS_BHIST_BUF_RELEASE;
 
 		else {
 			pr_err("%s: invalid buf type %d\n",
@@ -640,94 +822,31 @@
 	return rc;
 }
 
-static int msm_vfe_stats_buf_ioctl(struct v4l2_subdev *sd,
-	unsigned int cmd,
-	struct msm_cam_media_controller *mctl,
-	void __user *arg)
-{
-	struct msm_vfe_cfg_cmd cfgcmd;
-	int rc = 0;
-	v4l2_set_subdev_hostdata(sd, mctl);
-	switch (cmd) {
-	case MSM_CAM_IOCTL_STATS_REQBUF: {
-		struct msm_stats_reqbuf reqbuf;
-		if (copy_from_user(&reqbuf, arg,
-			sizeof(struct msm_stats_reqbuf))) {
-			ERR_COPY_FROM_USER();
-			return -EFAULT;
-		}
-	cfgcmd.cmd_type = VFE_CMD_STATS_REQBUF;
-	cfgcmd.value = (void *)&reqbuf;
-	cfgcmd.length = sizeof(struct msm_stats_reqbuf);
-	rc = msm_isp_subdev_ioctl(sd, &cfgcmd, (void *)mctl->client);
-	break;
-	}
-	case MSM_CAM_IOCTL_STATS_ENQUEUEBUF: {
-		struct msm_stats_buf_info buf_info;
-		if (copy_from_user(&buf_info, arg,
-			sizeof(struct msm_stats_buf_info))) {
-			ERR_COPY_FROM_USER();
-			return -EFAULT;
-		}
-	cfgcmd.cmd_type = VFE_CMD_STATS_ENQUEUEBUF;
-	cfgcmd.value = (void *)&buf_info;
-	cfgcmd.length = sizeof(struct msm_stats_buf_info);
-	rc = msm_isp_subdev_ioctl(sd, &cfgcmd, NULL);
-	break;
-	}
-	case MSM_CAM_IOCTL_STATS_FLUSH_BUFQ: {
-		struct msm_stats_flush_bufq bufq_info;
-		if (copy_from_user(&bufq_info, arg,
-			sizeof(struct msm_stats_flush_bufq))) {
-			ERR_COPY_FROM_USER();
-			return -EFAULT;
-		}
-	cfgcmd.cmd_type = VFE_CMD_STATS_FLUSH_BUFQ;
-	cfgcmd.value = (void *)&bufq_info;
-	cfgcmd.length = sizeof(struct msm_stats_flush_bufq);
-	rc = msm_isp_subdev_ioctl(sd, &cfgcmd, NULL);
-	break;
-	}
-	case MSM_CAM_IOCTL_STATS_UNREG_BUF: {
-		struct msm_stats_reqbuf reqbuf;
-		if (copy_from_user(&reqbuf, arg,
-			sizeof(struct msm_stats_reqbuf))) {
-			ERR_COPY_FROM_USER();
-			return -EFAULT;
-		}
-	cfgcmd.cmd_type = VFE_CMD_STATS_UNREGBUF;
-	cfgcmd.value = (void *)&reqbuf;
-	cfgcmd.length = sizeof(struct msm_stats_reqbuf);
-	rc = msm_isp_subdev_ioctl(sd, &cfgcmd, (void *)mctl->client);
-	break;
-	}
-	default:
-		rc = -1;
-	break;
-	}
-	CDBG("%s\n", __func__);
-	return rc;
-}
-/* config function simliar to origanl msm_ioctl_config*/
-int msm_isp_config(struct msm_cam_media_controller *pmctl,
+static int msm_isp_config(struct msm_cam_media_controller *pmctl,
 			 unsigned int cmd, unsigned long arg)
 {
 
 	int rc = -EINVAL;
 	void __user *argp = (void __user *)arg;
-	struct v4l2_subdev *sd;
-	if (!pmctl->vfe_sdev) {
-		pr_err("%s vfe subdev is NULL\n", __func__);
-		return -ENXIO;
-	}
-	sd = pmctl->vfe_sdev;
+	struct v4l2_subdev *sd = pmctl->isp_sdev->sd;
+
 	D("%s: cmd %d\n", __func__, _IOC_NR(cmd));
 	switch (cmd) {
+	case MSM_CAM_IOCTL_PICT_PP_DONE:
+		
+		break;
+
 	case MSM_CAM_IOCTL_CONFIG_VFE:
-		/* Coming from config thread for update */
+		
 		rc = msm_config_vfe(sd, pmctl, argp);
 		break;
 
+	case MSM_CAM_IOCTL_CONFIG_VPE:
+		
+		
+		rc = 0;
+		break;
+
 	case MSM_CAM_IOCTL_AXI_CONFIG:
 		D("Received MSM_CAM_IOCTL_AXI_CONFIG\n");
 		rc = msm_axi_config(sd, pmctl, argp);
@@ -737,11 +856,12 @@
 		rc = msm_put_stats_buffer(sd, pmctl, argp);
 		break;
 
-	case MSM_CAM_IOCTL_STATS_REQBUF:
-	case MSM_CAM_IOCTL_STATS_ENQUEUEBUF:
-	case MSM_CAM_IOCTL_STATS_FLUSH_BUFQ:
-	case MSM_CAM_IOCTL_STATS_UNREG_BUF:
-		rc = msm_vfe_stats_buf_ioctl(sd, cmd, pmctl, argp);
+	case MSM_CAM_IOCTL_ENABLE_DROP_FRAME :
+		rc = msm_enable_dropframe(sd, pmctl, argp);
+		break;
+
+	case MSM_CAM_IOCTL_SET_DROP_FRAME_NUM :
+		rc = msm_set_dropframe_num(sd, pmctl, argp);
 		break;
 
 	default:
@@ -752,7 +872,45 @@
 
 	return rc;
 }
-EXPORT_SYMBOL(msm_isp_config);
+
+static struct msm_isp_ops isp_subdev[MSM_MAX_CAMERA_CONFIGS];
+
+int msm_isp_init_module(int g_num_config_nodes)
+{
+	int i = 0;
+
+	for (i = 0; i < g_num_config_nodes; i++) {
+		isp_subdev[i].isp_open = msm_isp_open;
+		isp_subdev[i].isp_config = msm_isp_config;
+		isp_subdev[i].isp_release  = msm_isp_release;
+		isp_subdev[i].isp_notify = msm_isp_notify;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(msm_isp_init_module);
+
+int msm_isp_register(struct msm_cam_server_dev *psvr)
+{
+	int i = 0;
+
+	D("%s\n", __func__);
+
+	BUG_ON(!psvr);
+
+	
+	for (i = 0; i < psvr->config_info.num_config_nodes; i++)
+		psvr->isp_subdev[i] = &(isp_subdev[i]);
+
+	return 0;
+}
+EXPORT_SYMBOL(msm_isp_register);
+
+void msm_isp_unregister(struct msm_cam_server_dev *psvr)
+{
+	int i = 0;
+	for (i = 0; i < psvr->config_info.num_config_nodes; i++)
+		psvr->isp_subdev[i] = NULL;
+}
 
 int msm_isp_subdev_ioctl(struct v4l2_subdev *isp_subdev,
 	struct msm_vfe_cfg_cmd *cfgcmd, void *data)
@@ -762,3 +920,6 @@
 	vfe_params.data = data;
 	return v4l2_subdev_call(isp_subdev, core, ioctl, 0, &vfe_params);
 }
+
+
+
diff --git a/drivers/media/video/msm/msm_mctl.c b/drivers/media/video/msm/msm_mctl.c
index 06e8650..6cd88a4 100644
--- a/drivers/media/video/msm/msm_mctl.c
+++ b/drivers/media/video/msm/msm_mctl.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -11,6 +11,8 @@
  *
  */
 
+#include <linux/module.h>
+#include <linux/wakelock.h>
 #include <linux/workqueue.h>
 #include <linux/delay.h>
 #include <linux/types.h>
@@ -20,7 +22,7 @@
 #include <linux/videodev2.h>
 #include <linux/proc_fs.h>
 #include <linux/vmalloc.h>
-#include <linux/wakelock.h>
+#include <mach/board.h>
 
 #include <media/v4l2-dev.h>
 #include <media/v4l2-ioctl.h>
@@ -29,17 +31,19 @@
 #include <linux/android_pmem.h>
 
 #include "msm.h"
-#include "msm_cam_server.h"
 #include "msm_csid.h"
 #include "msm_csic.h"
 #include "msm_csiphy.h"
 #include "msm_ispif.h"
 #include "msm_sensor.h"
-#include "msm_actuator.h"
 #include "msm_vpe.h"
 #include "msm_vfe32.h"
-#include "msm_camera_eeprom.h"
-#include "msm_csi_register.h"
+
+#if 1	
+#ifdef CONFIG_RAWCHIP
+#include "rawchip/rawchip.h"
+#endif
+#endif 
 
 #ifdef CONFIG_MSM_CAMERA_DEBUG
 #define D(fmt, args...) pr_debug("msm_mctl: " fmt, ##args)
@@ -48,14 +52,14 @@
 #endif
 
 #define MSM_V4L2_SWFI_LATENCY 3
-/* VFE required buffer number for streaming */
+
 static struct msm_isp_color_fmt msm_isp_formats[] = {
 	{
 	.name	   = "NV12YUV",
 	.depth	  = 12,
 	.bitsperpxl = 8,
 	.fourcc	 = V4L2_PIX_FMT_NV12,
-	.pxlcode	= V4L2_MBUS_FMT_YUYV8_2X8, /* YUV sensor */
+	.pxlcode	= V4L2_MBUS_FMT_YUYV8_2X8, 
 	.colorspace = V4L2_COLORSPACE_JPEG,
 	},
 	{
@@ -63,7 +67,15 @@
 	.depth	  = 12,
 	.bitsperpxl = 8,
 	.fourcc	 = V4L2_PIX_FMT_NV21,
-	.pxlcode	= V4L2_MBUS_FMT_YUYV8_2X8, /* YUV sensor */
+	.pxlcode	= V4L2_MBUS_FMT_YUYV8_2X8, 
+	.colorspace = V4L2_COLORSPACE_JPEG,
+	},
+	{
+	.name	   = "YU12YUV",
+	.depth	  = 12,
+	.bitsperpxl = 8,
+	.fourcc	 = V4L2_PIX_FMT_YUV420M,
+	.pxlcode	= V4L2_MBUS_FMT_YUYV8_2X8, 
 	.colorspace = V4L2_COLORSPACE_JPEG,
 	},
 	{
@@ -71,7 +83,7 @@
 	.depth	  = 8,
 	.bitsperpxl = 8,
 	.fourcc	 = V4L2_PIX_FMT_NV12,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
+	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, 
 	.colorspace = V4L2_COLORSPACE_JPEG,
 	},
 	{
@@ -79,7 +91,7 @@
 	.depth	  = 8,
 	.bitsperpxl = 8,
 	.fourcc	 = V4L2_PIX_FMT_NV21,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
+	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, 
 	.colorspace = V4L2_COLORSPACE_JPEG,
 	},
 	{
@@ -87,7 +99,7 @@
 	.depth	  = 8,
 	.bitsperpxl = 8,
 	.fourcc	 = V4L2_PIX_FMT_NV16,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
+	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, 
 	.colorspace = V4L2_COLORSPACE_JPEG,
 	},
 	{
@@ -95,7 +107,7 @@
 	.depth	  = 8,
 	.bitsperpxl = 8,
 	.fourcc	 = V4L2_PIX_FMT_NV61,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
+	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, 
 	.colorspace = V4L2_COLORSPACE_JPEG,
 	},
 	{
@@ -103,7 +115,7 @@
 	.depth	  = 8,
 	.bitsperpxl = 8,
 	.fourcc	 = V4L2_PIX_FMT_NV21,
-	.pxlcode	= V4L2_MBUS_FMT_SGRBG10_1X10, /* Bayer sensor */
+	.pxlcode	= V4L2_MBUS_FMT_SGRBG10_1X10, 
 	.colorspace = V4L2_COLORSPACE_JPEG,
 	},
 	{
@@ -111,7 +123,7 @@
 	.depth	  = 8,
 	.bitsperpxl = 8,
 	.fourcc	 = V4L2_PIX_FMT_YUV420M,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
+	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, 
 	.colorspace = V4L2_COLORSPACE_JPEG,
 	},
 	{
@@ -119,7 +131,7 @@
 	.depth	  = 10,
 	.bitsperpxl = 10,
 	.fourcc	 = V4L2_PIX_FMT_SBGGR10,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* Bayer sensor */
+	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, 
 	.colorspace = V4L2_COLORSPACE_JPEG,
 	},
 	{
@@ -127,51 +139,29 @@
 	.depth	  = 10,
 	.bitsperpxl = 10,
 	.fourcc	 = V4L2_PIX_FMT_SBGGR10,
-	.pxlcode	= V4L2_MBUS_FMT_SGRBG10_1X10, /* Bayer sensor */
+	.pxlcode	= V4L2_MBUS_FMT_SGRBG10_1X10, 
 	.colorspace = V4L2_COLORSPACE_JPEG,
 	},
-	{
-	.name	   = "YUYV",
-	.depth	  = 16,
-	.bitsperpxl = 16,
-	.fourcc	 = V4L2_PIX_FMT_YUYV,
-	.pxlcode	= V4L2_MBUS_FMT_YUYV8_2X8, /* YUV sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "SAEC",
-	.depth	  = 16,
-	.bitsperpxl = 16,
-	.fourcc	 = V4L2_PIX_FMT_STATS_AE,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* YUV sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "SAWB",
-	.depth	  = 16,
-	.bitsperpxl = 16,
-	.fourcc	 = V4L2_PIX_FMT_STATS_AWB,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* YUV sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name	   = "SAFC",
-	.depth	  = 16,
-	.bitsperpxl = 16,
-	.fourcc	 = V4L2_PIX_FMT_STATS_AF,
-	.pxlcode	= V4L2_MBUS_FMT_SBGGR10_1X10, /* YUV sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
-	{
-	.name      = "SHST",
-	.depth    = 16,
-	.bitsperpxl = 16,
-	.fourcc  = V4L2_PIX_FMT_STATS_IHST,
-	.pxlcode        = V4L2_MBUS_FMT_SBGGR10_1X10, /* YUV sensor */
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	},
+
 };
 
+static int msm_set_perf_lock(
+	struct msm_cam_media_controller *mctl,
+	int enable)
+{
+#ifdef CONFIG_PERFLOCK
+	pr_info("%s: cam_perf_lock enable %d flag 0x%x\n", __func__, enable, mctl->cam_perf_lock->flags);
+	if(enable) {
+		if (!is_perf_lock_active(mctl->cam_perf_lock))
+			perf_lock(mctl->cam_perf_lock);
+	} else {
+		if (is_perf_lock_active(mctl->cam_perf_lock))
+			perf_unlock(mctl->cam_perf_lock);
+	}
+#endif
+	return 0;
+}
+
 static int msm_get_sensor_info(
 	struct msm_cam_media_controller *mctl,
 	void __user *arg)
@@ -194,16 +184,21 @@
 	info.flash_enabled = sdata->flash_data->flash_type !=
 					MSM_CAMERA_FLASH_NONE;
 	info.pxlcode = pcam->usr_fmts[0].pxlcode;
-	info.flashtype = sdata->flash_type; /* two flash_types here? */
+	info.flashtype = sdata->flash_type; 
 	info.camera_type = sdata->camera_type;
-	/* sensor_type needed to add YUV/SOC in probing */
+	
 	info.sensor_type = sdata->sensor_type;
 	info.mount_angle = sdata->sensor_platform_info->mount_angle;
 	info.actuator_enabled = sdata->actuator_info ? 1 : 0;
 	info.strobe_flash_enabled = sdata->strobe_flash_data ? 1 : 0;
-	info.ispif_supported = mctl->ispif_sdev ? 1 : 0;
 
-	/* copy back to user space */
+	
+	if (sdata->use_rawchip == RAWCHIP_ENABLE)
+		info.use_rawchip = RAWCHIP_ENABLE;
+	else
+		info.use_rawchip = RAWCHIP_DISABLE;
+	
+	
 	if (copy_to_user((void *)arg,
 				&info,
 				sizeof(struct msm_camsensor_info))) {
@@ -213,6 +208,7 @@
 	return rc;
 }
 
+
 static int msm_mctl_set_vfe_output_mode(struct msm_cam_media_controller
 					*p_mctl, void __user *arg)
 {
@@ -228,50 +224,6 @@
 	return rc;
 }
 
-static uint8_t msm_sensor_state_check(
-	struct msm_cam_media_controller *p_mctl)
-{
-	struct msm_sensor_ctrl_t *s_ctrl = NULL;
-	if (!p_mctl)
-		return 0;
-	if (!p_mctl->sensor_sdev)
-		return 0;
-	s_ctrl = get_sctrl(p_mctl->sensor_sdev);
-	if (s_ctrl->sensor_state == MSM_SENSOR_POWER_UP)
-		return 1;
-	return 0;
-}
-
-static int msm_mctl_add_intf_to_mctl_map(
-	struct msm_cam_media_controller *p_mctl,
-	struct intf_mctl_mapping_cfg *intf_map)
-{
-
-	int i;
-	int rc = 0;
-	uint32_t mctl_handle;
-
-	mctl_handle = msm_cam_find_handle_from_mctl_ptr(p_mctl);
-	if (mctl_handle == 0) {
-		pr_err("%s Error in finding handle from mctl_ptr, rc = %d",
-			__func__, rc);
-		return -EFAULT;
-	}
-	for (i = 0; i < intf_map->num_entries; i++) {
-		rc = msm_cam_server_config_interface_map(
-			intf_map->image_modes[i], mctl_handle,
-			intf_map->vnode_id, intf_map->is_bayer_sensor);
-		if (rc < 0) {
-				pr_err("%s Error in INTF MAPPING rc = %d",
-					__func__, rc);
-				return -EINVAL;
-		}
-	}
-	return rc;
-}
-
-/* called by the server or the config nodes to handle user space
-	commands*/
 static int msm_mctl_cmd(struct msm_cam_media_controller *p_mctl,
 			unsigned int cmd, unsigned long arg)
 {
@@ -283,9 +235,9 @@
 	}
 	D("%s:%d: cmd %d\n", __func__, __LINE__, cmd);
 
-	/* ... call sensor, ISPIF or VEF subdev*/
+	
 	switch (cmd) {
-		/* sensor config*/
+		
 	case MSM_CAM_IOCTL_GET_SENSOR_INFO:
 			rc = msm_get_sensor_info(p_mctl, argp);
 			break;
@@ -336,6 +288,8 @@
 
 	case MSM_CAM_IOCTL_GET_ACTUATOR_INFO: {
 		struct msm_actuator_cfg_data cdata;
+		CDBG("%s: act_config: %p\n", __func__,
+			p_mctl->actctrl->a_config);
 		if (copy_from_user(&cdata,
 			(void *)argp,
 			sizeof(struct msm_actuator_cfg_data))) {
@@ -345,7 +299,7 @@
 		cdata.is_af_supported = 0;
 		rc = 0;
 
-		if (p_mctl->act_sdev) {
+		if (p_mctl->actctrl->a_config) {
 			struct msm_camera_sensor_info *sdata;
 
 			sdata = p_mctl->sdata;
@@ -373,9 +327,8 @@
 
 	case MSM_CAM_IOCTL_ACTUATOR_IO_CFG: {
 		struct msm_actuator_cfg_data act_data;
-		if (p_mctl->act_sdev) {
-			rc = v4l2_subdev_call(p_mctl->act_sdev,
-				core, ioctl, VIDIOC_MSM_ACTUATOR_CFG, argp);
+		if (p_mctl->actctrl->a_config) {
+			rc = p_mctl->actctrl->a_config(argp);
 		} else {
 			rc = copy_from_user(
 				&act_data,
@@ -397,32 +350,6 @@
 		break;
 	}
 
-	case MSM_CAM_IOCTL_EEPROM_IO_CFG: {
-		struct msm_eeprom_cfg_data eeprom_data;
-		if (p_mctl->eeprom_sdev) {
-			rc = v4l2_subdev_call(p_mctl->eeprom_sdev,
-				core, ioctl, VIDIOC_MSM_EEPROM_CFG, argp);
-		} else {
-			rc = copy_from_user(
-				&eeprom_data,
-				(void *)argp,
-				sizeof(struct msm_eeprom_cfg_data));
-			if (rc != 0) {
-				rc = -EFAULT;
-				break;
-			}
-			eeprom_data.is_eeprom_supported = 0;
-			rc = copy_to_user((void *)argp,
-					 &eeprom_data,
-					 sizeof(struct msm_eeprom_cfg_data));
-			if (rc != 0) {
-				rc = -EFAULT;
-				break;
-			}
-		}
-		break;
-	}
-
 	case MSM_CAM_IOCTL_GET_KERNEL_SYSTEM_TIME: {
 		struct timeval timestamp;
 		if (copy_from_user(&timestamp, argp, sizeof(timestamp))) {
@@ -442,18 +369,7 @@
 			ERR_COPY_FROM_USER();
 			rc = -EFAULT;
 		} else {
-			if (msm_sensor_state_check(p_mctl))
-				rc = msm_flash_ctrl(p_mctl->sdata, &flash_info);
-		}
-		break;
-	}
-	case MSM_CAM_IOCTL_INTF_MCTL_MAPPING_CFG: {
-		struct intf_mctl_mapping_cfg intf_map;
-		if (copy_from_user(&intf_map, argp, sizeof(intf_map))) {
-			ERR_COPY_FROM_USER();
-			rc = -EFAULT;
-		} else {
-			rc = msm_mctl_add_intf_to_mctl_map(p_mctl, &intf_map);
+			rc = msm_flash_ctrl(p_mctl->sdata, &flash_info);
 		}
 		break;
 	}
@@ -485,75 +401,31 @@
 		rc = msm_mctl_pp_mctl_divert_done(p_mctl,
 			(void __user *)arg);
 		break;
-			/* ISFIF config*/
+			
 	case MSM_CAM_IOCTL_AXI_CONFIG:
-		if (p_mctl->axi_sdev) {
-			v4l2_set_subdev_hostdata(p_mctl->axi_sdev, p_mctl);
+		if (p_mctl->axi_sdev)
 			rc = v4l2_subdev_call(p_mctl->axi_sdev, core, ioctl,
 				VIDIOC_MSM_AXI_CFG, (void __user *)arg);
-		} else
-			rc = p_mctl->isp_config(p_mctl, cmd, arg);
+		else
+			rc = p_mctl->isp_sdev->isp_config(p_mctl, cmd, arg);
 		break;
-	case MSM_CAM_IOCTL_ISPIF_IO_CFG:
-		rc = v4l2_subdev_call(p_mctl->ispif_sdev,
-			core, ioctl, VIDIOC_MSM_ISPIF_CFG, argp);
-		break;
-
-	case MSM_CAM_IOCTL_CSIPHY_IO_CFG:
-		if (p_mctl->csiphy_sdev)
-			rc = v4l2_subdev_call(p_mctl->csiphy_sdev,
-				core, ioctl, VIDIOC_MSM_CSIPHY_CFG, argp);
-		break;
-
-	case MSM_CAM_IOCTL_CSIC_IO_CFG:
-		if (p_mctl->csic_sdev)
-			rc = v4l2_subdev_call(p_mctl->csic_sdev,
-				core, ioctl, VIDIOC_MSM_CSIC_CFG, argp);
-		break;
-
-	case MSM_CAM_IOCTL_CSID_IO_CFG:
-		if (p_mctl->csid_sdev)
-			rc = v4l2_subdev_call(p_mctl->csid_sdev,
-				core, ioctl, VIDIOC_MSM_CSID_CFG, argp);
-		break;
-
-	case MSM_CAM_IOCTL_AXI_INIT:
-		if (p_mctl->axi_sdev) {
-			v4l2_set_subdev_hostdata(p_mctl->axi_sdev, p_mctl);
-			rc = v4l2_subdev_call(p_mctl->axi_sdev, core, ioctl,
-				VIDIOC_MSM_AXI_INIT, (void __user *)arg);
-		}
-		break;
-
-	case MSM_CAM_IOCTL_AXI_RELEASE:
-		if (p_mctl->axi_sdev) {
-			v4l2_set_subdev_hostdata(p_mctl->axi_sdev, p_mctl);
-			rc = v4l2_subdev_call(p_mctl->axi_sdev, core, ioctl,
-				VIDIOC_MSM_AXI_RELEASE, NULL);
-		}
-		break;
-
-	case MSM_CAM_IOCTL_AXI_LOW_POWER_MODE:
-		if (p_mctl->axi_sdev) {
-			v4l2_set_subdev_hostdata(p_mctl->axi_sdev, p_mctl);
-			rc = v4l2_subdev_call(p_mctl->axi_sdev, core, ioctl,
-				VIDIOC_MSM_AXI_LOW_POWER_MODE,
-				(void __user *)arg);
+			
+	case MSM_CAM_IOCTL_SET_PERF_LOCK: {
+		int perf_lock_enable;
+		if (copy_from_user(&perf_lock_enable, argp, sizeof(perf_lock_enable))) {
+			ERR_COPY_FROM_USER();
+			rc = -EFAULT;
 		} else {
-			rc = 0;
+			rc = msm_set_perf_lock(p_mctl, perf_lock_enable);
 		}
 		break;
+	}
 
 	default:
-		if(p_mctl && p_mctl->isp_config) {
-			/* ISP config*/
-			D("%s:%d: go to default. Calling msm_isp_config\n",
-				__func__, __LINE__);
-			rc = p_mctl->isp_config(p_mctl, cmd, arg);
-		} else {
-			rc = -EINVAL;
-			pr_err("%s: media controller is null\n", __func__);
-		}
+		
+		D("%s:%d: go to default. Calling msm_isp_config\n",
+			__func__, __LINE__);
+		rc = p_mctl->isp_sdev->isp_config(p_mctl, cmd, arg);
 		break;
 	}
 	D("%s: !!! cmd = %d, rc = %d\n",
@@ -561,136 +433,428 @@
 	return rc;
 }
 
+static int msm_mctl_subdev_match_core(struct device *dev, void *data)
+{
+	int core_index = (int)data;
+	struct platform_device *pdev = to_platform_device(dev);
+
+	if (pdev->id == core_index)
+		return 1;
+	else
+		return 0;
+}
+
+static int msm_mctl_register_subdevs(struct msm_cam_media_controller *p_mctl,
+	int core_index)
+{
+	struct device_driver *driver;
+	struct device *dev;
+	int rc = -ENODEV;
+
+	struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(p_mctl->sensor_sdev);
+	struct msm_camera_sensor_info *sinfo =
+		(struct msm_camera_sensor_info *) s_ctrl->sensordata;
+	struct msm_camera_device_platform_data *pdata = sinfo->pdata;
+
+	if (pdata->is_csiphy) {
+		
+		driver = driver_find(MSM_CSIPHY_DRV_NAME, &platform_bus_type);
+		if (!driver)
+			goto out;
+
+		dev = driver_find_device(driver, NULL, (void *)core_index,
+				msm_mctl_subdev_match_core);
+		if (!dev)
+			goto out;
+
+		p_mctl->csiphy_sdev = dev_get_drvdata(dev);
+	}
+
+	if (pdata->is_csic) {
+		
+		driver = driver_find(MSM_CSIC_DRV_NAME, &platform_bus_type);
+		if (!driver)
+			goto out;
+
+		dev = driver_find_device(driver, NULL, (void *)core_index,
+				msm_mctl_subdev_match_core);
+		if (!dev)
+			goto out;
+
+		p_mctl->csic_sdev = dev_get_drvdata(dev);
+	}
+
+	if (pdata->is_csid) {
+		
+		driver = driver_find(MSM_CSID_DRV_NAME, &platform_bus_type);
+		if (!driver)
+			goto out;
+
+		dev = driver_find_device(driver, NULL, (void *)core_index,
+				msm_mctl_subdev_match_core);
+		if (!dev)
+			goto out;
+
+		p_mctl->csid_sdev = dev_get_drvdata(dev);
+	}
+
+	if (pdata->is_ispif) {
+		
+		driver = driver_find(MSM_ISPIF_DRV_NAME, &platform_bus_type);
+		if (!driver)
+			goto out;
+
+		dev = driver_find_device(driver, NULL, 0,
+				msm_mctl_subdev_match_core);
+		if (!dev)
+			goto out;
+
+		p_mctl->ispif_sdev = dev_get_drvdata(dev);
+	}
+
+	
+	driver = driver_find(MSM_VFE_DRV_NAME, &platform_bus_type);
+	if (!driver)
+		goto out;
+
+	dev = driver_find_device(driver, NULL, 0,
+				msm_mctl_subdev_match_core);
+	if (!dev)
+		goto out;
+
+	p_mctl->isp_sdev->sd = dev_get_drvdata(dev);
+
+	if (pdata->is_vpe) {
+		
+		driver = driver_find(MSM_VPE_DRV_NAME, &platform_bus_type);
+		if (!driver)
+			goto out;
+
+		dev = driver_find_device(driver, NULL, 0,
+				msm_mctl_subdev_match_core);
+		if (!dev){pr_info("%s: driver_find_device \n", __func__);
+			goto out;}
+
+		p_mctl->vpe_sdev = dev_get_drvdata(dev);
+	}
+
+	rc = 0;
+
+#if 0		
+	
+	driver = driver_find(MSM_GEMINI_DRV_NAME, &platform_bus_type);
+	if (!driver) {
+		pr_err("%s:%d:Gemini: Failure: goto out\n",
+			__func__, __LINE__);
+		goto out;
+	}
+	pr_debug("%s:%d:Gemini: driver_find_device Gemini driver 0x%x\n",
+		__func__, __LINE__, (uint32_t)driver);
+	dev = driver_find_device(driver, NULL, NULL,
+				msm_mctl_subdev_match_core);
+	if (!dev) {
+		pr_err("%s:%d:Gemini: Failure goto out_put_driver\n",
+			__func__, __LINE__);
+		goto out_put_driver;
+	}
+	p_mctl->gemini_sdev = dev_get_drvdata(dev);
+	pr_debug("%s:%d:Gemini: After dev_get_drvdata gemini_sdev=0x%x\n",
+		__func__, __LINE__, (uint32_t)p_mctl->gemini_sdev);
+
+	if (p_mctl->gemini_sdev == NULL) {
+		pr_err("%s:%d:Gemini: Failure gemini_sdev is null\n",
+			__func__, __LINE__);
+		goto out_put_driver;
+	}
+	rc = 0;
+#endif 
+
+out:
+	return rc;
+}
+
 static int msm_mctl_open(struct msm_cam_media_controller *p_mctl,
 				 const char *const apps_id)
 {
 	int rc = 0;
-	struct msm_sensor_ctrl_t *s_ctrl;
-	struct msm_camera_sensor_info *sinfo;
-	struct msm_camera_device_platform_data *camdev;
+	struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(p_mctl->sensor_sdev);
+	struct msm_camera_sensor_info *sinfo =
+		(struct msm_camera_sensor_info *) s_ctrl->sensordata;
+	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
 	uint8_t csid_core;
 	D("%s\n", __func__);
 	if (!p_mctl) {
 		pr_err("%s: param is NULL", __func__);
 		return -EINVAL;
 	}
-	s_ctrl = get_sctrl(p_mctl->sensor_sdev);
-	sinfo = (struct msm_camera_sensor_info *) s_ctrl->sensordata;
-	camdev = sinfo->pdata;
+
 	mutex_lock(&p_mctl->lock);
-	/* open sub devices - once only*/
+	
 	if (!p_mctl->opencnt) {
-		struct msm_sensor_csi_info csi_info;
-		wake_lock(&p_mctl->wake_lock);
+		uint32_t csid_version;
+		wake_lock(&p_mctl->wake_lock_suspend);
+		
+		
 
 		csid_core = camdev->csid_core;
-		rc = msm_mctl_find_sensor_subdevs(p_mctl, csid_core);
+		rc = msm_mctl_register_subdevs(p_mctl, csid_core);
 		if (rc < 0) {
-			pr_err("%s: msm_mctl_find_sensor_subdevs failed:%d\n",
+			pr_err("%s: msm_mctl_register_subdevs failed:%d\n",
 				__func__, rc);
 			goto register_sdev_failed;
 		}
 
-		/* then sensor - move sub dev later */
+		if (camdev->is_csiphy) {
+			rc = v4l2_subdev_call(p_mctl->csiphy_sdev, core, ioctl,
+				VIDIOC_MSM_CSIPHY_INIT, NULL);
+			if (rc < 0) {
+				pr_err("%s: csiphy initialization failed %d\n",
+					__func__, rc);
+				goto csiphy_init_failed;
+			}
+		}
+
+		if (camdev->is_csid) {
+			rc = v4l2_subdev_call(p_mctl->csid_sdev, core, ioctl,
+				VIDIOC_MSM_CSID_INIT, &csid_version);
+			if (rc < 0) {
+				pr_err("%s: csid initialization failed %d\n",
+					__func__, rc);
+				goto csid_init_failed;
+			}
+		}
+		if (camdev->is_csic) {
+			rc = v4l2_subdev_call(p_mctl->csic_sdev, core, ioctl,
+				VIDIOC_MSM_CSIC_INIT, &csid_version);
+			if (rc < 0) {
+				pr_err("%s: csic initialization failed %d\n",
+					__func__, rc);
+				goto csic_init_failed;
+			}
+		}
+
+		
+		if (p_mctl->isp_sdev && p_mctl->isp_sdev->isp_open) {
+			rc = p_mctl->isp_sdev->isp_open(
+				p_mctl->isp_sdev->sd, p_mctl);
+	
+			if (rc < 0) {
+				pr_err("%s: isp init failed: %d\n",
+					__func__, rc);
+				goto isp_open_failed;
+			}
+		}
+
+		if (p_mctl->axi_sdev) {
+			rc = v4l2_subdev_call(p_mctl->axi_sdev, core, ioctl,
+				VIDIOC_MSM_AXI_INIT, p_mctl);
+			if (rc < 0) {
+				pr_err("%s: axi initialization failed %d\n",
+					__func__, rc);
+				goto axi_init_failed;
+			}
+		}
+		if (camdev->is_vpe) {
+			rc = v4l2_subdev_call(p_mctl->vpe_sdev, core, ioctl,
+				VIDIOC_MSM_VPE_INIT, p_mctl);
+			if (rc < 0) {
+				pr_err("%s: vpe initialization failed %d\n",
+				__func__, rc);
+				goto vpe_init_failed;
+			}
+		}
+
+
+		if (camdev->is_ispif) {
+			rc = v4l2_subdev_call(p_mctl->ispif_sdev, core, ioctl,
+				VIDIOC_MSM_ISPIF_INIT, &csid_version);
+			if (rc < 0) {
+				pr_err("%s: ispif initialization failed %d\n",
+					__func__, rc);
+				goto ispif_init_failed;
+			}
+		}
+
+#if 1	
+
+		rc = msm_camio_probe_on(s_ctrl);
+		if (rc)
+			pr_info("%s msm_camio_probe_on rc(%d)\n", __func__, rc);
+
+		if (p_mctl->sdata->use_rawchip) {
+#ifdef CONFIG_RAWCHIP
+			rc = rawchip_open_init();
+			if (rc < 0) {
+				goto sensor_sdev_failed;
+			}
+#endif
+		}
+#endif 
+
+		
 		rc = v4l2_subdev_call(p_mctl->sensor_sdev, core, s_power, 1);
+
 		if (rc < 0) {
 			pr_err("%s: sensor powerup failed: %d\n", __func__, rc);
 			goto sensor_sdev_failed;
 		}
 
-		if (p_mctl->act_sdev)
-			rc = v4l2_subdev_call(p_mctl->act_sdev,
-				core, s_power, 1);
+#if 1		
+		msm_sensor_match_id(s_ctrl);
+#endif 
+
+		
+		if (p_mctl->actctrl->a_init_table)
+			rc = p_mctl->actctrl->a_init_table();
+
+		if (rc < 0) {
+			pr_err("%s: act init failed: %d\n", __func__, rc);
+			goto act_power_up_failed;
+		}
+		
+
+		if (p_mctl->actctrl->a_power_up)
+			rc = p_mctl->actctrl->a_power_up(
+				p_mctl->sdata->actuator_info);
+
 		if (rc < 0) {
 			pr_err("%s: act power failed:%d\n", __func__, rc);
 			goto act_power_up_failed;
 		}
 
-		if (p_mctl->csic_sdev)
-			csi_info.is_csic = 1;
-		else
-			csi_info.is_csic = 0;
-		rc = v4l2_subdev_call(p_mctl->sensor_sdev, core, ioctl,
-				VIDIOC_MSM_SENSOR_CSID_INFO, &csi_info);
-		if (rc < 0) {
-			pr_err("%s: sensor csi version failed %d\n",
-			__func__, rc);
-			goto msm_csi_version;
+		if (camdev->is_ispif) {
+			pm_qos_add_request(&p_mctl->pm_qos_req_list,
+				PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);
+			pm_qos_update_request(&p_mctl->pm_qos_req_list,
+				MSM_V4L2_SWFI_LATENCY);
 		}
-
-		pm_qos_add_request(&p_mctl->pm_qos_req_list,
-			PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);
-		pm_qos_update_request(&p_mctl->pm_qos_req_list,
-			MSM_V4L2_SWFI_LATENCY);
-
 		p_mctl->apps_id = apps_id;
 		p_mctl->opencnt++;
+		
 	} else {
 		D("%s: camera is already open", __func__);
 	}
 	mutex_unlock(&p_mctl->lock);
+
 	return rc;
 
-msm_csi_version:
 act_power_up_failed:
 	if (v4l2_subdev_call(p_mctl->sensor_sdev, core, s_power, 0) < 0)
 		pr_err("%s: sensor powerdown failed: %d\n", __func__, rc);
 sensor_sdev_failed:
+	if (camdev->is_ispif)
+		if (v4l2_subdev_call(p_mctl->ispif_sdev, core, ioctl,
+			VIDIOC_MSM_ISPIF_RELEASE, NULL) < 0)
+			pr_err("%s: ispif release failed %d\n", __func__, rc);
+ispif_init_failed:
+	if (camdev->is_vpe)
+		if (v4l2_subdev_call(p_mctl->vpe_sdev, core, ioctl,
+			VIDIOC_MSM_VPE_RELEASE, NULL) < 0)
+			pr_err("%s: vpe release failed %d\n", __func__, rc);
+vpe_init_failed:
+	if (p_mctl->axi_sdev)
+		if (v4l2_subdev_call(p_mctl->axi_sdev, core, ioctl,
+			VIDIOC_MSM_AXI_RELEASE, NULL) < 0)
+			pr_err("%s: axi release failed %d\n", __func__, rc);
+axi_init_failed:
+	if (p_mctl->isp_sdev && p_mctl->isp_sdev->isp_release)
+		p_mctl->isp_sdev->isp_release(p_mctl, p_mctl->isp_sdev->sd);
+isp_open_failed:
+	if (camdev->is_csic)
+		if (v4l2_subdev_call(p_mctl->csic_sdev, core, ioctl,
+			VIDIOC_MSM_CSIC_RELEASE, NULL) < 0)
+			pr_err("%s: csic release failed %d\n", __func__, rc);
+csic_init_failed:
+	if (camdev->is_csid)
+		if (v4l2_subdev_call(p_mctl->csid_sdev, core, ioctl,
+			VIDIOC_MSM_CSID_RELEASE, NULL) < 0)
+			pr_err("%s: csid release failed %d\n", __func__, rc);
+csid_init_failed:
+	if (camdev->is_csiphy)
+		if (v4l2_subdev_call(p_mctl->csiphy_sdev, core, ioctl,
+			VIDIOC_MSM_CSIPHY_RELEASE, NULL) < 0)
+			pr_err("%s: csiphy release failed %d\n", __func__, rc);
+csiphy_init_failed:
 register_sdev_failed:
-	wake_unlock(&p_mctl->wake_lock);
+	wake_unlock(&p_mctl->wake_lock_suspend);
+
 	mutex_unlock(&p_mctl->lock);
 	return rc;
 }
 
-static void msm_mctl_release(struct msm_cam_media_controller *p_mctl)
+static int msm_mctl_release(struct msm_cam_media_controller *p_mctl)
 {
+	int rc = 0;
 	struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(p_mctl->sensor_sdev);
 	struct msm_camera_sensor_info *sinfo =
 		(struct msm_camera_sensor_info *) s_ctrl->sensordata;
+	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
+
+#if 0 
 	v4l2_subdev_call(p_mctl->sensor_sdev, core, ioctl,
 		VIDIOC_MSM_SENSOR_RELEASE, NULL);
-
-	if (p_mctl->csic_sdev) {
-		v4l2_subdev_call(p_mctl->csic_sdev, core, ioctl,
-			VIDIOC_MSM_CSIC_RELEASE, NULL);
+#endif
+	if (camdev->is_ispif) {
+		v4l2_subdev_call(p_mctl->ispif_sdev, core, ioctl,
+			VIDIOC_MSM_ISPIF_RELEASE, NULL);
 	}
-
-	if (p_mctl->vpe_sdev) {
+	if (camdev->is_vpe) {
 		v4l2_subdev_call(p_mctl->vpe_sdev, core, ioctl,
 			VIDIOC_MSM_VPE_RELEASE, NULL);
 	}
-
 	if (p_mctl->axi_sdev) {
-		v4l2_set_subdev_hostdata(p_mctl->axi_sdev, p_mctl);
 		v4l2_subdev_call(p_mctl->axi_sdev, core, ioctl,
 			VIDIOC_MSM_AXI_RELEASE, NULL);
 	}
 
-	if (p_mctl->csiphy_sdev) {
-		v4l2_subdev_call(p_mctl->csiphy_sdev, core, ioctl,
-			VIDIOC_MSM_CSIPHY_RELEASE,
-			sinfo->sensor_platform_info->csi_lane_params);
-	}
 
-	if (p_mctl->csid_sdev) {
+	if (p_mctl->isp_sdev && p_mctl->isp_sdev->isp_release)
+		p_mctl->isp_sdev->isp_release(p_mctl,
+			p_mctl->isp_sdev->sd);
+
+	if (camdev->is_csid) {
 		v4l2_subdev_call(p_mctl->csid_sdev, core, ioctl,
 			VIDIOC_MSM_CSID_RELEASE, NULL);
 	}
 
-	if (p_mctl->act_sdev) {
-		v4l2_subdev_call(p_mctl->act_sdev, core, s_power, 0);
-		p_mctl->act_sdev = NULL;
+	if (camdev->is_csic) {
+		v4l2_subdev_call(p_mctl->csic_sdev, core, ioctl,
+			VIDIOC_MSM_CSIC_RELEASE, NULL);
 	}
 
+	if (camdev->is_csiphy) {
+		v4l2_subdev_call(p_mctl->csiphy_sdev, core, ioctl,
+			VIDIOC_MSM_CSIPHY_RELEASE, NULL);
+	}
+
+	if (p_mctl->actctrl->a_power_down)
+		p_mctl->actctrl->a_power_down(
+			p_mctl->sdata->actuator_info);
+	
+	if (p_mctl->sdata->use_rawchip) {
+#ifdef CONFIG_RAWCHIP
+		rawchip_release();
+#endif
+	}
+	
+	rc = msm_camio_probe_off(s_ctrl);
+	if (rc)
+		pr_info("%s msm_camio_probe_off rc(%d)\n", __func__, rc);
+	
+
 	v4l2_subdev_call(p_mctl->sensor_sdev, core, s_power, 0);
-
-	v4l2_subdev_call(p_mctl->ispif_sdev,
-			core, ioctl, VIDIOC_MSM_ISPIF_REL, NULL);
-	pm_qos_update_request(&p_mctl->pm_qos_req_list,
+	if (camdev->is_ispif) {
+		pm_qos_update_request(&p_mctl->pm_qos_req_list,
 				PM_QOS_DEFAULT_VALUE);
-	pm_qos_remove_request(&p_mctl->pm_qos_req_list);
+		pm_qos_remove_request(&p_mctl->pm_qos_req_list);
+	}
 
-	wake_unlock(&p_mctl->wake_lock);
+	(void)msm_set_perf_lock(p_mctl, 0);
+
+	
+	
+	wake_unlock(&p_mctl->wake_lock_suspend);
+	return rc;
 }
 
 int msm_mctl_init_user_formats(struct msm_cam_v4l2_device *pcam)
@@ -716,7 +880,7 @@
 	if (!pcam->usr_fmts)
 		return -ENOMEM;
 
-	/* from sensor to ISP.. fill the data structure */
+	
 	for (i = 0; i < numfmt_sensor; i++) {
 		rc = v4l2_subdev_call(sd, video, enum_mbus_fmt, i, &pxlcode);
 		D("rc is  %d\n", rc);
@@ -726,7 +890,7 @@
 		}
 
 		for (j = 0; j < ARRAY_SIZE(msm_isp_formats); j++) {
-			/* find the corresponding format */
+			
 			if (pxlcode == msm_isp_formats[j].pxlcode) {
 				pcam->usr_fmts[numfmt] = msm_isp_formats[j];
 				D("pcam->usr_fmts=0x%x\n", (u32)pcam->usr_fmts);
@@ -747,12 +911,9 @@
 	}
 
 	D("Found %d supported formats.\n", pcam->num_fmts);
-	/* set the default pxlcode, in any case, it will be set through
-	 * setfmt */
 	return 0;
 }
 
-/* this function plug in the implementation of a v4l2_subdev */
 int msm_mctl_init(struct msm_cam_v4l2_device *pcam)
 {
 	struct msm_cam_media_controller *pmctl = NULL;
@@ -761,46 +922,40 @@
 		pr_err("%s: param is NULL", __func__);
 		return -EINVAL;
 	}
-	pcam->mctl_handle = msm_cam_server_get_mctl_handle();
+	pcam->mctl_handle = msm_camera_get_mctl_handle();
 	if (pcam->mctl_handle == 0) {
 		pr_err("%s: cannot get mctl handle", __func__);
 		return -EINVAL;
 	}
 
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
 	if (!pmctl) {
 		pr_err("%s: invalid mctl controller", __func__);
 		return -EINVAL;
 	}
-
-	wake_lock_init(&pmctl->wake_lock, WAKE_LOCK_SUSPEND, "msm_camera");
+	wake_lock_init(&pmctl->wake_lock_suspend, WAKE_LOCK_SUSPEND, "msm_camera_suspend");
+	
+	
 	mutex_init(&pmctl->lock);
 	pmctl->opencnt = 0;
 
-	/* init module operations*/
+	
 	pmctl->mctl_open = msm_mctl_open;
 	pmctl->mctl_cmd = msm_mctl_cmd;
 	pmctl->mctl_release = msm_mctl_release;
-	pmctl->isp_config = msm_isp_config;
-	pmctl->isp_notify = msm_isp_notify;
-
-	/* init mctl buf */
+	
 	msm_mctl_buf_init(pcam);
 	memset(&pmctl->pp_info, 0, sizeof(pmctl->pp_info));
 	pmctl->vfe_output_mode = 0;
 	spin_lock_init(&pmctl->pp_info.lock);
-
 	pmctl->act_sdev = pcam->act_sdev;
-	pmctl->eeprom_sdev = pcam->eeprom_sdev;
+	pmctl->actctrl = &pcam->actctrl;
 	pmctl->sensor_sdev = pcam->sensor_sdev;
 	pmctl->sdata = pcam->sdata;
-	v4l2_set_subdev_hostdata(pcam->sensor_sdev, pmctl);
 
 #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	if (!pmctl->client) {
-		pmctl->client = msm_ion_client_create(-1, "camera");
-		kref_init(&pmctl->refcount);
-	}
+	pmctl->client = msm_ion_client_create(-1, "camera");
+	kref_init(&pmctl->refcount);
 #endif
 
 	return 0;
@@ -812,28 +967,27 @@
 	struct msm_cam_media_controller *pmctl = NULL;
 	D("%s\n", __func__);
 
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
 	if (!pmctl) {
 		pr_err("%s: invalid mctl controller", __func__);
 		return -EINVAL;
 	}
 
 	mutex_destroy(&pmctl->lock);
-	wake_lock_destroy(&pmctl->wake_lock);
-	/*clear out mctl fields*/
-	memset(pmctl, 0, sizeof(struct msm_cam_media_controller));
-	msm_cam_server_free_mctl(pcam->mctl_handle);
+	
+	
+	wake_lock_destroy(&pmctl->wake_lock_suspend);
+	msm_camera_free_mctl(pcam->mctl_handle);
 	return rc;
 }
-
-/* mctl node v4l2_file_operations */
 static int msm_mctl_dev_open(struct file *f)
 {
 	int rc = -EINVAL, i;
-	/* get the video device */
+	
 	struct msm_cam_v4l2_device *pcam  = NULL;
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	struct msm_cam_media_controller *pmctl;
+	D("%s : E ", __func__);
 
 	if (f == NULL) {
 		pr_err("%s :: cannot open video driver data", __func__);
@@ -845,14 +999,13 @@
 		pr_err("%s NULL pointer passed in!\n", __func__);
 		return rc;
 	}
-
 	D("%s : E use_count %d", __func__, pcam->mctl_node.use_count);
 	mutex_lock(&pcam->mctl_node.dev_lock);
 	for (i = 0; i < MSM_DEV_INST_MAX; i++) {
 		if (pcam->mctl_node.dev_inst[i] == NULL)
 			break;
 	}
-	/* if no instance is available, return error */
+	
 	if (i == MSM_DEV_INST_MAX) {
 		mutex_unlock(&pcam->mctl_node.dev_lock);
 		return rc;
@@ -871,6 +1024,7 @@
 
 	D("%s pcam_inst %p my_index = %d\n", __func__,
 		pcam_inst, pcam_inst->my_index);
+
 	rc = msm_cam_server_open_mctl_session(pcam,
 		&pcam->mctl_node.active);
 	if (rc < 0) {
@@ -879,24 +1033,27 @@
 		return rc;
 	}
 
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
 	if (!pmctl) {
 		pr_err("%s mctl NULL!\n", __func__);
 		return rc;
 	}
 
-	D("%s active %d\n", __func__, pcam->mctl_node.active);
-	msm_setup_v4l2_event_queue(&pcam_inst->eventHandle,
-			pcam->mctl_node.pvdev);
-
+	D("%s active %d\n", __func__, pcam->mctl_node.active);		
+	rc = msm_setup_v4l2_event_queue(&pcam_inst->eventHandle,
+					pcam->mctl_node.pvdev);
+	if (rc < 0) {
+		mutex_unlock(&pcam->mctl_node.dev_lock);
+		return rc;
+	}
 	pcam_inst->vbqueue_initialized = 0;
 	kref_get(&pmctl->refcount);
 	f->private_data = &pcam_inst->eventHandle;
 
 	D("f->private_data = 0x%x, pcam = 0x%x\n",
 		(u32)f->private_data, (u32)pcam_inst);
-
 	pcam->mctl_node.use_count++;
+
 	mutex_unlock(&pcam->mctl_node.dev_lock);
 	D("%s : X ", __func__);
 	return rc;
@@ -918,7 +1075,7 @@
 		return -EINVAL;
 	}
 
-	poll_wait(f, &(pcam_inst->eventHandle.wait), wait);
+	poll_wait(f, &(pcam_inst->eventHandle.events->wait), wait);
 	if (v4l2_event_pending(&pcam_inst->eventHandle)) {
 		rc |= POLLPRI;
 		D("%s Event available on mctl node ", __func__);
@@ -951,10 +1108,9 @@
 		pr_err("%s NULL pointer of camera device!\n", __func__);
 		return -EINVAL;
 	}
-
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
 	mutex_lock(&pcam->mctl_node.dev_lock);
-	mutex_lock(&pcam_inst->inst_lock);
+
 	D("%s : active %d ", __func__, pcam->mctl_node.active);
 	if (pcam->mctl_node.active == 1) {
 		rc = msm_cam_server_close_mctl_session(pcam);
@@ -965,28 +1121,25 @@
 			return rc;
 		}
 		pmctl = NULL;
-	}
+	}	
 	pcam_inst->streamon = 0;
-	pcam->mctl_node.use_count--;
 	pcam->mctl_node.dev_inst_map[pcam_inst->image_mode] = NULL;
 	if (pcam_inst->vbqueue_initialized)
 		vb2_queue_release(&pcam_inst->vid_bufq);
 	D("%s Closing down instance %p ", __func__, pcam_inst);
 	pcam->mctl_node.dev_inst[pcam_inst->my_index] = NULL;
-	msm_destroy_v4l2_event_queue(&pcam_inst->eventHandle);
-	CLR_MCTLPP_INST_IDX(pcam_inst->inst_handle);
-	CLR_DEVID_MODE(pcam_inst->inst_handle);
-	CLR_IMG_MODE(pcam_inst->inst_handle);
-	mutex_unlock(&pcam_inst->inst_lock);
+	v4l2_fh_del(&pcam_inst->eventHandle);
+	v4l2_fh_exit(&pcam_inst->eventHandle);
 	mutex_destroy(&pcam_inst->inst_lock);
 
 	kfree(pcam_inst);
-	f->private_data = NULL;
 	if (NULL != pmctl) {
 		D("%s : release ion client", __func__);
 		kref_put(&pmctl->refcount, msm_release_ion_client);
 	}
+	f->private_data = NULL;
 	mutex_unlock(&pcam->mctl_node.dev_lock);
+	pcam->mctl_node.use_count--;
 	D("%s : use_count %d X ", __func__, pcam->mctl_node.use_count);
 	return rc;
 }
@@ -999,11 +1152,6 @@
 	.unlocked_ioctl = video_ioctl2,
 };
 
-/*
- *
- * implementation of mctl node v4l2_ioctl_ops
- *
- */
 static int msm_mctl_v4l2_querycap(struct file *f, void *pctx,
 				struct v4l2_capability *pcaps)
 {
@@ -1026,7 +1174,6 @@
 
 	strlcpy(pcaps->driver, pcam->media_dev.dev->driver->name,
 			sizeof(pcaps->driver));
-	pcaps->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
 	return 0;
 }
 
@@ -1073,7 +1220,7 @@
 					__func__, pcam_inst);
 			rc = -EFAULT;
 		}
-		D("%s inst %p got plane info: num_planes = %d," \
+		D("%s inst %p got plane info: num_planes = %d,"
 				"plane size = %ld %ld ", __func__, pcam_inst,
 				pcam_inst->plane_info.num_planes,
 				pcam_inst->plane_info.plane[0].size,
@@ -1091,25 +1238,12 @@
 {
 	int rc = 0, i, j;
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	struct msm_cam_media_controller *pmctl;
-	struct msm_cam_v4l2_device *pcam = video_drvdata(f);
 	pcam_inst = container_of(f->private_data,
 		struct msm_cam_v4l2_dev_inst, eventHandle);
 	D("%s\n", __func__);
 	WARN_ON(pctx != f->private_data);
 
 	mutex_lock(&pcam_inst->inst_lock);
-	if (!pcam_inst->vbqueue_initialized && pb->count) {
-		pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-		if (pmctl == NULL) {
-			pr_err("%s Invalid mctl ptr", __func__);
-			mutex_unlock(&pcam_inst->inst_lock);
-			return -EINVAL;
-		}
-		pmctl->mctl_vbqueue_init(pcam_inst, &pcam_inst->vid_bufq,
-			pb->type);
-		pcam_inst->vbqueue_initialized = 1;
-	}
 	rc = vb2_reqbufs(&pcam_inst->vid_bufq, pb);
 	if (rc < 0) {
 		pr_err("%s reqbufs failed %d ", __func__, rc);
@@ -1117,17 +1251,13 @@
 		return rc;
 	}
 	if (!pb->count) {
-		/* Deallocation. free buf_offset array */
+		
 		D("%s Inst %p freeing buffer offsets array",
 			__func__, pcam_inst);
-		for (j = 0 ; j < pcam_inst->buf_count ; j++) {
+		for (j = 0 ; j < pcam_inst->buf_count ; j++)
 			kfree(pcam_inst->buf_offset[j]);
-			pcam_inst->buf_offset[j] = NULL;
-		}
 		kfree(pcam_inst->buf_offset);
 		pcam_inst->buf_offset = NULL;
-		/* If the userspace has deallocated all the
-		 * buffers, then release the vb2 queue */
 		if (pcam_inst->vbqueue_initialized) {
 			vb2_queue_release(&pcam_inst->vid_bufq);
 			pcam_inst->vbqueue_initialized = 0;
@@ -1135,7 +1265,7 @@
 	} else {
 		D("%s Inst %p Allocating buf_offset array",
 			__func__, pcam_inst);
-		/* Allocation. allocate buf_offset array */
+		
 		pcam_inst->buf_offset = (struct msm_cam_buf_offset **)
 			kzalloc(pb->count * sizeof(struct msm_cam_buf_offset *),
 							GFP_KERNEL);
@@ -1150,10 +1280,8 @@
 				pcam_inst->plane_info.num_planes, GFP_KERNEL);
 			if (!pcam_inst->buf_offset[i]) {
 				pr_err("%s out of memory ", __func__);
-				for (j = i-1 ; j >= 0; j--) {
+				for (j = i-1 ; j >= 0; j--)
 					kfree(pcam_inst->buf_offset[j]);
-					pcam_inst->buf_offset[j] = NULL;
-				}
 				kfree(pcam_inst->buf_offset);
 				pcam_inst->buf_offset = NULL;
 				mutex_unlock(&pcam_inst->inst_lock);
@@ -1171,7 +1299,7 @@
 static int msm_mctl_v4l2_querybuf(struct file *f, void *pctx,
 					struct v4l2_buffer *pb)
 {
-	/* get the video device */
+	
 	int rc = 0;
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
@@ -1189,7 +1317,7 @@
 					struct v4l2_buffer *pb)
 {
 	int rc = 0, i = 0;
-	/* get the camera device */
+	
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
 		struct msm_cam_v4l2_dev_inst, eventHandle);
@@ -1205,7 +1333,7 @@
 	}
 
 	if (pb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
-		/* Reject the buffer if planes array was not allocated */
+		
 		if (pb->m.planes == NULL) {
 			pr_err("%s Planes array is null ", __func__);
 			mutex_unlock(&pcam_inst->inst_lock);
@@ -1241,8 +1369,8 @@
 static int msm_mctl_v4l2_dqbuf(struct file *f, void *pctx,
 					struct v4l2_buffer *pb)
 {
-	int rc = 0, i;
-	/* get the camera device */
+	int rc = 0;
+	
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
 		struct msm_cam_v4l2_dev_inst, eventHandle);
@@ -1258,26 +1386,6 @@
 	rc = vb2_dqbuf(&pcam_inst->vid_bufq, pb,  f->f_flags & O_NONBLOCK);
 	D("%s, videobuf_dqbuf returns %d\n", __func__, rc);
 
-	if (pb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
-		/* Reject the buffer if planes array was not allocated */
-		if (pb->m.planes == NULL) {
-			pr_err("%s Planes array is null\n", __func__);
-			mutex_unlock(&pcam_inst->inst_lock);
-			return -EINVAL;
-		}
-		for (i = 0; i < pcam_inst->plane_info.num_planes; i++) {
-			pb->m.planes[i].data_offset =
-				pcam_inst->buf_offset[pb->index][i].data_offset;
-			pb->m.planes[i].reserved[0] =
-				pcam_inst->buf_offset[pb->index][i].addr_offset;
-			D("%s update offsets for plane %d as A %d D %d\n",
-				__func__, i, pb->m.planes[i].reserved[0],
-				pb->m.planes[i].data_offset);
-		}
-	} else {
-		pb->reserved = pcam_inst->buf_offset[pb->index][0].addr_offset;
-		D("%s stored reserved info %d\n", __func__, pb->reserved);
-	}
 	mutex_unlock(&pcam_inst->inst_lock);
 	return rc;
 }
@@ -1286,7 +1394,7 @@
 					enum v4l2_buf_type buf_type)
 {
 	int rc = 0;
-	/* get the camera device */
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
@@ -1306,11 +1414,11 @@
 	}
 
 	D("%s Calling videobuf_streamon", __func__);
-	/* if HW streaming on is successful, start buffer streaming */
+	
 	rc = vb2_streamon(&pcam_inst->vid_bufq, buf_type);
 	D("%s, videobuf_streamon returns %d\n", __func__, rc);
 
-	/* turn HW (VFE/sensor) streaming */
+	
 	pcam_inst->streamon = 1;
 	mutex_unlock(&pcam_inst->inst_lock);
 	mutex_unlock(&pcam->mctl_node.dev_lock);
@@ -1322,7 +1430,7 @@
 					enum v4l2_buf_type buf_type)
 {
 	int rc = 0;
-	/* get the camera device */
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
@@ -1337,15 +1445,13 @@
 		return -EINVAL;
 	}
 
-	/* first turn of HW (VFE/sensor) streaming so that buffers are
-		not in use when we free the buffers */
 	mutex_lock(&pcam->mctl_node.dev_lock);
 	mutex_lock(&pcam_inst->inst_lock);
 	pcam_inst->streamon = 0;
 	if (rc < 0)
 		pr_err("%s: hw failed to stop streaming\n", __func__);
 
-	/* stop buffer streaming */
+	
 	rc = vb2_streamoff(&pcam_inst->vid_bufq, buf_type);
 	D("%s, videobuf_streamoff returns %d\n", __func__, rc);
 	mutex_unlock(&pcam_inst->inst_lock);
@@ -1356,7 +1462,7 @@
 static int msm_mctl_v4l2_enum_fmt_cap(struct file *f, void *pctx,
 					struct v4l2_fmtdesc *pfmtdesc)
 {
-	/* get the video device */
+	
 	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
 	const struct msm_isp_color_fmt *isp_fmt;
 
@@ -1410,9 +1516,6 @@
 	return rc;
 }
 
-/* This function will readjust the format parameters based in HW
-  capabilities. Called by s_fmt_cap
-*/
 static int msm_mctl_v4l2_try_fmt_cap(struct file *f, void *pctx,
 					struct v4l2_format *pfmt)
 {
@@ -1435,16 +1538,28 @@
 	return rc;
 }
 
-/* This function will reconfig the v4l2 driver and HW device, it should be
-   called after the streaming is stopped.
-*/
 static int msm_mctl_v4l2_s_fmt_cap(struct file *f, void *pctx,
 					struct v4l2_format *pfmt)
 {
 	int rc = 0;
+	
+	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
+	struct msm_cam_media_controller *pmctl;
+	struct msm_cam_v4l2_dev_inst *pcam_inst;
+	pcam_inst = container_of(f->private_data,
+		struct msm_cam_v4l2_dev_inst, eventHandle);
 
 	D("%s\n", __func__);
+	D("%s, inst=0x%x,idx=%d,priv = 0x%p\n",
+		__func__, (u32)pcam_inst, pcam_inst->my_index,
+		(void *)pfmt->fmt.pix.priv);
 	WARN_ON(pctx != f->private_data);
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+	if (!pcam_inst->vbqueue_initialized) {
+		pmctl->mctl_vbqueue_init(pcam_inst, &pcam_inst->vid_bufq,
+					V4L2_BUF_TYPE_VIDEO_CAPTURE);
+		pcam_inst->vbqueue_initialized = 1;
+	}
 
 	return rc;
 }
@@ -1454,13 +1569,21 @@
 {
 	int rc = 0, i;
 	struct msm_cam_v4l2_device *pcam = video_drvdata(f);
+	struct msm_cam_media_controller *pmctl;
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
 			struct msm_cam_v4l2_dev_inst, eventHandle);
 
-	D("%s Inst %p\n", __func__, pcam_inst);
+	D("%s Inst %p vbqueue %d\n", __func__,
+		pcam_inst, pcam_inst->vbqueue_initialized);
 	WARN_ON(pctx != f->private_data);
 
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+	if (!pcam_inst->vbqueue_initialized) {
+		pmctl->mctl_vbqueue_init(pcam_inst, &pcam_inst->vid_bufq,
+					V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
+		pcam_inst->vbqueue_initialized = 1;
+	}
 	for (i = 0; i < pcam->num_fmts; i++)
 		if (pcam->usr_fmts[i].fourcc == pfmt->fmt.pix_mp.pixelformat)
 			break;
@@ -1523,7 +1646,6 @@
 	return rc;
 }
 
-/* Stream type-dependent parameter ioctls */
 static int msm_mctl_v4l2_g_parm(struct file *f, void *pctx,
 				struct v4l2_streamparm *a)
 {
@@ -1540,12 +1662,8 @@
 		return OUTPUT_TYPE_S;
 	case MSM_V4L2_EXT_CAPTURE_MODE_VIDEO:
 		return OUTPUT_TYPE_V;
-	case MSM_V4L2_EXT_CAPTURE_MODE_RDI:
-		return OUTPUT_TYPE_R;
-	case MSM_V4L2_EXT_CAPTURE_MODE_RDI1:
-		return OUTPUT_TYPE_R1;
-	case MSM_V4L2_EXT_CAPTURE_MODE_RDI2:
-		return OUTPUT_TYPE_R2;
+	case MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT:
+	case MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW:
 	default:
 		return OUTPUT_TYPE_P;
 	}
@@ -1555,30 +1673,13 @@
 				struct v4l2_streamparm *a)
 {
 	int rc = 0;
-	int is_bayer_sensor = 0;
-	struct msm_cam_media_controller *pmctl = NULL;
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	pcam_inst = container_of(f->private_data,
 		struct msm_cam_v4l2_dev_inst, eventHandle);
-	pcam_inst->image_mode = (a->parm.capture.extendedmode & 0x7F);
-
-	pmctl = msm_cam_server_get_mctl(pcam_inst->pcam->mctl_handle);
-	if (!pmctl) {
-		pr_err("%s: invalid mctl controller", __func__);
-		return -EINVAL;
-	}
-	/* save msm_dev node idx for subdev notify lookup */
-	SET_DEVID_MODE(pcam_inst->inst_handle, pmctl->pcam_ptr->vnode_id);
-	SET_IMG_MODE(pcam_inst->inst_handle, pcam_inst->image_mode);
-	SET_MCTLPP_INST_IDX(pcam_inst->inst_handle, pcam_inst->my_index);
+	pcam_inst->image_mode = a->parm.capture.extendedmode;
 	pcam_inst->pcam->mctl_node.dev_inst_map[pcam_inst->image_mode] =
 		pcam_inst;
 	pcam_inst->path = msm_mctl_vidbuf_get_path(pcam_inst->image_mode);
-	if (pcam_inst->pcam->sdata->sensor_type == BAYER_SENSOR)
-		is_bayer_sensor = 1;
-	rc = msm_cam_server_config_interface_map(pcam_inst->image_mode,
-			pcam_inst->pcam->mctl_handle,
-			pcam_inst->pcam->vnode_id, is_bayer_sensor);
 	D("%s path=%d, image mode = %d rc=%d\n", __func__,
 		pcam_inst->path, pcam_inst->image_mode, rc);
 	return rc;
@@ -1597,7 +1698,7 @@
 
 	if (sub->type == V4L2_EVENT_ALL)
 		sub->type = V4L2_EVENT_PRIVATE_START+MSM_CAM_APP_NOTIFY_EVENT;
-	rc = v4l2_event_subscribe(fh, sub, 100);
+	rc = v4l2_event_subscribe(fh, sub);
 	if (rc < 0)
 		pr_err("%s: failed for evtType = 0x%x, rc = %d\n",
 						__func__, sub->type, rc);
@@ -1620,52 +1721,6 @@
 	return rc;
 }
 
-static int msm_mctl_v4l2_private_g_ctrl(struct file *f, void *pctx,
-	struct msm_camera_v4l2_ioctl_t *ioctl_ptr)
-{
-	int rc = -EINVAL;
-	struct msm_cam_v4l2_device *pcam  = video_drvdata(f);
-	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	pcam_inst = container_of(f->private_data,
-		struct msm_cam_v4l2_dev_inst, eventHandle);
-
-	WARN_ON(pctx != f->private_data);
-
-	mutex_lock(&pcam->mctl_node.dev_lock);
-	switch (ioctl_ptr->id) {
-	case MSM_V4L2_PID_INST_HANDLE:
-		COPY_TO_USER(rc, (void __user *)ioctl_ptr->ioctl_ptr,
-			(void *)&pcam_inst->inst_handle, sizeof(uint32_t));
-		if (rc)
-			ERR_COPY_TO_USER();
-		break;
-	default:
-		pr_err("%s Unsupported ioctl %d ", __func__, ioctl_ptr->id);
-		break;
-	}
-	mutex_unlock(&pcam->mctl_node.dev_lock);
-	return rc;
-}
-
-static long msm_mctl_v4l2_private_ioctl(struct file *file, void *fh,
-	  bool valid_prio, int cmd, void *arg)
-{
-	int rc = -EINVAL;
-	struct msm_camera_v4l2_ioctl_t *ioctl_ptr = arg;
-	D("%s: cmd %d\n", __func__, _IOC_NR(cmd));
-
-	switch (cmd) {
-	case MSM_CAM_V4L2_IOCTL_PRIVATE_G_CTRL:
-		rc = msm_mctl_v4l2_private_g_ctrl(file, fh, ioctl_ptr);
-		break;
-	default:
-		pr_err("%s Unsupported ioctl cmd %d ", __func__, cmd);
-		break;
-	}
-	return rc;
-}
-
-/* mctl node v4l2_ioctl_ops */
 static const struct v4l2_ioctl_ops g_msm_mctl_ioctl_ops = {
 	.vidioc_querycap = msm_mctl_v4l2_querycap,
 
@@ -1684,7 +1739,7 @@
 	.vidioc_streamon = msm_mctl_v4l2_streamon,
 	.vidioc_streamoff = msm_mctl_v4l2_streamoff,
 
-	/* format ioctls */
+	
 	.vidioc_enum_fmt_vid_cap = msm_mctl_v4l2_enum_fmt_cap,
 	.vidioc_enum_fmt_vid_cap_mplane = msm_mctl_v4l2_enum_fmt_cap,
 	.vidioc_try_fmt_vid_cap = msm_mctl_v4l2_try_fmt_cap,
@@ -1697,54 +1752,41 @@
 	.vidioc_g_jpegcomp = msm_mctl_v4l2_g_jpegcomp,
 	.vidioc_s_jpegcomp = msm_mctl_v4l2_s_jpegcomp,
 
-	/* Stream type-dependent parameter ioctls */
+	
 	.vidioc_g_parm =  msm_mctl_v4l2_g_parm,
 	.vidioc_s_parm =  msm_mctl_v4l2_s_parm,
 
-	/* event subscribe/unsubscribe */
+	
 	.vidioc_subscribe_event = msm_mctl_v4l2_subscribe_event,
 	.vidioc_unsubscribe_event = msm_mctl_v4l2_unsubscribe_event,
-	.vidioc_default = msm_mctl_v4l2_private_ioctl,
 };
 
 int msm_setup_mctl_node(struct msm_cam_v4l2_device *pcam)
 {
 	int rc = -EINVAL;
 	struct video_device *pvdev = NULL;
-	struct i2c_client *client = NULL;
-	struct platform_device *pdev = NULL;
+	struct i2c_client *client = v4l2_get_subdevdata(pcam->sensor_sdev);
+
 	D("%s\n", __func__);
 
-	/* first register the v4l2 device */
-	if (pcam->sensor_sdev->flags & V4L2_SUBDEV_FL_IS_I2C) {
-		client = v4l2_get_subdevdata(pcam->sensor_sdev);
-		pcam->mctl_node.v4l2_dev.dev = &client->dev;
-	} else {
-		pdev = v4l2_get_subdevdata(pcam->sensor_sdev);
-		pcam->mctl_node.v4l2_dev.dev = &pdev->dev;
-	}
-
-	/* first register the v4l2 device */
+	
+	pcam->mctl_node.v4l2_dev.dev = &client->dev;
 	rc = v4l2_device_register(pcam->mctl_node.v4l2_dev.dev,
 				&pcam->mctl_node.v4l2_dev);
 	if (rc < 0)
 		return -EINVAL;
-	/*	else
-			pcam->v4l2_dev.notify = msm_cam_v4l2_subdev_notify; */
 
-	/* now setup video device */
+	
 	pvdev = video_device_alloc();
 	if (pvdev == NULL) {
 		pr_err("%s: video_device_alloc failed\n", __func__);
 		return rc;
 	}
 
-	/* init video device's driver interface */
+	
 	D("sensor name = %s, sizeof(pvdev->name)=%d\n",
 			pcam->sensor_sdev->name, sizeof(pvdev->name));
 
-	/* device info - strlcpy is safer than strncpy but
-	   only if architecture supports*/
 	strlcpy(pvdev->name, pcam->sensor_sdev->name,
 			sizeof(pvdev->name));
 
@@ -1754,7 +1796,7 @@
 	pvdev->minor	  = -1;
 	pvdev->vfl_type   = 1;
 
-	/* register v4l2 video device to kernel as /dev/videoXX */
+	
 	D("%s video_register_device\n", __func__);
 	rc = video_register_device(pvdev,
 			VFL_TYPE_GRABBER,
@@ -1766,7 +1808,7 @@
 	D("%s: video device registered as /dev/video%d\n",
 			__func__, pvdev->num);
 
-	/* connect pcam and mctl video dev to each other */
+	
 	pcam->mctl_node.pvdev	= pvdev;
 	video_set_drvdata(pcam->mctl_node.pvdev, pcam);
 
diff --git a/drivers/media/video/msm/msm_mctl_buf.c b/drivers/media/video/msm/msm_mctl_buf.c
index d4277c3..0e6df08 100644
--- a/drivers/media/video/msm/msm_mctl_buf.c
+++ b/drivers/media/video/msm/msm_mctl_buf.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -26,7 +26,6 @@
 #include <linux/android_pmem.h>
 
 #include "msm.h"
-#include "msm_cam_server.h"
 #include "msm_ispif.h"
 
 #ifdef CONFIG_MSM_CAMERA_DEBUG
@@ -36,13 +35,12 @@
 #endif
 
 static int msm_vb2_ops_queue_setup(struct vb2_queue *vq,
-				const struct v4l2_format *fmt,
-				unsigned int *num_buffers,
-				unsigned int *num_planes,
-				unsigned int sizes[],
-				void *alloc_ctxs[])
+					unsigned int *num_buffers,
+					unsigned int *num_planes,
+					unsigned long sizes[],
+					void *alloc_ctxs[])
 {
-	/* get the video device */
+	
 	struct msm_cam_v4l2_dev_inst *pcam_inst = vb2_get_drv_priv(vq);
 	struct msm_cam_v4l2_device *pcam = pcam_inst->pcam;
 	int i;
@@ -55,9 +53,9 @@
 
 	*num_planes = pcam_inst->plane_info.num_planes;
 	for (i = 0; i < pcam_inst->vid_fmt.fmt.pix_mp.num_planes; i++) {
-		sizes[i] = pcam_inst->plane_info.plane[i].size;
+		sizes[i] = PAGE_ALIGN(pcam_inst->plane_info.plane[i].size);
 		D("%s Inst %p : Plane %d Offset = %d Size = %ld"
-			"Aligned Size = %d", __func__, pcam_inst, i,
+			"Aligned Size = %ld", __func__, pcam_inst, i,
 			pcam_inst->plane_info.plane[i].offset,
 			pcam_inst->plane_info.plane[i].size, sizes[i]);
 	}
@@ -66,11 +64,11 @@
 
 static void msm_vb2_ops_wait_prepare(struct vb2_queue *q)
 {
-	/* we use polling so do not use this fn now */
+	
 }
 static void msm_vb2_ops_wait_finish(struct vb2_queue *q)
 {
-	/* we use polling so do not use this fn now */
+	
 }
 
 static int msm_vb2_ops_buf_init(struct vb2_buffer *vb)
@@ -115,18 +113,10 @@
 			pcam_inst->plane_info.plane[0].offset;
 	}
 	buf_idx = vb->v4l2_buf.index;
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-	if (pmctl == NULL) {
-		pr_err("%s No mctl found\n", __func__);
-		return -EINVAL;
-	}
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+	if(!pmctl) return -EINVAL;
 	for (i = 0; i < vb->num_planes; i++) {
 		mem = vb2_plane_cookie(vb, i);
-		if (mem == NULL) {
-			pr_err("%s Inst %p Buffer %d Plane %d cookie is null",
-				__func__, pcam_inst, buf_idx, i);
-			return -EINVAL;
-		}
 		if (buf_type == VIDEOBUF2_MULTIPLE_PLANES)
 			offset.data_offset =
 				pcam_inst->plane_info.plane[i].offset;
@@ -135,8 +125,7 @@
 			rc = videobuf2_pmem_contig_user_get(mem, &offset,
 				buf_type,
 				pcam_inst->buf_offset[buf_idx][i].addr_offset,
-				pcam_inst->path, pmctl->client,
-				pmctl->domain_num);
+				pcam_inst->path, pmctl->client);
 		else
 			rc = videobuf2_pmem_contig_mmap_get(mem, &offset,
 				buf_type, pcam_inst->path);
@@ -157,14 +146,19 @@
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	struct msm_cam_v4l2_device *pcam;
 	struct msm_frame_buffer *buf;
-	struct vb2_queue *vq;
+	struct vb2_queue	*vq = NULL;
 
 	D("%s\n", __func__);
-	if (!vb || !vb->vb2_queue) {
+	if (!vb) {
 		pr_err("%s error : input is NULL\n", __func__);
 		return -EINVAL;
 	}
 	vq = vb->vb2_queue;
+	if (!vq) {
+		pr_err("%s error : input is NULL\n", __func__);
+		return -EINVAL;
+	}
+	
 	pcam_inst = vb2_get_drv_priv(vq);
 	pcam = pcam_inst->pcam;
 	buf = container_of(vb, struct msm_frame_buffer, vidbuf);
@@ -173,14 +167,12 @@
 		pr_err("%s error : pointer is NULL\n", __func__);
 		return -EINVAL;
 	}
-	/* by this time vid_fmt should be already set.
-	 * return error if it is not. */
 	if ((pcam_inst->vid_fmt.fmt.pix.width == 0) ||
 		(pcam_inst->vid_fmt.fmt.pix.height == 0)) {
 		pr_err("%s error : pcam vid_fmt is not set\n", __func__);
 		return -EINVAL;
 	}
-	/* prefill in the byteused field */
+	
 	for (i = 0; i < vb->num_planes; i++) {
 		len = vb2_plane_size(vb, i);
 		vb2_set_plane_payload(vb, i, len);
@@ -199,8 +191,10 @@
 	pcam = pcam_inst->pcam;
 	buf = container_of(vb, struct msm_frame_buffer, vidbuf);
 	buf->state = MSM_BUFFER_STATE_DEQUEUED;
-	D("%s: inst=0x%x, buf=0x%x, idx=%d\n", __func__,
+	D("%s: inst=0x%x, buf=0x, %x, idx=%d\n", __func__,
 	(uint32_t)pcam_inst, (uint32_t)buf, vb->v4l2_buf.index);
+	D("%s: inst=%p, buf=%x, idx=%d\n", __func__,
+	pcam_inst, (uint32_t)buf, vb->v4l2_buf.index);
 	return 0;
 }
 
@@ -218,7 +212,6 @@
 	pcam = pcam_inst->pcam;
 	buf = container_of(vb, struct msm_frame_buffer, vidbuf);
 
-
 	if (pcam_inst->vid_fmt.type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
 		for (i = 0; i < vb->num_planes; i++) {
 			mem = vb2_plane_cookie(vb, i);
@@ -263,27 +256,18 @@
 		}
 		spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
 	}
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-	if (pmctl == NULL || pmctl->client == NULL) {
-		pr_err("%s No mctl found\n", __func__);
-		buf->state = MSM_BUFFER_STATE_UNUSED;
-		return;
-	}
-	for (i = 0; i < vb->num_planes; i++) {
-		mem = vb2_plane_cookie(vb, i);
-		if (mem) {
-			videobuf2_pmem_contig_user_put(mem, pmctl->client,
-				pmctl->domain_num);
-		} else {
-			pr_err("%s Inst %p buffer plane cookie is null",
-				__func__, pcam_inst);
-			return;
+	
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+	if(pmctl)  {
+		for (i = 0; i < vb->num_planes; i++) {
+			mem = vb2_plane_cookie(vb, i);
+			videobuf2_pmem_contig_user_put(mem, pmctl->client);
 		}
 	}
 	buf->state = MSM_BUFFER_STATE_UNUSED;
 }
 
-static int msm_vb2_ops_start_streaming(struct vb2_queue *q, unsigned int count)
+static int msm_vb2_ops_start_streaming(struct vb2_queue *q)
 {
 	return 0;
 }
@@ -298,14 +282,14 @@
 	struct msm_cam_v4l2_dev_inst *pcam_inst = NULL;
 	struct msm_cam_v4l2_device *pcam = NULL;
 	unsigned long flags = 0;
-	struct vb2_queue *vq;
+	struct vb2_queue *vq = NULL; 
 	struct msm_frame_buffer *buf;
 	D("%s\n", __func__);
-	if (!vb || !vb->vb2_queue) {
+	if (vb) vq = vb->vb2_queue; 
+	if (!vb || !vq) {
 		pr_err("%s error : input is NULL\n", __func__);
 		return ;
 	}
-	vq = vb->vb2_queue;
 	pcam_inst = vb2_get_drv_priv(vq);
 	pcam = pcam_inst->pcam;
 	D("%s pcam_inst=%p,(vb=0x%p),idx=%d,len=%d\n",
@@ -315,7 +299,7 @@
 		vb->v4l2_buf.index);
 	buf = container_of(vb, struct msm_frame_buffer, vidbuf);
 	spin_lock_irqsave(&pcam_inst->vq_irqlock, flags);
-	/* we are returning a buffer to the queue */
+	
 	list_add_tail(&buf->list, &pcam_inst->free_vq);
 	spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
 	buf->state = MSM_BUFFER_STATE_QUEUED;
@@ -335,7 +319,6 @@
 };
 
 
-/* prepare a video buffer queue for a vl42 device*/
 static int msm_vbqueue_init(struct msm_cam_v4l2_dev_inst *pcam_inst,
 			struct vb2_queue *q, enum v4l2_buf_type type)
 {
@@ -382,7 +365,7 @@
 struct msm_frame_buffer *msm_mctl_buf_find(
 	struct msm_cam_media_controller *pmctl,
 	struct msm_cam_v4l2_dev_inst *pcam_inst, int del_buf,
-	struct msm_free_buf *fbuf)
+	int image_mode, struct msm_free_buf *fbuf)
 {
 	struct msm_frame_buffer *buf = NULL, *tmp;
 	uint32_t buf_phyaddr = 0;
@@ -390,19 +373,13 @@
 	uint32_t buf_idx, offset = 0;
 	struct videobuf2_contig_pmem *mem;
 
-	/* we actually need a list, not a queue */
+	
 	spin_lock_irqsave(&pcam_inst->vq_irqlock, flags);
 	list_for_each_entry_safe(buf, tmp,
 			&pcam_inst->free_vq, list) {
 		buf_idx = buf->vidbuf.v4l2_buf.index;
 		mem = vb2_plane_cookie(&buf->vidbuf, 0);
-		if (mem == NULL) {
-			pr_err("%s Inst %p plane cookie is null",
-				__func__, pcam_inst);
-			spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
-			return NULL;
-		}
-		if (mem->buffer_type == VIDEOBUF2_MULTIPLE_PLANES)
+		if (mem->buffer_type ==	VIDEOBUF2_MULTIPLE_PLANES)
 			offset = mem->offset.data_offset +
 				pcam_inst->buf_offset[buf_idx][0].data_offset;
 		else
@@ -429,117 +406,73 @@
 int msm_mctl_buf_done_proc(
 		struct msm_cam_media_controller *pmctl,
 		struct msm_cam_v4l2_dev_inst *pcam_inst,
-		struct msm_free_buf *fbuf,
-		uint32_t *frame_id,
-		struct msm_cam_timestamp *cam_ts)
+		int image_mode, struct msm_free_buf *fbuf,
+		uint32_t *frame_id, int gen_timestamp)
 {
 	struct msm_frame_buffer *buf = NULL;
 	int del_buf = 1;
 
-	buf = msm_mctl_buf_find(pmctl, pcam_inst, del_buf, fbuf);
+	buf = msm_mctl_buf_find(pmctl, pcam_inst, del_buf,
+					image_mode, fbuf);
 	if (!buf) {
 		pr_err("%s: buf=0x%x not found\n",
 			__func__, fbuf->ch_paddr[0]);
 		return -EINVAL;
 	}
-	if (!cam_ts->present) {
+	if (gen_timestamp) {
 		if (frame_id)
 			buf->vidbuf.v4l2_buf.sequence = *frame_id;
 		msm_mctl_gettimeofday(
 			&buf->vidbuf.v4l2_buf.timestamp);
-	} else {
-		D("%s Copying timestamp as %ld.%ld", __func__,
-			cam_ts->timestamp.tv_sec, cam_ts->timestamp.tv_usec);
-		buf->vidbuf.v4l2_buf.timestamp = cam_ts->timestamp;
-		buf->vidbuf.v4l2_buf.sequence  = cam_ts->frame_id;
 	}
-	pcam_inst->sequence = buf->vidbuf.v4l2_buf.sequence;
-	D("%s Notify user about buffer %d image_mode %d frame_id %d", __func__,
-		buf->vidbuf.v4l2_buf.index, pcam_inst->image_mode,
-		buf->vidbuf.v4l2_buf.sequence);
 	vb2_buffer_done(&buf->vidbuf, VB2_BUF_STATE_DONE);
 	return 0;
 }
 
 
 int msm_mctl_buf_done(struct msm_cam_media_controller *p_mctl,
-	struct msm_cam_buf_handle *buf_handle,
-	struct msm_free_buf *fbuf,
-	uint32_t frame_id)
+			int image_mode, struct msm_free_buf *fbuf,
+			uint32_t frame_id)
 {
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	int idx, rc;
 	int pp_divert_type = 0, pp_type = 0;
-	uint32_t image_mode;
-	struct msm_cam_timestamp cam_ts;
-
-	if (!p_mctl || !buf_handle || !fbuf) {
-		pr_err("%s Invalid argument. ", __func__);
-		return -EINVAL;
-	}
-	if (buf_handle->buf_lookup_type == BUF_LOOKUP_BY_IMG_MODE)
-		image_mode = buf_handle->image_mode;
-	else
-		image_mode = GET_IMG_MODE(buf_handle->inst_handle);
-
-	if (image_mode > MSM_V4L2_EXT_CAPTURE_MODE_MAX) {
-		pr_err("%s Invalid image mode %d ", __func__, image_mode);
-		return -EINVAL;
-	}
 
 	msm_mctl_check_pp(p_mctl, image_mode, &pp_divert_type, &pp_type);
 	D("%s: pp_type=%d, pp_divert_type = %d, frame_id = 0x%x image_mode %d",
 		__func__, pp_type, pp_divert_type, frame_id, image_mode);
-	if (pp_type || pp_divert_type) {
-		rc = msm_mctl_do_pp_divert(p_mctl, buf_handle,
-			fbuf, frame_id, pp_type);
-	} else {
-		/* Find the instance on which vb2_buffer_done() needs to be
-		 * called, so that the user can get the buffer.
-		 * If the lookup type is
-		 * - By instance handle:
-		 *    Either mctl_pp inst idx or video inst idx should be set.
-		 *    Try to get the MCTL_PP inst idx first, if its not set,
-		 *    fall back to video inst idx. Once we get the inst idx,
-		 *    get the pcam_inst from the corresponding dev_inst[] map.
-		 *    If neither are set, its a serious error, trigger a BUG_ON.
-		 * - By image mode:
-		 *    Legacy usecase. Use the image mode and get the pcam_inst
-		 *    from the video node.
-		 */
-		if (buf_handle->buf_lookup_type == BUF_LOOKUP_BY_INST_HANDLE) {
-			idx = GET_MCTLPP_INST_IDX(buf_handle->inst_handle);
-			if (idx > MSM_DEV_INST_MAX) {
-				idx = GET_VIDEO_INST_IDX(
-					buf_handle->inst_handle);
-				BUG_ON(idx > MSM_DEV_INST_MAX);
-				pcam_inst = p_mctl->pcam_ptr->dev_inst[idx];
-			} else {
+	if (pp_type || pp_divert_type)
+		rc = msm_mctl_do_pp_divert(p_mctl,
+		image_mode, fbuf, frame_id, pp_type);
+	else {
+		idx = msm_mctl_img_mode_to_inst_index(
+				p_mctl, image_mode, 0);
+		if (idx < 0) {
+			
+			if ((image_mode >= 0) &&
+				p_mctl->pcam_ptr->mctl_node.
+					dev_inst_map[image_mode]) {
+				int index = p_mctl->pcam_ptr->mctl_node.
+					   dev_inst_map[image_mode]->my_index;
 				pcam_inst = p_mctl->pcam_ptr->mctl_node.
-					dev_inst[idx];
-			}
-		} else if (buf_handle->buf_lookup_type ==
-				BUF_LOOKUP_BY_IMG_MODE) {
-			idx = msm_mctl_img_mode_to_inst_index(p_mctl,
-				buf_handle->image_mode, 0);
-			if (idx < 0) {
-				pr_err("%s Invalid idx %d ", __func__, idx);
+					dev_inst[index];
+				D("%s: Mctl node index %d inst %p",
+					__func__, index, pcam_inst);
+				rc = msm_mctl_buf_done_proc(p_mctl, pcam_inst,
+					image_mode, fbuf,
+					&frame_id, 1);
+				D("%s mctl node buf done %d\n", __func__, 0);
 				return -EINVAL;
+			} else {
+			  pr_err("%s Invalid instance, dropping buffer\n",
+				  __func__);
+			  return idx;
 			}
-			pcam_inst = p_mctl->pcam_ptr->dev_inst[idx];
-		} else {
-			pr_err("%s Invalid buffer lookup type %d", __func__,
-				buf_handle->buf_lookup_type);
-			return -EINVAL;
 		}
-		if (!pcam_inst) {
-			pr_err("%s Invalid instance, Dropping buffer. ",
-				__func__);
-			return -EINVAL;
-		}
-		memset(&cam_ts, 0, sizeof(cam_ts));
+		pcam_inst = p_mctl->pcam_ptr->dev_inst[idx];
 		rc = msm_mctl_buf_done_proc(p_mctl, pcam_inst,
-			fbuf, &frame_id, &cam_ts);
+				image_mode, fbuf,
+				&frame_id, 1);
 	}
 	return rc;
 }
@@ -547,11 +480,8 @@
 int msm_mctl_buf_init(struct msm_cam_v4l2_device *pcam)
 {
 	struct msm_cam_media_controller *pmctl;
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-	if (pmctl == NULL) {
-		pr_err("%s No mctl found\n", __func__);
-		return -EINVAL;
-	}
+	pmctl = msm_camera_get_mctl(pcam->mctl_handle);
+	if(!pmctl) return 0;
 	pmctl->mctl_vbqueue_init = msm_vbqueue_init;
 	return 0;
 }
@@ -572,143 +502,97 @@
 	return ret;
 }
 
-struct msm_cam_v4l2_dev_inst *msm_mctl_get_inst_by_img_mode(
-	struct msm_cam_media_controller *pmctl, uint32_t img_mode)
-{
-	struct msm_cam_v4l2_dev_inst *pcam_inst = NULL;
-	struct msm_cam_v4l2_device *pcam = pmctl->pcam_ptr;
-	int idx;
-
-	/* Valid image mode. Search the mctl node first.
-	 * If mctl node doesnt have the instance, then
-	 * search in the user's video node */
-	if (pmctl->vfe_output_mode == VFE_OUTPUTS_MAIN_AND_THUMB
-		|| pmctl->vfe_output_mode == VFE_OUTPUTS_THUMB_AND_MAIN
-		|| pmctl->vfe_output_mode == VFE_OUTPUTS_MAIN_AND_PREVIEW) {
-		if (pcam->mctl_node.dev_inst_map[img_mode]
-		&& is_buffer_queued(pcam, img_mode)) {
-			idx = pcam->mctl_node.dev_inst_map[img_mode]->my_index;
-			pcam_inst = pcam->mctl_node.dev_inst[idx];
-			D("%s Found instance %p in mctl node device\n",
-				__func__, pcam_inst);
-		} else if (pcam->dev_inst_map[img_mode]) {
-			idx = pcam->dev_inst_map[img_mode]->my_index;
-			pcam_inst = pcam->dev_inst[idx];
-			D("%s Found instance %p in video device\n",
-				__func__, pcam_inst);
-		}
-	} else {
-		if (pcam->mctl_node.dev_inst_map[img_mode]) {
-			idx = pcam->mctl_node.dev_inst_map[img_mode]->my_index;
-			pcam_inst = pcam->mctl_node.dev_inst[idx];
-			D("%s Found instance %p in mctl node device\n",
-				__func__, pcam_inst);
-		} else if (pcam->dev_inst_map[img_mode]) {
-			idx = pcam->dev_inst_map[img_mode]->my_index;
-			pcam_inst = pcam->dev_inst[idx];
-			D("%s Found instance %p in video device\n",
-				__func__, pcam_inst);
-		}
-	}
-	return pcam_inst;
-}
-
 struct msm_cam_v4l2_dev_inst *msm_mctl_get_pcam_inst(
 				struct msm_cam_media_controller *pmctl,
-				struct msm_cam_buf_handle *buf_handle)
+				int image_mode)
 {
 	struct msm_cam_v4l2_dev_inst *pcam_inst = NULL;
 	struct msm_cam_v4l2_device *pcam = pmctl->pcam_ptr;
 	int idx;
 
-	/* Get the pcam instance on based on the following rules:
-	 * If the lookup type is
-	 * - By instance handle:
-	 *    Either mctl_pp inst idx or video inst idx should be set.
-	 *    Try to get the MCTL_PP inst idx first, if its not set,
-	 *    fall back to video inst idx. Once we get the inst idx,
-	 *    get the pcam_inst from the corresponding dev_inst[] map.
-	 *    If neither are set, its a serious error, trigger a BUG_ON.
-	 * - By image mode:(Legacy usecase)
-	 *    If vfe is in configured in snapshot mode, first check if
-	 *    mctl pp node has a instance created for this image mode
-	 *    and if there is a buffer queued for that instance.
-	 *    If so, return that instance, otherwise get the pcam instance
-	 *    for this image_mode from the video instance.
-	 *    If the vfe is configured in any other mode, then first check
-	 *    if mctl pp node has a instance created for this image mode,
-	 *    otherwise get the pcam instance for this image mode from the
-	 *    video instance.
-	 */
-	if (buf_handle->buf_lookup_type == BUF_LOOKUP_BY_INST_HANDLE) {
-		idx = GET_MCTLPP_INST_IDX(buf_handle->inst_handle);
-		if (idx > MSM_DEV_INST_MAX) {
-			idx = GET_VIDEO_INST_IDX(buf_handle->inst_handle);
-			BUG_ON(idx > MSM_DEV_INST_MAX);
-			pcam_inst = pcam->dev_inst[idx];
-		} else {
-			pcam_inst = pcam->mctl_node.dev_inst[idx];
-		}
-	} else if ((buf_handle->buf_lookup_type == BUF_LOOKUP_BY_IMG_MODE)
-		&& (buf_handle->image_mode >= 0 &&
-		buf_handle->image_mode < MSM_V4L2_EXT_CAPTURE_MODE_MAX)) {
-		pcam_inst = msm_mctl_get_inst_by_img_mode(pmctl,
-				buf_handle->image_mode);
-	} else {
-		pr_err("%s Invalid buffer lookup type %d", __func__,
-			buf_handle->buf_lookup_type);
+	
+	if (!pcam) {
+		pr_err("%s pcam is null\n", __func__);
+		return pcam_inst;
 	}
+	
+
+	if (image_mode >= 0) {
+		if (pmctl->vfe_output_mode == VFE_OUTPUTS_MAIN_AND_THUMB
+		|| pmctl->vfe_output_mode == VFE_OUTPUTS_THUMB_AND_MAIN) {
+			if (pcam->mctl_node.dev_inst_map[image_mode]
+			&& is_buffer_queued(pcam, image_mode)) {
+				idx =
+				pcam->mctl_node.dev_inst_map[image_mode]
+				->my_index;
+				pcam_inst = pcam->mctl_node.dev_inst[idx];
+				D("%s Found instance %p in mctl node device\n",
+				  __func__, pcam_inst);
+			} else if (pcam->dev_inst_map[image_mode]) {
+				idx = pcam->dev_inst_map[image_mode]->my_index;
+				pcam_inst = pcam->dev_inst[idx];
+				D("%s Found instance %p in video device",
+				__func__, pcam_inst);
+			}
+			else { 
+				pr_info("%s image_node %d\n", __func__, image_mode);
+				pr_info("%s mctl_node.dev_inst_map %p\n", __func__, pcam->mctl_node.dev_inst_map[image_mode]);
+				pr_info("%s dev_inst_map %p\n", __func__, pcam->dev_inst_map[image_mode]);
+			}
+		} else {
+			if (pcam->mctl_node.dev_inst_map[image_mode]) {
+				idx = pcam->mctl_node.dev_inst_map[image_mode]
+				->my_index;
+				pcam_inst = pcam->mctl_node.dev_inst[idx];
+				D("%s Found instance %p in mctl node device\n",
+				__func__, pcam_inst);
+			} else if (pcam->dev_inst_map[image_mode]) {
+				idx = pcam->dev_inst_map[image_mode]->my_index;
+				pcam_inst = pcam->dev_inst[idx];
+				D("%s Found instance %p in video device",
+				__func__, pcam_inst);
+			}
+			else { 
+				pr_info("%s image_node %d\n", __func__, image_mode);
+				pr_info("%s mctl_node.dev_inst_map %p\n", __func__, pcam->mctl_node.dev_inst_map[image_mode]);
+				pr_info("%s dev_inst_map %p\n", __func__, pcam->dev_inst_map[image_mode]);
+			}
+		}
+	} else
+		pr_err("%s Invalid image mode %d. Return NULL\n",
+			__func__, image_mode);
 	return pcam_inst;
 }
 
 int msm_mctl_reserve_free_buf(
-	struct msm_cam_media_controller *pmctl,
-	struct msm_cam_v4l2_dev_inst *pref_pcam_inst,
-	struct msm_cam_buf_handle *buf_handle,
-	struct msm_free_buf *free_buf)
+		struct msm_cam_media_controller *pmctl,
+		struct msm_cam_v4l2_dev_inst *pref_pcam_inst,
+		int image_mode, struct msm_free_buf *free_buf)
 {
 	struct msm_cam_v4l2_dev_inst *pcam_inst = pref_pcam_inst;
 	unsigned long flags = 0;
-	struct videobuf2_contig_pmem *mem;
+	struct videobuf2_contig_pmem *mem = NULL;
 	struct msm_frame_buffer *buf = NULL;
 	int rc = -EINVAL, i;
 	uint32_t buf_idx, plane_offset = 0;
 
-	if (!free_buf || !pmctl || !buf_handle) {
-		pr_err("%s: Invalid argument passed\n", __func__);
+	if (!free_buf || !pmctl) {
+		pr_err("%s: free_buf/pmctl is null\n", __func__);
 		return rc;
 	}
 	memset(free_buf, 0, sizeof(struct msm_free_buf));
 
-	/* If the caller wants to reserve a buffer from a particular
-	 * camera instance, he would send the preferred camera instance.
-	 * If the preferred camera instance is NULL, get the
-	 * camera instance using the image mode passed */
-	if (!pcam_inst) {
-		pcam_inst = msm_mctl_get_pcam_inst(pmctl, buf_handle);
-		if(!pcam_inst) {
-			pr_err("%s: pcam_inst is NULL\n", __func__);
-			return rc;
-		}
-	}
+	if (!pcam_inst)
+		pcam_inst = msm_mctl_get_pcam_inst(pmctl, image_mode);
+
 	if (!pcam_inst || !pcam_inst->streamon) {
-		pr_err("%s: stream is turned off\n", __func__);
+		if (pcam_inst)
+			pr_info("%s: pcam_inst %p stream is off\n", __func__, pcam_inst);
+		pr_info("%s: stream is turned off\n", __func__);
 		return rc;
 	}
 	spin_lock_irqsave(&pcam_inst->vq_irqlock, flags);
-	if (pcam_inst->free_vq.next == NULL) {
-		pr_err("%s Inst %p Free queue head is null",
-			__func__, pcam_inst);
-		spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
-		return rc;
-	}
 	list_for_each_entry(buf, &pcam_inst->free_vq, list) {
-		if (buf == NULL) {
-			pr_err("%s Inst %p Invalid buffer ptr",
-				__func__, pcam_inst);
-			spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
-			return rc;
-		}
 		if (buf->state != MSM_BUFFER_STATE_QUEUED)
 			continue;
 
@@ -719,13 +603,6 @@
 				pcam_inst->plane_info.num_planes;
 			for (i = 0; i < free_buf->num_planes; i++) {
 				mem = vb2_plane_cookie(&buf->vidbuf, i);
-				if (mem == NULL) {
-					pr_err("%s Inst %p %d invalid cookie",
-						__func__, pcam_inst, buf_idx);
-					spin_unlock_irqrestore(
-						&pcam_inst->vq_irqlock, flags);
-					return rc;
-				}
 				if (mem->buffer_type ==
 						VIDEOBUF2_MULTIPLE_PLANES)
 					plane_offset =
@@ -733,11 +610,11 @@
 				else
 					plane_offset =
 					mem->offset.sp_off.cbcr_off;
-
 				D("%s: data off %d plane off %d",
 					__func__,
 					pcam_inst->buf_offset[buf_idx][i].
 					data_offset, plane_offset);
+
 				free_buf->ch_paddr[i] =	(uint32_t)
 				videobuf2_to_pmem_contig(&buf->vidbuf, i) +
 				pcam_inst->buf_offset[buf_idx][i].data_offset +
@@ -746,13 +623,6 @@
 			}
 		} else {
 			mem = vb2_plane_cookie(&buf->vidbuf, 0);
-			if (mem == NULL) {
-				pr_err("%s Inst %p %d invalid cookie",
-					__func__, pcam_inst, buf_idx);
-				spin_unlock_irqrestore(
-					&pcam_inst->vq_irqlock, flags);
-				return rc;
-			}
 			free_buf->ch_paddr[0] = (uint32_t)
 				videobuf2_to_pmem_contig(&buf->vidbuf, 0) +
 				mem->offset.sp_off.y_off;
@@ -761,31 +631,87 @@
 		}
 		free_buf->vb = (uint32_t)buf;
 		buf->state = MSM_BUFFER_STATE_RESERVED;
-		D("%s inst=0x%p, idx=%d, paddr=0x%x, "
-			"ch1 addr=0x%x\n", __func__,
-			pcam_inst, buf->vidbuf.v4l2_buf.index,
-			free_buf->ch_paddr[0], free_buf->ch_paddr[1]);
+		if (pcam_inst->no_free_buf_cnt) {
+			pcam_inst->no_free_buf_cnt = 0;
+			pr_info("%s: inst=0x%p, idx=%d, paddr=0x%x, "
+				"ch1 addr=0x%x\n", __func__,
+				pcam_inst, buf->vidbuf.v4l2_buf.index,
+				free_buf->ch_paddr[0], free_buf->ch_paddr[1]);
+		}
 		rc = 0;
 		break;
 	}
-	if (rc != 0)
-		D("%s:No free buffer available: inst = 0x%p ",
-				__func__, pcam_inst);
+	if (rc != 0) {
+		++pcam_inst->no_free_buf_cnt;
+		if (pcam_inst->no_free_buf_cnt < 50 ||
+			pcam_inst->no_free_buf_cnt % 5 == 0)
+			pr_info("%s: No free buffer available: inst = 0x%p, cnt %d\n",
+				__func__, pcam_inst, pcam_inst->no_free_buf_cnt);
+	}
 	spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
 	return rc;
 }
 
+int msm_mctl_return_free_buf(struct msm_cam_media_controller *pmctl,
+                int image_node, struct msm_free_buf *free_buf)
+{
+    int idx = 0;
+    struct msm_frame_buffer *buf = NULL;
+    struct msm_cam_v4l2_dev_inst *pcam_inst;
+    unsigned long flags = 0;
+    uint32_t buf_phyaddr = 0;
+    int rc = -EINVAL;
+
+    if (!free_buf)
+        return rc;
+
+    idx = msm_mctl_img_mode_to_inst_index(pmctl, image_node, 0);
+    if (idx < 0) {
+        pr_err("%s Invalid instance, buffer not released\n", __func__);
+        return idx;
+    }
+    pcam_inst = pmctl->pcam_ptr->dev_inst[idx];
+    if (!pcam_inst) {
+        pr_err("%s Invalid instance, cannot send buf to user",
+            __func__);
+        return rc;
+    }
+
+    spin_lock_irqsave(&pcam_inst->vq_irqlock, flags);
+
+    if (!list_empty(&pcam_inst->free_vq)) {
+        list_for_each_entry(buf, &pcam_inst->free_vq, list) {
+            buf_phyaddr =
+                (uint32_t) videobuf2_to_pmem_contig(&buf->vidbuf, 0);
+            if (free_buf->ch_paddr[0] == buf_phyaddr) {
+                D("%s buf = 0x%x ", __func__, free_buf->ch_paddr[0]);
+                buf->state = MSM_BUFFER_STATE_QUEUED;
+                rc = 0;
+                break;
+            }
+        }
+    }
+    if (rc != 0)
+        pr_err("%s invalid buffer address ", __func__);
+
+    spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
+    return rc;
+}
+
 int msm_mctl_release_free_buf(struct msm_cam_media_controller *pmctl,
 				struct msm_cam_v4l2_dev_inst *pcam_inst,
-				struct msm_free_buf *free_buf)
+				int image_mode, struct msm_free_buf *free_buf)
 {
 	unsigned long flags = 0;
 	struct msm_frame_buffer *buf = NULL;
 	uint32_t buf_phyaddr = 0;
 	int rc = -EINVAL;
 
-	if (!pcam_inst || !free_buf) {
-		pr_err("%s Invalid argument, buffer will not be returned\n",
+	if (!free_buf)
+		return rc;
+
+	if (!pcam_inst) {
+		pr_err("%s Invalid instance, buffer not released\n",
 			__func__);
 		return rc;
 	}
@@ -795,58 +721,35 @@
 		buf_phyaddr =
 			(uint32_t) videobuf2_to_pmem_contig(&buf->vidbuf, 0);
 		if (free_buf->ch_paddr[0] == buf_phyaddr) {
-			D("%s Return buffer %d and mark it as QUEUED\n",
-				__func__, buf->vidbuf.v4l2_buf.index);
-			buf->state = MSM_BUFFER_STATE_QUEUED;
+			D("%s buf = 0x%x ", __func__, free_buf->ch_paddr[0]);
+			buf->state = MSM_BUFFER_STATE_UNUSED;
 			rc = 0;
 			break;
 		}
 	}
+
+	if (rc != 0)
+		pr_err("%s invalid buffer address ", __func__);
+
 	spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
-
-	if (rc)
-		pr_err("%s Cannot find buffer %x", __func__,
-			free_buf->ch_paddr[0]);
-
 	return rc;
 }
 
 int msm_mctl_buf_done_pp(struct msm_cam_media_controller *pmctl,
-	struct msm_cam_buf_handle *buf_handle,
-	struct msm_free_buf *frame,
-	struct msm_cam_return_frame_info *ret_frame)
+	int image_mode, struct msm_free_buf *frame, int dirty, int node_type)
 {
-	struct msm_cam_v4l2_dev_inst *pcam_inst = NULL;
+	struct msm_cam_v4l2_dev_inst *pcam_inst;
 	int rc = 0, idx;
-	struct msm_cam_timestamp cam_ts;
 
-	if (!pmctl || !buf_handle || !ret_frame) {
-		pr_err("%s Invalid argument ", __func__);
-		return -EINVAL;
+	idx = msm_mctl_img_mode_to_inst_index(pmctl, image_mode, node_type);
+	if (idx < 0) {
+		pr_err("%s Invalid instance, buffer not released\n", __func__);
+		return idx;
 	}
-
-	if (buf_handle->buf_lookup_type == BUF_LOOKUP_BY_INST_HANDLE) {
-		idx = GET_MCTLPP_INST_IDX(buf_handle->inst_handle);
-		if (idx > MSM_DEV_INST_MAX) {
-			idx = GET_VIDEO_INST_IDX(buf_handle->inst_handle);
-			BUG_ON(idx > MSM_DEV_INST_MAX);
-			pcam_inst = pmctl->pcam_ptr->dev_inst[idx];
-		} else {
-			pcam_inst = pmctl->pcam_ptr->mctl_node.dev_inst[idx];
-		}
-	} else if (buf_handle->buf_lookup_type == BUF_LOOKUP_BY_IMG_MODE) {
-		idx = msm_mctl_img_mode_to_inst_index(pmctl,
-			buf_handle->image_mode, ret_frame->node_type);
-		if (idx < 0) {
-			pr_err("%s Invalid instance, buffer not released\n",
-				__func__);
-			return idx;
-		}
-		if (ret_frame->node_type)
-			pcam_inst = pmctl->pcam_ptr->mctl_node.dev_inst[idx];
-		else
-			pcam_inst = pmctl->pcam_ptr->dev_inst[idx];
-	}
+	if (node_type)
+		pcam_inst = pmctl->pcam_ptr->mctl_node.dev_inst[idx];
+	else
+		pcam_inst = pmctl->pcam_ptr->dev_inst[idx];
 	if (!pcam_inst) {
 		pr_err("%s Invalid instance, cannot send buf to user",
 			__func__);
@@ -854,19 +757,124 @@
 	}
 
 	D("%s:inst=0x%p, paddr=0x%x, dirty=%d",
-		__func__, pcam_inst, frame->ch_paddr[0], ret_frame->dirty);
-	cam_ts.present = 1;
-	cam_ts.timestamp = ret_frame->timestamp;
-	cam_ts.frame_id   = ret_frame->frame_id;
-	if (ret_frame->dirty || (ret_frame->frame_id < pcam_inst->sequence))
-		/* the frame is dirty, not going to disptach to app */
-		rc = msm_mctl_release_free_buf(pmctl, pcam_inst, frame);
+		__func__, pcam_inst, frame->ch_paddr[0], dirty);
+	if (dirty)
+		
+		rc = msm_mctl_release_free_buf(pmctl, pcam_inst,
+						image_mode, frame);
 	else
-		rc = msm_mctl_buf_done_proc(pmctl, pcam_inst, frame,
-			NULL, &cam_ts);
+		rc = msm_mctl_buf_done_proc(pmctl, pcam_inst,
+			image_mode, frame, NULL, 0);
 	return rc;
 }
 
+struct msm_frame_buffer *msm_mctl_get_free_buf(
+		struct msm_cam_media_controller *pmctl,
+		int image_mode)
+{
+	struct msm_cam_v4l2_dev_inst *pcam_inst;
+	unsigned long flags = 0;
+	struct msm_frame_buffer *buf = NULL;
+	int rc = -EINVAL, idx;
+
+	idx = msm_mctl_img_mode_to_inst_index(pmctl,
+		image_mode, 0);
+	if (idx < 0) {
+		pr_err("%s Invalid instance, cant get buffer\n", __func__);
+		return NULL;
+	}
+	pcam_inst = pmctl->pcam_ptr->dev_inst[idx];
+	if (!pcam_inst->streamon) {
+		pr_err("%s: stream 0x%p is off\n", __func__, pcam_inst);
+		return NULL;
+	}
+	spin_lock_irqsave(&pcam_inst->vq_irqlock, flags);
+	if (!list_empty(&pcam_inst->free_vq)) {
+		list_for_each_entry(buf, &pcam_inst->free_vq, list) {
+			if (buf->state == MSM_BUFFER_STATE_QUEUED) {
+				buf->state = MSM_BUFFER_STATE_RESERVED;
+				rc = 0;
+				break;
+			}
+		}
+	}
+	if (rc != 0) {
+		pr_info("%s:No free buffer available: inst = 0x%p ",
+				__func__, pcam_inst);
+		buf = NULL;
+	}
+	spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
+	return buf;
+}
+
+int msm_mctl_put_free_buf(
+		struct msm_cam_media_controller *pmctl,
+		int image_mode, struct msm_frame_buffer *my_buf)
+{
+	struct msm_cam_v4l2_dev_inst *pcam_inst;
+	unsigned long flags = 0;
+	int rc = 0, idx;
+	struct msm_frame_buffer *buf = NULL;
+
+	idx = msm_mctl_img_mode_to_inst_index(pmctl,
+		image_mode, 0);
+	if (idx < 0) {
+		pr_err("%s Invalid instance, cant put buffer\n", __func__);
+		return idx;
+	}
+	pcam_inst = pmctl->pcam_ptr->dev_inst[idx];
+	if (!pcam_inst->streamon) {
+		pr_err("%s: stream 0x%p is off\n", __func__, pcam_inst);
+		return rc;
+	}
+	spin_lock_irqsave(&pcam_inst->vq_irqlock, flags);
+	if (!list_empty(&pcam_inst->free_vq)) {
+		list_for_each_entry(buf, &pcam_inst->free_vq, list) {
+			if (my_buf == buf) {
+				buf->state = MSM_BUFFER_STATE_QUEUED;
+				spin_unlock_irqrestore(&pcam_inst->vq_irqlock,
+					flags);
+				return 0;
+			}
+		}
+	}
+	spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
+	return rc;
+}
+
+int msm_mctl_buf_del(struct msm_cam_media_controller *pmctl,
+	int image_mode,
+	struct msm_frame_buffer *my_buf)
+{
+	struct msm_cam_v4l2_dev_inst *pcam_inst;
+	struct msm_frame_buffer *buf = NULL;
+	unsigned long flags = 0;
+	int idx;
+
+	idx = msm_mctl_img_mode_to_inst_index(pmctl,
+		image_mode, 0);
+	if (idx < 0) {
+		pr_err("%s Invalid instance, cant delete buffer\n", __func__);
+		return idx;
+	}
+	pcam_inst = pmctl->pcam_ptr->dev_inst[idx];
+	D("%s: idx = %d, pinst=0x%p", __func__, idx, pcam_inst);
+	spin_lock_irqsave(&pcam_inst->vq_irqlock, flags);
+	if (!list_empty(&pcam_inst->free_vq)) {
+		list_for_each_entry(buf, &pcam_inst->free_vq, list) {
+			if (my_buf == buf) {
+				list_del_init(&buf->list);
+				spin_unlock_irqrestore(&pcam_inst->vq_irqlock,
+					flags);
+				return 0;
+			}
+		}
+	}
+	spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
+	pr_err("%s: buf 0x%p not found", __func__, my_buf);
+	return -EINVAL;
+}
+
 int msm_mctl_buf_return_buf(struct msm_cam_media_controller *pmctl,
 			int image_mode, struct msm_frame_buffer *rbuf)
 {
@@ -907,199 +915,3 @@
 	spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
 	return -EINVAL;
 }
-
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-/* Unmap using ION APIs */
-static void __msm_mctl_unmap_user_frame(struct msm_cam_meta_frame *meta_frame,
-	struct ion_client *client, int domain_num)
-{
-	int i = 0;
-	for (i = 0; i < meta_frame->frame.num_planes; i++) {
-		D("%s Plane %d handle %p", __func__, i,
-			meta_frame->map[i].handle);
-		ion_unmap_iommu(client, meta_frame->map[i].handle,
-					domain_num, 0);
-		ion_free(client, meta_frame->map[i].handle);
-	}
-}
-
-/* Map using ION APIs */
-static int __msm_mctl_map_user_frame(struct msm_cam_meta_frame *meta_frame,
-	struct ion_client *client, int domain_num)
-{
-	unsigned long paddr = 0;
-	unsigned long len = 0;
-	int i = 0, j = 0;
-
-	for (i = 0; i < meta_frame->frame.num_planes; i++) {
-		meta_frame->map[i].handle = ion_import_dma_buf(client,
-			meta_frame->frame.mp[i].fd);
-		if (IS_ERR_OR_NULL(meta_frame->map[i].handle)) {
-			pr_err("%s: ion_import failed for plane = %d fd = %d",
-				__func__, i, meta_frame->frame.mp[i].fd);
-			/* Roll back previous plane mappings, if any */
-			for (j = i-1; j >= 0; j--) {
-				ion_unmap_iommu(client,
-					meta_frame->map[j].handle,
-					domain_num, 0);
-				ion_free(client, meta_frame->map[j].handle);
-			}
-			return -EACCES;
-		}
-		D("%s Mapping fd %d plane %d handle %p", __func__,
-			meta_frame->frame.mp[i].fd, i,
-			meta_frame->map[i].handle);
-		if (ion_map_iommu(client, meta_frame->map[i].handle,
-				domain_num, 0, SZ_4K,
-				0, &paddr, &len, 0, 0) < 0) {
-			pr_err("%s: cannot map address plane %d", __func__, i);
-			ion_free(client, meta_frame->map[i].handle);
-			/* Roll back previous plane mappings, if any */
-			for (j = i-1; j >= 0; j--) {
-				if (meta_frame->map[j].handle) {
-					ion_unmap_iommu(client,
-						meta_frame->map[j].handle,
-						domain_num, 0);
-					ion_free(client,
-						meta_frame->map[j].handle);
-				}
-			}
-			return -EFAULT;
-		}
-
-		/* Validate the offsets with the mapped length. */
-		if ((meta_frame->frame.mp[i].addr_offset > len) ||
-			(meta_frame->frame.mp[i].data_offset +
-			meta_frame->frame.mp[i].length > len)) {
-			pr_err("%s: Invalid offsets A %d D %d L %d len %ld",
-				__func__, meta_frame->frame.mp[i].addr_offset,
-				meta_frame->frame.mp[i].data_offset,
-				meta_frame->frame.mp[i].length, len);
-			/* Roll back previous plane mappings, if any */
-			for (j = i; j >= 0; j--) {
-				if (meta_frame->map[j].handle) {
-					ion_unmap_iommu(client,
-						meta_frame->map[j].handle,
-						domain_num, 0);
-					ion_free(client,
-						meta_frame->map[j].handle);
-				}
-			}
-			return -EINVAL;
-		}
-		meta_frame->map[i].data_offset =
-			meta_frame->frame.mp[i].data_offset;
-		/* Add the addr_offset to the paddr here itself. The addr_offset
-		 * will be non-zero only if the user has allocated a buffer with
-		 * a single fd, but logically partitioned it into
-		 * multiple planes or buffers.*/
-		paddr += meta_frame->frame.mp[i].addr_offset;
-		meta_frame->map[i].paddr = paddr;
-		meta_frame->map[i].len = len;
-		D("%s Plane %d fd %d handle %p paddr %x", __func__,
-			i, meta_frame->frame.mp[i].fd,
-			meta_frame->map[i].handle,
-			(uint32_t)meta_frame->map[i].paddr);
-	}
-	D("%s Frame mapped successfully ", __func__);
-	return 0;
-}
-#else
-/* Unmap using PMEM APIs */
-static int __msm_mctl_unmap_user_frame(struct msm_cam_meta_frame *meta_frame,
-	struct ion_client *client, int domain_num)
-{
-	int i = 0, rc = 0;
-
-	for (i = 0; i < meta_frame->frame.num_planes; i++) {
-		D("%s Plane %d handle %p", __func__, i,
-			meta_frame->map[i].handle);
-		put_pmem_file(meta_frame->map[i].file);
-	}
-}
-
-/* Map using PMEM APIs */
-static int __msm_mctl_map_user_frame(struct msm_cam_meta_frame *meta_frame,
-	struct ion_client *client, int domain_num)
-{
-	unsigned long kvstart = 0;
-	unsigned long paddr = 0;
-	struct file *file = NULL;
-	unsigned long len;
-	int i = 0, j = 0;
-
-	for (i = 0; i < meta_frame->frame.num_planes; i++) {
-		rc = get_pmem_file(meta_frame->frame.mp[i].fd,
-			&paddr, &kvstart, &len, &file);
-		if (rc < 0) {
-			pr_err("%s: get_pmem_file fd %d error %d\n",
-				__func__, meta_frame->frame.mp[i].fd, rc);
-			/* Roll back previous plane mappings, if any */
-			for (j = i-1; j >= 0; j--)
-				if (meta_frame->map[j].file)
-					put_pmem_file(meta_frame->map[j].file);
-
-			return -EACCES;
-		}
-		D("%s Got pmem file for fd %d plane %d as %p", __func__,
-			meta_frame->frame.mp[i].fd, i, file);
-		meta_frame->map[i].file = file;
-		/* Validate the offsets with the mapped length. */
-		if ((meta_frame->frame.mp[i].addr_offset > len) ||
-			(meta_frame->frame.mp[i].data_offset +
-			meta_frame->frame.mp[i].length > len)) {
-			pr_err("%s: Invalid offsets A %d D %d L %d len %ld",
-				__func__, meta_frame->frame.mp[i].addr_offset,
-				meta_frame->frame.mp[i].data_offset,
-				meta_frame->frame.mp[i].length, len);
-			/* Roll back previous plane mappings, if any */
-			for (j = i; j >= 0; j--)
-				if (meta_frame->map[j].file)
-					put_pmem_file(meta_frame->map[j].file);
-
-			return -EINVAL;
-		}
-		meta_frame->map[i].data_offset =
-			meta_frame->frame.mp[i].data_offset;
-		/* Add the addr_offset to the paddr here itself. The addr_offset
-		 * will be non-zero only if the user has allocated a buffer with
-		 * a single fd, but logically partitioned it into
-		 * multiple planes or buffers.*/
-		paddr += meta_frame->frame.mp[i].addr_offset;
-		meta_frame->map[i].paddr = paddr;
-		meta_frame->map[i].len = len;
-		D("%s Plane %d fd %d handle %p paddr %x", __func__,
-			i, meta_frame->frame.mp[i].fd,
-			meta_frame->map[i].handle,
-			(uint32_t)meta_frame->map[i].paddr);
-	}
-	D("%s Frame mapped successfully ", __func__);
-	return 0;
-}
-#endif
-
-int msm_mctl_map_user_frame(struct msm_cam_meta_frame *meta_frame,
-	struct ion_client *client, int domain_num)
-{
-
-	if ((NULL == meta_frame) || (NULL == client)) {
-		pr_err("%s Invalid input ", __func__);
-		return -EINVAL;
-	}
-
-	memset(&meta_frame->map[0], 0,
-		sizeof(struct msm_cam_buf_map_info) * VIDEO_MAX_PLANES);
-
-	return __msm_mctl_map_user_frame(meta_frame, client, domain_num);
-}
-
-int msm_mctl_unmap_user_frame(struct msm_cam_meta_frame *meta_frame,
-	struct ion_client *client, int domain_num)
-{
-	if ((NULL == meta_frame) || (NULL == client)) {
-		pr_err("%s Invalid input ", __func__);
-		return -EINVAL;
-	}
-	__msm_mctl_unmap_user_frame(meta_frame, client, domain_num);
-	return 0;
-}
diff --git a/drivers/media/video/msm/msm_mctl_pp.c b/drivers/media/video/msm/msm_mctl_pp.c
old mode 100755
new mode 100644
index 980bdd5..5118491
--- a/drivers/media/video/msm/msm_mctl_pp.c
+++ b/drivers/media/video/msm/msm_mctl_pp.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -36,6 +36,18 @@
 #define D(fmt, args...) do {} while (0)
 #endif
 
+static int msm_mctl_pp_vpe_ioctl(struct v4l2_subdev *vpe_sd,
+	struct msm_mctl_pp_cmd *cmd, void *data)
+{
+	int rc = 0;
+	struct msm_mctl_pp_params parm;
+	parm.cmd = cmd;
+	parm.data = data;
+	rc = v4l2_subdev_call(vpe_sd, core, ioctl, VIDIOC_MSM_VPE_CFG, &parm);
+	return rc;
+}
+
+
 static int msm_mctl_pp_buf_divert(
 			struct msm_cam_media_controller *pmctl,
 			struct msm_cam_v4l2_dev_inst *pcam_inst,
@@ -52,11 +64,10 @@
 	D("%s: msm_cam_evt_divert_frame=%d",
 		__func__, sizeof(struct msm_cam_evt_divert_frame));
 	memset(&v4l2_evt, 0, sizeof(v4l2_evt));
-	v4l2_evt.id = 0;
 	v4l2_evt.type = V4L2_EVENT_PRIVATE_START +
 			MSM_CAM_RESP_DIV_FRAME_EVT_MSG;
 	*((uint32_t *)v4l2_evt.u.data) = (uint32_t)isp_event;
-	/* Copy the divert frame struct into event ctrl struct. */
+	
 	isp_event->isp_data.div_frame = *div;
 
 	D("%s inst=%p, img_mode=%d, frame_id=%d\n", __func__,
@@ -103,14 +114,6 @@
 		if (p_mctl->pp_info.pp_ctrl.pp_msg_type == OUTPUT_TYPE_T)
 			*pp_type = OUTPUT_TYPE_T;
 		break;
-	case MSM_V4L2_EXT_CAPTURE_MODE_RDI:
-		if (p_mctl->pp_info.pp_ctrl.pp_msg_type & OUTPUT_TYPE_R)
-			*pp_type = OUTPUT_TYPE_R;
-		break;
-	case MSM_V4L2_EXT_CAPTURE_MODE_RDI2:
-		if (p_mctl->pp_info.pp_key & PP_RDI)
-			*pp_divert_type = OUTPUT_TYPE_R2;
-		break;
 	default:
 		break;
 	}
@@ -142,12 +145,6 @@
 	&pcam_inst->free_vq, list) {
 		buf_idx = buf->vidbuf.v4l2_buf.index;
 		mem = vb2_plane_cookie(&buf->vidbuf, 0);
-		if (mem == NULL) {
-			pr_err("%s Inst %p Buffer %d invalid plane cookie",
-				__func__, pcam_inst, buf_idx);
-			spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
-			return 0;
-		}
 		if (mem->buffer_type ==	VIDEOBUF2_MULTIPLE_PLANES)
 			offset = mem->offset.data_offset +
 				pcam_inst->buf_offset[buf_idx][0].data_offset;
@@ -167,96 +164,58 @@
 	spin_unlock_irqrestore(&pcam_inst->vq_irqlock, flags);
 	return 0;
 }
-
 static struct msm_cam_v4l2_dev_inst *msm_mctl_get_pcam_inst_for_divert(
-	struct msm_cam_media_controller *pmctl,
-	struct msm_cam_buf_handle *buf_handle,
-	struct msm_free_buf *fbuf, int *node_type)
+		struct msm_cam_media_controller *pmctl,
+		int image_mode, struct msm_free_buf *fbuf, int *node_type)
 {
 	struct msm_cam_v4l2_dev_inst *pcam_inst = NULL;
 	struct msm_cam_v4l2_device *pcam = pmctl->pcam_ptr;
 	int idx;
-	uint32_t img_mode;
 
-	if (buf_handle->buf_lookup_type == BUF_LOOKUP_BY_INST_HANDLE) {
-		idx = GET_MCTLPP_INST_IDX(buf_handle->inst_handle);
-		if (idx > MSM_DEV_INST_MAX) {
-			idx = GET_VIDEO_INST_IDX(buf_handle->inst_handle);
-			BUG_ON(idx > MSM_DEV_INST_MAX);
-			pcam_inst = pcam->dev_inst[idx];
-			*node_type = VIDEO_NODE;
-		} else {
+	if (image_mode >= 0) {
+		if (pcam->mctl_node.dev_inst_map[image_mode]
+		&& is_buf_in_queue(pcam, fbuf, image_mode)) {
+			idx =
+			pcam->mctl_node.dev_inst_map[image_mode]->my_index;
 			pcam_inst = pcam->mctl_node.dev_inst[idx];
 			*node_type = MCTL_NODE;
-		}
-	} else if (buf_handle->buf_lookup_type == BUF_LOOKUP_BY_IMG_MODE) {
-		img_mode = buf_handle->image_mode;
-		if (img_mode >= 0 && img_mode < MSM_V4L2_EXT_CAPTURE_MODE_MAX) {
-			/* Valid image mode. Search the mctl node first.
-			 * If mctl node doesnt have the instance, then
-			 * search in the user's video node */
-			if (pcam->mctl_node.dev_inst_map[img_mode]
-				&& is_buf_in_queue(pcam, fbuf, img_mode)) {
-				idx = pcam->mctl_node.
-					dev_inst_map[img_mode]->my_index;
-				pcam_inst = pcam->mctl_node.dev_inst[idx];
-				*node_type = MCTL_NODE;
-				D("%s Found instance %p in mctl node device\n",
-					__func__, pcam_inst);
-			} else if (pcam->dev_inst_map[img_mode]) {
-				idx = pcam->dev_inst_map[img_mode]->my_index;
-				pcam_inst = pcam->dev_inst[idx];
-				*node_type = VIDEO_NODE;
-				D("%s Found instance %p in video device",
-					__func__, pcam_inst);
-			} else {
-				pr_err("%s Cannot find instance for %d.\n",
-					__func__, img_mode);
-			}
-		} else {
+			D("%s Found instance %p in mctl node device\n",
+				__func__, pcam_inst);
+		} else if (pcam->dev_inst_map[image_mode]) {
+			idx = pcam->dev_inst_map[image_mode]->my_index;
+			pcam_inst = pcam->dev_inst[idx];
+			*node_type = VIDEO_NODE;
+			D("%s Found instance %p in video device",
+				__func__, pcam_inst);
+		} else
 			pr_err("%s Invalid image mode %d. Return NULL\n",
-				__func__, buf_handle->image_mode);
-		}
-	} else {
-		pr_err("%s Invalid buffer lookup type ", __func__);
+				   __func__, image_mode);
 	}
-	return pcam_inst;
+		return pcam_inst;
 }
 
 int msm_mctl_do_pp_divert(
 	struct msm_cam_media_controller *p_mctl,
-	struct msm_cam_buf_handle *buf_handle,
-	struct msm_free_buf *fbuf,
+	int image_mode, struct msm_free_buf *fbuf,
 	uint32_t frame_id, int pp_type)
 {
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	int rc = 0, i, buf_idx, node;
-	int del_buf = 0; /* delete from free queue */
+	int rc = 0, i, buf_idx;
+	int del_buf = 0; 
 	struct msm_cam_evt_divert_frame div;
 	struct msm_frame_buffer *vb = NULL;
 	struct videobuf2_contig_pmem *mem;
-	uint32_t image_mode;
+	int node;
 
-	if (buf_handle->buf_lookup_type == BUF_LOOKUP_BY_IMG_MODE) {
-		image_mode = buf_handle->image_mode;
-		div.frame.inst_handle = 0;
-	} else if (buf_handle->buf_lookup_type == BUF_LOOKUP_BY_INST_HANDLE) {
-		image_mode = GET_IMG_MODE(buf_handle->inst_handle);
-		div.frame.inst_handle = buf_handle->inst_handle;
-	} else {
-		pr_err("%s Invalid buffer lookup type %d ", __func__,
-			buf_handle->buf_lookup_type);
-		return -EINVAL;
-	}
-
-	pcam_inst = msm_mctl_get_pcam_inst_for_divert(p_mctl,
-			buf_handle, fbuf, &node);
+	pcam_inst = msm_mctl_get_pcam_inst_for_divert
+		(p_mctl, image_mode, fbuf, &node);
 	if (!pcam_inst) {
 		pr_err("%s Invalid instance. Cannot divert frame.\n",
 			__func__);
 		return -EINVAL;
 	}
-	vb = msm_mctl_buf_find(p_mctl, pcam_inst, del_buf, fbuf);
+	vb = msm_mctl_buf_find(p_mctl, pcam_inst,
+		  del_buf, image_mode, fbuf);
 	if (!vb)
 		return -EINVAL;
 
@@ -278,20 +237,10 @@
 	div.do_pp = pp_type;
 	D("%s Diverting frame %x id %d to userspace ", __func__,
 		(int)div.frame.handle, div.frame.frame_id);
-	/* Get the cookie for 1st plane and store the path.
-	 * Also use this to check the number of planes in
-	 * this buffer.*/
 	mem = vb2_plane_cookie(&vb->vidbuf, 0);
-	if (mem == NULL) {
-		pr_err("%s Inst %p Buffer %d, invalid plane cookie ", __func__,
-			pcam_inst, buf_idx);
-		return -EINVAL;
-	}
 	div.frame.path = mem->path;
 	div.frame.node_type = node;
 	if (mem->buffer_type == VIDEOBUF2_SINGLE_PLANE) {
-		/* This buffer contains only 1 plane. Use the
-		 * single planar structure to store the info.*/
 		div.frame.num_planes	= 1;
 		div.frame.sp.phy_addr	=
 			videobuf2_to_pmem_contig(&vb->vidbuf, 0);
@@ -304,18 +253,9 @@
 			p_mctl->pp_info.div_frame[pcam_inst->image_mode].
 			ch_paddr[0] = div.frame.sp.phy_addr;
 	} else {
-		/* This buffer contains multiple planes. Use the mutliplanar
-		 * structure to store the info. */
 		div.frame.num_planes	= pcam_inst->plane_info.num_planes;
-		/* Now traverse through all the planes of the buffer to
-		 * fill out the plane info. */
 		for (i = 0; i < div.frame.num_planes; i++) {
 			mem = vb2_plane_cookie(&vb->vidbuf, i);
-			if (mem == NULL) {
-				pr_err("%s Inst %p %d invalid plane cookie ",
-					__func__, pcam_inst, buf_idx);
-				return -EINVAL;
-			}
 			div.frame.mp[i].phy_addr =
 				videobuf2_to_pmem_contig(&vb->vidbuf, i);
 			if (!pcam_inst->buf_offset)
@@ -353,16 +293,7 @@
 	pp_frame->frame_id = vb->vidbuf.v4l2_buf.sequence;
 	pp_frame->timestamp = vb->vidbuf.v4l2_buf.timestamp;
 	pp_frame->buf_idx = buf_idx;
-	pp_frame->inst_handle = pcam_inst->inst_handle;
-	/* Get the cookie for 1st plane and store the path.
-	 * Also use this to check the number of planes in
-	 * this buffer.*/
 	mem = vb2_plane_cookie(&vb->vidbuf, 0);
-	if (mem == NULL) {
-		pr_err("%s Inst %p Buffer %d, invalid plane cookie ", __func__,
-			pcam_inst, buf_idx);
-		return -EINVAL;
-	}
 	pp_frame->image_type = (unsigned short)mem->path;
 	if (mem->buffer_type == VIDEOBUF2_SINGLE_PLANE) {
 		pp_frame->num_planes = 1;
@@ -377,12 +308,6 @@
 		pp_frame->num_planes = pcam_inst->plane_info.num_planes;
 		for (i = 0; i < pp_frame->num_planes; i++) {
 			mem = vb2_plane_cookie(&vb->vidbuf, i);
-			if (mem == NULL) {
-				pr_err("%s frame id %d buffer %d plane %d, invalid plane cookie "
-					, __func__, pp_frame->frame_id,
-					 buf_idx, i);
-				return -EINVAL;
-			}
 			pp_frame->mp[i].addr_offset = mem->addr_offset;
 			pp_frame->mp[i].phy_addr =
 				videobuf2_to_pmem_contig(&vb->vidbuf, i);
@@ -400,6 +325,287 @@
 	return 0;
 }
 
+static int msm_mctl_pp_copy_timestamp_and_frame_id(
+	uint32_t src_handle, uint32_t dest_handle)
+{
+	struct msm_frame_buffer *src_vb;
+	struct msm_frame_buffer *dest_vb;
+
+	src_vb = (struct msm_frame_buffer *)src_handle;
+	dest_vb = (struct msm_frame_buffer *)dest_handle;
+	dest_vb->vidbuf.v4l2_buf.timestamp =
+		src_vb->vidbuf.v4l2_buf.timestamp;
+	dest_vb->vidbuf.v4l2_buf.sequence =
+		src_vb->vidbuf.v4l2_buf.sequence;
+	D("%s: timestamp=%ld:%ld,frame_id=0x%x", __func__,
+		dest_vb->vidbuf.v4l2_buf.timestamp.tv_sec,
+		dest_vb->vidbuf.v4l2_buf.timestamp.tv_usec,
+		dest_vb->vidbuf.v4l2_buf.sequence);
+	return 0;
+}
+
+static int msm_mctl_pp_path_to_inst_index(struct msm_cam_v4l2_device *pcam,
+					int out_type)
+{
+	int image_mode;
+	switch (out_type) {
+	case OUTPUT_TYPE_P:
+		image_mode = MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW;
+		break;
+	case OUTPUT_TYPE_V:
+		image_mode = MSM_V4L2_EXT_CAPTURE_MODE_VIDEO;
+		break;
+	case OUTPUT_TYPE_S:
+		image_mode = MSM_V4L2_EXT_CAPTURE_MODE_MAIN;
+		break;
+	default:
+		image_mode = -1;
+		break;
+	}
+	if ((image_mode >= 0) && pcam->dev_inst_map[image_mode])
+		return pcam->dev_inst_map[image_mode]->my_index;
+	else
+		return -EINVAL;
+}
+
+int msm_mctl_pp_proc_vpe_cmd(
+	struct msm_cam_media_controller *p_mctl,
+	struct msm_mctl_pp_cmd *pp_cmd)
+{
+	int rc = 0, idx;
+	void __user *argp = (void __user *)pp_cmd->value;
+	struct msm_cam_v4l2_dev_inst *pcam_inst;
+
+	switch (pp_cmd->id) {
+	case VPE_CMD_INIT:
+	case VPE_CMD_DEINIT:
+		rc = msm_mctl_pp_vpe_ioctl(
+			p_mctl->vpe_sdev, pp_cmd, NULL);
+		break;
+	case VPE_CMD_DISABLE:
+	case VPE_CMD_RESET:
+		rc = msm_mctl_pp_vpe_ioctl(
+			p_mctl->vpe_sdev, pp_cmd, NULL);
+		break;
+	case VPE_CMD_ENABLE: {
+		struct msm_vpe_clock_rate clk_rate;
+		if (sizeof(struct msm_vpe_clock_rate) !=
+			pp_cmd->length) {
+			pr_err("%s: vpe cmd size mismatch "
+				"(id=%d, length = %d, expect size = %d",
+				__func__, pp_cmd->id, pp_cmd->length,
+				sizeof(struct msm_vpe_clock_rate));
+				rc = -EINVAL;
+				break;
+		}
+		if (copy_from_user(&clk_rate, pp_cmd->value,
+			sizeof(struct msm_vpe_clock_rate))) {
+			pr_err("%s:clk_rate copy failed", __func__);
+			return -EFAULT;
+		}
+		pp_cmd->value = (void *)&clk_rate;
+		rc = msm_mctl_pp_vpe_ioctl(
+			p_mctl->vpe_sdev, pp_cmd, NULL);
+		pp_cmd->value = argp;
+		break;
+	}
+	case VPE_CMD_FLUSH: {
+		struct msm_vpe_flush_frame_buffer flush_buf;
+		if (sizeof(struct msm_vpe_flush_frame_buffer) !=
+			pp_cmd->length) {
+			D("%s: size mismatch(id=%d, len = %d, expected = %d",
+				__func__, pp_cmd->id, pp_cmd->length,
+				sizeof(struct msm_vpe_flush_frame_buffer));
+				rc = -EINVAL;
+				break;
+		}
+		if (copy_from_user(
+			&flush_buf, pp_cmd->value, sizeof(flush_buf)))
+			return -EFAULT;
+		pp_cmd->value = (void *)&flush_buf;
+		rc = msm_mctl_pp_vpe_ioctl(
+			p_mctl->vpe_sdev, pp_cmd, NULL);
+		if (rc == 0) {
+			if (copy_to_user((void *)argp,
+						&flush_buf,
+						sizeof(flush_buf))) {
+				ERR_COPY_TO_USER();
+				rc = -EFAULT;
+			}
+			pp_cmd->value = argp;
+		}
+	}
+	break;
+	case VPE_CMD_OPERATION_MODE_CFG: {
+		struct msm_vpe_op_mode_cfg op_mode_cfg;
+		if (sizeof(struct msm_vpe_op_mode_cfg) !=
+		pp_cmd->length) {
+			D("%s: size mismatch(id=%d, len = %d, expected = %d",
+				__func__, pp_cmd->id, pp_cmd->length,
+				sizeof(struct msm_vpe_op_mode_cfg));
+				rc = -EINVAL;
+				break;
+		}
+		if (copy_from_user(&op_mode_cfg,
+			pp_cmd->value,
+			sizeof(op_mode_cfg)))
+			return -EFAULT;
+		pp_cmd->value = (void *)&op_mode_cfg;
+		rc = msm_mctl_pp_vpe_ioctl(
+			p_mctl->vpe_sdev, pp_cmd, NULL);
+		break;
+	}
+	case VPE_CMD_INPUT_PLANE_CFG: {
+		struct msm_vpe_input_plane_cfg input_cfg;
+		if (sizeof(struct msm_vpe_input_plane_cfg) !=
+			pp_cmd->length) {
+			D("%s: mismatch(id=%d, len = %d, expected = %d",
+				__func__, pp_cmd->id, pp_cmd->length,
+				sizeof(struct msm_vpe_input_plane_cfg));
+				rc = -EINVAL;
+				break;
+		}
+		if (copy_from_user(
+			&input_cfg, pp_cmd->value, sizeof(input_cfg)))
+			return -EFAULT;
+		pp_cmd->value = (void *)&input_cfg;
+		rc = msm_mctl_pp_vpe_ioctl(
+			p_mctl->vpe_sdev, pp_cmd, NULL);
+		break;
+	}
+	case VPE_CMD_OUTPUT_PLANE_CFG: {
+		struct msm_vpe_output_plane_cfg output_cfg;
+		if (sizeof(struct msm_vpe_output_plane_cfg) !=
+			pp_cmd->length) {
+			D("%s: size mismatch(id=%d, len = %d, expected = %d",
+				__func__, pp_cmd->id, pp_cmd->length,
+				sizeof(struct msm_vpe_output_plane_cfg));
+				rc = -EINVAL;
+				break;
+		}
+		if (copy_from_user(&output_cfg, pp_cmd->value,
+			sizeof(output_cfg))) {
+			D("%s: cannot copy pp_cmd->value, size=%d",
+				__func__, pp_cmd->length);
+			return -EFAULT;
+		}
+		pp_cmd->value = (void *)&output_cfg;
+		rc = msm_mctl_pp_vpe_ioctl(
+			p_mctl->vpe_sdev, pp_cmd, NULL);
+		break;
+	}
+	case VPE_CMD_INPUT_PLANE_UPDATE: {
+		struct msm_vpe_input_plane_update_cfg input_update_cfg;
+		if (sizeof(struct msm_vpe_input_plane_update_cfg) !=
+			pp_cmd->length) {
+			D("%s: size mismatch(id=%d, len = %d, expected = %d",
+				__func__, pp_cmd->id, pp_cmd->length,
+				sizeof(struct msm_vpe_input_plane_update_cfg));
+				rc = -EINVAL;
+				break;
+		}
+		if (copy_from_user(&input_update_cfg, pp_cmd->value,
+			sizeof(input_update_cfg)))
+			return -EFAULT;
+		pp_cmd->value = (void *)&input_update_cfg;
+		rc = msm_mctl_pp_vpe_ioctl(
+			p_mctl->vpe_sdev, pp_cmd, NULL);
+		break;
+	}
+	case VPE_CMD_SCALE_CFG_TYPE: {
+		struct msm_vpe_scaler_cfg scaler_cfg;
+		if (sizeof(struct msm_vpe_scaler_cfg) !=
+			pp_cmd->length) {
+			D("%s: size mismatch(id=%d, len = %d, expected = %d",
+				__func__, pp_cmd->id, pp_cmd->length,
+				sizeof(struct msm_vpe_scaler_cfg));
+				rc = -EINVAL;
+				break;
+		}
+		if (copy_from_user(&scaler_cfg, pp_cmd->value,
+			sizeof(scaler_cfg)))
+			return -EFAULT;
+		pp_cmd->value = (void *)&scaler_cfg;
+		rc = msm_mctl_pp_vpe_ioctl(
+			p_mctl->vpe_sdev, pp_cmd, NULL);
+		break;
+	}
+	case VPE_CMD_ZOOM: {
+		struct msm_mctl_pp_frame_info *zoom;
+		zoom = kmalloc(sizeof(struct msm_mctl_pp_frame_info),
+					GFP_ATOMIC);
+		if (!zoom) {
+			rc = -ENOMEM;
+			break;
+		}
+		if (sizeof(zoom->pp_frame_cmd) != pp_cmd->length) {
+			D("%s: size mismatch(id=%d, len = %d, expected = %d",
+				__func__, pp_cmd->id, pp_cmd->length,
+				sizeof(zoom->pp_frame_cmd));
+				rc = -EINVAL;
+				kfree(zoom);
+				break;
+		}
+		if (copy_from_user(&zoom->pp_frame_cmd, pp_cmd->value,
+			sizeof(zoom->pp_frame_cmd))) {
+			kfree(zoom);
+			return -EFAULT;
+		}
+		D("%s: src=0x%x, dest=0x%x,cookie=0x%x,action=0x%x,path=0x%x",
+				__func__, zoom->pp_frame_cmd.src_buf_handle,
+				zoom->pp_frame_cmd.dest_buf_handle,
+				zoom->pp_frame_cmd.cookie,
+				zoom->pp_frame_cmd.vpe_output_action,
+				zoom->pp_frame_cmd.path);
+		idx = msm_mctl_pp_path_to_inst_index(p_mctl->pcam_ptr,
+			zoom->pp_frame_cmd.path);
+		if (idx < 0) {
+			pr_err("%s Invalid path, returning\n", __func__);
+			kfree(zoom);
+			return idx;
+		}
+		pcam_inst = p_mctl->pcam_ptr->dev_inst[idx];
+		if (!pcam_inst) {
+			pr_err("%s Invalid instance, returning\n", __func__);
+			kfree(zoom);
+			return -EINVAL;
+		}
+		zoom->user_cmd = pp_cmd->id;
+		rc = msm_mctl_pp_get_phy_addr(pcam_inst,
+			zoom->pp_frame_cmd.src_buf_handle, &zoom->src_frame);
+		if (rc) {
+			kfree(zoom);
+			break;
+		}
+		rc = msm_mctl_pp_get_phy_addr(pcam_inst,
+			zoom->pp_frame_cmd.dest_buf_handle, &zoom->dest_frame);
+		if (rc) {
+			kfree(zoom);
+			break;
+		}
+		rc = msm_mctl_pp_copy_timestamp_and_frame_id(
+			zoom->pp_frame_cmd.src_buf_handle,
+
+			zoom->pp_frame_cmd.dest_buf_handle);
+		if (rc) {
+			kfree(zoom);
+			break;
+		}
+		rc = msm_mctl_pp_vpe_ioctl(
+			p_mctl->vpe_sdev, pp_cmd, (void *)zoom);
+		if (rc) {
+			kfree(zoom);
+			break;
+		}
+		break;
+	}
+	default:
+		rc = -1;
+		break;
+	}
+	return rc;
+}
+
 static int msm_mctl_pp_path_to_img_mode(int path)
 {
 	switch (path) {
@@ -411,16 +617,6 @@
 		return MSM_V4L2_EXT_CAPTURE_MODE_MAIN;
 	case OUTPUT_TYPE_T:
 		return MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL;
-	case OUTPUT_TYPE_SAEC:
-		return MSM_V4L2_EXT_CAPTURE_MODE_AEC;
-	case OUTPUT_TYPE_SAWB:
-		return MSM_V4L2_EXT_CAPTURE_MODE_AWB;
-	case OUTPUT_TYPE_SAFC:
-		return MSM_V4L2_EXT_CAPTURE_MODE_AF;
-	case OUTPUT_TYPE_IHST:
-		return MSM_V4L2_EXT_CAPTURE_MODE_IHIST;
-	case OUTPUT_TYPE_CSTA:
-		return MSM_V4L2_EXT_CAPTURE_MODE_CSTA;
 	default:
 		return -EINVAL;
 	}
@@ -430,18 +626,52 @@
 			struct msm_mctl_pp_cmd *pp_cmd)
 {
 	int rc = 0;
+	struct msm_mctl_pp_frame_buffer pp_buffer;
+	struct msm_frame_buffer *buf = NULL;
+	void __user *argp = (void __user *)pp_cmd->value;
+	int img_mode;
 	unsigned long flags;
 
 	switch (pp_cmd->id) {
+	case MCTL_CMD_GET_FRAME_BUFFER: {
+		if (copy_from_user(&pp_buffer, pp_cmd->value,
+				sizeof(pp_buffer)))
+			return -EFAULT;
+		img_mode = msm_mctl_pp_path_to_img_mode(pp_buffer.path);
+		if (img_mode < 0) {
+			pr_err("%s Invalid image mode\n", __func__);
+			return img_mode;
+		}
+		buf = msm_mctl_get_free_buf(p_mctl, img_mode);
+		pp_buffer.buf_handle = (uint32_t)buf;
+		if (copy_to_user((void *)argp,
+			&pp_buffer,
+			sizeof(struct msm_mctl_pp_frame_buffer))) {
+			ERR_COPY_TO_USER();
+			rc = -EFAULT;
+		}
+		break;
+	}
+	case MCTL_CMD_PUT_FRAME_BUFFER: {
+		if (copy_from_user(&pp_buffer, pp_cmd->value,
+				sizeof(pp_buffer)))
+			return -EFAULT;
+		img_mode = msm_mctl_pp_path_to_img_mode(pp_buffer.path);
+		if (img_mode < 0) {
+			pr_err("%s Invalid image mode\n", __func__);
+			return img_mode;
+		}
+		buf = (struct msm_frame_buffer *)pp_buffer.buf_handle;
+		msm_mctl_put_free_buf(p_mctl, img_mode, buf);
+		break;
+	}
 	case MCTL_CMD_DIVERT_FRAME_PP_PATH: {
 		struct msm_mctl_pp_divert_pp divert_pp;
 		if (copy_from_user(&divert_pp, pp_cmd->value,
-				sizeof(divert_pp))) {
-			ERR_COPY_FROM_USER();
+				sizeof(divert_pp)))
 			return -EFAULT;
-		}
-		D("%s: Divert Image mode =%d Enable %d",
-			__func__, divert_pp.path, divert_pp.enable);
+		D("%s: PP_PATH, path=%d",
+			__func__, divert_pp.path);
 		spin_lock_irqsave(&p_mctl->pp_info.lock, flags);
 		if (divert_pp.enable)
 			p_mctl->pp_info.pp_ctrl.pp_msg_type |= divert_pp.path;
@@ -471,6 +701,9 @@
 		return -EFAULT;
 
 	switch (pp_cmd.type) {
+	case MSM_PP_CMD_TYPE_VPE:
+		rc = msm_mctl_pp_proc_vpe_cmd(p_mctl, &pp_cmd.cmd);
+		break;
 	case MSM_PP_CMD_TYPE_MCTL:
 		rc = msm_mctl_pp_proc_cmd(p_mctl, &pp_cmd.cmd);
 		break;
@@ -479,7 +712,7 @@
 		break;
 	}
 	if (!rc) {
-		/* deep copy back the return value */
+		
 		if (copy_to_user((void *)arg,
 			&pp_cmd,
 			sizeof(struct msm_mctl_post_proc_cmd))) {
@@ -490,55 +723,106 @@
 	return rc;
 }
 
+int msm_mctl_pp_notify(struct msm_cam_media_controller *p_mctl,
+			struct msm_mctl_pp_frame_info *pp_frame_info)
+{
+		struct msm_mctl_pp_frame_cmd *pp_frame_cmd;
+		pp_frame_cmd = &pp_frame_info->pp_frame_cmd;
+
+		D("%s: msm_cam_evt_divert_frame=%d",
+			__func__, sizeof(struct msm_mctl_pp_event_info));
+		if ((MSM_MCTL_PP_VPE_FRAME_TO_APP &
+			pp_frame_cmd->vpe_output_action)) {
+			struct msm_free_buf done_frame;
+			int img_mode =
+				msm_mctl_pp_path_to_img_mode(
+					pp_frame_cmd->path);
+			if (img_mode < 0) {
+				pr_err("%s Invalid image mode\n", __func__);
+				return img_mode;
+			}
+			done_frame.ch_paddr[0] =
+				pp_frame_info->dest_frame.sp.phy_addr;
+			done_frame.vb =
+				pp_frame_info->dest_frame.handle;
+			msm_mctl_buf_done_pp(
+				p_mctl, img_mode, &done_frame, 0, 0);
+			D("%s: vpe done to app, vb=0x%x, path=%d, phy=0x%x",
+				__func__, done_frame.vb,
+				pp_frame_cmd->path, done_frame.ch_paddr[0]);
+		}
+		if ((MSM_MCTL_PP_VPE_FRAME_ACK &
+			pp_frame_cmd->vpe_output_action)) {
+			struct v4l2_event v4l2_evt;
+			struct msm_mctl_pp_event_info *pp_event_info;
+			struct msm_isp_event_ctrl *isp_event;
+			isp_event = kzalloc(sizeof(struct msm_isp_event_ctrl),
+								GFP_ATOMIC);
+			if (!isp_event) {
+				pr_err("%s Insufficient memory.", __func__);
+				return -ENOMEM;
+			}
+			memset(&v4l2_evt, 0, sizeof(v4l2_evt));
+			*((uint32_t *)v4l2_evt.u.data) = (uint32_t)isp_event;
+
+			
+			pp_event_info = &(isp_event->isp_data.pp_event_info);
+
+			pp_event_info->event = MCTL_PP_EVENT_CMD_ACK;
+			pp_event_info->ack.cmd = pp_frame_info->user_cmd;
+			pp_event_info->ack.status = 0;
+			pp_event_info->ack.cookie = pp_frame_cmd->cookie;
+			v4l2_evt.type = V4L2_EVENT_PRIVATE_START +
+						MSM_CAM_RESP_MCTL_PP_EVENT;
+
+			v4l2_event_queue(
+				p_mctl->config_device->
+					config_stat_event_queue.pvdev,
+				&v4l2_evt);
+			D("%s: ack to daemon, cookie=0x%x, event = 0x%x",
+				__func__, pp_frame_info->pp_frame_cmd.cookie,
+				v4l2_evt.type);
+		}
+		kfree(pp_frame_info); 
+		return 0;
+}
+
 int msm_mctl_pp_reserve_free_frame(
 	struct msm_cam_media_controller *p_mctl,
 	void __user *arg)
 {
-	struct msm_cam_evt_divert_frame div_frame;
+	struct msm_cam_evt_divert_frame frame;
 	int image_mode, rc = 0;
 	struct msm_free_buf free_buf;
 	struct msm_cam_v4l2_dev_inst *pcam_inst;
-	struct msm_cam_buf_handle buf_handle;
 
 	memset(&free_buf, 0, sizeof(struct msm_free_buf));
-	if (copy_from_user(&div_frame, arg,
-		sizeof(struct msm_cam_evt_divert_frame))) {
-		ERR_COPY_FROM_USER();
+	if (copy_from_user(&frame, arg,
+		sizeof(struct msm_cam_evt_divert_frame)))
 		return -EFAULT;
-	}
 
-	image_mode = div_frame.image_mode;
+	image_mode = frame.image_mode;
 	if (image_mode <= 0) {
 		pr_err("%s Invalid image mode %d", __func__, image_mode);
 		return -EINVAL;
 	}
-	/* Always reserve the buffer from user's video node */
-	pcam_inst = p_mctl->pcam_ptr->dev_inst_map[image_mode];
+	
+	pcam_inst = p_mctl->pcam_ptr->dev_inst[image_mode];
 	if (!pcam_inst) {
 		pr_err("%s Instance already closed ", __func__);
 		return -EINVAL;
 	}
-	D("%s Reserving free frame using %p inst handle %x ", __func__,
-		pcam_inst, div_frame.frame.inst_handle);
-	if (div_frame.frame.inst_handle) {
-		buf_handle.buf_lookup_type = BUF_LOOKUP_BY_INST_HANDLE;
-		buf_handle.inst_handle = div_frame.frame.inst_handle;
-	} else {
-		buf_handle.buf_lookup_type = BUF_LOOKUP_BY_IMG_MODE;
-		buf_handle.image_mode = image_mode;
-	}
 	rc = msm_mctl_reserve_free_buf(p_mctl, pcam_inst,
-					&buf_handle, &free_buf);
+					image_mode, &free_buf);
 	if (rc == 0) {
-		msm_mctl_pp_get_phy_addr(pcam_inst,
-			free_buf.vb, &div_frame.frame);
-		if (copy_to_user((void *)arg, &div_frame, sizeof(div_frame))) {
+		msm_mctl_pp_get_phy_addr(pcam_inst, free_buf.vb, &frame.frame);
+		if (copy_to_user((void *)arg, &frame, sizeof(frame))) {
 			ERR_COPY_TO_USER();
 			rc = -EFAULT;
 		}
 	}
-	D("%s: Got buffer %d from Inst %p rc = %d, phy = 0x%x",
-		__func__, div_frame.frame.buf_idx,
+	D("%s: reserve free buf got buffer %d from %p rc = %d, phy = 0x%x",
+		__func__, frame.frame.buf_idx,
 		pcam_inst, rc, free_buf.ch_paddr[0]);
 	return rc;
 }
@@ -552,13 +836,10 @@
 	struct msm_pp_frame *frame;
 	int image_mode, rc = 0;
 	struct msm_free_buf free_buf;
-	struct msm_cam_buf_handle buf_handle;
 
 	if (copy_from_user(&div_frame, arg,
-		sizeof(struct msm_cam_evt_divert_frame))) {
-		ERR_COPY_FROM_USER();
+		sizeof(struct msm_cam_evt_divert_frame)))
 		return -EFAULT;
-	}
 
 	image_mode = div_frame.image_mode;
 	if (image_mode < 0) {
@@ -571,23 +852,15 @@
 	else
 		free_buf.ch_paddr[0] = frame->sp.phy_addr;
 
-	if (div_frame.frame.inst_handle) {
-		buf_handle.buf_lookup_type = BUF_LOOKUP_BY_INST_HANDLE;
-		buf_handle.inst_handle = div_frame.frame.inst_handle;
-	} else {
-		buf_handle.buf_lookup_type = BUF_LOOKUP_BY_IMG_MODE;
-		buf_handle.image_mode = image_mode;
-	}
-	pcam_inst = msm_mctl_get_pcam_inst(p_mctl, &buf_handle);
+	pcam_inst = msm_mctl_get_pcam_inst(p_mctl, image_mode);
 	if (!pcam_inst) {
 		pr_err("%s Invalid instance. Cannot release frame.\n",
 			__func__);
 		return -EINVAL;
 	}
-	memset(&p_mctl->pp_info.div_frame[image_mode],
-		   0, sizeof(struct msm_free_buf));
 
-	rc = msm_mctl_release_free_buf(p_mctl, pcam_inst, &free_buf);
+	rc = msm_mctl_release_free_buf(p_mctl, pcam_inst,
+					image_mode, &free_buf);
 	D("%s: release free buf, rc = %d, phy = 0x%x",
 		__func__, rc, free_buf.ch_paddr[0]);
 
@@ -601,13 +874,11 @@
 	unsigned long flags;
 	spin_lock_irqsave(&p_mctl->pp_info.lock, flags);
 	if (copy_from_user(&p_mctl->pp_info.pp_key,
-			arg, sizeof(p_mctl->pp_info.pp_key))) {
-		ERR_COPY_FROM_USER();
+			arg, sizeof(p_mctl->pp_info.pp_key)))
 		rc = -EFAULT;
-	} else {
+	else
 		D("%s: mctl=0x%p, pp_key_setting=0x%x",
 			__func__, p_mctl, p_mctl->pp_info.pp_key);
-	}
 	spin_unlock_irqrestore(&p_mctl->pp_info.lock, flags);
 	return rc;
 }
@@ -621,26 +892,13 @@
 	int dirty = 0;
 	struct msm_free_buf buf;
 	unsigned long flags;
-	struct msm_cam_buf_handle buf_handle;
-	struct msm_cam_return_frame_info ret_frame;
 
-	if (copy_from_user(&frame, arg, sizeof(frame))) {
-		ERR_COPY_FROM_USER();
+	if (copy_from_user(&frame, arg, sizeof(frame)))
 		return -EFAULT;
-	}
 
 	spin_lock_irqsave(&p_mctl->pp_info.lock, flags);
-	if (frame.inst_handle) {
-		buf_handle.buf_lookup_type = BUF_LOOKUP_BY_INST_HANDLE;
-		buf_handle.inst_handle = frame.inst_handle;
-		image_mode = GET_IMG_MODE(frame.inst_handle);
-	} else {
-		buf_handle.buf_lookup_type = BUF_LOOKUP_BY_IMG_MODE;
-		buf_handle.image_mode =
-			msm_mctl_pp_path_to_img_mode(frame.path);
-		image_mode = buf_handle.image_mode;
-	}
-	if (image_mode < 0 || image_mode >= MSM_MAX_IMG_MODE) {
+	image_mode = msm_mctl_pp_path_to_img_mode(frame.path);
+	if (image_mode < 0) {
 		pr_err("%s Invalid image mode\n", __func__);
 		return image_mode;
 	}
@@ -654,7 +912,7 @@
 			0, sizeof(buf));
 		if (p_mctl->pp_info.cur_frame_id[image_mode] !=
 					frame.frame_id) {
-			/* dirty frame. should not pass to app */
+			
 			dirty = 1;
 		}
 	} else {
@@ -665,14 +923,8 @@
 			buf.ch_paddr[0] = frame.sp.phy_addr + frame.sp.y_off;
 	}
 	spin_unlock_irqrestore(&p_mctl->pp_info.lock, flags);
-
-	ret_frame.dirty = dirty;
-	ret_frame.node_type = 0;
-	ret_frame.timestamp = frame.timestamp;
-	ret_frame.frame_id   = frame.frame_id;
-	D("%s frame_id: %d buffer idx %d\n", __func__,
-		frame.frame_id, frame.buf_idx);
-	rc = msm_mctl_buf_done_pp(p_mctl, &buf_handle, &buf, &ret_frame);
+	
+	rc = msm_mctl_buf_done_pp(p_mctl, image_mode, &buf, dirty, 0);
 	return rc;
 }
 
@@ -681,26 +933,37 @@
 	void __user *arg)
 {
 	struct msm_pp_frame frame;
-	int rc = 0;
+	int msg_type, image_mode, rc = 0;
+	int dirty = 0;
 	struct msm_free_buf buf;
 	unsigned long flags;
-	struct msm_cam_buf_handle buf_handle;
-	struct msm_cam_return_frame_info ret_frame;
-
 	D("%s enter\n", __func__);
 
-	if (copy_from_user(&frame, arg, sizeof(frame))) {
-		ERR_COPY_FROM_USER();
+	if (copy_from_user(&frame, arg, sizeof(frame)))
 		return -EFAULT;
-	}
 
 	spin_lock_irqsave(&p_mctl->pp_info.lock, flags);
-	if (frame.inst_handle) {
-		buf_handle.buf_lookup_type = BUF_LOOKUP_BY_INST_HANDLE;
-		buf_handle.inst_handle = frame.inst_handle;
-	} else {
-		buf_handle.buf_lookup_type = BUF_LOOKUP_BY_IMG_MODE;
-		buf_handle.image_mode = frame.image_type;
+	D("%s Frame path: %d\n", __func__, frame.path);
+	switch (frame.path) {
+	case OUTPUT_TYPE_P:
+		msg_type = VFE_MSG_OUTPUT_P;
+		image_mode = MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW;
+		break;
+	case OUTPUT_TYPE_S:
+		msg_type = VFE_MSG_OUTPUT_S;
+		image_mode = MSM_V4L2_EXT_CAPTURE_MODE_MAIN;
+		break;
+	case OUTPUT_TYPE_V:
+		msg_type = VFE_MSG_OUTPUT_V;
+		image_mode = MSM_V4L2_EXT_CAPTURE_MODE_VIDEO;
+		break;
+	case OUTPUT_TYPE_T:
+		msg_type = VFE_MSG_OUTPUT_T;
+		image_mode = MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL;
+		break;
+	default:
+		rc = -EFAULT;
+		goto err;
 	}
 
 	if (frame.num_planes > 1)
@@ -710,13 +973,12 @@
 		buf.ch_paddr[0] = frame.sp.phy_addr + frame.sp.y_off;
 
 	spin_unlock_irqrestore(&p_mctl->pp_info.lock, flags);
-
-	ret_frame.dirty = 0;
-	ret_frame.node_type = frame.node_type;
-	ret_frame.timestamp = frame.timestamp;
-	ret_frame.frame_id  = frame.frame_id;
 	D("%s Frame done id: %d\n", __func__, frame.frame_id);
-	rc = msm_mctl_buf_done_pp(p_mctl, &buf_handle, &buf, &ret_frame);
+	rc = msm_mctl_buf_done_pp(p_mctl, image_mode,
+		&buf, dirty, frame.node_type);
+	return rc;
+err:
+	spin_unlock_irqrestore(&p_mctl->pp_info.lock, flags);
 	return rc;
 }
 
diff --git a/drivers/media/video/msm/msm_mem.c b/drivers/media/video/msm/msm_mem.c
index a32704d..34ff87ba 100644
--- a/drivers/media/video/msm/msm_mem.c
+++ b/drivers/media/video/msm/msm_mem.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -11,6 +11,7 @@
  *
  */
 
+#include <linux/module.h>
 #include <linux/workqueue.h>
 #include <linux/delay.h>
 #include <linux/types.h>
@@ -116,7 +117,7 @@
 }
 
 static int msm_pmem_table_add(struct hlist_head *ptype,
-	struct msm_pmem_info *info, struct ion_client *client, int domain_num)
+	struct msm_pmem_info *info, struct ion_client *client)
 {
 	unsigned long paddr;
 #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
@@ -135,7 +136,7 @@
 	region->handle = ion_import_dma_buf(client, info->fd);
 	if (IS_ERR_OR_NULL(region->handle))
 		goto out1;
-	if (ion_map_iommu(client, region->handle, domain_num, 0,
+	if (ion_map_iommu(client, region->handle, CAMERA_DOMAIN, GEN_POOL,
 				  SZ_4K, 0, &paddr, &len, 0, 0) < 0)
 		goto out2;
 #elif CONFIG_ANDROID_PMEM
@@ -180,7 +181,7 @@
 	return 0;
 out3:
 #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_unmap_iommu(client, region->handle, domain_num, 0);
+	ion_unmap_iommu(client, region->handle, CAMERA_DOMAIN, GEN_POOL);
 #endif
 #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
 out2:
@@ -195,8 +196,7 @@
 }
 
 static int __msm_register_pmem(struct hlist_head *ptype,
-			struct msm_pmem_info *pinfo, struct ion_client *client,
-			int domain_num)
+			struct msm_pmem_info *pinfo, struct ion_client *client)
 {
 	int rc = 0;
 
@@ -209,10 +209,7 @@
 	case MSM_PMEM_IHIST:
 	case MSM_PMEM_SKIN:
 	case MSM_PMEM_AEC_AWB:
-	case MSM_PMEM_BAYER_GRID:
-	case MSM_PMEM_BAYER_FOCUS:
-	case MSM_PMEM_BAYER_HIST:
-		rc = msm_pmem_table_add(ptype, pinfo, client, domain_num);
+		rc = msm_pmem_table_add(ptype, pinfo, client);
 		break;
 
 	default:
@@ -224,8 +221,7 @@
 }
 
 static int __msm_pmem_table_del(struct hlist_head *ptype,
-			struct msm_pmem_info *pinfo, struct ion_client *client,
-			int domain_num)
+			struct msm_pmem_info *pinfo, struct ion_client *client)
 {
 	int rc = 0;
 	struct msm_pmem_region *region;
@@ -240,9 +236,6 @@
 	case MSM_PMEM_IHIST:
 	case MSM_PMEM_SKIN:
 	case MSM_PMEM_AEC_AWB:
-	case MSM_PMEM_BAYER_GRID:
-	case MSM_PMEM_BAYER_FOCUS:
-	case MSM_PMEM_BAYER_HIST:
 		hlist_for_each_entry_safe(region, node, n,
 				ptype, list) {
 
@@ -252,7 +245,7 @@
 				hlist_del(node);
 #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
 				ion_unmap_iommu(client, region->handle,
-					domain_num, 0);
+					CAMERA_DOMAIN, GEN_POOL);
 				ion_free(client, region->handle);
 #else
 				put_pmem_file(region->file);
@@ -270,7 +263,6 @@
 	return rc;
 }
 
-/* return of 0 means failure */
 uint8_t msm_pmem_region_lookup(struct hlist_head *ptype,
 	int pmem_type, struct msm_pmem_region *reg, uint8_t maxcount)
 {
@@ -384,8 +376,6 @@
 	hlist_for_each_entry_safe(region, node, n,
 	&mctl->stats_info.pmem_stats_list, list) {
 		if (addr == region->paddr && region->info.active) {
-			/* offset since we could pass vaddr inside a
-			 * registered pmem buffer */
 			*fd = region->info.fd;
 			region->info.active = 0;
 			return (unsigned long)(region->info.vaddr);
@@ -396,8 +386,7 @@
 }
 
 int msm_register_pmem(struct hlist_head *ptype, void __user *arg,
-					struct ion_client *client,
-					int domain_num)
+					  struct ion_client *client)
 {
 	struct msm_pmem_info info;
 
@@ -406,12 +395,12 @@
 			return -EFAULT;
 	}
 
-	return __msm_register_pmem(ptype, &info, client, domain_num);
+	return __msm_register_pmem(ptype, &info, client);
 }
-//EXPORT_SYMBOL(msm_register_pmem);
+EXPORT_SYMBOL(msm_register_pmem);
 
 int msm_pmem_table_del(struct hlist_head *ptype, void __user *arg,
-			struct ion_client *client, int domain_num)
+					   struct ion_client *client)
 {
 	struct msm_pmem_info info;
 
@@ -420,6 +409,6 @@
 		return -EFAULT;
 	}
 
-	return __msm_pmem_table_del(ptype, &info, client, domain_num);
+	return __msm_pmem_table_del(ptype, &info, client);
 }
-//EXPORT_SYMBOL(msm_pmem_table_del);
+EXPORT_SYMBOL(msm_pmem_table_del);
diff --git a/drivers/media/video/msm/msm_v4l2_video.c b/drivers/media/video/msm/msm_v4l2_video.c
deleted file mode 100644
index fb46cc1..0000000
--- a/drivers/media/video/msm/msm_v4l2_video.c
+++ /dev/null
@@ -1,947 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/init.h>
-#include <linux/fb.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/time.h>
-#include <linux/videodev2.h>
-#include <linux/platform_device.h>
-#include <linux/file.h>
-#include <linux/fs.h>
-#include <linux/msm_mdp.h>
-#include <linux/sched.h>
-#include <linux/capability.h>
-
-#include <media/v4l2-ioctl.h>
-#include <media/videobuf-dma-sg.h>
-#include <media/v4l2-dev.h>
-#include <media/msm_v4l2_overlay.h>
-
-#include <mach/board.h>
-#include <mach/msm_fb.h>
-
-#include "msm_v4l2_video.h"
-
-#define MSM_VIDEO -1
-
-static struct msm_v4l2_overlay_device	*saved_vout0;
-
-static struct mutex msmfb_lock;
-static char *v4l2_ram_phys;
-static unsigned int v4l2_ram_size;
-
-static int msm_v4l2_overlay_mapformat(uint32_t pixelformat);
-
-static int msm_v4l2_overlay_startstreaming(struct msm_v4l2_overlay_device *vout)
-{
-	vout->req.src.width = vout->pix.width;
-	vout->req.src.height = vout->pix.height;
-
-	vout->req.src_rect.x = vout->crop_rect.left;
-	vout->req.src_rect.y = vout->crop_rect.top;
-	vout->req.src_rect.w = vout->crop_rect.width;
-	vout->req.src_rect.h = vout->crop_rect.height;
-
-	vout->req.src.format =
-		msm_v4l2_overlay_mapformat(vout->pix.pixelformat);
-
-	vout->req.dst_rect.x = vout->win.w.left;
-	vout->req.dst_rect.y = vout->win.w.top;
-	vout->req.dst_rect.w = vout->win.w.width;
-	vout->req.dst_rect.h = vout->win.w.height;
-
-	vout->req.alpha = MDP_ALPHA_NOP;
-	vout->req.transp_mask = MDP_TRANSP_NOP;
-
-	pr_debug("msm_v4l2_overlay:startstreaming:enabling fb\n");
-	mutex_lock(&msmfb_lock);
-	msm_fb_v4l2_enable(&vout->req, true, &vout->par);
-	mutex_unlock(&msmfb_lock);
-
-	vout->streaming = 1;
-
-	return 0;
-}
-
-static int msm_v4l2_overlay_stopstreaming(struct msm_v4l2_overlay_device *vout)
-{
-	if (!vout->streaming)
-		return 0;
-
-	pr_debug("msm_v4l2_overlay:startstreaming:disabling fb\n");
-	mutex_lock(&msmfb_lock);
-	msm_fb_v4l2_enable(&vout->req, false, &vout->par);
-	mutex_unlock(&msmfb_lock);
-
-	vout->streaming = 0;
-
-	return 0;
-}
-
-static int msm_v4l2_overlay_mapformat(uint32_t pixelformat)
-{
-	int mdp_format;
-
-	switch (pixelformat) {
-	case V4L2_PIX_FMT_RGB565:
-		mdp_format = MDP_RGB_565;
-		break;
-	case V4L2_PIX_FMT_RGB32:
-		mdp_format = MDP_ARGB_8888;
-		break;
-	case V4L2_PIX_FMT_RGB24:
-		mdp_format = MDP_RGB_888;
-		break;
-	case V4L2_PIX_FMT_NV12:
-		mdp_format = MDP_Y_CRCB_H2V2;
-		break;
-	case V4L2_PIX_FMT_NV21:
-		mdp_format = MDP_Y_CBCR_H2V2;
-		break;
-	case V4L2_PIX_FMT_YUV420:
-		mdp_format = MDP_Y_CR_CB_H2V2;
-		break;
-	default:
-		pr_err("%s:Unrecognized format %u\n", __func__, pixelformat);
-		mdp_format = MDP_Y_CBCR_H2V2;
-		break;
-	}
-
-	return mdp_format;
-}
-
-static int
-msm_v4l2_overlay_fb_update(struct msm_v4l2_overlay_device *vout,
-	struct v4l2_buffer *buffer)
-{
-	int ret;
-	unsigned long src_addr, src_size;
-	struct msm_v4l2_overlay_userptr_buffer up_buffer;
-
-	if (!buffer ||
-		(buffer->memory == V4L2_MEMORY_MMAP &&
-		 buffer->index >= vout->numbufs))
-		return -EINVAL;
-
-	mutex_lock(&msmfb_lock);
-	switch (buffer->memory) {
-	case V4L2_MEMORY_MMAP:
-		src_addr = (unsigned long)v4l2_ram_phys
-		+ vout->bufs[buffer->index].offset;
-		src_size = buffer->bytesused;
-		ret = msm_fb_v4l2_update(vout->par, src_addr, src_size,
-		0, 0, 0, 0);
-		break;
-	case V4L2_MEMORY_USERPTR:
-		if (copy_from_user(&up_buffer,
-		(void __user *)buffer->m.userptr,
-		sizeof(struct msm_v4l2_overlay_userptr_buffer))) {
-			mutex_unlock(&msmfb_lock);
-			return -EINVAL;
-		}
-		ret = msm_fb_v4l2_update(vout->par,
-		(unsigned long)up_buffer.base[0], up_buffer.length[0],
-		(unsigned long)up_buffer.base[1], up_buffer.length[1],
-		(unsigned long)up_buffer.base[2], up_buffer.length[2]);
-		break;
-	default:
-		mutex_unlock(&msmfb_lock);
-		return -EINVAL;
-	}
-	mutex_unlock(&msmfb_lock);
-
-	if (buffer->memory == V4L2_MEMORY_MMAP) {
-		vout->bufs[buffer->index].queued = 1;
-		buffer->flags |= V4L2_BUF_FLAG_MAPPED;
-	}
-	buffer->flags |= V4L2_BUF_FLAG_QUEUED;
-
-	return ret;
-}
-
-static int
-msm_v4l2_overlay_vidioc_dqbuf(struct file *file,
-	struct msm_v4l2_overlay_fh *fh, void *arg)
-{
-	struct msm_v4l2_overlay_device *vout = fh->vout;
-	struct v4l2_buffer *buffer = arg;
-	int i;
-
-	if (!vout->streaming) {
-		pr_err("%s: Video Stream not enabled\n", __func__);
-		return -EINVAL;
-	}
-
-	if (!buffer || buffer->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
-		return -EINVAL;
-
-	if (buffer->memory == V4L2_MEMORY_MMAP) {
-		for (i = 0; i < vout->numbufs; i++) {
-			if (vout->bufs[i].queued == 1)  {
-				vout->bufs[i].queued = 0;
-				/* Call into fb to remove this buffer? */
-				break;
-			}
-		}
-
-		/*
-		 * This should actually block, unless O_NONBLOCK was
-		 *  specified in open, but fine for now, especially
-		 *  since this is not a capturing device
-		 */
-		if (i == vout->numbufs)
-			return -EAGAIN;
-	}
-
-	buffer->flags &= ~V4L2_BUF_FLAG_QUEUED;
-
-	return 0;
-}
-
-
-static int
-msm_v4l2_overlay_vidioc_qbuf(struct file *file, struct msm_v4l2_overlay_fh* fh,
-	void *arg, bool bUserPtr)
-{
-	struct msm_v4l2_overlay_device *vout = fh->vout;
-	struct v4l2_buffer *buffer = arg;
-	int ret;
-
-	if (!bUserPtr && buffer->memory != V4L2_MEMORY_MMAP)
-		return -EINVAL;
-
-	if (!vout->streaming) {
-		pr_err("%s: Video Stream not enabled\n", __func__);
-		return -EINVAL;
-	}
-
-	if (!buffer || buffer->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
-		return -EINVAL;
-
-	/* maybe allow only one qbuf at a time? */
-	ret =  msm_v4l2_overlay_fb_update(vout, buffer);
-
-	return 0;
-}
-
-static int
-msm_v4l2_overlay_vidioc_querycap(struct file *file, void *arg)
-{
-	struct v4l2_capability *buffer = arg;
-
-	memset(buffer, 0, sizeof(struct v4l2_capability));
-	strlcpy(buffer->driver, "msm_v4l2_video_overlay",
-		ARRAY_SIZE(buffer->driver));
-	strlcpy(buffer->card, "MSM MDP",
-		ARRAY_SIZE(buffer->card));
-	buffer->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OUTPUT
-		| V4L2_CAP_VIDEO_OVERLAY;
-	return 0;
-}
-
-static int
-msm_v4l2_overlay_vidioc_fbuf(struct file *file,
-	struct msm_v4l2_overlay_device *vout, void *arg, bool get)
-{
-	struct v4l2_framebuffer *fb = arg;
-
-	if (fb == NULL)
-		return -EINVAL;
-
-	if (get) {
-		mutex_lock(&vout->update_lock);
-		memcpy(&fb->fmt, &vout->pix, sizeof(struct v4l2_pix_format));
-		mutex_unlock(&vout->update_lock);
-	}
-	/* The S_FBUF request does not store anything right now */
-	return 0;
-}
-
-static long msm_v4l2_overlay_calculate_bufsize(struct v4l2_pix_format *pix)
-{
-	int bpp;
-	long bufsize;
-	switch (pix->pixelformat) {
-	case V4L2_PIX_FMT_YUV420:
-	case V4L2_PIX_FMT_NV12:
-		bpp = 12;
-		break;
-
-	case V4L2_PIX_FMT_RGB565:
-		bpp = 16;
-		break;
-
-	case V4L2_PIX_FMT_RGB24:
-	case V4L2_PIX_FMT_BGR24:
-	case V4L2_PIX_FMT_YUV444:
-		bpp = 24;
-		break;
-
-	case V4L2_PIX_FMT_RGB32:
-	case V4L2_PIX_FMT_BGR32:
-		bpp = 32;
-		break;
-	default:
-		pr_err("%s: Unrecognized format %u\n", __func__,
-		pix->pixelformat);
-		bpp = 0;
-	}
-
-	bufsize = (pix->width * pix->height * bpp)/8;
-
-	return bufsize;
-}
-
-static long
-msm_v4l2_overlay_vidioc_reqbufs(struct file *file,
-	struct msm_v4l2_overlay_device *vout, void *arg)
-
-{
-	struct v4l2_requestbuffers *rqb = arg;
-	long bufsize;
-	int i;
-
-	if (rqb == NULL || rqb->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
-		return -EINVAL;
-
-	if (rqb->memory == V4L2_MEMORY_MMAP) {
-		if (rqb->count == 0) {
-			/* Deallocate allocated buffers */
-			mutex_lock(&vout->update_lock);
-			vout->numbufs = 0;
-			kfree(vout->bufs);
-			/*
-			 * There should be a way to look at bufs[i]->mapped,
-			 * and prevent userspace from mmaping and directly
-			 * calling this ioctl without unmapping. Maybe kernel
-			 * handles for us, but needs to be checked out
-			 */
-			mutex_unlock(&vout->update_lock);
-		} else {
-			/*
-			 * Keep it simple for now - need to deallocate
-			 * before reallocate
-			 */
-			if (vout->bufs)
-				return -EINVAL;
-
-			mutex_lock(&vout->update_lock);
-			bufsize =
-				msm_v4l2_overlay_calculate_bufsize(&vout->pix);
-			mutex_unlock(&vout->update_lock);
-
-			if (bufsize == 0
-				|| (bufsize * rqb->count) > v4l2_ram_size) {
-				pr_err("%s: Unsupported format or buffer size too large\n",
-				__func__);
-				pr_err("%s: bufsize %lu ram_size %u count %u\n",
-				__func__, bufsize, v4l2_ram_size, rqb->count);
-				return -EINVAL;
-			}
-
-			/*
-			 * We don't support multiple open of one vout,
-			 * but there are probably still some MT problems here,
-			 * (what if same fh is shared between two userspace
-			 * threads and they both call REQBUFS etc)
-			 */
-
-			mutex_lock(&vout->update_lock);
-			vout->numbufs = rqb->count;
-			vout->bufs =
-				kmalloc(rqb->count *
-					sizeof(struct msm_v4l2_overlay_buffer),
-					GFP_KERNEL);
-
-			for (i = 0; i < rqb->count; i++) {
-				struct msm_v4l2_overlay_buffer *b =
-				(struct msm_v4l2_overlay_buffer *)vout->bufs
-				+ i;
-				b->mapped = 0;
-				b->queued = 0;
-				b->offset = PAGE_ALIGN(bufsize*i);
-				b->bufsize = bufsize;
-			}
-
-			mutex_unlock(&vout->update_lock);
-
-		}
-	}
-
-	return 0;
-}
-
-static long
-msm_v4l2_overlay_vidioc_querybuf(struct file *file,
-				 struct msm_v4l2_overlay_device *vout,
-				 void *arg)
-{
-	struct v4l2_buffer *buf = arg;
-	struct msm_v4l2_overlay_buffer *mbuf;
-
-	if (buf == NULL || buf->type != V4L2_BUF_TYPE_VIDEO_OUTPUT
-			|| buf->memory == V4L2_MEMORY_USERPTR
-			|| buf->index >= vout->numbufs)
-		return -EINVAL;
-
-	mutex_lock(&vout->update_lock);
-
-	mbuf = (struct msm_v4l2_overlay_buffer *)vout->bufs + buf->index;
-	buf->flags = 0;
-	if (mbuf->mapped)
-		buf->flags |= V4L2_BUF_FLAG_MAPPED;
-	if (mbuf->queued)
-		buf->flags |= V4L2_BUF_FLAG_QUEUED;
-
-	buf->memory = V4L2_MEMORY_MMAP;
-	buf->length = mbuf->bufsize;
-	buf->m.offset = mbuf->offset;
-
-	mutex_unlock(&vout->update_lock);
-
-	return 0;
-}
-
-static long
-msm_v4l2_overlay_do_ioctl(struct file *file,
-		       unsigned int cmd, void *arg)
-{
-	struct msm_v4l2_overlay_fh *fh = file->private_data;
-	struct msm_v4l2_overlay_device *vout = fh->vout;
-	int ret;
-
-	switch (cmd) {
-	case VIDIOC_QUERYCAP:
-		return msm_v4l2_overlay_vidioc_querycap(file, arg);
-
-	case VIDIOC_G_FBUF:
-		return msm_v4l2_overlay_vidioc_fbuf(file, vout, arg, true);
-
-	case VIDIOC_S_FBUF:
-		return msm_v4l2_overlay_vidioc_fbuf(file, vout, arg, false);
-
-	case VIDIOC_REQBUFS:
-		return msm_v4l2_overlay_vidioc_reqbufs(file, vout, arg);
-
-	case VIDIOC_QUERYBUF:
-		return msm_v4l2_overlay_vidioc_querybuf(file, vout, arg);
-
-	case VIDIOC_QBUF:
-		mutex_lock(&vout->update_lock);
-		ret = msm_v4l2_overlay_vidioc_qbuf(file, fh, arg, false);
-		mutex_unlock(&vout->update_lock);
-
-		return ret;
-
-	case VIDIOC_MSM_USERPTR_QBUF:
-		if (!capable(CAP_SYS_RAWIO))
-			return -EPERM;
-
-		mutex_lock(&vout->update_lock);
-		ret = msm_v4l2_overlay_vidioc_qbuf(file, fh, arg, true);
-		mutex_unlock(&vout->update_lock);
-
-		return ret;
-
-	case VIDIOC_DQBUF:
-		mutex_lock(&vout->update_lock);
-		ret = msm_v4l2_overlay_vidioc_dqbuf(file, fh, arg);
-		mutex_unlock(&vout->update_lock);
-		break;
-
-	case VIDIOC_S_FMT: {
-		struct v4l2_format *f = arg;
-
-		switch (f->type) {
-		case V4L2_BUF_TYPE_VIDEO_OVERLAY:
-			mutex_lock(&vout->update_lock);
-			memcpy(&vout->win, &f->fmt.win,
-				sizeof(struct v4l2_window));
-			mutex_unlock(&vout->update_lock);
-			break;
-
-		case V4L2_BUF_TYPE_VIDEO_OUTPUT:
-			mutex_lock(&vout->update_lock);
-			memcpy(&vout->pix, &f->fmt.pix,
-				sizeof(struct v4l2_pix_format));
-			mutex_unlock(&vout->update_lock);
-			break;
-
-		default:
-			return -EINVAL;
-		}
-		break;
-	}
-	case VIDIOC_G_FMT: {
-		struct v4l2_format *f = arg;
-
-		switch (f->type) {
-		case V4L2_BUF_TYPE_VIDEO_OUTPUT: {
-			struct v4l2_pix_format *pix = &f->fmt.pix;
-			memset(pix, 0, sizeof(*pix));
-			*pix = vout->pix;
-			break;
-		}
-
-		case V4L2_BUF_TYPE_VIDEO_OVERLAY: {
-			struct v4l2_window *win = &f->fmt.win;
-			memset(win, 0, sizeof(*win));
-			win->w = vout->win.w;
-			break;
-		}
-		default:
-			return -EINVAL;
-		}
-		break;
-	}
-
-	case VIDIOC_CROPCAP: {
-		struct v4l2_cropcap *cr = arg;
-		if (cr->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
-			return -EINVAL;
-
-		cr->bounds.left =  0;
-		cr->bounds.top = 0;
-		cr->bounds.width = vout->crop_rect.width;
-		cr->bounds.height = vout->crop_rect.height;
-
-		cr->defrect.left =  0;
-		cr->defrect.top = 0;
-		cr->defrect.width = vout->crop_rect.width;
-		cr->defrect.height = vout->crop_rect.height;
-
-		cr->pixelaspect.numerator = 1;
-		cr->pixelaspect.denominator = 1;
-		break;
-	}
-
-	case VIDIOC_S_CROP: {
-		struct v4l2_crop *crop = arg;
-
-		switch (crop->type) {
-
-		case V4L2_BUF_TYPE_VIDEO_OUTPUT:
-
-			mutex_lock(&vout->update_lock);
-			memcpy(&vout->crop_rect, &crop->c,
-				sizeof(struct v4l2_rect));
-			mutex_unlock(&vout->update_lock);
-
-			break;
-
-		default:
-
-			return -EINVAL;
-		}
-		break;
-	}
-	case VIDIOC_G_CROP: {
-		struct v4l2_crop *crop = arg;
-
-		switch (crop->type) {
-
-		case V4L2_BUF_TYPE_VIDEO_OUTPUT:
-			memcpy(&crop->c, &vout->crop_rect,
-				sizeof(struct v4l2_rect));
-			break;
-
-		default:
-			return -EINVAL;
-		}
-		break;
-	}
-
-	case VIDIOC_S_CTRL: {
-		struct v4l2_control *ctrl = arg;
-		int32_t rotflag;
-
-		switch (ctrl->id) {
-
-		case V4L2_CID_ROTATE:
-			switch (ctrl->value) {
-			case 0:
-				rotflag = MDP_ROT_NOP;
-				break;
-			case 90:
-				rotflag = MDP_ROT_90;
-				break;
-			case 180:
-				rotflag = MDP_ROT_180;
-				break;
-			case 270:
-				rotflag = MDP_ROT_270;
-				break;
-			default:
-				pr_err("%s: V4L2_CID_ROTATE invalid rotation value %d.\n",
-						__func__, ctrl->value);
-				return -ERANGE;
-			}
-
-			mutex_lock(&vout->update_lock);
-			/* Clear the rotation flags */
-			vout->req.flags &= ~MDP_ROT_NOP;
-			vout->req.flags &= ~MDP_ROT_90;
-			vout->req.flags &= ~MDP_ROT_180;
-			vout->req.flags &= ~MDP_ROT_270;
-			/* Set the new rotation flag */
-			vout->req.flags |= rotflag;
-			mutex_unlock(&vout->update_lock);
-
-			break;
-
-		case V4L2_CID_HFLIP:
-			mutex_lock(&vout->update_lock);
-			/* Clear the flip flag */
-			vout->req.flags &= ~MDP_FLIP_LR;
-			if (true == ctrl->value)
-				vout->req.flags |= MDP_FLIP_LR;
-			mutex_unlock(&vout->update_lock);
-
-			break;
-
-		case V4L2_CID_VFLIP:
-			mutex_lock(&vout->update_lock);
-			/* Clear the flip flag */
-			vout->req.flags &= ~MDP_FLIP_UD;
-			if (true == ctrl->value)
-				vout->req.flags |= MDP_FLIP_UD;
-			mutex_unlock(&vout->update_lock);
-
-			break;
-
-		default:
-			pr_err("%s: VIDIOC_S_CTRL invalid control ID %d.\n",
-			__func__, ctrl->id);
-			return -EINVAL;
-		}
-		break;
-	}
-	case VIDIOC_G_CTRL: {
-		struct v4l2_control *ctrl = arg;
-		__s32 rotation;
-
-		switch (ctrl->id) {
-
-		case V4L2_CID_ROTATE:
-			if (MDP_ROT_NOP == (vout->req.flags & MDP_ROT_NOP))
-				rotation = 0;
-			if (MDP_ROT_90 == (vout->req.flags & MDP_ROT_90))
-				rotation = 90;
-			if (MDP_ROT_180 == (vout->req.flags & MDP_ROT_180))
-				rotation = 180;
-			if (MDP_ROT_270 == (vout->req.flags & MDP_ROT_270))
-				rotation = 270;
-
-			ctrl->value = rotation;
-			break;
-
-		case V4L2_CID_HFLIP:
-			if (MDP_FLIP_LR == (vout->req.flags & MDP_FLIP_LR))
-				ctrl->value = true;
-			break;
-
-		case V4L2_CID_VFLIP:
-			if (MDP_FLIP_UD == (vout->req.flags & MDP_FLIP_UD))
-				ctrl->value = true;
-			break;
-
-		default:
-			pr_err("%s: VIDIOC_G_CTRL invalid control ID %d.\n",
-			__func__, ctrl->id);
-			return -EINVAL;
-		}
-		break;
-	}
-
-	case VIDIOC_STREAMON: {
-
-		if (vout->streaming) {
-			pr_err("%s: VIDIOC_STREAMON: already streaming.\n",
-			__func__);
-			return -EBUSY;
-		}
-
-		mutex_lock(&vout->update_lock);
-		msm_v4l2_overlay_startstreaming(vout);
-		mutex_unlock(&vout->update_lock);
-
-		break;
-	}
-
-	case VIDIOC_STREAMOFF: {
-
-		if (!vout->streaming) {
-			pr_err("%s: VIDIOC_STREAMOFF: not currently streaming.\n",
-			__func__);
-			return -EINVAL;
-		}
-
-		mutex_lock(&vout->update_lock);
-		msm_v4l2_overlay_stopstreaming(vout);
-		mutex_unlock(&vout->update_lock);
-
-		break;
-	}
-
-	default:
-		return -ENOIOCTLCMD;
-
-	} /* switch */
-
-	return 0;
-}
-
-static long
-msm_v4l2_overlay_ioctl(struct file *file, unsigned int cmd,
-		    unsigned long arg)
-{
-	return video_usercopy(file, cmd, arg, msm_v4l2_overlay_do_ioctl);
-}
-
-static int
-msm_v4l2_overlay_mmap(struct file *filp, struct vm_area_struct * vma)
-{
-	unsigned long start = (unsigned long)v4l2_ram_phys;
-
-	/*
-	 * vm_pgoff is the offset (>>PAGE_SHIFT) that we provided
-	 * during REQBUFS. off therefore should equal the offset we
-	 * provided in REQBUFS, since last (PAGE_SHIFT) bits of off
-	 * should be 0
-	 */
-	unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
-	u32 len = PAGE_ALIGN((start & ~PAGE_MASK) + v4l2_ram_size);
-
-	/*
-	 * This is probably unnecessary now - the last PAGE_SHIFT
-	 * bits of start should be 0 now, since we are page aligning
-	 * v4l2_ram_phys
-	 */
-	start &= PAGE_MASK;
-
-	pr_debug("v4l2 map req for phys(%p,%p) offset %u to virt (%p,%p)\n",
-	(void *)(start+off), (void *)(start+off+(vma->vm_end - vma->vm_start)),
-	(unsigned int)off, (void *)vma->vm_start, (void *)vma->vm_end);
-
-	if ((vma->vm_end - vma->vm_start + off) > len) {
-		pr_err("v4l2 map request, memory requested too big\n");
-		return -EINVAL;
-	}
-
-	start += off;
-	vma->vm_pgoff = start >> PAGE_SHIFT;
-	/* This is an IO map - tell maydump to skip this VMA */
-	vma->vm_flags |= VM_IO | VM_RESERVED;
-
-	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-
-	/* Remap the frame buffer I/O range */
-	if (io_remap_pfn_range(vma, vma->vm_start, start >> PAGE_SHIFT,
-				vma->vm_end - vma->vm_start,
-				vma->vm_page_prot))
-		return -EAGAIN;
-
-	return 0;
-}
-
-static int
-msm_v4l2_overlay_release(struct file *file)
-{
-	struct msm_v4l2_overlay_fh *fh = file->private_data;
-	struct msm_v4l2_overlay_device *vout = fh->vout;
-
-	if (vout->streaming)
-		msm_v4l2_overlay_stopstreaming(vout);
-
-	vout->ref_count--;
-
-	kfree(vout->bufs);
-	vout->numbufs = 0;
-	kfree(fh);
-
-	return 0;
-}
-
-static int
-msm_v4l2_overlay_open(struct file *file)
-{
-	struct msm_v4l2_overlay_device	*vout = NULL;
-	struct v4l2_pix_format	*pix = NULL;
-	struct msm_v4l2_overlay_fh *fh;
-
-	vout = saved_vout0;
-	vout->id = 0;
-
-	if (vout->ref_count) {
-		pr_err("%s: multiple open currently is not"
-		"supported!\n", __func__);
-		return -EBUSY;
-	}
-
-	vout->ref_count++;
-
-	/* allocate per-filehandle data */
-	fh = kmalloc(sizeof(struct msm_v4l2_overlay_fh), GFP_KERNEL);
-	if (NULL == fh)
-		return -ENOMEM;
-
-	fh->vout = vout;
-	fh->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-
-	file->private_data = fh;
-
-	vout->streaming		= 0;
-	vout->crop_rect.left	= vout->crop_rect.top = 0;
-	vout->crop_rect.width	= vout->screen_width;
-	vout->crop_rect.height	= vout->screen_height;
-
-	pix				= &vout->pix;
-	pix->width			= vout->screen_width;
-	pix->height		= vout->screen_height;
-	pix->pixelformat	= V4L2_PIX_FMT_RGB32;
-	pix->field			= V4L2_FIELD_NONE;
-	pix->bytesperline	= pix->width * 4;
-	pix->sizeimage		= pix->bytesperline * pix->height;
-	pix->priv			= 0;
-	pix->colorspace		= V4L2_COLORSPACE_SRGB;
-
-	vout->win.w.left	= 0;
-	vout->win.w.top		= 0;
-	vout->win.w.width	= vout->screen_width;
-	vout->win.w.height	= vout->screen_height;
-
-	vout->fb.capability = V4L2_FBUF_CAP_EXTERNOVERLAY
-		| V4L2_FBUF_CAP_LOCAL_ALPHA;
-	vout->fb.flags = V4L2_FBUF_FLAG_LOCAL_ALPHA;
-	vout->fb.base = 0;
-	memcpy(&vout->fb.fmt, pix, sizeof(struct v4l2_format));
-
-	vout->bufs = 0;
-	vout->numbufs = 0;
-
-	mutex_init(&vout->update_lock);
-
-	return 0;
-}
-
-
-static int __devinit
-msm_v4l2_overlay_probe(struct platform_device *pdev)
-{
-	char *v4l2_ram_phys_unaligned;
-	if ((pdev->id == 0) && (pdev->num_resources > 0)) {
-		v4l2_ram_size =
-			pdev->resource[0].end - pdev->resource[0].start + 1;
-		v4l2_ram_phys_unaligned = (char *)pdev->resource[0].start;
-		v4l2_ram_phys =
-		(char *)PAGE_ALIGN((unsigned int)v4l2_ram_phys_unaligned);
-		/*
-		 * We are (fwd) page aligning the start of v4l2 memory.
-		 * Therefore we have that much less physical memory available
-		 */
-		v4l2_ram_size -= (unsigned int)v4l2_ram_phys
-			- (unsigned int)v4l2_ram_phys_unaligned;
-
-
-	}
-	return 0;
-}
-
-static int __devexit
-msm_v4l2_overlay_remove(struct platform_device *pdev)
-{
-	return 0;
-}
-
-static void msm_v4l2_overlay_videodev_release(struct video_device *vfd)
-{
-	return;
-}
-
-static const struct v4l2_file_operations msm_v4l2_overlay_fops = {
-	.owner		= THIS_MODULE,
-	.open		= msm_v4l2_overlay_open,
-	.release	= msm_v4l2_overlay_release,
-	.mmap		= msm_v4l2_overlay_mmap,
-	.ioctl		= msm_v4l2_overlay_ioctl,
-};
-
-static struct video_device msm_v4l2_overlay_vid_device0 = {
-	.name		= "msm_v4l2_overlay",
-	.fops       = &msm_v4l2_overlay_fops,
-	.minor		= -1,
-	.release	= msm_v4l2_overlay_videodev_release,
-};
-
-static struct platform_driver msm_v4l2_overlay_platform_driver = {
-	.probe   = msm_v4l2_overlay_probe,
-	.remove  = msm_v4l2_overlay_remove,
-	.driver  = {
-			 .name = "msm_v4l2_overlay_pd",
-		   },
-};
-
-static int __init msm_v4l2_overlay_init(void)
-{
-	int ret;
-
-
-	saved_vout0 = kzalloc(sizeof(struct msm_v4l2_overlay_device),
-		GFP_KERNEL);
-
-	if (!saved_vout0)
-		return -ENOMEM;
-
-	ret = platform_driver_register(&msm_v4l2_overlay_platform_driver);
-	if (ret < 0)
-		goto end;
-
-	/*
-	 * Register the device with videodev.
-	 * Videodev will make IOCTL calls on application requests
-	 */
-	ret = video_register_device(&msm_v4l2_overlay_vid_device0,
-		VFL_TYPE_GRABBER, MSM_VIDEO);
-
-	if (ret < 0) {
-		pr_err("%s: V4L2 video overlay device registration failure(%d)\n",
-				  __func__, ret);
-		goto end_unregister;
-	}
-
-	mutex_init(&msmfb_lock);
-
-	return 0;
-
-end_unregister:
-	platform_driver_unregister(&msm_v4l2_overlay_platform_driver);
-
-end:
-	kfree(saved_vout0);
-	return ret;
-}
-
-static void __exit msm_v4l2_overlay_exit(void)
-{
-	video_unregister_device(&msm_v4l2_overlay_vid_device0);
-	platform_driver_unregister(&msm_v4l2_overlay_platform_driver);
-	mutex_destroy(&msmfb_lock);
-	kfree(saved_vout0);
-}
-
-module_init(msm_v4l2_overlay_init);
-module_exit(msm_v4l2_overlay_exit);
-
-MODULE_DESCRIPTION("MSM V4L2 Video Overlay Driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/msm_v4l2_video.h b/drivers/media/video/msm/msm_v4l2_video.h
deleted file mode 100644
index 0c09a3f..0000000
--- a/drivers/media/video/msm/msm_v4l2_video.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-#ifndef MSM_V4L2_VIDEO_H
-#define MSM_V4L2_VIDEO_H
-
-#include <linux/mm.h>
-#include <linux/msm_mdp.h>
-#include <linux/videodev2.h>
-
-
-struct msm_v4l2_overlay_buffer {
-	int mapped;
-	int queued;
-	int offset;
-	int bufsize;
-};
-
-struct msm_v4l2_overlay_device {
-	struct device dev;
-
-	int ref_count;
-	int id;
-
-	int screen_width;
-	int screen_height;
-	int streaming;
-
-	struct v4l2_pix_format pix;
-	struct v4l2_window win;
-	struct v4l2_rect crop_rect;
-	struct v4l2_framebuffer fb;
-	struct msm_v4l2_overlay_buffer *bufs;
-	int numbufs;
-	struct mdp_overlay req;
-	void *par;
-
-	struct mutex update_lock;
-};
-
-struct msm_v4l2_overlay_fh {
-	struct msm_v4l2_overlay_device *vout;
-	enum v4l2_buf_type type;
-};
-
-struct msm_v4l2_overlay_userptr_buffer {
-	uint base[3];
-	size_t length[3];
-};
-
-#endif
diff --git a/drivers/media/video/msm/msm_vfe32.c b/drivers/media/video/msm/msm_vfe32.c
new file mode 100644
index 0000000..b92c421
--- /dev/null
+++ b/drivers/media/video/msm/msm_vfe32.c
@@ -0,0 +1,4236 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/uaccess.h>
+#include <linux/interrupt.h>
+#include <linux/slab.h>
+#include <linux/io.h>
+#include <linux/atomic.h>
+#include <linux/regulator/consumer.h>
+#include <linux/clk.h>
+#include <mach/irqs.h>
+#include <mach/camera.h>
+#include <media/v4l2-device.h>
+#include <media/v4l2-subdev.h>
+#include <media/msm_isp.h>
+
+#include "msm.h"
+#include "msm_vfe32.h"
+
+atomic_t irq_cnt;
+
+#define CHECKED_COPY_FROM_USER(in) {					\
+	if (copy_from_user((in), (void __user *)cmd->value,		\
+			cmd->length)) {					\
+		rc = -EFAULT;						\
+		break;							\
+	}								\
+}
+
+#define VFE32_AXI_OFFSET 0x0050
+#define vfe32_get_ch_ping_addr(chn) \
+	(msm_io_r(vfe32_ctrl->vfebase + 0x0050 + 0x18 * (chn)))
+#define vfe32_get_ch_pong_addr(chn) \
+	(msm_io_r(vfe32_ctrl->vfebase + 0x0050 + 0x18 * (chn) + 4))
+#define vfe32_get_ch_addr(ping_pong, chn) \
+	(((ping_pong) & (1 << (chn))) == 0 ? \
+	vfe32_get_ch_pong_addr(chn) : vfe32_get_ch_ping_addr(chn))
+
+#define vfe32_put_ch_ping_addr(chn, addr) \
+	(msm_io_w((addr), vfe32_ctrl->vfebase + 0x0050 + 0x18 * (chn)))
+#define vfe32_put_ch_pong_addr(chn, addr) \
+	(msm_io_w((addr), vfe32_ctrl->vfebase + 0x0050 + 0x18 * (chn) + 4))
+#define vfe32_put_ch_addr(ping_pong, chn, addr) \
+	(((ping_pong) & (1 << (chn))) == 0 ?   \
+	vfe32_put_ch_pong_addr((chn), (addr)) : \
+	vfe32_put_ch_ping_addr((chn), (addr)))
+
+static struct vfe32_ctrl_type *vfe32_ctrl;
+static uint32_t vfe_clk_rate;
+static void vfe32_send_isp_msg(struct vfe32_ctrl_type *vctrl,
+        uint32_t isp_msg_id);
+
+struct vfe32_isr_queue_cmd {
+	struct list_head list;
+	uint32_t                           vfeInterruptStatus0;
+	uint32_t                           vfeInterruptStatus1;
+};
+
+static struct vfe32_cmd_type vfe32_cmd[] = {
+	{VFE_CMD_DUMMY_0},
+		{VFE_CMD_SET_CLK},
+		{VFE_CMD_RESET},
+		{VFE_CMD_START},
+		{VFE_CMD_TEST_GEN_START},
+	{VFE_CMD_OPERATION_CFG, V32_OPERATION_CFG_LEN},
+		{VFE_CMD_AXI_OUT_CFG, V32_AXI_OUT_LEN, V32_AXI_OUT_OFF, 0xFF},
+		{VFE_CMD_CAMIF_CFG, V32_CAMIF_LEN, V32_CAMIF_OFF, 0xFF},
+		{VFE_CMD_AXI_INPUT_CFG},
+		{VFE_CMD_BLACK_LEVEL_CFG, V32_BLACK_LEVEL_LEN,
+		V32_BLACK_LEVEL_OFF,
+		0xFF},
+  {VFE_CMD_MESH_ROLL_OFF_CFG, V32_MESH_ROLL_OFF_CFG_LEN,
+		V32_MESH_ROLL_OFF_CFG_OFF, 0xFF},
+		{VFE_CMD_DEMUX_CFG, V32_DEMUX_LEN, V32_DEMUX_OFF, 0xFF},
+		{VFE_CMD_FOV_CFG, V32_FOV_LEN, V32_FOV_OFF, 0xFF},
+		{VFE_CMD_MAIN_SCALER_CFG, V32_MAIN_SCALER_LEN,
+		V32_MAIN_SCALER_OFF, 0xFF},
+		{VFE_CMD_WB_CFG, V32_WB_LEN, V32_WB_OFF, 0xFF},
+	{VFE_CMD_COLOR_COR_CFG, V32_COLOR_COR_LEN, V32_COLOR_COR_OFF, 0xFF},
+		{VFE_CMD_RGB_G_CFG, V32_RGB_G_LEN, V32_RGB_G_OFF, 0xFF},
+		{VFE_CMD_LA_CFG, V32_LA_LEN, V32_LA_OFF, 0xFF },
+		{VFE_CMD_CHROMA_EN_CFG, V32_CHROMA_EN_LEN, V32_CHROMA_EN_OFF,
+		0xFF},
+		{VFE_CMD_CHROMA_SUP_CFG, V32_CHROMA_SUP_LEN, V32_CHROMA_SUP_OFF,
+		0xFF},
+	{VFE_CMD_MCE_CFG, V32_MCE_LEN, V32_MCE_OFF, 0xFF},
+		{VFE_CMD_SK_ENHAN_CFG, V32_SCE_LEN, V32_SCE_OFF, 0xFF},
+		{VFE_CMD_ASF_CFG, V32_ASF_LEN, V32_ASF_OFF, 0xFF},
+		{VFE_CMD_S2Y_CFG, V32_S2Y_LEN, V32_S2Y_OFF, 0xFF},
+		{VFE_CMD_S2CbCr_CFG, V32_S2CbCr_LEN, V32_S2CbCr_OFF, 0xFF},
+	{VFE_CMD_CHROMA_SUBS_CFG, V32_CHROMA_SUBS_LEN, V32_CHROMA_SUBS_OFF,
+		0xFF},
+		{VFE_CMD_OUT_CLAMP_CFG, V32_OUT_CLAMP_LEN, V32_OUT_CLAMP_OFF,
+		0xFF},
+		{VFE_CMD_FRAME_SKIP_CFG, V32_FRAME_SKIP_LEN, V32_FRAME_SKIP_OFF,
+		0xFF},
+		{VFE_CMD_DUMMY_1},
+		{VFE_CMD_DUMMY_2},
+	{VFE_CMD_DUMMY_3},
+		{VFE_CMD_UPDATE},
+		{VFE_CMD_BL_LVL_UPDATE, V32_BLACK_LEVEL_LEN,
+		V32_BLACK_LEVEL_OFF, 0xFF},
+		{VFE_CMD_DEMUX_UPDATE, V32_DEMUX_LEN, V32_DEMUX_OFF, 0xFF},
+		{VFE_CMD_FOV_UPDATE, V32_FOV_LEN, V32_FOV_OFF, 0xFF},
+	{VFE_CMD_MAIN_SCALER_UPDATE, V32_MAIN_SCALER_LEN, V32_MAIN_SCALER_OFF,
+		0xFF},
+		{VFE_CMD_WB_UPDATE, V32_WB_LEN, V32_WB_OFF, 0xFF},
+		{VFE_CMD_COLOR_COR_UPDATE, V32_COLOR_COR_LEN, V32_COLOR_COR_OFF,
+		0xFF},
+		{VFE_CMD_RGB_G_UPDATE, V32_RGB_G_LEN, V32_CHROMA_EN_OFF, 0xFF},
+		{VFE_CMD_LA_UPDATE, V32_LA_LEN, V32_LA_OFF, 0xFF },
+	{VFE_CMD_CHROMA_EN_UPDATE, V32_CHROMA_EN_LEN, V32_CHROMA_EN_OFF,
+		0xFF},
+		{VFE_CMD_CHROMA_SUP_UPDATE, V32_CHROMA_SUP_LEN,
+		V32_CHROMA_SUP_OFF, 0xFF},
+		{VFE_CMD_MCE_UPDATE, V32_MCE_LEN, V32_MCE_OFF, 0xFF},
+		{VFE_CMD_SK_ENHAN_UPDATE, V32_SCE_LEN, V32_SCE_OFF, 0xFF},
+		{VFE_CMD_S2CbCr_UPDATE, V32_S2CbCr_LEN, V32_S2CbCr_OFF, 0xFF},
+	{VFE_CMD_S2Y_UPDATE, V32_S2Y_LEN, V32_S2Y_OFF, 0xFF},
+		{VFE_CMD_ASF_UPDATE, V32_ASF_UPDATE_LEN, V32_ASF_OFF, 0xFF},
+		{VFE_CMD_FRAME_SKIP_UPDATE},
+		{VFE_CMD_CAMIF_FRAME_UPDATE},
+		{VFE_CMD_STATS_AF_UPDATE, V32_STATS_AF_LEN, V32_STATS_AF_OFF},
+	{VFE_CMD_STATS_AE_UPDATE, V32_STATS_AE_LEN, V32_STATS_AE_OFF},
+		{VFE_CMD_STATS_AWB_UPDATE, V32_STATS_AWB_LEN,
+		V32_STATS_AWB_OFF},
+		{VFE_CMD_STATS_RS_UPDATE, V32_STATS_RS_LEN, V32_STATS_RS_OFF},
+		{VFE_CMD_STATS_CS_UPDATE, V32_STATS_CS_LEN, V32_STATS_CS_OFF},
+		{VFE_CMD_STATS_SKIN_UPDATE},
+	{VFE_CMD_STATS_IHIST_UPDATE, V32_STATS_IHIST_LEN, V32_STATS_IHIST_OFF},
+		{VFE_CMD_DUMMY_4},
+		{VFE_CMD_EPOCH1_ACK},
+		{VFE_CMD_EPOCH2_ACK},
+		{VFE_CMD_START_RECORDING},
+	{VFE_CMD_STOP_RECORDING},
+		{VFE_CMD_DUMMY_5},
+		{VFE_CMD_DUMMY_6},
+		{VFE_CMD_CAPTURE, V32_CAPTURE_LEN, 0xFF},
+		{VFE_CMD_DUMMY_7},
+	{VFE_CMD_STOP},
+		{VFE_CMD_GET_HW_VERSION, V32_GET_HW_VERSION_LEN,
+		V32_GET_HW_VERSION_OFF},
+		{VFE_CMD_GET_FRAME_SKIP_COUNTS},
+		{VFE_CMD_OUTPUT1_BUFFER_ENQ},
+		{VFE_CMD_OUTPUT2_BUFFER_ENQ},
+	{VFE_CMD_OUTPUT3_BUFFER_ENQ},
+		{VFE_CMD_JPEG_OUT_BUF_ENQ},
+		{VFE_CMD_RAW_OUT_BUF_ENQ},
+		{VFE_CMD_RAW_IN_BUF_ENQ},
+		{VFE_CMD_STATS_AF_ENQ},
+	{VFE_CMD_STATS_AE_ENQ},
+		{VFE_CMD_STATS_AWB_ENQ},
+		{VFE_CMD_STATS_RS_ENQ},
+		{VFE_CMD_STATS_CS_ENQ},
+		{VFE_CMD_STATS_SKIN_ENQ},
+	{VFE_CMD_STATS_IHIST_ENQ},
+		{VFE_CMD_DUMMY_8},
+		{VFE_CMD_JPEG_ENC_CFG},
+		{VFE_CMD_DUMMY_9},
+		{VFE_CMD_STATS_AF_START, V32_STATS_AF_LEN, V32_STATS_AF_OFF},
+	{VFE_CMD_STATS_AF_STOP},
+		{VFE_CMD_STATS_AE_START, V32_STATS_AE_LEN, V32_STATS_AE_OFF},
+		{VFE_CMD_STATS_AE_STOP},
+		{VFE_CMD_STATS_AWB_START, V32_STATS_AWB_LEN, V32_STATS_AWB_OFF},
+		{VFE_CMD_STATS_AWB_STOP},
+	{VFE_CMD_STATS_RS_START, V32_STATS_RS_LEN, V32_STATS_RS_OFF},
+		{VFE_CMD_STATS_RS_STOP},
+		{VFE_CMD_STATS_CS_START, V32_STATS_CS_LEN, V32_STATS_CS_OFF},
+		{VFE_CMD_STATS_CS_STOP},
+		{VFE_CMD_STATS_SKIN_START},
+	{VFE_CMD_STATS_SKIN_STOP},
+		{VFE_CMD_STATS_IHIST_START,
+		V32_STATS_IHIST_LEN, V32_STATS_IHIST_OFF},
+		{VFE_CMD_STATS_IHIST_STOP},
+		{VFE_CMD_DUMMY_10},
+		{VFE_CMD_SYNC_TIMER_SETTING, V32_SYNC_TIMER_LEN,
+			V32_SYNC_TIMER_OFF},
+	{VFE_CMD_ASYNC_TIMER_SETTING, V32_ASYNC_TIMER_LEN, V32_ASYNC_TIMER_OFF},
+		{VFE_CMD_LIVESHOT},
+		{VFE_CMD_LA_SETUP},
+		{VFE_CMD_LINEARIZATION_CFG, V32_LINEARIZATION_LEN1,
+			V32_LINEARIZATION_OFF1},
+		{VFE_CMD_DEMOSAICV3},
+	{VFE_CMD_DEMOSAICV3_ABCC_CFG},
+		{VFE_CMD_DEMOSAICV3_DBCC_CFG, V32_DEMOSAICV3_DBCC_LEN,
+			V32_DEMOSAICV3_DBCC_OFF},
+		{VFE_CMD_DEMOSAICV3_DBPC_CFG},
+		{VFE_CMD_DEMOSAICV3_ABF_CFG, V32_DEMOSAICV3_ABF_LEN,
+			V32_DEMOSAICV3_ABF_OFF},
+		{VFE_CMD_DEMOSAICV3_ABCC_UPDATE},
+	{VFE_CMD_DEMOSAICV3_DBCC_UPDATE, V32_DEMOSAICV3_DBCC_LEN,
+			V32_DEMOSAICV3_DBCC_OFF},
+		{VFE_CMD_DEMOSAICV3_DBPC_UPDATE},
+		{VFE_CMD_XBAR_CFG},
+		{VFE_CMD_MODULE_CFG, V32_MODULE_CFG_LEN, V32_MODULE_CFG_OFF},
+		{VFE_CMD_ZSL},
+	{VFE_CMD_LINEARIZATION_UPDATE, V32_LINEARIZATION_LEN1,
+			V32_LINEARIZATION_OFF1},
+		{VFE_CMD_DEMOSAICV3_ABF_UPDATE, V32_DEMOSAICV3_ABF_LEN,
+			V32_DEMOSAICV3_ABF_OFF},
+		{VFE_CMD_CLF_CFG, V32_CLF_CFG_LEN, V32_CLF_CFG_OFF},
+		{VFE_CMD_CLF_LUMA_UPDATE, V32_CLF_LUMA_UPDATE_LEN,
+			V32_CLF_LUMA_UPDATE_OFF},
+		{VFE_CMD_CLF_CHROMA_UPDATE, V32_CLF_CHROMA_UPDATE_LEN,
+			V32_CLF_CHROMA_UPDATE_OFF},
+ {VFE_CMD_PCA_ROLL_OFF_CFG},
+		{VFE_CMD_PCA_ROLL_OFF_UPDATE},
+		{VFE_CMD_GET_REG_DUMP},
+		{VFE_CMD_GET_LINEARIZATON_TABLE},
+		{VFE_CMD_GET_MESH_ROLLOFF_TABLE},
+ {VFE_CMD_GET_PCA_ROLLOFF_TABLE},
+		{VFE_CMD_GET_RGB_G_TABLE},
+		{VFE_CMD_GET_LA_TABLE},
+		{VFE_CMD_DEMOSAICV3_UPDATE},
+};
+
+uint32_t vfe32_AXI_WM_CFG[] = {
+	0x0000004C,
+	0x00000064,
+	0x0000007C,
+	0x00000094,
+	0x000000AC,
+	0x000000C4,
+	0x000000DC,
+};
+
+static const char * const vfe32_general_cmd[] = {
+	"DUMMY_0",  
+	"SET_CLK",
+	"RESET",
+	"START",
+	"TEST_GEN_START",
+	"OPERATION_CFG",  
+	"AXI_OUT_CFG",
+	"CAMIF_CFG",
+	"AXI_INPUT_CFG",
+	"BLACK_LEVEL_CFG",
+	"ROLL_OFF_CFG",  
+	"DEMUX_CFG",
+	"FOV_CFG",
+	"MAIN_SCALER_CFG",
+	"WB_CFG",
+	"COLOR_COR_CFG", 
+	"RGB_G_CFG",
+	"LA_CFG",
+	"CHROMA_EN_CFG",
+	"CHROMA_SUP_CFG",
+	"MCE_CFG", 
+	"SK_ENHAN_CFG",
+	"ASF_CFG",
+	"S2Y_CFG",
+	"S2CbCr_CFG",
+	"CHROMA_SUBS_CFG",  
+	"OUT_CLAMP_CFG",
+	"FRAME_SKIP_CFG",
+	"DUMMY_1",
+	"DUMMY_2",
+	"DUMMY_3",  
+	"UPDATE",
+	"BL_LVL_UPDATE",
+	"DEMUX_UPDATE",
+	"FOV_UPDATE",
+	"MAIN_SCALER_UPDATE",  
+	"WB_UPDATE",
+	"COLOR_COR_UPDATE",
+	"RGB_G_UPDATE",
+	"LA_UPDATE",
+	"CHROMA_EN_UPDATE",  
+	"CHROMA_SUP_UPDATE",
+	"MCE_UPDATE",
+	"SK_ENHAN_UPDATE",
+	"S2CbCr_UPDATE",
+	"S2Y_UPDATE",  
+	"ASF_UPDATE",
+	"FRAME_SKIP_UPDATE",
+	"CAMIF_FRAME_UPDATE",
+	"STATS_AF_UPDATE",
+	"STATS_AE_UPDATE",  
+	"STATS_AWB_UPDATE",
+	"STATS_RS_UPDATE",
+	"STATS_CS_UPDATE",
+	"STATS_SKIN_UPDATE",
+	"STATS_IHIST_UPDATE",  
+	"DUMMY_4",
+	"EPOCH1_ACK",
+	"EPOCH2_ACK",
+	"START_RECORDING",
+	"STOP_RECORDING",  
+	"DUMMY_5",
+	"DUMMY_6",
+	"CAPTURE",
+	"DUMMY_7",
+	"STOP",  
+	"GET_HW_VERSION",
+	"GET_FRAME_SKIP_COUNTS",
+	"OUTPUT1_BUFFER_ENQ",
+	"OUTPUT2_BUFFER_ENQ",
+	"OUTPUT3_BUFFER_ENQ",  
+	"JPEG_OUT_BUF_ENQ",
+	"RAW_OUT_BUF_ENQ",
+	"RAW_IN_BUF_ENQ",
+	"STATS_AF_ENQ",
+	"STATS_AE_ENQ",  
+	"STATS_AWB_ENQ",
+	"STATS_RS_ENQ",
+	"STATS_CS_ENQ",
+	"STATS_SKIN_ENQ",
+	"STATS_IHIST_ENQ",  
+	"DUMMY_8",
+	"JPEG_ENC_CFG",
+	"DUMMY_9",
+	"STATS_AF_START",
+	"STATS_AF_STOP",  
+	"STATS_AE_START",
+	"STATS_AE_STOP",
+	"STATS_AWB_START",
+	"STATS_AWB_STOP",
+	"STATS_RS_START",  
+	"STATS_RS_STOP",
+	"STATS_CS_START",
+	"STATS_CS_STOP",
+	"STATS_SKIN_START",
+	"STATS_SKIN_STOP",  
+	"STATS_IHIST_START",
+	"STATS_IHIST_STOP",
+	"DUMMY_10",
+	"SYNC_TIMER_SETTING",
+	"ASYNC_TIMER_SETTING",  
+	"LIVESHOT",
+	"LA_SETUP",
+	"LINEARIZATION_CFG",
+	"DEMOSAICV3",
+	"DEMOSAICV3_ABCC_CFG", 
+	"DEMOSAICV3_DBCC_CFG",
+	"DEMOSAICV3_DBPC_CFG",
+	"DEMOSAICV3_ABF_CFG",
+	"DEMOSAICV3_ABCC_UPDATE",
+	"DEMOSAICV3_DBCC_UPDATE", 
+	"DEMOSAICV3_DBPC_UPDATE",
+	"XBAR_CFG",
+	"EZTUNE_CFG",
+	"V32_ZSL",
+	"LINEARIZATION_UPDATE", 
+	"DEMOSAICV3_ABF_UPDATE",
+	"CLF_CFG",
+	"CLF_LUMA_UPDATE",
+	"CLF_CHROMA_UPDATE",
+	"PCA_ROLL_OFF_CFG", 
+	"PCA_ROLL_OFF_UPDATE",
+	"GET_REG_DUMP",
+	"GET_LINEARIZATON_TABLE",
+	"GET_MESH_ROLLOFF_TABLE",
+	"GET_PCA_ROLLOFF_TABLE", 
+	"GET_RGB_G_TABLE",
+	"GET_LA_TABLE",
+	"DEMOSAICV3_UPDATE",
+};
+
+static void vfe32_stop(void)
+{
+	uint8_t  axiBusyFlag = true;
+	unsigned long flags;
+
+	atomic_set(&vfe32_ctrl->vstate, 0);
+
+	
+	spin_lock_irqsave(&vfe32_ctrl->stop_flag_lock, flags);
+	vfe32_ctrl->stop_ack_pending = TRUE;
+	spin_unlock_irqrestore(&vfe32_ctrl->stop_flag_lock, flags);
+
+	
+	msm_io_w(VFE_DISABLE_ALL_IRQS,
+		vfe32_ctrl->vfebase + VFE_IRQ_MASK_0);
+	msm_io_w(VFE_DISABLE_ALL_IRQS,
+			vfe32_ctrl->vfebase + VFE_IRQ_MASK_1);
+
+	
+	msm_io_w(VFE_CLEAR_ALL_IRQS,
+		vfe32_ctrl->vfebase + VFE_IRQ_CLEAR_0);
+	msm_io_w(VFE_CLEAR_ALL_IRQS,
+		vfe32_ctrl->vfebase + VFE_IRQ_CLEAR_1);
+	msm_io_w_mb(1,
+		vfe32_ctrl->vfebase + VFE_IRQ_CMD);
+
+	msm_io_w(CAMIF_COMMAND_STOP_IMMEDIATELY,
+		vfe32_ctrl->vfebase + VFE_CAMIF_COMMAND);
+
+	
+	msm_io_w(AXI_HALT,
+		vfe32_ctrl->vfebase + VFE_AXI_CMD);
+	wmb();
+	while (axiBusyFlag) {
+		if (msm_io_r(vfe32_ctrl->vfebase + VFE_AXI_STATUS) & 0x1)
+			axiBusyFlag = false;
+	}
+	msm_io_w_mb(AXI_HALT_CLEAR,
+		vfe32_ctrl->vfebase + VFE_AXI_CMD);
+
+	
+	msm_io_w(0xf0000000,
+		vfe32_ctrl->vfebase + VFE_IRQ_MASK_0);
+	msm_io_w(VFE_IMASK_WHILE_STOPPING_1,
+		vfe32_ctrl->vfebase + VFE_IRQ_MASK_1);
+
+	msm_io_w_mb(VFE_RESET_UPON_STOP_CMD,
+		vfe32_ctrl->vfebase + VFE_GLOBAL_RESET);
+}
+
+static void vfe32_subdev_notify(int id, int path)
+{
+	struct msm_vfe_resp rp;
+	unsigned long flags = 0;
+	spin_lock_irqsave(&vfe32_ctrl->sd_notify_lock, flags);
+	memset(&rp, 0, sizeof(struct msm_vfe_resp));
+	rp.evt_msg.type   = MSM_CAMERA_MSG;
+	rp.evt_msg.msg_id = path;
+	rp.type    = id;
+	v4l2_subdev_notify(&vfe32_ctrl->subdev, NOTIFY_VFE_BUF_EVT, &rp);
+	spin_unlock_irqrestore(&vfe32_ctrl->sd_notify_lock, flags);
+}
+
+static int vfe32_config_axi(int mode, uint32_t *ao)
+{
+	uint32_t *ch_info;
+	uint32_t *axi_cfg = ao+V32_AXI_BUS_FMT_OFF;
+
+	
+	ch_info = axi_cfg + V32_AXI_CFG_LEN;
+	vfe32_ctrl->outpath.out0.ch0 = 0x0000FFFF & *ch_info;
+	vfe32_ctrl->outpath.out0.ch1 = 0x0000FFFF & (*ch_info++ >> 16);
+	vfe32_ctrl->outpath.out0.ch2 = 0x0000FFFF & *ch_info++;
+	vfe32_ctrl->outpath.out1.ch0 = 0x0000FFFF & *ch_info;
+	vfe32_ctrl->outpath.out1.ch1 = 0x0000FFFF & (*ch_info++ >> 16);
+	vfe32_ctrl->outpath.out1.ch2 = 0x0000FFFF & *ch_info++;
+	vfe32_ctrl->outpath.out2.ch0 = 0x0000FFFF & *ch_info;
+	vfe32_ctrl->outpath.out2.ch1 = 0x0000FFFF & (*ch_info++ >> 16);
+	vfe32_ctrl->outpath.out2.ch2 = 0x0000FFFF & *ch_info++;
+
+	switch (mode) {
+	case OUTPUT_PRIM:
+		vfe32_ctrl->outpath.output_mode =
+			VFE32_OUTPUT_MODE_PRIMARY;
+		break;
+	case OUTPUT_PRIM_ALL_CHNLS:
+		vfe32_ctrl->outpath.output_mode =
+			VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
+		break;
+	case OUTPUT_PRIM|OUTPUT_SEC:
+		vfe32_ctrl->outpath.output_mode =
+			VFE32_OUTPUT_MODE_PRIMARY;
+		vfe32_ctrl->outpath.output_mode |=
+			VFE32_OUTPUT_MODE_SECONDARY;
+		break;
+	case OUTPUT_PRIM|OUTPUT_SEC_ALL_CHNLS:
+		vfe32_ctrl->outpath.output_mode =
+			VFE32_OUTPUT_MODE_PRIMARY;
+		vfe32_ctrl->outpath.output_mode |=
+			VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS;
+		break;
+	case OUTPUT_PRIM_ALL_CHNLS|OUTPUT_SEC:
+		vfe32_ctrl->outpath.output_mode =
+			VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
+		vfe32_ctrl->outpath.output_mode |=
+			VFE32_OUTPUT_MODE_SECONDARY;
+		break;
+	default:
+		pr_err("%s Invalid AXI mode %d ", __func__, mode);
+		return -EINVAL;
+	}
+	msm_io_w(*ao, vfe32_ctrl->vfebase +
+		VFE_BUS_IO_FORMAT_CFG);
+	msm_io_memcpy(vfe32_ctrl->vfebase +
+		vfe32_cmd[VFE_CMD_AXI_OUT_CFG].offset, axi_cfg,
+		vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length - V32_AXI_CH_INF_LEN
+		- V32_AXI_BUS_FMT_LEN);
+	return 0;
+}
+
+static void vfe32_reset_internal_variables(void)
+{
+	unsigned long flags;
+	vfe32_ctrl->vfeImaskCompositePacked = 0;
+	
+	vfe32_ctrl->start_ack_pending = FALSE;
+	atomic_set(&irq_cnt, 0);
+
+	spin_lock_irqsave(&vfe32_ctrl->stop_flag_lock, flags);
+	vfe32_ctrl->stop_ack_pending  = FALSE;
+	spin_unlock_irqrestore(&vfe32_ctrl->stop_flag_lock, flags);
+
+	vfe32_ctrl->reset_ack_pending  = FALSE;
+
+	spin_lock_irqsave(&vfe32_ctrl->update_ack_lock, flags);
+	vfe32_ctrl->update_ack_pending = FALSE;
+	spin_unlock_irqrestore(&vfe32_ctrl->update_ack_lock, flags);
+
+	vfe32_ctrl->recording_state = VFE_STATE_IDLE;
+	vfe32_ctrl->liveshot_state = VFE_STATE_IDLE;
+
+	atomic_set(&vfe32_ctrl->vstate, 0);
+
+	
+	vfe32_ctrl->operation_mode = 0;
+	vfe32_ctrl->outpath.output_mode = 0;
+	vfe32_ctrl->vfe_capture_count = 0;
+
+	
+	vfe32_ctrl->vfeFrameId = 0;
+	
+	memset(&(vfe32_ctrl->afStatsControl), 0,
+		sizeof(struct vfe_stats_control));
+
+	memset(&(vfe32_ctrl->awbStatsControl), 0,
+		sizeof(struct vfe_stats_control));
+
+	memset(&(vfe32_ctrl->aecStatsControl), 0,
+		sizeof(struct vfe_stats_control));
+
+	memset(&(vfe32_ctrl->ihistStatsControl), 0,
+		sizeof(struct vfe_stats_control));
+
+	memset(&(vfe32_ctrl->rsStatsControl), 0,
+		sizeof(struct vfe_stats_control));
+
+	memset(&(vfe32_ctrl->csStatsControl), 0,
+		sizeof(struct vfe_stats_control));
+
+	vfe32_ctrl->frame_skip_cnt = 31;
+	vfe32_ctrl->frame_skip_pattern = 0xffffffff;
+	vfe32_ctrl->snapshot_frame_cnt = 0;
+}
+
+static void vfe32_reset(void)
+{
+	vfe32_reset_internal_variables();
+	msm_io_w(VFE_DISABLE_ALL_IRQS,
+		vfe32_ctrl->vfebase + VFE_IRQ_MASK_0);
+
+	msm_io_w(VFE_DISABLE_ALL_IRQS,
+		vfe32_ctrl->vfebase + VFE_IRQ_MASK_1);
+
+	
+	msm_io_w(VFE_CLEAR_ALL_IRQS, vfe32_ctrl->vfebase + VFE_IRQ_CLEAR_0);
+	msm_io_w(VFE_CLEAR_ALL_IRQS, vfe32_ctrl->vfebase + VFE_IRQ_CLEAR_1);
+
+	msm_io_w_mb(1, vfe32_ctrl->vfebase + VFE_IRQ_CMD);
+
+	
+	msm_io_w(VFE_IMASK_WHILE_STOPPING_1,
+	vfe32_ctrl->vfebase + VFE_IRQ_MASK_1);
+
+
+	msm_io_w_mb(VFE_RESET_UPON_RESET_CMD,
+		vfe32_ctrl->vfebase + VFE_GLOBAL_RESET);
+}
+
+static int vfe32_operation_config(uint32_t *cmd)
+{
+	uint32_t *p = cmd;
+
+	vfe32_ctrl->operation_mode = *p;
+	vfe32_ctrl->stats_comp = *(++p);
+	vfe32_ctrl->hfr_mode = *(++p);
+
+	msm_io_w(*(++p), vfe32_ctrl->vfebase + VFE_CFG);
+	msm_io_w(*(++p), vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+	msm_io_w(*(++p), vfe32_ctrl->vfebase + VFE_PIXEL_IF_CFG);
+	if (msm_io_r(vfe32_ctrl->vfebase + V32_GET_HW_VERSION_OFF) ==
+		VFE33_HW_NUMBER) {
+		msm_io_w(*(++p), vfe32_ctrl->vfebase + VFE_RDI0_CFG);
+		msm_io_w(*(++p), vfe32_ctrl->vfebase + VFE_RDI1_CFG);
+	}  else {
+		++p;
+		++p;
+	}
+	msm_io_w(*(++p), vfe32_ctrl->vfebase + VFE_REALIGN_BUF);
+	msm_io_w(*(++p), vfe32_ctrl->vfebase + VFE_CHROMA_UP);
+	msm_io_w(*(++p), vfe32_ctrl->vfebase + VFE_STATS_CFG);
+	return 0;
+}
+
+static uint32_t vfe_stats_awb_buf_init(struct vfe_cmd_stats_buf *in)
+{
+	uint32_t *ptr = in->statsBuf;
+	uint32_t addr;
+
+	addr = ptr[0];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PING_ADDR);
+	addr = ptr[1];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PONG_ADDR);
+	vfe32_ctrl->awbStatsControl.nextFrameAddrBuf = in->statsBuf[2];
+	return 0;
+}
+
+static uint32_t vfe_stats_aec_buf_init(struct vfe_cmd_stats_buf *in)
+{
+	uint32_t *ptr = in->statsBuf;
+	uint32_t addr;
+
+	addr = ptr[0];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_AEC_WR_PING_ADDR);
+	addr = ptr[1];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_AEC_WR_PONG_ADDR);
+
+	vfe32_ctrl->aecStatsControl.nextFrameAddrBuf = in->statsBuf[2];
+	return 0;
+}
+
+static uint32_t vfe_stats_af_buf_init(struct vfe_cmd_stats_buf *in)
+{
+	uint32_t *ptr = in->statsBuf;
+	uint32_t addr;
+
+	addr = ptr[0];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_AF_WR_PING_ADDR);
+	addr = ptr[1];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_AF_WR_PONG_ADDR);
+
+	vfe32_ctrl->afStatsControl.nextFrameAddrBuf = in->statsBuf[2];
+	return 0;
+}
+
+static uint32_t vfe_stats_ihist_buf_init(struct vfe_cmd_stats_buf *in)
+{
+	uint32_t *ptr = in->statsBuf;
+	uint32_t addr;
+
+	addr = ptr[0];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_HIST_WR_PING_ADDR);
+	addr = ptr[1];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_HIST_WR_PONG_ADDR);
+
+	vfe32_ctrl->ihistStatsControl.nextFrameAddrBuf = in->statsBuf[2];
+	return 0;
+}
+
+static uint32_t vfe_stats_rs_buf_init(struct vfe_cmd_stats_buf *in)
+{
+	uint32_t *ptr = in->statsBuf;
+	uint32_t addr;
+
+	addr = ptr[0];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_RS_WR_PING_ADDR);
+	addr = ptr[1];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_RS_WR_PONG_ADDR);
+
+	vfe32_ctrl->rsStatsControl.nextFrameAddrBuf = in->statsBuf[2];
+	return 0;
+}
+
+static uint32_t vfe_stats_cs_buf_init(struct vfe_cmd_stats_buf *in)
+{
+	uint32_t *ptr = in->statsBuf;
+	uint32_t addr;
+
+	addr = ptr[0];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_CS_WR_PING_ADDR);
+	addr = ptr[1];
+	msm_io_w(addr, vfe32_ctrl->vfebase + VFE_BUS_STATS_CS_WR_PONG_ADDR);
+
+	vfe32_ctrl->csStatsControl.nextFrameAddrBuf = in->statsBuf[2];
+	return 0;
+}
+
+static void vfe32_start_common(void)
+{
+	uint32_t irq_mask = 0x00E00021;
+	vfe32_ctrl->start_ack_pending = TRUE;
+	CDBG("VFE opertaion mode = 0x%x, output mode = 0x%x\n",
+		vfe32_ctrl->operation_mode, vfe32_ctrl->outpath.output_mode);
+	if (vfe32_ctrl->stats_comp)
+		irq_mask |= VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK;
+	else
+		irq_mask |= 0x000FE000;
+
+	msm_io_w(irq_mask, vfe32_ctrl->vfebase + VFE_IRQ_MASK_0);
+	msm_io_w(VFE_IMASK_WHILE_STOPPING_1,
+		vfe32_ctrl->vfebase + VFE_IRQ_MASK_1);
+	msm_io_w(0x80000000, vfe32_ctrl->vfebase + 0x600);
+
+	msm_io_w_mb(1, vfe32_ctrl->vfebase + VFE_REG_UPDATE_CMD);
+	msm_io_w_mb(1, vfe32_ctrl->vfebase + VFE_CAMIF_COMMAND);
+
+
+	atomic_set(&vfe32_ctrl->vstate, 1);
+}
+
+static int vfe32_start_recording(struct msm_cam_media_controller *pmctl)
+{
+	msm_camio_bus_scale_cfg(
+		pmctl->sdata->pdata->cam_bus_scale_table, S_VIDEO);
+	vfe32_ctrl->recording_state = VFE_STATE_START_REQUESTED;
+	msm_io_w_mb(1, vfe32_ctrl->vfebase + VFE_REG_UPDATE_CMD);
+	return 0;
+}
+
+static int vfe32_stop_recording(struct msm_cam_media_controller *pmctl)
+{
+	vfe32_ctrl->recording_state = VFE_STATE_STOP_REQUESTED;
+	msm_io_w_mb(1, vfe32_ctrl->vfebase + VFE_REG_UPDATE_CMD);
+	msm_camio_bus_scale_cfg(
+		pmctl->sdata->pdata->cam_bus_scale_table, S_PREVIEW);
+	return 0;
+}
+
+static void vfe32_start_liveshot(struct msm_cam_media_controller *pmctl)
+{
+	
+	vfe32_ctrl->outpath.out0.capture_cnt = 1;
+	vfe32_ctrl->vfe_capture_count = vfe32_ctrl->outpath.out0.capture_cnt;
+
+	vfe32_ctrl->liveshot_state = VFE_STATE_START_REQUESTED;
+	msm_io_w_mb(1, vfe32_ctrl->vfebase + VFE_REG_UPDATE_CMD);
+}
+
+static void vfe32_stop_liveshot(struct msm_cam_media_controller *pmctl)
+{
+	vfe32_ctrl->liveshot_state = VFE_STATE_STOP_REQUESTED;
+	msm_io_w_mb(1, vfe32_ctrl->vfebase + VFE_REG_UPDATE_CMD);
+}
+
+
+static int vfe32_zsl(struct msm_cam_media_controller *pmctl)
+{
+	uint32_t irq_comp_mask = 0;
+	
+	irq_comp_mask	=
+		msm_io_r(vfe32_ctrl->vfebase + VFE_IRQ_COMP_MASK);
+
+	CDBG("%s:op mode %d O/P Mode %d\n", __func__,
+		vfe32_ctrl->operation_mode, vfe32_ctrl->outpath.output_mode);
+
+	if (vfe32_ctrl->outpath.output_mode & VFE32_OUTPUT_MODE_PRIMARY) {
+		irq_comp_mask |= ((0x1 << (vfe32_ctrl->outpath.out0.ch0)) |
+				(0x1 << (vfe32_ctrl->outpath.out0.ch1)));
+	} else if (vfe32_ctrl->outpath.output_mode &
+			VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
+		irq_comp_mask |= ((0x1 << (vfe32_ctrl->outpath.out0.ch0)) |
+				(0x1 << (vfe32_ctrl->outpath.out0.ch1)) |
+				(0x1 << (vfe32_ctrl->outpath.out0.ch2)));
+	}
+
+	if (vfe32_ctrl->outpath.output_mode & VFE32_OUTPUT_MODE_SECONDARY) {
+		irq_comp_mask |= ((0x1 << (vfe32_ctrl->outpath.out1.ch0 + 8)) |
+				(0x1 << (vfe32_ctrl->outpath.out1.ch1 + 8)));
+	} else if (vfe32_ctrl->outpath.output_mode &
+			   VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
+		irq_comp_mask |= ((0x1 << (vfe32_ctrl->outpath.out1.ch0 + 8)) |
+				(0x1 << (vfe32_ctrl->outpath.out1.ch1 + 8)) |
+				(0x1 << (vfe32_ctrl->outpath.out1.ch2 + 8)));
+	}
+
+	if (vfe32_ctrl->outpath.output_mode & VFE32_OUTPUT_MODE_PRIMARY) {
+		msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch0]);
+		msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch1]);
+	} else if (vfe32_ctrl->outpath.output_mode &
+				VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
+		msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch0]);
+		msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch1]);
+		msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch2]);
+	}
+
+	if (vfe32_ctrl->outpath.output_mode & VFE32_OUTPUT_MODE_SECONDARY) {
+		msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch0]);
+		msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch1]);
+	} else if (vfe32_ctrl->outpath.output_mode &
+				VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
+		msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch0]);
+		msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch1]);
+		msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch2]);
+	}
+
+	msm_io_w(irq_comp_mask, vfe32_ctrl->vfebase + VFE_IRQ_COMP_MASK);
+	msm_camio_bus_scale_cfg(
+		pmctl->sdata->pdata->cam_bus_scale_table, S_ZSL);
+	vfe32_start_common();
+
+	msm_io_w(1, vfe32_ctrl->vfebase + 0x18C);
+	msm_io_w(1, vfe32_ctrl->vfebase + 0x188);
+	return 0;
+}
+static int vfe32_capture_raw(
+	struct msm_cam_media_controller *pmctl,
+	uint32_t num_frames_capture)
+{
+	uint32_t irq_comp_mask = 0;
+
+	vfe32_ctrl->outpath.out0.capture_cnt = num_frames_capture;
+	vfe32_ctrl->vfe_capture_count = num_frames_capture;
+
+	irq_comp_mask	=
+		msm_io_r(vfe32_ctrl->vfebase + VFE_IRQ_COMP_MASK);
+
+	if (vfe32_ctrl->outpath.output_mode & VFE32_OUTPUT_MODE_PRIMARY) {
+		irq_comp_mask |= (0x1 << (vfe32_ctrl->outpath.out0.ch0));
+		msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch0]);
+	}
+
+	msm_io_w(irq_comp_mask, vfe32_ctrl->vfebase + VFE_IRQ_COMP_MASK);
+	msm_camio_bus_scale_cfg(
+		pmctl->sdata->pdata->cam_bus_scale_table, S_CAPTURE);
+	vfe32_start_common();
+	return 0;
+}
+
+static int vfe32_capture(
+	struct msm_cam_media_controller *pmctl,
+	uint32_t num_frames_capture)
+{
+	uint32_t irq_comp_mask = 0;
+	
+	vfe32_ctrl->outpath.out1.capture_cnt = num_frames_capture;
+	if (vfe32_ctrl->operation_mode == VFE_OUTPUTS_MAIN_AND_THUMB ||
+		vfe32_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_MAIN ||
+		vfe32_ctrl->operation_mode == VFE_OUTPUTS_JPEG_AND_THUMB ||
+		vfe32_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_JPEG) {
+		vfe32_ctrl->outpath.out0.capture_cnt =
+			num_frames_capture;
+	}
+
+	vfe32_ctrl->vfe_capture_count = num_frames_capture;
+	irq_comp_mask	= msm_io_r(vfe32_ctrl->vfebase + VFE_IRQ_COMP_MASK);
+
+	if (vfe32_ctrl->operation_mode == VFE_OUTPUTS_MAIN_AND_THUMB ||
+		vfe32_ctrl->operation_mode == VFE_OUTPUTS_JPEG_AND_THUMB ||
+		vfe32_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_MAIN) {
+		if (vfe32_ctrl->outpath.output_mode &
+			VFE32_OUTPUT_MODE_PRIMARY) {
+			irq_comp_mask |= (0x1 << vfe32_ctrl->outpath.out0.ch0 |
+					0x1 << vfe32_ctrl->outpath.out0.ch1);
+		}
+		if (vfe32_ctrl->outpath.output_mode &
+			VFE32_OUTPUT_MODE_SECONDARY) {
+			irq_comp_mask |=
+				(0x1 << (vfe32_ctrl->outpath.out1.ch0 + 8) |
+				0x1 << (vfe32_ctrl->outpath.out1.ch1 + 8));
+		}
+		if (vfe32_ctrl->outpath.output_mode &
+			VFE32_OUTPUT_MODE_PRIMARY) {
+			msm_io_w(1, vfe32_ctrl->vfebase +
+				vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch0]);
+			msm_io_w(1, vfe32_ctrl->vfebase +
+				vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch1]);
+		}
+		if (vfe32_ctrl->outpath.output_mode &
+			VFE32_OUTPUT_MODE_SECONDARY) {
+			msm_io_w(1, vfe32_ctrl->vfebase +
+				vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch0]);
+			msm_io_w(1, vfe32_ctrl->vfebase +
+				vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch1]);
+		}
+	}
+
+	vfe32_ctrl->vfe_capture_count = num_frames_capture;
+
+	msm_io_w(irq_comp_mask, vfe32_ctrl->vfebase + VFE_IRQ_COMP_MASK);
+	msm_io_r(vfe32_ctrl->vfebase + VFE_IRQ_COMP_MASK);
+	msm_camio_bus_scale_cfg(
+		pmctl->sdata->pdata->cam_bus_scale_table, S_CAPTURE);
+
+	vfe32_start_common();
+	
+	msm_io_w(1, vfe32_ctrl->vfebase + 0x18C);
+	msm_io_w(1, vfe32_ctrl->vfebase + 0x188);
+	return 0;
+}
+
+static int vfe32_start(struct msm_cam_media_controller *pmctl)
+{
+	uint32_t irq_comp_mask = 0;
+
+	irq_comp_mask	=
+		msm_io_r(vfe32_ctrl->vfebase + VFE_IRQ_COMP_MASK);
+
+	if (vfe32_ctrl->outpath.output_mode & VFE32_OUTPUT_MODE_PRIMARY) {
+		irq_comp_mask |= (0x1 << vfe32_ctrl->outpath.out0.ch0 |
+			0x1 << vfe32_ctrl->outpath.out0.ch1);
+	} else if (vfe32_ctrl->outpath.output_mode &
+			   VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
+		irq_comp_mask |= (0x1 << vfe32_ctrl->outpath.out0.ch0 |
+			0x1 << vfe32_ctrl->outpath.out0.ch1 |
+			0x1 << vfe32_ctrl->outpath.out0.ch2);
+	}
+	if (vfe32_ctrl->outpath.output_mode & VFE32_OUTPUT_MODE_SECONDARY) {
+		irq_comp_mask |= (0x1 << (vfe32_ctrl->outpath.out1.ch0 + 8) |
+			0x1 << (vfe32_ctrl->outpath.out1.ch1 + 8));
+	} else if (vfe32_ctrl->outpath.output_mode &
+			VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
+		irq_comp_mask |= (0x1 << (vfe32_ctrl->outpath.out1.ch0 + 8) |
+			0x1 << (vfe32_ctrl->outpath.out1.ch1 + 8) |
+			0x1 << (vfe32_ctrl->outpath.out1.ch2 + 8));
+	}
+	msm_io_w(irq_comp_mask, vfe32_ctrl->vfebase + VFE_IRQ_COMP_MASK);
+
+	switch (vfe32_ctrl->operation_mode) {
+	case VFE_OUTPUTS_PREVIEW:
+	case VFE_OUTPUTS_PREVIEW_AND_VIDEO:
+		if (vfe32_ctrl->outpath.output_mode &
+			VFE32_OUTPUT_MODE_PRIMARY) {
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch0]);
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch1]);
+		} else if (vfe32_ctrl->outpath.output_mode &
+				VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch0]);
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch1]);
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch2]);
+		}
+		break;
+	default:
+		if (vfe32_ctrl->outpath.output_mode &
+			VFE32_OUTPUT_MODE_SECONDARY) {
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch0]);
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch1]);
+		} else if (vfe32_ctrl->outpath.output_mode &
+			VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch0]);
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch1]);
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch2]);
+		}
+		break;
+	}
+
+	msm_camio_bus_scale_cfg(
+		pmctl->sdata->pdata->cam_bus_scale_table, S_PREVIEW);
+	vfe32_start_common();
+	return 0;
+}
+
+static void vfe32_update(void)
+{
+	unsigned long flags;
+	uint32_t value = 0;
+	if (vfe32_ctrl->update_linear) {
+		if (!msm_io_r(vfe32_ctrl->vfebase + V32_LINEARIZATION_OFF1))
+			msm_io_w(1,
+				vfe32_ctrl->vfebase + V32_LINEARIZATION_OFF1);
+		else
+			msm_io_w(0,
+				vfe32_ctrl->vfebase + V32_LINEARIZATION_OFF1);
+		vfe32_ctrl->update_linear = false;
+	}
+
+	if (vfe32_ctrl->update_rolloff) {
+		value = msm_io_r(vfe32_ctrl->vfebase +
+			V33_PCA_ROLL_OFF_CFG_OFF1);
+		value ^= V33_PCA_ROLL_OFF_LUT_BANK_SEL_MASK;
+		msm_io_w(value, vfe32_ctrl->vfebase +
+			V33_PCA_ROLL_OFF_CFG_OFF1);
+		vfe32_ctrl->update_rolloff = false;
+	}
+
+	if (vfe32_ctrl->update_la) {
+		if (!msm_io_r(vfe32_ctrl->vfebase + V32_LA_OFF))
+			msm_io_w(1,
+				vfe32_ctrl->vfebase + V32_LA_OFF);
+		else
+			msm_io_w(0,
+				vfe32_ctrl->vfebase + V32_LA_OFF);
+		vfe32_ctrl->update_la = false;
+	}
+
+	if (vfe32_ctrl->update_gamma) {
+		value = msm_io_r(vfe32_ctrl->vfebase + V32_RGB_G_OFF);
+		value ^= V32_GAMMA_LUT_BANK_SEL_MASK;
+		msm_io_w(value, vfe32_ctrl->vfebase + V32_RGB_G_OFF);
+		vfe32_ctrl->update_gamma = false;
+	}
+
+	spin_lock_irqsave(&vfe32_ctrl->update_ack_lock, flags);
+	vfe32_ctrl->update_ack_pending = TRUE;
+	spin_unlock_irqrestore(&vfe32_ctrl->update_ack_lock, flags);
+	msm_io_w_mb(1, vfe32_ctrl->vfebase + VFE_REG_UPDATE_CMD);
+	return;
+}
+
+static void vfe32_sync_timer_stop(void)
+{
+	uint32_t value = 0;
+	vfe32_ctrl->sync_timer_state = 0;
+	if (vfe32_ctrl->sync_timer_number == 0)
+		value = 0x10000;
+	else if (vfe32_ctrl->sync_timer_number == 1)
+		value = 0x20000;
+	else if (vfe32_ctrl->sync_timer_number == 2)
+		value = 0x40000;
+
+	
+	msm_io_w(value, vfe32_ctrl->vfebase + V32_SYNC_TIMER_OFF);
+}
+
+static void vfe32_sync_timer_start(const uint32_t *tbl)
+{
+	
+	uint32_t value = 1;
+	uint32_t val;
+
+	vfe32_ctrl->sync_timer_state = *tbl++;
+	vfe32_ctrl->sync_timer_repeat_count = *tbl++;
+	vfe32_ctrl->sync_timer_number = *tbl++;
+	CDBG("%s timer_state %d, repeat_cnt %d timer number %d\n",
+		 __func__, vfe32_ctrl->sync_timer_state,
+		 vfe32_ctrl->sync_timer_repeat_count,
+		 vfe32_ctrl->sync_timer_number);
+
+	if (vfe32_ctrl->sync_timer_state) { 
+		value = value << vfe32_ctrl->sync_timer_number;
+	} else { 
+		CDBG("Failed to Start timer\n");
+		return;
+	}
+
+	
+	msm_io_w(value, vfe32_ctrl->vfebase + V32_SYNC_TIMER_OFF);
+	
+	value = *tbl++;
+	msm_io_w(value, vfe32_ctrl->vfebase + V32_SYNC_TIMER_OFF +
+		4 + ((vfe32_ctrl->sync_timer_number) * 12));
+	
+	value = *tbl++;
+	msm_io_w(value, vfe32_ctrl->vfebase + V32_SYNC_TIMER_OFF +
+			 8 + ((vfe32_ctrl->sync_timer_number) * 12));
+	
+	value = *tbl++;
+	val = vfe_clk_rate / 10000;
+	val = 10000000 / val;
+	val = value * 10000 / val;
+	CDBG("%s: Pixel Clk Cycles!!! %d\n", __func__, val);
+	msm_io_w(val, vfe32_ctrl->vfebase + V32_SYNC_TIMER_OFF +
+		12 + ((vfe32_ctrl->sync_timer_number) * 12));
+	
+	value = *tbl++;
+	msm_io_w(value, vfe32_ctrl->vfebase + V32_SYNC_TIMER_POLARITY_OFF);
+	
+	value = 0;
+	msm_io_w(value, vfe32_ctrl->vfebase + V32_TIMER_SELECT_OFF);
+}
+
+static void vfe32_program_dmi_cfg(enum VFE32_DMI_RAM_SEL bankSel)
+{
+	
+	uint32_t value = VFE_DMI_CFG_DEFAULT;
+	value += (uint32_t)bankSel;
+	CDBG("%s: banksel = %d\n", __func__, bankSel);
+
+	msm_io_w(value, vfe32_ctrl->vfebase + VFE_DMI_CFG);
+	
+	msm_io_w(0, vfe32_ctrl->vfebase + VFE_DMI_ADDR);
+}
+static void vfe32_write_gamma_cfg(enum VFE32_DMI_RAM_SEL channel_sel,
+						const uint32_t *tbl)
+{
+	int i;
+	uint32_t value, value1, value2;
+	vfe32_program_dmi_cfg(channel_sel);
+	for (i = 0 ; i < (VFE32_GAMMA_NUM_ENTRIES/2) ; i++) {
+		value = *tbl++;
+		value1 = value & 0x0000FFFF;
+		value2 = (value & 0xFFFF0000)>>16;
+		msm_io_w((value1), vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+		msm_io_w((value2), vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+	}
+	vfe32_program_dmi_cfg(NO_MEM_SELECTED);
+}
+
+static void vfe32_read_gamma_cfg(enum VFE32_DMI_RAM_SEL channel_sel,
+	uint32_t *tbl)
+{
+	int i;
+	vfe32_program_dmi_cfg(channel_sel);
+	CDBG("%s: Gamma table channel: %d\n", __func__, channel_sel);
+	for (i = 0 ; i < VFE32_GAMMA_NUM_ENTRIES ; i++) {
+		*tbl = msm_io_r(vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+		CDBG("%s: %08x\n", __func__, *tbl);
+		tbl++;
+	}
+	vfe32_program_dmi_cfg(NO_MEM_SELECTED);
+}
+
+static void vfe32_write_la_cfg(enum VFE32_DMI_RAM_SEL channel_sel,
+						const uint32_t *tbl)
+{
+	uint32_t i;
+	uint32_t value, value1, value2;
+
+	vfe32_program_dmi_cfg(channel_sel);
+	for (i = 0 ; i < (VFE32_LA_TABLE_LENGTH/2) ; i++) {
+		value = *tbl++;
+		value1 = value & 0x0000FFFF;
+		value2 = (value & 0xFFFF0000)>>16;
+		msm_io_w((value1), vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+		msm_io_w((value2), vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+	}
+	vfe32_program_dmi_cfg(NO_MEM_SELECTED);
+}
+
+static struct vfe32_output_ch *vfe32_get_ch(int path)
+{
+	struct vfe32_output_ch *ch = NULL;
+
+	if (path == VFE_MSG_OUTPUT_PRIMARY)
+		ch = &vfe32_ctrl->outpath.out0;
+	else if (path == VFE_MSG_OUTPUT_SECONDARY)
+		ch = &vfe32_ctrl->outpath.out1;
+	else
+		pr_err("%s: Invalid path %d\n", __func__,
+			path);
+
+	BUG_ON(ch == NULL);
+	return ch;
+}
+static struct msm_free_buf *vfe32_check_free_buffer(int id, int path)
+{
+	struct vfe32_output_ch *outch = NULL;
+	struct msm_free_buf *b = NULL;
+	vfe32_subdev_notify(id, path);
+	outch = vfe32_get_ch(path);
+	if (outch->free_buf.ch_paddr[0])
+		b = &outch->free_buf;
+	return b;
+}
+static int vfe32_configure_pingpong_buffers(int id, int path)
+{
+	struct vfe32_output_ch *outch = NULL;
+	int rc = 0;
+	vfe32_subdev_notify(id, path);
+	outch = vfe32_get_ch(path);
+	
+	if(!outch)
+		return 0;
+	
+	if (outch->ping.ch_paddr[0] && outch->pong.ch_paddr[0]) {
+		
+		pr_info("%s Configure ping/pong address for %d",
+						__func__, path);
+		vfe32_put_ch_ping_addr(outch->ch0,
+			outch->ping.ch_paddr[0]);
+		vfe32_put_ch_pong_addr(outch->ch0,
+			outch->pong.ch_paddr[0]);
+
+		if (vfe32_ctrl->operation_mode !=
+			VFE_OUTPUTS_RAW) {
+			vfe32_put_ch_ping_addr(outch->ch1,
+				outch->ping.ch_paddr[1]);
+			vfe32_put_ch_pong_addr(outch->ch1,
+				outch->pong.ch_paddr[1]);
+		}
+
+		if (outch->ping.num_planes > 2)
+			vfe32_put_ch_ping_addr(outch->ch2,
+				outch->ping.ch_paddr[2]);
+		if (outch->pong.num_planes > 2)
+			vfe32_put_ch_pong_addr(outch->ch2,
+				outch->pong.ch_paddr[2]);
+
+		
+		memset(&outch->ping, 0, sizeof(struct msm_free_buf));
+		memset(&outch->pong, 0, sizeof(struct msm_free_buf));
+	} else {
+		pr_err("%s ping/pong addr is null!!", __func__);
+		rc = -EINVAL;
+	}
+	return rc;
+}
+
+static void vfe32_write_linear_cfg(enum VFE32_DMI_RAM_SEL channel_sel,
+	const uint32_t *tbl)
+{
+	uint32_t i;
+
+	vfe32_program_dmi_cfg(channel_sel);
+	
+	for (i = 0 ; i < VFE32_LINEARIZATON_TABLE_LENGTH ; i++) {
+		msm_io_w(*tbl, vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+		tbl++;
+	}
+	CDBG("done writing to linearization table\n");
+	vfe32_program_dmi_cfg(NO_MEM_SELECTED);
+}
+
+static void vfe32_send_isp_msg(
+	struct vfe32_ctrl_type *vctrl,
+	uint32_t isp_msg_id)
+{
+	struct isp_msg_event isp_msg_evt;
+
+	isp_msg_evt.msg_id = isp_msg_id;
+	isp_msg_evt.sof_count = vfe32_ctrl->vfeFrameId;
+	v4l2_subdev_notify(&vctrl->subdev,
+			NOTIFY_ISP_MSG_EVT,
+			(void *)&isp_msg_evt);
+}
+
+static int vfe32_proc_general(
+	struct msm_cam_media_controller *pmctl,
+	struct msm_isp_cmd *cmd)
+{
+	int i , rc = 0;
+	uint32_t old_val = 0 , new_val = 0;
+	uint32_t *cmdp = NULL;
+	uint32_t *cmdp_local = NULL;
+	uint32_t snapshot_cnt = 0;
+	uint32_t temp1 = 0, temp2 = 0;
+
+	CDBG("vfe32_proc_general: cmdID = %s, length = %d\n",
+		vfe32_general_cmd[cmd->id], cmd->length);
+	switch (cmd->id) {
+	case VFE_CMD_RESET:
+		pr_info("vfe32_proc_general: cmdID = %s\n",
+			vfe32_general_cmd[cmd->id]);
+		vfe32_reset();
+		break;
+	case VFE_CMD_START:
+		pr_info("vfe32_proc_general: cmdID = %s\n",
+			vfe32_general_cmd[cmd->id]);
+		if ((vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_PREVIEW_AND_VIDEO) ||
+				(vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_PREVIEW))
+			
+			rc = vfe32_configure_pingpong_buffers(
+				VFE_MSG_V32_START, VFE_MSG_OUTPUT_PRIMARY);
+		else
+			
+			rc = vfe32_configure_pingpong_buffers(
+				VFE_MSG_V32_START, VFE_MSG_OUTPUT_SECONDARY);
+		if (rc < 0) {
+			pr_err("%s error configuring pingpong buffers"
+				   " for preview", __func__);
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		rc = vfe32_start(pmctl);
+		break;
+	case VFE_CMD_UPDATE:
+		vfe32_update();
+		break;
+	case VFE_CMD_CAPTURE_RAW:
+		pr_info("%s: cmdID = VFE_CMD_CAPTURE_RAW\n", __func__);
+		if (copy_from_user(&snapshot_cnt, (void __user *)(cmd->value),
+				sizeof(uint32_t))) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		rc = vfe32_configure_pingpong_buffers(VFE_MSG_V32_CAPTURE,
+							VFE_MSG_OUTPUT_PRIMARY);
+		if (rc < 0) {
+			pr_err("%s error configuring pingpong buffers"
+				   " for snapshot", __func__);
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		rc = vfe32_capture_raw(pmctl, snapshot_cnt);
+		break;
+	case VFE_CMD_CAPTURE:
+		pr_info("vfe32_proc_general: cmdID = %s\n",
+			vfe32_general_cmd[cmd->id]);
+		if (copy_from_user(&snapshot_cnt, (void __user *)(cmd->value),
+				sizeof(uint32_t))) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+
+		if (vfe32_ctrl->operation_mode == VFE_OUTPUTS_JPEG_AND_THUMB ||
+		vfe32_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_JPEG) {
+			if (snapshot_cnt != 1) {
+				pr_err("only support 1 inline snapshot\n");
+				rc = -EINVAL;
+				goto proc_general_done;
+			}
+			
+			rc = vfe32_configure_pingpong_buffers(
+				VFE_MSG_V32_JPEG_CAPTURE,
+				VFE_MSG_OUTPUT_PRIMARY);
+		} else {
+			
+			rc = vfe32_configure_pingpong_buffers(
+				VFE_MSG_V32_CAPTURE,
+				VFE_MSG_OUTPUT_PRIMARY);
+		}
+		if (rc < 0) {
+			pr_err("%s error configuring pingpong buffers"
+				   " for primary output", __func__);
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		
+		rc = vfe32_configure_pingpong_buffers(VFE_MSG_V32_CAPTURE,
+						  VFE_MSG_OUTPUT_SECONDARY);
+		if (rc < 0) {
+			pr_err("%s error configuring pingpong buffers"
+				   " for secondary output", __func__);
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		rc = vfe32_capture(pmctl, snapshot_cnt);
+		break;
+	case VFE_CMD_START_RECORDING:
+		pr_info("vfe32_proc_general: cmdID = %s\n",
+			vfe32_general_cmd[cmd->id]);
+		if (vfe32_ctrl->operation_mode ==
+			VFE_OUTPUTS_PREVIEW_AND_VIDEO)
+			rc = vfe32_configure_pingpong_buffers(
+				VFE_MSG_V32_START_RECORDING,
+				VFE_MSG_OUTPUT_SECONDARY);
+		else if (vfe32_ctrl->operation_mode ==
+			VFE_OUTPUTS_VIDEO_AND_PREVIEW)
+			rc = vfe32_configure_pingpong_buffers(
+				VFE_MSG_V32_START_RECORDING,
+				VFE_MSG_OUTPUT_PRIMARY);
+		if (rc < 0) {
+			pr_err("%s error configuring pingpong buffers"
+				" for video", __func__);
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		rc = vfe32_start_recording(pmctl);
+		break;
+	case VFE_CMD_STOP_RECORDING:
+		pr_info("vfe32_proc_general: cmdID = %s\n",
+			vfe32_general_cmd[cmd->id]);
+		rc = vfe32_stop_recording(pmctl);
+		break;
+	case VFE_CMD_OPERATION_CFG: {
+		if (cmd->length != V32_OPERATION_CFG_LEN) {
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		cmdp = kmalloc(V32_OPERATION_CFG_LEN, GFP_ATOMIC);
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			V32_OPERATION_CFG_LEN)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		rc = vfe32_operation_config(cmdp);
+		}
+		break;
+
+	case VFE_CMD_STATS_AE_START: {
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		old_val = msm_io_r(vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		old_val |= AE_BG_ENABLE_MASK;
+		msm_io_w(old_val,
+			vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+		cmdp, (vfe32_cmd[cmd->id].length));
+		}
+		break;
+	case VFE_CMD_STATS_AF_START: {
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		old_val = msm_io_r(vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		old_val |= AF_BF_ENABLE_MASK;
+		msm_io_w(old_val,
+			vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+		cmdp, (vfe32_cmd[cmd->id].length));
+		}
+		break;
+	case VFE_CMD_STATS_AWB_START: {
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		old_val = msm_io_r(vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		old_val |= AWB_ENABLE_MASK;
+		msm_io_w(old_val,
+			vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+				cmdp, (vfe32_cmd[cmd->id].length));
+		}
+		break;
+
+	case VFE_CMD_STATS_IHIST_START: {
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		old_val = msm_io_r(vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		old_val |= IHIST_ENABLE_MASK;
+		msm_io_w(old_val,
+			vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+				cmdp, (vfe32_cmd[cmd->id].length));
+		}
+		break;
+
+
+	case VFE_CMD_STATS_RS_START: {
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+				cmdp, (vfe32_cmd[cmd->id].length));
+		}
+		break;
+
+	case VFE_CMD_STATS_CS_START: {
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+				cmdp, (vfe32_cmd[cmd->id].length));
+		}
+		break;
+
+	case VFE_CMD_MCE_UPDATE:
+	case VFE_CMD_MCE_CFG:{
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		old_val = msm_io_r(vfe32_ctrl->vfebase +
+			V32_CHROMA_SUP_OFF + 4);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		new_val = *cmdp_local;
+		old_val &= MCE_EN_MASK;
+		new_val = new_val | old_val;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_CHROMA_SUP_OFF + 4,
+			&new_val, 4);
+		cmdp_local += 1;
+
+		old_val = msm_io_r(vfe32_ctrl->vfebase +
+			V32_CHROMA_SUP_OFF + 8);
+		new_val = *cmdp_local;
+		old_val &= MCE_Q_K_MASK;
+		new_val = new_val | old_val;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_CHROMA_SUP_OFF + 8,
+		&new_val, 4);
+		cmdp_local += 1;
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+		cmdp_local, (vfe32_cmd[cmd->id].length));
+		}
+		break;
+	case VFE_CMD_CHROMA_SUP_UPDATE:
+	case VFE_CMD_CHROMA_SUP_CFG:{
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_CHROMA_SUP_OFF,
+			cmdp_local, 4);
+
+		cmdp_local += 1;
+		new_val = *cmdp_local;
+		old_val = msm_io_r(vfe32_ctrl->vfebase +
+			V32_CHROMA_SUP_OFF + 4);
+		old_val &= ~MCE_EN_MASK;
+		new_val = new_val | old_val;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_CHROMA_SUP_OFF + 4,
+			&new_val, 4);
+		cmdp_local += 1;
+
+		old_val = msm_io_r(vfe32_ctrl->vfebase +
+			V32_CHROMA_SUP_OFF + 8);
+		new_val = *cmdp_local;
+		old_val &= ~MCE_Q_K_MASK;
+		new_val = new_val | old_val;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_CHROMA_SUP_OFF + 8,
+			&new_val, 4);
+		}
+		break;
+	case VFE_CMD_BLACK_LEVEL_CFG:
+		rc = -EFAULT;
+		goto proc_general_done;
+
+	case VFE_CMD_MESH_ROLL_OFF_CFG: {
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value) , cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+		cmdp_local, 16);
+		cmdp_local += 4;
+		vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK0);
+		
+		for (i = 0; i < (V32_MESH_ROLL_OFF_INIT_TABLE_SIZE * 2); i++) {
+			msm_io_w(*cmdp_local ,
+			vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+			cmdp_local++;
+		}
+		CDBG("done writing init table\n");
+		
+		msm_io_w(V32_MESH_ROLL_OFF_DELTA_TABLE_OFFSET,
+		vfe32_ctrl->vfebase + VFE_DMI_ADDR);
+		
+		for (i = 0; i < (V32_MESH_ROLL_OFF_DELTA_TABLE_SIZE * 2); i++) {
+			msm_io_w(*cmdp_local,
+			vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+			cmdp_local++;
+		}
+		vfe32_program_dmi_cfg(NO_MEM_SELECTED);
+		}
+		break;
+
+	case VFE_CMD_GET_MESH_ROLLOFF_TABLE:
+		temp1 = sizeof(uint32_t) * ((V32_MESH_ROLL_OFF_INIT_TABLE_SIZE *
+			2) + (V32_MESH_ROLL_OFF_DELTA_TABLE_SIZE * 2));
+		if (cmd->length != temp1) {
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		cmdp = kzalloc(temp1, GFP_KERNEL);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK0);
+		CDBG("%s: Mesh Rolloff init Table\n", __func__);
+		for (i = 0; i < (V32_MESH_ROLL_OFF_INIT_TABLE_SIZE * 2); i++) {
+			*cmdp_local =
+				msm_io_r(vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+			CDBG("%s: %08x\n", __func__, *cmdp_local);
+			cmdp_local++;
+		}
+		msm_io_w(V32_MESH_ROLL_OFF_DELTA_TABLE_OFFSET,
+			vfe32_ctrl->vfebase + VFE_DMI_ADDR);
+		CDBG("%s: Mesh Rolloff Delta Table\n", __func__);
+		for (i = 0; i < (V32_MESH_ROLL_OFF_DELTA_TABLE_SIZE * 2); i++) {
+			*cmdp_local =
+				msm_io_r(vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+			CDBG("%s: %08x\n", __func__, *cmdp_local);
+			cmdp_local++;
+		}
+		CDBG("done reading delta table\n");
+		vfe32_program_dmi_cfg(NO_MEM_SELECTED);
+		if (copy_to_user((void __user *)(cmd->value), cmdp,
+			temp1)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		break;
+	case VFE_CMD_LA_CFG:
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+			cmdp_local, (vfe32_cmd[cmd->id].length));
+
+		cmdp_local += 1;
+		vfe32_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK0, cmdp_local);
+		break;
+
+	case VFE_CMD_LA_UPDATE: {
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+
+		cmdp_local = cmdp + 1;
+		old_val = msm_io_r(vfe32_ctrl->vfebase + V32_LA_OFF);
+		if (old_val != 0x0)
+			vfe32_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK0,
+				cmdp_local);
+		else
+			vfe32_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK1,
+				cmdp_local);
+		}
+		vfe32_ctrl->update_la = true;
+		break;
+
+	case VFE_CMD_GET_LA_TABLE:
+		temp1 = sizeof(uint32_t) * VFE32_LA_TABLE_LENGTH / 2;
+		if (cmd->length != temp1) {
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		cmdp = kzalloc(temp1, GFP_KERNEL);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		if (msm_io_r(vfe32_ctrl->vfebase + V32_LA_OFF))
+			vfe32_program_dmi_cfg(LUMA_ADAPT_LUT_RAM_BANK1);
+		else
+			vfe32_program_dmi_cfg(LUMA_ADAPT_LUT_RAM_BANK0);
+		for (i = 0 ; i < (VFE32_LA_TABLE_LENGTH / 2) ; i++) {
+			*cmdp_local =
+				msm_io_r(vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+			*cmdp_local |= (msm_io_r(vfe32_ctrl->vfebase +
+				VFE_DMI_DATA_LO)) << 16;
+			cmdp_local++;
+		}
+		vfe32_program_dmi_cfg(NO_MEM_SELECTED);
+		if (copy_to_user((void __user *)(cmd->value), cmdp,
+			temp1)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		break;
+	case VFE_CMD_SK_ENHAN_CFG:
+	case VFE_CMD_SK_ENHAN_UPDATE:{
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_SCE_OFF,
+				cmdp, V32_SCE_LEN);
+		}
+		break;
+
+	case VFE_CMD_LIVESHOT:
+		pr_info("vfe32_proc_general: cmdID = %s\n",
+			vfe32_general_cmd[cmd->id]);
+		
+		rc = vfe32_configure_pingpong_buffers(VFE_MSG_V32_CAPTURE,
+						VFE_MSG_OUTPUT_PRIMARY);
+		if (rc < 0) {
+			pr_err("%s error configuring pingpong buffers"
+				   " for primary output", __func__);
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		vfe32_start_liveshot(pmctl);
+		break;
+
+	case VFE_CMD_LINEARIZATION_CFG:
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp, (void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_LINEARIZATION_OFF1,
+			cmdp_local, V32_LINEARIZATION_LEN1);
+		cmdp_local += 4;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_LINEARIZATION_OFF2,
+			cmdp_local, V32_LINEARIZATION_LEN2);
+
+		cmdp_local = cmdp + 17;
+		vfe32_write_linear_cfg(BLACK_LUT_RAM_BANK0, cmdp_local);
+		break;
+
+	case VFE_CMD_LINEARIZATION_UPDATE:
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp, (void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		cmdp_local++;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_LINEARIZATION_OFF1 + 4,
+			cmdp_local, (V32_LINEARIZATION_LEN1 - 4));
+		cmdp_local += 3;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_LINEARIZATION_OFF2,
+			cmdp_local, V32_LINEARIZATION_LEN2);
+		cmdp_local = cmdp + 17;
+		
+		old_val =
+			msm_io_r(vfe32_ctrl->vfebase + V32_LINEARIZATION_OFF1);
+
+		if (old_val != 0x0)
+			vfe32_write_linear_cfg(BLACK_LUT_RAM_BANK0, cmdp_local);
+		else
+			vfe32_write_linear_cfg(BLACK_LUT_RAM_BANK1, cmdp_local);
+		vfe32_ctrl->update_linear = true;
+		break;
+
+	case VFE_CMD_GET_LINEARIZATON_TABLE:
+		temp1 = sizeof(uint32_t) * VFE32_LINEARIZATON_TABLE_LENGTH;
+		if (cmd->length != temp1) {
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		cmdp = kzalloc(temp1, GFP_KERNEL);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		if (msm_io_r(vfe32_ctrl->vfebase + V32_LINEARIZATION_OFF1))
+			vfe32_program_dmi_cfg(BLACK_LUT_RAM_BANK1);
+		else
+			vfe32_program_dmi_cfg(BLACK_LUT_RAM_BANK0);
+		CDBG("%s: Linearization Table\n", __func__);
+		for (i = 0 ; i < VFE32_LINEARIZATON_TABLE_LENGTH ; i++) {
+			*cmdp_local =
+				msm_io_r(vfe32_ctrl->vfebase + VFE_DMI_DATA_LO);
+			CDBG("%s: %08x\n", __func__, *cmdp_local);
+			cmdp_local++;
+		}
+		vfe32_program_dmi_cfg(NO_MEM_SELECTED);
+		if (copy_to_user((void __user *)(cmd->value), cmdp,
+			temp1)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		break;
+	case VFE_CMD_DEMOSAICV3:
+		if (cmd->length !=
+			V32_DEMOSAICV3_0_LEN+V32_DEMOSAICV3_1_LEN) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		new_val = *cmdp_local;
+
+		old_val = msm_io_r(vfe32_ctrl->vfebase + V32_DEMOSAICV3_0_OFF);
+		old_val &= DEMOSAIC_MASK;
+		new_val = new_val | old_val;
+		*cmdp_local = new_val;
+
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_DEMOSAICV3_0_OFF,
+			cmdp_local, V32_DEMOSAICV3_0_LEN);
+		cmdp_local += 1;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_DEMOSAICV3_1_OFF,
+			cmdp_local, V32_DEMOSAICV3_1_LEN);
+		break;
+
+	case VFE_CMD_DEMOSAICV3_UPDATE:
+		if (cmd->length !=
+			V32_DEMOSAICV3_0_LEN * V32_DEMOSAICV3_UP_REG_CNT) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		new_val = *cmdp_local;
+
+		old_val = msm_io_r(vfe32_ctrl->vfebase + V32_DEMOSAICV3_0_OFF);
+		old_val &= DEMOSAIC_MASK;
+		new_val = new_val | old_val;
+		*cmdp_local = new_val;
+
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_DEMOSAICV3_0_OFF,
+			cmdp_local, V32_DEMOSAICV3_0_LEN);
+		cmdp_local += 1;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_DEMOSAICV3_1_OFF,
+			cmdp_local, 2 * V32_DEMOSAICV3_0_LEN);
+		cmdp_local += 2;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_DEMOSAICV3_2_OFF,
+			cmdp_local, 2 * V32_DEMOSAICV3_0_LEN);
+		break;
+
+	case VFE_CMD_DEMOSAICV3_ABCC_CFG:
+		rc = -EFAULT;
+		break;
+
+	case VFE_CMD_DEMOSAICV3_ABF_UPDATE:
+	case VFE_CMD_DEMOSAICV3_ABF_CFG: { 
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		new_val = *cmdp_local;
+
+		old_val = msm_io_r(vfe32_ctrl->vfebase + V32_DEMOSAICV3_0_OFF);
+		old_val &= ABF_MASK;
+		new_val = new_val | old_val;
+		*cmdp_local = new_val;
+
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_DEMOSAICV3_0_OFF,
+		    cmdp_local, 4);
+
+		cmdp_local += 1;
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+			cmdp_local, (vfe32_cmd[cmd->id].length));
+		}
+		break;
+
+	case VFE_CMD_DEMOSAICV3_DBCC_CFG:
+	case VFE_CMD_DEMOSAICV3_DBCC_UPDATE:
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		new_val = *cmdp_local;
+
+		old_val = msm_io_r(vfe32_ctrl->vfebase + V32_DEMOSAICV3_0_OFF);
+		old_val &= DBCC_MASK;
+
+		new_val = new_val | old_val;
+		*cmdp_local = new_val;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_DEMOSAICV3_0_OFF,
+					cmdp_local, 4);
+		cmdp_local += 1;
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+			cmdp_local, (vfe32_cmd[cmd->id].length));
+		break;
+
+	case VFE_CMD_DEMOSAICV3_DBPC_CFG:
+	case VFE_CMD_DEMOSAICV3_DBPC_UPDATE:
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		new_val = *cmdp_local;
+
+		old_val = msm_io_r(vfe32_ctrl->vfebase + V32_DEMOSAICV3_0_OFF);
+		old_val &= DBPC_MASK;
+
+		new_val = new_val | old_val;
+		*cmdp_local = new_val;
+		msm_io_memcpy(vfe32_ctrl->vfebase +
+			V32_DEMOSAICV3_0_OFF,
+			cmdp_local, V32_DEMOSAICV3_LEN);
+		cmdp_local += 1;
+		msm_io_memcpy(vfe32_ctrl->vfebase +
+			V32_DEMOSAICV3_DBPC_CFG_OFF,
+			cmdp_local, V32_DEMOSAICV3_DBPC_LEN);
+		cmdp_local += 1;
+		msm_io_memcpy(vfe32_ctrl->vfebase +
+			V32_DEMOSAICV3_DBPC_CFG_OFF0,
+			cmdp_local, V32_DEMOSAICV3_DBPC_LEN);
+		cmdp_local += 1;
+		msm_io_memcpy(vfe32_ctrl->vfebase +
+			V32_DEMOSAICV3_DBPC_CFG_OFF1,
+			cmdp_local, V32_DEMOSAICV3_DBPC_LEN);
+		cmdp_local += 1;
+		msm_io_memcpy(vfe32_ctrl->vfebase +
+			V32_DEMOSAICV3_DBPC_CFG_OFF2,
+			cmdp_local, V32_DEMOSAICV3_DBPC_LEN);
+		break;
+
+	case VFE_CMD_RGB_G_CFG: {
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_RGB_G_OFF,
+			cmdp, 4);
+		cmdp += 1;
+
+		vfe32_write_gamma_cfg(RGBLUT_RAM_CH0_BANK0, cmdp);
+		vfe32_write_gamma_cfg(RGBLUT_RAM_CH1_BANK0, cmdp);
+		vfe32_write_gamma_cfg(RGBLUT_RAM_CH2_BANK0, cmdp);
+		}
+	    cmdp -= 1;
+		break;
+
+	case VFE_CMD_RGB_G_UPDATE: {
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp, (void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+
+		old_val = msm_io_r(vfe32_ctrl->vfebase + V32_RGB_G_OFF);
+		cmdp += 1;
+		if (old_val != 0x0) {
+			vfe32_write_gamma_cfg(RGBLUT_RAM_CH0_BANK0, cmdp);
+			vfe32_write_gamma_cfg(RGBLUT_RAM_CH1_BANK0, cmdp);
+			vfe32_write_gamma_cfg(RGBLUT_RAM_CH2_BANK0, cmdp);
+		} else {
+			vfe32_write_gamma_cfg(RGBLUT_RAM_CH0_BANK1, cmdp);
+			vfe32_write_gamma_cfg(RGBLUT_RAM_CH1_BANK1, cmdp);
+			vfe32_write_gamma_cfg(RGBLUT_RAM_CH2_BANK1, cmdp);
+		}
+		}
+		vfe32_ctrl->update_gamma = TRUE;
+		cmdp -= 1;
+		break;
+
+	case VFE_CMD_GET_RGB_G_TABLE:
+		temp1 = sizeof(uint32_t) * VFE32_GAMMA_NUM_ENTRIES * 3;
+		if (cmd->length != temp1) {
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		cmdp = kzalloc(temp1, GFP_KERNEL);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+
+		old_val = msm_io_r(vfe32_ctrl->vfebase + V32_RGB_G_OFF);
+		temp2 = old_val ? RGBLUT_RAM_CH0_BANK1 :
+			RGBLUT_RAM_CH0_BANK0;
+		for (i = 0; i < 3; i++) {
+			vfe32_read_gamma_cfg(temp2,
+				cmdp_local + (VFE32_GAMMA_NUM_ENTRIES * i));
+			temp2 += 2;
+		}
+		if (copy_to_user((void __user *)(cmd->value), cmdp,
+			temp1)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		break;
+
+	case VFE_CMD_STATS_AWB_STOP: {
+		old_val = msm_io_r(vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		old_val &= ~AWB_ENABLE_MASK;
+		msm_io_w(old_val,
+			vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		}
+		break;
+	case VFE_CMD_STATS_AE_STOP: {
+		old_val = msm_io_r(vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		old_val &= ~AE_BG_ENABLE_MASK;
+		msm_io_w(old_val,
+			vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		}
+		break;
+	case VFE_CMD_STATS_AF_STOP: {
+		old_val = msm_io_r(vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		old_val &= ~AF_BF_ENABLE_MASK;
+		msm_io_w(old_val,
+			vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		}
+		break;
+
+	case VFE_CMD_STATS_IHIST_STOP: {
+		old_val = msm_io_r(vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		old_val &= ~IHIST_ENABLE_MASK;
+		msm_io_w(old_val,
+			vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		}
+		break;
+
+	case VFE_CMD_STATS_RS_STOP: {
+		old_val = msm_io_r(vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		old_val &= ~RS_ENABLE_MASK;
+		msm_io_w(old_val,
+			vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		}
+		break;
+
+	case VFE_CMD_STATS_CS_STOP: {
+		old_val = msm_io_r(vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		old_val &= ~CS_ENABLE_MASK;
+		msm_io_w(old_val,
+			vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		}
+		break;
+	case VFE_CMD_STOP:
+		pr_info("vfe32_proc_general: cmdID = %s\n",
+			vfe32_general_cmd[cmd->id]);
+		vfe32_stop();
+		break;
+
+	case VFE_CMD_SYNC_TIMER_SETTING:
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp, (void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		vfe32_sync_timer_start(cmdp);
+		break;
+
+	case VFE_CMD_MODULE_CFG: {
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		*cmdp &= ~STATS_ENABLE_MASK;
+		old_val = msm_io_r(vfe32_ctrl->vfebase + VFE_MODULE_CFG);
+		old_val &= STATS_ENABLE_MASK;
+		*cmdp |= old_val;
+
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+			cmdp, (vfe32_cmd[cmd->id].length));
+		}
+		break;
+
+	case VFE_CMD_ZSL:
+		pr_info("vfe32_proc_general: cmdID = %s\n",
+			vfe32_general_cmd[cmd->id]);
+		rc = vfe32_configure_pingpong_buffers(VFE_MSG_V32_START,
+			VFE_MSG_OUTPUT_PRIMARY);
+		if (rc < 0)
+			goto proc_general_done;
+		rc = vfe32_configure_pingpong_buffers(VFE_MSG_V32_START,
+			VFE_MSG_OUTPUT_SECONDARY);
+		if (rc < 0)
+			goto proc_general_done;
+
+		rc = vfe32_zsl(pmctl);
+		break;
+
+	case VFE_CMD_ASF_CFG:
+	case VFE_CMD_ASF_UPDATE:
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp, (void __user *)(cmd->value),
+			cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+			cmdp, (vfe32_cmd[cmd->id].length));
+		cmdp_local = cmdp + V32_ASF_LEN/4;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V32_ASF_SPECIAL_EFX_CFG_OFF,
+			cmdp_local, V32_ASF_SPECIAL_EFX_CFG_LEN);
+		break;
+
+	case VFE_CMD_PCA_ROLL_OFF_CFG:
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value) , cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+
+		cmdp_local = cmdp;
+
+		temp1 = *cmdp_local;
+		cmdp_local++;
+
+		msm_io_memcpy(vfe32_ctrl->vfebase + V33_PCA_ROLL_OFF_CFG_OFF1,
+			cmdp_local, V33_PCA_ROLL_OFF_CFG_LEN1);
+		cmdp_local += 4;
+		msm_io_memcpy(vfe32_ctrl->vfebase + V33_PCA_ROLL_OFF_CFG_OFF2,
+			cmdp_local, V33_PCA_ROLL_OFF_CFG_LEN2);
+
+		cmdp_local += 3;
+		CDBG("%s: start writing RollOff Ram0 table\n", __func__);
+		vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK0);
+		msm_io_w(temp1, vfe32_ctrl->vfebase + VFE_DMI_ADDR);
+		for (i = 0 ; i < V33_PCA_ROLL_OFF_TABLE_SIZE ; i++) {
+			msm_io_w(*(cmdp_local + 1),
+				vfe32_ctrl->vfebase + VFE33_DMI_DATA_HI);
+			msm_io_w(*cmdp_local,
+				vfe32_ctrl->vfebase + VFE33_DMI_DATA_LO);
+			cmdp_local += 2;
+		}
+		CDBG("%s: end writing RollOff Ram0 table\n", __func__);
+
+		CDBG("%s: start writing RollOff Ram1 table\n", __func__);
+		vfe32_program_dmi_cfg(ROLLOFF_RAM1_BANK0);
+		msm_io_w(temp1, vfe32_ctrl->vfebase + VFE_DMI_ADDR);
+		for (i = 0 ; i < V33_PCA_ROLL_OFF_TABLE_SIZE ; i++) {
+			msm_io_w(*cmdp_local,
+				vfe32_ctrl->vfebase + VFE33_DMI_DATA_LO);
+			cmdp_local += 2;
+		}
+		CDBG("%s: end writing RollOff Ram1 table\n", __func__);
+
+		vfe32_program_dmi_cfg(NO_MEM_SELECTED);
+		break;
+
+	case VFE_CMD_PCA_ROLL_OFF_UPDATE:
+		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		if (copy_from_user(cmdp,
+			(void __user *)(cmd->value), cmd->length)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+
+		cmdp_local = cmdp;
+
+		temp1 = *cmdp_local;
+		cmdp_local += 8;
+
+		temp2 = msm_io_r(vfe32_ctrl->vfebase +
+			V33_PCA_ROLL_OFF_CFG_OFF1)
+			& V33_PCA_ROLL_OFF_LUT_BANK_SEL_MASK;
+
+		CDBG("%s: start writing RollOff Ram0 table\n", __func__);
+		if (temp2)
+			vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK0);
+		else
+			vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK1);
+
+		msm_io_w(temp1, vfe32_ctrl->vfebase + VFE_DMI_ADDR);
+		for (i = 0 ; i < V33_PCA_ROLL_OFF_TABLE_SIZE ; i++) {
+			msm_io_w(*(cmdp_local + 1),
+				vfe32_ctrl->vfebase + VFE33_DMI_DATA_HI);
+			msm_io_w(*cmdp_local,
+				vfe32_ctrl->vfebase + VFE33_DMI_DATA_LO);
+			cmdp_local += 2;
+		}
+		CDBG("%s: end writing RollOff Ram0 table\n", __func__);
+
+		CDBG("%s: start writing RollOff Ram1 table\n", __func__);
+		if (temp2)
+			vfe32_program_dmi_cfg(ROLLOFF_RAM1_BANK0);
+		else
+			vfe32_program_dmi_cfg(ROLLOFF_RAM1_BANK1);
+
+		msm_io_w(temp1, vfe32_ctrl->vfebase + VFE_DMI_ADDR);
+		for (i = 0 ; i < V33_PCA_ROLL_OFF_TABLE_SIZE ; i++) {
+			msm_io_w(*cmdp_local,
+				vfe32_ctrl->vfebase + VFE33_DMI_DATA_LO);
+			cmdp_local += 2;
+		}
+		CDBG("%s: end writing RollOff Ram1 table\n", __func__);
+
+		vfe32_program_dmi_cfg(NO_MEM_SELECTED);
+		vfe32_ctrl->update_rolloff = true;
+		break;
+	case VFE_CMD_GET_PCA_ROLLOFF_TABLE:
+		temp1 = sizeof(uint64_t) * V33_PCA_ROLL_OFF_TABLE_SIZE * 2;
+		if (cmd->length != temp1) {
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		cmdp = kzalloc(temp1, GFP_KERNEL);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		cmdp_local = cmdp;
+		old_val = msm_io_r(vfe32_ctrl->vfebase +
+			V33_PCA_ROLL_OFF_CFG_OFF1) &
+			V33_PCA_ROLL_OFF_LUT_BANK_SEL_MASK;
+
+		if (old_val)
+			vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK1);
+		else
+			vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK0);
+
+		CDBG("%s: PCA Rolloff Ram0\n", __func__);
+		for (i = 0 ; i < V33_PCA_ROLL_OFF_TABLE_SIZE * 2; i++) {
+			temp2 = (i == (V33_PCA_ROLL_OFF_TABLE_SIZE));
+			if (old_val && temp2)
+				vfe32_program_dmi_cfg(ROLLOFF_RAM1_BANK1);
+			else if (!old_val && temp2)
+				vfe32_program_dmi_cfg(ROLLOFF_RAM1_BANK0);
+
+			*cmdp_local = msm_io_r(vfe32_ctrl->vfebase +
+				VFE33_DMI_DATA_LO);
+			*(cmdp_local + 1) =
+				msm_io_r(vfe32_ctrl->vfebase +
+				VFE33_DMI_DATA_HI);
+			CDBG("%s: %08x%08x\n", __func__,
+				*(cmdp_local + 1), *cmdp_local);
+			cmdp_local += 2;
+		}
+		vfe32_program_dmi_cfg(NO_MEM_SELECTED);
+		if (copy_to_user((void __user *)(cmd->value), cmdp,
+			temp1)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		break;
+	case VFE_CMD_GET_HW_VERSION:
+		if (cmd->length != V32_GET_HW_VERSION_LEN) {
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		cmdp = kmalloc(V32_GET_HW_VERSION_LEN, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		*cmdp = msm_io_r(vfe32_ctrl->vfebase+V32_GET_HW_VERSION_OFF);
+		if (copy_to_user((void __user *)(cmd->value), cmdp,
+			V32_GET_HW_VERSION_LEN)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		break;
+	case VFE_CMD_GET_REG_DUMP:
+		temp1 = sizeof(uint32_t) * vfe32_ctrl->register_total;
+		if (cmd->length != temp1) {
+			rc = -EINVAL;
+			goto proc_general_done;
+		}
+		cmdp = kmalloc(temp1, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+		msm_io_dump(vfe32_ctrl->vfebase, vfe32_ctrl->register_total*4);
+		CDBG("%s: %p %p %d\n", __func__, (void *)cmdp,
+			vfe32_ctrl->vfebase, temp1);
+		memcpy_fromio((void *)cmdp, vfe32_ctrl->vfebase, temp1);
+		if (copy_to_user((void __user *)(cmd->value), cmdp, temp1)) {
+			rc = -EFAULT;
+			goto proc_general_done;
+		}
+		break;
+	case VFE_CMD_FRAME_SKIP_CFG:
+		if (cmd->length != vfe32_cmd[cmd->id].length)
+			return -EINVAL;
+
+		cmdp = kmalloc(vfe32_cmd[cmd->id].length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+
+		CHECKED_COPY_FROM_USER(cmdp);
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+			cmdp, (vfe32_cmd[cmd->id].length));
+		vfe32_ctrl->frame_skip_cnt = ((uint32_t)
+			*cmdp & VFE_FRAME_SKIP_PERIOD_MASK) + 1;
+		vfe32_ctrl->frame_skip_pattern = (uint32_t)(*(cmdp + 2));
+		break;
+	case VFE_CMD_STOP_LIVESHOT:
+		CDBG("%s Stopping liveshot ", __func__);
+		vfe32_stop_liveshot(pmctl);
+		break;
+	default:
+		if (cmd->length != vfe32_cmd[cmd->id].length)
+			return -EINVAL;
+
+		cmdp = kmalloc(vfe32_cmd[cmd->id].length, GFP_ATOMIC);
+		if (!cmdp) {
+			rc = -ENOMEM;
+			goto proc_general_done;
+		}
+
+		CHECKED_COPY_FROM_USER(cmdp);
+		msm_io_memcpy(vfe32_ctrl->vfebase + vfe32_cmd[cmd->id].offset,
+			cmdp, (vfe32_cmd[cmd->id].length));
+		break;
+
+	}
+
+proc_general_done:
+	kfree(cmdp);
+
+	return rc;
+}
+
+static void vfe32_stats_af_ack(struct vfe_cmd_stats_ack *pAck)
+{
+	unsigned long flags;
+	spinlock_t *lock = (vfe32_ctrl->stats_comp ?
+		&vfe32_ctrl->comp_stats_ack_lock :
+		&vfe32_ctrl->af_ack_lock);
+	spin_lock_irqsave(lock, flags);
+	vfe32_ctrl->afStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
+	vfe32_ctrl->afStatsControl.ackPending = FALSE;
+	spin_unlock_irqrestore(lock, flags);
+}
+
+static void vfe32_stats_awb_ack(struct vfe_cmd_stats_ack *pAck)
+{
+	unsigned long flags;
+	spinlock_t *lock = (vfe32_ctrl->stats_comp ?
+		&vfe32_ctrl->comp_stats_ack_lock :
+		&vfe32_ctrl->awb_ack_lock);
+	spin_lock_irqsave(lock, flags);
+	vfe32_ctrl->awbStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
+	vfe32_ctrl->awbStatsControl.ackPending = FALSE;
+	spin_unlock_irqrestore(lock, flags);
+}
+
+static void vfe32_stats_aec_ack(struct vfe_cmd_stats_ack *pAck)
+{
+	unsigned long flags;
+	spinlock_t *lock = (vfe32_ctrl->stats_comp ?
+		&vfe32_ctrl->comp_stats_ack_lock :
+		&vfe32_ctrl->aec_ack_lock);
+	spin_lock_irqsave(lock, flags);
+	vfe32_ctrl->aecStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
+	vfe32_ctrl->aecStatsControl.ackPending = FALSE;
+	spin_unlock_irqrestore(lock, flags);
+}
+
+static void vfe32_stats_ihist_ack(struct vfe_cmd_stats_ack *pAck)
+{
+	unsigned long flags;
+	spinlock_t *lock = (vfe32_ctrl->stats_comp ?
+		&vfe32_ctrl->comp_stats_ack_lock :
+		&vfe32_ctrl->ihist_ack_lock);
+	spin_lock_irqsave(lock, flags);
+	vfe32_ctrl->ihistStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
+	vfe32_ctrl->ihistStatsControl.ackPending = FALSE;
+	spin_unlock_irqrestore(lock, flags);
+}
+static void vfe32_stats_rs_ack(struct vfe_cmd_stats_ack *pAck)
+{
+	unsigned long flags;
+	spinlock_t *lock = (vfe32_ctrl->stats_comp ?
+		&vfe32_ctrl->comp_stats_ack_lock :
+		&vfe32_ctrl->rs_ack_lock);
+	spin_lock_irqsave(lock, flags);
+	vfe32_ctrl->rsStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
+	vfe32_ctrl->rsStatsControl.ackPending = FALSE;
+	spin_unlock_irqrestore(lock, flags);
+}
+static void vfe32_stats_cs_ack(struct vfe_cmd_stats_ack *pAck)
+{
+	unsigned long flags;
+	spinlock_t *lock = (vfe32_ctrl->stats_comp ?
+		&vfe32_ctrl->comp_stats_ack_lock :
+		&vfe32_ctrl->cs_ack_lock);
+	spin_lock_irqsave(lock, flags);
+	vfe32_ctrl->csStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
+	vfe32_ctrl->csStatsControl.ackPending = FALSE;
+	spin_unlock_irqrestore(lock, flags);
+}
+
+static inline void vfe32_read_irq_status(struct vfe32_irq_status *out)
+{
+	uint32_t *temp;
+	memset(out, 0, sizeof(struct vfe32_irq_status));
+	temp = (uint32_t *)(vfe32_ctrl->vfebase + VFE_IRQ_STATUS_0);
+	out->vfeIrqStatus0 = msm_io_r(temp);
+
+	temp = (uint32_t *)(vfe32_ctrl->vfebase + VFE_IRQ_STATUS_1);
+	out->vfeIrqStatus1 = msm_io_r(temp);
+
+	temp = (uint32_t *)(vfe32_ctrl->vfebase + VFE_CAMIF_STATUS);
+	out->camifStatus = msm_io_r(temp);
+	CDBG("camifStatus  = 0x%x\n", out->camifStatus);
+
+	
+	msm_io_w(out->vfeIrqStatus0, vfe32_ctrl->vfebase + VFE_IRQ_CLEAR_0);
+	msm_io_w(out->vfeIrqStatus1, vfe32_ctrl->vfebase + VFE_IRQ_CLEAR_1);
+
+	msm_io_w_mb(1, vfe32_ctrl->vfebase + VFE_IRQ_CMD);
+
+}
+
+static void vfe32_process_reg_update_irq(void)
+{
+	unsigned long flags;
+
+	if (vfe32_ctrl->recording_state == VFE_STATE_START_REQUESTED) {
+		if (vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_VIDEO_AND_PREVIEW) {
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch0]);
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch1]);
+		} else if (vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_PREVIEW_AND_VIDEO) {
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch0]);
+			msm_io_w(1, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch1]);
+		}
+		vfe32_ctrl->recording_state = VFE_STATE_STARTED;
+		msm_io_w_mb(1, vfe32_ctrl->vfebase + VFE_REG_UPDATE_CMD);
+		CDBG("start video triggered .\n");
+	} else if (vfe32_ctrl->recording_state ==
+			VFE_STATE_STOP_REQUESTED) {
+		if (vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_VIDEO_AND_PREVIEW) {
+			msm_io_w(0, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch0]);
+			msm_io_w(0, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch1]);
+		} else if (vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_PREVIEW_AND_VIDEO) {
+			msm_io_w(0, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch0]);
+			msm_io_w(0, vfe32_ctrl->vfebase +
+			vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out1.ch1]);
+		}
+		CDBG("stop video triggered .\n");
+	}
+
+	if (vfe32_ctrl->start_ack_pending == TRUE) {
+		pr_info("%s: MSG_ID_START_ACK\n", __func__);
+		vfe32_send_isp_msg(vfe32_ctrl, MSG_ID_START_ACK);
+		vfe32_ctrl->start_ack_pending = FALSE;
+	} else {
+		if (vfe32_ctrl->recording_state ==
+				VFE_STATE_STOP_REQUESTED) {
+			vfe32_ctrl->recording_state = VFE_STATE_STOPPED;
+			msm_io_w_mb(1,
+			vfe32_ctrl->vfebase + VFE_REG_UPDATE_CMD);
+		} else if (vfe32_ctrl->recording_state ==
+					VFE_STATE_STOPPED) {
+			vfe32_send_isp_msg(vfe32_ctrl, MSG_ID_STOP_REC_ACK);
+			vfe32_ctrl->recording_state = VFE_STATE_IDLE;
+		}
+		spin_lock_irqsave(&vfe32_ctrl->update_ack_lock, flags);
+		if (vfe32_ctrl->update_ack_pending == TRUE) {
+			vfe32_ctrl->update_ack_pending = FALSE;
+			spin_unlock_irqrestore(
+				&vfe32_ctrl->update_ack_lock, flags);
+			vfe32_send_isp_msg(vfe32_ctrl, MSG_ID_UPDATE_ACK);
+		} else {
+			spin_unlock_irqrestore(
+				&vfe32_ctrl->update_ack_lock, flags);
+		}
+	}
+
+	switch (vfe32_ctrl->liveshot_state) {
+		case VFE_STATE_START_REQUESTED:
+			pr_info("%s enabling liveshot output\n", __func__);
+			if (vfe32_ctrl->outpath.output_mode &
+				VFE32_OUTPUT_MODE_PRIMARY) {
+				msm_io_w(1, vfe32_ctrl->vfebase +
+				vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch0]);
+				msm_io_w(1, vfe32_ctrl->vfebase +
+				vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch1]);
+
+				vfe32_ctrl->liveshot_state = VFE_STATE_STARTED;
+			}
+			break;
+		case VFE_STATE_STARTED:
+			vfe32_ctrl->vfe_capture_count--;
+			if (!vfe32_ctrl->vfe_capture_count &&
+				(vfe32_ctrl->outpath.output_mode &
+					VFE32_OUTPUT_MODE_PRIMARY)) {
+				msm_io_w(0, vfe32_ctrl->vfebase +
+				vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch0]);
+				msm_io_w(0, vfe32_ctrl->vfebase +
+				vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch1]);
+			}
+			break;
+		case VFE_STATE_STOP_REQUESTED:
+			if (vfe32_ctrl->outpath.output_mode &
+					VFE32_OUTPUT_MODE_PRIMARY) {
+				msm_io_w(0, vfe32_ctrl->vfebase +
+				vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch0]);
+				msm_io_w(0, vfe32_ctrl->vfebase +
+				vfe32_AXI_WM_CFG[vfe32_ctrl->outpath.out0.ch1]);
+
+				vfe32_ctrl->liveshot_state = VFE_STATE_STOPPED;
+				msm_io_w_mb(1, vfe32_ctrl->vfebase +
+					VFE_REG_UPDATE_CMD);
+			}
+			break;
+		case VFE_STATE_STOPPED:
+			pr_info("%s Sending STOP_LS ACK\n", __func__);
+			vfe32_send_isp_msg(vfe32_ctrl, MSG_ID_STOP_LS_ACK);
+			vfe32_ctrl->liveshot_state = VFE_STATE_IDLE;
+			break;
+		default:
+			break;
+	}
+
+	if ((vfe32_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_MAIN) ||
+		(vfe32_ctrl->operation_mode == VFE_OUTPUTS_MAIN_AND_THUMB) ||
+		(vfe32_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_JPEG) ||
+		(vfe32_ctrl->operation_mode == VFE_OUTPUTS_JPEG_AND_THUMB)) {
+		
+		
+		if (vfe32_ctrl->frame_skip_pattern & (0x1 <<
+			(vfe32_ctrl->snapshot_frame_cnt %
+				vfe32_ctrl->frame_skip_cnt))) {
+			vfe32_ctrl->vfe_capture_count--;
+			
+			if (vfe32_ctrl->vfe_capture_count == 0) {
+				
+				if (vfe32_ctrl->outpath.output_mode &
+						VFE32_OUTPUT_MODE_PRIMARY) {
+					msm_io_w(0, vfe32_ctrl->vfebase +
+						vfe32_AXI_WM_CFG[vfe32_ctrl->
+							outpath.out0.ch0]);
+					msm_io_w(0, vfe32_ctrl->vfebase +
+						vfe32_AXI_WM_CFG[vfe32_ctrl->
+							outpath.out0.ch1]);
+				}
+				if (vfe32_ctrl->outpath.output_mode &
+						VFE32_OUTPUT_MODE_SECONDARY) {
+					msm_io_w(0, vfe32_ctrl->vfebase +
+						vfe32_AXI_WM_CFG[vfe32_ctrl->
+							outpath.out1.ch0]);
+					msm_io_w(0, vfe32_ctrl->vfebase +
+						vfe32_AXI_WM_CFG[vfe32_ctrl->
+							outpath.out1.ch1]);
+				}
+				msm_io_w_mb
+				(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
+				vfe32_ctrl->vfebase + VFE_CAMIF_COMMAND);
+				vfe32_ctrl->snapshot_frame_cnt = -1;
+				vfe32_ctrl->frame_skip_cnt = 31;
+				vfe32_ctrl->frame_skip_pattern = 0xffffffff;
+			} 
+		} 
+		vfe32_ctrl->snapshot_frame_cnt++;
+		
+		msm_io_w(1, vfe32_ctrl->vfebase + VFE_REG_UPDATE_CMD);
+	} 
+}
+
+static void vfe32_set_default_reg_values(void)
+{
+	msm_io_w(0x800080, vfe32_ctrl->vfebase + VFE_DEMUX_GAIN_0);
+	msm_io_w(0x800080, vfe32_ctrl->vfebase + VFE_DEMUX_GAIN_1);
+	
+	msm_io_w(0xFFFFF, vfe32_ctrl->vfebase + VFE_CGC_OVERRIDE);
+
+	
+	msm_io_w(0x1f, vfe32_ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_CFG);
+	msm_io_w(0x1f, vfe32_ctrl->vfebase + VFE_FRAMEDROP_ENC_CBCR_CFG);
+	msm_io_w(0xFFFFFFFF, vfe32_ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_PATTERN);
+	msm_io_w(0xFFFFFFFF,
+		vfe32_ctrl->vfebase + VFE_FRAMEDROP_ENC_CBCR_PATTERN);
+	msm_io_w(0x1f, vfe32_ctrl->vfebase + VFE_FRAMEDROP_VIEW_Y);
+	msm_io_w(0x1f, vfe32_ctrl->vfebase + VFE_FRAMEDROP_VIEW_CBCR);
+	msm_io_w(0xFFFFFFFF,
+		vfe32_ctrl->vfebase + VFE_FRAMEDROP_VIEW_Y_PATTERN);
+	msm_io_w(0xFFFFFFFF,
+		vfe32_ctrl->vfebase + VFE_FRAMEDROP_VIEW_CBCR_PATTERN);
+	msm_io_w(0, vfe32_ctrl->vfebase + VFE_CLAMP_MIN);
+	msm_io_w(0xFFFFFF, vfe32_ctrl->vfebase + VFE_CLAMP_MAX);
+
+	
+	msm_io_w(0x3980007, vfe32_ctrl->vfebase + VFE_BUS_STATS_AEC_UB_CFG);
+	msm_io_w(0x3A00007, vfe32_ctrl->vfebase + VFE_BUS_STATS_AF_UB_CFG);
+	msm_io_w(0x3A8000F, vfe32_ctrl->vfebase + VFE_BUS_STATS_AWB_UB_CFG);
+	msm_io_w(0x3B80007, vfe32_ctrl->vfebase + VFE_BUS_STATS_RS_UB_CFG);
+	msm_io_w(0x3C0001F, vfe32_ctrl->vfebase + VFE_BUS_STATS_CS_UB_CFG);
+	msm_io_w(0x3E0001F, vfe32_ctrl->vfebase + VFE_BUS_STATS_HIST_UB_CFG);
+}
+
+static void vfe32_process_reset_irq(void)
+{
+	unsigned long flags;
+
+	atomic_set(&vfe32_ctrl->vstate, 0);
+
+	spin_lock_irqsave(&vfe32_ctrl->stop_flag_lock, flags);
+	if (vfe32_ctrl->stop_ack_pending) {
+		vfe32_ctrl->stop_ack_pending = FALSE;
+		spin_unlock_irqrestore(&vfe32_ctrl->stop_flag_lock, flags);
+		vfe32_send_isp_msg(vfe32_ctrl, MSG_ID_STOP_ACK);
+	} else {
+		spin_unlock_irqrestore(&vfe32_ctrl->stop_flag_lock, flags);
+		
+		vfe32_set_default_reg_values();
+
+		
+		msm_io_w(0x7FFF, vfe32_ctrl->vfebase + VFE_BUS_CMD);
+		vfe32_send_isp_msg(vfe32_ctrl, MSG_ID_RESET_ACK);
+	}
+}
+
+static void vfe32_process_camif_sof_irq(void)
+{
+	if (vfe32_ctrl->operation_mode ==
+		VFE_OUTPUTS_RAW) {
+		if (vfe32_ctrl->start_ack_pending) {
+			pr_info("%s: MSG_ID_START_ACK\n", __func__);
+			vfe32_send_isp_msg(vfe32_ctrl, MSG_ID_START_ACK);
+			vfe32_ctrl->start_ack_pending = FALSE;
+		}
+		vfe32_ctrl->vfe_capture_count--;
+		
+		if (vfe32_ctrl->vfe_capture_count == 0) {
+			msm_io_w_mb(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
+				vfe32_ctrl->vfebase + VFE_CAMIF_COMMAND);
+		}
+	} 
+
+	if (vfe32_ctrl->vfeFrameId == 0)
+		pr_info("irq startAckIrq sof\n");
+
+	if ((vfe32_ctrl->hfr_mode != HFR_MODE_OFF) &&
+		(vfe32_ctrl->operation_mode == VFE_MODE_OF_OPERATION_VIDEO) &&
+		(vfe32_ctrl->vfeFrameId % vfe32_ctrl->hfr_mode != 0)) {
+		vfe32_ctrl->vfeFrameId++;
+		CDBG("Skip the SOF notification when HFR enabled\n");
+		return;
+	}
+	vfe32_ctrl->vfeFrameId++;
+	vfe32_send_isp_msg(vfe32_ctrl, MSG_ID_SOF_ACK);
+	CDBG("camif_sof_irq, frameId = %d\n", vfe32_ctrl->vfeFrameId);
+
+	if (vfe32_ctrl->sync_timer_state) {
+		if (vfe32_ctrl->sync_timer_repeat_count == 0)
+			vfe32_sync_timer_stop();
+		else
+			vfe32_ctrl->sync_timer_repeat_count--;
+	}
+}
+
+static void vfe32_process_error_irq(uint32_t errStatus)
+{
+	uint32_t reg_value;
+
+	if (errStatus & VFE32_IMASK_CAMIF_ERROR) {
+		pr_err("vfe32_irq: camif errors\n");
+		reg_value = msm_io_r(vfe32_ctrl->vfebase + VFE_CAMIF_STATUS);
+		pr_err("camifStatus  = 0x%x\n", reg_value);
+		vfe32_send_isp_msg(vfe32_ctrl, MSG_ID_CAMIF_ERROR);
+	}
+
+	if (errStatus & VFE32_IMASK_BHIST_OVWR)
+		pr_err("vfe32_irq: stats bhist overwrite\n");
+
+	if (errStatus & VFE32_IMASK_STATS_CS_OVWR)
+		pr_err("vfe32_irq: stats cs overwrite\n");
+
+	if (errStatus & VFE32_IMASK_STATS_IHIST_OVWR)
+		pr_err("vfe32_irq: stats ihist overwrite\n");
+
+	if (errStatus & VFE32_IMASK_REALIGN_BUF_Y_OVFL)
+		pr_err("vfe32_irq: realign bug Y overflow\n");
+
+	if (errStatus & VFE32_IMASK_REALIGN_BUF_CB_OVFL)
+		pr_err("vfe32_irq: realign bug CB overflow\n");
+
+	if (errStatus & VFE32_IMASK_REALIGN_BUF_CR_OVFL)
+		pr_err("vfe32_irq: realign bug CR overflow\n");
+
+	if (errStatus & VFE32_IMASK_VIOLATION) {
+		pr_err("vfe32_irq: violation interrupt\n");
+		reg_value =
+			msm_io_r(vfe32_ctrl->vfebase + VFE_VIOLATION_STATUS);
+		pr_err("%s: violationStatus  = 0x%x\n", __func__, reg_value);
+	}
+
+	if (errStatus & VFE32_IMASK_IMG_MAST_0_BUS_OVFL)
+		pr_err("vfe32_irq: image master 0 bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_IMG_MAST_1_BUS_OVFL)
+		pr_err("vfe32_irq: image master 1 bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_IMG_MAST_2_BUS_OVFL)
+		pr_err("vfe32_irq: image master 2 bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_IMG_MAST_3_BUS_OVFL)
+		pr_err("vfe32_irq: image master 3 bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_IMG_MAST_4_BUS_OVFL)
+		pr_err("vfe32_irq: image master 4 bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_IMG_MAST_5_BUS_OVFL)
+		pr_err("vfe32_irq: image master 5 bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_IMG_MAST_6_BUS_OVFL)
+		pr_err("vfe32_irq: image master 6 bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_STATS_AE_BG_BUS_OVFL)
+		pr_err("vfe32_irq: ae/bg stats bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_STATS_AF_BF_BUS_OVFL)
+		pr_err("vfe32_irq: af/bf stats bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_STATS_AWB_BUS_OVFL)
+		pr_err("vfe32_irq: awb stats bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_STATS_RS_BUS_OVFL)
+		pr_err("vfe32_irq: rs stats bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_STATS_CS_BUS_OVFL)
+		pr_err("vfe32_irq: cs stats bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_STATS_IHIST_BUS_OVFL)
+		pr_err("vfe32_irq: ihist stats bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_STATS_SKIN_BHIST_BUS_OVFL)
+		pr_err("vfe32_irq: skin/bhist stats bus overflow\n");
+
+	if (errStatus & VFE32_IMASK_AXI_ERROR)
+		pr_err("vfe32_irq: axi error\n");
+}
+
+static void vfe_send_outmsg(struct v4l2_subdev *sd, uint8_t msgid,
+	uint32_t ch0_paddr, uint32_t ch1_paddr, uint32_t ch2_paddr)
+{
+	struct isp_msg_output msg;
+
+	msg.output_id = msgid;
+	msg.buf.ch_paddr[0]	= ch0_paddr;
+	msg.buf.ch_paddr[1]	= ch1_paddr;
+	msg.buf.ch_paddr[2]	= ch2_paddr;
+	msg.frameCounter = vfe32_ctrl->vfeFrameId;
+
+	v4l2_subdev_notify(&vfe32_ctrl->subdev,
+			NOTIFY_VFE_MSG_OUT,
+			&msg);
+	return;
+}
+
+static void vfe32_process_output_path_irq_0(void)
+{
+	uint32_t ping_pong;
+	uint32_t ch0_paddr, ch1_paddr, ch2_paddr;
+	uint8_t out_bool = 0;
+	struct msm_free_buf *free_buf = NULL;
+
+	free_buf = vfe32_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
+		VFE_MSG_OUTPUT_PRIMARY);
+
+	out_bool = ((vfe32_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_MAIN ||
+		vfe32_ctrl->operation_mode == VFE_OUTPUTS_MAIN_AND_THUMB ||
+		vfe32_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_JPEG ||
+		vfe32_ctrl->operation_mode == VFE_OUTPUTS_JPEG_AND_THUMB ||
+		vfe32_ctrl->operation_mode == VFE_OUTPUTS_RAW ||
+		vfe32_ctrl->liveshot_state == VFE_STATE_STARTED ||
+		vfe32_ctrl->liveshot_state == VFE_STATE_STOP_REQUESTED ||
+		vfe32_ctrl->liveshot_state == VFE_STATE_STOPPED) &&
+		(vfe32_ctrl->vfe_capture_count <= 1)) || free_buf;
+
+	if (out_bool) {
+		ping_pong = msm_io_r(vfe32_ctrl->vfebase +
+			VFE_BUS_PING_PONG_STATUS);
+
+		
+		ch0_paddr = vfe32_get_ch_addr(ping_pong,
+			vfe32_ctrl->outpath.out0.ch0);
+		
+		ch1_paddr = vfe32_get_ch_addr(ping_pong,
+			vfe32_ctrl->outpath.out0.ch1);
+		
+		ch2_paddr = vfe32_get_ch_addr(ping_pong,
+			vfe32_ctrl->outpath.out0.ch2);
+
+		CDBG("output path 0, ch0 = 0x%x, ch1 = 0x%x, ch2 = 0x%x\n",
+			ch0_paddr, ch1_paddr, ch2_paddr);
+		if (free_buf) {
+			
+			vfe32_put_ch_addr(ping_pong,
+			vfe32_ctrl->outpath.out0.ch0,
+			free_buf->ch_paddr[0]);
+			
+			vfe32_put_ch_addr(ping_pong,
+			vfe32_ctrl->outpath.out0.ch1,
+			free_buf->ch_paddr[1]);
+			if (free_buf->num_planes > 2)
+				vfe32_put_ch_addr(ping_pong,
+					vfe32_ctrl->outpath.out0.ch2,
+					free_buf->ch_paddr[2]);
+		}
+		if (vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_THUMB_AND_MAIN ||
+			vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_MAIN_AND_THUMB ||
+			vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_THUMB_AND_JPEG ||
+			vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_JPEG_AND_THUMB ||
+			vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_RAW ||
+			vfe32_ctrl->liveshot_state == VFE_STATE_STOPPED)
+			vfe32_ctrl->outpath.out0.capture_cnt--;
+
+		vfe_send_outmsg(&vfe32_ctrl->subdev,
+			MSG_ID_OUTPUT_PRIMARY, ch0_paddr,
+			ch1_paddr, ch2_paddr);
+
+	} else {
+		vfe32_ctrl->outpath.out0.frame_drop_cnt++;
+		CDBG("path_irq_0 - no free buffer!\n");
+	}
+}
+
+static void vfe32_process_output_path_irq_1(void)
+{
+	uint32_t ping_pong;
+	uint32_t ch0_paddr, ch1_paddr, ch2_paddr;
+	
+	uint8_t out_bool = 0;
+	struct msm_free_buf *free_buf = NULL;
+
+	free_buf = vfe32_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
+		VFE_MSG_OUTPUT_SECONDARY);
+	out_bool = ((vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_THUMB_AND_MAIN ||
+			vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_MAIN_AND_THUMB ||
+			vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_RAW ||
+			vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_JPEG_AND_THUMB) &&
+			(vfe32_ctrl->vfe_capture_count <= 1)) || free_buf;
+
+	if (out_bool) {
+		ping_pong = msm_io_r(vfe32_ctrl->vfebase +
+			VFE_BUS_PING_PONG_STATUS);
+
+		
+		ch0_paddr = vfe32_get_ch_addr(ping_pong,
+			vfe32_ctrl->outpath.out1.ch0);
+		
+		ch1_paddr = vfe32_get_ch_addr(ping_pong,
+			vfe32_ctrl->outpath.out1.ch1);
+		ch2_paddr = vfe32_get_ch_addr(ping_pong,
+			vfe32_ctrl->outpath.out1.ch2);
+
+		pr_debug("%s ch0 = 0x%x, ch1 = 0x%x, ch2 = 0x%x\n",
+			__func__, ch0_paddr, ch1_paddr, ch2_paddr);
+		if (free_buf) {
+			
+			vfe32_put_ch_addr(ping_pong,
+			vfe32_ctrl->outpath.out1.ch0,
+			free_buf->ch_paddr[0]);
+			
+			vfe32_put_ch_addr(ping_pong,
+			vfe32_ctrl->outpath.out1.ch1,
+			free_buf->ch_paddr[1]);
+			if (free_buf->num_planes > 2)
+				vfe32_put_ch_addr(ping_pong,
+					vfe32_ctrl->outpath.out1.ch2,
+					free_buf->ch_paddr[2]);
+		}
+		if (vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_THUMB_AND_MAIN ||
+			vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_MAIN_AND_THUMB ||
+			vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_RAW ||
+			vfe32_ctrl->operation_mode ==
+				VFE_OUTPUTS_JPEG_AND_THUMB)
+			vfe32_ctrl->outpath.out1.capture_cnt--;
+
+		vfe_send_outmsg(&vfe32_ctrl->subdev,
+			MSG_ID_OUTPUT_SECONDARY, ch0_paddr,
+			ch1_paddr, ch2_paddr);
+	} else {
+		vfe32_ctrl->outpath.out1.frame_drop_cnt++;
+		CDBG("path_irq_1 - no free buffer!\n");
+	}
+}
+
+static uint32_t  vfe32_process_stats_irq_common(uint32_t statsNum,
+						uint32_t newAddr) {
+
+	uint32_t pingpongStatus;
+	uint32_t returnAddr;
+	uint32_t pingpongAddr;
+
+	
+	pingpongStatus =
+		((msm_io_r(vfe32_ctrl->vfebase +
+		VFE_BUS_PING_PONG_STATUS))
+	& ((uint32_t)(1<<(statsNum + 7)))) >> (statsNum + 7);
+	
+	CDBG("statsNum %d, pingpongStatus %d\n", statsNum, pingpongStatus);
+	pingpongAddr =
+		((uint32_t)(vfe32_ctrl->vfebase +
+				VFE_BUS_STATS_PING_PONG_BASE)) +
+				(3*statsNum)*4 + (1-pingpongStatus)*4;
+	returnAddr = msm_io_r((uint32_t *)pingpongAddr);
+	msm_io_w(newAddr, (uint32_t *)pingpongAddr);
+	return returnAddr;
+}
+
+static void
+vfe_send_stats_msg(uint32_t bufAddress, uint32_t statsNum)
+{
+	unsigned long flags;
+	
+	
+	
+	struct isp_msg_stats msgStats;
+	msgStats.frameCounter = vfe32_ctrl->vfeFrameId;
+	msgStats.buffer = bufAddress;
+
+	switch (statsNum) {
+	case statsAeNum:{
+		msgStats.id = MSG_ID_STATS_AEC;
+		spin_lock_irqsave(&vfe32_ctrl->aec_ack_lock, flags);
+		vfe32_ctrl->aecStatsControl.ackPending = TRUE;
+		spin_unlock_irqrestore(&vfe32_ctrl->aec_ack_lock, flags);
+		}
+		break;
+	case statsAfNum:{
+		msgStats.id = MSG_ID_STATS_AF;
+		spin_lock_irqsave(&vfe32_ctrl->af_ack_lock, flags);
+		vfe32_ctrl->afStatsControl.ackPending = TRUE;
+		spin_unlock_irqrestore(&vfe32_ctrl->af_ack_lock, flags);
+		}
+		break;
+	case statsAwbNum: {
+		msgStats.id = MSG_ID_STATS_AWB;
+		spin_lock_irqsave(&vfe32_ctrl->awb_ack_lock, flags);
+		vfe32_ctrl->awbStatsControl.ackPending = TRUE;
+		spin_unlock_irqrestore(&vfe32_ctrl->awb_ack_lock, flags);
+		}
+		break;
+
+	case statsIhistNum: {
+		msgStats.id = MSG_ID_STATS_IHIST;
+		spin_lock_irqsave(&vfe32_ctrl->ihist_ack_lock, flags);
+		vfe32_ctrl->ihistStatsControl.ackPending = TRUE;
+		spin_unlock_irqrestore(&vfe32_ctrl->ihist_ack_lock, flags);
+		}
+		break;
+	case statsRsNum: {
+		msgStats.id = MSG_ID_STATS_RS;
+		spin_lock_irqsave(&vfe32_ctrl->rs_ack_lock, flags);
+		vfe32_ctrl->rsStatsControl.ackPending = TRUE;
+		spin_unlock_irqrestore(&vfe32_ctrl->rs_ack_lock, flags);
+		}
+		break;
+	case statsCsNum: {
+		msgStats.id = MSG_ID_STATS_CS;
+		spin_lock_irqsave(&vfe32_ctrl->cs_ack_lock, flags);
+		vfe32_ctrl->csStatsControl.ackPending = TRUE;
+		spin_unlock_irqrestore(&vfe32_ctrl->cs_ack_lock, flags);
+		}
+		break;
+
+	default:
+		goto stats_done;
+	}
+
+	v4l2_subdev_notify(&vfe32_ctrl->subdev,
+				NOTIFY_VFE_MSG_STATS,
+				&msgStats);
+stats_done:
+	
+	return;
+}
+
+static void vfe_send_comp_stats_msg(uint32_t status_bits)
+{
+	struct msm_stats_buf msgStats;
+	uint32_t temp;
+
+	msgStats.frame_id = vfe32_ctrl->vfeFrameId;
+	msgStats.status_bits = status_bits;
+
+	msgStats.aec.buff = vfe32_ctrl->aecStatsControl.bufToRender;
+	msgStats.awb.buff = vfe32_ctrl->awbStatsControl.bufToRender;
+	msgStats.af.buff = vfe32_ctrl->afStatsControl.bufToRender;
+
+	msgStats.ihist.buff = vfe32_ctrl->ihistStatsControl.bufToRender;
+	msgStats.rs.buff = vfe32_ctrl->rsStatsControl.bufToRender;
+	msgStats.cs.buff = vfe32_ctrl->csStatsControl.bufToRender;
+
+	temp = msm_io_r(vfe32_ctrl->vfebase + VFE_STATS_AWB_SGW_CFG);
+	msgStats.awb_ymin = (0xFF00 & temp) >> 8;
+
+	v4l2_subdev_notify(&vfe32_ctrl->subdev,
+				NOTIFY_VFE_MSG_COMP_STATS,
+				&msgStats);
+}
+
+static void vfe32_process_stats_ae_irq(void)
+{
+	unsigned long flags;
+	spin_lock_irqsave(&vfe32_ctrl->aec_ack_lock, flags);
+	if (!(vfe32_ctrl->aecStatsControl.ackPending)) {
+		spin_unlock_irqrestore(&vfe32_ctrl->aec_ack_lock, flags);
+		vfe32_ctrl->aecStatsControl.bufToRender =
+			vfe32_process_stats_irq_common(statsAeNum,
+			vfe32_ctrl->aecStatsControl.nextFrameAddrBuf);
+
+		vfe_send_stats_msg(vfe32_ctrl->aecStatsControl.bufToRender,
+						statsAeNum);
+	} else{
+		spin_unlock_irqrestore(&vfe32_ctrl->aec_ack_lock, flags);
+		vfe32_ctrl->aecStatsControl.droppedStatsFrameCount++;
+		CDBG("%s: droppedStatsFrameCount = %d", __func__,
+			vfe32_ctrl->aecStatsControl.droppedStatsFrameCount);
+	}
+}
+
+static void vfe32_process_stats_awb_irq(void)
+{
+	unsigned long flags;
+	spin_lock_irqsave(&vfe32_ctrl->awb_ack_lock, flags);
+	if (!(vfe32_ctrl->awbStatsControl.ackPending)) {
+		spin_unlock_irqrestore(&vfe32_ctrl->awb_ack_lock, flags);
+		vfe32_ctrl->awbStatsControl.bufToRender =
+			vfe32_process_stats_irq_common(statsAwbNum,
+			vfe32_ctrl->awbStatsControl.nextFrameAddrBuf);
+
+		vfe_send_stats_msg(vfe32_ctrl->awbStatsControl.bufToRender,
+						statsAwbNum);
+	} else{
+		spin_unlock_irqrestore(&vfe32_ctrl->awb_ack_lock, flags);
+		vfe32_ctrl->awbStatsControl.droppedStatsFrameCount++;
+		CDBG("%s: droppedStatsFrameCount = %d", __func__,
+			vfe32_ctrl->awbStatsControl.droppedStatsFrameCount);
+	}
+}
+
+static void vfe32_process_stats_af_irq(void)
+{
+	unsigned long flags;
+	spin_lock_irqsave(&vfe32_ctrl->af_ack_lock, flags);
+	if (!(vfe32_ctrl->afStatsControl.ackPending)) {
+		spin_unlock_irqrestore(&vfe32_ctrl->af_ack_lock, flags);
+		vfe32_ctrl->afStatsControl.bufToRender =
+			vfe32_process_stats_irq_common(statsAfNum,
+			vfe32_ctrl->afStatsControl.nextFrameAddrBuf);
+
+		vfe_send_stats_msg(vfe32_ctrl->afStatsControl.bufToRender,
+						statsAfNum);
+	} else{
+		spin_unlock_irqrestore(&vfe32_ctrl->af_ack_lock, flags);
+		vfe32_ctrl->afStatsControl.droppedStatsFrameCount++;
+		CDBG("%s: droppedStatsFrameCount = %d", __func__,
+			vfe32_ctrl->afStatsControl.droppedStatsFrameCount);
+	}
+}
+
+static void vfe32_process_stats_ihist_irq(void)
+{
+	if (!(vfe32_ctrl->ihistStatsControl.ackPending)) {
+		vfe32_ctrl->ihistStatsControl.bufToRender =
+			vfe32_process_stats_irq_common(statsIhistNum,
+			vfe32_ctrl->ihistStatsControl.nextFrameAddrBuf);
+
+		vfe_send_stats_msg(vfe32_ctrl->ihistStatsControl.bufToRender,
+						statsIhistNum);
+	} else {
+		vfe32_ctrl->ihistStatsControl.droppedStatsFrameCount++;
+		CDBG("%s: droppedStatsFrameCount = %d", __func__,
+			vfe32_ctrl->ihistStatsControl.droppedStatsFrameCount);
+	}
+}
+
+static void vfe32_process_stats_rs_irq(void)
+{
+	if (!(vfe32_ctrl->rsStatsControl.ackPending)) {
+		vfe32_ctrl->rsStatsControl.bufToRender =
+			vfe32_process_stats_irq_common(statsRsNum,
+			vfe32_ctrl->rsStatsControl.nextFrameAddrBuf);
+
+		vfe_send_stats_msg(vfe32_ctrl->rsStatsControl.bufToRender,
+						statsRsNum);
+	} else {
+		vfe32_ctrl->rsStatsControl.droppedStatsFrameCount++;
+		CDBG("%s: droppedStatsFrameCount = %d", __func__,
+			vfe32_ctrl->rsStatsControl.droppedStatsFrameCount);
+	}
+}
+
+static void vfe32_process_stats_cs_irq(void)
+{
+	if (!(vfe32_ctrl->csStatsControl.ackPending)) {
+		vfe32_ctrl->csStatsControl.bufToRender =
+			vfe32_process_stats_irq_common(statsCsNum,
+			vfe32_ctrl->csStatsControl.nextFrameAddrBuf);
+
+		vfe_send_stats_msg(vfe32_ctrl->csStatsControl.bufToRender,
+						statsCsNum);
+	} else {
+		vfe32_ctrl->csStatsControl.droppedStatsFrameCount++;
+		CDBG("%s: droppedStatsFrameCount = %d", __func__,
+			vfe32_ctrl->csStatsControl.droppedStatsFrameCount);
+	}
+}
+
+static void vfe32_process_stats(uint32_t status_bits)
+{
+	unsigned long flags;
+	int32_t process_stats = false;
+	CDBG("%s, stats = 0x%x\n", __func__, status_bits);
+
+	spin_lock_irqsave(&vfe32_ctrl->comp_stats_ack_lock, flags);
+	if (status_bits & VFE_IRQ_STATUS0_STATS_AEC) {
+		if (!vfe32_ctrl->aecStatsControl.ackPending) {
+			vfe32_ctrl->aecStatsControl.ackPending = TRUE;
+			vfe32_ctrl->aecStatsControl.bufToRender =
+				vfe32_process_stats_irq_common(statsAeNum,
+				vfe32_ctrl->aecStatsControl.nextFrameAddrBuf);
+			process_stats = true;
+		} else{
+			vfe32_ctrl->aecStatsControl.bufToRender = 0;
+			vfe32_ctrl->aecStatsControl.droppedStatsFrameCount++;
+		}
+	} else {
+		vfe32_ctrl->aecStatsControl.bufToRender = 0;
+	}
+
+	if (status_bits & VFE_IRQ_STATUS0_STATS_AWB) {
+		if (!vfe32_ctrl->awbStatsControl.ackPending) {
+			vfe32_ctrl->awbStatsControl.ackPending = TRUE;
+			vfe32_ctrl->awbStatsControl.bufToRender =
+				vfe32_process_stats_irq_common(statsAwbNum,
+				vfe32_ctrl->awbStatsControl.nextFrameAddrBuf);
+			process_stats = true;
+		} else{
+			vfe32_ctrl->awbStatsControl.droppedStatsFrameCount++;
+			vfe32_ctrl->awbStatsControl.bufToRender = 0;
+		}
+	} else {
+		vfe32_ctrl->awbStatsControl.bufToRender = 0;
+	}
+
+
+	if (status_bits & VFE_IRQ_STATUS0_STATS_AF) {
+		if (!vfe32_ctrl->afStatsControl.ackPending) {
+			vfe32_ctrl->afStatsControl.ackPending = TRUE;
+			vfe32_ctrl->afStatsControl.bufToRender =
+				vfe32_process_stats_irq_common(statsAfNum,
+				vfe32_ctrl->afStatsControl.nextFrameAddrBuf);
+			process_stats = true;
+		} else {
+			vfe32_ctrl->afStatsControl.bufToRender = 0;
+			vfe32_ctrl->afStatsControl.droppedStatsFrameCount++;
+		}
+	} else {
+		vfe32_ctrl->afStatsControl.bufToRender = 0;
+	}
+
+	if (status_bits & VFE_IRQ_STATUS0_STATS_IHIST) {
+		if (!vfe32_ctrl->ihistStatsControl.ackPending) {
+			vfe32_ctrl->ihistStatsControl.ackPending = TRUE;
+			vfe32_ctrl->ihistStatsControl.bufToRender =
+				vfe32_process_stats_irq_common(statsIhistNum,
+				vfe32_ctrl->ihistStatsControl.nextFrameAddrBuf);
+			process_stats = true;
+		} else {
+			vfe32_ctrl->ihistStatsControl.droppedStatsFrameCount++;
+			vfe32_ctrl->ihistStatsControl.bufToRender = 0;
+		}
+	} else {
+		vfe32_ctrl->ihistStatsControl.bufToRender = 0;
+	}
+
+	if (status_bits & VFE_IRQ_STATUS0_STATS_RS) {
+		if (!vfe32_ctrl->rsStatsControl.ackPending) {
+			vfe32_ctrl->rsStatsControl.ackPending = TRUE;
+			vfe32_ctrl->rsStatsControl.bufToRender =
+				vfe32_process_stats_irq_common(statsRsNum,
+				vfe32_ctrl->rsStatsControl.nextFrameAddrBuf);
+			process_stats = true;
+		} else {
+			vfe32_ctrl->rsStatsControl.droppedStatsFrameCount++;
+			vfe32_ctrl->rsStatsControl.bufToRender = 0;
+		}
+	} else {
+		vfe32_ctrl->rsStatsControl.bufToRender = 0;
+	}
+
+
+	if (status_bits & VFE_IRQ_STATUS0_STATS_CS) {
+		if (!vfe32_ctrl->csStatsControl.ackPending) {
+			vfe32_ctrl->csStatsControl.ackPending = TRUE;
+			vfe32_ctrl->csStatsControl.bufToRender =
+				vfe32_process_stats_irq_common(statsCsNum,
+				vfe32_ctrl->csStatsControl.nextFrameAddrBuf);
+			process_stats = true;
+		} else {
+			vfe32_ctrl->csStatsControl.droppedStatsFrameCount++;
+			vfe32_ctrl->csStatsControl.bufToRender = 0;
+		}
+	} else {
+		vfe32_ctrl->csStatsControl.bufToRender = 0;
+	}
+
+	spin_unlock_irqrestore(&vfe32_ctrl->comp_stats_ack_lock, flags);
+	if (process_stats)
+		vfe_send_comp_stats_msg(status_bits);
+
+	return;
+}
+
+static void vfe32_process_stats_irq(uint32_t irqstatus)
+{
+	uint32_t status_bits = VFE_COM_STATUS & irqstatus;
+
+	if ((vfe32_ctrl->hfr_mode != HFR_MODE_OFF) &&
+		(vfe32_ctrl->vfeFrameId % vfe32_ctrl->hfr_mode != 0)) {
+		CDBG("Skip the stats when HFR enabled\n");
+		return;
+	}
+
+	vfe32_process_stats(status_bits);
+	return;
+}
+
+static void vfe32_process_irq(uint32_t irqstatus)
+{
+	if (irqstatus &
+		VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK) {
+		vfe32_process_stats_irq(irqstatus);
+		return;
+	}
+
+	switch (irqstatus) {
+	case VFE_IRQ_STATUS0_CAMIF_SOF_MASK:
+		CDBG("irq	camifSofIrq\n");
+		vfe32_process_camif_sof_irq();
+		break;
+	case VFE_IRQ_STATUS0_REG_UPDATE_MASK:
+		CDBG("irq	regUpdateIrq\n");
+		vfe32_process_reg_update_irq();
+		break;
+	case VFE_IMASK_WHILE_STOPPING_1:
+		CDBG("irq	resetAckIrq\n");
+		vfe32_process_reset_irq();
+		break;
+	case VFE_IRQ_STATUS0_STATS_AEC:
+		CDBG("Stats AEC irq occured.\n");
+		vfe32_process_stats_ae_irq();
+		break;
+	case VFE_IRQ_STATUS0_STATS_AWB:
+		CDBG("Stats AWB irq occured.\n");
+		vfe32_process_stats_awb_irq();
+		break;
+	case VFE_IRQ_STATUS0_STATS_AF:
+		CDBG("Stats AF irq occured.\n");
+		vfe32_process_stats_af_irq();
+		break;
+	case VFE_IRQ_STATUS0_STATS_IHIST:
+		CDBG("Stats IHIST irq occured.\n");
+		vfe32_process_stats_ihist_irq();
+		break;
+	case VFE_IRQ_STATUS0_STATS_RS:
+		CDBG("Stats RS irq occured.\n");
+		vfe32_process_stats_rs_irq();
+		break;
+	case VFE_IRQ_STATUS0_STATS_CS:
+		CDBG("Stats CS irq occured.\n");
+		vfe32_process_stats_cs_irq();
+		break;
+	case VFE_IRQ_STATUS0_SYNC_TIMER0:
+		CDBG("SYNC_TIMER 0 irq occured.\n");
+		vfe32_send_isp_msg(vfe32_ctrl,
+			MSG_ID_SYNC_TIMER0_DONE);
+		break;
+	case VFE_IRQ_STATUS0_SYNC_TIMER1:
+		CDBG("SYNC_TIMER 1 irq occured.\n");
+		vfe32_send_isp_msg(vfe32_ctrl,
+			MSG_ID_SYNC_TIMER1_DONE);
+		break;
+	case VFE_IRQ_STATUS0_SYNC_TIMER2:
+		CDBG("SYNC_TIMER 2 irq occured.\n");
+		vfe32_send_isp_msg(vfe32_ctrl,
+			MSG_ID_SYNC_TIMER2_DONE);
+		break;
+	default:
+		pr_err("Invalid IRQ status\n");
+	}
+}
+
+static void axi32_do_tasklet(unsigned long data)
+{
+	unsigned long flags;
+	struct axi_ctrl_t *axi_ctrl = (struct axi_ctrl_t *)data;
+	struct vfe32_isr_queue_cmd *qcmd = NULL;
+
+	CDBG("=== axi32_do_tasklet start ===\n");
+
+	while (atomic_read(&irq_cnt)) {
+		spin_lock_irqsave(&axi_ctrl->tasklet_lock, flags);
+		qcmd = list_first_entry(&axi_ctrl->tasklet_q,
+			struct vfe32_isr_queue_cmd, list);
+		atomic_sub(1, &irq_cnt);
+
+		if (!qcmd) {
+			spin_unlock_irqrestore(&axi_ctrl->tasklet_lock,
+				flags);
+			return;
+		}
+
+		list_del_init(&qcmd->list);
+		
+		spin_unlock_irqrestore(&axi_ctrl->tasklet_lock,
+			flags);
+
+		if (qcmd->vfeInterruptStatus0 &
+				VFE_IRQ_STATUS0_CAMIF_SOF_MASK)
+			v4l2_subdev_notify(&axi_ctrl->subdev,
+				NOTIFY_VFE_IRQ,
+				(void *)VFE_IRQ_STATUS0_CAMIF_SOF_MASK);
+
+		
+		if (qcmd->vfeInterruptStatus0 &
+				VFE_IRQ_STATUS0_REG_UPDATE_MASK)
+			v4l2_subdev_notify(&axi_ctrl->subdev,
+				NOTIFY_VFE_IRQ,
+				(void *)VFE_IRQ_STATUS0_REG_UPDATE_MASK);
+
+		if (qcmd->vfeInterruptStatus1 &
+				VFE_IMASK_WHILE_STOPPING_1)
+			v4l2_subdev_notify(&axi_ctrl->subdev,
+				NOTIFY_VFE_IRQ,
+				(void *)VFE_IMASK_WHILE_STOPPING_1);
+
+		if (atomic_read(&vfe32_ctrl->vstate)) {
+			if (qcmd->vfeInterruptStatus1 &
+					VFE32_IMASK_ERROR_ONLY_1) {
+				pr_err("irq	errorIrq\n");
+				vfe32_process_error_irq(
+					qcmd->vfeInterruptStatus1 &
+					VFE32_IMASK_ERROR_ONLY_1);
+			}
+			v4l2_subdev_notify(&axi_ctrl->subdev,
+				NOTIFY_AXI_IRQ,
+				(void *)qcmd->vfeInterruptStatus0);
+
+
+			
+			if (vfe32_ctrl->stats_comp) {
+				
+				if (qcmd->vfeInterruptStatus0 &
+					VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK) {
+					CDBG("Stats composite irq occured.\n");
+					v4l2_subdev_notify(&axi_ctrl->subdev,
+					NOTIFY_VFE_IRQ,
+					(void *)qcmd->vfeInterruptStatus0);
+				}
+			} else {
+				
+				if (qcmd->vfeInterruptStatus0 &
+						VFE_IRQ_STATUS0_STATS_AEC)
+					v4l2_subdev_notify(&axi_ctrl->subdev,
+					NOTIFY_VFE_IRQ,
+					(void *)VFE_IRQ_STATUS0_STATS_AEC);
+
+				if (qcmd->vfeInterruptStatus0 &
+						VFE_IRQ_STATUS0_STATS_AWB)
+					v4l2_subdev_notify(&axi_ctrl->subdev,
+					NOTIFY_VFE_IRQ,
+					(void *)VFE_IRQ_STATUS0_STATS_AWB);
+
+				if (qcmd->vfeInterruptStatus0 &
+						VFE_IRQ_STATUS0_STATS_AF)
+					v4l2_subdev_notify(&axi_ctrl->subdev,
+					NOTIFY_VFE_IRQ,
+					(void *)VFE_IRQ_STATUS0_STATS_AF);
+				if (qcmd->vfeInterruptStatus0 &
+						VFE_IRQ_STATUS0_STATS_IHIST)
+					v4l2_subdev_notify(&axi_ctrl->subdev,
+					NOTIFY_VFE_IRQ,
+					(void *)VFE_IRQ_STATUS0_STATS_IHIST);
+				if (qcmd->vfeInterruptStatus0 &
+						VFE_IRQ_STATUS0_STATS_RS)
+					v4l2_subdev_notify(&axi_ctrl->subdev,
+					NOTIFY_VFE_IRQ,
+					(void *)VFE_IRQ_STATUS0_STATS_RS);
+
+				if (qcmd->vfeInterruptStatus0 &
+						VFE_IRQ_STATUS0_STATS_CS)
+					v4l2_subdev_notify(&axi_ctrl->subdev,
+					NOTIFY_VFE_IRQ,
+					(void *)VFE_IRQ_STATUS0_STATS_CS);
+
+				if (qcmd->vfeInterruptStatus0 &
+						VFE_IRQ_STATUS0_SYNC_TIMER0)
+					v4l2_subdev_notify(&axi_ctrl->subdev,
+					NOTIFY_VFE_IRQ,
+					(void *)VFE_IRQ_STATUS0_SYNC_TIMER0);
+
+				if (qcmd->vfeInterruptStatus0 &
+						VFE_IRQ_STATUS0_SYNC_TIMER1)
+					v4l2_subdev_notify(&axi_ctrl->subdev,
+					NOTIFY_VFE_IRQ,
+					(void *)VFE_IRQ_STATUS0_SYNC_TIMER1);
+				if (qcmd->vfeInterruptStatus0 &
+						VFE_IRQ_STATUS0_SYNC_TIMER2)
+					v4l2_subdev_notify(&axi_ctrl->subdev,
+					NOTIFY_VFE_IRQ,
+					(void *)VFE_IRQ_STATUS0_SYNC_TIMER2);
+
+			}
+		}
+		kfree(qcmd);
+	}
+	CDBG("=== axi32_do_tasklet end ===\n");
+}
+
+
+static irqreturn_t vfe32_parse_irq(int irq_num, void *data)
+{
+	unsigned long flags;
+	struct vfe32_irq_status irq;
+	struct vfe32_isr_queue_cmd *qcmd;
+	struct axi_ctrl_t *axi_ctrl = data;
+	CDBG("vfe_parse_irq\n");
+
+	vfe32_read_irq_status(&irq);
+
+	if ((irq.vfeIrqStatus0 == 0) && (irq.vfeIrqStatus1 == 0)) {
+		CDBG("vfe_parse_irq: vfeIrqStatus0 & 1 are both 0!\n");
+		return IRQ_HANDLED;
+	}
+
+	qcmd = kzalloc(sizeof(struct vfe32_isr_queue_cmd),
+		GFP_ATOMIC);
+	if (!qcmd) {
+		pr_err("vfe_parse_irq: qcmd malloc failed!\n");
+		return IRQ_HANDLED;
+	}
+
+	spin_lock_irqsave(&vfe32_ctrl->stop_flag_lock, flags);
+	if (vfe32_ctrl->stop_ack_pending) {
+		irq.vfeIrqStatus0 &= VFE_IMASK_WHILE_STOPPING_0;
+		irq.vfeIrqStatus1 &= VFE_IMASK_WHILE_STOPPING_1;
+	}
+	spin_unlock_irqrestore(&vfe32_ctrl->stop_flag_lock, flags);
+
+	CDBG("vfe_parse_irq: Irq_status0 = 0x%x, Irq_status1 = 0x%x.\n",
+		irq.vfeIrqStatus0, irq.vfeIrqStatus1);
+
+	qcmd->vfeInterruptStatus0 = irq.vfeIrqStatus0;
+	qcmd->vfeInterruptStatus1 = irq.vfeIrqStatus1;
+
+	spin_lock_irqsave(&axi_ctrl->tasklet_lock, flags);
+	list_add_tail(&qcmd->list, &axi_ctrl->tasklet_q);
+
+
+	atomic_add(1, &irq_cnt);
+	spin_unlock_irqrestore(&axi_ctrl->tasklet_lock, flags);
+	tasklet_schedule(&axi_ctrl->vfe32_tasklet);
+	return IRQ_HANDLED;
+}
+
+static long msm_vfe_subdev_ioctl(struct v4l2_subdev *sd,
+			unsigned int subdev_cmd, void *arg)
+{
+	struct msm_cam_media_controller *pmctl =
+		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
+	struct msm_isp_cmd vfecmd;
+	struct msm_camvfe_params *vfe_params =
+		(struct msm_camvfe_params *)arg;
+	struct msm_vfe_cfg_cmd *cmd = vfe_params->vfe_cfg;
+	void *data = vfe_params->data;
+
+	long rc = 0;
+	uint32_t i = 0;
+	struct vfe_cmd_stats_buf *scfg = NULL;
+	struct msm_pmem_region   *regptr = NULL;
+	struct vfe_cmd_stats_ack *sack = NULL;
+	if (cmd->cmd_type == CMD_VFE_PROCESS_IRQ) {
+		vfe32_process_irq((uint32_t) data);
+		return rc;
+	} else if (cmd->cmd_type != CMD_CONFIG_PING_ADDR &&
+		cmd->cmd_type != CMD_CONFIG_PONG_ADDR &&
+		cmd->cmd_type != CMD_CONFIG_FREE_BUF_ADDR &&
+		cmd->cmd_type != CMD_STATS_AEC_BUF_RELEASE &&
+		cmd->cmd_type != CMD_STATS_AWB_BUF_RELEASE &&
+		cmd->cmd_type != CMD_STATS_IHIST_BUF_RELEASE &&
+		cmd->cmd_type != CMD_STATS_RS_BUF_RELEASE &&
+		cmd->cmd_type != CMD_STATS_CS_BUF_RELEASE &&
+		cmd->cmd_type != CMD_STATS_AF_BUF_RELEASE) {
+		if (copy_from_user(&vfecmd,
+				(void __user *)(cmd->value),
+				sizeof(vfecmd))) {
+			pr_err("%s %d: copy_from_user failed\n", __func__,
+				__LINE__);
+			return -EFAULT;
+		}
+	} else {
+	
+		if (cmd->cmd_type != CMD_CONFIG_PING_ADDR &&
+			cmd->cmd_type != CMD_CONFIG_PONG_ADDR &&
+			cmd->cmd_type != CMD_CONFIG_FREE_BUF_ADDR) {
+			
+			if (!data)
+				return -EFAULT;
+			sack = kmalloc(sizeof(struct vfe_cmd_stats_ack),
+							GFP_ATOMIC);
+			if (!sack)
+				return -ENOMEM;
+
+			sack->nextStatsBuf = *(uint32_t *)data;
+		}
+	}
+
+	CDBG("%s: cmdType = %d\n", __func__, cmd->cmd_type);
+
+	if ((cmd->cmd_type == CMD_STATS_AF_ENABLE)    ||
+		(cmd->cmd_type == CMD_STATS_AWB_ENABLE)   ||
+		(cmd->cmd_type == CMD_STATS_IHIST_ENABLE) ||
+		(cmd->cmd_type == CMD_STATS_RS_ENABLE)    ||
+		(cmd->cmd_type == CMD_STATS_CS_ENABLE)    ||
+		(cmd->cmd_type == CMD_STATS_AEC_ENABLE)) {
+		struct axidata *axid;
+		axid = data;
+		if (!axid) {
+			rc = -EFAULT;
+			goto vfe32_config_done;
+		}
+
+		scfg =
+			kmalloc(sizeof(struct vfe_cmd_stats_buf),
+				GFP_ATOMIC);
+		if (!scfg) {
+			rc = -ENOMEM;
+			goto vfe32_config_done;
+		}
+		regptr = axid->region;
+		if (axid->bufnum1 > 0) {
+			for (i = 0; i < axid->bufnum1; i++) {
+				scfg->statsBuf[i] =
+					(uint32_t)(regptr->paddr);
+				regptr++;
+			}
+		}
+		
+		switch (cmd->cmd_type) {
+		case CMD_STATS_AEC_ENABLE:
+			rc = vfe_stats_aec_buf_init(scfg);
+			break;
+		case CMD_STATS_AF_ENABLE:
+			rc = vfe_stats_af_buf_init(scfg);
+			break;
+		case CMD_STATS_AWB_ENABLE:
+			rc = vfe_stats_awb_buf_init(scfg);
+			break;
+		case CMD_STATS_IHIST_ENABLE:
+			rc = vfe_stats_ihist_buf_init(scfg);
+			break;
+		case CMD_STATS_RS_ENABLE:
+			rc = vfe_stats_rs_buf_init(scfg);
+			break;
+		case CMD_STATS_CS_ENABLE:
+			rc = vfe_stats_cs_buf_init(scfg);
+			break;
+		default:
+			pr_err("%s Unsupported cmd type %d",
+				__func__, cmd->cmd_type);
+			break;
+		}
+		goto vfe32_config_done;
+	}
+	switch (cmd->cmd_type) {
+	case CMD_GENERAL:
+		rc = vfe32_proc_general(pmctl, &vfecmd);
+		break;
+
+	case CMD_CONFIG_PING_ADDR: {
+		int path = *((int *)cmd->value);
+		struct vfe32_output_ch *outch = vfe32_get_ch(path);
+		
+		if(!outch)
+			return 0;
+		
+		outch->ping = *((struct msm_free_buf *)data);
+	}
+		break;
+
+	case CMD_CONFIG_PONG_ADDR: {
+		int path = *((int *)cmd->value);
+		struct vfe32_output_ch *outch = vfe32_get_ch(path);
+		outch->pong = *((struct msm_free_buf *)data);
+	}
+		break;
+
+	case CMD_CONFIG_FREE_BUF_ADDR: {
+		int path = *((int *)cmd->value);
+		struct vfe32_output_ch *outch = vfe32_get_ch(path);
+		outch->free_buf = *((struct msm_free_buf *)data);
+	}
+		break;
+
+	case CMD_SNAP_BUF_RELEASE:
+		break;
+	case CMD_STATS_AEC_BUF_RELEASE:
+		vfe32_stats_aec_ack(sack);
+		break;
+	case CMD_STATS_AF_BUF_RELEASE:
+		vfe32_stats_af_ack(sack);
+		break;
+	case CMD_STATS_AWB_BUF_RELEASE:
+		vfe32_stats_awb_ack(sack);
+		break;
+
+	case CMD_STATS_IHIST_BUF_RELEASE:
+		vfe32_stats_ihist_ack(sack);
+		break;
+	case CMD_STATS_RS_BUF_RELEASE:
+		vfe32_stats_rs_ack(sack);
+		break;
+	case CMD_STATS_CS_BUF_RELEASE:
+		vfe32_stats_cs_ack(sack);
+		break;
+	default:
+		pr_err("%s Unsupported AXI configuration %x ", __func__,
+			cmd->cmd_type);
+		break;
+	}
+vfe32_config_done:
+	kfree(scfg);
+	kfree(sack);
+	CDBG("%s done: rc = %d\n", __func__, (int) rc);
+	return rc;
+}
+
+static struct msm_cam_clk_info vfe32_clk_info[] = {
+	{"vfe_clk", 228570000},
+	{"vfe_pclk", -1},
+	{"csi_vfe_clk", -1},
+};
+
+static int msm_axi_subdev_s_crystal_freq(struct v4l2_subdev *sd,
+						u32 freq, u32 flags)
+{
+	int rc = 0;
+	int round_rate;
+	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
+
+	round_rate = clk_round_rate(axi_ctrl->vfe_clk[0], freq);
+	if (rc < 0) {
+		pr_err("%s: clk_round_rate failed %d\n",
+					__func__, rc);
+		return rc;
+	}
+
+	vfe_clk_rate = round_rate;
+	rc = clk_set_rate(axi_ctrl->vfe_clk[0], round_rate);
+	if (rc < 0)
+		pr_err("%s: clk_set_rate failed %d\n",
+					__func__, rc);
+
+	return rc;
+}
+
+static const struct v4l2_subdev_core_ops msm_vfe_subdev_core_ops = {
+	.ioctl = msm_vfe_subdev_ioctl,
+};
+
+static const struct v4l2_subdev_ops msm_vfe_subdev_ops = {
+	.core = &msm_vfe_subdev_core_ops,
+};
+
+int msm_axi_subdev_init(struct v4l2_subdev *sd,
+			struct msm_cam_media_controller *mctl)
+{
+	int rc = 0;
+	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
+	v4l2_set_subdev_hostdata(sd, mctl);
+	spin_lock_init(&axi_ctrl->tasklet_lock);
+	INIT_LIST_HEAD(&axi_ctrl->tasklet_q);
+
+	axi_ctrl->vfebase = ioremap(axi_ctrl->vfemem->start,
+		resource_size(axi_ctrl->vfemem));
+	if (!axi_ctrl->vfebase) {
+		rc = -ENOMEM;
+		pr_err("%s: vfe ioremap failed\n", __func__);
+		goto remap_failed;
+	}
+
+	vfe32_ctrl->vfebase = axi_ctrl->vfebase;
+
+	if (axi_ctrl->fs_vfe == NULL) {
+		axi_ctrl->fs_vfe =
+			regulator_get(&axi_ctrl->pdev->dev, "fs_vfe");
+		if (IS_ERR(axi_ctrl->fs_vfe)) {
+			pr_err("%s: Regulator FS_VFE get failed %ld\n",
+				__func__, PTR_ERR(axi_ctrl->fs_vfe));
+			axi_ctrl->fs_vfe = NULL;
+			goto fs_failed;
+		} else if (regulator_enable(axi_ctrl->fs_vfe)) {
+			pr_err("%s: Regulator FS_VFE enable failed\n",
+							__func__);
+			regulator_put(axi_ctrl->fs_vfe);
+			axi_ctrl->fs_vfe = NULL;
+			goto fs_failed;
+		}
+	}
+
+	rc = msm_cam_clk_enable(&axi_ctrl->pdev->dev, vfe32_clk_info,
+			axi_ctrl->vfe_clk, ARRAY_SIZE(vfe32_clk_info), 1);
+	if (rc < 0)
+		goto clk_enable_failed;
+
+	msm_camio_bus_scale_cfg(
+		mctl->sdata->pdata->cam_bus_scale_table, S_INIT);
+	msm_camio_bus_scale_cfg(
+		mctl->sdata->pdata->cam_bus_scale_table, S_PREVIEW);
+
+	if (msm_io_r(vfe32_ctrl->vfebase + V32_GET_HW_VERSION_OFF) ==
+		VFE32_HW_NUMBER)
+		vfe32_ctrl->register_total = VFE32_REGISTER_TOTAL;
+	else
+		vfe32_ctrl->register_total = VFE33_REGISTER_TOTAL;
+
+	enable_irq(axi_ctrl->vfeirq->start);
+
+	return rc;
+clk_enable_failed:
+	regulator_disable(axi_ctrl->fs_vfe);
+	regulator_put(axi_ctrl->fs_vfe);
+	axi_ctrl->fs_vfe = NULL;
+fs_failed:
+	iounmap(axi_ctrl->vfebase);
+	axi_ctrl->vfebase = NULL;
+remap_failed:
+	disable_irq(axi_ctrl->vfeirq->start);
+	return rc;
+}
+
+int msm_vfe_subdev_init(struct v4l2_subdev *sd,
+			struct msm_cam_media_controller *mctl)
+{
+	int rc = 0;
+	v4l2_set_subdev_hostdata(sd, mctl);
+
+	spin_lock_init(&vfe32_ctrl->stop_flag_lock);
+	spin_lock_init(&vfe32_ctrl->state_lock);
+	spin_lock_init(&vfe32_ctrl->io_lock);
+	spin_lock_init(&vfe32_ctrl->update_ack_lock);
+
+	spin_lock_init(&vfe32_ctrl->aec_ack_lock);
+	spin_lock_init(&vfe32_ctrl->awb_ack_lock);
+	spin_lock_init(&vfe32_ctrl->af_ack_lock);
+	spin_lock_init(&vfe32_ctrl->ihist_ack_lock);
+	spin_lock_init(&vfe32_ctrl->rs_ack_lock);
+	spin_lock_init(&vfe32_ctrl->cs_ack_lock);
+	spin_lock_init(&vfe32_ctrl->comp_stats_ack_lock);
+	spin_lock_init(&vfe32_ctrl->sd_notify_lock);
+
+	vfe32_ctrl->update_linear = false;
+	vfe32_ctrl->update_rolloff = false;
+	vfe32_ctrl->update_la = false;
+	vfe32_ctrl->update_gamma = false;
+	vfe32_ctrl->hfr_mode = HFR_MODE_OFF;
+
+	return rc;
+}
+
+void msm_axi_subdev_release(struct v4l2_subdev *sd)
+{
+	struct msm_cam_media_controller *pmctl =
+		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
+	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
+	CDBG("%s, free_irq\n", __func__);
+	disable_irq(axi_ctrl->vfeirq->start);
+	tasklet_kill(&axi_ctrl->vfe32_tasklet);
+	msm_cam_clk_enable(&axi_ctrl->pdev->dev, vfe32_clk_info,
+			axi_ctrl->vfe_clk, ARRAY_SIZE(vfe32_clk_info), 0);
+	if (axi_ctrl->fs_vfe) {
+		regulator_disable(axi_ctrl->fs_vfe);
+		regulator_put(axi_ctrl->fs_vfe);
+		axi_ctrl->fs_vfe = NULL;
+	}
+	iounmap(axi_ctrl->vfebase);
+	axi_ctrl->vfebase = NULL;
+
+	if (atomic_read(&irq_cnt))
+		pr_warning("%s, Warning IRQ Count not ZERO\n", __func__);
+
+	msm_camio_bus_scale_cfg(
+		pmctl->sdata->pdata->cam_bus_scale_table, S_EXIT);
+}
+
+void msm_vfe_subdev_release(struct v4l2_subdev *sd)
+{
+	vfe32_ctrl->vfebase = 0;
+}
+
+static int msm_axi_config(struct v4l2_subdev *sd, void __user *arg)
+{
+	struct msm_vfe_cfg_cmd cfgcmd;
+	struct msm_isp_cmd vfecmd;
+	int rc = 0;
+
+	if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
+		ERR_COPY_FROM_USER();
+		return -EFAULT;
+	}
+
+	if (copy_from_user(&vfecmd,
+			(void __user *)(cfgcmd.value),
+			sizeof(vfecmd))) {
+		pr_err("%s %d: copy_from_user failed\n", __func__,
+			__LINE__);
+		return -EFAULT;
+	}
+
+	switch (cfgcmd.cmd_type) {
+
+	case CMD_AXI_CFG_PRIM: {
+		uint32_t *axio = NULL;
+		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
+				GFP_ATOMIC);
+		if (!axio) {
+			rc = -ENOMEM;
+			break;
+		}
+
+		if (copy_from_user(axio, (void __user *)(vfecmd.value),
+				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
+			kfree(axio);
+			rc = -EFAULT;
+			break;
+		}
+		vfe32_config_axi(OUTPUT_PRIM, axio);
+		kfree(axio);
+	}
+		break;
+	case CMD_AXI_CFG_PRIM_ALL_CHNLS: {
+		uint32_t *axio = NULL;
+		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
+				GFP_ATOMIC);
+		if (!axio) {
+			rc = -ENOMEM;
+			break;
+		}
+
+		if (copy_from_user(axio, (void __user *)(vfecmd.value),
+				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
+			kfree(axio);
+			rc = -EFAULT;
+			break;
+		}
+		vfe32_config_axi(OUTPUT_PRIM_ALL_CHNLS, axio);
+		kfree(axio);
+	}
+		break;
+	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC: {
+		uint32_t *axio = NULL;
+		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
+				GFP_ATOMIC);
+		if (!axio) {
+			rc = -ENOMEM;
+			break;
+		}
+
+		if (copy_from_user(axio, (void __user *)(vfecmd.value),
+				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
+			kfree(axio);
+			rc = -EFAULT;
+			break;
+		}
+		vfe32_config_axi(OUTPUT_PRIM|OUTPUT_SEC, axio);
+		kfree(axio);
+	}
+		break;
+	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC_ALL_CHNLS: {
+		uint32_t *axio = NULL;
+		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
+				GFP_ATOMIC);
+		if (!axio) {
+			rc = -ENOMEM;
+			break;
+		}
+
+		if (copy_from_user(axio, (void __user *)(vfecmd.value),
+				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
+			kfree(axio);
+			rc = -EFAULT;
+			break;
+		}
+		vfe32_config_axi(OUTPUT_PRIM|OUTPUT_SEC_ALL_CHNLS, axio);
+		kfree(axio);
+	}
+		break;
+	case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC: {
+		uint32_t *axio = NULL;
+		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
+				GFP_ATOMIC);
+		if (!axio) {
+			rc = -ENOMEM;
+			break;
+		}
+
+		if (copy_from_user(axio, (void __user *)(vfecmd.value),
+				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
+			kfree(axio);
+			rc = -EFAULT;
+			break;
+		}
+		vfe32_config_axi(OUTPUT_PRIM_ALL_CHNLS|OUTPUT_SEC, axio);
+		kfree(axio);
+	}
+		break;
+	case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC_ALL_CHNLS:
+		pr_err("%s Invalid/Unsupported AXI configuration %x",
+			__func__, cfgcmd.cmd_type);
+		break;
+	default:
+		pr_err("%s Unsupported AXI configuration %x ", __func__,
+			cfgcmd.cmd_type);
+		break;
+	}
+	CDBG("%s done: rc = %d\n", __func__, (int) rc);
+	return rc;
+}
+
+static void msm_axi_process_irq(struct v4l2_subdev *sd, void *arg)
+{
+	uint32_t irqstatus = (uint32_t) arg;
+	
+	if (irqstatus &
+		VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK) {
+		CDBG("Image composite done 0 irq occured.\n");
+		vfe32_process_output_path_irq_0();
+	}
+	if (irqstatus &
+		VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK) {
+		CDBG("Image composite done 1 irq occured.\n");
+		vfe32_process_output_path_irq_1();
+
+	}
+
+	if (vfe32_ctrl->operation_mode ==
+			VFE_OUTPUTS_THUMB_AND_MAIN ||
+		vfe32_ctrl->operation_mode ==
+			VFE_OUTPUTS_MAIN_AND_THUMB ||
+		vfe32_ctrl->operation_mode ==
+			VFE_OUTPUTS_THUMB_AND_JPEG ||
+		vfe32_ctrl->operation_mode ==
+			VFE_OUTPUTS_JPEG_AND_THUMB ||
+		vfe32_ctrl->operation_mode ==
+			VFE_OUTPUTS_RAW) {
+		if ((vfe32_ctrl->outpath.out0.capture_cnt == 0)
+				&& (vfe32_ctrl->outpath.out1.
+				capture_cnt == 0)) {
+			msm_io_w_mb(
+				CAMIF_COMMAND_STOP_IMMEDIATELY,
+				vfe32_ctrl->vfebase +
+				VFE_CAMIF_COMMAND);
+			vfe32_send_isp_msg(vfe32_ctrl,
+				MSG_ID_SNAPSHOT_DONE);
+		}
+	}
+}
+static const struct v4l2_subdev_internal_ops msm_vfe_internal_ops;
+
+static long msm_axi_subdev_ioctl(struct v4l2_subdev *sd,
+			unsigned int cmd, void *arg)
+{
+	int rc = -ENOIOCTLCMD;
+	switch (cmd) {
+	case VIDIOC_MSM_AXI_INIT:
+		rc = msm_axi_subdev_init(sd,
+			(struct msm_cam_media_controller *)arg);
+		break;
+	case VIDIOC_MSM_AXI_CFG:
+		rc = msm_axi_config(sd, arg);
+		break;
+	case VIDIOC_MSM_AXI_IRQ:
+		msm_axi_process_irq(sd, arg);
+		rc = 0;
+		break;
+	case VIDIOC_MSM_AXI_RELEASE:
+		msm_axi_subdev_release(sd);
+		rc = 0;
+		break;
+	default:
+		pr_err("%s: command not found\n", __func__);
+	}
+
+	return rc;
+}
+
+static const struct v4l2_subdev_core_ops msm_axi_subdev_core_ops = {
+	.ioctl = msm_axi_subdev_ioctl,
+};
+
+
+static const struct v4l2_subdev_video_ops msm_axi_subdev_video_ops = {
+	.s_crystal_freq = msm_axi_subdev_s_crystal_freq,
+};
+
+static const struct v4l2_subdev_ops msm_axi_subdev_ops = {
+	 .core = &msm_axi_subdev_core_ops,
+	 .video = &msm_axi_subdev_video_ops,
+};
+  
+
+
+static const struct v4l2_subdev_internal_ops msm_axi_internal_ops;
+static int __devinit vfe32_probe(struct platform_device *pdev)
+{
+	int rc = 0;
+	struct axi_ctrl_t *axi_ctrl;
+	CDBG("%s: device id = %d\n", __func__, pdev->id);
+	vfe32_ctrl = kzalloc(sizeof(struct vfe32_ctrl_type), GFP_KERNEL);
+	if (!vfe32_ctrl) {
+		pr_err("%s: no enough memory\n", __func__);
+		return -ENOMEM;
+	}
+	axi_ctrl = kzalloc(sizeof(struct axi_ctrl_t), GFP_KERNEL);
+	v4l2_subdev_init(&axi_ctrl->subdev, &msm_axi_subdev_ops);
+	axi_ctrl->subdev.internal_ops = &msm_axi_internal_ops;
+	axi_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	snprintf(axi_ctrl->subdev.name,
+			 sizeof(axi_ctrl->subdev.name), "axi");
+	v4l2_set_subdevdata(&axi_ctrl->subdev, axi_ctrl);
+	axi_ctrl->pdev = pdev;
+	msm_cam_register_subdev_node(&axi_ctrl->subdev, AXI_DEV, 0);
+
+
+	v4l2_subdev_init(&vfe32_ctrl->subdev, &msm_vfe_subdev_ops);	
+	vfe32_ctrl->subdev.internal_ops = &msm_vfe_internal_ops;
+	vfe32_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	snprintf(vfe32_ctrl->subdev.name,
+			 sizeof(vfe32_ctrl->subdev.name), "vfe3.2");
+	v4l2_set_subdevdata(&vfe32_ctrl->subdev, vfe32_ctrl);
+	platform_set_drvdata(pdev, &vfe32_ctrl->subdev);
+
+	axi_ctrl->vfemem = platform_get_resource_byname(pdev,
+					IORESOURCE_MEM, "vfe32");
+	if (!axi_ctrl->vfemem) {
+		pr_err("%s: no mem resource?\n", __func__);
+		rc = -ENODEV;
+		goto vfe32_no_resource;
+	}
+	axi_ctrl->vfeirq = platform_get_resource_byname(pdev,
+					IORESOURCE_IRQ, "vfe32");
+	if (!axi_ctrl->vfeirq) {
+		pr_err("%s: no irq resource?\n", __func__);
+		rc = -ENODEV;
+		goto vfe32_no_resource;
+	}
+
+	axi_ctrl->vfeio = request_mem_region(axi_ctrl->vfemem->start,
+		resource_size(axi_ctrl->vfemem), pdev->name);
+	if (!axi_ctrl->vfeio) {
+		pr_err("%s: no valid mem region\n", __func__);
+		rc = -EBUSY;
+		goto vfe32_no_resource;
+	}
+
+	rc = request_irq(axi_ctrl->vfeirq->start, vfe32_parse_irq,
+		IRQF_TRIGGER_RISING, "vfe", axi_ctrl);
+	if (rc < 0) {
+	rc = request_irq(axi_ctrl->vfeirq->start, vfe32_parse_irq,
+		IRQF_TRIGGER_RISING, "vfe", axi_ctrl);
+		pr_err("%s: irq request fail\n", __func__);
+		rc = -EBUSY;
+		goto vfe32_no_resource;
+	}
+
+	disable_irq(axi_ctrl->vfeirq->start);
+
+	tasklet_init(&axi_ctrl->vfe32_tasklet,
+		axi32_do_tasklet, (unsigned long)axi_ctrl);
+
+	vfe32_ctrl->pdev = pdev;
+	msm_cam_register_subdev_node(&vfe32_ctrl->subdev, VFE_DEV, 0);
+	
+	return 0;
+
+vfe32_no_resource:
+	kfree(axi_ctrl);
+	return 0;
+}
+
+static struct platform_driver vfe32_driver = {
+	.probe = vfe32_probe,
+	.driver = {
+		.name = MSM_VFE_DRV_NAME,
+		.owner = THIS_MODULE,
+	},
+};
+
+static int __init msm_vfe32_init_module(void)
+{
+	return platform_driver_register(&vfe32_driver);
+}
+
+static void __exit msm_vfe32_exit_module(void)
+{
+	platform_driver_unregister(&vfe32_driver);
+}
+
+module_init(msm_vfe32_init_module);
+module_exit(msm_vfe32_exit_module);
+MODULE_DESCRIPTION("VFE 3.2 driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/vfe/msm_vfe32.h b/drivers/media/video/msm/msm_vfe32.h
similarity index 72%
rename from drivers/media/video/msm/vfe/msm_vfe32.h
rename to drivers/media/video/msm/msm_vfe32.h
index 5dc4176..ff2e578 100644
--- a/drivers/media/video/msm/vfe/msm_vfe32.h
+++ b/drivers/media/video/msm/msm_vfe32.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -14,7 +14,6 @@
 #define __MSM_VFE32_H__
 
 #include <linux/bitops.h>
-#include "msm_vfe_stats_buf.h"
 
 #define TRUE  1
 #define FALSE 0
@@ -22,84 +21,42 @@
 #define VFE32_HW_NUMBER 0x3030B
 #define VFE33_HW_NUMBER 0x30408
 
-/* This defines total number registers in VFE.
- * Each register is 4 bytes so to get the range,
- * multiply this number with 4. */
 #define VFE32_REGISTER_TOTAL 0x000001CD
 #define VFE33_REGISTER_TOTAL 0x000001EE
 
-/* at start of camif,  bit 1:0 = 0x01:enable
- * image data capture at frame boundary. */
 #define CAMIF_COMMAND_START  0x00000005
 
-/* bit 2= 0x1:clear the CAMIF_STATUS register
- * value. */
 #define CAMIF_COMMAND_CLEAR  0x00000004
 
-/* at stop of vfe pipeline, for now it is assumed
- * that camif will stop at any time. Bit 1:0 = 0x10:
- * disable image data capture immediately. */
 #define CAMIF_COMMAND_STOP_IMMEDIATELY  0x00000002
 
-/* at stop of vfe pipeline, for now it is assumed
- * that camif will stop at any time. Bit 1:0 = 0x00:
- * disable image data capture at frame boundary */
 #define CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY  0x00000000
 
-/* to halt axi bridge */
 #define AXI_HALT  0x00000001
 
-/* clear the halt bit. */
 #define AXI_HALT_CLEAR  0x00000000
 
-/* reset the pipeline when stop command is issued.
- * (without reset the register.) bit 26-32 = 0,
- * domain reset, bit 0-9 = 1 for module reset, except
- * register module. */
 #define VFE_RESET_UPON_STOP_CMD  0x000003ef
 
-/* reset the pipeline when reset command.
- * bit 26-32 = 0, domain reset, bit 0-9 = 1 for module reset. */
 #define VFE_RESET_UPON_RESET_CMD  0x000003ff
 
-/* reset the vfe only when reset command*/
-#define VFE_ONLY_RESET_CMD  0x00000002
-
-/*Vfe module reset command*/
-#define VFE_MODULE_RESET_CMD 0x07ffffff
-
-/* bit 5 is for axi status idle or busy.
- * 1 =  halted,  0 = busy */
 #define AXI_STATUS_BUSY_MASK 0x00000020
 
-/* bit 0 & bit 1 = 1, both y and cbcr irqs need to be present
- * for frame done interrupt */
 #define VFE_COMP_IRQ_BOTH_Y_CBCR 3
 
-/* bit 1 = 1, only cbcr irq triggers frame done interrupt */
 #define VFE_COMP_IRQ_CBCR_ONLY 2
 
-/* bit 0 = 1, only y irq triggers frame done interrupt */
 #define VFE_COMP_IRQ_Y_ONLY 1
 
-/* bit 0 = 1, PM go;   bit1 = 1, PM stop */
 #define VFE_PERFORMANCE_MONITOR_GO   0x00000001
 #define VFE_PERFORMANCE_MONITOR_STOP 0x00000002
 
-/* bit 0 = 1, test gen go;   bit1 = 1, test gen stop */
 #define VFE_TEST_GEN_GO   0x00000001
 #define VFE_TEST_GEN_STOP 0x00000002
 
-/* the chroma is assumed to be interpolated between
- * the luma samples.  JPEG 4:2:2 */
 #define VFE_CHROMA_UPSAMPLE_INTERPOLATED 0
 
-/* wm bit offset for IRQ MASK and IRQ STATUS register */
-#define VFE_WM_OFFSET 6
-
-/* constants for irq registers */
 #define VFE_DISABLE_ALL_IRQS 0
-/* bit =1 is to clear the corresponding bit in VFE_IRQ_STATUS.  */
 #define VFE_CLEAR_ALL_IRQS   0xffffffff
 
 #define VFE_IRQ_STATUS0_CAMIF_SOF_MASK            0x00000001
@@ -110,85 +67,51 @@
 #define VFE_IRQ_STATUS1_RESET_AXI_HALT_ACK_MASK   0x00800000
 #define VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK       0x01000000
 
-#define VFE_IRQ_STATUS0_STATS_AEC_BG    0x2000  /* bit 13 */
-#define VFE_IRQ_STATUS0_STATS_AF_BF     0x4000  /* bit 14 */
-#define VFE_IRQ_STATUS0_STATS_AWB       0x8000  /* bit 15 */
-#define VFE_IRQ_STATUS0_STATS_RS        0x10000  /* bit 16 */
-#define VFE_IRQ_STATUS0_STATS_CS        0x20000  /* bit 17 */
-#define VFE_IRQ_STATUS0_STATS_IHIST     0x40000  /* bit 18 */
-#define VFE_IRQ_STATUS0_STATS_SK_BHIST  0x80000 /* bit 19 */
+#define VFE_IRQ_STATUS0_STATS_AEC     0x2000  
+#define VFE_IRQ_STATUS0_STATS_AF      0x4000  
+#define VFE_IRQ_STATUS0_STATS_AWB     0x8000  
+#define VFE_IRQ_STATUS0_STATS_RS      0x10000  
+#define VFE_IRQ_STATUS0_STATS_CS      0x20000  
+#define VFE_IRQ_STATUS0_STATS_IHIST   0x40000  
 
-#define VFE_IRQ_STATUS0_SYNC_TIMER0   0x2000000  /* bit 25 */
-#define VFE_IRQ_STATUS0_SYNC_TIMER1   0x4000000  /* bit 26 */
-#define VFE_IRQ_STATUS0_SYNC_TIMER2   0x8000000  /* bit 27 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER0  0x10000000  /* bit 28 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER1  0x20000000  /* bit 29 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER2  0x40000000  /* bit 30 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER3  0x80000000  /* bit 32 */
+#define VFE_IRQ_STATUS0_SYNC_TIMER0   0x2000000  
+#define VFE_IRQ_STATUS0_SYNC_TIMER1   0x4000000  
+#define VFE_IRQ_STATUS0_SYNC_TIMER2   0x8000000  
+#define VFE_IRQ_STATUS0_ASYNC_TIMER0  0x10000000  
+#define VFE_IRQ_STATUS0_ASYNC_TIMER1  0x20000000  
+#define VFE_IRQ_STATUS0_ASYNC_TIMER2  0x40000000  
+#define VFE_IRQ_STATUS0_ASYNC_TIMER3  0x80000000  
 
-#define VFE_IRQ_STATUS1_RDI0_REG_UPDATE_MASK  0x4000000 /*bit 26*/
-#define VFE_IRQ_STATUS1_RDI1_REG_UPDATE_MASK  0x8000000 /*bit 27*/
-#define VFE_IRQ_STATUS1_RDI2_REG_UPDATE_MASK  0x10000000 /*bit 28*/
-
-/*TODOs the irq status passed from axi to vfe irq handler does not account
-* for 2 irq status registers. So below macro is added to differentiate between
-* same bit set on both irq status registers. This wil be fixed later by passing
-*entire payload to vfe irq handler and parsing there instead of passing just the
-*status bit*/
-#define VFE_IRQ_STATUS1_RDI0_REG_UPDATE  0x84000000 /*bit 26*/
-#define VFE_IRQ_STATUS1_RDI1_REG_UPDATE  0x88000000 /*bit 27*/
-#define VFE_IRQ_STATUS1_RDI2_REG_UPDATE  0x90000000 /*bit 28*/
-
-/* imask for while waiting for stop ack,  driver has already
- * requested stop, waiting for reset irq, and async timer irq.
- * For irq_status_0, bit 28-32 are for async timer. For
- * irq_status_1, bit 22 for reset irq, bit 23 for axi_halt_ack
-   irq */
 #define VFE_IMASK_WHILE_STOPPING_0  0xF0000000
 #define VFE_IMASK_WHILE_STOPPING_1  0x00800000
 
-/* no error irq in mask 0 */
 #define VFE_IMASK_ERROR_ONLY_0  0x0
-/* when normal case, don't want to block error status. */
-/* bit 0-21 are error irq bits */
 #define VFE_IMASK_ERROR_ONLY_1  0x003fffff
 
-/* For BPC bit 0,bit 12-17 and bit 26 -20 are set to zero and other's 1 */
 #define BPC_MASK 0xF80C0FFE
 
-/* For ABF bit 4 is set to zero and other's 1 */
 #define ABF_MASK 0xFFFFFFF7
 
 
-/* For DBPC bit 0 is set to zero and other's 1 */
 #define DBPC_MASK 0xFFFFFFFE
 
-/* For DBPC bit 1 is set to zero and other's 1 */
 #define DBCC_MASK 0xFFFFFFFD
 
-/* For DBPC/ABF/DBCC/ABCC bits are set to 1 all others 0 */
 #define DEMOSAIC_MASK 0xF
 
-/* For MCE enable bit 28 set to zero and other's 1 */
 #define MCE_EN_MASK 0xEFFFFFFF
 
-/* For MCE Q_K bit 28 to 32 set to zero and other's 1 */
 #define MCE_Q_K_MASK 0x0FFFFFFF
 
-#define AE_BG_ENABLE_MASK 0x00000020      /* bit 5 */
-#define AF_BF_ENABLE_MASK 0x00000040      /* bit 6 */
-#define AWB_ENABLE_MASK 0x00000080     /* bit 7 */
-#define RS_ENABLE_MASK 0x00000100      /* bit 8  */
-#define CS_ENABLE_MASK 0x00000200      /* bit 9  */
-#define RS_CS_ENABLE_MASK 0x00000300   /* bit 8,9  */
-#define CLF_ENABLE_MASK 0x00002000     /* bit 13 */
-#define IHIST_ENABLE_MASK 0x00010000   /* bit 16 */
-#define SKIN_BHIST_ENABLE_MASK 0x00080000 /* bit 19 */
-#define STATS_ENABLE_MASK 0x000903E0   /* bit 19,16,9,8,7,6,5*/
-
-#define STATS_BG_ENABLE_MASK     0x00000002 /* bit 1 */
-#define STATS_BF_ENABLE_MASK     0x00000004 /* bit 2 */
-#define STATS_BHIST_ENABLE_MASK  0x00000008 /* bit 3 */
+#define AE_BG_ENABLE_MASK 0x00000020      
+#define AF_BF_ENABLE_MASK 0x00000040      
+#define AWB_ENABLE_MASK 0x00000080     
+#define RS_ENABLE_MASK 0x00000100      
+#define CS_ENABLE_MASK 0x00000200      
+#define RS_CS_ENABLE_MASK 0x00000300   
+#define CLF_ENABLE_MASK 0x00002000     
+#define IHIST_ENABLE_MASK 0x00010000   
+#define STATS_ENABLE_MASK 0x000903E0   
 
 #define VFE_REG_UPDATE_TRIGGER           1
 #define VFE_PM_BUF_MAX_CNT_MASK          0xFF
@@ -198,9 +121,7 @@
 #define VFE_AWB_PINGPONG_STATUS_BIT      0x200
 
 #define HFR_MODE_OFF 1
-#define VFE_FRAME_SKIP_PERIOD_MASK 0x0000001F /*bits 0 -4*/
-
-#define VFE_RELOAD_ALL_WRITE_MASTERS 0x00003FFF
+#define VFE_FRAME_SKIP_PERIOD_MASK 0x0000001F 
 
 enum VFE32_DMI_RAM_SEL {
 	NO_MEM_SELECTED          = 0,
@@ -233,8 +154,6 @@
 	VFE_STATE_STARTED,
 	VFE_STATE_STOP_REQUESTED,
 	VFE_STATE_STOPPED,
-	VFE_STATE_HW_STOP_REQUESTED,
-	VFE_STATE_HW_STOPPED,
 };
 
 #define V32_CAMIF_OFF             0x000001E4
@@ -249,22 +168,20 @@
 #define V32_DEMOSAICV3_1_LEN      88
 #define V32_DEMOSAICV3_2_OFF      0x0000066C
 #define V32_DEMOSAICV3_UP_REG_CNT 5
-/* BPC     */
 #define V32_DEMOSAIC_2_OFF        0x0000029C
 #define V32_DEMOSAIC_2_LEN        8
 
 #define V32_OUT_CLAMP_OFF         0x00000524
 #define V32_OUT_CLAMP_LEN         8
 
-#define V32_OPERATION_CFG_LEN     32
+#define V32_OPERATION_CFG_LEN     44
 
-#define V32_AXI_BUS_CMD_OFF       0x00000038
-#define V32_AXI_OUT_OFF           0x0000003C
-#define V32_AXI_OUT_LEN           264
+#define V32_AXI_OUT_OFF           0x00000038
+#define V32_AXI_OUT_LEN           216
+#define V32_AXI_CH_INF_LEN        24
 #define V32_AXI_CFG_LEN           47
-#define V32_AXI_BUS_FMT_OFF       1
-#define V32_AXI_BUS_FMT_LEN       4
-#define V32_AXI_BUS_CFG_LEN       16
+#define V32_AXI_BUS_FMT_OFF    1
+#define V32_AXI_BUS_FMT_LEN    4
 
 #define V32_FRAME_SKIP_OFF        0x00000504
 #define V32_FRAME_SKIP_LEN        32
@@ -397,15 +314,6 @@
 #define V32_CLF_CHROMA_UPDATE_OFF 0x000006F0
 #define V32_CLF_CHROMA_UPDATE_LEN 8
 
-#define V32_STATS_BG_OFF 0x00000700
-#define V32_STATS_BG_LEN 12
-
-#define V32_STATS_BF_OFF 0x0000070c
-#define V32_STATS_BF_LEN 24
-
-#define V32_STATS_BHIST_OFF 0x00000724
-#define V32_STATS_BHIST_LEN 8
-
 struct vfe_cmd_hw_version {
 	uint32_t minorVersion;
 	uint32_t majorVersion;
@@ -547,12 +455,6 @@
 
 #define VFE32_GAMMA_NUM_ENTRIES  64
 
-#define VFE32_GAMMA_CH0_G_POS    0
-
-#define VFE32_GAMMA_CH1_B_POS    32
-
-#define VFE32_GAMMA_CH2_R_POS    64
-
 #define VFE32_LA_TABLE_LENGTH    64
 
 #define VFE32_LINEARIZATON_TABLE_LENGTH    36
@@ -790,23 +692,19 @@
 struct vfe32_output_ch {
 	struct list_head free_buf_queue;
 	spinlock_t free_buf_lock;
-	uint32_t inst_handle;
+	uint16_t output_fmt;
 	int8_t ch0;
 	int8_t ch1;
 	int8_t ch2;
-	int32_t  capture_cnt;
+	uint32_t  capture_cnt;
 	uint32_t  frame_drop_cnt;
 	struct msm_free_buf ping;
 	struct msm_free_buf pong;
 	struct msm_free_buf free_buf;
 };
 
-/* no error irq in mask 0 */
 #define VFE32_IMASK_ERROR_ONLY_0  0x0
-/* when normal case, don't want to block error status. */
-/* bit 0-21 are error irq bits */
-#define VFE32_IMASK_COMMON_ERROR_ONLY_1       0x00407F00
-#define VFE32_IMASK_VFE_ERROR_ONLY_1          0x001F80FF
+#define VFE32_IMASK_ERROR_ONLY_1               0x005FFFFF
 #define VFE32_IMASK_CAMIF_ERROR               (0x00000001<<0)
 #define VFE32_IMASK_BHIST_OVWR                (0x00000001<<1)
 #define VFE32_IMASK_STATS_CS_OVWR             (0x00000001<<2)
@@ -834,13 +732,11 @@
 #define VFE_COM_STATUS 0x000FE000
 
 struct vfe32_output_path {
-	uint16_t output_mode;     /* bitmask  */
+	uint16_t output_mode;     
 
-	struct vfe32_output_ch out0; /* preview and thumbnail */
-	struct vfe32_output_ch out1; /* snapshot */
-	struct vfe32_output_ch out2; /* rdi0    */
-	struct vfe32_output_ch out3; /* rdi01   */
-	struct vfe32_output_ch out4; /* rdi02   */
+	struct vfe32_output_ch out0; 
+	struct vfe32_output_ch out1; 
+	struct vfe32_output_ch out2; 
 };
 
 struct vfe32_frame_extra {
@@ -881,12 +777,12 @@
 #define VFE_AXI_STATUS        0x000001DC
 #define VFE_BUS_STATS_PING_PONG_BASE    0x000000F4
 
-#define VFE_BUS_STATS_AEC_BG_WR_PING_ADDR    0x000000F4
-#define VFE_BUS_STATS_AEC_BG_WR_PONG_ADDR    0x000000F8
-#define VFE_BUS_STATS_AEC_BG_UB_CFG          0x000000FC
-#define VFE_BUS_STATS_AF_BF_WR_PING_ADDR     0x00000100
-#define VFE_BUS_STATS_AF_BF_WR_PONG_ADDR     0x00000104
-#define VFE_BUS_STATS_AF_BF_UB_CFG           0x00000108
+#define VFE_BUS_STATS_AEC_WR_PING_ADDR    0x000000F4
+#define VFE_BUS_STATS_AEC_WR_PONG_ADDR    0x000000F8
+#define VFE_BUS_STATS_AEC_UB_CFG          0x000000FC
+#define VFE_BUS_STATS_AF_WR_PING_ADDR     0x00000100
+#define VFE_BUS_STATS_AF_WR_PONG_ADDR     0x00000104
+#define VFE_BUS_STATS_AF_UB_CFG           0x00000108
 #define VFE_BUS_STATS_AWB_WR_PING_ADDR    0x0000010C
 #define VFE_BUS_STATS_AWB_WR_PONG_ADDR    0x00000110
 #define VFE_BUS_STATS_AWB_UB_CFG          0x00000114
@@ -900,11 +796,10 @@
 #define VFE_BUS_STATS_HIST_WR_PING_ADDR   0x00000130
 #define VFE_BUS_STATS_HIST_WR_PONG_ADDR   0x00000134
 #define VFE_BUS_STATS_HIST_UB_CFG          0x00000138
-#define VFE_BUS_STATS_SKIN_BHIST_WR_PING_ADDR    0x0000013C
-#define VFE_BUS_STATS_SKIN_BHIST_WR_PONG_ADDR    0x00000140
-#define VFE_BUS_STATS_SKIN_BHIST_UB_CFG          0x00000144
+#define VFE_BUS_STATS_SKIN_WR_PING_ADDR    0x0000013C
+#define VFE_BUS_STATS_SKIN_WR_PONG_ADDR    0x00000140
+#define VFE_BUS_STATS_SKIN_UB_CFG          0x00000144
 #define VFE_CAMIF_COMMAND               0x000001E0
-#define VFE_CAMIF_FRAME_CFG		0x000001EC
 #define VFE_CAMIF_STATUS                0x00000204
 #define VFE_REG_UPDATE_CMD              0x00000260
 #define VFE_DEMUX_GAIN_0                0x00000288
@@ -925,9 +820,7 @@
 #define VFE_STATS_AWB_SGW_CFG           0x00000554
 #define VFE_DMI_CFG                     0x00000598
 #define VFE_DMI_ADDR                    0x0000059C
-#define VFE_DMI_DATA_HI                 0x000005A0
 #define VFE_DMI_DATA_LO                 0x000005A4
-#define VFE_AXI_CFG                     0x00000600
 #define VFE_BUS_IO_FORMAT_CFG           0x000006F8
 #define VFE_PIXEL_IF_CFG                0x000006FC
 #define VFE_RDI0_CFG                    0x00000734
@@ -937,7 +830,6 @@
 
 #define VFE33_DMI_DATA_HI               0x000005A0
 #define VFE33_DMI_DATA_LO               0x000005A4
-#define VFE_AXI_CFG_MASK                0x80000000
 
 #define VFE32_OUTPUT_MODE_PT			BIT(0)
 #define VFE32_OUTPUT_MODE_S			BIT(1)
@@ -949,74 +841,13 @@
 #define VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS	BIT(7)
 #define VFE32_OUTPUT_MODE_SECONDARY		BIT(8)
 #define VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS	BIT(9)
-#define VFE32_OUTPUT_MODE_TERTIARY1		BIT(10)
-#define VFE32_OUTPUT_MODE_TERTIARY2		BIT(11)
-#define VFE32_OUTPUT_MODE_TERTIARY3		BIT(12)
 
 struct vfe_stats_control {
+	uint8_t  ackPending;
+	uint32_t nextFrameAddrBuf;
 	uint32_t droppedStatsFrameCount;
 	uint32_t bufToRender;
 };
-struct axi_ctrl_t;
-struct vfe32_ctrl_type;
-
-struct vfe_share_ctrl_t {
-	void __iomem *vfebase;
-	uint32_t register_total;
-
-	atomic_t vstate;
-	atomic_t handle_common_irq;
-	uint32_t vfeFrameId;
-	uint32_t rdi0FrameId;
-	uint32_t rdi1FrameId;
-	uint32_t rdi2FrameId;
-	uint32_t stats_comp;
-	spinlock_t  sd_notify_lock;
-	spinlock_t  stop_flag_lock;
-	int8_t stop_ack_pending;
-	enum vfe_output_state liveshot_state;
-	uint32_t vfe_capture_count;
-	int32_t rdi0_capture_count;
-	int32_t rdi1_capture_count;
-	int32_t rdi2_capture_count;
-	uint8_t update_counter;
-
-	uint32_t operation_mode;     /* streaming or snapshot */
-	uint32_t current_mode;
-	struct vfe32_output_path outpath;
-
-	uint16_t port_info;
-	uint8_t stop_immediately;
-	uint8_t sync_abort;
-	uint16_t cmd_type;
-	uint8_t vfe_reset_flag;
-	uint8_t dual_enabled;
-	uint8_t lp_mode;
-
-	uint8_t axi_ref_cnt;
-	uint16_t comp_output_mode;
-
-	struct completion reset_complete;
-
-	spinlock_t  update_ack_lock;
-	spinlock_t  start_ack_lock;
-
-	struct axi_ctrl_t *axi_ctrl;
-	struct vfe32_ctrl_type *vfe32_ctrl;
-	int8_t start_ack_pending;
-	int8_t update_ack_pending;
-	enum vfe_output_state recording_state;
-
-	atomic_t pix0_update_ack_pending;
-	atomic_t rdi0_update_ack_pending;
-	atomic_t rdi1_update_ack_pending;
-	atomic_t rdi2_update_ack_pending;
-
-	uint8_t stream_error;
-	uint32_t rdi_comp;
-
-};
-
 struct axi_ctrl_t {
 	struct v4l2_subdev subdev;
 	struct platform_device *pdev;
@@ -1024,6 +855,7 @@
 	spinlock_t  tasklet_lock;
 	struct list_head tasklet_q;
 
+	void __iomem *vfebase;
 	void *syncdata;
 
 	struct resource	*vfemem;
@@ -1031,50 +863,76 @@
 	struct regulator *fs_vfe;
 	struct clk *vfe_clk[3];
 	struct tasklet_struct vfe32_tasklet;
-	struct vfe_share_ctrl_t *share_ctrl;
-	struct device *iommu_ctx_imgwr;
-	struct device *iommu_ctx_misc;
-	uint32_t simultaneous_sof_frame;
 };
 
+
 struct vfe32_ctrl_type {
+	uint16_t operation_mode;     
+	struct vfe32_output_path outpath;
+
+	uint32_t vfeImaskCompositePacked;
+
+	spinlock_t  stop_flag_lock;
+	spinlock_t  update_ack_lock;
 	spinlock_t  state_lock;
-	spinlock_t  stats_bufq_lock;
+	spinlock_t  io_lock;
+
+	spinlock_t  aec_ack_lock;
+	spinlock_t  awb_ack_lock;
+	spinlock_t  af_ack_lock;
+	spinlock_t  ihist_ack_lock;
+	spinlock_t  rs_ack_lock;
+	spinlock_t  cs_ack_lock;
+	spinlock_t  comp_stats_ack_lock;
+
 	uint32_t extlen;
 	void *extdata;
 
-	int8_t vfe_sof_count_enable;
+	int8_t start_ack_pending;
+	int8_t stop_ack_pending;
+	int8_t reset_ack_pending;
+	int8_t update_ack_pending;
+	enum vfe_output_state recording_state;
 	int8_t update_linear;
 	int8_t update_rolloff;
 	int8_t update_la;
 	int8_t update_gamma;
+	enum vfe_output_state liveshot_state;
 
-	struct vfe_share_ctrl_t *share_ctrl;
 
+	void __iomem *vfebase;
+	uint32_t register_total;
+
+
+	uint32_t stats_comp;
+	atomic_t vstate;
+	uint32_t vfe_capture_count;
 	uint32_t sync_timer_repeat_count;
 	uint32_t sync_timer_state;
 	uint32_t sync_timer_number;
 
-	struct msm_ver_num_info ver_num;
-	struct vfe_stats_control afbfStatsControl;
+	uint32_t vfeFrameId;
+	uint32_t output1Pattern;
+	uint32_t output1Period;
+	uint32_t output2Pattern;
+	uint32_t output2Period;
+	uint32_t vfeFrameSkipCount;
+	uint32_t vfeFrameSkipPeriod;
+	struct vfe_stats_control afStatsControl;
 	struct vfe_stats_control awbStatsControl;
-	struct vfe_stats_control aecbgStatsControl;
+	struct vfe_stats_control aecStatsControl;
 	struct vfe_stats_control ihistStatsControl;
 	struct vfe_stats_control rsStatsControl;
 	struct vfe_stats_control csStatsControl;
-	struct vfe_stats_control bhistStatsControl;
 
-	/* v4l2 subdev */
+	
 	struct v4l2_subdev subdev;
 	struct platform_device *pdev;
+	spinlock_t  sd_notify_lock;
 	uint32_t hfr_mode;
 	uint32_t frame_skip_cnt;
 	uint32_t frame_skip_pattern;
 	uint32_t snapshot_frame_cnt;
-	struct msm_stats_bufq_ctrl stats_ctrl;
-	struct msm_stats_ops stats_ops;
-
-	uint32_t simultaneous_sof_stat;
 };
 
 #define statsAeNum      0
@@ -1089,10 +947,22 @@
 	uint32_t  nextStatsBuf;
 };
 
+#define VIDIOC_MSM_AXI_INIT \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 18, struct msm_cam_media_controller *)
+
+#define VIDIOC_MSM_AXI_RELEASE \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 19, struct msm_cam_media_controller *)
+
+#define VIDIOC_MSM_AXI_CFG \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 20, void *)
+
+#define VIDIOC_MSM_AXI_IRQ \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 21, void *)
+
+
 #define VFE_STATS_BUFFER_COUNT            3
 
 struct vfe_cmd_stats_buf {
 	uint32_t statsBuf[VFE_STATS_BUFFER_COUNT];
 };
-
-#endif /* __MSM_VFE32_H__ */
+#endif 
diff --git a/drivers/media/video/msm/msm_vpe.c b/drivers/media/video/msm/msm_vpe.c
index 7427ae3..4a425a4 100644
--- a/drivers/media/video/msm/msm_vpe.c
+++ b/drivers/media/video/msm/msm_vpe.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -17,6 +17,7 @@
 #include <mach/irqs.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/pm_qos.h>
 #include <linux/regulator/consumer.h>
 #include <linux/clk.h>
 #include <mach/clk.h>
@@ -30,19 +31,14 @@
 #include "msm.h"
 #include "msm_vpe.h"
 
-#ifdef CONFIG_MSM_CAMERA_DEBUG
-#define D(fmt, args...) pr_debug("msm_vpe: " fmt, ##args)
-#else
-#define D(fmt, args...) do {} while (0)
-#endif
-
-static int vpe_enable(uint32_t, struct msm_cam_media_controller *);
-static int vpe_disable(struct msm_cam_media_controller *);
+static int vpe_enable(uint32_t);
+static int vpe_disable(void);
 static int vpe_update_scaler(struct msm_pp_crop *pcrop);
 struct vpe_ctrl_type *vpe_ctrl;
 static atomic_t vpe_init_done = ATOMIC_INIT(0);
 
-static int msm_vpe_do_pp(struct msm_mctl_pp_frame_info *pp_frame_info);
+static int msm_vpe_do_pp(struct msm_mctl_pp_cmd *cmd,
+	struct msm_mctl_pp_frame_info *pp_frame_info);
 
 static long long vpe_do_div(long long num, long long den)
 {
@@ -52,39 +48,40 @@
 
 static int vpe_start(void)
 {
-	/*  enable the frame irq, bit 0 = Display list 0 ROI done */
-	msm_camera_io_w_mb(1, vpe_ctrl->vpebase + VPE_INTR_ENABLE_OFFSET);
-	msm_camera_io_dump(vpe_ctrl->vpebase, 0x120);
-	msm_camera_io_dump(vpe_ctrl->vpebase + 0x00400, 0x18);
-	msm_camera_io_dump(vpe_ctrl->vpebase + 0x10000, 0x250);
-	msm_camera_io_dump(vpe_ctrl->vpebase + 0x30000, 0x20);
-	msm_camera_io_dump(vpe_ctrl->vpebase + 0x50000, 0x30);
-	msm_camera_io_dump(vpe_ctrl->vpebase + 0x50400, 0x10);
-
-	/* this triggers the operation. */
-	msm_camera_io_w_mb(1, vpe_ctrl->vpebase + VPE_DL0_START_OFFSET);
+	
+	msm_io_w_mb(1, vpe_ctrl->vpebase + VPE_INTR_ENABLE_OFFSET);
+	msm_io_dump(vpe_ctrl->vpebase, 0x120);
+	msm_io_dump(vpe_ctrl->vpebase + 0x00400, 0x18);
+	msm_io_dump(vpe_ctrl->vpebase + 0x10000, 0x250);
+	msm_io_dump(vpe_ctrl->vpebase + 0x30000, 0x20);
+	msm_io_dump(vpe_ctrl->vpebase + 0x50000, 0x30);
+	msm_io_dump(vpe_ctrl->vpebase + 0x50400, 0x10);
+	
+	msm_io_w(1, vpe_ctrl->vpebase + VPE_DL0_START_OFFSET);
+	wmb();
 	return 0;
 }
 
 void vpe_reset_state_variables(void)
 {
-	/* initialize local variables for state control, etc.*/
+	
 	vpe_ctrl->op_mode = 0;
 	vpe_ctrl->state = VPE_STATE_INIT;
 }
 
 static void vpe_config_axi_default(void)
 {
-	msm_camera_io_w(0x25, vpe_ctrl->vpebase + VPE_AXI_ARB_2_OFFSET);
-	D("%s: yaddr %ld cbcraddr %ld", __func__,
+	msm_io_w(0x25, vpe_ctrl->vpebase + VPE_AXI_ARB_2_OFFSET);
+	CDBG("%s: yaddr %ld cbcraddr %ld", __func__,
 		 vpe_ctrl->out_y_addr, vpe_ctrl->out_cbcr_addr);
 	if (!vpe_ctrl->out_y_addr || !vpe_ctrl->out_cbcr_addr)
 		return;
-	msm_camera_io_w(vpe_ctrl->out_y_addr,
+	msm_io_w(vpe_ctrl->out_y_addr,
 		vpe_ctrl->vpebase + VPE_OUTP0_ADDR_OFFSET);
-	/* for video  CbCr address */
-	msm_camera_io_w(vpe_ctrl->out_cbcr_addr,
+	
+	msm_io_w(vpe_ctrl->out_cbcr_addr,
 		vpe_ctrl->vpebase + VPE_OUTP1_ADDR_OFFSET);
+
 }
 
 static int vpe_reset(void)
@@ -95,40 +92,38 @@
 
 	spin_lock_irqsave(&vpe_ctrl->lock, flags);
 	if (vpe_ctrl->state == VPE_STATE_IDLE) {
-		D("%s: VPE already disabled.", __func__);
+		pr_info("%s: VPE already disabled.", __func__);
 		spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
 		return rc;
 	}
 	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
 
+	pr_info("%s, vpe_ctrl->state %d\n", __func__, vpe_ctrl->state);
 	vpe_reset_state_variables();
-	vpe_version = msm_camera_io_r(
-			vpe_ctrl->vpebase + VPE_HW_VERSION_OFFSET);
-	D("vpe_version = 0x%x\n", vpe_version);
-	/* disable all interrupts.*/
-	msm_camera_io_w(0, vpe_ctrl->vpebase + VPE_INTR_ENABLE_OFFSET);
-	/* clear all pending interrupts*/
-	msm_camera_io_w(0x1fffff, vpe_ctrl->vpebase + VPE_INTR_CLEAR_OFFSET);
-	/* write sw_reset to reset the core. */
-	msm_camera_io_w(0x10, vpe_ctrl->vpebase + VPE_SW_RESET_OFFSET);
-	/* then poll the reset bit, it should be self-cleared. */
+	vpe_version = msm_io_r(vpe_ctrl->vpebase + VPE_HW_VERSION_OFFSET);
+	CDBG("vpe_version = 0x%x\n", vpe_version);
+	
+	msm_io_w(0, vpe_ctrl->vpebase + VPE_INTR_ENABLE_OFFSET);
+	
+	msm_io_w(0x1fffff, vpe_ctrl->vpebase + VPE_INTR_CLEAR_OFFSET);
+	
+	msm_io_w(0x10, vpe_ctrl->vpebase + VPE_SW_RESET_OFFSET);
+	
 	while (1) {
 		rc =
-		msm_camera_io_r(vpe_ctrl->vpebase + VPE_SW_RESET_OFFSET) & 0x10;
+		msm_io_r(vpe_ctrl->vpebase + VPE_SW_RESET_OFFSET) & 0x10;
 		if (rc == 0)
 			break;
 	}
-	/*  at this point, hardware is reset. Then pogram to default
-		values. */
-	msm_camera_io_w(VPE_AXI_RD_ARB_CONFIG_VALUE,
+	msm_io_w(VPE_AXI_RD_ARB_CONFIG_VALUE,
 			vpe_ctrl->vpebase + VPE_AXI_RD_ARB_CONFIG_OFFSET);
 
-	msm_camera_io_w(VPE_CGC_ENABLE_VALUE,
+	msm_io_w(VPE_CGC_ENABLE_VALUE,
 			vpe_ctrl->vpebase + VPE_CGC_EN_OFFSET);
-	msm_camera_io_w(1, vpe_ctrl->vpebase + VPE_CMD_MODE_OFFSET);
-	msm_camera_io_w(VPE_DEFAULT_OP_MODE_VALUE,
+	msm_io_w(1, vpe_ctrl->vpebase + VPE_CMD_MODE_OFFSET);
+	msm_io_w(VPE_DEFAULT_OP_MODE_VALUE,
 			vpe_ctrl->vpebase + VPE_OP_MODE_OFFSET);
-	msm_camera_io_w(VPE_DEFAULT_SCALE_CONFIG,
+	msm_io_w(VPE_DEFAULT_SCALE_CONFIG,
 			vpe_ctrl->vpebase + VPE_SCALE_CONFIG_OFFSET);
 	vpe_config_axi_default();
 	return rc;
@@ -139,16 +134,16 @@
 	uint32_t  rot_flag, rc = 0;
 	struct msm_pp_crop *pcrop = (struct msm_pp_crop *)pinfo;
 
-	rot_flag = msm_camera_io_r(vpe_ctrl->vpebase +
+	rot_flag = msm_io_r(vpe_ctrl->vpebase +
 						VPE_OP_MODE_OFFSET) & 0xE00;
 	if (pinfo != NULL) {
-		D("%s: Crop info in2_w = %d, in2_h = %d "
+		CDBG("%s: Crop info in2_w = %d, in2_h = %d "
 			"out2_w = %d out2_h = %d\n",
 			__func__, pcrop->src_w, pcrop->src_h,
 			pcrop->dst_w, pcrop->dst_h);
 		rc = vpe_update_scaler(pcrop);
 	}
-	D("return rc = %d rot_flag = %d\n", rc, rot_flag);
+	CDBG("return rc = %d rot_flag = %d\n", rc, rot_flag);
 	rc |= rot_flag;
 
 	return rc;
@@ -159,68 +154,56 @@
 	uint32_t i, offset;
 	offset = *p;
 	for (i = offset; i < (VPE_SCALE_COEFF_NUM + offset); i++) {
-		msm_camera_io_w(*(++p),
-			vpe_ctrl->vpebase + VPE_SCALE_COEFF_LSBn(i));
-		msm_camera_io_w(*(++p),
-			vpe_ctrl->vpebase + VPE_SCALE_COEFF_MSBn(i));
+		msm_io_w(*(++p), vpe_ctrl->vpebase + VPE_SCALE_COEFF_LSBn(i));
+		msm_io_w(*(++p), vpe_ctrl->vpebase + VPE_SCALE_COEFF_MSBn(i));
 	}
 }
 
 void vpe_input_plane_config(uint32_t *p)
 {
-	msm_camera_io_w(*p, vpe_ctrl->vpebase + VPE_SRC_FORMAT_OFFSET);
-	msm_camera_io_w(*(++p),
-		vpe_ctrl->vpebase + VPE_SRC_UNPACK_PATTERN1_OFFSET);
-	msm_camera_io_w(*(++p), vpe_ctrl->vpebase + VPE_SRC_IMAGE_SIZE_OFFSET);
-	msm_camera_io_w(*(++p), vpe_ctrl->vpebase + VPE_SRC_YSTRIDE1_OFFSET);
-	msm_camera_io_w(*(++p), vpe_ctrl->vpebase + VPE_SRC_SIZE_OFFSET);
-	msm_camera_io_w(*(++p), vpe_ctrl->vpebase + VPE_SRC_XY_OFFSET);
+	msm_io_w(*p, vpe_ctrl->vpebase + VPE_SRC_FORMAT_OFFSET);
+	msm_io_w(*(++p), vpe_ctrl->vpebase + VPE_SRC_UNPACK_PATTERN1_OFFSET);
+	msm_io_w(*(++p), vpe_ctrl->vpebase + VPE_SRC_IMAGE_SIZE_OFFSET);
+	msm_io_w(*(++p), vpe_ctrl->vpebase + VPE_SRC_YSTRIDE1_OFFSET);
+	msm_io_w(*(++p), vpe_ctrl->vpebase + VPE_SRC_SIZE_OFFSET);
+	msm_io_w(*(++p), vpe_ctrl->vpebase + VPE_SRC_XY_OFFSET);
 }
 
 void vpe_output_plane_config(uint32_t *p)
 {
-	msm_camera_io_w(*p, vpe_ctrl->vpebase + VPE_OUT_FORMAT_OFFSET);
-	msm_camera_io_w(*(++p),
-		vpe_ctrl->vpebase + VPE_OUT_PACK_PATTERN1_OFFSET);
-	msm_camera_io_w(*(++p), vpe_ctrl->vpebase + VPE_OUT_YSTRIDE1_OFFSET);
-	msm_camera_io_w(*(++p), vpe_ctrl->vpebase + VPE_OUT_SIZE_OFFSET);
-	msm_camera_io_w(*(++p), vpe_ctrl->vpebase + VPE_OUT_XY_OFFSET);
+	msm_io_w(*p, vpe_ctrl->vpebase + VPE_OUT_FORMAT_OFFSET);
+	msm_io_w(*(++p), vpe_ctrl->vpebase + VPE_OUT_PACK_PATTERN1_OFFSET);
+	msm_io_w(*(++p), vpe_ctrl->vpebase + VPE_OUT_YSTRIDE1_OFFSET);
+	msm_io_w(*(++p), vpe_ctrl->vpebase + VPE_OUT_SIZE_OFFSET);
+	msm_io_w(*(++p), vpe_ctrl->vpebase + VPE_OUT_XY_OFFSET);
 }
 
 static int vpe_operation_config(uint32_t *p)
 {
 	uint32_t w, h, temp;
-	msm_camera_io_w(*p, vpe_ctrl->vpebase + VPE_OP_MODE_OFFSET);
+	msm_io_w(*p, vpe_ctrl->vpebase + VPE_OP_MODE_OFFSET);
 
-	temp = msm_camera_io_r(vpe_ctrl->vpebase + VPE_OUT_SIZE_OFFSET);
+	temp = msm_io_r(vpe_ctrl->vpebase + VPE_OUT_SIZE_OFFSET);
 	w = temp & 0xFFF;
 	h = (temp & 0xFFF0000) >> 16;
 	if (*p++ & 0xE00) {
-		/* rotation enabled. */
+		
 		vpe_ctrl->out_w = h;
 		vpe_ctrl->out_h = w;
 	} else {
 		vpe_ctrl->out_w = w;
 		vpe_ctrl->out_h = h;
 	}
-	D("%s: out_w=%d, out_h=%d", __func__, vpe_ctrl->out_w,
+	CDBG("%s: out_w=%d, out_h=%d", __func__, vpe_ctrl->out_w,
 		vpe_ctrl->out_h);
 	return 0;
 }
 
-/* Later we can separate the rotation and scaler calc. If
-*  rotation is enabled, simply swap the destination dimension.
-*  And then pass the already swapped output size to this
-*  function. */
 static int vpe_update_scaler(struct msm_pp_crop *pcrop)
 {
 	uint32_t out_ROI_width, out_ROI_height;
 	uint32_t src_ROI_width, src_ROI_height;
 
-	/*
-	* phase_step_x, phase_step_y, phase_init_x and phase_init_y
-	* are represented in fixed-point, unsigned 3.29 format
-	*/
 	uint32_t phase_step_x = 0;
 	uint32_t phase_step_y = 0;
 	uint32_t phase_init_x = 0;
@@ -231,114 +214,81 @@
 	uint32_t scale_unit_sel_x, scale_unit_sel_y;
 	uint64_t numerator, denominator;
 
-	/* assumption is both direction need zoom. this can be
-	improved. */
 	temp =
-		msm_camera_io_r(vpe_ctrl->vpebase + VPE_OP_MODE_OFFSET) | 0x3;
-	msm_camera_io_w(temp, vpe_ctrl->vpebase + VPE_OP_MODE_OFFSET);
+		msm_io_r(vpe_ctrl->vpebase + VPE_OP_MODE_OFFSET) | 0x3;
+	msm_io_w(temp, vpe_ctrl->vpebase + VPE_OP_MODE_OFFSET);
 
 	src_ROI_width = pcrop->src_w;
 	src_ROI_height = pcrop->src_h;
 	out_ROI_width = pcrop->dst_w;
 	out_ROI_height = pcrop->dst_h;
 
-	D("src w = 0x%x, h=0x%x, dst w = 0x%x, h =0x%x.\n",
+	CDBG("src w = 0x%x, h=0x%x, dst w = 0x%x, h =0x%x.\n",
 		src_ROI_width, src_ROI_height, out_ROI_width,
 		out_ROI_height);
 	src_roi = (src_ROI_height << 16) + src_ROI_width;
 
-	msm_camera_io_w(src_roi, vpe_ctrl->vpebase + VPE_SRC_SIZE_OFFSET);
+	msm_io_w(src_roi, vpe_ctrl->vpebase + VPE_SRC_SIZE_OFFSET);
 
 	src_x = pcrop->src_x;
 	src_y = pcrop->src_y;
 
-	D("src_x = %d, src_y=%d.\n", src_x, src_y);
+	CDBG("src_x = %d, src_y=%d.\n", src_x, src_y);
 
 	src_xy = src_y*(1<<16) + src_x;
-	msm_camera_io_w(src_xy, vpe_ctrl->vpebase +
+	msm_io_w(src_xy, vpe_ctrl->vpebase +
 			VPE_SRC_XY_OFFSET);
-	D("src_xy = %d, src_roi=%d.\n", src_xy, src_roi);
+	CDBG("src_xy = %d, src_roi=%d.\n", src_xy, src_roi);
 
-	/* decide whether to use FIR or M/N for scaling */
+	
 	if ((out_ROI_width == 1 && src_ROI_width < 4) ||
 		(src_ROI_width < 4 * out_ROI_width - 3))
-		scale_unit_sel_x = 0;/* use FIR scalar */
+		scale_unit_sel_x = 0;
 	else
-		scale_unit_sel_x = 1;/* use M/N scalar */
+		scale_unit_sel_x = 1;
 
 	if ((out_ROI_height == 1 && src_ROI_height < 4) ||
 		(src_ROI_height < 4 * out_ROI_height - 3))
-		scale_unit_sel_y = 0;/* use FIR scalar */
+		scale_unit_sel_y = 0;
 	else
-		scale_unit_sel_y = 1;/* use M/N scalar */
+		scale_unit_sel_y = 1;
 
-	/* calculate phase step for the x direction */
+	
 
-	/* if destination is only 1 pixel wide,
-	the value of phase_step_x
-	is unimportant. Assigning phase_step_x to
-	src ROI width as an arbitrary value. */
 	if (out_ROI_width == 1)
 		phase_step_x = (uint32_t) ((src_ROI_width) <<
 						SCALER_PHASE_BITS);
 
-		/* if using FIR scalar */
+		
 	else if (scale_unit_sel_x == 0) {
 
-		/* Calculate the quotient ( src_ROI_width - 1 )
-			( out_ROI_width - 1)
-			with u3.29 precision. Quotient is rounded up to
-			the larger 29th decimal point*/
 		numerator = (uint64_t)(src_ROI_width - 1) <<
 			SCALER_PHASE_BITS;
-		/* never equals to 0 because of the
-			"(out_ROI_width == 1 )"*/
 		denominator = (uint64_t)(out_ROI_width - 1);
-		/* divide and round up to the larger 29th
-			decimal point.*/
 		phase_step_x = (uint32_t) vpe_do_div((numerator +
 					denominator - 1), denominator);
-	} else if (scale_unit_sel_x == 1) { /* if M/N scalar */
-		/* Calculate the quotient ( src_ROI_width ) /
-			( out_ROI_width)
-			with u3.29 precision. Quotient is rounded down to the
-			smaller 29th decimal point.*/
+	} else if (scale_unit_sel_x == 1) { 
 		numerator = (uint64_t)(src_ROI_width) <<
 			SCALER_PHASE_BITS;
 		denominator = (uint64_t)(out_ROI_width);
 		phase_step_x =
 			(uint32_t) vpe_do_div(numerator, denominator);
 	}
-	/* calculate phase step for the y direction */
+	
 
-	/* if destination is only 1 pixel wide, the value of
-		phase_step_x is unimportant. Assigning phase_step_x
-		to src ROI width as an arbitrary value. */
 	if (out_ROI_height == 1)
 		phase_step_y =
 		(uint32_t) ((src_ROI_height) << SCALER_PHASE_BITS);
 
-	/* if FIR scalar */
+	
 	else if (scale_unit_sel_y == 0) {
-		/* Calculate the quotient ( src_ROI_height - 1 ) /
-		( out_ROI_height - 1)
-		with u3.29 precision. Quotient is rounded up to the
-		larger 29th decimal point. */
 		numerator = (uint64_t)(src_ROI_height - 1) <<
 			SCALER_PHASE_BITS;
-		/* never equals to 0 because of the "
-		( out_ROI_height == 1 )" case */
 		denominator = (uint64_t)(out_ROI_height - 1);
-		/* Quotient is rounded up to the larger
-		29th decimal point. */
 		phase_step_y =
 		(uint32_t) vpe_do_div(
 			(numerator + denominator - 1), denominator);
-	} else if (scale_unit_sel_y == 1) { /* if M/N scalar */
-		/* Calculate the quotient ( src_ROI_height )
-			( out_ROI_height)
-			with u3.29 precision. Quotient is rounded down
-			to the smaller 29th decimal point. */
+	} else if (scale_unit_sel_y == 1) { 
 		numerator = (uint64_t)(src_ROI_height) <<
 			SCALER_PHASE_BITS;
 		denominator = (uint64_t)(out_ROI_height);
@@ -346,7 +296,7 @@
 			numerator, denominator);
 	}
 
-	/* decide which set of FIR coefficients to use */
+	
 	if (phase_step_x > HAL_MDP_PHASE_STEP_2P50)
 		xscale_filter_sel = 0;
 	else if (phase_step_x > HAL_MDP_PHASE_STEP_1P66)
@@ -365,9 +315,9 @@
 	else
 		yscale_filter_sel = 3;
 
-	/* calculate phase init for the x direction */
+	
 
-	/* if using FIR scalar */
+	
 	if (scale_unit_sel_x == 0) {
 		if (out_ROI_width == 1)
 			phase_init_x =
@@ -375,11 +325,9 @@
 							SCALER_PHASE_BITS);
 		else
 			phase_init_x = 0;
-	} else if (scale_unit_sel_x == 1) /* M over N scalar  */
+	} else if (scale_unit_sel_x == 1) 
 		phase_init_x = 0;
 
-	/* calculate phase init for the y direction
-	if using FIR scalar */
 	if (scale_unit_sel_y == 0) {
 		if (out_ROI_height == 1)
 			phase_init_y =
@@ -387,23 +335,23 @@
 						1) << SCALER_PHASE_BITS);
 		else
 			phase_init_y = 0;
-	} else if (scale_unit_sel_y == 1) /* M over N scalar   */
+	} else if (scale_unit_sel_y == 1) 
 		phase_init_y = 0;
 
-	D("phase step x = %d, step y = %d.\n",
+	CDBG("phase step x = %d, step y = %d.\n",
 		 phase_step_x, phase_step_y);
-	D("phase init x = %d, init y = %d.\n",
+	CDBG("phase init x = %d, init y = %d.\n",
 		 phase_init_x, phase_init_y);
 
-	msm_camera_io_w(phase_step_x, vpe_ctrl->vpebase +
+	msm_io_w(phase_step_x, vpe_ctrl->vpebase +
 			VPE_SCALE_PHASEX_STEP_OFFSET);
-	msm_camera_io_w(phase_step_y, vpe_ctrl->vpebase +
+	msm_io_w(phase_step_y, vpe_ctrl->vpebase +
 			VPE_SCALE_PHASEY_STEP_OFFSET);
 
-	msm_camera_io_w(phase_init_x, vpe_ctrl->vpebase +
+	msm_io_w(phase_init_x, vpe_ctrl->vpebase +
 			VPE_SCALE_PHASEX_INIT_OFFSET);
 
-	msm_camera_io_w(phase_init_y, vpe_ctrl->vpebase +
+	msm_io_w(phase_init_y, vpe_ctrl->vpebase +
 			VPE_SCALE_PHASEY_INIT_OFFSET);
 
 	return 1;
@@ -419,49 +367,26 @@
 	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
 	return busy;
 }
-
 static int msm_send_frame_to_vpe(void)
 {
 	int rc = 0;
 	unsigned long flags;
-	unsigned long srcP0, srcP1, outP0, outP1;
-	struct msm_mctl_pp_frame_info *frame_info = vpe_ctrl->pp_frame_info;
-
-	if (!frame_info) {
-		pr_err("%s Invalid frame", __func__);
-		return -EINVAL;
-	}
 
 	spin_lock_irqsave(&vpe_ctrl->lock, flags);
-
-	if (frame_info->src_frame.frame.num_planes > 1) {
-		srcP0 = frame_info->src_frame.map[0].paddr +
-			frame_info->src_frame.map[0].data_offset;
-		srcP1 = frame_info->src_frame.map[1].paddr +
-			frame_info->src_frame.map[1].data_offset;
-		outP0 = frame_info->dest_frame.map[0].paddr +
-			frame_info->dest_frame.map[0].data_offset;
-		outP1 = frame_info->dest_frame.map[1].paddr +
-			frame_info->dest_frame.map[1].data_offset;
-	} else {
-		srcP0 = frame_info->src_frame.map[0].paddr;
-		srcP1 = frame_info->src_frame.map[0].paddr +
-			frame_info->src_frame.map[0].data_offset;
-		outP0 = frame_info->dest_frame.map[0].paddr;
-		outP1 = frame_info->dest_frame.map[0].paddr +
-			frame_info->dest_frame.map[0].data_offset;
-	}
-
-	D("%s VPE Configured with Src %x, %x Dest %x, %x",
-		__func__, (uint32_t)srcP0, (uint32_t)srcP1,
-		(uint32_t)outP0, (uint32_t)outP1);
-
-	msm_camera_io_w(srcP0, vpe_ctrl->vpebase + VPE_SRCP0_ADDR_OFFSET);
-	msm_camera_io_w(srcP1, vpe_ctrl->vpebase + VPE_SRCP1_ADDR_OFFSET);
-	msm_camera_io_w(outP0, vpe_ctrl->vpebase + VPE_OUTP0_ADDR_OFFSET);
-	msm_camera_io_w(outP1, vpe_ctrl->vpebase + VPE_OUTP1_ADDR_OFFSET);
-
+	msm_io_w((vpe_ctrl->pp_frame_info->src_frame.sp.phy_addr +
+			  vpe_ctrl->pp_frame_info->src_frame.sp.y_off),
+			vpe_ctrl->vpebase + VPE_SRCP0_ADDR_OFFSET);
+	msm_io_w((vpe_ctrl->pp_frame_info->src_frame.sp.phy_addr +
+			  vpe_ctrl->pp_frame_info->src_frame.sp.cbcr_off),
+			vpe_ctrl->vpebase + VPE_SRCP1_ADDR_OFFSET);
+	msm_io_w((vpe_ctrl->pp_frame_info->dest_frame.sp.phy_addr +
+			  vpe_ctrl->pp_frame_info->dest_frame.sp.y_off),
+			vpe_ctrl->vpebase + VPE_OUTP0_ADDR_OFFSET);
+	msm_io_w((vpe_ctrl->pp_frame_info->dest_frame.sp.phy_addr +
+			  vpe_ctrl->pp_frame_info->dest_frame.sp.cbcr_off),
+			vpe_ctrl->vpebase + VPE_OUTP1_ADDR_OFFSET);
 	vpe_ctrl->state = VPE_STATE_ACTIVE;
+	vpe_ctrl->vpe_event_done = 0;
 	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
 	vpe_start();
 	return rc;
@@ -470,32 +395,29 @@
 static void vpe_send_outmsg(void)
 {
 	unsigned long flags;
-	struct v4l2_event v4l2_evt;
-	struct msm_queue_cmd *event_qcmd;
+	struct msm_vpe_resp rp;
+	memset(&rp, 0, sizeof(rp));
 	spin_lock_irqsave(&vpe_ctrl->lock, flags);
 	if (vpe_ctrl->state == VPE_STATE_IDLE) {
 		pr_err("%s VPE is in IDLE state. Ignore the ack msg", __func__);
 		spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
 		return;
 	}
-	event_qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_ATOMIC);
-	atomic_set(&event_qcmd->on_heap, 1);
-	event_qcmd->command = (void *)vpe_ctrl->pp_frame_info;
+	rp.type = vpe_ctrl->pp_frame_info->pp_frame_cmd.path;
+	rp.extdata = (void *)vpe_ctrl->pp_frame_info;
+	rp.extlen = sizeof(*vpe_ctrl->pp_frame_info);
+	vpe_ctrl->state = VPE_STATE_INIT;   
 	vpe_ctrl->pp_frame_info = NULL;
-	vpe_ctrl->state = VPE_STATE_INIT;   /* put it back to idle. */
-
-	/* Enqueue the event payload. */
-	msm_enqueue(&vpe_ctrl->eventData_q, &event_qcmd->list_eventdata);
-	/* Now queue the event. */
-	v4l2_evt.type = V4L2_EVENT_PRIVATE_START + MSM_CAM_RESP_MCTL_PP_EVENT;
-	v4l2_evt.id = 0;
-	v4l2_event_queue(vpe_ctrl->subdev.devnode, &v4l2_evt);
+	vpe_ctrl->vpe_event_done = 1;
+	wake_up(&vpe_ctrl->vpe_event_queue);
 	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
+	v4l2_subdev_notify(&vpe_ctrl->subdev,
+		NOTIFY_VPE_MSG_EVT, (void *)&rp);
 }
 
 static void vpe_do_tasklet(unsigned long data)
 {
-	D("%s: irq_status = 0x%x",
+	CDBG("%s: irq_status = 0x%x",
 		   __func__, vpe_ctrl->irq_status);
 	if (vpe_ctrl->irq_status & 0x1)
 		vpe_send_outmsg();
@@ -505,111 +427,117 @@
 
 static irqreturn_t vpe_parse_irq(int irq_num, void *data)
 {
-	if(!vpe_ctrl || !vpe_ctrl->vpebase)
-		return IRQ_HANDLED;
-	vpe_ctrl->irq_status = msm_camera_io_r_mb(vpe_ctrl->vpebase +
+	vpe_ctrl->irq_status = msm_io_r_mb(vpe_ctrl->vpebase +
 							VPE_INTR_STATUS_OFFSET);
-	msm_camera_io_w_mb(vpe_ctrl->irq_status, vpe_ctrl->vpebase +
+	msm_io_w_mb(vpe_ctrl->irq_status, vpe_ctrl->vpebase +
 				VPE_INTR_CLEAR_OFFSET);
-	msm_camera_io_w(0, vpe_ctrl->vpebase + VPE_INTR_ENABLE_OFFSET);
-	D("%s: vpe_parse_irq =0x%x.\n", __func__, vpe_ctrl->irq_status);
+	msm_io_w(0, vpe_ctrl->vpebase + VPE_INTR_ENABLE_OFFSET);
+	CDBG("%s: vpe_parse_irq =0x%x.\n", __func__, vpe_ctrl->irq_status);
 	tasklet_schedule(&vpe_tasklet);
 	return IRQ_HANDLED;
 }
 
 static struct msm_cam_clk_info vpe_clk_info[] = {
+#ifdef CONFIG_ARCH_APQ8064
 	{"vpe_clk", 160000000},
+#else
+	{"vpe_clk", 200000000},
+#endif
 	{"vpe_pclk", -1},
 };
 
-int vpe_enable(uint32_t clk_rate, struct msm_cam_media_controller *mctl)
+int vpe_enable(uint32_t clk_rate)
 {
 	int rc = 0;
 	unsigned long flags = 0;
-	D("%s", __func__);
-	/* don't change the order of clock and irq.*/
+	CDBG("%s", __func__);
+	
 	spin_lock_irqsave(&vpe_ctrl->lock, flags);
+	pr_info("%s, vpe_ctrl->state %d\n", __func__, vpe_ctrl->state);
 	if (vpe_ctrl->state != VPE_STATE_IDLE) {
 		pr_err("%s: VPE already enabled", __func__);
 		spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
 		return 0;
 	}
 	vpe_ctrl->state = VPE_STATE_INIT;
+	vpe_ctrl->vpe_event_done = 0;
 	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
 	enable_irq(vpe_ctrl->vpeirq->start);
-
-	if (vpe_ctrl->fs_vpe) {
-		rc = regulator_enable(vpe_ctrl->fs_vpe);
-		if (rc) {
-			pr_err("%s: Regulator enable failed\n", __func__);
-			goto vpe_fs_failed;
-		}
+	vpe_ctrl->fs_vpe = regulator_get(NULL, "fs_vpe");
+	if (IS_ERR(vpe_ctrl->fs_vpe)) {
+		pr_err("%s: Regulator FS_VPE get failed %ld\n", __func__,
+			PTR_ERR(vpe_ctrl->fs_vpe));
+		vpe_ctrl->fs_vpe = NULL;
+		goto vpe_fs_failed;
+	} else if (regulator_enable(vpe_ctrl->fs_vpe)) {
+		pr_err("%s: Regulator FS_VPE enable failed\n", __func__);
+		regulator_put(vpe_ctrl->fs_vpe);
+		vpe_ctrl->fs_vpe = NULL;
+		goto vpe_fs_failed;
 	}
 
 	rc = msm_cam_clk_enable(&vpe_ctrl->pdev->dev, vpe_clk_info,
 			vpe_ctrl->vpe_clk, ARRAY_SIZE(vpe_clk_info), 1);
-	if (rc < 0)
+	if (rc < 0) {
+		pr_err("%s: VPE clk enable failed\n", __func__);
 		goto vpe_clk_failed;
+	}
 
-#ifdef CONFIG_MSM_IOMMU
-	rc = iommu_attach_device(mctl->domain, vpe_ctrl->iommu_ctx_src);
-	if (rc < 0) {
-		pr_err("%s: Device attach failed\n", __func__);
-		goto src_attach_failed;
-	}
-	rc = iommu_attach_device(mctl->domain, vpe_ctrl->iommu_ctx_dst);
-	if (rc < 0) {
-		pr_err("%s: Device attach failed\n", __func__);
-		goto dst_attach_failed;
-	}
-#endif
 	return rc;
 
-#ifdef CONFIG_MSM_IOMMU
-dst_attach_failed:
-	iommu_detach_device(mctl->domain, vpe_ctrl->iommu_ctx_src);
-src_attach_failed:
-#endif
-	msm_cam_clk_enable(&vpe_ctrl->pdev->dev, vpe_clk_info,
-		vpe_ctrl->vpe_clk, ARRAY_SIZE(vpe_clk_info), 0);
 vpe_clk_failed:
-	if (vpe_ctrl->fs_vpe)
-		regulator_disable(vpe_ctrl->fs_vpe);
+	regulator_disable(vpe_ctrl->fs_vpe);
+	regulator_put(vpe_ctrl->fs_vpe);
+	vpe_ctrl->fs_vpe = NULL;
 vpe_fs_failed:
 	disable_irq(vpe_ctrl->vpeirq->start);
 	vpe_ctrl->state = VPE_STATE_IDLE;
 	return rc;
 }
 
-int vpe_disable(struct msm_cam_media_controller *mctl)
+int vpe_disable(void)
 {
 	int rc = 0;
 	unsigned long flags = 0;
-	D("%s", __func__);
+	CDBG("%s", __func__);
 	spin_lock_irqsave(&vpe_ctrl->lock, flags);
+	pr_info("%s, vpe_ctrl->state %d\n", __func__, vpe_ctrl->state);
 	if (vpe_ctrl->state == VPE_STATE_IDLE) {
-		D("%s: VPE already disabled", __func__);
+		pr_info("%s: VPE already disabled", __func__);
 		spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
 		return rc;
 	}
 	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
-#ifdef CONFIG_MSM_IOMMU
-	iommu_detach_device(mctl->domain, vpe_ctrl->iommu_ctx_dst);
-	iommu_detach_device(mctl->domain, vpe_ctrl->iommu_ctx_src);
-#endif
+
+	rc = wait_event_interruptible_timeout(vpe_ctrl->vpe_event_queue,
+		vpe_ctrl->vpe_event_done, msecs_to_jiffies(500));
+
+	if (rc < 0)
+		pr_err("%s: wait vpe event error: %d\n", __func__, rc);
+	else if (rc == 0) {
+		
+		pr_info("%s: wait vpe event timeout", __func__);
+	} else
+		pr_info("%s: got vpe done event, rc %d\n", __func__, rc);
+	rc = 0;
+
 	disable_irq(vpe_ctrl->vpeirq->start);
 	tasklet_kill(&vpe_tasklet);
 	msm_cam_clk_enable(&vpe_ctrl->pdev->dev, vpe_clk_info,
 			vpe_ctrl->vpe_clk, ARRAY_SIZE(vpe_clk_info), 0);
 
 	regulator_disable(vpe_ctrl->fs_vpe);
+	regulator_put(vpe_ctrl->fs_vpe);
+	vpe_ctrl->fs_vpe = NULL;
 	spin_lock_irqsave(&vpe_ctrl->lock, flags);
 	vpe_ctrl->state = VPE_STATE_IDLE;
+	vpe_ctrl->vpe_event_done = 0;
 	spin_unlock_irqrestore(&vpe_ctrl->lock, flags);
 	return rc;
 }
 
-static int msm_vpe_do_pp(struct msm_mctl_pp_frame_info *pp_frame_info)
+static int msm_vpe_do_pp(struct msm_mctl_pp_cmd *cmd,
+			struct msm_mctl_pp_frame_info *pp_frame_info)
 {
 	int rc = 0;
 	unsigned long flags;
@@ -626,21 +554,21 @@
 	vpe_ctrl->pp_frame_info = pp_frame_info;
 	msm_vpe_cfg_update(
 		&vpe_ctrl->pp_frame_info->pp_frame_cmd.crop);
-	D("%s Sending frame idx %d id %d to VPE ", __func__,
-		pp_frame_info->src_frame.frame.buf_idx,
-		pp_frame_info->src_frame.frame.frame_id);
+	CDBG("%s Sending frame idx %d id %d to VPE ", __func__,
+		pp_frame_info->src_frame.buf_idx,
+		pp_frame_info->src_frame.frame_id);
 	rc = msm_send_frame_to_vpe();
 	return rc;
 }
 
+
 static int msm_vpe_resource_init(void);
 
-int msm_vpe_subdev_init(struct v4l2_subdev *sd)
+int msm_vpe_subdev_init(struct v4l2_subdev *sd,
+		struct msm_cam_media_controller *mctl)
 {
 	int rc = 0;
-	struct msm_cam_media_controller *mctl;
-	mctl = v4l2_get_subdev_hostdata(sd);
-	D("%s:begin", __func__);
+	CDBG("%s:begin", __func__);
 	if (atomic_read(&vpe_init_done)) {
 		pr_err("%s: VPE has been initialized", __func__);
 		return -EBUSY;
@@ -652,8 +580,9 @@
 		atomic_set(&vpe_init_done, 0);
 		return rc;
 	}
+	v4l2_set_subdev_hostdata(sd, mctl);
 	spin_lock_init(&vpe_ctrl->lock);
-	D("%s:end", __func__);
+	CDBG("%s:end", __func__);
 	return rc;
 }
 EXPORT_SYMBOL(msm_vpe_subdev_init);
@@ -672,370 +601,106 @@
 	}
 
 	return rc;
-/* from this part it is error handling. */
 vpe_unmap_mem_region:
 	iounmap(vpe_ctrl->vpebase);
 	vpe_ctrl->vpebase = NULL;
-	return rc;  /* this rc should have error code. */
+	return rc;  
 }
 
-void msm_vpe_subdev_release(struct v4l2_subdev *sd)
+void msm_vpe_subdev_release(void)
 {
-	struct msm_cam_media_controller *mctl;
-	mctl = v4l2_get_subdev_hostdata(sd);
 	if (!atomic_read(&vpe_init_done)) {
-		/* no VPE object created */
+		
 		pr_err("%s: no VPE object to release", __func__);
 		return;
 	}
 	vpe_reset();
-	vpe_disable(mctl);
+	vpe_disable();
 	iounmap(vpe_ctrl->vpebase);
 	vpe_ctrl->vpebase = NULL;
 	atomic_set(&vpe_init_done, 0);
 }
 EXPORT_SYMBOL(msm_vpe_subdev_release);
 
-static int msm_vpe_process_vpe_cmd(struct msm_vpe_cfg_cmd *vpe_cmd,
-				struct msm_cam_media_controller *mctl)
-{
-	int rc = 0;
-
-	switch (vpe_cmd->cmd_type) {
-	case VPE_CMD_RESET:
-		rc = vpe_reset();
-		break;
-
-	case VPE_CMD_OPERATION_MODE_CFG: {
-		struct msm_vpe_op_mode_cfg op_mode_cfg;
-		if (sizeof(struct msm_vpe_op_mode_cfg) != vpe_cmd->length) {
-			pr_err("%s: size mismatch cmd=%d, len=%d, expected=%d",
-				__func__, vpe_cmd->cmd_type, vpe_cmd->length,
-				sizeof(struct msm_vpe_op_mode_cfg));
-			rc = -EINVAL;
-			break;
-		}
-		COPY_FROM_USER(rc, &op_mode_cfg, (void __user *)vpe_cmd->value,
-			sizeof(op_mode_cfg));
-		if (rc) {
-			ERR_COPY_FROM_USER();
-			break;
-		}
-
-		vpe_cmd->value = (void *)&op_mode_cfg;
-		rc = vpe_operation_config(vpe_cmd->value);
-		break;
-		}
-
-	case VPE_CMD_INPUT_PLANE_CFG: {
-		struct msm_vpe_input_plane_cfg input_cfg;
-		if (sizeof(struct msm_vpe_input_plane_cfg) != vpe_cmd->length) {
-			pr_err("%s: mismatch cmd = %d, len = %d, expected = %d",
-				__func__, vpe_cmd->cmd_type, vpe_cmd->length,
-				sizeof(struct msm_vpe_input_plane_cfg));
-			rc = -EINVAL;
-			break;
-		}
-		COPY_FROM_USER(rc, &input_cfg, (void __user *)vpe_cmd->value,
-			sizeof(input_cfg));
-		if (rc) {
-			ERR_COPY_FROM_USER();
-			break;
-		}
-
-		vpe_cmd->value = (void *)&input_cfg;
-		vpe_input_plane_config(vpe_cmd->value);
-		break;
-		}
-
-	case VPE_CMD_OUTPUT_PLANE_CFG: {
-		struct msm_vpe_output_plane_cfg output_cfg;
-		if (sizeof(struct msm_vpe_output_plane_cfg) !=
-			vpe_cmd->length) {
-			pr_err("%s: size mismatch cmd=%d, len=%d, expected=%d",
-				__func__, vpe_cmd->cmd_type, vpe_cmd->length,
-				sizeof(struct msm_vpe_output_plane_cfg));
-				rc = -EINVAL;
-				break;
-		}
-		COPY_FROM_USER(rc, &output_cfg, (void __user *)vpe_cmd->value,
-			sizeof(output_cfg));
-		if (rc) {
-			ERR_COPY_FROM_USER();
-			break;
-		}
-
-		vpe_cmd->value = (void *)&output_cfg;
-		vpe_output_plane_config(vpe_cmd->value);
-		break;
-		}
-
-	case VPE_CMD_SCALE_CFG_TYPE:{
-		struct msm_vpe_scaler_cfg scaler_cfg;
-		if (sizeof(struct msm_vpe_scaler_cfg) != vpe_cmd->length) {
-			pr_err("%s: size mismatch cmd=%d, len=%d, expected=%d",
-				__func__, vpe_cmd->cmd_type, vpe_cmd->length,
-				sizeof(struct msm_vpe_scaler_cfg));
-			rc = -EINVAL;
-			break;
-		}
-		COPY_FROM_USER(rc, &scaler_cfg, (void __user *)vpe_cmd->value,
-			sizeof(scaler_cfg));
-		if (rc) {
-			ERR_COPY_FROM_USER();
-			break;
-		}
-
-		vpe_cmd->value = (void *)&scaler_cfg;
-		vpe_update_scale_coef(vpe_cmd->value);
-		break;
-		}
-
-	case VPE_CMD_ZOOM: {
-		struct msm_mctl_pp_frame_info *zoom;
-		zoom = kmalloc(sizeof(struct msm_mctl_pp_frame_info),
-				GFP_ATOMIC);
-		if (!zoom) {
-			pr_err("%s Not enough memory ", __func__);
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (sizeof(zoom->pp_frame_cmd) != vpe_cmd->length) {
-			pr_err("%s: size mismatch id=%d, len=%d, expected=%d",
-				__func__, vpe_cmd->cmd_type, vpe_cmd->length,
-				sizeof(zoom->pp_frame_cmd));
-			rc = -EINVAL;
-			kfree(zoom);
-			break;
-		}
-		COPY_FROM_USER(rc, &zoom->pp_frame_cmd,
-			(void __user *)vpe_cmd->value,
-			sizeof(zoom->pp_frame_cmd));
-		if (rc) {
-			ERR_COPY_FROM_USER();
-			kfree(zoom);
-			break;
-		}
-
-		zoom->user_cmd = vpe_cmd->cmd_type;
-		zoom->p_mctl = v4l2_get_subdev_hostdata(&vpe_ctrl->subdev);
-		D("%s: cookie=0x%x,action=0x%x,path=0x%x",
-			__func__, zoom->pp_frame_cmd.cookie,
-			zoom->pp_frame_cmd.vpe_output_action,
-			zoom->pp_frame_cmd.path);
-
-		D("%s Mapping Source frame ", __func__);
-		zoom->src_frame.frame = zoom->pp_frame_cmd.src_frame;
-		rc = msm_mctl_map_user_frame(&zoom->src_frame,
-			zoom->p_mctl->client, mctl->domain_num);
-		if (rc < 0) {
-			pr_err("%s Error mapping source buffer rc = %d",
-				__func__, rc);
-			kfree(zoom);
-			break;
-		}
-
-		D("%s Mapping Destination frame ", __func__);
-		zoom->dest_frame.frame = zoom->pp_frame_cmd.dest_frame;
-		rc = msm_mctl_map_user_frame(&zoom->dest_frame,
-			zoom->p_mctl->client, mctl->domain_num);
-		if (rc < 0) {
-			pr_err("%s Error mapping dest buffer rc = %d",
-				__func__, rc);
-			msm_mctl_unmap_user_frame(&zoom->src_frame,
-				zoom->p_mctl->client, mctl->domain_num);
-			kfree(zoom);
-			break;
-		}
-
-		rc = msm_vpe_do_pp(zoom);
-		break;
-		}
-
-	case VPE_CMD_ENABLE: {
-		struct msm_vpe_clock_rate clk_rate;
-		int turbo_mode;
-		if (sizeof(struct msm_vpe_clock_rate) != vpe_cmd->length) {
-			pr_err("%s: size mismatch cmd=%d, len=%d, expected=%d",
-				__func__, vpe_cmd->cmd_type, vpe_cmd->length,
-				sizeof(struct msm_vpe_clock_rate));
-			rc = -EINVAL;
-			break;
-		}
-		if (copy_from_user(&clk_rate, (void __user *)vpe_cmd->value,
-			sizeof(struct msm_vpe_clock_rate))) {
-			pr_err("%s:clk_rate copy failed", __func__);
-			return -EFAULT;
-		}
-		turbo_mode = (int)clk_rate.rate;
-		rc = turbo_mode ? vpe_enable(VPE_TURBO_MODE_CLOCK_RATE, mctl) :
-				vpe_enable(VPE_NORMAL_MODE_CLOCK_RATE, mctl);
-		break;
-		}
-
-	case VPE_CMD_DISABLE:
-		rc = vpe_disable(mctl);
-		break;
-
-	default:
-		break;
-	}
-
-	return rc;
-}
-
 static long msm_vpe_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int cmd, void *arg)
+			unsigned int subdev_cmd, void *arg)
 {
-	struct msm_vpe_cfg_cmd *vpe_cmd;
+	struct msm_mctl_pp_params *vpe_params;
+	struct msm_mctl_pp_cmd *cmd;
 	int rc = 0;
-	struct msm_cam_media_controller *mctl;
-	mctl = v4l2_get_subdev_hostdata(sd);
-	switch (cmd) {
-	case VIDIOC_MSM_VPE_INIT: {
-		msm_vpe_subdev_init(sd);
-		break;
-		}
 
-	case VIDIOC_MSM_VPE_RELEASE:
-		msm_vpe_subdev_release(sd);
-		break;
-
-	case MSM_CAM_V4L2_IOCTL_CFG_VPE: {
-		vpe_cmd = (struct msm_vpe_cfg_cmd *)arg;
-		rc = msm_vpe_process_vpe_cmd(vpe_cmd, mctl);
-		if (rc < 0) {
-			pr_err("%s Error processing VPE cmd %d ",
-				__func__, vpe_cmd->cmd_type);
+	if (subdev_cmd == VIDIOC_MSM_VPE_INIT) {
+		struct msm_cam_media_controller *mctl =
+			(struct msm_cam_media_controller *)arg;
+		msm_vpe_subdev_init(sd, mctl);
+	} else if (subdev_cmd == VIDIOC_MSM_VPE_RELEASE) {
+		msm_vpe_subdev_release();
+	} else if (subdev_cmd == VIDIOC_MSM_VPE_CFG) {
+		vpe_params = (struct msm_mctl_pp_params *)arg;
+		cmd = vpe_params->cmd;
+		switch (cmd->id) {
+		case VPE_CMD_INIT:
+		case VPE_CMD_DEINIT:
+			break;
+		case VPE_CMD_RESET:
+			rc = vpe_reset();
+			break;
+		case VPE_CMD_OPERATION_MODE_CFG:
+			rc = vpe_operation_config(cmd->value);
+			break;
+		case VPE_CMD_INPUT_PLANE_CFG:
+			vpe_input_plane_config(cmd->value);
+			break;
+		case VPE_CMD_OUTPUT_PLANE_CFG:
+			vpe_output_plane_config(cmd->value);
+			break;
+		case VPE_CMD_SCALE_CFG_TYPE:
+			vpe_update_scale_coef(cmd->value);
+			break;
+		case VPE_CMD_ZOOM: {
+			rc = msm_vpe_do_pp(cmd,
+			(struct msm_mctl_pp_frame_info *)vpe_params->data);
 			break;
 		}
-		break;
+		case VPE_CMD_ENABLE: {
+			struct msm_vpe_clock_rate *clk_rate = cmd->value;
+			int turbo_mode = (int)clk_rate->rate;
+			rc = turbo_mode ?
+				vpe_enable(VPE_TURBO_MODE_CLOCK_RATE) :
+				vpe_enable(VPE_NORMAL_MODE_CLOCK_RATE);
+			break;
 		}
-
-	case MSM_CAM_V4L2_IOCTL_GET_EVENT_PAYLOAD: {
-		struct msm_device_queue *queue = &vpe_ctrl->eventData_q;
-		struct msm_queue_cmd *event_qcmd;
-		struct msm_mctl_pp_event_info pp_event_info;
-		struct msm_mctl_pp_frame_info *pp_frame_info;
-		struct msm_camera_v4l2_ioctl_t *v4l2_ioctl = arg;
-
-		event_qcmd = msm_dequeue(queue, list_eventdata);
-		if (!event_qcmd) {
-			pr_err("%s No events in the queue", __func__);
-			return -EFAULT;
+		case VPE_CMD_DISABLE:
+			rc = vpe_disable();
+			break;
+		case VPE_CMD_INPUT_PLANE_UPDATE:
+		case VPE_CMD_FLUSH:
+		default:
+			break;
 		}
-		pp_frame_info = event_qcmd->command;
-
-		D("%s Unmapping source and destination buffers ",
-			__func__);
-		msm_mctl_unmap_user_frame(&pp_frame_info->src_frame,
-			pp_frame_info->p_mctl->client, mctl->domain_num);
-		msm_mctl_unmap_user_frame(&pp_frame_info->dest_frame,
-			pp_frame_info->p_mctl->client, mctl->domain_num);
-
-		pp_event_info.event = MCTL_PP_EVENT_CMD_ACK;
-		pp_event_info.ack.cmd = pp_frame_info->user_cmd;
-		pp_event_info.ack.status = 0;
-		pp_event_info.ack.cookie = pp_frame_info->pp_frame_cmd.cookie;
-		D("%s Sending payload %d %d %d", __func__,
-			pp_event_info.ack.cmd, pp_event_info.ack.status,
-			pp_event_info.ack.cookie);
-		if (copy_to_user((void __user *)v4l2_ioctl->ioctl_ptr,
-			&pp_event_info,	sizeof(struct msm_mctl_pp_event_info)))
-			pr_err("%s PAYLOAD Copy to user failed ", __func__);
-
-		kfree(pp_frame_info);
-		kfree(event_qcmd);
-		break;
-		}
-
-	default:
-		break;
+		CDBG("%s: end, id = %d, rc = %d", __func__, cmd->id, rc);
 	}
 	return rc;
 }
 
-int msm_vpe_subdev_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
-	struct v4l2_event_subscription *sub)
-{
-	D("%s E\n", __func__);
-	return v4l2_event_subscribe(fh, sub, VPE_SUBDEV_MAX_EVENTS);
-}
-
-int msm_vpe_subdev_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
-	struct v4l2_event_subscription *sub)
-{
-	D("%s E\n", __func__);
-	return v4l2_event_unsubscribe(fh, sub);
-}
-
 static const struct v4l2_subdev_core_ops msm_vpe_subdev_core_ops = {
 	.ioctl = msm_vpe_subdev_ioctl,
-	.subscribe_event = msm_vpe_subdev_subscribe_event,
-	.unsubscribe_event = msm_vpe_subdev_unsubscribe_event,
 };
 
 static const struct v4l2_subdev_ops msm_vpe_subdev_ops = {
 	.core = &msm_vpe_subdev_core_ops,
 };
 
-static int msm_vpe_subdev_open(struct v4l2_subdev *sd,
-	struct v4l2_subdev_fh *fh)
-{
-	struct vpe_ctrl_type *vpe_ctrl = v4l2_get_subdevdata(sd);
-	/* Only one client of VPE allowed. */
-	if (atomic_read(&vpe_ctrl->active) != 0) {
-		pr_err("%s already opened\n", __func__);
-		return -EINVAL;
-	}
 
-	D("%s E ", __func__);
-	atomic_inc(&vpe_ctrl->active);
-	return 0;
-}
+static const struct v4l2_subdev_internal_ops msm_vpe_internal_ops;
 
-static int msm_vpe_subdev_close(struct v4l2_subdev *sd,
-	struct v4l2_subdev_fh *fh)
-{
-	struct vpe_ctrl_type *vpe_ctrl = v4l2_get_subdevdata(sd);
-	struct msm_mctl_pp_frame_info *frame_info = vpe_ctrl->pp_frame_info;
-	struct msm_cam_media_controller *mctl;
-	mctl = v4l2_get_subdev_hostdata(sd);
-	if (atomic_read(&vpe_ctrl->active) == 0) {
-		pr_err("%s already closed\n", __func__);
-		return -EINVAL;
-	}
-
-	D("%s E ", __func__);
-	if (frame_info) {
-		D("%s Unmap the pending item from the queue ", __func__);
-		msm_mctl_unmap_user_frame(&frame_info->src_frame,
-			frame_info->p_mctl->client, mctl->domain_num);
-		msm_mctl_unmap_user_frame(&frame_info->dest_frame,
-			frame_info->p_mctl->client, mctl->domain_num);
-	}
-	vpe_ctrl->pp_frame_info = NULL;
-	/* Drain the payload queue. */
-	msm_queue_drain(&vpe_ctrl->eventData_q, list_eventdata);
-	atomic_dec(&vpe_ctrl->active);
-	return 0;
-}
-
-static const struct v4l2_subdev_internal_ops msm_vpe_internal_ops = {
-	.open = msm_vpe_subdev_open,
-	.close = msm_vpe_subdev_close,
-};
-
-static int __devinit msm_vpe_probe(struct platform_device *pdev)
+static int __devinit vpe_probe(struct platform_device *pdev)
 {
 	int rc = 0;
-	struct msm_cam_subdev_info sd_info;
-
-	D("%s: device id = %d\n", __func__, pdev->id);
+	CDBG("%s: device id = %d\n", __func__, pdev->id);
 	vpe_ctrl = kzalloc(sizeof(struct vpe_ctrl_type), GFP_KERNEL);
 	if (!vpe_ctrl) {
-		pr_err("%s: not enough memory\n", __func__);
+		pr_err("%s: no enough memory\n", __func__);
 		return -ENOMEM;
 	}
 
@@ -1046,13 +711,6 @@
 	snprintf(vpe_ctrl->subdev.name, sizeof(vpe_ctrl->subdev.name), "vpe");
 	platform_set_drvdata(pdev, &vpe_ctrl->subdev);
 
-	media_entity_init(&vpe_ctrl->subdev.entity, 0, NULL, 0);
-	vpe_ctrl->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	vpe_ctrl->subdev.entity.group_id = VPE_DEV;
-	vpe_ctrl->subdev.entity.name = vpe_ctrl->subdev.name;
-
-	vpe_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_EVENTS;
-
 	vpe_ctrl->vpemem = platform_get_resource_byname(pdev,
 					IORESOURCE_MEM, "vpe");
 	if (!vpe_ctrl->vpemem) {
@@ -1086,47 +744,22 @@
 		goto vpe_no_resource;
 	}
 
-	vpe_ctrl->fs_vpe = regulator_get(&pdev->dev, "vdd");
-	if (IS_ERR(vpe_ctrl->fs_vpe)) {
-		pr_err("%s: Regulator FS_VPE get failed %ld\n", __func__,
-			PTR_ERR(vpe_ctrl->fs_vpe));
-		vpe_ctrl->fs_vpe = NULL;
-	}
-
 	disable_irq(vpe_ctrl->vpeirq->start);
 
-#ifdef CONFIG_MSM_IOMMU
-	/*get device context for IOMMU*/
-	vpe_ctrl->iommu_ctx_src = msm_iommu_get_ctx("vpe_src"); /*re-confirm*/
-	vpe_ctrl->iommu_ctx_dst = msm_iommu_get_ctx("vpe_dst"); /*re-confirm*/
-	if (!vpe_ctrl->iommu_ctx_src || !vpe_ctrl->iommu_ctx_dst) {
-		release_mem_region(vpe_ctrl->vpemem->start,
-			resource_size(vpe_ctrl->vpemem));
-		pr_err("%s: No iommu fw context found\n", __func__);
-		rc = -ENODEV;
-		goto vpe_no_resource;
-	}
-#endif
+	vpe_ctrl->pdev = pdev;	
+	msm_cam_register_subdev_node(&vpe_ctrl->subdev, VPE_DEV, pdev->id);
 
-	atomic_set(&vpe_ctrl->active, 0);
-	vpe_ctrl->pdev = pdev;
-	sd_info.sdev_type = VPE_DEV;
-	sd_info.sd_index = pdev->id;
-	sd_info.irq_num = vpe_ctrl->vpeirq->start;
-	msm_cam_register_subdev_node(&vpe_ctrl->subdev, &sd_info);
-	vpe_ctrl->subdev.entity.revision = vpe_ctrl->subdev.devnode->num;
-	msm_queue_init(&vpe_ctrl->eventData_q, "ackevents");
+	init_waitqueue_head(&vpe_ctrl->vpe_event_queue);
 
 	return 0;
 
 vpe_no_resource:
-	pr_err("%s: VPE Probe failed.\n", __func__);
 	kfree(vpe_ctrl);
-	return rc;
+	return 0;
 }
 
-struct platform_driver msm_vpe_driver = {
-	.probe = msm_vpe_probe,
+struct platform_driver vpe_driver = {
+	.probe = vpe_probe,
 	.driver = {
 		.name = MSM_VPE_DRV_NAME,
 		.owner = THIS_MODULE,
@@ -1135,15 +768,9 @@
 
 static int __init msm_vpe_init_module(void)
 {
-	return platform_driver_register(&msm_vpe_driver);
-}
-
-static void __exit msm_vpe_exit_module(void)
-{
-	platform_driver_unregister(&msm_vpe_driver);
+	return platform_driver_register(&vpe_driver);
 }
 
 module_init(msm_vpe_init_module);
-module_exit(msm_vpe_exit_module);
 MODULE_DESCRIPTION("VPE driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/msm_vpe.h b/drivers/media/video/msm/msm_vpe.h
index 6b89bf0..96f2bdf 100644
--- a/drivers/media/video/msm/msm_vpe.h
+++ b/drivers/media/video/msm/msm_vpe.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -16,7 +16,6 @@
 
 #include <mach/camera.h>
 
-/***********  start of register offset *********************/
 #define VPE_INTR_ENABLE_OFFSET                0x0020
 #define VPE_INTR_STATUS_OFFSET                0x0024
 #define VPE_INTR_CLEAR_OFFSET                 0x0028
@@ -63,15 +62,15 @@
 #define VPE_AXI_ARB_1_OFFSET                  0x00408
 #define VPE_AXI_ARB_2_OFFSET                  0x0040C
 
+
 #define VPE_SCALE_COEFF_LSBn(n)	(0x50400 + 8 * (n))
 #define VPE_SCALE_COEFF_MSBn(n)	(0x50404 + 8 * (n))
 #define VPE_SCALE_COEFF_NUM			32
 
-/*********** end of register offset ********************/
 
 
 #define VPE_HARDWARE_VERSION          0x00080308
-#define VPE_SW_RESET_VALUE            0x00000010  /* bit 4 for PPP*/
+#define VPE_SW_RESET_VALUE            0x00000010  
 #define VPE_AXI_RD_ARB_CONFIG_VALUE   0x124924
 #define VPE_CMD_MODE_VALUE            0x1
 #define VPE_DEFAULT_OP_MODE_VALUE     0x40FC0004
@@ -79,12 +78,9 @@
 #define VPE_DEFAULT_SCALE_CONFIG      0x3c
 
 #define VPE_NORMAL_MODE_CLOCK_RATE   150000000
-#define VPE_TURBO_MODE_CLOCK_RATE    200000000
-#define VPE_SUBDEV_MAX_EVENTS        30
+#define VPE_TURBO_MODE_CLOCK_RATE   200000000
 
-/**************************************************/
-/*********** End of command id ********************/
-/**************************************************/
+
 
 enum vpe_state {
 	VPE_STATE_IDLE,
@@ -100,8 +96,8 @@
 	void              *extdata;
 	uint32_t          extlen;
 	struct msm_vpe_callback *resp;
-	uint32_t          out_h;  /* this is BEFORE rotation. */
-	uint32_t          out_w;  /* this is BEFORE rotation. */
+	uint32_t          out_h;  
+	uint32_t          out_w;  
 	struct timespec   ts;
 	int               output_type;
 	int               frame_pack;
@@ -119,18 +115,10 @@
 	struct regulator *fs_vpe;
 	struct clk	*vpe_clk[2];
 	struct msm_mctl_pp_frame_info *pp_frame_info;
-	atomic_t active;
-	struct msm_device_queue eventData_q; /*V4L2 Event Payload Queue*/
-	struct device *iommu_ctx_src;
-	struct device *iommu_ctx_dst;
+	wait_queue_head_t vpe_event_queue;
+	int               vpe_event_done;
 };
 
-/*
-* vpe_input_update
-*
-* Define the parameters for output plane
-*/
-/* this is the dimension of ROI.  width / height. */
 struct vpe_src_size_packed {
 	uint32_t        src_w;
 	uint32_t        src_h;
@@ -143,9 +131,9 @@
 
 struct vpe_input_plane_update_type {
 	struct vpe_src_size_packed             src_roi_size;
-	/* crop updates this set. */
+	
 	struct vpe_src_xy_packed               src_roi_offset;
-	/* input address*/
+	
 	uint8_t                         *src_p0_addr;
 	uint8_t                         *src_p1_addr;
 };
@@ -182,5 +170,15 @@
 	int32_t phase_step_y;
 };
 
-#endif /*_MSM_VPE_H_*/
+#define VIDIOC_MSM_VPE_INIT \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 15, struct msm_cam_media_controller *)
+
+#define VIDIOC_MSM_VPE_RELEASE \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 16, struct msm_cam_media_controller *)
+
+#define VIDIOC_MSM_VPE_CFG \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 17, struct msm_mctl_pp_params *)
+ 
+
+#endif 
 
diff --git a/drivers/media/video/msm/msm_vpe1.c b/drivers/media/video/msm/msm_vpe1.c
deleted file mode 100644
index 948f7ac..0000000
--- a/drivers/media/video/msm/msm_vpe1.c
+++ /dev/null
@@ -1,1469 +0,0 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/uaccess.h>
-#include <linux/interrupt.h>
-#include <mach/irqs.h>
-#include <linux/io.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include "msm_vpe1.h"
-#include <linux/pm_qos.h>
-#include <linux/clk.h>
-#include <mach/clk.h>
-#include <asm/div64.h>
-
-static int vpe_enable(uint32_t);
-static int vpe_disable(void);
-static int vpe_update_scaler(struct video_crop_t *pcrop);
-static struct vpe_device_type  vpe_device_data;
-static struct vpe_device_type  *vpe_device;
-struct vpe_ctrl_type    *vpe_ctrl;
-char *vpe_general_cmd[] = {
-	"VPE_DUMMY_0",  /* 0 */
-	"VPE_SET_CLK",
-	"VPE_RESET",
-	"VPE_START",
-	"VPE_ABORT",
-	"VPE_OPERATION_MODE_CFG",  /* 5 */
-	"VPE_INPUT_PLANE_CFG",
-	"VPE_OUTPUT_PLANE_CFG",
-	"VPE_INPUT_PLANE_UPDATE",
-	"VPE_SCALE_CFG_TYPE",
-	"VPE_ROTATION_CFG_TYPE",  /* 10 */
-	"VPE_AXI_OUT_CFG",
-	"VPE_CMD_DIS_OFFSET_CFG",
-	"VPE_ENABLE",
-	"VPE_DISABLE",
-};
-static uint32_t orig_src_y, orig_src_cbcr;
-
-#define CHECKED_COPY_FROM_USER(in) {					\
-	if (copy_from_user((in), (void __user *)cmd->value,		\
-			cmd->length)) {					\
-		rc = -EFAULT;						\
-		break;							\
-	}								\
-}
-
-#define msm_dequeue_vpe(queue, member) ({			\
-	unsigned long flags;					\
-	struct msm_device_queue *__q = (queue);			\
-	struct msm_queue_cmd *qcmd = 0;				\
-	spin_lock_irqsave(&__q->lock, flags);			\
-	if (!list_empty(&__q->list)) {				\
-		__q->len--;					\
-		qcmd = list_first_entry(&__q->list,		\
-				struct msm_queue_cmd, member);	\
-		list_del_init(&qcmd->member);			\
-	}							\
-	spin_unlock_irqrestore(&__q->lock, flags);		\
-	qcmd;							\
-})
-
-/*
-static   struct vpe_cmd_type vpe_cmd[] = {
-		{VPE_DUMMY_0, 0},
-		{VPE_SET_CLK, 0},
-		{VPE_RESET, 0},
-		{VPE_START, 0},
-		{VPE_ABORT, 0},
-		{VPE_OPERATION_MODE_CFG, VPE_OPERATION_MODE_CFG_LEN},
-		{VPE_INPUT_PLANE_CFG, VPE_INPUT_PLANE_CFG_LEN},
-		{VPE_OUTPUT_PLANE_CFG, VPE_OUTPUT_PLANE_CFG_LEN},
-		{VPE_INPUT_PLANE_UPDATE, VPE_INPUT_PLANE_UPDATE_LEN},
-		{VPE_SCALE_CFG_TYPE, VPE_SCALER_CONFIG_LEN},
-		{VPE_ROTATION_CFG_TYPE, 0},
-		{VPE_AXI_OUT_CFG, 0},
-		{VPE_CMD_DIS_OFFSET_CFG, VPE_DIS_OFFSET_CFG_LEN},
-};
-*/
-
-static long long vpe_do_div(long long num, long long den)
-{
-	do_div(num, den);
-	return num;
-}
-
-static int vpe_start(void)
-{
-	/*  enable the frame irq, bit 0 = Display list 0 ROI done */
-	msm_camera_io_w(1, vpe_device->vpebase + VPE_INTR_ENABLE_OFFSET);
-	msm_camera_io_dump(vpe_device->vpebase + 0x10000, 0x250);
-	/* this triggers the operation. */
-	msm_camera_io_w(1, vpe_device->vpebase + VPE_DL0_START_OFFSET);
-
-	return 0;
-}
-
-void vpe_reset_state_variables(void)
-{
-	/* initialize local variables for state control, etc.*/
-	vpe_ctrl->op_mode = 0;
-	vpe_ctrl->state = VPE_STATE_INIT;
-	spin_lock_init(&vpe_ctrl->tasklet_lock);
-	spin_lock_init(&vpe_ctrl->state_lock);
-	INIT_LIST_HEAD(&vpe_ctrl->tasklet_q);
-}
-
-static void vpe_config_axi_default(void)
-{
-	msm_camera_io_w(0x25, vpe_device->vpebase + VPE_AXI_ARB_2_OFFSET);
-
-	CDBG("%s: yaddr %ld cbcraddr %ld", __func__,
-		 vpe_ctrl->out_y_addr, vpe_ctrl->out_cbcr_addr);
-
-	if (!vpe_ctrl->out_y_addr || !vpe_ctrl->out_cbcr_addr)
-		return;
-
-	msm_camera_io_w(vpe_ctrl->out_y_addr,
-		vpe_device->vpebase + VPE_OUTP0_ADDR_OFFSET);
-	/* for video  CbCr address */
-	msm_camera_io_w(vpe_ctrl->out_cbcr_addr,
-		vpe_device->vpebase + VPE_OUTP1_ADDR_OFFSET);
-
-}
-
-static int vpe_reset(void)
-{
-	uint32_t vpe_version;
-	uint32_t rc;
-
-	vpe_reset_state_variables();
-	vpe_version = msm_camera_io_r(
-			vpe_device->vpebase + VPE_HW_VERSION_OFFSET);
-	CDBG("vpe_version = 0x%x\n", vpe_version);
-
-	/* disable all interrupts.*/
-	msm_camera_io_w(0, vpe_device->vpebase + VPE_INTR_ENABLE_OFFSET);
-	/* clear all pending interrupts*/
-	msm_camera_io_w(0x1fffff, vpe_device->vpebase + VPE_INTR_CLEAR_OFFSET);
-
-	/* write sw_reset to reset the core. */
-	msm_camera_io_w(0x10, vpe_device->vpebase + VPE_SW_RESET_OFFSET);
-
-	/* then poll the reset bit, it should be self-cleared. */
-	while (1) {
-		rc = msm_camera_io_r(vpe_device->vpebase + VPE_SW_RESET_OFFSET)
-				& 0x10;
-		if (rc == 0)
-			break;
-	}
-
-	/*  at this point, hardware is reset. Then pogram to default
-		values. */
-	msm_camera_io_w(VPE_AXI_RD_ARB_CONFIG_VALUE,
-			vpe_device->vpebase + VPE_AXI_RD_ARB_CONFIG_OFFSET);
-
-	msm_camera_io_w(VPE_CGC_ENABLE_VALUE,
-			vpe_device->vpebase + VPE_CGC_EN_OFFSET);
-
-	msm_camera_io_w(1, vpe_device->vpebase + VPE_CMD_MODE_OFFSET);
-
-	msm_camera_io_w(VPE_DEFAULT_OP_MODE_VALUE,
-			vpe_device->vpebase + VPE_OP_MODE_OFFSET);
-
-	msm_camera_io_w(VPE_DEFAULT_SCALE_CONFIG,
-			vpe_device->vpebase + VPE_SCALE_CONFIG_OFFSET);
-
-	vpe_config_axi_default();
-	return 0;
-}
-
-int msm_vpe_cfg_update(void *pinfo)
-{
-	uint32_t  rot_flag, rc = 0;
-	struct video_crop_t *pcrop = (struct video_crop_t *)pinfo;
-
-	rot_flag = msm_camera_io_r(vpe_device->vpebase +
-						VPE_OP_MODE_OFFSET) & 0xE00;
-	if (pinfo != NULL) {
-		CDBG("Crop info in2_w = %d, in2_h = %d "
-			"out2_h = %d out2_w = %d \n", pcrop->in2_w,
-			pcrop->in2_h,
-			pcrop->out2_h, pcrop->out2_w);
-		rc = vpe_update_scaler(pcrop);
-	}
-	CDBG("return rc = %d rot_flag = %d\n", rc, rot_flag);
-	rc |= rot_flag;
-
-	return rc;
-}
-
-void vpe_update_scale_coef(uint32_t *p)
-{
-	uint32_t i, offset;
-	offset = *p;
-	for (i = offset; i < (VPE_SCALE_COEFF_NUM + offset); i++) {
-		msm_camera_io_w(*(++p),
-			vpe_device->vpebase + VPE_SCALE_COEFF_LSBn(i));
-		msm_camera_io_w(*(++p),
-			vpe_device->vpebase + VPE_SCALE_COEFF_MSBn(i));
-	}
-}
-
-void vpe_input_plane_config(uint32_t *p)
-{
-	msm_camera_io_w(*p,
-		vpe_device->vpebase + VPE_SRC_FORMAT_OFFSET);
-	msm_camera_io_w(*(++p),
-		vpe_device->vpebase + VPE_SRC_UNPACK_PATTERN1_OFFSET);
-	msm_camera_io_w(*(++p),
-		vpe_device->vpebase + VPE_SRC_IMAGE_SIZE_OFFSET);
-	msm_camera_io_w(*(++p),
-		vpe_device->vpebase + VPE_SRC_YSTRIDE1_OFFSET);
-	msm_camera_io_w(*(++p),
-		vpe_device->vpebase + VPE_SRC_SIZE_OFFSET);
-	vpe_ctrl->in_h_w = *p;
-	msm_camera_io_w(*(++p),
-		vpe_device->vpebase + VPE_SRC_XY_OFFSET);
-}
-
-void vpe_output_plane_config(uint32_t *p)
-{
-	msm_camera_io_w(*p,
-		vpe_device->vpebase + VPE_OUT_FORMAT_OFFSET);
-	msm_camera_io_w(*(++p),
-		vpe_device->vpebase + VPE_OUT_PACK_PATTERN1_OFFSET);
-	msm_camera_io_w(*(++p),
-		vpe_device->vpebase + VPE_OUT_YSTRIDE1_OFFSET);
-	msm_camera_io_w(*(++p),
-		vpe_device->vpebase + VPE_OUT_SIZE_OFFSET);
-	msm_camera_io_w(*(++p),
-		vpe_device->vpebase + VPE_OUT_XY_OFFSET);
-	vpe_ctrl->pcbcr_dis_offset = *(++p);
-}
-
-static int vpe_operation_config(uint32_t *p)
-{
-	uint32_t  outw, outh, temp;
-	msm_camera_io_w(*p, vpe_device->vpebase + VPE_OP_MODE_OFFSET);
-
-	temp = msm_camera_io_r(vpe_device->vpebase + VPE_OUT_SIZE_OFFSET);
-	outw = temp & 0xFFF;
-	outh = (temp & 0xFFF0000) >> 16;
-
-	if (*p++ & 0xE00) {
-		/* rotation enabled. */
-		vpe_ctrl->out_w = outh;
-		vpe_ctrl->out_h = outw;
-	} else {
-		vpe_ctrl->out_w = outw;
-		vpe_ctrl->out_h = outh;
-	}
-	vpe_ctrl->dis_en = *p;
-	return 0;
-}
-
-/* Later we can separate the rotation and scaler calc. If
-*  rotation is enabled, simply swap the destination dimension.
-*  And then pass the already swapped output size to this
-*  function. */
-static int vpe_update_scaler(struct video_crop_t *pcrop)
-{
-	uint32_t out_ROI_width, out_ROI_height;
-	uint32_t src_ROI_width, src_ROI_height;
-
-	uint32_t rc = 0;  /* default to no zoom. */
-	/*
-	* phase_step_x, phase_step_y, phase_init_x and phase_init_y
-	* are represented in fixed-point, unsigned 3.29 format
-	*/
-	uint32_t phase_step_x = 0;
-	uint32_t phase_step_y = 0;
-	uint32_t phase_init_x = 0;
-	uint32_t phase_init_y = 0;
-
-	uint32_t src_roi, src_x, src_y, src_xy, temp;
-	uint32_t yscale_filter_sel, xscale_filter_sel;
-	uint32_t scale_unit_sel_x, scale_unit_sel_y;
-	uint64_t numerator, denominator;
-
-	if ((pcrop->in2_w >= pcrop->out2_w) &&
-		(pcrop->in2_h >= pcrop->out2_h)) {
-		CDBG(" =======VPE no zoom needed.\n");
-
-		temp = msm_camera_io_r(vpe_device->vpebase + VPE_OP_MODE_OFFSET)
-		& 0xfffffffc;
-		msm_camera_io_w(temp, vpe_device->vpebase + VPE_OP_MODE_OFFSET);
-
-
-		msm_camera_io_w(0, vpe_device->vpebase + VPE_SRC_XY_OFFSET);
-
-		CDBG("vpe_ctrl->in_h_w = %d\n", vpe_ctrl->in_h_w);
-		msm_camera_io_w(vpe_ctrl->in_h_w , vpe_device->vpebase +
-				VPE_SRC_SIZE_OFFSET);
-
-		return rc;
-	}
-	/* If fall through then scaler is needed.*/
-
-	CDBG("========VPE zoom needed.\n");
-	/* assumption is both direction need zoom. this can be
-	improved. */
-	temp =
-		msm_camera_io_r(vpe_device->vpebase + VPE_OP_MODE_OFFSET) | 0x3;
-	msm_camera_io_w(temp, vpe_device->vpebase + VPE_OP_MODE_OFFSET);
-
-	src_ROI_width = pcrop->in2_w;
-	src_ROI_height = pcrop->in2_h;
-	out_ROI_width = pcrop->out2_w;
-	out_ROI_height = pcrop->out2_h;
-
-	CDBG("src w = 0x%x, h=0x%x, dst w = 0x%x, h =0x%x.\n",
-		src_ROI_width, src_ROI_height, out_ROI_width,
-		out_ROI_height);
-	src_roi = (src_ROI_height << 16) + src_ROI_width;
-
-	msm_camera_io_w(src_roi, vpe_device->vpebase + VPE_SRC_SIZE_OFFSET);
-
-	src_x = (out_ROI_width - src_ROI_width)/2;
-	src_y = (out_ROI_height - src_ROI_height)/2;
-
-	CDBG("src_x = %d, src_y=%d.\n", src_x, src_y);
-
-	src_xy = src_y*(1<<16) + src_x;
-	msm_camera_io_w(src_xy, vpe_device->vpebase +
-			VPE_SRC_XY_OFFSET);
-	CDBG("src_xy = %d, src_roi=%d.\n", src_xy, src_roi);
-
-	/* decide whether to use FIR or M/N for scaling */
-	if ((out_ROI_width == 1 && src_ROI_width < 4) ||
-		(src_ROI_width < 4 * out_ROI_width - 3))
-		scale_unit_sel_x = 0;/* use FIR scalar */
-	else
-		scale_unit_sel_x = 1;/* use M/N scalar */
-
-	if ((out_ROI_height == 1 && src_ROI_height < 4) ||
-		(src_ROI_height < 4 * out_ROI_height - 3))
-		scale_unit_sel_y = 0;/* use FIR scalar */
-	else
-		scale_unit_sel_y = 1;/* use M/N scalar */
-
-	/* calculate phase step for the x direction */
-
-	/* if destination is only 1 pixel wide,
-	the value of phase_step_x
-	is unimportant. Assigning phase_step_x to
-	src ROI width as an arbitrary value. */
-	if (out_ROI_width == 1)
-		phase_step_x = (uint32_t) ((src_ROI_width) <<
-						SCALER_PHASE_BITS);
-
-		/* if using FIR scalar */
-	else if (scale_unit_sel_x == 0) {
-
-		/* Calculate the quotient ( src_ROI_width - 1 )
-		/ ( out_ROI_width - 1)
-		with u3.29 precision. Quotient is rounded up to
-		the larger 29th decimal point. */
-		numerator = (uint64_t)(src_ROI_width - 1) <<
-			SCALER_PHASE_BITS;
-		/* never equals to 0 because of the
-		"(out_ROI_width == 1 )"*/
-		denominator = (uint64_t)(out_ROI_width - 1);
-		/* divide and round up to the larger 29th
-		decimal point. */
-		phase_step_x = (uint32_t) vpe_do_div((numerator +
-					denominator - 1), denominator);
-	} else if (scale_unit_sel_x == 1) { /* if M/N scalar */
-		/* Calculate the quotient ( src_ROI_width ) /
-		( out_ROI_width)
-		with u3.29 precision. Quotient is rounded down to the
-		smaller 29th decimal point. */
-		numerator = (uint64_t)(src_ROI_width) <<
-			SCALER_PHASE_BITS;
-		denominator = (uint64_t)(out_ROI_width);
-		phase_step_x =
-			(uint32_t) vpe_do_div(numerator, denominator);
-	}
-	/* calculate phase step for the y direction */
-
-	/* if destination is only 1 pixel wide, the value of
-		phase_step_x is unimportant. Assigning phase_step_x
-		to src ROI width as an arbitrary value. */
-	if (out_ROI_height == 1)
-		phase_step_y =
-		(uint32_t) ((src_ROI_height) << SCALER_PHASE_BITS);
-
-	/* if FIR scalar */
-	else if (scale_unit_sel_y == 0) {
-		/* Calculate the quotient ( src_ROI_height - 1 ) /
-		( out_ROI_height - 1)
-		with u3.29 precision. Quotient is rounded up to the
-		larger 29th decimal point. */
-		numerator = (uint64_t)(src_ROI_height - 1) <<
-			SCALER_PHASE_BITS;
-		/* never equals to 0 because of the "
-		( out_ROI_height == 1 )" case */
-		denominator = (uint64_t)(out_ROI_height - 1);
-		/* Quotient is rounded up to the larger
-		29th decimal point. */
-		phase_step_y =
-		(uint32_t) vpe_do_div(
-			(numerator + denominator - 1), denominator);
-	} else if (scale_unit_sel_y == 1) { /* if M/N scalar */
-		/* Calculate the quotient ( src_ROI_height )
-		/ ( out_ROI_height)
-		with u3.29 precision. Quotient is rounded down
-		to the smaller 29th decimal point. */
-		numerator = (uint64_t)(src_ROI_height) <<
-			SCALER_PHASE_BITS;
-		denominator = (uint64_t)(out_ROI_height);
-		phase_step_y = (uint32_t) vpe_do_div(
-			numerator, denominator);
-	}
-
-	/* decide which set of FIR coefficients to use */
-	if (phase_step_x > HAL_MDP_PHASE_STEP_2P50)
-		xscale_filter_sel = 0;
-	else if (phase_step_x > HAL_MDP_PHASE_STEP_1P66)
-		xscale_filter_sel = 1;
-	else if (phase_step_x > HAL_MDP_PHASE_STEP_1P25)
-		xscale_filter_sel = 2;
-	else
-		xscale_filter_sel = 3;
-
-	if (phase_step_y > HAL_MDP_PHASE_STEP_2P50)
-		yscale_filter_sel = 0;
-	else if (phase_step_y > HAL_MDP_PHASE_STEP_1P66)
-		yscale_filter_sel = 1;
-	else if (phase_step_y > HAL_MDP_PHASE_STEP_1P25)
-		yscale_filter_sel = 2;
-	else
-		yscale_filter_sel = 3;
-
-	/* calculate phase init for the x direction */
-
-	/* if using FIR scalar */
-	if (scale_unit_sel_x == 0) {
-		if (out_ROI_width == 1)
-			phase_init_x =
-				(uint32_t) ((src_ROI_width - 1) <<
-							SCALER_PHASE_BITS);
-		else
-			phase_init_x = 0;
-	} else if (scale_unit_sel_x == 1) /* M over N scalar  */
-		phase_init_x = 0;
-
-	/* calculate phase init for the y direction
-	if using FIR scalar */
-	if (scale_unit_sel_y == 0) {
-		if (out_ROI_height == 1)
-			phase_init_y =
-			(uint32_t) ((src_ROI_height -
-						1) << SCALER_PHASE_BITS);
-		else
-			phase_init_y = 0;
-	} else if (scale_unit_sel_y == 1) /* M over N scalar   */
-		phase_init_y = 0;
-
-	CDBG("phase step x = %d, step y = %d.\n",
-		 phase_step_x, phase_step_y);
-	CDBG("phase init x = %d, init y = %d.\n",
-		 phase_init_x, phase_init_y);
-
-	msm_camera_io_w(phase_step_x, vpe_device->vpebase +
-			VPE_SCALE_PHASEX_STEP_OFFSET);
-	msm_camera_io_w(phase_step_y, vpe_device->vpebase +
-			VPE_SCALE_PHASEY_STEP_OFFSET);
-
-	msm_camera_io_w(phase_init_x, vpe_device->vpebase +
-			VPE_SCALE_PHASEX_INIT_OFFSET);
-
-	msm_camera_io_w(phase_init_y, vpe_device->vpebase +
-			VPE_SCALE_PHASEY_INIT_OFFSET);
-
-	return 1;
-}
-
-static int vpe_update_scaler_with_dis(struct video_crop_t *pcrop,
-				struct dis_offset_type *dis_offset)
-{
-	uint32_t out_ROI_width, out_ROI_height;
-	uint32_t src_ROI_width, src_ROI_height;
-
-	uint32_t rc = 0;  /* default to no zoom. */
-	/*
-	* phase_step_x, phase_step_y, phase_init_x and phase_init_y
-	* are represented in fixed-point, unsigned 3.29 format
-	*/
-	uint32_t phase_step_x = 0;
-	uint32_t phase_step_y = 0;
-	uint32_t phase_init_x = 0;
-	uint32_t phase_init_y = 0;
-
-	uint32_t src_roi, temp;
-	int32_t  src_x, src_y, src_xy;
-	uint32_t yscale_filter_sel, xscale_filter_sel;
-	uint32_t scale_unit_sel_x, scale_unit_sel_y;
-	uint64_t numerator, denominator;
-	int32_t  zoom_dis_x, zoom_dis_y;
-
-	CDBG("%s: pcrop->in2_w = %d, pcrop->in2_h = %d\n", __func__,
-		 pcrop->in2_w, pcrop->in2_h);
-	CDBG("%s: pcrop->out2_w = %d, pcrop->out2_h = %d\n", __func__,
-		 pcrop->out2_w, pcrop->out2_h);
-
-	if ((pcrop->in2_w >= pcrop->out2_w) &&
-		(pcrop->in2_h >= pcrop->out2_h)) {
-		CDBG(" =======VPE no zoom needed, DIS is still enabled.\n");
-
-		temp = msm_camera_io_r(vpe_device->vpebase + VPE_OP_MODE_OFFSET)
-		& 0xfffffffc;
-		msm_camera_io_w(temp, vpe_device->vpebase + VPE_OP_MODE_OFFSET);
-
-		/* no zoom, use dis offset directly. */
-		src_xy = dis_offset->dis_offset_y * (1<<16) +
-			dis_offset->dis_offset_x;
-
-		msm_camera_io_w(src_xy,
-			vpe_device->vpebase + VPE_SRC_XY_OFFSET);
-
-		CDBG("vpe_ctrl->in_h_w = 0x%x\n", vpe_ctrl->in_h_w);
-		msm_camera_io_w(vpe_ctrl->in_h_w,
-			vpe_device->vpebase + VPE_SRC_SIZE_OFFSET);
-		return rc;
-	}
-	/* If fall through then scaler is needed.*/
-
-	CDBG("========VPE zoom needed + DIS enabled.\n");
-	/* assumption is both direction need zoom. this can be
-	 improved. */
-	temp = msm_camera_io_r(vpe_device->vpebase +
-					VPE_OP_MODE_OFFSET) | 0x3;
-	msm_camera_io_w(temp, vpe_device->vpebase +
-			VPE_OP_MODE_OFFSET);
-	zoom_dis_x = dis_offset->dis_offset_x *
-		pcrop->in2_w / pcrop->out2_w;
-	zoom_dis_y = dis_offset->dis_offset_y *
-		pcrop->in2_h / pcrop->out2_h;
-
-	src_x = zoom_dis_x + (pcrop->out2_w-pcrop->in2_w)/2;
-	src_y = zoom_dis_y + (pcrop->out2_h-pcrop->in2_h)/2;
-
-	out_ROI_width = vpe_ctrl->out_w;
-	out_ROI_height = vpe_ctrl->out_h;
-
-	src_ROI_width = out_ROI_width * pcrop->in2_w / pcrop->out2_w;
-	src_ROI_height = out_ROI_height * pcrop->in2_h / pcrop->out2_h;
-
-	/* clamp to output size.  This is because along
-	processing, we mostly do truncation, therefore
-	dis_offset tends to be
-	smaller values.  The intention was to make sure that the
-	offset does not exceed margin.   But in the case it could
-	result src_roi bigger, due to subtract a smaller value. */
-	CDBG("src w = 0x%x, h=0x%x, dst w = 0x%x, h =0x%x.\n",
-		src_ROI_width, src_ROI_height, out_ROI_width,
-		out_ROI_height);
-
-	src_roi = (src_ROI_height << 16) + src_ROI_width;
-
-	msm_camera_io_w(src_roi, vpe_device->vpebase + VPE_SRC_SIZE_OFFSET);
-
-	CDBG("src_x = %d, src_y=%d.\n", src_x, src_y);
-
-	src_xy = src_y*(1<<16) + src_x;
-	msm_camera_io_w(src_xy, vpe_device->vpebase +
-			VPE_SRC_XY_OFFSET);
-	CDBG("src_xy = 0x%x, src_roi=0x%x.\n", src_xy, src_roi);
-
-	/* decide whether to use FIR or M/N for scaling */
-	if ((out_ROI_width == 1 && src_ROI_width < 4) ||
-		(src_ROI_width < 4 * out_ROI_width - 3))
-		scale_unit_sel_x = 0;/* use FIR scalar */
-	else
-		scale_unit_sel_x = 1;/* use M/N scalar */
-
-	if ((out_ROI_height == 1 && src_ROI_height < 4) ||
-		(src_ROI_height < 4 * out_ROI_height - 3))
-		scale_unit_sel_y = 0;/* use FIR scalar */
-	else
-		scale_unit_sel_y = 1;/* use M/N scalar */
-	/* calculate phase step for the x direction */
-
-	/* if destination is only 1 pixel wide, the value of
-	phase_step_x is unimportant. Assigning phase_step_x
-	to src ROI width as an arbitrary value. */
-	if (out_ROI_width == 1)
-		phase_step_x = (uint32_t) ((src_ROI_width) <<
-							SCALER_PHASE_BITS);
-	else if (scale_unit_sel_x == 0) { /* if using FIR scalar */
-		/* Calculate the quotient ( src_ROI_width - 1 )
-		/ ( out_ROI_width - 1)with u3.29 precision.
-		Quotient is rounded up to the larger
-		29th decimal point. */
-		numerator =
-			(uint64_t)(src_ROI_width - 1) <<
-			SCALER_PHASE_BITS;
-		/* never equals to 0 because of the "
-		(out_ROI_width == 1 )"*/
-		denominator = (uint64_t)(out_ROI_width - 1);
-		/* divide and round up to the larger 29th
-		decimal point. */
-		phase_step_x = (uint32_t) vpe_do_div(
-			(numerator + denominator - 1), denominator);
-	} else if (scale_unit_sel_x == 1) { /* if M/N scalar */
-		/* Calculate the quotient
-		( src_ROI_width ) / ( out_ROI_width)
-		with u3.29 precision. Quotient is rounded
-		down to the smaller 29th decimal point. */
-		numerator = (uint64_t)(src_ROI_width) <<
-			SCALER_PHASE_BITS;
-		denominator = (uint64_t)(out_ROI_width);
-		phase_step_x =
-			(uint32_t) vpe_do_div(numerator, denominator);
-	}
-	/* calculate phase step for the y direction */
-
-	/* if destination is only 1 pixel wide, the value of
-		phase_step_x is unimportant. Assigning phase_step_x
-		to src ROI width as an arbitrary value. */
-	if (out_ROI_height == 1)
-		phase_step_y =
-		(uint32_t) ((src_ROI_height) << SCALER_PHASE_BITS);
-	else if (scale_unit_sel_y == 0) { /* if FIR scalar */
-		/* Calculate the quotient
-		( src_ROI_height - 1 ) / ( out_ROI_height - 1)
-		with u3.29 precision. Quotient is rounded up to the
-		larger 29th decimal point. */
-		numerator = (uint64_t)(src_ROI_height - 1) <<
-			SCALER_PHASE_BITS;
-		/* never equals to 0 because of the
-		"( out_ROI_height == 1 )" case */
-		denominator = (uint64_t)(out_ROI_height - 1);
-		/* Quotient is rounded up to the larger 29th
-		decimal point. */
-		phase_step_y =
-		(uint32_t) vpe_do_div(
-		(numerator + denominator - 1), denominator);
-	} else if (scale_unit_sel_y == 1) { /* if M/N scalar */
-		/* Calculate the quotient ( src_ROI_height ) / ( out_ROI_height)
-		with u3.29 precision. Quotient is rounded down to the smaller
-		29th decimal point. */
-		numerator = (uint64_t)(src_ROI_height) <<
-			SCALER_PHASE_BITS;
-		denominator = (uint64_t)(out_ROI_height);
-		phase_step_y = (uint32_t) vpe_do_div(
-			numerator, denominator);
-	}
-
-	/* decide which set of FIR coefficients to use */
-	if (phase_step_x > HAL_MDP_PHASE_STEP_2P50)
-		xscale_filter_sel = 0;
-	else if (phase_step_x > HAL_MDP_PHASE_STEP_1P66)
-		xscale_filter_sel = 1;
-	else if (phase_step_x > HAL_MDP_PHASE_STEP_1P25)
-		xscale_filter_sel = 2;
-	else
-		xscale_filter_sel = 3;
-
-	if (phase_step_y > HAL_MDP_PHASE_STEP_2P50)
-		yscale_filter_sel = 0;
-	else if (phase_step_y > HAL_MDP_PHASE_STEP_1P66)
-		yscale_filter_sel = 1;
-	else if (phase_step_y > HAL_MDP_PHASE_STEP_1P25)
-		yscale_filter_sel = 2;
-	else
-		yscale_filter_sel = 3;
-
-	/* calculate phase init for the x direction */
-
-	/* if using FIR scalar */
-	if (scale_unit_sel_x == 0) {
-		if (out_ROI_width == 1)
-			phase_init_x =
-			(uint32_t) ((src_ROI_width - 1) <<
-						SCALER_PHASE_BITS);
-		else
-			phase_init_x = 0;
-
-	} else if (scale_unit_sel_x == 1) /* M over N scalar  */
-		phase_init_x = 0;
-
-	/* calculate phase init for the y direction
-	if using FIR scalar */
-	if (scale_unit_sel_y == 0) {
-		if (out_ROI_height == 1)
-			phase_init_y =
-			(uint32_t) ((src_ROI_height -
-						1) << SCALER_PHASE_BITS);
-		else
-			phase_init_y = 0;
-
-	} else if (scale_unit_sel_y == 1) /* M over N scalar   */
-		phase_init_y = 0;
-
-	CDBG("phase step x = %d, step y = %d.\n",
-		phase_step_x, phase_step_y);
-	CDBG("phase init x = %d, init y = %d.\n",
-		phase_init_x, phase_init_y);
-
-	msm_camera_io_w(phase_step_x, vpe_device->vpebase +
-			VPE_SCALE_PHASEX_STEP_OFFSET);
-
-	msm_camera_io_w(phase_step_y, vpe_device->vpebase +
-			VPE_SCALE_PHASEY_STEP_OFFSET);
-
-	msm_camera_io_w(phase_init_x, vpe_device->vpebase +
-			VPE_SCALE_PHASEX_INIT_OFFSET);
-
-	msm_camera_io_w(phase_init_y, vpe_device->vpebase +
-			VPE_SCALE_PHASEY_INIT_OFFSET);
-
-	return 1;
-}
-
-void msm_send_frame_to_vpe(uint32_t p0_phy_add, uint32_t p1_phy_add,
-		struct timespec *ts, int output_type)
-{
-	uint32_t temp_pyaddr = 0, temp_pcbcraddr = 0;
-
-	CDBG("vpe input, p0_phy_add = 0x%x, p1_phy_add = 0x%x\n",
-		p0_phy_add, p1_phy_add);
-	msm_camera_io_w(p0_phy_add,
-		vpe_device->vpebase + VPE_SRCP0_ADDR_OFFSET);
-	msm_camera_io_w(p1_phy_add,
-		vpe_device->vpebase + VPE_SRCP1_ADDR_OFFSET);
-
-	if (vpe_ctrl->state == VPE_STATE_ACTIVE)
-		CDBG(" =====VPE is busy!!!  Wrong!========\n");
-
-	if (output_type != OUTPUT_TYPE_ST_R)
-		vpe_ctrl->ts = *ts;
-
-	if (output_type == OUTPUT_TYPE_ST_L) {
-		vpe_ctrl->pcbcr_before_dis =
-			msm_camera_io_r(vpe_device->vpebase +
-			VPE_OUTP1_ADDR_OFFSET);
-		temp_pyaddr = msm_camera_io_r(vpe_device->vpebase +
-			VPE_OUTP0_ADDR_OFFSET);
-		temp_pcbcraddr = temp_pyaddr + PAD_TO_2K(vpe_ctrl->out_w *
-			vpe_ctrl->out_h * 2, vpe_ctrl->pad_2k_bool);
-		msm_camera_io_w(temp_pcbcraddr, vpe_device->vpebase +
-			VPE_OUTP1_ADDR_OFFSET);
-	}
-
-	if (vpe_ctrl->dis_en) {
-		/* Changing the VPE output CBCR address,
-		to make Y/CBCR continuous */
-		vpe_ctrl->pcbcr_before_dis =
-			msm_camera_io_r(vpe_device->vpebase +
-			VPE_OUTP1_ADDR_OFFSET);
-		temp_pyaddr = msm_camera_io_r(vpe_device->vpebase +
-			VPE_OUTP0_ADDR_OFFSET);
-		temp_pcbcraddr = temp_pyaddr + vpe_ctrl->pcbcr_dis_offset;
-		msm_camera_io_w(temp_pcbcraddr, vpe_device->vpebase +
-			VPE_OUTP1_ADDR_OFFSET);
-	}
-
-	vpe_ctrl->output_type = output_type;
-	vpe_ctrl->state = VPE_STATE_ACTIVE;
-	vpe_start();
-}
-
-static int vpe_proc_general(struct msm_vpe_cmd *cmd)
-{
-	int rc = 0;
-	uint32_t *cmdp = NULL;
-	struct msm_queue_cmd *qcmd = NULL;
-	struct msm_vpe_buf_info *vpe_buf;
-	int turbo_mode = 0;
-	struct msm_sync *sync = (struct msm_sync *)vpe_ctrl->syncdata;
-	CDBG("vpe_proc_general: cmdID = %s, length = %d\n",
-		vpe_general_cmd[cmd->id], cmd->length);
-	switch (cmd->id) {
-	case VPE_ENABLE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto vpe_proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto vpe_proc_general_done;
-		}
-		turbo_mode = *((int *)(cmd->value));
-		rc = turbo_mode ? vpe_enable(VPE_TURBO_MODE_CLOCK_RATE)
-			: vpe_enable(VPE_NORMAL_MODE_CLOCK_RATE);
-		break;
-	case VPE_DISABLE:
-		rc = vpe_disable();
-		break;
-	case VPE_RESET:
-	case VPE_ABORT:
-		rc = vpe_reset();
-		break;
-	case VPE_START:
-		rc = vpe_start();
-		break;
-
-	case VPE_INPUT_PLANE_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto vpe_proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto vpe_proc_general_done;
-		}
-		vpe_input_plane_config(cmdp);
-		break;
-
-	case VPE_OPERATION_MODE_CFG:
-		CDBG("cmd->length = %d \n", cmd->length);
-		if (cmd->length != VPE_OPERATION_MODE_CFG_LEN) {
-			rc = -EINVAL;
-			goto vpe_proc_general_done;
-		}
-		cmdp = kmalloc(VPE_OPERATION_MODE_CFG_LEN,
-					GFP_ATOMIC);
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			VPE_OPERATION_MODE_CFG_LEN)) {
-			rc = -EFAULT;
-			goto vpe_proc_general_done;
-		}
-		rc = vpe_operation_config(cmdp);
-		CDBG("rc = %d \n", rc);
-		break;
-
-	case VPE_OUTPUT_PLANE_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto vpe_proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto vpe_proc_general_done;
-		}
-		vpe_output_plane_config(cmdp);
-		break;
-
-	case VPE_SCALE_CFG_TYPE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto vpe_proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto vpe_proc_general_done;
-		}
-		vpe_update_scale_coef(cmdp);
-		break;
-
-	case VPE_CMD_DIS_OFFSET_CFG: {
-		struct msm_vfe_resp *vdata;
-		/* first get the dis offset and frame id. */
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto vpe_proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto vpe_proc_general_done;
-		}
-		/* get the offset. */
-		vpe_ctrl->dis_offset = *(struct dis_offset_type *)cmdp;
-		qcmd = msm_dequeue_vpe(&sync->vpe_q, list_vpe_frame);
-		if (!qcmd) {
-			pr_err("%s: no video frame.\n", __func__);
-			kfree(cmdp);
-			return -EAGAIN;
-		}
-		vdata = (struct msm_vfe_resp *)(qcmd->command);
-		vpe_buf = &vdata->vpe_bf;
-		vpe_update_scaler_with_dis(&(vpe_buf->vpe_crop),
-					&(vpe_ctrl->dis_offset));
-
-		msm_send_frame_to_vpe(vpe_buf->p0_phy, vpe_buf->p1_phy,
-						&(vpe_buf->ts), OUTPUT_TYPE_V);
-
-		if (!qcmd || !atomic_read(&qcmd->on_heap)) {
-			kfree(cmdp);
-			return -EAGAIN;
-		}
-		if (!atomic_sub_return(1, &qcmd->on_heap))
-			kfree(qcmd);
-		break;
-	}
-
-	default:
-		break;
-	}
-vpe_proc_general_done:
-	kfree(cmdp);
-	return rc;
-}
-
-static void vpe_addr_convert(struct msm_vpe_phy_info *pinfo,
-	enum vpe_resp_msg type, void *data, void **ext, int32_t *elen)
-{
-	CDBG("In vpe_addr_convert type = %d\n", type);
-	switch (type) {
-	case VPE_MSG_OUTPUT_V:
-		pinfo->output_id = OUTPUT_TYPE_V;
-		break;
-	case VPE_MSG_OUTPUT_ST_R:
-		/* output_id will be used by user space only. */
-		pinfo->output_id = OUTPUT_TYPE_V;
-		break;
-	default:
-		break;
-	} /* switch */
-
-	CDBG("In vpe_addr_convert output_id = %d\n", pinfo->output_id);
-
-	pinfo->p0_phy =
-		((struct vpe_message *)data)->_u.msgOut.p0_Buffer;
-	pinfo->p1_phy =
-		((struct vpe_message *)data)->_u.msgOut.p1_Buffer;
-	*ext  = vpe_ctrl->extdata;
-	*elen = vpe_ctrl->extlen;
-}
-
-void vpe_proc_ops(uint8_t id, void *msg, size_t len)
-{
-	struct msm_vpe_resp *rp;
-
-	rp = vpe_ctrl->resp->vpe_alloc(sizeof(struct msm_vpe_resp),
-		vpe_ctrl->syncdata, GFP_ATOMIC);
-	if (!rp) {
-		CDBG("rp: cannot allocate buffer\n");
-		return;
-	}
-
-	CDBG("vpe_proc_ops, msgId = %d rp->evt_msg.msg_id = %d\n",
-		id, rp->evt_msg.msg_id);
-	rp->evt_msg.type   = MSM_CAMERA_MSG;
-	rp->evt_msg.msg_id = id;
-	rp->evt_msg.len    = len;
-	rp->evt_msg.data   = msg;
-
-	switch (rp->evt_msg.msg_id) {
-	case MSG_ID_VPE_OUTPUT_V:
-		rp->type = VPE_MSG_OUTPUT_V;
-		vpe_addr_convert(&(rp->phy), VPE_MSG_OUTPUT_V,
-			rp->evt_msg.data, &(rp->extdata),
-			&(rp->extlen));
-		break;
-
-	case MSG_ID_VPE_OUTPUT_ST_R:
-		rp->type = VPE_MSG_OUTPUT_ST_R;
-		vpe_addr_convert(&(rp->phy), VPE_MSG_OUTPUT_ST_R,
-			rp->evt_msg.data, &(rp->extdata),
-			&(rp->extlen));
-		break;
-
-	case MSG_ID_VPE_OUTPUT_ST_L:
-		rp->type = VPE_MSG_OUTPUT_ST_L;
-		break;
-
-	default:
-		rp->type = VPE_MSG_GENERAL;
-		break;
-	}
-	CDBG("%s: time = %ld\n",
-			__func__, vpe_ctrl->ts.tv_nsec);
-
-	vpe_ctrl->resp->vpe_resp(rp, MSM_CAM_Q_VPE_MSG,
-					vpe_ctrl->syncdata,
-					&(vpe_ctrl->ts), GFP_ATOMIC);
-}
-
-int vpe_config_axi(struct axidata *ad)
-{
-	uint32_t p1;
-	struct msm_pmem_region *regp1 = NULL;
-	CDBG("vpe_config_axi:bufnum1 = %d.\n", ad->bufnum1);
-
-	if (ad->bufnum1 != 1)
-		return -EINVAL;
-
-	regp1 = &(ad->region[0]);
-	/* for video  Y address */
-	p1 = (regp1->paddr + regp1->info.planar0_off);
-	msm_camera_io_w(p1, vpe_device->vpebase + VPE_OUTP0_ADDR_OFFSET);
-	/* for video  CbCr address */
-	p1 = (regp1->paddr + regp1->info.planar1_off);
-	msm_camera_io_w(p1, vpe_device->vpebase + VPE_OUTP1_ADDR_OFFSET);
-
-	return 0;
-}
-
-int msm_vpe_config(struct msm_vpe_cfg_cmd *cmd, void *data)
-{
-	struct msm_vpe_cmd vpecmd;
-	int rc = 0;
-	if (copy_from_user(&vpecmd,
-			(void __user *)(cmd->value),
-			sizeof(vpecmd))) {
-		pr_err("%s %d: copy_from_user failed\n", __func__,
-				__LINE__);
-		return -EFAULT;
-	}
-	CDBG("%s: cmd_type %d\n", __func__, cmd->cmd_type);
-	switch (cmd->cmd_type) {
-	case CMD_VPE:
-		rc = vpe_proc_general(&vpecmd);
-		CDBG(" rc = %d\n", rc);
-		break;
-
-	case CMD_AXI_CFG_VPE:
-	case CMD_AXI_CFG_SNAP_VPE:
-	case CMD_AXI_CFG_SNAP_THUMB_VPE: {
-		struct axidata *axid;
-		axid = data;
-		if (!axid)
-			return -EFAULT;
-		vpe_config_axi(axid);
-		break;
-	}
-	default:
-		break;
-	}
-	CDBG("%s: rc = %d\n", __func__, rc);
-	return rc;
-}
-
-void msm_vpe_offset_update(int frame_pack, uint32_t pyaddr, uint32_t pcbcraddr,
-	struct timespec *ts, int output_id, struct msm_st_half st_half,
-	int frameid)
-{
-	struct msm_vpe_buf_info vpe_buf;
-	uint32_t input_stride;
-
-	vpe_buf.vpe_crop.in2_w = st_half.stCropInfo.in_w;
-	vpe_buf.vpe_crop.in2_h = st_half.stCropInfo.in_h;
-	vpe_buf.vpe_crop.out2_w = st_half.stCropInfo.out_w;
-	vpe_buf.vpe_crop.out2_h = st_half.stCropInfo.out_h;
-	vpe_ctrl->dis_offset.dis_offset_x = st_half.pix_x_off;
-	vpe_ctrl->dis_offset.dis_offset_y = st_half.pix_y_off;
-	vpe_ctrl->dis_offset.frame_id = frameid;
-	vpe_ctrl->frame_pack = frame_pack;
-	vpe_ctrl->output_type = output_id;
-
-	input_stride = (st_half.buf_p1_stride * (1<<16)) +
-		st_half.buf_p0_stride;
-
-	msm_camera_io_w(input_stride,
-		vpe_device->vpebase + VPE_SRC_YSTRIDE1_OFFSET);
-
-	vpe_update_scaler_with_dis(&(vpe_buf.vpe_crop),
-		&(vpe_ctrl->dis_offset));
-
-	msm_send_frame_to_vpe(pyaddr, pcbcraddr, ts, output_id);
-}
-
-static void vpe_send_outmsg(uint8_t msgid, uint32_t p0_addr,
-	uint32_t p1_addr, uint32_t p2_addr)
-{
-	struct vpe_message msg;
-	uint8_t outid;
-	msg._d = outid = msgid;
-	msg._u.msgOut.output_id   = msgid;
-	msg._u.msgOut.p0_Buffer = p0_addr;
-	msg._u.msgOut.p1_Buffer = p1_addr;
-	msg._u.msgOut.p2_Buffer = p2_addr;
-	vpe_proc_ops(outid, &msg, sizeof(struct vpe_message));
-	return;
-}
-
-int msm_vpe_reg(struct msm_vpe_callback *presp)
-{
-	if (presp && presp->vpe_resp)
-		vpe_ctrl->resp = presp;
-
-	return 0;
-}
-
-static void vpe_send_msg_no_payload(enum VPE_MESSAGE_ID id)
-{
-	struct vpe_message msg;
-
-	CDBG("vfe31_send_msg_no_payload\n");
-	msg._d = id;
-	vpe_proc_ops(id, &msg, 0);
-}
-
-static void vpe_do_tasklet(unsigned long data)
-{
-	unsigned long flags;
-	uint32_t pyaddr = 0, pcbcraddr = 0;
-	uint32_t src_y, src_cbcr, temp;
-
-	struct vpe_isr_queue_cmd_type *qcmd = NULL;
-
-	CDBG("=== vpe_do_tasklet start === \n");
-
-	spin_lock_irqsave(&vpe_ctrl->tasklet_lock, flags);
-	qcmd = list_first_entry(&vpe_ctrl->tasklet_q,
-		struct vpe_isr_queue_cmd_type, list);
-
-	if (!qcmd) {
-		spin_unlock_irqrestore(&vpe_ctrl->tasklet_lock, flags);
-		return;
-	}
-
-	list_del(&qcmd->list);
-	spin_unlock_irqrestore(&vpe_ctrl->tasklet_lock, flags);
-
-	/* interrupt to be processed,  *qcmd has the payload.  */
-	if (qcmd->irq_status & 0x1) {
-		if (vpe_ctrl->output_type == OUTPUT_TYPE_ST_L) {
-			CDBG("vpe left frame done.\n");
-			vpe_ctrl->output_type = 0;
-			CDBG("vpe send out msg.\n");
-			orig_src_y = msm_camera_io_r(vpe_device->vpebase +
-				VPE_SRCP0_ADDR_OFFSET);
-			orig_src_cbcr = msm_camera_io_r(vpe_device->vpebase +
-				VPE_SRCP1_ADDR_OFFSET);
-
-			pyaddr = msm_camera_io_r(vpe_device->vpebase +
-				VPE_OUTP0_ADDR_OFFSET);
-			pcbcraddr = msm_camera_io_r(vpe_device->vpebase +
-				VPE_OUTP1_ADDR_OFFSET);
-			CDBG("%s: out_w = %d, out_h = %d\n", __func__,
-				vpe_ctrl->out_w, vpe_ctrl->out_h);
-
-			if ((vpe_ctrl->frame_pack == TOP_DOWN_FULL) ||
-				(vpe_ctrl->frame_pack == TOP_DOWN_HALF)) {
-				msm_camera_io_w(pyaddr + (vpe_ctrl->out_w *
-					vpe_ctrl->out_h), vpe_device->vpebase +
-					VPE_OUTP0_ADDR_OFFSET);
-				msm_camera_io_w(pcbcraddr + (vpe_ctrl->out_w *
-					vpe_ctrl->out_h/2),
-					vpe_device->vpebase +
-					VPE_OUTP1_ADDR_OFFSET);
-			} else if ((vpe_ctrl->frame_pack ==
-				SIDE_BY_SIDE_HALF) || (vpe_ctrl->frame_pack ==
-				SIDE_BY_SIDE_FULL)) {
-				msm_camera_io_w(pyaddr + vpe_ctrl->out_w,
-					vpe_device->vpebase +
-					VPE_OUTP0_ADDR_OFFSET);
-				msm_camera_io_w(pcbcraddr + vpe_ctrl->out_w,
-					vpe_device->vpebase +
-					VPE_OUTP1_ADDR_OFFSET);
-			} else
-				CDBG("%s: Invalid packing = %d\n", __func__,
-					vpe_ctrl->frame_pack);
-
-			vpe_send_msg_no_payload(MSG_ID_VPE_OUTPUT_ST_L);
-			vpe_ctrl->state = VPE_STATE_INIT;
-			kfree(qcmd);
-			return;
-		} else if (vpe_ctrl->output_type == OUTPUT_TYPE_ST_R) {
-			src_y = orig_src_y;
-			src_cbcr = orig_src_cbcr;
-			CDBG("%s: out_w = %d, out_h = %d\n", __func__,
-				vpe_ctrl->out_w, vpe_ctrl->out_h);
-
-			if ((vpe_ctrl->frame_pack == TOP_DOWN_FULL) ||
-				(vpe_ctrl->frame_pack == TOP_DOWN_HALF)) {
-				pyaddr = msm_camera_io_r(vpe_device->vpebase +
-					VPE_OUTP0_ADDR_OFFSET) -
-					(vpe_ctrl->out_w * vpe_ctrl->out_h);
-			} else if ((vpe_ctrl->frame_pack ==
-				SIDE_BY_SIDE_HALF) || (vpe_ctrl->frame_pack ==
-				SIDE_BY_SIDE_FULL)) {
-				pyaddr = msm_camera_io_r(vpe_device->vpebase +
-				VPE_OUTP0_ADDR_OFFSET) - vpe_ctrl->out_w;
-			} else
-				CDBG("%s: Invalid packing = %d\n", __func__,
-					vpe_ctrl->frame_pack);
-
-			pcbcraddr = vpe_ctrl->pcbcr_before_dis;
-		} else {
-			src_y =	msm_camera_io_r(vpe_device->vpebase +
-				VPE_SRCP0_ADDR_OFFSET);
-			src_cbcr = msm_camera_io_r(vpe_device->vpebase +
-				VPE_SRCP1_ADDR_OFFSET);
-			pyaddr = msm_camera_io_r(vpe_device->vpebase +
-				VPE_OUTP0_ADDR_OFFSET);
-			pcbcraddr = msm_camera_io_r(vpe_device->vpebase +
-				VPE_OUTP1_ADDR_OFFSET);
-		}
-
-		if (vpe_ctrl->dis_en)
-			pcbcraddr = vpe_ctrl->pcbcr_before_dis;
-
-		msm_camera_io_w(src_y,
-				vpe_device->vpebase + VPE_OUTP0_ADDR_OFFSET);
-		msm_camera_io_w(src_cbcr,
-				vpe_device->vpebase + VPE_OUTP1_ADDR_OFFSET);
-
-		temp = msm_camera_io_r(vpe_device->vpebase + VPE_OP_MODE_OFFSET)
-				& 0xFFFFFFFC;
-		msm_camera_io_w(temp, vpe_device->vpebase + VPE_OP_MODE_OFFSET);
-
-		/*  now pass this frame to msm_camera.c. */
-		if (vpe_ctrl->output_type == OUTPUT_TYPE_ST_R) {
-			CDBG("vpe send out R msg.\n");
-			vpe_send_outmsg(MSG_ID_VPE_OUTPUT_ST_R, pyaddr,
-				pcbcraddr, pyaddr);
-		} else if (vpe_ctrl->output_type == OUTPUT_TYPE_V) {
-			CDBG("vpe send out V msg.\n");
-			vpe_send_outmsg(MSG_ID_VPE_OUTPUT_V, pyaddr,
-				pcbcraddr, pyaddr);
-		}
-
-		vpe_ctrl->output_type = 0;
-		vpe_ctrl->state = VPE_STATE_INIT;   /* put it back to idle. */
-
-	}
-	kfree(qcmd);
-}
-DECLARE_TASKLET(vpe_tasklet, vpe_do_tasklet, 0);
-
-static irqreturn_t vpe_parse_irq(int irq_num, void *data)
-{
-	unsigned long flags;
-	uint32_t irq_status = 0;
-	struct vpe_isr_queue_cmd_type *qcmd;
-
-	CDBG("vpe_parse_irq.\n");
-	/* read and clear back-to-back. */
-	irq_status = msm_camera_io_r_mb(vpe_device->vpebase +
-							VPE_INTR_STATUS_OFFSET);
-	msm_camera_io_w_mb(irq_status, vpe_device->vpebase +
-				VPE_INTR_CLEAR_OFFSET);
-
-	msm_camera_io_w(0, vpe_device->vpebase + VPE_INTR_ENABLE_OFFSET);
-
-	if (irq_status == 0) {
-		pr_err("%s: irq_status = 0,Something is wrong!\n", __func__);
-		return IRQ_HANDLED;
-	}
-	irq_status &= 0x1;
-	/* apply mask. only interested in bit 0.  */
-	if (irq_status) {
-		qcmd = kzalloc(sizeof(struct vpe_isr_queue_cmd_type),
-			GFP_ATOMIC);
-		if (!qcmd) {
-			pr_err("%s: qcmd malloc failed!\n", __func__);
-			return IRQ_HANDLED;
-		}
-		/* must be 0x1 now. so in bottom half we don't really
-		need to check. */
-		qcmd->irq_status = irq_status & 0x1;
-		spin_lock_irqsave(&vpe_ctrl->tasklet_lock, flags);
-		list_add_tail(&qcmd->list, &vpe_ctrl->tasklet_q);
-		spin_unlock_irqrestore(&vpe_ctrl->tasklet_lock, flags);
-		tasklet_schedule(&vpe_tasklet);
-	}
-	return IRQ_HANDLED;
-}
-
-static int vpe_enable_irq(void)
-{
-	uint32_t   rc = 0;
-	rc = request_irq(vpe_device->vpeirq,
-				vpe_parse_irq,
-				IRQF_TRIGGER_HIGH, "vpe", 0);
-	return rc;
-}
-
-int msm_vpe_open(void)
-{
-	int rc = 0;
-
-	CDBG("%s: In \n", __func__);
-
-	vpe_ctrl = kzalloc(sizeof(struct vpe_ctrl_type), GFP_KERNEL);
-	if (!vpe_ctrl) {
-		pr_err("%s: no memory!\n", __func__);
-		return -ENOMEM;
-	}
-
-	spin_lock_init(&vpe_ctrl->ops_lock);
-	CDBG("%s: Out\n", __func__);
-
-	return rc;
-}
-
-int msm_vpe_release(void)
-{
-	/* clean up....*/
-	int rc = 0;
-	CDBG("%s: state %d\n", __func__, vpe_ctrl->state);
-	if (vpe_ctrl->state != VPE_STATE_IDLE)
-		rc = vpe_disable();
-
-	kfree(vpe_ctrl);
-	return rc;
-}
-
-
-int vpe_enable(uint32_t clk_rate)
-{
-	int rc = 0;
-	unsigned long flags = 0;
-	/* don't change the order of clock and irq.*/
-	CDBG("%s: enable_clock rate %u\n", __func__, clk_rate);
-	spin_lock_irqsave(&vpe_ctrl->ops_lock, flags);
-	if (vpe_ctrl->state != VPE_STATE_IDLE) {
-		CDBG("%s: VPE already enabled", __func__);
-		spin_unlock_irqrestore(&vpe_ctrl->ops_lock, flags);
-		return 0;
-	}
-	vpe_ctrl->state = VPE_STATE_INIT;
-	spin_unlock_irqrestore(&vpe_ctrl->ops_lock, flags);
-
-	rc = msm_camio_vpe_clk_enable(clk_rate);
-	if (rc < 0) {
-		pr_err("%s: msm_camio_vpe_clk_enable failed", __func__);
-		vpe_ctrl->state = VPE_STATE_IDLE;
-		return rc;
-	}
-
-	CDBG("%s: enable_irq\n", __func__);
-	vpe_enable_irq();
-
-	/* initialize the data structure - lock, queue etc. */
-	spin_lock_init(&vpe_ctrl->tasklet_lock);
-	INIT_LIST_HEAD(&vpe_ctrl->tasklet_q);
-
-	return rc;
-}
-
-int vpe_disable(void)
-{
-	int rc = 0;
-	unsigned long flags = 0;
-	CDBG("%s: called", __func__);
-	spin_lock_irqsave(&vpe_ctrl->ops_lock, flags);
-	if (vpe_ctrl->state == VPE_STATE_IDLE) {
-		CDBG("%s: VPE already disabled", __func__);
-		spin_unlock_irqrestore(&vpe_ctrl->ops_lock, flags);
-		return 0;
-	}
-	vpe_ctrl->state = VPE_STATE_IDLE;
-	spin_unlock_irqrestore(&vpe_ctrl->ops_lock, flags);
-	vpe_ctrl->out_y_addr = msm_camera_io_r(vpe_device->vpebase +
-		VPE_OUTP0_ADDR_OFFSET);
-	vpe_ctrl->out_cbcr_addr = msm_camera_io_r(vpe_device->vpebase +
-		VPE_OUTP1_ADDR_OFFSET);
-	free_irq(vpe_device->vpeirq, 0);
-	tasklet_kill(&vpe_tasklet);
-	rc = msm_camio_vpe_clk_disable();
-	return rc;
-}
-
-static int __msm_vpe_probe(struct platform_device *pdev)
-{
-	int rc = 0;
-	struct resource   *vpemem, *vpeirq, *vpeio;
-	void __iomem      *vpebase;
-
-	/* first allocate */
-
-	vpe_device = &vpe_device_data;
-	memset(vpe_device, 0, sizeof(struct vpe_device_type));
-
-	/* does the device exist? */
-	vpeirq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!vpeirq) {
-		pr_err("%s: no vpe irq resource.\n", __func__);
-		rc = -ENODEV;
-		goto vpe_free_device;
-	}
-	vpemem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!vpemem) {
-		pr_err("%s: no vpe mem resource!\n", __func__);
-		rc = -ENODEV;
-		goto vpe_free_device;
-	}
-	vpeio = request_mem_region(vpemem->start,
-			resource_size(vpemem), pdev->name);
-	if (!vpeio) {
-		pr_err("%s: VPE region already claimed.\n", __func__);
-		rc = -EBUSY;
-		goto vpe_free_device;
-	}
-
-	vpebase =
-		ioremap(vpemem->start,
-				(vpemem->end - vpemem->start) + 1);
-	if (!vpebase) {
-		pr_err("%s: vpe ioremap failed.\n", __func__);
-		rc = -ENOMEM;
-		goto vpe_release_mem_region;
-	}
-
-	/* Fall through, _probe is successful. */
-	vpe_device->vpeirq = vpeirq->start;
-	vpe_device->vpemem = vpemem;
-	vpe_device->vpeio = vpeio;
-	vpe_device->vpebase = vpebase;
-	return rc;  /* this rc should be zero.*/
-
-	iounmap(vpe_device->vpebase);  /* this path should never occur */
-	vpe_device->vpebase = NULL;
-/* from this part it is error handling. */
-vpe_release_mem_region:
-	release_mem_region(vpemem->start, (vpemem->end - vpemem->start) + 1);
-vpe_free_device:
-	return rc;  /* this rc should have error code. */
-}
-
-static int __msm_vpe_remove(struct platform_device *pdev)
-{
-	struct resource	*vpemem;
-	vpemem = vpe_device->vpemem;
-
-	iounmap(vpe_device->vpebase);
-	vpe_device->vpebase = NULL;
-	release_mem_region(vpemem->start,
-					(vpemem->end - vpemem->start) + 1);
-	return 0;
-}
-
-static struct platform_driver msm_vpe_driver = {
-	.probe = __msm_vpe_probe,
-	.remove = __msm_vpe_remove,
-	.driver = {
-		.name = "msm_vpe",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init msm_vpe_init(void)
-{
-	return platform_driver_register(&msm_vpe_driver);
-}
-module_init(msm_vpe_init);
-
-static void __exit msm_vpe_exit(void)
-{
-	platform_driver_unregister(&msm_vpe_driver);
-}
-module_exit(msm_vpe_exit);
-
-MODULE_DESCRIPTION("msm vpe 1.0 driver");
-MODULE_VERSION("msm vpe driver 1.0");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/msm_vpe1.h b/drivers/media/video/msm/msm_vpe1.h
deleted file mode 100644
index 5fd7a4a..0000000
--- a/drivers/media/video/msm/msm_vpe1.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/* Copyright (c) 2010, 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef _msm_vpe1_h_
-#define _msm_vpe1_h_
-
-#include <mach/camera.h>
-
-/***********  start of register offset *********************/
-#define VPE_INTR_ENABLE_OFFSET                0x0020
-#define VPE_INTR_STATUS_OFFSET                0x0024
-#define VPE_INTR_CLEAR_OFFSET                 0x0028
-#define VPE_DL0_START_OFFSET                  0x0030
-#define VPE_HW_VERSION_OFFSET                 0x0070
-#define VPE_SW_RESET_OFFSET                   0x0074
-#define VPE_AXI_RD_ARB_CONFIG_OFFSET          0x0078
-#define VPE_SEL_CLK_OR_HCLK_TEST_BUS_OFFSET   0x007C
-#define VPE_CGC_EN_OFFSET                     0x0100
-#define VPE_CMD_STATUS_OFFSET                 0x10008
-#define VPE_PROFILE_EN_OFFSET                 0x10010
-#define VPE_PROFILE_COUNT_OFFSET              0x10014
-#define VPE_CMD_MODE_OFFSET                   0x10060
-#define VPE_SRC_SIZE_OFFSET                   0x10108
-#define VPE_SRCP0_ADDR_OFFSET                 0x1010C
-#define VPE_SRCP1_ADDR_OFFSET                 0x10110
-#define VPE_SRC_YSTRIDE1_OFFSET               0x1011C
-#define VPE_SRC_FORMAT_OFFSET                 0x10124
-#define VPE_SRC_UNPACK_PATTERN1_OFFSET        0x10128
-#define VPE_OP_MODE_OFFSET                    0x10138
-#define VPE_SCALE_PHASEX_INIT_OFFSET          0x1013C
-#define VPE_SCALE_PHASEY_INIT_OFFSET          0x10140
-#define VPE_SCALE_PHASEX_STEP_OFFSET          0x10144
-#define VPE_SCALE_PHASEY_STEP_OFFSET          0x10148
-#define VPE_OUT_FORMAT_OFFSET                 0x10150
-#define VPE_OUT_PACK_PATTERN1_OFFSET          0x10154
-#define VPE_OUT_SIZE_OFFSET                   0x10164
-#define VPE_OUTP0_ADDR_OFFSET                 0x10168
-#define VPE_OUTP1_ADDR_OFFSET                 0x1016C
-#define VPE_OUT_YSTRIDE1_OFFSET               0x10178
-#define VPE_OUT_XY_OFFSET                     0x1019C
-#define VPE_SRC_XY_OFFSET                     0x10200
-#define VPE_SRC_IMAGE_SIZE_OFFSET             0x10208
-#define VPE_SCALE_CONFIG_OFFSET               0x10230
-#define VPE_DEINT_STATUS_OFFSET               0x30000
-#define VPE_DEINT_DECISION_OFFSET             0x30004
-#define VPE_DEINT_COEFF0_OFFSET               0x30010
-#define VPE_SCALE_STATUS_OFFSET               0x50000
-#define VPE_SCALE_SVI_PARAM_OFFSET            0x50010
-#define VPE_SCALE_SHARPEN_CFG_OFFSET          0x50020
-#define VPE_SCALE_COEFF_LSP_0_OFFSET          0x50400
-#define VPE_SCALE_COEFF_MSP_0_OFFSET          0x50404
-
-#define VPE_AXI_ARB_2_OFFSET                  0x004C
-
-#define VPE_SCALE_COEFF_LSBn(n)	(0x50400 + 8 * (n))
-#define VPE_SCALE_COEFF_MSBn(n)	(0x50404 + 8 * (n))
-#define VPE_SCALE_COEFF_NUM			32
-
-/*********** end of register offset ********************/
-
-
-#define VPE_HARDWARE_VERSION          0x00080308
-#define VPE_SW_RESET_VALUE            0x00000010  /* bit 4 for PPP*/
-#define VPE_AXI_RD_ARB_CONFIG_VALUE   0x124924
-#define VPE_CMD_MODE_VALUE        0x1
-#define VPE_DEFAULT_OP_MODE_VALUE     0x40FC0004
-#define VPE_CGC_ENABLE_VALUE          0xffff
-#define VPE_DEFAULT_SCALE_CONFIG      0x3c
-
-#define VPE_NORMAL_MODE_CLOCK_RATE   150000000
-#define VPE_TURBO_MODE_CLOCK_RATE   200000000
-/**************************************************/
-/*********** Start of command id ******************/
-/**************************************************/
-enum VPE_CMD_ID_ENUM {
-	VPE_DUMMY_0 = 0,
-	VPE_SET_CLK,
-	VPE_RESET,
-	VPE_START,
-	VPE_ABORT,
-	VPE_OPERATION_MODE_CFG, /* 5 */
-	VPE_INPUT_PLANE_CFG,
-	VPE_OUTPUT_PLANE_CFG,
-	VPE_INPUT_PLANE_UPDATE,
-	VPE_SCALE_CFG_TYPE,
-	VPE_ROTATION_CFG_TYPE, /* 10 */
-	VPE_AXI_OUT_CFG,
-	VPE_CMD_DIS_OFFSET_CFG,
-	VPE_ENABLE,
-	VPE_DISABLE,
-};
-
-/* Length of each command.  In bytes.  (payload only) */
-#define VPE_OPERATION_MODE_CFG_LEN 8
-#define VPE_INPUT_PLANE_CFG_LEN    24
-#define VPE_OUTPUT_PLANE_CFG_LEN   20
-#define VPE_INPUT_PLANE_UPDATE_LEN 12
-#define VPE_SCALER_CONFIG_LEN      260
-#define VPE_DIS_OFFSET_CFG_LEN     12
-/**************************************************/
-/*********** End of command id ********************/
-/**************************************************/
-
-struct msm_vpe_cmd {
-	int32_t  id;
-	uint16_t length;
-	void     *value;
-};
-
-struct vpe_cmd_type {
-	uint16_t id;
-	uint32_t length;
-};
-
-struct vpe_isr_queue_cmd_type {
-	struct list_head            list;
-	uint32_t                    irq_status;
-};
-
-enum VPE_MESSAGE_ID {
-	MSG_ID_VPE_OUTPUT_V = 7, /* To match with that of VFE */
-	MSG_ID_VPE_OUTPUT_ST_L,
-	MSG_ID_VPE_OUTPUT_ST_R,
-};
-
-enum vpe_state {
-	VPE_STATE_IDLE,
-	VPE_STATE_INIT,
-	VPE_STATE_ACTIVE,
-};
-
-struct vpe_device_type {
-	/* device related. */
-	int   vpeirq;
-	void __iomem      *vpebase;
-	struct resource	  *vpemem;
-	struct resource   *vpeio;
-	void        *device_extdata;
-};
-
-struct dis_offset_type {
-	int32_t dis_offset_x;
-	int32_t dis_offset_y;
-	uint32_t frame_id;
-};
-
-struct vpe_ctrl_type {
-	spinlock_t        tasklet_lock;
-	spinlock_t        state_lock;
-	spinlock_t        ops_lock;
-
-	struct list_head  tasklet_q;
-	void              *syncdata;
-	uint16_t          op_mode;
-	void              *extdata;
-	uint32_t          extlen;
-	struct msm_vpe_callback *resp;
-	uint32_t          in_h_w;
-	uint32_t          out_h;  /* this is BEFORE rotation. */
-	uint32_t          out_w;  /* this is BEFORE rotation. */
-	uint32_t          dis_en;
-	struct timespec   ts;
-	struct dis_offset_type   dis_offset;
-	uint32_t          pcbcr_before_dis;
-	uint32_t          pcbcr_dis_offset;
-	int               output_type;
-	int               frame_pack;
-	uint8_t           pad_2k_bool;
-	enum vpe_state    state;
-	unsigned long     out_y_addr;
-	unsigned long     out_cbcr_addr;
-};
-
-/*
-* vpe_input_update
-*
-* Define the parameters for output plane
-*/
-/* this is the dimension of ROI.  width / height. */
-struct vpe_src_size_packed {
-	uint32_t        src_w;
-	uint32_t        src_h;
-};
-
-struct vpe_src_xy_packed {
-	uint32_t        src_x;
-	uint32_t        src_y;
-};
-
-struct vpe_input_plane_update_type {
-	struct vpe_src_size_packed             src_roi_size;
-	/* DIS updates this set. */
-	struct vpe_src_xy_packed               src_roi_offset;
-	/* input address*/
-	uint8_t                         *src_p0_addr;
-	uint8_t                         *src_p1_addr;
-};
-
-struct vpe_msg_stats{
-	uint32_t    buffer;
-	uint32_t    frameCounter;
-};
-
-struct vpe_msg_output {
-	uint8_t   output_id;
-	uint32_t  p0_Buffer;
-	uint32_t  p1_Buffer;
-	uint32_t  p2_Buffer;
-	uint32_t  frameCounter;
-};
-
-struct vpe_message {
-	uint8_t  _d;
-	union {
-		struct vpe_msg_output              msgOut;
-		struct vpe_msg_stats               msgStats;
-	} _u;
-};
-
-#define SCALER_PHASE_BITS 29
-#define HAL_MDP_PHASE_STEP_2P50    0x50000000
-#define HAL_MDP_PHASE_STEP_1P66    0x35555555
-#define HAL_MDP_PHASE_STEP_1P25    0x28000000
-
-struct phase_val_t {
-	int32_t phase_init_x;
-	int32_t phase_init_y;
-	int32_t phase_step_x;
-	int32_t phase_step_y;
-};
-
-extern struct vpe_ctrl_type *vpe_ctrl;
-
-int msm_vpe_open(void);
-int msm_vpe_release(void);
-int msm_vpe_reg(struct msm_vpe_callback *presp);
-void msm_send_frame_to_vpe(uint32_t pyaddr, uint32_t pcbcraddr,
-	struct timespec *ts, int output_id);
-int msm_vpe_config(struct msm_vpe_cfg_cmd *cmd, void *data);
-int msm_vpe_cfg_update(void *pinfo);
-void msm_vpe_offset_update(int frame_pack, uint32_t pyaddr, uint32_t pcbcraddr,
-	struct timespec *ts, int output_id, struct msm_st_half st_half,
-	int frameid);
-#endif /*_msm_vpe1_h_*/
-
diff --git a/drivers/media/video/msm/mt9d112.c b/drivers/media/video/msm/mt9d112.c
deleted file mode 100644
index 9c19965..0000000
--- a/drivers/media/video/msm/mt9d112.c
+++ /dev/null
@@ -1,846 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/module.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include "mt9d112.h"
-
-/* Micron MT9D112 Registers and their values */
-/* Sensor Core Registers */
-#define  REG_MT9D112_MODEL_ID 0x3000
-#define  MT9D112_MODEL_ID     0x1580
-
-/*  SOC Registers Page 1  */
-#define  REG_MT9D112_SENSOR_RESET     0x301A
-#define  REG_MT9D112_STANDBY_CONTROL  0x3202
-#define  REG_MT9D112_MCU_BOOT         0x3386
-
-#define SENSOR_DEBUG 0
-
-struct mt9d112_work {
-	struct work_struct work;
-};
-
-static struct  mt9d112_work *mt9d112_sensorw;
-static struct  i2c_client *mt9d112_client;
-
-struct mt9d112_ctrl {
-	const struct msm_camera_sensor_info *sensordata;
-};
-
-
-static struct mt9d112_ctrl *mt9d112_ctrl;
-
-static DECLARE_WAIT_QUEUE_HEAD(mt9d112_wait_queue);
-DEFINE_SEMAPHORE(mt9d112_sem);
-static int16_t mt9d112_effect = CAMERA_EFFECT_OFF;
-
-/*=============================================================
-	EXTERNAL DECLARATIONS
-==============================================================*/
-extern struct mt9d112_reg mt9d112_regs;
-
-
-/*=============================================================*/
-
-static int mt9d112_reset(const struct msm_camera_sensor_info *dev)
-{
-	int rc = 0;
-
-	rc = gpio_request(dev->sensor_reset, "mt9d112");
-
-	if (!rc) {
-		rc = gpio_direction_output(dev->sensor_reset, 0);
-		msleep(20);
-		gpio_set_value_cansleep(dev->sensor_reset, 1);
-		msleep(20);
-	}
-
-	return rc;
-}
-
-static int32_t mt9d112_i2c_txdata(unsigned short saddr,
-	unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		},
-	};
-
-#if SENSOR_DEBUG
-	if (length == 2)
-		CDBG("msm_io_i2c_w: 0x%04x 0x%04x\n",
-			*(u16 *) txdata, *(u16 *) (txdata + 2));
-	else if (length == 4)
-		CDBG("msm_io_i2c_w: 0x%04x\n", *(u16 *) txdata);
-	else
-		CDBG("msm_io_i2c_w: length = %d\n", length);
-#endif
-	if (i2c_transfer(mt9d112_client->adapter, msg, 1) < 0) {
-		CDBG("mt9d112_i2c_txdata failed\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t mt9d112_i2c_write(unsigned short saddr,
-	unsigned short waddr, unsigned short wdata, enum mt9d112_width width)
-{
-	int32_t rc = -EIO;
-	unsigned char buf[4];
-
-	memset(buf, 0, sizeof(buf));
-	switch (width) {
-	case WORD_LEN: {
-		buf[0] = (waddr & 0xFF00)>>8;
-		buf[1] = (waddr & 0x00FF);
-		buf[2] = (wdata & 0xFF00)>>8;
-		buf[3] = (wdata & 0x00FF);
-
-		rc = mt9d112_i2c_txdata(saddr, buf, 4);
-	}
-		break;
-
-	case BYTE_LEN: {
-		buf[0] = waddr;
-		buf[1] = wdata;
-		rc = mt9d112_i2c_txdata(saddr, buf, 2);
-	}
-		break;
-
-	default:
-		break;
-	}
-
-	if (rc < 0)
-		CDBG(
-		"i2c_write failed, addr = 0x%x, val = 0x%x!\n",
-		waddr, wdata);
-
-	return rc;
-}
-
-static int32_t mt9d112_i2c_write_table(
-	struct mt9d112_i2c_reg_conf const *reg_conf_tbl,
-	int num_of_items_in_table)
-{
-	int i;
-	int32_t rc = -EIO;
-
-	for (i = 0; i < num_of_items_in_table; i++) {
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			reg_conf_tbl->waddr, reg_conf_tbl->wdata,
-			reg_conf_tbl->width);
-		if (rc < 0)
-			break;
-		if (reg_conf_tbl->mdelay_time != 0)
-			mdelay(reg_conf_tbl->mdelay_time);
-		reg_conf_tbl++;
-	}
-
-	return rc;
-}
-
-static int mt9d112_i2c_rxdata(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-	{
-		.addr   = saddr,
-		.flags = 0,
-		.len   = 2,
-		.buf   = rxdata,
-	},
-	{
-		.addr   = saddr,
-		.flags = I2C_M_RD,
-		.len   = length,
-		.buf   = rxdata,
-	},
-	};
-
-#if SENSOR_DEBUG
-	if (length == 2)
-		CDBG("msm_io_i2c_r: 0x%04x 0x%04x\n",
-			*(u16 *) rxdata, *(u16 *) (rxdata + 2));
-	else if (length == 4)
-		CDBG("msm_io_i2c_r: 0x%04x\n", *(u16 *) rxdata);
-	else
-		CDBG("msm_io_i2c_r: length = %d\n", length);
-#endif
-
-	if (i2c_transfer(mt9d112_client->adapter, msgs, 2) < 0) {
-		CDBG("mt9d112_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t mt9d112_i2c_read(unsigned short   saddr,
-	unsigned short raddr, unsigned short *rdata, enum mt9d112_width width)
-{
-	int32_t rc = 0;
-	unsigned char buf[4];
-
-	if (!rdata)
-		return -EIO;
-
-	memset(buf, 0, sizeof(buf));
-
-	switch (width) {
-	case WORD_LEN: {
-		buf[0] = (raddr & 0xFF00)>>8;
-		buf[1] = (raddr & 0x00FF);
-
-		rc = mt9d112_i2c_rxdata(saddr, buf, 2);
-		if (rc < 0)
-			return rc;
-
-		*rdata = buf[0] << 8 | buf[1];
-	}
-		break;
-
-	default:
-		break;
-	}
-
-	if (rc < 0)
-		CDBG("mt9d112_i2c_read failed!\n");
-
-	return rc;
-}
-
-static int32_t mt9d112_set_lens_roll_off(void)
-{
-	int32_t rc = 0;
-	rc = mt9d112_i2c_write_table(&mt9d112_regs.rftbl[0],
-								 mt9d112_regs.rftbl_size);
-	return rc;
-}
-
-static long mt9d112_reg_init(void)
-{
-	int32_t array_length;
-	int32_t i;
-	long rc;
-
-	/* PLL Setup Start */
-	rc = mt9d112_i2c_write_table(&mt9d112_regs.plltbl[0],
-					mt9d112_regs.plltbl_size);
-
-	if (rc < 0)
-		return rc;
-	/* PLL Setup End   */
-
-	array_length = mt9d112_regs.prev_snap_reg_settings_size;
-
-	/* Configure sensor for Preview mode and Snapshot mode */
-	for (i = 0; i < array_length; i++) {
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-		  mt9d112_regs.prev_snap_reg_settings[i].register_address,
-		  mt9d112_regs.prev_snap_reg_settings[i].register_value,
-		  WORD_LEN);
-
-		if (rc < 0)
-			return rc;
-	}
-
-	/* Configure for Noise Reduction, Saturation and Aperture Correction */
-	array_length = mt9d112_regs.noise_reduction_reg_settings_size;
-
-	for (i = 0; i < array_length; i++) {
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			mt9d112_regs.noise_reduction_reg_settings[i].register_address,
-			mt9d112_regs.noise_reduction_reg_settings[i].register_value,
-			WORD_LEN);
-
-		if (rc < 0)
-			return rc;
-	}
-
-	/* Set Color Kill Saturation point to optimum value */
-	rc =
-	mt9d112_i2c_write(mt9d112_client->addr,
-	0x35A4,
-	0x0593,
-	WORD_LEN);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9d112_i2c_write_table(&mt9d112_regs.stbl[0],
-					mt9d112_regs.stbl_size);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9d112_set_lens_roll_off();
-	if (rc < 0)
-		return rc;
-
-	return 0;
-}
-
-static long mt9d112_set_effect(int mode, int effect)
-{
-	uint16_t reg_addr;
-	uint16_t reg_val;
-	long rc = 0;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		/* Context A Special Effects */
-		reg_addr = 0x2799;
-		break;
-
-	case SENSOR_RAW_SNAPSHOT_MODE:
-	case SENSOR_SNAPSHOT_MODE:
-		/* Context B Special Effects */
-		reg_addr = 0x279B;
-		break;
-
-	default:
-		reg_addr = 0x2799;
-		break;
-	}
-
-	switch (effect) {
-	case CAMERA_EFFECT_OFF: {
-		reg_val = 0x6440;
-
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x338C, reg_addr, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x3390, reg_val, WORD_LEN);
-		if (rc < 0)
-			return rc;
-	}
-			break;
-
-	case CAMERA_EFFECT_MONO: {
-		reg_val = 0x6441;
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x338C, reg_addr, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x3390, reg_val, WORD_LEN);
-		if (rc < 0)
-			return rc;
-	}
-		break;
-
-	case CAMERA_EFFECT_NEGATIVE: {
-		reg_val = 0x6443;
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x338C, reg_addr, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x3390, reg_val, WORD_LEN);
-		if (rc < 0)
-			return rc;
-	}
-		break;
-
-	case CAMERA_EFFECT_SOLARIZE: {
-		reg_val = 0x6445;
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x338C, reg_addr, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x3390, reg_val, WORD_LEN);
-		if (rc < 0)
-			return rc;
-	}
-		break;
-
-	case CAMERA_EFFECT_SEPIA: {
-		reg_val = 0x6442;
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x338C, reg_addr, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x3390, reg_val, WORD_LEN);
-		if (rc < 0)
-			return rc;
-	}
-		break;
-
-	default: {
-		reg_val = 0x6440;
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x338C, reg_addr, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc = mt9d112_i2c_write(mt9d112_client->addr,
-			0x3390, reg_val, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		return -EINVAL;
-	}
-	}
-	mt9d112_effect = effect;
-	/* Refresh Sequencer */
-	rc = mt9d112_i2c_write(mt9d112_client->addr,
-		0x338C, 0xA103, WORD_LEN);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9d112_i2c_write(mt9d112_client->addr,
-		0x3390, 0x0005, WORD_LEN);
-
-	return rc;
-}
-
-static long mt9d112_set_sensor_mode(int mode)
-{
-	uint16_t clock;
-	long rc = 0;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x338C, 0xA20C, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x3390, 0x0004, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x338C, 0xA215, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x3390, 0x0004, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x338C, 0xA20B, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x3390, 0x0000, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		clock = 0x23C;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x341C, clock, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x338C, 0xA103, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x3390, 0x0001, WORD_LEN);
-		if (rc < 0)
-			return rc;
-		mdelay(5);
-
-		break;
-
-	case SENSOR_SNAPSHOT_MODE:
-		/* Switch to lower fps for Snapshot */
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x341C, 0x0120, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x338C, 0xA120, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		msleep(40);/*waiting for the delay of one frame*/
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x3390, 0x0002, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		msleep(80);/*waiting for the delay of two frames*/
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x338C, 0xA103, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		msleep(40);/*waiting for the delay of one frame*/
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x3390, 0x0002, WORD_LEN);
-		if (rc < 0)
-			return rc;
-		break;
-
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		/* Setting the effect to CAMERA_EFFECT_OFF */
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x338C, 0x279B, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-			0x3390, 0x6440, WORD_LEN);
-		if (rc < 0)
-			return rc;
-		msleep(40);/*waiting for the delay of one frame*/
-		/* Switch to lower fps for Snapshot */
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x341C, 0x0120, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x338C, 0xA120, WORD_LEN);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x3390, 0x0002, WORD_LEN);
-		if (rc < 0)
-			return rc;
-		msleep(80);/*waiting for the delay of two frames frame*/
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x338C, 0xA103, WORD_LEN);
-		if (rc < 0)
-			return rc;
-		msleep(40);/*waiting for the delay of one frame*/
-		rc =
-			mt9d112_i2c_write(mt9d112_client->addr,
-				0x3390, 0x0002, WORD_LEN);
-		if (rc < 0)
-			return rc;
-		break;
-
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static int mt9d112_sensor_init_probe(const struct msm_camera_sensor_info *data)
-{
-	uint16_t model_id = 0;
-	int rc = 0;
-
-	CDBG("init entry \n");
-	rc = mt9d112_reset(data);
-	if (rc < 0) {
-		CDBG("reset failed!\n");
-		goto init_probe_fail;
-	}
-
-	msm_camio_clk_rate_set(24000000);
-	msleep(20);
-
-	/* Micron suggested Power up block Start:
-	* Put MCU into Reset - Stop MCU */
-	rc = mt9d112_i2c_write(mt9d112_client->addr,
-		REG_MT9D112_MCU_BOOT, 0x0501, WORD_LEN);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	/* Pull MCU from Reset - Start MCU */
-	rc = mt9d112_i2c_write(mt9d112_client->addr,
-		REG_MT9D112_MCU_BOOT, 0x0500, WORD_LEN);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	mdelay(5);
-
-	/* Micron Suggested - Power up block */
-	rc = mt9d112_i2c_write(mt9d112_client->addr,
-		REG_MT9D112_SENSOR_RESET, 0x0ACC, WORD_LEN);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	rc = mt9d112_i2c_write(mt9d112_client->addr,
-		REG_MT9D112_STANDBY_CONTROL, 0x0008, WORD_LEN);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	/* FUSED_DEFECT_CORRECTION */
-	rc = mt9d112_i2c_write(mt9d112_client->addr,
-		0x33F4, 0x031D, WORD_LEN);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	mdelay(5);
-
-	/* Micron suggested Power up block End */
-	/* Read the Model ID of the sensor */
-	rc = mt9d112_i2c_read(mt9d112_client->addr,
-		REG_MT9D112_MODEL_ID, &model_id, WORD_LEN);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	CDBG("mt9d112 model_id = 0x%x\n", model_id);
-
-	/* Check if it matches it with the value in Datasheet */
-	if (model_id != MT9D112_MODEL_ID) {
-		rc = -EINVAL;
-		goto init_probe_fail;
-	}
-
-	rc = mt9d112_reg_init();
-	if (rc < 0)
-		goto init_probe_fail;
-
-	return rc;
-
-init_probe_fail:
-	return rc;
-}
-
-int mt9d112_sensor_init(const struct msm_camera_sensor_info *data)
-{
-	int rc = 0;
-
-	mt9d112_ctrl = kzalloc(sizeof(struct mt9d112_ctrl), GFP_KERNEL);
-	if (!mt9d112_ctrl) {
-		CDBG("mt9d112_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-
-	if (data)
-		mt9d112_ctrl->sensordata = data;
-
-	/* Input MCLK = 24MHz */
-	msm_camio_clk_rate_set(24000000);
-	mdelay(5);
-
-	msm_camio_camif_pad_reg_reset();
-
-	rc = mt9d112_sensor_init_probe(data);
-	if (rc < 0) {
-		CDBG("mt9d112_sensor_init failed!\n");
-		goto init_fail;
-	}
-
-init_done:
-	return rc;
-
-init_fail:
-	kfree(mt9d112_ctrl);
-	return rc;
-}
-
-static int mt9d112_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&mt9d112_wait_queue);
-	return 0;
-}
-
-int mt9d112_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cfg_data;
-	long   rc = 0;
-
-	if (copy_from_user(&cfg_data,
-			(void *)argp,
-			sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-
-	/* down(&mt9d112_sem); */
-
-	CDBG("mt9d112_ioctl, cfgtype = %d, mode = %d\n",
-		cfg_data.cfgtype, cfg_data.mode);
-
-		switch (cfg_data.cfgtype) {
-		case CFG_SET_MODE:
-			rc = mt9d112_set_sensor_mode(
-						cfg_data.mode);
-			break;
-
-		case CFG_SET_EFFECT:
-			rc = mt9d112_set_effect(cfg_data.mode,
-						cfg_data.cfg.effect);
-			break;
-
-		case CFG_GET_AF_MAX_STEPS:
-		default:
-			rc = -EINVAL;
-			break;
-		}
-
-	/* up(&mt9d112_sem); */
-
-	return rc;
-}
-
-int mt9d112_sensor_release(void)
-{
-	int rc = 0;
-
-	/* down(&mt9d112_sem); */
-	gpio_set_value_cansleep(mt9d112_ctrl->sensordata->sensor_reset, 0);
-	msleep(20);
-	gpio_free(mt9d112_ctrl->sensordata->sensor_reset);
-	kfree(mt9d112_ctrl);
-	/* up(&mt9d112_sem); */
-
-	return rc;
-}
-
-static int mt9d112_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		rc = -ENOTSUPP;
-		goto probe_failure;
-	}
-
-	mt9d112_sensorw =
-		kzalloc(sizeof(struct mt9d112_work), GFP_KERNEL);
-
-	if (!mt9d112_sensorw) {
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, mt9d112_sensorw);
-	mt9d112_init_client(client);
-	mt9d112_client = client;
-
-	CDBG("mt9d112_probe succeeded!\n");
-
-	return 0;
-
-probe_failure:
-	kfree(mt9d112_sensorw);
-	mt9d112_sensorw = NULL;
-	CDBG("mt9d112_probe failed!\n");
-	return rc;
-}
-
-static const struct i2c_device_id mt9d112_i2c_id[] = {
-	{ "mt9d112", 0},
-	{ },
-};
-
-static struct i2c_driver mt9d112_i2c_driver = {
-	.id_table = mt9d112_i2c_id,
-	.probe  = mt9d112_i2c_probe,
-	.remove = __exit_p(mt9d112_i2c_remove),
-	.driver = {
-		.name = "mt9d112",
-	},
-};
-
-static int mt9d112_sensor_probe(const struct msm_camera_sensor_info *info,
-				struct msm_sensor_ctrl *s)
-{
-	int rc = i2c_add_driver(&mt9d112_i2c_driver);
-	if (rc < 0 || mt9d112_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_done;
-	}
-
-	/* Input MCLK = 24MHz */
-	msm_camio_clk_rate_set(24000000);
-	mdelay(5);
-
-	rc = mt9d112_sensor_init_probe(info);
-	if (rc < 0) {
-		gpio_free(info->sensor_reset);
-		goto probe_done;
-	}
-	s->s_init = mt9d112_sensor_init;
-	s->s_release = mt9d112_sensor_release;
-	s->s_config  = mt9d112_sensor_config;
-	s->s_camera_type = FRONT_CAMERA_2D;
-	s->s_mount_angle  = 0;
-	gpio_set_value_cansleep(info->sensor_reset, 0);
-	msleep(20);
-	gpio_free(info->sensor_reset);
-
-probe_done:
-	CDBG("%s %s:%d\n", __FILE__, __func__, __LINE__);
-	return rc;
-}
-
-static int __mt9d112_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, mt9d112_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __mt9d112_probe,
-	.driver = {
-		.name = "msm_camera_mt9d112",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init mt9d112_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(mt9d112_init);
diff --git a/drivers/media/video/msm/mt9d112.h b/drivers/media/video/msm/mt9d112.h
deleted file mode 100644
index f07d732..0000000
--- a/drivers/media/video/msm/mt9d112.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef MT9D112_H
-#define MT9D112_H
-
-#include <linux/types.h>
-#include <mach/camera.h>
-
-extern struct mt9d112_reg mt9d112_regs;
-
-enum mt9d112_width {
-	WORD_LEN,
-	BYTE_LEN
-};
-
-struct mt9d112_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-	enum mt9d112_width width;
-	unsigned short mdelay_time;
-};
-
-struct mt9d112_reg {
-	const struct register_address_value_pair *prev_snap_reg_settings;
-	uint16_t prev_snap_reg_settings_size;
-	const struct register_address_value_pair *noise_reduction_reg_settings;
-	uint16_t noise_reduction_reg_settings_size;
-	const struct mt9d112_i2c_reg_conf *plltbl;
-	uint16_t plltbl_size;
-	const struct mt9d112_i2c_reg_conf *stbl;
-	uint16_t stbl_size;
-	const struct mt9d112_i2c_reg_conf *rftbl;
-	uint16_t rftbl_size;
-};
-
-#endif /* MT9D112_H */
diff --git a/drivers/media/video/msm/mt9d112_reg.c b/drivers/media/video/msm/mt9d112_reg.c
deleted file mode 100644
index 6c35cbc..0000000
--- a/drivers/media/video/msm/mt9d112_reg.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "mt9d112.h"
-
-
-struct register_address_value_pair const
-preview_snapshot_mode_reg_settings_array[] = {
-	{0x338C, 0x2703},
-	{0x3390, 800},    /* Output Width (P) = 640 */
-	{0x338C, 0x2705},
-	{0x3390, 600},    /* Output Height (P) = 480 */
-	{0x338C, 0x2707},
-	{0x3390, 0x0640}, /* Output Width (S) = 1600 */
-	{0x338C, 0x2709},
-	{0x3390, 0x04B0}, /* Output Height (S) = 1200 */
-	{0x338C, 0x270D},
-	{0x3390, 0x0000}, /* Row Start (P) = 0 */
-	{0x338C, 0x270F},
-	{0x3390, 0x0000}, /* Column Start (P) = 0 */
-	{0x338C, 0x2711},
-	{0x3390, 0x04BD}, /* Row End (P) = 1213 */
-	{0x338C, 0x2713},
-	{0x3390, 0x064D}, /* Column End (P) = 1613 */
-	{0x338C, 0x2715},
-	{0x3390, 0x0000}, /* Extra Delay (P) = 0 */
-	{0x338C, 0x2717},
-	{0x3390, 0x2111}, /* Row Speed (P) = 8465 */
-	{0x338C, 0x2719},
-	{0x3390, 0x046C}, /* Read Mode (P) = 1132 */
-	{0x338C, 0x271B},
-	{0x3390, 0x024F}, /* Sensor_Sample_Time_pck(P) = 591 */
-	{0x338C, 0x271D},
-	{0x3390, 0x0102}, /* Sensor_Fine_Correction(P) = 258 */
-	{0x338C, 0x271F},
-	{0x3390, 0x0279}, /* Sensor_Fine_IT_min(P) = 633 */
-	{0x338C, 0x2721},
-	{0x3390, 0x0155}, /* Sensor_Fine_IT_max_margin(P) = 341 */
-	{0x338C, 0x2723},
-	{0x3390, 659},    /* Frame Lines (P) = 679 */
-	{0x338C, 0x2725},
-	{0x3390, 0x061B}, /* Line Length (P) = 1563 */
-	{0x338C, 0x2727},
-	{0x3390, 0x2020},
-	{0x338C, 0x2729},
-	{0x3390, 0x2020},
-	{0x338C, 0x272B},
-	{0x3390, 0x1020},
-	{0x338C, 0x272D},
-	{0x3390, 0x2007},
-	{0x338C, 0x272F},
-	{0x3390, 0x0004}, /* Row Start(S) = 4 */
-	{0x338C, 0x2731},
-	{0x3390, 0x0004}, /* Column Start(S) = 4 */
-	{0x338C, 0x2733},
-	{0x3390, 0x04BB}, /* Row End(S) = 1211 */
-	{0x338C, 0x2735},
-	{0x3390, 0x064B}, /* Column End(S) = 1611 */
-	{0x338C, 0x2737},
-	{0x3390, 0x04CE}, /* Extra Delay(S) = 1230 */
-	{0x338C, 0x2739},
-	{0x3390, 0x2111}, /* Row Speed(S) = 8465 */
-	{0x338C, 0x273B},
-	{0x3390, 0x0024}, /* Read Mode(S) = 36 */
-	{0x338C, 0x273D},
-	{0x3390, 0x0120}, /* Sensor sample time pck(S) = 288 */
-	{0x338C, 0x2741},
-	{0x3390, 0x0169}, /* Sensor_Fine_IT_min(P) = 361 */
-	{0x338C, 0x2745},
-	{0x3390, 0x04FF}, /* Frame Lines(S) = 1279 */
-	{0x338C, 0x2747},
-	{0x3390, 0x0824}, /* Line Length(S) = 2084 */
-	{0x338C, 0x2751},
-	{0x3390, 0x0000}, /* Crop_X0(P) = 0 */
-	{0x338C, 0x2753},
-	{0x3390, 0x0320}, /* Crop_X1(P) = 800 */
-	{0x338C, 0x2755},
-	{0x3390, 0x0000}, /* Crop_Y0(P) = 0 */
-	{0x338C, 0x2757},
-	{0x3390, 0x0258}, /* Crop_Y1(P) = 600 */
-	{0x338C, 0x275F},
-	{0x3390, 0x0000}, /* Crop_X0(S) = 0 */
-	{0x338C, 0x2761},
-	{0x3390, 0x0640}, /* Crop_X1(S) = 1600 */
-	{0x338C, 0x2763},
-	{0x3390, 0x0000}, /* Crop_Y0(S) = 0 */
-	{0x338C, 0x2765},
-	{0x3390, 0x04B0}, /* Crop_Y1(S) = 1200 */
-	{0x338C, 0x222E},
-	{0x3390, 0x00A0}, /* R9 Step = 160 */
-	{0x338C, 0xA408},
-	{0x3390, 0x001F},
-	{0x338C, 0xA409},
-	{0x3390, 0x0021},
-	{0x338C, 0xA40A},
-	{0x3390, 0x0025},
-	{0x338C, 0xA40B},
-	{0x3390, 0x0027},
-	{0x338C, 0x2411},
-	{0x3390, 0x00A0},
-	{0x338C, 0x2413},
-	{0x3390, 0x00C0},
-	{0x338C, 0x2415},
-	{0x3390, 0x00A0},
-	{0x338C, 0x2417},
-	{0x3390, 0x00C0},
-	{0x338C, 0x2799},
-	{0x3390, 0x6408}, /* MODE_SPEC_EFFECTS(P) */
-	{0x338C, 0x279B},
-	{0x3390, 0x6408}, /* MODE_SPEC_EFFECTS(S) */
-};
-
-static struct register_address_value_pair const
-noise_reduction_reg_settings_array[] = {
-	{0x338C, 0xA76D},
-	{0x3390, 0x0003},
-	{0x338C, 0xA76E},
-	{0x3390, 0x0003},
-	{0x338C, 0xA76F},
-	{0x3390, 0},
-	{0x338C, 0xA770},
-	{0x3390, 21},
-	{0x338C, 0xA771},
-	{0x3390, 37},
-	{0x338C, 0xA772},
-	{0x3390, 63},
-	{0x338C, 0xA773},
-	{0x3390, 100},
-	{0x338C, 0xA774},
-	{0x3390, 128},
-	{0x338C, 0xA775},
-	{0x3390, 151},
-	{0x338C, 0xA776},
-	{0x3390, 169},
-	{0x338C, 0xA777},
-	{0x3390, 186},
-	{0x338C, 0xA778},
-	{0x3390, 199},
-	{0x338C, 0xA779},
-	{0x3390, 210},
-	{0x338C, 0xA77A},
-	{0x3390, 220},
-	{0x338C, 0xA77B},
-	{0x3390, 228},
-	{0x338C, 0xA77C},
-	{0x3390, 234},
-	{0x338C, 0xA77D},
-	{0x3390, 240},
-	{0x338C, 0xA77E},
-	{0x3390, 244},
-	{0x338C, 0xA77F},
-	{0x3390, 248},
-	{0x338C, 0xA780},
-	{0x3390, 252},
-	{0x338C, 0xA781},
-	{0x3390, 255},
-	{0x338C, 0xA782},
-	{0x3390, 0},
-	{0x338C, 0xA783},
-	{0x3390, 21},
-	{0x338C, 0xA784},
-	{0x3390, 37},
-	{0x338C, 0xA785},
-	{0x3390, 63},
-	{0x338C, 0xA786},
-	{0x3390, 100},
-	{0x338C, 0xA787},
-	{0x3390, 128},
-	{0x338C, 0xA788},
-	{0x3390, 151},
-	{0x338C, 0xA789},
-	{0x3390, 169},
-	{0x338C, 0xA78A},
-	{0x3390, 186},
-	{0x338C, 0xA78B},
-	{0x3390, 199},
-	{0x338C, 0xA78C},
-	{0x3390, 210},
-	{0x338C, 0xA78D},
-	{0x3390, 220},
-	{0x338C, 0xA78E},
-	{0x3390, 228},
-	{0x338C, 0xA78F},
-	{0x3390, 234},
-	{0x338C, 0xA790},
-	{0x3390, 240},
-	{0x338C, 0xA791},
-	{0x3390, 244},
-	{0x338C, 0xA793},
-	{0x3390, 252},
-	{0x338C, 0xA794},
-	{0x3390, 255},
-	{0x338C, 0xA103},
-	{0x3390, 6},
-};
-
-static const struct mt9d112_i2c_reg_conf const lens_roll_off_tbl[] = {
-	{ 0x34CE, 0x81A0, WORD_LEN, 0 },
-	{ 0x34D0, 0x6331, WORD_LEN, 0 },
-	{ 0x34D2, 0x3394, WORD_LEN, 0 },
-	{ 0x34D4, 0x9966, WORD_LEN, 0 },
-	{ 0x34D6, 0x4B25, WORD_LEN, 0 },
-	{ 0x34D8, 0x2670, WORD_LEN, 0 },
-	{ 0x34DA, 0x724C, WORD_LEN, 0 },
-	{ 0x34DC, 0xFFFD, WORD_LEN, 0 },
-	{ 0x34DE, 0x00CA, WORD_LEN, 0 },
-	{ 0x34E6, 0x00AC, WORD_LEN, 0 },
-	{ 0x34EE, 0x0EE1, WORD_LEN, 0 },
-	{ 0x34F6, 0x0D87, WORD_LEN, 0 },
-	{ 0x3500, 0xE1F7, WORD_LEN, 0 },
-	{ 0x3508, 0x1CF4, WORD_LEN, 0 },
-	{ 0x3510, 0x1D28, WORD_LEN, 0 },
-	{ 0x3518, 0x1F26, WORD_LEN, 0 },
-	{ 0x3520, 0x2220, WORD_LEN, 0 },
-	{ 0x3528, 0x333D, WORD_LEN, 0 },
-	{ 0x3530, 0x15D9, WORD_LEN, 0 },
-	{ 0x3538, 0xCFB8, WORD_LEN, 0 },
-	{ 0x354C, 0x05FE, WORD_LEN, 0 },
-	{ 0x3544, 0x05F8, WORD_LEN, 0 },
-	{ 0x355C, 0x0596, WORD_LEN, 0 },
-	{ 0x3554, 0x0611, WORD_LEN, 0 },
-	{ 0x34E0, 0x00F2, WORD_LEN, 0 },
-	{ 0x34E8, 0x00A8, WORD_LEN, 0 },
-	{ 0x34F0, 0x0F7B, WORD_LEN, 0 },
-	{ 0x34F8, 0x0CD7, WORD_LEN, 0 },
-	{ 0x3502, 0xFEDB, WORD_LEN, 0 },
-	{ 0x350A, 0x13E4, WORD_LEN, 0 },
-	{ 0x3512, 0x1F2C, WORD_LEN, 0 },
-	{ 0x351A, 0x1D20, WORD_LEN, 0 },
-	{ 0x3522, 0x2422, WORD_LEN, 0 },
-	{ 0x352A, 0x2925, WORD_LEN, 0 },
-	{ 0x3532, 0x1D04, WORD_LEN, 0 },
-	{ 0x353A, 0xFBF2, WORD_LEN, 0 },
-	{ 0x354E, 0x0616, WORD_LEN, 0 },
-	{ 0x3546, 0x0597, WORD_LEN, 0 },
-	{ 0x355E, 0x05CD, WORD_LEN, 0 },
-	{ 0x3556, 0x0529, WORD_LEN, 0 },
-	{ 0x34E4, 0x00B2, WORD_LEN, 0 },
-	{ 0x34EC, 0x005E, WORD_LEN, 0 },
-	{ 0x34F4, 0x0F43, WORD_LEN, 0 },
-	{ 0x34FC, 0x0E2F, WORD_LEN, 0 },
-	{ 0x3506, 0xF9FC, WORD_LEN, 0 },
-	{ 0x350E, 0x0CE4, WORD_LEN, 0 },
-	{ 0x3516, 0x1E1E, WORD_LEN, 0 },
-	{ 0x351E, 0x1B19, WORD_LEN, 0 },
-	{ 0x3526, 0x151B, WORD_LEN, 0 },
-	{ 0x352E, 0x1416, WORD_LEN, 0 },
-	{ 0x3536, 0x10FC, WORD_LEN, 0 },
-	{ 0x353E, 0xC018, WORD_LEN, 0 },
-	{ 0x3552, 0x06B4, WORD_LEN, 0 },
-	{ 0x354A, 0x0506, WORD_LEN, 0 },
-	{ 0x3562, 0x06AB, WORD_LEN, 0 },
-	{ 0x355A, 0x063A, WORD_LEN, 0 },
-	{ 0x34E2, 0x00E5, WORD_LEN, 0 },
-	{ 0x34EA, 0x008B, WORD_LEN, 0 },
-	{ 0x34F2, 0x0E4C, WORD_LEN, 0 },
-	{ 0x34FA, 0x0CA3, WORD_LEN, 0 },
-	{ 0x3504, 0x0907, WORD_LEN, 0 },
-	{ 0x350C, 0x1DFD, WORD_LEN, 0 },
-	{ 0x3514, 0x1E24, WORD_LEN, 0 },
-	{ 0x351C, 0x2529, WORD_LEN, 0 },
-	{ 0x3524, 0x1D20, WORD_LEN, 0 },
-	{ 0x352C, 0x2332, WORD_LEN, 0 },
-	{ 0x3534, 0x10E9, WORD_LEN, 0 },
-	{ 0x353C, 0x0BCB, WORD_LEN, 0 },
-	{ 0x3550, 0x04EF, WORD_LEN, 0 },
-	{ 0x3548, 0x0609, WORD_LEN, 0 },
-	{ 0x3560, 0x0580, WORD_LEN, 0 },
-	{ 0x3558, 0x05DD, WORD_LEN, 0 },
-	{ 0x3540, 0x0000, WORD_LEN, 0 },
-	{ 0x3542, 0x0000, WORD_LEN, 0 }
-};
-
-static const struct mt9d112_i2c_reg_conf const pll_setup_tbl[] = {
-	{ 0x341E, 0x8F09, WORD_LEN, 0 },
-	{ 0x341C, 0x0250, WORD_LEN, 0 },
-	{ 0x341E, 0x8F09, WORD_LEN, 5 },
-	{ 0x341E, 0x8F08, WORD_LEN, 0 }
-};
-
-/* Refresh Sequencer */
-static const struct mt9d112_i2c_reg_conf const sequencer_tbl[] = {
-	{ 0x338C, 0x2799, WORD_LEN, 0},
-	{ 0x3390, 0x6440, WORD_LEN, 5},
-	{ 0x338C, 0x279B, WORD_LEN, 0},
-	{ 0x3390, 0x6440, WORD_LEN, 5},
-	{ 0x338C, 0xA103, WORD_LEN, 0},
-	{ 0x3390, 0x0005, WORD_LEN, 5},
-	{ 0x338C, 0xA103, WORD_LEN, 0},
-	{ 0x3390, 0x0006, WORD_LEN, 5}
-};
-
-struct mt9d112_reg mt9d112_regs = {
-	.prev_snap_reg_settings = &preview_snapshot_mode_reg_settings_array[0],
-	.prev_snap_reg_settings_size = ARRAY_SIZE(
-		preview_snapshot_mode_reg_settings_array),
-	.noise_reduction_reg_settings = &noise_reduction_reg_settings_array[0],
-	.noise_reduction_reg_settings_size = ARRAY_SIZE(
-		noise_reduction_reg_settings_array),
-	.plltbl = pll_setup_tbl,
-	.plltbl_size = ARRAY_SIZE(pll_setup_tbl),
-	.stbl = sequencer_tbl,
-	.stbl_size = ARRAY_SIZE(sequencer_tbl),
-	.rftbl = lens_roll_off_tbl,
-	.rftbl_size = ARRAY_SIZE(lens_roll_off_tbl)
-};
-
-
-
diff --git a/drivers/media/video/msm/mt9d113.c b/drivers/media/video/msm/mt9d113.c
deleted file mode 100644
index a32c804..0000000
--- a/drivers/media/video/msm/mt9d113.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include "mt9d113.h"
-
-/* Micron MT9D113 Registers and their values */
-#define  REG_MT9D113_MODEL_ID	0x0000
-#define  MT9D113_MODEL_ID		0x2580
-#define Q8						0x00000100
-
-struct mt9d113_work {
-	struct work_struct work;
-};
-
-static struct  mt9d113_work *mt9d113_sensorw;
-static struct  i2c_client *mt9d113_client;
-
-struct mt9d113_ctrl {
-	const struct msm_camera_sensor_info *sensordata;
-	uint32_t sensormode;
-	uint32_t fps_divider;/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;/* init to 1 * 0x00000400 */
-	uint16_t fps;
-	uint16_t curr_step_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint16_t total_lines_per_frame;
-	uint16_t config_csi;
-	enum mt9d113_resolution_t prev_res;
-	enum mt9d113_resolution_t pict_res;
-	enum mt9d113_resolution_t curr_res;
-	enum mt9d113_test_mode_t  set_test;
-};
-
-static struct mt9d113_ctrl *mt9d113_ctrl;
-
-static DECLARE_WAIT_QUEUE_HEAD(mt9d113_wait_queue);
-DEFINE_MUTEX(mt9d113_mut);
-
-static int mt9d113_i2c_rxdata(unsigned short saddr,
-				unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr   = saddr,
-			.flags = 0,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-		{
-			.addr   = saddr,
-			.flags = I2C_M_RD,
-			.len   = length,
-			.buf   = rxdata,
-		},
-	};
-	if (i2c_transfer(mt9d113_client->adapter, msgs, 2) < 0) {
-		CDBG("mt9d113_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-	return 0;
-}
-
-static int32_t mt9d113_i2c_read(unsigned short   saddr,
-				unsigned short raddr,
-				unsigned short *rdata,
-				enum mt9d113_width width)
-{
-	int32_t rc = 0;
-	unsigned char buf[4];
-	if (!rdata)
-		return -EIO;
-	memset(buf, 0, sizeof(buf));
-	switch (width) {
-	case WORD_LEN: {
-			buf[0] = (raddr & 0xFF00)>>8;
-			buf[1] = (raddr & 0x00FF);
-			rc = mt9d113_i2c_rxdata(saddr, buf, 2);
-			if (rc < 0)
-				return rc;
-			*rdata = buf[0] << 8 | buf[1];
-		}
-		break;
-	default:
-		break;
-	}
-	if (rc < 0)
-		CDBG("mt9d113_i2c_read failed !\n");
-	return rc;
-}
-
-static int32_t mt9d113_i2c_txdata(unsigned short saddr,
-				unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		},
-	};
-	if (i2c_transfer(mt9d113_client->adapter, msg, 1) < 0) {
-		CDBG("mt9d113_i2c_txdata failed\n");
-		return -EIO;
-	}
-	return 0;
-}
-
-static int32_t mt9d113_i2c_write(unsigned short saddr,
-				unsigned short waddr,
-				unsigned short wdata,
-				enum mt9d113_width width)
-{
-	int32_t rc = -EIO;
-	unsigned char buf[4];
-	memset(buf, 0, sizeof(buf));
-	switch (width) {
-	case WORD_LEN: {
-			buf[0] = (waddr & 0xFF00)>>8;
-			buf[1] = (waddr & 0x00FF);
-			buf[2] = (wdata & 0xFF00)>>8;
-			buf[3] = (wdata & 0x00FF);
-			rc = mt9d113_i2c_txdata(saddr, buf, 4);
-		}
-		break;
-	case BYTE_LEN: {
-			buf[0] = waddr;
-			buf[1] = wdata;
-			rc = mt9d113_i2c_txdata(saddr, buf, 2);
-		}
-		break;
-	default:
-		break;
-	}
-	if (rc < 0)
-		printk(KERN_ERR
-			"i2c_write failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, wdata);
-	return rc;
-}
-
-static int32_t mt9d113_i2c_write_table(
-				struct mt9d113_i2c_reg_conf
-				const *reg_conf_tbl,
-				int num_of_items_in_table)
-{
-	int i;
-	int32_t rc = -EIO;
-	for (i = 0; i < num_of_items_in_table; i++) {
-		rc = mt9d113_i2c_write(mt9d113_client->addr,
-				reg_conf_tbl->waddr, reg_conf_tbl->wdata,
-				WORD_LEN);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-	return rc;
-}
-
-static long mt9d113_reg_init(void)
-{
-	uint16_t data = 0;
-	int32_t rc = 0;
-	int count = 0;
-	struct msm_camera_csi_params mt9d113_csi_params;
-	if (!mt9d113_ctrl->config_csi) {
-		mt9d113_csi_params.lane_cnt = 1;
-		mt9d113_csi_params.data_format = CSI_8BIT;
-		mt9d113_csi_params.lane_assign = 0xe4;
-		mt9d113_csi_params.dpcm_scheme = 0;
-		mt9d113_csi_params.settle_cnt = 0x14;
-		rc = msm_camio_csi_config(&mt9d113_csi_params);
-		mt9d113_ctrl->config_csi = 1;
-		msleep(50);
-	}
-	/* Disable parallel and enable mipi*/
-	rc = mt9d113_i2c_write(mt9d113_client->addr,
-				0x001A,
-				0x0051, WORD_LEN);
-	rc = mt9d113_i2c_write(mt9d113_client->addr,
-				0x001A,
-				0x0050,
-				WORD_LEN);
-	msleep(20);
-	rc = mt9d113_i2c_write(mt9d113_client->addr,
-				0x001A,
-				0x0058,
-				WORD_LEN);
-
-	/* Preset pll settings begin*/
-	rc = mt9d113_i2c_write_table(&mt9d113_regs.pll_tbl[0],
-				mt9d113_regs.pll_tbl_size);
-	if (rc < 0)
-		return rc;
-	rc = mt9d113_i2c_read(mt9d113_client->addr,
-				0x0014, &data, WORD_LEN);
-	data = data&0x8000;
-	/* Poll*/
-	while (data == 0x0000) {
-		data = 0;
-		rc = mt9d113_i2c_read(mt9d113_client->addr,
-				0x0014, &data, WORD_LEN);
-		data = data & 0x8000;
-		usleep_range(11000, 12000);
-		count++;
-		if (count == 100) {
-			CDBG(" Timeout:1\n");
-			break;
-		}
-	}
-	rc = mt9d113_i2c_write(mt9d113_client->addr,
-				0x0014,
-				0x20FA,
-				WORD_LEN);
-
-	/*Preset pll Ends*/
-	mt9d113_i2c_write(mt9d113_client->addr,
-				0x0018,
-				0x402D,
-				WORD_LEN);
-
-	mt9d113_i2c_write(mt9d113_client->addr,
-				0x0018,
-				0x402C,
-				WORD_LEN);
-	/*POLL_REG=0x0018,0x4000,!=0x0000,DELAY=10,TIMEOUT=100*/
-	data = 0;
-	rc = mt9d113_i2c_read(mt9d113_client->addr,
-		0x0018, &data, WORD_LEN);
-	data = data & 0x4000;
-	count = 0;
-	while (data != 0x0000) {
-		rc = mt9d113_i2c_read(mt9d113_client->addr,
-			0x0018, &data, WORD_LEN);
-		data = data & 0x4000;
-		CDBG(" data is %d\n" , data);
-		usleep_range(11000, 12000);
-		count++;
-		if (count == 100) {
-			CDBG(" Loop2 timeout: MT9D113\n");
-			break;
-		}
-		CDBG(" Not streaming\n");
-	}
-	CDBG("MT9D113: Start stream\n");
-	/*Preset Register Wizard Conf*/
-	rc = mt9d113_i2c_write_table(&mt9d113_regs.register_tbl[0],
-				mt9d113_regs.register_tbl_size);
-	if (rc < 0)
-		return rc;
-	rc = mt9d113_i2c_write_table(&mt9d113_regs.err_tbl[0],
-				mt9d113_regs.err_tbl_size);
-	if (rc < 0)
-		return rc;
-	rc = mt9d113_i2c_write_table(&mt9d113_regs.eeprom_tbl[0],
-				mt9d113_regs.eeprom_tbl_size);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9d113_i2c_write_table(&mt9d113_regs.low_light_tbl[0],
-				mt9d113_regs.low_light_tbl_size);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9d113_i2c_write_table(&mt9d113_regs.awb_tbl[0],
-				mt9d113_regs.awb_tbl_size);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9d113_i2c_write_table(&mt9d113_regs.patch_tbl[0],
-				mt9d113_regs.patch_tbl_size);
-	if (rc < 0)
-		return rc;
-
-	/*check patch load*/
-	mt9d113_i2c_write(mt9d113_client->addr,
-				0x098C,
-				0xA024,
-				WORD_LEN);
-	count = 0;
-	/*To check if patch is loaded properly
-	poll the register 0x990 till the condition is
-	met or till the timeout*/
-	data = 0;
-	rc = mt9d113_i2c_read(mt9d113_client->addr,
-				0x0990, &data, WORD_LEN);
-	while (data == 0) {
-		data = 0;
-		rc = mt9d113_i2c_read(mt9d113_client->addr,
-				0x0990, &data, WORD_LEN);
-		usleep_range(11000, 12000);
-		count++;
-		if (count == 100) {
-			CDBG("Timeout in patch loading\n");
-			break;
-		}
-	}
-		/*BITFIELD=0x0018, 0x0004, 0*/
-	/*Preset continue begin */
-	rc = mt9d113_i2c_write(mt9d113_client->addr, 0x0018, 0x0028,
-				WORD_LEN);
-	CDBG(" mt9d113 wait for seq done\n");
-	/* syncronize the FW with the sensor
-	MCU_ADDRESS [SEQ_CMD]*/
-	rc = mt9d113_i2c_write(mt9d113_client->addr,
-				0x098C, 0xA103, WORD_LEN);
-	rc = mt9d113_i2c_write(mt9d113_client->addr,
-				0x0990, 0x0006, WORD_LEN);
-		/*mt9d113 wait for seq done
-	 syncronize the FW with the sensor */
-	msleep(20);
-	/*Preset continue end */
-	CDBG(" MT9D113: Preset continue end\n");
-	rc = mt9d113_i2c_write(mt9d113_client->addr,
-				0x0012,
-				0x00F5,
-				WORD_LEN);
-	/*continue begin */
-	CDBG(" MT9D113: Preset continue begin\n");
-	rc = mt9d113_i2c_write(mt9d113_client->addr, 0x0018, 0x0028 ,
-				WORD_LEN);
-	/*mt9d113 wait for seq done
-	 syncronize the FW with the sensor
-	MCU_ADDRESS [SEQ_CMD]*/
-	msleep(20);
-	rc = mt9d113_i2c_write(mt9d113_client->addr,
-				0x098C, 0xA103, WORD_LEN);
-	/* MCU DATA */
-	rc = mt9d113_i2c_write(mt9d113_client->addr, 0x0990,
-				0x0006, WORD_LEN);
-	/*mt9d113 wait for seq done
-	syncronize the FW with the sensor */
-	/* MCU_ADDRESS [SEQ_CMD]*/
-	msleep(20);
-	/*Preset continue end*/
-	return rc;
-
-}
-
-static long mt9d113_set_sensor_mode(int mode)
-{
-	long rc = 0;
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = mt9d113_reg_init();
-		CDBG("MT9D113: configure to preview begin\n");
-		rc =
-		mt9d113_i2c_write(mt9d113_client->addr,
-						0x098C, 0xA115, WORD_LEN);
-		if (rc < 0)
-			return rc;
-		rc =
-		mt9d113_i2c_write(mt9d113_client->addr,
-						0x0990, 0x0000, WORD_LEN);
-		if (rc < 0)
-			return rc;
-		rc =
-		mt9d113_i2c_write(mt9d113_client->addr,
-						0x098C, 0xA103, WORD_LEN);
-		if (rc < 0)
-			return rc;
-		rc =
-		mt9d113_i2c_write(mt9d113_client->addr,
-						0x0990, 0x0001, WORD_LEN);
-		if (rc < 0)
-			return rc;
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc =
-		mt9d113_i2c_write(mt9d113_client->addr,
-						0x098C, 0xA115, WORD_LEN);
-		rc =
-		mt9d113_i2c_write(mt9d113_client->addr,
-						0x0990, 0x0002, WORD_LEN);
-		rc =
-		mt9d113_i2c_write(mt9d113_client->addr,
-						0x098C, 0xA103, WORD_LEN);
-		rc =
-		mt9d113_i2c_write(mt9d113_client->addr,
-						0x0990, 0x0002, WORD_LEN);
-		break;
-	default:
-		return -EINVAL;
-	}
-	return 0;
-}
-
-static int mt9d113_sensor_init_probe(const struct
-				msm_camera_sensor_info * data)
-{
-	uint16_t model_id = 0;
-	int rc = 0;
-	/* Read the Model ID of the sensor */
-	rc = mt9d113_i2c_read(mt9d113_client->addr,
-						REG_MT9D113_MODEL_ID,
-						&model_id, WORD_LEN);
-	if (rc < 0)
-		goto init_probe_fail;
-	/* Check if it matches it with the value in Datasheet */
-	if (model_id != MT9D113_MODEL_ID)
-		printk(KERN_INFO "mt9d113 model_id = 0x%x\n", model_id);
-	if (rc < 0)
-		goto init_probe_fail;
-	return rc;
-init_probe_fail:
-	printk(KERN_INFO "probe fail\n");
-	return rc;
-}
-
-static int mt9d113_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&mt9d113_wait_queue);
-	return 0;
-}
-
-int mt9d113_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cfg_data;
-	long rc = 0;
-
-	if (copy_from_user(&cfg_data,
-					(void *)argp,
-					(sizeof(struct sensor_cfg_data))))
-		return -EFAULT;
-	mutex_lock(&mt9d113_mut);
-	CDBG("mt9d113_ioctl, cfgtype = %d, mode = %d\n",
-		 cfg_data.cfgtype, cfg_data.mode);
-	switch (cfg_data.cfgtype) {
-	case CFG_SET_MODE:
-		rc = mt9d113_set_sensor_mode(
-						cfg_data.mode);
-		break;
-	case CFG_SET_EFFECT:
-		return rc;
-	case CFG_GET_AF_MAX_STEPS:
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	mutex_unlock(&mt9d113_mut);
-	return rc;
-}
-
-int mt9d113_sensor_release(void)
-{
-	int rc = 0;
-
-	mutex_lock(&mt9d113_mut);
-	gpio_set_value_cansleep(mt9d113_ctrl->sensordata->sensor_reset, 0);
-	msleep(20);
-	gpio_free(mt9d113_ctrl->sensordata->sensor_reset);
-	kfree(mt9d113_ctrl);
-	mutex_unlock(&mt9d113_mut);
-
-	return rc;
-}
-
-static int mt9d113_probe_init_done(const struct msm_camera_sensor_info
-				*data)
-{
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int mt9d113_probe_init_sensor(const struct msm_camera_sensor_info
-				*data)
-{
-	int32_t rc = 0;
-	uint16_t chipid = 0;
-
-	rc = gpio_request(data->sensor_reset, "mt9d113");
-	printk(KERN_INFO " mt9d113_probe_init_sensor\n");
-	if (!rc) {
-		printk(KERN_INFO "sensor_reset = %d\n", rc);
-		gpio_direction_output(data->sensor_reset, 0);
-		usleep_range(11000, 12000);
-		gpio_set_value_cansleep(data->sensor_reset, 1);
-		usleep_range(11000, 12000);
-	} else
-		goto init_probe_done;
-	printk(KERN_INFO " mt9d113_probe_init_sensor called\n");
-	rc = mt9d113_i2c_read(mt9d113_client->addr, REG_MT9D113_MODEL_ID,
-						&chipid, WORD_LEN);
-	if (rc < 0)
-		goto init_probe_fail;
-	/*Compare sensor ID to MT9D113 ID: */
-	if (chipid != MT9D113_MODEL_ID) {
-		printk(KERN_INFO "mt9d113_probe_init_sensor chip id is%d\n",
-			chipid);
-	}
-	CDBG("mt9d113_probe_init_sensor Success\n");
-	goto init_probe_done;
-init_probe_fail:
-	CDBG(" ov2720_probe_init_sensor fails\n");
-	gpio_set_value_cansleep(data->sensor_reset, 0);
-	mt9d113_probe_init_done(data);
-init_probe_done:
-	printk(KERN_INFO " mt9d113_probe_init_sensor finishes\n");
-	return rc;
-}
-
-static int mt9d113_i2c_probe(struct i2c_client *client,
-				const struct i2c_device_id *id)
-{
-	int rc = 0;
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		rc = -ENOTSUPP;
-		goto probe_failure;
-	}
-	mt9d113_sensorw =
-	kzalloc(sizeof(struct mt9d113_work), GFP_KERNEL);
-	if (!mt9d113_sensorw) {
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-	i2c_set_clientdata(client, mt9d113_sensorw);
-	mt9d113_init_client(client);
-	mt9d113_client = client;
-	CDBG("mt9d113_probe succeeded!\n");
-	return 0;
-probe_failure:
-	kfree(mt9d113_sensorw);
-	mt9d113_sensorw = NULL;
-	CDBG("mt9d113_probe failed!\n");
-	return rc;
-}
-
-static const struct i2c_device_id mt9d113_i2c_id[] = {
-	{ "mt9d113", 0},
-	{},
-};
-
-static struct i2c_driver mt9d113_i2c_driver = {
-	.id_table = mt9d113_i2c_id,
-	.probe  = mt9d113_i2c_probe,
-	.remove = __exit_p(mt9d113_i2c_remove),
-			  .driver = {
-		.name = "mt9d113",
-	},
-};
-
-int mt9d113_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	mt9d113_ctrl = kzalloc(sizeof(struct mt9d113_ctrl), GFP_KERNEL);
-	if (!mt9d113_ctrl) {
-		printk(KERN_INFO "mt9d113_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	mt9d113_ctrl->fps_divider = 1 * 0x00000400;
-	mt9d113_ctrl->pict_fps_divider = 1 * 0x00000400;
-	mt9d113_ctrl->set_test = TEST_OFF;
-	mt9d113_ctrl->config_csi = 0;
-	mt9d113_ctrl->prev_res = QTR_SIZE;
-	mt9d113_ctrl->pict_res = FULL_SIZE;
-	mt9d113_ctrl->curr_res = INVALID_SIZE;
-	if (data)
-		mt9d113_ctrl->sensordata = data;
-	if (rc < 0) {
-		printk(KERN_INFO "mt9d113_sensor_open_init fail\n");
-		return rc;
-	}
-		/* enable mclk first */
-		msm_camio_clk_rate_set(24000000);
-		msleep(20);
-		rc = mt9d113_probe_init_sensor(data);
-		if (rc < 0)
-			goto init_fail;
-		mt9d113_ctrl->fps = 30*Q8;
-		rc = mt9d113_sensor_init_probe(data);
-		if (rc < 0) {
-			gpio_set_value_cansleep(data->sensor_reset, 0);
-			goto init_fail;
-		} else
-			printk(KERN_ERR "%s: %d\n", __func__, __LINE__);
-		goto init_done;
-init_fail:
-		printk(KERN_INFO "init_fail\n");
-		mt9d113_probe_init_done(data);
-init_done:
-		CDBG("init_done\n");
-		return rc;
-}
-
-static int mt9d113_sensor_probe(const struct msm_camera_sensor_info
-				*info,
-				struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-	rc = i2c_add_driver(&mt9d113_i2c_driver);
-	if (rc < 0 || mt9d113_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_fail;
-	}
-	msm_camio_clk_rate_set(24000000);
-	usleep_range(5000, 6000);
-	rc = mt9d113_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-	s->s_init = mt9d113_sensor_open_init;
-	s->s_release = mt9d113_sensor_release;
-	s->s_config  = mt9d113_sensor_config;
-	s->s_camera_type = FRONT_CAMERA_2D;
-	s->s_mount_angle  = 0;
-	gpio_set_value_cansleep(info->sensor_reset, 0);
-	mt9d113_probe_init_done(info);
-	return rc;
-probe_fail:
-	printk(KERN_INFO "mt9d113_sensor_probe: SENSOR PROBE FAILS!\n");
-	return rc;
-}
-
-static int __mt9d113_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, mt9d113_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __mt9d113_probe,
-	.driver = {
-		.name = "msm_cam_mt9d113",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init mt9d113_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(mt9d113_init);
-
-MODULE_DESCRIPTION("Micron 2MP YUV sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/mt9d113.h b/drivers/media/video/msm/mt9d113.h
deleted file mode 100644
index 4aedc5e..0000000
--- a/drivers/media/video/msm/mt9d113.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef MT9D113_H
-#define MT9D113_H
-
-#include <linux/types.h>
-#include <mach/camera.h>
-
-extern struct mt9d113_reg mt9d113_regs;
-
-enum mt9d113_width {
-	WORD_LEN,
-	BYTE_LEN
-};
-
-struct mt9d113_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-struct mt9d113_reg {
-	const struct mt9d113_i2c_reg_conf *pll_tbl;
-	uint16_t pll_tbl_size;
-	const struct mt9d113_i2c_reg_conf *register_tbl;
-	uint16_t register_tbl_size;
-	const struct mt9d113_i2c_reg_conf *err_tbl;
-	uint16_t err_tbl_size;
-	const struct mt9d113_i2c_reg_conf *low_light_tbl;
-	uint16_t low_light_tbl_size;
-	const struct mt9d113_i2c_reg_conf *awb_tbl;
-	uint16_t awb_tbl_size;
-	const struct mt9d113_i2c_reg_conf *patch_tbl;
-	uint16_t patch_tbl_size;
-	const struct mt9d113_i2c_reg_conf *eeprom_tbl ;
-	uint16_t eeprom_tbl_size ;
-};
-
-enum mt9d113_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum mt9d113_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-
-enum mt9d113_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-#endif /* MT9D113_H */
diff --git a/drivers/media/video/msm/mt9d113_reg.c b/drivers/media/video/msm/mt9d113_reg.c
deleted file mode 100644
index 28ff518..0000000
--- a/drivers/media/video/msm/mt9d113_reg.c
+++ /dev/null
@@ -1,455 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "mt9d113.h"
-
-struct mt9d113_i2c_reg_conf const
-	pll_tbl_settings[] = {
-		{0x0014, 0x21F9 }, /*PLL control: BYPASS PLL = 8697*/
-		{0x0010, 0x0115 }, /*PLL Dividers = 277*/
-		{0x0012, 0x0F5  }, /*PLL P Dividers = 245*/
-		{0x0014, 0x21FB }, /*PLL control: PLL_ENABLE on = 8699*/
-		{0x0014, 0x20FB }, /*PLL control: SEL_LOCK_DET on = 8443*/
-};
-
-struct mt9d113_i2c_reg_conf const
-	register_wizard_settings[] = {
-		{0x098C, 0x2719},
-		{0x0990, 0x005A},
-		{0x098C, 0x271B},
-		{0x0990, 0x01BE},
-		{0x098C, 0x271D},
-		{0x0990, 0x0131},
-		{0x098C, 0x271F},
-		{0x0990, 0x02BB},
-		{0x098C, 0x2721},
-		{0x0990, 0x0888},
-		{0x098C, 0x272F},
-		{0x0990, 0x003A},
-		{0x098C, 0x2731},
-		{0x0990, 0x00F6},
-		{0x098C, 0x2733},
-		{0x0990, 0x008B},
-		{0x098C, 0x2735},
-		{0x0990, 0x0521},
-		{0x098C, 0x2737},
-		{0x0990, 0x0888},
-		{0x098C, 0x275F},
-		{0x0990, 0x0194},
-		{0x098C, 0x2761},
-		{0x0990, 0x0014},
-		{0x098C, 0xA765},
-		{0x0990, 0x0044},
-		{0x098C, 0xA24F},
-		{0x0990, 0x0028},
-		{0x098C, 0xA20E},
-		{0x0990, 0x00A0},
-		{0x098C, 0xA20C},
-		{0x0990, 0x000E},
-		{0x098C, 0x2222},
-		{0x0990, 0x00A0},
-		{0x098C, 0x2212},
-		{0x0990, 0x01EE},
-		{0x098C, 0xA408},
-		{0x0990, 0x0026},
-		{0x098C, 0xA409},
-		{0x0990, 0x0029},
-		{0x098C, 0xA40A},
-		{0x0990, 0x002E},
-		{0x098C, 0xA40B},
-		{0x0990, 0x0031},
-		{0x098C, 0x2411},
-		{0x0990, 0x00A0},
-		{0x098C, 0x2413},
-		{0x0990, 0x00C0},
-		{0x098C, 0x2415},
-		{0x0990, 0x00A0},
-		{0x098C, 0x2417},
-		{0x0990, 0x00C0},
-};
-
-struct mt9d113_i2c_reg_conf const
-	err_settings[] = {
-		{0x3084, 0x240C},
-		{0x3092, 0x0A4C},
-		{0x3094, 0x4C4C},
-		{0x3096, 0x4C54},
-};
-
-struct mt9d113_i2c_reg_conf const
-	patch_settings[] = {
-		{0x098C, 0x0415},    /* MCU_ADDRESS*/
-		{0x0990, 0xF601},
-		{0x0992, 0x42C1},
-		{0x0994, 0x0326},
-		{0x0996, 0x11F6},
-		{0x0998, 0x0143},
-		{0x099A, 0xC104},
-		{0x099C, 0x260A},
-		{0x099E, 0xCC04},
-		{0x098C, 0x0425},
-		{0x0990, 0x33BD},
-		{0x0992, 0xA362},
-		{0x0994, 0xBD04},
-		{0x0996, 0x3339},
-		{0x0998, 0xC6FF},
-		{0x099A, 0xF701},
-		{0x099C, 0x6439},
-		{0x099E, 0xFE01},
-		{0x098C, 0x0435},
-		{0x0990, 0x6918},
-		{0x0992, 0xCE03},
-		{0x0994, 0x25CC},
-		{0x0996, 0x0013},
-		{0x0998, 0xBDC2},
-		{0x099A, 0xB8CC},
-		{0x099C, 0x0489},
-		{0x099E, 0xFD03},
-		{0x098C, 0x0445},
-		{0x0990, 0x27CC},
-		{0x0992, 0x0325},
-		{0x0994, 0xFD01},
-		{0x0996, 0x69FE},
-		{0x0998, 0x02BD},
-		{0x099A, 0x18CE},
-		{0x099C, 0x0339},
-		{0x099E, 0xCC00},
-		{0x098C, 0x0455},
-		{0x0990, 0x11BD},
-		{0x0992, 0xC2B8},
-		{0x0994, 0xCC04},
-		{0x0996, 0xC8FD},
-		{0x0998, 0x0347},
-		{0x099A, 0xCC03},
-		{0x099C, 0x39FD},
-		{0x099E, 0x02BD},
-		{0x098C, 0x0465},
-		{0x0990, 0xDE00},
-		{0x0992, 0x18CE},
-		{0x0994, 0x00C2},
-		{0x0996, 0xCC00},
-		{0x0998, 0x37BD},
-		{0x099A, 0xC2B8},
-		{0x099C, 0xCC04},
-		{0x099E, 0xEFDD},
-		{0x098C, 0x0475},
-		{0x0990, 0xE6CC},
-		{0x0992, 0x00C2},
-		{0x0994, 0xDD00},
-		{0x0996, 0xC601},
-		{0x0998, 0xF701},
-		{0x099A, 0x64C6},
-		{0x099C, 0x03F7},
-		{0x099E, 0x0165},
-		{0x098C, 0x0485},
-		{0x0990, 0x7F01},
-		{0x0992, 0x6639},
-		{0x0994, 0x3C3C},
-		{0x0996, 0x3C34},
-		{0x0998, 0xCC32},
-		{0x099A, 0x3EBD},
-		{0x099C, 0xA558},
-		{0x099E, 0x30ED},
-		{0x098C, 0x0495},
-		{0x0990, 0x04BD},
-		{0x0992, 0xB2D7},
-		{0x0994, 0x30E7},
-		{0x0996, 0x06CC},
-		{0x0998, 0x323E},
-		{0x099A, 0xED00},
-		{0x099C, 0xEC04},
-		{0x099E, 0xBDA5},
-		{0x098C, 0x04A5},
-		{0x0990, 0x44CC},
-		{0x0992, 0x3244},
-		{0x0994, 0xBDA5},
-		{0x0996, 0x585F},
-		{0x0998, 0x30ED},
-		{0x099A, 0x02CC},
-		{0x099C, 0x3244},
-		{0x099E, 0xED00},
-		{0x098C, 0x04B5},
-		{0x0990, 0xF601},
-		{0x0992, 0xD54F},
-		{0x0994, 0xEA03},
-		{0x0996, 0xAA02},
-		{0x0998, 0xBDA5},
-		{0x099A, 0x4430},
-		{0x099C, 0xE606},
-		{0x099E, 0x3838},
-		{0x098C, 0x04C5},
-		{0x0990, 0x3831},
-		{0x0992, 0x39BD},
-		{0x0994, 0xD661},
-		{0x0996, 0xF602},
-		{0x0998, 0xF4C1},
-		{0x099A, 0x0126},
-		{0x099C, 0x0BFE},
-		{0x099E, 0x02BD},
-		{0x098C, 0x04D5},
-		{0x0990, 0xEE10},
-		{0x0992, 0xFC02},
-		{0x0994, 0xF5AD},
-		{0x0996, 0x0039},
-		{0x0998, 0xF602},
-		{0x099A, 0xF4C1},
-		{0x099C, 0x0226},
-		{0x099E, 0x0AFE},
-		{0x098C, 0x04E5},
-		{0x0990, 0x02BD},
-		{0x0992, 0xEE10},
-		{0x0994, 0xFC02},
-		{0x0996, 0xF7AD},
-		{0x0998, 0x0039},
-		{0x099A, 0x3CBD},
-		{0x099C, 0xB059},
-		{0x099E, 0xCC00},
-		{0x098C, 0x04F5},
-		{0x0990, 0x28BD},
-		{0x0992, 0xA558},
-		{0x0994, 0x8300},
-		{0x0996, 0x0027},
-		{0x0998, 0x0BCC},
-		{0x099A, 0x0026},
-		{0x099C, 0x30ED},
-		{0x099E, 0x00C6},
-		{0x098C, 0x0505},
-		{0x0990, 0x03BD},
-		{0x0992, 0xA544},
-		{0x0994, 0x3839},
-		{0x098C, 0x2006},
-		{0x0990, 0x0415},
-		{0x098C, 0xA005},
-		{0x0990, 0x0001},
-};
-
-struct mt9d113_i2c_reg_conf const
-	eeprom_settings[] = {
-		{0x3658, 0x0110},
-		{0x365A, 0x1B6D},
-		{0x365C, 0x01F2},
-		{0x365E, 0xFBCD},
-		{0x3660, 0x8C91},
-		{0x3680, 0xB9ED},
-		{0x3682, 0x0EE},
-		{0x3684, 0x256F},
-		{0x3686, 0x824F},
-		{0x3688, 0xD293},
-		{0x36A8, 0x5BF2},
-		{0x36AA, 0x1711},
-		{0x36AC, 0xA095},
-		{0x36AE, 0x642C},
-		{0x36B0, 0x0E38},
-		{0x36D0, 0x88B0},
-		{0x36D2, 0x2EB2},
-		{0x36D4, 0x4C74},
-		{0x36D6, 0x9F96},
-		{0x36D8, 0x9557},
-		{0x36F8, 0xCE51},
-		{0x36FA, 0xB354},
-		{0x36FC, 0x2817},
-		{0x36FE, 0x14B8},
-		{0x3700, 0xB019},
-		{0x364E, 0x0710},
-		{0x3650, 0x30ED},
-		{0x3652, 0x03F2},
-		{0x3654, 0xF12E},
-		{0x3656, 0x8492},
-		{0x3676, 0xD9AD},
-		{0x3678, 0x88D0},
-		{0x367A, 0x7DED},
-		{0x367C, 0x3E31},
-		{0x367E, 0x91B3},
-		{0x369E, 0x7032},
-		{0x36A0, 0x2791},
-		{0x36A2, 0xBB55},
-		{0x36A4, 0xAB32},
-		{0x36A6, 0x1A58},
-		{0x36C6, 0xB50F},
-		{0x36C8, 0x0011},
-		{0x36CA, 0x6DB4},
-		{0x36CC, 0x96F5},
-		{0x36CE, 0x9BB7},
-		{0x36EE, 0x9353},
-		{0x36F0, 0xDF74},
-		{0x36F2, 0x04F8},
-		{0x36F4, 0x0FD8},
-		{0x36F6, 0xA87A},
-		{0x3662, 0x0170},
-		{0x3664, 0x6F0C},
-		{0x3666, 0x0112},
-		{0x3668, 0xCBAB},
-		{0x366A, 0x9111},
-		{0x368A, 0xB38D},
-		{0x368C, 0xE96F},
-		{0x368E, 0xCC0F},
-		{0x3690, 0x5851},
-		{0x3692, 0xFDD2},
-		{0x36B2, 0x5F92},
-		{0x36B4, 0x33B2},
-		{0x36B6, 0x9815},
-		{0x36B8, 0x86F5},
-		{0x36BA, 0x0578},
-		{0x36DA, 0xCD90},
-		{0x36DC, 0x1131},
-		{0x36DE, 0x5275},
-		{0x36E0, 0xE855},
-		{0x36E2, 0xD037},
-		{0x3702, 0xAAD1},
-		{0x3704, 0xEB75},
-		{0x3706, 0x0CD7},
-		{0x3708, 0x2C79},
-		{0x370A, 0xE0B9},
-		{0x366C, 0x0190},
-		{0x366E, 0x1C8D},
-		{0x3670, 0x0052},
-		{0x3672, 0xD66E},
-		{0x3674, 0xF511},
-		{0x3694, 0xB54D},
-		{0x3696, 0x6E4E},
-		{0x3698, 0x142E},
-		{0x369A, 0xC190},
-		{0x369C, 0xA753},
-		{0x36BC, 0x70F2},
-		{0x36BE, 0x04F1},
-		{0x36C0, 0xBD95},
-		{0x36C2, 0x0CEE},
-		{0x36C4, 0x1BF8},
-		{0x36E4, 0x806F},
-		{0x36E6, 0x1672},
-		{0x36E8, 0x2DF4},
-		{0x36EA, 0x8F16},
-		{0x36EC, 0xF776},
-		{0x370C, 0xAD73},
-		{0x370E, 0xB534},
-		{0x3710, 0x0D18},
-		{0x3712, 0x6057},
-		{0x3714, 0xBD1A},
-		{0x3644, 0x0354},
-		{0x3642, 0x0234},
-		{0x3210, 0x01B8},
-};
-
-struct mt9d113_i2c_reg_conf const
-	awb_settings[] = {
-		{0x098C, 0x2306},
-		{0x0990, 0x0180},
-		{0x098C, 0x2308},
-		{0x0990, 0xFF00},
-		{0x098C, 0x230A},
-		{0x0990, 0x0080},
-		{0x098C, 0x230C},
-		{0x0990, 0xFF66},
-		{0x098C, 0x230E},
-		{0x0990, 0x0180},
-		{0x098C, 0x2310},
-		{0x0990, 0xFFEE},
-		{0x098C, 0x2312},
-		{0x0990, 0xFFCD},
-		{0x098C, 0x2314},
-		{0x0990, 0xFECD},
-		{0x098C, 0x2316},
-		{0x0990, 0x019A},
-		{0x098C, 0x2318},
-		{0x0990, 0x0020},
-		{0x098C, 0x231A},
-		{0x0990, 0x0033},
-		{0x098C, 0x231C},
-		{0x0990, 0x0100},
-		{0x098C, 0x231E},
-		{0x0990, 0xFF9A},
-		{0x098C, 0x2320},
-		{0x0990, 0x0000},
-		{0x098C, 0x2322},
-		{0x0990, 0x004D},
-		{0x098C, 0x2324},
-		{0x0990, 0xFFCD},
-		{0x098C, 0x2326},
-		{0x0990, 0xFFB8},
-		{0x098C, 0x2328},
-		{0x0990, 0x004D},
-		{0x098C, 0x232A},
-		{0x0990, 0x0080},
-		{0x098C, 0x232C},
-		{0x0990, 0xFF66},
-		{0x098C, 0x232E},
-		{0x0990, 0x0008},
-		{0x098C, 0x2330},
-		{0x0990, 0xFFF7},
-		{0x098C, 0xA363},
-		{0x0990, 0x00D2},
-		{0x098C, 0xA364},
-		{0x0990, 0x00EE},
-		{0x3244, 0x0328},
-		{0x323E, 0xC22C},
-};
-
-struct mt9d113_i2c_reg_conf const
-	low_light_setting[] = {
-		{0x098C, 0x2B28},
-		{0x0990, 0x35E8},
-		{0x098C, 0x2B2A},
-		{0x0990, 0xB3B0},
-		{0x098C, 0xAB20},
-		{0x0990, 0x004B},
-		{0x098C, 0xAB24},
-		{0x0990, 0x0000},
-		{0x098C, 0xAB25},
-		{0x0990, 0x00FF},
-		{0x098C, 0xAB30},
-		{0x0990, 0x00FF},
-		{0x098C, 0xAB31},
-		{0x0990, 0x00FF},
-		{0x098C, 0xAB32},
-		{0x0990, 0x00FF},
-		{0x098C, 0xAB33},
-		{0x0990, 0x0057},
-		{0x098C, 0xAB34},
-		{0x0990, 0x0080},
-		{0x098C, 0xAB35},
-		{0x0990, 0x00FF},
-		{0x098C, 0xAB36},
-		{0x0990, 0x0014},
-		{0x098C, 0xAB37},
-		{0x0990, 0x0003},
-		{0x098C, 0x2B38},
-		{0x0990, 0x32C8},
-		{0x098C, 0x2B3A},
-		{0x0990, 0x7918},
-		{0x098C, 0x2B62},
-		{0x0990, 0xFFFE},
-		{0x098C, 0x2B64},
-		{0x0990, 0xFFFF},
-};
-
-struct mt9d113_reg mt9d113_regs = {
-		.pll_tbl = pll_tbl_settings,
-		.pll_tbl_size = ARRAY_SIZE(
-			pll_tbl_settings),
-		.register_tbl = register_wizard_settings,
-		.register_tbl_size = ARRAY_SIZE(
-			register_wizard_settings),
-		.err_tbl = err_settings,
-		.err_tbl_size = ARRAY_SIZE(err_settings),
-		.low_light_tbl = low_light_setting,
-		.low_light_tbl_size = ARRAY_SIZE(low_light_setting),
-		.awb_tbl = awb_settings,
-		.awb_tbl_size = ARRAY_SIZE(awb_settings),
-		.patch_tbl = patch_settings,
-		.patch_tbl_size = ARRAY_SIZE(patch_settings),
-		.eeprom_tbl = eeprom_settings,
-		.eeprom_tbl_size = ARRAY_SIZE(eeprom_settings),
-};
-
-
-
diff --git a/drivers/media/video/msm/mt9e013.c b/drivers/media/video/msm/mt9e013.c
deleted file mode 100644
index f91bec4..0000000
--- a/drivers/media/video/msm/mt9e013.c
+++ /dev/null
@@ -1,1140 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/debugfs.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/slab.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include "mt9e013.h"
-/*=============================================================
-	SENSOR REGISTER DEFINES
-==============================================================*/
-#define REG_GROUPED_PARAMETER_HOLD		0x0104
-#define GROUPED_PARAMETER_HOLD_OFF		0x00
-#define GROUPED_PARAMETER_HOLD			0x01
-/* Integration Time */
-#define REG_COARSE_INTEGRATION_TIME		0x3012
-/* Gain */
-#define REG_GLOBAL_GAIN	0x305E
-/* PLL registers */
-#define REG_FRAME_LENGTH_LINES		0x0340
-/* Test Pattern */
-#define REG_TEST_PATTERN_MODE			0x0601
-#define REG_VCM_NEW_CODE			0x30F2
-
-/*============================================================================
-							 TYPE DECLARATIONS
-============================================================================*/
-
-/* 16bit address - 8 bit context register structure */
-#define Q8	0x00000100
-#define Q10	0x00000400
-#define MT9E013_MASTER_CLK_RATE 24000000
-
-/* AF Total steps parameters */
-#define MT9E013_TOTAL_STEPS_NEAR_TO_FAR    32
-
-uint16_t mt9e013_step_position_table[MT9E013_TOTAL_STEPS_NEAR_TO_FAR+1];
-uint16_t mt9e013_nl_region_boundary1;
-uint16_t mt9e013_nl_region_code_per_step1;
-uint16_t mt9e013_l_region_code_per_step = 4;
-uint16_t mt9e013_damping_threshold = 10;
-uint16_t mt9e013_sw_damping_time_wait = 1;
-
-struct mt9e013_work_t {
-	struct work_struct work;
-};
-
-static struct mt9e013_work_t *mt9e013_sensorw;
-static struct i2c_client *mt9e013_client;
-
-struct mt9e013_ctrl_t {
-	const struct  msm_camera_sensor_info *sensordata;
-
-	uint32_t sensormode;
-	uint32_t fps_divider;/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;/* init to 1 * 0x00000400 */
-	uint16_t fps;
-
-	uint16_t curr_lens_pos;
-	uint16_t curr_step_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint16_t total_lines_per_frame;
-
-	enum mt9e013_resolution_t prev_res;
-	enum mt9e013_resolution_t pict_res;
-	enum mt9e013_resolution_t curr_res;
-	enum mt9e013_test_mode_t  set_test;
-};
-
-
-static bool CSI_CONFIG;
-static struct mt9e013_ctrl_t *mt9e013_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(mt9e013_wait_queue);
-DEFINE_MUTEX(mt9e013_mut);
-
-static int cam_debug_init(void);
-static struct dentry *debugfs_base;
-/*=============================================================*/
-
-static int mt9e013_i2c_rxdata(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-	};
-	if (i2c_transfer(mt9e013_client->adapter, msgs, 2) < 0) {
-		CDBG("mt9e013_i2c_rxdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-	return 0;
-}
-
-static int32_t mt9e013_i2c_txdata(unsigned short saddr,
-				unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		 },
-	};
-	if (i2c_transfer(mt9e013_client->adapter, msg, 1) < 0) {
-		CDBG("mt9e013_i2c_txdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t mt9e013_i2c_read(unsigned short raddr,
-	unsigned short *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-	if (!rdata)
-		return -EIO;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-	rc = mt9e013_i2c_rxdata(mt9e013_client->addr<<1, buf, rlen);
-	if (rc < 0) {
-		CDBG("mt9e013_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-	CDBG("mt9e013_i2c_read 0x%x val = 0x%x!\n", raddr, *rdata);
-	return rc;
-}
-
-static int32_t mt9e013_i2c_write_w_sensor(unsigned short waddr, uint16_t wdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[4];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = (wdata & 0xFF00) >> 8;
-	buf[3] = (wdata & 0x00FF);
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, wdata);
-	rc = mt9e013_i2c_txdata(mt9e013_client->addr<<1, buf, 4);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, wdata);
-	}
-	return rc;
-}
-
-static int32_t mt9e013_i2c_write_b_sensor(unsigned short waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[3];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = mt9e013_i2c_txdata(mt9e013_client->addr<<1, buf, 3);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, bdata);
-	}
-	return rc;
-}
-
-static int32_t mt9e013_i2c_write_w_table(struct mt9e013_i2c_reg_conf const
-					 *reg_conf_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-	for (i = 0; i < num; i++) {
-		rc = mt9e013_i2c_write_w_sensor(reg_conf_tbl->waddr,
-			reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-	return rc;
-}
-
-static void mt9e013_group_hold_on(void)
-{
-	mt9e013_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-						GROUPED_PARAMETER_HOLD);
-}
-
-static void mt9e013_group_hold_off(void)
-{
-	mt9e013_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-						GROUPED_PARAMETER_HOLD_OFF);
-}
-
-static void mt9e013_start_stream(void)
-{
-	mt9e013_i2c_write_w_sensor(0x301A, 0x8250);
-	mt9e013_i2c_write_w_sensor(0x301A, 0x8650);
-	mt9e013_i2c_write_w_sensor(0x301A, 0x8658);
-	mt9e013_i2c_write_b_sensor(0x0104, 0x00);
-	mt9e013_i2c_write_w_sensor(0x301A, 0x065C);
-}
-
-static void mt9e013_stop_stream(void)
-{
-	mt9e013_i2c_write_w_sensor(0x301A, 0x0058);
-	mt9e013_i2c_write_w_sensor(0x301A, 0x0050);
-	mt9e013_i2c_write_b_sensor(0x0104, 0x01);
-}
-
-static void mt9e013_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint32_t divider, d1, d2;
-
-	d1 = mt9e013_regs.reg_prev[E013_FRAME_LENGTH_LINES].wdata
-		* 0x00000400/
-		mt9e013_regs.reg_snap[E013_FRAME_LENGTH_LINES].wdata;
-	d2 = mt9e013_regs.reg_prev[E013_LINE_LENGTH_PCK].wdata
-		* 0x00000400/
-		mt9e013_regs.reg_snap[E013_LINE_LENGTH_PCK].wdata;
-	divider = d1 * d2 / 0x400;
-
-	/*Verify PCLK settings and frame sizes.*/
-	*pfps = (uint16_t) (fps * divider / 0x400);
-	/* 2 is the ratio of no.of snapshot channels
-	to number of preview channels */
-}
-
-static uint16_t mt9e013_get_prev_lines_pf(void)
-{
-	if (mt9e013_ctrl->prev_res == QTR_SIZE)
-		return mt9e013_regs.reg_prev[E013_FRAME_LENGTH_LINES].wdata;
-	else if (mt9e013_ctrl->prev_res == FULL_SIZE)
-		return mt9e013_regs.reg_snap[E013_FRAME_LENGTH_LINES].wdata;
-	else if (mt9e013_ctrl->prev_res == HFR_60FPS)
-		return mt9e013_regs.reg_60fps[E013_FRAME_LENGTH_LINES].wdata;
-	else if (mt9e013_ctrl->prev_res == HFR_90FPS)
-		return mt9e013_regs.reg_120fps[E013_FRAME_LENGTH_LINES].wdata;
-	else
-		return mt9e013_regs.reg_120fps[E013_FRAME_LENGTH_LINES].wdata;
-}
-
-static uint16_t mt9e013_get_prev_pixels_pl(void)
-{
-	if (mt9e013_ctrl->prev_res == QTR_SIZE)
-		return mt9e013_regs.reg_prev[E013_LINE_LENGTH_PCK].wdata;
-	else if (mt9e013_ctrl->prev_res == FULL_SIZE)
-		return mt9e013_regs.reg_snap[E013_LINE_LENGTH_PCK].wdata;
-	else if (mt9e013_ctrl->prev_res == HFR_60FPS)
-		return mt9e013_regs.reg_60fps[E013_LINE_LENGTH_PCK].wdata;
-	else if (mt9e013_ctrl->prev_res == HFR_90FPS)
-		return mt9e013_regs.reg_120fps[E013_LINE_LENGTH_PCK].wdata;
-	else
-		return mt9e013_regs.reg_120fps[E013_LINE_LENGTH_PCK].wdata;
-}
-
-static uint16_t mt9e013_get_pict_lines_pf(void)
-{
-	if (mt9e013_ctrl->pict_res == QTR_SIZE)
-		return mt9e013_regs.reg_prev[E013_FRAME_LENGTH_LINES].wdata;
-	else if (mt9e013_ctrl->pict_res == FULL_SIZE)
-		return mt9e013_regs.reg_snap[E013_FRAME_LENGTH_LINES].wdata;
-	else if (mt9e013_ctrl->pict_res == HFR_60FPS)
-		return mt9e013_regs.reg_60fps[E013_FRAME_LENGTH_LINES].wdata;
-	else if (mt9e013_ctrl->pict_res == HFR_90FPS)
-		return mt9e013_regs.reg_120fps[E013_FRAME_LENGTH_LINES].wdata;
-	else
-		return mt9e013_regs.reg_120fps[E013_FRAME_LENGTH_LINES].wdata;
-}
-
-static uint16_t mt9e013_get_pict_pixels_pl(void)
-{
-	if (mt9e013_ctrl->pict_res == QTR_SIZE)
-		return mt9e013_regs.reg_prev[E013_LINE_LENGTH_PCK].wdata;
-	else if (mt9e013_ctrl->pict_res == FULL_SIZE)
-		return mt9e013_regs.reg_snap[E013_LINE_LENGTH_PCK].wdata;
-	else if (mt9e013_ctrl->pict_res == HFR_60FPS)
-		return mt9e013_regs.reg_60fps[E013_LINE_LENGTH_PCK].wdata;
-	else if (mt9e013_ctrl->pict_res == HFR_90FPS)
-		return mt9e013_regs.reg_120fps[E013_LINE_LENGTH_PCK].wdata;
-	else
-		return mt9e013_regs.reg_120fps[E013_LINE_LENGTH_PCK].wdata;
-}
-
-static uint32_t mt9e013_get_pict_max_exp_lc(void)
-{
-	if (mt9e013_ctrl->pict_res == QTR_SIZE)
-		return mt9e013_regs.reg_prev[E013_FRAME_LENGTH_LINES].wdata
-			* 24;
-	else if (mt9e013_ctrl->pict_res == FULL_SIZE)
-		return mt9e013_regs.reg_snap[E013_FRAME_LENGTH_LINES].wdata
-			* 24;
-	else if (mt9e013_ctrl->pict_res == HFR_60FPS)
-		return mt9e013_regs.reg_60fps[E013_FRAME_LENGTH_LINES].wdata
-			* 24;
-	else if (mt9e013_ctrl->pict_res == HFR_90FPS)
-		return mt9e013_regs.reg_120fps[E013_FRAME_LENGTH_LINES].wdata
-			* 24;
-	else
-		return mt9e013_regs.reg_120fps[E013_FRAME_LENGTH_LINES].wdata
-			* 24;
-}
-
-static int32_t mt9e013_set_fps(struct fps_cfg   *fps)
-{
-	uint16_t total_lines_per_frame;
-	int32_t rc = 0;
-	if (mt9e013_ctrl->curr_res == QTR_SIZE)
-		total_lines_per_frame =
-		mt9e013_regs.reg_prev[E013_FRAME_LENGTH_LINES].wdata;
-	else if (mt9e013_ctrl->curr_res == FULL_SIZE)
-		total_lines_per_frame =
-		mt9e013_regs.reg_snap[E013_FRAME_LENGTH_LINES].wdata;
-	else if (mt9e013_ctrl->curr_res == HFR_60FPS)
-		total_lines_per_frame =
-		mt9e013_regs.reg_60fps[E013_FRAME_LENGTH_LINES].wdata;
-	else if (mt9e013_ctrl->curr_res == HFR_90FPS)
-		total_lines_per_frame =
-		mt9e013_regs.reg_120fps[E013_FRAME_LENGTH_LINES].wdata;
-	else
-		total_lines_per_frame =
-		mt9e013_regs.reg_120fps[E013_FRAME_LENGTH_LINES].wdata;
-
-	mt9e013_ctrl->fps_divider = fps->fps_div;
-	mt9e013_ctrl->pict_fps_divider = fps->pict_fps_div;
-
-	if (mt9e013_ctrl->curr_res == FULL_SIZE) {
-		total_lines_per_frame = (uint16_t)
-		(total_lines_per_frame * mt9e013_ctrl->pict_fps_divider/0x400);
-	} else {
-		total_lines_per_frame = (uint16_t)
-		(total_lines_per_frame * mt9e013_ctrl->fps_divider/0x400);
-	}
-
-	mt9e013_group_hold_on();
-	rc = mt9e013_i2c_write_w_sensor(REG_FRAME_LENGTH_LINES,
-							total_lines_per_frame);
-	mt9e013_group_hold_off();
-	return rc;
-}
-
-static int32_t mt9e013_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	uint16_t max_legal_gain = 0xE7F;
-	int32_t rc = 0;
-	if (gain > max_legal_gain) {
-		CDBG("Max legal gain Line:%d\n", __LINE__);
-		gain = max_legal_gain;
-	}
-
-	if (mt9e013_ctrl->curr_res != FULL_SIZE) {
-		mt9e013_ctrl->my_reg_gain = gain;
-		mt9e013_ctrl->my_reg_line_count = (uint16_t) line;
-		line = (uint32_t) (line * mt9e013_ctrl->fps_divider /
-						   0x00000400);
-	} else {
-		line = (uint32_t) (line * mt9e013_ctrl->pict_fps_divider /
-						   0x00000400);
-	}
-
-	gain |= 0x1000;
-
-	mt9e013_group_hold_on();
-	rc = mt9e013_i2c_write_w_sensor(REG_GLOBAL_GAIN, gain);
-	rc = mt9e013_i2c_write_w_sensor(REG_COARSE_INTEGRATION_TIME, line);
-	mt9e013_group_hold_off();
-	return rc;
-}
-
-static int32_t mt9e013_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-	rc = mt9e013_write_exp_gain(gain, line);
-	mt9e013_i2c_write_w_sensor(0x301A, 0x065C|0x2);
-	return rc;
-}
-
-#define DIV_CEIL(x, y) (x/y + (x%y) ? 1 : 0)
-
-static int32_t mt9e013_move_focus(int direction,
-	int32_t num_steps)
-{
-	int16_t step_direction, dest_lens_position, dest_step_position;
-	int16_t target_dist, small_step, next_lens_position;
-	if (direction == MOVE_NEAR)
-		step_direction = 1;
-	else
-		step_direction = -1;
-
-	dest_step_position = mt9e013_ctrl->curr_step_pos
-						+ (step_direction * num_steps);
-
-	if (dest_step_position < 0)
-		dest_step_position = 0;
-	else if (dest_step_position > MT9E013_TOTAL_STEPS_NEAR_TO_FAR)
-		dest_step_position = MT9E013_TOTAL_STEPS_NEAR_TO_FAR;
-
-	if (dest_step_position == mt9e013_ctrl->curr_step_pos)
-		return 0;
-
-	dest_lens_position = mt9e013_step_position_table[dest_step_position];
-	target_dist = step_direction *
-		(dest_lens_position - mt9e013_ctrl->curr_lens_pos);
-
-	if (step_direction < 0 && (target_dist >=
-		mt9e013_step_position_table[mt9e013_damping_threshold])) {
-		small_step = DIV_CEIL(target_dist, 10);
-		mt9e013_sw_damping_time_wait = 10;
-	} else {
-		small_step = DIV_CEIL(target_dist, 4);
-		mt9e013_sw_damping_time_wait = 4;
-	}
-
-	for (next_lens_position = mt9e013_ctrl->curr_lens_pos
-		+ (step_direction * small_step);
-		(step_direction * next_lens_position) <=
-		(step_direction * dest_lens_position);
-		next_lens_position += (step_direction * small_step)) {
-		mt9e013_i2c_write_w_sensor(REG_VCM_NEW_CODE,
-		next_lens_position);
-		mt9e013_ctrl->curr_lens_pos = next_lens_position;
-		usleep(mt9e013_sw_damping_time_wait*50);
-	}
-
-	if (mt9e013_ctrl->curr_lens_pos != dest_lens_position) {
-		mt9e013_i2c_write_w_sensor(REG_VCM_NEW_CODE,
-		dest_lens_position);
-		usleep(mt9e013_sw_damping_time_wait*50);
-	}
-	mt9e013_ctrl->curr_lens_pos = dest_lens_position;
-	mt9e013_ctrl->curr_step_pos = dest_step_position;
-	return 0;
-}
-
-static int32_t mt9e013_set_default_focus(uint8_t af_step)
-{
-	int32_t rc = 0;
-	if (mt9e013_ctrl->curr_step_pos != 0) {
-		rc = mt9e013_move_focus(MOVE_FAR,
-		mt9e013_ctrl->curr_step_pos);
-	} else {
-		mt9e013_i2c_write_w_sensor(REG_VCM_NEW_CODE, 0x00);
-	}
-
-	mt9e013_ctrl->curr_lens_pos = 0;
-	mt9e013_ctrl->curr_step_pos = 0;
-
-	return rc;
-}
-
-static void mt9e013_init_focus(void)
-{
-	uint8_t i;
-	mt9e013_step_position_table[0] = 0;
-	for (i = 1; i <= MT9E013_TOTAL_STEPS_NEAR_TO_FAR; i++) {
-		if (i <= mt9e013_nl_region_boundary1) {
-			mt9e013_step_position_table[i] =
-				mt9e013_step_position_table[i-1]
-				+ mt9e013_nl_region_code_per_step1;
-		} else {
-			mt9e013_step_position_table[i] =
-				mt9e013_step_position_table[i-1]
-				+ mt9e013_l_region_code_per_step;
-		}
-
-		if (mt9e013_step_position_table[i] > 255)
-			mt9e013_step_position_table[i] = 255;
-	}
-}
-
-static int32_t mt9e013_test(enum mt9e013_test_mode_t mo)
-{
-	int32_t rc = 0;
-	if (mo == TEST_OFF)
-		return rc;
-	else {
-		/* REG_0x30D8[4] is TESBYPEN: 0: Normal Operation,
-		1: Bypass Signal Processing
-		REG_0x30D8[5] is EBDMASK: 0:
-		Output Embedded data, 1: No output embedded data */
-		if (mt9e013_i2c_write_b_sensor(REG_TEST_PATTERN_MODE,
-			(uint8_t) mo) < 0) {
-			return rc;
-		}
-	}
-	return rc;
-}
-
-static int32_t mt9e013_sensor_setting(int update_type, int rt)
-{
-
-	int32_t rc = 0;
-	struct msm_camera_csi_params mt9e013_csi_params;
-	uint8_t stored_af_step = 0;
-	CDBG("sensor_settings\n");
-	stored_af_step = mt9e013_ctrl->curr_step_pos;
-	mt9e013_set_default_focus(0);
-	mt9e013_stop_stream();
-	msleep(15);
-	if (update_type == REG_INIT) {
-		mt9e013_i2c_write_w_table(mt9e013_regs.reg_mipi,
-			mt9e013_regs.reg_mipi_size);
-		mt9e013_i2c_write_w_table(mt9e013_regs.rec_settings,
-			mt9e013_regs.rec_size);
-		cam_debug_init();
-		CSI_CONFIG = 0;
-	} else if (update_type == UPDATE_PERIODIC) {
-		if (rt == QTR_SIZE) {
-			mt9e013_i2c_write_w_table(mt9e013_regs.reg_pll,
-				mt9e013_regs.reg_pll_size);
-			mt9e013_i2c_write_w_table(mt9e013_regs.reg_prev,
-				mt9e013_regs.reg_prev_size);
-		} else if (rt == FULL_SIZE) {
-			mt9e013_i2c_write_w_table(mt9e013_regs.reg_pll,
-				mt9e013_regs.reg_pll_size);
-			mt9e013_i2c_write_w_table(mt9e013_regs.reg_snap,
-				mt9e013_regs.reg_snap_size);
-		} else if (rt == HFR_60FPS) {
-			mt9e013_i2c_write_w_table(mt9e013_regs.reg_pll_120fps,
-				mt9e013_regs.reg_pll_120fps_size);
-			mt9e013_i2c_write_w_sensor(0x0306, 0x0029);
-			mt9e013_i2c_write_w_table(mt9e013_regs.reg_120fps,
-				mt9e013_regs.reg_120fps_size);
-		} else if (rt == HFR_90FPS) {
-			mt9e013_i2c_write_w_table(mt9e013_regs.reg_pll_120fps,
-				mt9e013_regs.reg_pll_120fps_size);
-			mt9e013_i2c_write_w_sensor(0x0306, 0x003D);
-			mt9e013_i2c_write_w_table(mt9e013_regs.reg_120fps,
-				mt9e013_regs.reg_120fps_size);
-		} else if (rt == HFR_120FPS) {
-			msm_camio_vfe_clk_rate_set(266667000);
-			mt9e013_i2c_write_w_table(mt9e013_regs.reg_pll_120fps,
-				mt9e013_regs.reg_pll_120fps_size);
-			mt9e013_i2c_write_w_table(mt9e013_regs.reg_120fps,
-				mt9e013_regs.reg_120fps_size);
-		}
-		if (!CSI_CONFIG) {
-			msm_camio_vfe_clk_rate_set(192000000);
-			mt9e013_csi_params.data_format = CSI_10BIT;
-			mt9e013_csi_params.lane_cnt = 2;
-			mt9e013_csi_params.lane_assign = 0xe4;
-			mt9e013_csi_params.dpcm_scheme = 0;
-			mt9e013_csi_params.settle_cnt = 0x18;
-			rc = msm_camio_csi_config(&mt9e013_csi_params);
-			msleep(10);
-			CSI_CONFIG = 1;
-		}
-		mt9e013_move_focus(MOVE_NEAR, stored_af_step);
-		mt9e013_start_stream();
-	}
-	return rc;
-}
-
-static int32_t mt9e013_video_config(int mode)
-{
-
-	int32_t rc = 0;
-
-	CDBG("video config\n");
-	/* change sensor resolution if needed */
-	if (mt9e013_sensor_setting(UPDATE_PERIODIC,
-			mt9e013_ctrl->prev_res) < 0)
-		return rc;
-	if (mt9e013_ctrl->set_test) {
-		if (mt9e013_test(mt9e013_ctrl->set_test) < 0)
-			return  rc;
-	}
-
-	mt9e013_ctrl->curr_res = mt9e013_ctrl->prev_res;
-	mt9e013_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t mt9e013_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	/*change sensor resolution if needed */
-	if (mt9e013_ctrl->curr_res != mt9e013_ctrl->pict_res) {
-		if (mt9e013_sensor_setting(UPDATE_PERIODIC,
-				mt9e013_ctrl->pict_res) < 0)
-			return rc;
-	}
-
-	mt9e013_ctrl->curr_res = mt9e013_ctrl->pict_res;
-	mt9e013_ctrl->sensormode = mode;
-	return rc;
-} /*end of mt9e013_snapshot_config*/
-
-static int32_t mt9e013_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	/* change sensor resolution if needed */
-	if (mt9e013_ctrl->curr_res != mt9e013_ctrl->pict_res) {
-		if (mt9e013_sensor_setting(UPDATE_PERIODIC,
-				mt9e013_ctrl->pict_res) < 0)
-			return rc;
-	}
-
-	mt9e013_ctrl->curr_res = mt9e013_ctrl->pict_res;
-	mt9e013_ctrl->sensormode = mode;
-	return rc;
-} /*end of mt9e013_raw_snapshot_config*/
-
-static int32_t mt9e013_set_sensor_mode(int mode,
-	int res)
-{
-	int32_t rc = 0;
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-	case SENSOR_HFR_60FPS_MODE:
-	case SENSOR_HFR_90FPS_MODE:
-	case SENSOR_HFR_120FPS_MODE:
-		mt9e013_ctrl->prev_res = res;
-		rc = mt9e013_video_config(mode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-		mt9e013_ctrl->pict_res = res;
-		rc = mt9e013_snapshot_config(mode);
-		break;
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		mt9e013_ctrl->pict_res = res;
-		rc = mt9e013_raw_snapshot_config(mode);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-static int32_t mt9e013_power_down(void)
-{
-	return 0;
-}
-
-static int mt9e013_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	CDBG("probe done\n");
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int mt9e013_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	uint16_t chipid = 0;
-	CDBG("%s: %d\n", __func__, __LINE__);
-	rc = gpio_request(data->sensor_reset, "mt9e013");
-	CDBG(" mt9e013_probe_init_sensor\n");
-	if (!rc) {
-		CDBG("sensor_reset = %d\n", rc);
-		gpio_direction_output(data->sensor_reset, 0);
-		msleep(10);
-		gpio_set_value_cansleep(data->sensor_reset, 1);
-		msleep(10);
-	} else {
-		goto init_probe_done;
-	}
-
-	CDBG(" mt9e013_probe_init_sensor is called\n");
-	rc = mt9e013_i2c_read(0x0000, &chipid, 2);
-	CDBG("ID: %d\n", chipid);
-	/* 4. Compare sensor ID to MT9E013 ID: */
-	if (chipid != 0x4B00) {
-		rc = -ENODEV;
-		CDBG("mt9e013_probe_init_sensor fail chip id doesnot match\n");
-		goto init_probe_fail;
-	}
-
-	mt9e013_ctrl = kzalloc(sizeof(struct mt9e013_ctrl_t), GFP_KERNEL);
-	if (!mt9e013_ctrl) {
-		CDBG("mt9e013_init failed!\n");
-		rc = -ENOMEM;
-	}
-	mt9e013_ctrl->fps_divider = 1 * 0x00000400;
-	mt9e013_ctrl->pict_fps_divider = 1 * 0x00000400;
-	mt9e013_ctrl->set_test = TEST_OFF;
-	mt9e013_ctrl->prev_res = QTR_SIZE;
-	mt9e013_ctrl->pict_res = FULL_SIZE;
-
-	if (data)
-		mt9e013_ctrl->sensordata = data;
-
-	goto init_probe_done;
-init_probe_fail:
-	CDBG(" mt9e013_probe_init_sensor fails\n");
-	gpio_set_value_cansleep(data->sensor_reset, 0);
-	mt9e013_probe_init_done(data);
-init_probe_done:
-	CDBG(" mt9e013_probe_init_sensor finishes\n");
-	return rc;
-}
-/* camsensor_mt9e013_reset */
-
-int mt9e013_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-
-	CDBG("%s: %d\n", __func__, __LINE__);
-	CDBG("Calling mt9e013_sensor_open_init\n");
-
-	mt9e013_ctrl = kzalloc(sizeof(struct mt9e013_ctrl_t), GFP_KERNEL);
-	if (!mt9e013_ctrl) {
-		CDBG("mt9e013_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	mt9e013_ctrl->fps_divider = 1 * 0x00000400;
-	mt9e013_ctrl->pict_fps_divider = 1 * 0x00000400;
-	mt9e013_ctrl->set_test = TEST_OFF;
-	mt9e013_ctrl->prev_res = QTR_SIZE;
-	mt9e013_ctrl->pict_res = FULL_SIZE;
-
-	if (data)
-		mt9e013_ctrl->sensordata = data;
-	if (rc < 0) {
-		CDBG("Calling mt9e013_sensor_open_init fail1\n");
-		return rc;
-	}
-	CDBG("%s: %d\n", __func__, __LINE__);
-	/* enable mclk first */
-	msm_camio_clk_rate_set(MT9E013_MASTER_CLK_RATE);
-	rc = mt9e013_probe_init_sensor(data);
-	if (rc < 0)
-		goto init_fail;
-
-	CDBG("init settings\n");
-	rc = mt9e013_sensor_setting(REG_INIT, mt9e013_ctrl->prev_res);
-	mt9e013_ctrl->fps = 30*Q8;
-	mt9e013_init_focus();
-	if (rc < 0) {
-		gpio_set_value_cansleep(data->sensor_reset, 0);
-		goto init_fail;
-	} else
-		goto init_done;
-init_fail:
-	CDBG("init_fail\n");
-	mt9e013_probe_init_done(data);
-init_done:
-	CDBG("init_done\n");
-	return rc;
-} /*endof mt9e013_sensor_open_init*/
-
-static int mt9e013_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&mt9e013_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id mt9e013_i2c_id[] = {
-	{"mt9e013", 0},
-	{ }
-};
-
-static int mt9e013_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("mt9e013_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	mt9e013_sensorw = kzalloc(sizeof(struct mt9e013_work_t), GFP_KERNEL);
-	if (!mt9e013_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, mt9e013_sensorw);
-	mt9e013_init_client(client);
-	mt9e013_client = client;
-
-
-	CDBG("mt9e013_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("mt9e013_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int mt9e013_send_wb_info(struct wb_info_cfg *wb)
-{
-	return 0;
-
-} /*end of mt9e013_snapshot_config*/
-
-static int __exit mt9e013_remove(struct i2c_client *client)
-{
-	struct mt9e013_work_t_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	mt9e013_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static struct i2c_driver mt9e013_i2c_driver = {
-	.id_table = mt9e013_i2c_id,
-	.probe  = mt9e013_i2c_probe,
-	.remove = __exit_p(mt9e013_i2c_remove),
-	.driver = {
-		.name = "mt9e013",
-	},
-};
-
-int mt9e013_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-	if (copy_from_user(&cdata,
-		(void *)argp,
-		sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(&mt9e013_mut);
-	CDBG("mt9e013_sensor_config: cfgtype = %d\n",
-	cdata.cfgtype);
-		switch (cdata.cfgtype) {
-		case CFG_GET_PICT_FPS:
-			mt9e013_get_pict_fps(
-				cdata.cfg.gfps.prevfps,
-				&(cdata.cfg.gfps.pictfps));
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PREV_L_PF:
-			cdata.cfg.prevl_pf =
-			mt9e013_get_prev_lines_pf();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PREV_P_PL:
-			cdata.cfg.prevp_pl =
-				mt9e013_get_prev_pixels_pl();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_L_PF:
-			cdata.cfg.pictl_pf =
-				mt9e013_get_pict_lines_pf();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_P_PL:
-			cdata.cfg.pictp_pl =
-				mt9e013_get_pict_pixels_pl();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_MAX_EXP_LC:
-			cdata.cfg.pict_max_exp_lc =
-				mt9e013_get_pict_max_exp_lc();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_SET_FPS:
-		case CFG_SET_PICT_FPS:
-			rc = mt9e013_set_fps(&(cdata.cfg.fps));
-			break;
-
-		case CFG_SET_EXP_GAIN:
-			rc =
-				mt9e013_write_exp_gain(
-					cdata.cfg.exp_gain.gain,
-					cdata.cfg.exp_gain.line);
-			break;
-
-		case CFG_SET_PICT_EXP_GAIN:
-			rc =
-				mt9e013_set_pict_exp_gain(
-				cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-			break;
-
-		case CFG_SET_MODE:
-			rc = mt9e013_set_sensor_mode(cdata.mode,
-					cdata.rs);
-			break;
-
-		case CFG_PWR_DOWN:
-			rc = mt9e013_power_down();
-			break;
-
-		case CFG_MOVE_FOCUS:
-			rc =
-				mt9e013_move_focus(
-				cdata.cfg.focus.dir,
-				cdata.cfg.focus.steps);
-			break;
-
-		case CFG_SET_DEFAULT_FOCUS:
-			rc =
-				mt9e013_set_default_focus(
-				cdata.cfg.focus.steps);
-			break;
-
-		case CFG_GET_AF_MAX_STEPS:
-			cdata.max_steps = MT9E013_TOTAL_STEPS_NEAR_TO_FAR;
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_SET_EFFECT:
-			rc = mt9e013_set_default_focus(
-				cdata.cfg.effect);
-			break;
-
-
-		case CFG_SEND_WB_INFO:
-			rc = mt9e013_send_wb_info(
-				&(cdata.cfg.wb_info));
-			break;
-
-		default:
-			rc = -EFAULT;
-			break;
-		}
-
-	mutex_unlock(&mt9e013_mut);
-
-	return rc;
-}
-
-static int mt9e013_sensor_release(void)
-{
-	int rc = -EBADF;
-	mutex_lock(&mt9e013_mut);
-	mt9e013_power_down();
-	gpio_set_value_cansleep(mt9e013_ctrl->sensordata->sensor_reset, 0);
-	msleep(5);
-	gpio_free(mt9e013_ctrl->sensordata->sensor_reset);
-	kfree(mt9e013_ctrl);
-	mt9e013_ctrl = NULL;
-	CDBG("mt9e013_release completed\n");
-	mutex_unlock(&mt9e013_mut);
-
-	return rc;
-}
-
-static int mt9e013_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-	rc = i2c_add_driver(&mt9e013_i2c_driver);
-	if (rc < 0 || mt9e013_client == NULL) {
-		rc = -ENOTSUPP;
-		CDBG("I2C add driver failed");
-		goto probe_fail;
-	}
-	msm_camio_clk_rate_set(MT9E013_MASTER_CLK_RATE);
-	rc = mt9e013_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-	s->s_init = mt9e013_sensor_open_init;
-	s->s_release = mt9e013_sensor_release;
-	s->s_config  = mt9e013_sensor_config;
-	s->s_mount_angle = info->sensor_platform_info->mount_angle;
-	gpio_set_value_cansleep(info->sensor_reset, 0);
-	mt9e013_probe_init_done(info);
-	return rc;
-
-probe_fail:
-	CDBG("mt9e013_sensor_probe: SENSOR PROBE FAILS!\n");
-	return rc;
-}
-
-static int __mt9e013_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, mt9e013_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __mt9e013_probe,
-	.driver = {
-		.name = "msm_camera_mt9e013",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init mt9e013_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(mt9e013_init);
-void mt9e013_exit(void)
-{
-	i2c_del_driver(&mt9e013_i2c_driver);
-}
-MODULE_DESCRIPTION("Aptina 8 MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
-
-static bool streaming = 1;
-
-static int mt9e013_focus_test(void *data, u64 *val)
-{
-	int i = 0;
-	mt9e013_set_default_focus(0);
-
-	for (i = 90; i < 256; i++) {
-		mt9e013_i2c_write_w_sensor(REG_VCM_NEW_CODE, i);
-		msleep(5000);
-	}
-	msleep(5000);
-	for (i = 255; i > 90; i--) {
-		mt9e013_i2c_write_w_sensor(REG_VCM_NEW_CODE, i);
-		msleep(5000);
-	}
-	return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(cam_focus, mt9e013_focus_test,
-			NULL, "%lld\n");
-
-static int mt9e013_step_test(void *data, u64 *val)
-{
-	int i = 0;
-	mt9e013_set_default_focus(0);
-
-	for (i = 0; i < MT9E013_TOTAL_STEPS_NEAR_TO_FAR; i++) {
-		mt9e013_move_focus(MOVE_NEAR, 1);
-		msleep(5000);
-	}
-
-	mt9e013_move_focus(MOVE_FAR, MT9E013_TOTAL_STEPS_NEAR_TO_FAR);
-	msleep(5000);
-	return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(cam_step, mt9e013_step_test,
-			NULL, "%lld\n");
-
-static int cam_debug_stream_set(void *data, u64 val)
-{
-	int rc = 0;
-
-	if (val) {
-		mt9e013_start_stream();
-		streaming = 1;
-	} else {
-		mt9e013_stop_stream();
-		streaming = 0;
-	}
-
-	return rc;
-}
-
-static int cam_debug_stream_get(void *data, u64 *val)
-{
-	*val = streaming;
-	return 0;
-}
-DEFINE_SIMPLE_ATTRIBUTE(cam_stream, cam_debug_stream_get,
-			cam_debug_stream_set, "%llu\n");
-
-
-static int cam_debug_init(void)
-{
-	struct dentry *cam_dir;
-	debugfs_base = debugfs_create_dir("sensor", NULL);
-	if (!debugfs_base)
-		return -ENOMEM;
-
-	cam_dir = debugfs_create_dir("mt9e013", debugfs_base);
-	if (!cam_dir)
-		return -ENOMEM;
-
-	if (!debugfs_create_file("focus", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &cam_focus))
-		return -ENOMEM;
-	if (!debugfs_create_file("step", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &cam_step))
-		return -ENOMEM;
-	if (!debugfs_create_file("stream", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &cam_stream))
-		return -ENOMEM;
-
-	return 0;
-}
-
-
-
diff --git a/drivers/media/video/msm/mt9e013.h b/drivers/media/video/msm/mt9e013.h
deleted file mode 100644
index 6f43ec4..0000000
--- a/drivers/media/video/msm/mt9e013.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef MT9E013_H
-#define MT9E013_H
-#include <linux/types.h>
-#include <mach/board.h>
-extern struct mt9e013_reg mt9e013_regs;
-struct reg_struct_init {
-	uint8_t reg_0x0112;      /* 0x0112*/
-	uint8_t reg_0x0113;      /* 0x0113*/
-	uint8_t vt_pix_clk_div;  /* 0x0301*/
-	uint8_t pre_pll_clk_div; /* 0x0305*/
-	uint8_t pll_multiplier;  /* 0x0307*/
-	uint8_t op_pix_clk_div;  /* 0x0309*/
-	uint8_t reg_0x3030;      /*0x3030*/
-	uint8_t reg_0x0111;      /*0x0111*/
-	uint8_t reg_0x0b00;      /*0x0b00*/
-	uint8_t reg_0x3001;      /*0x3001*/
-	uint8_t reg_0x3004;      /*0x3004*/
-	uint8_t reg_0x3007;      /*0x3007*/
-	uint8_t reg_0x3016;      /*0x3016*/
-	uint8_t reg_0x301d;      /*0x301d*/
-	uint8_t reg_0x317e;      /*0x317E*/
-	uint8_t reg_0x317f;      /*0x317F*/
-	uint8_t reg_0x3400;      /*0x3400*/
-	uint8_t reg_0x0b06;      /*0x0b06*/
-	uint8_t reg_0x0b07;      /*0x0b07*/
-	uint8_t reg_0x0b08;      /*0x0b08*/
-	uint8_t reg_0x0b09;      /*0x0b09*/
-	uint8_t reg_0x0136;
-	uint8_t reg_0x0137;
-	/* Edof */
-	uint8_t reg_0x0b83;      /*0x0b83*/
-	uint8_t reg_0x0b84;      /*0x0b84*/
-	uint8_t reg_0x0b85;      /*0x0b85*/
-	uint8_t reg_0x0b88;      /*0x0b88*/
-	uint8_t reg_0x0b89;      /*0x0b89*/
-	uint8_t reg_0x0b8a;      /*0x0b8a*/
-	};
-struct reg_struct {
-	uint8_t coarse_integration_time_hi; /*REG_COARSE_INTEGRATION_TIME_HI*/
-	uint8_t coarse_integration_time_lo; /*REG_COARSE_INTEGRATION_TIME_LO*/
-	uint8_t analogue_gain_code_global;
-	uint8_t frame_length_lines_hi; /* 0x0340*/
-	uint8_t frame_length_lines_lo; /* 0x0341*/
-	uint8_t line_length_pck_hi;    /* 0x0342*/
-	uint8_t line_length_pck_lo;    /* 0x0343*/
-	uint8_t reg_0x3005;   /* 0x3005*/
-	uint8_t reg_0x3010;  /* 0x3010*/
-	uint8_t reg_0x3011;  /* 0x3011*/
-	uint8_t reg_0x301a;  /* 0x301a*/
-	uint8_t reg_0x3035;  /* 0x3035*/
-	uint8_t reg_0x3036;   /* 0x3036*/
-	uint8_t reg_0x3041;  /*0x3041*/
-	uint8_t reg_0x3042;  /*0x3042*/
-	uint8_t reg_0x3045;  /*0x3045*/
-	uint8_t reg_0x0b80;   /* 0x0b80*/
-	uint8_t reg_0x0900;   /*0x0900*/
-	uint8_t reg_0x0901;   /* 0x0901*/
-	uint8_t reg_0x0902;   /*0x0902*/
-	uint8_t reg_0x0383;   /*0x0383*/
-	uint8_t reg_0x0387;   /* 0x0387*/
-	uint8_t reg_0x034c;   /* 0x034c*/
-	uint8_t reg_0x034d;   /*0x034d*/
-	uint8_t reg_0x034e;   /* 0x034e*/
-	uint8_t reg_0x034f;   /* 0x034f*/
-	uint8_t reg_0x1716; /*0x1716*/
-	uint8_t reg_0x1717; /*0x1717*/
-	uint8_t reg_0x1718; /*0x1718*/
-	uint8_t reg_0x1719; /*0x1719*/
-	uint8_t reg_0x3210;/*0x3210*/
-	uint8_t reg_0x111; /*0x111*/
-	uint8_t reg_0x3410;  /*0x3410*/
-	uint8_t reg_0x3098;
-	uint8_t reg_0x309D;
-	uint8_t reg_0x0200;
-	uint8_t reg_0x0201;
-	};
-struct mt9e013_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-enum mt9e013_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum mt9e013_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	HFR_60FPS,
-	HFR_90FPS,
-	HFR_120FPS,
-	INVALID_SIZE
-};
-enum mt9e013_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-enum mt9e013_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-enum mt9e013_reg_pll {
-	E013_VT_PIX_CLK_DIV,
-	E013_VT_SYS_CLK_DIV,
-	E013_PRE_PLL_CLK_DIV,
-	E013_PLL_MULTIPLIER,
-	E013_OP_PIX_CLK_DIV,
-	E013_OP_SYS_CLK_DIV
-};
-
-enum mt9e013_reg_mode {
-	E013_X_ADDR_START,
-	E013_X_ADDR_END,
-	E013_Y_ADDR_START,
-	E013_Y_ADDR_END,
-	E013_X_OUTPUT_SIZE,
-	E013_Y_OUTPUT_SIZE,
-	E013_DATAPATH_SELECT,
-	E013_READ_MODE,
-	E013_ANALOG_CONTROL5,
-	E013_DAC_LD_4_5,
-	E013_SCALING_MODE,
-	E013_SCALE_M,
-	E013_LINE_LENGTH_PCK,
-	E013_FRAME_LENGTH_LINES,
-	E013_COARSE_INTEGRATION_TIME,
-	E013_FINE_INTEGRATION_TIME,
-	E013_FINE_CORRECTION
-};
-
-struct mt9e013_reg {
-	const struct mt9e013_i2c_reg_conf *reg_mipi;
-	const unsigned short reg_mipi_size;
-	const struct mt9e013_i2c_reg_conf *rec_settings;
-	const unsigned short rec_size;
-	const struct mt9e013_i2c_reg_conf *reg_pll;
-	const unsigned short reg_pll_size;
-	const struct mt9e013_i2c_reg_conf *reg_pll_60fps;
-	const unsigned short reg_pll_60fps_size;
-	const struct mt9e013_i2c_reg_conf *reg_pll_120fps;
-	const unsigned short reg_pll_120fps_size;
-	const struct mt9e013_i2c_reg_conf *reg_prev;
-	const unsigned short reg_prev_size;
-	const struct mt9e013_i2c_reg_conf *reg_snap;
-	const unsigned short reg_snap_size;
-	const struct mt9e013_i2c_reg_conf *reg_60fps;
-	const unsigned short reg_60fps_size;
-	const struct mt9e013_i2c_reg_conf *reg_120fps;
-	const unsigned short reg_120fps_size;
-};
-#endif /* MT9E013_H */
diff --git a/drivers/media/video/msm/mt9e013_reg.c b/drivers/media/video/msm/mt9e013_reg.c
deleted file mode 100644
index bdcf3f8..0000000
--- a/drivers/media/video/msm/mt9e013_reg.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-
-#include "mt9e013.h"
-
-static struct mt9e013_i2c_reg_conf mipi_settings[] = {
-	/*Disable embedded data*/
-	{0x3064, 0x7800},/*SMIA_TEST*/
-	/*configure 2-lane MIPI*/
-	{0x31AE, 0x0202},/*SERIAL_FORMAT*/
-	{0x31B8, 0x0E3F},/*MIPI_TIMING_2*/
-	/*set data to RAW10 format*/
-	{0x0112, 0x0A0A},/*CCP_DATA_FORMAT*/
-	{0x30F0, 0x8000},/*VCM CONTROL*/
-};
-
-/*PLL Configuration
-(Ext=24MHz, vt_pix_clk=174MHz, op_pix_clk=69.6MHz)*/
-static struct mt9e013_i2c_reg_conf pll_settings[] = {
-	{0x0300, 0x0004},/*VT_PIX_CLK_DIV*/
-	{0x0302, 0x0001},/*VT_SYS_CLK_DIV*/
-	{0x0304, 0x0002},/*PRE_PLL_CLK_DIV*/
-	{0x0306, 0x003A},/*PLL_MULTIPLIER*/
-	{0x0308, 0x000A},/*OP_PIX_CLK_DIV*/
-	{0x030A, 0x0001},/*OP_SYS_CLK_DIV*/
-};
-
-static struct mt9e013_i2c_reg_conf prev_settings[] = {
-	/*Output Size (1632x1224)*/
-	{0x0344, 0x0008},/*X_ADDR_START*/
-	{0x0348, 0x0CC9},/*X_ADDR_END*/
-	{0x0346, 0x0008},/*Y_ADDR_START*/
-	{0x034A, 0x0999},/*Y_ADDR_END*/
-	{0x034C, 0x0660},/*X_OUTPUT_SIZE*/
-	{0x034E, 0x04C8},/*Y_OUTPUT_SIZE*/
-	{0x306E, 0xFCB0},/*DATAPATH_SELECT*/
-	{0x3040, 0x04C3},/*READ_MODE*/
-	{0x3178, 0x0000},/*ANALOG_CONTROL5*/
-	{0x3ED0, 0x1E24},/*DAC_LD_4_5*/
-	{0x0400, 0x0002},/*SCALING_MODE*/
-	{0x0404, 0x0010},/*SCALE_M*/
-	/*Timing configuration*/
-	{0x0342, 0x1018},/*LINE_LENGTH_PCK*/
-	{0x0340, 0x055B},/*FRAME_LENGTH_LINES*/
-	{0x0202, 0x0557},/*COARSE_INTEGRATION_TIME*/
-	{0x3014, 0x0846},/*FINE_INTEGRATION_TIME_*/
-	{0x3010, 0x0130},/*FINE_CORRECTION*/
-};
-
-static struct mt9e013_i2c_reg_conf snap_settings[] = {
-	/*Output Size (3264x2448)*/
-	{0x0344, 0x0008},/*X_ADDR_START */
-	{0x0348, 0x0CD7},/*X_ADDR_END*/
-	{0x0346, 0x0008},/*Y_ADDR_START */
-	{0x034A, 0x09A7},/*Y_ADDR_END*/
-	{0x034C, 0x0CD0},/*X_OUTPUT_SIZE*/
-	{0x034E, 0x09A0},/*Y_OUTPUT_SIZE*/
-	{0x306E, 0xFC80},/*DATAPATH_SELECT*/
-	{0x3040, 0x0041},/*READ_MODE*/
-	{0x3178, 0x0000},/*ANALOG_CONTROL5*/
-	{0x3ED0, 0x1E24},/*DAC_LD_4_5*/
-	{0x0400, 0x0000},/*SCALING_MODE*/
-	{0x0404, 0x0010},/*SCALE_M*/
-	/*Timing configuration*/
-	{0x0342, 0x13F8},/*LINE_LENGTH_PCK*/
-	{0x0340, 0x0A2F},/*FRAME_LENGTH_LINES*/
-	{0x0202, 0x0A1F},/*COARSE_INTEGRATION_TIME*/
-	{0x3014, 0x03F6},/*FINE_INTEGRATION_TIME_ */
-	{0x3010, 0x0078},/*FINE_CORRECTION*/
-};
-
-static struct mt9e013_i2c_reg_conf pll_settings_60fps[] = {
-	{0x0300, 0x0004},/*VT_PIX_CLK_DIV*/
-	{0x0302, 0x0001},/*VT_SYS_CLK_DIV*/
-	{0x0304, 0x0002},/*PRE_PLL_CLK_DIV*/
-	{0x0306, 0x0042},/*PLL_MULTIPLIER*/
-	{0x0308, 0x000A},/*OP_PIX_CLK_DIV*/
-	{0x030A, 0x0001},/*OP_SYS_CLK_DIV*/
-};
-
-static struct mt9e013_i2c_reg_conf prev_settings_60fps[] = {
-	/*Output Size (1632x1224)*/
-	{0x0344, 0x0008},/*X_ADDR_START*/
-	{0x0348, 0x0CC5},/*X_ADDR_END*/
-	{0x0346, 0x013a},/*Y_ADDR_START*/
-	{0x034A, 0x0863},/*Y_ADDR_END*/
-	{0x034C, 0x0660},/*X_OUTPUT_SIZE*/
-	{0x034E, 0x0396},/*Y_OUTPUT_SIZE*/
-	{0x306E, 0xFC80},/*DATAPATH_SELECT*/
-	{0x3040, 0x00C3},/*READ_MODE*/
-	{0x3178, 0x0000},/*ANALOG_CONTROL5*/
-	{0x3ED0, 0x1E24},/*DAC_LD_4_5*/
-	{0x0400, 0x0000},/*SCALING_MODE*/
-	{0x0404, 0x0010},/*SCALE_M*/
-	/*Timing configuration*/
-	{0x0342, 0x0BE8},/*LINE_LENGTH_PCK*/
-	{0x0340, 0x0425},/*FRAME_LENGTH_LINES*/
-	{0x0202, 0x0425},/*COARSE_INTEGRATION_TIME*/
-	{0x3014, 0x03F6},/*FINE_INTEGRATION_TIME_*/
-	{0x3010, 0x0078},/*FINE_CORRECTION*/
-};
-
-static struct mt9e013_i2c_reg_conf pll_settings_120fps[] = {
-	{0x0300, 0x0005},/*VT_PIX_CLK_DIV*/
-	{0x0302, 0x0001},/*VT_SYS_CLK_DIV*/
-	{0x0304, 0x0002},/*PRE_PLL_CLK_DIV*/
-	{0x0306, 0x0052},/*PLL_MULTIPLIER*/
-	{0x0308, 0x000A},/*OP_PIX_CLK_DIV*/
-	{0x030A, 0x0001},/*OP_SYS_CLK_DIV*/
-};
-
-static struct mt9e013_i2c_reg_conf prev_settings_120fps[] = {
-	{0x0344, 0x0008},/*X_ADDR_START*/
-	{0x0348, 0x0685},/*X_ADDR_END*/
-	{0x0346, 0x013a},/*Y_ADDR_START*/
-	{0x034A, 0x055B},/*Y_ADDR_END*/
-	{0x034C, 0x0340},/*X_OUTPUT_SIZE*/
-	{0x034E, 0x0212},/*Y_OUTPUT_SIZE*/
-	{0x306E, 0xFC80},/*DATAPATH_SELECT*/
-	{0x3040, 0x00C3},/*READ_MODE*/
-	{0x3178, 0x0000},/*ANALOG_CONTROL5*/
-	{0x3ED0, 0x1E24},/*DAC_LD_4_5*/
-	{0x0400, 0x0000},/*SCALING_MODE*/
-	{0x0404, 0x0010},/*SCALE_M*/
-	/*Timing configuration*/
-	{0x0342, 0x0970},/*LINE_LENGTH_PCK*/
-	{0x0340, 0x02A1},/*FRAME_LENGTH_LINES*/
-	{0x0202, 0x02A1},/*COARSE_INTEGRATION_TIME*/
-	{0x3014, 0x03F6},/*FINE_INTEGRATION_TIME_*/
-	{0x3010, 0x0078},/*FINE_CORRECTION*/
-};
-
-static struct mt9e013_i2c_reg_conf recommend_settings[] = {
-	{0x3044, 0x0590},
-	{0x306E, 0xFC80},
-	{0x30B2, 0xC000},
-	{0x30D6, 0x0800},
-	{0x316C, 0xB42F},
-	{0x316E, 0x869C},
-	{0x3170, 0x210E},
-	{0x317A, 0x010E},
-	{0x31E0, 0x1FB9},
-	{0x31E6, 0x07FC},
-	{0x37C0, 0x0000},
-	{0x37C2, 0x0000},
-	{0x37C4, 0x0000},
-	{0x37C6, 0x0000},
-	{0x3E02, 0x8801},
-	{0x3E04, 0x2301},
-	{0x3E06, 0x8449},
-	{0x3E08, 0x6841},
-	{0x3E0A, 0x400C},
-	{0x3E0C, 0x1001},
-	{0x3E0E, 0x2103},
-	{0x3E10, 0x4B41},
-	{0x3E12, 0x4B26},
-	{0x3E16, 0x8802},
-	{0x3E18, 0x84FF},
-	{0x3E1A, 0x8601},
-	{0x3E1C, 0x8401},
-	{0x3E1E, 0x840A},
-	{0x3E20, 0xFF00},
-	{0x3E22, 0x8401},
-	{0x3E24, 0x00FF},
-	{0x3E26, 0x0088},
-	{0x3E28, 0x2E8A},
-	{0x3E32, 0x8801},
-	{0x3E34, 0x4024},
-	{0x3E38, 0x8469},
-	{0x3E3C, 0x2301},
-	{0x3E3E, 0x3E25},
-	{0x3E40, 0x1C01},
-	{0x3E42, 0x8486},
-	{0x3E44, 0x8401},
-	{0x3E46, 0x00FF},
-	{0x3E48, 0x8401},
-	{0x3E4A, 0x8601},
-	{0x3E4C, 0x8402},
-	{0x3E4E, 0x00FF},
-	{0x3E50, 0x6623},
-	{0x3E52, 0x8340},
-	{0x3E54, 0x00FF},
-	{0x3E56, 0x4A42},
-	{0x3E58, 0x2203},
-	{0x3E5A, 0x674D},
-	{0x3E5C, 0x3F25},
-	{0x3E5E, 0x846A},
-	{0x3E60, 0x4C01},
-	{0x3E62, 0x8401},
-	{0x3E66, 0x3901},
-	{0x3ECC, 0x00EB},
-	{0x3ED0, 0x1E24},
-	{0x3ED4, 0xAFC4},
-	{0x3ED6, 0x909B},
-	{0x3ED8, 0x0006},
-	{0x3EDA, 0xCFC6},
-	{0x3EDC, 0x4FE4},
-	{0x3EE0, 0x2424},
-	{0x3EE2, 0x9797},
-	{0x3EE4, 0xC100},
-	{0x3EE6, 0x0540}
-};
-
-struct mt9e013_reg mt9e013_regs = {
-	.reg_mipi = &mipi_settings[0],
-	.reg_mipi_size = ARRAY_SIZE(mipi_settings),
-	.rec_settings = &recommend_settings[0],
-	.rec_size = ARRAY_SIZE(recommend_settings),
-	.reg_pll = &pll_settings[0],
-	.reg_pll_size = ARRAY_SIZE(pll_settings),
-	.reg_prev = &prev_settings[0],
-	.reg_pll_60fps = &pll_settings_60fps[0],
-	.reg_pll_60fps_size = ARRAY_SIZE(pll_settings_60fps),
-	.reg_pll_120fps = &pll_settings_120fps[0],
-	.reg_pll_120fps_size = ARRAY_SIZE(pll_settings_120fps),
-	.reg_prev_size = ARRAY_SIZE(prev_settings),
-	.reg_snap = &snap_settings[0],
-	.reg_snap_size = ARRAY_SIZE(snap_settings),
-	.reg_60fps = &prev_settings_60fps[0],
-	.reg_60fps_size = ARRAY_SIZE(prev_settings_60fps),
-	.reg_120fps = &prev_settings_120fps[0],
-	.reg_120fps_size = ARRAY_SIZE(prev_settings_120fps),
-};
diff --git a/drivers/media/video/msm/mt9p012.h b/drivers/media/video/msm/mt9p012.h
deleted file mode 100644
index a30b2f1..0000000
--- a/drivers/media/video/msm/mt9p012.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef MT9T012_H
-#define MT9T012_H
-
-#include <linux/types.h>
-#include <mach/board.h>
-
-extern struct mt9p012_reg mt9p012_regs;	/* from mt9p012_reg.c */
-
-struct reg_struct {
-	uint16_t vt_pix_clk_div;     /* 0x0300 */
-	uint16_t vt_sys_clk_div;     /* 0x0302 */
-	uint16_t pre_pll_clk_div;    /* 0x0304 */
-	uint16_t pll_multiplier;     /* 0x0306 */
-	uint16_t op_pix_clk_div;     /* 0x0308 */
-	uint16_t op_sys_clk_div;     /* 0x030A */
-	uint16_t scale_m;            /* 0x0404 */
-	uint16_t row_speed;          /* 0x3016 */
-	uint16_t x_addr_start;       /* 0x3004 */
-	uint16_t x_addr_end;         /* 0x3008 */
-	uint16_t y_addr_start;       /* 0x3002 */
-	uint16_t y_addr_end;         /* 0x3006 */
-	uint16_t read_mode;          /* 0x3040 */
-	uint16_t x_output_size ;     /* 0x034C */
-	uint16_t y_output_size;      /* 0x034E */
-	uint16_t line_length_pck;    /* 0x300C */
-	uint16_t frame_length_lines; /* 0x300A */
-	uint16_t coarse_int_time;    /* 0x3012 */
-	uint16_t fine_int_time;      /* 0x3014 */
-};
-
-
-struct mt9p012_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-
-struct mt9p012_reg {
-	struct reg_struct const *reg_pat;
-	uint16_t reg_pat_size;
-	struct mt9p012_i2c_reg_conf const *ttbl;
-	uint16_t ttbl_size;
-	struct mt9p012_i2c_reg_conf const *rftbl;
-	uint16_t rftbl_size;
-};
-
-#endif /* MT9T012_H */
diff --git a/drivers/media/video/msm/mt9p012_bam.c b/drivers/media/video/msm/mt9p012_bam.c
deleted file mode 100644
index 9363893..0000000
--- a/drivers/media/video/msm/mt9p012_bam.c
+++ /dev/null
@@ -1,1426 +0,0 @@
-/* Copyright (c) 2008-2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/kernel.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include "mt9p012.h"
-
-/*=============================================================
-    SENSOR REGISTER DEFINES
-==============================================================*/
-#define MT9P012_REG_MODEL_ID         0x0000
-#define MT9P012_MODEL_ID             0x2801
-#define REG_GROUPED_PARAMETER_HOLD   0x0104
-#define GROUPED_PARAMETER_HOLD       0x0100
-#define GROUPED_PARAMETER_UPDATE     0x0000
-#define REG_COARSE_INT_TIME          0x3012
-#define REG_VT_PIX_CLK_DIV           0x0300
-#define REG_VT_SYS_CLK_DIV           0x0302
-#define REG_PRE_PLL_CLK_DIV          0x0304
-#define REG_PLL_MULTIPLIER           0x0306
-#define REG_OP_PIX_CLK_DIV           0x0308
-#define REG_OP_SYS_CLK_DIV           0x030A
-#define REG_SCALE_M                  0x0404
-#define REG_FRAME_LENGTH_LINES       0x300A
-#define REG_LINE_LENGTH_PCK          0x300C
-#define REG_X_ADDR_START             0x3004
-#define REG_Y_ADDR_START             0x3002
-#define REG_X_ADDR_END               0x3008
-#define REG_Y_ADDR_END               0x3006
-#define REG_X_OUTPUT_SIZE            0x034C
-#define REG_Y_OUTPUT_SIZE            0x034E
-#define REG_FINE_INTEGRATION_TIME    0x3014
-#define REG_ROW_SPEED                0x3016
-#define MT9P012_REG_RESET_REGISTER   0x301A
-#define MT9P012_RESET_REGISTER_PWON  0x10CC
-#define MT9P012_RESET_REGISTER_PWOFF 0x10C8
-#define REG_READ_MODE                0x3040
-#define REG_GLOBAL_GAIN              0x305E
-#define REG_TEST_PATTERN_MODE        0x3070
-
-#define MT9P012_REV_7
-
-enum mt9p012_test_mode {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum mt9p012_resolution {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-
-enum mt9p012_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-enum mt9p012_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-
-/* actuator's Slave Address */
-#define MT9P012_AF_I2C_ADDR   0x0A
-
-/* AF Total steps parameters */
-#define MT9P012_STEPS_NEAR_TO_CLOSEST_INF  20
-#define MT9P012_TOTAL_STEPS_NEAR_TO_FAR    20
-
-#define MT9P012_MU5M0_PREVIEW_DUMMY_PIXELS 0
-#define MT9P012_MU5M0_PREVIEW_DUMMY_LINES  0
-
-/* Time in milisecs for waiting for the sensor to reset.*/
-#define MT9P012_RESET_DELAY_MSECS   66
-
-/* for 20 fps preview */
-#define MT9P012_DEFAULT_CLOCK_RATE  24000000
-#define MT9P012_DEFAULT_MAX_FPS     26	/* ???? */
-
-struct mt9p012_work {
-	struct work_struct work;
-};
-static struct mt9p012_work *mt9p012_sensorw;
-static struct i2c_client *mt9p012_client;
-
-struct mt9p012_ctrl {
-	const struct msm_camera_sensor_info *sensordata;
-
-	int sensormode;
-	uint32_t fps_divider;	/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;	/* init to 1 * 0x00000400 */
-
-	uint16_t curr_lens_pos;
-	uint16_t init_curr_lens_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-
-	enum mt9p012_resolution prev_res;
-	enum mt9p012_resolution pict_res;
-	enum mt9p012_resolution curr_res;
-	enum mt9p012_test_mode set_test;
-};
-
-static uint16_t bam_macro, bam_infinite;
-static uint16_t bam_step_lookup_table[MT9P012_TOTAL_STEPS_NEAR_TO_FAR + 1];
-static uint16_t update_type = UPDATE_PERIODIC;
-static struct mt9p012_ctrl *mt9p012_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(mt9p012_wait_queue);
-DEFINE_MUTEX(mt9p012_mut);
-
-/*=============================================================*/
-
-static int mt9p012_i2c_rxdata(unsigned short saddr, int slength,
-			      unsigned char *rxdata, int rxlength)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = slength,
-			.buf = rxdata,
-		},
-		{
-			.addr = saddr,
-			.flags = I2C_M_RD,
-			.len = rxlength,
-			.buf = rxdata,
-		},
-	};
-
-	if (i2c_transfer(mt9p012_client->adapter, msgs, 2) < 0) {
-		CDBG("mt9p012_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-static int32_t mt9p012_i2c_read_b(unsigned short saddr, unsigned char raddr,
-				  unsigned short *rdata)
-{
-	int32_t rc = 0;
-	if (!rdata)
-		return -EIO;
-	rc = mt9p012_i2c_rxdata(saddr, 1, &raddr, 1);
-	if (rc < 0)
-		return rc;
-	*rdata = raddr;
-	if (rc < 0)
-		CDBG("mt9p012_i2c_read_b failed!\n");
-	return rc;
-}
-
-static int32_t mt9p012_i2c_read_w(unsigned short saddr, unsigned short raddr,
-				  unsigned short *rdata)
-{
-	int32_t rc = 0;
-	unsigned char buf[4];
-
-	if (!rdata)
-		return -EIO;
-
-	memset(buf, 0, sizeof(buf));
-
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-
-	rc = mt9p012_i2c_rxdata(saddr, 2, buf, 2);
-	if (rc < 0)
-		return rc;
-
-	*rdata = buf[0] << 8 | buf[1];
-
-	if (rc < 0)
-		CDBG("mt9p012_i2c_read failed!\n");
-
-	return rc;
-}
-
-static int32_t mt9p012_i2c_txdata(unsigned short saddr, unsigned char *txdata,
-				  int length)
-{
-	struct i2c_msg msg[] = {
-		{
-		 .addr = saddr,
-		 .flags = 0,
-		 .len = length,
-		 .buf = txdata,
-		 },
-	};
-
-	if (i2c_transfer(mt9p012_client->adapter, msg, 1) < 0) {
-		CDBG("mt9p012_i2c_txdata failed\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t mt9p012_i2c_write_b(unsigned short saddr, unsigned short baddr,
-				   unsigned short bdata)
-{
-	int32_t rc = -EIO;
-	unsigned char buf[2];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = baddr;
-	buf[1] = bdata;
-	rc = mt9p012_i2c_txdata(saddr, buf, 2);
-
-	if (rc < 0)
-		CDBG("i2c_write failed, saddr = 0x%x addr = 0x%x, val =0x%x!\n",
-		     saddr, baddr, bdata);
-
-	return rc;
-}
-
-static int32_t mt9p012_i2c_write_w(unsigned short saddr, unsigned short waddr,
-				   unsigned short wdata)
-{
-	int32_t rc = -EIO;
-	unsigned char buf[4];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = (wdata & 0xFF00) >> 8;
-	buf[3] = (wdata & 0x00FF);
-
-	rc = mt9p012_i2c_txdata(saddr, buf, 4);
-
-	if (rc < 0)
-		CDBG("i2c_write_w failed, addr = 0x%x, val = 0x%x!\n",
-		     waddr, wdata);
-
-	return rc;
-}
-
-static int32_t mt9p012_i2c_write_w_table(struct mt9p012_i2c_reg_conf const
-					 *reg_conf_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-
-	for (i = 0; i < num; i++) {
-		rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-					 reg_conf_tbl->waddr,
-					 reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-
-	return rc;
-}
-
-static int32_t mt9p012_test(enum mt9p012_test_mode mo)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return rc;
-
-	if (mo == TEST_OFF)
-		return 0;
-	else {
-		rc = mt9p012_i2c_write_w_table(mt9p012_regs.ttbl,
-					       mt9p012_regs.ttbl_size);
-		if (rc < 0)
-			return rc;
-
-		rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-					 REG_TEST_PATTERN_MODE, (uint16_t) mo);
-		if (rc < 0)
-			return rc;
-	}
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE);
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-
-static int32_t mt9p012_lens_shading_enable(uint8_t is_enable)
-{
-	int32_t rc = 0;
-
-	CDBG("%s: entered. enable = %d\n", __func__, is_enable);
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr, 0x3780,
-				 ((uint16_t) is_enable) << 15);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE);
-
-	CDBG("%s: exiting. rc = %d\n", __func__, rc);
-	return rc;
-}
-
-static int32_t mt9p012_set_lc(void)
-{
-	int32_t rc;
-
-	rc = mt9p012_i2c_write_w_table(mt9p012_regs.rftbl,
-				       mt9p012_regs.rftbl_size);
-
-	return rc;
-}
-
-static void mt9p012_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint32_t divider;	/*Q10 */
-	uint32_t pclk_mult;	/*Q10 */
-
-	if (mt9p012_ctrl->prev_res == QTR_SIZE) {
-		divider = (uint32_t)
-		    (((mt9p012_regs.reg_pat[RES_PREVIEW].frame_length_lines *
-		       mt9p012_regs.reg_pat[RES_PREVIEW].line_length_pck) *
-		      0x00000400) /
-		     (mt9p012_regs.reg_pat[RES_CAPTURE].frame_length_lines *
-		      mt9p012_regs.reg_pat[RES_CAPTURE].line_length_pck));
-
-		pclk_mult =
-		    (uint32_t) ((mt9p012_regs.reg_pat[RES_CAPTURE].
-				 pll_multiplier * 0x00000400) /
-				(mt9p012_regs.reg_pat[RES_PREVIEW].
-				 pll_multiplier));
-	} else {
-		/* full size resolution used for preview. */
-		divider = 0x00000400;	/*1.0 */
-		pclk_mult = 0x00000400;	/*1.0 */
-	}
-
-	/* Verify PCLK settings and frame sizes. */
-	*pfps = (uint16_t) (fps * divider * pclk_mult / 0x00000400 /
-			    0x00000400);
-}
-
-static uint16_t mt9p012_get_prev_lines_pf(void)
-{
-	if (mt9p012_ctrl->prev_res == QTR_SIZE)
-		return mt9p012_regs.reg_pat[RES_PREVIEW].frame_length_lines;
-	else
-		return mt9p012_regs.reg_pat[RES_CAPTURE].frame_length_lines;
-}
-
-static uint16_t mt9p012_get_prev_pixels_pl(void)
-{
-	if (mt9p012_ctrl->prev_res == QTR_SIZE)
-		return mt9p012_regs.reg_pat[RES_PREVIEW].line_length_pck;
-	else
-		return mt9p012_regs.reg_pat[RES_CAPTURE].line_length_pck;
-}
-
-static uint16_t mt9p012_get_pict_lines_pf(void)
-{
-	return mt9p012_regs.reg_pat[RES_CAPTURE].frame_length_lines;
-}
-
-static uint16_t mt9p012_get_pict_pixels_pl(void)
-{
-	return mt9p012_regs.reg_pat[RES_CAPTURE].line_length_pck;
-}
-
-static uint32_t mt9p012_get_pict_max_exp_lc(void)
-{
-	uint16_t snapshot_lines_per_frame;
-
-	if (mt9p012_ctrl->pict_res == QTR_SIZE)
-		snapshot_lines_per_frame =
-		    mt9p012_regs.reg_pat[RES_PREVIEW].frame_length_lines - 1;
-	else
-		snapshot_lines_per_frame =
-		    mt9p012_regs.reg_pat[RES_CAPTURE].frame_length_lines - 1;
-
-	return snapshot_lines_per_frame * 24;
-}
-
-static int32_t mt9p012_set_fps(struct fps_cfg *fps)
-{
-	/* input is new fps in Q10 format */
-	int32_t rc = 0;
-	enum mt9p012_setting setting;
-
-	mt9p012_ctrl->fps_divider = fps->fps_div;
-	mt9p012_ctrl->pict_fps_divider = fps->pict_fps_div;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return -EBUSY;
-
-	if (mt9p012_ctrl->sensormode == SENSOR_PREVIEW_MODE)
-		setting = RES_PREVIEW;
-	else
-		setting = RES_CAPTURE;
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-			REG_FRAME_LENGTH_LINES,
-			(mt9p012_regs.reg_pat[setting].frame_length_lines *
-			fps->fps_div / 0x00000400));
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE);
-
-	return rc;
-}
-
-static int32_t mt9p012_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	uint16_t max_legal_gain = 0x01FF;
-	uint32_t line_length_ratio = 0x00000400;
-	enum mt9p012_setting setting;
-	int32_t rc = 0;
-
-	CDBG("Line:%d mt9p012_write_exp_gain \n", __LINE__);
-
-	if (mt9p012_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-		mt9p012_ctrl->my_reg_gain = gain;
-		mt9p012_ctrl->my_reg_line_count = (uint16_t) line;
-	}
-
-	if (gain > max_legal_gain) {
-		CDBG("Max legal gain Line:%d \n", __LINE__);
-		gain = max_legal_gain;
-	}
-
-	/* Verify no overflow */
-	if (mt9p012_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-		line = (uint32_t) (line * mt9p012_ctrl->fps_divider /
-				   0x00000400);
-		setting = RES_PREVIEW;
-	} else {
-		line = (uint32_t) (line * mt9p012_ctrl->pict_fps_divider /
-				   0x00000400);
-		setting = RES_CAPTURE;
-	}
-
-	/* Set digital gain to 1 */
-#ifdef MT9P012_REV_7
-	gain |= 0x1000;
-#else
-	gain |= 0x0200;
-#endif
-
-	if ((mt9p012_regs.reg_pat[setting].frame_length_lines - 1) < line) {
-		line_length_ratio = (uint32_t) (line * 0x00000400) /
-		    (mt9p012_regs.reg_pat[setting].frame_length_lines - 1);
-	} else
-		line_length_ratio = 0x00000400;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr, REG_GLOBAL_GAIN, gain);
-	if (rc < 0) {
-		CDBG("mt9p012_i2c_write_w failed... Line:%d \n", __LINE__);
-		return rc;
-	}
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_COARSE_INT_TIME, line);
-	if (rc < 0) {
-		CDBG("mt9p012_i2c_write_w failed... Line:%d \n", __LINE__);
-		return rc;
-	}
-
-	CDBG("mt9p012_write_exp_gain: gain = %d, line = %d\n", gain, line);
-
-	return rc;
-}
-
-static int32_t mt9p012_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-
-	CDBG("Line:%d mt9p012_set_pict_exp_gain \n", __LINE__);
-
-	rc = mt9p012_write_exp_gain(gain, line);
-	if (rc < 0) {
-		CDBG("Line:%d mt9p012_set_pict_exp_gain failed... \n",
-		     __LINE__);
-		return rc;
-	}
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 MT9P012_REG_RESET_REGISTER, 0x10CC | 0x0002);
-	if (rc < 0) {
-		CDBG("mt9p012_i2c_write_w failed... Line:%d \n", __LINE__);
-		return rc;
-	}
-
-	mdelay(5);
-
-	/* camera_timed_wait(snapshot_wait*exposure_ratio); */
-	return rc;
-}
-
-static int32_t mt9p012_setting(enum mt9p012_reg_update rupdate,
-			       enum mt9p012_setting rt)
-{
-	int32_t rc = 0;
-
-	switch (rupdate) {
-	case UPDATE_PERIODIC:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct mt9p012_i2c_reg_conf ppc_tbl[] = {
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD},
-				{REG_ROW_SPEED,
-				 mt9p012_regs.reg_pat[rt].row_speed},
-				{REG_X_ADDR_START,
-				 mt9p012_regs.reg_pat[rt].x_addr_start},
-				{REG_X_ADDR_END,
-				 mt9p012_regs.reg_pat[rt].x_addr_end},
-				{REG_Y_ADDR_START,
-				 mt9p012_regs.reg_pat[rt].y_addr_start},
-				{REG_Y_ADDR_END,
-				 mt9p012_regs.reg_pat[rt].y_addr_end},
-				{REG_READ_MODE,
-				 mt9p012_regs.reg_pat[rt].read_mode},
-				{REG_SCALE_M, mt9p012_regs.reg_pat[rt].scale_m},
-				{REG_X_OUTPUT_SIZE,
-				 mt9p012_regs.reg_pat[rt].x_output_size},
-				{REG_Y_OUTPUT_SIZE,
-				 mt9p012_regs.reg_pat[rt].y_output_size},
-
-				{REG_LINE_LENGTH_PCK,
-				 mt9p012_regs.reg_pat[rt].line_length_pck},
-				{REG_FRAME_LENGTH_LINES,
-				 (mt9p012_regs.reg_pat[rt].frame_length_lines *
-				  mt9p012_ctrl->fps_divider / 0x00000400)},
-				{REG_COARSE_INT_TIME,
-				 mt9p012_regs.reg_pat[rt].coarse_int_time},
-				{REG_FINE_INTEGRATION_TIME,
-				 mt9p012_regs.reg_pat[rt].fine_int_time},
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE},
-			};
-			if (update_type == REG_INIT) {
-				update_type = rupdate;
-				return rc;
-			}
-			rc = mt9p012_i2c_write_w_table(&ppc_tbl[0],
-						ARRAY_SIZE(ppc_tbl));
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_test(mt9p012_ctrl->set_test);
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-						 MT9P012_REG_RESET_REGISTER,
-						 MT9P012_RESET_REGISTER_PWON |
-						 0x0002);
-			if (rc < 0)
-				return rc;
-
-			mdelay(5);	/* 15? wait for sensor to transition */
-
-			return rc;
-		}
-		break;		/* UPDATE_PERIODIC */
-
-	case REG_INIT:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct mt9p012_i2c_reg_conf ipc_tbl1[] = {
-				{MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWOFF},
-				{REG_VT_PIX_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].vt_pix_clk_div},
-				{REG_VT_SYS_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].vt_sys_clk_div},
-				{REG_PRE_PLL_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].pre_pll_clk_div},
-				{REG_PLL_MULTIPLIER,
-				 mt9p012_regs.reg_pat[rt].pll_multiplier},
-				{REG_OP_PIX_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].op_pix_clk_div},
-				{REG_OP_SYS_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].op_sys_clk_div},
-#ifdef MT9P012_REV_7
-				{0x30B0, 0x0001},
-				{0x308E, 0xE060},
-				{0x3092, 0x0A52},
-				{0x3094, 0x4656},
-				{0x3096, 0x5652},
-				{0x30CA, 0x8006},
-				{0x312A, 0xDD02},
-				{0x312C, 0x00E4},
-				{0x3170, 0x299A},
-#endif
-				/* optimized settings for noise */
-				{0x3088, 0x6FF6},
-				{0x3154, 0x0282},
-				{0x3156, 0x0381},
-				{0x3162, 0x04CE},
-				{0x0204, 0x0010},
-				{0x0206, 0x0010},
-				{0x0208, 0x0010},
-				{0x020A, 0x0010},
-				{0x020C, 0x0010},
-				{MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWON},
-			};
-
-			struct mt9p012_i2c_reg_conf ipc_tbl2[] = {
-				{MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWOFF},
-				{REG_VT_PIX_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].vt_pix_clk_div},
-				{REG_VT_SYS_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].vt_sys_clk_div},
-				{REG_PRE_PLL_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].pre_pll_clk_div},
-				{REG_PLL_MULTIPLIER,
-				 mt9p012_regs.reg_pat[rt].pll_multiplier},
-				{REG_OP_PIX_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].op_pix_clk_div},
-				{REG_OP_SYS_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].op_sys_clk_div},
-#ifdef MT9P012_REV_7
-				{0x30B0, 0x0001},
-				{0x308E, 0xE060},
-				{0x3092, 0x0A52},
-				{0x3094, 0x4656},
-				{0x3096, 0x5652},
-				{0x30CA, 0x8006},
-				{0x312A, 0xDD02},
-				{0x312C, 0x00E4},
-				{0x3170, 0x299A},
-#endif
-				/* optimized settings for noise */
-				{0x3088, 0x6FF6},
-				{0x3154, 0x0282},
-				{0x3156, 0x0381},
-				{0x3162, 0x04CE},
-				{0x0204, 0x0010},
-				{0x0206, 0x0010},
-				{0x0208, 0x0010},
-				{0x020A, 0x0010},
-				{0x020C, 0x0010},
-				{MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWON},
-			};
-
-			struct mt9p012_i2c_reg_conf ipc_tbl3[] = {
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD},
-				/* Set preview or snapshot mode */
-				{REG_ROW_SPEED,
-				 mt9p012_regs.reg_pat[rt].row_speed},
-				{REG_X_ADDR_START,
-				 mt9p012_regs.reg_pat[rt].x_addr_start},
-				{REG_X_ADDR_END,
-				 mt9p012_regs.reg_pat[rt].x_addr_end},
-				{REG_Y_ADDR_START,
-				 mt9p012_regs.reg_pat[rt].y_addr_start},
-				{REG_Y_ADDR_END,
-				 mt9p012_regs.reg_pat[rt].y_addr_end},
-				{REG_READ_MODE,
-				 mt9p012_regs.reg_pat[rt].read_mode},
-				{REG_SCALE_M, mt9p012_regs.reg_pat[rt].scale_m},
-				{REG_X_OUTPUT_SIZE,
-				 mt9p012_regs.reg_pat[rt].x_output_size},
-				{REG_Y_OUTPUT_SIZE,
-				 mt9p012_regs.reg_pat[rt].y_output_size},
-				{REG_LINE_LENGTH_PCK,
-				 mt9p012_regs.reg_pat[rt].line_length_pck},
-				{REG_FRAME_LENGTH_LINES,
-				 mt9p012_regs.reg_pat[rt].frame_length_lines},
-				{REG_COARSE_INT_TIME,
-				 mt9p012_regs.reg_pat[rt].coarse_int_time},
-				{REG_FINE_INTEGRATION_TIME,
-				 mt9p012_regs.reg_pat[rt].fine_int_time},
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE},
-			};
-
-			/* reset fps_divider */
-			mt9p012_ctrl->fps_divider = 1 * 0x0400;
-
-			rc = mt9p012_i2c_write_w_table(&ipc_tbl1[0],
-						       ARRAY_SIZE(ipc_tbl1));
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_i2c_write_w_table(&ipc_tbl2[0],
-						       ARRAY_SIZE(ipc_tbl2));
-			if (rc < 0)
-				return rc;
-
-			mdelay(5);
-
-			rc = mt9p012_i2c_write_w_table(&ipc_tbl3[0],
-						       ARRAY_SIZE(ipc_tbl3));
-			if (rc < 0)
-				return rc;
-
-			/* load lens shading */
-			rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-						 REG_GROUPED_PARAMETER_HOLD,
-						 GROUPED_PARAMETER_HOLD);
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_set_lc();
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-						 REG_GROUPED_PARAMETER_HOLD,
-						 GROUPED_PARAMETER_UPDATE);
-
-			if (rc < 0)
-				return rc;
-		}
-		update_type = rupdate;
-		break;		/* case REG_INIT: */
-
-	default:
-		rc = -EINVAL;
-		break;
-	}			/* switch (rupdate) */
-
-	return rc;
-}
-
-static int32_t mt9p012_video_config(int mode, int res)
-{
-	int32_t rc;
-
-	switch (res) {
-	case QTR_SIZE:
-		rc = mt9p012_setting(UPDATE_PERIODIC, RES_PREVIEW);
-		if (rc < 0)
-			return rc;
-
-		CDBG("mt9p012 sensor configuration done!\n");
-		break;
-
-	case FULL_SIZE:
-		rc = mt9p012_setting(UPDATE_PERIODIC, RES_CAPTURE);
-		if (rc < 0)
-			return rc;
-
-		break;
-
-	default:
-		return 0;
-	}			/* switch */
-
-	mt9p012_ctrl->prev_res = res;
-	mt9p012_ctrl->curr_res = res;
-	mt9p012_ctrl->sensormode = mode;
-
-	rc = mt9p012_write_exp_gain(mt9p012_ctrl->my_reg_gain,
-				    mt9p012_ctrl->my_reg_line_count);
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 MT9P012_REG_RESET_REGISTER, 0x10cc | 0x0002);
-
-	return rc;
-}
-
-static int32_t mt9p012_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_setting(UPDATE_PERIODIC, RES_CAPTURE);
-	if (rc < 0)
-		return rc;
-
-	mt9p012_ctrl->curr_res = mt9p012_ctrl->pict_res;
-
-	mt9p012_ctrl->sensormode = mode;
-
-	return rc;
-}
-
-static int32_t mt9p012_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_setting(UPDATE_PERIODIC, RES_CAPTURE);
-	if (rc < 0)
-		return rc;
-
-	mt9p012_ctrl->curr_res = mt9p012_ctrl->pict_res;
-
-	mt9p012_ctrl->sensormode = mode;
-
-	return rc;
-}
-
-static int32_t mt9p012_power_down(void)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWOFF);
-
-	mdelay(5);
-	return rc;
-}
-
-static int32_t mt9p012_move_focus(int direction, int32_t num_steps)
-{
-	int32_t rc;
-	int16_t step_direction;
-	int16_t actual_step;
-	int16_t next_position;
-	uint8_t code_val;
-	uint8_t time_out;
-	uint8_t temp_pos;
-
-	uint16_t actual_position_target;
-	if (num_steps > MT9P012_TOTAL_STEPS_NEAR_TO_FAR)
-		num_steps = MT9P012_TOTAL_STEPS_NEAR_TO_FAR;
-	else if (num_steps == 0) {
-		CDBG("mt9p012_move_focus failed at line %d ...\n", __LINE__);
-		return -EINVAL;
-	}
-
-	if (direction == MOVE_NEAR)
-		step_direction = -1;
-	else if (direction == MOVE_FAR)
-		step_direction = 1;
-	else {
-		CDBG("mt9p012_move_focus failed at line %d ...\n", __LINE__);
-		return -EINVAL;
-	}
-
-	if (mt9p012_ctrl->curr_lens_pos < mt9p012_ctrl->init_curr_lens_pos)
-		mt9p012_ctrl->curr_lens_pos = mt9p012_ctrl->init_curr_lens_pos;
-
-	actual_step = (int16_t) (step_direction * (int16_t) num_steps);
-	next_position = (int16_t) (mt9p012_ctrl->curr_lens_pos + actual_step);
-
-	if (next_position > MT9P012_TOTAL_STEPS_NEAR_TO_FAR)
-		next_position = MT9P012_TOTAL_STEPS_NEAR_TO_FAR;
-	else if (next_position < 0)
-		next_position = 0;
-
-	if (num_steps >= 10)
-		time_out = 100;
-	else
-		time_out = 30;
-	code_val = next_position;
-	actual_position_target = bam_step_lookup_table[code_val];
-	rc = mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x01, 0x29);
-	if (rc < 0)
-		return rc;
-	temp_pos = (uint8_t) (actual_position_target >> 8);
-	rc = mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x05, temp_pos);
-	if (rc < 0)
-		return rc;
-	temp_pos = (uint8_t) (actual_position_target & 0x00FF);
-	/* code_val_lsb |= mode_mask; */
-	rc = mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x06, temp_pos);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x0B, time_out);
-	if (rc < 0)
-		return rc;
-	rc = mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x07, 0x27);
-	if (rc < 0)
-		return rc;
-
-	mdelay(time_out);
-
-	/* Storing the current lens Position */
-	mt9p012_ctrl->curr_lens_pos = next_position;
-
-	return rc;
-}
-
-static int32_t mt9p012_set_default_focus(void)
-{
-	int32_t rc = 0;
-
-	uint8_t temp_pos;
-
-	/* Write the digital code for current to the actuator */
-	rc = mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x01, 0x29);
-	if (rc < 0)
-		return rc;
-	temp_pos = (uint8_t) (bam_infinite >> 8);
-
-	rc = mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x05, temp_pos);
-	if (rc < 0)
-		return rc;
-	temp_pos = (uint8_t) (bam_infinite & 0x00FF);
-	rc = mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x06, temp_pos);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x0B, 0x64);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x07, 0x27);
-	if (rc < 0)
-		return rc;
-
-	mdelay(140);
-
-	mt9p012_ctrl->curr_lens_pos = MT9P012_TOTAL_STEPS_NEAR_TO_FAR;
-
-	return rc;
-}
-
-static int mt9p012_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	gpio_direction_output(data->sensor_reset, 0);
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int mt9p012_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc;
-	uint16_t chipid;
-
-	rc = gpio_request(data->sensor_reset, "mt9p012");
-	if (!rc)
-		gpio_direction_output(data->sensor_reset, 1);
-	else
-		goto init_probe_done;
-
-	msleep(20);
-
-	/* RESET the sensor image part via I2C command */
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 MT9P012_REG_RESET_REGISTER, 0x10CC | 0x0001);
-	if (rc < 0) {
-		CDBG("sensor reset failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-
-	msleep(MT9P012_RESET_DELAY_MSECS);
-
-	/* 3. Read sensor Model ID: */
-	rc = mt9p012_i2c_read_w(mt9p012_client->addr,
-				MT9P012_REG_MODEL_ID, &chipid);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	/* 4. Compare sensor ID to MT9T012VC ID: */
-	if (chipid != MT9P012_MODEL_ID) {
-		rc = -ENODEV;
-		goto init_probe_fail;
-	}
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr, 0x306E, 0x9000);
-	if (rc < 0) {
-		CDBG("REV_7 write failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-
-	/* RESET_REGISTER, enable parallel interface and disable serialiser */
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr, 0x301A, 0x10CC);
-	if (rc < 0) {
-		CDBG("enable parallel interface failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-
-	/* To disable the 2 extra lines */
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr, 0x3064, 0x0805);
-
-	if (rc < 0) {
-		CDBG("disable the 2 extra lines failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-
-	goto init_probe_done;
-
-init_probe_fail:
-	mt9p012_probe_init_done(data);
-init_probe_done:
-	return rc;
-}
-
-static int mt9p012_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc;
-	unsigned short temp_pos;
-	uint8_t i;
-	uint16_t temp;
-
-	mt9p012_ctrl = kzalloc(sizeof(struct mt9p012_ctrl), GFP_KERNEL);
-	if (!mt9p012_ctrl) {
-		CDBG("mt9p012_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-
-	mt9p012_ctrl->fps_divider = 1 * 0x00000400;
-	mt9p012_ctrl->pict_fps_divider = 1 * 0x00000400;
-	mt9p012_ctrl->set_test = TEST_OFF;
-	mt9p012_ctrl->prev_res = QTR_SIZE;
-	mt9p012_ctrl->pict_res = FULL_SIZE;
-
-	if (data)
-		mt9p012_ctrl->sensordata = data;
-
-	msm_camio_camif_pad_reg_reset();
-	mdelay(20);
-
-	rc = mt9p012_probe_init_sensor(data);
-	if (rc < 0)
-		goto init_fail1;
-
-	if (mt9p012_ctrl->prev_res == QTR_SIZE)
-		rc = mt9p012_setting(REG_INIT, RES_PREVIEW);
-	else
-		rc = mt9p012_setting(REG_INIT, RES_CAPTURE);
-
-	if (rc < 0) {
-		CDBG("mt9p012_setting failed. rc = %d\n", rc);
-		goto init_fail1;
-	}
-
-	/* sensor : output enable */
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWON);
-	if (rc < 0) {
-		CDBG("sensor output enable failed. rc = %d\n", rc);
-		goto init_fail1;
-	}
-
-	/* enable AF actuator */
-	rc = gpio_request(mt9p012_ctrl->sensordata->vcm_pwd, "mt9p012");
-	if (!rc)
-		gpio_direction_output(mt9p012_ctrl->sensordata->vcm_pwd, 1);
-	else {
-		CDBG("mt9p012_ctrl gpio request failed!\n");
-		goto init_fail1;
-	}
-
-	mdelay(20);
-
-	bam_infinite = 0;
-	bam_macro = 0;
-	/*initialize AF actuator */
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x01, 0x09);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x07, 0x2E);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x0A, 0x01);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x17, 0x06);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x16, 0x0A);
-
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x01, 0x29);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x05, 0x00);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x06, 0x00);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x0B, 0x64);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x07, 0x27);
-	mdelay(140);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x01, 0x29);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x05, 0x03);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x06, 0xFF);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x0B, 0x64);
-	mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1, 0x07, 0x27);
-	mdelay(140);
-
-	if (mt9p012_i2c_read_b(MT9P012_AF_I2C_ADDR >> 1, 0x12, &temp_pos)
-	    >= 0) {
-		bam_infinite = (uint16_t) temp_pos;
-		if (mt9p012_i2c_read_b
-		    (MT9P012_AF_I2C_ADDR >> 1, 0x13, &temp_pos) >= 0)
-			bam_infinite =
-			    (bam_infinite << 8) | ((uint16_t) temp_pos);
-	} else {
-		bam_infinite = 100;
-	}
-
-	if (mt9p012_i2c_read_b(MT9P012_AF_I2C_ADDR >> 1, 0x14, &temp_pos)
-	    >= 0) {
-		bam_macro = (uint16_t) temp_pos;
-		if (mt9p012_i2c_read_b
-		    (MT9P012_AF_I2C_ADDR >> 1, 0x15, &temp_pos) >= 0)
-			bam_macro = (bam_macro << 8) | ((uint16_t) temp_pos);
-	}
-	temp = (bam_infinite - bam_macro) / MT9P012_TOTAL_STEPS_NEAR_TO_FAR;
-	for (i = 0; i < MT9P012_TOTAL_STEPS_NEAR_TO_FAR; i++)
-		bam_step_lookup_table[i] = bam_macro + temp * i;
-
-	bam_step_lookup_table[MT9P012_TOTAL_STEPS_NEAR_TO_FAR] = bam_infinite;
-
-	rc = mt9p012_set_default_focus();
-	if (rc >= 0)
-		goto init_done;
-
-init_fail1:
-	mt9p012_probe_init_done(data);
-	kfree(mt9p012_ctrl);
-init_done:
-	return rc;
-}
-
-static int mt9p012_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&mt9p012_wait_queue);
-	return 0;
-}
-
-static int32_t mt9p012_set_sensor_mode(int mode, int res)
-{
-	int32_t rc = 0;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = mt9p012_video_config(mode, res);
-		break;
-
-	case SENSOR_SNAPSHOT_MODE:
-		rc = mt9p012_snapshot_config(mode);
-		break;
-
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = mt9p012_raw_snapshot_config(mode);
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	return rc;
-}
-
-int mt9p012_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	int rc = 0;
-
-	if (copy_from_user(&cdata,
-			   (void *)argp, sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-
-	mutex_lock(&mt9p012_mut);
-
-	CDBG("%s: cfgtype = %d\n", __func__, cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		mt9p012_get_pict_fps(cdata.cfg.gfps.prevfps,
-				     &(cdata.cfg.gfps.pictfps));
-
-		if (copy_to_user((void *)argp, &cdata,
-				 sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf = mt9p012_get_prev_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl = mt9p012_get_prev_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf = mt9p012_get_pict_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl = mt9p012_get_pict_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc = mt9p012_get_pict_max_exp_lc();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = mt9p012_set_fps(&(cdata.cfg.fps));
-		break;
-
-	case CFG_SET_EXP_GAIN:
-		rc = mt9p012_write_exp_gain(cdata.cfg.exp_gain.gain,
-					    cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_PICT_EXP_GAIN:
-		CDBG("Line:%d CFG_SET_PICT_EXP_GAIN \n", __LINE__);
-		rc = mt9p012_set_pict_exp_gain(cdata.cfg.exp_gain.gain,
-					       cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_MODE:
-		rc = mt9p012_set_sensor_mode(cdata.mode, cdata.rs);
-		break;
-
-	case CFG_PWR_DOWN:
-		rc = mt9p012_power_down();
-		break;
-
-	case CFG_MOVE_FOCUS:
-		CDBG("mt9p012_ioctl: CFG_MOVE_FOCUS: dir=%d steps=%d\n",
-		     cdata.cfg.focus.dir, cdata.cfg.focus.steps);
-		rc = mt9p012_move_focus(cdata.cfg.focus.dir,
-					cdata.cfg.focus.steps);
-		break;
-
-	case CFG_SET_DEFAULT_FOCUS:
-		rc = mt9p012_set_default_focus();
-
-		break;
-
-	case CFG_SET_EFFECT:
-		rc = mt9p012_set_default_focus();
-		break;
-
-	case CFG_SET_LENS_SHADING:
-		CDBG("%s: CFG_SET_LENS_SHADING\n", __func__);
-		rc = mt9p012_lens_shading_enable(cdata.cfg.lens_shading);
-		break;
-
-	case CFG_GET_AF_MAX_STEPS:
-		cdata.max_steps = MT9P012_STEPS_NEAR_TO_CLOSEST_INF;
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	mutex_unlock(&mt9p012_mut);
-	return rc;
-}
-
-int mt9p012_sensor_release(void)
-{
-	int rc = -EBADF;
-
-	mutex_lock(&mt9p012_mut);
-
-	mt9p012_power_down();
-
-	gpio_direction_output(mt9p012_ctrl->sensordata->sensor_reset, 0);
-	gpio_free(mt9p012_ctrl->sensordata->sensor_reset);
-
-	gpio_direction_output(mt9p012_ctrl->sensordata->vcm_pwd, 0);
-	gpio_free(mt9p012_ctrl->sensordata->vcm_pwd);
-
-	kfree(mt9p012_ctrl);
-	mt9p012_ctrl = NULL;
-
-	CDBG("mt9p012_release completed\n");
-
-	mutex_unlock(&mt9p012_mut);
-	return rc;
-}
-
-static int mt9p012_i2c_probe(struct i2c_client *client,
-			     const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("mt9p012_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	mt9p012_sensorw = kzalloc(sizeof(struct mt9p012_work), GFP_KERNEL);
-	if (!mt9p012_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, mt9p012_sensorw);
-	mt9p012_init_client(client);
-	mt9p012_client = client;
-
-	mdelay(50);
-
-	CDBG("mt9p012_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("mt9p012_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int __exit mt9p012_remove(struct i2c_client *client)
-{
-	struct mt9p012_work_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	mt9p012_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static const struct i2c_device_id mt9p012_i2c_id[] = {
-	{"mt9p012", 0}
-};
-
-static struct i2c_driver mt9p012_i2c_driver = {
-	.id_table = mt9p012_i2c_id,
-	.probe = mt9p012_i2c_probe,
-	.remove = __exit_p(mt9p012_i2c_remove),
-	.driver = {
-		.name = "mt9p012",
-	},
-};
-
-static int mt9p012_sensor_probe(const struct msm_camera_sensor_info *info,
-				struct msm_sensor_ctrl *s)
-{
-	int rc = i2c_add_driver(&mt9p012_i2c_driver);
-	if (rc < 0 || mt9p012_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_done;
-	}
-
-	msm_camio_clk_rate_set(MT9P012_DEFAULT_CLOCK_RATE);
-	mdelay(20);
-
-	rc = mt9p012_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_done;
-
-	s->s_init = mt9p012_sensor_open_init;
-	s->s_release = mt9p012_sensor_release;
-	s->s_config = mt9p012_sensor_config;
-	s->s_mount_angle  = 0;
-	mt9p012_probe_init_done(info);
-
-probe_done:
-	CDBG("%s %s:%d\n", __FILE__, __func__, __LINE__);
-	return rc;
-}
-
-static int __mt9p012_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, mt9p012_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __mt9p012_probe,
-	.driver = {
-		.name = "msm_camera_mt9p012",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init mt9p012_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(mt9p012_init);
-void mt9p012_exit(void)
-{
-	i2c_del_driver(&mt9p012_i2c_driver);
-}
diff --git a/drivers/media/video/msm/mt9p012_fox.c b/drivers/media/video/msm/mt9p012_fox.c
deleted file mode 100644
index a8d90c1..0000000
--- a/drivers/media/video/msm/mt9p012_fox.c
+++ /dev/null
@@ -1,1346 +0,0 @@
-/* Copyright (c) 2009, 2011 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/kernel.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include "mt9p012.h"
-
-/*=============================================================
-    SENSOR REGISTER DEFINES
-==============================================================*/
-#define MT9P012_REG_MODEL_ID         0x0000
-#define MT9P012_MODEL_ID             0x2801
-#define REG_GROUPED_PARAMETER_HOLD   0x0104
-#define GROUPED_PARAMETER_HOLD       0x0100
-#define GROUPED_PARAMETER_UPDATE     0x0000
-#define REG_COARSE_INT_TIME          0x3012
-#define REG_VT_PIX_CLK_DIV           0x0300
-#define REG_VT_SYS_CLK_DIV           0x0302
-#define REG_PRE_PLL_CLK_DIV          0x0304
-#define REG_PLL_MULTIPLIER           0x0306
-#define REG_OP_PIX_CLK_DIV           0x0308
-#define REG_OP_SYS_CLK_DIV           0x030A
-#define REG_SCALE_M                  0x0404
-#define REG_FRAME_LENGTH_LINES       0x300A
-#define REG_LINE_LENGTH_PCK          0x300C
-#define REG_X_ADDR_START             0x3004
-#define REG_Y_ADDR_START             0x3002
-#define REG_X_ADDR_END               0x3008
-#define REG_Y_ADDR_END               0x3006
-#define REG_X_OUTPUT_SIZE            0x034C
-#define REG_Y_OUTPUT_SIZE            0x034E
-#define REG_FINE_INTEGRATION_TIME    0x3014
-#define REG_ROW_SPEED                0x3016
-#define MT9P012_REG_RESET_REGISTER   0x301A
-#define MT9P012_RESET_REGISTER_PWON  0x10CC
-#define MT9P012_RESET_REGISTER_PWOFF 0x10C8
-#define REG_READ_MODE                0x3040
-#define REG_GLOBAL_GAIN              0x305E
-#define REG_TEST_PATTERN_MODE        0x3070
-
-#define MT9P012_REV_7
-
-enum mt9p012_test_mode {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum mt9p012_resolution {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-
-enum mt9p012_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-enum mt9p012_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-
-/* actuator's Slave Address */
-#define MT9P012_AF_I2C_ADDR   0x18
-
-/* AF Total steps parameters */
-#define MT9P012_STEPS_NEAR_TO_CLOSEST_INF  32
-#define MT9P012_TOTAL_STEPS_NEAR_TO_FAR    32
-
-#define MT9P012_MU5M0_PREVIEW_DUMMY_PIXELS 0
-#define MT9P012_MU5M0_PREVIEW_DUMMY_LINES  0
-
-/* Time in milisecs for waiting for the sensor to reset.*/
-#define MT9P012_RESET_DELAY_MSECS   66
-
-/* for 20 fps preview */
-#define MT9P012_DEFAULT_CLOCK_RATE  24000000
-#define MT9P012_DEFAULT_MAX_FPS     26	/* ???? */
-
-struct mt9p012_work {
-	struct work_struct work;
-};
-static struct mt9p012_work *mt9p012_sensorw;
-static struct i2c_client *mt9p012_client;
-
-struct mt9p012_ctrl {
-	const struct msm_camera_sensor_info *sensordata;
-
-	int sensormode;
-	uint32_t fps_divider;	/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;	/* init to 1 * 0x00000400 */
-
-	uint16_t curr_lens_pos;
-	uint16_t init_curr_lens_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-
-	enum mt9p012_resolution prev_res;
-	enum mt9p012_resolution pict_res;
-	enum mt9p012_resolution curr_res;
-	enum mt9p012_test_mode set_test;
-};
-static uint16_t update_type = UPDATE_PERIODIC;
-static struct mt9p012_ctrl *mt9p012_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(mt9p012_wait_queue);
-DEFINE_MUTEX(mt9p012_mut);
-
-
-/*=============================================================*/
-
-static int mt9p012_i2c_rxdata(unsigned short saddr, unsigned char *rxdata,
-			      int length)
-{
-	int retry_cnt = 0;
-	int rc;
-
-	struct i2c_msg msgs[] = {
-		{
-		 .addr = saddr,
-		 .flags = 0,
-		 .len = 2,
-		 .buf = rxdata,
-		 },
-		{
-		 .addr = saddr,
-		 .flags = I2C_M_RD,
-		 .len = length,
-		 .buf = rxdata,
-		 },
-	};
-
-	do {
-		rc = i2c_transfer(mt9p012_client->adapter, msgs, 2);
-		if (rc > 0)
-			break;
-		retry_cnt++;
-	} while (retry_cnt < 3);
-
-	if (rc < 0) {
-		pr_err("mt9p012_i2c_rxdata failed!:%d %d\n", rc, retry_cnt);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t mt9p012_i2c_read_w(unsigned short saddr, unsigned short raddr,
-				  unsigned short *rdata)
-{
-	int32_t rc = 0;
-	unsigned char buf[4];
-
-	if (!rdata)
-		return -EIO;
-
-	memset(buf, 0, sizeof(buf));
-
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-
-	rc = mt9p012_i2c_rxdata(saddr, buf, 2);
-	if (rc < 0)
-		return rc;
-
-	*rdata = buf[0] << 8 | buf[1];
-
-	if (rc < 0)
-		CDBG("mt9p012_i2c_read failed!\n");
-
-	return rc;
-}
-
-static int32_t mt9p012_i2c_txdata(unsigned short saddr, unsigned char *txdata,
-				  int length)
-{
-	int retry_cnt = 0;
-	int rc;
-
-	struct i2c_msg msg[] = {
-		{
-		 .addr = saddr,
-		 .flags = 0,
-		 .len = length,
-		 .buf = txdata,
-		 },
-	};
-
-	do {
-		rc = i2c_transfer(mt9p012_client->adapter, msg, 1);
-		if (rc > 0)
-			break;
-		retry_cnt++;
-	} while (retry_cnt < 3);
-
-	if (rc < 0) {
-		pr_err("mt9p012_i2c_txdata failed: %d %d\n", rc, retry_cnt);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t mt9p012_i2c_write_b(unsigned short saddr, unsigned short baddr,
-				   unsigned short bdata)
-{
-	int32_t rc = -EIO;
-	unsigned char buf[2];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = baddr;
-	buf[1] = bdata;
-	rc = mt9p012_i2c_txdata(saddr, buf, 2);
-
-	if (rc < 0)
-		CDBG("i2c_write failed, saddr = 0x%x addr = 0x%x, val =0x%x!\n",
-		     saddr, baddr, bdata);
-
-	return rc;
-}
-
-static int32_t mt9p012_i2c_write_w(unsigned short saddr, unsigned short waddr,
-				   unsigned short wdata)
-{
-	int32_t rc = -EIO;
-	unsigned char buf[4];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = (wdata & 0xFF00) >> 8;
-	buf[3] = (wdata & 0x00FF);
-
-	rc = mt9p012_i2c_txdata(saddr, buf, 4);
-
-	if (rc < 0)
-		CDBG("i2c_write_w failed, addr = 0x%x, val = 0x%x!\n",
-		     waddr, wdata);
-
-	return rc;
-}
-
-static int32_t mt9p012_i2c_write_w_table(struct mt9p012_i2c_reg_conf const
-					 *reg_conf_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-
-	for (i = 0; i < num; i++) {
-		rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-					 reg_conf_tbl->waddr,
-					 reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-
-	return rc;
-}
-
-static int32_t mt9p012_test(enum mt9p012_test_mode mo)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return rc;
-
-	if (mo == TEST_OFF)
-		return 0;
-	else {
-		rc = mt9p012_i2c_write_w_table(mt9p012_regs.ttbl,
-					       mt9p012_regs.ttbl_size);
-		if (rc < 0)
-			return rc;
-
-		rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-					 REG_TEST_PATTERN_MODE, (uint16_t) mo);
-		if (rc < 0)
-			return rc;
-	}
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE);
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-
-static int32_t mt9p012_lens_shading_enable(uint8_t is_enable)
-{
-	int32_t rc = 0;
-
-	CDBG("%s: entered. enable = %d\n", __func__, is_enable);
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr, 0x3780,
-				 ((uint16_t) is_enable) << 15);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE);
-
-	CDBG("%s: exiting. rc = %d\n", __func__, rc);
-	return rc;
-}
-
-static int32_t mt9p012_set_lc(void)
-{
-	int32_t rc;
-
-	rc = mt9p012_i2c_write_w_table(mt9p012_regs.rftbl,
-				       mt9p012_regs.rftbl_size);
-
-	return rc;
-}
-
-static void mt9p012_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint32_t divider;	/*Q10 */
-	uint32_t pclk_mult;	/*Q10 */
-	uint32_t d1;
-	uint32_t d2;
-
-	d1 =
-		(uint32_t)(
-		(mt9p012_regs.reg_pat[RES_PREVIEW].frame_length_lines *
-		0x00000400) /
-		mt9p012_regs.reg_pat[RES_CAPTURE].frame_length_lines);
-
-	d2 =
-		(uint32_t)(
-		(mt9p012_regs.reg_pat[RES_PREVIEW].line_length_pck *
-		0x00000400) /
-		mt9p012_regs.reg_pat[RES_CAPTURE].line_length_pck);
-
-	divider = (uint32_t) (d1 * d2) / 0x00000400;
-
-	pclk_mult =
-		(uint32_t) ((mt9p012_regs.reg_pat[RES_CAPTURE].pll_multiplier *
-		0x00000400) /
-		(mt9p012_regs.reg_pat[RES_PREVIEW].pll_multiplier));
-
-	/* Verify PCLK settings and frame sizes. */
-	*pfps = (uint16_t) (fps * divider * pclk_mult / 0x00000400 /
-			    0x00000400);
-}
-
-static uint16_t mt9p012_get_prev_lines_pf(void)
-{
-	if (mt9p012_ctrl->prev_res == QTR_SIZE)
-		return mt9p012_regs.reg_pat[RES_PREVIEW].frame_length_lines;
-	else
-		return mt9p012_regs.reg_pat[RES_CAPTURE].frame_length_lines;
-}
-
-static uint16_t mt9p012_get_prev_pixels_pl(void)
-{
-	if (mt9p012_ctrl->prev_res == QTR_SIZE)
-		return mt9p012_regs.reg_pat[RES_PREVIEW].line_length_pck;
-	else
-		return mt9p012_regs.reg_pat[RES_CAPTURE].line_length_pck;
-}
-
-static uint16_t mt9p012_get_pict_lines_pf(void)
-{
-	return mt9p012_regs.reg_pat[RES_CAPTURE].frame_length_lines;
-}
-
-static uint16_t mt9p012_get_pict_pixels_pl(void)
-{
-	return mt9p012_regs.reg_pat[RES_CAPTURE].line_length_pck;
-}
-
-static uint32_t mt9p012_get_pict_max_exp_lc(void)
-{
-	uint16_t snapshot_lines_per_frame;
-
-	if (mt9p012_ctrl->pict_res == QTR_SIZE)
-		snapshot_lines_per_frame =
-		    mt9p012_regs.reg_pat[RES_PREVIEW].frame_length_lines - 1;
-	else
-		snapshot_lines_per_frame =
-		    mt9p012_regs.reg_pat[RES_CAPTURE].frame_length_lines - 1;
-
-	return snapshot_lines_per_frame * 24;
-}
-
-static int32_t mt9p012_set_fps(struct fps_cfg *fps)
-{
-	/* input is new fps in Q10 format */
-	int32_t rc = 0;
-	enum mt9p012_setting setting;
-
-	mt9p012_ctrl->fps_divider = fps->fps_div;
-	mt9p012_ctrl->pict_fps_divider = fps->pict_fps_div;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return -EBUSY;
-
-	if (mt9p012_ctrl->sensormode == SENSOR_PREVIEW_MODE)
-		setting = RES_PREVIEW;
-	else
-		setting = RES_CAPTURE;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-		REG_FRAME_LENGTH_LINES,
-		(mt9p012_regs.reg_pat[setting].frame_length_lines *
-		fps->fps_div / 0x00000400));
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE);
-
-	return rc;
-}
-
-static int32_t mt9p012_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	uint16_t max_legal_gain = 0x01FF;
-	uint32_t line_length_ratio = 0x00000400;
-	enum mt9p012_setting setting;
-	int32_t rc = 0;
-
-	CDBG("Line:%d mt9p012_write_exp_gain \n", __LINE__);
-
-	if (mt9p012_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-		mt9p012_ctrl->my_reg_gain = gain;
-		mt9p012_ctrl->my_reg_line_count = (uint16_t) line;
-	}
-
-	if (gain > max_legal_gain) {
-		CDBG("Max legal gain Line:%d \n", __LINE__);
-		gain = max_legal_gain;
-	}
-
-	/* Verify no overflow */
-	if (mt9p012_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-		line = (uint32_t) (line * mt9p012_ctrl->fps_divider /
-				   0x00000400);
-		setting = RES_PREVIEW;
-	} else {
-		line = (uint32_t) (line * mt9p012_ctrl->pict_fps_divider /
-				   0x00000400);
-		setting = RES_CAPTURE;
-	}
-
-	/* Set digital gain to 1 */
-#ifdef MT9P012_REV_7
-	gain |= 0x1000;
-#else
-	gain |= 0x0200;
-#endif
-
-	if ((mt9p012_regs.reg_pat[setting].frame_length_lines - 1) < line) {
-		line_length_ratio = (uint32_t) (line * 0x00000400) /
-		    (mt9p012_regs.reg_pat[setting].frame_length_lines - 1);
-	} else
-		line_length_ratio = 0x00000400;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr, REG_GLOBAL_GAIN, gain);
-	if (rc < 0) {
-		CDBG("mt9p012_i2c_write_w failed... Line:%d \n", __LINE__);
-		return rc;
-	}
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 REG_COARSE_INT_TIME, line);
-	if (rc < 0) {
-		CDBG("mt9p012_i2c_write_w failed... Line:%d \n", __LINE__);
-		return rc;
-	}
-
-	CDBG("mt9p012_write_exp_gain: gain = %d, line = %d\n", gain, line);
-
-	return rc;
-}
-
-static int32_t mt9p012_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-
-	CDBG("Line:%d mt9p012_set_pict_exp_gain \n", __LINE__);
-
-	rc = mt9p012_write_exp_gain(gain, line);
-	if (rc < 0) {
-		CDBG("Line:%d mt9p012_set_pict_exp_gain failed... \n",
-		     __LINE__);
-		return rc;
-	}
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 MT9P012_REG_RESET_REGISTER, 0x10CC | 0x0002);
-	if (rc < 0) {
-		CDBG("mt9p012_i2c_write_w failed... Line:%d \n", __LINE__);
-		return rc;
-	}
-
-	mdelay(5);
-
-	/* camera_timed_wait(snapshot_wait*exposure_ratio); */
-	return rc;
-}
-
-static int32_t mt9p012_setting(enum mt9p012_reg_update rupdate,
-			       enum mt9p012_setting rt)
-{
-	int32_t rc = 0;
-	switch (rupdate) {
-	case UPDATE_PERIODIC:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct mt9p012_i2c_reg_conf ppc_tbl[] = {
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD},
-				{REG_ROW_SPEED,
-				 mt9p012_regs.reg_pat[rt].row_speed},
-				{REG_X_ADDR_START,
-				 mt9p012_regs.reg_pat[rt].x_addr_start},
-				{REG_X_ADDR_END,
-				 mt9p012_regs.reg_pat[rt].x_addr_end},
-				{REG_Y_ADDR_START,
-				 mt9p012_regs.reg_pat[rt].y_addr_start},
-				{REG_Y_ADDR_END,
-				 mt9p012_regs.reg_pat[rt].y_addr_end},
-				{REG_READ_MODE,
-				 mt9p012_regs.reg_pat[rt].read_mode},
-				{REG_SCALE_M, mt9p012_regs.reg_pat[rt].scale_m},
-				{REG_X_OUTPUT_SIZE,
-				 mt9p012_regs.reg_pat[rt].x_output_size},
-				{REG_Y_OUTPUT_SIZE,
-				 mt9p012_regs.reg_pat[rt].y_output_size},
-
-				{REG_LINE_LENGTH_PCK,
-				 mt9p012_regs.reg_pat[rt].line_length_pck},
-				{REG_FRAME_LENGTH_LINES,
-				 (mt9p012_regs.reg_pat[rt].frame_length_lines *
-				  mt9p012_ctrl->fps_divider / 0x00000400)},
-				{REG_COARSE_INT_TIME,
-				 mt9p012_regs.reg_pat[rt].coarse_int_time},
-				{REG_FINE_INTEGRATION_TIME,
-				 mt9p012_regs.reg_pat[rt].fine_int_time},
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE},
-			};
-			if (update_type == REG_INIT) {
-				update_type = rupdate;
-				return rc;
-			}
-			rc = mt9p012_i2c_write_w_table(&ppc_tbl[0],
-						ARRAY_SIZE(ppc_tbl));
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_test(mt9p012_ctrl->set_test);
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-						 MT9P012_REG_RESET_REGISTER,
-						 MT9P012_RESET_REGISTER_PWON |
-						 0x0002);
-			if (rc < 0)
-				return rc;
-
-			mdelay(5);	/* 15? wait for sensor to transition */
-
-			return rc;
-		}
-		break;		/* UPDATE_PERIODIC */
-
-	case REG_INIT:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct mt9p012_i2c_reg_conf ipc_tbl1[] = {
-				{MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWOFF},
-				{REG_VT_PIX_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].vt_pix_clk_div},
-				{REG_VT_SYS_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].vt_sys_clk_div},
-				{REG_PRE_PLL_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].pre_pll_clk_div},
-				{REG_PLL_MULTIPLIER,
-				 mt9p012_regs.reg_pat[rt].pll_multiplier},
-				{REG_OP_PIX_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].op_pix_clk_div},
-				{REG_OP_SYS_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].op_sys_clk_div},
-#ifdef MT9P012_REV_7
-				{0x30B0, 0x0001},
-				{0x308E, 0xE060},
-				{0x3092, 0x0A52},
-				{0x3094, 0x4656},
-				{0x3096, 0x5652},
-				{0x30CA, 0x8006},
-				{0x312A, 0xDD02},
-				{0x312C, 0x00E4},
-				{0x3170, 0x299A},
-#endif
-				/* optimized settings for noise */
-				{0x3088, 0x6FF6},
-				{0x3154, 0x0282},
-				{0x3156, 0x0381},
-				{0x3162, 0x04CE},
-				{0x0204, 0x0010},
-				{0x0206, 0x0010},
-				{0x0208, 0x0010},
-				{0x020A, 0x0010},
-				{0x020C, 0x0010},
-				{MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWON},
-			};
-
-			struct mt9p012_i2c_reg_conf ipc_tbl2[] = {
-				{MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWOFF},
-				{REG_VT_PIX_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].vt_pix_clk_div},
-				{REG_VT_SYS_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].vt_sys_clk_div},
-				{REG_PRE_PLL_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].pre_pll_clk_div},
-				{REG_PLL_MULTIPLIER,
-				 mt9p012_regs.reg_pat[rt].pll_multiplier},
-				{REG_OP_PIX_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].op_pix_clk_div},
-				{REG_OP_SYS_CLK_DIV,
-				 mt9p012_regs.reg_pat[rt].op_sys_clk_div},
-#ifdef MT9P012_REV_7
-				{0x30B0, 0x0001},
-				{0x308E, 0xE060},
-				{0x3092, 0x0A52},
-				{0x3094, 0x4656},
-				{0x3096, 0x5652},
-				{0x30CA, 0x8006},
-				{0x312A, 0xDD02},
-				{0x312C, 0x00E4},
-				{0x3170, 0x299A},
-#endif
-				/* optimized settings for noise */
-				{0x3088, 0x6FF6},
-				{0x3154, 0x0282},
-				{0x3156, 0x0381},
-				{0x3162, 0x04CE},
-				{0x0204, 0x0010},
-				{0x0206, 0x0010},
-				{0x0208, 0x0010},
-				{0x020A, 0x0010},
-				{0x020C, 0x0010},
-				{MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWON},
-			};
-
-			struct mt9p012_i2c_reg_conf ipc_tbl3[] = {
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD},
-				/* Set preview or snapshot mode */
-				{REG_ROW_SPEED,
-				 mt9p012_regs.reg_pat[rt].row_speed},
-				{REG_X_ADDR_START,
-				 mt9p012_regs.reg_pat[rt].x_addr_start},
-				{REG_X_ADDR_END,
-				 mt9p012_regs.reg_pat[rt].x_addr_end},
-				{REG_Y_ADDR_START,
-				 mt9p012_regs.reg_pat[rt].y_addr_start},
-				{REG_Y_ADDR_END,
-				 mt9p012_regs.reg_pat[rt].y_addr_end},
-				{REG_READ_MODE,
-				 mt9p012_regs.reg_pat[rt].read_mode},
-				{REG_SCALE_M, mt9p012_regs.reg_pat[rt].scale_m},
-				{REG_X_OUTPUT_SIZE,
-				 mt9p012_regs.reg_pat[rt].x_output_size},
-				{REG_Y_OUTPUT_SIZE,
-				 mt9p012_regs.reg_pat[rt].y_output_size},
-				{REG_LINE_LENGTH_PCK,
-				 mt9p012_regs.reg_pat[rt].line_length_pck},
-				{REG_FRAME_LENGTH_LINES,
-				 mt9p012_regs.reg_pat[rt].frame_length_lines},
-				{REG_COARSE_INT_TIME,
-				 mt9p012_regs.reg_pat[rt].coarse_int_time},
-				{REG_FINE_INTEGRATION_TIME,
-				 mt9p012_regs.reg_pat[rt].fine_int_time},
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE},
-			};
-
-			/* reset fps_divider */
-			mt9p012_ctrl->fps_divider = 1 * 0x0400;
-
-			rc = mt9p012_i2c_write_w_table(&ipc_tbl1[0],
-						       ARRAY_SIZE(ipc_tbl1));
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_i2c_write_w_table(&ipc_tbl2[0],
-						       ARRAY_SIZE(ipc_tbl2));
-			if (rc < 0)
-				return rc;
-
-			mdelay(5);
-
-			rc = mt9p012_i2c_write_w_table(&ipc_tbl3[0],
-						       ARRAY_SIZE(ipc_tbl3));
-			if (rc < 0)
-				return rc;
-
-			/* load lens shading */
-			rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-						 REG_GROUPED_PARAMETER_HOLD,
-						 GROUPED_PARAMETER_HOLD);
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_set_lc();
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-						 REG_GROUPED_PARAMETER_HOLD,
-						 GROUPED_PARAMETER_UPDATE);
-
-			if (rc < 0)
-				return rc;
-		}
-		update_type = rupdate;
-		break;		/* case REG_INIT: */
-
-	default:
-		rc = -EINVAL;
-		break;
-	}			/* switch (rupdate) */
-
-	return rc;
-}
-
-static int32_t mt9p012_video_config(int mode, int res)
-{
-	int32_t rc;
-
-	switch (res) {
-	case QTR_SIZE:
-		rc = mt9p012_setting(UPDATE_PERIODIC, RES_PREVIEW);
-		if (rc < 0)
-			return rc;
-
-		CDBG("mt9p012 sensor configuration done!\n");
-		break;
-
-	case FULL_SIZE:
-		rc = mt9p012_setting(UPDATE_PERIODIC, RES_CAPTURE);
-		if (rc < 0)
-			return rc;
-
-		break;
-
-	default:
-		return 0;
-	}			/* switch */
-
-	mt9p012_ctrl->prev_res = res;
-	mt9p012_ctrl->curr_res = res;
-	mt9p012_ctrl->sensormode = mode;
-
-	rc = mt9p012_write_exp_gain(mt9p012_ctrl->my_reg_gain,
-				    mt9p012_ctrl->my_reg_line_count);
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 MT9P012_REG_RESET_REGISTER, 0x10cc | 0x0002);
-
-	return rc;
-}
-
-static int32_t mt9p012_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_setting(UPDATE_PERIODIC, RES_CAPTURE);
-	if (rc < 0)
-		return rc;
-
-	mt9p012_ctrl->curr_res = mt9p012_ctrl->pict_res;
-
-	mt9p012_ctrl->sensormode = mode;
-
-	return rc;
-}
-
-static int32_t mt9p012_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_setting(UPDATE_PERIODIC, RES_CAPTURE);
-	if (rc < 0)
-		return rc;
-
-	mt9p012_ctrl->curr_res = mt9p012_ctrl->pict_res;
-
-	mt9p012_ctrl->sensormode = mode;
-
-	return rc;
-}
-
-static int32_t mt9p012_power_down(void)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWOFF);
-
-	mdelay(5);
-	return rc;
-}
-
-static int32_t mt9p012_move_focus(int direction, int32_t num_steps)
-{
-	int16_t step_direction;
-	int16_t actual_step;
-	int16_t next_position;
-	uint8_t code_val_msb, code_val_lsb;
-
-	if (num_steps > MT9P012_TOTAL_STEPS_NEAR_TO_FAR)
-		num_steps = MT9P012_TOTAL_STEPS_NEAR_TO_FAR;
-	else if (num_steps == 0) {
-		CDBG("mt9p012_move_focus failed at line %d ...\n", __LINE__);
-		return -EINVAL;
-	}
-
-	if (direction == MOVE_NEAR)
-		step_direction = 16;	/* 10bit */
-	else if (direction == MOVE_FAR)
-		step_direction = -16;	/* 10 bit */
-	else {
-		CDBG("mt9p012_move_focus failed at line %d ...\n", __LINE__);
-		return -EINVAL;
-	}
-
-	if (mt9p012_ctrl->curr_lens_pos < mt9p012_ctrl->init_curr_lens_pos)
-		mt9p012_ctrl->curr_lens_pos = mt9p012_ctrl->init_curr_lens_pos;
-
-	actual_step = (int16_t) (step_direction * (int16_t) num_steps);
-	next_position = (int16_t) (mt9p012_ctrl->curr_lens_pos + actual_step);
-
-	if (next_position > 1023)
-		next_position = 1023;
-	else if (next_position < 0)
-		next_position = 0;
-
-	code_val_msb = next_position >> 4;
-	code_val_lsb = (next_position & 0x000F) << 4;
-	/* code_val_lsb |= mode_mask; */
-
-	/* Writing the digital code for current to the actuator */
-	if (mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1,
-				code_val_msb, code_val_lsb) < 0) {
-		CDBG("mt9p012_move_focus failed at line %d ...\n", __LINE__);
-		return -EBUSY;
-	}
-
-	/* Storing the current lens Position */
-	mt9p012_ctrl->curr_lens_pos = next_position;
-
-	return 0;
-}
-
-static int32_t mt9p012_set_default_focus(void)
-{
-	int32_t rc = 0;
-	uint8_t code_val_msb, code_val_lsb;
-
-	code_val_msb = 0x00;
-	code_val_lsb = 0x00;
-
-	/* Write the digital code for current to the actuator */
-	rc = mt9p012_i2c_write_b(MT9P012_AF_I2C_ADDR >> 1,
-				 code_val_msb, code_val_lsb);
-
-	mt9p012_ctrl->curr_lens_pos = 0;
-	mt9p012_ctrl->init_curr_lens_pos = 0;
-
-	return rc;
-}
-
-static int mt9p012_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	gpio_direction_output(data->sensor_reset, 0);
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int mt9p012_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc;
-	uint16_t chipid;
-
-	rc = gpio_request(data->sensor_reset, "mt9p012");
-	if (!rc)
-		gpio_direction_output(data->sensor_reset, 1);
-	else
-		goto init_probe_done;
-
-	msleep(20);
-
-	/* RESET the sensor image part via I2C command */
-	CDBG("mt9p012_sensor_init(): reseting sensor.\n");
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 MT9P012_REG_RESET_REGISTER, 0x10CC | 0x0001);
-	if (rc < 0) {
-		CDBG("sensor reset failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-
-	msleep(MT9P012_RESET_DELAY_MSECS);
-
-	/* 3. Read sensor Model ID: */
-	rc = mt9p012_i2c_read_w(mt9p012_client->addr,
-				MT9P012_REG_MODEL_ID, &chipid);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	/* 4. Compare sensor ID to MT9T012VC ID: */
-	if (chipid != MT9P012_MODEL_ID) {
-		CDBG("mt9p012 wrong model_id = 0x%x\n", chipid);
-		rc = -ENODEV;
-		goto init_probe_fail;
-	}
-
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr, 0x306E, 0x9000);
-	if (rc < 0) {
-		CDBG("REV_7 write failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-
-	/* RESET_REGISTER, enable parallel interface and disable serialiser */
-	CDBG("mt9p012_sensor_init(): enabling parallel interface.\n");
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr, 0x301A, 0x10CC);
-	if (rc < 0) {
-		CDBG("enable parallel interface failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-
-	/* To disable the 2 extra lines */
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr, 0x3064, 0x0805);
-
-	if (rc < 0) {
-		CDBG("disable the 2 extra lines failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-	goto init_probe_done;
-
-init_probe_fail:
-	mt9p012_probe_init_done(data);
-init_probe_done:
-	return rc;
-}
-
-static int mt9p012_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc;
-
-	mt9p012_ctrl = kzalloc(sizeof(struct mt9p012_ctrl), GFP_KERNEL);
-	if (!mt9p012_ctrl) {
-		CDBG("mt9p012_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-
-	mt9p012_ctrl->fps_divider = 1 * 0x00000400;
-	mt9p012_ctrl->pict_fps_divider = 1 * 0x00000400;
-	mt9p012_ctrl->set_test = TEST_OFF;
-	mt9p012_ctrl->prev_res = QTR_SIZE;
-	mt9p012_ctrl->pict_res = FULL_SIZE;
-
-	if (data)
-		mt9p012_ctrl->sensordata = data;
-
-	msm_camio_camif_pad_reg_reset();
-	mdelay(20);
-
-	rc = mt9p012_probe_init_sensor(data);
-	if (rc < 0)
-		goto init_fail1;
-
-	if (mt9p012_ctrl->prev_res == QTR_SIZE)
-		rc = mt9p012_setting(REG_INIT, RES_PREVIEW);
-	else
-		rc = mt9p012_setting(REG_INIT, RES_CAPTURE);
-
-	if (rc < 0) {
-		CDBG("mt9p012_setting failed. rc = %d\n", rc);
-		goto init_fail1;
-	}
-
-	/* sensor : output enable */
-	CDBG("mt9p012_sensor_open_init(): enabling output.\n");
-	rc = mt9p012_i2c_write_w(mt9p012_client->addr,
-				 MT9P012_REG_RESET_REGISTER,
-				 MT9P012_RESET_REGISTER_PWON);
-	if (rc < 0) {
-		CDBG("sensor output enable failed. rc = %d\n", rc);
-		goto init_fail1;
-	}
-
-	/* enable AF actuator */
-	if (mt9p012_ctrl->sensordata->vcm_enable) {
-		CDBG("enable AF actuator, gpio = %d\n",
-			 mt9p012_ctrl->sensordata->vcm_pwd);
-		rc = gpio_request(mt9p012_ctrl->sensordata->vcm_pwd,
-						"mt9p012");
-		if (!rc)
-			gpio_direction_output(
-				mt9p012_ctrl->sensordata->vcm_pwd,
-				 1);
-		else {
-			CDBG("mt9p012_ctrl gpio request failed!\n");
-			goto init_fail1;
-		}
-		msleep(20);
-		rc = mt9p012_set_default_focus();
-		if (rc < 0) {
-			gpio_direction_output(mt9p012_ctrl->sensordata->vcm_pwd,
-								0);
-			gpio_free(mt9p012_ctrl->sensordata->vcm_pwd);
-		}
-	}
-	if (rc >= 0)
-		goto init_done;
-init_fail1:
-	mt9p012_probe_init_done(data);
-	kfree(mt9p012_ctrl);
-init_done:
-	return rc;
-}
-
-static int mt9p012_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&mt9p012_wait_queue);
-	return 0;
-}
-
-static int32_t mt9p012_set_sensor_mode(int mode, int res)
-{
-	int32_t rc = 0;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = mt9p012_video_config(mode, res);
-		break;
-
-	case SENSOR_SNAPSHOT_MODE:
-		rc = mt9p012_snapshot_config(mode);
-		break;
-
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = mt9p012_raw_snapshot_config(mode);
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	return rc;
-}
-
-int mt9p012_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	int rc = 0;
-
-	if (copy_from_user(&cdata,
-			   (void *)argp, sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-
-	mutex_lock(&mt9p012_mut);
-
-	CDBG("%s: cfgtype = %d\n", __func__, cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		mt9p012_get_pict_fps(cdata.cfg.gfps.prevfps,
-				     &(cdata.cfg.gfps.pictfps));
-
-		if (copy_to_user((void *)argp, &cdata,
-				 sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf = mt9p012_get_prev_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl = mt9p012_get_prev_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf = mt9p012_get_pict_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl = mt9p012_get_pict_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc = mt9p012_get_pict_max_exp_lc();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = mt9p012_set_fps(&(cdata.cfg.fps));
-		break;
-
-	case CFG_SET_EXP_GAIN:
-		rc = mt9p012_write_exp_gain(cdata.cfg.exp_gain.gain,
-					    cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_PICT_EXP_GAIN:
-		CDBG("Line:%d CFG_SET_PICT_EXP_GAIN \n", __LINE__);
-		rc = mt9p012_set_pict_exp_gain(cdata.cfg.exp_gain.gain,
-					       cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_MODE:
-		rc = mt9p012_set_sensor_mode(cdata.mode, cdata.rs);
-		break;
-
-	case CFG_PWR_DOWN:
-		rc = mt9p012_power_down();
-		break;
-
-	case CFG_MOVE_FOCUS:
-		CDBG("mt9p012_ioctl: CFG_MOVE_FOCUS: cdata.cfg.focus.dir=%d \
-				cdata.cfg.focus.steps=%d\n",
-				cdata.cfg.focus.dir, cdata.cfg.focus.steps);
-		rc = mt9p012_move_focus(cdata.cfg.focus.dir,
-					cdata.cfg.focus.steps);
-		break;
-
-	case CFG_SET_DEFAULT_FOCUS:
-		rc = mt9p012_set_default_focus();
-		break;
-
-	case CFG_SET_LENS_SHADING:
-		CDBG("%s: CFG_SET_LENS_SHADING\n", __func__);
-		rc = mt9p012_lens_shading_enable(cdata.cfg.lens_shading);
-		break;
-
-	case CFG_GET_AF_MAX_STEPS:
-		cdata.max_steps = MT9P012_STEPS_NEAR_TO_CLOSEST_INF;
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_SET_EFFECT:
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	mutex_unlock(&mt9p012_mut);
-	return rc;
-}
-
-int mt9p012_sensor_release(void)
-{
-	int rc = -EBADF;
-
-	mutex_lock(&mt9p012_mut);
-
-	mt9p012_power_down();
-
-	gpio_direction_output(mt9p012_ctrl->sensordata->sensor_reset, 0);
-	gpio_free(mt9p012_ctrl->sensordata->sensor_reset);
-
-	if (mt9p012_ctrl->sensordata->vcm_enable) {
-		gpio_direction_output(mt9p012_ctrl->sensordata->vcm_pwd, 0);
-		gpio_free(mt9p012_ctrl->sensordata->vcm_pwd);
-	}
-
-	kfree(mt9p012_ctrl);
-	mt9p012_ctrl = NULL;
-
-	CDBG("mt9p012_release completed\n");
-
-	mutex_unlock(&mt9p012_mut);
-	return rc;
-}
-
-static int mt9p012_i2c_probe(struct i2c_client *client,
-			     const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("mt9p012_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	mt9p012_sensorw = kzalloc(sizeof(struct mt9p012_work), GFP_KERNEL);
-	if (!mt9p012_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, mt9p012_sensorw);
-	mt9p012_init_client(client);
-	mt9p012_client = client;
-
-	mdelay(50);
-
-	CDBG("mt9p012_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("mt9p012_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static const struct i2c_device_id mt9p012_i2c_id[] = {
-	{"mt9p012", 0},
-	{}
-};
-
-static struct i2c_driver mt9p012_i2c_driver = {
-	.id_table = mt9p012_i2c_id,
-	.probe = mt9p012_i2c_probe,
-	.remove = __exit_p(mt9p012_i2c_remove),
-	.driver = {
-		   .name = "mt9p012",
-		   },
-};
-
-static int mt9p012_sensor_probe(const struct msm_camera_sensor_info *info,
-				struct msm_sensor_ctrl *s)
-{
-	int rc = i2c_add_driver(&mt9p012_i2c_driver);
-	if (rc < 0 || mt9p012_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_done;
-	}
-
-	msm_camio_clk_rate_set(MT9P012_DEFAULT_CLOCK_RATE);
-	mdelay(20);
-
-	rc = mt9p012_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_done;
-
-	s->s_init = mt9p012_sensor_open_init;
-	s->s_release = mt9p012_sensor_release;
-	s->s_config = mt9p012_sensor_config;
-	s->s_mount_angle  = 0;
-	mt9p012_probe_init_done(info);
-
-probe_done:
-	CDBG("%s %s:%d\n", __FILE__, __func__, __LINE__);
-	return rc;
-}
-
-static int __mt9p012_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, mt9p012_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __mt9p012_probe,
-	.driver = {
-		   .name = "msm_camera_mt9p012",
-		   .owner = THIS_MODULE,
-		   },
-};
-
-static int __init mt9p012_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(mt9p012_init);
diff --git a/drivers/media/video/msm/mt9p012_km.c b/drivers/media/video/msm/mt9p012_km.c
deleted file mode 100644
index 959023b..0000000
--- a/drivers/media/video/msm/mt9p012_km.c
+++ /dev/null
@@ -1,1296 +0,0 @@
-/* Copyright (c) 2009-2010, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/kernel.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include "mt9p012_km.h"
-
-/*=============================================================
-    SENSOR REGISTER DEFINES
-==============================================================*/
-
-#define MT9P012_KM_REG_MODEL_ID      0x0000
-#define MT9P012_KM_MODEL_ID          0x2800
-#define REG_GROUPED_PARAMETER_HOLD   0x0104
-#define GROUPED_PARAMETER_HOLD       0x0100
-#define GROUPED_PARAMETER_UPDATE     0x0000
-#define REG_COARSE_INT_TIME          0x3012
-#define REG_VT_PIX_CLK_DIV           0x0300
-#define REG_VT_SYS_CLK_DIV           0x0302
-#define REG_PRE_PLL_CLK_DIV          0x0304
-#define REG_PLL_MULTIPLIER           0x0306
-#define REG_OP_PIX_CLK_DIV           0x0308
-#define REG_OP_SYS_CLK_DIV           0x030A
-#define REG_SCALE_M                  0x0404
-#define REG_FRAME_LENGTH_LINES       0x300A
-#define REG_LINE_LENGTH_PCK          0x300C
-#define REG_X_ADDR_START             0x3004
-#define REG_Y_ADDR_START             0x3002
-#define REG_X_ADDR_END               0x3008
-#define REG_Y_ADDR_END               0x3006
-#define REG_X_OUTPUT_SIZE            0x034C
-#define REG_Y_OUTPUT_SIZE            0x034E
-#define REG_FINE_INTEGRATION_TIME    0x3014
-#define REG_ROW_SPEED                0x3016
-#define MT9P012_KM_REG_RESET_REGISTER   0x301A
-#define MT9P012_KM_RESET_REGISTER_PWON  0x10CC
-#define MT9P012_KM_RESET_REGISTER_PWOFF 0x10C8
-#define REG_READ_MODE                0x3040
-#define REG_GLOBAL_GAIN              0x305E
-#define REG_TEST_PATTERN_MODE        0x3070
-
-enum mt9p012_km_test_mode {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum mt9p012_km_resolution {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-
-enum mt9p012_km_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-enum mt9p012_km_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-
-uint8_t mode_mask = 0x04;
-
-/* actuator's Slave Address */
-#define MT9P012_KM_AF_I2C_ADDR   (0x18 >> 1)
-
-/* AF Total steps parameters */
-#define MT9P012_KM_STEPS_NEAR_TO_CLOSEST_INF  30
-#define MT9P012_KM_TOTAL_STEPS_NEAR_TO_FAR    30
-
-/* Time in milisecs for waiting for the sensor to reset.*/
-#define MT9P012_KM_RESET_DELAY_MSECS   66
-
-/* for 20 fps preview */
-#define MT9P012_KM_DEFAULT_CLOCK_RATE  24000000
-
-struct mt9p012_km_work {
-	struct work_struct work;
-};
-static struct mt9p012_km_work *mt9p012_km_sensorw;
-static struct i2c_client *mt9p012_km_client;
-
-struct mt9p012_km_ctrl {
-	const struct msm_camera_sensor_info *sensordata;
-
-	int sensormode;
-	uint32_t fps_divider;	/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;	/* init to 1 * 0x00000400 */
-
-	uint16_t curr_lens_pos;
-	uint16_t init_curr_lens_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-
-	enum mt9p012_km_resolution prev_res;
-	enum mt9p012_km_resolution pict_res;
-	enum mt9p012_km_resolution curr_res;
-	enum mt9p012_km_test_mode set_test;
-};
-static uint16_t update_type = UPDATE_PERIODIC;
-static struct mt9p012_km_ctrl *mt9p012_km_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(mt9p012_km_wait_queue);
-DEFINE_MUTEX(mt9p012_km_mut);
-
-/*=============================================================*/
-
-static int mt9p012_km_i2c_rxdata(unsigned short saddr, unsigned char *rxdata,
-			int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr = saddr << 1,
-			.flags = 0,
-			.len = 2,
-			.buf = rxdata,
-		},
-		{
-			.addr = saddr << 1,
-			.flags = I2C_M_RD,
-			.len = length,
-			.buf = rxdata,
-		},
-	};
-
-	if (i2c_transfer(mt9p012_km_client->adapter, msgs, 2) < 0) {
-		CDBG("mt9p012_km_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t mt9p012_km_i2c_read_w(unsigned short saddr, unsigned short raddr,
-				  unsigned short *rdata)
-{
-	int32_t rc = 0;
-	unsigned char buf[4];
-
-	if (!rdata)
-		return -EIO;
-
-	memset(buf, 0, sizeof(buf));
-
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-
-	rc = mt9p012_km_i2c_rxdata(saddr, buf, 2);
-	if (rc < 0)
-		return rc;
-
-	*rdata = buf[0] << 8 | buf[1];
-
-	if (rc < 0)
-		CDBG("mt9p012_km_i2c_read failed!\n");
-
-	return rc;
-}
-
-static int32_t mt9p012_km_i2c_txdata(unsigned short saddr,
-				  unsigned char *txdata,
-				  int length)
-{
-	struct i2c_msg msg[] = {
-		{
-		 .addr = saddr << 1,
-		 .flags = 0,
-		 .len = length,
-		 .buf = txdata,
-		 },
-	};
-
-	if (i2c_transfer(mt9p012_km_client->adapter, msg, 1) < 0) {
-		CDBG("mt9p012_km_i2c_txdata failed\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t mt9p012_km_i2c_write_b(unsigned short saddr,
-				   unsigned short baddr,
-				   unsigned short bdata)
-{
-	int32_t rc = -EIO;
-	unsigned char buf[2];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = baddr;
-	buf[1] = bdata;
-	rc = mt9p012_km_i2c_txdata(saddr, buf, 2);
-
-	if (rc < 0)
-		CDBG("i2c_write failed, saddr = 0x%x addr = 0x%x, val =0x%x!\n",
-		     saddr, baddr, bdata);
-
-	return rc;
-}
-
-static int32_t mt9p012_km_i2c_write_w(unsigned short saddr,
-				   unsigned short waddr,
-				   unsigned short wdata)
-{
-	int32_t rc = -EIO;
-	unsigned char buf[4];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = (wdata & 0xFF00) >> 8;
-	buf[3] = (wdata & 0x00FF);
-
-	rc = mt9p012_km_i2c_txdata(saddr, buf, 4);
-
-	if (rc < 0)
-		CDBG("i2c_write_w failed, addr = 0x%x, val = 0x%x!\n",
-		     waddr, wdata);
-
-	return rc;
-}
-
-static int32_t mt9p012_km_i2c_write_w_table(struct mt9p012_km_i2c_reg_conf const
-					 *reg_conf_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-
-	for (i = 0; i < num; i++) {
-		rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-					 reg_conf_tbl->waddr,
-					 reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-
-	return rc;
-}
-
-static int32_t mt9p012_km_test(enum mt9p012_km_test_mode mo)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return rc;
-
-	if (mo == TEST_OFF)
-		return 0;
-	else {
-		rc = mt9p012_km_i2c_write_w_table(mt9p012_km_regs.ttbl,
-					 mt9p012_km_regs.ttbl_size);
-		if (rc < 0)
-			return rc;
-
-		rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-					 REG_TEST_PATTERN_MODE, (uint16_t) mo);
-		if (rc < 0)
-			return rc;
-	}
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE);
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-
-static int32_t mt9p012_km_lens_shading_enable(uint8_t is_enable)
-{
-	int32_t rc = 0;
-
-	CDBG("%s: entered. enable = %d\n", __func__, is_enable);
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr, 0x3780,
-				 ((uint16_t) is_enable) << 15);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE);
-
-	CDBG("%s: exiting. rc = %d\n", __func__, rc);
-	return rc;
-}
-
-static int32_t mt9p012_km_set_lc(void)
-{
-	int32_t rc;
-
-	rc = mt9p012_km_i2c_write_w_table(mt9p012_km_regs.lctbl,
-				       mt9p012_km_regs.lctbl_size);
-
-	return rc;
-}
-
-static void mt9p012_km_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-
-	/* input fps is preview fps in Q8 format */
-	uint32_t divider;   /*Q10 */
-	uint32_t pclk_mult; /*Q10 */
-	uint32_t d1;
-	uint32_t d2;
-
-	d1 =
-		(uint32_t)(
-		(mt9p012_km_regs.reg_pat[RES_PREVIEW].frame_length_lines *
-		0x00000400) /
-		mt9p012_km_regs.reg_pat[RES_CAPTURE].frame_length_lines);
-
-	d2 =
-		(uint32_t)(
-		(mt9p012_km_regs.reg_pat[RES_PREVIEW].line_length_pck *
-		0x00000400) /
-		mt9p012_km_regs.reg_pat[RES_CAPTURE].line_length_pck);
-
-	divider = (uint32_t) (d1 * d2) / 0x00000400;
-
-	pclk_mult =
-		(uint32_t) ((mt9p012_km_regs.reg_pat[RES_CAPTURE].
-		pll_multiplier * 0x00000400) /
-		(mt9p012_km_regs.reg_pat[RES_PREVIEW].pll_multiplier));
-
-
-	/* Verify PCLK settings and frame sizes. */
-	*pfps = (uint16_t)((((fps * pclk_mult) / 0x00000400) * divider)/
-				0x00000400);
-}
-
-static uint16_t mt9p012_km_get_prev_lines_pf(void)
-{
-	if (mt9p012_km_ctrl->prev_res == QTR_SIZE)
-		return  mt9p012_km_regs.reg_pat[RES_PREVIEW].frame_length_lines;
-	else
-		return  mt9p012_km_regs.reg_pat[RES_CAPTURE].frame_length_lines;
-}
-
-static uint16_t mt9p012_km_get_prev_pixels_pl(void)
-{
-	if (mt9p012_km_ctrl->prev_res == QTR_SIZE)
-		return  mt9p012_km_regs.reg_pat[RES_PREVIEW].line_length_pck;
-	else
-		return  mt9p012_km_regs.reg_pat[RES_CAPTURE].line_length_pck;
-}
-
-static uint16_t mt9p012_km_get_pict_lines_pf(void)
-{
-	return  mt9p012_km_regs.reg_pat[RES_CAPTURE].frame_length_lines;
-}
-
-static uint16_t mt9p012_km_get_pict_pixels_pl(void)
-{
-	return  mt9p012_km_regs.reg_pat[RES_CAPTURE].line_length_pck;
-}
-
-static uint32_t mt9p012_km_get_pict_max_exp_lc(void)
-{
-	uint16_t snapshot_lines_per_frame;
-
-	if (mt9p012_km_ctrl->pict_res == QTR_SIZE)
-		snapshot_lines_per_frame =
-	    mt9p012_km_regs.reg_pat[RES_PREVIEW].frame_length_lines - 1;
-	else
-		snapshot_lines_per_frame =
-	    mt9p012_km_regs.reg_pat[RES_CAPTURE].frame_length_lines - 1;
-
-	return snapshot_lines_per_frame * 24;
-}
-
-static int32_t mt9p012_km_set_fps(struct fps_cfg *fps)
-{
-	int32_t rc = 0;
-
-	mt9p012_km_ctrl->fps_divider = fps->fps_div;
-	mt9p012_km_ctrl->pict_fps_divider = fps->pict_fps_div;
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return -EBUSY;
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-			REG_FRAME_LENGTH_LINES,
-			mt9p012_km_regs.reg_pat[mt9p012_km_ctrl->sensormode].
-			frame_length_lines *
-			mt9p012_km_ctrl->fps_divider / 0x00000400);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE);
-
-	return rc;
-}
-
-
-static int32_t mt9p012_km_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	uint16_t max_legal_gain = 0x01FF;
-	uint32_t line_length_ratio = 0x00000400;
-	enum mt9p012_km_setting setting;
-	int32_t rc = 0;
-
-	CDBG("Line:%d mt9p012_km_write_exp_gain \n", __LINE__);
-
-	if (mt9p012_km_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-		mt9p012_km_ctrl->my_reg_gain = gain;
-		mt9p012_km_ctrl->my_reg_line_count = (uint16_t) line;
-	}
-
-	if (gain > max_legal_gain) {
-		CDBG("Max legal gain Line:%d \n", __LINE__);
-		gain = max_legal_gain;
-	}
-
-	/* Verify no overflow */
-	if (mt9p012_km_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-		line = (uint32_t) (line * mt9p012_km_ctrl->fps_divider /
-				   0x00000400);
-		setting = RES_PREVIEW;
-	} else {
-		line = (uint32_t) (line * mt9p012_km_ctrl->pict_fps_divider /
-				   0x00000400);
-		setting = RES_CAPTURE;
-	}
-
-	gain |= 0x0200;
-
-	if ((mt9p012_km_regs.reg_pat[setting].frame_length_lines - 1) < line) {
-		line_length_ratio = (uint32_t) (line * 0x00000400) /
-		    (mt9p012_km_regs.reg_pat[setting].frame_length_lines - 1);
-	} else
-		line_length_ratio = 0x00000400;
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				REG_GROUPED_PARAMETER_HOLD,
-				GROUPED_PARAMETER_HOLD);
-	if (rc < 0) {
-		CDBG("mt9p012_km_i2c_write_w failed... Line:%d \n", __LINE__);
-		return rc;
-	}
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 REG_GLOBAL_GAIN, gain);
-	if (rc < 0) {
-		CDBG("mt9p012_km_i2c_write_w failed... Line:%d \n", __LINE__);
-		return rc;
-	}
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				REG_LINE_LENGTH_PCK,
-			       (uint16_t) (mt9p012_km_regs.reg_pat[setting].
-			    line_length_pck * line_length_ratio / 0x00000400));
-	if (rc < 0)
-		return rc;
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 REG_COARSE_INT_TIME,
-				 (uint16_t) ((line * 0x00000400)/
-				 line_length_ratio));
-	if (rc < 0) {
-		CDBG("mt9p012_km_i2c_write_w failed... Line:%d \n", __LINE__);
-		return rc;
-	}
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE);
-	if (rc < 0) {
-		CDBG("mt9p012_km_i2c_write_w failed... Line:%d \n", __LINE__);
-		return rc;
-	}
-
-	CDBG("mt9p012_km_write_exp_gain: gain = %d, line = %d\n", gain, line);
-
-	return rc;
-}
-
-static int32_t mt9p012_km_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-
-	CDBG("Line:%d mt9p012_km_set_pict_exp_gain \n", __LINE__);
-
-	rc = mt9p012_km_write_exp_gain(gain, line);
-	if (rc < 0) {
-		CDBG("Line:%d mt9p012_km_set_pict_exp_gain failed... \n",
-		     __LINE__);
-		return rc;
-	}
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 MT9P012_KM_REG_RESET_REGISTER,
-				 0x10CC | 0x0002);
-	if (rc < 0) {
-		CDBG("mt9p012_km_i2c_write_w failed... Line:%d \n", __LINE__);
-		return rc;
-	}
-
-	mdelay(5);
-
-	/* camera_timed_wait(snapshot_wait*exposure_ratio); */
-	return rc;
-}
-
-static int32_t mt9p012_km_setting(enum mt9p012_km_reg_update rupdate,
-				enum mt9p012_km_setting rt)
-{
-	int32_t rc = 0;
-
-	switch (rupdate) {
-	case UPDATE_PERIODIC:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-
-			struct mt9p012_km_i2c_reg_conf ppc_tbl[] = {
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD},
-				{REG_ROW_SPEED,
-				 mt9p012_km_regs.reg_pat[rt].row_speed},
-				{REG_X_ADDR_START,
-				 mt9p012_km_regs.reg_pat[rt].x_addr_start},
-				{REG_X_ADDR_END,
-				 mt9p012_km_regs.reg_pat[rt].x_addr_end},
-				{REG_Y_ADDR_START,
-				 mt9p012_km_regs.reg_pat[rt].y_addr_start},
-				{REG_Y_ADDR_END,
-				 mt9p012_km_regs.reg_pat[rt].y_addr_end},
-				{REG_READ_MODE,
-				 mt9p012_km_regs.reg_pat[rt].read_mode},
-				{REG_SCALE_M,
-				 mt9p012_km_regs.reg_pat[rt].scale_m},
-				{REG_X_OUTPUT_SIZE,
-				 mt9p012_km_regs.reg_pat[rt].x_output_size},
-				{REG_Y_OUTPUT_SIZE,
-				 mt9p012_km_regs.reg_pat[rt].y_output_size},
-				{REG_LINE_LENGTH_PCK,
-				 mt9p012_km_regs.reg_pat[rt].line_length_pck},
-				{REG_FRAME_LENGTH_LINES,
-			       (mt9p012_km_regs.reg_pat[rt].frame_length_lines *
-				mt9p012_km_ctrl->fps_divider / 0x00000400)},
-				{REG_COARSE_INT_TIME,
-				 mt9p012_km_regs.reg_pat[rt].coarse_int_time},
-				{REG_FINE_INTEGRATION_TIME,
-				 mt9p012_km_regs.reg_pat[rt].fine_int_time},
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE},
-			};
-
-			if (update_type == REG_INIT) {
-				update_type = rupdate;
-				return rc;
-			}
-
-			rc = mt9p012_km_i2c_write_w_table(&ppc_tbl[0],
-						ARRAY_SIZE(ppc_tbl));
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_km_test(mt9p012_km_ctrl->set_test);
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-						 MT9P012_KM_REG_RESET_REGISTER,
-						 0x10cc |
-						 0x0002);
-			if (rc < 0)
-				return rc;
-
-			mdelay(15);	/* 15? wait for sensor to transition */
-
-			return rc;
-		}
-		break;	/* UPDATE_PERIODIC */
-
-	case REG_INIT:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct mt9p012_km_i2c_reg_conf ipc_tbl1[] = {
-				{MT9P012_KM_REG_RESET_REGISTER,
-				 MT9P012_KM_RESET_REGISTER_PWOFF},
-				{REG_VT_PIX_CLK_DIV,
-				 mt9p012_km_regs.reg_pat[rt].vt_pix_clk_div},
-				{REG_VT_SYS_CLK_DIV,
-				 mt9p012_km_regs.reg_pat[rt].vt_sys_clk_div},
-				{REG_PRE_PLL_CLK_DIV,
-				 mt9p012_km_regs.reg_pat[rt].pre_pll_clk_div},
-				{REG_PLL_MULTIPLIER,
-				 mt9p012_km_regs.reg_pat[rt].pll_multiplier},
-				{REG_OP_PIX_CLK_DIV,
-				 mt9p012_km_regs.reg_pat[rt].op_pix_clk_div},
-				{REG_OP_SYS_CLK_DIV,
-				 mt9p012_km_regs.reg_pat[rt].op_sys_clk_div},
-				{MT9P012_KM_REG_RESET_REGISTER,
-				 MT9P012_KM_RESET_REGISTER_PWON},
-			};
-
-			struct mt9p012_km_i2c_reg_conf ipc_tbl2[] = {
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_HOLD},
-				/* Optimized register settings for
-				   Rev3 Silicon */
-				{0x308A, 0x6424},
-				{0x3092, 0x0A52},
-				{0x3094, 0x4656},
-				{0x3096, 0x5652},
-				{0x0204, 0x0010},
-				{0x0206, 0x0010},
-				{0x0208, 0x0010},
-				{0x020A, 0x0010},
-				{0x020C, 0x0010},
-				{0x3088, 0x6FF6},
-				{0x3154, 0x0282},
-				{0x3156, 0x0381},
-				{0x3162, 0x04CE},
-			};
-
-			struct mt9p012_km_i2c_reg_conf ipc_tbl3[] = {
-				/* Set preview or snapshot mode */
-				{REG_ROW_SPEED,
-				 mt9p012_km_regs.reg_pat[rt].row_speed},
-				{REG_X_ADDR_START,
-				 mt9p012_km_regs.reg_pat[rt].x_addr_start},
-				{REG_X_ADDR_END,
-				 mt9p012_km_regs.reg_pat[rt].x_addr_end},
-				{REG_Y_ADDR_START,
-				 mt9p012_km_regs.reg_pat[rt].y_addr_start},
-				{REG_Y_ADDR_END,
-				 mt9p012_km_regs.reg_pat[rt].y_addr_end},
-				{REG_READ_MODE,
-				 mt9p012_km_regs.reg_pat[rt].read_mode},
-				{REG_SCALE_M,
-				 mt9p012_km_regs.reg_pat[rt].scale_m},
-				{REG_X_OUTPUT_SIZE,
-				 mt9p012_km_regs.reg_pat[rt].x_output_size},
-				{REG_Y_OUTPUT_SIZE,
-				 mt9p012_km_regs.reg_pat[rt].y_output_size},
-				{REG_LINE_LENGTH_PCK,
-				 mt9p012_km_regs.reg_pat[rt].line_length_pck},
-				{REG_FRAME_LENGTH_LINES,
-				 mt9p012_km_regs.reg_pat[rt].
-				 frame_length_lines},
-				{REG_COARSE_INT_TIME,
-				 mt9p012_km_regs.reg_pat[rt].coarse_int_time},
-				{REG_FINE_INTEGRATION_TIME,
-				 mt9p012_km_regs.reg_pat[rt].fine_int_time},
-				{REG_GROUPED_PARAMETER_HOLD,
-				 GROUPED_PARAMETER_UPDATE},
-			};
-
-			/* reset fps_divider */
-			mt9p012_km_ctrl->fps_divider = 1 * 0x0400;
-
-			rc = mt9p012_km_i2c_write_w_table(&ipc_tbl1[0],
-							ARRAY_SIZE(ipc_tbl1));
-			if (rc < 0)
-				return rc;
-
-			mdelay(15);
-
-			rc = mt9p012_km_i2c_write_w_table(&ipc_tbl2[0],
-							ARRAY_SIZE(ipc_tbl2));
-			if (rc < 0)
-				return rc;
-
-			mdelay(5);
-
-			rc = mt9p012_km_i2c_write_w_table(&ipc_tbl3[0],
-						       ARRAY_SIZE(ipc_tbl3));
-			if (rc < 0)
-				return rc;
-
-			/* load lens shading */
-			rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-						 REG_GROUPED_PARAMETER_HOLD,
-						 GROUPED_PARAMETER_HOLD);
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_km_set_lc();
-			if (rc < 0)
-				return rc;
-
-			rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-						 REG_GROUPED_PARAMETER_HOLD,
-						 GROUPED_PARAMETER_UPDATE);
-
-			if (rc < 0)
-				return rc;
-		}
-		update_type = rupdate;
-		break;		/* case REG_INIT: */
-
-	default:
-		rc = -EINVAL;
-		break;
-	}			/* switch (rupdate) */
-
-	return rc;
-}
-
-static int32_t mt9p012_km_video_config(int mode, int res)
-{
-	int32_t rc;
-
-	switch (res) {
-	case QTR_SIZE:
-		rc = mt9p012_km_setting(UPDATE_PERIODIC, RES_PREVIEW);
-		if (rc < 0)
-			return rc;
-
-		CDBG("mt9p012_km sensor configuration done!\n");
-		break;
-
-	case FULL_SIZE:
-		rc = mt9p012_km_setting(UPDATE_PERIODIC, RES_CAPTURE);
-		if (rc < 0)
-			return rc;
-
-		break;
-
-	default:
-		return 0;
-	}			/* switch */
-
-	mt9p012_km_ctrl->prev_res = res;
-	mt9p012_km_ctrl->curr_res = res;
-	mt9p012_km_ctrl->sensormode = mode;
-
-	rc = mt9p012_km_write_exp_gain(mt9p012_km_ctrl->my_reg_gain,
-				    mt9p012_km_ctrl->my_reg_line_count);
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 MT9P012_KM_REG_RESET_REGISTER,
-				 0x10cc | 0x0002);
-
-	mdelay(15);
-	return rc;
-}
-
-static int32_t mt9p012_km_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_km_setting(UPDATE_PERIODIC, RES_CAPTURE);
-	if (rc < 0)
-		return rc;
-
-	mt9p012_km_ctrl->curr_res = mt9p012_km_ctrl->pict_res;
-
-	mt9p012_km_ctrl->sensormode = mode;
-
-	return rc;
-}
-
-static int32_t mt9p012_km_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_km_setting(UPDATE_PERIODIC, RES_CAPTURE);
-	if (rc < 0)
-		return rc;
-
-	mt9p012_km_ctrl->curr_res = mt9p012_km_ctrl->pict_res;
-
-	mt9p012_km_ctrl->sensormode = mode;
-
-	return rc;
-}
-
-static int32_t mt9p012_km_power_down(void)
-{
-	int32_t rc = 0;
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 MT9P012_KM_REG_RESET_REGISTER,
-				 MT9P012_KM_RESET_REGISTER_PWOFF);
-
-	mdelay(5);
-	return rc;
-}
-
-static int32_t mt9p012_km_move_focus(int direction, int32_t num_steps)
-{
-	int16_t step_direction;
-	int16_t actual_step;
-	int16_t next_position;
-	uint8_t code_val_msb, code_val_lsb;
-
-	if (num_steps > MT9P012_KM_TOTAL_STEPS_NEAR_TO_FAR)
-		num_steps = MT9P012_KM_TOTAL_STEPS_NEAR_TO_FAR;
-	else if (num_steps == 0) {
-		CDBG("mt9p012_km_move_focus failed at line %d ...\n", __LINE__);
-		return -EINVAL;
-	}
-
-	if (direction == MOVE_NEAR)
-		step_direction = 16;	/* 10bit */
-	else if (direction == MOVE_FAR)
-		step_direction = -16;	/* 10 bit */
-	else {
-		CDBG("mt9p012_km_move_focus failed at line %d ...\n", __LINE__);
-		return -EINVAL;
-	}
-
-	if (mt9p012_km_ctrl->curr_lens_pos <
-				mt9p012_km_ctrl->init_curr_lens_pos)
-		mt9p012_km_ctrl->curr_lens_pos =
-				mt9p012_km_ctrl->init_curr_lens_pos;
-
-	actual_step = (int16_t) (step_direction * (int16_t) num_steps);
-	next_position = (int16_t) (mt9p012_km_ctrl->curr_lens_pos +
-							actual_step);
-
-	if (next_position > 1023)
-		next_position = 1023;
-	else if (next_position < 0)
-		next_position = 0;
-
-	code_val_msb = next_position >> 4;
-	code_val_lsb = (next_position & 0x000F) << 4;
-	code_val_lsb |= mode_mask;
-
-	/* Writing the digital code for current to the actuator */
-	if (mt9p012_km_i2c_write_b(MT9P012_KM_AF_I2C_ADDR >> 1,
-				code_val_msb, code_val_lsb) < 0) {
-		CDBG("mt9p012_km_move_focus failed at line %d ...\n", __LINE__);
-		return -EBUSY;
-	}
-
-	/* Storing the current lens Position */
-	mt9p012_km_ctrl->curr_lens_pos = next_position;
-
-	return 0;
-}
-
-static int32_t mt9p012_km_set_default_focus(void)
-{
-	int32_t rc = 0;
-	uint8_t code_val_msb, code_val_lsb;
-
-	code_val_msb = 0x00;
-	code_val_lsb = 0x04;
-
-	/* Write the digital code for current to the actuator */
-	rc = mt9p012_km_i2c_write_b(MT9P012_KM_AF_I2C_ADDR >> 1,
-				 code_val_msb, code_val_lsb);
-
-	mt9p012_km_ctrl->curr_lens_pos = 0;
-	mt9p012_km_ctrl->init_curr_lens_pos = 0;
-
-	return rc;
-}
-
-static int mt9p012_km_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	gpio_direction_output(data->sensor_reset, 0);
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int
-	mt9p012_km_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc;
-	uint16_t chipid;
-
-	rc = gpio_request(data->sensor_reset, "mt9p012_km");
-	if (!rc)
-		gpio_direction_output(data->sensor_reset, 1);
-	else
-		goto init_probe_done;
-
-	msleep(20);
-
-	/* RESET the sensor image part via I2C command */
-	CDBG("mt9p012_km_sensor_init(): reseting sensor.\n");
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 MT9P012_KM_REG_RESET_REGISTER,
-				 0x10CC | 0x0001);
-	if (rc < 0) {
-		CDBG("sensor reset failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-
-		msleep(MT9P012_KM_RESET_DELAY_MSECS);
-
-	/* 3. Read sensor Model ID: */
-	rc = mt9p012_km_i2c_read_w(mt9p012_km_client->addr,
-				MT9P012_KM_REG_MODEL_ID, &chipid);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	/* 4. Compare sensor ID to MT9T012VC ID: */
-	if (chipid != MT9P012_KM_MODEL_ID) {
-		CDBG("mt9p012_km wrong model_id = 0x%x\n", chipid);
-		rc = -ENODEV;
-		goto init_probe_fail;
-	}
-
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr, 0x306E, 0x9080);
-	if (rc < 0) {
-		CDBG("REV_7 write failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-
-	/* RESET_REGISTER, enable parallel interface and disable serialiser */
-	CDBG("mt9p012_km_sensor_init(): enabling parallel interface.\n");
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr, 0x301A, 0x10CC);
-	if (rc < 0) {
-		CDBG("enable parallel interface failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-
-	/* To disable the 2 extra lines */
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr, 0x3064, 0x0805);
-
-	if (rc < 0) {
-		CDBG("disable the 2 extra lines failed. rc = %d\n", rc);
-		goto init_probe_fail;
-	}
-
-	goto init_probe_done;
-
-init_probe_fail:
-	mt9p012_km_probe_init_done(data);
-init_probe_done:
-	return rc;
-}
-
-static int
-	mt9p012_km_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc;
-
-	mt9p012_km_ctrl = kzalloc(sizeof(struct mt9p012_km_ctrl), GFP_KERNEL);
-	if (!mt9p012_km_ctrl) {
-		CDBG("mt9p012_km_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-
-	mt9p012_km_ctrl->fps_divider = 1 * 0x00000400;
-	mt9p012_km_ctrl->pict_fps_divider = 1 * 0x00000400;
-	mt9p012_km_ctrl->set_test = TEST_OFF;
-	mt9p012_km_ctrl->prev_res = QTR_SIZE;
-	mt9p012_km_ctrl->pict_res = FULL_SIZE;
-
-	if (data)
-		mt9p012_km_ctrl->sensordata = data;
-
-	msm_camio_camif_pad_reg_reset();
-	mdelay(20);
-
-	rc = mt9p012_km_probe_init_sensor(data);
-	if (rc < 0)
-		goto init_fail1;
-
-	if (mt9p012_km_ctrl->prev_res == QTR_SIZE)
-		rc = mt9p012_km_setting(REG_INIT, RES_PREVIEW);
-	else
-		rc = mt9p012_km_setting(REG_INIT, RES_CAPTURE);
-
-	if (rc < 0) {
-		CDBG("mt9p012_km_setting failed. rc = %d\n", rc);
-		goto init_fail1;
-	}
-
-	/* sensor : output enable */
-	CDBG("mt9p012_km_sensor_open_init(): enabling output.\n");
-	rc = mt9p012_km_i2c_write_w(mt9p012_km_client->addr,
-				 MT9P012_KM_REG_RESET_REGISTER,
-				 MT9P012_KM_RESET_REGISTER_PWON);
-	if (rc < 0) {
-		CDBG("sensor output enable failed. rc = %d\n", rc);
-		goto init_fail1;
-	}
-
-	if (rc >= 0)
-		goto init_done;
-
-init_fail1:
-	mt9p012_km_probe_init_done(data);
-	kfree(mt9p012_km_ctrl);
-init_done:
-	return rc;
-}
-
-static int mt9p012_km_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&mt9p012_km_wait_queue);
-	return 0;
-}
-
-static int32_t mt9p012_km_set_sensor_mode(int mode, int res)
-{
-	int32_t rc = 0;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = mt9p012_km_video_config(mode, res);
-		break;
-
-	case SENSOR_SNAPSHOT_MODE:
-		rc = mt9p012_km_snapshot_config(mode);
-		break;
-
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = mt9p012_km_raw_snapshot_config(mode);
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	return rc;
-}
-
-int mt9p012_km_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	int rc = 0;
-
-	if (copy_from_user(&cdata,
-			   (void *)argp, sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-
-	mutex_lock(&mt9p012_km_mut);
-
-	CDBG("%s: cfgtype = %d\n", __func__, cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		mt9p012_km_get_pict_fps(cdata.cfg.gfps.prevfps,
-				     &(cdata.cfg.gfps.pictfps));
-
-		if (copy_to_user((void *)argp, &cdata,
-				 sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf = mt9p012_km_get_prev_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl = mt9p012_km_get_prev_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf = mt9p012_km_get_pict_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl = mt9p012_km_get_pict_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc = mt9p012_km_get_pict_max_exp_lc();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = mt9p012_km_set_fps(&(cdata.cfg.fps));
-		break;
-
-	case CFG_SET_EXP_GAIN:
-		rc = mt9p012_km_write_exp_gain(cdata.cfg.exp_gain.gain,
-					    cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_PICT_EXP_GAIN:
-		CDBG("Line:%d CFG_SET_PICT_EXP_GAIN \n", __LINE__);
-		rc = mt9p012_km_set_pict_exp_gain(cdata.cfg.exp_gain.gain,
-					       cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_MODE:
-		rc = mt9p012_km_set_sensor_mode(cdata.mode, cdata.rs);
-		break;
-
-	case CFG_PWR_DOWN:
-		rc = mt9p012_km_power_down();
-		break;
-
-	case CFG_MOVE_FOCUS:
-		CDBG("mt9p012_km_ioctl: CFG_MOVE_FOCUS: cdata.cfg.focus.dir=%d \
-				cdata.cfg.focus.steps=%d\n",
-				cdata.cfg.focus.dir, cdata.cfg.focus.steps);
-		rc = mt9p012_km_move_focus(cdata.cfg.focus.dir,
-					cdata.cfg.focus.steps);
-		break;
-
-	case CFG_SET_DEFAULT_FOCUS:
-		rc = mt9p012_km_set_default_focus();
-		break;
-
-	case CFG_SET_LENS_SHADING:
-		CDBG("%s: CFG_SET_LENS_SHADING\n", __func__);
-		rc = mt9p012_km_lens_shading_enable(cdata.cfg.lens_shading);
-		break;
-
-	case CFG_GET_AF_MAX_STEPS:
-		cdata.max_steps = MT9P012_KM_STEPS_NEAR_TO_CLOSEST_INF;
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_SET_EFFECT:
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	mutex_unlock(&mt9p012_km_mut);
-	return rc;
-}
-
-int mt9p012_km_sensor_release(void)
-{
-	int rc = -EBADF;
-
-	mutex_lock(&mt9p012_km_mut);
-
-	mt9p012_km_power_down();
-
-	gpio_direction_output(mt9p012_km_ctrl->sensordata->sensor_reset, 0);
-	gpio_free(mt9p012_km_ctrl->sensordata->sensor_reset);
-
-	gpio_direction_output(mt9p012_km_ctrl->sensordata->vcm_pwd, 0);
-	gpio_free(mt9p012_km_ctrl->sensordata->vcm_pwd);
-
-	kfree(mt9p012_km_ctrl);
-	mt9p012_km_ctrl = NULL;
-
-	CDBG("mt9p012_km_release completed\n");
-
-	mutex_unlock(&mt9p012_km_mut);
-	return rc;
-}
-
-static int mt9p012_km_i2c_probe(struct i2c_client *client,
-			     const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("mt9p012_km_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	mt9p012_km_sensorw = kzalloc(sizeof(struct mt9p012_km_work),
-							GFP_KERNEL);
-	if (!mt9p012_km_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, mt9p012_km_sensorw);
-	mt9p012_km_init_client(client);
-	mt9p012_km_client = client;
-
-	mdelay(50);
-
-	CDBG("mt9p012_km_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("mt9p012_km_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static const struct i2c_device_id mt9p012_km_i2c_id[] = {
-	{"mt9p012_km", 0},
-	{}
-};
-
-static struct i2c_driver mt9p012_km_i2c_driver = {
-	.id_table = mt9p012_km_i2c_id,
-	.probe = mt9p012_km_i2c_probe,
-	.remove = __exit_p(mt9p012_km_i2c_remove),
-	.driver = {
-		   .name = "mt9p012_km",
-		   },
-};
-
-static int mt9p012_km_sensor_probe(const struct msm_camera_sensor_info *info,
-				struct msm_sensor_ctrl *s)
-{
-	int rc = i2c_add_driver(&mt9p012_km_i2c_driver);
-	if (rc < 0 || mt9p012_km_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_done;
-	}
-
-	msm_camio_clk_rate_set(MT9P012_KM_DEFAULT_CLOCK_RATE);
-	mdelay(20);
-
-	rc = mt9p012_km_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_done;
-
-	s->s_init = mt9p012_km_sensor_open_init;
-	s->s_release = mt9p012_km_sensor_release;
-	s->s_config = mt9p012_km_sensor_config;
-	s->s_mount_angle  = 0;
-	mt9p012_km_probe_init_done(info);
-
-probe_done:
-	CDBG("%s %s:%d\n", __FILE__, __func__, __LINE__);
-	return rc;
-}
-
-static int __mt9p012_km_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, mt9p012_km_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __mt9p012_km_probe,
-	.driver = {
-		   .name = "msm_camera_mt9p012_km",
-		   .owner = THIS_MODULE,
-		   },
-};
-
-static int __init mt9p012_km_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(mt9p012_km_init);
diff --git a/drivers/media/video/msm/mt9p012_km.h b/drivers/media/video/msm/mt9p012_km.h
deleted file mode 100644
index d386474..0000000
--- a/drivers/media/video/msm/mt9p012_km.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef MT9P012_KM_H
-#define MT9P012_KM_H
-
-#include <linux/types.h>
-#include <mach/board.h>
-
-extern struct mt9p012_km_reg mt9p012_km_regs;	/* from mt9p012_km_reg.c */
-
-struct reg_struct {
-	uint16_t vt_pix_clk_div;     /* 0x0300 */
-	uint16_t vt_sys_clk_div;     /* 0x0302 */
-	uint16_t pre_pll_clk_div;    /* 0x0304 */
-	uint16_t pll_multiplier;     /* 0x0306 */
-	uint16_t op_pix_clk_div;     /* 0x0308 */
-	uint16_t op_sys_clk_div;     /* 0x030A */
-	uint16_t scale_m;            /* 0x0404 */
-	uint16_t row_speed;          /* 0x3016 */
-	uint16_t x_addr_start;       /* 0x3004 */
-	uint16_t x_addr_end;         /* 0x3008 */
-	uint16_t y_addr_start;       /* 0x3002 */
-	uint16_t y_addr_end;         /* 0x3006 */
-	uint16_t read_mode;          /* 0x3040 */
-	uint16_t x_output_size ;     /* 0x034C */
-	uint16_t y_output_size;      /* 0x034E */
-	uint16_t line_length_pck;    /* 0x300C */
-	uint16_t frame_length_lines; /* 0x300A */
-	uint16_t coarse_int_time;    /* 0x3012 */
-	uint16_t fine_int_time;      /* 0x3014 */
-};
-
-
-struct mt9p012_km_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-
-struct mt9p012_km_reg {
-	struct reg_struct const *reg_pat;
-	uint16_t reg_pat_size;
-	struct mt9p012_km_i2c_reg_conf const *ttbl;
-	uint16_t ttbl_size;
-	struct mt9p012_km_i2c_reg_conf const *lctbl;
-	uint16_t lctbl_size;
-	struct mt9p012_km_i2c_reg_conf const *rftbl;
-	uint16_t rftbl_size;
-};
-
-#endif /* MT9P012_KM_H */
diff --git a/drivers/media/video/msm/mt9p012_km_reg.c b/drivers/media/video/msm/mt9p012_km_reg.c
deleted file mode 100644
index 5c6318f..0000000
--- a/drivers/media/video/msm/mt9p012_km_reg.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/* Copyright (c) 2009-2010, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "mt9p012_km.h"
-#include <linux/kernel.h>
-
-/*Micron settings from Applications for lower power consumption.*/
-struct reg_struct const mt9p012_km_reg_pat[2] = {
-	{ /* Preview */
-		/* vt_pix_clk_div          REG=0x0300 */
-		6,  /* 5 */
-
-		/* vt_sys_clk_div          REG=0x0302 */
-		1,
-
-		/* pre_pll_clk_div         REG=0x0304 */
-		2,
-
-		/* pll_multiplier          REG=0x0306 */
-		60,
-
-		/* op_pix_clk_div          REG=0x0308 */
-		8,  /* 10 */
-
-		/* op_sys_clk_div          REG=0x030A */
-		1,
-
-		/* scale_m                 REG=0x0404 */
-		16,
-
-		/* row_speed               REG=0x3016 */
-		0x0111,
-
-		/* x_addr_start            REG=0x3004 */
-		8,
-
-		/* x_addr_end              REG=0x3008 */
-		2597,
-
-		/* y_addr_start            REG=0x3002 */
-		8,
-
-		/* y_addr_end              REG=0x3006 */
-		1949,
-
-		/* read_mode               REG=0x3040
-		 * Preview 2x2 skipping */
-		0x006C,
-
-		/* x_output_size           REG=0x034C */
-		1296,
-
-		/* y_output_size           REG=0x034E */
-		972,
-
-		/* line_length_pck         REG=0x300C */
-		3783,
-
-		/* frame_length_lines      REG=0x300A */
-		1074,
-
-		/* coarse_integration_time REG=0x3012 */
-		16,
-
-		/* fine_integration_time   REG=0x3014 */
-		1764
-	},
-	{ /* Snapshot */
-		/* vt_pix_clk_div          REG=0x0300 */
-		6,
-
-		/* vt_sys_clk_div          REG=0x0302 */
-		1,
-
-		/* pre_pll_clk_div         REG=0x0304 */
-		2,
-
-		/* pll_multiplier          REG=0x0306
-		 * 39 for 10fps snapshot */
-		39,
-
-		/* op_pix_clk_div          REG=0x0308 */
-		8,
-
-		/* op_sys_clk_div          REG=0x030A */
-		1,
-
-		/* scale_m                 REG=0x0404 */
-		16,
-
-		/* row_speed               REG=0x3016 */
-		0x0111,
-
-		/* x_addr_start            REG=0x3004 */
-		8,
-
-		/* x_addr_end              REG=0x3008 */
-		2615,
-
-		/* y_addr_start            REG=0x3002 */
-		8,
-
-		/* y_addr_end              REG=0x3006 */
-		1967,
-
-		/* read_mode               REG=0x3040 */
-		0x0024,
-
-		/* x_output_size           REG=0x034C */
-		2608,
-
-		/* y_output_size           REG=0x034E */
-		1960,
-
-		/* line_length_pck         REG=0x300C */
-		3788,
-
-		/* frame_length_lines      REG=0x300A 10 fps snapshot */
-		2045,
-
-		/* coarse_integration_time REG=0x3012 */
-		16,
-
-		/* fine_integration_time   REG=0x3014 */
-		882
-	}
-};
-
-struct mt9p012_km_i2c_reg_conf const mt9p012_km_test_tbl[] = {
-	{0x3044, 0x0544 & 0xFBFF},
-	{0x30CA, 0x0004 | 0x0001},
-	{0x30D4, 0x9020 & 0x7FFF},
-	{0x31E0, 0x0003 & 0xFFFE},
-	{0x3180, 0x91FF & 0x7FFF},
-	{0x301A, (0x10CC | 0x8000) & 0xFFF7},
-	{0x301E, 0x0000},
-	{0x3780, 0x0000},
-};
-
-
-struct mt9p012_km_i2c_reg_conf const mt9p012_km_lc_tbl[] = {
-	{0x360A, 0x00F0},
-	{0x360C, 0x0B29},
-	{0x360E, 0x5ED1},
-	{0x3610, 0x890D},
-	{0x3612, 0x9871},
-	{0x364A, 0xAD2C},
-	{0x364C, 0x0A8C},
-	{0x364E, 0x91EC},
-	{0x3650, 0x94EC},
-	{0x3652, 0xC76B},
-	{0x368A, 0x5931},
-	{0x368C, 0x4FED},
-	{0x368E, 0x8A50},
-	{0x3690, 0x5C0F},
-	{0x3692, 0x8393},
-	{0x36CA, 0xDB8E},
-	{0x36CC, 0xCA4D},
-	{0x36CE, 0x146F},
-	{0x36D0, 0x618F},
-	{0x36D2, 0x014F},
-	{0x370A, 0x1FEE},
-	{0x370C, 0xDD50},
-	{0x370E, 0xDB54},
-	{0x3710, 0xCA92},
-	{0x3712, 0x1896},
-	{0x3600, 0x00F0},
-	{0x3602, 0xA04C},
-	{0x3604, 0x5711},
-	{0x3606, 0x5E6D},
-	{0x3608, 0xA971},
-	{0x3640, 0xDCCC},
-	{0x3642, 0x0529},
-	{0x3644, 0x96ED},
-	{0x3646, 0xF447},
-	{0x3648, 0x4AEE},
-	{0x3680, 0x2171},
-	{0x3682, 0x634F},
-	{0x3684, 0xCC91},
-	{0x3686, 0xA9CE},
-	{0x3688, 0x8751},
-	{0x36C0, 0x8B6D},
-	{0x36C2, 0xE20E},
-	{0x36C4, 0x750F},
-	{0x36C6, 0x0090},
-	{0x36C8, 0x9E91},
-	{0x3700, 0xEAAF},
-	{0x3702, 0xB8AF},
-	{0x3704, 0xE293},
-	{0x3706, 0xAB33},
-	{0x3708, 0x4595},
-	{0x3614, 0x00D0},
-	{0x3616, 0x8AAB},
-	{0x3618, 0x18B1},
-	{0x361A, 0x54AD},
-	{0x361C, 0x9DB0},
-	{0x3654, 0x11EB},
-	{0x3656, 0x332C},
-	{0x3658, 0x316D},
-	{0x365A, 0xF0EB},
-	{0x365C, 0xB4ED},
-	{0x3694, 0x0F31},
-	{0x3696, 0x08D0},
-	{0x3698, 0xA52F},
-	{0x369A, 0xE64F},
-	{0x369C, 0xC9D2},
-	{0x36D4, 0x8C2D},
-	{0x36D6, 0xAD6E},
-	{0x36D8, 0xE1CE},
-	{0x36DA, 0x1750},
-	{0x36DC, 0x8CAD},
-	{0x3714, 0x8CAF},
-	{0x3716, 0x8C11},
-	{0x3718, 0xE453},
-	{0x371A, 0x9693},
-	{0x371C, 0x38B5},
-	{0x361E, 0x00D0},
-	{0x3620, 0xB6CB},
-	{0x3622, 0x4811},
-	{0x3624, 0xB70C},
-	{0x3626, 0xA771},
-	{0x365E, 0xB5A9},
-	{0x3660, 0x05AA},
-	{0x3662, 0x00CF},
-	{0x3664, 0xB86B},
-	{0x3666, 0xA4AF},
-	{0x369E, 0x3E31},
-	{0x36A0, 0x902B},
-	{0x36A2, 0xD251},
-	{0x36A4, 0x5C2F},
-	{0x36A6, 0x8471},
-	{0x36DE, 0x2C6D},
-	{0x36E0, 0xECEE},
-	{0x36E2, 0xB650},
-	{0x36E4, 0x0210},
-	{0x36E6, 0xACAE},
-	{0x371E, 0xAC30},
-	{0x3720, 0x394E},
-	{0x3722, 0xFDD3},
-	{0x3724, 0xBCB2},
-	{0x3726, 0x5AD5},
-	{0x3782, 0x0508},
-	{0x3784, 0x03B4},
-	{0x3780, 0x8000},
-};
-
-struct mt9p012_km_i2c_reg_conf const mt9p012_km_rolloff_tbl[] = {
-	{0x360A, 0x00F0},
-	{0x360C, 0x0B29},
-	{0x360E, 0x5ED1},
-	{0x3610, 0x890D},
-	{0x3612, 0x9871},
-	{0x364A, 0xAD2C},
-	{0x364C, 0x0A8C},
-	{0x364E, 0x91EC},
-	{0x3650, 0x94EC},
-	{0x3652, 0xC76B},
-	{0x368A, 0x5931},
-	{0x368C, 0x4FED},
-	{0x368E, 0x8A50},
-	{0x3690, 0x5C0F},
-	{0x3692, 0x8393},
-	{0x36CA, 0xDB8E},
-	{0x36CC, 0xCA4D},
-	{0x36CE, 0x146F},
-	{0x36D0, 0x618F},
-	{0x36D2, 0x014F},
-	{0x370A, 0x1FEE},
-	{0x370C, 0xDD50},
-	{0x370E, 0xDB54},
-	{0x3710, 0xCA92},
-	{0x3712, 0x1896},
-	{0x3600, 0x00F0},
-	{0x3602, 0xA04C},
-	{0x3604, 0x5711},
-	{0x3606, 0x5E6D},
-	{0x3608, 0xA971},
-	{0x3640, 0xDCCC},
-	{0x3642, 0x0529},
-	{0x3644, 0x96ED},
-	{0x3646, 0xF447},
-	{0x3648, 0x4AEE},
-	{0x3680, 0x2171},
-	{0x3682, 0x634F},
-	{0x3684, 0xCC91},
-	{0x3686, 0xA9CE},
-	{0x3688, 0x8751},
-	{0x36C0, 0x8B6D},
-	{0x36C2, 0xE20E},
-	{0x36C4, 0x750F},
-	{0x36C6, 0x0090},
-	{0x36C8, 0x9E91},
-	{0x3700, 0xEAAF},
-	{0x3702, 0xB8AF},
-	{0x3704, 0xE293},
-	{0x3706, 0xAB33},
-	{0x3708, 0x4595},
-	{0x3614, 0x00D0},
-	{0x3616, 0x8AAB},
-	{0x3618, 0x18B1},
-	{0x361A, 0x54AD},
-	{0x361C, 0x9DB0},
-	{0x3654, 0x11EB},
-	{0x3656, 0x332C},
-	{0x3658, 0x316D},
-	{0x365A, 0xF0EB},
-	{0x365C, 0xB4ED},
-	{0x3694, 0x0F31},
-	{0x3696, 0x08D0},
-	{0x3698, 0xA52F},
-	{0x369A, 0xE64F},
-	{0x369C, 0xC9D2},
-	{0x36D4, 0x8C2D},
-	{0x36D6, 0xAD6E},
-	{0x36D8, 0xE1CE},
-	{0x36DA, 0x1750},
-	{0x36DC, 0x8CAD},
-	{0x3714, 0x8CAF},
-	{0x3716, 0x8C11},
-	{0x3718, 0xE453},
-	{0x371A, 0x9693},
-	{0x371C, 0x38B5},
-	{0x361E, 0x00D0},
-	{0x3620, 0xB6CB},
-	{0x3622, 0x4811},
-	{0x3624, 0xB70C},
-	{0x3626, 0xA771},
-	{0x365E, 0xB5A9},
-	{0x3660, 0x05AA},
-	{0x3662, 0x00CF},
-	{0x3664, 0xB86B},
-	{0x3666, 0xA4AF},
-	{0x369E, 0x3E31},
-	{0x36A0, 0x902B},
-	{0x36A2, 0xD251},
-	{0x36A4, 0x5C2F},
-	{0x36A6, 0x8471},
-	{0x36DE, 0x2C6D},
-	{0x36E0, 0xECEE},
-	{0x36E2, 0xB650},
-	{0x36E4, 0x0210},
-	{0x36E6, 0xACAE},
-	{0x371E, 0xAC30},
-	{0x3720, 0x394E},
-	{0x3722, 0xFDD3},
-	{0x3724, 0xBCB2},
-	{0x3726, 0x5AD5},
-	{0x3782, 0x0508},
-	{0x3784, 0x03B4},
-	{0x3780, 0x8000},
-};
-
-
-struct mt9p012_km_reg mt9p012_km_regs = {
-	.reg_pat = &mt9p012_km_reg_pat[0],
-	.reg_pat_size = ARRAY_SIZE(mt9p012_km_reg_pat),
-	.ttbl = &mt9p012_km_test_tbl[0],
-	.ttbl_size = ARRAY_SIZE(mt9p012_km_test_tbl),
-	.lctbl = &mt9p012_km_lc_tbl[0],
-	.lctbl_size = ARRAY_SIZE(mt9p012_km_lc_tbl),
-	.rftbl = &mt9p012_km_rolloff_tbl[0],
-	.rftbl_size = ARRAY_SIZE(mt9p012_km_rolloff_tbl)
-};
-
-
diff --git a/drivers/media/video/msm/mt9p012_reg.c b/drivers/media/video/msm/mt9p012_reg.c
deleted file mode 100644
index b828852..0000000
--- a/drivers/media/video/msm/mt9p012_reg.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "mt9p012.h"
-#include <linux/kernel.h>
-
-/*Micron settings from Applications for lower power consumption.*/
-struct reg_struct const mt9p012_reg_pat[2] = {
-	{ /* Preview */
-		/* vt_pix_clk_div          REG=0x0300 */
-		6,  /* 5 */
-
-		/* vt_sys_clk_div          REG=0x0302 */
-		1,
-		/* pre_pll_clk_div         REG=0x0304 */
-		2,
-		/* pll_multiplier          REG=0x0306 */
-		60,
-
-		/* op_pix_clk_div          REG=0x0308 */
-		8,  /* 10 */
-
-		/* op_sys_clk_div          REG=0x030A */
-		1,
-
-		/* scale_m                 REG=0x0404 */
-		16,
-
-		/* row_speed               REG=0x3016 */
-		0x0111,
-
-		/* x_addr_start            REG=0x3004 */
-		8,
-
-		/* x_addr_end              REG=0x3008 */
-		2597,
-
-		/* y_addr_start            REG=0x3002 */
-		8,
-
-		/* y_addr_end              REG=0x3006 */
-		1949,
-
-		/* read_mode               REG=0x3040
-		 * Preview 2x2 skipping */
-		0x00C3,
-
-		/* x_output_size           REG=0x034C */
-		1296,
-
-		/* y_output_size           REG=0x034E */
-		972,
-
-		/* line_length_pck         REG=0x300C */
-		3659,
-
-		/* frame_length_lines      REG=0x300A */
-		1074,
-
-		/* coarse_integration_time REG=0x3012 */
-		16,
-
-		/* fine_integration_time   REG=0x3014 */
-		1764
-	},
-	{ /* Snapshot */
-		/* vt_pix_clk_div          REG=0x0300 */
-		6,
-
-		/* vt_sys_clk_div          REG=0x0302 */
-		1,
-
-		/* pre_pll_clk_div         REG=0x0304 */
-		2,
-
-		/* pll_multiplier          REG=0x0306
-		 * 60 for 10fps snapshot */
-		60,
-
-		/* op_pix_clk_div          REG=0x0308 */
-		8,
-
-		/* op_sys_clk_div          REG=0x030A */
-		1,
-
-		/* scale_m                 REG=0x0404 */
-		16,
-
-		/* row_speed               REG=0x3016 */
-		0x0111,
-
-		/* x_addr_start            REG=0x3004 */
-		8,
-
-		/* x_addr_end              REG=0x3008 */
-		2615,
-
-		/* y_addr_start            REG=0x3002 */
-		8,
-
-		/* y_addr_end              REG=0x3006 */
-		1967,
-
-		/* read_mode               REG=0x3040 */
-		0x0041,
-
-		/* x_output_size           REG=0x034C */
-		2608,
-
-		/* y_output_size           REG=0x034E */
-		1960,
-
-		/* line_length_pck         REG=0x300C */
-		3911,
-
-		/* frame_length_lines      REG=0x300A 10 fps snapshot */
-		2045,
-
-		/* coarse_integration_time REG=0x3012 */
-		16,
-
-		/* fine_integration_time   REG=0x3014 */
-		882
-	}
-};
-
-
-struct mt9p012_i2c_reg_conf const mt9p012_test_tbl[] = {
-	{0x3044, 0x0544 & 0xFBFF},
-	{0x30CA, 0x0004 | 0x0001},
-	{0x30D4, 0x9020 & 0x7FFF},
-	{0x31E0, 0x0003 & 0xFFFE},
-	{0x3180, 0x91FF & 0x7FFF},
-	{0x301A, (0x10CC | 0x8000) & 0xFFF7},
-	{0x301E, 0x0000},
-	{0x3780, 0x0000},
-};
-struct mt9p012_i2c_reg_conf const mt9p012_rolloff_tbl[] = {
-	{0x360A, 0x0110},
-	{0x360C, 0x270D},
-	{0x360E, 0x0071},
-	{0x3610, 0xA38D},
-	{0x3612, 0xA610},
-	{0x364A, 0x8F49},
-	{0x364C, 0x696A},
-	{0x364E, 0x0FCD},
-	{0x3650, 0x20ED},
-	{0x3652, 0x81ED},
-	{0x368A, 0x1031},
-	{0x368C, 0xBCAD},
-	{0x368E, 0x77AA},
-	{0x3690, 0xD10E},
-	{0x3692, 0xC133},
-	{0x36CA, 0x4F8D},
-	{0x36CC, 0xAC4D},
-	{0x36CE, 0xC8CE},
-	{0x36D0, 0x73AD},
-	{0x36D2, 0xC150},
-	{0x370A, 0xB590},
-	{0x370C, 0x9010},
-	{0x370E, 0xAC52},
-	{0x3710, 0x4D51},
-	{0x3712, 0x5670},
-	{0x3600, 0x00F0},
-	{0x3602, 0xCE4B},
-	{0x3604, 0x4270},
-	{0x3606, 0x8BC9},
-	{0x3608, 0xFA2F},
-	{0x3640, 0x9A09},
-	{0x3642, 0xB40C},
-	{0x3644, 0x4ECD},
-	{0x3646, 0x1BCC},
-	{0x3648, 0xD68E},
-	{0x3680, 0x1BF0},
-	{0x3682, 0xC94D},
-	{0x3684, 0x714F},
-	{0x3686, 0x1491},
-	{0x3688, 0xB8D3},
-	{0x36C0, 0x3E49},
-	{0x36C2, 0x7A6C},
-	{0x36C4, 0xEF2E},
-	{0x36C6, 0xE0EE},
-	{0x36C8, 0x570F},
-	{0x3700, 0xD6AF},
-	{0x3702, 0x2251},
-	{0x3704, 0x8A33},
-	{0x3706, 0xEFB3},
-	{0x3708, 0x1174},
-	{0x3614, 0x0150},
-	{0x3616, 0xA9AB},
-	{0x3618, 0x1770},
-	{0x361A, 0x8809},
-	{0x361C, 0xE3AE},
-	{0x3654, 0x5ACC},
-	{0x3656, 0x35EA},
-	{0x3658, 0x2DEC},
-	{0x365A, 0xB90B},
-	{0x365C, 0x250C},
-	{0x3694, 0x1630},
-	{0x3696, 0xD88C},
-	{0x3698, 0xBD0E},
-	{0x369A, 0x16D1},
-	{0x369C, 0xE492},
-	{0x36D4, 0x5D6D},
-	{0x36D6, 0x906E},
-	{0x36D8, 0x10AE},
-	{0x36DA, 0x7A8E},
-	{0x36DC, 0x9672},
-	{0x3714, 0x8D90},
-	{0x3716, 0x04F1},
-	{0x3718, 0x23F1},
-	{0x371A, 0xF313},
-	{0x371C, 0xE833},
-	{0x361E, 0x0490},
-	{0x3620, 0x14CD},
-	{0x3622, 0x38F0},
-	{0x3624, 0xBAED},
-	{0x3626, 0xFF6F},
-	{0x365E, 0x358C},
-	{0x3660, 0xA9E9},
-	{0x3662, 0x4A4E},
-	{0x3664, 0x398D},
-	{0x3666, 0x890F},
-	{0x369E, 0x2DF0},
-	{0x36A0, 0xF7CE},
-	{0x36A2, 0xB3CC},
-	{0x36A4, 0x118D},
-	{0x36A6, 0x9CB3},
-	{0x36DE, 0x462D},
-	{0x36E0, 0x74AA},
-	{0x36E2, 0xC8CF},
-	{0x36E4, 0x8DEF},
-	{0x36E6, 0xF130},
-	{0x371E, 0x9250},
-	{0x3720, 0x19CC},
-	{0x3722, 0xDFD1},
-	{0x3724, 0x5B70},
-	{0x3726, 0x34D2},
-	{0x3782, 0x0530},
-	{0x3784, 0x03C8},
-	{0x3780, 0x8000},
-};
-
-struct mt9p012_reg mt9p012_regs = {
-	.reg_pat = &mt9p012_reg_pat[0],
-	.reg_pat_size = ARRAY_SIZE(mt9p012_reg_pat),
-	.ttbl = &mt9p012_test_tbl[0],
-	.ttbl_size = ARRAY_SIZE(mt9p012_test_tbl),
-	.rftbl = &mt9p012_rolloff_tbl[0],
-	.rftbl_size = ARRAY_SIZE(mt9p012_rolloff_tbl)
-};
-
-
diff --git a/drivers/media/video/msm/mt9t013.c b/drivers/media/video/msm/mt9t013.c
deleted file mode 100644
index e107930..0000000
--- a/drivers/media/video/msm/mt9t013.c
+++ /dev/null
@@ -1,1504 +0,0 @@
-/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include <asm/mach-types.h>
-#include "mt9t013.h"
-
-/*=============================================================
-	SENSOR REGISTER DEFINES
-==============================================================*/
-#define MT9T013_REG_MODEL_ID 		 0x0000
-#define MT9T013_MODEL_ID     		 0x2600
-#define REG_GROUPED_PARAMETER_HOLD   0x0104
-#define GROUPED_PARAMETER_HOLD       0x0100
-#define GROUPED_PARAMETER_UPDATE     0x0000
-#define REG_COARSE_INT_TIME          0x3012
-#define REG_VT_PIX_CLK_DIV           0x0300
-#define REG_VT_SYS_CLK_DIV           0x0302
-#define REG_PRE_PLL_CLK_DIV          0x0304
-#define REG_PLL_MULTIPLIER           0x0306
-#define REG_OP_PIX_CLK_DIV           0x0308
-#define REG_OP_SYS_CLK_DIV           0x030A
-#define REG_SCALE_M                  0x0404
-#define REG_FRAME_LENGTH_LINES       0x300A
-#define REG_LINE_LENGTH_PCK          0x300C
-#define REG_X_ADDR_START             0x3004
-#define REG_Y_ADDR_START             0x3002
-#define REG_X_ADDR_END               0x3008
-#define REG_Y_ADDR_END               0x3006
-#define REG_X_OUTPUT_SIZE            0x034C
-#define REG_Y_OUTPUT_SIZE            0x034E
-#define REG_FINE_INT_TIME            0x3014
-#define REG_ROW_SPEED                0x3016
-#define MT9T013_REG_RESET_REGISTER   0x301A
-#define MT9T013_RESET_REGISTER_PWON  0x10CC
-#define MT9T013_RESET_REGISTER_PWOFF 0x1008 /* 0x10C8 stop streaming*/
-#define MT9T013_RESET_FAST_TRANSITION 0x0002
-#define REG_READ_MODE                0x3040
-#define REG_GLOBAL_GAIN              0x305E
-#define REG_TEST_PATTERN_MODE        0x3070
-
-
-enum mt9t013_test_mode {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum mt9t013_resolution {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-
-enum mt9t013_reg_update {
-	REG_INIT, /* registers that need to be updated during initialization */
-	UPDATE_PERIODIC, /* registers that needs periodic I2C writes */
-	UPDATE_ALL, /* all registers will be updated */
-	UPDATE_INVALID
-};
-
-enum mt9t013_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-
-/* actuator's Slave Address */
-#define MT9T013_AF_I2C_ADDR   0x18
-
-/*
-* AF Total steps parameters
-*/
-#define MT9T013_TOTAL_STEPS_NEAR_TO_FAR    30
-
-/*
- * Time in milisecs for waiting for the sensor to reset.
- */
-#define MT9T013_RESET_DELAY_MSECS   66
-
-/* for 30 fps preview */
-#define MT9T013_DEFAULT_CLOCK_RATE  24000000
-#define MT9T013_DEFAULT_MAX_FPS     26
-
-
-/* FIXME: Changes from here */
-struct mt9t013_work {
-	struct work_struct work;
-};
-
-static struct  mt9t013_work *mt9t013_sensorw;
-static struct  i2c_client *mt9t013_client;
-
-struct mt9t013_ctrl {
-	const struct msm_camera_sensor_info *sensordata;
-
-	int sensormode;
-	uint32_t fps_divider; 		/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider; 	/* init to 1 * 0x00000400 */
-
-	uint16_t curr_lens_pos;
-	uint16_t init_curr_lens_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-
-	enum mt9t013_resolution prev_res;
-	enum mt9t013_resolution pict_res;
-	enum mt9t013_resolution curr_res;
-	enum mt9t013_test_mode  set_test;
-
-	unsigned short imgaddr;
-};
-
-
-static struct mt9t013_ctrl *mt9t013_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(mt9t013_wait_queue);
-DEFINE_SEMAPHORE(mt9t013_sem);
-
-static int mt9t013_i2c_rxdata(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-	{
-		.addr   = saddr,
-		.flags = 0,
-		.len   = 2,
-		.buf   = rxdata,
-	},
-	{
-		.addr  = saddr,
-		.flags = I2C_M_RD,
-		.len   = length,
-		.buf   = rxdata,
-	},
-	};
-
-	if (i2c_transfer(mt9t013_client->adapter, msgs, 2) < 0) {
-		pr_err("mt9t013_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t mt9t013_i2c_read_w(unsigned short saddr,
-	unsigned short raddr, unsigned short *rdata)
-{
-	int32_t rc = 0;
-	unsigned char buf[4];
-
-	if (!rdata)
-		return -EIO;
-
-	memset(buf, 0, sizeof(buf));
-
-	buf[0] = (raddr & 0xFF00)>>8;
-	buf[1] = (raddr & 0x00FF);
-
-	rc = mt9t013_i2c_rxdata(saddr, buf, 2);
-	if (rc < 0)
-		return rc;
-
-	*rdata = buf[0] << 8 | buf[1];
-
-	if (rc < 0)
-		pr_err("mt9t013_i2c_read failed!\n");
-
-	return rc;
-}
-
-static int32_t mt9t013_i2c_txdata(unsigned short saddr,
-	unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-	{
-		.addr = saddr,
-		.flags = 0,
-		.len = length,
-		.buf = txdata,
-	},
-	};
-
-	if (i2c_transfer(mt9t013_client->adapter, msg, 1) < 0) {
-		pr_err("mt9t013_i2c_txdata failed\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t mt9t013_i2c_write_b(unsigned short saddr,
-	unsigned short waddr, unsigned short wdata)
-{
-	int32_t rc = -EIO;
-	unsigned char buf[2];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = waddr;
-	buf[1] = wdata;
-	rc = mt9t013_i2c_txdata(saddr, buf, 2);
-
-	if (rc < 0)
-		pr_err("i2c_write failed, addr = 0x%x, val = 0x%x!\n",
-		waddr, wdata);
-
-	return rc;
-}
-
-static int32_t mt9t013_i2c_write_w(unsigned short saddr,
-	unsigned short waddr, unsigned short wdata)
-{
-	int32_t rc = -EIO;
-	unsigned char buf[4];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00)>>8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = (wdata & 0xFF00)>>8;
-	buf[3] = (wdata & 0x00FF);
-
-	rc = mt9t013_i2c_txdata(saddr, buf, 4);
-
-	if (rc < 0)
-		pr_err("i2c_write_w failed, addr = 0x%x, val = 0x%x!\n",
-		waddr, wdata);
-
-	return rc;
-}
-
-static int32_t mt9t013_i2c_write_w_table(
-	struct mt9t013_i2c_reg_conf const *reg_conf_tbl,
-	int num_of_items_in_table)
-{
-	int i;
-	int32_t rc = -EIO;
-
-	for (i = 0; i < num_of_items_in_table; i++) {
-		rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-			reg_conf_tbl->waddr, reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-
-	return rc;
-}
-
-static int32_t mt9t013_test(enum mt9t013_test_mode mo)
-{
-	int32_t rc = 0;
-
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-			REG_GROUPED_PARAMETER_HOLD,
-			GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return rc;
-
-	if (mo == TEST_OFF)
-		return 0;
-	else {
-		rc = mt9t013_i2c_write_w_table(mt9t013_regs.ttbl,
-				mt9t013_regs.ttbl_size);
-		if (rc < 0)
-			return rc;
-		rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_TEST_PATTERN_MODE, (uint16_t)mo);
-		if (rc < 0)
-			return rc;
-	}
-
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-			REG_GROUPED_PARAMETER_HOLD,
-			GROUPED_PARAMETER_UPDATE);
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-
-static int32_t mt9t013_set_lc(void)
-{
-	int32_t rc;
-
-	rc = mt9t013_i2c_write_w_table(mt9t013_regs.lctbl,
-		mt9t013_regs.lctbl_size);
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-
-static int32_t mt9t013_set_default_focus(uint8_t af_step)
-{
-	int32_t rc = 0;
-	uint8_t code_val_msb, code_val_lsb;
-	code_val_msb = 0x01;
-	code_val_lsb = af_step;
-
-	/* Write the digital code for current to the actuator */
-	rc = mt9t013_i2c_write_b(MT9T013_AF_I2C_ADDR>>1,
-			code_val_msb, code_val_lsb);
-
-	mt9t013_ctrl->curr_lens_pos = 0;
-	mt9t013_ctrl->init_curr_lens_pos = 0;
-	return rc;
-}
-
-static void mt9t013_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint32_t divider;   /*Q10 */
-	uint32_t pclk_mult; /*Q10 */
-	uint32_t d1;
-	uint32_t d2;
-
-	d1 =
-		(uint32_t)(
-		(mt9t013_regs.reg_pat[RES_PREVIEW].frame_length_lines *
-		0x00000400) /
-		mt9t013_regs.reg_pat[RES_CAPTURE].frame_length_lines);
-
-	d2 =
-		(uint32_t)(
-		(mt9t013_regs.reg_pat[RES_PREVIEW].line_length_pck *
-		0x00000400) /
-		mt9t013_regs.reg_pat[RES_CAPTURE].line_length_pck);
-
-	divider = (uint32_t) (d1 * d2) / 0x00000400;
-
-	pclk_mult =
-		(uint32_t) ((mt9t013_regs.reg_pat[RES_CAPTURE].pll_multiplier *
-		0x00000400) /
-		(mt9t013_regs.reg_pat[RES_PREVIEW].pll_multiplier));
-
-
-	/* Verify PCLK settings and frame sizes. */
-	*pfps =
-		(uint16_t) (fps * divider * pclk_mult /
-		0x00000400 / 0x00000400);
-}
-
-static uint16_t mt9t013_get_prev_lines_pf(void)
-{
-	if (mt9t013_ctrl->prev_res == QTR_SIZE)
-		return mt9t013_regs.reg_pat[RES_PREVIEW].frame_length_lines;
-	else
-		return mt9t013_regs.reg_pat[RES_CAPTURE].frame_length_lines;
-}
-
-static uint16_t mt9t013_get_prev_pixels_pl(void)
-{
-	if (mt9t013_ctrl->prev_res == QTR_SIZE)
-		return mt9t013_regs.reg_pat[RES_PREVIEW].line_length_pck;
-	else
-		return mt9t013_regs.reg_pat[RES_CAPTURE].line_length_pck;
-}
-
-static uint16_t mt9t013_get_pict_lines_pf(void)
-{
-	return mt9t013_regs.reg_pat[RES_CAPTURE].frame_length_lines;
-}
-
-static uint16_t mt9t013_get_pict_pixels_pl(void)
-{
-	return mt9t013_regs.reg_pat[RES_CAPTURE].line_length_pck;
-}
-
-static uint32_t mt9t013_get_pict_max_exp_lc(void)
-{
-	uint16_t snapshot_lines_per_frame;
-
-	if (mt9t013_ctrl->pict_res == QTR_SIZE) {
-		snapshot_lines_per_frame =
-		mt9t013_regs.reg_pat[RES_PREVIEW].frame_length_lines - 1;
-	} else  {
-		snapshot_lines_per_frame =
-		mt9t013_regs.reg_pat[RES_CAPTURE].frame_length_lines - 1;
-	}
-
-	return snapshot_lines_per_frame * 24;
-}
-
-static int32_t mt9t013_set_fps(struct fps_cfg *fps)
-{
-	/* input is new fps in Q8 format */
-	int32_t rc = 0;
-	enum mt9t013_setting setting;
-
-	mt9t013_ctrl->fps_divider = fps->fps_div;
-	mt9t013_ctrl->pict_fps_divider = fps->pict_fps_div;
-
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-			REG_GROUPED_PARAMETER_HOLD,
-			GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return -EBUSY;
-
-	CDBG("mt9t013_set_fps: fps_div is %d, f_mult is %d\n",
-			fps->fps_div, fps->f_mult);
-
-	if (mt9t013_ctrl->sensormode == SENSOR_PREVIEW_MODE)
-		setting = RES_PREVIEW;
-	else
-		setting = RES_CAPTURE;
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-			REG_FRAME_LENGTH_LINES,
-			(uint16_t) (
-			mt9t013_regs.reg_pat[setting].frame_length_lines *
-			fps->fps_div / 0x00000400));
-
-	if (rc < 0)
-		return rc;
-
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-			REG_GROUPED_PARAMETER_HOLD,
-			GROUPED_PARAMETER_UPDATE);
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-
-static int32_t mt9t013_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	uint16_t max_legal_gain = 0x01FF;
-	int32_t rc = 0;
-
-	if (mt9t013_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-		mt9t013_ctrl->my_reg_gain = gain;
-		mt9t013_ctrl->my_reg_line_count = (uint16_t) line;
-	}
-
-	if (gain > max_legal_gain)
-		gain = max_legal_gain;
-
-	if (mt9t013_ctrl->sensormode != SENSOR_SNAPSHOT_MODE)
-		line = (uint32_t) (line * mt9t013_ctrl->fps_divider /
-				   0x00000400);
-	else
-		line = (uint32_t) (line * mt9t013_ctrl->pict_fps_divider /
-				   0x00000400);
-
-	/*Set digital gain to 1 */
-	gain |= 0x0200;
-
-	/* There used to be PARAMETER_HOLD register write before and
-	 * after REG_GLOBAL_GAIN & REG_COARSE_INIT_TIME. This causes
-	 * aec oscillation. Hence removed. */
-
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr, REG_GLOBAL_GAIN, gain);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-			REG_COARSE_INT_TIME, line);
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-
-static int32_t mt9t013_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-
-	rc = mt9t013_write_exp_gain(gain, line);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-			MT9T013_REG_RESET_REGISTER,
-			0x10CC | 0x0002);
-
-	mdelay(5);
-
-	return rc;
-}
-
-static int32_t mt9t013_setting(enum mt9t013_reg_update rupdate,
-	enum mt9t013_setting rt)
-{
-	int32_t rc = 0;
-
-	switch (rupdate) {
-	case UPDATE_PERIODIC: {
-
-	if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-#if 0
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				MT9T013_REG_RESET_REGISTER,
-				MT9T013_RESET_REGISTER_PWOFF);
-		if (rc < 0)
-			return rc;
-#endif
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_VT_PIX_CLK_DIV,
-				mt9t013_regs.reg_pat[rt].vt_pix_clk_div);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_VT_SYS_CLK_DIV,
-				mt9t013_regs.reg_pat[rt].vt_sys_clk_div);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_PRE_PLL_CLK_DIV,
-				mt9t013_regs.reg_pat[rt].pre_pll_clk_div);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_PLL_MULTIPLIER,
-				mt9t013_regs.reg_pat[rt].pll_multiplier);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_OP_PIX_CLK_DIV,
-				mt9t013_regs.reg_pat[rt].op_pix_clk_div);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_OP_SYS_CLK_DIV,
-				mt9t013_regs.reg_pat[rt].op_sys_clk_div);
-		if (rc < 0)
-			return rc;
-
-		mdelay(5);
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_GROUPED_PARAMETER_HOLD,
-				GROUPED_PARAMETER_HOLD);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_ROW_SPEED,
-				mt9t013_regs.reg_pat[rt].row_speed);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_X_ADDR_START,
-				mt9t013_regs.reg_pat[rt].x_addr_start);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_X_ADDR_END,
-				mt9t013_regs.reg_pat[rt].x_addr_end);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_Y_ADDR_START,
-				mt9t013_regs.reg_pat[rt].y_addr_start);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_Y_ADDR_END,
-				mt9t013_regs.reg_pat[rt].y_addr_end);
-		if (rc < 0)
-			return rc;
-
-		if (machine_is_sapphire()) {
-			if (rt == 0)
-				rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-					REG_READ_MODE,
-					0x046F);
-			else
-				rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-					REG_READ_MODE,
-					0x0027);
-		} else
-			rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-					REG_READ_MODE,
-					mt9t013_regs.reg_pat[rt].read_mode);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_SCALE_M,
-				mt9t013_regs.reg_pat[rt].scale_m);
-		if (rc < 0)
-			return rc;
-
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_X_OUTPUT_SIZE,
-				mt9t013_regs.reg_pat[rt].x_output_size);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_Y_OUTPUT_SIZE,
-				mt9t013_regs.reg_pat[rt].y_output_size);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_LINE_LENGTH_PCK,
-				mt9t013_regs.reg_pat[rt].line_length_pck);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-			REG_FRAME_LENGTH_LINES,
-			(mt9t013_regs.reg_pat[rt].frame_length_lines *
-			mt9t013_ctrl->fps_divider / 0x00000400));
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-			REG_COARSE_INT_TIME,
-			mt9t013_regs.reg_pat[rt].coarse_int_time);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-			REG_FINE_INT_TIME,
-			mt9t013_regs.reg_pat[rt].fine_int_time);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-			REG_GROUPED_PARAMETER_HOLD,
-			GROUPED_PARAMETER_UPDATE);
-		if (rc < 0)
-			return rc;
-
-		rc = mt9t013_test(mt9t013_ctrl->set_test);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-			MT9T013_REG_RESET_REGISTER,
-			MT9T013_RESET_REGISTER_PWON|
-			MT9T013_RESET_FAST_TRANSITION);
-		if (rc < 0)
-			return rc;
-
-		mdelay(5);
-
-		return rc;
-	}
-	}
-		break;
-
-	/*CAMSENSOR_REG_UPDATE_PERIODIC */
-	case REG_INIT: {
-	if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				MT9T013_REG_RESET_REGISTER,
-				MT9T013_RESET_REGISTER_PWOFF);
-		if (rc < 0)
-			/* MODE_SELECT, stop streaming */
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_VT_PIX_CLK_DIV,
-				mt9t013_regs.reg_pat[rt].vt_pix_clk_div);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_VT_SYS_CLK_DIV,
-				mt9t013_regs.reg_pat[rt].vt_sys_clk_div);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_PRE_PLL_CLK_DIV,
-				mt9t013_regs.reg_pat[rt].pre_pll_clk_div);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_PLL_MULTIPLIER,
-				mt9t013_regs.reg_pat[rt].pll_multiplier);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_OP_PIX_CLK_DIV,
-				mt9t013_regs.reg_pat[rt].op_pix_clk_div);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_OP_SYS_CLK_DIV,
-				mt9t013_regs.reg_pat[rt].op_sys_clk_div);
-		if (rc < 0)
-			return rc;
-
-		mdelay(5);
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_GROUPED_PARAMETER_HOLD,
-				GROUPED_PARAMETER_HOLD);
-		if (rc < 0)
-			return rc;
-
-		/* additional power saving mode ok around 38.2MHz */
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				0x3084, 0x2409);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				0x3092, 0x0A49);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				0x3094, 0x4949);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				0x3096, 0x4949);
-		if (rc < 0)
-			return rc;
-
-		/* Set preview or snapshot mode */
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_ROW_SPEED,
-				mt9t013_regs.reg_pat[rt].row_speed);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_X_ADDR_START,
-				mt9t013_regs.reg_pat[rt].x_addr_start);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_X_ADDR_END,
-				mt9t013_regs.reg_pat[rt].x_addr_end);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_Y_ADDR_START,
-				mt9t013_regs.reg_pat[rt].y_addr_start);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_Y_ADDR_END,
-				mt9t013_regs.reg_pat[rt].y_addr_end);
-		if (rc < 0)
-			return rc;
-
-		if (machine_is_sapphire()) {
-			if (rt == 0)
-				rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-					REG_READ_MODE,
-					0x046F);
-			else
-				rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-					REG_READ_MODE,
-					0x0027);
-		} else
-			rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-					REG_READ_MODE,
-					mt9t013_regs.reg_pat[rt].read_mode);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_SCALE_M,
-				mt9t013_regs.reg_pat[rt].scale_m);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_X_OUTPUT_SIZE,
-				mt9t013_regs.reg_pat[rt].x_output_size);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_Y_OUTPUT_SIZE,
-				mt9t013_regs.reg_pat[rt].y_output_size);
-		if (rc < 0)
-			return 0;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_LINE_LENGTH_PCK,
-				mt9t013_regs.reg_pat[rt].line_length_pck);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_FRAME_LENGTH_LINES,
-				mt9t013_regs.reg_pat[rt].frame_length_lines);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_COARSE_INT_TIME,
-				mt9t013_regs.reg_pat[rt].coarse_int_time);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_FINE_INT_TIME,
-				mt9t013_regs.reg_pat[rt].fine_int_time);
-		if (rc < 0)
-			return rc;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_GROUPED_PARAMETER_HOLD,
-				GROUPED_PARAMETER_UPDATE);
-			if (rc < 0)
-				return rc;
-
-		/* load lens shading */
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_GROUPED_PARAMETER_HOLD,
-				GROUPED_PARAMETER_HOLD);
-		if (rc < 0)
-			return rc;
-
-		/* most likely needs to be written only once. */
-		rc = mt9t013_set_lc();
-		if (rc < 0)
-			return -EBUSY;
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_GROUPED_PARAMETER_HOLD,
-				GROUPED_PARAMETER_UPDATE);
-		if (rc < 0)
-			return rc;
-
-		rc = mt9t013_test(mt9t013_ctrl->set_test);
-		if (rc < 0)
-			return rc;
-
-		mdelay(5);
-
-		rc =
-			mt9t013_i2c_write_w(mt9t013_client->addr,
-				MT9T013_REG_RESET_REGISTER,
-				MT9T013_RESET_REGISTER_PWON);
-		if (rc < 0)
-			/* MODE_SELECT, stop streaming */
-			return rc;
-
-		CDBG("!!! mt9t013 !!! PowerOn is done!\n");
-		mdelay(5);
-		return rc;
-		}
-	} /* case CAMSENSOR_REG_INIT: */
-	break;
-
-	/*CAMSENSOR_REG_INIT */
-	default:
-		rc = -EINVAL;
-		break;
-	} /* switch (rupdate) */
-
-	return rc;
-}
-
-static int32_t mt9t013_video_config(int mode, int res)
-{
-	int32_t rc;
-
-	switch (res) {
-	case QTR_SIZE:
-		rc = mt9t013_setting(UPDATE_PERIODIC, RES_PREVIEW);
-		if (rc < 0)
-			return rc;
-		CDBG("sensor configuration done!\n");
-		break;
-
-	case FULL_SIZE:
-		rc = mt9t013_setting(UPDATE_PERIODIC, RES_CAPTURE);
-		if (rc < 0)
-			return rc;
-		break;
-
-	default:
-		return -EINVAL;
-	} /* switch */
-
-	mt9t013_ctrl->prev_res = res;
-	mt9t013_ctrl->curr_res = res;
-	mt9t013_ctrl->sensormode = mode;
-
-	rc = mt9t013_write_exp_gain(mt9t013_ctrl->my_reg_gain,
-			mt9t013_ctrl->my_reg_line_count);
-	if (rc < 0)
-		return rc;
-
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-		MT9T013_REG_RESET_REGISTER,
-		MT9T013_RESET_REGISTER_PWON|MT9T013_RESET_FAST_TRANSITION);
-	if (rc < 0)
-		return rc;
-
-	msleep(5);
-	return rc;
-}
-
-static int32_t mt9t013_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-
-	rc = mt9t013_setting(UPDATE_PERIODIC, RES_CAPTURE);
-	if (rc < 0)
-		return rc;
-
-	mt9t013_ctrl->curr_res = mt9t013_ctrl->pict_res;
-	mt9t013_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t mt9t013_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-
-	rc = mt9t013_setting(UPDATE_PERIODIC, RES_CAPTURE);
-	if (rc < 0)
-		return rc;
-
-	mt9t013_ctrl->curr_res = mt9t013_ctrl->pict_res;
-	mt9t013_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t mt9t013_power_down(void)
-{
-	int32_t rc = 0;
-
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-			MT9T013_REG_RESET_REGISTER,
-			MT9T013_RESET_REGISTER_PWOFF);
-	if (rc >= 0)
-		mdelay(5);
-	return rc;
-}
-
-static int32_t mt9t013_move_focus(int direction, int32_t num_steps)
-{
-	int16_t step_direction;
-	int16_t actual_step;
-	int16_t next_position;
-	int16_t break_steps[4];
-	uint8_t code_val_msb, code_val_lsb;
-	int16_t i;
-
-	if (num_steps > MT9T013_TOTAL_STEPS_NEAR_TO_FAR)
-		num_steps = MT9T013_TOTAL_STEPS_NEAR_TO_FAR;
-	else if (num_steps == 0)
-		return -EINVAL;
-
-	if (direction == MOVE_NEAR)
-		step_direction = 4;
-	else if (direction == MOVE_FAR)
-		step_direction = -4;
-	else
-		return -EINVAL;
-
-	if (mt9t013_ctrl->curr_lens_pos < mt9t013_ctrl->init_curr_lens_pos)
-		mt9t013_ctrl->curr_lens_pos = mt9t013_ctrl->init_curr_lens_pos;
-
-	actual_step =
-		(int16_t) (step_direction *
-		(int16_t) num_steps);
-
-	for (i = 0; i < 4; i++)
-		break_steps[i] =
-			actual_step / 4 * (i + 1) - actual_step / 4 * i;
-
-	for (i = 0; i < 4; i++) {
-		next_position =
-		(int16_t)
-		(mt9t013_ctrl->curr_lens_pos + break_steps[i]);
-
-		if (next_position > 255)
-			next_position = 255;
-		else if (next_position < 0)
-			next_position = 0;
-
-		code_val_msb =
-		((next_position >> 4) << 2) |
-		((next_position << 4) >> 6);
-
-		code_val_lsb =
-		((next_position & 0x03) << 6);
-
-		/* Writing the digital code for current to the actuator */
-		if (mt9t013_i2c_write_b(MT9T013_AF_I2C_ADDR>>1,
-				code_val_msb, code_val_lsb) < 0)
-			return -EBUSY;
-
-		/* Storing the current lens Position */
-		mt9t013_ctrl->curr_lens_pos = next_position;
-
-		if (i < 3)
-			mdelay(1);
-	} /* for */
-
-	return 0;
-}
-
-static int mt9t013_sensor_init_done(const struct msm_camera_sensor_info *data)
-{
-	gpio_direction_output(data->sensor_reset, 0);
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int mt9t013_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int rc;
-	uint16_t chipid;
-
-	rc = gpio_request(data->sensor_reset, "mt9t013");
-	if (!rc)
-		gpio_direction_output(data->sensor_reset, 1);
-	else
-		goto init_probe_done;
-
-	mdelay(20);
-
-	/* RESET the sensor image part via I2C command */
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-		MT9T013_REG_RESET_REGISTER, 0x1009);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	msleep(10);
-
-	/* 3. Read sensor Model ID: */
-	rc = mt9t013_i2c_read_w(mt9t013_client->addr,
-		MT9T013_REG_MODEL_ID, &chipid);
-
-	if (rc < 0)
-		goto init_probe_fail;
-
-	CDBG("mt9t013 model_id = 0x%x\n", chipid);
-
-	/* 4. Compare sensor ID to MT9T012VC ID: */
-	if (chipid != MT9T013_MODEL_ID) {
-		rc = -ENODEV;
-		goto init_probe_fail;
-	}
-
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-		0x3064, 0x0805);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	mdelay(MT9T013_RESET_DELAY_MSECS);
-
-	goto init_probe_done;
-
-	/* sensor: output enable */
-#if 0
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-		MT9T013_REG_RESET_REGISTER,
-		MT9T013_RESET_REGISTER_PWON);
-
-	/* if this fails, the sensor is not the MT9T013 */
-	rc = mt9t013_set_default_focus(0);
-#endif
-
-init_probe_fail:
-	gpio_direction_output(data->sensor_reset, 0);
-	gpio_free(data->sensor_reset);
-init_probe_done:
-	return rc;
-}
-
-static int32_t mt9t013_poweron_af(void)
-{
-	int32_t rc = 0;
-
-	/* enable AF actuator */
-	CDBG("enable AF actuator, gpio = %d\n",
-			mt9t013_ctrl->sensordata->vcm_pwd);
-	rc = gpio_request(mt9t013_ctrl->sensordata->vcm_pwd, "mt9t013");
-	if (!rc) {
-		gpio_direction_output(mt9t013_ctrl->sensordata->vcm_pwd, 0);
-		mdelay(20);
-		rc = mt9t013_set_default_focus(0);
-	} else
-		pr_err("%s, gpio_request failed (%d)!\n", __func__, rc);
-	return rc;
-}
-
-static void mt9t013_poweroff_af(void)
-{
-	gpio_direction_output(mt9t013_ctrl->sensordata->vcm_pwd, 1);
-	gpio_free(mt9t013_ctrl->sensordata->vcm_pwd);
-}
-
-int mt9t013_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t  rc;
-
-	mt9t013_ctrl = kzalloc(sizeof(struct mt9t013_ctrl), GFP_KERNEL);
-	if (!mt9t013_ctrl) {
-		pr_err("mt9t013_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-
-	mt9t013_ctrl->fps_divider = 1 * 0x00000400;
-	mt9t013_ctrl->pict_fps_divider = 1 * 0x00000400;
-	mt9t013_ctrl->set_test = TEST_OFF;
-	mt9t013_ctrl->prev_res = QTR_SIZE;
-	mt9t013_ctrl->pict_res = FULL_SIZE;
-
-	if (data)
-		mt9t013_ctrl->sensordata = data;
-
-	/* enable mclk first */
-	msm_camio_clk_rate_set(MT9T013_DEFAULT_CLOCK_RATE);
-	mdelay(20);
-
-	msm_camio_camif_pad_reg_reset();
-	mdelay(20);
-
-	rc = mt9t013_probe_init_sensor(data);
-	if (rc < 0)
-		goto init_fail;
-
-	if (mt9t013_ctrl->prev_res == QTR_SIZE)
-		rc = mt9t013_setting(REG_INIT, RES_PREVIEW);
-	else
-		rc = mt9t013_setting(REG_INIT, RES_CAPTURE);
-
-	if (rc >= 0)
-		if (machine_is_sapphire())
-			rc = mt9t013_poweron_af();
-
-	if (rc < 0)
-		goto init_fail;
-	else
-		goto init_done;
-
-init_fail:
-	kfree(mt9t013_ctrl);
-init_done:
-	return rc;
-}
-
-static int mt9t013_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&mt9t013_wait_queue);
-	return 0;
-}
-
-
-static int32_t mt9t013_set_sensor_mode(int mode, int res)
-{
-	int32_t rc = 0;
-	rc = mt9t013_i2c_write_w(mt9t013_client->addr,
-			REG_GROUPED_PARAMETER_HOLD,
-			GROUPED_PARAMETER_HOLD);
-	if (rc < 0)
-		return rc;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = mt9t013_video_config(mode, res);
-		break;
-
-	case SENSOR_SNAPSHOT_MODE:
-		rc = mt9t013_snapshot_config(mode);
-		break;
-
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = mt9t013_raw_snapshot_config(mode);
-		break;
-
-	default:
-		return -EINVAL;
-	}
-
-	/* FIXME: what should we do if rc < 0? */
-	if (rc >= 0)
-		return mt9t013_i2c_write_w(mt9t013_client->addr,
-				REG_GROUPED_PARAMETER_HOLD,
-				GROUPED_PARAMETER_UPDATE);
-	return rc;
-}
-
-int mt9t013_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-
-	if (copy_from_user(&cdata, (void *)argp,
-			sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-
-	down(&mt9t013_sem);
-
-	CDBG("mt9t013_sensor_config: cfgtype = %d\n", cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		mt9t013_get_pict_fps(cdata.cfg.gfps.prevfps,
-				&(cdata.cfg.gfps.pictfps));
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf = mt9t013_get_prev_lines_pf();
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl = mt9t013_get_prev_pixels_pl();
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf = mt9t013_get_pict_lines_pf();
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl =
-			mt9t013_get_pict_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc =
-			mt9t013_get_pict_max_exp_lc();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = mt9t013_set_fps(&(cdata.cfg.fps));
-		break;
-
-	case CFG_SET_EXP_GAIN:
-		rc = mt9t013_write_exp_gain(cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_PICT_EXP_GAIN:
-		rc = mt9t013_set_pict_exp_gain(cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_MODE:
-		rc = mt9t013_set_sensor_mode(cdata.mode, cdata.rs);
-		break;
-
-	case CFG_PWR_DOWN:
-		rc = mt9t013_power_down();
-		break;
-
-	case CFG_MOVE_FOCUS:
-		rc = mt9t013_move_focus(cdata.cfg.focus.dir,
-				cdata.cfg.focus.steps);
-		break;
-
-	case CFG_SET_DEFAULT_FOCUS:
-		rc = mt9t013_set_default_focus(cdata.cfg.focus.steps);
-		break;
-
-	case CFG_GET_AF_MAX_STEPS:
-		cdata.max_steps = MT9T013_TOTAL_STEPS_NEAR_TO_FAR;
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_SET_EFFECT:
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	up(&mt9t013_sem);
-	return rc;
-}
-
-int mt9t013_sensor_release(void)
-{
-	int rc = -EBADF;
-
-	down(&mt9t013_sem);
-
-	if (machine_is_sapphire())
-		mt9t013_poweroff_af();
-	mt9t013_power_down();
-
-	gpio_direction_output(mt9t013_ctrl->sensordata->sensor_reset,
-			0);
-	gpio_free(mt9t013_ctrl->sensordata->sensor_reset);
-
-	kfree(mt9t013_ctrl);
-
-	up(&mt9t013_sem);
-	CDBG("mt9t013_release completed!\n");
-	return rc;
-}
-
-static int mt9t013_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		rc = -ENOTSUPP;
-		goto probe_failure;
-	}
-
-	mt9t013_sensorw =
-		kzalloc(sizeof(struct mt9t013_work), GFP_KERNEL);
-
-	if (!mt9t013_sensorw) {
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, mt9t013_sensorw);
-	mt9t013_init_client(client);
-	mt9t013_client = client;
-	mt9t013_client->addr = mt9t013_client->addr >> 1;
-	mdelay(50);
-
-	CDBG("i2c probe ok\n");
-	return 0;
-
-probe_failure:
-	kfree(mt9t013_sensorw);
-	mt9t013_sensorw = NULL;
-	pr_err("i2c probe failure %d\n", rc);
-	return rc;
-}
-
-static const struct i2c_device_id mt9t013_i2c_id[] = {
-	{ "mt9t013", 0},
-	{ }
-};
-
-static struct i2c_driver mt9t013_i2c_driver = {
-	.id_table = mt9t013_i2c_id,
-	.probe  = mt9t013_i2c_probe,
-	.remove = __exit_p(mt9t013_i2c_remove),
-	.driver = {
-		.name = "mt9t013",
-	},
-};
-
-static int mt9t013_sensor_probe(
-		const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	/* We expect this driver to match with the i2c device registered
-	 * in the board file immediately. */
-	int rc = i2c_add_driver(&mt9t013_i2c_driver);
-	if (rc < 0 || mt9t013_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_done;
-	}
-
-	/* enable mclk first */
-	msm_camio_clk_rate_set(MT9T013_DEFAULT_CLOCK_RATE);
-	mdelay(20);
-
-	rc = mt9t013_probe_init_sensor(info);
-	if (rc < 0) {
-		i2c_del_driver(&mt9t013_i2c_driver);
-		goto probe_done;
-	}
-
-	s->s_init = mt9t013_sensor_open_init;
-	s->s_release = mt9t013_sensor_release;
-	s->s_config  = mt9t013_sensor_config;
-	s->s_mount_angle = 0;
-	mt9t013_sensor_init_done(info);
-
-probe_done:
-	return rc;
-}
-
-static int __mt9t013_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, mt9t013_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __mt9t013_probe,
-	.driver = {
-		.name = "msm_camera_mt9t013",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init mt9t013_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(mt9t013_init);
diff --git a/drivers/media/video/msm/mt9t013.h b/drivers/media/video/msm/mt9t013.h
deleted file mode 100644
index e2d0c23..0000000
--- a/drivers/media/video/msm/mt9t013.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef MT9T013_H
-#define MT9T013_H
-
-#include <linux/types.h>
-#include <mach/board.h>
-
-extern struct mt9t013_reg mt9t013_regs; /* from mt9t013_reg.c */
-
-struct reg_struct {
-	uint16_t vt_pix_clk_div;        /*  0x0300 */
-	uint16_t vt_sys_clk_div;        /*  0x0302 */
-	uint16_t pre_pll_clk_div;       /*  0x0304 */
-	uint16_t pll_multiplier;        /*  0x0306 */
-	uint16_t op_pix_clk_div;        /*  0x0308 */
-	uint16_t op_sys_clk_div;        /*  0x030A */
-	uint16_t scale_m;               /*  0x0404 */
-	uint16_t row_speed;             /*  0x3016 */
-	uint16_t x_addr_start;          /*  0x3004 */
-	uint16_t x_addr_end;            /*  0x3008 */
-	uint16_t y_addr_start;        	/*  0x3002 */
-	uint16_t y_addr_end;            /*  0x3006 */
-	uint16_t read_mode;             /*  0x3040 */
-	uint16_t x_output_size;         /*  0x034C */
-	uint16_t y_output_size;         /*  0x034E */
-	uint16_t line_length_pck;       /*  0x300C */
-	uint16_t frame_length_lines;	/*  0x300A */
-	uint16_t coarse_int_time; 		/*  0x3012 */
-	uint16_t fine_int_time;   		/*  0x3014 */
-};
-
-struct mt9t013_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-struct mt9t013_reg {
-	struct reg_struct const *reg_pat;
-	uint16_t reg_pat_size;
-	struct mt9t013_i2c_reg_conf const *ttbl;
-	uint16_t ttbl_size;
-	struct mt9t013_i2c_reg_conf const *lctbl;
-	uint16_t lctbl_size;
-	struct mt9t013_i2c_reg_conf const *rftbl;
-	uint16_t rftbl_size;
-};
-
-#endif /* #define MT9T013_H */
diff --git a/drivers/media/video/msm/mt9t013_reg.c b/drivers/media/video/msm/mt9t013_reg.c
deleted file mode 100644
index 9031441..0000000
--- a/drivers/media/video/msm/mt9t013_reg.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "mt9t013.h"
-#include <linux/kernel.h>
-
-struct reg_struct const mt9t013_reg_pat[2] = {
-	{ /* Preview 2x2 binning 20fps, pclk MHz, MCLK 24MHz */
-	/* vt_pix_clk_div:REG=0x0300 update get_snapshot_fps
-	* if this change */
-	8,
-
-	/* vt_sys_clk_div: REG=0x0302  update get_snapshot_fps
-	* if this change */
-	1,
-
-	/* pre_pll_clk_div REG=0x0304  update get_snapshot_fps
-	* if this change */
-	2,
-
-	/* pll_multiplier  REG=0x0306 60 for 30fps preview, 40
-	 * for 20fps preview
-	 * 46 for 30fps preview, try 47/48 to increase further */
-	46,
-
-	/* op_pix_clk_div        REG=0x0308 */
-	8,
-
-	/* op_sys_clk_div        REG=0x030A */
-	1,
-
-	/* scale_m       REG=0x0404 */
-	16,
-
-	/* row_speed     REG=0x3016 */
-	0x0111,
-
-	/* x_addr_start  REG=0x3004 */
-	8,
-
-	/* x_addr_end    REG=0x3008 */
-	2053,
-
-	/* y_addr_start  REG=0x3002 */
-	8,
-
-	/* y_addr_end    REG=0x3006 */
-	1541,
-
-	/* read_mode     REG=0x3040 */
-	0x046C,
-
-	/* x_output_size REG=0x034C */
-	1024,
-
-	/* y_output_size REG=0x034E */
-	768,
-
-	/* line_length_pck    REG=0x300C */
-	2616,
-
-	/* frame_length_lines REG=0x300A */
-	916,
-
-	/* coarse_int_time REG=0x3012 */
-	16,
-
-	/* fine_int_time   REG=0x3014 */
-	1461
-	},
-	{ /*Snapshot */
-	/* vt_pix_clk_div  REG=0x0300 update get_snapshot_fps
-	* if this change */
-	8,
-
-	/* vt_sys_clk_div  REG=0x0302 update get_snapshot_fps
-	* if this change */
-	1,
-
-	/* pre_pll_clk_div REG=0x0304 update get_snapshot_fps
-	 * if this change */
-	2,
-
-	/* pll_multiplier REG=0x0306 50 for 15fps snapshot,
-	 * 40 for 10fps snapshot
-	 * 46 for 30fps snapshot, try 47/48 to increase further */
-	46,
-
-	/* op_pix_clk_div        REG=0x0308 */
-	8,
-
-	/* op_sys_clk_div        REG=0x030A */
-	1,
-
-	/* scale_m       REG=0x0404 */
-	16,
-
-	/* row_speed     REG=0x3016 */
-	0x0111,
-
-	/* x_addr_start  REG=0x3004 */
-	8,
-
-	/* x_addr_end    REG=0x3008 */
-	2071,
-
-	/* y_addr_start  REG=0x3002 */
-	8,
-
-	/* y_addr_end    REG=0x3006 */
-	1551,
-
-	/* read_mode     REG=0x3040 */
-	0x0024,
-
-	/* x_output_size REG=0x034C */
-	2064,
-
-	/* y_output_size REG=0x034E */
-	1544,
-
-	/* line_length_pck REG=0x300C */
-	2952,
-
-	/* frame_length_lines    REG=0x300A */
-	1629,
-
-	/* coarse_int_time REG=0x3012 */
-	16,
-
-	/* fine_int_time REG=0x3014   */
-	733
-	}
-};
-
-struct mt9t013_i2c_reg_conf const mt9t013_test_tbl[] = {
-	{ 0x3044, 0x0544 & 0xFBFF },
-	{ 0x30CA, 0x0004 | 0x0001 },
-	{ 0x30D4, 0x9020 & 0x7FFF },
-	{ 0x31E0, 0x0003 & 0xFFFE },
-	{ 0x3180, 0x91FF & 0x7FFF },
-	{ 0x301A, (0x10CC | 0x8000) & 0xFFF7 },
-	{ 0x301E, 0x0000 },
-	{ 0x3780, 0x0000 },
-};
-
-/* [Lens shading 85 Percent TL84] */
-struct mt9t013_i2c_reg_conf const mt9t013_lc_tbl[] = {
-	{ 0x360A, 0x0290 }, /* P_RD_P0Q0 */
-	{ 0x360C, 0xC92D }, /* P_RD_P0Q1 */
-	{ 0x360E, 0x0771 }, /* P_RD_P0Q2 */
-	{ 0x3610, 0xE38C }, /* P_RD_P0Q3 */
-	{ 0x3612, 0xD74F }, /* P_RD_P0Q4 */
-	{ 0x364A, 0x168C }, /* P_RD_P1Q0 */
-	{ 0x364C, 0xCACB }, /* P_RD_P1Q1 */
-	{ 0x364E, 0x8C4C }, /* P_RD_P1Q2 */
-	{ 0x3650, 0x0BEA }, /* P_RD_P1Q3 */
-	{ 0x3652, 0xDC0F }, /* P_RD_P1Q4 */
-	{ 0x368A, 0x70B0 }, /* P_RD_P2Q0 */
-	{ 0x368C, 0x200B }, /* P_RD_P2Q1 */
-	{ 0x368E, 0x30B2 }, /* P_RD_P2Q2 */
-	{ 0x3690, 0xD04F }, /* P_RD_P2Q3 */
-	{ 0x3692, 0xACF5 }, /* P_RD_P2Q4 */
-	{ 0x36CA, 0xF7C9 }, /* P_RD_P3Q0 */
-	{ 0x36CC, 0x2AED }, /* P_RD_P3Q1 */
-	{ 0x36CE, 0xA652 }, /* P_RD_P3Q2 */
-	{ 0x36D0, 0x8192 }, /* P_RD_P3Q3 */
-	{ 0x36D2, 0x3A15 }, /* P_RD_P3Q4 */
-	{ 0x370A, 0xDA30 }, /* P_RD_P4Q0 */
-	{ 0x370C, 0x2E2F }, /* P_RD_P4Q1 */
-	{ 0x370E, 0xBB56 }, /* P_RD_P4Q2 */
-	{ 0x3710, 0x8195 }, /* P_RD_P4Q3 */
-	{ 0x3712, 0x02F9 }, /* P_RD_P4Q4 */
-	{ 0x3600, 0x0230 }, /* P_GR_P0Q0 */
-	{ 0x3602, 0x58AD }, /* P_GR_P0Q1 */
-	{ 0x3604, 0x18D1 }, /* P_GR_P0Q2 */
-	{ 0x3606, 0x260D }, /* P_GR_P0Q3 */
-	{ 0x3608, 0xF530 }, /* P_GR_P0Q4 */
-	{ 0x3640, 0x17EB }, /* P_GR_P1Q0 */
-	{ 0x3642, 0x3CAB }, /* P_GR_P1Q1 */
-	{ 0x3644, 0x87CE }, /* P_GR_P1Q2 */
-	{ 0x3646, 0xC02E }, /* P_GR_P1Q3 */
-	{ 0x3648, 0xF48F }, /* P_GR_P1Q4 */
-	{ 0x3680, 0x5350 }, /* P_GR_P2Q0 */
-	{ 0x3682, 0x7EAF }, /* P_GR_P2Q1 */
-	{ 0x3684, 0x4312 }, /* P_GR_P2Q2 */
-	{ 0x3686, 0xC652 }, /* P_GR_P2Q3 */
-	{ 0x3688, 0xBC15 }, /* P_GR_P2Q4 */
-	{ 0x36C0, 0xB8AD }, /* P_GR_P3Q0 */
-	{ 0x36C2, 0xBDCD }, /* P_GR_P3Q1 */
-	{ 0x36C4, 0xE4B2 }, /* P_GR_P3Q2 */
-	{ 0x36C6, 0xB50F }, /* P_GR_P3Q3 */
-	{ 0x36C8, 0x5B95 }, /* P_GR_P3Q4 */
-	{ 0x3700, 0xFC90 }, /* P_GR_P4Q0 */
-	{ 0x3702, 0x8C51 }, /* P_GR_P4Q1 */
-	{ 0x3704, 0xCED6 }, /* P_GR_P4Q2 */
-	{ 0x3706, 0xB594 }, /* P_GR_P4Q3 */
-	{ 0x3708, 0x0A39 }, /* P_GR_P4Q4 */
-	{ 0x3614, 0x0230 }, /* P_BL_P0Q0 */
-	{ 0x3616, 0x160D }, /* P_BL_P0Q1 */
-	{ 0x3618, 0x08D1 }, /* P_BL_P0Q2 */
-	{ 0x361A, 0x98AB }, /* P_BL_P0Q3 */
-	{ 0x361C, 0xEA50 }, /* P_BL_P0Q4 */
-	{ 0x3654, 0xB4EA }, /* P_BL_P1Q0 */
-	{ 0x3656, 0xEA6C }, /* P_BL_P1Q1 */
-	{ 0x3658, 0xFE08 }, /* P_BL_P1Q2 */
-	{ 0x365A, 0x2C6E }, /* P_BL_P1Q3 */
-	{ 0x365C, 0xEB0E }, /* P_BL_P1Q4 */
-	{ 0x3694, 0x6DF0 }, /* P_BL_P2Q0 */
-	{ 0x3696, 0x3ACF }, /* P_BL_P2Q1 */
-	{ 0x3698, 0x3E0F }, /* P_BL_P2Q2 */
-	{ 0x369A, 0xB2B1 }, /* P_BL_P2Q3 */
-	{ 0x369C, 0xC374 }, /* P_BL_P2Q4 */
-	{ 0x36D4, 0xF2AA }, /* P_BL_P3Q0 */
-	{ 0x36D6, 0x8CCC }, /* P_BL_P3Q1 */
-	{ 0x36D8, 0xDEF2 }, /* P_BL_P3Q2 */
-	{ 0x36DA, 0xFA11 }, /* P_BL_P3Q3 */
-	{ 0x36DC, 0x42F5 }, /* P_BL_P3Q4 */
-	{ 0x3714, 0xF4F1 }, /* P_BL_P4Q0 */
-	{ 0x3716, 0xF6F0 }, /* P_BL_P4Q1 */
-	{ 0x3718, 0x8FD6 }, /* P_BL_P4Q2 */
-	{ 0x371A, 0xEA14 }, /* P_BL_P4Q3 */
-	{ 0x371C, 0x6338 }, /* P_BL_P4Q4 */
-	{ 0x361E, 0x0350 }, /* P_GB_P0Q0 */
-	{ 0x3620, 0x91AE }, /* P_GB_P0Q1 */
-	{ 0x3622, 0x0571 }, /* P_GB_P0Q2 */
-	{ 0x3624, 0x100D }, /* P_GB_P0Q3 */
-	{ 0x3626, 0xCA70 }, /* P_GB_P0Q4 */
-	{ 0x365E, 0xE6CB }, /* P_GB_P1Q0 */
-	{ 0x3660, 0x50ED }, /* P_GB_P1Q1 */
-	{ 0x3662, 0x3DAE }, /* P_GB_P1Q2 */
-	{ 0x3664, 0xAA4F }, /* P_GB_P1Q3 */
-	{ 0x3666, 0xDC50 }, /* P_GB_P1Q4 */
-	{ 0x369E, 0x5470 }, /* P_GB_P2Q0 */
-	{ 0x36A0, 0x1F6E }, /* P_GB_P2Q1 */
-	{ 0x36A2, 0x6671 }, /* P_GB_P2Q2 */
-	{ 0x36A4, 0xC010 }, /* P_GB_P2Q3 */
-	{ 0x36A6, 0x8DF5 }, /* P_GB_P2Q4 */
-	{ 0x36DE, 0x0B0C }, /* P_GB_P3Q0 */
-	{ 0x36E0, 0x84CE }, /* P_GB_P3Q1 */
-	{ 0x36E2, 0x8493 }, /* P_GB_P3Q2 */
-	{ 0x36E4, 0xA610 }, /* P_GB_P3Q3 */
-	{ 0x36E6, 0x50B5 }, /* P_GB_P3Q4 */
-	{ 0x371E, 0x9651 }, /* P_GB_P4Q0 */
-	{ 0x3720, 0x1EAB }, /* P_GB_P4Q1 */
-	{ 0x3722, 0xAF76 }, /* P_GB_P4Q2 */
-	{ 0x3724, 0xE4F4 }, /* P_GB_P4Q3 */
-	{ 0x3726, 0x79F8 }, /* P_GB_P4Q4 */
-	{ 0x3782, 0x0410 }, /* POLY_ORIGIN_C */
-	{ 0x3784, 0x0320 }, /* POLY_ORIGIN_R  */
-	{ 0x3780, 0x8000 } /* POLY_SC_ENABLE */
-};
-
-struct mt9t013_reg mt9t013_regs = {
-	.reg_pat = &mt9t013_reg_pat[0],
-	.reg_pat_size = ARRAY_SIZE(mt9t013_reg_pat),
-	.ttbl = &mt9t013_test_tbl[0],
-	.ttbl_size = ARRAY_SIZE(mt9t013_test_tbl),
-	.lctbl = &mt9t013_lc_tbl[0],
-	.lctbl_size = ARRAY_SIZE(mt9t013_lc_tbl),
-	.rftbl = &mt9t013_lc_tbl[0],	/* &mt9t013_rolloff_tbl[0], */
-	.rftbl_size = ARRAY_SIZE(mt9t013_lc_tbl)
-};
-
-
diff --git a/drivers/media/video/msm/ov5640.c b/drivers/media/video/msm/ov5640.c
deleted file mode 100644
index 8441a46..0000000
--- a/drivers/media/video/msm/ov5640.c
+++ /dev/null
@@ -1,1477 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-/* #define DEBUG */
-
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/leds.h>
-#include <linux/slab.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include "ov5640.h"
-
-#define FALSE 0
-#define TRUE 1
-
-struct ov5640_work {
-	struct work_struct work;
-};
-
-struct __ov5640_ctrl {
-	const struct msm_camera_sensor_info *sensordata;
-	int sensormode;
-	uint fps_divider; /* init to 1 * 0x00000400 */
-	uint pict_fps_divider; /* init to 1 * 0x00000400 */
-	u16 curr_step_pos;
-	u16 curr_lens_pos;
-	u16 init_curr_lens_pos;
-	u16 my_reg_gain;
-	u16 my_reg_line_count;
-	enum msm_s_resolution prev_res;
-	enum msm_s_resolution pict_res;
-	enum msm_s_resolution curr_res;
-	enum msm_s_test_mode  set_test;
-};
-
-static DECLARE_WAIT_QUEUE_HEAD(ov5640_wait_queue);
-DEFINE_MUTEX(ov5640_mutex);
-
-static int ov5640_pwdn_gpio;
-static int ov5640_reset_gpio;
-static int ov5640_driver_pwdn_gpio;
-static int OV5640_CSI_CONFIG;
-static struct ov5640_work *ov5640_sensorw;
-static struct i2c_client    *ov5640_client;
-static u8 ov5640_i2c_buf[4];
-static u8 ov5640_counter;
-static int16_t ov5640_effect;
-static int is_autoflash;
-static int effect_value;
-unsigned int ov5640_SAT_U = 0x40;
-unsigned int ov5640_SAT_V = 0x40;
-
-static struct __ov5640_ctrl *ov5640_ctrl;
-static int ov5640_afinit = 1;
-
-struct rw_semaphore ov_leds_list_lock;
-struct list_head ov_leds_list;
-
-static int ov5640_i2c_remove(struct i2c_client *client);
-static int ov5640_i2c_probe(struct i2c_client *client,
-		const struct i2c_device_id *id);
-
-static int ov5640_i2c_txdata(u16 saddr, u8 *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr	= saddr,
-			.flags	= 0,
-			.len	= length,
-			.buf	= txdata,
-		},
-	};
-
-	if (i2c_transfer(ov5640_client->adapter, msg, 1) < 0)
-		return -EIO;
-	else
-		return 0;
-}
-
-static int ov5640_i2c_write(unsigned short saddr, unsigned int waddr,
-		unsigned short bdata, u8 trytimes)
-{
-	int rc = -EIO;
-
-	ov5640_counter = 0;
-	ov5640_i2c_buf[0] = (waddr & 0xFF00) >> 8;
-	ov5640_i2c_buf[1] = (waddr & 0x00FF);
-	ov5640_i2c_buf[2] = (bdata & 0x00FF);
-
-	while ((ov5640_counter < trytimes) && (rc != 0)) {
-		rc = ov5640_i2c_txdata(saddr, ov5640_i2c_buf, 3);
-
-		if (rc < 0) {
-			ov5640_counter++;
-			CDBG("***--CAMERA i2c_write_w failed,i2c addr=0x%x,"
-				"command addr = 0x%x, val = 0x%x,s=%d,"
-					"rc=%d!\n", saddr, waddr, bdata,
-					ov5640_counter, rc);
-			msleep(20);
-		}
-	}
-	return rc;
-}
-
-static int ov5640_i2c_rxdata(unsigned short saddr, unsigned char *rxdata,
-		int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr	= saddr,
-			.flags	= 0,
-			.len	= 2,
-			.buf	= rxdata,
-		},
-		{
-			.addr	= saddr,
-			.flags	= I2C_M_RD,
-			.len	= length,
-			.buf	= rxdata,
-		},
-	};
-
-	if (i2c_transfer(ov5640_client->adapter, msgs, 2) < 0) {
-		CDBG("ov5640_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t ov5640_i2c_read_byte(unsigned short  saddr,
-		unsigned int raddr, unsigned int *rdata)
-{
-	int rc = 0;
-	unsigned char buf[2];
-
-	memset(buf, 0, sizeof(buf));
-
-	buf[0] = (raddr & 0xFF00)>>8;
-	buf[1] = (raddr & 0x00FF);
-
-	rc = ov5640_i2c_rxdata(saddr, buf, 1);
-	if (rc < 0) {
-		CDBG("ov5640_i2c_read_byte failed!\n");
-		return rc;
-	}
-
-	*rdata = buf[0];
-
-	return rc;
-}
-
-static int32_t ov5640_writepregs(struct ov5640_sensor *ptb, int32_t len)
-{
-	int32_t i, ret = 0;
-	uint32_t regv;
-
-	for (i = 0; i < len; i++) {
-		if (0 == ptb[i].mask) {
-			ov5640_i2c_write(ov5640_client->addr, ptb[i].addr,
-					ptb[i].data, 10);
-		} else {
-			ov5640_i2c_read_byte(ov5640_client->addr, ptb[i].addr,
-					&regv);
-			regv &= ptb[i].mask;
-			regv |= (ptb[i].data & (~ptb[i].mask));
-			ov5640_i2c_write(ov5640_client->addr, ptb[i].addr,
-					regv, 10);
-		}
-	}
-	return ret;
-}
-
-static void camera_sw_power_onoff(int v)
-{
-	if (v == 0) {
-		CDBG("camera_sw_power_onoff: down\n");
-		ov5640_i2c_write(ov5640_client->addr, 0x3008, 0x42, 10);
-	} else {
-		CDBG("camera_sw_power_onoff: on\n");
-		ov5640_i2c_write(ov5640_client->addr, 0x3008, 0x02, 10);
-	}
-}
-
-static void ov5640_power_off(void)
-{
-	CDBG("--CAMERA-- %s ... (Start...)\n", __func__);
-	gpio_set_value(ov5640_pwdn_gpio, 1);
-	CDBG("--CAMERA-- %s ... (End...)\n", __func__);
-}
-
-static void ov5640_power_on(void)
-{
-	CDBG("--CAMERA-- %s ... (Start...)\n", __func__);
-	gpio_set_value(ov5640_pwdn_gpio, 0);
-	CDBG("--CAMERA-- %s ... (End...)\n", __func__);
-}
-
-static void ov5640_power_reset(void)
-{
-	CDBG("--CAMERA-- %s ... (Start...)\n", __func__);
-	gpio_set_value(ov5640_reset_gpio, 1);   /* reset camera reset pin */
-	msleep(20);
-	gpio_set_value(ov5640_reset_gpio, 0);
-	msleep(20);
-	gpio_set_value(ov5640_reset_gpio, 1);
-	msleep(20);
-
-	CDBG("--CAMERA-- %s ... (End...)\n", __func__);
-}
-
-static int ov5640_probe_readID(const struct msm_camera_sensor_info *data)
-{
-	int rc = 0;
-	u32 device_id_high = 0;
-	u32 device_id_low = 0;
-
-	CDBG("--CAMERA-- %s (Start...)\n", __func__);
-	CDBG("--CAMERA-- %s sensor poweron,begin to read ID!\n", __func__);
-
-	/* 0x300A ,sensor ID register */
-	rc = ov5640_i2c_read_byte(ov5640_client->addr, 0x300A,
-			&device_id_high);
-
-	if (rc < 0) {
-		CDBG("--CAMERA-- %s ok , readI2C failed, rc = 0x%x\r\n",
-				__func__, rc);
-		return rc;
-	}
-	CDBG("--CAMERA-- %s  readID high byte, data = 0x%x\r\n",
-			__func__, device_id_high);
-
-	/* 0x300B ,sensor ID register */
-	rc = ov5640_i2c_read_byte(ov5640_client->addr, 0x300B,
-			&device_id_low);
-	if (rc < 0) {
-		CDBG("--CAMERA-- %s ok , readI2C failed,rc = 0x%x\r\n",
-				__func__, rc);
-		return rc;
-	}
-
-	CDBG("--CAMERA-- %s  readID low byte, data = 0x%x\r\n",
-			__func__, device_id_low);
-	CDBG("--CAMERA-- %s return ID :0x%x\n", __func__,
-			(device_id_high << 8) + device_id_low);
-
-	/* 0x5640, ov5640 chip id */
-	if ((device_id_high << 8) + device_id_low != OV5640_SENSOR_ID) {
-		CDBG("--CAMERA-- %s ok , device id error, should be 0x%x\r\n",
-				__func__, OV5640_SENSOR_ID);
-		return -EINVAL;
-	} else {
-		CDBG("--CAMERA-- %s ok , device id=0x%x\n", __func__,
-				OV5640_SENSOR_ID);
-		return 0;
-	}
-}
-
-static int ov5640_af_setting(void)
-{
-	int rc = 0;
-	int lens = sizeof(ov5640_afinit_tbl) / sizeof(ov5640_afinit_tbl[0]);
-
-	CDBG("--CAMERA-- ov5640_af_setting\n");
-
-	ov5640_i2c_write(ov5640_client->addr, 0x3000, 0x20, 10);
-
-	rc = ov5640_i2c_txdata(ov5640_client->addr, ov5640_afinit_tbl, lens);
-	if (rc < 0) {
-		CDBG("--CAMERA-- AF_init failed\n");
-		return rc;
-	}
-
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_MAIN, 0x00, 10);
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_ACK, 0x00, 10);
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_PARA0, 0x00, 10);
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_PARA1, 0x00, 10);
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_PARA2, 0x00, 10);
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_PARA3, 0x00, 10);
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_PARA4, 0x00, 10);
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_FW_STATUS, 0x7f, 10);
-	ov5640_i2c_write(ov5640_client->addr, 0x3000, 0x00, 10);
-
-	return rc;
-}
-
-static int ov5640_set_flash_light(enum led_brightness brightness)
-{
-	struct led_classdev *led_cdev;
-
-	CDBG("ov5640_set_flash_light brightness = %d\n", brightness);
-
-	down_read(&ov_leds_list_lock);
-	list_for_each_entry(led_cdev, &ov_leds_list, node) {
-		if (!strncmp(led_cdev->name, "flashlight", 10))
-			break;
-	}
-	up_read(&ov_leds_list_lock);
-
-	if (led_cdev) {
-		led_brightness_set(led_cdev, brightness);
-	} else {
-		CDBG("get flashlight device failed\n");
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static int ov5640_video_config(void)
-{
-	int rc = 0;
-
-	CDBG("--CAMERA-- ov5640_video_config\n");
-	CDBG("--CAMERA-- preview in, is_autoflash - 0x%x\n", is_autoflash);
-
-	/* autoflash setting */
-	if (is_autoflash == 1)
-		ov5640_set_flash_light(LED_OFF);
-
-	/* preview setting */
-	rc = OV5640CORE_WRITEPREG(ov5640_preview_tbl);
-	return rc;
-}
-
-static int ov5640_snapshot_config(void)
-{
-	int rc = 0;
-	unsigned int tmp;
-
-	CDBG("--CAMERA-- SENSOR_SNAPSHOT_MODE\n");
-	CDBG("--CAMERA-- %s, snapshot in, is_autoflash - 0x%x\n", __func__,
-			is_autoflash);
-
-	if (is_autoflash == 1) {
-		ov5640_i2c_read_byte(ov5640_client->addr, 0x350b, &tmp);
-		CDBG("--CAMERA-- GAIN VALUE : %x\n", tmp);
-		if ((tmp & 0x80) == 0)
-			ov5640_set_flash_light(LED_OFF);
-		else
-			ov5640_set_flash_light(LED_FULL);
-	}
-
-	rc = OV5640CORE_WRITEPREG(ov5640_capture_tbl);
-
-	return rc;
-}
-
-static int ov5640_setting(enum msm_s_reg_update rupdate,
-		enum msm_s_setting rt)
-{
-	int rc = -EINVAL, tmp;
-	struct msm_camera_csi_params ov5640_csi_params;
-
-	CDBG("--CAMERA-- %s (Start...), rupdate=%d\n", __func__, rupdate);
-
-	switch (rupdate) {
-	case S_UPDATE_PERIODIC:
-		if (!OV5640_CSI_CONFIG) {
-			camera_sw_power_onoff(0); /* standby */
-			msleep(20);
-
-			ov5640_csi_params.lane_cnt = 2;
-			ov5640_csi_params.data_format = CSI_8BIT;
-			ov5640_csi_params.lane_assign = 0xe4;
-			ov5640_csi_params.dpcm_scheme = 0;
-			ov5640_csi_params.settle_cnt = 0x6;
-
-			CDBG("%s: msm_camio_csi_config\n", __func__);
-
-			rc = msm_camio_csi_config(&ov5640_csi_params);
-			msleep(20);
-			camera_sw_power_onoff(1); /* on */
-			msleep(20);
-
-			OV5640_CSI_CONFIG = 1;
-
-		} else {
-			rc = 0;
-		}
-
-		if (S_RES_PREVIEW == rt)
-			rc = ov5640_video_config();
-		else if (S_RES_CAPTURE == rt)
-			rc = ov5640_snapshot_config();
-
-		break; /* UPDATE_PERIODIC */
-
-	case S_REG_INIT:
-		CDBG("--CAMERA-- S_REG_INIT (Start)\n");
-
-		rc = ov5640_i2c_write(ov5640_client->addr, 0x3103, 0x11, 10);
-		rc = ov5640_i2c_write(ov5640_client->addr, 0x3008, 0x82, 10);
-		msleep(20);
-
-		/* set sensor init setting */
-		CDBG("set sensor init setting\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_init_tbl);
-		if (rc < 0) {
-			CDBG("sensor init setting failed\n");
-			break;
-		}
-
-		/* set image quality setting */
-		rc = OV5640CORE_WRITEPREG(ov5640_init_iq_tbl);
-		rc = ov5640_i2c_read_byte(ov5640_client->addr, 0x4740, &tmp);
-		CDBG("--CAMERA-- init 0x4740 value=0x%x\n", tmp);
-
-		if (tmp != 0x21) {
-			rc = ov5640_i2c_write(ov5640_client->addr, 0x4740,
-					0x21, 10);
-			msleep(20);
-			rc = ov5640_i2c_read_byte(ov5640_client->addr,
-					0x4740, &tmp);
-			CDBG("--CAMERA-- WG 0x4740 value=0x%x\n", tmp);
-		}
-
-		CDBG("--CAMERA-- AF_init: ov5640_afinit = %d\n",
-				ov5640_afinit);
-		if (ov5640_afinit == 1) {
-			rc = ov5640_af_setting();
-			if (rc < 0) {
-				CDBG("--CAMERA-- ov5640_af_setting failed\n");
-				break;
-			}
-			ov5640_afinit = 0;
-		}
-
-		/* reset fps_divider */
-		ov5640_ctrl->fps_divider = 1 * 0x0400;
-		CDBG("--CAMERA-- S_REG_INIT (End)\n");
-		break; /* case REG_INIT: */
-
-	default:
-		break;
-	} /* switch (rupdate) */
-
-	CDBG("--CAMERA-- %s (End), rupdate=%d\n", __func__, rupdate);
-
-	return rc;
-}
-
-static int ov5640_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int rc = -ENOMEM;
-
-	CDBG("--CAMERA-- %s\n", __func__);
-	ov5640_ctrl = kzalloc(sizeof(struct __ov5640_ctrl), GFP_KERNEL);
-	if (!ov5640_ctrl) {
-		CDBG("--CAMERA-- kzalloc ov5640_ctrl error !!\n");
-		kfree(ov5640_ctrl);
-		return rc;
-	}
-
-	ov5640_ctrl->fps_divider = 1 * 0x00000400;
-	ov5640_ctrl->pict_fps_divider = 1 * 0x00000400;
-	ov5640_ctrl->set_test = S_TEST_OFF;
-	ov5640_ctrl->prev_res = S_QTR_SIZE;
-	ov5640_ctrl->pict_res = S_FULL_SIZE;
-
-	if (data)
-		ov5640_ctrl->sensordata = data;
-
-	ov5640_power_off();
-
-	CDBG("%s: msm_camio_clk_rate_set\n", __func__);
-
-	msm_camio_clk_rate_set(24000000);
-	msleep(20);
-
-	ov5640_power_on();
-	ov5640_power_reset();
-
-	CDBG("%s: init sequence\n", __func__);
-
-	if (ov5640_ctrl->prev_res == S_QTR_SIZE)
-		rc = ov5640_setting(S_REG_INIT, S_RES_PREVIEW);
-	else
-		rc = ov5640_setting(S_REG_INIT, S_RES_CAPTURE);
-
-	if (rc < 0) {
-		CDBG("--CAMERA-- %s : ov5640_setting failed. rc = %d\n",
-				__func__, rc);
-		kfree(ov5640_ctrl);
-		return rc;
-	}
-
-	OV5640_CSI_CONFIG = 0;
-
-	CDBG("--CAMERA--re_init_sensor ok!!\n");
-	return rc;
-}
-
-static int ov5640_sensor_release(void)
-{
-	CDBG("--CAMERA--ov5640_sensor_release!!\n");
-
-	mutex_lock(&ov5640_mutex);
-
-	ov5640_power_off();
-
-	kfree(ov5640_ctrl);
-	ov5640_ctrl = NULL;
-
-	OV5640_CSI_CONFIG = 0;
-
-	mutex_unlock(&ov5640_mutex);
-	return 0;
-}
-
-static const struct i2c_device_id ov5640_i2c_id[] = {
-	{"ov5640",  0}, {}
-};
-
-static int ov5640_i2c_remove(struct i2c_client *client)
-{
-	return 0;
-}
-
-static int ov5640_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&ov5640_wait_queue);
-	return 0;
-}
-
-static long ov5640_set_effect(int mode, int effect)
-{
-	int rc = 0;
-
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		/* Context A Special Effects */
-		CDBG("--CAMERA-- %s ...SENSOR_PREVIEW_MODE\n", __func__);
-		break;
-
-	case SENSOR_SNAPSHOT_MODE:
-		/* Context B Special Effects */
-		CDBG("--CAMERA-- %s ...SENSOR_SNAPSHOT_MODE\n", __func__);
-		break;
-
-	default:
-		break;
-	}
-
-	effect_value = effect;
-
-	switch (effect)	{
-	case CAMERA_EFFECT_OFF:
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_OFF\n", __func__);
-		rc = OV5640CORE_WRITEPREG(ov5640_effect_normal_tbl);
-		/* for recover saturation level when change special effect */
-		ov5640_i2c_write(ov5640_client->addr, 0x5583, ov5640_SAT_U,
-				10);
-		/* for recover saturation level when change special effect */
-		ov5640_i2c_write(ov5640_client->addr, 0x5584, ov5640_SAT_V,
-				10);
-		break;
-
-	case CAMERA_EFFECT_MONO:
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_MONO\n", __func__);
-		rc = OV5640CORE_WRITEPREG(ov5640_effect_mono_tbl);
-		break;
-
-	case CAMERA_EFFECT_BW:
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_BW\n", __func__);
-		rc = OV5640CORE_WRITEPREG(ov5640_effect_bw_tbl);
-		break;
-
-	case CAMERA_EFFECT_BLUISH:
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_BLUISH\n", __func__);
-		rc = OV5640CORE_WRITEPREG(ov5640_effect_bluish_tbl);
-		break;
-
-	case CAMERA_EFFECT_SOLARIZE:
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_NEGATIVE\n", __func__);
-		rc = OV5640CORE_WRITEPREG(ov5640_effect_solarize_tbl);
-		break;
-
-	case CAMERA_EFFECT_SEPIA:
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_SEPIA\n", __func__);
-		rc = OV5640CORE_WRITEPREG(ov5640_effect_sepia_tbl);
-		break;
-
-	case CAMERA_EFFECT_REDDISH:
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_REDDISH\n", __func__);
-		rc = OV5640CORE_WRITEPREG(ov5640_effect_reddish_tbl);
-		break;
-
-	case CAMERA_EFFECT_GREENISH:
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_GREENISH\n", __func__);
-		rc = OV5640CORE_WRITEPREG(ov5640_effect_greenish_tbl);
-		break;
-
-	case CAMERA_EFFECT_NEGATIVE:
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_NEGATIVE\n", __func__);
-		rc = OV5640CORE_WRITEPREG(ov5640_effect_negative_tbl);
-		break;
-
-	default:
-		CDBG("--CAMERA-- %s ...Default(Not Support)\n", __func__);
-	}
-
-	ov5640_effect = effect;
-	/* Refresh Sequencer */
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static int ov5640_set_brightness(int8_t brightness)
-{
-	int rc = 0;
-
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-	CDBG("--CAMERA-- %s ...brightness = %d\n", __func__ , brightness);
-
-	switch (brightness) {
-	case CAMERA_BRIGHTNESS_LV0:
-		CDBG("--CAMERA--CAMERA_BRIGHTNESS_LV0\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_brightness_lv0_tbl);
-		break;
-
-	case CAMERA_BRIGHTNESS_LV1:
-		CDBG("--CAMERA--CAMERA_BRIGHTNESS_LV1\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_brightness_lv1_tbl);
-		break;
-
-	case CAMERA_BRIGHTNESS_LV2:
-		CDBG("--CAMERA--CAMERA_BRIGHTNESS_LV2\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_brightness_lv2_tbl);
-		break;
-
-	case CAMERA_BRIGHTNESS_LV3:
-		CDBG("--CAMERA--CAMERA_BRIGHTNESS_LV3\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_brightness_lv3_tbl);
-		break;
-
-	case CAMERA_BRIGHTNESS_LV4:
-		CDBG("--CAMERA--CAMERA_BRIGHTNESS_LV4\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_brightness_default_lv4_tbl);
-		break;
-
-	case CAMERA_BRIGHTNESS_LV5:
-		CDBG("--CAMERA--CAMERA_BRIGHTNESS_LV5\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_brightness_lv5_tbl);
-		break;
-
-	case CAMERA_BRIGHTNESS_LV6:
-		CDBG("--CAMERA--CAMERA_BRIGHTNESS_LV6\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_brightness_lv6_tbl);
-		break;
-
-	case CAMERA_BRIGHTNESS_LV7:
-		CDBG("--CAMERA--CAMERA_BRIGHTNESS_LV7\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_brightness_lv7_tbl);
-		break;
-
-	case CAMERA_BRIGHTNESS_LV8:
-		CDBG("--CAMERA--CAMERA_BRIGHTNESS_LV8\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_brightness_lv8_tbl);
-		break;
-
-	default:
-		CDBG("--CAMERA--CAMERA_BRIGHTNESS_ERROR COMMAND\n");
-		break;
-	}
-
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static int ov5640_set_contrast(int contrast)
-{
-	int rc = 0;
-
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-	CDBG("--CAMERA-- %s ...contrast = %d\n", __func__ , contrast);
-
-	if (effect_value == CAMERA_EFFECT_OFF) {
-		switch (contrast) {
-		case CAMERA_CONTRAST_LV0:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV0\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_contrast_lv0_tbl);
-			break;
-
-		case CAMERA_CONTRAST_LV1:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV1\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_contrast_lv1_tbl);
-			break;
-
-		case CAMERA_CONTRAST_LV2:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV2\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_contrast_lv2_tbl);
-			break;
-
-		case CAMERA_CONTRAST_LV3:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV3\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_contrast_lv3_tbl);
-			break;
-
-		case CAMERA_CONTRAST_LV4:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV4\n");
-			rc = OV5640CORE_WRITEPREG(
-					ov5640_contrast_default_lv4_tbl);
-			break;
-
-		case CAMERA_CONTRAST_LV5:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV5\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_contrast_lv5_tbl);
-			break;
-
-		case CAMERA_CONTRAST_LV6:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV6\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_contrast_lv6_tbl);
-			break;
-
-		case CAMERA_CONTRAST_LV7:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV7\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_contrast_lv7_tbl);
-			break;
-
-		case CAMERA_CONTRAST_LV8:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV8\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_contrast_lv8_tbl);
-			break;
-
-		default:
-			CDBG("--CAMERA--CAMERA_CONTRAST_ERROR COMMAND\n");
-			break;
-		}
-	}
-
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static int ov5640_set_sharpness(int sharpness)
-{
-	int rc = 0;
-
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-	CDBG("--CAMERA-- %s ...sharpness = %d\n", __func__ , sharpness);
-
-	if (effect_value == CAMERA_EFFECT_OFF) {
-		switch (sharpness) {
-		case CAMERA_SHARPNESS_LV0:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV0\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_sharpness_lv0_tbl);
-			break;
-
-		case CAMERA_SHARPNESS_LV1:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV1\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_sharpness_lv1_tbl);
-			break;
-
-		case CAMERA_SHARPNESS_LV2:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV2\n");
-			rc = OV5640CORE_WRITEPREG(
-					ov5640_sharpness_default_lv2_tbl);
-			break;
-
-		case CAMERA_SHARPNESS_LV3:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV3\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_sharpness_lv3_tbl);
-			break;
-
-		case CAMERA_SHARPNESS_LV4:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV4\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_sharpness_lv4_tbl);
-			break;
-
-		case CAMERA_SHARPNESS_LV5:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV5\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_sharpness_lv5_tbl);
-			break;
-
-		case CAMERA_SHARPNESS_LV6:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV6\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_sharpness_lv6_tbl);
-			break;
-
-		case CAMERA_SHARPNESS_LV7:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV7\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_sharpness_lv7_tbl);
-			break;
-
-		case CAMERA_SHARPNESS_LV8:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV8\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_sharpness_lv8_tbl);
-			break;
-
-		default:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_ERROR COMMAND\n");
-			break;
-		}
-	}
-
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static int ov5640_set_saturation(int saturation)
-{
-	long rc = 0;
-
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-	CDBG("--CAMERA-- %s ...saturation = %d\n", __func__ , saturation);
-
-	if (effect_value == CAMERA_EFFECT_OFF) {
-		switch (saturation) {
-		case CAMERA_SATURATION_LV0:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV0\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_saturation_lv0_tbl);
-			break;
-
-		case CAMERA_SATURATION_LV1:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV1\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_saturation_lv1_tbl);
-			break;
-
-		case CAMERA_SATURATION_LV2:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV2\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_saturation_lv2_tbl);
-			break;
-
-		case CAMERA_SATURATION_LV3:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV3\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_saturation_lv3_tbl);
-			break;
-
-		case CAMERA_SATURATION_LV4:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV4\n");
-			rc = OV5640CORE_WRITEPREG(
-					ov5640_saturation_default_lv4_tbl);
-			break;
-
-		case CAMERA_SATURATION_LV5:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV5\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_saturation_lv5_tbl);
-			break;
-
-		case CAMERA_SATURATION_LV6:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV6\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_saturation_lv6_tbl);
-			break;
-
-		case CAMERA_SATURATION_LV7:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV7\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_saturation_lv7_tbl);
-			break;
-
-		case CAMERA_SATURATION_LV8:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV8\n");
-			rc = OV5640CORE_WRITEPREG(ov5640_saturation_lv8_tbl);
-			break;
-
-		default:
-			CDBG("--CAMERA--CAMERA_SATURATION_ERROR COMMAND\n");
-			break;
-		}
-	}
-
-	/* for recover saturation level when change special effect */
-	switch (saturation) {
-	case CAMERA_SATURATION_LV0:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV0\n");
-		ov5640_SAT_U = 0x00;
-		ov5640_SAT_V = 0x00;
-		break;
-	case CAMERA_SATURATION_LV1:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV1\n");
-		ov5640_SAT_U = 0x10;
-		ov5640_SAT_V = 0x10;
-		break;
-	case CAMERA_SATURATION_LV2:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV2\n");
-		ov5640_SAT_U = 0x20;
-		ov5640_SAT_V = 0x20;
-		break;
-	case CAMERA_SATURATION_LV3:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV3\n");
-		ov5640_SAT_U = 0x30;
-		ov5640_SAT_V = 0x30;
-		break;
-	case CAMERA_SATURATION_LV4:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV4\n");
-		ov5640_SAT_U = 0x40;
-		ov5640_SAT_V = 0x40;            break;
-	case CAMERA_SATURATION_LV5:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV5\n");
-		ov5640_SAT_U = 0x50;
-		ov5640_SAT_V = 0x50;            break;
-	case CAMERA_SATURATION_LV6:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV6\n");
-		ov5640_SAT_U = 0x60;
-		ov5640_SAT_V = 0x60;
-		break;
-	case CAMERA_SATURATION_LV7:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV7\n");
-		ov5640_SAT_U = 0x70;
-		ov5640_SAT_V = 0x70;            break;
-	case CAMERA_SATURATION_LV8:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV8\n");
-		ov5640_SAT_U = 0x80;
-		ov5640_SAT_V = 0x80;
-		break;
-	default:
-		CDBG("--CAMERA--CAMERA_SATURATION_ERROR COMMAND\n");
-		break;
-	}
-
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static long ov5640_set_antibanding(int antibanding)
-{
-	long rc = 0;
-
-	CDBG("--CAMERA-- %s ...(Start)\n",  __func__);
-	CDBG("--CAMERA-- %s ...antibanding = %d\n",  __func__, antibanding);
-
-	switch (antibanding) {
-	case CAMERA_ANTIBANDING_OFF:
-		CDBG("--CAMERA--CAMERA_ANTIBANDING_OFF\n");
-		break;
-
-	case CAMERA_ANTIBANDING_60HZ:
-		CDBG("--CAMERA--CAMERA_ANTIBANDING_60HZ\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_antibanding_60z_tbl);
-		break;
-
-	case CAMERA_ANTIBANDING_50HZ:
-		CDBG("--CAMERA--CAMERA_ANTIBANDING_50HZ\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_antibanding_50z_tbl);
-		break;
-
-	case CAMERA_ANTIBANDING_AUTO:
-		CDBG("--CAMERA--CAMERA_ANTIBANDING_AUTO\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_antibanding_auto_tbl);
-		break;
-
-	default:
-		CDBG("--CAMERA--CAMERA_ANTIBANDING_ERROR COMMAND\n");
-		break;
-	}
-
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static long ov5640_set_exposure_mode(int mode)
-{
-	long rc = 0;
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-	CDBG("--CAMERA-- %s ...mode = %d\n", __func__ , mode);
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static int32_t ov5640_lens_shading_enable(uint8_t is_enable)
-{
-	int32_t rc = 0;
-	CDBG("--CAMERA--%s: ...(Start). enable = %d\n",  __func__, is_enable);
-
-	if (is_enable) {
-		CDBG("%s: enable~!!\n", __func__);
-		rc = OV5640CORE_WRITEPREG(ov5640_lens_shading_on_tbl);
-	} else {
-		CDBG("%s: disable~!!\n", __func__);
-		rc = OV5640CORE_WRITEPREG(ov5640_lens_shading_off_tbl);
-	}
-	CDBG("--CAMERA--%s: ...(End). rc = %d\n", __func__, rc);
-	return rc;
-}
-
-static int ov5640_set_sensor_mode(int mode, int res)
-{
-	int rc = 0;
-
-	CDBG("--CAMERA-- ov5640_set_sensor_mode mode = %d, res = %d\n",
-			mode, res);
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		CDBG("--CAMERA-- SENSOR_PREVIEW_MODE\n");
-		rc = ov5640_setting(S_UPDATE_PERIODIC, S_RES_PREVIEW);
-		break;
-
-	case SENSOR_SNAPSHOT_MODE:
-		CDBG("--CAMERA-- SENSOR_SNAPSHOT_MODE\n");
-		rc = ov5640_setting(S_UPDATE_PERIODIC, S_RES_CAPTURE);
-		break;
-
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		CDBG("--CAMERA-- SENSOR_RAW_SNAPSHOT_MODE\n");
-		rc = ov5640_setting(S_UPDATE_PERIODIC, S_RES_CAPTURE);
-		break;
-
-	default:
-		CDBG("--CAMERA--ov5640_set_sensor_mode no support\n");
-		rc = -EINVAL;
-		break;
-	}
-
-	return rc;
-}
-
-static int ov5640_set_wb_oem(uint8_t param)
-{
-	int rc = 0;
-	unsigned int tmp2;
-
-	CDBG("[kylin] %s \r\n", __func__);
-
-	ov5640_i2c_read_byte(ov5640_client->addr, 0x350b, &tmp2);
-	CDBG("--CAMERA-- GAIN VALUE : %x\n", tmp2);
-
-	switch (param) {
-	case CAMERA_WB_AUTO:
-
-		CDBG("--CAMERA--CAMERA_WB_AUTO\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_wb_def);
-		break;
-
-	case CAMERA_WB_CUSTOM:
-		CDBG("--CAMERA--CAMERA_WB_CUSTOM\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_wb_custom);
-		break;
-	case CAMERA_WB_INCANDESCENT:
-		CDBG("--CAMERA--CAMERA_WB_INCANDESCENT\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_wb_inc);
-		break;
-	case CAMERA_WB_DAYLIGHT:
-		CDBG("--CAMERA--CAMERA_WB_DAYLIGHT\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_wb_daylight);
-		break;
-	case CAMERA_WB_CLOUDY_DAYLIGHT:
-		CDBG("--CAMERA--CAMERA_WB_CLOUDY_DAYLIGHT\n");
-		rc = OV5640CORE_WRITEPREG(ov5640_wb_cloudy);
-		break;
-	default:
-		break;
-	}
-	return rc;
-}
-
-static int ov5640_set_touchaec(uint32_t x, uint32_t y)
-{
-	uint8_t aec_arr[8] = {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11};
-	int idx = 0;
-	int i;
-
-	CDBG("[kylin] %s x: %d ,y: %d\r\n", __func__ , x, y);
-	idx = x / 2 + y * 2;
-	CDBG("[kylin] idx: %d\r\n", idx);
-
-	if (x % 2 == 0)
-		aec_arr[idx] = 0x10 | 0x0a;
-	else
-		aec_arr[idx] = 0x01 | 0xa0;
-
-	for (i = 0; i < 8; i++) {
-		CDBG("write : %x val : %x ", 0x5688 + i, aec_arr[i]);
-		ov5640_i2c_write(ov5640_client->addr, 0x5688 + i,
-				aec_arr[i], 10);
-	}
-
-	return 1;
-}
-
-static int ov5640_set_exposure_compensation(int compensation)
-{
-	long rc = 0;
-
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-
-	CDBG("--CAMERA-- %s ...exposure_compensation = %d\n", __func__ ,
-			    compensation);
-
-	switch (compensation) {
-	case CAMERA_EXPOSURE_COMPENSATION_LV0:
-		CDBG("--CAMERA--CAMERA_EXPOSURE_COMPENSATION_LV0\n");
-		rc = OV5640CORE_WRITEPREG(
-				ov5640_exposure_compensation_lv0_tbl);
-		break;
-
-	case CAMERA_EXPOSURE_COMPENSATION_LV1:
-		CDBG("--CAMERA--CAMERA_EXPOSURE_COMPENSATION_LV1\n");
-		rc = OV5640CORE_WRITEPREG(
-				ov5640_exposure_compensation_lv1_tbl);
-		break;
-
-	case CAMERA_EXPOSURE_COMPENSATION_LV2:
-		CDBG("--CAMERA--CAMERA_EXPOSURE_COMPENSATION_LV2\n");
-		rc = OV5640CORE_WRITEPREG(
-			    ov5640_exposure_compensation_lv2_default_tbl);
-		break;
-
-	case CAMERA_EXPOSURE_COMPENSATION_LV3:
-		CDBG("--CAMERA--CAMERA_EXPOSURE_COMPENSATION_LV3\n");
-		rc = OV5640CORE_WRITEPREG(
-				ov5640_exposure_compensation_lv3_tbl);
-		break;
-
-	case CAMERA_EXPOSURE_COMPENSATION_LV4:
-		CDBG("--CAMERA--CAMERA_EXPOSURE_COMPENSATION_LV3\n");
-		rc = OV5640CORE_WRITEPREG(
-				ov5640_exposure_compensation_lv4_tbl);
-		break;
-
-	default:
-		CDBG("--CAMERA--ERROR CAMERA_EXPOSURE_COMPENSATION\n");
-		break;
-	}
-
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-
-	return rc;
-}
-
-static int ov5640_sensor_start_af(void)
-{
-	int i;
-	unsigned int af_st = 0;
-	unsigned int af_ack = 0;
-	unsigned int tmp = 0;
-	int rc = 0;
-
-	CDBG("--CAMERA-- %s (Start...)\n", __func__);
-
-	ov5640_i2c_read_byte(ov5640_client->addr,
-			OV5640_CMD_FW_STATUS, &af_st);
-	CDBG("--CAMERA-- %s af_st = %d\n", __func__, af_st);
-
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_ACK, 0x01, 10);
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_MAIN, 0x03, 10);
-
-	for (i = 0; i < 50; i++) {
-		ov5640_i2c_read_byte(ov5640_client->addr,
-				OV5640_CMD_ACK, &af_ack);
-		if (af_ack == 0)
-			break;
-		msleep(50);
-	}
-	CDBG("--CAMERA-- %s af_ack = 0x%x\n", __func__, af_ack);
-
-	ov5640_i2c_read_byte(ov5640_client->addr, OV5640_CMD_FW_STATUS,
-			&af_st);
-	CDBG("--CAMERA-- %s af_st = %d\n", __func__, af_st);
-
-	if (af_st == 0x10) {
-		CDBG("--CAMERA-- %s AF ok and release AF setting~!!\n",
-				__func__);
-	} else {
-		CDBG("--CAMERA-- %s AF not ready!!\n", __func__);
-	}
-
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_ACK, 0x01, 10);
-	ov5640_i2c_write(ov5640_client->addr, OV5640_CMD_MAIN, 0x07, 10);
-
-	for (i = 0; i < 70; i++) {
-		ov5640_i2c_read_byte(ov5640_client->addr, OV5640_CMD_ACK,
-				&af_ack);
-		if (af_ack == 0)
-			break;
-		msleep(25);
-	}
-
-	ov5640_i2c_read_byte(ov5640_client->addr, OV5640_CMD_PARA0, &tmp);
-	CDBG("0x3024 = %x\n", tmp);
-	rc = ((tmp == 0) ? 1 : 0);
-
-	ov5640_i2c_read_byte(ov5640_client->addr, OV5640_CMD_PARA1, &tmp);
-	CDBG("0x3025 = %x\n", tmp);
-	rc = ((tmp == 0) ? 1 : 0);
-
-	ov5640_i2c_read_byte(ov5640_client->addr, OV5640_CMD_PARA2, &tmp);
-	CDBG("0x3026 = %x\n", tmp);
-	rc = ((tmp == 0) ? 1 : 0);
-
-	ov5640_i2c_read_byte(ov5640_client->addr, OV5640_CMD_PARA3, &tmp);
-	CDBG("0x3027 = %x\n", tmp);
-	rc = ((tmp == 0) ? 1 : 0) ;
-
-	ov5640_i2c_read_byte(ov5640_client->addr, OV5640_CMD_PARA4, &tmp);
-	CDBG("0x3028 = %x\n", tmp);
-	rc = ((tmp == 0) ? 1 : 0) ;
-
-	CDBG("--CAMERA-- %s rc = %d(End...)\n", __func__, rc);
-	return rc;
-}
-
-static int ov5640_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long rc = 0;
-
-	if (copy_from_user(&cdata, (void *)argp,
-				sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-
-	CDBG("--CAMERA-- %s %d\n", __func__, cdata.cfgtype);
-
-	mutex_lock(&ov5640_mutex);
-
-	switch (cdata.cfgtype) {
-	case CFG_SET_MODE:
-		rc = ov5640_set_sensor_mode(cdata.mode, cdata.rs);
-		break;
-
-	case CFG_SET_EFFECT:
-		CDBG("--CAMERA-- CFG_SET_EFFECT mode=%d,"
-				"effect = %d !!\n", cdata.mode,
-				cdata.cfg.effect);
-		rc = ov5640_set_effect(cdata.mode, cdata.cfg.effect);
-		break;
-
-	case CFG_START:
-		CDBG("--CAMERA-- CFG_START (Not Support) !!\n");
-		/* Not Support */
-		break;
-
-	case CFG_PWR_UP:
-		CDBG("--CAMERA-- CFG_PWR_UP (Not Support) !!\n");
-		/* Not Support */
-		break;
-
-	case CFG_PWR_DOWN:
-		CDBG("--CAMERA-- CFG_PWR_DOWN (Not Support)\n");
-		ov5640_power_off();
-		break;
-
-	case CFG_SET_DEFAULT_FOCUS:
-		CDBG("--CAMERA-- CFG_SET_DEFAULT_FOCUS (Not Implement) !!\n");
-		break;
-
-	case CFG_MOVE_FOCUS:
-		CDBG("--CAMERA-- CFG_MOVE_FOCUS (Not Implement) !!\n");
-		break;
-
-	case CFG_SET_BRIGHTNESS:
-		CDBG("--CAMERA-- CFG_SET_BRIGHTNESS  !!\n");
-		rc = ov5640_set_brightness(cdata.cfg.brightness);
-		break;
-
-	case CFG_SET_CONTRAST:
-		CDBG("--CAMERA-- CFG_SET_CONTRAST  !!\n");
-		rc = ov5640_set_contrast(cdata.cfg.contrast);
-		break;
-
-	case CFG_SET_EXPOSURE_MODE:
-		CDBG("--CAMERA-- CFG_SET_EXPOSURE_MODE !!\n");
-		rc = ov5640_set_exposure_mode(cdata.cfg.ae_mode);
-		break;
-
-	case CFG_SET_ANTIBANDING:
-		CDBG("--CAMERA-- CFG_SET_ANTIBANDING antibanding = %d!!\n",
-				cdata.cfg.antibanding);
-		rc = ov5640_set_antibanding(cdata.cfg.antibanding);
-		break;
-
-	case CFG_SET_LENS_SHADING:
-		CDBG("--CAMERA-- CFG_SET_LENS_SHADING !!\n");
-		rc = ov5640_lens_shading_enable(
-				cdata.cfg.lens_shading);
-		break;
-
-	case CFG_SET_SATURATION:
-		CDBG("--CAMERA-- CFG_SET_SATURATION !!\n");
-		rc = ov5640_set_saturation(cdata.cfg.saturation);
-		break;
-
-	case CFG_SET_SHARPNESS:
-		CDBG("--CAMERA-- CFG_SET_SHARPNESS !!\n");
-		rc = ov5640_set_sharpness(cdata.cfg.sharpness);
-		break;
-
-	case CFG_SET_WB:
-		CDBG("--CAMERA-- CFG_SET_WB!!\n");
-		ov5640_set_wb_oem(cdata.cfg.wb_val);
-		rc = 0 ;
-		break;
-
-	case CFG_SET_TOUCHAEC:
-		CDBG("--CAMERA-- CFG_SET_TOUCHAEC!!\n");
-		ov5640_set_touchaec(cdata.cfg.aec_cord.x,
-				cdata.cfg.aec_cord.y);
-		rc = 0 ;
-		break;
-
-	case CFG_SET_AUTO_FOCUS:
-		CDBG("--CAMERA-- CFG_SET_AUTO_FOCUS !\n");
-		rc = ov5640_sensor_start_af();
-		break;
-
-	case CFG_SET_AUTOFLASH:
-		CDBG("--CAMERA-- CFG_SET_AUTOFLASH !\n");
-		is_autoflash = cdata.cfg.is_autoflash;
-		CDBG("[kylin] is autoflash %d\r\n", is_autoflash);
-		rc = 0;
-		break;
-
-	case CFG_SET_EXPOSURE_COMPENSATION:
-		CDBG("--CAMERA-- CFG_SET_EXPOSURE_COMPENSATION !\n");
-		rc = ov5640_set_exposure_compensation(
-				cdata.cfg.exp_compensation);
-		break;
-
-	default:
-		CDBG("%s: Command=%d (Not Implement)!!\n", __func__,
-				cdata.cfgtype);
-		rc = -EINVAL;
-		break;
-	}
-
-	mutex_unlock(&ov5640_mutex);
-	return rc;
-}
-
-static struct i2c_driver ov5640_i2c_driver = {
-	.id_table = ov5640_i2c_id,
-	.probe  = ov5640_i2c_probe,
-	.remove = ov5640_i2c_remove,
-	.driver = {
-		.name = "ov5640",
-	},
-};
-
-static int ov5640_probe_init_gpio(const struct msm_camera_sensor_info *data)
-{
-	int rc = 0;
-
-	CDBG("--CAMERA-- %s\n", __func__);
-
-	ov5640_pwdn_gpio = data->sensor_pwd;
-	ov5640_reset_gpio = data->sensor_reset;
-	ov5640_driver_pwdn_gpio = data->vcm_pwd ;
-
-	if (data->vcm_enable)
-		gpio_direction_output(data->vcm_pwd, 1);
-
-	gpio_direction_output(data->sensor_reset, 1);
-	gpio_direction_output(data->sensor_pwd, 1);
-
-	return rc;
-
-}
-
-static void ov5640_probe_free_gpio(const struct msm_camera_sensor_info *data)
-{
-	gpio_free(ov5640_pwdn_gpio);
-	gpio_free(ov5640_reset_gpio);
-
-	if (data->vcm_enable) {
-		gpio_free(ov5640_driver_pwdn_gpio);
-		ov5640_driver_pwdn_gpio = 0xFF ;
-	}
-
-	ov5640_pwdn_gpio	= 0xFF;
-	ov5640_reset_gpio	= 0xFF;
-}
-
-static int ov5640_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = -ENOTSUPP;
-
-	CDBG("--CAMERA-- %s (Start...)\n", __func__);
-	rc = i2c_add_driver(&ov5640_i2c_driver);
-	CDBG("--CAMERA-- i2c_add_driver ret:0x%x,ov5640_client=0x%x\n",
-			rc, (unsigned int)ov5640_client);
-	if ((rc < 0) || (ov5640_client == NULL)) {
-		CDBG("--CAMERA-- i2c_add_driver FAILS!!\n");
-		return rc;
-	}
-
-	rc = ov5640_probe_init_gpio(info);
-	if (rc < 0)
-		return rc;
-
-	ov5640_power_off();
-
-	/* SENSOR NEED MCLK TO DO I2C COMMUNICTION, OPEN CLK FIRST*/
-	msm_camio_clk_rate_set(24000000);
-
-	msleep(20);
-
-	ov5640_power_on();
-	ov5640_power_reset();
-
-	rc = ov5640_probe_readID(info);
-
-	if (rc < 0) {
-		CDBG("--CAMERA--ov5640_probe_readID Fail !!~~~~!!\n");
-		CDBG("--CAMERA-- %s, unregister\n", __func__);
-		i2c_del_driver(&ov5640_i2c_driver);
-		ov5640_power_off();
-		ov5640_probe_free_gpio(info);
-		return rc;
-	}
-
-	s->s_init		= ov5640_sensor_open_init;
-	s->s_release		= ov5640_sensor_release;
-	s->s_config		= ov5640_sensor_config;
-	s->s_camera_type	= BACK_CAMERA_2D;
-	s->s_mount_angle	= info->sensor_platform_info->mount_angle;
-
-	ov5640_power_off();
-
-	CDBG("--CAMERA-- %s (End...)\n", __func__);
-	return rc;
-}
-
-static int ov5640_i2c_probe(struct i2c_client *client,
-		const struct i2c_device_id *id)
-{
-	CDBG("--CAMERA-- %s ... (Start...)\n", __func__);
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("--CAMERA--i2c_check_functionality failed\n");
-		return -ENOMEM;
-	}
-
-	ov5640_sensorw = kzalloc(sizeof(struct ov5640_work), GFP_KERNEL);
-	if (!ov5640_sensorw) {
-		CDBG("--CAMERA--kzalloc failed\n");
-		return -ENOMEM;
-	}
-
-	i2c_set_clientdata(client, ov5640_sensorw);
-	ov5640_init_client(client);
-	ov5640_client = client;
-
-	CDBG("--CAMERA-- %s ... (End...)\n", __func__);
-	return 0;
-}
-
-static int __ov5640_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, ov5640_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe	= __ov5640_probe,
-	.driver	= {
-		.name	= "msm_camera_ov5640",
-		.owner	= THIS_MODULE,
-	},
-};
-
-static int __init ov5640_init(void)
-{
-	ov5640_i2c_buf[0] = 0x5A;
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(ov5640_init);
-
-MODULE_DESCRIPTION("OV5640 YUV MIPI sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/ov5640.h b/drivers/media/video/msm/ov5640.h
deleted file mode 100644
index a428da6..0000000
--- a/drivers/media/video/msm/ov5640.h
+++ /dev/null
@@ -1,2993 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-
-/*
-[SENSOR]
-Sensor Model:   OV5640
-Camera Module:
-Lens Model:
-Driver IC:
-PV Size         = 640 x 480
-Cap Size        = 2592 x 1944
-Output Format   = YUYV
-MCLK Speed      = 24M
-PV DVP_PCLK     = 28M
-Cap DVP_PCLK    = 56M
-PV Frame Rate   = 30fps
-Cap Frame Rate  = 7.5fps
-I2C Slave ID    = 0x78
-I2C Mode        = 16Addr, 8Data
-*/
-
-#ifndef CAMSENSOR_OV5640
-#define CAMSENSOR_OV5640
-
-#define INVMASK(v)  (0xff-v)
-#define OV5640CORE_WRITEPREG(PTBL)	ov5640_writepregs(PTBL,\
-					sizeof(PTBL)/sizeof(PTBL[0]))
-
-/* OV SENSOR SCCB */
-struct ov5640_sensor {
-	uint16_t addr;
-	uint8_t data;
-	uint8_t mask;
-};
-
-/* Auto Focus Command */
-#define OV5640_CMD_MAIN 0x3022
-#define OV5640_CMD_ACK 0x3023
-#define OV5640_CMD_PARA0 0x3024
-#define OV5640_CMD_PARA1 0x3025
-#define OV5640_CMD_PARA2 0x3026
-#define OV5640_CMD_PARA3 0x3027
-#define OV5640_CMD_PARA4 0x3028
-#define OV5640_CMD_FW_STATUS 0x3029
-
-/* Sensor ID */
-#define OV5640_SENSOR_ID 0x5640
-
-#define capture_framerate 750     /* 7.5fps capture frame rate */
-#define g_preview_frameRate 3000  /* 30fps preview frame rate */
-
-struct ov5640_sensor ov5640_init_tbl[] = {
-	{0x3008, 0x42},
-	{0x3103, 0x03},
-	{0x3017, 0x00},
-	{0x3018, 0x00},
-	{0x3034, 0x18},
-	{0x3035, 0x14},
-	{0x3036, 0x38},
-	{0x3037, 0x13},
-	{0x3108, 0x01},
-	{0x3630, 0x36},
-	{0x3631, 0x0e},
-	{0x3632, 0xe2},
-	{0x3633, 0x12},
-	{0x3621, 0xe0},
-	{0x3704, 0xa0},
-	{0x3703, 0x5a},
-	{0x3715, 0x78},
-	{0x3717, 0x01},
-	{0x370b, 0x60},
-	{0x3705, 0x1a},
-	{0x3905, 0x02},
-	{0x3906, 0x10},
-	{0x3901, 0x0a},
-	{0x3731, 0x12},
-	{0x3600, 0x08},
-	{0x3601, 0x33},
-	{0x302d, 0x60},
-	{0x3620, 0x52},
-	{0x371b, 0x20},
-	{0x471c, 0x50},
-	{0x3a13, 0x43},
-	{0x3a18, 0x00},
-	{0x3a19, 0xf8},
-	{0x3635, 0x13},
-	{0x3636, 0x03},
-	{0x3634, 0x40},
-	{0x3622, 0x01},
-	{0x3c01, 0x34},
-	{0x3c04, 0x28},
-	{0x3c05, 0x98},
-	{0x3c06, 0x00},
-	{0x3c07, 0x08},
-	{0x3c08, 0x00},
-	{0x3c09, 0x1c},
-	{0x3c0a, 0x9c},
-	{0x3c0b, 0x40},
-	{0x3820, 0x41},
-	{0x3821, 0x07},
-	{0x3814, 0x31},
-	{0x3815, 0x31},
-	{0x3800, 0x00},
-	{0x3801, 0x00},
-	{0x3802, 0x00},
-	{0x3803, 0x04},
-	{0x3804, 0x0a},
-	{0x3805, 0x3f},
-	{0x3806, 0x07},
-	{0x3807, 0x9b},
-	{0x3808, 0x02},
-	{0x3809, 0x80},
-	{0x380a, 0x01},
-	{0x380b, 0xe0},
-	{0x380c, 0x07},
-	{0x380d, 0x68},
-	{0x380e, 0x03},
-	{0x380f, 0xd8},
-	{0x3810, 0x00},
-	{0x3811, 0x10},
-	{0x3812, 0x00},
-	{0x3813, 0x06},
-	{0x3618, 0x00},
-	{0x3612, 0x29},
-	{0x3708, 0x64},
-	{0x3709, 0x52},
-	{0x370c, 0x03},
-	{0x3a02, 0x03},
-	{0x3a03, 0xd8},
-	{0x3a08, 0x01},
-	{0x3a09, 0x27},
-	{0x3a0a, 0x00},
-	{0x3a0b, 0xf6},
-	{0x3a0e, 0x03},
-	{0x3a0d, 0x04},
-	{0x3a14, 0x03},
-	{0x3a15, 0xd8},
-	{0x4001, 0x02},
-	{0x4004, 0x02},
-	{0x3000, 0x00},
-	{0x3002, 0x1c},
-	{0x3004, 0xff},
-	{0x3006, 0xc3},
-	{0x300e, 0x45},
-	{0x302e, 0x08},
-	{0x4300, 0x30},
-	{0x501f, 0x00},
-	{0x4713, 0x03},
-	{0x4407, 0x04},
-	{0x440e, 0x00},
-	{0x460b, 0x35},
-	{0x460c, 0x22},
-	{0x4837, 0x44},
-	{0x3824, 0x02},
-	{0x5000, 0xa7},
-	{0x5001, 0xa3},
-	{0x5180, 0xff},
-	{0x5181, 0xf2},
-	{0x5182, 0x00},
-	{0x5183, 0x14},
-	{0x5184, 0x25},
-	{0x5185, 0x24},
-	{0x5186, 0x09},
-	{0x5187, 0x09},
-	{0x5188, 0x09},
-	{0x5189, 0x75},
-	{0x518a, 0x54},
-	{0x518b, 0xe0},
-	{0x518c, 0xb2},
-	{0x518d, 0x42},
-	{0x518e, 0x3d},
-	{0x518f, 0x56},
-	{0x5190, 0x46},
-	{0x5191, 0xf8},
-	{0x5192, 0x04},
-	{0x5193, 0x70},
-	{0x5194, 0xf0},
-	{0x5195, 0xf0},
-	{0x5196, 0x03},
-	{0x5197, 0x01},
-	{0x5198, 0x04},
-	{0x5199, 0x12},
-	{0x519a, 0x04},
-	{0x519b, 0x00},
-	{0x519c, 0x06},
-	{0x519d, 0x82},
-	{0x519e, 0x38},
-	{0x5381, 0x1e},
-	{0x5382, 0x5b},
-	{0x5383, 0x08},
-	{0x5384, 0x0a},
-	{0x5385, 0x7e},
-	{0x5386, 0x88},
-	{0x5387, 0x7c},
-	{0x5388, 0x6c},
-	{0x5389, 0x10},
-	{0x538a, 0x01},
-	{0x538b, 0x98},
-	{0x5300, 0x08},
-	{0x5301, 0x30},
-	{0x5302, 0x10},
-	{0x5303, 0x00},
-	{0x5304, 0x08},
-	{0x5305, 0x30},
-	{0x5306, 0x08},
-	{0x5307, 0x16},
-	{0x5309, 0x08},
-	{0x530a, 0x30},
-	{0x530b, 0x04},
-	{0x530c, 0x06},
-	{0x5480, 0x01},
-	{0x5481, 0x08},
-	{0x5482, 0x14},
-	{0x5483, 0x28},
-	{0x5484, 0x51},
-	{0x5485, 0x65},
-	{0x5486, 0x71},
-	{0x5487, 0x7d},
-	{0x5488, 0x87},
-	{0x5489, 0x91},
-	{0x548a, 0x9a},
-	{0x548b, 0xaa},
-	{0x548c, 0xb8},
-	{0x548d, 0xcd},
-	{0x548e, 0xdd},
-	{0x548f, 0xea},
-	{0x5490, 0x1d},
-	{0x5580, 0x02},
-	{0x5583, 0x40},
-	{0x5584, 0x10},
-	{0x5589, 0x10},
-	{0x558a, 0x00},
-	{0x558b, 0xf8},
-	{0x5800, 0x23},
-	{0x5801, 0x14},
-	{0x5802, 0x0f},
-	{0x5803, 0x0f},
-	{0x5804, 0x12},
-	{0x5805, 0x26},
-	{0x5806, 0x0c},
-	{0x5807, 0x08},
-	{0x5808, 0x05},
-	{0x5809, 0x05},
-	{0x580a, 0x08},
-	{0x580b, 0x0d},
-	{0x580c, 0x08},
-	{0x580d, 0x03},
-	{0x580e, 0x00},
-	{0x580f, 0x00},
-	{0x5810, 0x03},
-	{0x5811, 0x09},
-	{0x5812, 0x07},
-	{0x5813, 0x03},
-	{0x5814, 0x00},
-	{0x5815, 0x01},
-	{0x5816, 0x03},
-	{0x5817, 0x08},
-	{0x5818, 0x0d},
-	{0x5819, 0x08},
-	{0x581a, 0x05},
-	{0x581b, 0x06},
-	{0x581c, 0x08},
-	{0x581d, 0x0e},
-	{0x581e, 0x29},
-	{0x581f, 0x17},
-	{0x5820, 0x11},
-	{0x5821, 0x11},
-	{0x5822, 0x15},
-	{0x5823, 0x28},
-	{0x5824, 0x46},
-	{0x5825, 0x26},
-	{0x5826, 0x08},
-	{0x5827, 0x26},
-	{0x5828, 0x64},
-	{0x5829, 0x26},
-	{0x582a, 0x24},
-	{0x582b, 0x22},
-	{0x582c, 0x24},
-	{0x582d, 0x24},
-	{0x582e, 0x06},
-	{0x582f, 0x22},
-	{0x5830, 0x40},
-	{0x5831, 0x42},
-	{0x5832, 0x24},
-	{0x5833, 0x26},
-	{0x5834, 0x24},
-	{0x5835, 0x22},
-	{0x5836, 0x22},
-	{0x5837, 0x26},
-	{0x5838, 0x44},
-	{0x5839, 0x24},
-	{0x583a, 0x26},
-	{0x583b, 0x28},
-	{0x583c, 0x42},
-	{0x583d, 0xce},
-	{0x5025, 0x00},
-	{0x3a0f, 0x30},
-	{0x3a10, 0x28},
-	{0x3a1b, 0x30},
-	{0x3a1e, 0x26},
-	{0x3a11, 0x60},
-	{0x3a1f, 0x14},
-	{0x3008, 0x02},
-};
-
-struct ov5640_sensor ov5640_init_iq_tbl[] = {
-/* Lens correction */
-/* OV5640 LENC setting */
-	{0x5800, 0x3f},
-	{0x5801, 0x20},
-	{0x5802, 0x1a},
-	{0x5803, 0x1a},
-	{0x5804, 0x23},
-	{0x5805, 0x3f},
-	{0x5806, 0x11},
-	{0x5807, 0x0c},
-	{0x5808, 0x09},
-	{0x5809, 0x08},
-	{0x580a, 0x0d},
-	{0x580b, 0x12},
-	{0x580c, 0x0d},
-	{0x580d, 0x04},
-	{0x580e, 0x00},
-	{0x580f, 0x00},
-	{0x5810, 0x05},
-	{0x5811, 0x0d},
-	{0x5812, 0x0d},
-	{0x5813, 0x04},
-	{0x5814, 0x00},
-	{0x5815, 0x00},
-	{0x5816, 0x04},
-	{0x5817, 0x0d},
-	{0x5818, 0x13},
-	{0x5819, 0x0d},
-	{0x581a, 0x08},
-	{0x581b, 0x08},
-	{0x581c, 0x0c},
-	{0x581d, 0x13},
-	{0x581e, 0x3f},
-	{0x581f, 0x1f},
-	{0x5820, 0x1b},
-	{0x5821, 0x1c},
-	{0x5822, 0x23},
-	{0x5823, 0x3f},
-	{0x5824, 0x6a},
-	{0x5825, 0x06},
-	{0x5826, 0x08},
-	{0x5827, 0x06},
-	{0x5828, 0x2a},
-	{0x5829, 0x08},
-	{0x582a, 0x24},
-	{0x582b, 0x24},
-	{0x582c, 0x24},
-	{0x582d, 0x08},
-	{0x582e, 0x08},
-	{0x582f, 0x22},
-	{0x5830, 0x40},
-	{0x5831, 0x22},
-	{0x5832, 0x06},
-	{0x5833, 0x08},
-	{0x5834, 0x24},
-	{0x5835, 0x24},
-	{0x5836, 0x04},
-	{0x5837, 0x0a},
-	{0x5838, 0x86},
-	{0x5839, 0x08},
-	{0x583a, 0x28},
-	{0x583b, 0x28},
-	{0x583c, 0x66},
-	{0x583d, 0xce},
-/* AEC */
-	{0x3a0f, 0x38},
-	{0x3a10, 0x30},
-	{0x3a11, 0x61},
-	{0x3a1b, 0x38},
-	{0x3a1e, 0x30},
-	{0x3a1f, 0x10},
-	/* AWB */
-	{0x5180, 0xff},
-	{0x5181, 0xf2},
-	{0x5182, 0x00},
-	{0x5183, 0x14},
-	{0x5184, 0x25},
-	{0x5185, 0x24},
-	{0x5186, 0x09},
-	{0x5187, 0x09},
-	{0x5188, 0x09},
-	{0x5189, 0x88},
-	{0x518a, 0x54},
-	{0x518b, 0xee},
-	{0x518c, 0xb2},
-	{0x518d, 0x50},
-	{0x518e, 0x34},
-	{0x518f, 0x6b},
-	{0x5190, 0x46},
-	{0x5191, 0xf8},
-	{0x5192, 0x04},
-	{0x5193, 0x70},
-	{0x5194, 0xf0},
-	{0x5195, 0xf0},
-	{0x5196, 0x03},
-	{0x5197, 0x01},
-	{0x5198, 0x04},
-	{0x5199, 0x6c},
-	{0x519a, 0x04},
-	{0x519b, 0x00},
-	{0x519c, 0x09},
-	{0x519d, 0x2b},
-	{0x519e, 0x38},
-
-/* UV Adjust Auto Mode */
-	{0x5580, 0x02},	/* 02 ;Sat enable */
-	{0x5588, 0x01},	/*40 ;enable UV adj */
-	{0x5583, 0x40},	/*	;offset high */
-	{0x5584, 0x18},	/*	;offset low */
-	{0x5589, 0x18},	/*	;gth1	*/
-	{0x558a, 0x00},
-	{0x358b, 0xf8},	/*	;gth2 */
-};
-
-struct ov5640_sensor ov5640_preview_tbl[] = {
-/* @@ MIPI_2lane_5M to vga(YUV) 30fps 99 640 480 98 0 0 */
-	{0x3503, 0x00}, /* enable AE back from capture to preview */
-	{0x3035, 0x14},
-	{0x3036, 0x38},
-	{0x3820, 0x41},
-	{0x3821, 0x07},
-	{0x3814, 0x31},
-	{0x3815, 0x31},
-	{0x3803, 0x04},
-	{0x3807, 0x9b},
-	{0x3808, 0x02},
-	{0x3809, 0x80},
-	{0x380a, 0x01},
-	{0x380b, 0xe0},
-	{0x380c, 0x07},
-	{0x380d, 0x68},
-	{0x380e, 0x03},
-	{0x380f, 0xd8},
-	{0x3813, 0x06},
-	{0x3618, 0x00},
-	{0x3612, 0x29},
-	{0x3708, 0x64},
-	{0x3709, 0x52},
-	{0x370c, 0x03},
-	{0x5001, 0xa3},
-	{0x4004, 0x02},
-	{0x4005, 0x18},
-	{0x4837, 0x44},
-	{0x4713, 0x03},
-	{0x4407, 0x04},
-	{0x460b, 0x35},
-	{0x460c, 0x22},
-	{0x3824, 0x02},
-};
-
-struct ov5640_sensor ov5640_capture_tbl[] = {
-/* @@ MIPI_2lane_5M(YUV) 7.5/15fps 99 2592 1944 98 0 0 */
-	{0x3035, 0x21}, /* 11 */
-	{0x3036, 0x54},
-	{0x3820, 0x40},
-	{0x3821, 0x06},
-	{0x3814, 0x11},
-	{0x3815, 0x11},
-	{0x3803, 0x00},
-	{0x3807, 0x9f},
-	{0x3808, 0x0a},
-	{0x3809, 0x20},
-	{0x380a, 0x07},
-	{0x380b, 0x98},
-	{0x380c, 0x0b},
-	{0x380d, 0x1c},
-	{0x380e, 0x07},
-	{0x380f, 0xb0},
-	{0x3813, 0x04},
-	{0x3618, 0x04},
-	{0x3612, 0x2b},
-	{0x3708, 0x21},
-	{0x3709, 0x12},
-	{0x370c, 0x00},
-	{0x5001, 0x83},
-	{0x4004, 0x06},
-	{0x4005, 0x1a},
-	{0x4837, 0x15}, /* 0a */
-	{0x4713, 0x02},
-	{0x4407, 0x0c},
-	{0x460b, 0x37},
-	{0x460c, 0x20},
-	{0x3824, 0x01},
-};
-
-/* Contrast */
-
-struct ov5640_sensor ov5640_contrast_lv0_tbl[] = {
-/* Contrast -4 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x04, INVMASK(0x04)}, /* Enable BIT2 for contrast/brightness
-					  control*/
-	{0x5586, 0x10},                /* Gain */
-	{0x5585, 0x10},                /* Offset */
-	{0x5588, 0x00, INVMASK(0x04)}, /* Offset sign */
-};
-
-struct ov5640_sensor ov5640_contrast_lv1_tbl[] = {
-/* Contrast -3 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x04, INVMASK(0x04)}, /* Enable BIT2 for contrast/brightness
-					  control */
-	{0x5586, 0x14},                /* Gain */
-	{0x5585, 0x14},                /* Offset */
-	{0x5588, 0x00, INVMASK(0x04)}, /* Offset sign */
-};
-
-struct ov5640_sensor ov5640_contrast_lv2_tbl[] = {
-/* Contrast -2 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x04, INVMASK(0x04)}, /* Enable BIT2 for contrast/brightness
-					  control */
-	{0x5586, 0x18},                /* Gain */
-	{0x5585, 0x18},                /* Offset */
-	{0x5588, 0x00, INVMASK(0x04)}, /* Offset sign */
-};
-
-struct ov5640_sensor ov5640_contrast_lv3_tbl[] = {
-/* Contrast -1 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5586, 0x1c},
-	{0x5585, 0x1c},
-	{0x5588, 0x00, INVMASK(0x04)},
-};
-
-struct ov5640_sensor ov5640_contrast_default_lv4_tbl[] = {
-/* Contrast (Default) */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5586, 0x20},
-	{0x5585, 0x00},
-	{0x5588, 0x00, INVMASK(0x04)},
-};
-
-struct ov5640_sensor ov5640_contrast_lv5_tbl[] = {
-/* Contrast +1 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5586, 0x24},
-	{0x5585, 0x10},
-	{0x5588, 0x00, INVMASK(0x04)},
-};
-
-struct ov5640_sensor ov5640_contrast_lv6_tbl[] = {
-/* Contrast +2 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5586, 0x28},
-	{0x5585, 0x18},
-	{0x5588, 0x00, INVMASK(0x04)},
-};
-
-struct ov5640_sensor ov5640_contrast_lv7_tbl[] = {
-/* Contrast +3 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5586, 0x2c},
-	{0x5585, 0x1c},
-	{0x5588, 0x00, INVMASK(0x04)},
-};
-
-struct ov5640_sensor ov5640_contrast_lv8_tbl[] = {
-/* Contrast +4 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5586, 0x30},
-	{0x5585, 0x20},
-	{0x5588, 0x00, INVMASK(0x04)},
-};
-
-/* Sharpness */
-
-struct ov5640_sensor ov5640_sharpness_lv0_tbl[] = {
-/* Sharpness 0 */
-	{0x5308, 0x40, INVMASK(0x40)},
-	{0x5302, 0x00},
-};
-
-struct ov5640_sensor ov5640_sharpness_lv1_tbl[] = {
-/* Sharpness 1 */
-	{0x5308, 0x40, INVMASK(0x40)},
-	{0x5302, 0x02},
-};
-
-struct ov5640_sensor ov5640_sharpness_default_lv2_tbl[] = {
-/* Sharpness_Auto (Default) */
-	{0x5308, 0x00, INVMASK(0x40)},
-	{0x5300, 0x08},
-	{0x5301, 0x30},
-	{0x5302, 0x10},
-	{0x5303, 0x00},
-	{0x5309, 0x08},
-	{0x530a, 0x30},
-	{0x530b, 0x04},
-	{0x530c, 0x06},
-};
-
-struct ov5640_sensor ov5640_sharpness_lv3_tbl[] = {
-/* Sharpness 3 */
-	{0x5308, 0x40, INVMASK(0x40)},
-	{0x5302, 0x08},
-};
-
-struct ov5640_sensor ov5640_sharpness_lv4_tbl[] = {
-/* Sharpness 4 */
-	{0x5308, 0x40, INVMASK(0x40)},
-	{0x5302, 0x0c},
-};
-
-struct ov5640_sensor ov5640_sharpness_lv5_tbl[] = {
-/* Sharpness 5 */
-	{0x5308, 0x40, INVMASK(0x40)},
-	{0x5302, 0x10},
-};
-
-struct ov5640_sensor ov5640_sharpness_lv6_tbl[] = {
-/* Sharpness 6 */
-	{0x5308, 0x40, INVMASK(0x40)},
-	{0x5302, 0x14},
-};
-
-struct ov5640_sensor ov5640_sharpness_lv7_tbl[] = {
-/* Sharpness 7 */
-	{0x5308, 0x40, INVMASK(0x40)},
-	{0x5302, 0x18},
-};
-
-struct ov5640_sensor ov5640_sharpness_lv8_tbl[] = {
-/* Sharpness 8 */
-	{0x5308, 0x40, INVMASK(0x40)},
-	{0x5302, 0x20},
-};
-
-/* Saturation */
-
-struct ov5640_sensor ov5640_saturation_lv0_tbl[] = {
-/* Saturation x0.25 */
-	{0x5001, 0x83, INVMASK(0x80)},  /* SDE_En */
-	{0x5583, 0x00},                 /* Saturaion gain in U */
-	{0x5584, 0x00},                 /* Saturation gain in V */
-	{0x5580, 0x02, INVMASK(0x02)},  /* Saturation enable */
-	{0x5588, 0x40, INVMASK(0x40)},
-};
-
-struct ov5640_sensor ov5640_saturation_lv1_tbl[] = {
-/* Saturation x0.5 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5583, 0x10},
-	{0x5584, 0x10},
-	{0x5580, 0x02, INVMASK(0x02)},
-	{0x5588, 0x40, INVMASK(0x40)},
-};
-
-struct ov5640_sensor ov5640_saturation_lv2_tbl[] = {
-/* Saturation x0.75 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5583, 0x20},
-	{0x5584, 0x20},
-	{0x5580, 0x02, INVMASK(0x02)},
-	{0x5588, 0x40, INVMASK(0x40)},
-};
-
-struct ov5640_sensor ov5640_saturation_lv3_tbl[] = {
-/* Saturation x0.75 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5583, 0x30},
-	{0x5584, 0x30},
-	{0x5580, 0x02, INVMASK(0x02)},
-	{0x5588, 0x40, INVMASK(0x40)},
-};
-
-struct ov5640_sensor ov5640_saturation_default_lv4_tbl[] = {
-/* Saturation x1 (Default) */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5583, 0x40},
-	{0x5584, 0x40},
-	{0x5580, 0x02, INVMASK(0x02)},
-	{0x5588, 0x40, INVMASK(0x40)},
-};
-
-struct ov5640_sensor ov5640_saturation_lv5_tbl[] = {
-/* Saturation x1.25 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5583, 0x50},
-	{0x5584, 0x50},
-	{0x5580, 0x02, INVMASK(0x02)},
-	{0x5588, 0x40, INVMASK(0x40)},
-};
-
-struct ov5640_sensor ov5640_saturation_lv6_tbl[] = {
-/* Saturation x1.5 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5583, 0x60},
-	{0x5584, 0x60},
-	{0x5580, 0x02, INVMASK(0x02)},
-	{0x5588, 0x40, INVMASK(0x40)},
-};
-
-struct ov5640_sensor ov5640_saturation_lv7_tbl[] = {
-/* Saturation x1.25 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5583, 0x70},
-	{0x5584, 0x70},
-	{0x5580, 0x02, INVMASK(0x02)},
-	{0x5588, 0x40, INVMASK(0x40)},
-};
-
-struct ov5640_sensor ov5640_saturation_lv8_tbl[] = {
-/* Saturation x1.5 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5583, 0x80},
-	{0x5584, 0x80},
-	{0x5580, 0x02, INVMASK(0x02)},
-	{0x5588, 0x40, INVMASK(0x40)},
-};
-
-/* Brightness */
-
-struct ov5640_sensor ov5640_brightness_lv0_tbl[] = {
-/* Brightness -4 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5587, 0x40},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5588, 0x08, INVMASK(0x08)},
-};
-
-struct ov5640_sensor ov5640_brightness_lv1_tbl[] = {
-/* Brightness -3 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5587, 0x30},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5588, 0x08, INVMASK(0x08)},
-};
-
-struct ov5640_sensor ov5640_brightness_lv2_tbl[] = {
-/* Brightness -2 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5587, 0x20},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5588, 0x08, INVMASK(0x08)},
-};
-
-struct ov5640_sensor ov5640_brightness_lv3_tbl[] = {
-/* Brightness -1 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5587, 0x10},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5588, 0x08, INVMASK(0x08)},
-};
-
-struct ov5640_sensor ov5640_brightness_default_lv4_tbl[] = {
-/* Brightness 0 (Default) */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5587, 0x00},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5588, 0x00, INVMASK(0x08)},
-};
-
-struct ov5640_sensor ov5640_brightness_lv5_tbl[] = {
-/* Brightness +1 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5587, 0x10},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5588, 0x00, INVMASK(0x08)},
-};
-
-struct ov5640_sensor ov5640_brightness_lv6_tbl[] = {
-/* Brightness +2 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5587, 0x20},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5588, 0x00, INVMASK(0x08)},
-};
-
-struct ov5640_sensor ov5640_brightness_lv7_tbl[] = {
-/* Brightness +3 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5587, 0x30},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5588, 0x00, INVMASK(0x08)},
-};
-
-struct ov5640_sensor ov5640_brightness_lv8_tbl[] = {
-/* Brightness +4 */
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5587, 0x40},
-	{0x5580, 0x04, INVMASK(0x04)},
-	{0x5588, 0x00, INVMASK(0x08)},
-};
-
-/* Exposure Compensation */
-struct ov5640_sensor ov5640_exposure_compensation_lv0_tbl[] = {
-	/* @@ +1.7EV */
-	{0x3a0f, 0x60},
-	{0x3a10, 0x58},
-	{0x3a11, 0xa0},
-	{0x3a1b, 0x60},
-	{0x3a1e, 0x58},
-	{0x3a1f, 0x20},
-};
-
-struct ov5640_sensor ov5640_exposure_compensation_lv1_tbl[] = {
-	/* @@ +1.0EV */
-	{0x3a0f, 0x50},
-	{0x3a10, 0x48},
-	{0x3a11, 0x90},
-	{0x3a1b, 0x50},
-	{0x3a1e, 0x48},
-	{0x3a1f, 0x20},
-};
-
-struct ov5640_sensor ov5640_exposure_compensation_lv2_default_tbl[] = {
-	/* @@ default */
-	{0x3a0f, 0x38},
-	{0x3a10, 0x30},
-	{0x3a11, 0x61},
-	{0x3a1b, 0x38},
-	{0x3a1e, 0x30},
-	{0x3a1f, 0x10},
-};
-
-struct ov5640_sensor ov5640_exposure_compensation_lv3_tbl[] = {
-	/* @@ -1.0EV */
-	{0x3a0f, 0x20},
-	{0x3a10, 0x18},
-	{0x3a11, 0x41},
-	{0x3a1b, 0x20},
-	{0x3a1e, 0x18},
-	{0x3a1f, 0x10},
-};
-
-struct ov5640_sensor ov5640_exposure_compensation_lv4_tbl[] = {
-	/* @@ -1.7EV */
-	{0x3a0f, 0x10},
-	{0x3a10, 0x08},
-	{0x3a11, 0x10},
-	{0x3a1b, 0x08},
-	{0x3a1e, 0x20},
-	{0x3a1f, 0x10},
-};
-
-/* Auto Expourse Weight */
-
-struct ov5640_sensor ov5640_ae_average_tbl[] = {
-  /* Whole Image Average */
-	{0x5688, 0x11}, /* Zone 1/Zone 0 weight */
-	{0x5689, 0x11}, /* Zone 3/Zone 2 weight */
-	{0x569a, 0x11}, /* Zone 5/Zone 4 weight */
-	{0x569b, 0x11}, /* Zone 7/Zone 6 weight */
-	{0x569c, 0x11}, /* Zone 9/Zone 8 weight */
-	{0x569d, 0x11}, /* Zone b/Zone a weight */
-	{0x569e, 0x11}, /* Zone d/Zone c weight */
-	{0x569f, 0x11}, /* Zone f/Zone e weight */
-};
-
-struct ov5640_sensor ov5640_ae_centerweight_tbl[] = {
-  /* Whole Image Center More weight */
-	{0x5688, 0x62},
-	{0x5689, 0x26},
-	{0x568a, 0xe6},
-	{0x568b, 0x6e},
-	{0x568c, 0xea},
-	{0x568d, 0xae},
-	{0x568e, 0xa6},
-	{0x568f, 0x6a},
-};
-
-/* Light Mode */
-struct ov5640_sensor ov5640_wb_def[] = {
-	{0x3406, 0x00, INVMASK(0x01)},
-};
-
-struct ov5640_sensor ov5640_wb_custom[] = {
-	{0x3406, 0x01, INVMASK(0x01)},
-	{0x3400, 0x04},
-	{0x3401, 0x58},
-	{0x3402, 0x04},
-	{0x3403, 0x00},
-	{0x3404, 0x08},
-	{0x3405, 0x40},
-};
-
-struct ov5640_sensor ov5640_wb_inc[] = {
-	{0x3406, 0x01, INVMASK(0x01)},
-	{0x3400, 0x04},
-	{0x3401, 0x88},
-	{0x3402, 0x04},
-	{0x3403, 0x00},
-	{0x3404, 0x08},
-	{0x3405, 0xb6},
-};
-
-struct ov5640_sensor ov5640_wb_daylight[] = {
-	{0x3406, 0x01, INVMASK(0x01)},
-	{0x3400, 0x07},
-	{0x3401, 0x02},
-	{0x3402, 0x04},
-	{0x3403, 0x00},
-	{0x3404, 0x05},
-	{0x3405, 0x15},
-};
-
-struct ov5640_sensor ov5640_wb_cloudy[] = {
-	{0x3406, 0x01, INVMASK(0x01)},
-	{0x3400, 0x07},
-	{0x3401, 0x88},
-	{0x3402, 0x04},
-	{0x3403, 0x00},
-	{0x3404, 0x05},
-	{0x3405, 0x00},
-};
-
-/* EFFECT */
-struct ov5640_sensor ov5640_effect_normal_tbl[] = {
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x00, INVMASK(0x78)},
-	{0x5003, 0x08},
-	{0x5583, 0x40},
-	{0x5584, 0x40},
-};
-
-struct ov5640_sensor ov5640_effect_mono_tbl[] = {
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x20, INVMASK(0x78)},
-	{0x5003, 0x08},
-	{0x5583, 0x40},
-	{0x5584, 0x40},
-};
-
-struct ov5640_sensor ov5640_effect_bw_tbl[] = {
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x18, INVMASK(0x78)},
-	{0x5003, 0x08},
-	{0x5583, 0x80},
-	{0x5584, 0x80},
-};
-
-struct ov5640_sensor ov5640_effect_bluish_tbl[] = {
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x18, INVMASK(0x78)},
-	{0x5003, 0x08},
-	{0x5583, 0xa0},
-	{0x5584, 0x40},
-};
-
-struct ov5640_sensor ov5640_effect_solarize_tbl[] = {
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x00, INVMASK(0x78)},
-	{0x5003, 0x09},
-};
-
-
-struct ov5640_sensor ov5640_effect_sepia_tbl[] = {
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x18, INVMASK(0x78)},
-	{0x5003, 0x08},
-	{0x5583, 0x40},
-	{0x5584, 0xa0},
-};
-
-struct ov5640_sensor ov5640_effect_reddish_tbl[] = {
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x18, INVMASK(0x78)},
-	{0x5003, 0x08},
-	{0x5583, 0x80},
-	{0x5584, 0xc0},
-};
-
-struct ov5640_sensor ov5640_effect_greenish_tbl[] = {
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x18, INVMASK(0x78)},
-	{0x5003, 0x08},
-	{0x5583, 0x60},
-	{0x5584, 0x60},
-};
-
-struct ov5640_sensor ov5640_effect_negative_tbl[] = {
-	{0x5001, 0x83, INVMASK(0x80)},
-	{0x5580, 0x40, INVMASK(0x78)},
-	{0x5003, 0x08},
-};
-
-/* AntiBanding */
-struct ov5640_sensor ov5640_antibanding_auto_tbl[] = {
-  /* Auto-XCLK24MHz */
-	{0x3622, 0x01}, /* PD-sel */
-	{0x3635, 0x1c}, /* VMREF 3635[2:0] */
-	{0x3634, 0x40}, /* I_5060 3643[2:0] */
-	{0x3c01, 0x34},
-	{0x3c00, 0x00},
-	{0x3c04, 0x28},
-	{0x3c05, 0x98},
-	{0x3c06, 0x00},
-	{0x3c07, 0x08},
-	{0x3c08, 0x00},
-	{0x3c09, 0x1c},
-	{0x300c, 0x22}, /* 50/60div 300c[2:0] */
-	{0x3c0a, 0x9c},
-	{0x3c0b, 0x40},
-};
-
-struct ov5640_sensor ov5640_antibanding_50z_tbl[] = {
-  /* Band 50Hz */
-	{0x3c01, 0x80, INVMASK(0x80)},
-	{0x3c00, 0x04},
-};
-
-struct ov5640_sensor ov5640_antibanding_60z_tbl[] = {
-  /* Band 60Hz */
-	{0x3c01, 0x80, INVMASK(0x80)},
-	{0x3c00, 0x00},
-};
-
-
-/* Lens_shading */
-
-struct ov5640_sensor ov5640_lens_shading_on_tbl[] = {
-	/* @@ Lenc On(C) */
-	{0x5000, 0x80, INVMASK(0x80)},
-};
-
-struct ov5640_sensor ov5640_lens_shading_off_tbl[] = {
-	/*  Lenc Off */
-	{0x5000, 0x00, INVMASK(0x80)},
-};
-
-/* Auto Focus Firmware-use 2011-08-24 firmware settings */
-u8 ov5640_afinit_tbl[] = {
-	0x80,	0x00,	0x02,	0x0b,	0x7b,	0x02,	0x07,	0xbd,	0xc2,
-	0x01,	0x22,	0x22,	0x00,	0x02,	0x0b,	0x57,	0xe5,	0x1f,
-	0x70,	0x72,	0xf5,	0x1e,	0xd2,	0x35,	0xff,	0xef,	0x25,
-	0xe0,	0x24,	0x4b,	0xf8,	0xe4,	0xf6,	0x08,	0xf6,	0x0f,
-	0xbf,	0x34,	0xf2,	0x90,	0x0e,	0x88,	0xe4,	0x93,	0xff,
-	0xe5,	0x49,	0xc3,	0x9f,	0x50,	0x04,	0x7f,	0x05,	0x80,
-	0x02,	0x7f,	0xfb,	0x78,	0xba,	0xa6,	0x07,	0x12,	0x0a,
-	0xb4,	0x40,	0x04,	0x7f,	0x03,	0x80,	0x02,	0x7f,	0x30,
-	0x78,	0xb9,	0xa6,	0x07,	0xe6,	0x18,	0xf6,	0x08,	0xe6,
-	0x78,	0xb6,	0xf6,	0x78,	0xb9,	0xe6,	0x78,	0xb7,	0xf6,
-	0x78,	0xbc,	0x76,	0x33,	0xe4,	0x08,	0xf6,	0x78,	0xb5,
-	0x76,	0x01,	0x75,	0x48,	0x02,	0x78,	0xb3,	0xf6,	0x08,
-	0xf6,	0x74,	0xff,	0x78,	0xbe,	0xf6,	0x08,	0xf6,	0x75,
-	0x1f,	0x01,	0x78,	0xb9,	0xe6,	0x75,	0xf0,	0x05,	0xa4,
-	0xf5,	0x49,	0x12,	0x08,	0x5b,	0xc2,	0x37,	0x22,	0x78,
-	0xb5,	0xe6,	0xd3,	0x94,	0x00,	0x40,	0x02,	0x16,	0x22,
-	0xe5,	0x1f,	0x64,	0x05,	0x70,	0x28,	0xf5,	0x1f,	0xc2,
-	0x01,	0x78,	0xb6,	0xe6,	0x25,	0xe0,	0x24,	0x4b,	0xf8,
-	0xe6,	0xfe,	0x08,	0xe6,	0xff,	0x78,	0x4b,	0xa6,	0x06,
-	0x08,	0xa6,	0x07,	0xa2,	0x37,	0xe4,	0x33,	0xf5,	0x3c,
-	0x90,	0x30,	0x28,	0xf0,	0x75,	0x1e,	0x10,	0xd2,	0x35,
-	0x22,	0xe5,	0x49,	0x75,	0xf0,	0x05,	0x84,	0x78,	0xb9,
-	0xf6,	0x90,	0x0e,	0x85,	0xe4,	0x93,	0xff,	0x25,	0xe0,
-	0x24,	0x0a,	0xf8,	0xe6,	0xfc,	0x08,	0xe6,	0xfd,	0x78,
-	0xb9,	0xe6,	0x25,	0xe0,	0x24,	0x4b,	0xf8,	0xa6,	0x04,
-	0x08,	0xa6,	0x05,	0xef,	0x12,	0x0a,	0xbb,	0xd3,	0x78,
-	0xb4,	0x96,	0xee,	0x18,	0x96,	0x40,	0x0d,	0x78,	0xb9,
-	0xe6,	0x78,	0xb6,	0xf6,	0x78,	0xb3,	0xa6,	0x06,	0x08,
-	0xa6,	0x07,	0x90,	0x0e,	0x85,	0xe4,	0x93,	0x12,	0x0a,
-	0xbb,	0xc3,	0x78,	0xbf,	0x96,	0xee,	0x18,	0x96,	0x50,
-	0x0d,	0x78,	0xb9,	0xe6,	0x78,	0xb7,	0xf6,	0x78,	0xbe,
-	0xa6,	0x06,	0x08,	0xa6,	0x07,	0x78,	0xb3,	0xe6,	0xfe,
-	0x08,	0xe6,	0xc3,	0x78,	0xbf,	0x96,	0xff,	0xee,	0x18,
-	0x96,	0x78,	0xc0,	0xf6,	0x08,	0xa6,	0x07,	0x90,	0x0e,
-	0x8a,	0xe4,	0x18,	0x12,	0x0a,	0x99,	0xc3,	0x33,	0xce,
-	0x33,	0xce,	0xd8,	0xf9,	0xff,	0xd3,	0xed,	0x9f,	0xec,
-	0x9e,	0x40,	0x02,	0xd2,	0x37,	0x78,	0xb9,	0xe6,	0x08,
-	0x26,	0x08,	0xf6,	0xe5,	0x1f,	0x64,	0x01,	0x70,	0x55,
-	0xe6,	0xc3,	0x78,	0xbd,	0x12,	0x0a,	0x8f,	0x40,	0x10,
-	0x12,	0x0a,	0x8a,	0x50,	0x0b,	0x30,	0x37,	0x41,	0x78,
-	0xb9,	0xe6,	0x78,	0xb6,	0x66,	0x60,	0x39,	0x12,	0x0a,
-	0xb2,	0x40,	0x04,	0x7f,	0xfe,	0x80,	0x02,	0x7f,	0x02,
-	0x78,	0xba,	0xa6,	0x07,	0x78,	0xb6,	0xe6,	0x24,	0x03,
-	0x78,	0xbc,	0xf6,	0x78,	0xb6,	0xe6,	0x24,	0xfd,	0x78,
-	0xbd,	0xf6,	0x12,	0x0a,	0xb2,	0x40,	0x06,	0x78,	0xbd,
-	0xe6,	0xff,	0x80,	0x04,	0x78,	0xbc,	0xe6,	0xff,	0x78,
-	0xbb,	0xa6,	0x07,	0x75,	0x1f,	0x02,	0x78,	0xb5,	0x76,
-	0x01,	0x02,	0x02,	0x68,	0xe5,	0x1f,	0x64,	0x02,	0x60,
-	0x03,	0x02,	0x02,	0x48,	0x78,	0xbb,	0xe6,	0xff,	0xc3,
-	0x78,	0xbd,	0x12,	0x0a,	0x90,	0x40,	0x08,	0x12,	0x0a,
-	0x8a,	0x50,	0x03,	0x02,	0x02,	0x46,	0x12,	0x0a,	0xb2,
-	0x40,	0x04,	0x7f,	0xff,	0x80,	0x02,	0x7f,	0x01,	0x78,
-	0xba,	0xa6,	0x07,	0x78,	0xb6,	0xe6,	0x04,	0x78,	0xbc,
-	0xf6,	0x78,	0xb6,	0xe6,	0x14,	0x78,	0xbd,	0xf6,	0x18,
-	0x12,	0x0a,	0xb4,	0x40,	0x04,	0xe6,	0xff,	0x80,	0x02,
-	0x7f,	0x00,	0x78,	0xbc,	0xa6,	0x07,	0xd3,	0x08,	0xe6,
-	0x64,	0x80,	0x94,	0x80,	0x40,	0x04,	0xe6,	0xff,	0x80,
-	0x02,	0x7f,	0x00,	0x78,	0xbd,	0xa6,	0x07,	0xc3,	0x18,
-	0xe6,	0x64,	0x80,	0x94,	0xb3,	0x50,	0x04,	0xe6,	0xff,
-	0x80,	0x02,	0x7f,	0x33,	0x78,	0xbc,	0xa6,	0x07,	0xc3,
-	0x08,	0xe6,	0x64,	0x80,	0x94,	0xb3,	0x50,	0x04,	0xe6,
-	0xff,	0x80,	0x02,	0x7f,	0x33,	0x78,	0xbd,	0xa6,	0x07,
-	0x12,	0x0a,	0xb2,	0x40,	0x06,	0x78,	0xbd,	0xe6,	0xff,
-	0x80,	0x04,	0x78,	0xbc,	0xe6,	0xff,	0x78,	0xbb,	0xa6,
-	0x07,	0x75,	0x1f,	0x03,	0x78,	0xb5,	0x76,	0x01,	0x80,
-	0x20,	0xe5,	0x1f,	0x64,	0x03,	0x70,	0x26,	0x78,	0xbb,
-	0xe6,	0xff,	0xc3,	0x78,	0xbd,	0x12,	0x0a,	0x90,	0x40,
-	0x05,	0x12,	0x0a,	0x8a,	0x40,	0x09,	0x78,	0xb6,	0xe6,
-	0x78,	0xbb,	0xf6,	0x75,	0x1f,	0x04,	0x78,	0xbb,	0xe6,
-	0x75,	0xf0,	0x05,	0xa4,	0xf5,	0x49,	0x02,	0x08,	0x5b,
-	0xe5,	0x1f,	0xb4,	0x04,	0x1d,	0x90,	0x0e,	0x89,	0xe4,
-	0x78,	0xc0,	0x12,	0x0a,	0x99,	0xc3,	0x33,	0xce,	0x33,
-	0xce,	0xd8,	0xf9,	0xff,	0xd3,	0xed,	0x9f,	0xec,	0x9e,
-	0x40,	0x02,	0xd2,	0x37,	0x75,	0x1f,	0x05,	0x22,	0xef,
-	0x8d,	0xf0,	0xa4,	0xa8,	0xf0,	0xcf,	0x8c,	0xf0,	0xa4,
-	0x28,	0xce,	0x8d,	0xf0,	0xa4,	0x2e,	0xfe,	0x22,	0xbc,
-	0x00,	0x0b,	0xbe,	0x00,	0x29,	0xef,	0x8d,	0xf0,	0x84,
-	0xff,	0xad,	0xf0,	0x22,	0xe4,	0xcc,	0xf8,	0x75,	0xf0,
-	0x08,	0xef,	0x2f,	0xff,	0xee,	0x33,	0xfe,	0xec,	0x33,
-	0xfc,	0xee,	0x9d,	0xec,	0x98,	0x40,	0x05,	0xfc,	0xee,
-	0x9d,	0xfe,	0x0f,	0xd5,	0xf0,	0xe9,	0xe4,	0xce,	0xfd,
-	0x22,	0xed,	0xf8,	0xf5,	0xf0,	0xee,	0x84,	0x20,	0xd2,
-	0x1c,	0xfe,	0xad,	0xf0,	0x75,	0xf0,	0x08,	0xef,	0x2f,
-	0xff,	0xed,	0x33,	0xfd,	0x40,	0x07,	0x98,	0x50,	0x06,
-	0xd5,	0xf0,	0xf2,	0x22,	0xc3,	0x98,	0xfd,	0x0f,	0xd5,
-	0xf0,	0xea,	0x22,	0xe8,	0x8f,	0xf0,	0xa4,	0xcc,	0x8b,
-	0xf0,	0xa4,	0x2c,	0xfc,	0xe9,	0x8e,	0xf0,	0xa4,	0x2c,
-	0xfc,	0x8a,	0xf0,	0xed,	0xa4,	0x2c,	0xfc,	0xea,	0x8e,
-	0xf0,	0xa4,	0xcd,	0xa8,	0xf0,	0x8b,	0xf0,	0xa4,	0x2d,
-	0xcc,	0x38,	0x25,	0xf0,	0xfd,	0xe9,	0x8f,	0xf0,	0xa4,
-	0x2c,	0xcd,	0x35,	0xf0,	0xfc,	0xeb,	0x8e,	0xf0,	0xa4,
-	0xfe,	0xa9,	0xf0,	0xeb,	0x8f,	0xf0,	0xa4,	0xcf,	0xc5,
-	0xf0,	0x2e,	0xcd,	0x39,	0xfe,	0xe4,	0x3c,	0xfc,	0xea,
-	0xa4,	0x2d,	0xce,	0x35,	0xf0,	0xfd,	0xe4,	0x3c,	0xfc,
-	0x22,	0x75,	0xf0,	0x08,	0x75,	0x82,	0x00,	0xef,	0x2f,
-	0xff,	0xee,	0x33,	0xfe,	0xcd,	0x33,	0xcd,	0xcc,	0x33,
-	0xcc,	0xc5,	0x82,	0x33,	0xc5,	0x82,	0x9b,	0xed,	0x9a,
-	0xec,	0x99,	0xe5,	0x82,	0x98,	0x40,	0x0c,	0xf5,	0x82,
-	0xee,	0x9b,	0xfe,	0xed,	0x9a,	0xfd,	0xec,	0x99,	0xfc,
-	0x0f,	0xd5,	0xf0,	0xd6,	0xe4,	0xce,	0xfb,	0xe4,	0xcd,
-	0xfa,	0xe4,	0xcc,	0xf9,	0xa8,	0x82,	0x22,	0xb8,	0x00,
-	0xc1,	0xb9,	0x00,	0x59,	0xba,	0x00,	0x2d,	0xec,	0x8b,
-	0xf0,	0x84,	0xcf,	0xce,	0xcd,	0xfc,	0xe5,	0xf0,	0xcb,
-	0xf9,	0x78,	0x18,	0xef,	0x2f,	0xff,	0xee,	0x33,	0xfe,
-	0xed,	0x33,	0xfd,	0xec,	0x33,	0xfc,	0xeb,	0x33,	0xfb,
-	0x10,	0xd7,	0x03,	0x99,	0x40,	0x04,	0xeb,	0x99,	0xfb,
-	0x0f,	0xd8,	0xe5,	0xe4,	0xf9,	0xfa,	0x22,	0x78,	0x18,
-	0xef,	0x2f,	0xff,	0xee,	0x33,	0xfe,	0xed,	0x33,	0xfd,
-	0xec,	0x33,	0xfc,	0xc9,	0x33,	0xc9,	0x10,	0xd7,	0x05,
-	0x9b,	0xe9,	0x9a,	0x40,	0x07,	0xec,	0x9b,	0xfc,	0xe9,
-	0x9a,	0xf9,	0x0f,	0xd8,	0xe0,	0xe4,	0xc9,	0xfa,	0xe4,
-	0xcc,	0xfb,	0x22,	0x75,	0xf0,	0x10,	0xef,	0x2f,	0xff,
-	0xee,	0x33,	0xfe,	0xed,	0x33,	0xfd,	0xcc,	0x33,	0xcc,
-	0xc8,	0x33,	0xc8,	0x10,	0xd7,	0x07,	0x9b,	0xec,	0x9a,
-	0xe8,	0x99,	0x40,	0x0a,	0xed,	0x9b,	0xfd,	0xec,	0x9a,
-	0xfc,	0xe8,	0x99,	0xf8,	0x0f,	0xd5,	0xf0,	0xda,	0xe4,
-	0xcd,	0xfb,	0xe4,	0xcc,	0xfa,	0xe4,	0xc8,	0xf9,	0x22,
-	0xeb,	0x9f,	0xf5,	0xf0,	0xea,	0x9e,	0x42,	0xf0,	0xe9,
-	0x9d,	0x42,	0xf0,	0xe8,	0x9c,	0x45,	0xf0,	0x22,	0xe8,
-	0x60,	0x0f,	0xef,	0xc3,	0x33,	0xff,	0xee,	0x33,	0xfe,
-	0xed,	0x33,	0xfd,	0xec,	0x33,	0xfc,	0xd8,	0xf1,	0x22,
-	0xe4,	0x93,	0xfc,	0x74,	0x01,	0x93,	0xfd,	0x74,	0x02,
-	0x93,	0xfe,	0x74,	0x03,	0x93,	0xff,	0x22,	0xe6,	0xfb,
-	0x08,	0xe6,	0xf9,	0x08,	0xe6,	0xfa,	0x08,	0xe6,	0xcb,
-	0xf8,	0x22,	0xec,	0xf6,	0x08,	0xed,	0xf6,	0x08,	0xee,
-	0xf6,	0x08,	0xef,	0xf6,	0x22,	0xa4,	0x25,	0x82,	0xf5,
-	0x82,	0xe5,	0xf0,	0x35,	0x83,	0xf5,	0x83,	0x22,	0xd0,
-	0x83,	0xd0,	0x82,	0xf8,	0xe4,	0x93,	0x70,	0x12,	0x74,
-	0x01,	0x93,	0x70,	0x0d,	0xa3,	0xa3,	0x93,	0xf8,	0x74,
-	0x01,	0x93,	0xf5,	0x82,	0x88,	0x83,	0xe4,	0x73,	0x74,
-	0x02,	0x93,	0x68,	0x60,	0xef,	0xa3,	0xa3,	0xa3,	0x80,
-	0xdf,	0x90,	0x38,	0x04,	0x78,	0x4f,	0x12,	0x09,	0x50,
-	0x90,	0x38,	0x00,	0xe0,	0xfe,	0xa3,	0xe0,	0xfd,	0xed,
-	0xff,	0xc3,	0x12,	0x09,	0x09,	0x90,	0x38,	0x10,	0x12,
-	0x08,	0xfd,	0x90,	0x38,	0x06,	0x78,	0x51,	0x12,	0x09,
-	0x50,	0x90,	0x38,	0x02,	0xe0,	0xfe,	0xa3,	0xe0,	0xfd,
-	0xed,	0xff,	0xc3,	0x12,	0x09,	0x09,	0x90,	0x38,	0x12,
-	0x12,	0x08,	0xfd,	0xa3,	0xe0,	0xb4,	0x31,	0x07,	0x78,
-	0x4f,	0x79,	0x4f,	0x12,	0x09,	0x66,	0x90,	0x38,	0x14,
-	0xe0,	0xb4,	0x71,	0x15,	0x78,	0x4f,	0xe6,	0xfe,	0x08,
-	0xe6,	0x78,	0x02,	0xce,	0xc3,	0x13,	0xce,	0x13,	0xd8,
-	0xf9,	0x79,	0x50,	0xf7,	0xee,	0x19,	0xf7,	0x90,	0x38,
-	0x15,	0xe0,	0xb4,	0x31,	0x07,	0x78,	0x51,	0x79,	0x51,
-	0x12,	0x09,	0x66,	0x90,	0x38,	0x15,	0xe0,	0xb4,	0x71,
-	0x15,	0x78,	0x51,	0xe6,	0xfe,	0x08,	0xe6,	0x78,	0x02,
-	0xce,	0xc3,	0x13,	0xce,	0x13,	0xd8,	0xf9,	0x79,	0x52,
-	0xf7,	0xee,	0x19,	0xf7,	0x79,	0x4f,	0x12,	0x09,	0x38,
-	0x09,	0x12,	0x09,	0x38,	0xaf,	0x45,	0x12,	0x08,	0xee,
-	0x7d,	0x50,	0x12,	0x02,	0xa9,	0x78,	0x57,	0xa6,	0x06,
-	0x08,	0xa6,	0x07,	0xaf,	0x43,	0x12,	0x08,	0xee,	0x7d,
-	0x50,	0x12,	0x02,	0xa9,	0x78,	0x53,	0xa6,	0x06,	0x08,
-	0xa6,	0x07,	0xaf,	0x46,	0x78,	0x51,	0x12,	0x08,	0xf0,
-	0x7d,	0x3c,	0x12,	0x02,	0xa9,	0x78,	0x59,	0xa6,	0x06,
-	0x08,	0xa6,	0x07,	0xaf,	0x44,	0x7e,	0x00,	0x78,	0x51,
-	0x12,	0x08,	0xf2,	0x7d,	0x3c,	0x12,	0x02,	0xa9,	0x78,
-	0x55,	0xa6,	0x06,	0x08,	0xa6,	0x07,	0xc3,	0x78,	0x58,
-	0xe6,	0x94,	0x08,	0x18,	0xe6,	0x94,	0x00,	0x50,	0x05,
-	0x76,	0x00,	0x08,	0x76,	0x08,	0xc3,	0x78,	0x5a,	0xe6,
-	0x94,	0x08,	0x18,	0xe6,	0x94,	0x00,	0x50,	0x05,	0x76,
-	0x00,	0x08,	0x76,	0x08,	0x78,	0x57,	0x12,	0x09,	0x25,
-	0xff,	0xd3,	0x78,	0x54,	0xe6,	0x9f,	0x18,	0xe6,	0x9e,
-	0x40,	0x0e,	0x78,	0x57,	0xe6,	0x13,	0xfe,	0x08,	0xe6,
-	0x78,	0x54,	0x12,	0x09,	0x5b,	0x80,	0x04,	0x7e,	0x00,
-	0x7f,	0x00,	0x78,	0x5b,	0x12,	0x09,	0x1d,	0xff,	0xd3,
-	0x78,	0x56,	0xe6,	0x9f,	0x18,	0xe6,	0x9e,	0x40,	0x0e,
-	0x78,	0x59,	0xe6,	0x13,	0xfe,	0x08,	0xe6,	0x78,	0x56,
-	0x12,	0x09,	0x5b,	0x80,	0x04,	0x7e,	0x00,	0x7f,	0x00,
-	0xe4,	0xfc,	0xfd,	0x78,	0x5f,	0x12,	0x04,	0x5c,	0x78,
-	0x57,	0x12,	0x09,	0x25,	0x78,	0x54,	0x26,	0xff,	0xee,
-	0x18,	0x36,	0xfe,	0x78,	0x63,	0x12,	0x09,	0x1d,	0x78,
-	0x56,	0x26,	0xff,	0xee,	0x18,	0x36,	0xfe,	0xe4,	0xfc,
-	0xfd,	0x78,	0x67,	0x12,	0x04,	0x5c,	0x12,	0x09,	0x2d,
-	0x78,	0x63,	0x12,	0x04,	0x4f,	0xd3,	0x12,	0x04,	0x1b,
-	0x40,	0x08,	0x12,	0x09,	0x2d,	0x78,	0x63,	0x12,	0x04,
-	0x5c,	0x78,	0x51,	0x12,	0x09,	0x2f,	0x78,	0x67,	0x12,
-	0x04,	0x4f,	0xd3,	0x12,	0x04,	0x1b,	0x40,	0x0a,	0x78,
-	0x51,	0x12,	0x09,	0x2f,	0x78,	0x67,	0x12,	0x04,	0x5c,
-	0xe4,	0xfd,	0x78,	0x5e,	0x12,	0x09,	0x48,	0x24,	0x01,
-	0x12,	0x09,	0x11,	0x78,	0x62,	0x12,	0x09,	0x48,	0x24,
-	0x02,	0x12,	0x09,	0x11,	0x78,	0x66,	0x12,	0x09,	0x48,
-	0x24,	0x03,	0x12,	0x09,	0x11,	0x78,	0x6a,	0x12,	0x09,
-	0x48,	0x24,	0x04,	0x12,	0x09,	0x11,	0x0d,	0xbd,	0x05,
-	0xd4,	0xc2,	0x0e,	0xc2,	0x06,	0x22,	0x85,	0x08,	0x41,
-	0x90,	0x30,	0x24,	0xe0,	0xf5,	0x3d,	0xa3,	0xe0,	0xf5,
-	0x3e,	0xa3,	0xe0,	0xf5,	0x3f,	0xa3,	0xe0,	0xf5,	0x40,
-	0xa3,	0xe0,	0xf5,	0x3c,	0xd2,	0x34,	0xe5,	0x41,	0x12,
-	0x04,	0x74,	0x06,	0xc7,	0x03,	0x06,	0xcb,	0x04,	0x06,
-	0xd1,	0x07,	0x06,	0xda,	0x08,	0x06,	0xeb,	0x12,	0x07,
-	0x03,	0x18,	0x07,	0x19,	0x19,	0x06,	0xee,	0x1a,	0x06,
-	0xfa,	0x1b,	0x07,	0x3e,	0x80,	0x07,	0x43,	0x81,	0x07,
-	0xa1,	0x8f,	0x07,	0x90,	0x90,	0x07,	0xa1,	0x91,	0x07,
-	0xa1,	0x92,	0x07,	0xa1,	0x93,	0x07,	0xa1,	0x94,	0x07,
-	0xa1,	0x98,	0x07,	0x9e,	0x9f,	0x00,	0x00,	0x07,	0xbc,
-	0x12,	0x0a,	0xf4,	0x22,	0x12,	0x0a,	0xf4,	0xd2,	0x03,
-	0x22,	0xa2,	0x37,	0xe4,	0x33,	0xf5,	0x3c,	0x02,	0x07,
-	0xa1,	0xc2,	0x01,	0xc2,	0x02,	0xc2,	0x03,	0x12,	0x09,
-	0x70,	0x75,	0x1e,	0x70,	0xd2,	0x35,	0x02,	0x07,	0xa1,
-	0x02,	0x07,	0x8b,	0x85,	0x40,	0x48,	0x85,	0x3c,	0x49,
-	0x12,	0x08,	0x5b,	0x02,	0x07,	0xa1,	0x85,	0x48,	0x40,
-	0x85,	0x49,	0x3c,	0x02,	0x07,	0xa1,	0xe4,	0xf5,	0x22,
-	0xf5,	0x23,	0x85,	0x40,	0x31,	0x85,	0x3f,	0x30,	0x85,
-	0x3e,	0x2f,	0x85,	0x3d,	0x2e,	0x12,	0x0a,	0xc6,	0x80,
-	0x1f,	0x75,	0x22,	0x00,	0x75,	0x23,	0x01,	0x74,	0xff,
-	0xf5,	0x2d,	0xf5,	0x2c,	0xf5,	0x2b,	0xf5,	0x2a,	0x12,
-	0x0a,	0xc6,	0x85,	0x2d,	0x40,	0x85,	0x2c,	0x3f,	0x85,
-	0x2b,	0x3e,	0x85,	0x2a,	0x3d,	0xe4,	0xf5,	0x3c,	0x02,
-	0x07,	0xa1,	0x12,	0x0b,	0x3d,	0x80,	0x5e,	0x85,	0x3d,
-	0x43,	0x85,	0x3e,	0x44,	0xe5,	0x45,	0xc3,	0x13,	0xff,
-	0xe5,	0x43,	0xc3,	0x9f,	0x50,	0x02,	0x8f,	0x43,	0xe5,
-	0x46,	0xc3,	0x13,	0xff,	0xe5,	0x44,	0xc3,	0x9f,	0x50,
-	0x02,	0x8f,	0x44,	0xe5,	0x45,	0xc3,	0x13,	0xff,	0xfd,
-	0xe5,	0x43,	0x90,	0x0e,	0x7f,	0x12,	0x0b,	0x10,	0x40,
-	0x04,	0xee,	0x9f,	0xf5,	0x43,	0xe5,	0x46,	0xc3,	0x13,
-	0xff,	0xfd,	0xe5,	0x44,	0x90,	0x0e,	0x80,	0x12,	0x0b,
-	0x10,	0x40,	0x04,	0xee,	0x9f,	0xf5,	0x44,	0x12,	0x04,
-	0x9a,	0x80,	0x11,	0x85,	0x40,	0x46,	0x85,	0x3f,	0x45,
-	0x85,	0x3e,	0x44,	0x85,	0x3d,	0x43,	0x80,	0x03,	0x02,
-	0x04,	0x9a,	0x90,	0x30,	0x24,	0xe5,	0x3d,	0xf0,	0xa3,
-	0xe5,	0x3e,	0xf0,	0xa3,	0xe5,	0x3f,	0xf0,	0xa3,	0xe5,
-	0x40,	0xf0,	0xa3,	0xe5,	0x3c,	0xf0,	0x90,	0x30,	0x23,
-	0xe4,	0xf0,	0x22,	0xc0,	0xe0,	0xc0,	0x83,	0xc0,	0x82,
-	0xc0,	0xd0,	0x90,	0x3f,	0x0c,	0xe0,	0xf5,	0x32,	0xe5,
-	0x32,	0x30,	0xe3,	0x4c,	0x30,	0x36,	0x3e,	0x90,	0x60,
-	0x19,
-	0xe0,
-	0xf5,
-	0x0a,
-	0xa3,
-	0xe0,
-	0xf5,
-	0x0b,
-	0x90,
-	0x60,
-	0x1d,
-	0xe0,
-	0xf5,
-	0x14,
-	0xa3,
-	0xe0,
-	0xf5,
-	0x15,
-	0x30,
-	0x01,
-	0x06,
-	0x30,
-	0x33,
-	0x03,
-	0xd3,
-	0x80,
-	0x01,
-	0xc3,
-	0x92,
-	0x09,
-	0x30,
-	0x02,
-	0x06,
-	0x30,
-	0x33,
-	0x03,
-	0xd3,
-	0x80,
-	0x01,
-	0xc3,
-	0x92,
-	0x0a,
-	0x30,
-	0x33,
-	0x0c,
-	0x30,
-	0x03,
-	0x09,
-	0x20,
-	0x02,
-	0x06,
-	0x20,
-	0x01,
-	0x03,
-	0xd3,
-	0x80,
-	0x01,
-	0xc3,
-	0x92,
-	0x0b,
-	0x90,
-	0x30,
-	0x01,
-	0xe0,
-	0x44,
-	0x40,
-	0xf0,
-	0xe0,
-	0x54,
-	0xbf,
-	0xf0,
-	0xe5,
-	0x32,
-	0x30,
-	0xe1,
-	0x14,
-	0x30,
-	0x34,
-	0x11,
-	0x90,
-	0x30,
-	0x22,
-	0xe0,
-	0xf5,
-	0x08,
-	0xe4,
-	0xf0,
-	0x30,
-	0x00,
-	0x03,
-	0xd3,
-	0x80,
-	0x01,
-	0xc3,
-	0x92,
-	0x08,
-	0xe5,
-	0x32,
-	0x30,
-	0xe5,
-	0x12,
-	0x90,
-	0x56,
-	0xa1,
-	0xe0,
-	0xf5,
-	0x09,
-	0x30,
-	0x31,
-	0x09,
-	0x30,
-	0x05,
-	0x03,
-	0xd3,
-	0x80,
-	0x01,
-	0xc3,
-	0x92,
-	0x0d,
-	0x90,
-	0x3f,
-	0x0c,
-	0xe5,
-	0x32,
-	0xf0,
-	0xd0,
-	0xd0,
-	0xd0,
-	0x82,
-	0xd0,
-	0x83,
-	0xd0,
-	0xe0,
-	0x32,
-	0x90,
-	0x0e,
-	0x7d,
-	0xe4,
-	0x93,
-	0xfe,
-	0x74,
-	0x01,
-	0x93,
-	0xff,
-	0xc3,
-	0x90,
-	0x0e,
-	0x7b,
-	0x74,
-	0x01,
-	0x93,
-	0x9f,
-	0xff,
-	0xe4,
-	0x93,
-	0x9e,
-	0xfe,
-	0xe4,
-	0x8f,
-	0x3b,
-	0x8e,
-	0x3a,
-	0xf5,
-	0x39,
-	0xf5,
-	0x38,
-	0xab,
-	0x3b,
-	0xaa,
-	0x3a,
-	0xa9,
-	0x39,
-	0xa8,
-	0x38,
-	0xaf,
-	0x49,
-	0xfc,
-	0xfd,
-	0xfe,
-	0x12,
-	0x02,
-	0xfe,
-	0x12,
-	0x0b,
-	0x22,
-	0xe4,
-	0x7b,
-	0xff,
-	0xfa,
-	0xf9,
-	0xf8,
-	0x12,
-	0x03,
-	0x89,
-	0x12,
-	0x0b,
-	0x22,
-	0x90,
-	0x0e,
-	0x69,
-	0xe4,
-	0x12,
-	0x0b,
-	0x37,
-	0x12,
-	0x0b,
-	0x22,
-	0xe4,
-	0x85,
-	0x48,
-	0x37,
-	0xf5,
-	0x36,
-	0xf5,
-	0x35,
-	0xf5,
-	0x34,
-	0xaf,
-	0x37,
-	0xae,
-	0x36,
-	0xad,
-	0x35,
-	0xac,
-	0x34,
-	0xa3,
-	0x12,
-	0x0b,
-	0x37,
-	0x8f,
-	0x37,
-	0x8e,
-	0x36,
-	0x8d,
-	0x35,
-	0x8c,
-	0x34,
-	0xe5,
-	0x3b,
-	0x45,
-	0x37,
-	0xf5,
-	0x3b,
-	0xe5,
-	0x3a,
-	0x45,
-	0x36,
-	0xf5,
-	0x3a,
-	0xe5,
-	0x39,
-	0x45,
-	0x35,
-	0xf5,
-	0x39,
-	0xe5,
-	0x38,
-	0x45,
-	0x34,
-	0xf5,
-	0x38,
-	0xe4,
-	0xf5,
-	0x22,
-	0xf5,
-	0x23,
-	0x85,
-	0x3b,
-	0x31,
-	0x85,
-	0x3a,
-	0x30,
-	0x85,
-	0x39,
-	0x2f,
-	0x85,
-	0x38,
-	0x2e,
-	0x02,
-	0x0a,
-	0xc6,
-	0x78,
-	0x4f,
-	0x7e,
-	0x00,
-	0xe6,
-	0xfc,
-	0x08,
-	0xe6,
-	0xfd,
-	0x12,
-	0x02,
-	0x97,
-	0x7c,
-	0x00,
-	0x22,
-	0xe0,
-	0xa3,
-	0xe0,
-	0x75,
-	0xf0,
-	0x02,
-	0xa4,
-	0xff,
-	0xae,
-	0xf0,
-	0xc3,
-	0x08,
-	0xe6,
-	0x9f,
-	0xf6,
-	0x18,
-	0xe6,
-	0x9e,
-	0xf6,
-	0x22,
-	0xff,
-	0xe5,
-	0xf0,
-	0x34,
-	0x60,
-	0x8f,
-	0x82,
-	0xf5,
-	0x83,
-	0xec,
-	0xf0,
-	0x22,
-	0xe4,
-	0xfc,
-	0xfd,
-	0x12,
-	0x04,
-	0x5c,
-	0x78,
-	0x59,
-	0xe6,
-	0xc3,
-	0x13,
-	0xfe,
-	0x08,
-	0xe6,
-	0x13,
-	0x22,
-	0x78,
-	0x4f,
-	0xe6,
-	0xfe,
-	0x08,
-	0xe6,
-	0xff,
-	0xe4,
-	0xfc,
-	0xfd,
-	0x22,
-	0xe7,
-	0xc4,
-	0xf8,
-	0x54,
-	0xf0,
-	0xc8,
-	0x68,
-	0xf7,
-	0x09,
-	0xe7,
-	0xc4,
-	0x54,
-	0x0f,
-	0x48,
-	0xf7,
-	0x22,
-	0xe6,
-	0xfc,
-	0xed,
-	0x75,
-	0xf0,
-	0x04,
-	0xa4,
-	0x22,
-	0xe0,
-	0xfe,
-	0xa3,
-	0xe0,
-	0xfd,
-	0xee,
-	0xf6,
-	0xed,
-	0x08,
-	0xf6,
-	0x22,
-	0x13,
-	0xff,
-	0xc3,
-	0xe6,
-	0x9f,
-	0xff,
-	0x18,
-	0xe6,
-	0x9e,
-	0xfe,
-	0x22,
-	0xe6,
-	0xc3,
-	0x13,
-	0xf7,
-	0x08,
-	0xe6,
-	0x13,
-	0x09,
-	0xf7,
-	0x22,
-	0xe4,
-	0xf5,
-	0x49,
-	0x90,
-	0x0e,
-	0x77,
-	0x93,
-	0xff,
-	0xe4,
-	0x8f,
-	0x37,
-	0xf5,
-	0x36,
-	0xf5,
-	0x35,
-	0xf5,
-	0x34,
-	0xaf,
-	0x37,
-	0xae,
-	0x36,
-	0xad,
-	0x35,
-	0xac,
-	0x34,
-	0x90,
-	0x0e,
-	0x6a,
-	0x12,
-	0x0b,
-	0x37,
-	0x8f,
-	0x37,
-	0x8e,
-	0x36,
-	0x8d,
-	0x35,
-	0x8c,
-	0x34,
-	0x90,
-	0x0e,
-	0x72,
-	0x12,
-	0x04,
-	0x3f,
-	0xef,
-	0x45,
-	0x37,
-	0xf5,
-	0x37,
-	0xee,
-	0x45,
-	0x36,
-	0xf5,
-	0x36,
-	0xed,
-	0x45,
-	0x35,
-	0xf5,
-	0x35,
-	0xec,
-	0x45,
-	0x34,
-	0xf5,
-	0x34,
-	0xe4,
-	0xf5,
-	0x22,
-	0xf5,
-	0x23,
-	0x85,
-	0x37,
-	0x31,
-	0x85,
-	0x36,
-	0x30,
-	0x85,
-	0x35,
-	0x2f,
-	0x85,
-	0x34,
-	0x2e,
-	0x12,
-	0x0a,
-	0xc6,
-	0xe4,
-	0xf5,
-	0x22,
-	0xf5,
-	0x23,
-	0x90,
-	0x0e,
-	0x72,
-	0x12,
-	0x0b,
-	0x2b,
-	0x12,
-	0x0a,
-	0xc6,
-	0xe4,
-	0xf5,
-	0x22,
-	0xf5,
-	0x23,
-	0x90,
-	0x0e,
-	0x6e,
-	0x12,
-	0x0b,
-	0x2b,
-	0x02,
-	0x0a,
-	0xc6,
-	0x75,
-	0x89,
-	0x03,
-	0x75,
-	0xa8,
-	0x01,
-	0x75,
-	0xb8,
-	0x04,
-	0x75,
-	0x34,
-	0xff,
-	0x75,
-	0x35,
-	0x0e,
-	0x75,
-	0x36,
-	0x15,
-	0x75,
-	0x37,
-	0x0d,
-	0x12,
-	0x0a,
-	0x4a,
-	0x12,
-	0x00,
-	0x09,
-	0x12,
-	0x0b,
-	0x3d,
-	0x12,
-	0x00,
-	0x06,
-	0xd2,
-	0x00,
-	0xd2,
-	0x34,
-	0xd2,
-	0xaf,
-	0x75,
-	0x34,
-	0xff,
-	0x75,
-	0x35,
-	0x0e,
-	0x75,
-	0x36,
-	0x49,
-	0x75,
-	0x37,
-	0x03,
-	0x12,
-	0x0a,
-	0x4a,
-	0x30,
-	0x08,
-	0x09,
-	0xc2,
-	0x34,
-	0x12,
-	0x06,
-	0x6a,
-	0xc2,
-	0x08,
-	0xd2,
-	0x34,
-	0x30,
-	0x09,
-	0x09,
-	0xc2,
-	0x36,
-	0x12,
-	0x00,
-	0x0e,
-	0xc2,
-	0x09,
-	0xd2,
-	0x36,
-	0x30,
-	0x0e,
-	0x03,
-	0x12,
-	0x04,
-	0x9a,
-	0x30,
-	0x35,
-	0xdf,
-	0x90,
-	0x30,
-	0x29,
-	0xe5,
-	0x1e,
-	0xf0,
-	0xb4,
-	0x10,
-	0x05,
-	0x90,
-	0x30,
-	0x23,
-	0xe4,
-	0xf0,
-	0xc2,
-	0x35,
-	0x80,
-	0xcd,
-	0xae,
-	0x35,
-	0xaf,
-	0x36,
-	0xe4,
-	0xfd,
-	0xed,
-	0xc3,
-	0x95,
-	0x37,
-	0x50,
-	0x33,
-	0x12,
-	0x0b,
-	0x87,
-	0xe4,
-	0x93,
-	0xf5,
-	0x38,
-	0x74,
-	0x01,
-	0x93,
-	0xf5,
-	0x39,
-	0x45,
-	0x38,
-	0x60,
-	0x23,
-	0x85,
-	0x39,
-	0x82,
-	0x85,
-	0x38,
-	0x83,
-	0xe0,
-	0xfc,
-	0x12,
-	0x0b,
-	0x87,
-	0x74,
-	0x03,
-	0x93,
-	0x52,
-	0x04,
-	0x12,
-	0x0b,
-	0x87,
-	0x74,
-	0x02,
-	0x93,
-	0x42,
-	0x04,
-	0x85,
-	0x39,
-	0x82,
-	0x85,
-	0x38,
-	0x83,
-	0xec,
-	0xf0,
-	0x0d,
-	0x80,
-	0xc7,
-	0x22,
-	0x78,
-	0xbb,
-	0xe6,
-	0xd3,
-	0x08,
-	0xff,
-	0xe6,
-	0x64,
-	0x80,
-	0xf8,
-	0xef,
-	0x64,
-	0x80,
-	0x98,
-	0x22,
-	0x93,
-	0xff,
-	0x7e,
-	0x00,
-	0xe6,
-	0xfc,
-	0x08,
-	0xe6,
-	0xfd,
-	0x12,
-	0x02,
-	0x97,
-	0xac,
-	0x06,
-	0xad,
-	0x07,
-	0x78,
-	0xb3,
-	0xe6,
-	0xfe,
-	0x08,
-	0xe6,
-	0x78,
-	0x03,
-	0x22,
-	0x78,
-	0xba,
-	0xd3,
-	0xe6,
-	0x64,
-	0x80,
-	0x94,
-	0x80,
-	0x22,
-	0x25,
-	0xe0,
-	0x24,
-	0x0a,
-	0xf8,
-	0xe6,
-	0xfe,
-	0x08,
-	0xe6,
-	0xff,
-	0x22,
-	0xa2,
-	0xaf,
-	0x92,
-	0x32,
-	0xc2,
-	0xaf,
-	0xe5,
-	0x23,
-	0x45,
-	0x22,
-	0x90,
-	0x0e,
-	0x5d,
-	0x60,
-	0x0e,
-	0x12,
-	0x0b,
-	0x70,
-	0xe0,
-	0xf5,
-	0x2c,
-	0x12,
-	0x0b,
-	0x6d,
-	0xe0,
-	0xf5,
-	0x2d,
-	0x80,
-	0x0c,
-	0x12,
-	0x0b,
-	0x70,
-	0xe5,
-	0x30,
-	0xf0,
-	0x12,
-	0x0b,
-	0x6d,
-	0xe5,
-	0x31,
-	0xf0,
-	0xa2,
-	0x32,
-	0x92,
-	0xaf,
-	0x22,
-	0xd2,
-	0x01,
-	0xc2,
-	0x02,
-	0xe4,
-	0xf5,
-	0x1f,
-	0xf5,
-	0x1e,
-	0xd2,
-	0x35,
-	0xd2,
-	0x33,
-	0xd2,
-	0x36,
-	0xd2,
-	0x01,
-	0xc2,
-	0x02,
-	0xf5,
-	0x1f,
-	0xf5,
-	0x1e,
-	0xd2,
-	0x35,
-	0xd2,
-	0x33,
-	0x22,
-	0x2d,
-	0xfd,
-	0xe4,
-	0x33,
-	0xfc,
-	0xe4,
-	0x93,
-	0xfe,
-	0xfb,
-	0xd3,
-	0xed,
-	0x9b,
-	0x74,
-	0x80,
-	0xf8,
-	0x6c,
-	0x98,
-	0x22,
-	0x8f,
-	0x3b,
-	0x8e,
-	0x3a,
-	0x8d,
-	0x39,
-	0x8c,
-	0x38,
-	0x22,
-	0x12,
-	0x04,
-	0x3f,
-	0x8f,
-	0x31,
-	0x8e,
-	0x30,
-	0x8d,
-	0x2f,
-	0x8c,
-	0x2e,
-	0x22,
-	0x93,
-	0xf9,
-	0xf8,
-	0x02,
-	0x04,
-	0x2c,
-	0x90,
-	0x0e,
-	0x81,
-	0x12,
-	0x04,
-	0x3f,
-	0x8f,
-	0x46,
-	0x8e,
-	0x45,
-	0x8d,
-	0x44,
-	0x8c,
-	0x43,
-	0xd2,
-	0x06,
-	0x30,
-	0x06,
-	0x03,
-	0xd3,
-	0x80,
-	0x01,
-	0xc3,
-	0x92,
-	0x0e,
-	0x22,
-	0xc0,
-	0xe0,
-	0xc0,
-	0x83,
-	0xc0,
-	0x82,
-	0x90,
-	0x3f,
-	0x0d,
-	0xe0,
-	0xf5,
-	0x33,
-	0xe5,
-	0x33,
-	0xf0,
-	0xd0,
-	0x82,
-	0xd0,
-	0x83,
-	0xd0,
-	0xe0,
-	0x32,
-	0x90,
-	0x0e,
-	0x5f,
-	0xe4,
-	0x93,
-	0xfe,
-	0x74,
-	0x01,
-	0x93,
-	0xf5,
-	0x82,
-	0x8e,
-	0x83,
-	0x22,
-	0x78,
-	0x7f,
-	0xe4,
-	0xf6,
-	0xd8,
-	0xfd,
-	0x75,
-	0x81,
-	0xca,
-	0x02,
-	0x09,
-	0xe1,
-	0x8f,
-	0x82,
-	0x8e,
-	0x83,
-	0x75,
-	0xf0,
-	0x04,
-	0xed,
-	0x02,
-	0x04,
-	0x68,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x11,
-	0x07,
-	0x21,
-	0x15,
-	0x29,
-	0x13,
-	0x4f,
-	0x56,
-	0x54,
-	0x20,
-	0x20,
-	0x20,
-	0x20,
-	0x20,
-	0x20,
-	0x01,
-	0x10,
-	0x00,
-	0x56,
-	0x40,
-	0x1a,
-	0x30,
-	0x29,
-	0x7e,
-	0x00,
-	0x30,
-	0x04,
-	0x20,
-	0xdf,
-	0x30,
-	0x05,
-	0x40,
-	0xbf,
-	0x50,
-	0x03,
-	0x00,
-	0xfd,
-	0x50,
-	0x27,
-	0x01,
-	0xfe,
-	0x60,
-	0x00,
-	0x11,
-	0x00,
-	0x3f,
-	0x05,
-	0x30,
-	0x00,
-	0x3f,
-	0x06,
-	0x22,
-	0x00,
-	0x3f,
-	0x01,
-	0x2a,
-	0x00,
-	0x3f,
-	0x02,
-	0x00,
-	0x00,
-	0x36,
-	0x06,
-	0x07,
-	0x00,
-	0x3f,
-	0x0b,
-	0x0f,
-	0xf0,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x30,
-	0x01,
-	0x40,
-	0xbf,
-	0x30,
-	0x01,
-	0x00,
-	0xbf,
-	0x30,
-	0x29,
-	0x70,
-	0x00,
-	0x3a,
-	0x00,
-	0x00,
-	0xff,
-	0x3a,
-	0x00,
-	0x00,
-	0xff,
-	0x36,
-	0x03,
-	0x36,
-	0x02,
-	0x41,
-	0x44,
-	0x58,
-	0x20,
-	0x18,
-	0x10,
-	0x0a,
-	0x04,
-	0x04,
-	0x00,
-	0x03,
-	0xff,
-	0x64,
-	0x00,
-	0x00,
-	0x80,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x00,
-	0x02,
-	0x04,
-	0x06,
-	0x00,
-	0x03,
-	0x98,
-	0x00,
-	0xcc,
-	0x50,
-	0x3c,
-	0x28,
-	0x1e,
-	0x10,
-	0x10,
-	0x00,
-	0x00,
-	0x00,
-	0x6e,
-	0x30,
-	0x28,
-	0x00,
-	0xa5,
-	0x5a,
-	0x00,
-};
-
-#endif /* CAMSENSOR_OV5640 */
diff --git a/drivers/media/video/msm/ov5647.c b/drivers/media/video/msm/ov5647.c
deleted file mode 100644
index 365faef..0000000
--- a/drivers/media/video/msm/ov5647.c
+++ /dev/null
@@ -1,1201 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/debugfs.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/slab.h>
-#include <linux/gpio.h>
-#include <linux/bitops.h>
-#include <linux/leds.h>
-#include <mach/camera.h>
-#include <media/msm_camera.h>
-#include "ov5647.h"
-
-/* 16bit address - 8 bit context register structure */
-#define Q8	0x00000100
-#define Q10	0x00000400
-
-#define REG_OV5647_GAIN_MSB           0x350A
-#define REG_OV5647_GAIN_LSB           0x350B
-#define REG_OV5647_LINE_HSB           0x3500
-#define REG_OV5647_LINE_MSB           0x3501
-#define REG_OV5647_LINE_LSB           0x3502
-
-/* MCLK */
-#define OV5647_MASTER_CLK_RATE 24000000
-
-/* AF Total steps parameters */
-#define OV5647_TOTAL_STEPS_NEAR_TO_FAR	32
-
-#define OV5647_REG_PREV_FRAME_LEN_1	31
-#define OV5647_REG_PREV_FRAME_LEN_2	32
-#define OV5647_REG_PREV_LINE_LEN_1	33
-#define OV5647_REG_PREV_LINE_LEN_2	34
-
-#define OV5647_REG_SNAP_FRAME_LEN_1	15
-#define OV5647_REG_SNAP_FRAME_LEN_2	16
-#define OV5647_REG_SNAP_LINE_LEN_1	17
-#define OV5647_REG_SNAP_LINE_LEN_2	18
-#define MSB                             1
-#define LSB                             0
-
-/* Debug switch */
-#ifdef CDBG
-#undef CDBG
-#endif
-#ifdef CDBG_HIGH
-#undef CDBG_HIGH
-#endif
-
-/*#define OV5647_VERBOSE_DGB*/
-
-#ifdef OV5647_VERBOSE_DGB
-#define CDBG(fmt, args...) pr_debug(fmt, ##args)
-#define CDBG_HIGH(fmt, args...) pr_debug(fmt, ##args)
-#else
-#define CDBG(fmt, args...) do { } while (0)
-#define CDBG_HIGH(fmt, args...) pr_debug(fmt, ##args)
-#endif
-
-/*for debug*/
-#ifdef CDBG
-#undef CDBG
-#endif
-#define CDBG(fmt, args...) printk(fmt, ##args)
-
-static uint8_t  mode_mask = 0x09;
-struct ov5647_work_t {
-	struct work_struct work;
-};
-
-static struct ov5647_work_t *ov5647_sensorw;
-static struct ov5647_work_t *ov5647_af_sensorw;
-static struct i2c_client *ov5647_af_client;
-static struct i2c_client *ov5647_client;
-
-struct ov5647_ctrl_t {
-	const struct  msm_camera_sensor_info *sensordata;
-
-	uint32_t sensormode;
-	uint32_t fps_divider;/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;/* init to 1 * 0x00000400 */
-	uint16_t fps;
-
-	uint16_t curr_lens_pos;
-	uint16_t curr_step_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint16_t total_lines_per_frame;
-
-	enum ov5647_resolution_t prev_res;
-	enum ov5647_resolution_t pict_res;
-	enum ov5647_resolution_t curr_res;
-	enum ov5647_test_mode_t  set_test;
-};
-
-static bool CSI_CONFIG;
-static struct ov5647_ctrl_t *ov5647_ctrl;
-
-static DECLARE_WAIT_QUEUE_HEAD(ov5647_wait_queue);
-static DECLARE_WAIT_QUEUE_HEAD(ov5647_af_wait_queue);
-DEFINE_MUTEX(ov5647_mut);
-
-static uint16_t prev_line_length_pck;
-static uint16_t prev_frame_length_lines;
-static uint16_t snap_line_length_pck;
-static uint16_t snap_frame_length_lines;
-
-static int ov5647_i2c_rxdata(unsigned short saddr,
-		unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = 1,
-			.buf   = rxdata,
-		},
-	};
-	if (i2c_transfer(ov5647_client->adapter, msgs, 2) < 0) {
-		CDBG("ov5647_i2c_rxdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-	return 0;
-}
-
-static int32_t ov5647_i2c_txdata(unsigned short saddr,
-		unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		},
-	};
-	if (i2c_transfer(ov5647_client->adapter, msg, 1) < 0) {
-		CDBG("ov5647_i2c_txdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t ov5647_i2c_read(unsigned short raddr,
-		unsigned short *rdata)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-
-	if (!rdata)
-		return -EIO;
-	CDBG("%s:saddr:0x%x raddr:0x%x data:0x%x",
-		__func__, ov5647_client->addr, raddr, *rdata);
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-	rc = ov5647_i2c_rxdata(ov5647_client->addr >> 1, buf, 1);
-	if (rc < 0) {
-		CDBG("ov5647_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = buf[0];
-	CDBG("ov5647_i2c_read 0x%x val = 0x%x!\n", raddr, *rdata);
-
-	return rc;
-}
-
-static int32_t ov5647_i2c_write_b_sensor(unsigned short waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[3];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = ov5647_i2c_txdata(ov5647_client->addr >> 1, buf, 3);
-	if (rc < 0) {
-		pr_err("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-				waddr, bdata);
-	}
-	return rc;
-}
-
-static int32_t ov5647_i2c_write_b_table(struct ov5647_i2c_reg_conf const
-		*reg_conf_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-
-	for (i = 0; i < num; i++) {
-		rc = ov5647_i2c_write_b_sensor(reg_conf_tbl->waddr,
-				reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-	return rc;
-}
-
-static int32_t ov5647_af_i2c_txdata(unsigned short saddr,
-		unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		},
-	};
-	if (i2c_transfer(ov5647_af_client->adapter, msg, 1) < 0) {
-		pr_err("ov5647_af_i2c_txdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t ov5647_af_i2c_write_b_sensor(uint8_t waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[2];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = waddr;
-	buf[1] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = ov5647_af_i2c_txdata(ov5647_af_client->addr, buf, 2);
-	if (rc < 0) {
-		pr_err("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-				waddr, bdata);
-	}
-	return rc;
-}
-
-static void ov5647_start_stream(void)
-{
-	CDBG("CAMERA_DBG: 0x4202 0x0, stream on...\r\n");
-	ov5647_i2c_write_b_sensor(0x4202, 0x00);/* streaming on */
-}
-
-static void ov5647_stop_stream(void)
-{
-	CDBG("CAMERA_DBG: 0x4202 0xf, stream off...\r\n");
-	ov5647_i2c_write_b_sensor(0x4202, 0x0f);/* streaming off */
-}
-
-static void ov5647_group_hold_on(void)
-{
-	ov5647_i2c_write_b_sensor(0x0104, 0x01);
-}
-
-static void ov5647_group_hold_off(void)
-{
-	ov5647_i2c_write_b_sensor(0x0104, 0x0);
-}
-
-static void ov5647_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint32_t divider, d1, d2;
-	uint32_t preview_pclk = 0x37, snapshot_pclk = 0x4f;
-
-	d1 = (prev_frame_length_lines * 0x00000400) / snap_frame_length_lines;
-	d2 = (prev_line_length_pck * 0x00000400) / snap_line_length_pck;
-	divider = (d1 * d2*preview_pclk/snapshot_pclk) / 0x400;
-	CDBG(KERN_ERR "ov5647_get_pict_fps divider = %d", divider);
-	/*Verify PCLK settings and frame sizes.*/
-	*pfps = (uint16_t) (fps * divider / 0x400);
-}
-
-static uint16_t ov5647_get_prev_lines_pf(void)
-{
-	if (ov5647_ctrl->prev_res == QTR_SIZE)
-		return prev_frame_length_lines;
-	else
-		return snap_frame_length_lines;
-}
-
-static uint16_t ov5647_get_prev_pixels_pl(void)
-{
-	if (ov5647_ctrl->prev_res == QTR_SIZE)
-		return prev_line_length_pck;
-	else
-		return snap_line_length_pck;
-}
-
-static uint16_t ov5647_get_pict_lines_pf(void)
-{
-	if (ov5647_ctrl->pict_res == QTR_SIZE)
-		return prev_frame_length_lines;
-	else
-		return snap_frame_length_lines;
-}
-
-static uint16_t ov5647_get_pict_pixels_pl(void)
-{
-	if (ov5647_ctrl->pict_res == QTR_SIZE)
-		return prev_line_length_pck;
-	else
-		return snap_line_length_pck;
-}
-
-static uint32_t ov5647_get_pict_max_exp_lc(void)
-{
-	return snap_frame_length_lines * 24;
-}
-
-static int32_t ov5647_set_fps(struct fps_cfg   *fps)
-{
-	uint16_t total_lines_per_frame;
-	int32_t rc = 0;
-
-	ov5647_ctrl->fps_divider = fps->fps_div;
-	ov5647_ctrl->pict_fps_divider = fps->pict_fps_div;
-
-	if (ov5647_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-		total_lines_per_frame = (uint16_t)
-		((prev_frame_length_lines * ov5647_ctrl->fps_divider) / 0x400);
-	} else {
-		total_lines_per_frame = (uint16_t)
-		((snap_frame_length_lines * ov5647_ctrl->fps_divider) / 0x400);
-	}
-
-	ov5647_group_hold_on();
-	rc = ov5647_i2c_write_b_sensor(0x0340,
-			((total_lines_per_frame & 0xFF00) >> 8));
-	rc = ov5647_i2c_write_b_sensor(0x0341,
-			(total_lines_per_frame & 0x00FF));
-	ov5647_group_hold_off();
-
-	return rc;
-}
-
-static inline uint8_t ov5647_byte(uint16_t word, uint8_t offset)
-{
-	return word >> (offset * BITS_PER_BYTE);
-}
-
-static int32_t ov5647_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	int rc = 0;
-	uint16_t max_line;
-	u8 intg_time_hsb, intg_time_msb, intg_time_lsb;
-	uint8_t gain_lsb, gain_hsb;
-	ov5647_ctrl->my_reg_gain = gain;
-	ov5647_ctrl->my_reg_line_count = (uint16_t)line;
-
-	CDBG(KERN_ERR "preview exposure setting 0x%x, 0x%x, %d",
-		 gain, line, line);
-
-	gain_lsb = (uint8_t) (ov5647_ctrl->my_reg_gain);
-	gain_hsb = (uint8_t)((ov5647_ctrl->my_reg_gain & 0x300)>>8);
-	/* adjust frame rate */
-	if (line > 980) {
-		rc = ov5647_i2c_write_b_sensor(0x380E,
-			 (uint8_t)((line+4) >> 8)) ;
-		rc = ov5647_i2c_write_b_sensor(0x380F,
-			 (uint8_t)((line+4) & 0x00FF)) ;
-		max_line = line + 4;
-	} else if (max_line > 984) {
-		rc = ov5647_i2c_write_b_sensor(0x380E,
-			 (uint8_t)(984 >> 8)) ;
-		rc = ov5647_i2c_write_b_sensor(0x380F,
-			 (uint8_t)(984 & 0x00FF)) ;
-		max_line = 984;
-	}
-
-	line = line<<4;
-	/* ov5647 need this operation */
-	intg_time_hsb = (u8)(line>>16);
-	intg_time_msb = (u8) ((line & 0xFF00) >> 8);
-	intg_time_lsb = (u8) (line & 0x00FF);
-
-	ov5647_group_hold_on();
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_LINE_HSB, intg_time_hsb) ;
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_LINE_MSB, intg_time_msb) ;
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_LINE_LSB, intg_time_lsb) ;
-
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_GAIN_MSB, gain_hsb) ;
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_GAIN_LSB, gain_lsb) ;
-	ov5647_group_hold_off();
-
-	return rc;
-}
-
-
-static int32_t ov5647_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	uint16_t max_line;
-	int rc = 0;
-	uint8_t gain_lsb, gain_hsb;
-	u8 intg_time_hsb, intg_time_msb, intg_time_lsb;
-
-	ov5647_ctrl->my_reg_gain = gain;
-	ov5647_ctrl->my_reg_line_count = (uint16_t)line;
-
-	gain_lsb = (uint8_t) (ov5647_ctrl->my_reg_gain);
-	gain_hsb = (uint8_t)((ov5647_ctrl->my_reg_gain & 0x300)>>8);
-
-	CDBG(KERN_ERR "snapshot exposure seting 0x%x, 0x%x, %d"
-		, gain, line, line);
-
-	if (line > 1964) {
-		rc = ov5647_i2c_write_b_sensor(0x380E,
-			 (uint8_t)((line+4) >> 8)) ;
-		rc = ov5647_i2c_write_b_sensor(0x380F,
-			 (uint8_t)((line+4) & 0x00FF)) ;
-		max_line = line + 4;
-	} else if (max_line > 1968) {
-		rc = ov5647_i2c_write_b_sensor(0x380E,
-			 (uint8_t)(1968 >> 8)) ;
-		rc = ov5647_i2c_write_b_sensor(0x380F,
-			 (uint8_t)(1968 & 0x00FF)) ;
-		max_line = 1968;
-	}
-	line = line<<4;
-	/* ov5647 need this operation */
-	intg_time_hsb = (u8)(line>>16);
-	intg_time_msb = (u8) ((line & 0xFF00) >> 8);
-	intg_time_lsb = (u8) (line & 0x00FF);
-
-	/* FIXME for BLC trigger */
-	ov5647_group_hold_on();
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_LINE_HSB, intg_time_hsb) ;
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_LINE_MSB, intg_time_msb) ;
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_LINE_LSB, intg_time_lsb) ;
-
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_GAIN_MSB, gain_hsb) ;
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_GAIN_LSB, gain_lsb - 1) ;
-
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_LINE_HSB, intg_time_hsb) ;
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_LINE_MSB, intg_time_msb) ;
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_LINE_LSB, intg_time_lsb) ;
-
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_GAIN_MSB, gain_hsb) ;
-	rc = ov5647_i2c_write_b_sensor(REG_OV5647_GAIN_LSB, gain_lsb) ;
-	ov5647_group_hold_off();
-
-	msleep(500);
-	return rc;
-
-}
-
-static int32_t ov5647_move_focus(int direction, int32_t num_steps)
-{
-	uint8_t   code_val_msb = 0;
-	uint8_t   code_val_lsb = 0;
-	int16_t   step_direction, actual_step, next_position;
-	int rc;
-
-	if (num_steps == 0)
-		return 0;
-
-	if (direction == MOVE_NEAR)
-		step_direction = 20;
-	else if (direction == MOVE_FAR)
-		step_direction = -20;
-	else
-		return -EINVAL;
-
-	actual_step = (int16_t)(step_direction * num_steps);
-	next_position = (int16_t)ov5647_ctrl->curr_lens_pos + actual_step;
-	if (next_position < 0) {
-		CDBG(KERN_ERR "%s: OV5647 position(=%d) out of range",
-			__func__, next_position);
-		next_position = 0;
-	}
-	if (next_position > 0x3FF) {
-		CDBG(KERN_ERR "%s: OV5647 position(=%d) out of range",
-			__func__, next_position);
-		next_position = 0x3FF;
-	}
-	ov5647_ctrl->curr_lens_pos = next_position;
-
-	code_val_msb = (uint8_t)((ov5647_ctrl->curr_lens_pos & 0x03FF) >> 4);
-	code_val_lsb = (uint8_t)((ov5647_ctrl->curr_lens_pos & 0x000F) << 4);
-	code_val_lsb |= mode_mask;
-
-	rc = ov5647_af_i2c_write_b_sensor(code_val_msb, code_val_lsb);
-	/* DAC Setting */
-	if (rc != 0) {
-		CDBG(KERN_ERR "%s: WRITE ERROR lsb = 0x%x, msb = 0x%x",
-			__func__, code_val_lsb, code_val_msb);
-	} else {
-		CDBG(KERN_ERR "%s: Successful lsb = 0x%x, msb = 0x%x",
-			__func__, code_val_lsb, code_val_msb);
-		/* delay may set based on the steps moved
-		when I2C write successful */
-		msleep(100);
-	}
-	return 0;
-}
-
-static int32_t ov5647_set_default_focus(uint8_t af_step)
-{
-	uint8_t  code_val_msb = 0;
-	uint8_t  code_val_lsb = 0;
-	int rc = 0;
-
-	ov5647_ctrl->curr_lens_pos = 200;
-
-
-	code_val_msb = (ov5647_ctrl->curr_lens_pos & 0x03FF) >> 4;
-	code_val_lsb = (ov5647_ctrl->curr_lens_pos & 0x000F) << 4;
-	code_val_lsb |= mode_mask;
-
-	CDBG(KERN_ERR "ov5647_set_default_focus:lens pos = %d",
-		 ov5647_ctrl->curr_lens_pos);
-	rc = ov5647_af_i2c_write_b_sensor(code_val_msb, code_val_lsb);
-	/* DAC Setting */
-	if (rc != 0)
-		CDBG(KERN_ERR "%s: WRITE ERROR lsb = 0x%x, msb = 0x%x",
-			__func__, code_val_lsb, code_val_msb);
-	else
-		CDBG(KERN_ERR "%s: WRITE successful lsb = 0x%x, msb = 0x%x",
-			__func__, code_val_lsb, code_val_msb);
-
-	usleep_range(10000, 11000);
-	return 0;
-}
-
-static int32_t ov5647_test(enum ov5647_test_mode_t mo)
-{
-	int32_t rc = 0;
-
-	if (mo != TEST_OFF)
-		rc = ov5647_i2c_write_b_sensor(0x0601, (uint8_t) mo);
-
-	return rc;
-}
-
-static void ov5647_reset_sensor(void)
-{
-	ov5647_i2c_write_b_sensor(0x103, 0x1);
-}
-
-
-static int32_t ov5647_sensor_setting(int update_type, int rt)
-{
-
-	int32_t rc = 0;
-	struct msm_camera_csi_params ov5647_csi_params;
-
-	ov5647_stop_stream();
-
-	/* wait for clk/data really stop */
-	if ((rt == RES_CAPTURE) || (CSI_CONFIG == 0))
-		msleep(66);
-	else
-		msleep(266);
-
-	CDBG("CAMERA_DBG1: 0x4800 regVal:0x25\r\n");
-	ov5647_i2c_write_b_sensor(0x4800, 0x25);/* streaming off */
-
-	usleep_range(10000, 11000);
-
-	if (update_type == REG_INIT) {
-		ov5647_reset_sensor();
-		ov5647_i2c_write_b_table(ov5647_regs.rec_settings,
-			ov5647_regs.rec_size);
-		CSI_CONFIG = 0;
-	} else if (update_type == UPDATE_PERIODIC) {
-			/* turn off flash when preview */
-
-			if (rt == RES_PREVIEW) {
-				ov5647_i2c_write_b_table(ov5647_regs.reg_prev,
-					 ov5647_regs.reg_prev_size);
-				CDBG("CAMERA_DBG:preview settings...\r\n");
-			} else {
-				ov5647_i2c_write_b_table(ov5647_regs.reg_snap,
-					 ov5647_regs.reg_snap_size);
-				CDBG("CAMERA_DBG:snapshot settings...\r\n");
-			}
-
-			msleep(20);
-			if (!CSI_CONFIG) {
-				msm_camio_vfe_clk_rate_set(192000000);
-				ov5647_csi_params.data_format = CSI_8BIT;
-				ov5647_csi_params.lane_cnt = 2;
-				ov5647_csi_params.lane_assign = 0xe4;
-				ov5647_csi_params.dpcm_scheme = 0;
-				ov5647_csi_params.settle_cnt = 10;
-				rc = msm_camio_csi_config(&ov5647_csi_params);
-				msleep(20);
-				CSI_CONFIG = 1;
-			/* exit powerdown state */
-				ov5647_i2c_write_b_sensor(0x0100, 0x01);
-			}
-			CDBG("CAMERA_DBG: 0x4800 regVal:0x04\r\n");
-			/* streaming on */
-			ov5647_i2c_write_b_sensor(0x4800, 0x04);
-			msleep(266);
-			ov5647_start_stream();
-			msleep(30);
-	}
-	return rc;
-}
-
-static int32_t ov5647_video_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-	CDBG("video config\n");
-	/* change sensor resolution if needed */
-	if (ov5647_ctrl->prev_res == QTR_SIZE)
-		rt = RES_PREVIEW;
-	else
-		rt = RES_CAPTURE;
-	if (ov5647_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-		return rc;
-	if (ov5647_ctrl->set_test) {
-		if (ov5647_test(ov5647_ctrl->set_test) < 0)
-			return  rc;
-	}
-
-	ov5647_ctrl->curr_res = ov5647_ctrl->prev_res;
-	ov5647_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t ov5647_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-
-	/*change sensor resolution if needed */
-	if (ov5647_ctrl->curr_res != ov5647_ctrl->pict_res) {
-		if (ov5647_ctrl->pict_res == QTR_SIZE)
-			rt = RES_PREVIEW;
-		else
-			rt = RES_CAPTURE;
-		if (ov5647_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-			return rc;
-	}
-
-	ov5647_ctrl->curr_res = ov5647_ctrl->pict_res;
-	ov5647_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t ov5647_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-
-	/* change sensor resolution if needed */
-	if (ov5647_ctrl->curr_res != ov5647_ctrl->pict_res) {
-		if (ov5647_ctrl->pict_res == QTR_SIZE)
-			rt = RES_PREVIEW;
-		else
-			rt = RES_CAPTURE;
-		if (ov5647_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-			return rc;
-	}
-
-	ov5647_ctrl->curr_res = ov5647_ctrl->pict_res;
-	ov5647_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t ov5647_set_sensor_mode(int mode,
-		int res)
-{
-	int32_t rc = 0;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = ov5647_video_config(mode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-		rc = ov5647_snapshot_config(mode);
-		break;
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = ov5647_raw_snapshot_config(mode);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-static int32_t ov5647_power_down(void)
-{
-	ov5647_stop_stream();
-	return 0;
-}
-
-static int ov5647_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	CDBG("probe done\n");
-	gpio_direction_output(data->sensor_pwd, 1);
-	return 0;
-}
-
-static int ov5647_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	uint16_t regaddress1 = 0x300a;
-	uint16_t regaddress2 = 0x300b;
-	uint16_t chipid1 = 0;
-	uint16_t chipid2 = 0;
-
-	CDBG("%s: %d\n", __func__, __LINE__);
-
-	gpio_direction_output(data->sensor_pwd, 0);
-	usleep_range(4000, 4100);
-	gpio_direction_output(data->sensor_reset, 1);
-	usleep_range(2000, 2100);
-
-	ov5647_i2c_read(regaddress1, &chipid1);
-	if (chipid1 != 0x56) {
-		rc = -ENODEV;
-		pr_err("ov5647_probe_init_sensor fail chip id doesnot match\n");
-		goto init_probe_fail;
-	}
-
-	ov5647_i2c_read(regaddress2, &chipid2);
-	if (chipid2 != 0x47) {
-		rc = -ENODEV;
-		pr_err("ov5647_probe_init_sensor fail chip id doesnot match\n");
-		goto init_probe_fail;
-	}
-
-	pr_err("ID1: 0x%x\n", chipid1);
-	pr_err("ID2: 0x%x\n", chipid2);
-	goto init_probe_done;
-
-init_probe_fail:
-	pr_err(" ov5647_probe_init_sensor fails\n");
-	ov5647_probe_init_done(data);
-	return rc;
-init_probe_done:
-	pr_debug(" ov5647_probe_init_sensor finishes\n");
-	gpio_direction_output(data->sensor_pwd, 1);
-	return rc;
-}
-
-
-static int ov5647_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-
-	CDBG("%s: %d\n", __func__, __LINE__);
-	CDBG("Calling ov5647_sensor_open_init\n");
-
-	ov5647_ctrl = kzalloc(sizeof(struct ov5647_ctrl_t), GFP_KERNEL);
-	if (!ov5647_ctrl) {
-		CDBG("ov5647_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	ov5647_ctrl->fps_divider = 1 * 0x00000400;
-	ov5647_ctrl->pict_fps_divider = 1 * 0x00000400;
-	ov5647_ctrl->set_test = TEST_OFF;
-	ov5647_ctrl->prev_res = QTR_SIZE;
-	ov5647_ctrl->pict_res = FULL_SIZE;
-
-	if (data)
-		ov5647_ctrl->sensordata = data;
-
-	prev_frame_length_lines = 0x3d8;
-
-	prev_line_length_pck = 0x768*2;
-
-	snap_frame_length_lines = 0x7b0;
-
-	snap_line_length_pck = 0xa8c;
-
-	/* enable mclk first */
-	msm_camio_clk_rate_set(OV5647_MASTER_CLK_RATE);
-
-	gpio_direction_output(data->sensor_pwd, 1);
-	gpio_direction_output(data->sensor_reset, 0);
-	usleep_range(10000, 11000);
-	/* power on camera ldo and vreg */
-	if (ov5647_ctrl->sensordata->pmic_gpio_enable)
-		lcd_camera_power_onoff(1);
-	usleep_range(10000, 11000); /*waiting for ldo stable*/
-	gpio_direction_output(data->sensor_pwd, 0);
-	msleep(20);
-	gpio_direction_output(data->sensor_reset, 1);
-	msleep(25);
-
-	CDBG("init settings\n");
-	if (ov5647_ctrl->prev_res == QTR_SIZE)
-		rc = ov5647_sensor_setting(REG_INIT, RES_PREVIEW);
-	else
-		rc = ov5647_sensor_setting(REG_INIT, RES_CAPTURE);
-	ov5647_ctrl->fps = 30 * Q8;
-
-	/* enable AF actuator */
-	if (ov5647_ctrl->sensordata->vcm_enable) {
-		CDBG("enable AF actuator, gpio = %d\n",
-			 ov5647_ctrl->sensordata->vcm_pwd);
-		rc = gpio_request(ov5647_ctrl->sensordata->vcm_pwd,
-						"ov5647_af");
-		if (!rc)
-			gpio_direction_output(
-				ov5647_ctrl->sensordata->vcm_pwd,
-				 1);
-		else {
-			pr_err("ov5647_ctrl gpio request failed!\n");
-			goto init_fail;
-		}
-		msleep(20);
-		rc = ov5647_set_default_focus(0);
-		if (rc < 0) {
-			gpio_direction_output(ov5647_ctrl->sensordata->vcm_pwd,
-								0);
-			gpio_free(ov5647_ctrl->sensordata->vcm_pwd);
-		}
-	}
-	if (rc < 0)
-		goto init_fail;
-	else
-		goto init_done;
-init_fail:
-	CDBG("init_fail\n");
-	ov5647_probe_init_done(data);
-	/* No need to power OFF camera ldo and vreg
-	affects Display while resume */
-init_done:
-	CDBG("init_done\n");
-	return rc;
-}
-
-static int ov5647_i2c_remove(struct i2c_client *client)
-{
-	return 0;
-}
-
-static int ov5647_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&ov5647_wait_queue);
-	return 0;
-}
-
-static int ov5647_af_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&ov5647_af_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id ov5647_af_i2c_id[] = {
-	{"ov5647_af", 0},
-	{ }
-};
-
-static int ov5647_af_i2c_probe(struct i2c_client *client,
-		const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("ov5647_af_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	ov5647_af_sensorw = kzalloc(sizeof(struct ov5647_work_t), GFP_KERNEL);
-	if (!ov5647_af_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, ov5647_af_sensorw);
-	ov5647_af_init_client(client);
-	ov5647_af_client = client;
-
-	msleep(50);
-
-	CDBG("ov5647_af_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("ov5647_af_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static const struct i2c_device_id ov5647_i2c_id[] = {
-	{"ov5647", 0}, {}
-};
-
-static int ov5647_i2c_probe(struct i2c_client *client,
-		const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("ov5647_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	ov5647_sensorw = kzalloc(sizeof(struct ov5647_work_t), GFP_KERNEL);
-	if (!ov5647_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, ov5647_sensorw);
-	ov5647_init_client(client);
-	ov5647_client = client;
-
-	msleep(50);
-
-	CDBG("ov5647_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("ov5647_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int __devexit ov5647_remove(struct i2c_client *client)
-{
-	struct ov5647_work_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	ov5647_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static int __devexit ov5647_af_remove(struct i2c_client *client)
-{
-	struct ov5647_work_t *ov5647_af = i2c_get_clientdata(client);
-	free_irq(client->irq, ov5647_af);
-	ov5647_af_client = NULL;
-	kfree(ov5647_af);
-	return 0;
-}
-
-static struct i2c_driver ov5647_i2c_driver = {
-	.id_table = ov5647_i2c_id,
-	.probe  = ov5647_i2c_probe,
-	.remove = ov5647_i2c_remove,
-	.driver = {
-		.name = "ov5647",
-	},
-};
-
-static struct i2c_driver ov5647_af_i2c_driver = {
-	.id_table = ov5647_af_i2c_id,
-	.probe  = ov5647_af_i2c_probe,
-	.remove = __exit_p(ov5647_af_i2c_remove),
-	.driver = {
-		.name = "ov5647_af",
-	},
-};
-
-int ov5647_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-	if (copy_from_user(&cdata,
-				(void *)argp,
-				sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(&ov5647_mut);
-	CDBG("ov5647_sensor_config: cfgtype = %d\n",
-			cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		ov5647_get_pict_fps(
-			cdata.cfg.gfps.prevfps,
-			&(cdata.cfg.gfps.pictfps));
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf =
-			ov5647_get_prev_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl =
-			ov5647_get_prev_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf =
-			ov5647_get_pict_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl =
-			ov5647_get_pict_pixels_pl();
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc =
-			ov5647_get_pict_max_exp_lc();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = ov5647_set_fps(&(cdata.cfg.fps));
-		break;
-	case CFG_SET_EXP_GAIN:
-		rc = ov5647_write_exp_gain(cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-		break;
-	case CFG_SET_PICT_EXP_GAIN:
-		rc = ov5647_set_pict_exp_gain(cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-		break;
-	case CFG_SET_MODE:
-		rc = ov5647_set_sensor_mode(cdata.mode, cdata.rs);
-		break;
-	case CFG_PWR_DOWN:
-		rc = ov5647_power_down();
-		break;
-	case CFG_MOVE_FOCUS:
-		rc = ov5647_move_focus(cdata.cfg.focus.dir,
-				cdata.cfg.focus.steps);
-		break;
-	case CFG_SET_DEFAULT_FOCUS:
-		rc = ov5647_set_default_focus(cdata.cfg.focus.steps);
-		break;
-
-	case CFG_GET_AF_MAX_STEPS:
-		cdata.max_steps = OV5647_TOTAL_STEPS_NEAR_TO_FAR;
-		if (copy_to_user((void *)argp,
-					&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_SET_EFFECT:
-		rc = ov5647_set_default_focus(cdata.cfg.effect);
-		break;
-	default:
-		rc = -EFAULT;
-		break;
-	}
-	mutex_unlock(&ov5647_mut);
-
-	return rc;
-}
-
-static int ov5647_sensor_release(void)
-{
-	int rc = -EBADF;
-	unsigned short rdata;
-
-	mutex_lock(&ov5647_mut);
-	ov5647_power_down();
-	msleep(20);
-	ov5647_i2c_read(0x3018, &rdata);
-	rdata |= 0x18; /*set bit 3 bit 4 to 1*/
-	ov5647_i2c_write_b_sensor(0x3018, rdata);/*write back*/
-	msleep(20);
-
-	gpio_set_value(ov5647_ctrl->sensordata->sensor_pwd, 1);
-	usleep_range(5000, 5100);
-	if (ov5647_ctrl->sensordata->vcm_enable) {
-		gpio_direction_output(ov5647_ctrl->sensordata->vcm_pwd, 0);
-		gpio_free(ov5647_ctrl->sensordata->vcm_pwd);
-	}
-
-	/* No need to power OFF camera ldo and vreg
-	affects Display while resume */
-
-	kfree(ov5647_ctrl);
-	ov5647_ctrl = NULL;
-	CDBG("ov5647_release completed\n");
-	mutex_unlock(&ov5647_mut);
-
-	return rc;
-}
-
-static int ov5647_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-
-	CDBG("%s E\n", __func__);
-
-	gpio_direction_output(info->sensor_pwd, 1);
-	gpio_direction_output(info->sensor_reset, 0);
-	usleep_range(1000, 1100);
-	/* turn on ldo and vreg */
-	if (info->pmic_gpio_enable)
-		lcd_camera_power_onoff(1);
-
-	rc = i2c_add_driver(&ov5647_i2c_driver);
-	if (rc < 0 || ov5647_client == NULL) {
-		rc = -ENOTSUPP;
-		CDBG("I2C add driver ov5647 failed");
-		goto probe_fail_2;
-	}
-	if (info->vcm_enable) {
-		rc = i2c_add_driver(&ov5647_af_i2c_driver);
-		if (rc < 0 || ov5647_af_client == NULL) {
-			rc = -ENOTSUPP;
-			CDBG("I2C add driver ov5647 af failed");
-			goto probe_fail_3;
-		}
-	}
-	msm_camio_clk_rate_set(OV5647_MASTER_CLK_RATE);
-
-	rc = ov5647_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail_1;
-
-	s->s_init = ov5647_sensor_open_init;
-	s->s_release = ov5647_sensor_release;
-	s->s_config  = ov5647_sensor_config;
-	s->s_mount_angle = info->sensor_platform_info->mount_angle;
-	gpio_set_value(info->sensor_pwd, 1);
-	ov5647_probe_init_done(info);
-	/* turn off ldo and vreg */
-	if (info->pmic_gpio_enable)
-		lcd_camera_power_onoff(0);
-
-	CDBG("%s X", __func__);
-	return rc;
-
-probe_fail_3:
-	i2c_del_driver(&ov5647_af_i2c_driver);
-probe_fail_2:
-	i2c_del_driver(&ov5647_i2c_driver);
-probe_fail_1:
-	/* turn off ldo and vreg */
-	if (info->pmic_gpio_enable)
-		lcd_camera_power_onoff(0);
-	CDBG("ov5647_sensor_probe: SENSOR PROBE FAILS!\n");
-	CDBG("%s X", __func__);
-	return rc;
-}
-
-static int __devinit ov5647_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, ov5647_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = ov5647_probe,
-	.driver = {
-		.name = "msm_camera_ov5647",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init ov5647_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(ov5647_init);
-MODULE_DESCRIPTION("Omnivision 5 MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/ov5647.h b/drivers/media/video/msm/ov5647.h
deleted file mode 100644
index 0015d63..0000000
--- a/drivers/media/video/msm/ov5647.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef OV5647_H
-#define OV5647_H
-#include <linux/types.h>
-#include <mach/board.h>
-
-extern struct ov5647_reg ov5647_regs;
-extern int lcd_camera_power_onoff(int on);
-extern struct rw_semaphore leds_list_lock;
-extern struct list_head leds_list;
-
-struct ov5647_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-enum ov5647_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum ov5647_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-enum ov5647_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-enum ov5647_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-enum ov5647_reg_pll {
-	E013_VT_PIX_CLK_DIV,
-	E013_VT_SYS_CLK_DIV,
-	E013_PRE_PLL_CLK_DIV,
-	E013_PLL_MULTIPLIER,
-	E013_OP_PIX_CLK_DIV,
-	E013_OP_SYS_CLK_DIV
-};
-
-enum ov5647_reg_mode {
-	E013_X_ADDR_START,
-	E013_X_ADDR_END,
-	E013_Y_ADDR_START,
-	E013_Y_ADDR_END,
-	E013_X_OUTPUT_SIZE,
-	E013_Y_OUTPUT_SIZE,
-	E013_DATAPATH_SELECT,
-	E013_READ_MODE,
-	E013_ANALOG_CONTROL5,
-	E013_DAC_LD_4_5,
-	E013_SCALING_MODE,
-	E013_SCALE_M,
-	E013_LINE_LENGTH_PCK,
-	E013_FRAME_LENGTH_LINES,
-	E013_COARSE_INTEGRATION_TIME,
-	E013_FINE_INTEGRATION_TIME,
-	E013_FINE_CORRECTION
-};
-
-struct ov5647_reg {
-	const struct ov5647_i2c_reg_conf *rec_settings;
-	const unsigned short rec_size;
-	const struct ov5647_i2c_reg_conf *reg_prev;
-	const unsigned short reg_prev_size;
-	const struct ov5647_i2c_reg_conf *reg_snap;
-	const unsigned short reg_snap_size;
-};
-#endif /* OV5647_H */
diff --git a/drivers/media/video/msm/ov5647_reg.c b/drivers/media/video/msm/ov5647_reg.c
deleted file mode 100644
index c9709bf..0000000
--- a/drivers/media/video/msm/ov5647_reg.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-
-#include "ov5647.h"
-struct ov5647_i2c_reg_conf ov5647_prev_settings[] = {
-	/*1280*960 Reference Setting 24M MCLK 2lane 280Mbps/lane 30fps
-	for back to preview*/
-	{0x3035, 0x21},
-	{0x3036, 0x37},
-	{0x3821, 0x07},
-	{0x3820, 0x41},
-	{0x3612, 0x09},
-	{0x3618, 0x00},
-	{0x380c, 0x07},
-	{0x380d, 0x68},
-	{0x380e, 0x03},
-	{0x380f, 0xd8},
-	{0x3814, 0x31},
-	{0x3815, 0x31},
-	{0x3709, 0x52},
-	{0x3808, 0x05},
-	{0x3809, 0x00},
-	{0x380a, 0x03},
-	{0x380b, 0xc0},
-	{0x3800, 0x00},
-	{0x3801, 0x18},
-	{0x3802, 0x00},
-	{0x3803, 0x0e},
-	{0x3804, 0x0a},
-	{0x3805, 0x27},
-	{0x3806, 0x07},
-	{0x3807, 0x95},
-	{0x4004, 0x02},
-};
-
-struct ov5647_i2c_reg_conf ov5647_snap_settings[] = {
-	/*2608*1952 Reference Setting 24M MCLK 2lane 280Mbps/lane 30fps*/
-	{0x3035, 0x21},
-	{0x3036, 0x4f},
-	{0x3821, 0x06},
-	{0x3820, 0x00},
-	{0x3612, 0x0b},
-	{0x3618, 0x04},
-	{0x380c, 0x0a},
-	{0x380d, 0x8c},
-	{0x380e, 0x07},
-	{0x380f, 0xb0},
-	{0x3814, 0x11},
-	{0x3815, 0x11},
-	{0x3709, 0x12},
-	{0x3808, 0x0a},
-	{0x3809, 0x30},
-	{0x380a, 0x07},
-	{0x380b, 0xa0},
-	{0x3800, 0x00},
-	{0x3801, 0x04},
-	{0x3802, 0x00},
-	{0x3803, 0x00},
-	{0x3804, 0x0a},
-	{0x3805, 0x3b},
-	{0x3806, 0x07},
-	{0x3807, 0xa3},
-	{0x4004, 0x04},
-};
-
-struct ov5647_i2c_reg_conf ov5647_recommend_settings[] = {
-	{0x3035, 0x11},
-	{0x303c, 0x11},
-	{0x370c, 0x03},
-	{0x5000, 0x06},
-	{0x5003, 0x08},
-	{0x5a00, 0x08},
-	{0x3000, 0xff},
-	{0x3001, 0xff},
-	{0x3002, 0xff},
-	{0x301d, 0xf0},
-	{0x3a18, 0x00},
-	{0x3a19, 0xf8},
-	{0x3c01, 0x80},
-	{0x3b07, 0x0c},
-	{0x3708, 0x64},
-	{0x3630, 0x2e},
-	{0x3632, 0xe2},
-	{0x3633, 0x23},
-	{0x3634, 0x44},
-	{0x3620, 0x64},
-	{0x3621, 0xe0},
-	{0x3600, 0x37},
-	{0x3704, 0xa0},
-	{0x3703, 0x5a},
-	{0x3715, 0x78},
-	{0x3717, 0x01},
-	{0x3731, 0x02},
-	{0x370b, 0x60},
-	{0x3705, 0x1a},
-	{0x3f05, 0x02},
-	{0x3f06, 0x10},
-	{0x3f01, 0x0a},
-	{0x3a08, 0x01},
-	{0x3a0f, 0x58},
-	{0x3a10, 0x50},
-	{0x3a1b, 0x58},
-	{0x3a1e, 0x50},
-	{0x3a11, 0x60},
-	{0x3a1f, 0x28},
-	{0x4001, 0x02},
-	{0x4000, 0x09},
-	{0x3000, 0x00},
-	{0x3001, 0x00},
-	{0x3002, 0x00},
-	{0x3017, 0xe0},
-	{0x301c, 0xfc},
-	{0x3636, 0x06},
-	{0x3016, 0x08},
-	{0x3827, 0xec},
-	{0x3018, 0x44},
-	{0x3035, 0x21},
-	{0x3106, 0xf5},
-	{0x3034, 0x18},
-	{0x301c, 0xf8},
-	/*lens setting*/
-	{0x5000, 0x86},
-	{0x5800, 0x11},
-	{0x5801, 0x0c},
-	{0x5802, 0x0a},
-	{0x5803, 0x0b},
-	{0x5804, 0x0d},
-	{0x5805, 0x13},
-	{0x5806, 0x09},
-	{0x5807, 0x05},
-	{0x5808, 0x03},
-	{0x5809, 0x03},
-	{0x580a, 0x06},
-	{0x580b, 0x08},
-	{0x580c, 0x05},
-	{0x580d, 0x01},
-	{0x580e, 0x00},
-	{0x580f, 0x00},
-	{0x5810, 0x02},
-	{0x5811, 0x06},
-	{0x5812, 0x05},
-	{0x5813, 0x01},
-	{0x5814, 0x00},
-	{0x5815, 0x00},
-	{0x5816, 0x02},
-	{0x5817, 0x06},
-	{0x5818, 0x09},
-	{0x5819, 0x05},
-	{0x581a, 0x04},
-	{0x581b, 0x04},
-	{0x581c, 0x06},
-	{0x581d, 0x09},
-	{0x581e, 0x11},
-	{0x581f, 0x0c},
-	{0x5820, 0x0b},
-	{0x5821, 0x0b},
-	{0x5822, 0x0d},
-	{0x5823, 0x13},
-	{0x5824, 0x22},
-	{0x5825, 0x26},
-	{0x5826, 0x26},
-	{0x5827, 0x24},
-	{0x5828, 0x24},
-	{0x5829, 0x24},
-	{0x582a, 0x22},
-	{0x582b, 0x20},
-	{0x582c, 0x22},
-	{0x582d, 0x26},
-	{0x582e, 0x22},
-	{0x582f, 0x22},
-	{0x5830, 0x42},
-	{0x5831, 0x22},
-	{0x5832, 0x02},
-	{0x5833, 0x24},
-	{0x5834, 0x22},
-	{0x5835, 0x22},
-	{0x5836, 0x22},
-	{0x5837, 0x26},
-	{0x5838, 0x42},
-	{0x5839, 0x26},
-	{0x583a, 0x06},
-	{0x583b, 0x26},
-	{0x583c, 0x24},
-	{0x583d, 0xce},
-	/* manual AWB,manual AE,close Lenc,open WBC*/
-	{0x3503, 0x03}, /*manual AE*/
-	{0x3501, 0x10},
-	{0x3502, 0x80},
-	{0x350a, 0x00},
-	{0x350b, 0x7f},
-	{0x5001, 0x01}, /*manual AWB*/
-	{0x5180, 0x08},
-	{0x5186, 0x04},
-	{0x5187, 0x00},
-	{0x5188, 0x04},
-	{0x5189, 0x00},
-	{0x518a, 0x04},
-	{0x518b, 0x00},
-	{0x5000, 0x06}, /*No lenc,WBC on*/
-};
-
-struct ov5647_reg ov5647_regs = {
-	.rec_settings = &ov5647_recommend_settings[0],
-	.rec_size = ARRAY_SIZE(ov5647_recommend_settings),
-	.reg_prev = &ov5647_prev_settings[0],
-	.reg_prev_size = ARRAY_SIZE(ov5647_prev_settings),
-	.reg_snap = &ov5647_snap_settings[0],
-	.reg_snap_size = ARRAY_SIZE(ov5647_snap_settings),
-};
diff --git a/drivers/media/video/msm/ov7692.c b/drivers/media/video/msm/ov7692.c
deleted file mode 100644
index 252d42c..0000000
--- a/drivers/media/video/msm/ov7692.c
+++ /dev/null
@@ -1,597 +0,0 @@
-/* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/slab.h>
-#include <media/msm_camera.h>
-#include <mach/camera.h>
-#include "ov7692.h"
-
-/*=============================================================
-	SENSOR REGISTER DEFINES
-==============================================================*/
-#define Q8    0x00000100
-
-/* Omnivision8810 product ID register address */
-#define REG_OV7692_MODEL_ID_MSB                       0x0A
-#define REG_OV7692_MODEL_ID_LSB                       0x0B
-
-#define OV7692_MODEL_ID                       0x7692
-/* Omnivision8810 product ID */
-
-/* Time in milisecs for waiting for the sensor to reset */
-#define OV7692_RESET_DELAY_MSECS    66
-#define OV7692_DEFAULT_CLOCK_RATE   24000000
-/* Registers*/
-
-/* Color bar pattern selection */
-#define OV7692_COLOR_BAR_PATTERN_SEL_REG     0x82
-/* Color bar enabling control */
-#define OV7692_COLOR_BAR_ENABLE_REG           0x601
-/* Time in milisecs for waiting for the sensor to reset*/
-#define OV7692_RESET_DELAY_MSECS    66
-
-/*============================================================================
-							DATA DECLARATIONS
-============================================================================*/
-/*  96MHz PCLK @ 24MHz MCLK */
-struct reg_addr_val_pair_struct ov7692_init_settings_array[] = {
-    {0x12, 0x80},
-    {0x0e, 0x08},
-    {0x69, 0x52},
-    {0x1e, 0xb3},
-    {0x48, 0x42},
-    {0xff, 0x01},
-    {0xae, 0xa0},
-    {0xa8, 0x26},
-    {0xb4, 0xc0},
-    {0xb5, 0x40},
-    {0xff, 0x00},
-    {0x0c, 0x00},
-    {0x62, 0x10},
-    {0x12, 0x00},
-    {0x17, 0x65},
-    {0x18, 0xa4},
-    {0x19, 0x0a},
-    {0x1a, 0xf6},
-    {0x3e, 0x30},
-    {0x64, 0x0a},
-    {0xff, 0x01},
-    {0xb4, 0xc0},
-    {0xff, 0x00},
-    {0x67, 0x20},
-    {0x81, 0x3f},
-    {0xcc, 0x02},
-    {0xcd, 0x80},
-    {0xce, 0x01},
-    {0xcf, 0xe0},
-    {0xc8, 0x02},
-    {0xc9, 0x80},
-    {0xca, 0x01},
-    {0xcb, 0xe0},
-    {0xd0, 0x48},
-    {0x82, 0x03},
-    {0x0e, 0x00},
-    {0x70, 0x00},
-    {0x71, 0x34},
-    {0x74, 0x28},
-    {0x75, 0x98},
-    {0x76, 0x00},
-    {0x77, 0x64},
-    {0x78, 0x01},
-    {0x79, 0xc2},
-    {0x7a, 0x4e},
-    {0x7b, 0x1f},
-    {0x7c, 0x00},
-    {0x11, 0x00},
-    {0x20, 0x00},
-    {0x21, 0x23},
-    {0x50, 0x9a},
-    {0x51, 0x80},
-    {0x4c, 0x7d},
-    {0x0e, 0x00},
-    {0x80, 0x7f},
-    {0x85, 0x10},
-    {0x86, 0x00},
-    {0x87, 0x00},
-    {0x88, 0x00},
-    {0x89, 0x2a},
-    {0x8a, 0x26},
-    {0x8b, 0x22},
-    {0xbb, 0x7a},
-    {0xbc, 0x69},
-    {0xbd, 0x11},
-    {0xbe, 0x13},
-    {0xbf, 0x81},
-    {0xc0, 0x96},
-    {0xc1, 0x1e},
-    {0xb7, 0x05},
-    {0xb8, 0x09},
-    {0xb9, 0x00},
-    {0xba, 0x18},
-    {0x5a, 0x1f},
-    {0x5b, 0x9f},
-    {0x5c, 0x6a},
-    {0x5d, 0x42},
-    {0x24, 0x78},
-    {0x25, 0x68},
-    {0x26, 0xb3},
-    {0xa3, 0x0b},
-    {0xa4, 0x15},
-    {0xa5, 0x2a},
-    {0xa6, 0x51},
-    {0xa7, 0x63},
-    {0xa8, 0x74},
-    {0xa9, 0x83},
-    {0xaa, 0x91},
-    {0xab, 0x9e},
-    {0xac, 0xaa},
-    {0xad, 0xbe},
-    {0xae, 0xce},
-    {0xaf, 0xe5},
-    {0xb0, 0xf3},
-    {0xb1, 0xfb},
-    {0xb2, 0x06},
-    {0x8c, 0x5c},
-    {0x8d, 0x11},
-    {0x8e, 0x12},
-    {0x8f, 0x19},
-    {0x90, 0x50},
-    {0x91, 0x20},
-    {0x92, 0x96},
-    {0x93, 0x80},
-    {0x94, 0x13},
-    {0x95, 0x1b},
-    {0x96, 0xff},
-    {0x97, 0x00},
-    {0x98, 0x3d},
-    {0x99, 0x36},
-    {0x9a, 0x51},
-    {0x9b, 0x43},
-    {0x9c, 0xf0},
-    {0x9d, 0xf0},
-    {0x9e, 0xf0},
-    {0x9f, 0xff},
-    {0xa0, 0x68},
-    {0xa1, 0x62},
-    {0xa2, 0x0e},
-};
-
-static bool OV7692_CSI_CONFIG;
-/* 816x612, 24MHz MCLK 96MHz PCLK */
-uint32_t OV7692_FULL_SIZE_WIDTH        = 640;
-uint32_t OV7692_FULL_SIZE_HEIGHT       = 480;
-
-uint32_t OV7692_QTR_SIZE_WIDTH         = 640;
-uint32_t OV7692_QTR_SIZE_HEIGHT        = 480;
-
-uint32_t OV7692_HRZ_FULL_BLK_PIXELS    = 16;
-uint32_t OV7692_VER_FULL_BLK_LINES     = 12;
-uint32_t OV7692_HRZ_QTR_BLK_PIXELS     = 16;
-uint32_t OV7692_VER_QTR_BLK_LINES      = 12;
-
-struct ov7692_work_t {
-	struct work_struct work;
-};
-static struct  ov7692_work_t *ov7692_sensorw;
-static struct  i2c_client *ov7692_client;
-struct ov7692_ctrl_t {
-	const struct  msm_camera_sensor_info *sensordata;
-	uint32_t sensormode;
-	uint32_t fps_divider;		/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;	/* init to 1 * 0x00000400 */
-	uint32_t fps;
-	int32_t  curr_lens_pos;
-	uint32_t curr_step_pos;
-	uint32_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint32_t total_lines_per_frame;
-	enum ov7692_resolution_t prev_res;
-	enum ov7692_resolution_t pict_res;
-	enum ov7692_resolution_t curr_res;
-	enum ov7692_test_mode_t  set_test;
-	unsigned short imgaddr;
-};
-static struct ov7692_ctrl_t *ov7692_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(ov7692_wait_queue);
-DEFINE_MUTEX(ov7692_mut);
-
-/*=============================================================*/
-
-static int ov7692_i2c_rxdata(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = 1,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = 1,
-			.buf   = rxdata,
-		},
-	};
-	if (i2c_transfer(ov7692_client->adapter, msgs, 2) < 0) {
-		CDBG("ov7692_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-	return 0;
-}
-static int32_t ov7692_i2c_txdata(unsigned short saddr,
-				unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = 2,
-			.buf = txdata,
-		 },
-	};
-	if (i2c_transfer(ov7692_client->adapter, msg, 1) < 0) {
-		CDBG("ov7692_i2c_txdata faild 0x%x\n", ov7692_client->addr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t ov7692_i2c_read(uint8_t raddr,
-	uint8_t *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[1];
-	if (!rdata)
-		return -EIO;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = raddr;
-	rc = ov7692_i2c_rxdata(ov7692_client->addr >> 1, buf, rlen);
-	if (rc < 0) {
-		CDBG("ov7692_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = buf[0];
-	return rc;
-}
-static int32_t ov7692_i2c_write_b_sensor(uint8_t waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[2];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = waddr;
-	buf[1] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = ov7692_i2c_txdata(ov7692_client->addr >> 1, buf, 2);
-	if (rc < 0)
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, bdata);
-	return rc;
-}
-
-static int32_t ov7692_sensor_setting(int update_type, int rt)
-{
-	int32_t i, array_length;
-	int32_t rc = 0;
-	struct msm_camera_csi_params ov7692_csi_params;
-	switch (update_type) {
-	case REG_INIT:
-		OV7692_CSI_CONFIG = 0;
-		ov7692_i2c_write_b_sensor(0x0e, 0x08);
-		return rc;
-		break;
-	case UPDATE_PERIODIC:
-		if (!OV7692_CSI_CONFIG) {
-			ov7692_csi_params.lane_cnt = 1;
-			ov7692_csi_params.data_format = CSI_8BIT;
-			ov7692_csi_params.lane_assign = 0xe4;
-			ov7692_csi_params.dpcm_scheme = 0;
-			ov7692_csi_params.settle_cnt = 0x14;
-
-			rc = msm_camio_csi_config(&ov7692_csi_params);
-			msleep(10);
-			array_length = sizeof(ov7692_init_settings_array) /
-				sizeof(ov7692_init_settings_array[0]);
-			for (i = 0; i < array_length; i++) {
-				rc = ov7692_i2c_write_b_sensor(
-					ov7692_init_settings_array[i].reg_addr,
-					ov7692_init_settings_array[i].reg_val);
-				if (rc < 0)
-					return rc;
-			}
-			OV7692_CSI_CONFIG = 1;
-			msleep(20);
-			return rc;
-		}
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-static int32_t ov7692_video_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-	/* change sensor resolution if needed */
-	rt = RES_PREVIEW;
-
-	if (ov7692_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-		return rc;
-	ov7692_ctrl->curr_res = ov7692_ctrl->prev_res;
-	ov7692_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t ov7692_set_sensor_mode(int mode,
-	int res)
-{
-	int32_t rc = 0;
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = ov7692_video_config(mode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-static int32_t ov7692_power_down(void)
-{
-	return 0;
-}
-
-static int ov7692_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	uint8_t model_id_msb, model_id_lsb = 0;
-	uint16_t model_id;
-	int32_t rc = 0;
-	/*The reset pin is not physically connected to the sensor.
-	The standby pin will do the reset hence there is no need
-	to request the gpio reset*/
-
-	/* Read sensor Model ID: */
-	rc = ov7692_i2c_read(REG_OV7692_MODEL_ID_MSB, &model_id_msb, 1);
-	if (rc < 0)
-		goto init_probe_fail;
-	rc = ov7692_i2c_read(REG_OV7692_MODEL_ID_LSB, &model_id_lsb, 1);
-	if (rc < 0)
-		goto init_probe_fail;
-	model_id = (model_id_msb << 8) | ((model_id_lsb & 0x00FF)) ;
-	CDBG("ov7692 model_id = 0x%x, 0x%x, 0x%x\n",
-		 model_id, model_id_msb, model_id_lsb);
-	/* 4. Compare sensor ID to OV7692 ID: */
-	if (model_id != OV7692_MODEL_ID) {
-		rc = -ENODEV;
-		goto init_probe_fail;
-	}
-	goto init_probe_done;
-init_probe_fail:
-	pr_warning(" ov7692_probe_init_sensor fails\n");
-init_probe_done:
-	CDBG(" ov7692_probe_init_sensor finishes\n");
-	return rc;
-}
-
-int ov7692_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-
-	CDBG("%s: %d\n", __func__, __LINE__);
-	CDBG("Calling ov7692_sensor_open_init\n");
-	ov7692_ctrl = kzalloc(sizeof(struct ov7692_ctrl_t), GFP_KERNEL);
-	if (!ov7692_ctrl) {
-		CDBG("ov7692_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	ov7692_ctrl->fps_divider = 1 * 0x00000400;
-	ov7692_ctrl->pict_fps_divider = 1 * 0x00000400;
-	ov7692_ctrl->fps = 30 * Q8;
-	ov7692_ctrl->set_test = TEST_OFF;
-	ov7692_ctrl->prev_res = QTR_SIZE;
-	ov7692_ctrl->pict_res = FULL_SIZE;
-	ov7692_ctrl->curr_res = INVALID_SIZE;
-
-	if (data)
-		ov7692_ctrl->sensordata = data;
-
-	/* enable mclk first */
-
-	msm_camio_clk_rate_set(24000000);
-	msleep(20);
-
-	rc = ov7692_probe_init_sensor(data);
-	if (rc < 0) {
-		CDBG("Calling ov7692_sensor_open_init fail\n");
-		goto init_fail;
-	}
-
-	rc = ov7692_sensor_setting(REG_INIT, RES_PREVIEW);
-	if (rc < 0)
-		goto init_fail;
-	else
-		goto init_done;
-
-init_fail:
-	CDBG(" ov7692_sensor_open_init fail\n");
-	kfree(ov7692_ctrl);
-init_done:
-	CDBG("ov7692_sensor_open_init done\n");
-	return rc;
-}
-
-static int ov7692_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&ov7692_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id ov7692_i2c_id[] = {
-	{"ov7692", 0},
-	{ }
-};
-
-static int ov7692_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("ov7692_i2c_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	ov7692_sensorw = kzalloc(sizeof(struct ov7692_work_t), GFP_KERNEL);
-	if (!ov7692_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, ov7692_sensorw);
-	ov7692_init_client(client);
-	ov7692_client = client;
-
-	CDBG("ov7692_i2c_probe success! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("ov7692_i2c_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int __exit ov7692_remove(struct i2c_client *client)
-{
-	struct ov7692_work_t_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	ov7692_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static struct i2c_driver ov7692_i2c_driver = {
-	.id_table = ov7692_i2c_id,
-	.probe  = ov7692_i2c_probe,
-	.remove = __exit_p(ov7692_i2c_remove),
-	.driver = {
-		.name = "ov7692",
-	},
-};
-
-int ov7692_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-	if (copy_from_user(&cdata,
-		(void *)argp,
-		sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(&ov7692_mut);
-	CDBG("ov7692_sensor_config: cfgtype = %d\n",
-	cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_SET_MODE:
-		rc = ov7692_set_sensor_mode(cdata.mode,
-			cdata.rs);
-		break;
-	case CFG_PWR_DOWN:
-		rc = ov7692_power_down();
-		break;
-	case CFG_SET_EFFECT:
-		break;
-	default:
-		rc = -EFAULT;
-		break;
-	}
-
-	mutex_unlock(&ov7692_mut);
-
-	return rc;
-}
-static int ov7692_sensor_release(void)
-{
-	int rc = -EBADF;
-	mutex_lock(&ov7692_mut);
-	ov7692_power_down();
-	kfree(ov7692_ctrl);
-	ov7692_ctrl = NULL;
-	CDBG("ov7692_release completed\n");
-	mutex_unlock(&ov7692_mut);
-
-	return rc;
-}
-
-static int ov7692_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-	rc = i2c_add_driver(&ov7692_i2c_driver);
-	if (rc < 0 || ov7692_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_fail;
-	}
-	msm_camio_clk_rate_set(24000000);
-	rc = ov7692_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-	s->s_init = ov7692_sensor_open_init;
-	s->s_release = ov7692_sensor_release;
-	s->s_config  = ov7692_sensor_config;
-	s->s_camera_type = FRONT_CAMERA_2D;
-	s->s_mount_angle = 0;
-	return rc;
-
-probe_fail:
-	CDBG("ov7692_sensor_probe: SENSOR PROBE FAILS!\n");
-	i2c_del_driver(&ov7692_i2c_driver);
-	return rc;
-}
-
-static int __ov7692_probe(struct platform_device *pdev)
-{
-
-	return msm_camera_drv_start(pdev, ov7692_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __ov7692_probe,
-	.driver = {
-		.name = "msm_camera_ov7692",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init ov7692_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(ov7692_init);
-
-MODULE_DESCRIPTION("OMNI VGA YUV sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/ov7692.h b/drivers/media/video/msm/ov7692.h
deleted file mode 100644
index da98284..0000000
--- a/drivers/media/video/msm/ov7692.h
+++ /dev/null
@@ -1,666 +0,0 @@
-/* Copyright (c) 2010, 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-#ifndef OV7692_H
-#define OV7692_H
-#include <linux/types.h>
-#include <mach/board.h>
-
-#define INVMASK(v)  (0xff-v)
-#define OV7692Core_WritePREG(pTbl)  OV7692_WritePRegs \
-			(pTbl, sizeof(pTbl)/sizeof(pTbl[0]))
-
-extern int lcd_camera_power_onoff(int on);
-struct reg_addr_val_pair_struct {
-	uint8_t	reg_addr;
-	uint8_t	reg_val;
-};
-
-enum ov7692_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum ov7692_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-
-enum ov7692_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-enum ov7692_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-/*OV SENSOR SCCB*/
-struct OV7692_WREG {
-	uint8_t addr;
-	uint8_t data;
-	uint8_t mask;
-} OV7692_WREG;
-
-#ifdef CONFIG_WEBCAM_OV7692_QRD
-/*  96MHz PCLK @ 24MHz MCLK */
-struct reg_addr_val_pair_struct ov7692_init_settings_array[] = {
-	{0x12, 0x80},
-	{0x0e, 0x08},
-	{0x69, 0x52},
-	{0x1e, 0xb3},
-	{0x48, 0x42},
-	{0xff, 0x01},
-	{0xae, 0xa0},
-	{0xa8, 0x26},
-	{0xb4, 0xc0},
-	{0xb5, 0x40},
-	{0xff, 0x00},
-	{0x0c, 0x00},
-	{0x62, 0x10},
-	{0x12, 0x00},
-	{0x17, 0x65},
-	{0x18, 0xa4},
-	{0x19, 0x0a},
-	{0x1a, 0xf6},
-	{0x3e, 0x30},
-	{0x64, 0x0a},
-	{0xff, 0x01},
-	{0xb4, 0xc0},
-	{0xff, 0x00},
-	{0x67, 0x20},
-	{0x81, 0x3f},
-	{0xcc, 0x02},
-	{0xcd, 0x80},
-	{0xce, 0x01},
-	{0xcf, 0xe0},
-	{0xc8, 0x02},
-	{0xc9, 0x80},
-	{0xca, 0x01},
-	{0xcb, 0xe0},
-	{0xd0, 0x48},
-	{0x82, 0x03},
-	/*{0x0e, 0x00},*/
-	{0x70, 0x00},
-	{0x71, 0x34},
-	{0x74, 0x28},
-	{0x75, 0x98},
-	{0x76, 0x00},
-	{0x77, 0x64},
-	{0x78, 0x01},
-	{0x79, 0xc2},
-	{0x7a, 0x4e},
-	{0x7b, 0x1f},
-	{0x7c, 0x00},
-	{0x11, 0x00},
-	{0x20, 0x00},
-	{0x21, 0x23},
-	{0x50, 0x9a},
-	{0x51, 0x80},
-	{0x4c, 0x7d},
-	/*{0x0e, 0x00},*/
-	{0x85, 0x10},
-	{0x86, 0x00},
-	{0x87, 0x00},
-	{0x88, 0x00},
-	{0x89, 0x2a},
-	{0x8a, 0x26},
-	{0x8b, 0x22},
-	{0xbb, 0x7a},
-	{0xbc, 0x69},
-	{0xbd, 0x11},
-	{0xbe, 0x13},
-	{0xbf, 0x81},
-	{0xc0, 0x96},
-	{0xc1, 0x1e},
-	{0xb7, 0x05},
-	{0xb8, 0x09},
-	{0xb9, 0x00},
-	{0xba, 0x18},
-	{0x5a, 0x1f},
-	{0x5b, 0x9f},
-	{0x5c, 0x6a},
-	{0x5d, 0x42},
-	{0x24, 0x78},
-	{0x25, 0x68},
-	{0x26, 0xb3},
-	{0xa3, 0x0b},
-	{0xa4, 0x15},
-	{0xa5, 0x2a},
-	{0xa6, 0x51},
-	{0xa7, 0x63},
-	{0xa8, 0x74},
-	{0xa9, 0x83},
-	{0xaa, 0x91},
-	{0xab, 0x9e},
-	{0xac, 0xaa},
-	{0xad, 0xbe},
-	{0xae, 0xce},
-	{0xaf, 0xe5},
-	{0xb0, 0xf3},
-	{0xb1, 0xfb},
-	{0xb2, 0x06},
-	{0x8c, 0x5c},
-	{0x8d, 0x11},
-	{0x8e, 0x12},
-	{0x8f, 0x19},
-	{0x90, 0x50},
-	{0x91, 0x20},
-	{0x92, 0x96},
-	{0x93, 0x80},
-	{0x94, 0x13},
-	{0x95, 0x1b},
-	{0x96, 0xff},
-	{0x97, 0x00},
-	{0x98, 0x3d},
-	{0x99, 0x36},
-	{0x9a, 0x51},
-	{0x9b, 0x43},
-	{0x9c, 0xf0},
-	{0x9d, 0xf0},
-	{0x9e, 0xf0},
-	{0x9f, 0xff},
-	{0xa0, 0x68},
-	{0xa1, 0x62},
-	{0xa2, 0x0e},
-};
-#endif
-/* Exposure Compensation */
-struct OV7692_WREG ov7692_exposure_compensation_lv0_tbl[] = {
-	/*@@ +1.7EV*/
-	{0x24, 0xc0},
-	{0x25, 0xb8},
-	{0x26, 0xe6},
-};
-
-struct OV7692_WREG ov7692_exposure_compensation_lv1_tbl[] = {
-	/*@@ +1.0EV*/
-	{0x24, 0xa8},
-	{0x25, 0xa0},
-	{0x26, 0xc4},
-};
-
-struct OV7692_WREG ov7692_exposure_compensation_lv2_default_tbl[] = {
-	/*@@ default*/
-	{0x24, 0x86},
-	{0x25, 0x76},
-	{0x26, 0xb3},
-};
-
-struct OV7692_WREG ov7692_exposure_compensation_lv3_tbl[] = {
-	/*@@ -1.0EV*/
-	{0x24, 0x70},
-	{0x25, 0x60},
-	{0x26, 0xa2},
-};
-
-struct OV7692_WREG ov7692_exposure_compensation_lv4_tbl[] = {
-	/*@@ -1.7EV*/
-	{0x24, 0x50},
-	{0x25, 0x40},
-	{0x26, 0xa2},
-};
-
-struct OV7692_WREG ov7692_antibanding_off_tbl[] = {
-	{0x13, 0xE5, INVMASK(0x20)},
-};
-
-struct OV7692_WREG ov7692_antibanding_auto_tbl[] = {
-	{0x13, 0x20, INVMASK(0x20)},
-	{0x14, 0x14, INVMASK(0x17)},
-};
-
-struct OV7692_WREG ov7692_antibanding_50z_tbl[] = {
-	/*Band 50Hz*/
-	{0x13, 0x20, INVMASK(0x20)},
-	{0x14, 0x17, INVMASK(0x17)},
-};
-
-struct OV7692_WREG ov7692_antibanding_60z_tbl[] = {
-	/*Band 60Hz*/
-	{0x13, 0x20, INVMASK(0x20)},
-	{0x14, 0x16, INVMASK(0x17)},
-};
-
-/*Saturation*/
-struct OV7692_WREG ov7692_saturation_lv0_tbl[] = {
-	/*Saturation level 0*/
-	{0x81, 0x33, INVMASK(0x33)},
-	{0xd8, 0x00, INVMASK(0xff)},
-	{0xd9, 0x00, INVMASK(0xff)},
-	{0xd2, 0x02, INVMASK(0xff)},
-};
-
-struct OV7692_WREG ov7692_saturation_lv1_tbl[] = {
-	/*Saturation level 1*/
-	{0x81, 0x33, INVMASK(0x33)},
-	{0xd8, 0x10, INVMASK(0xff)},
-	{0xd9, 0x10, INVMASK(0xff)},
-	{0xd2, 0x02, INVMASK(0xff)},
-};
-
-struct OV7692_WREG ov7692_saturation_lv2_tbl[] = {
-	/*Saturation level 2*/
-	{0x81, 0x33, INVMASK(0x33)},
-	{0xd8, 0x20, INVMASK(0xff)},
-	{0xd9, 0x20, INVMASK(0xff)},
-	{0xd2, 0x02, INVMASK(0xff)},
-
-};
-
-struct OV7692_WREG ov7692_saturation_lv3_tbl[] = {
-	/*Saturation level 3*/
-	{0x81, 0x33, INVMASK(0x33)},
-	{0xd8, 0x30, INVMASK(0xff)},
-	{0xd9, 0x30, INVMASK(0xff)},
-	{0xd2, 0x02, INVMASK(0xff)},
-
-};
-
-struct OV7692_WREG ov7692_saturation_default_lv4_tbl[] = {
-	/*Saturation level 4 (default)*/
-	{0x81, 0x33, INVMASK(0x33)},
-	{0xd8, 0x40, INVMASK(0xff)},
-	{0xd9, 0x40, INVMASK(0xff)},
-	{0xd2, 0x02, INVMASK(0xff)},
-};
-
-struct OV7692_WREG ov7692_saturation_lv5_tbl[] = {
-	/*Saturation level 5*/
-	{0x81, 0x33, INVMASK(0x33)},
-	{0xd8, 0x50, INVMASK(0xff)},
-	{0xd9, 0x50, INVMASK(0xff)},
-	{0xd2, 0x02, INVMASK(0xff)},
-};
-
-struct OV7692_WREG ov7692_saturation_lv6_tbl[] = {
-	/*Saturation level 6*/
-	{0x81, 0x33, INVMASK(0x33)},
-	{0xd8, 0x60, INVMASK(0xff)},
-	{0xd9, 0x60, INVMASK(0xff)},
-	{0xd2, 0x02, INVMASK(0xff)},
-};
-
-struct OV7692_WREG ov7692_saturation_lv7_tbl[] = {
-	/*Saturation level 7*/
-	{0x81, 0x33, INVMASK(0x33)},
-	{0xd8, 0x70, INVMASK(0xff)},
-	{0xd9, 0x70, INVMASK(0xff)},
-	{0xd2, 0x02, INVMASK(0xff)},
-};
-
-struct OV7692_WREG ov7692_saturation_lv8_tbl[] = {
-	/*Saturation level 8*/
-	{0x81, 0x33, INVMASK(0x33)},
-	{0xd8, 0x80, INVMASK(0xff)},
-	{0xd9, 0x80, INVMASK(0xff)},
-	{0xd2, 0x02, INVMASK(0xff)},
-};
-
-/*EFFECT*/
-struct OV7692_WREG ov7692_effect_normal_tbl[] = {
-	{0x81, 0x00, INVMASK(0x20)},
-	{0x28, 0x00, },
-	{0xd2, 0x00, },
-	{0xda, 0x80, },
-	{0xdb, 0x80, },
-};
-
-struct OV7692_WREG ov7692_effect_mono_tbl[] = {
-	{0x81, 0x20, INVMASK(0x20)},
-	{0x28, 0x00, },
-	{0xd2, 0x18, },
-	{0xda, 0x80, },
-	{0xdb, 0x80, },
-};
-
-struct OV7692_WREG ov7692_effect_bw_tbl[] = {
-	{0x81, 0x20, INVMASK(0x20)},
-	{0x28, 0x00, },
-	{0xd2, 0x18, },
-	{0xda, 0x80, },
-	{0xdb, 0x80, },
-};
-
-struct OV7692_WREG ov7692_effect_sepia_tbl[] = {
-	{0x81, 0x20, INVMASK(0x20)},
-	{0x28, 0x00, },
-	{0xd2, 0x18, },
-	{0xda, 0x40, },
-	{0xdb, 0xa0, },
-};
-
-struct OV7692_WREG ov7692_effect_bluish_tbl[] = {
-	{0x81, 0x20, INVMASK(0x20)},
-	{0x28, 0x00, },
-	{0xd2, 0x18, },
-	{0xda, 0xc0, },
-	{0xdb, 0x80, },
-};
-
-struct OV7692_WREG ov7692_effect_reddish_tbl[] = {
-	{0x81, 0x20, INVMASK(0x20)},
-	{0x28, 0x00, },
-	{0xd2, 0x18, },
-	{0xda, 0x80, },
-	{0xdb, 0xc0, },
-};
-
-struct OV7692_WREG ov7692_effect_greenish_tbl[] = {
-	{0x81, 0x20, INVMASK(0x20)},
-	{0x28, 0x00, },
-	{0xd2, 0x18, },
-	{0xda, 0x60, },
-	{0xdb, 0x60, },
-};
-
-struct OV7692_WREG ov7692_effect_negative_tbl[] = {
-	{0x81, 0x20, INVMASK(0x20)},
-	{0x28, 0x80, },
-	{0xd2, 0x40, },
-	{0xda, 0x80, },
-	{0xdb, 0x80, },
-};
-
-/*Contrast*/
-struct OV7692_WREG ov7692_contrast_lv0_tbl[] = {
-	/*Contrast -4*/
-	{0xb2, 0x29},
-	{0xa3, 0x55},
-	{0xa4, 0x5b},
-	{0xa5, 0x67},
-	{0xa6, 0x7e},
-	{0xa7, 0x89},
-	{0xa8, 0x93},
-	{0xa9, 0x9c},
-	{0xaa, 0xa4},
-	{0xab, 0xac},
-	{0xac, 0xb3},
-	{0xad, 0xbe},
-	{0xae, 0xc7},
-	{0xaf, 0xd5},
-	{0xb0, 0xdd},
-	{0xb1, 0xe1},
-};
-
-struct OV7692_WREG ov7692_contrast_lv1_tbl[] = {
-	/*Contrast -3*/
-	{0xb2, 0x20},
-	{0xa3, 0x43},
-	{0xa4, 0x4a},
-	{0xa5, 0x58},
-	{0xa6, 0x73},
-	{0xa7, 0x80},
-	{0xa8, 0x8b},
-	{0xa9, 0x96},
-	{0xaa, 0x9f},
-	{0xab, 0xa8},
-	{0xac, 0xb1},
-	{0xad, 0xbe},
-	{0xae, 0xc9},
-	{0xaf, 0xd8},
-	{0xb0, 0xe2},
-	{0xb1, 0xe8},
-};
-
-struct OV7692_WREG ov7692_contrast_lv2_tbl[] = {
-	/*Contrast -2*/
-	{0xb2, 0x18},
-	{0xa3, 0x31},
-	{0xa4, 0x39},
-	{0xa5, 0x4a},
-	{0xa6, 0x68},
-	{0xa7, 0x77},
-	{0xa8, 0x84},
-	{0xa9, 0x90},
-	{0xaa, 0x9b},
-	{0xab, 0xa5},
-	{0xac, 0xaf},
-	{0xad, 0xbe},
-	{0xae, 0xca},
-	{0xaf, 0xdc},
-	{0xb0, 0xe7},
-	{0xb1, 0xee},
-};
-
-struct OV7692_WREG ov7692_contrast_lv3_tbl[] = {
-	/*Contrast -1*/
-	{0xb2, 0x10},
-	{0xa3, 0x1f},
-	{0xa4, 0x28},
-	{0xa5, 0x3b},
-	{0xa6, 0x5d},
-	{0xa7, 0x6e},
-	{0xa8, 0x7d},
-	{0xa9, 0x8a},
-	{0xaa, 0x96},
-	{0xab, 0xa2},
-	{0xac, 0xad},
-	{0xad, 0xbe},
-	{0xae, 0xcc},
-	{0xaf, 0xe0},
-	{0xb0, 0xed},
-	{0xb1, 0xf4},
-};
-
-struct OV7692_WREG ov7692_contrast_default_lv4_tbl[] = {
-	/*Contrast 0*/
-	{0xb2, 0x6},
-	{0xa3, 0xb},
-	{0xa4, 0x15},
-	{0xa5, 0x2a},
-	{0xa6, 0x51},
-	{0xa7, 0x63},
-	{0xa8, 0x74},
-	{0xa9, 0x83},
-	{0xaa, 0x91},
-	{0xab, 0x9e},
-	{0xac, 0xaa},
-	{0xad, 0xbe},
-	{0xae, 0xce},
-	{0xaf, 0xe5},
-	{0xb0, 0xf3},
-	{0xb1, 0xfb},
-};
-
-struct OV7692_WREG ov7692_contrast_lv5_tbl[] = {
-	/*Contrast 1*/
-	{0xb2, 0xc},
-	{0xa3, 0x4},
-	{0xa4, 0xc},
-	{0xa5, 0x1f},
-	{0xa6, 0x45},
-	{0xa7, 0x58},
-	{0xa8, 0x6b},
-	{0xa9, 0x7c},
-	{0xaa, 0x8d},
-	{0xab, 0x9d},
-	{0xac, 0xac},
-	{0xad, 0xc3},
-	{0xae, 0xd2},
-	{0xaf, 0xe8},
-	{0xb0, 0xf2},
-	{0xb1, 0xf7},
-};
-
-struct OV7692_WREG ov7692_contrast_lv6_tbl[] = {
-	/*Contrast 2*/
-	{0xb2, 0x1},
-	{0xa3, 0x2},
-	{0xa4, 0x9},
-	{0xa5, 0x1a},
-	{0xa6, 0x3e},
-	{0xa7, 0x4a},
-	{0xa8, 0x59},
-	{0xa9, 0x6a},
-	{0xaa, 0x79},
-	{0xab, 0x8e},
-	{0xac, 0xa4},
-	{0xad, 0xc1},
-	{0xae, 0xdb},
-	{0xaf, 0xf4},
-	{0xb0, 0xff},
-	{0xb1, 0xff},
-};
-
-struct OV7692_WREG ov7692_contrast_lv7_tbl[] = {
-	/*Contrast 3*/
-	{0xb2, 0xc},
-	{0xa3, 0x4},
-	{0xa4, 0x8},
-	{0xa5, 0x17},
-	{0xa6, 0x27},
-	{0xa7, 0x3d},
-	{0xa8, 0x54},
-	{0xa9, 0x60},
-	{0xaa, 0x77},
-	{0xab, 0x85},
-	{0xac, 0xa4},
-	{0xad, 0xc6},
-	{0xae, 0xd2},
-	{0xaf, 0xe9},
-	{0xb0, 0xf0},
-	{0xb1, 0xf7},
-};
-
-struct OV7692_WREG ov7692_contrast_lv8_tbl[] = {
-	/*Contrast 4*/
-	{0xb2, 0x1},
-	{0xa3, 0x4},
-	{0xa4, 0x4},
-	{0xa5, 0x7},
-	{0xa6, 0xb},
-	{0xa7, 0x17},
-	{0xa8, 0x2a},
-	{0xa9, 0x41},
-	{0xaa, 0x59},
-	{0xab, 0x6b},
-	{0xac, 0x8b},
-	{0xad, 0xb1},
-	{0xae, 0xd2},
-	{0xaf, 0xea},
-	{0xb0, 0xf4},
-	{0xb1, 0xff},
-};
-
-	/*Sharpness*/
-struct OV7692_WREG ov7692_sharpness_lv0_tbl[] = {
-	/*Sharpness 0*/
-	{0xb4, 0x20, INVMASK(0x20)},
-	{0xb6, 0x00, INVMASK(0x1f)},
-};
-struct OV7692_WREG ov7692_sharpness_lv1_tbl[] = {
-	/*Sharpness 1*/
-	{0xb4, 0x20, INVMASK(0x20)},
-	{0xb6, 0x01, INVMASK(0x1f)},
-};
-struct OV7692_WREG ov7692_sharpness_default_lv2_tbl[] = {
-	/*Sharpness Auto (Default)*/
-	{0xb4, 0x00, INVMASK(0x20)},
-	{0xb6, 0x00, INVMASK(0x1f)},
-};
-struct OV7692_WREG ov7692_sharpness_lv3_tbl[] = {
-	/*Sharpness 3*/
-	{0xb4, 0x20, INVMASK(0x20)},
-	{0xb6, 0x66, INVMASK(0x04)},
-};
-struct OV7692_WREG ov7692_sharpness_lv4_tbl[] = {
-	/*Sharpness 4*/
-	{0xb4, 0x20, INVMASK(0x20)},
-	{0xb6, 0x99, INVMASK(0x1f)},
-};
-struct OV7692_WREG ov7692_sharpness_lv5_tbl[] = {
-	/*Sharpness 5*/
-	{0xb4, 0x20, INVMASK(0x20)},
-	{0xb6, 0xcc, INVMASK(0x1f)},
-};
-struct OV7692_WREG ov7692_sharpness_lv6_tbl[] = {
-	/*Sharpness 6*/
-	{0xb4, 0x20, INVMASK(0x20)},
-	{0xb6, 0xff, INVMASK(0x1f)},
-};
-
-	/* ISO TYPE*/
-struct OV7692_WREG ov7692_iso_type_auto[] = {
-	/*@@ISO Auto*/
-	{0x14, 0x20, INVMASK(0x70)},
-};
-
-struct OV7692_WREG ov7692_iso_type_100[] = {
-	/*@@ISO 100*/
-	{0x14, 0x00, INVMASK(0x70)},
-};
-
-struct OV7692_WREG ov7692_iso_type_200[] = {
-	/*@@ISO 200*/
-	{0x14, 0x10, INVMASK(0x70)},
-};
-
-struct OV7692_WREG ov7692_iso_type_400[] = {
-	/*@@ISO 400*/
-	{0x14, 0x20, INVMASK(0x70)},
-};
-
-struct OV7692_WREG ov7692_iso_type_800[] = {
-	/*@@ISO 800*/
-	{0x14, 0x30, INVMASK(0x70)},
-};
-
-struct OV7692_WREG ov7692_iso_type_1600[] = {
-	/*@@ISO 1600*/
-	{0x14, 0x40, INVMASK(0x70)},
-};
-
-	/*Light Mode*/
-struct OV7692_WREG ov7692_wb_def[] = {
-	{0x13, 0xf7},
-	{0x15, 0x00},
-};
-
-struct OV7692_WREG ov7692_wb_custom[] = {
-	{0x13, 0xf5},
-	{0x01, 0x56},
-	{0x02, 0x50},
-	{0x15, 0x00},
-};
-
-struct OV7692_WREG ov7692_wb_inc[] = {
-	{0x13, 0xf5},
-	{0x01, 0x66},
-	{0x02, 0x40},
-	{0x15, 0x00},
-};
-
-struct OV7692_WREG ov7692_wb_daylight[] = {
-	{0x13, 0xf5},
-	{0x01, 0x43},
-	{0x02, 0x5d},
-	{0x15, 0x00},
-};
-
-struct OV7692_WREG ov7692_wb_cloudy[] = {
-	{0x13, 0xf5},
-	{0x01, 0x48},
-	{0x02, 0x63},
-	{0x15, 0x00},
-};
-
-#endif
-
diff --git a/drivers/media/video/msm/ov7692_qrd.c b/drivers/media/video/msm/ov7692_qrd.c
deleted file mode 100644
index 05a82ab..0000000
--- a/drivers/media/video/msm/ov7692_qrd.c
+++ /dev/null
@@ -1,1178 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/slab.h>
-#include <media/msm_camera.h>
-#include <mach/camera.h>
-#include <mach/gpio.h>
-#include "ov7692.h"
-
-/*=============================================================
-    SENSOR REGISTER DEFINES
-==============================================================*/
-#define Q8    0x00000100
-
-/* Omnivision8810 product ID register address */
-#define REG_OV7692_MODEL_ID_MSB                       0x0A
-#define REG_OV7692_MODEL_ID_LSB                       0x0B
-
-#define OV7692_MODEL_ID                       0x7692
-/* Omnivision8810 product ID */
-
-/* Time in milisecs for waiting for the sensor to reset */
-#define OV7692_RESET_DELAY_MSECS    66
-#define OV7692_DEFAULT_CLOCK_RATE   24000000
-/* Registers*/
-
-/* Color bar pattern selection */
-#define OV7692_COLOR_BAR_PATTERN_SEL_REG     0x82
-/* Color bar enabling control */
-#define OV7692_COLOR_BAR_ENABLE_REG           0x601
-/* Time in milisecs for waiting for the sensor to reset*/
-#define OV7692_RESET_DELAY_MSECS    66
-
-static int ov7692_pwdn_gpio;
-static int ov7692_reset_gpio;
-
-
-/*============================================================================
-			DATA DECLARATIONS
-============================================================================*/
-
-
-static bool OV7692_CSI_CONFIG;
-/* 816x612, 24MHz MCLK 96MHz PCLK */
-uint32_t OV7692_FULL_SIZE_WIDTH        = 640;
-uint32_t OV7692_FULL_SIZE_HEIGHT       = 480;
-
-uint32_t OV7692_QTR_SIZE_WIDTH         = 640;
-uint32_t OV7692_QTR_SIZE_HEIGHT        = 480;
-
-uint32_t OV7692_HRZ_FULL_BLK_PIXELS    = 16;
-uint32_t OV7692_VER_FULL_BLK_LINES     = 12;
-uint32_t OV7692_HRZ_QTR_BLK_PIXELS     = 16;
-uint32_t OV7692_VER_QTR_BLK_LINES      = 12;
-
-struct ov7692_work_t {
-	struct work_struct work;
-};
-static struct  ov7692_work_t *ov7692_sensorw;
-static struct  i2c_client *ov7692_client;
-struct ov7692_ctrl_t {
-	const struct  msm_camera_sensor_info *sensordata;
-	uint32_t sensormode;
-	uint32_t fps_divider;        /* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;    /* init to 1 * 0x00000400 */
-	uint32_t fps;
-	int32_t  curr_lens_pos;
-	uint32_t curr_step_pos;
-	uint32_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint32_t total_lines_per_frame;
-	enum ov7692_resolution_t prev_res;
-	enum ov7692_resolution_t pict_res;
-	enum ov7692_resolution_t curr_res;
-	enum ov7692_test_mode_t  set_test;
-	unsigned short imgaddr;
-};
-static struct ov7692_ctrl_t *ov7692_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(ov7692_wait_queue);
-DEFINE_MUTEX(ov7692_mut);
-static int effect_value;
-static int16_t ov7692_effect = CAMERA_EFFECT_OFF;
-static unsigned int SAT_U = 0x80;
-static unsigned int SAT_V = 0x80;
-
-/*=============================================================*/
-
-static int ov7692_i2c_rxdata(unsigned short saddr,
-		unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = 1,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = 1,
-			.buf   = rxdata,
-		},
-	};
-	if (i2c_transfer(ov7692_client->adapter, msgs, 2) < 0) {
-		CDBG("ov7692_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-	return 0;
-}
-static int32_t ov7692_i2c_txdata(unsigned short saddr,
-		unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = 2,
-			.buf = txdata,
-		},
-	};
-	if (i2c_transfer(ov7692_client->adapter, msg, 1) < 0) {
-		CDBG("ov7692_i2c_txdata faild 0x%x\n", ov7692_client->addr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t ov7692_i2c_read(uint8_t raddr,
-		uint8_t *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[1];
-	if (!rdata)
-		return -EIO;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = raddr;
-	rc = ov7692_i2c_rxdata(ov7692_client->addr >> 1, buf, rlen);
-	if (rc < 0) {
-		CDBG("ov7692_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = buf[0];
-	return rc;
-}
-static int32_t ov7692_i2c_write_b_sensor(uint8_t waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[2];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = waddr;
-	buf[1] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = ov7692_i2c_txdata(ov7692_client->addr >> 1, buf, 2);
-	if (rc < 0)
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-		waddr, bdata);
-
-	return rc;
-}
-
-static int32_t OV7692_WritePRegs(struct OV7692_WREG *pTb, int32_t len)
-{
-	int32_t i, ret = 0;
-	uint8_t regv;
-
-	for (i = 0; i < len; i++) {
-		if (pTb[i].mask == 0) {
-			ov7692_i2c_write_b_sensor(pTb[i].addr, pTb[i].data);
-		} else {
-			ov7692_i2c_read(pTb[i].addr, &regv, 1);
-			regv &= pTb[i].mask;
-			regv |= (pTb[i].data & (~pTb[i].mask));
-			ov7692_i2c_write_b_sensor(pTb[i].addr, regv);
-		}
-	}
-	return ret;
-}
-
-static int32_t ov7692_sensor_setting(int update_type, int rt)
-{
-	int32_t i, array_length;
-	int32_t rc = 0;
-	struct msm_camera_csi_params ov7692_csi_params;
-
-	CDBG("%s: rt = %d\n", __func__, rt);
-
-	switch (update_type) {
-	case REG_INIT:
-		OV7692_CSI_CONFIG = 0;
-		ov7692_i2c_write_b_sensor(0x0e, 0x08);
-		return rc;
-		break;
-	case UPDATE_PERIODIC:
-		if (!OV7692_CSI_CONFIG) {
-			ov7692_csi_params.lane_cnt = 1;
-			ov7692_csi_params.data_format = CSI_8BIT;
-			ov7692_csi_params.lane_assign = 0xe4;
-			ov7692_csi_params.dpcm_scheme = 0;
-			ov7692_csi_params.settle_cnt = 0x14;
-
-			array_length = sizeof(ov7692_init_settings_array) /
-				sizeof(ov7692_init_settings_array[0]);
-			for (i = 0; i < array_length; i++) {
-				rc = ov7692_i2c_write_b_sensor(
-				ov7692_init_settings_array[i].reg_addr,
-				ov7692_init_settings_array[i].reg_val);
-				if (rc < 0)
-					return rc;
-			}
-			usleep_range(10000, 11000);
-			rc = msm_camio_csi_config(&ov7692_csi_params);
-			usleep_range(10000, 11000);
-			ov7692_i2c_write_b_sensor(0x0e, 0x00);
-			OV7692_CSI_CONFIG = 1;
-			msleep(20);
-			return rc;
-		}
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-static int32_t ov7692_video_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-	/* change sensor resolution if needed */
-	rt = RES_PREVIEW;
-
-	CDBG("%s\n", __func__);
-
-	if (ov7692_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-		return rc;
-	ov7692_ctrl->curr_res = ov7692_ctrl->prev_res;
-	ov7692_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t ov7692_set_sensor_mode(int mode,
-		int res)
-{
-	int32_t rc = 0;
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = ov7692_video_config(mode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-static int ov7692_set_exposure_compensation(int compensation)
-{
-	long rc = 0;
-
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-	CDBG("--CAMERA-- %s ...exposure_compensation = %d\n",
-		 __func__ , compensation);
-	switch (compensation) {
-	case CAMERA_EXPOSURE_COMPENSATION_LV0:
-		CDBG("--CAMERA--CAMERA_EXPOSURE_COMPENSATION_LV0\n");
-		rc = OV7692Core_WritePREG(
-			ov7692_exposure_compensation_lv0_tbl);
-		break;
-	case CAMERA_EXPOSURE_COMPENSATION_LV1:
-		CDBG("--CAMERA--CAMERA_EXPOSURE_COMPENSATION_LV1\n");
-		rc = OV7692Core_WritePREG(
-			ov7692_exposure_compensation_lv1_tbl);
-		break;
-	case CAMERA_EXPOSURE_COMPENSATION_LV2:
-		CDBG("--CAMERA--CAMERA_EXPOSURE_COMPENSATION_LV2\n");
-		rc = OV7692Core_WritePREG(
-			ov7692_exposure_compensation_lv2_default_tbl);
-		break;
-	case CAMERA_EXPOSURE_COMPENSATION_LV3:
-		CDBG("--CAMERA--CAMERA_EXPOSURE_COMPENSATION_LV3\n");
-		rc = OV7692Core_WritePREG(
-			ov7692_exposure_compensation_lv3_tbl);
-		break;
-	case CAMERA_EXPOSURE_COMPENSATION_LV4:
-		CDBG("--CAMERA--CAMERA_EXPOSURE_COMPENSATION_LV3\n");
-		rc = OV7692Core_WritePREG(
-			ov7692_exposure_compensation_lv4_tbl);
-		break;
-	default:
-		CDBG("--CAMERA--ERROR CAMERA_EXPOSURE_COMPENSATION\n");
-		break;
-	}
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static long ov7692_set_antibanding(int antibanding)
-{
-	long rc = 0;
-
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-	CDBG("--CAMERA-- %s ...antibanding = %d\n", __func__, antibanding);
-	switch (antibanding) {
-	case CAMERA_ANTIBANDING_OFF:
-		CDBG("--CAMERA--CAMERA_ANTIBANDING_OFF\n");
-		break;
-	case CAMERA_ANTIBANDING_60HZ:
-		CDBG("--CAMERA--CAMERA_ANTIBANDING_60HZ\n");
-		rc = OV7692Core_WritePREG(ov7692_antibanding_60z_tbl);
-		break;
-	case CAMERA_ANTIBANDING_50HZ:
-		CDBG("--CAMERA--CAMERA_ANTIBANDING_50HZ\n");
-		rc = OV7692Core_WritePREG(ov7692_antibanding_50z_tbl);
-		break;
-	case CAMERA_ANTIBANDING_AUTO:
-		CDBG("--CAMERA--CAMERA_ANTIBANDING_AUTO\n");
-		rc = OV7692Core_WritePREG(ov7692_antibanding_auto_tbl);
-		break;
-	default:
-		CDBG("--CAMERA--CAMERA_ANTIBANDING_ERROR COMMAND\n");
-		break;
-	}
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static int ov7692_set_saturation(int saturation)
-{
-	long rc = 0;
-
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-	CDBG("--CAMERA-- %s ...saturation = %d\n", __func__ , saturation);
-
-	if (effect_value == CAMERA_EFFECT_OFF) {
-		switch (saturation) {
-		case CAMERA_SATURATION_LV0:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV0\n");
-			rc = OV7692Core_WritePREG(ov7692_saturation_lv0_tbl);
-			break;
-		case CAMERA_SATURATION_LV1:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV1\n");
-			rc = OV7692Core_WritePREG(ov7692_saturation_lv1_tbl);
-			break;
-		case CAMERA_SATURATION_LV2:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV2\n");
-			rc = OV7692Core_WritePREG(ov7692_saturation_lv2_tbl);
-			break;
-		case CAMERA_SATURATION_LV3:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV3\n");
-			rc = OV7692Core_WritePREG(ov7692_saturation_lv3_tbl);
-			break;
-		case CAMERA_SATURATION_LV4:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV4\n");
-			rc = OV7692Core_WritePREG(
-				ov7692_saturation_default_lv4_tbl);
-			break;
-		case CAMERA_SATURATION_LV5:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV5\n");
-			rc = OV7692Core_WritePREG(ov7692_saturation_lv5_tbl);
-			break;
-		case CAMERA_SATURATION_LV6:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV6\n");
-			rc = OV7692Core_WritePREG(ov7692_saturation_lv6_tbl);
-			break;
-		case CAMERA_SATURATION_LV7:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV7\n");
-			rc = OV7692Core_WritePREG(ov7692_saturation_lv7_tbl);
-			break;
-		case CAMERA_SATURATION_LV8:
-			CDBG("--CAMERA--CAMERA_SATURATION_LV8\n");
-			rc = OV7692Core_WritePREG(ov7692_saturation_lv8_tbl);
-			break;
-		default:
-			CDBG("--CAMERA--CAMERA_SATURATION_ERROR COMMAND\n");
-			break;
-		}
-	}
-
-	/*for recover saturation level when change special effect*/
-	switch (saturation) {
-	case CAMERA_SATURATION_LV0:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV0\n");
-		SAT_U = 0x00;
-		SAT_V = 0x00;
-		break;
-	case CAMERA_SATURATION_LV1:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV1\n");
-		SAT_U = 0x10;
-		SAT_V = 0x10;
-		break;
-	case CAMERA_SATURATION_LV2:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV2\n");
-		SAT_U = 0x20;
-		SAT_V = 0x20;
-		break;
-	case CAMERA_SATURATION_LV3:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV3\n");
-		SAT_U = 0x30;
-		SAT_V = 0x30;
-		break;
-	case CAMERA_SATURATION_LV4:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV4\n");
-		SAT_U = 0x40;
-		SAT_V = 0x40;
-		break;
-	case CAMERA_SATURATION_LV5:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV5\n");
-		SAT_U = 0x50;
-		SAT_V = 0x50;
-		break;
-	case CAMERA_SATURATION_LV6:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV6\n");
-		SAT_U = 0x60;
-		SAT_V = 0x60;
-		break;
-	case CAMERA_SATURATION_LV7:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV7\n");
-		SAT_U = 0x70;
-		SAT_V = 0x70;
-		break;
-	case CAMERA_SATURATION_LV8:
-		CDBG("--CAMERA--CAMERA_SATURATION_LV8\n");
-		SAT_U = 0x80;
-		SAT_V = 0x80;
-		break;
-	default:
-		CDBG("--CAMERA--CAMERA_SATURATION_ERROR COMMAND\n");
-		break;
-	}
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static long ov7692_set_effect(int mode, int effect)
-{
-	int rc = 0;
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		break;
-	case SENSOR_HFR_60FPS_MODE:
-		break;
-	case SENSOR_HFR_90FPS_MODE:
-		/* Context A Special Effects */
-		CDBG("-CAMERA- %s ...SENSOR_PREVIEW_MODE\n", __func__);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-		/* Context B Special Effects */
-		CDBG("-CAMERA- %s ...SENSOR_SNAPSHOT_MODE\n", __func__);
-		break;
-	default:
-		break;
-	}
-	effect_value = effect;
-	switch (effect) {
-	case CAMERA_EFFECT_OFF: {
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_OFF\n", __func__);
-		rc = OV7692Core_WritePREG(ov7692_effect_normal_tbl);
-		/* for recover saturation level
-		 when change special effect*/
-		ov7692_i2c_write_b_sensor(0xda, SAT_U);
-		/* for recover saturation level
-		when change special effect*/
-		ov7692_i2c_write_b_sensor(0xdb, SAT_V);
-		break;
-	}
-	case CAMERA_EFFECT_MONO: {
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_MONO\n", __func__);
-		rc = OV7692Core_WritePREG(ov7692_effect_mono_tbl);
-		break;
-	}
-	case CAMERA_EFFECT_BW: {
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_BW\n", __func__);
-		rc = OV7692Core_WritePREG(ov7692_effect_bw_tbl);
-		break;
-	}
-	case CAMERA_EFFECT_BLUISH: {
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_BLUISH\n", __func__);
-		rc = OV7692Core_WritePREG(ov7692_effect_bluish_tbl);
-		break;
-	}
-	case CAMERA_EFFECT_SOLARIZE: {
-		CDBG("%s ...CAMERA_EFFECT_NEGATIVE(No Support)!\n", __func__);
-		break;
-	}
-	case CAMERA_EFFECT_SEPIA: {
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_SEPIA\n", __func__);
-		rc = OV7692Core_WritePREG(ov7692_effect_sepia_tbl);
-		break;
-	}
-	case CAMERA_EFFECT_REDDISH: {
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_REDDISH\n", __func__);
-		rc = OV7692Core_WritePREG(ov7692_effect_reddish_tbl);
-		break;
-	}
-	case CAMERA_EFFECT_GREENISH: {
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_GREENISH\n", __func__);
-		rc = OV7692Core_WritePREG(ov7692_effect_greenish_tbl);
-		break;
-	}
-	case CAMERA_EFFECT_NEGATIVE: {
-		CDBG("--CAMERA-- %s ...CAMERA_EFFECT_NEGATIVE\n", __func__);
-		rc = OV7692Core_WritePREG(ov7692_effect_negative_tbl);
-		break;
-	}
-	default: {
-		CDBG("--CAMERA-- %s ...Default(Not Support)\n", __func__);
-	}
-	}
-	ov7692_effect = effect;
-	/*Refresh Sequencer */
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static int ov7692_set_contrast(int contrast)
-{
-	int rc = 0;
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-	CDBG("--CAMERA-- %s ...contrast = %d\n", __func__ , contrast);
-
-	if (effect_value == CAMERA_EFFECT_OFF) {
-		switch (contrast) {
-		case CAMERA_CONTRAST_LV0:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV0\n");
-			rc = OV7692Core_WritePREG(ov7692_contrast_lv0_tbl);
-			break;
-		case CAMERA_CONTRAST_LV1:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV1\n");
-			rc = OV7692Core_WritePREG(ov7692_contrast_lv1_tbl);
-			break;
-		case CAMERA_CONTRAST_LV2:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV2\n");
-			rc = OV7692Core_WritePREG(ov7692_contrast_lv2_tbl);
-			break;
-		case CAMERA_CONTRAST_LV3:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV3\n");
-			rc = OV7692Core_WritePREG(ov7692_contrast_lv3_tbl);
-			break;
-		case CAMERA_CONTRAST_LV4:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV4\n");
-			rc = OV7692Core_WritePREG(
-				ov7692_contrast_default_lv4_tbl);
-			break;
-		case CAMERA_CONTRAST_LV5:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV5\n");
-			rc = OV7692Core_WritePREG(ov7692_contrast_lv5_tbl);
-			break;
-		case CAMERA_CONTRAST_LV6:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV6\n");
-			rc = OV7692Core_WritePREG(ov7692_contrast_lv6_tbl);
-			break;
-		case CAMERA_CONTRAST_LV7:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV7\n");
-			rc = OV7692Core_WritePREG(ov7692_contrast_lv7_tbl);
-			break;
-		case CAMERA_CONTRAST_LV8:
-			CDBG("--CAMERA--CAMERA_CONTRAST_LV8\n");
-			rc = OV7692Core_WritePREG(ov7692_contrast_lv8_tbl);
-			break;
-		default:
-			CDBG("--CAMERA--CAMERA_CONTRAST_ERROR COMMAND\n");
-			break;
-		}
-	}
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static int ov7692_set_sharpness(int sharpness)
-{
-	int rc = 0;
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-	CDBG("--CAMERA-- %s ...sharpness = %d\n", __func__ , sharpness);
-
-	if (effect_value == CAMERA_EFFECT_OFF) {
-		switch (sharpness) {
-		case CAMERA_SHARPNESS_LV0:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV0\n");
-			rc = OV7692Core_WritePREG(ov7692_sharpness_lv0_tbl);
-			break;
-		case CAMERA_SHARPNESS_LV1:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV1\n");
-			rc = OV7692Core_WritePREG(ov7692_sharpness_lv1_tbl);
-			break;
-		case CAMERA_SHARPNESS_LV2:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV2\n");
-			rc = OV7692Core_WritePREG(
-				ov7692_sharpness_default_lv2_tbl);
-			break;
-		case CAMERA_SHARPNESS_LV3:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV3\n");
-			rc = OV7692Core_WritePREG(ov7692_sharpness_lv3_tbl);
-			break;
-		case CAMERA_SHARPNESS_LV4:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV4\n");
-			rc = OV7692Core_WritePREG(ov7692_sharpness_lv4_tbl);
-			break;
-		case CAMERA_SHARPNESS_LV5:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV5\n");
-			rc = OV7692Core_WritePREG(ov7692_sharpness_lv5_tbl);
-			break;
-		case CAMERA_SHARPNESS_LV6:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_LV6\n");
-			rc = OV7692Core_WritePREG(ov7692_sharpness_lv6_tbl);
-			break;
-		default:
-			CDBG("--CAMERA--CAMERA_SHARPNESS_ERROR COMMAND\n");
-			break;
-		}
-	}
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static int ov7692_set_iso(int8_t iso_type)
-{
-	long rc = 0;
-
-	CDBG("--CAMERA-- %s ...(Start)\n", __func__);
-	CDBG("--CAMERA-- %s ...iso_type = %d\n", __func__ , iso_type);
-	switch (iso_type) {
-	case CAMERA_ISO_TYPE_AUTO:
-		CDBG("--CAMERA--CAMERA_ISO_TYPE_AUTO\n");
-		rc = OV7692Core_WritePREG(ov7692_iso_type_auto);
-		break;
-	case CAMEAR_ISO_TYPE_HJR:
-		CDBG("--CAMERA--CAMEAR_ISO_TYPE_HJR\n");
-		rc = OV7692Core_WritePREG(ov7692_iso_type_auto);
-		break;
-	case CAMEAR_ISO_TYPE_100:
-		CDBG("--CAMERA--CAMEAR_ISO_TYPE_100\n");
-		rc = OV7692Core_WritePREG(ov7692_iso_type_100);
-		break;
-	case CAMERA_ISO_TYPE_200:
-		CDBG("--CAMERA--CAMERA_ISO_TYPE_200\n");
-		rc = OV7692Core_WritePREG(ov7692_iso_type_200);
-		break;
-	case CAMERA_ISO_TYPE_400:
-		CDBG("--CAMERA--CAMERA_ISO_TYPE_400\n");
-		rc = OV7692Core_WritePREG(ov7692_iso_type_400);
-		break;
-	case CAMEAR_ISO_TYPE_800:
-		CDBG("--CAMERA--CAMEAR_ISO_TYPE_800\n");
-		rc = OV7692Core_WritePREG(ov7692_iso_type_800);
-		break;
-	case CAMERA_ISO_TYPE_1600:
-		CDBG("--CAMERA--CAMERA_ISO_TYPE_1600\n");
-		rc = OV7692Core_WritePREG(ov7692_iso_type_1600);
-		break;
-	default:
-		CDBG("--CAMERA--ERROR ISO TYPE\n");
-		break;
-	}
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-static int ov7692_set_wb_oem(uint8_t param)
-{
-	int rc = 0;
-	CDBG("--CAMERA--%s runs\r\n", __func__);
-
-	switch (param) {
-	case CAMERA_WB_AUTO:
-		CDBG("--CAMERA--CAMERA_WB_AUTO\n");
-		rc = OV7692Core_WritePREG(ov7692_wb_def);
-		break;
-	case CAMERA_WB_CUSTOM:
-		CDBG("--CAMERA--CAMERA_WB_CUSTOM\n");
-		rc = OV7692Core_WritePREG(ov7692_wb_custom);
-		break;
-	case CAMERA_WB_INCANDESCENT:
-		CDBG("--CAMERA--CAMERA_WB_INCANDESCENT\n");
-		rc = OV7692Core_WritePREG(ov7692_wb_inc);
-		break;
-	case CAMERA_WB_DAYLIGHT:
-		CDBG("--CAMERA--CAMERA_WB_DAYLIGHT\n");
-		rc = OV7692Core_WritePREG(ov7692_wb_daylight);
-		break;
-	case CAMERA_WB_CLOUDY_DAYLIGHT:
-		CDBG("--CAMERA--CAMERA_WB_CLOUDY_DAYLIGHT\n");
-		rc = OV7692Core_WritePREG(ov7692_wb_cloudy);
-		break;
-	default:
-		break;
-	}
-	return rc;
-}
-
-static void ov7692_power_on(void)
-{
-	CDBG("%s\n", __func__);
-	gpio_set_value(ov7692_pwdn_gpio, 0);
-}
-
-static void ov7692_power_down(void)
-{
-	CDBG("%s\n", __func__);
-	gpio_set_value(ov7692_pwdn_gpio, 1);
-}
-
-static void ov7692_sw_reset(void)
-{
-	CDBG("%s\n", __func__);
-	ov7692_i2c_write_b_sensor(0x12, 0x80);
-}
-
-static void ov7692_hw_reset(void)
-{
-	CDBG("--CAMERA-- %s ... (Start...)\n", __func__);
-	gpio_set_value(ov7692_reset_gpio, 1);   /*reset camera reset pin*/
-	usleep_range(5000, 5100);
-	gpio_set_value(ov7692_reset_gpio, 0);
-	usleep_range(5000, 5100);
-	gpio_set_value(ov7692_reset_gpio, 1);
-	usleep_range(1000, 1100);
-	CDBG("--CAMERA-- %s ... (End...)\n", __func__);
-}
-
-
-
-static int ov7692_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	uint8_t model_id_msb, model_id_lsb = 0;
-	uint16_t model_id = 0;
-	int32_t rc = 0;
-	/*The reset pin is not physically connected to the sensor.
-	  The standby pin will do the reset hence there is no need
-	  to request the gpio reset*/
-
-	/* Read sensor Model ID: */
-	rc = ov7692_i2c_read(REG_OV7692_MODEL_ID_MSB, &model_id_msb, 1);
-	if (rc < 0)
-		goto init_probe_fail;
-	rc = ov7692_i2c_read(REG_OV7692_MODEL_ID_LSB, &model_id_lsb, 1);
-	if (rc < 0)
-		goto init_probe_fail;
-	model_id = (model_id_msb << 8) | ((model_id_lsb & 0x00FF)) ;
-	CDBG("ov7692 model_id = 0x%x, 0x%x, 0x%x\n",
-			model_id, model_id_msb, model_id_lsb);
-	/* 4. Compare sensor ID to OV7692 ID: */
-	if (model_id != OV7692_MODEL_ID) {
-		rc = -ENODEV;
-		goto init_probe_fail;
-	}
-	goto init_probe_done;
-init_probe_fail:
-	pr_warning(" ov7692_probe_init_sensor fails\n");
-init_probe_done:
-	CDBG(" ov7692_probe_init_sensor finishes\n");
-	return rc;
-}
-
-int ov7692_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-
-	CDBG("%s: %d\n", __func__, __LINE__);
-	CDBG("Calling ov7692_sensor_open_init\n");
-	ov7692_ctrl = kzalloc(sizeof(struct ov7692_ctrl_t), GFP_KERNEL);
-	if (!ov7692_ctrl) {
-		CDBG("ov7692_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	ov7692_ctrl->fps_divider = 1 * 0x00000400;
-	ov7692_ctrl->pict_fps_divider = 1 * 0x00000400;
-	ov7692_ctrl->fps = 30 * Q8;
-	ov7692_ctrl->set_test = TEST_OFF;
-	ov7692_ctrl->prev_res = QTR_SIZE;
-	ov7692_ctrl->pict_res = FULL_SIZE;
-	ov7692_ctrl->curr_res = INVALID_SIZE;
-
-	if (data)
-		ov7692_ctrl->sensordata = data;
-	/* turn on LDO for PVT */
-	if (data->pmic_gpio_enable)
-		lcd_camera_power_onoff(1);
-
-	/* enable mclk first */
-
-	msm_camio_clk_rate_set(24000000);
-	msleep(20);
-
-	ov7692_power_on();
-	usleep_range(5000, 5100);
-
-	rc = ov7692_probe_init_sensor(data);
-	if (rc < 0) {
-		CDBG("Calling ov7692_sensor_open_init fail\n");
-		goto init_fail;
-	}
-
-	rc = ov7692_sensor_setting(REG_INIT, RES_PREVIEW);
-	if (rc < 0)
-		goto init_fail;
-	else
-		goto init_done;
-
-init_fail:
-	CDBG(" ov7692_sensor_open_init fail\n");
-	if (data->pmic_gpio_enable)
-		lcd_camera_power_onoff(0);
-	kfree(ov7692_ctrl);
-init_done:
-	CDBG("ov7692_sensor_open_init done\n");
-	return rc;
-}
-
-static int ov7692_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&ov7692_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id ov7692_i2c_id[] = {
-	{"ov7692", 0},
-	{ }
-};
-
-static int ov7692_i2c_probe(struct i2c_client *client,
-		const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("ov7692_i2c_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	ov7692_sensorw = kzalloc(sizeof(struct ov7692_work_t), GFP_KERNEL);
-	if (!ov7692_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, ov7692_sensorw);
-	ov7692_init_client(client);
-	ov7692_client = client;
-
-	CDBG("ov7692_i2c_probe success! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("ov7692_i2c_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int __exit ov7692_remove(struct i2c_client *client)
-{
-	struct ov7692_work_t_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	ov7692_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static struct i2c_driver ov7692_i2c_driver = {
-	.id_table = ov7692_i2c_id,
-	.probe  = ov7692_i2c_probe,
-	.remove = __exit_p(ov7692_i2c_remove),
-	.driver = {
-		.name = "ov7692",
-	},
-};
-
-int ov7692_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-	if (copy_from_user(&cdata,
-				(void *)argp,
-				sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(&ov7692_mut);
-	CDBG("ov7692_sensor_config: cfgtype = %d\n", cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_SET_MODE:
-		rc = ov7692_set_sensor_mode(cdata.mode, cdata.rs);
-		break;
-	case CFG_SET_EFFECT:
-		CDBG("--CAMERA-- CFG_SET_EFFECT mode=%d, effect = %d !!\n",
-			 cdata.mode, cdata.cfg.effect);
-		rc = ov7692_set_effect(cdata.mode, cdata.cfg.effect);
-		break;
-	case CFG_START:
-		CDBG("--CAMERA-- CFG_START (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_PWR_UP:
-		CDBG("--CAMERA-- CFG_PWR_UP (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_PWR_DOWN:
-		CDBG("--CAMERA-- CFG_PWR_DOWN !!\n");
-		ov7692_power_down();
-		break;
-	case CFG_WRITE_EXPOSURE_GAIN:
-		CDBG("--CAMERA-- CFG_WRITE_EXPOSURE_GAIN (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SET_DEFAULT_FOCUS:
-		CDBG("--CAMERA-- CFG_SET_DEFAULT_FOCUS (Not Implement) !!\n");
-		break;
-	case CFG_MOVE_FOCUS:
-		CDBG("--CAMERA-- CFG_MOVE_FOCUS (Not Implement) !!\n");
-		break;
-	case CFG_REGISTER_TO_REAL_GAIN:
-		CDBG("--CAMERA-- CFG_REGISTER_TO_REAL_GAIN (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_REAL_TO_REGISTER_GAIN:
-		CDBG("--CAMERA-- CFG_REAL_TO_REGISTER_GAIN (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SET_FPS:
-		CDBG("--CAMERA-- CFG_SET_FPS (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SET_PICT_FPS:
-		CDBG("--CAMERA-- CFG_SET_PICT_FPS (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SET_BRIGHTNESS:
-		CDBG("--CAMERA-- CFG_SET_BRIGHTNESS  !!\n");
-		/* rc = ov7692_set_brightness(cdata.cfg.brightness); */
-		break;
-	case CFG_SET_CONTRAST:
-		CDBG("--CAMERA-- CFG_SET_CONTRAST  !!\n");
-		rc = ov7692_set_contrast(cdata.cfg.contrast);
-		break;
-	case CFG_SET_ZOOM:
-		CDBG("--CAMERA-- CFG_SET_ZOOM (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SET_EXPOSURE_MODE:
-		CDBG("--CAMERA-- CFG_SET_EXPOSURE_MODE !!\n");
-		/* rc = ov7692_set_exposure_mode(cdata.cfg.ae_mode); */
-		break;
-	case CFG_SET_WB:
-		CDBG("--CAMERA-- CFG_SET_WB!!\n");
-		ov7692_set_wb_oem(cdata.cfg.wb_val);
-		rc = 0 ;
-		break;
-	case CFG_SET_ANTIBANDING:
-		CDBG("--CAMERA-- CFG_SET_ANTIBANDING antibanding = %d !!\n",
-			 cdata.cfg.antibanding);
-		rc = ov7692_set_antibanding(cdata.cfg.antibanding);
-		break;
-	case CFG_SET_EXP_GAIN:
-		CDBG("--CAMERA-- CFG_SET_EXP_GAIN (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SET_PICT_EXP_GAIN:
-		CDBG("--CAMERA-- CFG_SET_PICT_EXP_GAIN (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SET_LENS_SHADING:
-		CDBG("--CAMERA-- CFG_SET_LENS_SHADING !!\n");
-		/* rc = ov7692_lens_shading_enable(cdata.cfg.lens_shading); */
-		break;
-	case CFG_GET_PICT_FPS:
-		CDBG("--CAMERA-- CFG_GET_PICT_FPS (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_GET_PREV_L_PF:
-		CDBG("--CAMERA-- CFG_GET_PREV_L_PF (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_GET_PREV_P_PL:
-		CDBG("--CAMERA-- CFG_GET_PREV_P_PL (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_GET_PICT_L_PF:
-		CDBG("--CAMERA-- CFG_GET_PICT_L_PF (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_GET_PICT_P_PL:
-		CDBG("--CAMERA-- CFG_GET_PICT_P_PL (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_GET_AF_MAX_STEPS:
-		CDBG("--CAMERA-- CFG_GET_AF_MAX_STEPS (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_GET_PICT_MAX_EXP_LC:
-		CDBG("--CAMERA-- CFG_GET_PICT_MAX_EXP_LC (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SEND_WB_INFO:
-		CDBG("--CAMERA-- CFG_SEND_WB_INFO (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SENSOR_INIT:
-		CDBG("--CAMERA-- CFG_SENSOR_INIT (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SET_SATURATION:
-		CDBG("--CAMERA-- CFG_SET_SATURATION !!\n");
-		rc = ov7692_set_saturation(cdata.cfg.saturation);
-		break;
-	case CFG_SET_SHARPNESS:
-		CDBG("--CAMERA-- CFG_SET_SHARPNESS !!\n");
-		rc = ov7692_set_sharpness(cdata.cfg.sharpness);
-		break;
-	case CFG_SET_TOUCHAEC:
-		CDBG("--CAMERA-- CFG_SET_TOUCHAEC!!\n");
-		/* ov7692_set_touchaec(cdata.cfg.aec_cord.x,
-			 cdata.cfg.aec_cord.y); */
-		rc = 0 ;
-		break;
-	case CFG_SET_AUTO_FOCUS:
-		CDBG("--CAMERA-- CFG_SET_AUTO_FOCUS (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SET_AUTOFLASH:
-		CDBG("--CAMERA-- CFG_SET_AUTOFLASH (Not Support) !!\n");
-		/* Not Support */
-		break;
-	case CFG_SET_EXPOSURE_COMPENSATION:
-		CDBG("--CAMERA-- CFG_SET_EXPOSURE_COMPENSATION !\n");
-		rc = ov7692_set_exposure_compensation(
-			cdata.cfg.exp_compensation);
-		break;
-	case CFG_SET_ISO:
-		CDBG("--CAMERA-- CFG_SET_ISO !\n");
-		rc = ov7692_set_iso(cdata.cfg.iso_type);
-		break;
-	default:
-		CDBG("--CAMERA-- %s: Command=%d (Not Implement) !!\n",
-			 __func__, cdata.cfgtype);
-		rc = -EINVAL;
-		break;
-	}
-
-	mutex_unlock(&ov7692_mut);
-
-	return rc;
-}
-static int ov7692_sensor_release(void)
-{
-	int rc = -EBADF;
-
-	mutex_lock(&ov7692_mut);
-	ov7692_sw_reset();
-	ov7692_power_down();
-	kfree(ov7692_ctrl);
-	ov7692_ctrl = NULL;
-	CDBG("ov7692_release completed\n");
-	mutex_unlock(&ov7692_mut);
-
-	return rc;
-}
-
-static int ov7692_probe_init_gpio(const struct msm_camera_sensor_info *data)
-{
-	int rc = 0;
-
-	ov7692_pwdn_gpio = data->sensor_pwd;
-	ov7692_reset_gpio = data->sensor_reset ;
-
-	if (data->sensor_reset_enable)
-		gpio_direction_output(data->sensor_reset, 1);
-
-	gpio_direction_output(data->sensor_pwd, 1);
-
-	return rc;
-
-}
-
-
-static int ov7692_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-	rc = i2c_add_driver(&ov7692_i2c_driver);
-	if (rc < 0 || ov7692_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_fail;
-	}
-	pr_debug("%s: %d Entered\n", __func__, __LINE__);
-	rc = ov7692_probe_init_gpio(info);
-	if (rc < 0) {
-		CDBG("%s: gpio init failed\n", __func__);
-		goto probe_fail;
-	}
-	/* turn on LDO for PVT */
-	if (info->pmic_gpio_enable)
-		lcd_camera_power_onoff(1);
-
-	ov7692_power_down();
-
-	msm_camio_clk_rate_set(24000000);
-	usleep_range(5000, 5100);
-
-	ov7692_power_on();
-	usleep_range(5000, 5100);
-
-	if (info->sensor_reset_enable)
-		ov7692_hw_reset();
-	else
-		ov7692_sw_reset();
-
-	rc = ov7692_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-
-
-	s->s_init = ov7692_sensor_open_init;
-	s->s_release = ov7692_sensor_release;
-	s->s_config  = ov7692_sensor_config;
-	s->s_camera_type = FRONT_CAMERA_2D;
-	s->s_mount_angle = info->sensor_platform_info->mount_angle;
-
-	/* ov7692_sw_reset(); */
-	ov7692_power_down();
-
-	if (info->pmic_gpio_enable)
-		lcd_camera_power_onoff(0);
-
-	return rc;
-
-probe_fail:
-	CDBG("ov7692_sensor_probe: SENSOR PROBE FAILS!\n");
-	if (info->pmic_gpio_enable)
-		lcd_camera_power_onoff(0);
-	i2c_del_driver(&ov7692_i2c_driver);
-	return rc;
-}
-
-static int __ov7692_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, ov7692_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __ov7692_probe,
-	.driver = {
-		.name = "msm_camera_ov7692",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init ov7692_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(ov7692_init);
-
-MODULE_DESCRIPTION("OMNI VGA YUV sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/ov9726.c b/drivers/media/video/msm/ov9726.c
deleted file mode 100644
index 96a084c..0000000
--- a/drivers/media/video/msm/ov9726.c
+++ /dev/null
@@ -1,794 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/slab.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include "ov9726.h"
-
-/*=============================================================
-	SENSOR REGISTER DEFINES
-==============================================================*/
-#define OV9726_Q8				0x00000100
-#define OV9726_Q8Shift				8
-#define OV9726_Q10				0x00000400
-#define OV9726_Q10Shift				10
-
-/* Omnivision8810 product ID register address */
-#define	OV9726_PIDH_REG				0x0000
-#define	OV9726_PIDL_REG				0x0001
-/* Omnivision8810 product ID */
-#define	OV9726_PID				0x97
-/* Omnivision8810 version */
-#define	OV9726_VER				0x26
-/* Time in milisecs for waiting for the sensor to reset */
-#define	OV9726_RESET_DELAY_MSECS		66
-#define	OV9726_DEFAULT_CLOCK_RATE		24000000
-/* Registers*/
-#define	OV9726_GAIN				0x3000
-#define	OV9726_AEC_MSB				0x3002
-#define	OV9726_AEC_LSB				0x3003
-
-/* Color bar pattern selection */
-#define OV9726_COLOR_BAR_PATTERN_SEL_REG	0x600
-/* Color bar enabling control */
-#define OV9726_COLOR_BAR_ENABLE_REG		0x601
-/* Time in milisecs for waiting for the sensor to reset*/
-#define OV9726_RESET_DELAY_MSECS		66
-/* I2C Address of the Sensor */
-/*============================================================================
-		DATA DECLARATIONS
-============================================================================*/
-#define OV9726_FULL_SIZE_DUMMY_PIXELS		0
-#define OV9726_FULL_SIZE_DUMMY_LINES		0
-#define OV9726_QTR_SIZE_DUMMY_PIXELS		0
-#define OV9726_QTR_SIZE_DUMMY_LINES		0
-
-#define OV9726_FULL_SIZE_WIDTH			1296
-#define OV9726_FULL_SIZE_HEIGHT			808
-
-#define OV9726_QTR_SIZE_WIDTH			1296
-#define OV9726_QTR_SIZE_HEIGHT			808
-
-#define OV9726_HRZ_FULL_BLK_PIXELS		368
-#define OV9726_VER_FULL_BLK_LINES		32
-#define OV9726_HRZ_QTR_BLK_PIXELS		368
-#define OV9726_VER_QTR_BLK_LINES		32
-
-#define OV9726_MSB_MASK			0xFF00
-#define OV9726_LSB_MASK			0x00FF
-
-struct ov9726_work_t {
-	struct work_struct work;
-};
-static struct ov9726_work_t *ov9726_sensorw;
-static struct i2c_client *ov9726_client;
-struct ov9726_ctrl_t {
-	const struct  msm_camera_sensor_info *sensordata;
-	uint32_t sensormode;
-	uint32_t fps_divider;		/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;	/* init to 1 * 0x00000400 */
-	uint16_t fps;
-	int16_t curr_lens_pos;
-	uint16_t curr_step_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint16_t total_lines_per_frame;
-	enum ov9726_resolution_t prev_res;
-	enum ov9726_resolution_t pict_res;
-	enum ov9726_resolution_t curr_res;
-	enum ov9726_test_mode_t  set_test;
-	unsigned short imgaddr;
-};
-static struct ov9726_ctrl_t *ov9726_ctrl;
-static int8_t config_not_set = 1;
-static DECLARE_WAIT_QUEUE_HEAD(ov9726_wait_queue);
-DEFINE_MUTEX(ov9726_mut);
-
-/*=============================================================*/
-static int ov9726_i2c_rxdata(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-	{
-		.addr  = saddr,
-		.flags = 0,
-		.len   = 2,
-		.buf   = rxdata,
-	},
-	{
-		.addr  = saddr,
-		.flags = I2C_M_RD,
-		.len   = length,
-		.buf   = rxdata,
-	},
-	};
-
-	if (i2c_transfer(ov9726_client->adapter, msgs, 2) < 0) {
-		CDBG("ov9726_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t ov9726_i2c_txdata(unsigned short saddr,
-				unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-		 .addr = saddr ,
-		 .flags = 0,
-		 .len = length,
-		 .buf = txdata,
-		 },
-	};
-
-	if (i2c_transfer(ov9726_client->adapter, msg, 1) < 0) {
-		CDBG("ov9726_i2c_txdata faild 0x%x\n", ov9726_client->addr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t ov9726_i2c_read(unsigned short raddr,
-				unsigned short *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-
-	if (!rdata)
-		return -EIO;
-
-	buf[0] = (raddr & OV9726_MSB_MASK) >> 8;
-	buf[1] = (raddr & OV9726_LSB_MASK);
-
-	rc = ov9726_i2c_rxdata(ov9726_client->addr, buf, rlen);
-
-	if (rc < 0) {
-		CDBG("ov9726_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-	return rc;
-}
-
-static int32_t ov9726_i2c_write_b(unsigned short saddr,
-	unsigned short waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[3];
-
-	buf[0] = (waddr & OV9726_MSB_MASK) >> 8;
-	buf[1] = (waddr & OV9726_LSB_MASK);
-	buf[2] = bdata;
-
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%xd\n", waddr, bdata);
-	rc = ov9726_i2c_txdata(saddr, buf, 3);
-
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			 waddr, bdata);
-	}
-
-	return rc;
-}
-
-static void ov9726_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	uint32_t divider;	/*Q10 */
-	uint32_t d1;
-	uint32_t d2;
-	uint16_t snapshot_height, preview_height, preview_width, snapshot_width;
-	if (ov9726_ctrl->prev_res == QTR_SIZE) {
-		preview_width = OV9726_QTR_SIZE_WIDTH +
-			OV9726_HRZ_QTR_BLK_PIXELS ;
-		preview_height = OV9726_QTR_SIZE_HEIGHT +
-			OV9726_VER_QTR_BLK_LINES ;
-	} else {
-		/* full size resolution used for preview. */
-		preview_width = OV9726_FULL_SIZE_WIDTH +
-			OV9726_HRZ_FULL_BLK_PIXELS ;
-		preview_height = OV9726_FULL_SIZE_HEIGHT +
-			OV9726_VER_FULL_BLK_LINES ;
-	}
-	if (ov9726_ctrl->pict_res == QTR_SIZE) {
-		snapshot_width  = OV9726_QTR_SIZE_WIDTH +
-			OV9726_HRZ_QTR_BLK_PIXELS ;
-		snapshot_height = OV9726_QTR_SIZE_HEIGHT +
-			OV9726_VER_QTR_BLK_LINES ;
-	} else {
-		snapshot_width  = OV9726_FULL_SIZE_WIDTH +
-			OV9726_HRZ_FULL_BLK_PIXELS;
-		snapshot_height = OV9726_FULL_SIZE_HEIGHT +
-			OV9726_VER_FULL_BLK_LINES;
-	}
-
-	d1 = (uint32_t)(((uint32_t)preview_height <<
-		OV9726_Q10Shift) /
-		snapshot_height);
-
-	d2 = (uint32_t)(((uint32_t)preview_width <<
-		OV9726_Q10Shift) /
-		 snapshot_width);
-
-	divider = (uint32_t) (d1 * d2) >> OV9726_Q10Shift;
-	*pfps = (uint16_t)((uint32_t)(fps * divider) >> OV9726_Q10Shift);
-}
-
-static uint16_t ov9726_get_prev_lines_pf(void)
-{
-	if (ov9726_ctrl->prev_res == QTR_SIZE)
-		return OV9726_QTR_SIZE_HEIGHT + OV9726_VER_QTR_BLK_LINES;
-	else
-		return OV9726_FULL_SIZE_HEIGHT + OV9726_VER_FULL_BLK_LINES;
-}
-
-static uint16_t ov9726_get_prev_pixels_pl(void)
-{
-	if (ov9726_ctrl->prev_res == QTR_SIZE)
-		return OV9726_QTR_SIZE_WIDTH + OV9726_HRZ_QTR_BLK_PIXELS;
-	else
-		return OV9726_FULL_SIZE_WIDTH + OV9726_HRZ_FULL_BLK_PIXELS;
-}
-
-static uint16_t ov9726_get_pict_lines_pf(void)
-{
-	if (ov9726_ctrl->pict_res == QTR_SIZE)
-		return OV9726_QTR_SIZE_HEIGHT + OV9726_VER_QTR_BLK_LINES;
-	else
-		return OV9726_FULL_SIZE_HEIGHT + OV9726_VER_FULL_BLK_LINES;
-}
-
-static uint16_t ov9726_get_pict_pixels_pl(void)
-{
-	if (ov9726_ctrl->pict_res == QTR_SIZE)
-		return OV9726_QTR_SIZE_WIDTH + OV9726_HRZ_QTR_BLK_PIXELS;
-	else
-		return OV9726_FULL_SIZE_WIDTH + OV9726_HRZ_FULL_BLK_PIXELS;
-}
-
-static uint32_t ov9726_get_pict_max_exp_lc(void)
-{
-	if (ov9726_ctrl->pict_res == QTR_SIZE)
-		return (OV9726_QTR_SIZE_HEIGHT + OV9726_VER_QTR_BLK_LINES)*24;
-	else
-		return (OV9726_FULL_SIZE_HEIGHT + OV9726_VER_FULL_BLK_LINES)*24;
-}
-
-static int32_t ov9726_set_fps(struct fps_cfg	*fps)
-{
-	int32_t rc = 0;
-	CDBG("%s: fps->fps_div = %d\n", __func__, fps->fps_div);
-	/* TODO: Passing of fps_divider from user space has issues. */
-	/* ov9726_ctrl->fps_divider = fps->fps_div; */
-	ov9726_ctrl->fps_divider = 1 * 0x400;
-	CDBG("%s: ov9726_ctrl->fps_divider = %d\n", __func__,
-		ov9726_ctrl->fps_divider);
-	ov9726_ctrl->pict_fps_divider = fps->pict_fps_div;
-	ov9726_ctrl->fps = fps->f_mult;
-	return rc;
-}
-
-static int32_t ov9726_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	static uint16_t max_legal_gain = 0x00FF;
-	uint8_t gain_msb, gain_lsb;
-	uint8_t intg_time_msb, intg_time_lsb;
-	uint8_t ov9726_offset = 6;
-	uint8_t line_length_pck_msb, line_length_pck_lsb;
-	uint16_t line_length_pck, frame_length_lines;
-	uint32_t line_length_ratio = 1 << OV9726_Q8Shift;
-	int32_t rc = -1;
-	CDBG("%s: gain = %d	line = %d", __func__, gain, line);
-
-	if (ov9726_ctrl->sensormode != SENSOR_SNAPSHOT_MODE) {
-		if (ov9726_ctrl->curr_res == QTR_SIZE) {
-			frame_length_lines = OV9726_QTR_SIZE_HEIGHT +
-			 OV9726_VER_QTR_BLK_LINES;
-			line_length_pck = OV9726_QTR_SIZE_WIDTH	+
-			 OV9726_HRZ_QTR_BLK_PIXELS;
-		} else {
-			frame_length_lines = OV9726_FULL_SIZE_HEIGHT +
-				OV9726_VER_FULL_BLK_LINES;
-			line_length_pck = OV9726_FULL_SIZE_WIDTH +
-				OV9726_HRZ_FULL_BLK_PIXELS;
-		}
-		if (line > (frame_length_lines - ov9726_offset))
-			ov9726_ctrl->fps = (uint16_t) (((uint32_t)30 <<
-				OV9726_Q8Shift) *
-				(frame_length_lines - ov9726_offset) / line);
-		else
-			ov9726_ctrl->fps = (uint16_t) ((uint32_t)30 <<
-				OV9726_Q8Shift);
-	} else {
-		frame_length_lines = OV9726_FULL_SIZE_HEIGHT +
-			OV9726_VER_FULL_BLK_LINES;
-		line_length_pck = OV9726_FULL_SIZE_WIDTH +
-			OV9726_HRZ_FULL_BLK_PIXELS;
-	}
-
-	if (ov9726_ctrl->sensormode != SENSOR_SNAPSHOT_MODE) {
-		line = (uint32_t) (line * ov9726_ctrl->fps_divider) >>
-			OV9726_Q10Shift;
-	} else {
-		line = (uint32_t) (line * ov9726_ctrl->pict_fps_divider) >>
-			OV9726_Q10Shift;
-	}
-
-	/* calculate line_length_ratio */
-	if (line > (frame_length_lines - ov9726_offset)) {
-		line_length_ratio = (line << OV9726_Q8Shift) /
-			(frame_length_lines - ov9726_offset);
-		line = frame_length_lines - ov9726_offset;
-	} else
-		line_length_ratio = (uint32_t)1 << OV9726_Q8Shift;
-
-	if (gain > max_legal_gain) {
-		/* range:	0	to 224 */
-		gain = max_legal_gain;
-	}
-	/* update	gain registers */
-	gain_msb = (uint8_t) ((gain & 0xFF00) >> 8);
-	gain_lsb = (uint8_t) (gain & 0x00FF);
-	/* linear	AFR	horizontal stretch */
-	line_length_pck = (uint16_t) ((line_length_pck *
-		line_length_ratio) >> OV9726_Q8Shift);
-	line_length_pck_msb = (uint8_t) ((line_length_pck & 0xFF00) >> 8);
-	line_length_pck_lsb = (uint8_t) (line_length_pck & 0x00FF);
-	/* update	line count registers */
-	intg_time_msb = (uint8_t) ((line & 0xFF00) >> 8);
-	intg_time_lsb = (uint8_t) (line	& 0x00FF);
-
-	rc = ov9726_i2c_write_b(ov9726_client->addr, 0x104, 0x1);
-	if (rc < 0)
-		return rc;
-
-	rc = ov9726_i2c_write_b(ov9726_client->addr, 0x204, gain_msb);
-	if (rc < 0)
-		return rc;
-
-	rc = ov9726_i2c_write_b(ov9726_client->addr, 0x205, gain_lsb);
-	if (rc < 0)
-		return rc;
-
-	rc = ov9726_i2c_write_b(ov9726_client->addr, 0x342,
-		line_length_pck_msb);
-	if (rc < 0)
-		return rc;
-
-	rc = ov9726_i2c_write_b(ov9726_client->addr, 0x343,
-		line_length_pck_lsb);
-	if (rc < 0)
-		return rc;
-
-	rc = ov9726_i2c_write_b(ov9726_client->addr, 0x0202, intg_time_msb);
-	if (rc < 0)
-		return rc;
-
-	rc = ov9726_i2c_write_b(ov9726_client->addr, 0x0203, intg_time_lsb);
-	if (rc < 0)
-		return rc;
-
-	rc = ov9726_i2c_write_b(ov9726_client->addr, 0x104, 0x0);
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-
-static int32_t ov9726_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-	rc = ov9726_write_exp_gain(gain, line);
-	return rc;
-}
-
-static int32_t initialize_ov9726_registers(void)
-{
-	int32_t i;
-	int32_t rc = 0;
-	ov9726_ctrl->sensormode = SENSOR_PREVIEW_MODE ;
-	/* Configure sensor for Preview mode and Snapshot mode */
-	CDBG("Initialize_ov9726_registers\n");
-	for (i = 0; i < ov9726_array_length; i++) {
-		rc = ov9726_i2c_write_b(ov9726_client->addr,
-			ov9726_init_settings_array[i].reg_addr,
-			ov9726_init_settings_array[i].reg_val);
-	if (rc < 0)
-		return rc;
-	}
-	return rc;
-}
-
-static int32_t ov9726_video_config(int mode)
-{
-	int32_t rc = 0;
-
-	ov9726_ctrl->sensormode = mode;
-
-	if (config_not_set) {
-		struct msm_camera_csi_params ov9726_csi_params;
-
-		/* sensor in standby */
-		ov9726_i2c_write_b(ov9726_client->addr, 0x100, 0);
-		msleep(5);
-		/* Initialize Sensor registers */
-		ov9726_csi_params.data_format = CSI_10BIT;
-		ov9726_csi_params.lane_cnt = 1;
-		ov9726_csi_params.lane_assign = 0xe4;
-		ov9726_csi_params.dpcm_scheme = 0;
-		ov9726_csi_params.settle_cnt = 7;
-
-		rc = msm_camio_csi_config(&ov9726_csi_params);
-		rc = initialize_ov9726_registers();
-		config_not_set = 0;
-	}
-	return rc;
-}
-
-static int32_t ov9726_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	ov9726_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t ov9726_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	ov9726_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t ov9726_set_sensor_mode(int  mode,
-			int  res)
-{
-	int32_t rc = 0;
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = ov9726_video_config(mode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-		rc = ov9726_snapshot_config(mode);
-		break;
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = ov9726_raw_snapshot_config(mode);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-static int ov9726_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	uint16_t  chipidl, chipidh;
-
-	if (data->sensor_reset_enable) {
-		rc = gpio_request(data->sensor_reset, "ov9726");
-		if (!rc) {
-			gpio_direction_output(data->sensor_reset, 0);
-			gpio_set_value_cansleep(data->sensor_reset, 1);
-			msleep(20);
-		} else
-			goto init_probe_done;
-	}
-	/* 3. Read sensor Model ID: */
-	rc = ov9726_i2c_read(OV9726_PIDH_REG, &chipidh, 1);
-	if (rc < 0)
-		goto init_probe_fail;
-	rc = ov9726_i2c_read(OV9726_PIDL_REG, &chipidl, 1);
-	if (rc < 0)
-		goto init_probe_fail;
-	CDBG("kov9726 model_id = 0x%x  0x%x\n", chipidh, chipidl);
-	/* 4. Compare sensor ID to OV9726 ID: */
-	if (chipidh != OV9726_PID) {
-		rc = -ENODEV;
-		printk(KERN_INFO "Probeinit fail\n");
-		goto init_probe_fail;
-	}
-	CDBG("chipidh == OV9726_PID\n");
-	msleep(OV9726_RESET_DELAY_MSECS);
-	CDBG("after delay\n");
-	goto init_probe_done;
-
-init_probe_fail:
-	if (data->sensor_reset_enable) {
-		gpio_direction_output(data->sensor_reset, 0);
-		gpio_free(data->sensor_reset);
-	}
-init_probe_done:
-	printk(KERN_INFO " ov9726_probe_init_sensor finishes\n");
-	return rc;
-}
-
-int ov9726_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t  rc;
-
-	CDBG("Calling ov9726_sensor_open_init\n");
-	ov9726_ctrl = kzalloc(sizeof(struct ov9726_ctrl_t), GFP_KERNEL);
-	if (!ov9726_ctrl) {
-		CDBG("ov9726_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	ov9726_ctrl->curr_lens_pos = -1;
-	ov9726_ctrl->fps_divider = 1 << OV9726_Q10Shift;
-	ov9726_ctrl->pict_fps_divider = 1 << OV9726_Q10Shift;
-	ov9726_ctrl->set_test = TEST_OFF;
-	ov9726_ctrl->prev_res = FULL_SIZE;
-	ov9726_ctrl->pict_res = FULL_SIZE;
-	ov9726_ctrl->curr_res = INVALID_SIZE;
-	config_not_set = 1;
-	if (data)
-		ov9726_ctrl->sensordata = data;
-	/* enable mclk first */
-	msm_camio_clk_rate_set(OV9726_DEFAULT_CLOCK_RATE);
-	msleep(20);
-	rc = ov9726_probe_init_sensor(data);
-	if (rc < 0)
-		goto init_fail;
-
-	ov9726_ctrl->fps = (uint16_t)(30 << OV9726_Q8Shift);
-	/* generate test pattern */
-	if (rc < 0)
-		goto init_fail;
-	else
-		goto init_done;
-	/* reset the driver state */
-init_fail:
-	CDBG(" init_fail\n");
-	kfree(ov9726_ctrl);
-init_done:
-	CDBG("init_done\n");
-	return rc;
-}
-
-static int ov9726_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&ov9726_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id ov9726_i2c_id[] = {
-	{ "ov9726", 0},
-	{ }
-};
-
-static int ov9726_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("ov9726_probe called!\n");
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-	ov9726_sensorw = kzalloc(sizeof(struct ov9726_work_t), GFP_KERNEL);
-	if (!ov9726_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-	i2c_set_clientdata(client, ov9726_sensorw);
-	ov9726_init_client(client);
-	ov9726_client = client;
-	msleep(50);
-	CDBG("ov9726_probe successed! rc = %d\n", rc);
-	return 0;
-probe_failure:
-	CDBG("ov9726_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int __exit ov9726_remove(struct i2c_client *client)
-{
-	struct ov9726_work_t_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	ov9726_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static struct i2c_driver ov9726_i2c_driver = {
-	.id_table = ov9726_i2c_id,
-	.probe	= ov9726_i2c_probe,
-	.remove = __exit_p(ov9726_i2c_remove),
-	.driver = {
-		.name = "ov9726",
-	},
-};
-
-int ov9726_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-
-	if (copy_from_user(&cdata,
-				(void *)argp,
-				sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(&ov9726_mut);
-	CDBG("ov9726_sensor_config: cfgtype = %d\n",
-		cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		ov9726_get_pict_fps(cdata.cfg.gfps.prevfps,
-				&(cdata.cfg.gfps.pictfps));
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-			break;
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf = ov9726_get_prev_lines_pf();
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl = ov9726_get_prev_pixels_pl();
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf = ov9726_get_pict_lines_pf();
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl =
-				ov9726_get_pict_pixels_pl();
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc = ov9726_get_pict_max_exp_lc();
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = ov9726_set_fps(&(cdata.cfg.fps));
-		break;
-	case CFG_SET_EXP_GAIN:
-		rc = ov9726_write_exp_gain(
-					cdata.cfg.exp_gain.gain,
-					cdata.cfg.exp_gain.line);
-		break;
-	case CFG_SET_PICT_EXP_GAIN:
-		rc = ov9726_set_pict_exp_gain(
-					cdata.cfg.exp_gain.gain,
-					cdata.cfg.exp_gain.line);
-		break;
-	case CFG_SET_MODE:
-		rc = ov9726_set_sensor_mode(cdata.mode,
-						cdata.rs);
-		break;
-	case CFG_PWR_DOWN:
-	case CFG_MOVE_FOCUS:
-	case CFG_SET_DEFAULT_FOCUS:
-		rc = 0;
-		break;
-	case CFG_SET_EFFECT:
-	default:
-		rc = -EFAULT;
-		break;
-	}
-	mutex_unlock(&ov9726_mut);
-	return rc;
-}
-
-static int ov9726_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	if (data->sensor_reset_enable) {
-		gpio_direction_output(data->sensor_reset, 0);
-		gpio_free(data->sensor_reset);
-	}
-	return 0;
-}
-
-static int ov9726_sensor_release(void)
-{
-	int rc = -EBADF;
-	mutex_lock(&ov9726_mut);
-	if (ov9726_ctrl->sensordata->sensor_reset_enable) {
-		gpio_direction_output(
-			ov9726_ctrl->sensordata->sensor_reset, 0);
-		gpio_free(ov9726_ctrl->sensordata->sensor_reset);
-	}
-	kfree(ov9726_ctrl);
-	ov9726_ctrl = NULL;
-	CDBG("ov9726_release completed\n");
-	mutex_unlock(&ov9726_mut);
-	return rc;
-}
-
-static int ov9726_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-
-	rc = i2c_add_driver(&ov9726_i2c_driver);
-	if (rc < 0 || ov9726_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_fail;
-	}
-	msm_camio_clk_rate_set(24000000);
-	msleep(20);
-	rc = ov9726_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-
-	s->s_init = ov9726_sensor_open_init;
-	s->s_release = ov9726_sensor_release;
-	s->s_config  = ov9726_sensor_config;
-	s->s_camera_type = FRONT_CAMERA_2D;
-	s->s_mount_angle = info->sensor_platform_info->mount_angle;
-	ov9726_probe_init_done(info);
-
-	return rc;
-
-probe_fail:
-	CDBG("SENSOR PROBE FAILS!\n");
-	return rc;
-}
-
-static int __ov9726_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, ov9726_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __ov9726_probe,
-	.driver = {
-		.name = "msm_camera_ov9726",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init ov9726_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(ov9726_init);
-void ov9726_exit(void)
-{
-	i2c_del_driver(&ov9726_i2c_driver);
-}
-
-MODULE_DESCRIPTION("OMNI VGA Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
-
diff --git a/drivers/media/video/msm/ov9726.h b/drivers/media/video/msm/ov9726.h
deleted file mode 100644
index 40ba1a8..0000000
--- a/drivers/media/video/msm/ov9726.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef OV9726_H
-#define OV9726_H
-#include <linux/types.h>
-#include <mach/board.h>
-
-/* 16bit address - 8 bit context register structure */
-struct reg_struct_type {
-	uint16_t	reg_addr;
-	unsigned char	reg_val;
-};
-
-enum ov9726_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum ov9726_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-extern struct reg_struct_type ov9726_init_settings_array[];
-extern int32_t ov9726_array_length;
-#endif
-
diff --git a/drivers/media/video/msm/ov9726_reg.c b/drivers/media/video/msm/ov9726_reg.c
deleted file mode 100644
index 216ecca..0000000
--- a/drivers/media/video/msm/ov9726_reg.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "ov9726.h"
-struct reg_struct_type ov9726_init_settings_array[] = {
-	{0x0103, 0x01}, /* SOFTWARE_RESET */
-	{0x3026, 0x00}, /* OUTPUT_SELECT01 */
-	{0x3027, 0x00}, /* OUTPUT_SELECT02 */
-	{0x3002, 0xe8}, /* IO_CTRL00 */
-	{0x3004, 0x03}, /* IO_CTRL01 */
-	{0x3005, 0xff}, /* IO_CTRL02 */
-	{0x3703, 0x42},
-	{0x3704, 0x10},
-	{0x3705, 0x45},
-	{0x3603, 0xaa},
-	{0x3632, 0x2f},
-	{0x3620, 0x66},
-	{0x3621, 0xc0},
-	{0x0340, 0x03}, /* FRAME_LENGTH_LINES_HI */
-	{0x0341, 0xC1}, /* FRAME_LENGTH_LINES_LO */
-	{0x0342, 0x06}, /* LINE_LENGTH_PCK_HI */
-	{0x0343, 0x80}, /* LINE_LENGTH_PCK_LO */
-	{0x0202, 0x03}, /* COARSE_INTEGRATION_TIME_HI */
-	{0x0203, 0x43}, /* COARSE_INTEGRATION_TIME_LO */
-	{0x3833, 0x04},
-	{0x3835, 0x02},
-	{0x4702, 0x04},
-	{0x4704, 0x00}, /* DVP_CTRL01 */
-	{0x4706, 0x08},
-	{0x5052, 0x01},
-	{0x3819, 0x6e},
-	{0x3817, 0x94},
-	{0x3a18, 0x00}, /* AEC_GAIN_CEILING_HI */
-	{0x3a19, 0x7f}, /* AEC_GAIN_CEILING_LO */
-	{0x404e, 0x7e},
-	{0x3631, 0x52},
-	{0x3633, 0x50},
-	{0x3630, 0xd2},
-	{0x3604, 0x08},
-	{0x3601, 0x40},
-	{0x3602, 0x14},
-	{0x3610, 0xa0},
-	{0x3612, 0x20},
-	{0x034c, 0x05}, /* X_OUTPUT_SIZE_HI */
-	{0x034d, 0x10}, /* X_OUTPUT_SIZE_LO */
-	{0x034e, 0x03}, /* Y_OUTPUT_SIZE_HI */
-	{0x034f, 0x28}, /* Y_OUTPUT_SIZE_LO */
-	{0x0340, 0x03}, /* FRAME_LENGTH_LINES_HI */
-	{0x0341, 0xC1}, /* FRAME_LENGTH_LINES_LO */
-	{0x0342, 0x06}, /* LINE_LENGTH_PCK_HI */
-	{0x0343, 0x80}, /* LINE_LENGTH_PCK_LO */
-	{0x0202, 0x03}, /* COARSE_INTEGRATION_TIME_HI */
-	{0x0203, 0x43}, /* COARSE_INTEGRATION_TIME_LO */
-	{0x0303, 0x01}, /* VT_SYS_CLK_DIV_LO */
-	{0x3002, 0x00}, /* IO_CTRL00 */
-	{0x3004, 0x00}, /* IO_CTRL01 */
-	{0x3005, 0x00}, /* IO_CTRL02 */
-	{0x4801, 0x0f}, /* MIPI_CTRL01 */
-	{0x4803, 0x05}, /* MIPI_CTRL03 */
-	{0x4601, 0x16}, /* VFIFO_READ_CONTROL */
-	{0x3014, 0x05}, /* SC_CMMN_MIPI / SC_CTRL00 */
-	{0x3104, 0x80},
-	{0x0305, 0x04}, /* PRE_PLL_CLK_DIV_LO */
-	{0x0307, 0x64}, /* PLL_MULTIPLIER_LO */
-	{0x300c, 0x02},
-	{0x300d, 0x20},
-	{0x300e, 0x01},
-	{0x3010, 0x01},
-	{0x460e, 0x81}, /* VFIFO_CONTROL00 */
-	{0x0101, 0x01}, /* IMAGE_ORIENTATION */
-	{0x3707, 0x14},
-	{0x3622, 0x9f},
-	{0x5047, 0x3D}, /* ISP_CTRL47 */
-	{0x4002, 0x45}, /* BLC_CTRL02 */
-	{0x5000, 0x06}, /* ISP_CTRL0 */
-	{0x5001, 0x00}, /* ISP_CTRL1 */
-	{0x3406, 0x00}, /* AWB_MANUAL_CTRL */
-	{0x3503, 0x13}, /* AEC_ENABLE */
-	{0x4005, 0x18}, /* BLC_CTRL05 */
-	{0x4837, 0x21},
-	{0x0100, 0x01}, /* MODE_SELECT */
-	{0x3a0f, 0x64}, /* AEC_CTRL0F */
-	{0x3a10, 0x54}, /* AEC_CTRL10 */
-	{0x3a11, 0xc2}, /* AEC_CTRL11 */
-	{0x3a1b, 0x64}, /* AEC_CTRL1B */
-	{0x3a1e, 0x54}, /* AEC_CTRL1E */
-	{0x3a1a, 0x05}, /* AEC_DIFF_MAX */
-};
-int32_t ov9726_array_length = sizeof(ov9726_init_settings_array) /
-	sizeof(ov9726_init_settings_array[0]);
-
diff --git a/drivers/media/video/msm/qs_s5k4e1.c b/drivers/media/video/msm/qs_s5k4e1.c
deleted file mode 100644
index 32d094d..0000000
--- a/drivers/media/video/msm/qs_s5k4e1.c
+++ /dev/null
@@ -1,1822 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/debugfs.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/slab.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include "qs_s5k4e1.h"
-/*=============================================================
-	SENSOR REGISTER DEFINES
-==============================================================*/
-#define REG_GROUPED_PARAMETER_HOLD		0x0104
-#define GROUPED_PARAMETER_HOLD_OFF		0x00
-#define GROUPED_PARAMETER_HOLD			0x01
-/* Integration Time */
-#define REG_COARSE_INTEGRATION_TIME		0x0202
-/* Gain */
-#define REG_GLOBAL_GAIN					0x0204
-#define REG_GR_GAIN					0x020E
-#define REG_R_GAIN					0x0210
-#define REG_B_GAIN					0x0212
-#define REG_GB_GAIN					0x0214
-/* PLL registers */
-#define REG_FRAME_LENGTH_LINES			0x0340
-#define REG_LINE_LENGTH_PCK				0x0342
-/* Test Pattern */
-#define REG_TEST_PATTERN_MODE			0x0601
-#define REG_VCM_NEW_CODE				0x30F2
-#define AF_ADDR							0x18
-#define BRIDGE_ADDR						0x80
-/*============================================================================
-			 TYPE DECLARATIONS
-============================================================================*/
-
-/* 16bit address - 8 bit context register structure */
-#define Q8  0x00000100
-#define Q10 0x00000400
-#define QS_S5K4E1_MASTER_CLK_RATE 24000000
-#define QS_S5K4E1_OFFSET			8
-
-/* AF Total steps parameters */
-#define QS_S5K4E1_TOTAL_STEPS_NEAR_TO_FAR    32
-#define QS_S5K4E1_TOTAL_STEPS_3D    32
-
-uint16_t qs_s5k4e1_step_position_table[QS_S5K4E1_TOTAL_STEPS_NEAR_TO_FAR+1];
-uint16_t qs_s5k4e1_step_position_table_left[QS_S5K4E1_TOTAL_STEPS_3D+1];
-uint16_t qs_s5k4e1_step_position_table_right[QS_S5K4E1_TOTAL_STEPS_3D+1];
-uint16_t qs_s5k4e1_nl_region_boundary1;
-uint16_t qs_s5k4e1_nl_region_code_per_step1 = 190;
-uint16_t qs_s5k4e1_l_region_code_per_step = 8;
-uint16_t qs_s5k4e1_damping_threshold = 10;
-uint16_t qs_s5k4e1_sw_damping_time_wait = 8;
-uint16_t qs_s5k4e1_af_mode = 4;
-int16_t qs_s5k4e1_af_initial_code = 190;
-int16_t qs_s5k4e1_af_right_adjust;
-
-struct qs_s5k4e1_work_t {
-	struct work_struct work;
-};
-
-static struct qs_s5k4e1_work_t *qs_s5k4e1_sensorw;
-static struct i2c_client *qs_s5k4e1_client;
-static char lens_eeprom_data[864];
-static bool cali_data_status;
-struct qs_s5k4e1_ctrl_t {
-	const struct  msm_camera_sensor_info *sensordata;
-
-	uint32_t sensormode;
-	uint32_t fps_divider;/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;/* init to 1 * 0x00000400 */
-	uint16_t fps;
-
-	uint16_t curr_lens_pos;
-	uint16_t curr_step_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint16_t total_lines_per_frame;
-
-	enum qs_s5k4e1_resolution_t prev_res;
-	enum qs_s5k4e1_resolution_t pict_res;
-	enum qs_s5k4e1_resolution_t curr_res;
-	enum qs_s5k4e1_test_mode_t  set_test;
-	enum qs_s5k4e1_cam_mode_t cam_mode;
-};
-
-static uint16_t prev_line_length_pck;
-static uint16_t prev_frame_length_lines;
-static uint16_t snap_line_length_pck;
-static uint16_t snap_frame_length_lines;
-
-static bool CSI_CONFIG, LENS_SHADE_CONFIG, default_lens_shade;
-static struct qs_s5k4e1_ctrl_t *qs_s5k4e1_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(qs_s5k4e1_wait_queue);
-DEFINE_MUTEX(qs_s5k4e1_mut);
-
-static int cam_debug_init(void);
-static struct dentry *debugfs_base;
-/*=============================================================*/
-
-static int qs_s5k4e1_i2c_rxdata(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = length,
-			.buf   = rxdata,
-		},
-	};
-	if (i2c_transfer(qs_s5k4e1_client->adapter, msgs, 2) < 0) {
-		CDBG("qs_s5k4e1_i2c_rxdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-	return 0;
-}
-
-static int32_t qs_s5k4e1_i2c_txdata(unsigned short saddr,
-				unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		 },
-	};
-	if (i2c_transfer(qs_s5k4e1_client->adapter, msg, 1) < 0) {
-		CDBG("qs_s5k4e1_i2c_txdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t qs_s5k4e1_i2c_read(unsigned short raddr,
-	unsigned short *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-	if (!rdata)
-		return -EIO;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-	rc = qs_s5k4e1_i2c_rxdata(qs_s5k4e1_client->addr>>1, buf, rlen);
-	if (rc < 0) {
-		CDBG("qs_s5k4e1_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-	CDBG("qs_s5k4e1_i2c_read 0x%x val = 0x%x!\n", raddr, *rdata);
-	return rc;
-}
-
-static int32_t qs_s5k4e1_i2c_write_w_sensor(unsigned short waddr,
-	 uint16_t wdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[4];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = (wdata & 0xFF00) >> 8;
-	buf[3] = (wdata & 0x00FF);
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, wdata);
-	rc = qs_s5k4e1_i2c_txdata(qs_s5k4e1_client->addr>>1, buf, 4);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, wdata);
-	}
-	return rc;
-}
-
-static int32_t qs_s5k4e1_i2c_write_b_sensor(unsigned short waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[3];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = qs_s5k4e1_i2c_txdata(qs_s5k4e1_client->addr>>1, buf, 3);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, bdata);
-	}
-	return rc;
-}
-
-static int32_t qs_s5k4e1_i2c_write_b_table(struct qs_s5k4e1_i2c_reg_conf const
-					 *reg_conf_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-	for (i = 0; i < num; i++) {
-		rc = qs_s5k4e1_i2c_write_b_sensor(reg_conf_tbl->waddr,
-			reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-	return rc;
-}
-
-static int32_t qs_s5k4e1_i2c_write_seq_sensor(unsigned short waddr,
-		unsigned char *seq_data, int len)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[len+2];
-	int i = 0;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	for (i = 0; i < len; i++)
-		buf[i+2] = seq_data[i];
-	rc = qs_s5k4e1_i2c_txdata(qs_s5k4e1_client->addr>>1, buf, len+2);
-	return rc;
-}
-
-static int32_t af_i2c_write_b_sensor(unsigned short baddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[2];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = baddr;
-	buf[1] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", baddr, bdata);
-	rc = qs_s5k4e1_i2c_txdata(AF_ADDR>>1, buf, 2);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			baddr, bdata);
-	}
-	return rc;
-}
-
-static int32_t bridge_i2c_write_w(unsigned short waddr, uint16_t wdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[4];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = (wdata & 0xFF00) >> 8;
-	buf[3] = (wdata & 0x00FF);
-	CDBG("bridge_i2c_write_w addr = 0x%x, val = 0x%x\n", waddr, wdata);
-	rc = qs_s5k4e1_i2c_txdata(BRIDGE_ADDR>>1, buf, 4);
-	if (rc < 0) {
-		CDBG("bridge_i2c_write_w failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, wdata);
-	}
-	return rc;
-}
-
-static int32_t bridge_i2c_read(unsigned short raddr,
-	unsigned short *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-	if (!rdata)
-		return -EIO;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-	rc = qs_s5k4e1_i2c_rxdata(BRIDGE_ADDR>>1, buf, rlen);
-	if (rc < 0) {
-		CDBG("bridge_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-	CDBG("bridge_i2c_read 0x%x val = 0x%x!\n", raddr, *rdata);
-	return rc;
-}
-
-static int32_t qs_s5k4e1_eeprom_i2c_read(unsigned short raddr,
-	unsigned char *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned short i2caddr = 0xA0 >> 1;
-	unsigned char buf[rlen];
-	int i = 0;
-	if (!rdata)
-		return -EIO;
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-	rc = qs_s5k4e1_i2c_rxdata(i2caddr, buf, rlen);
-	if (rc < 0) {
-		CDBG("qs_s5k4e1_eeprom_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	for (i = 0; i < rlen; i++) {
-		rdata[i] = buf[i];
-		CDBG("qs_s5k4e1_eeprom_i2c_read 0x%x index: %d val = 0x%x!\n",
-			raddr, i, buf[i]);
-	}
-	return rc;
-}
-
-static int32_t qs_s5k4e1_eeprom_i2c_read_b(unsigned short raddr,
-	unsigned short *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-	rc = qs_s5k4e1_eeprom_i2c_read(raddr, &buf[0], rlen);
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-	CDBG("qs_s5k4e1_eeprom_i2c_read 0x%x val = 0x%x!\n", raddr, *rdata);
-	return rc;
-}
-
-static int32_t qs_s5k4e1_get_calibration_data(
-	struct sensor_3d_cali_data_t *cdata)
-{
-	int32_t rc = 0;
-	cali_data_status = 1;
-	rc = qs_s5k4e1_eeprom_i2c_read(0x0,
-		&(cdata->left_p_matrix[0][0][0]), 96);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read(0x60,
-		&(cdata->right_p_matrix[0][0][0]), 96);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read(0xC0, &(cdata->square_len[0]), 8);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read(0xC8, &(cdata->focal_len[0]), 8);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read(0xD0, &(cdata->pixel_pitch[0]), 8);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x100, &(cdata->left_r), 1);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x101, &(cdata->right_r), 1);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x102, &(cdata->left_b), 1);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x103, &(cdata->right_b), 1);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x104, &(cdata->left_gb), 1);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x105, &(cdata->right_gb), 1);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x110, &(cdata->left_af_far), 2);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x112, &(cdata->right_af_far), 2);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x114, &(cdata->left_af_mid), 2);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x116, &(cdata->right_af_mid), 2);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x118, &(cdata->left_af_short), 2);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x11A, &(cdata->right_af_short), 2);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x11C, &(cdata->left_af_5um), 2);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x11E, &(cdata->right_af_5um), 2);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x120, &(cdata->left_af_50up), 2);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x122, &(cdata->right_af_50up), 2);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x124, &(cdata->left_af_50down), 2);
-	if (rc < 0)
-		goto fail;
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x126, &(cdata->right_af_50down), 2);
-	if (rc < 0)
-		goto fail;
-
-	return 0;
-
-fail:
-	cali_data_status = 0;
-	return -EIO;
-
-}
-static int32_t qs_s5k4e1_write_left_lsc(char *left_lsc, int rt)
-{
-	struct qs_s5k4e1_i2c_reg_conf *ptr = (struct qs_s5k4e1_i2c_reg_conf *)
-		(qs_s5k4e1_regs.reg_lens + rt);
-	bridge_i2c_write_w(0x06, 0x02);
-	if (!LENS_SHADE_CONFIG) {
-		qs_s5k4e1_i2c_write_b_sensor(0x3096, 0x40);
-		qs_s5k4e1_i2c_write_b_table(ptr, qs_s5k4e1_regs.reg_lens_size);
-		if (default_lens_shade)
-			qs_s5k4e1_i2c_write_b_table(qs_s5k4e1_regs.
-			reg_default_lens, qs_s5k4e1_regs.reg_default_lens_size);
-		else {
-			qs_s5k4e1_i2c_write_seq_sensor(0x3200,
-				&left_lsc[0], 216);
-			qs_s5k4e1_i2c_write_seq_sensor(0x32D8,
-				&left_lsc[216], 216);
-		}
-		qs_s5k4e1_i2c_write_b_sensor(0x3096, 0x60);
-		qs_s5k4e1_i2c_write_b_sensor(0x3096, 0x40);
-	} else
-		qs_s5k4e1_i2c_write_b_table(ptr, qs_s5k4e1_regs.reg_lens_size);
-	return 0;
-}
-
-static int32_t qs_s5k4e1_write_right_lsc(char *right_lsc, int rt)
-{
-	struct qs_s5k4e1_i2c_reg_conf *ptr = (struct qs_s5k4e1_i2c_reg_conf *)
-		(qs_s5k4e1_regs.reg_lens + rt);
-	bridge_i2c_write_w(0x06, 0x01);
-	if (!LENS_SHADE_CONFIG) {
-		qs_s5k4e1_i2c_write_b_sensor(0x3096, 0x40);
-		qs_s5k4e1_i2c_write_b_table(ptr, qs_s5k4e1_regs.reg_lens_size);
-		if (default_lens_shade)
-			qs_s5k4e1_i2c_write_b_table(qs_s5k4e1_regs.
-			reg_default_lens, qs_s5k4e1_regs.reg_default_lens_size);
-		else {
-			qs_s5k4e1_i2c_write_seq_sensor(0x3200,
-				&right_lsc[0], 216);
-			qs_s5k4e1_i2c_write_seq_sensor(0x32D8,
-				&right_lsc[216], 216);
-		}
-		qs_s5k4e1_i2c_write_b_sensor(0x3096, 0x60);
-		qs_s5k4e1_i2c_write_b_sensor(0x3096, 0x40);
-	} else
-		qs_s5k4e1_i2c_write_b_table(ptr, qs_s5k4e1_regs.reg_lens_size);
-	return 0;
-}
-
-static int32_t qs_s5k4e1_write_lsc(char *lsc, int rt)
-{
-	if (qs_s5k4e1_ctrl->cam_mode == MODE_3D) {
-		qs_s5k4e1_write_left_lsc(&lsc[0], rt);
-		qs_s5k4e1_write_right_lsc(&lsc[432], rt);
-		bridge_i2c_write_w(0x06, 0x03);
-	} else if (qs_s5k4e1_ctrl->cam_mode == MODE_2D_LEFT)
-		qs_s5k4e1_write_left_lsc(&lsc[0], rt);
-	else if (qs_s5k4e1_ctrl->cam_mode == MODE_2D_RIGHT)
-		qs_s5k4e1_write_right_lsc(&lsc[432], rt);
-	return 0;
-}
-
-static int32_t qs_s5k4e1_read_left_lsc(char *left_lsc)
-{
-	qs_s5k4e1_eeprom_i2c_read(0x200, &left_lsc[0], 216);
-	qs_s5k4e1_eeprom_i2c_read(0x2D8, &left_lsc[216], 216);
-	return 0;
-}
-
-static int32_t qs_s5k4e1_read_right_lsc(char *right_lsc)
-{
-	qs_s5k4e1_eeprom_i2c_read(0x3B0, &right_lsc[0], 216);
-	qs_s5k4e1_eeprom_i2c_read(0x488, &right_lsc[216], 216);
-	return 0;
-}
-
-static int32_t qs_s5k4e1_read_lsc(char *lsc)
-{
-	qs_s5k4e1_read_left_lsc(&lsc[0]);
-	qs_s5k4e1_read_right_lsc(&lsc[432]);
-	return 0;
-}
-
-static int32_t qs_s5k4e1_bridge_reset(void){
-	unsigned short RegData = 0, GPIOInState = 0;
-	int32_t rc = 0;
-	rc = bridge_i2c_write_w(0x50, 0x00);
-	if (rc < 0)
-		goto bridge_fail;
-	rc = bridge_i2c_write_w(0x53, 0x00);
-	if (rc < 0)
-		goto bridge_fail;
-	msleep(30);
-	rc = bridge_i2c_write_w(0x53, 0x01);
-	if (rc < 0)
-		goto bridge_fail;
-	msleep(30);
-	rc = bridge_i2c_write_w(0x0E, 0xFFFF);
-	if (rc < 0)
-		goto err;
-	rc = bridge_i2c_read(0x54, &RegData, 2);
-	if (rc < 0)
-		goto err;
-	rc = bridge_i2c_write_w(0x54, (RegData | 0x1));
-	if (rc < 0)
-		goto err;
-	msleep(30);
-	rc = bridge_i2c_read(0x54, &RegData, 2);
-	if (rc < 0)
-		goto err;
-	rc = bridge_i2c_write_w(0x54, (RegData | 0x4));
-	if (rc < 0)
-		goto err;
-	rc = bridge_i2c_read(0x55, &GPIOInState, 2);
-	if (rc < 0)
-		goto err;
-	rc = bridge_i2c_write_w(0x55, (GPIOInState | 0x1));
-	if (rc < 0)
-		goto err;
-	msleep(30);
-	rc = bridge_i2c_read(0x55, &GPIOInState, 2);
-	if (rc < 0)
-		goto err;
-	rc = bridge_i2c_write_w(0x55, (GPIOInState | 0x4));
-	if (rc < 0)
-		goto err;
-	msleep(30);
-	rc = bridge_i2c_read(0x55, &GPIOInState, 2);
-	if (rc < 0)
-		goto err;
-	GPIOInState = ((GPIOInState >> 4) & 0x1);
-
-	rc = bridge_i2c_read(0x08, &GPIOInState, 2);
-	if (rc < 0)
-		goto err;
-	rc = bridge_i2c_write_w(0x08, GPIOInState | 0x4000);
-	if (rc < 0)
-		goto err;
-	return rc;
-
-err:
-	bridge_i2c_write_w(0x53, 0x00);
-	msleep(30);
-
-bridge_fail:
-	return rc;
-
-}
-
-static void qs_s5k4e1_bridge_config(int mode, int rt)
-{
-	unsigned short RegData = 0;
-	if (mode == MODE_3D) {
-		bridge_i2c_read(0x54, &RegData, 2);
-		bridge_i2c_write_w(0x54, (RegData | 0x2));
-		bridge_i2c_write_w(0x54, (RegData | 0xa));
-		bridge_i2c_read(0x55, &RegData, 2);
-		bridge_i2c_write_w(0x55, (RegData | 0x2));
-		bridge_i2c_write_w(0x55, (RegData | 0xa));
-		bridge_i2c_write_w(0x14, 0x0C);
-		msleep(20);
-		bridge_i2c_write_w(0x16, 0x00);
-		bridge_i2c_write_w(0x51, 0x3);
-		bridge_i2c_write_w(0x52, 0x1);
-		bridge_i2c_write_w(0x06, 0x03);
-		bridge_i2c_write_w(0x04, 0x2018);
-		bridge_i2c_write_w(0x50, 0x00);
-	} else if (mode == MODE_2D_RIGHT) {
-		bridge_i2c_read(0x54, &RegData, 2);
-		RegData |= 0x2;
-		bridge_i2c_write_w(0x54, RegData);
-		bridge_i2c_write_w(0x54, (RegData & ~(0x8)));
-		bridge_i2c_read(0x55, &RegData, 2);
-		RegData |= 0x2;
-		bridge_i2c_write_w(0x55, RegData);
-		bridge_i2c_write_w(0x55, (RegData & ~(0x8)));
-		bridge_i2c_write_w(0x14, 0x04);
-		msleep(20);
-		bridge_i2c_write_w(0x51, 0x3);
-		bridge_i2c_write_w(0x06, 0x01);
-		bridge_i2c_write_w(0x04, 0x2018);
-		bridge_i2c_write_w(0x50, 0x01);
-	} else if (mode == MODE_2D_LEFT) {
-		bridge_i2c_read(0x54, &RegData, 2);
-		RegData |= 0x8;
-		bridge_i2c_write_w(0x54, RegData);
-		bridge_i2c_write_w(0x54, (RegData & ~(0x2)));
-		bridge_i2c_read(0x55, &RegData, 2);
-		RegData |= 0x8;
-		bridge_i2c_write_w(0x55, RegData);
-		bridge_i2c_write_w(0x55, (RegData & ~(0x2)));
-		bridge_i2c_write_w(0x14, 0x08);
-		msleep(20);
-		bridge_i2c_write_w(0x51, 0x3);
-		bridge_i2c_write_w(0x06, 0x02);
-		bridge_i2c_write_w(0x04, 0x2018);
-		bridge_i2c_write_w(0x50, 0x02);
-	}
-}
-
-static void qs_s5k4e1_group_hold_on(void)
-{
-	qs_s5k4e1_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-						GROUPED_PARAMETER_HOLD);
-}
-
-static void qs_s5k4e1_group_hold_off(void)
-{
-	qs_s5k4e1_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-						GROUPED_PARAMETER_HOLD_OFF);
-}
-
-static void qs_s5k4e1_start_stream(void)
-{
-	qs_s5k4e1_i2c_write_b_sensor(0x0100, 0x01);
-}
-
-static void qs_s5k4e1_stop_stream(void)
-{
-	qs_s5k4e1_i2c_write_b_sensor(0x0100, 0x00);
-}
-
-static void qs_s5k4e1_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint32_t divider, d1, d2;
-
-	d1 = prev_frame_length_lines * 0x00000400 / snap_frame_length_lines;
-	d2 = prev_line_length_pck * 0x00000400 / snap_line_length_pck;
-	divider = d1 * d2 / 0x400;
-
-	/*Verify PCLK settings and frame sizes.*/
-	*pfps = (uint16_t) (fps * divider / 0x400);
-	/* 2 is the ratio of no.of snapshot channels
-	to number of preview channels */
-}
-
-static uint16_t qs_s5k4e1_get_prev_lines_pf(void)
-{
-
-	return prev_frame_length_lines;
-
-}
-
-static uint16_t qs_s5k4e1_get_prev_pixels_pl(void)
-{
-	return prev_line_length_pck;
-
-}
-
-static uint16_t qs_s5k4e1_get_pict_lines_pf(void)
-{
-	return snap_frame_length_lines;
-}
-
-static uint16_t qs_s5k4e1_get_pict_pixels_pl(void)
-{
-	return snap_line_length_pck;
-}
-
-
-static uint32_t qs_s5k4e1_get_pict_max_exp_lc(void)
-{
-	return snap_frame_length_lines  * 24;
-}
-
-static int32_t qs_s5k4e1_set_fps(struct fps_cfg   *fps)
-{
-	uint16_t total_lines_per_frame;
-	int32_t rc = 0;
-	qs_s5k4e1_ctrl->fps_divider = fps->fps_div;
-	qs_s5k4e1_ctrl->pict_fps_divider = fps->pict_fps_div;
-	if (qs_s5k4e1_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-		total_lines_per_frame = (uint16_t)
-		((prev_frame_length_lines) * qs_s5k4e1_ctrl->fps_divider/0x400);
-	} else {
-		total_lines_per_frame = (uint16_t)
-		((snap_frame_length_lines) *
-			qs_s5k4e1_ctrl->pict_fps_divider/0x400);
-	}
-	qs_s5k4e1_group_hold_on();
-	rc = qs_s5k4e1_i2c_write_w_sensor(REG_FRAME_LENGTH_LINES,
-							total_lines_per_frame);
-	qs_s5k4e1_group_hold_off();
-	return rc;
-}
-
-static int32_t qs_s5k4e1_write_exp_gain(struct sensor_3d_exp_cfg exp_cfg)
-{
-	uint16_t max_legal_gain = 0x0200;
-	uint32_t ll_pck, fl_lines;
-	uint16_t gain = exp_cfg.gain;
-	uint32_t line = exp_cfg.line;
-	int32_t rc = 0;
-	if (gain > max_legal_gain) {
-		CDBG("Max legal gain Line:%d\n", __LINE__);
-		gain = max_legal_gain;
-	}
-	CDBG("qs_s5k4e1_write_exp_gain : gain = %d line = %d\n", gain, line);
-
-	if (qs_s5k4e1_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-		qs_s5k4e1_ctrl->my_reg_gain = gain;
-		qs_s5k4e1_ctrl->my_reg_line_count = (uint16_t) line;
-		fl_lines = prev_frame_length_lines *
-			qs_s5k4e1_ctrl->fps_divider / 0x400;
-		ll_pck = prev_line_length_pck;
-	} else {
-		fl_lines = snap_frame_length_lines *
-			qs_s5k4e1_ctrl->pict_fps_divider / 0x400;
-		ll_pck = snap_line_length_pck;
-	}
-	if (line > (fl_lines - QS_S5K4E1_OFFSET))
-		fl_lines = line + QS_S5K4E1_OFFSET;
-	qs_s5k4e1_group_hold_on();
-	rc = qs_s5k4e1_i2c_write_w_sensor(REG_GLOBAL_GAIN, gain);
-	rc = qs_s5k4e1_i2c_write_w_sensor(REG_FRAME_LENGTH_LINES, fl_lines);
-	rc = qs_s5k4e1_i2c_write_w_sensor(REG_COARSE_INTEGRATION_TIME, line);
-	if ((qs_s5k4e1_ctrl->cam_mode == MODE_3D) && (cali_data_status == 1)) {
-		bridge_i2c_write_w(0x06, 0x01);
-		rc = qs_s5k4e1_i2c_write_w_sensor(REG_GLOBAL_GAIN,
-			 exp_cfg.gain_adjust);
-		rc = qs_s5k4e1_i2c_write_w_sensor(REG_GR_GAIN, exp_cfg.gr_gain);
-		rc = qs_s5k4e1_i2c_write_w_sensor(REG_R_GAIN,
-				exp_cfg.r_gain);
-		rc = qs_s5k4e1_i2c_write_w_sensor(REG_B_GAIN,
-				exp_cfg.b_gain);
-		rc = qs_s5k4e1_i2c_write_w_sensor(REG_GB_GAIN,
-				exp_cfg.gb_gain);
-		bridge_i2c_write_w(0x06, 0x03);
-	}
-	qs_s5k4e1_group_hold_off();
-	return rc;
-}
-
-static int32_t qs_s5k4e1_set_pict_exp_gain(struct sensor_3d_exp_cfg exp_cfg)
-{
-	int32_t rc = 0;
-	rc = qs_s5k4e1_write_exp_gain(exp_cfg);
-	return rc;
-}
-
-static int32_t qs_s5k4e1_write_focus_value(uint16_t code_value)
-{
-	uint8_t code_val_msb, code_val_lsb;
-	if ((qs_s5k4e1_ctrl->cam_mode == MODE_2D_LEFT) ||
-		(qs_s5k4e1_ctrl->cam_mode == MODE_3D)) {
-		/* Left */
-		bridge_i2c_write_w(0x06, 0x02);
-		CDBG("%s: Left Lens Position: %d\n", __func__,
-			code_value);
-		code_val_msb = code_value >> 4;
-		code_val_lsb = (code_value & 0x000F) << 4;
-		code_val_lsb |= qs_s5k4e1_af_mode;
-		if (af_i2c_write_b_sensor(code_val_msb, code_val_lsb) < 0) {
-			CDBG("move_focus failed at line %d ...\n", __LINE__);
-			return -EBUSY;
-		}
-	}
-
-	if ((qs_s5k4e1_ctrl->cam_mode == MODE_2D_RIGHT) ||
-		(qs_s5k4e1_ctrl->cam_mode == MODE_3D)) {
-		/* Right */
-		bridge_i2c_write_w(0x06, 0x01);
-		code_value += qs_s5k4e1_af_right_adjust;
-		CDBG("%s: Right Lens Position: %d\n", __func__,
-			code_value);
-		code_val_msb = code_value >> 4;
-		code_val_lsb = (code_value & 0x000F) << 4;
-		code_val_lsb |= qs_s5k4e1_af_mode;
-		if (af_i2c_write_b_sensor(code_val_msb, code_val_lsb) < 0) {
-			CDBG("move_focus failed at line %d ...\n", __LINE__);
-			return -EBUSY;
-		}
-	}
-
-	if (qs_s5k4e1_ctrl->cam_mode == MODE_3D) {
-		/* 3D Mode */
-		bridge_i2c_write_w(0x06, 0x03);
-	}
-	usleep(qs_s5k4e1_sw_damping_time_wait*50);
-	return 0;
-}
-
-static int32_t qs_s5k4e1_write_1D_focus_value(uint16_t code_value)
-{
-	uint8_t code_val_msb, code_val_lsb;
-	CDBG("%s: Lens Position: %d\n", __func__, code_value);
-	code_val_msb = code_value >> 4;
-	code_val_lsb = (code_value & 0x000F) << 4;
-	code_val_lsb |= qs_s5k4e1_af_mode;
-	if (af_i2c_write_b_sensor(code_val_msb, code_val_lsb) < 0) {
-		CDBG("move_focus failed at line %d ...\n", __LINE__);
-		return -EBUSY;
-	}
-
-	usleep(qs_s5k4e1_sw_damping_time_wait*50);
-	return 0;
-}
-
-static int32_t qs_s5k4e1_move_focus(int direction,
-	int32_t num_steps)
-{
-	int16_t step_direction, actual_step, dest_lens_position,
-		dest_step_position;
-	int16_t max_step_postion = QS_S5K4E1_TOTAL_STEPS_NEAR_TO_FAR;
-	CDBG("Inside %s\n", __func__);
-	if (direction == MOVE_NEAR)
-		step_direction = 1;
-	else
-		step_direction = -1;
-
-	actual_step = (int16_t) (step_direction * (int16_t) num_steps);
-	dest_step_position = (int16_t) (qs_s5k4e1_ctrl->curr_step_pos +
-		actual_step);
-
-	if (qs_s5k4e1_ctrl->cam_mode == MODE_3D)
-		max_step_postion = QS_S5K4E1_TOTAL_STEPS_3D;
-
-	if (dest_step_position > max_step_postion)
-		dest_step_position = max_step_postion;
-	else if (dest_step_position < 0)
-		dest_step_position = 0;
-
-	if (dest_step_position == qs_s5k4e1_ctrl->curr_step_pos) {
-		CDBG("%s cur and dest pos are same\n", __func__);
-		CDBG("%s cur_step_pos:%d\n", __func__,
-			qs_s5k4e1_ctrl->curr_step_pos);
-		return 0;
-	}
-
-	if (step_direction < 0) {
-		if (num_steps >= 20) {
-			/* sweeping towards all the way in infinity direction */
-			qs_s5k4e1_af_mode = 2;
-			qs_s5k4e1_sw_damping_time_wait = 8;
-		} else if (num_steps <= 4) {
-			/* reverse search during macro mode */
-			qs_s5k4e1_af_mode = 4;
-			qs_s5k4e1_sw_damping_time_wait = 16;
-		} else {
-			qs_s5k4e1_af_mode = 3;
-			qs_s5k4e1_sw_damping_time_wait = 12;
-		}
-	} else {
-		/* coarse search towards macro direction */
-		qs_s5k4e1_af_mode = 4;
-		qs_s5k4e1_sw_damping_time_wait = 16;
-	}
-
-	if (qs_s5k4e1_ctrl->cam_mode == MODE_3D) {
-		/* Left */
-		bridge_i2c_write_w(0x06, 0x02);
-		dest_lens_position =
-			qs_s5k4e1_step_position_table_left[dest_step_position];
-		if (qs_s5k4e1_write_1D_focus_value(dest_lens_position) < 0) {
-			CDBG("move_focus failed at line %d ...\n", __LINE__);
-			bridge_i2c_write_w(0x06, 0x03);
-			return -EBUSY;
-		}
-		/* Keep left sensor as reference as AF stats is from left */
-		qs_s5k4e1_ctrl->curr_step_pos = dest_step_position;
-		qs_s5k4e1_ctrl->curr_lens_pos = dest_lens_position;
-
-		/* Right */
-		bridge_i2c_write_w(0x06, 0x01);
-		dest_lens_position =
-			qs_s5k4e1_step_position_table_right[dest_step_position];
-		if (qs_s5k4e1_write_1D_focus_value(dest_lens_position) < 0) {
-			CDBG("move_focus failed at line %d ...\n", __LINE__);
-			bridge_i2c_write_w(0x06, 0x03);
-			return -EBUSY;
-		}
-
-		/* 3D Mode */
-		bridge_i2c_write_w(0x06, 0x03);
-		return 0;
-	}
-
-	dest_lens_position = qs_s5k4e1_step_position_table[dest_step_position];
-	CDBG("%s: Step Position: %d\n", __func__, dest_step_position);
-	if (qs_s5k4e1_ctrl->curr_lens_pos != dest_lens_position) {
-		if (qs_s5k4e1_write_focus_value(dest_lens_position) < 0) {
-			CDBG("move_focus failed at line %d ...\n", __LINE__);
-			return -EBUSY;
-		}
-	}
-
-	qs_s5k4e1_ctrl->curr_step_pos = dest_step_position;
-	qs_s5k4e1_ctrl->curr_lens_pos = dest_lens_position;
-	return 0;
-}
-
-static int32_t qs_s5k4e1_set_default_focus(uint8_t af_step)
-{
-	int32_t rc = 0;
-	if (qs_s5k4e1_ctrl->curr_step_pos) {
-		rc = qs_s5k4e1_move_focus(MOVE_FAR,
-			qs_s5k4e1_ctrl->curr_step_pos);
-		if (rc < 0)
-			return rc;
-	} else {
-		if (qs_s5k4e1_ctrl->cam_mode == MODE_3D) {
-			/* Left */
-			bridge_i2c_write_w(0x06, 0x02);
-			rc = qs_s5k4e1_write_1D_focus_value(
-				qs_s5k4e1_step_position_table_left[0]);
-			if (rc < 0) {
-				bridge_i2c_write_w(0x06, 0x03);
-				return rc;
-			}
-
-			/* Right */
-			bridge_i2c_write_w(0x06, 0x01);
-			rc = qs_s5k4e1_write_1D_focus_value(
-				qs_s5k4e1_step_position_table_right[0]);
-			if (rc < 0) {
-				bridge_i2c_write_w(0x06, 0x03);
-				return rc;
-			}
-
-			/* Left sensor is the reference sensor for AF stats */
-			qs_s5k4e1_ctrl->curr_lens_pos =
-				qs_s5k4e1_step_position_table_left[0];
-
-			/* 3D Mode */
-			bridge_i2c_write_w(0x06, 0x03);
-		} else {
-			rc = qs_s5k4e1_write_focus_value(
-				qs_s5k4e1_step_position_table[0]);
-			if (rc < 0)
-				return rc;
-			qs_s5k4e1_ctrl->curr_lens_pos =
-				qs_s5k4e1_step_position_table[0];
-		}
-	}
-	CDBG("%s\n", __func__);
-	return 0;
-}
-
-static void qs_s5k4e1_3d_table_init(void)
-{
-	int16_t af_data = 0;
-	uint16_t step = 8, step_q2 = 8, anchor_point_q2;
-	int32_t rc = 0, i, j;
-	uint16_t eeprom_read_addr[2][3] = {{0x110, 0x114, 0x118},
-		{0x112, 0x116, 0x11A} };
-	uint16_t *step_position_table;
-
-	step_position_table = qs_s5k4e1_step_position_table_left;
-	for (j = 0; j < 2; j++) {
-		rc = qs_s5k4e1_eeprom_i2c_read_b(eeprom_read_addr[j][0],
-			&af_data, 2);
-		if (rc == 0) {
-			CDBG("%s: Far data - %d\n", __func__, af_data);
-			step_position_table[0] = af_data;
-		} else {
-			CDBG("%s: EEPROM data read error\n", __func__);
-			return;
-		}
-
-		rc = qs_s5k4e1_eeprom_i2c_read_b(eeprom_read_addr[j][1],
-			&af_data, 2);
-		if (rc == 0) {
-			CDBG("%s: Medium data - %d\n", __func__, af_data);
-			step_position_table[2] = af_data;
-		} else {
-			CDBG("%s: EEPROM data read error\n", __func__);
-			return;
-		}
-
-		/*
-		 * Using the 150cm and 100cm calibration values
-		 * as per the Lens characteristics derive intermediate step
-		 */
-		step_position_table[1] = step_position_table[0] +
-			(step_position_table[2] - step_position_table[0])/2;
-		CDBG("%s: Step between 150cm:100cm is %d\n", __func__,
-			step_position_table[1]);
-
-		rc = qs_s5k4e1_eeprom_i2c_read_b(eeprom_read_addr[j][2],
-			&af_data, 2);
-		if (rc == 0) {
-			CDBG("%s: Short data - %d\n", __func__, af_data);
-			step_position_table[6] = af_data;
-		} else {
-			CDBG("%s: EEPROM data read error\n", __func__);
-			return;
-		}
-
-		/*
-		 * Using the 100cm and 50cm calibration values
-		 * as per the Lens characteristics derive
-		 * intermediate steps
-		 */
-		step = (step_position_table[6] - step_position_table[2])/4;
-
-		/*
-		 * Interpolate the intermediate steps between 100cm
-		 * to 50cm based on COC1.5
-		 */
-		step_position_table[3] = step_position_table[2] + step;
-		step_position_table[4] = step_position_table[3] + step;
-		step_position_table[5] = step_position_table[4] + step;
-
-		/*
-		 * Extrapolate the steps within 50cm based on
-		 * OC2 to converge faster. This range is beyond the 3D
-		 * specification of 50cm
-		 */
-		anchor_point_q2 = step_position_table[6] << 1;
-		step_q2 = (step_position_table[6] - step_position_table[2]);
-
-		for (i = 7; i < QS_S5K4E1_TOTAL_STEPS_3D; i++) {
-			anchor_point_q2 += step_q2;
-			step_position_table[i] = anchor_point_q2 >> 1;
-		}
-		step_position_table = qs_s5k4e1_step_position_table_right;
-	}
-}
-
-static void qs_s5k4e1_init_focus(void)
-{
-	uint8_t i;
-	int32_t rc = 0;
-	int16_t af_far_data = 0;
-	qs_s5k4e1_af_initial_code = 190;
-	/* Read the calibration data from left and right sensors if available */
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x110, &af_far_data, 2);
-	if (rc == 0) {
-		CDBG("%s: Left Far data - %d\n", __func__, af_far_data);
-		qs_s5k4e1_af_initial_code = af_far_data;
-	}
-
-	rc = qs_s5k4e1_eeprom_i2c_read_b(0x112, &af_far_data, 2);
-	if (rc == 0) {
-		CDBG("%s: Right Far data - %d\n", __func__, af_far_data);
-		qs_s5k4e1_af_right_adjust = af_far_data -
-			qs_s5k4e1_af_initial_code;
-	}
-
-	qs_s5k4e1_3d_table_init();
-
-	qs_s5k4e1_step_position_table[0] = qs_s5k4e1_af_initial_code;
-	for (i = 1; i <= QS_S5K4E1_TOTAL_STEPS_NEAR_TO_FAR; i++) {
-		if (i <= qs_s5k4e1_nl_region_boundary1) {
-			qs_s5k4e1_step_position_table[i] =
-				qs_s5k4e1_step_position_table[i-1]
-				+ qs_s5k4e1_nl_region_code_per_step1;
-		} else {
-			qs_s5k4e1_step_position_table[i] =
-				qs_s5k4e1_step_position_table[i-1]
-				+ qs_s5k4e1_l_region_code_per_step;
-		}
-
-		if (qs_s5k4e1_step_position_table[i] > 1023)
-			qs_s5k4e1_step_position_table[i] = 1023;
-	}
-	qs_s5k4e1_ctrl->curr_step_pos = 0;
-}
-
-static int32_t qs_s5k4e1_test(enum qs_s5k4e1_test_mode_t mo)
-{
-	int32_t rc = 0;
-	if (mo == TEST_OFF)
-		return rc;
-	else {
-		/* REG_0x30D8[4] is TESBYPEN: 0: Normal Operation,
-		1: Bypass Signal Processing
-		REG_0x30D8[5] is EBDMASK: 0:
-		Output Embedded data, 1: No output embedded data */
-		if (qs_s5k4e1_i2c_write_b_sensor(REG_TEST_PATTERN_MODE,
-			(uint8_t) mo) < 0) {
-			return rc;
-		}
-	}
-	return rc;
-}
-
-static int32_t qs_s5k4e1_sensor_setting(int update_type, int rt)
-{
-
-	int32_t rc = 0;
-	struct msm_camera_csi_params qs_s5k4e1_csi_params;
-
-	qs_s5k4e1_stop_stream();
-	msleep(80);
-	bridge_i2c_write_w(0x53, 0x00);
-	msleep(80);
-	if (update_type == REG_INIT) {
-		CSI_CONFIG = 0;
-		LENS_SHADE_CONFIG = 0;
-		default_lens_shade = 0;
-		bridge_i2c_write_w(0x53, 0x01);
-		msleep(30);
-		qs_s5k4e1_bridge_config(qs_s5k4e1_ctrl->cam_mode, rt);
-		msleep(30);
-		qs_s5k4e1_i2c_write_b_table(qs_s5k4e1_regs.rec_settings,
-				qs_s5k4e1_regs.rec_size);
-		msleep(30);
-	} else if (update_type == UPDATE_PERIODIC) {
-		qs_s5k4e1_write_lsc(lens_eeprom_data, rt);
-		msleep(100);
-		if (!CSI_CONFIG) {
-			if (qs_s5k4e1_ctrl->cam_mode == MODE_3D) {
-				qs_s5k4e1_csi_params.lane_cnt = 4;
-				qs_s5k4e1_csi_params.data_format = CSI_8BIT;
-			} else {
-				qs_s5k4e1_csi_params.lane_cnt = 1;
-				qs_s5k4e1_csi_params.data_format = CSI_10BIT;
-			}
-			qs_s5k4e1_csi_params.lane_assign = 0xe4;
-			qs_s5k4e1_csi_params.dpcm_scheme = 0;
-			qs_s5k4e1_csi_params.settle_cnt = 28;
-			rc = msm_camio_csi_config(&qs_s5k4e1_csi_params);
-			msleep(10);
-			cam_debug_init();
-			CSI_CONFIG = 1;
-		}
-		bridge_i2c_write_w(0x53, 0x01);
-		msleep(50);
-		qs_s5k4e1_i2c_write_b_table(qs_s5k4e1_regs.conf_array[rt].conf,
-			qs_s5k4e1_regs.conf_array[rt].size);
-		msleep(50);
-		qs_s5k4e1_start_stream();
-		msleep(80);
-	}
-	return rc;
-}
-
-static int32_t qs_s5k4e1_video_config(int mode)
-{
-
-	int32_t rc = 0;
-	/* change sensor resolution if needed */
-	if (qs_s5k4e1_sensor_setting(UPDATE_PERIODIC,
-			qs_s5k4e1_ctrl->prev_res) < 0)
-		return rc;
-	if (qs_s5k4e1_ctrl->set_test) {
-		if (qs_s5k4e1_test(qs_s5k4e1_ctrl->set_test) < 0)
-			return  rc;
-	}
-
-	qs_s5k4e1_ctrl->curr_res = qs_s5k4e1_ctrl->prev_res;
-	qs_s5k4e1_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t qs_s5k4e1_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	/*change sensor resolution if needed */
-	if (qs_s5k4e1_ctrl->curr_res != qs_s5k4e1_ctrl->pict_res) {
-		if (qs_s5k4e1_sensor_setting(UPDATE_PERIODIC,
-				qs_s5k4e1_ctrl->pict_res) < 0)
-			return rc;
-	}
-
-	qs_s5k4e1_ctrl->curr_res = qs_s5k4e1_ctrl->pict_res;
-	qs_s5k4e1_ctrl->sensormode = mode;
-	return rc;
-} /*end of qs_s5k4e1_snapshot_config*/
-
-static int32_t qs_s5k4e1_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	/* change sensor resolution if needed */
-	if (qs_s5k4e1_ctrl->curr_res != qs_s5k4e1_ctrl->pict_res) {
-		if (qs_s5k4e1_sensor_setting(UPDATE_PERIODIC,
-				qs_s5k4e1_ctrl->pict_res) < 0)
-			return rc;
-	}
-
-	qs_s5k4e1_ctrl->curr_res = qs_s5k4e1_ctrl->pict_res;
-	qs_s5k4e1_ctrl->sensormode = mode;
-	return rc;
-} /*end of qs_s5k4e1_raw_snapshot_config*/
-
-static int32_t qs_s5k4e1_mode_init(int mode, struct sensor_init_cfg init_info)
-{
-	int32_t rc = 0;
-	if (mode != qs_s5k4e1_ctrl->cam_mode) {
-		qs_s5k4e1_ctrl->prev_res = init_info.prev_res;
-		qs_s5k4e1_ctrl->pict_res = init_info.pict_res;
-		qs_s5k4e1_ctrl->cam_mode = mode;
-
-		prev_frame_length_lines =
-		((qs_s5k4e1_regs.conf_array[qs_s5k4e1_ctrl->prev_res]\
-			.conf[QS_S5K4E1_FRAME_LENGTH_LINES_H].wdata << 8)
-			| qs_s5k4e1_regs.conf_array[qs_s5k4e1_ctrl->prev_res]\
-			.conf[QS_S5K4E1_FRAME_LENGTH_LINES_L].wdata);
-		prev_line_length_pck =
-		(qs_s5k4e1_regs.conf_array[qs_s5k4e1_ctrl->prev_res]\
-			.conf[QS_S5K4E1_LINE_LENGTH_PCK_H].wdata << 8)
-			| qs_s5k4e1_regs.conf_array[qs_s5k4e1_ctrl->prev_res]\
-			.conf[QS_S5K4E1_LINE_LENGTH_PCK_L].wdata;
-		snap_frame_length_lines =
-		(qs_s5k4e1_regs.conf_array[qs_s5k4e1_ctrl->pict_res]\
-			.conf[QS_S5K4E1_FRAME_LENGTH_LINES_H].wdata << 8)
-			| qs_s5k4e1_regs.conf_array[qs_s5k4e1_ctrl->pict_res]\
-			.conf[QS_S5K4E1_FRAME_LENGTH_LINES_L].wdata;
-		snap_line_length_pck =
-		(qs_s5k4e1_regs.conf_array[qs_s5k4e1_ctrl->pict_res]\
-			.conf[QS_S5K4E1_LINE_LENGTH_PCK_H].wdata << 8)
-			| qs_s5k4e1_regs.conf_array[qs_s5k4e1_ctrl->pict_res]\
-			.conf[QS_S5K4E1_LINE_LENGTH_PCK_L].wdata;
-
-	rc = qs_s5k4e1_sensor_setting(REG_INIT,
-		qs_s5k4e1_ctrl->prev_res);
-	}
-	return rc;
-}
-static int32_t qs_s5k4e1_set_sensor_mode(int mode,
-	int res)
-{
-	int32_t rc = 0;
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		qs_s5k4e1_ctrl->prev_res = res;
-		rc = qs_s5k4e1_video_config(mode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-		qs_s5k4e1_ctrl->pict_res = res;
-		rc = qs_s5k4e1_snapshot_config(mode);
-		break;
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		qs_s5k4e1_ctrl->pict_res = res;
-		rc = qs_s5k4e1_raw_snapshot_config(mode);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-static int32_t qs_s5k4e1_power_down(void)
-{
-	qs_s5k4e1_stop_stream();
-	msleep(30);
-	qs_s5k4e1_af_mode = 2;
-	qs_s5k4e1_af_right_adjust = 0;
-	qs_s5k4e1_write_focus_value(0);
-	msleep(100);
-	/* Set AF actutator to PowerDown */
-	af_i2c_write_b_sensor(0x80, 00);
-	return 0;
-}
-
-static int qs_s5k4e1_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	CDBG("probe done\n");
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int
-	qs_s5k4e1_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	uint16_t chipid = 0;
-	CDBG("%s: %d\n", __func__, __LINE__);
-	rc = gpio_request(data->sensor_reset, "qs_s5k4e1");
-	CDBG(" qs_s5k4e1_probe_init_sensor\n");
-	if (!rc) {
-		CDBG("sensor_reset = %d\n", rc);
-		gpio_direction_output(data->sensor_reset, 0);
-		msleep(50);
-		gpio_set_value_cansleep(data->sensor_reset, 1);
-		msleep(13);
-	} else {
-		goto init_probe_done;
-	}
-	msleep(70);
-	rc = qs_s5k4e1_bridge_reset();
-	if (rc < 0)
-		goto init_probe_fail;
-	qs_s5k4e1_bridge_config(MODE_3D, RES_PREVIEW);
-	msleep(30);
-
-	CDBG(" qs_s5k4e1_probe_init_sensor is called\n");
-	rc = qs_s5k4e1_i2c_read(0x0000, &chipid, 2);
-	CDBG("ID: %d\n", chipid);
-	/* 4. Compare sensor ID to QS_S5K4E1 ID: */
-	if (chipid != 0x4e10) {
-		rc = -ENODEV;
-		CDBG("qs_s5k4e1_probe_init_sensor fail chip id mismatch\n");
-		goto init_probe_fail;
-	}
-	goto init_probe_done;
-init_probe_fail:
-	CDBG(" qs_s5k4e1_probe_init_sensor fails\n");
-	gpio_set_value_cansleep(data->sensor_reset, 0);
-	qs_s5k4e1_probe_init_done(data);
-init_probe_done:
-	CDBG(" qs_s5k4e1_probe_init_sensor finishes\n");
-	return rc;
-}
-/* camsensor_qs_s5k4e1_reset */
-
-int qs_s5k4e1_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	CDBG("%s: %d\n", __func__, __LINE__);
-	CDBG("Calling qs_s5k4e1_sensor_open_init\n");
-
-	qs_s5k4e1_ctrl = kzalloc(sizeof(struct qs_s5k4e1_ctrl_t), GFP_KERNEL);
-	if (!qs_s5k4e1_ctrl) {
-		CDBG("qs_s5k4e1_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	qs_s5k4e1_ctrl->fps_divider = 1 * 0x00000400;
-	qs_s5k4e1_ctrl->pict_fps_divider = 1 * 0x00000400;
-	qs_s5k4e1_ctrl->set_test = TEST_OFF;
-	qs_s5k4e1_ctrl->cam_mode = MODE_INVALID;
-
-	if (data)
-		qs_s5k4e1_ctrl->sensordata = data;
-	if (rc < 0) {
-		CDBG("Calling qs_s5k4e1_sensor_open_init fail1\n");
-		return rc;
-	}
-	CDBG("%s: %d\n", __func__, __LINE__);
-	/* enable mclk first */
-	msm_camio_clk_rate_set(QS_S5K4E1_MASTER_CLK_RATE);
-	rc = qs_s5k4e1_probe_init_sensor(data);
-	if (rc < 0)
-		goto init_fail;
-/*Default mode is 3D*/
-	memcpy(lens_eeprom_data, data->eeprom_data, 864);
-	qs_s5k4e1_ctrl->fps = 30*Q8;
-	qs_s5k4e1_init_focus();
-	if (rc < 0) {
-		gpio_set_value_cansleep(data->sensor_reset, 0);
-		goto init_fail;
-	} else
-		goto init_done;
-init_fail:
-	CDBG("init_fail\n");
-	qs_s5k4e1_probe_init_done(data);
-init_done:
-	CDBG("init_done\n");
-	return rc;
-} /*endof qs_s5k4e1_sensor_open_init*/
-
-static int qs_s5k4e1_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&qs_s5k4e1_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id qs_s5k4e1_i2c_id[] = {
-	{"qs_s5k4e1", 0},
-	{ }
-};
-
-static int qs_s5k4e1_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("qs_s5k4e1_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	qs_s5k4e1_sensorw = kzalloc(sizeof(struct qs_s5k4e1_work_t),
-		 GFP_KERNEL);
-	if (!qs_s5k4e1_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, qs_s5k4e1_sensorw);
-	qs_s5k4e1_init_client(client);
-	qs_s5k4e1_client = client;
-
-	msleep(50);
-
-	CDBG("qs_s5k4e1_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("qs_s5k4e1_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int qs_s5k4e1_send_wb_info(struct wb_info_cfg *wb)
-{
-	return 0;
-
-} /*end of qs_s5k4e1_snapshot_config*/
-
-static int __exit qs_s5k4e1_remove(struct i2c_client *client)
-{
-	struct qs_s5k4e1_work_t_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	qs_s5k4e1_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static struct i2c_driver qs_s5k4e1_i2c_driver = {
-	.id_table = qs_s5k4e1_i2c_id,
-	.probe  = qs_s5k4e1_i2c_probe,
-	.remove = __exit_p(qs_s5k4e1_i2c_remove),
-	.driver = {
-		.name = "qs_s5k4e1",
-	},
-};
-
-int qs_s5k4e1_3D_sensor_config(void __user *argp)
-{
-	struct sensor_large_data cdata;
-	long rc;
-	if (copy_from_user(&cdata,
-		(void *)argp,
-		sizeof(struct sensor_large_data)))
-		return -EFAULT;
-	mutex_lock(&qs_s5k4e1_mut);
-	rc = qs_s5k4e1_get_calibration_data
-		(&cdata.data.sensor_3d_cali_data);
-	if (rc < 0)
-		goto fail;
-	if (copy_to_user((void *)argp,
-		&cdata,
-		sizeof(struct sensor_large_data)))
-		rc = -EFAULT;
-fail:
-	mutex_unlock(&qs_s5k4e1_mut);
-	return rc;
-}
-
-int qs_s5k4e1_2D_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-	if (copy_from_user(&cdata,
-		(void *)argp,
-		sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(&qs_s5k4e1_mut);
-	CDBG("qs_s5k4e1_sensor_config: cfgtype = %d\n",
-	cdata.cfgtype);
-		switch (cdata.cfgtype) {
-		case CFG_GET_PICT_FPS:
-			qs_s5k4e1_get_pict_fps(
-				cdata.cfg.gfps.prevfps,
-				&(cdata.cfg.gfps.pictfps));
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PREV_L_PF:
-			cdata.cfg.prevl_pf =
-			qs_s5k4e1_get_prev_lines_pf();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PREV_P_PL:
-			cdata.cfg.prevp_pl =
-				qs_s5k4e1_get_prev_pixels_pl();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_L_PF:
-			cdata.cfg.pictl_pf =
-				qs_s5k4e1_get_pict_lines_pf();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_P_PL:
-			cdata.cfg.pictp_pl =
-				qs_s5k4e1_get_pict_pixels_pl();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_MAX_EXP_LC:
-			cdata.cfg.pict_max_exp_lc =
-				qs_s5k4e1_get_pict_max_exp_lc();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_SET_FPS:
-		case CFG_SET_PICT_FPS:
-			rc = qs_s5k4e1_set_fps(&(cdata.cfg.fps));
-			break;
-
-		case CFG_SET_EXP_GAIN:
-			rc =
-				qs_s5k4e1_write_exp_gain(
-					cdata.cfg.sensor_3d_exp);
-			break;
-
-		case CFG_SET_PICT_EXP_GAIN:
-			rc =
-				qs_s5k4e1_set_pict_exp_gain(
-				cdata.cfg.sensor_3d_exp);
-			break;
-
-		case CFG_SET_MODE:
-			rc = qs_s5k4e1_set_sensor_mode(cdata.mode,
-					cdata.rs);
-			break;
-
-		case CFG_PWR_DOWN:
-			rc = qs_s5k4e1_power_down();
-			break;
-
-		case CFG_MOVE_FOCUS:
-			rc =
-				qs_s5k4e1_move_focus(
-				cdata.cfg.focus.dir,
-				cdata.cfg.focus.steps);
-			break;
-
-		case CFG_SET_DEFAULT_FOCUS:
-			rc =
-				qs_s5k4e1_set_default_focus(
-				cdata.cfg.focus.steps);
-			break;
-
-		case CFG_GET_AF_MAX_STEPS:
-			if (qs_s5k4e1_ctrl->cam_mode == MODE_3D)
-				cdata.max_steps = QS_S5K4E1_TOTAL_STEPS_3D;
-			else
-				cdata.max_steps =
-					QS_S5K4E1_TOTAL_STEPS_NEAR_TO_FAR;
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_SET_EFFECT:
-			rc = qs_s5k4e1_set_default_focus(
-				cdata.cfg.effect);
-			break;
-
-
-		case CFG_SEND_WB_INFO:
-			rc = qs_s5k4e1_send_wb_info(
-				&(cdata.cfg.wb_info));
-			break;
-
-		case CFG_SENSOR_INIT:
-			rc = qs_s5k4e1_mode_init(cdata.mode,
-					cdata.cfg.init_info);
-			break;
-
-		default:
-			rc = -EFAULT;
-			break;
-		}
-
-	mutex_unlock(&qs_s5k4e1_mut);
-
-	return rc;
-}
-
-int qs_s5k4e1_sensor_config(void __user *argp)
-{
-	int cfgtype;
-	long rc;
-	if (copy_from_user(&cfgtype,
-		(void *)argp,
-		sizeof(int)))
-		return -EFAULT;
-	if (cfgtype != CFG_GET_3D_CALI_DATA)
-		rc = qs_s5k4e1_2D_sensor_config(argp);
-	else
-		rc = qs_s5k4e1_3D_sensor_config(argp);
-	return rc;
-}
-
-static int qs_s5k4e1_sensor_release(void)
-{
-	int rc = -EBADF;
-	mutex_lock(&qs_s5k4e1_mut);
-	qs_s5k4e1_power_down();
-	bridge_i2c_write_w(0x53, 0x00);
-	msleep(20);
-	gpio_set_value_cansleep(qs_s5k4e1_ctrl->sensordata->sensor_reset, 0);
-	msleep(5);
-	gpio_free(qs_s5k4e1_ctrl->sensordata->sensor_reset);
-	kfree(qs_s5k4e1_ctrl);
-	qs_s5k4e1_ctrl = NULL;
-	CDBG("qs_s5k4e1_release completed\n");
-	mutex_unlock(&qs_s5k4e1_mut);
-
-	return rc;
-}
-
-static int qs_s5k4e1_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-	rc = i2c_add_driver(&qs_s5k4e1_i2c_driver);
-	if (rc < 0 || qs_s5k4e1_client == NULL) {
-		rc = -ENOTSUPP;
-		CDBG("I2C add driver failed");
-		goto probe_fail;
-	}
-	msm_camio_clk_rate_set(QS_S5K4E1_MASTER_CLK_RATE);
-	rc = qs_s5k4e1_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-	qs_s5k4e1_read_lsc(info->eeprom_data); /*Default mode is 3D*/
-	s->s_init = qs_s5k4e1_sensor_open_init;
-	s->s_release = qs_s5k4e1_sensor_release;
-	s->s_config  = qs_s5k4e1_sensor_config;
-	s->s_mount_angle = info->sensor_platform_info->mount_angle;
-	s->s_camera_type = BACK_CAMERA_3D;
-	s->s_video_packing = SIDE_BY_SIDE_HALF;
-	s->s_snap_packing = SIDE_BY_SIDE_FULL;
-	bridge_i2c_write_w(0x53, 0x00);
-	msleep(20);
-	gpio_set_value_cansleep(info->sensor_reset, 0);
-	qs_s5k4e1_probe_init_done(info);
-	return rc;
-
-probe_fail:
-	CDBG("qs_s5k4e1_sensor_probe: SENSOR PROBE FAILS!\n");
-	return rc;
-}
-
-static bool streaming = 1;
-
-static int qs_s5k4e1_focus_test(void *data, u64 *val)
-{
-	int i = 0;
-	qs_s5k4e1_set_default_focus(0);
-
-	for (i = 0; i < QS_S5K4E1_TOTAL_STEPS_NEAR_TO_FAR; i++) {
-		qs_s5k4e1_move_focus(MOVE_NEAR, 1);
-		msleep(2000);
-	}
-	msleep(5000);
-	for ( ; i > 0; i--) {
-		qs_s5k4e1_move_focus(MOVE_FAR, 1);
-		msleep(2000);
-	}
-	return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(cam_focus, qs_s5k4e1_focus_test,
-			NULL, "%lld\n");
-
-static int qs_s5k4e1_step_test(void *data, u64 *val)
-{
-	int rc = 0;
-	struct sensor_large_data cdata;
-	rc = qs_s5k4e1_get_calibration_data
-		(&cdata.data.sensor_3d_cali_data);
-	if (rc < 0)
-		CDBG("%s: Calibration data read fail.\n", __func__);
-
-	return 0;
-}
-
-static int qs_s5k4e1_set_step(void *data, u64 val)
-{
-	qs_s5k4e1_l_region_code_per_step = val & 0xFF;
-	qs_s5k4e1_af_mode = (val >> 8) & 0xFF;
-	qs_s5k4e1_nl_region_code_per_step1 = (val >> 16) & 0xFFFF;
-
-	return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(cam_step, qs_s5k4e1_step_test,
-			qs_s5k4e1_set_step, "%lld\n");
-
-static int cam_debug_stream_set(void *data, u64 val)
-{
-	int rc = 0;
-
-	if (val) {
-		qs_s5k4e1_start_stream();
-		streaming = 1;
-	} else {
-		qs_s5k4e1_stop_stream();
-		streaming = 0;
-	}
-
-	return rc;
-}
-
-static int cam_debug_stream_get(void *data, u64 *val)
-{
-	*val = streaming;
-	return 0;
-}
-DEFINE_SIMPLE_ATTRIBUTE(cam_stream, cam_debug_stream_get,
-			cam_debug_stream_set, "%llu\n");
-
-static uint16_t qs_s5k4e1_step_val = QS_S5K4E1_TOTAL_STEPS_NEAR_TO_FAR;
-static uint8_t qs_s5k4e1_step_dir = MOVE_NEAR;
-static int qs_s5k4e1_af_step_config(void *data, u64 val)
-{
-	qs_s5k4e1_step_val = val & 0xFFFF;
-	qs_s5k4e1_step_dir = (val >> 16) & 0x1;
-	CDBG("%s\n", __func__);
-	return 0;
-}
-
-static int qs_s5k4e1_af_step(void *data, u64 *val)
-{
-	int i = 0;
-	int dir = MOVE_NEAR;
-	CDBG("%s\n", __func__);
-	qs_s5k4e1_set_default_focus(0);
-	msleep(5000);
-	if (qs_s5k4e1_step_dir == 1)
-		dir = MOVE_FAR;
-
-	for (i = 0; i < qs_s5k4e1_step_val; i += 4) {
-		qs_s5k4e1_move_focus(dir, 4);
-		msleep(1000);
-	}
-	qs_s5k4e1_set_default_focus(0);
-	return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(af_step, qs_s5k4e1_af_step,
-			qs_s5k4e1_af_step_config, "%llu\n");
-
-static int cam_debug_init(void)
-{
-	struct dentry *cam_dir;
-	debugfs_base = debugfs_create_dir("sensor", NULL);
-	if (!debugfs_base)
-		return -ENOMEM;
-
-	cam_dir = debugfs_create_dir("qs_s5k4e1", debugfs_base);
-	if (!cam_dir)
-		return -ENOMEM;
-
-	if (!debugfs_create_file("focus", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &cam_focus))
-		return -ENOMEM;
-	if (!debugfs_create_file("step", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &cam_step))
-		return -ENOMEM;
-	if (!debugfs_create_file("stream", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &cam_stream))
-		return -ENOMEM;
-	if (!debugfs_create_file("af_step", S_IRUGO | S_IWUSR, cam_dir,
-							 NULL, &af_step))
-		return -ENOMEM;
-	return 0;
-}
-
-static int __qs_s5k4e1_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, qs_s5k4e1_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __qs_s5k4e1_probe,
-	.driver = {
-		.name = "msm_camera_qs_s5k4e1",
-	.owner = THIS_MODULE,
-	},
-};
-
-static int __init qs_s5k4e1_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(qs_s5k4e1_init);
-void qs_s5k4e1_exit(void)
-{
-	i2c_del_driver(&qs_s5k4e1_i2c_driver);
-}
-MODULE_DESCRIPTION("Samsung 5MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/qs_s5k4e1.h b/drivers/media/video/msm/qs_s5k4e1.h
deleted file mode 100644
index dca3d0a..0000000
--- a/drivers/media/video/msm/qs_s5k4e1.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef QS_S5K4E1_H
-#define QS_S5K4E1_H
-#include <linux/types.h>
-#include <mach/board.h>
-extern struct qs_s5k4e1_reg qs_s5k4e1_regs;
-
-#define LENS_SHADE_TABLE 16
-
-struct qs_s5k4e1_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-struct qs_s5k4e1_i2c_conf_array {
-       struct qs_s5k4e1_i2c_reg_conf *conf;
-       unsigned short size;
-};
-
-enum qs_s5k4e1_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum qs_s5k4e1_resolution_t {
-	QTR_2D_SIZE,
-	FULL_2D_SIZE,
-	QTR_3D_SIZE,
-	FULL_3D_SIZE,
-	INVALID_SIZE
-};
-enum qs_s5k4e1_setting {
-	RES_PREVIEW,
-	RES_CAPTURE,
-	RES_3D_PREVIEW,
-	RES_3D_CAPTURE
-};
-enum qs_s5k4e1_cam_mode_t {
-    MODE_2D_RIGHT,
-	MODE_2D_LEFT,
-	MODE_3D,
-	MODE_INVALID
-};
-enum qs_s5k4e1_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-enum qs_s5k4e1_reg_mode {
-	QS_S5K4E1_FRAME_LENGTH_LINES_H = 1,
-	QS_S5K4E1_FRAME_LENGTH_LINES_L,
-	QS_S5K4E1_LINE_LENGTH_PCK_H,
-	QS_S5K4E1_LINE_LENGTH_PCK_L,
-};
-
-struct qs_s5k4e1_reg {
-	const struct qs_s5k4e1_i2c_reg_conf *rec_settings;
-	const unsigned short rec_size;
-	const struct qs_s5k4e1_i2c_reg_conf *reg_prev;
-	const unsigned short reg_prev_size;
-	const struct qs_s5k4e1_i2c_reg_conf *reg_snap;
-	const unsigned short reg_snap_size;
-	const struct qs_s5k4e1_i2c_reg_conf (*reg_lens)[LENS_SHADE_TABLE];
-	const unsigned short reg_lens_size;
-	const struct qs_s5k4e1_i2c_reg_conf *reg_default_lens;
-	const unsigned short reg_default_lens_size;
-	const struct qs_s5k4e1_i2c_conf_array *conf_array;
-};
-#endif /* QS_S5K4E1_H */
diff --git a/drivers/media/video/msm/qs_s5k4e1_reg.c b/drivers/media/video/msm/qs_s5k4e1_reg.c
deleted file mode 100644
index b872343..0000000
--- a/drivers/media/video/msm/qs_s5k4e1_reg.c
+++ /dev/null
@@ -1,804 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-
-#include "qs_s5k4e1.h"
-
-struct qs_s5k4e1_i2c_reg_conf qs_s5k4e1_prev_settings_3d[] = {
-	{0x0100, 0x00},
-	/*Frame Length*/
-	{0x0340, 0x04},
-	{0x0341, 0x90},
-	/*Line Length*/
-	{0x0342, 0x0A},
-	{0x0343, 0xB2},
-	{0x3030, 0x06},
-	{0x3017, 0xA4},
-	{0x301B, 0x88},
-	{0x30BC, 0x90},
-	{0x301C, 0x04},
-	{0x0202, 0x04},
-	{0x0203, 0x12},
-	{0x0204, 0x00},
-	{0x0205, 0x80},
-	{0x0306, 0x00},
-	{0x0307, 0x60},
-	{0x30B5, 0x01},
-	{0x30E2, 0x02},/*num lanes[1:0] = 1*/
-	{0x30F1, 0x60},
-/*MIPI Size Setting*/
-	{0x30A9, 0x02},
-	{0x300E, 0xE8},
-	{0x0387, 0x01},
-	{0x0344, 0x01},
-	{0x0345, 0x18},
-	{0x0348, 0x09},
-	{0x0349, 0x17},
-	{0x0346, 0x01},
-	{0x0347, 0x94},
-	{0x034A, 0x06},
-	{0x034B, 0x13},
-	{0x0380, 0x00},
-	{0x0381, 0x01},
-	{0x0382, 0x00},
-	{0x0383, 0x01},
-	{0x0384, 0x00},
-	{0x0385, 0x01},
-	{0x0386, 0x00},
-	{0x0387, 0x01},
-	{0x034C, 0x04},
-	{0x034D, 0x00},
-	{0x034E, 0x04},
-	{0x034F, 0x80},
-	{0x30BF, 0xAA},
-	{0x30C0, 0x40},
-	{0x30C8, 0x04},
-	{0x30C9, 0x00},
-};
-
-struct qs_s5k4e1_i2c_reg_conf qs_s5k4e1_prev_settings_2d[] = {
-	{0x0100, 0x00},
-	{0x0340, 0x03},
-	{0x0341, 0xe0},
-	{0x0342, 0x0A},
-	{0x0343, 0xB2},
-	{0x3030, 0x06},
-	{0x301B, 0x83},
-	{0x30BC, 0x98},
-	{0x301C, 0x04},
-	{0x0202, 0x01},
-	{0x0203, 0xFD},
-	{0x0204, 0x00},
-	{0x0205, 0x80},
-	{0x0306, 0x00},
-	{0x0307, 0x64},
-	{0x30B5, 0x00},
-	{0x30E2, 0x01},/*num lanes[1:0] = 1*/
-	{0x30F1, 0xd0},
-	{0x30A9, 0x02},
-	{0x300E, 0xEB},
-	{0x0387, 0x03},
-	{0x0344, 0x00},
-	{0x0345, 0x00},
-	{0x0348, 0x0A},
-	{0x0349, 0x2F},
-	{0x0346, 0x00},
-	{0x0347, 0x00},
-	{0x034A, 0x07},
-	{0x034B, 0xA7},
-	{0x0380, 0x00},
-	{0x0381, 0x01},
-	{0x0382, 0x00},
-	{0x0383, 0x01},
-	{0x0384, 0x00},
-	{0x0385, 0x01},
-	{0x0386, 0x00},
-	{0x0387, 0x03},
-	{0x034C, 0x05},
-	{0x034D, 0x10},
-	{0x034E, 0x03},
-	{0x034F, 0xd4},
-	{0x30BF, 0xAB},
-	{0x30C0, 0xc0},
-	{0x30C8, 0x06},
-	{0x30C9, 0x54},
-};
-
-struct qs_s5k4e1_i2c_reg_conf qs_s5k4e1_snap_settings_2d[] = {
-	{0x0100, 0x00},
-	{0x0340, 0x07},
-	{0x0341, 0xb4},
-	{0x0342, 0x0A},
-	{0x0343, 0xB2},
-	{0x3030, 0x06}, /*shut streaming off*/
-	{0x300E, 0xE8},
-	{0x301B, 0x75},
-	{0x301C, 0x04},
-	{0x30BC, 0x98},
-	{0x0202, 0x04},
-	{0x0203, 0x12},
-	{0x0204, 0x00},
-	{0x0205, 0x80},
-	{0x0306, 0x00},
-	{0x0307, 0x64},
-	{0x30B5, 0x00},
-	{0x30E2, 0x01},/*num lanes[1:0] = 1*/
-	{0x30F1, 0xd0},
-	{0x30A9, 0x03},/*Horizontal Binning Off*/
-	{0x300E, 0xE8},/*Vertical Binning Off*/
-	{0x0387, 0x01},/*y_odd_inc*/
-	{0x034C, 0x0A},/*x_output size*/
-	{0x034D, 0x30},
-	{0x034E, 0x07},/*y_output size*/
-	{0x034F, 0xA8},
-	{0x30BF, 0xAB},/*outif_enable[7], data_type[5:0](2Bh = bayer 10bit)*/
-	{0x30C0, 0x86},/*video_offset[7:4] 3260%12*/
-	{0x30C8, 0x0C},/*video_data_length 3260 = 2608 * 1.25*/
-	{0x30C9, 0xBC},
-
-};
-
-struct qs_s5k4e1_i2c_reg_conf qs_s5k4e1_snap_settings_3d[] = {
-	{0x0100, 0x00},
-
-/* Frame Length*/
-	{0x0340, 0x09},
-	{0x0341, 0x20},
-/* Line Length*/
-	{0x0342, 0x0A},
-	{0x0343, 0xB2},
-	{0x3030, 0x06},/*shut streaming off*/
-/*Analog Setting*/
-	{0x3017, 0xA4},
-	{0x301B, 0x88},
-	{0x30BC, 0x90},
-	{0x301C, 0x04},
-/*Integration setting ... */
-	{0x0202, 0x04},
-	{0x0203, 0x12},
-	{0x0204, 0x00},
-	{0x0205, 0x80},
-/*PLL setting ...*/
-	{0x0306, 0x00},
-	{0x0307, 0x60},
-	{0x30B5, 0x01},
-	{0x30E2, 0x02},/*num lanes[1:0] = 1*/
-	{0x30F1, 0x60},
-/*MIPI Size Setting*/
-	{0x30A9, 0x01},
-	{0x300E, 0xE8},
-	{0x0387, 0x01},
-	{0x0344, 0x01},/*x_addr_start*/
-	{0x0345, 0x14},
-	{0x0348, 0x09},/*x_addr_end*/
-	{0x0349, 0x17},
-	{0x0346, 0x01},/*y_addr_start*/
-	{0x0347, 0x94},
-	{0x034A, 0x06},/*y_addr_end*/
-	{0x034B, 0x13},
-	{0x0380, 0x00},/*x_even_inc 1*/
-	{0x0381, 0x01},
-	{0x0382, 0x00},/*x_odd_inc 1*/
-	{0x0383, 0x01},
-	{0x0384, 0x00},/*y_even_inc 1*/
-	{0x0385, 0x01},
-	{0x0386, 0x00},/*y_odd_inc 1*/
-	{0x0387, 0x01},
-	{0x034C, 0x08},/*x_output size*/
-	{0x034D, 0x00},
-	{0x034E, 0x04},/*y_output size*/
-	{0x034F, 0x80},
-	{0x30BF, 0xAA},/*outif_enable[7], data_type[5:0](2Bh = bayer 8bit)*/
-	{0x30C0, 0x80},/*video_offset[7:4]*/
-	{0x30C8, 0x08},/*video_data_length*/
-	{0x30C9, 0x00},
-
-};
-
-struct qs_s5k4e1_i2c_reg_conf qs_s5k4e1_recommend_settings[] = {
-	{0x0100, 0x00},
-
-	{0x3030, 0x06},/*shut streaming*/
-/*Analog Setting*/
-	{0x3000, 0x05},
-	{0x3001, 0x03},
-	{0x3002, 0x08},
-	{0x3003, 0x09},
-	{0x3004, 0x2E},
-	{0x3005, 0x06},
-	{0x3006, 0x34},
-	{0x3007, 0x00},
-	{0x3008, 0x3C},
-	{0x3009, 0x3C},
-	{0x300A, 0x28},
-	{0x300B, 0x04},
-	{0x300C, 0x0A},
-	{0x300D, 0x02},
-	{0x300F, 0x82},
-	{0x3010, 0x00},
-	{0x3011, 0x4C},
-	{0x3012, 0x30},
-	{0x3013, 0xC0},
-	{0x3014, 0x00},
-	{0x3015, 0x00},
-	{0x3016, 0x2C},
-	{0x3017, 0x94},
-	{0x3018, 0x78},
-	{0x301D, 0xD4},
-	{0x3021, 0x02},
-	{0x3022, 0x24},
-	{0x3024, 0x40},
-	{0x3027, 0x08},
-	{0x3029, 0xC6},
-	{0x302B, 0x01},
-	{0x30D8, 0x3F},
-/* ADLC setting ...*/
-	{0x3070, 0x5F},
-	{0x3071, 0x00},
-	{0x3080, 0x04},
-	{0x3081, 0x38},
-
-/*MIPI setting*/
-	{0x30BD, 0x00},/*SEL_CCP[0]*/
-	{0x3084, 0x15},/*SYNC Mode*/
-	{0x30BE, 0x1A},/*M_PCLKDIV_AUTO[4], M_DIV_PCLK[3:0]*/
-	{0x30C1, 0x01},/*pack video enable [0]*/
-	{0x30EE, 0x02},/*DPHY enable [1]*/
-	{0x3111, 0x86},/*Embedded data off [5]*/
-/*For MIPI T8 T9*/
-	{0x30E3, 0x38},
-	{0x30E4, 0x40},
-	{0x3113, 0x70},
-	{0x3114, 0x80},
-	{0x3115, 0x7B},
-	{0x3116, 0xC0},
-	{0x30EE, 0x12},
-
-/*PLL setting ...*/
-	{0x0305, 0x06},
-};
-static struct qs_s5k4e1_i2c_reg_conf qs_s5k4e1_default_lenshading_settings[] = {
-
-	{0x3200, 0x00},
-	{0x3201, 0x9a},
-	{0x3202, 0x56},
-	{0x3203, 0xf },
-	{0x3204, 0xd8},
-	{0x3205, 0x94},
-	{0x3206, 0x0 },
-	{0x3207, 0x10},
-	{0x3208, 0x71},
-	{0x3209, 0x0 },
-	{0x320a, 0x9 },
-	{0x320b, 0xc1},
-	{0x320c, 0xf },
-	{0x320d, 0xf1},
-	{0x320e, 0x3d},
-	{0x320f, 0x0 },
-	{0x3210, 0xa },
-	{0x3211, 0x93},
-	{0x3212, 0xf },
-	{0x3213, 0xc9},
-	{0x3214, 0xa1},
-	{0x3215, 0x0 },
-	{0x3216, 0x10},
-	{0x3217, 0x89},
-	{0x3218, 0xf },
-	{0x3219, 0xfb},
-	{0x321a, 0xf3},
-	{0x321b, 0xf },
-	{0x321c, 0xf8},
-	{0x321d, 0xfc},
-	{0x321e, 0x0 },
-	{0x321f, 0x4 },
-	{0x3220, 0xe3},
-	{0x3221, 0xf },
-	{0x3222, 0xfe},
-	{0x3223, 0x94},
-	{0x3224, 0x0 },
-	{0x3225, 0x24},
-	{0x3226, 0x59},
-	{0x3227, 0xf },
-	{0x3228, 0xe9},
-	{0x3229, 0x68},
-	{0x322a, 0xf },
-	{0x322b, 0xfa},
-	{0x322c, 0x7f},
-	{0x322d, 0x0 },
-	{0x322e, 0x13},
-	{0x322f, 0xe1},
-	{0x3230, 0x0 },
-	{0x3231, 0x3 },
-	{0x3232, 0xbc},
-	{0x3233, 0xf },
-	{0x3234, 0xf0},
-	{0x3235, 0xa1},
-	{0x3236, 0xf },
-	{0x3237, 0xf4},
-	{0x3238, 0xc9},
-	{0x3239, 0x0 },
-	{0x323a, 0x11},
-	{0x323b, 0x4b},
-	{0x323c, 0x0 },
-	{0x323d, 0x12},
-	{0x323e, 0xc5},
-	{0x323f, 0xf },
-	{0x3240, 0xe3},
-	{0x3241, 0xb },
-	{0x3242, 0xf },
-	{0x3243, 0xf8},
-	{0x3244, 0x4f},
-	{0x3245, 0x0 },
-	{0x3246, 0x13},
-	{0x3247, 0xac},
-	{0x3248, 0x0 },
-	{0x3249, 0x0 },
-	{0x324a, 0x7c},
-	{0x324b, 0xf },
-	{0x324c, 0xfe},
-	{0x324d, 0xdd},
-	{0x324e, 0xf },
-	{0x324f, 0xf2},
-	{0x3250, 0x96},
-	{0x3251, 0x0 },
-	{0x3252, 0x8 },
-	{0x3253, 0xef},
-	{0x3254, 0x0 },
-	{0x3255, 0x6 },
-	{0x3256, 0xa4},
-	{0x3257, 0x0 },
-	{0x3258, 0x2 },
-	{0x3259, 0x4b},
-	{0x325a, 0x0 },
-	{0x325b, 0x6 },
-	{0x325c, 0x85},
-	{0x325d, 0xf },
-	{0x325e, 0xf8},
-	{0x325f, 0x6a},
-	{0x3260, 0xf },
-	{0x3261, 0xfd},
-	{0x3262, 0x70},
-	{0x3263, 0x0 },
-	{0x3264, 0xd },
-	{0x3265, 0xa9},
-	{0x3266, 0xf },
-	{0x3267, 0xfd},
-	{0x3268, 0xf8},
-	{0x3269, 0xf },
-	{0x326a, 0xec},
-	{0x326b, 0xfc},
-	{0x326c, 0x0 },
-	{0x326d, 0xa7},
-	{0x326e, 0x5 },
-	{0x326f, 0xf },
-	{0x3270, 0xd6},
-	{0x3271, 0x19},
-	{0x3272, 0x0 },
-	{0x3273, 0xa },
-	{0x3274, 0xe8},
-	{0x3275, 0x0 },
-	{0x3276, 0x17},
-	{0x3277, 0x1 },
-	{0x3278, 0xf },
-	{0x3279, 0xe7},
-	{0x327a, 0xa0},
-	{0x327b, 0x0 },
-	{0x327c, 0xb },
-	{0x327d, 0xc3},
-	{0x327e, 0xf },
-	{0x327f, 0xc0},
-	{0x3280, 0xe3},
-	{0x3281, 0x0 },
-	{0x3282, 0x15},
-	{0x3283, 0x5a},
-	{0x3284, 0xf },
-	{0x3285, 0xf9},
-	{0x3286, 0xa0},
-	{0x3287, 0xf },
-	{0x3288, 0xf4},
-	{0x3289, 0xce},
-	{0x328a, 0x0 },
-	{0x328b, 0xb },
-	{0x328c, 0x72},
-	{0x328d, 0xf },
-	{0x328e, 0xfb},
-	{0x328f, 0xb5},
-	{0x3290, 0x0 },
-	{0x3291, 0x2f},
-	{0x3292, 0xb },
-	{0x3293, 0xf },
-	{0x3294, 0xde},
-	{0x3295, 0xc0},
-	{0x3296, 0x0 },
-	{0x3297, 0x0 },
-	{0x3298, 0x58},
-	{0x3299, 0x0 },
-	{0x329a, 0x1b},
-	{0x329b, 0x5 },
-	{0x329c, 0xf },
-	{0x329d, 0xf9},
-	{0x329e, 0x23},
-	{0x329f, 0xf },
-	{0x32a0, 0xf3},
-	{0x32a1, 0x94},
-	{0x32a2, 0xf },
-	{0x32a3, 0xe7},
-	{0x32a4, 0xc2},
-	{0x32a5, 0x0 },
-	{0x32a6, 0x1d},
-	{0x32a7, 0xe5},
-	{0x32a8, 0x0 },
-	{0x32a9, 0x5 },
-	{0x32aa, 0xaf},
-	{0x32ab, 0xf },
-	{0x32ac, 0xe3},
-	{0x32ad, 0xb7},
-	{0x32ae, 0xf },
-	{0x32af, 0xf8},
-	{0x32b0, 0x34},
-	{0x32b1, 0x0 },
-	{0x32b2, 0x1c},
-	{0x32b3, 0x3d},
-	{0x32b4, 0x0 },
-	{0x32b5, 0x10},
-	{0x32b6, 0x4a},
-	{0x32b7, 0xf },
-	{0x32b8, 0xfa},
-	{0x32b9, 0x7 },
-	{0x32ba, 0xf },
-	{0x32bb, 0xff},
-	{0x32bc, 0x16},
-	{0x32bd, 0x0 },
-	{0x32be, 0x5 },
-	{0x32bf, 0x4e},
-	{0x32c0, 0x0 },
-	{0x32c1, 0xc },
-	{0x32c2, 0x1b},
-	{0x32c3, 0xf },
-	{0x32c4, 0xf1},
-	{0x32c5, 0xdb},
-	{0x32c6, 0xf },
-	{0x32c7, 0xfc},
-	{0x32c8, 0xf8},
-	{0x32c9, 0xf },
-	{0x32ca, 0xf4},
-	{0x32cb, 0xad},
-	{0x32cc, 0xf },
-	{0x32cd, 0xfb},
-	{0x32ce, 0x59},
-	{0x32cf, 0x0 },
-	{0x32d0, 0x9 },
-	{0x32d1, 0xf7},
-	{0x32d2, 0x0 },
-	{0x32d3, 0x0 },
-	{0x32d4, 0xc1},
-	{0x32d5, 0xf },
-	{0x32d6, 0xf5},
-	{0x32d7, 0x30},
-	{0x32d8, 0x0 },
-	{0x32d9, 0x83},
-	{0x32da, 0x1d},
-	{0x32db, 0xf },
-	{0x32dc, 0xe3},
-	{0x32dd, 0x3c},
-	{0x32de, 0x0 },
-	{0x32df, 0xa },
-	{0x32e0, 0x10},
-	{0x32e1, 0x0 },
-	{0x32e2, 0x7 },
-	{0x32e3, 0x65},
-	{0x32e4, 0xf },
-	{0x32e5, 0xfe},
-	{0x32e6, 0x79},
-	{0x32e7, 0xf },
-	{0x32e8, 0xfd},
-	{0x32e9, 0x57},
-	{0x32ea, 0xf },
-	{0x32eb, 0xd6},
-	{0x32ec, 0x8f},
-	{0x32ed, 0x0 },
-	{0x32ee, 0x3 },
-	{0x32ef, 0x93},
-	{0x32f0, 0x0 },
-	{0x32f1, 0x6 },
-	{0x32f2, 0xa },
-	{0x32f3, 0xf },
-	{0x32f4, 0xfa},
-	{0x32f5, 0x6c},
-	{0x32f6, 0xf },
-	{0x32f7, 0xf1},
-	{0x32f8, 0x1e},
-	{0x32f9, 0x0 },
-	{0x32fa, 0x14},
-	{0x32fb, 0xe7},
-	{0x32fc, 0x0 },
-	{0x32fd, 0x1f},
-	{0x32fe, 0x2d},
-	{0x32ff, 0x0 },
-	{0x3300, 0x7 },
-	{0x3301, 0x5e},
-	{0x3302, 0xf },
-	{0x3303, 0xe0},
-	{0x3304, 0x55},
-	{0x3305, 0x0 },
-	{0x3306, 0x20},
-	{0x3307, 0x93},
-	{0x3308, 0x0 },
-	{0x3309, 0xf },
-	{0x330a, 0x20},
-	{0x330b, 0xf },
-	{0x330c, 0xd7},
-	{0x330d, 0xf5},
-	{0x330e, 0xf },
-	{0x330f, 0xef},
-	{0x3310, 0xb8},
-	{0x3311, 0xf },
-	{0x3312, 0xf0},
-	{0x3313, 0x29},
-	{0x3314, 0x0 },
-	{0x3315, 0x27},
-	{0x3316, 0x5e},
-	{0x3317, 0xf },
-	{0x3318, 0xda},
-	{0x3319, 0x14},
-	{0x331a, 0xf },
-	{0x331b, 0xef},
-	{0x331c, 0x93},
-	{0x331d, 0x0 },
-	{0x331e, 0x2c},
-	{0x331f, 0xdc},
-	{0x3320, 0x0 },
-	{0x3321, 0xe },
-	{0x3322, 0x2d},
-	{0x3323, 0x0 },
-	{0x3324, 0x6 },
-	{0x3325, 0xcf},
-	{0x3326, 0xf },
-	{0x3327, 0xfb},
-	{0x3328, 0x26},
-	{0x3329, 0x0 },
-	{0x332a, 0x3 },
-	{0x332b, 0x5 },
-	{0x332c, 0x0 },
-	{0x332d, 0x6 },
-	{0x332e, 0xa6},
-	{0x332f, 0xf },
-	{0x3330, 0xf7},
-	{0x3331, 0x7b},
-	{0x3332, 0xf },
-	{0x3333, 0xf9},
-	{0x3334, 0xb },
-	{0x3335, 0x0 },
-	{0x3336, 0x7 },
-	{0x3337, 0x5a},
-	{0x3338, 0xf },
-	{0x3339, 0xe4},
-	{0x333a, 0x7a},
-	{0x333b, 0x0 },
-	{0x333c, 0x1b},
-	{0x333d, 0xb0},
-	{0x333e, 0x0 },
-	{0x333f, 0x2 },
-	{0x3340, 0xa7},
-	{0x3341, 0xf },
-	{0x3342, 0xe9},
-	{0x3343, 0x3a},
-	{0x3344, 0x0 },
-	{0x3345, 0x95},
-	{0x3346, 0x42},
-	{0x3347, 0xf },
-	{0x3348, 0xda},
-	{0x3349, 0x45},
-	{0x334a, 0x0 },
-	{0x334b, 0x16},
-	{0x334c, 0x7a},
-	{0x334d, 0xf },
-	{0x334e, 0xfb},
-	{0x334f, 0x32},
-	{0x3350, 0x0 },
-	{0x3351, 0x6 },
-	{0x3352, 0x35},
-	{0x3353, 0xf },
-	{0x3354, 0xfc},
-	{0x3355, 0x8f},
-	{0x3356, 0xf },
-	{0x3357, 0xca},
-	{0x3358, 0xd5},
-	{0x3359, 0x0 },
-	{0x335a, 0x11},
-	{0x335b, 0x59},
-	{0x335c, 0xf },
-	{0x335d, 0xfa},
-	{0x335e, 0xaa},
-	{0x335f, 0xf },
-	{0x3360, 0xfe},
-	{0x3361, 0x84},
-	{0x3362, 0xf },
-	{0x3363, 0xf6},
-	{0x3364, 0x8f},
-	{0x3365, 0x0 },
-	{0x3366, 0xb },
-	{0x3367, 0x70},
-	{0x3368, 0x0 },
-	{0x3369, 0x25},
-	{0x336a, 0x83},
-	{0x336b, 0xf },
-	{0x336c, 0xe7},
-	{0x336d, 0x27},
-	{0x336e, 0xf },
-	{0x336f, 0xf1},
-	{0x3370, 0x72},
-	{0x3371, 0x0 },
-	{0x3372, 0x21},
-	{0x3373, 0x6d},
-	{0x3374, 0x0 },
-	{0x3375, 0x2 },
-	{0x3376, 0xc3},
-	{0x3377, 0xf },
-	{0x3378, 0xe8},
-	{0x3379, 0x5a},
-	{0x337a, 0xf },
-	{0x337b, 0xf2},
-	{0x337c, 0x73},
-	{0x337d, 0x0 },
-	{0x337e, 0x19},
-	{0x337f, 0xa5},
-	{0x3380, 0x0 },
-	{0x3381, 0x1a},
-	{0x3382, 0x81},
-	{0x3383, 0xf },
-	{0x3384, 0xd0},
-	{0x3385, 0x31},
-	{0x3386, 0xf },
-	{0x3387, 0xfb},
-	{0x3388, 0xff},
-	{0x3389, 0x0 },
-	{0x338a, 0x1e},
-	{0x338b, 0xe1},
-	{0x338c, 0x0 },
-	{0x338d, 0x5 },
-	{0x338e, 0xe1},
-	{0x338f, 0xf },
-	{0x3390, 0xee},
-	{0x3391, 0xe2},
-	{0x3392, 0xf },
-	{0x3393, 0xf6},
-	{0x3394, 0xcf},
-	{0x3395, 0x0 },
-	{0x3396, 0x13},
-	{0x3397, 0x8f},
-	{0x3398, 0x0 },
-	{0x3399, 0x3 },
-	{0x339a, 0x61},
-	{0x339b, 0xf },
-	{0x339c, 0xf8},
-	{0x339d, 0xf7},
-	{0x339e, 0x0 },
-	{0x339f, 0x0 },
-	{0x33a0, 0xb5},
-	{0x33a1, 0x0 },
-	{0x33a2, 0x5 },
-	{0x33a3, 0x78},
-	{0x33a4, 0xf },
-	{0x33a5, 0xf4},
-	{0x33a6, 0x5 },
-	{0x33a7, 0x0 },
-	{0x33a8, 0xc },
-	{0x33a9, 0xe },
-	{0x33aa, 0x0 },
-	{0x33ab, 0x3 },
-	{0x33ac, 0x53},
-	{0x33ad, 0xf },
-	{0x33ae, 0xec},
-	{0x33af, 0xbd},
-};
-
-const struct
-qs_s5k4e1_i2c_reg_conf qs_s5k4e1_lenshading_settings[4][LENS_SHADE_TABLE] = {
-	{/*2D Preview*/
-		{0x3097, 0x52},/*sh4ch_blk_width = 82*/
-		{0x3098, 0x3e},/*sh4ch_blk_height = 62*/
-		{0x3099, 0x03},/*sh4ch_step_x msb (sh4ch_step_x = 799)*/
-		{0x309a, 0x1f},/*sh4ch_step_x lsb*/
-		{0x309b, 0x04},/*sh4ch_step_y msb (sh4ch_step_y = 1057)*/
-		{0x309c, 0x21},/*sh4ch_step_y lsb*/
-		{0x309d, 0x00},/*sh4ch_start_blk_cnt_x = 0*/
-		{0x309e, 0x00},/*sh4ch_start_int_cnt_x = 0*/
-		{0x309f, 0x00},/*sh4ch_start_frac_cnt_x msb (0)*/
-		{0x30a0, 0x00},/*sh4ch_start_frac_cnt_x lsb*/
-		{0x30a1, 0x00},/*sh4ch_start_blk_cnt_y = 0*/
-		{0x30a2, 0x00},/*sh4ch_start_int_cnt_y = 0*/
-		{0x30a3, 0x00},/*sh4ch_start_frac_cnt_y msb (0)*/
-		{0x30a4, 0x00},/*sh4ch_start_frac_cnt_y lsb*/
-		{0x30a5, 0x01},
-		{0x30a6, 0x00},/*gs_pedestal	= 64*/
-	},
-	{/*2D Snapshot*/
-		{0x3097, 0x52},/*sh4ch_blk_width = 82*/
-		{0x3098, 0x7b},/*sh4ch_blk_height = 123*/
-		{0x3099, 0x03},/*sh4ch_step_x msb (sh4ch_step_x = 799)*/
-		{0x309a, 0x1f},/*sh4ch_step_x lsb*/
-		{0x309b, 0x02},/*sh4ch_step_y msb (sh4ch_step_y = 533)*/
-		{0x309c, 0x15},/*sh4ch_step_y lsb*/
-		{0x309d, 0x00},/*sh4ch_start_blk_cnt_x = 0*/
-		{0x309e, 0x00},/*sh4ch_start_int_cnt_x = 0*/
-		{0x309f, 0x00},/*sh4ch_start_frac_cnt_x msb (0)*/
-		{0x30a0, 0x00},/*sh4ch_start_frac_cnt_x lsb*/
-		{0x30a1, 0x00},/*sh4ch_start_blk_cnt_y = 0*/
-		{0x30a2, 0x00},/*sh4ch_start_int_cnt_y = 0*/
-		{0x30a3, 0x00},/*sh4ch_start_frac_cnt_y msb (0)*/
-		{0x30a4, 0x00},/*sh4ch_start_frac_cnt_y lsb*/
-		{0x30a5, 0x01},
-		{0x30a6, 0x00},/*gs_pedestal	= 64*/
-	},
-
-	{/*3D Preview*/
-		{0x3097, 0x52},/*sh4ch_blk_width = 82*/
-		{0x3098, 0x7b},/*sh4ch_blk_height = 123*/
-		{0x3099, 0x03},/*sh4ch_step_x msb (sh4ch_step_x = 799)*/
-		{0x309a, 0x1f},/*sh4ch_step_x lsb*/
-		{0x309b, 0x02},/*sh4ch_step_y msb (sh4ch_step_y = 533)*/
-		{0x309c, 0x15},/*sh4ch_step_y lsb*/
-		{0x309d, 0x3a},/*sh4ch_start_blk_cnt_x = 58*/
-		{0x309e, 0x01},/*sh4ch_start_int_cnt_x = 1*/
-		{0x309f, 0xb5},/*sh4ch_start_frac_cnt_x msb (46342)*/
-		{0x30a0, 0x06},/*sh4ch_start_frac_cnt_x lsb*/
-		{0x30a1, 0x23},/*sh4ch_start_blk_cnt_y = 35*/
-		{0x30a2, 0x03},/*sh4ch_start_int_cnt_y = 3*/
-		{0x30a3, 0x48},/*sh4ch_start_frac_cnt_y msb (46342)*/
-		{0x30a4, 0xdf},/*sh4ch_start_frac_cnt_y lsb*/
-		{0x30a5, 0x01},
-		{0x30a6, 0x00},/*gs_pedestal	= 64*/
-	},
-
-	{/*3D Snapshot*/
-		{0x3097, 0x52},/*sh4ch_blk_width = 82*/
-		{0x3098, 0x7b},/*sh4ch_blk_height = 123*/
-		{0x3099, 0x03},/*sh4ch_step_x msb (sh4ch_step_x = 799)*/
-		{0x309a, 0x1f},/*sh4ch_step_x lsb*/
-		{0x309b, 0x02},/*sh4ch_step_y msb (sh4ch_step_y = 533)*/
-		{0x309c, 0x15},/*sh4ch_step_y lsb*/
-		{0x309d, 0x38},/*sh4ch_start_blk_cnt_x = 56*/
-		{0x309e, 0x01},/*sh4ch_start_int_cnt_x = 1*/
-		{0x309f, 0xae},/*sh4ch_start_frac_cnt_x msb (44744)*/
-		{0x30a0, 0xc8},/*sh4ch_start_frac_cnt_x lsb*/
-		{0x30a1, 0x23},/*sh4ch_start_blk_cnt_y = 35*/
-		{0x30a2, 0x03},/*sh4ch_start_int_cnt_y = 3*/
-		{0x30a3, 0x48},/*sh4ch_start_frac_cnt_y msb (44744)*/
-		{0x30a4, 0xdf},/*sh4ch_start_frac_cnt_y lsb*/
-		{0x30a5, 0x01},
-		{0x30a6, 0x00},/*gs_pedestal	= 64*/
-	},
-
-};
-
-struct qs_s5k4e1_i2c_conf_array qs_s5k4e1_confs[] = {
-	{&qs_s5k4e1_prev_settings_2d[0], \
-		ARRAY_SIZE(qs_s5k4e1_prev_settings_2d)},
-	{&qs_s5k4e1_snap_settings_2d[0], \
-		ARRAY_SIZE(qs_s5k4e1_snap_settings_2d)},
-	{&qs_s5k4e1_prev_settings_3d[0], \
-		ARRAY_SIZE(qs_s5k4e1_prev_settings_3d)},
-	{&qs_s5k4e1_snap_settings_3d[0], \
-		ARRAY_SIZE(qs_s5k4e1_snap_settings_3d)},
-};
-struct qs_s5k4e1_reg qs_s5k4e1_regs = {
-	.rec_settings = &qs_s5k4e1_recommend_settings[0],
-	.rec_size = ARRAY_SIZE(qs_s5k4e1_recommend_settings),
-	.reg_lens = &qs_s5k4e1_lenshading_settings[0],
-	.reg_lens_size = ARRAY_SIZE(qs_s5k4e1_lenshading_settings[0]),
-	.reg_default_lens = &qs_s5k4e1_default_lenshading_settings[0],
-	.reg_default_lens_size =
-		ARRAY_SIZE(qs_s5k4e1_default_lenshading_settings),
-	.conf_array = &qs_s5k4e1_confs[0],
-};
diff --git a/drivers/media/video/msm/rawchip/DxODOP_regMap.h b/drivers/media/video/msm/rawchip/DxODOP_regMap.h
new file mode 100644
index 0000000..c98077f
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/DxODOP_regMap.h
@@ -0,0 +1,395 @@
+/* ============================================================================
+*  DxO Labs proprietary and confidential information
+*  Copyright (C) DxO Labs 1999-2011 - (All rights reserved)
+*  ============================================================================
+*
+*  The definitions listed below are available in DxODOP integration guide.
+*
+*  DxO Labs recommends the customer referring to these definitions before use.
+*
+*  These values mentioned here are related to a specific customer DxODOP configuration
+*  (RTL parameters and FW capabilities) and delivery.
+*
+*  It must not be used for any other configuration or delivery.
+*
+*  ============================================================================ */
+
+#ifndef __DxODOP_regMap_h__
+#define __DxODOP_regMap_h__
+
+#define DxODOP_boot                                                             0x6810
+#define DxODOP_execCmd                                                          0x6808
+#define DxODOP_newFrameCmd                                                      0x680c
+
+#define DxODOP_ucode_id_7_0                                                     0x0200
+#define DxODOP_ucode_id_15_8                                                    0x0201
+#define DxODOP_hw_id_7_0                                                        0x0202
+#define DxODOP_hw_id_15_8                                                       0x0203
+#define DxODOP_calib_id_0_7_0                                                   0x0204
+#define DxODOP_calib_id_1_7_0                                                   0x0205
+#define DxODOP_calib_id_2_7_0                                                   0x0206
+#define DxODOP_calib_id_3_7_0                                                   0x0207
+#define DxODOP_error_code_7_0                                                   0x0208
+#define DxODOP_visible_line_size_7_0                                            0x0209
+#define DxODOP_visible_line_size_15_8                                           0x020a
+#define DxODOP_mode_7_0                                                         0x020b
+#define DxODOP_image_orientation_7_0                                            0x020c
+#define DxODOP_x_addr_start_7_0                                                 0x020d
+#define DxODOP_x_addr_start_15_8                                                0x020e
+#define DxODOP_y_addr_start_7_0                                                 0x020f
+#define DxODOP_y_addr_start_15_8                                                0x0210
+#define DxODOP_x_addr_end_7_0                                                   0x0211
+#define DxODOP_x_addr_end_15_8                                                  0x0212
+#define DxODOP_y_addr_end_7_0                                                   0x0213
+#define DxODOP_y_addr_end_15_8                                                  0x0214
+#define DxODOP_x_odd_inc_7_0                                                    0x0217
+#define DxODOP_x_odd_inc_15_8                                                   0x0218
+#define DxODOP_y_odd_inc_7_0                                                    0x021b
+#define DxODOP_y_odd_inc_15_8                                                   0x021c
+#define DxODOP_binning_7_0                                                      0x021d
+#define DxODOP_analogue_gain_code_greenr_7_0                                    0x021e
+#define DxODOP_analogue_gain_code_greenr_15_8                                   0x021f
+#define DxODOP_analogue_gain_code_red_7_0                                       0x0220
+#define DxODOP_analogue_gain_code_red_15_8                                      0x0221
+#define DxODOP_analogue_gain_code_blue_7_0                                      0x0222
+#define DxODOP_analogue_gain_code_blue_15_8                                     0x0223
+#define DxODOP_pre_digital_gain_greenr_7_0                                      0x0224
+#define DxODOP_pre_digital_gain_greenr_15_8                                     0x0225
+#define DxODOP_pre_digital_gain_red_7_0                                         0x0226
+#define DxODOP_pre_digital_gain_red_15_8                                        0x0227
+#define DxODOP_pre_digital_gain_blue_7_0                                        0x0228
+#define DxODOP_pre_digital_gain_blue_15_8                                       0x0229
+#define DxODOP_red_green_ratio_7_0                                              0x022e
+#define DxODOP_blue_green_ratio_7_0                                             0x022f
+#define DxODOP_estimation_mode_7_0                                              0x0234
+#define DxODOP_ROI_active_number_7_0                                            0x0235
+#define DxODOP_ROI_0_x_start_7_0                                                0x0236
+#define DxODOP_ROI_0_y_start_7_0                                                0x0237
+#define DxODOP_ROI_0_x_end_7_0                                                  0x0238
+#define DxODOP_ROI_0_y_end_7_0                                                  0x0239
+#define DxODOP_ROI_1_x_start_7_0                                                0x023a
+#define DxODOP_ROI_1_y_start_7_0                                                0x023b
+#define DxODOP_ROI_1_x_end_7_0                                                  0x023c
+#define DxODOP_ROI_1_y_end_7_0                                                  0x023d
+#define DxODOP_ROI_2_x_start_7_0                                                0x023e
+#define DxODOP_ROI_2_y_start_7_0                                                0x023f
+#define DxODOP_ROI_2_x_end_7_0                                                  0x0240
+#define DxODOP_ROI_2_y_end_7_0                                                  0x0241
+#define DxODOP_ROI_3_x_start_7_0                                                0x0242
+#define DxODOP_ROI_3_y_start_7_0                                                0x0243
+#define DxODOP_ROI_3_x_end_7_0                                                  0x0244
+#define DxODOP_ROI_3_y_end_7_0                                                  0x0245
+#define DxODOP_ROI_4_x_start_7_0                                                0x0246
+#define DxODOP_ROI_4_y_start_7_0                                                0x0247
+#define DxODOP_ROI_4_x_end_7_0                                                  0x0248
+#define DxODOP_ROI_4_y_end_7_0                                                  0x0249
+#define DxODOP_sharpness_7_0                                                    0x024a
+#define DxODOP_denoising_lowGain_7_0                                            0x024b
+#define DxODOP_denoising_mediumGain_7_0                                         0x024c
+#define DxODOP_denoising_strongGain_7_0                                         0x024d
+#define DxODOP_noise_versus_details_lowGain_7_0                                 0x024e
+#define DxODOP_noise_versus_details_mediumGain_7_0                              0x024f
+#define DxODOP_noise_versus_details_strongGain_7_0                              0x0250
+#define DxODOP_temporal_smoothing_7_0                                           0x0251
+#define DxODOP_ROI_0_stats_G_7_0                                                0x0252
+#define DxODOP_ROI_0_stats_G_15_8                                               0x0253
+#define DxODOP_ROI_0_stats_G_23_16                                              0x0254
+#define DxODOP_ROI_0_stats_G_31_24                                              0x0255
+#define DxODOP_ROI_0_stats_R_7_0                                                0x0256
+#define DxODOP_ROI_0_stats_R_15_8                                               0x0257
+#define DxODOP_ROI_0_stats_R_23_16                                              0x0258
+#define DxODOP_ROI_0_stats_R_31_24                                              0x0259
+#define DxODOP_ROI_0_stats_B_7_0                                                0x025a
+#define DxODOP_ROI_0_stats_B_15_8                                               0x025b
+#define DxODOP_ROI_0_stats_B_23_16                                              0x025c
+#define DxODOP_ROI_0_stats_B_31_24                                              0x025d
+#define DxODOP_ROI_0_stats_confidence_7_0                                       0x025e
+#define DxODOP_ROI_0_stats_confidence_15_8                                      0x025f
+#define DxODOP_ROI_0_stats_confidence_23_16                                     0x0260
+#define DxODOP_ROI_0_stats_confidence_31_24                                     0x0261
+#define DxODOP_ROI_1_stats_G_7_0                                                0x0262
+#define DxODOP_ROI_1_stats_G_15_8                                               0x0263
+#define DxODOP_ROI_1_stats_G_23_16                                              0x0264
+#define DxODOP_ROI_1_stats_G_31_24                                              0x0265
+#define DxODOP_ROI_1_stats_R_7_0                                                0x0266
+#define DxODOP_ROI_1_stats_R_15_8                                               0x0267
+#define DxODOP_ROI_1_stats_R_23_16                                              0x0268
+#define DxODOP_ROI_1_stats_R_31_24                                              0x0269
+#define DxODOP_ROI_1_stats_B_7_0                                                0x026a
+#define DxODOP_ROI_1_stats_B_15_8                                               0x026b
+#define DxODOP_ROI_1_stats_B_23_16                                              0x026c
+#define DxODOP_ROI_1_stats_B_31_24                                              0x026d
+#define DxODOP_ROI_1_stats_confidence_7_0                                       0x026e
+#define DxODOP_ROI_1_stats_confidence_15_8                                      0x026f
+#define DxODOP_ROI_1_stats_confidence_23_16                                     0x0270
+#define DxODOP_ROI_1_stats_confidence_31_24                                     0x0271
+#define DxODOP_ROI_2_stats_G_7_0                                                0x0272
+#define DxODOP_ROI_2_stats_G_15_8                                               0x0273
+#define DxODOP_ROI_2_stats_G_23_16                                              0x0274
+#define DxODOP_ROI_2_stats_G_31_24                                              0x0275
+#define DxODOP_ROI_2_stats_R_7_0                                                0x0276
+#define DxODOP_ROI_2_stats_R_15_8                                               0x0277
+#define DxODOP_ROI_2_stats_R_23_16                                              0x0278
+#define DxODOP_ROI_2_stats_R_31_24                                              0x0279
+#define DxODOP_ROI_2_stats_B_7_0                                                0x027a
+#define DxODOP_ROI_2_stats_B_15_8                                               0x027b
+#define DxODOP_ROI_2_stats_B_23_16                                              0x027c
+#define DxODOP_ROI_2_stats_B_31_24                                              0x027d
+#define DxODOP_ROI_2_stats_confidence_7_0                                       0x027e
+#define DxODOP_ROI_2_stats_confidence_15_8                                      0x027f
+#define DxODOP_ROI_2_stats_confidence_23_16                                     0x0280
+#define DxODOP_ROI_2_stats_confidence_31_24                                     0x0281
+#define DxODOP_ROI_3_stats_G_7_0                                                0x0282
+#define DxODOP_ROI_3_stats_G_15_8                                               0x0283
+#define DxODOP_ROI_3_stats_G_23_16                                              0x0284
+#define DxODOP_ROI_3_stats_G_31_24                                              0x0285
+#define DxODOP_ROI_3_stats_R_7_0                                                0x0286
+#define DxODOP_ROI_3_stats_R_15_8                                               0x0287
+#define DxODOP_ROI_3_stats_R_23_16                                              0x0288
+#define DxODOP_ROI_3_stats_R_31_24                                              0x0289
+#define DxODOP_ROI_3_stats_B_7_0                                                0x028a
+#define DxODOP_ROI_3_stats_B_15_8                                               0x028b
+#define DxODOP_ROI_3_stats_B_23_16                                              0x028c
+#define DxODOP_ROI_3_stats_B_31_24                                              0x028d
+#define DxODOP_ROI_3_stats_confidence_7_0                                       0x028e
+#define DxODOP_ROI_3_stats_confidence_15_8                                      0x028f
+#define DxODOP_ROI_3_stats_confidence_23_16                                     0x0290
+#define DxODOP_ROI_3_stats_confidence_31_24                                     0x0291
+#define DxODOP_ROI_4_stats_G_7_0                                                0x0292
+#define DxODOP_ROI_4_stats_G_15_8                                               0x0293
+#define DxODOP_ROI_4_stats_G_23_16                                              0x0294
+#define DxODOP_ROI_4_stats_G_31_24                                              0x0295
+#define DxODOP_ROI_4_stats_R_7_0                                                0x0296
+#define DxODOP_ROI_4_stats_R_15_8                                               0x0297
+#define DxODOP_ROI_4_stats_R_23_16                                              0x0298
+#define DxODOP_ROI_4_stats_R_31_24                                              0x0299
+#define DxODOP_ROI_4_stats_B_7_0                                                0x029a
+#define DxODOP_ROI_4_stats_B_15_8                                               0x029b
+#define DxODOP_ROI_4_stats_B_23_16                                              0x029c
+#define DxODOP_ROI_4_stats_B_31_24                                              0x029d
+#define DxODOP_ROI_4_stats_confidence_7_0                                       0x029e
+#define DxODOP_ROI_4_stats_confidence_15_8                                      0x029f
+#define DxODOP_ROI_4_stats_confidence_23_16                                     0x02a0
+#define DxODOP_ROI_4_stats_confidence_31_24                                     0x02a1
+#define DxODOP_frame_number_7_0                                                 0x02a2
+#define DxODOP_frame_number_15_8                                                0x02a3
+
+#define DxODOP_af_strategy_7_0                              0x02a4
+#define DxODOP_mode_idle                                                        0x00
+#if 1 
+#define DxODOP_mode_still_preview                           0x01
+#define DxODOP_mode_video                                   0x02
+#define DxODOP_mode_edof_disabled                           0x04
+#define DxODOP_mode_blue_fringing_disabled                  0x08
+#define DxODOP_mode_denoising_disabled                      0x10
+#else
+#define DxODOP_mode_stillPreview                                                0x01
+#define DxODOP_mode_video                                                       0x02
+#endif
+#define DxODOP_execCmd_SettingCmd                                               0x01
+#define DxODOP_focus_strategy_CW                                                0x01
+#define DxODOP_focus_strategy_SL                                                0x02
+#define DxODOP_focus_strategy_SN                                                0x04
+#define DxODOP_focus_strategy_UF                                                0x08
+
+#if 1 
+#define DxODOP_dfltVal_ucode_id_7_0                         0x00
+#define DxODOP_dfltVal_ucode_id_15_8                        0x02
+#define DxODOP_dfltVal_hw_id_7_0                            0xed
+#define DxODOP_dfltVal_hw_id_15_8                           0xb4
+#define DxODOP_dfltVal_calib_id_0_7_0                       0x00
+#define DxODOP_dfltVal_calib_id_1_7_0                       0x00
+#define DxODOP_dfltVal_calib_id_2_7_0                       0x00
+#define DxODOP_dfltVal_calib_id_3_7_0                       0x01
+#else
+#define DxODOP_dfltVal_ucode_id_7_0                                             0x04
+#define DxODOP_dfltVal_ucode_id_15_8                                            0x01
+#define DxODOP_dfltVal_hw_id_7_0                                                0xed
+#define DxODOP_dfltVal_hw_id_15_8                                               0xb4
+#define DxODOP_dfltVal_calib_id_0_7_0                                           0x00
+#define DxODOP_dfltVal_calib_id_1_7_0                                           0x00
+#define DxODOP_dfltVal_calib_id_2_7_0                                           0x00
+#define DxODOP_dfltVal_calib_id_3_7_0                                           0x00
+#endif
+#define DxODOP_dfltVal_error_code_7_0                                           0x00
+#define DxODOP_dfltVal_visible_line_size_7_0                                    0x00
+#define DxODOP_dfltVal_visible_line_size_15_8                                   0x00
+#define DxODOP_dfltVal_mode_7_0                                                 0x00
+#define DxODOP_dfltVal_image_orientation_7_0                                    0x00
+#define DxODOP_dfltVal_x_addr_start_7_0                                         0x00
+#define DxODOP_dfltVal_x_addr_start_15_8                                        0x00
+#define DxODOP_dfltVal_y_addr_start_7_0                                         0x00
+#define DxODOP_dfltVal_y_addr_start_15_8                                        0x00
+#define DxODOP_dfltVal_x_addr_end_7_0                                           0x00
+#define DxODOP_dfltVal_x_addr_end_15_8                                          0x00
+#define DxODOP_dfltVal_y_addr_end_7_0                                           0x00
+#define DxODOP_dfltVal_y_addr_end_15_8                                          0x00
+#define DxODOP_dfltVal_x_odd_inc_7_0                                            0x00
+#define DxODOP_dfltVal_x_odd_inc_15_8                                           0x00
+#define DxODOP_dfltVal_y_odd_inc_7_0                                            0x00
+#define DxODOP_dfltVal_y_odd_inc_15_8                                           0x00
+#define DxODOP_dfltVal_binning_7_0                                              0x00
+#define DxODOP_dfltVal_analogue_gain_code_greenr_7_0                            0x00
+#define DxODOP_dfltVal_analogue_gain_code_greenr_15_8                           0x00
+#define DxODOP_dfltVal_analogue_gain_code_red_7_0                               0x00
+#define DxODOP_dfltVal_analogue_gain_code_red_15_8                              0x00
+#define DxODOP_dfltVal_analogue_gain_code_blue_7_0                              0x00
+#define DxODOP_dfltVal_analogue_gain_code_blue_15_8                             0x00
+#define DxODOP_dfltVal_pre_digital_gain_greenr_7_0                              0x00
+#define DxODOP_dfltVal_pre_digital_gain_greenr_15_8                             0x00
+#define DxODOP_dfltVal_pre_digital_gain_red_7_0                                 0x00
+#define DxODOP_dfltVal_pre_digital_gain_red_15_8                                0x00
+#define DxODOP_dfltVal_pre_digital_gain_blue_7_0                                0x00
+#define DxODOP_dfltVal_pre_digital_gain_blue_15_8                               0x00
+#define DxODOP_dfltVal_red_green_ratio_7_0                                      0x00
+#define DxODOP_dfltVal_blue_green_ratio_7_0                                     0x00
+#define DxODOP_dfltVal_estimation_mode_7_0                                      0x00
+#define DxODOP_dfltVal_ROI_active_number_7_0                                    0x00
+#define DxODOP_dfltVal_ROI_0_x_start_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_0_y_start_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_0_x_end_7_0                                          0x00
+#define DxODOP_dfltVal_ROI_0_y_end_7_0                                          0x00
+#define DxODOP_dfltVal_ROI_1_x_start_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_1_y_start_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_1_x_end_7_0                                          0x00
+#define DxODOP_dfltVal_ROI_1_y_end_7_0                                          0x00
+#define DxODOP_dfltVal_ROI_2_x_start_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_2_y_start_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_2_x_end_7_0                                          0x00
+#define DxODOP_dfltVal_ROI_2_y_end_7_0                                          0x00
+#define DxODOP_dfltVal_ROI_3_x_start_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_3_y_start_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_3_x_end_7_0                                          0x00
+#define DxODOP_dfltVal_ROI_3_y_end_7_0                                          0x00
+#define DxODOP_dfltVal_ROI_4_x_start_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_4_y_start_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_4_x_end_7_0                                          0x00
+#define DxODOP_dfltVal_ROI_4_y_end_7_0                                          0x00
+#define DxODOP_dfltVal_sharpness_7_0                                            0x80
+#define DxODOP_dfltVal_denoising_lowGain_7_0                                    0x80
+#define DxODOP_dfltVal_denoising_mediumGain_7_0                                 0x80
+#define DxODOP_dfltVal_denoising_strongGain_7_0                                 0x80
+#define DxODOP_dfltVal_noise_versus_details_lowGain_7_0                         0x80
+#define DxODOP_dfltVal_noise_versus_details_mediumGain_7_0                      0x80
+#define DxODOP_dfltVal_noise_versus_details_strongGain_7_0                      0x80
+#define DxODOP_dfltVal_temporal_smoothing_7_0                                   0x00
+#define DxODOP_dfltVal_ROI_0_stats_G_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_0_stats_G_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_0_stats_G_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_0_stats_G_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_0_stats_R_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_0_stats_R_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_0_stats_R_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_0_stats_R_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_0_stats_B_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_0_stats_B_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_0_stats_B_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_0_stats_B_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_0_stats_confidence_7_0                               0x00
+#define DxODOP_dfltVal_ROI_0_stats_confidence_15_8                              0x00
+#define DxODOP_dfltVal_ROI_0_stats_confidence_23_16                             0x00
+#define DxODOP_dfltVal_ROI_0_stats_confidence_31_24                             0x00
+#define DxODOP_dfltVal_ROI_1_stats_G_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_1_stats_G_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_1_stats_G_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_1_stats_G_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_1_stats_R_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_1_stats_R_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_1_stats_R_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_1_stats_R_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_1_stats_B_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_1_stats_B_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_1_stats_B_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_1_stats_B_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_1_stats_confidence_7_0                               0x00
+#define DxODOP_dfltVal_ROI_1_stats_confidence_15_8                              0x00
+#define DxODOP_dfltVal_ROI_1_stats_confidence_23_16                             0x00
+#define DxODOP_dfltVal_ROI_1_stats_confidence_31_24                             0x00
+#define DxODOP_dfltVal_ROI_2_stats_G_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_2_stats_G_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_2_stats_G_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_2_stats_G_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_2_stats_R_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_2_stats_R_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_2_stats_R_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_2_stats_R_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_2_stats_B_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_2_stats_B_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_2_stats_B_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_2_stats_B_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_2_stats_confidence_7_0                               0x00
+#define DxODOP_dfltVal_ROI_2_stats_confidence_15_8                              0x00
+#define DxODOP_dfltVal_ROI_2_stats_confidence_23_16                             0x00
+#define DxODOP_dfltVal_ROI_2_stats_confidence_31_24                             0x00
+#define DxODOP_dfltVal_ROI_3_stats_G_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_3_stats_G_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_3_stats_G_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_3_stats_G_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_3_stats_R_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_3_stats_R_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_3_stats_R_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_3_stats_R_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_3_stats_B_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_3_stats_B_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_3_stats_B_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_3_stats_B_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_3_stats_confidence_7_0                               0x00
+#define DxODOP_dfltVal_ROI_3_stats_confidence_15_8                              0x00
+#define DxODOP_dfltVal_ROI_3_stats_confidence_23_16                             0x00
+#define DxODOP_dfltVal_ROI_3_stats_confidence_31_24                             0x00
+#define DxODOP_dfltVal_ROI_4_stats_G_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_4_stats_G_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_4_stats_G_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_4_stats_G_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_4_stats_R_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_4_stats_R_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_4_stats_R_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_4_stats_R_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_4_stats_B_7_0                                        0x00
+#define DxODOP_dfltVal_ROI_4_stats_B_15_8                                       0x00
+#define DxODOP_dfltVal_ROI_4_stats_B_23_16                                      0x00
+#define DxODOP_dfltVal_ROI_4_stats_B_31_24                                      0x00
+#define DxODOP_dfltVal_ROI_4_stats_confidence_7_0                               0x00
+#define DxODOP_dfltVal_ROI_4_stats_confidence_15_8                              0x00
+#define DxODOP_dfltVal_ROI_4_stats_confidence_23_16                             0x00
+#define DxODOP_dfltVal_ROI_4_stats_confidence_31_24                             0x00
+#define DxODOP_dfltVal_frame_number_7_0                                         0xff
+#define DxODOP_dfltVal_frame_number_15_8                                        0xff
+#if 1 
+#define DxODOP_dfltVal_af_strategy_7_0                      0x11
+#endif
+
+#define DxODOP_error_code_ok                                                    0x00
+#define DxODOP_error_code_bad_hw_id                                             0x01
+#define DxODOP_error_code_bad_calib_data                                        0x02
+#define DxODOP_error_code_setting_not_ready                                     0x03
+#define DxODOP_error_code_no_matching_setting                                   0x04
+#define DxODOP_error_code_invalid_cmd                                           0x05
+#define DxODOP_error_code_invalid_mode                                          0x06
+#define DxODOP_error_code_y_addr_start_too_large                                0x08
+#define DxODOP_error_code_y_addr_end_too_large                                  0x0a
+#define DxODOP_error_code_y_addr_end_even                                       0x0e
+#define DxODOP_error_code_y_boundaries_order                                    0x10
+#define DxODOP_error_code_y_odd_inc_too_large                                   0x12
+#define DxODOP_error_code_y_odd_inc_even                                        0x14
+#define DxODOP_error_code_invalid_binning                                       0x1c
+#define DxODOP_error_code_invalid_orientation                                   0x1d
+#define DxODOP_error_code_invalid_analogue_gain_code                            0x1e
+#define DxODOP_error_code_invalid_analogue_gain_code_greenR                     0x1f
+#define DxODOP_error_code_invalid_analogue_gain_code_red                        0x20
+#define DxODOP_error_code_invalid_analogue_gain_code_blue                       0x21
+#define DxODOP_error_code_invalid_digital_gain_greenR                           0x22
+#define DxODOP_error_code_invalid_digital_gain_red                              0x23
+#define DxODOP_error_code_invalid_digital_gain_blue                             0x24
+#define DxODOP_error_code_invalid_estimation_mode                               0x25
+#define DxODOP_error_code_red_green_ratio_too_low                               0x26
+#define DxODOP_error_code_blue_green_ratio_too_low                              0x27
+#define DxODOP_error_code_ROI_number_too_large                                  0x29
+#define DxODOP_error_code_ROI_x_start_too_large                                 0x2a
+#define DxODOP_error_code_ROI_y_start_too_large                                 0x2b
+#define DxODOP_error_code_ROI_x_end_too_large                                   0x2c
+#define DxODOP_error_code_ROI_y_end_too_large                                   0x2d
+#define DxODOP_error_code_ROI_x_order                                           0x2e
+#define DxODOP_error_code_ROI_y_order                                           0x2f
+
+#endif 
diff --git a/drivers/media/video/msm/rawchip/DxODPP_regMap.h b/drivers/media/video/msm/rawchip/DxODPP_regMap.h
new file mode 100644
index 0000000..b1d902b
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/DxODPP_regMap.h
@@ -0,0 +1,156 @@
+/* ============================================================================
+*  DxO Labs proprietary and confidential information
+*  Copyright (C) DxO Labs 1999-2011 - (All rights reserved)
+*  ============================================================================
+*
+*  The definitions listed below are available in DxODPP integration guide.
+*
+*  DxO Labs recommends the customer referring to these definitions before use.
+*
+*  These values mentioned here are related to a specific customer DxODPP configuration
+*  (RTL parameters and FW capabilities) and delivery.
+*
+*  It must not be used for any other configuration or delivery.
+*
+*  ============================================================================ */
+
+#ifndef __DxODPP_regMap_h__
+#define __DxODPP_regMap_h__
+
+#define DxODPP_boot                                                             0xd010
+#define DxODPP_execCmd                                                          0xd008
+#define DxODPP_newFrameCmd                                                      0xd00c
+
+#define DxODPP_ucode_id_7_0                                                     0x0200
+#define DxODPP_ucode_id_15_8                                                    0x0201
+#define DxODPP_hw_id_7_0                                                        0x0202
+#define DxODPP_hw_id_15_8                                                       0x0203
+#define DxODPP_calib_id_0_7_0                                                   0x0204
+#define DxODPP_calib_id_1_7_0                                                   0x0205
+#define DxODPP_calib_id_2_7_0                                                   0x0206
+#define DxODPP_calib_id_3_7_0                                                   0x0207
+#define DxODPP_error_code_7_0                                                   0x0208
+#define DxODPP_visible_line_size_7_0                                            0x0209
+#define DxODPP_visible_line_size_15_8                                           0x020a
+#define DxODPP_mode_7_0                                                         0x020b
+#define DxODPP_image_orientation_7_0                                            0x020c
+#define DxODPP_x_addr_start_7_0                                                 0x020d
+#define DxODPP_x_addr_start_15_8                                                0x020e
+#define DxODPP_y_addr_start_7_0                                                 0x020f
+#define DxODPP_y_addr_start_15_8                                                0x0210
+#define DxODPP_x_addr_end_7_0                                                   0x0211
+#define DxODPP_x_addr_end_15_8                                                  0x0212
+#define DxODPP_y_addr_end_7_0                                                   0x0213
+#define DxODPP_y_addr_end_15_8                                                  0x0214
+#define DxODPP_x_even_inc_7_0                                                   0x0215
+#define DxODPP_x_even_inc_15_8                                                  0x0216
+#define DxODPP_x_odd_inc_7_0                                                    0x0217
+#define DxODPP_x_odd_inc_15_8                                                   0x0218
+#define DxODPP_y_even_inc_7_0                                                   0x0219
+#define DxODPP_y_even_inc_15_8                                                  0x021a
+#define DxODPP_y_odd_inc_7_0                                                    0x021b
+#define DxODPP_y_odd_inc_15_8                                                   0x021c
+#define DxODPP_analogue_gain_code_greenr_7_0                                    0x021e
+#define DxODPP_analogue_gain_code_greenr_15_8                                   0x021f
+#define DxODPP_pre_digital_gain_greenr_7_0                                      0x0224
+#define DxODPP_pre_digital_gain_greenr_15_8                                     0x0225
+#define DxODPP_exposure_time_7_0                                                0x022a
+#define DxODPP_exposure_time_15_8                                               0x022b
+#define DxODPP_temporal_smoothing_7_0                                           0x022e
+#define DxODPP_flash_preflash_ratio_7_0                                         0x022f
+#define DxODPP_flash_preflash_ratio_15_8                                        0x0230
+#define DxODPP_focal_info_7_0                                                   0x0231
+#define DxODPP_frame_number_7_0                                                 0x0232
+#define DxODPP_frame_number_15_8                                                0x0233
+#define DxODPP_last_estimation_frame_number_7_0                                 0x0234
+#define DxODPP_last_estimation_frame_number_15_8                                0x0235
+
+#define DxODPP_execCmd_SettingCmd                                               0x01
+#define DxODPP_mode_cls_msk                                                     0x01
+#define DxODPP_mode_grGb_msk                                                    0x02
+#define DxODPP_mode_unused_bit5                                                 0x20
+#define DxODPP_mode_unused_bit6                                                 0x40
+#define DxODPP_mode_preFlash                                                    0x08
+#define DxODPP_mode_flash                                                       0x10
+#define DxODPP_mode_restartEstim                                                0x80
+
+#if 1 
+#define DxODPP_dfltVal_ucode_id_7_0                         0x07
+#define DxODPP_dfltVal_ucode_id_15_8                        0x01
+#define DxODPP_dfltVal_hw_id_7_0                            0xe8
+#define DxODPP_dfltVal_hw_id_15_8                           0xeb
+#define DxODPP_dfltVal_calib_id_0_7_0                       0x00
+#define DxODPP_dfltVal_calib_id_1_7_0                       0x00
+#define DxODPP_dfltVal_calib_id_2_7_0                       0x00
+#define DxODPP_dfltVal_calib_id_3_7_0                       0x01
+#else
+#define DxODPP_dfltVal_ucode_id_7_0                                             0x04
+#define DxODPP_dfltVal_ucode_id_15_8                                            0x01
+#define DxODPP_dfltVal_hw_id_7_0                                                0xe8
+#define DxODPP_dfltVal_hw_id_15_8                                               0xeb
+#define DxODPP_dfltVal_calib_id_0_7_0                                           0x00
+#define DxODPP_dfltVal_calib_id_1_7_0                                           0x00
+#define DxODPP_dfltVal_calib_id_2_7_0                                           0x00
+#define DxODPP_dfltVal_calib_id_3_7_0                                           0x00
+#endif
+#define DxODPP_dfltVal_error_code_7_0                                           0x00
+#define DxODPP_dfltVal_visible_line_size_7_0                                    0x00
+#define DxODPP_dfltVal_visible_line_size_15_8                                   0x00
+#define DxODPP_dfltVal_mode_7_0                                                 0x00
+#define DxODPP_dfltVal_image_orientation_7_0                                    0x00
+#define DxODPP_dfltVal_x_addr_start_7_0                                         0x00
+#define DxODPP_dfltVal_x_addr_start_15_8                                        0x00
+#define DxODPP_dfltVal_y_addr_start_7_0                                         0x00
+#define DxODPP_dfltVal_y_addr_start_15_8                                        0x00
+#define DxODPP_dfltVal_x_addr_end_7_0                                           0x00
+#define DxODPP_dfltVal_x_addr_end_15_8                                          0x00
+#define DxODPP_dfltVal_y_addr_end_7_0                                           0x00
+#define DxODPP_dfltVal_y_addr_end_15_8                                          0x00
+#define DxODPP_dfltVal_x_even_inc_7_0                                           0x00
+#define DxODPP_dfltVal_x_even_inc_15_8                                          0x00
+#define DxODPP_dfltVal_x_odd_inc_7_0                                            0x00
+#define DxODPP_dfltVal_x_odd_inc_15_8                                           0x00
+#define DxODPP_dfltVal_y_even_inc_7_0                                           0x00
+#define DxODPP_dfltVal_y_even_inc_15_8                                          0x00
+#define DxODPP_dfltVal_y_odd_inc_7_0                                            0x00
+#define DxODPP_dfltVal_y_odd_inc_15_8                                           0x00
+#define DxODPP_dfltVal_analogue_gain_code_greenr_7_0                            0x00
+#define DxODPP_dfltVal_analogue_gain_code_greenr_15_8                           0x00
+#define DxODPP_dfltVal_pre_digital_gain_greenr_7_0                              0x00
+#define DxODPP_dfltVal_pre_digital_gain_greenr_15_8                             0x00
+#define DxODPP_dfltVal_exposure_time_7_0                                        0x00
+#define DxODPP_dfltVal_exposure_time_15_8                                       0x00
+#define DxODPP_dfltVal_temporal_smoothing_7_0                                   0x00
+#define DxODPP_dfltVal_flash_preflash_ratio_7_0                                 0x00
+#define DxODPP_dfltVal_flash_preflash_ratio_15_8                                0x00
+#define DxODPP_dfltVal_focal_info_7_0                                           0x00
+#define DxODPP_dfltVal_frame_number_7_0                                         0xff
+#define DxODPP_dfltVal_frame_number_15_8                                        0xff
+#define DxODPP_dfltVal_last_estimation_frame_number_7_0                         0xff
+#define DxODPP_dfltVal_last_estimation_frame_number_15_8                        0xff
+
+#define DxODPP_error_code_ok                                                    0x00
+#define DxODPP_error_code_bad_hw_id                                             0x01
+#define DxODPP_error_code_bad_calib_data                                        0x02
+#define DxODPP_error_code_setting_not_ready                                     0x03
+#define DxODPP_error_code_no_matching_setting                                   0x04
+#define DxODPP_error_code_invalid_cmd                                           0x05
+#define DxODPP_error_code_invalid_mode                                          0x06
+#define DxODPP_error_code_y_addr_start_too_large                                0x08
+#define DxODPP_error_code_y_addr_end_too_large                                  0x0a
+#define DxODPP_error_code_y_addr_start_odd                                      0x0c
+#define DxODPP_error_code_y_addr_end_even                                       0x0e
+#define DxODPP_error_code_y_boundaries_order                                    0x10
+#define DxODPP_error_code_y_odd_inc_too_large                                   0x12
+#if 1 
+#define DxODPP_error_code_y_odd_inc_even                    0x14
+#endif
+#define DxODPP_error_code_x_decim_unsupported                                   0x15
+#define DxODPP_error_code_y_decim_unsupported                                   0x16
+#if 1 
+#define DxODPP_error_code_y_even_inc_even                   0x18
+#endif
+#define DxODPP_error_code_y_even_inc_too_large                                  0x1a
+#define DxODPP_error_code_temporal_smoothing_too_large                          0x1b
+
+#endif 
diff --git a/drivers/media/video/msm/rawchip/DxOPDP_regMap.h b/drivers/media/video/msm/rawchip/DxOPDP_regMap.h
new file mode 100644
index 0000000..eee7ab3
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/DxOPDP_regMap.h
@@ -0,0 +1,149 @@
+/* ============================================================================
+*  DxO Labs proprietary and confidential information
+*  Copyright (C) DxO Labs 1999-2011 - (All rights reserved)
+*  ============================================================================
+*
+*  The definitions listed below are available in DxOPDP integration guide.
+*
+*  DxO Labs recommends the customer referring to these definitions before use.
+*
+*  These values mentioned here are related to a specific customer DxOPDP configuration
+*  (RTL parameters and FW capabilities) and delivery.
+*
+*  It must not be used for any other configuration or delivery.
+*
+*  ============================================================================ */
+
+#ifndef __DxOPDP_regMap_h__
+#define __DxOPDP_regMap_h__
+
+#define DxOPDP_boot                                                             0x1a10
+#define DxOPDP_execCmd                                                          0x1a08
+#define DxOPDP_newFrameCmd                                                      0x1a0c
+
+#define DxOPDP_ucode_id_7_0                                                     0x0200
+#define DxOPDP_ucode_id_15_8                                                    0x0201
+#define DxOPDP_hw_id_7_0                                                        0x0202
+#define DxOPDP_hw_id_15_8                                                       0x0203
+#define DxOPDP_calib_id_0_7_0                                                   0x0204
+#define DxOPDP_calib_id_1_7_0                                                   0x0205
+#define DxOPDP_calib_id_2_7_0                                                   0x0206
+#define DxOPDP_calib_id_3_7_0                                                   0x0207
+#define DxOPDP_error_code_7_0                                                   0x0208
+#define DxOPDP_visible_line_size_7_0                                            0x0209
+#define DxOPDP_visible_line_size_15_8                                           0x020a
+#define DxOPDP_mode_7_0                                                         0x020b
+#define DxOPDP_image_orientation_7_0                                            0x020c
+#define DxOPDP_x_addr_start_7_0                                                 0x020d
+#define DxOPDP_x_addr_start_15_8                                                0x020e
+#define DxOPDP_y_addr_start_7_0                                                 0x020f
+#define DxOPDP_y_addr_start_15_8                                                0x0210
+#define DxOPDP_x_addr_end_7_0                                                   0x0211
+#define DxOPDP_x_addr_end_15_8                                                  0x0212
+#define DxOPDP_y_addr_end_7_0                                                   0x0213
+#define DxOPDP_y_addr_end_15_8                                                  0x0214
+#define DxOPDP_x_odd_inc_7_0                                                    0x0217
+#define DxOPDP_x_odd_inc_15_8                                                   0x0218
+#define DxOPDP_y_odd_inc_7_0                                                    0x021b
+#define DxOPDP_y_odd_inc_15_8                                                   0x021c
+#define DxOPDP_binning_7_0                                                      0x021d
+#define DxOPDP_analogue_gain_code_greenr_7_0                                    0x021e
+#define DxOPDP_analogue_gain_code_greenr_15_8                                   0x021f
+#define DxOPDP_analogue_gain_code_red_7_0                                       0x0220
+#define DxOPDP_analogue_gain_code_red_15_8                                      0x0221
+#define DxOPDP_analogue_gain_code_blue_7_0                                      0x0222
+#define DxOPDP_analogue_gain_code_blue_15_8                                     0x0223
+#define DxOPDP_pre_digital_gain_greenr_7_0                                      0x0224
+#define DxOPDP_pre_digital_gain_greenr_15_8                                     0x0225
+#define DxOPDP_pre_digital_gain_red_7_0                                         0x0226
+#define DxOPDP_pre_digital_gain_red_15_8                                        0x0227
+#define DxOPDP_pre_digital_gain_blue_7_0                                        0x0228
+#define DxOPDP_pre_digital_gain_blue_15_8                                       0x0229
+#define DxOPDP_exposure_time_7_0                                                0x022a
+#define DxOPDP_exposure_time_15_8                                               0x022b
+#define DxOPDP_dead_pixels_correction_lowGain_7_0                               0x022e
+#define DxOPDP_dead_pixels_correction_mediumGain_7_0                            0x022f
+#define DxOPDP_dead_pixels_correction_strongGain_7_0                            0x0230
+#define DxOPDP_frame_number_7_0                                                 0x0231
+#define DxOPDP_frame_number_15_8                                                0x0232
+
+#define DxOPDP_execCmd_SettingCmd                                               0x01
+#define DxOPDP_mode_features_enabled                                            0x01
+#define DxOPDP_mode_black_point_disabled                                        0x08
+#define DxOPDP_mode_dead_pixels_disabled                                        0x10
+#define DxOPDP_mode_phase_repair_disabled                                       0x20
+
+#if 1 
+#define DxOPDP_dfltVal_ucode_id_7_0                                             0x07
+#define DxOPDP_dfltVal_ucode_id_15_8                                            0x01
+#define DxOPDP_dfltVal_hw_id_7_0                                                0x5b
+#define DxOPDP_dfltVal_hw_id_15_8                                               0xe6
+#define DxOPDP_dfltVal_calib_id_0_7_0                                           0x00
+#define DxOPDP_dfltVal_calib_id_1_7_0                                           0x00
+#define DxOPDP_dfltVal_calib_id_2_7_0                                           0x00
+#define DxOPDP_dfltVal_calib_id_3_7_0                                           0x01
+#else
+#define DxOPDP_dfltVal_ucode_id_7_0                                             0x04
+#define DxOPDP_dfltVal_ucode_id_15_8                                            0x01
+#define DxOPDP_dfltVal_hw_id_7_0                                                0x5b
+#define DxOPDP_dfltVal_hw_id_15_8                                               0xe6
+#define DxOPDP_dfltVal_calib_id_0_7_0                                           0x00
+#define DxOPDP_dfltVal_calib_id_1_7_0                                           0x00
+#define DxOPDP_dfltVal_calib_id_2_7_0                                           0x00
+#define DxOPDP_dfltVal_calib_id_3_7_0                                           0x00
+#endif
+#define DxOPDP_dfltVal_error_code_7_0                                           0x00
+#define DxOPDP_dfltVal_visible_line_size_7_0                                    0x00
+#define DxOPDP_dfltVal_visible_line_size_15_8                                   0x00
+#define DxOPDP_dfltVal_mode_7_0                                                 0x00
+#define DxOPDP_dfltVal_image_orientation_7_0                                    0x00
+#define DxOPDP_dfltVal_x_addr_start_7_0                                         0x00
+#define DxOPDP_dfltVal_x_addr_start_15_8                                        0x00
+#define DxOPDP_dfltVal_y_addr_start_7_0                                         0x00
+#define DxOPDP_dfltVal_y_addr_start_15_8                                        0x00
+#define DxOPDP_dfltVal_x_addr_end_7_0                                           0x00
+#define DxOPDP_dfltVal_x_addr_end_15_8                                          0x00
+#define DxOPDP_dfltVal_y_addr_end_7_0                                           0x00
+#define DxOPDP_dfltVal_y_addr_end_15_8                                          0x00
+#define DxOPDP_dfltVal_x_odd_inc_7_0                                            0x00
+#define DxOPDP_dfltVal_x_odd_inc_15_8                                           0x00
+#define DxOPDP_dfltVal_y_odd_inc_7_0                                            0x00
+#define DxOPDP_dfltVal_y_odd_inc_15_8                                           0x00
+#define DxOPDP_dfltVal_binning_7_0                                              0x00
+#define DxOPDP_dfltVal_analogue_gain_code_greenr_7_0                            0x00
+#define DxOPDP_dfltVal_analogue_gain_code_greenr_15_8                           0x00
+#define DxOPDP_dfltVal_analogue_gain_code_red_7_0                               0x00
+#define DxOPDP_dfltVal_analogue_gain_code_red_15_8                              0x00
+#define DxOPDP_dfltVal_analogue_gain_code_blue_7_0                              0x00
+#define DxOPDP_dfltVal_analogue_gain_code_blue_15_8                             0x00
+#define DxOPDP_dfltVal_pre_digital_gain_greenr_7_0                              0x00
+#define DxOPDP_dfltVal_pre_digital_gain_greenr_15_8                             0x00
+#define DxOPDP_dfltVal_pre_digital_gain_red_7_0                                 0x00
+#define DxOPDP_dfltVal_pre_digital_gain_red_15_8                                0x00
+#define DxOPDP_dfltVal_pre_digital_gain_blue_7_0                                0x00
+#define DxOPDP_dfltVal_pre_digital_gain_blue_15_8                               0x00
+#define DxOPDP_dfltVal_exposure_time_7_0                                        0x00
+#define DxOPDP_dfltVal_exposure_time_15_8                                       0x00
+#define DxOPDP_dfltVal_dead_pixels_correction_lowGain_7_0                       0x80
+#define DxOPDP_dfltVal_dead_pixels_correction_mediumGain_7_0                    0x80
+#define DxOPDP_dfltVal_dead_pixels_correction_strongGain_7_0                    0x80
+#define DxOPDP_dfltVal_frame_number_7_0                                         0xff
+#define DxOPDP_dfltVal_frame_number_15_8                                        0xff
+
+#define DxOPDP_error_code_ok                                                    0x00
+#define DxOPDP_error_code_bad_hw_id                                             0x01
+#define DxOPDP_error_code_bad_calib_data                                        0x02
+#define DxOPDP_error_code_setting_not_ready                                     0x03
+#define DxOPDP_error_code_no_matching_setting                                   0x04
+#define DxOPDP_error_code_y_addr_end_too_large                                  0x0a
+#define DxOPDP_error_code_y_addr_start_odd                                      0x0c
+#define DxOPDP_error_code_y_addr_end_even                                       0x0e
+#define DxOPDP_error_code_y_boundaries_order                                    0x10
+#define DxOPDP_error_code_y_odd_inc_too_large                                   0x12
+#define DxOPDP_error_code_y_odd_inc_even                                        0x14
+#define DxOPDP_error_code_y_even_inc_even                                       0x18
+#define DxOPDP_error_code_invalid_binning                                       0x1c
+#define DxOPDP_error_code_invalid_orientation                                   0x1d
+#define DxOPDP_error_code_invalid_analogue_gain_code_greenR                     0x1f
+
+#endif 
diff --git a/drivers/media/video/msm/rawchip/Makefile b/drivers/media/video/msm/rawchip/Makefile
new file mode 100644
index 0000000..2bee243
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/Makefile
@@ -0,0 +1,3 @@
+GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
+obj-$(CONFIG_RAWCHIP) += rawchip_spi.o rawchip.o Yushan_API.o Yushan_Platform_Specific.o Yushan_HTC_Functions.o
+obj-$(CONFIG_RAWCHIP) += yushan_reg.o yushan_u_code_r2.o yushan_u_code_r3.o yushan_reg_s5k3h2yx.o yushan_reg_imx175.o yushan_reg_ov8838.o yushan_reg_ar0260.o yushan_reg_ov2722.o yushan_reg_ov5693.o yushan_reg_s5k6a2ya.o
diff --git a/drivers/media/video/msm/rawchip/Yushan_API.c b/drivers/media/video/msm/rawchip/Yushan_API.c
new file mode 100644
index 0000000..8fc6ac3
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/Yushan_API.c
@@ -0,0 +1,2647 @@
+
+#include "Yushan_API.h"
+#include "Yushan_Platform_Specific.h"
+
+
+
+
+bool_t	gPllLocked;
+
+
+bool_t	Yushan_Init_LDO(bool_t	bUseExternalLDO)
+{
+	bool_t		fStatus = SUCCESS;
+	uint8_t		bSpiReadData = 0, bLDOTrimValue = 0, bSpiData = 0;
+	uint16_t	uwCount = 500;	
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	
+	SPI_Read(YUSHAN_IOR_NVM_STATUS, 1, (uint8_t *)(&bSpiReadData));
+	while (bSpiReadData != 1) {
+		
+		SPI_Read(YUSHAN_IOR_NVM_STATUS, 1, (uint8_t *)(&bSpiReadData));
+		
+		uwCount--;
+		if (!uwCount)
+			break;	
+	}
+
+	
+	if (bSpiReadData == 1) {
+		
+		SPI_Read(YUSHAN_IOR_NVM_DATA_WORD_3, 1, (uint8_t *)(&bLDOTrimValue));
+		if (bLDOTrimValue>>3 == 1)				
+			bLDOTrimValue &= 0xF7;
+		else {
+			
+			bLDOTrimValue = 0;
+			SPI_Read(YUSHAN_IOR_NVM_DATA_WORD_2 + 3, 1, (uint8_t *)(&bLDOTrimValue));
+			if (bLDOTrimValue>>3 == 1)			
+				bLDOTrimValue &= 0xF7;
+			else							
+				bLDOTrimValue = 0 ;			
+		}
+
+		
+		SPI_Write(YUSHAN_PRIVATE_TEST_LDO_NVM_CTRL, 1, (uint8_t *)(&bLDOTrimValue));
+
+		
+		bSpiReadData = 0;
+		SPI_Read(YUSHAN_PRIVATE_TEST_LDO_CTRL,  1, (uint8_t *)(&bSpiReadData));
+		bSpiData = bSpiReadData;
+
+		DEBUGLOG("[CAM] %s: Yushan bUseExternalLDO = %d\n", __func__, bUseExternalLDO);
+		if(!bUseExternalLDO) {
+			
+			bSpiData = (bSpiData&0xF7);			
+			SPI_Write(YUSHAN_PRIVATE_TEST_LDO_CTRL,  1, (uint8_t *)(&bSpiData));
+			bSpiData = (bSpiData&0xFE);			
+			SPI_Write(YUSHAN_PRIVATE_TEST_LDO_CTRL,  1, (uint8_t *)(&bSpiData));
+			bSpiData = (bSpiData&0xFD);			
+			SPI_Write(YUSHAN_PRIVATE_TEST_LDO_CTRL,  1, (uint8_t *)(&bSpiData));
+		} else {
+			
+			bSpiData |= 0x04;
+			SPI_Write(YUSHAN_PRIVATE_TEST_LDO_CTRL,  1, (uint8_t *)(&bSpiData));
+		}
+
+		
+		DEBUGLOG("[CAM] %s: Waiting for EVENT_LDO_STABLE Interrupt\n", __func__);
+		fStatus &= Yushan_WaitForInterruptEvent(EVENT_LDO_STABLE, TIME_100MS);
+
+		if (!fStatus) {
+			ERRORLOG("[CAM] %s:LDO Interrupt Failed\n", __func__);
+			VERBOSELOG("[CAM] %s: End with Failure\n", __func__);
+			return FAILURE;
+		} else {
+			DEBUGLOG("[CAM] %s:LDO Interrupt received\n", __func__);
+		}
+
+	} else {
+		ERRORLOG("[CAM] %s:NVM is not Ready for Read operation\n", __func__);
+		VERBOSELOG("[CAM] %s: End\n", __func__);
+		return FAILURE;
+	}
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return SUCCESS;
+
+}
+
+
+
+bool_t Yushan_Init_Clocks(Yushan_Init_Struct_t *sInitStruct, Yushan_SystemStatus_t *sSystemStatus, uint32_t	*udwIntrMask)
+{
+
+	uint32_t		fpTargetPll_Clk, fpSys_Clk, fpPixel_Clk, fpDxo_Clk, fpIdp_Clk, fpDxoClockLow;		
+	uint32_t		fpSysClk_Div, fpIdpClk_div, fpDxoClk_Div, fpTempVar;				
+
+	uint32_t		udwSpiData = 0;
+	uint8_t			bRx_PixelWidth, bTx_PixelWidth;
+	int8_t			bCount;
+	uint8_t			fStatus = SUCCESS, fDXOStatus = DXO_NO_ERR;
+	uint8_t			bSpiData;
+	uint32_t 		udwFullLine, udwFullFrame, udwFrameBlank;
+
+	
+	
+
+	
+	
+	uint32_t		fpDividers[] = {0x10000, 0x18000, 0x20000, 0x28000, 0x30000, 0x38000, 0x40000, 0x48000, 0x50000, 0x58000, 0x60000,	\
+										0x68000, 0x70000, 0x78000, 0x80000, 0xA0000};
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	
+	DEBUGLOG("[CAM] %s:Switching to Host clock while evaluating different clock dividers\n", __func__);
+	bSpiData = 0x00;
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+1, 1, (uint8_t *)(&bSpiData)); 
+	bSpiData = 0x02;
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+1, 1, (uint8_t *)(&bSpiData)); 
+	bSpiData = 0x19;
+	fStatus &= SPI_Write(YUSHAN_PLL_CTRL_MAIN, 1, (uint8_t *)(&bSpiData));	
+	
+	bRx_PixelWidth = bTx_PixelWidth = (sInitStruct->uwPixelFormat) & (0x000F);
+
+	
+	fpTargetPll_Clk = Yushan_ConvertTo16p16FP((uint16_t)sInitStruct->uwBitRate);
+	
+	fpTargetPll_Clk = Yushan_Compute_Pll_Divs(sInitStruct->fpExternalClock, fpTargetPll_Clk);
+	if (!fpTargetPll_Clk) {
+		ERRORLOG("[CAM] %s:Wrong PLL Clk calculated. Returning", __func__);
+		VERBOSELOG("[CAM] %s: End\n", __func__);
+		return FAILURE;
+	}
+
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	fpIdpClk_div = (Yushan_ConvertTo16p16FP(bTx_PixelWidth)/sInitStruct->bNumberOfLanes);
+
+	
+
+	
+	
+	
+	fpPixel_Clk = ( (Yushan_ConvertTo16p16FP(sInitStruct->uwBitRate)*sInitStruct->bNumberOfLanes)/bRx_PixelWidth);
+	fpIdp_Clk = Yushan_ConvertTo16p16FP((uint16_t)(fpTargetPll_Clk/fpIdpClk_div));
+
+	
+	udwFullLine  = sInitStruct->uwActivePixels + sInitStruct->uwLineBlankStill;
+	udwFullFrame = sInitStruct->uwLines + sInitStruct->uwFrameBlank;
+
+	fpTempVar = Yushan_ConvertTo16p16FP((uint16_t)((sInitStruct->fpSpiClock*30)/0x80000));
+	fpDxoClockLow = (fpTempVar >= fpIdp_Clk)?fpTempVar:fpIdp_Clk;
+
+	if (fpDxoClockLow > DXO_CLK_LIMIT) {
+		ERRORLOG("[CAM] %s:Lower limit of DxO clock is greater than higher limit, so EXITING the test\n", __func__);
+		sSystemStatus->bDxoConstraints = DXO_LOLIMIT_EXCEED_HILIMIT;
+		VERBOSELOG("[CAM] %s: End\n", __func__);
+		return FAILURE;
+	}
+
+	
+	bCount = ((bTx_PixelWidth == 8) ? 14 : 15);
+
+	sSystemStatus->udwDxoConstraintsMinValue = 0;
+	
+	while (bCount >= 0) {
+		fpDxoClk_Div = fpDividers[bCount];
+		fpDxo_Clk = Yushan_ConvertTo16p16FP((uint16_t)(fpTargetPll_Clk / fpDxoClk_Div));
+
+		if ((fpDxo_Clk >= fpDxoClockLow) && (fpDxo_Clk <= DXO_CLK_LIMIT)) {
+			
+			fDXOStatus = ((fStatus = Yushan_CheckDxoConstraints(sInitStruct->uwLineBlankStill, DXO_MIN_LINEBLANKING, fpDxo_Clk, fpPixel_Clk, 1, &sSystemStatus->udwDxoConstraintsMinValue))==0)? DXO_LINEBLANK_ERR : DXO_NO_ERR;
+			if(fDXOStatus!=DXO_NO_ERR) { bCount--; continue;}
+			fDXOStatus = ((fStatus = Yushan_CheckDxoConstraints(udwFullLine, DXO_MIN_LINELENGTH, fpDxo_Clk, fpPixel_Clk, 1, &sSystemStatus->udwDxoConstraintsMinValue))==0)? DXO_FULLLINE_ERR: DXO_NO_ERR ;
+			if(fDXOStatus!=DXO_NO_ERR) { bCount--; continue;}
+			
+			
+			fDXOStatus = ((fStatus = Yushan_CheckDxoConstraints(sInitStruct->uwLines, ((DXO_ACTIVE_FRAMELENGTH/udwFullLine)+1), fpDxo_Clk, fpPixel_Clk, 1, &sSystemStatus->udwDxoConstraintsMinValue))==0)? DXO_ACTIVE_FRAMELENGTH_ERR: DXO_NO_ERR;
+			if(fDXOStatus!=DXO_NO_ERR) { bCount--; continue;}
+			fDXOStatus = ((fStatus = Yushan_CheckDxoConstraints(udwFullFrame, ((DXO_FULL_FRAMELENGTH/udwFullLine)+1), fpDxo_Clk, fpPixel_Clk, 1, &sSystemStatus->udwDxoConstraintsMinValue))==0)? DXO_FULLFRAMELENGTH_ERR: DXO_NO_ERR;
+			if(fDXOStatus!=DXO_NO_ERR) { bCount--; continue;}
+
+			udwFrameBlank = ((8*fpDxo_Clk)/fpPixel_Clk);						
+			if (sInitStruct->bDxoSettingCmdPerFrame == 1)
+				udwFrameBlank += (135000/udwFullLine)+1;   
+			if (sInitStruct->bDxoSettingCmdPerFrame > 1)
+				udwFrameBlank += (220000/udwFullLine)+1;   
+
+			fDXOStatus = ((fStatus = Yushan_CheckDxoConstraints(sInitStruct->uwFrameBlank, udwFrameBlank, fpDxo_Clk, fpPixel_Clk, 1, &sSystemStatus->udwDxoConstraintsMinValue))==0)? DXO_FRAMEBLANKING_ERR: DXO_NO_ERR;
+			if(fDXOStatus!=DXO_NO_ERR) { bCount--; continue;}
+
+			
+			break;
+
+        	}																															
+		
+		bCount--;
+	}
+
+	
+	sSystemStatus->bDxoConstraints = fDXOStatus;
+
+	
+	if (bCount < 0) {
+		ERRORLOG("[CAM] %s:DXO Dividers exhausted and returning FAILURE\n", __func__);
+		VERBOSELOG("[CAM] %s: End\n", __func__);
+		return FAILURE;
+	}
+
+	for (bCount = 0; bCount < 10; bCount++) {
+		fpSysClk_Div = fpDividers[bCount];
+		fpSys_Clk = Yushan_ConvertTo16p16FP((uint16_t)(fpTargetPll_Clk / fpSysClk_Div));
+		if (fpSys_Clk <= SYS_CLK_LIMIT)
+			break; 
+	}
+
+
+	fStatus = SUCCESS;
+
+	
+	bSpiData = 0x7F;
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL, 1, (uint8_t *)(&bSpiData)); 
+
+	
+	
+	bSpiData = 0x00;
+	fStatus &= SPI_Write(YUSHAN_RESET_CTRL, 1, (uint8_t *)(&bSpiData));
+	bSpiData = 0x04;
+	fStatus &= SPI_Write(YUSHAN_RESET_CTRL + 1, 1, (uint8_t *)(&bSpiData));
+	bSpiData = 0x00;
+	fStatus &= SPI_Write(YUSHAN_RESET_CTRL + 2, 1, (uint8_t *)(&bSpiData));
+	bSpiData = 0x37;
+	fStatus &= SPI_Write(YUSHAN_RESET_CTRL, 1, (uint8_t *)(&bSpiData));
+	bSpiData = 0x0f;
+	fStatus &= SPI_Write(YUSHAN_RESET_CTRL + 1, 1, (uint8_t *)(&bSpiData));
+	bSpiData = 0x07;
+	fStatus &= SPI_Write(YUSHAN_RESET_CTRL + 2, 1, (uint8_t *)(&bSpiData));
+	bSpiData = 1;
+	fStatus &= SPI_Write(YUSHAN_RESET_CTRL + 3, 1, (uint8_t *)(&bSpiData));
+	bSpiData = 0;
+	fStatus &= SPI_Write(YUSHAN_RESET_CTRL + 3, 1, (uint8_t *)(&bSpiData));
+
+	
+	Yushan_Intr_Enable((uint8_t *)udwIntrMask);
+
+	
+	fStatus &= Yushan_Init_LDO(sInitStruct->bUseExternalLDO);
+	if (!fStatus) {
+		ERRORLOG("[CAM] %s:LDO setup FAILED\n", __func__);
+		VERBOSELOG("[CAM] %s: End\n", __func__);
+		return FAILURE;
+	} else {
+		DEBUGLOG("[CAM] %s:LDO setup done.\n", __func__);
+	}
+
+	
+	
+	bSpiData = (uint8_t)(fpDxoClk_Div>>16);
+	bSpiData = bSpiData << 1;
+	if ((fpDxoClk_Div&0x8000)==0x8000)				
+		bSpiData |= 0x01;
+	fStatus &= SPI_Write(YUSHAN_CLK_DIV_FACTOR,   1, (uint8_t *)(&bSpiData));
+	bSpiData = (uint8_t)(fpIdpClk_div>>16);
+	bSpiData = bSpiData << 1;
+	if ((fpIdpClk_div&0x8000)==0x8000)				
+		bSpiData |= 0x01;
+	fStatus &= SPI_Write(YUSHAN_CLK_DIV_FACTOR+1, 1, (uint8_t *) (&bSpiData));
+	bSpiData = (uint8_t)(fpSysClk_Div>>16);
+	bSpiData = bSpiData << 1;
+	if ((fpSysClk_Div&0x8000)==0x8000)				
+		bSpiData |= 0x01;
+	fStatus &= SPI_Write(YUSHAN_CLK_DIV_FACTOR + 2, 1, (uint8_t *) (&bSpiData));
+
+	
+	bSpiData = 0x18;
+	fStatus &= SPI_Write(YUSHAN_PLL_CTRL_MAIN, 1, (uint8_t *)(&bSpiData));	
+
+	if (!fStatus) {
+		ERRORLOG("[CAM] %s: End with Failure at enabling PLLs\n", __func__);
+		return FAILURE;
+	}
+
+	DEBUGLOG("[CAM] %s:Waiting for YUSHAN_PLL_CTRL_MAIN interrupt Starts here\n", __func__);
+	fStatus &= Yushan_WaitForInterruptEvent(EVENT_PLL_STABLE, TIME_100MS);
+
+	DEBUGLOG("[CAM] %s:YUSHAN_PLL_CTRL_MAIN interrupt received\n", __func__);
+
+	if (!fStatus) {
+		ERRORLOG("[CAM] %s: Failure at YUSHAN_PLL_CTRL_MAIN interrupt non-received Exiting...\n", __func__);
+		return FAILURE;
+	}
+
+	
+	
+	udwSpiData = 0;
+	SPI_Read(YUSHAN_CLK_CTRL,   4, (uint8_t*)(&udwSpiData));
+
+	
+	bSpiData = 0x00;
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL, 1, (uint8_t*)(&bSpiData));
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+1, 1, (uint8_t*)(&bSpiData));
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+2, 1, (uint8_t*)(&bSpiData));		
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+3, 1, (uint8_t*)(&bSpiData));		
+
+
+	
+	bSpiData = 0x01; 
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL + 1, 1, (uint8_t *)(&bSpiData));
+
+	
+	udwSpiData &= 0xFDFF; 
+	udwSpiData |= 0x0100; 
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL, 4, (uint8_t *)(&udwSpiData));
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return fStatus;
+
+
+}
+
+
+
+uint32_t Yushan_ConvertTo16p16FP(uint16_t uwNonFPValue)
+{
+
+	return (((uint32_t)(uwNonFPValue)) << 16);
+
+}
+
+
+
+
+bool_t	Yushan_Init_Dxo(Yushan_Init_Dxo_Struct_t *sDxoStruct, bool_t fBypassDxoUpload)
+{
+
+	uint8_t bSpiData;
+	uint32_t	udwHWnMicroCodeID = 0; 
+	uint32_t udwDxoBaseAddress = 0, udwSpiBaseIndex = 0;
+	bool_t	fStatus = 1;
+	
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	
+
+	udwSpiBaseIndex = 0x08000;
+	fStatus=SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+	udwDxoBaseAddress=DXO_DOP_BASE_ADDR;
+
+	if (!fBypassDxoUpload) {
+		DEBUGLOG("[CAM] load DxO DOP firmware\n");
+		fStatus &= SPI_Write_4thByte((uint16_t)(sDxoStruct->uwBaseAddrDopMicroCode[0]+udwDxoBaseAddress), sDxoStruct->uwDxoDopRamImageSize[0], sDxoStruct->pDxoDopRamImage[0]);
+		fStatus &= SPI_Write_4thByte((uint16_t)(sDxoStruct->uwBaseAddrDopMicroCode[1]+udwDxoBaseAddress), sDxoStruct->uwDxoDopRamImageSize[1], sDxoStruct->pDxoDopRamImage[1]);
+	}
+	
+	
+	fStatus &= SPI_Write((uint16_t)(sDxoStruct->uwDxoDopBootAddr + udwDxoBaseAddress), 2,  (uint8_t*)(&sDxoStruct->uwDxoDopStartAddr));
+	
+	bSpiData = DXO_BOOT_CMD;
+	fStatus &= SPI_Write((uint16_t)(DxODOP_boot + udwDxoBaseAddress), 1,  (uint8_t*)(&bSpiData));
+
+	
+	udwSpiBaseIndex = 0x10000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+	udwDxoBaseAddress=(0x8000 + DXO_DPP_BASE_ADDR) - udwSpiBaseIndex; 
+	
+	if (!fBypassDxoUpload) {
+		DEBUGLOG("[CAM] load DxO DPP firmware\n");
+		fStatus &= SPI_Write_4thByte((uint16_t)(sDxoStruct->uwBaseAddrDppMicroCode[0]+ udwDxoBaseAddress), sDxoStruct->uwDxoDppRamImageSize[0], sDxoStruct->pDxoDppRamImage[0]);
+		
+		udwSpiBaseIndex = DXO_DPP_BASE_ADDR + sDxoStruct->uwBaseAddrDppMicroCode[1]; 
+		SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+		udwDxoBaseAddress = ((DXO_DPP_BASE_ADDR + sDxoStruct->uwBaseAddrDppMicroCode[1]) - udwSpiBaseIndex) + 0x8000; 
+
+		fStatus &= SPI_Write_4thByte((uint16_t)(udwDxoBaseAddress), sDxoStruct->uwDxoDppRamImageSize[1], sDxoStruct->pDxoDppRamImage[1]);
+	}
+	
+	udwSpiBaseIndex = 0x18000;
+	udwDxoBaseAddress = 0x8000;  
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+	
+	
+	fStatus &= SPI_Write((uint16_t)((DXO_DPP_BASE_ADDR + sDxoStruct->uwDxoDppBootAddr) - udwSpiBaseIndex + udwDxoBaseAddress), 2,  (uint8_t*)(&sDxoStruct->uwDxoDppStartAddr));
+	
+	bSpiData = DXO_BOOT_CMD;
+	fStatus &= SPI_Write(((uint16_t)(DXO_DPP_BASE_ADDR + DxODPP_boot) - udwSpiBaseIndex + udwDxoBaseAddress), 1,  (uint8_t*)(&bSpiData));
+
+	
+	udwSpiBaseIndex = 0x8000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+	
+	
+	if (!fBypassDxoUpload) {
+		DEBUGLOG("[CAM] load DxO PDP firmware\n");
+		fStatus &= SPI_Write_4thByte((uint16_t)(sDxoStruct->uwBaseAddrPdpMicroCode[0]+ DXO_PDP_BASE_ADDR), sDxoStruct->uwDxoPdpRamImageSize[0], sDxoStruct->pDxoPdpRamImage[0]);
+		fStatus &= SPI_Write_4thByte((uint16_t)(sDxoStruct->uwBaseAddrPdpMicroCode[1]+ DXO_PDP_BASE_ADDR), sDxoStruct->uwDxoPdpRamImageSize[1], sDxoStruct->pDxoPdpRamImage[1]);
+  	}
+	
+	
+	fStatus &= SPI_Write((uint16_t)(sDxoStruct->uwDxoPdpBootAddr + DXO_PDP_BASE_ADDR), 2,  (uint8_t*)(&sDxoStruct->uwDxoPdpStartAddr));
+
+	
+	bSpiData = DXO_BOOT_CMD;
+	fStatus &= SPI_Write((uint16_t)(DxOPDP_boot + DXO_PDP_BASE_ADDR), 1,  (uint8_t*)(&bSpiData));
+
+	DEBUGLOG("[CAM] %s:Waiting for EVENT_DOP7_BOOT interrupt Starts here\n", __func__);
+	
+	fStatus &= Yushan_WaitForInterruptEvent2 (EVENT_DOP7_BOOT, TIME_100MS);
+	if (!fStatus) {
+		ERRORLOG("[CAM] %s: EVENT_DOP7_BOOT not received. Exiting ...\n", __func__);
+		return fStatus;
+	}
+	DEBUGLOG("[CAM] %s:DOP7 IP Booted\n", __func__);
+
+	
+
+		
+	SPI_Read((DxODOP_ucode_id_7_0 + DXO_DOP_BASE_ADDR) , 4, (uint8_t *)(&udwHWnMicroCodeID));
+#if 0
+	SPI_Read((DxODOP_calib_id_0_7_0 + DXO_DOP_BASE_ADDR), 4, (uint8_t *)(&udwCalibrationDataID));
+	SPI_Read((DxODOP_error_code_7_0 + DXO_DOP_BASE_ADDR), 1, (uint8_t *)(&udwErrorCode));
+	DEBUGLOG("DXO DOP udwHWnMicroCodeID:%x;udwCalibrationDataID:%x;udwErrorCode:%x\n",
+		udwHWnMicroCodeID, udwCalibrationDataID, udwErrorCode);
+#endif
+
+	udwHWnMicroCodeID &= 0xFFFFFF00;	
+	if ((udwHWnMicroCodeID != DXO_DOP_HW_MICROCODE_ID)) {
+		ERRORLOG("[CAM] %s: Error with DOP microcode check. Exiting ...\n", __func__);
+		return FAILURE;
+	}
+
+	DEBUGLOG("[CAM] %s:Waiting for EVENT_DPP_BOOT interrupt Starts here\n", __func__);
+	
+	fStatus &= Yushan_WaitForInterruptEvent (EVENT_DPP_BOOT, TIME_100MS);
+	if (!fStatus) {
+		ERRORLOG("[CAM] %s: EVENT_DPP_BOOT not received. Exiting ...\n", __func__);
+		return fStatus;
+	}
+	DEBUGLOG("[CAM] %s:DPP IP Booted\n", __func__);
+
+	
+	udwSpiBaseIndex = 0x010000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+	SPI_Read(DxODPP_ucode_id_7_0+ DXO_DPP_BASE_ADDR-0x8000, 4, (uint8_t *)(&udwHWnMicroCodeID));
+#if 0
+	SPI_Read(DxODPP_calib_id_0_7_0+DXO_DPP_BASE_ADDR-0x8000, 4, (uint8_t *)(&udwCalibrationDataID));
+	SPI_Read(DxOPDP_error_code_7_0+DXO_DPP_BASE_ADDR-0x8000, 1, (uint8_t *)(&udwErrorCode));
+	DEBUGLOG("DXO DPP udwHWnMicroCodeID:%x;udwCalibrationDataID:%x;udwErrorCode:%x\n",
+		udwHWnMicroCodeID, udwCalibrationDataID, udwErrorCode);
+#endif
+
+	udwHWnMicroCodeID &= 0xFFFFFF00;	
+	if (udwHWnMicroCodeID != DXO_DPP_HW_MICROCODE_ID) {
+		ERRORLOG("[CAM] %s: Error with DPP microcode check. Exiting ...\n", __func__);
+		return FAILURE;
+	}
+	
+	udwSpiBaseIndex = 0x08000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+	DEBUGLOG("[CAM] %s:Waiting for EVENT_PDP_BOOT interrupt Starts here\n", __func__);
+	
+	fStatus &= Yushan_WaitForInterruptEvent (EVENT_PDP_BOOT, TIME_100MS);
+
+	if (!fStatus) {
+		ERRORLOG("[CAM] %s: EVENT_PDP_BOOT not received. Exiting ...\n", __func__);
+		return fStatus;
+	}
+	DEBUGLOG("[CAM] %s:PDP IP Booted\n", __func__);
+
+	
+	SPI_Read((DxOPDP_ucode_id_7_0 + DXO_PDP_BASE_ADDR) , 4, (uint8_t *)(&udwHWnMicroCodeID));
+#if 0
+	SPI_Read((DxOPDP_calib_id_0_7_0 + DXO_PDP_BASE_ADDR), 4, (uint8_t *)(&udwCalibrationDataID));
+	SPI_Read((DxOPDP_error_code_7_0 + DXO_PDP_BASE_ADDR), 1, (uint8_t *)(&udwErrorCode));
+	DEBUGLOG("DXO PDP udwHWnMicroCodeID:%x;udwCalibrationDataID:%x;udwErrorCode:%x\n",
+		udwHWnMicroCodeID, udwCalibrationDataID, udwErrorCode);
+#endif
+
+	udwHWnMicroCodeID &= 0xFFFFFF00; 
+	if (udwHWnMicroCodeID != DXO_PDP_HW_MICROCODE_ID) {
+		ERRORLOG("[CAM] %s: Error with PDP microcode check. Exiting ...\n", __func__);
+		return FAILURE;
+	}
+
+	VERBOSELOG("[CAM] %s: End with Success\n", __func__);
+	return SUCCESS;
+}
+
+
+bool_t Yushan_Init(Yushan_Init_Struct_t *sInitStruct)
+{
+
+	uint32_t spi_base_address, udwSpiData;
+	uint16_t uwHsizeStill = 0;
+	uint16_t uwHsizeVf = 0;
+	uint16_t uwLecciStill;
+	uint16_t uwLecciVf;
+	uint8_t bCount, bStillIndex = 0xf, bVfIndex = 0xf;
+	uint8_t bSofEofLength = 32;
+	uint8_t bDxoClkDiv , bPixClkDiv;
+	uint8_t		bDXODecimalFactor = 0, bIdpDecimalFactor = 0; 
+	uint8_t		bUsedDataType = 0;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	
+	spi_base_address = 0x8000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (unsigned char *)&spi_base_address);
+
+	udwSpiData = 0x1;
+	SPI_Write(YUSHAN_IOR_NVM_CTRL, 1, (unsigned char *)&udwSpiData); 
+
+	
+	udwSpiData = 4000/sInitStruct->uwBitRate;
+	SPI_Write(YUSHAN_MIPI_TX_UIX4, 1, (unsigned char *)&udwSpiData);
+	SPI_Write(YUSHAN_MIPI_RX_UIX4, 1, (unsigned char *)&udwSpiData);
+	udwSpiData = 1;
+	SPI_Write(YUSHAN_MIPI_RX_COMP, 1, (unsigned char*)&udwSpiData);
+
+	if (sInitStruct->bNumberOfLanes == 1)
+		udwSpiData = 0x11; 
+	else if (sInitStruct->bNumberOfLanes == 2)
+		udwSpiData = 0x31; 
+	else if (sInitStruct->bNumberOfLanes == 4)
+		udwSpiData = 0xf1; 
+
+	
+	SPI_Write(YUSHAN_MIPI_TX_ENABLE,1,(unsigned char*)&udwSpiData);
+	SPI_Write(YUSHAN_MIPI_RX_ENABLE,1,(unsigned char*)&udwSpiData); 
+	
+	
+	udwSpiData=4000/sInitStruct->uwBitRate;
+	SPI_Write(YUSHAN_MIPI_TX_UIX4,1,(unsigned char*)&udwSpiData);
+	SPI_Write(YUSHAN_MIPI_RX_UIX4,1,(unsigned char*)&udwSpiData); 
+
+	
+	SPI_Read(YUSHAN_MIPI_RX_ENABLE,1,(unsigned char*)&udwSpiData); 
+	udwSpiData |= 0x02; 
+	SPI_Write(YUSHAN_MIPI_TX_ENABLE,1,(unsigned char*)&udwSpiData);
+
+	
+
+	udwSpiData=sInitStruct->bNumberOfLanes;
+	SPI_Write(YUSHAN_CSI2_RX_NB_DATA_LANES,1,(unsigned char*)&udwSpiData); 
+
+	udwSpiData=sInitStruct->uwPixelFormat & 0x0f;
+	SPI_Write(YUSHAN_CSI2_RX_IMG_UNPACKING_FORMAT,1,(unsigned char*)&udwSpiData); 
+
+	udwSpiData = 4; 
+	SPI_Write(YUSHAN_CSI2_RX_BYTE2PIXEL_READ_TH,1,(unsigned char*)&udwSpiData); 
+
+	
+
+	udwSpiData=sInitStruct->uwPixelFormat & 0x0f;
+	SPI_Write(YUSHAN_SMIA_FM_PIX_WIDTH,1,(unsigned char*)&udwSpiData); 
+
+	udwSpiData=0;
+	SPI_Write(YUSHAN_SMIA_FM_GROUPED_PARAMETER_HOLD,1,(unsigned char*)&udwSpiData); 
+	udwSpiData=0x19;
+	SPI_Write(YUSHAN_SMIA_FM_CTRL,1,(unsigned char*)&udwSpiData); 
+	
+	udwSpiData = 0;
+	SPI_Write(YUSHAN_SMIA_FM_EOF_INT_EN, 1, (unsigned char*)&udwSpiData);	
+	
+	
+
+	
+	udwSpiData=((((sInitStruct->uwPixelFormat & 0x0f) * bSofEofLength )/32 )<<8)|0x01;
+	SPI_Write(YUSHAN_CSI2_TX_WRAPPER_THRESH,2,(unsigned char*)&udwSpiData); 
+
+	
+
+	udwSpiData=1;
+	SPI_Write(YUSHAN_EOF_RESIZE_PRE_DXO_AUTOMATIC_CONTROL,1,(unsigned char*)&udwSpiData); 
+	SPI_Write(YUSHAN_EOF_RESIZE_PRE_DXO_ENABLE,1,(unsigned char*)&udwSpiData); 
+
+	
+	udwSpiData=0; 
+	SPI_Write(YUSHAN_EOF_RESIZE_POST_DXO_AUTOMATIC_CONTROL,1,(unsigned char*)&udwSpiData); 
+	udwSpiData= bSofEofLength;
+	SPI_Write(YUSHAN_EOF_RESIZE_POST_DXO_H_SIZE,1,(unsigned char*)&udwSpiData); 
+	udwSpiData=1;
+	SPI_Write(YUSHAN_EOF_RESIZE_POST_DXO_ENABLE,1,(unsigned char*)&udwSpiData); 
+
+	SPI_Read(YUSHAN_CLK_DIV_FACTOR,1,(unsigned char*)&bDxoClkDiv); 
+	SPI_Read(YUSHAN_CLK_DIV_FACTOR+1,1,(unsigned char*)&bPixClkDiv); 
+	
+	
+
+	
+
+	for (bCount = 0 ; bCount < 14 ; bCount++) {
+
+		if (bCount < sInitStruct->bValidWCEntries) {
+		udwSpiData=sInitStruct->sFrameFormat[bCount].uwWordcount | 
+			( sInitStruct->sFrameFormat[bCount].bDatatype << 16 )|
+			( sInitStruct->sFrameFormat[bCount].bActiveDatatype << 24 );
+
+		SPI_Write((uint16_t)(YUSHAN_IDP_GEN_WC_DI_0+4*bCount),4,(unsigned char*)&udwSpiData);
+
+		udwSpiData=sInitStruct->sFrameFormat[bCount].uwWordcount ;
+		SPI_Write((uint16_t)(YUSHAN_CSI2_TX_PACKET_SIZE_0+0xc*bCount),4,(unsigned char*)&udwSpiData);
+
+		udwSpiData=sInitStruct->sFrameFormat[bCount].bDatatype ;
+		SPI_Write((uint16_t)(YUSHAN_CSI2_TX_DI_INDEX_CTRL_0+0xc*bCount),1,(unsigned char*)&udwSpiData);
+
+		if (sInitStruct->sFrameFormat[bCount].bSelectStillVfMode == YUSHAN_FRAME_FORMAT_VF_MODE) {
+			bUsedDataType = sInitStruct->sFrameFormat[bCount].bDatatype;
+			uwHsizeVf=(sInitStruct->sFrameFormat[bCount].uwWordcount * 8 )/ (sInitStruct->uwPixelFormat & 0x0f);
+			bVfIndex=bCount;
+		}
+
+		if (sInitStruct->sFrameFormat[bCount].bSelectStillVfMode == YUSHAN_FRAME_FORMAT_STILL_MODE) {
+			bUsedDataType = sInitStruct->sFrameFormat[bCount].bDatatype;
+			uwHsizeStill=(sInitStruct->sFrameFormat[bCount].uwWordcount * 8 )/ (sInitStruct->uwPixelFormat & 0x0f);
+			bStillIndex=bCount;
+		}
+		} else {
+			udwSpiData = (0)|(bUsedDataType << 16)|(1<<24);
+			SPI_Write((uint16_t)(YUSHAN_IDP_GEN_WC_DI_0+4*bCount),4,(unsigned char*)&udwSpiData);
+		}
+	}
+
+	udwSpiData=bVfIndex | ( bStillIndex << 4 ) | (bSofEofLength << 8)|0x3ff0000; 
+	SPI_Write(YUSHAN_IDP_GEN_CONTROL,4,(unsigned char*)&udwSpiData);
+	udwSpiData=0xc810;
+	SPI_Write(YUSHAN_IDP_GEN_ERROR_LINES_EOF_GAP,2,(unsigned char*)&udwSpiData);
+
+	  
+
+
+	udwSpiData=sInitStruct->bNumberOfLanes-1;
+	SPI_Write(YUSHAN_CSI2_TX_NUMBER_OF_LANES,1,(unsigned char*)&udwSpiData); 
+
+	udwSpiData=1;
+	SPI_Write(YUSHAN_CSI2_TX_PACKET_CONTROL,1,(unsigned char*)&udwSpiData); 
+	udwSpiData=1;
+	SPI_Write(YUSHAN_CSI2_TX_ENABLE,1,(unsigned char*)&udwSpiData); 
+
+	
+	
+	udwSpiData=0x1;
+	SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH0,1,(unsigned char*)&udwSpiData);
+	SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH1,1,(unsigned char*)&udwSpiData);
+	SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH2,1,(unsigned char*)&udwSpiData);
+	udwSpiData=0x3;
+	SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH3,1,(unsigned char*)&udwSpiData);
+	udwSpiData=0x01;
+	SPI_Write(YUSHAN_DTFILTER_BYPASS_ENABLE,1,(unsigned char*)&udwSpiData);
+
+	
+
+	udwSpiData=0xd;
+	SPI_Write(YUSHAN_DTFILTER_DXO_MATCH0,1,(unsigned char*)&udwSpiData);
+	SPI_Write(YUSHAN_DTFILTER_DXO_MATCH2,1,(unsigned char*)&udwSpiData);
+	SPI_Write(YUSHAN_DTFILTER_DXO_MATCH3,1,(unsigned char*)&udwSpiData);
+	udwSpiData=0x02;
+	SPI_Write(YUSHAN_DTFILTER_DXO_MATCH1,1,(unsigned char*)&udwSpiData);
+	udwSpiData=0x01;
+	SPI_Write(YUSHAN_DTFILTER_DXO_ENABLE,1,(unsigned char*)&udwSpiData);
+
+
+	
+
+	
+	udwSpiData=(uwHsizeStill&0xff) | ((uwHsizeVf&0xff) << 8 );
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT,2,(unsigned char*)&udwSpiData);
+	
+	udwSpiData=DXO_PDP_BASE_ADDR+DxOPDP_visible_line_size_7_0;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+2,3,(unsigned char*)&udwSpiData);
+	udwSpiData=((uwHsizeStill>>8)&0xff) | (((uwHsizeVf>>8)&0xff) << 8 );
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+8,2,(unsigned char*)&udwSpiData);
+	
+	udwSpiData=DXO_PDP_BASE_ADDR + DxOPDP_visible_line_size_15_8;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+8+2,3,(unsigned char*)&udwSpiData);
+	udwSpiData=0x0101;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+16,2,(unsigned char*)&udwSpiData);
+	
+	udwSpiData=DXO_PDP_BASE_ADDR + DxOPDP_newFrameCmd;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+16+2,3,(unsigned char*)&udwSpiData);
+
+	
+	udwSpiData=(uwHsizeStill&0xff) | ((uwHsizeVf&0xff) << 8 );
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+24,2,(unsigned char*)&udwSpiData);
+	
+	udwSpiData=DXO_DPP_BASE_ADDR + DxODPP_visible_line_size_7_0;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+24+2,3,(unsigned char*)&udwSpiData);
+	udwSpiData=((uwHsizeStill>>8)&0xff) | (((uwHsizeVf>>8)&0xff) << 8 );
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+32,2,(unsigned char*)&udwSpiData);
+	
+	udwSpiData=DXO_DPP_BASE_ADDR + DxODPP_visible_line_size_15_8;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+32+2,3,(unsigned char*)&udwSpiData);
+	udwSpiData=0x0101;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+40,2,(unsigned char*)&udwSpiData);
+	
+	udwSpiData=DXO_DPP_BASE_ADDR + DxODPP_newFrameCmd;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+40+2,3,(unsigned char*)&udwSpiData);
+
+	
+	udwSpiData=(uwHsizeStill&0xff) | ((uwHsizeVf&0xff) << 8);
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+48,2,(unsigned char*)&udwSpiData);
+	
+	udwSpiData=DXO_DOP_BASE_ADDR + DxODOP_visible_line_size_7_0;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+48+2,3,(unsigned char*)&udwSpiData);
+	udwSpiData=((uwHsizeStill>>8)&0xff) | (((uwHsizeVf>>8)&0xff) << 8);
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+56,2,(unsigned char*)&udwSpiData);
+	
+	udwSpiData=DXO_DOP_BASE_ADDR + DxODOP_visible_line_size_15_8;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+56+2,3,(unsigned char*)&udwSpiData);
+	udwSpiData=0x0101;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+64,2,(unsigned char*)&udwSpiData);
+	
+	udwSpiData=DXO_DOP_BASE_ADDR + DxODOP_newFrameCmd;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+64+2,3,(unsigned char*)&udwSpiData);
+
+	
+	udwSpiData=(uwHsizeStill&0xff) | ((uwHsizeVf&0xff) << 8);
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+72,2,(unsigned char*)&udwSpiData);
+	udwSpiData=YUSHAN_LBE_PRE_DXO_H_SIZE;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+72+2,3,(unsigned char*)&udwSpiData);
+	udwSpiData=((uwHsizeStill>>8)&0xff) | (((uwHsizeVf>>8)&0xff) << 8);
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+80,2,(unsigned char*)&udwSpiData);
+	udwSpiData=YUSHAN_LBE_PRE_DXO_H_SIZE+1;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+80+2,3,(unsigned char*)&udwSpiData);
+
+	
+	udwSpiData=(uwHsizeStill&0xff) | ((uwHsizeVf&0xff) << 8);
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+88,2,(unsigned char*)&udwSpiData);
+	udwSpiData=YUSHAN_LBE_POST_DXO_H_SIZE;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+88+2,3,(unsigned char*)&udwSpiData);
+	udwSpiData=((uwHsizeStill>>8)&0xff) | (((uwHsizeVf>>8)&0xff) << 8);
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+96,2,(unsigned char*)&udwSpiData);
+	udwSpiData=YUSHAN_LBE_POST_DXO_H_SIZE+1;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+96+2,3,(unsigned char*)&udwSpiData);
+
+	
+	udwSpiData=(uwHsizeStill&0xff) | ((uwHsizeVf&0xff) << 8);
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+104,2,(unsigned char*)&udwSpiData);
+	udwSpiData=YUSHAN_LECCI_LINE_SIZE;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+104+2,3,(unsigned char*)&udwSpiData);
+	udwSpiData=((uwHsizeStill>>8)&0xff) | (((uwHsizeVf>>8)&0xff) << 8);
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+112,2,(unsigned char*)&udwSpiData);
+	udwSpiData=YUSHAN_LECCI_LINE_SIZE+1;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+112+2,3,(unsigned char*)&udwSpiData);
+
+	
+	
+	if (bDxoClkDiv != 0 && bPixClkDiv != 0) {
+		uwLecciVf    = sInitStruct->uwLineBlankVf*bPixClkDiv/ bDxoClkDiv;
+		uwLecciStill = sInitStruct->uwLineBlankStill*bPixClkDiv/ bDxoClkDiv;
+	} else {
+		uwLecciVf    = 300;
+		uwLecciStill = 300;
+	}
+
+	
+	udwSpiData=(uwLecciStill&0xff) | ((uwLecciVf&0xff) << 8 );
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+120,2,(unsigned char*)&udwSpiData); 
+	udwSpiData=YUSHAN_LECCI_MIN_INTERLINE;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+120+2,3,(unsigned char*)&udwSpiData); 
+	udwSpiData=((uwLecciStill>>8)&0xff) | (((uwLecciVf>>8)&0xff) << 8 );
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+128,2,(unsigned char*)&udwSpiData); 
+	udwSpiData=YUSHAN_LECCI_MIN_INTERLINE+1;
+	SPI_Write(YUSHAN_T1_DMA_MEM_LOWER_ELT+128+2,3,(unsigned char*)&udwSpiData);
+
+ 
+	udwSpiData=17; 
+	SPI_Write(YUSHAN_T1_DMA_REG_REFILL_ELT_NB,1,(unsigned char*)&udwSpiData); 
+	udwSpiData=1;
+	SPI_Write(YUSHAN_T1_DMA_REG_ENABLE,1,(unsigned char*)&udwSpiData); 
+
+	
+	
+
+	udwSpiData=4;  
+	SPI_Write(YUSHAN_LBE_PRE_DXO_READ_START,1,(unsigned char*)&udwSpiData); 
+	udwSpiData=1;  
+	SPI_Write(YUSHAN_LBE_PRE_DXO_ENABLE,1,(unsigned char*)&udwSpiData); 
+
+	
+	
+	udwSpiData = 0x10;  
+	SPI_Write(YUSHAN_LBE_POST_DXO_READ_START,1,(unsigned char*)&udwSpiData);
+	udwSpiData=1;  
+	SPI_Write(YUSHAN_LBE_POST_DXO_ENABLE,1,(unsigned char*)&udwSpiData);
+
+	
+	
+	
+	bDXODecimalFactor = bIdpDecimalFactor = 0;
+
+	if(((bDxoClkDiv&0x01) == 1))		
+		bDXODecimalFactor = 1;		
+	if(((bPixClkDiv&0x01) == 1))		
+		bIdpDecimalFactor = 1;
+
+	bDxoClkDiv = bDxoClkDiv>>1;		
+	bPixClkDiv = bPixClkDiv>>1;		
+
+	if(bDxoClkDiv==bPixClkDiv)
+		udwSpiData = (((2*bDxoClkDiv + bDXODecimalFactor)<<8) | 0x1);
+	else
+		udwSpiData = (((2*bDxoClkDiv + bDXODecimalFactor)<<8)|((bPixClkDiv*2 + bIdpDecimalFactor)-1));
+
+
+	SPI_Write(YUSHAN_LECCI_OUT_BURST_CTRL,2,(unsigned char*)&udwSpiData);
+	udwSpiData=0x01;
+	SPI_Write(YUSHAN_LECCI_ENABLE,1,(unsigned char*)&udwSpiData);
+
+	DEBUGLOG("[CAM] Yushan_Init return success\n");
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return SUCCESS;
+
+}
+
+
+bool_t Yushan_Update_ImageChar(Yushan_ImageChar_t *sImageChar)
+{
+	uint8_t  *pData;
+	bool_t fStatus;
+	uint32_t udwSpiData;
+	uint8_t  bData[20];
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	
+	pData = (uint8_t *)bData;
+
+	bData[0]=sImageChar->bImageOrientation;
+	bData[1]=sImageChar->uwXAddrStart & 0xff;
+	bData[2]=sImageChar->uwXAddrStart >> 8;
+	bData[3]=sImageChar->uwYAddrStart & 0xff;
+	bData[4]=sImageChar->uwYAddrStart >> 8;
+	bData[5]=sImageChar->uwXAddrEnd & 0xff;
+	bData[6]=sImageChar->uwXAddrEnd >> 8;
+	bData[7]=sImageChar->uwYAddrEnd & 0xff;
+	bData[8]=sImageChar->uwYAddrEnd >> 8;
+	bData[9]=sImageChar->uwXEvenInc & 0xff;
+	bData[10]=sImageChar->uwXEvenInc >> 8;
+	bData[11]=sImageChar->uwXOddInc & 0xff;
+	bData[12]=sImageChar->uwXOddInc >> 8;
+	bData[13]=sImageChar->uwYEvenInc & 0xff;
+	bData[14]=sImageChar->uwYEvenInc >> 8;
+	bData[15]=sImageChar->uwYOddInc & 0xff;
+	bData[16]=sImageChar->uwYOddInc >> 8;
+	bData[17]=sImageChar->bBinning ;
+
+	
+	fStatus = SPI_Write(DXO_PDP_BASE_ADDR+DxOPDP_image_orientation_7_0, 18, pData);
+	
+	fStatus = SPI_Write(DXO_DOP_BASE_ADDR+DxODOP_image_orientation_7_0, 18, pData);
+	udwSpiData = 0x10000 ;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS,4,(uint8_t *)&udwSpiData);
+	fStatus = SPI_Write(DXO_DPP_BASE_ADDR+DxODPP_image_orientation_7_0-0x8000, 18, pData);
+	udwSpiData = 0x8000 ;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS,4,(uint8_t *)&udwSpiData);
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return fStatus;
+
+}
+
+
+
+bool_t Yushan_Update_SensorParameters(Yushan_GainsExpTime_t *sGainsExpInfo)
+{
+	uint8_t *pData;
+	bool_t fStatus;
+	uint32_t udwSpiData;
+	uint8_t bData[20];
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	pData = (uint8_t *)bData;
+
+	bData[0]=sGainsExpInfo->uwAnalogGainCodeGR & 0xff;
+	bData[1]=sGainsExpInfo->uwAnalogGainCodeGR >> 8;
+	bData[2]=sGainsExpInfo->uwAnalogGainCodeR & 0xff;
+	bData[3]=sGainsExpInfo->uwAnalogGainCodeR >> 8;
+	bData[4]=sGainsExpInfo->uwAnalogGainCodeB & 0xff;
+	bData[5]=sGainsExpInfo->uwAnalogGainCodeB >> 8;
+	bData[6]=sGainsExpInfo->uwPreDigGainGR & 0xff;
+	bData[7]=sGainsExpInfo->uwPreDigGainGR >> 8;
+	bData[8]=sGainsExpInfo->uwPreDigGainR & 0xff;
+	bData[9]=sGainsExpInfo->uwPreDigGainR >> 8;
+	bData[10]=sGainsExpInfo->uwPreDigGainB & 0xff;
+	bData[11]=sGainsExpInfo->uwPreDigGainB >> 8;
+	bData[12]=sGainsExpInfo->uwExposureTime & 0xff;
+	bData[13]=sGainsExpInfo->uwExposureTime >> 8;
+	
+	
+	fStatus = SPI_Write(DXO_PDP_BASE_ADDR+DxOPDP_analogue_gain_code_greenr_7_0, 14, pData);
+	fStatus = SPI_Write(DXO_DOP_BASE_ADDR+DxODOP_analogue_gain_code_greenr_7_0, 12, pData);
+	pData = (uint8_t *)&(sGainsExpInfo->bRedGreenRatio);
+	fStatus = SPI_Write(DXO_DOP_BASE_ADDR+DxODOP_red_green_ratio_7_0, 2, pData);
+	udwSpiData = 0x10000 ;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS,4,(uint8_t *)&udwSpiData);
+	pData = (uint8_t *)(sGainsExpInfo);
+	fStatus = SPI_Write(DXO_DPP_BASE_ADDR+DxODPP_analogue_gain_code_greenr_7_0-0x8000, 2, pData);
+	pData = (uint8_t *)&(sGainsExpInfo->uwPreDigGainGR);
+	fStatus = SPI_Write(DXO_DPP_BASE_ADDR+DxODPP_pre_digital_gain_greenr_7_0-0x8000, 2, pData);
+	pData = (uint8_t *)&(sGainsExpInfo->uwExposureTime);
+	fStatus = SPI_Write(DXO_DPP_BASE_ADDR+DxODPP_exposure_time_7_0-0x8000, 2, pData);
+	udwSpiData = 0x8000 ;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS,4,(uint8_t *)&udwSpiData);
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return fStatus;
+
+}
+
+
+
+bool_t Yushan_Update_DxoPdp_TuningParameters(Yushan_DXO_PDP_Tuning_t *sDxoPdpTuning)
+{
+	uint8_t  *pData,fStatus;
+	uint8_t bData[3];
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	pData = (uint8_t *)bData;
+	bData[0]=sDxoPdpTuning->bDeadPixelCorrectionLowGain;
+	bData[1]=sDxoPdpTuning->bDeadPixelCorrectionMedGain;
+	bData[2]=sDxoPdpTuning->bDeadPixelCorrectionHiGain;
+
+	
+	
+	fStatus = SPI_Write(DXO_PDP_BASE_ADDR+DxOPDP_dead_pixels_correction_lowGain_7_0, 3, pData);
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return fStatus;
+
+}
+
+
+
+
+
+bool_t Yushan_Update_DxoDpp_TuningParameters(Yushan_DXO_DPP_Tuning_t *sDxoDppTuning)
+{
+
+	uint8_t  *pData;
+	bool_t	fStatus;
+	uint32_t udwSpiData;
+	uint8_t bData[10];
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	pData = (uint8_t *)bData;
+
+	bData[0]=sDxoDppTuning->bTemporalSmoothing;
+	bData[1]=sDxoDppTuning->uwFlashPreflashRating & 0xff ;
+	bData[2]=sDxoDppTuning->uwFlashPreflashRating >> 8;
+	bData[3]=sDxoDppTuning->bFocalInfo;
+
+	udwSpiData = 0x10000 ;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS,4,(uint8_t *)&udwSpiData);
+	fStatus = SPI_Write(DXO_DPP_BASE_ADDR+DxODPP_temporal_smoothing_7_0-0x8000, 4,  pData);
+
+	
+  	udwSpiData = 0x8000 ;
+  	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS,4,(uint8_t *)&udwSpiData);
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return fStatus;
+
+}
+
+
+bool_t Yushan_Update_DxoDop_TuningParameters(Yushan_DXO_DOP_Tuning_t *sDxoDopTuning)
+{
+	uint8_t *pData;
+	bool_t fStatus;
+	uint8_t bData[10];
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	pData = (uint8_t *) bData;
+
+	bData[0]=sDxoDopTuning->bEstimationMode ;
+	
+	fStatus = SPI_Write(DXO_DOP_BASE_ADDR+DxODOP_estimation_mode_7_0, 1, pData);
+
+	bData[0]=sDxoDopTuning->bSharpness;
+	bData[1]=sDxoDopTuning->bDenoisingLowGain;
+	bData[2]=sDxoDopTuning->bDenoisingMedGain;
+	bData[3]=sDxoDopTuning->bDenoisingHiGain;
+	bData[4]=sDxoDopTuning->bNoiseVsDetailsLowGain ;
+	bData[5]=sDxoDopTuning->bNoiseVsDetailsMedGain ;
+	bData[6]=sDxoDopTuning->bNoiseVsDetailsHiGain ;
+	bData[7]=sDxoDopTuning->bTemporalSmoothing ;
+
+	fStatus &= SPI_Write(DXO_DOP_BASE_ADDR+DxODOP_sharpness_7_0, 8, pData);
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return fStatus;
+
+}
+
+
+
+
+bool_t Yushan_Update_Commit(uint8_t  bPdpMode, uint8_t  bDppMode, uint8_t  bDopMode)
+{
+	uint8_t bData, *pData;
+	bool_t fStatus = SUCCESS;
+	uint32_t udwSpiData ;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	bData = 1;
+	pData = &bData;
+
+	
+	SPI_Write(DXO_PDP_BASE_ADDR+DxOPDP_mode_7_0, 1, &bPdpMode);
+	
+	SPI_Write(DXO_PDP_BASE_ADDR+DxOPDP_execCmd, 1, pData);
+
+	
+	SPI_Write(DXO_DOP_BASE_ADDR+DxODOP_mode_7_0, 1, &bDopMode);
+	
+	SPI_Write(DXO_DOP_BASE_ADDR+DxODOP_execCmd, 1, pData);
+
+	
+	udwSpiData = 0x10000 ;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS,4,(uint8_t *)&udwSpiData);
+	
+	SPI_Write(DXO_DPP_BASE_ADDR+DxODPP_mode_7_0-0x8000, 1, &bDppMode);
+	udwSpiData = 0x18000 ;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS,4,(uint8_t *)&udwSpiData);
+	
+	SPI_Write(DXO_DPP_BASE_ADDR+DxODPP_execCmd-0x10000, 1, pData);
+
+
+	
+	udwSpiData = 0x8000 ;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS,4,(uint8_t *)&udwSpiData);
+
+#if 0
+	DEBUGLOG("[CAM] %s:Waiting for EOF_EXECCMD interrupt Starts here\n", __func__);
+	
+	
+	fStatus = Yushan_WaitForInterruptEvent(EVENT_PDP_EOF_EXECCMD, TIME_100MS);
+	if (!fStatus) {
+		ERRORLOG("[CAM] %s:Failed in EVENT_PDP_EOF_EXECCMD interrupt\n", __func__);
+		return FAILURE;
+	}
+	DEBUGLOG("[CAM] %s:DXO PDP commited now\n", __func__);
+
+	fStatus = Yushan_WaitForInterruptEvent2(EVENT_DOP7_EOF_EXECCMD, TIME_100MS);
+	if (!fStatus) {
+		ERRORLOG("[CAM] %s:Failed in EVENT_DOP7_EOF_EXECCMD interrupt\n", __func__);
+		return FAILURE;
+	}
+	DEBUGLOG("[CAM] %s:DXO DOP7 commited now\n", __func__);
+
+	fStatus = Yushan_WaitForInterruptEvent(EVENT_DPP_EOF_EXECCMD, TIME_100MS);
+	if (!fStatus) {
+		ERRORLOG("[CAM] %s:Failed in EVENT_DPP_EOF_EXECCMD interrupt\n", __func__);
+		return FAILURE;
+	}
+#endif
+
+	DEBUGLOG("[CAM] %s:DXO IPs commited now\n", __func__);
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	
+	return fStatus;
+
+}
+
+
+
+bool_t Yushan_CheckDxoConstraints(uint32_t udwParameters, uint32_t udwMinLimit, uint32_t fpDxo_Clk, uint32_t fpPixel_Clk, uint16_t uwFullLine, uint32_t * pMinValue)
+{
+	
+
+	
+	uint16_t	uwLocalDxoClk, uwLocalPixelClk;
+	uint32_t	udwTemp1, udwTemp2;
+
+	
+	uwLocalDxoClk = fpDxo_Clk>>16;
+	uwLocalPixelClk = fpPixel_Clk>>16;
+
+	udwTemp1 = (udwParameters*0xFFFF)/uwLocalPixelClk;
+	udwTemp2 = (udwMinLimit*0xFFFF)/uwLocalDxoClk;
+
+	
+	if (udwTemp1 < udwTemp2) {
+		
+		
+		udwTemp1 = ((udwTemp2*uwLocalPixelClk)/0xFFFF); 
+		*pMinValue = (udwTemp1+1);
+
+		return FAILURE;
+	}
+
+	
+	return SUCCESS;
+
+}
+
+
+
+uint32_t Yushan_Compute_Pll_Divs(uint32_t fpExternal_Clk, uint32_t fpTarget_PllClk)
+{
+	
+	
+	
+	uint32_t		fpIDiv, fpClkPll; 
+	uint32_t		fpBelow[4], fpAbove[4], *pDivPll;	
+	uint32_t		fpFreqVco, fpIdFreq;
+	uint8_t			bODiv, bLoop, bIDivCount = 0;
+	uint8_t			bSpiData;
+	bool_t			fStatus = SUCCESS;
+
+	
+	fpBelow[PLL_CLK_INDEX]=0;
+	fpAbove[PLL_CLK_INDEX]=0x7FFFFFFF; 
+
+	for (bIDivCount = 1; bIDivCount < 8; bIDivCount++) {
+		
+		fpIDiv = Yushan_ConvertTo16p16FP((uint16_t)bIDivCount);
+		
+		fpIdFreq = fpExternal_Clk/bIDivCount;
+		
+		if ((fpIdFreq >= 0x60000) && (fpIdFreq <= 0x320000)) {
+			for (bLoop = 10; bLoop < 168; bLoop++) {
+				
+				fpFreqVco = fpIdFreq * 2 * bLoop;
+				
+				if ((fpFreqVco >= 0x3E80000) && (fpFreqVco <= 0x7D00000)) {
+					for (bODiv = 1; bODiv < 64; bODiv++) {
+						fpClkPll = (fpFreqVco / (2 * bODiv));
+						if ((fpClkPll <= fpTarget_PllClk) && (fpClkPll >= fpBelow[PLL_CLK_INDEX]))
+							fpBelow[PLL_CLK_INDEX] = fpClkPll, fpBelow[IDIV_INDEX] = fpIDiv, fpBelow[LOOP_INDEX] = Yushan_ConvertTo16p16FP((uint16_t)bLoop), fpBelow[ODIV_INDEX] = Yushan_ConvertTo16p16FP((uint16_t)bODiv);
+						if ((fpClkPll >= fpTarget_PllClk) && (fpClkPll <= fpAbove[PLL_CLK_INDEX]))
+							fpAbove[PLL_CLK_INDEX] = fpClkPll, fpAbove[IDIV_INDEX] = fpIDiv, fpAbove[LOOP_INDEX] = Yushan_ConvertTo16p16FP((uint16_t)bLoop), fpAbove[ODIV_INDEX] = Yushan_ConvertTo16p16FP((uint16_t)bODiv);
+					}
+				}
+			}               
+		}
+	}
+
+	
+#if 0
+	if ((fpTarget_PllClk - fpBelow[PLL_CLK_INDEX]) < (fpAbove[PLL_CLK_INDEX] - fpTarget_PllClk))
+		pDivPll = &fpBelow[PLL_CLK_INDEX];
+	else
+		pDivPll = &fpAbove[PLL_CLK_INDEX];
+#else
+	
+	
+	if ((fpBelow[PLL_CLK_INDEX] <= fpTarget_PllClk)&&(fpAbove[PLL_CLK_INDEX]>fpTarget_PllClk))
+		pDivPll = &fpBelow[PLL_CLK_INDEX];
+	else if (fpAbove[PLL_CLK_INDEX] == fpTarget_PllClk)
+		pDivPll = &fpAbove[PLL_CLK_INDEX];
+	else {
+		
+		ERRORLOG("[CAM] %s: Error, Above Conditions not satisfied ...\n", __func__);
+		return FAILURE;
+	}
+#endif
+
+	
+	
+	bSpiData = (uint8_t)((*(pDivPll+1))>>16);
+	fStatus	&= SPI_Write(YUSHAN_PLL_CTRL_MAIN+1, 1, (uint8_t *)  (&bSpiData));
+	bSpiData = (uint8_t)((*(pDivPll+2))>>16);
+	fStatus	&= SPI_Write(YUSHAN_PLL_LOOP_OUT_DF, 1, (uint8_t *) (&bSpiData));
+	bSpiData = (uint8_t)((*(pDivPll+3))>>16);
+	fStatus	&= SPI_Write(YUSHAN_PLL_LOOP_OUT_DF+1, 1, (uint8_t *) (&bSpiData));
+
+	if (!fStatus) 
+		return FAILURE; 
+	else	
+		return *pDivPll;
+}
+
+
+
+
+
+
+bool_t Yushan_Get_Version_Information(Yushan_Version_Info_t * sYushanVersionInfo) 
+{
+#if 1 
+	uint32_t udwSpiBaseIndex;
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	SPI_Read((DxODOP_ucode_id_7_0 + DXO_DOP_BASE_ADDR) , 4, (uint8_t *)(&sYushanVersionInfo->udwDopVersion));
+	SPI_Read((DxODOP_calib_id_0_7_0+ DXO_DOP_BASE_ADDR), 4, (uint8_t *)(&sYushanVersionInfo->udwDopCalibrationVersion));	
+
+	udwSpiBaseIndex = 0x010000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+	
+	SPI_Read(DxODPP_ucode_id_7_0+ DXO_DPP_BASE_ADDR-0x8000, 4, (uint8_t *)(&sYushanVersionInfo->udwDppVersion));
+	SPI_Read(DxODPP_calib_id_0_7_0+ DXO_DPP_BASE_ADDR-0x8000, 4, (uint8_t *)(&sYushanVersionInfo->udwDppCalibrationVersion));
+
+	udwSpiBaseIndex = 0x08000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+	SPI_Read((DxOPDP_ucode_id_7_0 + DXO_PDP_BASE_ADDR) , 4, (uint8_t *)(&sYushanVersionInfo->udwPdpVersion));
+	SPI_Read((DxOPDP_calib_id_0_7_0+ DXO_PDP_BASE_ADDR), 4, (uint8_t *)(&sYushanVersionInfo->udwPdpCalibrationVersion));
+
+#endif
+	sYushanVersionInfo->bApiMajorVersion=API_MAJOR_VERSION;
+	sYushanVersionInfo->bApiMinorVersion=API_MINOR_VERSION;
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return SUCCESS;
+}
+
+
+
+
+
+void	Yushan_AssignInterruptGroupsToPad1(uint16_t	uwAssignITRGrpToPad1)
+{
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	VERBOSELOG("[CAM] %s: uwAssignITRGrpToPad1:0x%x\n", __func__, uwAssignITRGrpToPad1);
+	SPI_Write(YUSHAN_IOR_NVM_SEND_ITR_PAD1, 2, (uint8_t	*)&uwAssignITRGrpToPad1);
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+}
+
+
+
+bool_t Yushan_Intr_Enable(uint8_t *pIntrMask)
+{
+	
+	
+	uint8_t		bTotalEventInASet, *pSpiData, *pCompSpiData;
+	uint8_t		bIntrCount = 1, bIntr32Count = 1, bIntrCountInSet = 0, bIntrSetID = 0;
+	uint16_t	uwIntrSetOffset;
+	uint32_t	udwLocalIntrMask, udwInterruptSetting, *pLocalIntrMask, udwSpiData = 0, udwCompSpiData = 0;
+	uint32_t	udwLocalCompSPIMask = 0;
+	uint16_t	ByteCount = 0;
+
+	
+	uint8_t		bFirstIndexForSet[] = EVENT_FIRST_INDEXFORSET;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	
+	pLocalIntrMask = (uint32_t *)(pIntrMask);
+	udwLocalIntrMask	= *pLocalIntrMask;
+
+	pSpiData = (uint8_t *)(&udwSpiData);
+	pCompSpiData = (uint8_t *)(&udwCompSpiData);
+
+	
+	bTotalEventInASet = (bFirstIndexForSet[bIntrSetID+1] - bFirstIndexForSet[bIntrSetID]);
+
+	
+	while (bIntrCount <= (TOTAL_INTERRUPT_COUNT+1)) {
+		if (bIntrCountInSet == bTotalEventInASet) {
+			
+			uwIntrSetOffset = (bIntrSetID*INTERRUPT_SET_SIZE);
+
+			
+			if (bTotalEventInASet == 32)
+				udwLocalCompSPIMask = 0x00000000;
+			else
+				udwLocalCompSPIMask = (uint32_t)(0xFFFFFFFF<<bTotalEventInASet);
+			udwCompSpiData = (uint32_t)(~(udwSpiData|udwLocalCompSPIMask));
+
+			
+			
+			if (gPllLocked) {
+				
+				ByteCount = (uint16_t)((bTotalEventInASet+7)>>3);
+				
+				if (udwSpiData != 0)
+					
+					SPI_Write((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_ENABLE), ByteCount, pSpiData);
+				
+				if (udwCompSpiData != 0)
+					
+					SPI_Write((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_DISABLE), ByteCount, pCompSpiData);
+			} else {
+				
+				if (udwSpiData != 0) {
+					
+					SPI_Write((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_ENABLE), 1, pSpiData);
+				SPI_Write((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_ENABLE+1), 1, pSpiData+1);
+				SPI_Write((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_ENABLE+2), 1, pSpiData+2);
+				SPI_Write((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_ENABLE+3), 1, pSpiData+3);
+			}
+			
+			
+			
+				if (udwCompSpiData != 0) {
+					
+					SPI_Write((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_DISABLE), 1, pCompSpiData);
+					SPI_Write((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_DISABLE+1), 1, pCompSpiData+1);
+					SPI_Write((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_DISABLE+2), 1, pCompSpiData+2);
+					SPI_Write((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_DISABLE+3), 1, pCompSpiData+3);
+				}
+			}
+
+			
+			bIntrCountInSet = 0;
+			udwSpiData = 0;
+
+			
+			bIntr32Count--;
+			bIntrCount--;
+			
+			bIntrSetID++;
+
+			
+				bTotalEventInASet = (bFirstIndexForSet[bIntrSetID+1] - bFirstIndexForSet[bIntrSetID]);
+		} else {
+			
+			udwInterruptSetting = ((udwLocalIntrMask>>(bIntr32Count-1))&0x01);
+			
+			udwSpiData |= (udwInterruptSetting<<(bIntrCountInSet));
+
+			
+			bIntrCountInSet++;
+		}
+
+		
+		if (!(bIntr32Count % 32)) {
+			
+			bIntr32Count = 1;
+			
+			pLocalIntrMask++;
+			udwLocalIntrMask	= *pLocalIntrMask;
+		} else
+			bIntr32Count++;
+
+		
+		bIntrCount++;
+	}
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return SUCCESS;
+}
+
+
+
+
+void Yushan_Intr_Status_Read(uint8_t *bListOfInterrupts,	bool_t	fSelect_Intr_Pad)
+{
+	uint16_t	uwSpiData = 0, 	uwListOfITRGrpToPad1 = 0, RaisedGrpForPAD = 0;
+	uint8_t		bIntrSetID = 0;
+	bool_t		fStatus = SUCCESS;
+	uint8_t		bSpiData = 0;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	VERBOSELOG("[CAM] %s: Check for interrupts on Pad%i\n", __func__, fSelect_Intr_Pad);
+
+	
+	memset((void *)bListOfInterrupts, 0, 96/8);
+
+	
+	if (gPllLocked) {
+		SPI_Read(YUSHAN_IOR_NVM_SEND_ITR_PAD1, 2, (uint8_t	*)&uwListOfITRGrpToPad1);
+	} else {
+		fStatus &= SPI_Read(YUSHAN_IOR_NVM_SEND_ITR_PAD1, 1, (uint8_t *)(&bSpiData));
+		uwListOfITRGrpToPad1 = (uint16_t) bSpiData;
+		fStatus &= SPI_Read(YUSHAN_IOR_NVM_SEND_ITR_PAD1+1, 1, (uint8_t *)(&bSpiData));
+		uwListOfITRGrpToPad1 |= (((uint16_t) bSpiData)<<8);
+	}
+
+
+	if(fSelect_Intr_Pad==INTERRUPT_PAD_0)
+		uwListOfITRGrpToPad1	=	~uwListOfITRGrpToPad1;
+
+	if (gPllLocked) {
+		fStatus &= SPI_Read(YUSHAN_IOR_NVM_INTR_STATUS, 2, (uint8_t *)(&uwSpiData));
+	} else {
+		fStatus &= SPI_Read(YUSHAN_IOR_NVM_INTR_STATUS, 1, (uint8_t *)(&bSpiData));
+		uwSpiData = (uint16_t) bSpiData;
+		fStatus &= SPI_Read(YUSHAN_IOR_NVM_INTR_STATUS+1, 1, (uint8_t *)(&bSpiData));
+		uwSpiData |= ( ((uint16_t) bSpiData)<<8 );
+	}
+
+	RaisedGrpForPAD = uwSpiData & uwListOfITRGrpToPad1;
+	while (bIntrSetID < TOTAL_INTERRUPT_SETS) {
+		if ((RaisedGrpForPAD>>bIntrSetID)&0x01) {
+			
+			Yushan_Read_IntrEvent(bIntrSetID, (uint32_t *)bListOfInterrupts);
+		}
+		
+		bIntrSetID++;
+	}
+
+	VERBOSELOG("[CAM] %s: Read interrupts status:0x%08x, 0x%08x, 0x%08x\n", __func__, *((uint32_t *)bListOfInterrupts), *(((uint32_t *)bListOfInterrupts)+1), *(((uint32_t *)bListOfInterrupts)+2));
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+}
+
+
+
+
+
+void Yushan_Read_IntrEvent(uint8_t bIntrSetID, uint32_t *udwListOfInterrupts)
+{
+
+	uint8_t		bInterruptID, bTotalEventInASet, bIntrCountInSet = 0, bTempIntrStatus = 0;
+	uint8_t		bFirstIndexForSet[] = EVENT_FIRST_INDEXFORSET;
+	uint16_t	uwIntrSetOffset;
+	uint32_t	udwIntrStatus = 0, udwIntrEnableStatus = 0, udwCombinedStatus = 0;
+	uint16_t	ByteCount = 0;
+
+	bTotalEventInASet = (bFirstIndexForSet[bIntrSetID + 1] - bFirstIndexForSet[bIntrSetID]);
+
+	
+	uwIntrSetOffset = (bIntrSetID * INTERRUPT_SET_SIZE);
+
+
+	if (gPllLocked) {	
+		
+		ByteCount = (uint16_t)((bTotalEventInASet+7)>>3);
+		
+		SPI_Read((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset), ByteCount, (uint8_t *)(&udwIntrStatus));
+		
+		SPI_Read((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_ENABLE_STATUS), ByteCount, (uint8_t *)(&udwIntrEnableStatus));
+	} else {
+		SPI_Read((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset),   1, (uint8_t *)(&bTempIntrStatus));
+		udwIntrStatus = (uint32_t)(bTempIntrStatus);
+		SPI_Read((uint16_t)((YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset)+1), 1, (uint8_t *)(&bTempIntrStatus));
+		udwIntrStatus |= ((uint32_t)(bTempIntrStatus))<<8;
+		SPI_Read((uint16_t)((YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset)+2), 1, (uint8_t *)(&bTempIntrStatus));
+		udwIntrStatus |= ((uint32_t)(bTempIntrStatus))<<16;
+		SPI_Read((uint16_t)((YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset)+3), 1, (uint8_t *)(&bTempIntrStatus));
+		udwIntrStatus |= ((uint32_t)(bTempIntrStatus))<<24;
+
+		
+		SPI_Read((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_ENABLE_STATUS),    1, (uint8_t *)(&bTempIntrStatus));
+		udwIntrEnableStatus = (uint32_t)(bTempIntrStatus);
+		SPI_Read((uint16_t)((YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_ENABLE_STATUS) +1), 1, (uint8_t *)(&bTempIntrStatus));
+		udwIntrEnableStatus |= ((uint32_t)(bTempIntrStatus))<<8;
+		SPI_Read((uint16_t)((YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_ENABLE_STATUS) +2), 1, (uint8_t *)(&bTempIntrStatus));
+		udwIntrEnableStatus |= ((uint32_t)(bTempIntrStatus))<<16;
+		SPI_Read((uint16_t)((YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_ENABLE_STATUS) +3), 1, (uint8_t *)(&bTempIntrStatus));
+		udwIntrEnableStatus |= ((uint32_t)(bTempIntrStatus))<<24;
+	}
+
+	DEBUGLOG("[CAM] udwIntrStatus:  0x%x, udwIntrEnableStatus: 0x%x\n", udwIntrStatus, udwIntrEnableStatus);
+	udwCombinedStatus = (udwIntrStatus & udwIntrEnableStatus);
+	
+	while (bIntrCountInSet < bTotalEventInASet) {
+		if ((udwCombinedStatus>>bIntrCountInSet) & 0x01) {
+			bInterruptID = (bFirstIndexForSet[bIntrSetID] + bIntrCountInSet);
+
+			Yushan_AddnRemoveIDInList(bInterruptID, udwListOfInterrupts, ADD_INTR_TO_LIST);
+
+		}
+		bIntrCountInSet++;
+	}
+}
+
+
+
+bool_t Yushan_Intr_Status_Clear(uint8_t *bListOfInterrupts)
+{
+	uint8_t		bTotalEventInASet; 
+	uint8_t		bIntrCount = 1, bIntr32Count = 1, bIntrCountInSet = 0, bIntrSetID = 0;
+	uint16_t	uwIntrSetOffset;
+	uint32_t	udwLocalIntrMask, udwInterruptSetting, *pLocalIntrMask, udwSpiData = 0;
+	uint16_t	ByteCount = 0;
+
+	
+	uint8_t		bFirstIndexForSet[] = EVENT_FIRST_INDEXFORSET;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+
+	pLocalIntrMask = (uint32_t *) bListOfInterrupts; 
+	udwLocalIntrMask	= *pLocalIntrMask;
+
+	
+	bTotalEventInASet = (bFirstIndexForSet[bIntrSetID+1] - bFirstIndexForSet[bIntrSetID]);
+
+	
+	while (bIntrCount <= (TOTAL_INTERRUPT_COUNT + 1)) {
+		if (bIntrCountInSet == bTotalEventInASet) {
+			
+			if (udwSpiData != 0) {
+				
+				ByteCount = (uint16_t)((bTotalEventInASet+7)>>3);
+				
+				uwIntrSetOffset = (bIntrSetID * INTERRUPT_SET_SIZE);
+				
+				
+				
+				
+				
+				SPI_Write((uint16_t)(YUSHAN_INTR_BASE_ADDR + uwIntrSetOffset + YUSHAN_OFFSET_INTR_STATUS_CLEAR), ByteCount, (uint8_t *)(&udwSpiData));
+			}
+
+			
+			bIntrCountInSet = 0;
+			udwSpiData = 0;
+
+			
+			bIntr32Count--;
+			bIntrCount--;
+			
+			bIntrSetID++;
+
+			
+			bTotalEventInASet = (bFirstIndexForSet[bIntrSetID + 1] - bFirstIndexForSet[bIntrSetID]);
+		} else {
+			
+			udwInterruptSetting = ((udwLocalIntrMask>>(bIntr32Count-1))&0x01);
+			
+			udwSpiData |= (udwInterruptSetting<<(bIntrCountInSet));
+			
+			bIntrCountInSet++;
+		}
+
+		
+		if (!(bIntr32Count % 32)) {
+			
+			bIntr32Count = 1;
+
+			
+			pLocalIntrMask++;
+			udwLocalIntrMask	= *pLocalIntrMask;
+		} else
+			bIntr32Count++;
+
+
+		
+		bIntrCount++;
+
+	}
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return SUCCESS;
+}
+
+
+
+bool_t	Yushan_Check_Pad_For_IntrID(uint8_t	bInterruptId)
+{
+
+	uint8_t		bFirstIndexForSet[] = EVENT_FIRST_INDEXFORSET;
+	uint8_t		bIntrSetID = 0;
+	uint16_t	uwIntrSetsDivertedToPad1 = 0;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	
+	SPI_Read(YUSHAN_IOR_NVM_SEND_ITR_PAD1 , 2, (uint8_t	*)&uwIntrSetsDivertedToPad1);
+
+	
+	while (bIntrSetID < TOTAL_INTERRUPT_SETS) {
+		if ((bInterruptId >= bFirstIndexForSet[bIntrSetID]) && (bInterruptId < bFirstIndexForSet[bIntrSetID+1])) {
+			if ((uwIntrSetsDivertedToPad1>>bIntrSetID)&0x01) {
+				VERBOSELOG("[CAM] %s: End\n", __func__);
+				return INTERRUPT_PAD_1;
+			} else {
+				VERBOSELOG("[CAM] %s: End\n", __func__);
+				return INTERRUPT_PAD_0;
+			}
+		} else
+			bIntrSetID++;
+	}
+
+	
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return INTERRUPT_PAD_0;
+
+}
+
+
+bool_t Yushan_CheckForInterruptIDInList(uint8_t bInterruptID, uint32_t *udwProtoInterruptList)
+{
+
+	bool_t		fStatus = 0;
+	uint8_t		bIntrDWordInList, bIndexInCurrentDWord;
+	uint32_t	*pListOfInterrupt;
+
+
+	
+	pListOfInterrupt =  udwProtoInterruptList;
+
+
+	if ((1<=bInterruptID)&&(bInterruptID<=32))
+		bIntrDWordInList = 0;
+	else if ((33<=bInterruptID)&&(bInterruptID<=64))
+		bIntrDWordInList = 1;
+	else
+		bIntrDWordInList = 2;
+
+	
+	pListOfInterrupt = pListOfInterrupt + bIntrDWordInList;
+
+	bIndexInCurrentDWord = (bInterruptID - (bIntrDWordInList*32)) - 1;
+
+
+	
+	fStatus = (bool_t)(((*pListOfInterrupt)>>bIndexInCurrentDWord) & 0x00000001);
+
+	return fStatus;
+
+}
+
+
+
+
+void Yushan_AddnRemoveIDInList(uint8_t bInterruptID, uint32_t *udwListOfInterrupts, bool_t fAddORClear)
+{
+
+	uint8_t		bIntrDWordInList, bIndexInCurrentDWord;
+	uint32_t	*pListOfInterrupt, udwTempIntrList, udwMask = 0x00000001;
+
+	
+	pListOfInterrupt = udwListOfInterrupts;
+
+	if ((1<=bInterruptID)&&(bInterruptID<=32))
+		bIntrDWordInList = 0;
+	else if ((33<=bInterruptID)&&(bInterruptID<=64))
+		bIntrDWordInList = 1;
+	else
+		bIntrDWordInList = 2;
+
+	
+	pListOfInterrupt = pListOfInterrupt + bIntrDWordInList;
+
+	
+	bIndexInCurrentDWord = (bInterruptID - (bIntrDWordInList*32)) - 1;
+
+	
+	
+
+	
+	if (fAddORClear == ADD_INTR_TO_LIST) {
+		
+		udwTempIntrList = ( ((*pListOfInterrupt)>>(bIndexInCurrentDWord)) | udwMask ); 
+		*pListOfInterrupt |= (udwTempIntrList << (bIndexInCurrentDWord));
+	} else if (fAddORClear == DEL_INTR_FROM_LIST) {
+		
+		udwTempIntrList = ( ((*pListOfInterrupt)>>(bIndexInCurrentDWord)) & udwMask ); 
+		*pListOfInterrupt &= ~(udwTempIntrList << (bIndexInCurrentDWord));
+	}
+
+
+}
+
+
+
+
+
+
+
+
+void	Yushan_DCPX_CPX_Enable(void)
+{
+
+	uint8_t	bSpiData = 0;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	
+	bSpiData = 0x01;
+	SPI_Write(YUSHAN_SMIA_DCPX_ENABLE, 1, &bSpiData); 
+	bSpiData = 0x08;
+	SPI_Write(YUSHAN_SMIA_DCPX_MODE_REQ, 1, &bSpiData); 
+	bSpiData = 0x0A;
+	SPI_Write(YUSHAN_SMIA_DCPX_MODE_REQ+1, 1, &bSpiData); 
+
+	
+	bSpiData = 0x01;
+	SPI_Write(YUSHAN_SMIA_CPX_CTRL_REQ, 1, &bSpiData); 
+	
+	SPI_Write(YUSHAN_SMIA_CPX_MODE_REQ, 1, &bSpiData); 
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+}
+
+
+uint8_t Yushan_GetCurrentStreamingMode(void)
+{
+	uint8_t bSpiData,currentEvent;
+	uint8_t CurrentStreamingMode;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	
+	SPI_Read(YUSHAN_T1_DMA_REG_STATUS, 1, &bSpiData);
+
+	currentEvent = (bSpiData&0x70)>>4;
+	switch (currentEvent) {
+	case 1:
+		CurrentStreamingMode = YUSHAN_FRAME_FORMAT_STILL_MODE;
+		break;
+	case 2:
+		CurrentStreamingMode = YUSHAN_FRAME_FORMAT_VF_MODE;
+		break;
+	default:
+		
+		CurrentStreamingMode = 255;
+	}
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return CurrentStreamingMode;
+}
+
+
+bool_t	Yushan_Context_Config_Update(Yushan_New_Context_Config_t	*sYushanNewContextConfig)
+{
+
+	
+	uint8_t		bVfStillIndex, bVFIndex, bStillIndex, bVFMask=0;
+	
+	uint8_t		bDataType=0, bCurrentDataType=0, bActiveDatatype=1, bRawFormat=0, bWCAlreadyPresent = 0;
+	
+	uint8_t		bPixClkDiv=0, bDxoClkDiv=0, bCount=0;
+	uint16_t	uwNewHSize=0, uwLecci=0;
+	uint32_t	udwSpiData = 0;
+	uint16_t	wordCount = 0;
+	uint8_t		bCurrentStreamingMode;
+	
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	
+	bCurrentStreamingMode = Yushan_GetCurrentStreamingMode();
+	if (bCurrentStreamingMode == YUSHAN_FRAME_FORMAT_STILL_MODE) {
+		
+		sYushanNewContextConfig->bSelectStillVfMode = YUSHAN_FRAME_FORMAT_VF_MODE;
+	} else {
+		if (bCurrentStreamingMode == YUSHAN_FRAME_FORMAT_VF_MODE) {
+		
+		sYushanNewContextConfig->bSelectStillVfMode = YUSHAN_FRAME_FORMAT_STILL_MODE;
+		}
+	}
+
+	
+	
+	
+	
+
+	if ((sYushanNewContextConfig->uwPixelFormat&0x0F)==0x0A){
+		bRawFormat = RAW10;
+		bDataType  = 0x2b;
+	} else if((sYushanNewContextConfig->uwPixelFormat&0x0F)==0x08) {
+		bRawFormat= RAW8; 
+		if(((sYushanNewContextConfig->uwPixelFormat>>8)&0x0F)==0x08)
+			bDataType = 0x2a;
+		else 
+			bDataType = 0x30; 
+	}
+
+	
+	SPI_Read(YUSHAN_IDP_GEN_CONTROL, 1, (uint8_t *)(&bVfStillIndex));
+	bVFIndex = bVfStillIndex&0x0F;
+	bStillIndex = (bVfStillIndex&0xF0)>>4;
+
+	
+	uwNewHSize = sYushanNewContextConfig->uwActivePixels;
+
+	for (bCount = 0; bCount < 13; bCount++) {
+		SPI_Read((uint16_t)(YUSHAN_IDP_GEN_WC_DI_0+4*bCount),4,(unsigned char*)&udwSpiData);
+		wordCount = udwSpiData & 0x0000ffff; 
+		if (wordCount==0) 
+			break;
+
+		bCurrentDataType = (udwSpiData>>16);							
+		udwSpiData = ((udwSpiData&0xFFFF)*8)/bRawFormat;				
+		
+		
+		if ((uwNewHSize == udwSpiData) && (bCurrentDataType == bDataType)) {
+			bWCAlreadyPresent = 1;
+			if((bCount==bVFIndex)||(bCount==bStillIndex)) {
+				VERBOSELOG("[CAM] %s: End\n", __func__);
+				return SUCCESS;			
+			} else
+				break;					
+		}
+	}
+
+	
+	
+	SPI_Read(YUSHAN_IDP_GEN_CONTROL, 4, (uint8_t *)(&udwSpiData));
+	if (sYushanNewContextConfig->bSelectStillVfMode == YUSHAN_FRAME_FORMAT_VF_MODE) {
+		udwSpiData &= 0xFFFFFFF0;
+		udwSpiData |= bCount;
+		
+		bVFMask = 1;
+	} else if (sYushanNewContextConfig->bSelectStillVfMode == YUSHAN_FRAME_FORMAT_STILL_MODE) {
+		udwSpiData &= 0xFFFFFF0F;
+		udwSpiData |= bCount << 4;
+		
+		bVFMask = 0;
+	}
+
+	
+	SPI_Write((uint16_t)(YUSHAN_IDP_GEN_CONTROL), 4, (uint8_t *)(&udwSpiData));
+
+	
+	if (bWCAlreadyPresent && (bCount != 13)) {
+		
+		SPI_Write((uint16_t)((YUSHAN_IDP_GEN_WC_DI_0+(4*bCount))+3),	1,	(unsigned char*)&bActiveDatatype);
+	} else if (bCount != 13) {
+		
+		
+		udwSpiData=(sYushanNewContextConfig->uwActivePixels*bRawFormat)/8;
+		SPI_Write((uint16_t)(YUSHAN_CSI2_TX_PACKET_SIZE_0+0xc*bCount),	4,	(unsigned char*)&udwSpiData);
+
+		SPI_Write((uint16_t)(YUSHAN_CSI2_TX_DI_INDEX_CTRL_0+0xc*bCount),	1,	(unsigned char*)&bDataType);
+
+		udwSpiData = udwSpiData | (bDataType<<16) | (bActiveDatatype<<24);
+		SPI_Write((uint16_t)(YUSHAN_IDP_GEN_WC_DI_0+4*bCount),	4,	(unsigned char*)&udwSpiData);
+	} else {
+		
+		ERRORLOG("[CAM] %s: Error, No entry vacant. Exiting ...\n", __func__);
+		return FAILURE;
+	}
+	
+	
+	
+	udwSpiData = (uwNewHSize & 0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT + bVFMask),1,(unsigned char*)&udwSpiData);
+	udwSpiData = ((uwNewHSize>>8)&0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+8+ bVFMask),1,(unsigned char*)&udwSpiData);
+
+	
+	udwSpiData=(uwNewHSize & 0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+24+ bVFMask),1,(unsigned char*)&udwSpiData);
+	udwSpiData=((uwNewHSize>>8)&0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+32+ bVFMask),1,(unsigned char*)&udwSpiData);
+
+	
+	udwSpiData=(uwNewHSize & 0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+48+ bVFMask),1,(unsigned char*)&udwSpiData);
+	udwSpiData=((uwNewHSize>>8)&0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+56+ bVFMask),1,(unsigned char*)&udwSpiData);
+
+	
+	udwSpiData=(uwNewHSize & 0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+72+ bVFMask),1,(unsigned char*)&udwSpiData);
+	udwSpiData=((uwNewHSize>>8)&0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+80+ bVFMask),1,(unsigned char*)&udwSpiData);
+
+	
+	udwSpiData=(uwNewHSize & 0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+88+ bVFMask),1,(unsigned char*)&udwSpiData);
+	udwSpiData=((uwNewHSize>>8)&0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+96+ bVFMask),1,(unsigned char*)&udwSpiData);
+
+	
+	udwSpiData=(uwNewHSize & 0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+104+ bVFMask),1,(unsigned char*)&udwSpiData);
+	udwSpiData=((uwNewHSize>>8)&0xFF);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+112+ bVFMask),1,(unsigned char*)&udwSpiData);
+
+	
+	
+	SPI_Read(YUSHAN_CLK_DIV_FACTOR,1,(unsigned char*)&bDxoClkDiv); 
+	SPI_Read(YUSHAN_CLK_DIV_FACTOR+1,1,(unsigned char*)&bPixClkDiv); 
+
+	if ((bDxoClkDiv !=0) && (bPixClkDiv !=0))
+		uwLecci = (sYushanNewContextConfig->uwLineBlank*bPixClkDiv)/ bDxoClkDiv;
+	else
+		uwLecci = 300;
+
+	
+	udwSpiData=(uwLecci&0xff);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+120+bVFMask),1,(unsigned char*)&udwSpiData);
+
+	udwSpiData=((uwLecci>>8)&0xff);
+	SPI_Write((uint16_t)(YUSHAN_T1_DMA_MEM_LOWER_ELT+128+bVFMask),1,(unsigned char*)&udwSpiData);
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return SUCCESS;
+
+
+}
+
+
+
+
+
+bool_t Yushan_Update_DxoDop_Af_Strategy(uint8_t  bAfStrategy)
+{
+	bool_t	fStatus = SUCCESS;
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	
+#if DxODOP_dfltVal_ucode_id_15_8 == 2
+	fStatus = SPI_Write(DXO_DOP_BASE_ADDR+DxODOP_af_strategy_7_0, 1, &bAfStrategy);
+#else
+	VERBOSELOG("[CAM] %s: DOP used not compatiblewith this function\n", __func__);
+#endif
+	VERBOSELOG("[CAM] %s: End with Status:%i\n", __func__, fStatus);
+	return fStatus;
+}
+
+
+
+bool_t Yushan_AF_ROI_Update(Yushan_AF_ROI_t  *sYushanAfRoi, uint8_t bNumOfActiveRoi) 
+{
+
+	uint8_t		bSpiData[4];
+	uint8_t		bStatus = SUCCESS, bCount=0;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	if (!bNumOfActiveRoi) { 
+		DEBUGLOG("[CAM] %s:No ROI Activated so exiting with SUCCESS\n", __func__);
+		return SUCCESS;
+	} else {
+		
+		bStatus &= SPI_Write(DXO_DOP_BASE_ADDR+DxODOP_ROI_active_number_7_0, 1, (uint8_t*)(&bNumOfActiveRoi));
+	}
+
+	
+
+	
+	while (bCount < bNumOfActiveRoi) {
+		bSpiData[0] = (sYushanAfRoi->bXStart);
+		bSpiData[1] = (sYushanAfRoi->bYStart);
+		bSpiData[2] = (sYushanAfRoi->bXEnd);
+		bSpiData[3] = (sYushanAfRoi->bYEnd);
+
+		
+		
+		bStatus &= SPI_Write((uint16_t)(DXO_DOP_BASE_ADDR+DxODOP_ROI_0_x_start_7_0 + bCount*4), 4, (uint8_t*)(&bSpiData[0]));
+		
+		bCount++;
+
+		
+		sYushanAfRoi++;
+	}
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return bStatus;
+}
+
+
+
+
+bool_t Yushan_Enter_Standby_Mode(void)
+{
+	uint8_t		bSpiData;
+	uint32_t	udwSpiData;
+	bool_t		fStatus = SUCCESS;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	
+	bSpiData = 0;
+	fStatus &= SPI_Write(YUSHAN_MIPI_RX_ENABLE, 1, (uint8_t*)(&bSpiData));
+	fStatus &= SPI_Write(YUSHAN_MIPI_TX_ENABLE, 1, (uint8_t*)(&bSpiData));
+
+
+	
+	
+	
+	
+	SPI_Read(YUSHAN_CLK_CTRL,   1, (uint8_t*)(&bSpiData));		
+	SPI_Read(YUSHAN_CLK_CTRL+2, 2, (uint8_t*)(&udwSpiData));	
+	udwSpiData = (bSpiData | (udwSpiData<<16));
+
+	
+	bSpiData = 0x00;
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL, 1, (uint8_t*)(&bSpiData));
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+2, 1, (uint8_t*)(&bSpiData)); 
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+3, 1, (uint8_t*)(&bSpiData)); 
+
+	
+	SPI_Read(YUSHAN_CLK_CTRL+1, 1, (uint8_t*)(&bSpiData));
+	bSpiData &= 0xFE;	
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+1, 1, (uint8_t*)(&bSpiData));
+
+	
+	
+	bSpiData |= ((bSpiData>>1)|0x01)<<1;						
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+1, 1, (uint8_t*)(&bSpiData));
+
+	
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL, 1, (uint8_t*)(&udwSpiData));		
+	udwSpiData = (udwSpiData >> 16);										
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+2, 1, (uint8_t*)(&udwSpiData));	
+	udwSpiData = (udwSpiData >> 8);
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+3, 1, (uint8_t*)(&udwSpiData));	
+	 
+	
+	SPI_Read(YUSHAN_PLL_CTRL_MAIN, 1, (uint8_t*)(&bSpiData));
+	bSpiData |= 0x01;			
+	fStatus &= SPI_Write(YUSHAN_PLL_CTRL_MAIN, 1, (uint8_t*)(&bSpiData));
+
+	
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return fStatus;
+
+
+}
+
+
+
+
+bool_t Yushan_Exit_Standby_Mode(Yushan_Init_Struct_t * sInitStruct)
+{
+	uint8_t		bSpiData;
+	uint32_t	udwSpiData;
+	bool_t		fStatus = SUCCESS;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	
+
+	
+	SPI_Read(YUSHAN_PLL_CTRL_MAIN, 1, (uint8_t*)(&bSpiData));
+	bSpiData &= 0xFE;	
+	SPI_Write(YUSHAN_PLL_CTRL_MAIN, 1, (uint8_t*)(&bSpiData));
+
+	fStatus &= Yushan_WaitForInterruptEvent(EVENT_PLL_STABLE, TIME_100MS);
+	
+	if (!fStatus) {
+		ERRORLOG("[CAM] %s: Error: EVENT_PLL_STABLE not received. Exiting...\n", __func__);
+		return fStatus;
+	}
+
+	
+	
+	SPI_Read(YUSHAN_CLK_CTRL,   1, (uint8_t*)(&bSpiData));		
+	udwSpiData = (uint32_t)(bSpiData);
+	SPI_Read(YUSHAN_CLK_CTRL+2, 1, (uint8_t*)(&bSpiData));		
+	udwSpiData |= (((uint32_t)(bSpiData))<<8);
+	SPI_Read(YUSHAN_CLK_CTRL+3, 1, (uint8_t*)(&bSpiData));		
+	udwSpiData |= (((uint32_t)(bSpiData))<<16);
+
+
+	
+	bSpiData = 0x00;
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL, 1, (uint8_t*)(&bSpiData));
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+2, 1, (uint8_t*)(&bSpiData));		
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+3, 1, (uint8_t*)(&bSpiData));		
+
+	
+	SPI_Read(YUSHAN_CLK_CTRL+1, 1, (uint8_t*)(&bSpiData));
+	bSpiData &= (bSpiData&0xFD);						
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+1, 1, (uint8_t*)(&bSpiData));
+
+	
+	
+	bSpiData |= 0x01;											
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+1, 1, (uint8_t*)(&bSpiData));
+	
+	
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL, 1, (uint8_t*)(&udwSpiData));		
+	udwSpiData = (udwSpiData >> 16);										
+	fStatus &= SPI_Write(YUSHAN_CLK_CTRL+2, 2, (uint8_t*)(&udwSpiData));	
+
+
+	
+	if ( sInitStruct->bNumberOfLanes == 1)
+		udwSpiData=0x11; 
+	else
+	if ( sInitStruct->bNumberOfLanes == 2)
+		udwSpiData=0x31; 
+	else
+	if ( sInitStruct->bNumberOfLanes == 4)
+		udwSpiData=0xf1; 
+
+	fStatus &= SPI_Write(YUSHAN_MIPI_RX_ENABLE, 1,(uint8_t*)(&udwSpiData)); 
+	udwSpiData |= 0x02; 
+	fStatus &= SPI_Write(YUSHAN_MIPI_TX_ENABLE, 1,(uint8_t*)(&udwSpiData));
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return fStatus;
+
+}
+
+
+
+
+bool_t Yushan_Swap_Rx_Pins (bool_t fClkLane, bool_t fDataLane1, bool_t fDataLane2, bool_t fDataLane3, bool_t fDataLane4)
+{
+	bool_t		fStatus; 
+	uint8_t		bSpiData = 0;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	bSpiData = (fClkLane | (fDataLane1<<4) | (fDataLane2<<5) | (fDataLane3<<6) | (fDataLane4<<7));
+
+	DEBUGLOG("[CAM] %s:Spi data for Swapping Rx pins is %4.4x\n", __func__, bSpiData);
+
+	fStatus = SPI_Write(YUSHAN_MIPI_RX_SWAP_PINS, 1, &bSpiData);
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return fStatus;
+
+}
+
+
+
+bool_t Yushan_Invert_Rx_Pins (bool_t fClkLane, bool_t fDataLane1, bool_t fDataLane2, bool_t fDataLane3, bool_t fDataLane4)
+{
+
+	bool_t		fStatus; 
+	uint8_t		bSpiData = 0;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	bSpiData = (fClkLane | (fDataLane1<<4) | (fDataLane2<<5) | (fDataLane3<<6) | (fDataLane4<<7));
+	VERBOSELOG("[CAM] %s:Spi data for Inverting Rx pins is %4.4x\n", __func__, bSpiData);
+
+	fStatus = SPI_Write(YUSHAN_MIPI_RX_INVERT_HS, 1, &bSpiData);
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return fStatus;
+}
+
+
+
+
+bool_t Yushan_Assert_Reset(uint32_t udwModuleMask, uint8_t bResetORDeReset)
+{
+	uint8_t bCurrentModuleToReset, bCurrentModule=0;
+	uint8_t	bSpiData;
+	bool_t	bSetORReset;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	if (!(udwModuleMask & 0xFFFFFFFF)) {
+		ERRORLOG("[CAM] %s:Mask not given for reset/dereset. Returning FAILURE\n", __func__);
+		return FAILURE;	
+	}
+
+	while (bCurrentModule < TOTAL_MODULES) {
+
+		bSetORReset = ((udwModuleMask>>bCurrentModule) & 0x01);
+
+		
+		if (!bSetORReset) {
+			bCurrentModule++;
+			pr_info("[CAM] Current Module is %d\n", bCurrentModule);
+			continue;
+		} else {
+			bCurrentModuleToReset = bCurrentModule + 1;
+			bCurrentModule++;
+		}
+
+
+		
+		if (bResetORDeReset)
+			
+			bSpiData = 0x11;
+		else
+			
+			bSpiData = 0x01;
+
+		
+		pr_info("[CAM] Current module is %d and Module to reset/Dereset is %d\n", bCurrentModule, bCurrentModuleToReset);
+		
+		
+		switch (bCurrentModuleToReset) {
+#if 0
+			case DFT_RESET:
+				break;
+#endif
+			case T1_DMA:
+				SPI_Write(YUSHAN_T1_DMA_REG_ENABLE, 1, &bSpiData);
+				break;
+			case CSI2_RX:
+				
+				if(bResetORDeReset)
+					
+					bSpiData = 0x70;
+				else
+					
+					bSpiData = 0x00;
+
+				SPI_Write(YUSHAN_CSI2_RX_ENABLE, 1, &bSpiData);
+				
+				
+				if(bResetORDeReset)
+					
+					bSpiData = 0x11;
+				else
+					
+					bSpiData = 0x01;
+				break;
+			case IT_POINT:
+				SPI_Write(YUSHAN_ITPOINT_ENABLE, 1, &bSpiData);
+				break;
+			case IDP_GEN:
+
+				
+				SPI_Read(YUSHAN_IDP_GEN_AUTO_RUN, 1, &bSpiData);
+
+				if(bResetORDeReset)
+					bSpiData |= 0x10;
+				else
+					bSpiData &=0x01;
+				SPI_Write(YUSHAN_IDP_GEN_AUTO_RUN, 1, &bSpiData);
+
+				break;
+			case MIPI_RX_DTCHK:
+				SPI_Write(YUSHAN_MIPI_RX_DTCHK_ENABLE, 1, &bSpiData);
+				break;
+			case SMIA_PATTERN_GEN:
+				SPI_Write(YUSHAN_PATTERN_GEN_ENABLE, 1, &bSpiData);
+				break;
+			case SMIA_DCPX:
+				SPI_Write(YUSHAN_SMIA_DCPX_ENABLE, 1, &bSpiData);
+				break;
+			case P2W_FIFO_WR:
+				
+				if(bResetORDeReset)
+					
+					bSpiData = 0x03;
+				else
+					
+					bSpiData = 0x00;
+
+				SPI_Write(YUSHAN_P2W_FIFO_WR_CTRL, 1, &bSpiData);
+				
+				
+				if(bResetORDeReset)
+					
+					bSpiData = 0x11;
+				else
+					
+					bSpiData = 0x01;
+
+				break;
+			case P2W_FIFO_RD:
+				
+				if(bResetORDeReset)
+					
+					bSpiData = 0x03;
+				else
+					
+					bSpiData = 0x00;
+
+				SPI_Write(YUSHAN_P2W_FIFO_RD_CTRL, 1, &bSpiData);
+				
+				
+				if(bResetORDeReset)
+					
+					bSpiData = 0x11;
+				else
+					
+					bSpiData = 0x01;
+
+				break;
+			case CSI2_TX_WRAPPER:
+				if(bResetORDeReset)
+					
+					bSpiData = 0x01;
+				else
+					
+					bSpiData = 0x00;
+
+				SPI_Write(YUSHAN_CSI2_TX_WRAPPER_CTRL, 1, &bSpiData);
+				
+				
+				if(bResetORDeReset)
+					
+					bSpiData = 0x11;
+				else
+					
+					bSpiData = 0x01;
+
+				break;
+
+			case CSI2_TX:
+				SPI_Write(YUSHAN_CSI2_TX_ENABLE, 1, &bSpiData);
+				break;
+			case LINE_FILTER_BYPASS:
+				SPI_Write(YUSHAN_LINE_FILTER_BYPASS_ENABLE, 1, &bSpiData);
+				break;
+			case DT_FILTER_BYPASS:
+				SPI_Write(YUSHAN_DTFILTER_BYPASS_ENABLE, 1, &bSpiData);
+				break;
+			case LINE_FILTER_DXO:
+				SPI_Write(YUSHAN_LINE_FILTER_DXO_ENABLE, 1, &bSpiData);
+				break;
+			case DT_FILTER_DXO:
+				SPI_Write(YUSHAN_DTFILTER_DXO_ENABLE, 1, &bSpiData);
+				break;
+			case EOF_RESIZE_PRE_DXO:
+				SPI_Write(YUSHAN_EOF_RESIZE_PRE_DXO_ENABLE, 1, &bSpiData);
+				break;
+			case LBE_PRE_DXO:
+				SPI_Write(YUSHAN_LBE_PRE_DXO_ENABLE, 1, &bSpiData);
+				break;
+			case EOF_RESIZE_POST_DXO:
+				SPI_Write(YUSHAN_EOF_RESIZE_POST_DXO_ENABLE, 1, &bSpiData);
+				break;
+			case LECCI_RESET:
+				SPI_Write(YUSHAN_LECCI_ENABLE, 1,  &bSpiData);
+				break;
+			case LBE_POST_DXO:
+				SPI_Write(YUSHAN_LBE_POST_DXO_ENABLE, 1,  &bSpiData);
+				break;
+
+		}
+
+
+
+	}
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return SUCCESS;
+
+}
+
+
+
+
+bool_t	Yushan_PatternGenerator(Yushan_Init_Struct_t *sInitStruct, uint8_t	bPatternReq, bool_t	bDxoBypassForTestPattern) 
+{
+
+	uint8_t		bSpiData, bDxoClkDiv, bPixClkDiv;
+	uint32_t	udwSpiData=0, uwHSize, uwVSize;
+	uint32_t	uwVBlk;
+	uint16_t	uwMaxInterframeGap;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	uwHSize = sInitStruct->uwActivePixels;
+	uwVSize = sInitStruct->uwLines;
+	uwVBlk	= sInitStruct->uwFrameBlank;
+
+	
+	sInitStruct->sFrameFormat[1].bDatatype = 0x12;
+	sInitStruct->sFrameFormat[1].uwWordcount=(uwHSize)*(sInitStruct->uwPixelFormat&0x0F)/8;
+
+	udwSpiData=sInitStruct->sFrameFormat[1].uwWordcount;
+	SPI_Write(YUSHAN_CSI2_TX_PACKET_SIZE_0+0xc*1,4,(unsigned char*)&udwSpiData);
+
+	udwSpiData=sInitStruct->sFrameFormat[1].bDatatype ;
+	SPI_Write(YUSHAN_CSI2_TX_DI_INDEX_CTRL_0+0xc*1,1,(unsigned char*)&udwSpiData); 
+
+	
+	
+	SPI_Write(YUSHAN_LECCI_BYPASS_CTRL, 1, (unsigned char*)&bDxoBypassForTestPattern); 
+
+	SPI_Read(YUSHAN_CLK_DIV_FACTOR,1,(unsigned char*)&bDxoClkDiv);
+	SPI_Read(YUSHAN_CLK_DIV_FACTOR+1,1,(unsigned char*)&bPixClkDiv);
+	
+	if ( bDxoClkDiv !=0 && bPixClkDiv !=0 )
+	  udwSpiData    = sInitStruct->uwLineBlankStill*bPixClkDiv/ bDxoClkDiv;
+	else
+	  udwSpiData    = 300;
+	SPI_Write(YUSHAN_LECCI_MIN_INTERLINE, 2, (unsigned char*)&udwSpiData);
+
+	
+	udwSpiData = uwHSize;
+	SPI_Write(YUSHAN_LECCI_LINE_SIZE, 2, (unsigned char*)&udwSpiData);
+	SPI_Write(YUSHAN_LBE_PRE_DXO_H_SIZE, 2, (unsigned char*)&udwSpiData);
+	SPI_Write(YUSHAN_LBE_POST_DXO_H_SIZE, 2, (unsigned char*)&udwSpiData);
+
+	
+	SPI_Write(YUSHAN_PATTERN_GEN_PATTERN_TYPE_REQ, 1, &bPatternReq);
+	
+	udwSpiData = (uwHSize|((uwHSize+sInitStruct->uwLineBlankStill)<<16));
+	SPI_Write(YUSHAN_IDP_GEN_LINE_LENGTH, 4, (uint8_t *)(&udwSpiData));
+	if (bDxoBypassForTestPattern) {
+	udwSpiData = (uwVSize|(0xFFF0<<16));
+		SPI_Write(YUSHAN_IDP_GEN_FRAME_LENGTH, 4, (uint8_t *)(&udwSpiData));
+	} else {
+		uwMaxInterframeGap = (0xFFF0/uwHSize)*uwHSize;
+		uwVBlk = uwVBlk - (uwMaxInterframeGap/uwHSize);
+		udwSpiData = ((uwVSize+uwVBlk)|(uwMaxInterframeGap<<16));
+		SPI_Write(YUSHAN_IDP_GEN_FRAME_LENGTH, 4, (uint8_t *)(&udwSpiData));
+		
+		udwSpiData = 1;
+		SPI_Write(YUSHAN_LINE_FILTER_BYPASS_ENABLE, 1, (unsigned char *)&udwSpiData);
+		udwSpiData = 1;
+		SPI_Write(YUSHAN_LINE_FILTER_BYPASS_LSTART_LEVEL, 2, (unsigned char *)&udwSpiData);
+		udwSpiData = uwVBlk+1;
+		SPI_Write(YUSHAN_LINE_FILTER_BYPASS_LSTOP_LEVEL, 2, (unsigned char *)&udwSpiData);
+		
+		udwSpiData = 0x1;
+		SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH0, 1, (unsigned char *)&udwSpiData);
+		udwSpiData = 0xd;
+		SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH1, 1, (unsigned char *)&udwSpiData);
+		SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH2, 1, (unsigned char *)&udwSpiData);
+		udwSpiData = 0x03;
+		SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH3, 1, (unsigned char *)&udwSpiData);
+		udwSpiData = 0x01;
+		SPI_Write(YUSHAN_DTFILTER_BYPASS_ENABLE, 1, (unsigned char *)&udwSpiData);
+		
+		udwSpiData = 1;
+		SPI_Write(YUSHAN_LINE_FILTER_DXO_ENABLE, 1, (unsigned char *)&udwSpiData);
+		udwSpiData = uwVBlk+1;
+		SPI_Write(YUSHAN_LINE_FILTER_DXO_LSTART_LEVEL, 2, (unsigned char *)&udwSpiData);
+		udwSpiData = uwVSize+uwVBlk+1;
+		SPI_Write(YUSHAN_LINE_FILTER_DXO_LSTOP_LEVEL, 2, (unsigned char *)&udwSpiData);
+	}
+
+	
+	if(sInitStruct->uwPixelFormat == 0x0a08) {
+		
+		bSpiData = 0x00;
+		SPI_Write(YUSHAN_SMIA_DCPX_ENABLE, 1, &bSpiData); 
+	}
+
+	
+
+	
+	bSpiData = 1;
+	SPI_Write(YUSHAN_PATTERN_GEN_ENABLE, 1, &bSpiData);
+
+	
+	bSpiData = 1;
+	SPI_Write(YUSHAN_IDP_GEN_AUTO_RUN, 1, &bSpiData);
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	return SUCCESS;
+
+}
+
+
+
+
+void	Yushan_DXO_Lecci_Bypass(void)
+{
+	uint8_t	bSpiData;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+	
+	bSpiData=0x01;
+	SPI_Write(YUSHAN_LECCI_BYPASS_CTRL, 1, (unsigned char*)&bSpiData);
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+}
+
+
+
+
+void	Yushan_DXO_DTFilter_Bypass(void)
+{
+	uint32_t	udwSpiData=0;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	
+	
+	udwSpiData=0x1;
+	SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH0,1,(unsigned char*)&udwSpiData);
+	udwSpiData=0xd;
+	SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH1,1,(unsigned char*)&udwSpiData);
+	udwSpiData=0x02;
+	SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH2,1,(unsigned char*)&udwSpiData);
+	udwSpiData=0x03;
+	SPI_Write(YUSHAN_DTFILTER_BYPASS_MATCH3,1,(unsigned char*)&udwSpiData);
+	udwSpiData=0x01;
+	SPI_Write(YUSHAN_DTFILTER_BYPASS_ENABLE,1,(unsigned char*)&udwSpiData);
+
+	
+
+	udwSpiData=0x5;
+	SPI_Write(YUSHAN_DTFILTER_DXO_MATCH0,1,(unsigned char*)&udwSpiData);
+	SPI_Write(YUSHAN_DTFILTER_DXO_MATCH2,1,(unsigned char*)&udwSpiData);
+	SPI_Write(YUSHAN_DTFILTER_DXO_MATCH3,1,(unsigned char*)&udwSpiData);
+	
+	udwSpiData=0x05;
+	SPI_Write(YUSHAN_DTFILTER_DXO_MATCH1,1,(unsigned char*)&udwSpiData);
+	udwSpiData=0x01;
+	SPI_Write(YUSHAN_DTFILTER_DXO_ENABLE,1,(unsigned char*)&udwSpiData);
+
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+	
+}
+
+
+
+
+
+
+bool_t Yushan_Read_AF_Statistics(Yushan_AF_Stats_t* sYushanAFStats, uint8_t	bNumOfActiveRoi, uint16_t *frameIdx)
+{
+
+	uint8_t		bStatus = SUCCESS, bCount = 0;
+	uint32_t	udwSpiData[4];
+	uint16_t	val;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+#if 0 
+			YushanPrintFrameNumber();
+			YushanPrintDxODOPAfStrategy();
+			YushanPrintImageInformation();
+			YushanPrintVisibleLineSizeAndRoi();
+#endif
+
+#if 0
+	
+	bStatus &= SPI_Read(DXO_DOP_BASE_ADDR+DxODOP_ROI_active_number_7_0, 1, (uint8_t*)(&bNumOfActiveRoi));
+	
+#endif
+
+	if (!bNumOfActiveRoi) 
+		return SUCCESS;
+	if (frameIdx != NULL) {
+		SPI_Read(DXO_DOP_BASE_ADDR+DxODOP_frame_number_7_0, 2, (uint8_t *)(&val));
+		*frameIdx= val;
+	}
+
+	
+	
+	while (bCount < bNumOfActiveRoi) {
+		
+		bStatus &= SPI_Read((uint16_t)(DXO_DOP_BASE_ADDR + DxODOP_ROI_0_stats_G_7_0 + bCount*16), 16, (uint8_t *)(&udwSpiData[0]));
+
+		
+		sYushanAFStats[bCount].udwAfStatsGreen = udwSpiData[0];
+		sYushanAFStats[bCount].udwAfStatsRed = udwSpiData[1];
+		sYushanAFStats[bCount].udwAfStatsBlue = udwSpiData[2];
+		sYushanAFStats[bCount].udwAfStatsConfidence = udwSpiData[3];
+		DEBUGLOG("[CAM]%s, G:%d, R:%d, B:%d, confidence:%d (%d) \n", __func__,
+			sYushanAFStats[bCount].udwAfStatsGreen,
+			sYushanAFStats[bCount].udwAfStatsRed,
+			sYushanAFStats[bCount].udwAfStatsBlue,
+			sYushanAFStats[bCount].udwAfStatsConfidence,
+			*frameIdx);
+
+		
+		bCount++;
+	}
+
+	VERBOSELOG("[CAM] %s: End With Status: %i\n", __func__, bStatus);
+	return bStatus;
+
+}
+
+
+
+#define YUSHAN_REGISTER_CHECK(reg_addr) udwSpiData = 0; SPI_Read(reg_addr, 4, (uint8_t *)(&udwSpiData)); pr_info("[CAM] %s: %s: 0x%08x\n", __func__, #reg_addr, udwSpiData);
+#define YUSHAN_DOP_REGISTER_CHECK(reg_addr) udwSpiData = 0; SPI_Read(reg_addr + DXO_DOP_BASE_ADDR, 1, (uint8_t *)(&udwSpiData)); pr_info("[CAM] %s: %s: 0x%02x\n", __func__, #reg_addr, udwSpiData);
+#define YUSHAN_PDP_REGISTER_CHECK(reg_addr) udwSpiData = 0; SPI_Read(reg_addr + DXO_PDP_BASE_ADDR, 1, (uint8_t *)(&udwSpiData)); pr_info("[CAM] %s: %s: 0x%02x\n", __func__, #reg_addr, udwSpiData);
+#define YUSHAN_DPP_REGISTER_CHECK(reg_addr) udwSpiData = 0; SPI_Read(reg_addr + DXO_DPP_BASE_ADDR-0x8000, 1, (uint8_t *)(&udwSpiData)); pr_info("[CAM] %s: %s: 0x%02x\n", __func__, #reg_addr, udwSpiData);
+#define YUSHAN_DPP_REGISTER_CHECK2(reg_addr) udwSpiData = 0; SPI_Read(reg_addr + DXO_DPP_BASE_ADDR-0x10000, 1, (uint8_t *)(&udwSpiData)); pr_info("[CAM] %s: %s: 0x%02x\n", __func__, #reg_addr, udwSpiData);
+void Yushan_Status_Snapshot(void)
+{
+	uint32_t	udwSpiData;
+	uint32_t	udwSpiBaseIndex;
+
+	VERBOSELOG("[CAM] %s: Start\n", __func__);
+
+	DEBUGLOG("[CAM] %s: **** CLK CONFIG  CHECK ****\n", __func__);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CLK_DIV_FACTOR);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CLK_DIV_FACTOR_2);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CLK_CTRL);
+	YUSHAN_REGISTER_CHECK(YUSHAN_PLL_CTRL_MAIN);
+	YUSHAN_REGISTER_CHECK(YUSHAN_PLL_LOOP_OUT_DF);
+
+	DEBUGLOG("[CAM] %s: **** CSI2 RX INTERFACE  CHECK ****\n", __func__);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_RX_FRAME_NUMBER);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_RX_DATA_TYPE);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_RX_WORD_COUNT);
+	YUSHAN_REGISTER_CHECK(YUSHAN_ITM_CSI2RX_STATUS);
+
+	DEBUGLOG("[CAM] %s: **** PRE-DXO CHECK ****\n", __func__);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_0);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_1);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_2);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_3);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_4);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_5);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_6);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_7);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_8);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_9);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_10);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_11);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_12);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_13);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_WC_DI_14);
+	YUSHAN_REGISTER_CHECK(YUSHAN_IDP_GEN_CONTROL);
+	YUSHAN_REGISTER_CHECK(YUSHAN_ITM_IDP_STATUS);
+	YUSHAN_REGISTER_CHECK(YUSHAN_T1_DMA_REG_STATUS);
+
+	DEBUGLOG("[CAM] %s: **** DXO PDP CHECK ****\n", __func__);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_ucode_id_7_0);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_ucode_id_15_8);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_hw_id_7_0);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_hw_id_15_8);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_calib_id_0_7_0);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_calib_id_1_7_0);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_calib_id_2_7_0);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_calib_id_3_7_0);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_error_code_7_0);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_frame_number_7_0);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_frame_number_15_8);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_visible_line_size_7_0);
+	YUSHAN_PDP_REGISTER_CHECK(DxOPDP_visible_line_size_15_8);
+
+	DEBUGLOG("[CAM] %s: **** DXO DPP CHECK ****\n", __func__);
+	udwSpiBaseIndex = 0x010000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_ucode_id_7_0);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_ucode_id_15_8);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_hw_id_7_0);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_hw_id_15_8);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_calib_id_0_7_0);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_calib_id_1_7_0);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_calib_id_2_7_0);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_calib_id_3_7_0);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_error_code_7_0);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_frame_number_7_0);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_frame_number_15_8);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_visible_line_size_7_0);
+	YUSHAN_DPP_REGISTER_CHECK(DxODPP_visible_line_size_15_8);
+	udwSpiBaseIndex = 0x08000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+	DEBUGLOG("[CAM] %s: **** DXO DOP CHECK ****\n", __func__);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_ucode_id_7_0);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_ucode_id_15_8);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_hw_id_7_0);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_hw_id_15_8);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_calib_id_0_7_0);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_calib_id_1_7_0);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_calib_id_2_7_0);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_calib_id_3_7_0);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_error_code_7_0);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_frame_number_7_0);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_frame_number_15_8);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_visible_line_size_7_0);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_visible_line_size_15_8);
+	YUSHAN_DOP_REGISTER_CHECK(DxODOP_binning_7_0);
+
+	DEBUGLOG("[CAM] %s: **** POST-DXO CHECK ****\n", __func__);
+	YUSHAN_REGISTER_CHECK(YUSHAN_P2W_FIFO_WR_STATUS);
+	YUSHAN_REGISTER_CHECK(YUSHAN_P2W_FIFO_RD_STATUS);
+	YUSHAN_REGISTER_CHECK(YUSHAN_ITM_P2W_UFLOW_STATUS);
+	YUSHAN_REGISTER_CHECK(YUSHAN_ITM_LBE_POST_DXO_STATUS);
+
+	DEBUGLOG("[CAM] %s: **** CSI2 RX INTERFACE  CHECK ****\n", __func__);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_TX_PACKET_SIZE_0);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_TX_DI_INDEX_CTRL_0);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_TX_LINE_NO_0);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_TX_PACKET_SIZE_1);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_TX_DI_INDEX_CTRL_1);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_TX_LINE_NO_1);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_TX_PACKET_SIZE_2);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_TX_DI_INDEX_CTRL_2);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_TX_LINE_NO_2);
+	YUSHAN_REGISTER_CHECK(YUSHAN_CSI2_TX_FRAME_NO_0);
+	YUSHAN_REGISTER_CHECK(YUSHAN_ITM_CSI2TX_STATUS);
+	VERBOSELOG("[CAM] %s: End\n", __func__);
+}
+
diff --git a/drivers/media/video/msm/rawchip/Yushan_API.h b/drivers/media/video/msm/rawchip/Yushan_API.h
new file mode 100644
index 0000000..b4d2a45
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/Yushan_API.h
@@ -0,0 +1,619 @@
+#ifndef _YUSHAN_API_H_
+#define _YUSHAN_API_H_
+
+
+#ifndef WIN32
+#include <media/linux_rawchip.h>
+#include "yushan_registermap.h"
+#include "DxODOP_regMap.h"
+#include "DxODPP_regMap.h"
+#include "DxOPDP_regMap.h"
+#include "rawchip_spi.h"
+#endif
+#ifdef __cplusplus
+extern "C"{
+#endif   
+
+
+
+
+
+#define YUSHAN_DEBUG 0
+#if YUSHAN_DEBUG
+	#ifdef WIN32
+		#include <stdio.h>
+		extern	FILE	*fLogFile;
+		extern	FILE	*HtmlFileLog;
+		#define __func__  __FUNCTION__
+		
+		#define DEBUGLOG(...)  fprintf(HtmlFileLog, __VA_ARGS__); fprintf(HtmlFileLog, "<hr>\n")
+		
+	#else
+		#define DEBUGLOG  pr_info
+	#endif
+#else
+	#define DEBUGLOG(...)	
+#endif
+
+#define YUSHAN_VERBOSE 0
+#if YUSHAN_VERBOSE
+	#ifdef WIN32
+		#define VERBOSELOG(...)   fprintf(HtmlFileLog, __VA_ARGS__)
+	#else
+		#define VERBOSELOG  pr_info
+	#endif
+#else
+	#define VERBOSELOG(...)	
+#endif
+
+#ifdef WIN32
+	#if YUSHAN_DEBUG == 0
+		#include <stdio.h>
+		extern	FILE	*fLogFile;
+		extern	FILE	*HtmlFileLog;
+		
+		#define __func__  __FUNCTION__
+	#endif
+	#define ERRORLOG(...)   fprintf(HtmlFileLog, __VA_ARGS__)
+#else
+	#define ERRORLOG  pr_err
+#endif
+
+
+
+typedef unsigned char bool_t;
+#ifdef WIN32
+typedef unsigned char uint8_t;
+typedef signed char int8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+#endif
+
+
+#define API_MAJOR_VERSION					14
+#define API_MINOR_VERSION				2
+
+#define TRUE								1
+#define SUCCESS								1
+#define FALSE								0
+#define FAILURE								0
+#define MIPI_CLK_LANE					  1
+#define MIPI_DATA_LANE1					2
+#define MIPI_DATA_LANE2					3
+#define MIPI_DATA_LANE3					4
+#define MIPI_DATA_LANE4					5
+#define MIPI_STOP_STATE					1
+#define MIPI_ULP_STATE					2
+#define MIPI_ACTIVE_STATE				3
+
+
+
+#define RAW8								8
+#define	RAW10								10
+#define	RAW10_8								108		
+
+
+#define IDP_GEN_PIX_WIDTH					10
+#define DXO_CLK_LIMIT						0x12C0000	
+#define SYS_CLK_LIMIT						0x0C80000	
+
+#define PLL_CLK_INDEX				    	0
+#define IDIV_INDEX				    		1
+#define ODIV_INDEX		          			2
+#define LOOP_INDEX	     					3
+
+#define DXO_MIN_LINEBLANKING				150
+#define DXO_MIN_LINELENGTH					1000
+#define DXO_ACTIVE_FRAMELENGTH				500000
+#define DXO_FULL_FRAMELENGTH				900000
+
+
+#define DXO_PDP_HW_MICROCODE_ID				((DxOPDP_dfltVal_ucode_id_15_8<<8)|			\
+												(DxOPDP_dfltVal_hw_id_7_0<<16)|(DxOPDP_dfltVal_hw_id_15_8<<24))
+#define DXO_DOP_HW_MICROCODE_ID				((DxODOP_dfltVal_ucode_id_15_8<<8)|			\
+												(DxODOP_dfltVal_hw_id_7_0<<16)|(DxODOP_dfltVal_hw_id_15_8<<24))
+#define DXO_DPP_HW_MICROCODE_ID				((DxODPP_dfltVal_ucode_id_15_8<<8)|			\
+												(DxODPP_dfltVal_hw_id_7_0<<16)|(DxODPP_dfltVal_hw_id_15_8<<24))
+
+#define DXO_PDP_CALIBRATIONCODE_ID			((DxOPDP_dfltVal_calib_id_0_7_0)|(DxOPDP_dfltVal_calib_id_1_7_0<<8)|	\
+												(DxOPDP_dfltVal_calib_id_2_7_0<<16)|(DxOPDP_dfltVal_calib_id_3_7_0<<24))
+#define DXO_DOP_CALIBRATIONCODE_ID			((DxODOP_dfltVal_calib_id_0_7_0)|(DxODOP_dfltVal_calib_id_1_7_0<<8)|	\
+												(DxODOP_dfltVal_calib_id_2_7_0<<16)|(DxODOP_dfltVal_calib_id_3_7_0<<24))
+#define DXO_DPP_CALIBRATIONCODE_ID			((DxODPP_dfltVal_calib_id_0_7_0)|(DxODPP_dfltVal_calib_id_1_7_0<<8)|	\
+												(DxODPP_dfltVal_calib_id_2_7_0<<16)|(DxODPP_dfltVal_calib_id_3_7_0<<24))
+
+
+
+
+#define ADD_INTR_TO_LIST							0x01
+#define	DEL_INTR_FROM_LIST							0x00
+
+#define	INTERRUPT_PAD_0								0x00
+#define	INTERRUPT_PAD_1								0x01
+
+#define TOTAL_INTERRUPT_SETS						13
+#define TOTAL_INTERRUPT_COUNT						85
+#define INTERRUPT_SET_SIZE							0x18
+#define FALSE_ALARM									0xFF
+
+#define YUSHAN_INTR_BASE_ADDR						0x0C00
+#define	YUSHAN_OFFSET_INTR_STATUS					0x00	
+#define	YUSHAN_OFFSET_INTR_ENABLE_STATUS			0x04
+#define YUSHAN_OFFSET_INTR_STATUS_CLEAR				0x08
+#define YUSHAN_OFFSET_INTR_DISABLE					0x10
+#define YUSHAN_OFFSET_INTR_ENABLE					0x14
+
+#define DXO_DOP_BASE_ADDR							0x8000
+#define DXO_DPP_BASE_ADDR							0x10000
+#define DXO_PDP_BASE_ADDR							0x6000
+
+
+#define DFT_RESET									1
+#define T1_DMA										2
+#define CSI2_RX										3
+#define IT_POINT									4
+#define IDP_GEN										5
+#define MIPI_RX_DTCHK								6
+#define SMIA_PATTERN_GEN							7
+#define SMIA_DCPX									8
+#define P2W_FIFO_WR									9
+#define P2W_FIFO_RD									10
+#define CSI2_TX_WRAPPER								11
+#define CSI2_TX										12
+#define LINE_FILTER_BYPASS							13
+#define DT_FILTER_BYPASS							14
+#define LINE_FILTER_DXO								15
+#define DT_FILTER_DXO								16
+#define EOF_RESIZE_PRE_DXO							17
+#define LBE_PRE_DXO									18
+#define EOF_RESIZE_POST_DXO							19
+#define LECCI_RESET									20
+#define LBE_POST_DXO								21
+
+#define TOTAL_MODULES								21
+
+
+
+#define EVENT_CSI2RX_ECC_ERR						1
+#define EVENT_CSI2RX_CHKSUM_ERR						2
+#define EVENT_CSI2RX_SHORTPACKET					3
+#define EVENT_CSI2RX_SYNCPULSE_MISSED				4
+
+#define EVENT_PDP_BOOT							    5
+#define EVENT_PDP_EOF_EXECCMD				  		6
+#define EVENT_DXOPDP_EOP						  	7
+#define EVENT_DXOPDP_NEWFRAMECMD_ACK				8
+#define EVENT_DXOPDP_NEWFRAMEPROC_ACK				9
+#define EVENT_DXOPDP_NEWFRAME_ERR					10
+	
+#define EVENT_DPP_BOOT							  	11
+#define EVENT_DPP_EOF_EXECCMD						12
+#define EVENT_DXODPP_EOP							13
+#define EVENT_DXODPP_NEWFRAMECMD_ACK				14
+#define EVENT_DXODPP_NEWFRAMEPROC_ACK				15
+#define EVENT_DXODPP_NEWFRAME_ERR					16
+
+#define EVENT_DOP7_BOOT							  	17
+#define EVENT_DOP7_EOF_EXECCMD						18
+#define EVENT_DXODOP7_EOP						  	19
+#define EVENT_DXODOP7_NEWFRAMECMD_ACK				20
+#define EVENT_DXODOP7_NEWFRAMEPROC_ACK				21
+#define EVENT_DXODOP7_NEWFRAME_ERR					22
+
+#define EVENT_CSI2TX_SP_ERR							23
+#define EVENT_CSI2TX_LP_ERR							24
+#define EVENT_CSI2TX_DATAINDEX_ERR					25
+#define EVENT_CSI2TX_FRAMEFINISH					26
+#define	EVENT_RX_PHY_ERR_SOT_SOFT_DL4				27
+#define	EVENT_RX_PHY_ERR_SOT_HARD_DL4				28
+#define	EVENT_RX_PHY_ERR_EOT_DL4					29
+#define	EVENT_RX_PHY_ERR_ESC_DL4					30
+#define	EVENT_RX_PHY_ERR_CTRL_DL4					31
+#define	EVENT_RX_PHY_ULPM_EXIT_DL4					32
+#define	EVENT_RX_PHY_ULPM_ENTER_DL4					33
+
+#define	EVENT_RESERVED								34
+
+#define	EVENT_RX_PHY_ERR_SOT_SOFT_DL3				35
+#define	EVENT_RX_PHY_ERR_SOT_HARD_DL3				36
+#define	EVENT_RX_PHY_ERR_EOT_DL3					37
+#define	EVENT_RX_PHY_ERR_ESC_DL3					38
+#define	EVENT_RX_PHY_ERR_CTRL_DL3					39
+#define	EVENT_RX_PHY_ULPM_EXIT_DL3					40
+#define	EVENT_RX_PHY_ULPM_ENTER_DL3					41
+
+#define	EVENT_RESERVED2								42
+
+#define	EVENT_RX_PHY_ERR_SOT_SOFT_DL2				43
+#define	EVENT_RX_PHY_ERR_SOT_HARD_DL2				44
+#define	EVENT_RX_PHY_ERR_EOT_DL2					45
+#define	EVENT_RX_PHY_ERR_ESC_DL2					46
+#define	EVENT_RX_PHY_ERR_CTRL_DL2					47
+#define	EVENT_RX_PHY_ULPM_EXIT_DL2					48
+#define	EVENT_RX_PHY_ULPM_ENTER_DL2					49
+
+#define	EVENT_RX_PHY_ULPM_EXIT_CLK					50
+
+#define	EVENT_RX_PHY_ERR_SOT_SOFT_DL1				51
+#define	EVENT_RX_PHY_ERR_SOT_HARD_DL1				52
+#define	EVENT_RX_PHY_ERR_EOT_DL1					53
+#define	EVENT_RX_PHY_ERR_ESC_DL1					54
+#define	EVENT_RX_PHY_ERR_CTRL_DL1					55
+#define	EVENT_RX_PHY_ULPM_EXIT_DL1					56
+#define	EVENT_RX_PHY_ULPM_ENTER_DL1					57
+
+#define	EVENT_RX_PHY_ULPM_ENTER_CLK					58
+#define EVENT_TXPHY_CTRL_ERR_D1						59
+#define EVENT_TXPHY_CTRL_ERR_D2						60
+#define EVENT_TXPHY_CTRL_ERR_D3						61
+#define EVENT_TXPHY_CTRL_ERR_D4						62
+
+#define EVENT_UNMATCHED_IMAGE_SIZE_ERROR			63
+#define	EVENT_UNMANAGED_DATA_TYPE					64
+#define	PRE_DXO_WRAPPER_PROTOCOL_ERR				65
+#define	PRE_DXO_WRAPPER_FIFO_OVERFLOW				66
+#define EVENT_BAD_FRAME_DETECTION					67
+#define EVENT_TX_DATA_FIFO_OVERFLOW					68
+#define EVENT_TX_INDEX_FIFO_OVERFLOW				69
+#define EVENT_RX_CHAR_COLOR_BAR_0_ERR				70
+#define EVENT_RX_CHAR_COLOR_BAR_1_ERR				71
+#define EVENT_RX_CHAR_COLOR_BAR_2_ERR				72
+#define EVENT_RX_CHAR_COLOR_BAR_3_ERR				73
+#define EVENT_RX_CHAR_COLOR_BAR_4_ERR				74
+#define EVENT_RX_CHAR_COLOR_BAR_5_ERR				75
+#define EVENT_RX_CHAR_COLOR_BAR_6_ERR				76
+#define EVENT_RX_CHAR_COLOR_BAR_7_ERR				77
+#define	EVENT_POST_DXO_WRAPPER_PROTOCOL_ERR			78
+#define	EVENT_POST_DXO_WRAPPER_FIFO_OVERFLOW		79
+#define EVENT_LINESIZE_REPROGRAM_DONE				80
+#define EVENT_PLL_STABLE							81
+#define EVENT_LDO_STABLE							82
+#define EVENT_LINE_POSITION_INTR					83	
+#define EVENT_TX_DATA_UNDERFLOW						84	
+#define EVENT_TX_INDEX_UNDERFLOW					85	
+
+#define EVENT_FIRST_INDEXFORSET {EVENT_CSI2RX_ECC_ERR, EVENT_PDP_BOOT, EVENT_DPP_BOOT, EVENT_DOP7_BOOT, EVENT_CSI2TX_SP_ERR, EVENT_RX_PHY_ERR_SOT_SOFT_DL4, EVENT_TXPHY_CTRL_ERR_D1, EVENT_UNMATCHED_IMAGE_SIZE_ERROR, EVENT_RX_CHAR_COLOR_BAR_0_ERR, EVENT_POST_DXO_WRAPPER_PROTOCOL_ERR, EVENT_LINESIZE_REPROGRAM_DONE, EVENT_LINE_POSITION_INTR, EVENT_TX_DATA_UNDERFLOW, TOTAL_INTERRUPT_COUNT+1}
+
+
+
+#define TIME_5MS				1
+#define TIME_10MS				2
+#define TIME_20MS				3
+#define TIME_50MS				4
+#define TIME_100MS				5
+
+
+#define YUSHAN_FRAME_FORMAT_NORMAL_MODE		0	
+#define YUSHAN_FRAME_FORMAT_VF_MODE			1
+#define YUSHAN_FRAME_FORMAT_STILL_MODE		2
+
+#define DXO_BOOT_CMD			1
+
+
+#define RESET_MODULE						1
+#define	DERESET_MODULE						0
+
+
+extern bool_t			gPllLocked;
+
+
+
+typedef enum {
+	DXO_NO_ERR=100,
+	DXO_LINEBLANK_ERR,
+	DXO_FULLLINE_ERR, 
+	DXO_ACTIVE_FRAMELENGTH_ERR, 
+	DXO_FULLFRAMELENGTH_ERR, 
+	DXO_FRAMEBLANKING_ERR,
+	
+	DXO_LOLIMIT_EXCEED_HILIMIT  = 200
+}Yushan_DXO_Errors_e;
+
+
+
+
+
+
+
+
+typedef struct {
+	uint16_t 	uwWordcount; 
+	
+	
+	uint8_t 	bDatatype;
+	
+	uint8_t 	bActiveDatatype;
+	
+	
+	uint8_t 	bSelectStillVfMode;
+	
+	
+	
+	
+	
+	
+	
+} Yushan_Frame_Format_t;
+
+
+
+
+typedef	struct {
+	
+	
+	uint8_t 	bNumberOfLanes;
+	
+	
+	
+	
+	uint16_t 	uwPixelFormat;
+	
+	uint16_t 	uwBitRate; 
+	
+	uint32_t 	fpExternalClock; 
+	uint32_t	fpSpiClock;
+	
+	uint16_t	uwActivePixels;
+	
+	uint16_t	uwLineBlankVf;
+	
+	uint16_t	uwLineBlankStill;
+	
+	uint16_t	uwLines;
+	
+	uint16_t	uwFrameBlank;
+	
+	
+	
+	
+	
+	uint8_t		bValidWCEntries; 
+	Yushan_Frame_Format_t sFrameFormat[15];
+	
+	uint8_t		bDxoSettingCmdPerFrame;
+	
+	bool_t		bUseExternalLDO;
+	
+	
+}Yushan_Init_Struct_t;
+
+
+typedef struct {
+	
+	uint16_t	uwActivePixels;			
+	
+	uint16_t	uwLineBlank;
+	
+	uint16_t	uwActiveFrameLength;	
+	
+	uint8_t		bSelectStillVfMode;
+	
+	uint16_t	uwPixelFormat;
+
+}Yushan_New_Context_Config_t;
+
+
+
+typedef	struct {
+	uint8_t 	*pDxoPdpRamImage[2];
+	
+	uint16_t	uwDxoPdpStartAddr;
+	
+	uint16_t	uwDxoPdpBootAddr;
+	
+	uint16_t 	uwDxoPdpRamImageSize[2];
+	
+	uint16_t	uwBaseAddrPdpMicroCode[2];
+	
+	uint8_t 	*pDxoDppRamImage[2];
+	
+	uint16_t	uwDxoDppStartAddr;
+	
+	uint16_t	uwDxoDppBootAddr;
+	
+	uint16_t 	uwDxoDppRamImageSize[2];
+	
+	uint16_t	uwBaseAddrDppMicroCode[2];
+	
+	uint8_t 	*pDxoDopRamImage[2];
+	
+	uint16_t	uwDxoDopStartAddr;
+	
+	uint16_t	uwDxoDopBootAddr;
+	
+	uint16_t 	uwDxoDopRamImageSize[2];
+	
+	uint16_t	uwBaseAddrDopMicroCode[2];
+	
+} Yushan_Init_Dxo_Struct_t;
+
+
+
+typedef struct {
+	
+	uint8_t		bDxoConstraints;
+	
+	uint32_t	udwDxoConstraintsMinValue;
+	
+	
+	
+
+}Yushan_SystemStatus_t;
+
+
+
+
+typedef	struct {
+	uint8_t 	bImageOrientation;
+	uint16_t 	uwXAddrStart;
+	uint16_t 	uwYAddrStart;
+	uint16_t 	uwXAddrEnd;
+	uint16_t 	uwYAddrEnd;
+	uint16_t 	uwXEvenInc;  
+	uint16_t 	uwXOddInc;
+	uint16_t 	uwYEvenInc;  
+	uint16_t 	uwYOddInc;
+	uint8_t 	bBinning;    
+}Yushan_ImageChar_t;
+
+
+typedef	struct {
+	uint16_t 	uwAnalogGainCodeGR;
+	uint16_t 	uwAnalogGainCodeR;
+	uint16_t 	uwAnalogGainCodeB;
+	uint16_t 	uwPreDigGainGR;
+	uint16_t 	uwPreDigGainR;
+	uint16_t 	uwPreDigGainB;
+	uint16_t 	uwExposureTime;    
+	uint8_t	bRedGreenRatio;
+	uint8_t	bBlueGreenRatio; 
+}Yushan_GainsExpTime_t;
+
+
+
+typedef	struct {
+	
+	uint8_t 	bTemporalSmoothing;   
+	uint16_t 	uwFlashPreflashRating;
+	uint8_t 	bFocalInfo;
+}Yushan_DXO_DPP_Tuning_t;
+
+
+
+typedef	struct {
+	
+	
+	uint8_t 	bEstimationMode;
+	uint8_t 	bSharpness;
+	uint8_t 	bDenoisingLowGain;
+	uint8_t 	bDenoisingMedGain;
+	uint8_t 	bDenoisingHiGain;
+	uint8_t 	bNoiseVsDetailsLowGain;
+	uint8_t 	bNoiseVsDetailsMedGain;
+	uint8_t 	bNoiseVsDetailsHiGain;
+	uint8_t 	bTemporalSmoothing;    
+}Yushan_DXO_DOP_Tuning_t;
+
+
+
+typedef	struct {
+	uint8_t 	bDeadPixelCorrectionLowGain;
+	uint8_t 	bDeadPixelCorrectionMedGain;
+	uint8_t 	bDeadPixelCorrectionHiGain;
+}Yushan_DXO_PDP_Tuning_t;
+
+
+
+
+typedef struct {
+	uint8_t		bDxoDopRoiActiveNumber;
+}Yushan_DXO_ROI_Active_Number_t;
+
+
+
+typedef	struct {
+	uint8_t 	bXStart;
+	uint8_t 	bYStart;
+	uint8_t 	bXEnd;
+	uint8_t 	bYEnd;
+}Yushan_AF_ROI_t;
+
+typedef struct {
+	uint32_t 	udwAfStatsGreen;
+	uint32_t 	udwAfStatsRed;
+	uint32_t 	udwAfStatsBlue;
+	uint32_t 	udwAfStatsConfidence;
+}Yushan_AF_Stats_t;
+
+
+
+typedef struct {
+	uint32_t 	udwDopVersion;
+	uint32_t 	udwDppVersion;
+	uint32_t 	udwPdpVersion;
+	uint32_t 	udwDopCalibrationVersion;
+	uint32_t 	udwDppCalibrationVersion;
+	uint32_t 	udwPdpCalibrationVersion;
+	uint8_t 	bApiMajorVersion;
+	uint8_t 	bApiMinorVersion;
+}Yushan_Version_Info_t;
+
+
+
+#define Yushan_DXO_Sync_Reset_Dereset(bFlagResetOrDereset) 	SPI_Write(YUSHAN_RESET_CTRL+3, 1, &bFlagResetOrDereset)
+
+#ifdef WIN32
+bool_t	SPI_Read( uint16_t uwIndex , uint16_t uwCount , uint8_t * pData);
+bool_t	SPI_Write( uint16_t uwIndex , uint16_t uwCount , uint8_t * pData);
+#endif
+
+
+
+
+
+
+
+
+bool_t	Yushan_Init_LDO(bool_t	bUseExternalLDO);
+bool_t	Yushan_Init_Clocks(Yushan_Init_Struct_t *sInitStruct, Yushan_SystemStatus_t *sSystemStatus, uint32_t *udwIntrMask);
+bool_t	Yushan_Init(Yushan_Init_Struct_t * sInitStruct);
+bool_t	Yushan_Init_Dxo(Yushan_Init_Dxo_Struct_t * sDxoStruct, bool_t fBypassDxoUpload);
+
+bool_t	Yushan_Update_ImageChar(Yushan_ImageChar_t * sImageChar);
+bool_t	Yushan_Update_SensorParameters(Yushan_GainsExpTime_t * sGainsExpInfo);
+bool_t Yushan_Update_DxoPdp_TuningParameters(Yushan_DXO_PDP_Tuning_t * sDxoPdpTuning);
+bool_t	Yushan_Update_DxoDpp_TuningParameters(Yushan_DXO_DPP_Tuning_t * sDxoDppTuning);
+bool_t	Yushan_Update_DxoDop_TuningParameters(Yushan_DXO_DOP_Tuning_t * sDxoDopTuning);
+bool_t	Yushan_Update_Commit(uint8_t  bPdpMode, uint8_t  bDppMode, uint8_t  bDopMode);
+
+
+
+
+void	Yushan_AssignInterruptGroupsToPad1(uint16_t	uwAssignITRGrpToPad1);
+bool_t	Yushan_Intr_Enable(uint8_t *pIntrMask);
+void	Yushan_Intr_Status_Read (uint8_t *bListOfInterrupts, bool_t	fSelect_Intr_Pad);
+void	Yushan_Read_IntrEvent(uint8_t bIntrSetID, uint32_t *udwListOfInterrupts);
+bool_t	Yushan_Intr_Status_Clear(uint8_t *bListOfInterrupts);
+bool_t	Yushan_Check_Pad_For_IntrID(uint8_t	bInterruptId);
+void	Yushan_AddnRemoveIDInList(uint8_t bInterruptID, uint32_t *udwListOfInterrupts, bool_t fAddORClear);
+bool_t	Yushan_CheckForInterruptIDInList(uint8_t bInterruptID, uint32_t *udwProtoInterruptList);
+
+
+
+bool_t Yushan_Get_Version_Information(Yushan_Version_Info_t * sYushanVersionInfo );
+
+
+
+bool_t Yushan_Context_Config_Update(Yushan_New_Context_Config_t	*sYushanNewContextConfig);
+
+uint8_t Yushan_GetCurrentStreamingMode(void);
+bool_t	Yushan_Swap_Rx_Pins(bool_t fClkLane, bool_t fDataLane1, bool_t fDataLane2, bool_t fDataLane3, bool_t fDataLane4);
+bool_t	Yushan_Invert_Rx_Pins(bool_t fClkLane, bool_t fDataLane1, bool_t fDataLane2, bool_t fDataLane3, bool_t fDataLane4);
+bool_t	Yushan_Enter_Standby_Mode(void);
+bool_t	Yushan_Exit_Standby_Mode(Yushan_Init_Struct_t *sInitStruct);
+bool_t	Yushan_Assert_Reset(uint32_t bModuleMask, uint8_t bResetORDeReset);
+bool_t  Yushan_Update_DxoDop_Af_Strategy(uint8_t  bAfStrategy);
+bool_t	Yushan_AF_ROI_Update(Yushan_AF_ROI_t  *sYushanAfRoi, uint8_t bNumOfActiveRoi);
+bool_t	Yushan_PatternGenerator(Yushan_Init_Struct_t *sInitStruct, uint8_t	bPatternReq, bool_t	bDxoBypassForTestPattern);
+void	Yushan_DCPX_CPX_Enable(void);
+
+
+bool_t		Yushan_CheckDxoConstraints(uint32_t udwParameters, uint32_t udwMinLimit, uint32_t fpDxo_Clk, uint32_t fpPixel_Clk, uint16_t uwFullLine, uint32_t * pMinValue);
+uint32_t	Yushan_Compute_Pll_Divs(uint32_t fpExternal_Clk, uint32_t fpTarget_PllClk);
+uint32_t	Yushan_ConvertTo16p16FP(uint16_t);
+
+
+bool_t Yushan_Read_AF_Statistics(Yushan_AF_Stats_t* sYushanAFStats, uint8_t	bNumOfActiveRoi, uint16_t *frameIdx);
+
+
+void	Yushan_DXO_DTFilter_Bypass(void);
+void	Yushan_DXO_Lecci_Bypass(void);
+
+void	Yushan_Status_Snapshot(void);
+
+#ifdef __cplusplus
+}
+#endif   
+
+
+#endif 
diff --git a/drivers/media/video/msm/rawchip/Yushan_HTC_Functions.c b/drivers/media/video/msm/rawchip/Yushan_HTC_Functions.c
new file mode 100644
index 0000000..97de14a
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/Yushan_HTC_Functions.c
@@ -0,0 +1,2058 @@
+#include "yushan_registermap.h"
+#include "DxODOP_regMap.h"
+#include "DxODPP_regMap.h"
+#include "DxOPDP_regMap.h"
+#include "Yushan_HTC_Functions.h"
+
+#include <mach/board.h>
+
+#ifdef YUSHAN_HTC_FUNCTIONS_DEBUG
+#define CDBG(fmt, args...) pr_debug(fmt, ##args)
+#else
+#define CDBG(fmt, args...) do { } while (0)
+#endif
+
+Yushan_ImageChar_t	sImageChar_context;
+struct yushan_reg_t *p_yushan_regs;
+
+#define PDP_enable 0x01
+#define black_level_enable 0x01
+#define dead_pixel_enable 0x01
+#define DOP_enable 0x01
+#define denoise_enable 0x01
+#define DPP_enable 0x01
+
+uint8_t bPdpMode = PDP_enable ? (0x01|(((~black_level_enable)&0x01)<<3)|(((~dead_pixel_enable)&0x01)<<4)) : 0;
+uint8_t bDppMode = DPP_enable ? 0x03 : 0;
+uint8_t bDopMode = DOP_enable ? (0x01|(((~denoise_enable)&0x01)<<4)) : 0;
+
+void YushanPrintDxODOPAfStrategy(void)
+{
+	uint8_t val ;
+	SPI_Read((DXO_DOP_BASE_ADDR+0x02a4) , 1, (uint8_t *)(&val));
+	pr_info("[CAM] prcDxO YushanReadDxODOPAfStrategy:0x%02x", val);
+}
+
+void YushanPrintFrameNumber(void)
+{
+	uint16_t val ;
+	SPI_Read((0x82a2) , 2, (uint8_t *)(&val));
+	pr_info("[CAM] prcDxO YushanReadFrameNumber:%d", val);
+}
+
+void YushanPrintVisibleLineSizeAndRoi(void)
+{
+	uint16_t val ;
+	uint8_t  xRoiStart;
+	uint8_t  yRoiStart;
+	uint8_t  xRoiEnd;
+	uint8_t  yRoiEnd;
+
+	SPI_Read((DxOPDP_visible_line_size_7_0 + 0x8000) , 2, (uint8_t *)(&val));
+	pr_info("[CAM] prcDxO YushanPrintVisibleLineSizeAndRoi:%d", val);
+
+	SPI_Read((DxODOP_ROI_0_x_start_7_0 + DXO_DOP_BASE_ADDR) , 1, (uint8_t *)(&xRoiStart));
+	SPI_Read((DxODOP_ROI_0_y_start_7_0 + DXO_DOP_BASE_ADDR) , 1, (uint8_t *)(&yRoiStart));
+	SPI_Read((DxODOP_ROI_0_x_end_7_0 + DXO_DOP_BASE_ADDR) , 1, (uint8_t *)(&xRoiEnd));
+	SPI_Read((DxODOP_ROI_0_y_end_7_0 + DXO_DOP_BASE_ADDR) , 1, (uint8_t *)(&yRoiEnd));
+	pr_info("[CAM] prcDxO ROI [ %d %d | %d %d ]\n",xRoiStart,xRoiEnd,yRoiStart,yRoiEnd);
+}
+
+void YushanPrintImageInformation(void)
+{
+	static uint16_t xStart_prev = -1;
+	static uint16_t xEnd_prev = -1;
+	static uint16_t yStart_prev = -1;
+	static uint16_t yEnd_prev = -1;
+	static uint16_t xOddInc_prev = -1;
+	static uint16_t yOddInc_prev = -1;
+	uint16_t xStart_new ;
+	uint16_t xEnd_new ;
+	uint16_t yStart_new ;
+	uint16_t yEnd_new ;
+	uint16_t xOddInc_new ;
+	uint16_t yOddInc_new ;
+
+
+	SPI_Read((DxOPDP_x_addr_start_7_0 + 0x8000) , 2, (uint8_t *)(&xStart_new));
+	SPI_Read((DxOPDP_y_addr_start_7_0 + 0x8000) , 2, (uint8_t *)(&yStart_new));
+	SPI_Read((DxOPDP_x_addr_end_7_0 + 0x8000) , 2, (uint8_t *)(&xEnd_new));
+	SPI_Read((DxOPDP_y_addr_end_7_0 + 0x8000) , 2, (uint8_t *)(&yEnd_new));
+	SPI_Read((DxOPDP_x_odd_inc_7_0 + 0x8000) , 2, (uint8_t *)(&xOddInc_new));
+	SPI_Read((DxOPDP_y_odd_inc_7_0 + 0x8000) , 2, (uint8_t *)(&yOddInc_new));
+
+	if ((xStart_prev!=xStart_new)
+		||	(yStart_prev!=yStart_new)
+		||	(xEnd_prev!=xEnd_new)
+		||	(yEnd_prev!=yEnd_new)
+		||	(xOddInc_prev!=xOddInc_new)
+		||	(yOddInc_prev!=yOddInc_new) ) {
+			pr_err("[CAM] prcDxO DxOPDP_x_addr_start: %d", xStart_new);
+			pr_err("[CAM] prcDxO DxOPDP_x_addr_end: %d", xEnd_new);
+			pr_err("[CAM] prcDxO DxOPDP_y_addr_start: %d", yStart_new);
+			pr_err("[CAM] prcDxO DxOPDP_y_addr_end: %d", yEnd_new);
+			pr_err("[CAM] prcDxO DxOPDP_x_odd_inc: %d", xOddInc_new);
+			pr_err("[CAM] prcDxO DxOPDP_y_odd_inc: %d", yOddInc_new);
+		}
+	xStart_prev = xStart_new;
+	xEnd_prev = xEnd_new ;
+	yStart_prev = yStart_new ;
+	yEnd_prev = yEnd_new ;
+	xOddInc_prev = xOddInc_new ;
+	yOddInc_prev = yOddInc_new ;
+
+
+}
+
+void Reset_Yushan(void)
+{
+	uint8_t	bSpiData;
+	Yushan_Init_Dxo_Struct_t	sDxoStruct;
+	sDxoStruct.pDxoPdpRamImage[0] = (uint8_t *)p_yushan_regs->pdpcode;
+	sDxoStruct.pDxoDppRamImage[0] = (uint8_t *)p_yushan_regs->dppcode;
+	sDxoStruct.pDxoDopRamImage[0] = (uint8_t *)p_yushan_regs->dopcode;
+	sDxoStruct.pDxoPdpRamImage[1] = (uint8_t *)p_yushan_regs->pdpclib;
+	sDxoStruct.pDxoDppRamImage[1] = (uint8_t *)p_yushan_regs->dppclib;
+	sDxoStruct.pDxoDopRamImage[1] = (uint8_t *)p_yushan_regs->dopclib;
+
+	sDxoStruct.uwDxoPdpRamImageSize[0] = p_yushan_regs->pdpcode_size;
+	sDxoStruct.uwDxoDppRamImageSize[0] = p_yushan_regs->dppcode_size;
+	sDxoStruct.uwDxoDopRamImageSize[0] = p_yushan_regs->dopcode_size;
+	sDxoStruct.uwDxoPdpRamImageSize[1] = p_yushan_regs->pdpclib_size;
+	sDxoStruct.uwDxoDppRamImageSize[1] = p_yushan_regs->dppclib_size;
+	sDxoStruct.uwDxoDopRamImageSize[1] = p_yushan_regs->dopclib_size;
+
+	sDxoStruct.uwBaseAddrPdpMicroCode[0] = p_yushan_regs->pdpcode_first_addr;
+	sDxoStruct.uwBaseAddrDppMicroCode[0] = p_yushan_regs->dppcode_first_addr;
+	sDxoStruct.uwBaseAddrDopMicroCode[0] = p_yushan_regs->dopcode_first_addr;
+	sDxoStruct.uwBaseAddrPdpMicroCode[1] = p_yushan_regs->pdpclib_first_addr;
+	sDxoStruct.uwBaseAddrDppMicroCode[1] = p_yushan_regs->dppclib_first_addr;
+	sDxoStruct.uwBaseAddrDopMicroCode[1] = p_yushan_regs->dopclib_first_addr;
+
+	sDxoStruct.uwDxoPdpBootAddr = p_yushan_regs->pdpBootAddr;
+	sDxoStruct.uwDxoDppBootAddr = p_yushan_regs->dppBootAddr;
+	sDxoStruct.uwDxoDopBootAddr = p_yushan_regs->dopBootAddr;
+
+	sDxoStruct.uwDxoPdpStartAddr = p_yushan_regs->pdpStartAddr;
+	sDxoStruct.uwDxoDppStartAddr = p_yushan_regs->dppStartAddr;
+	sDxoStruct.uwDxoDopStartAddr = p_yushan_regs->dopStartAddr;
+
+	pr_err("[CAM] %s\n",__func__);
+	
+	Yushan_Assert_Reset(0x001F0F10, RESET_MODULE);
+	bSpiData =1;
+	Yushan_DXO_Sync_Reset_Dereset(bSpiData);
+	Yushan_Assert_Reset(0x001F0F10, DERESET_MODULE);
+	bSpiData = 0;
+	Yushan_DXO_Sync_Reset_Dereset(bSpiData);
+	Yushan_Init_Dxo(&sDxoStruct, 1);
+	msleep(10);
+	
+	
+	
+}
+
+void ASIC_Test(void)
+{
+	pr_info("[CAM] ASIC_Test E\n");
+	mdelay(10);
+	
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x000c, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x000d, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x000c, 0x3f); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x000d, 0x07); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x000f, 0x00); 
+	mdelay(10);
+
+	
+	rawchip_spi_write_2B1B(0x1405, 0x03);
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x1405, 0x02);
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x1405, 0x00);
+
+	
+	
+	rawchip_spi_write_2B1B(0x0015, 0x19); 
+	rawchip_spi_write_2B1B(0x0014, 0x03); 
+
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x0000, 0x0a); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x0001, 0x0a); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x0002, 0x14); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x0010, 0x18); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x0009, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x1000, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2000, 0xff); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2004, 0x06); 
+	mdelay(10);
+	
+	mdelay(10);
+	
+	rawchip_spi_write_2B1B(0x5004, 0x14); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2408, 0x04); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x240c, 0x0a); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2420, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2428, 0x2b); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4400, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4404, 0x0a); 
+	mdelay(10);
+
+	
+	rawchip_spi_write_2B1B(0x4a05, 0x04); 
+
+	
+	rawchip_spi_write_2B1B(0x2c09, 0x10); 
+
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2c0c, 0xd0); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2c0d, 0x0c); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2c0e, 0xa0); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2c0f, 0x0f); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2c10, 0xa0); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2c11, 0x09); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2c12, 0xf0); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2c13, 0xff); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x3400, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x3401, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x3402, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x3403, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x3408, 0x02); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x3409, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x340a, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x340b, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5880, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5888, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4400, 0x11); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4408, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x440c, 0x03); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4c00, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4c08, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4c10, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4c4c, 0x14); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4c4d, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4c50, 0x2b); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4c51, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4c5c, 0x2b); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4c5d, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4c58, 0x04); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x4c59, 0x10); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5828, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x582c, 0x02); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5830, 0x0d); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5834, 0x03); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5820, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5868, 0xff); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x586c, 0xff); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5870, 0xff); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5874, 0xff); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5860, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5c08, 0x94); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5c09, 0x02); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5c0c, 0xfc); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5c10, 0x90); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5c11, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5c14, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x5c00, 0x01); 
+	mdelay(10);
+
+	
+	rawchip_spi_write_2B1B(0x5000, 0x33); 
+	mdelay(100);
+
+	rawchip_spi_write_2B1B(0x2c00, 0x01); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2c01, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2c02, 0x00); 
+	mdelay(10);
+	rawchip_spi_write_2B1B(0x2c03, 0x00); 
+	msleep(2000);
+
+	pr_info("[CAM] ASIC_Test X\n");
+}
+
+#define DxO
+int Yushan_sensor_open_init(struct rawchip_sensor_init_data data)
+{
+	
+#ifdef COLOR_BAR
+	 int32_t rc = 0;
+	ASIC_Test();
+	
+#else
+	
+	
+
+	bool_t	bBypassDxoUpload = 0;
+	Yushan_Version_Info_t sYushanVersionInfo;
+
+	uint8_t			bPixelFormat = RAW10;
+	
+	
+	Yushan_Init_Struct_t	sInitStruct;
+	Yushan_Init_Dxo_Struct_t	sDxoStruct;
+	Yushan_GainsExpTime_t sGainsExpTime;
+	Yushan_DXO_DPP_Tuning_t sDxoDppTuning;
+	Yushan_DXO_PDP_Tuning_t sDxoPdpTuning;
+	Yushan_DXO_DOP_Tuning_t sDxoDopTuning;
+	Yushan_SystemStatus_t			sSystemStatus;
+	uint32_t		udwIntrMask[] = {0x3DE38E3B, 0xFC3C3C3C, 0x001B7FFB};	
+	uint16_t		uwAssignITRGrpToPad1 = 0x008; 
+
+#if 0
+	Yushan_AF_ROI_t					sYushanAfRoi[5];
+	Yushan_DXO_ROI_Active_Number_t	sYushanDxoRoiActiveNumber;
+	Yushan_AF_Stats_t				sYushanAFStats[5];
+	Yushan_New_Context_Config_t		sYushanNewContextConfig;
+#endif
+	
+	uint8_t bStatus;
+	
+
+	uint16_t uwHSize = data.width;
+	uint16_t uwVSize = data.height;
+	uint16_t uwBlkPixels = data.blk_pixels;
+	uint16_t uwBlkLines = data.blk_lines;
+
+ #endif
+
+	CDBG("[CAM] Yushan API Version : %d.%d \n", API_MAJOR_VERSION, API_MINOR_VERSION);
+
+#ifndef COLOR_BAR
+	
+	sInitStruct.bNumberOfLanes		=	data.lane_cnt;
+	sInitStruct.fpExternalClock		=	data.ext_clk;
+	sInitStruct.uwBitRate			=	data.bitrate;
+	sInitStruct.uwPixelFormat = 0x0A0A;
+	
+	sInitStruct.bDxoSettingCmdPerFrame	=	1;
+
+	if ((sInitStruct.uwPixelFormat&0x0F) == 0x0A)
+		bPixelFormat = RAW10;
+	else if ((sInitStruct.uwPixelFormat&0x0F) == 0x08) {
+		if (((sInitStruct.uwPixelFormat>>8)&0x0F) == 0x08)
+			bPixelFormat = RAW8;
+		else 
+			bPixelFormat = RAW10_8;
+	}
+#endif
+
+#ifndef COLOR_BAR
+
+	p_yushan_regs = &yushan_regs;
+	if (1) {
+		pr_info("[CAM] Load R2 u_code data\n");
+		p_yushan_regs->pdpcode_first_addr = yushan_u_code_r2.pdpcode_first_addr;
+		p_yushan_regs->pdpcode = yushan_u_code_r2.pdpcode;
+		p_yushan_regs->pdpcode_size = yushan_u_code_r2.pdpcode_size;
+		p_yushan_regs->pdpBootAddr = yushan_u_code_r2.pdpBootAddr;
+		p_yushan_regs->pdpStartAddr = yushan_u_code_r2.pdpStartAddr;
+
+		p_yushan_regs->dppcode_first_addr = yushan_u_code_r2.dppcode_first_addr;
+		p_yushan_regs->dppcode = yushan_u_code_r2.dppcode;
+		p_yushan_regs->dppcode_size = yushan_u_code_r2.dppcode_size;
+		p_yushan_regs->dppBootAddr = yushan_u_code_r2.dppBootAddr;
+		p_yushan_regs->dppStartAddr = yushan_u_code_r2.dppStartAddr;
+
+		p_yushan_regs->dopcode_first_addr = yushan_u_code_r2.dopcode_first_addr;
+		p_yushan_regs->dopcode = yushan_u_code_r2.dopcode;
+		p_yushan_regs->dopcode_size = yushan_u_code_r2.dopcode_size;
+		p_yushan_regs->dopBootAddr = yushan_u_code_r2.dopBootAddr;
+		p_yushan_regs->dopStartAddr = yushan_u_code_r2.dopStartAddr;
+	} else {
+		pr_info("[CAM] Load R3 u_code data\n");
+		p_yushan_regs->pdpcode_first_addr = yushan_u_code_r3.pdpcode_first_addr;
+		p_yushan_regs->pdpcode = yushan_u_code_r3.pdpcode;
+		p_yushan_regs->pdpcode_size = yushan_u_code_r3.pdpcode_size;
+		p_yushan_regs->pdpBootAddr = yushan_u_code_r3.pdpBootAddr;
+		p_yushan_regs->pdpStartAddr = yushan_u_code_r3.pdpStartAddr;
+
+		p_yushan_regs->dppcode_first_addr = yushan_u_code_r3.dppcode_first_addr;
+		p_yushan_regs->dppcode = yushan_u_code_r3.dppcode;
+		p_yushan_regs->dppcode_size = yushan_u_code_r3.dppcode_size;
+		p_yushan_regs->dppBootAddr = yushan_u_code_r3.dppBootAddr;
+		p_yushan_regs->dppStartAddr = yushan_u_code_r3.dppStartAddr;
+
+		p_yushan_regs->dopcode_first_addr = yushan_u_code_r3.dopcode_first_addr;
+		p_yushan_regs->dopcode = yushan_u_code_r3.dopcode;
+		p_yushan_regs->dopcode_size = yushan_u_code_r3.dopcode_size;
+		p_yushan_regs->dopBootAddr = yushan_u_code_r3.dopBootAddr;
+		p_yushan_regs->dopStartAddr = yushan_u_code_r3.dopStartAddr;
+	}
+	
+	if (strcmp(data.sensor_name, "s5k3h2yx") == 0) {
+		p_yushan_regs->pdpclib = yushan_regs_clib_s5k3h2yx.pdpclib;
+		p_yushan_regs->dppclib = yushan_regs_clib_s5k3h2yx.dppclib;
+		p_yushan_regs->dopclib = yushan_regs_clib_s5k3h2yx.dopclib;
+		p_yushan_regs->pdpclib_size = yushan_regs_clib_s5k3h2yx.pdpclib_size;
+		p_yushan_regs->dppclib_size = yushan_regs_clib_s5k3h2yx.dppclib_size;
+		p_yushan_regs->dopclib_size = yushan_regs_clib_s5k3h2yx.dopclib_size;
+		p_yushan_regs->pdpclib_first_addr = yushan_regs_clib_s5k3h2yx.pdpclib_first_addr;
+		p_yushan_regs->dppclib_first_addr = yushan_regs_clib_s5k3h2yx.dppclib_first_addr;
+		p_yushan_regs->dopclib_first_addr = yushan_regs_clib_s5k3h2yx.dopclib_first_addr;
+	}
+	else if (strcmp(data.sensor_name, "imx175") == 0) {
+		p_yushan_regs->pdpclib = yushan_regs_clib_imx175.pdpclib;
+		p_yushan_regs->dppclib = yushan_regs_clib_imx175.dppclib;
+		p_yushan_regs->dopclib = yushan_regs_clib_imx175.dopclib;
+		p_yushan_regs->pdpclib_size = yushan_regs_clib_imx175.pdpclib_size;
+		p_yushan_regs->dppclib_size = yushan_regs_clib_imx175.dppclib_size;
+		p_yushan_regs->dopclib_size = yushan_regs_clib_imx175.dopclib_size;
+		p_yushan_regs->pdpclib_first_addr = yushan_regs_clib_imx175.pdpclib_first_addr;
+		p_yushan_regs->dppclib_first_addr = yushan_regs_clib_imx175.dppclib_first_addr;
+		p_yushan_regs->dopclib_first_addr = yushan_regs_clib_imx175.dopclib_first_addr;
+	}
+	else if (strcmp(data.sensor_name, "ov8838") == 0) {
+		p_yushan_regs->pdpclib = yushan_regs_clib_ov8838.pdpclib;
+		p_yushan_regs->dppclib = yushan_regs_clib_ov8838.dppclib;
+		p_yushan_regs->dopclib = yushan_regs_clib_ov8838.dopclib;
+		p_yushan_regs->pdpclib_size = yushan_regs_clib_ov8838.pdpclib_size;
+		p_yushan_regs->dppclib_size = yushan_regs_clib_ov8838.dppclib_size;
+		p_yushan_regs->dopclib_size = yushan_regs_clib_ov8838.dopclib_size;
+		p_yushan_regs->pdpclib_first_addr = yushan_regs_clib_ov8838.pdpclib_first_addr;
+		p_yushan_regs->dppclib_first_addr = yushan_regs_clib_ov8838.dppclib_first_addr;
+		p_yushan_regs->dopclib_first_addr = yushan_regs_clib_ov8838.dopclib_first_addr;
+	}
+	else if (strcmp(data.sensor_name, "ar0260") == 0) {
+		p_yushan_regs->pdpclib = yushan_regs_clib_ar0260.pdpclib;
+		p_yushan_regs->dppclib = yushan_regs_clib_ar0260.dppclib;
+		p_yushan_regs->dopclib = yushan_regs_clib_ar0260.dopclib;
+		p_yushan_regs->pdpclib_size = yushan_regs_clib_ar0260.pdpclib_size;
+		p_yushan_regs->dppclib_size = yushan_regs_clib_ar0260.dppclib_size;
+		p_yushan_regs->dopclib_size = yushan_regs_clib_ar0260.dopclib_size;
+		p_yushan_regs->pdpclib_first_addr = yushan_regs_clib_ar0260.pdpclib_first_addr;
+		p_yushan_regs->dppclib_first_addr = yushan_regs_clib_ar0260.dppclib_first_addr;
+		p_yushan_regs->dopclib_first_addr = yushan_regs_clib_ar0260.dopclib_first_addr;
+	}
+	else if (strcmp(data.sensor_name, "ov2722") == 0) {
+		p_yushan_regs->pdpclib = yushan_regs_clib_ov2722.pdpclib;
+		p_yushan_regs->dppclib = yushan_regs_clib_ov2722.dppclib;
+		p_yushan_regs->dopclib = yushan_regs_clib_ov2722.dopclib;
+		p_yushan_regs->pdpclib_size = yushan_regs_clib_ov2722.pdpclib_size;
+		p_yushan_regs->dppclib_size = yushan_regs_clib_ov2722.dppclib_size;
+		p_yushan_regs->dopclib_size = yushan_regs_clib_ov2722.dopclib_size;
+		p_yushan_regs->pdpclib_first_addr = yushan_regs_clib_ov2722.pdpclib_first_addr;
+		p_yushan_regs->dppclib_first_addr = yushan_regs_clib_ov2722.dppclib_first_addr;
+		p_yushan_regs->dopclib_first_addr = yushan_regs_clib_ov2722.dopclib_first_addr;
+	}
+
+	sDxoStruct.pDxoPdpRamImage[0] = (uint8_t *)p_yushan_regs->pdpcode;
+	sDxoStruct.pDxoDppRamImage[0] = (uint8_t *)p_yushan_regs->dppcode;
+	sDxoStruct.pDxoDopRamImage[0] = (uint8_t *)p_yushan_regs->dopcode;
+	sDxoStruct.pDxoPdpRamImage[1] = (uint8_t *)p_yushan_regs->pdpclib;
+	sDxoStruct.pDxoDppRamImage[1] = (uint8_t *)p_yushan_regs->dppclib;
+	sDxoStruct.pDxoDopRamImage[1] = (uint8_t *)p_yushan_regs->dopclib;
+
+	sDxoStruct.uwDxoPdpRamImageSize[0] = p_yushan_regs->pdpcode_size;
+	sDxoStruct.uwDxoDppRamImageSize[0] = p_yushan_regs->dppcode_size;
+	sDxoStruct.uwDxoDopRamImageSize[0] = p_yushan_regs->dopcode_size;
+	sDxoStruct.uwDxoPdpRamImageSize[1] = p_yushan_regs->pdpclib_size;
+	sDxoStruct.uwDxoDppRamImageSize[1] = p_yushan_regs->dppclib_size;
+	sDxoStruct.uwDxoDopRamImageSize[1] = p_yushan_regs->dopclib_size;
+
+	sDxoStruct.uwBaseAddrPdpMicroCode[0] = p_yushan_regs->pdpcode_first_addr;
+	sDxoStruct.uwBaseAddrDppMicroCode[0] = p_yushan_regs->dppcode_first_addr;
+	sDxoStruct.uwBaseAddrDopMicroCode[0] = p_yushan_regs->dopcode_first_addr;
+	sDxoStruct.uwBaseAddrPdpMicroCode[1] = p_yushan_regs->pdpclib_first_addr;
+	sDxoStruct.uwBaseAddrDppMicroCode[1] = p_yushan_regs->dppclib_first_addr;
+	sDxoStruct.uwBaseAddrDopMicroCode[1] = p_yushan_regs->dopclib_first_addr;
+
+	sDxoStruct.uwDxoPdpBootAddr = p_yushan_regs->pdpBootAddr;
+	sDxoStruct.uwDxoDppBootAddr = p_yushan_regs->dppBootAddr;
+	sDxoStruct.uwDxoDopBootAddr = p_yushan_regs->dopBootAddr;
+
+	sDxoStruct.uwDxoPdpStartAddr = p_yushan_regs->pdpStartAddr;
+	sDxoStruct.uwDxoDppStartAddr = p_yushan_regs->dppStartAddr;
+	sDxoStruct.uwDxoDopStartAddr = p_yushan_regs->dopStartAddr;
+
+#if 0
+	pr_info("/*---------------------------------------*\\");
+	pr_info("array base ADDRs %d %d %d %d %d %d",
+		sDxoStruct.uwBaseAddrPdpMicroCode[0], sDxoStruct.uwBaseAddrDppMicroCode[0], sDxoStruct.uwBaseAddrDopMicroCode[0],
+		sDxoStruct.uwBaseAddrPdpMicroCode[1], sDxoStruct.uwBaseAddrDppMicroCode[1], sDxoStruct.uwBaseAddrDopMicroCode[1]);
+	pr_info("array 1st values %d %d %d %d %d %d",
+		*sDxoStruct.pDxoPdpRamImage[0], *sDxoStruct.pDxoDppRamImage[0], *sDxoStruct.pDxoDopRamImage[0],
+		*sDxoStruct.pDxoPdpRamImage[1], *sDxoStruct.pDxoDppRamImage[1], *sDxoStruct.pDxoDopRamImage[1]);
+	pr_info("array sizes %d %d %d %d %d %d",
+		sDxoStruct.uwDxoPdpRamImageSize[0], sDxoStruct.uwDxoDppRamImageSize[0], sDxoStruct.uwDxoDopRamImageSize[0],
+		sDxoStruct.uwDxoPdpRamImageSize[1], sDxoStruct.uwDxoDppRamImageSize[1], sDxoStruct.uwDxoDopRamImageSize[1]);
+	pr_info("Boot Addr %d %d %d",
+		sDxoStruct.uwDxoPdpBootAddr, sDxoStruct.uwDxoDppBootAddr, sDxoStruct.uwDxoDopBootAddr);
+	pr_info("\\*---------------------------------------*/");
+#endif
+
+	
+	
+#if 0
+	
+	switch (bSpiFreq) {
+	case 0x80:	
+		udwSpiFreq = 8<<16;
+		break;
+	case 0x00:	
+		udwSpiFreq = 4<<16;
+		break;
+	case 0x81:	
+		udwSpiFreq = 2<<16;
+		break;
+	case 0x01:	
+		udwSpiFreq = 1<<16;
+		break;
+	case 0x82:	
+		udwSpiFreq = 1<<8;
+		break;
+	case 0x02:	
+		udwSpiFreq = 1<<4;
+		break;
+	case 0x03:	
+		udwSpiFreq = 1<<2;
+		break;
+	  }
+#endif
+
+	sInitStruct.fpSpiClock			=	data.spi_clk*(1<<16);  
+	sInitStruct.fpExternalClock		=	sInitStruct.fpExternalClock << 16; 
+
+	sInitStruct.uwActivePixels = uwHSize;
+	sInitStruct.uwLineBlankStill = uwBlkPixels;
+	sInitStruct.uwLineBlankVf = uwBlkPixels;
+	sInitStruct.uwLines = uwVSize;
+	sInitStruct.uwFrameBlank = uwBlkLines;
+	sInitStruct.bUseExternalLDO = data.use_ext_1v2;
+	sImageChar_context.bImageOrientation = data.orientation;
+	sImageChar_context.uwXAddrStart = data.x_addr_start;
+	sImageChar_context.uwYAddrStart = data.y_addr_start;
+	sImageChar_context.uwXAddrEnd = data.x_addr_end;
+	sImageChar_context.uwYAddrEnd = data.y_addr_end;
+	sImageChar_context.uwXEvenInc = data.x_even_inc;
+	sImageChar_context.uwXOddInc = data.x_odd_inc;
+	sImageChar_context.uwYEvenInc = data.y_even_inc;
+	sImageChar_context.uwYOddInc = data.y_odd_inc;
+	sImageChar_context.bBinning = data.binning_rawchip;
+
+	memset(sInitStruct.sFrameFormat, 0, sizeof(Yushan_Frame_Format_t)*15);
+	if ((bPixelFormat == RAW8) || (bPixelFormat == RAW10_8)) {
+		CDBG("[CAM] bPixelFormat==RAW8");
+		sInitStruct.sFrameFormat[0].uwWordcount = (uwHSize);	
+		sInitStruct.sFrameFormat[0].bDatatype = 0x2a;		  
+	} else { 
+		CDBG("[CAM] bPixelFormat==RAW10");
+		sInitStruct.sFrameFormat[0].uwWordcount = (uwHSize*10)/8;	 
+		sInitStruct.sFrameFormat[0].bDatatype = 0x2b;		  
+	}
+	
+	if (bPixelFormat == RAW10_8) {
+		sInitStruct.sFrameFormat[0].bDatatype = 0x30;
+	}
+	sInitStruct.sFrameFormat[0].bActiveDatatype = 1;
+	sInitStruct.sFrameFormat[0].bSelectStillVfMode = YUSHAN_FRAME_FORMAT_STILL_MODE;
+
+	sInitStruct.bValidWCEntries = 1;
+
+	sGainsExpTime.uwAnalogGainCodeGR = 0x20; 
+	sGainsExpTime.uwAnalogGainCodeR = 0x20;
+	sGainsExpTime.uwAnalogGainCodeB = 0x20;
+	sGainsExpTime.uwPreDigGainGR = 0x100;
+	sGainsExpTime.uwPreDigGainR = 0x100;
+	sGainsExpTime.uwPreDigGainB = 0x100;
+	sGainsExpTime.uwExposureTime = 0x20;
+	sGainsExpTime.bRedGreenRatio = 0x40;
+	sGainsExpTime.bBlueGreenRatio = 0x40;
+
+	sDxoDppTuning.bTemporalSmoothing = 0x63; 
+	sDxoDppTuning.uwFlashPreflashRating = 0;
+	sDxoDppTuning.bFocalInfo = 0;
+
+	sDxoPdpTuning.bDeadPixelCorrectionLowGain = 0x80;
+	sDxoPdpTuning.bDeadPixelCorrectionMedGain = 0x80;
+	sDxoPdpTuning.bDeadPixelCorrectionHiGain = 0x80;
+
+#if 0
+	sDxoDopTuning.uwForceClosestDistance = 0;	
+	sDxoDopTuning.uwForceFarthestDistance = 0;
+#endif
+	sDxoDopTuning.bEstimationMode = 1;
+	sDxoDopTuning.bSharpness = 0x01; 
+	sDxoDopTuning.bDenoisingLowGain = 0x1; 
+	sDxoDopTuning.bNoiseVsDetailsLowGain = 0xA0;
+	sDxoDopTuning.bNoiseVsDetailsMedGain = 0x80;
+	sDxoDopTuning.bNoiseVsDetailsHiGain = 0x80;
+	bDppMode = DPP_enable ? 0x03 : 0;
+
+	if (strcmp(data.sensor_name, "s5k3h2yx") == 0)
+	{
+		sDxoDopTuning.bDenoisingMedGain = 0x60;
+		sDxoDopTuning.bDenoisingHiGain = 0x40;
+	}
+	else if (strcmp(data.sensor_name, "imx175") == 0)
+	{
+	    sDxoDopTuning.bSharpness = 0x01;
+	    sDxoDopTuning.bDenoisingLowGain = 0x30;
+	    sDxoDopTuning.bDenoisingMedGain = 0x80;
+	    sDxoDopTuning.bDenoisingHiGain =  0x60;
+ 
+	    sDxoDopTuning.bNoiseVsDetailsLowGain = 0xD0;
+	    sDxoDopTuning.bNoiseVsDetailsMedGain = 0xB0;
+	    sDxoDopTuning.bNoiseVsDetailsHiGain = 0xB0;
+	}
+	else if (strcmp(data.sensor_name, "ar0260") == 0)
+	{
+		sDxoDopTuning.bDenoisingLowGain = 0x60;
+		sDxoDopTuning.bDenoisingMedGain = 0x60;
+		sDxoDopTuning.bDenoisingHiGain =  0x60;
+	    sDxoDopTuning.bNoiseVsDetailsLowGain = 0x80;
+	    sDxoDopTuning.bNoiseVsDetailsMedGain = 0x80;
+	    sDxoDopTuning.bNoiseVsDetailsHiGain = 0x80;
+	    sDxoDopTuning.bSharpness = 0;
+		bDppMode =0;
+	}
+	else
+	{
+		sDxoDopTuning.bDenoisingMedGain = 0x60;
+		sDxoDopTuning.bDenoisingHiGain = 0x40;
+	}
+
+	sDxoDopTuning.bTemporalSmoothing = 0x26; 
+
+	gPllLocked = 0;
+	CDBG("[CAM] Yushan_common_init Yushan_Init_Clocks\n");
+	bStatus = Yushan_Init_Clocks(&sInitStruct, &sSystemStatus, udwIntrMask) ;
+	if (bStatus != SUCCESS) {
+		pr_err("[CAM] Clock Init FAILED\n");
+		pr_err("[CAM] Yushan_common_init Yushan_Init_Clocks=%d\n", bStatus);
+		pr_err("[CAM] Min Value Required %d\n", sSystemStatus.udwDxoConstraintsMinValue);
+		pr_err("[CAM] Error Code : %d\n", sSystemStatus.bDxoConstraints);
+		return -1;
+	} else
+		CDBG("[CAM] Clock Init Done \n");
+	
+	gPllLocked = 1;
+
+	
+	Yushan_AssignInterruptGroupsToPad1(uwAssignITRGrpToPad1);
+
+	CDBG("[CAM] Yushan_common_init Yushan_Init\n");
+	bStatus = Yushan_Init(&sInitStruct) ;
+	CDBG("[CAM] Yushan_common_init Yushan_Init=%d\n", bStatus);
+
+	
+	if (bPixelFormat == RAW10_8)
+		Yushan_DCPX_CPX_Enable();
+
+	if (bStatus == 0) {
+		pr_err("[CAM] Yushan Init FAILED\n");
+		return -1;
+	}
+	
+
+	if (data.use_rawchip == RAWCHIP_DXO_BYPASS) {
+		
+		Yushan_DXO_Lecci_Bypass();
+	}
+
+	if (data.use_rawchip == RAWCHIP_MIPI_BYPASS) {
+		
+		Yushan_DXO_DTFilter_Bypass();
+	}
+
+	if (data.use_rawchip == RAWCHIP_ENABLE) {
+		CDBG("[CAM] Yushan_common_init Yushan_Init_Dxo\n");
+		
+		bStatus = Yushan_Init_Dxo(&sDxoStruct, bBypassDxoUpload);
+		CDBG("[CAM] Yushan_common_init Yushan_Init_Dxo=%d\n", bStatus);
+		if (bStatus == SUCCESS) {
+			CDBG("[CAM] DXO Upload and Init Done\n");
+		} else {
+			pr_err("[CAM] DXO Upload and Init FAILED\n");
+			return -1;
+		}
+		CDBG("[CAM] Yushan_common_init Yushan_Get_Version_Information\n");
+
+		bStatus = Yushan_Get_Version_Information(&sYushanVersionInfo) ;
+	
+	#if 1 
+		CDBG("Yushan_common_init Yushan_Get_Version_Information=%d\n", bStatus);
+
+		CDBG("API Version : %d.%d \n", sYushanVersionInfo.bApiMajorVersion, sYushanVersionInfo.bApiMinorVersion);
+		CDBG("DxO Pdp Version : %x \n", sYushanVersionInfo.udwPdpVersion);
+		CDBG("DxO Dpp Version : %x \n", sYushanVersionInfo.udwDppVersion);
+		CDBG("DxO Dop Version : %x \n", sYushanVersionInfo.udwDopVersion);
+		CDBG("DxO Pdp Calibration Version : %x \n", sYushanVersionInfo.udwPdpCalibrationVersion);
+		CDBG("DxO Dpp Calibration Version : %x \n", sYushanVersionInfo.udwDppCalibrationVersion);
+		CDBG("DxO Dop Calibration Version : %x \n", sYushanVersionInfo.udwDopCalibrationVersion);
+	#endif
+	
+
+	#if 0
+		
+		if (bTestPatternMode == 1) {
+			
+			Yushan_PatternGenerator(&sInitStruct, bPatternReq, bDxoBypassForTestPattern);
+			
+			return 0;
+		}
+	#endif
+
+		
+		Yushan_Update_ImageChar(&sImageChar_context);
+	
+		Yushan_Update_SensorParameters(&sGainsExpTime);
+		Yushan_Update_DxoDpp_TuningParameters(&sDxoDppTuning);
+		Yushan_Update_DxoDop_TuningParameters(&sDxoDopTuning);
+		Yushan_Update_DxoPdp_TuningParameters(&sDxoPdpTuning);
+		bStatus = Yushan_Update_Commit(bPdpMode, bDppMode, bDopMode);
+		CDBG("[CAM] Yushan_common_init Yushan_Update_Commit=%d\n", bStatus);
+
+		
+		
+		bStatus &= Yushan_WaitForInterruptEvent(EVENT_PDP_EOF_EXECCMD, TIME_100MS);
+		if (!bStatus)
+		{
+			pr_err("[CAM] EVENT_PDP_EOF_EXECCMD fail\n");
+			return -1;
+		}
+
+		bStatus &= Yushan_WaitForInterruptEvent2(EVENT_DOP7_EOF_EXECCMD, TIME_100MS);
+		if (!bStatus)
+		{
+			pr_err("[CAM] EVENT_DOP7_EOF_EXECCMD fail\n");
+			return -1;
+		}
+
+		bStatus &= Yushan_WaitForInterruptEvent(EVENT_DPP_EOF_EXECCMD, TIME_100MS);
+		if (!bStatus)
+		{
+			pr_err("[CAM] EVENT_DPP_EOF_EXECCMD fail\n");
+			return -1;
+		}
+
+		if (bStatus == 1)
+			CDBG("[CAM] DXO Commit Done\n");
+		else {
+			pr_err("[CAM] DXO Commit FAILED\n");
+			
+		}
+	}
+#if 0
+	
+	bSpiData = 0;
+	SPI_Write(YUSHAN_SMIA_FM_EOF_INT_EN, 1,  &bSpiData);
+#endif
+
+	return (bStatus == SUCCESS) ? 0 : -1;
+#endif
+	return 0;
+}
+bool_t Yushan_Dxo_Dop_Af_Run(Yushan_AF_ROI_t	*sYushanAfRoi, uint32_t *pAfStatsGreen, uint8_t	bRoiActiveNumber)
+{
+
+	uint8_t		bStatus = SUCCESS;
+	
+#if 1
+	uint32_t		enableIntrMask[] = {0x00338E30, 0x00000000, 0x00018000};
+	uint32_t		disableIntrMask[] = {0x00238E30, 0x00000000, 0x00018000};
+#endif
+
+	
+
+	
+
+	if (bRoiActiveNumber)
+	{
+		Yushan_Intr_Enable((uint8_t*)enableIntrMask);
+		
+		bStatus = Yushan_AF_ROI_Update(&sYushanAfRoi[0], bRoiActiveNumber);
+		bStatus &= Yushan_Update_Commit(bPdpMode,bDppMode,bDopMode);
+
+		
+		bStatus &= Yushan_WaitForInterruptEvent2(EVENT_DXODOP7_NEWFRAMEPROC_ACK, TIME_100MS);
+	}
+	else
+		Yushan_Intr_Enable((uint8_t*)disableIntrMask);
+
+#if 0
+	if (bStatus) {
+		
+		#if 0
+		yushan_go_to_position(0, 0);
+		for(i=1; i<=42; i++)
+		{
+			s5k3h2yx_move_focus( 1, i);
+			bStatus = Yushan_Read_AF_Statistics(pAfStatsGreen);
+		}
+		#endif
+		bStatus = Yushan_Read_AF_Statistics(pAfStatsGreen);
+	}
+
+	if (!bStatus) {
+		pr_err("ROI AF Statistics read failed\n");
+		return FAILURE;
+	} else
+		pr_err("Read ROI AF Statistics successfully\n");
+#endif
+
+	return SUCCESS;
+
+}
+
+#if 0
+bool_t Yushan_get_AFSU(Yushan_AF_Stats_t* sYushanAFStats)
+{
+
+	uint8_t		bStatus = SUCCESS, bNumOfActiveRoi = 0,  bCount = 0;
+	uint32_t	udwSpiData[4];
+	uint16_t val ;
+
+#if 0
+			YushanPrintFrameNumber();
+			YushanPrintDxODOPAfStrategy();
+			YushanPrintImageInformation();
+			YushanPrintVisibleLineSizeAndRoi();
+#endif
+
+	
+	bStatus &= SPI_Read(DXO_DOP_BASE_ADDR+DxODOP_ROI_active_number_7_0, 1, (uint8_t*)(&bNumOfActiveRoi));
+
+	if (!bNumOfActiveRoi) 
+		return SUCCESS;
+
+	SPI_Read(DXO_DOP_BASE_ADDR+DxODOP_frame_number_7_0, 2, (uint8_t *)(&val));
+	sYushanAFStats[0].frameIdx= val;
+
+	
+	
+	while(bCount<bNumOfActiveRoi)
+	{
+		
+		bStatus &= SPI_Read((uint16_t)(DXO_DOP_BASE_ADDR + DxODOP_ROI_0_stats_G_7_0 + bCount*16), 16, (uint8_t *)(&udwSpiData[0]));
+		
+		sYushanAFStats[bCount].udwAfStatsGreen        = udwSpiData[0];
+		sYushanAFStats[bCount].udwAfStatsRed            = udwSpiData[1];
+		sYushanAFStats[bCount].udwAfStatsBlue           = udwSpiData[2];
+		sYushanAFStats[bCount].udwAfStatsConfidence = udwSpiData[3];
+		sYushanAFStats[bCount].frameIdx                    = sYushanAFStats[0].frameIdx;
+#if 0
+		pr_info("[CAM]%s, G:%d, R:%d, B:%d, confidence:%d (%d) \n", __func__,
+			sYushanAFStats[bCount].udwAfStatsGreen,
+			sYushanAFStats[bCount].udwAfStatsRed,
+		    sYushanAFStats[bCount].udwAfStatsBlue,
+		    sYushanAFStats[bCount].udwAfStatsConfidence,
+		    sYushanAFStats[bCount].frameIdx);
+#endif
+		bCount++;
+	}
+
+
+
+	return bStatus;
+}
+#else
+int Yushan_get_AFSU(rawchip_af_stats* af_stats)
+{
+
+	uint8_t		bStatus = SUCCESS;
+
+	bStatus = Yushan_Read_AF_Statistics(af_stats->udwAfStats, 1, &af_stats->frameIdx);
+	if (bStatus == FAILURE) {
+		pr_err("[CAM] Get AFSU statistic data fail\n");
+		return -1;
+	}
+	CDBG("[CAM] GET_AFSU:G:%d, R:%d, B:%d, confi:%d, frmIdx:%d\n",
+		af_stats->udwAfStats[0].udwAfStatsGreen,
+		af_stats->udwAfStats[0].udwAfStatsRed,
+		af_stats->udwAfStats[0].udwAfStatsBlue,
+		af_stats->udwAfStats[0].udwAfStatsConfidence,
+		af_stats->frameIdx);
+	return 0;
+}
+#endif
+
+
+int	Yushan_ContextUpdate_Wrapper(Yushan_New_Context_Config_t	sYushanNewContextConfig, Yushan_ImageChar_t	sImageNewChar_context)
+{
+
+	bool_t	bStatus = SUCCESS;
+	
+
+		CDBG("[CAM] Reconfiguration starts:%d,%d,%d\n",
+			sYushanNewContextConfig->uwActiveFrameLength,
+			sYushanNewContextConfig->uwActivePixels,
+			sYushanNewContextConfig->uwLineBlank);
+		bStatus = Yushan_Context_Config_Update(&sYushanNewContextConfig);
+		
+
+#if 0
+	
+	sImageChar_context.bImageOrientation = sYushanNewContextConfig->orientation;
+	sImageChar_context.uwXAddrStart = sYushanNewContextConfig->uwXAddrStart;
+	sImageChar_context.uwYAddrStart = sYushanNewContextConfig->uwYAddrStart;
+	sImageChar_context.uwXAddrEnd= sYushanNewContextConfig->uwXAddrEnd;
+	sImageChar_context.uwYAddrEnd= sYushanNewContextConfig->uwYAddrEnd;
+
+	sImageChar_context.uwXEvenInc = sYushanNewContextConfig->uwXEvenInc;
+	sImageChar_context.uwXOddInc = sYushanNewContextConfig->uwXOddInc;
+	sImageChar_context.uwYEvenInc = sYushanNewContextConfig->uwYEvenInc;
+	sImageChar_context.uwYOddInc = sYushanNewContextConfig->uwYOddInc;
+	sImageChar_context.bBinning = sYushanNewContextConfig->bBinning;
+#endif
+
+
+	
+	Yushan_Update_ImageChar(&sImageNewChar_context);
+	bStatus &= Yushan_Update_Commit(bPdpMode,bDppMode,bDopMode);
+
+	
+	
+	bStatus &= Yushan_WaitForInterruptEvent(EVENT_PDP_EOF_EXECCMD, TIME_100MS);
+	if (!bStatus)
+	{
+		pr_err("[CAM] EVENT_PDP_EOF_EXECCMD fail\n");
+		return -1;
+	}
+
+	bStatus &= Yushan_WaitForInterruptEvent2(EVENT_DOP7_EOF_EXECCMD, TIME_100MS);
+	if (!bStatus)
+	{
+		pr_err("[CAM] EVENT_DOP7_EOF_EXECCMD fail\n");
+		return -1;
+	}
+
+	bStatus &= Yushan_WaitForInterruptEvent(EVENT_DPP_EOF_EXECCMD, TIME_100MS);
+	if (!bStatus)
+	{
+		pr_err("[CAM] EVENT_DPP_EOF_EXECCMD fail\n");
+		return -1;
+	}
+
+	if (bStatus)
+		CDBG("[CAM] DXO Commit, Post Context Reconfigration, Done\n");
+	else
+		pr_err("[CAM] DXO Commit, Post Context Reconfigration, FAILED\n");
+
+	return (bStatus == SUCCESS) ? 0 : -1;
+
+}
+
+#if 0
+void Yushan_Write_Exp_Time_Gain(uint16_t yushan_line, uint16_t yushan_gain)
+{
+#if 0
+	Yushan_GainsExpTime_t sGainsExpTime;
+	uint32_t udwSpiBaseIndex;
+	uint32_t spidata;
+	float ratio = 0.019;
+	pr_info("[CAM] Yushan_Write_Exp_Time_Gain, yushan_gain:%d, yushan_line:%d", yushan_gain, yushan_line);
+#endif
+
+	sGainsExpTime.uwAnalogGainCodeGR= yushan_gain;
+	sGainsExpTime.uwAnalogGainCodeR=yushan_gain;
+	sGainsExpTime.uwAnalogGainCodeB=yushan_gain;
+	sGainsExpTime.uwPreDigGainGR= 0x100;
+	sGainsExpTime.uwPreDigGainR= 0x100;
+	sGainsExpTime.uwPreDigGainB= 0x100;
+	sGainsExpTime.uwExposureTime= (uint16_t)((19*yushan_line/1000));
+
+	if (sGainsExpTime.bRedGreenRatio == 0) sGainsExpTime.bRedGreenRatio=0x40;
+	if (sGainsExpTime.bBlueGreenRatio == 0) sGainsExpTime.bBlueGreenRatio=0x40;
+
+	pr_err("[CAM] uwExposureTime: %d\n", sGainsExpTime.uwExposureTime);
+	Yushan_Update_SensorParameters(&sGainsExpTime);
+#if 0
+	pr_info("DxO Regiser Dump Start******* \n");
+	SPI_Read((0x821E), 4, (uint8_t *)(&spidata));
+	pr_info("DxO DOP 0x821E : %x \n",spidata);
+	SPI_Read((0x8222), 4, (uint8_t *)(&spidata));
+	pr_info("DxO DOP 0x8222 : %x \n",spidata);
+	SPI_Read((0x8226), 4, (uint8_t *)(&spidata));
+	pr_info("DxO DOP 0x8226 : %x \n",spidata);
+	SPI_Read((0x822A), 4, (uint8_t *)(&spidata));
+	pr_info("DxO DOP 0x822A : %x \n",spidata);
+	SPI_Read((0x822E), 2, (uint8_t *)(&spidata));
+	pr_info("DxO DOP 0x822E : %x \n",spidata);
+	SPI_Read((0x8204), 4, (uint8_t *)(&spidata));
+	pr_info("DxO DOP Cali_ID : %x \n",spidata);
+
+	udwSpiBaseIndex = 0x010000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+	SPI_Read((0x821E), 4, (uint8_t *)(&spidata));
+	pr_info("DxO DPP 0x821E : %x \n",spidata);
+	SPI_Read((0x8222), 4, (uint8_t *)(&spidata));
+	pr_info("DxO DPP 0x8222 : %x \n",spidata);
+	SPI_Read((0x8226), 4, (uint8_t *)(&spidata));
+	pr_info("DxO DPP 0x8226 : %x \n",spidata);
+	SPI_Read((0x822A), 2, (uint8_t *)(&spidata));
+	pr_info("DxO DPP 0x822A : %x \n",spidata);
+	SPI_Read((0x8204), 4, (uint8_t *)(&spidata));
+	pr_info("DxO DPP Cali_ID : %x \n",spidata);
+
+	udwSpiBaseIndex = 0x08000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+	SPI_Read((0x621E), 4, (uint8_t *)(&spidata));
+	pr_info("DxO PDP 0x621E : %x \n",spidata);
+	SPI_Read((0x6222), 4, (uint8_t *)(&spidata));
+	pr_info("DxO PDP 0x6222 : %x \n",spidata);
+	SPI_Read((0x6226), 4, (uint8_t *)(&spidata));
+	pr_info("DxO PDP 0x6226 : %x \n",spidata);
+	SPI_Read((0x622A), 2, (uint8_t *)(&spidata));
+	pr_info("DxO PDP 0x622A : %x \n",spidata);
+	SPI_Read((0x6204), 4, (uint8_t *)(&spidata));
+	pr_info("DxO PDP Cali_ID : %x \n",spidata);
+#endif
+
+}
+#endif
+
+int Yushan_Set_AF_Strategy(uint8_t afStrategy)
+{
+	uint8_t		bStatus = SUCCESS;
+	CDBG("[CAM] Yushan_Set_AF_Strategy\n");
+	bStatus = Yushan_Update_DxoDop_Af_Strategy(afStrategy);
+	return (bStatus == SUCCESS) ? 0 : -1;
+}
+
+int Yushan_Get_Version(rawchip_dxo_version* dxo_version)
+{
+	uint32_t udwSpiBaseIndex = 0;
+	CDBG("[CAM] Yushan_Get_Version\n");
+
+	SPI_Read(DXO_DOP_BASE_ADDR+DxODOP_ucode_id_7_0 , 2,(uint8_t *)(&(dxo_version->udwDOPUcodeId)));
+	SPI_Read(DXO_DOP_BASE_ADDR+DxODOP_hw_id_7_0      , 2,(uint8_t *)(&(dxo_version->udwDOPHwId    )));
+	SPI_Read(DXO_DOP_BASE_ADDR+DxODOP_calib_id_0_7_0, 4,(uint8_t *)(&(dxo_version->udwDOPCalibId )));
+
+	udwSpiBaseIndex = 0x010000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+	SPI_Read((DXO_DPP_BASE_ADDR-0x8000)+DxODPP_ucode_id_7_0 , 2, (uint8_t *)(&(dxo_version->udwDPPUcodeId)));
+	SPI_Read((DXO_DPP_BASE_ADDR-0x8000)+DxODPP_hw_id_7_0      , 2, (uint8_t *)(&(dxo_version->udwDPPHwId)));
+	SPI_Read((DXO_DPP_BASE_ADDR-0x8000)+DxODPP_calib_id_0_7_0, 4, (uint8_t *)(&(dxo_version->udwDPPCalibId)));
+	udwSpiBaseIndex = 0x08000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+       SPI_Read(DXO_PDP_BASE_ADDR+DxOPDP_ucode_id_7_0 , 2,(uint8_t *)(&(dxo_version->udwPDPUcodeId)));
+	SPI_Read(DXO_PDP_BASE_ADDR+DxOPDP_hw_id_7_0      , 2,(uint8_t *)(&(dxo_version->udwPDPHwId)));
+	SPI_Read(DXO_PDP_BASE_ADDR+DxOPDP_calib_id_0_7_0, 4,(uint8_t *)(&(dxo_version->udwPDPCalibId)));
+
+	CDBG("[CAM] Yushan_Get_Version : DOP ucodeid 0x%04x\n",dxo_version->udwDOPUcodeId);
+	CDBG("[CAM] Yushan_Get_Version : DOP hwid     0x%04x\n",dxo_version->udwDOPHwId);
+	CDBG("[CAM] Yushan_Get_Version : DOP calibid  0x%08x\n",dxo_version->udwDOPCalibId);
+	CDBG("[CAM] Yushan_Get_Version : DPP ucodeid 0x%04x\n",dxo_version->udwDPPUcodeId);
+	CDBG("[CAM] Yushan_Get_Version : DPP hwid     0x%04x\n",dxo_version->udwDPPHwId);
+	CDBG("[CAM] Yushan_Get_Version : DPP calibid  0x%08x\n",dxo_version->udwDPPCalibId);
+	CDBG("[CAM] Yushan_Get_Version : PDP ucodeid 0x%04x\n",dxo_version->udwPDPUcodeId);
+	CDBG("[CAM] Yushan_Get_Version : PDP hwid     0x%04x\n",dxo_version->udwPDPHwId);
+	CDBG("[CAM] Yushan_Get_Version : PDP calibid  0x%08x\n",dxo_version->udwPDPCalibId);
+
+	return SUCCESS;
+}
+int Yushan_Update_AEC_AWB_Params(rawchip_update_aec_awb_params_t *update_aec_awb_params)
+{
+	uint8_t bStatus = SUCCESS;
+	Yushan_GainsExpTime_t sGainsExpTime;
+
+	sGainsExpTime.uwAnalogGainCodeGR = update_aec_awb_params->aec_params.gain;
+	sGainsExpTime.uwAnalogGainCodeR = update_aec_awb_params->aec_params.gain;
+	sGainsExpTime.uwAnalogGainCodeB = update_aec_awb_params->aec_params.gain;
+	sGainsExpTime.uwPreDigGainGR = update_aec_awb_params->aec_params.dig_gain;
+	sGainsExpTime.uwPreDigGainR = update_aec_awb_params->aec_params.dig_gain;
+	sGainsExpTime.uwPreDigGainB = update_aec_awb_params->aec_params.dig_gain;
+	sGainsExpTime.uwExposureTime = update_aec_awb_params->aec_params.exp;
+	sGainsExpTime.bRedGreenRatio = update_aec_awb_params->awb_params.rg_ratio;
+	sGainsExpTime.bBlueGreenRatio = update_aec_awb_params->awb_params.bg_ratio;
+#if 0
+	if (sGainsExpTime.bRedGreenRatio == 0)
+		sGainsExpTime.bRedGreenRatio = 0x40;
+	if (sGainsExpTime.bBlueGreenRatio == 0)
+		sGainsExpTime.bBlueGreenRatio = 0x40;
+#endif
+
+	CDBG("[CAM] uwExposureTime: %d\n", sGainsExpTime.uwExposureTime);
+	bStatus = Yushan_Update_SensorParameters(&sGainsExpTime);
+
+	return (bStatus == SUCCESS) ? 0 : -1;
+}
+
+int Yushan_Update_AF_Params(rawchip_update_af_params_t *update_af_params)
+{
+
+	uint8_t bStatus = SUCCESS;
+	bStatus = Yushan_AF_ROI_Update(&update_af_params->af_params.sYushanAfRoi[0],
+		update_af_params->af_params.active_number);
+	return (bStatus == SUCCESS) ? 0 : -1;
+}
+
+int Yushan_Update_3A_Params(rawchip_newframe_ack_enable_t enable_newframe_ack)
+{
+	uint8_t bStatus = SUCCESS;
+	uint32_t		enableIntrMask[] = {0x3DF38E3B, 0xFC3C3C3C, 0x001B7FFB};
+	uint32_t		disableIntrMask[] = {0x3DE38E3B, 0xFC3C3C3C, 0x001B7FFB};
+	if (enable_newframe_ack == RAWCHIP_NEWFRAME_ACK_ENABLE)
+		Yushan_Intr_Enable((uint8_t*)enableIntrMask);
+	else if (enable_newframe_ack == RAWCHIP_NEWFRAME_ACK_DISABLE)
+		Yushan_Intr_Enable((uint8_t*)disableIntrMask);
+	bStatus = Yushan_Update_Commit(bPdpMode, bDppMode, bDopMode);
+	return (bStatus == SUCCESS) ? 0 : -1;
+}
+
+void Yushan_dump_register(void)
+{
+	uint16_t read_data = 0;
+	uint8_t i;
+	for (i = 0; i < 50; i++) {
+		
+		rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_FRAME_NUMBER, &read_data);
+		pr_info("[CAM] Yushan's in counting=%d\n", read_data);
+
+		
+		rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_FRAME_NO_0, &read_data);
+		pr_info("[CAM] Yushan's out counting=%d\n", read_data);
+
+		mdelay(30);
+	}
+
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2RX_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2RX_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2TX_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2TX_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_IDP_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_IDP_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_P2W_UFLOW_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_P2W_UFLOW_STATUS=%x\n", read_data);
+}
+
+void Yushan_dump_all_register(void)
+{
+	uint16_t read_data = 0;
+	uint8_t i;
+	for (i = 0; i < 50; i++) {
+		
+		rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_FRAME_NUMBER, &read_data);
+		pr_info("[CAM] Yushan's in counting=%d\n", read_data);
+
+		
+		rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_FRAME_NO_0, &read_data);
+		pr_info("[CAM] Yushan's out counting=%d\n", read_data);
+
+		mdelay(30);
+	}
+
+	rawchip_spi_read_2B2B(YUSHAN_CLK_DIV_FACTOR, &read_data);
+	pr_info("[CAM]YUSHAN_CLK_DIV_FACTOR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CLK_DIV_FACTOR_2, &read_data);
+	pr_info("[CAM]YUSHAN_CLK_DIV_FACTOR_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CLK_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_CLK_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_RESET_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_RESET_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_PLL_CTRL_MAIN, &read_data);
+	pr_info("[CAM]YUSHAN_PLL_CTRL_MAIN=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_PLL_LOOP_OUT_DF, &read_data);
+	pr_info("[CAM]YUSHAN_PLL_LOOP_OUT_DF=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_PLL_SSCG_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_PLL_SSCG_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_HOST_IF_SPI_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_HOST_IF_SPI_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_HOST_IF_SPI_DEVADDR, &read_data);
+	pr_info("[CAM]YUSHAN_HOST_IF_SPI_DEVADDR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, &read_data);
+	pr_info("[CAM]YUSHAN_HOST_IF_SPI_BASE_ADDRESS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2RX_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2RX_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2RX_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2RX_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2RX_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2RX_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2RX_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2RX_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2RX_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2RX_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2RX_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2RX_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_PDP_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_PDP_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_PDP_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_PDP_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_PDP_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_PDP_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_PDP_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_PDP_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_PDP_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_PDP_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_PDP_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_PDP_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DPP_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DPP_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DPP_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DPP_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DPP_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DPP_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DPP_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DPP_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DPP_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DPP_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DPP_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DPP_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DOP7_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DOP7_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DOP7_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DOP7_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DOP7_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DOP7_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DOP7_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DOP7_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DOP7_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DOP7_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_DOP7_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_DOP7_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2TX_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2TX_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2TX_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2TX_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2TX_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2TX_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2TX_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2TX_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2TX_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2TX_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_CSI2TX_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_CSI2TX_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_PHY_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_PHY_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_PHY_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_PHY_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_PHY_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_PHY_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_PHY_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_PHY_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_PHY_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_PHY_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_PHY_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_PHY_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_TX_PHY_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_TX_PHY_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_TX_PHY_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_TX_PHY_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_TX_PHY_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_TX_PHY_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_TX_PHY_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_TX_PHY_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_TX_PHY_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_TX_PHY_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_TX_PHY_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_TX_PHY_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_IDP_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_IDP_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_IDP_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_IDP_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_IDP_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_IDP_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_IDP_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_IDP_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_IDP_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_IDP_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_IDP_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_IDP_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_CHAR_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_CHAR_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_CHAR_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_CHAR_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_CHAR_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_CHAR_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_CHAR_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_CHAR_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_CHAR_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_CHAR_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_RX_CHAR_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_RX_CHAR_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_LBE_POST_DXO_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_LBE_POST_DXO_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_LBE_POST_DXO_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_LBE_POST_DXO_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_LBE_POST_DXO_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_LBE_POST_DXO_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_LBE_POST_DXO_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_LBE_POST_DXO_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_LBE_POST_DXO_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_LBE_POST_DXO_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_LBE_POST_DXO_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_LBE_POST_DXO_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_SYS_DOMAIN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_SYS_DOMAIN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_SYS_DOMAIN_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_SYS_DOMAIN_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_SYS_DOMAIN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_SYS_DOMAIN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_SYS_DOMAIN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_SYS_DOMAIN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_SYS_DOMAIN_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_SYS_DOMAIN_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_SYS_DOMAIN_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_SYS_DOMAIN_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_ITPOINT_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_ITPOINT_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_ITPOINT_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_ITPOINT_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_ITPOINT_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_ITPOINT_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_ITPOINT_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_ITPOINT_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_ITPOINT_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_ITPOINT_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_ITPOINT_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_ITPOINT_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_P2W_UFLOW_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_P2W_UFLOW_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_P2W_UFLOW_EN_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_P2W_UFLOW_EN_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_P2W_UFLOW_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_P2W_UFLOW_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_P2W_UFLOW_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_P2W_UFLOW_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_P2W_UFLOW_EN_STATUS_BCLR, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_P2W_UFLOW_EN_STATUS_BCLR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITM_P2W_UFLOW_EN_STATUS_BSET, &read_data);
+	pr_info("[CAM]YUSHAN_ITM_P2W_UFLOW_EN_STATUS_BSET=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_DATA_WORD_0, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_DATA_WORD_0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_DATA_WORD_1, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_DATA_WORD_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_DATA_WORD_2, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_DATA_WORD_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_DATA_WORD_3, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_DATA_WORD_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_HYST, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_HYST=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_PDN, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_PDN=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_PUN, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_PUN=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_LOWEMI, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_LOWEMI=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_PAD_IN, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_PAD_IN=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_RATIO_PAD, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_RATIO_PAD=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_SEND_ITR_PAD1, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_SEND_ITR_PAD1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_INTR_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_INTR_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IOR_NVM_LDO_STS_REG, &read_data);
+	pr_info("[CAM]YUSHAN_IOR_NVM_LDO_STS_REG=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_T1_DMA_REG_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_T1_DMA_REG_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_T1_DMA_REG_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_T1_DMA_REG_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_T1_DMA_REG_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_T1_DMA_REG_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_T1_DMA_REG_REFILL_ELT_NB, &read_data);
+	pr_info("[CAM]YUSHAN_T1_DMA_REG_REFILL_ELT_NB=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_T1_DMA_REG_REFILL_ERROR, &read_data);
+	pr_info("[CAM]YUSHAN_T1_DMA_REG_REFILL_ERROR=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_T1_DMA_REG_DFV_CONTROL, &read_data);
+	pr_info("[CAM]YUSHAN_T1_DMA_REG_DFV_CONTROL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_T1_DMA_MEM_PAGE, &read_data);
+	pr_info("[CAM]YUSHAN_T1_DMA_MEM_PAGE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_T1_DMA_MEM_LOWER_ELT, &read_data);
+	pr_info("[CAM]YUSHAN_T1_DMA_MEM_LOWER_ELT=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_T1_DMA_MEM_UPPER_ELT, &read_data);
+	pr_info("[CAM]YUSHAN_T1_DMA_MEM_UPPER_ELT=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_UIX4, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_UIX4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_SWAP_PINS, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_SWAP_PINS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_INVERT_HS, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_INVERT_HS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_STOP_STATE, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_STOP_STATE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_ULP_STATE, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_ULP_STATE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_CLK_ACTIVE, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_CLK_ACTIVE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_FORCE_RX_MODE_DL, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_FORCE_RX_MODE_DL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_TEST_RESERVED, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_TEST_RESERVED=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_ESC_DL_STS, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_ESC_DL_STS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_EOT_BYPASS, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_EOT_BYPASS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_HSRX_SHIFT_CL, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_HSRX_SHIFT_CL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_HS_RX_SHIFT_DL, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_HS_RX_SHIFT_DL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_VIL_CL, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_VIL_CL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_VIL_DL, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_VIL_DL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_OVERSAMPLE_BYPASS, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_OVERSAMPLE_BYPASS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_OVERSAMPLE_FLAG1, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_OVERSAMPLE_FLAG1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_SKEW_OFFSET_1, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_SKEW_OFFSET_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_SKEW_OFFSET_2, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_SKEW_OFFSET_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_SKEW_OFFSET_3, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_SKEW_OFFSET_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_SKEW_OFFSET_4, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_SKEW_OFFSET_4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_OFFSET_CL, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_OFFSET_CL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_CALIBRATE, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_CALIBRATE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_SPECS, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_SPECS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_COMP, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_COMP=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_MIPI_IN_SHORT, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_MIPI_IN_SHORT=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_LANE_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_LANE_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_VER_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_VER_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_NB_DATA_LANES, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_NB_DATA_LANES=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_IMG_UNPACKING_FORMAT, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_IMG_UNPACKING_FORMAT=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_WAIT_AFTER_PACKET_END, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_WAIT_AFTER_PACKET_END=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_MULTIPLE_OF_5_HSYNC_EXTENSION_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_MULTIPLE_OF_5_HSYNC_EXTENSION_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_MULTIPLE_OF_5_HSYNC_EXTENSION_PADDING_DATA, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_MULTIPLE_OF_5_HSYNC_EXTENSION_PADDING_DATA=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_CHARACTERIZATION_MODE, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_CHARACTERIZATION_MODE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_BYTE2PIXEL_READ_TH, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_BYTE2PIXEL_READ_TH=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_VIRTUAL_CHANNEL, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_VIRTUAL_CHANNEL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_DATA_TYPE, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_DATA_TYPE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_FRAME_NUMBER, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_FRAME_NUMBER=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_LINE_NUMBER, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_LINE_NUMBER=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_DATA_FIELD, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_DATA_FIELD=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_WORD_COUNT, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_WORD_COUNT=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_ECC_ERROR_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_ECC_ERROR_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_RX_DFV, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_RX_DFV=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITPOINT_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_ITPOINT_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITPOINT_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_ITPOINT_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITPOINT_PIX_POS, &read_data);
+	pr_info("[CAM]YUSHAN_ITPOINT_PIX_POS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITPOINT_LINE_POS, &read_data);
+	pr_info("[CAM]YUSHAN_ITPOINT_LINE_POS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITPOINT_PIX_CNT, &read_data);
+	pr_info("[CAM]YUSHAN_ITPOINT_PIX_CNT=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITPOINT_LINE_CNT, &read_data);
+	pr_info("[CAM]YUSHAN_ITPOINT_LINE_CNT=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITPOINT_FRAME_CNT, &read_data);
+	pr_info("[CAM]YUSHAN_ITPOINT_FRAME_CNT=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_ITPOINT_DFV, &read_data);
+	pr_info("[CAM]YUSHAN_ITPOINT_DFV=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_AUTO_RUN, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_AUTO_RUN=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_CONTROL, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_CONTROL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_LINE_LENGTH, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_LINE_LENGTH=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_FRAME_LENGTH, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_FRAME_LENGTH=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_ERROR_LINES_EOF_GAP, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_ERROR_LINES_EOF_GAP=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_0, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_1, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_2, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_3, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_4, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_5, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_5=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_6, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_6=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_7, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_7=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_8, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_8=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_9, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_9=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_10, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_10=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_11, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_11=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_12, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_12=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_13, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_13=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_WC_DI_14, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_WC_DI_14=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_IDP_GEN_DFV, &read_data);
+	pr_info("[CAM]YUSHAN_IDP_GEN_DFV=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_VERSION_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_VERSION_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLORBAR_WIDTH_BY4_M1, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLORBAR_WIDTH_BY4_M1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_0, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_1, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_2, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_3, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_4, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_5, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_5=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_6, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_6=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_7, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_7=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_0, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_1, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_2, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_3, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_4, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_5, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_5=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_6, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_6=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_7, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_7=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_0, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_1, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_2, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_3, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_4, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_5, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_5=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_6, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_6=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_7, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_7=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_0, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_1, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_2, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_3, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_4, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_5, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_5=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_6, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_6=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_7, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_7=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_RX_DTCHK_DFV, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_RX_DTCHK_DFV=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_PATTERN_GEN_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_PATTERN_GEN_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_PATTERN_GEN_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_PATTERN_GEN_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_PATTERN_GEN_PATTERN_TYPE_REQ, &read_data);
+	pr_info("[CAM]YUSHAN_PATTERN_GEN_PATTERN_TYPE_REQ=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_PATTERN_GEN_TPAT_DATA_RG, &read_data);
+	pr_info("[CAM]YUSHAN_PATTERN_GEN_TPAT_DATA_RG=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_PATTERN_GEN_TPAT_DATA_BG, &read_data);
+	pr_info("[CAM]YUSHAN_PATTERN_GEN_TPAT_DATA_BG=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_PATTERN_GEN_TPAT_HCUR_WP, &read_data);
+	pr_info("[CAM]YUSHAN_PATTERN_GEN_TPAT_HCUR_WP=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_PATTERN_GEN_TPAT_VCUR_WP, &read_data);
+	pr_info("[CAM]YUSHAN_PATTERN_GEN_TPAT_VCUR_WP=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_PATTERN_GEN_PATTERN_TYPE_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_PATTERN_GEN_PATTERN_TYPE_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_DCPX_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_DCPX_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_DCPX_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_DCPX_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_DCPX_ENABLE_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_DCPX_ENABLE_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_DCPX_MODE_REQ, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_DCPX_MODE_REQ=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_DCPX_MODE_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_DCPX_MODE_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_CPX_CTRL_REQ, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_CPX_CTRL_REQ=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_CPX_MODE_REQ, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_CPX_MODE_REQ=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_CPX_CTRL_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_CPX_CTRL_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_CPX_MODE_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_CPX_MODE_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_FM_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_FM_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_FM_PIX_WIDTH, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_FM_PIX_WIDTH=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_FM_GROUPED_PARAMETER_HOLD, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_FM_GROUPED_PARAMETER_HOLD=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_FM_EOF_INT_EN, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_FM_EOF_INT_EN=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_SMIA_FM_EOF_INT_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_SMIA_FM_EOF_INT_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_P2W_FIFO_WR_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_P2W_FIFO_WR_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_P2W_FIFO_WR_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_P2W_FIFO_WR_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_P2W_FIFO_RD_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_P2W_FIFO_RD_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_P2W_FIFO_RD_STATUS, &read_data);
+	pr_info("[CAM]YUSHAN_P2W_FIFO_RD_STATUS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_WRAPPER_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_WRAPPER_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_WRAPPER_THRESH, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_WRAPPER_THRESH=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_WRAPPER_CHAR_EN, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_WRAPPER_CHAR_EN=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_VERSION_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_VERSION_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_NUMBER_OF_LANES, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_NUMBER_OF_LANES=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LANE_MAPPING, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LANE_MAPPING=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_CONTROL, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_CONTROL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_INTERPACKET_DELAY, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_INTERPACKET_DELAY=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_STATUS_LINE_SIZE, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_STATUS_LINE_SIZE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_STATUS_LINE_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_STATUS_LINE_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_VC_CTRL_0, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_VC_CTRL_0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_VC_CTRL_1, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_VC_CTRL_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_VC_CTRL_2, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_VC_CTRL_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_VC_CTRL_3, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_VC_CTRL_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_FRAME_NO_0, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_FRAME_NO_0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_FRAME_NO_1, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_FRAME_NO_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_FRAME_NO_2, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_FRAME_NO_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_FRAME_NO_3, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_FRAME_NO_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_BYTE_COUNT, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_BYTE_COUNT=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_CURRENT_DATA_IDENTIFIER, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_CURRENT_DATA_IDENTIFIER=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DFV, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DFV=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_0, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_0, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_0, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_1, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_1, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_1, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_2, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_2, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_2, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_3, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_3, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_3, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_4, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_4, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_4, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_5, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_5=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_5, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_5=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_5, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_5=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_6, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_6=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_6, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_6=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_6, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_6=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_7, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_7=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_7, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_7=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_7, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_7=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_8, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_8=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_8, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_8=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_8, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_8=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_9, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_9=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_9, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_9=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_9, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_9=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_10, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_10=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_10, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_10=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_10, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_10=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_11, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_11=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_11, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_11=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_11, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_11=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_12, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_12=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_12, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_12=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_12, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_12=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_13, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_13=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_13, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_13=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_13, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_13=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_14, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_14=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_14, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_14=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_14, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_14=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_PACKET_SIZE_15, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_PACKET_SIZE_15=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_DI_INDEX_CTRL_15, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_DI_INDEX_CTRL_15=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_CSI2_TX_LINE_NO_15, &read_data);
+	pr_info("[CAM]YUSHAN_CSI2_TX_LINE_NO_15=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_UIX4, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_UIX4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_SWAP_PINS, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_SWAP_PINS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_INVERT_HS, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_INVERT_HS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_STOP_STATE, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_STOP_STATE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_FORCE_TX_MODE_DL, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_FORCE_TX_MODE_DL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_ULP_STATE, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_ULP_STATE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_ULP_EXIT, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_ULP_EXIT=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_ESC_DL, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_ESC_DL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_HSTX_SLEW, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_HSTX_SLEW=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_SKEW, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_SKEW=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_GPIO_CL, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_GPIO_CL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_GPIO_DL1, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_GPIO_DL1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_GPIO_DL2, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_GPIO_DL2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_GPIO_DL3, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_GPIO_DL3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_GPIO_DL4, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_GPIO_DL4=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_SPECS, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_SPECS=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_SLEW_RATE, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_SLEW_RATE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_TEST_RESERVED, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_TEST_RESERVED=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_TCLK_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_TCLK_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_MIPI_TX_TCLK_POST_DELAY, &read_data);
+	pr_info("[CAM]YUSHAN_MIPI_TX_TCLK_POST_DELAY=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LINE_FILTER_BYPASS_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_LINE_FILTER_BYPASS_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LINE_FILTER_BYPASS_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_LINE_FILTER_BYPASS_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LINE_FILTER_BYPASS_LSTART_LEVEL, &read_data);
+	pr_info("[CAM]YUSHAN_LINE_FILTER_BYPASS_LSTART_LEVEL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LINE_FILTER_BYPASS_LSTOP_LEVEL, &read_data);
+	pr_info("[CAM]YUSHAN_LINE_FILTER_BYPASS_LSTOP_LEVEL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_BYPASS_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_BYPASS_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_BYPASS_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_BYPASS_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_BYPASS_MATCH0, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_BYPASS_MATCH0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_BYPASS_MATCH1, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_BYPASS_MATCH1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_BYPASS_MATCH2, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_BYPASS_MATCH2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_BYPASS_MATCH3, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_BYPASS_MATCH3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LINE_FILTER_DXO_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_LINE_FILTER_DXO_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LINE_FILTER_DXO_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_LINE_FILTER_DXO_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LINE_FILTER_DXO_LSTART_LEVEL, &read_data);
+	pr_info("[CAM]YUSHAN_LINE_FILTER_DXO_LSTART_LEVEL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LINE_FILTER_DXO_LSTOP_LEVEL, &read_data);
+	pr_info("[CAM]YUSHAN_LINE_FILTER_DXO_LSTOP_LEVEL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_DXO_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_DXO_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_DXO_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_DXO_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_DXO_MATCH0, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_DXO_MATCH0=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_DXO_MATCH1, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_DXO_MATCH1=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_DXO_MATCH2, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_DXO_MATCH2=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_DTFILTER_DXO_MATCH3, &read_data);
+	pr_info("[CAM]YUSHAN_DTFILTER_DXO_MATCH3=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_EOF_RESIZE_PRE_DXO_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_EOF_RESIZE_PRE_DXO_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_EOF_RESIZE_PRE_DXO_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_EOF_RESIZE_PRE_DXO_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_EOF_RESIZE_PRE_DXO_AUTOMATIC_CONTROL, &read_data);
+	pr_info("[CAM]YUSHAN_EOF_RESIZE_PRE_DXO_AUTOMATIC_CONTROL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_EOF_RESIZE_PRE_DXO_H_SIZE, &read_data);
+	pr_info("[CAM]YUSHAN_EOF_RESIZE_PRE_DXO_H_SIZE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LBE_PRE_DXO_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_LBE_PRE_DXO_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LBE_PRE_DXO_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_LBE_PRE_DXO_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LBE_PRE_DXO_DFV, &read_data);
+	pr_info("[CAM]YUSHAN_LBE_PRE_DXO_DFV=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LBE_PRE_DXO_H_SIZE, &read_data);
+	pr_info("[CAM]YUSHAN_LBE_PRE_DXO_H_SIZE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LBE_PRE_DXO_READ_START, &read_data);
+	pr_info("[CAM]YUSHAN_LBE_PRE_DXO_READ_START=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_EOF_RESIZE_POST_DXO_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_EOF_RESIZE_POST_DXO_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_EOF_RESIZE_POST_DXO_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_EOF_RESIZE_POST_DXO_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_EOF_RESIZE_POST_DXO_AUTOMATIC_CONTROL, &read_data);
+	pr_info("[CAM]YUSHAN_EOF_RESIZE_POST_DXO_AUTOMATIC_CONTROL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_EOF_RESIZE_POST_DXO_H_SIZE, &read_data);
+	pr_info("[CAM]YUSHAN_EOF_RESIZE_POST_DXO_H_SIZE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LECCI_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_LECCI_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LECCI_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_LECCI_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LECCI_MIN_INTERLINE, &read_data);
+	pr_info("[CAM]YUSHAN_LECCI_MIN_INTERLINE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LECCI_OUT_BURST_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_LECCI_OUT_BURST_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LECCI_LINE_SIZE, &read_data);
+	pr_info("[CAM]YUSHAN_LECCI_LINE_SIZE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LECCI_BYPASS_CTRL, &read_data);
+	pr_info("[CAM]YUSHAN_LECCI_BYPASS_CTRL=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LBE_POST_DXO_ENABLE, &read_data);
+	pr_info("[CAM]YUSHAN_LBE_POST_DXO_ENABLE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LBE_POST_DXO_VERSION, &read_data);
+	pr_info("[CAM]YUSHAN_LBE_POST_DXO_VERSION=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LBE_POST_DXO_DFV, &read_data);
+	pr_info("[CAM]YUSHAN_LBE_POST_DXO_DFV=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LBE_POST_DXO_H_SIZE, &read_data);
+	pr_info("[CAM]YUSHAN_LBE_POST_DXO_H_SIZE=%x\n", read_data);
+	rawchip_spi_read_2B2B(YUSHAN_LBE_POST_DXO_READ_START, &read_data);
+	pr_info("[CAM]YUSHAN_LBE_POST_DXO_READ_START=%x\n", read_data);
+
+}
+
+#define YUSHAN_DOP_REGISTER_CHECK(reg_addr) udwSpiData = 0; SPI_Read(reg_addr + DXO_DOP_BASE_ADDR, 1, (uint8_t *)(&udwSpiData)); CDBG("[CAM] %s: %s: 0x%02x\n", __func__, #reg_addr, udwSpiData);
+#define YUSHAN_PDP_REGISTER_CHECK(reg_addr) udwSpiData = 0; SPI_Read(reg_addr + DXO_PDP_BASE_ADDR, 1, (uint8_t *)(&udwSpiData)); CDBG("[CAM] %s: %s: 0x%02x\n", __func__, #reg_addr, udwSpiData);
+#define YUSHAN_DPP_REGISTER_CHECK(reg_addr) udwSpiData = 0; SPI_Read(reg_addr + DXO_DPP_BASE_ADDR-0x8000, 1, (uint8_t *)(&udwSpiData)); CDBG("[CAM] %s: %s: 0x%02x\n", __func__, #reg_addr, udwSpiData);
+void Yushan_dump_Dxo(void)
+{
+	int i;
+	uint32_t	udwSpiData;
+	uint32_t	udwSpiBaseIndex;
+	uint8_t target_data;
+	uint32_t udwDxoBaseAddress;
+	int print_data;
+
+	pr_info("[CAM] %s: Start\n", __func__);
+
+	CDBG("[CAM] %s: **** DXO DOP CODE/CLIB CHECK ****\n", __func__);
+	for (i = 0, print_data = 0; i < p_yushan_regs->dopcode_size; i++) {
+		YUSHAN_DOP_REGISTER_CHECK(p_yushan_regs->dopcode_first_addr+i);
+		target_data = *((uint8_t *)p_yushan_regs->dopcode+i);
+		if (udwSpiData != target_data && (print_data <= 10 || print_data % 1000 == 0)) {
+			pr_err("Unmatching DOP code addr=%x data=%x target_data=%x\n",
+				p_yushan_regs->dopcode_first_addr+i, udwSpiData, target_data);
+			print_data++;
+		}
+	}
+	for (i = 0, print_data = 0; i < p_yushan_regs->dopclib_size; i++) {
+		YUSHAN_DOP_REGISTER_CHECK(p_yushan_regs->dopclib_first_addr+i);
+		target_data = *((uint8_t *)p_yushan_regs->dopclib+i);
+		if (udwSpiData != target_data && (print_data <= 10 || print_data % 1000 == 0)) {
+			pr_err("Unmatching DOP clib addr=%x data=%x target_data=%x\n",
+				p_yushan_regs->dopclib_first_addr+i, udwSpiData, target_data);
+			print_data++;
+		}
+	}
+
+	CDBG("[CAM] %s: **** DXO DPP CODE/CLIB CHECK ****\n", __func__);
+	udwSpiBaseIndex = 0x010000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+	udwDxoBaseAddress=(0x8000 + DXO_DPP_BASE_ADDR) - udwSpiBaseIndex; 
+	for (i = 0, print_data = 0; i < p_yushan_regs->dppcode_size; i++) {
+		YUSHAN_DPP_REGISTER_CHECK(p_yushan_regs->dppcode_first_addr+udwDxoBaseAddress+i-DXO_DPP_BASE_ADDR+0x8000);
+		target_data = *((uint8_t *)p_yushan_regs->dppcode+i);
+		if (udwSpiData != target_data && (print_data <= 10 || print_data % 1000 == 0)) {
+			pr_err("Unmatching DPP code addr=%x data=%x target_data=%x\n",
+				p_yushan_regs->dppcode_first_addr+i, udwSpiData, target_data);
+			print_data++;
+		}
+	}
+	udwSpiBaseIndex = DXO_DPP_BASE_ADDR + p_yushan_regs->dppclib_first_addr; 
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+	udwDxoBaseAddress = ((DXO_DPP_BASE_ADDR + p_yushan_regs->dppclib_first_addr) - udwSpiBaseIndex) + 0x8000; 
+	for (i = 0, print_data = 0; i < p_yushan_regs->dppclib_size; i++) {
+		YUSHAN_DPP_REGISTER_CHECK(udwDxoBaseAddress+i-DXO_DPP_BASE_ADDR+0x8000);
+		target_data = *((uint8_t *)p_yushan_regs->dppclib+i);
+		if (udwSpiData != target_data && (print_data <= 10 || print_data % 1000 == 0)) {
+			pr_err("Unmatching DPP clib addr=%x data=%x target_data=%x\n",
+				p_yushan_regs->dppclib_first_addr+i, udwSpiData, target_data);
+			print_data++;
+		}
+	}
+	udwSpiBaseIndex = 0x08000;
+	SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+	CDBG("[CAM] %s: **** DXO PDP CODE/CLIB CHECK ****\n", __func__);
+	for (i = 0, print_data = 0; i < p_yushan_regs->pdpcode_size; i++) {
+		YUSHAN_PDP_REGISTER_CHECK(p_yushan_regs->pdpcode_first_addr+i);
+		target_data = *((uint8_t *)p_yushan_regs->pdpcode+i);
+		if (udwSpiData != target_data && (print_data <= 10 || print_data % 1000 == 0)) {
+			pr_err("Unmatching PDP code addr=%x data=%x target_data=%x\n",
+				p_yushan_regs->pdpcode_first_addr+i, udwSpiData, target_data);
+			print_data++;
+		}
+	}
+	for (i = 0, print_data = 0; i < p_yushan_regs->pdpclib_size; i++) {
+		YUSHAN_PDP_REGISTER_CHECK(p_yushan_regs->pdpclib_first_addr+i);
+		target_data = *((uint8_t *)p_yushan_regs->pdpclib+i);
+		if (udwSpiData != target_data && (print_data <= 10 || print_data % 1000 == 0)) {
+			pr_err("Unmatching PDP clib addr=%x data=%x target_data=%x\n",
+				p_yushan_regs->pdpclib_first_addr+i, udwSpiData, target_data);
+			print_data++;
+		}
+	}
+
+	pr_info("[CAM] %s: End\n", __func__);
+}
+
+
diff --git a/drivers/media/video/msm/rawchip/Yushan_HTC_Functions.h b/drivers/media/video/msm/rawchip/Yushan_HTC_Functions.h
new file mode 100644
index 0000000..b8edfd7
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/Yushan_HTC_Functions.h
@@ -0,0 +1,209 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _YUSHAN_HTC_FUNCTIONS_H
+#define _YUSHAN_HTC_FUNCTIONS_H
+
+#include "Yushan_API.h"
+#include "Yushan_Platform_Specific.h"
+
+enum yushan_orientation_type {
+	YUSHAN_ORIENTATION_NONE,
+	YUSHAN_ORIENTATION_MIRROR,
+	YUSHAN_ORIENTATION_FLIP,
+	YUSHAN_ORIENTATION_MIRROR_FLIP,
+};
+
+struct yushan_reg_conf {
+	uint16_t addr;
+	uint8_t  data;
+};
+
+struct yushan_reg_t {
+	uint16_t pdpcode_first_addr;
+	uint8_t *pdpcode;
+	uint16_t pdpcode_size;
+
+	uint16_t pdpclib_first_addr;
+	uint8_t *pdpclib;
+	uint16_t pdpclib_size;
+
+	uint16_t pdpBootAddr;
+	uint16_t pdpStartAddr;
+
+	uint16_t dppcode_first_addr;
+	uint8_t *dppcode;
+	uint16_t dppcode_size;
+
+	uint16_t dppclib_first_addr;
+	uint8_t *dppclib;
+	uint16_t dppclib_size;
+
+	uint16_t dppBootAddr;
+	uint16_t dppStartAddr;
+
+	uint16_t dopcode_first_addr;
+	uint8_t *dopcode;
+	uint16_t dopcode_size;
+
+	uint16_t dopclib_first_addr;
+	uint8_t *dopclib;
+	uint16_t dopclib_size;
+
+	uint16_t dopBootAddr;
+	uint16_t dopStartAddr;
+};
+
+extern struct yushan_reg_t yushan_regs;
+
+
+struct yushan_reg_u_code_t {
+	uint16_t pdpcode_first_addr;
+	uint8_t *pdpcode;
+	uint16_t pdpcode_size;
+
+	uint16_t pdpBootAddr;
+	uint16_t pdpStartAddr;
+
+	uint16_t dppcode_first_addr;
+	uint8_t *dppcode;
+	uint16_t dppcode_size;
+
+	uint16_t dppBootAddr;
+	uint16_t dppStartAddr;
+
+	uint16_t dopcode_first_addr;
+	uint8_t *dopcode;
+	uint16_t dopcode_size;
+
+	uint16_t dopBootAddr;
+	uint16_t dopStartAddr;
+};
+
+extern struct yushan_reg_u_code_t yushan_u_code_r2;
+extern struct yushan_reg_u_code_t yushan_u_code_r3;
+
+
+
+struct yushan_reg_clib_t {
+	uint16_t pdpclib_first_addr;
+	uint8_t *pdpclib;
+	uint16_t pdpclib_size;
+
+	uint16_t dppclib_first_addr;
+	uint8_t *dppclib;
+	uint16_t dppclib_size;
+
+	uint16_t dopclib_first_addr;
+	uint8_t *dopclib;
+	uint16_t dopclib_size;
+};
+
+extern struct yushan_reg_clib_t yushan_regs_clib_s5k3h2yx;
+extern struct yushan_reg_clib_t yushan_regs_clib_imx175;
+extern struct yushan_reg_clib_t yushan_regs_clib_ov8838;
+extern struct yushan_reg_clib_t yushan_regs_clib_ar0260;
+extern struct yushan_reg_clib_t yushan_regs_clib_ov2722;
+
+
+struct rawchip_sensor_init_data {
+	const char *sensor_name;
+	uint8_t spi_clk;
+	uint8_t ext_clk;
+	uint8_t lane_cnt;
+	uint8_t orientation;
+	uint8_t use_ext_1v2;
+	uint16_t bitrate;
+	uint16_t width;
+	uint16_t height;
+	uint16_t blk_pixels;
+	uint16_t blk_lines;
+	uint16_t x_addr_start;
+	uint16_t y_addr_start;
+	uint16_t x_addr_end;
+	uint16_t y_addr_end;
+	uint16_t x_even_inc;
+	uint16_t x_odd_inc;
+	uint16_t y_even_inc;
+	uint16_t y_odd_inc;
+	uint8_t binning_rawchip;
+	uint8_t use_rawchip;
+};
+
+typedef enum {
+  RAWCHIP_NEWFRAME_ACK_NOCHANGE,
+  RAWCHIP_NEWFRAME_ACK_ENABLE,
+  RAWCHIP_NEWFRAME_ACK_DISABLE,
+} rawchip_newframe_ack_enable_t;
+
+typedef struct {
+  uint16_t gain;
+  uint16_t dig_gain;
+  uint16_t exp;
+} rawchip_aec_params_t;
+
+typedef struct {
+  uint8_t rg_ratio; 
+  uint8_t bg_ratio; 
+} rawchip_awb_params_t;
+
+typedef struct {
+  int update;
+  rawchip_aec_params_t aec_params;
+  rawchip_awb_params_t awb_params;
+} rawchip_update_aec_awb_params_t;
+
+typedef struct {
+  uint8_t active_number;
+  Yushan_AF_ROI_t sYushanAfRoi[5];
+} rawchip_af_params_t;
+
+typedef struct {
+  int update;
+  rawchip_af_params_t af_params;
+} rawchip_update_af_params_t;
+
+typedef struct {
+  uint8_t value;
+}Yushan_DXO_DOP_afStrategy_t;
+
+typedef struct
+{
+	Yushan_AF_Stats_t udwAfStats[5];
+	uint16_t  frameIdx;
+} rawchip_af_stats;
+
+void YushanPrintDxODOPAfStrategy(void);
+void YushanPrintFrameNumber(void);
+void YushanPrintVisibleLineSizeAndRoi(void);
+void YushanPrintImageInformation(void);
+
+void Reset_Yushan(void);
+void ASIC_Test(void);
+
+
+int Yushan_sensor_open_init(struct rawchip_sensor_init_data data);
+void Yushan_dump_register(void);
+void Yushan_dump_all_register(void);
+void Yushan_dump_Dxo(void);
+
+int Yushan_ContextUpdate_Wrapper(Yushan_New_Context_Config_t	sYushanNewContextConfig, Yushan_ImageChar_t	sImageNewChar_context);
+int Yushan_Get_Version(rawchip_dxo_version* dxo_version);
+int Yushan_Set_AF_Strategy(uint8_t afStrategy);
+bool_t Yushan_Dxo_Dop_Af_Run(Yushan_AF_ROI_t	*sYushanAfRoi, uint32_t *pAfStatsGreen, uint8_t	bRoiActiveNumber);
+int Yushan_get_AFSU(rawchip_af_stats* af_stats);
+
+int Yushan_Update_AEC_AWB_Params(rawchip_update_aec_awb_params_t *update_aec_awb_params);
+int Yushan_Update_AF_Params(rawchip_update_af_params_t *update_af_params);
+int Yushan_Update_3A_Params(rawchip_newframe_ack_enable_t enable_newframe_ack);
+
+#endif
diff --git a/drivers/media/video/msm/rawchip/Yushan_Platform_Specific.c b/drivers/media/video/msm/rawchip/Yushan_Platform_Specific.c
new file mode 100644
index 0000000..dfeb6cc
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/Yushan_Platform_Specific.c
@@ -0,0 +1,905 @@
+#include "yushan_registermap.h"
+#include "DxODOP_regMap.h"
+#include "DxODPP_regMap.h"
+#include "DxOPDP_regMap.h"
+#include "Yushan_API.h"
+#include "Yushan_Platform_Specific.h"
+
+#include <mach/board.h>
+#include <linux/platform_device.h>
+
+#include <mach/gpio.h>
+
+#ifdef YUSHAN_PLATFORM_SPECIFIC_DEBUG
+#define CDBG(fmt, args...) pr_debug(fmt, ##args)
+#else
+#define CDBG(fmt, args...) do { } while (0)
+#endif
+
+struct yushan_int_t {
+	spinlock_t yushan_spin_lock;
+	wait_queue_head_t yushan_wait;
+};
+
+uint32_t	udwProtoInterruptList_Pad0[3];
+uint32_t	udwProtoInterruptList_Pad1[3];
+
+extern int rawchip_intr0, rawchip_intr1;
+extern atomic_t interrupt, interrupt2;
+extern struct yushan_int_t yushan_int;
+
+bool_t Yushan_WaitForInterruptEvent (uint8_t bInterruptId ,uint32_t udwTimeOut)
+{
+
+	int					 counterLimit;
+	
+	bool_t				fStatus = 0; 
+	int rc = 0;
+	int i;
+
+	switch ( udwTimeOut )
+	{
+		case TIME_5MS :
+			counterLimit=100 ;
+			break;
+		case TIME_10MS :
+			counterLimit=200 ;
+			break;
+		case TIME_20MS :
+			counterLimit=400 ;
+			break;
+		case TIME_50MS :
+			counterLimit=1000 ;
+			break;
+		case TIME_100MS :
+			counterLimit=2000 ;
+			break;
+		default :
+			counterLimit=50 ;
+			break;
+	}
+
+	fStatus = Yushan_CheckForInterruptIDInList(bInterruptId, udwProtoInterruptList_Pad0);		
+	CDBG("[CAM] %s Yushan_CheckForInterruptIDInList:%d \n",__func__, fStatus);
+	if ((fStatus)) {
+		
+		Yushan_AddnRemoveIDInList(bInterruptId, udwProtoInterruptList_Pad0, DEL_INTR_FROM_LIST); 
+		
+		CDBG("[CAM] %s Del Yushan_CheckForInterruptIDInList:%d \n",__func__, fStatus);
+		return SUCCESS;
+	}
+
+	for (i = 0; i < 10; i++) {
+	CDBG("[CAM] %s begin interrupt wait\n",__func__);
+	
+	
+	rc = wait_event_timeout(yushan_int.yushan_wait,
+	atomic_read(&interrupt),
+		counterLimit/200);
+	CDBG("[CAM] %s end interrupt: %d; interrupt id:%d wait rc=%d\n",__func__, atomic_read(&interrupt), bInterruptId, rc);
+	if(atomic_read(&interrupt))
+	{
+		
+		atomic_set(&interrupt, 0);
+		Yushan_Interrupt_Manager_Pad0();
+		fStatus = Yushan_CheckForInterruptIDInList(bInterruptId, udwProtoInterruptList_Pad0);		
+		CDBG("[CAM] %s Yushan_CheckForInterruptIDInList:%d \n",__func__, fStatus);
+		if (fStatus) {
+		
+		Yushan_AddnRemoveIDInList(bInterruptId, udwProtoInterruptList_Pad0, DEL_INTR_FROM_LIST); 
+		
+		CDBG("[CAM] %s Del Yushan_CheckForInterruptIDInList:%d \n",__func__, fStatus);
+		return SUCCESS;
+		}
+	}
+	mdelay(1);
+	pr_info("retry getting interrupt\n");
+	}
+	return FAILURE;
+}
+
+bool_t Yushan_WaitForInterruptEvent2 (uint8_t bInterruptId ,uint32_t udwTimeOut)
+{
+
+	int					 counterLimit;
+	
+	bool_t				fStatus = 0; 
+	int rc = 0;
+	int i;
+
+	switch ( udwTimeOut )
+	{
+		case TIME_5MS :
+			counterLimit=100 ;
+			break;
+		case TIME_10MS :
+			counterLimit=200 ;
+			break;
+		case TIME_20MS :
+			counterLimit=400 ;
+			break;
+		case TIME_50MS :
+			counterLimit=1000 ;
+			break;
+		case TIME_100MS :
+			counterLimit=2000 ;
+			break;
+		default :
+			counterLimit=50 ;
+			break;
+	}
+
+	fStatus = Yushan_CheckForInterruptIDInList(bInterruptId, udwProtoInterruptList_Pad1);		
+	CDBG("[CAM] %s Yushan_CheckForInterruptIDInList:%d \n",__func__, fStatus);
+	if ((fStatus)) {
+		
+		Yushan_AddnRemoveIDInList(bInterruptId, udwProtoInterruptList_Pad1, DEL_INTR_FROM_LIST); 
+		
+		CDBG("[CAM] %s Del Yushan_CheckForInterruptIDInList:%d \n",__func__, fStatus);
+		return SUCCESS;
+	}
+
+	for (i = 0; i < 10; i++) {
+	CDBG("[CAM] %s begin interrupt wait\n",__func__);
+	
+	
+	rc = wait_event_timeout(yushan_int.yushan_wait,
+	atomic_read(&interrupt2),
+		counterLimit/200);
+	CDBG("[CAM] %s end interrupt: %d; interrupt id:%d wait  rc=%d\n",__func__, atomic_read(&interrupt2), bInterruptId, rc);
+	if(atomic_read(&interrupt2))
+	{
+		
+		atomic_set(&interrupt2, 0);
+		Yushan_Interrupt_Manager_Pad1();
+		fStatus = Yushan_CheckForInterruptIDInList(bInterruptId, udwProtoInterruptList_Pad1);		
+		CDBG("[CAM] %s Yushan_CheckForInterruptIDInList:%d \n",__func__, fStatus);
+		if (fStatus) {
+		
+		Yushan_AddnRemoveIDInList(bInterruptId, udwProtoInterruptList_Pad1, DEL_INTR_FROM_LIST); 
+		
+		CDBG("[CAM] %s Del Yushan_CheckForInterruptIDInList:%d \n",__func__, fStatus);
+		return SUCCESS;
+		}
+	}
+	mdelay(1);
+	pr_info("retry getting interrupt\n");
+	}
+	return FAILURE;
+}
+
+
+
+uint8_t Yushan_parse_interrupt(int intr_pad, int error_times[TOTAL_INTERRUPT_COUNT])
+{
+
+	uint8_t		bCurrentInterruptID = 0;
+	uint8_t		bAssertOrDeassert = 0, bInterruptWord = 0;
+	uint32_t	*udwListOfInterrupts;
+	uint8_t	bSpiData;
+	uint32_t udwSpiBaseIndex;
+	uint8_t interrupt_type = 0;
+
+	udwListOfInterrupts	= kmalloc(96, GFP_KERNEL);
+
+	
+	
+	Yushan_Intr_Status_Read((uint8_t *)udwListOfInterrupts, intr_pad);
+
+	
+	Yushan_Intr_Status_Clear((uint8_t *) udwListOfInterrupts);
+
+	
+	while (bCurrentInterruptID < (TOTAL_INTERRUPT_COUNT)) {
+		bAssertOrDeassert = ((udwListOfInterrupts[bInterruptWord])>>(bCurrentInterruptID%32))&0x01;
+
+		if (bAssertOrDeassert) {
+			CDBG("[CAM] %s:bCurrentInterruptID:%d\n", __func__, bCurrentInterruptID+1);
+			switch (bCurrentInterruptID+1) {
+			case EVENT_PDP_EOF_EXECCMD :
+				CDBG("[CAM] %s:[AF_INT]EVENT_PDP_EOF_EXECCMD\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_PDP_EOF_EXECCMD;
+				break;
+
+			case EVENT_DPP_EOF_EXECCMD :
+				CDBG("[CAM] %s:[AF_INT]EVENT_DPP_EOF_EXECCMD\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_DPP_EOF_EXECCMD;
+				break;
+
+			case EVENT_DOP7_EOF_EXECCMD :
+				CDBG("[CAM] %s:[AF_INT]EVENT_DOP7_EOF_EXECCMD\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_DOP_EOF_EXECCMD;
+				break;
+
+			case EVENT_DXODOP7_NEWFRAMEPROC_ACK :
+				CDBG("[CAM] %s:[AF_INT]EVENT_DXODOP7_NEWFRAMEPROC_ACK\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_NEW_FRAME;
+				break;
+
+			case EVENT_CSI2RX_ECC_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_CSI2RX_ECC_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_CSI2RX_CHKSUM_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_CSI2RX_CHKSUM_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_CSI2RX_SYNCPULSE_MISSED :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_CSI2RX_SYNCPULSE_MISSED\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_DXOPDP_NEWFRAME_ERR :
+				SPI_Read(DXO_PDP_BASE_ADDR+DxOPDP_error_code_7_0, 1, &bSpiData);
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_DXOPDP_NEWFRAME_ERR, error code =%d\n", __func__, bSpiData);
+				
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_DXODPP_NEWFRAME_ERR :
+				udwSpiBaseIndex = 0x010000;
+				SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+				SPI_Read(DXO_DPP_BASE_ADDR+DxODPP_error_code_7_0-0x8000, 1, &bSpiData);
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_DXODPP_NEWFRAME_ERR, error code =%d\n", __func__, bSpiData);
+
+				udwSpiBaseIndex = 0x08000;
+				SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+				
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_DXODOP7_NEWFRAME_ERR :
+				SPI_Read(DXO_DOP_BASE_ADDR+DxODOP_error_code_7_0, 1, &bSpiData);
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_DXODOP7_NEWFRAME_ERR, error code =%d\n", __func__, bSpiData);
+				
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_CSI2TX_SP_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_CSI2TX_SP_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_CSI2TX_LP_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_CSI2TX_LP_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_CSI2TX_DATAINDEX_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_CSI2TX_DATAINDEX_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_SOT_SOFT_DL1 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_SOFT_DL1\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_SOT_HARD_DL1 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_HARD_DL1\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_EOT_DL1 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_EOT_DL1\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_ESC_DL1 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_ESC_DL1\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_CTRL_DL1 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_CTRL_DL1\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_SOT_SOFT_DL2 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_SOFT_DL2\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_SOT_HARD_DL2 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_HARD_DL2\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_EOT_DL2 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_EOT_DL2\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_ESC_DL2 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_ESC_DL2\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_CTRL_DL2 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_CTRL_DL2\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_SOT_SOFT_DL3 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_SOFT_DL3\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_SOT_HARD_DL3 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_HARD_DL3\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_EOT_DL3 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_EOT_DL3\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_ESC_DL3 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_ESC_DL3\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_CTRL_DL3:
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_CTRL_DL3\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_SOT_SOFT_DL4 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_SOFT_DL4\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_SOT_HARD_DL4 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_HARD_DL4\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_EOT_DL4:
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_EOT_DL4\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_ESC_DL4:
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_ESC_DL4\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_PHY_ERR_CTRL_DL4 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_CTRL_DL4\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_TXPHY_CTRL_ERR_D1 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_TXPHY_CTRL_ERR_D1\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_TXPHY_CTRL_ERR_D2 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_TXPHY_CTRL_ERR_D2\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_TXPHY_CTRL_ERR_D3 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_TXPHY_CTRL_ERR_D3\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_TXPHY_CTRL_ERR_D4 :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_TXPHY_CTRL_ERR_D4\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_UNMATCHED_IMAGE_SIZE_ERROR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_UNMATCHED_IMAGE_SIZE_ERROR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case PRE_DXO_WRAPPER_PROTOCOL_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]PRE_DXO_WRAPPER_PROTOCOL_ERR\n", __func__);
+				
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case PRE_DXO_WRAPPER_FIFO_OVERFLOW :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]PRE_DXO_WRAPPER_FIFO_OVERFLOW\n", __func__);
+				
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_BAD_FRAME_DETECTION :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_BAD_FRAME_DETECTION\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_TX_DATA_FIFO_OVERFLOW :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_TX_DATA_FIFO_OVERFLOW\n", __func__);
+				
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_TX_INDEX_FIFO_OVERFLOW :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_TX_INDEX_FIFO_OVERFLOW\n", __func__);
+				
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_CHAR_COLOR_BAR_0_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_0_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_CHAR_COLOR_BAR_1_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_1_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_CHAR_COLOR_BAR_2_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_2_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_CHAR_COLOR_BAR_3_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_3_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_CHAR_COLOR_BAR_4_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_4_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_CHAR_COLOR_BAR_5_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_5_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_CHAR_COLOR_BAR_6_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_6_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_RX_CHAR_COLOR_BAR_7_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_7_ERR\n", __func__);
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_POST_DXO_WRAPPER_PROTOCOL_ERR :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_POST_DXO_WRAPPER_PROTOCOL_ERR\n", __func__);
+				
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_POST_DXO_WRAPPER_FIFO_OVERFLOW :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_POST_DXO_WRAPPER_FIFO_OVERFLOW\n", __func__);
+				
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_TX_DATA_UNDERFLOW :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_TX_DATA_UNDERFLOW\n", __func__);
+				
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			case EVENT_TX_INDEX_UNDERFLOW :
+				error_times[bCurrentInterruptID]++;
+				if (error_times[bCurrentInterruptID] <= 10 || error_times[bCurrentInterruptID] % 1000 == 0)
+				pr_err("[CAM] %s:[ERR]EVENT_TX_INDEX_UNDERFLOW\n", __func__);
+				
+				interrupt_type |= RAWCHIP_INT_TYPE_ERROR;
+				break;
+
+			}
+		}
+		bCurrentInterruptID++;
+
+		if (bCurrentInterruptID%32 == 0)
+			bInterruptWord++;
+	}
+
+	kfree(udwListOfInterrupts);
+
+	if (intr_pad == INTERRUPT_PAD_0)
+		enable_irq(rawchip_intr0);
+	else if (intr_pad == INTERRUPT_PAD_1)
+		enable_irq(rawchip_intr1);
+
+	return interrupt_type;
+}
+
+void Yushan_Interrupt_Manager_Pad0(void)
+{
+
+	uint8_t		bCurrentInterruptID = 0;
+	uint8_t		bAssertOrDeassert=0, bInterruptWord = 0;
+	uint32_t	*udwListOfInterrupts;
+	uint8_t	bSpiData;
+	uint32_t udwSpiBaseIndex;
+
+	udwListOfInterrupts	= (uint32_t *) kmalloc(96/8, GFP_KERNEL);
+
+	
+	
+	Yushan_Intr_Status_Read ((uint8_t *)udwListOfInterrupts, INTERRUPT_PAD_0);
+
+	
+	Yushan_Intr_Status_Clear((uint8_t *) udwListOfInterrupts);
+
+	
+	while (bCurrentInterruptID < (TOTAL_INTERRUPT_COUNT)) {
+		bAssertOrDeassert = ((udwListOfInterrupts[bInterruptWord])>>(bCurrentInterruptID%32))&0x01;
+
+		if (bAssertOrDeassert) {
+			Yushan_AddnRemoveIDInList((uint8_t)(bCurrentInterruptID+1), udwProtoInterruptList_Pad0, ADD_INTR_TO_LIST);
+
+			CDBG("[CAM] %s:bCurrentInterruptID:%d\n",__func__, bCurrentInterruptID+1);
+			switch (bCurrentInterruptID + 1) {
+				case EVENT_PDP_EOF_EXECCMD :
+					CDBG("[CAM] %s:[AF_INT]EVENT_PDP_EOF_EXECCMD\n", __func__);
+					break;
+
+				case EVENT_DPP_EOF_EXECCMD :
+					CDBG("[CAM] %s:[AF_INT]EVENT_DPP_EOF_EXECCMD\n", __func__);
+					break;
+
+				case EVENT_DOP7_EOF_EXECCMD :
+					CDBG("[CAM] %s:[AF_INT]EVENT_DOP7_EOF_EXECCMD\n", __func__);
+					break;
+
+				case EVENT_DXODOP7_NEWFRAMEPROC_ACK :
+					CDBG("[CAM] %s:[AF_INT]EVENT_DXODOP7_NEWFRAMEPROC_ACK\n", __func__);
+					break;
+				case EVENT_CSI2RX_ECC_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_CSI2RX_ECC_ERR\n",__func__);
+					break;
+				case EVENT_CSI2RX_CHKSUM_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_CSI2RX_CHKSUM_ERR\n",__func__);
+					break;
+				case EVENT_CSI2RX_SYNCPULSE_MISSED :
+					pr_err("[CAM] %s:[ERR]EVENT_CSI2RX_SYNCPULSE_MISSED\n",__func__);
+					break;
+				case EVENT_DXOPDP_NEWFRAME_ERR :
+				{
+					SPI_Read(DXO_PDP_BASE_ADDR+DxOPDP_error_code_7_0,1,&bSpiData);
+					pr_err("[CAM] %s:[ERR]EVENT_DXOPDP_NEWFRAME_ERR, error code =%d\n",__func__, bSpiData);
+					
+					break;
+				}
+				case EVENT_DXODPP_NEWFRAME_ERR :
+				{
+					udwSpiBaseIndex = 0x010000;
+					SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+
+					SPI_Read(DXO_DPP_BASE_ADDR+DxODPP_error_code_7_0-0x8000,1,&bSpiData);
+					pr_err("[CAM] %s:[ERR]EVENT_DXODPP_NEWFRAME_ERR, error code =%d\n",__func__, bSpiData);
+
+					udwSpiBaseIndex = 0x08000;
+					SPI_Write(YUSHAN_HOST_IF_SPI_BASE_ADDRESS, 4, (uint8_t *)(&udwSpiBaseIndex));
+					
+					break;
+				}
+				case EVENT_DXODOP7_NEWFRAME_ERR :
+				{
+					SPI_Read(DXO_DOP_BASE_ADDR+DxODOP_error_code_7_0,1,&bSpiData);
+					pr_err("[CAM] %s:[ERR]EVENT_DXODOP7_NEWFRAME_ERR, error code =%d\n",__func__, bSpiData);
+					
+					break;
+				}
+				case EVENT_CSI2TX_SP_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_CSI2TX_SP_ERR\n",__func__);
+					break;
+				case EVENT_CSI2TX_LP_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_CSI2TX_LP_ERR\n",__func__);
+					break;
+				case EVENT_CSI2TX_DATAINDEX_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_CSI2TX_DATAINDEX_ERR\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_SOT_SOFT_DL1 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_SOFT_DL1\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_SOT_HARD_DL1 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_HARD_DL1\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_EOT_DL1 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_EOT_DL1\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_ESC_DL1 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_ESC_DL1\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_CTRL_DL1 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_CTRL_DL1\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_SOT_SOFT_DL2 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_SOFT_DL2\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_SOT_HARD_DL2 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_HARD_DL2\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_EOT_DL2 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_EOT_DL2\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_ESC_DL2 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_ESC_DL2\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_CTRL_DL2 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_CTRL_DL2\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_SOT_SOFT_DL3 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_SOFT_DL3\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_SOT_HARD_DL3 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_HARD_DL3\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_EOT_DL3 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_EOT_DL3\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_ESC_DL3 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_ESC_DL3\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_CTRL_DL3:
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_CTRL_DL3\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_SOT_SOFT_DL4 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_SOFT_DL4\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_SOT_HARD_DL4 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_SOT_HARD_DL4\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_EOT_DL4:
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_EOT_DL4\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_ESC_DL4:
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_ESC_DL4\n",__func__);
+					break;
+				case EVENT_RX_PHY_ERR_CTRL_DL4 :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_PHY_ERR_CTRL_DL4\n",__func__);
+					break;
+				case EVENT_TXPHY_CTRL_ERR_D1 :
+					pr_err("[CAM] %s:[ERR]EVENT_TXPHY_CTRL_ERR_D1\n",__func__);
+					break;
+				case EVENT_TXPHY_CTRL_ERR_D2 :
+					pr_err("[CAM] %s:[ERR]EVENT_TXPHY_CTRL_ERR_D2\n",__func__);
+					break;
+				case EVENT_TXPHY_CTRL_ERR_D3 :
+					pr_err("[CAM] %s:[ERR]EVENT_TXPHY_CTRL_ERR_D3\n",__func__);
+					break;
+				case EVENT_TXPHY_CTRL_ERR_D4 :
+					pr_err("[CAM] %s:[ERR]EVENT_TXPHY_CTRL_ERR_D4\n",__func__);
+					break;
+				case EVENT_UNMATCHED_IMAGE_SIZE_ERROR :
+					pr_err("[CAM] %s:[ERR]EVENT_UNMATCHED_IMAGE_SIZE_ERROR\n",__func__);
+					break;
+				case PRE_DXO_WRAPPER_PROTOCOL_ERR :
+					pr_err("[CAM] %s:[ERR]PRE_DXO_WRAPPER_PROTOCOL_ERR\n",__func__);
+					
+					break;
+				case PRE_DXO_WRAPPER_FIFO_OVERFLOW :
+					pr_err("[CAM] %s:[ERR]PRE_DXO_WRAPPER_FIFO_OVERFLOW\n",__func__);
+					
+					break;
+				case EVENT_BAD_FRAME_DETECTION :
+					pr_err("[CAM] %s:[ERR]EVENT_BAD_FRAME_DETECTION\n",__func__);
+					break;
+				case EVENT_TX_DATA_FIFO_OVERFLOW :
+					pr_err("[CAM] %s:[ERR]EVENT_TX_DATA_FIFO_OVERFLOW\n",__func__);
+					
+					break;
+				case EVENT_TX_INDEX_FIFO_OVERFLOW :
+					pr_err("[CAM] %s:[ERR]EVENT_TX_INDEX_FIFO_OVERFLOW\n",__func__);
+					
+					break;
+				case EVENT_RX_CHAR_COLOR_BAR_0_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_0_ERR\n",__func__);
+					break;
+				case EVENT_RX_CHAR_COLOR_BAR_1_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_1_ERR\n",__func__);
+					break;
+				case EVENT_RX_CHAR_COLOR_BAR_2_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_2_ERR\n",__func__);
+					break;
+				case EVENT_RX_CHAR_COLOR_BAR_3_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_3_ERR\n",__func__);
+					break;
+				case EVENT_RX_CHAR_COLOR_BAR_4_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_4_ERR\n",__func__);
+					break;
+				case EVENT_RX_CHAR_COLOR_BAR_5_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_5_ERR\n",__func__);
+					break;
+				case EVENT_RX_CHAR_COLOR_BAR_6_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_6_ERR\n",__func__);
+					break;
+				case EVENT_RX_CHAR_COLOR_BAR_7_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_RX_CHAR_COLOR_BAR_7_ERR\n",__func__);
+					break;
+				case EVENT_POST_DXO_WRAPPER_PROTOCOL_ERR :
+					pr_err("[CAM] %s:[ERR]EVENT_POST_DXO_WRAPPER_PROTOCOL_ERR\n",__func__);
+					
+					break;
+				case EVENT_POST_DXO_WRAPPER_FIFO_OVERFLOW :
+					pr_err("[CAM] %s:[ERR]EVENT_POST_DXO_WRAPPER_FIFO_OVERFLOW\n",__func__);
+					
+					break;
+				case EVENT_TX_DATA_UNDERFLOW :
+					pr_err("[CAM] %s:[ERR]EVENT_TX_DATA_UNDERFLOW\n",__func__);
+					
+					break;
+				case EVENT_TX_INDEX_UNDERFLOW :
+					pr_err("[CAM] %s:[ERR]EVENT_TX_INDEX_UNDERFLOW\n",__func__);
+					
+					break;
+			}
+		}
+		bCurrentInterruptID++;
+
+		if(bCurrentInterruptID%32==0)
+			bInterruptWord++;
+	}
+
+	kfree(udwListOfInterrupts);
+
+	enable_irq(rawchip_intr0);
+
+}
+
+
+void Yushan_Interrupt_Manager_Pad1(void)
+{
+
+	uint8_t		bCurrentInterruptID = 0;
+	uint8_t		bAssertOrDeassert=0, bInterruptWord = 0;
+	uint32_t	*udwListOfInterrupts;
+	uint8_t	bSpiData;
+
+	udwListOfInterrupts	= (uint32_t *) kmalloc(96/8, GFP_KERNEL);
+
+	
+	
+	Yushan_Intr_Status_Read ((uint8_t *)udwListOfInterrupts, INTERRUPT_PAD_1);
+
+
+	
+	Yushan_Intr_Status_Clear((uint8_t *) udwListOfInterrupts);
+#if 1
+
+	
+	while (bCurrentInterruptID < (TOTAL_INTERRUPT_COUNT)) {
+		bAssertOrDeassert = ((udwListOfInterrupts[bInterruptWord])>>(bCurrentInterruptID%32))&0x01;
+
+		if(bAssertOrDeassert)
+		{
+			Yushan_AddnRemoveIDInList((uint8_t)(bCurrentInterruptID+1), udwProtoInterruptList_Pad1, ADD_INTR_TO_LIST);
+#if 1
+			CDBG("[CAM] %s:bCurrentInterruptID:%d\n", __func__, bCurrentInterruptID+1);
+			switch(bCurrentInterruptID+1)
+			{
+				case EVENT_DXODOP7_NEWFRAMEPROC_ACK :
+					pr_info("[CAM] %s:[AF_INT]EVENT_DXODOP7_NEWFRAMEPROC_ACK\n", __func__);
+					break;
+				case EVENT_DXODOP7_NEWFRAME_ERR :
+					{
+						SPI_Read(DXO_DOP_BASE_ADDR+DxODOP_error_code_7_0,1,&bSpiData);
+						pr_err("[CAM] %s:[ERR]EVENT_DXODOP7_NEWFRAME_ERR, error code =%d\n",__func__, bSpiData);
+						
+						break;
+					}
+			}
+#endif
+		}
+		bCurrentInterruptID++;
+
+		if(bCurrentInterruptID%32==0)
+			bInterruptWord++;
+	}
+#endif
+
+	kfree(udwListOfInterrupts);
+
+	
+	enable_irq((rawchip_intr1));
+
+}
diff --git a/drivers/media/video/msm/rawchip/Yushan_Platform_Specific.h b/drivers/media/video/msm/rawchip/Yushan_Platform_Specific.h
new file mode 100644
index 0000000..f135d6a
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/Yushan_Platform_Specific.h
@@ -0,0 +1,30 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#define ST_SPECIFIC							1
+#ifndef _YUSHAN_PLATFORM_SPECIFIC_H
+#define _YUSHAN_PLATFORM_SPECIFIC_H
+
+
+#define RAWCHIP_INT_TYPE_ERROR (0x01<<0)
+#define RAWCHIP_INT_TYPE_NEW_FRAME (0x01<<1)
+#define RAWCHIP_INT_TYPE_PDP_EOF_EXECCMD (0x01<<2)
+#define RAWCHIP_INT_TYPE_DPP_EOF_EXECCMD (0x01<<3)
+#define RAWCHIP_INT_TYPE_DOP_EOF_EXECCMD (0x01<<4)
+
+bool_t Yushan_WaitForInterruptEvent (uint8_t bInterruptId ,uint32_t udwTimeOut);
+bool_t Yushan_WaitForInterruptEvent2 (uint8_t bInterruptId ,uint32_t udwTimeOut);
+uint8_t Yushan_parse_interrupt(int intr_pad, int error_times[TOTAL_INTERRUPT_COUNT]);
+void Yushan_Interrupt_Manager_Pad0(void);
+void Yushan_Interrupt_Manager_Pad1(void);
+
+#endif
diff --git a/drivers/media/video/msm/rawchip/rawchip.c b/drivers/media/video/msm/rawchip/rawchip.c
new file mode 100644
index 0000000..ec59cc5
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/rawchip.c
@@ -0,0 +1,1005 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include "rawchip.h"
+
+#define MSM_RAWCHIP_NAME "rawchip"
+
+static struct rawchip_id_info_t yushan_id_info = {
+	.rawchip_id_reg_addr = 0x5c04,
+	.rawchip_id = 0x02030200,
+};
+
+static struct rawchip_info_t rawchip_info = {
+	.rawchip_id_info = &yushan_id_info,
+};
+
+static struct rawchip_ctrl *rawchipCtrl = NULL;
+
+static struct class *rawchip_class;
+static dev_t rawchip_devno;
+extern Yushan_ImageChar_t	sImageChar_context;
+
+int rawchip_intr0, rawchip_intr1;
+atomic_t interrupt, interrupt2;
+struct yushan_int_t yushan_int;
+struct yushan_int_t {
+	spinlock_t yushan_spin_lock;
+	wait_queue_head_t yushan_wait;
+};
+
+static irqreturn_t yushan_irq_handler(int irq, void *dev_id){
+
+	unsigned long flags;
+
+	disable_irq_nosync(rawchipCtrl->pdata->rawchip_intr0);
+
+	
+	spin_lock_irqsave(&yushan_int.yushan_spin_lock,flags);
+	
+	
+	
+	
+	atomic_set(&interrupt, 1);
+	CDBG("[CAM] %s after detect INT0, interrupt:%d \n",__func__, atomic_read(&interrupt));
+	
+	
+	
+	
+	wake_up(&yushan_int.yushan_wait);
+	spin_unlock_irqrestore(&yushan_int.yushan_spin_lock,flags);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t yushan_irq_handler2(int irq, void *dev_id){
+
+	unsigned long flags;
+
+	disable_irq_nosync(rawchipCtrl->pdata->rawchip_intr1);
+
+	spin_lock_irqsave(&yushan_int.yushan_spin_lock,flags);
+	atomic_set(&interrupt2, 1);
+	CDBG("[CAM] %s after detect INT1, interrupt:%d \n", __func__, atomic_read(&interrupt2));
+	wake_up(&yushan_int.yushan_wait);
+	spin_unlock_irqrestore(&yushan_int.yushan_spin_lock,flags);
+
+	return IRQ_HANDLED;
+}
+
+int rawchip_set_size(struct rawchip_sensor_data data)
+{
+	int rc = -1;
+	struct msm_camera_rawchip_info *pdata = rawchipCtrl->pdata;
+	struct rawchip_sensor_init_data rawchip_init_data;
+	Yushan_New_Context_Config_t sYushanNewContextConfig;
+	Yushan_ImageChar_t	sImageChar_context;
+	int bit_cnt = 1;
+	static uint32_t pre_pixel_clk = 0;
+	uint8_t orientation;
+	CDBG("%s", __func__);
+
+	if (data.mirror_flip == CAMERA_SENSOR_MIRROR_FLIP)
+		orientation = YUSHAN_ORIENTATION_MIRROR_FLIP;
+	else if (data.mirror_flip == CAMERA_SENSOR_MIRROR)
+		orientation = YUSHAN_ORIENTATION_MIRROR;
+	else if (data.mirror_flip == CAMERA_SENSOR_FLIP)
+		orientation = YUSHAN_ORIENTATION_FLIP;
+	else
+		orientation = YUSHAN_ORIENTATION_NONE;
+
+	if (rawchipCtrl->rawchip_init == 0 || pre_pixel_clk != data.pixel_clk) {
+		pre_pixel_clk = data.pixel_clk;
+		switch (data.datatype) {
+		case CSI_RAW8:
+			bit_cnt = 8;
+			break;
+		case CSI_RAW10:
+			bit_cnt = 10;
+			break;
+		case CSI_RAW12:
+			bit_cnt = 12;
+			break;
+		}
+		rawchip_init_data.sensor_name = data.sensor_name;
+		rawchip_init_data.spi_clk = pdata->rawchip_spi_freq;
+		rawchip_init_data.ext_clk = pdata->rawchip_mclk_freq;
+		rawchip_init_data.lane_cnt = data.lane_cnt;
+		rawchip_init_data.orientation = orientation;
+		rawchip_init_data.use_ext_1v2 = pdata->rawchip_use_ext_1v2();
+		rawchip_init_data.bitrate = (data.pixel_clk * bit_cnt / data.lane_cnt) / 1000000;
+		rawchip_init_data.width = data.width;
+		rawchip_init_data.height = data.height;
+		rawchip_init_data.blk_pixels = data.line_length_pclk - data.width;
+		rawchip_init_data.blk_lines = data.frame_length_lines - data.height;
+		rawchip_init_data.x_addr_start = data.x_addr_start;
+		rawchip_init_data.y_addr_start = data.y_addr_start;
+		rawchip_init_data.x_addr_end = data.x_addr_end;
+		rawchip_init_data.y_addr_end = data.y_addr_end;
+		rawchip_init_data.x_even_inc = data.x_even_inc;
+		rawchip_init_data.x_odd_inc = data.x_odd_inc;
+		rawchip_init_data.y_even_inc = data.y_even_inc;
+		rawchip_init_data.y_odd_inc = data.y_odd_inc;
+		rawchip_init_data.binning_rawchip = data.binning_rawchip;
+
+		pr_info("rawchip init spi_clk=%d ext_clk=%d lane_cnt=%d bitrate=%d %d %d %d %d\n",
+			rawchip_init_data.spi_clk, rawchip_init_data.ext_clk,
+			rawchip_init_data.lane_cnt, rawchip_init_data.bitrate,
+			rawchip_init_data.width, rawchip_init_data.height,
+			rawchip_init_data.blk_pixels, rawchip_init_data.blk_lines);
+		if (rawchipCtrl->rawchip_init) {
+			rc = gpio_request(pdata->rawchip_reset, "rawchip");
+			if (rc < 0) {
+				pr_err("GPIO(%d) request failed\n", pdata->rawchip_reset);
+				return rc;
+			}
+			gpio_direction_output(pdata->rawchip_reset, 0);
+			mdelay(1);
+			gpio_direction_output(pdata->rawchip_reset, 1);
+			gpio_free(pdata->rawchip_reset);
+			
+		}
+		rawchip_init_data.use_rawchip = data.use_rawchip;
+		rc = Yushan_sensor_open_init(rawchip_init_data);
+		rawchipCtrl->rawchip_init = 1;
+		return rc;
+	}
+
+	pr_info("rawchip set size %d %d %d %d\n",
+		data.width, data.height, data.line_length_pclk, data.frame_length_lines);
+
+	sYushanNewContextConfig.uwActivePixels = data.width;
+	sYushanNewContextConfig.uwLineBlank = data.line_length_pclk - data.width;
+	sYushanNewContextConfig.uwActiveFrameLength = data.height;
+	sYushanNewContextConfig.uwPixelFormat = 0x0A0A;
+
+	sImageChar_context.bImageOrientation = orientation;
+	sImageChar_context.uwXAddrStart = data.x_addr_start;
+	sImageChar_context.uwYAddrStart = data.y_addr_start;
+	sImageChar_context.uwXAddrEnd= data.x_addr_end;
+	sImageChar_context.uwYAddrEnd= data.y_addr_end;
+	sImageChar_context.uwXEvenInc = data.x_even_inc;
+	sImageChar_context.uwXOddInc = data.x_odd_inc;
+	sImageChar_context.uwYEvenInc = data.y_even_inc;
+	sImageChar_context.uwYOddInc = data.y_odd_inc;
+	sImageChar_context.bBinning = data.binning_rawchip;
+
+	rc = Yushan_ContextUpdate_Wrapper(sYushanNewContextConfig, sImageChar_context);
+	return rc;
+}
+
+static int rawchip_get_dxoprc_frameSetting(struct rawchip_ctrl *raw_dev, void __user *arg)
+{
+	rawchip_dxo_frameSetting frameSetting;
+	int rc = 0;
+	struct rawchip_stats_event_ctrl se;
+	int timeout;
+
+	CDBG("%s\n *should be only once*", __func__);
+
+	frameSetting.orientation	= sImageChar_context.bImageOrientation;
+	frameSetting.xStart	= sImageChar_context.uwXAddrStart;
+	frameSetting.yStart	= sImageChar_context.uwYAddrStart;
+	frameSetting.xEnd		= sImageChar_context.uwXAddrEnd;
+	frameSetting.yEnd		= sImageChar_context.uwYAddrEnd;
+	frameSetting.xEvenInc	= sImageChar_context.uwXEvenInc;
+	frameSetting.yEvenInc  = sImageChar_context.uwYEvenInc;
+	frameSetting.xOddInc	= sImageChar_context.uwXOddInc;
+	frameSetting.yOddInc	= sImageChar_context.uwXOddInc;
+	frameSetting.binning	= sImageChar_context.bBinning;
+	if (copy_from_user(&se, arg,
+			sizeof(struct rawchip_stats_event_ctrl))) {
+		pr_err("%s, ERR_COPY_FROM_USER\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+	timeout = (int)se.timeout_ms;
+	CDBG("[CAM] %s: timeout %d\n", __func__, timeout);
+	se.type = 5;
+	se.length = sizeof(frameSetting);
+
+	if (copy_to_user((void *)(se.data),
+			&frameSetting,
+			se.length)) {
+			pr_err("%s, ERR_COPY_TO_USER 1\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+
+	if (copy_to_user((void *)arg, &se, sizeof(se))) {
+		pr_err("%s, ERR_COPY_TO_USER 2\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+end:
+	return rc;
+	
+
+}
+static int rawchip_get_interrupt(struct rawchip_ctrl *raw_dev, void __user *arg)
+{
+	int rc = 0;
+	struct rawchip_stats_event_ctrl se;
+	int timeout;
+	uint8_t interrupt_type;
+	uint8_t interrupt0_type = 0;
+	uint8_t interrupt1_type = 0;
+
+	CDBG("%s\n", __func__);
+
+	if (copy_from_user(&se, arg,
+			sizeof(struct rawchip_stats_event_ctrl))) {
+		pr_err("%s, ERR_COPY_FROM_USER\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+
+	timeout = (int)se.timeout_ms;
+
+	CDBG("[CAM] %s: timeout %d\n", __func__, timeout);
+
+	if (atomic_read(&rawchipCtrl->check_intr0)) {
+		interrupt0_type = Yushan_parse_interrupt(INTERRUPT_PAD_0, rawchipCtrl->error_interrupt_times);
+		atomic_set(&rawchipCtrl->check_intr0, 0);
+	}
+	if (atomic_read(&rawchipCtrl->check_intr1)) {
+		interrupt1_type = Yushan_parse_interrupt(INTERRUPT_PAD_1, rawchipCtrl->error_interrupt_times);
+		atomic_set(&rawchipCtrl->check_intr1, 0);
+	}
+	interrupt_type = interrupt0_type | interrupt1_type;
+	if (interrupt_type & RAWCHIP_INT_TYPE_ERROR) {
+		rawchipCtrl->total_error_interrupt_times++;
+		if (rawchipCtrl->total_error_interrupt_times <= 10 || rawchipCtrl->total_error_interrupt_times % 1000 == 0) {
+			Yushan_Status_Snapshot();
+			Yushan_dump_Dxo();
+		}
+	}
+	se.type = 10;
+	se.length = sizeof(interrupt_type);
+	if (copy_to_user((void *)(se.data),
+			&interrupt_type,
+			se.length)) {
+			pr_err("%s, ERR_COPY_TO_USER 1\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+
+	if (copy_to_user((void *)arg, &se, sizeof(se))) {
+		pr_err("%s, ERR_COPY_TO_USER 2\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+end:
+	return rc;
+}
+
+static int rawchip_get_af_status(struct rawchip_ctrl *raw_dev, void __user *arg)
+{
+	int rc = 0;
+	struct rawchip_stats_event_ctrl se;
+	int timeout;
+	rawchip_af_stats af_stats;
+	CDBG("%s\n", __func__);
+
+	if (copy_from_user(&se, arg,
+			sizeof(struct rawchip_stats_event_ctrl))) {
+		pr_err("%s, ERR_COPY_FROM_USER\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+
+	timeout = (int)se.timeout_ms;
+
+	CDBG("[CAM] %s: timeout %d\n", __func__, timeout);
+	rc = Yushan_get_AFSU(&af_stats);
+
+	if (rc < 0) {
+		pr_err("%s, Yushan_get_AFSU failed\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+	se.type = 5;
+	se.length = sizeof(af_stats);
+
+	if (copy_to_user((void *)(se.data),
+			&af_stats,
+			se.length)) {
+			pr_err("%s, ERR_COPY_TO_USER 1\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+
+	if (copy_to_user((void *)arg, &se, sizeof(se))) {
+		pr_err("%s, ERR_COPY_TO_USER 2\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+
+end:
+	return rc;
+}
+
+static int rawchip_get_dxo_version(struct rawchip_ctrl *raw_dev, void __user *arg)
+{
+
+	int rc = 0;
+	struct rawchip_stats_event_ctrl se;
+	int timeout;
+	rawchip_dxo_version dxoVersion;
+
+	CDBG("%s\n", __func__);
+
+	if (copy_from_user(&se, arg,
+			sizeof(struct rawchip_stats_event_ctrl))) {
+		pr_err("%s, ERR_COPY_FROM_USER\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+	timeout = (int)se.timeout_ms;
+	CDBG("[CAM] %s: timeout %d\n", __func__, timeout);
+
+	Yushan_Get_Version(&dxoVersion);
+
+	se.type = 5 ;
+	se.length = sizeof(dxoVersion);
+
+	if (copy_to_user((void *)(se.data),
+			&dxoVersion,
+			se.length)) {
+			pr_err("%s, ERR_COPY_TO_USER 1\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+	if (copy_to_user((void *)arg, &se, sizeof(se))) {
+		pr_err("%s, ERR_COPY_TO_USER 2\n", __func__);
+		rc = -EFAULT;
+		goto end;
+	}
+
+end:
+	return rc;
+}
+static int rawchip_set_dxo_prc_afStrategy(struct rawchip_ctrl *raw_dev, void __user *arg)
+{
+	int rc = 0;
+	struct rawchip_stats_event_ctrl se;
+	uint8_t* afStrategy;
+
+	CDBG("%s\n", __func__);
+
+	if (copy_from_user(&se, arg,
+			sizeof(struct rawchip_stats_event_ctrl))) {
+		pr_err("%s, ERR_COPY_FROM_USER\n", __func__);
+		return -EFAULT;
+	}
+
+	afStrategy = kmalloc(se.length, GFP_ATOMIC);
+	if (!afStrategy) {
+		pr_err("%s %d: kmalloc failed\n", __func__,
+			__LINE__);
+		return -ENOMEM;
+	}
+	if (copy_from_user(afStrategy,
+		(void __user *)(se.data),
+		se.length)) {
+		pr_err("%s %d: copy_from_user failed\n", __func__,
+			__LINE__);
+		kfree(afStrategy);
+		return -EFAULT;
+	}
+
+	CDBG("%s afStrategy = %d\n", __func__,*afStrategy);
+
+	rc = Yushan_Set_AF_Strategy(*afStrategy);
+	if (rc < 0) {
+		pr_err("%s, Yushan_Set_AF_Strategy failed\n", __func__);
+		kfree(afStrategy);
+		return -EFAULT;
+	}
+
+	kfree(afStrategy);
+	return 0;
+}
+static int rawchip_update_aec_awb_params(struct rawchip_ctrl *raw_dev, void __user *arg)
+{
+	struct rawchip_stats_event_ctrl se;
+	rawchip_update_aec_awb_params_t *update_aec_awb_params;
+
+	CDBG("%s\n", __func__);
+	if (copy_from_user(&se, arg,
+			sizeof(struct rawchip_stats_event_ctrl))) {
+		pr_err("%s, ERR_COPY_FROM_USER\n", __func__);
+		return -EFAULT;
+	}
+
+	update_aec_awb_params = kmalloc(se.length, GFP_ATOMIC);
+	if (!update_aec_awb_params) {
+		pr_err("%s %d: kmalloc failed\n", __func__,
+			__LINE__);
+		return -ENOMEM;
+	}
+	if (copy_from_user(update_aec_awb_params,
+		(void __user *)(se.data),
+		se.length)) {
+		pr_err("%s %d: copy_from_user failed\n", __func__,
+			__LINE__);
+		kfree(update_aec_awb_params);
+		return -EFAULT;
+	}
+
+	CDBG("%s gain=%d dig_gain=%d exp=%d\n", __func__,
+		update_aec_awb_params->aec_params.gain, update_aec_awb_params->aec_params.dig_gain,
+		update_aec_awb_params->aec_params.exp);
+	CDBG("%s rg_ratio=%d bg_ratio=%d\n", __func__,
+		update_aec_awb_params->awb_params.rg_ratio, update_aec_awb_params->awb_params.bg_ratio);
+
+	Yushan_Update_AEC_AWB_Params(update_aec_awb_params);
+
+	kfree(update_aec_awb_params);
+	return 0;
+}
+
+static int rawchip_update_af_params(struct rawchip_ctrl *raw_dev, void __user *arg)
+{
+	struct rawchip_stats_event_ctrl se;
+	rawchip_update_af_params_t *update_af_params;
+
+	CDBG("%s\n", __func__);
+	if (copy_from_user(&se, arg,
+			sizeof(struct rawchip_stats_event_ctrl))) {
+		pr_err("%s, ERR_COPY_FROM_USER\n", __func__);
+		return -EFAULT;
+	}
+
+	update_af_params = kmalloc(se.length, GFP_ATOMIC);
+	if (!update_af_params) {
+		pr_err("%s %d: kmalloc failed\n", __func__,
+			__LINE__);
+		return -ENOMEM;
+	}
+	if (copy_from_user(update_af_params,
+		(void __user *)(se.data),
+		se.length)) {
+		pr_err("%s %d: copy_from_user failed\n", __func__,
+			__LINE__);
+		kfree(update_af_params);
+		return -EFAULT;
+	}
+
+	CDBG("active_number=%d\n", update_af_params->af_params.active_number);
+	CDBG("sYushanAfRoi[0] %d %d %d %d\n",
+		update_af_params->af_params.sYushanAfRoi[0].bXStart,
+		update_af_params->af_params.sYushanAfRoi[0].bXEnd,
+		update_af_params->af_params.sYushanAfRoi[0].bYStart,
+		update_af_params->af_params.sYushanAfRoi[0].bYEnd);
+
+	Yushan_Update_AF_Params(update_af_params);
+
+	kfree(update_af_params);
+	return 0;
+}
+
+static int rawchip_update_3a_params(struct rawchip_ctrl *raw_dev, void __user *arg)
+{
+	struct rawchip_stats_event_ctrl se;
+	rawchip_newframe_ack_enable_t  *enable_newframe_ack;
+
+	CDBG("%s\n", __func__);
+	if (copy_from_user(&se, arg,
+			sizeof(struct rawchip_stats_event_ctrl))) {
+		pr_err("%s, ERR_COPY_FROM_USER\n", __func__);
+		return -EFAULT;
+	}
+
+	enable_newframe_ack = kmalloc(se.length, GFP_ATOMIC);
+	if (!enable_newframe_ack) {
+		pr_err("%s %d: kmalloc failed\n", __func__,
+			__LINE__);
+		return -ENOMEM;
+	}
+	if (copy_from_user(enable_newframe_ack,
+		(void __user *)(se.data),
+		se.length)) {
+		pr_err("%s %d: copy_from_user failed\n", __func__,
+			__LINE__);
+		kfree(enable_newframe_ack);
+		return -EFAULT;
+	}
+
+	CDBG("enable_newframe_ack=%d\n", *enable_newframe_ack);
+	Yushan_Update_3A_Params(*enable_newframe_ack);
+	CDBG("rawchip_update_3a_params done\n");
+
+	kfree(enable_newframe_ack);
+	return 0;
+}
+
+int rawchip_power_up(const struct msm_camera_rawchip_info *pdata)
+{
+	int rc = 0;
+	CDBG("[CAM] %s\n", __func__);
+
+	if (pdata->camera_rawchip_power_on == NULL) {
+		pr_err("rawchip power on platform_data didn't register\n");
+		return -EIO;
+	}
+	rc = pdata->camera_rawchip_power_on();
+	if (rc < 0) {
+		pr_err("rawchip power on failed\n");
+		goto enable_power_on_failed;
+	}
+
+#ifdef CONFIG_RAWCHIP_MCLK
+	rc = msm_camio_clk_enable(CAMIO_CAM_RAWCHIP_MCLK_CLK);
+#else
+	rc = msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
+#endif
+
+	if (rc < 0) {
+		pr_err("enable MCLK failed\n");
+		goto enable_mclk_failed;
+	}
+	mdelay(1); 
+
+	rc = gpio_request(pdata->rawchip_reset, "rawchip");
+	if (rc < 0) {
+		pr_err("GPIO(%d) request failed\n", pdata->rawchip_reset);
+		goto enable_reset_failed;
+	}
+	gpio_direction_output(pdata->rawchip_reset, 1);
+	gpio_free(pdata->rawchip_reset);
+	mdelay(1); 
+
+	yushan_spi_write(0x0008, 0x7f);
+	mdelay(1);
+
+	return rc;
+
+enable_reset_failed:
+#ifdef CONFIG_RAWCHIP_MCLK
+	rc = msm_camio_clk_disable(CAMIO_CAM_RAWCHIP_MCLK_CLK);
+#else
+	rc = msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
+#endif
+
+enable_mclk_failed:
+	if (pdata->camera_rawchip_power_off == NULL)
+		pr_err("rawchip power off platform_data didn't register\n");
+	else
+		pdata->camera_rawchip_power_off();
+enable_power_on_failed:
+	return rc;
+}
+
+int rawchip_power_down(const struct msm_camera_rawchip_info *pdata)
+{
+	int rc = 0;
+	CDBG("%s\n", __func__);
+
+	rc = gpio_request(pdata->rawchip_reset, "rawchip");
+	if (rc < 0)
+		pr_err("GPIO(%d) request failed\n", pdata->rawchip_reset);
+	gpio_direction_output(pdata->rawchip_reset, 0);
+	gpio_free(pdata->rawchip_reset);
+
+	mdelay(1);
+
+#ifdef CONFIG_RAWCHIP_MCLK
+	rc = msm_camio_clk_disable(CAMIO_CAM_RAWCHIP_MCLK_CLK);
+#else
+	rc = msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
+#endif
+
+	if (rc < 0)
+		pr_err("disable MCLK failed\n");
+
+	if (pdata->camera_rawchip_power_off == NULL) {
+		pr_err("rawchip power off platform_data didn't register\n");
+		return -EIO;
+	}
+
+	rc = pdata->camera_rawchip_power_off();
+	if (rc < 0)
+		pr_err("rawchip power off failed\n");
+
+	return rc;
+}
+
+extern uint32_t rawchip_id;
+
+int rawchip_match_id(void)
+{
+	int rc = 0;
+	uint32_t chipid = 0;
+	int retry_spi_cnt = 0, retry_readid_cnt = 0;
+	uint8_t read_byte;
+	int i;
+	CDBG("%s\n", __func__);
+
+	for (retry_spi_cnt = 0, retry_readid_cnt = 0; (retry_spi_cnt < 3 && retry_readid_cnt < 3); ) {
+		chipid = 0;
+		for (i = 0; i < 4; i++) {
+			rc = SPI_Read((rawchip_info.rawchip_id_info->rawchip_id_reg_addr + i), 1, (uint8_t*)(&read_byte));
+			if (rc < 0) {
+				pr_err("%s: read id failed\n", __func__);
+				retry_spi_cnt++;
+				pr_info("%s: retry: %d\n", __func__, retry_spi_cnt);
+				mdelay(5);
+				break;
+			} else
+				*((uint8_t*)(&chipid) + i) = read_byte;
+		}
+		if (rc < 0)
+			continue;
+
+		pr_info("rawchip id: 0x%x requested id: 0x%x\n", chipid, rawchip_info.rawchip_id_info->rawchip_id);
+		if (chipid != rawchip_info.rawchip_id_info->rawchip_id) {
+			pr_err("rawchip_match_id chip id does not match\n");
+			retry_readid_cnt++;
+			pr_info("%s: retry: %d\n", __func__, retry_readid_cnt);
+			mdelay(5);
+			rc = -ENODEV;
+			continue;
+		} else
+			break;
+	}
+
+	rawchip_id = chipid;
+	return rc;
+}
+
+void rawchip_release(void)
+{
+	struct msm_camera_rawchip_info *pdata = rawchipCtrl->pdata;
+
+	pr_info("%s\n", __func__);
+
+	CDBG("[CAM] rawchip free irq");
+	free_irq(pdata->rawchip_intr0, 0);
+	free_irq(pdata->rawchip_intr1, 0);
+
+	rawchip_power_down(pdata);
+}
+
+int rawchip_open_init(void)
+{
+	int rc = 0;
+	struct msm_camera_rawchip_info *pdata = rawchipCtrl->pdata;
+	int read_id_retry = 0;
+	int i;
+
+	pr_info("%s\n", __func__);
+
+open_read_id_retry:
+	rc = rawchip_power_up(pdata);
+	if (rc < 0)
+		return rc;
+
+	rc = rawchip_match_id();
+	if (rc < 0) {
+		if (read_id_retry < 3) {
+			pr_info("retry read rawchip ID: %d\n", read_id_retry);
+			read_id_retry++;
+			rawchip_power_down(pdata);
+			goto open_read_id_retry;
+		}
+		goto open_init_failed;
+	}
+
+	init_waitqueue_head(&yushan_int.yushan_wait);
+	spin_lock_init(&yushan_int.yushan_spin_lock);
+	atomic_set(&interrupt, 0);
+	atomic_set(&interrupt2, 0);
+
+	
+	rc = request_irq(pdata->rawchip_intr0, yushan_irq_handler,
+		IRQF_TRIGGER_HIGH, "yushan_irq", 0);
+	if (rc < 0) {
+		pr_err("request irq intr0 failed\n");
+		goto open_init_failed;
+	}
+
+	rc = request_irq(pdata->rawchip_intr1, yushan_irq_handler2,
+		IRQF_TRIGGER_HIGH, "yushan_irq2", 0);
+	if (rc < 0) {
+		pr_err("request irq intr1 failed\n");
+		free_irq(pdata->rawchip_intr0, 0);
+		goto open_init_failed;
+	}
+
+	rawchipCtrl->rawchip_init = 0;
+	rawchipCtrl->total_error_interrupt_times = 0;
+	for (i = 0; i < TOTAL_INTERRUPT_COUNT; i++)
+		rawchipCtrl->error_interrupt_times[i] = 0;
+	atomic_set(&rawchipCtrl->check_intr0, 0);
+	atomic_set(&rawchipCtrl->check_intr1, 0);
+	rawchip_intr0 = pdata->rawchip_intr0;
+	rawchip_intr1 = pdata->rawchip_intr1;
+
+	return rc;
+
+open_init_failed:
+	pr_err("%s: rawchip_open_init failed\n", __func__);
+	rawchip_power_down(pdata);
+
+	return rc;
+}
+
+int rawchip_probe_init(void)
+{
+	int rc = 0;
+	struct msm_camera_rawchip_info *pdata = NULL;
+	int read_id_retry = 0;
+
+	pr_info("%s\n", __func__);
+
+	if (rawchipCtrl == NULL) {
+		pr_err("already failed in __msm_rawchip_probe\n");
+		return -EINVAL;
+	} else
+		pdata = rawchipCtrl->pdata;
+
+probe_read_id_retry:
+	rc = rawchip_power_up(pdata);
+	if (rc < 0)
+		return rc;
+
+	rc = rawchip_match_id();
+	if (rc < 0) {
+		if (read_id_retry < 3) {
+			pr_info("retry read rawchip ID: %d\n", read_id_retry);
+			read_id_retry++;
+			rawchip_power_down(pdata);
+			goto probe_read_id_retry;
+		}
+		goto probe_init_fail;
+	}
+
+	pr_info("%s: probe_success\n", __func__);
+	return rc;
+
+probe_init_fail:
+	pr_err("%s: rawchip_probe_init failed\n", __func__);
+	rawchip_power_down(pdata);
+	return rc;
+}
+
+void rawchip_probe_deinit(void)
+{
+	struct msm_camera_rawchip_info *pdata = rawchipCtrl->pdata;
+	CDBG("%s\n", __func__);
+
+	rawchip_power_down(pdata);
+}
+
+static int rawchip_fops_open(struct inode *inode, struct file *filp)
+{
+	struct rawchip_ctrl *raw_dev = container_of(inode->i_cdev,
+		struct rawchip_ctrl, cdev);
+
+	filp->private_data = raw_dev;
+
+	return 0;
+}
+
+static unsigned int rawchip_fops_poll(struct file *filp,
+	struct poll_table_struct *pll_table)
+{
+	int rc = 0;
+	unsigned long flags;
+
+	poll_wait(filp, &yushan_int.yushan_wait, pll_table);
+
+	spin_lock_irqsave(&yushan_int.yushan_spin_lock, flags);
+	if (atomic_read(&interrupt)) {
+		atomic_set(&interrupt, 0);
+		atomic_set(&rawchipCtrl->check_intr0, 1);
+		rc = POLLIN | POLLRDNORM;
+	}
+	if (atomic_read(&interrupt2)) {
+		atomic_set(&interrupt2, 0);
+		atomic_set(&rawchipCtrl->check_intr1, 1);
+		rc = POLLIN | POLLRDNORM;
+	}
+	spin_unlock_irqrestore(&yushan_int.yushan_spin_lock, flags);
+
+	return rc;
+}
+
+static long rawchip_fops_ioctl(struct file *filp, unsigned int cmd,
+	unsigned long arg)
+{
+	int rc = 0;
+	struct rawchip_ctrl *raw_dev = filp->private_data;
+	void __user *argp = (void __user *)arg;
+
+	CDBG("%s:%d cmd = %d\n", __func__, __LINE__, _IOC_NR(cmd));
+	mutex_lock(&raw_dev->raw_ioctl_lock);
+	switch (cmd) {
+	case RAWCHIP_IOCTL_GET_INT:
+		CDBG("RAWCHIP_IOCTL_GET_INT\n");
+		rawchip_get_interrupt(raw_dev, argp);
+		break;
+	case RAWCHIP_IOCTL_GET_AF_STATUS:
+		CDBG("RAWCHIP_IOCTL_GET_AF_STATUS\n");
+		rawchip_get_af_status(raw_dev, argp);
+		break;
+	case RAWCHIP_IOCTL_UPDATE_AEC_AWB:
+		CDBG("RAWCHIP_IOCTL_UPDATE_AEC\n");
+		rawchip_update_aec_awb_params(raw_dev, argp);
+		break;
+	case RAWCHIP_IOCTL_UPDATE_AF:
+		CDBG("RAWCHIP_IOCTL_UPDATE_AF\n");
+		rawchip_update_af_params(raw_dev, argp);
+		break;
+	case RAWCHIP_IOCTL_UPDATE_3A:
+		CDBG("RAWCHIP_IOCTL_UPDATE_3A\n");
+		rawchip_update_3a_params(raw_dev, argp);
+		break;
+	case RAWCHIP_IOCTL_SET_DXOPRC_AF_STRATEGY:
+		CDBG("RAWCHIP_IOCTL_SET_DXOPRC_AF_STRATEGY:\n");
+		rawchip_set_dxo_prc_afStrategy(raw_dev, argp);
+		break;
+	case RAWCHIP_IOCTL_GET_DXOPRC_VER:
+		CDBG("RAWCHIP_IOCTL_GET_DXOPRC_VER:\n");
+		rawchip_get_dxo_version(raw_dev, argp);
+		break;
+	case RAWCHIP_IOCTL_GET_DXOPRC_FRAMESETTING:
+		CDBG("RAWCHIP_IOCTL_GET_DXOPRC_FRAMESETTING:\n");
+		rawchip_get_dxoprc_frameSetting(raw_dev, argp);
+		break;
+	}
+	mutex_unlock(&raw_dev->raw_ioctl_lock);
+	return rc;
+}
+
+static  const struct  file_operations rawchip_fops = {
+	.owner	  = THIS_MODULE,
+	.open	   = rawchip_fops_open,
+	.unlocked_ioctl = rawchip_fops_ioctl,
+	.poll  = rawchip_fops_poll,
+};
+
+static int setup_rawchip_cdev(void)
+{
+	int rc = 0;
+	struct device *dev;
+
+	pr_info("%s\n", __func__);
+
+	rc = alloc_chrdev_region(&rawchip_devno, 0, 1, MSM_RAWCHIP_NAME);
+	if (rc < 0) {
+		pr_err("%s: failed to allocate chrdev\n", __func__);
+		goto alloc_chrdev_region_failed;
+	}
+
+	if (!rawchip_class) {
+		rawchip_class = class_create(THIS_MODULE, MSM_RAWCHIP_NAME);
+		if (IS_ERR(rawchip_class)) {
+			rc = PTR_ERR(rawchip_class);
+			pr_err("%s: create device class failed\n",
+				__func__);
+			goto class_create_failed;
+		}
+	}
+
+	dev = device_create(rawchip_class, NULL,
+		MKDEV(MAJOR(rawchip_devno), MINOR(rawchip_devno)), NULL,
+		"%s%d", MSM_RAWCHIP_NAME, 0);
+	if (IS_ERR(dev)) {
+		pr_err("%s: error creating device\n", __func__);
+		rc = -ENODEV;
+		goto device_create_failed;
+	}
+
+	cdev_init(&rawchipCtrl->cdev, &rawchip_fops);
+	rawchipCtrl->cdev.owner = THIS_MODULE;
+	rawchipCtrl->cdev.ops   =
+		(const struct file_operations *) &rawchip_fops;
+	rc = cdev_add(&rawchipCtrl->cdev, rawchip_devno, 1);
+	if (rc < 0) {
+		pr_err("%s: error adding cdev\n", __func__);
+		rc = -ENODEV;
+		goto cdev_add_failed;
+	}
+
+	return rc;
+
+cdev_add_failed:
+	device_destroy(rawchip_class, rawchip_devno);
+device_create_failed:
+	class_destroy(rawchip_class);
+class_create_failed:
+	unregister_chrdev_region(rawchip_devno, 1);
+alloc_chrdev_region_failed:
+	return rc;
+}
+
+static void rawchip_tear_down_cdev(void)
+{
+	cdev_del(&rawchipCtrl->cdev);
+	device_destroy(rawchip_class, rawchip_devno);
+	class_destroy(rawchip_class);
+	unregister_chrdev_region(rawchip_devno, 1);
+}
+
+static int rawchip_driver_probe(struct platform_device *pdev)
+{
+	int rc = 0;
+	pr_info("%s\n", __func__);
+
+	rawchipCtrl = kzalloc(sizeof(struct rawchip_ctrl), GFP_ATOMIC);
+	if (!rawchipCtrl) {
+		pr_err("%s: could not allocate mem for rawchip_dev\n", __func__);
+		return -ENOMEM;
+	}
+
+	rc = setup_rawchip_cdev();
+	if (rc < 0) {
+		kfree(rawchipCtrl);
+		return rc;
+	}
+
+	mutex_init(&rawchipCtrl->raw_ioctl_lock);
+	rawchipCtrl->pdata = pdev->dev.platform_data;
+
+	rc = rawchip_spi_init();
+	if (rc < 0) {
+		pr_err("%s: failed to register spi driver\n", __func__);
+		return rc;
+	}
+
+	msm_rawchip_attr_node();
+
+	return rc;
+}
+
+static int rawchip_driver_remove(struct platform_device *pdev)
+{
+	rawchip_tear_down_cdev();
+
+	mutex_destroy(&rawchipCtrl->raw_ioctl_lock);
+
+	kfree(rawchipCtrl);
+
+	return 0;
+}
+
+static struct  platform_driver rawchip_driver = {
+	.probe  = rawchip_driver_probe,
+	.remove = rawchip_driver_remove,
+	.driver = {
+		.name = "rawchip",
+		.owner = THIS_MODULE,
+	},
+};
+
+static int __init rawchip_driver_init(void)
+{
+	int rc;
+	rc = platform_driver_register(&rawchip_driver);
+	return rc;
+}
+
+static void __exit rawchip_driver_exit(void)
+{
+	platform_driver_unregister(&rawchip_driver);
+}
+
+MODULE_DESCRIPTION("rawchip driver");
+MODULE_VERSION("rawchip 0.1");
+
+module_init(rawchip_driver_init);
+module_exit(rawchip_driver_exit);
+
+
diff --git a/drivers/media/video/msm/rawchip/rawchip.h b/drivers/media/video/msm/rawchip/rawchip.h
new file mode 100644
index 0000000..f8a580e
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/rawchip.h
@@ -0,0 +1,107 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef MSM_RAWCHIP_H
+#define MSM_RAWCHIP_H
+
+#include <linux/delay.h>
+#include <linux/types.h>
+#include <linux/uaccess.h>
+#include <linux/miscdevice.h>
+#include <linux/earlysuspend.h>
+#include <linux/wakelock.h>
+#include <linux/slab.h>
+#include <linux/fs.h>
+#include <linux/list.h>
+#include <linux/cdev.h>
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/device.h>
+
+#include <mach/camera.h>
+
+
+#include <mach/gpio.h>
+#include <mach/vreg.h>
+#include <asm/mach-types.h>
+#include <mach/board.h>
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+
+
+#include <media/linux_rawchip.h>
+#include "Yushan_API.h"
+#include "Yushan_Platform_Specific.h"
+#include "Yushan_HTC_Functions.h"
+#include "../msm.h"
+
+struct rawchip_ctrl {
+	struct msm_camera_rawchip_info *pdata;
+	struct cdev   cdev;
+
+	struct mutex raw_ioctl_lock;
+	int rawchip_init;
+	atomic_t check_intr0;
+	atomic_t check_intr1;
+
+	int error_interrupt_times[TOTAL_INTERRUPT_COUNT];
+	int total_error_interrupt_times;
+
+};
+
+struct rawchip_sensor_data {
+	const char *sensor_name;
+	uint8_t datatype;
+	uint8_t lane_cnt;
+	uint32_t pixel_clk;
+	uint16_t width;
+	uint16_t height;
+	uint16_t line_length_pclk;
+	uint16_t frame_length_lines;
+	uint16_t fullsize_width;
+	uint16_t fullsize_height;
+	uint16_t fullsize_line_length_pclk;
+	uint16_t fullsize_frame_length_lines;
+	int mirror_flip;
+	uint16_t x_addr_start;
+	uint16_t y_addr_start;
+	uint16_t x_addr_end;
+	uint16_t y_addr_end;
+	uint16_t x_even_inc;
+	uint16_t x_odd_inc;
+	uint16_t y_even_inc;
+	uint16_t y_odd_inc;
+	uint8_t binning_rawchip;
+	uint8_t use_rawchip;
+};
+
+struct rawchip_id_info_t {
+	uint16_t rawchip_id_reg_addr;
+	uint32_t rawchip_id;
+};
+
+struct rawchip_info_t {
+	struct rawchip_id_info_t *rawchip_id_info;
+};
+
+int rawchip_probe_init(void);
+void rawchip_probe_deinit(void);
+void rawchip_release(void);
+int rawchip_open_init(void);
+int rawchip_set_size(struct rawchip_sensor_data data);
+
+static inline void rawchip_dump_register(void) { Yushan_dump_register(); }
+
+#endif
diff --git a/drivers/media/video/msm/rawchip/rawchip_spi.c b/drivers/media/video/msm/rawchip/rawchip_spi.c
new file mode 100644
index 0000000..571df38
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/rawchip_spi.c
@@ -0,0 +1,498 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include "rawchip_spi.h"
+
+#ifdef RAWCHIP_SPI_DEBUG
+#define CDBG(fmt, args...) pr_debug(fmt, ##args)
+#else
+#define CDBG(fmt, args...) do { } while (0)
+#endif
+
+#define yushan_MAX_ALLOCATE 1000
+static DEFINE_MUTEX(spi_lock);
+
+static uint8_t *yushan_spi_write_addr;
+
+static struct spi_device *rawchip_dev;
+
+struct yushan_spi_ctrl_blk {
+	struct spi_device *spi;
+	spinlock_t		spinlock;
+};
+struct yushan_spi_ctrl_blk *yushan_spi_ctrl;
+
+static int
+yushan_spi_sync_write_then_read(uint8_t *txbuf, size_t n_tx,
+	uint8_t *rxbuf, size_t n_rx)
+{
+#if 0
+	struct spi_transfer	tx_t = {
+			.tx_buf		= txbuf,
+			.len		= n_tx,
+		};
+	struct spi_transfer	rx_t = {
+			.rx_buf		= rxbuf,
+			.len		= n_rx,
+		};
+	struct spi_message	m;
+
+	spi_message_init(&m);
+	spi_message_add_tail(&tx_t, &m);
+	spi_message_add_tail(&rx_t, &m);
+#else
+	struct spi_transfer	rx_t = {
+		.tx_buf = txbuf,
+		.rx_buf		= rxbuf,
+		.len		= n_rx,
+		};
+	struct spi_message	m;
+
+	spi_message_init(&m);
+	spi_message_add_tail(&rx_t, &m);
+#endif
+
+	return spi_sync(yushan_spi_ctrl->spi, &m); 
+}
+int yushan_spi_read(uint16_t reg, uint8_t *rval)
+{
+	int rc = 0;
+	uint8_t  rx[6];
+	rx[0] = 0x60;
+	rx[1] = (reg & 0xff00) >> 8;
+	rx[2] = reg & 0x00ff;
+	rx[3] = 0x61;
+	rx[4] = 0;
+	
+
+	rc = yushan_spi_sync_write_then_read(&rx[0], 3,
+		&rx[3], 2);
+#if 0
+	pr_info("%s: rc = %d\n", __func__, rc);
+	pr_info("rx[3] = 0x%x, rx[4] = 0x%x, rx[5] = 0x%x\n",
+		rx[3], rx[4], rx[5]);
+#endif
+	if (rc >= 0)
+		
+		*rval = rx[4];
+	else {
+		pr_err("yushan_spi_sync_write_then_read failed\n");
+		*rval = 0;
+	}
+
+	return rc;
+}
+
+int SPI_Read( uint16_t uwIndex , uint16_t uwCount , uint8_t * pData)
+{
+	uint16_t reg;
+	uint8_t i, val, rc=0;
+	val=0;
+
+	mutex_lock(&spi_lock);
+	for (i=0; i<uwCount; i++)
+	{
+		reg = uwIndex+i;
+		
+		rc = rawchip_spi_read_2B1B(reg,&val);
+		if (rc==0)
+		{
+			*(pData+i)=val;
+			CDBG("[CAM]%s 0x%x[%d]=0x%x SPI_Read OK",__func__, uwIndex, i, *(pData+i));
+		}
+		else
+		{
+			pr_err("[CAM]%s 0x%x[%d]=0x%x " \
+				"SPI_Read Fail",__func__, uwIndex, i, *(pData+i));
+			break;
+		}
+	}
+	mutex_unlock(&spi_lock);
+
+	if(rc==0)
+		return SUCCESS;
+	else
+		return FAILURE;
+}
+
+#if 0
+static int yushan_spi_sync_write_once(uint8_t *tbuf, uint8_t *wbuf)
+{
+	struct spi_message	m;
+
+	struct spi_transfer tx_addr = {
+		.tx_buf	= tbuf,
+		.len = 3,
+	};
+
+	struct spi_transfer tx_buf = {
+		.tx_buf = wbuf,
+		.len = 3,
+	};
+
+	spi_message_init(&m);
+	spi_message_add_tail(&tx_addr, &m);
+	spi_message_add_tail(&tx_buf, &m);
+
+	return yushan_spi_transaction(&m);
+}
+#if 1
+static int yushan_spi_write(uint16_t reg, uint16_t val)
+{
+	uint8_t tx[3], wb[3];
+
+	tx[0] = yushan_REGADDR_WR;
+	tx[1] = (reg & 0xff00) >> 8;
+	tx[2] = reg & 0x00ff;
+
+	wb[0] = yushan_REGVAL_WR;
+	wb[1] = (val & 0xff00) >> 8;
+	wb[2] = val & 0x00ff;
+
+    return yushan_spi_sync_write_once(&tx[0], &wb[0]);
+}
+#endif
+#endif
+
+static void yushan_spi_complete(void *arg)
+{
+	complete(arg);
+}
+
+static int yushan_spi_transaction(struct spi_message *msg)
+{
+	DECLARE_COMPLETION_ONSTACK(yushan_done);
+	
+	static int status = 0;
+	
+
+	msg->complete = yushan_spi_complete;
+	msg->context = &yushan_done;
+
+	CDBG("[CAMSPI] %s spin_lock_irq\n",__func__);
+	spin_lock_irq(&yushan_spi_ctrl->spinlock);
+	if (yushan_spi_ctrl->spi == NULL)
+		status = -ESHUTDOWN;
+	else
+		{
+		CDBG("[CAMSPI] %s spi_async\n",__func__);
+		status = spi_async(yushan_spi_ctrl->spi, msg);
+		}
+	CDBG("[CAMSPI] %s spin_unlock_irq\n",__func__);
+	spin_unlock_irq(&yushan_spi_ctrl->spinlock);
+
+	if (status == 0) {
+		CDBG("[CAMSPI] %s wait_for_completion\n",__func__);
+		wait_for_completion(&yushan_done);
+		CDBG("[CAMSPI] %s wait_for_completion DONE\n",__func__);
+		status = msg->status;
+		if (status == 0)
+			status = msg->actual_length;
+	}
+
+	return status;
+}
+
+static int yushan_spi_sync_write_once(uint8_t *tbuf, uint8_t *wbuf)
+{
+	struct spi_message	m;
+
+	struct spi_transfer tx_addr = {
+		.tx_buf	= tbuf,
+		.len = 4,
+	};
+	spi_message_init(&m);
+	spi_message_add_tail(&tx_addr, &m);
+	return yushan_spi_transaction(&m);
+}
+
+int yushan_spi_write(uint16_t reg, uint8_t val)
+{
+	uint8_t tx[4];
+
+	tx[0] = 0x60;
+	tx[1] = (reg & 0xff00) >> 8;
+	tx[2] = reg & 0x00ff;
+	tx[3] = val;
+
+    return yushan_spi_sync_write_once(&tx[0], NULL);
+}
+
+int SPI_Write(uint16_t uwIndex , uint16_t uwCount , uint8_t *pData)
+{
+	uint16_t reg, i;
+	uint8_t val, rc = 0;
+	val = 0;
+
+	mutex_lock(&spi_lock);
+	for (i = 0; i < uwCount; i++) {
+		reg = uwIndex+i;
+		rc = yushan_spi_write(reg,*(pData+i));
+		if (rc == 0)
+			CDBG("[DxO]%s 0x%x[%d]=0x%x SPI_Write OK",__func__, uwIndex, i, *(pData+i));
+		else {
+			pr_err("[CAM]%s 0x%x[%d]=0x%x " \
+			"SPI_Write Fail",__func__, uwIndex, i, *(pData+i));
+			break;
+		}
+	}
+	mutex_unlock(&spi_lock);
+
+	if (rc == 0)
+		return SUCCESS;
+	else
+		return FAILURE;
+}
+
+static int32_t Yushan_spi_write_table(
+	uint16_t uwIndex , uint16_t uwCount , uint8_t *pData)
+{
+	int i, status;
+	struct spi_message	m;
+	struct spi_transfer	tx_addr;
+	uint16_t transferedIndex = 0;
+
+	if (!yushan_spi_write_addr) {
+		pr_err("Error allocating memory retrying num:%d\n", uwCount);
+		return FAILURE;
+	}
+
+	while (transferedIndex < uwCount) {
+		spi_message_init(&m);
+		memset(&tx_addr, 0, sizeof(struct spi_transfer));
+
+		yushan_spi_write_addr[0] = 0x60;
+		yushan_spi_write_addr[1] = ((uwIndex+transferedIndex) & 0xff00) >> 8;
+		yushan_spi_write_addr[2] = (uwIndex+transferedIndex) & 0x00ff;
+
+		for (i = 0; (i < yushan_MAX_ALLOCATE && transferedIndex < uwCount); i++, transferedIndex++)
+			yushan_spi_write_addr[i+3] = *(pData+transferedIndex);
+
+		tx_addr.tx_buf = yushan_spi_write_addr;
+		tx_addr.len = i+3;
+		tx_addr.cs_change = 0;
+		tx_addr.bits_per_word = 32;
+		spi_message_add_tail(&tx_addr, &m);
+		status = yushan_spi_transaction(&m);
+		if (status != 0) {
+			pr_err("[CAM]%s, spi write status::%d", __func__, status);
+			return FAILURE;
+		}
+	}
+	return SUCCESS;
+}
+
+int SPI_Write_4thByte(uint16_t uwIndex , uint16_t uwCount , uint8_t *pData)
+{
+#if 0
+	uint16_t reg, i;
+	uint8_t val, rc;
+	val=0;
+	for (i = 0; i<uwCount; i++) {
+		reg = uwIndex+i;
+		rc = yushan_spi_write(reg, *(pData+2+4*i));
+		if (rc == 0) {
+			CDBG("[CAM]%s 0x%x=0x%x \
+				SPI_Write OK (%d)", __func__, reg, *(pData+2+4*i), 2+4*i);
+		}
+		else {
+			pr_err("[CAM]%s 0x%x=0x%x\
+				SPI_Write Fail", __func__, reg, *(pData+2+4*i));
+			break;
+		}
+	}
+  if (rc == 0)
+	return SUCCESS;
+  else
+	return FAILURE;
+#else
+	return Yushan_spi_write_table(uwIndex, uwCount, pData);
+#endif
+}
+
+
+int rawchip_spi_write(unsigned char addr, unsigned char data)
+{
+	unsigned char buffer[2];
+	int rc;
+	CDBG("[CAM] rawchip_spi_write+++\n");
+	if (!rawchip_dev)
+		return -1;
+
+	rawchip_dev->bits_per_word = 16;
+	buffer[0] = addr;
+	buffer[1] = data;
+	rc = spi_write(rawchip_dev, buffer, 2);
+	if (rc < 0) {
+		pr_err("[CAM]rawchip_spi_write spi_write failed, rc=%d\n", rc);
+		return rc;
+	}
+	CDBG("[CAM] rawchip_spi_write---, rc=%d\n", rc);
+	return rc;
+}
+
+int rawchip_spi_write_2B1B(uint16_t addr, unsigned char data)
+{
+	unsigned char buffer[4];
+	int rc;
+	
+
+	if (!rawchip_dev)
+		return -1;
+
+	rawchip_dev->bits_per_word = 8;
+	buffer[0] = 0x60;
+	buffer[1] = (addr & 0xff00) >> 8;
+	buffer[2] = addr & 0x00ff;
+	buffer[3] = data;
+	rc = spi_write(rawchip_dev, buffer, 4);
+	if (rc < 0) {
+		pr_err("[CAM]rawchip_spi_write_2B1B spi_write failed, rc=%d\n", rc);
+		return rc;
+	}
+	CDBG("[CAM] rawchip_spi_write_2B1B--\
+		, rc=%d (addr=0x%x, data=0x%x)\n", rc, addr, data);
+
+#if 0
+	msleep(10);
+	rawchip_spi_read_2B1B(addr, &rb);
+	if (data!=rb)
+		pr_info("[CAM]rawchip_spi_write_2B1B!!!!, %d %d\n", data, rb);
+#endif
+
+	return rc;
+}
+
+
+int rawchip_spi_read_2B1B(uint16_t addr, unsigned char *data)
+{
+	unsigned char buffer[4], tx_buf[2], rx_buf[2];
+	int rc;
+	if (!rawchip_dev)
+		return -1;
+
+	rawchip_dev->bits_per_word = 8;
+	buffer[0] = 0x60;
+	buffer[1] = (addr & 0xff00) >> 8;
+	buffer[2] = addr & 0x00ff;
+
+	rc = spi_write(rawchip_dev, buffer, 3);
+	if (rc < 0) {
+		pr_err("[CAM]rawchip_spi_read_2B1B spi_write failed, rc=%d\n", rc);
+		return rc;
+	}
+
+	tx_buf[0] = 0x61;
+	tx_buf[1] = 0x00;
+
+	rx_buf[0] = 0x00;
+	rx_buf[1] = 0x00;
+
+	rc = spi_write_and_read(rawchip_dev, tx_buf, rx_buf, 2);
+	if (rc < 0) {
+		pr_err("[CAM]rawchip_spi_read_2B1B spi_write_and_read failed, rc=%d\n", rc);
+		return rc;
+	}
+	*data = rx_buf[1];
+	CDBG("[CAM]rawchip_spi_read_2B1B---, \
+		rc=%d, (addr=0x%x, data=0x%x)\n", rc, addr, *data);
+
+	return rc;
+}
+
+int rawchip_spi_read_2B2B(uint16_t addr, uint16_t *data)
+{
+	unsigned char buffer[4], tx_buf[2], rx_buf[3];
+	int rc;
+	if (!rawchip_dev)
+		return -1;
+
+	rawchip_dev->bits_per_word = 8;
+	buffer[0] = 0x60;
+	buffer[1] = (addr & 0xff00) >> 8;
+	buffer[2] = addr & 0x00ff;
+
+	rc = spi_write(rawchip_dev, buffer, 3);
+	if (rc < 0) {
+		pr_err("[CAM]rawchip_spi_read_2B2B spi_write failed, rc=%d\n", rc);
+		return rc;
+	}
+
+	tx_buf[0] = 0x61;
+	tx_buf[1] = 0x00;
+
+	rx_buf[0] = 0x00;
+	rx_buf[1] = 0x00;
+	rx_buf[2] = 0x00;
+
+	rc = spi_write_and_read(rawchip_dev, tx_buf, rx_buf, 3);
+	if (rc < 0) {
+		pr_err("[CAM]rawchip_spi_read_2B2B spi_write_and_read failed, rc=%d\n", rc);
+		return rc;
+	}
+	*data = (rx_buf[2]<<8 | rx_buf[1]);
+
+	return rc;
+}
+
+int spi_rawchip_probe(struct spi_device *rawchip)
+{
+	pr_info("[CAM]:%s\n", __func__);
+
+	rawchip_dev = rawchip;
+
+	
+	yushan_spi_ctrl = kzalloc(sizeof(*yushan_spi_ctrl), GFP_KERNEL);
+	if (!yushan_spi_ctrl)
+		return -ENOMEM;
+
+	yushan_spi_ctrl->spi = rawchip;
+	spin_lock_init(&yushan_spi_ctrl->spinlock);
+
+	spi_set_drvdata(rawchip, yushan_spi_ctrl);
+
+	return 0;
+}
+
+static struct spi_driver spi_rawchip = {
+	.driver = {
+		.name = "spi_rawchip",
+		.owner = THIS_MODULE,
+	},
+	.probe = spi_rawchip_probe,
+};
+
+int rawchip_spi_init(void)
+{
+	int rc = -1;
+
+	pr_info("[CAM]%s \n", __func__);
+
+	rc = spi_register_driver(&spi_rawchip);
+	if (rc < 0) {
+		pr_err("[CAM]%s:failed to register \
+			spi driver(%d) for camera\n", __func__, rc);
+		return -EINVAL;
+	}
+
+	if (!yushan_spi_ctrl) {
+		pr_err("yushan_spi_ctrl is NULL!\n");
+		return -EINVAL;
+	}
+
+	if(yushan_spi_write_addr == NULL)
+		yushan_spi_write_addr =
+			kcalloc(yushan_MAX_ALLOCATE+3, sizeof(uint8_t), GFP_KERNEL);
+
+	return 0;
+}
+
diff --git a/drivers/media/video/msm/rawchip/rawchip_spi.h b/drivers/media/video/msm/rawchip/rawchip_spi.h
new file mode 100644
index 0000000..cf4f5ff
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/rawchip_spi.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef MSM_RAWCHIP_SPI_H
+#define MSM_RAWCHIP_SPI_H
+
+#include <linux/module.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/spidev.h>
+
+#define TRUE								1
+#define SUCCESS								1
+#define FALSE								0
+#define FAILURE								0
+
+
+int rawchip_spi_write(unsigned char addr, unsigned char data);
+int rawchip_spi_write_2B1B(uint16_t addr, unsigned char data);
+int rawchip_spi_read_2B1B(uint16_t addr, unsigned char *data);
+int rawchip_spi_read_2B2B(uint16_t addr, uint16_t *data);
+int yushan_spi_write(uint16_t reg, uint8_t val);
+
+int	SPI_Read(uint16_t uwIndex , uint16_t uwCount , uint8_t *pData);
+int	SPI_Write(uint16_t uwIndex , uint16_t uwCount , uint8_t *pData);
+
+int	SPI_Write_4thByte(uint16_t uwIndex ,
+		uint16_t uwCount , uint8_t *pData);
+
+int spi_rawchip_probe(struct spi_device *rawchip);
+
+int rawchip_spi_init(void);
+
+#endif
diff --git a/drivers/media/video/msm/rawchip/yushan_reg.c b/drivers/media/video/msm/rawchip/yushan_reg.c
new file mode 100644
index 0000000..1f9594a
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/yushan_reg.c
@@ -0,0 +1,37984 @@
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include "Yushan_HTC_Functions.h"
+
+uint8_t pdpcode_u[] =
+{
+	0x78,
+	0x64,
+	0x00,
+	0xa0,
+	0xff,
+	0x13,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x13,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0xa0,
+	0x34,
+	0x13,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x9c,
+	0x14,
+	0x1a,
+	0x9c,
+	0x18,
+	0x1a,
+	0x9c,
+	0x20,
+	0x1a,
+	0x9c,
+	0x24,
+	0x1a,
+	0xb8,
+	0xa0,
+	0x04,
+	0x53,
+	0xa1,
+	0x0d,
+	0x00,
+	0x02,
+	0xa0,
+	0x03,
+	0x53,
+	0xd7,
+	0x0d,
+	0x04,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x07,
+	0x02,
+	0xcd,
+	0xd9,
+	0x0d,
+	0xf0,
+	0x04,
+	0xa2,
+	0x02,
+	0x80,
+	0x10,
+	0xa2,
+	0x01,
+	0xad,
+	0x00,
+	0x18,
+	0xc9,
+	0x5b,
+	0xd0,
+	0x07,
+	0xad,
+	0x01,
+	0x18,
+	0xc9,
+	0xe6,
+	0xf0,
+	0x08,
+	0x8e,
+	0x08,
+	0x02,
+	0xee,
+	0x14,
+	0x1a,
+	0x80,
+	0x1b,
+	0xa2,
+	0xff,
+	0x9a,
+	0xa0,
+	0x0e,
+	0x53,
+	0x93,
+	0x0d,
+	0x02,
+	0x00,
+	0xa9,
+	0x03,
+	0x85,
+	0xa0,
+	0x85,
+	0xbf,
+	0xa0,
+	0x05,
+	0x53,
+	0xa5,
+	0x0d,
+	0x2e,
+	0x02,
+	0x58,
+	0xee,
+	0x14,
+	0x1a,
+	0x5c,
+	0x80,
+	0xfd,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xde,
+	0x0c,
+	0x48,
+	0xa9,
+	0x01,
+	0xa0,
+	0x34,
+	0xa6,
+	0xcf,
+	0xf0,
+	0x0b,
+	0x53,
+	0x00,
+	0x02,
+	0x35,
+	0x01,
+	0x8d,
+	0x69,
+	0x01,
+	0x3a,
+	0x80,
+	0x08,
+	0x53,
+	0x00,
+	0x02,
+	0x00,
+	0x01,
+	0x8d,
+	0x34,
+	0x01,
+	0x85,
+	0xcf,
+	0x9c,
+	0x08,
+	0x02,
+	0x9c,
+	0x18,
+	0x1a,
+	0xee,
+	0x18,
+	0x1a,
+	0x20,
+	0x6b,
+	0x0d,
+	0x4c,
+	0x40,
+	0x0d,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xde,
+	0x0c,
+	0x48,
+	0xad,
+	0x34,
+	0x18,
+	0x29,
+	0x03,
+	0xc9,
+	0x02,
+	0xd0,
+	0x0e,
+	0x9c,
+	0x24,
+	0x1a,
+	0xee,
+	0x24,
+	0x1a,
+	0xad,
+	0x33,
+	0x02,
+	0xf0,
+	0x03,
+	0x20,
+	0x6b,
+	0x0d,
+	0x4c,
+	0x40,
+	0x0d,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xde,
+	0x0c,
+	0x48,
+	0x9c,
+	0x24,
+	0x1a,
+	0xee,
+	0x24,
+	0x1a,
+	0x4c,
+	0x40,
+	0x0d,
+	0x40,
+	0xb9,
+	0x28,
+	0x00,
+	0xd0,
+	0x4d,
+	0xb9,
+	0x27,
+	0x00,
+	0xc9,
+	0x08,
+	0xb0,
+	0x46,
+	0x1a,
+	0x4a,
+	0xb0,
+	0x3f,
+	0x85,
+	0xeb,
+	0x98,
+	0x4a,
+	0xa8,
+	0xb9,
+	0x1d,
+	0x00,
+	0x4a,
+	0xb0,
+	0x40,
+	0xb9,
+	0x21,
+	0x00,
+	0xaa,
+	0x4a,
+	0x90,
+	0x36,
+	0x8a,
+	0xf9,
+	0xda,
+	0x0d,
+	0xb9,
+	0x22,
+	0x00,
+	0xf9,
+	0xdb,
+	0x0d,
+	0xb0,
+	0x27,
+	0x8a,
+	0xf9,
+	0x1d,
+	0x00,
+	0xaa,
+	0xb9,
+	0x22,
+	0x00,
+	0xf9,
+	0x1e,
+	0x00,
+	0x90,
+	0x23,
+	0xe8,
+	0xd0,
+	0x01,
+	0x1a,
+	0xa4,
+	0xeb,
+	0x20,
+	0xff,
+	0x0a,
+	0xe8,
+	0xd0,
+	0x01,
+	0x1a,
+	0x4a,
+	0xa8,
+	0x8a,
+	0x6a,
+	0xa2,
+	0x00,
+	0x60,
+	0xa2,
+	0x13,
+	0x60,
+	0xa9,
+	0x11,
+	0x60,
+	0xa2,
+	0x09,
+	0x60,
+	0xa2,
+	0x0d,
+	0x60,
+	0xa2,
+	0x0b,
+	0x60,
+	0xa2,
+	0x0f,
+	0x60,
+	0xf8,
+	0xa5,
+	0xcf,
+	0x85,
+	0xf7,
+	0xa0,
+	0x34,
+	0xa5,
+	0xf7,
+	0xd0,
+	0x12,
+	0xad,
+	0x69,
+	0x01,
+	0xd0,
+	0x03,
+	0x4c,
+	0x25,
+	0x04,
+	0x53,
+	0x35,
+	0x01,
+	0x10,
+	0x00,
+	0x9c,
+	0x69,
+	0x01,
+	0x80,
+	0x10,
+	0xad,
+	0x34,
+	0x01,
+	0xd0,
+	0x03,
+	0x4c,
+	0x25,
+	0x04,
+	0x53,
+	0x00,
+	0x01,
+	0x10,
+	0x00,
+	0x9c,
+	0x34,
+	0x01,
+	0x64,
+	0x63,
+	0xa0,
+	0x00,
+	0x20,
+	0x0e,
+	0x03,
+	0xf0,
+	0x07,
+	0x64,
+	0x45,
+	0x64,
+	0x46,
+	0x8a,
+	0x80,
+	0x59,
+	0x85,
+	0x45,
+	0x84,
+	0x46,
+	0xa0,
+	0x04,
+	0x20,
+	0x0e,
+	0x03,
+	0xf0,
+	0x08,
+	0x8a,
+	0x1a,
+	0x80,
+	0x4a,
+	0xa9,
+	0x1f,
+	0x80,
+	0x46,
+	0x85,
+	0x47,
+	0x84,
+	0x48,
+	0x38,
+	0xa5,
+	0x2e,
+	0xed,
+	0xdf,
+	0x0d,
+	0xa5,
+	0x2f,
+	0xed,
+	0xe0,
+	0x0d,
+	0x90,
+	0xeb,
+	0xad,
+	0xe1,
+	0x0d,
+	0xe5,
+	0x2e,
+	0xad,
+	0xe2,
+	0x0d,
+	0xe5,
+	0x2f,
+	0x90,
+	0xdf,
+	0xa0,
+	0x02,
+	0x53,
+	0x2e,
+	0x00,
+	0xe6,
+	0x00,
+	0x20,
+	0x1c,
+	0x0c,
+	0xa0,
+	0x02,
+	0x53,
+	0xe6,
+	0x00,
+	0x2e,
+	0x00,
+	0xa5,
+	0x1b,
+	0xaa,
+	0x29,
+	0x01,
+	0xd0,
+	0x04,
+	0xa2,
+	0x38,
+	0x86,
+	0x1b,
+	0x20,
+	0x50,
+	0x06,
+	0xd0,
+	0x08,
+	0x20,
+	0x6b,
+	0x09,
+	0xd0,
+	0x03,
+	0x20,
+	0x0b,
+	0x0a,
+	0x85,
+	0x63,
+	0xa0,
+	0x1f,
+	0xa2,
+	0x03,
+	0xa5,
+	0xf7,
+	0xf0,
+	0x09,
+	0x86,
+	0xbf,
+	0x53,
+	0x45,
+	0x00,
+	0xa1,
+	0x00,
+	0x80,
+	0x07,
+	0x86,
+	0xa0,
+	0x53,
+	0x45,
+	0x00,
+	0x82,
+	0x00,
+	0x9c,
+	0x1c,
+	0x1a,
+	0xee,
+	0x1c,
+	0x1a,
+	0x18,
+	0xad,
+	0x69,
+	0x01,
+	0x6d,
+	0x34,
+	0x01,
+	0xf0,
+	0x0a,
+	0xa5,
+	0xf7,
+	0x3a,
+	0x29,
+	0x01,
+	0x85,
+	0xf7,
+	0x4c,
+	0x74,
+	0x03,
+	0x9c,
+	0x6a,
+	0x01,
+	0xad,
+	0x33,
+	0x02,
+	0xf0,
+	0x10,
+	0xa0,
+	0x02,
+	0x53,
+	0x45,
+	0x00,
+	0x09,
+	0x02,
+	0x0e,
+	0x09,
+	0x02,
+	0x2e,
+	0x0a,
+	0x02,
+	0x20,
+	0x6d,
+	0x04,
+	0x4c,
+	0x5d,
+	0x0d,
+	0xa9,
+	0x01,
+	0xc4,
+	0xf5,
+	0xd0,
+	0x04,
+	0xe4,
+	0xf4,
+	0xf0,
+	0x01,
+	0x1a,
+	0x3a,
+	0x60,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xde,
+	0x0c,
+	0x48,
+	0x20,
+	0x6d,
+	0x04,
+	0x4c,
+	0x40,
+	0x0d,
+	0xad,
+	0x0a,
+	0x02,
+	0x4a,
+	0x85,
+	0xf5,
+	0xad,
+	0x09,
+	0x02,
+	0x6a,
+	0xb0,
+	0x46,
+	0x85,
+	0xf4,
+	0x64,
+	0xe4,
+	0xa4,
+	0x83,
+	0xa6,
+	0x82,
+	0x20,
+	0x53,
+	0x04,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe4,
+	0xa4,
+	0xa2,
+	0xa6,
+	0xa1,
+	0x20,
+	0x53,
+	0x04,
+	0xd0,
+	0x04,
+	0xe6,
+	0xe4,
+	0xe6,
+	0xe4,
+	0xa5,
+	0xe4,
+	0xf0,
+	0x26,
+	0xa0,
+	0x1e,
+	0xc9,
+	0x01,
+	0xf0,
+	0x07,
+	0x4a,
+	0x90,
+	0x0f,
+	0xa5,
+	0xcf,
+	0xd0,
+	0x0b,
+	0xa5,
+	0xa0,
+	0xd0,
+	0x17,
+	0x53,
+	0x82,
+	0x00,
+	0x64,
+	0x00,
+	0x80,
+	0x09,
+	0xa5,
+	0xbf,
+	0xd0,
+	0x0c,
+	0x53,
+	0xa1,
+	0x00,
+	0x64,
+	0x00,
+	0x20,
+	0xf8,
+	0x04,
+	0x80,
+	0x02,
+	0xa9,
+	0x04,
+	0x8d,
+	0x08,
+	0x02,
+	0xa2,
+	0x28,
+	0xa8,
+	0xd0,
+	0x0a,
+	0xee,
+	0x31,
+	0x02,
+	0xd0,
+	0x03,
+	0xee,
+	0x32,
+	0x02,
+	0xa2,
+	0x20,
+	0x9e,
+	0x00,
+	0x1a,
+	0xfe,
+	0x00,
+	0x1a,
+	0x60,
+	0x8d,
+	0x50,
+	0x18,
+	0x8e,
+	0x50,
+	0x18,
+	0xd0,
+	0x01,
+	0xca,
+	0x3a,
+	0x99,
+	0x00,
+	0x18,
+	0x48,
+	0x8a,
+	0x99,
+	0x01,
+	0x18,
+	0x68,
+	0x0a,
+	0x1a,
+	0x8d,
+	0x50,
+	0x18,
+	0x8a,
+	0x2a,
+	0x8d,
+	0x50,
+	0x18,
+	0x60,
+	0xa0,
+	0x01,
+	0x8c,
+	0x04,
+	0x18,
+	0x8c,
+	0x10,
+	0x18,
+	0x53,
+	0x7d,
+	0x00,
+	0x78,
+	0x18,
+	0x53,
+	0x7c,
+	0x00,
+	0x7c,
+	0x18,
+	0x53,
+	0x7b,
+	0x00,
+	0x80,
+	0x18,
+	0x53,
+	0x7a,
+	0x00,
+	0x84,
+	0x18,
+	0x53,
+	0x7e,
+	0x00,
+	0x88,
+	0x18,
+	0x53,
+	0x7f,
+	0x00,
+	0x8c,
+	0x18,
+	0x53,
+	0x80,
+	0x00,
+	0x90,
+	0x18,
+	0xa5,
+	0x81,
+	0x8d,
+	0x94,
+	0x18,
+	0x8d,
+	0x14,
+	0x18,
+	0xc8,
+	0x53,
+	0x68,
+	0x00,
+	0x54,
+	0x18,
+	0x53,
+	0x6a,
+	0x00,
+	0x58,
+	0x18,
+	0x53,
+	0x6c,
+	0x00,
+	0x5c,
+	0x18,
+	0x53,
+	0x6e,
+	0x00,
+	0x60,
+	0x18,
+	0x53,
+	0x72,
+	0x00,
+	0x64,
+	0x18,
+	0x53,
+	0x70,
+	0x00,
+	0x68,
+	0x18,
+	0x53,
+	0x76,
+	0x00,
+	0x6c,
+	0x18,
+	0x53,
+	0x74,
+	0x00,
+	0x70,
+	0x18,
+	0x53,
+	0x78,
+	0x00,
+	0x74,
+	0x18,
+	0x9c,
+	0x3c,
+	0x18,
+	0x13,
+	0x3c,
+	0x18,
+	0x28,
+	0x18,
+	0x13,
+	0x3c,
+	0x18,
+	0x2c,
+	0x18,
+	0x9c,
+	0x30,
+	0x18,
+	0x9c,
+	0x20,
+	0x18,
+	0x9c,
+	0x24,
+	0x18,
+	0x9c,
+	0x0c,
+	0x18,
+	0x9c,
+	0x0d,
+	0x18,
+	0xa0,
+	0x18,
+	0xa6,
+	0x65,
+	0xa5,
+	0x64,
+	0x20,
+	0xda,
+	0x04,
+	0xa9,
+	0x04,
+	0x8d,
+	0x0c,
+	0x18,
+	0x9c,
+	0x0d,
+	0x18,
+	0xa0,
+	0x1c,
+	0xa6,
+	0x67,
+	0xa5,
+	0x66,
+	0x20,
+	0xda,
+	0x04,
+	0xa0,
+	0x03,
+	0x43,
+	0xaa,
+	0x0d,
+	0x38,
+	0x18,
+	0xa9,
+	0x00,
+	0x60,
+	0x20,
+	0xa5,
+	0x05,
+	0xe0,
+	0x00,
+	0xf0,
+	0x04,
+	0x1a,
+	0xd0,
+	0x01,
+	0xc8,
+	0x60,
+	0x85,
+	0xea,
+	0x45,
+	0xec,
+	0x84,
+	0xeb,
+	0xaa,
+	0xa5,
+	0xed,
+	0x45,
+	0xea,
+	0x18,
+	0x65,
+	0xeb,
+	0x90,
+	0x01,
+	0xc8,
+	0x60,
+	0x18,
+	0x65,
+	0xee,
+	0x85,
+	0xee,
+	0x98,
+	0x65,
+	0xef,
+	0x85,
+	0xef,
+	0x38,
+	0xa5,
+	0xee,
+	0xe9,
+	0xff,
+	0xa5,
+	0xef,
+	0xe9,
+	0x07,
+	0x90,
+	0x08,
+	0xa9,
+	0xff,
+	0x85,
+	0xee,
+	0xa9,
+	0x07,
+	0x85,
+	0xef,
+	0x60,
+	0x38,
+	0xa5,
+	0xee,
+	0xe5,
+	0xec,
+	0x85,
+	0xee,
+	0xa5,
+	0xef,
+	0xe5,
+	0xed,
+	0x85,
+	0xef,
+	0xb0,
+	0x04,
+	0x64,
+	0xee,
+	0x64,
+	0xef,
+	0x60,
+	0xa5,
+	0xee,
+	0x0a,
+	0x85,
+	0xec,
+	0xa5,
+	0xef,
+	0x2a,
+	0x85,
+	0xed,
+	0x60,
+	0x20,
+	0xe9,
+	0x05,
+	0xa5,
+	0xf2,
+	0xd0,
+	0x05,
+	0xa6,
+	0xf3,
+	0xd0,
+	0x0b,
+	0x60,
+	0x20,
+	0x99,
+	0x05,
+	0x85,
+	0xec,
+	0x84,
+	0xed,
+	0x4c,
+	0xd5,
+	0x05,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xec,
+	0x85,
+	0xec,
+	0xa9,
+	0x04,
+	0xe5,
+	0xed,
+	0x85,
+	0xed,
+	0x8a,
+	0x20,
+	0x99,
+	0x05,
+	0x4c,
+	0xb7,
+	0x05,
+	0x20,
+	0xe9,
+	0x05,
+	0xa6,
+	0xf2,
+	0xd0,
+	0x05,
+	0xa6,
+	0xf3,
+	0xd0,
+	0x15,
+	0x60,
+	0x38,
+	0xa9,
+	0xfe,
+	0xe5,
+	0xec,
+	0x85,
+	0xec,
+	0xa9,
+	0x0f,
+	0xe5,
+	0xed,
+	0x85,
+	0xed,
+	0x8a,
+	0x20,
+	0xa5,
+	0x05,
+	0x4c,
+	0xb7,
+	0x05,
+	0x38,
+	0xa5,
+	0xed,
+	0xe9,
+	0x04,
+	0x85,
+	0xed,
+	0x8a,
+	0x20,
+	0xa5,
+	0x05,
+	0x85,
+	0xec,
+	0x84,
+	0xed,
+	0x4c,
+	0xd5,
+	0x05,
+	0xa5,
+	0x2d,
+	0xd0,
+	0x02,
+	0xa9,
+	0x11,
+	0xaa,
+	0x49,
+	0x10,
+	0xc0,
+	0x05,
+	0x90,
+	0x03,
+	0xa9,
+	0x1c,
+	0x60,
+	0x84,
+	0xd2,
+	0x8a,
+	0x29,
+	0x0f,
+	0xc9,
+	0x05,
+	0xb0,
+	0xf4,
+	0x45,
+	0xd2,
+	0xaa,
+	0xbd,
+	0xc5,
+	0x0d,
+	0x85,
+	0xd2,
+	0x64,
+	0xe3,
+	0x38,
+	0xad,
+	0x2d,
+	0x0f,
+	0xe5,
+	0xd2,
+	0xb0,
+	0x02,
+	0xe6,
+	0xe3,
+	0x64,
+	0xc2,
+	0x64,
+	0xc3,
+	0xa0,
+	0x02,
+	0x53,
+	0x2e,
+	0x00,
+	0xc0,
+	0x00,
+	0x53,
+	0x34,
+	0x00,
+	0xd0,
+	0x00,
+	0x20,
+	0x58,
+	0x0b,
+	0xa5,
+	0xc4,
+	0x10,
+	0x0a,
+	0xe6,
+	0xc5,
+	0xd0,
+	0x06,
+	0xe6,
+	0xc6,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc7,
+	0xa5,
+	0xc7,
+	0xf0,
+	0x06,
+	0xa9,
+	0xff,
+	0x85,
+	0xc5,
+	0x85,
+	0xc6,
+	0xa0,
+	0x02,
+	0x53,
+	0xc5,
+	0x00,
+	0xcd,
+	0x00,
+	0x53,
+	0xcd,
+	0x00,
+	0xe8,
+	0x00,
+	0xa2,
+	0x2e,
+	0xa0,
+	0x0f,
+	0xa9,
+	0x04,
+	0x20,
+	0x3c,
+	0x0a,
+	0x84,
+	0xd3,
+	0xa5,
+	0xe3,
+	0x49,
+	0x24,
+	0x85,
+	0xc8,
+	0xa5,
+	0xd3,
+	0x49,
+	0x06,
+	0x18,
+	0x65,
+	0xc8,
+	0x85,
+	0xc8,
+	0xc0,
+	0x04,
+	0xf0,
+	0x10,
+	0x38,
+	0xb9,
+	0xfc,
+	0x0f,
+	0xe5,
+	0xcd,
+	0xc8,
+	0xb9,
+	0xfc,
+	0x0f,
+	0xc8,
+	0xe5,
+	0xce,
+	0x90,
+	0xed,
+	0x88,
+	0x98,
+	0x4a,
+	0xa8,
+	0xb9,
+	0x3e,
+	0x00,
+	0x85,
+	0xf2,
+	0xa9,
+	0x80,
+	0x38,
+	0xe5,
+	0xf2,
+	0x85,
+	0xf2,
+	0xb0,
+	0x0b,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xf2,
+	0x64,
+	0xf2,
+	0x85,
+	0xf3,
+	0x80,
+	0x02,
+	0x64,
+	0xf3,
+	0xa9,
+	0x0c,
+	0x85,
+	0xcc,
+	0xa4,
+	0xd3,
+	0xa2,
+	0x00,
+	0xb9,
+	0x2e,
+	0x0f,
+	0x95,
+	0xe6,
+	0xe8,
+	0xc8,
+	0xe0,
+	0x04,
+	0x90,
+	0xf5,
+	0x18,
+	0xa5,
+	0xc8,
+	0x69,
+	0x34,
+	0x85,
+	0xc8,
+	0xa9,
+	0x0f,
+	0x90,
+	0x01,
+	0x1a,
+	0x85,
+	0xc9,
+	0xa5,
+	0xe3,
+	0x49,
+	0x40,
+	0x85,
+	0xca,
+	0xa5,
+	0xd3,
+	0x49,
+	0x10,
+	0x18,
+	0x65,
+	0xca,
+	0x69,
+	0x7c,
+	0x85,
+	0xca,
+	0xa9,
+	0x0f,
+	0x90,
+	0x01,
+	0x1a,
+	0x85,
+	0xcb,
+	0x20,
+	0x88,
+	0x0a,
+	0x20,
+	0xf4,
+	0x05,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0x49,
+	0x00,
+	0x20,
+	0x88,
+	0x0a,
+	0x20,
+	0xf4,
+	0x05,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0x4b,
+	0x00,
+	0x20,
+	0x88,
+	0x0a,
+	0x20,
+	0x1e,
+	0x06,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0x4d,
+	0x00,
+	0x20,
+	0x88,
+	0x0a,
+	0x20,
+	0x1e,
+	0x06,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0x4f,
+	0x00,
+	0x20,
+	0x65,
+	0x0a,
+	0x85,
+	0x51,
+	0x64,
+	0x52,
+	0x20,
+	0x65,
+	0x0a,
+	0x85,
+	0x5f,
+	0x20,
+	0x65,
+	0x0a,
+	0x85,
+	0x60,
+	0x20,
+	0x65,
+	0x0a,
+	0x85,
+	0x61,
+	0xa5,
+	0x1b,
+	0x29,
+	0x10,
+	0xf0,
+	0x08,
+	0xa9,
+	0xff,
+	0x85,
+	0x51,
+	0xa9,
+	0x03,
+	0x85,
+	0x52,
+	0xa9,
+	0x00,
+	0x60,
+	0x18,
+	0xa5,
+	0xd4,
+	0x69,
+	0x0a,
+	0x80,
+	0x02,
+	0xa5,
+	0xd5,
+	0xaa,
+	0xa0,
+	0x00,
+	0xbd,
+	0xeb,
+	0x0d,
+	0x99,
+	0xe6,
+	0x00,
+	0xe8,
+	0xc8,
+	0xc0,
+	0x04,
+	0xd0,
+	0xf4,
+	0xa0,
+	0x02,
+	0x60,
+	0x65,
+	0xe2,
+	0x85,
+	0xe2,
+	0x98,
+	0x65,
+	0xde,
+	0x85,
+	0xde,
+	0x90,
+	0x07,
+	0xe6,
+	0xdf,
+	0x18,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe0,
+	0x60,
+	0x65,
+	0xde,
+	0x85,
+	0xde,
+	0x98,
+	0x65,
+	0xdf,
+	0x85,
+	0xdf,
+	0x90,
+	0x07,
+	0x18,
+	0xe6,
+	0xe0,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe1,
+	0x60,
+	0xa4,
+	0xe3,
+	0xf0,
+	0x03,
+	0x4c,
+	0x65,
+	0x0a,
+	0x4c,
+	0x88,
+	0x0a,
+	0xa9,
+	0x06,
+	0x85,
+	0xcc,
+	0x20,
+	0x94,
+	0x07,
+	0x53,
+	0x34,
+	0x00,
+	0xcd,
+	0x00,
+	0x53,
+	0xda,
+	0x00,
+	0xc8,
+	0x00,
+	0x53,
+	0xdc,
+	0x00,
+	0xca,
+	0x00,
+	0x20,
+	0xd5,
+	0x07,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0xf0,
+	0x00,
+	0x53,
+	0xc8,
+	0x00,
+	0xda,
+	0x00,
+	0x53,
+	0xca,
+	0x00,
+	0xdc,
+	0x00,
+	0x20,
+	0x94,
+	0x07,
+	0x53,
+	0xd6,
+	0x00,
+	0xc8,
+	0x00,
+	0x53,
+	0xd8,
+	0x00,
+	0xca,
+	0x00,
+	0x20,
+	0xd5,
+	0x07,
+	0xa0,
+	0x02,
+	0x53,
+	0xc8,
+	0x00,
+	0xd6,
+	0x00,
+	0x53,
+	0xca,
+	0x00,
+	0xd8,
+	0x00,
+	0x38,
+	0xa5,
+	0xee,
+	0xe5,
+	0xf0,
+	0xd0,
+	0x09,
+	0xa5,
+	0xef,
+	0xe5,
+	0xf1,
+	0xd0,
+	0x03,
+	0xa5,
+	0xee,
+	0x60,
+	0x20,
+	0x9b,
+	0x07,
+	0x38,
+	0xa5,
+	0xe8,
+	0xe5,
+	0xe6,
+	0x85,
+	0xd0,
+	0xa5,
+	0xe9,
+	0xe5,
+	0xe7,
+	0x85,
+	0xd1,
+	0x4a,
+	0x85,
+	0xeb,
+	0xa5,
+	0xd0,
+	0x6a,
+	0x85,
+	0xea,
+	0x38,
+	0xa5,
+	0xf0,
+	0xe5,
+	0xee,
+	0x85,
+	0xec,
+	0xa5,
+	0xf1,
+	0xe5,
+	0xef,
+	0x85,
+	0xed,
+	0x64,
+	0xe6,
+	0xb0,
+	0x17,
+	0xe6,
+	0xe6,
+	0xa5,
+	0xea,
+	0xe9,
+	0x00,
+	0xb0,
+	0x03,
+	0x38,
+	0xc6,
+	0xeb,
+	0xa9,
+	0x00,
+	0xe5,
+	0xec,
+	0x85,
+	0xec,
+	0xa9,
+	0x00,
+	0xe5,
+	0xed,
+	0x85,
+	0xed,
+	0x64,
+	0xe0,
+	0x64,
+	0xe1,
+	0xa5,
+	0xd5,
+	0x0a,
+	0xaa,
+	0xbd,
+	0xfb,
+	0x0d,
+	0x45,
+	0xed,
+	0x85,
+	0xe2,
+	0x84,
+	0xde,
+	0xbd,
+	0xfc,
+	0x0d,
+	0x45,
+	0xed,
+	0x18,
+	0x65,
+	0xde,
+	0x85,
+	0xde,
+	0x90,
+	0x02,
+	0xc8,
+	0x18,
+	0x84,
+	0xdf,
+	0xbd,
+	0xfc,
+	0x0d,
+	0x45,
+	0xec,
+	0x20,
+	0xaf,
+	0x07,
+	0xbd,
+	0xfd,
+	0x0d,
+	0x45,
+	0xeb,
+	0x20,
+	0xaf,
+	0x07,
+	0xbd,
+	0xfd,
+	0x0d,
+	0x45,
+	0xec,
+	0x65,
+	0xde,
+	0x85,
+	0xde,
+	0x98,
+	0x65,
+	0xdf,
+	0x85,
+	0xdf,
+	0x90,
+	0x07,
+	0xe6,
+	0xe0,
+	0x18,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe1,
+	0xbd,
+	0xfd,
+	0x0d,
+	0x45,
+	0xed,
+	0x65,
+	0xdf,
+	0x85,
+	0xdf,
+	0x98,
+	0x65,
+	0xe0,
+	0x85,
+	0xe0,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0xe1,
+	0xbd,
+	0xfe,
+	0x0d,
+	0x45,
+	0xea,
+	0x65,
+	0xe2,
+	0x98,
+	0xa0,
+	0x00,
+	0x20,
+	0xc2,
+	0x07,
+	0xbd,
+	0xfe,
+	0x0d,
+	0x45,
+	0xeb,
+	0x20,
+	0xc2,
+	0x07,
+	0xbd,
+	0xfe,
+	0x0d,
+	0x45,
+	0xec,
+	0x65,
+	0xdf,
+	0x85,
+	0xdf,
+	0x98,
+	0x65,
+	0xe0,
+	0x85,
+	0xe0,
+	0x90,
+	0x03,
+	0xe6,
+	0xe1,
+	0x18,
+	0xbd,
+	0xfe,
+	0x0d,
+	0x45,
+	0xed,
+	0x65,
+	0xe0,
+	0x85,
+	0xe0,
+	0x98,
+	0x65,
+	0xe1,
+	0x85,
+	0xe1,
+	0xa0,
+	0x04,
+	0x53,
+	0xde,
+	0x00,
+	0xc0,
+	0x00,
+	0xe6,
+	0xc0,
+	0xd0,
+	0x0a,
+	0xe6,
+	0xc1,
+	0xd0,
+	0x06,
+	0xe6,
+	0xc2,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc3,
+	0x20,
+	0x58,
+	0x0b,
+	0x38,
+	0xa2,
+	0x00,
+	0xa0,
+	0x04,
+	0xb5,
+	0xea,
+	0xf5,
+	0xc4,
+	0xe8,
+	0x88,
+	0xd0,
+	0xf8,
+	0xdc,
+	0x90,
+	0x08,
+	0x53,
+	0xc0,
+	0x00,
+	0xde,
+	0x00,
+	0x4c,
+	0x0d,
+	0x09,
+	0x53,
+	0xde,
+	0x00,
+	0xc0,
+	0x00,
+	0xa5,
+	0xe6,
+	0xf0,
+	0x17,
+	0xa2,
+	0x00,
+	0x38,
+	0x8a,
+	0xe5,
+	0xc0,
+	0x85,
+	0xc0,
+	0x8a,
+	0xe5,
+	0xc1,
+	0x85,
+	0xc1,
+	0x8a,
+	0xe5,
+	0xc2,
+	0x85,
+	0xc2,
+	0x8a,
+	0xe5,
+	0xc3,
+	0x85,
+	0xc3,
+	0x20,
+	0x9b,
+	0x07,
+	0x53,
+	0x2e,
+	0x00,
+	0xcd,
+	0x00,
+	0xa0,
+	0x04,
+	0x53,
+	0xee,
+	0x00,
+	0xea,
+	0x00,
+	0x20,
+	0xb1,
+	0x0a,
+	0xa5,
+	0xee,
+	0x60,
+	0xa5,
+	0x1b,
+	0x29,
+	0x08,
+	0xf0,
+	0x10,
+	0x64,
+	0xe5,
+	0xa0,
+	0x06,
+	0x13,
+	0xe5,
+	0x00,
+	0x59,
+	0x00,
+	0xa9,
+	0xf8,
+	0x85,
+	0x59,
+	0xa9,
+	0x00,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x2e,
+	0x00,
+	0xe8,
+	0x00,
+	0xa2,
+	0xeb,
+	0xa0,
+	0x0d,
+	0xa9,
+	0x08,
+	0x20,
+	0x3c,
+	0x0a,
+	0x84,
+	0xd5,
+	0xa0,
+	0x02,
+	0x53,
+	0x34,
+	0x00,
+	0xe8,
+	0x00,
+	0xa2,
+	0xf5,
+	0xa0,
+	0x0d,
+	0xa9,
+	0x04,
+	0x20,
+	0x3c,
+	0x0a,
+	0x84,
+	0xd4,
+	0xa5,
+	0xd5,
+	0x4a,
+	0x49,
+	0x12,
+	0x85,
+	0xd6,
+	0xa5,
+	0xd4,
+	0x49,
+	0x03,
+	0x65,
+	0xd6,
+	0x69,
+	0x0b,
+	0x85,
+	0xd6,
+	0x98,
+	0x69,
+	0x0e,
+	0x85,
+	0xd7,
+	0xa5,
+	0xd6,
+	0x69,
+	0x12,
+	0x85,
+	0xda,
+	0xa5,
+	0xd7,
+	0x69,
+	0x00,
+	0x85,
+	0xdb,
+	0xa5,
+	0xd5,
+	0x49,
+	0x14,
+	0x69,
+	0x65,
+	0x85,
+	0xd8,
+	0x98,
+	0x69,
+	0x0e,
+	0x85,
+	0xd9,
+	0x18,
+	0xa5,
+	0xd4,
+	0x49,
+	0x0a,
+	0x65,
+	0xd8,
+	0x85,
+	0xd8,
+	0x90,
+	0x03,
+	0xe6,
+	0xd9,
+	0x18,
+	0xa5,
+	0xd8,
+	0x69,
+	0x28,
+	0x85,
+	0xdc,
+	0xa5,
+	0xd9,
+	0x69,
+	0x00,
+	0x85,
+	0xdd,
+	0x64,
+	0xe3,
+	0x20,
+	0xdf,
+	0x07,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0x59,
+	0x00,
+	0xe6,
+	0xe3,
+	0xa2,
+	0x03,
+	0xda,
+	0x20,
+	0xdf,
+	0x07,
+	0xfa,
+	0x95,
+	0x5b,
+	0xca,
+	0x10,
+	0xf6,
+	0xa9,
+	0x00,
+	0x60,
+	0xa5,
+	0x1c,
+	0xd8,
+	0x4d,
+	0xde,
+	0x0d,
+	0x85,
+	0x62,
+	0xf8,
+	0x29,
+	0xfc,
+	0xf0,
+	0x03,
+	0xa9,
+	0x1d,
+	0x60,
+	0xa6,
+	0x27,
+	0xa5,
+	0x1b,
+	0x29,
+	0x20,
+	0xf0,
+	0x02,
+	0xa2,
+	0x01,
+	0x8a,
+	0x3a,
+	0x49,
+	0x03,
+	0x18,
+	0x69,
+	0xad,
+	0x85,
+	0xe6,
+	0x98,
+	0x69,
+	0x0d,
+	0x85,
+	0xe7,
+	0xa0,
+	0x06,
+	0xd3,
+	0xe6,
+	0x53,
+	0x00,
+	0xa9,
+	0x00,
+	0x60,
+	0x85,
+	0xea,
+	0x86,
+	0xe6,
+	0x84,
+	0xe7,
+	0xa0,
+	0x01,
+	0xc8,
+	0xc4,
+	0xea,
+	0xf0,
+	0x0d,
+	0x38,
+	0xb1,
+	0xe6,
+	0xe5,
+	0xe8,
+	0xc8,
+	0xb1,
+	0xe6,
+	0xe5,
+	0xe9,
+	0x90,
+	0xef,
+	0x88,
+	0x88,
+	0x88,
+	0x60,
+	0xa0,
+	0x04,
+	0xe6,
+	0xca,
+	0xd0,
+	0x02,
+	0xe6,
+	0xcb,
+	0x88,
+	0xd0,
+	0xf7,
+	0x60,
+	0xa0,
+	0x04,
+	0xd3,
+	0xca,
+	0xc0,
+	0x00,
+	0xb2,
+	0xc8,
+	0x85,
+	0xea,
+	0x64,
+	0xeb,
+	0xa4,
+	0xcc,
+	0xb1,
+	0xc8,
+	0x85,
+	0xec,
+	0x64,
+	0xed,
+	0x20,
+	0xb1,
+	0x0a,
+	0x20,
+	0x59,
+	0x0a,
+	0xe6,
+	0xc8,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc9,
+	0xa5,
+	0xee,
+	0x60,
+	0xa0,
+	0x04,
+	0xd3,
+	0xca,
+	0xc0,
+	0x00,
+	0xa0,
+	0x02,
+	0xd3,
+	0xc8,
+	0xea,
+	0x00,
+	0xa4,
+	0xcc,
+	0xb1,
+	0xc8,
+	0x85,
+	0xec,
+	0xc8,
+	0xb1,
+	0xc8,
+	0x85,
+	0xed,
+	0x20,
+	0xb1,
+	0x0a,
+	0x20,
+	0x59,
+	0x0a,
+	0xa0,
+	0x02,
+	0xe6,
+	0xc8,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc9,
+	0x88,
+	0xd0,
+	0xf7,
+	0x60,
+	0xa0,
+	0x02,
+	0x38,
+	0xa5,
+	0xcd,
+	0xe5,
+	0xe6,
+	0xa5,
+	0xce,
+	0xe5,
+	0xe7,
+	0xb0,
+	0x06,
+	0x53,
+	0xea,
+	0x00,
+	0xee,
+	0x00,
+	0x60,
+	0xa5,
+	0xe8,
+	0xe5,
+	0xcd,
+	0xa5,
+	0xe9,
+	0xe5,
+	0xce,
+	0xb0,
+	0x06,
+	0x53,
+	0xec,
+	0x00,
+	0xee,
+	0x00,
+	0x60,
+	0x38,
+	0xa5,
+	0xcd,
+	0xe5,
+	0xe6,
+	0x85,
+	0xd0,
+	0xa5,
+	0xce,
+	0xe5,
+	0xe7,
+	0x85,
+	0xd1,
+	0x20,
+	0x58,
+	0x0b,
+	0x18,
+	0xa9,
+	0x80,
+	0x65,
+	0xc5,
+	0x90,
+	0x06,
+	0xe6,
+	0xc6,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc7,
+	0x18,
+	0xa5,
+	0xea,
+	0x65,
+	0xc6,
+	0x85,
+	0xee,
+	0xa5,
+	0xeb,
+	0x65,
+	0xc7,
+	0x85,
+	0xef,
+	0x60,
+	0x88,
+	0xd0,
+	0x01,
+	0x60,
+	0x85,
+	0xe6,
+	0x86,
+	0xe7,
+	0x98,
+	0xc8,
+	0x18,
+	0x65,
+	0xe7,
+	0xaa,
+	0x90,
+	0x02,
+	0xe6,
+	0xe6,
+	0x98,
+	0xc9,
+	0x01,
+	0xf0,
+	0x0e,
+	0x29,
+	0x01,
+	0xd0,
+	0x0d,
+	0x46,
+	0xe6,
+	0x8a,
+	0x6a,
+	0xaa,
+	0x98,
+	0x4a,
+	0xa8,
+	0x80,
+	0xee,
+	0xa5,
+	0xe6,
+	0x60,
+	0x8a,
+	0x1a,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe6,
+	0x49,
+	0x55,
+	0x84,
+	0xe8,
+	0x18,
+	0x65,
+	0xe8,
+	0x85,
+	0xe7,
+	0x90,
+	0x03,
+	0xe6,
+	0xe8,
+	0x18,
+	0xa5,
+	0xe6,
+	0x49,
+	0x55,
+	0x84,
+	0xe9,
+	0xaa,
+	0x65,
+	0xe7,
+	0x8a,
+	0x65,
+	0xe8,
+	0x85,
+	0xe8,
+	0xa5,
+	0xe9,
+	0x90,
+	0x03,
+	0xe6,
+	0xe9,
+	0x18,
+	0x65,
+	0xe8,
+	0xaa,
+	0xa5,
+	0xe9,
+	0x69,
+	0x00,
+	0x60,
+	0x64,
+	0xc7,
+	0xa5,
+	0xd0,
+	0x45,
+	0xc0,
+	0x85,
+	0xc4,
+	0x84,
+	0xc5,
+	0x18,
+	0xa5,
+	0xd0,
+	0x45,
+	0xc1,
+	0x65,
+	0xc5,
+	0x85,
+	0xc5,
+	0x90,
+	0x05,
+	0xc8,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc7,
+	0x84,
+	0xc6,
+	0x18,
+	0xa5,
+	0xd1,
+	0x45,
+	0xc0,
+	0x65,
+	0xc5,
+	0x85,
+	0xc5,
+	0x98,
+	0x65,
+	0xc6,
+	0x85,
+	0xc6,
+	0x90,
+	0x03,
+	0xe6,
+	0xc7,
+	0x18,
+	0xa5,
+	0xd0,
+	0x45,
+	0xc2,
+	0x65,
+	0xc6,
+	0x85,
+	0xc6,
+	0x98,
+	0x65,
+	0xc7,
+	0x85,
+	0xc7,
+	0x18,
+	0xa5,
+	0xd1,
+	0x45,
+	0xc1,
+	0x65,
+	0xc6,
+	0x85,
+	0xc6,
+	0x98,
+	0x65,
+	0xc7,
+	0x85,
+	0xc7,
+	0x18,
+	0xa5,
+	0xd0,
+	0x45,
+	0xc3,
+	0x65,
+	0xc7,
+	0x85,
+	0xc7,
+	0x18,
+	0xa5,
+	0xd1,
+	0x45,
+	0xc2,
+	0x65,
+	0xc7,
+	0x85,
+	0xc7,
+	0x60,
+	0xa5,
+	0xe6,
+	0x45,
+	0xe8,
+	0x85,
+	0xea,
+	0x84,
+	0xeb,
+	0xa5,
+	0xe6,
+	0x45,
+	0xe9,
+	0x18,
+	0x65,
+	0xeb,
+	0x85,
+	0xeb,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xec,
+	0x64,
+	0xed,
+	0xa5,
+	0xe7,
+	0x45,
+	0xe8,
+	0x18,
+	0x65,
+	0xeb,
+	0x85,
+	0xeb,
+	0x98,
+	0x65,
+	0xec,
+	0x85,
+	0xec,
+	0x90,
+	0x02,
+	0xe6,
+	0xed,
+	0xa5,
+	0xe7,
+	0x45,
+	0xe9,
+	0x18,
+	0x65,
+	0xec,
+	0x85,
+	0xec,
+	0x98,
+	0x65,
+	0xed,
+	0x85,
+	0xed,
+	0xa5,
+	0xe9,
+	0x10,
+	0x0d,
+	0x38,
+	0xa5,
+	0xec,
+	0xe5,
+	0xe6,
+	0x85,
+	0xec,
+	0xa5,
+	0xed,
+	0xe5,
+	0xe7,
+	0x85,
+	0xed,
+	0x60,
+	0x18,
+	0xa5,
+	0xe8,
+	0x65,
+	0xea,
+	0x85,
+	0xea,
+	0xa2,
+	0x00,
+	0xa5,
+	0xe9,
+	0x10,
+	0x01,
+	0xca,
+	0x65,
+	0xeb,
+	0x85,
+	0xeb,
+	0x8a,
+	0x65,
+	0xec,
+	0x85,
+	0xec,
+	0x8a,
+	0x65,
+	0xed,
+	0x85,
+	0xed,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0xe5,
+	0x0d,
+	0xe8,
+	0x00,
+	0x20,
+	0xb5,
+	0x0b,
+	0xa0,
+	0x02,
+	0x53,
+	0xe9,
+	0x0d,
+	0xe8,
+	0x00,
+	0x20,
+	0xff,
+	0x0b,
+	0xa0,
+	0x04,
+	0x53,
+	0xea,
+	0x00,
+	0xee,
+	0x00,
+	0xa0,
+	0x02,
+	0x53,
+	0xe3,
+	0x0d,
+	0xe8,
+	0x00,
+	0x20,
+	0xb5,
+	0x0b,
+	0xa0,
+	0x02,
+	0x53,
+	0xe7,
+	0x0d,
+	0xe8,
+	0x00,
+	0x20,
+	0xff,
+	0x0b,
+	0xa5,
+	0xed,
+	0x10,
+	0x22,
+	0xa2,
+	0x00,
+	0xa9,
+	0x01,
+	0x4a,
+	0xa9,
+	0x00,
+	0xf5,
+	0xea,
+	0x95,
+	0xea,
+	0x2a,
+	0xe8,
+	0xe0,
+	0x04,
+	0x90,
+	0xf3,
+	0xa2,
+	0x00,
+	0xa9,
+	0x01,
+	0x4a,
+	0xa9,
+	0x00,
+	0xf5,
+	0xee,
+	0x95,
+	0xee,
+	0x2a,
+	0xe8,
+	0xe0,
+	0x04,
+	0x90,
+	0xf3,
+	0xa5,
+	0xed,
+	0x05,
+	0xf1,
+	0x30,
+	0x12,
+	0x06,
+	0xea,
+	0x26,
+	0xeb,
+	0x26,
+	0xec,
+	0x26,
+	0xed,
+	0x06,
+	0xee,
+	0x26,
+	0xef,
+	0x26,
+	0xf0,
+	0x26,
+	0xf1,
+	0x80,
+	0xe8,
+	0x64,
+	0xe6,
+	0x64,
+	0xe7,
+	0x64,
+	0xe8,
+	0x64,
+	0xe9,
+	0xa2,
+	0x20,
+	0x06,
+	0xea,
+	0x26,
+	0xeb,
+	0x26,
+	0xec,
+	0x26,
+	0xed,
+	0x26,
+	0xe6,
+	0x26,
+	0xe7,
+	0x26,
+	0xe8,
+	0x26,
+	0xe9,
+	0x38,
+	0xa5,
+	0xe6,
+	0xe5,
+	0xef,
+	0x85,
+	0xc0,
+	0xa5,
+	0xe7,
+	0xe5,
+	0xf0,
+	0x85,
+	0xc1,
+	0xa5,
+	0xe8,
+	0xe5,
+	0xf1,
+	0x85,
+	0xc2,
+	0xa5,
+	0xe9,
+	0xe9,
+	0x00,
+	0x85,
+	0xc3,
+	0x90,
+	0x0b,
+	0xe6,
+	0xea,
+	0x8a,
+	0xa0,
+	0x04,
+	0x53,
+	0xc0,
+	0x00,
+	0xe6,
+	0x00,
+	0xaa,
+	0xca,
+	0xd0,
+	0xc7,
+	0xa6,
+	0xea,
+	0xa4,
+	0xeb,
+	0xa5,
+	0xec,
+	0x05,
+	0xed,
+	0xf0,
+	0x03,
+	0xa2,
+	0xff,
+	0xdc,
+	0x86,
+	0xe6,
+	0x84,
+	0xe7,
+	0x60,
+	0xba,
+	0x08,
+	0x78,
+	0x68,
+	0x48,
+	0x29,
+	0x1c,
+	0x85,
+	0xfa,
+	0x86,
+	0xf8,
+	0xa9,
+	0x01,
+	0x85,
+	0xf9,
+	0xa0,
+	0x06,
+	0xb1,
+	0xf8,
+	0x48,
+	0x29,
+	0x1c,
+	0xc5,
+	0xfa,
+	0x90,
+	0x08,
+	0x7a,
+	0xa0,
+	0x09,
+	0xb1,
+	0xf8,
+	0x48,
+	0x29,
+	0x1c,
+	0xc9,
+	0x00,
+	0xd0,
+	0x38,
+	0xa0,
+	0x03,
+	0xb1,
+	0xf8,
+	0xe0,
+	0xdf,
+	0xb0,
+	0x18,
+	0x8d,
+	0x6b,
+	0x01,
+	0xc8,
+	0xb1,
+	0xf8,
+	0x8d,
+	0x6c,
+	0x01,
+	0xc8,
+	0xb1,
+	0xf8,
+	0x8d,
+	0x6d,
+	0x01,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0x6e,
+	0x01,
+	0x80,
+	0x16,
+	0x8d,
+	0x6f,
+	0x01,
+	0xc8,
+	0xb1,
+	0xf8,
+	0x8d,
+	0x70,
+	0x01,
+	0xc8,
+	0xb1,
+	0xf8,
+	0x8d,
+	0x71,
+	0x01,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0x72,
+	0x01,
+	0xa9,
+	0x00,
+	0xfa,
+	0x28,
+	0xf8,
+	0x60,
+	0x68,
+	0xf0,
+	0x04,
+	0x68,
+	0xfa,
+	0x7a,
+	0x40,
+	0x08,
+	0x78,
+	0x68,
+	0xad,
+	0x6a,
+	0x01,
+	0xf0,
+	0x0e,
+	0xae,
+	0x6e,
+	0x01,
+	0x9a,
+	0xad,
+	0x6b,
+	0x01,
+	0xae,
+	0x6c,
+	0x01,
+	0xac,
+	0x6d,
+	0x01,
+	0x40,
+	0xae,
+	0x72,
+	0x01,
+	0x9a,
+	0xad,
+	0x6f,
+	0x01,
+	0xae,
+	0x70,
+	0x01,
+	0xac,
+	0x71,
+	0x01,
+	0x40,
+	0x08,
+	0x78,
+	0xad,
+	0x6a,
+	0x01,
+	0xd0,
+	0x1f,
+	0x1a,
+	0x8d,
+	0x6a,
+	0x01,
+	0xa9,
+	0xdc,
+	0x8d,
+	0x6e,
+	0x01,
+	0x9c,
+	0x6b,
+	0x01,
+	0x9c,
+	0x6c,
+	0x01,
+	0x9c,
+	0x6d,
+	0x01,
+	0xa9,
+	0x03,
+	0x8d,
+	0xdf,
+	0x01,
+	0xa9,
+	0x6f,
+	0x8d,
+	0xde,
+	0x01,
+	0x9c,
+	0xdd,
+	0x01,
+	0x28,
+	0x60,
+	0xa9,
+	0x02,
+	0x60,
+	0x04,
+	0xdc,
+	0x02,
+	0xfd,
+	0x02,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x0d,
+	0x03,
+	0x07,
+	0x01,
+	0x5b,
+	0xe6,
+	0x80,
+	0x80,
+	0x80,
+	0xff,
+	0xff,
+	0x02,
+	0x01,
+	0x05,
+	0x00,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x03,
+	0x70,
+	0x00,
+	0x10,
+	0x00,
+	0xc7,
+	0x02,
+	0x8e,
+	0x00,
+	0x1c,
+	0x00,
+	0xa4,
+	0x02,
+	0x9c,
+	0x00,
+	0x24,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x03,
+	0x03,
+	0x03,
+	0x03,
+	0x03,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+
+};
+
+uint8_t pdpclib_u[] =
+{
+	0x02,
+	0x00,
+	0x01,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0x00,
+	0x20,
+	0x00,
+	0x00,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x80,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0xff,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0xff,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0xff,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0xff,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0xff,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x00,
+	0x12,
+	0xfe,
+	0xff,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x12,
+	0xfe,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x12,
+	0xfe,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x12,
+	0xfe,
+	0xff,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x12,
+	0xfe,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x04,
+	0x08,
+	0x0c,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x0a,
+	0x10,
+	0x17,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x0e,
+	0x17,
+	0x21,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x02,
+	0x04,
+	0x06,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x05,
+	0x08,
+	0x0b,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x07,
+	0x0c,
+	0x11,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x55,
+	0x01,
+	0x00,
+	0x00,
+	0xd5,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0xe0,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x01,
+	0x00,
+	0x00,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0xab,
+	0x00,
+	0x00,
+	0x00,
+	0xd5,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0xc0,
+	0x00,
+	0x00,
+	0x00,
+	0xff,
+	0x01,
+	0xff,
+	0x05,
+
+};
+
+uint8_t dppcode_u[] =
+{
+	0x78,
+	0xb8,
+	0x18,
+	0xf8,
+	0x9c,
+	0x00,
+	0x02,
+	0xa0,
+	0x36,
+	0x13,
+	0x00,
+	0x02,
+	0x01,
+	0x02,
+	0xa9,
+	0x07,
+	0x8d,
+	0x00,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x01,
+	0x02,
+	0xa9,
+	0xe8,
+	0x8d,
+	0x02,
+	0x02,
+	0xa9,
+	0xeb,
+	0x8d,
+	0x03,
+	0x02,
+	0xa2,
+	0xff,
+	0x8e,
+	0x32,
+	0x02,
+	0x8e,
+	0x1d,
+	0x6b,
+	0xa2,
+	0xff,
+	0x8e,
+	0x33,
+	0x02,
+	0x8e,
+	0x1e,
+	0x6b,
+	0xa0,
+	0x03,
+	0x53,
+	0x27,
+	0xbe,
+	0x04,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x07,
+	0x02,
+	0xcd,
+	0x29,
+	0xbe,
+	0xf0,
+	0x04,
+	0xa2,
+	0x02,
+	0x80,
+	0x10,
+	0xa2,
+	0x01,
+	0xad,
+	0x00,
+	0xc0,
+	0xc9,
+	0xe8,
+	0xd0,
+	0x07,
+	0xad,
+	0x01,
+	0xc0,
+	0xc9,
+	0xeb,
+	0xf0,
+	0x0e,
+	0x8e,
+	0x08,
+	0x02,
+	0xa9,
+	0x01,
+	0x9c,
+	0x14,
+	0xd0,
+	0x8d,
+	0x14,
+	0xd0,
+	0x5c,
+	0x80,
+	0xfd,
+	0x9c,
+	0x08,
+	0x02,
+	0xa0,
+	0x0e,
+	0x53,
+	0x80,
+	0x3f,
+	0x02,
+	0x00,
+	0x9c,
+	0x14,
+	0xd0,
+	0x9c,
+	0x18,
+	0xd0,
+	0x9c,
+	0x1c,
+	0xd0,
+	0x9c,
+	0x20,
+	0xd0,
+	0x9c,
+	0x24,
+	0xd0,
+	0x9c,
+	0x28,
+	0xd0,
+	0xa2,
+	0xff,
+	0x9a,
+	0x20,
+	0x90,
+	0x03,
+	0x58,
+	0xa9,
+	0x01,
+	0x8d,
+	0x14,
+	0xd0,
+	0x4c,
+	0xf8,
+	0x0d,
+	0x9c,
+	0xde,
+	0x5e,
+	0xa9,
+	0x01,
+	0x8d,
+	0xdf,
+	0x5e,
+	0x9c,
+	0x81,
+	0x82,
+	0x9c,
+	0x21,
+	0x5f,
+	0x9c,
+	0x22,
+	0x5f,
+	0x9c,
+	0x23,
+	0x5f,
+	0x9c,
+	0x24,
+	0x5f,
+	0x9c,
+	0x2b,
+	0x5f,
+	0x9c,
+	0x2c,
+	0x5f,
+	0xa0,
+	0x03,
+	0x13,
+	0x81,
+	0x82,
+	0x18,
+	0x5f,
+	0x13,
+	0x81,
+	0x82,
+	0x1b,
+	0x5f,
+	0x20,
+	0xc6,
+	0x03,
+	0x20,
+	0x83,
+	0x1a,
+	0x20,
+	0xc0,
+	0x1a,
+	0x9c,
+	0x75,
+	0x60,
+	0x60,
+	0x9c,
+	0x65,
+	0x5e,
+	0x9c,
+	0x64,
+	0x5e,
+	0x9c,
+	0x66,
+	0x5e,
+	0x9c,
+	0x67,
+	0x5e,
+	0x9c,
+	0x68,
+	0x5e,
+	0x60,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xa9,
+	0x3e,
+	0x48,
+	0xad,
+	0x08,
+	0xd0,
+	0xc9,
+	0x01,
+	0xd0,
+	0x51,
+	0x08,
+	0x78,
+	0xad,
+	0x64,
+	0x5e,
+	0xc9,
+	0x02,
+	0xb0,
+	0x03,
+	0xee,
+	0x64,
+	0x5e,
+	0xee,
+	0x66,
+	0x5e,
+	0xd0,
+	0x08,
+	0xee,
+	0x67,
+	0x5e,
+	0xd0,
+	0x03,
+	0xee,
+	0x68,
+	0x5e,
+	0xa0,
+	0x37,
+	0xad,
+	0x65,
+	0x5e,
+	0x1a,
+	0x29,
+	0x01,
+	0x8d,
+	0x65,
+	0x5e,
+	0xf0,
+	0x0e,
+	0x53,
+	0x00,
+	0x02,
+	0xa0,
+	0x5e,
+	0xa0,
+	0x03,
+	0x53,
+	0x66,
+	0x5e,
+	0xda,
+	0x5e,
+	0x80,
+	0x0c,
+	0x53,
+	0x00,
+	0x02,
+	0x69,
+	0x5e,
+	0xa0,
+	0x03,
+	0x53,
+	0x66,
+	0x5e,
+	0xd7,
+	0x5e,
+	0xad,
+	0x75,
+	0x60,
+	0xd0,
+	0x03,
+	0x20,
+	0x36,
+	0x3f,
+	0x28,
+	0xa9,
+	0x01,
+	0x9c,
+	0x18,
+	0xd0,
+	0x8d,
+	0x18,
+	0xd0,
+	0x4c,
+	0x0b,
+	0x3f,
+	0x8a,
+	0xf0,
+	0x0c,
+	0xa9,
+	0x40,
+	0x8d,
+	0x30,
+	0xc0,
+	0xa9,
+	0x08,
+	0x8d,
+	0x31,
+	0xc0,
+	0x80,
+	0x06,
+	0x9c,
+	0x30,
+	0xc0,
+	0x9c,
+	0x31,
+	0xc0,
+	0xbd,
+	0x2d,
+	0x5f,
+	0x85,
+	0xa9,
+	0x8d,
+	0x78,
+	0xc0,
+	0xbd,
+	0x2f,
+	0x5f,
+	0x8d,
+	0x17,
+	0x6b,
+	0xbd,
+	0x31,
+	0x5f,
+	0x8d,
+	0x68,
+	0xc0,
+	0xbd,
+	0x33,
+	0x5f,
+	0x8d,
+	0x69,
+	0xc0,
+	0xbd,
+	0x35,
+	0x5f,
+	0x0a,
+	0xa8,
+	0xb9,
+	0x9c,
+	0x6a,
+	0x85,
+	0xc0,
+	0xb9,
+	0x9d,
+	0x6a,
+	0x85,
+	0xc1,
+	0xb9,
+	0xf4,
+	0x6a,
+	0x8d,
+	0x58,
+	0xc0,
+	0xb9,
+	0xf5,
+	0x6a,
+	0x8d,
+	0x59,
+	0xc0,
+	0xb9,
+	0x04,
+	0x6b,
+	0x8d,
+	0x60,
+	0xc0,
+	0xb9,
+	0x05,
+	0x6b,
+	0x8d,
+	0x61,
+	0xc0,
+	0xbd,
+	0x37,
+	0x5f,
+	0x0a,
+	0xa8,
+	0xb9,
+	0xa4,
+	0x6a,
+	0x85,
+	0xc2,
+	0xb9,
+	0xa5,
+	0x6a,
+	0x85,
+	0xc3,
+	0xb9,
+	0xfc,
+	0x6a,
+	0x8d,
+	0x5c,
+	0xc0,
+	0xb9,
+	0xfd,
+	0x6a,
+	0x8d,
+	0x5d,
+	0xc0,
+	0xb9,
+	0x0c,
+	0x6b,
+	0x8d,
+	0x64,
+	0xc0,
+	0xb9,
+	0x0d,
+	0x6b,
+	0x8d,
+	0x65,
+	0xc0,
+	0xbd,
+	0x39,
+	0x5f,
+	0x8d,
+	0x14,
+	0xc0,
+	0xbd,
+	0x3b,
+	0x5f,
+	0x8d,
+	0x18,
+	0xc0,
+	0xbd,
+	0x3d,
+	0x5f,
+	0x8d,
+	0x19,
+	0xc0,
+	0xa9,
+	0x00,
+	0x8d,
+	0x0c,
+	0xc0,
+	0xa9,
+	0x00,
+	0x8d,
+	0x0d,
+	0xc0,
+	0xda,
+	0xe0,
+	0x00,
+	0xd0,
+	0x12,
+	0xac,
+	0x6f,
+	0x60,
+	0x43,
+	0x97,
+	0x5f,
+	0x54,
+	0xc0,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x27,
+	0x60,
+	0x79,
+	0x6a,
+	0x80,
+	0x10,
+	0xac,
+	0x70,
+	0x60,
+	0x43,
+	0xbf,
+	0x5f,
+	0x54,
+	0xc0,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x3b,
+	0x60,
+	0x79,
+	0x6a,
+	0xfa,
+	0xbd,
+	0x6b,
+	0x5f,
+	0x8d,
+	0x28,
+	0xc0,
+	0xbd,
+	0x3f,
+	0x5f,
+	0x8d,
+	0x1c,
+	0xc0,
+	0xbd,
+	0x41,
+	0x5f,
+	0x8d,
+	0x1d,
+	0xc0,
+	0xa9,
+	0x50,
+	0x8d,
+	0x0c,
+	0xc0,
+	0xa9,
+	0x00,
+	0x8d,
+	0x0d,
+	0xc0,
+	0xda,
+	0xe0,
+	0x00,
+	0xd0,
+	0x12,
+	0xac,
+	0x71,
+	0x60,
+	0x43,
+	0xe7,
+	0x5f,
+	0x54,
+	0xc0,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x4f,
+	0x60,
+	0x8d,
+	0x6a,
+	0x80,
+	0x10,
+	0xac,
+	0x72,
+	0x60,
+	0x43,
+	0x07,
+	0x60,
+	0x54,
+	0xc0,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x5f,
+	0x60,
+	0x8d,
+	0x6a,
+	0xfa,
+	0xbd,
+	0x6d,
+	0x5f,
+	0x8d,
+	0x2c,
+	0xc0,
+	0xbd,
+	0x47,
+	0x5f,
+	0x85,
+	0xb4,
+	0xbd,
+	0x49,
+	0x5f,
+	0x85,
+	0xb5,
+	0xbd,
+	0x4b,
+	0x5f,
+	0x85,
+	0xbe,
+	0xbd,
+	0x4d,
+	0x5f,
+	0x85,
+	0xbf,
+	0xbd,
+	0x4f,
+	0x5f,
+	0x85,
+	0xaa,
+	0xbd,
+	0x51,
+	0x5f,
+	0x85,
+	0xb9,
+	0xbd,
+	0x53,
+	0x5f,
+	0x85,
+	0xb6,
+	0xbd,
+	0x55,
+	0x5f,
+	0x85,
+	0xbd,
+	0xbd,
+	0x57,
+	0x5f,
+	0x85,
+	0xb7,
+	0xbd,
+	0x59,
+	0x5f,
+	0x85,
+	0xb8,
+	0xbd,
+	0x5b,
+	0x5f,
+	0x85,
+	0xac,
+	0xbd,
+	0x5d,
+	0x5f,
+	0x85,
+	0xad,
+	0xbd,
+	0x5f,
+	0x5f,
+	0x85,
+	0xb2,
+	0xbd,
+	0x61,
+	0x5f,
+	0x85,
+	0xb3,
+	0xbd,
+	0x63,
+	0x5f,
+	0x85,
+	0xae,
+	0xbd,
+	0x65,
+	0x5f,
+	0x85,
+	0xaf,
+	0xbd,
+	0x67,
+	0x5f,
+	0x85,
+	0xb0,
+	0xbd,
+	0x69,
+	0x5f,
+	0x85,
+	0xb1,
+	0xda,
+	0xbd,
+	0x29,
+	0x5f,
+	0x8d,
+	0x76,
+	0x60,
+	0xf0,
+	0x3c,
+	0xbd,
+	0x73,
+	0x60,
+	0x85,
+	0x12,
+	0xbd,
+	0x27,
+	0x5f,
+	0xa2,
+	0x00,
+	0xa8,
+	0xd0,
+	0x04,
+	0xa5,
+	0x25,
+	0xd0,
+	0x29,
+	0xc0,
+	0x00,
+	0xf0,
+	0x0a,
+	0x20,
+	0x5e,
+	0x3f,
+	0xa0,
+	0x06,
+	0x53,
+	0x4c,
+	0x5c,
+	0x79,
+	0x6b,
+	0xa0,
+	0x01,
+	0x84,
+	0x25,
+	0xa0,
+	0x02,
+	0x53,
+	0x32,
+	0x02,
+	0x1b,
+	0x6b,
+	0x20,
+	0x9f,
+	0x3b,
+	0x64,
+	0x24,
+	0xa5,
+	0xbd,
+	0x85,
+	0x23,
+	0xa5,
+	0x12,
+	0x8d,
+	0x19,
+	0x6b,
+	0xa2,
+	0x01,
+	0x86,
+	0xa8,
+	0xfa,
+	0x08,
+	0x78,
+	0x68,
+	0xa9,
+	0x02,
+	0x8d,
+	0x38,
+	0xc0,
+	0xa9,
+	0x01,
+	0x8d,
+	0x38,
+	0xc0,
+	0xa9,
+	0x09,
+	0x8d,
+	0x38,
+	0xc0,
+	0xbd,
+	0x43,
+	0x5f,
+	0xf0,
+	0x0a,
+	0xa9,
+	0x05,
+	0x8d,
+	0x38,
+	0xc0,
+	0xa9,
+	0x0d,
+	0x8d,
+	0x38,
+	0xc0,
+	0xbd,
+	0x45,
+	0x5f,
+	0x85,
+	0xab,
+	0x85,
+	0xba,
+	0x60,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xa9,
+	0x3e,
+	0x48,
+	0xad,
+	0x0c,
+	0xd0,
+	0xc9,
+	0x01,
+	0xf0,
+	0x05,
+	0xa9,
+	0x05,
+	0x4c,
+	0x82,
+	0x06,
+	0x08,
+	0x78,
+	0xad,
+	0xde,
+	0x5e,
+	0xf0,
+	0x59,
+	0x8d,
+	0x63,
+	0x5e,
+	0xc9,
+	0x02,
+	0xf0,
+	0x0d,
+	0xa2,
+	0x00,
+	0xad,
+	0x21,
+	0x5f,
+	0x0d,
+	0x23,
+	0x5f,
+	0xd0,
+	0x1b,
+	0xe8,
+	0x80,
+	0x18,
+	0x38,
+	0xad,
+	0x1b,
+	0x5f,
+	0xed,
+	0x18,
+	0x5f,
+	0xad,
+	0x1c,
+	0x5f,
+	0xed,
+	0x19,
+	0x5f,
+	0xad,
+	0x1d,
+	0x5f,
+	0xed,
+	0x1a,
+	0x5f,
+	0xa2,
+	0x01,
+	0xb0,
+	0x01,
+	0xca,
+	0xad,
+	0x09,
+	0x02,
+	0xdd,
+	0x21,
+	0x5f,
+	0xd0,
+	0x0d,
+	0xad,
+	0x0a,
+	0x02,
+	0xdd,
+	0x23,
+	0x5f,
+	0xd0,
+	0x05,
+	0xbd,
+	0x25,
+	0x5f,
+	0x80,
+	0x1a,
+	0xce,
+	0x63,
+	0x5e,
+	0xf0,
+	0x0f,
+	0xca,
+	0xf0,
+	0xe3,
+	0xa2,
+	0x01,
+	0x80,
+	0xdf,
+	0xad,
+	0xe0,
+	0x5e,
+	0x9c,
+	0xe0,
+	0x5e,
+	0xd0,
+	0x06,
+	0xa9,
+	0x04,
+	0x80,
+	0x02,
+	0xa9,
+	0x03,
+	0x28,
+	0x8d,
+	0x08,
+	0x02,
+	0xc9,
+	0x00,
+	0xf0,
+	0x0a,
+	0xa0,
+	0x01,
+	0x9c,
+	0x28,
+	0xd0,
+	0x8c,
+	0x28,
+	0xd0,
+	0x80,
+	0x27,
+	0x20,
+	0x38,
+	0x04,
+	0xee,
+	0x32,
+	0x02,
+	0xd0,
+	0x03,
+	0xee,
+	0x33,
+	0x02,
+	0x9c,
+	0x81,
+	0x82,
+	0xa9,
+	0x01,
+	0x8d,
+	0x75,
+	0x60,
+	0x8d,
+	0xdf,
+	0x5e,
+	0x9c,
+	0x2b,
+	0x5f,
+	0x9c,
+	0x2c,
+	0x5f,
+	0x9c,
+	0xde,
+	0x5e,
+	0xa0,
+	0x01,
+	0x9c,
+	0x20,
+	0xd0,
+	0x8c,
+	0x20,
+	0xd0,
+	0x4c,
+	0x0b,
+	0x3f,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xa9,
+	0x3e,
+	0x48,
+	0x08,
+	0x78,
+	0x68,
+	0xa5,
+	0x25,
+	0xc9,
+	0x03,
+	0xf0,
+	0x05,
+	0x64,
+	0x25,
+	0x20,
+	0x5e,
+	0x3f,
+	0xa9,
+	0x01,
+	0x9c,
+	0x24,
+	0xd0,
+	0x8d,
+	0x24,
+	0xd0,
+	0x9c,
+	0x75,
+	0x60,
+	0x20,
+	0x36,
+	0x3f,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0xc0,
+	0x4c,
+	0x12,
+	0x3f,
+	0xa9,
+	0x01,
+	0xcc,
+	0x2b,
+	0xbe,
+	0x90,
+	0x08,
+	0xd0,
+	0x05,
+	0xec,
+	0x2a,
+	0xbe,
+	0x90,
+	0x01,
+	0x1a,
+	0x3a,
+	0x60,
+	0xa9,
+	0x01,
+	0xcc,
+	0x2d,
+	0xbe,
+	0x90,
+	0x08,
+	0xd0,
+	0x05,
+	0xec,
+	0x2c,
+	0xbe,
+	0x90,
+	0x01,
+	0x1a,
+	0x3a,
+	0x60,
+	0xa5,
+	0x22,
+	0xf0,
+	0x38,
+	0xa9,
+	0x4a,
+	0x85,
+	0x16,
+	0xa9,
+	0x70,
+	0x85,
+	0x17,
+	0xa9,
+	0x1b,
+	0x85,
+	0x18,
+	0xa9,
+	0x6c,
+	0x85,
+	0x19,
+	0xa0,
+	0x00,
+	0xa9,
+	0x04,
+	0xf3,
+	0x16,
+	0x18,
+	0xe6,
+	0x17,
+	0xe6,
+	0x19,
+	0x3a,
+	0xd0,
+	0xf6,
+	0xa0,
+	0x2f,
+	0xf3,
+	0x16,
+	0x18,
+	0xa0,
+	0x06,
+	0x53,
+	0x7f,
+	0x6b,
+	0x79,
+	0x6b,
+	0xa0,
+	0x02,
+	0x53,
+	0x34,
+	0x02,
+	0x1d,
+	0x6b,
+	0x53,
+	0x1b,
+	0x6b,
+	0x34,
+	0x02,
+	0x64,
+	0x22,
+	0xf8,
+	0x08,
+	0x78,
+	0xad,
+	0x64,
+	0x5e,
+	0xd0,
+	0x03,
+	0x4c,
+	0x7f,
+	0x08,
+	0xa0,
+	0x03,
+	0x53,
+	0x66,
+	0x5e,
+	0x1e,
+	0x5f,
+	0xad,
+	0x65,
+	0x5e,
+	0x8d,
+	0xdd,
+	0x5e,
+	0xaa,
+	0xd0,
+	0x39,
+	0xbd,
+	0x2b,
+	0x5f,
+	0xf0,
+	0x1e,
+	0xad,
+	0xd7,
+	0x5e,
+	0xcd,
+	0x18,
+	0x5f,
+	0xd0,
+	0x16,
+	0xad,
+	0xd8,
+	0x5e,
+	0xcd,
+	0x19,
+	0x5f,
+	0xd0,
+	0x0e,
+	0xad,
+	0xd9,
+	0x5e,
+	0xcd,
+	0x1a,
+	0x5f,
+	0xd0,
+	0x06,
+	0xac,
+	0xdd,
+	0x5e,
+	0x4c,
+	0x6d,
+	0x08,
+	0x9c,
+	0x30,
+	0xc0,
+	0x9c,
+	0x31,
+	0xc0,
+	0xa0,
+	0x37,
+	0x53,
+	0x69,
+	0x5e,
+	0xe1,
+	0x5e,
+	0xa0,
+	0x03,
+	0x53,
+	0xd7,
+	0x5e,
+	0x18,
+	0x5f,
+	0x80,
+	0x3b,
+	0xbd,
+	0x2b,
+	0x5f,
+	0xf0,
+	0x1e,
+	0xad,
+	0xda,
+	0x5e,
+	0xcd,
+	0x1b,
+	0x5f,
+	0xd0,
+	0x16,
+	0xad,
+	0xdb,
+	0x5e,
+	0xcd,
+	0x1c,
+	0x5f,
+	0xd0,
+	0x0e,
+	0xad,
+	0xdc,
+	0x5e,
+	0xcd,
+	0x1d,
+	0x5f,
+	0xd0,
+	0x06,
+	0xac,
+	0xdd,
+	0x5e,
+	0x4c,
+	0x6d,
+	0x08,
+	0xa9,
+	0x40,
+	0x8d,
+	0x30,
+	0xc0,
+	0xa9,
+	0x08,
+	0x8d,
+	0x31,
+	0xc0,
+	0xa0,
+	0x37,
+	0x53,
+	0xa0,
+	0x5e,
+	0xe1,
+	0x5e,
+	0xa0,
+	0x03,
+	0x53,
+	0xda,
+	0x5e,
+	0x1b,
+	0x5f,
+	0xae,
+	0xdd,
+	0x5e,
+	0xa9,
+	0x00,
+	0x9d,
+	0x21,
+	0x5f,
+	0x9d,
+	0x23,
+	0x5f,
+	0x9d,
+	0x3d,
+	0x5f,
+	0x9d,
+	0x3b,
+	0x5f,
+	0xad,
+	0xde,
+	0x5e,
+	0xc9,
+	0x02,
+	0xd0,
+	0x04,
+	0x3a,
+	0x8d,
+	0xde,
+	0x5e,
+	0x28,
+	0xad,
+	0xdf,
+	0x5e,
+	0xf0,
+	0x2b,
+	0x9c,
+	0xdf,
+	0x5e,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0xc0,
+	0xa9,
+	0x01,
+	0x8d,
+	0x10,
+	0xc0,
+	0x9c,
+	0x3c,
+	0xc0,
+	0xad,
+	0x37,
+	0xbe,
+	0xae,
+	0x38,
+	0xbe,
+	0x8d,
+	0x70,
+	0xc0,
+	0x8e,
+	0x6c,
+	0xc0,
+	0x9c,
+	0x29,
+	0xc0,
+	0x9c,
+	0x2d,
+	0xc0,
+	0x9c,
+	0x74,
+	0xc0,
+	0x9c,
+	0x20,
+	0xc0,
+	0x9c,
+	0x24,
+	0xc0,
+	0xad,
+	0xdd,
+	0x5e,
+	0x20,
+	0x9e,
+	0x08,
+	0x08,
+	0x78,
+	0xac,
+	0xdd,
+	0x5e,
+	0x99,
+	0x25,
+	0x5f,
+	0x8d,
+	0xe0,
+	0x5e,
+	0xb9,
+	0x3d,
+	0x5f,
+	0xaa,
+	0xb9,
+	0x3b,
+	0x5f,
+	0x1a,
+	0xd0,
+	0x01,
+	0xe8,
+	0x0a,
+	0x99,
+	0x21,
+	0x5f,
+	0x8a,
+	0x2a,
+	0x99,
+	0x23,
+	0x5f,
+	0xa9,
+	0x01,
+	0x9c,
+	0x1c,
+	0xd0,
+	0x8d,
+	0x1c,
+	0xd0,
+	0xee,
+	0xde,
+	0x5e,
+	0xad,
+	0x66,
+	0x5e,
+	0xcd,
+	0x1e,
+	0x5f,
+	0xd0,
+	0x10,
+	0xad,
+	0x67,
+	0x5e,
+	0xcd,
+	0x1f,
+	0x5f,
+	0xd0,
+	0x08,
+	0xad,
+	0x68,
+	0x5e,
+	0xcd,
+	0x20,
+	0x5f,
+	0xf0,
+	0x03,
+	0x4c,
+	0x51,
+	0x07,
+	0xad,
+	0x64,
+	0x5e,
+	0x3a,
+	0xf0,
+	0x0c,
+	0xcc,
+	0x65,
+	0x5e,
+	0xd0,
+	0x07,
+	0x98,
+	0x1a,
+	0x29,
+	0x01,
+	0x4c,
+	0x5b,
+	0x07,
+	0x9c,
+	0x81,
+	0x82,
+	0xad,
+	0x17,
+	0x5f,
+	0xf0,
+	0x14,
+	0xac,
+	0xdd,
+	0x5e,
+	0xb9,
+	0x23,
+	0x5f,
+	0x8d,
+	0x0a,
+	0x02,
+	0xb9,
+	0x21,
+	0x5f,
+	0x8d,
+	0x09,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x0c,
+	0xd0,
+	0x4c,
+	0x28,
+	0x3f,
+	0xaa,
+	0x85,
+	0x1f,
+	0xad,
+	0xed,
+	0x5e,
+	0xa8,
+	0x29,
+	0x01,
+	0x85,
+	0xb6,
+	0x9d,
+	0x53,
+	0x5f,
+	0x98,
+	0x4a,
+	0x29,
+	0x01,
+	0x85,
+	0xbd,
+	0x9d,
+	0x55,
+	0x5f,
+	0x98,
+	0x29,
+	0x03,
+	0xd8,
+	0x4d,
+	0x2e,
+	0xbe,
+	0xf8,
+	0x9d,
+	0x39,
+	0x5f,
+	0xad,
+	0xf9,
+	0x5e,
+	0xf0,
+	0x03,
+	0xa9,
+	0x04,
+	0x60,
+	0xad,
+	0xf8,
+	0x5e,
+	0xa8,
+	0x29,
+	0xf0,
+	0xd0,
+	0xf5,
+	0x98,
+	0x29,
+	0x01,
+	0xf0,
+	0xf0,
+	0xad,
+	0xf7,
+	0x5e,
+	0xd0,
+	0xeb,
+	0xad,
+	0xf6,
+	0x5e,
+	0xa8,
+	0x29,
+	0xf0,
+	0xd0,
+	0xe3,
+	0x98,
+	0x29,
+	0x01,
+	0xf0,
+	0xde,
+	0x18,
+	0xad,
+	0xf8,
+	0x5e,
+	0x6d,
+	0xf6,
+	0x5e,
+	0x4a,
+	0xc9,
+	0x05,
+	0xb0,
+	0xd2,
+	0xa8,
+	0xb9,
+	0xa3,
+	0x59,
+	0xf0,
+	0xcc,
+	0x98,
+	0x85,
+	0x10,
+	0x9d,
+	0x35,
+	0x5f,
+	0xac,
+	0xef,
+	0x5e,
+	0xae,
+	0xee,
+	0x5e,
+	0x20,
+	0xe8,
+	0x06,
+	0xd0,
+	0xbb,
+	0x98,
+	0x4a,
+	0x85,
+	0x17,
+	0x8a,
+	0x6a,
+	0x85,
+	0x16,
+	0xb0,
+	0xb1,
+	0xac,
+	0xf3,
+	0x5e,
+	0xae,
+	0xf2,
+	0x5e,
+	0x20,
+	0xe8,
+	0x06,
+	0xd0,
+	0xa6,
+	0x98,
+	0x4a,
+	0x85,
+	0x19,
+	0x8a,
+	0x6a,
+	0x85,
+	0x18,
+	0x90,
+	0x9c,
+	0xe5,
+	0x16,
+	0xaa,
+	0xa5,
+	0x19,
+	0xe5,
+	0x17,
+	0x30,
+	0x93,
+	0xa4,
+	0x10,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1a,
+	0x86,
+	0x1b,
+	0xa4,
+	0x1f,
+	0x99,
+	0x3b,
+	0x5f,
+	0x8a,
+	0x99,
+	0x3d,
+	0x5f,
+	0xa0,
+	0x00,
+	0xb9,
+	0xae,
+	0x6a,
+	0x38,
+	0xe5,
+	0x16,
+	0xb9,
+	0xc2,
+	0x6a,
+	0xe5,
+	0x17,
+	0x10,
+	0x03,
+	0xc8,
+	0x80,
+	0xf0,
+	0x84,
+	0xb4,
+	0xb9,
+	0xae,
+	0x6a,
+	0x38,
+	0xe5,
+	0x18,
+	0xb9,
+	0xc2,
+	0x6a,
+	0xe5,
+	0x19,
+	0x10,
+	0x03,
+	0xc8,
+	0x80,
+	0xf0,
+	0x84,
+	0xb5,
+	0xa9,
+	0xff,
+	0x85,
+	0x1e,
+	0x64,
+	0x20,
+	0xa5,
+	0xb6,
+	0xd0,
+	0x3b,
+	0xa4,
+	0xb4,
+	0xc4,
+	0xb5,
+	0xf0,
+	0x79,
+	0x5a,
+	0x38,
+	0xb9,
+	0xae,
+	0x6a,
+	0xe5,
+	0x16,
+	0xaa,
+	0xb9,
+	0xc2,
+	0x6a,
+	0xe5,
+	0x17,
+	0xa4,
+	0x10,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1c,
+	0x86,
+	0x1d,
+	0x48,
+	0x0a,
+	0x1a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x8a,
+	0x2a,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x38,
+	0x68,
+	0xaa,
+	0xe5,
+	0x1e,
+	0x7a,
+	0x99,
+	0x79,
+	0x6a,
+	0x86,
+	0x1e,
+	0xc8,
+	0x80,
+	0xc7,
+	0xa5,
+	0x18,
+	0xd0,
+	0x02,
+	0xc6,
+	0x19,
+	0x3a,
+	0x85,
+	0x18,
+	0xa4,
+	0xb5,
+	0xc4,
+	0xb4,
+	0xf0,
+	0x35,
+	0x5a,
+	0x38,
+	0xa5,
+	0x18,
+	0xf9,
+	0xad,
+	0x6a,
+	0xaa,
+	0xa5,
+	0x19,
+	0xf9,
+	0xc1,
+	0x6a,
+	0xa4,
+	0x10,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1c,
+	0x86,
+	0x1d,
+	0x48,
+	0x0a,
+	0x1a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x8a,
+	0x2a,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x38,
+	0x68,
+	0xaa,
+	0xe5,
+	0x1e,
+	0x7a,
+	0x99,
+	0x79,
+	0x6a,
+	0x86,
+	0x1e,
+	0x88,
+	0x80,
+	0xc7,
+	0xa5,
+	0x1a,
+	0xa6,
+	0x1b,
+	0xc5,
+	0x1c,
+	0xd0,
+	0x12,
+	0xe4,
+	0x1d,
+	0xd0,
+	0x0e,
+	0xa5,
+	0x20,
+	0xa6,
+	0xb6,
+	0xd0,
+	0x04,
+	0xc6,
+	0xb5,
+	0x80,
+	0x22,
+	0xe6,
+	0xb4,
+	0x80,
+	0x1e,
+	0x0a,
+	0x08,
+	0x1a,
+	0x5a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x7a,
+	0x6a,
+	0x38,
+	0xe5,
+	0x1e,
+	0x99,
+	0x79,
+	0x6a,
+	0x28,
+	0x8a,
+	0x2a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x98,
+	0xa4,
+	0x1f,
+	0x99,
+	0x6f,
+	0x60,
+	0xa5,
+	0xb6,
+	0xd0,
+	0x0d,
+	0xa5,
+	0x16,
+	0xa4,
+	0xb4,
+	0xf0,
+	0x10,
+	0x38,
+	0xf9,
+	0xad,
+	0x6a,
+	0x3a,
+	0x80,
+	0x09,
+	0xa4,
+	0xb5,
+	0xb9,
+	0xae,
+	0x6a,
+	0x38,
+	0xe5,
+	0x18,
+	0x3a,
+	0xaa,
+	0xa9,
+	0x00,
+	0xa4,
+	0x10,
+	0x20,
+	0x9e,
+	0x0d,
+	0xa4,
+	0x1f,
+	0x99,
+	0x6b,
+	0x5f,
+	0x98,
+	0xd0,
+	0x12,
+	0xac,
+	0x6f,
+	0x60,
+	0x53,
+	0x6f,
+	0x5f,
+	0x97,
+	0x5f,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x79,
+	0x6a,
+	0x27,
+	0x60,
+	0x80,
+	0x10,
+	0xac,
+	0x70,
+	0x60,
+	0x53,
+	0x6f,
+	0x5f,
+	0xbf,
+	0x5f,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x79,
+	0x6a,
+	0x3b,
+	0x60,
+	0xa6,
+	0x1f,
+	0xad,
+	0x12,
+	0x5f,
+	0x9d,
+	0x73,
+	0x60,
+	0xad,
+	0xec,
+	0x5e,
+	0xa8,
+	0x29,
+	0x04,
+	0xf0,
+	0x03,
+	0xa9,
+	0x06,
+	0x60,
+	0x98,
+	0x29,
+	0x80,
+	0x9d,
+	0x27,
+	0x5f,
+	0x98,
+	0x29,
+	0x03,
+	0x9d,
+	0x29,
+	0x5f,
+	0xd0,
+	0x03,
+	0x9d,
+	0x27,
+	0x5f,
+	0xa0,
+	0x00,
+	0x29,
+	0x02,
+	0xf0,
+	0x01,
+	0xc8,
+	0x98,
+	0x9d,
+	0x2d,
+	0x5f,
+	0xad,
+	0x0f,
+	0x5f,
+	0xc9,
+	0x81,
+	0x90,
+	0x03,
+	0xa9,
+	0x1b,
+	0x60,
+	0x9d,
+	0x2f,
+	0x5f,
+	0xa9,
+	0xdf,
+	0x9d,
+	0x31,
+	0x5f,
+	0xa9,
+	0x03,
+	0x9d,
+	0x33,
+	0x5f,
+	0xad,
+	0xfd,
+	0x5e,
+	0xf0,
+	0x03,
+	0xa9,
+	0x12,
+	0x60,
+	0xad,
+	0xfc,
+	0x5e,
+	0xa8,
+	0x29,
+	0xf0,
+	0xd0,
+	0xf5,
+	0x98,
+	0x29,
+	0x01,
+	0xd0,
+	0x03,
+	0xa9,
+	0x14,
+	0x60,
+	0xad,
+	0xfb,
+	0x5e,
+	0xf0,
+	0x03,
+	0xa9,
+	0x1a,
+	0x60,
+	0xad,
+	0xfa,
+	0x5e,
+	0xa8,
+	0x29,
+	0xf0,
+	0xd0,
+	0xf5,
+	0x98,
+	0x29,
+	0x01,
+	0xd0,
+	0x03,
+	0xa9,
+	0x18,
+	0x60,
+	0x18,
+	0xad,
+	0xfc,
+	0x5e,
+	0x6d,
+	0xfa,
+	0x5e,
+	0x4a,
+	0xc9,
+	0x05,
+	0x90,
+	0x03,
+	0xa9,
+	0x16,
+	0x60,
+	0xa8,
+	0xb9,
+	0xa3,
+	0x59,
+	0xf0,
+	0xf7,
+	0x98,
+	0x85,
+	0x11,
+	0x9d,
+	0x37,
+	0x5f,
+	0xac,
+	0xf1,
+	0x5e,
+	0xae,
+	0xf0,
+	0x5e,
+	0x20,
+	0xf9,
+	0x06,
+	0xf0,
+	0x03,
+	0xa9,
+	0x08,
+	0x60,
+	0x98,
+	0x4a,
+	0x85,
+	0x17,
+	0x8a,
+	0x6a,
+	0x85,
+	0x16,
+	0x90,
+	0x03,
+	0xa9,
+	0x0c,
+	0x60,
+	0xac,
+	0xf5,
+	0x5e,
+	0xae,
+	0xf4,
+	0x5e,
+	0x20,
+	0xe8,
+	0x06,
+	0xf0,
+	0x03,
+	0xa9,
+	0x0a,
+	0x60,
+	0x98,
+	0x4a,
+	0x85,
+	0x19,
+	0x8a,
+	0x6a,
+	0x85,
+	0x18,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0e,
+	0x60,
+	0xe5,
+	0x16,
+	0x85,
+	0x1a,
+	0xa5,
+	0x19,
+	0xe5,
+	0x17,
+	0x85,
+	0x1b,
+	0x10,
+	0x03,
+	0xa9,
+	0x10,
+	0x60,
+	0xa0,
+	0x00,
+	0xb9,
+	0xd6,
+	0x6a,
+	0x38,
+	0xe5,
+	0x16,
+	0xb9,
+	0xe6,
+	0x6a,
+	0xe5,
+	0x17,
+	0x10,
+	0x03,
+	0xc8,
+	0x80,
+	0xf0,
+	0x84,
+	0xbe,
+	0xb9,
+	0xd6,
+	0x6a,
+	0x38,
+	0xe5,
+	0x18,
+	0xb9,
+	0xe6,
+	0x6a,
+	0xe5,
+	0x19,
+	0x10,
+	0x03,
+	0xc8,
+	0x80,
+	0xf0,
+	0x84,
+	0xbf,
+	0xa6,
+	0x1a,
+	0xa5,
+	0x1b,
+	0xa4,
+	0x11,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1a,
+	0x86,
+	0x1b,
+	0xa4,
+	0x1f,
+	0x99,
+	0x3f,
+	0x5f,
+	0x8a,
+	0x99,
+	0x41,
+	0x5f,
+	0xa9,
+	0xff,
+	0x85,
+	0x1e,
+	0x64,
+	0x20,
+	0xa5,
+	0xbd,
+	0xd0,
+	0x3b,
+	0xa4,
+	0xbe,
+	0xc4,
+	0xbf,
+	0xf0,
+	0x79,
+	0x5a,
+	0x38,
+	0xb9,
+	0xd6,
+	0x6a,
+	0xe5,
+	0x16,
+	0xaa,
+	0xb9,
+	0xe6,
+	0x6a,
+	0xe5,
+	0x17,
+	0xa4,
+	0x11,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1c,
+	0x86,
+	0x1d,
+	0x48,
+	0x0a,
+	0x1a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x8a,
+	0x2a,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x38,
+	0x68,
+	0xaa,
+	0xe5,
+	0x1e,
+	0x7a,
+	0x99,
+	0x8d,
+	0x6a,
+	0x86,
+	0x1e,
+	0xc8,
+	0x80,
+	0xc7,
+	0xa5,
+	0x18,
+	0xd0,
+	0x02,
+	0xc6,
+	0x19,
+	0x3a,
+	0x85,
+	0x18,
+	0xa4,
+	0xbf,
+	0xc4,
+	0xbe,
+	0xf0,
+	0x35,
+	0x5a,
+	0x38,
+	0xa5,
+	0x18,
+	0xf9,
+	0xd5,
+	0x6a,
+	0xaa,
+	0xa5,
+	0x19,
+	0xf9,
+	0xe5,
+	0x6a,
+	0xa4,
+	0x11,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1c,
+	0x86,
+	0x1d,
+	0x48,
+	0x0a,
+	0x1a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x8a,
+	0x2a,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x38,
+	0x68,
+	0xaa,
+	0xe5,
+	0x1e,
+	0x7a,
+	0x99,
+	0x8d,
+	0x6a,
+	0x86,
+	0x1e,
+	0x88,
+	0x80,
+	0xc7,
+	0xa5,
+	0x1a,
+	0xa6,
+	0x1b,
+	0xc5,
+	0x1c,
+	0xd0,
+	0x1a,
+	0xe4,
+	0x1d,
+	0xd0,
+	0x16,
+	0xa5,
+	0xbe,
+	0xc5,
+	0xbf,
+	0xf0,
+	0x0e,
+	0xa5,
+	0x20,
+	0xa6,
+	0xbd,
+	0xd0,
+	0x04,
+	0xc6,
+	0xbf,
+	0x80,
+	0x25,
+	0xe6,
+	0xbe,
+	0x80,
+	0x21,
+	0xa5,
+	0x1a,
+	0x0a,
+	0x08,
+	0x1a,
+	0x5a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x7a,
+	0x6a,
+	0x38,
+	0xe5,
+	0x1e,
+	0x99,
+	0x8d,
+	0x6a,
+	0x28,
+	0xa5,
+	0x1b,
+	0x2a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x98,
+	0xa4,
+	0x1f,
+	0x99,
+	0x71,
+	0x60,
+	0xa5,
+	0xbd,
+	0xd0,
+	0x0d,
+	0xa5,
+	0x16,
+	0xa4,
+	0xbe,
+	0xf0,
+	0x10,
+	0x38,
+	0xf9,
+	0xd5,
+	0x6a,
+	0x3a,
+	0x80,
+	0x09,
+	0xa4,
+	0xbf,
+	0xb9,
+	0xd6,
+	0x6a,
+	0x38,
+	0xe5,
+	0x18,
+	0x3a,
+	0xaa,
+	0xa9,
+	0x00,
+	0xa4,
+	0x11,
+	0x20,
+	0x9e,
+	0x0d,
+	0xa4,
+	0x1f,
+	0x99,
+	0x6d,
+	0x5f,
+	0x98,
+	0xd0,
+	0x12,
+	0xac,
+	0x71,
+	0x60,
+	0x53,
+	0x6f,
+	0x5f,
+	0xe7,
+	0x5f,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x8d,
+	0x6a,
+	0x4f,
+	0x60,
+	0x80,
+	0x10,
+	0xac,
+	0x72,
+	0x60,
+	0x53,
+	0x6f,
+	0x5f,
+	0x07,
+	0x60,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x8d,
+	0x6a,
+	0x5f,
+	0x60,
+	0x38,
+	0xa5,
+	0xbf,
+	0xe5,
+	0xbe,
+	0x85,
+	0x1e,
+	0x1a,
+	0x85,
+	0xab,
+	0xa5,
+	0xbe,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x02,
+	0xa5,
+	0xbf,
+	0x85,
+	0xb9,
+	0x85,
+	0xaa,
+	0xa5,
+	0xbe,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x02,
+	0xa5,
+	0xbf,
+	0x49,
+	0x3c,
+	0x18,
+	0x69,
+	0x77,
+	0x85,
+	0xb7,
+	0x98,
+	0x69,
+	0x60,
+	0x85,
+	0xb8,
+	0xa5,
+	0xb4,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x02,
+	0xa5,
+	0xb5,
+	0x49,
+	0x03,
+	0x18,
+	0x65,
+	0xb7,
+	0x85,
+	0xb7,
+	0x98,
+	0x65,
+	0xb8,
+	0x85,
+	0xb8,
+	0xa0,
+	0x02,
+	0x53,
+	0xb7,
+	0x00,
+	0xac,
+	0x00,
+	0x53,
+	0xb7,
+	0x00,
+	0xb2,
+	0x00,
+	0x53,
+	0xb7,
+	0x00,
+	0xae,
+	0x00,
+	0xa5,
+	0x1e,
+	0xd0,
+	0x07,
+	0x53,
+	0xb7,
+	0x00,
+	0xb0,
+	0x00,
+	0x80,
+	0x20,
+	0xa5,
+	0xbd,
+	0xd0,
+	0x0f,
+	0x18,
+	0xa5,
+	0xb7,
+	0x69,
+	0x3c,
+	0x85,
+	0xb0,
+	0xa5,
+	0xb8,
+	0x69,
+	0x00,
+	0x85,
+	0xb1,
+	0x80,
+	0x0d,
+	0x38,
+	0xa5,
+	0xb7,
+	0xe9,
+	0x3c,
+	0x85,
+	0xb0,
+	0xa5,
+	0xb8,
+	0xe9,
+	0x00,
+	0x85,
+	0xb1,
+	0xa6,
+	0x1f,
+	0xbd,
+	0x29,
+	0x5f,
+	0x8d,
+	0x76,
+	0x60,
+	0xa9,
+	0x00,
+	0xaa,
+	0x20,
+	0xc5,
+	0x39,
+	0xa5,
+	0xab,
+	0xf0,
+	0x06,
+	0xa9,
+	0x01,
+	0xaa,
+	0x20,
+	0xc5,
+	0x39,
+	0x8a,
+	0xa6,
+	0x1f,
+	0x9d,
+	0x43,
+	0x5f,
+	0xa9,
+	0x01,
+	0x9d,
+	0x2b,
+	0x5f,
+	0xa5,
+	0xab,
+	0x9d,
+	0x45,
+	0x5f,
+	0xa5,
+	0xb7,
+	0x9d,
+	0x57,
+	0x5f,
+	0xa5,
+	0xb8,
+	0x9d,
+	0x59,
+	0x5f,
+	0xa5,
+	0xac,
+	0x9d,
+	0x5b,
+	0x5f,
+	0xa5,
+	0xad,
+	0x9d,
+	0x5d,
+	0x5f,
+	0xa5,
+	0xb2,
+	0x9d,
+	0x5f,
+	0x5f,
+	0xa5,
+	0xb3,
+	0x9d,
+	0x61,
+	0x5f,
+	0xa5,
+	0xae,
+	0x9d,
+	0x63,
+	0x5f,
+	0xa5,
+	0xaf,
+	0x9d,
+	0x65,
+	0x5f,
+	0xa5,
+	0xb0,
+	0x9d,
+	0x67,
+	0x5f,
+	0xa5,
+	0xb1,
+	0x9d,
+	0x69,
+	0x5f,
+	0xa5,
+	0xb4,
+	0x9d,
+	0x47,
+	0x5f,
+	0xa5,
+	0xb5,
+	0x9d,
+	0x49,
+	0x5f,
+	0xa5,
+	0xbe,
+	0x9d,
+	0x4b,
+	0x5f,
+	0xa5,
+	0xbf,
+	0x9d,
+	0x4d,
+	0x5f,
+	0xa5,
+	0xaa,
+	0x9d,
+	0x4f,
+	0x5f,
+	0xa5,
+	0xb9,
+	0x9d,
+	0x51,
+	0x5f,
+	0xa9,
+	0x00,
+	0x60,
+	0xc0,
+	0x01,
+	0xd0,
+	0x04,
+	0xa8,
+	0x8a,
+	0xfc,
+	0x60,
+	0x85,
+	0x12,
+	0x98,
+	0xc9,
+	0x01,
+	0xf0,
+	0x0e,
+	0x29,
+	0x01,
+	0xd0,
+	0x0e,
+	0x46,
+	0x12,
+	0x8a,
+	0x6a,
+	0xaa,
+	0x98,
+	0x4a,
+	0xa8,
+	0x80,
+	0xee,
+	0x8a,
+	0xa6,
+	0x12,
+	0x60,
+	0x8a,
+	0x1a,
+	0xd0,
+	0x02,
+	0xe6,
+	0x12,
+	0x49,
+	0x55,
+	0x84,
+	0x14,
+	0x18,
+	0x65,
+	0x14,
+	0x85,
+	0x13,
+	0x90,
+	0x03,
+	0xe6,
+	0x14,
+	0x18,
+	0xa5,
+	0x12,
+	0x49,
+	0x55,
+	0x84,
+	0x15,
+	0xaa,
+	0x65,
+	0x13,
+	0x8a,
+	0x65,
+	0x14,
+	0x85,
+	0x14,
+	0xa5,
+	0x15,
+	0x90,
+	0x03,
+	0xe6,
+	0x15,
+	0x18,
+	0x65,
+	0x14,
+	0xa6,
+	0x15,
+	0x90,
+	0x01,
+	0xe8,
+	0x60,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0xc0,
+	0x4c,
+	0x00,
+	0x03,
+	0x08,
+	0x68,
+	0x8d,
+	0x16,
+	0x6b,
+	0x64,
+	0x25,
+	0x80,
+	0x06,
+	0xa5,
+	0x25,
+	0xc9,
+	0x01,
+	0xf0,
+	0x03,
+	0x5c,
+	0x80,
+	0xf7,
+	0x20,
+	0xa5,
+	0x0e,
+	0xa5,
+	0x24,
+	0xd0,
+	0x03,
+	0x5c,
+	0x80,
+	0xf9,
+	0xc6,
+	0x24,
+	0xa5,
+	0x60,
+	0x85,
+	0x67,
+	0x20,
+	0x22,
+	0x1d,
+	0xa5,
+	0x60,
+	0xa6,
+	0x23,
+	0xf0,
+	0x07,
+	0xc5,
+	0x27,
+	0xf0,
+	0x0d,
+	0x1a,
+	0x80,
+	0x05,
+	0xc5,
+	0x26,
+	0xf0,
+	0x06,
+	0x3a,
+	0x85,
+	0x67,
+	0x20,
+	0x53,
+	0x1f,
+	0xa5,
+	0x27,
+	0xa6,
+	0x23,
+	0xf0,
+	0x02,
+	0xa5,
+	0x26,
+	0xc5,
+	0x60,
+	0xf0,
+	0x0b,
+	0x8a,
+	0xf0,
+	0x04,
+	0xc6,
+	0x60,
+	0x80,
+	0xc6,
+	0xe6,
+	0x60,
+	0x80,
+	0xc2,
+	0x85,
+	0x67,
+	0x20,
+	0x53,
+	0x1f,
+	0x20,
+	0xd3,
+	0x29,
+	0x80,
+	0xac,
+	0x18,
+	0x69,
+	0x14,
+	0x90,
+	0x01,
+	0xc8,
+	0xda,
+	0x85,
+	0x32,
+	0x84,
+	0x33,
+	0x49,
+	0x66,
+	0x84,
+	0x34,
+	0xa5,
+	0x33,
+	0x49,
+	0x66,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x35,
+	0xa5,
+	0x32,
+	0x49,
+	0x06,
+	0x18,
+	0x65,
+	0x34,
+	0xaa,
+	0x98,
+	0x65,
+	0x35,
+	0x85,
+	0x35,
+	0xa5,
+	0x33,
+	0x49,
+	0x06,
+	0x18,
+	0x65,
+	0x35,
+	0xe0,
+	0xfa,
+	0x90,
+	0x01,
+	0x1a,
+	0xfa,
+	0x60,
+	0x18,
+	0x69,
+	0x10,
+	0x90,
+	0x01,
+	0xc8,
+	0x84,
+	0x32,
+	0x46,
+	0x32,
+	0x6a,
+	0x46,
+	0x32,
+	0x6a,
+	0x46,
+	0x32,
+	0x6a,
+	0x46,
+	0x32,
+	0x6a,
+	0x46,
+	0x32,
+	0x6a,
+	0x60,
+	0xa0,
+	0x12,
+	0x64,
+	0x6e,
+	0x64,
+	0x6f,
+	0x64,
+	0x70,
+	0x64,
+	0x71,
+	0x13,
+	0x6e,
+	0x00,
+	0xc3,
+	0x80,
+	0x64,
+	0x72,
+	0x64,
+	0x73,
+	0xa0,
+	0x48,
+	0x13,
+	0x6e,
+	0x00,
+	0xd5,
+	0x80,
+	0x13,
+	0x6e,
+	0x00,
+	0x1d,
+	0x81,
+	0x13,
+	0x6e,
+	0x00,
+	0x65,
+	0x81,
+	0xad,
+	0x19,
+	0x6b,
+	0xae,
+	0x18,
+	0x6b,
+	0xd0,
+	0x05,
+	0xcd,
+	0x1a,
+	0x6b,
+	0xf0,
+	0x0f,
+	0x20,
+	0xa7,
+	0x0f,
+	0x20,
+	0x92,
+	0x10,
+	0xad,
+	0x19,
+	0x6b,
+	0x8d,
+	0x1a,
+	0x6b,
+	0x9c,
+	0x18,
+	0x6b,
+	0xa6,
+	0x26,
+	0x9e,
+	0x79,
+	0x74,
+	0x9e,
+	0x8b,
+	0x74,
+	0xa9,
+	0x00,
+	0xa8,
+	0xe4,
+	0x27,
+	0xf0,
+	0x19,
+	0x9d,
+	0x7a,
+	0x74,
+	0x48,
+	0x98,
+	0x9d,
+	0x8c,
+	0x74,
+	0x68,
+	0xc9,
+	0x28,
+	0xf0,
+	0x06,
+	0x18,
+	0x69,
+	0x14,
+	0xc8,
+	0x80,
+	0x03,
+	0xa9,
+	0x00,
+	0xa8,
+	0xe8,
+	0x80,
+	0xe3,
+	0x9d,
+	0x7a,
+	0x74,
+	0x9d,
+	0x7b,
+	0x74,
+	0x98,
+	0x9d,
+	0x8c,
+	0x74,
+	0x9d,
+	0x8d,
+	0x74,
+	0x38,
+	0xa5,
+	0x29,
+	0xe5,
+	0x28,
+	0xaa,
+	0x1a,
+	0x85,
+	0x2e,
+	0xbd,
+	0xa8,
+	0x59,
+	0x85,
+	0x2c,
+	0xa2,
+	0x00,
+	0x8a,
+	0x0a,
+	0x1a,
+	0x45,
+	0x2e,
+	0x20,
+	0x5b,
+	0x0e,
+	0x9d,
+	0x1b,
+	0x7d,
+	0xe8,
+	0xe0,
+	0x14,
+	0x90,
+	0xf0,
+	0xa2,
+	0x00,
+	0xbd,
+	0x1b,
+	0x7d,
+	0xdd,
+	0x1c,
+	0x7d,
+	0xd0,
+	0x05,
+	0x09,
+	0x80,
+	0x9d,
+	0x1b,
+	0x7d,
+	0xe8,
+	0xe0,
+	0x13,
+	0x90,
+	0xee,
+	0x38,
+	0xa5,
+	0x27,
+	0xe5,
+	0x26,
+	0xaa,
+	0x1a,
+	0x85,
+	0x2e,
+	0xbd,
+	0xbc,
+	0x59,
+	0x85,
+	0x2d,
+	0xa2,
+	0x00,
+	0x8a,
+	0x0a,
+	0x1a,
+	0x45,
+	0x2e,
+	0x20,
+	0x93,
+	0x0e,
+	0x9d,
+	0x2f,
+	0x7d,
+	0xe8,
+	0xe0,
+	0x10,
+	0x90,
+	0xf0,
+	0xa5,
+	0x23,
+	0xf0,
+	0x14,
+	0xa2,
+	0x0f,
+	0xbd,
+	0x2f,
+	0x7d,
+	0xdd,
+	0x2e,
+	0x7d,
+	0xd0,
+	0x05,
+	0x09,
+	0x80,
+	0x9d,
+	0x2f,
+	0x7d,
+	0xca,
+	0xd0,
+	0xf0,
+	0x80,
+	0x14,
+	0xa2,
+	0x00,
+	0xbd,
+	0x2f,
+	0x7d,
+	0xdd,
+	0x30,
+	0x7d,
+	0xd0,
+	0x05,
+	0x09,
+	0x80,
+	0x9d,
+	0x2f,
+	0x7d,
+	0xe8,
+	0xe0,
+	0x0f,
+	0x90,
+	0xee,
+	0xa9,
+	0x00,
+	0xa6,
+	0x23,
+	0xf0,
+	0x02,
+	0xa9,
+	0x0f,
+	0x85,
+	0x8a,
+	0xe6,
+	0x25,
+	0x60,
+	0x85,
+	0x2e,
+	0xa9,
+	0x39,
+	0x85,
+	0x4a,
+	0xa9,
+	0xbe,
+	0x85,
+	0x4b,
+	0xa2,
+	0x00,
+	0xa0,
+	0x5a,
+	0xa5,
+	0x2e,
+	0xd1,
+	0x4a,
+	0x90,
+	0x19,
+	0xe0,
+	0x04,
+	0xf0,
+	0x0e,
+	0xe8,
+	0x18,
+	0xa5,
+	0x4a,
+	0x69,
+	0x5b,
+	0x85,
+	0x4a,
+	0x90,
+	0xec,
+	0xe6,
+	0x4b,
+	0x80,
+	0xe8,
+	0xa0,
+	0x5a,
+	0xd3,
+	0x4a,
+	0x1f,
+	0x6b,
+	0x60,
+	0x8a,
+	0xf0,
+	0xf6,
+	0xb1,
+	0x4a,
+	0x85,
+	0x30,
+	0x38,
+	0xa5,
+	0x4a,
+	0xe9,
+	0x5b,
+	0x85,
+	0x4c,
+	0xa5,
+	0x4b,
+	0xe9,
+	0x00,
+	0x85,
+	0x4d,
+	0xb1,
+	0x4c,
+	0x85,
+	0x2f,
+	0xc5,
+	0x2e,
+	0xd0,
+	0x07,
+	0xa0,
+	0x5a,
+	0xd3,
+	0x4c,
+	0x1f,
+	0x6b,
+	0x60,
+	0x38,
+	0xa5,
+	0x30,
+	0xe5,
+	0x2e,
+	0x85,
+	0x33,
+	0x64,
+	0x32,
+	0x38,
+	0xa5,
+	0x30,
+	0xe5,
+	0x2f,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0x20,
+	0x0b,
+	0x39,
+	0xa5,
+	0x32,
+	0x85,
+	0x2e,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x2e,
+	0x85,
+	0x2f,
+	0xa9,
+	0x06,
+	0x85,
+	0x34,
+	0xa2,
+	0x00,
+	0x64,
+	0x35,
+	0xdc,
+	0xb1,
+	0x4c,
+	0x85,
+	0x30,
+	0xb1,
+	0x4a,
+	0x10,
+	0x20,
+	0xa4,
+	0x35,
+	0xf0,
+	0x1c,
+	0x85,
+	0x31,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x31,
+	0x45,
+	0x2f,
+	0x85,
+	0x31,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x31,
+	0x85,
+	0x32,
+	0x84,
+	0x31,
+	0xa9,
+	0x00,
+	0xe5,
+	0x31,
+	0x85,
+	0x33,
+	0x80,
+	0x06,
+	0x45,
+	0x2f,
+	0x85,
+	0x32,
+	0x84,
+	0x33,
+	0xa5,
+	0x30,
+	0x10,
+	0x1e,
+	0xa4,
+	0x35,
+	0xf0,
+	0x1a,
+	0x85,
+	0x31,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x31,
+	0x45,
+	0x2e,
+	0x85,
+	0x31,
+	0x38,
+	0xa5,
+	0x32,
+	0xe5,
+	0x31,
+	0x85,
+	0x32,
+	0x84,
+	0x31,
+	0xa5,
+	0x33,
+	0xe5,
+	0x31,
+	0x80,
+	0x0a,
+	0x45,
+	0x2e,
+	0x18,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x65,
+	0x33,
+	0xa8,
+	0xa5,
+	0x32,
+	0x10,
+	0x01,
+	0xc8,
+	0x98,
+	0x9d,
+	0x1f,
+	0x6b,
+	0xe8,
+	0xe6,
+	0x35,
+	0xa5,
+	0x35,
+	0xc9,
+	0x0f,
+	0xd0,
+	0x92,
+	0xc6,
+	0x34,
+	0xd0,
+	0x8c,
+	0x60,
+	0xa9,
+	0x9d,
+	0x85,
+	0x4a,
+	0xa9,
+	0x74,
+	0x85,
+	0x4b,
+	0xa9,
+	0xdc,
+	0x85,
+	0x4c,
+	0xa9,
+	0x3f,
+	0x85,
+	0x4d,
+	0x64,
+	0x38,
+	0xa0,
+	0x11,
+	0x13,
+	0x38,
+	0x00,
+	0x39,
+	0x00,
+	0xa9,
+	0x11,
+	0x85,
+	0x30,
+	0xa9,
+	0x15,
+	0x85,
+	0x31,
+	0xa0,
+	0x0e,
+	0xd3,
+	0x4c,
+	0x50,
+	0x00,
+	0x64,
+	0x4e,
+	0xa2,
+	0x00,
+	0xa9,
+	0x06,
+	0x85,
+	0x2e,
+	0x18,
+	0xbd,
+	0x20,
+	0x6b,
+	0x3c,
+	0x45,
+	0x50,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x09,
+	0x7d,
+	0x1f,
+	0x6b,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x80,
+	0x07,
+	0x7d,
+	0x1f,
+	0x6b,
+	0x85,
+	0x33,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0x85,
+	0x34,
+	0x18,
+	0xbd,
+	0x21,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x51,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x22,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x52,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x23,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x53,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x24,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x54,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x25,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x55,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x26,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x56,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x27,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x57,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x28,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x58,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x29,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x59,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x2a,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x5a,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x2b,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x5b,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x2c,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x5c,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x2d,
+	0x6b,
+	0x3c,
+	0x45,
+	0x5d,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x08,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x80,
+	0x06,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0x00,
+	0x65,
+	0x34,
+	0xf0,
+	0x0a,
+	0x10,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x0e,
+	0xa9,
+	0xff,
+	0x80,
+	0x0a,
+	0xa5,
+	0x33,
+	0xa4,
+	0x32,
+	0x10,
+	0x04,
+	0x1a,
+	0xd0,
+	0x01,
+	0x3a,
+	0x92,
+	0x4a,
+	0xda,
+	0xa6,
+	0x4e,
+	0x18,
+	0x75,
+	0x38,
+	0x95,
+	0x38,
+	0x90,
+	0x07,
+	0x18,
+	0xf6,
+	0x39,
+	0xd0,
+	0x02,
+	0xf6,
+	0x3a,
+	0xe8,
+	0xe8,
+	0xe8,
+	0x86,
+	0x4e,
+	0xe6,
+	0x4a,
+	0xd0,
+	0x02,
+	0xe6,
+	0x4b,
+	0x68,
+	0x69,
+	0x0f,
+	0xaa,
+	0xc6,
+	0x2e,
+	0xf0,
+	0x03,
+	0x4c,
+	0xc2,
+	0x10,
+	0xa5,
+	0x4c,
+	0x69,
+	0x0e,
+	0x85,
+	0x4c,
+	0x90,
+	0x02,
+	0xe6,
+	0x4d,
+	0xc6,
+	0x31,
+	0xf0,
+	0x03,
+	0x4c,
+	0xb3,
+	0x10,
+	0xc6,
+	0x30,
+	0xf0,
+	0x03,
+	0x4c,
+	0xaf,
+	0x10,
+	0x64,
+	0x2e,
+	0xa5,
+	0x2e,
+	0x49,
+	0x09,
+	0xa8,
+	0xa2,
+	0x00,
+	0xa9,
+	0x03,
+	0x85,
+	0x2f,
+	0xb9,
+	0x38,
+	0x00,
+	0x0a,
+	0x48,
+	0xb9,
+	0x39,
+	0x00,
+	0x2a,
+	0x95,
+	0x50,
+	0xb9,
+	0x3a,
+	0x00,
+	0x2a,
+	0x95,
+	0x51,
+	0x68,
+	0x0a,
+	0x90,
+	0x06,
+	0xf6,
+	0x50,
+	0xd0,
+	0x02,
+	0xf6,
+	0x51,
+	0xc8,
+	0xc8,
+	0xc8,
+	0xe8,
+	0xe8,
+	0xc6,
+	0x2f,
+	0xd0,
+	0xdc,
+	0xa0,
+	0x00,
+	0x38,
+	0xa5,
+	0x50,
+	0xe5,
+	0x52,
+	0x85,
+	0x2f,
+	0xa5,
+	0x51,
+	0xe5,
+	0x53,
+	0x08,
+	0x05,
+	0x2f,
+	0x85,
+	0x2f,
+	0xd0,
+	0x01,
+	0xc8,
+	0x38,
+	0xa5,
+	0x52,
+	0xe5,
+	0x54,
+	0x85,
+	0x30,
+	0xa5,
+	0x53,
+	0xe5,
+	0x55,
+	0x08,
+	0x05,
+	0x30,
+	0x85,
+	0x30,
+	0xd0,
+	0x01,
+	0xc8,
+	0x38,
+	0xa5,
+	0x54,
+	0xe5,
+	0x50,
+	0x85,
+	0x31,
+	0xa5,
+	0x55,
+	0xe5,
+	0x51,
+	0x08,
+	0x05,
+	0x31,
+	0x85,
+	0x31,
+	0xd0,
+	0x01,
+	0xc8,
+	0xa6,
+	0x2e,
+	0x98,
+	0x95,
+	0xdc,
+	0xa9,
+	0x00,
+	0xa8,
+	0x28,
+	0xb0,
+	0x03,
+	0x69,
+	0x04,
+	0xc8,
+	0x28,
+	0xb0,
+	0x03,
+	0x1a,
+	0x1a,
+	0xc8,
+	0x28,
+	0xb0,
+	0x02,
+	0x1a,
+	0xc8,
+	0xc0,
+	0x01,
+	0xd0,
+	0x26,
+	0xc9,
+	0x01,
+	0xd0,
+	0x08,
+	0xa4,
+	0x30,
+	0xd0,
+	0x1e,
+	0xa9,
+	0x00,
+	0x80,
+	0x1a,
+	0xc9,
+	0x02,
+	0xd0,
+	0x08,
+	0xa4,
+	0x2f,
+	0xd0,
+	0x12,
+	0xa9,
+	0x00,
+	0x80,
+	0x0e,
+	0xa4,
+	0x2f,
+	0xd0,
+	0x04,
+	0xa9,
+	0x05,
+	0x80,
+	0x06,
+	0xa4,
+	0x30,
+	0xd0,
+	0x02,
+	0xa9,
+	0x06,
+	0x49,
+	0x03,
+	0xa8,
+	0xb9,
+	0xa3,
+	0x3f,
+	0x85,
+	0x5d,
+	0xb9,
+	0xa4,
+	0x3f,
+	0x85,
+	0x5e,
+	0xb9,
+	0xa5,
+	0x3f,
+	0x85,
+	0x5f,
+	0xa6,
+	0x5e,
+	0xa4,
+	0x5d,
+	0x98,
+	0x0a,
+	0xa8,
+	0xb9,
+	0x50,
+	0x00,
+	0x85,
+	0x32,
+	0xb9,
+	0x51,
+	0x00,
+	0x85,
+	0x33,
+	0xa5,
+	0x2e,
+	0x49,
+	0x06,
+	0xaa,
+	0xa0,
+	0x00,
+	0x38,
+	0xb9,
+	0x50,
+	0x00,
+	0xe5,
+	0x32,
+	0x9d,
+	0xfb,
+	0x7c,
+	0xb9,
+	0x51,
+	0x00,
+	0xe5,
+	0x33,
+	0x9d,
+	0xfc,
+	0x7c,
+	0xe8,
+	0xe8,
+	0xc8,
+	0xc8,
+	0xc0,
+	0x06,
+	0xd0,
+	0xe7,
+	0xa5,
+	0x2e,
+	0x49,
+	0x03,
+	0xaa,
+	0xa5,
+	0x5d,
+	0x9d,
+	0x07,
+	0x7d,
+	0xa5,
+	0x5e,
+	0x9d,
+	0x08,
+	0x7d,
+	0xa5,
+	0x5f,
+	0x9d,
+	0x09,
+	0x7d,
+	0xa5,
+	0x2e,
+	0x49,
+	0x06,
+	0xa8,
+	0x18,
+	0x65,
+	0x5f,
+	0x65,
+	0x5f,
+	0xaa,
+	0xbd,
+	0xfc,
+	0x7c,
+	0x85,
+	0x6b,
+	0xbd,
+	0xfb,
+	0x7c,
+	0x85,
+	0x6a,
+	0x98,
+	0x18,
+	0x65,
+	0x5e,
+	0x65,
+	0x5e,
+	0xaa,
+	0xbd,
+	0xfc,
+	0x7c,
+	0x85,
+	0x69,
+	0xbd,
+	0xfb,
+	0x7c,
+	0x85,
+	0x68,
+	0x49,
+	0x10,
+	0x85,
+	0x32,
+	0x84,
+	0x33,
+	0x18,
+	0xa5,
+	0x69,
+	0x49,
+	0x10,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x38,
+	0xa5,
+	0x6a,
+	0xe5,
+	0x68,
+	0x85,
+	0x34,
+	0xa5,
+	0x6b,
+	0xe5,
+	0x69,
+	0x85,
+	0x35,
+	0x20,
+	0x2f,
+	0x39,
+	0xa0,
+	0x02,
+	0x53,
+	0x32,
+	0x00,
+	0x56,
+	0x00,
+	0x18,
+	0xa5,
+	0x68,
+	0x65,
+	0x6a,
+	0x85,
+	0x58,
+	0xa5,
+	0x69,
+	0x65,
+	0x6b,
+	0x85,
+	0x59,
+	0xa5,
+	0x56,
+	0x45,
+	0x68,
+	0x85,
+	0x5a,
+	0x84,
+	0x5b,
+	0xa5,
+	0x57,
+	0x45,
+	0x68,
+	0x18,
+	0x65,
+	0x5b,
+	0x85,
+	0x5b,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x5c,
+	0xa5,
+	0x56,
+	0x45,
+	0x69,
+	0x18,
+	0x65,
+	0x5b,
+	0x85,
+	0x5b,
+	0x98,
+	0x65,
+	0x5c,
+	0x85,
+	0x5c,
+	0xa5,
+	0x57,
+	0x45,
+	0x69,
+	0x18,
+	0x65,
+	0x5c,
+	0x85,
+	0x5c,
+	0xa5,
+	0x2e,
+	0x49,
+	0x07,
+	0x18,
+	0x69,
+	0x0d,
+	0x85,
+	0x4c,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x4d,
+	0xa0,
+	0x07,
+	0x73,
+	0x56,
+	0x00,
+	0x4c,
+	0xa5,
+	0x2e,
+	0x1a,
+	0xc9,
+	0x02,
+	0xf0,
+	0x05,
+	0x85,
+	0x2e,
+	0x4c,
+	0x14,
+	0x13,
+	0x60,
+	0xa2,
+	0x00,
+	0xa8,
+	0x30,
+	0x04,
+	0xe8,
+	0x0a,
+	0x10,
+	0xfc,
+	0xbd,
+	0xb8,
+	0x3f,
+	0xaa,
+	0x60,
+	0xa5,
+	0x9a,
+	0x05,
+	0x9e,
+	0x05,
+	0xa2,
+	0x05,
+	0xa6,
+	0xf0,
+	0x33,
+	0x20,
+	0xc0,
+	0x14,
+	0x45,
+	0x99,
+	0x84,
+	0xea,
+	0x8a,
+	0x45,
+	0x9a,
+	0x05,
+	0xea,
+	0x85,
+	0xea,
+	0x8a,
+	0x45,
+	0x9d,
+	0x84,
+	0xeb,
+	0x8a,
+	0x45,
+	0x9e,
+	0x05,
+	0xeb,
+	0x85,
+	0xeb,
+	0x8a,
+	0x45,
+	0xa1,
+	0x84,
+	0xec,
+	0x8a,
+	0x45,
+	0xa2,
+	0x05,
+	0xec,
+	0x85,
+	0xec,
+	0x8a,
+	0x45,
+	0xa5,
+	0x84,
+	0xed,
+	0x8a,
+	0x45,
+	0xa6,
+	0x05,
+	0xed,
+	0x85,
+	0xed,
+	0x60,
+	0xa5,
+	0x99,
+	0x05,
+	0x9d,
+	0x05,
+	0xa1,
+	0x05,
+	0xa5,
+	0xf0,
+	0x33,
+	0x20,
+	0xc0,
+	0x14,
+	0x45,
+	0x98,
+	0x84,
+	0xea,
+	0x8a,
+	0x45,
+	0x99,
+	0x05,
+	0xea,
+	0x85,
+	0xea,
+	0x8a,
+	0x45,
+	0x9c,
+	0x84,
+	0xeb,
+	0x8a,
+	0x45,
+	0x9d,
+	0x05,
+	0xeb,
+	0x85,
+	0xeb,
+	0x8a,
+	0x45,
+	0xa0,
+	0x84,
+	0xec,
+	0x8a,
+	0x45,
+	0xa1,
+	0x05,
+	0xec,
+	0x85,
+	0xec,
+	0x8a,
+	0x45,
+	0xa4,
+	0x84,
+	0xed,
+	0x8a,
+	0x45,
+	0xa5,
+	0x05,
+	0xed,
+	0x85,
+	0xed,
+	0x60,
+	0xa5,
+	0x98,
+	0x85,
+	0xea,
+	0xa5,
+	0x9c,
+	0x85,
+	0xeb,
+	0xa5,
+	0xa0,
+	0x85,
+	0xec,
+	0xa5,
+	0xa4,
+	0x85,
+	0xed,
+	0x60,
+	0xaa,
+	0x45,
+	0xc8,
+	0x84,
+	0xcb,
+	0x8a,
+	0x45,
+	0xc9,
+	0x18,
+	0x65,
+	0xcb,
+	0x90,
+	0x01,
+	0xc8,
+	0x84,
+	0xe7,
+	0x8a,
+	0x45,
+	0xcc,
+	0x84,
+	0xcf,
+	0x8a,
+	0x45,
+	0xcd,
+	0x18,
+	0x65,
+	0xcf,
+	0x90,
+	0x01,
+	0xc8,
+	0x98,
+	0x0a,
+	0x0a,
+	0x0a,
+	0x85,
+	0xe8,
+	0x8a,
+	0x45,
+	0xc4,
+	0x84,
+	0xc7,
+	0x8a,
+	0x45,
+	0xc5,
+	0x18,
+	0x65,
+	0xc7,
+	0x90,
+	0x02,
+	0x18,
+	0xc8,
+	0x85,
+	0xc4,
+	0x84,
+	0xc5,
+	0x8a,
+	0x45,
+	0xc6,
+	0x65,
+	0xc5,
+	0x85,
+	0xc5,
+	0x8a,
+	0x45,
+	0xd0,
+	0x84,
+	0xd3,
+	0x8a,
+	0x45,
+	0xd1,
+	0x18,
+	0x65,
+	0xd3,
+	0x90,
+	0x02,
+	0x18,
+	0xc8,
+	0x85,
+	0xd0,
+	0x84,
+	0xd1,
+	0x8a,
+	0x45,
+	0xd2,
+	0x65,
+	0xd1,
+	0x85,
+	0xd1,
+	0x18,
+	0xa5,
+	0xc4,
+	0x65,
+	0xd0,
+	0xa5,
+	0xc5,
+	0x65,
+	0xd1,
+	0x6a,
+	0xa8,
+	0x90,
+	0x04,
+	0x1a,
+	0xd0,
+	0x01,
+	0x3a,
+	0x85,
+	0xe9,
+	0x98,
+	0x4a,
+	0x4a,
+	0x49,
+	0x20,
+	0x05,
+	0xe7,
+	0x85,
+	0xe7,
+	0x98,
+	0x05,
+	0xe8,
+	0x85,
+	0xe8,
+	0x38,
+	0xa5,
+	0xc4,
+	0xe5,
+	0xd0,
+	0xaa,
+	0xa5,
+	0xc5,
+	0xe5,
+	0xd1,
+	0xb0,
+	0x52,
+	0x38,
+	0xa5,
+	0xd0,
+	0xe5,
+	0xc4,
+	0x85,
+	0xca,
+	0xa5,
+	0xd1,
+	0xe5,
+	0xc5,
+	0x85,
+	0xcb,
+	0xa4,
+	0xe9,
+	0xb9,
+	0xcc,
+	0x59,
+	0xaa,
+	0x45,
+	0xca,
+	0x84,
+	0xc4,
+	0x8a,
+	0x45,
+	0xcb,
+	0x18,
+	0x65,
+	0xc4,
+	0x85,
+	0xc4,
+	0x98,
+	0x69,
+	0x00,
+	0xa4,
+	0xe9,
+	0xbe,
+	0xcc,
+	0x5a,
+	0xf0,
+	0x14,
+	0x85,
+	0xc5,
+	0x8a,
+	0x45,
+	0xca,
+	0x18,
+	0x65,
+	0xc4,
+	0x85,
+	0xc4,
+	0x98,
+	0x65,
+	0xc5,
+	0x85,
+	0xc5,
+	0x8a,
+	0x45,
+	0xcb,
+	0x65,
+	0xc5,
+	0xa6,
+	0xc4,
+	0x10,
+	0x01,
+	0x1a,
+	0xc9,
+	0x27,
+	0x90,
+	0x02,
+	0xa9,
+	0x26,
+	0x85,
+	0xe6,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0xe6,
+	0x85,
+	0xe6,
+	0x60,
+	0x86,
+	0xca,
+	0x85,
+	0xcb,
+	0xa4,
+	0xe9,
+	0xb9,
+	0xcc,
+	0x59,
+	0xaa,
+	0x45,
+	0xca,
+	0x84,
+	0xc4,
+	0x8a,
+	0x45,
+	0xcb,
+	0x18,
+	0x65,
+	0xc4,
+	0x85,
+	0xc4,
+	0x98,
+	0x69,
+	0x00,
+	0xa4,
+	0xe9,
+	0xbe,
+	0xcc,
+	0x5a,
+	0xf0,
+	0x14,
+	0x85,
+	0xc5,
+	0x8a,
+	0x45,
+	0xca,
+	0x18,
+	0x65,
+	0xc4,
+	0x85,
+	0xc4,
+	0x98,
+	0x65,
+	0xc5,
+	0x85,
+	0xc5,
+	0x8a,
+	0x45,
+	0xcb,
+	0x65,
+	0xc5,
+	0xa6,
+	0xc4,
+	0x10,
+	0x01,
+	0x1a,
+	0xc9,
+	0x27,
+	0x90,
+	0x02,
+	0xa9,
+	0x26,
+	0x85,
+	0xe6,
+	0x60,
+	0xa5,
+	0xc4,
+	0x0a,
+	0xa5,
+	0xc5,
+	0x2a,
+	0x85,
+	0xc4,
+	0xa5,
+	0xc6,
+	0x2a,
+	0x85,
+	0xc5,
+	0xa5,
+	0xc7,
+	0x2a,
+	0x85,
+	0xc6,
+	0xa5,
+	0xc9,
+	0x4a,
+	0x4a,
+	0x85,
+	0xc8,
+	0xa5,
+	0xca,
+	0x49,
+	0x40,
+	0x05,
+	0xc8,
+	0x85,
+	0xc8,
+	0x84,
+	0xc9,
+	0xa5,
+	0xcb,
+	0x49,
+	0x40,
+	0x05,
+	0xc9,
+	0x85,
+	0xc9,
+	0x84,
+	0xca,
+	0xa5,
+	0xcd,
+	0x4a,
+	0x4a,
+	0x85,
+	0xcc,
+	0xa5,
+	0xce,
+	0x49,
+	0x40,
+	0x05,
+	0xcc,
+	0x85,
+	0xcc,
+	0x84,
+	0xcd,
+	0xa5,
+	0xcf,
+	0x49,
+	0x40,
+	0x05,
+	0xcd,
+	0x85,
+	0xcd,
+	0x84,
+	0xce,
+	0xa5,
+	0xd0,
+	0x0a,
+	0xa5,
+	0xd1,
+	0x2a,
+	0x85,
+	0xd0,
+	0xa5,
+	0xd2,
+	0x2a,
+	0x85,
+	0xd1,
+	0xa5,
+	0xd3,
+	0x2a,
+	0x85,
+	0xd2,
+	0x60,
+	0xa5,
+	0xc4,
+	0x49,
+	0x04,
+	0x84,
+	0xc4,
+	0xa5,
+	0xc5,
+	0x49,
+	0x04,
+	0x05,
+	0xc4,
+	0x85,
+	0xc4,
+	0x84,
+	0xc5,
+	0xa5,
+	0xc6,
+	0x49,
+	0x04,
+	0x05,
+	0xc5,
+	0x85,
+	0xc5,
+	0x84,
+	0xc6,
+	0xa5,
+	0xc9,
+	0x4a,
+	0x85,
+	0xc8,
+	0xa5,
+	0xca,
+	0x49,
+	0x80,
+	0x05,
+	0xc8,
+	0x85,
+	0xc8,
+	0x84,
+	0xc9,
+	0xa5,
+	0xcb,
+	0x49,
+	0x80,
+	0x05,
+	0xc9,
+	0x85,
+	0xc9,
+	0x84,
+	0xca,
+	0xa5,
+	0xcd,
+	0x4a,
+	0x85,
+	0xcc,
+	0xa5,
+	0xce,
+	0x49,
+	0x80,
+	0x05,
+	0xcc,
+	0x85,
+	0xcc,
+	0x84,
+	0xcd,
+	0xa5,
+	0xcf,
+	0x49,
+	0x80,
+	0x05,
+	0xcd,
+	0x85,
+	0xcd,
+	0x84,
+	0xce,
+	0xa5,
+	0xd0,
+	0x49,
+	0x04,
+	0x84,
+	0xd0,
+	0xa5,
+	0xd1,
+	0x49,
+	0x04,
+	0x05,
+	0xd0,
+	0x85,
+	0xd0,
+	0x84,
+	0xd1,
+	0xa5,
+	0xd2,
+	0x49,
+	0x04,
+	0x05,
+	0xd1,
+	0x85,
+	0xd1,
+	0x84,
+	0xd2,
+	0x60,
+	0xa5,
+	0xc4,
+	0x49,
+	0x08,
+	0x84,
+	0xc4,
+	0xa5,
+	0xc5,
+	0x49,
+	0x08,
+	0x05,
+	0xc4,
+	0x85,
+	0xc4,
+	0x84,
+	0xc5,
+	0xa5,
+	0xc6,
+	0x49,
+	0x08,
+	0x05,
+	0xc5,
+	0x85,
+	0xc5,
+	0x84,
+	0xc6,
+	0xa5,
+	0xc9,
+	0x85,
+	0xc8,
+	0xa5,
+	0xca,
+	0x85,
+	0xc9,
+	0xa5,
+	0xcb,
+	0x85,
+	0xca,
+	0xa5,
+	0xcd,
+	0x85,
+	0xcc,
+	0xa5,
+	0xce,
+	0x85,
+	0xcd,
+	0xa5,
+	0xcf,
+	0x85,
+	0xce,
+	0xa5,
+	0xd0,
+	0x49,
+	0x08,
+	0x84,
+	0xd0,
+	0xa5,
+	0xd1,
+	0x49,
+	0x08,
+	0x05,
+	0xd0,
+	0x85,
+	0xd0,
+	0x84,
+	0xd1,
+	0xa5,
+	0xd2,
+	0x49,
+	0x08,
+	0x05,
+	0xd1,
+	0x85,
+	0xd1,
+	0x84,
+	0xd2,
+	0x60,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0xa5,
+	0xc8,
+	0x0a,
+	0xa5,
+	0xc9,
+	0x2a,
+	0x85,
+	0xc8,
+	0xa5,
+	0xca,
+	0x2a,
+	0x85,
+	0xc9,
+	0xa5,
+	0xcb,
+	0x2a,
+	0x85,
+	0xca,
+	0xa5,
+	0xcc,
+	0x0a,
+	0xa5,
+	0xcd,
+	0x2a,
+	0x85,
+	0xcc,
+	0xa5,
+	0xce,
+	0x2a,
+	0x85,
+	0xcd,
+	0xa5,
+	0xcf,
+	0x2a,
+	0x85,
+	0xce,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x60,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0xa5,
+	0xc8,
+	0x49,
+	0x04,
+	0x84,
+	0xc8,
+	0xa5,
+	0xc9,
+	0x49,
+	0x04,
+	0x05,
+	0xc8,
+	0x85,
+	0xc8,
+	0x84,
+	0xc9,
+	0xa5,
+	0xca,
+	0x49,
+	0x04,
+	0x05,
+	0xc9,
+	0x85,
+	0xc9,
+	0x84,
+	0xca,
+	0xa5,
+	0xcc,
+	0x49,
+	0x04,
+	0x84,
+	0xcc,
+	0xa5,
+	0xcd,
+	0x49,
+	0x04,
+	0x05,
+	0xcc,
+	0x85,
+	0xcc,
+	0x84,
+	0xcd,
+	0xa5,
+	0xce,
+	0x49,
+	0x04,
+	0x05,
+	0xcd,
+	0x85,
+	0xcd,
+	0x84,
+	0xce,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x60,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0xa5,
+	0xc8,
+	0x49,
+	0x08,
+	0x84,
+	0xc8,
+	0xa5,
+	0xc9,
+	0x49,
+	0x08,
+	0x05,
+	0xc8,
+	0x85,
+	0xc8,
+	0x84,
+	0xc9,
+	0xa5,
+	0xca,
+	0x49,
+	0x08,
+	0x05,
+	0xc9,
+	0x85,
+	0xc9,
+	0x84,
+	0xca,
+	0xa5,
+	0xcc,
+	0x49,
+	0x08,
+	0x84,
+	0xcc,
+	0xa5,
+	0xcd,
+	0x49,
+	0x08,
+	0x05,
+	0xcc,
+	0x85,
+	0xcc,
+	0x84,
+	0xcd,
+	0xa5,
+	0xce,
+	0x49,
+	0x08,
+	0x05,
+	0xcd,
+	0x85,
+	0xcd,
+	0x84,
+	0xce,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x60,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x60,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x60,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x60,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x60,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x60,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x60,
+	0xa5,
+	0xc7,
+	0x49,
+	0x20,
+	0x85,
+	0xc7,
+	0xa5,
+	0xc6,
+	0x49,
+	0x20,
+	0x85,
+	0xc6,
+	0x98,
+	0x05,
+	0xc7,
+	0x85,
+	0xc7,
+	0xa5,
+	0xc5,
+	0x49,
+	0x20,
+	0x85,
+	0xc5,
+	0x98,
+	0x05,
+	0xc6,
+	0x85,
+	0xc6,
+	0xa5,
+	0xc4,
+	0x49,
+	0x20,
+	0x85,
+	0xc4,
+	0x98,
+	0x05,
+	0xc5,
+	0x85,
+	0xc5,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0xa5,
+	0xd3,
+	0x49,
+	0x20,
+	0x85,
+	0xd3,
+	0xa5,
+	0xd2,
+	0x49,
+	0x20,
+	0x85,
+	0xd2,
+	0x98,
+	0x05,
+	0xd3,
+	0x85,
+	0xd3,
+	0xa5,
+	0xd1,
+	0x49,
+	0x20,
+	0x85,
+	0xd1,
+	0x98,
+	0x05,
+	0xd2,
+	0x85,
+	0xd2,
+	0xa5,
+	0xd0,
+	0x49,
+	0x20,
+	0x85,
+	0xd0,
+	0x98,
+	0x05,
+	0xd1,
+	0x85,
+	0xd1,
+	0x60,
+	0xa5,
+	0xc7,
+	0x49,
+	0x40,
+	0x85,
+	0xc7,
+	0xa5,
+	0xc6,
+	0x49,
+	0x40,
+	0x85,
+	0xc6,
+	0x98,
+	0x05,
+	0xc7,
+	0x85,
+	0xc7,
+	0xa5,
+	0xc5,
+	0x49,
+	0x40,
+	0x85,
+	0xc5,
+	0x98,
+	0x05,
+	0xc6,
+	0x85,
+	0xc6,
+	0xa5,
+	0xc4,
+	0x49,
+	0x40,
+	0x85,
+	0xc4,
+	0x98,
+	0x05,
+	0xc5,
+	0x85,
+	0xc5,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0xa5,
+	0xd3,
+	0x49,
+	0x40,
+	0x85,
+	0xd3,
+	0xa5,
+	0xd2,
+	0x49,
+	0x40,
+	0x85,
+	0xd2,
+	0x98,
+	0x05,
+	0xd3,
+	0x85,
+	0xd3,
+	0xa5,
+	0xd1,
+	0x49,
+	0x40,
+	0x85,
+	0xd1,
+	0x98,
+	0x05,
+	0xd2,
+	0x85,
+	0xd2,
+	0xa5,
+	0xd0,
+	0x49,
+	0x40,
+	0x85,
+	0xd0,
+	0x98,
+	0x05,
+	0xd1,
+	0x85,
+	0xd1,
+	0x60,
+	0x20,
+	0x7b,
+	0x3b,
+	0x46,
+	0xe5,
+	0x66,
+	0xe4,
+	0x90,
+	0x06,
+	0xe6,
+	0xe4,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe5,
+	0x38,
+	0xa5,
+	0xe6,
+	0xe5,
+	0xe4,
+	0xa5,
+	0xe7,
+	0xe5,
+	0xe5,
+	0x30,
+	0x06,
+	0xe6,
+	0xe2,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe3,
+	0x60,
+	0x64,
+	0x22,
+	0x64,
+	0xa8,
+	0x9c,
+	0x9d,
+	0x6a,
+	0xa9,
+	0x77,
+	0x85,
+	0xe2,
+	0xa9,
+	0x60,
+	0x85,
+	0xe3,
+	0xa2,
+	0xc0,
+	0xa9,
+	0x03,
+	0x20,
+	0x90,
+	0x3e,
+	0xa9,
+	0x80,
+	0x85,
+	0xde,
+	0xa9,
+	0x1b,
+	0x85,
+	0xe2,
+	0xa9,
+	0x6c,
+	0x85,
+	0xe3,
+	0xa2,
+	0x94,
+	0xa9,
+	0x05,
+	0x20,
+	0x92,
+	0x3e,
+	0xa0,
+	0x06,
+	0x53,
+	0x4c,
+	0x5c,
+	0x79,
+	0x6b,
+	0xa0,
+	0x96,
+	0x13,
+	0xa8,
+	0x00,
+	0x85,
+	0x6b,
+	0xa9,
+	0x01,
+	0x8d,
+	0x18,
+	0x6b,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x2a,
+	0xbe,
+	0xe8,
+	0x00,
+	0x88,
+	0x98,
+	0x0a,
+	0xaa,
+	0xb9,
+	0xa3,
+	0x59,
+	0xd0,
+	0x14,
+	0x9e,
+	0x9c,
+	0x6a,
+	0x9e,
+	0x9d,
+	0x6a,
+	0x9e,
+	0xf4,
+	0x6a,
+	0x9e,
+	0xf5,
+	0x6a,
+	0x9e,
+	0x04,
+	0x6b,
+	0x9e,
+	0x05,
+	0x6b,
+	0x80,
+	0x6d,
+	0x5a,
+	0xda,
+	0xa5,
+	0xe9,
+	0xa6,
+	0xe8,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0xea,
+	0x86,
+	0xeb,
+	0xdc,
+	0x20,
+	0x5b,
+	0x0e,
+	0xfa,
+	0x9d,
+	0x9c,
+	0x6a,
+	0x9d,
+	0x9d,
+	0x6a,
+	0x49,
+	0x28,
+	0x85,
+	0xec,
+	0x84,
+	0xed,
+	0x38,
+	0xa5,
+	0xea,
+	0xe5,
+	0xec,
+	0x85,
+	0xec,
+	0xa5,
+	0xeb,
+	0xe5,
+	0xed,
+	0x05,
+	0xec,
+	0xf0,
+	0x03,
+	0xfe,
+	0x9d,
+	0x6a,
+	0xbd,
+	0x9d,
+	0x6a,
+	0x85,
+	0xe4,
+	0x64,
+	0xe5,
+	0xa9,
+	0x00,
+	0x85,
+	0xe2,
+	0xa9,
+	0x80,
+	0x85,
+	0xe3,
+	0xda,
+	0x20,
+	0x62,
+	0x1a,
+	0xfa,
+	0xa5,
+	0xe3,
+	0x9d,
+	0xf5,
+	0x6a,
+	0xa5,
+	0xe2,
+	0x9d,
+	0xf4,
+	0x6a,
+	0xbd,
+	0x9d,
+	0x6a,
+	0x85,
+	0xe4,
+	0x64,
+	0xe5,
+	0xa9,
+	0x00,
+	0x85,
+	0xe2,
+	0xa9,
+	0x40,
+	0x85,
+	0xe3,
+	0xda,
+	0x20,
+	0x62,
+	0x1a,
+	0xfa,
+	0xa5,
+	0xe3,
+	0x9d,
+	0x05,
+	0x6b,
+	0xa5,
+	0xe2,
+	0x9d,
+	0x04,
+	0x6b,
+	0x7a,
+	0xc8,
+	0xc0,
+	0x05,
+	0xb0,
+	0x03,
+	0x4c,
+	0xc8,
+	0x1a,
+	0xad,
+	0x9e,
+	0x6a,
+	0x49,
+	0x28,
+	0x85,
+	0xde,
+	0x38,
+	0xa5,
+	0xe8,
+	0xe5,
+	0xde,
+	0x4a,
+	0x85,
+	0xde,
+	0x64,
+	0xdf,
+	0xa9,
+	0xff,
+	0x85,
+	0xe8,
+	0x85,
+	0xe9,
+	0xa2,
+	0x01,
+	0x18,
+	0xa5,
+	0xe8,
+	0x6d,
+	0x9e,
+	0x6a,
+	0x85,
+	0xe8,
+	0x90,
+	0x02,
+	0xe6,
+	0xe9,
+	0x8a,
+	0x0a,
+	0x45,
+	0xde,
+	0x20,
+	0x55,
+	0x0e,
+	0xc5,
+	0xdf,
+	0xf0,
+	0x06,
+	0xe6,
+	0xe8,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe9,
+	0x85,
+	0xdf,
+	0xa5,
+	0xe8,
+	0x9d,
+	0xad,
+	0x6a,
+	0xa5,
+	0xe9,
+	0x9d,
+	0xc1,
+	0x6a,
+	0xe8,
+	0xe0,
+	0x15,
+	0x90,
+	0xd2,
+	0xa0,
+	0x02,
+	0x53,
+	0x2c,
+	0xbe,
+	0xe8,
+	0x00,
+	0x88,
+	0x98,
+	0x0a,
+	0xaa,
+	0xb9,
+	0xa3,
+	0x59,
+	0xd0,
+	0x14,
+	0x9e,
+	0xa4,
+	0x6a,
+	0x9e,
+	0xa5,
+	0x6a,
+	0x9e,
+	0xfc,
+	0x6a,
+	0x9e,
+	0xfd,
+	0x6a,
+	0x9e,
+	0x0c,
+	0x6b,
+	0x9e,
+	0x0d,
+	0x6b,
+	0x80,
+	0x6d,
+	0x5a,
+	0xda,
+	0xa5,
+	0xe9,
+	0xa6,
+	0xe8,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0xea,
+	0x86,
+	0xeb,
+	0xdc,
+	0x20,
+	0x93,
+	0x0e,
+	0xfa,
+	0x9d,
+	0xa4,
+	0x6a,
+	0x9d,
+	0xa5,
+	0x6a,
+	0x49,
+	0x20,
+	0x85,
+	0xec,
+	0x84,
+	0xed,
+	0x38,
+	0xa5,
+	0xea,
+	0xe5,
+	0xec,
+	0x85,
+	0xec,
+	0xa5,
+	0xeb,
+	0xe5,
+	0xed,
+	0x05,
+	0xec,
+	0xf0,
+	0x03,
+	0xfe,
+	0xa5,
+	0x6a,
+	0xbd,
+	0xa5,
+	0x6a,
+	0x85,
+	0xe4,
+	0x64,
+	0xe5,
+	0xa9,
+	0x00,
+	0x85,
+	0xe2,
+	0xa9,
+	0x80,
+	0x85,
+	0xe3,
+	0xda,
+	0x20,
+	0x62,
+	0x1a,
+	0xfa,
+	0xa5,
+	0xe3,
+	0x9d,
+	0xfd,
+	0x6a,
+	0xa5,
+	0xe2,
+	0x9d,
+	0xfc,
+	0x6a,
+	0xbd,
+	0xa5,
+	0x6a,
+	0x85,
+	0xe4,
+	0x64,
+	0xe5,
+	0xa9,
+	0x00,
+	0x85,
+	0xe2,
+	0xa9,
+	0x40,
+	0x85,
+	0xe3,
+	0xda,
+	0x20,
+	0x62,
+	0x1a,
+	0xfa,
+	0xa5,
+	0xe3,
+	0x9d,
+	0x0d,
+	0x6b,
+	0xa5,
+	0xe2,
+	0x9d,
+	0x0c,
+	0x6b,
+	0x7a,
+	0xc8,
+	0xc0,
+	0x05,
+	0xb0,
+	0x03,
+	0x4c,
+	0xa8,
+	0x1b,
+	0xad,
+	0xa6,
+	0x6a,
+	0x49,
+	0x20,
+	0x85,
+	0xde,
+	0x38,
+	0xa5,
+	0xe8,
+	0xe5,
+	0xde,
+	0x4a,
+	0x85,
+	0xde,
+	0x64,
+	0xdf,
+	0xa9,
+	0xff,
+	0x85,
+	0xe8,
+	0x85,
+	0xe9,
+	0xa2,
+	0x01,
+	0x18,
+	0xa5,
+	0xe8,
+	0x6d,
+	0xa6,
+	0x6a,
+	0x85,
+	0xe8,
+	0x90,
+	0x02,
+	0xe6,
+	0xe9,
+	0x8a,
+	0x0a,
+	0x45,
+	0xde,
+	0x20,
+	0x8d,
+	0x0e,
+	0xc5,
+	0xdf,
+	0xf0,
+	0x06,
+	0xe6,
+	0xe8,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe9,
+	0x85,
+	0xdf,
+	0xa5,
+	0xe8,
+	0x9d,
+	0xd5,
+	0x6a,
+	0xa5,
+	0xe9,
+	0x9d,
+	0xe5,
+	0x6a,
+	0xe8,
+	0xe0,
+	0x11,
+	0x90,
+	0xd2,
+	0xa9,
+	0x01,
+	0x8d,
+	0x9d,
+	0x6a,
+	0x60,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xa9,
+	0x3e,
+	0x48,
+	0xad,
+	0x34,
+	0xc0,
+	0xaa,
+	0x29,
+	0x03,
+	0xc9,
+	0x02,
+	0xd0,
+	0x07,
+	0xad,
+	0x76,
+	0x60,
+	0xd0,
+	0x07,
+	0x80,
+	0x38,
+	0x8a,
+	0x29,
+	0xf8,
+	0xf0,
+	0x1b,
+	0xac,
+	0x76,
+	0x60,
+	0xf0,
+	0x06,
+	0x8a,
+	0x4a,
+	0x4a,
+	0x20,
+	0x47,
+	0x3c,
+	0xa5,
+	0xba,
+	0xf0,
+	0x24,
+	0x8a,
+	0x29,
+	0x04,
+	0x09,
+	0x09,
+	0x8d,
+	0x38,
+	0xc0,
+	0xc6,
+	0xba,
+	0x80,
+	0x18,
+	0xa5,
+	0xab,
+	0xf0,
+	0x14,
+	0x8a,
+	0x4a,
+	0x4a,
+	0x20,
+	0xc5,
+	0x39,
+	0xa0,
+	0x01,
+	0x8a,
+	0x4a,
+	0x4a,
+	0x29,
+	0x01,
+	0xf0,
+	0x02,
+	0xa0,
+	0x05,
+	0x8c,
+	0x38,
+	0xc0,
+	0x8a,
+	0x29,
+	0x03,
+	0xc9,
+	0x02,
+	0xd0,
+	0x42,
+	0xa5,
+	0xbe,
+	0xf0,
+	0x0f,
+	0x49,
+	0x3c,
+	0xaa,
+	0xa9,
+	0x77,
+	0x85,
+	0xe2,
+	0xa9,
+	0x60,
+	0x85,
+	0xe3,
+	0x98,
+	0x20,
+	0x90,
+	0x3e,
+	0x38,
+	0xa9,
+	0x0f,
+	0xe5,
+	0xbf,
+	0xf0,
+	0x1a,
+	0x49,
+	0x3c,
+	0x85,
+	0xe4,
+	0x84,
+	0xe5,
+	0x38,
+	0xa9,
+	0x37,
+	0xe5,
+	0xe4,
+	0x85,
+	0xe2,
+	0xa9,
+	0x64,
+	0xe5,
+	0xe5,
+	0x85,
+	0xe3,
+	0xa6,
+	0xe4,
+	0xa5,
+	0xe5,
+	0x20,
+	0x90,
+	0x3e,
+	0xa9,
+	0x01,
+	0x9c,
+	0x24,
+	0xd0,
+	0x8d,
+	0x24,
+	0xd0,
+	0x9c,
+	0x75,
+	0x60,
+	0x20,
+	0x36,
+	0x3f,
+	0x4c,
+	0x0b,
+	0x3f,
+	0xa6,
+	0x67,
+	0xbd,
+	0x7a,
+	0x74,
+	0xaa,
+	0x18,
+	0x69,
+	0xb7,
+	0x85,
+	0x50,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x51,
+	0x8a,
+	0x0a,
+	0xaa,
+	0x69,
+	0xf3,
+	0x85,
+	0x4a,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x4b,
+	0x8a,
+	0x69,
+	0x6b,
+	0x85,
+	0x4c,
+	0xa9,
+	0x7e,
+	0x69,
+	0x00,
+	0x85,
+	0x4d,
+	0x8a,
+	0x69,
+	0x3f,
+	0x85,
+	0x4e,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x4f,
+	0xa6,
+	0x67,
+	0xbd,
+	0x8c,
+	0x74,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x52,
+	0x5e,
+	0x85,
+	0x56,
+	0xbd,
+	0x53,
+	0x5e,
+	0x85,
+	0x57,
+	0xbd,
+	0x58,
+	0x5e,
+	0x85,
+	0x58,
+	0xbd,
+	0x59,
+	0x5e,
+	0x85,
+	0x59,
+	0xa5,
+	0x67,
+	0x49,
+	0x7e,
+	0x18,
+	0x69,
+	0x9d,
+	0x85,
+	0x52,
+	0x98,
+	0x69,
+	0x74,
+	0x85,
+	0x53,
+	0xa5,
+	0x28,
+	0x49,
+	0x06,
+	0x18,
+	0x65,
+	0x52,
+	0x85,
+	0x52,
+	0x98,
+	0x65,
+	0x53,
+	0x85,
+	0x53,
+	0xa0,
+	0x02,
+	0x53,
+	0x2a,
+	0x00,
+	0x3a,
+	0x00,
+	0xa5,
+	0x28,
+	0x85,
+	0x66,
+	0x0a,
+	0x85,
+	0x31,
+	0xa0,
+	0x05,
+	0xd3,
+	0x3a,
+	0x3e,
+	0x00,
+	0x18,
+	0xa5,
+	0x3f,
+	0x65,
+	0x42,
+	0x6a,
+	0x69,
+	0x00,
+	0xaa,
+	0xbd,
+	0x52,
+	0x5d,
+	0x85,
+	0x33,
+	0xbd,
+	0x52,
+	0x5c,
+	0x85,
+	0x32,
+	0xa6,
+	0x40,
+	0x38,
+	0xfd,
+	0x52,
+	0x5c,
+	0xa8,
+	0xa5,
+	0x33,
+	0xfd,
+	0x52,
+	0x5d,
+	0xaa,
+	0x10,
+	0x0c,
+	0x29,
+	0xf0,
+	0xc9,
+	0xf0,
+	0xf0,
+	0x0e,
+	0xa0,
+	0x00,
+	0xa2,
+	0xf0,
+	0x80,
+	0x08,
+	0x29,
+	0xf0,
+	0xf0,
+	0x04,
+	0xa0,
+	0xff,
+	0xa2,
+	0x0f,
+	0x98,
+	0xa4,
+	0x31,
+	0x91,
+	0x4a,
+	0xc8,
+	0x8a,
+	0x91,
+	0x4a,
+	0xa6,
+	0x41,
+	0x38,
+	0xa5,
+	0x32,
+	0xfd,
+	0x52,
+	0x5c,
+	0xa8,
+	0xa5,
+	0x33,
+	0xfd,
+	0x52,
+	0x5d,
+	0xaa,
+	0x10,
+	0x0c,
+	0x29,
+	0xf0,
+	0xc9,
+	0xf0,
+	0xf0,
+	0x0e,
+	0xa0,
+	0x00,
+	0xa2,
+	0xf0,
+	0x80,
+	0x08,
+	0x29,
+	0xf0,
+	0xf0,
+	0x04,
+	0xa0,
+	0xff,
+	0xa2,
+	0x0f,
+	0x98,
+	0xa4,
+	0x31,
+	0x91,
+	0x4c,
+	0xc8,
+	0x8a,
+	0x91,
+	0x4c,
+	0xa6,
+	0x3f,
+	0xbd,
+	0x52,
+	0x5d,
+	0x48,
+	0xbd,
+	0x52,
+	0x5c,
+	0xa6,
+	0x42,
+	0x38,
+	0xfd,
+	0x52,
+	0x5c,
+	0xa8,
+	0x68,
+	0xfd,
+	0x52,
+	0x5d,
+	0xaa,
+	0x10,
+	0x0c,
+	0x29,
+	0xf8,
+	0xc9,
+	0xf8,
+	0xf0,
+	0x0e,
+	0xa0,
+	0x00,
+	0xa2,
+	0xf8,
+	0x80,
+	0x08,
+	0x29,
+	0xf8,
+	0xf0,
+	0x04,
+	0xa0,
+	0xff,
+	0xa2,
+	0x07,
+	0x98,
+	0xa4,
+	0x31,
+	0x91,
+	0x4e,
+	0xc8,
+	0x8a,
+	0x91,
+	0x4e,
+	0xa2,
+	0x01,
+	0xa5,
+	0x3e,
+	0xcd,
+	0x2f,
+	0xbe,
+	0x90,
+	0x07,
+	0xcd,
+	0x30,
+	0xbe,
+	0x90,
+	0x03,
+	0xf0,
+	0x01,
+	0xca,
+	0x8a,
+	0xa4,
+	0x66,
+	0x91,
+	0x50,
+	0x64,
+	0x30,
+	0xa9,
+	0x00,
+	0x85,
+	0x6d,
+	0x49,
+	0x03,
+	0x85,
+	0x38,
+	0x64,
+	0x34,
+	0x64,
+	0x35,
+	0xa9,
+	0x03,
+	0x85,
+	0x6c,
+	0x18,
+	0xa5,
+	0x38,
+	0xa6,
+	0x30,
+	0x7d,
+	0x07,
+	0x7d,
+	0x65,
+	0x52,
+	0x85,
+	0x36,
+	0xa5,
+	0x53,
+	0x69,
+	0x00,
+	0x85,
+	0x37,
+	0xa2,
+	0x00,
+	0xb2,
+	0x36,
+	0xa0,
+	0x06,
+	0x71,
+	0x36,
+	0x90,
+	0x02,
+	0xe8,
+	0x18,
+	0xa0,
+	0x7e,
+	0x71,
+	0x36,
+	0x90,
+	0x02,
+	0xe8,
+	0x18,
+	0xa0,
+	0x84,
+	0x71,
+	0x36,
+	0x90,
+	0x01,
+	0xe8,
+	0x86,
+	0x2e,
+	0x46,
+	0x2e,
+	0x6a,
+	0x46,
+	0x2e,
+	0x6a,
+	0x69,
+	0x00,
+	0x92,
+	0x56,
+	0xa4,
+	0x30,
+	0x59,
+	0x79,
+	0x6b,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x65,
+	0x35,
+	0x85,
+	0x35,
+	0xe6,
+	0x56,
+	0xd0,
+	0x02,
+	0xe6,
+	0x57,
+	0xe6,
+	0x30,
+	0xc6,
+	0x6c,
+	0xd0,
+	0xad,
+	0xa5,
+	0x34,
+	0x0a,
+	0xaa,
+	0xa5,
+	0x35,
+	0x2a,
+	0xe0,
+	0x80,
+	0x90,
+	0x04,
+	0x1a,
+	0xd0,
+	0x01,
+	0x3a,
+	0x92,
+	0x58,
+	0xe6,
+	0x58,
+	0xd0,
+	0x02,
+	0xe6,
+	0x59,
+	0xa5,
+	0x6d,
+	0x1a,
+	0xc9,
+	0x02,
+	0xd0,
+	0x80,
+	0xa5,
+	0x52,
+	0x18,
+	0x69,
+	0x06,
+	0x85,
+	0x52,
+	0x90,
+	0x02,
+	0xe6,
+	0x53,
+	0xa6,
+	0x66,
+	0xe4,
+	0x29,
+	0xf0,
+	0x0f,
+	0xa5,
+	0x3a,
+	0x69,
+	0x05,
+	0x85,
+	0x3a,
+	0x90,
+	0x02,
+	0xe6,
+	0x3b,
+	0x8a,
+	0x1a,
+	0x4c,
+	0x96,
+	0x1d,
+	0xa5,
+	0x2a,
+	0xa6,
+	0x23,
+	0xf0,
+	0x0b,
+	0x38,
+	0xe9,
+	0x64,
+	0x85,
+	0x2a,
+	0xb0,
+	0x0d,
+	0xc6,
+	0x2b,
+	0x80,
+	0x09,
+	0x18,
+	0x69,
+	0x64,
+	0x85,
+	0x2a,
+	0x90,
+	0x02,
+	0xe6,
+	0x2b,
+	0x60,
+	0xa4,
+	0x28,
+	0x84,
+	0x61,
+	0x84,
+	0x62,
+	0xc4,
+	0x29,
+	0xf0,
+	0x02,
+	0xe6,
+	0x62,
+	0xb1,
+	0x5a,
+	0xf0,
+	0x20,
+	0x31,
+	0x5c,
+	0x31,
+	0x5e,
+	0xfc,
+	0xa4,
+	0x61,
+	0x31,
+	0x5c,
+	0x31,
+	0x5a,
+	0x31,
+	0x5e,
+	0xa4,
+	0x62,
+	0x31,
+	0x5c,
+	0x31,
+	0x5a,
+	0x31,
+	0x5e,
+	0xdc,
+	0x29,
+	0x01,
+	0xd0,
+	0x04,
+	0xb1,
+	0x5a,
+	0x80,
+	0x02,
+	0x09,
+	0x02,
+	0x91,
+	0x5a,
+	0x84,
+	0x61,
+	0xc8,
+	0xc4,
+	0x29,
+	0x90,
+	0xd1,
+	0xf0,
+	0xd1,
+	0x60,
+	0xa2,
+	0x01,
+	0xa5,
+	0x67,
+	0xc5,
+	0x26,
+	0xf0,
+	0x06,
+	0xc5,
+	0x27,
+	0xf0,
+	0x02,
+	0xa2,
+	0x00,
+	0x86,
+	0x88,
+	0x85,
+	0x64,
+	0x1a,
+	0x85,
+	0x63,
+	0x1a,
+	0x85,
+	0x65,
+	0x18,
+	0xa6,
+	0x67,
+	0xa9,
+	0xb7,
+	0xa8,
+	0x7d,
+	0x79,
+	0x74,
+	0x85,
+	0x5c,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x5d,
+	0x98,
+	0x7d,
+	0x7a,
+	0x74,
+	0x85,
+	0x5a,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x5b,
+	0x98,
+	0x7d,
+	0x7b,
+	0x74,
+	0x85,
+	0x5e,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x5f,
+	0x20,
+	0x17,
+	0x1f,
+	0xa6,
+	0x63,
+	0xbd,
+	0x8b,
+	0x74,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x52,
+	0x5e,
+	0x85,
+	0x4a,
+	0xbd,
+	0x53,
+	0x5e,
+	0x85,
+	0x4b,
+	0xbd,
+	0x58,
+	0x5e,
+	0x85,
+	0x52,
+	0xbd,
+	0x59,
+	0x5e,
+	0x85,
+	0x53,
+	0xa5,
+	0x28,
+	0xc5,
+	0x29,
+	0xf0,
+	0x1b,
+	0x18,
+	0xa5,
+	0x4a,
+	0x69,
+	0x06,
+	0x85,
+	0x4c,
+	0xa5,
+	0x4b,
+	0x69,
+	0x00,
+	0x85,
+	0x4d,
+	0xa5,
+	0x52,
+	0x69,
+	0x02,
+	0x85,
+	0x54,
+	0xa5,
+	0x53,
+	0x69,
+	0x00,
+	0x85,
+	0x55,
+	0x80,
+	0x0c,
+	0xa0,
+	0x02,
+	0x53,
+	0x4a,
+	0x00,
+	0x4c,
+	0x00,
+	0x53,
+	0x52,
+	0x00,
+	0x54,
+	0x00,
+	0xa6,
+	0x64,
+	0xbd,
+	0x8b,
+	0x74,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x52,
+	0x5e,
+	0x85,
+	0x4e,
+	0xbd,
+	0x53,
+	0x5e,
+	0x85,
+	0x4f,
+	0xbd,
+	0x58,
+	0x5e,
+	0x85,
+	0x56,
+	0xbd,
+	0x59,
+	0x5e,
+	0x85,
+	0x57,
+	0xa6,
+	0x65,
+	0xbd,
+	0x8b,
+	0x74,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x52,
+	0x5e,
+	0x85,
+	0x50,
+	0xbd,
+	0x53,
+	0x5e,
+	0x85,
+	0x51,
+	0xbd,
+	0x58,
+	0x5e,
+	0x85,
+	0x58,
+	0xbd,
+	0x59,
+	0x5e,
+	0x85,
+	0x59,
+	0xa0,
+	0x02,
+	0x53,
+	0x5a,
+	0x00,
+	0x3c,
+	0x00,
+	0x18,
+	0xa6,
+	0x67,
+	0xbd,
+	0x79,
+	0x74,
+	0x0a,
+	0x69,
+	0x3f,
+	0x85,
+	0x5c,
+	0xa9,
+	0x7d,
+	0xa8,
+	0x69,
+	0x00,
+	0x85,
+	0x5d,
+	0xbd,
+	0x7a,
+	0x74,
+	0x0a,
+	0x69,
+	0x3f,
+	0x85,
+	0x5a,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x5b,
+	0xbd,
+	0x7b,
+	0x74,
+	0x0a,
+	0x69,
+	0x3f,
+	0x85,
+	0x5e,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x5f,
+	0xa5,
+	0x28,
+	0xaa,
+	0x85,
+	0x66,
+	0x0a,
+	0x85,
+	0x61,
+	0x8a,
+	0xa0,
+	0x01,
+	0x64,
+	0x89,
+	0xc5,
+	0x29,
+	0xf0,
+	0x01,
+	0x1a,
+	0x0a,
+	0x85,
+	0x62,
+	0x84,
+	0x87,
+	0xa4,
+	0x66,
+	0xb1,
+	0x3c,
+	0x29,
+	0x02,
+	0xf0,
+	0x0b,
+	0x20,
+	0x19,
+	0x21,
+	0x20,
+	0x0d,
+	0x22,
+	0x20,
+	0x98,
+	0x24,
+	0x80,
+	0x0e,
+	0x64,
+	0x93,
+	0x64,
+	0x94,
+	0x64,
+	0x95,
+	0x64,
+	0x96,
+	0x20,
+	0x0d,
+	0x22,
+	0x20,
+	0x98,
+	0x24,
+	0xa6,
+	0x89,
+	0xbd,
+	0x1b,
+	0x7d,
+	0xe8,
+	0x29,
+	0x80,
+	0xd0,
+	0xf8,
+	0x86,
+	0x89,
+	0x18,
+	0xa5,
+	0x4e,
+	0x69,
+	0x06,
+	0x85,
+	0x4e,
+	0x90,
+	0x03,
+	0xe6,
+	0x4f,
+	0x18,
+	0xa5,
+	0x50,
+	0x69,
+	0x06,
+	0x85,
+	0x50,
+	0x90,
+	0x03,
+	0xe6,
+	0x51,
+	0x18,
+	0xa5,
+	0x56,
+	0x69,
+	0x02,
+	0x85,
+	0x56,
+	0x90,
+	0x03,
+	0xe6,
+	0x57,
+	0x18,
+	0xa5,
+	0x58,
+	0x69,
+	0x02,
+	0x85,
+	0x58,
+	0x90,
+	0x02,
+	0xe6,
+	0x59,
+	0xa5,
+	0x66,
+	0xaa,
+	0x0a,
+	0x85,
+	0x61,
+	0xe4,
+	0x28,
+	0xf0,
+	0x16,
+	0x18,
+	0xa5,
+	0x4a,
+	0x69,
+	0x06,
+	0x85,
+	0x4a,
+	0x90,
+	0x03,
+	0xe6,
+	0x4b,
+	0x18,
+	0xa5,
+	0x52,
+	0x69,
+	0x02,
+	0x85,
+	0x52,
+	0x90,
+	0x02,
+	0xe6,
+	0x53,
+	0xa0,
+	0x00,
+	0xe8,
+	0x86,
+	0x66,
+	0xe4,
+	0x29,
+	0xf0,
+	0x16,
+	0x18,
+	0xa5,
+	0x4c,
+	0x69,
+	0x06,
+	0x85,
+	0x4c,
+	0x90,
+	0x03,
+	0xe6,
+	0x4d,
+	0x18,
+	0xa5,
+	0x54,
+	0x69,
+	0x02,
+	0x85,
+	0x54,
+	0x90,
+	0x02,
+	0xe6,
+	0x55,
+	0x8a,
+	0xe4,
+	0x29,
+	0xb0,
+	0x03,
+	0x4c,
+	0x59,
+	0x20,
+	0xd0,
+	0x04,
+	0xc8,
+	0x4c,
+	0x5d,
+	0x20,
+	0xa6,
+	0x8a,
+	0xbd,
+	0x2f,
+	0x7d,
+	0xa4,
+	0x23,
+	0xf0,
+	0x03,
+	0xca,
+	0x80,
+	0x01,
+	0xe8,
+	0x29,
+	0x80,
+	0xd0,
+	0xf1,
+	0x86,
+	0x8a,
+	0x60,
+	0xa4,
+	0x62,
+	0xb1,
+	0x5a,
+	0xc8,
+	0x0a,
+	0xaa,
+	0xb1,
+	0x5a,
+	0x88,
+	0x2a,
+	0x48,
+	0x18,
+	0x8a,
+	0x71,
+	0x5c,
+	0xc8,
+	0xaa,
+	0x68,
+	0x71,
+	0x5c,
+	0x88,
+	0x48,
+	0x18,
+	0x8a,
+	0x71,
+	0x5e,
+	0xc8,
+	0xaa,
+	0x68,
+	0x71,
+	0x5e,
+	0x48,
+	0xda,
+	0xa4,
+	0x61,
+	0xb1,
+	0x5a,
+	0xc8,
+	0x0a,
+	0xaa,
+	0xb1,
+	0x5a,
+	0x88,
+	0x2a,
+	0x48,
+	0x18,
+	0x8a,
+	0x71,
+	0x5c,
+	0xc8,
+	0xaa,
+	0x68,
+	0x71,
+	0x5c,
+	0x88,
+	0x48,
+	0x18,
+	0x8a,
+	0x71,
+	0x5e,
+	0x85,
+	0x93,
+	0xc8,
+	0x68,
+	0x71,
+	0x5e,
+	0x85,
+	0x94,
+	0x38,
+	0x68,
+	0xe5,
+	0x93,
+	0x85,
+	0x93,
+	0x68,
+	0xe5,
+	0x94,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x93,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x93,
+	0xa6,
+	0x87,
+	0xd0,
+	0x05,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x93,
+	0x90,
+	0x05,
+	0xe6,
+	0x93,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x94,
+	0xa5,
+	0x66,
+	0x0a,
+	0xa8,
+	0x38,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0xaa,
+	0xc8,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0x85,
+	0x96,
+	0x8a,
+	0x0a,
+	0x85,
+	0x95,
+	0x26,
+	0x96,
+	0xa4,
+	0x61,
+	0x38,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0xaa,
+	0xc8,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0xa8,
+	0x8a,
+	0x18,
+	0x65,
+	0x95,
+	0x85,
+	0x95,
+	0x98,
+	0x65,
+	0x96,
+	0x85,
+	0x96,
+	0xa4,
+	0x62,
+	0x38,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0xaa,
+	0xc8,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0xa8,
+	0x8a,
+	0x18,
+	0x65,
+	0x95,
+	0x85,
+	0x95,
+	0x98,
+	0x65,
+	0x96,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x95,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x95,
+	0xa6,
+	0x88,
+	0xd0,
+	0x05,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x95,
+	0x90,
+	0x05,
+	0xe6,
+	0x95,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x96,
+	0xa5,
+	0x66,
+	0x0a,
+	0xa8,
+	0xb1,
+	0x5a,
+	0x65,
+	0x6e,
+	0x85,
+	0x6e,
+	0xc8,
+	0xa2,
+	0xff,
+	0xb1,
+	0x5a,
+	0x30,
+	0x01,
+	0xe8,
+	0x65,
+	0x6f,
+	0x85,
+	0x6f,
+	0x8a,
+	0x65,
+	0x70,
+	0x85,
+	0x70,
+	0x8a,
+	0x65,
+	0x71,
+	0x85,
+	0x71,
+	0xe6,
+	0x72,
+	0xd0,
+	0x02,
+	0xe6,
+	0x73,
+	0x60,
+	0xa5,
+	0x66,
+	0x0a,
+	0x85,
+	0x2e,
+	0x64,
+	0x2f,
+	0x64,
+	0x38,
+	0x64,
+	0x39,
+	0x64,
+	0x6d,
+	0xa9,
+	0xf3,
+	0xa2,
+	0x7d,
+	0x80,
+	0x04,
+	0xa9,
+	0x6b,
+	0xa2,
+	0x7e,
+	0x85,
+	0x32,
+	0x86,
+	0x33,
+	0xa4,
+	0x67,
+	0xb9,
+	0x7a,
+	0x74,
+	0x0a,
+	0x65,
+	0x32,
+	0x85,
+	0x34,
+	0xa5,
+	0x33,
+	0x69,
+	0x00,
+	0x85,
+	0x35,
+	0xa4,
+	0x62,
+	0xb1,
+	0x34,
+	0xa4,
+	0x61,
+	0x38,
+	0xf1,
+	0x34,
+	0xaa,
+	0xa4,
+	0x62,
+	0xc8,
+	0xb1,
+	0x34,
+	0xa4,
+	0x61,
+	0xc8,
+	0xf1,
+	0x34,
+	0xa4,
+	0x87,
+	0xd0,
+	0x11,
+	0xc9,
+	0x80,
+	0x6a,
+	0x85,
+	0x69,
+	0x8a,
+	0x6a,
+	0x69,
+	0x00,
+	0x85,
+	0x68,
+	0x90,
+	0x1f,
+	0xaa,
+	0xa5,
+	0x69,
+	0x1a,
+	0xa8,
+	0x10,
+	0x0c,
+	0x29,
+	0xf0,
+	0xc9,
+	0xf0,
+	0xf0,
+	0x0e,
+	0xa2,
+	0x00,
+	0xa0,
+	0xf0,
+	0x80,
+	0x08,
+	0x29,
+	0xf0,
+	0xf0,
+	0x04,
+	0xa2,
+	0xff,
+	0xa0,
+	0x0f,
+	0x86,
+	0x68,
+	0x84,
+	0x69,
+	0xa4,
+	0x65,
+	0xb9,
+	0x79,
+	0x74,
+	0x0a,
+	0x65,
+	0x32,
+	0x85,
+	0x34,
+	0xa5,
+	0x33,
+	0xaa,
+	0x69,
+	0x00,
+	0x85,
+	0x35,
+	0xa4,
+	0x64,
+	0xb9,
+	0x79,
+	0x74,
+	0x0a,
+	0x65,
+	0x32,
+	0x85,
+	0x36,
+	0x8a,
+	0x69,
+	0x00,
+	0x85,
+	0x37,
+	0xa4,
+	0x2e,
+	0xb1,
+	0x34,
+	0x38,
+	0xf1,
+	0x36,
+	0xaa,
+	0xc8,
+	0xb1,
+	0x34,
+	0xf1,
+	0x36,
+	0xa4,
+	0x88,
+	0xd0,
+	0x11,
+	0xc9,
+	0x80,
+	0x6a,
+	0x85,
+	0x6b,
+	0x8a,
+	0x6a,
+	0x69,
+	0x00,
+	0x85,
+	0x6a,
+	0x90,
+	0x1f,
+	0xaa,
+	0xa5,
+	0x6b,
+	0x1a,
+	0xa8,
+	0x10,
+	0x0c,
+	0x29,
+	0xf0,
+	0xc9,
+	0xf0,
+	0xf0,
+	0x0e,
+	0xa2,
+	0x00,
+	0xa0,
+	0xf0,
+	0x80,
+	0x08,
+	0x29,
+	0xf0,
+	0xf0,
+	0x04,
+	0xa2,
+	0xff,
+	0xa0,
+	0x0f,
+	0x86,
+	0x6a,
+	0x84,
+	0x6b,
+	0xa9,
+	0x03,
+	0x85,
+	0x6c,
+	0xa4,
+	0x2f,
+	0xb1,
+	0x4a,
+	0xaa,
+	0xb1,
+	0x4c,
+	0xa8,
+	0xbd,
+	0x52,
+	0x5c,
+	0x38,
+	0xf9,
+	0x52,
+	0x5c,
+	0x85,
+	0x32,
+	0xbd,
+	0x52,
+	0x5d,
+	0xf9,
+	0x52,
+	0x5d,
+	0xa4,
+	0x87,
+	0xd0,
+	0x0c,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x32,
+	0x90,
+	0x05,
+	0xe6,
+	0x32,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x33,
+	0xaa,
+	0x18,
+	0xa5,
+	0x32,
+	0x65,
+	0x68,
+	0x85,
+	0x32,
+	0x8a,
+	0x65,
+	0x69,
+	0x85,
+	0x33,
+	0x10,
+	0x0d,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x32,
+	0x85,
+	0x32,
+	0xa9,
+	0x00,
+	0xe5,
+	0x33,
+	0x85,
+	0x33,
+	0xa4,
+	0x2f,
+	0xb1,
+	0x4e,
+	0xaa,
+	0xb1,
+	0x50,
+	0xa8,
+	0xbd,
+	0x52,
+	0x5c,
+	0x38,
+	0xf9,
+	0x52,
+	0x5c,
+	0x85,
+	0x34,
+	0xbd,
+	0x52,
+	0x5d,
+	0xf9,
+	0x52,
+	0x5d,
+	0xa4,
+	0x88,
+	0xd0,
+	0x0c,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x34,
+	0x90,
+	0x05,
+	0xe6,
+	0x34,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x35,
+	0xaa,
+	0x18,
+	0xa5,
+	0x34,
+	0x65,
+	0x6a,
+	0x85,
+	0x34,
+	0x8a,
+	0x65,
+	0x6b,
+	0x85,
+	0x35,
+	0x10,
+	0x0d,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x34,
+	0x85,
+	0x34,
+	0xa9,
+	0x00,
+	0xe5,
+	0x35,
+	0x85,
+	0x35,
+	0xc5,
+	0x33,
+	0x90,
+	0x11,
+	0xf0,
+	0x09,
+	0xa0,
+	0x02,
+	0x53,
+	0x34,
+	0x00,
+	0x32,
+	0x00,
+	0x80,
+	0x06,
+	0xa5,
+	0x34,
+	0xc5,
+	0x32,
+	0xb0,
+	0xf1,
+	0xa5,
+	0x2f,
+	0x49,
+	0x03,
+	0xaa,
+	0x18,
+	0xa5,
+	0x32,
+	0x7d,
+	0xc3,
+	0x80,
+	0x9d,
+	0xc3,
+	0x80,
+	0xa5,
+	0x33,
+	0x7d,
+	0xc4,
+	0x80,
+	0x9d,
+	0xc4,
+	0x80,
+	0x90,
+	0x03,
+	0xfe,
+	0xc5,
+	0x80,
+	0xe6,
+	0x2f,
+	0xc6,
+	0x6c,
+	0xf0,
+	0x03,
+	0x4c,
+	0xdd,
+	0x22,
+	0xa4,
+	0x6d,
+	0xb1,
+	0x52,
+	0xaa,
+	0xb1,
+	0x54,
+	0xa8,
+	0xbd,
+	0x52,
+	0x5c,
+	0x38,
+	0xf9,
+	0x52,
+	0x5c,
+	0x85,
+	0x32,
+	0xbd,
+	0x52,
+	0x5d,
+	0xf9,
+	0x52,
+	0x5d,
+	0xa4,
+	0x87,
+	0xd0,
+	0x0c,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x32,
+	0x90,
+	0x05,
+	0xe6,
+	0x32,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x33,
+	0xaa,
+	0x18,
+	0xa5,
+	0x32,
+	0x65,
+	0x68,
+	0x85,
+	0x32,
+	0x8a,
+	0x65,
+	0x69,
+	0x85,
+	0x33,
+	0x10,
+	0x1a,
+	0x18,
+	0xa5,
+	0x38,
+	0x65,
+	0x32,
+	0xa5,
+	0x39,
+	0x65,
+	0x33,
+	0xb0,
+	0x21,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x32,
+	0x85,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x33,
+	0x85,
+	0x39,
+	0x80,
+	0x12,
+	0x38,
+	0xa5,
+	0x38,
+	0xe5,
+	0x32,
+	0xa5,
+	0x39,
+	0xe5,
+	0x33,
+	0xb0,
+	0x07,
+	0xa0,
+	0x02,
+	0x53,
+	0x32,
+	0x00,
+	0x38,
+	0x00,
+	0xa4,
+	0x6d,
+	0xb1,
+	0x56,
+	0xaa,
+	0xb1,
+	0x58,
+	0xa8,
+	0xbd,
+	0x52,
+	0x5c,
+	0x38,
+	0xf9,
+	0x52,
+	0x5c,
+	0x85,
+	0x34,
+	0xbd,
+	0x52,
+	0x5d,
+	0xf9,
+	0x52,
+	0x5d,
+	0xa4,
+	0x88,
+	0xd0,
+	0x0c,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x34,
+	0x90,
+	0x05,
+	0xe6,
+	0x34,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x35,
+	0xaa,
+	0x18,
+	0xa5,
+	0x34,
+	0x65,
+	0x6a,
+	0x85,
+	0x34,
+	0x8a,
+	0x65,
+	0x6b,
+	0x85,
+	0x35,
+	0x10,
+	0x1a,
+	0x18,
+	0xa5,
+	0x38,
+	0x65,
+	0x34,
+	0xa5,
+	0x39,
+	0x65,
+	0x35,
+	0xb0,
+	0x21,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x34,
+	0x85,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x35,
+	0x85,
+	0x39,
+	0x80,
+	0x12,
+	0x38,
+	0xa5,
+	0x38,
+	0xe5,
+	0x34,
+	0xa5,
+	0x39,
+	0xe5,
+	0x35,
+	0xb0,
+	0x07,
+	0xa0,
+	0x02,
+	0x53,
+	0x34,
+	0x00,
+	0x38,
+	0x00,
+	0xa0,
+	0x04,
+	0xa5,
+	0x6d,
+	0xd0,
+	0x07,
+	0x53,
+	0x32,
+	0x00,
+	0x8b,
+	0x00,
+	0x80,
+	0x05,
+	0x53,
+	0x32,
+	0x00,
+	0x8f,
+	0x00,
+	0xd0,
+	0x05,
+	0xe6,
+	0x6d,
+	0x4c,
+	0x20,
+	0x22,
+	0x38,
+	0xa5,
+	0x38,
+	0xed,
+	0x31,
+	0xbe,
+	0xa5,
+	0x39,
+	0xed,
+	0x32,
+	0xbe,
+	0x90,
+	0x09,
+	0x64,
+	0x8b,
+	0xa0,
+	0x07,
+	0x13,
+	0x8b,
+	0x00,
+	0x8c,
+	0x00,
+	0x60,
+	0xa2,
+	0x00,
+	0xa5,
+	0x94,
+	0x10,
+	0x0f,
+	0x85,
+	0x42,
+	0x38,
+	0x8a,
+	0xe5,
+	0x93,
+	0x85,
+	0x93,
+	0x8a,
+	0xe5,
+	0x94,
+	0x85,
+	0x94,
+	0x80,
+	0x08,
+	0x05,
+	0x93,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x42,
+	0xa5,
+	0x2c,
+	0xf0,
+	0x14,
+	0x45,
+	0x93,
+	0x84,
+	0x93,
+	0xa5,
+	0x94,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2c,
+	0x18,
+	0x65,
+	0x93,
+	0x85,
+	0x93,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x94,
+	0xa5,
+	0x96,
+	0x10,
+	0x0f,
+	0x85,
+	0x43,
+	0x38,
+	0x8a,
+	0xe5,
+	0x95,
+	0x85,
+	0x95,
+	0x8a,
+	0xe5,
+	0x96,
+	0x85,
+	0x96,
+	0x80,
+	0x08,
+	0x05,
+	0x95,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x43,
+	0xa5,
+	0x2d,
+	0xf0,
+	0x14,
+	0x45,
+	0x95,
+	0x84,
+	0x95,
+	0xa5,
+	0x96,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2d,
+	0x18,
+	0x65,
+	0x95,
+	0x85,
+	0x95,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x96,
+	0xa5,
+	0x8c,
+	0x10,
+	0x0f,
+	0x85,
+	0x46,
+	0x38,
+	0x8a,
+	0xe5,
+	0x8b,
+	0x85,
+	0x8b,
+	0x8a,
+	0xe5,
+	0x8c,
+	0x85,
+	0x8c,
+	0x80,
+	0x08,
+	0x05,
+	0x8b,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x46,
+	0xa5,
+	0x2c,
+	0xf0,
+	0x14,
+	0x45,
+	0x8b,
+	0x84,
+	0x8b,
+	0xa5,
+	0x8c,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2c,
+	0x18,
+	0x65,
+	0x8b,
+	0x85,
+	0x8b,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x8c,
+	0xa5,
+	0x90,
+	0x10,
+	0x0f,
+	0x85,
+	0x47,
+	0x38,
+	0x8a,
+	0xe5,
+	0x8f,
+	0x85,
+	0x8f,
+	0x8a,
+	0xe5,
+	0x90,
+	0x85,
+	0x90,
+	0x80,
+	0x08,
+	0x05,
+	0x8f,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x47,
+	0xa5,
+	0x2c,
+	0xf0,
+	0x14,
+	0x45,
+	0x8f,
+	0x84,
+	0x8f,
+	0xa5,
+	0x90,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2c,
+	0x18,
+	0x65,
+	0x8f,
+	0x85,
+	0x8f,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x90,
+	0xa5,
+	0x8e,
+	0x10,
+	0x0f,
+	0x85,
+	0x48,
+	0x38,
+	0x8a,
+	0xe5,
+	0x8d,
+	0x85,
+	0x8d,
+	0x8a,
+	0xe5,
+	0x8e,
+	0x85,
+	0x8e,
+	0x80,
+	0x08,
+	0x05,
+	0x8d,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x48,
+	0xa5,
+	0x2d,
+	0xf0,
+	0x14,
+	0x45,
+	0x8d,
+	0x84,
+	0x8d,
+	0xa5,
+	0x8e,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2d,
+	0x18,
+	0x65,
+	0x8d,
+	0x85,
+	0x8d,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x8e,
+	0xa5,
+	0x92,
+	0x10,
+	0x0f,
+	0x85,
+	0x49,
+	0x38,
+	0x8a,
+	0xe5,
+	0x91,
+	0x85,
+	0x91,
+	0x8a,
+	0xe5,
+	0x92,
+	0x85,
+	0x92,
+	0x80,
+	0x08,
+	0x05,
+	0x91,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x49,
+	0xa5,
+	0x2d,
+	0xf0,
+	0x14,
+	0x45,
+	0x91,
+	0x84,
+	0x91,
+	0xa5,
+	0x92,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2d,
+	0x18,
+	0x65,
+	0x91,
+	0x85,
+	0x91,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x92,
+	0xa4,
+	0x8a,
+	0x5a,
+	0x84,
+	0x45,
+	0xa4,
+	0x89,
+	0x5a,
+	0x84,
+	0x44,
+	0xa2,
+	0x00,
+	0x64,
+	0x30,
+	0x18,
+	0xa5,
+	0x45,
+	0x69,
+	0x04,
+	0x85,
+	0x33,
+	0x64,
+	0x31,
+	0x18,
+	0xa5,
+	0x44,
+	0x69,
+	0x06,
+	0x85,
+	0x34,
+	0x20,
+	0xad,
+	0x26,
+	0xe6,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0xe6,
+	0x30,
+	0x38,
+	0xa5,
+	0x33,
+	0xe9,
+	0x04,
+	0x85,
+	0x33,
+	0x64,
+	0x31,
+	0xa5,
+	0x34,
+	0x20,
+	0xad,
+	0x26,
+	0xe6,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x38,
+	0xa5,
+	0x33,
+	0xe9,
+	0x04,
+	0x85,
+	0x33,
+	0x64,
+	0x31,
+	0xa5,
+	0x34,
+	0x20,
+	0xad,
+	0x26,
+	0xe6,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x38,
+	0xa5,
+	0x32,
+	0xe9,
+	0x0a,
+	0x20,
+	0xad,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x30,
+	0x38,
+	0xa5,
+	0x33,
+	0xe9,
+	0x04,
+	0x85,
+	0x33,
+	0x64,
+	0x31,
+	0xa5,
+	0x34,
+	0x20,
+	0xad,
+	0x26,
+	0xe6,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0x01,
+	0x85,
+	0x30,
+	0x38,
+	0xa5,
+	0x33,
+	0xe9,
+	0x04,
+	0x85,
+	0x33,
+	0x64,
+	0x31,
+	0xa5,
+	0x34,
+	0x20,
+	0xad,
+	0x26,
+	0xe6,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x7a,
+	0xb9,
+	0x1b,
+	0x7d,
+	0x10,
+	0x04,
+	0xc8,
+	0x4c,
+	0xd3,
+	0x25,
+	0x7a,
+	0xb9,
+	0x2f,
+	0x7d,
+	0x10,
+	0x0c,
+	0xa6,
+	0x23,
+	0xf0,
+	0x04,
+	0x88,
+	0x4c,
+	0xce,
+	0x25,
+	0xc8,
+	0x4c,
+	0xce,
+	0x25,
+	0x60,
+	0x38,
+	0xa5,
+	0x32,
+	0xe9,
+	0x05,
+	0x85,
+	0x32,
+	0xda,
+	0x64,
+	0x2e,
+	0x64,
+	0x2f,
+	0xa6,
+	0x33,
+	0xa8,
+	0x30,
+	0x31,
+	0xc9,
+	0x0c,
+	0xb0,
+	0x2d,
+	0x8a,
+	0x30,
+	0x2a,
+	0xc9,
+	0x08,
+	0xb0,
+	0x26,
+	0xa5,
+	0x44,
+	0xd0,
+	0x09,
+	0xa5,
+	0x31,
+	0xd0,
+	0x0d,
+	0xbd,
+	0xaa,
+	0x55,
+	0x80,
+	0x17,
+	0xc9,
+	0x13,
+	0xd0,
+	0x09,
+	0xa5,
+	0x31,
+	0x10,
+	0xf3,
+	0xbd,
+	0xa2,
+	0x55,
+	0x80,
+	0x0a,
+	0x8a,
+	0x49,
+	0x0c,
+	0x18,
+	0x65,
+	0x32,
+	0xa8,
+	0xb9,
+	0xb2,
+	0x55,
+	0x85,
+	0x2e,
+	0xe8,
+	0x30,
+	0x35,
+	0xe0,
+	0x0a,
+	0xb0,
+	0x31,
+	0xa5,
+	0x32,
+	0x3a,
+	0x30,
+	0x2c,
+	0xc9,
+	0x0a,
+	0xb0,
+	0x28,
+	0xa4,
+	0x45,
+	0xd0,
+	0x0a,
+	0xaa,
+	0xa5,
+	0x30,
+	0xd0,
+	0x0e,
+	0xbd,
+	0x1c,
+	0x56,
+	0x80,
+	0x18,
+	0xc0,
+	0x0f,
+	0xd0,
+	0x0a,
+	0xaa,
+	0xa5,
+	0x30,
+	0x30,
+	0xf2,
+	0xbd,
+	0x12,
+	0x56,
+	0x80,
+	0x0a,
+	0x8a,
+	0x49,
+	0x0a,
+	0x18,
+	0x65,
+	0x32,
+	0xaa,
+	0xbd,
+	0x25,
+	0x56,
+	0x85,
+	0x2f,
+	0xfa,
+	0xa5,
+	0x2e,
+	0xd0,
+	0x03,
+	0x4c,
+	0x79,
+	0x28,
+	0xa8,
+	0x10,
+	0x05,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x2e,
+	0x85,
+	0x36,
+	0x98,
+	0x3c,
+	0x45,
+	0x42,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x38,
+	0x45,
+	0x93,
+	0x85,
+	0x37,
+	0xbd,
+	0xd5,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd5,
+	0x80,
+	0x84,
+	0x37,
+	0xbd,
+	0xd6,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd6,
+	0x80,
+	0xb0,
+	0x04,
+	0xde,
+	0xd7,
+	0x80,
+	0x38,
+	0xa5,
+	0x94,
+	0xf0,
+	0x40,
+	0x45,
+	0x36,
+	0x85,
+	0x37,
+	0xbd,
+	0xd6,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd6,
+	0x80,
+	0x84,
+	0x37,
+	0xbd,
+	0xd7,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd7,
+	0x80,
+	0x80,
+	0x28,
+	0x45,
+	0x93,
+	0x7d,
+	0xd5,
+	0x80,
+	0x9d,
+	0xd5,
+	0x80,
+	0x98,
+	0x7d,
+	0xd6,
+	0x80,
+	0x9d,
+	0xd6,
+	0x80,
+	0x90,
+	0x04,
+	0xfe,
+	0xd7,
+	0x80,
+	0x18,
+	0xa5,
+	0x94,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0xd6,
+	0x80,
+	0x9d,
+	0xd6,
+	0x80,
+	0x98,
+	0x7d,
+	0xd7,
+	0x80,
+	0x9d,
+	0xd7,
+	0x80,
+	0xa5,
+	0x46,
+	0xf0,
+	0x69,
+	0x3c,
+	0x45,
+	0x2e,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x38,
+	0x45,
+	0x8b,
+	0x85,
+	0x37,
+	0xbd,
+	0x1d,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1d,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x1e,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1e,
+	0x81,
+	0xb0,
+	0x04,
+	0xde,
+	0x1f,
+	0x81,
+	0x38,
+	0xa5,
+	0x8c,
+	0xf0,
+	0x40,
+	0x45,
+	0x36,
+	0x85,
+	0x37,
+	0xbd,
+	0x1e,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1e,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x1f,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1f,
+	0x81,
+	0x80,
+	0x28,
+	0x45,
+	0x8b,
+	0x7d,
+	0x1d,
+	0x81,
+	0x9d,
+	0x1d,
+	0x81,
+	0x98,
+	0x7d,
+	0x1e,
+	0x81,
+	0x9d,
+	0x1e,
+	0x81,
+	0x90,
+	0x04,
+	0xfe,
+	0x1f,
+	0x81,
+	0x18,
+	0xa5,
+	0x8c,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0x1e,
+	0x81,
+	0x9d,
+	0x1e,
+	0x81,
+	0x98,
+	0x7d,
+	0x1f,
+	0x81,
+	0x9d,
+	0x1f,
+	0x81,
+	0xa5,
+	0x47,
+	0xf0,
+	0x6a,
+	0x3c,
+	0x45,
+	0x2e,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x38,
+	0x45,
+	0x8f,
+	0x85,
+	0x37,
+	0xbd,
+	0x65,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x65,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x66,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x66,
+	0x81,
+	0xb0,
+	0x04,
+	0xde,
+	0x67,
+	0x81,
+	0x38,
+	0xa5,
+	0x90,
+	0xf0,
+	0x41,
+	0x45,
+	0x36,
+	0x85,
+	0x37,
+	0xbd,
+	0x66,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x66,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x67,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x67,
+	0x81,
+	0x80,
+	0x29,
+	0x45,
+	0x8f,
+	0x18,
+	0x7d,
+	0x65,
+	0x81,
+	0x9d,
+	0x65,
+	0x81,
+	0x98,
+	0x7d,
+	0x66,
+	0x81,
+	0x9d,
+	0x66,
+	0x81,
+	0x90,
+	0x04,
+	0xfe,
+	0x67,
+	0x81,
+	0x18,
+	0xa5,
+	0x90,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0x66,
+	0x81,
+	0x9d,
+	0x66,
+	0x81,
+	0x98,
+	0x7d,
+	0x67,
+	0x81,
+	0x9d,
+	0x67,
+	0x81,
+	0xa5,
+	0x2f,
+	0xd0,
+	0x03,
+	0x4c,
+	0xcf,
+	0x29,
+	0xa8,
+	0x10,
+	0x05,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x2f,
+	0x85,
+	0x36,
+	0x98,
+	0x3c,
+	0x45,
+	0x43,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x39,
+	0x45,
+	0x95,
+	0x85,
+	0x37,
+	0xbd,
+	0xd5,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd5,
+	0x80,
+	0x84,
+	0x37,
+	0xbd,
+	0xd6,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd6,
+	0x80,
+	0xb0,
+	0x04,
+	0xde,
+	0xd7,
+	0x80,
+	0x38,
+	0xa5,
+	0x96,
+	0xf0,
+	0x41,
+	0x45,
+	0x36,
+	0x38,
+	0x85,
+	0x37,
+	0xbd,
+	0xd6,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd6,
+	0x80,
+	0x84,
+	0x37,
+	0xbd,
+	0xd7,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd7,
+	0x80,
+	0x80,
+	0x28,
+	0x45,
+	0x95,
+	0x7d,
+	0xd5,
+	0x80,
+	0x9d,
+	0xd5,
+	0x80,
+	0x98,
+	0x7d,
+	0xd6,
+	0x80,
+	0x9d,
+	0xd6,
+	0x80,
+	0x90,
+	0x04,
+	0xfe,
+	0xd7,
+	0x80,
+	0x18,
+	0xa5,
+	0x96,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0xd6,
+	0x80,
+	0x9d,
+	0xd6,
+	0x80,
+	0x98,
+	0x7d,
+	0xd7,
+	0x80,
+	0x9d,
+	0xd7,
+	0x80,
+	0xa5,
+	0x48,
+	0xf0,
+	0x69,
+	0x3c,
+	0x45,
+	0x2f,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x38,
+	0x45,
+	0x8d,
+	0x85,
+	0x37,
+	0xbd,
+	0x1d,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1d,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x1e,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1e,
+	0x81,
+	0xb0,
+	0x04,
+	0xde,
+	0x1f,
+	0x81,
+	0x38,
+	0xa5,
+	0x8e,
+	0xf0,
+	0x40,
+	0x45,
+	0x36,
+	0x85,
+	0x37,
+	0xbd,
+	0x1e,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1e,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x1f,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1f,
+	0x81,
+	0x80,
+	0x28,
+	0x45,
+	0x8d,
+	0x7d,
+	0x1d,
+	0x81,
+	0x9d,
+	0x1d,
+	0x81,
+	0x98,
+	0x7d,
+	0x1e,
+	0x81,
+	0x9d,
+	0x1e,
+	0x81,
+	0x90,
+	0x04,
+	0xfe,
+	0x1f,
+	0x81,
+	0x18,
+	0xa5,
+	0x8e,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0x1e,
+	0x81,
+	0x9d,
+	0x1e,
+	0x81,
+	0x98,
+	0x7d,
+	0x1f,
+	0x81,
+	0x9d,
+	0x1f,
+	0x81,
+	0xa5,
+	0x49,
+	0xf0,
+	0x69,
+	0x3c,
+	0x45,
+	0x2f,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x38,
+	0x45,
+	0x91,
+	0x85,
+	0x37,
+	0xbd,
+	0x65,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x65,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x66,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x66,
+	0x81,
+	0xb0,
+	0x04,
+	0xde,
+	0x67,
+	0x81,
+	0x38,
+	0xa5,
+	0x92,
+	0xf0,
+	0x40,
+	0x45,
+	0x36,
+	0x85,
+	0x37,
+	0xbd,
+	0x66,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x66,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x67,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x67,
+	0x81,
+	0x80,
+	0x28,
+	0x45,
+	0x91,
+	0x7d,
+	0x65,
+	0x81,
+	0x9d,
+	0x65,
+	0x81,
+	0x98,
+	0x7d,
+	0x66,
+	0x81,
+	0x9d,
+	0x66,
+	0x81,
+	0x90,
+	0x04,
+	0xfe,
+	0x67,
+	0x81,
+	0x18,
+	0xa5,
+	0x92,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0x66,
+	0x81,
+	0x9d,
+	0x66,
+	0x81,
+	0x98,
+	0x7d,
+	0x67,
+	0x81,
+	0x9d,
+	0x67,
+	0x81,
+	0xe8,
+	0xe8,
+	0xe8,
+	0x60,
+	0xe6,
+	0x25,
+	0x20,
+	0xdb,
+	0x2a,
+	0x20,
+	0x16,
+	0x2e,
+	0x20,
+	0xff,
+	0x2f,
+	0x20,
+	0x2e,
+	0x31,
+	0x20,
+	0x92,
+	0x34,
+	0x64,
+	0x25,
+	0x60,
+	0xa5,
+	0x41,
+	0xc9,
+	0x80,
+	0x66,
+	0x41,
+	0x66,
+	0x40,
+	0x66,
+	0x3f,
+	0x66,
+	0x3e,
+	0xc9,
+	0x80,
+	0x66,
+	0x41,
+	0x66,
+	0x40,
+	0x66,
+	0x3f,
+	0x66,
+	0x3e,
+	0xc9,
+	0x80,
+	0x66,
+	0x41,
+	0x66,
+	0x40,
+	0x66,
+	0x3f,
+	0x66,
+	0x3e,
+	0xc9,
+	0x80,
+	0x66,
+	0x41,
+	0x66,
+	0x40,
+	0x66,
+	0x3f,
+	0x66,
+	0x3e,
+	0x60,
+	0xa5,
+	0x34,
+	0x45,
+	0x32,
+	0x85,
+	0x37,
+	0x84,
+	0x38,
+	0xa5,
+	0x35,
+	0x45,
+	0x32,
+	0x18,
+	0x65,
+	0x38,
+	0x85,
+	0x38,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x39,
+	0xa5,
+	0x34,
+	0x45,
+	0x33,
+	0x18,
+	0x65,
+	0x38,
+	0x85,
+	0x38,
+	0x98,
+	0x65,
+	0x39,
+	0x85,
+	0x39,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0x85,
+	0x3a,
+	0xa5,
+	0x35,
+	0x45,
+	0x33,
+	0x18,
+	0x65,
+	0x39,
+	0x85,
+	0x39,
+	0x98,
+	0x65,
+	0x3a,
+	0x85,
+	0x3a,
+	0xa5,
+	0x36,
+	0x45,
+	0x32,
+	0x18,
+	0x65,
+	0x39,
+	0x85,
+	0x39,
+	0x98,
+	0x65,
+	0x3a,
+	0x85,
+	0x3a,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0x85,
+	0x3b,
+	0xa5,
+	0x36,
+	0x45,
+	0x33,
+	0x18,
+	0x65,
+	0x3a,
+	0x85,
+	0x3a,
+	0x98,
+	0x65,
+	0x3b,
+	0x85,
+	0x3b,
+	0xa5,
+	0x33,
+	0x10,
+	0x13,
+	0x38,
+	0xa5,
+	0x39,
+	0xe5,
+	0x34,
+	0x85,
+	0x39,
+	0xa5,
+	0x3a,
+	0xe5,
+	0x35,
+	0x85,
+	0x3a,
+	0xa5,
+	0x3b,
+	0xe5,
+	0x36,
+	0x85,
+	0x3b,
+	0x64,
+	0x32,
+	0xa5,
+	0x37,
+	0x29,
+	0x0f,
+	0xc9,
+	0x08,
+	0xd0,
+	0x02,
+	0xe6,
+	0x32,
+	0xa2,
+	0x04,
+	0xa5,
+	0x3b,
+	0xc9,
+	0x80,
+	0x66,
+	0x3b,
+	0x66,
+	0x3a,
+	0x66,
+	0x39,
+	0x66,
+	0x38,
+	0x66,
+	0x37,
+	0xca,
+	0xd0,
+	0xef,
+	0xa5,
+	0x3b,
+	0xf0,
+	0x22,
+	0x10,
+	0x13,
+	0x1a,
+	0xd0,
+	0x04,
+	0xa5,
+	0x3a,
+	0x30,
+	0x1d,
+	0x64,
+	0x3e,
+	0x64,
+	0x3f,
+	0x64,
+	0x40,
+	0xa9,
+	0x80,
+	0x85,
+	0x41,
+	0x18,
+	0x60,
+	0xa9,
+	0xff,
+	0x85,
+	0x3e,
+	0x85,
+	0x3f,
+	0x85,
+	0x40,
+	0x4a,
+	0x85,
+	0x41,
+	0x18,
+	0x60,
+	0xa5,
+	0x3a,
+	0x30,
+	0xef,
+	0xa0,
+	0x04,
+	0x53,
+	0x37,
+	0x00,
+	0x3e,
+	0x00,
+	0xa5,
+	0x32,
+	0xd0,
+	0x03,
+	0x2a,
+	0x1a,
+	0x6a,
+	0x60,
+	0xa9,
+	0x80,
+	0x38,
+	0xed,
+	0x17,
+	0x6b,
+	0x85,
+	0x74,
+	0x64,
+	0x6d,
+	0xa0,
+	0x09,
+	0x53,
+	0xc3,
+	0x80,
+	0x7b,
+	0x00,
+	0xa0,
+	0x02,
+	0x53,
+	0x0d,
+	0x7d,
+	0x32,
+	0x00,
+	0xad,
+	0x07,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0xfb,
+	0x7c,
+	0x85,
+	0x75,
+	0xbd,
+	0xfc,
+	0x7c,
+	0x85,
+	0x76,
+	0xad,
+	0x08,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0xfb,
+	0x7c,
+	0x85,
+	0x77,
+	0xbd,
+	0xfc,
+	0x7c,
+	0x85,
+	0x78,
+	0xad,
+	0x09,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0xfb,
+	0x7c,
+	0x85,
+	0x79,
+	0xbd,
+	0xfc,
+	0x7c,
+	0x85,
+	0x7a,
+	0x64,
+	0x84,
+	0x64,
+	0x85,
+	0x64,
+	0x86,
+	0xa6,
+	0x6d,
+	0xb5,
+	0xdc,
+	0xf0,
+	0x07,
+	0xa9,
+	0x80,
+	0x85,
+	0x86,
+	0x4c,
+	0x7c,
+	0x2d,
+	0x38,
+	0xa5,
+	0x7b,
+	0xe5,
+	0x7e,
+	0x85,
+	0x7b,
+	0xa5,
+	0x7c,
+	0xe5,
+	0x7f,
+	0x85,
+	0x7c,
+	0xa5,
+	0x7d,
+	0xe5,
+	0x80,
+	0xa8,
+	0xa5,
+	0x7c,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xf0,
+	0x12,
+	0x98,
+	0x30,
+	0x09,
+	0xa9,
+	0xff,
+	0x85,
+	0x7b,
+	0x4a,
+	0x85,
+	0x7c,
+	0x80,
+	0x06,
+	0xa9,
+	0x80,
+	0x85,
+	0x7c,
+	0x64,
+	0x7b,
+	0x38,
+	0xa5,
+	0x81,
+	0xe5,
+	0x7e,
+	0x85,
+	0x81,
+	0xa5,
+	0x82,
+	0xe5,
+	0x7f,
+	0x85,
+	0x82,
+	0xa5,
+	0x83,
+	0xe5,
+	0x80,
+	0xa8,
+	0xa5,
+	0x82,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xf0,
+	0x12,
+	0x98,
+	0x30,
+	0x09,
+	0xa9,
+	0xff,
+	0x85,
+	0x81,
+	0x4a,
+	0x85,
+	0x82,
+	0x80,
+	0x06,
+	0xa9,
+	0x80,
+	0x85,
+	0x82,
+	0x64,
+	0x81,
+	0xa0,
+	0x02,
+	0x53,
+	0x81,
+	0x00,
+	0x34,
+	0x00,
+	0x20,
+	0x50,
+	0x39,
+	0x20,
+	0xe7,
+	0x29,
+	0x90,
+	0x0e,
+	0xe6,
+	0x3e,
+	0xd0,
+	0x0a,
+	0xe6,
+	0x3f,
+	0xd0,
+	0x06,
+	0xe6,
+	0x40,
+	0xd0,
+	0x02,
+	0xe6,
+	0x41,
+	0xa2,
+	0x00,
+	0xa5,
+	0x7b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x42,
+	0xa5,
+	0x7c,
+	0x10,
+	0x01,
+	0xca,
+	0x65,
+	0x3f,
+	0x85,
+	0x43,
+	0x8a,
+	0x65,
+	0x40,
+	0x85,
+	0x44,
+	0x8a,
+	0x65,
+	0x41,
+	0x85,
+	0x45,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x7b,
+	0x85,
+	0x34,
+	0xa9,
+	0x00,
+	0xe5,
+	0x7c,
+	0x85,
+	0x35,
+	0xa5,
+	0x6d,
+	0x49,
+	0x07,
+	0xaa,
+	0xda,
+	0xbd,
+	0x0f,
+	0x7d,
+	0x85,
+	0x32,
+	0xbd,
+	0x10,
+	0x7d,
+	0x85,
+	0x33,
+	0xa5,
+	0x7c,
+	0x10,
+	0x05,
+	0x20,
+	0x93,
+	0x39,
+	0x80,
+	0x03,
+	0x20,
+	0x50,
+	0x39,
+	0xa0,
+	0x04,
+	0x53,
+	0x3e,
+	0x00,
+	0x46,
+	0x00,
+	0xfa,
+	0xbd,
+	0x11,
+	0x7d,
+	0x85,
+	0x34,
+	0xbd,
+	0x12,
+	0x7d,
+	0x85,
+	0x35,
+	0xbd,
+	0x13,
+	0x7d,
+	0x85,
+	0x36,
+	0xa0,
+	0x02,
+	0x53,
+	0x81,
+	0x00,
+	0x32,
+	0x00,
+	0x20,
+	0x12,
+	0x2a,
+	0xa5,
+	0x46,
+	0xe5,
+	0x3e,
+	0x85,
+	0x46,
+	0xa5,
+	0x47,
+	0xe5,
+	0x3f,
+	0x85,
+	0x47,
+	0xa5,
+	0x48,
+	0xe5,
+	0x40,
+	0x85,
+	0x48,
+	0xa2,
+	0x00,
+	0xa5,
+	0x49,
+	0x10,
+	0x01,
+	0xca,
+	0xe5,
+	0x41,
+	0x85,
+	0x49,
+	0x8a,
+	0xa6,
+	0x41,
+	0x30,
+	0x04,
+	0xe9,
+	0x00,
+	0x80,
+	0x02,
+	0xe9,
+	0xff,
+	0x10,
+	0x0f,
+	0xc9,
+	0xff,
+	0xd0,
+	0x04,
+	0xa5,
+	0x49,
+	0x30,
+	0x19,
+	0xa9,
+	0x80,
+	0x85,
+	0x49,
+	0x0a,
+	0x80,
+	0x0c,
+	0xd0,
+	0x04,
+	0xa5,
+	0x49,
+	0x10,
+	0x0c,
+	0xa9,
+	0x7f,
+	0x85,
+	0x49,
+	0xa9,
+	0xff,
+	0x85,
+	0x48,
+	0x85,
+	0x47,
+	0x85,
+	0x46,
+	0xa9,
+	0x00,
+	0xa8,
+	0x38,
+	0xe5,
+	0x46,
+	0x85,
+	0x46,
+	0x98,
+	0xe5,
+	0x47,
+	0x85,
+	0x47,
+	0x98,
+	0xe5,
+	0x48,
+	0x85,
+	0x48,
+	0x98,
+	0xe5,
+	0x49,
+	0x85,
+	0x49,
+	0xa5,
+	0x45,
+	0x30,
+	0x32,
+	0x06,
+	0x42,
+	0x26,
+	0x43,
+	0x26,
+	0x44,
+	0x26,
+	0x45,
+	0xa5,
+	0x42,
+	0x05,
+	0x43,
+	0x05,
+	0x44,
+	0x05,
+	0x45,
+	0xd0,
+	0x06,
+	0x64,
+	0x32,
+	0x64,
+	0x33,
+	0x80,
+	0x34,
+	0xa5,
+	0x49,
+	0x30,
+	0x18,
+	0xa5,
+	0x45,
+	0x30,
+	0x14,
+	0x06,
+	0x42,
+	0x26,
+	0x43,
+	0x26,
+	0x44,
+	0x26,
+	0x45,
+	0x06,
+	0x46,
+	0x26,
+	0x47,
+	0x26,
+	0x48,
+	0x26,
+	0x49,
+	0x80,
+	0xe6,
+	0x80,
+	0x6e,
+	0xa0,
+	0x02,
+	0x53,
+	0x48,
+	0x00,
+	0x32,
+	0x00,
+	0x53,
+	0x44,
+	0x00,
+	0x34,
+	0x00,
+	0xa5,
+	0x34,
+	0x05,
+	0x35,
+	0xd0,
+	0x03,
+	0x4c,
+	0x3d,
+	0x2d,
+	0x20,
+	0x2f,
+	0x39,
+	0x38,
+	0xa5,
+	0x75,
+	0xe5,
+	0x32,
+	0xa5,
+	0x76,
+	0xe5,
+	0x33,
+	0xb0,
+	0x4b,
+	0x38,
+	0xa5,
+	0x32,
+	0xe5,
+	0x79,
+	0xa5,
+	0x33,
+	0xe5,
+	0x7a,
+	0xb0,
+	0x40,
+	0x38,
+	0xa5,
+	0x32,
+	0xe5,
+	0x77,
+	0xa5,
+	0x33,
+	0xe5,
+	0x78,
+	0xb0,
+	0x62,
+	0xa0,
+	0x02,
+	0x53,
+	0x77,
+	0x00,
+	0x34,
+	0x00,
+	0x38,
+	0xa5,
+	0x77,
+	0xe5,
+	0x32,
+	0xaa,
+	0x64,
+	0x32,
+	0xa5,
+	0x78,
+	0xe5,
+	0x33,
+	0x86,
+	0x33,
+	0x4a,
+	0x66,
+	0x33,
+	0x66,
+	0x32,
+	0x4a,
+	0x90,
+	0x08,
+	0x66,
+	0x33,
+	0x66,
+	0x32,
+	0x46,
+	0x35,
+	0x66,
+	0x34,
+	0x20,
+	0x2f,
+	0x39,
+	0xa5,
+	0x32,
+	0x85,
+	0x84,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0x84,
+	0x85,
+	0x85,
+	0x80,
+	0x66,
+	0xa2,
+	0x00,
+	0xa5,
+	0x82,
+	0x10,
+	0x01,
+	0xca,
+	0x86,
+	0x83,
+	0xa2,
+	0x00,
+	0xa5,
+	0x7c,
+	0x10,
+	0x01,
+	0xca,
+	0x86,
+	0x7d,
+	0x38,
+	0xa5,
+	0x81,
+	0xe5,
+	0x7b,
+	0xa5,
+	0x82,
+	0xe5,
+	0x7c,
+	0xa5,
+	0x83,
+	0xe5,
+	0x7d,
+	0x10,
+	0x06,
+	0xa9,
+	0x80,
+	0x85,
+	0x86,
+	0x80,
+	0x3f,
+	0xa9,
+	0x80,
+	0x85,
+	0x84,
+	0x80,
+	0x39,
+	0x38,
+	0xa5,
+	0x79,
+	0xe5,
+	0x77,
+	0x85,
+	0x34,
+	0xa5,
+	0x7a,
+	0xe5,
+	0x78,
+	0x85,
+	0x35,
+	0x38,
+	0xa5,
+	0x79,
+	0xe5,
+	0x32,
+	0xaa,
+	0x64,
+	0x32,
+	0xa5,
+	0x7a,
+	0xe5,
+	0x33,
+	0x86,
+	0x33,
+	0x4a,
+	0x66,
+	0x33,
+	0x66,
+	0x32,
+	0x4a,
+	0x90,
+	0x08,
+	0x66,
+	0x33,
+	0x66,
+	0x32,
+	0x46,
+	0x35,
+	0x66,
+	0x34,
+	0x20,
+	0x2f,
+	0x39,
+	0xa5,
+	0x32,
+	0x85,
+	0x85,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0x85,
+	0x85,
+	0x86,
+	0x64,
+	0x2e,
+	0x64,
+	0x6c,
+	0xa6,
+	0x6c,
+	0xb5,
+	0x84,
+	0x45,
+	0x74,
+	0x85,
+	0x32,
+	0x84,
+	0x33,
+	0xa5,
+	0x6d,
+	0x49,
+	0x03,
+	0x18,
+	0x65,
+	0x6c,
+	0xaa,
+	0xbd,
+	0x79,
+	0x6b,
+	0x4d,
+	0x17,
+	0x6b,
+	0x18,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x65,
+	0x33,
+	0x06,
+	0x32,
+	0x2a,
+	0xc5,
+	0x2e,
+	0x90,
+	0x06,
+	0xf0,
+	0x04,
+	0x85,
+	0x2e,
+	0x86,
+	0x2f,
+	0x9d,
+	0x7f,
+	0x6b,
+	0xe6,
+	0x6c,
+	0xa5,
+	0x6c,
+	0xc9,
+	0x03,
+	0xd0,
+	0xc8,
+	0x38,
+	0xa9,
+	0x80,
+	0xfd,
+	0x7d,
+	0x6b,
+	0xfd,
+	0x7e,
+	0x6b,
+	0xfd,
+	0x7f,
+	0x6b,
+	0xf0,
+	0x09,
+	0xa6,
+	0x2f,
+	0x18,
+	0x7d,
+	0x7f,
+	0x6b,
+	0x9d,
+	0x7f,
+	0x6b,
+	0xe6,
+	0x6d,
+	0xa5,
+	0x6d,
+	0xc9,
+	0x02,
+	0xf0,
+	0x3e,
+	0xa0,
+	0x09,
+	0x53,
+	0xcc,
+	0x80,
+	0x7b,
+	0x00,
+	0xa0,
+	0x02,
+	0x53,
+	0x14,
+	0x7d,
+	0x32,
+	0x00,
+	0xad,
+	0x0a,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x01,
+	0x7d,
+	0x85,
+	0x75,
+	0xbd,
+	0x02,
+	0x7d,
+	0x85,
+	0x76,
+	0xad,
+	0x0b,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x01,
+	0x7d,
+	0x85,
+	0x77,
+	0xbd,
+	0x02,
+	0x7d,
+	0x85,
+	0x78,
+	0xad,
+	0x0c,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x01,
+	0x7d,
+	0x85,
+	0x79,
+	0xbd,
+	0x02,
+	0x7d,
+	0x85,
+	0x7a,
+	0x4c,
+	0x20,
+	0x2b,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x33,
+	0xbe,
+	0x36,
+	0x00,
+	0x53,
+	0x35,
+	0xbe,
+	0x38,
+	0x00,
+	0xa0,
+	0x00,
+	0xfc,
+	0xbd,
+	0xd5,
+	0x80,
+	0x0a,
+	0xbd,
+	0xd6,
+	0x80,
+	0x69,
+	0x00,
+	0x99,
+	0xd5,
+	0x80,
+	0xbd,
+	0xd7,
+	0x80,
+	0x69,
+	0x00,
+	0x99,
+	0xd6,
+	0x80,
+	0xbd,
+	0x1d,
+	0x81,
+	0x0a,
+	0xbd,
+	0x1e,
+	0x81,
+	0x69,
+	0x00,
+	0x99,
+	0x1d,
+	0x81,
+	0xbd,
+	0x1f,
+	0x81,
+	0x69,
+	0x00,
+	0x99,
+	0x1e,
+	0x81,
+	0xbd,
+	0x65,
+	0x81,
+	0x0a,
+	0xbd,
+	0x66,
+	0x81,
+	0x69,
+	0x00,
+	0x99,
+	0x65,
+	0x81,
+	0xbd,
+	0x67,
+	0x81,
+	0x69,
+	0x00,
+	0x99,
+	0x66,
+	0x81,
+	0xc8,
+	0xc8,
+	0xe8,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x48,
+	0xd0,
+	0xbb,
+	0xa9,
+	0x62,
+	0x85,
+	0x50,
+	0xa9,
+	0x53,
+	0x85,
+	0x51,
+	0x64,
+	0x2e,
+	0xa2,
+	0x00,
+	0x64,
+	0x3e,
+	0x64,
+	0x3f,
+	0x64,
+	0x40,
+	0x64,
+	0x42,
+	0x64,
+	0x43,
+	0x64,
+	0x44,
+	0x64,
+	0x46,
+	0x64,
+	0x47,
+	0x64,
+	0x48,
+	0xb2,
+	0x50,
+	0x85,
+	0x2f,
+	0x5d,
+	0xd5,
+	0x80,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xd6,
+	0x80,
+	0xf0,
+	0x12,
+	0x48,
+	0x45,
+	0x2f,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x2f,
+	0x85,
+	0x40,
+	0xa5,
+	0x2f,
+	0x5d,
+	0x1d,
+	0x81,
+	0x18,
+	0x65,
+	0x42,
+	0x85,
+	0x42,
+	0x98,
+	0x65,
+	0x43,
+	0x85,
+	0x43,
+	0x90,
+	0x03,
+	0xe6,
+	0x44,
+	0x18,
+	0xbd,
+	0x1e,
+	0x81,
+	0xf0,
+	0x12,
+	0x48,
+	0x45,
+	0x2f,
+	0x65,
+	0x43,
+	0x85,
+	0x43,
+	0x98,
+	0x65,
+	0x44,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x2f,
+	0x85,
+	0x44,
+	0xa5,
+	0x2f,
+	0x5d,
+	0x65,
+	0x81,
+	0x18,
+	0x65,
+	0x46,
+	0x85,
+	0x46,
+	0x98,
+	0x65,
+	0x47,
+	0x85,
+	0x47,
+	0x90,
+	0x03,
+	0xe6,
+	0x48,
+	0x18,
+	0xbd,
+	0x66,
+	0x81,
+	0xf0,
+	0x12,
+	0x48,
+	0x45,
+	0x2f,
+	0x65,
+	0x47,
+	0x85,
+	0x47,
+	0x98,
+	0x65,
+	0x48,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x2f,
+	0x85,
+	0x48,
+	0xe6,
+	0x50,
+	0xd0,
+	0x02,
+	0xe6,
+	0x51,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x30,
+	0xf0,
+	0x03,
+	0x4c,
+	0x88,
+	0x2e,
+	0xa6,
+	0x2e,
+	0x06,
+	0x3e,
+	0x26,
+	0x3f,
+	0x26,
+	0x40,
+	0x06,
+	0x3e,
+	0xa9,
+	0x00,
+	0x65,
+	0x3f,
+	0x9d,
+	0xad,
+	0x81,
+	0xa9,
+	0x00,
+	0x65,
+	0x40,
+	0x9d,
+	0xae,
+	0x81,
+	0x06,
+	0x42,
+	0x26,
+	0x43,
+	0x26,
+	0x44,
+	0x06,
+	0x42,
+	0xa9,
+	0x00,
+	0x65,
+	0x43,
+	0x85,
+	0x42,
+	0xa9,
+	0x00,
+	0x65,
+	0x44,
+	0x85,
+	0x43,
+	0x38,
+	0xa5,
+	0x42,
+	0xe5,
+	0x38,
+	0xa5,
+	0x43,
+	0xe5,
+	0x39,
+	0x30,
+	0x06,
+	0xa5,
+	0x38,
+	0xa4,
+	0x39,
+	0x80,
+	0x15,
+	0x38,
+	0xa5,
+	0x42,
+	0xe5,
+	0x36,
+	0xa5,
+	0x43,
+	0xe5,
+	0x37,
+	0x30,
+	0x06,
+	0xa5,
+	0x42,
+	0xa4,
+	0x43,
+	0x80,
+	0x04,
+	0xa5,
+	0x36,
+	0xa4,
+	0x37,
+	0x9d,
+	0xdf,
+	0x81,
+	0x98,
+	0x9d,
+	0xe0,
+	0x81,
+	0x06,
+	0x46,
+	0x26,
+	0x47,
+	0x26,
+	0x48,
+	0x06,
+	0x46,
+	0xa9,
+	0x00,
+	0x65,
+	0x47,
+	0x85,
+	0x46,
+	0xa9,
+	0x00,
+	0x65,
+	0x48,
+	0x85,
+	0x47,
+	0x38,
+	0xa5,
+	0x46,
+	0xe5,
+	0x38,
+	0xa5,
+	0x47,
+	0xe5,
+	0x39,
+	0x30,
+	0x06,
+	0xa5,
+	0x38,
+	0xa4,
+	0x39,
+	0x80,
+	0x15,
+	0x38,
+	0xa5,
+	0x46,
+	0xe5,
+	0x36,
+	0xa5,
+	0x47,
+	0xe5,
+	0x37,
+	0x30,
+	0x06,
+	0xa5,
+	0x46,
+	0xa4,
+	0x47,
+	0x80,
+	0x04,
+	0xa5,
+	0x36,
+	0xa4,
+	0x37,
+	0x9d,
+	0x11,
+	0x82,
+	0x98,
+	0x9d,
+	0x12,
+	0x82,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x18,
+	0xd0,
+	0x3b,
+	0x9e,
+	0xad,
+	0x81,
+	0x9e,
+	0xae,
+	0x81,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x39,
+	0x30,
+	0x06,
+	0xa5,
+	0x38,
+	0xa4,
+	0x39,
+	0x80,
+	0x15,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x36,
+	0xa9,
+	0x00,
+	0xe5,
+	0x37,
+	0x30,
+	0x06,
+	0xa9,
+	0x00,
+	0xa0,
+	0x00,
+	0x80,
+	0x04,
+	0xa5,
+	0x36,
+	0xa4,
+	0x37,
+	0x9d,
+	0xdf,
+	0x81,
+	0x9d,
+	0x11,
+	0x82,
+	0x98,
+	0x9d,
+	0xe0,
+	0x81,
+	0x9d,
+	0x12,
+	0x82,
+	0xe8,
+	0xe8,
+	0x86,
+	0x2e,
+	0xe0,
+	0x32,
+	0xb0,
+	0x03,
+	0x4c,
+	0x74,
+	0x2e,
+	0x60,
+	0xa5,
+	0x72,
+	0x64,
+	0x38,
+	0x64,
+	0x39,
+	0x05,
+	0x73,
+	0xd0,
+	0x05,
+	0x64,
+	0x32,
+	0x64,
+	0x33,
+	0x60,
+	0x64,
+	0x2f,
+	0x64,
+	0x3e,
+	0x64,
+	0x3f,
+	0x64,
+	0x40,
+	0xa2,
+	0x00,
+	0xa0,
+	0x00,
+	0xa5,
+	0x2f,
+	0xf0,
+	0x05,
+	0xc9,
+	0x04,
+	0xf0,
+	0x01,
+	0xc8,
+	0x84,
+	0x30,
+	0x64,
+	0x2e,
+	0xa4,
+	0x30,
+	0xa5,
+	0x2e,
+	0xf0,
+	0x05,
+	0xc9,
+	0x04,
+	0xf0,
+	0x01,
+	0xc8,
+	0xbd,
+	0xae,
+	0x81,
+	0x85,
+	0x31,
+	0xbd,
+	0xad,
+	0x81,
+	0xc0,
+	0x01,
+	0x90,
+	0x08,
+	0xf0,
+	0x03,
+	0x0a,
+	0x26,
+	0x31,
+	0x0a,
+	0x26,
+	0x31,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0xa5,
+	0x31,
+	0xa8,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x30,
+	0x06,
+	0x90,
+	0x08,
+	0xe6,
+	0x40,
+	0x80,
+	0x04,
+	0xb0,
+	0x02,
+	0xc6,
+	0x40,
+	0xe8,
+	0xe8,
+	0xa5,
+	0x2e,
+	0x1a,
+	0x85,
+	0x2e,
+	0xc9,
+	0x05,
+	0xd0,
+	0xbd,
+	0xa5,
+	0x2f,
+	0x1a,
+	0x85,
+	0x2f,
+	0xc9,
+	0x05,
+	0xd0,
+	0xa5,
+	0xa2,
+	0x06,
+	0xa5,
+	0x40,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x3f,
+	0x66,
+	0x3e,
+	0xca,
+	0xd0,
+	0xf6,
+	0xa5,
+	0x3f,
+	0x85,
+	0x39,
+	0xa5,
+	0x3e,
+	0x90,
+	0x05,
+	0x1a,
+	0xd0,
+	0x02,
+	0xe6,
+	0x39,
+	0x85,
+	0x38,
+	0xa5,
+	0x72,
+	0x85,
+	0x34,
+	0xa6,
+	0x73,
+	0x86,
+	0x35,
+	0xa6,
+	0x70,
+	0x10,
+	0x30,
+	0xa0,
+	0x00,
+	0x98,
+	0x38,
+	0xe5,
+	0x6e,
+	0x85,
+	0x32,
+	0x98,
+	0xe5,
+	0x6f,
+	0x85,
+	0x33,
+	0x98,
+	0xe5,
+	0x70,
+	0xf0,
+	0x0c,
+	0x46,
+	0x35,
+	0x66,
+	0x34,
+	0x4a,
+	0x66,
+	0x33,
+	0x66,
+	0x32,
+	0xaa,
+	0xd0,
+	0xf4,
+	0x20,
+	0x2f,
+	0x39,
+	0x18,
+	0xa5,
+	0x32,
+	0x65,
+	0x38,
+	0x85,
+	0x32,
+	0xa5,
+	0x33,
+	0x65,
+	0x39,
+	0x85,
+	0x33,
+	0x80,
+	0x26,
+	0x8a,
+	0xf0,
+	0x0c,
+	0x46,
+	0x35,
+	0x66,
+	0x34,
+	0x4a,
+	0x66,
+	0x6f,
+	0x66,
+	0x6e,
+	0xaa,
+	0xd0,
+	0xf4,
+	0xa0,
+	0x02,
+	0x53,
+	0x6e,
+	0x00,
+	0x32,
+	0x00,
+	0x20,
+	0x2f,
+	0x39,
+	0x38,
+	0xa5,
+	0x38,
+	0xe5,
+	0x32,
+	0x85,
+	0x32,
+	0xa5,
+	0x39,
+	0xe5,
+	0x33,
+	0x85,
+	0x33,
+	0xa2,
+	0x00,
+	0x38,
+	0xbd,
+	0xad,
+	0x81,
+	0xe5,
+	0x32,
+	0xa8,
+	0xbd,
+	0xae,
+	0x81,
+	0xe5,
+	0x33,
+	0x30,
+	0x10,
+	0xc9,
+	0x03,
+	0x90,
+	0x1a,
+	0xd0,
+	0x04,
+	0xc0,
+	0xff,
+	0x90,
+	0x14,
+	0xa0,
+	0xff,
+	0xa9,
+	0x03,
+	0x80,
+	0x0e,
+	0xc9,
+	0xfc,
+	0x90,
+	0x06,
+	0xd0,
+	0x08,
+	0xc0,
+	0x00,
+	0xb0,
+	0x04,
+	0xa0,
+	0x00,
+	0xa9,
+	0xfc,
+	0x9d,
+	0xae,
+	0x81,
+	0x98,
+	0x9d,
+	0xad,
+	0x81,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x32,
+	0xd0,
+	0xc7,
+	0x60,
+	0x20,
+	0x6e,
+	0x31,
+	0xa9,
+	0xad,
+	0x85,
+	0x4a,
+	0xa9,
+	0x81,
+	0x85,
+	0x4b,
+	0x20,
+	0xc1,
+	0x32,
+	0xa0,
+	0x32,
+	0x53,
+	0x43,
+	0x82,
+	0xad,
+	0x81,
+	0xa9,
+	0xdf,
+	0x85,
+	0x4a,
+	0xa9,
+	0x81,
+	0x85,
+	0x4b,
+	0x20,
+	0xc1,
+	0x32,
+	0x20,
+	0xfe,
+	0x33,
+	0xa0,
+	0x32,
+	0x53,
+	0x43,
+	0x82,
+	0xdf,
+	0x81,
+	0xa9,
+	0x11,
+	0x85,
+	0x4a,
+	0xa9,
+	0x82,
+	0x85,
+	0x4b,
+	0x20,
+	0xc1,
+	0x32,
+	0x20,
+	0xfe,
+	0x33,
+	0xa0,
+	0x32,
+	0x53,
+	0x43,
+	0x82,
+	0x11,
+	0x82,
+	0x60,
+	0xa5,
+	0x28,
+	0x49,
+	0x04,
+	0x85,
+	0x2e,
+	0x38,
+	0xa5,
+	0x29,
+	0x1a,
+	0xe5,
+	0x28,
+	0x49,
+	0x14,
+	0x85,
+	0x38,
+	0x84,
+	0x39,
+	0x64,
+	0x3a,
+	0x64,
+	0x3b,
+	0xa2,
+	0x00,
+	0xa5,
+	0x3a,
+	0x85,
+	0x32,
+	0xa5,
+	0x3b,
+	0x85,
+	0x33,
+	0xa9,
+	0x14,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0xda,
+	0x20,
+	0x0b,
+	0x39,
+	0xfa,
+	0x18,
+	0xa5,
+	0x32,
+	0x65,
+	0x2e,
+	0x9d,
+	0x75,
+	0x82,
+	0x18,
+	0xa5,
+	0x3a,
+	0x65,
+	0x38,
+	0x85,
+	0x3a,
+	0xa5,
+	0x3b,
+	0x65,
+	0x39,
+	0x85,
+	0x3b,
+	0xe8,
+	0xe0,
+	0x05,
+	0xd0,
+	0xd3,
+	0xbd,
+	0x74,
+	0x82,
+	0x1a,
+	0x9d,
+	0x75,
+	0x82,
+	0xa5,
+	0x26,
+	0x49,
+	0x04,
+	0x85,
+	0x2e,
+	0x38,
+	0xa5,
+	0x27,
+	0x1a,
+	0xe5,
+	0x26,
+	0x49,
+	0x10,
+	0x85,
+	0x38,
+	0x84,
+	0x39,
+	0x64,
+	0x3a,
+	0x64,
+	0x3b,
+	0xa2,
+	0x00,
+	0xa5,
+	0x3a,
+	0x85,
+	0x32,
+	0xa5,
+	0x3b,
+	0x85,
+	0x33,
+	0xa9,
+	0x10,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0xda,
+	0x20,
+	0x0b,
+	0x39,
+	0xfa,
+	0x18,
+	0xa5,
+	0x32,
+	0x65,
+	0x2e,
+	0x9d,
+	0x7b,
+	0x82,
+	0x18,
+	0xa5,
+	0x3a,
+	0x65,
+	0x38,
+	0x85,
+	0x3a,
+	0xa5,
+	0x3b,
+	0x65,
+	0x39,
+	0x85,
+	0x3b,
+	0xe8,
+	0xe0,
+	0x05,
+	0xd0,
+	0xd3,
+	0xbd,
+	0x7a,
+	0x82,
+	0x1a,
+	0x9d,
+	0x7b,
+	0x82,
+	0x60,
+	0xa5,
+	0x2e,
+	0xa2,
+	0x00,
+	0xe8,
+	0xdd,
+	0x75,
+	0x82,
+	0xb0,
+	0xfa,
+	0xca,
+	0x8a,
+	0x0a,
+	0x18,
+	0x60,
+	0xa5,
+	0x2f,
+	0xa2,
+	0x00,
+	0xe8,
+	0xdd,
+	0x7b,
+	0x82,
+	0xb0,
+	0xfa,
+	0xca,
+	0x8a,
+	0x0a,
+	0x18,
+	0x60,
+	0xb1,
+	0x4a,
+	0x85,
+	0x38,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x38,
+	0xa5,
+	0x2e,
+	0xfd,
+	0x75,
+	0x82,
+	0x85,
+	0x31,
+	0xf0,
+	0x0f,
+	0xc8,
+	0x38,
+	0xbd,
+	0x76,
+	0x82,
+	0xfd,
+	0x75,
+	0x82,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0x20,
+	0x6f,
+	0x32,
+	0x60,
+	0xb1,
+	0x4a,
+	0x85,
+	0x38,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x38,
+	0xa5,
+	0x2f,
+	0xfd,
+	0x7b,
+	0x82,
+	0x85,
+	0x31,
+	0xf0,
+	0x13,
+	0x18,
+	0x98,
+	0x69,
+	0x09,
+	0xa8,
+	0x38,
+	0xbd,
+	0x7c,
+	0x82,
+	0xfd,
+	0x7b,
+	0x82,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0x20,
+	0x6f,
+	0x32,
+	0x60,
+	0x38,
+	0xb1,
+	0x4a,
+	0xe5,
+	0x38,
+	0x85,
+	0x32,
+	0xc8,
+	0xb1,
+	0x4a,
+	0xa0,
+	0x00,
+	0xe5,
+	0x39,
+	0x85,
+	0x33,
+	0x10,
+	0x0c,
+	0x38,
+	0x98,
+	0xe5,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0xe5,
+	0x33,
+	0x85,
+	0x33,
+	0xc8,
+	0x5a,
+	0xa5,
+	0x32,
+	0x45,
+	0x31,
+	0x85,
+	0x32,
+	0x84,
+	0x4c,
+	0xa5,
+	0x33,
+	0x45,
+	0x31,
+	0x18,
+	0x65,
+	0x4c,
+	0x85,
+	0x33,
+	0x20,
+	0x2f,
+	0x39,
+	0x7a,
+	0xf0,
+	0x0e,
+	0x38,
+	0xa5,
+	0x38,
+	0xe5,
+	0x32,
+	0x85,
+	0x38,
+	0xa5,
+	0x39,
+	0xe5,
+	0x33,
+	0x85,
+	0x39,
+	0x60,
+	0x18,
+	0xa5,
+	0x38,
+	0x65,
+	0x32,
+	0x85,
+	0x38,
+	0xa5,
+	0x39,
+	0x65,
+	0x33,
+	0x85,
+	0x39,
+	0x60,
+	0x64,
+	0x30,
+	0x64,
+	0x2f,
+	0x64,
+	0x2e,
+	0xa5,
+	0x2f,
+	0xcd,
+	0x7b,
+	0x82,
+	0xb0,
+	0x33,
+	0xa5,
+	0x2e,
+	0xcd,
+	0x75,
+	0x82,
+	0xb0,
+	0x0d,
+	0xb2,
+	0x4a,
+	0x85,
+	0x38,
+	0xa0,
+	0x01,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x4c,
+	0xd1,
+	0x33,
+	0xcd,
+	0x79,
+	0x82,
+	0xf0,
+	0x10,
+	0x90,
+	0x0e,
+	0xa0,
+	0x08,
+	0xb1,
+	0x4a,
+	0x85,
+	0x38,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x4c,
+	0xd1,
+	0x33,
+	0x20,
+	0x07,
+	0x32,
+	0xa8,
+	0x20,
+	0x25,
+	0x32,
+	0x4c,
+	0xd1,
+	0x33,
+	0xcd,
+	0x7f,
+	0x82,
+	0xf0,
+	0x38,
+	0x90,
+	0x36,
+	0xa5,
+	0x2e,
+	0xcd,
+	0x75,
+	0x82,
+	0xb0,
+	0x0e,
+	0xa0,
+	0x28,
+	0xb1,
+	0x4a,
+	0x85,
+	0x38,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x4c,
+	0xd1,
+	0x33,
+	0xcd,
+	0x79,
+	0x82,
+	0xf0,
+	0x10,
+	0x90,
+	0x0e,
+	0xa0,
+	0x30,
+	0xb1,
+	0x4a,
+	0x85,
+	0x38,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x4c,
+	0xd1,
+	0x33,
+	0x20,
+	0x07,
+	0x32,
+	0x69,
+	0x28,
+	0xa8,
+	0x20,
+	0x25,
+	0x32,
+	0x4c,
+	0xd1,
+	0x33,
+	0xa5,
+	0x2e,
+	0xcd,
+	0x75,
+	0x82,
+	0xb0,
+	0x0c,
+	0x20,
+	0x16,
+	0x32,
+	0x49,
+	0x05,
+	0xa8,
+	0x20,
+	0x48,
+	0x32,
+	0x4c,
+	0xd1,
+	0x33,
+	0xcd,
+	0x79,
+	0x82,
+	0xf0,
+	0x0f,
+	0x90,
+	0x0d,
+	0x20,
+	0x16,
+	0x32,
+	0x49,
+	0x05,
+	0x69,
+	0x08,
+	0xa8,
+	0x20,
+	0x48,
+	0x32,
+	0x80,
+	0x6c,
+	0x20,
+	0x16,
+	0x32,
+	0x86,
+	0x3d,
+	0x49,
+	0x05,
+	0x85,
+	0x4d,
+	0x20,
+	0x07,
+	0x32,
+	0x86,
+	0x3c,
+	0x65,
+	0x4d,
+	0x85,
+	0x4d,
+	0xa8,
+	0x20,
+	0x25,
+	0x32,
+	0xa6,
+	0x3d,
+	0x38,
+	0xa5,
+	0x2f,
+	0xfd,
+	0x7b,
+	0x82,
+	0xf0,
+	0x4c,
+	0xa6,
+	0x31,
+	0xd0,
+	0x09,
+	0xa6,
+	0x3d,
+	0xa4,
+	0x4d,
+	0x20,
+	0x48,
+	0x32,
+	0x80,
+	0x3f,
+	0x48,
+	0xa5,
+	0x38,
+	0x85,
+	0x3a,
+	0xa5,
+	0x39,
+	0x85,
+	0x3b,
+	0xa6,
+	0x3c,
+	0x18,
+	0xa5,
+	0x4d,
+	0x69,
+	0x0a,
+	0xa8,
+	0x20,
+	0x25,
+	0x32,
+	0xa6,
+	0x3d,
+	0x38,
+	0xbd,
+	0x7c,
+	0x82,
+	0xfd,
+	0x7b,
+	0x82,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0x68,
+	0x85,
+	0x31,
+	0x38,
+	0xa5,
+	0x38,
+	0xe5,
+	0x3a,
+	0x85,
+	0x32,
+	0xa5,
+	0x39,
+	0xe5,
+	0x3b,
+	0x85,
+	0x33,
+	0xa0,
+	0x02,
+	0x53,
+	0x3a,
+	0x00,
+	0x38,
+	0x00,
+	0xa0,
+	0x00,
+	0xa5,
+	0x33,
+	0x20,
+	0x7f,
+	0x32,
+	0xa6,
+	0x30,
+	0xa5,
+	0x38,
+	0x9d,
+	0x43,
+	0x82,
+	0xa5,
+	0x39,
+	0xe8,
+	0x9d,
+	0x43,
+	0x82,
+	0xe8,
+	0x86,
+	0x30,
+	0x18,
+	0xa5,
+	0x2e,
+	0x69,
+	0x14,
+	0x85,
+	0x2e,
+	0xc9,
+	0x51,
+	0xb0,
+	0x03,
+	0x4c,
+	0xc7,
+	0x32,
+	0x18,
+	0xa5,
+	0x2f,
+	0x69,
+	0x10,
+	0x85,
+	0x2f,
+	0xc9,
+	0x41,
+	0xb0,
+	0x03,
+	0x4c,
+	0xc5,
+	0x32,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x5b,
+	0x82,
+	0x32,
+	0x00,
+	0xa2,
+	0x00,
+	0x38,
+	0xbd,
+	0x43,
+	0x82,
+	0xe5,
+	0x32,
+	0x9d,
+	0x43,
+	0x82,
+	0xe8,
+	0xbd,
+	0x43,
+	0x82,
+	0xe5,
+	0x33,
+	0x9d,
+	0x43,
+	0x82,
+	0xe8,
+	0xe0,
+	0x32,
+	0xd0,
+	0xe9,
+	0x60,
+	0x85,
+	0x4c,
+	0x86,
+	0x4d,
+	0xa2,
+	0x00,
+	0xdc,
+	0xb1,
+	0x4a,
+	0x45,
+	0x2e,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xdc,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x48,
+	0x45,
+	0x2e,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x2e,
+	0x85,
+	0x40,
+	0xdc,
+	0xb1,
+	0x4c,
+	0x45,
+	0x2f,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xdc,
+	0xc8,
+	0xb1,
+	0x4c,
+	0x48,
+	0x45,
+	0x2f,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x2f,
+	0x85,
+	0x40,
+	0x06,
+	0x3e,
+	0xa5,
+	0x3f,
+	0x2a,
+	0xdc,
+	0x91,
+	0x4a,
+	0xa5,
+	0x40,
+	0x2a,
+	0xc8,
+	0x91,
+	0x4a,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x32,
+	0xd0,
+	0xa2,
+	0x60,
+	0xc9,
+	0xa7,
+	0x90,
+	0x03,
+	0xa9,
+	0xa6,
+	0x60,
+	0xc9,
+	0x5a,
+	0xb0,
+	0x02,
+	0xa9,
+	0x5a,
+	0x60,
+	0xad,
+	0x17,
+	0x6b,
+	0x85,
+	0x2e,
+	0xa9,
+	0x80,
+	0x38,
+	0xe5,
+	0x2e,
+	0x85,
+	0x2f,
+	0xa9,
+	0x85,
+	0x85,
+	0x4a,
+	0xa9,
+	0x6b,
+	0x85,
+	0x4b,
+	0xa9,
+	0xdf,
+	0xa2,
+	0x81,
+	0x20,
+	0x1f,
+	0x34,
+	0xa9,
+	0xb7,
+	0x85,
+	0x4a,
+	0xa9,
+	0x6b,
+	0x85,
+	0x4b,
+	0xa9,
+	0x11,
+	0xa2,
+	0x82,
+	0x20,
+	0x1f,
+	0x34,
+	0xa9,
+	0xe9,
+	0x85,
+	0x4a,
+	0xa9,
+	0x6b,
+	0x85,
+	0x4b,
+	0xa9,
+	0xad,
+	0xa2,
+	0x81,
+	0x20,
+	0x1f,
+	0x34,
+	0xa9,
+	0x9d,
+	0x85,
+	0x4a,
+	0xa9,
+	0x74,
+	0x85,
+	0x4b,
+	0xa9,
+	0x4a,
+	0x85,
+	0x4c,
+	0xa9,
+	0x70,
+	0x85,
+	0x4d,
+	0xa9,
+	0xda,
+	0x85,
+	0x4e,
+	0xa9,
+	0x56,
+	0x85,
+	0x4f,
+	0xa2,
+	0x02,
+	0xbd,
+	0x7f,
+	0x6b,
+	0xbc,
+	0x07,
+	0x7d,
+	0x99,
+	0x7e,
+	0x00,
+	0xbd,
+	0x82,
+	0x6b,
+	0xbc,
+	0x0a,
+	0x7d,
+	0x99,
+	0x81,
+	0x00,
+	0xca,
+	0x10,
+	0xeb,
+	0xa9,
+	0x11,
+	0x85,
+	0x2e,
+	0xa9,
+	0x15,
+	0x85,
+	0x2f,
+	0xa0,
+	0x06,
+	0xd3,
+	0x4a,
+	0x75,
+	0x00,
+	0xa0,
+	0x02,
+	0xd3,
+	0x4e,
+	0x30,
+	0x00,
+	0xa6,
+	0x31,
+	0xa4,
+	0x30,
+	0xb9,
+	0x8a,
+	0x56,
+	0x85,
+	0x50,
+	0xd0,
+	0x0d,
+	0xbd,
+	0x85,
+	0x6b,
+	0x85,
+	0x3f,
+	0xbd,
+	0x86,
+	0x6b,
+	0x85,
+	0x40,
+	0x4c,
+	0xdf,
+	0x35,
+	0xb9,
+	0x8b,
+	0x56,
+	0x85,
+	0x51,
+	0xb9,
+	0x8c,
+	0x56,
+	0x85,
+	0x52,
+	0xb9,
+	0x8d,
+	0x56,
+	0x85,
+	0x53,
+	0xbd,
+	0x85,
+	0x6b,
+	0x45,
+	0x50,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xbd,
+	0x86,
+	0x6b,
+	0x48,
+	0x45,
+	0x50,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x50,
+	0x85,
+	0x40,
+	0xa5,
+	0x51,
+	0xf0,
+	0x27,
+	0x5d,
+	0x87,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0x88,
+	0x6b,
+	0x48,
+	0x45,
+	0x51,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x51,
+	0x85,
+	0x40,
+	0xa5,
+	0x52,
+	0xf0,
+	0x27,
+	0x5d,
+	0x8f,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0x90,
+	0x6b,
+	0x48,
+	0x45,
+	0x52,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x52,
+	0x85,
+	0x40,
+	0xa5,
+	0x53,
+	0xf0,
+	0x27,
+	0x5d,
+	0x91,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0x92,
+	0x6b,
+	0x48,
+	0x45,
+	0x53,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x53,
+	0x85,
+	0x40,
+	0xa5,
+	0x3e,
+	0x10,
+	0x06,
+	0xe6,
+	0x3f,
+	0xd0,
+	0x02,
+	0xe6,
+	0x40,
+	0xa5,
+	0x40,
+	0x30,
+	0x15,
+	0x49,
+	0x0b,
+	0x18,
+	0x69,
+	0x80,
+	0x85,
+	0x33,
+	0xa5,
+	0x3f,
+	0x49,
+	0x0b,
+	0x85,
+	0x32,
+	0x98,
+	0x18,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x80,
+	0x2b,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x3f,
+	0xa8,
+	0xa9,
+	0x00,
+	0xe5,
+	0x40,
+	0x85,
+	0x40,
+	0x98,
+	0x49,
+	0x0b,
+	0x85,
+	0x3e,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x3e,
+	0x85,
+	0x32,
+	0x84,
+	0x3e,
+	0xa9,
+	0x80,
+	0xe5,
+	0x3e,
+	0x48,
+	0xa5,
+	0x40,
+	0x49,
+	0x0b,
+	0x85,
+	0x3e,
+	0x38,
+	0x68,
+	0xe5,
+	0x3e,
+	0x85,
+	0x33,
+	0xa5,
+	0x75,
+	0x45,
+	0x7e,
+	0x85,
+	0x34,
+	0x84,
+	0x35,
+	0xa5,
+	0x76,
+	0x45,
+	0x7f,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x65,
+	0x35,
+	0x85,
+	0x35,
+	0xa5,
+	0x77,
+	0x45,
+	0x80,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x65,
+	0x35,
+	0x06,
+	0x34,
+	0x2a,
+	0x06,
+	0x34,
+	0x69,
+	0x00,
+	0x85,
+	0x34,
+	0x45,
+	0x32,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xa5,
+	0x34,
+	0x45,
+	0x33,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x06,
+	0x3f,
+	0x2a,
+	0xb0,
+	0x0a,
+	0x06,
+	0x3f,
+	0x69,
+	0x00,
+	0xb0,
+	0x04,
+	0xc9,
+	0xf4,
+	0x90,
+	0x04,
+	0xa9,
+	0xf3,
+	0x80,
+	0x06,
+	0xc9,
+	0x40,
+	0xb0,
+	0x02,
+	0xa9,
+	0x40,
+	0x92,
+	0x4c,
+	0xa6,
+	0x31,
+	0xa5,
+	0x50,
+	0xd0,
+	0x0d,
+	0xbd,
+	0xb7,
+	0x6b,
+	0x85,
+	0x3f,
+	0xbd,
+	0xb8,
+	0x6b,
+	0x85,
+	0x40,
+	0x4c,
+	0x38,
+	0x37,
+	0xbd,
+	0xb7,
+	0x6b,
+	0x45,
+	0x50,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xbd,
+	0xb8,
+	0x6b,
+	0x48,
+	0x45,
+	0x50,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x50,
+	0x85,
+	0x40,
+	0xa5,
+	0x51,
+	0xf0,
+	0x27,
+	0x5d,
+	0xb9,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xba,
+	0x6b,
+	0x48,
+	0x45,
+	0x51,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x51,
+	0x85,
+	0x40,
+	0xa5,
+	0x52,
+	0xf0,
+	0x27,
+	0x5d,
+	0xc1,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xc2,
+	0x6b,
+	0x48,
+	0x45,
+	0x52,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x52,
+	0x85,
+	0x40,
+	0xa5,
+	0x53,
+	0xf0,
+	0x27,
+	0x5d,
+	0xc3,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xc4,
+	0x6b,
+	0x48,
+	0x45,
+	0x53,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x53,
+	0x85,
+	0x40,
+	0xa5,
+	0x3e,
+	0x10,
+	0x06,
+	0xe6,
+	0x3f,
+	0xd0,
+	0x02,
+	0xe6,
+	0x40,
+	0xa5,
+	0x40,
+	0x30,
+	0x15,
+	0x49,
+	0x0b,
+	0x18,
+	0x69,
+	0x80,
+	0x85,
+	0x33,
+	0xa5,
+	0x3f,
+	0x49,
+	0x0b,
+	0x85,
+	0x32,
+	0x98,
+	0x18,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x80,
+	0x2b,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x3f,
+	0xa8,
+	0xa9,
+	0x00,
+	0xe5,
+	0x40,
+	0x85,
+	0x40,
+	0x98,
+	0x49,
+	0x0b,
+	0x85,
+	0x3e,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x3e,
+	0x85,
+	0x32,
+	0x84,
+	0x3e,
+	0xa9,
+	0x80,
+	0xe5,
+	0x3e,
+	0x48,
+	0xa5,
+	0x40,
+	0x49,
+	0x0b,
+	0x85,
+	0x3e,
+	0x38,
+	0x68,
+	0xe5,
+	0x3e,
+	0x85,
+	0x33,
+	0xa5,
+	0x81,
+	0x45,
+	0x78,
+	0x85,
+	0x34,
+	0x84,
+	0x35,
+	0xa5,
+	0x82,
+	0x45,
+	0x79,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x65,
+	0x35,
+	0x85,
+	0x35,
+	0xa5,
+	0x83,
+	0x45,
+	0x7a,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x65,
+	0x35,
+	0x06,
+	0x34,
+	0x2a,
+	0x06,
+	0x34,
+	0x69,
+	0x00,
+	0x85,
+	0x34,
+	0x45,
+	0x32,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xa5,
+	0x34,
+	0x45,
+	0x33,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x06,
+	0x3f,
+	0x2a,
+	0xb0,
+	0x0a,
+	0x06,
+	0x3f,
+	0x69,
+	0x00,
+	0xb0,
+	0x04,
+	0xc9,
+	0xf4,
+	0x90,
+	0x04,
+	0xa9,
+	0xf3,
+	0x80,
+	0x06,
+	0xc9,
+	0x40,
+	0xb0,
+	0x02,
+	0xa9,
+	0x40,
+	0xa0,
+	0x01,
+	0x91,
+	0x4c,
+	0xa6,
+	0x31,
+	0xa5,
+	0x50,
+	0xd0,
+	0x0d,
+	0xbd,
+	0xe9,
+	0x6b,
+	0x85,
+	0x3f,
+	0xbd,
+	0xea,
+	0x6b,
+	0x85,
+	0x40,
+	0x4c,
+	0x93,
+	0x38,
+	0xbd,
+	0xe9,
+	0x6b,
+	0x45,
+	0x50,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xbd,
+	0xea,
+	0x6b,
+	0x48,
+	0x45,
+	0x50,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x50,
+	0x85,
+	0x40,
+	0xa5,
+	0x51,
+	0xf0,
+	0x27,
+	0x5d,
+	0xeb,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xec,
+	0x6b,
+	0x48,
+	0x45,
+	0x51,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x51,
+	0x85,
+	0x40,
+	0xa5,
+	0x52,
+	0xf0,
+	0x27,
+	0x5d,
+	0xf3,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xf4,
+	0x6b,
+	0x48,
+	0x45,
+	0x52,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x52,
+	0x85,
+	0x40,
+	0xa5,
+	0x53,
+	0xf0,
+	0x27,
+	0x5d,
+	0xf5,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xf6,
+	0x6b,
+	0x48,
+	0x45,
+	0x53,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x53,
+	0x85,
+	0x40,
+	0xa5,
+	0x3e,
+	0x10,
+	0x06,
+	0xe6,
+	0x3f,
+	0xd0,
+	0x02,
+	0xe6,
+	0x40,
+	0xa2,
+	0x00,
+	0xa5,
+	0x40,
+	0x10,
+	0x0e,
+	0xe8,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x3f,
+	0x85,
+	0x3f,
+	0xa9,
+	0x00,
+	0xe5,
+	0x40,
+	0x85,
+	0x40,
+	0xda,
+	0xa5,
+	0x3f,
+	0x49,
+	0x0b,
+	0x85,
+	0x32,
+	0x84,
+	0x33,
+	0xa5,
+	0x40,
+	0x49,
+	0x0b,
+	0x18,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x46,
+	0x33,
+	0x66,
+	0x32,
+	0x10,
+	0x02,
+	0xe6,
+	0x33,
+	0x18,
+	0xa5,
+	0x33,
+	0x69,
+	0x80,
+	0xaa,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0x33,
+	0x7a,
+	0xf0,
+	0x01,
+	0x8a,
+	0x20,
+	0x84,
+	0x34,
+	0xa0,
+	0x02,
+	0x91,
+	0x4c,
+	0x18,
+	0xa5,
+	0x4a,
+	0x69,
+	0x06,
+	0x85,
+	0x4a,
+	0x90,
+	0x03,
+	0xe6,
+	0x4b,
+	0x18,
+	0xa5,
+	0x4c,
+	0x69,
+	0x03,
+	0x85,
+	0x4c,
+	0x90,
+	0x03,
+	0xe6,
+	0x4d,
+	0x18,
+	0xa5,
+	0x4e,
+	0x69,
+	0x02,
+	0x85,
+	0x4e,
+	0x90,
+	0x02,
+	0xe6,
+	0x4f,
+	0xc6,
+	0x2f,
+	0xf0,
+	0x03,
+	0x4c,
+	0x02,
+	0x35,
+	0xc6,
+	0x2e,
+	0xf0,
+	0x03,
+	0x4c,
+	0xfe,
+	0x34,
+	0xa9,
+	0x01,
+	0x85,
+	0x22,
+	0x60,
+	0x64,
+	0x36,
+	0x64,
+	0x37,
+	0xa2,
+	0x10,
+	0x06,
+	0x32,
+	0x26,
+	0x33,
+	0x26,
+	0x36,
+	0x26,
+	0x37,
+	0xa5,
+	0x36,
+	0x38,
+	0xe5,
+	0x34,
+	0xa8,
+	0xa5,
+	0x37,
+	0xe5,
+	0x35,
+	0x90,
+	0x06,
+	0x85,
+	0x37,
+	0x84,
+	0x36,
+	0xe6,
+	0x32,
+	0xca,
+	0xd0,
+	0xe3,
+	0x60,
+	0x20,
+	0x0b,
+	0x39,
+	0x46,
+	0x35,
+	0x66,
+	0x34,
+	0x90,
+	0x06,
+	0xe6,
+	0x34,
+	0xd0,
+	0x02,
+	0xe6,
+	0x35,
+	0x38,
+	0xa5,
+	0x36,
+	0xe5,
+	0x34,
+	0xa5,
+	0x37,
+	0xe5,
+	0x35,
+	0x30,
+	0x06,
+	0xe6,
+	0x32,
+	0xd0,
+	0x02,
+	0xe6,
+	0x33,
+	0x60,
+	0xa5,
+	0x32,
+	0x45,
+	0x34,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xa5,
+	0x32,
+	0x45,
+	0x35,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x40,
+	0xa5,
+	0x33,
+	0x45,
+	0x34,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x85,
+	0x40,
+	0xa5,
+	0x33,
+	0x45,
+	0x35,
+	0x65,
+	0x40,
+	0x85,
+	0x40,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x41,
+	0xa5,
+	0x35,
+	0x10,
+	0x0d,
+	0x38,
+	0xa5,
+	0x40,
+	0xe5,
+	0x32,
+	0x85,
+	0x40,
+	0xa5,
+	0x41,
+	0xe5,
+	0x33,
+	0x85,
+	0x41,
+	0x60,
+	0xa5,
+	0x32,
+	0x45,
+	0x34,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xa5,
+	0x32,
+	0x45,
+	0x35,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x40,
+	0xa5,
+	0x33,
+	0x45,
+	0x34,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x85,
+	0x40,
+	0xa5,
+	0x33,
+	0x45,
+	0x35,
+	0x65,
+	0x40,
+	0x85,
+	0x40,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x41,
+	0x60,
+	0xda,
+	0x29,
+	0x01,
+	0xf0,
+	0x06,
+	0xa9,
+	0x68,
+	0xa0,
+	0x04,
+	0x80,
+	0x04,
+	0xa9,
+	0x90,
+	0xa0,
+	0x00,
+	0x85,
+	0xe6,
+	0x84,
+	0xe7,
+	0x38,
+	0xa5,
+	0xb5,
+	0xe5,
+	0xb4,
+	0x1a,
+	0x1a,
+	0x85,
+	0xde,
+	0xa0,
+	0x02,
+	0x53,
+	0xac,
+	0x00,
+	0xea,
+	0x00,
+	0xa5,
+	0xb4,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x02,
+	0xa5,
+	0xb5,
+	0xaa,
+	0x85,
+	0xdf,
+	0x8a,
+	0x18,
+	0x65,
+	0xb6,
+	0x49,
+	0x03,
+	0x85,
+	0xe8,
+	0xa5,
+	0xaa,
+	0x48,
+	0x18,
+	0x65,
+	0xbd,
+	0x49,
+	0x3f,
+	0x65,
+	0xe8,
+	0x90,
+	0x02,
+	0xc8,
+	0x18,
+	0x69,
+	0x1b,
+	0x85,
+	0xe2,
+	0x98,
+	0x69,
+	0x6c,
+	0x85,
+	0xe3,
+	0x68,
+	0x1a,
+	0x38,
+	0xe5,
+	0xbd,
+	0x49,
+	0x3f,
+	0x18,
+	0x65,
+	0xe8,
+	0x90,
+	0x02,
+	0xc8,
+	0x18,
+	0x69,
+	0x1b,
+	0x85,
+	0xe4,
+	0x98,
+	0x69,
+	0x6c,
+	0x85,
+	0xe5,
+	0xa0,
+	0x03,
+	0xd3,
+	0xe2,
+	0xd4,
+	0x00,
+	0xd3,
+	0xe4,
+	0xd8,
+	0x00,
+	0xa0,
+	0x02,
+	0x53,
+	0xe6,
+	0x00,
+	0x0c,
+	0xc0,
+	0xad,
+	0x76,
+	0x60,
+	0xa8,
+	0x29,
+	0x01,
+	0xd0,
+	0x0a,
+	0xa2,
+	0x80,
+	0x86,
+	0xd4,
+	0x86,
+	0xd5,
+	0x86,
+	0xd8,
+	0x86,
+	0xd9,
+	0x98,
+	0x29,
+	0x02,
+	0xd0,
+	0x06,
+	0xa2,
+	0x80,
+	0x86,
+	0xd6,
+	0x86,
+	0xda,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xd6,
+	0x85,
+	0xd7,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xda,
+	0x85,
+	0xdb,
+	0xa0,
+	0x08,
+	0x43,
+	0xd4,
+	0x00,
+	0x54,
+	0xc0,
+	0xc6,
+	0xde,
+	0xd0,
+	0x03,
+	0x4c,
+	0x25,
+	0x3b,
+	0xa4,
+	0xb6,
+	0xd0,
+	0x04,
+	0xe6,
+	0xdf,
+	0x80,
+	0x02,
+	0xc6,
+	0xdf,
+	0xa0,
+	0x03,
+	0xc3,
+	0xea,
+	0x54,
+	0xc0,
+	0xc3,
+	0xae,
+	0x54,
+	0xc0,
+	0xc3,
+	0xb0,
+	0x54,
+	0xc0,
+	0xc3,
+	0xb2,
+	0x54,
+	0xc0,
+	0xa5,
+	0xdf,
+	0xa6,
+	0xb6,
+	0xd0,
+	0x18,
+	0x18,
+	0xa5,
+	0xe2,
+	0x69,
+	0x03,
+	0x85,
+	0xe2,
+	0x90,
+	0x03,
+	0xe6,
+	0xe3,
+	0x18,
+	0xa5,
+	0xe4,
+	0x69,
+	0x03,
+	0x85,
+	0xe4,
+	0x90,
+	0x02,
+	0xe6,
+	0xe5,
+	0x80,
+	0x16,
+	0x38,
+	0xa5,
+	0xe2,
+	0xe9,
+	0x03,
+	0x85,
+	0xe2,
+	0xb0,
+	0x03,
+	0xc6,
+	0xe3,
+	0x38,
+	0xa5,
+	0xe4,
+	0xe9,
+	0x03,
+	0x85,
+	0xe4,
+	0xb0,
+	0x02,
+	0xc6,
+	0xe5,
+	0xa5,
+	0xde,
+	0x3a,
+	0xf0,
+	0x4f,
+	0xa0,
+	0x02,
+	0x53,
+	0xea,
+	0x00,
+	0xb2,
+	0x00,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x23,
+	0x38,
+	0xa5,
+	0xae,
+	0xe9,
+	0x03,
+	0x85,
+	0xae,
+	0xb0,
+	0x03,
+	0xc6,
+	0xaf,
+	0x38,
+	0xa5,
+	0xea,
+	0xe9,
+	0x03,
+	0x85,
+	0xea,
+	0xb0,
+	0x03,
+	0xc6,
+	0xeb,
+	0x38,
+	0xa5,
+	0xb0,
+	0xe9,
+	0x03,
+	0x85,
+	0xb0,
+	0xb0,
+	0x25,
+	0xc6,
+	0xb1,
+	0x80,
+	0x21,
+	0x18,
+	0xa5,
+	0xae,
+	0x69,
+	0x03,
+	0x85,
+	0xae,
+	0x90,
+	0x03,
+	0xe6,
+	0xaf,
+	0x18,
+	0xa5,
+	0xea,
+	0x69,
+	0x03,
+	0x85,
+	0xea,
+	0x90,
+	0x03,
+	0xe6,
+	0xeb,
+	0x18,
+	0xa5,
+	0xb0,
+	0x69,
+	0x03,
+	0x85,
+	0xb0,
+	0x90,
+	0x02,
+	0xe6,
+	0xb1,
+	0x18,
+	0xa5,
+	0xe6,
+	0x69,
+	0x18,
+	0x85,
+	0xe6,
+	0x90,
+	0x02,
+	0xe6,
+	0xe7,
+	0x4c,
+	0x29,
+	0x3a,
+	0xa0,
+	0x03,
+	0xc3,
+	0xea,
+	0x54,
+	0xc0,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x04,
+	0xc6,
+	0xaa,
+	0x80,
+	0x02,
+	0xe6,
+	0xaa,
+	0xc6,
+	0xab,
+	0xf0,
+	0x40,
+	0xa5,
+	0xac,
+	0xa4,
+	0xad,
+	0x85,
+	0xae,
+	0x84,
+	0xaf,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x08,
+	0x38,
+	0xe9,
+	0x3c,
+	0xb0,
+	0x09,
+	0x88,
+	0x80,
+	0x06,
+	0x18,
+	0x69,
+	0x3c,
+	0x90,
+	0x01,
+	0xc8,
+	0x85,
+	0xac,
+	0x84,
+	0xad,
+	0xa6,
+	0xab,
+	0xca,
+	0xf0,
+	0x12,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x08,
+	0x38,
+	0xe9,
+	0x3c,
+	0xb0,
+	0x09,
+	0x88,
+	0x80,
+	0x06,
+	0x18,
+	0x69,
+	0x3c,
+	0x90,
+	0x01,
+	0xc8,
+	0x85,
+	0xb0,
+	0x84,
+	0xb1,
+	0xa0,
+	0x02,
+	0x53,
+	0xac,
+	0x00,
+	0xb2,
+	0x00,
+	0xfa,
+	0x60,
+	0x64,
+	0xe6,
+	0x64,
+	0xe7,
+	0xa2,
+	0x10,
+	0x06,
+	0xe2,
+	0x26,
+	0xe3,
+	0x26,
+	0xe6,
+	0x26,
+	0xe7,
+	0xa5,
+	0xe6,
+	0x38,
+	0xe5,
+	0xe4,
+	0xa8,
+	0xa5,
+	0xe7,
+	0xe5,
+	0xe5,
+	0x90,
+	0x06,
+	0x85,
+	0xe7,
+	0x84,
+	0xe6,
+	0xe6,
+	0xe2,
+	0xca,
+	0xd0,
+	0xe3,
+	0x60,
+	0xa5,
+	0xc0,
+	0x49,
+	0x1a,
+	0x84,
+	0x17,
+	0xa6,
+	0xb4,
+	0xbd,
+	0x79,
+	0x6a,
+	0xc5,
+	0x17,
+	0xb0,
+	0x01,
+	0xe8,
+	0x86,
+	0x28,
+	0xa6,
+	0xb5,
+	0xbd,
+	0x79,
+	0x6a,
+	0xc5,
+	0x17,
+	0xb0,
+	0x01,
+	0xca,
+	0x86,
+	0x29,
+	0x8a,
+	0xa5,
+	0xc2,
+	0x49,
+	0x1a,
+	0x84,
+	0xe3,
+	0xa6,
+	0xbe,
+	0xbd,
+	0x8d,
+	0x6a,
+	0xc5,
+	0xe3,
+	0xb0,
+	0x01,
+	0xe8,
+	0x86,
+	0x26,
+	0xa6,
+	0xbf,
+	0xbd,
+	0x8d,
+	0x6a,
+	0xc5,
+	0xe3,
+	0xb0,
+	0x01,
+	0xca,
+	0x86,
+	0x27,
+	0xa4,
+	0xbd,
+	0xd0,
+	0x02,
+	0xa6,
+	0x26,
+	0x86,
+	0x60,
+	0xa5,
+	0x26,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x02,
+	0xa5,
+	0x27,
+	0x49,
+	0x64,
+	0x18,
+	0x69,
+	0x37,
+	0x85,
+	0xbb,
+	0x85,
+	0x2a,
+	0x98,
+	0x69,
+	0x64,
+	0x85,
+	0xbc,
+	0x85,
+	0x2b,
+	0xa5,
+	0x28,
+	0x49,
+	0x05,
+	0x65,
+	0x2a,
+	0x85,
+	0x2a,
+	0x90,
+	0x03,
+	0xe6,
+	0x2b,
+	0x18,
+	0xa5,
+	0x28,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x02,
+	0xa5,
+	0x29,
+	0x49,
+	0x05,
+	0x65,
+	0xbb,
+	0x85,
+	0xbb,
+	0x90,
+	0x02,
+	0xe6,
+	0xbc,
+	0x60,
+	0xfc,
+	0xf0,
+	0x11,
+	0xa2,
+	0x07,
+	0x85,
+	0xe3,
+	0x98,
+	0x80,
+	0x02,
+	0x66,
+	0xe3,
+	0xe8,
+	0x4a,
+	0xd0,
+	0xfa,
+	0x66,
+	0xe3,
+	0x80,
+	0x0b,
+	0xa2,
+	0x07,
+	0xa8,
+	0x30,
+	0x04,
+	0xca,
+	0x0a,
+	0x10,
+	0xfc,
+	0x85,
+	0xe3,
+	0x8a,
+	0x0a,
+	0xaa,
+	0xa5,
+	0xe3,
+	0x29,
+	0x7f,
+	0xa8,
+	0x60,
+	0x7c,
+	0xc0,
+	0x3f,
+	0xda,
+	0xa0,
+	0x02,
+	0x53,
+	0xbb,
+	0x00,
+	0xd4,
+	0x00,
+	0x53,
+	0xb7,
+	0x00,
+	0xd6,
+	0x00,
+	0x29,
+	0x01,
+	0xf0,
+	0x06,
+	0xa9,
+	0xd0,
+	0xa2,
+	0x0a,
+	0x80,
+	0x04,
+	0xa9,
+	0x40,
+	0xa2,
+	0x08,
+	0x8d,
+	0x0c,
+	0xc0,
+	0x8e,
+	0x0d,
+	0xc0,
+	0xa5,
+	0xb4,
+	0xf0,
+	0x17,
+	0x49,
+	0x03,
+	0x5a,
+	0x48,
+	0xa5,
+	0xb9,
+	0x49,
+	0x3c,
+	0x18,
+	0x69,
+	0x77,
+	0x85,
+	0xe2,
+	0x98,
+	0x69,
+	0x60,
+	0x85,
+	0xe3,
+	0xfa,
+	0x68,
+	0x20,
+	0x90,
+	0x3e,
+	0x38,
+	0xa9,
+	0x13,
+	0xe5,
+	0xb5,
+	0xf0,
+	0x24,
+	0x49,
+	0x03,
+	0x5a,
+	0x48,
+	0xa5,
+	0xb9,
+	0x49,
+	0x3c,
+	0x18,
+	0x69,
+	0x77,
+	0x85,
+	0xe2,
+	0x98,
+	0x69,
+	0x60,
+	0x85,
+	0xe3,
+	0xa5,
+	0xb5,
+	0x1a,
+	0x49,
+	0x03,
+	0x65,
+	0xe2,
+	0x85,
+	0xe2,
+	0x90,
+	0x02,
+	0xe6,
+	0xe3,
+	0xfa,
+	0x68,
+	0x20,
+	0x90,
+	0x3e,
+	0x38,
+	0xa5,
+	0xb5,
+	0xaa,
+	0xa4,
+	0xb6,
+	0xd0,
+	0x02,
+	0xa6,
+	0xb4,
+	0x86,
+	0xdf,
+	0xe5,
+	0xb4,
+	0x1a,
+	0x85,
+	0xde,
+	0x64,
+	0xf3,
+	0xa2,
+	0x00,
+	0xa4,
+	0xb9,
+	0xb9,
+	0x8d,
+	0x6a,
+	0x85,
+	0xe1,
+	0xa5,
+	0xc2,
+	0x49,
+	0x1a,
+	0xa2,
+	0x01,
+	0xc4,
+	0xe1,
+	0xf0,
+	0x03,
+	0x90,
+	0x01,
+	0xca,
+	0x86,
+	0xee,
+	0xa6,
+	0x28,
+	0xa4,
+	0x29,
+	0xa5,
+	0xb6,
+	0xf0,
+	0x03,
+	0x8a,
+	0xfc,
+	0xa8,
+	0x86,
+	0xf2,
+	0x84,
+	0xef,
+	0xa6,
+	0x26,
+	0xa4,
+	0x27,
+	0xa5,
+	0xbd,
+	0xf0,
+	0x03,
+	0x8a,
+	0xfc,
+	0xa8,
+	0x86,
+	0xf0,
+	0x84,
+	0xf1,
+	0xa0,
+	0x10,
+	0x13,
+	0x54,
+	0xc0,
+	0xc4,
+	0x00,
+	0xa4,
+	0xdf,
+	0xa2,
+	0x00,
+	0xa5,
+	0xa8,
+	0xf0,
+	0x0f,
+	0xa5,
+	0xee,
+	0xf0,
+	0x0b,
+	0xc4,
+	0x28,
+	0x90,
+	0x07,
+	0xc4,
+	0x29,
+	0xf0,
+	0x02,
+	0xb0,
+	0x01,
+	0xe8,
+	0x86,
+	0x97,
+	0xb9,
+	0x79,
+	0x6a,
+	0x85,
+	0xe2,
+	0xaa,
+	0x45,
+	0xe1,
+	0x84,
+	0x9a,
+	0x49,
+	0x20,
+	0x85,
+	0x98,
+	0x84,
+	0x99,
+	0xa5,
+	0x9a,
+	0x49,
+	0x20,
+	0x18,
+	0x65,
+	0x99,
+	0x85,
+	0x99,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x9a,
+	0x38,
+	0xa5,
+	0xc4,
+	0xe5,
+	0x98,
+	0x85,
+	0xc4,
+	0xa5,
+	0xc5,
+	0xe5,
+	0x99,
+	0x85,
+	0xc5,
+	0xa5,
+	0xc6,
+	0xe5,
+	0x9a,
+	0x85,
+	0xc6,
+	0xa5,
+	0xc7,
+	0xe9,
+	0x00,
+	0x85,
+	0xc7,
+	0x10,
+	0x08,
+	0x64,
+	0xc4,
+	0x64,
+	0xc5,
+	0x64,
+	0xc6,
+	0x64,
+	0xc7,
+	0x38,
+	0xa5,
+	0xc8,
+	0xe5,
+	0x98,
+	0x85,
+	0xc8,
+	0xa5,
+	0xc9,
+	0xe5,
+	0x99,
+	0x85,
+	0xc9,
+	0xa5,
+	0xca,
+	0xe5,
+	0x9a,
+	0x85,
+	0xca,
+	0xa5,
+	0xcb,
+	0xe9,
+	0x00,
+	0x85,
+	0xcb,
+	0x10,
+	0x08,
+	0x64,
+	0xc8,
+	0x64,
+	0xc9,
+	0x64,
+	0xca,
+	0x64,
+	0xcb,
+	0x38,
+	0xa5,
+	0xcc,
+	0xe5,
+	0x98,
+	0x85,
+	0xcc,
+	0xa5,
+	0xcd,
+	0xe5,
+	0x99,
+	0x85,
+	0xcd,
+	0xa5,
+	0xce,
+	0xe5,
+	0x9a,
+	0x85,
+	0xce,
+	0xa5,
+	0xcf,
+	0xe9,
+	0x00,
+	0x85,
+	0xcf,
+	0x10,
+	0x08,
+	0x64,
+	0xcc,
+	0x64,
+	0xcd,
+	0x64,
+	0xce,
+	0x64,
+	0xcf,
+	0x38,
+	0xa5,
+	0xd0,
+	0xe5,
+	0x98,
+	0x85,
+	0xd0,
+	0xa5,
+	0xd1,
+	0xe5,
+	0x99,
+	0x85,
+	0xd1,
+	0xa5,
+	0xd2,
+	0xe5,
+	0x9a,
+	0x85,
+	0xd2,
+	0xa5,
+	0xd3,
+	0xe9,
+	0x00,
+	0x85,
+	0xd3,
+	0x10,
+	0x08,
+	0x64,
+	0xd0,
+	0x64,
+	0xd1,
+	0x64,
+	0xd2,
+	0x64,
+	0xd3,
+	0x8a,
+	0xa6,
+	0x97,
+	0xf0,
+	0x07,
+	0xa0,
+	0x10,
+	0x53,
+	0xc4,
+	0x00,
+	0x98,
+	0x00,
+	0xa5,
+	0xe1,
+	0x45,
+	0xe2,
+	0x20,
+	0x1c,
+	0x3c,
+	0x5a,
+	0x20,
+	0x44,
+	0x3c,
+	0x7a,
+	0xb9,
+	0xcc,
+	0x5b,
+	0x20,
+	0x59,
+	0x15,
+	0xa0,
+	0x03,
+	0x73,
+	0xe6,
+	0x00,
+	0xd6,
+	0xa5,
+	0x97,
+	0xd0,
+	0x02,
+	0x80,
+	0x27,
+	0xa5,
+	0xdf,
+	0x20,
+	0xce,
+	0x14,
+	0xa0,
+	0x05,
+	0x73,
+	0xe9,
+	0x00,
+	0xd4,
+	0x84,
+	0xf3,
+	0xa5,
+	0xd4,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x0b,
+	0x38,
+	0xe9,
+	0x05,
+	0x85,
+	0xd4,
+	0xb0,
+	0x0d,
+	0xc6,
+	0xd5,
+	0x80,
+	0x09,
+	0x18,
+	0x69,
+	0x05,
+	0x85,
+	0xd4,
+	0x90,
+	0x02,
+	0xe6,
+	0xd5,
+	0xa5,
+	0xd6,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x0b,
+	0x38,
+	0xe9,
+	0x03,
+	0x85,
+	0xd6,
+	0xb0,
+	0x0d,
+	0xc6,
+	0xd7,
+	0x80,
+	0x09,
+	0x18,
+	0x69,
+	0x03,
+	0x85,
+	0xd6,
+	0x90,
+	0x02,
+	0xe6,
+	0xd7,
+	0xc6,
+	0xde,
+	0xf0,
+	0x0e,
+	0xa5,
+	0xb6,
+	0xf0,
+	0x05,
+	0xc6,
+	0xdf,
+	0x4c,
+	0xf7,
+	0x3c,
+	0xe6,
+	0xdf,
+	0x4c,
+	0xf7,
+	0x3c,
+	0xa5,
+	0xb7,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x0b,
+	0x38,
+	0xe9,
+	0x3c,
+	0x85,
+	0xb7,
+	0xb0,
+	0x0d,
+	0xc6,
+	0xb8,
+	0x80,
+	0x09,
+	0x18,
+	0x69,
+	0x3c,
+	0x85,
+	0xb7,
+	0x90,
+	0x02,
+	0xe6,
+	0xb8,
+	0xa6,
+	0xb9,
+	0xe4,
+	0xf1,
+	0xd0,
+	0x02,
+	0x64,
+	0xa8,
+	0xa5,
+	0xee,
+	0xf0,
+	0x1a,
+	0xa5,
+	0xbb,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x0b,
+	0x38,
+	0xe9,
+	0x64,
+	0x85,
+	0xbb,
+	0xb0,
+	0x0d,
+	0xc6,
+	0xbc,
+	0x80,
+	0x09,
+	0x18,
+	0x69,
+	0x64,
+	0x85,
+	0xbb,
+	0x90,
+	0x02,
+	0xe6,
+	0xbc,
+	0xa5,
+	0xf3,
+	0xf0,
+	0x02,
+	0xe6,
+	0x24,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x04,
+	0xc6,
+	0xb9,
+	0x80,
+	0x02,
+	0xe6,
+	0xb9,
+	0xfa,
+	0x60,
+	0x64,
+	0xde,
+	0xda,
+	0xaa,
+	0xf0,
+	0x0b,
+	0xa0,
+	0x00,
+	0x33,
+	0xde,
+	0x00,
+	0xe2,
+	0xe6,
+	0xe3,
+	0x3a,
+	0xd0,
+	0xf7,
+	0x7a,
+	0xf0,
+	0x04,
+	0x33,
+	0xde,
+	0x00,
+	0xe2,
+	0x60,
+	0xba,
+	0x08,
+	0x78,
+	0x68,
+	0x48,
+	0x29,
+	0x1c,
+	0x85,
+	0xf6,
+	0x86,
+	0xf4,
+	0xa9,
+	0x01,
+	0x85,
+	0xf5,
+	0xa0,
+	0x06,
+	0xb1,
+	0xf4,
+	0x48,
+	0x29,
+	0x1c,
+	0xc5,
+	0xf6,
+	0x90,
+	0x08,
+	0x7a,
+	0xa0,
+	0x09,
+	0xb1,
+	0xf4,
+	0x48,
+	0x29,
+	0x1c,
+	0xc9,
+	0x00,
+	0xd0,
+	0x38,
+	0xa0,
+	0x03,
+	0xb1,
+	0xf4,
+	0xe0,
+	0x7f,
+	0xb0,
+	0x18,
+	0x8d,
+	0x82,
+	0x82,
+	0xc8,
+	0xb1,
+	0xf4,
+	0x8d,
+	0x83,
+	0x82,
+	0xc8,
+	0xb1,
+	0xf4,
+	0x8d,
+	0x84,
+	0x82,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0x85,
+	0x82,
+	0x80,
+	0x16,
+	0x8d,
+	0x86,
+	0x82,
+	0xc8,
+	0xb1,
+	0xf4,
+	0x8d,
+	0x87,
+	0x82,
+	0xc8,
+	0xb1,
+	0xf4,
+	0x8d,
+	0x88,
+	0x82,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0x89,
+	0x82,
+	0xa9,
+	0x00,
+	0xfa,
+	0x28,
+	0xf8,
+	0x60,
+	0x68,
+	0xf0,
+	0x04,
+	0x68,
+	0xfa,
+	0x7a,
+	0x40,
+	0x08,
+	0x78,
+	0x68,
+	0xad,
+	0x81,
+	0x82,
+	0xf0,
+	0x0e,
+	0xae,
+	0x85,
+	0x82,
+	0x9a,
+	0xad,
+	0x82,
+	0x82,
+	0xae,
+	0x83,
+	0x82,
+	0xac,
+	0x84,
+	0x82,
+	0x40,
+	0xae,
+	0x89,
+	0x82,
+	0x9a,
+	0xad,
+	0x86,
+	0x82,
+	0xae,
+	0x87,
+	0x82,
+	0xac,
+	0x88,
+	0x82,
+	0x40,
+	0x08,
+	0x78,
+	0xad,
+	0x81,
+	0x82,
+	0xd0,
+	0x1f,
+	0x1a,
+	0x8d,
+	0x81,
+	0x82,
+	0xa9,
+	0x7c,
+	0x8d,
+	0x85,
+	0x82,
+	0x9c,
+	0x82,
+	0x82,
+	0x9c,
+	0x83,
+	0x82,
+	0x9c,
+	0x84,
+	0x82,
+	0xa9,
+	0x07,
+	0x8d,
+	0x7f,
+	0x01,
+	0xa9,
+	0x0a,
+	0x8d,
+	0x7e,
+	0x01,
+	0x9c,
+	0x7d,
+	0x01,
+	0x28,
+	0x60,
+	0x08,
+	0x78,
+	0xa9,
+	0x0e,
+	0x8d,
+	0xfe,
+	0x01,
+	0xa9,
+	0x07,
+	0x8d,
+	0xfd,
+	0x01,
+	0xad,
+	0x16,
+	0x6b,
+	0x8d,
+	0xfc,
+	0x01,
+	0xa9,
+	0xfb,
+	0x8d,
+	0x89,
+	0x82,
+	0x9c,
+	0x86,
+	0x82,
+	0x9c,
+	0x87,
+	0x82,
+	0x9c,
+	0x88,
+	0x82,
+	0x28,
+	0x60,
+	0xd6,
+	0x03,
+	0x0c,
+	0x06,
+	0x86,
+	0x1c,
+	0xbd,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xf0,
+	0x0d,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x00,
+	0x04,
+	0x08,
+	0x0d,
+	0x11,
+	0x15,
+	0x1a,
+	0x1e,
+	0x23,
+	0x27,
+	0x00,
+	0x04,
+	0x09,
+	0x0d,
+	0x12,
+	0x17,
+	0x1b,
+	0x00,
+	0x01,
+	0x02,
+	0x00,
+	0x02,
+	0x01,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x01,
+	0x02,
+	0x02,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x01,
+	0x01,
+	0x02,
+	0x00,
+	0x01,
+	0x02,
+	0x04,
+	0x08,
+	0x10,
+	0x20,
+	0x40,
+	0x80,
+	0xef,
+	0x19,
+	0x88,
+	0x19,
+	0x4b,
+	0x19,
+	0x26,
+	0x19,
+	0x01,
+	0x19,
+	0xdc,
+	0x18,
+	0xb7,
+	0x18,
+	0x7a,
+	0x18,
+	0x2d,
+	0x18,
+	0xd4,
+	0x17,
+	0x7f,
+	0x17,
+	0x32,
+	0x17,
+	0xcb,
+	0x16,
+	0x72,
+	0x16,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x8e,
+	0x73,
+	0x8e,
+	0x73,
+	0x4f,
+	0xb2,
+	0x4f,
+	0xe5,
+	0x1c,
+	0xe3,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x9b,
+	0x66,
+	0x9b,
+	0x66,
+	0x24,
+	0xdd,
+	0x24,
+	0x2d,
+	0xd4,
+	0x95,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xa7,
+	0x5a,
+	0xa7,
+	0x5a,
+	0xfe,
+	0x03,
+	0xfe,
+	0x5d,
+	0xa4,
+	0x81,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xb4,
+	0x4d,
+	0xb4,
+	0x4d,
+	0xdd,
+	0x24,
+	0xdd,
+	0x78,
+	0x89,
+	0x95,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xc1,
+	0x40,
+	0xc1,
+	0x40,
+	0xc1,
+	0x40,
+	0xc1,
+	0x7f,
+	0x81,
+	0xc1,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xce,
+	0x33,
+	0xce,
+	0x33,
+	0xaa,
+	0x57,
+	0xaa,
+	0x79,
+	0x88,
+	0xf7,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xdb,
+	0x26,
+	0xdb,
+	0x26,
+	0x98,
+	0x69,
+	0x98,
+	0x65,
+	0x9c,
+	0x2c,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xe7,
+	0x1a,
+	0xe7,
+	0x1a,
+	0x8b,
+	0x76,
+	0x8b,
+	0x49,
+	0xb8,
+	0x59,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xf4,
+	0x0d,
+	0xf4,
+	0x0d,
+	0x84,
+	0x7d,
+	0x84,
+	0x26,
+	0xdb,
+	0x76,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x7f,
+	0x81,
+	0x00,
+	0x00,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x0d,
+	0xf4,
+	0x0d,
+	0xf4,
+	0x84,
+	0x7d,
+	0x84,
+	0xdb,
+	0x26,
+	0x76,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x1a,
+	0xe7,
+	0x1a,
+	0xe7,
+	0x8b,
+	0x76,
+	0x8b,
+	0xb8,
+	0x49,
+	0x59,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x26,
+	0xdb,
+	0x26,
+	0xdb,
+	0x98,
+	0x69,
+	0x98,
+	0x9c,
+	0x65,
+	0x2c,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x33,
+	0xce,
+	0x33,
+	0xce,
+	0xaa,
+	0x57,
+	0xaa,
+	0x88,
+	0x79,
+	0xf7,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x40,
+	0xc1,
+	0x40,
+	0xc1,
+	0xc1,
+	0x40,
+	0xc1,
+	0x81,
+	0x7f,
+	0xc1,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x4d,
+	0xb4,
+	0x4d,
+	0xb4,
+	0xdd,
+	0x24,
+	0xdd,
+	0x89,
+	0x78,
+	0x95,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x5a,
+	0xa7,
+	0x5a,
+	0xa7,
+	0xfe,
+	0x03,
+	0xfe,
+	0xa4,
+	0x5d,
+	0x81,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x66,
+	0x9b,
+	0x66,
+	0x9b,
+	0x24,
+	0xdd,
+	0x24,
+	0xd4,
+	0x2d,
+	0x95,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x73,
+	0x8e,
+	0x73,
+	0x8e,
+	0x4f,
+	0xb2,
+	0x4f,
+	0x1c,
+	0xe5,
+	0xe3,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x7f,
+	0x81,
+	0x7f,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x81,
+	0x70,
+	0xbd,
+	0x07,
+	0x7f,
+	0x91,
+	0x44,
+	0x81,
+	0x70,
+	0x7f,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x8e,
+	0x65,
+	0xc4,
+	0x06,
+	0x4f,
+	0xbc,
+	0x2a,
+	0xe5,
+	0x18,
+	0xe3,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x9b,
+	0x5a,
+	0xcb,
+	0x06,
+	0x24,
+	0xe2,
+	0x13,
+	0x2d,
+	0xda,
+	0x95,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xa7,
+	0x4e,
+	0xd1,
+	0x05,
+	0xfe,
+	0x02,
+	0x00,
+	0x5d,
+	0xaf,
+	0x81,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xb4,
+	0x43,
+	0xd8,
+	0x04,
+	0xdd,
+	0x1f,
+	0xee,
+	0x78,
+	0x98,
+	0x95,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xc1,
+	0x38,
+	0xdf,
+	0x04,
+	0xc1,
+	0x38,
+	0xdf,
+	0x7f,
+	0x91,
+	0xc1,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xce,
+	0x2d,
+	0xe6,
+	0x03,
+	0xaa,
+	0x4c,
+	0xd3,
+	0x79,
+	0x97,
+	0xf7,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xdb,
+	0x22,
+	0xed,
+	0x02,
+	0x98,
+	0x5c,
+	0xc9,
+	0x65,
+	0xa8,
+	0x2c,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xe7,
+	0x16,
+	0xf3,
+	0x01,
+	0x8b,
+	0x67,
+	0xc2,
+	0x49,
+	0xc1,
+	0x59,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xf4,
+	0x0b,
+	0xfa,
+	0x01,
+	0x84,
+	0x6e,
+	0xbe,
+	0x26,
+	0xe0,
+	0x76,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x70,
+	0xbd,
+	0x00,
+	0x00,
+	0x7f,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x0d,
+	0xf6,
+	0x07,
+	0x00,
+	0x84,
+	0x6e,
+	0xbe,
+	0xdb,
+	0x21,
+	0x76,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x1a,
+	0xeb,
+	0x0e,
+	0x00,
+	0x8b,
+	0x67,
+	0xc2,
+	0xb8,
+	0x40,
+	0x59,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x26,
+	0xdf,
+	0x14,
+	0xff,
+	0x98,
+	0x5c,
+	0xc9,
+	0x9c,
+	0x59,
+	0x2c,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x33,
+	0xd4,
+	0x1b,
+	0xfe,
+	0xaa,
+	0x4c,
+	0xd3,
+	0x88,
+	0x6a,
+	0xf7,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x40,
+	0xc9,
+	0x22,
+	0xfd,
+	0xc1,
+	0x38,
+	0xdf,
+	0x81,
+	0x70,
+	0xc1,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x4d,
+	0xbe,
+	0x29,
+	0xfd,
+	0xdd,
+	0x1f,
+	0xee,
+	0x89,
+	0x69,
+	0x95,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x5a,
+	0xb3,
+	0x30,
+	0xfc,
+	0xfe,
+	0x02,
+	0x00,
+	0xa4,
+	0x52,
+	0x81,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x66,
+	0xa7,
+	0x36,
+	0xfb,
+	0x24,
+	0xe2,
+	0x13,
+	0xd4,
+	0x27,
+	0x95,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x73,
+	0x9c,
+	0x3d,
+	0xfb,
+	0x4f,
+	0xbc,
+	0x2a,
+	0x1c,
+	0xe9,
+	0xe3,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x7f,
+	0x91,
+	0x44,
+	0xfa,
+	0x7f,
+	0x91,
+	0x44,
+	0x7f,
+	0x91,
+	0x7f,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x81,
+	0x60,
+	0xf1,
+	0xb9,
+	0x7f,
+	0xa1,
+	0x10,
+	0x81,
+	0x60,
+	0x7f,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x8e,
+	0x56,
+	0xf3,
+	0xc0,
+	0x4f,
+	0xc5,
+	0x0a,
+	0xe5,
+	0x15,
+	0xe3,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x9b,
+	0x4d,
+	0xf4,
+	0xc7,
+	0x24,
+	0xe6,
+	0x04,
+	0x2d,
+	0xdf,
+	0x95,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xa7,
+	0x43,
+	0xf6,
+	0xcf,
+	0xfe,
+	0x02,
+	0x00,
+	0x5d,
+	0xbb,
+	0x81,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xb4,
+	0x3a,
+	0xf7,
+	0xd6,
+	0xdd,
+	0x1b,
+	0xfd,
+	0x78,
+	0xa7,
+	0x95,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xc1,
+	0x30,
+	0xf9,
+	0xdd,
+	0xc1,
+	0x30,
+	0xf9,
+	0x7f,
+	0xa1,
+	0xc1,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xce,
+	0x26,
+	0xfb,
+	0xe4,
+	0xaa,
+	0x41,
+	0xf6,
+	0x79,
+	0xa6,
+	0xf7,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xdb,
+	0x1d,
+	0xfc,
+	0xeb,
+	0x98,
+	0x4f,
+	0xf4,
+	0x65,
+	0xb5,
+	0x2c,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xe7,
+	0x13,
+	0xfe,
+	0xf3,
+	0x8b,
+	0x58,
+	0xf2,
+	0x49,
+	0xca,
+	0x59,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xf4,
+	0x0a,
+	0xff,
+	0xfa,
+	0x84,
+	0x5e,
+	0xf1,
+	0x26,
+	0xe5,
+	0x76,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x60,
+	0xf1,
+	0x00,
+	0x00,
+	0x7f,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x0d,
+	0xf7,
+	0x02,
+	0x07,
+	0x84,
+	0x5e,
+	0xf1,
+	0xdb,
+	0x1c,
+	0x76,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x1a,
+	0xee,
+	0x03,
+	0x0e,
+	0x8b,
+	0x58,
+	0xf2,
+	0xb8,
+	0x37,
+	0x59,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x26,
+	0xe4,
+	0x05,
+	0x16,
+	0x98,
+	0x4f,
+	0xf4,
+	0x9c,
+	0x4c,
+	0x2c,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x33,
+	0xdb,
+	0x06,
+	0x1d,
+	0xaa,
+	0x41,
+	0xf6,
+	0x88,
+	0x5b,
+	0xf7,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x40,
+	0xd1,
+	0x08,
+	0x24,
+	0xc1,
+	0x30,
+	0xf9,
+	0x81,
+	0x60,
+	0xc1,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x4d,
+	0xc7,
+	0x0a,
+	0x2b,
+	0xdd,
+	0x1b,
+	0xfd,
+	0x89,
+	0x5a,
+	0x95,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x5a,
+	0xbe,
+	0x0b,
+	0x32,
+	0xfe,
+	0x02,
+	0x00,
+	0xa4,
+	0x46,
+	0x81,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x66,
+	0xb4,
+	0x0d,
+	0x3a,
+	0x24,
+	0xe6,
+	0x04,
+	0xd4,
+	0x22,
+	0x95,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x73,
+	0xab,
+	0x0e,
+	0x41,
+	0x4f,
+	0xc5,
+	0x0a,
+	0x1c,
+	0xec,
+	0xe3,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x7f,
+	0xa1,
+	0x10,
+	0x48,
+	0x7f,
+	0xa1,
+	0x10,
+	0x7f,
+	0xa1,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x81,
+	0x50,
+	0x1c,
+	0x8e,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x81,
+	0x50,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x8e,
+	0x48,
+	0x19,
+	0x9a,
+	0x4f,
+	0xcf,
+	0xf0,
+	0xe5,
+	0x11,
+	0xe3,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x9b,
+	0x40,
+	0x16,
+	0xa5,
+	0x24,
+	0xeb,
+	0xf9,
+	0x2d,
+	0xe5,
+	0x95,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xa7,
+	0x38,
+	0x14,
+	0xb0,
+	0xfe,
+	0x02,
+	0x01,
+	0x5d,
+	0xc7,
+	0x81,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xb4,
+	0x30,
+	0x11,
+	0xbc,
+	0xdd,
+	0x16,
+	0x08,
+	0x78,
+	0xb6,
+	0x95,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xc1,
+	0x28,
+	0x0e,
+	0xc7,
+	0xc1,
+	0x28,
+	0x0e,
+	0x7f,
+	0xb1,
+	0xc1,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xce,
+	0x20,
+	0x0b,
+	0xd3,
+	0xaa,
+	0x36,
+	0x13,
+	0x79,
+	0xb5,
+	0xf7,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xdb,
+	0x18,
+	0x08,
+	0xdf,
+	0x98,
+	0x42,
+	0x17,
+	0x65,
+	0xc2,
+	0x2c,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xe7,
+	0x10,
+	0x06,
+	0xea,
+	0x8b,
+	0x4a,
+	0x1a,
+	0x49,
+	0xd4,
+	0x59,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xf4,
+	0x08,
+	0x03,
+	0xf6,
+	0x84,
+	0x4e,
+	0x1b,
+	0x26,
+	0xe9,
+	0x76,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x50,
+	0x1c,
+	0x00,
+	0x00,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x0d,
+	0xf9,
+	0xfe,
+	0x0c,
+	0x84,
+	0x4e,
+	0x1b,
+	0xdb,
+	0x18,
+	0x76,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x1a,
+	0xf1,
+	0xfb,
+	0x17,
+	0x8b,
+	0x4a,
+	0x1a,
+	0xb8,
+	0x2d,
+	0x59,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x26,
+	0xe9,
+	0xf9,
+	0x23,
+	0x98,
+	0x42,
+	0x17,
+	0x9c,
+	0x3f,
+	0x2c,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x33,
+	0xe1,
+	0xf6,
+	0x2e,
+	0xaa,
+	0x36,
+	0x13,
+	0x88,
+	0x4c,
+	0xf7,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x40,
+	0xd9,
+	0xf3,
+	0x3a,
+	0xc1,
+	0x28,
+	0x0e,
+	0x81,
+	0x50,
+	0xc1,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x4d,
+	0xd1,
+	0xf0,
+	0x45,
+	0xdd,
+	0x16,
+	0x08,
+	0x89,
+	0x4b,
+	0x95,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x5a,
+	0xc9,
+	0xed,
+	0x50,
+	0xfe,
+	0x02,
+	0x01,
+	0xa4,
+	0x3a,
+	0x81,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x66,
+	0xc1,
+	0xeb,
+	0x5c,
+	0x24,
+	0xeb,
+	0xf9,
+	0xd4,
+	0x1c,
+	0x95,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x73,
+	0xb9,
+	0xe8,
+	0x67,
+	0x4f,
+	0xcf,
+	0xf0,
+	0x1c,
+	0xf0,
+	0xe3,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x73,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x7f,
+	0xb1,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x81,
+	0x40,
+	0x40,
+	0x81,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x81,
+	0x40,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x8e,
+	0x3a,
+	0x3a,
+	0x8e,
+	0x4f,
+	0xd9,
+	0xd9,
+	0xe5,
+	0x0e,
+	0xe3,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x9b,
+	0x33,
+	0x33,
+	0x9b,
+	0x24,
+	0xef,
+	0xef,
+	0x2d,
+	0xea,
+	0x95,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xa7,
+	0x2d,
+	0x2d,
+	0xa7,
+	0xfe,
+	0x01,
+	0x01,
+	0x5d,
+	0xd2,
+	0x81,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xb4,
+	0x26,
+	0x26,
+	0xb4,
+	0xdd,
+	0x12,
+	0x12,
+	0x78,
+	0xc5,
+	0x95,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x20,
+	0x20,
+	0xc1,
+	0xc1,
+	0x20,
+	0x20,
+	0x7f,
+	0xc1,
+	0xc1,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xce,
+	0x1a,
+	0x1a,
+	0xce,
+	0xaa,
+	0x2c,
+	0x2c,
+	0x79,
+	0xc5,
+	0xf7,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xdb,
+	0x13,
+	0x13,
+	0xdb,
+	0x98,
+	0x34,
+	0x34,
+	0x65,
+	0xce,
+	0x2c,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xe7,
+	0x0d,
+	0x0d,
+	0xe7,
+	0x8b,
+	0x3b,
+	0x3b,
+	0x49,
+	0xdd,
+	0x59,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xf4,
+	0x06,
+	0x06,
+	0xf4,
+	0x84,
+	0x3f,
+	0x3f,
+	0x26,
+	0xee,
+	0x76,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x40,
+	0x40,
+	0x00,
+	0x00,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x0d,
+	0xfb,
+	0xfb,
+	0x0d,
+	0x84,
+	0x3f,
+	0x3f,
+	0xdb,
+	0x13,
+	0x76,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x1a,
+	0xf4,
+	0xf4,
+	0x1a,
+	0x8b,
+	0x3b,
+	0x3b,
+	0xb8,
+	0x24,
+	0x59,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x26,
+	0xee,
+	0xee,
+	0x26,
+	0x98,
+	0x34,
+	0x34,
+	0x9c,
+	0x33,
+	0x2c,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x33,
+	0xe7,
+	0xe7,
+	0x33,
+	0xaa,
+	0x2c,
+	0x2c,
+	0x88,
+	0x3c,
+	0xf7,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x40,
+	0xe1,
+	0xe1,
+	0x40,
+	0xc1,
+	0x20,
+	0x20,
+	0x81,
+	0x40,
+	0xc1,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x4d,
+	0xdb,
+	0xdb,
+	0x4d,
+	0xdd,
+	0x12,
+	0x12,
+	0x89,
+	0x3c,
+	0x95,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x5a,
+	0xd4,
+	0xd4,
+	0x5a,
+	0xfe,
+	0x01,
+	0x01,
+	0xa4,
+	0x2f,
+	0x81,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x66,
+	0xce,
+	0xce,
+	0x66,
+	0x24,
+	0xef,
+	0xef,
+	0xd4,
+	0x17,
+	0x95,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x73,
+	0xc7,
+	0xc7,
+	0x73,
+	0x4f,
+	0xd9,
+	0xd9,
+	0x1c,
+	0xf3,
+	0xe3,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x7f,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x81,
+	0x30,
+	0x5c,
+	0x8c,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x81,
+	0x30,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x8e,
+	0x2b,
+	0x53,
+	0x98,
+	0x4f,
+	0xe3,
+	0xc8,
+	0xe5,
+	0x0a,
+	0xe3,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x9b,
+	0x26,
+	0x4a,
+	0xa3,
+	0x24,
+	0xf4,
+	0xe7,
+	0x2d,
+	0xf0,
+	0x95,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xa7,
+	0x22,
+	0x40,
+	0xaf,
+	0xfe,
+	0x01,
+	0x02,
+	0x5d,
+	0xde,
+	0x81,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xb4,
+	0x1d,
+	0x37,
+	0xbb,
+	0xdd,
+	0x0d,
+	0x1a,
+	0x78,
+	0xd4,
+	0x95,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xc1,
+	0x18,
+	0x2e,
+	0xc6,
+	0xc1,
+	0x18,
+	0x2e,
+	0x7f,
+	0xd1,
+	0xc1,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xce,
+	0x13,
+	0x25,
+	0xd2,
+	0xaa,
+	0x21,
+	0x3f,
+	0x79,
+	0xd4,
+	0xf7,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xdb,
+	0x0e,
+	0x1c,
+	0xde,
+	0x98,
+	0x27,
+	0x4b,
+	0x65,
+	0xdb,
+	0x2c,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xe7,
+	0x0a,
+	0x12,
+	0xea,
+	0x8b,
+	0x2c,
+	0x55,
+	0x49,
+	0xe6,
+	0x59,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xf4,
+	0x05,
+	0x09,
+	0xf5,
+	0x84,
+	0x2f,
+	0x5a,
+	0x26,
+	0xf3,
+	0x76,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x30,
+	0x5c,
+	0x00,
+	0x00,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x0d,
+	0xfc,
+	0xf8,
+	0x0c,
+	0x84,
+	0x2f,
+	0x5a,
+	0xdb,
+	0x0e,
+	0x76,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x1a,
+	0xf7,
+	0xef,
+	0x17,
+	0x8b,
+	0x2c,
+	0x55,
+	0xb8,
+	0x1b,
+	0x59,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x26,
+	0xf3,
+	0xe5,
+	0x23,
+	0x98,
+	0x27,
+	0x4b,
+	0x9c,
+	0x26,
+	0x2c,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x33,
+	0xee,
+	0xdc,
+	0x2f,
+	0xaa,
+	0x21,
+	0x3f,
+	0x88,
+	0x2d,
+	0xf7,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x40,
+	0xe9,
+	0xd3,
+	0x3b,
+	0xc1,
+	0x18,
+	0x2e,
+	0x81,
+	0x30,
+	0xc1,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x4d,
+	0xe4,
+	0xca,
+	0x46,
+	0xdd,
+	0x0d,
+	0x1a,
+	0x89,
+	0x2d,
+	0x95,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x5a,
+	0xdf,
+	0xc1,
+	0x52,
+	0xfe,
+	0x01,
+	0x02,
+	0xa4,
+	0x23,
+	0x81,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x66,
+	0xdb,
+	0xb7,
+	0x5e,
+	0x24,
+	0xf4,
+	0xe7,
+	0xd4,
+	0x11,
+	0x95,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x73,
+	0xd6,
+	0xae,
+	0x69,
+	0x4f,
+	0xe3,
+	0xc8,
+	0x1c,
+	0xf7,
+	0xe3,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x75,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x7f,
+	0xd1,
+	0x7f,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x81,
+	0x20,
+	0x70,
+	0xa9,
+	0x7f,
+	0xe1,
+	0x91,
+	0x81,
+	0x20,
+	0x7f,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x8e,
+	0x1d,
+	0x65,
+	0xb2,
+	0x4f,
+	0xed,
+	0xbc,
+	0xe5,
+	0x07,
+	0xe3,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x9b,
+	0x1a,
+	0x5a,
+	0xbb,
+	0x24,
+	0xf8,
+	0xe2,
+	0x2d,
+	0xf6,
+	0x95,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xa7,
+	0x16,
+	0x4e,
+	0xc3,
+	0xfe,
+	0x01,
+	0x02,
+	0x5d,
+	0xea,
+	0x81,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xb4,
+	0x13,
+	0x43,
+	0xcc,
+	0xdd,
+	0x09,
+	0x1f,
+	0x78,
+	0xe3,
+	0x95,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xc1,
+	0x10,
+	0x38,
+	0xd5,
+	0xc1,
+	0x10,
+	0x38,
+	0x7f,
+	0xe1,
+	0xc1,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xce,
+	0x0d,
+	0x2d,
+	0xde,
+	0xaa,
+	0x16,
+	0x4c,
+	0x79,
+	0xe3,
+	0xf7,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xdb,
+	0x0a,
+	0x22,
+	0xe7,
+	0x98,
+	0x1a,
+	0x5c,
+	0x65,
+	0xe8,
+	0x2c,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xe7,
+	0x06,
+	0x16,
+	0xef,
+	0x8b,
+	0x1d,
+	0x67,
+	0x49,
+	0xef,
+	0x59,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xf4,
+	0x03,
+	0x0b,
+	0xf8,
+	0x84,
+	0x1f,
+	0x6e,
+	0x26,
+	0xf8,
+	0x76,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x20,
+	0x70,
+	0x00,
+	0x00,
+	0x7f,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x0d,
+	0xfe,
+	0xf6,
+	0x09,
+	0x84,
+	0x1f,
+	0x6e,
+	0xdb,
+	0x09,
+	0x76,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x1a,
+	0xfb,
+	0xeb,
+	0x12,
+	0x8b,
+	0x1d,
+	0x67,
+	0xb8,
+	0x12,
+	0x59,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x26,
+	0xf7,
+	0xdf,
+	0x1a,
+	0x98,
+	0x1a,
+	0x5c,
+	0x9c,
+	0x19,
+	0x2c,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x33,
+	0xf4,
+	0xd4,
+	0x23,
+	0xaa,
+	0x16,
+	0x4c,
+	0x88,
+	0x1e,
+	0xf7,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x40,
+	0xf1,
+	0xc9,
+	0x2c,
+	0xc1,
+	0x10,
+	0x38,
+	0x81,
+	0x20,
+	0xc1,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x4d,
+	0xee,
+	0xbe,
+	0x35,
+	0xdd,
+	0x09,
+	0x1f,
+	0x89,
+	0x1e,
+	0x95,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x5a,
+	0xeb,
+	0xb3,
+	0x3e,
+	0xfe,
+	0x01,
+	0x02,
+	0xa4,
+	0x17,
+	0x81,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x66,
+	0xe7,
+	0xa7,
+	0x46,
+	0x24,
+	0xf8,
+	0xe2,
+	0xd4,
+	0x0b,
+	0x95,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x73,
+	0xe4,
+	0x9c,
+	0x4f,
+	0x4f,
+	0xed,
+	0xbc,
+	0x1c,
+	0xfa,
+	0xe3,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x7f,
+	0xe1,
+	0x91,
+	0x58,
+	0x7f,
+	0xe1,
+	0x91,
+	0x7f,
+	0xe1,
+	0x7f,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x81,
+	0x10,
+	0x7c,
+	0xd2,
+	0x7f,
+	0xf1,
+	0x85,
+	0x81,
+	0x10,
+	0x7f,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x8e,
+	0x0e,
+	0x70,
+	0xd7,
+	0x4f,
+	0xf7,
+	0xb4,
+	0xe5,
+	0x03,
+	0xe3,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x9b,
+	0x0d,
+	0x63,
+	0xdb,
+	0x24,
+	0xfd,
+	0xde,
+	0x2d,
+	0xfb,
+	0x95,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xa7,
+	0x0b,
+	0x57,
+	0xe0,
+	0xfe,
+	0x00,
+	0x02,
+	0x5d,
+	0xf5,
+	0x81,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xb4,
+	0x0a,
+	0x4a,
+	0xe5,
+	0xdd,
+	0x04,
+	0x23,
+	0x78,
+	0xf2,
+	0x95,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xc1,
+	0x08,
+	0x3e,
+	0xe9,
+	0xc1,
+	0x08,
+	0x3e,
+	0x7f,
+	0xf1,
+	0xc1,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xce,
+	0x06,
+	0x32,
+	0xee,
+	0xaa,
+	0x0b,
+	0x54,
+	0x79,
+	0xf2,
+	0xf7,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xdb,
+	0x05,
+	0x25,
+	0xf3,
+	0x98,
+	0x0d,
+	0x66,
+	0x65,
+	0xf4,
+	0x2c,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xe7,
+	0x03,
+	0x19,
+	0xf8,
+	0x8b,
+	0x0f,
+	0x72,
+	0x49,
+	0xf8,
+	0x59,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xf4,
+	0x02,
+	0x0c,
+	0xfc,
+	0x84,
+	0x10,
+	0x7a,
+	0x26,
+	0xfc,
+	0x76,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x10,
+	0x7c,
+	0x00,
+	0x00,
+	0x7f,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x0d,
+	0xff,
+	0xf5,
+	0x05,
+	0x84,
+	0x10,
+	0x7a,
+	0xdb,
+	0x05,
+	0x76,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x1a,
+	0xfe,
+	0xe8,
+	0x09,
+	0x8b,
+	0x0f,
+	0x72,
+	0xb8,
+	0x09,
+	0x59,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x26,
+	0xfc,
+	0xdc,
+	0x0e,
+	0x98,
+	0x0d,
+	0x66,
+	0x9c,
+	0x0d,
+	0x2c,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x33,
+	0xfb,
+	0xcf,
+	0x13,
+	0xaa,
+	0x0b,
+	0x54,
+	0x88,
+	0x0f,
+	0xf7,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x40,
+	0xf9,
+	0xc3,
+	0x18,
+	0xc1,
+	0x08,
+	0x3e,
+	0x81,
+	0x10,
+	0xc1,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x4d,
+	0xf7,
+	0xb7,
+	0x1c,
+	0xdd,
+	0x04,
+	0x23,
+	0x89,
+	0x0f,
+	0x95,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x5a,
+	0xf6,
+	0xaa,
+	0x21,
+	0xfe,
+	0x00,
+	0x02,
+	0xa4,
+	0x0c,
+	0x81,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x66,
+	0xf4,
+	0x9e,
+	0x26,
+	0x24,
+	0xfd,
+	0xde,
+	0xd4,
+	0x06,
+	0x95,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x73,
+	0xf3,
+	0x91,
+	0x2a,
+	0x4f,
+	0xf7,
+	0xb4,
+	0x1c,
+	0xfe,
+	0xe3,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x7f,
+	0xf1,
+	0x85,
+	0x2f,
+	0x7f,
+	0xf1,
+	0x85,
+	0x7f,
+	0xf1,
+	0x7f,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x81,
+	0x00,
+	0x7f,
+	0x00,
+	0x7f,
+	0x00,
+	0x81,
+	0x81,
+	0x00,
+	0x7f,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x8e,
+	0x00,
+	0x73,
+	0x00,
+	0x4f,
+	0x00,
+	0xb2,
+	0xe5,
+	0x00,
+	0xe3,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x9b,
+	0x00,
+	0x66,
+	0x00,
+	0x24,
+	0x00,
+	0xdd,
+	0x2d,
+	0x00,
+	0x95,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xa7,
+	0x00,
+	0x5a,
+	0x00,
+	0xfe,
+	0x00,
+	0x03,
+	0x5d,
+	0x00,
+	0x81,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xb4,
+	0x00,
+	0x4d,
+	0x00,
+	0xdd,
+	0x00,
+	0x24,
+	0x78,
+	0x00,
+	0x95,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xc1,
+	0x00,
+	0x40,
+	0x00,
+	0xc1,
+	0x00,
+	0x40,
+	0x7f,
+	0x00,
+	0xc1,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xce,
+	0x00,
+	0x33,
+	0x00,
+	0xaa,
+	0x00,
+	0x57,
+	0x79,
+	0x00,
+	0xf7,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xdb,
+	0x00,
+	0x26,
+	0x00,
+	0x98,
+	0x00,
+	0x69,
+	0x65,
+	0x00,
+	0x2c,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xe7,
+	0x00,
+	0x1a,
+	0x00,
+	0x8b,
+	0x00,
+	0x76,
+	0x49,
+	0x00,
+	0x59,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xf4,
+	0x00,
+	0x0d,
+	0x00,
+	0x84,
+	0x00,
+	0x7d,
+	0x26,
+	0x00,
+	0x76,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x00,
+	0x00,
+	0x7f,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x0d,
+	0x00,
+	0xf4,
+	0x00,
+	0x84,
+	0x00,
+	0x7d,
+	0xdb,
+	0x00,
+	0x76,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x1a,
+	0x00,
+	0xe7,
+	0x00,
+	0x8b,
+	0x00,
+	0x76,
+	0xb8,
+	0x00,
+	0x59,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x26,
+	0x00,
+	0xdb,
+	0x00,
+	0x98,
+	0x00,
+	0x69,
+	0x9c,
+	0x00,
+	0x2c,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x33,
+	0x00,
+	0xce,
+	0x00,
+	0xaa,
+	0x00,
+	0x57,
+	0x88,
+	0x00,
+	0xf7,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x40,
+	0x00,
+	0xc1,
+	0x00,
+	0xc1,
+	0x00,
+	0x40,
+	0x81,
+	0x00,
+	0xc1,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x4d,
+	0x00,
+	0xb4,
+	0x00,
+	0xdd,
+	0x00,
+	0x24,
+	0x89,
+	0x00,
+	0x95,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x5a,
+	0x00,
+	0xa7,
+	0x00,
+	0xfe,
+	0x00,
+	0x03,
+	0xa4,
+	0x00,
+	0x81,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x66,
+	0x00,
+	0x9b,
+	0x00,
+	0x24,
+	0x00,
+	0xdd,
+	0xd4,
+	0x00,
+	0x95,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x73,
+	0x00,
+	0x8e,
+	0x00,
+	0x4f,
+	0x00,
+	0xb2,
+	0x1c,
+	0x00,
+	0xe3,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x00,
+	0x81,
+	0x7f,
+	0x00,
+	0x7f,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x81,
+	0xf1,
+	0x7c,
+	0x2f,
+	0x7f,
+	0x10,
+	0x85,
+	0x81,
+	0xf1,
+	0x7f,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x8e,
+	0xf3,
+	0x70,
+	0x2a,
+	0x4f,
+	0x0a,
+	0xb4,
+	0xe5,
+	0xfe,
+	0xe3,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x9b,
+	0xf4,
+	0x63,
+	0x26,
+	0x24,
+	0x04,
+	0xde,
+	0x2d,
+	0x06,
+	0x95,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xa7,
+	0xf6,
+	0x57,
+	0x21,
+	0xfe,
+	0x00,
+	0x02,
+	0x5d,
+	0x0c,
+	0x81,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xb4,
+	0xf7,
+	0x4a,
+	0x1c,
+	0xdd,
+	0xfd,
+	0x23,
+	0x78,
+	0x0f,
+	0x95,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xc1,
+	0xf9,
+	0x3e,
+	0x17,
+	0xc1,
+	0xf9,
+	0x3e,
+	0x7f,
+	0x10,
+	0xc1,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xce,
+	0xfb,
+	0x32,
+	0x13,
+	0xaa,
+	0xf6,
+	0x54,
+	0x79,
+	0x0f,
+	0xf7,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xdb,
+	0xfc,
+	0x25,
+	0x0e,
+	0x98,
+	0xf4,
+	0x66,
+	0x65,
+	0x0d,
+	0x2c,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xe7,
+	0xfe,
+	0x19,
+	0x09,
+	0x8b,
+	0xf2,
+	0x72,
+	0x49,
+	0x09,
+	0x59,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xf4,
+	0xff,
+	0x0c,
+	0x05,
+	0x84,
+	0xf1,
+	0x7a,
+	0x26,
+	0x05,
+	0x76,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xf1,
+	0x7c,
+	0x00,
+	0x00,
+	0x7f,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x0d,
+	0x02,
+	0xf5,
+	0xfc,
+	0x84,
+	0xf1,
+	0x7a,
+	0xdb,
+	0xfc,
+	0x76,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x1a,
+	0x03,
+	0xe8,
+	0xf8,
+	0x8b,
+	0xf2,
+	0x72,
+	0xb8,
+	0xf8,
+	0x59,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x26,
+	0x05,
+	0xdc,
+	0xf3,
+	0x98,
+	0xf4,
+	0x66,
+	0x9c,
+	0xf4,
+	0x2c,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x33,
+	0x06,
+	0xcf,
+	0xee,
+	0xaa,
+	0xf6,
+	0x54,
+	0x88,
+	0xf2,
+	0xf7,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x40,
+	0x08,
+	0xc3,
+	0xea,
+	0xc1,
+	0xf9,
+	0x3e,
+	0x81,
+	0xf1,
+	0xc1,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x4d,
+	0x0a,
+	0xb7,
+	0xe5,
+	0xdd,
+	0xfd,
+	0x23,
+	0x89,
+	0xf2,
+	0x95,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x5a,
+	0x0b,
+	0xaa,
+	0xe0,
+	0xfe,
+	0x00,
+	0x02,
+	0xa4,
+	0xf5,
+	0x81,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x66,
+	0x0d,
+	0x9e,
+	0xdb,
+	0x24,
+	0x04,
+	0xde,
+	0xd4,
+	0xfb,
+	0x95,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x73,
+	0x0e,
+	0x91,
+	0xd7,
+	0x4f,
+	0x0a,
+	0xb4,
+	0x1c,
+	0x03,
+	0xe3,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x7f,
+	0x10,
+	0x85,
+	0xd2,
+	0x7f,
+	0x10,
+	0x85,
+	0x7f,
+	0x10,
+	0x7f,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x81,
+	0xe1,
+	0x70,
+	0x58,
+	0x7f,
+	0x20,
+	0x91,
+	0x81,
+	0xe1,
+	0x7f,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x8e,
+	0xe4,
+	0x65,
+	0x4f,
+	0x4f,
+	0x14,
+	0xbc,
+	0xe5,
+	0xfa,
+	0xe3,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x9b,
+	0xe7,
+	0x5a,
+	0x46,
+	0x24,
+	0x09,
+	0xe2,
+	0x2d,
+	0x0b,
+	0x95,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xa7,
+	0xeb,
+	0x4e,
+	0x3e,
+	0xfe,
+	0x00,
+	0x02,
+	0x5d,
+	0x17,
+	0x81,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xb4,
+	0xee,
+	0x43,
+	0x35,
+	0xdd,
+	0xf8,
+	0x1f,
+	0x78,
+	0x1e,
+	0x95,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xc1,
+	0xf1,
+	0x38,
+	0x2c,
+	0xc1,
+	0xf1,
+	0x38,
+	0x7f,
+	0x20,
+	0xc1,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xce,
+	0xf4,
+	0x2d,
+	0x23,
+	0xaa,
+	0xeb,
+	0x4c,
+	0x79,
+	0x1e,
+	0xf7,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xdb,
+	0xf7,
+	0x22,
+	0x1a,
+	0x98,
+	0xe7,
+	0x5c,
+	0x65,
+	0x19,
+	0x2c,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xe7,
+	0xfb,
+	0x16,
+	0x12,
+	0x8b,
+	0xe4,
+	0x67,
+	0x49,
+	0x12,
+	0x59,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xf4,
+	0xfe,
+	0x0b,
+	0x09,
+	0x84,
+	0xe2,
+	0x6e,
+	0x26,
+	0x09,
+	0x76,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xe1,
+	0x70,
+	0x00,
+	0x00,
+	0x7f,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x0d,
+	0x03,
+	0xf6,
+	0xf8,
+	0x84,
+	0xe2,
+	0x6e,
+	0xdb,
+	0xf8,
+	0x76,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x1a,
+	0x06,
+	0xeb,
+	0xef,
+	0x8b,
+	0xe4,
+	0x67,
+	0xb8,
+	0xef,
+	0x59,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x26,
+	0x0a,
+	0xdf,
+	0xe7,
+	0x98,
+	0xe7,
+	0x5c,
+	0x9c,
+	0xe8,
+	0x2c,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x33,
+	0x0d,
+	0xd4,
+	0xde,
+	0xaa,
+	0xeb,
+	0x4c,
+	0x88,
+	0xe3,
+	0xf7,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x40,
+	0x10,
+	0xc9,
+	0xd5,
+	0xc1,
+	0xf1,
+	0x38,
+	0x81,
+	0xe1,
+	0xc1,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x4d,
+	0x13,
+	0xbe,
+	0xcc,
+	0xdd,
+	0xf8,
+	0x1f,
+	0x89,
+	0xe3,
+	0x95,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x5a,
+	0x16,
+	0xb3,
+	0xc3,
+	0xfe,
+	0x00,
+	0x02,
+	0xa4,
+	0xea,
+	0x81,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x66,
+	0x1a,
+	0xa7,
+	0xbb,
+	0x24,
+	0x09,
+	0xe2,
+	0xd4,
+	0xf6,
+	0x95,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x73,
+	0x1d,
+	0x9c,
+	0xb2,
+	0x4f,
+	0x14,
+	0xbc,
+	0x1c,
+	0x07,
+	0xe3,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x7f,
+	0x20,
+	0x91,
+	0xa9,
+	0x7f,
+	0x20,
+	0x91,
+	0x7f,
+	0x20,
+	0x7f,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x81,
+	0xd1,
+	0x5c,
+	0x75,
+	0x7f,
+	0x30,
+	0xa5,
+	0x81,
+	0xd1,
+	0x7f,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x8e,
+	0xd6,
+	0x53,
+	0x69,
+	0x4f,
+	0x1e,
+	0xc8,
+	0xe5,
+	0xf7,
+	0xe3,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x9b,
+	0xdb,
+	0x4a,
+	0x5e,
+	0x24,
+	0x0d,
+	0xe7,
+	0x2d,
+	0x11,
+	0x95,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xa7,
+	0xdf,
+	0x40,
+	0x52,
+	0xfe,
+	0x00,
+	0x02,
+	0x5d,
+	0x23,
+	0x81,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xb4,
+	0xe4,
+	0x37,
+	0x46,
+	0xdd,
+	0xf4,
+	0x1a,
+	0x78,
+	0x2d,
+	0x95,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xc1,
+	0xe9,
+	0x2e,
+	0x3b,
+	0xc1,
+	0xe9,
+	0x2e,
+	0x7f,
+	0x30,
+	0xc1,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xce,
+	0xee,
+	0x25,
+	0x2f,
+	0xaa,
+	0xe0,
+	0x3f,
+	0x79,
+	0x2d,
+	0xf7,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xdb,
+	0xf3,
+	0x1c,
+	0x23,
+	0x98,
+	0xda,
+	0x4b,
+	0x65,
+	0x26,
+	0x2c,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xe7,
+	0xf7,
+	0x12,
+	0x17,
+	0x8b,
+	0xd5,
+	0x55,
+	0x49,
+	0x1b,
+	0x59,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xf4,
+	0xfc,
+	0x09,
+	0x0c,
+	0x84,
+	0xd2,
+	0x5a,
+	0x26,
+	0x0e,
+	0x76,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xd1,
+	0x5c,
+	0x00,
+	0x00,
+	0x7f,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x0d,
+	0x05,
+	0xf8,
+	0xf5,
+	0x84,
+	0xd2,
+	0x5a,
+	0xdb,
+	0xf3,
+	0x76,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x1a,
+	0x0a,
+	0xef,
+	0xea,
+	0x8b,
+	0xd5,
+	0x55,
+	0xb8,
+	0xe6,
+	0x59,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x26,
+	0x0e,
+	0xe5,
+	0xde,
+	0x98,
+	0xda,
+	0x4b,
+	0x9c,
+	0xdb,
+	0x2c,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x33,
+	0x13,
+	0xdc,
+	0xd2,
+	0xaa,
+	0xe0,
+	0x3f,
+	0x88,
+	0xd4,
+	0xf7,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x40,
+	0x18,
+	0xd3,
+	0xc6,
+	0xc1,
+	0xe9,
+	0x2e,
+	0x81,
+	0xd1,
+	0xc1,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x4d,
+	0x1d,
+	0xca,
+	0xbb,
+	0xdd,
+	0xf4,
+	0x1a,
+	0x89,
+	0xd4,
+	0x95,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x5a,
+	0x22,
+	0xc1,
+	0xaf,
+	0xfe,
+	0x00,
+	0x02,
+	0xa4,
+	0xde,
+	0x81,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x66,
+	0x26,
+	0xb7,
+	0xa3,
+	0x24,
+	0x0d,
+	0xe7,
+	0xd4,
+	0xf0,
+	0x95,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x73,
+	0x2b,
+	0xae,
+	0x98,
+	0x4f,
+	0x1e,
+	0xc8,
+	0x1c,
+	0x0a,
+	0xe3,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x7f,
+	0x30,
+	0xa5,
+	0x8c,
+	0x7f,
+	0x30,
+	0xa5,
+	0x7f,
+	0x30,
+	0x7f,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x81,
+	0xc1,
+	0x40,
+	0x7f,
+	0x7f,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x7f,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x8e,
+	0xc7,
+	0x3a,
+	0x73,
+	0x4f,
+	0x28,
+	0xd9,
+	0xe5,
+	0xf3,
+	0xe3,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x9b,
+	0xce,
+	0x33,
+	0x66,
+	0x24,
+	0x12,
+	0xef,
+	0x2d,
+	0x17,
+	0x95,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xa7,
+	0xd4,
+	0x2d,
+	0x5a,
+	0xfe,
+	0x00,
+	0x01,
+	0x5d,
+	0x2f,
+	0x81,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xb4,
+	0xdb,
+	0x26,
+	0x4d,
+	0xdd,
+	0xef,
+	0x12,
+	0x78,
+	0x3c,
+	0x95,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xc1,
+	0xe1,
+	0x20,
+	0x40,
+	0xc1,
+	0xe1,
+	0x20,
+	0x7f,
+	0x40,
+	0xc1,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xce,
+	0xe7,
+	0x1a,
+	0x33,
+	0xaa,
+	0xd5,
+	0x2c,
+	0x79,
+	0x3c,
+	0xf7,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xdb,
+	0xee,
+	0x13,
+	0x26,
+	0x98,
+	0xcd,
+	0x34,
+	0x65,
+	0x33,
+	0x2c,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xe7,
+	0xf4,
+	0x0d,
+	0x1a,
+	0x8b,
+	0xc6,
+	0x3b,
+	0x49,
+	0x24,
+	0x59,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xf4,
+	0xfb,
+	0x06,
+	0x0d,
+	0x84,
+	0xc2,
+	0x3f,
+	0x26,
+	0x13,
+	0x76,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xc1,
+	0x40,
+	0x00,
+	0x00,
+	0x7f,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x0d,
+	0x06,
+	0xfb,
+	0xf4,
+	0x84,
+	0xc2,
+	0x3f,
+	0xdb,
+	0xee,
+	0x76,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x1a,
+	0x0d,
+	0xf4,
+	0xe7,
+	0x8b,
+	0xc6,
+	0x3b,
+	0xb8,
+	0xdd,
+	0x59,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x26,
+	0x13,
+	0xee,
+	0xdb,
+	0x98,
+	0xcd,
+	0x34,
+	0x9c,
+	0xce,
+	0x2c,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x33,
+	0x1a,
+	0xe7,
+	0xce,
+	0xaa,
+	0xd5,
+	0x2c,
+	0x88,
+	0xc5,
+	0xf7,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x40,
+	0x20,
+	0xe1,
+	0xc1,
+	0xc1,
+	0xe1,
+	0x20,
+	0x81,
+	0xc1,
+	0xc1,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x4d,
+	0x26,
+	0xdb,
+	0xb4,
+	0xdd,
+	0xef,
+	0x12,
+	0x89,
+	0xc5,
+	0x95,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x5a,
+	0x2d,
+	0xd4,
+	0xa7,
+	0xfe,
+	0x00,
+	0x01,
+	0xa4,
+	0xd2,
+	0x81,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x66,
+	0x33,
+	0xce,
+	0x9b,
+	0x24,
+	0x12,
+	0xef,
+	0xd4,
+	0xea,
+	0x95,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x73,
+	0x3a,
+	0xc7,
+	0x8e,
+	0x4f,
+	0x28,
+	0xd9,
+	0x1c,
+	0x0e,
+	0xe3,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x7f,
+	0x40,
+	0xc1,
+	0x81,
+	0x7f,
+	0x40,
+	0xc1,
+	0x7f,
+	0x40,
+	0x7f,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x81,
+	0xb1,
+	0x1c,
+	0x73,
+	0x7f,
+	0x50,
+	0xe5,
+	0x81,
+	0xb1,
+	0x7f,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x8e,
+	0xb9,
+	0x19,
+	0x68,
+	0x4f,
+	0x32,
+	0xf0,
+	0xe5,
+	0xf0,
+	0xe3,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x9b,
+	0xc1,
+	0x16,
+	0x5c,
+	0x24,
+	0x16,
+	0xf9,
+	0x2d,
+	0x1c,
+	0x95,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xa7,
+	0xc9,
+	0x14,
+	0x51,
+	0xfe,
+	0xff,
+	0x01,
+	0x5d,
+	0x3a,
+	0x81,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xb4,
+	0xd1,
+	0x11,
+	0x45,
+	0xdd,
+	0xeb,
+	0x08,
+	0x78,
+	0x4b,
+	0x95,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xc1,
+	0xd9,
+	0x0e,
+	0x3a,
+	0xc1,
+	0xd9,
+	0x0e,
+	0x7f,
+	0x50,
+	0xc1,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xce,
+	0xe1,
+	0x0b,
+	0x2e,
+	0xaa,
+	0xcb,
+	0x13,
+	0x79,
+	0x4c,
+	0xf7,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xdb,
+	0xe9,
+	0x08,
+	0x23,
+	0x98,
+	0xbf,
+	0x17,
+	0x65,
+	0x3f,
+	0x2c,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xe7,
+	0xf1,
+	0x06,
+	0x17,
+	0x8b,
+	0xb7,
+	0x1a,
+	0x49,
+	0x2d,
+	0x59,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xf4,
+	0xf9,
+	0x03,
+	0x0b,
+	0x84,
+	0xb3,
+	0x1b,
+	0x26,
+	0x18,
+	0x76,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xb1,
+	0x1c,
+	0x00,
+	0x00,
+	0x7f,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x0d,
+	0x08,
+	0xfe,
+	0xf5,
+	0x84,
+	0xb3,
+	0x1b,
+	0xdb,
+	0xe9,
+	0x76,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x1a,
+	0x10,
+	0xfb,
+	0xea,
+	0x8b,
+	0xb7,
+	0x1a,
+	0xb8,
+	0xd4,
+	0x59,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x26,
+	0x18,
+	0xf9,
+	0xde,
+	0x98,
+	0xbf,
+	0x17,
+	0x9c,
+	0xc2,
+	0x2c,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x33,
+	0x20,
+	0xf6,
+	0xd3,
+	0xaa,
+	0xcb,
+	0x13,
+	0x88,
+	0xb5,
+	0xf7,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x40,
+	0x28,
+	0xf3,
+	0xc7,
+	0xc1,
+	0xd9,
+	0x0e,
+	0x81,
+	0xb1,
+	0xc1,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x4d,
+	0x30,
+	0xf0,
+	0xbc,
+	0xdd,
+	0xeb,
+	0x08,
+	0x89,
+	0xb6,
+	0x95,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x5a,
+	0x38,
+	0xed,
+	0xb0,
+	0xfe,
+	0xff,
+	0x01,
+	0xa4,
+	0xc7,
+	0x81,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x66,
+	0x40,
+	0xeb,
+	0xa5,
+	0x24,
+	0x16,
+	0xf9,
+	0xd4,
+	0xe5,
+	0x95,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x73,
+	0x48,
+	0xe8,
+	0x99,
+	0x4f,
+	0x32,
+	0xf0,
+	0x1c,
+	0x11,
+	0xe3,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x7f,
+	0x50,
+	0xe5,
+	0x8e,
+	0x7f,
+	0x50,
+	0xe5,
+	0x7f,
+	0x50,
+	0x7f,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x81,
+	0xa1,
+	0xf1,
+	0x48,
+	0x7f,
+	0x60,
+	0x10,
+	0x81,
+	0xa1,
+	0x7f,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x8e,
+	0xab,
+	0xf3,
+	0x41,
+	0x4f,
+	0x3c,
+	0x0a,
+	0xe5,
+	0xec,
+	0xe3,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x9b,
+	0xb4,
+	0xf4,
+	0x3a,
+	0x24,
+	0x1b,
+	0x04,
+	0x2d,
+	0x22,
+	0x95,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xa7,
+	0xbe,
+	0xf6,
+	0x32,
+	0xfe,
+	0xff,
+	0x00,
+	0x5d,
+	0x46,
+	0x81,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xb4,
+	0xc7,
+	0xf7,
+	0x2b,
+	0xdd,
+	0xe6,
+	0xfd,
+	0x78,
+	0x5a,
+	0x95,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xc1,
+	0xd1,
+	0xf9,
+	0x24,
+	0xc1,
+	0xd1,
+	0xf9,
+	0x7f,
+	0x60,
+	0xc1,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xce,
+	0xdb,
+	0xfb,
+	0x1d,
+	0xaa,
+	0xc0,
+	0xf6,
+	0x79,
+	0x5b,
+	0xf7,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xdb,
+	0xe4,
+	0xfc,
+	0x16,
+	0x98,
+	0xb2,
+	0xf4,
+	0x65,
+	0x4c,
+	0x2c,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xe7,
+	0xee,
+	0xfe,
+	0x0e,
+	0x8b,
+	0xa9,
+	0xf2,
+	0x49,
+	0x37,
+	0x59,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xf4,
+	0xf7,
+	0xff,
+	0x07,
+	0x84,
+	0xa3,
+	0xf1,
+	0x26,
+	0x1c,
+	0x76,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xa1,
+	0xf1,
+	0x00,
+	0x00,
+	0x7f,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x0d,
+	0x0a,
+	0x02,
+	0xfa,
+	0x84,
+	0xa3,
+	0xf1,
+	0xdb,
+	0xe5,
+	0x76,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x1a,
+	0x13,
+	0x03,
+	0xf3,
+	0x8b,
+	0xa9,
+	0xf2,
+	0xb8,
+	0xca,
+	0x59,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x26,
+	0x1d,
+	0x05,
+	0xeb,
+	0x98,
+	0xb2,
+	0xf4,
+	0x9c,
+	0xb5,
+	0x2c,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x33,
+	0x26,
+	0x06,
+	0xe4,
+	0xaa,
+	0xc0,
+	0xf6,
+	0x88,
+	0xa6,
+	0xf7,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x40,
+	0x30,
+	0x08,
+	0xdd,
+	0xc1,
+	0xd1,
+	0xf9,
+	0x81,
+	0xa1,
+	0xc1,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x4d,
+	0x3a,
+	0x0a,
+	0xd6,
+	0xdd,
+	0xe6,
+	0xfd,
+	0x89,
+	0xa7,
+	0x95,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x5a,
+	0x43,
+	0x0b,
+	0xcf,
+	0xfe,
+	0xff,
+	0x00,
+	0xa4,
+	0xbb,
+	0x81,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x66,
+	0x4d,
+	0x0d,
+	0xc7,
+	0x24,
+	0x1b,
+	0x04,
+	0xd4,
+	0xdf,
+	0x95,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x73,
+	0x56,
+	0x0e,
+	0xc0,
+	0x4f,
+	0x3c,
+	0x0a,
+	0x1c,
+	0x15,
+	0xe3,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x7f,
+	0x60,
+	0x10,
+	0xb9,
+	0x7f,
+	0x60,
+	0x10,
+	0x7f,
+	0x60,
+	0x7f,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x81,
+	0x91,
+	0xbd,
+	0xfa,
+	0x7f,
+	0x70,
+	0x44,
+	0x81,
+	0x91,
+	0x7f,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x8e,
+	0x9c,
+	0xc4,
+	0xfb,
+	0x4f,
+	0x45,
+	0x2a,
+	0xe5,
+	0xe9,
+	0xe3,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x9b,
+	0xa7,
+	0xcb,
+	0xfb,
+	0x24,
+	0x1f,
+	0x13,
+	0x2d,
+	0x27,
+	0x95,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xa7,
+	0xb3,
+	0xd1,
+	0xfc,
+	0xfe,
+	0xff,
+	0x00,
+	0x5d,
+	0x52,
+	0x81,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xb4,
+	0xbe,
+	0xd8,
+	0xfd,
+	0xdd,
+	0xe2,
+	0xee,
+	0x78,
+	0x69,
+	0x95,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xc1,
+	0xc9,
+	0xdf,
+	0xfe,
+	0xc1,
+	0xc9,
+	0xdf,
+	0x7f,
+	0x70,
+	0xc1,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xce,
+	0xd4,
+	0xe6,
+	0xfe,
+	0xaa,
+	0xb5,
+	0xd3,
+	0x79,
+	0x6a,
+	0xf7,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xdb,
+	0xdf,
+	0xed,
+	0xff,
+	0x98,
+	0xa5,
+	0xc9,
+	0x65,
+	0x59,
+	0x2c,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xe7,
+	0xeb,
+	0xf3,
+	0x00,
+	0x8b,
+	0x9a,
+	0xc2,
+	0x49,
+	0x40,
+	0x59,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xf4,
+	0xf6,
+	0xfa,
+	0x00,
+	0x84,
+	0x93,
+	0xbe,
+	0x26,
+	0x21,
+	0x76,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x91,
+	0xbd,
+	0x00,
+	0x00,
+	0x7f,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x0d,
+	0x0b,
+	0x07,
+	0x01,
+	0x84,
+	0x93,
+	0xbe,
+	0xdb,
+	0xe0,
+	0x76,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x1a,
+	0x16,
+	0x0e,
+	0x01,
+	0x8b,
+	0x9a,
+	0xc2,
+	0xb8,
+	0xc1,
+	0x59,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x26,
+	0x22,
+	0x14,
+	0x02,
+	0x98,
+	0xa5,
+	0xc9,
+	0x9c,
+	0xa8,
+	0x2c,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x33,
+	0x2d,
+	0x1b,
+	0x03,
+	0xaa,
+	0xb5,
+	0xd3,
+	0x88,
+	0x97,
+	0xf7,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x40,
+	0x38,
+	0x22,
+	0x03,
+	0xc1,
+	0xc9,
+	0xdf,
+	0x81,
+	0x91,
+	0xc1,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x4d,
+	0x43,
+	0x29,
+	0x04,
+	0xdd,
+	0xe2,
+	0xee,
+	0x89,
+	0x98,
+	0x95,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x5a,
+	0x4e,
+	0x30,
+	0x05,
+	0xfe,
+	0xff,
+	0x00,
+	0xa4,
+	0xaf,
+	0x81,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x66,
+	0x5a,
+	0x36,
+	0x06,
+	0x24,
+	0x1f,
+	0x13,
+	0xd4,
+	0xda,
+	0x95,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x73,
+	0x65,
+	0x3d,
+	0x06,
+	0x4f,
+	0x45,
+	0x2a,
+	0x1c,
+	0x18,
+	0xe3,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x7f,
+	0x70,
+	0x44,
+	0x07,
+	0x7f,
+	0x70,
+	0x44,
+	0x7f,
+	0x70,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x81,
+	0x81,
+	0x81,
+	0x81,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x81,
+	0x81,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x8e,
+	0x8e,
+	0x8e,
+	0x8e,
+	0x4f,
+	0x4f,
+	0x4f,
+	0xe5,
+	0xe5,
+	0xe3,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x9b,
+	0x9b,
+	0x9b,
+	0x9b,
+	0x24,
+	0x24,
+	0x24,
+	0x2d,
+	0x2d,
+	0x95,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xa7,
+	0xa7,
+	0xa7,
+	0xa7,
+	0xfe,
+	0xfe,
+	0xfe,
+	0x5d,
+	0x5d,
+	0x81,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xb4,
+	0xb4,
+	0xb4,
+	0xb4,
+	0xdd,
+	0xdd,
+	0xdd,
+	0x78,
+	0x78,
+	0x95,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xc1,
+	0xc1,
+	0xc1,
+	0xc1,
+	0xc1,
+	0xc1,
+	0xc1,
+	0x7f,
+	0x7f,
+	0xc1,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xce,
+	0xce,
+	0xce,
+	0xce,
+	0xaa,
+	0xaa,
+	0xaa,
+	0x79,
+	0x79,
+	0xf7,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xdb,
+	0xdb,
+	0xdb,
+	0xdb,
+	0x98,
+	0x98,
+	0x98,
+	0x65,
+	0x65,
+	0x2c,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xe7,
+	0xe7,
+	0xe7,
+	0xe7,
+	0x8b,
+	0x8b,
+	0x8b,
+	0x49,
+	0x49,
+	0x59,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xf4,
+	0xf4,
+	0xf4,
+	0xf4,
+	0x84,
+	0x84,
+	0x84,
+	0x26,
+	0x26,
+	0x76,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x81,
+	0x81,
+	0x00,
+	0x00,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x0d,
+	0x0d,
+	0x0d,
+	0x0d,
+	0x84,
+	0x84,
+	0x84,
+	0xdb,
+	0xdb,
+	0x76,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x1a,
+	0x1a,
+	0x1a,
+	0x1a,
+	0x8b,
+	0x8b,
+	0x8b,
+	0xb8,
+	0xb8,
+	0x59,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x26,
+	0x26,
+	0x26,
+	0x26,
+	0x98,
+	0x98,
+	0x98,
+	0x9c,
+	0x9c,
+	0x2c,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0xaa,
+	0xaa,
+	0xaa,
+	0x88,
+	0x88,
+	0xf7,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0xc1,
+	0xc1,
+	0xc1,
+	0x81,
+	0x81,
+	0xc1,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x4d,
+	0x4d,
+	0x4d,
+	0x4d,
+	0xdd,
+	0xdd,
+	0xdd,
+	0x89,
+	0x89,
+	0x95,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x5a,
+	0x5a,
+	0x5a,
+	0x5a,
+	0xfe,
+	0xfe,
+	0xfe,
+	0xa4,
+	0xa4,
+	0x81,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x66,
+	0x66,
+	0x66,
+	0x66,
+	0x24,
+	0x24,
+	0x24,
+	0xd4,
+	0xd4,
+	0x95,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x73,
+	0x73,
+	0x73,
+	0x73,
+	0x4f,
+	0x4f,
+	0x4f,
+	0x1c,
+	0x1c,
+	0xe3,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xa2,
+	0x36,
+	0x24,
+	0x1b,
+	0x19,
+	0x45,
+	0x39,
+	0x20,
+	0x19,
+	0x19,
+	0x30,
+	0x2a,
+	0x19,
+	0x17,
+	0x26,
+	0x21,
+	0x19,
+	0x15,
+	0x17,
+	0x23,
+	0x20,
+	0x19,
+	0x17,
+	0x16,
+	0x36,
+	0x66,
+	0x23,
+	0x1e,
+	0x1b,
+	0x3b,
+	0x32,
+	0x25,
+	0x1a,
+	0x1b,
+	0x29,
+	0x28,
+	0x1a,
+	0x18,
+	0x23,
+	0x1e,
+	0x18,
+	0x15,
+	0x17,
+	0x20,
+	0x1e,
+	0x18,
+	0x17,
+	0x17,
+	0x24,
+	0x23,
+	0x5a,
+	0x23,
+	0x24,
+	0x21,
+	0x24,
+	0x28,
+	0x24,
+	0x21,
+	0x1d,
+	0x1d,
+	0x1d,
+	0x1d,
+	0x1a,
+	0x17,
+	0x16,
+	0x17,
+	0x1a,
+	0x19,
+	0x18,
+	0x15,
+	0x18,
+	0x19,
+	0x1b,
+	0x1e,
+	0x23,
+	0x66,
+	0x36,
+	0x1b,
+	0x1a,
+	0x25,
+	0x32,
+	0x3b,
+	0x18,
+	0x1a,
+	0x28,
+	0x29,
+	0x17,
+	0x15,
+	0x18,
+	0x1e,
+	0x23,
+	0x17,
+	0x17,
+	0x18,
+	0x1e,
+	0x20,
+	0x19,
+	0x1b,
+	0x24,
+	0x36,
+	0xa2,
+	0x19,
+	0x19,
+	0x20,
+	0x39,
+	0x45,
+	0x17,
+	0x19,
+	0x2a,
+	0x30,
+	0x17,
+	0x15,
+	0x19,
+	0x21,
+	0x26,
+	0x16,
+	0x17,
+	0x19,
+	0x20,
+	0x23,
+	0x45,
+	0x3b,
+	0x21,
+	0x1b,
+	0x19,
+	0x6e,
+	0x30,
+	0x21,
+	0x18,
+	0x19,
+	0x32,
+	0x2e,
+	0x19,
+	0x17,
+	0x2a,
+	0x23,
+	0x1a,
+	0x16,
+	0x17,
+	0x26,
+	0x23,
+	0x1a,
+	0x17,
+	0x17,
+	0x39,
+	0x32,
+	0x24,
+	0x1a,
+	0x19,
+	0x30,
+	0x45,
+	0x1e,
+	0x18,
+	0x18,
+	0x2b,
+	0x27,
+	0x18,
+	0x16,
+	0x23,
+	0x1e,
+	0x17,
+	0x14,
+	0x16,
+	0x21,
+	0x1e,
+	0x17,
+	0x15,
+	0x15,
+	0x20,
+	0x25,
+	0x28,
+	0x25,
+	0x20,
+	0x21,
+	0x1e,
+	0x3c,
+	0x1e,
+	0x21,
+	0x1b,
+	0x1e,
+	0x1e,
+	0x1b,
+	0x1a,
+	0x17,
+	0x17,
+	0x17,
+	0x1a,
+	0x19,
+	0x18,
+	0x16,
+	0x18,
+	0x19,
+	0x19,
+	0x1a,
+	0x24,
+	0x32,
+	0x39,
+	0x18,
+	0x18,
+	0x1e,
+	0x45,
+	0x30,
+	0x16,
+	0x18,
+	0x27,
+	0x2b,
+	0x16,
+	0x14,
+	0x17,
+	0x1e,
+	0x23,
+	0x15,
+	0x15,
+	0x17,
+	0x1e,
+	0x21,
+	0x19,
+	0x1b,
+	0x21,
+	0x3b,
+	0x45,
+	0x19,
+	0x18,
+	0x21,
+	0x30,
+	0x6e,
+	0x17,
+	0x19,
+	0x2e,
+	0x32,
+	0x17,
+	0x16,
+	0x1a,
+	0x23,
+	0x2a,
+	0x17,
+	0x17,
+	0x1a,
+	0x23,
+	0x26,
+	0x30,
+	0x29,
+	0x1d,
+	0x18,
+	0x17,
+	0x32,
+	0x2b,
+	0x1b,
+	0x16,
+	0x17,
+	0x67,
+	0x2b,
+	0x18,
+	0x16,
+	0x32,
+	0x2b,
+	0x1b,
+	0x16,
+	0x17,
+	0x30,
+	0x29,
+	0x1d,
+	0x18,
+	0x17,
+	0x2a,
+	0x28,
+	0x1d,
+	0x1a,
+	0x19,
+	0x2e,
+	0x27,
+	0x1e,
+	0x18,
+	0x19,
+	0x2b,
+	0x45,
+	0x1a,
+	0x18,
+	0x2e,
+	0x27,
+	0x1e,
+	0x18,
+	0x19,
+	0x2a,
+	0x28,
+	0x1d,
+	0x1a,
+	0x19,
+	0x19,
+	0x1a,
+	0x1d,
+	0x28,
+	0x2a,
+	0x19,
+	0x18,
+	0x1e,
+	0x27,
+	0x2e,
+	0x18,
+	0x1a,
+	0x45,
+	0x2b,
+	0x19,
+	0x18,
+	0x1e,
+	0x27,
+	0x2e,
+	0x19,
+	0x1a,
+	0x1d,
+	0x28,
+	0x2a,
+	0x17,
+	0x18,
+	0x1d,
+	0x29,
+	0x30,
+	0x17,
+	0x16,
+	0x1b,
+	0x2b,
+	0x32,
+	0x16,
+	0x18,
+	0x2b,
+	0x67,
+	0x17,
+	0x16,
+	0x1b,
+	0x2b,
+	0x32,
+	0x17,
+	0x18,
+	0x1d,
+	0x29,
+	0x30,
+	0x26,
+	0x23,
+	0x1a,
+	0x17,
+	0x17,
+	0x2a,
+	0x23,
+	0x1a,
+	0x16,
+	0x17,
+	0x32,
+	0x2e,
+	0x19,
+	0x17,
+	0x6e,
+	0x30,
+	0x21,
+	0x18,
+	0x19,
+	0x45,
+	0x3b,
+	0x21,
+	0x1b,
+	0x19,
+	0x21,
+	0x1e,
+	0x17,
+	0x15,
+	0x15,
+	0x23,
+	0x1e,
+	0x17,
+	0x14,
+	0x16,
+	0x2b,
+	0x27,
+	0x18,
+	0x16,
+	0x30,
+	0x45,
+	0x1e,
+	0x18,
+	0x18,
+	0x39,
+	0x32,
+	0x24,
+	0x1a,
+	0x19,
+	0x19,
+	0x18,
+	0x16,
+	0x18,
+	0x19,
+	0x1a,
+	0x17,
+	0x17,
+	0x17,
+	0x1a,
+	0x1b,
+	0x1e,
+	0x1e,
+	0x1b,
+	0x21,
+	0x1e,
+	0x3c,
+	0x1e,
+	0x21,
+	0x20,
+	0x25,
+	0x28,
+	0x25,
+	0x20,
+	0x15,
+	0x15,
+	0x17,
+	0x1e,
+	0x21,
+	0x16,
+	0x14,
+	0x17,
+	0x1e,
+	0x23,
+	0x16,
+	0x18,
+	0x27,
+	0x2b,
+	0x18,
+	0x18,
+	0x1e,
+	0x45,
+	0x30,
+	0x19,
+	0x1a,
+	0x24,
+	0x32,
+	0x39,
+	0x17,
+	0x17,
+	0x1a,
+	0x23,
+	0x26,
+	0x17,
+	0x16,
+	0x1a,
+	0x23,
+	0x2a,
+	0x17,
+	0x19,
+	0x2e,
+	0x32,
+	0x19,
+	0x18,
+	0x21,
+	0x30,
+	0x6e,
+	0x19,
+	0x1b,
+	0x21,
+	0x3b,
+	0x45,
+	0x23,
+	0x20,
+	0x19,
+	0x17,
+	0x16,
+	0x26,
+	0x21,
+	0x19,
+	0x15,
+	0x17,
+	0x30,
+	0x2a,
+	0x19,
+	0x17,
+	0x45,
+	0x39,
+	0x20,
+	0x19,
+	0x19,
+	0xa2,
+	0x36,
+	0x24,
+	0x1b,
+	0x19,
+	0x20,
+	0x1e,
+	0x18,
+	0x17,
+	0x17,
+	0x23,
+	0x1e,
+	0x18,
+	0x15,
+	0x17,
+	0x29,
+	0x28,
+	0x1a,
+	0x18,
+	0x3b,
+	0x32,
+	0x25,
+	0x1a,
+	0x1b,
+	0x36,
+	0x66,
+	0x23,
+	0x1e,
+	0x1b,
+	0x19,
+	0x18,
+	0x15,
+	0x18,
+	0x19,
+	0x1a,
+	0x17,
+	0x16,
+	0x17,
+	0x1a,
+	0x1d,
+	0x1d,
+	0x1d,
+	0x1d,
+	0x21,
+	0x24,
+	0x28,
+	0x24,
+	0x21,
+	0x24,
+	0x23,
+	0x5a,
+	0x23,
+	0x24,
+	0x17,
+	0x17,
+	0x18,
+	0x1e,
+	0x20,
+	0x17,
+	0x15,
+	0x18,
+	0x1e,
+	0x23,
+	0x18,
+	0x1a,
+	0x28,
+	0x29,
+	0x1b,
+	0x1a,
+	0x25,
+	0x32,
+	0x3b,
+	0x1b,
+	0x1e,
+	0x23,
+	0x66,
+	0x36,
+	0x16,
+	0x17,
+	0x19,
+	0x20,
+	0x23,
+	0x17,
+	0x15,
+	0x19,
+	0x21,
+	0x26,
+	0x17,
+	0x19,
+	0x2a,
+	0x30,
+	0x19,
+	0x19,
+	0x20,
+	0x39,
+	0x45,
+	0x19,
+	0x1b,
+	0x24,
+	0x36,
+	0xa2,
+	0x0d,
+	0x26,
+	0x40,
+	0x5a,
+	0x5a,
+	0x40,
+	0x26,
+	0x0d,
+	0xf3,
+	0xda,
+	0xc0,
+	0xa6,
+	0xa6,
+	0xc0,
+	0xda,
+	0xf3,
+	0x03,
+	0x0a,
+	0x0d,
+	0x0d,
+	0x0d,
+	0x06,
+	0xfa,
+	0xf3,
+	0xf3,
+	0xf3,
+	0xf6,
+	0xfd,
+	0x0a,
+	0x1d,
+	0x26,
+	0x26,
+	0x26,
+	0x13,
+	0xed,
+	0xda,
+	0xda,
+	0xda,
+	0xe3,
+	0xf6,
+	0x10,
+	0x30,
+	0x40,
+	0x40,
+	0x40,
+	0x20,
+	0xe0,
+	0xc0,
+	0xc0,
+	0xc0,
+	0xd0,
+	0xf0,
+	0x16,
+	0x43,
+	0x5a,
+	0x5a,
+	0x5a,
+	0x2d,
+	0xd3,
+	0xa6,
+	0xa6,
+	0xa6,
+	0xbd,
+	0xea,
+	0x16,
+	0x43,
+	0x5a,
+	0x5a,
+	0x5a,
+	0x2d,
+	0xd3,
+	0xa6,
+	0xa6,
+	0xa6,
+	0xbd,
+	0xea,
+	0x10,
+	0x30,
+	0x40,
+	0x40,
+	0x40,
+	0x20,
+	0xe0,
+	0xc0,
+	0xc0,
+	0xc0,
+	0xd0,
+	0xf0,
+	0x0a,
+	0x1d,
+	0x26,
+	0x26,
+	0x26,
+	0x13,
+	0xed,
+	0xda,
+	0xda,
+	0xda,
+	0xe3,
+	0xf6,
+	0x03,
+	0x0a,
+	0x0d,
+	0x0d,
+	0x0d,
+	0x06,
+	0xfa,
+	0xf3,
+	0xf3,
+	0xf3,
+	0xf6,
+	0xfd,
+	0x0d,
+	0x26,
+	0x40,
+	0x5a,
+	0x73,
+	0x73,
+	0x5a,
+	0x40,
+	0x26,
+	0x0d,
+	0xf3,
+	0xda,
+	0xc0,
+	0xa6,
+	0x8d,
+	0x8d,
+	0xa6,
+	0xc0,
+	0xda,
+	0xf3,
+	0x03,
+	0x0a,
+	0x10,
+	0x16,
+	0x1d,
+	0x1d,
+	0x16,
+	0x10,
+	0x0a,
+	0x03,
+	0x0a,
+	0x1d,
+	0x30,
+	0x43,
+	0x56,
+	0x56,
+	0x43,
+	0x30,
+	0x1d,
+	0x0a,
+	0x0d,
+	0x26,
+	0x40,
+	0x5a,
+	0x73,
+	0x73,
+	0x5a,
+	0x40,
+	0x26,
+	0x0d,
+	0x0d,
+	0x26,
+	0x40,
+	0x5a,
+	0x73,
+	0x73,
+	0x5a,
+	0x40,
+	0x26,
+	0x0d,
+	0x06,
+	0x13,
+	0x20,
+	0x2d,
+	0x3a,
+	0x3a,
+	0x2d,
+	0x20,
+	0x13,
+	0x06,
+	0xfa,
+	0xed,
+	0xe0,
+	0xd3,
+	0xc6,
+	0xc6,
+	0xd3,
+	0xe0,
+	0xed,
+	0xfa,
+	0xf3,
+	0xda,
+	0xc0,
+	0xa6,
+	0x8d,
+	0x8d,
+	0xa6,
+	0xc0,
+	0xda,
+	0xf3,
+	0xf3,
+	0xda,
+	0xc0,
+	0xa6,
+	0x8d,
+	0x8d,
+	0xa6,
+	0xc0,
+	0xda,
+	0xf3,
+	0xf6,
+	0xe3,
+	0xd0,
+	0xbd,
+	0xaa,
+	0xaa,
+	0xbd,
+	0xd0,
+	0xe3,
+	0xf6,
+	0xfd,
+	0xf6,
+	0xf0,
+	0xea,
+	0xe3,
+	0xe3,
+	0xea,
+	0xf0,
+	0xf6,
+	0xfd,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xcd,
+	0x33,
+	0x00,
+	0x00,
+	0x9a,
+	0x66,
+	0x00,
+	0x00,
+	0x66,
+	0x9a,
+	0x00,
+	0x00,
+	0x33,
+	0xcd,
+	0x00,
+	0x00,
+	0xc0,
+	0x00,
+	0x40,
+	0x00,
+	0x9a,
+	0x26,
+	0x33,
+	0x0d,
+	0x73,
+	0x4d,
+	0x26,
+	0x1a,
+	0x4d,
+	0x73,
+	0x1a,
+	0x26,
+	0x26,
+	0x9a,
+	0x0d,
+	0x33,
+	0x80,
+	0x00,
+	0x80,
+	0x00,
+	0x66,
+	0x1a,
+	0x66,
+	0x1a,
+	0x4d,
+	0x33,
+	0x4d,
+	0x33,
+	0x33,
+	0x4d,
+	0x33,
+	0x4d,
+	0x1a,
+	0x66,
+	0x1a,
+	0x66,
+	0x40,
+	0x00,
+	0xc0,
+	0x00,
+	0x33,
+	0x0d,
+	0x9a,
+	0x26,
+	0x26,
+	0x1a,
+	0x73,
+	0x4d,
+	0x1a,
+	0x26,
+	0x4d,
+	0x73,
+	0x0d,
+	0x33,
+	0x26,
+	0x9a,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x0c,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x02,
+	0x04,
+	0x02,
+	0x08,
+	0x02,
+	0x0c,
+	0x02,
+	0x10,
+	0x02,
+	0x00,
+	0x04,
+	0x04,
+	0x04,
+	0x08,
+	0x04,
+	0x0c,
+	0x04,
+	0x10,
+	0x04,
+	0x00,
+	0x06,
+	0x04,
+	0x06,
+	0x08,
+	0x06,
+	0x0c,
+	0x06,
+	0x10,
+	0x06,
+	0x00,
+	0x08,
+	0x14,
+	0x00,
+	0x18,
+	0x00,
+	0x1c,
+	0x00,
+	0x20,
+	0x00,
+	0x24,
+	0x00,
+	0x14,
+	0x02,
+	0x18,
+	0x02,
+	0x1c,
+	0x02,
+	0x20,
+	0x02,
+	0x24,
+	0x02,
+	0x14,
+	0x04,
+	0x18,
+	0x04,
+	0x1c,
+	0x04,
+	0x20,
+	0x04,
+	0x24,
+	0x04,
+	0x14,
+	0x06,
+	0x18,
+	0x06,
+	0x1c,
+	0x06,
+	0x20,
+	0x06,
+	0x24,
+	0x06,
+	0x14,
+	0x08,
+	0x28,
+	0x00,
+	0x2c,
+	0x00,
+	0x30,
+	0x00,
+	0x34,
+	0x00,
+	0x38,
+	0x00,
+	0x28,
+	0x02,
+	0x2c,
+	0x02,
+	0x30,
+	0x02,
+	0x34,
+	0x02,
+	0x38,
+	0x02,
+	0x28,
+	0x04,
+	0x2c,
+	0x04,
+	0x30,
+	0x04,
+	0x34,
+	0x04,
+	0x38,
+	0x04,
+	0x28,
+	0x06,
+	0x2c,
+	0x06,
+	0x30,
+	0x06,
+	0x34,
+	0x06,
+	0x38,
+	0x06,
+	0x28,
+	0x08,
+	0x3c,
+	0x00,
+	0x40,
+	0x00,
+	0x44,
+	0x00,
+	0x48,
+	0x00,
+	0x4c,
+	0x00,
+	0x3c,
+	0x02,
+	0x40,
+	0x02,
+	0x44,
+	0x02,
+	0x48,
+	0x02,
+	0x4c,
+	0x02,
+	0x3c,
+	0x04,
+	0x40,
+	0x04,
+	0x44,
+	0x04,
+	0x48,
+	0x04,
+	0x4c,
+	0x04,
+	0x3c,
+	0x06,
+	0x40,
+	0x06,
+	0x44,
+	0x06,
+	0x48,
+	0x06,
+	0x4c,
+	0x06,
+	0x3c,
+	0x08,
+	0x00,
+	0x0a,
+	0x04,
+	0x0a,
+	0x08,
+	0x0a,
+	0x0c,
+	0x0a,
+	0x10,
+	0x0a,
+	0x00,
+	0x0c,
+	0x04,
+	0x0c,
+	0x08,
+	0x0c,
+	0x0c,
+	0x0c,
+	0x10,
+	0x0c,
+	0x00,
+	0x0e,
+	0x04,
+	0x0e,
+	0x08,
+	0x0e,
+	0x0c,
+	0x0e,
+	0x10,
+	0x0e,
+	0x00,
+	0x10,
+	0x04,
+	0x10,
+	0x08,
+	0x10,
+	0x0c,
+	0x10,
+	0x10,
+	0x10,
+	0x00,
+	0x12,
+	0x14,
+	0x0a,
+	0x18,
+	0x0a,
+	0x1c,
+	0x0a,
+	0x20,
+	0x0a,
+	0x24,
+	0x0a,
+	0x14,
+	0x0c,
+	0x18,
+	0x0c,
+	0x1c,
+	0x0c,
+	0x20,
+	0x0c,
+	0x24,
+	0x0c,
+	0x14,
+	0x0e,
+	0x18,
+	0x0e,
+	0x1c,
+	0x0e,
+	0x20,
+	0x0e,
+	0x24,
+	0x0e,
+	0x14,
+	0x10,
+	0x18,
+	0x10,
+	0x1c,
+	0x10,
+	0x20,
+	0x10,
+	0x24,
+	0x10,
+	0x14,
+	0x12,
+	0x28,
+	0x0a,
+	0x2c,
+	0x0a,
+	0x30,
+	0x0a,
+	0x34,
+	0x0a,
+	0x38,
+	0x0a,
+	0x28,
+	0x0c,
+	0x2c,
+	0x0c,
+	0x30,
+	0x0c,
+	0x34,
+	0x0c,
+	0x38,
+	0x0c,
+	0x28,
+	0x0e,
+	0x2c,
+	0x0e,
+	0x30,
+	0x0e,
+	0x34,
+	0x0e,
+	0x38,
+	0x0e,
+	0x28,
+	0x10,
+	0x2c,
+	0x10,
+	0x30,
+	0x10,
+	0x34,
+	0x10,
+	0x38,
+	0x10,
+	0x28,
+	0x12,
+	0x3c,
+	0x0a,
+	0x40,
+	0x0a,
+	0x44,
+	0x0a,
+	0x48,
+	0x0a,
+	0x4c,
+	0x0a,
+	0x3c,
+	0x0c,
+	0x40,
+	0x0c,
+	0x44,
+	0x0c,
+	0x48,
+	0x0c,
+	0x4c,
+	0x0c,
+	0x3c,
+	0x0e,
+	0x40,
+	0x0e,
+	0x44,
+	0x0e,
+	0x48,
+	0x0e,
+	0x4c,
+	0x0e,
+	0x3c,
+	0x10,
+	0x40,
+	0x10,
+	0x44,
+	0x10,
+	0x48,
+	0x10,
+	0x4c,
+	0x10,
+	0x3c,
+	0x12,
+	0x00,
+	0x14,
+	0x04,
+	0x14,
+	0x08,
+	0x14,
+	0x0c,
+	0x14,
+	0x10,
+	0x14,
+	0x00,
+	0x16,
+	0x04,
+	0x16,
+	0x08,
+	0x16,
+	0x0c,
+	0x16,
+	0x10,
+	0x16,
+	0x00,
+	0x18,
+	0x04,
+	0x18,
+	0x08,
+	0x18,
+	0x0c,
+	0x18,
+	0x10,
+	0x18,
+	0x00,
+	0x1a,
+	0x04,
+	0x1a,
+	0x08,
+	0x1a,
+	0x0c,
+	0x1a,
+	0x10,
+	0x1a,
+	0x00,
+	0x1c,
+	0x14,
+	0x14,
+	0x18,
+	0x14,
+	0x1c,
+	0x14,
+	0x20,
+	0x14,
+	0x24,
+	0x14,
+	0x14,
+	0x16,
+	0x18,
+	0x16,
+	0x1c,
+	0x16,
+	0x20,
+	0x16,
+	0x24,
+	0x16,
+	0x14,
+	0x18,
+	0x18,
+	0x18,
+	0x1c,
+	0x18,
+	0x20,
+	0x18,
+	0x24,
+	0x18,
+	0x14,
+	0x1a,
+	0x18,
+	0x1a,
+	0x1c,
+	0x1a,
+	0x20,
+	0x1a,
+	0x24,
+	0x1a,
+	0x14,
+	0x1c,
+	0x28,
+	0x14,
+	0x2c,
+	0x14,
+	0x30,
+	0x14,
+	0x34,
+	0x14,
+	0x38,
+	0x14,
+	0x28,
+	0x16,
+	0x2c,
+	0x16,
+	0x30,
+	0x16,
+	0x34,
+	0x16,
+	0x38,
+	0x16,
+	0x28,
+	0x18,
+	0x2c,
+	0x18,
+	0x30,
+	0x18,
+	0x34,
+	0x18,
+	0x38,
+	0x18,
+	0x28,
+	0x1a,
+	0x2c,
+	0x1a,
+	0x30,
+	0x1a,
+	0x34,
+	0x1a,
+	0x38,
+	0x1a,
+	0x28,
+	0x1c,
+	0x3c,
+	0x14,
+	0x40,
+	0x14,
+	0x44,
+	0x14,
+	0x48,
+	0x14,
+	0x4c,
+	0x14,
+	0x3c,
+	0x16,
+	0x40,
+	0x16,
+	0x44,
+	0x16,
+	0x48,
+	0x16,
+	0x4c,
+	0x16,
+	0x3c,
+	0x18,
+	0x40,
+	0x18,
+	0x44,
+	0x18,
+	0x48,
+	0x18,
+	0x4c,
+	0x18,
+	0x3c,
+	0x1a,
+	0x40,
+	0x1a,
+	0x44,
+	0x1a,
+	0x48,
+	0x1a,
+	0x4c,
+	0x1a,
+	0x3c,
+	0x1c,
+	0x00,
+	0x1e,
+	0x04,
+	0x1e,
+	0x08,
+	0x1e,
+	0x0c,
+	0x1e,
+	0x10,
+	0x1e,
+	0x00,
+	0x20,
+	0x04,
+	0x20,
+	0x08,
+	0x20,
+	0x0c,
+	0x20,
+	0x10,
+	0x20,
+	0x00,
+	0x22,
+	0x04,
+	0x22,
+	0x08,
+	0x22,
+	0x0c,
+	0x22,
+	0x10,
+	0x22,
+	0x00,
+	0x24,
+	0x04,
+	0x24,
+	0x08,
+	0x24,
+	0x0c,
+	0x24,
+	0x10,
+	0x24,
+	0x00,
+	0x26,
+	0x14,
+	0x1e,
+	0x18,
+	0x1e,
+	0x1c,
+	0x1e,
+	0x20,
+	0x1e,
+	0x24,
+	0x1e,
+	0x14,
+	0x20,
+	0x18,
+	0x20,
+	0x1c,
+	0x20,
+	0x20,
+	0x20,
+	0x24,
+	0x20,
+	0x14,
+	0x22,
+	0x18,
+	0x22,
+	0x1c,
+	0x22,
+	0x20,
+	0x22,
+	0x24,
+	0x22,
+	0x14,
+	0x24,
+	0x18,
+	0x24,
+	0x1c,
+	0x24,
+	0x20,
+	0x24,
+	0x24,
+	0x24,
+	0x14,
+	0x26,
+	0x28,
+	0x1e,
+	0x2c,
+	0x1e,
+	0x30,
+	0x1e,
+	0x34,
+	0x1e,
+	0x38,
+	0x1e,
+	0x28,
+	0x20,
+	0x2c,
+	0x20,
+	0x30,
+	0x20,
+	0x34,
+	0x20,
+	0x38,
+	0x20,
+	0x28,
+	0x22,
+	0x2c,
+	0x22,
+	0x30,
+	0x22,
+	0x34,
+	0x22,
+	0x38,
+	0x22,
+	0x28,
+	0x24,
+	0x2c,
+	0x24,
+	0x30,
+	0x24,
+	0x34,
+	0x24,
+	0x38,
+	0x24,
+	0x28,
+	0x26,
+	0x3c,
+	0x1e,
+	0x40,
+	0x1e,
+	0x44,
+	0x1e,
+	0x48,
+	0x1e,
+	0x4c,
+	0x1e,
+	0x3c,
+	0x20,
+	0x40,
+	0x20,
+	0x44,
+	0x20,
+	0x48,
+	0x20,
+	0x4c,
+	0x20,
+	0x3c,
+	0x22,
+	0x40,
+	0x22,
+	0x44,
+	0x22,
+	0x48,
+	0x22,
+	0x4c,
+	0x22,
+	0x3c,
+	0x24,
+	0x40,
+	0x24,
+	0x44,
+	0x24,
+	0x48,
+	0x24,
+	0x4c,
+	0x24,
+	0x3c,
+	0x26,
+	0x00,
+	0x28,
+	0x04,
+	0x28,
+	0x08,
+	0x28,
+	0x0c,
+	0x28,
+	0x10,
+	0x28,
+	0x00,
+	0x2a,
+	0x04,
+	0x2a,
+	0x08,
+	0x2a,
+	0x0c,
+	0x2a,
+	0x10,
+	0x2a,
+	0x00,
+	0x2c,
+	0x04,
+	0x2c,
+	0x08,
+	0x2c,
+	0x0c,
+	0x2c,
+	0x10,
+	0x2c,
+	0x00,
+	0x2e,
+	0x04,
+	0x2e,
+	0x08,
+	0x2e,
+	0x0c,
+	0x2e,
+	0x10,
+	0x2e,
+	0x00,
+	0x30,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x0c,
+	0x1a,
+	0x26,
+	0x34,
+	0x40,
+	0x4c,
+	0x5a,
+	0x66,
+	0x74,
+	0x80,
+	0x8c,
+	0x9a,
+	0xa6,
+	0xb4,
+	0xc0,
+	0xcc,
+	0xda,
+	0xe6,
+	0xf4,
+	0x00,
+	0x10,
+	0x20,
+	0x30,
+	0x40,
+	0x50,
+	0x60,
+	0x70,
+	0x80,
+	0x90,
+	0xa0,
+	0xb0,
+	0xc0,
+	0xd0,
+	0xe0,
+	0xf0,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x55,
+	0x00,
+	0xcc,
+	0xaa,
+	0x24,
+	0x00,
+	0x1c,
+	0x66,
+	0xd1,
+	0x55,
+	0xec,
+	0x92,
+	0x44,
+	0x00,
+	0xc3,
+	0x8e,
+	0x5e,
+	0x33,
+	0x0c,
+	0xe8,
+	0xc8,
+	0xaa,
+	0x8f,
+	0x76,
+	0x5e,
+	0x49,
+	0x34,
+	0x22,
+	0x10,
+	0x00,
+	0xf0,
+	0xe1,
+	0xd4,
+	0xc7,
+	0xba,
+	0xaf,
+	0xa4,
+	0x99,
+	0x8f,
+	0x86,
+	0x7d,
+	0x74,
+	0x6c,
+	0x64,
+	0x5c,
+	0x55,
+	0x4e,
+	0x47,
+	0x41,
+	0x3b,
+	0x35,
+	0x2f,
+	0x29,
+	0x24,
+	0x1f,
+	0x1a,
+	0x15,
+	0x11,
+	0x0c,
+	0x08,
+	0x04,
+	0x00,
+	0xfc,
+	0xf8,
+	0xf4,
+	0xf0,
+	0xed,
+	0xea,
+	0xe6,
+	0xe3,
+	0xe0,
+	0xdd,
+	0xda,
+	0xd7,
+	0xd4,
+	0xd2,
+	0xcf,
+	0xcc,
+	0xca,
+	0xc7,
+	0xc5,
+	0xc3,
+	0xc0,
+	0xbe,
+	0xbc,
+	0xba,
+	0xb8,
+	0xb6,
+	0xb4,
+	0xb2,
+	0xb0,
+	0xae,
+	0xac,
+	0xaa,
+	0xa8,
+	0xa7,
+	0xa5,
+	0xa3,
+	0xa2,
+	0xa0,
+	0x9f,
+	0x9d,
+	0x9c,
+	0x9a,
+	0x99,
+	0x97,
+	0x96,
+	0x94,
+	0x93,
+	0x92,
+	0x90,
+	0x8f,
+	0x8e,
+	0x8d,
+	0x8c,
+	0x8a,
+	0x89,
+	0x88,
+	0x87,
+	0x86,
+	0x85,
+	0x84,
+	0x83,
+	0x82,
+	0x81,
+	0x80,
+	0x7f,
+	0x7e,
+	0x7d,
+	0x7c,
+	0x7b,
+	0x7a,
+	0x79,
+	0x78,
+	0x77,
+	0x76,
+	0x75,
+	0x75,
+	0x74,
+	0x73,
+	0x72,
+	0x71,
+	0x70,
+	0x70,
+	0x6f,
+	0x6e,
+	0x6d,
+	0x6d,
+	0x6c,
+	0x6b,
+	0x6b,
+	0x6a,
+	0x69,
+	0x69,
+	0x68,
+	0x67,
+	0x67,
+	0x66,
+	0x65,
+	0x65,
+	0x64,
+	0x63,
+	0x63,
+	0x62,
+	0x62,
+	0x61,
+	0x60,
+	0x60,
+	0x5f,
+	0x5f,
+	0x5e,
+	0x5e,
+	0x5d,
+	0x5d,
+	0x5c,
+	0x5c,
+	0x5b,
+	0x5b,
+	0x5a,
+	0x5a,
+	0x59,
+	0x59,
+	0x58,
+	0x58,
+	0x57,
+	0x57,
+	0x56,
+	0x56,
+	0x55,
+	0x55,
+	0x54,
+	0x54,
+	0x54,
+	0x53,
+	0x53,
+	0x52,
+	0x52,
+	0x51,
+	0x51,
+	0x51,
+	0x50,
+	0x50,
+	0x4f,
+	0x4f,
+	0x4f,
+	0x4e,
+	0x4e,
+	0x4e,
+	0x4d,
+	0x4d,
+	0x4c,
+	0x4c,
+	0x4c,
+	0x4b,
+	0x4b,
+	0x4b,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x49,
+	0x49,
+	0x49,
+	0x48,
+	0x48,
+	0x48,
+	0x47,
+	0x47,
+	0x47,
+	0x46,
+	0x46,
+	0x46,
+	0x46,
+	0x45,
+	0x45,
+	0x45,
+	0x44,
+	0x44,
+	0x44,
+	0x43,
+	0x43,
+	0x43,
+	0x43,
+	0x42,
+	0x42,
+	0x42,
+	0x42,
+	0x41,
+	0x41,
+	0x41,
+	0x41,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x20,
+	0x15,
+	0x10,
+	0x0c,
+	0x0a,
+	0x09,
+	0x08,
+	0x07,
+	0x06,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x03,
+	0x03,
+	0x03,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xfe,
+	0xfc,
+	0xfa,
+	0xf8,
+	0xf6,
+	0xf4,
+	0xf2,
+	0xf0,
+	0xef,
+	0xed,
+	0xeb,
+	0xe9,
+	0xe8,
+	0xe6,
+	0xe4,
+	0xe3,
+	0xe1,
+	0xe0,
+	0xde,
+	0xdd,
+	0xdb,
+	0xda,
+	0xd8,
+	0xd7,
+	0xd5,
+	0xd4,
+	0xd3,
+	0xd1,
+	0xd0,
+	0xcf,
+	0xcd,
+	0xcc,
+	0xcb,
+	0xc9,
+	0xc8,
+	0xc7,
+	0xc6,
+	0xc5,
+	0xc3,
+	0xc2,
+	0xc1,
+	0xc0,
+	0xbf,
+	0xbe,
+	0xbd,
+	0xbb,
+	0xba,
+	0xb9,
+	0xb8,
+	0xb7,
+	0xb6,
+	0xb5,
+	0xb4,
+	0xb3,
+	0xb2,
+	0xb1,
+	0xb0,
+	0xaf,
+	0xae,
+	0xad,
+	0xac,
+	0xac,
+	0xab,
+	0xaa,
+	0xa9,
+	0xa8,
+	0xa7,
+	0xa6,
+	0xa5,
+	0xa5,
+	0xa4,
+	0xa3,
+	0xa2,
+	0xa1,
+	0xa0,
+	0xa0,
+	0x9f,
+	0x9e,
+	0x9d,
+	0x9d,
+	0x9c,
+	0x9b,
+	0x9a,
+	0x9a,
+	0x99,
+	0x98,
+	0x97,
+	0x97,
+	0x96,
+	0x95,
+	0x95,
+	0x94,
+	0x93,
+	0x93,
+	0x92,
+	0x91,
+	0x91,
+	0x90,
+	0x8f,
+	0x8f,
+	0x8e,
+	0x8d,
+	0x8d,
+	0x8c,
+	0x8c,
+	0x8b,
+	0x8a,
+	0x8a,
+	0x89,
+	0x89,
+	0x88,
+	0x88,
+	0x87,
+	0x86,
+	0x86,
+	0x85,
+	0x85,
+	0x84,
+	0x84,
+	0x83,
+	0x83,
+	0x82,
+	0x82,
+	0x81,
+	0x81,
+	0x80,
+	0x80,
+	0x7f,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xae,
+	0x00,
+	0x93,
+	0xae,
+	0x75,
+	0x00,
+	0x5c,
+	0x93,
+	0xad,
+	0xae,
+	0x9b,
+	0x75,
+	0x41,
+	0x00,
+	0xb3,
+	0x5c,
+	0xfc,
+	0x93,
+	0x23,
+	0xad,
+	0x30,
+	0xae,
+	0x27,
+	0x9b,
+	0x0a,
+	0x75,
+	0xdd,
+	0x41,
+	0xa2,
+	0x00,
+	0x5b,
+	0xb3,
+	0x09,
+	0x5c,
+	0xad,
+	0xfc,
+	0x49,
+	0x93,
+	0xdc,
+	0x23,
+	0x69,
+	0xad,
+	0xef,
+	0x30,
+	0x70,
+	0xae,
+	0xeb,
+	0x27,
+	0x61,
+	0x9b,
+	0xd3,
+	0x0a,
+	0x40,
+	0x75,
+	0xaa,
+	0xdd,
+	0x10,
+	0x41,
+	0x72,
+	0xa2,
+	0xd1,
+	0x00,
+	0x2e,
+	0x5b,
+	0x87,
+	0xb3,
+	0xde,
+	0x09,
+	0x33,
+	0x5c,
+	0x85,
+	0xad,
+	0xd5,
+	0xfc,
+	0x22,
+	0x49,
+	0x6e,
+	0x93,
+	0xb8,
+	0xdc,
+	0x00,
+	0x23,
+	0x46,
+	0x69,
+	0x8b,
+	0xad,
+	0xce,
+	0xef,
+	0x10,
+	0x30,
+	0x50,
+	0x70,
+	0x8f,
+	0xae,
+	0xcd,
+	0xeb,
+	0x09,
+	0x27,
+	0x44,
+	0x61,
+	0x7e,
+	0x9b,
+	0xb7,
+	0xd3,
+	0xef,
+	0x0a,
+	0x25,
+	0x40,
+	0x5b,
+	0x75,
+	0x90,
+	0xaa,
+	0xc4,
+	0xdd,
+	0xf7,
+	0x10,
+	0x29,
+	0x41,
+	0x5a,
+	0x72,
+	0x8a,
+	0xa2,
+	0xba,
+	0xd1,
+	0xe9,
+	0x00,
+	0x17,
+	0x2e,
+	0x44,
+	0x5b,
+	0x71,
+	0x87,
+	0x9d,
+	0xb3,
+	0xc9,
+	0xde,
+	0xf4,
+	0x09,
+	0x1e,
+	0x33,
+	0x47,
+	0x5c,
+	0x70,
+	0x85,
+	0x99,
+	0xad,
+	0xc1,
+	0xd5,
+	0xe8,
+	0xfc,
+	0x0f,
+	0x22,
+	0x36,
+	0x49,
+	0x5b,
+	0x6e,
+	0x81,
+	0x93,
+	0xa6,
+	0xb8,
+	0xca,
+	0xdc,
+	0xee,
+	0x00,
+	0x12,
+	0x23,
+	0x35,
+	0x46,
+	0x58,
+	0x69,
+	0x7a,
+	0x8b,
+	0x9c,
+	0xad,
+	0xbe,
+	0xce,
+	0xdf,
+	0xef,
+	0x00,
+	0x10,
+	0x20,
+	0x30,
+	0x40,
+	0x50,
+	0x60,
+	0x70,
+	0x7f,
+	0x8f,
+	0x9f,
+	0xae,
+	0xbd,
+	0xcd,
+	0xdc,
+	0xeb,
+	0xfa,
+	0x09,
+	0x18,
+	0x27,
+	0x35,
+	0x44,
+	0x53,
+	0x61,
+	0x70,
+	0x7e,
+	0x8c,
+	0x9b,
+	0xa9,
+	0xb7,
+	0xc5,
+	0xd3,
+	0xe1,
+	0xef,
+	0xfc,
+	0x0a,
+	0x18,
+	0x25,
+	0x33,
+	0x40,
+	0x4e,
+	0x5b,
+	0x68,
+	0x75,
+	0x83,
+	0x90,
+	0x9d,
+	0xaa,
+	0xb7,
+	0xc4,
+	0xd0,
+	0xdd,
+	0xea,
+	0xf7,
+	0x03,
+	0x10,
+	0x1c,
+	0x29,
+	0x35,
+	0x41,
+	0x4e,
+	0x5a,
+	0x66,
+	0x72,
+	0x7e,
+	0x8a,
+	0x96,
+	0xa2,
+	0xae,
+	0xba,
+	0xc6,
+	0xd1,
+	0xdd,
+	0xe9,
+	0xf4,
+	0x00,
+	0x00,
+	0x08,
+	0x0c,
+	0x10,
+	0x12,
+	0x14,
+	0x16,
+	0x18,
+	0x19,
+	0x1a,
+	0x1b,
+	0x1c,
+	0x1d,
+	0x1e,
+	0x1f,
+	0x20,
+	0x20,
+	0x21,
+	0x21,
+	0x22,
+	0x23,
+	0x23,
+	0x24,
+	0x24,
+	0x25,
+	0x25,
+	0x26,
+	0x26,
+	0x26,
+	0x27,
+	0x27,
+	0x28,
+	0x28,
+	0x28,
+	0x29,
+	0x29,
+	0x29,
+	0x29,
+	0x2a,
+	0x2a,
+	0x2a,
+	0x2b,
+	0x2b,
+	0x2b,
+	0x2b,
+	0x2c,
+	0x2c,
+	0x2c,
+	0x2c,
+	0x2d,
+	0x2d,
+	0x2d,
+	0x2d,
+	0x2e,
+	0x2e,
+	0x2e,
+	0x2e,
+	0x2e,
+	0x2f,
+	0x2f,
+	0x2f,
+	0x2f,
+	0x2f,
+	0x30,
+	0x30,
+	0x30,
+	0x30,
+	0x30,
+	0x30,
+	0x31,
+	0x31,
+	0x31,
+	0x31,
+	0x31,
+	0x31,
+	0x31,
+	0x32,
+	0x32,
+	0x32,
+	0x32,
+	0x32,
+	0x32,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0x34,
+	0x34,
+	0x34,
+	0x34,
+	0x34,
+	0x34,
+	0x34,
+	0x34,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0xe3,
+	0x7e,
+	0x5b,
+	0x7f,
+	0xd3,
+	0x7f,
+	0x4b,
+	0x80,
+	0x73,
+	0x80,
+	0x9b,
+	0x80,
+
+};
+
+uint8_t dppclib_u[] =
+{
+	0x03,
+	0x00,
+	0x01,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0x00,
+	0x05,
+	0xfa,
+	0x7b,
+	0x00,
+	0x20,
+	0xfe,
+	0x1a,
+	0x01,
+	0x02,
+	0x05,
+	0x80,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0xfd,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x91,
+	0x02,
+	0x0a,
+	0xff,
+	0xff,
+	0xfd,
+	0x00,
+	0x00,
+	0x00,
+	0x0e,
+	0xff,
+	0xfb,
+	0x00,
+	0x00,
+	0xfc,
+	0x87,
+	0x03,
+	0x06,
+	0x00,
+	0xff,
+	0xfd,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x01,
+	0xff,
+	0x00,
+	0x00,
+	0xff,
+	0x80,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x74,
+	0x01,
+	0xfd,
+	0x01,
+	0x01,
+	0xfe,
+	0xff,
+	0x00,
+	0x00,
+	0xf7,
+	0x04,
+	0x07,
+	0x00,
+	0x00,
+	0x03,
+	0x78,
+	0x00,
+	0xfe,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xfa,
+	0x02,
+	0x05,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+
+};
+
+uint8_t dopcode_u[] =
+{
+	0x78,
+	0xb8,
+	0x18,
+	0x64,
+	0x10,
+	0x64,
+	0x11,
+	0x64,
+	0x13,
+	0xa9,
+	0x01,
+	0x85,
+	0x12,
+	0xa0,
+	0x52,
+	0x13,
+	0x10,
+	0x00,
+	0x00,
+	0x02,
+	0xa9,
+	0x11,
+	0x8d,
+	0xa4,
+	0x02,
+	0xa9,
+	0x80,
+	0x8d,
+	0x4a,
+	0x02,
+	0x8d,
+	0x4b,
+	0x02,
+	0x8d,
+	0x4c,
+	0x02,
+	0x8d,
+	0x4d,
+	0x02,
+	0x8d,
+	0x4e,
+	0x02,
+	0x8d,
+	0x4f,
+	0x02,
+	0x8d,
+	0x50,
+	0x02,
+	0xa9,
+	0x00,
+	0x8d,
+	0x00,
+	0x02,
+	0xa9,
+	0x02,
+	0x8d,
+	0x01,
+	0x02,
+	0xa9,
+	0xed,
+	0x8d,
+	0x02,
+	0x02,
+	0xa9,
+	0xb4,
+	0x8d,
+	0x03,
+	0x02,
+	0xa9,
+	0xff,
+	0x8d,
+	0xa2,
+	0x02,
+	0x8d,
+	0xa3,
+	0x02,
+	0xa0,
+	0x03,
+	0x53,
+	0xcc,
+	0x3b,
+	0x04,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x07,
+	0x02,
+	0xcd,
+	0xce,
+	0x3b,
+	0xf0,
+	0x04,
+	0xa2,
+	0x02,
+	0x80,
+	0x10,
+	0xa2,
+	0x01,
+	0xad,
+	0x00,
+	0x60,
+	0xc9,
+	0xed,
+	0xd0,
+	0x07,
+	0xad,
+	0x01,
+	0x60,
+	0xc9,
+	0xb4,
+	0xf0,
+	0x0e,
+	0x8e,
+	0x08,
+	0x02,
+	0xa9,
+	0x01,
+	0x9c,
+	0x14,
+	0x68,
+	0x8d,
+	0x14,
+	0x68,
+	0x5c,
+	0x80,
+	0xfd,
+	0x9c,
+	0x14,
+	0x68,
+	0x9c,
+	0x18,
+	0x68,
+	0x9c,
+	0x20,
+	0x68,
+	0x9c,
+	0x24,
+	0x68,
+	0x9c,
+	0x28,
+	0x68,
+	0xa2,
+	0xff,
+	0x9a,
+	0xa9,
+	0xd7,
+	0x85,
+	0x0e,
+	0xa9,
+	0x22,
+	0x85,
+	0x0f,
+	0xa9,
+	0x88,
+	0x85,
+	0x02,
+	0xa9,
+	0x22,
+	0x85,
+	0x03,
+	0xa9,
+	0xf1,
+	0x85,
+	0x04,
+	0xa9,
+	0x24,
+	0x85,
+	0x05,
+	0xa9,
+	0xe8,
+	0x85,
+	0x06,
+	0xa9,
+	0x22,
+	0x85,
+	0x07,
+	0xa9,
+	0x5b,
+	0x85,
+	0x08,
+	0xa9,
+	0x23,
+	0x85,
+	0x09,
+	0xa0,
+	0x0e,
+	0x13,
+	0x10,
+	0x00,
+	0xa5,
+	0x02,
+	0x9c,
+	0xbb,
+	0x02,
+	0x9c,
+	0xbc,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0xb3,
+	0x02,
+	0xa9,
+	0x02,
+	0x8d,
+	0xb4,
+	0x02,
+	0x8d,
+	0xb5,
+	0x02,
+	0xa0,
+	0x02,
+	0x53,
+	0xa2,
+	0x3c,
+	0xb6,
+	0x02,
+	0x53,
+	0xa4,
+	0x3c,
+	0xb8,
+	0x02,
+	0x13,
+	0x10,
+	0x00,
+	0x58,
+	0x2c,
+	0x13,
+	0x10,
+	0x00,
+	0xbb,
+	0x2c,
+	0x13,
+	0x10,
+	0x00,
+	0x71,
+	0x00,
+	0xa0,
+	0x02,
+	0x13,
+	0x10,
+	0x00,
+	0xac,
+	0x2c,
+	0x13,
+	0x10,
+	0x00,
+	0x0f,
+	0x2d,
+	0x13,
+	0x10,
+	0x00,
+	0xc5,
+	0x00,
+	0x9c,
+	0xba,
+	0x02,
+	0xa9,
+	0x03,
+	0x8d,
+	0xae,
+	0x2c,
+	0x8d,
+	0x11,
+	0x2d,
+	0x64,
+	0xc7,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0x60,
+	0x9c,
+	0xe9,
+	0x27,
+	0x58,
+	0x8d,
+	0x14,
+	0x68,
+	0x4c,
+	0x7c,
+	0x03,
+	0xf0,
+	0x30,
+	0xad,
+	0xb4,
+	0x2b,
+	0xaa,
+	0x29,
+	0x03,
+	0x85,
+	0x7b,
+	0xd0,
+	0x0a,
+	0xa9,
+	0x01,
+	0x85,
+	0x75,
+	0x85,
+	0x76,
+	0x85,
+	0x77,
+	0x80,
+	0x16,
+	0x8a,
+	0x4a,
+	0x4a,
+	0xaa,
+	0x29,
+	0x01,
+	0x85,
+	0x75,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x29,
+	0x01,
+	0x85,
+	0x76,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x29,
+	0x01,
+	0x85,
+	0x77,
+	0x20,
+	0xd6,
+	0x0c,
+	0xf0,
+	0x01,
+	0x60,
+	0xad,
+	0xfb,
+	0x2b,
+	0xd0,
+	0x02,
+	0xa9,
+	0x11,
+	0x85,
+	0xc6,
+	0xcd,
+	0xbb,
+	0x02,
+	0xf0,
+	0x12,
+	0x29,
+	0xf0,
+	0xf0,
+	0x08,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x85,
+	0xc5,
+	0x80,
+	0x0e,
+	0xa9,
+	0x10,
+	0x85,
+	0xc5,
+	0x80,
+	0x08,
+	0xad,
+	0xbc,
+	0x02,
+	0x85,
+	0xc5,
+	0x20,
+	0x3f,
+	0x18,
+	0xad,
+	0xfa,
+	0x2b,
+	0x85,
+	0x81,
+	0xa0,
+	0x02,
+	0x53,
+	0xc7,
+	0x2b,
+	0xcf,
+	0x00,
+	0x53,
+	0xcd,
+	0x2b,
+	0xdb,
+	0x00,
+	0x20,
+	0x0c,
+	0x12,
+	0xf0,
+	0x01,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x2d,
+	0x00,
+	0x6d,
+	0x00,
+	0xa5,
+	0x6e,
+	0xcd,
+	0xf6,
+	0x3f,
+	0x90,
+	0x09,
+	0xd0,
+	0x0f,
+	0xa5,
+	0x6d,
+	0xcd,
+	0xf5,
+	0x3f,
+	0xb0,
+	0x08,
+	0xad,
+	0xf4,
+	0x2b,
+	0xae,
+	0xf7,
+	0x2b,
+	0x80,
+	0x1e,
+	0xa5,
+	0x6e,
+	0xcd,
+	0xf8,
+	0x3f,
+	0x90,
+	0x09,
+	0xd0,
+	0x0f,
+	0xa5,
+	0x6d,
+	0xcd,
+	0xf7,
+	0x3f,
+	0xb0,
+	0x08,
+	0xad,
+	0xf5,
+	0x2b,
+	0xae,
+	0xf8,
+	0x2b,
+	0x80,
+	0x06,
+	0xad,
+	0xf6,
+	0x2b,
+	0xae,
+	0xf9,
+	0x2b,
+	0x85,
+	0x84,
+	0x86,
+	0x86,
+	0xad,
+	0xf3,
+	0x2b,
+	0x85,
+	0x85,
+	0xa5,
+	0x7c,
+	0xd0,
+	0x4e,
+	0xa5,
+	0x7b,
+	0xc9,
+	0x02,
+	0xd0,
+	0x48,
+	0xad,
+	0xb1,
+	0x02,
+	0xc5,
+	0x85,
+	0x90,
+	0x11,
+	0x38,
+	0xe5,
+	0x85,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0x85,
+	0x80,
+	0x16,
+	0xa5,
+	0x85,
+	0x38,
+	0xed,
+	0xb1,
+	0x02,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xcb,
+	0x38,
+	0xa5,
+	0x85,
+	0xe5,
+	0xcb,
+	0x85,
+	0x85,
+	0xad,
+	0xb0,
+	0x02,
+	0xc5,
+	0x84,
+	0x90,
+	0x13,
+	0x38,
+	0xe5,
+	0x84,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0x84,
+	0x80,
+	0x18,
+	0x80,
+	0x48,
+	0xa5,
+	0x84,
+	0x38,
+	0xed,
+	0xb0,
+	0x02,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xcb,
+	0x38,
+	0xa5,
+	0x84,
+	0xe5,
+	0xcb,
+	0x85,
+	0x84,
+	0xad,
+	0xb2,
+	0x02,
+	0xc5,
+	0x86,
+	0x90,
+	0x11,
+	0x38,
+	0xe5,
+	0x86,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0x86,
+	0x80,
+	0x16,
+	0xa5,
+	0x86,
+	0x38,
+	0xed,
+	0xb2,
+	0x02,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xcb,
+	0x38,
+	0xa5,
+	0x86,
+	0xe5,
+	0xcb,
+	0x85,
+	0x86,
+	0xa0,
+	0x02,
+	0xad,
+	0x0b,
+	0x3c,
+	0xd0,
+	0x07,
+	0x53,
+	0xc7,
+	0x2b,
+	0xcf,
+	0x00,
+	0x80,
+	0x05,
+	0x53,
+	0xcb,
+	0x2b,
+	0xcf,
+	0x00,
+	0x53,
+	0xd1,
+	0x2b,
+	0xdb,
+	0x00,
+	0x20,
+	0x0c,
+	0x12,
+	0xf0,
+	0x01,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x2d,
+	0x00,
+	0x2b,
+	0x00,
+	0x18,
+	0xad,
+	0xd7,
+	0x2b,
+	0x69,
+	0x02,
+	0xb0,
+	0x10,
+	0x4a,
+	0x4a,
+	0xc9,
+	0x08,
+	0x90,
+	0x06,
+	0xc9,
+	0x40,
+	0xb0,
+	0x06,
+	0x80,
+	0x06,
+	0xa9,
+	0x08,
+	0x80,
+	0x02,
+	0xa9,
+	0x3f,
+	0x85,
+	0x88,
+	0x18,
+	0xad,
+	0xd8,
+	0x2b,
+	0x69,
+	0x02,
+	0xb0,
+	0x10,
+	0x4a,
+	0x4a,
+	0xc9,
+	0x08,
+	0x90,
+	0x06,
+	0xc9,
+	0x40,
+	0xb0,
+	0x06,
+	0x80,
+	0x06,
+	0xa9,
+	0x08,
+	0x80,
+	0x02,
+	0xa9,
+	0x3f,
+	0x85,
+	0x89,
+	0xa4,
+	0x88,
+	0xb9,
+	0x93,
+	0x27,
+	0x85,
+	0x8a,
+	0x45,
+	0x89,
+	0x20,
+	0x6e,
+	0x21,
+	0x85,
+	0x30,
+	0xa4,
+	0x89,
+	0xb9,
+	0x93,
+	0x27,
+	0x85,
+	0x8b,
+	0x45,
+	0x88,
+	0x20,
+	0x6e,
+	0x21,
+	0x85,
+	0x2f,
+	0xa0,
+	0x02,
+	0xad,
+	0xda,
+	0x2b,
+	0xd0,
+	0x0c,
+	0xad,
+	0xd9,
+	0x2b,
+	0xd0,
+	0x07,
+	0x53,
+	0xb6,
+	0x02,
+	0xcf,
+	0x00,
+	0x80,
+	0x05,
+	0x53,
+	0xd9,
+	0x2b,
+	0xcf,
+	0x00,
+	0x20,
+	0x7f,
+	0x0c,
+	0x85,
+	0x82,
+	0xa0,
+	0x02,
+	0xad,
+	0xdc,
+	0x2b,
+	0xd0,
+	0x0c,
+	0xad,
+	0xdb,
+	0x2b,
+	0xd0,
+	0x07,
+	0x53,
+	0xb8,
+	0x02,
+	0xcf,
+	0x00,
+	0x80,
+	0x05,
+	0x53,
+	0xdb,
+	0x2b,
+	0xcf,
+	0x00,
+	0x20,
+	0x7f,
+	0x0c,
+	0x85,
+	0x83,
+	0xa5,
+	0x76,
+	0xf0,
+	0x04,
+	0x64,
+	0x8e,
+	0x80,
+	0x10,
+	0xa5,
+	0x83,
+	0xc9,
+	0x02,
+	0xb0,
+	0x05,
+	0xad,
+	0xa6,
+	0x3c,
+	0x80,
+	0x03,
+	0xad,
+	0xa7,
+	0x3c,
+	0x85,
+	0x8e,
+	0xad,
+	0xa9,
+	0x3c,
+	0x49,
+	0x10,
+	0x84,
+	0xd0,
+	0x85,
+	0xcf,
+	0xa5,
+	0x89,
+	0x85,
+	0xd1,
+	0x64,
+	0xd2,
+	0x20,
+	0x16,
+	0x27,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x06,
+	0xa5,
+	0xcf,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0x85,
+	0x8f,
+	0xad,
+	0xa8,
+	0x3c,
+	0x45,
+	0x88,
+	0x84,
+	0xd0,
+	0x85,
+	0xcf,
+	0xa5,
+	0x89,
+	0x85,
+	0xd1,
+	0x64,
+	0xd2,
+	0x20,
+	0x16,
+	0x27,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x06,
+	0xa5,
+	0xcf,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0x85,
+	0x90,
+	0xa9,
+	0x00,
+	0xa6,
+	0x82,
+	0xe0,
+	0x02,
+	0xb0,
+	0x08,
+	0xa9,
+	0x01,
+	0xe4,
+	0x83,
+	0xf0,
+	0x02,
+	0xa9,
+	0x02,
+	0x85,
+	0x91,
+	0xa0,
+	0x00,
+	0xa5,
+	0x6e,
+	0xd9,
+	0xb9,
+	0x3c,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xd9,
+	0xb8,
+	0x3c,
+	0x90,
+	0x08,
+	0xc8,
+	0xc8,
+	0xc0,
+	0x06,
+	0xf0,
+	0x02,
+	0x80,
+	0xe8,
+	0x98,
+	0x4a,
+	0x49,
+	0x03,
+	0xa8,
+	0xb9,
+	0xbe,
+	0x3c,
+	0x85,
+	0x92,
+	0xb9,
+	0xbf,
+	0x3c,
+	0x85,
+	0x93,
+	0xb9,
+	0xc0,
+	0x3c,
+	0x85,
+	0x94,
+	0xa5,
+	0x82,
+	0x4a,
+	0xaa,
+	0xbd,
+	0xf7,
+	0x3c,
+	0x85,
+	0x95,
+	0x29,
+	0x01,
+	0xf0,
+	0x1e,
+	0xa0,
+	0x02,
+	0xad,
+	0x0b,
+	0x3c,
+	0xd0,
+	0x07,
+	0x53,
+	0xc7,
+	0x2b,
+	0xcf,
+	0x00,
+	0x80,
+	0x05,
+	0x53,
+	0xc9,
+	0x2b,
+	0xcf,
+	0x00,
+	0x53,
+	0xcf,
+	0x2b,
+	0xdb,
+	0x00,
+	0x20,
+	0x0c,
+	0x12,
+	0xf0,
+	0x01,
+	0x60,
+	0xa5,
+	0x2d,
+	0x49,
+	0x10,
+	0x85,
+	0xd3,
+	0x84,
+	0xd4,
+	0xa5,
+	0x2e,
+	0x49,
+	0x10,
+	0x05,
+	0xd4,
+	0x85,
+	0xd4,
+	0x84,
+	0xd5,
+	0x64,
+	0xd6,
+	0xa0,
+	0x02,
+	0x53,
+	0x6d,
+	0x00,
+	0xcf,
+	0x00,
+	0x20,
+	0x81,
+	0x21,
+	0xa5,
+	0xd5,
+	0xd0,
+	0x0e,
+	0xa5,
+	0xd4,
+	0xd0,
+	0x0a,
+	0xa4,
+	0xd3,
+	0xc0,
+	0x08,
+	0x90,
+	0x08,
+	0xc0,
+	0x3f,
+	0x90,
+	0x06,
+	0xa0,
+	0x3f,
+	0x80,
+	0x02,
+	0xa0,
+	0x08,
+	0xb9,
+	0x93,
+	0x27,
+	0x85,
+	0x96,
+	0xa5,
+	0x83,
+	0xc9,
+	0x02,
+	0x90,
+	0x05,
+	0x20,
+	0xf8,
+	0x12,
+	0x80,
+	0x19,
+	0xad,
+	0xf6,
+	0x3c,
+	0x85,
+	0x99,
+	0xad,
+	0xf5,
+	0x3c,
+	0x45,
+	0x88,
+	0x20,
+	0x52,
+	0x21,
+	0x85,
+	0x97,
+	0xad,
+	0xf4,
+	0x3c,
+	0x45,
+	0x89,
+	0x20,
+	0x52,
+	0x21,
+	0x85,
+	0x98,
+	0x20,
+	0xd1,
+	0x13,
+	0x20,
+	0x17,
+	0x14,
+	0xa5,
+	0x86,
+	0xaa,
+	0x20,
+	0x6e,
+	0x14,
+	0x85,
+	0xcc,
+	0x8a,
+	0x20,
+	0x88,
+	0x14,
+	0x85,
+	0xcd,
+	0xa5,
+	0x32,
+	0x0a,
+	0x45,
+	0xcc,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x85,
+	0x9a,
+	0xa5,
+	0x33,
+	0x0a,
+	0x45,
+	0xcc,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x85,
+	0x9b,
+	0xa5,
+	0x36,
+	0x0a,
+	0x45,
+	0xcd,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0xa8,
+	0xb9,
+	0x53,
+	0x27,
+	0xaa,
+	0x29,
+	0x0f,
+	0x85,
+	0xa1,
+	0x8a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x85,
+	0xa0,
+	0xa5,
+	0x31,
+	0x85,
+	0xa2,
+	0xa5,
+	0x77,
+	0xf0,
+	0x08,
+	0x64,
+	0x9c,
+	0x64,
+	0x9d,
+	0xa9,
+	0x3f,
+	0x80,
+	0x5f,
+	0xa5,
+	0x34,
+	0x0a,
+	0x45,
+	0xcc,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x0a,
+	0x45,
+	0x84,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x85,
+	0x9c,
+	0xa5,
+	0x35,
+	0x0a,
+	0x45,
+	0xcc,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x0a,
+	0x45,
+	0x84,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x85,
+	0x9d,
+	0xa5,
+	0x84,
+	0x20,
+	0x9b,
+	0x14,
+	0x85,
+	0xce,
+	0xa5,
+	0x36,
+	0x0a,
+	0x45,
+	0xcd,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0x0a,
+	0x45,
+	0xce,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0xa8,
+	0xb9,
+	0x53,
+	0x27,
+	0xaa,
+	0x29,
+	0x0f,
+	0x85,
+	0x9f,
+	0x8a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x85,
+	0x9e,
+	0xa5,
+	0x78,
+	0xc9,
+	0x02,
+	0xb0,
+	0x04,
+	0xa2,
+	0x00,
+	0x80,
+	0x02,
+	0xa2,
+	0x36,
+	0x86,
+	0xcb,
+	0xbd,
+	0x88,
+	0x3f,
+	0x85,
+	0xa4,
+	0xa2,
+	0x00,
+	0x18,
+	0x8a,
+	0x65,
+	0xcb,
+	0xa8,
+	0xa5,
+	0x6e,
+	0xd9,
+	0x8a,
+	0x3f,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xd9,
+	0x89,
+	0x3f,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x08,
+	0xf0,
+	0x02,
+	0x80,
+	0xe3,
+	0x8a,
+	0x4a,
+	0x49,
+	0x09,
+	0x18,
+	0x65,
+	0xcb,
+	0xaa,
+	0xbd,
+	0x91,
+	0x3f,
+	0x85,
+	0xa5,
+	0xbd,
+	0x92,
+	0x3f,
+	0x85,
+	0xa6,
+	0xbd,
+	0x93,
+	0x3f,
+	0x85,
+	0xa7,
+	0xbd,
+	0x94,
+	0x3f,
+	0x85,
+	0xa8,
+	0xbd,
+	0x98,
+	0x3f,
+	0x85,
+	0xac,
+	0xbd,
+	0x99,
+	0x3f,
+	0x85,
+	0xad,
+	0xbd,
+	0x95,
+	0x3f,
+	0x85,
+	0xa9,
+	0xbd,
+	0x96,
+	0x3f,
+	0x85,
+	0xaa,
+	0xbd,
+	0x97,
+	0x3f,
+	0x85,
+	0xab,
+	0xa5,
+	0x77,
+	0xf0,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x72,
+	0xa5,
+	0x84,
+	0x30,
+	0x0f,
+	0x85,
+	0xcb,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0xcb,
+	0x85,
+	0xcb,
+	0xa9,
+	0x20,
+	0x85,
+	0xcc,
+	0x80,
+	0x06,
+	0x29,
+	0x7f,
+	0x85,
+	0xcb,
+	0x64,
+	0xcc,
+	0x38,
+	0xa5,
+	0xcc,
+	0xe5,
+	0xa9,
+	0x85,
+	0xcd,
+	0x3c,
+	0x45,
+	0xcb,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x10,
+	0x05,
+	0x98,
+	0x18,
+	0x65,
+	0xcd,
+	0xa8,
+	0x8a,
+	0x0a,
+	0x98,
+	0x2a,
+	0x18,
+	0x65,
+	0xa9,
+	0x85,
+	0xa9,
+	0x38,
+	0xa5,
+	0xcc,
+	0xe5,
+	0xaa,
+	0x85,
+	0xcd,
+	0x3c,
+	0x45,
+	0xcb,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x10,
+	0x05,
+	0x98,
+	0x18,
+	0x65,
+	0xcd,
+	0xa8,
+	0x8a,
+	0x0a,
+	0x98,
+	0x2a,
+	0x18,
+	0x65,
+	0xaa,
+	0x85,
+	0xaa,
+	0x38,
+	0xa5,
+	0xcc,
+	0xe5,
+	0xab,
+	0x85,
+	0xcd,
+	0x3c,
+	0x45,
+	0xcb,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x10,
+	0x05,
+	0x98,
+	0x18,
+	0x65,
+	0xcd,
+	0xa8,
+	0x8a,
+	0x0a,
+	0x98,
+	0x2a,
+	0x18,
+	0x65,
+	0xab,
+	0x85,
+	0xab,
+	0xa9,
+	0x01,
+	0x85,
+	0xa3,
+	0xa5,
+	0x88,
+	0x85,
+	0xcb,
+	0x4a,
+	0x85,
+	0xcf,
+	0xa9,
+	0x08,
+	0x85,
+	0xd0,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x04,
+	0xa5,
+	0xcf,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xb3,
+	0xa5,
+	0x89,
+	0x85,
+	0xcb,
+	0x4a,
+	0x85,
+	0xcf,
+	0xa9,
+	0x08,
+	0x85,
+	0xd0,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x04,
+	0xa5,
+	0xcf,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xb2,
+	0xa5,
+	0x88,
+	0x85,
+	0xcb,
+	0x4a,
+	0x18,
+	0x69,
+	0xf0,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x69,
+	0x3d,
+	0x85,
+	0xd0,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xc9,
+	0x03,
+	0x90,
+	0x10,
+	0xd0,
+	0x06,
+	0xa5,
+	0xcf,
+	0xc9,
+	0xdf,
+	0x90,
+	0x08,
+	0xa9,
+	0xdf,
+	0x85,
+	0xcf,
+	0xa9,
+	0x03,
+	0x85,
+	0xd0,
+	0x18,
+	0xa9,
+	0x20,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x46,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x6a,
+	0x85,
+	0xb0,
+	0xa5,
+	0x89,
+	0x85,
+	0xcb,
+	0x4a,
+	0x18,
+	0x69,
+	0xf0,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x69,
+	0x3d,
+	0x85,
+	0xd0,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xc9,
+	0x03,
+	0x90,
+	0x10,
+	0xd0,
+	0x06,
+	0xa5,
+	0xcf,
+	0xc9,
+	0xdf,
+	0x90,
+	0x08,
+	0xa9,
+	0xdf,
+	0x85,
+	0xcf,
+	0xa9,
+	0x03,
+	0x85,
+	0xd0,
+	0x18,
+	0xa9,
+	0x20,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x46,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x6a,
+	0x85,
+	0xae,
+	0x64,
+	0xb1,
+	0x64,
+	0xcb,
+	0xa5,
+	0x88,
+	0xc9,
+	0x10,
+	0xb0,
+	0x06,
+	0x85,
+	0xcb,
+	0xa9,
+	0x01,
+	0x85,
+	0xb1,
+	0xa5,
+	0x89,
+	0xc9,
+	0x10,
+	0xb0,
+	0x10,
+	0xa5,
+	0xb1,
+	0x09,
+	0x02,
+	0x85,
+	0xb1,
+	0xa5,
+	0x89,
+	0xc5,
+	0xcb,
+	0x90,
+	0x08,
+	0x85,
+	0xcb,
+	0x80,
+	0x04,
+	0xa5,
+	0xb1,
+	0xf0,
+	0x45,
+	0xa5,
+	0xcb,
+	0x49,
+	0xdf,
+	0x85,
+	0xcf,
+	0x84,
+	0xd0,
+	0xa5,
+	0xcb,
+	0x49,
+	0x03,
+	0x18,
+	0x65,
+	0xd0,
+	0x85,
+	0xd0,
+	0x18,
+	0xa9,
+	0x08,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x49,
+	0x10,
+	0x84,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x49,
+	0x10,
+	0x18,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x84,
+	0xd0,
+	0x18,
+	0xa9,
+	0x20,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x46,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x6a,
+	0x85,
+	0xaf,
+	0x80,
+	0x02,
+	0x64,
+	0xaf,
+	0xa5,
+	0x82,
+	0x49,
+	0x03,
+	0xaa,
+	0xbd,
+	0x58,
+	0x3f,
+	0x85,
+	0xb6,
+	0xbd,
+	0x59,
+	0x3f,
+	0x85,
+	0xb5,
+	0xbd,
+	0x5a,
+	0x3f,
+	0x85,
+	0xb4,
+	0xa5,
+	0x83,
+	0x49,
+	0x03,
+	0xa8,
+	0xb9,
+	0x64,
+	0x3f,
+	0x85,
+	0xb9,
+	0xb9,
+	0x65,
+	0x3f,
+	0x85,
+	0xb8,
+	0xb9,
+	0x66,
+	0x3f,
+	0x85,
+	0xb7,
+	0xa5,
+	0x77,
+	0xf0,
+	0x06,
+	0x64,
+	0xba,
+	0x64,
+	0xbb,
+	0x80,
+	0x5a,
+	0x20,
+	0xe6,
+	0x14,
+	0xa5,
+	0x84,
+	0x30,
+	0x0f,
+	0x85,
+	0xcb,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0xcb,
+	0x85,
+	0xcb,
+	0x64,
+	0xcc,
+	0x64,
+	0xcd,
+	0x80,
+	0x0a,
+	0x29,
+	0x7f,
+	0x85,
+	0xcb,
+	0x64,
+	0xcc,
+	0xa9,
+	0x39,
+	0x85,
+	0xcd,
+	0x38,
+	0xa5,
+	0xcc,
+	0xe5,
+	0xba,
+	0x85,
+	0xcc,
+	0x3c,
+	0x45,
+	0xcb,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x10,
+	0x05,
+	0x98,
+	0x18,
+	0x65,
+	0xcc,
+	0xa8,
+	0x8a,
+	0x0a,
+	0x98,
+	0x2a,
+	0x18,
+	0x65,
+	0xba,
+	0x85,
+	0xba,
+	0x38,
+	0xa5,
+	0xcd,
+	0xe5,
+	0xbb,
+	0x85,
+	0xcd,
+	0x3c,
+	0x45,
+	0xcb,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x10,
+	0x05,
+	0x98,
+	0x18,
+	0x65,
+	0xcd,
+	0xa8,
+	0x8a,
+	0x0a,
+	0x98,
+	0x2a,
+	0x18,
+	0x65,
+	0xbb,
+	0x85,
+	0xbb,
+	0xa5,
+	0x75,
+	0xf0,
+	0x0c,
+	0xa0,
+	0x92,
+	0x9c,
+	0x18,
+	0x29,
+	0x13,
+	0x18,
+	0x29,
+	0x19,
+	0x29,
+	0x80,
+	0x3d,
+	0xa5,
+	0x79,
+	0xc9,
+	0x02,
+	0xb0,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x02,
+	0xa9,
+	0xf0,
+	0x85,
+	0xd9,
+	0xad,
+	0x77,
+	0x3d,
+	0x1a,
+	0x49,
+	0x15,
+	0x85,
+	0xcd,
+	0xa5,
+	0x83,
+	0x20,
+	0xb1,
+	0x15,
+	0xa9,
+	0x18,
+	0x85,
+	0xd1,
+	0xa9,
+	0x29,
+	0x85,
+	0xd2,
+	0xa9,
+	0x00,
+	0x20,
+	0xe9,
+	0x15,
+	0xa5,
+	0x82,
+	0x20,
+	0xcc,
+	0x15,
+	0xa9,
+	0x24,
+	0x85,
+	0xd1,
+	0xa9,
+	0x29,
+	0x85,
+	0xd2,
+	0xa9,
+	0x01,
+	0x20,
+	0xe9,
+	0x15,
+	0x20,
+	0xc9,
+	0x16,
+	0xad,
+	0x53,
+	0x3c,
+	0x85,
+	0xbf,
+	0x85,
+	0xcd,
+	0xa5,
+	0xc5,
+	0x29,
+	0xf0,
+	0xf0,
+	0x08,
+	0x64,
+	0xbe,
+	0x64,
+	0xc0,
+	0xa5,
+	0xc6,
+	0x80,
+	0x12,
+	0xa5,
+	0xcd,
+	0xa6,
+	0x88,
+	0x20,
+	0xee,
+	0x16,
+	0x85,
+	0xbe,
+	0xa5,
+	0xcd,
+	0xa6,
+	0x89,
+	0x20,
+	0xee,
+	0x16,
+	0x85,
+	0xc0,
+	0x20,
+	0x22,
+	0x17,
+	0xa4,
+	0x79,
+	0xb9,
+	0x59,
+	0x3c,
+	0x85,
+	0xc3,
+	0xa5,
+	0x7b,
+	0xc9,
+	0x00,
+	0xf0,
+	0x04,
+	0xa5,
+	0x7a,
+	0xd0,
+	0x04,
+	0xa9,
+	0x02,
+	0x85,
+	0x7f,
+	0xa9,
+	0x00,
+	0x60,
+	0xad,
+	0xb5,
+	0x2b,
+	0x29,
+	0xfc,
+	0xf0,
+	0x03,
+	0xa9,
+	0x1d,
+	0x60,
+	0xae,
+	0xce,
+	0x2b,
+	0xad,
+	0xcd,
+	0x2b,
+	0x20,
+	0x3f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x22,
+	0x60,
+	0xae,
+	0xd0,
+	0x2b,
+	0xad,
+	0xcf,
+	0x2b,
+	0x20,
+	0x3f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x23,
+	0x60,
+	0xae,
+	0xd2,
+	0x2b,
+	0xad,
+	0xd1,
+	0x2b,
+	0x20,
+	0x3f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x24,
+	0x60,
+	0xae,
+	0xc8,
+	0x2b,
+	0xad,
+	0xc7,
+	0x2b,
+	0x20,
+	0x5f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x1f,
+	0x60,
+	0xae,
+	0xca,
+	0x2b,
+	0xad,
+	0xc9,
+	0x2b,
+	0x20,
+	0x5f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x20,
+	0x60,
+	0xae,
+	0xcc,
+	0x2b,
+	0xad,
+	0xcb,
+	0x2b,
+	0x20,
+	0x5f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x21,
+	0x60,
+	0xae,
+	0xdd,
+	0x2b,
+	0xa9,
+	0x08,
+	0x20,
+	0x30,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x25,
+	0x60,
+	0xad,
+	0xd7,
+	0x2b,
+	0xc9,
+	0x10,
+	0xb0,
+	0x03,
+	0xa9,
+	0x26,
+	0x60,
+	0xad,
+	0xd8,
+	0x2b,
+	0xc9,
+	0x10,
+	0xb0,
+	0x03,
+	0xa9,
+	0x27,
+	0x60,
+	0xad,
+	0xde,
+	0x2b,
+	0xc9,
+	0x06,
+	0x90,
+	0x03,
+	0xa9,
+	0x29,
+	0x60,
+	0xf0,
+	0x54,
+	0x49,
+	0x04,
+	0x85,
+	0xcb,
+	0xa2,
+	0x00,
+	0xbd,
+	0xdf,
+	0x2b,
+	0xcd,
+	0x0c,
+	0x3c,
+	0x90,
+	0x03,
+	0xa9,
+	0x2a,
+	0x60,
+	0xbd,
+	0xe0,
+	0x2b,
+	0xcd,
+	0x0d,
+	0x3c,
+	0x90,
+	0x03,
+	0xa9,
+	0x2b,
+	0x60,
+	0xbd,
+	0xe1,
+	0x2b,
+	0xcd,
+	0x0c,
+	0x3c,
+	0x90,
+	0x03,
+	0xa9,
+	0x2c,
+	0x60,
+	0xbd,
+	0xe2,
+	0x2b,
+	0xcd,
+	0x0d,
+	0x3c,
+	0x90,
+	0x03,
+	0xa9,
+	0x2d,
+	0x60,
+	0xbd,
+	0xe1,
+	0x2b,
+	0xdd,
+	0xdf,
+	0x2b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x2e,
+	0x60,
+	0xbd,
+	0xe2,
+	0x2b,
+	0xdd,
+	0xe0,
+	0x2b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x2f,
+	0x60,
+	0x18,
+	0x8a,
+	0x69,
+	0x04,
+	0xc5,
+	0xcb,
+	0xb0,
+	0x04,
+	0xaa,
+	0x4c,
+	0xc9,
+	0x0b,
+	0xa9,
+	0x00,
+	0x60,
+	0xc9,
+	0x01,
+	0xf0,
+	0x0f,
+	0xc9,
+	0x03,
+	0xf0,
+	0x0b,
+	0xc9,
+	0x05,
+	0xf0,
+	0x07,
+	0xc9,
+	0x07,
+	0xf0,
+	0x03,
+	0xa9,
+	0x01,
+	0x60,
+	0xa9,
+	0x00,
+	0x60,
+	0x86,
+	0xcb,
+	0xc5,
+	0xcb,
+	0xf0,
+	0x06,
+	0x4a,
+	0xd0,
+	0xf9,
+	0xa9,
+	0x01,
+	0x60,
+	0xa9,
+	0x00,
+	0x60,
+	0xec,
+	0xda,
+	0x3b,
+	0x90,
+	0x09,
+	0xd0,
+	0x13,
+	0xcd,
+	0xd9,
+	0x3b,
+	0xf0,
+	0x02,
+	0xb0,
+	0x0c,
+	0xec,
+	0xd8,
+	0x3b,
+	0x90,
+	0x07,
+	0xd0,
+	0x08,
+	0xcd,
+	0xd7,
+	0x3b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x01,
+	0x60,
+	0xa9,
+	0x00,
+	0x60,
+	0xec,
+	0xe2,
+	0x3b,
+	0x90,
+	0x09,
+	0xd0,
+	0x13,
+	0xcd,
+	0xe1,
+	0x3b,
+	0xf0,
+	0x02,
+	0xb0,
+	0x0c,
+	0xec,
+	0xe0,
+	0x3b,
+	0x90,
+	0x07,
+	0xd0,
+	0x08,
+	0xcd,
+	0xdf,
+	0x3b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x01,
+	0x60,
+	0xa9,
+	0x00,
+	0x60,
+	0xa0,
+	0x00,
+	0x18,
+	0xb9,
+	0x94,
+	0x3c,
+	0x79,
+	0x96,
+	0x3c,
+	0x85,
+	0xd1,
+	0xb9,
+	0x95,
+	0x3c,
+	0x79,
+	0x97,
+	0x3c,
+	0x6a,
+	0x85,
+	0xd2,
+	0x66,
+	0xd1,
+	0xa5,
+	0xd0,
+	0xc5,
+	0xd2,
+	0x90,
+	0x10,
+	0xd0,
+	0x06,
+	0xa5,
+	0xcf,
+	0xc5,
+	0xd1,
+	0x90,
+	0x08,
+	0xc8,
+	0xc8,
+	0xc0,
+	0x06,
+	0xf0,
+	0x02,
+	0x80,
+	0xd6,
+	0x98,
+	0x4a,
+	0x60,
+	0xc9,
+	0x00,
+	0xf0,
+	0x1d,
+	0xc9,
+	0x01,
+	0xf0,
+	0x12,
+	0xc9,
+	0x02,
+	0xf0,
+	0x07,
+	0xad,
+	0x9a,
+	0x3c,
+	0xae,
+	0x9b,
+	0x3c,
+	0x60,
+	0xad,
+	0x98,
+	0x3c,
+	0xae,
+	0x99,
+	0x3c,
+	0x60,
+	0xad,
+	0x96,
+	0x3c,
+	0xae,
+	0x97,
+	0x3c,
+	0x60,
+	0xad,
+	0x94,
+	0x3c,
+	0xae,
+	0x95,
+	0x3c,
+	0x60,
+	0x64,
+	0x71,
+	0x64,
+	0x72,
+	0xad,
+	0x0c,
+	0x3c,
+	0x85,
+	0x73,
+	0xad,
+	0x0d,
+	0x3c,
+	0x85,
+	0x74,
+	0xa9,
+	0x01,
+	0x85,
+	0x7a,
+	0x85,
+	0x7d,
+	0x85,
+	0x7e,
+	0x38,
+	0xad,
+	0xba,
+	0x2b,
+	0xed,
+	0xe3,
+	0x3b,
+	0xad,
+	0xbb,
+	0x2b,
+	0xed,
+	0xe4,
+	0x3b,
+	0x90,
+	0x03,
+	0xa9,
+	0x09,
+	0x60,
+	0xad,
+	0xc1,
+	0x2b,
+	0xd0,
+	0x10,
+	0xad,
+	0xc0,
+	0x2b,
+	0xaa,
+	0x4a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x13,
+	0x60,
+	0x8a,
+	0x20,
+	0x1a,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x11,
+	0x60,
+	0x8a,
+	0x1a,
+	0x4a,
+	0x85,
+	0x17,
+	0x64,
+	0xc2,
+	0xc9,
+	0x01,
+	0xf0,
+	0x02,
+	0xe6,
+	0xc2,
+	0x38,
+	0xad,
+	0xba,
+	0x2b,
+	0x6a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0d,
+	0x60,
+	0x2a,
+	0xed,
+	0xb6,
+	0x2b,
+	0xa8,
+	0x6a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0b,
+	0x60,
+	0x2a,
+	0xad,
+	0xbb,
+	0x2b,
+	0xed,
+	0xb7,
+	0x2b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0f,
+	0x60,
+	0xc8,
+	0xd0,
+	0x01,
+	0x1a,
+	0x84,
+	0x19,
+	0x85,
+	0x1a,
+	0xa5,
+	0x19,
+	0xa6,
+	0x1a,
+	0xa4,
+	0x17,
+	0x20,
+	0xb3,
+	0x0f,
+	0x48,
+	0xda,
+	0x1a,
+	0xd0,
+	0x01,
+	0xe8,
+	0x29,
+	0xfe,
+	0x85,
+	0x71,
+	0x86,
+	0x72,
+	0xa8,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x98,
+	0x6a,
+	0xd0,
+	0x01,
+	0xca,
+	0x3a,
+	0x85,
+	0x65,
+	0x86,
+	0x66,
+	0x68,
+	0x4a,
+	0x85,
+	0xd0,
+	0x68,
+	0x6a,
+	0x85,
+	0xcf,
+	0xad,
+	0x0c,
+	0x3c,
+	0x85,
+	0xcb,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xcf,
+	0x85,
+	0xd3,
+	0xc9,
+	0x14,
+	0xb0,
+	0x08,
+	0x46,
+	0x73,
+	0x06,
+	0x7d,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x07,
+	0xa5,
+	0xcf,
+	0xcd,
+	0xa0,
+	0x3c,
+	0xb0,
+	0x00,
+	0xad,
+	0xb4,
+	0x2b,
+	0xaa,
+	0xc9,
+	0x03,
+	0xd0,
+	0x03,
+	0xa9,
+	0x06,
+	0x60,
+	0x8a,
+	0x29,
+	0xe0,
+	0xd0,
+	0xf8,
+	0x8a,
+	0x29,
+	0x04,
+	0xf0,
+	0x02,
+	0x64,
+	0x7a,
+	0x38,
+	0xad,
+	0xbc,
+	0x2b,
+	0xed,
+	0xe5,
+	0x3b,
+	0xad,
+	0xbd,
+	0x2b,
+	0xed,
+	0xe6,
+	0x3b,
+	0x90,
+	0x03,
+	0xa9,
+	0x0a,
+	0x60,
+	0xad,
+	0xc5,
+	0x2b,
+	0xd0,
+	0x10,
+	0xad,
+	0xc4,
+	0x2b,
+	0xaa,
+	0x4a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x14,
+	0x60,
+	0x8a,
+	0x20,
+	0x1a,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x12,
+	0x60,
+	0x8a,
+	0x1a,
+	0x4a,
+	0x85,
+	0x18,
+	0x64,
+	0xc2,
+	0xc9,
+	0x01,
+	0xf0,
+	0x02,
+	0xe6,
+	0xc2,
+	0xad,
+	0xbc,
+	0x2b,
+	0x4a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0e,
+	0x60,
+	0x2a,
+	0x38,
+	0xed,
+	0xb8,
+	0x2b,
+	0xa8,
+	0x6a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0c,
+	0x60,
+	0x2a,
+	0xad,
+	0xbd,
+	0x2b,
+	0xed,
+	0xb9,
+	0x2b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x10,
+	0x60,
+	0xc8,
+	0xd0,
+	0x01,
+	0x1a,
+	0x84,
+	0x1b,
+	0x85,
+	0x1c,
+	0xa5,
+	0x1b,
+	0xa6,
+	0x1c,
+	0xa4,
+	0x18,
+	0x20,
+	0xb3,
+	0x0f,
+	0x48,
+	0xda,
+	0x1a,
+	0xd0,
+	0x01,
+	0xe8,
+	0xa8,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x98,
+	0x6a,
+	0xd0,
+	0x01,
+	0xca,
+	0x3a,
+	0x85,
+	0x67,
+	0x86,
+	0x68,
+	0x68,
+	0x4a,
+	0x85,
+	0xd0,
+	0x68,
+	0x6a,
+	0x85,
+	0xcf,
+	0xad,
+	0x0d,
+	0x3c,
+	0x85,
+	0xcb,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xcf,
+	0x85,
+	0xd4,
+	0xc9,
+	0x14,
+	0xb0,
+	0x08,
+	0x46,
+	0x74,
+	0x06,
+	0x7e,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x09,
+	0xa5,
+	0xcf,
+	0xcd,
+	0xa1,
+	0x3c,
+	0xb0,
+	0x02,
+	0x64,
+	0x7a,
+	0xa2,
+	0x00,
+	0xa5,
+	0x72,
+	0xcd,
+	0xa8,
+	0x02,
+	0xd0,
+	0x09,
+	0xa5,
+	0x71,
+	0xcd,
+	0xa7,
+	0x02,
+	0xd0,
+	0x02,
+	0x80,
+	0x01,
+	0xe8,
+	0x86,
+	0x7c,
+	0xa5,
+	0x18,
+	0xc5,
+	0x17,
+	0xb0,
+	0x02,
+	0xa5,
+	0x17,
+	0x85,
+	0x79,
+	0xc9,
+	0x03,
+	0x90,
+	0x0c,
+	0xa2,
+	0x01,
+	0x86,
+	0x75,
+	0xc9,
+	0x05,
+	0x90,
+	0x04,
+	0x86,
+	0x76,
+	0x86,
+	0x77,
+	0xad,
+	0x9f,
+	0x3c,
+	0xc5,
+	0x79,
+	0xb0,
+	0x02,
+	0x64,
+	0x7a,
+	0xa2,
+	0x01,
+	0xad,
+	0xc6,
+	0x2b,
+	0xf0,
+	0x21,
+	0xa8,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0xaa,
+	0xa9,
+	0x04,
+	0x20,
+	0x30,
+	0x0c,
+	0xd0,
+	0x0c,
+	0x98,
+	0x29,
+	0x0f,
+	0xdc,
+	0xaa,
+	0xa9,
+	0x04,
+	0x20,
+	0x30,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x1c,
+	0x60,
+	0xc4,
+	0xcb,
+	0xb0,
+	0x01,
+	0xfc,
+	0x86,
+	0x78,
+	0x64,
+	0x7f,
+	0x64,
+	0x69,
+	0x64,
+	0x6a,
+	0x64,
+	0x6b,
+	0x64,
+	0x6c,
+	0xad,
+	0xb5,
+	0x2b,
+	0x85,
+	0x87,
+	0xd8,
+	0x4d,
+	0x0e,
+	0x3c,
+	0xf8,
+	0x85,
+	0x80,
+	0x85,
+	0xc1,
+	0xad,
+	0xb5,
+	0x2b,
+	0x29,
+	0x01,
+	0xd0,
+	0x0a,
+	0x64,
+	0x1f,
+	0x64,
+	0x20,
+	0xa9,
+	0x01,
+	0x85,
+	0x22,
+	0x80,
+	0x0b,
+	0xa5,
+	0x73,
+	0x3a,
+	0x85,
+	0x1f,
+	0x85,
+	0x20,
+	0xa9,
+	0xff,
+	0x85,
+	0x22,
+	0xa0,
+	0x02,
+	0x53,
+	0x19,
+	0x00,
+	0x23,
+	0x00,
+	0x53,
+	0xb6,
+	0x2b,
+	0x25,
+	0x00,
+	0xa9,
+	0xef,
+	0x85,
+	0xdd,
+	0xa9,
+	0x3b,
+	0x85,
+	0xde,
+	0xa9,
+	0xe7,
+	0x85,
+	0xdf,
+	0xa9,
+	0x3b,
+	0x85,
+	0xe0,
+	0xa9,
+	0xd7,
+	0x85,
+	0xdb,
+	0xa9,
+	0x2a,
+	0x85,
+	0xdc,
+	0xa9,
+	0x9f,
+	0x85,
+	0x1d,
+	0xa9,
+	0x2a,
+	0x85,
+	0x1e,
+	0xa5,
+	0x73,
+	0x85,
+	0x27,
+	0xa5,
+	0x17,
+	0x85,
+	0x29,
+	0x20,
+	0x10,
+	0x10,
+	0x20,
+	0x38,
+	0x0b,
+	0xf0,
+	0x01,
+	0x60,
+	0xad,
+	0xde,
+	0x2b,
+	0x85,
+	0xc4,
+	0xf0,
+	0x12,
+	0xa5,
+	0x7d,
+	0x3a,
+	0x85,
+	0x28,
+	0xa9,
+	0xf3,
+	0x85,
+	0xdf,
+	0xa9,
+	0x2a,
+	0x85,
+	0xe0,
+	0xa9,
+	0x00,
+	0x20,
+	0xb3,
+	0x11,
+	0xad,
+	0xb5,
+	0x2b,
+	0x29,
+	0x02,
+	0xd0,
+	0x0a,
+	0x64,
+	0x1f,
+	0x64,
+	0x20,
+	0xa9,
+	0x01,
+	0x85,
+	0x22,
+	0x80,
+	0x0b,
+	0xa5,
+	0x74,
+	0x3a,
+	0x85,
+	0x1f,
+	0x85,
+	0x20,
+	0xa9,
+	0xff,
+	0x85,
+	0x22,
+	0xa0,
+	0x02,
+	0x53,
+	0x1b,
+	0x00,
+	0x23,
+	0x00,
+	0x53,
+	0xb8,
+	0x2b,
+	0x25,
+	0x00,
+	0xa9,
+	0xff,
+	0x85,
+	0xdd,
+	0xa9,
+	0x3b,
+	0x85,
+	0xde,
+	0xa9,
+	0xeb,
+	0x85,
+	0xdf,
+	0xa9,
+	0x3b,
+	0x85,
+	0xe0,
+	0xa9,
+	0xe7,
+	0x85,
+	0xdb,
+	0xa9,
+	0x2a,
+	0x85,
+	0xdc,
+	0xa9,
+	0xbf,
+	0x85,
+	0x1d,
+	0xa9,
+	0x2a,
+	0x85,
+	0x1e,
+	0xa5,
+	0x74,
+	0x85,
+	0x27,
+	0xa5,
+	0x18,
+	0x85,
+	0x29,
+	0x20,
+	0x10,
+	0x10,
+	0xa5,
+	0xc4,
+	0xf0,
+	0x12,
+	0xa5,
+	0x7e,
+	0x3a,
+	0x85,
+	0x28,
+	0xa9,
+	0x03,
+	0x85,
+	0xdf,
+	0xa9,
+	0x2b,
+	0x85,
+	0xe0,
+	0xa9,
+	0x01,
+	0x20,
+	0xb3,
+	0x11,
+	0xa9,
+	0x00,
+	0x60,
+	0x88,
+	0x84,
+	0xcb,
+	0xc8,
+	0x18,
+	0x65,
+	0xcb,
+	0x90,
+	0x01,
+	0xe8,
+	0x20,
+	0xc1,
+	0x0f,
+	0x60,
+	0xc0,
+	0x01,
+	0xd0,
+	0x01,
+	0x60,
+	0x85,
+	0xcb,
+	0x98,
+	0xc9,
+	0x01,
+	0xf0,
+	0x0e,
+	0x29,
+	0x01,
+	0xd0,
+	0x0d,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x66,
+	0xcb,
+	0x98,
+	0x4a,
+	0xa8,
+	0x80,
+	0xee,
+	0xa5,
+	0xcb,
+	0x60,
+	0xa5,
+	0xcb,
+	0x1a,
+	0xd0,
+	0x01,
+	0xe8,
+	0x49,
+	0x55,
+	0x84,
+	0xcd,
+	0x18,
+	0x65,
+	0xcd,
+	0x85,
+	0xcc,
+	0x90,
+	0x03,
+	0xe6,
+	0xcd,
+	0x18,
+	0x8a,
+	0x49,
+	0x55,
+	0x84,
+	0xce,
+	0xaa,
+	0x65,
+	0xcc,
+	0x8a,
+	0x65,
+	0xcd,
+	0x85,
+	0xcd,
+	0xa5,
+	0xce,
+	0x90,
+	0x03,
+	0xe6,
+	0xce,
+	0x18,
+	0x65,
+	0xcd,
+	0xa8,
+	0xa5,
+	0xce,
+	0x69,
+	0x00,
+	0xaa,
+	0x98,
+	0x60,
+	0xa5,
+	0x27,
+	0x85,
+	0xcb,
+	0x3a,
+	0x4a,
+	0x85,
+	0xce,
+	0x38,
+	0xe5,
+	0x27,
+	0x85,
+	0xce,
+	0xa0,
+	0x02,
+	0x53,
+	0x23,
+	0x00,
+	0xcf,
+	0x00,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x20,
+	0xbe,
+	0x20,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x18,
+	0xa9,
+	0x02,
+	0x65,
+	0xcf,
+	0x85,
+	0xd3,
+	0xa9,
+	0x00,
+	0x65,
+	0xd0,
+	0x85,
+	0xd4,
+	0xa0,
+	0x02,
+	0x53,
+	0xcf,
+	0x00,
+	0xbb,
+	0x29,
+	0x53,
+	0xd3,
+	0x00,
+	0xbd,
+	0x29,
+	0xa5,
+	0x27,
+	0x1a,
+	0x4a,
+	0x3a,
+	0x85,
+	0xcd,
+	0xa2,
+	0x00,
+	0xda,
+	0xe4,
+	0xcd,
+	0xd0,
+	0x02,
+	0xe6,
+	0xce,
+	0x18,
+	0xa5,
+	0xce,
+	0x65,
+	0xd1,
+	0x85,
+	0xce,
+	0x30,
+	0x09,
+	0x38,
+	0xe5,
+	0x27,
+	0x85,
+	0xce,
+	0xa9,
+	0x02,
+	0x80,
+	0x02,
+	0xa9,
+	0x00,
+	0xfa,
+	0x9d,
+	0xab,
+	0x29,
+	0xe8,
+	0xe4,
+	0x27,
+	0xf0,
+	0x03,
+	0xda,
+	0x80,
+	0xda,
+	0xa5,
+	0x29,
+	0x85,
+	0xcb,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x20,
+	0xbe,
+	0x20,
+	0xa0,
+	0x02,
+	0x53,
+	0xcf,
+	0x00,
+	0xd7,
+	0x00,
+	0xa5,
+	0x29,
+	0x85,
+	0xcb,
+	0x45,
+	0xd7,
+	0x85,
+	0xd9,
+	0xfc,
+	0xa5,
+	0xcb,
+	0x45,
+	0xd8,
+	0x85,
+	0xda,
+	0x8a,
+	0x18,
+	0x65,
+	0xda,
+	0x85,
+	0xda,
+	0x38,
+	0xa5,
+	0xd7,
+	0xe9,
+	0x01,
+	0x85,
+	0xd7,
+	0xa5,
+	0xd8,
+	0xe9,
+	0x00,
+	0x85,
+	0xd8,
+	0xe6,
+	0xcd,
+	0x64,
+	0xd1,
+	0x64,
+	0xd2,
+	0x64,
+	0xcf,
+	0x64,
+	0xd0,
+	0x64,
+	0xd3,
+	0x64,
+	0xd4,
+	0x64,
+	0xce,
+	0xa2,
+	0x00,
+	0x86,
+	0xcc,
+	0xbd,
+	0xab,
+	0x29,
+	0xaa,
+	0xe8,
+	0xbd,
+	0xbb,
+	0x29,
+	0x4a,
+	0x85,
+	0xd6,
+	0xca,
+	0xbd,
+	0xbb,
+	0x29,
+	0x6a,
+	0x85,
+	0xd5,
+	0x18,
+	0xa5,
+	0xd1,
+	0x65,
+	0xd9,
+	0x85,
+	0xd1,
+	0xa5,
+	0xd2,
+	0x65,
+	0xda,
+	0x85,
+	0xd2,
+	0x38,
+	0xa5,
+	0xd1,
+	0xe5,
+	0xd5,
+	0x85,
+	0xd1,
+	0xa5,
+	0xd2,
+	0xe5,
+	0xd6,
+	0x85,
+	0xd2,
+	0x18,
+	0x10,
+	0x0d,
+	0xa5,
+	0x29,
+	0x65,
+	0xd1,
+	0x85,
+	0xd1,
+	0xa9,
+	0x00,
+	0x65,
+	0xd2,
+	0x85,
+	0xd2,
+	0x38,
+	0xa5,
+	0xd7,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0xa5,
+	0xd8,
+	0x65,
+	0xd0,
+	0x85,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x0a,
+	0x09,
+	0x01,
+	0x92,
+	0x1d,
+	0xa5,
+	0xd0,
+	0x2a,
+	0xa0,
+	0x01,
+	0x91,
+	0x1d,
+	0x18,
+	0xa5,
+	0x1d,
+	0x69,
+	0x02,
+	0x85,
+	0x1d,
+	0xa5,
+	0x1e,
+	0x69,
+	0x00,
+	0x85,
+	0x1e,
+	0xe6,
+	0xcf,
+	0xd0,
+	0x02,
+	0xe6,
+	0xd0,
+	0xa6,
+	0xcc,
+	0xbd,
+	0xab,
+	0x29,
+	0xaa,
+	0xbd,
+	0xbb,
+	0x29,
+	0x85,
+	0xd5,
+	0xe8,
+	0xbd,
+	0xbb,
+	0x29,
+	0x85,
+	0xd6,
+	0xa5,
+	0xcc,
+	0xc5,
+	0xcd,
+	0xb0,
+	0x0d,
+	0x38,
+	0xa5,
+	0xd5,
+	0xe9,
+	0x01,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd6,
+	0xe9,
+	0x00,
+	0x85,
+	0xd6,
+	0x46,
+	0xd6,
+	0x66,
+	0xd5,
+	0x18,
+	0xa5,
+	0x25,
+	0x65,
+	0xd5,
+	0x85,
+	0xd5,
+	0xa5,
+	0x26,
+	0x65,
+	0xd6,
+	0x85,
+	0xd6,
+	0xa6,
+	0xcc,
+	0xbd,
+	0xab,
+	0x29,
+	0xaa,
+	0x18,
+	0xbd,
+	0xbb,
+	0x29,
+	0x65,
+	0x25,
+	0x85,
+	0x25,
+	0xe8,
+	0xbd,
+	0xbb,
+	0x29,
+	0x65,
+	0x26,
+	0x85,
+	0x26,
+	0xa5,
+	0xd6,
+	0xc5,
+	0xd4,
+	0x90,
+	0x1f,
+	0xd0,
+	0x06,
+	0xa5,
+	0xd5,
+	0xc5,
+	0xd3,
+	0x90,
+	0x17,
+	0xa4,
+	0xce,
+	0xb1,
+	0xdd,
+	0xa8,
+	0xb1,
+	0xdf,
+	0x18,
+	0x65,
+	0xd3,
+	0x85,
+	0xd3,
+	0xc8,
+	0xb1,
+	0xdf,
+	0x65,
+	0xd4,
+	0x85,
+	0xd4,
+	0xe6,
+	0xce,
+	0x80,
+	0xdb,
+	0xa5,
+	0xce,
+	0x3a,
+	0xa4,
+	0x1f,
+	0x91,
+	0xdb,
+	0x18,
+	0x98,
+	0x65,
+	0x22,
+	0x85,
+	0x1f,
+	0xa6,
+	0xcc,
+	0xe8,
+	0xe4,
+	0x27,
+	0xb0,
+	0x05,
+	0x86,
+	0xcc,
+	0x4c,
+	0xc0,
+	0x10,
+	0x60,
+	0xaa,
+	0x64,
+	0xcb,
+	0xa9,
+	0x01,
+	0x85,
+	0xcc,
+	0x64,
+	0xcd,
+	0xa4,
+	0x20,
+	0xbd,
+	0xdf,
+	0x2b,
+	0x85,
+	0xce,
+	0xbd,
+	0xe1,
+	0x2b,
+	0x85,
+	0xcf,
+	0xa5,
+	0x28,
+	0xf0,
+	0x04,
+	0x46,
+	0xce,
+	0x46,
+	0xcf,
+	0xa5,
+	0xcb,
+	0xd0,
+	0x02,
+	0x91,
+	0xdf,
+	0xa5,
+	0xcd,
+	0xc5,
+	0xce,
+	0x90,
+	0x0c,
+	0xc5,
+	0xcf,
+	0xf0,
+	0x02,
+	0xb0,
+	0x06,
+	0xb1,
+	0xdf,
+	0x05,
+	0xcc,
+	0x91,
+	0xdf,
+	0xa5,
+	0xcd,
+	0x1a,
+	0xc5,
+	0x27,
+	0xb0,
+	0x09,
+	0x85,
+	0xcd,
+	0x18,
+	0x98,
+	0x65,
+	0x22,
+	0xa8,
+	0x80,
+	0xd8,
+	0xa5,
+	0xcb,
+	0x1a,
+	0xcd,
+	0xde,
+	0x2b,
+	0xb0,
+	0x0b,
+	0x85,
+	0xcb,
+	0x8a,
+	0x18,
+	0x69,
+	0x04,
+	0xaa,
+	0x06,
+	0xcc,
+	0x80,
+	0xaf,
+	0x60,
+	0xad,
+	0xcf,
+	0x3b,
+	0x0d,
+	0xd0,
+	0x3b,
+	0xf0,
+	0x2d,
+	0xa0,
+	0x02,
+	0x53,
+	0xcf,
+	0x3b,
+	0xd1,
+	0x00,
+	0x20,
+	0x3d,
+	0x21,
+	0xa0,
+	0x02,
+	0x53,
+	0xd1,
+	0x3b,
+	0xcf,
+	0x00,
+	0x20,
+	0xe2,
+	0x20,
+	0xa0,
+	0x02,
+	0x53,
+	0xd5,
+	0x3b,
+	0xd7,
+	0x00,
+	0xa5,
+	0xd8,
+	0x10,
+	0x08,
+	0xa2,
+	0xff,
+	0x86,
+	0xd9,
+	0x86,
+	0xda,
+	0x80,
+	0x38,
+	0x64,
+	0xd9,
+	0x64,
+	0xda,
+	0x80,
+	0x32,
+	0xa0,
+	0x02,
+	0x53,
+	0xd3,
+	0x3b,
+	0xd1,
+	0x00,
+	0x20,
+	0x3d,
+	0x21,
+	0xa0,
+	0x02,
+	0x53,
+	0xd5,
+	0x3b,
+	0xcf,
+	0x00,
+	0x20,
+	0xe2,
+	0x20,
+	0xa0,
+	0x04,
+	0x53,
+	0xd3,
+	0x00,
+	0xd7,
+	0x00,
+	0xa0,
+	0x02,
+	0x53,
+	0xd1,
+	0x3b,
+	0xd3,
+	0x00,
+	0xa5,
+	0xd4,
+	0x10,
+	0x08,
+	0xa2,
+	0xff,
+	0x86,
+	0xd5,
+	0x86,
+	0xd6,
+	0x80,
+	0x04,
+	0x64,
+	0xd5,
+	0x64,
+	0xd6,
+	0xd8,
+	0xa5,
+	0xd6,
+	0x45,
+	0xda,
+	0xf8,
+	0x10,
+	0x03,
+	0xa9,
+	0x1e,
+	0x60,
+	0xa5,
+	0xd6,
+	0x10,
+	0x03,
+	0x20,
+	0xda,
+	0x21,
+	0x20,
+	0x07,
+	0x22,
+	0x64,
+	0xd3,
+	0xa0,
+	0x02,
+	0x53,
+	0xcf,
+	0x00,
+	0xd4,
+	0x00,
+	0x64,
+	0xd6,
+	0x53,
+	0xd1,
+	0x00,
+	0xcf,
+	0x00,
+	0x20,
+	0x81,
+	0x21,
+	0xa5,
+	0xd5,
+	0xf0,
+	0x06,
+	0xa9,
+	0xff,
+	0x85,
+	0xd3,
+	0x85,
+	0xd4,
+	0xa5,
+	0xd3,
+	0x45,
+	0xdb,
+	0x85,
+	0xd7,
+	0x84,
+	0xd8,
+	0xa5,
+	0xd3,
+	0x45,
+	0xdc,
+	0x18,
+	0x65,
+	0xd8,
+	0x85,
+	0xd8,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xd9,
+	0xa5,
+	0xd4,
+	0x45,
+	0xdb,
+	0x18,
+	0x65,
+	0xd8,
+	0x85,
+	0xd8,
+	0x98,
+	0x65,
+	0xd9,
+	0x85,
+	0xd9,
+	0xa5,
+	0xd4,
+	0x45,
+	0xdc,
+	0x65,
+	0xd9,
+	0x85,
+	0xd9,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xda,
+	0xa5,
+	0xd7,
+	0x10,
+	0x08,
+	0xe6,
+	0xd8,
+	0xd0,
+	0x04,
+	0xe6,
+	0xd9,
+	0xf0,
+	0x0d,
+	0xa5,
+	0xda,
+	0xd0,
+	0x09,
+	0xa0,
+	0x02,
+	0x53,
+	0xd8,
+	0x00,
+	0x2d,
+	0x00,
+	0x80,
+	0x06,
+	0xa9,
+	0xff,
+	0x85,
+	0x2d,
+	0x85,
+	0x2e,
+	0xa9,
+	0x00,
+	0x60,
+	0xa2,
+	0x02,
+	0xa5,
+	0x6e,
+	0xdd,
+	0xcb,
+	0x3c,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xdd,
+	0xca,
+	0x3c,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x06,
+	0xf0,
+	0x02,
+	0x80,
+	0xe8,
+	0xca,
+	0xca,
+	0xda,
+	0x38,
+	0xa5,
+	0x6d,
+	0xfd,
+	0xca,
+	0x3c,
+	0x85,
+	0xcf,
+	0xa5,
+	0x6e,
+	0xfd,
+	0xcb,
+	0x3c,
+	0x85,
+	0xd0,
+	0xbd,
+	0xe5,
+	0x3c,
+	0x85,
+	0xd1,
+	0xbd,
+	0xe6,
+	0x3c,
+	0x85,
+	0xd2,
+	0x20,
+	0x04,
+	0x21,
+	0x8a,
+	0x4a,
+	0xaa,
+	0xbd,
+	0xf1,
+	0x3c,
+	0xf0,
+	0x12,
+	0x38,
+	0xa9,
+	0x00,
+	0xa8,
+	0xe5,
+	0xd3,
+	0x85,
+	0xd3,
+	0x98,
+	0xe5,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0xe5,
+	0xd5,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0xbd,
+	0xd6,
+	0x3c,
+	0x18,
+	0x65,
+	0xd5,
+	0x85,
+	0x99,
+	0xfa,
+	0xda,
+	0xbd,
+	0xdf,
+	0x3c,
+	0x85,
+	0xd1,
+	0xbd,
+	0xe0,
+	0x3c,
+	0x85,
+	0xd2,
+	0x20,
+	0x04,
+	0x21,
+	0x8a,
+	0x4a,
+	0xaa,
+	0xbd,
+	0xee,
+	0x3c,
+	0xf0,
+	0x12,
+	0x38,
+	0xa9,
+	0x00,
+	0xa8,
+	0xe5,
+	0xd3,
+	0x85,
+	0xd3,
+	0x98,
+	0xe5,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0xe5,
+	0xd5,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0xbd,
+	0xd3,
+	0x3c,
+	0x18,
+	0x65,
+	0xd5,
+	0x45,
+	0x88,
+	0x20,
+	0x52,
+	0x21,
+	0x85,
+	0x97,
+	0xfa,
+	0xbd,
+	0xd9,
+	0x3c,
+	0x85,
+	0xd1,
+	0xbd,
+	0xda,
+	0x3c,
+	0x85,
+	0xd2,
+	0x20,
+	0x04,
+	0x21,
+	0x8a,
+	0x4a,
+	0xaa,
+	0xbd,
+	0xeb,
+	0x3c,
+	0xf0,
+	0x12,
+	0x38,
+	0xa9,
+	0x00,
+	0xa8,
+	0xe5,
+	0xd3,
+	0x85,
+	0xd3,
+	0x98,
+	0xe5,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0xe5,
+	0xd5,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0xbd,
+	0xd0,
+	0x3c,
+	0x18,
+	0x65,
+	0xd5,
+	0x45,
+	0x89,
+	0x20,
+	0x52,
+	0x21,
+	0x85,
+	0x98,
+	0x60,
+	0xa5,
+	0x78,
+	0xc9,
+	0x02,
+	0xb0,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x02,
+	0xa9,
+	0x33,
+	0x85,
+	0xcb,
+	0xa2,
+	0x00,
+	0x18,
+	0x8a,
+	0x65,
+	0xcb,
+	0xa8,
+	0xa5,
+	0x6e,
+	0xd9,
+	0xfa,
+	0x3c,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xd9,
+	0xf9,
+	0x3c,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x06,
+	0xf0,
+	0x02,
+	0x80,
+	0xe3,
+	0x8a,
+	0x4a,
+	0x49,
+	0x05,
+	0x18,
+	0x65,
+	0xcb,
+	0x18,
+	0x69,
+	0xff,
+	0x85,
+	0xd1,
+	0xa9,
+	0x3c,
+	0x69,
+	0x00,
+	0x85,
+	0xd2,
+	0xa0,
+	0x05,
+	0xd3,
+	0xd1,
+	0x31,
+	0x00,
+	0x60,
+	0xa2,
+	0x02,
+	0x18,
+	0x8a,
+	0x65,
+	0xcb,
+	0xa8,
+	0xa5,
+	0x6e,
+	0xd9,
+	0x14,
+	0x3d,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xd9,
+	0x13,
+	0x3d,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x0a,
+	0xf0,
+	0x02,
+	0x80,
+	0xe3,
+	0xca,
+	0xca,
+	0x18,
+	0x8a,
+	0x65,
+	0xcb,
+	0xa8,
+	0x38,
+	0xa5,
+	0x6d,
+	0xf9,
+	0x13,
+	0x3d,
+	0x85,
+	0xcf,
+	0xa5,
+	0x6e,
+	0xf9,
+	0x14,
+	0x3d,
+	0x85,
+	0xd0,
+	0xb9,
+	0x1d,
+	0x3d,
+	0x85,
+	0xd1,
+	0xb9,
+	0x1e,
+	0x3d,
+	0x85,
+	0xd2,
+	0x20,
+	0x3d,
+	0x21,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0x8a,
+	0x4a,
+	0x18,
+	0x65,
+	0xcb,
+	0xa8,
+	0x18,
+	0xb9,
+	0x27,
+	0x3d,
+	0x65,
+	0xd5,
+	0x85,
+	0x36,
+	0x60,
+	0x38,
+	0x30,
+	0x0b,
+	0x85,
+	0xcb,
+	0xa9,
+	0x00,
+	0xe5,
+	0xcb,
+	0xd0,
+	0x02,
+	0xa9,
+	0xff,
+	0x60,
+	0xe9,
+	0x80,
+	0x4a,
+	0x4a,
+	0x85,
+	0xcb,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0xcb,
+	0x60,
+	0x38,
+	0xe9,
+	0x80,
+	0xaa,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0xd8,
+	0x49,
+	0x01,
+	0xf8,
+	0x4a,
+	0x8a,
+	0x6a,
+	0x18,
+	0x69,
+	0x80,
+	0x60,
+	0x38,
+	0x30,
+	0x0b,
+	0x85,
+	0xcb,
+	0xa9,
+	0x00,
+	0xe5,
+	0xcb,
+	0xd0,
+	0x02,
+	0xa9,
+	0xff,
+	0x60,
+	0xe9,
+	0x80,
+	0x4a,
+	0x85,
+	0xcb,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0xcb,
+	0x60,
+	0x38,
+	0xe9,
+	0x80,
+	0x85,
+	0xcb,
+	0x8a,
+	0x3c,
+	0x45,
+	0xcb,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xdc,
+	0x10,
+	0x01,
+	0x1a,
+	0x18,
+	0x69,
+	0x80,
+	0x60,
+	0x0a,
+	0x85,
+	0xcb,
+	0x8a,
+	0x45,
+	0xcb,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0x60,
+	0x0a,
+	0x85,
+	0xcb,
+	0x8a,
+	0x45,
+	0xcb,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x7f,
+	0xb0,
+	0x01,
+	0x60,
+	0xa9,
+	0x7f,
+	0x60,
+	0xa2,
+	0x02,
+	0xa5,
+	0x6e,
+	0xdd,
+	0x71,
+	0x3f,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xdd,
+	0x70,
+	0x3f,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x06,
+	0xf0,
+	0x02,
+	0x80,
+	0xe8,
+	0xca,
+	0xca,
+	0xda,
+	0x38,
+	0xa5,
+	0x6d,
+	0xfd,
+	0x70,
+	0x3f,
+	0x85,
+	0xcf,
+	0xa5,
+	0x6e,
+	0xfd,
+	0x71,
+	0x3f,
+	0x85,
+	0xd0,
+	0xbd,
+	0x76,
+	0x3f,
+	0x85,
+	0xd1,
+	0xbd,
+	0x77,
+	0x3f,
+	0x85,
+	0xd2,
+	0x20,
+	0x3d,
+	0x21,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x18,
+	0xbd,
+	0x82,
+	0x3f,
+	0x65,
+	0xd5,
+	0x85,
+	0xba,
+	0xfa,
+	0xbd,
+	0x7c,
+	0x3f,
+	0x85,
+	0xd1,
+	0xbd,
+	0x7d,
+	0x3f,
+	0x85,
+	0xd2,
+	0x20,
+	0x3d,
+	0x21,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x18,
+	0xbd,
+	0x85,
+	0x3f,
+	0x65,
+	0xd5,
+	0x85,
+	0xbb,
+	0x60,
+	0x5a,
+	0x86,
+	0xcb,
+	0x45,
+	0xcb,
+	0xaa,
+	0x98,
+	0x29,
+	0x30,
+	0xd0,
+	0x12,
+	0x98,
+	0x49,
+	0x08,
+	0x85,
+	0xcb,
+	0x8a,
+	0x49,
+	0x10,
+	0x98,
+	0x4a,
+	0x05,
+	0xcb,
+	0x69,
+	0x00,
+	0x30,
+	0x02,
+	0x7a,
+	0x60,
+	0xa9,
+	0x7f,
+	0x7a,
+	0x60,
+	0x5a,
+	0x86,
+	0xcb,
+	0x45,
+	0xcb,
+	0xaa,
+	0x98,
+	0x29,
+	0x38,
+	0xd0,
+	0x12,
+	0x98,
+	0x49,
+	0x10,
+	0x85,
+	0xcb,
+	0x8a,
+	0x49,
+	0x20,
+	0x98,
+	0x4a,
+	0x05,
+	0xcb,
+	0x69,
+	0x00,
+	0x30,
+	0x02,
+	0x7a,
+	0x60,
+	0xa9,
+	0x7f,
+	0x7a,
+	0x60,
+	0x5a,
+	0x86,
+	0xcb,
+	0x45,
+	0xcb,
+	0xaa,
+	0x98,
+	0x29,
+	0xf8,
+	0xd0,
+	0x10,
+	0x98,
+	0x49,
+	0x10,
+	0x85,
+	0xcb,
+	0x8a,
+	0x49,
+	0x20,
+	0x98,
+	0x4a,
+	0x05,
+	0xcb,
+	0x69,
+	0x00,
+	0x10,
+	0x02,
+	0xa9,
+	0x7f,
+	0x7a,
+	0x60,
+	0x49,
+	0x3c,
+	0x18,
+	0x65,
+	0xd9,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0x85,
+	0xd0,
+	0x18,
+	0xa5,
+	0xcf,
+	0x69,
+	0x78,
+	0x85,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x69,
+	0x3d,
+	0x85,
+	0xd0,
+	0x60,
+	0xf0,
+	0x02,
+	0xa9,
+	0x3c,
+	0x18,
+	0x65,
+	0xd9,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0x85,
+	0xd0,
+	0x18,
+	0xa5,
+	0xcf,
+	0x69,
+	0x78,
+	0x85,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x69,
+	0x3d,
+	0x85,
+	0xd0,
+	0x60,
+	0x85,
+	0xd8,
+	0xa9,
+	0x04,
+	0x48,
+	0x80,
+	0x1a,
+	0xfa,
+	0xfa,
+	0x48,
+	0xa9,
+	0x0f,
+	0x18,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0xd0,
+	0xa5,
+	0xcd,
+	0x65,
+	0xd1,
+	0x85,
+	0xd1,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0xd2,
+	0xa0,
+	0x0f,
+	0xd3,
+	0xcf,
+	0x56,
+	0x00,
+	0xa6,
+	0x62,
+	0xa5,
+	0x85,
+	0x20,
+	0xb4,
+	0x14,
+	0x85,
+	0xcc,
+	0xa6,
+	0x63,
+	0xa5,
+	0x85,
+	0x20,
+	0xb4,
+	0x14,
+	0x85,
+	0xce,
+	0xa6,
+	0x64,
+	0xa5,
+	0x85,
+	0x20,
+	0xb4,
+	0x14,
+	0x85,
+	0xd3,
+	0xa5,
+	0x56,
+	0xa6,
+	0xce,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x89,
+	0x20,
+	0x71,
+	0x15,
+	0x85,
+	0x56,
+	0xa5,
+	0x57,
+	0xa6,
+	0xd3,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x30,
+	0x20,
+	0x92,
+	0x15,
+	0x85,
+	0x57,
+	0xa5,
+	0x58,
+	0xa6,
+	0xcc,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x58,
+	0xa5,
+	0x59,
+	0xa6,
+	0xcc,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x59,
+	0xa5,
+	0x5a,
+	0xa6,
+	0xcc,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x8b,
+	0x20,
+	0x50,
+	0x15,
+	0x85,
+	0x5a,
+	0xa5,
+	0x5b,
+	0xa6,
+	0xd3,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x8a,
+	0x20,
+	0x50,
+	0x15,
+	0x85,
+	0x5b,
+	0xa5,
+	0x5c,
+	0xa6,
+	0xce,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x5c,
+	0xa5,
+	0x5d,
+	0xa6,
+	0xce,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x5d,
+	0xa5,
+	0x5e,
+	0xa6,
+	0xd3,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x5e,
+	0xa0,
+	0x09,
+	0xa5,
+	0xd8,
+	0xd0,
+	0x27,
+	0xa5,
+	0x5f,
+	0xa6,
+	0xcc,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x2f,
+	0x20,
+	0x92,
+	0x15,
+	0x85,
+	0x5f,
+	0xa5,
+	0x60,
+	0xa6,
+	0xce,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x88,
+	0x20,
+	0x71,
+	0x15,
+	0x85,
+	0x60,
+	0xa5,
+	0x61,
+	0xa6,
+	0xd3,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x61,
+	0xa0,
+	0x0c,
+	0x73,
+	0x56,
+	0x00,
+	0xd1,
+	0x68,
+	0x3a,
+	0xd0,
+	0x01,
+	0x60,
+	0x20,
+	0xf0,
+	0x15,
+	0xa9,
+	0x03,
+	0x48,
+	0xa2,
+	0x00,
+	0x80,
+	0x06,
+	0x48,
+	0x18,
+	0x8a,
+	0x69,
+	0x15,
+	0xaa,
+	0xa0,
+	0x15,
+	0x18,
+	0xbd,
+	0x18,
+	0x29,
+	0x7d,
+	0x42,
+	0x29,
+	0x4a,
+	0x69,
+	0x00,
+	0x9d,
+	0x2d,
+	0x29,
+	0xe8,
+	0x88,
+	0xd0,
+	0xef,
+	0x68,
+	0x3a,
+	0xd0,
+	0xe3,
+	0x60,
+	0xbc,
+	0x93,
+	0x27,
+	0x84,
+	0xcb,
+	0x45,
+	0xcb,
+	0x85,
+	0xcf,
+	0x84,
+	0xd0,
+	0x18,
+	0xa9,
+	0x10,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0xb0,
+	0x15,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0xb0,
+	0x0f,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0xb0,
+	0x09,
+	0xa9,
+	0xc0,
+	0x25,
+	0xd0,
+	0xd0,
+	0x03,
+	0xa5,
+	0xd0,
+	0x60,
+	0xa9,
+	0x3f,
+	0x60,
+	0xa5,
+	0x2b,
+	0x49,
+	0x10,
+	0x85,
+	0xd3,
+	0x84,
+	0xd4,
+	0xa5,
+	0x2c,
+	0x49,
+	0x10,
+	0x05,
+	0xd4,
+	0x85,
+	0xd4,
+	0x84,
+	0xd5,
+	0x64,
+	0xd6,
+	0xa0,
+	0x02,
+	0x53,
+	0x6d,
+	0x00,
+	0xcf,
+	0x00,
+	0x20,
+	0x81,
+	0x21,
+	0xa5,
+	0xd5,
+	0xd0,
+	0x0a,
+	0xa5,
+	0xd4,
+	0xd0,
+	0x06,
+	0xa5,
+	0xd3,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0x45,
+	0x89,
+	0x18,
+	0x69,
+	0x08,
+	0x85,
+	0xcb,
+	0x98,
+	0x69,
+	0x00,
+	0x49,
+	0x10,
+	0xc0,
+	0x00,
+	0xd0,
+	0x0f,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x49,
+	0x10,
+	0x84,
+	0xcb,
+	0x8a,
+	0x05,
+	0xcb,
+	0xcd,
+	0x62,
+	0x3c,
+	0x90,
+	0x05,
+	0xad,
+	0x64,
+	0x3c,
+	0x80,
+	0x03,
+	0xad,
+	0x63,
+	0x3c,
+	0x18,
+	0x69,
+	0x20,
+	0x29,
+	0x3f,
+	0x85,
+	0xcb,
+	0xa4,
+	0x78,
+	0xb9,
+	0x5d,
+	0x3c,
+	0x18,
+	0x69,
+	0x20,
+	0x29,
+	0x3f,
+	0x85,
+	0xcc,
+	0xa4,
+	0x79,
+	0xb9,
+	0x55,
+	0x3c,
+	0x45,
+	0xcc,
+	0x85,
+	0xcf,
+	0x84,
+	0xd0,
+	0x18,
+	0xa9,
+	0x10,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x06,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x2a,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x2a,
+	0x85,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x45,
+	0xcb,
+	0x85,
+	0xcf,
+	0xa5,
+	0xd0,
+	0xf0,
+	0x05,
+	0x18,
+	0x98,
+	0x65,
+	0xcb,
+	0xa8,
+	0x84,
+	0xd0,
+	0x18,
+	0xa9,
+	0x10,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x64,
+	0xcb,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x26,
+	0xcb,
+	0x06,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x2a,
+	0x85,
+	0xd1,
+	0xa5,
+	0xcb,
+	0x2a,
+	0x85,
+	0xd2,
+	0xa0,
+	0x00,
+	0x5a,
+	0xb9,
+	0x28,
+	0x3c,
+	0x18,
+	0x69,
+	0x20,
+	0x29,
+	0x3f,
+	0x85,
+	0xcb,
+	0xa5,
+	0xcb,
+	0x45,
+	0xd1,
+	0x85,
+	0xcf,
+	0xfc,
+	0xa5,
+	0xcb,
+	0x45,
+	0xd2,
+	0x85,
+	0xd0,
+	0x8a,
+	0x18,
+	0x65,
+	0xd0,
+	0x85,
+	0xd0,
+	0x18,
+	0xa9,
+	0x10,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x64,
+	0xcb,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x26,
+	0xcb,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x26,
+	0xcb,
+	0x06,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x2a,
+	0xa8,
+	0xa5,
+	0xcb,
+	0x2a,
+	0xd0,
+	0x05,
+	0x98,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x7a,
+	0x99,
+	0x1d,
+	0x2b,
+	0xc8,
+	0xc0,
+	0x07,
+	0x90,
+	0xae,
+	0xa9,
+	0x00,
+	0x60,
+	0xa5,
+	0xc6,
+	0xa8,
+	0x29,
+	0x0f,
+	0xf0,
+	0x28,
+	0x98,
+	0x29,
+	0xf0,
+	0xf0,
+	0x23,
+	0xa5,
+	0xc5,
+	0xaa,
+	0x29,
+	0x0f,
+	0x3a,
+	0xd0,
+	0x11,
+	0xd8,
+	0x8a,
+	0x49,
+	0x10,
+	0xaa,
+	0xd0,
+	0x07,
+	0x98,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x80,
+	0x03,
+	0x98,
+	0x29,
+	0x0f,
+	0xf8,
+	0x85,
+	0xc5,
+	0x8a,
+	0x29,
+	0x10,
+	0x05,
+	0xc5,
+	0x85,
+	0xc5,
+	0x60,
+	0xa9,
+	0x01,
+	0x8d,
+	0x10,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0xad,
+	0x3c,
+	0x58,
+	0x60,
+	0x53,
+	0x65,
+	0x00,
+	0x18,
+	0x60,
+	0x53,
+	0x67,
+	0x00,
+	0x1c,
+	0x60,
+	0x53,
+	0x69,
+	0x00,
+	0x28,
+	0x60,
+	0x53,
+	0x6b,
+	0x00,
+	0x2c,
+	0x60,
+	0x53,
+	0x6f,
+	0x00,
+	0x30,
+	0x60,
+	0xa0,
+	0x01,
+	0x53,
+	0xb3,
+	0x3c,
+	0x20,
+	0x61,
+	0x53,
+	0xb4,
+	0x3c,
+	0x24,
+	0x61,
+	0x53,
+	0xb5,
+	0x3c,
+	0x28,
+	0x61,
+	0x53,
+	0xaf,
+	0x3c,
+	0x2c,
+	0x61,
+	0x53,
+	0xb0,
+	0x3c,
+	0x30,
+	0x61,
+	0x53,
+	0xb1,
+	0x3c,
+	0x34,
+	0x61,
+	0x53,
+	0xb2,
+	0x3c,
+	0x38,
+	0x61,
+	0x53,
+	0xb6,
+	0x3c,
+	0x3c,
+	0x61,
+	0x53,
+	0xb7,
+	0x3c,
+	0x40,
+	0x61,
+	0x53,
+	0xf4,
+	0x3f,
+	0x74,
+	0x60,
+	0x53,
+	0xaa,
+	0x3c,
+	0x0c,
+	0x61,
+	0x53,
+	0xab,
+	0x3c,
+	0x44,
+	0x61,
+	0x53,
+	0xac,
+	0x3c,
+	0x88,
+	0x60,
+	0x53,
+	0x54,
+	0x3c,
+	0xdc,
+	0x60,
+	0x53,
+	0x55,
+	0x3c,
+	0x68,
+	0x61,
+	0x53,
+	0x80,
+	0x00,
+	0x14,
+	0x60,
+	0x53,
+	0x7f,
+	0x00,
+	0x3c,
+	0x60,
+	0x53,
+	0x88,
+	0x00,
+	0xec,
+	0x60,
+	0x53,
+	0x89,
+	0x00,
+	0xe0,
+	0x60,
+	0x53,
+	0x8a,
+	0x00,
+	0xe8,
+	0x60,
+	0x53,
+	0x8b,
+	0x00,
+	0xe4,
+	0x60,
+	0x53,
+	0x8e,
+	0x00,
+	0x64,
+	0x61,
+	0x53,
+	0x8f,
+	0x00,
+	0x80,
+	0x60,
+	0x53,
+	0x90,
+	0x00,
+	0x84,
+	0x60,
+	0x53,
+	0x91,
+	0x00,
+	0x58,
+	0x61,
+	0x53,
+	0x92,
+	0x00,
+	0xf0,
+	0x60,
+	0x53,
+	0x93,
+	0x00,
+	0xf4,
+	0x60,
+	0x53,
+	0x94,
+	0x00,
+	0xf8,
+	0x60,
+	0x53,
+	0x95,
+	0x00,
+	0x5c,
+	0x61,
+	0x53,
+	0x96,
+	0x00,
+	0xac,
+	0x60,
+	0x53,
+	0x97,
+	0x00,
+	0x7c,
+	0x60,
+	0x53,
+	0x98,
+	0x00,
+	0x78,
+	0x60,
+	0x53,
+	0x99,
+	0x00,
+	0x10,
+	0x61,
+	0x53,
+	0x9a,
+	0x00,
+	0xfc,
+	0x60,
+	0x53,
+	0x9b,
+	0x00,
+	0x00,
+	0x61,
+	0x53,
+	0x9c,
+	0x00,
+	0x04,
+	0x61,
+	0x53,
+	0x9d,
+	0x00,
+	0x08,
+	0x61,
+	0x53,
+	0x9e,
+	0x00,
+	0x1c,
+	0x61,
+	0x53,
+	0x9f,
+	0x00,
+	0x4c,
+	0x61,
+	0x53,
+	0xa0,
+	0x00,
+	0x18,
+	0x61,
+	0x53,
+	0xa1,
+	0x00,
+	0x48,
+	0x61,
+	0x53,
+	0xa2,
+	0x00,
+	0x14,
+	0x61,
+	0x53,
+	0xa3,
+	0x00,
+	0x6c,
+	0x61,
+	0x53,
+	0xa4,
+	0x00,
+	0x5c,
+	0x60,
+	0x53,
+	0xa5,
+	0x00,
+	0xbc,
+	0x60,
+	0x53,
+	0xa6,
+	0x00,
+	0xc0,
+	0x60,
+	0x53,
+	0xa7,
+	0x00,
+	0xc4,
+	0x60,
+	0x53,
+	0xa8,
+	0x00,
+	0xc8,
+	0x60,
+	0x53,
+	0xa9,
+	0x00,
+	0xcc,
+	0x60,
+	0x53,
+	0xaa,
+	0x00,
+	0xd0,
+	0x60,
+	0x53,
+	0xab,
+	0x00,
+	0xd4,
+	0x60,
+	0x53,
+	0xac,
+	0x00,
+	0xd8,
+	0x60,
+	0x53,
+	0xad,
+	0x00,
+	0x50,
+	0x61,
+	0x53,
+	0xae,
+	0x00,
+	0x60,
+	0x60,
+	0x53,
+	0xaf,
+	0x00,
+	0x64,
+	0x60,
+	0x53,
+	0xb0,
+	0x00,
+	0x68,
+	0x60,
+	0x53,
+	0xb1,
+	0x00,
+	0x60,
+	0x61,
+	0x53,
+	0xb2,
+	0x00,
+	0x6c,
+	0x60,
+	0x53,
+	0xb3,
+	0x00,
+	0x70,
+	0x60,
+	0x53,
+	0xb4,
+	0x00,
+	0xa8,
+	0x60,
+	0x53,
+	0xb5,
+	0x00,
+	0xa4,
+	0x60,
+	0x53,
+	0xb6,
+	0x00,
+	0xa0,
+	0x60,
+	0x53,
+	0xb7,
+	0x00,
+	0x9c,
+	0x60,
+	0x53,
+	0xb8,
+	0x00,
+	0x98,
+	0x60,
+	0x53,
+	0xb9,
+	0x00,
+	0x94,
+	0x60,
+	0x53,
+	0xba,
+	0x00,
+	0x8c,
+	0x60,
+	0x53,
+	0xbb,
+	0x00,
+	0x90,
+	0x60,
+	0x53,
+	0xbe,
+	0x00,
+	0xb8,
+	0x60,
+	0x53,
+	0xbf,
+	0x00,
+	0xb4,
+	0x60,
+	0x53,
+	0xc0,
+	0x00,
+	0xb0,
+	0x60,
+	0x53,
+	0xc1,
+	0x00,
+	0x54,
+	0x61,
+	0x53,
+	0xc2,
+	0x00,
+	0x70,
+	0x61,
+	0x9c,
+	0x20,
+	0x60,
+	0x9c,
+	0x24,
+	0x60,
+	0x60,
+	0x29,
+	0x01,
+	0xf0,
+	0x06,
+	0xa2,
+	0xb8,
+	0xa9,
+	0x01,
+	0x80,
+	0x04,
+	0xa2,
+	0x38,
+	0xa9,
+	0x00,
+	0x8e,
+	0x0c,
+	0x60,
+	0x8d,
+	0x0d,
+	0x60,
+	0x85,
+	0xd4,
+	0x86,
+	0xd3,
+	0xa4,
+	0x8d,
+	0xb9,
+	0xe7,
+	0x2a,
+	0xa8,
+	0xb9,
+	0x47,
+	0x27,
+	0x49,
+	0x04,
+	0x18,
+	0x69,
+	0x5f,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x69,
+	0x3d,
+	0x85,
+	0xd0,
+	0xa5,
+	0x73,
+	0x85,
+	0xcb,
+	0xa0,
+	0x00,
+	0x5a,
+	0xb9,
+	0xd7,
+	0x2a,
+	0xa8,
+	0xb9,
+	0x37,
+	0x27,
+	0x4a,
+	0xa8,
+	0xb1,
+	0xcf,
+	0xb0,
+	0x04,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x29,
+	0x0f,
+	0x18,
+	0x49,
+	0x15,
+	0x69,
+	0x18,
+	0x85,
+	0xd1,
+	0xa9,
+	0x29,
+	0x69,
+	0x00,
+	0x85,
+	0xd2,
+	0xa0,
+	0x15,
+	0xc3,
+	0xd1,
+	0x54,
+	0x60,
+	0x18,
+	0xa5,
+	0xd3,
+	0x69,
+	0x18,
+	0x85,
+	0xd3,
+	0x90,
+	0x02,
+	0xe6,
+	0xd4,
+	0xa0,
+	0x02,
+	0x53,
+	0xd3,
+	0x00,
+	0x0c,
+	0x60,
+	0x7a,
+	0xc6,
+	0xcb,
+	0xf0,
+	0x03,
+	0xc8,
+	0x80,
+	0xbf,
+	0xe6,
+	0x8d,
+	0x60,
+	0xa5,
+	0x7a,
+	0xf0,
+	0x06,
+	0xa5,
+	0x7b,
+	0xc9,
+	0x00,
+	0xd0,
+	0x12,
+	0xa0,
+	0x02,
+	0x53,
+	0xa2,
+	0x3c,
+	0xb6,
+	0x02,
+	0x53,
+	0xa4,
+	0x3c,
+	0xb8,
+	0x02,
+	0x9c,
+	0xa9,
+	0x02,
+	0x4c,
+	0x55,
+	0x1d,
+	0xa9,
+	0x03,
+	0x85,
+	0xd7,
+	0xa0,
+	0x02,
+	0x53,
+	0x42,
+	0x00,
+	0xcf,
+	0x00,
+	0xa5,
+	0x3f,
+	0xc5,
+	0xd0,
+	0x90,
+	0x13,
+	0xd0,
+	0x06,
+	0xa5,
+	0x3e,
+	0xc5,
+	0xcf,
+	0x90,
+	0x0b,
+	0xa9,
+	0x01,
+	0x85,
+	0xd7,
+	0xa0,
+	0x02,
+	0x53,
+	0x3e,
+	0x00,
+	0xcf,
+	0x00,
+	0xa5,
+	0x3d,
+	0xc5,
+	0xd0,
+	0x90,
+	0x13,
+	0xd0,
+	0x06,
+	0xa5,
+	0x3c,
+	0xc5,
+	0xcf,
+	0x90,
+	0x0b,
+	0xa9,
+	0x00,
+	0x85,
+	0xd7,
+	0xa0,
+	0x02,
+	0x53,
+	0x3c,
+	0x00,
+	0xcf,
+	0x00,
+	0xa5,
+	0x41,
+	0xc5,
+	0xd0,
+	0x90,
+	0x13,
+	0xd0,
+	0x06,
+	0xa5,
+	0x40,
+	0xc5,
+	0xcf,
+	0x90,
+	0x0b,
+	0xa9,
+	0x02,
+	0x85,
+	0xd7,
+	0xa0,
+	0x02,
+	0x53,
+	0x40,
+	0x00,
+	0xcf,
+	0x00,
+	0xa6,
+	0x7b,
+	0xe0,
+	0x02,
+	0xf0,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x02,
+	0xa9,
+	0x16,
+	0x85,
+	0xcb,
+	0xa2,
+	0x00,
+	0x18,
+	0x8a,
+	0x65,
+	0xcb,
+	0xa8,
+	0xa5,
+	0x6e,
+	0xd9,
+	0x69,
+	0x3c,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xd9,
+	0x68,
+	0x3c,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x08,
+	0xf0,
+	0x02,
+	0x80,
+	0xe3,
+	0x8a,
+	0x4a,
+	0x49,
+	0x04,
+	0x18,
+	0x65,
+	0xcb,
+	0x48,
+	0xa5,
+	0x37,
+	0x85,
+	0xcb,
+	0xd0,
+	0x08,
+	0x64,
+	0xd3,
+	0x64,
+	0xd4,
+	0x64,
+	0xd5,
+	0x80,
+	0x48,
+	0x4a,
+	0x85,
+	0xda,
+	0xa5,
+	0x38,
+	0x85,
+	0xd0,
+	0xa5,
+	0xda,
+	0x85,
+	0xcf,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x04,
+	0xa5,
+	0xcf,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xd3,
+	0xa5,
+	0x39,
+	0x85,
+	0xd0,
+	0xa5,
+	0xda,
+	0x85,
+	0xcf,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x04,
+	0xa5,
+	0xcf,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xd4,
+	0xa5,
+	0x3b,
+	0x85,
+	0xd0,
+	0xa5,
+	0xda,
+	0x85,
+	0xcf,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x04,
+	0xa5,
+	0xcf,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xd5,
+	0xa5,
+	0x7c,
+	0xf0,
+	0x03,
+	0x4c,
+	0x41,
+	0x1c,
+	0xad,
+	0xaa,
+	0x02,
+	0xc5,
+	0xd3,
+	0x90,
+	0x16,
+	0x38,
+	0xe5,
+	0xd3,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0xd3,
+	0x80,
+	0x21,
+	0xa5,
+	0xd3,
+	0x38,
+	0xed,
+	0xaa,
+	0x02,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x38,
+	0xe9,
+	0x80,
+	0x85,
+	0xdf,
+	0x98,
+	0xe9,
+	0x00,
+	0x85,
+	0xe0,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xdf,
+	0xa5,
+	0xd3,
+	0xe5,
+	0xe0,
+	0x85,
+	0xd3,
+	0xad,
+	0xab,
+	0x02,
+	0xc5,
+	0xd4,
+	0x90,
+	0x16,
+	0x38,
+	0xe5,
+	0xd4,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0xd4,
+	0x80,
+	0x21,
+	0xa5,
+	0xd4,
+	0x38,
+	0xed,
+	0xab,
+	0x02,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x38,
+	0xe9,
+	0x80,
+	0x85,
+	0xdf,
+	0x98,
+	0xe9,
+	0x00,
+	0x85,
+	0xe0,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xdf,
+	0xa5,
+	0xd4,
+	0xe5,
+	0xe0,
+	0x85,
+	0xd4,
+	0xad,
+	0xac,
+	0x02,
+	0xc5,
+	0xd5,
+	0x90,
+	0x16,
+	0x38,
+	0xe5,
+	0xd5,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0xd5,
+	0x80,
+	0x21,
+	0xa5,
+	0xd5,
+	0x38,
+	0xed,
+	0xac,
+	0x02,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x38,
+	0xe9,
+	0x80,
+	0x85,
+	0xdf,
+	0x98,
+	0xe9,
+	0x00,
+	0x85,
+	0xe0,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xdf,
+	0xa5,
+	0xd5,
+	0xe5,
+	0xe0,
+	0x85,
+	0xd5,
+	0xa0,
+	0x03,
+	0x53,
+	0xd3,
+	0x00,
+	0xaa,
+	0x02,
+	0x18,
+	0xa5,
+	0xd4,
+	0x65,
+	0xd3,
+	0xb0,
+	0x02,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xd6,
+	0xfa,
+	0xa5,
+	0xd3,
+	0xdd,
+	0x71,
+	0x3c,
+	0x90,
+	0x16,
+	0xa9,
+	0x00,
+	0x85,
+	0xd8,
+	0xa5,
+	0xd3,
+	0xdd,
+	0x70,
+	0x3c,
+	0x90,
+	0x02,
+	0x80,
+	0x2a,
+	0xa5,
+	0xd6,
+	0xdd,
+	0x70,
+	0x3c,
+	0x90,
+	0x2f,
+	0x80,
+	0x27,
+	0xa5,
+	0xd6,
+	0xdd,
+	0x6f,
+	0x3c,
+	0x90,
+	0x2c,
+	0xa9,
+	0x01,
+	0x85,
+	0xd8,
+	0xa5,
+	0xd6,
+	0xdd,
+	0x70,
+	0x3c,
+	0x90,
+	0x02,
+	0x80,
+	0x13,
+	0xa5,
+	0xd5,
+	0xdd,
+	0x6e,
+	0x3c,
+	0x90,
+	0x12,
+	0xa9,
+	0x03,
+	0x85,
+	0xd9,
+	0x80,
+	0x27,
+	0xa9,
+	0x00,
+	0x85,
+	0xd9,
+	0x80,
+	0x21,
+	0xa9,
+	0x01,
+	0x85,
+	0xd9,
+	0x80,
+	0x1b,
+	0xa9,
+	0x02,
+	0x85,
+	0xd9,
+	0x80,
+	0x15,
+	0xa5,
+	0xd5,
+	0xdd,
+	0x6e,
+	0x3c,
+	0x90,
+	0x08,
+	0xa9,
+	0x03,
+	0x85,
+	0xd8,
+	0x85,
+	0xd9,
+	0x80,
+	0x06,
+	0xa9,
+	0x02,
+	0x85,
+	0xd8,
+	0x85,
+	0xd9,
+	0xa5,
+	0xd7,
+	0xc5,
+	0xd8,
+	0xf0,
+	0x02,
+	0xb0,
+	0x0c,
+	0xa5,
+	0xd8,
+	0xf0,
+	0x1a,
+	0x85,
+	0xd9,
+	0xa5,
+	0xd7,
+	0x85,
+	0xd8,
+	0x80,
+	0x12,
+	0xa5,
+	0xd8,
+	0xc9,
+	0x02,
+	0xd0,
+	0x08,
+	0xa5,
+	0xd7,
+	0x85,
+	0xd9,
+	0x85,
+	0xd8,
+	0x80,
+	0x04,
+	0xa5,
+	0xd7,
+	0x85,
+	0xd9,
+	0xa5,
+	0x7c,
+	0xd0,
+	0x05,
+	0xad,
+	0xa9,
+	0x02,
+	0xd0,
+	0x14,
+	0xa9,
+	0x01,
+	0x8d,
+	0xae,
+	0x02,
+	0x8d,
+	0xaf,
+	0x02,
+	0xa5,
+	0xd8,
+	0x8d,
+	0xb4,
+	0x02,
+	0xa5,
+	0xd9,
+	0x8d,
+	0xb5,
+	0x02,
+	0x80,
+	0x3c,
+	0xa5,
+	0xd8,
+	0xcd,
+	0xb4,
+	0x02,
+	0xd0,
+	0x0d,
+	0xad,
+	0xae,
+	0x02,
+	0xcd,
+	0x9e,
+	0x3c,
+	0xb0,
+	0x0f,
+	0xee,
+	0xae,
+	0x02,
+	0x80,
+	0x06,
+	0x8d,
+	0xb4,
+	0x02,
+	0x9c,
+	0xae,
+	0x02,
+	0xa5,
+	0x82,
+	0x85,
+	0xd8,
+	0xa5,
+	0xd9,
+	0xcd,
+	0xb5,
+	0x02,
+	0xd0,
+	0x0d,
+	0xad,
+	0xaf,
+	0x02,
+	0xcd,
+	0x9e,
+	0x3c,
+	0xb0,
+	0x0f,
+	0xee,
+	0xaf,
+	0x02,
+	0x80,
+	0x06,
+	0x8d,
+	0xb5,
+	0x02,
+	0x9c,
+	0xaf,
+	0x02,
+	0xa5,
+	0x83,
+	0x85,
+	0xd9,
+	0xa9,
+	0x01,
+	0x8d,
+	0xa9,
+	0x02,
+	0xa5,
+	0xd8,
+	0x20,
+	0xae,
+	0x0c,
+	0x8d,
+	0xb6,
+	0x02,
+	0x8e,
+	0xb7,
+	0x02,
+	0xa5,
+	0xd9,
+	0x20,
+	0xae,
+	0x0c,
+	0x8d,
+	0xb8,
+	0x02,
+	0x8e,
+	0xb9,
+	0x02,
+	0xa2,
+	0x00,
+	0xa0,
+	0x00,
+	0xc4,
+	0xc4,
+	0xb0,
+	0x1e,
+	0xa5,
+	0xc5,
+	0x29,
+	0x10,
+	0xf0,
+	0x03,
+	0x38,
+	0x80,
+	0x01,
+	0x18,
+	0x3e,
+	0x08,
+	0x2c,
+	0x3e,
+	0x09,
+	0x2c,
+	0x3e,
+	0x0a,
+	0x2c,
+	0x3e,
+	0x0b,
+	0x2c,
+	0xc8,
+	0x18,
+	0x8a,
+	0x69,
+	0x10,
+	0xaa,
+	0x80,
+	0xde,
+	0xa0,
+	0x50,
+	0x53,
+	0xfc,
+	0x2b,
+	0x52,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0x60,
+	0x60,
+	0xa5,
+	0x4c,
+	0x45,
+	0xd0,
+	0x85,
+	0xd3,
+	0x84,
+	0xd4,
+	0xa5,
+	0x4d,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xd5,
+	0xa5,
+	0x4e,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xd5,
+	0x85,
+	0xd5,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xd6,
+	0xa5,
+	0x4f,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xd6,
+	0x85,
+	0xd6,
+	0x60,
+	0xa0,
+	0x04,
+	0x13,
+	0x54,
+	0x60,
+	0x4c,
+	0x00,
+	0xa0,
+	0x04,
+	0x13,
+	0x54,
+	0x60,
+	0x44,
+	0x00,
+	0xa0,
+	0x04,
+	0x13,
+	0x54,
+	0x60,
+	0x48,
+	0x00,
+	0xa0,
+	0x02,
+	0x13,
+	0x54,
+	0x60,
+	0x54,
+	0x00,
+	0x38,
+	0xa5,
+	0x44,
+	0xe5,
+	0x48,
+	0x85,
+	0x50,
+	0xa5,
+	0x45,
+	0xe5,
+	0x49,
+	0x85,
+	0x51,
+	0xa5,
+	0x46,
+	0xe5,
+	0x4a,
+	0x85,
+	0x52,
+	0xa5,
+	0x47,
+	0xe5,
+	0x4b,
+	0x85,
+	0x53,
+	0x18,
+	0xa5,
+	0xd1,
+	0x69,
+	0x10,
+	0x85,
+	0xd1,
+	0x90,
+	0x02,
+	0xe6,
+	0xd2,
+	0xa0,
+	0x02,
+	0x53,
+	0xd1,
+	0x00,
+	0x0c,
+	0x60,
+	0xad,
+	0x9d,
+	0x3c,
+	0xc5,
+	0x55,
+	0x90,
+	0x0c,
+	0xd0,
+	0x07,
+	0xad,
+	0x9c,
+	0x3c,
+	0xc5,
+	0x54,
+	0x90,
+	0x03,
+	0x4c,
+	0x9d,
+	0x1f,
+	0xa5,
+	0x4f,
+	0xd0,
+	0x2b,
+	0xa5,
+	0x54,
+	0x45,
+	0xc3,
+	0x85,
+	0xdb,
+	0x84,
+	0xdc,
+	0xa5,
+	0x55,
+	0x45,
+	0xc3,
+	0x18,
+	0x65,
+	0xdc,
+	0x85,
+	0xdc,
+	0x98,
+	0x69,
+	0x00,
+	0xc5,
+	0x4e,
+	0x90,
+	0x13,
+	0xd0,
+	0x0e,
+	0xa5,
+	0xdc,
+	0xc5,
+	0x4d,
+	0x90,
+	0x0b,
+	0xd0,
+	0x06,
+	0xa5,
+	0xdb,
+	0xc5,
+	0x4c,
+	0x90,
+	0x03,
+	0x4c,
+	0x9d,
+	0x1f,
+	0xe6,
+	0x37,
+	0xa5,
+	0x87,
+	0x29,
+	0x01,
+	0xf0,
+	0x07,
+	0x18,
+	0xa5,
+	0x73,
+	0xe5,
+	0xcb,
+	0x80,
+	0x02,
+	0xa5,
+	0xcb,
+	0x45,
+	0x7d,
+	0xa8,
+	0xb9,
+	0x37,
+	0x27,
+	0x4a,
+	0xa8,
+	0xb1,
+	0xd9,
+	0xb0,
+	0x04,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x29,
+	0x0f,
+	0xa8,
+	0xad,
+	0xdd,
+	0x2b,
+	0xc9,
+	0x08,
+	0xf0,
+	0x17,
+	0xc9,
+	0x02,
+	0xf0,
+	0x09,
+	0xc9,
+	0x04,
+	0xf0,
+	0x0a,
+	0xb9,
+	0x50,
+	0x3c,
+	0x80,
+	0x0d,
+	0xb9,
+	0x4d,
+	0x3c,
+	0x80,
+	0x08,
+	0xb9,
+	0x4a,
+	0x3c,
+	0x80,
+	0x03,
+	0xb9,
+	0x47,
+	0x3c,
+	0x85,
+	0xce,
+	0xa5,
+	0x53,
+	0x29,
+	0x80,
+	0x85,
+	0xcd,
+	0xf0,
+	0x17,
+	0x38,
+	0xa9,
+	0x00,
+	0xaa,
+	0xe5,
+	0x50,
+	0x85,
+	0x50,
+	0x8a,
+	0xe5,
+	0x51,
+	0x85,
+	0x51,
+	0x8a,
+	0xe5,
+	0x52,
+	0x85,
+	0x52,
+	0x8a,
+	0xe5,
+	0x53,
+	0x85,
+	0x53,
+	0xa4,
+	0xcb,
+	0xb9,
+	0xd7,
+	0x2a,
+	0xa8,
+	0xb9,
+	0x37,
+	0x27,
+	0x4a,
+	0xa8,
+	0xb1,
+	0xd7,
+	0xb0,
+	0x04,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x29,
+	0x0f,
+	0xa8,
+	0xb9,
+	0x1d,
+	0x2b,
+	0x85,
+	0xd0,
+	0xa5,
+	0x50,
+	0x45,
+	0xd0,
+	0x85,
+	0x50,
+	0x84,
+	0xdf,
+	0xa5,
+	0x51,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xdf,
+	0x85,
+	0x51,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xdf,
+	0xa5,
+	0x52,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xdf,
+	0x85,
+	0x52,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xdf,
+	0xa5,
+	0x53,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xdf,
+	0x85,
+	0x53,
+	0xa5,
+	0xcd,
+	0xf0,
+	0x6a,
+	0xad,
+	0x65,
+	0x3c,
+	0x85,
+	0xd0,
+	0x20,
+	0x88,
+	0x1d,
+	0xa5,
+	0x53,
+	0xc5,
+	0xd6,
+	0x90,
+	0x27,
+	0xd0,
+	0x16,
+	0xa5,
+	0x52,
+	0xc5,
+	0xd5,
+	0x90,
+	0x1f,
+	0xd0,
+	0x0e,
+	0xa5,
+	0x51,
+	0xc5,
+	0xd4,
+	0x90,
+	0x17,
+	0xd0,
+	0x06,
+	0xa5,
+	0x50,
+	0xc5,
+	0xd3,
+	0x90,
+	0x0f,
+	0xe6,
+	0x38,
+	0x18,
+	0xa5,
+	0xce,
+	0x65,
+	0x3c,
+	0x85,
+	0x3c,
+	0x90,
+	0x7b,
+	0xe6,
+	0x3d,
+	0x80,
+	0x77,
+	0xad,
+	0x66,
+	0x3c,
+	0x85,
+	0xd0,
+	0x20,
+	0x88,
+	0x1d,
+	0xa5,
+	0x53,
+	0xc5,
+	0xd6,
+	0x90,
+	0x4d,
+	0xd0,
+	0x16,
+	0xa5,
+	0x52,
+	0xc5,
+	0xd5,
+	0x90,
+	0x45,
+	0xd0,
+	0x0e,
+	0xa5,
+	0x51,
+	0xc5,
+	0xd4,
+	0x90,
+	0x3d,
+	0xd0,
+	0x06,
+	0xa5,
+	0x50,
+	0xc5,
+	0xd3,
+	0x90,
+	0x35,
+	0xe6,
+	0x39,
+	0x18,
+	0xa5,
+	0xce,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x90,
+	0x46,
+	0xe6,
+	0x3f,
+	0x80,
+	0x42,
+	0xad,
+	0x67,
+	0x3c,
+	0x85,
+	0xd0,
+	0x20,
+	0x88,
+	0x1d,
+	0xa5,
+	0xd6,
+	0xc5,
+	0x53,
+	0x90,
+	0x27,
+	0xd0,
+	0x16,
+	0xa5,
+	0xd5,
+	0xc5,
+	0x52,
+	0x90,
+	0x1f,
+	0xd0,
+	0x0e,
+	0xa5,
+	0xd4,
+	0xc5,
+	0x51,
+	0x90,
+	0x17,
+	0xd0,
+	0x06,
+	0xa5,
+	0xd3,
+	0xc5,
+	0x50,
+	0x90,
+	0x0f,
+	0xe6,
+	0x3a,
+	0x18,
+	0xa5,
+	0xce,
+	0x65,
+	0x40,
+	0x85,
+	0x40,
+	0x90,
+	0x11,
+	0xe6,
+	0x41,
+	0x80,
+	0x0d,
+	0xe6,
+	0x3b,
+	0x18,
+	0xa5,
+	0xce,
+	0x65,
+	0x42,
+	0x85,
+	0x42,
+	0x90,
+	0x02,
+	0xe6,
+	0x43,
+	0xa5,
+	0xc4,
+	0xd0,
+	0x01,
+	0x60,
+	0xa6,
+	0xcb,
+	0xbd,
+	0xf3,
+	0x2a,
+	0x25,
+	0x21,
+	0xd0,
+	0x01,
+	0x60,
+	0x85,
+	0xdd,
+	0xa2,
+	0x00,
+	0xa0,
+	0x00,
+	0xa9,
+	0x01,
+	0x85,
+	0xde,
+	0x25,
+	0xdd,
+	0xd0,
+	0x03,
+	0x4c,
+	0x36,
+	0x20,
+	0x18,
+	0xa5,
+	0x4c,
+	0x7d,
+	0xfc,
+	0x2b,
+	0x9d,
+	0xfc,
+	0x2b,
+	0xa5,
+	0x4d,
+	0x7d,
+	0xfd,
+	0x2b,
+	0x9d,
+	0xfd,
+	0x2b,
+	0xa5,
+	0x4e,
+	0x7d,
+	0xfe,
+	0x2b,
+	0x9d,
+	0xfe,
+	0x2b,
+	0xa5,
+	0x4f,
+	0x7d,
+	0xff,
+	0x2b,
+	0x9d,
+	0xff,
+	0x2b,
+	0x18,
+	0xa5,
+	0x44,
+	0x7d,
+	0x00,
+	0x2c,
+	0x9d,
+	0x00,
+	0x2c,
+	0xa5,
+	0x45,
+	0x7d,
+	0x01,
+	0x2c,
+	0x9d,
+	0x01,
+	0x2c,
+	0xa5,
+	0x46,
+	0x7d,
+	0x02,
+	0x2c,
+	0x9d,
+	0x02,
+	0x2c,
+	0xa5,
+	0x47,
+	0x7d,
+	0x03,
+	0x2c,
+	0x9d,
+	0x03,
+	0x2c,
+	0x18,
+	0xa5,
+	0x48,
+	0x7d,
+	0x04,
+	0x2c,
+	0x9d,
+	0x04,
+	0x2c,
+	0xa5,
+	0x49,
+	0x7d,
+	0x05,
+	0x2c,
+	0x9d,
+	0x05,
+	0x2c,
+	0xa5,
+	0x4a,
+	0x7d,
+	0x06,
+	0x2c,
+	0x9d,
+	0x06,
+	0x2c,
+	0xa5,
+	0x4b,
+	0x7d,
+	0x07,
+	0x2c,
+	0x9d,
+	0x07,
+	0x2c,
+	0x18,
+	0xa5,
+	0x54,
+	0x7d,
+	0x08,
+	0x2c,
+	0x9d,
+	0x08,
+	0x2c,
+	0xa5,
+	0x55,
+	0x7d,
+	0x09,
+	0x2c,
+	0x9d,
+	0x09,
+	0x2c,
+	0x90,
+	0x03,
+	0xfe,
+	0x0a,
+	0x2c,
+	0xc8,
+	0xc4,
+	0xc4,
+	0xb0,
+	0x0b,
+	0x18,
+	0x8a,
+	0x69,
+	0x10,
+	0xaa,
+	0xa5,
+	0xde,
+	0x0a,
+	0x4c,
+	0xb4,
+	0x1f,
+	0x60,
+	0xaa,
+	0xa5,
+	0x7a,
+	0xd0,
+	0x02,
+	0x80,
+	0x6d,
+	0xa5,
+	0x7b,
+	0xc9,
+	0x00,
+	0xf0,
+	0x67,
+	0x8a,
+	0x29,
+	0x01,
+	0xf0,
+	0x06,
+	0xa2,
+	0x38,
+	0xa9,
+	0x04,
+	0x80,
+	0x04,
+	0xa2,
+	0x38,
+	0xa9,
+	0x03,
+	0x8e,
+	0x0c,
+	0x60,
+	0x8d,
+	0x0d,
+	0x60,
+	0x85,
+	0xd2,
+	0x86,
+	0xd1,
+	0xa4,
+	0xbd,
+	0xb9,
+	0x03,
+	0x2b,
+	0x85,
+	0x21,
+	0xb9,
+	0xe7,
+	0x2a,
+	0xa8,
+	0xb9,
+	0x47,
+	0x27,
+	0x49,
+	0x04,
+	0x18,
+	0x69,
+	0x10,
+	0x85,
+	0xd7,
+	0xa9,
+	0x00,
+	0x69,
+	0x3c,
+	0x85,
+	0xd8,
+	0xa5,
+	0x87,
+	0x29,
+	0x02,
+	0xf0,
+	0x07,
+	0x18,
+	0xa5,
+	0x74,
+	0xe5,
+	0xbd,
+	0x80,
+	0x02,
+	0xa5,
+	0xbd,
+	0x45,
+	0x7e,
+	0xa8,
+	0xb9,
+	0x47,
+	0x27,
+	0x49,
+	0x04,
+	0x18,
+	0x69,
+	0x2f,
+	0x85,
+	0xd9,
+	0xa9,
+	0x00,
+	0x69,
+	0x3c,
+	0x85,
+	0xda,
+	0x64,
+	0xcb,
+	0xa6,
+	0x73,
+	0x86,
+	0xcc,
+	0x80,
+	0x02,
+	0xe6,
+	0xcb,
+	0x20,
+	0xb6,
+	0x1d,
+	0xc6,
+	0xcc,
+	0xd0,
+	0xf7,
+	0xe6,
+	0xbd,
+	0x60,
+	0x64,
+	0xd1,
+	0x64,
+	0xd2,
+	0xa2,
+	0x10,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0xa5,
+	0xd1,
+	0x38,
+	0xe5,
+	0xcb,
+	0xa8,
+	0xa5,
+	0xd2,
+	0xe9,
+	0x00,
+	0x90,
+	0x06,
+	0x85,
+	0xd2,
+	0x84,
+	0xd1,
+	0xe6,
+	0xcf,
+	0xca,
+	0xd0,
+	0xe3,
+	0x60,
+	0x18,
+	0xa5,
+	0xcf,
+	0x65,
+	0xd3,
+	0x85,
+	0xd3,
+	0xa2,
+	0x00,
+	0xa5,
+	0xd0,
+	0x10,
+	0x02,
+	0xa2,
+	0xff,
+	0x86,
+	0xcb,
+	0x65,
+	0xd4,
+	0x85,
+	0xd4,
+	0xa5,
+	0xd5,
+	0x65,
+	0xcb,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd6,
+	0x65,
+	0xcb,
+	0x85,
+	0xd6,
+	0x60,
+	0xa5,
+	0xcf,
+	0x45,
+	0xd1,
+	0x85,
+	0xd3,
+	0x84,
+	0xd4,
+	0xa5,
+	0xcf,
+	0x45,
+	0xd2,
+	0x18,
+	0x65,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xd5,
+	0x64,
+	0xd6,
+	0xa5,
+	0xd0,
+	0x45,
+	0xd1,
+	0x18,
+	0x65,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0x65,
+	0xd5,
+	0x85,
+	0xd5,
+	0x90,
+	0x02,
+	0xe6,
+	0xd6,
+	0xa5,
+	0xd0,
+	0x45,
+	0xd2,
+	0x18,
+	0x65,
+	0xd5,
+	0x85,
+	0xd5,
+	0x98,
+	0x65,
+	0xd6,
+	0x85,
+	0xd6,
+	0x60,
+	0x20,
+	0x04,
+	0x21,
+	0xa5,
+	0xd2,
+	0x10,
+	0x0d,
+	0x38,
+	0xa5,
+	0xd5,
+	0xe5,
+	0xcf,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd6,
+	0xe5,
+	0xd0,
+	0x85,
+	0xd6,
+	0x60,
+	0xfc,
+	0x49,
+	0x20,
+	0x98,
+	0x4a,
+	0x69,
+	0x00,
+	0x85,
+	0xcb,
+	0x8a,
+	0x49,
+	0x10,
+	0xc0,
+	0x00,
+	0xd0,
+	0x09,
+	0x18,
+	0x65,
+	0xcb,
+	0xb0,
+	0x04,
+	0xc9,
+	0x7f,
+	0x90,
+	0x02,
+	0xa9,
+	0x7f,
+	0x60,
+	0xfc,
+	0x49,
+	0x10,
+	0x98,
+	0x4a,
+	0x69,
+	0x00,
+	0x85,
+	0xcb,
+	0x8a,
+	0x49,
+	0x08,
+	0x18,
+	0x65,
+	0xcb,
+	0xd0,
+	0x01,
+	0x3a,
+	0x60,
+	0x20,
+	0xa6,
+	0x21,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x90,
+	0x06,
+	0xe6,
+	0xcf,
+	0xd0,
+	0x02,
+	0xe6,
+	0xd0,
+	0x38,
+	0xa5,
+	0xd1,
+	0xe5,
+	0xcf,
+	0xa5,
+	0xd2,
+	0xe5,
+	0xd0,
+	0x30,
+	0x0a,
+	0xe6,
+	0xd3,
+	0xd0,
+	0x06,
+	0xe6,
+	0xd4,
+	0xd0,
+	0x02,
+	0xe6,
+	0xd5,
+	0x60,
+	0x64,
+	0xd1,
+	0x64,
+	0xd2,
+	0x64,
+	0xcb,
+	0xa2,
+	0x18,
+	0x06,
+	0xd3,
+	0x26,
+	0xd4,
+	0x26,
+	0xd5,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x26,
+	0xcb,
+	0xa5,
+	0xd1,
+	0x38,
+	0xe5,
+	0xcf,
+	0xa8,
+	0xa5,
+	0xd2,
+	0xe5,
+	0xd0,
+	0x85,
+	0xcc,
+	0xa5,
+	0xcb,
+	0xe9,
+	0x00,
+	0x90,
+	0x0a,
+	0x85,
+	0xcb,
+	0xa5,
+	0xcc,
+	0x85,
+	0xd2,
+	0x84,
+	0xd1,
+	0xe6,
+	0xd3,
+	0xca,
+	0xd0,
+	0xd5,
+	0x60,
+	0xa9,
+	0x00,
+	0xaa,
+	0x38,
+	0xe5,
+	0xd3,
+	0x85,
+	0xd3,
+	0x8a,
+	0xe5,
+	0xd4,
+	0x85,
+	0xd4,
+	0x8a,
+	0xe5,
+	0xd5,
+	0x85,
+	0xd5,
+	0x8a,
+	0xe5,
+	0xd6,
+	0x85,
+	0xd6,
+	0x8a,
+	0x38,
+	0xe5,
+	0xd7,
+	0x85,
+	0xd7,
+	0x8a,
+	0xe5,
+	0xd8,
+	0x85,
+	0xd8,
+	0x8a,
+	0xe5,
+	0xd9,
+	0x85,
+	0xd9,
+	0x8a,
+	0xe5,
+	0xda,
+	0x85,
+	0xda,
+	0x60,
+	0xa5,
+	0xd6,
+	0x05,
+	0xda,
+	0xf0,
+	0x2b,
+	0x38,
+	0xa5,
+	0xd6,
+	0xe5,
+	0xda,
+	0x30,
+	0x04,
+	0xa5,
+	0xd6,
+	0x80,
+	0x11,
+	0xa5,
+	0xda,
+	0x80,
+	0x0d,
+	0x26,
+	0xd4,
+	0x26,
+	0xd5,
+	0x26,
+	0xd6,
+	0x26,
+	0xd8,
+	0x26,
+	0xd9,
+	0x26,
+	0xda,
+	0x0a,
+	0x10,
+	0xf1,
+	0xa0,
+	0x02,
+	0x53,
+	0xd5,
+	0x00,
+	0xcf,
+	0x00,
+	0x53,
+	0xd9,
+	0x00,
+	0xd1,
+	0x00,
+	0x60,
+	0xa5,
+	0xd5,
+	0x05,
+	0xd9,
+	0xf0,
+	0x2b,
+	0x38,
+	0xa5,
+	0xd5,
+	0xe5,
+	0xd9,
+	0x30,
+	0x04,
+	0xa5,
+	0xd5,
+	0x80,
+	0x11,
+	0xa5,
+	0xd9,
+	0x80,
+	0x0d,
+	0x26,
+	0xd3,
+	0x26,
+	0xd4,
+	0x26,
+	0xd5,
+	0x26,
+	0xd7,
+	0x26,
+	0xd8,
+	0x26,
+	0xd9,
+	0x0a,
+	0x10,
+	0xf1,
+	0xa0,
+	0x02,
+	0x53,
+	0xd4,
+	0x00,
+	0xcf,
+	0x00,
+	0x53,
+	0xd8,
+	0x00,
+	0xd1,
+	0x00,
+	0x60,
+	0xa5,
+	0xd4,
+	0x30,
+	0x0e,
+	0xa5,
+	0xd8,
+	0x30,
+	0x0a,
+	0x06,
+	0xd3,
+	0x26,
+	0xd4,
+	0x06,
+	0xd7,
+	0x26,
+	0xd8,
+	0x80,
+	0xee,
+	0xa0,
+	0x02,
+	0x53,
+	0xd3,
+	0x00,
+	0xcf,
+	0x00,
+	0x53,
+	0xd7,
+	0x00,
+	0xd1,
+	0x00,
+	0x60,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0x3d,
+	0x26,
+	0x48,
+	0xf8,
+	0xad,
+	0x08,
+	0x68,
+	0xc9,
+	0x01,
+	0xd0,
+	0x3d,
+	0xa5,
+	0x12,
+	0xf0,
+	0x17,
+	0x64,
+	0x12,
+	0xa5,
+	0x11,
+	0x09,
+	0x03,
+	0x85,
+	0x11,
+	0xa0,
+	0x48,
+	0x53,
+	0x0b,
+	0x02,
+	0x24,
+	0x2b,
+	0xad,
+	0xa4,
+	0x02,
+	0x8d,
+	0x6b,
+	0x2b,
+	0x80,
+	0x15,
+	0xe6,
+	0x12,
+	0xa5,
+	0x11,
+	0x09,
+	0x30,
+	0x85,
+	0x11,
+	0xa0,
+	0x48,
+	0x53,
+	0x0b,
+	0x02,
+	0x6c,
+	0x2b,
+	0xad,
+	0xa4,
+	0x02,
+	0x8d,
+	0xb3,
+	0x2b,
+	0x9c,
+	0x18,
+	0x68,
+	0xee,
+	0x18,
+	0x68,
+	0xa5,
+	0x10,
+	0xd0,
+	0x03,
+	0x20,
+	0xca,
+	0x26,
+	0x4c,
+	0x9f,
+	0x26,
+	0xa9,
+	0x01,
+	0x8d,
+	0x18,
+	0x68,
+	0x68,
+	0x68,
+	0x68,
+	0xa9,
+	0x03,
+	0x48,
+	0xa9,
+	0x00,
+	0x48,
+	0xba,
+	0xda,
+	0x40,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0x3d,
+	0x26,
+	0x48,
+	0xf8,
+	0xad,
+	0x34,
+	0x60,
+	0xaa,
+	0x29,
+	0x03,
+	0xc9,
+	0x02,
+	0xd0,
+	0x0f,
+	0xda,
+	0x64,
+	0x10,
+	0x20,
+	0xca,
+	0x26,
+	0xfa,
+	0xa5,
+	0x7f,
+	0x29,
+	0x02,
+	0xf0,
+	0x07,
+	0x80,
+	0x26,
+	0x8a,
+	0x29,
+	0xf8,
+	0xf0,
+	0x2b,
+	0x8a,
+	0x29,
+	0x04,
+	0x48,
+	0x4a,
+	0x4a,
+	0x20,
+	0x47,
+	0x20,
+	0xa5,
+	0xbc,
+	0xf0,
+	0x13,
+	0xc6,
+	0xbc,
+	0x68,
+	0xd0,
+	0x07,
+	0xa9,
+	0x09,
+	0x8d,
+	0x38,
+	0x60,
+	0x80,
+	0x31,
+	0xa9,
+	0x0d,
+	0x8d,
+	0x38,
+	0x60,
+	0x80,
+	0x2a,
+	0x68,
+	0x20,
+	0x7d,
+	0x1a,
+	0xa9,
+	0x01,
+	0x8d,
+	0x24,
+	0x68,
+	0x80,
+	0x1f,
+	0xa5,
+	0x8c,
+	0xf0,
+	0x1b,
+	0x3a,
+	0x85,
+	0x8c,
+	0x8a,
+	0x29,
+	0x04,
+	0x48,
+	0x4a,
+	0x4a,
+	0x20,
+	0x05,
+	0x1a,
+	0x68,
+	0xd0,
+	0x07,
+	0xa9,
+	0x01,
+	0x8d,
+	0x38,
+	0x60,
+	0x80,
+	0x05,
+	0xa9,
+	0x05,
+	0x8d,
+	0x38,
+	0x60,
+	0x4c,
+	0x9f,
+	0x26,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0x3d,
+	0x26,
+	0x48,
+	0xee,
+	0xa5,
+	0x02,
+	0xd0,
+	0x03,
+	0xee,
+	0xa6,
+	0x02,
+	0xa0,
+	0x4f,
+	0x9c,
+	0x52,
+	0x02,
+	0x13,
+	0x52,
+	0x02,
+	0x53,
+	0x02,
+	0x9c,
+	0x24,
+	0x68,
+	0xee,
+	0x24,
+	0x68,
+	0x64,
+	0x10,
+	0x20,
+	0xca,
+	0x26,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0x60,
+	0x4c,
+	0xa6,
+	0x26,
+	0x08,
+	0x78,
+	0x68,
+	0x8a,
+	0x29,
+	0xf0,
+	0xf0,
+	0x09,
+	0x8a,
+	0x29,
+	0x0f,
+	0xf0,
+	0x22,
+	0xa5,
+	0x12,
+	0xd0,
+	0x1e,
+	0x8a,
+	0x29,
+	0xf0,
+	0x85,
+	0x11,
+	0x64,
+	0x14,
+	0x8a,
+	0x29,
+	0x02,
+	0x85,
+	0x15,
+	0xa9,
+	0x28,
+	0x8d,
+	0xae,
+	0x2c,
+	0x64,
+	0x6f,
+	0x64,
+	0x70,
+	0xa0,
+	0x48,
+	0x53,
+	0x24,
+	0x2b,
+	0xb4,
+	0x2b,
+	0x80,
+	0x22,
+	0x8a,
+	0x29,
+	0x0f,
+	0x85,
+	0x11,
+	0xa9,
+	0x01,
+	0x85,
+	0x14,
+	0x8a,
+	0x29,
+	0x20,
+	0x85,
+	0x15,
+	0xa9,
+	0x28,
+	0x8d,
+	0x11,
+	0x2d,
+	0xa9,
+	0x38,
+	0x85,
+	0x6f,
+	0xa9,
+	0x03,
+	0x85,
+	0x70,
+	0xa0,
+	0x48,
+	0x53,
+	0x6c,
+	0x2b,
+	0xb4,
+	0x2b,
+	0x58,
+	0xa5,
+	0x15,
+	0xd0,
+	0x38,
+	0xa0,
+	0x70,
+	0xa5,
+	0x14,
+	0xd0,
+	0x0e,
+	0x53,
+	0xbf,
+	0x29,
+	0x9f,
+	0x2a,
+	0xa0,
+	0x63,
+	0x53,
+	0x4c,
+	0x2c,
+	0x65,
+	0x00,
+	0x80,
+	0x0c,
+	0x53,
+	0x2f,
+	0x2a,
+	0x9f,
+	0x2a,
+	0xa0,
+	0x63,
+	0x53,
+	0xaf,
+	0x2c,
+	0x65,
+	0x00,
+	0xa5,
+	0x72,
+	0xcd,
+	0xa8,
+	0x02,
+	0xd0,
+	0x0b,
+	0xa5,
+	0x71,
+	0xcd,
+	0xa7,
+	0x02,
+	0xd0,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x7c,
+	0xa5,
+	0x15,
+	0x20,
+	0x1b,
+	0x04,
+	0x85,
+	0xc7,
+	0xf0,
+	0x03,
+	0x4c,
+	0xa5,
+	0x24,
+	0x64,
+	0x8d,
+	0x64,
+	0xbd,
+	0xa0,
+	0x02,
+	0x53,
+	0x6f,
+	0x00,
+	0x30,
+	0x60,
+	0xa9,
+	0x00,
+	0x8d,
+	0x0c,
+	0x60,
+	0x9c,
+	0x0d,
+	0x60,
+	0xa5,
+	0x73,
+	0x0a,
+	0xa8,
+	0x43,
+	0x9f,
+	0x2a,
+	0x54,
+	0x60,
+	0xa9,
+	0x20,
+	0x8d,
+	0x0c,
+	0x60,
+	0x9c,
+	0x0d,
+	0x60,
+	0xa5,
+	0x74,
+	0x0a,
+	0xa8,
+	0x43,
+	0xbf,
+	0x2a,
+	0x54,
+	0x60,
+	0xa5,
+	0x74,
+	0x85,
+	0x8c,
+	0x3a,
+	0x85,
+	0xbc,
+	0xa9,
+	0x02,
+	0x48,
+	0x20,
+	0x05,
+	0x1a,
+	0x68,
+	0xc6,
+	0x8c,
+	0xf0,
+	0x03,
+	0x3a,
+	0xd0,
+	0xf4,
+	0xa5,
+	0x14,
+	0xd0,
+	0x20,
+	0xa0,
+	0x93,
+	0x53,
+	0x18,
+	0x29,
+	0xf2,
+	0x27,
+	0xa0,
+	0x07,
+	0x53,
+	0x1d,
+	0x2b,
+	0x0f,
+	0x2b,
+	0xa0,
+	0x70,
+	0x53,
+	0x9f,
+	0x2a,
+	0xbf,
+	0x29,
+	0xa0,
+	0x63,
+	0x53,
+	0x65,
+	0x00,
+	0x4c,
+	0x2c,
+	0xa2,
+	0x00,
+	0x80,
+	0x38,
+	0xa0,
+	0x93,
+	0x53,
+	0x18,
+	0x29,
+	0x85,
+	0x28,
+	0xa0,
+	0x07,
+	0x53,
+	0x1d,
+	0x2b,
+	0x16,
+	0x2b,
+	0xa0,
+	0x70,
+	0x53,
+	0x9f,
+	0x2a,
+	0x2f,
+	0x2a,
+	0xa0,
+	0x63,
+	0x53,
+	0x65,
+	0x00,
+	0xaf,
+	0x2c,
+	0xa2,
+	0x01,
+	0x80,
+	0x18,
+	0xa6,
+	0x14,
+	0xd0,
+	0x0b,
+	0xa0,
+	0x63,
+	0x53,
+	0x65,
+	0x00,
+	0x4c,
+	0x2c,
+	0xa2,
+	0x00,
+	0x80,
+	0x09,
+	0xa0,
+	0x63,
+	0x53,
+	0x65,
+	0x00,
+	0xaf,
+	0x2c,
+	0xa2,
+	0x01,
+	0xa5,
+	0x15,
+	0xf0,
+	0x04,
+	0x86,
+	0x13,
+	0x64,
+	0x15,
+	0x9c,
+	0x1c,
+	0x68,
+	0xee,
+	0x1c,
+	0x68,
+	0x60,
+	0xf8,
+	0xa6,
+	0x11,
+	0xda,
+	0xa6,
+	0x11,
+	0xf0,
+	0x05,
+	0x20,
+	0x87,
+	0x23,
+	0x80,
+	0xf7,
+	0xfa,
+	0xf0,
+	0x0f,
+	0xad,
+	0xba,
+	0x02,
+	0xf0,
+	0x0a,
+	0xa0,
+	0x02,
+	0x53,
+	0x71,
+	0x00,
+	0x09,
+	0x02,
+	0x20,
+	0x06,
+	0x25,
+	0x9c,
+	0xe9,
+	0x27,
+	0x4c,
+	0xbc,
+	0x26,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0x3d,
+	0x26,
+	0x48,
+	0xf8,
+	0xad,
+	0x0c,
+	0x68,
+	0xc9,
+	0x01,
+	0xd0,
+	0x03,
+	0x20,
+	0x06,
+	0x25,
+	0x4c,
+	0x9f,
+	0x26,
+	0x9c,
+	0x20,
+	0x68,
+	0x9c,
+	0x24,
+	0x68,
+	0x9c,
+	0x28,
+	0x68,
+	0xa2,
+	0x00,
+	0xad,
+	0x0a,
+	0x02,
+	0xcd,
+	0x59,
+	0x2c,
+	0xd0,
+	0x09,
+	0xad,
+	0x09,
+	0x02,
+	0xcd,
+	0x58,
+	0x2c,
+	0xd0,
+	0x01,
+	0xe8,
+	0xad,
+	0x0a,
+	0x02,
+	0xcd,
+	0xbc,
+	0x2c,
+	0xd0,
+	0x0a,
+	0xad,
+	0x09,
+	0x02,
+	0xcd,
+	0xbb,
+	0x2c,
+	0xd0,
+	0x02,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x00,
+	0xd0,
+	0x06,
+	0xa9,
+	0x04,
+	0x85,
+	0xc7,
+	0x80,
+	0x46,
+	0xe0,
+	0x01,
+	0xf0,
+	0x08,
+	0xe0,
+	0x02,
+	0xf0,
+	0x22,
+	0xa5,
+	0x13,
+	0xd0,
+	0x1e,
+	0xa0,
+	0x63,
+	0x53,
+	0x4c,
+	0x2c,
+	0x65,
+	0x00,
+	0xa0,
+	0x93,
+	0x53,
+	0xf2,
+	0x27,
+	0x18,
+	0x29,
+	0xa0,
+	0x07,
+	0x53,
+	0x0f,
+	0x2b,
+	0x1d,
+	0x2b,
+	0xa0,
+	0x38,
+	0x53,
+	0xf7,
+	0x29,
+	0xd7,
+	0x2a,
+	0x80,
+	0x1c,
+	0xa0,
+	0x63,
+	0x53,
+	0xaf,
+	0x2c,
+	0x65,
+	0x00,
+	0xa0,
+	0x93,
+	0x53,
+	0x85,
+	0x28,
+	0x18,
+	0x29,
+	0xa0,
+	0x07,
+	0x53,
+	0x16,
+	0x2b,
+	0x1d,
+	0x2b,
+	0xa0,
+	0x38,
+	0x53,
+	0x67,
+	0x2a,
+	0xd7,
+	0x2a,
+	0xa5,
+	0x11,
+	0xae,
+	0xae,
+	0x2c,
+	0xe0,
+	0x00,
+	0xf0,
+	0x0c,
+	0xe0,
+	0x28,
+	0xd0,
+	0x0a,
+	0xa6,
+	0x15,
+	0xe0,
+	0x00,
+	0xf0,
+	0x02,
+	0x09,
+	0x03,
+	0x09,
+	0x01,
+	0xae,
+	0x11,
+	0x2d,
+	0xe0,
+	0x00,
+	0xf0,
+	0x0c,
+	0xe0,
+	0x28,
+	0xd0,
+	0x0a,
+	0xa6,
+	0x15,
+	0xe0,
+	0x00,
+	0xf0,
+	0x02,
+	0x09,
+	0x30,
+	0x09,
+	0x10,
+	0x85,
+	0x11,
+	0xa5,
+	0xc7,
+	0xf0,
+	0x0f,
+	0xc9,
+	0x28,
+	0xd0,
+	0x02,
+	0xa9,
+	0x04,
+	0x8d,
+	0x08,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x28,
+	0x68,
+	0x60,
+	0x8d,
+	0x08,
+	0x02,
+	0xa0,
+	0x03,
+	0x53,
+	0x84,
+	0x00,
+	0xb0,
+	0x02,
+	0xa0,
+	0x02,
+	0x53,
+	0x71,
+	0x00,
+	0xa7,
+	0x02,
+	0xa5,
+	0xc5,
+	0x8d,
+	0xbc,
+	0x02,
+	0xa5,
+	0xc6,
+	0x8d,
+	0xbb,
+	0x02,
+	0x20,
+	0x6f,
+	0x18,
+	0xa9,
+	0x02,
+	0x8d,
+	0x38,
+	0x60,
+	0xa9,
+	0x01,
+	0x8d,
+	0x38,
+	0x60,
+	0xa9,
+	0x05,
+	0x8d,
+	0x38,
+	0x60,
+	0xa9,
+	0x09,
+	0x8d,
+	0x38,
+	0x60,
+	0xa5,
+	0x7f,
+	0x29,
+	0x02,
+	0xd0,
+	0x0e,
+	0xa9,
+	0x0d,
+	0x8d,
+	0x38,
+	0x60,
+	0xa0,
+	0x0c,
+	0x64,
+	0x37,
+	0x13,
+	0x37,
+	0x00,
+	0x38,
+	0x00,
+	0x18,
+	0xad,
+	0xa2,
+	0x02,
+	0x69,
+	0x01,
+	0x8d,
+	0xa2,
+	0x02,
+	0xad,
+	0xa3,
+	0x02,
+	0x69,
+	0x00,
+	0x8d,
+	0xa3,
+	0x02,
+	0xa5,
+	0x7a,
+	0x8d,
+	0xad,
+	0x02,
+	0xa5,
+	0x7c,
+	0x8d,
+	0xb3,
+	0x02,
+	0xa0,
+	0x4f,
+	0x9c,
+	0xfc,
+	0x2b,
+	0x13,
+	0xfc,
+	0x2b,
+	0xfd,
+	0x2b,
+	0x9c,
+	0xe9,
+	0x27,
+	0xa9,
+	0x01,
+	0x8d,
+	0x20,
+	0x68,
+	0x85,
+	0x10,
+	0x64,
+	0xc7,
+	0x60,
+	0xba,
+	0x08,
+	0x78,
+	0x68,
+	0x48,
+	0x29,
+	0x1c,
+	0x85,
+	0xca,
+	0x86,
+	0xc8,
+	0xa9,
+	0x01,
+	0x85,
+	0xc9,
+	0xa0,
+	0x06,
+	0xb1,
+	0xc8,
+	0x48,
+	0x29,
+	0x1c,
+	0xc5,
+	0xca,
+	0x90,
+	0x08,
+	0x7a,
+	0xa0,
+	0x09,
+	0xb1,
+	0xc8,
+	0x48,
+	0x29,
+	0x1c,
+	0xc9,
+	0x00,
+	0xd0,
+	0x38,
+	0xa0,
+	0x03,
+	0xb1,
+	0xc8,
+	0xe0,
+	0x7f,
+	0xb0,
+	0x18,
+	0x8d,
+	0xea,
+	0x27,
+	0xc8,
+	0xb1,
+	0xc8,
+	0x8d,
+	0xeb,
+	0x27,
+	0xc8,
+	0xb1,
+	0xc8,
+	0x8d,
+	0xec,
+	0x27,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0xed,
+	0x27,
+	0x80,
+	0x16,
+	0x8d,
+	0xee,
+	0x27,
+	0xc8,
+	0xb1,
+	0xc8,
+	0x8d,
+	0xef,
+	0x27,
+	0xc8,
+	0xb1,
+	0xc8,
+	0x8d,
+	0xf0,
+	0x27,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0xf1,
+	0x27,
+	0xa9,
+	0x00,
+	0xfa,
+	0x28,
+	0xf8,
+	0x60,
+	0x68,
+	0xf0,
+	0x04,
+	0x68,
+	0xfa,
+	0x7a,
+	0x40,
+	0x08,
+	0x78,
+	0x68,
+	0xad,
+	0xe9,
+	0x27,
+	0xf0,
+	0x0e,
+	0xae,
+	0xed,
+	0x27,
+	0x9a,
+	0xad,
+	0xea,
+	0x27,
+	0xae,
+	0xeb,
+	0x27,
+	0xac,
+	0xec,
+	0x27,
+	0x40,
+	0xae,
+	0xf1,
+	0x27,
+	0x9a,
+	0xad,
+	0xee,
+	0x27,
+	0xae,
+	0xef,
+	0x27,
+	0xac,
+	0xf0,
+	0x27,
+	0x40,
+	0x08,
+	0x78,
+	0xad,
+	0xe9,
+	0x27,
+	0xd0,
+	0x1f,
+	0x1a,
+	0x8d,
+	0xe9,
+	0x27,
+	0xa9,
+	0x7c,
+	0x8d,
+	0xed,
+	0x27,
+	0x9c,
+	0xea,
+	0x27,
+	0x9c,
+	0xeb,
+	0x27,
+	0x9c,
+	0xec,
+	0x27,
+	0xa9,
+	0x24,
+	0x8d,
+	0x7f,
+	0x01,
+	0xa9,
+	0xcc,
+	0x8d,
+	0x7e,
+	0x01,
+	0x9c,
+	0x7d,
+	0x01,
+	0x28,
+	0x60,
+	0x64,
+	0xd3,
+	0x64,
+	0xd4,
+	0xa2,
+	0x10,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x26,
+	0xd3,
+	0x26,
+	0xd4,
+	0xa5,
+	0xd3,
+	0x38,
+	0xe5,
+	0xd1,
+	0xa8,
+	0xa5,
+	0xd4,
+	0xe5,
+	0xd2,
+	0x90,
+	0x06,
+	0x85,
+	0xd4,
+	0x84,
+	0xd3,
+	0xe6,
+	0xcf,
+	0xca,
+	0xd0,
+	0xe3,
+	0x60,
+	0x20,
+	0xf2,
+	0x26,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x90,
+	0x06,
+	0xe6,
+	0xd1,
+	0xd0,
+	0x02,
+	0xe6,
+	0xd2,
+	0x38,
+	0xa5,
+	0xd3,
+	0xe5,
+	0xd1,
+	0xa5,
+	0xd4,
+	0xe5,
+	0xd2,
+	0x30,
+	0x06,
+	0xe6,
+	0xcf,
+	0xd0,
+	0x02,
+	0xe6,
+	0xd0,
+	0x60,
+	0x00,
+	0x01,
+	0x02,
+	0x03,
+	0x04,
+	0x05,
+	0x06,
+	0x07,
+	0x07,
+	0x06,
+	0x05,
+	0x04,
+	0x03,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x02,
+	0x03,
+	0x04,
+	0x05,
+	0x05,
+	0x04,
+	0x03,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x81,
+	0x02,
+	0x42,
+	0x82,
+	0xc2,
+	0x03,
+	0x23,
+	0x43,
+	0x63,
+	0x83,
+	0xa3,
+	0xc3,
+	0xe3,
+	0x04,
+	0x14,
+	0x24,
+	0x34,
+	0x44,
+	0x54,
+	0x64,
+	0x74,
+	0x84,
+	0x94,
+	0xa4,
+	0xb4,
+	0xc4,
+	0xd4,
+	0xe4,
+	0xf4,
+	0x05,
+	0x05,
+	0x15,
+	0x15,
+	0x25,
+	0x25,
+	0x35,
+	0x35,
+	0x45,
+	0x45,
+	0x55,
+	0x55,
+	0x65,
+	0x65,
+	0x75,
+	0x75,
+	0x85,
+	0x85,
+	0x95,
+	0x95,
+	0xa5,
+	0xa5,
+	0xb5,
+	0xb5,
+	0xc5,
+	0xc5,
+	0xd5,
+	0xd5,
+	0xe5,
+	0xe5,
+	0xf5,
+	0xf5,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x39,
+	0x33,
+	0x2f,
+	0x2b,
+	0x27,
+	0x25,
+	0x22,
+	0x20,
+	0x1e,
+	0x1c,
+	0x1b,
+	0x1a,
+	0x18,
+	0x17,
+	0x16,
+	0x15,
+	0x14,
+	0x14,
+	0x13,
+	0x12,
+	0x12,
+	0x11,
+	0x11,
+	0x10,
+	0x10,
+	0x0f,
+	0x0f,
+	0x0e,
+	0x0e,
+	0x0d,
+	0x0d,
+	0x0d,
+	0x0c,
+	0x0c,
+	0x0c,
+	0x0c,
+	0x0b,
+	0x0b,
+	0x0b,
+	0x0b,
+	0x0a,
+	0x0a,
+	0x0a,
+	0x0a,
+	0x0a,
+	0x09,
+	0x09,
+	0x09,
+	0x09,
+	0x09,
+	0x09,
+	0x09,
+	0x08,
+	0x08,
+	0x08,
+};
+
+uint8_t dopclib_u[] =
+{
+	0x03,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x20,
+	0x00,
+	0x00,
+	0x02,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x10,
+	0x0c,
+	0x00,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x07,
+	0x0d,
+	0x13,
+	0x19,
+	0x1d,
+	0x1f,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x17,
+	0x14,
+	0x1f,
+	0x2e,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x07,
+	0x0f,
+	0x14,
+	0x1e,
+	0x00,
+	0x06,
+	0x0e,
+	0x08,
+	0x08,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x01,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x55,
+	0xfe,
+	0x80,
+	0xff,
+	0xe0,
+	0xff,
+	0x00,
+	0x00,
+	0x0d,
+	0x0d,
+	0x08,
+	0x06,
+	0x05,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x01,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0xab,
+	0xfb,
+	0xc0,
+	0xfe,
+	0x80,
+	0xff,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x15,
+	0x10,
+	0x0c,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x07,
+	0x0d,
+	0x09,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x5d,
+	0x1a,
+	0x12,
+	0x11,
+	0x17,
+	0x19,
+	0x0d,
+	0x00,
+	0x08,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x1a,
+	0x16,
+	0x0e,
+	0x14,
+	0x17,
+	0x0b,
+	0x00,
+	0x07,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x23,
+	0x1a,
+	0x15,
+	0x0a,
+	0x10,
+	0x09,
+	0x10,
+	0x00,
+	0x05,
+	0x00,
+	0x03,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x1a,
+	0x15,
+	0x04,
+	0x09,
+	0x06,
+	0x01,
+	0x01,
+	0x09,
+	0x02,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x7f,
+	0x26,
+	0x18,
+	0x07,
+	0x10,
+	0x0a,
+	0x09,
+	0x09,
+	0x10,
+	0x07,
+	0x07,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x26,
+	0x20,
+	0x06,
+	0x0c,
+	0x08,
+	0x0d,
+	0x00,
+	0x06,
+	0x06,
+	0x06,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x2e,
+	0x26,
+	0x21,
+	0x06,
+	0x0c,
+	0x06,
+	0x0d,
+	0x00,
+	0x07,
+	0x05,
+	0x06,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x2e,
+	0x26,
+	0x20,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x08,
+	0x06,
+	0x05,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x18,
+	0x40,
+	0x28,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x07,
+	0x09,
+	0x09,
+	0x01,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x40,
+	0x25,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x08,
+	0x09,
+	0x08,
+	0x03,
+	0x09,
+	0x01,
+	0x00,
+	0x00,
+	0x43,
+	0x40,
+	0x2f,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x0b,
+	0x0b,
+	0x0e,
+	0x02,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x33,
+	0x40,
+	0x30,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x0b,
+	0x04,
+	0x09,
+	0x01,
+	0x01,
+	0x05,
+	0x01,
+	0x00,
+	0x1a,
+	0x40,
+	0x64,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0b,
+	0x05,
+	0x08,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x16,
+	0x40,
+	0x35,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0d,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x03,
+	0x01,
+	0x00,
+	0x26,
+	0x40,
+	0x38,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x0e,
+	0x01,
+	0x14,
+	0x02,
+	0x03,
+	0x04,
+	0x01,
+	0x0f,
+	0x2a,
+	0x40,
+	0x3c,
+	0x02,
+	0x04,
+	0x03,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x0d,
+	0x05,
+	0x07,
+	0x0f,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x30,
+	0x1a,
+	0x13,
+	0x05,
+	0x09,
+	0x0f,
+	0x05,
+	0x00,
+	0x03,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1f,
+	0x1a,
+	0x16,
+	0x04,
+	0x08,
+	0x0f,
+	0x04,
+	0x00,
+	0x03,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x1a,
+	0x14,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x01,
+	0x03,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x7f,
+	0x26,
+	0x12,
+	0x02,
+	0x06,
+	0x0b,
+	0x01,
+	0x01,
+	0x06,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x4d,
+	0x26,
+	0x1c,
+	0x03,
+	0x07,
+	0x09,
+	0x04,
+	0x04,
+	0x07,
+	0x18,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x21,
+	0x02,
+	0x06,
+	0x0a,
+	0x03,
+	0x03,
+	0x06,
+	0x1a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x20,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x06,
+	0x03,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x24,
+	0x40,
+	0x39,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x09,
+	0x0b,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x4c,
+	0x40,
+	0x32,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x44,
+	0x40,
+	0x36,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x42,
+	0x40,
+	0x37,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0a,
+	0x03,
+	0x07,
+	0x01,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x23,
+	0x40,
+	0x4e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x04,
+	0x06,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x30,
+	0x40,
+	0x3e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x08,
+	0x07,
+	0x0b,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x3c,
+	0x40,
+	0x3c,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x07,
+	0x0b,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x33,
+	0x40,
+	0x3e,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x33,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x29,
+	0x33,
+	0x35,
+	0x2f,
+	0x16,
+	0x18,
+	0x16,
+	0x2e,
+	0x07,
+	0x1f,
+	0x33,
+	0x35,
+	0x2e,
+	0x11,
+	0x15,
+	0x11,
+	0x2d,
+	0x04,
+	0x16,
+	0x2e,
+	0x31,
+	0x28,
+	0x0e,
+	0x13,
+	0x0e,
+	0x27,
+	0x03,
+	0x10,
+	0x34,
+	0x3a,
+	0x32,
+	0x09,
+	0x10,
+	0x09,
+	0x32,
+	0x01,
+	0x0b,
+	0x2f,
+	0x38,
+	0x32,
+	0x04,
+	0x0e,
+	0x04,
+	0x33,
+	0x00,
+	0x33,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x38,
+	0x3b,
+	0x34,
+	0x11,
+	0x15,
+	0x11,
+	0x33,
+	0x05,
+	0x3a,
+	0x33,
+	0x36,
+	0x30,
+	0x0e,
+	0x13,
+	0x0e,
+	0x2e,
+	0x04,
+	0x29,
+	0x2a,
+	0x31,
+	0x28,
+	0x09,
+	0x10,
+	0x09,
+	0x27,
+	0x03,
+	0x1d,
+	0x24,
+	0x30,
+	0x27,
+	0x04,
+	0x0e,
+	0x04,
+	0x28,
+	0x02,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+
+};
+
+struct yushan_reg_t yushan_regs = {
+	.pdpcode_first_addr = 0x0234,
+	.pdpcode = &pdpcode_u[0],
+	.pdpcode_size = ARRAY_SIZE(pdpcode_u),
+
+	.pdpclib_first_addr = 0x0dd7,
+	.pdpclib = &pdpclib_u[0],
+	.pdpclib_size = ARRAY_SIZE(pdpclib_u),
+
+	.pdpBootAddr  = 0x1a00,
+	.pdpStartAddr = 0x0234,
+
+	.dppcode_first_addr = 0x0300,
+	.dppcode = &dppcode_u[0],
+	.dppcode_size = ARRAY_SIZE(dppcode_u),
+
+	.dppclib_first_addr = 0xbe27,
+	.dppclib = &dppclib_u[0],
+	.dppclib_size = ARRAY_SIZE(dppclib_u),
+
+	.dppBootAddr  = 0xd000,
+	.dppStartAddr = 0x0300,
+
+	.dopcode_first_addr = 0x0300,
+	.dopcode = &dopcode_u[0],
+	.dopcode_size = ARRAY_SIZE(dopcode_u),
+
+	.dopclib_first_addr = 0x3bcc,
+	.dopclib = &dopclib_u[0],
+	.dopclib_size = ARRAY_SIZE(dopclib_u),
+
+	.dopBootAddr  = 0x6800,
+	.dopStartAddr = 0x0300,
+
+
+};
+
diff --git a/drivers/media/video/msm/rawchip/yushan_reg_ar0260.c b/drivers/media/video/msm/rawchip/yushan_reg_ar0260.c
new file mode 100644
index 0000000..6d41eb1
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/yushan_reg_ar0260.c
@@ -0,0 +1,2157 @@
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include "Yushan_HTC_Functions.h"
+
+uint8_t pdpclib_u_ar0260[] =
+{
+	0x01,
+	0x01,
+	0x01,
+	0x88,
+	0x07,
+	0x40,
+	0x04,
+	0x00,
+	0x20,
+	0x00,
+	0x00,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x80,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0xf9,
+	0x00,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0xf9,
+	0x00,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0xf9,
+	0x00,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0xf9,
+	0x00,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0xf9,
+	0x00,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0xf9,
+	0x00,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0xf9,
+	0x00,
+	0x02,
+	0x03,
+	0x02,
+	0x02,
+	0xf9,
+	0x00,
+	0x02,
+	0x03,
+	0x02,
+	0x02,
+	0xf9,
+	0x00,
+	0x02,
+	0x03,
+	0x02,
+	0x02,
+	0xf9,
+	0x00,
+	0x02,
+	0x03,
+	0x03,
+	0x03,
+	0xf9,
+	0x00,
+	0x02,
+	0x03,
+	0x03,
+	0x03,
+	0xf9,
+	0x00,
+	0x02,
+	0x03,
+	0x03,
+	0x03,
+	0xfa,
+	0x00,
+	0x04,
+	0x06,
+	0x05,
+	0x05,
+	0xfa,
+	0x00,
+	0x04,
+	0x06,
+	0x05,
+	0x05,
+	0xfa,
+	0x00,
+	0x04,
+	0x06,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x01,
+	0x11,
+	0x21,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x04,
+	0x1f,
+	0x3a,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x01,
+	0x2c,
+	0x57,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x00,
+	0x08,
+	0x10,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x02,
+	0x10,
+	0x1d,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x01,
+	0x16,
+	0x2b,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x55,
+	0x02,
+	0x00,
+	0x00,
+	0x2b,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xa0,
+	0xff,
+	0xff,
+	0xff,
+	0xa0,
+	0x01,
+	0x00,
+	0x00,
+	0xa0,
+	0x03,
+	0x00,
+	0x00,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x55,
+	0x00,
+	0x00,
+	0x00,
+	0x55,
+	0x01,
+	0x00,
+	0x00,
+	0x2b,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xe0,
+	0xff,
+	0xff,
+	0xff,
+	0xc0,
+	0x00,
+	0x00,
+	0x00,
+	0xc0,
+	0x01,
+	0x00,
+	0x00,
+	0xff,
+	0x01,
+	0xff,
+	0x05,
+
+};
+
+uint8_t dppclib_u_ar0260[] =
+{
+	0x01,
+	0x01,
+	0x01,
+	0x88,
+	0x07,
+	0x40,
+	0x04,
+	0x00,
+	0x05,
+	0xfa,
+	0x84,
+	0x00,
+	0xbc,
+	0xfe,
+	0x32,
+	0x01,
+	0x02,
+	0x05,
+	0x80,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x1b,
+	0x00,
+	0xfb,
+	0x00,
+	0x00,
+	0xfc,
+	0x00,
+	0xfe,
+	0x00,
+	0x00,
+	0x9c,
+	0x04,
+	0x0d,
+	0x01,
+	0xff,
+	0x1c,
+	0x12,
+	0xfa,
+	0xff,
+	0x17,
+	0xfc,
+	0xf6,
+	0xff,
+	0xfb,
+	0xf8,
+	0x8a,
+	0x04,
+	0x09,
+	0x01,
+	0xff,
+	0x1a,
+	0x10,
+	0xfb,
+	0xff,
+	0x04,
+	0xfc,
+	0xfc,
+	0xfe,
+	0xfb,
+	0xfe,
+	0x80,
+	0xfe,
+	0x00,
+	0xff,
+	0x00,
+	0xf4,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xff,
+	0x00,
+	0x00,
+	0x6d,
+	0xfd,
+	0xfe,
+	0xff,
+	0x01,
+	0xf2,
+	0x0c,
+	0x02,
+	0x00,
+	0xee,
+	0x00,
+	0x09,
+	0xff,
+	0xfc,
+	0x08,
+	0x74,
+	0xff,
+	0xff,
+	0xff,
+	0x01,
+	0xf6,
+	0x0f,
+	0x03,
+	0xff,
+	0xf4,
+	0x00,
+	0x05,
+	0x00,
+	0xfc,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+
+};
+
+uint8_t dopclib_u_ar0260[] =
+{
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x20,
+	0x00,
+	0x00,
+	0x02,
+	0x88,
+	0x07,
+	0x40,
+	0x04,
+	0x78,
+	0x00,
+	0x7a,
+	0x00,
+	0x5a,
+	0x00,
+	0x5c,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x10,
+	0x0c,
+	0x00,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1e,
+	0x00,
+	0x06,
+	0x0e,
+	0x08,
+	0x08,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x02,
+	0x03,
+	0x01,
+	0x01,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0xab,
+	0xfe,
+	0xc0,
+	0xff,
+	0xc0,
+	0xff,
+	0x00,
+	0x00,
+	0x0b,
+	0x0b,
+	0x07,
+	0x06,
+	0x04,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x01,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0xab,
+	0xfc,
+	0x00,
+	0xff,
+	0x80,
+	0xff,
+	0x00,
+	0x00,
+	0x1d,
+	0x1d,
+	0x13,
+	0x0f,
+	0x0b,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x1a,
+	0x0f,
+	0x01,
+	0x01,
+	0x0b,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x1a,
+	0x14,
+	0x02,
+	0x05,
+	0x0c,
+	0x07,
+	0x00,
+	0x02,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0d,
+	0x1a,
+	0x14,
+	0x02,
+	0x04,
+	0x0d,
+	0x05,
+	0x00,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0c,
+	0x1a,
+	0x13,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x02,
+	0x03,
+	0x06,
+	0x03,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x26,
+	0x1f,
+	0x00,
+	0x00,
+	0x00,
+	0x07,
+	0x07,
+	0x05,
+	0x05,
+	0x02,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x15,
+	0x26,
+	0x1e,
+	0x00,
+	0x03,
+	0x04,
+	0x06,
+	0x06,
+	0x05,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x11,
+	0x26,
+	0x1a,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x08,
+	0x04,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1d,
+	0x40,
+	0x3a,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x0a,
+	0x07,
+	0x08,
+	0x02,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x27,
+	0x40,
+	0x34,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x09,
+	0x07,
+	0x08,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x00,
+	0x20,
+	0x40,
+	0x2e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x22,
+	0x40,
+	0x32,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x04,
+	0x04,
+	0x01,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x20,
+	0x40,
+	0x3b,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x09,
+	0x07,
+	0x08,
+	0x00,
+	0x04,
+	0x03,
+	0x01,
+	0x00,
+	0x20,
+	0x40,
+	0x31,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x07,
+	0x08,
+	0x01,
+	0x03,
+	0x03,
+	0x01,
+	0x00,
+	0x24,
+	0x40,
+	0x32,
+	0x01,
+	0x01,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x1a,
+	0x12,
+	0x01,
+	0x01,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0d,
+	0x1a,
+	0x17,
+	0x01,
+	0x02,
+	0x08,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x1a,
+	0x14,
+	0x01,
+	0x01,
+	0x07,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0c,
+	0x1a,
+	0x15,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0e,
+	0x26,
+	0x20,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x06,
+	0x05,
+	0x09,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x19,
+	0x26,
+	0x22,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x06,
+	0x04,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x16,
+	0x26,
+	0x22,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x03,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x25,
+	0x40,
+	0x2d,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x03,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2e,
+	0x40,
+	0x3d,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x06,
+	0x09,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x30,
+	0x40,
+	0x3b,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x07,
+	0x06,
+	0x08,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2f,
+	0x40,
+	0x3c,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x03,
+	0x03,
+	0x01,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x33,
+	0x40,
+	0x39,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x03,
+	0x04,
+	0x01,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x30,
+	0x40,
+	0x3e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x08,
+	0x06,
+	0x09,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x32,
+	0x40,
+	0x3c,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x07,
+	0x05,
+	0x08,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x32,
+	0x40,
+	0x3d,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x36,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x23,
+	0x2d,
+	0x31,
+	0x29,
+	0x16,
+	0x18,
+	0x16,
+	0x2a,
+	0x07,
+	0x1b,
+	0x2e,
+	0x32,
+	0x2a,
+	0x11,
+	0x15,
+	0x11,
+	0x2a,
+	0x04,
+	0x14,
+	0x36,
+	0x3d,
+	0x35,
+	0x0e,
+	0x13,
+	0x0e,
+	0x36,
+	0x02,
+	0x0e,
+	0x2a,
+	0x36,
+	0x30,
+	0x09,
+	0x10,
+	0x09,
+	0x32,
+	0x01,
+	0x0a,
+	0x29,
+	0x35,
+	0x2f,
+	0x04,
+	0x0e,
+	0x04,
+	0x31,
+	0x00,
+	0x36,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x33,
+	0x37,
+	0x31,
+	0x11,
+	0x15,
+	0x11,
+	0x31,
+	0x05,
+	0x33,
+	0x2c,
+	0x33,
+	0x2b,
+	0x0e,
+	0x13,
+	0x0e,
+	0x2c,
+	0x04,
+	0x24,
+	0x31,
+	0x3c,
+	0x35,
+	0x09,
+	0x10,
+	0x09,
+	0x37,
+	0x02,
+	0x19,
+	0x30,
+	0x3b,
+	0x34,
+	0x04,
+	0x0e,
+	0x04,
+	0x36,
+	0x01,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+
+};
+
+
+struct yushan_reg_clib_t yushan_regs_clib_ar0260 = {
+	.pdpclib_first_addr = 0x0dd7,
+	.pdpclib = &pdpclib_u_ar0260[0],
+	.pdpclib_size = ARRAY_SIZE(pdpclib_u_ar0260),
+
+	.dppclib_first_addr = 0xbe27,
+	.dppclib = &dppclib_u_ar0260[0],
+	.dppclib_size = ARRAY_SIZE(dppclib_u_ar0260),
+
+#if 1 
+	.dopclib_first_addr = 0x3bcc,
+#else
+	.dopclib_first_addr = 0x3bcc,
+#endif
+	.dopclib = &dopclib_u_ar0260[0],
+	.dopclib_size = ARRAY_SIZE(dopclib_u_ar0260),
+};
+
diff --git a/drivers/media/video/msm/rawchip/yushan_reg_imx175.c b/drivers/media/video/msm/rawchip/yushan_reg_imx175.c
new file mode 100644
index 0000000..506eb3e
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/yushan_reg_imx175.c
@@ -0,0 +1,3238 @@
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include "Yushan_HTC_Functions.h"
+
+uint8_t pdpclib_u_imx175[] =
+{
+	0x02,
+	0x01,
+	0x01,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0x01,
+	0x00,
+	0x00,
+	0xe0,
+	0x00,
+	0x00,
+	0x00,
+	0xff,
+	0xff,
+	0x00,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x80,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x09,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x09,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x09,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x09,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x09,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x09,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x09,
+	0x01,
+	0x40,
+	0x40,
+	0x3f,
+	0x40,
+	0x09,
+	0x01,
+	0x40,
+	0x40,
+	0x3f,
+	0x40,
+	0x09,
+	0x01,
+	0x40,
+	0x41,
+	0x40,
+	0x40,
+	0x09,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x09,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x09,
+	0x01,
+	0x40,
+	0x41,
+	0x40,
+	0x40,
+	0x09,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x09,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x09,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x05,
+	0x0f,
+	0x18,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x08,
+	0x1c,
+	0x31,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x0a,
+	0x29,
+	0x47,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x03,
+	0x07,
+	0x0c,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x04,
+	0x0e,
+	0x18,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x05,
+	0x14,
+	0x24,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x2b,
+	0x02,
+	0x00,
+	0x00,
+	0x2b,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0xa0,
+	0x01,
+	0x00,
+	0x00,
+	0xc0,
+	0x02,
+	0x00,
+	0x00,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2b,
+	0x00,
+	0x00,
+	0x00,
+	0x2b,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x00,
+	0x00,
+	0xc0,
+	0x00,
+	0x00,
+	0x00,
+	0x80,
+	0x01,
+	0x00,
+	0x00,
+	0xff,
+	0x01,
+	0xff,
+	0x05,
+
+};
+
+uint8_t dppclib_u_imx175[] =
+{
+	0x02,
+	0x01,
+	0x01,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0x01,
+	0x05,
+	0xfa,
+	0x4e,
+	0x00,
+	0xca,
+	0xfe,
+	0x1a,
+	0x01,
+	0x02,
+	0x05,
+	0x80,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x8e,
+	0xff,
+	0x06,
+	0x00,
+	0xff,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x0c,
+	0x00,
+	0xfa,
+	0x00,
+	0x00,
+	0xfd,
+	0x86,
+	0xff,
+	0x03,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x06,
+	0x01,
+	0xfe,
+	0x00,
+	0x00,
+	0xff,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x7a,
+	0x00,
+	0xff,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0xfe,
+	0x00,
+	0x05,
+	0x00,
+	0x00,
+	0x02,
+	0x7b,
+	0x00,
+	0xff,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0xfe,
+	0x00,
+	0x04,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+
+};
+
+uint8_t dopclib_u_imx175[] =
+#if 1 
+{
+	0x02,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0xff,
+	0xff,
+	0x00,
+	0x01,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xe0,
+	0x00,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x10,
+	0x0c,
+	0x01,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1e,
+	0x00,
+	0x06,
+	0x0e,
+	0x08,
+	0x08,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x00,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x01,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x55,
+	0xfe,
+	0xc0,
+	0xff,
+	0xc0,
+	0xff,
+	0x00,
+	0x00,
+	0x0c,
+	0x0c,
+	0x07,
+	0x06,
+	0x04,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x00,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x01,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0xab,
+	0xfb,
+	0x00,
+	0xff,
+	0xa0,
+	0xff,
+	0x00,
+	0x00,
+	0x20,
+	0x20,
+	0x13,
+	0x0f,
+	0x0c,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x04,
+	0x0a,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x0b,
+	0x06,
+	0x0c,
+	0x08,
+	0x04,
+	0x00,
+	0x04,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x32,
+	0x1a,
+	0x0f,
+	0x0a,
+	0x0e,
+	0x09,
+	0x09,
+	0x00,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x24,
+	0x1a,
+	0x15,
+	0x08,
+	0x0c,
+	0x0a,
+	0x07,
+	0x00,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x27,
+	0x1a,
+	0x16,
+	0x03,
+	0x0a,
+	0x01,
+	0x01,
+	0x00,
+	0x0a,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x12,
+	0x03,
+	0x0b,
+	0x05,
+	0x04,
+	0x04,
+	0x0b,
+	0x17,
+	0x03,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x39,
+	0x26,
+	0x1a,
+	0x05,
+	0x0b,
+	0x08,
+	0x08,
+	0x07,
+	0x0b,
+	0x05,
+	0x05,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x26,
+	0x20,
+	0x04,
+	0x09,
+	0x0a,
+	0x07,
+	0x00,
+	0x08,
+	0x04,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x3b,
+	0x26,
+	0x21,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x06,
+	0x06,
+	0x02,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x40,
+	0x0c,
+	0x00,
+	0x00,
+	0x04,
+	0x02,
+	0x04,
+	0x0a,
+	0x0b,
+	0x01,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x40,
+	0x25,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x0b,
+	0x0b,
+	0x07,
+	0x02,
+	0x08,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x23,
+	0x00,
+	0x00,
+	0x00,
+	0x07,
+	0x0e,
+	0x0d,
+	0x0c,
+	0x04,
+	0x07,
+	0x00,
+	0x00,
+	0x00,
+	0x35,
+	0x40,
+	0x37,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x0c,
+	0x01,
+	0x0a,
+	0x01,
+	0x01,
+	0x06,
+	0x01,
+	0x00,
+	0x18,
+	0x40,
+	0x7f,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x0e,
+	0x01,
+	0x12,
+	0x01,
+	0x01,
+	0x04,
+	0x01,
+	0x07,
+	0x25,
+	0x40,
+	0x50,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x0e,
+	0x0a,
+	0x09,
+	0x01,
+	0x04,
+	0x04,
+	0x01,
+	0x00,
+	0x1a,
+	0x40,
+	0x25,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x10,
+	0x01,
+	0x1b,
+	0x03,
+	0x04,
+	0x06,
+	0x00,
+	0x0d,
+	0x2b,
+	0x40,
+	0x4d,
+	0x01,
+	0x04,
+	0x01,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x07,
+	0x02,
+	0x04,
+	0x06,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x4a,
+	0x1a,
+	0x0d,
+	0x03,
+	0x05,
+	0x07,
+	0x03,
+	0x00,
+	0x02,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1f,
+	0x1a,
+	0x14,
+	0x03,
+	0x05,
+	0x07,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x1a,
+	0x14,
+	0x01,
+	0x04,
+	0x01,
+	0x01,
+	0x01,
+	0x04,
+	0x09,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x67,
+	0x26,
+	0x13,
+	0x01,
+	0x04,
+	0x06,
+	0x00,
+	0x00,
+	0x04,
+	0x12,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x35,
+	0x26,
+	0x1a,
+	0x01,
+	0x05,
+	0x05,
+	0x03,
+	0x03,
+	0x05,
+	0x0f,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x1f,
+	0x01,
+	0x05,
+	0x05,
+	0x03,
+	0x03,
+	0x05,
+	0x10,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2f,
+	0x26,
+	0x1f,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x04,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x29,
+	0x40,
+	0x30,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x07,
+	0x08,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x3c,
+	0x40,
+	0x31,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x07,
+	0x01,
+	0x0b,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x07,
+	0x3a,
+	0x40,
+	0x36,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x09,
+	0x09,
+	0x0f,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x3b,
+	0x40,
+	0x39,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x03,
+	0x07,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x22,
+	0x40,
+	0x4d,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x05,
+	0x08,
+	0x01,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x2c,
+	0x40,
+	0x41,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x0c,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x07,
+	0x32,
+	0x40,
+	0x43,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x02,
+	0x10,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x09,
+	0x35,
+	0x40,
+	0x42,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x2f,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x27,
+	0x35,
+	0x35,
+	0x2e,
+	0x16,
+	0x18,
+	0x16,
+	0x2b,
+	0x07,
+	0x1c,
+	0x34,
+	0x34,
+	0x2c,
+	0x11,
+	0x15,
+	0x11,
+	0x2a,
+	0x04,
+	0x15,
+	0x30,
+	0x31,
+	0x27,
+	0x0e,
+	0x13,
+	0x0e,
+	0x25,
+	0x03,
+	0x0f,
+	0x39,
+	0x39,
+	0x32,
+	0x09,
+	0x10,
+	0x09,
+	0x30,
+	0x01,
+	0x0b,
+	0x35,
+	0x39,
+	0x31,
+	0x04,
+	0x0e,
+	0x04,
+	0x30,
+	0x00,
+	0x2f,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x3a,
+	0x3a,
+	0x32,
+	0x11,
+	0x15,
+	0x11,
+	0x31,
+	0x05,
+	0x36,
+	0x35,
+	0x35,
+	0x2e,
+	0x0e,
+	0x13,
+	0x0e,
+	0x2b,
+	0x04,
+	0x28,
+	0x30,
+	0x30,
+	0x27,
+	0x09,
+	0x10,
+	0x09,
+	0x25,
+	0x03,
+	0x1c,
+	0x2b,
+	0x30,
+	0x26,
+	0x04,
+	0x0e,
+	0x04,
+	0x25,
+	0x02,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+
+};
+#else
+{
+	0x02,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x20,
+	0x00,
+	0x00,
+	0x02,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x10,
+	0x0c,
+	0x00,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x07,
+	0x0d,
+	0x13,
+	0x19,
+	0x1d,
+	0x1f,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x17,
+	0x14,
+	0x1f,
+	0x2e,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x07,
+	0x0f,
+	0x14,
+	0x1e,
+	0x00,
+	0x06,
+	0x04,
+	0x02,
+	0x04,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x01,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x55,
+	0xfe,
+	0x80,
+	0xff,
+	0xe0,
+	0xff,
+	0x00,
+	0x00,
+	0x0d,
+	0x0d,
+	0x08,
+	0x06,
+	0x05,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x01,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0xab,
+	0xfb,
+	0xc0,
+	0xfe,
+	0x80,
+	0xff,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x15,
+	0x10,
+	0x0c,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x07,
+	0x0d,
+	0x09,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x5d,
+	0x1a,
+	0x12,
+	0x11,
+	0x17,
+	0x19,
+	0x0d,
+	0x00,
+	0x08,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x1a,
+	0x16,
+	0x0e,
+	0x14,
+	0x17,
+	0x0b,
+	0x00,
+	0x07,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x23,
+	0x1a,
+	0x15,
+	0x0a,
+	0x10,
+	0x09,
+	0x10,
+	0x00,
+	0x05,
+	0x00,
+	0x03,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x1a,
+	0x15,
+	0x04,
+	0x09,
+	0x06,
+	0x01,
+	0x01,
+	0x09,
+	0x02,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x7f,
+	0x26,
+	0x18,
+	0x07,
+	0x10,
+	0x0a,
+	0x09,
+	0x09,
+	0x10,
+	0x07,
+	0x07,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x26,
+	0x20,
+	0x06,
+	0x0c,
+	0x08,
+	0x0d,
+	0x00,
+	0x06,
+	0x06,
+	0x06,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x2e,
+	0x26,
+	0x21,
+	0x06,
+	0x0c,
+	0x06,
+	0x0d,
+	0x00,
+	0x07,
+	0x05,
+	0x06,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x2e,
+	0x26,
+	0x20,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x08,
+	0x06,
+	0x05,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x18,
+	0x40,
+	0x28,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x07,
+	0x09,
+	0x09,
+	0x01,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x40,
+	0x25,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x08,
+	0x09,
+	0x08,
+	0x03,
+	0x09,
+	0x01,
+	0x00,
+	0x00,
+	0x43,
+	0x40,
+	0x2f,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x0b,
+	0x0b,
+	0x0e,
+	0x02,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x33,
+	0x40,
+	0x30,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x0b,
+	0x04,
+	0x09,
+	0x01,
+	0x01,
+	0x05,
+	0x01,
+	0x00,
+	0x1a,
+	0x40,
+	0x64,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0b,
+	0x05,
+	0x08,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x16,
+	0x40,
+	0x35,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0d,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x03,
+	0x01,
+	0x00,
+	0x26,
+	0x40,
+	0x38,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x0e,
+	0x01,
+	0x14,
+	0x02,
+	0x03,
+	0x04,
+	0x01,
+	0x0f,
+	0x2a,
+	0x40,
+	0x3c,
+	0x02,
+	0x04,
+	0x03,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x0d,
+	0x05,
+	0x07,
+	0x0f,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x30,
+	0x1a,
+	0x13,
+	0x05,
+	0x09,
+	0x0f,
+	0x05,
+	0x00,
+	0x03,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1f,
+	0x1a,
+	0x16,
+	0x04,
+	0x08,
+	0x0f,
+	0x04,
+	0x00,
+	0x03,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x1a,
+	0x14,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x01,
+	0x03,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x7f,
+	0x26,
+	0x12,
+	0x02,
+	0x06,
+	0x0b,
+	0x01,
+	0x01,
+	0x06,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x4d,
+	0x26,
+	0x1c,
+	0x03,
+	0x07,
+	0x09,
+	0x04,
+	0x04,
+	0x07,
+	0x18,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x21,
+	0x02,
+	0x06,
+	0x0a,
+	0x03,
+	0x03,
+	0x06,
+	0x1a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x20,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x06,
+	0x03,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x24,
+	0x40,
+	0x39,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x09,
+	0x0b,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x4c,
+	0x40,
+	0x32,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x44,
+	0x40,
+	0x36,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x42,
+	0x40,
+	0x37,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0a,
+	0x03,
+	0x07,
+	0x01,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x23,
+	0x40,
+	0x4e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x04,
+	0x06,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x30,
+	0x40,
+	0x3e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x08,
+	0x07,
+	0x0b,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x3c,
+	0x40,
+	0x3c,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x07,
+	0x0b,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x33,
+	0x40,
+	0x3e,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x33,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x29,
+	0x33,
+	0x35,
+	0x2f,
+	0x16,
+	0x18,
+	0x16,
+	0x2e,
+	0x07,
+	0x1f,
+	0x33,
+	0x35,
+	0x2e,
+	0x11,
+	0x15,
+	0x11,
+	0x2d,
+	0x04,
+	0x16,
+	0x2e,
+	0x31,
+	0x28,
+	0x0e,
+	0x13,
+	0x0e,
+	0x27,
+	0x03,
+	0x10,
+	0x34,
+	0x3a,
+	0x32,
+	0x09,
+	0x10,
+	0x09,
+	0x32,
+	0x01,
+	0x0b,
+	0x2f,
+	0x38,
+	0x32,
+	0x04,
+	0x0e,
+	0x04,
+	0x33,
+	0x00,
+	0x33,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x38,
+	0x3b,
+	0x34,
+	0x11,
+	0x15,
+	0x11,
+	0x33,
+	0x05,
+	0x3a,
+	0x33,
+	0x36,
+	0x30,
+	0x0e,
+	0x13,
+	0x0e,
+	0x2e,
+	0x04,
+	0x29,
+	0x2a,
+	0x31,
+	0x28,
+	0x09,
+	0x10,
+	0x09,
+	0x27,
+	0x03,
+	0x1d,
+	0x24,
+	0x30,
+	0x27,
+	0x04,
+	0x0e,
+	0x04,
+	0x28,
+	0x02,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+
+};
+#endif
+
+struct yushan_reg_clib_t yushan_regs_clib_imx175 = {
+	.pdpclib_first_addr = 0x0dd7,
+	.pdpclib = &pdpclib_u_imx175[0],
+	.pdpclib_size = ARRAY_SIZE(pdpclib_u_imx175),
+
+	.dppclib_first_addr = 0xbe27,
+	.dppclib = &dppclib_u_imx175[0],
+	.dppclib_size = ARRAY_SIZE(dppclib_u_imx175),
+
+#if 1 
+	.dopclib_first_addr = 0x3bcc,
+#else
+	.dopclib_first_addr = 0x3bcc,
+#endif
+	.dopclib = &dopclib_u_imx175[0],
+	.dopclib_size = ARRAY_SIZE(dopclib_u_imx175),
+};
+
diff --git a/drivers/media/video/msm/rawchip/yushan_reg_ov2722.c b/drivers/media/video/msm/rawchip/yushan_reg_ov2722.c
new file mode 100644
index 0000000..867daf3
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/yushan_reg_ov2722.c
@@ -0,0 +1,2157 @@
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include "Yushan_HTC_Functions.h"
+
+uint8_t pdpclib_u_ov2722[] =
+{
+0x01,
+0x03,
+0x01,
+0x88,
+0x07,
+0x40,
+0x04,
+0x02,
+0x10,
+0x00,
+0x00,
+0x01,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x10,
+0x00,
+0x00,
+0x01,
+0x00,
+0x02,
+0x00,
+0x04,
+0x00,
+0x08,
+0x00,
+0x10,
+0x80,
+0x00,
+0x00,
+0x01,
+0x00,
+0x02,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x80,
+0x00,
+0x00,
+0x00,
+0x40,
+0x00,
+0x00,
+0x00,
+0x20,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x01,
+0x00,
+0x02,
+0x00,
+0x08,
+0x00,
+0x10,
+0x78,
+0x01,
+0x00,
+0x01,
+0x60,
+0x02,
+0x50,
+0x03,
+0x04,
+0x06,
+0x0a,
+0x0e,
+0xd6,
+0x01,
+0x40,
+0x01,
+0x60,
+0x02,
+0x50,
+0x03,
+0x04,
+0x0a,
+0x11,
+0x17,
+0xd6,
+0x01,
+0x40,
+0x01,
+0x60,
+0x02,
+0x50,
+0x03,
+0x04,
+0x0f,
+0x16,
+0x1e,
+0x78,
+0x01,
+0x00,
+0x01,
+0x60,
+0x02,
+0x50,
+0x03,
+0x04,
+0x03,
+0x05,
+0x07,
+0xd6,
+0x01,
+0x40,
+0x01,
+0x60,
+0x02,
+0x50,
+0x03,
+0x04,
+0x05,
+0x08,
+0x0b,
+0xd6,
+0x01,
+0x40,
+0x01,
+0x60,
+0x02,
+0x50,
+0x03,
+0x04,
+0x07,
+0x0b,
+0x0f,
+0xab,
+0x0f,
+0x00,
+0x00,
+0xab,
+0x0a,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0xab,
+0x00,
+0x00,
+0x00,
+0x2b,
+0x01,
+0x00,
+0x00,
+0x80,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0xa0,
+0x00,
+0x00,
+0x00,
+0xa0,
+0x00,
+0x00,
+0x00,
+0xe0,
+0x00,
+0x00,
+0x00,
+0xab,
+0x0f,
+0x00,
+0x00,
+0xab,
+0x0a,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x55,
+0x00,
+0x00,
+0x00,
+0x80,
+0x00,
+0x00,
+0x00,
+0xab,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x40,
+0x00,
+0x00,
+0x00,
+0x60,
+0x00,
+0x00,
+0x00,
+0x80,
+0x00,
+0x00,
+0x00,
+0xff,
+0x01,
+0xff,
+0x05,
+
+};
+
+uint8_t dppclib_u_ov2722[] =
+{
+	0x01,
+	0x03,
+	0x01,
+	0x88,
+	0x07,
+	0x40,
+	0x04,
+	0x02,
+	0x05,
+	0xfa,
+	0x4d,
+	0x00,
+	0xca,
+	0xfe,
+	0x77,
+	0x01,
+	0x02,
+	0x05,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x8f,
+	0xfe,
+	0x09,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x00,
+	0xfd,
+	0xff,
+	0x00,
+	0xfd,
+	0x8e,
+	0xfe,
+	0x08,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x0e,
+	0x00,
+	0xfd,
+	0xff,
+	0x00,
+	0xfe,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x7f,
+	0x00,
+	0x00,
+	0xff,
+	0x01,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0xff,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x82,
+	0x00,
+	0x02,
+	0x00,
+	0x01,
+	0xfe,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+
+};
+
+uint8_t dopclib_u_ov2722[] =
+{
+	0x01,
+	0x03,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x10,
+	0x00,
+	0x00,
+	0x01,
+	0x88,
+	0x07,
+	0x40,
+	0x04,
+	0x78,
+	0x00,
+	0x7a,
+	0x00,
+	0x5a,
+	0x00,
+	0x5c,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x10,
+	0x0c,
+	0x02,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1e,
+	0x00,
+	0x06,
+	0x0e,
+	0x08,
+	0x08,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0xab,
+	0xfd,
+	0xc0,
+	0xff,
+	0xc0,
+	0xff,
+	0x00,
+	0x00,
+	0x11,
+	0x11,
+	0x0a,
+	0x09,
+	0x07,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0xfa,
+	0x00,
+	0xff,
+	0x60,
+	0xff,
+	0x00,
+	0x00,
+	0x2d,
+	0x2d,
+	0x1b,
+	0x17,
+	0x12,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x15,
+	0x1a,
+	0x21,
+	0x01,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x16,
+	0x1a,
+	0x00,
+	0x01,
+	0x01,
+	0x02,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x1a,
+	0x55,
+	0x01,
+	0x01,
+	0x01,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x1a,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x23,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x3c,
+	0x40,
+	0x50,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x03,
+	0x01,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x3c,
+	0x40,
+	0x7f,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x03,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0c,
+	0x40,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x04,
+	0x01,
+	0x04,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x28,
+	0x40,
+	0x69,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x3d,
+	0x40,
+	0x47,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x01,
+	0x04,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x3d,
+	0x40,
+	0x7f,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x03,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x75,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x16,
+	0x1a,
+	0x1c,
+	0x01,
+	0x01,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x19,
+	0x1a,
+	0x3e,
+	0x01,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x1a,
+	0x24,
+	0x01,
+	0x01,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0c,
+	0x1a,
+	0x22,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x25,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x13,
+	0x26,
+	0x7f,
+	0x00,
+	0x00,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0d,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x02,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x3c,
+	0x40,
+	0x43,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x02,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x3f,
+	0x40,
+	0x5b,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x02,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x34,
+	0x40,
+	0x52,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x02,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2d,
+	0x40,
+	0x4e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x02,
+	0x04,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x3d,
+	0x40,
+	0x42,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x02,
+	0x05,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x3f,
+	0x40,
+	0x50,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x02,
+	0x04,
+	0x01,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x36,
+	0x40,
+	0x4d,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x02,
+	0x04,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x30,
+	0x40,
+	0x48,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x31,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x39,
+	0x3c,
+	0x3e,
+	0x36,
+	0x16,
+	0x18,
+	0x16,
+	0x34,
+	0x07,
+	0x2e,
+	0x2a,
+	0x30,
+	0x27,
+	0x11,
+	0x15,
+	0x11,
+	0x27,
+	0x05,
+	0x1f,
+	0x36,
+	0x38,
+	0x31,
+	0x0e,
+	0x13,
+	0x0e,
+	0x30,
+	0x03,
+	0x1a,
+	0x32,
+	0x35,
+	0x2e,
+	0x09,
+	0x10,
+	0x09,
+	0x2c,
+	0x02,
+	0x14,
+	0x34,
+	0x35,
+	0x2e,
+	0x04,
+	0x0e,
+	0x04,
+	0x2d,
+	0x01,
+	0x31,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x31,
+	0x35,
+	0x2e,
+	0x11,
+	0x15,
+	0x11,
+	0x2d,
+	0x06,
+	0x3f,
+	0x3d,
+	0x3f,
+	0x36,
+	0x0e,
+	0x13,
+	0x0e,
+	0x35,
+	0x04,
+	0x3f,
+	0x37,
+	0x3b,
+	0x33,
+	0x09,
+	0x10,
+	0x09,
+	0x32,
+	0x03,
+	0x33,
+	0x3a,
+	0x3c,
+	0x34,
+	0x04,
+	0x0e,
+	0x04,
+	0x32,
+	0x02,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+
+};
+
+
+struct yushan_reg_clib_t yushan_regs_clib_ov2722 = {
+	.pdpclib_first_addr = 0x0dd7,
+	.pdpclib = &pdpclib_u_ov2722[0],
+	.pdpclib_size = ARRAY_SIZE(pdpclib_u_ov2722),
+
+	.dppclib_first_addr = 0xbe27,
+	.dppclib = &dppclib_u_ov2722[0],
+	.dppclib_size = ARRAY_SIZE(dppclib_u_ov2722),
+
+#if 1 
+	.dopclib_first_addr = 0x3bcc,
+#else
+	.dopclib_first_addr = 0x3bcc,
+#endif
+	.dopclib = &dopclib_u_ov2722[0],
+	.dopclib_size = ARRAY_SIZE(dopclib_u_ov2722),
+};
+
diff --git a/drivers/media/video/msm/rawchip/yushan_reg_ov5693.c b/drivers/media/video/msm/rawchip/yushan_reg_ov5693.c
new file mode 100644
index 0000000..3ae2e84
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/yushan_reg_ov5693.c
@@ -0,0 +1,3236 @@
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include "Yushan_HTC_Functions.h"
+
+uint8_t pdpclib_u_ov5693[] =
+{
+	0x01,
+	0x01,
+	0x01,
+	0x20,
+	0x0a,
+	0xa0,
+	0x07,
+	0x02,
+	0x10,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x80,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0xfc,
+	0x00,
+	0x10,
+	0x10,
+	0x10,
+	0x10,
+	0xfc,
+	0x00,
+	0x10,
+	0x10,
+	0x10,
+	0x10,
+	0xfc,
+	0x00,
+	0x10,
+	0x10,
+	0x10,
+	0x10,
+	0xfd,
+	0x00,
+	0x11,
+	0x11,
+	0x11,
+	0x11,
+	0xfd,
+	0x00,
+	0x11,
+	0x11,
+	0x11,
+	0x11,
+	0xfd,
+	0x00,
+	0x11,
+	0x11,
+	0x11,
+	0x11,
+	0xfd,
+	0x00,
+	0x11,
+	0x12,
+	0x13,
+	0x12,
+	0xfd,
+	0x00,
+	0x11,
+	0x12,
+	0x13,
+	0x12,
+	0xfd,
+	0x00,
+	0x11,
+	0x12,
+	0x13,
+	0x12,
+	0xfd,
+	0x00,
+	0x12,
+	0x13,
+	0x13,
+	0x13,
+	0xfd,
+	0x00,
+	0x12,
+	0x13,
+	0x13,
+	0x13,
+	0xfd,
+	0x00,
+	0x12,
+	0x13,
+	0x13,
+	0x13,
+	0xfd,
+	0x00,
+	0x12,
+	0x14,
+	0x13,
+	0x12,
+	0xfd,
+	0x00,
+	0x12,
+	0x14,
+	0x13,
+	0x12,
+	0xfd,
+	0x00,
+	0x12,
+	0x14,
+	0x13,
+	0x12,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x04,
+	0x0f,
+	0x1a,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x01,
+	0x1b,
+	0x35,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x04,
+	0x24,
+	0x43,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x02,
+	0x07,
+	0x0d,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x00,
+	0x0d,
+	0x1b,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x02,
+	0x12,
+	0x22,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x80,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x80,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x60,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x01,
+	0x00,
+	0x00,
+	0xc0,
+	0x01,
+	0x00,
+	0x00,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xab,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x55,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0xa0,
+	0x00,
+	0x00,
+	0x00,
+	0xe0,
+	0x00,
+	0x00,
+	0x00,
+	0xff,
+	0x01,
+	0xff,
+	0x05,
+};
+
+uint8_t dppclib_u_ov5693[] =
+{
+	0x01,
+	0x01,
+	0x01,
+	0x20,
+	0x0a,
+	0xa0,
+	0x07,
+	0x02,
+	0x05,
+	0xfa,
+	0x50,
+	0x00,
+	0xca,
+	0xfe,
+	0x1a,
+	0x01,
+	0x02,
+	0x05,
+	0x80,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0xfe,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xa6,
+	0x01,
+	0x17,
+	0x00,
+	0x00,
+	0xfd,
+	0x00,
+	0x00,
+	0x00,
+	0x28,
+	0xff,
+	0xf7,
+	0x00,
+	0x00,
+	0xfc,
+	0x95,
+	0x01,
+	0x0d,
+	0x00,
+	0x01,
+	0xfe,
+	0x00,
+	0x00,
+	0x00,
+	0x18,
+	0x00,
+	0xfd,
+	0x00,
+	0x00,
+	0xff,
+	0x80,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0xfd,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x7c,
+	0xfe,
+	0xfe,
+	0x00,
+	0x00,
+	0xfd,
+	0xff,
+	0x00,
+	0x00,
+	0xfd,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x7f,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0xfe,
+	0x00,
+	0x00,
+	0x00,
+	0xff,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+};
+
+uint8_t dopclib_u_ov5693[] =
+#if 1 
+{
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x10,
+	0x00,
+	0x00,
+	0x01,
+	0x20,
+	0x0a,
+	0xa0,
+	0x07,
+	0xa2,
+	0x00,
+	0xa4,
+	0x00,
+	0xa2,
+	0x00,
+	0xa4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x10,
+	0x0c,
+	0x02,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1e,
+	0x00,
+	0x06,
+	0x0e,
+	0x08,
+	0x08,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x01,
+	0x03,
+	0x01,
+	0x01,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x02,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x55,
+	0xfe,
+	0xc0,
+	0xff,
+	0xc0,
+	0xff,
+	0x00,
+	0x00,
+	0x0d,
+	0x0d,
+	0x08,
+	0x07,
+	0x05,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x01,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x02,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0xfc,
+	0x00,
+	0xff,
+	0x80,
+	0xff,
+	0x00,
+	0x00,
+	0x21,
+	0x21,
+	0x15,
+	0x11,
+	0x0d,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x0a,
+	0x11,
+	0x0a,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x57,
+	0x1a,
+	0x13,
+	0x0a,
+	0x10,
+	0x0b,
+	0x06,
+	0x00,
+	0x05,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x1a,
+	0x13,
+	0x0c,
+	0x12,
+	0x15,
+	0x07,
+	0x00,
+	0x06,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x29,
+	0x1a,
+	0x14,
+	0x0b,
+	0x11,
+	0x15,
+	0x06,
+	0x00,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x28,
+	0x1a,
+	0x13,
+	0x01,
+	0x08,
+	0x04,
+	0x01,
+	0x01,
+	0x08,
+	0x15,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x65,
+	0x26,
+	0x13,
+	0x02,
+	0x07,
+	0x06,
+	0x03,
+	0x03,
+	0x07,
+	0x11,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x18,
+	0x03,
+	0x09,
+	0x0e,
+	0x04,
+	0x00,
+	0x09,
+	0x03,
+	0x03,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x30,
+	0x26,
+	0x18,
+	0x02,
+	0x08,
+	0x07,
+	0x04,
+	0x04,
+	0x08,
+	0x19,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x30,
+	0x26,
+	0x18,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x0b,
+	0x04,
+	0x04,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x12,
+	0x40,
+	0x2b,
+	0x00,
+	0x00,
+	0x00,
+	0x07,
+	0x0f,
+	0x01,
+	0x0d,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x1d,
+	0x40,
+	0x5c,
+	0x00,
+	0x00,
+	0x11,
+	0x06,
+	0x0f,
+	0x01,
+	0x15,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x07,
+	0x1c,
+	0x40,
+	0x63,
+	0x00,
+	0x00,
+	0x00,
+	0x08,
+	0x15,
+	0x01,
+	0x1a,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x0b,
+	0x26,
+	0x40,
+	0x4b,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x0e,
+	0x02,
+	0x08,
+	0x01,
+	0x01,
+	0x04,
+	0x01,
+	0x00,
+	0x17,
+	0x40,
+	0x65,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x10,
+	0x01,
+	0x19,
+	0x01,
+	0x01,
+	0x06,
+	0x01,
+	0x06,
+	0x22,
+	0x40,
+	0x6f,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x13,
+	0x01,
+	0x20,
+	0x00,
+	0x01,
+	0x09,
+	0x02,
+	0x0c,
+	0x23,
+	0x40,
+	0x7a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x12,
+	0x01,
+	0x20,
+	0x01,
+	0x02,
+	0x08,
+	0x02,
+	0x10,
+	0x27,
+	0x40,
+	0x55,
+	0x03,
+	0x06,
+	0x05,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x0d,
+	0x03,
+	0x05,
+	0x09,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x3d,
+	0x1a,
+	0x10,
+	0x03,
+	0x06,
+	0x0a,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x1a,
+	0x0f,
+	0x03,
+	0x05,
+	0x09,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x38,
+	0x1a,
+	0x10,
+	0x01,
+	0x03,
+	0x01,
+	0x01,
+	0x01,
+	0x03,
+	0x08,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x4c,
+	0x26,
+	0x14,
+	0x01,
+	0x02,
+	0x05,
+	0x00,
+	0x00,
+	0x02,
+	0x09,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x1a,
+	0x01,
+	0x03,
+	0x06,
+	0x01,
+	0x01,
+	0x03,
+	0x0b,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2a,
+	0x26,
+	0x1b,
+	0x01,
+	0x03,
+	0x06,
+	0x00,
+	0x00,
+	0x03,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2a,
+	0x26,
+	0x1b,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x03,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x40,
+	0x35,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x08,
+	0x04,
+	0x07,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x28,
+	0x40,
+	0x42,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x06,
+	0x09,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2b,
+	0x40,
+	0x3e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x05,
+	0x09,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2b,
+	0x40,
+	0x42,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x02,
+	0x05,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x14,
+	0x40,
+	0x52,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x04,
+	0x09,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x28,
+	0x40,
+	0x50,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x02,
+	0x0c,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x04,
+	0x2b,
+	0x40,
+	0x4d,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x06,
+	0x0c,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x2c,
+	0x40,
+	0x49,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x37,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x28,
+	0x30,
+	0x34,
+	0x2d,
+	0x16,
+	0x18,
+	0x16,
+	0x2e,
+	0x07,
+	0x1e,
+	0x30,
+	0x34,
+	0x2d,
+	0x11,
+	0x15,
+	0x11,
+	0x2e,
+	0x04,
+	0x16,
+	0x26,
+	0x30,
+	0x28,
+	0x0e,
+	0x13,
+	0x0e,
+	0x29,
+	0x03,
+	0x10,
+	0x2c,
+	0x3a,
+	0x33,
+	0x09,
+	0x10,
+	0x09,
+	0x36,
+	0x01,
+	0x0d,
+	0x32,
+	0x3b,
+	0x34,
+	0x04,
+	0x0e,
+	0x04,
+	0x35,
+	0x00,
+	0x37,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x34,
+	0x3a,
+	0x33,
+	0x11,
+	0x15,
+	0x11,
+	0x33,
+	0x05,
+	0x38,
+	0x2c,
+	0x35,
+	0x2e,
+	0x0e,
+	0x13,
+	0x0e,
+	0x30,
+	0x04,
+	0x2a,
+	0x22,
+	0x31,
+	0x29,
+	0x09,
+	0x10,
+	0x09,
+	0x2c,
+	0x03,
+	0x21,
+	0x27,
+	0x32,
+	0x2a,
+	0x04,
+	0x0e,
+	0x04,
+	0x2c,
+	0x02,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+
+};
+#else
+{
+	0x02,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x10,
+	0x00,
+	0x00,
+	0x01,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x10,
+	0x0c,
+	0x01,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1e,
+	0x00,
+	0x06,
+	0x0e,
+	0x08,
+	0x08,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x02,
+	0x03,
+	0x01,
+	0x02,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x06,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x05,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0xab,
+	0xfe,
+	0xc0,
+	0xff,
+	0xe0,
+	0xff,
+	0x00,
+	0x00,
+	0x0b,
+	0x0b,
+	0x07,
+	0x06,
+	0x05,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x02,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x06,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x05,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x55,
+	0xfc,
+	0x40,
+	0xff,
+	0xa0,
+	0xff,
+	0x00,
+	0x00,
+	0x1e,
+	0x1e,
+	0x13,
+	0x10,
+	0x0d,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x27,
+	0x01,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x38,
+	0x1a,
+	0x41,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x5f,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x5b,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x46,
+	0x40,
+	0x7f,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x05,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x4a,
+	0x40,
+	0x70,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x02,
+	0x02,
+	0x07,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x56,
+	0x40,
+	0x6f,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x02,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x43,
+	0x40,
+	0x59,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x43,
+	0x40,
+	0x61,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x04,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x42,
+	0x40,
+	0x68,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x06,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x4d,
+	0x40,
+	0x76,
+	0x01,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x16,
+	0x1a,
+	0x1b,
+	0x01,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x15,
+	0x1a,
+	0x20,
+	0x01,
+	0x01,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x1a,
+	0x7f,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1e,
+	0x1a,
+	0x69,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x02,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2f,
+	0x40,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x02,
+	0x01,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x34,
+	0x40,
+	0x7d,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x35,
+	0x40,
+	0x59,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x37,
+	0x40,
+	0x61,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x39,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x23,
+	0x2b,
+	0x31,
+	0x29,
+	0x16,
+	0x18,
+	0x16,
+	0x2b,
+	0x07,
+	0x1b,
+	0x2b,
+	0x31,
+	0x29,
+	0x11,
+	0x15,
+	0x11,
+	0x2b,
+	0x04,
+	0x13,
+	0x31,
+	0x3c,
+	0x35,
+	0x0e,
+	0x13,
+	0x0e,
+	0x37,
+	0x02,
+	0x0e,
+	0x25,
+	0x36,
+	0x31,
+	0x09,
+	0x10,
+	0x09,
+	0x35,
+	0x01,
+	0x0c,
+	0x29,
+	0x39,
+	0x32,
+	0x04,
+	0x0e,
+	0x04,
+	0x36,
+	0x00,
+	0x39,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x31,
+	0x36,
+	0x30,
+	0x11,
+	0x15,
+	0x11,
+	0x31,
+	0x05,
+	0x32,
+	0x27,
+	0x32,
+	0x2b,
+	0x0e,
+	0x13,
+	0x0e,
+	0x2e,
+	0x04,
+	0x25,
+	0x2b,
+	0x3d,
+	0x36,
+	0x09,
+	0x10,
+	0x09,
+	0x3a,
+	0x02,
+	0x1e,
+	0x20,
+	0x30,
+	0x28,
+	0x04,
+	0x0e,
+	0x04,
+	0x2c,
+	0x02,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+
+};
+#endif
+
+struct yushan_reg_clib_t yushan_regs_clib_ov5693 = {
+	.pdpclib_first_addr = 0x0dd7,
+	.pdpclib = &pdpclib_u_ov5693[0],
+	.pdpclib_size = ARRAY_SIZE(pdpclib_u_ov5693),
+
+	.dppclib_first_addr = 0xbe27,
+	.dppclib = &dppclib_u_ov5693[0],
+	.dppclib_size = ARRAY_SIZE(dppclib_u_ov5693),
+
+#if 1 
+	.dopclib_first_addr = 0x3bcc,
+#else
+	.dopclib_first_addr = 0x3bcc,
+#endif
+	.dopclib = &dopclib_u_ov5693[0],
+	.dopclib_size = ARRAY_SIZE(dopclib_u_ov5693),
+};
+
diff --git a/drivers/media/video/msm/rawchip/yushan_reg_ov8838.c b/drivers/media/video/msm/rawchip/yushan_reg_ov8838.c
new file mode 100644
index 0000000..5aaa09e
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/yushan_reg_ov8838.c
@@ -0,0 +1,3236 @@
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include "Yushan_HTC_Functions.h"
+
+uint8_t pdpclib_u_ov8838[] =
+{
+	0x02,    
+	0x01,
+	0x01,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0x02,
+	0x10,
+	0x00,
+	0xf8,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x80,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x0b,
+	0x01,
+	0x47,
+	0x49,
+	0x45,
+	0x4a,
+	0x0b,
+	0x01,
+	0x47,
+	0x49,
+	0x45,
+	0x4a,
+	0x0b,
+	0x01,
+	0x47,
+	0x49,
+	0x45,
+	0x4a,
+	0x0a,
+	0x01,
+	0x46,
+	0x49,
+	0x44,
+	0x49,
+	0x0a,
+	0x01,
+	0x46,
+	0x49,
+	0x44,
+	0x49,
+	0x0a,
+	0x01,
+	0x46,
+	0x49,
+	0x44,
+	0x49,
+	0x0b,
+	0x01,
+	0x46,
+	0x49,
+	0x45,
+	0x48,
+	0x0b,
+	0x01,
+	0x46,
+	0x49,
+	0x45,
+	0x48,
+	0x0b,
+	0x01,
+	0x46,
+	0x49,
+	0x45,
+	0x48,
+	0x0a,
+	0x01,
+	0x46,
+	0x49,
+	0x43,
+	0x49,
+	0x0a,
+	0x01,
+	0x46,
+	0x49,
+	0x43,
+	0x49,
+	0x0a,
+	0x01,
+	0x46,
+	0x49,
+	0x43,
+	0x49,
+	0x0a,
+	0x01,
+	0x46,
+	0x48,
+	0x44,
+	0x47,
+	0x0a,
+	0x01,
+	0x46,
+	0x48,
+	0x44,
+	0x47,
+	0x0a,
+	0x01,
+	0x46,
+	0x48,
+	0x44,
+	0x47,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x0a,
+	0x13,
+	0x1c,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x0f,
+	0x23,
+	0x36,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x12,
+	0x2d,
+	0x47,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x05,
+	0x09,
+	0x0e,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x07,
+	0x11,
+	0x1b,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x09,
+	0x16,
+	0x24,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xd5,
+	0x00,
+	0x00,
+	0x00,
+	0xab,
+	0x02,
+	0x00,
+	0x00,
+	0x55,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x60,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x01,
+	0x00,
+	0x00,
+	0x20,
+	0x02,
+	0x00,
+	0x00,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x55,
+	0x00,
+	0x00,
+	0x00,
+	0x55,
+	0x01,
+	0x00,
+	0x00,
+	0x2b,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0xa0,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x01,
+	0x00,
+	0x00,
+	0xff,
+	0x01,
+	0xff,
+	0x05,
+};
+
+uint8_t dppclib_u_ov8838[] =
+{
+	0x02,
+	0x01,
+	0x01,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0x02,
+	0x05,
+	0xfa,
+	0x5e,
+	0x00,
+	0x39,
+	0xfe,
+	0x1a,
+	0x01,
+	0x02,
+	0x05,
+	0x80,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0xfd,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x83,
+	0xff,
+	0x02,
+	0x00,
+	0xff,
+	0xfc,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0xfe,
+	0x7a,
+	0x00,
+	0xfe,
+	0x00,
+	0x00,
+	0xfe,
+	0x00,
+	0x01,
+	0x00,
+	0xff,
+	0x01,
+	0x08,
+	0x01,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0xfe,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x7a,
+	0x03,
+	0xfe,
+	0x00,
+	0x01,
+	0xfd,
+	0xff,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x01,
+	0x00,
+	0x03,
+	0x7b,
+	0x01,
+	0xfe,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xfd,
+	0x01,
+	0x03,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+};
+
+uint8_t dopclib_u_ov8838[] =
+#if 1 
+{
+	0x02,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x10,
+	0x00,
+	0xf8,
+	0x00,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x10,
+	0x0c,
+	0x02,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1e,
+	0x00,
+	0x06,
+	0x0e,
+	0x08,
+	0x08,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x02,
+	0x03,
+	0x01,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x05,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x05,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x55,
+	0xfe,
+	0xc0,
+	0xff,
+	0xe0,
+	0xff,
+	0x00,
+	0x00,
+	0x0c,
+	0x0c,
+	0x07,
+	0x06,
+	0x05,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x05,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x05,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0xfc,
+	0x40,
+	0xff,
+	0xc0,
+	0xff,
+	0x00,
+	0x00,
+	0x1e,
+	0x1e,
+	0x12,
+	0x0f,
+	0x0d,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x0b,
+	0x12,
+	0x0d,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x58,
+	0x1a,
+	0x14,
+	0x0b,
+	0x11,
+	0x0e,
+	0x08,
+	0x00,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x1a,
+	0x13,
+	0x0b,
+	0x14,
+	0x10,
+	0x10,
+	0x00,
+	0x07,
+	0x00,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1e,
+	0x1a,
+	0x15,
+	0x0e,
+	0x14,
+	0x0e,
+	0x0e,
+	0x00,
+	0x07,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x1a,
+	0x15,
+	0x01,
+	0x08,
+	0x02,
+	0x01,
+	0x01,
+	0x08,
+	0x17,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x5d,
+	0x26,
+	0x14,
+	0x02,
+	0x07,
+	0x03,
+	0x04,
+	0x04,
+	0x07,
+	0x0e,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x32,
+	0x26,
+	0x1b,
+	0x05,
+	0x09,
+	0x04,
+	0x07,
+	0x07,
+	0x09,
+	0x0a,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x23,
+	0x26,
+	0x1a,
+	0x05,
+	0x0b,
+	0x08,
+	0x08,
+	0x08,
+	0x0b,
+	0x18,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x28,
+	0x26,
+	0x1e,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x08,
+	0x06,
+	0x03,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x15,
+	0x40,
+	0x1e,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x0a,
+	0x07,
+	0x0a,
+	0x01,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x27,
+	0x40,
+	0x3b,
+	0x00,
+	0x00,
+	0x00,
+	0x07,
+	0x0e,
+	0x09,
+	0x09,
+	0x03,
+	0x07,
+	0x01,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x31,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x12,
+	0x14,
+	0x12,
+	0x04,
+	0x09,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x40,
+	0x34,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x0b,
+	0x03,
+	0x07,
+	0x01,
+	0x01,
+	0x04,
+	0x01,
+	0x00,
+	0x1a,
+	0x40,
+	0x5f,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x0e,
+	0x01,
+	0x0f,
+	0x02,
+	0x03,
+	0x05,
+	0x01,
+	0x08,
+	0x29,
+	0x40,
+	0x53,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x11,
+	0x0e,
+	0x0d,
+	0x04,
+	0x07,
+	0x07,
+	0x01,
+	0x00,
+	0x2a,
+	0x40,
+	0x38,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x10,
+	0x0b,
+	0x14,
+	0x04,
+	0x06,
+	0x06,
+	0x01,
+	0x05,
+	0x34,
+	0x40,
+	0x46,
+	0x03,
+	0x06,
+	0x05,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x0e,
+	0x03,
+	0x06,
+	0x0b,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x36,
+	0x1a,
+	0x0f,
+	0x04,
+	0x07,
+	0x0f,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x1a,
+	0x13,
+	0x05,
+	0x07,
+	0x0d,
+	0x03,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x1a,
+	0x13,
+	0x01,
+	0x03,
+	0x01,
+	0x01,
+	0x01,
+	0x03,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x49,
+	0x26,
+	0x14,
+	0x01,
+	0x03,
+	0x05,
+	0x01,
+	0x01,
+	0x03,
+	0x0b,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x1b,
+	0x01,
+	0x03,
+	0x08,
+	0x01,
+	0x01,
+	0x03,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x28,
+	0x26,
+	0x1f,
+	0x01,
+	0x04,
+	0x08,
+	0x01,
+	0x01,
+	0x04,
+	0x13,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x28,
+	0x26,
+	0x1d,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x03,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x32,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x07,
+	0x06,
+	0x09,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x33,
+	0x40,
+	0x3c,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x09,
+	0x08,
+	0x0c,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x32,
+	0x40,
+	0x37,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0a,
+	0x0a,
+	0x11,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x39,
+	0x40,
+	0x38,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x08,
+	0x02,
+	0x05,
+	0x01,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x25,
+	0x40,
+	0x48,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x06,
+	0x0a,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x2e,
+	0x40,
+	0x42,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x09,
+	0x0e,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x30,
+	0x40,
+	0x3b,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x0b,
+	0x11,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x37,
+	0x40,
+	0x3c,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x3c,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x23,
+	0x27,
+	0x30,
+	0x29,
+	0x16,
+	0x18,
+	0x16,
+	0x2b,
+	0x07,
+	0x19,
+	0x24,
+	0x30,
+	0x28,
+	0x11,
+	0x15,
+	0x11,
+	0x2b,
+	0x04,
+	0x12,
+	0x2c,
+	0x3a,
+	0x33,
+	0x0e,
+	0x13,
+	0x0e,
+	0x37,
+	0x02,
+	0x0e,
+	0x24,
+	0x35,
+	0x30,
+	0x09,
+	0x10,
+	0x09,
+	0x33,
+	0x01,
+	0x0b,
+	0x25,
+	0x37,
+	0x31,
+	0x04,
+	0x0e,
+	0x04,
+	0x35,
+	0x00,
+	0x3c,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3d,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x2a,
+	0x35,
+	0x2f,
+	0x11,
+	0x15,
+	0x11,
+	0x31,
+	0x05,
+	0x2f,
+	0x22,
+	0x31,
+	0x29,
+	0x0e,
+	0x13,
+	0x0e,
+	0x2d,
+	0x04,
+	0x23,
+	0x2a,
+	0x3b,
+	0x34,
+	0x09,
+	0x10,
+	0x09,
+	0x39,
+	0x02,
+	0x1c,
+	0x2b,
+	0x3d,
+	0x36,
+	0x04,
+	0x0e,
+	0x04,
+	0x3b,
+	0x01,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+
+};
+#else
+{
+	0x02,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x10,
+	0x00,
+	0xf8,
+	0x00,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x10,
+	0x0c,
+	0x02,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1e,
+	0x00,
+	0x06,
+	0x0e,
+	0x08,
+	0x08,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x02,
+	0x03,
+	0x01,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x05,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x05,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x55,
+	0xfe,
+	0xc0,
+	0xff,
+	0xe0,
+	0xff,
+	0x00,
+	0x00,
+	0x0c,
+	0x0c,
+	0x07,
+	0x06,
+	0x05,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x05,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x05,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0xfc,
+	0x40,
+	0xff,
+	0xc0,
+	0xff,
+	0x00,
+	0x00,
+	0x1e,
+	0x1e,
+	0x12,
+	0x0f,
+	0x0d,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x0b,
+	0x12,
+	0x0d,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x58,
+	0x1a,
+	0x14,
+	0x0b,
+	0x11,
+	0x0e,
+	0x08,
+	0x00,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x1a,
+	0x13,
+	0x0b,
+	0x14,
+	0x10,
+	0x10,
+	0x00,
+	0x07,
+	0x00,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1e,
+	0x1a,
+	0x15,
+	0x0e,
+	0x14,
+	0x0e,
+	0x0e,
+	0x00,
+	0x07,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x1a,
+	0x15,
+	0x01,
+	0x08,
+	0x02,
+	0x01,
+	0x01,
+	0x08,
+	0x17,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x5d,
+	0x26,
+	0x14,
+	0x02,
+	0x07,
+	0x03,
+	0x04,
+	0x04,
+	0x07,
+	0x0e,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x32,
+	0x26,
+	0x1b,
+	0x05,
+	0x09,
+	0x04,
+	0x07,
+	0x07,
+	0x09,
+	0x0a,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x23,
+	0x26,
+	0x1a,
+	0x05,
+	0x0b,
+	0x08,
+	0x08,
+	0x08,
+	0x0b,
+	0x18,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x28,
+	0x26,
+	0x1e,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x08,
+	0x06,
+	0x03,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x15,
+	0x40,
+	0x1e,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x0a,
+	0x07,
+	0x0a,
+	0x01,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x27,
+	0x40,
+	0x3b,
+	0x00,
+	0x00,
+	0x00,
+	0x07,
+	0x0e,
+	0x09,
+	0x09,
+	0x03,
+	0x07,
+	0x01,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x31,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x12,
+	0x14,
+	0x12,
+	0x04,
+	0x09,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x40,
+	0x34,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x0b,
+	0x03,
+	0x07,
+	0x01,
+	0x01,
+	0x04,
+	0x01,
+	0x00,
+	0x1a,
+	0x40,
+	0x5f,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x0e,
+	0x01,
+	0x0f,
+	0x02,
+	0x03,
+	0x05,
+	0x01,
+	0x08,
+	0x29,
+	0x40,
+	0x53,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x11,
+	0x0e,
+	0x0d,
+	0x04,
+	0x07,
+	0x07,
+	0x01,
+	0x00,
+	0x2a,
+	0x40,
+	0x38,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x10,
+	0x0b,
+	0x14,
+	0x04,
+	0x06,
+	0x06,
+	0x01,
+	0x05,
+	0x34,
+	0x40,
+	0x46,
+	0x03,
+	0x06,
+	0x05,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x0e,
+	0x03,
+	0x06,
+	0x0b,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x36,
+	0x1a,
+	0x0f,
+	0x04,
+	0x07,
+	0x0f,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x1a,
+	0x13,
+	0x05,
+	0x07,
+	0x0d,
+	0x03,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x1a,
+	0x13,
+	0x01,
+	0x03,
+	0x01,
+	0x01,
+	0x01,
+	0x03,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x49,
+	0x26,
+	0x14,
+	0x01,
+	0x03,
+	0x05,
+	0x01,
+	0x01,
+	0x03,
+	0x0b,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x1b,
+	0x01,
+	0x03,
+	0x08,
+	0x01,
+	0x01,
+	0x03,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x28,
+	0x26,
+	0x1f,
+	0x01,
+	0x04,
+	0x08,
+	0x01,
+	0x01,
+	0x04,
+	0x13,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x28,
+	0x26,
+	0x1d,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x03,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x32,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x07,
+	0x06,
+	0x09,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x33,
+	0x40,
+	0x3c,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x09,
+	0x08,
+	0x0c,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x32,
+	0x40,
+	0x37,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0a,
+	0x0a,
+	0x11,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x39,
+	0x40,
+	0x38,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x08,
+	0x02,
+	0x05,
+	0x01,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x25,
+	0x40,
+	0x48,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x06,
+	0x0a,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x2e,
+	0x40,
+	0x42,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x09,
+	0x0e,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x30,
+	0x40,
+	0x3b,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x0b,
+	0x11,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x37,
+	0x40,
+	0x3c,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x3c,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x23,
+	0x27,
+	0x30,
+	0x29,
+	0x16,
+	0x18,
+	0x16,
+	0x2b,
+	0x07,
+	0x19,
+	0x24,
+	0x30,
+	0x28,
+	0x11,
+	0x15,
+	0x11,
+	0x2b,
+	0x04,
+	0x12,
+	0x2c,
+	0x3a,
+	0x33,
+	0x0e,
+	0x13,
+	0x0e,
+	0x37,
+	0x02,
+	0x0e,
+	0x24,
+	0x35,
+	0x30,
+	0x09,
+	0x10,
+	0x09,
+	0x33,
+	0x01,
+	0x0b,
+	0x25,
+	0x37,
+	0x31,
+	0x04,
+	0x0e,
+	0x04,
+	0x35,
+	0x00,
+	0x3c,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3d,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x2a,
+	0x35,
+	0x2f,
+	0x11,
+	0x15,
+	0x11,
+	0x31,
+	0x05,
+	0x2f,
+	0x22,
+	0x31,
+	0x29,
+	0x0e,
+	0x13,
+	0x0e,
+	0x2d,
+	0x04,
+	0x23,
+	0x2a,
+	0x3b,
+	0x34,
+	0x09,
+	0x10,
+	0x09,
+	0x39,
+	0x02,
+	0x1c,
+	0x2b,
+	0x3d,
+	0x36,
+	0x04,
+	0x0e,
+	0x04,
+	0x3b,
+	0x01,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+
+};
+#endif
+
+struct yushan_reg_clib_t yushan_regs_clib_ov8838 = {
+	.pdpclib_first_addr = 0x0dd7,
+	.pdpclib = &pdpclib_u_ov8838[0],
+	.pdpclib_size = ARRAY_SIZE(pdpclib_u_ov8838),
+
+	.dppclib_first_addr = 0xbe27,
+	.dppclib = &dppclib_u_ov8838[0],
+	.dppclib_size = ARRAY_SIZE(dppclib_u_ov8838),
+
+#if 1 
+	.dopclib_first_addr = 0x3bcc,
+#else
+	.dopclib_first_addr = 0x3bcc,
+#endif
+	.dopclib = &dopclib_u_ov8838[0],
+	.dopclib_size = ARRAY_SIZE(dopclib_u_ov8838),
+};
+
diff --git a/drivers/media/video/msm/rawchip/yushan_reg_s5k3h2yx.c b/drivers/media/video/msm/rawchip/yushan_reg_s5k3h2yx.c
new file mode 100644
index 0000000..ff237d2
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/yushan_reg_s5k3h2yx.c
@@ -0,0 +1,3238 @@
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include "Yushan_HTC_Functions.h"
+
+uint8_t pdpclib_u_s5k3h2yx[] =
+{
+	0x02,
+	0x00,
+	0x01,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0x00,
+	0x20,
+	0x00,
+	0x00,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x80,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0xff,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0xff,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0xff,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0xff,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0xff,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x08,
+	0x01,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x00,
+	0x12,
+	0xfe,
+	0xff,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x12,
+	0xfe,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x12,
+	0xfe,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x12,
+	0xfe,
+	0xff,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x12,
+	0xfe,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x04,
+	0x08,
+	0x0c,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x0a,
+	0x10,
+	0x17,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x0e,
+	0x17,
+	0x21,
+	0x78,
+	0x01,
+	0x00,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x02,
+	0x04,
+	0x06,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x05,
+	0x08,
+	0x0b,
+	0xd6,
+	0x01,
+	0x40,
+	0x01,
+	0x60,
+	0x02,
+	0x50,
+	0x03,
+	0x04,
+	0x07,
+	0x0c,
+	0x11,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x55,
+	0x01,
+	0x00,
+	0x00,
+	0xd5,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0xe0,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x01,
+	0x00,
+	0x00,
+	0xab,
+	0x0f,
+	0x00,
+	0x00,
+	0xab,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0xab,
+	0x00,
+	0x00,
+	0x00,
+	0xd5,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0xc0,
+	0x00,
+	0x00,
+	0x00,
+	0xff,
+	0x01,
+	0xff,
+	0x05,
+
+};
+
+uint8_t dppclib_u_s5k3h2yx[] =
+{
+	0x03,
+	0x00,
+	0x01,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0x00,
+	0x05,
+	0xfa,
+	0x7b,
+	0x00,
+	0x20,
+	0xfe,
+	0x1a,
+	0x01,
+	0x02,
+	0x05,
+	0x80,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0xfd,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x91,
+	0x02,
+	0x0a,
+	0xff,
+	0xff,
+	0xfd,
+	0x00,
+	0x00,
+	0x00,
+	0x0e,
+	0xff,
+	0xfb,
+	0x00,
+	0x00,
+	0xfc,
+	0x87,
+	0x03,
+	0x06,
+	0x00,
+	0xff,
+	0xfd,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x01,
+	0xff,
+	0x00,
+	0x00,
+	0xff,
+	0x80,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x74,
+	0x01,
+	0xfd,
+	0x01,
+	0x01,
+	0xfe,
+	0xff,
+	0x00,
+	0x00,
+	0xf7,
+	0x04,
+	0x07,
+	0x00,
+	0x00,
+	0x03,
+	0x78,
+	0x00,
+	0xfe,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xfa,
+	0x02,
+	0x05,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+
+};
+
+uint8_t dopclib_u_s5k3h2yx[] =
+#if 1 
+{
+	0x03,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x20,
+	0x00,
+	0x00,
+	0x02,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x10,
+	0x0c,
+	0x00,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x07,
+	0x0d,
+	0x13,
+	0x19,
+	0x1d,
+	0x1f,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x17,
+	0x14,
+	0x1f,
+	0x2e,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x07,
+	0x0f,
+	0x14,
+	0x1e,
+	0x00,
+	0x06,
+	0x0e,
+	0x08,
+	0x08,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x01,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x55,
+	0xfe,
+	0x80,
+	0xff,
+	0xe0,
+	0xff,
+	0x00,
+	0x00,
+	0x0d,
+	0x0d,
+	0x08,
+	0x06,
+	0x05,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x01,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0xab,
+	0xfb,
+	0xc0,
+	0xfe,
+	0x80,
+	0xff,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x15,
+	0x10,
+	0x0c,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x07,
+	0x0d,
+	0x09,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x5d,
+	0x1a,
+	0x12,
+	0x11,
+	0x17,
+	0x19,
+	0x0d,
+	0x00,
+	0x08,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x1a,
+	0x16,
+	0x0e,
+	0x14,
+	0x17,
+	0x0b,
+	0x00,
+	0x07,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x23,
+	0x1a,
+	0x15,
+	0x0a,
+	0x10,
+	0x09,
+	0x10,
+	0x00,
+	0x05,
+	0x00,
+	0x03,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x1a,
+	0x15,
+	0x04,
+	0x09,
+	0x06,
+	0x01,
+	0x01,
+	0x09,
+	0x02,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x7f,
+	0x26,
+	0x18,
+	0x07,
+	0x10,
+	0x0a,
+	0x09,
+	0x09,
+	0x10,
+	0x07,
+	0x07,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x26,
+	0x20,
+	0x06,
+	0x0c,
+	0x08,
+	0x0d,
+	0x00,
+	0x06,
+	0x06,
+	0x06,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x2e,
+	0x26,
+	0x21,
+	0x06,
+	0x0c,
+	0x06,
+	0x0d,
+	0x00,
+	0x07,
+	0x05,
+	0x06,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x2e,
+	0x26,
+	0x20,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x08,
+	0x06,
+	0x05,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x18,
+	0x40,
+	0x28,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x07,
+	0x09,
+	0x09,
+	0x01,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x40,
+	0x25,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x08,
+	0x09,
+	0x08,
+	0x03,
+	0x09,
+	0x01,
+	0x00,
+	0x00,
+	0x43,
+	0x40,
+	0x2f,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x0b,
+	0x0b,
+	0x0e,
+	0x02,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x33,
+	0x40,
+	0x30,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x0b,
+	0x04,
+	0x09,
+	0x01,
+	0x01,
+	0x05,
+	0x01,
+	0x00,
+	0x1a,
+	0x40,
+	0x64,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0b,
+	0x05,
+	0x08,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x16,
+	0x40,
+	0x35,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0d,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x03,
+	0x01,
+	0x00,
+	0x26,
+	0x40,
+	0x38,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x0e,
+	0x01,
+	0x14,
+	0x02,
+	0x03,
+	0x04,
+	0x01,
+	0x0f,
+	0x2a,
+	0x40,
+	0x3c,
+	0x02,
+	0x04,
+	0x03,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x0d,
+	0x05,
+	0x07,
+	0x0f,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x30,
+	0x1a,
+	0x13,
+	0x05,
+	0x09,
+	0x0f,
+	0x05,
+	0x00,
+	0x03,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1f,
+	0x1a,
+	0x16,
+	0x04,
+	0x08,
+	0x0f,
+	0x04,
+	0x00,
+	0x03,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x1a,
+	0x14,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x01,
+	0x03,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x7f,
+	0x26,
+	0x12,
+	0x02,
+	0x06,
+	0x0b,
+	0x01,
+	0x01,
+	0x06,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x4d,
+	0x26,
+	0x1c,
+	0x03,
+	0x07,
+	0x09,
+	0x04,
+	0x04,
+	0x07,
+	0x18,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x21,
+	0x02,
+	0x06,
+	0x0a,
+	0x03,
+	0x03,
+	0x06,
+	0x1a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x20,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x06,
+	0x03,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x24,
+	0x40,
+	0x39,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x09,
+	0x0b,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x4c,
+	0x40,
+	0x32,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x44,
+	0x40,
+	0x36,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x42,
+	0x40,
+	0x37,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0a,
+	0x03,
+	0x07,
+	0x01,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x23,
+	0x40,
+	0x4e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x04,
+	0x06,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x30,
+	0x40,
+	0x3e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x08,
+	0x07,
+	0x0b,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x3c,
+	0x40,
+	0x3c,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x07,
+	0x0b,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x33,
+	0x40,
+	0x3e,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x33,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x29,
+	0x33,
+	0x35,
+	0x2f,
+	0x16,
+	0x18,
+	0x16,
+	0x2e,
+	0x07,
+	0x1f,
+	0x33,
+	0x35,
+	0x2e,
+	0x11,
+	0x15,
+	0x11,
+	0x2d,
+	0x04,
+	0x16,
+	0x2e,
+	0x31,
+	0x28,
+	0x0e,
+	0x13,
+	0x0e,
+	0x27,
+	0x03,
+	0x10,
+	0x34,
+	0x3a,
+	0x32,
+	0x09,
+	0x10,
+	0x09,
+	0x32,
+	0x01,
+	0x0b,
+	0x2f,
+	0x38,
+	0x32,
+	0x04,
+	0x0e,
+	0x04,
+	0x33,
+	0x00,
+	0x33,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x38,
+	0x3b,
+	0x34,
+	0x11,
+	0x15,
+	0x11,
+	0x33,
+	0x05,
+	0x3a,
+	0x33,
+	0x36,
+	0x30,
+	0x0e,
+	0x13,
+	0x0e,
+	0x2e,
+	0x04,
+	0x29,
+	0x2a,
+	0x31,
+	0x28,
+	0x09,
+	0x10,
+	0x09,
+	0x27,
+	0x03,
+	0x1d,
+	0x24,
+	0x30,
+	0x27,
+	0x04,
+	0x0e,
+	0x04,
+	0x28,
+	0x02,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+
+};
+#else
+{
+	0x02,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x20,
+	0x00,
+	0x00,
+	0x02,
+	0xd0,
+	0x0c,
+	0xa0,
+	0x09,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0xcc,
+	0x00,
+	0xce,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x02,
+	0x00,
+	0x10,
+	0x0c,
+	0x00,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x07,
+	0x0d,
+	0x13,
+	0x19,
+	0x1d,
+	0x1f,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x17,
+	0x14,
+	0x1f,
+	0x2e,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x07,
+	0x0f,
+	0x14,
+	0x1e,
+	0x00,
+	0x06,
+	0x04,
+	0x02,
+	0x04,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x01,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x55,
+	0xfe,
+	0x80,
+	0xff,
+	0xe0,
+	0xff,
+	0x00,
+	0x00,
+	0x0d,
+	0x0d,
+	0x08,
+	0x06,
+	0x05,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x01,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0xab,
+	0xfb,
+	0xc0,
+	0xfe,
+	0x80,
+	0xff,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x15,
+	0x10,
+	0x0c,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x07,
+	0x0d,
+	0x09,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x5d,
+	0x1a,
+	0x12,
+	0x11,
+	0x17,
+	0x19,
+	0x0d,
+	0x00,
+	0x08,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x1a,
+	0x16,
+	0x0e,
+	0x14,
+	0x17,
+	0x0b,
+	0x00,
+	0x07,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x23,
+	0x1a,
+	0x15,
+	0x0a,
+	0x10,
+	0x09,
+	0x10,
+	0x00,
+	0x05,
+	0x00,
+	0x03,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x1a,
+	0x15,
+	0x04,
+	0x09,
+	0x06,
+	0x01,
+	0x01,
+	0x09,
+	0x02,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x7f,
+	0x26,
+	0x18,
+	0x07,
+	0x10,
+	0x0a,
+	0x09,
+	0x09,
+	0x10,
+	0x07,
+	0x07,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x26,
+	0x20,
+	0x06,
+	0x0c,
+	0x08,
+	0x0d,
+	0x00,
+	0x06,
+	0x06,
+	0x06,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x2e,
+	0x26,
+	0x21,
+	0x06,
+	0x0c,
+	0x06,
+	0x0d,
+	0x00,
+	0x07,
+	0x05,
+	0x06,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x2e,
+	0x26,
+	0x20,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x08,
+	0x06,
+	0x05,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x18,
+	0x40,
+	0x28,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x07,
+	0x09,
+	0x09,
+	0x01,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x37,
+	0x40,
+	0x25,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x08,
+	0x09,
+	0x08,
+	0x03,
+	0x09,
+	0x01,
+	0x00,
+	0x00,
+	0x43,
+	0x40,
+	0x2f,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x0b,
+	0x0b,
+	0x0e,
+	0x02,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x33,
+	0x40,
+	0x30,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x0b,
+	0x04,
+	0x09,
+	0x01,
+	0x01,
+	0x05,
+	0x01,
+	0x00,
+	0x1a,
+	0x40,
+	0x64,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0b,
+	0x05,
+	0x08,
+	0x00,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x16,
+	0x40,
+	0x35,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0d,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x03,
+	0x01,
+	0x00,
+	0x26,
+	0x40,
+	0x38,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x0e,
+	0x01,
+	0x14,
+	0x02,
+	0x03,
+	0x04,
+	0x01,
+	0x0f,
+	0x2a,
+	0x40,
+	0x3c,
+	0x02,
+	0x04,
+	0x03,
+	0x01,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1a,
+	0x0d,
+	0x05,
+	0x07,
+	0x0f,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x30,
+	0x1a,
+	0x13,
+	0x05,
+	0x09,
+	0x0f,
+	0x05,
+	0x00,
+	0x03,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1f,
+	0x1a,
+	0x16,
+	0x04,
+	0x08,
+	0x0f,
+	0x04,
+	0x00,
+	0x03,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x1a,
+	0x14,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x01,
+	0x03,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x7f,
+	0x26,
+	0x12,
+	0x02,
+	0x06,
+	0x0b,
+	0x01,
+	0x01,
+	0x06,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x4d,
+	0x26,
+	0x1c,
+	0x03,
+	0x07,
+	0x09,
+	0x04,
+	0x04,
+	0x07,
+	0x18,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x21,
+	0x02,
+	0x06,
+	0x0a,
+	0x03,
+	0x03,
+	0x06,
+	0x1a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2c,
+	0x26,
+	0x20,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x06,
+	0x03,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x24,
+	0x40,
+	0x39,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x09,
+	0x0b,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x4c,
+	0x40,
+	0x32,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x44,
+	0x40,
+	0x36,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x08,
+	0x09,
+	0x0e,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x42,
+	0x40,
+	0x37,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x0a,
+	0x03,
+	0x07,
+	0x01,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x23,
+	0x40,
+	0x4e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x04,
+	0x06,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x30,
+	0x40,
+	0x3e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x08,
+	0x07,
+	0x0b,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x3c,
+	0x40,
+	0x3c,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x09,
+	0x07,
+	0x0b,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x33,
+	0x40,
+	0x3e,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x33,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x29,
+	0x33,
+	0x35,
+	0x2f,
+	0x16,
+	0x18,
+	0x16,
+	0x2e,
+	0x07,
+	0x1f,
+	0x33,
+	0x35,
+	0x2e,
+	0x11,
+	0x15,
+	0x11,
+	0x2d,
+	0x04,
+	0x16,
+	0x2e,
+	0x31,
+	0x28,
+	0x0e,
+	0x13,
+	0x0e,
+	0x27,
+	0x03,
+	0x10,
+	0x34,
+	0x3a,
+	0x32,
+	0x09,
+	0x10,
+	0x09,
+	0x32,
+	0x01,
+	0x0b,
+	0x2f,
+	0x38,
+	0x32,
+	0x04,
+	0x0e,
+	0x04,
+	0x33,
+	0x00,
+	0x33,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x38,
+	0x3b,
+	0x34,
+	0x11,
+	0x15,
+	0x11,
+	0x33,
+	0x05,
+	0x3a,
+	0x33,
+	0x36,
+	0x30,
+	0x0e,
+	0x13,
+	0x0e,
+	0x2e,
+	0x04,
+	0x29,
+	0x2a,
+	0x31,
+	0x28,
+	0x09,
+	0x10,
+	0x09,
+	0x27,
+	0x03,
+	0x1d,
+	0x24,
+	0x30,
+	0x27,
+	0x04,
+	0x0e,
+	0x04,
+	0x28,
+	0x02,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+
+};
+#endif
+
+struct yushan_reg_clib_t yushan_regs_clib_s5k3h2yx = {
+	.pdpclib_first_addr = 0x0dd7,
+	.pdpclib = &pdpclib_u_s5k3h2yx[0],
+	.pdpclib_size = ARRAY_SIZE(pdpclib_u_s5k3h2yx),
+
+	.dppclib_first_addr = 0xbe27,
+	.dppclib = &dppclib_u_s5k3h2yx[0],
+	.dppclib_size = ARRAY_SIZE(dppclib_u_s5k3h2yx),
+
+#if 1 
+	.dopclib_first_addr = 0x3bcc,
+#else
+	.dopclib_first_addr = 0x3bcc,
+#endif
+	.dopclib = &dopclib_u_s5k3h2yx[0],
+	.dopclib_size = ARRAY_SIZE(dopclib_u_s5k3h2yx),
+};
+
diff --git a/drivers/media/video/msm/rawchip/yushan_reg_s5k6a2ya.c b/drivers/media/video/msm/rawchip/yushan_reg_s5k6a2ya.c
new file mode 100644
index 0000000..7dfde38
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/yushan_reg_s5k6a2ya.c
@@ -0,0 +1,2150 @@
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include "Yushan_HTC_Functions.h"
+
+uint8_t pdpclib_u_s5k6a2ya[] =
+{
+		0x02,
+		0x01,
+		0x01,
+		0xc0,
+		0x05,
+		0x50,
+		0x04,
+		0x00,
+		0x20,
+		0x00,
+		0x00,
+		0x02,
+		0x01,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x20,
+		0x00,
+		0x00,
+		0x01,
+		0x00,
+		0x02,
+		0x00,
+		0x04,
+		0x00,
+		0x08,
+		0x00,
+		0x10,
+		0x80,
+		0x00,
+		0x00,
+		0x01,
+		0x00,
+		0x02,
+		0x00,
+		0x00,
+		0x00,
+		0x01,
+		0x00,
+		0x00,
+		0x80,
+		0x00,
+		0x00,
+		0x00,
+		0x40,
+		0x00,
+		0x00,
+		0x00,
+		0x20,
+		0x00,
+		0x09,
+		0x01,
+		0x42,
+		0x43,
+		0x43,
+		0x43,
+		0x09,
+		0x01,
+		0x42,
+		0x43,
+		0x43,
+		0x43,
+		0x09,
+		0x01,
+		0x42,
+		0x43,
+		0x43,
+		0x43,
+		0x09,
+		0x01,
+		0x42,
+		0x43,
+		0x42,
+		0x43,
+		0x09,
+		0x01,
+		0x42,
+		0x43,
+		0x42,
+		0x43,
+		0x09,
+		0x01,
+		0x42,
+		0x43,
+		0x42,
+		0x43,
+		0x09,
+		0x01,
+		0x43,
+		0x43,
+		0x43,
+		0x43,
+		0x09,
+		0x01,
+		0x43,
+		0x43,
+		0x43,
+		0x43,
+		0x09,
+		0x01,
+		0x43,
+		0x43,
+		0x43,
+		0x43,
+		0x09,
+		0x01,
+		0x43,
+		0x43,
+		0x43,
+		0x44,
+		0x09,
+		0x01,
+		0x43,
+		0x43,
+		0x43,
+		0x44,
+		0x09,
+		0x01,
+		0x43,
+		0x43,
+		0x43,
+		0x44,
+		0x09,
+		0x01,
+		0x42,
+		0x43,
+		0x42,
+		0x43,
+		0x09,
+		0x01,
+		0x42,
+		0x43,
+		0x42,
+		0x43,
+		0x09,
+		0x01,
+		0x42,
+		0x43,
+		0x42,
+		0x43,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x01,
+		0x00,
+		0x02,
+		0x00,
+		0x08,
+		0x00,
+		0x10,
+		0x78,
+		0x01,
+		0x00,
+		0x01,
+		0x60,
+		0x02,
+		0x50,
+		0x03,
+		0x04,
+		0x09,
+		0x0e,
+		0x13,
+		0xd6,
+		0x01,
+		0x40,
+		0x01,
+		0x60,
+		0x02,
+		0x50,
+		0x03,
+		0x04,
+		0x10,
+		0x1c,
+		0x27,
+		0xd6,
+		0x01,
+		0x40,
+		0x01,
+		0x60,
+		0x02,
+		0x50,
+		0x03,
+		0x04,
+		0x17,
+		0x27,
+		0x36,
+		0x78,
+		0x01,
+		0x00,
+		0x01,
+		0x60,
+		0x02,
+		0x50,
+		0x03,
+		0x04,
+		0x04,
+		0x07,
+		0x0a,
+		0xd6,
+		0x01,
+		0x40,
+		0x01,
+		0x60,
+		0x02,
+		0x50,
+		0x03,
+		0x04,
+		0x08,
+		0x0e,
+		0x13,
+		0xd6,
+		0x01,
+		0x40,
+		0x01,
+		0x60,
+		0x02,
+		0x50,
+		0x03,
+		0x04,
+		0x0b,
+		0x13,
+		0x1b,
+		0xab,
+		0x0f,
+		0x00,
+		0x00,
+		0xab,
+		0x0a,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x2b,
+		0x01,
+		0x00,
+		0x00,
+		0x55,
+		0x02,
+		0x00,
+		0x00,
+		0x55,
+		0x03,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0xe0,
+		0x00,
+		0x00,
+		0x00,
+		0x60,
+		0x01,
+		0x00,
+		0x00,
+		0xe0,
+		0x01,
+		0x00,
+		0x00,
+		0xab,
+		0x0f,
+		0x00,
+		0x00,
+		0xab,
+		0x0a,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0xab,
+		0x00,
+		0x00,
+		0x00,
+		0x2b,
+		0x01,
+		0x00,
+		0x00,
+		0x80,
+		0x01,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x60,
+		0x00,
+		0x00,
+		0x00,
+		0xa0,
+		0x00,
+		0x00,
+		0x00,
+		0x00,
+		0x01,
+		0x00,
+		0x00,
+		0xff,
+		0x01,
+		0xff,
+		0x05,
+};
+
+uint8_t dppclib_u_s5k6a2ya[] =
+{
+	0x02,
+	0x01,
+	0x01,
+	0xc0,
+	0x05,
+	0x50,
+	0x04,
+	0x00,
+	0x05,
+	0xfa,
+	0x36,
+	0x00,
+	0xca,
+	0xfe,
+	0x1a,
+	0x01,
+	0x02,
+	0x05,
+	0x80,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0xff,
+	0x00,
+	0x00,
+	0xff,
+	0x00,
+	0xff,
+	0x00,
+	0x00,
+	0xa5,
+	0xfe,
+	0x11,
+	0x00,
+	0xfd,
+	0x02,
+	0x01,
+	0xff,
+	0x00,
+	0x1c,
+	0xff,
+	0xef,
+	0xff,
+	0x00,
+	0xf7,
+	0x99,
+	0x00,
+	0x0c,
+	0x00,
+	0xfd,
+	0x02,
+	0x01,
+	0xff,
+	0x00,
+	0x12,
+	0xff,
+	0xf5,
+	0xff,
+	0x00,
+	0xfa,
+	0x80,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x7b,
+	0x02,
+	0xfd,
+	0x00,
+	0x00,
+	0xff,
+	0xff,
+	0x00,
+	0x00,
+	0xfb,
+	0xff,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x7a,
+	0x01,
+	0xfd,
+	0x00,
+	0x00,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0xfb,
+	0xff,
+	0x02,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+};
+
+uint8_t dopclib_u_s5k6a2ya[] =
+{
+	0x02,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x20,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x01,
+	0x00,
+	0x08,
+	0x20,
+	0x00,
+	0x00,
+	0x02,
+	0xc0,
+	0x05,
+	0x50,
+	0x04,
+	0x5c,
+	0x00,
+	0x5e,
+	0x00,
+	0x5c,
+	0x00,
+	0x5e,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x0c,
+	0x00,
+	0xe6,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x65,
+	0x43,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x43,
+	0x21,
+	0x10,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x11,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x22,
+	0x21,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x00,
+	0x03,
+	0x02,
+	0x01,
+	0x0b,
+	0x38,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x1e,
+	0x00,
+	0x06,
+	0x0e,
+	0x08,
+	0x08,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x33,
+	0x9f,
+	0x52,
+	0x9f,
+	0x43,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0a,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x66,
+	0x9f,
+	0x4d,
+	0x9f,
+	0x76,
+	0x0c,
+	0x00,
+	0x14,
+	0x00,
+	0x3c,
+	0x00,
+	0x10,
+	0x27,
+	0x04,
+	0x00,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x64,
+	0x00,
+	0x4c,
+	0x04,
+	0x00,
+	0x01,
+	0x12,
+	0x12,
+	0x0d,
+	0x06,
+	0x10,
+	0x84,
+	0x03,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x04,
+	0x03,
+	0x04,
+	0x03,
+	0x02,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x07,
+	0x0c,
+	0x11,
+	0x06,
+	0x0f,
+	0x11,
+	0x06,
+	0x14,
+	0x11,
+	0x05,
+	0x1a,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x80,
+	0x02,
+	0x23,
+	0x23,
+	0x7f,
+	0x1d,
+	0x1d,
+	0x7f,
+	0x05,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xb8,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xc4,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x01,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x01,
+	0x03,
+	0x01,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x01,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x04,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x55,
+	0xfe,
+	0x80,
+	0xff,
+	0xe0,
+	0xff,
+	0x00,
+	0x00,
+	0x0d,
+	0x0d,
+	0x08,
+	0x06,
+	0x05,
+	0x80,
+	0x02,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x00,
+	0x04,
+	0x05,
+	0x03,
+	0x04,
+	0x00,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x01,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x04,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x55,
+	0xfb,
+	0xc0,
+	0xfe,
+	0xa0,
+	0xff,
+	0x00,
+	0x00,
+	0x23,
+	0x23,
+	0x15,
+	0x10,
+	0x0d,
+	0x65,
+	0x54,
+	0x33,
+	0x32,
+	0x65,
+	0x43,
+	0x32,
+	0x22,
+	0x54,
+	0x33,
+	0x22,
+	0x11,
+	0x54,
+	0x32,
+	0x21,
+	0x11,
+	0x43,
+	0x32,
+	0x11,
+	0x10,
+	0x43,
+	0x22,
+	0x11,
+	0x00,
+	0x01,
+	0x01,
+	0x01,
+	0x0f,
+	0x05,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x1a,
+	0x00,
+	0x01,
+	0x01,
+	0x0b,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x1a,
+	0x00,
+	0x01,
+	0x01,
+	0x0a,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x1a,
+	0x25,
+	0x01,
+	0x01,
+	0x07,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x1a,
+	0x0f,
+	0x00,
+	0x00,
+	0x17,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x06,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x26,
+	0x40,
+	0x00,
+	0x01,
+	0x00,
+	0x04,
+	0x05,
+	0x02,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x26,
+	0x11,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x0a,
+	0x01,
+	0x06,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x19,
+	0x40,
+	0x7f,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x08,
+	0x00,
+	0x03,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x15,
+	0x40,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x07,
+	0x02,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0b,
+	0x40,
+	0x61,
+	0x00,
+	0x00,
+	0x00,
+	0x03,
+	0x06,
+	0x00,
+	0x03,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x1a,
+	0x40,
+	0x30,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x09,
+	0x01,
+	0x05,
+	0x00,
+	0x01,
+	0x02,
+	0x00,
+	0x00,
+	0x0f,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x07,
+	0x01,
+	0x02,
+	0x01,
+	0x01,
+	0x02,
+	0x01,
+	0x00,
+	0x1a,
+	0x40,
+	0x66,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x07,
+	0x01,
+	0x03,
+	0x01,
+	0x01,
+	0x02,
+	0x01,
+	0x00,
+	0x1c,
+	0x40,
+	0x46,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x06,
+	0x00,
+	0x03,
+	0x01,
+	0x00,
+	0x02,
+	0x01,
+	0x04,
+	0x1f,
+	0x40,
+	0x34,
+	0x01,
+	0x01,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x1a,
+	0x42,
+	0x01,
+	0x01,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x1a,
+	0x22,
+	0x01,
+	0x01,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x1a,
+	0x1d,
+	0x01,
+	0x01,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0c,
+	0x1a,
+	0x18,
+	0x00,
+	0x00,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x0a,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x26,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x04,
+	0x02,
+	0x03,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x26,
+	0x25,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x05,
+	0x01,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x27,
+	0x40,
+	0x58,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x05,
+	0x02,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x25,
+	0x40,
+	0x4a,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x05,
+	0x02,
+	0x04,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x26,
+	0x40,
+	0x40,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x05,
+	0x04,
+	0x05,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x2b,
+	0x40,
+	0x3f,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x06,
+	0x01,
+	0x04,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x2b,
+	0x40,
+	0x50,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x01,
+	0x03,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x29,
+	0x40,
+	0x46,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x02,
+	0x04,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x2b,
+	0x40,
+	0x41,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x05,
+	0x03,
+	0x05,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x2f,
+	0x40,
+	0x3f,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x14,
+	0x2b,
+	0x3f,
+	0x14,
+	0x1b,
+	0x3f,
+	0x3f,
+	0x0f,
+	0x3f,
+	0x3f,
+	0x20,
+	0x14,
+	0x00,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x00,
+	0xc0,
+	0xfa,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x40,
+	0x07,
+	0x00,
+	0x00,
+	0x15,
+	0x15,
+	0x00,
+	0x1c,
+	0x1c,
+	0x39,
+	0x34,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x2a,
+	0x33,
+	0x36,
+	0x30,
+	0x16,
+	0x18,
+	0x16,
+	0x2f,
+	0x07,
+	0x20,
+	0x33,
+	0x36,
+	0x30,
+	0x11,
+	0x15,
+	0x11,
+	0x2f,
+	0x04,
+	0x17,
+	0x2c,
+	0x31,
+	0x29,
+	0x0e,
+	0x13,
+	0x0e,
+	0x29,
+	0x03,
+	0x11,
+	0x34,
+	0x3a,
+	0x33,
+	0x09,
+	0x10,
+	0x09,
+	0x33,
+	0x01,
+	0x0c,
+	0x2d,
+	0x3a,
+	0x33,
+	0x04,
+	0x0e,
+	0x04,
+	0x35,
+	0x00,
+	0x34,
+	0x80,
+	0x01,
+	0x00,
+	0x03,
+	0x00,
+	0x06,
+	0x00,
+	0x0c,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x16,
+	0x18,
+	0x16,
+	0x3f,
+	0x07,
+	0x3f,
+	0x38,
+	0x3c,
+	0x34,
+	0x11,
+	0x15,
+	0x11,
+	0x34,
+	0x05,
+	0x3c,
+	0x32,
+	0x36,
+	0x30,
+	0x0e,
+	0x13,
+	0x0e,
+	0x30,
+	0x04,
+	0x2b,
+	0x2a,
+	0x31,
+	0x28,
+	0x09,
+	0x10,
+	0x09,
+	0x28,
+	0x03,
+	0x1e,
+	0x23,
+	0x31,
+	0x28,
+	0x04,
+	0x0e,
+	0x04,
+	0x2b,
+	0x02,
+	0x40,
+	0x00,
+	0x02,
+	0x00,
+	0x06,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+};
+
+
+struct yushan_reg_clib_t yushan_regs_clib_s5k6a2ya = {
+	.pdpclib_first_addr = 0x0dd7,
+	.pdpclib = &pdpclib_u_s5k6a2ya[0],
+	.pdpclib_size = ARRAY_SIZE(pdpclib_u_s5k6a2ya),
+
+	.dppclib_first_addr = 0xbe27,
+	.dppclib = &dppclib_u_s5k6a2ya[0],
+	.dppclib_size = ARRAY_SIZE(dppclib_u_s5k6a2ya),
+
+	.dopclib_first_addr = 0x3bcc,
+	.dopclib = &dopclib_u_s5k6a2ya[0],
+	.dopclib_size = ARRAY_SIZE(dopclib_u_s5k6a2ya),
+};
+
diff --git a/drivers/media/video/msm/rawchip/yushan_registermap.h b/drivers/media/video/msm/rawchip/yushan_registermap.h
new file mode 100644
index 0000000..39cac6f
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/yushan_registermap.h
@@ -0,0 +1,405 @@
+/*   Header file is automatically generated by Spirit2RegBank (version 3.14) at 06/08/11 on 12:16:54
+*
+*    STMicroelectronics reserves the rights to make changes without
+*    notice at any time. STMicroelectronics makes no warranty,
+*    expressed, implied or statutary, including but  limited to any
+*    implied warranty or merchantability or fitness for any particular
+*    purpose, or that the use will not infringe any third party patent,
+*    copyright or trademark. STMicroelectronics shall not be liable
+*    for any loss or damage arising from the use of its libraries or
+*    software.
+*
+*    This file may be used and  copied  with the  inclusion of the  above
+*    copyright notice. This file or any other copies thereof may not be
+*    provided or otherwise made available to  any other person. No title to
+*    and ownership of this file is hereby transferred.} */
+
+#ifndef __yushan_registermap_H
+#define __yushan_registermap_H
+
+#define         YUSHAN_CLK_DIV_FACTOR	0x0
+#define         YUSHAN_CLK_DIV_FACTOR_2	0x4
+#define         YUSHAN_CLK_CTRL	0x8
+#define         YUSHAN_RESET_CTRL	0xc
+#define         YUSHAN_PLL_CTRL_MAIN	0x10
+#define         YUSHAN_PLL_LOOP_OUT_DF	0x14
+#define         YUSHAN_PLL_SSCG_CTRL	0x18
+#define         YUSHAN_HOST_IF_SPI_CTRL	0x800
+#define         YUSHAN_HOST_IF_SPI_DEVADDR	0x804
+#define         YUSHAN_HOST_IF_SPI_BASE_ADDRESS	0x808
+#define         YUSHAN_ITM_CSI2RX_STATUS	0xc00
+#define         YUSHAN_ITM_CSI2RX_EN_STATUS	0xc04
+#define         YUSHAN_ITM_CSI2RX_STATUS_BCLR	0xc08
+#define         YUSHAN_ITM_CSI2RX_STATUS_BSET	0xc0c
+#define         YUSHAN_ITM_CSI2RX_EN_STATUS_BCLR	0xc10
+#define         YUSHAN_ITM_CSI2RX_EN_STATUS_BSET	0xc14
+#define         YUSHAN_ITM_PDP_STATUS	0xc18
+#define         YUSHAN_ITM_PDP_EN_STATUS	0xc1c
+#define         YUSHAN_ITM_PDP_STATUS_BCLR	0xc20
+#define         YUSHAN_ITM_PDP_STATUS_BSET	0xc24
+#define         YUSHAN_ITM_PDP_EN_STATUS_BCLR	0xc28
+#define         YUSHAN_ITM_PDP_EN_STATUS_BSET	0xc2c
+#define         YUSHAN_ITM_DPP_STATUS	0xc30
+#define         YUSHAN_ITM_DPP_EN_STATUS	0xc34
+#define         YUSHAN_ITM_DPP_STATUS_BCLR	0xc38
+#define         YUSHAN_ITM_DPP_STATUS_BSET	0xc3c
+#define         YUSHAN_ITM_DPP_EN_STATUS_BCLR	0xc40
+#define         YUSHAN_ITM_DPP_EN_STATUS_BSET	0xc44
+#define         YUSHAN_ITM_DOP7_STATUS	0xc48
+#define         YUSHAN_ITM_DOP7_EN_STATUS	0xc4c
+#define         YUSHAN_ITM_DOP7_STATUS_BCLR	0xc50
+#define         YUSHAN_ITM_DOP7_STATUS_BSET	0xc54
+#define         YUSHAN_ITM_DOP7_EN_STATUS_BCLR	0xc58
+#define         YUSHAN_ITM_DOP7_EN_STATUS_BSET	0xc5c
+#define         YUSHAN_ITM_CSI2TX_STATUS	0xc60
+#define         YUSHAN_ITM_CSI2TX_EN_STATUS	0xc64
+#define         YUSHAN_ITM_CSI2TX_STATUS_BCLR	0xc68
+#define         YUSHAN_ITM_CSI2TX_STATUS_BSET	0xc6c
+#define         YUSHAN_ITM_CSI2TX_EN_STATUS_BCLR	0xc70
+#define         YUSHAN_ITM_CSI2TX_EN_STATUS_BSET	0xc74
+#define         YUSHAN_ITM_RX_PHY_STATUS	0xc78
+#define         YUSHAN_ITM_RX_PHY_EN_STATUS	0xc7c
+#define         YUSHAN_ITM_RX_PHY_STATUS_BCLR	0xc80
+#define         YUSHAN_ITM_RX_PHY_STATUS_BSET	0xc84
+#define         YUSHAN_ITM_RX_PHY_EN_STATUS_BCLR	0xc88
+#define         YUSHAN_ITM_RX_PHY_EN_STATUS_BSET	0xc8c
+#define         YUSHAN_ITM_TX_PHY_STATUS	0xc90
+#define         YUSHAN_ITM_TX_PHY_EN_STATUS	0xc94
+#define         YUSHAN_ITM_TX_PHY_STATUS_BCLR	0xc98
+#define         YUSHAN_ITM_TX_PHY_STATUS_BSET	0xc9c
+#define         YUSHAN_ITM_TX_PHY_EN_STATUS_BCLR	0xca0
+#define         YUSHAN_ITM_TX_PHY_EN_STATUS_BSET	0xca4
+#define         YUSHAN_ITM_IDP_STATUS	0xca8
+#define         YUSHAN_ITM_IDP_EN_STATUS	0xcac
+#define         YUSHAN_ITM_IDP_STATUS_BCLR	0xcb0
+#define         YUSHAN_ITM_IDP_STATUS_BSET	0xcb4
+#define         YUSHAN_ITM_IDP_EN_STATUS_BCLR	0xcb8
+#define         YUSHAN_ITM_IDP_EN_STATUS_BSET	0xcbc
+#define         YUSHAN_ITM_RX_CHAR_STATUS	0xcc0
+#define         YUSHAN_ITM_RX_CHAR_EN_STATUS	0xcc4
+#define         YUSHAN_ITM_RX_CHAR_STATUS_BCLR	0xcc8
+#define         YUSHAN_ITM_RX_CHAR_STATUS_BSET	0xccc
+#define         YUSHAN_ITM_RX_CHAR_EN_STATUS_BCLR	0xcd0
+#define         YUSHAN_ITM_RX_CHAR_EN_STATUS_BSET	0xcd4
+#define         YUSHAN_ITM_LBE_POST_DXO_STATUS	0xcd8
+#define         YUSHAN_ITM_LBE_POST_DXO_EN_STATUS	0xcdc
+#define         YUSHAN_ITM_LBE_POST_DXO_STATUS_BCLR	0xce0
+#define         YUSHAN_ITM_LBE_POST_DXO_STATUS_BSET 	0xce4
+#define         YUSHAN_ITM_LBE_POST_DXO_EN_STATUS_BCLR	0xce8
+#define         YUSHAN_ITM_LBE_POST_DXO_EN_STATUS_BSET	0xcec
+#define         YUSHAN_ITM_SYS_DOMAIN_STATUS	0xcf0
+#define         YUSHAN_ITM_SYS_DOMAIN_EN_STATUS	0xcf4
+#define         YUSHAN_ITM_SYS_DOMAIN_STATUS_BCLR	0xcf8
+#define         YUSHAN_ITM_SYS_DOMAIN_STATUS_BSET	0xcfc
+#define         YUSHAN_ITM_SYS_DOMAIN_EN_STATUS_BCLR	0xd00
+#define         YUSHAN_ITM_SYS_DOMAIN_EN_STATUS_BSET	0xd04
+#define         YUSHAN_ITM_ITPOINT_STATUS	0xd08
+#define         YUSHAN_ITM_ITPOINT_EN_STATUS	0xd0c
+#define         YUSHAN_ITM_ITPOINT_STATUS_BCLR	0xd10
+#define         YUSHAN_ITM_ITPOINT_STATUS_BSET	0xd14
+#define         YUSHAN_ITM_ITPOINT_EN_STATUS_BCLR	0xd18
+#define         YUSHAN_ITM_ITPOINT_EN_STATUS_BSET	0xd1c
+#define         YUSHAN_ITM_P2W_UFLOW_STATUS	0xd20
+#define         YUSHAN_ITM_P2W_UFLOW_EN_STATUS	0xd24
+#define         YUSHAN_ITM_P2W_UFLOW_STATUS_BCLR	0xd28
+#define         YUSHAN_ITM_P2W_UFLOW_STATUS_BSET	0xd2c
+#define         YUSHAN_ITM_P2W_UFLOW_EN_STATUS_BCLR	0xd30
+#define         YUSHAN_ITM_P2W_UFLOW_EN_STATUS_BSET	0xd34
+#define         YUSHAN_IOR_NVM_CTRL 0x1000
+#define         YUSHAN_IOR_NVM_STATUS                                                     0x1004
+#define         YUSHAN_IOR_NVM_DATA_WORD_0                                                0x1008
+#define         YUSHAN_IOR_NVM_DATA_WORD_1                                                0x100c
+#define         YUSHAN_IOR_NVM_DATA_WORD_2                                                0x1010
+#define         YUSHAN_IOR_NVM_DATA_WORD_3                                                0x1014
+#define         YUSHAN_IOR_NVM_HYST                                                       0x1018
+#define         YUSHAN_IOR_NVM_PDN                                                        0x101c
+#define         YUSHAN_IOR_NVM_PUN                                                        0x1020
+#define         YUSHAN_IOR_NVM_LOWEMI                                                     0x1024
+#define         YUSHAN_IOR_NVM_PAD_IN                                                     0x1028
+#define         YUSHAN_IOR_NVM_RATIO_PAD                                                  0x102c
+#define         YUSHAN_IOR_NVM_SEND_ITR_PAD1                                              0x1030
+#define         YUSHAN_IOR_NVM_INTR_STATUS                                                0x1034
+#define         YUSHAN_IOR_NVM_LDO_STS_REG                                                0x1038
+#define		 YUSHAN_PRIVATE_TEST_LDO_CTRL											   0x1405
+#define		 YUSHAN_PRIVATE_TEST_LDO_NVM_CTRL										   0x1406
+#define         YUSHAN_T1_DMA_REG_ENABLE                                                  0x1a00
+#define         YUSHAN_T1_DMA_REG_VERSION                                                 0x1a04
+#define         YUSHAN_T1_DMA_REG_STATUS                                                  0x1a08
+#define         YUSHAN_T1_DMA_REG_REFILL_ELT_NB                                           0x1a0c
+#define         YUSHAN_T1_DMA_REG_REFILL_ERROR                                            0x1a10
+#define         YUSHAN_T1_DMA_REG_DFV_CONTROL                                             0x1a14
+#define         YUSHAN_T1_DMA_MEM_PAGE                                                    0x1c00
+#define         YUSHAN_T1_DMA_MEM_LOWER_ELT                                               0x1c04
+#define         YUSHAN_T1_DMA_MEM_UPPER_ELT                                               0x1c08
+#define         YUSHAN_MIPI_RX_ENABLE                                                     0x2000
+#define         YUSHAN_MIPI_RX_UIX4                                                       0x2004
+#define         YUSHAN_MIPI_RX_SWAP_PINS                                                  0x2008
+#define         YUSHAN_MIPI_RX_INVERT_HS                                                  0x200c
+#define         YUSHAN_MIPI_RX_STOP_STATE                                                 0x2010
+#define         YUSHAN_MIPI_RX_ULP_STATE                                                  0x2014
+#define         YUSHAN_MIPI_RX_CLK_ACTIVE                                                 0x2018
+#define         YUSHAN_MIPI_RX_FORCE_RX_MODE_DL                                           0x201c
+#define         YUSHAN_MIPI_RX_TEST_RESERVED                                              0x2020
+#define         YUSHAN_MIPI_RX_ESC_DL_STS                                                 0x2024
+#define         YUSHAN_MIPI_RX_EOT_BYPASS                                                 0x2028
+#define         YUSHAN_MIPI_RX_HSRX_SHIFT_CL                                              0x202c
+#define         YUSHAN_MIPI_RX_HS_RX_SHIFT_DL                                             0x2030
+#define         YUSHAN_MIPI_RX_VIL_CL                                                     0x2034
+#define         YUSHAN_MIPI_RX_VIL_DL                                                     0x2038
+#define         YUSHAN_MIPI_RX_OVERSAMPLE_BYPASS                                          0x203c
+#define         YUSHAN_MIPI_RX_OVERSAMPLE_FLAG1                                           0x2040
+#define         YUSHAN_MIPI_RX_SKEW_OFFSET_1                                              0x2044
+#define         YUSHAN_MIPI_RX_SKEW_OFFSET_2                                              0x2048
+#define         YUSHAN_MIPI_RX_SKEW_OFFSET_3                                              0x204c
+#define         YUSHAN_MIPI_RX_SKEW_OFFSET_4                                              0x2050
+#define         YUSHAN_MIPI_RX_OFFSET_CL                                                  0x2054
+#define         YUSHAN_MIPI_RX_CALIBRATE                                                  0x2058
+#define         YUSHAN_MIPI_RX_SPECS                                                      0x205c
+#define         YUSHAN_MIPI_RX_COMP                                                       0x2060
+#define         YUSHAN_MIPI_RX_MIPI_IN_SHORT                                              0x2064
+#define         YUSHAN_MIPI_RX_LANE_CTRL                                                  0x2068
+#define         YUSHAN_CSI2_RX_ENABLE                                                     0x2400
+#define         YUSHAN_CSI2_RX_VER_CTRL                                                   0x2404
+#define         YUSHAN_CSI2_RX_NB_DATA_LANES                                              0x2408
+#define         YUSHAN_CSI2_RX_IMG_UNPACKING_FORMAT                                       0x240c
+#define         YUSHAN_CSI2_RX_WAIT_AFTER_PACKET_END                                      0x2410
+#define         YUSHAN_CSI2_RX_MULTIPLE_OF_5_HSYNC_EXTENSION_ENABLE                       0x2414
+#define         YUSHAN_CSI2_RX_MULTIPLE_OF_5_HSYNC_EXTENSION_PADDING_DATA                 0x2418
+#define         YUSHAN_CSI2_RX_CHARACTERIZATION_MODE                                      0x241c
+#define         YUSHAN_CSI2_RX_BYTE2PIXEL_READ_TH                                         0x2420
+#define         YUSHAN_CSI2_RX_VIRTUAL_CHANNEL                                            0x2424
+#define         YUSHAN_CSI2_RX_DATA_TYPE                                                  0x2428
+#define         YUSHAN_CSI2_RX_FRAME_NUMBER                                               0x242c
+#define         YUSHAN_CSI2_RX_LINE_NUMBER                                                0x2430
+#define         YUSHAN_CSI2_RX_DATA_FIELD                                                 0x2434
+#define         YUSHAN_CSI2_RX_WORD_COUNT                                                 0x2438
+#define         YUSHAN_CSI2_RX_ECC_ERROR_STATUS                                           0x243c
+#define         YUSHAN_CSI2_RX_DFV                                                        0x2440
+#define         YUSHAN_ITPOINT_ENABLE                                                     0x2800
+#define         YUSHAN_ITPOINT_VERSION                                                    0x2804
+#define         YUSHAN_ITPOINT_PIX_POS                                                    0x2808
+#define         YUSHAN_ITPOINT_LINE_POS                                                   0x280c
+#define         YUSHAN_ITPOINT_PIX_CNT                                                    0x2810
+#define         YUSHAN_ITPOINT_LINE_CNT                                                   0x2814
+#define         YUSHAN_ITPOINT_FRAME_CNT                                                  0x2818
+#define         YUSHAN_ITPOINT_DFV                                                        0x281c
+#define         YUSHAN_IDP_GEN_AUTO_RUN                                                   0x2c00
+#define         YUSHAN_IDP_GEN_VERSION                                                    0x2c04
+#define         YUSHAN_IDP_GEN_CONTROL                                                    0x2c08
+#define         YUSHAN_IDP_GEN_LINE_LENGTH                                                0x2c0c
+#define         YUSHAN_IDP_GEN_FRAME_LENGTH                                               0x2c10
+#define         YUSHAN_IDP_GEN_ERROR_LINES_EOF_GAP                                        0x2c14
+#define         YUSHAN_IDP_GEN_WC_DI_0                                                    0x2c18
+#define         YUSHAN_IDP_GEN_WC_DI_1                                                    0x2c1c
+#define         YUSHAN_IDP_GEN_WC_DI_2                                                    0x2c20
+#define         YUSHAN_IDP_GEN_WC_DI_3                                                    0x2c24
+#define         YUSHAN_IDP_GEN_WC_DI_4                                                    0x2c28
+#define         YUSHAN_IDP_GEN_WC_DI_5                                                    0x2c2c
+#define         YUSHAN_IDP_GEN_WC_DI_6                                                    0x2c30
+#define         YUSHAN_IDP_GEN_WC_DI_7                                                    0x2c34
+#define         YUSHAN_IDP_GEN_WC_DI_8                                                    0x2c38
+#define         YUSHAN_IDP_GEN_WC_DI_9                                                    0x2c3c
+#define         YUSHAN_IDP_GEN_WC_DI_10                                                   0x2c40
+#define         YUSHAN_IDP_GEN_WC_DI_11                                                   0x2c44
+#define         YUSHAN_IDP_GEN_WC_DI_12                                                   0x2c48
+#define         YUSHAN_IDP_GEN_WC_DI_13                                                   0x2c4c
+#define         YUSHAN_IDP_GEN_WC_DI_14                                                   0x2c50
+#define         YUSHAN_IDP_GEN_DFV                                                        0x2c54
+#define         YUSHAN_MIPI_RX_DTCHK_ENABLE                                               0x3000
+#define         YUSHAN_MIPI_RX_DTCHK_VERSION_CTRL                                         0x3004
+#define         YUSHAN_MIPI_RX_DTCHK_COLORBAR_WIDTH_BY4_M1                                0x3008
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_0                                      0x300c
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_1                                      0x3010
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_2                                      0x3014
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_3                                      0x3018
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_4                                      0x301c
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_5                                      0x3020
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_6                                      0x3024
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_VAL_7                                      0x3028
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_0                           0x302c
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_1                           0x3030
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_2                           0x3034
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_3                           0x3038
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_4                           0x303c
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_5                           0x3040
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_6                           0x3044
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_IGNORE_ERR_CNT_7                           0x3048
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_0                                   0x304c
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_1                                   0x3050
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_2                                   0x3054
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_3                                   0x3058
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_4                                   0x305c
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_5                                   0x3060
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_6                                   0x3064
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERRVAL_7                                   0x3068
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_0                                  0x306c
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_1                                  0x3070
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_2                                  0x3074
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_3                                  0x3078
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_4                                  0x307c
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_5                                  0x3080
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_6                                  0x3084
+#define         YUSHAN_MIPI_RX_DTCHK_COLOR_BAR_ERR_POS_7                                  0x3088
+#define         YUSHAN_MIPI_RX_DTCHK_DFV                                                  0x308c
+#define         YUSHAN_PATTERN_GEN_ENABLE                                                 0x3400
+#define         YUSHAN_PATTERN_GEN_VERSION                                                0x3404
+#define         YUSHAN_PATTERN_GEN_PATTERN_TYPE_REQ                                       0x3408
+#define         YUSHAN_PATTERN_GEN_TPAT_DATA_RG                                           0x340c
+#define         YUSHAN_PATTERN_GEN_TPAT_DATA_BG                                           0x3410
+#define         YUSHAN_PATTERN_GEN_TPAT_HCUR_WP                                           0x3414
+#define         YUSHAN_PATTERN_GEN_TPAT_VCUR_WP                                           0x3418
+#define         YUSHAN_PATTERN_GEN_PATTERN_TYPE_STATUS                                    0x341c
+#define         YUSHAN_SMIA_DCPX_ENABLE                                                   0x3800
+#define         YUSHAN_SMIA_DCPX_VERSION                                                  0x3804
+#define         YUSHAN_SMIA_DCPX_ENABLE_STATUS                                            0x3808
+#define         YUSHAN_SMIA_DCPX_MODE_REQ                                                 0x380c
+#define         YUSHAN_SMIA_DCPX_MODE_STATUS                                              0x3810
+#define         YUSHAN_SMIA_CPX_CTRL_REQ                                                  0x4000
+#define         YUSHAN_SMIA_CPX_MODE_REQ                                                  0x4004
+#define         YUSHAN_SMIA_CPX_CTRL_STATUS                                               0x4008
+#define         YUSHAN_SMIA_CPX_MODE_STATUS                                               0x400c
+#define         YUSHAN_SMIA_FM_CTRL                                                       0x4400
+#define         YUSHAN_SMIA_FM_PIX_WIDTH                                                  0x4404
+#define         YUSHAN_SMIA_FM_GROUPED_PARAMETER_HOLD                                     0x4408
+#define         YUSHAN_SMIA_FM_EOF_INT_EN                                                 0x440c
+#define         YUSHAN_SMIA_FM_EOF_INT_CTRL                                               0x4410
+#define         YUSHAN_P2W_FIFO_WR_CTRL                                                   0x4800
+#define         YUSHAN_P2W_FIFO_WR_STATUS                                                 0x4804
+#define         YUSHAN_P2W_FIFO_RD_CTRL                                                   0x4900
+#define         YUSHAN_P2W_FIFO_RD_STATUS                                                 0x4904
+#define         YUSHAN_CSI2_TX_WRAPPER_CTRL                                               0x4a00
+#define         YUSHAN_CSI2_TX_WRAPPER_THRESH                                             0x4a04
+#define         YUSHAN_CSI2_TX_WRAPPER_CHAR_EN                                            0x4a08
+#define         YUSHAN_CSI2_TX_ENABLE                                                     0x4c00
+#define         YUSHAN_CSI2_TX_VERSION_CTRL                                               0x4c04
+#define         YUSHAN_CSI2_TX_NUMBER_OF_LANES                                            0x4c08
+#define         YUSHAN_CSI2_TX_LANE_MAPPING                                               0x4c0c
+#define         YUSHAN_CSI2_TX_PACKET_CONTROL                                             0x4c10
+#define         YUSHAN_CSI2_TX_INTERPACKET_DELAY                                          0x4c14
+#define         YUSHAN_CSI2_TX_STATUS_LINE_SIZE                                           0x4c18
+#define         YUSHAN_CSI2_TX_STATUS_LINE_CTRL                                           0x4c1c
+#define         YUSHAN_CSI2_TX_VC_CTRL_0                                                  0x4c20
+#define         YUSHAN_CSI2_TX_VC_CTRL_1                                                  0x4c24
+#define         YUSHAN_CSI2_TX_VC_CTRL_2                                                  0x4c28
+#define         YUSHAN_CSI2_TX_VC_CTRL_3                                                  0x4c2c
+#define         YUSHAN_CSI2_TX_FRAME_NO_0                                                 0x4c30
+#define         YUSHAN_CSI2_TX_FRAME_NO_1                                                 0x4c34
+#define         YUSHAN_CSI2_TX_FRAME_NO_2                                                 0x4c38
+#define         YUSHAN_CSI2_TX_FRAME_NO_3                                                 0x4c3c
+#define         YUSHAN_CSI2_TX_BYTE_COUNT                                                 0x4c40
+#define         YUSHAN_CSI2_TX_CURRENT_DATA_IDENTIFIER                                    0x4c44
+#define         YUSHAN_CSI2_TX_DFV                                                        0x4c48
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_0                                              0x4c4c
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_0                                            0x4c50
+#define         YUSHAN_CSI2_TX_LINE_NO_0                                                  0x4c54
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_1                                              0x4c58
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_1                                            0x4c5c
+#define         YUSHAN_CSI2_TX_LINE_NO_1                                                  0x4c60
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_2                                              0x4c64
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_2                                            0x4c68
+#define         YUSHAN_CSI2_TX_LINE_NO_2                                                  0x4c6c
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_3                                              0x4c70
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_3                                            0x4c74
+#define         YUSHAN_CSI2_TX_LINE_NO_3                                                  0x4c78
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_4                                              0x4c7c
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_4                                            0x4c80
+#define         YUSHAN_CSI2_TX_LINE_NO_4                                                  0x4c84
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_5                                              0x4c88
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_5                                            0x4c8c
+#define         YUSHAN_CSI2_TX_LINE_NO_5                                                  0x4c90
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_6                                              0x4c94
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_6                                            0x4c98
+#define         YUSHAN_CSI2_TX_LINE_NO_6                                                  0x4c9c
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_7                                              0x4ca0
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_7                                            0x4ca4
+#define         YUSHAN_CSI2_TX_LINE_NO_7                                                  0x4ca8
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_8                                              0x4cac
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_8                                            0x4cb0
+#define         YUSHAN_CSI2_TX_LINE_NO_8                                                  0x4cb4
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_9                                              0x4cb8
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_9                                            0x4cbc
+#define         YUSHAN_CSI2_TX_LINE_NO_9                                                  0x4cc0
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_10                                             0x4cc4
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_10                                           0x4cc8
+#define         YUSHAN_CSI2_TX_LINE_NO_10                                                 0x4ccc
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_11                                             0x4cd0
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_11                                           0x4cd4
+#define         YUSHAN_CSI2_TX_LINE_NO_11                                                 0x4cd8
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_12                                             0x4cdc
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_12                                           0x4ce0
+#define         YUSHAN_CSI2_TX_LINE_NO_12                                                 0x4ce4
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_13                                             0x4ce8
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_13                                           0x4cec
+#define         YUSHAN_CSI2_TX_LINE_NO_13                                                 0x4cf0
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_14                                             0x4cf4
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_14                                           0x4cf8
+#define         YUSHAN_CSI2_TX_LINE_NO_14                                                 0x4cfc
+#define         YUSHAN_CSI2_TX_PACKET_SIZE_15                                             0x4d00
+#define         YUSHAN_CSI2_TX_DI_INDEX_CTRL_15                                           0x4d04
+#define         YUSHAN_CSI2_TX_LINE_NO_15                                                 0x4d08
+#define         YUSHAN_MIPI_TX_ENABLE                                                     0x5000
+#define         YUSHAN_MIPI_TX_UIX4                                                       0x5004
+#define         YUSHAN_MIPI_TX_SWAP_PINS                                                  0x5008
+#define         YUSHAN_MIPI_TX_INVERT_HS                                                  0x500c
+#define         YUSHAN_MIPI_TX_STOP_STATE                                                 0x5010
+#define         YUSHAN_MIPI_TX_FORCE_TX_MODE_DL                                           0x5014
+#define         YUSHAN_MIPI_TX_ULP_STATE                                                  0x5018
+#define         YUSHAN_MIPI_TX_ULP_EXIT                                                   0x501c
+#define         YUSHAN_MIPI_TX_ESC_DL                                                     0x5020
+#define         YUSHAN_MIPI_TX_HSTX_SLEW                                                  0x5024
+#define         YUSHAN_MIPI_TX_SKEW                                                       0x5028
+#define         YUSHAN_MIPI_TX_GPIO_CL                                                    0x502c
+#define         YUSHAN_MIPI_TX_GPIO_DL1                                                   0x5030
+#define         YUSHAN_MIPI_TX_GPIO_DL2                                                   0x5034
+#define         YUSHAN_MIPI_TX_GPIO_DL3                                                   0x5038
+#define         YUSHAN_MIPI_TX_GPIO_DL4                                                   0x503c
+#define         YUSHAN_MIPI_TX_SPECS                                                      0x5040
+#define         YUSHAN_MIPI_TX_SLEW_RATE                                                  0x5044
+#define         YUSHAN_MIPI_TX_TEST_RESERVED                                              0x5048
+#define         YUSHAN_MIPI_TX_TCLK_ENABLE                                                0x504c
+#define         YUSHAN_MIPI_TX_TCLK_POST_DELAY                                            0x5050
+#define         YUSHAN_LINE_FILTER_BYPASS_ENABLE                                          0x5800
+#define         YUSHAN_LINE_FILTER_BYPASS_VERSION                                         0x5804
+#define         YUSHAN_LINE_FILTER_BYPASS_LSTART_LEVEL                                    0x5808
+#define         YUSHAN_LINE_FILTER_BYPASS_LSTOP_LEVEL                                     0x580c
+#define         YUSHAN_DTFILTER_BYPASS_ENABLE                                             0x5820
+#define         YUSHAN_DTFILTER_BYPASS_VERSION                                            0x5824
+#define         YUSHAN_DTFILTER_BYPASS_MATCH0                                             0x5828
+#define         YUSHAN_DTFILTER_BYPASS_MATCH1                                             0x582c
+#define         YUSHAN_DTFILTER_BYPASS_MATCH2                                             0x5830
+#define         YUSHAN_DTFILTER_BYPASS_MATCH3                                             0x5834
+#define         YUSHAN_LINE_FILTER_DXO_ENABLE                                             0x5840
+#define         YUSHAN_LINE_FILTER_DXO_VERSION                                            0x5844
+#define         YUSHAN_LINE_FILTER_DXO_LSTART_LEVEL                                       0x5848
+#define         YUSHAN_LINE_FILTER_DXO_LSTOP_LEVEL                                        0x584c
+#define         YUSHAN_DTFILTER_DXO_ENABLE                                                0x5860
+#define         YUSHAN_DTFILTER_DXO_VERSION                                               0x5864
+#define         YUSHAN_DTFILTER_DXO_MATCH0                                                0x5868
+#define         YUSHAN_DTFILTER_DXO_MATCH1                                                0x586c
+#define         YUSHAN_DTFILTER_DXO_MATCH2                                                0x5870
+#define         YUSHAN_DTFILTER_DXO_MATCH3                                                0x5874
+#define         YUSHAN_EOF_RESIZE_PRE_DXO_ENABLE                                          0x5880
+#define         YUSHAN_EOF_RESIZE_PRE_DXO_VERSION                                         0x5884
+#define         YUSHAN_EOF_RESIZE_PRE_DXO_AUTOMATIC_CONTROL                               0x5888
+#define         YUSHAN_EOF_RESIZE_PRE_DXO_H_SIZE                                          0x588c
+#define         YUSHAN_LBE_PRE_DXO_ENABLE                                                 0x58a0
+#define         YUSHAN_LBE_PRE_DXO_VERSION                                                0x58a4
+#define         YUSHAN_LBE_PRE_DXO_DFV                                                    0x58a8
+#define         YUSHAN_LBE_PRE_DXO_H_SIZE                                                 0x58ac
+#define         YUSHAN_LBE_PRE_DXO_READ_START                                             0x58b0
+#define         YUSHAN_EOF_RESIZE_POST_DXO_ENABLE                                         0x58c0
+#define         YUSHAN_EOF_RESIZE_POST_DXO_VERSION                                        0x58c4
+#define         YUSHAN_EOF_RESIZE_POST_DXO_AUTOMATIC_CONTROL                              0x58c8
+#define         YUSHAN_EOF_RESIZE_POST_DXO_H_SIZE                                         0x58cc
+#define         YUSHAN_LECCI_ENABLE                                                       0x5c00
+#define         YUSHAN_LECCI_VERSION                                                      0x5c04
+#define         YUSHAN_LECCI_MIN_INTERLINE                                                0x5c08
+#define         YUSHAN_LECCI_OUT_BURST_CTRL                                               0x5c0c
+#define         YUSHAN_LECCI_LINE_SIZE                                                    0x5c10
+#define         YUSHAN_LECCI_BYPASS_CTRL                                                  0x5c14
+#define         YUSHAN_LBE_POST_DXO_ENABLE                                                0x5c20
+#define         YUSHAN_LBE_POST_DXO_VERSION                                               0x5c24
+#define         YUSHAN_LBE_POST_DXO_DFV                                                   0x5c28
+#define         YUSHAN_LBE_POST_DXO_H_SIZE                                                0x5c2c
+#define         YUSHAN_LBE_POST_DXO_READ_START                                            0x5c30
+#endif
diff --git a/drivers/media/video/msm/rawchip/yushan_u_code_r2.c b/drivers/media/video/msm/rawchip/yushan_u_code_r2.c
new file mode 100644
index 0000000..a8f18b4
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/yushan_u_code_r2.c
@@ -0,0 +1,35855 @@
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include "Yushan_HTC_Functions.h"
+
+uint8_t pdpcode_u_1_7[] =
+{
+	0x78,
+	0x64,
+	0x00,
+	0xa0,
+	0xff,
+	0x13,
+	0x00,
+	0x00,
+	0x01,
+	0x00,
+	0x13,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0xa0,
+	0x34,
+	0x13,
+	0x00,
+	0x00,
+	0x00,
+	0x02,
+	0x9c,
+	0x14,
+	0x1a,
+	0x9c,
+	0x18,
+	0x1a,
+	0x9c,
+	0x20,
+	0x1a,
+	0x9c,
+	0x24,
+	0x1a,
+	0xb8,
+	0xa0,
+	0x04,
+	0x53,
+	0xa1,
+	0x0d,
+	0x00,
+	0x02,
+	0xa0,
+	0x03,
+	0x53,
+	0xd7,
+	0x0d,
+	0x04,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x07,
+	0x02,
+	0xcd,
+	0xd9,
+	0x0d,
+	0xf0,
+	0x04,
+	0xa2,
+	0x02,
+	0x80,
+	0x10,
+	0xa2,
+	0x01,
+	0xad,
+	0x00,
+	0x18,
+	0xc9,
+	0x5b,
+	0xd0,
+	0x07,
+	0xad,
+	0x01,
+	0x18,
+	0xc9,
+	0xe6,
+	0xf0,
+	0x08,
+	0x8e,
+	0x08,
+	0x02,
+	0xee,
+	0x14,
+	0x1a,
+	0x80,
+	0x1b,
+	0xa2,
+	0xff,
+	0x9a,
+	0xa0,
+	0x0e,
+	0x53,
+	0x93,
+	0x0d,
+	0x02,
+	0x00,
+	0xa9,
+	0x03,
+	0x85,
+	0xa0,
+	0x85,
+	0xbf,
+	0xa0,
+	0x05,
+	0x53,
+	0xa5,
+	0x0d,
+	0x2e,
+	0x02,
+	0x58,
+	0xee,
+	0x14,
+	0x1a,
+	0x5c,
+	0x80,
+	0xfd,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xde,
+	0x0c,
+	0x48,
+	0xa9,
+	0x01,
+	0xa0,
+	0x34,
+	0xa6,
+	0xcf,
+	0xf0,
+	0x0b,
+	0x53,
+	0x00,
+	0x02,
+	0x35,
+	0x01,
+	0x8d,
+	0x69,
+	0x01,
+	0x3a,
+	0x80,
+	0x08,
+	0x53,
+	0x00,
+	0x02,
+	0x00,
+	0x01,
+	0x8d,
+	0x34,
+	0x01,
+	0x85,
+	0xcf,
+	0x9c,
+	0x08,
+	0x02,
+	0x9c,
+	0x18,
+	0x1a,
+	0xee,
+	0x18,
+	0x1a,
+	0x20,
+	0x6b,
+	0x0d,
+	0x4c,
+	0x40,
+	0x0d,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xde,
+	0x0c,
+	0x48,
+	0xad,
+	0x34,
+	0x18,
+	0x29,
+	0x03,
+	0xc9,
+	0x02,
+	0xd0,
+	0x0e,
+	0x9c,
+	0x24,
+	0x1a,
+	0xee,
+	0x24,
+	0x1a,
+	0xad,
+	0x33,
+	0x02,
+	0xf0,
+	0x03,
+	0x20,
+	0x6b,
+	0x0d,
+	0x4c,
+	0x40,
+	0x0d,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xde,
+	0x0c,
+	0x48,
+	0x9c,
+	0x24,
+	0x1a,
+	0xee,
+	0x24,
+	0x1a,
+	0x4c,
+	0x40,
+	0x0d,
+	0x40,
+	0xb9,
+	0x28,
+	0x00,
+	0xd0,
+	0x4d,
+	0xb9,
+	0x27,
+	0x00,
+	0xc9,
+	0x08,
+	0xb0,
+	0x46,
+	0x1a,
+	0x4a,
+	0xb0,
+	0x3f,
+	0x85,
+	0xeb,
+	0x98,
+	0x4a,
+	0xa8,
+	0xb9,
+	0x1d,
+	0x00,
+	0x4a,
+	0xb0,
+	0x40,
+	0xb9,
+	0x21,
+	0x00,
+	0xaa,
+	0x4a,
+	0x90,
+	0x36,
+	0x8a,
+	0xf9,
+	0xda,
+	0x0d,
+	0xb9,
+	0x22,
+	0x00,
+	0xf9,
+	0xdb,
+	0x0d,
+	0xb0,
+	0x27,
+	0x8a,
+	0xf9,
+	0x1d,
+	0x00,
+	0xaa,
+	0xb9,
+	0x22,
+	0x00,
+	0xf9,
+	0x1e,
+	0x00,
+	0x90,
+	0x23,
+	0xe8,
+	0xd0,
+	0x01,
+	0x1a,
+	0xa4,
+	0xeb,
+	0x20,
+	0xff,
+	0x0a,
+	0xe8,
+	0xd0,
+	0x01,
+	0x1a,
+	0x4a,
+	0xa8,
+	0x8a,
+	0x6a,
+	0xa2,
+	0x00,
+	0x60,
+	0xa2,
+	0x13,
+	0x60,
+	0xa9,
+	0x11,
+	0x60,
+	0xa2,
+	0x09,
+	0x60,
+	0xa2,
+	0x0d,
+	0x60,
+	0xa2,
+	0x0b,
+	0x60,
+	0xa2,
+	0x0f,
+	0x60,
+	0xf8,
+	0xa5,
+	0xcf,
+	0x85,
+	0xf7,
+	0xa0,
+	0x34,
+	0xa5,
+	0xf7,
+	0xd0,
+	0x12,
+	0xad,
+	0x69,
+	0x01,
+	0xd0,
+	0x03,
+	0x4c,
+	0x25,
+	0x04,
+	0x53,
+	0x35,
+	0x01,
+	0x10,
+	0x00,
+	0x9c,
+	0x69,
+	0x01,
+	0x80,
+	0x10,
+	0xad,
+	0x34,
+	0x01,
+	0xd0,
+	0x03,
+	0x4c,
+	0x25,
+	0x04,
+	0x53,
+	0x00,
+	0x01,
+	0x10,
+	0x00,
+	0x9c,
+	0x34,
+	0x01,
+	0x64,
+	0x63,
+	0xa0,
+	0x00,
+	0x20,
+	0x0e,
+	0x03,
+	0xf0,
+	0x07,
+	0x64,
+	0x45,
+	0x64,
+	0x46,
+	0x8a,
+	0x80,
+	0x59,
+	0x85,
+	0x45,
+	0x84,
+	0x46,
+	0xa0,
+	0x04,
+	0x20,
+	0x0e,
+	0x03,
+	0xf0,
+	0x08,
+	0x8a,
+	0x1a,
+	0x80,
+	0x4a,
+	0xa9,
+	0x1f,
+	0x80,
+	0x46,
+	0x85,
+	0x47,
+	0x84,
+	0x48,
+	0x38,
+	0xa5,
+	0x2e,
+	0xed,
+	0xdf,
+	0x0d,
+	0xa5,
+	0x2f,
+	0xed,
+	0xe0,
+	0x0d,
+	0x90,
+	0xeb,
+	0xad,
+	0xe1,
+	0x0d,
+	0xe5,
+	0x2e,
+	0xad,
+	0xe2,
+	0x0d,
+	0xe5,
+	0x2f,
+	0x90,
+	0xdf,
+	0xa0,
+	0x02,
+	0x53,
+	0x2e,
+	0x00,
+	0xe6,
+	0x00,
+	0x20,
+	0x1c,
+	0x0c,
+	0xa0,
+	0x02,
+	0x53,
+	0xe6,
+	0x00,
+	0x2e,
+	0x00,
+	0xa5,
+	0x1b,
+	0xaa,
+	0x29,
+	0x01,
+	0xd0,
+	0x04,
+	0xa2,
+	0x38,
+	0x86,
+	0x1b,
+	0x20,
+	0x50,
+	0x06,
+	0xd0,
+	0x08,
+	0x20,
+	0x6b,
+	0x09,
+	0xd0,
+	0x03,
+	0x20,
+	0x0b,
+	0x0a,
+	0x85,
+	0x63,
+	0xa0,
+	0x1f,
+	0xa2,
+	0x03,
+	0xa5,
+	0xf7,
+	0xf0,
+	0x09,
+	0x86,
+	0xbf,
+	0x53,
+	0x45,
+	0x00,
+	0xa1,
+	0x00,
+	0x80,
+	0x07,
+	0x86,
+	0xa0,
+	0x53,
+	0x45,
+	0x00,
+	0x82,
+	0x00,
+	0x9c,
+	0x1c,
+	0x1a,
+	0xee,
+	0x1c,
+	0x1a,
+	0x18,
+	0xad,
+	0x69,
+	0x01,
+	0x6d,
+	0x34,
+	0x01,
+	0xf0,
+	0x0a,
+	0xa5,
+	0xf7,
+	0x3a,
+	0x29,
+	0x01,
+	0x85,
+	0xf7,
+	0x4c,
+	0x74,
+	0x03,
+	0x9c,
+	0x6a,
+	0x01,
+	0xad,
+	0x33,
+	0x02,
+	0xf0,
+	0x10,
+	0xa0,
+	0x02,
+	0x53,
+	0x45,
+	0x00,
+	0x09,
+	0x02,
+	0x0e,
+	0x09,
+	0x02,
+	0x2e,
+	0x0a,
+	0x02,
+	0x20,
+	0x6d,
+	0x04,
+	0x4c,
+	0x5d,
+	0x0d,
+	0xa9,
+	0x01,
+	0xc4,
+	0xf5,
+	0xd0,
+	0x04,
+	0xe4,
+	0xf4,
+	0xf0,
+	0x01,
+	0x1a,
+	0x3a,
+	0x60,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xde,
+	0x0c,
+	0x48,
+	0x20,
+	0x6d,
+	0x04,
+	0x4c,
+	0x40,
+	0x0d,
+	0xad,
+	0x0a,
+	0x02,
+	0x4a,
+	0x85,
+	0xf5,
+	0xad,
+	0x09,
+	0x02,
+	0x6a,
+	0xb0,
+	0x46,
+	0x85,
+	0xf4,
+	0x64,
+	0xe4,
+	0xa4,
+	0x83,
+	0xa6,
+	0x82,
+	0x20,
+	0x53,
+	0x04,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe4,
+	0xa4,
+	0xa2,
+	0xa6,
+	0xa1,
+	0x20,
+	0x53,
+	0x04,
+	0xd0,
+	0x04,
+	0xe6,
+	0xe4,
+	0xe6,
+	0xe4,
+	0xa5,
+	0xe4,
+	0xf0,
+	0x26,
+	0xa0,
+	0x1e,
+	0xc9,
+	0x01,
+	0xf0,
+	0x07,
+	0x4a,
+	0x90,
+	0x0f,
+	0xa5,
+	0xcf,
+	0xd0,
+	0x0b,
+	0xa5,
+	0xa0,
+	0xd0,
+	0x17,
+	0x53,
+	0x82,
+	0x00,
+	0x64,
+	0x00,
+	0x80,
+	0x09,
+	0xa5,
+	0xbf,
+	0xd0,
+	0x0c,
+	0x53,
+	0xa1,
+	0x00,
+	0x64,
+	0x00,
+	0x20,
+	0xf8,
+	0x04,
+	0x80,
+	0x02,
+	0xa9,
+	0x04,
+	0x8d,
+	0x08,
+	0x02,
+	0xa2,
+	0x28,
+	0xa8,
+	0xd0,
+	0x0a,
+	0xee,
+	0x31,
+	0x02,
+	0xd0,
+	0x03,
+	0xee,
+	0x32,
+	0x02,
+	0xa2,
+	0x20,
+	0x9e,
+	0x00,
+	0x1a,
+	0xfe,
+	0x00,
+	0x1a,
+	0x60,
+	0x8d,
+	0x50,
+	0x18,
+	0x8e,
+	0x50,
+	0x18,
+	0xd0,
+	0x01,
+	0xca,
+	0x3a,
+	0x99,
+	0x00,
+	0x18,
+	0x48,
+	0x8a,
+	0x99,
+	0x01,
+	0x18,
+	0x68,
+	0x0a,
+	0x1a,
+	0x8d,
+	0x50,
+	0x18,
+	0x8a,
+	0x2a,
+	0x8d,
+	0x50,
+	0x18,
+	0x60,
+	0xa0,
+	0x01,
+	0x8c,
+	0x04,
+	0x18,
+	0x8c,
+	0x10,
+	0x18,
+	0x53,
+	0x7d,
+	0x00,
+	0x78,
+	0x18,
+	0x53,
+	0x7c,
+	0x00,
+	0x7c,
+	0x18,
+	0x53,
+	0x7b,
+	0x00,
+	0x80,
+	0x18,
+	0x53,
+	0x7a,
+	0x00,
+	0x84,
+	0x18,
+	0x53,
+	0x7e,
+	0x00,
+	0x88,
+	0x18,
+	0x53,
+	0x7f,
+	0x00,
+	0x8c,
+	0x18,
+	0x53,
+	0x80,
+	0x00,
+	0x90,
+	0x18,
+	0xa5,
+	0x81,
+	0x8d,
+	0x94,
+	0x18,
+	0x8d,
+	0x14,
+	0x18,
+	0xc8,
+	0x53,
+	0x68,
+	0x00,
+	0x54,
+	0x18,
+	0x53,
+	0x6a,
+	0x00,
+	0x58,
+	0x18,
+	0x53,
+	0x6c,
+	0x00,
+	0x5c,
+	0x18,
+	0x53,
+	0x6e,
+	0x00,
+	0x60,
+	0x18,
+	0x53,
+	0x72,
+	0x00,
+	0x64,
+	0x18,
+	0x53,
+	0x70,
+	0x00,
+	0x68,
+	0x18,
+	0x53,
+	0x76,
+	0x00,
+	0x6c,
+	0x18,
+	0x53,
+	0x74,
+	0x00,
+	0x70,
+	0x18,
+	0x53,
+	0x78,
+	0x00,
+	0x74,
+	0x18,
+	0x9c,
+	0x3c,
+	0x18,
+	0x13,
+	0x3c,
+	0x18,
+	0x28,
+	0x18,
+	0x13,
+	0x3c,
+	0x18,
+	0x2c,
+	0x18,
+	0x9c,
+	0x30,
+	0x18,
+	0x9c,
+	0x20,
+	0x18,
+	0x9c,
+	0x24,
+	0x18,
+	0x9c,
+	0x0c,
+	0x18,
+	0x9c,
+	0x0d,
+	0x18,
+	0xa0,
+	0x18,
+	0xa6,
+	0x65,
+	0xa5,
+	0x64,
+	0x20,
+	0xda,
+	0x04,
+	0xa9,
+	0x04,
+	0x8d,
+	0x0c,
+	0x18,
+	0x9c,
+	0x0d,
+	0x18,
+	0xa0,
+	0x1c,
+	0xa6,
+	0x67,
+	0xa5,
+	0x66,
+	0x20,
+	0xda,
+	0x04,
+	0xa0,
+	0x03,
+	0x43,
+	0xaa,
+	0x0d,
+	0x38,
+	0x18,
+	0xa9,
+	0x00,
+	0x60,
+	0x20,
+	0xa5,
+	0x05,
+	0xe0,
+	0x00,
+	0xf0,
+	0x04,
+	0x1a,
+	0xd0,
+	0x01,
+	0xc8,
+	0x60,
+	0x85,
+	0xea,
+	0x45,
+	0xec,
+	0x84,
+	0xeb,
+	0xaa,
+	0xa5,
+	0xed,
+	0x45,
+	0xea,
+	0x18,
+	0x65,
+	0xeb,
+	0x90,
+	0x01,
+	0xc8,
+	0x60,
+	0x18,
+	0x65,
+	0xee,
+	0x85,
+	0xee,
+	0x98,
+	0x65,
+	0xef,
+	0x85,
+	0xef,
+	0x38,
+	0xa5,
+	0xee,
+	0xe9,
+	0xff,
+	0xa5,
+	0xef,
+	0xe9,
+	0x07,
+	0x90,
+	0x08,
+	0xa9,
+	0xff,
+	0x85,
+	0xee,
+	0xa9,
+	0x07,
+	0x85,
+	0xef,
+	0x60,
+	0x38,
+	0xa5,
+	0xee,
+	0xe5,
+	0xec,
+	0x85,
+	0xee,
+	0xa5,
+	0xef,
+	0xe5,
+	0xed,
+	0x85,
+	0xef,
+	0xb0,
+	0x04,
+	0x64,
+	0xee,
+	0x64,
+	0xef,
+	0x60,
+	0xa5,
+	0xee,
+	0x0a,
+	0x85,
+	0xec,
+	0xa5,
+	0xef,
+	0x2a,
+	0x85,
+	0xed,
+	0x60,
+	0x20,
+	0xe9,
+	0x05,
+	0xa5,
+	0xf2,
+	0xd0,
+	0x05,
+	0xa6,
+	0xf3,
+	0xd0,
+	0x0b,
+	0x60,
+	0x20,
+	0x99,
+	0x05,
+	0x85,
+	0xec,
+	0x84,
+	0xed,
+	0x4c,
+	0xd5,
+	0x05,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xec,
+	0x85,
+	0xec,
+	0xa9,
+	0x04,
+	0xe5,
+	0xed,
+	0x85,
+	0xed,
+	0x8a,
+	0x20,
+	0x99,
+	0x05,
+	0x4c,
+	0xb7,
+	0x05,
+	0x20,
+	0xe9,
+	0x05,
+	0xa6,
+	0xf2,
+	0xd0,
+	0x05,
+	0xa6,
+	0xf3,
+	0xd0,
+	0x15,
+	0x60,
+	0x38,
+	0xa9,
+	0xfe,
+	0xe5,
+	0xec,
+	0x85,
+	0xec,
+	0xa9,
+	0x0f,
+	0xe5,
+	0xed,
+	0x85,
+	0xed,
+	0x8a,
+	0x20,
+	0xa5,
+	0x05,
+	0x4c,
+	0xb7,
+	0x05,
+	0x38,
+	0xa5,
+	0xed,
+	0xe9,
+	0x04,
+	0x85,
+	0xed,
+	0x8a,
+	0x20,
+	0xa5,
+	0x05,
+	0x85,
+	0xec,
+	0x84,
+	0xed,
+	0x4c,
+	0xd5,
+	0x05,
+	0xa5,
+	0x2d,
+	0xd0,
+	0x02,
+	0xa9,
+	0x11,
+	0xaa,
+	0x49,
+	0x10,
+	0xc0,
+	0x05,
+	0x90,
+	0x03,
+	0xa9,
+	0x1c,
+	0x60,
+	0x84,
+	0xd2,
+	0x8a,
+	0x29,
+	0x0f,
+	0xc9,
+	0x05,
+	0xb0,
+	0xf4,
+	0x45,
+	0xd2,
+	0xaa,
+	0xbd,
+	0xc5,
+	0x0d,
+	0x85,
+	0xd2,
+	0x64,
+	0xe3,
+	0x38,
+	0xad,
+	0x2d,
+	0x0f,
+	0xe5,
+	0xd2,
+	0xb0,
+	0x02,
+	0xe6,
+	0xe3,
+	0x64,
+	0xc2,
+	0x64,
+	0xc3,
+	0xa0,
+	0x02,
+	0x53,
+	0x2e,
+	0x00,
+	0xc0,
+	0x00,
+	0x53,
+	0x34,
+	0x00,
+	0xd0,
+	0x00,
+	0x20,
+	0x58,
+	0x0b,
+	0xa5,
+	0xc4,
+	0x10,
+	0x0a,
+	0xe6,
+	0xc5,
+	0xd0,
+	0x06,
+	0xe6,
+	0xc6,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc7,
+	0xa5,
+	0xc7,
+	0xf0,
+	0x06,
+	0xa9,
+	0xff,
+	0x85,
+	0xc5,
+	0x85,
+	0xc6,
+	0xa0,
+	0x02,
+	0x53,
+	0xc5,
+	0x00,
+	0xcd,
+	0x00,
+	0x53,
+	0xcd,
+	0x00,
+	0xe8,
+	0x00,
+	0xa2,
+	0x2e,
+	0xa0,
+	0x0f,
+	0xa9,
+	0x04,
+	0x20,
+	0x3c,
+	0x0a,
+	0x84,
+	0xd3,
+	0xa5,
+	0xe3,
+	0x49,
+	0x24,
+	0x85,
+	0xc8,
+	0xa5,
+	0xd3,
+	0x49,
+	0x06,
+	0x18,
+	0x65,
+	0xc8,
+	0x85,
+	0xc8,
+	0xc0,
+	0x04,
+	0xf0,
+	0x10,
+	0x38,
+	0xb9,
+	0xfc,
+	0x0f,
+	0xe5,
+	0xcd,
+	0xc8,
+	0xb9,
+	0xfc,
+	0x0f,
+	0xc8,
+	0xe5,
+	0xce,
+	0x90,
+	0xed,
+	0x88,
+	0x98,
+	0x4a,
+	0xa8,
+	0xb9,
+	0x3e,
+	0x00,
+	0x85,
+	0xf2,
+	0xa9,
+	0x80,
+	0x38,
+	0xe5,
+	0xf2,
+	0x85,
+	0xf2,
+	0xb0,
+	0x0b,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xf2,
+	0x64,
+	0xf2,
+	0x85,
+	0xf3,
+	0x80,
+	0x02,
+	0x64,
+	0xf3,
+	0xa9,
+	0x0c,
+	0x85,
+	0xcc,
+	0xa4,
+	0xd3,
+	0xa2,
+	0x00,
+	0xb9,
+	0x2e,
+	0x0f,
+	0x95,
+	0xe6,
+	0xe8,
+	0xc8,
+	0xe0,
+	0x04,
+	0x90,
+	0xf5,
+	0x18,
+	0xa5,
+	0xc8,
+	0x69,
+	0x34,
+	0x85,
+	0xc8,
+	0xa9,
+	0x0f,
+	0x90,
+	0x01,
+	0x1a,
+	0x85,
+	0xc9,
+	0xa5,
+	0xe3,
+	0x49,
+	0x40,
+	0x85,
+	0xca,
+	0xa5,
+	0xd3,
+	0x49,
+	0x10,
+	0x18,
+	0x65,
+	0xca,
+	0x69,
+	0x7c,
+	0x85,
+	0xca,
+	0xa9,
+	0x0f,
+	0x90,
+	0x01,
+	0x1a,
+	0x85,
+	0xcb,
+	0x20,
+	0x88,
+	0x0a,
+	0x20,
+	0xf4,
+	0x05,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0x49,
+	0x00,
+	0x20,
+	0x88,
+	0x0a,
+	0x20,
+	0xf4,
+	0x05,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0x4b,
+	0x00,
+	0x20,
+	0x88,
+	0x0a,
+	0x20,
+	0x1e,
+	0x06,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0x4d,
+	0x00,
+	0x20,
+	0x88,
+	0x0a,
+	0x20,
+	0x1e,
+	0x06,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0x4f,
+	0x00,
+	0x20,
+	0x65,
+	0x0a,
+	0x85,
+	0x51,
+	0x64,
+	0x52,
+	0x20,
+	0x65,
+	0x0a,
+	0x85,
+	0x5f,
+	0x20,
+	0x65,
+	0x0a,
+	0x85,
+	0x60,
+	0x20,
+	0x65,
+	0x0a,
+	0x85,
+	0x61,
+	0xa5,
+	0x1b,
+	0x29,
+	0x10,
+	0xf0,
+	0x08,
+	0xa9,
+	0xff,
+	0x85,
+	0x51,
+	0xa9,
+	0x03,
+	0x85,
+	0x52,
+	0xa9,
+	0x00,
+	0x60,
+	0x18,
+	0xa5,
+	0xd4,
+	0x69,
+	0x0a,
+	0x80,
+	0x02,
+	0xa5,
+	0xd5,
+	0xaa,
+	0xa0,
+	0x00,
+	0xbd,
+	0xeb,
+	0x0d,
+	0x99,
+	0xe6,
+	0x00,
+	0xe8,
+	0xc8,
+	0xc0,
+	0x04,
+	0xd0,
+	0xf4,
+	0xa0,
+	0x02,
+	0x60,
+	0x65,
+	0xe2,
+	0x85,
+	0xe2,
+	0x98,
+	0x65,
+	0xde,
+	0x85,
+	0xde,
+	0x90,
+	0x07,
+	0xe6,
+	0xdf,
+	0x18,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe0,
+	0x60,
+	0x65,
+	0xde,
+	0x85,
+	0xde,
+	0x98,
+	0x65,
+	0xdf,
+	0x85,
+	0xdf,
+	0x90,
+	0x07,
+	0x18,
+	0xe6,
+	0xe0,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe1,
+	0x60,
+	0xa4,
+	0xe3,
+	0xf0,
+	0x03,
+	0x4c,
+	0x65,
+	0x0a,
+	0x4c,
+	0x88,
+	0x0a,
+	0xa9,
+	0x06,
+	0x85,
+	0xcc,
+	0x20,
+	0x94,
+	0x07,
+	0x53,
+	0x34,
+	0x00,
+	0xcd,
+	0x00,
+	0x53,
+	0xda,
+	0x00,
+	0xc8,
+	0x00,
+	0x53,
+	0xdc,
+	0x00,
+	0xca,
+	0x00,
+	0x20,
+	0xd5,
+	0x07,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0xf0,
+	0x00,
+	0x53,
+	0xc8,
+	0x00,
+	0xda,
+	0x00,
+	0x53,
+	0xca,
+	0x00,
+	0xdc,
+	0x00,
+	0x20,
+	0x94,
+	0x07,
+	0x53,
+	0xd6,
+	0x00,
+	0xc8,
+	0x00,
+	0x53,
+	0xd8,
+	0x00,
+	0xca,
+	0x00,
+	0x20,
+	0xd5,
+	0x07,
+	0xa0,
+	0x02,
+	0x53,
+	0xc8,
+	0x00,
+	0xd6,
+	0x00,
+	0x53,
+	0xca,
+	0x00,
+	0xd8,
+	0x00,
+	0x38,
+	0xa5,
+	0xee,
+	0xe5,
+	0xf0,
+	0xd0,
+	0x09,
+	0xa5,
+	0xef,
+	0xe5,
+	0xf1,
+	0xd0,
+	0x03,
+	0xa5,
+	0xee,
+	0x60,
+	0x20,
+	0x9b,
+	0x07,
+	0x38,
+	0xa5,
+	0xe8,
+	0xe5,
+	0xe6,
+	0x85,
+	0xd0,
+	0xa5,
+	0xe9,
+	0xe5,
+	0xe7,
+	0x85,
+	0xd1,
+	0x4a,
+	0x85,
+	0xeb,
+	0xa5,
+	0xd0,
+	0x6a,
+	0x85,
+	0xea,
+	0x38,
+	0xa5,
+	0xf0,
+	0xe5,
+	0xee,
+	0x85,
+	0xec,
+	0xa5,
+	0xf1,
+	0xe5,
+	0xef,
+	0x85,
+	0xed,
+	0x64,
+	0xe6,
+	0xb0,
+	0x17,
+	0xe6,
+	0xe6,
+	0xa5,
+	0xea,
+	0xe9,
+	0x00,
+	0xb0,
+	0x03,
+	0x38,
+	0xc6,
+	0xeb,
+	0xa9,
+	0x00,
+	0xe5,
+	0xec,
+	0x85,
+	0xec,
+	0xa9,
+	0x00,
+	0xe5,
+	0xed,
+	0x85,
+	0xed,
+	0x64,
+	0xe0,
+	0x64,
+	0xe1,
+	0xa5,
+	0xd5,
+	0x0a,
+	0xaa,
+	0xbd,
+	0xfb,
+	0x0d,
+	0x45,
+	0xed,
+	0x85,
+	0xe2,
+	0x84,
+	0xde,
+	0xbd,
+	0xfc,
+	0x0d,
+	0x45,
+	0xed,
+	0x18,
+	0x65,
+	0xde,
+	0x85,
+	0xde,
+	0x90,
+	0x02,
+	0xc8,
+	0x18,
+	0x84,
+	0xdf,
+	0xbd,
+	0xfc,
+	0x0d,
+	0x45,
+	0xec,
+	0x20,
+	0xaf,
+	0x07,
+	0xbd,
+	0xfd,
+	0x0d,
+	0x45,
+	0xeb,
+	0x20,
+	0xaf,
+	0x07,
+	0xbd,
+	0xfd,
+	0x0d,
+	0x45,
+	0xec,
+	0x65,
+	0xde,
+	0x85,
+	0xde,
+	0x98,
+	0x65,
+	0xdf,
+	0x85,
+	0xdf,
+	0x90,
+	0x07,
+	0xe6,
+	0xe0,
+	0x18,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe1,
+	0xbd,
+	0xfd,
+	0x0d,
+	0x45,
+	0xed,
+	0x65,
+	0xdf,
+	0x85,
+	0xdf,
+	0x98,
+	0x65,
+	0xe0,
+	0x85,
+	0xe0,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0xe1,
+	0xbd,
+	0xfe,
+	0x0d,
+	0x45,
+	0xea,
+	0x65,
+	0xe2,
+	0x98,
+	0xa0,
+	0x00,
+	0x20,
+	0xc2,
+	0x07,
+	0xbd,
+	0xfe,
+	0x0d,
+	0x45,
+	0xeb,
+	0x20,
+	0xc2,
+	0x07,
+	0xbd,
+	0xfe,
+	0x0d,
+	0x45,
+	0xec,
+	0x65,
+	0xdf,
+	0x85,
+	0xdf,
+	0x98,
+	0x65,
+	0xe0,
+	0x85,
+	0xe0,
+	0x90,
+	0x03,
+	0xe6,
+	0xe1,
+	0x18,
+	0xbd,
+	0xfe,
+	0x0d,
+	0x45,
+	0xed,
+	0x65,
+	0xe0,
+	0x85,
+	0xe0,
+	0x98,
+	0x65,
+	0xe1,
+	0x85,
+	0xe1,
+	0xa0,
+	0x04,
+	0x53,
+	0xde,
+	0x00,
+	0xc0,
+	0x00,
+	0xe6,
+	0xc0,
+	0xd0,
+	0x0a,
+	0xe6,
+	0xc1,
+	0xd0,
+	0x06,
+	0xe6,
+	0xc2,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc3,
+	0x20,
+	0x58,
+	0x0b,
+	0x38,
+	0xa2,
+	0x00,
+	0xa0,
+	0x04,
+	0xb5,
+	0xea,
+	0xf5,
+	0xc4,
+	0xe8,
+	0x88,
+	0xd0,
+	0xf8,
+	0xdc,
+	0x90,
+	0x08,
+	0x53,
+	0xc0,
+	0x00,
+	0xde,
+	0x00,
+	0x4c,
+	0x0d,
+	0x09,
+	0x53,
+	0xde,
+	0x00,
+	0xc0,
+	0x00,
+	0xa5,
+	0xe6,
+	0xf0,
+	0x17,
+	0xa2,
+	0x00,
+	0x38,
+	0x8a,
+	0xe5,
+	0xc0,
+	0x85,
+	0xc0,
+	0x8a,
+	0xe5,
+	0xc1,
+	0x85,
+	0xc1,
+	0x8a,
+	0xe5,
+	0xc2,
+	0x85,
+	0xc2,
+	0x8a,
+	0xe5,
+	0xc3,
+	0x85,
+	0xc3,
+	0x20,
+	0x9b,
+	0x07,
+	0x53,
+	0x2e,
+	0x00,
+	0xcd,
+	0x00,
+	0xa0,
+	0x04,
+	0x53,
+	0xee,
+	0x00,
+	0xea,
+	0x00,
+	0x20,
+	0xb1,
+	0x0a,
+	0xa5,
+	0xee,
+	0x60,
+	0xa5,
+	0x1b,
+	0x29,
+	0x08,
+	0xf0,
+	0x10,
+	0x64,
+	0xe5,
+	0xa0,
+	0x06,
+	0x13,
+	0xe5,
+	0x00,
+	0x59,
+	0x00,
+	0xa9,
+	0xf8,
+	0x85,
+	0x59,
+	0xa9,
+	0x00,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x2e,
+	0x00,
+	0xe8,
+	0x00,
+	0xa2,
+	0xeb,
+	0xa0,
+	0x0d,
+	0xa9,
+	0x08,
+	0x20,
+	0x3c,
+	0x0a,
+	0x84,
+	0xd5,
+	0xa0,
+	0x02,
+	0x53,
+	0x34,
+	0x00,
+	0xe8,
+	0x00,
+	0xa2,
+	0xf5,
+	0xa0,
+	0x0d,
+	0xa9,
+	0x04,
+	0x20,
+	0x3c,
+	0x0a,
+	0x84,
+	0xd4,
+	0xa5,
+	0xd5,
+	0x4a,
+	0x49,
+	0x12,
+	0x85,
+	0xd6,
+	0xa5,
+	0xd4,
+	0x49,
+	0x03,
+	0x65,
+	0xd6,
+	0x69,
+	0x0b,
+	0x85,
+	0xd6,
+	0x98,
+	0x69,
+	0x0e,
+	0x85,
+	0xd7,
+	0xa5,
+	0xd6,
+	0x69,
+	0x12,
+	0x85,
+	0xda,
+	0xa5,
+	0xd7,
+	0x69,
+	0x00,
+	0x85,
+	0xdb,
+	0xa5,
+	0xd5,
+	0x49,
+	0x14,
+	0x69,
+	0x65,
+	0x85,
+	0xd8,
+	0x98,
+	0x69,
+	0x0e,
+	0x85,
+	0xd9,
+	0x18,
+	0xa5,
+	0xd4,
+	0x49,
+	0x0a,
+	0x65,
+	0xd8,
+	0x85,
+	0xd8,
+	0x90,
+	0x03,
+	0xe6,
+	0xd9,
+	0x18,
+	0xa5,
+	0xd8,
+	0x69,
+	0x28,
+	0x85,
+	0xdc,
+	0xa5,
+	0xd9,
+	0x69,
+	0x00,
+	0x85,
+	0xdd,
+	0x64,
+	0xe3,
+	0x20,
+	0xdf,
+	0x07,
+	0xa0,
+	0x02,
+	0x53,
+	0xee,
+	0x00,
+	0x59,
+	0x00,
+	0xe6,
+	0xe3,
+	0xa2,
+	0x03,
+	0xda,
+	0x20,
+	0xdf,
+	0x07,
+	0xfa,
+	0x95,
+	0x5b,
+	0xca,
+	0x10,
+	0xf6,
+	0xa9,
+	0x00,
+	0x60,
+	0xa5,
+	0x1c,
+	0xd8,
+	0x4d,
+	0xde,
+	0x0d,
+	0x85,
+	0x62,
+	0xf8,
+	0x29,
+	0xfc,
+	0xf0,
+	0x03,
+	0xa9,
+	0x1d,
+	0x60,
+	0xa6,
+	0x27,
+	0xa5,
+	0x1b,
+	0x29,
+	0x20,
+	0xf0,
+	0x02,
+	0xa2,
+	0x01,
+	0x8a,
+	0x3a,
+	0x49,
+	0x03,
+	0x18,
+	0x69,
+	0xad,
+	0x85,
+	0xe6,
+	0x98,
+	0x69,
+	0x0d,
+	0x85,
+	0xe7,
+	0xa0,
+	0x06,
+	0xd3,
+	0xe6,
+	0x53,
+	0x00,
+	0xa9,
+	0x00,
+	0x60,
+	0x85,
+	0xea,
+	0x86,
+	0xe6,
+	0x84,
+	0xe7,
+	0xa0,
+	0x01,
+	0xc8,
+	0xc4,
+	0xea,
+	0xf0,
+	0x0d,
+	0x38,
+	0xb1,
+	0xe6,
+	0xe5,
+	0xe8,
+	0xc8,
+	0xb1,
+	0xe6,
+	0xe5,
+	0xe9,
+	0x90,
+	0xef,
+	0x88,
+	0x88,
+	0x88,
+	0x60,
+	0xa0,
+	0x04,
+	0xe6,
+	0xca,
+	0xd0,
+	0x02,
+	0xe6,
+	0xcb,
+	0x88,
+	0xd0,
+	0xf7,
+	0x60,
+	0xa0,
+	0x04,
+	0xd3,
+	0xca,
+	0xc0,
+	0x00,
+	0xb2,
+	0xc8,
+	0x85,
+	0xea,
+	0x64,
+	0xeb,
+	0xa4,
+	0xcc,
+	0xb1,
+	0xc8,
+	0x85,
+	0xec,
+	0x64,
+	0xed,
+	0x20,
+	0xb1,
+	0x0a,
+	0x20,
+	0x59,
+	0x0a,
+	0xe6,
+	0xc8,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc9,
+	0xa5,
+	0xee,
+	0x60,
+	0xa0,
+	0x04,
+	0xd3,
+	0xca,
+	0xc0,
+	0x00,
+	0xa0,
+	0x02,
+	0xd3,
+	0xc8,
+	0xea,
+	0x00,
+	0xa4,
+	0xcc,
+	0xb1,
+	0xc8,
+	0x85,
+	0xec,
+	0xc8,
+	0xb1,
+	0xc8,
+	0x85,
+	0xed,
+	0x20,
+	0xb1,
+	0x0a,
+	0x20,
+	0x59,
+	0x0a,
+	0xa0,
+	0x02,
+	0xe6,
+	0xc8,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc9,
+	0x88,
+	0xd0,
+	0xf7,
+	0x60,
+	0xa0,
+	0x02,
+	0x38,
+	0xa5,
+	0xcd,
+	0xe5,
+	0xe6,
+	0xa5,
+	0xce,
+	0xe5,
+	0xe7,
+	0xb0,
+	0x06,
+	0x53,
+	0xea,
+	0x00,
+	0xee,
+	0x00,
+	0x60,
+	0xa5,
+	0xe8,
+	0xe5,
+	0xcd,
+	0xa5,
+	0xe9,
+	0xe5,
+	0xce,
+	0xb0,
+	0x06,
+	0x53,
+	0xec,
+	0x00,
+	0xee,
+	0x00,
+	0x60,
+	0x38,
+	0xa5,
+	0xcd,
+	0xe5,
+	0xe6,
+	0x85,
+	0xd0,
+	0xa5,
+	0xce,
+	0xe5,
+	0xe7,
+	0x85,
+	0xd1,
+	0x20,
+	0x58,
+	0x0b,
+	0x18,
+	0xa9,
+	0x80,
+	0x65,
+	0xc5,
+	0x90,
+	0x06,
+	0xe6,
+	0xc6,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc7,
+	0x18,
+	0xa5,
+	0xea,
+	0x65,
+	0xc6,
+	0x85,
+	0xee,
+	0xa5,
+	0xeb,
+	0x65,
+	0xc7,
+	0x85,
+	0xef,
+	0x60,
+	0x88,
+	0xd0,
+	0x01,
+	0x60,
+	0x85,
+	0xe6,
+	0x86,
+	0xe7,
+	0x98,
+	0xc8,
+	0x18,
+	0x65,
+	0xe7,
+	0xaa,
+	0x90,
+	0x02,
+	0xe6,
+	0xe6,
+	0x98,
+	0xc9,
+	0x01,
+	0xf0,
+	0x0e,
+	0x29,
+	0x01,
+	0xd0,
+	0x0d,
+	0x46,
+	0xe6,
+	0x8a,
+	0x6a,
+	0xaa,
+	0x98,
+	0x4a,
+	0xa8,
+	0x80,
+	0xee,
+	0xa5,
+	0xe6,
+	0x60,
+	0x8a,
+	0x1a,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe6,
+	0x49,
+	0x55,
+	0x84,
+	0xe8,
+	0x18,
+	0x65,
+	0xe8,
+	0x85,
+	0xe7,
+	0x90,
+	0x03,
+	0xe6,
+	0xe8,
+	0x18,
+	0xa5,
+	0xe6,
+	0x49,
+	0x55,
+	0x84,
+	0xe9,
+	0xaa,
+	0x65,
+	0xe7,
+	0x8a,
+	0x65,
+	0xe8,
+	0x85,
+	0xe8,
+	0xa5,
+	0xe9,
+	0x90,
+	0x03,
+	0xe6,
+	0xe9,
+	0x18,
+	0x65,
+	0xe8,
+	0xaa,
+	0xa5,
+	0xe9,
+	0x69,
+	0x00,
+	0x60,
+	0x64,
+	0xc7,
+	0xa5,
+	0xd0,
+	0x45,
+	0xc0,
+	0x85,
+	0xc4,
+	0x84,
+	0xc5,
+	0x18,
+	0xa5,
+	0xd0,
+	0x45,
+	0xc1,
+	0x65,
+	0xc5,
+	0x85,
+	0xc5,
+	0x90,
+	0x05,
+	0xc8,
+	0xd0,
+	0x02,
+	0xe6,
+	0xc7,
+	0x84,
+	0xc6,
+	0x18,
+	0xa5,
+	0xd1,
+	0x45,
+	0xc0,
+	0x65,
+	0xc5,
+	0x85,
+	0xc5,
+	0x98,
+	0x65,
+	0xc6,
+	0x85,
+	0xc6,
+	0x90,
+	0x03,
+	0xe6,
+	0xc7,
+	0x18,
+	0xa5,
+	0xd0,
+	0x45,
+	0xc2,
+	0x65,
+	0xc6,
+	0x85,
+	0xc6,
+	0x98,
+	0x65,
+	0xc7,
+	0x85,
+	0xc7,
+	0x18,
+	0xa5,
+	0xd1,
+	0x45,
+	0xc1,
+	0x65,
+	0xc6,
+	0x85,
+	0xc6,
+	0x98,
+	0x65,
+	0xc7,
+	0x85,
+	0xc7,
+	0x18,
+	0xa5,
+	0xd0,
+	0x45,
+	0xc3,
+	0x65,
+	0xc7,
+	0x85,
+	0xc7,
+	0x18,
+	0xa5,
+	0xd1,
+	0x45,
+	0xc2,
+	0x65,
+	0xc7,
+	0x85,
+	0xc7,
+	0x60,
+	0xa5,
+	0xe6,
+	0x45,
+	0xe8,
+	0x85,
+	0xea,
+	0x84,
+	0xeb,
+	0xa5,
+	0xe6,
+	0x45,
+	0xe9,
+	0x18,
+	0x65,
+	0xeb,
+	0x85,
+	0xeb,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xec,
+	0x64,
+	0xed,
+	0xa5,
+	0xe7,
+	0x45,
+	0xe8,
+	0x18,
+	0x65,
+	0xeb,
+	0x85,
+	0xeb,
+	0x98,
+	0x65,
+	0xec,
+	0x85,
+	0xec,
+	0x90,
+	0x02,
+	0xe6,
+	0xed,
+	0xa5,
+	0xe7,
+	0x45,
+	0xe9,
+	0x18,
+	0x65,
+	0xec,
+	0x85,
+	0xec,
+	0x98,
+	0x65,
+	0xed,
+	0x85,
+	0xed,
+	0xa5,
+	0xe9,
+	0x10,
+	0x0d,
+	0x38,
+	0xa5,
+	0xec,
+	0xe5,
+	0xe6,
+	0x85,
+	0xec,
+	0xa5,
+	0xed,
+	0xe5,
+	0xe7,
+	0x85,
+	0xed,
+	0x60,
+	0x18,
+	0xa5,
+	0xe8,
+	0x65,
+	0xea,
+	0x85,
+	0xea,
+	0xa2,
+	0x00,
+	0xa5,
+	0xe9,
+	0x10,
+	0x01,
+	0xca,
+	0x65,
+	0xeb,
+	0x85,
+	0xeb,
+	0x8a,
+	0x65,
+	0xec,
+	0x85,
+	0xec,
+	0x8a,
+	0x65,
+	0xed,
+	0x85,
+	0xed,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0xe5,
+	0x0d,
+	0xe8,
+	0x00,
+	0x20,
+	0xb5,
+	0x0b,
+	0xa0,
+	0x02,
+	0x53,
+	0xe9,
+	0x0d,
+	0xe8,
+	0x00,
+	0x20,
+	0xff,
+	0x0b,
+	0xa0,
+	0x04,
+	0x53,
+	0xea,
+	0x00,
+	0xee,
+	0x00,
+	0xa0,
+	0x02,
+	0x53,
+	0xe3,
+	0x0d,
+	0xe8,
+	0x00,
+	0x20,
+	0xb5,
+	0x0b,
+	0xa0,
+	0x02,
+	0x53,
+	0xe7,
+	0x0d,
+	0xe8,
+	0x00,
+	0x20,
+	0xff,
+	0x0b,
+	0xa5,
+	0xed,
+	0x10,
+	0x22,
+	0xa2,
+	0x00,
+	0xa9,
+	0x01,
+	0x4a,
+	0xa9,
+	0x00,
+	0xf5,
+	0xea,
+	0x95,
+	0xea,
+	0x2a,
+	0xe8,
+	0xe0,
+	0x04,
+	0x90,
+	0xf3,
+	0xa2,
+	0x00,
+	0xa9,
+	0x01,
+	0x4a,
+	0xa9,
+	0x00,
+	0xf5,
+	0xee,
+	0x95,
+	0xee,
+	0x2a,
+	0xe8,
+	0xe0,
+	0x04,
+	0x90,
+	0xf3,
+	0xa5,
+	0xed,
+	0x05,
+	0xf1,
+	0x30,
+	0x12,
+	0x06,
+	0xea,
+	0x26,
+	0xeb,
+	0x26,
+	0xec,
+	0x26,
+	0xed,
+	0x06,
+	0xee,
+	0x26,
+	0xef,
+	0x26,
+	0xf0,
+	0x26,
+	0xf1,
+	0x80,
+	0xe8,
+	0x64,
+	0xe6,
+	0x64,
+	0xe7,
+	0x64,
+	0xe8,
+	0x64,
+	0xe9,
+	0xa2,
+	0x20,
+	0x06,
+	0xea,
+	0x26,
+	0xeb,
+	0x26,
+	0xec,
+	0x26,
+	0xed,
+	0x26,
+	0xe6,
+	0x26,
+	0xe7,
+	0x26,
+	0xe8,
+	0x26,
+	0xe9,
+	0x38,
+	0xa5,
+	0xe6,
+	0xe5,
+	0xef,
+	0x85,
+	0xc0,
+	0xa5,
+	0xe7,
+	0xe5,
+	0xf0,
+	0x85,
+	0xc1,
+	0xa5,
+	0xe8,
+	0xe5,
+	0xf1,
+	0x85,
+	0xc2,
+	0xa5,
+	0xe9,
+	0xe9,
+	0x00,
+	0x85,
+	0xc3,
+	0x90,
+	0x0b,
+	0xe6,
+	0xea,
+	0x8a,
+	0xa0,
+	0x04,
+	0x53,
+	0xc0,
+	0x00,
+	0xe6,
+	0x00,
+	0xaa,
+	0xca,
+	0xd0,
+	0xc7,
+	0xa6,
+	0xea,
+	0xa4,
+	0xeb,
+	0xa5,
+	0xec,
+	0x05,
+	0xed,
+	0xf0,
+	0x03,
+	0xa2,
+	0xff,
+	0xdc,
+	0x86,
+	0xe6,
+	0x84,
+	0xe7,
+	0x60,
+	0xba,
+	0x08,
+	0x78,
+	0x68,
+	0x48,
+	0x29,
+	0x1c,
+	0x85,
+	0xfa,
+	0x86,
+	0xf8,
+	0xa9,
+	0x01,
+	0x85,
+	0xf9,
+	0xa0,
+	0x06,
+	0xb1,
+	0xf8,
+	0x48,
+	0x29,
+	0x1c,
+	0xc5,
+	0xfa,
+	0x90,
+	0x08,
+	0x7a,
+	0xa0,
+	0x09,
+	0xb1,
+	0xf8,
+	0x48,
+	0x29,
+	0x1c,
+	0xc9,
+	0x00,
+	0xd0,
+	0x38,
+	0xa0,
+	0x03,
+	0xb1,
+	0xf8,
+	0xe0,
+	0xdf,
+	0xb0,
+	0x18,
+	0x8d,
+	0x6b,
+	0x01,
+	0xc8,
+	0xb1,
+	0xf8,
+	0x8d,
+	0x6c,
+	0x01,
+	0xc8,
+	0xb1,
+	0xf8,
+	0x8d,
+	0x6d,
+	0x01,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0x6e,
+	0x01,
+	0x80,
+	0x16,
+	0x8d,
+	0x6f,
+	0x01,
+	0xc8,
+	0xb1,
+	0xf8,
+	0x8d,
+	0x70,
+	0x01,
+	0xc8,
+	0xb1,
+	0xf8,
+	0x8d,
+	0x71,
+	0x01,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0x72,
+	0x01,
+	0xa9,
+	0x00,
+	0xfa,
+	0x28,
+	0xf8,
+	0x60,
+	0x68,
+	0xf0,
+	0x04,
+	0x68,
+	0xfa,
+	0x7a,
+	0x40,
+	0x08,
+	0x78,
+	0x68,
+	0xad,
+	0x6a,
+	0x01,
+	0xf0,
+	0x0e,
+	0xae,
+	0x6e,
+	0x01,
+	0x9a,
+	0xad,
+	0x6b,
+	0x01,
+	0xae,
+	0x6c,
+	0x01,
+	0xac,
+	0x6d,
+	0x01,
+	0x40,
+	0xae,
+	0x72,
+	0x01,
+	0x9a,
+	0xad,
+	0x6f,
+	0x01,
+	0xae,
+	0x70,
+	0x01,
+	0xac,
+	0x71,
+	0x01,
+	0x40,
+	0x08,
+	0x78,
+	0xad,
+	0x6a,
+	0x01,
+	0xd0,
+	0x1f,
+	0x1a,
+	0x8d,
+	0x6a,
+	0x01,
+	0xa9,
+	0xdc,
+	0x8d,
+	0x6e,
+	0x01,
+	0x9c,
+	0x6b,
+	0x01,
+	0x9c,
+	0x6c,
+	0x01,
+	0x9c,
+	0x6d,
+	0x01,
+	0xa9,
+	0x03,
+	0x8d,
+	0xdf,
+	0x01,
+	0xa9,
+	0x6f,
+	0x8d,
+	0xde,
+	0x01,
+	0x9c,
+	0xdd,
+	0x01,
+	0x28,
+	0x60,
+	0xa9,
+	0x02,
+	0x60,
+	0x04,
+	0xdc,
+	0x02,
+	0xfd,
+	0x02,
+	0xff,
+	0xff,
+	0xff,
+	0xff,
+	0x0d,
+	0x03,
+	0x07,
+	0x01,
+	0x5b,
+	0xe6,
+	0x80,
+	0x80,
+	0x80,
+	0xff,
+	0xff,
+	0x02,
+	0x01,
+	0x05,
+	0x00,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x10,
+	0x03,
+	0x70,
+	0x00,
+	0x10,
+	0x00,
+	0xc7,
+	0x02,
+	0x8e,
+	0x00,
+	0x1c,
+	0x00,
+	0xa4,
+	0x02,
+	0x9c,
+	0x00,
+	0x24,
+	0x00,
+	0x00,
+	0x01,
+	0x01,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x03,
+	0x03,
+	0x03,
+	0x03,
+	0x03,
+	0x03,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+
+};
+
+uint8_t dppcode_u_1_7[] =
+{
+	0x78,
+	0xb8,
+	0x18,
+	0xf8,
+	0x9c,
+	0x00,
+	0x02,
+	0xa0,
+	0x36,
+	0x13,
+	0x00,
+	0x02,
+	0x01,
+	0x02,
+	0xa9,
+	0x07,
+	0x8d,
+	0x00,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x01,
+	0x02,
+	0xa9,
+	0xe8,
+	0x8d,
+	0x02,
+	0x02,
+	0xa9,
+	0xeb,
+	0x8d,
+	0x03,
+	0x02,
+	0xa2,
+	0xff,
+	0x8e,
+	0x32,
+	0x02,
+	0x8e,
+	0x1d,
+	0x6b,
+	0xa2,
+	0xff,
+	0x8e,
+	0x33,
+	0x02,
+	0x8e,
+	0x1e,
+	0x6b,
+	0xa0,
+	0x03,
+	0x53,
+	0x27,
+	0xbe,
+	0x04,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x07,
+	0x02,
+	0xcd,
+	0x29,
+	0xbe,
+	0xf0,
+	0x04,
+	0xa2,
+	0x02,
+	0x80,
+	0x10,
+	0xa2,
+	0x01,
+	0xad,
+	0x00,
+	0xc0,
+	0xc9,
+	0xe8,
+	0xd0,
+	0x07,
+	0xad,
+	0x01,
+	0xc0,
+	0xc9,
+	0xeb,
+	0xf0,
+	0x0e,
+	0x8e,
+	0x08,
+	0x02,
+	0xa9,
+	0x01,
+	0x9c,
+	0x14,
+	0xd0,
+	0x8d,
+	0x14,
+	0xd0,
+	0x5c,
+	0x80,
+	0xfd,
+	0x9c,
+	0x08,
+	0x02,
+	0xa0,
+	0x0e,
+	0x53,
+	0x80,
+	0x3f,
+	0x02,
+	0x00,
+	0x9c,
+	0x14,
+	0xd0,
+	0x9c,
+	0x18,
+	0xd0,
+	0x9c,
+	0x1c,
+	0xd0,
+	0x9c,
+	0x20,
+	0xd0,
+	0x9c,
+	0x24,
+	0xd0,
+	0x9c,
+	0x28,
+	0xd0,
+	0xa2,
+	0xff,
+	0x9a,
+	0x20,
+	0x90,
+	0x03,
+	0x58,
+	0xa9,
+	0x01,
+	0x8d,
+	0x14,
+	0xd0,
+	0x4c,
+	0xf8,
+	0x0d,
+	0x9c,
+	0xde,
+	0x5e,
+	0xa9,
+	0x01,
+	0x8d,
+	0xdf,
+	0x5e,
+	0x9c,
+	0x81,
+	0x82,
+	0x9c,
+	0x21,
+	0x5f,
+	0x9c,
+	0x22,
+	0x5f,
+	0x9c,
+	0x23,
+	0x5f,
+	0x9c,
+	0x24,
+	0x5f,
+	0x9c,
+	0x2b,
+	0x5f,
+	0x9c,
+	0x2c,
+	0x5f,
+	0xa0,
+	0x03,
+	0x13,
+	0x81,
+	0x82,
+	0x18,
+	0x5f,
+	0x13,
+	0x81,
+	0x82,
+	0x1b,
+	0x5f,
+	0x20,
+	0xc6,
+	0x03,
+	0x20,
+	0x83,
+	0x1a,
+	0x20,
+	0xc0,
+	0x1a,
+	0x9c,
+	0x75,
+	0x60,
+	0x60,
+	0x9c,
+	0x65,
+	0x5e,
+	0x9c,
+	0x64,
+	0x5e,
+	0x9c,
+	0x66,
+	0x5e,
+	0x9c,
+	0x67,
+	0x5e,
+	0x9c,
+	0x68,
+	0x5e,
+	0x60,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xa9,
+	0x3e,
+	0x48,
+	0xad,
+	0x08,
+	0xd0,
+	0xc9,
+	0x01,
+	0xd0,
+	0x51,
+	0x08,
+	0x78,
+	0xad,
+	0x64,
+	0x5e,
+	0xc9,
+	0x02,
+	0xb0,
+	0x03,
+	0xee,
+	0x64,
+	0x5e,
+	0xee,
+	0x66,
+	0x5e,
+	0xd0,
+	0x08,
+	0xee,
+	0x67,
+	0x5e,
+	0xd0,
+	0x03,
+	0xee,
+	0x68,
+	0x5e,
+	0xa0,
+	0x37,
+	0xad,
+	0x65,
+	0x5e,
+	0x1a,
+	0x29,
+	0x01,
+	0x8d,
+	0x65,
+	0x5e,
+	0xf0,
+	0x0e,
+	0x53,
+	0x00,
+	0x02,
+	0xa0,
+	0x5e,
+	0xa0,
+	0x03,
+	0x53,
+	0x66,
+	0x5e,
+	0xda,
+	0x5e,
+	0x80,
+	0x0c,
+	0x53,
+	0x00,
+	0x02,
+	0x69,
+	0x5e,
+	0xa0,
+	0x03,
+	0x53,
+	0x66,
+	0x5e,
+	0xd7,
+	0x5e,
+	0xad,
+	0x75,
+	0x60,
+	0xd0,
+	0x03,
+	0x20,
+	0x36,
+	0x3f,
+	0x28,
+	0xa9,
+	0x01,
+	0x9c,
+	0x18,
+	0xd0,
+	0x8d,
+	0x18,
+	0xd0,
+	0x4c,
+	0x0b,
+	0x3f,
+	0x8a,
+	0xf0,
+	0x0c,
+	0xa9,
+	0x40,
+	0x8d,
+	0x30,
+	0xc0,
+	0xa9,
+	0x08,
+	0x8d,
+	0x31,
+	0xc0,
+	0x80,
+	0x06,
+	0x9c,
+	0x30,
+	0xc0,
+	0x9c,
+	0x31,
+	0xc0,
+	0xbd,
+	0x2d,
+	0x5f,
+	0x85,
+	0xa9,
+	0x8d,
+	0x78,
+	0xc0,
+	0xbd,
+	0x2f,
+	0x5f,
+	0x8d,
+	0x17,
+	0x6b,
+	0xbd,
+	0x31,
+	0x5f,
+	0x8d,
+	0x68,
+	0xc0,
+	0xbd,
+	0x33,
+	0x5f,
+	0x8d,
+	0x69,
+	0xc0,
+	0xbd,
+	0x35,
+	0x5f,
+	0x0a,
+	0xa8,
+	0xb9,
+	0x9c,
+	0x6a,
+	0x85,
+	0xc0,
+	0xb9,
+	0x9d,
+	0x6a,
+	0x85,
+	0xc1,
+	0xb9,
+	0xf4,
+	0x6a,
+	0x8d,
+	0x58,
+	0xc0,
+	0xb9,
+	0xf5,
+	0x6a,
+	0x8d,
+	0x59,
+	0xc0,
+	0xb9,
+	0x04,
+	0x6b,
+	0x8d,
+	0x60,
+	0xc0,
+	0xb9,
+	0x05,
+	0x6b,
+	0x8d,
+	0x61,
+	0xc0,
+	0xbd,
+	0x37,
+	0x5f,
+	0x0a,
+	0xa8,
+	0xb9,
+	0xa4,
+	0x6a,
+	0x85,
+	0xc2,
+	0xb9,
+	0xa5,
+	0x6a,
+	0x85,
+	0xc3,
+	0xb9,
+	0xfc,
+	0x6a,
+	0x8d,
+	0x5c,
+	0xc0,
+	0xb9,
+	0xfd,
+	0x6a,
+	0x8d,
+	0x5d,
+	0xc0,
+	0xb9,
+	0x0c,
+	0x6b,
+	0x8d,
+	0x64,
+	0xc0,
+	0xb9,
+	0x0d,
+	0x6b,
+	0x8d,
+	0x65,
+	0xc0,
+	0xbd,
+	0x39,
+	0x5f,
+	0x8d,
+	0x14,
+	0xc0,
+	0xbd,
+	0x3b,
+	0x5f,
+	0x8d,
+	0x18,
+	0xc0,
+	0xbd,
+	0x3d,
+	0x5f,
+	0x8d,
+	0x19,
+	0xc0,
+	0xa9,
+	0x00,
+	0x8d,
+	0x0c,
+	0xc0,
+	0xa9,
+	0x00,
+	0x8d,
+	0x0d,
+	0xc0,
+	0xda,
+	0xe0,
+	0x00,
+	0xd0,
+	0x12,
+	0xac,
+	0x6f,
+	0x60,
+	0x43,
+	0x97,
+	0x5f,
+	0x54,
+	0xc0,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x27,
+	0x60,
+	0x79,
+	0x6a,
+	0x80,
+	0x10,
+	0xac,
+	0x70,
+	0x60,
+	0x43,
+	0xbf,
+	0x5f,
+	0x54,
+	0xc0,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x3b,
+	0x60,
+	0x79,
+	0x6a,
+	0xfa,
+	0xbd,
+	0x6b,
+	0x5f,
+	0x8d,
+	0x28,
+	0xc0,
+	0xbd,
+	0x3f,
+	0x5f,
+	0x8d,
+	0x1c,
+	0xc0,
+	0xbd,
+	0x41,
+	0x5f,
+	0x8d,
+	0x1d,
+	0xc0,
+	0xa9,
+	0x50,
+	0x8d,
+	0x0c,
+	0xc0,
+	0xa9,
+	0x00,
+	0x8d,
+	0x0d,
+	0xc0,
+	0xda,
+	0xe0,
+	0x00,
+	0xd0,
+	0x12,
+	0xac,
+	0x71,
+	0x60,
+	0x43,
+	0xe7,
+	0x5f,
+	0x54,
+	0xc0,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x4f,
+	0x60,
+	0x8d,
+	0x6a,
+	0x80,
+	0x10,
+	0xac,
+	0x72,
+	0x60,
+	0x43,
+	0x07,
+	0x60,
+	0x54,
+	0xc0,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x5f,
+	0x60,
+	0x8d,
+	0x6a,
+	0xfa,
+	0xbd,
+	0x6d,
+	0x5f,
+	0x8d,
+	0x2c,
+	0xc0,
+	0xbd,
+	0x47,
+	0x5f,
+	0x85,
+	0xb4,
+	0xbd,
+	0x49,
+	0x5f,
+	0x85,
+	0xb5,
+	0xbd,
+	0x4b,
+	0x5f,
+	0x85,
+	0xbe,
+	0xbd,
+	0x4d,
+	0x5f,
+	0x85,
+	0xbf,
+	0xbd,
+	0x4f,
+	0x5f,
+	0x85,
+	0xaa,
+	0xbd,
+	0x51,
+	0x5f,
+	0x85,
+	0xb9,
+	0xbd,
+	0x53,
+	0x5f,
+	0x85,
+	0xb6,
+	0xbd,
+	0x55,
+	0x5f,
+	0x85,
+	0xbd,
+	0xbd,
+	0x57,
+	0x5f,
+	0x85,
+	0xb7,
+	0xbd,
+	0x59,
+	0x5f,
+	0x85,
+	0xb8,
+	0xbd,
+	0x5b,
+	0x5f,
+	0x85,
+	0xac,
+	0xbd,
+	0x5d,
+	0x5f,
+	0x85,
+	0xad,
+	0xbd,
+	0x5f,
+	0x5f,
+	0x85,
+	0xb2,
+	0xbd,
+	0x61,
+	0x5f,
+	0x85,
+	0xb3,
+	0xbd,
+	0x63,
+	0x5f,
+	0x85,
+	0xae,
+	0xbd,
+	0x65,
+	0x5f,
+	0x85,
+	0xaf,
+	0xbd,
+	0x67,
+	0x5f,
+	0x85,
+	0xb0,
+	0xbd,
+	0x69,
+	0x5f,
+	0x85,
+	0xb1,
+	0xda,
+	0xbd,
+	0x29,
+	0x5f,
+	0x8d,
+	0x76,
+	0x60,
+	0xf0,
+	0x3c,
+	0xbd,
+	0x73,
+	0x60,
+	0x85,
+	0x12,
+	0xbd,
+	0x27,
+	0x5f,
+	0xa2,
+	0x00,
+	0xa8,
+	0xd0,
+	0x04,
+	0xa5,
+	0x25,
+	0xd0,
+	0x29,
+	0xc0,
+	0x00,
+	0xf0,
+	0x0a,
+	0x20,
+	0x5e,
+	0x3f,
+	0xa0,
+	0x06,
+	0x53,
+	0x4c,
+	0x5c,
+	0x79,
+	0x6b,
+	0xa0,
+	0x01,
+	0x84,
+	0x25,
+	0xa0,
+	0x02,
+	0x53,
+	0x32,
+	0x02,
+	0x1b,
+	0x6b,
+	0x20,
+	0x9f,
+	0x3b,
+	0x64,
+	0x24,
+	0xa5,
+	0xbd,
+	0x85,
+	0x23,
+	0xa5,
+	0x12,
+	0x8d,
+	0x19,
+	0x6b,
+	0xa2,
+	0x01,
+	0x86,
+	0xa8,
+	0xfa,
+	0x08,
+	0x78,
+	0x68,
+	0xa9,
+	0x02,
+	0x8d,
+	0x38,
+	0xc0,
+	0xa9,
+	0x01,
+	0x8d,
+	0x38,
+	0xc0,
+	0xa9,
+	0x09,
+	0x8d,
+	0x38,
+	0xc0,
+	0xbd,
+	0x43,
+	0x5f,
+	0xf0,
+	0x0a,
+	0xa9,
+	0x05,
+	0x8d,
+	0x38,
+	0xc0,
+	0xa9,
+	0x0d,
+	0x8d,
+	0x38,
+	0xc0,
+	0xbd,
+	0x45,
+	0x5f,
+	0x85,
+	0xab,
+	0x85,
+	0xba,
+	0x60,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xa9,
+	0x3e,
+	0x48,
+	0xad,
+	0x0c,
+	0xd0,
+	0xc9,
+	0x01,
+	0xf0,
+	0x05,
+	0xa9,
+	0x05,
+	0x4c,
+	0x82,
+	0x06,
+	0x08,
+	0x78,
+	0xad,
+	0xde,
+	0x5e,
+	0xf0,
+	0x59,
+	0x8d,
+	0x63,
+	0x5e,
+	0xc9,
+	0x02,
+	0xf0,
+	0x0d,
+	0xa2,
+	0x00,
+	0xad,
+	0x21,
+	0x5f,
+	0x0d,
+	0x23,
+	0x5f,
+	0xd0,
+	0x1b,
+	0xe8,
+	0x80,
+	0x18,
+	0x38,
+	0xad,
+	0x1b,
+	0x5f,
+	0xed,
+	0x18,
+	0x5f,
+	0xad,
+	0x1c,
+	0x5f,
+	0xed,
+	0x19,
+	0x5f,
+	0xad,
+	0x1d,
+	0x5f,
+	0xed,
+	0x1a,
+	0x5f,
+	0xa2,
+	0x01,
+	0xb0,
+	0x01,
+	0xca,
+	0xad,
+	0x09,
+	0x02,
+	0xdd,
+	0x21,
+	0x5f,
+	0xd0,
+	0x0d,
+	0xad,
+	0x0a,
+	0x02,
+	0xdd,
+	0x23,
+	0x5f,
+	0xd0,
+	0x05,
+	0xbd,
+	0x25,
+	0x5f,
+	0x80,
+	0x1a,
+	0xce,
+	0x63,
+	0x5e,
+	0xf0,
+	0x0f,
+	0xca,
+	0xf0,
+	0xe3,
+	0xa2,
+	0x01,
+	0x80,
+	0xdf,
+	0xad,
+	0xe0,
+	0x5e,
+	0x9c,
+	0xe0,
+	0x5e,
+	0xd0,
+	0x06,
+	0xa9,
+	0x04,
+	0x80,
+	0x02,
+	0xa9,
+	0x03,
+	0x28,
+	0x8d,
+	0x08,
+	0x02,
+	0xc9,
+	0x00,
+	0xf0,
+	0x0a,
+	0xa0,
+	0x01,
+	0x9c,
+	0x28,
+	0xd0,
+	0x8c,
+	0x28,
+	0xd0,
+	0x80,
+	0x27,
+	0x20,
+	0x38,
+	0x04,
+	0xee,
+	0x32,
+	0x02,
+	0xd0,
+	0x03,
+	0xee,
+	0x33,
+	0x02,
+	0x9c,
+	0x81,
+	0x82,
+	0xa9,
+	0x01,
+	0x8d,
+	0x75,
+	0x60,
+	0x8d,
+	0xdf,
+	0x5e,
+	0x9c,
+	0x2b,
+	0x5f,
+	0x9c,
+	0x2c,
+	0x5f,
+	0x9c,
+	0xde,
+	0x5e,
+	0xa0,
+	0x01,
+	0x9c,
+	0x20,
+	0xd0,
+	0x8c,
+	0x20,
+	0xd0,
+	0x4c,
+	0x0b,
+	0x3f,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xa9,
+	0x3e,
+	0x48,
+	0x08,
+	0x78,
+	0x68,
+	0xa5,
+	0x25,
+	0xc9,
+	0x03,
+	0xf0,
+	0x05,
+	0x64,
+	0x25,
+	0x20,
+	0x5e,
+	0x3f,
+	0xa9,
+	0x01,
+	0x9c,
+	0x24,
+	0xd0,
+	0x8d,
+	0x24,
+	0xd0,
+	0x9c,
+	0x75,
+	0x60,
+	0x20,
+	0x36,
+	0x3f,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0xc0,
+	0x4c,
+	0x12,
+	0x3f,
+	0xa9,
+	0x01,
+	0xcc,
+	0x2b,
+	0xbe,
+	0x90,
+	0x08,
+	0xd0,
+	0x05,
+	0xec,
+	0x2a,
+	0xbe,
+	0x90,
+	0x01,
+	0x1a,
+	0x3a,
+	0x60,
+	0xa9,
+	0x01,
+	0xcc,
+	0x2d,
+	0xbe,
+	0x90,
+	0x08,
+	0xd0,
+	0x05,
+	0xec,
+	0x2c,
+	0xbe,
+	0x90,
+	0x01,
+	0x1a,
+	0x3a,
+	0x60,
+	0xa5,
+	0x22,
+	0xf0,
+	0x38,
+	0xa9,
+	0x4a,
+	0x85,
+	0x16,
+	0xa9,
+	0x70,
+	0x85,
+	0x17,
+	0xa9,
+	0x1b,
+	0x85,
+	0x18,
+	0xa9,
+	0x6c,
+	0x85,
+	0x19,
+	0xa0,
+	0x00,
+	0xa9,
+	0x04,
+	0xf3,
+	0x16,
+	0x18,
+	0xe6,
+	0x17,
+	0xe6,
+	0x19,
+	0x3a,
+	0xd0,
+	0xf6,
+	0xa0,
+	0x2f,
+	0xf3,
+	0x16,
+	0x18,
+	0xa0,
+	0x06,
+	0x53,
+	0x7f,
+	0x6b,
+	0x79,
+	0x6b,
+	0xa0,
+	0x02,
+	0x53,
+	0x34,
+	0x02,
+	0x1d,
+	0x6b,
+	0x53,
+	0x1b,
+	0x6b,
+	0x34,
+	0x02,
+	0x64,
+	0x22,
+	0xf8,
+	0x08,
+	0x78,
+	0xad,
+	0x64,
+	0x5e,
+	0xd0,
+	0x03,
+	0x4c,
+	0x7f,
+	0x08,
+	0xa0,
+	0x03,
+	0x53,
+	0x66,
+	0x5e,
+	0x1e,
+	0x5f,
+	0xad,
+	0x65,
+	0x5e,
+	0x8d,
+	0xdd,
+	0x5e,
+	0xaa,
+	0xd0,
+	0x39,
+	0xbd,
+	0x2b,
+	0x5f,
+	0xf0,
+	0x1e,
+	0xad,
+	0xd7,
+	0x5e,
+	0xcd,
+	0x18,
+	0x5f,
+	0xd0,
+	0x16,
+	0xad,
+	0xd8,
+	0x5e,
+	0xcd,
+	0x19,
+	0x5f,
+	0xd0,
+	0x0e,
+	0xad,
+	0xd9,
+	0x5e,
+	0xcd,
+	0x1a,
+	0x5f,
+	0xd0,
+	0x06,
+	0xac,
+	0xdd,
+	0x5e,
+	0x4c,
+	0x6d,
+	0x08,
+	0x9c,
+	0x30,
+	0xc0,
+	0x9c,
+	0x31,
+	0xc0,
+	0xa0,
+	0x37,
+	0x53,
+	0x69,
+	0x5e,
+	0xe1,
+	0x5e,
+	0xa0,
+	0x03,
+	0x53,
+	0xd7,
+	0x5e,
+	0x18,
+	0x5f,
+	0x80,
+	0x3b,
+	0xbd,
+	0x2b,
+	0x5f,
+	0xf0,
+	0x1e,
+	0xad,
+	0xda,
+	0x5e,
+	0xcd,
+	0x1b,
+	0x5f,
+	0xd0,
+	0x16,
+	0xad,
+	0xdb,
+	0x5e,
+	0xcd,
+	0x1c,
+	0x5f,
+	0xd0,
+	0x0e,
+	0xad,
+	0xdc,
+	0x5e,
+	0xcd,
+	0x1d,
+	0x5f,
+	0xd0,
+	0x06,
+	0xac,
+	0xdd,
+	0x5e,
+	0x4c,
+	0x6d,
+	0x08,
+	0xa9,
+	0x40,
+	0x8d,
+	0x30,
+	0xc0,
+	0xa9,
+	0x08,
+	0x8d,
+	0x31,
+	0xc0,
+	0xa0,
+	0x37,
+	0x53,
+	0xa0,
+	0x5e,
+	0xe1,
+	0x5e,
+	0xa0,
+	0x03,
+	0x53,
+	0xda,
+	0x5e,
+	0x1b,
+	0x5f,
+	0xae,
+	0xdd,
+	0x5e,
+	0xa9,
+	0x00,
+	0x9d,
+	0x21,
+	0x5f,
+	0x9d,
+	0x23,
+	0x5f,
+	0x9d,
+	0x3d,
+	0x5f,
+	0x9d,
+	0x3b,
+	0x5f,
+	0xad,
+	0xde,
+	0x5e,
+	0xc9,
+	0x02,
+	0xd0,
+	0x04,
+	0x3a,
+	0x8d,
+	0xde,
+	0x5e,
+	0x28,
+	0xad,
+	0xdf,
+	0x5e,
+	0xf0,
+	0x2b,
+	0x9c,
+	0xdf,
+	0x5e,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0xc0,
+	0xa9,
+	0x01,
+	0x8d,
+	0x10,
+	0xc0,
+	0x9c,
+	0x3c,
+	0xc0,
+	0xad,
+	0x37,
+	0xbe,
+	0xae,
+	0x38,
+	0xbe,
+	0x8d,
+	0x70,
+	0xc0,
+	0x8e,
+	0x6c,
+	0xc0,
+	0x9c,
+	0x29,
+	0xc0,
+	0x9c,
+	0x2d,
+	0xc0,
+	0x9c,
+	0x74,
+	0xc0,
+	0x9c,
+	0x20,
+	0xc0,
+	0x9c,
+	0x24,
+	0xc0,
+	0xad,
+	0xdd,
+	0x5e,
+	0x20,
+	0x9e,
+	0x08,
+	0x08,
+	0x78,
+	0xac,
+	0xdd,
+	0x5e,
+	0x99,
+	0x25,
+	0x5f,
+	0x8d,
+	0xe0,
+	0x5e,
+	0xb9,
+	0x3d,
+	0x5f,
+	0xaa,
+	0xb9,
+	0x3b,
+	0x5f,
+	0x1a,
+	0xd0,
+	0x01,
+	0xe8,
+	0x0a,
+	0x99,
+	0x21,
+	0x5f,
+	0x8a,
+	0x2a,
+	0x99,
+	0x23,
+	0x5f,
+	0xa9,
+	0x01,
+	0x9c,
+	0x1c,
+	0xd0,
+	0x8d,
+	0x1c,
+	0xd0,
+	0xee,
+	0xde,
+	0x5e,
+	0xad,
+	0x66,
+	0x5e,
+	0xcd,
+	0x1e,
+	0x5f,
+	0xd0,
+	0x10,
+	0xad,
+	0x67,
+	0x5e,
+	0xcd,
+	0x1f,
+	0x5f,
+	0xd0,
+	0x08,
+	0xad,
+	0x68,
+	0x5e,
+	0xcd,
+	0x20,
+	0x5f,
+	0xf0,
+	0x03,
+	0x4c,
+	0x51,
+	0x07,
+	0xad,
+	0x64,
+	0x5e,
+	0x3a,
+	0xf0,
+	0x0c,
+	0xcc,
+	0x65,
+	0x5e,
+	0xd0,
+	0x07,
+	0x98,
+	0x1a,
+	0x29,
+	0x01,
+	0x4c,
+	0x5b,
+	0x07,
+	0x9c,
+	0x81,
+	0x82,
+	0xad,
+	0x17,
+	0x5f,
+	0xf0,
+	0x14,
+	0xac,
+	0xdd,
+	0x5e,
+	0xb9,
+	0x23,
+	0x5f,
+	0x8d,
+	0x0a,
+	0x02,
+	0xb9,
+	0x21,
+	0x5f,
+	0x8d,
+	0x09,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x0c,
+	0xd0,
+	0x4c,
+	0x28,
+	0x3f,
+	0xaa,
+	0x85,
+	0x1f,
+	0xad,
+	0xed,
+	0x5e,
+	0xa8,
+	0x29,
+	0x01,
+	0x85,
+	0xb6,
+	0x9d,
+	0x53,
+	0x5f,
+	0x98,
+	0x4a,
+	0x29,
+	0x01,
+	0x85,
+	0xbd,
+	0x9d,
+	0x55,
+	0x5f,
+	0x98,
+	0x29,
+	0x03,
+	0xd8,
+	0x4d,
+	0x2e,
+	0xbe,
+	0xf8,
+	0x9d,
+	0x39,
+	0x5f,
+	0xad,
+	0xf9,
+	0x5e,
+	0xf0,
+	0x03,
+	0xa9,
+	0x04,
+	0x60,
+	0xad,
+	0xf8,
+	0x5e,
+	0xa8,
+	0x29,
+	0xf0,
+	0xd0,
+	0xf5,
+	0x98,
+	0x29,
+	0x01,
+	0xf0,
+	0xf0,
+	0xad,
+	0xf7,
+	0x5e,
+	0xd0,
+	0xeb,
+	0xad,
+	0xf6,
+	0x5e,
+	0xa8,
+	0x29,
+	0xf0,
+	0xd0,
+	0xe3,
+	0x98,
+	0x29,
+	0x01,
+	0xf0,
+	0xde,
+	0x18,
+	0xad,
+	0xf8,
+	0x5e,
+	0x6d,
+	0xf6,
+	0x5e,
+	0x4a,
+	0xc9,
+	0x05,
+	0xb0,
+	0xd2,
+	0xa8,
+	0xb9,
+	0xa3,
+	0x59,
+	0xf0,
+	0xcc,
+	0x98,
+	0x85,
+	0x10,
+	0x9d,
+	0x35,
+	0x5f,
+	0xac,
+	0xef,
+	0x5e,
+	0xae,
+	0xee,
+	0x5e,
+	0x20,
+	0xe8,
+	0x06,
+	0xd0,
+	0xbb,
+	0x98,
+	0x4a,
+	0x85,
+	0x17,
+	0x8a,
+	0x6a,
+	0x85,
+	0x16,
+	0xb0,
+	0xb1,
+	0xac,
+	0xf3,
+	0x5e,
+	0xae,
+	0xf2,
+	0x5e,
+	0x20,
+	0xe8,
+	0x06,
+	0xd0,
+	0xa6,
+	0x98,
+	0x4a,
+	0x85,
+	0x19,
+	0x8a,
+	0x6a,
+	0x85,
+	0x18,
+	0x90,
+	0x9c,
+	0xe5,
+	0x16,
+	0xaa,
+	0xa5,
+	0x19,
+	0xe5,
+	0x17,
+	0x30,
+	0x93,
+	0xa4,
+	0x10,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1a,
+	0x86,
+	0x1b,
+	0xa4,
+	0x1f,
+	0x99,
+	0x3b,
+	0x5f,
+	0x8a,
+	0x99,
+	0x3d,
+	0x5f,
+	0xa0,
+	0x00,
+	0xb9,
+	0xae,
+	0x6a,
+	0x38,
+	0xe5,
+	0x16,
+	0xb9,
+	0xc2,
+	0x6a,
+	0xe5,
+	0x17,
+	0x10,
+	0x03,
+	0xc8,
+	0x80,
+	0xf0,
+	0x84,
+	0xb4,
+	0xb9,
+	0xae,
+	0x6a,
+	0x38,
+	0xe5,
+	0x18,
+	0xb9,
+	0xc2,
+	0x6a,
+	0xe5,
+	0x19,
+	0x10,
+	0x03,
+	0xc8,
+	0x80,
+	0xf0,
+	0x84,
+	0xb5,
+	0xa9,
+	0xff,
+	0x85,
+	0x1e,
+	0x64,
+	0x20,
+	0xa5,
+	0xb6,
+	0xd0,
+	0x3b,
+	0xa4,
+	0xb4,
+	0xc4,
+	0xb5,
+	0xf0,
+	0x79,
+	0x5a,
+	0x38,
+	0xb9,
+	0xae,
+	0x6a,
+	0xe5,
+	0x16,
+	0xaa,
+	0xb9,
+	0xc2,
+	0x6a,
+	0xe5,
+	0x17,
+	0xa4,
+	0x10,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1c,
+	0x86,
+	0x1d,
+	0x48,
+	0x0a,
+	0x1a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x8a,
+	0x2a,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x38,
+	0x68,
+	0xaa,
+	0xe5,
+	0x1e,
+	0x7a,
+	0x99,
+	0x79,
+	0x6a,
+	0x86,
+	0x1e,
+	0xc8,
+	0x80,
+	0xc7,
+	0xa5,
+	0x18,
+	0xd0,
+	0x02,
+	0xc6,
+	0x19,
+	0x3a,
+	0x85,
+	0x18,
+	0xa4,
+	0xb5,
+	0xc4,
+	0xb4,
+	0xf0,
+	0x35,
+	0x5a,
+	0x38,
+	0xa5,
+	0x18,
+	0xf9,
+	0xad,
+	0x6a,
+	0xaa,
+	0xa5,
+	0x19,
+	0xf9,
+	0xc1,
+	0x6a,
+	0xa4,
+	0x10,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1c,
+	0x86,
+	0x1d,
+	0x48,
+	0x0a,
+	0x1a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x8a,
+	0x2a,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x38,
+	0x68,
+	0xaa,
+	0xe5,
+	0x1e,
+	0x7a,
+	0x99,
+	0x79,
+	0x6a,
+	0x86,
+	0x1e,
+	0x88,
+	0x80,
+	0xc7,
+	0xa5,
+	0x1a,
+	0xa6,
+	0x1b,
+	0xc5,
+	0x1c,
+	0xd0,
+	0x12,
+	0xe4,
+	0x1d,
+	0xd0,
+	0x0e,
+	0xa5,
+	0x20,
+	0xa6,
+	0xb6,
+	0xd0,
+	0x04,
+	0xc6,
+	0xb5,
+	0x80,
+	0x22,
+	0xe6,
+	0xb4,
+	0x80,
+	0x1e,
+	0x0a,
+	0x08,
+	0x1a,
+	0x5a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x7a,
+	0x6a,
+	0x38,
+	0xe5,
+	0x1e,
+	0x99,
+	0x79,
+	0x6a,
+	0x28,
+	0x8a,
+	0x2a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x98,
+	0xa4,
+	0x1f,
+	0x99,
+	0x6f,
+	0x60,
+	0xa5,
+	0xb6,
+	0xd0,
+	0x0d,
+	0xa5,
+	0x16,
+	0xa4,
+	0xb4,
+	0xf0,
+	0x10,
+	0x38,
+	0xf9,
+	0xad,
+	0x6a,
+	0x3a,
+	0x80,
+	0x09,
+	0xa4,
+	0xb5,
+	0xb9,
+	0xae,
+	0x6a,
+	0x38,
+	0xe5,
+	0x18,
+	0x3a,
+	0xaa,
+	0xa9,
+	0x00,
+	0xa4,
+	0x10,
+	0x20,
+	0x9e,
+	0x0d,
+	0xa4,
+	0x1f,
+	0x99,
+	0x6b,
+	0x5f,
+	0x98,
+	0xd0,
+	0x12,
+	0xac,
+	0x6f,
+	0x60,
+	0x53,
+	0x6f,
+	0x5f,
+	0x97,
+	0x5f,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x79,
+	0x6a,
+	0x27,
+	0x60,
+	0x80,
+	0x10,
+	0xac,
+	0x70,
+	0x60,
+	0x53,
+	0x6f,
+	0x5f,
+	0xbf,
+	0x5f,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x79,
+	0x6a,
+	0x3b,
+	0x60,
+	0xa6,
+	0x1f,
+	0xad,
+	0x12,
+	0x5f,
+	0x9d,
+	0x73,
+	0x60,
+	0xad,
+	0xec,
+	0x5e,
+	0xa8,
+	0x29,
+	0x04,
+	0xf0,
+	0x03,
+	0xa9,
+	0x06,
+	0x60,
+	0x98,
+	0x29,
+	0x80,
+	0x9d,
+	0x27,
+	0x5f,
+	0x98,
+	0x29,
+	0x03,
+	0x9d,
+	0x29,
+	0x5f,
+	0xd0,
+	0x03,
+	0x9d,
+	0x27,
+	0x5f,
+	0xa0,
+	0x00,
+	0x29,
+	0x02,
+	0xf0,
+	0x01,
+	0xc8,
+	0x98,
+	0x9d,
+	0x2d,
+	0x5f,
+	0xad,
+	0x0f,
+	0x5f,
+	0xc9,
+	0x81,
+	0x90,
+	0x03,
+	0xa9,
+	0x1b,
+	0x60,
+	0x9d,
+	0x2f,
+	0x5f,
+	0xa9,
+	0xdf,
+	0x9d,
+	0x31,
+	0x5f,
+	0xa9,
+	0x03,
+	0x9d,
+	0x33,
+	0x5f,
+	0xad,
+	0xfd,
+	0x5e,
+	0xf0,
+	0x03,
+	0xa9,
+	0x12,
+	0x60,
+	0xad,
+	0xfc,
+	0x5e,
+	0xa8,
+	0x29,
+	0xf0,
+	0xd0,
+	0xf5,
+	0x98,
+	0x29,
+	0x01,
+	0xd0,
+	0x03,
+	0xa9,
+	0x14,
+	0x60,
+	0xad,
+	0xfb,
+	0x5e,
+	0xf0,
+	0x03,
+	0xa9,
+	0x1a,
+	0x60,
+	0xad,
+	0xfa,
+	0x5e,
+	0xa8,
+	0x29,
+	0xf0,
+	0xd0,
+	0xf5,
+	0x98,
+	0x29,
+	0x01,
+	0xd0,
+	0x03,
+	0xa9,
+	0x18,
+	0x60,
+	0x18,
+	0xad,
+	0xfc,
+	0x5e,
+	0x6d,
+	0xfa,
+	0x5e,
+	0x4a,
+	0xc9,
+	0x05,
+	0x90,
+	0x03,
+	0xa9,
+	0x16,
+	0x60,
+	0xa8,
+	0xb9,
+	0xa3,
+	0x59,
+	0xf0,
+	0xf7,
+	0x98,
+	0x85,
+	0x11,
+	0x9d,
+	0x37,
+	0x5f,
+	0xac,
+	0xf1,
+	0x5e,
+	0xae,
+	0xf0,
+	0x5e,
+	0x20,
+	0xf9,
+	0x06,
+	0xf0,
+	0x03,
+	0xa9,
+	0x08,
+	0x60,
+	0x98,
+	0x4a,
+	0x85,
+	0x17,
+	0x8a,
+	0x6a,
+	0x85,
+	0x16,
+	0x90,
+	0x03,
+	0xa9,
+	0x0c,
+	0x60,
+	0xac,
+	0xf5,
+	0x5e,
+	0xae,
+	0xf4,
+	0x5e,
+	0x20,
+	0xe8,
+	0x06,
+	0xf0,
+	0x03,
+	0xa9,
+	0x0a,
+	0x60,
+	0x98,
+	0x4a,
+	0x85,
+	0x19,
+	0x8a,
+	0x6a,
+	0x85,
+	0x18,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0e,
+	0x60,
+	0xe5,
+	0x16,
+	0x85,
+	0x1a,
+	0xa5,
+	0x19,
+	0xe5,
+	0x17,
+	0x85,
+	0x1b,
+	0x10,
+	0x03,
+	0xa9,
+	0x10,
+	0x60,
+	0xa0,
+	0x00,
+	0xb9,
+	0xd6,
+	0x6a,
+	0x38,
+	0xe5,
+	0x16,
+	0xb9,
+	0xe6,
+	0x6a,
+	0xe5,
+	0x17,
+	0x10,
+	0x03,
+	0xc8,
+	0x80,
+	0xf0,
+	0x84,
+	0xbe,
+	0xb9,
+	0xd6,
+	0x6a,
+	0x38,
+	0xe5,
+	0x18,
+	0xb9,
+	0xe6,
+	0x6a,
+	0xe5,
+	0x19,
+	0x10,
+	0x03,
+	0xc8,
+	0x80,
+	0xf0,
+	0x84,
+	0xbf,
+	0xa6,
+	0x1a,
+	0xa5,
+	0x1b,
+	0xa4,
+	0x11,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1a,
+	0x86,
+	0x1b,
+	0xa4,
+	0x1f,
+	0x99,
+	0x3f,
+	0x5f,
+	0x8a,
+	0x99,
+	0x41,
+	0x5f,
+	0xa9,
+	0xff,
+	0x85,
+	0x1e,
+	0x64,
+	0x20,
+	0xa5,
+	0xbd,
+	0xd0,
+	0x3b,
+	0xa4,
+	0xbe,
+	0xc4,
+	0xbf,
+	0xf0,
+	0x79,
+	0x5a,
+	0x38,
+	0xb9,
+	0xd6,
+	0x6a,
+	0xe5,
+	0x16,
+	0xaa,
+	0xb9,
+	0xe6,
+	0x6a,
+	0xe5,
+	0x17,
+	0xa4,
+	0x11,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1c,
+	0x86,
+	0x1d,
+	0x48,
+	0x0a,
+	0x1a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x8a,
+	0x2a,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x38,
+	0x68,
+	0xaa,
+	0xe5,
+	0x1e,
+	0x7a,
+	0x99,
+	0x8d,
+	0x6a,
+	0x86,
+	0x1e,
+	0xc8,
+	0x80,
+	0xc7,
+	0xa5,
+	0x18,
+	0xd0,
+	0x02,
+	0xc6,
+	0x19,
+	0x3a,
+	0x85,
+	0x18,
+	0xa4,
+	0xbf,
+	0xc4,
+	0xbe,
+	0xf0,
+	0x35,
+	0x5a,
+	0x38,
+	0xa5,
+	0x18,
+	0xf9,
+	0xd5,
+	0x6a,
+	0xaa,
+	0xa5,
+	0x19,
+	0xf9,
+	0xe5,
+	0x6a,
+	0xa4,
+	0x11,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0x1c,
+	0x86,
+	0x1d,
+	0x48,
+	0x0a,
+	0x1a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x8a,
+	0x2a,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x38,
+	0x68,
+	0xaa,
+	0xe5,
+	0x1e,
+	0x7a,
+	0x99,
+	0x8d,
+	0x6a,
+	0x86,
+	0x1e,
+	0x88,
+	0x80,
+	0xc7,
+	0xa5,
+	0x1a,
+	0xa6,
+	0x1b,
+	0xc5,
+	0x1c,
+	0xd0,
+	0x1a,
+	0xe4,
+	0x1d,
+	0xd0,
+	0x16,
+	0xa5,
+	0xbe,
+	0xc5,
+	0xbf,
+	0xf0,
+	0x0e,
+	0xa5,
+	0x20,
+	0xa6,
+	0xbd,
+	0xd0,
+	0x04,
+	0xc6,
+	0xbf,
+	0x80,
+	0x25,
+	0xe6,
+	0xbe,
+	0x80,
+	0x21,
+	0xa5,
+	0x1a,
+	0x0a,
+	0x08,
+	0x1a,
+	0x5a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x84,
+	0x20,
+	0x7a,
+	0x6a,
+	0x38,
+	0xe5,
+	0x1e,
+	0x99,
+	0x8d,
+	0x6a,
+	0x28,
+	0xa5,
+	0x1b,
+	0x2a,
+	0xa4,
+	0x20,
+	0x99,
+	0x6f,
+	0x5f,
+	0xc8,
+	0x98,
+	0xa4,
+	0x1f,
+	0x99,
+	0x71,
+	0x60,
+	0xa5,
+	0xbd,
+	0xd0,
+	0x0d,
+	0xa5,
+	0x16,
+	0xa4,
+	0xbe,
+	0xf0,
+	0x10,
+	0x38,
+	0xf9,
+	0xd5,
+	0x6a,
+	0x3a,
+	0x80,
+	0x09,
+	0xa4,
+	0xbf,
+	0xb9,
+	0xd6,
+	0x6a,
+	0x38,
+	0xe5,
+	0x18,
+	0x3a,
+	0xaa,
+	0xa9,
+	0x00,
+	0xa4,
+	0x11,
+	0x20,
+	0x9e,
+	0x0d,
+	0xa4,
+	0x1f,
+	0x99,
+	0x6d,
+	0x5f,
+	0x98,
+	0xd0,
+	0x12,
+	0xac,
+	0x71,
+	0x60,
+	0x53,
+	0x6f,
+	0x5f,
+	0xe7,
+	0x5f,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x8d,
+	0x6a,
+	0x4f,
+	0x60,
+	0x80,
+	0x10,
+	0xac,
+	0x72,
+	0x60,
+	0x53,
+	0x6f,
+	0x5f,
+	0x07,
+	0x60,
+	0x98,
+	0x4a,
+	0xa8,
+	0x53,
+	0x8d,
+	0x6a,
+	0x5f,
+	0x60,
+	0x38,
+	0xa5,
+	0xbf,
+	0xe5,
+	0xbe,
+	0x85,
+	0x1e,
+	0x1a,
+	0x85,
+	0xab,
+	0xa5,
+	0xbe,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x02,
+	0xa5,
+	0xbf,
+	0x85,
+	0xb9,
+	0x85,
+	0xaa,
+	0xa5,
+	0xbe,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x02,
+	0xa5,
+	0xbf,
+	0x49,
+	0x3c,
+	0x18,
+	0x69,
+	0x77,
+	0x85,
+	0xb7,
+	0x98,
+	0x69,
+	0x60,
+	0x85,
+	0xb8,
+	0xa5,
+	0xb4,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x02,
+	0xa5,
+	0xb5,
+	0x49,
+	0x03,
+	0x18,
+	0x65,
+	0xb7,
+	0x85,
+	0xb7,
+	0x98,
+	0x65,
+	0xb8,
+	0x85,
+	0xb8,
+	0xa0,
+	0x02,
+	0x53,
+	0xb7,
+	0x00,
+	0xac,
+	0x00,
+	0x53,
+	0xb7,
+	0x00,
+	0xb2,
+	0x00,
+	0x53,
+	0xb7,
+	0x00,
+	0xae,
+	0x00,
+	0xa5,
+	0x1e,
+	0xd0,
+	0x07,
+	0x53,
+	0xb7,
+	0x00,
+	0xb0,
+	0x00,
+	0x80,
+	0x20,
+	0xa5,
+	0xbd,
+	0xd0,
+	0x0f,
+	0x18,
+	0xa5,
+	0xb7,
+	0x69,
+	0x3c,
+	0x85,
+	0xb0,
+	0xa5,
+	0xb8,
+	0x69,
+	0x00,
+	0x85,
+	0xb1,
+	0x80,
+	0x0d,
+	0x38,
+	0xa5,
+	0xb7,
+	0xe9,
+	0x3c,
+	0x85,
+	0xb0,
+	0xa5,
+	0xb8,
+	0xe9,
+	0x00,
+	0x85,
+	0xb1,
+	0xa6,
+	0x1f,
+	0xbd,
+	0x29,
+	0x5f,
+	0x8d,
+	0x76,
+	0x60,
+	0xa9,
+	0x00,
+	0xaa,
+	0x20,
+	0xc5,
+	0x39,
+	0xa5,
+	0xab,
+	0xf0,
+	0x06,
+	0xa9,
+	0x01,
+	0xaa,
+	0x20,
+	0xc5,
+	0x39,
+	0x8a,
+	0xa6,
+	0x1f,
+	0x9d,
+	0x43,
+	0x5f,
+	0xa9,
+	0x01,
+	0x9d,
+	0x2b,
+	0x5f,
+	0xa5,
+	0xab,
+	0x9d,
+	0x45,
+	0x5f,
+	0xa5,
+	0xb7,
+	0x9d,
+	0x57,
+	0x5f,
+	0xa5,
+	0xb8,
+	0x9d,
+	0x59,
+	0x5f,
+	0xa5,
+	0xac,
+	0x9d,
+	0x5b,
+	0x5f,
+	0xa5,
+	0xad,
+	0x9d,
+	0x5d,
+	0x5f,
+	0xa5,
+	0xb2,
+	0x9d,
+	0x5f,
+	0x5f,
+	0xa5,
+	0xb3,
+	0x9d,
+	0x61,
+	0x5f,
+	0xa5,
+	0xae,
+	0x9d,
+	0x63,
+	0x5f,
+	0xa5,
+	0xaf,
+	0x9d,
+	0x65,
+	0x5f,
+	0xa5,
+	0xb0,
+	0x9d,
+	0x67,
+	0x5f,
+	0xa5,
+	0xb1,
+	0x9d,
+	0x69,
+	0x5f,
+	0xa5,
+	0xb4,
+	0x9d,
+	0x47,
+	0x5f,
+	0xa5,
+	0xb5,
+	0x9d,
+	0x49,
+	0x5f,
+	0xa5,
+	0xbe,
+	0x9d,
+	0x4b,
+	0x5f,
+	0xa5,
+	0xbf,
+	0x9d,
+	0x4d,
+	0x5f,
+	0xa5,
+	0xaa,
+	0x9d,
+	0x4f,
+	0x5f,
+	0xa5,
+	0xb9,
+	0x9d,
+	0x51,
+	0x5f,
+	0xa9,
+	0x00,
+	0x60,
+	0xc0,
+	0x01,
+	0xd0,
+	0x04,
+	0xa8,
+	0x8a,
+	0xfc,
+	0x60,
+	0x85,
+	0x12,
+	0x98,
+	0xc9,
+	0x01,
+	0xf0,
+	0x0e,
+	0x29,
+	0x01,
+	0xd0,
+	0x0e,
+	0x46,
+	0x12,
+	0x8a,
+	0x6a,
+	0xaa,
+	0x98,
+	0x4a,
+	0xa8,
+	0x80,
+	0xee,
+	0x8a,
+	0xa6,
+	0x12,
+	0x60,
+	0x8a,
+	0x1a,
+	0xd0,
+	0x02,
+	0xe6,
+	0x12,
+	0x49,
+	0x55,
+	0x84,
+	0x14,
+	0x18,
+	0x65,
+	0x14,
+	0x85,
+	0x13,
+	0x90,
+	0x03,
+	0xe6,
+	0x14,
+	0x18,
+	0xa5,
+	0x12,
+	0x49,
+	0x55,
+	0x84,
+	0x15,
+	0xaa,
+	0x65,
+	0x13,
+	0x8a,
+	0x65,
+	0x14,
+	0x85,
+	0x14,
+	0xa5,
+	0x15,
+	0x90,
+	0x03,
+	0xe6,
+	0x15,
+	0x18,
+	0x65,
+	0x14,
+	0xa6,
+	0x15,
+	0x90,
+	0x01,
+	0xe8,
+	0x60,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0xc0,
+	0x4c,
+	0x00,
+	0x03,
+	0x08,
+	0x68,
+	0x8d,
+	0x16,
+	0x6b,
+	0x64,
+	0x25,
+	0x80,
+	0x06,
+	0xa5,
+	0x25,
+	0xc9,
+	0x01,
+	0xf0,
+	0x03,
+	0x5c,
+	0x80,
+	0xf7,
+	0x20,
+	0xa5,
+	0x0e,
+	0xa5,
+	0x24,
+	0xd0,
+	0x03,
+	0x5c,
+	0x80,
+	0xf9,
+	0xc6,
+	0x24,
+	0xa5,
+	0x60,
+	0x85,
+	0x67,
+	0x20,
+	0x22,
+	0x1d,
+	0xa5,
+	0x60,
+	0xa6,
+	0x23,
+	0xf0,
+	0x07,
+	0xc5,
+	0x27,
+	0xf0,
+	0x0d,
+	0x1a,
+	0x80,
+	0x05,
+	0xc5,
+	0x26,
+	0xf0,
+	0x06,
+	0x3a,
+	0x85,
+	0x67,
+	0x20,
+	0x53,
+	0x1f,
+	0xa5,
+	0x27,
+	0xa6,
+	0x23,
+	0xf0,
+	0x02,
+	0xa5,
+	0x26,
+	0xc5,
+	0x60,
+	0xf0,
+	0x0b,
+	0x8a,
+	0xf0,
+	0x04,
+	0xc6,
+	0x60,
+	0x80,
+	0xc6,
+	0xe6,
+	0x60,
+	0x80,
+	0xc2,
+	0x85,
+	0x67,
+	0x20,
+	0x53,
+	0x1f,
+	0x20,
+	0xd3,
+	0x29,
+	0x80,
+	0xac,
+	0x18,
+	0x69,
+	0x14,
+	0x90,
+	0x01,
+	0xc8,
+	0xda,
+	0x85,
+	0x32,
+	0x84,
+	0x33,
+	0x49,
+	0x66,
+	0x84,
+	0x34,
+	0xa5,
+	0x33,
+	0x49,
+	0x66,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x35,
+	0xa5,
+	0x32,
+	0x49,
+	0x06,
+	0x18,
+	0x65,
+	0x34,
+	0xaa,
+	0x98,
+	0x65,
+	0x35,
+	0x85,
+	0x35,
+	0xa5,
+	0x33,
+	0x49,
+	0x06,
+	0x18,
+	0x65,
+	0x35,
+	0xe0,
+	0xfa,
+	0x90,
+	0x01,
+	0x1a,
+	0xfa,
+	0x60,
+	0x18,
+	0x69,
+	0x10,
+	0x90,
+	0x01,
+	0xc8,
+	0x84,
+	0x32,
+	0x46,
+	0x32,
+	0x6a,
+	0x46,
+	0x32,
+	0x6a,
+	0x46,
+	0x32,
+	0x6a,
+	0x46,
+	0x32,
+	0x6a,
+	0x46,
+	0x32,
+	0x6a,
+	0x60,
+	0xa0,
+	0x12,
+	0x64,
+	0x6e,
+	0x64,
+	0x6f,
+	0x64,
+	0x70,
+	0x64,
+	0x71,
+	0x13,
+	0x6e,
+	0x00,
+	0xc3,
+	0x80,
+	0x64,
+	0x72,
+	0x64,
+	0x73,
+	0xa0,
+	0x48,
+	0x13,
+	0x6e,
+	0x00,
+	0xd5,
+	0x80,
+	0x13,
+	0x6e,
+	0x00,
+	0x1d,
+	0x81,
+	0x13,
+	0x6e,
+	0x00,
+	0x65,
+	0x81,
+	0xad,
+	0x19,
+	0x6b,
+	0xae,
+	0x18,
+	0x6b,
+	0xd0,
+	0x05,
+	0xcd,
+	0x1a,
+	0x6b,
+	0xf0,
+	0x0f,
+	0x20,
+	0xa7,
+	0x0f,
+	0x20,
+	0x92,
+	0x10,
+	0xad,
+	0x19,
+	0x6b,
+	0x8d,
+	0x1a,
+	0x6b,
+	0x9c,
+	0x18,
+	0x6b,
+	0xa6,
+	0x26,
+	0x9e,
+	0x79,
+	0x74,
+	0x9e,
+	0x8b,
+	0x74,
+	0xa9,
+	0x00,
+	0xa8,
+	0xe4,
+	0x27,
+	0xf0,
+	0x19,
+	0x9d,
+	0x7a,
+	0x74,
+	0x48,
+	0x98,
+	0x9d,
+	0x8c,
+	0x74,
+	0x68,
+	0xc9,
+	0x28,
+	0xf0,
+	0x06,
+	0x18,
+	0x69,
+	0x14,
+	0xc8,
+	0x80,
+	0x03,
+	0xa9,
+	0x00,
+	0xa8,
+	0xe8,
+	0x80,
+	0xe3,
+	0x9d,
+	0x7a,
+	0x74,
+	0x9d,
+	0x7b,
+	0x74,
+	0x98,
+	0x9d,
+	0x8c,
+	0x74,
+	0x9d,
+	0x8d,
+	0x74,
+	0x38,
+	0xa5,
+	0x29,
+	0xe5,
+	0x28,
+	0xaa,
+	0x1a,
+	0x85,
+	0x2e,
+	0xbd,
+	0xa8,
+	0x59,
+	0x85,
+	0x2c,
+	0xa2,
+	0x00,
+	0x8a,
+	0x0a,
+	0x1a,
+	0x45,
+	0x2e,
+	0x20,
+	0x5b,
+	0x0e,
+	0x9d,
+	0x1b,
+	0x7d,
+	0xe8,
+	0xe0,
+	0x14,
+	0x90,
+	0xf0,
+	0xa2,
+	0x00,
+	0xbd,
+	0x1b,
+	0x7d,
+	0xdd,
+	0x1c,
+	0x7d,
+	0xd0,
+	0x05,
+	0x09,
+	0x80,
+	0x9d,
+	0x1b,
+	0x7d,
+	0xe8,
+	0xe0,
+	0x13,
+	0x90,
+	0xee,
+	0x38,
+	0xa5,
+	0x27,
+	0xe5,
+	0x26,
+	0xaa,
+	0x1a,
+	0x85,
+	0x2e,
+	0xbd,
+	0xbc,
+	0x59,
+	0x85,
+	0x2d,
+	0xa2,
+	0x00,
+	0x8a,
+	0x0a,
+	0x1a,
+	0x45,
+	0x2e,
+	0x20,
+	0x93,
+	0x0e,
+	0x9d,
+	0x2f,
+	0x7d,
+	0xe8,
+	0xe0,
+	0x10,
+	0x90,
+	0xf0,
+	0xa5,
+	0x23,
+	0xf0,
+	0x14,
+	0xa2,
+	0x0f,
+	0xbd,
+	0x2f,
+	0x7d,
+	0xdd,
+	0x2e,
+	0x7d,
+	0xd0,
+	0x05,
+	0x09,
+	0x80,
+	0x9d,
+	0x2f,
+	0x7d,
+	0xca,
+	0xd0,
+	0xf0,
+	0x80,
+	0x14,
+	0xa2,
+	0x00,
+	0xbd,
+	0x2f,
+	0x7d,
+	0xdd,
+	0x30,
+	0x7d,
+	0xd0,
+	0x05,
+	0x09,
+	0x80,
+	0x9d,
+	0x2f,
+	0x7d,
+	0xe8,
+	0xe0,
+	0x0f,
+	0x90,
+	0xee,
+	0xa9,
+	0x00,
+	0xa6,
+	0x23,
+	0xf0,
+	0x02,
+	0xa9,
+	0x0f,
+	0x85,
+	0x8a,
+	0xe6,
+	0x25,
+	0x60,
+	0x85,
+	0x2e,
+	0xa9,
+	0x39,
+	0x85,
+	0x4a,
+	0xa9,
+	0xbe,
+	0x85,
+	0x4b,
+	0xa2,
+	0x00,
+	0xa0,
+	0x5a,
+	0xa5,
+	0x2e,
+	0xd1,
+	0x4a,
+	0x90,
+	0x19,
+	0xe0,
+	0x04,
+	0xf0,
+	0x0e,
+	0xe8,
+	0x18,
+	0xa5,
+	0x4a,
+	0x69,
+	0x5b,
+	0x85,
+	0x4a,
+	0x90,
+	0xec,
+	0xe6,
+	0x4b,
+	0x80,
+	0xe8,
+	0xa0,
+	0x5a,
+	0xd3,
+	0x4a,
+	0x1f,
+	0x6b,
+	0x60,
+	0x8a,
+	0xf0,
+	0xf6,
+	0xb1,
+	0x4a,
+	0x85,
+	0x30,
+	0x38,
+	0xa5,
+	0x4a,
+	0xe9,
+	0x5b,
+	0x85,
+	0x4c,
+	0xa5,
+	0x4b,
+	0xe9,
+	0x00,
+	0x85,
+	0x4d,
+	0xb1,
+	0x4c,
+	0x85,
+	0x2f,
+	0xc5,
+	0x2e,
+	0xd0,
+	0x07,
+	0xa0,
+	0x5a,
+	0xd3,
+	0x4c,
+	0x1f,
+	0x6b,
+	0x60,
+	0x38,
+	0xa5,
+	0x30,
+	0xe5,
+	0x2e,
+	0x85,
+	0x33,
+	0x64,
+	0x32,
+	0x38,
+	0xa5,
+	0x30,
+	0xe5,
+	0x2f,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0x20,
+	0x0b,
+	0x39,
+	0xa5,
+	0x32,
+	0x85,
+	0x2e,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x2e,
+	0x85,
+	0x2f,
+	0xa9,
+	0x06,
+	0x85,
+	0x34,
+	0xa2,
+	0x00,
+	0x64,
+	0x35,
+	0xdc,
+	0xb1,
+	0x4c,
+	0x85,
+	0x30,
+	0xb1,
+	0x4a,
+	0x10,
+	0x20,
+	0xa4,
+	0x35,
+	0xf0,
+	0x1c,
+	0x85,
+	0x31,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x31,
+	0x45,
+	0x2f,
+	0x85,
+	0x31,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x31,
+	0x85,
+	0x32,
+	0x84,
+	0x31,
+	0xa9,
+	0x00,
+	0xe5,
+	0x31,
+	0x85,
+	0x33,
+	0x80,
+	0x06,
+	0x45,
+	0x2f,
+	0x85,
+	0x32,
+	0x84,
+	0x33,
+	0xa5,
+	0x30,
+	0x10,
+	0x1e,
+	0xa4,
+	0x35,
+	0xf0,
+	0x1a,
+	0x85,
+	0x31,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x31,
+	0x45,
+	0x2e,
+	0x85,
+	0x31,
+	0x38,
+	0xa5,
+	0x32,
+	0xe5,
+	0x31,
+	0x85,
+	0x32,
+	0x84,
+	0x31,
+	0xa5,
+	0x33,
+	0xe5,
+	0x31,
+	0x80,
+	0x0a,
+	0x45,
+	0x2e,
+	0x18,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x65,
+	0x33,
+	0xa8,
+	0xa5,
+	0x32,
+	0x10,
+	0x01,
+	0xc8,
+	0x98,
+	0x9d,
+	0x1f,
+	0x6b,
+	0xe8,
+	0xe6,
+	0x35,
+	0xa5,
+	0x35,
+	0xc9,
+	0x0f,
+	0xd0,
+	0x92,
+	0xc6,
+	0x34,
+	0xd0,
+	0x8c,
+	0x60,
+	0xa9,
+	0x9d,
+	0x85,
+	0x4a,
+	0xa9,
+	0x74,
+	0x85,
+	0x4b,
+	0xa9,
+	0xdc,
+	0x85,
+	0x4c,
+	0xa9,
+	0x3f,
+	0x85,
+	0x4d,
+	0x64,
+	0x38,
+	0xa0,
+	0x11,
+	0x13,
+	0x38,
+	0x00,
+	0x39,
+	0x00,
+	0xa9,
+	0x11,
+	0x85,
+	0x30,
+	0xa9,
+	0x15,
+	0x85,
+	0x31,
+	0xa0,
+	0x0e,
+	0xd3,
+	0x4c,
+	0x50,
+	0x00,
+	0x64,
+	0x4e,
+	0xa2,
+	0x00,
+	0xa9,
+	0x06,
+	0x85,
+	0x2e,
+	0x18,
+	0xbd,
+	0x20,
+	0x6b,
+	0x3c,
+	0x45,
+	0x50,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x09,
+	0x7d,
+	0x1f,
+	0x6b,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x80,
+	0x07,
+	0x7d,
+	0x1f,
+	0x6b,
+	0x85,
+	0x33,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0x85,
+	0x34,
+	0x18,
+	0xbd,
+	0x21,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x51,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x22,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x52,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x23,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x53,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x24,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x54,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x25,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x55,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x26,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x56,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x27,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x57,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x28,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x58,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x29,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x59,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x2a,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x5a,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x2b,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x5b,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x2c,
+	0x6b,
+	0xf0,
+	0x20,
+	0x3c,
+	0x45,
+	0x5c,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x0d,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x18,
+	0x80,
+	0x09,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0x34,
+	0xbd,
+	0x2d,
+	0x6b,
+	0x3c,
+	0x45,
+	0x5d,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x10,
+	0x08,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0xff,
+	0x80,
+	0x06,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0xa9,
+	0x00,
+	0x65,
+	0x34,
+	0xf0,
+	0x0a,
+	0x10,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x0e,
+	0xa9,
+	0xff,
+	0x80,
+	0x0a,
+	0xa5,
+	0x33,
+	0xa4,
+	0x32,
+	0x10,
+	0x04,
+	0x1a,
+	0xd0,
+	0x01,
+	0x3a,
+	0x92,
+	0x4a,
+	0xda,
+	0xa6,
+	0x4e,
+	0x18,
+	0x75,
+	0x38,
+	0x95,
+	0x38,
+	0x90,
+	0x07,
+	0x18,
+	0xf6,
+	0x39,
+	0xd0,
+	0x02,
+	0xf6,
+	0x3a,
+	0xe8,
+	0xe8,
+	0xe8,
+	0x86,
+	0x4e,
+	0xe6,
+	0x4a,
+	0xd0,
+	0x02,
+	0xe6,
+	0x4b,
+	0x68,
+	0x69,
+	0x0f,
+	0xaa,
+	0xc6,
+	0x2e,
+	0xf0,
+	0x03,
+	0x4c,
+	0xc2,
+	0x10,
+	0xa5,
+	0x4c,
+	0x69,
+	0x0e,
+	0x85,
+	0x4c,
+	0x90,
+	0x02,
+	0xe6,
+	0x4d,
+	0xc6,
+	0x31,
+	0xf0,
+	0x03,
+	0x4c,
+	0xb3,
+	0x10,
+	0xc6,
+	0x30,
+	0xf0,
+	0x03,
+	0x4c,
+	0xaf,
+	0x10,
+	0x64,
+	0x2e,
+	0xa5,
+	0x2e,
+	0x49,
+	0x09,
+	0xa8,
+	0xa2,
+	0x00,
+	0xa9,
+	0x03,
+	0x85,
+	0x2f,
+	0xb9,
+	0x38,
+	0x00,
+	0x0a,
+	0x48,
+	0xb9,
+	0x39,
+	0x00,
+	0x2a,
+	0x95,
+	0x50,
+	0xb9,
+	0x3a,
+	0x00,
+	0x2a,
+	0x95,
+	0x51,
+	0x68,
+	0x0a,
+	0x90,
+	0x06,
+	0xf6,
+	0x50,
+	0xd0,
+	0x02,
+	0xf6,
+	0x51,
+	0xc8,
+	0xc8,
+	0xc8,
+	0xe8,
+	0xe8,
+	0xc6,
+	0x2f,
+	0xd0,
+	0xdc,
+	0xa0,
+	0x00,
+	0x38,
+	0xa5,
+	0x50,
+	0xe5,
+	0x52,
+	0x85,
+	0x2f,
+	0xa5,
+	0x51,
+	0xe5,
+	0x53,
+	0x08,
+	0x05,
+	0x2f,
+	0x85,
+	0x2f,
+	0xd0,
+	0x01,
+	0xc8,
+	0x38,
+	0xa5,
+	0x52,
+	0xe5,
+	0x54,
+	0x85,
+	0x30,
+	0xa5,
+	0x53,
+	0xe5,
+	0x55,
+	0x08,
+	0x05,
+	0x30,
+	0x85,
+	0x30,
+	0xd0,
+	0x01,
+	0xc8,
+	0x38,
+	0xa5,
+	0x54,
+	0xe5,
+	0x50,
+	0x85,
+	0x31,
+	0xa5,
+	0x55,
+	0xe5,
+	0x51,
+	0x08,
+	0x05,
+	0x31,
+	0x85,
+	0x31,
+	0xd0,
+	0x01,
+	0xc8,
+	0xa6,
+	0x2e,
+	0x98,
+	0x95,
+	0xdc,
+	0xa9,
+	0x00,
+	0xa8,
+	0x28,
+	0xb0,
+	0x03,
+	0x69,
+	0x04,
+	0xc8,
+	0x28,
+	0xb0,
+	0x03,
+	0x1a,
+	0x1a,
+	0xc8,
+	0x28,
+	0xb0,
+	0x02,
+	0x1a,
+	0xc8,
+	0xc0,
+	0x01,
+	0xd0,
+	0x26,
+	0xc9,
+	0x01,
+	0xd0,
+	0x08,
+	0xa4,
+	0x30,
+	0xd0,
+	0x1e,
+	0xa9,
+	0x00,
+	0x80,
+	0x1a,
+	0xc9,
+	0x02,
+	0xd0,
+	0x08,
+	0xa4,
+	0x2f,
+	0xd0,
+	0x12,
+	0xa9,
+	0x00,
+	0x80,
+	0x0e,
+	0xa4,
+	0x2f,
+	0xd0,
+	0x04,
+	0xa9,
+	0x05,
+	0x80,
+	0x06,
+	0xa4,
+	0x30,
+	0xd0,
+	0x02,
+	0xa9,
+	0x06,
+	0x49,
+	0x03,
+	0xa8,
+	0xb9,
+	0xa3,
+	0x3f,
+	0x85,
+	0x5d,
+	0xb9,
+	0xa4,
+	0x3f,
+	0x85,
+	0x5e,
+	0xb9,
+	0xa5,
+	0x3f,
+	0x85,
+	0x5f,
+	0xa6,
+	0x5e,
+	0xa4,
+	0x5d,
+	0x98,
+	0x0a,
+	0xa8,
+	0xb9,
+	0x50,
+	0x00,
+	0x85,
+	0x32,
+	0xb9,
+	0x51,
+	0x00,
+	0x85,
+	0x33,
+	0xa5,
+	0x2e,
+	0x49,
+	0x06,
+	0xaa,
+	0xa0,
+	0x00,
+	0x38,
+	0xb9,
+	0x50,
+	0x00,
+	0xe5,
+	0x32,
+	0x9d,
+	0xfb,
+	0x7c,
+	0xb9,
+	0x51,
+	0x00,
+	0xe5,
+	0x33,
+	0x9d,
+	0xfc,
+	0x7c,
+	0xe8,
+	0xe8,
+	0xc8,
+	0xc8,
+	0xc0,
+	0x06,
+	0xd0,
+	0xe7,
+	0xa5,
+	0x2e,
+	0x49,
+	0x03,
+	0xaa,
+	0xa5,
+	0x5d,
+	0x9d,
+	0x07,
+	0x7d,
+	0xa5,
+	0x5e,
+	0x9d,
+	0x08,
+	0x7d,
+	0xa5,
+	0x5f,
+	0x9d,
+	0x09,
+	0x7d,
+	0xa5,
+	0x2e,
+	0x49,
+	0x06,
+	0xa8,
+	0x18,
+	0x65,
+	0x5f,
+	0x65,
+	0x5f,
+	0xaa,
+	0xbd,
+	0xfc,
+	0x7c,
+	0x85,
+	0x6b,
+	0xbd,
+	0xfb,
+	0x7c,
+	0x85,
+	0x6a,
+	0x98,
+	0x18,
+	0x65,
+	0x5e,
+	0x65,
+	0x5e,
+	0xaa,
+	0xbd,
+	0xfc,
+	0x7c,
+	0x85,
+	0x69,
+	0xbd,
+	0xfb,
+	0x7c,
+	0x85,
+	0x68,
+	0x49,
+	0x10,
+	0x85,
+	0x32,
+	0x84,
+	0x33,
+	0x18,
+	0xa5,
+	0x69,
+	0x49,
+	0x10,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x38,
+	0xa5,
+	0x6a,
+	0xe5,
+	0x68,
+	0x85,
+	0x34,
+	0xa5,
+	0x6b,
+	0xe5,
+	0x69,
+	0x85,
+	0x35,
+	0x20,
+	0x2f,
+	0x39,
+	0xa0,
+	0x02,
+	0x53,
+	0x32,
+	0x00,
+	0x56,
+	0x00,
+	0x18,
+	0xa5,
+	0x68,
+	0x65,
+	0x6a,
+	0x85,
+	0x58,
+	0xa5,
+	0x69,
+	0x65,
+	0x6b,
+	0x85,
+	0x59,
+	0xa5,
+	0x56,
+	0x45,
+	0x68,
+	0x85,
+	0x5a,
+	0x84,
+	0x5b,
+	0xa5,
+	0x57,
+	0x45,
+	0x68,
+	0x18,
+	0x65,
+	0x5b,
+	0x85,
+	0x5b,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x5c,
+	0xa5,
+	0x56,
+	0x45,
+	0x69,
+	0x18,
+	0x65,
+	0x5b,
+	0x85,
+	0x5b,
+	0x98,
+	0x65,
+	0x5c,
+	0x85,
+	0x5c,
+	0xa5,
+	0x57,
+	0x45,
+	0x69,
+	0x18,
+	0x65,
+	0x5c,
+	0x85,
+	0x5c,
+	0xa5,
+	0x2e,
+	0x49,
+	0x07,
+	0x18,
+	0x69,
+	0x0d,
+	0x85,
+	0x4c,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x4d,
+	0xa0,
+	0x07,
+	0x73,
+	0x56,
+	0x00,
+	0x4c,
+	0xa5,
+	0x2e,
+	0x1a,
+	0xc9,
+	0x02,
+	0xf0,
+	0x05,
+	0x85,
+	0x2e,
+	0x4c,
+	0x14,
+	0x13,
+	0x60,
+	0xa2,
+	0x00,
+	0xa8,
+	0x30,
+	0x04,
+	0xe8,
+	0x0a,
+	0x10,
+	0xfc,
+	0xbd,
+	0xb8,
+	0x3f,
+	0xaa,
+	0x60,
+	0xa5,
+	0x9a,
+	0x05,
+	0x9e,
+	0x05,
+	0xa2,
+	0x05,
+	0xa6,
+	0xf0,
+	0x33,
+	0x20,
+	0xc0,
+	0x14,
+	0x45,
+	0x99,
+	0x84,
+	0xea,
+	0x8a,
+	0x45,
+	0x9a,
+	0x05,
+	0xea,
+	0x85,
+	0xea,
+	0x8a,
+	0x45,
+	0x9d,
+	0x84,
+	0xeb,
+	0x8a,
+	0x45,
+	0x9e,
+	0x05,
+	0xeb,
+	0x85,
+	0xeb,
+	0x8a,
+	0x45,
+	0xa1,
+	0x84,
+	0xec,
+	0x8a,
+	0x45,
+	0xa2,
+	0x05,
+	0xec,
+	0x85,
+	0xec,
+	0x8a,
+	0x45,
+	0xa5,
+	0x84,
+	0xed,
+	0x8a,
+	0x45,
+	0xa6,
+	0x05,
+	0xed,
+	0x85,
+	0xed,
+	0x60,
+	0xa5,
+	0x99,
+	0x05,
+	0x9d,
+	0x05,
+	0xa1,
+	0x05,
+	0xa5,
+	0xf0,
+	0x33,
+	0x20,
+	0xc0,
+	0x14,
+	0x45,
+	0x98,
+	0x84,
+	0xea,
+	0x8a,
+	0x45,
+	0x99,
+	0x05,
+	0xea,
+	0x85,
+	0xea,
+	0x8a,
+	0x45,
+	0x9c,
+	0x84,
+	0xeb,
+	0x8a,
+	0x45,
+	0x9d,
+	0x05,
+	0xeb,
+	0x85,
+	0xeb,
+	0x8a,
+	0x45,
+	0xa0,
+	0x84,
+	0xec,
+	0x8a,
+	0x45,
+	0xa1,
+	0x05,
+	0xec,
+	0x85,
+	0xec,
+	0x8a,
+	0x45,
+	0xa4,
+	0x84,
+	0xed,
+	0x8a,
+	0x45,
+	0xa5,
+	0x05,
+	0xed,
+	0x85,
+	0xed,
+	0x60,
+	0xa5,
+	0x98,
+	0x85,
+	0xea,
+	0xa5,
+	0x9c,
+	0x85,
+	0xeb,
+	0xa5,
+	0xa0,
+	0x85,
+	0xec,
+	0xa5,
+	0xa4,
+	0x85,
+	0xed,
+	0x60,
+	0xaa,
+	0x45,
+	0xc8,
+	0x84,
+	0xcb,
+	0x8a,
+	0x45,
+	0xc9,
+	0x18,
+	0x65,
+	0xcb,
+	0x90,
+	0x01,
+	0xc8,
+	0x84,
+	0xe7,
+	0x8a,
+	0x45,
+	0xcc,
+	0x84,
+	0xcf,
+	0x8a,
+	0x45,
+	0xcd,
+	0x18,
+	0x65,
+	0xcf,
+	0x90,
+	0x01,
+	0xc8,
+	0x98,
+	0x0a,
+	0x0a,
+	0x0a,
+	0x85,
+	0xe8,
+	0x8a,
+	0x45,
+	0xc4,
+	0x84,
+	0xc7,
+	0x8a,
+	0x45,
+	0xc5,
+	0x18,
+	0x65,
+	0xc7,
+	0x90,
+	0x02,
+	0x18,
+	0xc8,
+	0x85,
+	0xc4,
+	0x84,
+	0xc5,
+	0x8a,
+	0x45,
+	0xc6,
+	0x65,
+	0xc5,
+	0x85,
+	0xc5,
+	0x8a,
+	0x45,
+	0xd0,
+	0x84,
+	0xd3,
+	0x8a,
+	0x45,
+	0xd1,
+	0x18,
+	0x65,
+	0xd3,
+	0x90,
+	0x02,
+	0x18,
+	0xc8,
+	0x85,
+	0xd0,
+	0x84,
+	0xd1,
+	0x8a,
+	0x45,
+	0xd2,
+	0x65,
+	0xd1,
+	0x85,
+	0xd1,
+	0x18,
+	0xa5,
+	0xc4,
+	0x65,
+	0xd0,
+	0xa5,
+	0xc5,
+	0x65,
+	0xd1,
+	0x6a,
+	0xa8,
+	0x90,
+	0x04,
+	0x1a,
+	0xd0,
+	0x01,
+	0x3a,
+	0x85,
+	0xe9,
+	0x98,
+	0x4a,
+	0x4a,
+	0x49,
+	0x20,
+	0x05,
+	0xe7,
+	0x85,
+	0xe7,
+	0x98,
+	0x05,
+	0xe8,
+	0x85,
+	0xe8,
+	0x38,
+	0xa5,
+	0xc4,
+	0xe5,
+	0xd0,
+	0xaa,
+	0xa5,
+	0xc5,
+	0xe5,
+	0xd1,
+	0xb0,
+	0x52,
+	0x38,
+	0xa5,
+	0xd0,
+	0xe5,
+	0xc4,
+	0x85,
+	0xca,
+	0xa5,
+	0xd1,
+	0xe5,
+	0xc5,
+	0x85,
+	0xcb,
+	0xa4,
+	0xe9,
+	0xb9,
+	0xcc,
+	0x59,
+	0xaa,
+	0x45,
+	0xca,
+	0x84,
+	0xc4,
+	0x8a,
+	0x45,
+	0xcb,
+	0x18,
+	0x65,
+	0xc4,
+	0x85,
+	0xc4,
+	0x98,
+	0x69,
+	0x00,
+	0xa4,
+	0xe9,
+	0xbe,
+	0xcc,
+	0x5a,
+	0xf0,
+	0x14,
+	0x85,
+	0xc5,
+	0x8a,
+	0x45,
+	0xca,
+	0x18,
+	0x65,
+	0xc4,
+	0x85,
+	0xc4,
+	0x98,
+	0x65,
+	0xc5,
+	0x85,
+	0xc5,
+	0x8a,
+	0x45,
+	0xcb,
+	0x65,
+	0xc5,
+	0xa6,
+	0xc4,
+	0x10,
+	0x01,
+	0x1a,
+	0xc9,
+	0x27,
+	0x90,
+	0x02,
+	0xa9,
+	0x26,
+	0x85,
+	0xe6,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0xe6,
+	0x85,
+	0xe6,
+	0x60,
+	0x86,
+	0xca,
+	0x85,
+	0xcb,
+	0xa4,
+	0xe9,
+	0xb9,
+	0xcc,
+	0x59,
+	0xaa,
+	0x45,
+	0xca,
+	0x84,
+	0xc4,
+	0x8a,
+	0x45,
+	0xcb,
+	0x18,
+	0x65,
+	0xc4,
+	0x85,
+	0xc4,
+	0x98,
+	0x69,
+	0x00,
+	0xa4,
+	0xe9,
+	0xbe,
+	0xcc,
+	0x5a,
+	0xf0,
+	0x14,
+	0x85,
+	0xc5,
+	0x8a,
+	0x45,
+	0xca,
+	0x18,
+	0x65,
+	0xc4,
+	0x85,
+	0xc4,
+	0x98,
+	0x65,
+	0xc5,
+	0x85,
+	0xc5,
+	0x8a,
+	0x45,
+	0xcb,
+	0x65,
+	0xc5,
+	0xa6,
+	0xc4,
+	0x10,
+	0x01,
+	0x1a,
+	0xc9,
+	0x27,
+	0x90,
+	0x02,
+	0xa9,
+	0x26,
+	0x85,
+	0xe6,
+	0x60,
+	0xa5,
+	0xc4,
+	0x0a,
+	0xa5,
+	0xc5,
+	0x2a,
+	0x85,
+	0xc4,
+	0xa5,
+	0xc6,
+	0x2a,
+	0x85,
+	0xc5,
+	0xa5,
+	0xc7,
+	0x2a,
+	0x85,
+	0xc6,
+	0xa5,
+	0xc9,
+	0x4a,
+	0x4a,
+	0x85,
+	0xc8,
+	0xa5,
+	0xca,
+	0x49,
+	0x40,
+	0x05,
+	0xc8,
+	0x85,
+	0xc8,
+	0x84,
+	0xc9,
+	0xa5,
+	0xcb,
+	0x49,
+	0x40,
+	0x05,
+	0xc9,
+	0x85,
+	0xc9,
+	0x84,
+	0xca,
+	0xa5,
+	0xcd,
+	0x4a,
+	0x4a,
+	0x85,
+	0xcc,
+	0xa5,
+	0xce,
+	0x49,
+	0x40,
+	0x05,
+	0xcc,
+	0x85,
+	0xcc,
+	0x84,
+	0xcd,
+	0xa5,
+	0xcf,
+	0x49,
+	0x40,
+	0x05,
+	0xcd,
+	0x85,
+	0xcd,
+	0x84,
+	0xce,
+	0xa5,
+	0xd0,
+	0x0a,
+	0xa5,
+	0xd1,
+	0x2a,
+	0x85,
+	0xd0,
+	0xa5,
+	0xd2,
+	0x2a,
+	0x85,
+	0xd1,
+	0xa5,
+	0xd3,
+	0x2a,
+	0x85,
+	0xd2,
+	0x60,
+	0xa5,
+	0xc4,
+	0x49,
+	0x04,
+	0x84,
+	0xc4,
+	0xa5,
+	0xc5,
+	0x49,
+	0x04,
+	0x05,
+	0xc4,
+	0x85,
+	0xc4,
+	0x84,
+	0xc5,
+	0xa5,
+	0xc6,
+	0x49,
+	0x04,
+	0x05,
+	0xc5,
+	0x85,
+	0xc5,
+	0x84,
+	0xc6,
+	0xa5,
+	0xc9,
+	0x4a,
+	0x85,
+	0xc8,
+	0xa5,
+	0xca,
+	0x49,
+	0x80,
+	0x05,
+	0xc8,
+	0x85,
+	0xc8,
+	0x84,
+	0xc9,
+	0xa5,
+	0xcb,
+	0x49,
+	0x80,
+	0x05,
+	0xc9,
+	0x85,
+	0xc9,
+	0x84,
+	0xca,
+	0xa5,
+	0xcd,
+	0x4a,
+	0x85,
+	0xcc,
+	0xa5,
+	0xce,
+	0x49,
+	0x80,
+	0x05,
+	0xcc,
+	0x85,
+	0xcc,
+	0x84,
+	0xcd,
+	0xa5,
+	0xcf,
+	0x49,
+	0x80,
+	0x05,
+	0xcd,
+	0x85,
+	0xcd,
+	0x84,
+	0xce,
+	0xa5,
+	0xd0,
+	0x49,
+	0x04,
+	0x84,
+	0xd0,
+	0xa5,
+	0xd1,
+	0x49,
+	0x04,
+	0x05,
+	0xd0,
+	0x85,
+	0xd0,
+	0x84,
+	0xd1,
+	0xa5,
+	0xd2,
+	0x49,
+	0x04,
+	0x05,
+	0xd1,
+	0x85,
+	0xd1,
+	0x84,
+	0xd2,
+	0x60,
+	0xa5,
+	0xc4,
+	0x49,
+	0x08,
+	0x84,
+	0xc4,
+	0xa5,
+	0xc5,
+	0x49,
+	0x08,
+	0x05,
+	0xc4,
+	0x85,
+	0xc4,
+	0x84,
+	0xc5,
+	0xa5,
+	0xc6,
+	0x49,
+	0x08,
+	0x05,
+	0xc5,
+	0x85,
+	0xc5,
+	0x84,
+	0xc6,
+	0xa5,
+	0xc9,
+	0x85,
+	0xc8,
+	0xa5,
+	0xca,
+	0x85,
+	0xc9,
+	0xa5,
+	0xcb,
+	0x85,
+	0xca,
+	0xa5,
+	0xcd,
+	0x85,
+	0xcc,
+	0xa5,
+	0xce,
+	0x85,
+	0xcd,
+	0xa5,
+	0xcf,
+	0x85,
+	0xce,
+	0xa5,
+	0xd0,
+	0x49,
+	0x08,
+	0x84,
+	0xd0,
+	0xa5,
+	0xd1,
+	0x49,
+	0x08,
+	0x05,
+	0xd0,
+	0x85,
+	0xd0,
+	0x84,
+	0xd1,
+	0xa5,
+	0xd2,
+	0x49,
+	0x08,
+	0x05,
+	0xd1,
+	0x85,
+	0xd1,
+	0x84,
+	0xd2,
+	0x60,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0xa5,
+	0xc8,
+	0x0a,
+	0xa5,
+	0xc9,
+	0x2a,
+	0x85,
+	0xc8,
+	0xa5,
+	0xca,
+	0x2a,
+	0x85,
+	0xc9,
+	0xa5,
+	0xcb,
+	0x2a,
+	0x85,
+	0xca,
+	0xa5,
+	0xcc,
+	0x0a,
+	0xa5,
+	0xcd,
+	0x2a,
+	0x85,
+	0xcc,
+	0xa5,
+	0xce,
+	0x2a,
+	0x85,
+	0xcd,
+	0xa5,
+	0xcf,
+	0x2a,
+	0x85,
+	0xce,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x60,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0xa5,
+	0xc8,
+	0x49,
+	0x04,
+	0x84,
+	0xc8,
+	0xa5,
+	0xc9,
+	0x49,
+	0x04,
+	0x05,
+	0xc8,
+	0x85,
+	0xc8,
+	0x84,
+	0xc9,
+	0xa5,
+	0xca,
+	0x49,
+	0x04,
+	0x05,
+	0xc9,
+	0x85,
+	0xc9,
+	0x84,
+	0xca,
+	0xa5,
+	0xcc,
+	0x49,
+	0x04,
+	0x84,
+	0xcc,
+	0xa5,
+	0xcd,
+	0x49,
+	0x04,
+	0x05,
+	0xcc,
+	0x85,
+	0xcc,
+	0x84,
+	0xcd,
+	0xa5,
+	0xce,
+	0x49,
+	0x04,
+	0x05,
+	0xcd,
+	0x85,
+	0xcd,
+	0x84,
+	0xce,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x60,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0xa5,
+	0xc8,
+	0x49,
+	0x08,
+	0x84,
+	0xc8,
+	0xa5,
+	0xc9,
+	0x49,
+	0x08,
+	0x05,
+	0xc8,
+	0x85,
+	0xc8,
+	0x84,
+	0xc9,
+	0xa5,
+	0xca,
+	0x49,
+	0x08,
+	0x05,
+	0xc9,
+	0x85,
+	0xc9,
+	0x84,
+	0xca,
+	0xa5,
+	0xcc,
+	0x49,
+	0x08,
+	0x84,
+	0xcc,
+	0xa5,
+	0xcd,
+	0x49,
+	0x08,
+	0x05,
+	0xcc,
+	0x85,
+	0xcc,
+	0x84,
+	0xcd,
+	0xa5,
+	0xce,
+	0x49,
+	0x08,
+	0x05,
+	0xcd,
+	0x85,
+	0xcd,
+	0x84,
+	0xce,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x60,
+	0x46,
+	0xc6,
+	0x66,
+	0xc5,
+	0x66,
+	0xc4,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x66,
+	0xd0,
+	0x60,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x60,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x60,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x46,
+	0xca,
+	0x66,
+	0xc9,
+	0x66,
+	0xc8,
+	0x46,
+	0xce,
+	0x66,
+	0xcd,
+	0x66,
+	0xcc,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x60,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x60,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc4,
+	0x26,
+	0xc5,
+	0x26,
+	0xc6,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x06,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x60,
+	0xa5,
+	0xc7,
+	0x49,
+	0x20,
+	0x85,
+	0xc7,
+	0xa5,
+	0xc6,
+	0x49,
+	0x20,
+	0x85,
+	0xc6,
+	0x98,
+	0x05,
+	0xc7,
+	0x85,
+	0xc7,
+	0xa5,
+	0xc5,
+	0x49,
+	0x20,
+	0x85,
+	0xc5,
+	0x98,
+	0x05,
+	0xc6,
+	0x85,
+	0xc6,
+	0xa5,
+	0xc4,
+	0x49,
+	0x20,
+	0x85,
+	0xc4,
+	0x98,
+	0x05,
+	0xc5,
+	0x85,
+	0xc5,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0xa5,
+	0xd3,
+	0x49,
+	0x20,
+	0x85,
+	0xd3,
+	0xa5,
+	0xd2,
+	0x49,
+	0x20,
+	0x85,
+	0xd2,
+	0x98,
+	0x05,
+	0xd3,
+	0x85,
+	0xd3,
+	0xa5,
+	0xd1,
+	0x49,
+	0x20,
+	0x85,
+	0xd1,
+	0x98,
+	0x05,
+	0xd2,
+	0x85,
+	0xd2,
+	0xa5,
+	0xd0,
+	0x49,
+	0x20,
+	0x85,
+	0xd0,
+	0x98,
+	0x05,
+	0xd1,
+	0x85,
+	0xd1,
+	0x60,
+	0xa5,
+	0xc7,
+	0x49,
+	0x40,
+	0x85,
+	0xc7,
+	0xa5,
+	0xc6,
+	0x49,
+	0x40,
+	0x85,
+	0xc6,
+	0x98,
+	0x05,
+	0xc7,
+	0x85,
+	0xc7,
+	0xa5,
+	0xc5,
+	0x49,
+	0x40,
+	0x85,
+	0xc5,
+	0x98,
+	0x05,
+	0xc6,
+	0x85,
+	0xc6,
+	0xa5,
+	0xc4,
+	0x49,
+	0x40,
+	0x85,
+	0xc4,
+	0x98,
+	0x05,
+	0xc5,
+	0x85,
+	0xc5,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xc8,
+	0x26,
+	0xc9,
+	0x26,
+	0xca,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0x06,
+	0xcc,
+	0x26,
+	0xcd,
+	0x26,
+	0xce,
+	0xa5,
+	0xd3,
+	0x49,
+	0x40,
+	0x85,
+	0xd3,
+	0xa5,
+	0xd2,
+	0x49,
+	0x40,
+	0x85,
+	0xd2,
+	0x98,
+	0x05,
+	0xd3,
+	0x85,
+	0xd3,
+	0xa5,
+	0xd1,
+	0x49,
+	0x40,
+	0x85,
+	0xd1,
+	0x98,
+	0x05,
+	0xd2,
+	0x85,
+	0xd2,
+	0xa5,
+	0xd0,
+	0x49,
+	0x40,
+	0x85,
+	0xd0,
+	0x98,
+	0x05,
+	0xd1,
+	0x85,
+	0xd1,
+	0x60,
+	0x20,
+	0x7b,
+	0x3b,
+	0x46,
+	0xe5,
+	0x66,
+	0xe4,
+	0x90,
+	0x06,
+	0xe6,
+	0xe4,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe5,
+	0x38,
+	0xa5,
+	0xe6,
+	0xe5,
+	0xe4,
+	0xa5,
+	0xe7,
+	0xe5,
+	0xe5,
+	0x30,
+	0x06,
+	0xe6,
+	0xe2,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe3,
+	0x60,
+	0x64,
+	0x22,
+	0x64,
+	0xa8,
+	0x9c,
+	0x9d,
+	0x6a,
+	0xa9,
+	0x77,
+	0x85,
+	0xe2,
+	0xa9,
+	0x60,
+	0x85,
+	0xe3,
+	0xa2,
+	0xc0,
+	0xa9,
+	0x03,
+	0x20,
+	0x90,
+	0x3e,
+	0xa9,
+	0x80,
+	0x85,
+	0xde,
+	0xa9,
+	0x1b,
+	0x85,
+	0xe2,
+	0xa9,
+	0x6c,
+	0x85,
+	0xe3,
+	0xa2,
+	0x94,
+	0xa9,
+	0x05,
+	0x20,
+	0x92,
+	0x3e,
+	0xa0,
+	0x06,
+	0x53,
+	0x4c,
+	0x5c,
+	0x79,
+	0x6b,
+	0xa0,
+	0x96,
+	0x13,
+	0xa8,
+	0x00,
+	0x85,
+	0x6b,
+	0xa9,
+	0x01,
+	0x8d,
+	0x18,
+	0x6b,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x2a,
+	0xbe,
+	0xe8,
+	0x00,
+	0x88,
+	0x98,
+	0x0a,
+	0xaa,
+	0xb9,
+	0xa3,
+	0x59,
+	0xd0,
+	0x14,
+	0x9e,
+	0x9c,
+	0x6a,
+	0x9e,
+	0x9d,
+	0x6a,
+	0x9e,
+	0xf4,
+	0x6a,
+	0x9e,
+	0xf5,
+	0x6a,
+	0x9e,
+	0x04,
+	0x6b,
+	0x9e,
+	0x05,
+	0x6b,
+	0x80,
+	0x6d,
+	0x5a,
+	0xda,
+	0xa5,
+	0xe9,
+	0xa6,
+	0xe8,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0xea,
+	0x86,
+	0xeb,
+	0xdc,
+	0x20,
+	0x5b,
+	0x0e,
+	0xfa,
+	0x9d,
+	0x9c,
+	0x6a,
+	0x9d,
+	0x9d,
+	0x6a,
+	0x49,
+	0x28,
+	0x85,
+	0xec,
+	0x84,
+	0xed,
+	0x38,
+	0xa5,
+	0xea,
+	0xe5,
+	0xec,
+	0x85,
+	0xec,
+	0xa5,
+	0xeb,
+	0xe5,
+	0xed,
+	0x05,
+	0xec,
+	0xf0,
+	0x03,
+	0xfe,
+	0x9d,
+	0x6a,
+	0xbd,
+	0x9d,
+	0x6a,
+	0x85,
+	0xe4,
+	0x64,
+	0xe5,
+	0xa9,
+	0x00,
+	0x85,
+	0xe2,
+	0xa9,
+	0x80,
+	0x85,
+	0xe3,
+	0xda,
+	0x20,
+	0x62,
+	0x1a,
+	0xfa,
+	0xa5,
+	0xe3,
+	0x9d,
+	0xf5,
+	0x6a,
+	0xa5,
+	0xe2,
+	0x9d,
+	0xf4,
+	0x6a,
+	0xbd,
+	0x9d,
+	0x6a,
+	0x85,
+	0xe4,
+	0x64,
+	0xe5,
+	0xa9,
+	0x00,
+	0x85,
+	0xe2,
+	0xa9,
+	0x40,
+	0x85,
+	0xe3,
+	0xda,
+	0x20,
+	0x62,
+	0x1a,
+	0xfa,
+	0xa5,
+	0xe3,
+	0x9d,
+	0x05,
+	0x6b,
+	0xa5,
+	0xe2,
+	0x9d,
+	0x04,
+	0x6b,
+	0x7a,
+	0xc8,
+	0xc0,
+	0x05,
+	0xb0,
+	0x03,
+	0x4c,
+	0xc8,
+	0x1a,
+	0xad,
+	0x9e,
+	0x6a,
+	0x49,
+	0x28,
+	0x85,
+	0xde,
+	0x38,
+	0xa5,
+	0xe8,
+	0xe5,
+	0xde,
+	0x4a,
+	0x85,
+	0xde,
+	0x64,
+	0xdf,
+	0xa9,
+	0xff,
+	0x85,
+	0xe8,
+	0x85,
+	0xe9,
+	0xa2,
+	0x01,
+	0x18,
+	0xa5,
+	0xe8,
+	0x6d,
+	0x9e,
+	0x6a,
+	0x85,
+	0xe8,
+	0x90,
+	0x02,
+	0xe6,
+	0xe9,
+	0x8a,
+	0x0a,
+	0x45,
+	0xde,
+	0x20,
+	0x55,
+	0x0e,
+	0xc5,
+	0xdf,
+	0xf0,
+	0x06,
+	0xe6,
+	0xe8,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe9,
+	0x85,
+	0xdf,
+	0xa5,
+	0xe8,
+	0x9d,
+	0xad,
+	0x6a,
+	0xa5,
+	0xe9,
+	0x9d,
+	0xc1,
+	0x6a,
+	0xe8,
+	0xe0,
+	0x15,
+	0x90,
+	0xd2,
+	0xa0,
+	0x02,
+	0x53,
+	0x2c,
+	0xbe,
+	0xe8,
+	0x00,
+	0x88,
+	0x98,
+	0x0a,
+	0xaa,
+	0xb9,
+	0xa3,
+	0x59,
+	0xd0,
+	0x14,
+	0x9e,
+	0xa4,
+	0x6a,
+	0x9e,
+	0xa5,
+	0x6a,
+	0x9e,
+	0xfc,
+	0x6a,
+	0x9e,
+	0xfd,
+	0x6a,
+	0x9e,
+	0x0c,
+	0x6b,
+	0x9e,
+	0x0d,
+	0x6b,
+	0x80,
+	0x6d,
+	0x5a,
+	0xda,
+	0xa5,
+	0xe9,
+	0xa6,
+	0xe8,
+	0x20,
+	0x9e,
+	0x0d,
+	0x85,
+	0xea,
+	0x86,
+	0xeb,
+	0xdc,
+	0x20,
+	0x93,
+	0x0e,
+	0xfa,
+	0x9d,
+	0xa4,
+	0x6a,
+	0x9d,
+	0xa5,
+	0x6a,
+	0x49,
+	0x20,
+	0x85,
+	0xec,
+	0x84,
+	0xed,
+	0x38,
+	0xa5,
+	0xea,
+	0xe5,
+	0xec,
+	0x85,
+	0xec,
+	0xa5,
+	0xeb,
+	0xe5,
+	0xed,
+	0x05,
+	0xec,
+	0xf0,
+	0x03,
+	0xfe,
+	0xa5,
+	0x6a,
+	0xbd,
+	0xa5,
+	0x6a,
+	0x85,
+	0xe4,
+	0x64,
+	0xe5,
+	0xa9,
+	0x00,
+	0x85,
+	0xe2,
+	0xa9,
+	0x80,
+	0x85,
+	0xe3,
+	0xda,
+	0x20,
+	0x62,
+	0x1a,
+	0xfa,
+	0xa5,
+	0xe3,
+	0x9d,
+	0xfd,
+	0x6a,
+	0xa5,
+	0xe2,
+	0x9d,
+	0xfc,
+	0x6a,
+	0xbd,
+	0xa5,
+	0x6a,
+	0x85,
+	0xe4,
+	0x64,
+	0xe5,
+	0xa9,
+	0x00,
+	0x85,
+	0xe2,
+	0xa9,
+	0x40,
+	0x85,
+	0xe3,
+	0xda,
+	0x20,
+	0x62,
+	0x1a,
+	0xfa,
+	0xa5,
+	0xe3,
+	0x9d,
+	0x0d,
+	0x6b,
+	0xa5,
+	0xe2,
+	0x9d,
+	0x0c,
+	0x6b,
+	0x7a,
+	0xc8,
+	0xc0,
+	0x05,
+	0xb0,
+	0x03,
+	0x4c,
+	0xa8,
+	0x1b,
+	0xad,
+	0xa6,
+	0x6a,
+	0x49,
+	0x20,
+	0x85,
+	0xde,
+	0x38,
+	0xa5,
+	0xe8,
+	0xe5,
+	0xde,
+	0x4a,
+	0x85,
+	0xde,
+	0x64,
+	0xdf,
+	0xa9,
+	0xff,
+	0x85,
+	0xe8,
+	0x85,
+	0xe9,
+	0xa2,
+	0x01,
+	0x18,
+	0xa5,
+	0xe8,
+	0x6d,
+	0xa6,
+	0x6a,
+	0x85,
+	0xe8,
+	0x90,
+	0x02,
+	0xe6,
+	0xe9,
+	0x8a,
+	0x0a,
+	0x45,
+	0xde,
+	0x20,
+	0x8d,
+	0x0e,
+	0xc5,
+	0xdf,
+	0xf0,
+	0x06,
+	0xe6,
+	0xe8,
+	0xd0,
+	0x02,
+	0xe6,
+	0xe9,
+	0x85,
+	0xdf,
+	0xa5,
+	0xe8,
+	0x9d,
+	0xd5,
+	0x6a,
+	0xa5,
+	0xe9,
+	0x9d,
+	0xe5,
+	0x6a,
+	0xe8,
+	0xe0,
+	0x11,
+	0x90,
+	0xd2,
+	0xa9,
+	0x01,
+	0x8d,
+	0x9d,
+	0x6a,
+	0x60,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0xa9,
+	0x3e,
+	0x48,
+	0xad,
+	0x34,
+	0xc0,
+	0xaa,
+	0x29,
+	0x03,
+	0xc9,
+	0x02,
+	0xd0,
+	0x07,
+	0xad,
+	0x76,
+	0x60,
+	0xd0,
+	0x07,
+	0x80,
+	0x38,
+	0x8a,
+	0x29,
+	0xf8,
+	0xf0,
+	0x1b,
+	0xac,
+	0x76,
+	0x60,
+	0xf0,
+	0x06,
+	0x8a,
+	0x4a,
+	0x4a,
+	0x20,
+	0x47,
+	0x3c,
+	0xa5,
+	0xba,
+	0xf0,
+	0x24,
+	0x8a,
+	0x29,
+	0x04,
+	0x09,
+	0x09,
+	0x8d,
+	0x38,
+	0xc0,
+	0xc6,
+	0xba,
+	0x80,
+	0x18,
+	0xa5,
+	0xab,
+	0xf0,
+	0x14,
+	0x8a,
+	0x4a,
+	0x4a,
+	0x20,
+	0xc5,
+	0x39,
+	0xa0,
+	0x01,
+	0x8a,
+	0x4a,
+	0x4a,
+	0x29,
+	0x01,
+	0xf0,
+	0x02,
+	0xa0,
+	0x05,
+	0x8c,
+	0x38,
+	0xc0,
+	0x8a,
+	0x29,
+	0x03,
+	0xc9,
+	0x02,
+	0xd0,
+	0x42,
+	0xa5,
+	0xbe,
+	0xf0,
+	0x0f,
+	0x49,
+	0x3c,
+	0xaa,
+	0xa9,
+	0x77,
+	0x85,
+	0xe2,
+	0xa9,
+	0x60,
+	0x85,
+	0xe3,
+	0x98,
+	0x20,
+	0x90,
+	0x3e,
+	0x38,
+	0xa9,
+	0x0f,
+	0xe5,
+	0xbf,
+	0xf0,
+	0x1a,
+	0x49,
+	0x3c,
+	0x85,
+	0xe4,
+	0x84,
+	0xe5,
+	0x38,
+	0xa9,
+	0x37,
+	0xe5,
+	0xe4,
+	0x85,
+	0xe2,
+	0xa9,
+	0x64,
+	0xe5,
+	0xe5,
+	0x85,
+	0xe3,
+	0xa6,
+	0xe4,
+	0xa5,
+	0xe5,
+	0x20,
+	0x90,
+	0x3e,
+	0xa9,
+	0x01,
+	0x9c,
+	0x24,
+	0xd0,
+	0x8d,
+	0x24,
+	0xd0,
+	0x9c,
+	0x75,
+	0x60,
+	0x20,
+	0x36,
+	0x3f,
+	0x4c,
+	0x0b,
+	0x3f,
+	0xa6,
+	0x67,
+	0xbd,
+	0x7a,
+	0x74,
+	0xaa,
+	0x18,
+	0x69,
+	0xb7,
+	0x85,
+	0x50,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x51,
+	0x8a,
+	0x0a,
+	0xaa,
+	0x69,
+	0xf3,
+	0x85,
+	0x4a,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x4b,
+	0x8a,
+	0x69,
+	0x6b,
+	0x85,
+	0x4c,
+	0xa9,
+	0x7e,
+	0x69,
+	0x00,
+	0x85,
+	0x4d,
+	0x8a,
+	0x69,
+	0x3f,
+	0x85,
+	0x4e,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x4f,
+	0xa6,
+	0x67,
+	0xbd,
+	0x8c,
+	0x74,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x52,
+	0x5e,
+	0x85,
+	0x56,
+	0xbd,
+	0x53,
+	0x5e,
+	0x85,
+	0x57,
+	0xbd,
+	0x58,
+	0x5e,
+	0x85,
+	0x58,
+	0xbd,
+	0x59,
+	0x5e,
+	0x85,
+	0x59,
+	0xa5,
+	0x67,
+	0x49,
+	0x7e,
+	0x18,
+	0x69,
+	0x9d,
+	0x85,
+	0x52,
+	0x98,
+	0x69,
+	0x74,
+	0x85,
+	0x53,
+	0xa5,
+	0x28,
+	0x49,
+	0x06,
+	0x18,
+	0x65,
+	0x52,
+	0x85,
+	0x52,
+	0x98,
+	0x65,
+	0x53,
+	0x85,
+	0x53,
+	0xa0,
+	0x02,
+	0x53,
+	0x2a,
+	0x00,
+	0x3a,
+	0x00,
+	0xa5,
+	0x28,
+	0x85,
+	0x66,
+	0x0a,
+	0x85,
+	0x31,
+	0xa0,
+	0x05,
+	0xd3,
+	0x3a,
+	0x3e,
+	0x00,
+	0x18,
+	0xa5,
+	0x3f,
+	0x65,
+	0x42,
+	0x6a,
+	0x69,
+	0x00,
+	0xaa,
+	0xbd,
+	0x52,
+	0x5d,
+	0x85,
+	0x33,
+	0xbd,
+	0x52,
+	0x5c,
+	0x85,
+	0x32,
+	0xa6,
+	0x40,
+	0x38,
+	0xfd,
+	0x52,
+	0x5c,
+	0xa8,
+	0xa5,
+	0x33,
+	0xfd,
+	0x52,
+	0x5d,
+	0xaa,
+	0x10,
+	0x0c,
+	0x29,
+	0xf0,
+	0xc9,
+	0xf0,
+	0xf0,
+	0x0e,
+	0xa0,
+	0x00,
+	0xa2,
+	0xf0,
+	0x80,
+	0x08,
+	0x29,
+	0xf0,
+	0xf0,
+	0x04,
+	0xa0,
+	0xff,
+	0xa2,
+	0x0f,
+	0x98,
+	0xa4,
+	0x31,
+	0x91,
+	0x4a,
+	0xc8,
+	0x8a,
+	0x91,
+	0x4a,
+	0xa6,
+	0x41,
+	0x38,
+	0xa5,
+	0x32,
+	0xfd,
+	0x52,
+	0x5c,
+	0xa8,
+	0xa5,
+	0x33,
+	0xfd,
+	0x52,
+	0x5d,
+	0xaa,
+	0x10,
+	0x0c,
+	0x29,
+	0xf0,
+	0xc9,
+	0xf0,
+	0xf0,
+	0x0e,
+	0xa0,
+	0x00,
+	0xa2,
+	0xf0,
+	0x80,
+	0x08,
+	0x29,
+	0xf0,
+	0xf0,
+	0x04,
+	0xa0,
+	0xff,
+	0xa2,
+	0x0f,
+	0x98,
+	0xa4,
+	0x31,
+	0x91,
+	0x4c,
+	0xc8,
+	0x8a,
+	0x91,
+	0x4c,
+	0xa6,
+	0x3f,
+	0xbd,
+	0x52,
+	0x5d,
+	0x48,
+	0xbd,
+	0x52,
+	0x5c,
+	0xa6,
+	0x42,
+	0x38,
+	0xfd,
+	0x52,
+	0x5c,
+	0xa8,
+	0x68,
+	0xfd,
+	0x52,
+	0x5d,
+	0xaa,
+	0x10,
+	0x0c,
+	0x29,
+	0xf8,
+	0xc9,
+	0xf8,
+	0xf0,
+	0x0e,
+	0xa0,
+	0x00,
+	0xa2,
+	0xf8,
+	0x80,
+	0x08,
+	0x29,
+	0xf8,
+	0xf0,
+	0x04,
+	0xa0,
+	0xff,
+	0xa2,
+	0x07,
+	0x98,
+	0xa4,
+	0x31,
+	0x91,
+	0x4e,
+	0xc8,
+	0x8a,
+	0x91,
+	0x4e,
+	0xa2,
+	0x01,
+	0xa5,
+	0x3e,
+	0xcd,
+	0x2f,
+	0xbe,
+	0x90,
+	0x07,
+	0xcd,
+	0x30,
+	0xbe,
+	0x90,
+	0x03,
+	0xf0,
+	0x01,
+	0xca,
+	0x8a,
+	0xa4,
+	0x66,
+	0x91,
+	0x50,
+	0x64,
+	0x30,
+	0xa9,
+	0x00,
+	0x85,
+	0x6d,
+	0x49,
+	0x03,
+	0x85,
+	0x38,
+	0x64,
+	0x34,
+	0x64,
+	0x35,
+	0xa9,
+	0x03,
+	0x85,
+	0x6c,
+	0x18,
+	0xa5,
+	0x38,
+	0xa6,
+	0x30,
+	0x7d,
+	0x07,
+	0x7d,
+	0x65,
+	0x52,
+	0x85,
+	0x36,
+	0xa5,
+	0x53,
+	0x69,
+	0x00,
+	0x85,
+	0x37,
+	0xa2,
+	0x00,
+	0xb2,
+	0x36,
+	0xa0,
+	0x06,
+	0x71,
+	0x36,
+	0x90,
+	0x02,
+	0xe8,
+	0x18,
+	0xa0,
+	0x7e,
+	0x71,
+	0x36,
+	0x90,
+	0x02,
+	0xe8,
+	0x18,
+	0xa0,
+	0x84,
+	0x71,
+	0x36,
+	0x90,
+	0x01,
+	0xe8,
+	0x86,
+	0x2e,
+	0x46,
+	0x2e,
+	0x6a,
+	0x46,
+	0x2e,
+	0x6a,
+	0x69,
+	0x00,
+	0x92,
+	0x56,
+	0xa4,
+	0x30,
+	0x59,
+	0x79,
+	0x6b,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x65,
+	0x35,
+	0x85,
+	0x35,
+	0xe6,
+	0x56,
+	0xd0,
+	0x02,
+	0xe6,
+	0x57,
+	0xe6,
+	0x30,
+	0xc6,
+	0x6c,
+	0xd0,
+	0xad,
+	0xa5,
+	0x34,
+	0x0a,
+	0xaa,
+	0xa5,
+	0x35,
+	0x2a,
+	0xe0,
+	0x80,
+	0x90,
+	0x04,
+	0x1a,
+	0xd0,
+	0x01,
+	0x3a,
+	0x92,
+	0x58,
+	0xe6,
+	0x58,
+	0xd0,
+	0x02,
+	0xe6,
+	0x59,
+	0xa5,
+	0x6d,
+	0x1a,
+	0xc9,
+	0x02,
+	0xd0,
+	0x80,
+	0xa5,
+	0x52,
+	0x18,
+	0x69,
+	0x06,
+	0x85,
+	0x52,
+	0x90,
+	0x02,
+	0xe6,
+	0x53,
+	0xa6,
+	0x66,
+	0xe4,
+	0x29,
+	0xf0,
+	0x0f,
+	0xa5,
+	0x3a,
+	0x69,
+	0x05,
+	0x85,
+	0x3a,
+	0x90,
+	0x02,
+	0xe6,
+	0x3b,
+	0x8a,
+	0x1a,
+	0x4c,
+	0x96,
+	0x1d,
+	0xa5,
+	0x2a,
+	0xa6,
+	0x23,
+	0xf0,
+	0x0b,
+	0x38,
+	0xe9,
+	0x64,
+	0x85,
+	0x2a,
+	0xb0,
+	0x0d,
+	0xc6,
+	0x2b,
+	0x80,
+	0x09,
+	0x18,
+	0x69,
+	0x64,
+	0x85,
+	0x2a,
+	0x90,
+	0x02,
+	0xe6,
+	0x2b,
+	0x60,
+	0xa4,
+	0x28,
+	0x84,
+	0x61,
+	0x84,
+	0x62,
+	0xc4,
+	0x29,
+	0xf0,
+	0x02,
+	0xe6,
+	0x62,
+	0xb1,
+	0x5a,
+	0xf0,
+	0x20,
+	0x31,
+	0x5c,
+	0x31,
+	0x5e,
+	0xfc,
+	0xa4,
+	0x61,
+	0x31,
+	0x5c,
+	0x31,
+	0x5a,
+	0x31,
+	0x5e,
+	0xa4,
+	0x62,
+	0x31,
+	0x5c,
+	0x31,
+	0x5a,
+	0x31,
+	0x5e,
+	0xdc,
+	0x29,
+	0x01,
+	0xd0,
+	0x04,
+	0xb1,
+	0x5a,
+	0x80,
+	0x02,
+	0x09,
+	0x02,
+	0x91,
+	0x5a,
+	0x84,
+	0x61,
+	0xc8,
+	0xc4,
+	0x29,
+	0x90,
+	0xd1,
+	0xf0,
+	0xd1,
+	0x60,
+	0xa2,
+	0x01,
+	0xa5,
+	0x67,
+	0xc5,
+	0x26,
+	0xf0,
+	0x06,
+	0xc5,
+	0x27,
+	0xf0,
+	0x02,
+	0xa2,
+	0x00,
+	0x86,
+	0x88,
+	0x85,
+	0x64,
+	0x1a,
+	0x85,
+	0x63,
+	0x1a,
+	0x85,
+	0x65,
+	0x18,
+	0xa6,
+	0x67,
+	0xa9,
+	0xb7,
+	0xa8,
+	0x7d,
+	0x79,
+	0x74,
+	0x85,
+	0x5c,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x5d,
+	0x98,
+	0x7d,
+	0x7a,
+	0x74,
+	0x85,
+	0x5a,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x5b,
+	0x98,
+	0x7d,
+	0x7b,
+	0x74,
+	0x85,
+	0x5e,
+	0xa9,
+	0x7d,
+	0x69,
+	0x00,
+	0x85,
+	0x5f,
+	0x20,
+	0x17,
+	0x1f,
+	0xa6,
+	0x63,
+	0xbd,
+	0x8b,
+	0x74,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x52,
+	0x5e,
+	0x85,
+	0x4a,
+	0xbd,
+	0x53,
+	0x5e,
+	0x85,
+	0x4b,
+	0xbd,
+	0x58,
+	0x5e,
+	0x85,
+	0x52,
+	0xbd,
+	0x59,
+	0x5e,
+	0x85,
+	0x53,
+	0xa5,
+	0x28,
+	0xc5,
+	0x29,
+	0xf0,
+	0x1b,
+	0x18,
+	0xa5,
+	0x4a,
+	0x69,
+	0x06,
+	0x85,
+	0x4c,
+	0xa5,
+	0x4b,
+	0x69,
+	0x00,
+	0x85,
+	0x4d,
+	0xa5,
+	0x52,
+	0x69,
+	0x02,
+	0x85,
+	0x54,
+	0xa5,
+	0x53,
+	0x69,
+	0x00,
+	0x85,
+	0x55,
+	0x80,
+	0x0c,
+	0xa0,
+	0x02,
+	0x53,
+	0x4a,
+	0x00,
+	0x4c,
+	0x00,
+	0x53,
+	0x52,
+	0x00,
+	0x54,
+	0x00,
+	0xa6,
+	0x64,
+	0xbd,
+	0x8b,
+	0x74,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x52,
+	0x5e,
+	0x85,
+	0x4e,
+	0xbd,
+	0x53,
+	0x5e,
+	0x85,
+	0x4f,
+	0xbd,
+	0x58,
+	0x5e,
+	0x85,
+	0x56,
+	0xbd,
+	0x59,
+	0x5e,
+	0x85,
+	0x57,
+	0xa6,
+	0x65,
+	0xbd,
+	0x8b,
+	0x74,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x52,
+	0x5e,
+	0x85,
+	0x50,
+	0xbd,
+	0x53,
+	0x5e,
+	0x85,
+	0x51,
+	0xbd,
+	0x58,
+	0x5e,
+	0x85,
+	0x58,
+	0xbd,
+	0x59,
+	0x5e,
+	0x85,
+	0x59,
+	0xa0,
+	0x02,
+	0x53,
+	0x5a,
+	0x00,
+	0x3c,
+	0x00,
+	0x18,
+	0xa6,
+	0x67,
+	0xbd,
+	0x79,
+	0x74,
+	0x0a,
+	0x69,
+	0x3f,
+	0x85,
+	0x5c,
+	0xa9,
+	0x7d,
+	0xa8,
+	0x69,
+	0x00,
+	0x85,
+	0x5d,
+	0xbd,
+	0x7a,
+	0x74,
+	0x0a,
+	0x69,
+	0x3f,
+	0x85,
+	0x5a,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x5b,
+	0xbd,
+	0x7b,
+	0x74,
+	0x0a,
+	0x69,
+	0x3f,
+	0x85,
+	0x5e,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x5f,
+	0xa5,
+	0x28,
+	0xaa,
+	0x85,
+	0x66,
+	0x0a,
+	0x85,
+	0x61,
+	0x8a,
+	0xa0,
+	0x01,
+	0x64,
+	0x89,
+	0xc5,
+	0x29,
+	0xf0,
+	0x01,
+	0x1a,
+	0x0a,
+	0x85,
+	0x62,
+	0x84,
+	0x87,
+	0xa4,
+	0x66,
+	0xb1,
+	0x3c,
+	0x29,
+	0x02,
+	0xf0,
+	0x0b,
+	0x20,
+	0x19,
+	0x21,
+	0x20,
+	0x0d,
+	0x22,
+	0x20,
+	0x98,
+	0x24,
+	0x80,
+	0x0e,
+	0x64,
+	0x93,
+	0x64,
+	0x94,
+	0x64,
+	0x95,
+	0x64,
+	0x96,
+	0x20,
+	0x0d,
+	0x22,
+	0x20,
+	0x98,
+	0x24,
+	0xa6,
+	0x89,
+	0xbd,
+	0x1b,
+	0x7d,
+	0xe8,
+	0x29,
+	0x80,
+	0xd0,
+	0xf8,
+	0x86,
+	0x89,
+	0x18,
+	0xa5,
+	0x4e,
+	0x69,
+	0x06,
+	0x85,
+	0x4e,
+	0x90,
+	0x03,
+	0xe6,
+	0x4f,
+	0x18,
+	0xa5,
+	0x50,
+	0x69,
+	0x06,
+	0x85,
+	0x50,
+	0x90,
+	0x03,
+	0xe6,
+	0x51,
+	0x18,
+	0xa5,
+	0x56,
+	0x69,
+	0x02,
+	0x85,
+	0x56,
+	0x90,
+	0x03,
+	0xe6,
+	0x57,
+	0x18,
+	0xa5,
+	0x58,
+	0x69,
+	0x02,
+	0x85,
+	0x58,
+	0x90,
+	0x02,
+	0xe6,
+	0x59,
+	0xa5,
+	0x66,
+	0xaa,
+	0x0a,
+	0x85,
+	0x61,
+	0xe4,
+	0x28,
+	0xf0,
+	0x16,
+	0x18,
+	0xa5,
+	0x4a,
+	0x69,
+	0x06,
+	0x85,
+	0x4a,
+	0x90,
+	0x03,
+	0xe6,
+	0x4b,
+	0x18,
+	0xa5,
+	0x52,
+	0x69,
+	0x02,
+	0x85,
+	0x52,
+	0x90,
+	0x02,
+	0xe6,
+	0x53,
+	0xa0,
+	0x00,
+	0xe8,
+	0x86,
+	0x66,
+	0xe4,
+	0x29,
+	0xf0,
+	0x16,
+	0x18,
+	0xa5,
+	0x4c,
+	0x69,
+	0x06,
+	0x85,
+	0x4c,
+	0x90,
+	0x03,
+	0xe6,
+	0x4d,
+	0x18,
+	0xa5,
+	0x54,
+	0x69,
+	0x02,
+	0x85,
+	0x54,
+	0x90,
+	0x02,
+	0xe6,
+	0x55,
+	0x8a,
+	0xe4,
+	0x29,
+	0xb0,
+	0x03,
+	0x4c,
+	0x59,
+	0x20,
+	0xd0,
+	0x04,
+	0xc8,
+	0x4c,
+	0x5d,
+	0x20,
+	0xa6,
+	0x8a,
+	0xbd,
+	0x2f,
+	0x7d,
+	0xa4,
+	0x23,
+	0xf0,
+	0x03,
+	0xca,
+	0x80,
+	0x01,
+	0xe8,
+	0x29,
+	0x80,
+	0xd0,
+	0xf1,
+	0x86,
+	0x8a,
+	0x60,
+	0xa4,
+	0x62,
+	0xb1,
+	0x5a,
+	0xc8,
+	0x0a,
+	0xaa,
+	0xb1,
+	0x5a,
+	0x88,
+	0x2a,
+	0x48,
+	0x18,
+	0x8a,
+	0x71,
+	0x5c,
+	0xc8,
+	0xaa,
+	0x68,
+	0x71,
+	0x5c,
+	0x88,
+	0x48,
+	0x18,
+	0x8a,
+	0x71,
+	0x5e,
+	0xc8,
+	0xaa,
+	0x68,
+	0x71,
+	0x5e,
+	0x48,
+	0xda,
+	0xa4,
+	0x61,
+	0xb1,
+	0x5a,
+	0xc8,
+	0x0a,
+	0xaa,
+	0xb1,
+	0x5a,
+	0x88,
+	0x2a,
+	0x48,
+	0x18,
+	0x8a,
+	0x71,
+	0x5c,
+	0xc8,
+	0xaa,
+	0x68,
+	0x71,
+	0x5c,
+	0x88,
+	0x48,
+	0x18,
+	0x8a,
+	0x71,
+	0x5e,
+	0x85,
+	0x93,
+	0xc8,
+	0x68,
+	0x71,
+	0x5e,
+	0x85,
+	0x94,
+	0x38,
+	0x68,
+	0xe5,
+	0x93,
+	0x85,
+	0x93,
+	0x68,
+	0xe5,
+	0x94,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x93,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x93,
+	0xa6,
+	0x87,
+	0xd0,
+	0x05,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x93,
+	0x90,
+	0x05,
+	0xe6,
+	0x93,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x94,
+	0xa5,
+	0x66,
+	0x0a,
+	0xa8,
+	0x38,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0xaa,
+	0xc8,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0x85,
+	0x96,
+	0x8a,
+	0x0a,
+	0x85,
+	0x95,
+	0x26,
+	0x96,
+	0xa4,
+	0x61,
+	0x38,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0xaa,
+	0xc8,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0xa8,
+	0x8a,
+	0x18,
+	0x65,
+	0x95,
+	0x85,
+	0x95,
+	0x98,
+	0x65,
+	0x96,
+	0x85,
+	0x96,
+	0xa4,
+	0x62,
+	0x38,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0xaa,
+	0xc8,
+	0xb1,
+	0x5e,
+	0xf1,
+	0x5c,
+	0xa8,
+	0x8a,
+	0x18,
+	0x65,
+	0x95,
+	0x85,
+	0x95,
+	0x98,
+	0x65,
+	0x96,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x95,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x95,
+	0xa6,
+	0x88,
+	0xd0,
+	0x05,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x95,
+	0x90,
+	0x05,
+	0xe6,
+	0x95,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x96,
+	0xa5,
+	0x66,
+	0x0a,
+	0xa8,
+	0xb1,
+	0x5a,
+	0x65,
+	0x6e,
+	0x85,
+	0x6e,
+	0xc8,
+	0xa2,
+	0xff,
+	0xb1,
+	0x5a,
+	0x30,
+	0x01,
+	0xe8,
+	0x65,
+	0x6f,
+	0x85,
+	0x6f,
+	0x8a,
+	0x65,
+	0x70,
+	0x85,
+	0x70,
+	0x8a,
+	0x65,
+	0x71,
+	0x85,
+	0x71,
+	0xe6,
+	0x72,
+	0xd0,
+	0x02,
+	0xe6,
+	0x73,
+	0x60,
+	0xa5,
+	0x66,
+	0x0a,
+	0x85,
+	0x2e,
+	0x64,
+	0x2f,
+	0x64,
+	0x38,
+	0x64,
+	0x39,
+	0x64,
+	0x6d,
+	0xa9,
+	0xf3,
+	0xa2,
+	0x7d,
+	0x80,
+	0x04,
+	0xa9,
+	0x6b,
+	0xa2,
+	0x7e,
+	0x85,
+	0x32,
+	0x86,
+	0x33,
+	0xa4,
+	0x67,
+	0xb9,
+	0x7a,
+	0x74,
+	0x0a,
+	0x65,
+	0x32,
+	0x85,
+	0x34,
+	0xa5,
+	0x33,
+	0x69,
+	0x00,
+	0x85,
+	0x35,
+	0xa4,
+	0x62,
+	0xb1,
+	0x34,
+	0xa4,
+	0x61,
+	0x38,
+	0xf1,
+	0x34,
+	0xaa,
+	0xa4,
+	0x62,
+	0xc8,
+	0xb1,
+	0x34,
+	0xa4,
+	0x61,
+	0xc8,
+	0xf1,
+	0x34,
+	0xa4,
+	0x87,
+	0xd0,
+	0x11,
+	0xc9,
+	0x80,
+	0x6a,
+	0x85,
+	0x69,
+	0x8a,
+	0x6a,
+	0x69,
+	0x00,
+	0x85,
+	0x68,
+	0x90,
+	0x1f,
+	0xaa,
+	0xa5,
+	0x69,
+	0x1a,
+	0xa8,
+	0x10,
+	0x0c,
+	0x29,
+	0xf0,
+	0xc9,
+	0xf0,
+	0xf0,
+	0x0e,
+	0xa2,
+	0x00,
+	0xa0,
+	0xf0,
+	0x80,
+	0x08,
+	0x29,
+	0xf0,
+	0xf0,
+	0x04,
+	0xa2,
+	0xff,
+	0xa0,
+	0x0f,
+	0x86,
+	0x68,
+	0x84,
+	0x69,
+	0xa4,
+	0x65,
+	0xb9,
+	0x79,
+	0x74,
+	0x0a,
+	0x65,
+	0x32,
+	0x85,
+	0x34,
+	0xa5,
+	0x33,
+	0xaa,
+	0x69,
+	0x00,
+	0x85,
+	0x35,
+	0xa4,
+	0x64,
+	0xb9,
+	0x79,
+	0x74,
+	0x0a,
+	0x65,
+	0x32,
+	0x85,
+	0x36,
+	0x8a,
+	0x69,
+	0x00,
+	0x85,
+	0x37,
+	0xa4,
+	0x2e,
+	0xb1,
+	0x34,
+	0x38,
+	0xf1,
+	0x36,
+	0xaa,
+	0xc8,
+	0xb1,
+	0x34,
+	0xf1,
+	0x36,
+	0xa4,
+	0x88,
+	0xd0,
+	0x11,
+	0xc9,
+	0x80,
+	0x6a,
+	0x85,
+	0x6b,
+	0x8a,
+	0x6a,
+	0x69,
+	0x00,
+	0x85,
+	0x6a,
+	0x90,
+	0x1f,
+	0xaa,
+	0xa5,
+	0x6b,
+	0x1a,
+	0xa8,
+	0x10,
+	0x0c,
+	0x29,
+	0xf0,
+	0xc9,
+	0xf0,
+	0xf0,
+	0x0e,
+	0xa2,
+	0x00,
+	0xa0,
+	0xf0,
+	0x80,
+	0x08,
+	0x29,
+	0xf0,
+	0xf0,
+	0x04,
+	0xa2,
+	0xff,
+	0xa0,
+	0x0f,
+	0x86,
+	0x6a,
+	0x84,
+	0x6b,
+	0xa9,
+	0x03,
+	0x85,
+	0x6c,
+	0xa4,
+	0x2f,
+	0xb1,
+	0x4a,
+	0xaa,
+	0xb1,
+	0x4c,
+	0xa8,
+	0xbd,
+	0x52,
+	0x5c,
+	0x38,
+	0xf9,
+	0x52,
+	0x5c,
+	0x85,
+	0x32,
+	0xbd,
+	0x52,
+	0x5d,
+	0xf9,
+	0x52,
+	0x5d,
+	0xa4,
+	0x87,
+	0xd0,
+	0x0c,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x32,
+	0x90,
+	0x05,
+	0xe6,
+	0x32,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x33,
+	0xaa,
+	0x18,
+	0xa5,
+	0x32,
+	0x65,
+	0x68,
+	0x85,
+	0x32,
+	0x8a,
+	0x65,
+	0x69,
+	0x85,
+	0x33,
+	0x10,
+	0x0d,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x32,
+	0x85,
+	0x32,
+	0xa9,
+	0x00,
+	0xe5,
+	0x33,
+	0x85,
+	0x33,
+	0xa4,
+	0x2f,
+	0xb1,
+	0x4e,
+	0xaa,
+	0xb1,
+	0x50,
+	0xa8,
+	0xbd,
+	0x52,
+	0x5c,
+	0x38,
+	0xf9,
+	0x52,
+	0x5c,
+	0x85,
+	0x34,
+	0xbd,
+	0x52,
+	0x5d,
+	0xf9,
+	0x52,
+	0x5d,
+	0xa4,
+	0x88,
+	0xd0,
+	0x0c,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x34,
+	0x90,
+	0x05,
+	0xe6,
+	0x34,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x35,
+	0xaa,
+	0x18,
+	0xa5,
+	0x34,
+	0x65,
+	0x6a,
+	0x85,
+	0x34,
+	0x8a,
+	0x65,
+	0x6b,
+	0x85,
+	0x35,
+	0x10,
+	0x0d,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x34,
+	0x85,
+	0x34,
+	0xa9,
+	0x00,
+	0xe5,
+	0x35,
+	0x85,
+	0x35,
+	0xc5,
+	0x33,
+	0x90,
+	0x11,
+	0xf0,
+	0x09,
+	0xa0,
+	0x02,
+	0x53,
+	0x34,
+	0x00,
+	0x32,
+	0x00,
+	0x80,
+	0x06,
+	0xa5,
+	0x34,
+	0xc5,
+	0x32,
+	0xb0,
+	0xf1,
+	0xa5,
+	0x2f,
+	0x49,
+	0x03,
+	0xaa,
+	0x18,
+	0xa5,
+	0x32,
+	0x7d,
+	0xc3,
+	0x80,
+	0x9d,
+	0xc3,
+	0x80,
+	0xa5,
+	0x33,
+	0x7d,
+	0xc4,
+	0x80,
+	0x9d,
+	0xc4,
+	0x80,
+	0x90,
+	0x03,
+	0xfe,
+	0xc5,
+	0x80,
+	0xe6,
+	0x2f,
+	0xc6,
+	0x6c,
+	0xf0,
+	0x03,
+	0x4c,
+	0xdd,
+	0x22,
+	0xa4,
+	0x6d,
+	0xb1,
+	0x52,
+	0xaa,
+	0xb1,
+	0x54,
+	0xa8,
+	0xbd,
+	0x52,
+	0x5c,
+	0x38,
+	0xf9,
+	0x52,
+	0x5c,
+	0x85,
+	0x32,
+	0xbd,
+	0x52,
+	0x5d,
+	0xf9,
+	0x52,
+	0x5d,
+	0xa4,
+	0x87,
+	0xd0,
+	0x0c,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x32,
+	0x90,
+	0x05,
+	0xe6,
+	0x32,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x33,
+	0xaa,
+	0x18,
+	0xa5,
+	0x32,
+	0x65,
+	0x68,
+	0x85,
+	0x32,
+	0x8a,
+	0x65,
+	0x69,
+	0x85,
+	0x33,
+	0x10,
+	0x1a,
+	0x18,
+	0xa5,
+	0x38,
+	0x65,
+	0x32,
+	0xa5,
+	0x39,
+	0x65,
+	0x33,
+	0xb0,
+	0x21,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x32,
+	0x85,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x33,
+	0x85,
+	0x39,
+	0x80,
+	0x12,
+	0x38,
+	0xa5,
+	0x38,
+	0xe5,
+	0x32,
+	0xa5,
+	0x39,
+	0xe5,
+	0x33,
+	0xb0,
+	0x07,
+	0xa0,
+	0x02,
+	0x53,
+	0x32,
+	0x00,
+	0x38,
+	0x00,
+	0xa4,
+	0x6d,
+	0xb1,
+	0x56,
+	0xaa,
+	0xb1,
+	0x58,
+	0xa8,
+	0xbd,
+	0x52,
+	0x5c,
+	0x38,
+	0xf9,
+	0x52,
+	0x5c,
+	0x85,
+	0x34,
+	0xbd,
+	0x52,
+	0x5d,
+	0xf9,
+	0x52,
+	0x5d,
+	0xa4,
+	0x88,
+	0xd0,
+	0x0c,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x34,
+	0x90,
+	0x05,
+	0xe6,
+	0x34,
+	0xd0,
+	0x01,
+	0x1a,
+	0x85,
+	0x35,
+	0xaa,
+	0x18,
+	0xa5,
+	0x34,
+	0x65,
+	0x6a,
+	0x85,
+	0x34,
+	0x8a,
+	0x65,
+	0x6b,
+	0x85,
+	0x35,
+	0x10,
+	0x1a,
+	0x18,
+	0xa5,
+	0x38,
+	0x65,
+	0x34,
+	0xa5,
+	0x39,
+	0x65,
+	0x35,
+	0xb0,
+	0x21,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x34,
+	0x85,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x35,
+	0x85,
+	0x39,
+	0x80,
+	0x12,
+	0x38,
+	0xa5,
+	0x38,
+	0xe5,
+	0x34,
+	0xa5,
+	0x39,
+	0xe5,
+	0x35,
+	0xb0,
+	0x07,
+	0xa0,
+	0x02,
+	0x53,
+	0x34,
+	0x00,
+	0x38,
+	0x00,
+	0xa0,
+	0x04,
+	0xa5,
+	0x6d,
+	0xd0,
+	0x07,
+	0x53,
+	0x32,
+	0x00,
+	0x8b,
+	0x00,
+	0x80,
+	0x05,
+	0x53,
+	0x32,
+	0x00,
+	0x8f,
+	0x00,
+	0xd0,
+	0x05,
+	0xe6,
+	0x6d,
+	0x4c,
+	0x20,
+	0x22,
+	0x38,
+	0xa5,
+	0x38,
+	0xed,
+	0x31,
+	0xbe,
+	0xa5,
+	0x39,
+	0xed,
+	0x32,
+	0xbe,
+	0x90,
+	0x09,
+	0x64,
+	0x8b,
+	0xa0,
+	0x07,
+	0x13,
+	0x8b,
+	0x00,
+	0x8c,
+	0x00,
+	0x60,
+	0xa2,
+	0x00,
+	0xa5,
+	0x94,
+	0x10,
+	0x0f,
+	0x85,
+	0x42,
+	0x38,
+	0x8a,
+	0xe5,
+	0x93,
+	0x85,
+	0x93,
+	0x8a,
+	0xe5,
+	0x94,
+	0x85,
+	0x94,
+	0x80,
+	0x08,
+	0x05,
+	0x93,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x42,
+	0xa5,
+	0x2c,
+	0xf0,
+	0x14,
+	0x45,
+	0x93,
+	0x84,
+	0x93,
+	0xa5,
+	0x94,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2c,
+	0x18,
+	0x65,
+	0x93,
+	0x85,
+	0x93,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x94,
+	0xa5,
+	0x96,
+	0x10,
+	0x0f,
+	0x85,
+	0x43,
+	0x38,
+	0x8a,
+	0xe5,
+	0x95,
+	0x85,
+	0x95,
+	0x8a,
+	0xe5,
+	0x96,
+	0x85,
+	0x96,
+	0x80,
+	0x08,
+	0x05,
+	0x95,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x43,
+	0xa5,
+	0x2d,
+	0xf0,
+	0x14,
+	0x45,
+	0x95,
+	0x84,
+	0x95,
+	0xa5,
+	0x96,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2d,
+	0x18,
+	0x65,
+	0x95,
+	0x85,
+	0x95,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x96,
+	0xa5,
+	0x8c,
+	0x10,
+	0x0f,
+	0x85,
+	0x46,
+	0x38,
+	0x8a,
+	0xe5,
+	0x8b,
+	0x85,
+	0x8b,
+	0x8a,
+	0xe5,
+	0x8c,
+	0x85,
+	0x8c,
+	0x80,
+	0x08,
+	0x05,
+	0x8b,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x46,
+	0xa5,
+	0x2c,
+	0xf0,
+	0x14,
+	0x45,
+	0x8b,
+	0x84,
+	0x8b,
+	0xa5,
+	0x8c,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2c,
+	0x18,
+	0x65,
+	0x8b,
+	0x85,
+	0x8b,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x8c,
+	0xa5,
+	0x90,
+	0x10,
+	0x0f,
+	0x85,
+	0x47,
+	0x38,
+	0x8a,
+	0xe5,
+	0x8f,
+	0x85,
+	0x8f,
+	0x8a,
+	0xe5,
+	0x90,
+	0x85,
+	0x90,
+	0x80,
+	0x08,
+	0x05,
+	0x8f,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x47,
+	0xa5,
+	0x2c,
+	0xf0,
+	0x14,
+	0x45,
+	0x8f,
+	0x84,
+	0x8f,
+	0xa5,
+	0x90,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2c,
+	0x18,
+	0x65,
+	0x8f,
+	0x85,
+	0x8f,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x90,
+	0xa5,
+	0x8e,
+	0x10,
+	0x0f,
+	0x85,
+	0x48,
+	0x38,
+	0x8a,
+	0xe5,
+	0x8d,
+	0x85,
+	0x8d,
+	0x8a,
+	0xe5,
+	0x8e,
+	0x85,
+	0x8e,
+	0x80,
+	0x08,
+	0x05,
+	0x8d,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x48,
+	0xa5,
+	0x2d,
+	0xf0,
+	0x14,
+	0x45,
+	0x8d,
+	0x84,
+	0x8d,
+	0xa5,
+	0x8e,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2d,
+	0x18,
+	0x65,
+	0x8d,
+	0x85,
+	0x8d,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x8e,
+	0xa5,
+	0x92,
+	0x10,
+	0x0f,
+	0x85,
+	0x49,
+	0x38,
+	0x8a,
+	0xe5,
+	0x91,
+	0x85,
+	0x91,
+	0x8a,
+	0xe5,
+	0x92,
+	0x85,
+	0x92,
+	0x80,
+	0x08,
+	0x05,
+	0x91,
+	0xf0,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x49,
+	0xa5,
+	0x2d,
+	0xf0,
+	0x14,
+	0x45,
+	0x91,
+	0x84,
+	0x91,
+	0xa5,
+	0x92,
+	0xf0,
+	0x0c,
+	0x45,
+	0x2d,
+	0x18,
+	0x65,
+	0x91,
+	0x85,
+	0x91,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x92,
+	0xa4,
+	0x8a,
+	0x5a,
+	0x84,
+	0x45,
+	0xa4,
+	0x89,
+	0x5a,
+	0x84,
+	0x44,
+	0xa2,
+	0x00,
+	0x64,
+	0x30,
+	0x18,
+	0xa5,
+	0x45,
+	0x69,
+	0x04,
+	0x85,
+	0x33,
+	0x64,
+	0x31,
+	0x18,
+	0xa5,
+	0x44,
+	0x69,
+	0x06,
+	0x85,
+	0x34,
+	0x20,
+	0xad,
+	0x26,
+	0xe6,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0xe6,
+	0x30,
+	0x38,
+	0xa5,
+	0x33,
+	0xe9,
+	0x04,
+	0x85,
+	0x33,
+	0x64,
+	0x31,
+	0xa5,
+	0x34,
+	0x20,
+	0xad,
+	0x26,
+	0xe6,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x38,
+	0xa5,
+	0x33,
+	0xe9,
+	0x04,
+	0x85,
+	0x33,
+	0x64,
+	0x31,
+	0xa5,
+	0x34,
+	0x20,
+	0xad,
+	0x26,
+	0xe6,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x38,
+	0xa5,
+	0x32,
+	0xe9,
+	0x0a,
+	0x20,
+	0xad,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x30,
+	0x38,
+	0xa5,
+	0x33,
+	0xe9,
+	0x04,
+	0x85,
+	0x33,
+	0x64,
+	0x31,
+	0xa5,
+	0x34,
+	0x20,
+	0xad,
+	0x26,
+	0xe6,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0x01,
+	0x85,
+	0x30,
+	0x38,
+	0xa5,
+	0x33,
+	0xe9,
+	0x04,
+	0x85,
+	0x33,
+	0x64,
+	0x31,
+	0xa5,
+	0x34,
+	0x20,
+	0xad,
+	0x26,
+	0xe6,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0x20,
+	0xa8,
+	0x26,
+	0xa9,
+	0xff,
+	0x85,
+	0x31,
+	0x20,
+	0xa8,
+	0x26,
+	0x7a,
+	0xb9,
+	0x1b,
+	0x7d,
+	0x10,
+	0x04,
+	0xc8,
+	0x4c,
+	0xd3,
+	0x25,
+	0x7a,
+	0xb9,
+	0x2f,
+	0x7d,
+	0x10,
+	0x0c,
+	0xa6,
+	0x23,
+	0xf0,
+	0x04,
+	0x88,
+	0x4c,
+	0xce,
+	0x25,
+	0xc8,
+	0x4c,
+	0xce,
+	0x25,
+	0x60,
+	0x38,
+	0xa5,
+	0x32,
+	0xe9,
+	0x05,
+	0x85,
+	0x32,
+	0xda,
+	0x64,
+	0x2e,
+	0x64,
+	0x2f,
+	0xa6,
+	0x33,
+	0xa8,
+	0x30,
+	0x31,
+	0xc9,
+	0x0c,
+	0xb0,
+	0x2d,
+	0x8a,
+	0x30,
+	0x2a,
+	0xc9,
+	0x08,
+	0xb0,
+	0x26,
+	0xa5,
+	0x44,
+	0xd0,
+	0x09,
+	0xa5,
+	0x31,
+	0xd0,
+	0x0d,
+	0xbd,
+	0xaa,
+	0x55,
+	0x80,
+	0x17,
+	0xc9,
+	0x13,
+	0xd0,
+	0x09,
+	0xa5,
+	0x31,
+	0x10,
+	0xf3,
+	0xbd,
+	0xa2,
+	0x55,
+	0x80,
+	0x0a,
+	0x8a,
+	0x49,
+	0x0c,
+	0x18,
+	0x65,
+	0x32,
+	0xa8,
+	0xb9,
+	0xb2,
+	0x55,
+	0x85,
+	0x2e,
+	0xe8,
+	0x30,
+	0x35,
+	0xe0,
+	0x0a,
+	0xb0,
+	0x31,
+	0xa5,
+	0x32,
+	0x3a,
+	0x30,
+	0x2c,
+	0xc9,
+	0x0a,
+	0xb0,
+	0x28,
+	0xa4,
+	0x45,
+	0xd0,
+	0x0a,
+	0xaa,
+	0xa5,
+	0x30,
+	0xd0,
+	0x0e,
+	0xbd,
+	0x1c,
+	0x56,
+	0x80,
+	0x18,
+	0xc0,
+	0x0f,
+	0xd0,
+	0x0a,
+	0xaa,
+	0xa5,
+	0x30,
+	0x30,
+	0xf2,
+	0xbd,
+	0x12,
+	0x56,
+	0x80,
+	0x0a,
+	0x8a,
+	0x49,
+	0x0a,
+	0x18,
+	0x65,
+	0x32,
+	0xaa,
+	0xbd,
+	0x25,
+	0x56,
+	0x85,
+	0x2f,
+	0xfa,
+	0xa5,
+	0x2e,
+	0xd0,
+	0x03,
+	0x4c,
+	0x79,
+	0x28,
+	0xa8,
+	0x10,
+	0x05,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x2e,
+	0x85,
+	0x36,
+	0x98,
+	0x3c,
+	0x45,
+	0x42,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x38,
+	0x45,
+	0x93,
+	0x85,
+	0x37,
+	0xbd,
+	0xd5,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd5,
+	0x80,
+	0x84,
+	0x37,
+	0xbd,
+	0xd6,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd6,
+	0x80,
+	0xb0,
+	0x04,
+	0xde,
+	0xd7,
+	0x80,
+	0x38,
+	0xa5,
+	0x94,
+	0xf0,
+	0x40,
+	0x45,
+	0x36,
+	0x85,
+	0x37,
+	0xbd,
+	0xd6,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd6,
+	0x80,
+	0x84,
+	0x37,
+	0xbd,
+	0xd7,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd7,
+	0x80,
+	0x80,
+	0x28,
+	0x45,
+	0x93,
+	0x7d,
+	0xd5,
+	0x80,
+	0x9d,
+	0xd5,
+	0x80,
+	0x98,
+	0x7d,
+	0xd6,
+	0x80,
+	0x9d,
+	0xd6,
+	0x80,
+	0x90,
+	0x04,
+	0xfe,
+	0xd7,
+	0x80,
+	0x18,
+	0xa5,
+	0x94,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0xd6,
+	0x80,
+	0x9d,
+	0xd6,
+	0x80,
+	0x98,
+	0x7d,
+	0xd7,
+	0x80,
+	0x9d,
+	0xd7,
+	0x80,
+	0xa5,
+	0x46,
+	0xf0,
+	0x69,
+	0x3c,
+	0x45,
+	0x2e,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x38,
+	0x45,
+	0x8b,
+	0x85,
+	0x37,
+	0xbd,
+	0x1d,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1d,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x1e,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1e,
+	0x81,
+	0xb0,
+	0x04,
+	0xde,
+	0x1f,
+	0x81,
+	0x38,
+	0xa5,
+	0x8c,
+	0xf0,
+	0x40,
+	0x45,
+	0x36,
+	0x85,
+	0x37,
+	0xbd,
+	0x1e,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1e,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x1f,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1f,
+	0x81,
+	0x80,
+	0x28,
+	0x45,
+	0x8b,
+	0x7d,
+	0x1d,
+	0x81,
+	0x9d,
+	0x1d,
+	0x81,
+	0x98,
+	0x7d,
+	0x1e,
+	0x81,
+	0x9d,
+	0x1e,
+	0x81,
+	0x90,
+	0x04,
+	0xfe,
+	0x1f,
+	0x81,
+	0x18,
+	0xa5,
+	0x8c,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0x1e,
+	0x81,
+	0x9d,
+	0x1e,
+	0x81,
+	0x98,
+	0x7d,
+	0x1f,
+	0x81,
+	0x9d,
+	0x1f,
+	0x81,
+	0xa5,
+	0x47,
+	0xf0,
+	0x6a,
+	0x3c,
+	0x45,
+	0x2e,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x38,
+	0x45,
+	0x8f,
+	0x85,
+	0x37,
+	0xbd,
+	0x65,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x65,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x66,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x66,
+	0x81,
+	0xb0,
+	0x04,
+	0xde,
+	0x67,
+	0x81,
+	0x38,
+	0xa5,
+	0x90,
+	0xf0,
+	0x41,
+	0x45,
+	0x36,
+	0x85,
+	0x37,
+	0xbd,
+	0x66,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x66,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x67,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x67,
+	0x81,
+	0x80,
+	0x29,
+	0x45,
+	0x8f,
+	0x18,
+	0x7d,
+	0x65,
+	0x81,
+	0x9d,
+	0x65,
+	0x81,
+	0x98,
+	0x7d,
+	0x66,
+	0x81,
+	0x9d,
+	0x66,
+	0x81,
+	0x90,
+	0x04,
+	0xfe,
+	0x67,
+	0x81,
+	0x18,
+	0xa5,
+	0x90,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0x66,
+	0x81,
+	0x9d,
+	0x66,
+	0x81,
+	0x98,
+	0x7d,
+	0x67,
+	0x81,
+	0x9d,
+	0x67,
+	0x81,
+	0xa5,
+	0x2f,
+	0xd0,
+	0x03,
+	0x4c,
+	0xcf,
+	0x29,
+	0xa8,
+	0x10,
+	0x05,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x2f,
+	0x85,
+	0x36,
+	0x98,
+	0x3c,
+	0x45,
+	0x43,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x39,
+	0x45,
+	0x95,
+	0x85,
+	0x37,
+	0xbd,
+	0xd5,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd5,
+	0x80,
+	0x84,
+	0x37,
+	0xbd,
+	0xd6,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd6,
+	0x80,
+	0xb0,
+	0x04,
+	0xde,
+	0xd7,
+	0x80,
+	0x38,
+	0xa5,
+	0x96,
+	0xf0,
+	0x41,
+	0x45,
+	0x36,
+	0x38,
+	0x85,
+	0x37,
+	0xbd,
+	0xd6,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd6,
+	0x80,
+	0x84,
+	0x37,
+	0xbd,
+	0xd7,
+	0x80,
+	0xe5,
+	0x37,
+	0x9d,
+	0xd7,
+	0x80,
+	0x80,
+	0x28,
+	0x45,
+	0x95,
+	0x7d,
+	0xd5,
+	0x80,
+	0x9d,
+	0xd5,
+	0x80,
+	0x98,
+	0x7d,
+	0xd6,
+	0x80,
+	0x9d,
+	0xd6,
+	0x80,
+	0x90,
+	0x04,
+	0xfe,
+	0xd7,
+	0x80,
+	0x18,
+	0xa5,
+	0x96,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0xd6,
+	0x80,
+	0x9d,
+	0xd6,
+	0x80,
+	0x98,
+	0x7d,
+	0xd7,
+	0x80,
+	0x9d,
+	0xd7,
+	0x80,
+	0xa5,
+	0x48,
+	0xf0,
+	0x69,
+	0x3c,
+	0x45,
+	0x2f,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x38,
+	0x45,
+	0x8d,
+	0x85,
+	0x37,
+	0xbd,
+	0x1d,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1d,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x1e,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1e,
+	0x81,
+	0xb0,
+	0x04,
+	0xde,
+	0x1f,
+	0x81,
+	0x38,
+	0xa5,
+	0x8e,
+	0xf0,
+	0x40,
+	0x45,
+	0x36,
+	0x85,
+	0x37,
+	0xbd,
+	0x1e,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1e,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x1f,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x1f,
+	0x81,
+	0x80,
+	0x28,
+	0x45,
+	0x8d,
+	0x7d,
+	0x1d,
+	0x81,
+	0x9d,
+	0x1d,
+	0x81,
+	0x98,
+	0x7d,
+	0x1e,
+	0x81,
+	0x9d,
+	0x1e,
+	0x81,
+	0x90,
+	0x04,
+	0xfe,
+	0x1f,
+	0x81,
+	0x18,
+	0xa5,
+	0x8e,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0x1e,
+	0x81,
+	0x9d,
+	0x1e,
+	0x81,
+	0x98,
+	0x7d,
+	0x1f,
+	0x81,
+	0x9d,
+	0x1f,
+	0x81,
+	0xa5,
+	0x49,
+	0xf0,
+	0x69,
+	0x3c,
+	0x45,
+	0x2f,
+	0xc0,
+	0x80,
+	0xa5,
+	0x36,
+	0x90,
+	0x38,
+	0x45,
+	0x91,
+	0x85,
+	0x37,
+	0xbd,
+	0x65,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x65,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x66,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x66,
+	0x81,
+	0xb0,
+	0x04,
+	0xde,
+	0x67,
+	0x81,
+	0x38,
+	0xa5,
+	0x92,
+	0xf0,
+	0x40,
+	0x45,
+	0x36,
+	0x85,
+	0x37,
+	0xbd,
+	0x66,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x66,
+	0x81,
+	0x84,
+	0x37,
+	0xbd,
+	0x67,
+	0x81,
+	0xe5,
+	0x37,
+	0x9d,
+	0x67,
+	0x81,
+	0x80,
+	0x28,
+	0x45,
+	0x91,
+	0x7d,
+	0x65,
+	0x81,
+	0x9d,
+	0x65,
+	0x81,
+	0x98,
+	0x7d,
+	0x66,
+	0x81,
+	0x9d,
+	0x66,
+	0x81,
+	0x90,
+	0x04,
+	0xfe,
+	0x67,
+	0x81,
+	0x18,
+	0xa5,
+	0x92,
+	0xf0,
+	0x0f,
+	0x45,
+	0x36,
+	0x7d,
+	0x66,
+	0x81,
+	0x9d,
+	0x66,
+	0x81,
+	0x98,
+	0x7d,
+	0x67,
+	0x81,
+	0x9d,
+	0x67,
+	0x81,
+	0xe8,
+	0xe8,
+	0xe8,
+	0x60,
+	0xe6,
+	0x25,
+	0x20,
+	0xdb,
+	0x2a,
+	0x20,
+	0x16,
+	0x2e,
+	0x20,
+	0xff,
+	0x2f,
+	0x20,
+	0x2e,
+	0x31,
+	0x20,
+	0x92,
+	0x34,
+	0x64,
+	0x25,
+	0x60,
+	0xa5,
+	0x41,
+	0xc9,
+	0x80,
+	0x66,
+	0x41,
+	0x66,
+	0x40,
+	0x66,
+	0x3f,
+	0x66,
+	0x3e,
+	0xc9,
+	0x80,
+	0x66,
+	0x41,
+	0x66,
+	0x40,
+	0x66,
+	0x3f,
+	0x66,
+	0x3e,
+	0xc9,
+	0x80,
+	0x66,
+	0x41,
+	0x66,
+	0x40,
+	0x66,
+	0x3f,
+	0x66,
+	0x3e,
+	0xc9,
+	0x80,
+	0x66,
+	0x41,
+	0x66,
+	0x40,
+	0x66,
+	0x3f,
+	0x66,
+	0x3e,
+	0x60,
+	0xa5,
+	0x34,
+	0x45,
+	0x32,
+	0x85,
+	0x37,
+	0x84,
+	0x38,
+	0xa5,
+	0x35,
+	0x45,
+	0x32,
+	0x18,
+	0x65,
+	0x38,
+	0x85,
+	0x38,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x39,
+	0xa5,
+	0x34,
+	0x45,
+	0x33,
+	0x18,
+	0x65,
+	0x38,
+	0x85,
+	0x38,
+	0x98,
+	0x65,
+	0x39,
+	0x85,
+	0x39,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0x85,
+	0x3a,
+	0xa5,
+	0x35,
+	0x45,
+	0x33,
+	0x18,
+	0x65,
+	0x39,
+	0x85,
+	0x39,
+	0x98,
+	0x65,
+	0x3a,
+	0x85,
+	0x3a,
+	0xa5,
+	0x36,
+	0x45,
+	0x32,
+	0x18,
+	0x65,
+	0x39,
+	0x85,
+	0x39,
+	0x98,
+	0x65,
+	0x3a,
+	0x85,
+	0x3a,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0x85,
+	0x3b,
+	0xa5,
+	0x36,
+	0x45,
+	0x33,
+	0x18,
+	0x65,
+	0x3a,
+	0x85,
+	0x3a,
+	0x98,
+	0x65,
+	0x3b,
+	0x85,
+	0x3b,
+	0xa5,
+	0x33,
+	0x10,
+	0x13,
+	0x38,
+	0xa5,
+	0x39,
+	0xe5,
+	0x34,
+	0x85,
+	0x39,
+	0xa5,
+	0x3a,
+	0xe5,
+	0x35,
+	0x85,
+	0x3a,
+	0xa5,
+	0x3b,
+	0xe5,
+	0x36,
+	0x85,
+	0x3b,
+	0x64,
+	0x32,
+	0xa5,
+	0x37,
+	0x29,
+	0x0f,
+	0xc9,
+	0x08,
+	0xd0,
+	0x02,
+	0xe6,
+	0x32,
+	0xa2,
+	0x04,
+	0xa5,
+	0x3b,
+	0xc9,
+	0x80,
+	0x66,
+	0x3b,
+	0x66,
+	0x3a,
+	0x66,
+	0x39,
+	0x66,
+	0x38,
+	0x66,
+	0x37,
+	0xca,
+	0xd0,
+	0xef,
+	0xa5,
+	0x3b,
+	0xf0,
+	0x22,
+	0x10,
+	0x13,
+	0x1a,
+	0xd0,
+	0x04,
+	0xa5,
+	0x3a,
+	0x30,
+	0x1d,
+	0x64,
+	0x3e,
+	0x64,
+	0x3f,
+	0x64,
+	0x40,
+	0xa9,
+	0x80,
+	0x85,
+	0x41,
+	0x18,
+	0x60,
+	0xa9,
+	0xff,
+	0x85,
+	0x3e,
+	0x85,
+	0x3f,
+	0x85,
+	0x40,
+	0x4a,
+	0x85,
+	0x41,
+	0x18,
+	0x60,
+	0xa5,
+	0x3a,
+	0x30,
+	0xef,
+	0xa0,
+	0x04,
+	0x53,
+	0x37,
+	0x00,
+	0x3e,
+	0x00,
+	0xa5,
+	0x32,
+	0xd0,
+	0x03,
+	0x2a,
+	0x1a,
+	0x6a,
+	0x60,
+	0xa9,
+	0x80,
+	0x38,
+	0xed,
+	0x17,
+	0x6b,
+	0x85,
+	0x74,
+	0x64,
+	0x6d,
+	0xa0,
+	0x09,
+	0x53,
+	0xc3,
+	0x80,
+	0x7b,
+	0x00,
+	0xa0,
+	0x02,
+	0x53,
+	0x0d,
+	0x7d,
+	0x32,
+	0x00,
+	0xad,
+	0x07,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0xfb,
+	0x7c,
+	0x85,
+	0x75,
+	0xbd,
+	0xfc,
+	0x7c,
+	0x85,
+	0x76,
+	0xad,
+	0x08,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0xfb,
+	0x7c,
+	0x85,
+	0x77,
+	0xbd,
+	0xfc,
+	0x7c,
+	0x85,
+	0x78,
+	0xad,
+	0x09,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0xfb,
+	0x7c,
+	0x85,
+	0x79,
+	0xbd,
+	0xfc,
+	0x7c,
+	0x85,
+	0x7a,
+	0x64,
+	0x84,
+	0x64,
+	0x85,
+	0x64,
+	0x86,
+	0xa6,
+	0x6d,
+	0xb5,
+	0xdc,
+	0xf0,
+	0x07,
+	0xa9,
+	0x80,
+	0x85,
+	0x86,
+	0x4c,
+	0x7c,
+	0x2d,
+	0x38,
+	0xa5,
+	0x7b,
+	0xe5,
+	0x7e,
+	0x85,
+	0x7b,
+	0xa5,
+	0x7c,
+	0xe5,
+	0x7f,
+	0x85,
+	0x7c,
+	0xa5,
+	0x7d,
+	0xe5,
+	0x80,
+	0xa8,
+	0xa5,
+	0x7c,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xf0,
+	0x12,
+	0x98,
+	0x30,
+	0x09,
+	0xa9,
+	0xff,
+	0x85,
+	0x7b,
+	0x4a,
+	0x85,
+	0x7c,
+	0x80,
+	0x06,
+	0xa9,
+	0x80,
+	0x85,
+	0x7c,
+	0x64,
+	0x7b,
+	0x38,
+	0xa5,
+	0x81,
+	0xe5,
+	0x7e,
+	0x85,
+	0x81,
+	0xa5,
+	0x82,
+	0xe5,
+	0x7f,
+	0x85,
+	0x82,
+	0xa5,
+	0x83,
+	0xe5,
+	0x80,
+	0xa8,
+	0xa5,
+	0x82,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xf0,
+	0x12,
+	0x98,
+	0x30,
+	0x09,
+	0xa9,
+	0xff,
+	0x85,
+	0x81,
+	0x4a,
+	0x85,
+	0x82,
+	0x80,
+	0x06,
+	0xa9,
+	0x80,
+	0x85,
+	0x82,
+	0x64,
+	0x81,
+	0xa0,
+	0x02,
+	0x53,
+	0x81,
+	0x00,
+	0x34,
+	0x00,
+	0x20,
+	0x50,
+	0x39,
+	0x20,
+	0xe7,
+	0x29,
+	0x90,
+	0x0e,
+	0xe6,
+	0x3e,
+	0xd0,
+	0x0a,
+	0xe6,
+	0x3f,
+	0xd0,
+	0x06,
+	0xe6,
+	0x40,
+	0xd0,
+	0x02,
+	0xe6,
+	0x41,
+	0xa2,
+	0x00,
+	0xa5,
+	0x7b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x42,
+	0xa5,
+	0x7c,
+	0x10,
+	0x01,
+	0xca,
+	0x65,
+	0x3f,
+	0x85,
+	0x43,
+	0x8a,
+	0x65,
+	0x40,
+	0x85,
+	0x44,
+	0x8a,
+	0x65,
+	0x41,
+	0x85,
+	0x45,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x7b,
+	0x85,
+	0x34,
+	0xa9,
+	0x00,
+	0xe5,
+	0x7c,
+	0x85,
+	0x35,
+	0xa5,
+	0x6d,
+	0x49,
+	0x07,
+	0xaa,
+	0xda,
+	0xbd,
+	0x0f,
+	0x7d,
+	0x85,
+	0x32,
+	0xbd,
+	0x10,
+	0x7d,
+	0x85,
+	0x33,
+	0xa5,
+	0x7c,
+	0x10,
+	0x05,
+	0x20,
+	0x93,
+	0x39,
+	0x80,
+	0x03,
+	0x20,
+	0x50,
+	0x39,
+	0xa0,
+	0x04,
+	0x53,
+	0x3e,
+	0x00,
+	0x46,
+	0x00,
+	0xfa,
+	0xbd,
+	0x11,
+	0x7d,
+	0x85,
+	0x34,
+	0xbd,
+	0x12,
+	0x7d,
+	0x85,
+	0x35,
+	0xbd,
+	0x13,
+	0x7d,
+	0x85,
+	0x36,
+	0xa0,
+	0x02,
+	0x53,
+	0x81,
+	0x00,
+	0x32,
+	0x00,
+	0x20,
+	0x12,
+	0x2a,
+	0xa5,
+	0x46,
+	0xe5,
+	0x3e,
+	0x85,
+	0x46,
+	0xa5,
+	0x47,
+	0xe5,
+	0x3f,
+	0x85,
+	0x47,
+	0xa5,
+	0x48,
+	0xe5,
+	0x40,
+	0x85,
+	0x48,
+	0xa2,
+	0x00,
+	0xa5,
+	0x49,
+	0x10,
+	0x01,
+	0xca,
+	0xe5,
+	0x41,
+	0x85,
+	0x49,
+	0x8a,
+	0xa6,
+	0x41,
+	0x30,
+	0x04,
+	0xe9,
+	0x00,
+	0x80,
+	0x02,
+	0xe9,
+	0xff,
+	0x10,
+	0x0f,
+	0xc9,
+	0xff,
+	0xd0,
+	0x04,
+	0xa5,
+	0x49,
+	0x30,
+	0x19,
+	0xa9,
+	0x80,
+	0x85,
+	0x49,
+	0x0a,
+	0x80,
+	0x0c,
+	0xd0,
+	0x04,
+	0xa5,
+	0x49,
+	0x10,
+	0x0c,
+	0xa9,
+	0x7f,
+	0x85,
+	0x49,
+	0xa9,
+	0xff,
+	0x85,
+	0x48,
+	0x85,
+	0x47,
+	0x85,
+	0x46,
+	0xa9,
+	0x00,
+	0xa8,
+	0x38,
+	0xe5,
+	0x46,
+	0x85,
+	0x46,
+	0x98,
+	0xe5,
+	0x47,
+	0x85,
+	0x47,
+	0x98,
+	0xe5,
+	0x48,
+	0x85,
+	0x48,
+	0x98,
+	0xe5,
+	0x49,
+	0x85,
+	0x49,
+	0xa5,
+	0x45,
+	0x30,
+	0x32,
+	0x06,
+	0x42,
+	0x26,
+	0x43,
+	0x26,
+	0x44,
+	0x26,
+	0x45,
+	0xa5,
+	0x42,
+	0x05,
+	0x43,
+	0x05,
+	0x44,
+	0x05,
+	0x45,
+	0xd0,
+	0x06,
+	0x64,
+	0x32,
+	0x64,
+	0x33,
+	0x80,
+	0x34,
+	0xa5,
+	0x49,
+	0x30,
+	0x18,
+	0xa5,
+	0x45,
+	0x30,
+	0x14,
+	0x06,
+	0x42,
+	0x26,
+	0x43,
+	0x26,
+	0x44,
+	0x26,
+	0x45,
+	0x06,
+	0x46,
+	0x26,
+	0x47,
+	0x26,
+	0x48,
+	0x26,
+	0x49,
+	0x80,
+	0xe6,
+	0x80,
+	0x6e,
+	0xa0,
+	0x02,
+	0x53,
+	0x48,
+	0x00,
+	0x32,
+	0x00,
+	0x53,
+	0x44,
+	0x00,
+	0x34,
+	0x00,
+	0xa5,
+	0x34,
+	0x05,
+	0x35,
+	0xd0,
+	0x03,
+	0x4c,
+	0x3d,
+	0x2d,
+	0x20,
+	0x2f,
+	0x39,
+	0x38,
+	0xa5,
+	0x75,
+	0xe5,
+	0x32,
+	0xa5,
+	0x76,
+	0xe5,
+	0x33,
+	0xb0,
+	0x4b,
+	0x38,
+	0xa5,
+	0x32,
+	0xe5,
+	0x79,
+	0xa5,
+	0x33,
+	0xe5,
+	0x7a,
+	0xb0,
+	0x40,
+	0x38,
+	0xa5,
+	0x32,
+	0xe5,
+	0x77,
+	0xa5,
+	0x33,
+	0xe5,
+	0x78,
+	0xb0,
+	0x62,
+	0xa0,
+	0x02,
+	0x53,
+	0x77,
+	0x00,
+	0x34,
+	0x00,
+	0x38,
+	0xa5,
+	0x77,
+	0xe5,
+	0x32,
+	0xaa,
+	0x64,
+	0x32,
+	0xa5,
+	0x78,
+	0xe5,
+	0x33,
+	0x86,
+	0x33,
+	0x4a,
+	0x66,
+	0x33,
+	0x66,
+	0x32,
+	0x4a,
+	0x90,
+	0x08,
+	0x66,
+	0x33,
+	0x66,
+	0x32,
+	0x46,
+	0x35,
+	0x66,
+	0x34,
+	0x20,
+	0x2f,
+	0x39,
+	0xa5,
+	0x32,
+	0x85,
+	0x84,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0x84,
+	0x85,
+	0x85,
+	0x80,
+	0x66,
+	0xa2,
+	0x00,
+	0xa5,
+	0x82,
+	0x10,
+	0x01,
+	0xca,
+	0x86,
+	0x83,
+	0xa2,
+	0x00,
+	0xa5,
+	0x7c,
+	0x10,
+	0x01,
+	0xca,
+	0x86,
+	0x7d,
+	0x38,
+	0xa5,
+	0x81,
+	0xe5,
+	0x7b,
+	0xa5,
+	0x82,
+	0xe5,
+	0x7c,
+	0xa5,
+	0x83,
+	0xe5,
+	0x7d,
+	0x10,
+	0x06,
+	0xa9,
+	0x80,
+	0x85,
+	0x86,
+	0x80,
+	0x3f,
+	0xa9,
+	0x80,
+	0x85,
+	0x84,
+	0x80,
+	0x39,
+	0x38,
+	0xa5,
+	0x79,
+	0xe5,
+	0x77,
+	0x85,
+	0x34,
+	0xa5,
+	0x7a,
+	0xe5,
+	0x78,
+	0x85,
+	0x35,
+	0x38,
+	0xa5,
+	0x79,
+	0xe5,
+	0x32,
+	0xaa,
+	0x64,
+	0x32,
+	0xa5,
+	0x7a,
+	0xe5,
+	0x33,
+	0x86,
+	0x33,
+	0x4a,
+	0x66,
+	0x33,
+	0x66,
+	0x32,
+	0x4a,
+	0x90,
+	0x08,
+	0x66,
+	0x33,
+	0x66,
+	0x32,
+	0x46,
+	0x35,
+	0x66,
+	0x34,
+	0x20,
+	0x2f,
+	0x39,
+	0xa5,
+	0x32,
+	0x85,
+	0x85,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0x85,
+	0x85,
+	0x86,
+	0x64,
+	0x2e,
+	0x64,
+	0x6c,
+	0xa6,
+	0x6c,
+	0xb5,
+	0x84,
+	0x45,
+	0x74,
+	0x85,
+	0x32,
+	0x84,
+	0x33,
+	0xa5,
+	0x6d,
+	0x49,
+	0x03,
+	0x18,
+	0x65,
+	0x6c,
+	0xaa,
+	0xbd,
+	0x79,
+	0x6b,
+	0x4d,
+	0x17,
+	0x6b,
+	0x18,
+	0x65,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0x65,
+	0x33,
+	0x06,
+	0x32,
+	0x2a,
+	0xc5,
+	0x2e,
+	0x90,
+	0x06,
+	0xf0,
+	0x04,
+	0x85,
+	0x2e,
+	0x86,
+	0x2f,
+	0x9d,
+	0x7f,
+	0x6b,
+	0xe6,
+	0x6c,
+	0xa5,
+	0x6c,
+	0xc9,
+	0x03,
+	0xd0,
+	0xc8,
+	0x38,
+	0xa9,
+	0x80,
+	0xfd,
+	0x7d,
+	0x6b,
+	0xfd,
+	0x7e,
+	0x6b,
+	0xfd,
+	0x7f,
+	0x6b,
+	0xf0,
+	0x09,
+	0xa6,
+	0x2f,
+	0x18,
+	0x7d,
+	0x7f,
+	0x6b,
+	0x9d,
+	0x7f,
+	0x6b,
+	0xe6,
+	0x6d,
+	0xa5,
+	0x6d,
+	0xc9,
+	0x02,
+	0xf0,
+	0x3e,
+	0xa0,
+	0x09,
+	0x53,
+	0xcc,
+	0x80,
+	0x7b,
+	0x00,
+	0xa0,
+	0x02,
+	0x53,
+	0x14,
+	0x7d,
+	0x32,
+	0x00,
+	0xad,
+	0x0a,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x01,
+	0x7d,
+	0x85,
+	0x75,
+	0xbd,
+	0x02,
+	0x7d,
+	0x85,
+	0x76,
+	0xad,
+	0x0b,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x01,
+	0x7d,
+	0x85,
+	0x77,
+	0xbd,
+	0x02,
+	0x7d,
+	0x85,
+	0x78,
+	0xad,
+	0x0c,
+	0x7d,
+	0x0a,
+	0xaa,
+	0xbd,
+	0x01,
+	0x7d,
+	0x85,
+	0x79,
+	0xbd,
+	0x02,
+	0x7d,
+	0x85,
+	0x7a,
+	0x4c,
+	0x20,
+	0x2b,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x33,
+	0xbe,
+	0x36,
+	0x00,
+	0x53,
+	0x35,
+	0xbe,
+	0x38,
+	0x00,
+	0xa0,
+	0x00,
+	0xfc,
+	0xbd,
+	0xd5,
+	0x80,
+	0x0a,
+	0xbd,
+	0xd6,
+	0x80,
+	0x69,
+	0x00,
+	0x99,
+	0xd5,
+	0x80,
+	0xbd,
+	0xd7,
+	0x80,
+	0x69,
+	0x00,
+	0x99,
+	0xd6,
+	0x80,
+	0xbd,
+	0x1d,
+	0x81,
+	0x0a,
+	0xbd,
+	0x1e,
+	0x81,
+	0x69,
+	0x00,
+	0x99,
+	0x1d,
+	0x81,
+	0xbd,
+	0x1f,
+	0x81,
+	0x69,
+	0x00,
+	0x99,
+	0x1e,
+	0x81,
+	0xbd,
+	0x65,
+	0x81,
+	0x0a,
+	0xbd,
+	0x66,
+	0x81,
+	0x69,
+	0x00,
+	0x99,
+	0x65,
+	0x81,
+	0xbd,
+	0x67,
+	0x81,
+	0x69,
+	0x00,
+	0x99,
+	0x66,
+	0x81,
+	0xc8,
+	0xc8,
+	0xe8,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x48,
+	0xd0,
+	0xbb,
+	0xa9,
+	0x62,
+	0x85,
+	0x50,
+	0xa9,
+	0x53,
+	0x85,
+	0x51,
+	0x64,
+	0x2e,
+	0xa2,
+	0x00,
+	0x64,
+	0x3e,
+	0x64,
+	0x3f,
+	0x64,
+	0x40,
+	0x64,
+	0x42,
+	0x64,
+	0x43,
+	0x64,
+	0x44,
+	0x64,
+	0x46,
+	0x64,
+	0x47,
+	0x64,
+	0x48,
+	0xb2,
+	0x50,
+	0x85,
+	0x2f,
+	0x5d,
+	0xd5,
+	0x80,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xd6,
+	0x80,
+	0xf0,
+	0x12,
+	0x48,
+	0x45,
+	0x2f,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x2f,
+	0x85,
+	0x40,
+	0xa5,
+	0x2f,
+	0x5d,
+	0x1d,
+	0x81,
+	0x18,
+	0x65,
+	0x42,
+	0x85,
+	0x42,
+	0x98,
+	0x65,
+	0x43,
+	0x85,
+	0x43,
+	0x90,
+	0x03,
+	0xe6,
+	0x44,
+	0x18,
+	0xbd,
+	0x1e,
+	0x81,
+	0xf0,
+	0x12,
+	0x48,
+	0x45,
+	0x2f,
+	0x65,
+	0x43,
+	0x85,
+	0x43,
+	0x98,
+	0x65,
+	0x44,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x2f,
+	0x85,
+	0x44,
+	0xa5,
+	0x2f,
+	0x5d,
+	0x65,
+	0x81,
+	0x18,
+	0x65,
+	0x46,
+	0x85,
+	0x46,
+	0x98,
+	0x65,
+	0x47,
+	0x85,
+	0x47,
+	0x90,
+	0x03,
+	0xe6,
+	0x48,
+	0x18,
+	0xbd,
+	0x66,
+	0x81,
+	0xf0,
+	0x12,
+	0x48,
+	0x45,
+	0x2f,
+	0x65,
+	0x47,
+	0x85,
+	0x47,
+	0x98,
+	0x65,
+	0x48,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x2f,
+	0x85,
+	0x48,
+	0xe6,
+	0x50,
+	0xd0,
+	0x02,
+	0xe6,
+	0x51,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x30,
+	0xf0,
+	0x03,
+	0x4c,
+	0x88,
+	0x2e,
+	0xa6,
+	0x2e,
+	0x06,
+	0x3e,
+	0x26,
+	0x3f,
+	0x26,
+	0x40,
+	0x06,
+	0x3e,
+	0xa9,
+	0x00,
+	0x65,
+	0x3f,
+	0x9d,
+	0xad,
+	0x81,
+	0xa9,
+	0x00,
+	0x65,
+	0x40,
+	0x9d,
+	0xae,
+	0x81,
+	0x06,
+	0x42,
+	0x26,
+	0x43,
+	0x26,
+	0x44,
+	0x06,
+	0x42,
+	0xa9,
+	0x00,
+	0x65,
+	0x43,
+	0x85,
+	0x42,
+	0xa9,
+	0x00,
+	0x65,
+	0x44,
+	0x85,
+	0x43,
+	0x38,
+	0xa5,
+	0x42,
+	0xe5,
+	0x38,
+	0xa5,
+	0x43,
+	0xe5,
+	0x39,
+	0x30,
+	0x06,
+	0xa5,
+	0x38,
+	0xa4,
+	0x39,
+	0x80,
+	0x15,
+	0x38,
+	0xa5,
+	0x42,
+	0xe5,
+	0x36,
+	0xa5,
+	0x43,
+	0xe5,
+	0x37,
+	0x30,
+	0x06,
+	0xa5,
+	0x42,
+	0xa4,
+	0x43,
+	0x80,
+	0x04,
+	0xa5,
+	0x36,
+	0xa4,
+	0x37,
+	0x9d,
+	0xdf,
+	0x81,
+	0x98,
+	0x9d,
+	0xe0,
+	0x81,
+	0x06,
+	0x46,
+	0x26,
+	0x47,
+	0x26,
+	0x48,
+	0x06,
+	0x46,
+	0xa9,
+	0x00,
+	0x65,
+	0x47,
+	0x85,
+	0x46,
+	0xa9,
+	0x00,
+	0x65,
+	0x48,
+	0x85,
+	0x47,
+	0x38,
+	0xa5,
+	0x46,
+	0xe5,
+	0x38,
+	0xa5,
+	0x47,
+	0xe5,
+	0x39,
+	0x30,
+	0x06,
+	0xa5,
+	0x38,
+	0xa4,
+	0x39,
+	0x80,
+	0x15,
+	0x38,
+	0xa5,
+	0x46,
+	0xe5,
+	0x36,
+	0xa5,
+	0x47,
+	0xe5,
+	0x37,
+	0x30,
+	0x06,
+	0xa5,
+	0x46,
+	0xa4,
+	0x47,
+	0x80,
+	0x04,
+	0xa5,
+	0x36,
+	0xa4,
+	0x37,
+	0x9d,
+	0x11,
+	0x82,
+	0x98,
+	0x9d,
+	0x12,
+	0x82,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x18,
+	0xd0,
+	0x3b,
+	0x9e,
+	0xad,
+	0x81,
+	0x9e,
+	0xae,
+	0x81,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x39,
+	0x30,
+	0x06,
+	0xa5,
+	0x38,
+	0xa4,
+	0x39,
+	0x80,
+	0x15,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x36,
+	0xa9,
+	0x00,
+	0xe5,
+	0x37,
+	0x30,
+	0x06,
+	0xa9,
+	0x00,
+	0xa0,
+	0x00,
+	0x80,
+	0x04,
+	0xa5,
+	0x36,
+	0xa4,
+	0x37,
+	0x9d,
+	0xdf,
+	0x81,
+	0x9d,
+	0x11,
+	0x82,
+	0x98,
+	0x9d,
+	0xe0,
+	0x81,
+	0x9d,
+	0x12,
+	0x82,
+	0xe8,
+	0xe8,
+	0x86,
+	0x2e,
+	0xe0,
+	0x32,
+	0xb0,
+	0x03,
+	0x4c,
+	0x74,
+	0x2e,
+	0x60,
+	0xa5,
+	0x72,
+	0x64,
+	0x38,
+	0x64,
+	0x39,
+	0x05,
+	0x73,
+	0xd0,
+	0x05,
+	0x64,
+	0x32,
+	0x64,
+	0x33,
+	0x60,
+	0x64,
+	0x2f,
+	0x64,
+	0x3e,
+	0x64,
+	0x3f,
+	0x64,
+	0x40,
+	0xa2,
+	0x00,
+	0xa0,
+	0x00,
+	0xa5,
+	0x2f,
+	0xf0,
+	0x05,
+	0xc9,
+	0x04,
+	0xf0,
+	0x01,
+	0xc8,
+	0x84,
+	0x30,
+	0x64,
+	0x2e,
+	0xa4,
+	0x30,
+	0xa5,
+	0x2e,
+	0xf0,
+	0x05,
+	0xc9,
+	0x04,
+	0xf0,
+	0x01,
+	0xc8,
+	0xbd,
+	0xae,
+	0x81,
+	0x85,
+	0x31,
+	0xbd,
+	0xad,
+	0x81,
+	0xc0,
+	0x01,
+	0x90,
+	0x08,
+	0xf0,
+	0x03,
+	0x0a,
+	0x26,
+	0x31,
+	0x0a,
+	0x26,
+	0x31,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0xa5,
+	0x31,
+	0xa8,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x30,
+	0x06,
+	0x90,
+	0x08,
+	0xe6,
+	0x40,
+	0x80,
+	0x04,
+	0xb0,
+	0x02,
+	0xc6,
+	0x40,
+	0xe8,
+	0xe8,
+	0xa5,
+	0x2e,
+	0x1a,
+	0x85,
+	0x2e,
+	0xc9,
+	0x05,
+	0xd0,
+	0xbd,
+	0xa5,
+	0x2f,
+	0x1a,
+	0x85,
+	0x2f,
+	0xc9,
+	0x05,
+	0xd0,
+	0xa5,
+	0xa2,
+	0x06,
+	0xa5,
+	0x40,
+	0xc9,
+	0x80,
+	0x6a,
+	0x66,
+	0x3f,
+	0x66,
+	0x3e,
+	0xca,
+	0xd0,
+	0xf6,
+	0xa5,
+	0x3f,
+	0x85,
+	0x39,
+	0xa5,
+	0x3e,
+	0x90,
+	0x05,
+	0x1a,
+	0xd0,
+	0x02,
+	0xe6,
+	0x39,
+	0x85,
+	0x38,
+	0xa5,
+	0x72,
+	0x85,
+	0x34,
+	0xa6,
+	0x73,
+	0x86,
+	0x35,
+	0xa6,
+	0x70,
+	0x10,
+	0x30,
+	0xa0,
+	0x00,
+	0x98,
+	0x38,
+	0xe5,
+	0x6e,
+	0x85,
+	0x32,
+	0x98,
+	0xe5,
+	0x6f,
+	0x85,
+	0x33,
+	0x98,
+	0xe5,
+	0x70,
+	0xf0,
+	0x0c,
+	0x46,
+	0x35,
+	0x66,
+	0x34,
+	0x4a,
+	0x66,
+	0x33,
+	0x66,
+	0x32,
+	0xaa,
+	0xd0,
+	0xf4,
+	0x20,
+	0x2f,
+	0x39,
+	0x18,
+	0xa5,
+	0x32,
+	0x65,
+	0x38,
+	0x85,
+	0x32,
+	0xa5,
+	0x33,
+	0x65,
+	0x39,
+	0x85,
+	0x33,
+	0x80,
+	0x26,
+	0x8a,
+	0xf0,
+	0x0c,
+	0x46,
+	0x35,
+	0x66,
+	0x34,
+	0x4a,
+	0x66,
+	0x6f,
+	0x66,
+	0x6e,
+	0xaa,
+	0xd0,
+	0xf4,
+	0xa0,
+	0x02,
+	0x53,
+	0x6e,
+	0x00,
+	0x32,
+	0x00,
+	0x20,
+	0x2f,
+	0x39,
+	0x38,
+	0xa5,
+	0x38,
+	0xe5,
+	0x32,
+	0x85,
+	0x32,
+	0xa5,
+	0x39,
+	0xe5,
+	0x33,
+	0x85,
+	0x33,
+	0xa2,
+	0x00,
+	0x38,
+	0xbd,
+	0xad,
+	0x81,
+	0xe5,
+	0x32,
+	0xa8,
+	0xbd,
+	0xae,
+	0x81,
+	0xe5,
+	0x33,
+	0x30,
+	0x10,
+	0xc9,
+	0x03,
+	0x90,
+	0x1a,
+	0xd0,
+	0x04,
+	0xc0,
+	0xff,
+	0x90,
+	0x14,
+	0xa0,
+	0xff,
+	0xa9,
+	0x03,
+	0x80,
+	0x0e,
+	0xc9,
+	0xfc,
+	0x90,
+	0x06,
+	0xd0,
+	0x08,
+	0xc0,
+	0x00,
+	0xb0,
+	0x04,
+	0xa0,
+	0x00,
+	0xa9,
+	0xfc,
+	0x9d,
+	0xae,
+	0x81,
+	0x98,
+	0x9d,
+	0xad,
+	0x81,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x32,
+	0xd0,
+	0xc7,
+	0x60,
+	0x20,
+	0x6e,
+	0x31,
+	0xa9,
+	0xad,
+	0x85,
+	0x4a,
+	0xa9,
+	0x81,
+	0x85,
+	0x4b,
+	0x20,
+	0xc1,
+	0x32,
+	0xa0,
+	0x32,
+	0x53,
+	0x43,
+	0x82,
+	0xad,
+	0x81,
+	0xa9,
+	0xdf,
+	0x85,
+	0x4a,
+	0xa9,
+	0x81,
+	0x85,
+	0x4b,
+	0x20,
+	0xc1,
+	0x32,
+	0x20,
+	0xfe,
+	0x33,
+	0xa0,
+	0x32,
+	0x53,
+	0x43,
+	0x82,
+	0xdf,
+	0x81,
+	0xa9,
+	0x11,
+	0x85,
+	0x4a,
+	0xa9,
+	0x82,
+	0x85,
+	0x4b,
+	0x20,
+	0xc1,
+	0x32,
+	0x20,
+	0xfe,
+	0x33,
+	0xa0,
+	0x32,
+	0x53,
+	0x43,
+	0x82,
+	0x11,
+	0x82,
+	0x60,
+	0xa5,
+	0x28,
+	0x49,
+	0x04,
+	0x85,
+	0x2e,
+	0x38,
+	0xa5,
+	0x29,
+	0x1a,
+	0xe5,
+	0x28,
+	0x49,
+	0x14,
+	0x85,
+	0x38,
+	0x84,
+	0x39,
+	0x64,
+	0x3a,
+	0x64,
+	0x3b,
+	0xa2,
+	0x00,
+	0xa5,
+	0x3a,
+	0x85,
+	0x32,
+	0xa5,
+	0x3b,
+	0x85,
+	0x33,
+	0xa9,
+	0x14,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0xda,
+	0x20,
+	0x0b,
+	0x39,
+	0xfa,
+	0x18,
+	0xa5,
+	0x32,
+	0x65,
+	0x2e,
+	0x9d,
+	0x75,
+	0x82,
+	0x18,
+	0xa5,
+	0x3a,
+	0x65,
+	0x38,
+	0x85,
+	0x3a,
+	0xa5,
+	0x3b,
+	0x65,
+	0x39,
+	0x85,
+	0x3b,
+	0xe8,
+	0xe0,
+	0x05,
+	0xd0,
+	0xd3,
+	0xbd,
+	0x74,
+	0x82,
+	0x1a,
+	0x9d,
+	0x75,
+	0x82,
+	0xa5,
+	0x26,
+	0x49,
+	0x04,
+	0x85,
+	0x2e,
+	0x38,
+	0xa5,
+	0x27,
+	0x1a,
+	0xe5,
+	0x26,
+	0x49,
+	0x10,
+	0x85,
+	0x38,
+	0x84,
+	0x39,
+	0x64,
+	0x3a,
+	0x64,
+	0x3b,
+	0xa2,
+	0x00,
+	0xa5,
+	0x3a,
+	0x85,
+	0x32,
+	0xa5,
+	0x3b,
+	0x85,
+	0x33,
+	0xa9,
+	0x10,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0xda,
+	0x20,
+	0x0b,
+	0x39,
+	0xfa,
+	0x18,
+	0xa5,
+	0x32,
+	0x65,
+	0x2e,
+	0x9d,
+	0x7b,
+	0x82,
+	0x18,
+	0xa5,
+	0x3a,
+	0x65,
+	0x38,
+	0x85,
+	0x3a,
+	0xa5,
+	0x3b,
+	0x65,
+	0x39,
+	0x85,
+	0x3b,
+	0xe8,
+	0xe0,
+	0x05,
+	0xd0,
+	0xd3,
+	0xbd,
+	0x7a,
+	0x82,
+	0x1a,
+	0x9d,
+	0x7b,
+	0x82,
+	0x60,
+	0xa5,
+	0x2e,
+	0xa2,
+	0x00,
+	0xe8,
+	0xdd,
+	0x75,
+	0x82,
+	0xb0,
+	0xfa,
+	0xca,
+	0x8a,
+	0x0a,
+	0x18,
+	0x60,
+	0xa5,
+	0x2f,
+	0xa2,
+	0x00,
+	0xe8,
+	0xdd,
+	0x7b,
+	0x82,
+	0xb0,
+	0xfa,
+	0xca,
+	0x8a,
+	0x0a,
+	0x18,
+	0x60,
+	0xb1,
+	0x4a,
+	0x85,
+	0x38,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x38,
+	0xa5,
+	0x2e,
+	0xfd,
+	0x75,
+	0x82,
+	0x85,
+	0x31,
+	0xf0,
+	0x0f,
+	0xc8,
+	0x38,
+	0xbd,
+	0x76,
+	0x82,
+	0xfd,
+	0x75,
+	0x82,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0x20,
+	0x6f,
+	0x32,
+	0x60,
+	0xb1,
+	0x4a,
+	0x85,
+	0x38,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x38,
+	0xa5,
+	0x2f,
+	0xfd,
+	0x7b,
+	0x82,
+	0x85,
+	0x31,
+	0xf0,
+	0x13,
+	0x18,
+	0x98,
+	0x69,
+	0x09,
+	0xa8,
+	0x38,
+	0xbd,
+	0x7c,
+	0x82,
+	0xfd,
+	0x7b,
+	0x82,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0x20,
+	0x6f,
+	0x32,
+	0x60,
+	0x38,
+	0xb1,
+	0x4a,
+	0xe5,
+	0x38,
+	0x85,
+	0x32,
+	0xc8,
+	0xb1,
+	0x4a,
+	0xa0,
+	0x00,
+	0xe5,
+	0x39,
+	0x85,
+	0x33,
+	0x10,
+	0x0c,
+	0x38,
+	0x98,
+	0xe5,
+	0x32,
+	0x85,
+	0x32,
+	0x98,
+	0xe5,
+	0x33,
+	0x85,
+	0x33,
+	0xc8,
+	0x5a,
+	0xa5,
+	0x32,
+	0x45,
+	0x31,
+	0x85,
+	0x32,
+	0x84,
+	0x4c,
+	0xa5,
+	0x33,
+	0x45,
+	0x31,
+	0x18,
+	0x65,
+	0x4c,
+	0x85,
+	0x33,
+	0x20,
+	0x2f,
+	0x39,
+	0x7a,
+	0xf0,
+	0x0e,
+	0x38,
+	0xa5,
+	0x38,
+	0xe5,
+	0x32,
+	0x85,
+	0x38,
+	0xa5,
+	0x39,
+	0xe5,
+	0x33,
+	0x85,
+	0x39,
+	0x60,
+	0x18,
+	0xa5,
+	0x38,
+	0x65,
+	0x32,
+	0x85,
+	0x38,
+	0xa5,
+	0x39,
+	0x65,
+	0x33,
+	0x85,
+	0x39,
+	0x60,
+	0x64,
+	0x30,
+	0x64,
+	0x2f,
+	0x64,
+	0x2e,
+	0xa5,
+	0x2f,
+	0xcd,
+	0x7b,
+	0x82,
+	0xb0,
+	0x33,
+	0xa5,
+	0x2e,
+	0xcd,
+	0x75,
+	0x82,
+	0xb0,
+	0x0d,
+	0xb2,
+	0x4a,
+	0x85,
+	0x38,
+	0xa0,
+	0x01,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x4c,
+	0xd1,
+	0x33,
+	0xcd,
+	0x79,
+	0x82,
+	0xf0,
+	0x10,
+	0x90,
+	0x0e,
+	0xa0,
+	0x08,
+	0xb1,
+	0x4a,
+	0x85,
+	0x38,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x4c,
+	0xd1,
+	0x33,
+	0x20,
+	0x07,
+	0x32,
+	0xa8,
+	0x20,
+	0x25,
+	0x32,
+	0x4c,
+	0xd1,
+	0x33,
+	0xcd,
+	0x7f,
+	0x82,
+	0xf0,
+	0x38,
+	0x90,
+	0x36,
+	0xa5,
+	0x2e,
+	0xcd,
+	0x75,
+	0x82,
+	0xb0,
+	0x0e,
+	0xa0,
+	0x28,
+	0xb1,
+	0x4a,
+	0x85,
+	0x38,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x4c,
+	0xd1,
+	0x33,
+	0xcd,
+	0x79,
+	0x82,
+	0xf0,
+	0x10,
+	0x90,
+	0x0e,
+	0xa0,
+	0x30,
+	0xb1,
+	0x4a,
+	0x85,
+	0x38,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x85,
+	0x39,
+	0x4c,
+	0xd1,
+	0x33,
+	0x20,
+	0x07,
+	0x32,
+	0x69,
+	0x28,
+	0xa8,
+	0x20,
+	0x25,
+	0x32,
+	0x4c,
+	0xd1,
+	0x33,
+	0xa5,
+	0x2e,
+	0xcd,
+	0x75,
+	0x82,
+	0xb0,
+	0x0c,
+	0x20,
+	0x16,
+	0x32,
+	0x49,
+	0x05,
+	0xa8,
+	0x20,
+	0x48,
+	0x32,
+	0x4c,
+	0xd1,
+	0x33,
+	0xcd,
+	0x79,
+	0x82,
+	0xf0,
+	0x0f,
+	0x90,
+	0x0d,
+	0x20,
+	0x16,
+	0x32,
+	0x49,
+	0x05,
+	0x69,
+	0x08,
+	0xa8,
+	0x20,
+	0x48,
+	0x32,
+	0x80,
+	0x6c,
+	0x20,
+	0x16,
+	0x32,
+	0x86,
+	0x3d,
+	0x49,
+	0x05,
+	0x85,
+	0x4d,
+	0x20,
+	0x07,
+	0x32,
+	0x86,
+	0x3c,
+	0x65,
+	0x4d,
+	0x85,
+	0x4d,
+	0xa8,
+	0x20,
+	0x25,
+	0x32,
+	0xa6,
+	0x3d,
+	0x38,
+	0xa5,
+	0x2f,
+	0xfd,
+	0x7b,
+	0x82,
+	0xf0,
+	0x4c,
+	0xa6,
+	0x31,
+	0xd0,
+	0x09,
+	0xa6,
+	0x3d,
+	0xa4,
+	0x4d,
+	0x20,
+	0x48,
+	0x32,
+	0x80,
+	0x3f,
+	0x48,
+	0xa5,
+	0x38,
+	0x85,
+	0x3a,
+	0xa5,
+	0x39,
+	0x85,
+	0x3b,
+	0xa6,
+	0x3c,
+	0x18,
+	0xa5,
+	0x4d,
+	0x69,
+	0x0a,
+	0xa8,
+	0x20,
+	0x25,
+	0x32,
+	0xa6,
+	0x3d,
+	0x38,
+	0xbd,
+	0x7c,
+	0x82,
+	0xfd,
+	0x7b,
+	0x82,
+	0x85,
+	0x34,
+	0x64,
+	0x35,
+	0x68,
+	0x85,
+	0x31,
+	0x38,
+	0xa5,
+	0x38,
+	0xe5,
+	0x3a,
+	0x85,
+	0x32,
+	0xa5,
+	0x39,
+	0xe5,
+	0x3b,
+	0x85,
+	0x33,
+	0xa0,
+	0x02,
+	0x53,
+	0x3a,
+	0x00,
+	0x38,
+	0x00,
+	0xa0,
+	0x00,
+	0xa5,
+	0x33,
+	0x20,
+	0x7f,
+	0x32,
+	0xa6,
+	0x30,
+	0xa5,
+	0x38,
+	0x9d,
+	0x43,
+	0x82,
+	0xa5,
+	0x39,
+	0xe8,
+	0x9d,
+	0x43,
+	0x82,
+	0xe8,
+	0x86,
+	0x30,
+	0x18,
+	0xa5,
+	0x2e,
+	0x69,
+	0x14,
+	0x85,
+	0x2e,
+	0xc9,
+	0x51,
+	0xb0,
+	0x03,
+	0x4c,
+	0xc7,
+	0x32,
+	0x18,
+	0xa5,
+	0x2f,
+	0x69,
+	0x10,
+	0x85,
+	0x2f,
+	0xc9,
+	0x41,
+	0xb0,
+	0x03,
+	0x4c,
+	0xc5,
+	0x32,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x5b,
+	0x82,
+	0x32,
+	0x00,
+	0xa2,
+	0x00,
+	0x38,
+	0xbd,
+	0x43,
+	0x82,
+	0xe5,
+	0x32,
+	0x9d,
+	0x43,
+	0x82,
+	0xe8,
+	0xbd,
+	0x43,
+	0x82,
+	0xe5,
+	0x33,
+	0x9d,
+	0x43,
+	0x82,
+	0xe8,
+	0xe0,
+	0x32,
+	0xd0,
+	0xe9,
+	0x60,
+	0x85,
+	0x4c,
+	0x86,
+	0x4d,
+	0xa2,
+	0x00,
+	0xdc,
+	0xb1,
+	0x4a,
+	0x45,
+	0x2e,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xdc,
+	0xc8,
+	0xb1,
+	0x4a,
+	0x48,
+	0x45,
+	0x2e,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x2e,
+	0x85,
+	0x40,
+	0xdc,
+	0xb1,
+	0x4c,
+	0x45,
+	0x2f,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xdc,
+	0xc8,
+	0xb1,
+	0x4c,
+	0x48,
+	0x45,
+	0x2f,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x2f,
+	0x85,
+	0x40,
+	0x06,
+	0x3e,
+	0xa5,
+	0x3f,
+	0x2a,
+	0xdc,
+	0x91,
+	0x4a,
+	0xa5,
+	0x40,
+	0x2a,
+	0xc8,
+	0x91,
+	0x4a,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x32,
+	0xd0,
+	0xa2,
+	0x60,
+	0xc9,
+	0xa7,
+	0x90,
+	0x03,
+	0xa9,
+	0xa6,
+	0x60,
+	0xc9,
+	0x5a,
+	0xb0,
+	0x02,
+	0xa9,
+	0x5a,
+	0x60,
+	0xad,
+	0x17,
+	0x6b,
+	0x85,
+	0x2e,
+	0xa9,
+	0x80,
+	0x38,
+	0xe5,
+	0x2e,
+	0x85,
+	0x2f,
+	0xa9,
+	0x85,
+	0x85,
+	0x4a,
+	0xa9,
+	0x6b,
+	0x85,
+	0x4b,
+	0xa9,
+	0xdf,
+	0xa2,
+	0x81,
+	0x20,
+	0x1f,
+	0x34,
+	0xa9,
+	0xb7,
+	0x85,
+	0x4a,
+	0xa9,
+	0x6b,
+	0x85,
+	0x4b,
+	0xa9,
+	0x11,
+	0xa2,
+	0x82,
+	0x20,
+	0x1f,
+	0x34,
+	0xa9,
+	0xe9,
+	0x85,
+	0x4a,
+	0xa9,
+	0x6b,
+	0x85,
+	0x4b,
+	0xa9,
+	0xad,
+	0xa2,
+	0x81,
+	0x20,
+	0x1f,
+	0x34,
+	0xa9,
+	0x9d,
+	0x85,
+	0x4a,
+	0xa9,
+	0x74,
+	0x85,
+	0x4b,
+	0xa9,
+	0x4a,
+	0x85,
+	0x4c,
+	0xa9,
+	0x70,
+	0x85,
+	0x4d,
+	0xa9,
+	0xda,
+	0x85,
+	0x4e,
+	0xa9,
+	0x56,
+	0x85,
+	0x4f,
+	0xa2,
+	0x02,
+	0xbd,
+	0x7f,
+	0x6b,
+	0xbc,
+	0x07,
+	0x7d,
+	0x99,
+	0x7e,
+	0x00,
+	0xbd,
+	0x82,
+	0x6b,
+	0xbc,
+	0x0a,
+	0x7d,
+	0x99,
+	0x81,
+	0x00,
+	0xca,
+	0x10,
+	0xeb,
+	0xa9,
+	0x11,
+	0x85,
+	0x2e,
+	0xa9,
+	0x15,
+	0x85,
+	0x2f,
+	0xa0,
+	0x06,
+	0xd3,
+	0x4a,
+	0x75,
+	0x00,
+	0xa0,
+	0x02,
+	0xd3,
+	0x4e,
+	0x30,
+	0x00,
+	0xa6,
+	0x31,
+	0xa4,
+	0x30,
+	0xb9,
+	0x8a,
+	0x56,
+	0x85,
+	0x50,
+	0xd0,
+	0x0d,
+	0xbd,
+	0x85,
+	0x6b,
+	0x85,
+	0x3f,
+	0xbd,
+	0x86,
+	0x6b,
+	0x85,
+	0x40,
+	0x4c,
+	0xdf,
+	0x35,
+	0xb9,
+	0x8b,
+	0x56,
+	0x85,
+	0x51,
+	0xb9,
+	0x8c,
+	0x56,
+	0x85,
+	0x52,
+	0xb9,
+	0x8d,
+	0x56,
+	0x85,
+	0x53,
+	0xbd,
+	0x85,
+	0x6b,
+	0x45,
+	0x50,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xbd,
+	0x86,
+	0x6b,
+	0x48,
+	0x45,
+	0x50,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x50,
+	0x85,
+	0x40,
+	0xa5,
+	0x51,
+	0xf0,
+	0x27,
+	0x5d,
+	0x87,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0x88,
+	0x6b,
+	0x48,
+	0x45,
+	0x51,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x51,
+	0x85,
+	0x40,
+	0xa5,
+	0x52,
+	0xf0,
+	0x27,
+	0x5d,
+	0x8f,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0x90,
+	0x6b,
+	0x48,
+	0x45,
+	0x52,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x52,
+	0x85,
+	0x40,
+	0xa5,
+	0x53,
+	0xf0,
+	0x27,
+	0x5d,
+	0x91,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0x92,
+	0x6b,
+	0x48,
+	0x45,
+	0x53,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x53,
+	0x85,
+	0x40,
+	0xa5,
+	0x3e,
+	0x10,
+	0x06,
+	0xe6,
+	0x3f,
+	0xd0,
+	0x02,
+	0xe6,
+	0x40,
+	0xa5,
+	0x40,
+	0x30,
+	0x15,
+	0x49,
+	0x0b,
+	0x18,
+	0x69,
+	0x80,
+	0x85,
+	0x33,
+	0xa5,
+	0x3f,
+	0x49,
+	0x0b,
+	0x85,
+	0x32,
+	0x98,
+	0x18,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x80,
+	0x2b,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x3f,
+	0xa8,
+	0xa9,
+	0x00,
+	0xe5,
+	0x40,
+	0x85,
+	0x40,
+	0x98,
+	0x49,
+	0x0b,
+	0x85,
+	0x3e,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x3e,
+	0x85,
+	0x32,
+	0x84,
+	0x3e,
+	0xa9,
+	0x80,
+	0xe5,
+	0x3e,
+	0x48,
+	0xa5,
+	0x40,
+	0x49,
+	0x0b,
+	0x85,
+	0x3e,
+	0x38,
+	0x68,
+	0xe5,
+	0x3e,
+	0x85,
+	0x33,
+	0xa5,
+	0x75,
+	0x45,
+	0x7e,
+	0x85,
+	0x34,
+	0x84,
+	0x35,
+	0xa5,
+	0x76,
+	0x45,
+	0x7f,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x65,
+	0x35,
+	0x85,
+	0x35,
+	0xa5,
+	0x77,
+	0x45,
+	0x80,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x65,
+	0x35,
+	0x06,
+	0x34,
+	0x2a,
+	0x06,
+	0x34,
+	0x69,
+	0x00,
+	0x85,
+	0x34,
+	0x45,
+	0x32,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xa5,
+	0x34,
+	0x45,
+	0x33,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x06,
+	0x3f,
+	0x2a,
+	0xb0,
+	0x0a,
+	0x06,
+	0x3f,
+	0x69,
+	0x00,
+	0xb0,
+	0x04,
+	0xc9,
+	0xf4,
+	0x90,
+	0x04,
+	0xa9,
+	0xf3,
+	0x80,
+	0x06,
+	0xc9,
+	0x40,
+	0xb0,
+	0x02,
+	0xa9,
+	0x40,
+	0x92,
+	0x4c,
+	0xa6,
+	0x31,
+	0xa5,
+	0x50,
+	0xd0,
+	0x0d,
+	0xbd,
+	0xb7,
+	0x6b,
+	0x85,
+	0x3f,
+	0xbd,
+	0xb8,
+	0x6b,
+	0x85,
+	0x40,
+	0x4c,
+	0x38,
+	0x37,
+	0xbd,
+	0xb7,
+	0x6b,
+	0x45,
+	0x50,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xbd,
+	0xb8,
+	0x6b,
+	0x48,
+	0x45,
+	0x50,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x50,
+	0x85,
+	0x40,
+	0xa5,
+	0x51,
+	0xf0,
+	0x27,
+	0x5d,
+	0xb9,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xba,
+	0x6b,
+	0x48,
+	0x45,
+	0x51,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x51,
+	0x85,
+	0x40,
+	0xa5,
+	0x52,
+	0xf0,
+	0x27,
+	0x5d,
+	0xc1,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xc2,
+	0x6b,
+	0x48,
+	0x45,
+	0x52,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x52,
+	0x85,
+	0x40,
+	0xa5,
+	0x53,
+	0xf0,
+	0x27,
+	0x5d,
+	0xc3,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xc4,
+	0x6b,
+	0x48,
+	0x45,
+	0x53,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x53,
+	0x85,
+	0x40,
+	0xa5,
+	0x3e,
+	0x10,
+	0x06,
+	0xe6,
+	0x3f,
+	0xd0,
+	0x02,
+	0xe6,
+	0x40,
+	0xa5,
+	0x40,
+	0x30,
+	0x15,
+	0x49,
+	0x0b,
+	0x18,
+	0x69,
+	0x80,
+	0x85,
+	0x33,
+	0xa5,
+	0x3f,
+	0x49,
+	0x0b,
+	0x85,
+	0x32,
+	0x98,
+	0x18,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x80,
+	0x2b,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x3f,
+	0xa8,
+	0xa9,
+	0x00,
+	0xe5,
+	0x40,
+	0x85,
+	0x40,
+	0x98,
+	0x49,
+	0x0b,
+	0x85,
+	0x3e,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0x3e,
+	0x85,
+	0x32,
+	0x84,
+	0x3e,
+	0xa9,
+	0x80,
+	0xe5,
+	0x3e,
+	0x48,
+	0xa5,
+	0x40,
+	0x49,
+	0x0b,
+	0x85,
+	0x3e,
+	0x38,
+	0x68,
+	0xe5,
+	0x3e,
+	0x85,
+	0x33,
+	0xa5,
+	0x81,
+	0x45,
+	0x78,
+	0x85,
+	0x34,
+	0x84,
+	0x35,
+	0xa5,
+	0x82,
+	0x45,
+	0x79,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x65,
+	0x35,
+	0x85,
+	0x35,
+	0xa5,
+	0x83,
+	0x45,
+	0x7a,
+	0x18,
+	0x65,
+	0x34,
+	0x85,
+	0x34,
+	0x98,
+	0x65,
+	0x35,
+	0x06,
+	0x34,
+	0x2a,
+	0x06,
+	0x34,
+	0x69,
+	0x00,
+	0x85,
+	0x34,
+	0x45,
+	0x32,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xa5,
+	0x34,
+	0x45,
+	0x33,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x06,
+	0x3f,
+	0x2a,
+	0xb0,
+	0x0a,
+	0x06,
+	0x3f,
+	0x69,
+	0x00,
+	0xb0,
+	0x04,
+	0xc9,
+	0xf4,
+	0x90,
+	0x04,
+	0xa9,
+	0xf3,
+	0x80,
+	0x06,
+	0xc9,
+	0x40,
+	0xb0,
+	0x02,
+	0xa9,
+	0x40,
+	0xa0,
+	0x01,
+	0x91,
+	0x4c,
+	0xa6,
+	0x31,
+	0xa5,
+	0x50,
+	0xd0,
+	0x0d,
+	0xbd,
+	0xe9,
+	0x6b,
+	0x85,
+	0x3f,
+	0xbd,
+	0xea,
+	0x6b,
+	0x85,
+	0x40,
+	0x4c,
+	0x93,
+	0x38,
+	0xbd,
+	0xe9,
+	0x6b,
+	0x45,
+	0x50,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xbd,
+	0xea,
+	0x6b,
+	0x48,
+	0x45,
+	0x50,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x50,
+	0x85,
+	0x40,
+	0xa5,
+	0x51,
+	0xf0,
+	0x27,
+	0x5d,
+	0xeb,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xec,
+	0x6b,
+	0x48,
+	0x45,
+	0x51,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x51,
+	0x85,
+	0x40,
+	0xa5,
+	0x52,
+	0xf0,
+	0x27,
+	0x5d,
+	0xf3,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xf4,
+	0x6b,
+	0x48,
+	0x45,
+	0x52,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x52,
+	0x85,
+	0x40,
+	0xa5,
+	0x53,
+	0xf0,
+	0x27,
+	0x5d,
+	0xf5,
+	0x6b,
+	0x18,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x98,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x90,
+	0x03,
+	0xe6,
+	0x40,
+	0x18,
+	0xbd,
+	0xf6,
+	0x6b,
+	0x48,
+	0x45,
+	0x53,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x7a,
+	0x10,
+	0x03,
+	0x38,
+	0xe5,
+	0x53,
+	0x85,
+	0x40,
+	0xa5,
+	0x3e,
+	0x10,
+	0x06,
+	0xe6,
+	0x3f,
+	0xd0,
+	0x02,
+	0xe6,
+	0x40,
+	0xa2,
+	0x00,
+	0xa5,
+	0x40,
+	0x10,
+	0x0e,
+	0xe8,
+	0xa9,
+	0x00,
+	0x38,
+	0xe5,
+	0x3f,
+	0x85,
+	0x3f,
+	0xa9,
+	0x00,
+	0xe5,
+	0x40,
+	0x85,
+	0x40,
+	0xda,
+	0xa5,
+	0x3f,
+	0x49,
+	0x0b,
+	0x85,
+	0x32,
+	0x84,
+	0x33,
+	0xa5,
+	0x40,
+	0x49,
+	0x0b,
+	0x18,
+	0x65,
+	0x33,
+	0x85,
+	0x33,
+	0x46,
+	0x33,
+	0x66,
+	0x32,
+	0x10,
+	0x02,
+	0xe6,
+	0x33,
+	0x18,
+	0xa5,
+	0x33,
+	0x69,
+	0x80,
+	0xaa,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0x33,
+	0x7a,
+	0xf0,
+	0x01,
+	0x8a,
+	0x20,
+	0x84,
+	0x34,
+	0xa0,
+	0x02,
+	0x91,
+	0x4c,
+	0x18,
+	0xa5,
+	0x4a,
+	0x69,
+	0x06,
+	0x85,
+	0x4a,
+	0x90,
+	0x03,
+	0xe6,
+	0x4b,
+	0x18,
+	0xa5,
+	0x4c,
+	0x69,
+	0x03,
+	0x85,
+	0x4c,
+	0x90,
+	0x03,
+	0xe6,
+	0x4d,
+	0x18,
+	0xa5,
+	0x4e,
+	0x69,
+	0x02,
+	0x85,
+	0x4e,
+	0x90,
+	0x02,
+	0xe6,
+	0x4f,
+	0xc6,
+	0x2f,
+	0xf0,
+	0x03,
+	0x4c,
+	0x02,
+	0x35,
+	0xc6,
+	0x2e,
+	0xf0,
+	0x03,
+	0x4c,
+	0xfe,
+	0x34,
+	0xa9,
+	0x01,
+	0x85,
+	0x22,
+	0x60,
+	0x64,
+	0x36,
+	0x64,
+	0x37,
+	0xa2,
+	0x10,
+	0x06,
+	0x32,
+	0x26,
+	0x33,
+	0x26,
+	0x36,
+	0x26,
+	0x37,
+	0xa5,
+	0x36,
+	0x38,
+	0xe5,
+	0x34,
+	0xa8,
+	0xa5,
+	0x37,
+	0xe5,
+	0x35,
+	0x90,
+	0x06,
+	0x85,
+	0x37,
+	0x84,
+	0x36,
+	0xe6,
+	0x32,
+	0xca,
+	0xd0,
+	0xe3,
+	0x60,
+	0x20,
+	0x0b,
+	0x39,
+	0x46,
+	0x35,
+	0x66,
+	0x34,
+	0x90,
+	0x06,
+	0xe6,
+	0x34,
+	0xd0,
+	0x02,
+	0xe6,
+	0x35,
+	0x38,
+	0xa5,
+	0x36,
+	0xe5,
+	0x34,
+	0xa5,
+	0x37,
+	0xe5,
+	0x35,
+	0x30,
+	0x06,
+	0xe6,
+	0x32,
+	0xd0,
+	0x02,
+	0xe6,
+	0x33,
+	0x60,
+	0xa5,
+	0x32,
+	0x45,
+	0x34,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xa5,
+	0x32,
+	0x45,
+	0x35,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x40,
+	0xa5,
+	0x33,
+	0x45,
+	0x34,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x85,
+	0x40,
+	0xa5,
+	0x33,
+	0x45,
+	0x35,
+	0x65,
+	0x40,
+	0x85,
+	0x40,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x41,
+	0xa5,
+	0x35,
+	0x10,
+	0x0d,
+	0x38,
+	0xa5,
+	0x40,
+	0xe5,
+	0x32,
+	0x85,
+	0x40,
+	0xa5,
+	0x41,
+	0xe5,
+	0x33,
+	0x85,
+	0x41,
+	0x60,
+	0xa5,
+	0x32,
+	0x45,
+	0x34,
+	0x85,
+	0x3e,
+	0x84,
+	0x3f,
+	0xa5,
+	0x32,
+	0x45,
+	0x35,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x40,
+	0xa5,
+	0x33,
+	0x45,
+	0x34,
+	0x18,
+	0x65,
+	0x3f,
+	0x85,
+	0x3f,
+	0x98,
+	0x65,
+	0x40,
+	0x85,
+	0x40,
+	0xa5,
+	0x33,
+	0x45,
+	0x35,
+	0x65,
+	0x40,
+	0x85,
+	0x40,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x41,
+	0x60,
+	0xda,
+	0x29,
+	0x01,
+	0xf0,
+	0x06,
+	0xa9,
+	0x68,
+	0xa0,
+	0x04,
+	0x80,
+	0x04,
+	0xa9,
+	0x90,
+	0xa0,
+	0x00,
+	0x85,
+	0xe6,
+	0x84,
+	0xe7,
+	0x38,
+	0xa5,
+	0xb5,
+	0xe5,
+	0xb4,
+	0x1a,
+	0x1a,
+	0x85,
+	0xde,
+	0xa0,
+	0x02,
+	0x53,
+	0xac,
+	0x00,
+	0xea,
+	0x00,
+	0xa5,
+	0xb4,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x02,
+	0xa5,
+	0xb5,
+	0xaa,
+	0x85,
+	0xdf,
+	0x8a,
+	0x18,
+	0x65,
+	0xb6,
+	0x49,
+	0x03,
+	0x85,
+	0xe8,
+	0xa5,
+	0xaa,
+	0x48,
+	0x18,
+	0x65,
+	0xbd,
+	0x49,
+	0x3f,
+	0x65,
+	0xe8,
+	0x90,
+	0x02,
+	0xc8,
+	0x18,
+	0x69,
+	0x1b,
+	0x85,
+	0xe2,
+	0x98,
+	0x69,
+	0x6c,
+	0x85,
+	0xe3,
+	0x68,
+	0x1a,
+	0x38,
+	0xe5,
+	0xbd,
+	0x49,
+	0x3f,
+	0x18,
+	0x65,
+	0xe8,
+	0x90,
+	0x02,
+	0xc8,
+	0x18,
+	0x69,
+	0x1b,
+	0x85,
+	0xe4,
+	0x98,
+	0x69,
+	0x6c,
+	0x85,
+	0xe5,
+	0xa0,
+	0x03,
+	0xd3,
+	0xe2,
+	0xd4,
+	0x00,
+	0xd3,
+	0xe4,
+	0xd8,
+	0x00,
+	0xa0,
+	0x02,
+	0x53,
+	0xe6,
+	0x00,
+	0x0c,
+	0xc0,
+	0xad,
+	0x76,
+	0x60,
+	0xa8,
+	0x29,
+	0x01,
+	0xd0,
+	0x0a,
+	0xa2,
+	0x80,
+	0x86,
+	0xd4,
+	0x86,
+	0xd5,
+	0x86,
+	0xd8,
+	0x86,
+	0xd9,
+	0x98,
+	0x29,
+	0x02,
+	0xd0,
+	0x06,
+	0xa2,
+	0x80,
+	0x86,
+	0xd6,
+	0x86,
+	0xda,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xd6,
+	0x85,
+	0xd7,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xda,
+	0x85,
+	0xdb,
+	0xa0,
+	0x08,
+	0x43,
+	0xd4,
+	0x00,
+	0x54,
+	0xc0,
+	0xc6,
+	0xde,
+	0xd0,
+	0x03,
+	0x4c,
+	0x25,
+	0x3b,
+	0xa4,
+	0xb6,
+	0xd0,
+	0x04,
+	0xe6,
+	0xdf,
+	0x80,
+	0x02,
+	0xc6,
+	0xdf,
+	0xa0,
+	0x03,
+	0xc3,
+	0xea,
+	0x54,
+	0xc0,
+	0xc3,
+	0xae,
+	0x54,
+	0xc0,
+	0xc3,
+	0xb0,
+	0x54,
+	0xc0,
+	0xc3,
+	0xb2,
+	0x54,
+	0xc0,
+	0xa5,
+	0xdf,
+	0xa6,
+	0xb6,
+	0xd0,
+	0x18,
+	0x18,
+	0xa5,
+	0xe2,
+	0x69,
+	0x03,
+	0x85,
+	0xe2,
+	0x90,
+	0x03,
+	0xe6,
+	0xe3,
+	0x18,
+	0xa5,
+	0xe4,
+	0x69,
+	0x03,
+	0x85,
+	0xe4,
+	0x90,
+	0x02,
+	0xe6,
+	0xe5,
+	0x80,
+	0x16,
+	0x38,
+	0xa5,
+	0xe2,
+	0xe9,
+	0x03,
+	0x85,
+	0xe2,
+	0xb0,
+	0x03,
+	0xc6,
+	0xe3,
+	0x38,
+	0xa5,
+	0xe4,
+	0xe9,
+	0x03,
+	0x85,
+	0xe4,
+	0xb0,
+	0x02,
+	0xc6,
+	0xe5,
+	0xa5,
+	0xde,
+	0x3a,
+	0xf0,
+	0x4f,
+	0xa0,
+	0x02,
+	0x53,
+	0xea,
+	0x00,
+	0xb2,
+	0x00,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x23,
+	0x38,
+	0xa5,
+	0xae,
+	0xe9,
+	0x03,
+	0x85,
+	0xae,
+	0xb0,
+	0x03,
+	0xc6,
+	0xaf,
+	0x38,
+	0xa5,
+	0xea,
+	0xe9,
+	0x03,
+	0x85,
+	0xea,
+	0xb0,
+	0x03,
+	0xc6,
+	0xeb,
+	0x38,
+	0xa5,
+	0xb0,
+	0xe9,
+	0x03,
+	0x85,
+	0xb0,
+	0xb0,
+	0x25,
+	0xc6,
+	0xb1,
+	0x80,
+	0x21,
+	0x18,
+	0xa5,
+	0xae,
+	0x69,
+	0x03,
+	0x85,
+	0xae,
+	0x90,
+	0x03,
+	0xe6,
+	0xaf,
+	0x18,
+	0xa5,
+	0xea,
+	0x69,
+	0x03,
+	0x85,
+	0xea,
+	0x90,
+	0x03,
+	0xe6,
+	0xeb,
+	0x18,
+	0xa5,
+	0xb0,
+	0x69,
+	0x03,
+	0x85,
+	0xb0,
+	0x90,
+	0x02,
+	0xe6,
+	0xb1,
+	0x18,
+	0xa5,
+	0xe6,
+	0x69,
+	0x18,
+	0x85,
+	0xe6,
+	0x90,
+	0x02,
+	0xe6,
+	0xe7,
+	0x4c,
+	0x29,
+	0x3a,
+	0xa0,
+	0x03,
+	0xc3,
+	0xea,
+	0x54,
+	0xc0,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x04,
+	0xc6,
+	0xaa,
+	0x80,
+	0x02,
+	0xe6,
+	0xaa,
+	0xc6,
+	0xab,
+	0xf0,
+	0x40,
+	0xa5,
+	0xac,
+	0xa4,
+	0xad,
+	0x85,
+	0xae,
+	0x84,
+	0xaf,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x08,
+	0x38,
+	0xe9,
+	0x3c,
+	0xb0,
+	0x09,
+	0x88,
+	0x80,
+	0x06,
+	0x18,
+	0x69,
+	0x3c,
+	0x90,
+	0x01,
+	0xc8,
+	0x85,
+	0xac,
+	0x84,
+	0xad,
+	0xa6,
+	0xab,
+	0xca,
+	0xf0,
+	0x12,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x08,
+	0x38,
+	0xe9,
+	0x3c,
+	0xb0,
+	0x09,
+	0x88,
+	0x80,
+	0x06,
+	0x18,
+	0x69,
+	0x3c,
+	0x90,
+	0x01,
+	0xc8,
+	0x85,
+	0xb0,
+	0x84,
+	0xb1,
+	0xa0,
+	0x02,
+	0x53,
+	0xac,
+	0x00,
+	0xb2,
+	0x00,
+	0xfa,
+	0x60,
+	0x64,
+	0xe6,
+	0x64,
+	0xe7,
+	0xa2,
+	0x10,
+	0x06,
+	0xe2,
+	0x26,
+	0xe3,
+	0x26,
+	0xe6,
+	0x26,
+	0xe7,
+	0xa5,
+	0xe6,
+	0x38,
+	0xe5,
+	0xe4,
+	0xa8,
+	0xa5,
+	0xe7,
+	0xe5,
+	0xe5,
+	0x90,
+	0x06,
+	0x85,
+	0xe7,
+	0x84,
+	0xe6,
+	0xe6,
+	0xe2,
+	0xca,
+	0xd0,
+	0xe3,
+	0x60,
+	0xa5,
+	0xc0,
+	0x49,
+	0x1a,
+	0x84,
+	0x17,
+	0xa6,
+	0xb4,
+	0xbd,
+	0x79,
+	0x6a,
+	0xc5,
+	0x17,
+	0xb0,
+	0x01,
+	0xe8,
+	0x86,
+	0x28,
+	0xa6,
+	0xb5,
+	0xbd,
+	0x79,
+	0x6a,
+	0xc5,
+	0x17,
+	0xb0,
+	0x01,
+	0xca,
+	0x86,
+	0x29,
+	0x8a,
+	0xa5,
+	0xc2,
+	0x49,
+	0x1a,
+	0x84,
+	0xe3,
+	0xa6,
+	0xbe,
+	0xbd,
+	0x8d,
+	0x6a,
+	0xc5,
+	0xe3,
+	0xb0,
+	0x01,
+	0xe8,
+	0x86,
+	0x26,
+	0xa6,
+	0xbf,
+	0xbd,
+	0x8d,
+	0x6a,
+	0xc5,
+	0xe3,
+	0xb0,
+	0x01,
+	0xca,
+	0x86,
+	0x27,
+	0xa4,
+	0xbd,
+	0xd0,
+	0x02,
+	0xa6,
+	0x26,
+	0x86,
+	0x60,
+	0xa5,
+	0x26,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x02,
+	0xa5,
+	0x27,
+	0x49,
+	0x64,
+	0x18,
+	0x69,
+	0x37,
+	0x85,
+	0xbb,
+	0x85,
+	0x2a,
+	0x98,
+	0x69,
+	0x64,
+	0x85,
+	0xbc,
+	0x85,
+	0x2b,
+	0xa5,
+	0x28,
+	0x49,
+	0x05,
+	0x65,
+	0x2a,
+	0x85,
+	0x2a,
+	0x90,
+	0x03,
+	0xe6,
+	0x2b,
+	0x18,
+	0xa5,
+	0x28,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x02,
+	0xa5,
+	0x29,
+	0x49,
+	0x05,
+	0x65,
+	0xbb,
+	0x85,
+	0xbb,
+	0x90,
+	0x02,
+	0xe6,
+	0xbc,
+	0x60,
+	0xfc,
+	0xf0,
+	0x11,
+	0xa2,
+	0x07,
+	0x85,
+	0xe3,
+	0x98,
+	0x80,
+	0x02,
+	0x66,
+	0xe3,
+	0xe8,
+	0x4a,
+	0xd0,
+	0xfa,
+	0x66,
+	0xe3,
+	0x80,
+	0x0b,
+	0xa2,
+	0x07,
+	0xa8,
+	0x30,
+	0x04,
+	0xca,
+	0x0a,
+	0x10,
+	0xfc,
+	0x85,
+	0xe3,
+	0x8a,
+	0x0a,
+	0xaa,
+	0xa5,
+	0xe3,
+	0x29,
+	0x7f,
+	0xa8,
+	0x60,
+	0x7c,
+	0xc0,
+	0x3f,
+	0xda,
+	0xa0,
+	0x02,
+	0x53,
+	0xbb,
+	0x00,
+	0xd4,
+	0x00,
+	0x53,
+	0xb7,
+	0x00,
+	0xd6,
+	0x00,
+	0x29,
+	0x01,
+	0xf0,
+	0x06,
+	0xa9,
+	0xd0,
+	0xa2,
+	0x0a,
+	0x80,
+	0x04,
+	0xa9,
+	0x40,
+	0xa2,
+	0x08,
+	0x8d,
+	0x0c,
+	0xc0,
+	0x8e,
+	0x0d,
+	0xc0,
+	0xa5,
+	0xb4,
+	0xf0,
+	0x17,
+	0x49,
+	0x03,
+	0x5a,
+	0x48,
+	0xa5,
+	0xb9,
+	0x49,
+	0x3c,
+	0x18,
+	0x69,
+	0x77,
+	0x85,
+	0xe2,
+	0x98,
+	0x69,
+	0x60,
+	0x85,
+	0xe3,
+	0xfa,
+	0x68,
+	0x20,
+	0x90,
+	0x3e,
+	0x38,
+	0xa9,
+	0x13,
+	0xe5,
+	0xb5,
+	0xf0,
+	0x24,
+	0x49,
+	0x03,
+	0x5a,
+	0x48,
+	0xa5,
+	0xb9,
+	0x49,
+	0x3c,
+	0x18,
+	0x69,
+	0x77,
+	0x85,
+	0xe2,
+	0x98,
+	0x69,
+	0x60,
+	0x85,
+	0xe3,
+	0xa5,
+	0xb5,
+	0x1a,
+	0x49,
+	0x03,
+	0x65,
+	0xe2,
+	0x85,
+	0xe2,
+	0x90,
+	0x02,
+	0xe6,
+	0xe3,
+	0xfa,
+	0x68,
+	0x20,
+	0x90,
+	0x3e,
+	0x38,
+	0xa5,
+	0xb5,
+	0xaa,
+	0xa4,
+	0xb6,
+	0xd0,
+	0x02,
+	0xa6,
+	0xb4,
+	0x86,
+	0xdf,
+	0xe5,
+	0xb4,
+	0x1a,
+	0x85,
+	0xde,
+	0x64,
+	0xf3,
+	0xa2,
+	0x00,
+	0xa4,
+	0xb9,
+	0xb9,
+	0x8d,
+	0x6a,
+	0x85,
+	0xe1,
+	0xa5,
+	0xc2,
+	0x49,
+	0x1a,
+	0xa2,
+	0x01,
+	0xc4,
+	0xe1,
+	0xf0,
+	0x03,
+	0x90,
+	0x01,
+	0xca,
+	0x86,
+	0xee,
+	0xa6,
+	0x28,
+	0xa4,
+	0x29,
+	0xa5,
+	0xb6,
+	0xf0,
+	0x03,
+	0x8a,
+	0xfc,
+	0xa8,
+	0x86,
+	0xf2,
+	0x84,
+	0xef,
+	0xa6,
+	0x26,
+	0xa4,
+	0x27,
+	0xa5,
+	0xbd,
+	0xf0,
+	0x03,
+	0x8a,
+	0xfc,
+	0xa8,
+	0x86,
+	0xf0,
+	0x84,
+	0xf1,
+	0xa0,
+	0x10,
+	0x13,
+	0x54,
+	0xc0,
+	0xc4,
+	0x00,
+	0xa4,
+	0xdf,
+	0xa2,
+	0x00,
+	0xa5,
+	0xa8,
+	0xf0,
+	0x0f,
+	0xa5,
+	0xee,
+	0xf0,
+	0x0b,
+	0xc4,
+	0x28,
+	0x90,
+	0x07,
+	0xc4,
+	0x29,
+	0xf0,
+	0x02,
+	0xb0,
+	0x01,
+	0xe8,
+	0x86,
+	0x97,
+	0xb9,
+	0x79,
+	0x6a,
+	0x85,
+	0xe2,
+	0xaa,
+	0x45,
+	0xe1,
+	0x84,
+	0x9a,
+	0x49,
+	0x20,
+	0x85,
+	0x98,
+	0x84,
+	0x99,
+	0xa5,
+	0x9a,
+	0x49,
+	0x20,
+	0x18,
+	0x65,
+	0x99,
+	0x85,
+	0x99,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0x9a,
+	0x38,
+	0xa5,
+	0xc4,
+	0xe5,
+	0x98,
+	0x85,
+	0xc4,
+	0xa5,
+	0xc5,
+	0xe5,
+	0x99,
+	0x85,
+	0xc5,
+	0xa5,
+	0xc6,
+	0xe5,
+	0x9a,
+	0x85,
+	0xc6,
+	0xa5,
+	0xc7,
+	0xe9,
+	0x00,
+	0x85,
+	0xc7,
+	0x10,
+	0x08,
+	0x64,
+	0xc4,
+	0x64,
+	0xc5,
+	0x64,
+	0xc6,
+	0x64,
+	0xc7,
+	0x38,
+	0xa5,
+	0xc8,
+	0xe5,
+	0x98,
+	0x85,
+	0xc8,
+	0xa5,
+	0xc9,
+	0xe5,
+	0x99,
+	0x85,
+	0xc9,
+	0xa5,
+	0xca,
+	0xe5,
+	0x9a,
+	0x85,
+	0xca,
+	0xa5,
+	0xcb,
+	0xe9,
+	0x00,
+	0x85,
+	0xcb,
+	0x10,
+	0x08,
+	0x64,
+	0xc8,
+	0x64,
+	0xc9,
+	0x64,
+	0xca,
+	0x64,
+	0xcb,
+	0x38,
+	0xa5,
+	0xcc,
+	0xe5,
+	0x98,
+	0x85,
+	0xcc,
+	0xa5,
+	0xcd,
+	0xe5,
+	0x99,
+	0x85,
+	0xcd,
+	0xa5,
+	0xce,
+	0xe5,
+	0x9a,
+	0x85,
+	0xce,
+	0xa5,
+	0xcf,
+	0xe9,
+	0x00,
+	0x85,
+	0xcf,
+	0x10,
+	0x08,
+	0x64,
+	0xcc,
+	0x64,
+	0xcd,
+	0x64,
+	0xce,
+	0x64,
+	0xcf,
+	0x38,
+	0xa5,
+	0xd0,
+	0xe5,
+	0x98,
+	0x85,
+	0xd0,
+	0xa5,
+	0xd1,
+	0xe5,
+	0x99,
+	0x85,
+	0xd1,
+	0xa5,
+	0xd2,
+	0xe5,
+	0x9a,
+	0x85,
+	0xd2,
+	0xa5,
+	0xd3,
+	0xe9,
+	0x00,
+	0x85,
+	0xd3,
+	0x10,
+	0x08,
+	0x64,
+	0xd0,
+	0x64,
+	0xd1,
+	0x64,
+	0xd2,
+	0x64,
+	0xd3,
+	0x8a,
+	0xa6,
+	0x97,
+	0xf0,
+	0x07,
+	0xa0,
+	0x10,
+	0x53,
+	0xc4,
+	0x00,
+	0x98,
+	0x00,
+	0xa5,
+	0xe1,
+	0x45,
+	0xe2,
+	0x20,
+	0x1c,
+	0x3c,
+	0x5a,
+	0x20,
+	0x44,
+	0x3c,
+	0x7a,
+	0xb9,
+	0xcc,
+	0x5b,
+	0x20,
+	0x59,
+	0x15,
+	0xa0,
+	0x03,
+	0x73,
+	0xe6,
+	0x00,
+	0xd6,
+	0xa5,
+	0x97,
+	0xd0,
+	0x02,
+	0x80,
+	0x27,
+	0xa5,
+	0xdf,
+	0x20,
+	0xce,
+	0x14,
+	0xa0,
+	0x05,
+	0x73,
+	0xe9,
+	0x00,
+	0xd4,
+	0x84,
+	0xf3,
+	0xa5,
+	0xd4,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x0b,
+	0x38,
+	0xe9,
+	0x05,
+	0x85,
+	0xd4,
+	0xb0,
+	0x0d,
+	0xc6,
+	0xd5,
+	0x80,
+	0x09,
+	0x18,
+	0x69,
+	0x05,
+	0x85,
+	0xd4,
+	0x90,
+	0x02,
+	0xe6,
+	0xd5,
+	0xa5,
+	0xd6,
+	0xa6,
+	0xb6,
+	0xf0,
+	0x0b,
+	0x38,
+	0xe9,
+	0x03,
+	0x85,
+	0xd6,
+	0xb0,
+	0x0d,
+	0xc6,
+	0xd7,
+	0x80,
+	0x09,
+	0x18,
+	0x69,
+	0x03,
+	0x85,
+	0xd6,
+	0x90,
+	0x02,
+	0xe6,
+	0xd7,
+	0xc6,
+	0xde,
+	0xf0,
+	0x0e,
+	0xa5,
+	0xb6,
+	0xf0,
+	0x05,
+	0xc6,
+	0xdf,
+	0x4c,
+	0xf7,
+	0x3c,
+	0xe6,
+	0xdf,
+	0x4c,
+	0xf7,
+	0x3c,
+	0xa5,
+	0xb7,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x0b,
+	0x38,
+	0xe9,
+	0x3c,
+	0x85,
+	0xb7,
+	0xb0,
+	0x0d,
+	0xc6,
+	0xb8,
+	0x80,
+	0x09,
+	0x18,
+	0x69,
+	0x3c,
+	0x85,
+	0xb7,
+	0x90,
+	0x02,
+	0xe6,
+	0xb8,
+	0xa6,
+	0xb9,
+	0xe4,
+	0xf1,
+	0xd0,
+	0x02,
+	0x64,
+	0xa8,
+	0xa5,
+	0xee,
+	0xf0,
+	0x1a,
+	0xa5,
+	0xbb,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x0b,
+	0x38,
+	0xe9,
+	0x64,
+	0x85,
+	0xbb,
+	0xb0,
+	0x0d,
+	0xc6,
+	0xbc,
+	0x80,
+	0x09,
+	0x18,
+	0x69,
+	0x64,
+	0x85,
+	0xbb,
+	0x90,
+	0x02,
+	0xe6,
+	0xbc,
+	0xa5,
+	0xf3,
+	0xf0,
+	0x02,
+	0xe6,
+	0x24,
+	0xa6,
+	0xbd,
+	0xf0,
+	0x04,
+	0xc6,
+	0xb9,
+	0x80,
+	0x02,
+	0xe6,
+	0xb9,
+	0xfa,
+	0x60,
+	0x64,
+	0xde,
+	0xda,
+	0xaa,
+	0xf0,
+	0x0b,
+	0xa0,
+	0x00,
+	0x33,
+	0xde,
+	0x00,
+	0xe2,
+	0xe6,
+	0xe3,
+	0x3a,
+	0xd0,
+	0xf7,
+	0x7a,
+	0xf0,
+	0x04,
+	0x33,
+	0xde,
+	0x00,
+	0xe2,
+	0x60,
+	0xba,
+	0x08,
+	0x78,
+	0x68,
+	0x48,
+	0x29,
+	0x1c,
+	0x85,
+	0xf6,
+	0x86,
+	0xf4,
+	0xa9,
+	0x01,
+	0x85,
+	0xf5,
+	0xa0,
+	0x06,
+	0xb1,
+	0xf4,
+	0x48,
+	0x29,
+	0x1c,
+	0xc5,
+	0xf6,
+	0x90,
+	0x08,
+	0x7a,
+	0xa0,
+	0x09,
+	0xb1,
+	0xf4,
+	0x48,
+	0x29,
+	0x1c,
+	0xc9,
+	0x00,
+	0xd0,
+	0x38,
+	0xa0,
+	0x03,
+	0xb1,
+	0xf4,
+	0xe0,
+	0x7f,
+	0xb0,
+	0x18,
+	0x8d,
+	0x82,
+	0x82,
+	0xc8,
+	0xb1,
+	0xf4,
+	0x8d,
+	0x83,
+	0x82,
+	0xc8,
+	0xb1,
+	0xf4,
+	0x8d,
+	0x84,
+	0x82,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0x85,
+	0x82,
+	0x80,
+	0x16,
+	0x8d,
+	0x86,
+	0x82,
+	0xc8,
+	0xb1,
+	0xf4,
+	0x8d,
+	0x87,
+	0x82,
+	0xc8,
+	0xb1,
+	0xf4,
+	0x8d,
+	0x88,
+	0x82,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0x89,
+	0x82,
+	0xa9,
+	0x00,
+	0xfa,
+	0x28,
+	0xf8,
+	0x60,
+	0x68,
+	0xf0,
+	0x04,
+	0x68,
+	0xfa,
+	0x7a,
+	0x40,
+	0x08,
+	0x78,
+	0x68,
+	0xad,
+	0x81,
+	0x82,
+	0xf0,
+	0x0e,
+	0xae,
+	0x85,
+	0x82,
+	0x9a,
+	0xad,
+	0x82,
+	0x82,
+	0xae,
+	0x83,
+	0x82,
+	0xac,
+	0x84,
+	0x82,
+	0x40,
+	0xae,
+	0x89,
+	0x82,
+	0x9a,
+	0xad,
+	0x86,
+	0x82,
+	0xae,
+	0x87,
+	0x82,
+	0xac,
+	0x88,
+	0x82,
+	0x40,
+	0x08,
+	0x78,
+	0xad,
+	0x81,
+	0x82,
+	0xd0,
+	0x1f,
+	0x1a,
+	0x8d,
+	0x81,
+	0x82,
+	0xa9,
+	0x7c,
+	0x8d,
+	0x85,
+	0x82,
+	0x9c,
+	0x82,
+	0x82,
+	0x9c,
+	0x83,
+	0x82,
+	0x9c,
+	0x84,
+	0x82,
+	0xa9,
+	0x07,
+	0x8d,
+	0x7f,
+	0x01,
+	0xa9,
+	0x0a,
+	0x8d,
+	0x7e,
+	0x01,
+	0x9c,
+	0x7d,
+	0x01,
+	0x28,
+	0x60,
+	0x08,
+	0x78,
+	0xa9,
+	0x0e,
+	0x8d,
+	0xfe,
+	0x01,
+	0xa9,
+	0x07,
+	0x8d,
+	0xfd,
+	0x01,
+	0xad,
+	0x16,
+	0x6b,
+	0x8d,
+	0xfc,
+	0x01,
+	0xa9,
+	0xfb,
+	0x8d,
+	0x89,
+	0x82,
+	0x9c,
+	0x86,
+	0x82,
+	0x9c,
+	0x87,
+	0x82,
+	0x9c,
+	0x88,
+	0x82,
+	0x28,
+	0x60,
+	0xd6,
+	0x03,
+	0x0c,
+	0x06,
+	0x86,
+	0x1c,
+	0xbd,
+	0x06,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xf0,
+	0x0d,
+	0x80,
+	0x80,
+	0x80,
+	0x80,
+	0x00,
+	0x04,
+	0x08,
+	0x0d,
+	0x11,
+	0x15,
+	0x1a,
+	0x1e,
+	0x23,
+	0x27,
+	0x00,
+	0x04,
+	0x09,
+	0x0d,
+	0x12,
+	0x17,
+	0x1b,
+	0x00,
+	0x01,
+	0x02,
+	0x00,
+	0x02,
+	0x01,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x01,
+	0x02,
+	0x02,
+	0x01,
+	0x00,
+	0x02,
+	0x00,
+	0x01,
+	0x01,
+	0x02,
+	0x00,
+	0x01,
+	0x02,
+	0x04,
+	0x08,
+	0x10,
+	0x20,
+	0x40,
+	0x80,
+	0xef,
+	0x19,
+	0x88,
+	0x19,
+	0x4b,
+	0x19,
+	0x26,
+	0x19,
+	0x01,
+	0x19,
+	0xdc,
+	0x18,
+	0xb7,
+	0x18,
+	0x7a,
+	0x18,
+	0x2d,
+	0x18,
+	0xd4,
+	0x17,
+	0x7f,
+	0x17,
+	0x32,
+	0x17,
+	0xcb,
+	0x16,
+	0x72,
+	0x16,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x8e,
+	0x73,
+	0x8e,
+	0x73,
+	0x4f,
+	0xb2,
+	0x4f,
+	0xe5,
+	0x1c,
+	0xe3,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x9b,
+	0x66,
+	0x9b,
+	0x66,
+	0x24,
+	0xdd,
+	0x24,
+	0x2d,
+	0xd4,
+	0x95,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xa7,
+	0x5a,
+	0xa7,
+	0x5a,
+	0xfe,
+	0x03,
+	0xfe,
+	0x5d,
+	0xa4,
+	0x81,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xb4,
+	0x4d,
+	0xb4,
+	0x4d,
+	0xdd,
+	0x24,
+	0xdd,
+	0x78,
+	0x89,
+	0x95,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xc1,
+	0x40,
+	0xc1,
+	0x40,
+	0xc1,
+	0x40,
+	0xc1,
+	0x7f,
+	0x81,
+	0xc1,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xce,
+	0x33,
+	0xce,
+	0x33,
+	0xaa,
+	0x57,
+	0xaa,
+	0x79,
+	0x88,
+	0xf7,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xdb,
+	0x26,
+	0xdb,
+	0x26,
+	0x98,
+	0x69,
+	0x98,
+	0x65,
+	0x9c,
+	0x2c,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xe7,
+	0x1a,
+	0xe7,
+	0x1a,
+	0x8b,
+	0x76,
+	0x8b,
+	0x49,
+	0xb8,
+	0x59,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0xf4,
+	0x0d,
+	0xf4,
+	0x0d,
+	0x84,
+	0x7d,
+	0x84,
+	0x26,
+	0xdb,
+	0x76,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x7f,
+	0x81,
+	0x00,
+	0x00,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x0d,
+	0xf4,
+	0x0d,
+	0xf4,
+	0x84,
+	0x7d,
+	0x84,
+	0xdb,
+	0x26,
+	0x76,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x1a,
+	0xe7,
+	0x1a,
+	0xe7,
+	0x8b,
+	0x76,
+	0x8b,
+	0xb8,
+	0x49,
+	0x59,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x26,
+	0xdb,
+	0x26,
+	0xdb,
+	0x98,
+	0x69,
+	0x98,
+	0x9c,
+	0x65,
+	0x2c,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x33,
+	0xce,
+	0x33,
+	0xce,
+	0xaa,
+	0x57,
+	0xaa,
+	0x88,
+	0x79,
+	0xf7,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x40,
+	0xc1,
+	0x40,
+	0xc1,
+	0xc1,
+	0x40,
+	0xc1,
+	0x81,
+	0x7f,
+	0xc1,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x4d,
+	0xb4,
+	0x4d,
+	0xb4,
+	0xdd,
+	0x24,
+	0xdd,
+	0x89,
+	0x78,
+	0x95,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x5a,
+	0xa7,
+	0x5a,
+	0xa7,
+	0xfe,
+	0x03,
+	0xfe,
+	0xa4,
+	0x5d,
+	0x81,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x66,
+	0x9b,
+	0x66,
+	0x9b,
+	0x24,
+	0xdd,
+	0x24,
+	0xd4,
+	0x2d,
+	0x95,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x73,
+	0x8e,
+	0x73,
+	0x8e,
+	0x4f,
+	0xb2,
+	0x4f,
+	0x1c,
+	0xe5,
+	0xe3,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x81,
+	0x7f,
+	0x7f,
+	0x81,
+	0x7f,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x81,
+	0x70,
+	0xbd,
+	0x07,
+	0x7f,
+	0x91,
+	0x44,
+	0x81,
+	0x70,
+	0x7f,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x8e,
+	0x65,
+	0xc4,
+	0x06,
+	0x4f,
+	0xbc,
+	0x2a,
+	0xe5,
+	0x18,
+	0xe3,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x9b,
+	0x5a,
+	0xcb,
+	0x06,
+	0x24,
+	0xe2,
+	0x13,
+	0x2d,
+	0xda,
+	0x95,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xa7,
+	0x4e,
+	0xd1,
+	0x05,
+	0xfe,
+	0x02,
+	0x00,
+	0x5d,
+	0xaf,
+	0x81,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xb4,
+	0x43,
+	0xd8,
+	0x04,
+	0xdd,
+	0x1f,
+	0xee,
+	0x78,
+	0x98,
+	0x95,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xc1,
+	0x38,
+	0xdf,
+	0x04,
+	0xc1,
+	0x38,
+	0xdf,
+	0x7f,
+	0x91,
+	0xc1,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xce,
+	0x2d,
+	0xe6,
+	0x03,
+	0xaa,
+	0x4c,
+	0xd3,
+	0x79,
+	0x97,
+	0xf7,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xdb,
+	0x22,
+	0xed,
+	0x02,
+	0x98,
+	0x5c,
+	0xc9,
+	0x65,
+	0xa8,
+	0x2c,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xe7,
+	0x16,
+	0xf3,
+	0x01,
+	0x8b,
+	0x67,
+	0xc2,
+	0x49,
+	0xc1,
+	0x59,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0xf4,
+	0x0b,
+	0xfa,
+	0x01,
+	0x84,
+	0x6e,
+	0xbe,
+	0x26,
+	0xe0,
+	0x76,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x70,
+	0xbd,
+	0x00,
+	0x00,
+	0x7f,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x0d,
+	0xf6,
+	0x07,
+	0x00,
+	0x84,
+	0x6e,
+	0xbe,
+	0xdb,
+	0x21,
+	0x76,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x1a,
+	0xeb,
+	0x0e,
+	0x00,
+	0x8b,
+	0x67,
+	0xc2,
+	0xb8,
+	0x40,
+	0x59,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x26,
+	0xdf,
+	0x14,
+	0xff,
+	0x98,
+	0x5c,
+	0xc9,
+	0x9c,
+	0x59,
+	0x2c,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x33,
+	0xd4,
+	0x1b,
+	0xfe,
+	0xaa,
+	0x4c,
+	0xd3,
+	0x88,
+	0x6a,
+	0xf7,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x40,
+	0xc9,
+	0x22,
+	0xfd,
+	0xc1,
+	0x38,
+	0xdf,
+	0x81,
+	0x70,
+	0xc1,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x4d,
+	0xbe,
+	0x29,
+	0xfd,
+	0xdd,
+	0x1f,
+	0xee,
+	0x89,
+	0x69,
+	0x95,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x5a,
+	0xb3,
+	0x30,
+	0xfc,
+	0xfe,
+	0x02,
+	0x00,
+	0xa4,
+	0x52,
+	0x81,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x66,
+	0xa7,
+	0x36,
+	0xfb,
+	0x24,
+	0xe2,
+	0x13,
+	0xd4,
+	0x27,
+	0x95,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x73,
+	0x9c,
+	0x3d,
+	0xfb,
+	0x4f,
+	0xbc,
+	0x2a,
+	0x1c,
+	0xe9,
+	0xe3,
+	0x91,
+	0x44,
+	0xfa,
+	0xc9,
+	0x7f,
+	0x91,
+	0x44,
+	0xfa,
+	0x7f,
+	0x91,
+	0x44,
+	0x7f,
+	0x91,
+	0x7f,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x81,
+	0x60,
+	0xf1,
+	0xb9,
+	0x7f,
+	0xa1,
+	0x10,
+	0x81,
+	0x60,
+	0x7f,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x8e,
+	0x56,
+	0xf3,
+	0xc0,
+	0x4f,
+	0xc5,
+	0x0a,
+	0xe5,
+	0x15,
+	0xe3,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x9b,
+	0x4d,
+	0xf4,
+	0xc7,
+	0x24,
+	0xe6,
+	0x04,
+	0x2d,
+	0xdf,
+	0x95,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xa7,
+	0x43,
+	0xf6,
+	0xcf,
+	0xfe,
+	0x02,
+	0x00,
+	0x5d,
+	0xbb,
+	0x81,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xb4,
+	0x3a,
+	0xf7,
+	0xd6,
+	0xdd,
+	0x1b,
+	0xfd,
+	0x78,
+	0xa7,
+	0x95,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xc1,
+	0x30,
+	0xf9,
+	0xdd,
+	0xc1,
+	0x30,
+	0xf9,
+	0x7f,
+	0xa1,
+	0xc1,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xce,
+	0x26,
+	0xfb,
+	0xe4,
+	0xaa,
+	0x41,
+	0xf6,
+	0x79,
+	0xa6,
+	0xf7,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xdb,
+	0x1d,
+	0xfc,
+	0xeb,
+	0x98,
+	0x4f,
+	0xf4,
+	0x65,
+	0xb5,
+	0x2c,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xe7,
+	0x13,
+	0xfe,
+	0xf3,
+	0x8b,
+	0x58,
+	0xf2,
+	0x49,
+	0xca,
+	0x59,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0xf4,
+	0x0a,
+	0xff,
+	0xfa,
+	0x84,
+	0x5e,
+	0xf1,
+	0x26,
+	0xe5,
+	0x76,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x60,
+	0xf1,
+	0x00,
+	0x00,
+	0x7f,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x0d,
+	0xf7,
+	0x02,
+	0x07,
+	0x84,
+	0x5e,
+	0xf1,
+	0xdb,
+	0x1c,
+	0x76,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x1a,
+	0xee,
+	0x03,
+	0x0e,
+	0x8b,
+	0x58,
+	0xf2,
+	0xb8,
+	0x37,
+	0x59,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x26,
+	0xe4,
+	0x05,
+	0x16,
+	0x98,
+	0x4f,
+	0xf4,
+	0x9c,
+	0x4c,
+	0x2c,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x33,
+	0xdb,
+	0x06,
+	0x1d,
+	0xaa,
+	0x41,
+	0xf6,
+	0x88,
+	0x5b,
+	0xf7,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x40,
+	0xd1,
+	0x08,
+	0x24,
+	0xc1,
+	0x30,
+	0xf9,
+	0x81,
+	0x60,
+	0xc1,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x4d,
+	0xc7,
+	0x0a,
+	0x2b,
+	0xdd,
+	0x1b,
+	0xfd,
+	0x89,
+	0x5a,
+	0x95,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x5a,
+	0xbe,
+	0x0b,
+	0x32,
+	0xfe,
+	0x02,
+	0x00,
+	0xa4,
+	0x46,
+	0x81,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x66,
+	0xb4,
+	0x0d,
+	0x3a,
+	0x24,
+	0xe6,
+	0x04,
+	0xd4,
+	0x22,
+	0x95,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x73,
+	0xab,
+	0x0e,
+	0x41,
+	0x4f,
+	0xc5,
+	0x0a,
+	0x1c,
+	0xec,
+	0xe3,
+	0xa1,
+	0x10,
+	0x48,
+	0x85,
+	0x7f,
+	0xa1,
+	0x10,
+	0x48,
+	0x7f,
+	0xa1,
+	0x10,
+	0x7f,
+	0xa1,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x81,
+	0x50,
+	0x1c,
+	0x8e,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x81,
+	0x50,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x8e,
+	0x48,
+	0x19,
+	0x9a,
+	0x4f,
+	0xcf,
+	0xf0,
+	0xe5,
+	0x11,
+	0xe3,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x9b,
+	0x40,
+	0x16,
+	0xa5,
+	0x24,
+	0xeb,
+	0xf9,
+	0x2d,
+	0xe5,
+	0x95,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xa7,
+	0x38,
+	0x14,
+	0xb0,
+	0xfe,
+	0x02,
+	0x01,
+	0x5d,
+	0xc7,
+	0x81,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xb4,
+	0x30,
+	0x11,
+	0xbc,
+	0xdd,
+	0x16,
+	0x08,
+	0x78,
+	0xb6,
+	0x95,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xc1,
+	0x28,
+	0x0e,
+	0xc7,
+	0xc1,
+	0x28,
+	0x0e,
+	0x7f,
+	0xb1,
+	0xc1,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xce,
+	0x20,
+	0x0b,
+	0xd3,
+	0xaa,
+	0x36,
+	0x13,
+	0x79,
+	0xb5,
+	0xf7,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xdb,
+	0x18,
+	0x08,
+	0xdf,
+	0x98,
+	0x42,
+	0x17,
+	0x65,
+	0xc2,
+	0x2c,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xe7,
+	0x10,
+	0x06,
+	0xea,
+	0x8b,
+	0x4a,
+	0x1a,
+	0x49,
+	0xd4,
+	0x59,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0xf4,
+	0x08,
+	0x03,
+	0xf6,
+	0x84,
+	0x4e,
+	0x1b,
+	0x26,
+	0xe9,
+	0x76,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x50,
+	0x1c,
+	0x00,
+	0x00,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x0d,
+	0xf9,
+	0xfe,
+	0x0c,
+	0x84,
+	0x4e,
+	0x1b,
+	0xdb,
+	0x18,
+	0x76,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x1a,
+	0xf1,
+	0xfb,
+	0x17,
+	0x8b,
+	0x4a,
+	0x1a,
+	0xb8,
+	0x2d,
+	0x59,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x26,
+	0xe9,
+	0xf9,
+	0x23,
+	0x98,
+	0x42,
+	0x17,
+	0x9c,
+	0x3f,
+	0x2c,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x33,
+	0xe1,
+	0xf6,
+	0x2e,
+	0xaa,
+	0x36,
+	0x13,
+	0x88,
+	0x4c,
+	0xf7,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x40,
+	0xd9,
+	0xf3,
+	0x3a,
+	0xc1,
+	0x28,
+	0x0e,
+	0x81,
+	0x50,
+	0xc1,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x4d,
+	0xd1,
+	0xf0,
+	0x45,
+	0xdd,
+	0x16,
+	0x08,
+	0x89,
+	0x4b,
+	0x95,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x5a,
+	0xc9,
+	0xed,
+	0x50,
+	0xfe,
+	0x02,
+	0x01,
+	0xa4,
+	0x3a,
+	0x81,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x66,
+	0xc1,
+	0xeb,
+	0x5c,
+	0x24,
+	0xeb,
+	0xf9,
+	0xd4,
+	0x1c,
+	0x95,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x73,
+	0xb9,
+	0xe8,
+	0x67,
+	0x4f,
+	0xcf,
+	0xf0,
+	0x1c,
+	0xf0,
+	0xe3,
+	0xb1,
+	0xe5,
+	0x73,
+	0x8d,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x73,
+	0x7f,
+	0xb1,
+	0xe5,
+	0x7f,
+	0xb1,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x81,
+	0x40,
+	0x40,
+	0x81,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x81,
+	0x40,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x8e,
+	0x3a,
+	0x3a,
+	0x8e,
+	0x4f,
+	0xd9,
+	0xd9,
+	0xe5,
+	0x0e,
+	0xe3,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x9b,
+	0x33,
+	0x33,
+	0x9b,
+	0x24,
+	0xef,
+	0xef,
+	0x2d,
+	0xea,
+	0x95,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xa7,
+	0x2d,
+	0x2d,
+	0xa7,
+	0xfe,
+	0x01,
+	0x01,
+	0x5d,
+	0xd2,
+	0x81,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xb4,
+	0x26,
+	0x26,
+	0xb4,
+	0xdd,
+	0x12,
+	0x12,
+	0x78,
+	0xc5,
+	0x95,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x20,
+	0x20,
+	0xc1,
+	0xc1,
+	0x20,
+	0x20,
+	0x7f,
+	0xc1,
+	0xc1,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xce,
+	0x1a,
+	0x1a,
+	0xce,
+	0xaa,
+	0x2c,
+	0x2c,
+	0x79,
+	0xc5,
+	0xf7,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xdb,
+	0x13,
+	0x13,
+	0xdb,
+	0x98,
+	0x34,
+	0x34,
+	0x65,
+	0xce,
+	0x2c,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xe7,
+	0x0d,
+	0x0d,
+	0xe7,
+	0x8b,
+	0x3b,
+	0x3b,
+	0x49,
+	0xdd,
+	0x59,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xf4,
+	0x06,
+	0x06,
+	0xf4,
+	0x84,
+	0x3f,
+	0x3f,
+	0x26,
+	0xee,
+	0x76,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x40,
+	0x40,
+	0x00,
+	0x00,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x0d,
+	0xfb,
+	0xfb,
+	0x0d,
+	0x84,
+	0x3f,
+	0x3f,
+	0xdb,
+	0x13,
+	0x76,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x1a,
+	0xf4,
+	0xf4,
+	0x1a,
+	0x8b,
+	0x3b,
+	0x3b,
+	0xb8,
+	0x24,
+	0x59,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x26,
+	0xee,
+	0xee,
+	0x26,
+	0x98,
+	0x34,
+	0x34,
+	0x9c,
+	0x33,
+	0x2c,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x33,
+	0xe7,
+	0xe7,
+	0x33,
+	0xaa,
+	0x2c,
+	0x2c,
+	0x88,
+	0x3c,
+	0xf7,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x40,
+	0xe1,
+	0xe1,
+	0x40,
+	0xc1,
+	0x20,
+	0x20,
+	0x81,
+	0x40,
+	0xc1,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x4d,
+	0xdb,
+	0xdb,
+	0x4d,
+	0xdd,
+	0x12,
+	0x12,
+	0x89,
+	0x3c,
+	0x95,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x5a,
+	0xd4,
+	0xd4,
+	0x5a,
+	0xfe,
+	0x01,
+	0x01,
+	0xa4,
+	0x2f,
+	0x81,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x66,
+	0xce,
+	0xce,
+	0x66,
+	0x24,
+	0xef,
+	0xef,
+	0xd4,
+	0x17,
+	0x95,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x73,
+	0xc7,
+	0xc7,
+	0x73,
+	0x4f,
+	0xd9,
+	0xd9,
+	0x1c,
+	0xf3,
+	0xe3,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x7f,
+	0x7f,
+	0xc1,
+	0xc1,
+	0x7f,
+	0xc1,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x81,
+	0x30,
+	0x5c,
+	0x8c,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x81,
+	0x30,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x8e,
+	0x2b,
+	0x53,
+	0x98,
+	0x4f,
+	0xe3,
+	0xc8,
+	0xe5,
+	0x0a,
+	0xe3,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x9b,
+	0x26,
+	0x4a,
+	0xa3,
+	0x24,
+	0xf4,
+	0xe7,
+	0x2d,
+	0xf0,
+	0x95,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xa7,
+	0x22,
+	0x40,
+	0xaf,
+	0xfe,
+	0x01,
+	0x02,
+	0x5d,
+	0xde,
+	0x81,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xb4,
+	0x1d,
+	0x37,
+	0xbb,
+	0xdd,
+	0x0d,
+	0x1a,
+	0x78,
+	0xd4,
+	0x95,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xc1,
+	0x18,
+	0x2e,
+	0xc6,
+	0xc1,
+	0x18,
+	0x2e,
+	0x7f,
+	0xd1,
+	0xc1,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xce,
+	0x13,
+	0x25,
+	0xd2,
+	0xaa,
+	0x21,
+	0x3f,
+	0x79,
+	0xd4,
+	0xf7,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xdb,
+	0x0e,
+	0x1c,
+	0xde,
+	0x98,
+	0x27,
+	0x4b,
+	0x65,
+	0xdb,
+	0x2c,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xe7,
+	0x0a,
+	0x12,
+	0xea,
+	0x8b,
+	0x2c,
+	0x55,
+	0x49,
+	0xe6,
+	0x59,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0xf4,
+	0x05,
+	0x09,
+	0xf5,
+	0x84,
+	0x2f,
+	0x5a,
+	0x26,
+	0xf3,
+	0x76,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x30,
+	0x5c,
+	0x00,
+	0x00,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x0d,
+	0xfc,
+	0xf8,
+	0x0c,
+	0x84,
+	0x2f,
+	0x5a,
+	0xdb,
+	0x0e,
+	0x76,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x1a,
+	0xf7,
+	0xef,
+	0x17,
+	0x8b,
+	0x2c,
+	0x55,
+	0xb8,
+	0x1b,
+	0x59,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x26,
+	0xf3,
+	0xe5,
+	0x23,
+	0x98,
+	0x27,
+	0x4b,
+	0x9c,
+	0x26,
+	0x2c,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x33,
+	0xee,
+	0xdc,
+	0x2f,
+	0xaa,
+	0x21,
+	0x3f,
+	0x88,
+	0x2d,
+	0xf7,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x40,
+	0xe9,
+	0xd3,
+	0x3b,
+	0xc1,
+	0x18,
+	0x2e,
+	0x81,
+	0x30,
+	0xc1,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x4d,
+	0xe4,
+	0xca,
+	0x46,
+	0xdd,
+	0x0d,
+	0x1a,
+	0x89,
+	0x2d,
+	0x95,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x5a,
+	0xdf,
+	0xc1,
+	0x52,
+	0xfe,
+	0x01,
+	0x02,
+	0xa4,
+	0x23,
+	0x81,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x66,
+	0xdb,
+	0xb7,
+	0x5e,
+	0x24,
+	0xf4,
+	0xe7,
+	0xd4,
+	0x11,
+	0x95,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x73,
+	0xd6,
+	0xae,
+	0x69,
+	0x4f,
+	0xe3,
+	0xc8,
+	0x1c,
+	0xf7,
+	0xe3,
+	0xd1,
+	0xa5,
+	0x75,
+	0x04,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x75,
+	0x7f,
+	0xd1,
+	0xa5,
+	0x7f,
+	0xd1,
+	0x7f,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x81,
+	0x20,
+	0x70,
+	0xa9,
+	0x7f,
+	0xe1,
+	0x91,
+	0x81,
+	0x20,
+	0x7f,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x8e,
+	0x1d,
+	0x65,
+	0xb2,
+	0x4f,
+	0xed,
+	0xbc,
+	0xe5,
+	0x07,
+	0xe3,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x9b,
+	0x1a,
+	0x5a,
+	0xbb,
+	0x24,
+	0xf8,
+	0xe2,
+	0x2d,
+	0xf6,
+	0x95,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xa7,
+	0x16,
+	0x4e,
+	0xc3,
+	0xfe,
+	0x01,
+	0x02,
+	0x5d,
+	0xea,
+	0x81,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xb4,
+	0x13,
+	0x43,
+	0xcc,
+	0xdd,
+	0x09,
+	0x1f,
+	0x78,
+	0xe3,
+	0x95,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xc1,
+	0x10,
+	0x38,
+	0xd5,
+	0xc1,
+	0x10,
+	0x38,
+	0x7f,
+	0xe1,
+	0xc1,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xce,
+	0x0d,
+	0x2d,
+	0xde,
+	0xaa,
+	0x16,
+	0x4c,
+	0x79,
+	0xe3,
+	0xf7,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xdb,
+	0x0a,
+	0x22,
+	0xe7,
+	0x98,
+	0x1a,
+	0x5c,
+	0x65,
+	0xe8,
+	0x2c,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xe7,
+	0x06,
+	0x16,
+	0xef,
+	0x8b,
+	0x1d,
+	0x67,
+	0x49,
+	0xef,
+	0x59,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0xf4,
+	0x03,
+	0x0b,
+	0xf8,
+	0x84,
+	0x1f,
+	0x6e,
+	0x26,
+	0xf8,
+	0x76,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x20,
+	0x70,
+	0x00,
+	0x00,
+	0x7f,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x0d,
+	0xfe,
+	0xf6,
+	0x09,
+	0x84,
+	0x1f,
+	0x6e,
+	0xdb,
+	0x09,
+	0x76,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x1a,
+	0xfb,
+	0xeb,
+	0x12,
+	0x8b,
+	0x1d,
+	0x67,
+	0xb8,
+	0x12,
+	0x59,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x26,
+	0xf7,
+	0xdf,
+	0x1a,
+	0x98,
+	0x1a,
+	0x5c,
+	0x9c,
+	0x19,
+	0x2c,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x33,
+	0xf4,
+	0xd4,
+	0x23,
+	0xaa,
+	0x16,
+	0x4c,
+	0x88,
+	0x1e,
+	0xf7,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x40,
+	0xf1,
+	0xc9,
+	0x2c,
+	0xc1,
+	0x10,
+	0x38,
+	0x81,
+	0x20,
+	0xc1,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x4d,
+	0xee,
+	0xbe,
+	0x35,
+	0xdd,
+	0x09,
+	0x1f,
+	0x89,
+	0x1e,
+	0x95,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x5a,
+	0xeb,
+	0xb3,
+	0x3e,
+	0xfe,
+	0x01,
+	0x02,
+	0xa4,
+	0x17,
+	0x81,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x66,
+	0xe7,
+	0xa7,
+	0x46,
+	0x24,
+	0xf8,
+	0xe2,
+	0xd4,
+	0x0b,
+	0x95,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x73,
+	0xe4,
+	0x9c,
+	0x4f,
+	0x4f,
+	0xed,
+	0xbc,
+	0x1c,
+	0xfa,
+	0xe3,
+	0xe1,
+	0x91,
+	0x58,
+	0x44,
+	0x7f,
+	0xe1,
+	0x91,
+	0x58,
+	0x7f,
+	0xe1,
+	0x91,
+	0x7f,
+	0xe1,
+	0x7f,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x81,
+	0x10,
+	0x7c,
+	0xd2,
+	0x7f,
+	0xf1,
+	0x85,
+	0x81,
+	0x10,
+	0x7f,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x8e,
+	0x0e,
+	0x70,
+	0xd7,
+	0x4f,
+	0xf7,
+	0xb4,
+	0xe5,
+	0x03,
+	0xe3,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x9b,
+	0x0d,
+	0x63,
+	0xdb,
+	0x24,
+	0xfd,
+	0xde,
+	0x2d,
+	0xfb,
+	0x95,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xa7,
+	0x0b,
+	0x57,
+	0xe0,
+	0xfe,
+	0x00,
+	0x02,
+	0x5d,
+	0xf5,
+	0x81,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xb4,
+	0x0a,
+	0x4a,
+	0xe5,
+	0xdd,
+	0x04,
+	0x23,
+	0x78,
+	0xf2,
+	0x95,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xc1,
+	0x08,
+	0x3e,
+	0xe9,
+	0xc1,
+	0x08,
+	0x3e,
+	0x7f,
+	0xf1,
+	0xc1,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xce,
+	0x06,
+	0x32,
+	0xee,
+	0xaa,
+	0x0b,
+	0x54,
+	0x79,
+	0xf2,
+	0xf7,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xdb,
+	0x05,
+	0x25,
+	0xf3,
+	0x98,
+	0x0d,
+	0x66,
+	0x65,
+	0xf4,
+	0x2c,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xe7,
+	0x03,
+	0x19,
+	0xf8,
+	0x8b,
+	0x0f,
+	0x72,
+	0x49,
+	0xf8,
+	0x59,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0xf4,
+	0x02,
+	0x0c,
+	0xfc,
+	0x84,
+	0x10,
+	0x7a,
+	0x26,
+	0xfc,
+	0x76,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x10,
+	0x7c,
+	0x00,
+	0x00,
+	0x7f,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x0d,
+	0xff,
+	0xf5,
+	0x05,
+	0x84,
+	0x10,
+	0x7a,
+	0xdb,
+	0x05,
+	0x76,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x1a,
+	0xfe,
+	0xe8,
+	0x09,
+	0x8b,
+	0x0f,
+	0x72,
+	0xb8,
+	0x09,
+	0x59,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x26,
+	0xfc,
+	0xdc,
+	0x0e,
+	0x98,
+	0x0d,
+	0x66,
+	0x9c,
+	0x0d,
+	0x2c,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x33,
+	0xfb,
+	0xcf,
+	0x13,
+	0xaa,
+	0x0b,
+	0x54,
+	0x88,
+	0x0f,
+	0xf7,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x40,
+	0xf9,
+	0xc3,
+	0x18,
+	0xc1,
+	0x08,
+	0x3e,
+	0x81,
+	0x10,
+	0xc1,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x4d,
+	0xf7,
+	0xb7,
+	0x1c,
+	0xdd,
+	0x04,
+	0x23,
+	0x89,
+	0x0f,
+	0x95,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x5a,
+	0xf6,
+	0xaa,
+	0x21,
+	0xfe,
+	0x00,
+	0x02,
+	0xa4,
+	0x0c,
+	0x81,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x66,
+	0xf4,
+	0x9e,
+	0x26,
+	0x24,
+	0xfd,
+	0xde,
+	0xd4,
+	0x06,
+	0x95,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x73,
+	0xf3,
+	0x91,
+	0x2a,
+	0x4f,
+	0xf7,
+	0xb4,
+	0x1c,
+	0xfe,
+	0xe3,
+	0xf1,
+	0x85,
+	0x2f,
+	0x70,
+	0x7f,
+	0xf1,
+	0x85,
+	0x2f,
+	0x7f,
+	0xf1,
+	0x85,
+	0x7f,
+	0xf1,
+	0x7f,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x81,
+	0x00,
+	0x7f,
+	0x00,
+	0x7f,
+	0x00,
+	0x81,
+	0x81,
+	0x00,
+	0x7f,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x8e,
+	0x00,
+	0x73,
+	0x00,
+	0x4f,
+	0x00,
+	0xb2,
+	0xe5,
+	0x00,
+	0xe3,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x9b,
+	0x00,
+	0x66,
+	0x00,
+	0x24,
+	0x00,
+	0xdd,
+	0x2d,
+	0x00,
+	0x95,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xa7,
+	0x00,
+	0x5a,
+	0x00,
+	0xfe,
+	0x00,
+	0x03,
+	0x5d,
+	0x00,
+	0x81,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xb4,
+	0x00,
+	0x4d,
+	0x00,
+	0xdd,
+	0x00,
+	0x24,
+	0x78,
+	0x00,
+	0x95,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xc1,
+	0x00,
+	0x40,
+	0x00,
+	0xc1,
+	0x00,
+	0x40,
+	0x7f,
+	0x00,
+	0xc1,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xce,
+	0x00,
+	0x33,
+	0x00,
+	0xaa,
+	0x00,
+	0x57,
+	0x79,
+	0x00,
+	0xf7,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xdb,
+	0x00,
+	0x26,
+	0x00,
+	0x98,
+	0x00,
+	0x69,
+	0x65,
+	0x00,
+	0x2c,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xe7,
+	0x00,
+	0x1a,
+	0x00,
+	0x8b,
+	0x00,
+	0x76,
+	0x49,
+	0x00,
+	0x59,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0xf4,
+	0x00,
+	0x0d,
+	0x00,
+	0x84,
+	0x00,
+	0x7d,
+	0x26,
+	0x00,
+	0x76,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x00,
+	0x00,
+	0x7f,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x0d,
+	0x00,
+	0xf4,
+	0x00,
+	0x84,
+	0x00,
+	0x7d,
+	0xdb,
+	0x00,
+	0x76,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x1a,
+	0x00,
+	0xe7,
+	0x00,
+	0x8b,
+	0x00,
+	0x76,
+	0xb8,
+	0x00,
+	0x59,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x26,
+	0x00,
+	0xdb,
+	0x00,
+	0x98,
+	0x00,
+	0x69,
+	0x9c,
+	0x00,
+	0x2c,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x33,
+	0x00,
+	0xce,
+	0x00,
+	0xaa,
+	0x00,
+	0x57,
+	0x88,
+	0x00,
+	0xf7,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x40,
+	0x00,
+	0xc1,
+	0x00,
+	0xc1,
+	0x00,
+	0x40,
+	0x81,
+	0x00,
+	0xc1,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x4d,
+	0x00,
+	0xb4,
+	0x00,
+	0xdd,
+	0x00,
+	0x24,
+	0x89,
+	0x00,
+	0x95,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x5a,
+	0x00,
+	0xa7,
+	0x00,
+	0xfe,
+	0x00,
+	0x03,
+	0xa4,
+	0x00,
+	0x81,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x66,
+	0x00,
+	0x9b,
+	0x00,
+	0x24,
+	0x00,
+	0xdd,
+	0xd4,
+	0x00,
+	0x95,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x73,
+	0x00,
+	0x8e,
+	0x00,
+	0x4f,
+	0x00,
+	0xb2,
+	0x1c,
+	0x00,
+	0xe3,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x7f,
+	0x00,
+	0x81,
+	0x00,
+	0x7f,
+	0x00,
+	0x81,
+	0x7f,
+	0x00,
+	0x7f,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x81,
+	0xf1,
+	0x7c,
+	0x2f,
+	0x7f,
+	0x10,
+	0x85,
+	0x81,
+	0xf1,
+	0x7f,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x8e,
+	0xf3,
+	0x70,
+	0x2a,
+	0x4f,
+	0x0a,
+	0xb4,
+	0xe5,
+	0xfe,
+	0xe3,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x9b,
+	0xf4,
+	0x63,
+	0x26,
+	0x24,
+	0x04,
+	0xde,
+	0x2d,
+	0x06,
+	0x95,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xa7,
+	0xf6,
+	0x57,
+	0x21,
+	0xfe,
+	0x00,
+	0x02,
+	0x5d,
+	0x0c,
+	0x81,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xb4,
+	0xf7,
+	0x4a,
+	0x1c,
+	0xdd,
+	0xfd,
+	0x23,
+	0x78,
+	0x0f,
+	0x95,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xc1,
+	0xf9,
+	0x3e,
+	0x17,
+	0xc1,
+	0xf9,
+	0x3e,
+	0x7f,
+	0x10,
+	0xc1,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xce,
+	0xfb,
+	0x32,
+	0x13,
+	0xaa,
+	0xf6,
+	0x54,
+	0x79,
+	0x0f,
+	0xf7,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xdb,
+	0xfc,
+	0x25,
+	0x0e,
+	0x98,
+	0xf4,
+	0x66,
+	0x65,
+	0x0d,
+	0x2c,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xe7,
+	0xfe,
+	0x19,
+	0x09,
+	0x8b,
+	0xf2,
+	0x72,
+	0x49,
+	0x09,
+	0x59,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0xf4,
+	0xff,
+	0x0c,
+	0x05,
+	0x84,
+	0xf1,
+	0x7a,
+	0x26,
+	0x05,
+	0x76,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xf1,
+	0x7c,
+	0x00,
+	0x00,
+	0x7f,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x0d,
+	0x02,
+	0xf5,
+	0xfc,
+	0x84,
+	0xf1,
+	0x7a,
+	0xdb,
+	0xfc,
+	0x76,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x1a,
+	0x03,
+	0xe8,
+	0xf8,
+	0x8b,
+	0xf2,
+	0x72,
+	0xb8,
+	0xf8,
+	0x59,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x26,
+	0x05,
+	0xdc,
+	0xf3,
+	0x98,
+	0xf4,
+	0x66,
+	0x9c,
+	0xf4,
+	0x2c,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x33,
+	0x06,
+	0xcf,
+	0xee,
+	0xaa,
+	0xf6,
+	0x54,
+	0x88,
+	0xf2,
+	0xf7,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x40,
+	0x08,
+	0xc3,
+	0xea,
+	0xc1,
+	0xf9,
+	0x3e,
+	0x81,
+	0xf1,
+	0xc1,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x4d,
+	0x0a,
+	0xb7,
+	0xe5,
+	0xdd,
+	0xfd,
+	0x23,
+	0x89,
+	0xf2,
+	0x95,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x5a,
+	0x0b,
+	0xaa,
+	0xe0,
+	0xfe,
+	0x00,
+	0x02,
+	0xa4,
+	0xf5,
+	0x81,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x66,
+	0x0d,
+	0x9e,
+	0xdb,
+	0x24,
+	0x04,
+	0xde,
+	0xd4,
+	0xfb,
+	0x95,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x73,
+	0x0e,
+	0x91,
+	0xd7,
+	0x4f,
+	0x0a,
+	0xb4,
+	0x1c,
+	0x03,
+	0xe3,
+	0x10,
+	0x85,
+	0xd2,
+	0x70,
+	0x7f,
+	0x10,
+	0x85,
+	0xd2,
+	0x7f,
+	0x10,
+	0x85,
+	0x7f,
+	0x10,
+	0x7f,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x81,
+	0xe1,
+	0x70,
+	0x58,
+	0x7f,
+	0x20,
+	0x91,
+	0x81,
+	0xe1,
+	0x7f,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x8e,
+	0xe4,
+	0x65,
+	0x4f,
+	0x4f,
+	0x14,
+	0xbc,
+	0xe5,
+	0xfa,
+	0xe3,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x9b,
+	0xe7,
+	0x5a,
+	0x46,
+	0x24,
+	0x09,
+	0xe2,
+	0x2d,
+	0x0b,
+	0x95,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xa7,
+	0xeb,
+	0x4e,
+	0x3e,
+	0xfe,
+	0x00,
+	0x02,
+	0x5d,
+	0x17,
+	0x81,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xb4,
+	0xee,
+	0x43,
+	0x35,
+	0xdd,
+	0xf8,
+	0x1f,
+	0x78,
+	0x1e,
+	0x95,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xc1,
+	0xf1,
+	0x38,
+	0x2c,
+	0xc1,
+	0xf1,
+	0x38,
+	0x7f,
+	0x20,
+	0xc1,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xce,
+	0xf4,
+	0x2d,
+	0x23,
+	0xaa,
+	0xeb,
+	0x4c,
+	0x79,
+	0x1e,
+	0xf7,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xdb,
+	0xf7,
+	0x22,
+	0x1a,
+	0x98,
+	0xe7,
+	0x5c,
+	0x65,
+	0x19,
+	0x2c,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xe7,
+	0xfb,
+	0x16,
+	0x12,
+	0x8b,
+	0xe4,
+	0x67,
+	0x49,
+	0x12,
+	0x59,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0xf4,
+	0xfe,
+	0x0b,
+	0x09,
+	0x84,
+	0xe2,
+	0x6e,
+	0x26,
+	0x09,
+	0x76,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xe1,
+	0x70,
+	0x00,
+	0x00,
+	0x7f,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x0d,
+	0x03,
+	0xf6,
+	0xf8,
+	0x84,
+	0xe2,
+	0x6e,
+	0xdb,
+	0xf8,
+	0x76,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x1a,
+	0x06,
+	0xeb,
+	0xef,
+	0x8b,
+	0xe4,
+	0x67,
+	0xb8,
+	0xef,
+	0x59,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x26,
+	0x0a,
+	0xdf,
+	0xe7,
+	0x98,
+	0xe7,
+	0x5c,
+	0x9c,
+	0xe8,
+	0x2c,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x33,
+	0x0d,
+	0xd4,
+	0xde,
+	0xaa,
+	0xeb,
+	0x4c,
+	0x88,
+	0xe3,
+	0xf7,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x40,
+	0x10,
+	0xc9,
+	0xd5,
+	0xc1,
+	0xf1,
+	0x38,
+	0x81,
+	0xe1,
+	0xc1,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x4d,
+	0x13,
+	0xbe,
+	0xcc,
+	0xdd,
+	0xf8,
+	0x1f,
+	0x89,
+	0xe3,
+	0x95,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x5a,
+	0x16,
+	0xb3,
+	0xc3,
+	0xfe,
+	0x00,
+	0x02,
+	0xa4,
+	0xea,
+	0x81,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x66,
+	0x1a,
+	0xa7,
+	0xbb,
+	0x24,
+	0x09,
+	0xe2,
+	0xd4,
+	0xf6,
+	0x95,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x73,
+	0x1d,
+	0x9c,
+	0xb2,
+	0x4f,
+	0x14,
+	0xbc,
+	0x1c,
+	0x07,
+	0xe3,
+	0x20,
+	0x91,
+	0xa9,
+	0x44,
+	0x7f,
+	0x20,
+	0x91,
+	0xa9,
+	0x7f,
+	0x20,
+	0x91,
+	0x7f,
+	0x20,
+	0x7f,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x81,
+	0xd1,
+	0x5c,
+	0x75,
+	0x7f,
+	0x30,
+	0xa5,
+	0x81,
+	0xd1,
+	0x7f,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x8e,
+	0xd6,
+	0x53,
+	0x69,
+	0x4f,
+	0x1e,
+	0xc8,
+	0xe5,
+	0xf7,
+	0xe3,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x9b,
+	0xdb,
+	0x4a,
+	0x5e,
+	0x24,
+	0x0d,
+	0xe7,
+	0x2d,
+	0x11,
+	0x95,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xa7,
+	0xdf,
+	0x40,
+	0x52,
+	0xfe,
+	0x00,
+	0x02,
+	0x5d,
+	0x23,
+	0x81,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xb4,
+	0xe4,
+	0x37,
+	0x46,
+	0xdd,
+	0xf4,
+	0x1a,
+	0x78,
+	0x2d,
+	0x95,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xc1,
+	0xe9,
+	0x2e,
+	0x3b,
+	0xc1,
+	0xe9,
+	0x2e,
+	0x7f,
+	0x30,
+	0xc1,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xce,
+	0xee,
+	0x25,
+	0x2f,
+	0xaa,
+	0xe0,
+	0x3f,
+	0x79,
+	0x2d,
+	0xf7,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xdb,
+	0xf3,
+	0x1c,
+	0x23,
+	0x98,
+	0xda,
+	0x4b,
+	0x65,
+	0x26,
+	0x2c,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xe7,
+	0xf7,
+	0x12,
+	0x17,
+	0x8b,
+	0xd5,
+	0x55,
+	0x49,
+	0x1b,
+	0x59,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0xf4,
+	0xfc,
+	0x09,
+	0x0c,
+	0x84,
+	0xd2,
+	0x5a,
+	0x26,
+	0x0e,
+	0x76,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xd1,
+	0x5c,
+	0x00,
+	0x00,
+	0x7f,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x0d,
+	0x05,
+	0xf8,
+	0xf5,
+	0x84,
+	0xd2,
+	0x5a,
+	0xdb,
+	0xf3,
+	0x76,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x1a,
+	0x0a,
+	0xef,
+	0xea,
+	0x8b,
+	0xd5,
+	0x55,
+	0xb8,
+	0xe6,
+	0x59,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x26,
+	0x0e,
+	0xe5,
+	0xde,
+	0x98,
+	0xda,
+	0x4b,
+	0x9c,
+	0xdb,
+	0x2c,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x33,
+	0x13,
+	0xdc,
+	0xd2,
+	0xaa,
+	0xe0,
+	0x3f,
+	0x88,
+	0xd4,
+	0xf7,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x40,
+	0x18,
+	0xd3,
+	0xc6,
+	0xc1,
+	0xe9,
+	0x2e,
+	0x81,
+	0xd1,
+	0xc1,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x4d,
+	0x1d,
+	0xca,
+	0xbb,
+	0xdd,
+	0xf4,
+	0x1a,
+	0x89,
+	0xd4,
+	0x95,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x5a,
+	0x22,
+	0xc1,
+	0xaf,
+	0xfe,
+	0x00,
+	0x02,
+	0xa4,
+	0xde,
+	0x81,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x66,
+	0x26,
+	0xb7,
+	0xa3,
+	0x24,
+	0x0d,
+	0xe7,
+	0xd4,
+	0xf0,
+	0x95,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x73,
+	0x2b,
+	0xae,
+	0x98,
+	0x4f,
+	0x1e,
+	0xc8,
+	0x1c,
+	0x0a,
+	0xe3,
+	0x30,
+	0xa5,
+	0x8c,
+	0x04,
+	0x7f,
+	0x30,
+	0xa5,
+	0x8c,
+	0x7f,
+	0x30,
+	0xa5,
+	0x7f,
+	0x30,
+	0x7f,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x81,
+	0xc1,
+	0x40,
+	0x7f,
+	0x7f,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x7f,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x8e,
+	0xc7,
+	0x3a,
+	0x73,
+	0x4f,
+	0x28,
+	0xd9,
+	0xe5,
+	0xf3,
+	0xe3,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x9b,
+	0xce,
+	0x33,
+	0x66,
+	0x24,
+	0x12,
+	0xef,
+	0x2d,
+	0x17,
+	0x95,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xa7,
+	0xd4,
+	0x2d,
+	0x5a,
+	0xfe,
+	0x00,
+	0x01,
+	0x5d,
+	0x2f,
+	0x81,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xb4,
+	0xdb,
+	0x26,
+	0x4d,
+	0xdd,
+	0xef,
+	0x12,
+	0x78,
+	0x3c,
+	0x95,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xc1,
+	0xe1,
+	0x20,
+	0x40,
+	0xc1,
+	0xe1,
+	0x20,
+	0x7f,
+	0x40,
+	0xc1,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xce,
+	0xe7,
+	0x1a,
+	0x33,
+	0xaa,
+	0xd5,
+	0x2c,
+	0x79,
+	0x3c,
+	0xf7,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xdb,
+	0xee,
+	0x13,
+	0x26,
+	0x98,
+	0xcd,
+	0x34,
+	0x65,
+	0x33,
+	0x2c,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xe7,
+	0xf4,
+	0x0d,
+	0x1a,
+	0x8b,
+	0xc6,
+	0x3b,
+	0x49,
+	0x24,
+	0x59,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0xf4,
+	0xfb,
+	0x06,
+	0x0d,
+	0x84,
+	0xc2,
+	0x3f,
+	0x26,
+	0x13,
+	0x76,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xc1,
+	0x40,
+	0x00,
+	0x00,
+	0x7f,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x0d,
+	0x06,
+	0xfb,
+	0xf4,
+	0x84,
+	0xc2,
+	0x3f,
+	0xdb,
+	0xee,
+	0x76,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x1a,
+	0x0d,
+	0xf4,
+	0xe7,
+	0x8b,
+	0xc6,
+	0x3b,
+	0xb8,
+	0xdd,
+	0x59,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x26,
+	0x13,
+	0xee,
+	0xdb,
+	0x98,
+	0xcd,
+	0x34,
+	0x9c,
+	0xce,
+	0x2c,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x33,
+	0x1a,
+	0xe7,
+	0xce,
+	0xaa,
+	0xd5,
+	0x2c,
+	0x88,
+	0xc5,
+	0xf7,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x40,
+	0x20,
+	0xe1,
+	0xc1,
+	0xc1,
+	0xe1,
+	0x20,
+	0x81,
+	0xc1,
+	0xc1,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x4d,
+	0x26,
+	0xdb,
+	0xb4,
+	0xdd,
+	0xef,
+	0x12,
+	0x89,
+	0xc5,
+	0x95,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x5a,
+	0x2d,
+	0xd4,
+	0xa7,
+	0xfe,
+	0x00,
+	0x01,
+	0xa4,
+	0xd2,
+	0x81,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x66,
+	0x33,
+	0xce,
+	0x9b,
+	0x24,
+	0x12,
+	0xef,
+	0xd4,
+	0xea,
+	0x95,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x73,
+	0x3a,
+	0xc7,
+	0x8e,
+	0x4f,
+	0x28,
+	0xd9,
+	0x1c,
+	0x0e,
+	0xe3,
+	0x40,
+	0xc1,
+	0x81,
+	0xc1,
+	0x7f,
+	0x40,
+	0xc1,
+	0x81,
+	0x7f,
+	0x40,
+	0xc1,
+	0x7f,
+	0x40,
+	0x7f,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x81,
+	0xb1,
+	0x1c,
+	0x73,
+	0x7f,
+	0x50,
+	0xe5,
+	0x81,
+	0xb1,
+	0x7f,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x8e,
+	0xb9,
+	0x19,
+	0x68,
+	0x4f,
+	0x32,
+	0xf0,
+	0xe5,
+	0xf0,
+	0xe3,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x9b,
+	0xc1,
+	0x16,
+	0x5c,
+	0x24,
+	0x16,
+	0xf9,
+	0x2d,
+	0x1c,
+	0x95,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xa7,
+	0xc9,
+	0x14,
+	0x51,
+	0xfe,
+	0xff,
+	0x01,
+	0x5d,
+	0x3a,
+	0x81,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xb4,
+	0xd1,
+	0x11,
+	0x45,
+	0xdd,
+	0xeb,
+	0x08,
+	0x78,
+	0x4b,
+	0x95,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xc1,
+	0xd9,
+	0x0e,
+	0x3a,
+	0xc1,
+	0xd9,
+	0x0e,
+	0x7f,
+	0x50,
+	0xc1,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xce,
+	0xe1,
+	0x0b,
+	0x2e,
+	0xaa,
+	0xcb,
+	0x13,
+	0x79,
+	0x4c,
+	0xf7,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xdb,
+	0xe9,
+	0x08,
+	0x23,
+	0x98,
+	0xbf,
+	0x17,
+	0x65,
+	0x3f,
+	0x2c,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xe7,
+	0xf1,
+	0x06,
+	0x17,
+	0x8b,
+	0xb7,
+	0x1a,
+	0x49,
+	0x2d,
+	0x59,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0xf4,
+	0xf9,
+	0x03,
+	0x0b,
+	0x84,
+	0xb3,
+	0x1b,
+	0x26,
+	0x18,
+	0x76,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xb1,
+	0x1c,
+	0x00,
+	0x00,
+	0x7f,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x0d,
+	0x08,
+	0xfe,
+	0xf5,
+	0x84,
+	0xb3,
+	0x1b,
+	0xdb,
+	0xe9,
+	0x76,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x1a,
+	0x10,
+	0xfb,
+	0xea,
+	0x8b,
+	0xb7,
+	0x1a,
+	0xb8,
+	0xd4,
+	0x59,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x26,
+	0x18,
+	0xf9,
+	0xde,
+	0x98,
+	0xbf,
+	0x17,
+	0x9c,
+	0xc2,
+	0x2c,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x33,
+	0x20,
+	0xf6,
+	0xd3,
+	0xaa,
+	0xcb,
+	0x13,
+	0x88,
+	0xb5,
+	0xf7,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x40,
+	0x28,
+	0xf3,
+	0xc7,
+	0xc1,
+	0xd9,
+	0x0e,
+	0x81,
+	0xb1,
+	0xc1,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x4d,
+	0x30,
+	0xf0,
+	0xbc,
+	0xdd,
+	0xeb,
+	0x08,
+	0x89,
+	0xb6,
+	0x95,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x5a,
+	0x38,
+	0xed,
+	0xb0,
+	0xfe,
+	0xff,
+	0x01,
+	0xa4,
+	0xc7,
+	0x81,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x66,
+	0x40,
+	0xeb,
+	0xa5,
+	0x24,
+	0x16,
+	0xf9,
+	0xd4,
+	0xe5,
+	0x95,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x73,
+	0x48,
+	0xe8,
+	0x99,
+	0x4f,
+	0x32,
+	0xf0,
+	0x1c,
+	0x11,
+	0xe3,
+	0x50,
+	0xe5,
+	0x8e,
+	0x8d,
+	0x7f,
+	0x50,
+	0xe5,
+	0x8e,
+	0x7f,
+	0x50,
+	0xe5,
+	0x7f,
+	0x50,
+	0x7f,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x81,
+	0xa1,
+	0xf1,
+	0x48,
+	0x7f,
+	0x60,
+	0x10,
+	0x81,
+	0xa1,
+	0x7f,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x8e,
+	0xab,
+	0xf3,
+	0x41,
+	0x4f,
+	0x3c,
+	0x0a,
+	0xe5,
+	0xec,
+	0xe3,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x9b,
+	0xb4,
+	0xf4,
+	0x3a,
+	0x24,
+	0x1b,
+	0x04,
+	0x2d,
+	0x22,
+	0x95,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xa7,
+	0xbe,
+	0xf6,
+	0x32,
+	0xfe,
+	0xff,
+	0x00,
+	0x5d,
+	0x46,
+	0x81,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xb4,
+	0xc7,
+	0xf7,
+	0x2b,
+	0xdd,
+	0xe6,
+	0xfd,
+	0x78,
+	0x5a,
+	0x95,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xc1,
+	0xd1,
+	0xf9,
+	0x24,
+	0xc1,
+	0xd1,
+	0xf9,
+	0x7f,
+	0x60,
+	0xc1,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xce,
+	0xdb,
+	0xfb,
+	0x1d,
+	0xaa,
+	0xc0,
+	0xf6,
+	0x79,
+	0x5b,
+	0xf7,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xdb,
+	0xe4,
+	0xfc,
+	0x16,
+	0x98,
+	0xb2,
+	0xf4,
+	0x65,
+	0x4c,
+	0x2c,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xe7,
+	0xee,
+	0xfe,
+	0x0e,
+	0x8b,
+	0xa9,
+	0xf2,
+	0x49,
+	0x37,
+	0x59,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0xf4,
+	0xf7,
+	0xff,
+	0x07,
+	0x84,
+	0xa3,
+	0xf1,
+	0x26,
+	0x1c,
+	0x76,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0xa1,
+	0xf1,
+	0x00,
+	0x00,
+	0x7f,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x0d,
+	0x0a,
+	0x02,
+	0xfa,
+	0x84,
+	0xa3,
+	0xf1,
+	0xdb,
+	0xe5,
+	0x76,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x1a,
+	0x13,
+	0x03,
+	0xf3,
+	0x8b,
+	0xa9,
+	0xf2,
+	0xb8,
+	0xca,
+	0x59,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x26,
+	0x1d,
+	0x05,
+	0xeb,
+	0x98,
+	0xb2,
+	0xf4,
+	0x9c,
+	0xb5,
+	0x2c,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x33,
+	0x26,
+	0x06,
+	0xe4,
+	0xaa,
+	0xc0,
+	0xf6,
+	0x88,
+	0xa6,
+	0xf7,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x40,
+	0x30,
+	0x08,
+	0xdd,
+	0xc1,
+	0xd1,
+	0xf9,
+	0x81,
+	0xa1,
+	0xc1,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x4d,
+	0x3a,
+	0x0a,
+	0xd6,
+	0xdd,
+	0xe6,
+	0xfd,
+	0x89,
+	0xa7,
+	0x95,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x5a,
+	0x43,
+	0x0b,
+	0xcf,
+	0xfe,
+	0xff,
+	0x00,
+	0xa4,
+	0xbb,
+	0x81,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x66,
+	0x4d,
+	0x0d,
+	0xc7,
+	0x24,
+	0x1b,
+	0x04,
+	0xd4,
+	0xdf,
+	0x95,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x73,
+	0x56,
+	0x0e,
+	0xc0,
+	0x4f,
+	0x3c,
+	0x0a,
+	0x1c,
+	0x15,
+	0xe3,
+	0x60,
+	0x10,
+	0xb9,
+	0x85,
+	0x7f,
+	0x60,
+	0x10,
+	0xb9,
+	0x7f,
+	0x60,
+	0x10,
+	0x7f,
+	0x60,
+	0x7f,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x81,
+	0x91,
+	0xbd,
+	0xfa,
+	0x7f,
+	0x70,
+	0x44,
+	0x81,
+	0x91,
+	0x7f,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x8e,
+	0x9c,
+	0xc4,
+	0xfb,
+	0x4f,
+	0x45,
+	0x2a,
+	0xe5,
+	0xe9,
+	0xe3,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x9b,
+	0xa7,
+	0xcb,
+	0xfb,
+	0x24,
+	0x1f,
+	0x13,
+	0x2d,
+	0x27,
+	0x95,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xa7,
+	0xb3,
+	0xd1,
+	0xfc,
+	0xfe,
+	0xff,
+	0x00,
+	0x5d,
+	0x52,
+	0x81,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xb4,
+	0xbe,
+	0xd8,
+	0xfd,
+	0xdd,
+	0xe2,
+	0xee,
+	0x78,
+	0x69,
+	0x95,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xc1,
+	0xc9,
+	0xdf,
+	0xfe,
+	0xc1,
+	0xc9,
+	0xdf,
+	0x7f,
+	0x70,
+	0xc1,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xce,
+	0xd4,
+	0xe6,
+	0xfe,
+	0xaa,
+	0xb5,
+	0xd3,
+	0x79,
+	0x6a,
+	0xf7,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xdb,
+	0xdf,
+	0xed,
+	0xff,
+	0x98,
+	0xa5,
+	0xc9,
+	0x65,
+	0x59,
+	0x2c,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xe7,
+	0xeb,
+	0xf3,
+	0x00,
+	0x8b,
+	0x9a,
+	0xc2,
+	0x49,
+	0x40,
+	0x59,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0xf4,
+	0xf6,
+	0xfa,
+	0x00,
+	0x84,
+	0x93,
+	0xbe,
+	0x26,
+	0x21,
+	0x76,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x91,
+	0xbd,
+	0x00,
+	0x00,
+	0x7f,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x0d,
+	0x0b,
+	0x07,
+	0x01,
+	0x84,
+	0x93,
+	0xbe,
+	0xdb,
+	0xe0,
+	0x76,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x1a,
+	0x16,
+	0x0e,
+	0x01,
+	0x8b,
+	0x9a,
+	0xc2,
+	0xb8,
+	0xc1,
+	0x59,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x26,
+	0x22,
+	0x14,
+	0x02,
+	0x98,
+	0xa5,
+	0xc9,
+	0x9c,
+	0xa8,
+	0x2c,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x33,
+	0x2d,
+	0x1b,
+	0x03,
+	0xaa,
+	0xb5,
+	0xd3,
+	0x88,
+	0x97,
+	0xf7,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x40,
+	0x38,
+	0x22,
+	0x03,
+	0xc1,
+	0xc9,
+	0xdf,
+	0x81,
+	0x91,
+	0xc1,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x4d,
+	0x43,
+	0x29,
+	0x04,
+	0xdd,
+	0xe2,
+	0xee,
+	0x89,
+	0x98,
+	0x95,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x5a,
+	0x4e,
+	0x30,
+	0x05,
+	0xfe,
+	0xff,
+	0x00,
+	0xa4,
+	0xaf,
+	0x81,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x66,
+	0x5a,
+	0x36,
+	0x06,
+	0x24,
+	0x1f,
+	0x13,
+	0xd4,
+	0xda,
+	0x95,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x73,
+	0x65,
+	0x3d,
+	0x06,
+	0x4f,
+	0x45,
+	0x2a,
+	0x1c,
+	0x18,
+	0xe3,
+	0x70,
+	0x44,
+	0x07,
+	0xc9,
+	0x7f,
+	0x70,
+	0x44,
+	0x07,
+	0x7f,
+	0x70,
+	0x44,
+	0x7f,
+	0x70,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x81,
+	0x81,
+	0x81,
+	0x81,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x81,
+	0x81,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x8e,
+	0x8e,
+	0x8e,
+	0x8e,
+	0x4f,
+	0x4f,
+	0x4f,
+	0xe5,
+	0xe5,
+	0xe3,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x9b,
+	0x9b,
+	0x9b,
+	0x9b,
+	0x24,
+	0x24,
+	0x24,
+	0x2d,
+	0x2d,
+	0x95,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xa7,
+	0xa7,
+	0xa7,
+	0xa7,
+	0xfe,
+	0xfe,
+	0xfe,
+	0x5d,
+	0x5d,
+	0x81,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xb4,
+	0xb4,
+	0xb4,
+	0xb4,
+	0xdd,
+	0xdd,
+	0xdd,
+	0x78,
+	0x78,
+	0x95,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xc1,
+	0xc1,
+	0xc1,
+	0xc1,
+	0xc1,
+	0xc1,
+	0xc1,
+	0x7f,
+	0x7f,
+	0xc1,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xce,
+	0xce,
+	0xce,
+	0xce,
+	0xaa,
+	0xaa,
+	0xaa,
+	0x79,
+	0x79,
+	0xf7,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xdb,
+	0xdb,
+	0xdb,
+	0xdb,
+	0x98,
+	0x98,
+	0x98,
+	0x65,
+	0x65,
+	0x2c,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xe7,
+	0xe7,
+	0xe7,
+	0xe7,
+	0x8b,
+	0x8b,
+	0x8b,
+	0x49,
+	0x49,
+	0x59,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xf4,
+	0xf4,
+	0xf4,
+	0xf4,
+	0x84,
+	0x84,
+	0x84,
+	0x26,
+	0x26,
+	0x76,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x81,
+	0x81,
+	0x81,
+	0x00,
+	0x00,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x0d,
+	0x0d,
+	0x0d,
+	0x0d,
+	0x84,
+	0x84,
+	0x84,
+	0xdb,
+	0xdb,
+	0x76,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x1a,
+	0x1a,
+	0x1a,
+	0x1a,
+	0x8b,
+	0x8b,
+	0x8b,
+	0xb8,
+	0xb8,
+	0x59,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x26,
+	0x26,
+	0x26,
+	0x26,
+	0x98,
+	0x98,
+	0x98,
+	0x9c,
+	0x9c,
+	0x2c,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0xaa,
+	0xaa,
+	0xaa,
+	0x88,
+	0x88,
+	0xf7,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0xc1,
+	0xc1,
+	0xc1,
+	0x81,
+	0x81,
+	0xc1,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x4d,
+	0x4d,
+	0x4d,
+	0x4d,
+	0xdd,
+	0xdd,
+	0xdd,
+	0x89,
+	0x89,
+	0x95,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x5a,
+	0x5a,
+	0x5a,
+	0x5a,
+	0xfe,
+	0xfe,
+	0xfe,
+	0xa4,
+	0xa4,
+	0x81,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x66,
+	0x66,
+	0x66,
+	0x66,
+	0x24,
+	0x24,
+	0x24,
+	0xd4,
+	0xd4,
+	0x95,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x73,
+	0x73,
+	0x73,
+	0x73,
+	0x4f,
+	0x4f,
+	0x4f,
+	0x1c,
+	0x1c,
+	0xe3,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0x7f,
+	0xa2,
+	0x36,
+	0x24,
+	0x1b,
+	0x19,
+	0x45,
+	0x39,
+	0x20,
+	0x19,
+	0x19,
+	0x30,
+	0x2a,
+	0x19,
+	0x17,
+	0x26,
+	0x21,
+	0x19,
+	0x15,
+	0x17,
+	0x23,
+	0x20,
+	0x19,
+	0x17,
+	0x16,
+	0x36,
+	0x66,
+	0x23,
+	0x1e,
+	0x1b,
+	0x3b,
+	0x32,
+	0x25,
+	0x1a,
+	0x1b,
+	0x29,
+	0x28,
+	0x1a,
+	0x18,
+	0x23,
+	0x1e,
+	0x18,
+	0x15,
+	0x17,
+	0x20,
+	0x1e,
+	0x18,
+	0x17,
+	0x17,
+	0x24,
+	0x23,
+	0x5a,
+	0x23,
+	0x24,
+	0x21,
+	0x24,
+	0x28,
+	0x24,
+	0x21,
+	0x1d,
+	0x1d,
+	0x1d,
+	0x1d,
+	0x1a,
+	0x17,
+	0x16,
+	0x17,
+	0x1a,
+	0x19,
+	0x18,
+	0x15,
+	0x18,
+	0x19,
+	0x1b,
+	0x1e,
+	0x23,
+	0x66,
+	0x36,
+	0x1b,
+	0x1a,
+	0x25,
+	0x32,
+	0x3b,
+	0x18,
+	0x1a,
+	0x28,
+	0x29,
+	0x17,
+	0x15,
+	0x18,
+	0x1e,
+	0x23,
+	0x17,
+	0x17,
+	0x18,
+	0x1e,
+	0x20,
+	0x19,
+	0x1b,
+	0x24,
+	0x36,
+	0xa2,
+	0x19,
+	0x19,
+	0x20,
+	0x39,
+	0x45,
+	0x17,
+	0x19,
+	0x2a,
+	0x30,
+	0x17,
+	0x15,
+	0x19,
+	0x21,
+	0x26,
+	0x16,
+	0x17,
+	0x19,
+	0x20,
+	0x23,
+	0x45,
+	0x3b,
+	0x21,
+	0x1b,
+	0x19,
+	0x6e,
+	0x30,
+	0x21,
+	0x18,
+	0x19,
+	0x32,
+	0x2e,
+	0x19,
+	0x17,
+	0x2a,
+	0x23,
+	0x1a,
+	0x16,
+	0x17,
+	0x26,
+	0x23,
+	0x1a,
+	0x17,
+	0x17,
+	0x39,
+	0x32,
+	0x24,
+	0x1a,
+	0x19,
+	0x30,
+	0x45,
+	0x1e,
+	0x18,
+	0x18,
+	0x2b,
+	0x27,
+	0x18,
+	0x16,
+	0x23,
+	0x1e,
+	0x17,
+	0x14,
+	0x16,
+	0x21,
+	0x1e,
+	0x17,
+	0x15,
+	0x15,
+	0x20,
+	0x25,
+	0x28,
+	0x25,
+	0x20,
+	0x21,
+	0x1e,
+	0x3c,
+	0x1e,
+	0x21,
+	0x1b,
+	0x1e,
+	0x1e,
+	0x1b,
+	0x1a,
+	0x17,
+	0x17,
+	0x17,
+	0x1a,
+	0x19,
+	0x18,
+	0x16,
+	0x18,
+	0x19,
+	0x19,
+	0x1a,
+	0x24,
+	0x32,
+	0x39,
+	0x18,
+	0x18,
+	0x1e,
+	0x45,
+	0x30,
+	0x16,
+	0x18,
+	0x27,
+	0x2b,
+	0x16,
+	0x14,
+	0x17,
+	0x1e,
+	0x23,
+	0x15,
+	0x15,
+	0x17,
+	0x1e,
+	0x21,
+	0x19,
+	0x1b,
+	0x21,
+	0x3b,
+	0x45,
+	0x19,
+	0x18,
+	0x21,
+	0x30,
+	0x6e,
+	0x17,
+	0x19,
+	0x2e,
+	0x32,
+	0x17,
+	0x16,
+	0x1a,
+	0x23,
+	0x2a,
+	0x17,
+	0x17,
+	0x1a,
+	0x23,
+	0x26,
+	0x30,
+	0x29,
+	0x1d,
+	0x18,
+	0x17,
+	0x32,
+	0x2b,
+	0x1b,
+	0x16,
+	0x17,
+	0x67,
+	0x2b,
+	0x18,
+	0x16,
+	0x32,
+	0x2b,
+	0x1b,
+	0x16,
+	0x17,
+	0x30,
+	0x29,
+	0x1d,
+	0x18,
+	0x17,
+	0x2a,
+	0x28,
+	0x1d,
+	0x1a,
+	0x19,
+	0x2e,
+	0x27,
+	0x1e,
+	0x18,
+	0x19,
+	0x2b,
+	0x45,
+	0x1a,
+	0x18,
+	0x2e,
+	0x27,
+	0x1e,
+	0x18,
+	0x19,
+	0x2a,
+	0x28,
+	0x1d,
+	0x1a,
+	0x19,
+	0x19,
+	0x1a,
+	0x1d,
+	0x28,
+	0x2a,
+	0x19,
+	0x18,
+	0x1e,
+	0x27,
+	0x2e,
+	0x18,
+	0x1a,
+	0x45,
+	0x2b,
+	0x19,
+	0x18,
+	0x1e,
+	0x27,
+	0x2e,
+	0x19,
+	0x1a,
+	0x1d,
+	0x28,
+	0x2a,
+	0x17,
+	0x18,
+	0x1d,
+	0x29,
+	0x30,
+	0x17,
+	0x16,
+	0x1b,
+	0x2b,
+	0x32,
+	0x16,
+	0x18,
+	0x2b,
+	0x67,
+	0x17,
+	0x16,
+	0x1b,
+	0x2b,
+	0x32,
+	0x17,
+	0x18,
+	0x1d,
+	0x29,
+	0x30,
+	0x26,
+	0x23,
+	0x1a,
+	0x17,
+	0x17,
+	0x2a,
+	0x23,
+	0x1a,
+	0x16,
+	0x17,
+	0x32,
+	0x2e,
+	0x19,
+	0x17,
+	0x6e,
+	0x30,
+	0x21,
+	0x18,
+	0x19,
+	0x45,
+	0x3b,
+	0x21,
+	0x1b,
+	0x19,
+	0x21,
+	0x1e,
+	0x17,
+	0x15,
+	0x15,
+	0x23,
+	0x1e,
+	0x17,
+	0x14,
+	0x16,
+	0x2b,
+	0x27,
+	0x18,
+	0x16,
+	0x30,
+	0x45,
+	0x1e,
+	0x18,
+	0x18,
+	0x39,
+	0x32,
+	0x24,
+	0x1a,
+	0x19,
+	0x19,
+	0x18,
+	0x16,
+	0x18,
+	0x19,
+	0x1a,
+	0x17,
+	0x17,
+	0x17,
+	0x1a,
+	0x1b,
+	0x1e,
+	0x1e,
+	0x1b,
+	0x21,
+	0x1e,
+	0x3c,
+	0x1e,
+	0x21,
+	0x20,
+	0x25,
+	0x28,
+	0x25,
+	0x20,
+	0x15,
+	0x15,
+	0x17,
+	0x1e,
+	0x21,
+	0x16,
+	0x14,
+	0x17,
+	0x1e,
+	0x23,
+	0x16,
+	0x18,
+	0x27,
+	0x2b,
+	0x18,
+	0x18,
+	0x1e,
+	0x45,
+	0x30,
+	0x19,
+	0x1a,
+	0x24,
+	0x32,
+	0x39,
+	0x17,
+	0x17,
+	0x1a,
+	0x23,
+	0x26,
+	0x17,
+	0x16,
+	0x1a,
+	0x23,
+	0x2a,
+	0x17,
+	0x19,
+	0x2e,
+	0x32,
+	0x19,
+	0x18,
+	0x21,
+	0x30,
+	0x6e,
+	0x19,
+	0x1b,
+	0x21,
+	0x3b,
+	0x45,
+	0x23,
+	0x20,
+	0x19,
+	0x17,
+	0x16,
+	0x26,
+	0x21,
+	0x19,
+	0x15,
+	0x17,
+	0x30,
+	0x2a,
+	0x19,
+	0x17,
+	0x45,
+	0x39,
+	0x20,
+	0x19,
+	0x19,
+	0xa2,
+	0x36,
+	0x24,
+	0x1b,
+	0x19,
+	0x20,
+	0x1e,
+	0x18,
+	0x17,
+	0x17,
+	0x23,
+	0x1e,
+	0x18,
+	0x15,
+	0x17,
+	0x29,
+	0x28,
+	0x1a,
+	0x18,
+	0x3b,
+	0x32,
+	0x25,
+	0x1a,
+	0x1b,
+	0x36,
+	0x66,
+	0x23,
+	0x1e,
+	0x1b,
+	0x19,
+	0x18,
+	0x15,
+	0x18,
+	0x19,
+	0x1a,
+	0x17,
+	0x16,
+	0x17,
+	0x1a,
+	0x1d,
+	0x1d,
+	0x1d,
+	0x1d,
+	0x21,
+	0x24,
+	0x28,
+	0x24,
+	0x21,
+	0x24,
+	0x23,
+	0x5a,
+	0x23,
+	0x24,
+	0x17,
+	0x17,
+	0x18,
+	0x1e,
+	0x20,
+	0x17,
+	0x15,
+	0x18,
+	0x1e,
+	0x23,
+	0x18,
+	0x1a,
+	0x28,
+	0x29,
+	0x1b,
+	0x1a,
+	0x25,
+	0x32,
+	0x3b,
+	0x1b,
+	0x1e,
+	0x23,
+	0x66,
+	0x36,
+	0x16,
+	0x17,
+	0x19,
+	0x20,
+	0x23,
+	0x17,
+	0x15,
+	0x19,
+	0x21,
+	0x26,
+	0x17,
+	0x19,
+	0x2a,
+	0x30,
+	0x19,
+	0x19,
+	0x20,
+	0x39,
+	0x45,
+	0x19,
+	0x1b,
+	0x24,
+	0x36,
+	0xa2,
+	0x0d,
+	0x26,
+	0x40,
+	0x5a,
+	0x5a,
+	0x40,
+	0x26,
+	0x0d,
+	0xf3,
+	0xda,
+	0xc0,
+	0xa6,
+	0xa6,
+	0xc0,
+	0xda,
+	0xf3,
+	0x03,
+	0x0a,
+	0x0d,
+	0x0d,
+	0x0d,
+	0x06,
+	0xfa,
+	0xf3,
+	0xf3,
+	0xf3,
+	0xf6,
+	0xfd,
+	0x0a,
+	0x1d,
+	0x26,
+	0x26,
+	0x26,
+	0x13,
+	0xed,
+	0xda,
+	0xda,
+	0xda,
+	0xe3,
+	0xf6,
+	0x10,
+	0x30,
+	0x40,
+	0x40,
+	0x40,
+	0x20,
+	0xe0,
+	0xc0,
+	0xc0,
+	0xc0,
+	0xd0,
+	0xf0,
+	0x16,
+	0x43,
+	0x5a,
+	0x5a,
+	0x5a,
+	0x2d,
+	0xd3,
+	0xa6,
+	0xa6,
+	0xa6,
+	0xbd,
+	0xea,
+	0x16,
+	0x43,
+	0x5a,
+	0x5a,
+	0x5a,
+	0x2d,
+	0xd3,
+	0xa6,
+	0xa6,
+	0xa6,
+	0xbd,
+	0xea,
+	0x10,
+	0x30,
+	0x40,
+	0x40,
+	0x40,
+	0x20,
+	0xe0,
+	0xc0,
+	0xc0,
+	0xc0,
+	0xd0,
+	0xf0,
+	0x0a,
+	0x1d,
+	0x26,
+	0x26,
+	0x26,
+	0x13,
+	0xed,
+	0xda,
+	0xda,
+	0xda,
+	0xe3,
+	0xf6,
+	0x03,
+	0x0a,
+	0x0d,
+	0x0d,
+	0x0d,
+	0x06,
+	0xfa,
+	0xf3,
+	0xf3,
+	0xf3,
+	0xf6,
+	0xfd,
+	0x0d,
+	0x26,
+	0x40,
+	0x5a,
+	0x73,
+	0x73,
+	0x5a,
+	0x40,
+	0x26,
+	0x0d,
+	0xf3,
+	0xda,
+	0xc0,
+	0xa6,
+	0x8d,
+	0x8d,
+	0xa6,
+	0xc0,
+	0xda,
+	0xf3,
+	0x03,
+	0x0a,
+	0x10,
+	0x16,
+	0x1d,
+	0x1d,
+	0x16,
+	0x10,
+	0x0a,
+	0x03,
+	0x0a,
+	0x1d,
+	0x30,
+	0x43,
+	0x56,
+	0x56,
+	0x43,
+	0x30,
+	0x1d,
+	0x0a,
+	0x0d,
+	0x26,
+	0x40,
+	0x5a,
+	0x73,
+	0x73,
+	0x5a,
+	0x40,
+	0x26,
+	0x0d,
+	0x0d,
+	0x26,
+	0x40,
+	0x5a,
+	0x73,
+	0x73,
+	0x5a,
+	0x40,
+	0x26,
+	0x0d,
+	0x06,
+	0x13,
+	0x20,
+	0x2d,
+	0x3a,
+	0x3a,
+	0x2d,
+	0x20,
+	0x13,
+	0x06,
+	0xfa,
+	0xed,
+	0xe0,
+	0xd3,
+	0xc6,
+	0xc6,
+	0xd3,
+	0xe0,
+	0xed,
+	0xfa,
+	0xf3,
+	0xda,
+	0xc0,
+	0xa6,
+	0x8d,
+	0x8d,
+	0xa6,
+	0xc0,
+	0xda,
+	0xf3,
+	0xf3,
+	0xda,
+	0xc0,
+	0xa6,
+	0x8d,
+	0x8d,
+	0xa6,
+	0xc0,
+	0xda,
+	0xf3,
+	0xf6,
+	0xe3,
+	0xd0,
+	0xbd,
+	0xaa,
+	0xaa,
+	0xbd,
+	0xd0,
+	0xe3,
+	0xf6,
+	0xfd,
+	0xf6,
+	0xf0,
+	0xea,
+	0xe3,
+	0xe3,
+	0xea,
+	0xf0,
+	0xf6,
+	0xfd,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xcd,
+	0x33,
+	0x00,
+	0x00,
+	0x9a,
+	0x66,
+	0x00,
+	0x00,
+	0x66,
+	0x9a,
+	0x00,
+	0x00,
+	0x33,
+	0xcd,
+	0x00,
+	0x00,
+	0xc0,
+	0x00,
+	0x40,
+	0x00,
+	0x9a,
+	0x26,
+	0x33,
+	0x0d,
+	0x73,
+	0x4d,
+	0x26,
+	0x1a,
+	0x4d,
+	0x73,
+	0x1a,
+	0x26,
+	0x26,
+	0x9a,
+	0x0d,
+	0x33,
+	0x80,
+	0x00,
+	0x80,
+	0x00,
+	0x66,
+	0x1a,
+	0x66,
+	0x1a,
+	0x4d,
+	0x33,
+	0x4d,
+	0x33,
+	0x33,
+	0x4d,
+	0x33,
+	0x4d,
+	0x1a,
+	0x66,
+	0x1a,
+	0x66,
+	0x40,
+	0x00,
+	0xc0,
+	0x00,
+	0x33,
+	0x0d,
+	0x9a,
+	0x26,
+	0x26,
+	0x1a,
+	0x73,
+	0x4d,
+	0x1a,
+	0x26,
+	0x4d,
+	0x73,
+	0x0d,
+	0x33,
+	0x26,
+	0x9a,
+	0x00,
+	0x00,
+	0x04,
+	0x00,
+	0x08,
+	0x00,
+	0x0c,
+	0x00,
+	0x10,
+	0x00,
+	0x00,
+	0x02,
+	0x04,
+	0x02,
+	0x08,
+	0x02,
+	0x0c,
+	0x02,
+	0x10,
+	0x02,
+	0x00,
+	0x04,
+	0x04,
+	0x04,
+	0x08,
+	0x04,
+	0x0c,
+	0x04,
+	0x10,
+	0x04,
+	0x00,
+	0x06,
+	0x04,
+	0x06,
+	0x08,
+	0x06,
+	0x0c,
+	0x06,
+	0x10,
+	0x06,
+	0x00,
+	0x08,
+	0x14,
+	0x00,
+	0x18,
+	0x00,
+	0x1c,
+	0x00,
+	0x20,
+	0x00,
+	0x24,
+	0x00,
+	0x14,
+	0x02,
+	0x18,
+	0x02,
+	0x1c,
+	0x02,
+	0x20,
+	0x02,
+	0x24,
+	0x02,
+	0x14,
+	0x04,
+	0x18,
+	0x04,
+	0x1c,
+	0x04,
+	0x20,
+	0x04,
+	0x24,
+	0x04,
+	0x14,
+	0x06,
+	0x18,
+	0x06,
+	0x1c,
+	0x06,
+	0x20,
+	0x06,
+	0x24,
+	0x06,
+	0x14,
+	0x08,
+	0x28,
+	0x00,
+	0x2c,
+	0x00,
+	0x30,
+	0x00,
+	0x34,
+	0x00,
+	0x38,
+	0x00,
+	0x28,
+	0x02,
+	0x2c,
+	0x02,
+	0x30,
+	0x02,
+	0x34,
+	0x02,
+	0x38,
+	0x02,
+	0x28,
+	0x04,
+	0x2c,
+	0x04,
+	0x30,
+	0x04,
+	0x34,
+	0x04,
+	0x38,
+	0x04,
+	0x28,
+	0x06,
+	0x2c,
+	0x06,
+	0x30,
+	0x06,
+	0x34,
+	0x06,
+	0x38,
+	0x06,
+	0x28,
+	0x08,
+	0x3c,
+	0x00,
+	0x40,
+	0x00,
+	0x44,
+	0x00,
+	0x48,
+	0x00,
+	0x4c,
+	0x00,
+	0x3c,
+	0x02,
+	0x40,
+	0x02,
+	0x44,
+	0x02,
+	0x48,
+	0x02,
+	0x4c,
+	0x02,
+	0x3c,
+	0x04,
+	0x40,
+	0x04,
+	0x44,
+	0x04,
+	0x48,
+	0x04,
+	0x4c,
+	0x04,
+	0x3c,
+	0x06,
+	0x40,
+	0x06,
+	0x44,
+	0x06,
+	0x48,
+	0x06,
+	0x4c,
+	0x06,
+	0x3c,
+	0x08,
+	0x00,
+	0x0a,
+	0x04,
+	0x0a,
+	0x08,
+	0x0a,
+	0x0c,
+	0x0a,
+	0x10,
+	0x0a,
+	0x00,
+	0x0c,
+	0x04,
+	0x0c,
+	0x08,
+	0x0c,
+	0x0c,
+	0x0c,
+	0x10,
+	0x0c,
+	0x00,
+	0x0e,
+	0x04,
+	0x0e,
+	0x08,
+	0x0e,
+	0x0c,
+	0x0e,
+	0x10,
+	0x0e,
+	0x00,
+	0x10,
+	0x04,
+	0x10,
+	0x08,
+	0x10,
+	0x0c,
+	0x10,
+	0x10,
+	0x10,
+	0x00,
+	0x12,
+	0x14,
+	0x0a,
+	0x18,
+	0x0a,
+	0x1c,
+	0x0a,
+	0x20,
+	0x0a,
+	0x24,
+	0x0a,
+	0x14,
+	0x0c,
+	0x18,
+	0x0c,
+	0x1c,
+	0x0c,
+	0x20,
+	0x0c,
+	0x24,
+	0x0c,
+	0x14,
+	0x0e,
+	0x18,
+	0x0e,
+	0x1c,
+	0x0e,
+	0x20,
+	0x0e,
+	0x24,
+	0x0e,
+	0x14,
+	0x10,
+	0x18,
+	0x10,
+	0x1c,
+	0x10,
+	0x20,
+	0x10,
+	0x24,
+	0x10,
+	0x14,
+	0x12,
+	0x28,
+	0x0a,
+	0x2c,
+	0x0a,
+	0x30,
+	0x0a,
+	0x34,
+	0x0a,
+	0x38,
+	0x0a,
+	0x28,
+	0x0c,
+	0x2c,
+	0x0c,
+	0x30,
+	0x0c,
+	0x34,
+	0x0c,
+	0x38,
+	0x0c,
+	0x28,
+	0x0e,
+	0x2c,
+	0x0e,
+	0x30,
+	0x0e,
+	0x34,
+	0x0e,
+	0x38,
+	0x0e,
+	0x28,
+	0x10,
+	0x2c,
+	0x10,
+	0x30,
+	0x10,
+	0x34,
+	0x10,
+	0x38,
+	0x10,
+	0x28,
+	0x12,
+	0x3c,
+	0x0a,
+	0x40,
+	0x0a,
+	0x44,
+	0x0a,
+	0x48,
+	0x0a,
+	0x4c,
+	0x0a,
+	0x3c,
+	0x0c,
+	0x40,
+	0x0c,
+	0x44,
+	0x0c,
+	0x48,
+	0x0c,
+	0x4c,
+	0x0c,
+	0x3c,
+	0x0e,
+	0x40,
+	0x0e,
+	0x44,
+	0x0e,
+	0x48,
+	0x0e,
+	0x4c,
+	0x0e,
+	0x3c,
+	0x10,
+	0x40,
+	0x10,
+	0x44,
+	0x10,
+	0x48,
+	0x10,
+	0x4c,
+	0x10,
+	0x3c,
+	0x12,
+	0x00,
+	0x14,
+	0x04,
+	0x14,
+	0x08,
+	0x14,
+	0x0c,
+	0x14,
+	0x10,
+	0x14,
+	0x00,
+	0x16,
+	0x04,
+	0x16,
+	0x08,
+	0x16,
+	0x0c,
+	0x16,
+	0x10,
+	0x16,
+	0x00,
+	0x18,
+	0x04,
+	0x18,
+	0x08,
+	0x18,
+	0x0c,
+	0x18,
+	0x10,
+	0x18,
+	0x00,
+	0x1a,
+	0x04,
+	0x1a,
+	0x08,
+	0x1a,
+	0x0c,
+	0x1a,
+	0x10,
+	0x1a,
+	0x00,
+	0x1c,
+	0x14,
+	0x14,
+	0x18,
+	0x14,
+	0x1c,
+	0x14,
+	0x20,
+	0x14,
+	0x24,
+	0x14,
+	0x14,
+	0x16,
+	0x18,
+	0x16,
+	0x1c,
+	0x16,
+	0x20,
+	0x16,
+	0x24,
+	0x16,
+	0x14,
+	0x18,
+	0x18,
+	0x18,
+	0x1c,
+	0x18,
+	0x20,
+	0x18,
+	0x24,
+	0x18,
+	0x14,
+	0x1a,
+	0x18,
+	0x1a,
+	0x1c,
+	0x1a,
+	0x20,
+	0x1a,
+	0x24,
+	0x1a,
+	0x14,
+	0x1c,
+	0x28,
+	0x14,
+	0x2c,
+	0x14,
+	0x30,
+	0x14,
+	0x34,
+	0x14,
+	0x38,
+	0x14,
+	0x28,
+	0x16,
+	0x2c,
+	0x16,
+	0x30,
+	0x16,
+	0x34,
+	0x16,
+	0x38,
+	0x16,
+	0x28,
+	0x18,
+	0x2c,
+	0x18,
+	0x30,
+	0x18,
+	0x34,
+	0x18,
+	0x38,
+	0x18,
+	0x28,
+	0x1a,
+	0x2c,
+	0x1a,
+	0x30,
+	0x1a,
+	0x34,
+	0x1a,
+	0x38,
+	0x1a,
+	0x28,
+	0x1c,
+	0x3c,
+	0x14,
+	0x40,
+	0x14,
+	0x44,
+	0x14,
+	0x48,
+	0x14,
+	0x4c,
+	0x14,
+	0x3c,
+	0x16,
+	0x40,
+	0x16,
+	0x44,
+	0x16,
+	0x48,
+	0x16,
+	0x4c,
+	0x16,
+	0x3c,
+	0x18,
+	0x40,
+	0x18,
+	0x44,
+	0x18,
+	0x48,
+	0x18,
+	0x4c,
+	0x18,
+	0x3c,
+	0x1a,
+	0x40,
+	0x1a,
+	0x44,
+	0x1a,
+	0x48,
+	0x1a,
+	0x4c,
+	0x1a,
+	0x3c,
+	0x1c,
+	0x00,
+	0x1e,
+	0x04,
+	0x1e,
+	0x08,
+	0x1e,
+	0x0c,
+	0x1e,
+	0x10,
+	0x1e,
+	0x00,
+	0x20,
+	0x04,
+	0x20,
+	0x08,
+	0x20,
+	0x0c,
+	0x20,
+	0x10,
+	0x20,
+	0x00,
+	0x22,
+	0x04,
+	0x22,
+	0x08,
+	0x22,
+	0x0c,
+	0x22,
+	0x10,
+	0x22,
+	0x00,
+	0x24,
+	0x04,
+	0x24,
+	0x08,
+	0x24,
+	0x0c,
+	0x24,
+	0x10,
+	0x24,
+	0x00,
+	0x26,
+	0x14,
+	0x1e,
+	0x18,
+	0x1e,
+	0x1c,
+	0x1e,
+	0x20,
+	0x1e,
+	0x24,
+	0x1e,
+	0x14,
+	0x20,
+	0x18,
+	0x20,
+	0x1c,
+	0x20,
+	0x20,
+	0x20,
+	0x24,
+	0x20,
+	0x14,
+	0x22,
+	0x18,
+	0x22,
+	0x1c,
+	0x22,
+	0x20,
+	0x22,
+	0x24,
+	0x22,
+	0x14,
+	0x24,
+	0x18,
+	0x24,
+	0x1c,
+	0x24,
+	0x20,
+	0x24,
+	0x24,
+	0x24,
+	0x14,
+	0x26,
+	0x28,
+	0x1e,
+	0x2c,
+	0x1e,
+	0x30,
+	0x1e,
+	0x34,
+	0x1e,
+	0x38,
+	0x1e,
+	0x28,
+	0x20,
+	0x2c,
+	0x20,
+	0x30,
+	0x20,
+	0x34,
+	0x20,
+	0x38,
+	0x20,
+	0x28,
+	0x22,
+	0x2c,
+	0x22,
+	0x30,
+	0x22,
+	0x34,
+	0x22,
+	0x38,
+	0x22,
+	0x28,
+	0x24,
+	0x2c,
+	0x24,
+	0x30,
+	0x24,
+	0x34,
+	0x24,
+	0x38,
+	0x24,
+	0x28,
+	0x26,
+	0x3c,
+	0x1e,
+	0x40,
+	0x1e,
+	0x44,
+	0x1e,
+	0x48,
+	0x1e,
+	0x4c,
+	0x1e,
+	0x3c,
+	0x20,
+	0x40,
+	0x20,
+	0x44,
+	0x20,
+	0x48,
+	0x20,
+	0x4c,
+	0x20,
+	0x3c,
+	0x22,
+	0x40,
+	0x22,
+	0x44,
+	0x22,
+	0x48,
+	0x22,
+	0x4c,
+	0x22,
+	0x3c,
+	0x24,
+	0x40,
+	0x24,
+	0x44,
+	0x24,
+	0x48,
+	0x24,
+	0x4c,
+	0x24,
+	0x3c,
+	0x26,
+	0x00,
+	0x28,
+	0x04,
+	0x28,
+	0x08,
+	0x28,
+	0x0c,
+	0x28,
+	0x10,
+	0x28,
+	0x00,
+	0x2a,
+	0x04,
+	0x2a,
+	0x08,
+	0x2a,
+	0x0c,
+	0x2a,
+	0x10,
+	0x2a,
+	0x00,
+	0x2c,
+	0x04,
+	0x2c,
+	0x08,
+	0x2c,
+	0x0c,
+	0x2c,
+	0x10,
+	0x2c,
+	0x00,
+	0x2e,
+	0x04,
+	0x2e,
+	0x08,
+	0x2e,
+	0x0c,
+	0x2e,
+	0x10,
+	0x2e,
+	0x00,
+	0x30,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x0c,
+	0x1a,
+	0x26,
+	0x34,
+	0x40,
+	0x4c,
+	0x5a,
+	0x66,
+	0x74,
+	0x80,
+	0x8c,
+	0x9a,
+	0xa6,
+	0xb4,
+	0xc0,
+	0xcc,
+	0xda,
+	0xe6,
+	0xf4,
+	0x00,
+	0x10,
+	0x20,
+	0x30,
+	0x40,
+	0x50,
+	0x60,
+	0x70,
+	0x80,
+	0x90,
+	0xa0,
+	0xb0,
+	0xc0,
+	0xd0,
+	0xe0,
+	0xf0,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x55,
+	0x00,
+	0xcc,
+	0xaa,
+	0x24,
+	0x00,
+	0x1c,
+	0x66,
+	0xd1,
+	0x55,
+	0xec,
+	0x92,
+	0x44,
+	0x00,
+	0xc3,
+	0x8e,
+	0x5e,
+	0x33,
+	0x0c,
+	0xe8,
+	0xc8,
+	0xaa,
+	0x8f,
+	0x76,
+	0x5e,
+	0x49,
+	0x34,
+	0x22,
+	0x10,
+	0x00,
+	0xf0,
+	0xe1,
+	0xd4,
+	0xc7,
+	0xba,
+	0xaf,
+	0xa4,
+	0x99,
+	0x8f,
+	0x86,
+	0x7d,
+	0x74,
+	0x6c,
+	0x64,
+	0x5c,
+	0x55,
+	0x4e,
+	0x47,
+	0x41,
+	0x3b,
+	0x35,
+	0x2f,
+	0x29,
+	0x24,
+	0x1f,
+	0x1a,
+	0x15,
+	0x11,
+	0x0c,
+	0x08,
+	0x04,
+	0x00,
+	0xfc,
+	0xf8,
+	0xf4,
+	0xf0,
+	0xed,
+	0xea,
+	0xe6,
+	0xe3,
+	0xe0,
+	0xdd,
+	0xda,
+	0xd7,
+	0xd4,
+	0xd2,
+	0xcf,
+	0xcc,
+	0xca,
+	0xc7,
+	0xc5,
+	0xc3,
+	0xc0,
+	0xbe,
+	0xbc,
+	0xba,
+	0xb8,
+	0xb6,
+	0xb4,
+	0xb2,
+	0xb0,
+	0xae,
+	0xac,
+	0xaa,
+	0xa8,
+	0xa7,
+	0xa5,
+	0xa3,
+	0xa2,
+	0xa0,
+	0x9f,
+	0x9d,
+	0x9c,
+	0x9a,
+	0x99,
+	0x97,
+	0x96,
+	0x94,
+	0x93,
+	0x92,
+	0x90,
+	0x8f,
+	0x8e,
+	0x8d,
+	0x8c,
+	0x8a,
+	0x89,
+	0x88,
+	0x87,
+	0x86,
+	0x85,
+	0x84,
+	0x83,
+	0x82,
+	0x81,
+	0x80,
+	0x7f,
+	0x7e,
+	0x7d,
+	0x7c,
+	0x7b,
+	0x7a,
+	0x79,
+	0x78,
+	0x77,
+	0x76,
+	0x75,
+	0x75,
+	0x74,
+	0x73,
+	0x72,
+	0x71,
+	0x70,
+	0x70,
+	0x6f,
+	0x6e,
+	0x6d,
+	0x6d,
+	0x6c,
+	0x6b,
+	0x6b,
+	0x6a,
+	0x69,
+	0x69,
+	0x68,
+	0x67,
+	0x67,
+	0x66,
+	0x65,
+	0x65,
+	0x64,
+	0x63,
+	0x63,
+	0x62,
+	0x62,
+	0x61,
+	0x60,
+	0x60,
+	0x5f,
+	0x5f,
+	0x5e,
+	0x5e,
+	0x5d,
+	0x5d,
+	0x5c,
+	0x5c,
+	0x5b,
+	0x5b,
+	0x5a,
+	0x5a,
+	0x59,
+	0x59,
+	0x58,
+	0x58,
+	0x57,
+	0x57,
+	0x56,
+	0x56,
+	0x55,
+	0x55,
+	0x54,
+	0x54,
+	0x54,
+	0x53,
+	0x53,
+	0x52,
+	0x52,
+	0x51,
+	0x51,
+	0x51,
+	0x50,
+	0x50,
+	0x4f,
+	0x4f,
+	0x4f,
+	0x4e,
+	0x4e,
+	0x4e,
+	0x4d,
+	0x4d,
+	0x4c,
+	0x4c,
+	0x4c,
+	0x4b,
+	0x4b,
+	0x4b,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x49,
+	0x49,
+	0x49,
+	0x48,
+	0x48,
+	0x48,
+	0x47,
+	0x47,
+	0x47,
+	0x46,
+	0x46,
+	0x46,
+	0x46,
+	0x45,
+	0x45,
+	0x45,
+	0x44,
+	0x44,
+	0x44,
+	0x43,
+	0x43,
+	0x43,
+	0x43,
+	0x42,
+	0x42,
+	0x42,
+	0x42,
+	0x41,
+	0x41,
+	0x41,
+	0x41,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x40,
+	0x20,
+	0x15,
+	0x10,
+	0x0c,
+	0x0a,
+	0x09,
+	0x08,
+	0x07,
+	0x06,
+	0x05,
+	0x05,
+	0x04,
+	0x04,
+	0x04,
+	0x04,
+	0x03,
+	0x03,
+	0x03,
+	0x03,
+	0x03,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x02,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xfe,
+	0xfc,
+	0xfa,
+	0xf8,
+	0xf6,
+	0xf4,
+	0xf2,
+	0xf0,
+	0xef,
+	0xed,
+	0xeb,
+	0xe9,
+	0xe8,
+	0xe6,
+	0xe4,
+	0xe3,
+	0xe1,
+	0xe0,
+	0xde,
+	0xdd,
+	0xdb,
+	0xda,
+	0xd8,
+	0xd7,
+	0xd5,
+	0xd4,
+	0xd3,
+	0xd1,
+	0xd0,
+	0xcf,
+	0xcd,
+	0xcc,
+	0xcb,
+	0xc9,
+	0xc8,
+	0xc7,
+	0xc6,
+	0xc5,
+	0xc3,
+	0xc2,
+	0xc1,
+	0xc0,
+	0xbf,
+	0xbe,
+	0xbd,
+	0xbb,
+	0xba,
+	0xb9,
+	0xb8,
+	0xb7,
+	0xb6,
+	0xb5,
+	0xb4,
+	0xb3,
+	0xb2,
+	0xb1,
+	0xb0,
+	0xaf,
+	0xae,
+	0xad,
+	0xac,
+	0xac,
+	0xab,
+	0xaa,
+	0xa9,
+	0xa8,
+	0xa7,
+	0xa6,
+	0xa5,
+	0xa5,
+	0xa4,
+	0xa3,
+	0xa2,
+	0xa1,
+	0xa0,
+	0xa0,
+	0x9f,
+	0x9e,
+	0x9d,
+	0x9d,
+	0x9c,
+	0x9b,
+	0x9a,
+	0x9a,
+	0x99,
+	0x98,
+	0x97,
+	0x97,
+	0x96,
+	0x95,
+	0x95,
+	0x94,
+	0x93,
+	0x93,
+	0x92,
+	0x91,
+	0x91,
+	0x90,
+	0x8f,
+	0x8f,
+	0x8e,
+	0x8d,
+	0x8d,
+	0x8c,
+	0x8c,
+	0x8b,
+	0x8a,
+	0x8a,
+	0x89,
+	0x89,
+	0x88,
+	0x88,
+	0x87,
+	0x86,
+	0x86,
+	0x85,
+	0x85,
+	0x84,
+	0x84,
+	0x83,
+	0x83,
+	0x82,
+	0x82,
+	0x81,
+	0x81,
+	0x80,
+	0x80,
+	0x7f,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x80,
+	0x00,
+	0x00,
+	0x00,
+	0x00,
+	0xae,
+	0x00,
+	0x93,
+	0xae,
+	0x75,
+	0x00,
+	0x5c,
+	0x93,
+	0xad,
+	0xae,
+	0x9b,
+	0x75,
+	0x41,
+	0x00,
+	0xb3,
+	0x5c,
+	0xfc,
+	0x93,
+	0x23,
+	0xad,
+	0x30,
+	0xae,
+	0x27,
+	0x9b,
+	0x0a,
+	0x75,
+	0xdd,
+	0x41,
+	0xa2,
+	0x00,
+	0x5b,
+	0xb3,
+	0x09,
+	0x5c,
+	0xad,
+	0xfc,
+	0x49,
+	0x93,
+	0xdc,
+	0x23,
+	0x69,
+	0xad,
+	0xef,
+	0x30,
+	0x70,
+	0xae,
+	0xeb,
+	0x27,
+	0x61,
+	0x9b,
+	0xd3,
+	0x0a,
+	0x40,
+	0x75,
+	0xaa,
+	0xdd,
+	0x10,
+	0x41,
+	0x72,
+	0xa2,
+	0xd1,
+	0x00,
+	0x2e,
+	0x5b,
+	0x87,
+	0xb3,
+	0xde,
+	0x09,
+	0x33,
+	0x5c,
+	0x85,
+	0xad,
+	0xd5,
+	0xfc,
+	0x22,
+	0x49,
+	0x6e,
+	0x93,
+	0xb8,
+	0xdc,
+	0x00,
+	0x23,
+	0x46,
+	0x69,
+	0x8b,
+	0xad,
+	0xce,
+	0xef,
+	0x10,
+	0x30,
+	0x50,
+	0x70,
+	0x8f,
+	0xae,
+	0xcd,
+	0xeb,
+	0x09,
+	0x27,
+	0x44,
+	0x61,
+	0x7e,
+	0x9b,
+	0xb7,
+	0xd3,
+	0xef,
+	0x0a,
+	0x25,
+	0x40,
+	0x5b,
+	0x75,
+	0x90,
+	0xaa,
+	0xc4,
+	0xdd,
+	0xf7,
+	0x10,
+	0x29,
+	0x41,
+	0x5a,
+	0x72,
+	0x8a,
+	0xa2,
+	0xba,
+	0xd1,
+	0xe9,
+	0x00,
+	0x17,
+	0x2e,
+	0x44,
+	0x5b,
+	0x71,
+	0x87,
+	0x9d,
+	0xb3,
+	0xc9,
+	0xde,
+	0xf4,
+	0x09,
+	0x1e,
+	0x33,
+	0x47,
+	0x5c,
+	0x70,
+	0x85,
+	0x99,
+	0xad,
+	0xc1,
+	0xd5,
+	0xe8,
+	0xfc,
+	0x0f,
+	0x22,
+	0x36,
+	0x49,
+	0x5b,
+	0x6e,
+	0x81,
+	0x93,
+	0xa6,
+	0xb8,
+	0xca,
+	0xdc,
+	0xee,
+	0x00,
+	0x12,
+	0x23,
+	0x35,
+	0x46,
+	0x58,
+	0x69,
+	0x7a,
+	0x8b,
+	0x9c,
+	0xad,
+	0xbe,
+	0xce,
+	0xdf,
+	0xef,
+	0x00,
+	0x10,
+	0x20,
+	0x30,
+	0x40,
+	0x50,
+	0x60,
+	0x70,
+	0x7f,
+	0x8f,
+	0x9f,
+	0xae,
+	0xbd,
+	0xcd,
+	0xdc,
+	0xeb,
+	0xfa,
+	0x09,
+	0x18,
+	0x27,
+	0x35,
+	0x44,
+	0x53,
+	0x61,
+	0x70,
+	0x7e,
+	0x8c,
+	0x9b,
+	0xa9,
+	0xb7,
+	0xc5,
+	0xd3,
+	0xe1,
+	0xef,
+	0xfc,
+	0x0a,
+	0x18,
+	0x25,
+	0x33,
+	0x40,
+	0x4e,
+	0x5b,
+	0x68,
+	0x75,
+	0x83,
+	0x90,
+	0x9d,
+	0xaa,
+	0xb7,
+	0xc4,
+	0xd0,
+	0xdd,
+	0xea,
+	0xf7,
+	0x03,
+	0x10,
+	0x1c,
+	0x29,
+	0x35,
+	0x41,
+	0x4e,
+	0x5a,
+	0x66,
+	0x72,
+	0x7e,
+	0x8a,
+	0x96,
+	0xa2,
+	0xae,
+	0xba,
+	0xc6,
+	0xd1,
+	0xdd,
+	0xe9,
+	0xf4,
+	0x00,
+	0x00,
+	0x08,
+	0x0c,
+	0x10,
+	0x12,
+	0x14,
+	0x16,
+	0x18,
+	0x19,
+	0x1a,
+	0x1b,
+	0x1c,
+	0x1d,
+	0x1e,
+	0x1f,
+	0x20,
+	0x20,
+	0x21,
+	0x21,
+	0x22,
+	0x23,
+	0x23,
+	0x24,
+	0x24,
+	0x25,
+	0x25,
+	0x26,
+	0x26,
+	0x26,
+	0x27,
+	0x27,
+	0x28,
+	0x28,
+	0x28,
+	0x29,
+	0x29,
+	0x29,
+	0x29,
+	0x2a,
+	0x2a,
+	0x2a,
+	0x2b,
+	0x2b,
+	0x2b,
+	0x2b,
+	0x2c,
+	0x2c,
+	0x2c,
+	0x2c,
+	0x2d,
+	0x2d,
+	0x2d,
+	0x2d,
+	0x2e,
+	0x2e,
+	0x2e,
+	0x2e,
+	0x2e,
+	0x2f,
+	0x2f,
+	0x2f,
+	0x2f,
+	0x2f,
+	0x30,
+	0x30,
+	0x30,
+	0x30,
+	0x30,
+	0x30,
+	0x31,
+	0x31,
+	0x31,
+	0x31,
+	0x31,
+	0x31,
+	0x31,
+	0x32,
+	0x32,
+	0x32,
+	0x32,
+	0x32,
+	0x32,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0x33,
+	0x34,
+	0x34,
+	0x34,
+	0x34,
+	0x34,
+	0x34,
+	0x34,
+	0x34,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x35,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x36,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x37,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x38,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x39,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3a,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3b,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3c,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3d,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3e,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0xe3,
+	0x7e,
+	0x5b,
+	0x7f,
+	0xd3,
+	0x7f,
+	0x4b,
+	0x80,
+	0x73,
+	0x80,
+	0x9b,
+	0x80,
+
+};
+
+uint8_t dopcode_u_1_7[] =
+{
+	0x78,
+	0xb8,
+	0x18,
+	0x64,
+	0x10,
+	0x64,
+	0x11,
+	0x64,
+	0x13,
+	0xa9,
+	0x01,
+	0x85,
+	0x12,
+	0xa0,
+	0x52,
+	0x13,
+	0x10,
+	0x00,
+	0x00,
+	0x02,
+	0xa9,
+	0x11,
+	0x8d,
+	0xa4,
+	0x02,
+	0xa9,
+	0x80,
+	0x8d,
+	0x4a,
+	0x02,
+	0x8d,
+	0x4b,
+	0x02,
+	0x8d,
+	0x4c,
+	0x02,
+	0x8d,
+	0x4d,
+	0x02,
+	0x8d,
+	0x4e,
+	0x02,
+	0x8d,
+	0x4f,
+	0x02,
+	0x8d,
+	0x50,
+	0x02,
+	0xa9,
+	0x00,
+	0x8d,
+	0x00,
+	0x02,
+	0xa9,
+	0x02,
+	0x8d,
+	0x01,
+	0x02,
+	0xa9,
+	0xed,
+	0x8d,
+	0x02,
+	0x02,
+	0xa9,
+	0xb4,
+	0x8d,
+	0x03,
+	0x02,
+	0xa9,
+	0xff,
+	0x8d,
+	0xa2,
+	0x02,
+	0x8d,
+	0xa3,
+	0x02,
+	0xa0,
+	0x03,
+	0x53,
+	0xcc,
+	0x3b,
+	0x04,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x07,
+	0x02,
+	0xcd,
+	0xce,
+	0x3b,
+	0xf0,
+	0x04,
+	0xa2,
+	0x02,
+	0x80,
+	0x10,
+	0xa2,
+	0x01,
+	0xad,
+	0x00,
+	0x60,
+	0xc9,
+	0xed,
+	0xd0,
+	0x07,
+	0xad,
+	0x01,
+	0x60,
+	0xc9,
+	0xb4,
+	0xf0,
+	0x0e,
+	0x8e,
+	0x08,
+	0x02,
+	0xa9,
+	0x01,
+	0x9c,
+	0x14,
+	0x68,
+	0x8d,
+	0x14,
+	0x68,
+	0x5c,
+	0x80,
+	0xfd,
+	0x9c,
+	0x14,
+	0x68,
+	0x9c,
+	0x18,
+	0x68,
+	0x9c,
+	0x20,
+	0x68,
+	0x9c,
+	0x24,
+	0x68,
+	0x9c,
+	0x28,
+	0x68,
+	0xa2,
+	0xff,
+	0x9a,
+	0xa9,
+	0xd7,
+	0x85,
+	0x0e,
+	0xa9,
+	0x22,
+	0x85,
+	0x0f,
+	0xa9,
+	0x88,
+	0x85,
+	0x02,
+	0xa9,
+	0x22,
+	0x85,
+	0x03,
+	0xa9,
+	0xf1,
+	0x85,
+	0x04,
+	0xa9,
+	0x24,
+	0x85,
+	0x05,
+	0xa9,
+	0xe8,
+	0x85,
+	0x06,
+	0xa9,
+	0x22,
+	0x85,
+	0x07,
+	0xa9,
+	0x5b,
+	0x85,
+	0x08,
+	0xa9,
+	0x23,
+	0x85,
+	0x09,
+	0xa0,
+	0x0e,
+	0x13,
+	0x10,
+	0x00,
+	0xa5,
+	0x02,
+	0x9c,
+	0xbb,
+	0x02,
+	0x9c,
+	0xbc,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0xb3,
+	0x02,
+	0xa9,
+	0x02,
+	0x8d,
+	0xb4,
+	0x02,
+	0x8d,
+	0xb5,
+	0x02,
+	0xa0,
+	0x02,
+	0x53,
+	0xa2,
+	0x3c,
+	0xb6,
+	0x02,
+	0x53,
+	0xa4,
+	0x3c,
+	0xb8,
+	0x02,
+	0x13,
+	0x10,
+	0x00,
+	0x58,
+	0x2c,
+	0x13,
+	0x10,
+	0x00,
+	0xbb,
+	0x2c,
+	0x13,
+	0x10,
+	0x00,
+	0x71,
+	0x00,
+	0xa0,
+	0x02,
+	0x13,
+	0x10,
+	0x00,
+	0xac,
+	0x2c,
+	0x13,
+	0x10,
+	0x00,
+	0x0f,
+	0x2d,
+	0x13,
+	0x10,
+	0x00,
+	0xc5,
+	0x00,
+	0x9c,
+	0xba,
+	0x02,
+	0xa9,
+	0x03,
+	0x8d,
+	0xae,
+	0x2c,
+	0x8d,
+	0x11,
+	0x2d,
+	0x64,
+	0xc7,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0x60,
+	0x9c,
+	0xe9,
+	0x27,
+	0x58,
+	0x8d,
+	0x14,
+	0x68,
+	0x4c,
+	0x7c,
+	0x03,
+	0xf0,
+	0x30,
+	0xad,
+	0xb4,
+	0x2b,
+	0xaa,
+	0x29,
+	0x03,
+	0x85,
+	0x7b,
+	0xd0,
+	0x0a,
+	0xa9,
+	0x01,
+	0x85,
+	0x75,
+	0x85,
+	0x76,
+	0x85,
+	0x77,
+	0x80,
+	0x16,
+	0x8a,
+	0x4a,
+	0x4a,
+	0xaa,
+	0x29,
+	0x01,
+	0x85,
+	0x75,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x29,
+	0x01,
+	0x85,
+	0x76,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x29,
+	0x01,
+	0x85,
+	0x77,
+	0x20,
+	0xd6,
+	0x0c,
+	0xf0,
+	0x01,
+	0x60,
+	0xad,
+	0xfb,
+	0x2b,
+	0xd0,
+	0x02,
+	0xa9,
+	0x11,
+	0x85,
+	0xc6,
+	0xcd,
+	0xbb,
+	0x02,
+	0xf0,
+	0x12,
+	0x29,
+	0xf0,
+	0xf0,
+	0x08,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x85,
+	0xc5,
+	0x80,
+	0x0e,
+	0xa9,
+	0x10,
+	0x85,
+	0xc5,
+	0x80,
+	0x08,
+	0xad,
+	0xbc,
+	0x02,
+	0x85,
+	0xc5,
+	0x20,
+	0x3f,
+	0x18,
+	0xad,
+	0xfa,
+	0x2b,
+	0x85,
+	0x81,
+	0xa0,
+	0x02,
+	0x53,
+	0xc7,
+	0x2b,
+	0xcf,
+	0x00,
+	0x53,
+	0xcd,
+	0x2b,
+	0xdb,
+	0x00,
+	0x20,
+	0x0c,
+	0x12,
+	0xf0,
+	0x01,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x2d,
+	0x00,
+	0x6d,
+	0x00,
+	0xa5,
+	0x6e,
+	0xcd,
+	0xf6,
+	0x3f,
+	0x90,
+	0x09,
+	0xd0,
+	0x0f,
+	0xa5,
+	0x6d,
+	0xcd,
+	0xf5,
+	0x3f,
+	0xb0,
+	0x08,
+	0xad,
+	0xf4,
+	0x2b,
+	0xae,
+	0xf7,
+	0x2b,
+	0x80,
+	0x1e,
+	0xa5,
+	0x6e,
+	0xcd,
+	0xf8,
+	0x3f,
+	0x90,
+	0x09,
+	0xd0,
+	0x0f,
+	0xa5,
+	0x6d,
+	0xcd,
+	0xf7,
+	0x3f,
+	0xb0,
+	0x08,
+	0xad,
+	0xf5,
+	0x2b,
+	0xae,
+	0xf8,
+	0x2b,
+	0x80,
+	0x06,
+	0xad,
+	0xf6,
+	0x2b,
+	0xae,
+	0xf9,
+	0x2b,
+	0x85,
+	0x84,
+	0x86,
+	0x86,
+	0xad,
+	0xf3,
+	0x2b,
+	0x85,
+	0x85,
+	0xa5,
+	0x7c,
+	0xd0,
+	0x4e,
+	0xa5,
+	0x7b,
+	0xc9,
+	0x02,
+	0xd0,
+	0x48,
+	0xad,
+	0xb1,
+	0x02,
+	0xc5,
+	0x85,
+	0x90,
+	0x11,
+	0x38,
+	0xe5,
+	0x85,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0x85,
+	0x80,
+	0x16,
+	0xa5,
+	0x85,
+	0x38,
+	0xed,
+	0xb1,
+	0x02,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xcb,
+	0x38,
+	0xa5,
+	0x85,
+	0xe5,
+	0xcb,
+	0x85,
+	0x85,
+	0xad,
+	0xb0,
+	0x02,
+	0xc5,
+	0x84,
+	0x90,
+	0x13,
+	0x38,
+	0xe5,
+	0x84,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0x84,
+	0x80,
+	0x18,
+	0x80,
+	0x48,
+	0xa5,
+	0x84,
+	0x38,
+	0xed,
+	0xb0,
+	0x02,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xcb,
+	0x38,
+	0xa5,
+	0x84,
+	0xe5,
+	0xcb,
+	0x85,
+	0x84,
+	0xad,
+	0xb2,
+	0x02,
+	0xc5,
+	0x86,
+	0x90,
+	0x11,
+	0x38,
+	0xe5,
+	0x86,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0x86,
+	0x80,
+	0x16,
+	0xa5,
+	0x86,
+	0x38,
+	0xed,
+	0xb2,
+	0x02,
+	0x4d,
+	0x0f,
+	0x3c,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xcb,
+	0x38,
+	0xa5,
+	0x86,
+	0xe5,
+	0xcb,
+	0x85,
+	0x86,
+	0xa0,
+	0x02,
+	0xad,
+	0x0b,
+	0x3c,
+	0xd0,
+	0x07,
+	0x53,
+	0xc7,
+	0x2b,
+	0xcf,
+	0x00,
+	0x80,
+	0x05,
+	0x53,
+	0xcb,
+	0x2b,
+	0xcf,
+	0x00,
+	0x53,
+	0xd1,
+	0x2b,
+	0xdb,
+	0x00,
+	0x20,
+	0x0c,
+	0x12,
+	0xf0,
+	0x01,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0x2d,
+	0x00,
+	0x2b,
+	0x00,
+	0x18,
+	0xad,
+	0xd7,
+	0x2b,
+	0x69,
+	0x02,
+	0xb0,
+	0x10,
+	0x4a,
+	0x4a,
+	0xc9,
+	0x08,
+	0x90,
+	0x06,
+	0xc9,
+	0x40,
+	0xb0,
+	0x06,
+	0x80,
+	0x06,
+	0xa9,
+	0x08,
+	0x80,
+	0x02,
+	0xa9,
+	0x3f,
+	0x85,
+	0x88,
+	0x18,
+	0xad,
+	0xd8,
+	0x2b,
+	0x69,
+	0x02,
+	0xb0,
+	0x10,
+	0x4a,
+	0x4a,
+	0xc9,
+	0x08,
+	0x90,
+	0x06,
+	0xc9,
+	0x40,
+	0xb0,
+	0x06,
+	0x80,
+	0x06,
+	0xa9,
+	0x08,
+	0x80,
+	0x02,
+	0xa9,
+	0x3f,
+	0x85,
+	0x89,
+	0xa4,
+	0x88,
+	0xb9,
+	0x93,
+	0x27,
+	0x85,
+	0x8a,
+	0x45,
+	0x89,
+	0x20,
+	0x6e,
+	0x21,
+	0x85,
+	0x30,
+	0xa4,
+	0x89,
+	0xb9,
+	0x93,
+	0x27,
+	0x85,
+	0x8b,
+	0x45,
+	0x88,
+	0x20,
+	0x6e,
+	0x21,
+	0x85,
+	0x2f,
+	0xa0,
+	0x02,
+	0xad,
+	0xda,
+	0x2b,
+	0xd0,
+	0x0c,
+	0xad,
+	0xd9,
+	0x2b,
+	0xd0,
+	0x07,
+	0x53,
+	0xb6,
+	0x02,
+	0xcf,
+	0x00,
+	0x80,
+	0x05,
+	0x53,
+	0xd9,
+	0x2b,
+	0xcf,
+	0x00,
+	0x20,
+	0x7f,
+	0x0c,
+	0x85,
+	0x82,
+	0xa0,
+	0x02,
+	0xad,
+	0xdc,
+	0x2b,
+	0xd0,
+	0x0c,
+	0xad,
+	0xdb,
+	0x2b,
+	0xd0,
+	0x07,
+	0x53,
+	0xb8,
+	0x02,
+	0xcf,
+	0x00,
+	0x80,
+	0x05,
+	0x53,
+	0xdb,
+	0x2b,
+	0xcf,
+	0x00,
+	0x20,
+	0x7f,
+	0x0c,
+	0x85,
+	0x83,
+	0xa5,
+	0x76,
+	0xf0,
+	0x04,
+	0x64,
+	0x8e,
+	0x80,
+	0x10,
+	0xa5,
+	0x83,
+	0xc9,
+	0x02,
+	0xb0,
+	0x05,
+	0xad,
+	0xa6,
+	0x3c,
+	0x80,
+	0x03,
+	0xad,
+	0xa7,
+	0x3c,
+	0x85,
+	0x8e,
+	0xad,
+	0xa9,
+	0x3c,
+	0x49,
+	0x10,
+	0x84,
+	0xd0,
+	0x85,
+	0xcf,
+	0xa5,
+	0x89,
+	0x85,
+	0xd1,
+	0x64,
+	0xd2,
+	0x20,
+	0x16,
+	0x27,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x06,
+	0xa5,
+	0xcf,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0x85,
+	0x8f,
+	0xad,
+	0xa8,
+	0x3c,
+	0x45,
+	0x88,
+	0x84,
+	0xd0,
+	0x85,
+	0xcf,
+	0xa5,
+	0x89,
+	0x85,
+	0xd1,
+	0x64,
+	0xd2,
+	0x20,
+	0x16,
+	0x27,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x06,
+	0xa5,
+	0xcf,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0x85,
+	0x90,
+	0xa9,
+	0x00,
+	0xa6,
+	0x82,
+	0xe0,
+	0x02,
+	0xb0,
+	0x08,
+	0xa9,
+	0x01,
+	0xe4,
+	0x83,
+	0xf0,
+	0x02,
+	0xa9,
+	0x02,
+	0x85,
+	0x91,
+	0xa0,
+	0x00,
+	0xa5,
+	0x6e,
+	0xd9,
+	0xb9,
+	0x3c,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xd9,
+	0xb8,
+	0x3c,
+	0x90,
+	0x08,
+	0xc8,
+	0xc8,
+	0xc0,
+	0x06,
+	0xf0,
+	0x02,
+	0x80,
+	0xe8,
+	0x98,
+	0x4a,
+	0x49,
+	0x03,
+	0xa8,
+	0xb9,
+	0xbe,
+	0x3c,
+	0x85,
+	0x92,
+	0xb9,
+	0xbf,
+	0x3c,
+	0x85,
+	0x93,
+	0xb9,
+	0xc0,
+	0x3c,
+	0x85,
+	0x94,
+	0xa5,
+	0x82,
+	0x4a,
+	0xaa,
+	0xbd,
+	0xf7,
+	0x3c,
+	0x85,
+	0x95,
+	0x29,
+	0x01,
+	0xf0,
+	0x1e,
+	0xa0,
+	0x02,
+	0xad,
+	0x0b,
+	0x3c,
+	0xd0,
+	0x07,
+	0x53,
+	0xc7,
+	0x2b,
+	0xcf,
+	0x00,
+	0x80,
+	0x05,
+	0x53,
+	0xc9,
+	0x2b,
+	0xcf,
+	0x00,
+	0x53,
+	0xcf,
+	0x2b,
+	0xdb,
+	0x00,
+	0x20,
+	0x0c,
+	0x12,
+	0xf0,
+	0x01,
+	0x60,
+	0xa5,
+	0x2d,
+	0x49,
+	0x10,
+	0x85,
+	0xd3,
+	0x84,
+	0xd4,
+	0xa5,
+	0x2e,
+	0x49,
+	0x10,
+	0x05,
+	0xd4,
+	0x85,
+	0xd4,
+	0x84,
+	0xd5,
+	0x64,
+	0xd6,
+	0xa0,
+	0x02,
+	0x53,
+	0x6d,
+	0x00,
+	0xcf,
+	0x00,
+	0x20,
+	0x81,
+	0x21,
+	0xa5,
+	0xd5,
+	0xd0,
+	0x0e,
+	0xa5,
+	0xd4,
+	0xd0,
+	0x0a,
+	0xa4,
+	0xd3,
+	0xc0,
+	0x08,
+	0x90,
+	0x08,
+	0xc0,
+	0x3f,
+	0x90,
+	0x06,
+	0xa0,
+	0x3f,
+	0x80,
+	0x02,
+	0xa0,
+	0x08,
+	0xb9,
+	0x93,
+	0x27,
+	0x85,
+	0x96,
+	0xa5,
+	0x83,
+	0xc9,
+	0x02,
+	0x90,
+	0x05,
+	0x20,
+	0xf8,
+	0x12,
+	0x80,
+	0x19,
+	0xad,
+	0xf6,
+	0x3c,
+	0x85,
+	0x99,
+	0xad,
+	0xf5,
+	0x3c,
+	0x45,
+	0x88,
+	0x20,
+	0x52,
+	0x21,
+	0x85,
+	0x97,
+	0xad,
+	0xf4,
+	0x3c,
+	0x45,
+	0x89,
+	0x20,
+	0x52,
+	0x21,
+	0x85,
+	0x98,
+	0x20,
+	0xd1,
+	0x13,
+	0x20,
+	0x17,
+	0x14,
+	0xa5,
+	0x86,
+	0xaa,
+	0x20,
+	0x6e,
+	0x14,
+	0x85,
+	0xcc,
+	0x8a,
+	0x20,
+	0x88,
+	0x14,
+	0x85,
+	0xcd,
+	0xa5,
+	0x32,
+	0x0a,
+	0x45,
+	0xcc,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x85,
+	0x9a,
+	0xa5,
+	0x33,
+	0x0a,
+	0x45,
+	0xcc,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x85,
+	0x9b,
+	0xa5,
+	0x36,
+	0x0a,
+	0x45,
+	0xcd,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0xa8,
+	0xb9,
+	0x53,
+	0x27,
+	0xaa,
+	0x29,
+	0x0f,
+	0x85,
+	0xa1,
+	0x8a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x85,
+	0xa0,
+	0xa5,
+	0x31,
+	0x85,
+	0xa2,
+	0xa5,
+	0x77,
+	0xf0,
+	0x08,
+	0x64,
+	0x9c,
+	0x64,
+	0x9d,
+	0xa9,
+	0x3f,
+	0x80,
+	0x5f,
+	0xa5,
+	0x34,
+	0x0a,
+	0x45,
+	0xcc,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x0a,
+	0x45,
+	0x84,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x85,
+	0x9c,
+	0xa5,
+	0x35,
+	0x0a,
+	0x45,
+	0xcc,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x0a,
+	0x45,
+	0x84,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x85,
+	0x9d,
+	0xa5,
+	0x84,
+	0x20,
+	0x9b,
+	0x14,
+	0x85,
+	0xce,
+	0xa5,
+	0x36,
+	0x0a,
+	0x45,
+	0xcd,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0x0a,
+	0x45,
+	0xce,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0xa8,
+	0xb9,
+	0x53,
+	0x27,
+	0xaa,
+	0x29,
+	0x0f,
+	0x85,
+	0x9f,
+	0x8a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x85,
+	0x9e,
+	0xa5,
+	0x78,
+	0xc9,
+	0x02,
+	0xb0,
+	0x04,
+	0xa2,
+	0x00,
+	0x80,
+	0x02,
+	0xa2,
+	0x36,
+	0x86,
+	0xcb,
+	0xbd,
+	0x88,
+	0x3f,
+	0x85,
+	0xa4,
+	0xa2,
+	0x00,
+	0x18,
+	0x8a,
+	0x65,
+	0xcb,
+	0xa8,
+	0xa5,
+	0x6e,
+	0xd9,
+	0x8a,
+	0x3f,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xd9,
+	0x89,
+	0x3f,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x08,
+	0xf0,
+	0x02,
+	0x80,
+	0xe3,
+	0x8a,
+	0x4a,
+	0x49,
+	0x09,
+	0x18,
+	0x65,
+	0xcb,
+	0xaa,
+	0xbd,
+	0x91,
+	0x3f,
+	0x85,
+	0xa5,
+	0xbd,
+	0x92,
+	0x3f,
+	0x85,
+	0xa6,
+	0xbd,
+	0x93,
+	0x3f,
+	0x85,
+	0xa7,
+	0xbd,
+	0x94,
+	0x3f,
+	0x85,
+	0xa8,
+	0xbd,
+	0x98,
+	0x3f,
+	0x85,
+	0xac,
+	0xbd,
+	0x99,
+	0x3f,
+	0x85,
+	0xad,
+	0xbd,
+	0x95,
+	0x3f,
+	0x85,
+	0xa9,
+	0xbd,
+	0x96,
+	0x3f,
+	0x85,
+	0xaa,
+	0xbd,
+	0x97,
+	0x3f,
+	0x85,
+	0xab,
+	0xa5,
+	0x77,
+	0xf0,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x72,
+	0xa5,
+	0x84,
+	0x30,
+	0x0f,
+	0x85,
+	0xcb,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0xcb,
+	0x85,
+	0xcb,
+	0xa9,
+	0x20,
+	0x85,
+	0xcc,
+	0x80,
+	0x06,
+	0x29,
+	0x7f,
+	0x85,
+	0xcb,
+	0x64,
+	0xcc,
+	0x38,
+	0xa5,
+	0xcc,
+	0xe5,
+	0xa9,
+	0x85,
+	0xcd,
+	0x3c,
+	0x45,
+	0xcb,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x10,
+	0x05,
+	0x98,
+	0x18,
+	0x65,
+	0xcd,
+	0xa8,
+	0x8a,
+	0x0a,
+	0x98,
+	0x2a,
+	0x18,
+	0x65,
+	0xa9,
+	0x85,
+	0xa9,
+	0x38,
+	0xa5,
+	0xcc,
+	0xe5,
+	0xaa,
+	0x85,
+	0xcd,
+	0x3c,
+	0x45,
+	0xcb,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x10,
+	0x05,
+	0x98,
+	0x18,
+	0x65,
+	0xcd,
+	0xa8,
+	0x8a,
+	0x0a,
+	0x98,
+	0x2a,
+	0x18,
+	0x65,
+	0xaa,
+	0x85,
+	0xaa,
+	0x38,
+	0xa5,
+	0xcc,
+	0xe5,
+	0xab,
+	0x85,
+	0xcd,
+	0x3c,
+	0x45,
+	0xcb,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x10,
+	0x05,
+	0x98,
+	0x18,
+	0x65,
+	0xcd,
+	0xa8,
+	0x8a,
+	0x0a,
+	0x98,
+	0x2a,
+	0x18,
+	0x65,
+	0xab,
+	0x85,
+	0xab,
+	0xa9,
+	0x01,
+	0x85,
+	0xa3,
+	0xa5,
+	0x88,
+	0x85,
+	0xcb,
+	0x4a,
+	0x85,
+	0xcf,
+	0xa9,
+	0x08,
+	0x85,
+	0xd0,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x04,
+	0xa5,
+	0xcf,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xb3,
+	0xa5,
+	0x89,
+	0x85,
+	0xcb,
+	0x4a,
+	0x85,
+	0xcf,
+	0xa9,
+	0x08,
+	0x85,
+	0xd0,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x04,
+	0xa5,
+	0xcf,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xb2,
+	0xa5,
+	0x88,
+	0x85,
+	0xcb,
+	0x4a,
+	0x18,
+	0x69,
+	0xf0,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x69,
+	0x3d,
+	0x85,
+	0xd0,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xc9,
+	0x03,
+	0x90,
+	0x10,
+	0xd0,
+	0x06,
+	0xa5,
+	0xcf,
+	0xc9,
+	0xdf,
+	0x90,
+	0x08,
+	0xa9,
+	0xdf,
+	0x85,
+	0xcf,
+	0xa9,
+	0x03,
+	0x85,
+	0xd0,
+	0x18,
+	0xa9,
+	0x20,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x46,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x6a,
+	0x85,
+	0xb0,
+	0xa5,
+	0x89,
+	0x85,
+	0xcb,
+	0x4a,
+	0x18,
+	0x69,
+	0xf0,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x69,
+	0x3d,
+	0x85,
+	0xd0,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xc9,
+	0x03,
+	0x90,
+	0x10,
+	0xd0,
+	0x06,
+	0xa5,
+	0xcf,
+	0xc9,
+	0xdf,
+	0x90,
+	0x08,
+	0xa9,
+	0xdf,
+	0x85,
+	0xcf,
+	0xa9,
+	0x03,
+	0x85,
+	0xd0,
+	0x18,
+	0xa9,
+	0x20,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x46,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x6a,
+	0x85,
+	0xae,
+	0x64,
+	0xb1,
+	0x64,
+	0xcb,
+	0xa5,
+	0x88,
+	0xc9,
+	0x10,
+	0xb0,
+	0x06,
+	0x85,
+	0xcb,
+	0xa9,
+	0x01,
+	0x85,
+	0xb1,
+	0xa5,
+	0x89,
+	0xc9,
+	0x10,
+	0xb0,
+	0x10,
+	0xa5,
+	0xb1,
+	0x09,
+	0x02,
+	0x85,
+	0xb1,
+	0xa5,
+	0x89,
+	0xc5,
+	0xcb,
+	0x90,
+	0x08,
+	0x85,
+	0xcb,
+	0x80,
+	0x04,
+	0xa5,
+	0xb1,
+	0xf0,
+	0x45,
+	0xa5,
+	0xcb,
+	0x49,
+	0xdf,
+	0x85,
+	0xcf,
+	0x84,
+	0xd0,
+	0xa5,
+	0xcb,
+	0x49,
+	0x03,
+	0x18,
+	0x65,
+	0xd0,
+	0x85,
+	0xd0,
+	0x18,
+	0xa9,
+	0x08,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x49,
+	0x10,
+	0x84,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x49,
+	0x10,
+	0x18,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x84,
+	0xd0,
+	0x18,
+	0xa9,
+	0x20,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x46,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x6a,
+	0x85,
+	0xaf,
+	0x80,
+	0x02,
+	0x64,
+	0xaf,
+	0xa5,
+	0x82,
+	0x49,
+	0x03,
+	0xaa,
+	0xbd,
+	0x58,
+	0x3f,
+	0x85,
+	0xb6,
+	0xbd,
+	0x59,
+	0x3f,
+	0x85,
+	0xb5,
+	0xbd,
+	0x5a,
+	0x3f,
+	0x85,
+	0xb4,
+	0xa5,
+	0x83,
+	0x49,
+	0x03,
+	0xa8,
+	0xb9,
+	0x64,
+	0x3f,
+	0x85,
+	0xb9,
+	0xb9,
+	0x65,
+	0x3f,
+	0x85,
+	0xb8,
+	0xb9,
+	0x66,
+	0x3f,
+	0x85,
+	0xb7,
+	0xa5,
+	0x77,
+	0xf0,
+	0x06,
+	0x64,
+	0xba,
+	0x64,
+	0xbb,
+	0x80,
+	0x5a,
+	0x20,
+	0xe6,
+	0x14,
+	0xa5,
+	0x84,
+	0x30,
+	0x0f,
+	0x85,
+	0xcb,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0xcb,
+	0x85,
+	0xcb,
+	0x64,
+	0xcc,
+	0x64,
+	0xcd,
+	0x80,
+	0x0a,
+	0x29,
+	0x7f,
+	0x85,
+	0xcb,
+	0x64,
+	0xcc,
+	0xa9,
+	0x39,
+	0x85,
+	0xcd,
+	0x38,
+	0xa5,
+	0xcc,
+	0xe5,
+	0xba,
+	0x85,
+	0xcc,
+	0x3c,
+	0x45,
+	0xcb,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x10,
+	0x05,
+	0x98,
+	0x18,
+	0x65,
+	0xcc,
+	0xa8,
+	0x8a,
+	0x0a,
+	0x98,
+	0x2a,
+	0x18,
+	0x65,
+	0xba,
+	0x85,
+	0xba,
+	0x38,
+	0xa5,
+	0xcd,
+	0xe5,
+	0xbb,
+	0x85,
+	0xcd,
+	0x3c,
+	0x45,
+	0xcb,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x10,
+	0x05,
+	0x98,
+	0x18,
+	0x65,
+	0xcd,
+	0xa8,
+	0x8a,
+	0x0a,
+	0x98,
+	0x2a,
+	0x18,
+	0x65,
+	0xbb,
+	0x85,
+	0xbb,
+	0xa5,
+	0x75,
+	0xf0,
+	0x0c,
+	0xa0,
+	0x92,
+	0x9c,
+	0x18,
+	0x29,
+	0x13,
+	0x18,
+	0x29,
+	0x19,
+	0x29,
+	0x80,
+	0x3d,
+	0xa5,
+	0x79,
+	0xc9,
+	0x02,
+	0xb0,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x02,
+	0xa9,
+	0xf0,
+	0x85,
+	0xd9,
+	0xad,
+	0x77,
+	0x3d,
+	0x1a,
+	0x49,
+	0x15,
+	0x85,
+	0xcd,
+	0xa5,
+	0x83,
+	0x20,
+	0xb1,
+	0x15,
+	0xa9,
+	0x18,
+	0x85,
+	0xd1,
+	0xa9,
+	0x29,
+	0x85,
+	0xd2,
+	0xa9,
+	0x00,
+	0x20,
+	0xe9,
+	0x15,
+	0xa5,
+	0x82,
+	0x20,
+	0xcc,
+	0x15,
+	0xa9,
+	0x24,
+	0x85,
+	0xd1,
+	0xa9,
+	0x29,
+	0x85,
+	0xd2,
+	0xa9,
+	0x01,
+	0x20,
+	0xe9,
+	0x15,
+	0x20,
+	0xc9,
+	0x16,
+	0xad,
+	0x53,
+	0x3c,
+	0x85,
+	0xbf,
+	0x85,
+	0xcd,
+	0xa5,
+	0xc5,
+	0x29,
+	0xf0,
+	0xf0,
+	0x08,
+	0x64,
+	0xbe,
+	0x64,
+	0xc0,
+	0xa5,
+	0xc6,
+	0x80,
+	0x12,
+	0xa5,
+	0xcd,
+	0xa6,
+	0x88,
+	0x20,
+	0xee,
+	0x16,
+	0x85,
+	0xbe,
+	0xa5,
+	0xcd,
+	0xa6,
+	0x89,
+	0x20,
+	0xee,
+	0x16,
+	0x85,
+	0xc0,
+	0x20,
+	0x22,
+	0x17,
+	0xa4,
+	0x79,
+	0xb9,
+	0x59,
+	0x3c,
+	0x85,
+	0xc3,
+	0xa5,
+	0x7b,
+	0xc9,
+	0x00,
+	0xf0,
+	0x04,
+	0xa5,
+	0x7a,
+	0xd0,
+	0x04,
+	0xa9,
+	0x02,
+	0x85,
+	0x7f,
+	0xa9,
+	0x00,
+	0x60,
+	0xad,
+	0xb5,
+	0x2b,
+	0x29,
+	0xfc,
+	0xf0,
+	0x03,
+	0xa9,
+	0x1d,
+	0x60,
+	0xae,
+	0xce,
+	0x2b,
+	0xad,
+	0xcd,
+	0x2b,
+	0x20,
+	0x3f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x22,
+	0x60,
+	0xae,
+	0xd0,
+	0x2b,
+	0xad,
+	0xcf,
+	0x2b,
+	0x20,
+	0x3f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x23,
+	0x60,
+	0xae,
+	0xd2,
+	0x2b,
+	0xad,
+	0xd1,
+	0x2b,
+	0x20,
+	0x3f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x24,
+	0x60,
+	0xae,
+	0xc8,
+	0x2b,
+	0xad,
+	0xc7,
+	0x2b,
+	0x20,
+	0x5f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x1f,
+	0x60,
+	0xae,
+	0xca,
+	0x2b,
+	0xad,
+	0xc9,
+	0x2b,
+	0x20,
+	0x5f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x20,
+	0x60,
+	0xae,
+	0xcc,
+	0x2b,
+	0xad,
+	0xcb,
+	0x2b,
+	0x20,
+	0x5f,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x21,
+	0x60,
+	0xae,
+	0xdd,
+	0x2b,
+	0xa9,
+	0x08,
+	0x20,
+	0x30,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x25,
+	0x60,
+	0xad,
+	0xd7,
+	0x2b,
+	0xc9,
+	0x10,
+	0xb0,
+	0x03,
+	0xa9,
+	0x26,
+	0x60,
+	0xad,
+	0xd8,
+	0x2b,
+	0xc9,
+	0x10,
+	0xb0,
+	0x03,
+	0xa9,
+	0x27,
+	0x60,
+	0xad,
+	0xde,
+	0x2b,
+	0xc9,
+	0x06,
+	0x90,
+	0x03,
+	0xa9,
+	0x29,
+	0x60,
+	0xf0,
+	0x54,
+	0x49,
+	0x04,
+	0x85,
+	0xcb,
+	0xa2,
+	0x00,
+	0xbd,
+	0xdf,
+	0x2b,
+	0xcd,
+	0x0c,
+	0x3c,
+	0x90,
+	0x03,
+	0xa9,
+	0x2a,
+	0x60,
+	0xbd,
+	0xe0,
+	0x2b,
+	0xcd,
+	0x0d,
+	0x3c,
+	0x90,
+	0x03,
+	0xa9,
+	0x2b,
+	0x60,
+	0xbd,
+	0xe1,
+	0x2b,
+	0xcd,
+	0x0c,
+	0x3c,
+	0x90,
+	0x03,
+	0xa9,
+	0x2c,
+	0x60,
+	0xbd,
+	0xe2,
+	0x2b,
+	0xcd,
+	0x0d,
+	0x3c,
+	0x90,
+	0x03,
+	0xa9,
+	0x2d,
+	0x60,
+	0xbd,
+	0xe1,
+	0x2b,
+	0xdd,
+	0xdf,
+	0x2b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x2e,
+	0x60,
+	0xbd,
+	0xe2,
+	0x2b,
+	0xdd,
+	0xe0,
+	0x2b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x2f,
+	0x60,
+	0x18,
+	0x8a,
+	0x69,
+	0x04,
+	0xc5,
+	0xcb,
+	0xb0,
+	0x04,
+	0xaa,
+	0x4c,
+	0xc9,
+	0x0b,
+	0xa9,
+	0x00,
+	0x60,
+	0xc9,
+	0x01,
+	0xf0,
+	0x0f,
+	0xc9,
+	0x03,
+	0xf0,
+	0x0b,
+	0xc9,
+	0x05,
+	0xf0,
+	0x07,
+	0xc9,
+	0x07,
+	0xf0,
+	0x03,
+	0xa9,
+	0x01,
+	0x60,
+	0xa9,
+	0x00,
+	0x60,
+	0x86,
+	0xcb,
+	0xc5,
+	0xcb,
+	0xf0,
+	0x06,
+	0x4a,
+	0xd0,
+	0xf9,
+	0xa9,
+	0x01,
+	0x60,
+	0xa9,
+	0x00,
+	0x60,
+	0xec,
+	0xda,
+	0x3b,
+	0x90,
+	0x09,
+	0xd0,
+	0x13,
+	0xcd,
+	0xd9,
+	0x3b,
+	0xf0,
+	0x02,
+	0xb0,
+	0x0c,
+	0xec,
+	0xd8,
+	0x3b,
+	0x90,
+	0x07,
+	0xd0,
+	0x08,
+	0xcd,
+	0xd7,
+	0x3b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x01,
+	0x60,
+	0xa9,
+	0x00,
+	0x60,
+	0xec,
+	0xe2,
+	0x3b,
+	0x90,
+	0x09,
+	0xd0,
+	0x13,
+	0xcd,
+	0xe1,
+	0x3b,
+	0xf0,
+	0x02,
+	0xb0,
+	0x0c,
+	0xec,
+	0xe0,
+	0x3b,
+	0x90,
+	0x07,
+	0xd0,
+	0x08,
+	0xcd,
+	0xdf,
+	0x3b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x01,
+	0x60,
+	0xa9,
+	0x00,
+	0x60,
+	0xa0,
+	0x00,
+	0x18,
+	0xb9,
+	0x94,
+	0x3c,
+	0x79,
+	0x96,
+	0x3c,
+	0x85,
+	0xd1,
+	0xb9,
+	0x95,
+	0x3c,
+	0x79,
+	0x97,
+	0x3c,
+	0x6a,
+	0x85,
+	0xd2,
+	0x66,
+	0xd1,
+	0xa5,
+	0xd0,
+	0xc5,
+	0xd2,
+	0x90,
+	0x10,
+	0xd0,
+	0x06,
+	0xa5,
+	0xcf,
+	0xc5,
+	0xd1,
+	0x90,
+	0x08,
+	0xc8,
+	0xc8,
+	0xc0,
+	0x06,
+	0xf0,
+	0x02,
+	0x80,
+	0xd6,
+	0x98,
+	0x4a,
+	0x60,
+	0xc9,
+	0x00,
+	0xf0,
+	0x1d,
+	0xc9,
+	0x01,
+	0xf0,
+	0x12,
+	0xc9,
+	0x02,
+	0xf0,
+	0x07,
+	0xad,
+	0x9a,
+	0x3c,
+	0xae,
+	0x9b,
+	0x3c,
+	0x60,
+	0xad,
+	0x98,
+	0x3c,
+	0xae,
+	0x99,
+	0x3c,
+	0x60,
+	0xad,
+	0x96,
+	0x3c,
+	0xae,
+	0x97,
+	0x3c,
+	0x60,
+	0xad,
+	0x94,
+	0x3c,
+	0xae,
+	0x95,
+	0x3c,
+	0x60,
+	0x64,
+	0x71,
+	0x64,
+	0x72,
+	0xad,
+	0x0c,
+	0x3c,
+	0x85,
+	0x73,
+	0xad,
+	0x0d,
+	0x3c,
+	0x85,
+	0x74,
+	0xa9,
+	0x01,
+	0x85,
+	0x7a,
+	0x85,
+	0x7d,
+	0x85,
+	0x7e,
+	0x38,
+	0xad,
+	0xba,
+	0x2b,
+	0xed,
+	0xe3,
+	0x3b,
+	0xad,
+	0xbb,
+	0x2b,
+	0xed,
+	0xe4,
+	0x3b,
+	0x90,
+	0x03,
+	0xa9,
+	0x09,
+	0x60,
+	0xad,
+	0xc1,
+	0x2b,
+	0xd0,
+	0x10,
+	0xad,
+	0xc0,
+	0x2b,
+	0xaa,
+	0x4a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x13,
+	0x60,
+	0x8a,
+	0x20,
+	0x1a,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x11,
+	0x60,
+	0x8a,
+	0x1a,
+	0x4a,
+	0x85,
+	0x17,
+	0x64,
+	0xc2,
+	0xc9,
+	0x01,
+	0xf0,
+	0x02,
+	0xe6,
+	0xc2,
+	0x38,
+	0xad,
+	0xba,
+	0x2b,
+	0x6a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0d,
+	0x60,
+	0x2a,
+	0xed,
+	0xb6,
+	0x2b,
+	0xa8,
+	0x6a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0b,
+	0x60,
+	0x2a,
+	0xad,
+	0xbb,
+	0x2b,
+	0xed,
+	0xb7,
+	0x2b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0f,
+	0x60,
+	0xc8,
+	0xd0,
+	0x01,
+	0x1a,
+	0x84,
+	0x19,
+	0x85,
+	0x1a,
+	0xa5,
+	0x19,
+	0xa6,
+	0x1a,
+	0xa4,
+	0x17,
+	0x20,
+	0xb3,
+	0x0f,
+	0x48,
+	0xda,
+	0x1a,
+	0xd0,
+	0x01,
+	0xe8,
+	0x29,
+	0xfe,
+	0x85,
+	0x71,
+	0x86,
+	0x72,
+	0xa8,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x98,
+	0x6a,
+	0xd0,
+	0x01,
+	0xca,
+	0x3a,
+	0x85,
+	0x65,
+	0x86,
+	0x66,
+	0x68,
+	0x4a,
+	0x85,
+	0xd0,
+	0x68,
+	0x6a,
+	0x85,
+	0xcf,
+	0xad,
+	0x0c,
+	0x3c,
+	0x85,
+	0xcb,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xcf,
+	0x85,
+	0xd3,
+	0xc9,
+	0x14,
+	0xb0,
+	0x08,
+	0x46,
+	0x73,
+	0x06,
+	0x7d,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x07,
+	0xa5,
+	0xcf,
+	0xcd,
+	0xa0,
+	0x3c,
+	0xb0,
+	0x00,
+	0xad,
+	0xb4,
+	0x2b,
+	0xaa,
+	0xc9,
+	0x03,
+	0xd0,
+	0x03,
+	0xa9,
+	0x06,
+	0x60,
+	0x8a,
+	0x29,
+	0xe0,
+	0xd0,
+	0xf8,
+	0x8a,
+	0x29,
+	0x04,
+	0xf0,
+	0x02,
+	0x64,
+	0x7a,
+	0x38,
+	0xad,
+	0xbc,
+	0x2b,
+	0xed,
+	0xe5,
+	0x3b,
+	0xad,
+	0xbd,
+	0x2b,
+	0xed,
+	0xe6,
+	0x3b,
+	0x90,
+	0x03,
+	0xa9,
+	0x0a,
+	0x60,
+	0xad,
+	0xc5,
+	0x2b,
+	0xd0,
+	0x10,
+	0xad,
+	0xc4,
+	0x2b,
+	0xaa,
+	0x4a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x14,
+	0x60,
+	0x8a,
+	0x20,
+	0x1a,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x12,
+	0x60,
+	0x8a,
+	0x1a,
+	0x4a,
+	0x85,
+	0x18,
+	0x64,
+	0xc2,
+	0xc9,
+	0x01,
+	0xf0,
+	0x02,
+	0xe6,
+	0xc2,
+	0xad,
+	0xbc,
+	0x2b,
+	0x4a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0e,
+	0x60,
+	0x2a,
+	0x38,
+	0xed,
+	0xb8,
+	0x2b,
+	0xa8,
+	0x6a,
+	0xb0,
+	0x03,
+	0xa9,
+	0x0c,
+	0x60,
+	0x2a,
+	0xad,
+	0xbd,
+	0x2b,
+	0xed,
+	0xb9,
+	0x2b,
+	0xb0,
+	0x03,
+	0xa9,
+	0x10,
+	0x60,
+	0xc8,
+	0xd0,
+	0x01,
+	0x1a,
+	0x84,
+	0x1b,
+	0x85,
+	0x1c,
+	0xa5,
+	0x1b,
+	0xa6,
+	0x1c,
+	0xa4,
+	0x18,
+	0x20,
+	0xb3,
+	0x0f,
+	0x48,
+	0xda,
+	0x1a,
+	0xd0,
+	0x01,
+	0xe8,
+	0xa8,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x98,
+	0x6a,
+	0xd0,
+	0x01,
+	0xca,
+	0x3a,
+	0x85,
+	0x67,
+	0x86,
+	0x68,
+	0x68,
+	0x4a,
+	0x85,
+	0xd0,
+	0x68,
+	0x6a,
+	0x85,
+	0xcf,
+	0xad,
+	0x0d,
+	0x3c,
+	0x85,
+	0xcb,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xcf,
+	0x85,
+	0xd4,
+	0xc9,
+	0x14,
+	0xb0,
+	0x08,
+	0x46,
+	0x74,
+	0x06,
+	0x7e,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x09,
+	0xa5,
+	0xcf,
+	0xcd,
+	0xa1,
+	0x3c,
+	0xb0,
+	0x02,
+	0x64,
+	0x7a,
+	0xa2,
+	0x00,
+	0xa5,
+	0x72,
+	0xcd,
+	0xa8,
+	0x02,
+	0xd0,
+	0x09,
+	0xa5,
+	0x71,
+	0xcd,
+	0xa7,
+	0x02,
+	0xd0,
+	0x02,
+	0x80,
+	0x01,
+	0xe8,
+	0x86,
+	0x7c,
+	0xa5,
+	0x18,
+	0xc5,
+	0x17,
+	0xb0,
+	0x02,
+	0xa5,
+	0x17,
+	0x85,
+	0x79,
+	0xc9,
+	0x03,
+	0x90,
+	0x0c,
+	0xa2,
+	0x01,
+	0x86,
+	0x75,
+	0xc9,
+	0x05,
+	0x90,
+	0x04,
+	0x86,
+	0x76,
+	0x86,
+	0x77,
+	0xad,
+	0x9f,
+	0x3c,
+	0xc5,
+	0x79,
+	0xb0,
+	0x02,
+	0x64,
+	0x7a,
+	0xa2,
+	0x01,
+	0xad,
+	0xc6,
+	0x2b,
+	0xf0,
+	0x21,
+	0xa8,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0xaa,
+	0xa9,
+	0x04,
+	0x20,
+	0x30,
+	0x0c,
+	0xd0,
+	0x0c,
+	0x98,
+	0x29,
+	0x0f,
+	0xdc,
+	0xaa,
+	0xa9,
+	0x04,
+	0x20,
+	0x30,
+	0x0c,
+	0xf0,
+	0x03,
+	0xa9,
+	0x1c,
+	0x60,
+	0xc4,
+	0xcb,
+	0xb0,
+	0x01,
+	0xfc,
+	0x86,
+	0x78,
+	0x64,
+	0x7f,
+	0x64,
+	0x69,
+	0x64,
+	0x6a,
+	0x64,
+	0x6b,
+	0x64,
+	0x6c,
+	0xad,
+	0xb5,
+	0x2b,
+	0x85,
+	0x87,
+	0xd8,
+	0x4d,
+	0x0e,
+	0x3c,
+	0xf8,
+	0x85,
+	0x80,
+	0x85,
+	0xc1,
+	0xad,
+	0xb5,
+	0x2b,
+	0x29,
+	0x01,
+	0xd0,
+	0x0a,
+	0x64,
+	0x1f,
+	0x64,
+	0x20,
+	0xa9,
+	0x01,
+	0x85,
+	0x22,
+	0x80,
+	0x0b,
+	0xa5,
+	0x73,
+	0x3a,
+	0x85,
+	0x1f,
+	0x85,
+	0x20,
+	0xa9,
+	0xff,
+	0x85,
+	0x22,
+	0xa0,
+	0x02,
+	0x53,
+	0x19,
+	0x00,
+	0x23,
+	0x00,
+	0x53,
+	0xb6,
+	0x2b,
+	0x25,
+	0x00,
+	0xa9,
+	0xef,
+	0x85,
+	0xdd,
+	0xa9,
+	0x3b,
+	0x85,
+	0xde,
+	0xa9,
+	0xe7,
+	0x85,
+	0xdf,
+	0xa9,
+	0x3b,
+	0x85,
+	0xe0,
+	0xa9,
+	0xd7,
+	0x85,
+	0xdb,
+	0xa9,
+	0x2a,
+	0x85,
+	0xdc,
+	0xa9,
+	0x9f,
+	0x85,
+	0x1d,
+	0xa9,
+	0x2a,
+	0x85,
+	0x1e,
+	0xa5,
+	0x73,
+	0x85,
+	0x27,
+	0xa5,
+	0x17,
+	0x85,
+	0x29,
+	0x20,
+	0x10,
+	0x10,
+	0x20,
+	0x38,
+	0x0b,
+	0xf0,
+	0x01,
+	0x60,
+	0xad,
+	0xde,
+	0x2b,
+	0x85,
+	0xc4,
+	0xf0,
+	0x12,
+	0xa5,
+	0x7d,
+	0x3a,
+	0x85,
+	0x28,
+	0xa9,
+	0xf3,
+	0x85,
+	0xdf,
+	0xa9,
+	0x2a,
+	0x85,
+	0xe0,
+	0xa9,
+	0x00,
+	0x20,
+	0xb3,
+	0x11,
+	0xad,
+	0xb5,
+	0x2b,
+	0x29,
+	0x02,
+	0xd0,
+	0x0a,
+	0x64,
+	0x1f,
+	0x64,
+	0x20,
+	0xa9,
+	0x01,
+	0x85,
+	0x22,
+	0x80,
+	0x0b,
+	0xa5,
+	0x74,
+	0x3a,
+	0x85,
+	0x1f,
+	0x85,
+	0x20,
+	0xa9,
+	0xff,
+	0x85,
+	0x22,
+	0xa0,
+	0x02,
+	0x53,
+	0x1b,
+	0x00,
+	0x23,
+	0x00,
+	0x53,
+	0xb8,
+	0x2b,
+	0x25,
+	0x00,
+	0xa9,
+	0xff,
+	0x85,
+	0xdd,
+	0xa9,
+	0x3b,
+	0x85,
+	0xde,
+	0xa9,
+	0xeb,
+	0x85,
+	0xdf,
+	0xa9,
+	0x3b,
+	0x85,
+	0xe0,
+	0xa9,
+	0xe7,
+	0x85,
+	0xdb,
+	0xa9,
+	0x2a,
+	0x85,
+	0xdc,
+	0xa9,
+	0xbf,
+	0x85,
+	0x1d,
+	0xa9,
+	0x2a,
+	0x85,
+	0x1e,
+	0xa5,
+	0x74,
+	0x85,
+	0x27,
+	0xa5,
+	0x18,
+	0x85,
+	0x29,
+	0x20,
+	0x10,
+	0x10,
+	0xa5,
+	0xc4,
+	0xf0,
+	0x12,
+	0xa5,
+	0x7e,
+	0x3a,
+	0x85,
+	0x28,
+	0xa9,
+	0x03,
+	0x85,
+	0xdf,
+	0xa9,
+	0x2b,
+	0x85,
+	0xe0,
+	0xa9,
+	0x01,
+	0x20,
+	0xb3,
+	0x11,
+	0xa9,
+	0x00,
+	0x60,
+	0x88,
+	0x84,
+	0xcb,
+	0xc8,
+	0x18,
+	0x65,
+	0xcb,
+	0x90,
+	0x01,
+	0xe8,
+	0x20,
+	0xc1,
+	0x0f,
+	0x60,
+	0xc0,
+	0x01,
+	0xd0,
+	0x01,
+	0x60,
+	0x85,
+	0xcb,
+	0x98,
+	0xc9,
+	0x01,
+	0xf0,
+	0x0e,
+	0x29,
+	0x01,
+	0xd0,
+	0x0d,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x66,
+	0xcb,
+	0x98,
+	0x4a,
+	0xa8,
+	0x80,
+	0xee,
+	0xa5,
+	0xcb,
+	0x60,
+	0xa5,
+	0xcb,
+	0x1a,
+	0xd0,
+	0x01,
+	0xe8,
+	0x49,
+	0x55,
+	0x84,
+	0xcd,
+	0x18,
+	0x65,
+	0xcd,
+	0x85,
+	0xcc,
+	0x90,
+	0x03,
+	0xe6,
+	0xcd,
+	0x18,
+	0x8a,
+	0x49,
+	0x55,
+	0x84,
+	0xce,
+	0xaa,
+	0x65,
+	0xcc,
+	0x8a,
+	0x65,
+	0xcd,
+	0x85,
+	0xcd,
+	0xa5,
+	0xce,
+	0x90,
+	0x03,
+	0xe6,
+	0xce,
+	0x18,
+	0x65,
+	0xcd,
+	0xa8,
+	0xa5,
+	0xce,
+	0x69,
+	0x00,
+	0xaa,
+	0x98,
+	0x60,
+	0xa5,
+	0x27,
+	0x85,
+	0xcb,
+	0x3a,
+	0x4a,
+	0x85,
+	0xce,
+	0x38,
+	0xe5,
+	0x27,
+	0x85,
+	0xce,
+	0xa0,
+	0x02,
+	0x53,
+	0x23,
+	0x00,
+	0xcf,
+	0x00,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x20,
+	0xbe,
+	0x20,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x18,
+	0xa9,
+	0x02,
+	0x65,
+	0xcf,
+	0x85,
+	0xd3,
+	0xa9,
+	0x00,
+	0x65,
+	0xd0,
+	0x85,
+	0xd4,
+	0xa0,
+	0x02,
+	0x53,
+	0xcf,
+	0x00,
+	0xbb,
+	0x29,
+	0x53,
+	0xd3,
+	0x00,
+	0xbd,
+	0x29,
+	0xa5,
+	0x27,
+	0x1a,
+	0x4a,
+	0x3a,
+	0x85,
+	0xcd,
+	0xa2,
+	0x00,
+	0xda,
+	0xe4,
+	0xcd,
+	0xd0,
+	0x02,
+	0xe6,
+	0xce,
+	0x18,
+	0xa5,
+	0xce,
+	0x65,
+	0xd1,
+	0x85,
+	0xce,
+	0x30,
+	0x09,
+	0x38,
+	0xe5,
+	0x27,
+	0x85,
+	0xce,
+	0xa9,
+	0x02,
+	0x80,
+	0x02,
+	0xa9,
+	0x00,
+	0xfa,
+	0x9d,
+	0xab,
+	0x29,
+	0xe8,
+	0xe4,
+	0x27,
+	0xf0,
+	0x03,
+	0xda,
+	0x80,
+	0xda,
+	0xa5,
+	0x29,
+	0x85,
+	0xcb,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x20,
+	0xbe,
+	0x20,
+	0xa0,
+	0x02,
+	0x53,
+	0xcf,
+	0x00,
+	0xd7,
+	0x00,
+	0xa5,
+	0x29,
+	0x85,
+	0xcb,
+	0x45,
+	0xd7,
+	0x85,
+	0xd9,
+	0xfc,
+	0xa5,
+	0xcb,
+	0x45,
+	0xd8,
+	0x85,
+	0xda,
+	0x8a,
+	0x18,
+	0x65,
+	0xda,
+	0x85,
+	0xda,
+	0x38,
+	0xa5,
+	0xd7,
+	0xe9,
+	0x01,
+	0x85,
+	0xd7,
+	0xa5,
+	0xd8,
+	0xe9,
+	0x00,
+	0x85,
+	0xd8,
+	0xe6,
+	0xcd,
+	0x64,
+	0xd1,
+	0x64,
+	0xd2,
+	0x64,
+	0xcf,
+	0x64,
+	0xd0,
+	0x64,
+	0xd3,
+	0x64,
+	0xd4,
+	0x64,
+	0xce,
+	0xa2,
+	0x00,
+	0x86,
+	0xcc,
+	0xbd,
+	0xab,
+	0x29,
+	0xaa,
+	0xe8,
+	0xbd,
+	0xbb,
+	0x29,
+	0x4a,
+	0x85,
+	0xd6,
+	0xca,
+	0xbd,
+	0xbb,
+	0x29,
+	0x6a,
+	0x85,
+	0xd5,
+	0x18,
+	0xa5,
+	0xd1,
+	0x65,
+	0xd9,
+	0x85,
+	0xd1,
+	0xa5,
+	0xd2,
+	0x65,
+	0xda,
+	0x85,
+	0xd2,
+	0x38,
+	0xa5,
+	0xd1,
+	0xe5,
+	0xd5,
+	0x85,
+	0xd1,
+	0xa5,
+	0xd2,
+	0xe5,
+	0xd6,
+	0x85,
+	0xd2,
+	0x18,
+	0x10,
+	0x0d,
+	0xa5,
+	0x29,
+	0x65,
+	0xd1,
+	0x85,
+	0xd1,
+	0xa9,
+	0x00,
+	0x65,
+	0xd2,
+	0x85,
+	0xd2,
+	0x38,
+	0xa5,
+	0xd7,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0xa5,
+	0xd8,
+	0x65,
+	0xd0,
+	0x85,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x0a,
+	0x09,
+	0x01,
+	0x92,
+	0x1d,
+	0xa5,
+	0xd0,
+	0x2a,
+	0xa0,
+	0x01,
+	0x91,
+	0x1d,
+	0x18,
+	0xa5,
+	0x1d,
+	0x69,
+	0x02,
+	0x85,
+	0x1d,
+	0xa5,
+	0x1e,
+	0x69,
+	0x00,
+	0x85,
+	0x1e,
+	0xe6,
+	0xcf,
+	0xd0,
+	0x02,
+	0xe6,
+	0xd0,
+	0xa6,
+	0xcc,
+	0xbd,
+	0xab,
+	0x29,
+	0xaa,
+	0xbd,
+	0xbb,
+	0x29,
+	0x85,
+	0xd5,
+	0xe8,
+	0xbd,
+	0xbb,
+	0x29,
+	0x85,
+	0xd6,
+	0xa5,
+	0xcc,
+	0xc5,
+	0xcd,
+	0xb0,
+	0x0d,
+	0x38,
+	0xa5,
+	0xd5,
+	0xe9,
+	0x01,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd6,
+	0xe9,
+	0x00,
+	0x85,
+	0xd6,
+	0x46,
+	0xd6,
+	0x66,
+	0xd5,
+	0x18,
+	0xa5,
+	0x25,
+	0x65,
+	0xd5,
+	0x85,
+	0xd5,
+	0xa5,
+	0x26,
+	0x65,
+	0xd6,
+	0x85,
+	0xd6,
+	0xa6,
+	0xcc,
+	0xbd,
+	0xab,
+	0x29,
+	0xaa,
+	0x18,
+	0xbd,
+	0xbb,
+	0x29,
+	0x65,
+	0x25,
+	0x85,
+	0x25,
+	0xe8,
+	0xbd,
+	0xbb,
+	0x29,
+	0x65,
+	0x26,
+	0x85,
+	0x26,
+	0xa5,
+	0xd6,
+	0xc5,
+	0xd4,
+	0x90,
+	0x1f,
+	0xd0,
+	0x06,
+	0xa5,
+	0xd5,
+	0xc5,
+	0xd3,
+	0x90,
+	0x17,
+	0xa4,
+	0xce,
+	0xb1,
+	0xdd,
+	0xa8,
+	0xb1,
+	0xdf,
+	0x18,
+	0x65,
+	0xd3,
+	0x85,
+	0xd3,
+	0xc8,
+	0xb1,
+	0xdf,
+	0x65,
+	0xd4,
+	0x85,
+	0xd4,
+	0xe6,
+	0xce,
+	0x80,
+	0xdb,
+	0xa5,
+	0xce,
+	0x3a,
+	0xa4,
+	0x1f,
+	0x91,
+	0xdb,
+	0x18,
+	0x98,
+	0x65,
+	0x22,
+	0x85,
+	0x1f,
+	0xa6,
+	0xcc,
+	0xe8,
+	0xe4,
+	0x27,
+	0xb0,
+	0x05,
+	0x86,
+	0xcc,
+	0x4c,
+	0xc0,
+	0x10,
+	0x60,
+	0xaa,
+	0x64,
+	0xcb,
+	0xa9,
+	0x01,
+	0x85,
+	0xcc,
+	0x64,
+	0xcd,
+	0xa4,
+	0x20,
+	0xbd,
+	0xdf,
+	0x2b,
+	0x85,
+	0xce,
+	0xbd,
+	0xe1,
+	0x2b,
+	0x85,
+	0xcf,
+	0xa5,
+	0x28,
+	0xf0,
+	0x04,
+	0x46,
+	0xce,
+	0x46,
+	0xcf,
+	0xa5,
+	0xcb,
+	0xd0,
+	0x02,
+	0x91,
+	0xdf,
+	0xa5,
+	0xcd,
+	0xc5,
+	0xce,
+	0x90,
+	0x0c,
+	0xc5,
+	0xcf,
+	0xf0,
+	0x02,
+	0xb0,
+	0x06,
+	0xb1,
+	0xdf,
+	0x05,
+	0xcc,
+	0x91,
+	0xdf,
+	0xa5,
+	0xcd,
+	0x1a,
+	0xc5,
+	0x27,
+	0xb0,
+	0x09,
+	0x85,
+	0xcd,
+	0x18,
+	0x98,
+	0x65,
+	0x22,
+	0xa8,
+	0x80,
+	0xd8,
+	0xa5,
+	0xcb,
+	0x1a,
+	0xcd,
+	0xde,
+	0x2b,
+	0xb0,
+	0x0b,
+	0x85,
+	0xcb,
+	0x8a,
+	0x18,
+	0x69,
+	0x04,
+	0xaa,
+	0x06,
+	0xcc,
+	0x80,
+	0xaf,
+	0x60,
+	0xad,
+	0xcf,
+	0x3b,
+	0x0d,
+	0xd0,
+	0x3b,
+	0xf0,
+	0x2d,
+	0xa0,
+	0x02,
+	0x53,
+	0xcf,
+	0x3b,
+	0xd1,
+	0x00,
+	0x20,
+	0x3d,
+	0x21,
+	0xa0,
+	0x02,
+	0x53,
+	0xd1,
+	0x3b,
+	0xcf,
+	0x00,
+	0x20,
+	0xe2,
+	0x20,
+	0xa0,
+	0x02,
+	0x53,
+	0xd5,
+	0x3b,
+	0xd7,
+	0x00,
+	0xa5,
+	0xd8,
+	0x10,
+	0x08,
+	0xa2,
+	0xff,
+	0x86,
+	0xd9,
+	0x86,
+	0xda,
+	0x80,
+	0x38,
+	0x64,
+	0xd9,
+	0x64,
+	0xda,
+	0x80,
+	0x32,
+	0xa0,
+	0x02,
+	0x53,
+	0xd3,
+	0x3b,
+	0xd1,
+	0x00,
+	0x20,
+	0x3d,
+	0x21,
+	0xa0,
+	0x02,
+	0x53,
+	0xd5,
+	0x3b,
+	0xcf,
+	0x00,
+	0x20,
+	0xe2,
+	0x20,
+	0xa0,
+	0x04,
+	0x53,
+	0xd3,
+	0x00,
+	0xd7,
+	0x00,
+	0xa0,
+	0x02,
+	0x53,
+	0xd1,
+	0x3b,
+	0xd3,
+	0x00,
+	0xa5,
+	0xd4,
+	0x10,
+	0x08,
+	0xa2,
+	0xff,
+	0x86,
+	0xd5,
+	0x86,
+	0xd6,
+	0x80,
+	0x04,
+	0x64,
+	0xd5,
+	0x64,
+	0xd6,
+	0xd8,
+	0xa5,
+	0xd6,
+	0x45,
+	0xda,
+	0xf8,
+	0x10,
+	0x03,
+	0xa9,
+	0x1e,
+	0x60,
+	0xa5,
+	0xd6,
+	0x10,
+	0x03,
+	0x20,
+	0xda,
+	0x21,
+	0x20,
+	0x07,
+	0x22,
+	0x64,
+	0xd3,
+	0xa0,
+	0x02,
+	0x53,
+	0xcf,
+	0x00,
+	0xd4,
+	0x00,
+	0x64,
+	0xd6,
+	0x53,
+	0xd1,
+	0x00,
+	0xcf,
+	0x00,
+	0x20,
+	0x81,
+	0x21,
+	0xa5,
+	0xd5,
+	0xf0,
+	0x06,
+	0xa9,
+	0xff,
+	0x85,
+	0xd3,
+	0x85,
+	0xd4,
+	0xa5,
+	0xd3,
+	0x45,
+	0xdb,
+	0x85,
+	0xd7,
+	0x84,
+	0xd8,
+	0xa5,
+	0xd3,
+	0x45,
+	0xdc,
+	0x18,
+	0x65,
+	0xd8,
+	0x85,
+	0xd8,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xd9,
+	0xa5,
+	0xd4,
+	0x45,
+	0xdb,
+	0x18,
+	0x65,
+	0xd8,
+	0x85,
+	0xd8,
+	0x98,
+	0x65,
+	0xd9,
+	0x85,
+	0xd9,
+	0xa5,
+	0xd4,
+	0x45,
+	0xdc,
+	0x65,
+	0xd9,
+	0x85,
+	0xd9,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xda,
+	0xa5,
+	0xd7,
+	0x10,
+	0x08,
+	0xe6,
+	0xd8,
+	0xd0,
+	0x04,
+	0xe6,
+	0xd9,
+	0xf0,
+	0x0d,
+	0xa5,
+	0xda,
+	0xd0,
+	0x09,
+	0xa0,
+	0x02,
+	0x53,
+	0xd8,
+	0x00,
+	0x2d,
+	0x00,
+	0x80,
+	0x06,
+	0xa9,
+	0xff,
+	0x85,
+	0x2d,
+	0x85,
+	0x2e,
+	0xa9,
+	0x00,
+	0x60,
+	0xa2,
+	0x02,
+	0xa5,
+	0x6e,
+	0xdd,
+	0xcb,
+	0x3c,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xdd,
+	0xca,
+	0x3c,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x06,
+	0xf0,
+	0x02,
+	0x80,
+	0xe8,
+	0xca,
+	0xca,
+	0xda,
+	0x38,
+	0xa5,
+	0x6d,
+	0xfd,
+	0xca,
+	0x3c,
+	0x85,
+	0xcf,
+	0xa5,
+	0x6e,
+	0xfd,
+	0xcb,
+	0x3c,
+	0x85,
+	0xd0,
+	0xbd,
+	0xe5,
+	0x3c,
+	0x85,
+	0xd1,
+	0xbd,
+	0xe6,
+	0x3c,
+	0x85,
+	0xd2,
+	0x20,
+	0x04,
+	0x21,
+	0x8a,
+	0x4a,
+	0xaa,
+	0xbd,
+	0xf1,
+	0x3c,
+	0xf0,
+	0x12,
+	0x38,
+	0xa9,
+	0x00,
+	0xa8,
+	0xe5,
+	0xd3,
+	0x85,
+	0xd3,
+	0x98,
+	0xe5,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0xe5,
+	0xd5,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0xbd,
+	0xd6,
+	0x3c,
+	0x18,
+	0x65,
+	0xd5,
+	0x85,
+	0x99,
+	0xfa,
+	0xda,
+	0xbd,
+	0xdf,
+	0x3c,
+	0x85,
+	0xd1,
+	0xbd,
+	0xe0,
+	0x3c,
+	0x85,
+	0xd2,
+	0x20,
+	0x04,
+	0x21,
+	0x8a,
+	0x4a,
+	0xaa,
+	0xbd,
+	0xee,
+	0x3c,
+	0xf0,
+	0x12,
+	0x38,
+	0xa9,
+	0x00,
+	0xa8,
+	0xe5,
+	0xd3,
+	0x85,
+	0xd3,
+	0x98,
+	0xe5,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0xe5,
+	0xd5,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0xbd,
+	0xd3,
+	0x3c,
+	0x18,
+	0x65,
+	0xd5,
+	0x45,
+	0x88,
+	0x20,
+	0x52,
+	0x21,
+	0x85,
+	0x97,
+	0xfa,
+	0xbd,
+	0xd9,
+	0x3c,
+	0x85,
+	0xd1,
+	0xbd,
+	0xda,
+	0x3c,
+	0x85,
+	0xd2,
+	0x20,
+	0x04,
+	0x21,
+	0x8a,
+	0x4a,
+	0xaa,
+	0xbd,
+	0xeb,
+	0x3c,
+	0xf0,
+	0x12,
+	0x38,
+	0xa9,
+	0x00,
+	0xa8,
+	0xe5,
+	0xd3,
+	0x85,
+	0xd3,
+	0x98,
+	0xe5,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0xe5,
+	0xd5,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0xbd,
+	0xd0,
+	0x3c,
+	0x18,
+	0x65,
+	0xd5,
+	0x45,
+	0x89,
+	0x20,
+	0x52,
+	0x21,
+	0x85,
+	0x98,
+	0x60,
+	0xa5,
+	0x78,
+	0xc9,
+	0x02,
+	0xb0,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x02,
+	0xa9,
+	0x33,
+	0x85,
+	0xcb,
+	0xa2,
+	0x00,
+	0x18,
+	0x8a,
+	0x65,
+	0xcb,
+	0xa8,
+	0xa5,
+	0x6e,
+	0xd9,
+	0xfa,
+	0x3c,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xd9,
+	0xf9,
+	0x3c,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x06,
+	0xf0,
+	0x02,
+	0x80,
+	0xe3,
+	0x8a,
+	0x4a,
+	0x49,
+	0x05,
+	0x18,
+	0x65,
+	0xcb,
+	0x18,
+	0x69,
+	0xff,
+	0x85,
+	0xd1,
+	0xa9,
+	0x3c,
+	0x69,
+	0x00,
+	0x85,
+	0xd2,
+	0xa0,
+	0x05,
+	0xd3,
+	0xd1,
+	0x31,
+	0x00,
+	0x60,
+	0xa2,
+	0x02,
+	0x18,
+	0x8a,
+	0x65,
+	0xcb,
+	0xa8,
+	0xa5,
+	0x6e,
+	0xd9,
+	0x14,
+	0x3d,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xd9,
+	0x13,
+	0x3d,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x0a,
+	0xf0,
+	0x02,
+	0x80,
+	0xe3,
+	0xca,
+	0xca,
+	0x18,
+	0x8a,
+	0x65,
+	0xcb,
+	0xa8,
+	0x38,
+	0xa5,
+	0x6d,
+	0xf9,
+	0x13,
+	0x3d,
+	0x85,
+	0xcf,
+	0xa5,
+	0x6e,
+	0xf9,
+	0x14,
+	0x3d,
+	0x85,
+	0xd0,
+	0xb9,
+	0x1d,
+	0x3d,
+	0x85,
+	0xd1,
+	0xb9,
+	0x1e,
+	0x3d,
+	0x85,
+	0xd2,
+	0x20,
+	0x3d,
+	0x21,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0x8a,
+	0x4a,
+	0x18,
+	0x65,
+	0xcb,
+	0xa8,
+	0x18,
+	0xb9,
+	0x27,
+	0x3d,
+	0x65,
+	0xd5,
+	0x85,
+	0x36,
+	0x60,
+	0x38,
+	0x30,
+	0x0b,
+	0x85,
+	0xcb,
+	0xa9,
+	0x00,
+	0xe5,
+	0xcb,
+	0xd0,
+	0x02,
+	0xa9,
+	0xff,
+	0x60,
+	0xe9,
+	0x80,
+	0x4a,
+	0x4a,
+	0x85,
+	0xcb,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0xcb,
+	0x60,
+	0x38,
+	0xe9,
+	0x80,
+	0xaa,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0xd8,
+	0x49,
+	0x01,
+	0xf8,
+	0x4a,
+	0x8a,
+	0x6a,
+	0x18,
+	0x69,
+	0x80,
+	0x60,
+	0x38,
+	0x30,
+	0x0b,
+	0x85,
+	0xcb,
+	0xa9,
+	0x00,
+	0xe5,
+	0xcb,
+	0xd0,
+	0x02,
+	0xa9,
+	0xff,
+	0x60,
+	0xe9,
+	0x80,
+	0x4a,
+	0x85,
+	0xcb,
+	0x38,
+	0xa9,
+	0x80,
+	0xe5,
+	0xcb,
+	0x60,
+	0x38,
+	0xe9,
+	0x80,
+	0x85,
+	0xcb,
+	0x8a,
+	0x3c,
+	0x45,
+	0xcb,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xdc,
+	0x10,
+	0x01,
+	0x1a,
+	0x18,
+	0x69,
+	0x80,
+	0x60,
+	0x0a,
+	0x85,
+	0xcb,
+	0x8a,
+	0x45,
+	0xcb,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0x60,
+	0x0a,
+	0x85,
+	0xcb,
+	0x8a,
+	0x45,
+	0xcb,
+	0x0a,
+	0x98,
+	0x69,
+	0x00,
+	0xc9,
+	0x7f,
+	0xb0,
+	0x01,
+	0x60,
+	0xa9,
+	0x7f,
+	0x60,
+	0xa2,
+	0x02,
+	0xa5,
+	0x6e,
+	0xdd,
+	0x71,
+	0x3f,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xdd,
+	0x70,
+	0x3f,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x06,
+	0xf0,
+	0x02,
+	0x80,
+	0xe8,
+	0xca,
+	0xca,
+	0xda,
+	0x38,
+	0xa5,
+	0x6d,
+	0xfd,
+	0x70,
+	0x3f,
+	0x85,
+	0xcf,
+	0xa5,
+	0x6e,
+	0xfd,
+	0x71,
+	0x3f,
+	0x85,
+	0xd0,
+	0xbd,
+	0x76,
+	0x3f,
+	0x85,
+	0xd1,
+	0xbd,
+	0x77,
+	0x3f,
+	0x85,
+	0xd2,
+	0x20,
+	0x3d,
+	0x21,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x18,
+	0xbd,
+	0x82,
+	0x3f,
+	0x65,
+	0xd5,
+	0x85,
+	0xba,
+	0xfa,
+	0xbd,
+	0x7c,
+	0x3f,
+	0x85,
+	0xd1,
+	0xbd,
+	0x7d,
+	0x3f,
+	0x85,
+	0xd2,
+	0x20,
+	0x3d,
+	0x21,
+	0xa5,
+	0xd4,
+	0x10,
+	0x02,
+	0xe6,
+	0xd5,
+	0x8a,
+	0x4a,
+	0xaa,
+	0x18,
+	0xbd,
+	0x85,
+	0x3f,
+	0x65,
+	0xd5,
+	0x85,
+	0xbb,
+	0x60,
+	0x5a,
+	0x86,
+	0xcb,
+	0x45,
+	0xcb,
+	0xaa,
+	0x98,
+	0x29,
+	0x30,
+	0xd0,
+	0x12,
+	0x98,
+	0x49,
+	0x08,
+	0x85,
+	0xcb,
+	0x8a,
+	0x49,
+	0x10,
+	0x98,
+	0x4a,
+	0x05,
+	0xcb,
+	0x69,
+	0x00,
+	0x30,
+	0x02,
+	0x7a,
+	0x60,
+	0xa9,
+	0x7f,
+	0x7a,
+	0x60,
+	0x5a,
+	0x86,
+	0xcb,
+	0x45,
+	0xcb,
+	0xaa,
+	0x98,
+	0x29,
+	0x38,
+	0xd0,
+	0x12,
+	0x98,
+	0x49,
+	0x10,
+	0x85,
+	0xcb,
+	0x8a,
+	0x49,
+	0x20,
+	0x98,
+	0x4a,
+	0x05,
+	0xcb,
+	0x69,
+	0x00,
+	0x30,
+	0x02,
+	0x7a,
+	0x60,
+	0xa9,
+	0x7f,
+	0x7a,
+	0x60,
+	0x5a,
+	0x86,
+	0xcb,
+	0x45,
+	0xcb,
+	0xaa,
+	0x98,
+	0x29,
+	0xf8,
+	0xd0,
+	0x10,
+	0x98,
+	0x49,
+	0x10,
+	0x85,
+	0xcb,
+	0x8a,
+	0x49,
+	0x20,
+	0x98,
+	0x4a,
+	0x05,
+	0xcb,
+	0x69,
+	0x00,
+	0x10,
+	0x02,
+	0xa9,
+	0x7f,
+	0x7a,
+	0x60,
+	0x49,
+	0x3c,
+	0x18,
+	0x65,
+	0xd9,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0x85,
+	0xd0,
+	0x18,
+	0xa5,
+	0xcf,
+	0x69,
+	0x78,
+	0x85,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x69,
+	0x3d,
+	0x85,
+	0xd0,
+	0x60,
+	0xf0,
+	0x02,
+	0xa9,
+	0x3c,
+	0x18,
+	0x65,
+	0xd9,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x69,
+	0x00,
+	0x85,
+	0xd0,
+	0x18,
+	0xa5,
+	0xcf,
+	0x69,
+	0x78,
+	0x85,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x69,
+	0x3d,
+	0x85,
+	0xd0,
+	0x60,
+	0x85,
+	0xd8,
+	0xa9,
+	0x04,
+	0x48,
+	0x80,
+	0x1a,
+	0xfa,
+	0xfa,
+	0x48,
+	0xa9,
+	0x0f,
+	0x18,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0xd0,
+	0xa5,
+	0xcd,
+	0x65,
+	0xd1,
+	0x85,
+	0xd1,
+	0x90,
+	0x03,
+	0x18,
+	0xe6,
+	0xd2,
+	0xa0,
+	0x0f,
+	0xd3,
+	0xcf,
+	0x56,
+	0x00,
+	0xa6,
+	0x62,
+	0xa5,
+	0x85,
+	0x20,
+	0xb4,
+	0x14,
+	0x85,
+	0xcc,
+	0xa6,
+	0x63,
+	0xa5,
+	0x85,
+	0x20,
+	0xb4,
+	0x14,
+	0x85,
+	0xce,
+	0xa6,
+	0x64,
+	0xa5,
+	0x85,
+	0x20,
+	0xb4,
+	0x14,
+	0x85,
+	0xd3,
+	0xa5,
+	0x56,
+	0xa6,
+	0xce,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x89,
+	0x20,
+	0x71,
+	0x15,
+	0x85,
+	0x56,
+	0xa5,
+	0x57,
+	0xa6,
+	0xd3,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x30,
+	0x20,
+	0x92,
+	0x15,
+	0x85,
+	0x57,
+	0xa5,
+	0x58,
+	0xa6,
+	0xcc,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x58,
+	0xa5,
+	0x59,
+	0xa6,
+	0xcc,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x59,
+	0xa5,
+	0x5a,
+	0xa6,
+	0xcc,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x8b,
+	0x20,
+	0x50,
+	0x15,
+	0x85,
+	0x5a,
+	0xa5,
+	0x5b,
+	0xa6,
+	0xd3,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x8a,
+	0x20,
+	0x50,
+	0x15,
+	0x85,
+	0x5b,
+	0xa5,
+	0x5c,
+	0xa6,
+	0xce,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x5c,
+	0xa5,
+	0x5d,
+	0xa6,
+	0xce,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x5d,
+	0xa5,
+	0x5e,
+	0xa6,
+	0xd3,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x5e,
+	0xa0,
+	0x09,
+	0xa5,
+	0xd8,
+	0xd0,
+	0x27,
+	0xa5,
+	0x5f,
+	0xa6,
+	0xcc,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x2f,
+	0x20,
+	0x92,
+	0x15,
+	0x85,
+	0x5f,
+	0xa5,
+	0x60,
+	0xa6,
+	0xce,
+	0x20,
+	0xc9,
+	0x14,
+	0xa6,
+	0x88,
+	0x20,
+	0x71,
+	0x15,
+	0x85,
+	0x60,
+	0xa5,
+	0x61,
+	0xa6,
+	0xd3,
+	0x20,
+	0xd4,
+	0x14,
+	0x85,
+	0x61,
+	0xa0,
+	0x0c,
+	0x73,
+	0x56,
+	0x00,
+	0xd1,
+	0x68,
+	0x3a,
+	0xd0,
+	0x01,
+	0x60,
+	0x20,
+	0xf0,
+	0x15,
+	0xa9,
+	0x03,
+	0x48,
+	0xa2,
+	0x00,
+	0x80,
+	0x06,
+	0x48,
+	0x18,
+	0x8a,
+	0x69,
+	0x15,
+	0xaa,
+	0xa0,
+	0x15,
+	0x18,
+	0xbd,
+	0x18,
+	0x29,
+	0x7d,
+	0x42,
+	0x29,
+	0x4a,
+	0x69,
+	0x00,
+	0x9d,
+	0x2d,
+	0x29,
+	0xe8,
+	0x88,
+	0xd0,
+	0xef,
+	0x68,
+	0x3a,
+	0xd0,
+	0xe3,
+	0x60,
+	0xbc,
+	0x93,
+	0x27,
+	0x84,
+	0xcb,
+	0x45,
+	0xcb,
+	0x85,
+	0xcf,
+	0x84,
+	0xd0,
+	0x18,
+	0xa9,
+	0x10,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0xb0,
+	0x15,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0xb0,
+	0x0f,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0xb0,
+	0x09,
+	0xa9,
+	0xc0,
+	0x25,
+	0xd0,
+	0xd0,
+	0x03,
+	0xa5,
+	0xd0,
+	0x60,
+	0xa9,
+	0x3f,
+	0x60,
+	0xa5,
+	0x2b,
+	0x49,
+	0x10,
+	0x85,
+	0xd3,
+	0x84,
+	0xd4,
+	0xa5,
+	0x2c,
+	0x49,
+	0x10,
+	0x05,
+	0xd4,
+	0x85,
+	0xd4,
+	0x84,
+	0xd5,
+	0x64,
+	0xd6,
+	0xa0,
+	0x02,
+	0x53,
+	0x6d,
+	0x00,
+	0xcf,
+	0x00,
+	0x20,
+	0x81,
+	0x21,
+	0xa5,
+	0xd5,
+	0xd0,
+	0x0a,
+	0xa5,
+	0xd4,
+	0xd0,
+	0x06,
+	0xa5,
+	0xd3,
+	0xc9,
+	0x3f,
+	0x90,
+	0x02,
+	0xa9,
+	0x3f,
+	0x45,
+	0x89,
+	0x18,
+	0x69,
+	0x08,
+	0x85,
+	0xcb,
+	0x98,
+	0x69,
+	0x00,
+	0x49,
+	0x10,
+	0xc0,
+	0x00,
+	0xd0,
+	0x0f,
+	0xaa,
+	0xa5,
+	0xcb,
+	0x49,
+	0x10,
+	0x84,
+	0xcb,
+	0x8a,
+	0x05,
+	0xcb,
+	0xcd,
+	0x62,
+	0x3c,
+	0x90,
+	0x05,
+	0xad,
+	0x64,
+	0x3c,
+	0x80,
+	0x03,
+	0xad,
+	0x63,
+	0x3c,
+	0x18,
+	0x69,
+	0x20,
+	0x29,
+	0x3f,
+	0x85,
+	0xcb,
+	0xa4,
+	0x78,
+	0xb9,
+	0x5d,
+	0x3c,
+	0x18,
+	0x69,
+	0x20,
+	0x29,
+	0x3f,
+	0x85,
+	0xcc,
+	0xa4,
+	0x79,
+	0xb9,
+	0x55,
+	0x3c,
+	0x45,
+	0xcc,
+	0x85,
+	0xcf,
+	0x84,
+	0xd0,
+	0x18,
+	0xa9,
+	0x10,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x06,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x2a,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x2a,
+	0x85,
+	0xd0,
+	0xa5,
+	0xcf,
+	0x45,
+	0xcb,
+	0x85,
+	0xcf,
+	0xa5,
+	0xd0,
+	0xf0,
+	0x05,
+	0x18,
+	0x98,
+	0x65,
+	0xcb,
+	0xa8,
+	0x84,
+	0xd0,
+	0x18,
+	0xa9,
+	0x10,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x64,
+	0xcb,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x26,
+	0xcb,
+	0x06,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x2a,
+	0x85,
+	0xd1,
+	0xa5,
+	0xcb,
+	0x2a,
+	0x85,
+	0xd2,
+	0xa0,
+	0x00,
+	0x5a,
+	0xb9,
+	0x28,
+	0x3c,
+	0x18,
+	0x69,
+	0x20,
+	0x29,
+	0x3f,
+	0x85,
+	0xcb,
+	0xa5,
+	0xcb,
+	0x45,
+	0xd1,
+	0x85,
+	0xcf,
+	0xfc,
+	0xa5,
+	0xcb,
+	0x45,
+	0xd2,
+	0x85,
+	0xd0,
+	0x8a,
+	0x18,
+	0x65,
+	0xd0,
+	0x85,
+	0xd0,
+	0x18,
+	0xa9,
+	0x10,
+	0x65,
+	0xcf,
+	0x85,
+	0xcf,
+	0x90,
+	0x02,
+	0xe6,
+	0xd0,
+	0x64,
+	0xcb,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x26,
+	0xcb,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x26,
+	0xcb,
+	0x06,
+	0xcf,
+	0xa5,
+	0xd0,
+	0x2a,
+	0xa8,
+	0xa5,
+	0xcb,
+	0x2a,
+	0xd0,
+	0x05,
+	0x98,
+	0xc9,
+	0x1f,
+	0x90,
+	0x02,
+	0xa9,
+	0x1f,
+	0x7a,
+	0x99,
+	0x1d,
+	0x2b,
+	0xc8,
+	0xc0,
+	0x07,
+	0x90,
+	0xae,
+	0xa9,
+	0x00,
+	0x60,
+	0xa5,
+	0xc6,
+	0xa8,
+	0x29,
+	0x0f,
+	0xf0,
+	0x28,
+	0x98,
+	0x29,
+	0xf0,
+	0xf0,
+	0x23,
+	0xa5,
+	0xc5,
+	0xaa,
+	0x29,
+	0x0f,
+	0x3a,
+	0xd0,
+	0x11,
+	0xd8,
+	0x8a,
+	0x49,
+	0x10,
+	0xaa,
+	0xd0,
+	0x07,
+	0x98,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x80,
+	0x03,
+	0x98,
+	0x29,
+	0x0f,
+	0xf8,
+	0x85,
+	0xc5,
+	0x8a,
+	0x29,
+	0x10,
+	0x05,
+	0xc5,
+	0x85,
+	0xc5,
+	0x60,
+	0xa9,
+	0x01,
+	0x8d,
+	0x10,
+	0x60,
+	0xa0,
+	0x02,
+	0x53,
+	0xad,
+	0x3c,
+	0x58,
+	0x60,
+	0x53,
+	0x65,
+	0x00,
+	0x18,
+	0x60,
+	0x53,
+	0x67,
+	0x00,
+	0x1c,
+	0x60,
+	0x53,
+	0x69,
+	0x00,
+	0x28,
+	0x60,
+	0x53,
+	0x6b,
+	0x00,
+	0x2c,
+	0x60,
+	0x53,
+	0x6f,
+	0x00,
+	0x30,
+	0x60,
+	0xa0,
+	0x01,
+	0x53,
+	0xb3,
+	0x3c,
+	0x20,
+	0x61,
+	0x53,
+	0xb4,
+	0x3c,
+	0x24,
+	0x61,
+	0x53,
+	0xb5,
+	0x3c,
+	0x28,
+	0x61,
+	0x53,
+	0xaf,
+	0x3c,
+	0x2c,
+	0x61,
+	0x53,
+	0xb0,
+	0x3c,
+	0x30,
+	0x61,
+	0x53,
+	0xb1,
+	0x3c,
+	0x34,
+	0x61,
+	0x53,
+	0xb2,
+	0x3c,
+	0x38,
+	0x61,
+	0x53,
+	0xb6,
+	0x3c,
+	0x3c,
+	0x61,
+	0x53,
+	0xb7,
+	0x3c,
+	0x40,
+	0x61,
+	0x53,
+	0xf4,
+	0x3f,
+	0x74,
+	0x60,
+	0x53,
+	0xaa,
+	0x3c,
+	0x0c,
+	0x61,
+	0x53,
+	0xab,
+	0x3c,
+	0x44,
+	0x61,
+	0x53,
+	0xac,
+	0x3c,
+	0x88,
+	0x60,
+	0x53,
+	0x54,
+	0x3c,
+	0xdc,
+	0x60,
+	0x53,
+	0x55,
+	0x3c,
+	0x68,
+	0x61,
+	0x53,
+	0x80,
+	0x00,
+	0x14,
+	0x60,
+	0x53,
+	0x7f,
+	0x00,
+	0x3c,
+	0x60,
+	0x53,
+	0x88,
+	0x00,
+	0xec,
+	0x60,
+	0x53,
+	0x89,
+	0x00,
+	0xe0,
+	0x60,
+	0x53,
+	0x8a,
+	0x00,
+	0xe8,
+	0x60,
+	0x53,
+	0x8b,
+	0x00,
+	0xe4,
+	0x60,
+	0x53,
+	0x8e,
+	0x00,
+	0x64,
+	0x61,
+	0x53,
+	0x8f,
+	0x00,
+	0x80,
+	0x60,
+	0x53,
+	0x90,
+	0x00,
+	0x84,
+	0x60,
+	0x53,
+	0x91,
+	0x00,
+	0x58,
+	0x61,
+	0x53,
+	0x92,
+	0x00,
+	0xf0,
+	0x60,
+	0x53,
+	0x93,
+	0x00,
+	0xf4,
+	0x60,
+	0x53,
+	0x94,
+	0x00,
+	0xf8,
+	0x60,
+	0x53,
+	0x95,
+	0x00,
+	0x5c,
+	0x61,
+	0x53,
+	0x96,
+	0x00,
+	0xac,
+	0x60,
+	0x53,
+	0x97,
+	0x00,
+	0x7c,
+	0x60,
+	0x53,
+	0x98,
+	0x00,
+	0x78,
+	0x60,
+	0x53,
+	0x99,
+	0x00,
+	0x10,
+	0x61,
+	0x53,
+	0x9a,
+	0x00,
+	0xfc,
+	0x60,
+	0x53,
+	0x9b,
+	0x00,
+	0x00,
+	0x61,
+	0x53,
+	0x9c,
+	0x00,
+	0x04,
+	0x61,
+	0x53,
+	0x9d,
+	0x00,
+	0x08,
+	0x61,
+	0x53,
+	0x9e,
+	0x00,
+	0x1c,
+	0x61,
+	0x53,
+	0x9f,
+	0x00,
+	0x4c,
+	0x61,
+	0x53,
+	0xa0,
+	0x00,
+	0x18,
+	0x61,
+	0x53,
+	0xa1,
+	0x00,
+	0x48,
+	0x61,
+	0x53,
+	0xa2,
+	0x00,
+	0x14,
+	0x61,
+	0x53,
+	0xa3,
+	0x00,
+	0x6c,
+	0x61,
+	0x53,
+	0xa4,
+	0x00,
+	0x5c,
+	0x60,
+	0x53,
+	0xa5,
+	0x00,
+	0xbc,
+	0x60,
+	0x53,
+	0xa6,
+	0x00,
+	0xc0,
+	0x60,
+	0x53,
+	0xa7,
+	0x00,
+	0xc4,
+	0x60,
+	0x53,
+	0xa8,
+	0x00,
+	0xc8,
+	0x60,
+	0x53,
+	0xa9,
+	0x00,
+	0xcc,
+	0x60,
+	0x53,
+	0xaa,
+	0x00,
+	0xd0,
+	0x60,
+	0x53,
+	0xab,
+	0x00,
+	0xd4,
+	0x60,
+	0x53,
+	0xac,
+	0x00,
+	0xd8,
+	0x60,
+	0x53,
+	0xad,
+	0x00,
+	0x50,
+	0x61,
+	0x53,
+	0xae,
+	0x00,
+	0x60,
+	0x60,
+	0x53,
+	0xaf,
+	0x00,
+	0x64,
+	0x60,
+	0x53,
+	0xb0,
+	0x00,
+	0x68,
+	0x60,
+	0x53,
+	0xb1,
+	0x00,
+	0x60,
+	0x61,
+	0x53,
+	0xb2,
+	0x00,
+	0x6c,
+	0x60,
+	0x53,
+	0xb3,
+	0x00,
+	0x70,
+	0x60,
+	0x53,
+	0xb4,
+	0x00,
+	0xa8,
+	0x60,
+	0x53,
+	0xb5,
+	0x00,
+	0xa4,
+	0x60,
+	0x53,
+	0xb6,
+	0x00,
+	0xa0,
+	0x60,
+	0x53,
+	0xb7,
+	0x00,
+	0x9c,
+	0x60,
+	0x53,
+	0xb8,
+	0x00,
+	0x98,
+	0x60,
+	0x53,
+	0xb9,
+	0x00,
+	0x94,
+	0x60,
+	0x53,
+	0xba,
+	0x00,
+	0x8c,
+	0x60,
+	0x53,
+	0xbb,
+	0x00,
+	0x90,
+	0x60,
+	0x53,
+	0xbe,
+	0x00,
+	0xb8,
+	0x60,
+	0x53,
+	0xbf,
+	0x00,
+	0xb4,
+	0x60,
+	0x53,
+	0xc0,
+	0x00,
+	0xb0,
+	0x60,
+	0x53,
+	0xc1,
+	0x00,
+	0x54,
+	0x61,
+	0x53,
+	0xc2,
+	0x00,
+	0x70,
+	0x61,
+	0x9c,
+	0x20,
+	0x60,
+	0x9c,
+	0x24,
+	0x60,
+	0x60,
+	0x29,
+	0x01,
+	0xf0,
+	0x06,
+	0xa2,
+	0xb8,
+	0xa9,
+	0x01,
+	0x80,
+	0x04,
+	0xa2,
+	0x38,
+	0xa9,
+	0x00,
+	0x8e,
+	0x0c,
+	0x60,
+	0x8d,
+	0x0d,
+	0x60,
+	0x85,
+	0xd4,
+	0x86,
+	0xd3,
+	0xa4,
+	0x8d,
+	0xb9,
+	0xe7,
+	0x2a,
+	0xa8,
+	0xb9,
+	0x47,
+	0x27,
+	0x49,
+	0x04,
+	0x18,
+	0x69,
+	0x5f,
+	0x85,
+	0xcf,
+	0xa9,
+	0x00,
+	0x69,
+	0x3d,
+	0x85,
+	0xd0,
+	0xa5,
+	0x73,
+	0x85,
+	0xcb,
+	0xa0,
+	0x00,
+	0x5a,
+	0xb9,
+	0xd7,
+	0x2a,
+	0xa8,
+	0xb9,
+	0x37,
+	0x27,
+	0x4a,
+	0xa8,
+	0xb1,
+	0xcf,
+	0xb0,
+	0x04,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x29,
+	0x0f,
+	0x18,
+	0x49,
+	0x15,
+	0x69,
+	0x18,
+	0x85,
+	0xd1,
+	0xa9,
+	0x29,
+	0x69,
+	0x00,
+	0x85,
+	0xd2,
+	0xa0,
+	0x15,
+	0xc3,
+	0xd1,
+	0x54,
+	0x60,
+	0x18,
+	0xa5,
+	0xd3,
+	0x69,
+	0x18,
+	0x85,
+	0xd3,
+	0x90,
+	0x02,
+	0xe6,
+	0xd4,
+	0xa0,
+	0x02,
+	0x53,
+	0xd3,
+	0x00,
+	0x0c,
+	0x60,
+	0x7a,
+	0xc6,
+	0xcb,
+	0xf0,
+	0x03,
+	0xc8,
+	0x80,
+	0xbf,
+	0xe6,
+	0x8d,
+	0x60,
+	0xa5,
+	0x7a,
+	0xf0,
+	0x06,
+	0xa5,
+	0x7b,
+	0xc9,
+	0x00,
+	0xd0,
+	0x12,
+	0xa0,
+	0x02,
+	0x53,
+	0xa2,
+	0x3c,
+	0xb6,
+	0x02,
+	0x53,
+	0xa4,
+	0x3c,
+	0xb8,
+	0x02,
+	0x9c,
+	0xa9,
+	0x02,
+	0x4c,
+	0x55,
+	0x1d,
+	0xa9,
+	0x03,
+	0x85,
+	0xd7,
+	0xa0,
+	0x02,
+	0x53,
+	0x42,
+	0x00,
+	0xcf,
+	0x00,
+	0xa5,
+	0x3f,
+	0xc5,
+	0xd0,
+	0x90,
+	0x13,
+	0xd0,
+	0x06,
+	0xa5,
+	0x3e,
+	0xc5,
+	0xcf,
+	0x90,
+	0x0b,
+	0xa9,
+	0x01,
+	0x85,
+	0xd7,
+	0xa0,
+	0x02,
+	0x53,
+	0x3e,
+	0x00,
+	0xcf,
+	0x00,
+	0xa5,
+	0x3d,
+	0xc5,
+	0xd0,
+	0x90,
+	0x13,
+	0xd0,
+	0x06,
+	0xa5,
+	0x3c,
+	0xc5,
+	0xcf,
+	0x90,
+	0x0b,
+	0xa9,
+	0x00,
+	0x85,
+	0xd7,
+	0xa0,
+	0x02,
+	0x53,
+	0x3c,
+	0x00,
+	0xcf,
+	0x00,
+	0xa5,
+	0x41,
+	0xc5,
+	0xd0,
+	0x90,
+	0x13,
+	0xd0,
+	0x06,
+	0xa5,
+	0x40,
+	0xc5,
+	0xcf,
+	0x90,
+	0x0b,
+	0xa9,
+	0x02,
+	0x85,
+	0xd7,
+	0xa0,
+	0x02,
+	0x53,
+	0x40,
+	0x00,
+	0xcf,
+	0x00,
+	0xa6,
+	0x7b,
+	0xe0,
+	0x02,
+	0xf0,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x02,
+	0xa9,
+	0x16,
+	0x85,
+	0xcb,
+	0xa2,
+	0x00,
+	0x18,
+	0x8a,
+	0x65,
+	0xcb,
+	0xa8,
+	0xa5,
+	0x6e,
+	0xd9,
+	0x69,
+	0x3c,
+	0x90,
+	0x11,
+	0xd0,
+	0x07,
+	0xa5,
+	0x6d,
+	0xd9,
+	0x68,
+	0x3c,
+	0x90,
+	0x08,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x08,
+	0xf0,
+	0x02,
+	0x80,
+	0xe3,
+	0x8a,
+	0x4a,
+	0x49,
+	0x04,
+	0x18,
+	0x65,
+	0xcb,
+	0x48,
+	0xa5,
+	0x37,
+	0x85,
+	0xcb,
+	0xd0,
+	0x08,
+	0x64,
+	0xd3,
+	0x64,
+	0xd4,
+	0x64,
+	0xd5,
+	0x80,
+	0x48,
+	0x4a,
+	0x85,
+	0xda,
+	0xa5,
+	0x38,
+	0x85,
+	0xd0,
+	0xa5,
+	0xda,
+	0x85,
+	0xcf,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x04,
+	0xa5,
+	0xcf,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xd3,
+	0xa5,
+	0x39,
+	0x85,
+	0xd0,
+	0xa5,
+	0xda,
+	0x85,
+	0xcf,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x04,
+	0xa5,
+	0xcf,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xd4,
+	0xa5,
+	0x3b,
+	0x85,
+	0xd0,
+	0xa5,
+	0xda,
+	0x85,
+	0xcf,
+	0x20,
+	0xbe,
+	0x20,
+	0xa5,
+	0xd0,
+	0xd0,
+	0x04,
+	0xa5,
+	0xcf,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xd5,
+	0xa5,
+	0x7c,
+	0xf0,
+	0x03,
+	0x4c,
+	0x41,
+	0x1c,
+	0xad,
+	0xaa,
+	0x02,
+	0xc5,
+	0xd3,
+	0x90,
+	0x16,
+	0x38,
+	0xe5,
+	0xd3,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0xd3,
+	0x80,
+	0x21,
+	0xa5,
+	0xd3,
+	0x38,
+	0xed,
+	0xaa,
+	0x02,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x38,
+	0xe9,
+	0x80,
+	0x85,
+	0xdf,
+	0x98,
+	0xe9,
+	0x00,
+	0x85,
+	0xe0,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xdf,
+	0xa5,
+	0xd3,
+	0xe5,
+	0xe0,
+	0x85,
+	0xd3,
+	0xad,
+	0xab,
+	0x02,
+	0xc5,
+	0xd4,
+	0x90,
+	0x16,
+	0x38,
+	0xe5,
+	0xd4,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0xd4,
+	0x80,
+	0x21,
+	0xa5,
+	0xd4,
+	0x38,
+	0xed,
+	0xab,
+	0x02,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x38,
+	0xe9,
+	0x80,
+	0x85,
+	0xdf,
+	0x98,
+	0xe9,
+	0x00,
+	0x85,
+	0xe0,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xdf,
+	0xa5,
+	0xd4,
+	0xe5,
+	0xe0,
+	0x85,
+	0xd4,
+	0xad,
+	0xac,
+	0x02,
+	0xc5,
+	0xd5,
+	0x90,
+	0x16,
+	0x38,
+	0xe5,
+	0xd5,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x18,
+	0x69,
+	0x80,
+	0x98,
+	0x69,
+	0x00,
+	0x18,
+	0x65,
+	0xd5,
+	0x80,
+	0x21,
+	0xa5,
+	0xd5,
+	0x38,
+	0xed,
+	0xac,
+	0x02,
+	0x45,
+	0x81,
+	0x0a,
+	0xaa,
+	0x98,
+	0x2a,
+	0xa8,
+	0x8a,
+	0x38,
+	0xe9,
+	0x80,
+	0x85,
+	0xdf,
+	0x98,
+	0xe9,
+	0x00,
+	0x85,
+	0xe0,
+	0x38,
+	0xa9,
+	0x00,
+	0xe5,
+	0xdf,
+	0xa5,
+	0xd5,
+	0xe5,
+	0xe0,
+	0x85,
+	0xd5,
+	0xa0,
+	0x03,
+	0x53,
+	0xd3,
+	0x00,
+	0xaa,
+	0x02,
+	0x18,
+	0xa5,
+	0xd4,
+	0x65,
+	0xd3,
+	0xb0,
+	0x02,
+	0x80,
+	0x02,
+	0xa9,
+	0xff,
+	0x85,
+	0xd6,
+	0xfa,
+	0xa5,
+	0xd3,
+	0xdd,
+	0x71,
+	0x3c,
+	0x90,
+	0x16,
+	0xa9,
+	0x00,
+	0x85,
+	0xd8,
+	0xa5,
+	0xd3,
+	0xdd,
+	0x70,
+	0x3c,
+	0x90,
+	0x02,
+	0x80,
+	0x2a,
+	0xa5,
+	0xd6,
+	0xdd,
+	0x70,
+	0x3c,
+	0x90,
+	0x2f,
+	0x80,
+	0x27,
+	0xa5,
+	0xd6,
+	0xdd,
+	0x6f,
+	0x3c,
+	0x90,
+	0x2c,
+	0xa9,
+	0x01,
+	0x85,
+	0xd8,
+	0xa5,
+	0xd6,
+	0xdd,
+	0x70,
+	0x3c,
+	0x90,
+	0x02,
+	0x80,
+	0x13,
+	0xa5,
+	0xd5,
+	0xdd,
+	0x6e,
+	0x3c,
+	0x90,
+	0x12,
+	0xa9,
+	0x03,
+	0x85,
+	0xd9,
+	0x80,
+	0x27,
+	0xa9,
+	0x00,
+	0x85,
+	0xd9,
+	0x80,
+	0x21,
+	0xa9,
+	0x01,
+	0x85,
+	0xd9,
+	0x80,
+	0x1b,
+	0xa9,
+	0x02,
+	0x85,
+	0xd9,
+	0x80,
+	0x15,
+	0xa5,
+	0xd5,
+	0xdd,
+	0x6e,
+	0x3c,
+	0x90,
+	0x08,
+	0xa9,
+	0x03,
+	0x85,
+	0xd8,
+	0x85,
+	0xd9,
+	0x80,
+	0x06,
+	0xa9,
+	0x02,
+	0x85,
+	0xd8,
+	0x85,
+	0xd9,
+	0xa5,
+	0xd7,
+	0xc5,
+	0xd8,
+	0xf0,
+	0x02,
+	0xb0,
+	0x0c,
+	0xa5,
+	0xd8,
+	0xf0,
+	0x1a,
+	0x85,
+	0xd9,
+	0xa5,
+	0xd7,
+	0x85,
+	0xd8,
+	0x80,
+	0x12,
+	0xa5,
+	0xd8,
+	0xc9,
+	0x02,
+	0xd0,
+	0x08,
+	0xa5,
+	0xd7,
+	0x85,
+	0xd9,
+	0x85,
+	0xd8,
+	0x80,
+	0x04,
+	0xa5,
+	0xd7,
+	0x85,
+	0xd9,
+	0xa5,
+	0x7c,
+	0xd0,
+	0x05,
+	0xad,
+	0xa9,
+	0x02,
+	0xd0,
+	0x14,
+	0xa9,
+	0x01,
+	0x8d,
+	0xae,
+	0x02,
+	0x8d,
+	0xaf,
+	0x02,
+	0xa5,
+	0xd8,
+	0x8d,
+	0xb4,
+	0x02,
+	0xa5,
+	0xd9,
+	0x8d,
+	0xb5,
+	0x02,
+	0x80,
+	0x3c,
+	0xa5,
+	0xd8,
+	0xcd,
+	0xb4,
+	0x02,
+	0xd0,
+	0x0d,
+	0xad,
+	0xae,
+	0x02,
+	0xcd,
+	0x9e,
+	0x3c,
+	0xb0,
+	0x0f,
+	0xee,
+	0xae,
+	0x02,
+	0x80,
+	0x06,
+	0x8d,
+	0xb4,
+	0x02,
+	0x9c,
+	0xae,
+	0x02,
+	0xa5,
+	0x82,
+	0x85,
+	0xd8,
+	0xa5,
+	0xd9,
+	0xcd,
+	0xb5,
+	0x02,
+	0xd0,
+	0x0d,
+	0xad,
+	0xaf,
+	0x02,
+	0xcd,
+	0x9e,
+	0x3c,
+	0xb0,
+	0x0f,
+	0xee,
+	0xaf,
+	0x02,
+	0x80,
+	0x06,
+	0x8d,
+	0xb5,
+	0x02,
+	0x9c,
+	0xaf,
+	0x02,
+	0xa5,
+	0x83,
+	0x85,
+	0xd9,
+	0xa9,
+	0x01,
+	0x8d,
+	0xa9,
+	0x02,
+	0xa5,
+	0xd8,
+	0x20,
+	0xae,
+	0x0c,
+	0x8d,
+	0xb6,
+	0x02,
+	0x8e,
+	0xb7,
+	0x02,
+	0xa5,
+	0xd9,
+	0x20,
+	0xae,
+	0x0c,
+	0x8d,
+	0xb8,
+	0x02,
+	0x8e,
+	0xb9,
+	0x02,
+	0xa2,
+	0x00,
+	0xa0,
+	0x00,
+	0xc4,
+	0xc4,
+	0xb0,
+	0x1e,
+	0xa5,
+	0xc5,
+	0x29,
+	0x10,
+	0xf0,
+	0x03,
+	0x38,
+	0x80,
+	0x01,
+	0x18,
+	0x3e,
+	0x08,
+	0x2c,
+	0x3e,
+	0x09,
+	0x2c,
+	0x3e,
+	0x0a,
+	0x2c,
+	0x3e,
+	0x0b,
+	0x2c,
+	0xc8,
+	0x18,
+	0x8a,
+	0x69,
+	0x10,
+	0xaa,
+	0x80,
+	0xde,
+	0xa0,
+	0x50,
+	0x53,
+	0xfc,
+	0x2b,
+	0x52,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0x60,
+	0x60,
+	0xa5,
+	0x4c,
+	0x45,
+	0xd0,
+	0x85,
+	0xd3,
+	0x84,
+	0xd4,
+	0xa5,
+	0x4d,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xd5,
+	0xa5,
+	0x4e,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xd5,
+	0x85,
+	0xd5,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xd6,
+	0xa5,
+	0x4f,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xd6,
+	0x85,
+	0xd6,
+	0x60,
+	0xa0,
+	0x04,
+	0x13,
+	0x54,
+	0x60,
+	0x4c,
+	0x00,
+	0xa0,
+	0x04,
+	0x13,
+	0x54,
+	0x60,
+	0x44,
+	0x00,
+	0xa0,
+	0x04,
+	0x13,
+	0x54,
+	0x60,
+	0x48,
+	0x00,
+	0xa0,
+	0x02,
+	0x13,
+	0x54,
+	0x60,
+	0x54,
+	0x00,
+	0x38,
+	0xa5,
+	0x44,
+	0xe5,
+	0x48,
+	0x85,
+	0x50,
+	0xa5,
+	0x45,
+	0xe5,
+	0x49,
+	0x85,
+	0x51,
+	0xa5,
+	0x46,
+	0xe5,
+	0x4a,
+	0x85,
+	0x52,
+	0xa5,
+	0x47,
+	0xe5,
+	0x4b,
+	0x85,
+	0x53,
+	0x18,
+	0xa5,
+	0xd1,
+	0x69,
+	0x10,
+	0x85,
+	0xd1,
+	0x90,
+	0x02,
+	0xe6,
+	0xd2,
+	0xa0,
+	0x02,
+	0x53,
+	0xd1,
+	0x00,
+	0x0c,
+	0x60,
+	0xad,
+	0x9d,
+	0x3c,
+	0xc5,
+	0x55,
+	0x90,
+	0x0c,
+	0xd0,
+	0x07,
+	0xad,
+	0x9c,
+	0x3c,
+	0xc5,
+	0x54,
+	0x90,
+	0x03,
+	0x4c,
+	0x9d,
+	0x1f,
+	0xa5,
+	0x4f,
+	0xd0,
+	0x2b,
+	0xa5,
+	0x54,
+	0x45,
+	0xc3,
+	0x85,
+	0xdb,
+	0x84,
+	0xdc,
+	0xa5,
+	0x55,
+	0x45,
+	0xc3,
+	0x18,
+	0x65,
+	0xdc,
+	0x85,
+	0xdc,
+	0x98,
+	0x69,
+	0x00,
+	0xc5,
+	0x4e,
+	0x90,
+	0x13,
+	0xd0,
+	0x0e,
+	0xa5,
+	0xdc,
+	0xc5,
+	0x4d,
+	0x90,
+	0x0b,
+	0xd0,
+	0x06,
+	0xa5,
+	0xdb,
+	0xc5,
+	0x4c,
+	0x90,
+	0x03,
+	0x4c,
+	0x9d,
+	0x1f,
+	0xe6,
+	0x37,
+	0xa5,
+	0x87,
+	0x29,
+	0x01,
+	0xf0,
+	0x07,
+	0x18,
+	0xa5,
+	0x73,
+	0xe5,
+	0xcb,
+	0x80,
+	0x02,
+	0xa5,
+	0xcb,
+	0x45,
+	0x7d,
+	0xa8,
+	0xb9,
+	0x37,
+	0x27,
+	0x4a,
+	0xa8,
+	0xb1,
+	0xd9,
+	0xb0,
+	0x04,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x29,
+	0x0f,
+	0xa8,
+	0xad,
+	0xdd,
+	0x2b,
+	0xc9,
+	0x08,
+	0xf0,
+	0x17,
+	0xc9,
+	0x02,
+	0xf0,
+	0x09,
+	0xc9,
+	0x04,
+	0xf0,
+	0x0a,
+	0xb9,
+	0x50,
+	0x3c,
+	0x80,
+	0x0d,
+	0xb9,
+	0x4d,
+	0x3c,
+	0x80,
+	0x08,
+	0xb9,
+	0x4a,
+	0x3c,
+	0x80,
+	0x03,
+	0xb9,
+	0x47,
+	0x3c,
+	0x85,
+	0xce,
+	0xa5,
+	0x53,
+	0x29,
+	0x80,
+	0x85,
+	0xcd,
+	0xf0,
+	0x17,
+	0x38,
+	0xa9,
+	0x00,
+	0xaa,
+	0xe5,
+	0x50,
+	0x85,
+	0x50,
+	0x8a,
+	0xe5,
+	0x51,
+	0x85,
+	0x51,
+	0x8a,
+	0xe5,
+	0x52,
+	0x85,
+	0x52,
+	0x8a,
+	0xe5,
+	0x53,
+	0x85,
+	0x53,
+	0xa4,
+	0xcb,
+	0xb9,
+	0xd7,
+	0x2a,
+	0xa8,
+	0xb9,
+	0x37,
+	0x27,
+	0x4a,
+	0xa8,
+	0xb1,
+	0xd7,
+	0xb0,
+	0x04,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x4a,
+	0x29,
+	0x0f,
+	0xa8,
+	0xb9,
+	0x1d,
+	0x2b,
+	0x85,
+	0xd0,
+	0xa5,
+	0x50,
+	0x45,
+	0xd0,
+	0x85,
+	0x50,
+	0x84,
+	0xdf,
+	0xa5,
+	0x51,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xdf,
+	0x85,
+	0x51,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xdf,
+	0xa5,
+	0x52,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xdf,
+	0x85,
+	0x52,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xdf,
+	0xa5,
+	0x53,
+	0x45,
+	0xd0,
+	0x18,
+	0x65,
+	0xdf,
+	0x85,
+	0x53,
+	0xa5,
+	0xcd,
+	0xf0,
+	0x6a,
+	0xad,
+	0x65,
+	0x3c,
+	0x85,
+	0xd0,
+	0x20,
+	0x88,
+	0x1d,
+	0xa5,
+	0x53,
+	0xc5,
+	0xd6,
+	0x90,
+	0x27,
+	0xd0,
+	0x16,
+	0xa5,
+	0x52,
+	0xc5,
+	0xd5,
+	0x90,
+	0x1f,
+	0xd0,
+	0x0e,
+	0xa5,
+	0x51,
+	0xc5,
+	0xd4,
+	0x90,
+	0x17,
+	0xd0,
+	0x06,
+	0xa5,
+	0x50,
+	0xc5,
+	0xd3,
+	0x90,
+	0x0f,
+	0xe6,
+	0x38,
+	0x18,
+	0xa5,
+	0xce,
+	0x65,
+	0x3c,
+	0x85,
+	0x3c,
+	0x90,
+	0x7b,
+	0xe6,
+	0x3d,
+	0x80,
+	0x77,
+	0xad,
+	0x66,
+	0x3c,
+	0x85,
+	0xd0,
+	0x20,
+	0x88,
+	0x1d,
+	0xa5,
+	0x53,
+	0xc5,
+	0xd6,
+	0x90,
+	0x4d,
+	0xd0,
+	0x16,
+	0xa5,
+	0x52,
+	0xc5,
+	0xd5,
+	0x90,
+	0x45,
+	0xd0,
+	0x0e,
+	0xa5,
+	0x51,
+	0xc5,
+	0xd4,
+	0x90,
+	0x3d,
+	0xd0,
+	0x06,
+	0xa5,
+	0x50,
+	0xc5,
+	0xd3,
+	0x90,
+	0x35,
+	0xe6,
+	0x39,
+	0x18,
+	0xa5,
+	0xce,
+	0x65,
+	0x3e,
+	0x85,
+	0x3e,
+	0x90,
+	0x46,
+	0xe6,
+	0x3f,
+	0x80,
+	0x42,
+	0xad,
+	0x67,
+	0x3c,
+	0x85,
+	0xd0,
+	0x20,
+	0x88,
+	0x1d,
+	0xa5,
+	0xd6,
+	0xc5,
+	0x53,
+	0x90,
+	0x27,
+	0xd0,
+	0x16,
+	0xa5,
+	0xd5,
+	0xc5,
+	0x52,
+	0x90,
+	0x1f,
+	0xd0,
+	0x0e,
+	0xa5,
+	0xd4,
+	0xc5,
+	0x51,
+	0x90,
+	0x17,
+	0xd0,
+	0x06,
+	0xa5,
+	0xd3,
+	0xc5,
+	0x50,
+	0x90,
+	0x0f,
+	0xe6,
+	0x3a,
+	0x18,
+	0xa5,
+	0xce,
+	0x65,
+	0x40,
+	0x85,
+	0x40,
+	0x90,
+	0x11,
+	0xe6,
+	0x41,
+	0x80,
+	0x0d,
+	0xe6,
+	0x3b,
+	0x18,
+	0xa5,
+	0xce,
+	0x65,
+	0x42,
+	0x85,
+	0x42,
+	0x90,
+	0x02,
+	0xe6,
+	0x43,
+	0xa5,
+	0xc4,
+	0xd0,
+	0x01,
+	0x60,
+	0xa6,
+	0xcb,
+	0xbd,
+	0xf3,
+	0x2a,
+	0x25,
+	0x21,
+	0xd0,
+	0x01,
+	0x60,
+	0x85,
+	0xdd,
+	0xa2,
+	0x00,
+	0xa0,
+	0x00,
+	0xa9,
+	0x01,
+	0x85,
+	0xde,
+	0x25,
+	0xdd,
+	0xd0,
+	0x03,
+	0x4c,
+	0x36,
+	0x20,
+	0x18,
+	0xa5,
+	0x4c,
+	0x7d,
+	0xfc,
+	0x2b,
+	0x9d,
+	0xfc,
+	0x2b,
+	0xa5,
+	0x4d,
+	0x7d,
+	0xfd,
+	0x2b,
+	0x9d,
+	0xfd,
+	0x2b,
+	0xa5,
+	0x4e,
+	0x7d,
+	0xfe,
+	0x2b,
+	0x9d,
+	0xfe,
+	0x2b,
+	0xa5,
+	0x4f,
+	0x7d,
+	0xff,
+	0x2b,
+	0x9d,
+	0xff,
+	0x2b,
+	0x18,
+	0xa5,
+	0x44,
+	0x7d,
+	0x00,
+	0x2c,
+	0x9d,
+	0x00,
+	0x2c,
+	0xa5,
+	0x45,
+	0x7d,
+	0x01,
+	0x2c,
+	0x9d,
+	0x01,
+	0x2c,
+	0xa5,
+	0x46,
+	0x7d,
+	0x02,
+	0x2c,
+	0x9d,
+	0x02,
+	0x2c,
+	0xa5,
+	0x47,
+	0x7d,
+	0x03,
+	0x2c,
+	0x9d,
+	0x03,
+	0x2c,
+	0x18,
+	0xa5,
+	0x48,
+	0x7d,
+	0x04,
+	0x2c,
+	0x9d,
+	0x04,
+	0x2c,
+	0xa5,
+	0x49,
+	0x7d,
+	0x05,
+	0x2c,
+	0x9d,
+	0x05,
+	0x2c,
+	0xa5,
+	0x4a,
+	0x7d,
+	0x06,
+	0x2c,
+	0x9d,
+	0x06,
+	0x2c,
+	0xa5,
+	0x4b,
+	0x7d,
+	0x07,
+	0x2c,
+	0x9d,
+	0x07,
+	0x2c,
+	0x18,
+	0xa5,
+	0x54,
+	0x7d,
+	0x08,
+	0x2c,
+	0x9d,
+	0x08,
+	0x2c,
+	0xa5,
+	0x55,
+	0x7d,
+	0x09,
+	0x2c,
+	0x9d,
+	0x09,
+	0x2c,
+	0x90,
+	0x03,
+	0xfe,
+	0x0a,
+	0x2c,
+	0xc8,
+	0xc4,
+	0xc4,
+	0xb0,
+	0x0b,
+	0x18,
+	0x8a,
+	0x69,
+	0x10,
+	0xaa,
+	0xa5,
+	0xde,
+	0x0a,
+	0x4c,
+	0xb4,
+	0x1f,
+	0x60,
+	0xaa,
+	0xa5,
+	0x7a,
+	0xd0,
+	0x02,
+	0x80,
+	0x6d,
+	0xa5,
+	0x7b,
+	0xc9,
+	0x00,
+	0xf0,
+	0x67,
+	0x8a,
+	0x29,
+	0x01,
+	0xf0,
+	0x06,
+	0xa2,
+	0x38,
+	0xa9,
+	0x04,
+	0x80,
+	0x04,
+	0xa2,
+	0x38,
+	0xa9,
+	0x03,
+	0x8e,
+	0x0c,
+	0x60,
+	0x8d,
+	0x0d,
+	0x60,
+	0x85,
+	0xd2,
+	0x86,
+	0xd1,
+	0xa4,
+	0xbd,
+	0xb9,
+	0x03,
+	0x2b,
+	0x85,
+	0x21,
+	0xb9,
+	0xe7,
+	0x2a,
+	0xa8,
+	0xb9,
+	0x47,
+	0x27,
+	0x49,
+	0x04,
+	0x18,
+	0x69,
+	0x10,
+	0x85,
+	0xd7,
+	0xa9,
+	0x00,
+	0x69,
+	0x3c,
+	0x85,
+	0xd8,
+	0xa5,
+	0x87,
+	0x29,
+	0x02,
+	0xf0,
+	0x07,
+	0x18,
+	0xa5,
+	0x74,
+	0xe5,
+	0xbd,
+	0x80,
+	0x02,
+	0xa5,
+	0xbd,
+	0x45,
+	0x7e,
+	0xa8,
+	0xb9,
+	0x47,
+	0x27,
+	0x49,
+	0x04,
+	0x18,
+	0x69,
+	0x2f,
+	0x85,
+	0xd9,
+	0xa9,
+	0x00,
+	0x69,
+	0x3c,
+	0x85,
+	0xda,
+	0x64,
+	0xcb,
+	0xa6,
+	0x73,
+	0x86,
+	0xcc,
+	0x80,
+	0x02,
+	0xe6,
+	0xcb,
+	0x20,
+	0xb6,
+	0x1d,
+	0xc6,
+	0xcc,
+	0xd0,
+	0xf7,
+	0xe6,
+	0xbd,
+	0x60,
+	0x64,
+	0xd1,
+	0x64,
+	0xd2,
+	0xa2,
+	0x10,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0xa5,
+	0xd1,
+	0x38,
+	0xe5,
+	0xcb,
+	0xa8,
+	0xa5,
+	0xd2,
+	0xe9,
+	0x00,
+	0x90,
+	0x06,
+	0x85,
+	0xd2,
+	0x84,
+	0xd1,
+	0xe6,
+	0xcf,
+	0xca,
+	0xd0,
+	0xe3,
+	0x60,
+	0x18,
+	0xa5,
+	0xcf,
+	0x65,
+	0xd3,
+	0x85,
+	0xd3,
+	0xa2,
+	0x00,
+	0xa5,
+	0xd0,
+	0x10,
+	0x02,
+	0xa2,
+	0xff,
+	0x86,
+	0xcb,
+	0x65,
+	0xd4,
+	0x85,
+	0xd4,
+	0xa5,
+	0xd5,
+	0x65,
+	0xcb,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd6,
+	0x65,
+	0xcb,
+	0x85,
+	0xd6,
+	0x60,
+	0xa5,
+	0xcf,
+	0x45,
+	0xd1,
+	0x85,
+	0xd3,
+	0x84,
+	0xd4,
+	0xa5,
+	0xcf,
+	0x45,
+	0xd2,
+	0x18,
+	0x65,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0x69,
+	0x00,
+	0x85,
+	0xd5,
+	0x64,
+	0xd6,
+	0xa5,
+	0xd0,
+	0x45,
+	0xd1,
+	0x18,
+	0x65,
+	0xd4,
+	0x85,
+	0xd4,
+	0x98,
+	0x65,
+	0xd5,
+	0x85,
+	0xd5,
+	0x90,
+	0x02,
+	0xe6,
+	0xd6,
+	0xa5,
+	0xd0,
+	0x45,
+	0xd2,
+	0x18,
+	0x65,
+	0xd5,
+	0x85,
+	0xd5,
+	0x98,
+	0x65,
+	0xd6,
+	0x85,
+	0xd6,
+	0x60,
+	0x20,
+	0x04,
+	0x21,
+	0xa5,
+	0xd2,
+	0x10,
+	0x0d,
+	0x38,
+	0xa5,
+	0xd5,
+	0xe5,
+	0xcf,
+	0x85,
+	0xd5,
+	0xa5,
+	0xd6,
+	0xe5,
+	0xd0,
+	0x85,
+	0xd6,
+	0x60,
+	0xfc,
+	0x49,
+	0x20,
+	0x98,
+	0x4a,
+	0x69,
+	0x00,
+	0x85,
+	0xcb,
+	0x8a,
+	0x49,
+	0x10,
+	0xc0,
+	0x00,
+	0xd0,
+	0x09,
+	0x18,
+	0x65,
+	0xcb,
+	0xb0,
+	0x04,
+	0xc9,
+	0x7f,
+	0x90,
+	0x02,
+	0xa9,
+	0x7f,
+	0x60,
+	0xfc,
+	0x49,
+	0x10,
+	0x98,
+	0x4a,
+	0x69,
+	0x00,
+	0x85,
+	0xcb,
+	0x8a,
+	0x49,
+	0x08,
+	0x18,
+	0x65,
+	0xcb,
+	0xd0,
+	0x01,
+	0x3a,
+	0x60,
+	0x20,
+	0xa6,
+	0x21,
+	0x46,
+	0xd0,
+	0x66,
+	0xcf,
+	0x90,
+	0x06,
+	0xe6,
+	0xcf,
+	0xd0,
+	0x02,
+	0xe6,
+	0xd0,
+	0x38,
+	0xa5,
+	0xd1,
+	0xe5,
+	0xcf,
+	0xa5,
+	0xd2,
+	0xe5,
+	0xd0,
+	0x30,
+	0x0a,
+	0xe6,
+	0xd3,
+	0xd0,
+	0x06,
+	0xe6,
+	0xd4,
+	0xd0,
+	0x02,
+	0xe6,
+	0xd5,
+	0x60,
+	0x64,
+	0xd1,
+	0x64,
+	0xd2,
+	0x64,
+	0xcb,
+	0xa2,
+	0x18,
+	0x06,
+	0xd3,
+	0x26,
+	0xd4,
+	0x26,
+	0xd5,
+	0x26,
+	0xd1,
+	0x26,
+	0xd2,
+	0x26,
+	0xcb,
+	0xa5,
+	0xd1,
+	0x38,
+	0xe5,
+	0xcf,
+	0xa8,
+	0xa5,
+	0xd2,
+	0xe5,
+	0xd0,
+	0x85,
+	0xcc,
+	0xa5,
+	0xcb,
+	0xe9,
+	0x00,
+	0x90,
+	0x0a,
+	0x85,
+	0xcb,
+	0xa5,
+	0xcc,
+	0x85,
+	0xd2,
+	0x84,
+	0xd1,
+	0xe6,
+	0xd3,
+	0xca,
+	0xd0,
+	0xd5,
+	0x60,
+	0xa9,
+	0x00,
+	0xaa,
+	0x38,
+	0xe5,
+	0xd3,
+	0x85,
+	0xd3,
+	0x8a,
+	0xe5,
+	0xd4,
+	0x85,
+	0xd4,
+	0x8a,
+	0xe5,
+	0xd5,
+	0x85,
+	0xd5,
+	0x8a,
+	0xe5,
+	0xd6,
+	0x85,
+	0xd6,
+	0x8a,
+	0x38,
+	0xe5,
+	0xd7,
+	0x85,
+	0xd7,
+	0x8a,
+	0xe5,
+	0xd8,
+	0x85,
+	0xd8,
+	0x8a,
+	0xe5,
+	0xd9,
+	0x85,
+	0xd9,
+	0x8a,
+	0xe5,
+	0xda,
+	0x85,
+	0xda,
+	0x60,
+	0xa5,
+	0xd6,
+	0x05,
+	0xda,
+	0xf0,
+	0x2b,
+	0x38,
+	0xa5,
+	0xd6,
+	0xe5,
+	0xda,
+	0x30,
+	0x04,
+	0xa5,
+	0xd6,
+	0x80,
+	0x11,
+	0xa5,
+	0xda,
+	0x80,
+	0x0d,
+	0x26,
+	0xd4,
+	0x26,
+	0xd5,
+	0x26,
+	0xd6,
+	0x26,
+	0xd8,
+	0x26,
+	0xd9,
+	0x26,
+	0xda,
+	0x0a,
+	0x10,
+	0xf1,
+	0xa0,
+	0x02,
+	0x53,
+	0xd5,
+	0x00,
+	0xcf,
+	0x00,
+	0x53,
+	0xd9,
+	0x00,
+	0xd1,
+	0x00,
+	0x60,
+	0xa5,
+	0xd5,
+	0x05,
+	0xd9,
+	0xf0,
+	0x2b,
+	0x38,
+	0xa5,
+	0xd5,
+	0xe5,
+	0xd9,
+	0x30,
+	0x04,
+	0xa5,
+	0xd5,
+	0x80,
+	0x11,
+	0xa5,
+	0xd9,
+	0x80,
+	0x0d,
+	0x26,
+	0xd3,
+	0x26,
+	0xd4,
+	0x26,
+	0xd5,
+	0x26,
+	0xd7,
+	0x26,
+	0xd8,
+	0x26,
+	0xd9,
+	0x0a,
+	0x10,
+	0xf1,
+	0xa0,
+	0x02,
+	0x53,
+	0xd4,
+	0x00,
+	0xcf,
+	0x00,
+	0x53,
+	0xd8,
+	0x00,
+	0xd1,
+	0x00,
+	0x60,
+	0xa5,
+	0xd4,
+	0x30,
+	0x0e,
+	0xa5,
+	0xd8,
+	0x30,
+	0x0a,
+	0x06,
+	0xd3,
+	0x26,
+	0xd4,
+	0x06,
+	0xd7,
+	0x26,
+	0xd8,
+	0x80,
+	0xee,
+	0xa0,
+	0x02,
+	0x53,
+	0xd3,
+	0x00,
+	0xcf,
+	0x00,
+	0x53,
+	0xd7,
+	0x00,
+	0xd1,
+	0x00,
+	0x60,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0x3d,
+	0x26,
+	0x48,
+	0xf8,
+	0xad,
+	0x08,
+	0x68,
+	0xc9,
+	0x01,
+	0xd0,
+	0x3d,
+	0xa5,
+	0x12,
+	0xf0,
+	0x17,
+	0x64,
+	0x12,
+	0xa5,
+	0x11,
+	0x09,
+	0x03,
+	0x85,
+	0x11,
+	0xa0,
+	0x48,
+	0x53,
+	0x0b,
+	0x02,
+	0x24,
+	0x2b,
+	0xad,
+	0xa4,
+	0x02,
+	0x8d,
+	0x6b,
+	0x2b,
+	0x80,
+	0x15,
+	0xe6,
+	0x12,
+	0xa5,
+	0x11,
+	0x09,
+	0x30,
+	0x85,
+	0x11,
+	0xa0,
+	0x48,
+	0x53,
+	0x0b,
+	0x02,
+	0x6c,
+	0x2b,
+	0xad,
+	0xa4,
+	0x02,
+	0x8d,
+	0xb3,
+	0x2b,
+	0x9c,
+	0x18,
+	0x68,
+	0xee,
+	0x18,
+	0x68,
+	0xa5,
+	0x10,
+	0xd0,
+	0x03,
+	0x20,
+	0xca,
+	0x26,
+	0x4c,
+	0x9f,
+	0x26,
+	0xa9,
+	0x01,
+	0x8d,
+	0x18,
+	0x68,
+	0x68,
+	0x68,
+	0x68,
+	0xa9,
+	0x03,
+	0x48,
+	0xa9,
+	0x00,
+	0x48,
+	0xba,
+	0xda,
+	0x40,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0x3d,
+	0x26,
+	0x48,
+	0xf8,
+	0xad,
+	0x34,
+	0x60,
+	0xaa,
+	0x29,
+	0x03,
+	0xc9,
+	0x02,
+	0xd0,
+	0x0f,
+	0xda,
+	0x64,
+	0x10,
+	0x20,
+	0xca,
+	0x26,
+	0xfa,
+	0xa5,
+	0x7f,
+	0x29,
+	0x02,
+	0xf0,
+	0x07,
+	0x80,
+	0x26,
+	0x8a,
+	0x29,
+	0xf8,
+	0xf0,
+	0x2b,
+	0x8a,
+	0x29,
+	0x04,
+	0x48,
+	0x4a,
+	0x4a,
+	0x20,
+	0x47,
+	0x20,
+	0xa5,
+	0xbc,
+	0xf0,
+	0x13,
+	0xc6,
+	0xbc,
+	0x68,
+	0xd0,
+	0x07,
+	0xa9,
+	0x09,
+	0x8d,
+	0x38,
+	0x60,
+	0x80,
+	0x31,
+	0xa9,
+	0x0d,
+	0x8d,
+	0x38,
+	0x60,
+	0x80,
+	0x2a,
+	0x68,
+	0x20,
+	0x7d,
+	0x1a,
+	0xa9,
+	0x01,
+	0x8d,
+	0x24,
+	0x68,
+	0x80,
+	0x1f,
+	0xa5,
+	0x8c,
+	0xf0,
+	0x1b,
+	0x3a,
+	0x85,
+	0x8c,
+	0x8a,
+	0x29,
+	0x04,
+	0x48,
+	0x4a,
+	0x4a,
+	0x20,
+	0x05,
+	0x1a,
+	0x68,
+	0xd0,
+	0x07,
+	0xa9,
+	0x01,
+	0x8d,
+	0x38,
+	0x60,
+	0x80,
+	0x05,
+	0xa9,
+	0x05,
+	0x8d,
+	0x38,
+	0x60,
+	0x4c,
+	0x9f,
+	0x26,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0x3d,
+	0x26,
+	0x48,
+	0xee,
+	0xa5,
+	0x02,
+	0xd0,
+	0x03,
+	0xee,
+	0xa6,
+	0x02,
+	0xa0,
+	0x4f,
+	0x9c,
+	0x52,
+	0x02,
+	0x13,
+	0x52,
+	0x02,
+	0x53,
+	0x02,
+	0x9c,
+	0x24,
+	0x68,
+	0xee,
+	0x24,
+	0x68,
+	0x64,
+	0x10,
+	0x20,
+	0xca,
+	0x26,
+	0xa9,
+	0x01,
+	0x8d,
+	0x04,
+	0x60,
+	0x4c,
+	0xa6,
+	0x26,
+	0x08,
+	0x78,
+	0x68,
+	0x8a,
+	0x29,
+	0xf0,
+	0xf0,
+	0x09,
+	0x8a,
+	0x29,
+	0x0f,
+	0xf0,
+	0x22,
+	0xa5,
+	0x12,
+	0xd0,
+	0x1e,
+	0x8a,
+	0x29,
+	0xf0,
+	0x85,
+	0x11,
+	0x64,
+	0x14,
+	0x8a,
+	0x29,
+	0x02,
+	0x85,
+	0x15,
+	0xa9,
+	0x28,
+	0x8d,
+	0xae,
+	0x2c,
+	0x64,
+	0x6f,
+	0x64,
+	0x70,
+	0xa0,
+	0x48,
+	0x53,
+	0x24,
+	0x2b,
+	0xb4,
+	0x2b,
+	0x80,
+	0x22,
+	0x8a,
+	0x29,
+	0x0f,
+	0x85,
+	0x11,
+	0xa9,
+	0x01,
+	0x85,
+	0x14,
+	0x8a,
+	0x29,
+	0x20,
+	0x85,
+	0x15,
+	0xa9,
+	0x28,
+	0x8d,
+	0x11,
+	0x2d,
+	0xa9,
+	0x38,
+	0x85,
+	0x6f,
+	0xa9,
+	0x03,
+	0x85,
+	0x70,
+	0xa0,
+	0x48,
+	0x53,
+	0x6c,
+	0x2b,
+	0xb4,
+	0x2b,
+	0x58,
+	0xa5,
+	0x15,
+	0xd0,
+	0x38,
+	0xa0,
+	0x70,
+	0xa5,
+	0x14,
+	0xd0,
+	0x0e,
+	0x53,
+	0xbf,
+	0x29,
+	0x9f,
+	0x2a,
+	0xa0,
+	0x63,
+	0x53,
+	0x4c,
+	0x2c,
+	0x65,
+	0x00,
+	0x80,
+	0x0c,
+	0x53,
+	0x2f,
+	0x2a,
+	0x9f,
+	0x2a,
+	0xa0,
+	0x63,
+	0x53,
+	0xaf,
+	0x2c,
+	0x65,
+	0x00,
+	0xa5,
+	0x72,
+	0xcd,
+	0xa8,
+	0x02,
+	0xd0,
+	0x0b,
+	0xa5,
+	0x71,
+	0xcd,
+	0xa7,
+	0x02,
+	0xd0,
+	0x04,
+	0xa9,
+	0x00,
+	0x80,
+	0x02,
+	0xa9,
+	0x01,
+	0x85,
+	0x7c,
+	0xa5,
+	0x15,
+	0x20,
+	0x1b,
+	0x04,
+	0x85,
+	0xc7,
+	0xf0,
+	0x03,
+	0x4c,
+	0xa5,
+	0x24,
+	0x64,
+	0x8d,
+	0x64,
+	0xbd,
+	0xa0,
+	0x02,
+	0x53,
+	0x6f,
+	0x00,
+	0x30,
+	0x60,
+	0xa9,
+	0x00,
+	0x8d,
+	0x0c,
+	0x60,
+	0x9c,
+	0x0d,
+	0x60,
+	0xa5,
+	0x73,
+	0x0a,
+	0xa8,
+	0x43,
+	0x9f,
+	0x2a,
+	0x54,
+	0x60,
+	0xa9,
+	0x20,
+	0x8d,
+	0x0c,
+	0x60,
+	0x9c,
+	0x0d,
+	0x60,
+	0xa5,
+	0x74,
+	0x0a,
+	0xa8,
+	0x43,
+	0xbf,
+	0x2a,
+	0x54,
+	0x60,
+	0xa5,
+	0x74,
+	0x85,
+	0x8c,
+	0x3a,
+	0x85,
+	0xbc,
+	0xa9,
+	0x02,
+	0x48,
+	0x20,
+	0x05,
+	0x1a,
+	0x68,
+	0xc6,
+	0x8c,
+	0xf0,
+	0x03,
+	0x3a,
+	0xd0,
+	0xf4,
+	0xa5,
+	0x14,
+	0xd0,
+	0x20,
+	0xa0,
+	0x93,
+	0x53,
+	0x18,
+	0x29,
+	0xf2,
+	0x27,
+	0xa0,
+	0x07,
+	0x53,
+	0x1d,
+	0x2b,
+	0x0f,
+	0x2b,
+	0xa0,
+	0x70,
+	0x53,
+	0x9f,
+	0x2a,
+	0xbf,
+	0x29,
+	0xa0,
+	0x63,
+	0x53,
+	0x65,
+	0x00,
+	0x4c,
+	0x2c,
+	0xa2,
+	0x00,
+	0x80,
+	0x38,
+	0xa0,
+	0x93,
+	0x53,
+	0x18,
+	0x29,
+	0x85,
+	0x28,
+	0xa0,
+	0x07,
+	0x53,
+	0x1d,
+	0x2b,
+	0x16,
+	0x2b,
+	0xa0,
+	0x70,
+	0x53,
+	0x9f,
+	0x2a,
+	0x2f,
+	0x2a,
+	0xa0,
+	0x63,
+	0x53,
+	0x65,
+	0x00,
+	0xaf,
+	0x2c,
+	0xa2,
+	0x01,
+	0x80,
+	0x18,
+	0xa6,
+	0x14,
+	0xd0,
+	0x0b,
+	0xa0,
+	0x63,
+	0x53,
+	0x65,
+	0x00,
+	0x4c,
+	0x2c,
+	0xa2,
+	0x00,
+	0x80,
+	0x09,
+	0xa0,
+	0x63,
+	0x53,
+	0x65,
+	0x00,
+	0xaf,
+	0x2c,
+	0xa2,
+	0x01,
+	0xa5,
+	0x15,
+	0xf0,
+	0x04,
+	0x86,
+	0x13,
+	0x64,
+	0x15,
+	0x9c,
+	0x1c,
+	0x68,
+	0xee,
+	0x1c,
+	0x68,
+	0x60,
+	0xf8,
+	0xa6,
+	0x11,
+	0xda,
+	0xa6,
+	0x11,
+	0xf0,
+	0x05,
+	0x20,
+	0x87,
+	0x23,
+	0x80,
+	0xf7,
+	0xfa,
+	0xf0,
+	0x0f,
+	0xad,
+	0xba,
+	0x02,
+	0xf0,
+	0x0a,
+	0xa0,
+	0x02,
+	0x53,
+	0x71,
+	0x00,
+	0x09,
+	0x02,
+	0x20,
+	0x06,
+	0x25,
+	0x9c,
+	0xe9,
+	0x27,
+	0x4c,
+	0xbc,
+	0x26,
+	0x5a,
+	0xda,
+	0x48,
+	0x20,
+	0x3d,
+	0x26,
+	0x48,
+	0xf8,
+	0xad,
+	0x0c,
+	0x68,
+	0xc9,
+	0x01,
+	0xd0,
+	0x03,
+	0x20,
+	0x06,
+	0x25,
+	0x4c,
+	0x9f,
+	0x26,
+	0x9c,
+	0x20,
+	0x68,
+	0x9c,
+	0x24,
+	0x68,
+	0x9c,
+	0x28,
+	0x68,
+	0xa2,
+	0x00,
+	0xad,
+	0x0a,
+	0x02,
+	0xcd,
+	0x59,
+	0x2c,
+	0xd0,
+	0x09,
+	0xad,
+	0x09,
+	0x02,
+	0xcd,
+	0x58,
+	0x2c,
+	0xd0,
+	0x01,
+	0xe8,
+	0xad,
+	0x0a,
+	0x02,
+	0xcd,
+	0xbc,
+	0x2c,
+	0xd0,
+	0x0a,
+	0xad,
+	0x09,
+	0x02,
+	0xcd,
+	0xbb,
+	0x2c,
+	0xd0,
+	0x02,
+	0xe8,
+	0xe8,
+	0xe0,
+	0x00,
+	0xd0,
+	0x06,
+	0xa9,
+	0x04,
+	0x85,
+	0xc7,
+	0x80,
+	0x46,
+	0xe0,
+	0x01,
+	0xf0,
+	0x08,
+	0xe0,
+	0x02,
+	0xf0,
+	0x22,
+	0xa5,
+	0x13,
+	0xd0,
+	0x1e,
+	0xa0,
+	0x63,
+	0x53,
+	0x4c,
+	0x2c,
+	0x65,
+	0x00,
+	0xa0,
+	0x93,
+	0x53,
+	0xf2,
+	0x27,
+	0x18,
+	0x29,
+	0xa0,
+	0x07,
+	0x53,
+	0x0f,
+	0x2b,
+	0x1d,
+	0x2b,
+	0xa0,
+	0x38,
+	0x53,
+	0xf7,
+	0x29,
+	0xd7,
+	0x2a,
+	0x80,
+	0x1c,
+	0xa0,
+	0x63,
+	0x53,
+	0xaf,
+	0x2c,
+	0x65,
+	0x00,
+	0xa0,
+	0x93,
+	0x53,
+	0x85,
+	0x28,
+	0x18,
+	0x29,
+	0xa0,
+	0x07,
+	0x53,
+	0x16,
+	0x2b,
+	0x1d,
+	0x2b,
+	0xa0,
+	0x38,
+	0x53,
+	0x67,
+	0x2a,
+	0xd7,
+	0x2a,
+	0xa5,
+	0x11,
+	0xae,
+	0xae,
+	0x2c,
+	0xe0,
+	0x00,
+	0xf0,
+	0x0c,
+	0xe0,
+	0x28,
+	0xd0,
+	0x0a,
+	0xa6,
+	0x15,
+	0xe0,
+	0x00,
+	0xf0,
+	0x02,
+	0x09,
+	0x03,
+	0x09,
+	0x01,
+	0xae,
+	0x11,
+	0x2d,
+	0xe0,
+	0x00,
+	0xf0,
+	0x0c,
+	0xe0,
+	0x28,
+	0xd0,
+	0x0a,
+	0xa6,
+	0x15,
+	0xe0,
+	0x00,
+	0xf0,
+	0x02,
+	0x09,
+	0x30,
+	0x09,
+	0x10,
+	0x85,
+	0x11,
+	0xa5,
+	0xc7,
+	0xf0,
+	0x0f,
+	0xc9,
+	0x28,
+	0xd0,
+	0x02,
+	0xa9,
+	0x04,
+	0x8d,
+	0x08,
+	0x02,
+	0xa9,
+	0x01,
+	0x8d,
+	0x28,
+	0x68,
+	0x60,
+	0x8d,
+	0x08,
+	0x02,
+	0xa0,
+	0x03,
+	0x53,
+	0x84,
+	0x00,
+	0xb0,
+	0x02,
+	0xa0,
+	0x02,
+	0x53,
+	0x71,
+	0x00,
+	0xa7,
+	0x02,
+	0xa5,
+	0xc5,
+	0x8d,
+	0xbc,
+	0x02,
+	0xa5,
+	0xc6,
+	0x8d,
+	0xbb,
+	0x02,
+	0x20,
+	0x6f,
+	0x18,
+	0xa9,
+	0x02,
+	0x8d,
+	0x38,
+	0x60,
+	0xa9,
+	0x01,
+	0x8d,
+	0x38,
+	0x60,
+	0xa9,
+	0x05,
+	0x8d,
+	0x38,
+	0x60,
+	0xa9,
+	0x09,
+	0x8d,
+	0x38,
+	0x60,
+	0xa5,
+	0x7f,
+	0x29,
+	0x02,
+	0xd0,
+	0x0e,
+	0xa9,
+	0x0d,
+	0x8d,
+	0x38,
+	0x60,
+	0xa0,
+	0x0c,
+	0x64,
+	0x37,
+	0x13,
+	0x37,
+	0x00,
+	0x38,
+	0x00,
+	0x18,
+	0xad,
+	0xa2,
+	0x02,
+	0x69,
+	0x01,
+	0x8d,
+	0xa2,
+	0x02,
+	0xad,
+	0xa3,
+	0x02,
+	0x69,
+	0x00,
+	0x8d,
+	0xa3,
+	0x02,
+	0xa5,
+	0x7a,
+	0x8d,
+	0xad,
+	0x02,
+	0xa5,
+	0x7c,
+	0x8d,
+	0xb3,
+	0x02,
+	0xa0,
+	0x4f,
+	0x9c,
+	0xfc,
+	0x2b,
+	0x13,
+	0xfc,
+	0x2b,
+	0xfd,
+	0x2b,
+	0x9c,
+	0xe9,
+	0x27,
+	0xa9,
+	0x01,
+	0x8d,
+	0x20,
+	0x68,
+	0x85,
+	0x10,
+	0x64,
+	0xc7,
+	0x60,
+	0xba,
+	0x08,
+	0x78,
+	0x68,
+	0x48,
+	0x29,
+	0x1c,
+	0x85,
+	0xca,
+	0x86,
+	0xc8,
+	0xa9,
+	0x01,
+	0x85,
+	0xc9,
+	0xa0,
+	0x06,
+	0xb1,
+	0xc8,
+	0x48,
+	0x29,
+	0x1c,
+	0xc5,
+	0xca,
+	0x90,
+	0x08,
+	0x7a,
+	0xa0,
+	0x09,
+	0xb1,
+	0xc8,
+	0x48,
+	0x29,
+	0x1c,
+	0xc9,
+	0x00,
+	0xd0,
+	0x38,
+	0xa0,
+	0x03,
+	0xb1,
+	0xc8,
+	0xe0,
+	0x7f,
+	0xb0,
+	0x18,
+	0x8d,
+	0xea,
+	0x27,
+	0xc8,
+	0xb1,
+	0xc8,
+	0x8d,
+	0xeb,
+	0x27,
+	0xc8,
+	0xb1,
+	0xc8,
+	0x8d,
+	0xec,
+	0x27,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0xed,
+	0x27,
+	0x80,
+	0x16,
+	0x8d,
+	0xee,
+	0x27,
+	0xc8,
+	0xb1,
+	0xc8,
+	0x8d,
+	0xef,
+	0x27,
+	0xc8,
+	0xb1,
+	0xc8,
+	0x8d,
+	0xf0,
+	0x27,
+	0x8a,
+	0x18,
+	0x69,
+	0x05,
+	0x8d,
+	0xf1,
+	0x27,
+	0xa9,
+	0x00,
+	0xfa,
+	0x28,
+	0xf8,
+	0x60,
+	0x68,
+	0xf0,
+	0x04,
+	0x68,
+	0xfa,
+	0x7a,
+	0x40,
+	0x08,
+	0x78,
+	0x68,
+	0xad,
+	0xe9,
+	0x27,
+	0xf0,
+	0x0e,
+	0xae,
+	0xed,
+	0x27,
+	0x9a,
+	0xad,
+	0xea,
+	0x27,
+	0xae,
+	0xeb,
+	0x27,
+	0xac,
+	0xec,
+	0x27,
+	0x40,
+	0xae,
+	0xf1,
+	0x27,
+	0x9a,
+	0xad,
+	0xee,
+	0x27,
+	0xae,
+	0xef,
+	0x27,
+	0xac,
+	0xf0,
+	0x27,
+	0x40,
+	0x08,
+	0x78,
+	0xad,
+	0xe9,
+	0x27,
+	0xd0,
+	0x1f,
+	0x1a,
+	0x8d,
+	0xe9,
+	0x27,
+	0xa9,
+	0x7c,
+	0x8d,
+	0xed,
+	0x27,
+	0x9c,
+	0xea,
+	0x27,
+	0x9c,
+	0xeb,
+	0x27,
+	0x9c,
+	0xec,
+	0x27,
+	0xa9,
+	0x24,
+	0x8d,
+	0x7f,
+	0x01,
+	0xa9,
+	0xcc,
+	0x8d,
+	0x7e,
+	0x01,
+	0x9c,
+	0x7d,
+	0x01,
+	0x28,
+	0x60,
+	0x64,
+	0xd3,
+	0x64,
+	0xd4,
+	0xa2,
+	0x10,
+	0x06,
+	0xcf,
+	0x26,
+	0xd0,
+	0x26,
+	0xd3,
+	0x26,
+	0xd4,
+	0xa5,
+	0xd3,
+	0x38,
+	0xe5,
+	0xd1,
+	0xa8,
+	0xa5,
+	0xd4,
+	0xe5,
+	0xd2,
+	0x90,
+	0x06,
+	0x85,
+	0xd4,
+	0x84,
+	0xd3,
+	0xe6,
+	0xcf,
+	0xca,
+	0xd0,
+	0xe3,
+	0x60,
+	0x20,
+	0xf2,
+	0x26,
+	0x46,
+	0xd2,
+	0x66,
+	0xd1,
+	0x90,
+	0x06,
+	0xe6,
+	0xd1,
+	0xd0,
+	0x02,
+	0xe6,
+	0xd2,
+	0x38,
+	0xa5,
+	0xd3,
+	0xe5,
+	0xd1,
+	0xa5,
+	0xd4,
+	0xe5,
+	0xd2,
+	0x30,
+	0x06,
+	0xe6,
+	0xcf,
+	0xd0,
+	0x02,
+	0xe6,
+	0xd0,
+	0x60,
+	0x00,
+	0x01,
+	0x02,
+	0x03,
+	0x04,
+	0x05,
+	0x06,
+	0x07,
+	0x07,
+	0x06,
+	0x05,
+	0x04,
+	0x03,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x01,
+	0x02,
+	0x03,
+	0x04,
+	0x05,
+	0x05,
+	0x04,
+	0x03,
+	0x02,
+	0x01,
+	0x00,
+	0x00,
+	0x00,
+	0x01,
+	0x81,
+	0x02,
+	0x42,
+	0x82,
+	0xc2,
+	0x03,
+	0x23,
+	0x43,
+	0x63,
+	0x83,
+	0xa3,
+	0xc3,
+	0xe3,
+	0x04,
+	0x14,
+	0x24,
+	0x34,
+	0x44,
+	0x54,
+	0x64,
+	0x74,
+	0x84,
+	0x94,
+	0xa4,
+	0xb4,
+	0xc4,
+	0xd4,
+	0xe4,
+	0xf4,
+	0x05,
+	0x05,
+	0x15,
+	0x15,
+	0x25,
+	0x25,
+	0x35,
+	0x35,
+	0x45,
+	0x45,
+	0x55,
+	0x55,
+	0x65,
+	0x65,
+	0x75,
+	0x75,
+	0x85,
+	0x85,
+	0x95,
+	0x95,
+	0xa5,
+	0xa5,
+	0xb5,
+	0xb5,
+	0xc5,
+	0xc5,
+	0xd5,
+	0xd5,
+	0xe5,
+	0xe5,
+	0xf5,
+	0xf5,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x3f,
+	0x39,
+	0x33,
+	0x2f,
+	0x2b,
+	0x27,
+	0x25,
+	0x22,
+	0x20,
+	0x1e,
+	0x1c,
+	0x1b,
+	0x1a,
+	0x18,
+	0x17,
+	0x16,
+	0x15,
+	0x14,
+	0x14,
+	0x13,
+	0x12,
+	0x12,
+	0x11,
+	0x11,
+	0x10,
+	0x10,
+	0x0f,
+	0x0f,
+	0x0e,
+	0x0e,
+	0x0d,
+	0x0d,
+	0x0d,
+	0x0c,
+	0x0c,
+	0x0c,
+	0x0c,
+	0x0b,
+	0x0b,
+	0x0b,
+	0x0b,
+	0x0a,
+	0x0a,
+	0x0a,
+	0x0a,
+	0x0a,
+	0x09,
+	0x09,
+	0x09,
+	0x09,
+	0x09,
+	0x09,
+	0x09,
+	0x08,
+	0x08,
+	0x08,
+};
+
+struct yushan_reg_u_code_t yushan_u_code_r2 = {
+	.pdpcode_first_addr = 0x0234,
+	.pdpcode = &pdpcode_u_1_7[0],
+	.pdpcode_size = ARRAY_SIZE(pdpcode_u_1_7),
+
+	.pdpBootAddr  = 0x1a00,
+	.pdpStartAddr = 0x0234,
+
+	.dppcode_first_addr = 0x0300,
+	.dppcode = &dppcode_u_1_7[0],
+	.dppcode_size = ARRAY_SIZE(dppcode_u_1_7),
+
+	.dppBootAddr  = 0xd000,
+	.dppStartAddr = 0x0300,
+
+	.dopcode_first_addr = 0x0300,
+	.dopcode = &dopcode_u_1_7[0],
+	.dopcode_size = ARRAY_SIZE(dopcode_u_1_7),
+
+	.dopBootAddr  = 0x6800,
+	.dopStartAddr = 0x0300,
+
+
+};
+
diff --git a/drivers/media/video/msm/rawchip/yushan_u_code_r3.c b/drivers/media/video/msm/rawchip/yushan_u_code_r3.c
new file mode 100644
index 0000000..1a785eb
--- /dev/null
+++ b/drivers/media/video/msm/rawchip/yushan_u_code_r3.c
@@ -0,0 +1,36251 @@
+/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
+
+#include <linux/kernel.h>
+#include "Yushan_HTC_Functions.h"
+
+uint8_t pdpcode_u_1_8[] =
+{
+0x78,
+0xa2,
+0xff,
+0x9a,
+0x9c,
+0x14,
+0x1a,
+0x9c,
+0x18,
+0x1a,
+0x9c,
+0x20,
+0x1a,
+0x9c,
+0x24,
+0x1a,
+0x64,
+0x00,
+0xa0,
+0xff,
+0x13,
+0x00,
+0x00,
+0x01,
+0x00,
+0x13,
+0x00,
+0x00,
+0x00,
+0x01,
+0xa0,
+0x34,
+0x13,
+0x00,
+0x00,
+0x00,
+0x02,
+0xb8,
+0xa0,
+0x04,
+0x53,
+0xa1,
+0x0d,
+0x00,
+0x02,
+0xa0,
+0x03,
+0x53,
+0xd7,
+0x0d,
+0x04,
+0x02,
+0xa9,
+0x01,
+0x8d,
+0x07,
+0x02,
+0xcd,
+0xd9,
+0x0d,
+0xf0,
+0x04,
+0xa2,
+0x03,
+0x80,
+0x10,
+0xa2,
+0x02,
+0xad,
+0x00,
+0x18,
+0xc9,
+0x5b,
+0xd0,
+0x07,
+0xad,
+0x01,
+0x18,
+0xc9,
+0xe6,
+0xf0,
+0x08,
+0x8e,
+0x08,
+0x02,
+0xee,
+0x14,
+0x1a,
+0x80,
+0x18,
+0xa0,
+0x0e,
+0x53,
+0x93,
+0x0d,
+0x02,
+0x00,
+0xa9,
+0x04,
+0x85,
+0xa0,
+0x85,
+0xbf,
+0xa0,
+0x05,
+0x53,
+0xa5,
+0x0d,
+0x2e,
+0x02,
+0x58,
+0xee,
+0x14,
+0x1a,
+0x5c,
+0x80,
+0xfd,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xde,
+0x0c,
+0x48,
+0xa9,
+0x01,
+0xa0,
+0x34,
+0xa6,
+0xcf,
+0xf0,
+0x0b,
+0x53,
+0x00,
+0x02,
+0x35,
+0x01,
+0x8d,
+0x69,
+0x01,
+0x3a,
+0x80,
+0x08,
+0x53,
+0x00,
+0x02,
+0x00,
+0x01,
+0x8d,
+0x34,
+0x01,
+0x85,
+0xcf,
+0x9c,
+0x08,
+0x02,
+0x9c,
+0x18,
+0x1a,
+0xee,
+0x18,
+0x1a,
+0x20,
+0x6b,
+0x0d,
+0x4c,
+0x40,
+0x0d,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xde,
+0x0c,
+0x48,
+0xad,
+0x34,
+0x18,
+0x29,
+0x03,
+0xc9,
+0x02,
+0xd0,
+0x0e,
+0x9c,
+0x24,
+0x1a,
+0xee,
+0x24,
+0x1a,
+0xad,
+0x33,
+0x02,
+0xf0,
+0x03,
+0x20,
+0x6b,
+0x0d,
+0x4c,
+0x40,
+0x0d,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xde,
+0x0c,
+0x48,
+0x9c,
+0x24,
+0x1a,
+0xee,
+0x24,
+0x1a,
+0x4c,
+0x40,
+0x0d,
+0x40,
+0xb9,
+0x28,
+0x00,
+0xd0,
+0x4d,
+0xb9,
+0x27,
+0x00,
+0xc9,
+0x08,
+0xb0,
+0x46,
+0x1a,
+0x4a,
+0xb0,
+0x3f,
+0x85,
+0xeb,
+0x98,
+0x4a,
+0xa8,
+0xb9,
+0x1d,
+0x00,
+0x4a,
+0xb0,
+0x40,
+0xb9,
+0x21,
+0x00,
+0xaa,
+0x4a,
+0x90,
+0x36,
+0x8a,
+0xf9,
+0xda,
+0x0d,
+0xb9,
+0x22,
+0x00,
+0xf9,
+0xdb,
+0x0d,
+0xb0,
+0x27,
+0x8a,
+0xf9,
+0x1d,
+0x00,
+0xaa,
+0xb9,
+0x22,
+0x00,
+0xf9,
+0x1e,
+0x00,
+0x90,
+0x23,
+0xe8,
+0xd0,
+0x01,
+0x1a,
+0xa4,
+0xeb,
+0x20,
+0xff,
+0x0a,
+0xe8,
+0xd0,
+0x01,
+0x1a,
+0x4a,
+0xa8,
+0x8a,
+0x6a,
+0xa2,
+0x00,
+0x60,
+0xa2,
+0x15,
+0x60,
+0xa9,
+0x13,
+0x60,
+0xa2,
+0x0b,
+0x60,
+0xa2,
+0x0f,
+0x60,
+0xa2,
+0x0d,
+0x60,
+0xa2,
+0x11,
+0x60,
+0xf8,
+0xa5,
+0xcf,
+0x85,
+0xf7,
+0xa0,
+0x34,
+0xa5,
+0xf7,
+0xd0,
+0x12,
+0xad,
+0x69,
+0x01,
+0xd0,
+0x03,
+0x4c,
+0x25,
+0x04,
+0x53,
+0x35,
+0x01,
+0x10,
+0x00,
+0x9c,
+0x69,
+0x01,
+0x80,
+0x10,
+0xad,
+0x34,
+0x01,
+0xd0,
+0x03,
+0x4c,
+0x25,
+0x04,
+0x53,
+0x00,
+0x01,
+0x10,
+0x00,
+0x9c,
+0x34,
+0x01,
+0x64,
+0x63,
+0xa0,
+0x00,
+0x20,
+0x0e,
+0x03,
+0xf0,
+0x07,
+0x64,
+0x45,
+0x64,
+0x46,
+0x8a,
+0x80,
+0x59,
+0x85,
+0x45,
+0x84,
+0x46,
+0xa0,
+0x04,
+0x20,
+0x0e,
+0x03,
+0xf0,
+0x08,
+0x8a,
+0x1a,
+0x80,
+0x4a,
+0xa9,
+0x21,
+0x80,
+0x46,
+0x85,
+0x47,
+0x84,
+0x48,
+0x38,
+0xa5,
+0x2e,
+0xed,
+0xdf,
+0x0d,
+0xa5,
+0x2f,
+0xed,
+0xe0,
+0x0d,
+0x90,
+0xeb,
+0xad,
+0xe1,
+0x0d,
+0xe5,
+0x2e,
+0xad,
+0xe2,
+0x0d,
+0xe5,
+0x2f,
+0x90,
+0xdf,
+0xa0,
+0x02,
+0x53,
+0x2e,
+0x00,
+0xe6,
+0x00,
+0x20,
+0x1c,
+0x0c,
+0xa0,
+0x02,
+0x53,
+0xe6,
+0x00,
+0x2e,
+0x00,
+0xa5,
+0x1b,
+0xaa,
+0x29,
+0x01,
+0xd0,
+0x04,
+0xa2,
+0x38,
+0x86,
+0x1b,
+0x20,
+0x50,
+0x06,
+0xd0,
+0x08,
+0x20,
+0x6b,
+0x09,
+0xd0,
+0x03,
+0x20,
+0x0b,
+0x0a,
+0x85,
+0x63,
+0xa0,
+0x1f,
+0xa2,
+0x04,
+0xa5,
+0xf7,
+0xf0,
+0x09,
+0x86,
+0xbf,
+0x53,
+0x45,
+0x00,
+0xa1,
+0x00,
+0x80,
+0x07,
+0x86,
+0xa0,
+0x53,
+0x45,
+0x00,
+0x82,
+0x00,
+0x9c,
+0x1c,
+0x1a,
+0xee,
+0x1c,
+0x1a,
+0x18,
+0xad,
+0x69,
+0x01,
+0x6d,
+0x34,
+0x01,
+0xf0,
+0x0a,
+0xa5,
+0xf7,
+0x3a,
+0x29,
+0x01,
+0x85,
+0xf7,
+0x4c,
+0x74,
+0x03,
+0x9c,
+0x6a,
+0x01,
+0xad,
+0x33,
+0x02,
+0xf0,
+0x10,
+0xa0,
+0x02,
+0x53,
+0x45,
+0x00,
+0x09,
+0x02,
+0x0e,
+0x09,
+0x02,
+0x2e,
+0x0a,
+0x02,
+0x20,
+0x6d,
+0x04,
+0x4c,
+0x5d,
+0x0d,
+0xa9,
+0x01,
+0xc4,
+0xf5,
+0xd0,
+0x04,
+0xe4,
+0xf4,
+0xf0,
+0x01,
+0x1a,
+0x3a,
+0x60,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xde,
+0x0c,
+0x48,
+0x20,
+0x6d,
+0x04,
+0x4c,
+0x40,
+0x0d,
+0xad,
+0x0a,
+0x02,
+0x4a,
+0x85,
+0xf5,
+0xad,
+0x09,
+0x02,
+0x6a,
+0xb0,
+0x46,
+0x85,
+0xf4,
+0x64,
+0xe4,
+0xa4,
+0x83,
+0xa6,
+0x82,
+0x20,
+0x53,
+0x04,
+0xd0,
+0x02,
+0xe6,
+0xe4,
+0xa4,
+0xa2,
+0xa6,
+0xa1,
+0x20,
+0x53,
+0x04,
+0xd0,
+0x04,
+0xe6,
+0xe4,
+0xe6,
+0xe4,
+0xa5,
+0xe4,
+0xf0,
+0x26,
+0xa0,
+0x1e,
+0xc9,
+0x01,
+0xf0,
+0x07,
+0x4a,
+0x90,
+0x0f,
+0xa5,
+0xcf,
+0xd0,
+0x0b,
+0xa5,
+0xa0,
+0xd0,
+0x17,
+0x53,
+0x82,
+0x00,
+0x64,
+0x00,
+0x80,
+0x09,
+0xa5,
+0xbf,
+0xd0,
+0x0c,
+0x53,
+0xa1,
+0x00,
+0x64,
+0x00,
+0x20,
+0xf8,
+0x04,
+0x80,
+0x02,
+0xa9,
+0x05,
+0x8d,
+0x08,
+0x02,
+0xa2,
+0x28,
+0xa8,
+0xd0,
+0x0a,
+0xee,
+0x31,
+0x02,
+0xd0,
+0x03,
+0xee,
+0x32,
+0x02,
+0xa2,
+0x20,
+0x9e,
+0x00,
+0x1a,
+0xfe,
+0x00,
+0x1a,
+0x60,
+0x8d,
+0x50,
+0x18,
+0x8e,
+0x50,
+0x18,
+0xd0,
+0x01,
+0xca,
+0x3a,
+0x99,
+0x00,
+0x18,
+0x48,
+0x8a,
+0x99,
+0x01,
+0x18,
+0x68,
+0x0a,
+0x1a,
+0x8d,
+0x50,
+0x18,
+0x8a,
+0x2a,
+0x8d,
+0x50,
+0x18,
+0x60,
+0xa0,
+0x01,
+0x8c,
+0x04,
+0x18,
+0x8c,
+0x10,
+0x18,
+0x53,
+0x7d,
+0x00,
+0x78,
+0x18,
+0x53,
+0x7c,
+0x00,
+0x7c,
+0x18,
+0x53,
+0x7b,
+0x00,
+0x80,
+0x18,
+0x53,
+0x7a,
+0x00,
+0x84,
+0x18,
+0x53,
+0x7e,
+0x00,
+0x88,
+0x18,
+0x53,
+0x7f,
+0x00,
+0x8c,
+0x18,
+0x53,
+0x80,
+0x00,
+0x90,
+0x18,
+0xa5,
+0x81,
+0x8d,
+0x94,
+0x18,
+0x8d,
+0x14,
+0x18,
+0xc8,
+0x53,
+0x68,
+0x00,
+0x54,
+0x18,
+0x53,
+0x6a,
+0x00,
+0x58,
+0x18,
+0x53,
+0x6c,
+0x00,
+0x5c,
+0x18,
+0x53,
+0x6e,
+0x00,
+0x60,
+0x18,
+0x53,
+0x70,
+0x00,
+0x68,
+0x18,
+0x53,
+0x72,
+0x00,
+0x64,
+0x18,
+0x53,
+0x76,
+0x00,
+0x6c,
+0x18,
+0x53,
+0x74,
+0x00,
+0x70,
+0x18,
+0x53,
+0x78,
+0x00,
+0x74,
+0x18,
+0x9c,
+0x3c,
+0x18,
+0x13,
+0x3c,
+0x18,
+0x28,
+0x18,
+0x13,
+0x3c,
+0x18,
+0x2c,
+0x18,
+0x9c,
+0x30,
+0x18,
+0x9c,
+0x20,
+0x18,
+0x9c,
+0x24,
+0x18,
+0x9c,
+0x0c,
+0x18,
+0x9c,
+0x0d,
+0x18,
+0xa0,
+0x18,
+0xa6,
+0x65,
+0xa5,
+0x64,
+0x20,
+0xda,
+0x04,
+0xa9,
+0x04,
+0x8d,
+0x0c,
+0x18,
+0x9c,
+0x0d,
+0x18,
+0xa0,
+0x1c,
+0xa6,
+0x67,
+0xa5,
+0x66,
+0x20,
+0xda,
+0x04,
+0xa0,
+0x03,
+0x43,
+0xaa,
+0x0d,
+0x38,
+0x18,
+0xa9,
+0x00,
+0x60,
+0x20,
+0xa5,
+0x05,
+0xe0,
+0x00,
+0xf0,
+0x04,
+0x1a,
+0xd0,
+0x01,
+0xc8,
+0x60,
+0x85,
+0xea,
+0x45,
+0xec,
+0x84,
+0xeb,
+0xaa,
+0xa5,
+0xed,
+0x45,
+0xea,
+0x18,
+0x65,
+0xeb,
+0x90,
+0x01,
+0xc8,
+0x60,
+0x18,
+0x65,
+0xee,
+0x85,
+0xee,
+0x98,
+0x65,
+0xef,
+0x85,
+0xef,
+0x38,
+0xa5,
+0xee,
+0xe9,
+0xff,
+0xa5,
+0xef,
+0xe9,
+0x07,
+0x90,
+0x08,
+0xa9,
+0xff,
+0x85,
+0xee,
+0xa9,
+0x07,
+0x85,
+0xef,
+0x60,
+0x38,
+0xa5,
+0xee,
+0xe5,
+0xec,
+0x85,
+0xee,
+0xa5,
+0xef,
+0xe5,
+0xed,
+0x85,
+0xef,
+0xb0,
+0x04,
+0x64,
+0xee,
+0x64,
+0xef,
+0x60,
+0xa5,
+0xee,
+0x0a,
+0x85,
+0xec,
+0xa5,
+0xef,
+0x2a,
+0x85,
+0xed,
+0x60,
+0x20,
+0xe9,
+0x05,
+0xa5,
+0xf2,
+0xd0,
+0x05,
+0xa6,
+0xf3,
+0xd0,
+0x0b,
+0x60,
+0x20,
+0x99,
+0x05,
+0x85,
+0xec,
+0x84,
+0xed,
+0x4c,
+0xd5,
+0x05,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0xec,
+0x85,
+0xec,
+0xa9,
+0x04,
+0xe5,
+0xed,
+0x85,
+0xed,
+0x8a,
+0x20,
+0x99,
+0x05,
+0x4c,
+0xb7,
+0x05,
+0x20,
+0xe9,
+0x05,
+0xa6,
+0xf2,
+0xd0,
+0x05,
+0xa6,
+0xf3,
+0xd0,
+0x15,
+0x60,
+0x38,
+0xa9,
+0xfe,
+0xe5,
+0xec,
+0x85,
+0xec,
+0xa9,
+0x0f,
+0xe5,
+0xed,
+0x85,
+0xed,
+0x8a,
+0x20,
+0xa5,
+0x05,
+0x4c,
+0xb7,
+0x05,
+0x38,
+0xa5,
+0xed,
+0xe9,
+0x04,
+0x85,
+0xed,
+0x8a,
+0x20,
+0xa5,
+0x05,
+0x85,
+0xec,
+0x84,
+0xed,
+0x4c,
+0xd5,
+0x05,
+0xa5,
+0x2d,
+0xd0,
+0x02,
+0xa9,
+0x11,
+0xaa,
+0x49,
+0x10,
+0xc0,
+0x05,
+0x90,
+0x03,
+0xa9,
+0x1e,
+0x60,
+0x84,
+0xd2,
+0x8a,
+0x29,
+0x0f,
+0xc9,
+0x05,
+0xb0,
+0xf4,
+0x45,
+0xd2,
+0xaa,
+0xbd,
+0xc5,
+0x0d,
+0x85,
+0xd2,
+0x64,
+0xe3,
+0x38,
+0xad,
+0x2d,
+0x0f,
+0xe5,
+0xd2,
+0xb0,
+0x02,
+0xe6,
+0xe3,
+0x64,
+0xc2,
+0x64,
+0xc3,
+0xa0,
+0x02,
+0x53,
+0x2e,
+0x00,
+0xc0,
+0x00,
+0x53,
+0x34,
+0x00,
+0xd0,
+0x00,
+0x20,
+0x58,
+0x0b,
+0xa5,
+0xc4,
+0x10,
+0x0a,
+0xe6,
+0xc5,
+0xd0,
+0x06,
+0xe6,
+0xc6,
+0xd0,
+0x02,
+0xe6,
+0xc7,
+0xa5,
+0xc7,
+0xf0,
+0x06,
+0xa9,
+0xff,
+0x85,
+0xc5,
+0x85,
+0xc6,
+0xa0,
+0x02,
+0x53,
+0xc5,
+0x00,
+0xcd,
+0x00,
+0x53,
+0xcd,
+0x00,
+0xe8,
+0x00,
+0xa2,
+0x2e,
+0xa0,
+0x0f,
+0xa9,
+0x04,
+0x20,
+0x3c,
+0x0a,
+0x84,
+0xd3,
+0xa5,
+0xe3,
+0x49,
+0x24,
+0x85,
+0xc8,
+0xa5,
+0xd3,
+0x49,
+0x06,
+0x18,
+0x65,
+0xc8,
+0x85,
+0xc8,
+0xc0,
+0x04,
+0xf0,
+0x10,
+0x38,
+0xb9,
+0xfc,
+0x0f,
+0xe5,
+0xcd,
+0xc8,
+0xb9,
+0xfc,
+0x0f,
+0xc8,
+0xe5,
+0xce,
+0x90,
+0xed,
+0x88,
+0x98,
+0x4a,
+0xa8,
+0xb9,
+0x3e,
+0x00,
+0x85,
+0xf2,
+0xa9,
+0x80,
+0x38,
+0xe5,
+0xf2,
+0x85,
+0xf2,
+0xb0,
+0x0b,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0xf2,
+0x64,
+0xf2,
+0x85,
+0xf3,
+0x80,
+0x02,
+0x64,
+0xf3,
+0xa9,
+0x0c,
+0x85,
+0xcc,
+0xa4,
+0xd3,
+0xa2,
+0x00,
+0xb9,
+0x2e,
+0x0f,
+0x95,
+0xe6,
+0xe8,
+0xc8,
+0xe0,
+0x04,
+0x90,
+0xf5,
+0x18,
+0xa5,
+0xc8,
+0x69,
+0x34,
+0x85,
+0xc8,
+0xa9,
+0x0f,
+0x90,
+0x01,
+0x1a,
+0x85,
+0xc9,
+0xa5,
+0xe3,
+0x49,
+0x40,
+0x85,
+0xca,
+0xa5,
+0xd3,
+0x49,
+0x10,
+0x18,
+0x65,
+0xca,
+0x69,
+0x7c,
+0x85,
+0xca,
+0xa9,
+0x0f,
+0x90,
+0x01,
+0x1a,
+0x85,
+0xcb,
+0x20,
+0x88,
+0x0a,
+0x20,
+0xf4,
+0x05,
+0xa0,
+0x02,
+0x53,
+0xee,
+0x00,
+0x49,
+0x00,
+0x20,
+0x88,
+0x0a,
+0x20,
+0xf4,
+0x05,
+0xa0,
+0x02,
+0x53,
+0xee,
+0x00,
+0x4b,
+0x00,
+0x20,
+0x88,
+0x0a,
+0x20,
+0x1e,
+0x06,
+0xa0,
+0x02,
+0x53,
+0xee,
+0x00,
+0x4d,
+0x00,
+0x20,
+0x88,
+0x0a,
+0x20,
+0x1e,
+0x06,
+0xa0,
+0x02,
+0x53,
+0xee,
+0x00,
+0x4f,
+0x00,
+0x20,
+0x65,
+0x0a,
+0x85,
+0x51,
+0x64,
+0x52,
+0x20,
+0x65,
+0x0a,
+0x85,
+0x5f,
+0x20,
+0x65,
+0x0a,
+0x85,
+0x60,
+0x20,
+0x65,
+0x0a,
+0x85,
+0x61,
+0xa5,
+0x1b,
+0x29,
+0x10,
+0xf0,
+0x08,
+0xa9,
+0xff,
+0x85,
+0x51,
+0xa9,
+0x03,
+0x85,
+0x52,
+0xa9,
+0x00,
+0x60,
+0x18,
+0xa5,
+0xd4,
+0x69,
+0x0a,
+0x80,
+0x02,
+0xa5,
+0xd5,
+0xaa,
+0xa0,
+0x00,
+0xbd,
+0xeb,
+0x0d,
+0x99,
+0xe6,
+0x00,
+0xe8,
+0xc8,
+0xc0,
+0x04,
+0xd0,
+0xf4,
+0xa0,
+0x02,
+0x60,
+0x65,
+0xe2,
+0x85,
+0xe2,
+0x98,
+0x65,
+0xde,
+0x85,
+0xde,
+0x90,
+0x07,
+0xe6,
+0xdf,
+0x18,
+0xd0,
+0x02,
+0xe6,
+0xe0,
+0x60,
+0x65,
+0xde,
+0x85,
+0xde,
+0x98,
+0x65,
+0xdf,
+0x85,
+0xdf,
+0x90,
+0x07,
+0x18,
+0xe6,
+0xe0,
+0xd0,
+0x02,
+0xe6,
+0xe1,
+0x60,
+0xa4,
+0xe3,
+0xf0,
+0x03,
+0x4c,
+0x65,
+0x0a,
+0x4c,
+0x88,
+0x0a,
+0xa9,
+0x06,
+0x85,
+0xcc,
+0x20,
+0x94,
+0x07,
+0x53,
+0x34,
+0x00,
+0xcd,
+0x00,
+0x53,
+0xda,
+0x00,
+0xc8,
+0x00,
+0x53,
+0xdc,
+0x00,
+0xca,
+0x00,
+0x20,
+0xd5,
+0x07,
+0xa0,
+0x02,
+0x53,
+0xee,
+0x00,
+0xf0,
+0x00,
+0x53,
+0xc8,
+0x00,
+0xda,
+0x00,
+0x53,
+0xca,
+0x00,
+0xdc,
+0x00,
+0x20,
+0x94,
+0x07,
+0x53,
+0xd6,
+0x00,
+0xc8,
+0x00,
+0x53,
+0xd8,
+0x00,
+0xca,
+0x00,
+0x20,
+0xd5,
+0x07,
+0xa0,
+0x02,
+0x53,
+0xc8,
+0x00,
+0xd6,
+0x00,
+0x53,
+0xca,
+0x00,
+0xd8,
+0x00,
+0x38,
+0xa5,
+0xee,
+0xe5,
+0xf0,
+0xd0,
+0x09,
+0xa5,
+0xef,
+0xe5,
+0xf1,
+0xd0,
+0x03,
+0xa5,
+0xee,
+0x60,
+0x20,
+0x9b,
+0x07,
+0x38,
+0xa5,
+0xe8,
+0xe5,
+0xe6,
+0x85,
+0xd0,
+0xa5,
+0xe9,
+0xe5,
+0xe7,
+0x85,
+0xd1,
+0x4a,
+0x85,
+0xeb,
+0xa5,
+0xd0,
+0x6a,
+0x85,
+0xea,
+0x38,
+0xa5,
+0xf0,
+0xe5,
+0xee,
+0x85,
+0xec,
+0xa5,
+0xf1,
+0xe5,
+0xef,
+0x85,
+0xed,
+0x64,
+0xe6,
+0xb0,
+0x17,
+0xe6,
+0xe6,
+0xa5,
+0xea,
+0xe9,
+0x00,
+0xb0,
+0x03,
+0x38,
+0xc6,
+0xeb,
+0xa9,
+0x00,
+0xe5,
+0xec,
+0x85,
+0xec,
+0xa9,
+0x00,
+0xe5,
+0xed,
+0x85,
+0xed,
+0x64,
+0xe0,
+0x64,
+0xe1,
+0xa5,
+0xd5,
+0x0a,
+0xaa,
+0xbd,
+0xfb,
+0x0d,
+0x45,
+0xed,
+0x85,
+0xe2,
+0x84,
+0xde,
+0xbd,
+0xfc,
+0x0d,
+0x45,
+0xed,
+0x18,
+0x65,
+0xde,
+0x85,
+0xde,
+0x90,
+0x02,
+0xc8,
+0x18,
+0x84,
+0xdf,
+0xbd,
+0xfc,
+0x0d,
+0x45,
+0xec,
+0x20,
+0xaf,
+0x07,
+0xbd,
+0xfd,
+0x0d,
+0x45,
+0xeb,
+0x20,
+0xaf,
+0x07,
+0xbd,
+0xfd,
+0x0d,
+0x45,
+0xec,
+0x65,
+0xde,
+0x85,
+0xde,
+0x98,
+0x65,
+0xdf,
+0x85,
+0xdf,
+0x90,
+0x07,
+0xe6,
+0xe0,
+0x18,
+0xd0,
+0x02,
+0xe6,
+0xe1,
+0xbd,
+0xfd,
+0x0d,
+0x45,
+0xed,
+0x65,
+0xdf,
+0x85,
+0xdf,
+0x98,
+0x65,
+0xe0,
+0x85,
+0xe0,
+0x90,
+0x03,
+0x18,
+0xe6,
+0xe1,
+0xbd,
+0xfe,
+0x0d,
+0x45,
+0xea,
+0x65,
+0xe2,
+0x98,
+0xa0,
+0x00,
+0x20,
+0xc2,
+0x07,
+0xbd,
+0xfe,
+0x0d,
+0x45,
+0xeb,
+0x20,
+0xc2,
+0x07,
+0xbd,
+0xfe,
+0x0d,
+0x45,
+0xec,
+0x65,
+0xdf,
+0x85,
+0xdf,
+0x98,
+0x65,
+0xe0,
+0x85,
+0xe0,
+0x90,
+0x03,
+0xe6,
+0xe1,
+0x18,
+0xbd,
+0xfe,
+0x0d,
+0x45,
+0xed,
+0x65,
+0xe0,
+0x85,
+0xe0,
+0x98,
+0x65,
+0xe1,
+0x85,
+0xe1,
+0xa0,
+0x04,
+0x53,
+0xde,
+0x00,
+0xc0,
+0x00,
+0xe6,
+0xc0,
+0xd0,
+0x0a,
+0xe6,
+0xc1,
+0xd0,
+0x06,
+0xe6,
+0xc2,
+0xd0,
+0x02,
+0xe6,
+0xc3,
+0x20,
+0x58,
+0x0b,
+0x38,
+0xa2,
+0x00,
+0xa0,
+0x04,
+0xb5,
+0xea,
+0xf5,
+0xc4,
+0xe8,
+0x88,
+0xd0,
+0xf8,
+0xdc,
+0x90,
+0x08,
+0x53,
+0xc0,
+0x00,
+0xde,
+0x00,
+0x4c,
+0x0d,
+0x09,
+0x53,
+0xde,
+0x00,
+0xc0,
+0x00,
+0xa5,
+0xe6,
+0xf0,
+0x17,
+0xa2,
+0x00,
+0x38,
+0x8a,
+0xe5,
+0xc0,
+0x85,
+0xc0,
+0x8a,
+0xe5,
+0xc1,
+0x85,
+0xc1,
+0x8a,
+0xe5,
+0xc2,
+0x85,
+0xc2,
+0x8a,
+0xe5,
+0xc3,
+0x85,
+0xc3,
+0x20,
+0x9b,
+0x07,
+0x53,
+0x2e,
+0x00,
+0xcd,
+0x00,
+0xa0,
+0x04,
+0x53,
+0xee,
+0x00,
+0xea,
+0x00,
+0x20,
+0xb1,
+0x0a,
+0xa5,
+0xee,
+0x60,
+0xa5,
+0x1b,
+0x29,
+0x08,
+0xf0,
+0x10,
+0x64,
+0xe5,
+0xa0,
+0x06,
+0x13,
+0xe5,
+0x00,
+0x59,
+0x00,
+0xa9,
+0xf8,
+0x85,
+0x59,
+0xa9,
+0x00,
+0x60,
+0xa0,
+0x02,
+0x53,
+0x2e,
+0x00,
+0xe8,
+0x00,
+0xa2,
+0xeb,
+0xa0,
+0x0d,
+0xa9,
+0x08,
+0x20,
+0x3c,
+0x0a,
+0x84,
+0xd5,
+0xa0,
+0x02,
+0x53,
+0x34,
+0x00,
+0xe8,
+0x00,
+0xa2,
+0xf5,
+0xa0,
+0x0d,
+0xa9,
+0x04,
+0x20,
+0x3c,
+0x0a,
+0x84,
+0xd4,
+0xa5,
+0xd5,
+0x4a,
+0x49,
+0x12,
+0x85,
+0xd6,
+0xa5,
+0xd4,
+0x49,
+0x03,
+0x65,
+0xd6,
+0x69,
+0x0b,
+0x85,
+0xd6,
+0x98,
+0x69,
+0x0e,
+0x85,
+0xd7,
+0xa5,
+0xd6,
+0x69,
+0x12,
+0x85,
+0xda,
+0xa5,
+0xd7,
+0x69,
+0x00,
+0x85,
+0xdb,
+0xa5,
+0xd5,
+0x49,
+0x14,
+0x69,
+0x65,
+0x85,
+0xd8,
+0x98,
+0x69,
+0x0e,
+0x85,
+0xd9,
+0x18,
+0xa5,
+0xd4,
+0x49,
+0x0a,
+0x65,
+0xd8,
+0x85,
+0xd8,
+0x90,
+0x03,
+0xe6,
+0xd9,
+0x18,
+0xa5,
+0xd8,
+0x69,
+0x28,
+0x85,
+0xdc,
+0xa5,
+0xd9,
+0x69,
+0x00,
+0x85,
+0xdd,
+0x64,
+0xe3,
+0x20,
+0xdf,
+0x07,
+0xa0,
+0x02,
+0x53,
+0xee,
+0x00,
+0x59,
+0x00,
+0xe6,
+0xe3,
+0xa2,
+0x03,
+0xda,
+0x20,
+0xdf,
+0x07,
+0xfa,
+0x95,
+0x5b,
+0xca,
+0x10,
+0xf6,
+0xa9,
+0x00,
+0x60,
+0xa5,
+0x1c,
+0xd8,
+0x4d,
+0xde,
+0x0d,
+0x85,
+0x62,
+0xf8,
+0x29,
+0xfc,
+0xf0,
+0x03,
+0xa9,
+0x1f,
+0x60,
+0xa6,
+0x27,
+0xa5,
+0x1b,
+0x29,
+0x20,
+0xf0,
+0x02,
+0xa2,
+0x01,
+0x8a,
+0x3a,
+0x49,
+0x03,
+0x18,
+0x69,
+0xad,
+0x85,
+0xe6,
+0x98,
+0x69,
+0x0d,
+0x85,
+0xe7,
+0xa0,
+0x06,
+0xd3,
+0xe6,
+0x53,
+0x00,
+0xa9,
+0x00,
+0x60,
+0x85,
+0xea,
+0x86,
+0xe6,
+0x84,
+0xe7,
+0xa0,
+0x01,
+0xc8,
+0xc4,
+0xea,
+0xf0,
+0x0d,
+0x38,
+0xb1,
+0xe6,
+0xe5,
+0xe8,
+0xc8,
+0xb1,
+0xe6,
+0xe5,
+0xe9,
+0x90,
+0xef,
+0x88,
+0x88,
+0x88,
+0x60,
+0xa0,
+0x04,
+0xe6,
+0xca,
+0xd0,
+0x02,
+0xe6,
+0xcb,
+0x88,
+0xd0,
+0xf7,
+0x60,
+0xa0,
+0x04,
+0xd3,
+0xca,
+0xc0,
+0x00,
+0xb2,
+0xc8,
+0x85,
+0xea,
+0x64,
+0xeb,
+0xa4,
+0xcc,
+0xb1,
+0xc8,
+0x85,
+0xec,
+0x64,
+0xed,
+0x20,
+0xb1,
+0x0a,
+0x20,
+0x59,
+0x0a,
+0xe6,
+0xc8,
+0xd0,
+0x02,
+0xe6,
+0xc9,
+0xa5,
+0xee,
+0x60,
+0xa0,
+0x04,
+0xd3,
+0xca,
+0xc0,
+0x00,
+0xa0,
+0x02,
+0xd3,
+0xc8,
+0xea,
+0x00,
+0xa4,
+0xcc,
+0xb1,
+0xc8,
+0x85,
+0xec,
+0xc8,
+0xb1,
+0xc8,
+0x85,
+0xed,
+0x20,
+0xb1,
+0x0a,
+0x20,
+0x59,
+0x0a,
+0xa0,
+0x02,
+0xe6,
+0xc8,
+0xd0,
+0x02,
+0xe6,
+0xc9,
+0x88,
+0xd0,
+0xf7,
+0x60,
+0xa0,
+0x02,
+0x38,
+0xa5,
+0xcd,
+0xe5,
+0xe6,
+0xa5,
+0xce,
+0xe5,
+0xe7,
+0xb0,
+0x06,
+0x53,
+0xea,
+0x00,
+0xee,
+0x00,
+0x60,
+0xa5,
+0xe8,
+0xe5,
+0xcd,
+0xa5,
+0xe9,
+0xe5,
+0xce,
+0xb0,
+0x06,
+0x53,
+0xec,
+0x00,
+0xee,
+0x00,
+0x60,
+0x38,
+0xa5,
+0xcd,
+0xe5,
+0xe6,
+0x85,
+0xd0,
+0xa5,
+0xce,
+0xe5,
+0xe7,
+0x85,
+0xd1,
+0x20,
+0x58,
+0x0b,
+0x18,
+0xa9,
+0x80,
+0x65,
+0xc5,
+0x90,
+0x06,
+0xe6,
+0xc6,
+0xd0,
+0x02,
+0xe6,
+0xc7,
+0x18,
+0xa5,
+0xea,
+0x65,
+0xc6,
+0x85,
+0xee,
+0xa5,
+0xeb,
+0x65,
+0xc7,
+0x85,
+0xef,
+0x60,
+0x88,
+0xd0,
+0x01,
+0x60,
+0x85,
+0xe6,
+0x86,
+0xe7,
+0x98,
+0xc8,
+0x18,
+0x65,
+0xe7,
+0xaa,
+0x90,
+0x02,
+0xe6,
+0xe6,
+0x98,
+0xc9,
+0x01,
+0xf0,
+0x0e,
+0x29,
+0x01,
+0xd0,
+0x0d,
+0x46,
+0xe6,
+0x8a,
+0x6a,
+0xaa,
+0x98,
+0x4a,
+0xa8,
+0x80,
+0xee,
+0xa5,
+0xe6,
+0x60,
+0x8a,
+0x1a,
+0xd0,
+0x02,
+0xe6,
+0xe6,
+0x49,
+0x55,
+0x84,
+0xe8,
+0x18,
+0x65,
+0xe8,
+0x85,
+0xe7,
+0x90,
+0x03,
+0xe6,
+0xe8,
+0x18,
+0xa5,
+0xe6,
+0x49,
+0x55,
+0x84,
+0xe9,
+0xaa,
+0x65,
+0xe7,
+0x8a,
+0x65,
+0xe8,
+0x85,
+0xe8,
+0xa5,
+0xe9,
+0x90,
+0x03,
+0xe6,
+0xe9,
+0x18,
+0x65,
+0xe8,
+0xaa,
+0xa5,
+0xe9,
+0x69,
+0x00,
+0x60,
+0x64,
+0xc7,
+0xa5,
+0xd0,
+0x45,
+0xc0,
+0x85,
+0xc4,
+0x84,
+0xc5,
+0x18,
+0xa5,
+0xd0,
+0x45,
+0xc1,
+0x65,
+0xc5,
+0x85,
+0xc5,
+0x90,
+0x05,
+0xc8,
+0xd0,
+0x02,
+0xe6,
+0xc7,
+0x84,
+0xc6,
+0x18,
+0xa5,
+0xd1,
+0x45,
+0xc0,
+0x65,
+0xc5,
+0x85,
+0xc5,
+0x98,
+0x65,
+0xc6,
+0x85,
+0xc6,
+0x90,
+0x03,
+0xe6,
+0xc7,
+0x18,
+0xa5,
+0xd0,
+0x45,
+0xc2,
+0x65,
+0xc6,
+0x85,
+0xc6,
+0x98,
+0x65,
+0xc7,
+0x85,
+0xc7,
+0x18,
+0xa5,
+0xd1,
+0x45,
+0xc1,
+0x65,
+0xc6,
+0x85,
+0xc6,
+0x98,
+0x65,
+0xc7,
+0x85,
+0xc7,
+0x18,
+0xa5,
+0xd0,
+0x45,
+0xc3,
+0x65,
+0xc7,
+0x85,
+0xc7,
+0x18,
+0xa5,
+0xd1,
+0x45,
+0xc2,
+0x65,
+0xc7,
+0x85,
+0xc7,
+0x60,
+0xa5,
+0xe6,
+0x45,
+0xe8,
+0x85,
+0xea,
+0x84,
+0xeb,
+0xa5,
+0xe6,
+0x45,
+0xe9,
+0x18,
+0x65,
+0xeb,
+0x85,
+0xeb,
+0x98,
+0x69,
+0x00,
+0x85,
+0xec,
+0x64,
+0xed,
+0xa5,
+0xe7,
+0x45,
+0xe8,
+0x18,
+0x65,
+0xeb,
+0x85,
+0xeb,
+0x98,
+0x65,
+0xec,
+0x85,
+0xec,
+0x90,
+0x02,
+0xe6,
+0xed,
+0xa5,
+0xe7,
+0x45,
+0xe9,
+0x18,
+0x65,
+0xec,
+0x85,
+0xec,
+0x98,
+0x65,
+0xed,
+0x85,
+0xed,
+0xa5,
+0xe9,
+0x10,
+0x0d,
+0x38,
+0xa5,
+0xec,
+0xe5,
+0xe6,
+0x85,
+0xec,
+0xa5,
+0xed,
+0xe5,
+0xe7,
+0x85,
+0xed,
+0x60,
+0x18,
+0xa5,
+0xe8,
+0x65,
+0xea,
+0x85,
+0xea,
+0xa2,
+0x00,
+0xa5,
+0xe9,
+0x10,
+0x01,
+0xca,
+0x65,
+0xeb,
+0x85,
+0xeb,
+0x8a,
+0x65,
+0xec,
+0x85,
+0xec,
+0x8a,
+0x65,
+0xed,
+0x85,
+0xed,
+0x60,
+0xa0,
+0x02,
+0x53,
+0xe5,
+0x0d,
+0xe8,
+0x00,
+0x20,
+0xb5,
+0x0b,
+0xa0,
+0x02,
+0x53,
+0xe9,
+0x0d,
+0xe8,
+0x00,
+0x20,
+0xff,
+0x0b,
+0xa0,
+0x04,
+0x53,
+0xea,
+0x00,
+0xee,
+0x00,
+0xa0,
+0x02,
+0x53,
+0xe3,
+0x0d,
+0xe8,
+0x00,
+0x20,
+0xb5,
+0x0b,
+0xa0,
+0x02,
+0x53,
+0xe7,
+0x0d,
+0xe8,
+0x00,
+0x20,
+0xff,
+0x0b,
+0xa5,
+0xed,
+0x10,
+0x22,
+0xa2,
+0x00,
+0xa9,
+0x01,
+0x4a,
+0xa9,
+0x00,
+0xf5,
+0xea,
+0x95,
+0xea,
+0x2a,
+0xe8,
+0xe0,
+0x04,
+0x90,
+0xf3,
+0xa2,
+0x00,
+0xa9,
+0x01,
+0x4a,
+0xa9,
+0x00,
+0xf5,
+0xee,
+0x95,
+0xee,
+0x2a,
+0xe8,
+0xe0,
+0x04,
+0x90,
+0xf3,
+0xa5,
+0xed,
+0x05,
+0xf1,
+0x30,
+0x12,
+0x06,
+0xea,
+0x26,
+0xeb,
+0x26,
+0xec,
+0x26,
+0xed,
+0x06,
+0xee,
+0x26,
+0xef,
+0x26,
+0xf0,
+0x26,
+0xf1,
+0x80,
+0xe8,
+0x64,
+0xe6,
+0x64,
+0xe7,
+0x64,
+0xe8,
+0x64,
+0xe9,
+0xa2,
+0x20,
+0x06,
+0xea,
+0x26,
+0xeb,
+0x26,
+0xec,
+0x26,
+0xed,
+0x26,
+0xe6,
+0x26,
+0xe7,
+0x26,
+0xe8,
+0x26,
+0xe9,
+0x38,
+0xa5,
+0xe6,
+0xe5,
+0xef,
+0x85,
+0xc0,
+0xa5,
+0xe7,
+0xe5,
+0xf0,
+0x85,
+0xc1,
+0xa5,
+0xe8,
+0xe5,
+0xf1,
+0x85,
+0xc2,
+0xa5,
+0xe9,
+0xe9,
+0x00,
+0x85,
+0xc3,
+0x90,
+0x0b,
+0xe6,
+0xea,
+0x8a,
+0xa0,
+0x04,
+0x53,
+0xc0,
+0x00,
+0xe6,
+0x00,
+0xaa,
+0xca,
+0xd0,
+0xc7,
+0xa6,
+0xea,
+0xa4,
+0xeb,
+0xa5,
+0xec,
+0x05,
+0xed,
+0xf0,
+0x03,
+0xa2,
+0xff,
+0xdc,
+0x86,
+0xe6,
+0x84,
+0xe7,
+0x60,
+0xba,
+0x08,
+0x78,
+0x68,
+0x48,
+0x29,
+0x1c,
+0x85,
+0xfa,
+0x86,
+0xf8,
+0xa9,
+0x01,
+0x85,
+0xf9,
+0xa0,
+0x06,
+0xb1,
+0xf8,
+0x48,
+0x29,
+0x1c,
+0xc5,
+0xfa,
+0x90,
+0x08,
+0x7a,
+0xa0,
+0x09,
+0xb1,
+0xf8,
+0x48,
+0x29,
+0x1c,
+0xc9,
+0x00,
+0xd0,
+0x38,
+0xa0,
+0x03,
+0xb1,
+0xf8,
+0xe0,
+0xdf,
+0xb0,
+0x18,
+0x8d,
+0x6b,
+0x01,
+0xc8,
+0xb1,
+0xf8,
+0x8d,
+0x6c,
+0x01,
+0xc8,
+0xb1,
+0xf8,
+0x8d,
+0x6d,
+0x01,
+0x8a,
+0x18,
+0x69,
+0x05,
+0x8d,
+0x6e,
+0x01,
+0x80,
+0x16,
+0x8d,
+0x6f,
+0x01,
+0xc8,
+0xb1,
+0xf8,
+0x8d,
+0x70,
+0x01,
+0xc8,
+0xb1,
+0xf8,
+0x8d,
+0x71,
+0x01,
+0x8a,
+0x18,
+0x69,
+0x05,
+0x8d,
+0x72,
+0x01,
+0xa9,
+0x00,
+0xfa,
+0x28,
+0xf8,
+0x60,
+0x68,
+0xf0,
+0x04,
+0x68,
+0xfa,
+0x7a,
+0x40,
+0x08,
+0x78,
+0x68,
+0xad,
+0x6a,
+0x01,
+0xf0,
+0x0e,
+0xae,
+0x6e,
+0x01,
+0x9a,
+0xad,
+0x6b,
+0x01,
+0xae,
+0x6c,
+0x01,
+0xac,
+0x6d,
+0x01,
+0x40,
+0xae,
+0x72,
+0x01,
+0x9a,
+0xad,
+0x6f,
+0x01,
+0xae,
+0x70,
+0x01,
+0xac,
+0x71,
+0x01,
+0x40,
+0x08,
+0x78,
+0xad,
+0x6a,
+0x01,
+0xd0,
+0x1f,
+0x1a,
+0x8d,
+0x6a,
+0x01,
+0xa9,
+0xdc,
+0x8d,
+0x6e,
+0x01,
+0x9c,
+0x6b,
+0x01,
+0x9c,
+0x6c,
+0x01,
+0x9c,
+0x6d,
+0x01,
+0xa9,
+0x03,
+0x8d,
+0xdf,
+0x01,
+0xa9,
+0x6f,
+0x8d,
+0xde,
+0x01,
+0x9c,
+0xdd,
+0x01,
+0x28,
+0x60,
+0xa9,
+0x02,
+0x60,
+0x04,
+0xdc,
+0x02,
+0xfd,
+0x02,
+0xff,
+0xff,
+0xff,
+0xff,
+0x0d,
+0x03,
+0x08,
+0x01,
+0x5b,
+0xe6,
+0x80,
+0x80,
+0x80,
+0xff,
+0xff,
+0x02,
+0x01,
+0x05,
+0x00,
+0x04,
+0x00,
+0x00,
+0x00,
+0x00,
+0x10,
+0x03,
+0x70,
+0x00,
+0x10,
+0x00,
+0xc7,
+0x02,
+0x8e,
+0x00,
+0x1c,
+0x00,
+0xa4,
+0x02,
+0x9c,
+0x00,
+0x24,
+0x00,
+0x00,
+0x01,
+0x01,
+0x02,
+0x02,
+0x02,
+0x02,
+0x03,
+0x03,
+0x03,
+0x03,
+0x03,
+0x03,
+0x04,
+0x04,
+0x04,
+0x04,
+};
+uint8_t dppcode_u_1_8[] = 
+{
+0xa0,
+0x00,
+0x80,
+0x02,
+0xa0,
+0x01,
+0x78,
+0xa2,
+0xff,
+0x9a,
+0xf8,
+0xc0,
+0x00,
+0xf0,
+0x09,
+0x20,
+0x9f,
+0x3f,
+0xf0,
+0x04,
+0xa2,
+0x01,
+0x80,
+0x53,
+0x9c,
+0x00,
+0x02,
+0xa0,
+0x36,
+0x13,
+0x00,
+0x02,
+0x01,
+0x02,
+0xa9,
+0x08,
+0x8d,
+0x00,
+0x02,
+0xa9,
+0x01,
+0x8d,
+0x01,
+0x02,
+0xa9,
+0xe8,
+0x8d,
+0x02,
+0x02,
+0xa9,
+0xeb,
+0x8d,
+0x03,
+0x02,
+0xa2,
+0xff,
+0x8e,
+0x32,
+0x02,
+0x8e,
+0xb9,
+0x6b,
+0xa2,
+0xff,
+0x8e,
+0x33,
+0x02,
+0x8e,
+0xba,
+0x6b,
+0xa0,
+0x03,
+0x53,
+0x27,
+0xbe,
+0x04,
+0x02,
+0xa9,
+0x01,
+0x8d,
+0x07,
+0x02,
+0xcd,
+0x29,
+0xbe,
+0xf0,
+0x04,
+0xa2,
+0x03,
+0x80,
+0x10,
+0xa2,
+0x02,
+0xad,
+0x00,
+0xc0,
+0xc9,
+0xe8,
+0xd0,
+0x07,
+0xad,
+0x01,
+0xc0,
+0xc9,
+0xeb,
+0xf0,
+0x0e,
+0x8e,
+0x08,
+0x02,
+0xa9,
+0x01,
+0x9c,
+0x14,
+0xd0,
+0x8d,
+0x14,
+0xd0,
+0x5c,
+0x80,
+0xfd,
+0x9c,
+0x08,
+0x02,
+0xa0,
+0x0e,
+0x53,
+0xe1,
+0x3f,
+0x02,
+0x00,
+0x9c,
+0x14,
+0xd0,
+0x9c,
+0x18,
+0xd0,
+0x9c,
+0x1c,
+0xd0,
+0x9c,
+0x20,
+0xd0,
+0x9c,
+0x24,
+0xd0,
+0x9c,
+0x28,
+0xd0,
+0x20,
+0xa1,
+0x03,
+0x58,
+0xa9,
+0x01,
+0x8d,
+0x14,
+0xd0,
+0x4c,
+0x11,
+0x0e,
+0x9c,
+0x7a,
+0x5f,
+0xa9,
+0x01,
+0x8d,
+0x7b,
+0x5f,
+0x9c,
+0x1d,
+0x83,
+0x9c,
+0xbd,
+0x5f,
+0x9c,
+0xbe,
+0x5f,
+0x9c,
+0xbf,
+0x5f,
+0x9c,
+0xc0,
+0x5f,
+0x9c,
+0xc7,
+0x5f,
+0x9c,
+0xc8,
+0x5f,
+0xa0,
+0x03,
+0x13,
+0x1d,
+0x83,
+0xb4,
+0x5f,
+0x13,
+0x1d,
+0x83,
+0xb7,
+0x5f,
+0x20,
+0xd7,
+0x03,
+0x20,
+0xa2,
+0x1a,
+0x20,
+0xdf,
+0x1a,
+0x9c,
+0x11,
+0x61,
+0x60,
+0x9c,
+0x01,
+0x5f,
+0x9c,
+0x00,
+0x5f,
+0x9c,
+0x02,
+0x5f,
+0x9c,
+0x03,
+0x5f,
+0x9c,
+0x04,
+0x5f,
+0x60,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xc8,
+0x3e,
+0x48,
+0xad,
+0x08,
+0xd0,
+0xc9,
+0x01,
+0xd0,
+0x51,
+0x08,
+0x78,
+0xad,
+0x00,
+0x5f,
+0xc9,
+0x02,
+0xb0,
+0x03,
+0xee,
+0x00,
+0x5f,
+0xee,
+0x02,
+0x5f,
+0xd0,
+0x08,
+0xee,
+0x03,
+0x5f,
+0xd0,
+0x03,
+0xee,
+0x04,
+0x5f,
+0xa0,
+0x37,
+0xad,
+0x01,
+0x5f,
+0x1a,
+0x29,
+0x01,
+0x8d,
+0x01,
+0x5f,
+0xf0,
+0x0e,
+0x53,
+0x00,
+0x02,
+0x3c,
+0x5f,
+0xa0,
+0x03,
+0x53,
+0x02,
+0x5f,
+0x76,
+0x5f,
+0x80,
+0x0c,
+0x53,
+0x00,
+0x02,
+0x05,
+0x5f,
+0xa0,
+0x03,
+0x53,
+0x02,
+0x5f,
+0x73,
+0x5f,
+0xad,
+0x11,
+0x61,
+0xd0,
+0x03,
+0x20,
+0x55,
+0x3f,
+0x28,
+0xa9,
+0x01,
+0x9c,
+0x18,
+0xd0,
+0x8d,
+0x18,
+0xd0,
+0x4c,
+0x2a,
+0x3f,
+0x8a,
+0xf0,
+0x0c,
+0xa9,
+0x40,
+0x8d,
+0x30,
+0xc0,
+0xa9,
+0x08,
+0x8d,
+0x31,
+0xc0,
+0x80,
+0x06,
+0x9c,
+0x30,
+0xc0,
+0x9c,
+0x31,
+0xc0,
+0xbd,
+0xc9,
+0x5f,
+0x85,
+0xa9,
+0x8d,
+0x78,
+0xc0,
+0xbd,
+0xcb,
+0x5f,
+0x8d,
+0xb3,
+0x6b,
+0xbd,
+0xcd,
+0x5f,
+0x8d,
+0x68,
+0xc0,
+0xbd,
+0xcf,
+0x5f,
+0x8d,
+0x69,
+0xc0,
+0xbd,
+0xd1,
+0x5f,
+0x0a,
+0xa8,
+0xb9,
+0x38,
+0x6b,
+0x85,
+0xc0,
+0xb9,
+0x39,
+0x6b,
+0x85,
+0xc1,
+0xb9,
+0x90,
+0x6b,
+0x8d,
+0x58,
+0xc0,
+0xb9,
+0x91,
+0x6b,
+0x8d,
+0x59,
+0xc0,
+0xb9,
+0xa0,
+0x6b,
+0x8d,
+0x60,
+0xc0,
+0xb9,
+0xa1,
+0x6b,
+0x8d,
+0x61,
+0xc0,
+0xbd,
+0xd3,
+0x5f,
+0x0a,
+0xa8,
+0xb9,
+0x40,
+0x6b,
+0x85,
+0xc2,
+0xb9,
+0x41,
+0x6b,
+0x85,
+0xc3,
+0xb9,
+0x98,
+0x6b,
+0x8d,
+0x5c,
+0xc0,
+0xb9,
+0x99,
+0x6b,
+0x8d,
+0x5d,
+0xc0,
+0xb9,
+0xa8,
+0x6b,
+0x8d,
+0x64,
+0xc0,
+0xb9,
+0xa9,
+0x6b,
+0x8d,
+0x65,
+0xc0,
+0xbd,
+0xd5,
+0x5f,
+0x8d,
+0x14,
+0xc0,
+0xbd,
+0xd7,
+0x5f,
+0x8d,
+0x18,
+0xc0,
+0xbd,
+0xd9,
+0x5f,
+0x8d,
+0x19,
+0xc0,
+0xa9,
+0x00,
+0x8d,
+0x0c,
+0xc0,
+0xa9,
+0x00,
+0x8d,
+0x0d,
+0xc0,
+0xda,
+0xe0,
+0x00,
+0xd0,
+0x12,
+0xac,
+0x0b,
+0x61,
+0x43,
+0x33,
+0x60,
+0x54,
+0xc0,
+0x98,
+0x4a,
+0xa8,
+0x53,
+0xc3,
+0x60,
+0x15,
+0x6b,
+0x80,
+0x10,
+0xac,
+0x0c,
+0x61,
+0x43,
+0x5b,
+0x60,
+0x54,
+0xc0,
+0x98,
+0x4a,
+0xa8,
+0x53,
+0xd7,
+0x60,
+0x15,
+0x6b,
+0xfa,
+0xbd,
+0x07,
+0x60,
+0x8d,
+0x28,
+0xc0,
+0xbd,
+0xdb,
+0x5f,
+0x8d,
+0x1c,
+0xc0,
+0xbd,
+0xdd,
+0x5f,
+0x8d,
+0x1d,
+0xc0,
+0xa9,
+0x50,
+0x8d,
+0x0c,
+0xc0,
+0xa9,
+0x00,
+0x8d,
+0x0d,
+0xc0,
+0xda,
+0xe0,
+0x00,
+0xd0,
+0x12,
+0xac,
+0x0d,
+0x61,
+0x43,
+0x83,
+0x60,
+0x54,
+0xc0,
+0x98,
+0x4a,
+0xa8,
+0x53,
+0xeb,
+0x60,
+0x29,
+0x6b,
+0x80,
+0x10,
+0xac,
+0x0e,
+0x61,
+0x43,
+0xa3,
+0x60,
+0x54,
+0xc0,
+0x98,
+0x4a,
+0xa8,
+0x53,
+0xfb,
+0x60,
+0x29,
+0x6b,
+0xfa,
+0xbd,
+0x09,
+0x60,
+0x8d,
+0x2c,
+0xc0,
+0xbd,
+0xe3,
+0x5f,
+0x85,
+0xb4,
+0xbd,
+0xe5,
+0x5f,
+0x85,
+0xb5,
+0xbd,
+0xe7,
+0x5f,
+0x85,
+0xbe,
+0xbd,
+0xe9,
+0x5f,
+0x85,
+0xbf,
+0xbd,
+0xeb,
+0x5f,
+0x85,
+0xaa,
+0xbd,
+0xed,
+0x5f,
+0x85,
+0xb9,
+0xbd,
+0xef,
+0x5f,
+0x85,
+0xb6,
+0xbd,
+0xf1,
+0x5f,
+0x85,
+0xbd,
+0xbd,
+0xf3,
+0x5f,
+0x85,
+0xb7,
+0xbd,
+0xf5,
+0x5f,
+0x85,
+0xb8,
+0xbd,
+0xf7,
+0x5f,
+0x85,
+0xac,
+0xbd,
+0xf9,
+0x5f,
+0x85,
+0xad,
+0xbd,
+0xfb,
+0x5f,
+0x85,
+0xb2,
+0xbd,
+0xfd,
+0x5f,
+0x85,
+0xb3,
+0xbd,
+0xff,
+0x5f,
+0x85,
+0xae,
+0xbd,
+0x01,
+0x60,
+0x85,
+0xaf,
+0xbd,
+0x03,
+0x60,
+0x85,
+0xb0,
+0xbd,
+0x05,
+0x60,
+0x85,
+0xb1,
+0xda,
+0xbd,
+0xc5,
+0x5f,
+0x8d,
+0x12,
+0x61,
+0xf0,
+0x3c,
+0xbd,
+0x0f,
+0x61,
+0x85,
+0x12,
+0xbd,
+0xc3,
+0x5f,
+0xa2,
+0x00,
+0xa8,
+0xd0,
+0x04,
+0xa5,
+0x25,
+0xd0,
+0x29,
+0xc0,
+0x00,
+0xf0,
+0x0a,
+0x20,
+0x7d,
+0x3f,
+0xa0,
+0x06,
+0x53,
+0xe6,
+0x5c,
+0x15,
+0x6c,
+0xa0,
+0x01,
+0x84,
+0x25,
+0xa0,
+0x02,
+0x53,
+0x32,
+0x02,
+0xb7,
+0x6b,
+0x20,
+0xbe,
+0x3b,
+0x64,
+0x24,
+0xa5,
+0xbd,
+0x85,
+0x23,
+0xa5,
+0x12,
+0x8d,
+0xb5,
+0x6b,
+0xa2,
+0x01,
+0x86,
+0xa8,
+0xfa,
+0x08,
+0x78,
+0x68,
+0xa9,
+0x02,
+0x8d,
+0x38,
+0xc0,
+0xa9,
+0x01,
+0x8d,
+0x38,
+0xc0,
+0xa9,
+0x09,
+0x8d,
+0x38,
+0xc0,
+0xbd,
+0xdf,
+0x5f,
+0xf0,
+0x0a,
+0xa9,
+0x05,
+0x8d,
+0x38,
+0xc0,
+0xa9,
+0x0d,
+0x8d,
+0x38,
+0xc0,
+0xbd,
+0xe1,
+0x5f,
+0x85,
+0xab,
+0x85,
+0xba,
+0x60,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xc8,
+0x3e,
+0x48,
+0xad,
+0x11,
+0x61,
+0xf0,
+0x05,
+0xa9,
+0x08,
+0x4c,
+0x9d,
+0x06,
+0xad,
+0x0c,
+0xd0,
+0xc9,
+0x01,
+0xf0,
+0x05,
+0xa9,
+0x06,
+0x4c,
+0x9d,
+0x06,
+0x08,
+0x78,
+0xad,
+0x7a,
+0x5f,
+0xf0,
+0x59,
+0x8d,
+0xff,
+0x5e,
+0xc9,
+0x02,
+0xf0,
+0x0d,
+0xa2,
+0x00,
+0xad,
+0xbd,
+0x5f,
+0x0d,
+0xbf,
+0x5f,
+0xd0,
+0x1b,
+0xe8,
+0x80,
+0x18,
+0x38,
+0xad,
+0xb7,
+0x5f,
+0xed,
+0xb4,
+0x5f,
+0xad,
+0xb8,
+0x5f,
+0xed,
+0xb5,
+0x5f,
+0xad,
+0xb9,
+0x5f,
+0xed,
+0xb6,
+0x5f,
+0xa2,
+0x01,
+0xb0,
+0x01,
+0xca,
+0xad,
+0x09,
+0x02,
+0xdd,
+0xbd,
+0x5f,
+0xd0,
+0x0d,
+0xad,
+0x0a,
+0x02,
+0xdd,
+0xbf,
+0x5f,
+0xd0,
+0x05,
+0xbd,
+0xc1,
+0x5f,
+0x80,
+0x1a,
+0xce,
+0xff,
+0x5e,
+0xf0,
+0x0f,
+0xca,
+0xf0,
+0xe3,
+0xa2,
+0x01,
+0x80,
+0xdf,
+0xad,
+0x7c,
+0x5f,
+0x9c,
+0x7c,
+0x5f,
+0xd0,
+0x06,
+0xa9,
+0x05,
+0x80,
+0x02,
+0xa9,
+0x04,
+0x28,
+0x8d,
+0x08,
+0x02,
+0xc9,
+0x00,
+0xf0,
+0x0a,
+0xa0,
+0x01,
+0x9c,
+0x28,
+0xd0,
+0x8c,
+0x28,
+0xd0,
+0x80,
+0x27,
+0x20,
+0x49,
+0x04,
+0xee,
+0x32,
+0x02,
+0xd0,
+0x03,
+0xee,
+0x33,
+0x02,
+0x9c,
+0x1d,
+0x83,
+0xa9,
+0x01,
+0x8d,
+0x11,
+0x61,
+0x8d,
+0x7b,
+0x5f,
+0x9c,
+0xc7,
+0x5f,
+0x9c,
+0xc8,
+0x5f,
+0x9c,
+0x7a,
+0x5f,
+0xa0,
+0x01,
+0x9c,
+0x20,
+0xd0,
+0x8c,
+0x20,
+0xd0,
+0x4c,
+0x2a,
+0x3f,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xc8,
+0x3e,
+0x48,
+0x08,
+0x78,
+0x68,
+0xa5,
+0x25,
+0xc9,
+0x03,
+0xf0,
+0x05,
+0x64,
+0x25,
+0x20,
+0x7d,
+0x3f,
+0xa9,
+0x01,
+0x9c,
+0x24,
+0xd0,
+0x8d,
+0x24,
+0xd0,
+0x8d,
+0x04,
+0xc0,
+0x9c,
+0x11,
+0x61,
+0x20,
+0x55,
+0x3f,
+0x4c,
+0x31,
+0x3f,
+0xa9,
+0x01,
+0xcc,
+0x2b,
+0xbe,
+0x90,
+0x08,
+0xd0,
+0x05,
+0xec,
+0x2a,
+0xbe,
+0x90,
+0x01,
+0x1a,
+0x3a,
+0x60,
+0xa9,
+0x01,
+0xcc,
+0x2d,
+0xbe,
+0x90,
+0x08,
+0xd0,
+0x05,
+0xec,
+0x2c,
+0xbe,
+0x90,
+0x01,
+0x1a,
+0x3a,
+0x60,
+0xa5,
+0x22,
+0xf0,
+0x38,
+0xa9,
+0xe6,
+0x85,
+0x16,
+0xa9,
+0x70,
+0x85,
+0x17,
+0xa9,
+0xb7,
+0x85,
+0x18,
+0xa9,
+0x6c,
+0x85,
+0x19,
+0xa0,
+0x00,
+0xa9,
+0x04,
+0xf3,
+0x16,
+0x18,
+0xe6,
+0x17,
+0xe6,
+0x19,
+0x3a,
+0xd0,
+0xf6,
+0xa0,
+0x2f,
+0xf3,
+0x16,
+0x18,
+0xa0,
+0x06,
+0x53,
+0x1b,
+0x6c,
+0x15,
+0x6c,
+0xa0,
+0x02,
+0x53,
+0x34,
+0x02,
+0xb9,
+0x6b,
+0x53,
+0xb7,
+0x6b,
+0x34,
+0x02,
+0x64,
+0x22,
+0xf8,
+0x08,
+0x78,
+0xad,
+0x00,
+0x5f,
+0xd0,
+0x03,
+0x4c,
+0x98,
+0x08,
+0xa0,
+0x03,
+0x53,
+0x02,
+0x5f,
+0xba,
+0x5f,
+0xad,
+0x01,
+0x5f,
+0x8d,
+0x79,
+0x5f,
+0xaa,
+0xd0,
+0x39,
+0xbd,
+0xc7,
+0x5f,
+0xf0,
+0x1e,
+0xad,
+0x73,
+0x5f,
+0xcd,
+0xb4,
+0x5f,
+0xd0,
+0x16,
+0xad,
+0x74,
+0x5f,
+0xcd,
+0xb5,
+0x5f,
+0xd0,
+0x0e,
+0xad,
+0x75,
+0x5f,
+0xcd,
+0xb6,
+0x5f,
+0xd0,
+0x06,
+0xac,
+0x79,
+0x5f,
+0x4c,
+0x86,
+0x08,
+0x9c,
+0x30,
+0xc0,
+0x9c,
+0x31,
+0xc0,
+0xa0,
+0x37,
+0x53,
+0x05,
+0x5f,
+0x7d,
+0x5f,
+0xa0,
+0x03,
+0x53,
+0x73,
+0x5f,
+0xb4,
+0x5f,
+0x80,
+0x3b,
+0xbd,
+0xc7,
+0x5f,
+0xf0,
+0x1e,
+0xad,
+0x76,
+0x5f,
+0xcd,
+0xb7,
+0x5f,
+0xd0,
+0x16,
+0xad,
+0x77,
+0x5f,
+0xcd,
+0xb8,
+0x5f,
+0xd0,
+0x0e,
+0xad,
+0x78,
+0x5f,
+0xcd,
+0xb9,
+0x5f,
+0xd0,
+0x06,
+0xac,
+0x79,
+0x5f,
+0x4c,
+0x86,
+0x08,
+0xa9,
+0x40,
+0x8d,
+0x30,
+0xc0,
+0xa9,
+0x08,
+0x8d,
+0x31,
+0xc0,
+0xa0,
+0x37,
+0x53,
+0x3c,
+0x5f,
+0x7d,
+0x5f,
+0xa0,
+0x03,
+0x53,
+0x76,
+0x5f,
+0xb7,
+0x5f,
+0xae,
+0x79,
+0x5f,
+0xa9,
+0x00,
+0x9d,
+0xbd,
+0x5f,
+0x9d,
+0xbf,
+0x5f,
+0x9d,
+0xd9,
+0x5f,
+0x9d,
+0xd7,
+0x5f,
+0xad,
+0x7a,
+0x5f,
+0xc9,
+0x02,
+0xd0,
+0x04,
+0x3a,
+0x8d,
+0x7a,
+0x5f,
+0x28,
+0xad,
+0x7b,
+0x5f,
+0xf0,
+0x2b,
+0x9c,
+0x7b,
+0x5f,
+0xa9,
+0x01,
+0x8d,
+0x04,
+0xc0,
+0xa9,
+0x01,
+0x8d,
+0x10,
+0xc0,
+0x9c,
+0x3c,
+0xc0,
+0xad,
+0x37,
+0xbe,
+0xae,
+0x38,
+0xbe,
+0x8d,
+0x70,
+0xc0,
+0x8e,
+0x6c,
+0xc0,
+0x9c,
+0x29,
+0xc0,
+0x9c,
+0x2d,
+0xc0,
+0x9c,
+0x74,
+0xc0,
+0x9c,
+0x20,
+0xc0,
+0x9c,
+0x24,
+0xc0,
+0xad,
+0x79,
+0x5f,
+0x20,
+0xb7,
+0x08,
+0x08,
+0x78,
+0xac,
+0x79,
+0x5f,
+0x99,
+0xc1,
+0x5f,
+0x8d,
+0x7c,
+0x5f,
+0xb9,
+0xd9,
+0x5f,
+0xaa,
+0xb9,
+0xd7,
+0x5f,
+0x1a,
+0xd0,
+0x01,
+0xe8,
+0x0a,
+0x99,
+0xbd,
+0x5f,
+0x8a,
+0x2a,
+0x99,
+0xbf,
+0x5f,
+0xa9,
+0x01,
+0x9c,
+0x1c,
+0xd0,
+0x8d,
+0x1c,
+0xd0,
+0xee,
+0x7a,
+0x5f,
+0xad,
+0x02,
+0x5f,
+0xcd,
+0xba,
+0x5f,
+0xd0,
+0x10,
+0xad,
+0x03,
+0x5f,
+0xcd,
+0xbb,
+0x5f,
+0xd0,
+0x08,
+0xad,
+0x04,
+0x5f,
+0xcd,
+0xbc,
+0x5f,
+0xf0,
+0x03,
+0x4c,
+0x6a,
+0x07,
+0xad,
+0x00,
+0x5f,
+0x3a,
+0xf0,
+0x0c,
+0xcc,
+0x01,
+0x5f,
+0xd0,
+0x07,
+0x98,
+0x1a,
+0x29,
+0x01,
+0x4c,
+0x74,
+0x07,
+0x9c,
+0x1d,
+0x83,
+0xad,
+0xb3,
+0x5f,
+0xf0,
+0x14,
+0xac,
+0x79,
+0x5f,
+0xb9,
+0xbf,
+0x5f,
+0x8d,
+0x0a,
+0x02,
+0xb9,
+0xbd,
+0x5f,
+0x8d,
+0x09,
+0x02,
+0xa9,
+0x01,
+0x8d,
+0x0c,
+0xd0,
+0x4c,
+0x47,
+0x3f,
+0xaa,
+0x85,
+0x1f,
+0xad,
+0x89,
+0x5f,
+0xa8,
+0x29,
+0x01,
+0x85,
+0xb6,
+0x9d,
+0xef,
+0x5f,
+0x98,
+0x4a,
+0x29,
+0x01,
+0x85,
+0xbd,
+0x9d,
+0xf1,
+0x5f,
+0x98,
+0x29,
+0x03,
+0xd8,
+0x4d,
+0x2e,
+0xbe,
+0xf8,
+0x9d,
+0xd5,
+0x5f,
+0xad,
+0x95,
+0x5f,
+0xf0,
+0x03,
+0xa9,
+0x05,
+0x60,
+0xad,
+0x94,
+0x5f,
+0xa8,
+0x29,
+0xf0,
+0xd0,
+0xf5,
+0x98,
+0x29,
+0x01,
+0xf0,
+0xf0,
+0xad,
+0x93,
+0x5f,
+0xd0,
+0xeb,
+0xad,
+0x92,
+0x5f,
+0xa8,
+0x29,
+0xf0,
+0xd0,
+0xe3,
+0x98,
+0x29,
+0x01,
+0xf0,
+0xde,
+0x18,
+0xad,
+0x94,
+0x5f,
+0x6d,
+0x92,
+0x5f,
+0x4a,
+0xc9,
+0x05,
+0xb0,
+0xd2,
+0xa8,
+0xb9,
+0x3d,
+0x5a,
+0xf0,
+0xcc,
+0x98,
+0x85,
+0x10,
+0x9d,
+0xd1,
+0x5f,
+0xac,
+0x8b,
+0x5f,
+0xae,
+0x8a,
+0x5f,
+0x20,
+0x01,
+0x07,
+0xd0,
+0xbb,
+0x98,
+0x4a,
+0x85,
+0x17,
+0x8a,
+0x6a,
+0x85,
+0x16,
+0xb0,
+0xb1,
+0xac,
+0x8f,
+0x5f,
+0xae,
+0x8e,
+0x5f,
+0x20,
+0x01,
+0x07,
+0xd0,
+0xa6,
+0x98,
+0x4a,
+0x85,
+0x19,
+0x8a,
+0x6a,
+0x85,
+0x18,
+0x90,
+0x9c,
+0xe5,
+0x16,
+0xaa,
+0xa5,
+0x19,
+0xe5,
+0x17,
+0x30,
+0x93,
+0xa4,
+0x10,
+0x20,
+0xb7,
+0x0d,
+0x85,
+0x1a,
+0x86,
+0x1b,
+0xa4,
+0x1f,
+0x99,
+0xd7,
+0x5f,
+0x8a,
+0x99,
+0xd9,
+0x5f,
+0xa0,
+0x00,
+0xb9,
+0x4a,
+0x6b,
+0x38,
+0xe5,
+0x16,
+0xb9,
+0x5e,
+0x6b,
+0xe5,
+0x17,
+0x10,
+0x03,
+0xc8,
+0x80,
+0xf0,
+0x84,
+0xb4,
+0xb9,
+0x4a,
+0x6b,
+0x38,
+0xe5,
+0x18,
+0xb9,
+0x5e,
+0x6b,
+0xe5,
+0x19,
+0x10,
+0x03,
+0xc8,
+0x80,
+0xf0,
+0x84,
+0xb5,
+0xa9,
+0xff,
+0x85,
+0x1e,
+0x64,
+0x20,
+0xa5,
+0xb6,
+0xd0,
+0x3b,
+0xa4,
+0xb4,
+0xc4,
+0xb5,
+0xf0,
+0x79,
+0x5a,
+0x38,
+0xb9,
+0x4a,
+0x6b,
+0xe5,
+0x16,
+0xaa,
+0xb9,
+0x5e,
+0x6b,
+0xe5,
+0x17,
+0xa4,
+0x10,
+0x20,
+0xb7,
+0x0d,
+0x85,
+0x1c,
+0x86,
+0x1d,
+0x48,
+0x0a,
+0x1a,
+0xa4,
+0x20,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x8a,
+0x2a,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x84,
+0x20,
+0x38,
+0x68,
+0xaa,
+0xe5,
+0x1e,
+0x7a,
+0x99,
+0x15,
+0x6b,
+0x86,
+0x1e,
+0xc8,
+0x80,
+0xc7,
+0xa5,
+0x18,
+0xd0,
+0x02,
+0xc6,
+0x19,
+0x3a,
+0x85,
+0x18,
+0xa4,
+0xb5,
+0xc4,
+0xb4,
+0xf0,
+0x35,
+0x5a,
+0x38,
+0xa5,
+0x18,
+0xf9,
+0x49,
+0x6b,
+0xaa,
+0xa5,
+0x19,
+0xf9,
+0x5d,
+0x6b,
+0xa4,
+0x10,
+0x20,
+0xb7,
+0x0d,
+0x85,
+0x1c,
+0x86,
+0x1d,
+0x48,
+0x0a,
+0x1a,
+0xa4,
+0x20,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x8a,
+0x2a,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x84,
+0x20,
+0x38,
+0x68,
+0xaa,
+0xe5,
+0x1e,
+0x7a,
+0x99,
+0x15,
+0x6b,
+0x86,
+0x1e,
+0x88,
+0x80,
+0xc7,
+0xa5,
+0x1a,
+0xa6,
+0x1b,
+0xc5,
+0x1c,
+0xd0,
+0x12,
+0xe4,
+0x1d,
+0xd0,
+0x0e,
+0xa5,
+0x20,
+0xa6,
+0xb6,
+0xd0,
+0x04,
+0xc6,
+0xb5,
+0x80,
+0x22,
+0xe6,
+0xb4,
+0x80,
+0x1e,
+0x0a,
+0x08,
+0x1a,
+0x5a,
+0xa4,
+0x20,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x84,
+0x20,
+0x7a,
+0x6a,
+0x38,
+0xe5,
+0x1e,
+0x99,
+0x15,
+0x6b,
+0x28,
+0x8a,
+0x2a,
+0xa4,
+0x20,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x98,
+0xa4,
+0x1f,
+0x99,
+0x0b,
+0x61,
+0xa5,
+0xb6,
+0xd0,
+0x0d,
+0xa5,
+0x16,
+0xa4,
+0xb4,
+0xf0,
+0x10,
+0x38,
+0xf9,
+0x49,
+0x6b,
+0x3a,
+0x80,
+0x09,
+0xa4,
+0xb5,
+0xb9,
+0x4a,
+0x6b,
+0x38,
+0xe5,
+0x18,
+0x3a,
+0xaa,
+0xa9,
+0x00,
+0xa4,
+0x10,
+0x20,
+0xb7,
+0x0d,
+0xa4,
+0x1f,
+0x99,
+0x07,
+0x60,
+0x98,
+0xd0,
+0x12,
+0xac,
+0x0b,
+0x61,
+0x53,
+0x0b,
+0x60,
+0x33,
+0x60,
+0x98,
+0x4a,
+0xa8,
+0x53,
+0x15,
+0x6b,
+0xc3,
+0x60,
+0x80,
+0x10,
+0xac,
+0x0c,
+0x61,
+0x53,
+0x0b,
+0x60,
+0x5b,
+0x60,
+0x98,
+0x4a,
+0xa8,
+0x53,
+0x15,
+0x6b,
+0xd7,
+0x60,
+0xa6,
+0x1f,
+0xad,
+0xae,
+0x5f,
+0x9d,
+0x0f,
+0x61,
+0xad,
+0x88,
+0x5f,
+0xa8,
+0x29,
+0x04,
+0xf0,
+0x03,
+0xa9,
+0x07,
+0x60,
+0x98,
+0x29,
+0x80,
+0x9d,
+0xc3,
+0x5f,
+0x98,
+0x29,
+0x03,
+0x9d,
+0xc5,
+0x5f,
+0xd0,
+0x03,
+0x9d,
+0xc3,
+0x5f,
+0xa0,
+0x00,
+0x29,
+0x02,
+0xf0,
+0x01,
+0xc8,
+0x98,
+0x9d,
+0xc9,
+0x5f,
+0xad,
+0xab,
+0x5f,
+0xc9,
+0x81,
+0x90,
+0x03,
+0xa9,
+0x1d,
+0x60,
+0x9d,
+0xcb,
+0x5f,
+0xa9,
+0xdf,
+0x9d,
+0xcd,
+0x5f,
+0xa9,
+0x03,
+0x9d,
+0xcf,
+0x5f,
+0xad,
+0x99,
+0x5f,
+0xf0,
+0x03,
+0xa9,
+0x14,
+0x60,
+0xad,
+0x98,
+0x5f,
+0xa8,
+0x29,
+0xf0,
+0xd0,
+0xf5,
+0x98,
+0x29,
+0x01,
+0xd0,
+0x03,
+0xa9,
+0x16,
+0x60,
+0xad,
+0x97,
+0x5f,
+0xf0,
+0x03,
+0xa9,
+0x1c,
+0x60,
+0xad,
+0x96,
+0x5f,
+0xa8,
+0x29,
+0xf0,
+0xd0,
+0xf5,
+0x98,
+0x29,
+0x01,
+0xd0,
+0x03,
+0xa9,
+0x1a,
+0x60,
+0x18,
+0xad,
+0x98,
+0x5f,
+0x6d,
+0x96,
+0x5f,
+0x4a,
+0xc9,
+0x05,
+0x90,
+0x03,
+0xa9,
+0x18,
+0x60,
+0xa8,
+0xb9,
+0x3d,
+0x5a,
+0xf0,
+0xf7,
+0x98,
+0x85,
+0x11,
+0x9d,
+0xd3,
+0x5f,
+0xac,
+0x8d,
+0x5f,
+0xae,
+0x8c,
+0x5f,
+0x20,
+0x12,
+0x07,
+0xf0,
+0x03,
+0xa9,
+0x0a,
+0x60,
+0x98,
+0x4a,
+0x85,
+0x17,
+0x8a,
+0x6a,
+0x85,
+0x16,
+0x90,
+0x03,
+0xa9,
+0x0e,
+0x60,
+0xac,
+0x91,
+0x5f,
+0xae,
+0x90,
+0x5f,
+0x20,
+0x01,
+0x07,
+0xf0,
+0x03,
+0xa9,
+0x0c,
+0x60,
+0x98,
+0x4a,
+0x85,
+0x19,
+0x8a,
+0x6a,
+0x85,
+0x18,
+0xb0,
+0x03,
+0xa9,
+0x10,
+0x60,
+0xe5,
+0x16,
+0x85,
+0x1a,
+0xa5,
+0x19,
+0xe5,
+0x17,
+0x85,
+0x1b,
+0x10,
+0x03,
+0xa9,
+0x12,
+0x60,
+0xa0,
+0x00,
+0xb9,
+0x72,
+0x6b,
+0x38,
+0xe5,
+0x16,
+0xb9,
+0x82,
+0x6b,
+0xe5,
+0x17,
+0x10,
+0x03,
+0xc8,
+0x80,
+0xf0,
+0x84,
+0xbe,
+0xb9,
+0x72,
+0x6b,
+0x38,
+0xe5,
+0x18,
+0xb9,
+0x82,
+0x6b,
+0xe5,
+0x19,
+0x10,
+0x03,
+0xc8,
+0x80,
+0xf0,
+0x84,
+0xbf,
+0xa6,
+0x1a,
+0xa5,
+0x1b,
+0xa4,
+0x11,
+0x20,
+0xb7,
+0x0d,
+0x85,
+0x1a,
+0x86,
+0x1b,
+0xa4,
+0x1f,
+0x99,
+0xdb,
+0x5f,
+0x8a,
+0x99,
+0xdd,
+0x5f,
+0xa9,
+0xff,
+0x85,
+0x1e,
+0x64,
+0x20,
+0xa5,
+0xbd,
+0xd0,
+0x3b,
+0xa4,
+0xbe,
+0xc4,
+0xbf,
+0xf0,
+0x79,
+0x5a,
+0x38,
+0xb9,
+0x72,
+0x6b,
+0xe5,
+0x16,
+0xaa,
+0xb9,
+0x82,
+0x6b,
+0xe5,
+0x17,
+0xa4,
+0x11,
+0x20,
+0xb7,
+0x0d,
+0x85,
+0x1c,
+0x86,
+0x1d,
+0x48,
+0x0a,
+0x1a,
+0xa4,
+0x20,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x8a,
+0x2a,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x84,
+0x20,
+0x38,
+0x68,
+0xaa,
+0xe5,
+0x1e,
+0x7a,
+0x99,
+0x29,
+0x6b,
+0x86,
+0x1e,
+0xc8,
+0x80,
+0xc7,
+0xa5,
+0x18,
+0xd0,
+0x02,
+0xc6,
+0x19,
+0x3a,
+0x85,
+0x18,
+0xa4,
+0xbf,
+0xc4,
+0xbe,
+0xf0,
+0x35,
+0x5a,
+0x38,
+0xa5,
+0x18,
+0xf9,
+0x71,
+0x6b,
+0xaa,
+0xa5,
+0x19,
+0xf9,
+0x81,
+0x6b,
+0xa4,
+0x11,
+0x20,
+0xb7,
+0x0d,
+0x85,
+0x1c,
+0x86,
+0x1d,
+0x48,
+0x0a,
+0x1a,
+0xa4,
+0x20,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x8a,
+0x2a,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x84,
+0x20,
+0x38,
+0x68,
+0xaa,
+0xe5,
+0x1e,
+0x7a,
+0x99,
+0x29,
+0x6b,
+0x86,
+0x1e,
+0x88,
+0x80,
+0xc7,
+0xa5,
+0x1a,
+0xa6,
+0x1b,
+0xc5,
+0x1c,
+0xd0,
+0x1a,
+0xe4,
+0x1d,
+0xd0,
+0x16,
+0xa5,
+0xbe,
+0xc5,
+0xbf,
+0xf0,
+0x0e,
+0xa5,
+0x20,
+0xa6,
+0xbd,
+0xd0,
+0x04,
+0xc6,
+0xbf,
+0x80,
+0x25,
+0xe6,
+0xbe,
+0x80,
+0x21,
+0xa5,
+0x1a,
+0x0a,
+0x08,
+0x1a,
+0x5a,
+0xa4,
+0x20,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x84,
+0x20,
+0x7a,
+0x6a,
+0x38,
+0xe5,
+0x1e,
+0x99,
+0x29,
+0x6b,
+0x28,
+0xa5,
+0x1b,
+0x2a,
+0xa4,
+0x20,
+0x99,
+0x0b,
+0x60,
+0xc8,
+0x98,
+0xa4,
+0x1f,
+0x99,
+0x0d,
+0x61,
+0xa5,
+0xbd,
+0xd0,
+0x0d,
+0xa5,
+0x16,
+0xa4,
+0xbe,
+0xf0,
+0x10,
+0x38,
+0xf9,
+0x71,
+0x6b,
+0x3a,
+0x80,
+0x09,
+0xa4,
+0xbf,
+0xb9,
+0x72,
+0x6b,
+0x38,
+0xe5,
+0x18,
+0x3a,
+0xaa,
+0xa9,
+0x00,
+0xa4,
+0x11,
+0x20,
+0xb7,
+0x0d,
+0xa4,
+0x1f,
+0x99,
+0x09,
+0x60,
+0x98,
+0xd0,
+0x12,
+0xac,
+0x0d,
+0x61,
+0x53,
+0x0b,
+0x60,
+0x83,
+0x60,
+0x98,
+0x4a,
+0xa8,
+0x53,
+0x29,
+0x6b,
+0xeb,
+0x60,
+0x80,
+0x10,
+0xac,
+0x0e,
+0x61,
+0x53,
+0x0b,
+0x60,
+0xa3,
+0x60,
+0x98,
+0x4a,
+0xa8,
+0x53,
+0x29,
+0x6b,
+0xfb,
+0x60,
+0x38,
+0xa5,
+0xbf,
+0xe5,
+0xbe,
+0x85,
+0x1e,
+0x1a,
+0x85,
+0xab,
+0xa5,
+0xbe,
+0xa6,
+0xbd,
+0xf0,
+0x02,
+0xa5,
+0xbf,
+0x85,
+0xb9,
+0x85,
+0xaa,
+0xa5,
+0xbe,
+0xa6,
+0xbd,
+0xf0,
+0x02,
+0xa5,
+0xbf,
+0x49,
+0x3c,
+0x18,
+0x69,
+0x13,
+0x85,
+0xb7,
+0x98,
+0x69,
+0x61,
+0x85,
+0xb8,
+0xa5,
+0xb4,
+0xa6,
+0xb6,
+0xf0,
+0x02,
+0xa5,
+0xb5,
+0x49,
+0x03,
+0x18,
+0x65,
+0xb7,
+0x85,
+0xb7,
+0x98,
+0x65,
+0xb8,
+0x85,
+0xb8,
+0xa0,
+0x02,
+0x53,
+0xb7,
+0x00,
+0xac,
+0x00,
+0x53,
+0xb7,
+0x00,
+0xb2,
+0x00,
+0x53,
+0xb7,
+0x00,
+0xae,
+0x00,
+0xa5,
+0x1e,
+0xd0,
+0x07,
+0x53,
+0xb7,
+0x00,
+0xb0,
+0x00,
+0x80,
+0x20,
+0xa5,
+0xbd,
+0xd0,
+0x0f,
+0x18,
+0xa5,
+0xb7,
+0x69,
+0x3c,
+0x85,
+0xb0,
+0xa5,
+0xb8,
+0x69,
+0x00,
+0x85,
+0xb1,
+0x80,
+0x0d,
+0x38,
+0xa5,
+0xb7,
+0xe9,
+0x3c,
+0x85,
+0xb0,
+0xa5,
+0xb8,
+0xe9,
+0x00,
+0x85,
+0xb1,
+0xa6,
+0x1f,
+0xbd,
+0xc5,
+0x5f,
+0x8d,
+0x12,
+0x61,
+0xa9,
+0x00,
+0xaa,
+0x20,
+0xe4,
+0x39,
+0xa5,
+0xab,
+0xf0,
+0x06,
+0xa9,
+0x01,
+0xaa,
+0x20,
+0xe4,
+0x39,
+0x8a,
+0xa6,
+0x1f,
+0x9d,
+0xdf,
+0x5f,
+0xa9,
+0x01,
+0x9d,
+0xc7,
+0x5f,
+0xa5,
+0xab,
+0x9d,
+0xe1,
+0x5f,
+0xa5,
+0xb7,
+0x9d,
+0xf3,
+0x5f,
+0xa5,
+0xb8,
+0x9d,
+0xf5,
+0x5f,
+0xa5,
+0xac,
+0x9d,
+0xf7,
+0x5f,
+0xa5,
+0xad,
+0x9d,
+0xf9,
+0x5f,
+0xa5,
+0xb2,
+0x9d,
+0xfb,
+0x5f,
+0xa5,
+0xb3,
+0x9d,
+0xfd,
+0x5f,
+0xa5,
+0xae,
+0x9d,
+0xff,
+0x5f,
+0xa5,
+0xaf,
+0x9d,
+0x01,
+0x60,
+0xa5,
+0xb0,
+0x9d,
+0x03,
+0x60,
+0xa5,
+0xb1,
+0x9d,
+0x05,
+0x60,
+0xa5,
+0xb4,
+0x9d,
+0xe3,
+0x5f,
+0xa5,
+0xb5,
+0x9d,
+0xe5,
+0x5f,
+0xa5,
+0xbe,
+0x9d,
+0xe7,
+0x5f,
+0xa5,
+0xbf,
+0x9d,
+0xe9,
+0x5f,
+0xa5,
+0xaa,
+0x9d,
+0xeb,
+0x5f,
+0xa5,
+0xb9,
+0x9d,
+0xed,
+0x5f,
+0xa9,
+0x00,
+0x60,
+0xc0,
+0x01,
+0xd0,
+0x04,
+0xa8,
+0x8a,
+0xfc,
+0x60,
+0x85,
+0x12,
+0x98,
+0xc9,
+0x01,
+0xf0,
+0x0e,
+0x29,
+0x01,
+0xd0,
+0x0e,
+0x46,
+0x12,
+0x8a,
+0x6a,
+0xaa,
+0x98,
+0x4a,
+0xa8,
+0x80,
+0xee,
+0x8a,
+0xa6,
+0x12,
+0x60,
+0x8a,
+0x1a,
+0xd0,
+0x02,
+0xe6,
+0x12,
+0x49,
+0x55,
+0x84,
+0x14,
+0x18,
+0x65,
+0x14,
+0x85,
+0x13,
+0x90,
+0x03,
+0xe6,
+0x14,
+0x18,
+0xa5,
+0x12,
+0x49,
+0x55,
+0x84,
+0x15,
+0xaa,
+0x65,
+0x13,
+0x8a,
+0x65,
+0x14,
+0x85,
+0x14,
+0xa5,
+0x15,
+0x90,
+0x03,
+0xe6,
+0x15,
+0x18,
+0x65,
+0x14,
+0xa6,
+0x15,
+0x90,
+0x01,
+0xe8,
+0x60,
+0xa9,
+0x01,
+0x8d,
+0x04,
+0xc0,
+0x4c,
+0x00,
+0x03,
+0x08,
+0x68,
+0x8d,
+0xb2,
+0x6b,
+0x64,
+0x25,
+0x08,
+0x78,
+0xa5,
+0x25,
+0xc9,
+0x01,
+0xf0,
+0x04,
+0x28,
+0x5c,
+0x80,
+0xf4,
+0x28,
+0x20,
+0xc4,
+0x0e,
+0x08,
+0x78,
+0xa5,
+0x24,
+0xd0,
+0x04,
+0x28,
+0x5c,
+0x80,
+0xf6,
+0xc6,
+0x24,
+0x28,
+0xa5,
+0x60,
+0x85,
+0x67,
+0x20,
+0x41,
+0x1d,
+0xa5,
+0x60,
+0xa6,
+0x23,
+0xf0,
+0x07,
+0xc5,
+0x27,
+0xf0,
+0x0d,
+0x1a,
+0x80,
+0x05,
+0xc5,
+0x26,
+0xf0,
+0x06,
+0x3a,
+0x85,
+0x67,
+0x20,
+0x72,
+0x1f,
+0xa5,
+0x27,
+0xa6,
+0x23,
+0xf0,
+0x02,
+0xa5,
+0x26,
+0xc5,
+0x60,
+0xf0,
+0x0b,
+0x8a,
+0xf0,
+0x04,
+0xc6,
+0x60,
+0x80,
+0xc2,
+0xe6,
+0x60,
+0x80,
+0xbe,
+0x85,
+0x67,
+0x20,
+0x72,
+0x1f,
+0x20,
+0xf2,
+0x29,
+0x80,
+0xa4,
+0x18,
+0x69,
+0x14,
+0x90,
+0x01,
+0xc8,
+0xda,
+0x85,
+0x32,
+0x84,
+0x33,
+0x49,
+0x66,
+0x84,
+0x34,
+0xa5,
+0x33,
+0x49,
+0x66,
+0x18,
+0x65,
+0x34,
+0x85,
+0x34,
+0x98,
+0x69,
+0x00,
+0x85,
+0x35,
+0xa5,
+0x32,
+0x49,
+0x06,
+0x18,
+0x65,
+0x34,
+0xaa,
+0x98,
+0x65,
+0x35,
+0x85,
+0x35,
+0xa5,
+0x33,
+0x49,
+0x06,
+0x18,
+0x65,
+0x35,
+0xe0,
+0xfa,
+0x90,
+0x01,
+0x1a,
+0xfa,
+0x60,
+0x18,
+0x69,
+0x10,
+0x90,
+0x01,
+0xc8,
+0x84,
+0x32,
+0x46,
+0x32,
+0x6a,
+0x46,
+0x32,
+0x6a,
+0x46,
+0x32,
+0x6a,
+0x46,
+0x32,
+0x6a,
+0x46,
+0x32,
+0x6a,
+0x60,
+0xa0,
+0x12,
+0x64,
+0x6e,
+0x64,
+0x6f,
+0x64,
+0x70,
+0x64,
+0x71,
+0x13,
+0x6e,
+0x00,
+0x5f,
+0x81,
+0x64,
+0x72,
+0x64,
+0x73,
+0xa0,
+0x48,
+0x13,
+0x6e,
+0x00,
+0x71,
+0x81,
+0x13,
+0x6e,
+0x00,
+0xb9,
+0x81,
+0x13,
+0x6e,
+0x00,
+0x01,
+0x82,
+0xad,
+0xb5,
+0x6b,
+0xae,
+0xb4,
+0x6b,
+0xd0,
+0x05,
+0xcd,
+0xb6,
+0x6b,
+0xf0,
+0x0f,
+0x20,
+0xc6,
+0x0f,
+0x20,
+0xb1,
+0x10,
+0xad,
+0xb5,
+0x6b,
+0x8d,
+0xb6,
+0x6b,
+0x9c,
+0xb4,
+0x6b,
+0xa6,
+0x26,
+0x9e,
+0x15,
+0x75,
+0x9e,
+0x27,
+0x75,
+0xa9,
+0x00,
+0xa8,
+0xe4,
+0x27,
+0xf0,
+0x19,
+0x9d,
+0x16,
+0x75,
+0x48,
+0x98,
+0x9d,
+0x28,
+0x75,
+0x68,
+0xc9,
+0x28,
+0xf0,
+0x06,
+0x18,
+0x69,
+0x14,
+0xc8,
+0x80,
+0x03,
+0xa9,
+0x00,
+0xa8,
+0xe8,
+0x80,
+0xe3,
+0x9d,
+0x16,
+0x75,
+0x9d,
+0x17,
+0x75,
+0x98,
+0x9d,
+0x28,
+0x75,
+0x9d,
+0x29,
+0x75,
+0x38,
+0xa5,
+0x29,
+0xe5,
+0x28,
+0xaa,
+0x1a,
+0x85,
+0x2e,
+0xbd,
+0x42,
+0x5a,
+0x85,
+0x2c,
+0xa2,
+0x00,
+0x8a,
+0x0a,
+0x1a,
+0x45,
+0x2e,
+0x20,
+0x7a,
+0x0e,
+0x9d,
+0xb7,
+0x7d,
+0xe8,
+0xe0,
+0x14,
+0x90,
+0xf0,
+0xa2,
+0x00,
+0xbd,
+0xb7,
+0x7d,
+0xdd,
+0xb8,
+0x7d,
+0xd0,
+0x05,
+0x09,
+0x80,
+0x9d,
+0xb7,
+0x7d,
+0xe8,
+0xe0,
+0x13,
+0x90,
+0xee,
+0x38,
+0xa5,
+0x27,
+0xe5,
+0x26,
+0xaa,
+0x1a,
+0x85,
+0x2e,
+0xbd,
+0x56,
+0x5a,
+0x85,
+0x2d,
+0xa2,
+0x00,
+0x8a,
+0x0a,
+0x1a,
+0x45,
+0x2e,
+0x20,
+0xb2,
+0x0e,
+0x9d,
+0xcb,
+0x7d,
+0xe8,
+0xe0,
+0x10,
+0x90,
+0xf0,
+0xa5,
+0x23,
+0xf0,
+0x14,
+0xa2,
+0x0f,
+0xbd,
+0xcb,
+0x7d,
+0xdd,
+0xca,
+0x7d,
+0xd0,
+0x05,
+0x09,
+0x80,
+0x9d,
+0xcb,
+0x7d,
+0xca,
+0xd0,
+0xf0,
+0x80,
+0x14,
+0xa2,
+0x00,
+0xbd,
+0xcb,
+0x7d,
+0xdd,
+0xcc,
+0x7d,
+0xd0,
+0x05,
+0x09,
+0x80,
+0x9d,
+0xcb,
+0x7d,
+0xe8,
+0xe0,
+0x0f,
+0x90,
+0xee,
+0xa9,
+0x00,
+0xa6,
+0x23,
+0xf0,
+0x02,
+0xa9,
+0x0f,
+0x85,
+0x8a,
+0xe6,
+0x25,
+0x60,
+0x85,
+0x2e,
+0xa9,
+0x39,
+0x85,
+0x4a,
+0xa9,
+0xbe,
+0x85,
+0x4b,
+0xa2,
+0x00,
+0xa0,
+0x5a,
+0xa5,
+0x2e,
+0xd1,
+0x4a,
+0x90,
+0x19,
+0xe0,
+0x04,
+0xf0,
+0x0e,
+0xe8,
+0x18,
+0xa5,
+0x4a,
+0x69,
+0x5b,
+0x85,
+0x4a,
+0x90,
+0xec,
+0xe6,
+0x4b,
+0x80,
+0xe8,
+0xa0,
+0x5a,
+0xd3,
+0x4a,
+0xbb,
+0x6b,
+0x60,
+0x8a,
+0xf0,
+0xf6,
+0xb1,
+0x4a,
+0x85,
+0x30,
+0x38,
+0xa5,
+0x4a,
+0xe9,
+0x5b,
+0x85,
+0x4c,
+0xa5,
+0x4b,
+0xe9,
+0x00,
+0x85,
+0x4d,
+0xb1,
+0x4c,
+0x85,
+0x2f,
+0xc5,
+0x2e,
+0xd0,
+0x07,
+0xa0,
+0x5a,
+0xd3,
+0x4c,
+0xbb,
+0x6b,
+0x60,
+0x38,
+0xa5,
+0x30,
+0xe5,
+0x2e,
+0x85,
+0x33,
+0x64,
+0x32,
+0x38,
+0xa5,
+0x30,
+0xe5,
+0x2f,
+0x85,
+0x34,
+0x64,
+0x35,
+0x20,
+0x2a,
+0x39,
+0xa5,
+0x32,
+0x85,
+0x2e,
+0xa9,
+0x00,
+0x38,
+0xe5,
+0x2e,
+0x85,
+0x2f,
+0xa9,
+0x06,
+0x85,
+0x34,
+0xa2,
+0x00,
+0x64,
+0x35,
+0xdc,
+0xb1,
+0x4c,
+0x85,
+0x30,
+0xb1,
+0x4a,
+0x10,
+0x20,
+0xa4,
+0x35,
+0xf0,
+0x1c,
+0x85,
+0x31,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x31,
+0x45,
+0x2f,
+0x85,
+0x31,
+0xa9,
+0x00,
+0x38,
+0xe5,
+0x31,
+0x85,
+0x32,
+0x84,
+0x31,
+0xa9,
+0x00,
+0xe5,
+0x31,
+0x85,
+0x33,
+0x80,
+0x06,
+0x45,
+0x2f,
+0x85,
+0x32,
+0x84,
+0x33,
+0xa5,
+0x30,
+0x10,
+0x1e,
+0xa4,
+0x35,
+0xf0,
+0x1a,
+0x85,
+0x31,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x31,
+0x45,
+0x2e,
+0x85,
+0x31,
+0x38,
+0xa5,
+0x32,
+0xe5,
+0x31,
+0x85,
+0x32,
+0x84,
+0x31,
+0xa5,
+0x33,
+0xe5,
+0x31,
+0x80,
+0x0a,
+0x45,
+0x2e,
+0x18,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x65,
+0x33,
+0xa8,
+0xa5,
+0x32,
+0x10,
+0x01,
+0xc8,
+0x98,
+0x9d,
+0xbb,
+0x6b,
+0xe8,
+0xe6,
+0x35,
+0xa5,
+0x35,
+0xc9,
+0x0f,
+0xd0,
+0x92,
+0xc6,
+0x34,
+0xd0,
+0x8c,
+0x60,
+0xa9,
+0x39,
+0x85,
+0x4a,
+0xa9,
+0x75,
+0x85,
+0x4b,
+0xa9,
+0x76,
+0x85,
+0x4c,
+0xa9,
+0x40,
+0x85,
+0x4d,
+0x64,
+0x38,
+0xa0,
+0x11,
+0x13,
+0x38,
+0x00,
+0x39,
+0x00,
+0xa9,
+0x11,
+0x85,
+0x30,
+0xa9,
+0x15,
+0x85,
+0x31,
+0xa0,
+0x0e,
+0xd3,
+0x4c,
+0x50,
+0x00,
+0x64,
+0x4e,
+0xa2,
+0x00,
+0xa9,
+0x06,
+0x85,
+0x2e,
+0x18,
+0xbd,
+0xbc,
+0x6b,
+0x3c,
+0x45,
+0x50,
+0x85,
+0x32,
+0x98,
+0x10,
+0x09,
+0x7d,
+0xbb,
+0x6b,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x80,
+0x07,
+0x7d,
+0xbb,
+0x6b,
+0x85,
+0x33,
+0xa9,
+0x00,
+0x69,
+0x00,
+0x85,
+0x34,
+0x18,
+0xbd,
+0xbd,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x51,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xbe,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x52,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xbf,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x53,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xc0,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x54,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xc1,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x55,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xc2,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x56,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xc3,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x57,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xc4,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x58,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xc5,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x59,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xc6,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x5a,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xc7,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x5b,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xc8,
+0x6b,
+0xf0,
+0x20,
+0x3c,
+0x45,
+0x5c,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x0d,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x65,
+0x34,
+0x85,
+0x34,
+0x18,
+0x80,
+0x09,
+0x65,
+0x33,
+0x85,
+0x33,
+0x90,
+0x03,
+0x18,
+0xe6,
+0x34,
+0xbd,
+0xc9,
+0x6b,
+0x3c,
+0x45,
+0x5d,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x10,
+0x08,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0xff,
+0x80,
+0x06,
+0x65,
+0x33,
+0x85,
+0x33,
+0xa9,
+0x00,
+0x65,
+0x34,
+0xf0,
+0x0a,
+0x10,
+0x04,
+0xa9,
+0x00,
+0x80,
+0x0e,
+0xa9,
+0xff,
+0x80,
+0x0a,
+0xa5,
+0x33,
+0xa4,
+0x32,
+0x10,
+0x04,
+0x1a,
+0xd0,
+0x01,
+0x3a,
+0x92,
+0x4a,
+0xda,
+0xa6,
+0x4e,
+0x18,
+0x75,
+0x38,
+0x95,
+0x38,
+0x90,
+0x07,
+0x18,
+0xf6,
+0x39,
+0xd0,
+0x02,
+0xf6,
+0x3a,
+0xe8,
+0xe8,
+0xe8,
+0x86,
+0x4e,
+0xe6,
+0x4a,
+0xd0,
+0x02,
+0xe6,
+0x4b,
+0x68,
+0x69,
+0x0f,
+0xaa,
+0xc6,
+0x2e,
+0xf0,
+0x03,
+0x4c,
+0xe1,
+0x10,
+0xa5,
+0x4c,
+0x69,
+0x0e,
+0x85,
+0x4c,
+0x90,
+0x02,
+0xe6,
+0x4d,
+0xc6,
+0x31,
+0xf0,
+0x03,
+0x4c,
+0xd2,
+0x10,
+0xc6,
+0x30,
+0xf0,
+0x03,
+0x4c,
+0xce,
+0x10,
+0x64,
+0x2e,
+0xa5,
+0x2e,
+0x49,
+0x09,
+0xa8,
+0xa2,
+0x00,
+0xa9,
+0x03,
+0x85,
+0x2f,
+0xb9,
+0x38,
+0x00,
+0x0a,
+0x48,
+0xb9,
+0x39,
+0x00,
+0x2a,
+0x95,
+0x50,
+0xb9,
+0x3a,
+0x00,
+0x2a,
+0x95,
+0x51,
+0x68,
+0x0a,
+0x90,
+0x06,
+0xf6,
+0x50,
+0xd0,
+0x02,
+0xf6,
+0x51,
+0xc8,
+0xc8,
+0xc8,
+0xe8,
+0xe8,
+0xc6,
+0x2f,
+0xd0,
+0xdc,
+0xa0,
+0x00,
+0x38,
+0xa5,
+0x50,
+0xe5,
+0x52,
+0x85,
+0x2f,
+0xa5,
+0x51,
+0xe5,
+0x53,
+0x08,
+0x05,
+0x2f,
+0x85,
+0x2f,
+0xd0,
+0x01,
+0xc8,
+0x38,
+0xa5,
+0x52,
+0xe5,
+0x54,
+0x85,
+0x30,
+0xa5,
+0x53,
+0xe5,
+0x55,
+0x08,
+0x05,
+0x30,
+0x85,
+0x30,
+0xd0,
+0x01,
+0xc8,
+0x38,
+0xa5,
+0x54,
+0xe5,
+0x50,
+0x85,
+0x31,
+0xa5,
+0x55,
+0xe5,
+0x51,
+0x08,
+0x05,
+0x31,
+0x85,
+0x31,
+0xd0,
+0x01,
+0xc8,
+0xa6,
+0x2e,
+0x98,
+0x95,
+0xdc,
+0xa9,
+0x00,
+0xa8,
+0x28,
+0xb0,
+0x03,
+0x69,
+0x04,
+0xc8,
+0x28,
+0xb0,
+0x03,
+0x1a,
+0x1a,
+0xc8,
+0x28,
+0xb0,
+0x02,
+0x1a,
+0xc8,
+0xc0,
+0x01,
+0xd0,
+0x26,
+0xc9,
+0x01,
+0xd0,
+0x08,
+0xa4,
+0x30,
+0xd0,
+0x1e,
+0xa9,
+0x00,
+0x80,
+0x1a,
+0xc9,
+0x02,
+0xd0,
+0x08,
+0xa4,
+0x2f,
+0xd0,
+0x12,
+0xa9,
+0x00,
+0x80,
+0x0e,
+0xa4,
+0x2f,
+0xd0,
+0x04,
+0xa9,
+0x05,
+0x80,
+0x06,
+0xa4,
+0x30,
+0xd0,
+0x02,
+0xa9,
+0x06,
+0x49,
+0x03,
+0xa8,
+0xb9,
+0x3d,
+0x40,
+0x85,
+0x5d,
+0xb9,
+0x3e,
+0x40,
+0x85,
+0x5e,
+0xb9,
+0x3f,
+0x40,
+0x85,
+0x5f,
+0xa6,
+0x5e,
+0xa4,
+0x5d,
+0x98,
+0x0a,
+0xa8,
+0xb9,
+0x50,
+0x00,
+0x85,
+0x32,
+0xb9,
+0x51,
+0x00,
+0x85,
+0x33,
+0xa5,
+0x2e,
+0x49,
+0x06,
+0xaa,
+0xa0,
+0x00,
+0x38,
+0xb9,
+0x50,
+0x00,
+0xe5,
+0x32,
+0x9d,
+0x97,
+0x7d,
+0xb9,
+0x51,
+0x00,
+0xe5,
+0x33,
+0x9d,
+0x98,
+0x7d,
+0xe8,
+0xe8,
+0xc8,
+0xc8,
+0xc0,
+0x06,
+0xd0,
+0xe7,
+0xa5,
+0x2e,
+0x49,
+0x03,
+0xaa,
+0xa5,
+0x5d,
+0x9d,
+0xa3,
+0x7d,
+0xa5,
+0x5e,
+0x9d,
+0xa4,
+0x7d,
+0xa5,
+0x5f,
+0x9d,
+0xa5,
+0x7d,
+0xa5,
+0x2e,
+0x49,
+0x06,
+0xa8,
+0x18,
+0x65,
+0x5f,
+0x65,
+0x5f,
+0xaa,
+0xbd,
+0x98,
+0x7d,
+0x85,
+0x6b,
+0xbd,
+0x97,
+0x7d,
+0x85,
+0x6a,
+0x98,
+0x18,
+0x65,
+0x5e,
+0x65,
+0x5e,
+0xaa,
+0xbd,
+0x98,
+0x7d,
+0x85,
+0x69,
+0xbd,
+0x97,
+0x7d,
+0x85,
+0x68,
+0x49,
+0x10,
+0x85,
+0x32,
+0x84,
+0x33,
+0x18,
+0xa5,
+0x69,
+0x49,
+0x10,
+0x65,
+0x33,
+0x85,
+0x33,
+0x38,
+0xa5,
+0x6a,
+0xe5,
+0x68,
+0x85,
+0x34,
+0xa5,
+0x6b,
+0xe5,
+0x69,
+0x85,
+0x35,
+0x20,
+0x4e,
+0x39,
+0xa0,
+0x02,
+0x53,
+0x32,
+0x00,
+0x56,
+0x00,
+0x18,
+0xa5,
+0x68,
+0x65,
+0x6a,
+0x85,
+0x58,
+0xa5,
+0x69,
+0x65,
+0x6b,
+0x85,
+0x59,
+0xa5,
+0x56,
+0x45,
+0x68,
+0x85,
+0x5a,
+0x84,
+0x5b,
+0xa5,
+0x57,
+0x45,
+0x68,
+0x18,
+0x65,
+0x5b,
+0x85,
+0x5b,
+0x98,
+0x69,
+0x00,
+0x85,
+0x5c,
+0xa5,
+0x56,
+0x45,
+0x69,
+0x18,
+0x65,
+0x5b,
+0x85,
+0x5b,
+0x98,
+0x65,
+0x5c,
+0x85,
+0x5c,
+0xa5,
+0x57,
+0x45,
+0x69,
+0x18,
+0x65,
+0x5c,
+0x85,
+0x5c,
+0xa5,
+0x2e,
+0x49,
+0x07,
+0x18,
+0x69,
+0xa9,
+0x85,
+0x4c,
+0xa9,
+0x7d,
+0x69,
+0x00,
+0x85,
+0x4d,
+0xa0,
+0x07,
+0x73,
+0x56,
+0x00,
+0x4c,
+0xa5,
+0x2e,
+0x1a,
+0xc9,
+0x02,
+0xf0,
+0x05,
+0x85,
+0x2e,
+0x4c,
+0x33,
+0x13,
+0x60,
+0xa2,
+0x00,
+0xa8,
+0x30,
+0x04,
+0xe8,
+0x0a,
+0x10,
+0xfc,
+0xbd,
+0x52,
+0x40,
+0xaa,
+0x60,
+0xa5,
+0x9a,
+0x05,
+0x9e,
+0x05,
+0xa2,
+0x05,
+0xa6,
+0xf0,
+0x33,
+0x20,
+0xdf,
+0x14,
+0x45,
+0x99,
+0x84,
+0xea,
+0x8a,
+0x45,
+0x9a,
+0x05,
+0xea,
+0x85,
+0xea,
+0x8a,
+0x45,
+0x9d,
+0x84,
+0xeb,
+0x8a,
+0x45,
+0x9e,
+0x05,
+0xeb,
+0x85,
+0xeb,
+0x8a,
+0x45,
+0xa1,
+0x84,
+0xec,
+0x8a,
+0x45,
+0xa2,
+0x05,
+0xec,
+0x85,
+0xec,
+0x8a,
+0x45,
+0xa5,
+0x84,
+0xed,
+0x8a,
+0x45,
+0xa6,
+0x05,
+0xed,
+0x85,
+0xed,
+0x60,
+0xa5,
+0x99,
+0x05,
+0x9d,
+0x05,
+0xa1,
+0x05,
+0xa5,
+0xf0,
+0x33,
+0x20,
+0xdf,
+0x14,
+0x45,
+0x98,
+0x84,
+0xea,
+0x8a,
+0x45,
+0x99,
+0x05,
+0xea,
+0x85,
+0xea,
+0x8a,
+0x45,
+0x9c,
+0x84,
+0xeb,
+0x8a,
+0x45,
+0x9d,
+0x05,
+0xeb,
+0x85,
+0xeb,
+0x8a,
+0x45,
+0xa0,
+0x84,
+0xec,
+0x8a,
+0x45,
+0xa1,
+0x05,
+0xec,
+0x85,
+0xec,
+0x8a,
+0x45,
+0xa4,
+0x84,
+0xed,
+0x8a,
+0x45,
+0xa5,
+0x05,
+0xed,
+0x85,
+0xed,
+0x60,
+0xa5,
+0x98,
+0x85,
+0xea,
+0xa5,
+0x9c,
+0x85,
+0xeb,
+0xa5,
+0xa0,
+0x85,
+0xec,
+0xa5,
+0xa4,
+0x85,
+0xed,
+0x60,
+0xaa,
+0x45,
+0xc8,
+0x84,
+0xcb,
+0x8a,
+0x45,
+0xc9,
+0x18,
+0x65,
+0xcb,
+0x90,
+0x01,
+0xc8,
+0x84,
+0xe7,
+0x8a,
+0x45,
+0xcc,
+0x84,
+0xcf,
+0x8a,
+0x45,
+0xcd,
+0x18,
+0x65,
+0xcf,
+0x90,
+0x01,
+0xc8,
+0x98,
+0x0a,
+0x0a,
+0x0a,
+0x85,
+0xe8,
+0x8a,
+0x45,
+0xc4,
+0x84,
+0xc7,
+0x8a,
+0x45,
+0xc5,
+0x18,
+0x65,
+0xc7,
+0x90,
+0x02,
+0x18,
+0xc8,
+0x85,
+0xc4,
+0x84,
+0xc5,
+0x8a,
+0x45,
+0xc6,
+0x65,
+0xc5,
+0x85,
+0xc5,
+0x8a,
+0x45,
+0xd0,
+0x84,
+0xd3,
+0x8a,
+0x45,
+0xd1,
+0x18,
+0x65,
+0xd3,
+0x90,
+0x02,
+0x18,
+0xc8,
+0x85,
+0xd0,
+0x84,
+0xd1,
+0x8a,
+0x45,
+0xd2,
+0x65,
+0xd1,
+0x85,
+0xd1,
+0x18,
+0xa5,
+0xc4,
+0x65,
+0xd0,
+0xa5,
+0xc5,
+0x65,
+0xd1,
+0x6a,
+0xa8,
+0x90,
+0x04,
+0x1a,
+0xd0,
+0x01,
+0x3a,
+0x85,
+0xe9,
+0x98,
+0x4a,
+0x4a,
+0x49,
+0x20,
+0x05,
+0xe7,
+0x85,
+0xe7,
+0x98,
+0x05,
+0xe8,
+0x85,
+0xe8,
+0x38,
+0xa5,
+0xc4,
+0xe5,
+0xd0,
+0xaa,
+0xa5,
+0xc5,
+0xe5,
+0xd1,
+0xb0,
+0x52,
+0x38,
+0xa5,
+0xd0,
+0xe5,
+0xc4,
+0x85,
+0xca,
+0xa5,
+0xd1,
+0xe5,
+0xc5,
+0x85,
+0xcb,
+0xa4,
+0xe9,
+0xb9,
+0x66,
+0x5a,
+0xaa,
+0x45,
+0xca,
+0x84,
+0xc4,
+0x8a,
+0x45,
+0xcb,
+0x18,
+0x65,
+0xc4,
+0x85,
+0xc4,
+0x98,
+0x69,
+0x00,
+0xa4,
+0xe9,
+0xbe,
+0x66,
+0x5b,
+0xf0,
+0x14,
+0x85,
+0xc5,
+0x8a,
+0x45,
+0xca,
+0x18,
+0x65,
+0xc4,
+0x85,
+0xc4,
+0x98,
+0x65,
+0xc5,
+0x85,
+0xc5,
+0x8a,
+0x45,
+0xcb,
+0x65,
+0xc5,
+0xa6,
+0xc4,
+0x10,
+0x01,
+0x1a,
+0xc9,
+0x27,
+0x90,
+0x02,
+0xa9,
+0x26,
+0x85,
+0xe6,
+0xa9,
+0x00,
+0x38,
+0xe5,
+0xe6,
+0x85,
+0xe6,
+0x60,
+0x86,
+0xca,
+0x85,
+0xcb,
+0xa4,
+0xe9,
+0xb9,
+0x66,
+0x5a,
+0xaa,
+0x45,
+0xca,
+0x84,
+0xc4,
+0x8a,
+0x45,
+0xcb,
+0x18,
+0x65,
+0xc4,
+0x85,
+0xc4,
+0x98,
+0x69,
+0x00,
+0xa4,
+0xe9,
+0xbe,
+0x66,
+0x5b,
+0xf0,
+0x14,
+0x85,
+0xc5,
+0x8a,
+0x45,
+0xca,
+0x18,
+0x65,
+0xc4,
+0x85,
+0xc4,
+0x98,
+0x65,
+0xc5,
+0x85,
+0xc5,
+0x8a,
+0x45,
+0xcb,
+0x65,
+0xc5,
+0xa6,
+0xc4,
+0x10,
+0x01,
+0x1a,
+0xc9,
+0x27,
+0x90,
+0x02,
+0xa9,
+0x26,
+0x85,
+0xe6,
+0x60,
+0xa5,
+0xc4,
+0x0a,
+0xa5,
+0xc5,
+0x2a,
+0x85,
+0xc4,
+0xa5,
+0xc6,
+0x2a,
+0x85,
+0xc5,
+0xa5,
+0xc7,
+0x2a,
+0x85,
+0xc6,
+0xa5,
+0xc9,
+0x4a,
+0x4a,
+0x85,
+0xc8,
+0xa5,
+0xca,
+0x49,
+0x40,
+0x05,
+0xc8,
+0x85,
+0xc8,
+0x84,
+0xc9,
+0xa5,
+0xcb,
+0x49,
+0x40,
+0x05,
+0xc9,
+0x85,
+0xc9,
+0x84,
+0xca,
+0xa5,
+0xcd,
+0x4a,
+0x4a,
+0x85,
+0xcc,
+0xa5,
+0xce,
+0x49,
+0x40,
+0x05,
+0xcc,
+0x85,
+0xcc,
+0x84,
+0xcd,
+0xa5,
+0xcf,
+0x49,
+0x40,
+0x05,
+0xcd,
+0x85,
+0xcd,
+0x84,
+0xce,
+0xa5,
+0xd0,
+0x0a,
+0xa5,
+0xd1,
+0x2a,
+0x85,
+0xd0,
+0xa5,
+0xd2,
+0x2a,
+0x85,
+0xd1,
+0xa5,
+0xd3,
+0x2a,
+0x85,
+0xd2,
+0x60,
+0xa5,
+0xc4,
+0x49,
+0x04,
+0x84,
+0xc4,
+0xa5,
+0xc5,
+0x49,
+0x04,
+0x05,
+0xc4,
+0x85,
+0xc4,
+0x84,
+0xc5,
+0xa5,
+0xc6,
+0x49,
+0x04,
+0x05,
+0xc5,
+0x85,
+0xc5,
+0x84,
+0xc6,
+0xa5,
+0xc9,
+0x4a,
+0x85,
+0xc8,
+0xa5,
+0xca,
+0x49,
+0x80,
+0x05,
+0xc8,
+0x85,
+0xc8,
+0x84,
+0xc9,
+0xa5,
+0xcb,
+0x49,
+0x80,
+0x05,
+0xc9,
+0x85,
+0xc9,
+0x84,
+0xca,
+0xa5,
+0xcd,
+0x4a,
+0x85,
+0xcc,
+0xa5,
+0xce,
+0x49,
+0x80,
+0x05,
+0xcc,
+0x85,
+0xcc,
+0x84,
+0xcd,
+0xa5,
+0xcf,
+0x49,
+0x80,
+0x05,
+0xcd,
+0x85,
+0xcd,
+0x84,
+0xce,
+0xa5,
+0xd0,
+0x49,
+0x04,
+0x84,
+0xd0,
+0xa5,
+0xd1,
+0x49,
+0x04,
+0x05,
+0xd0,
+0x85,
+0xd0,
+0x84,
+0xd1,
+0xa5,
+0xd2,
+0x49,
+0x04,
+0x05,
+0xd1,
+0x85,
+0xd1,
+0x84,
+0xd2,
+0x60,
+0xa5,
+0xc4,
+0x49,
+0x08,
+0x84,
+0xc4,
+0xa5,
+0xc5,
+0x49,
+0x08,
+0x05,
+0xc4,
+0x85,
+0xc4,
+0x84,
+0xc5,
+0xa5,
+0xc6,
+0x49,
+0x08,
+0x05,
+0xc5,
+0x85,
+0xc5,
+0x84,
+0xc6,
+0xa5,
+0xc9,
+0x85,
+0xc8,
+0xa5,
+0xca,
+0x85,
+0xc9,
+0xa5,
+0xcb,
+0x85,
+0xca,
+0xa5,
+0xcd,
+0x85,
+0xcc,
+0xa5,
+0xce,
+0x85,
+0xcd,
+0xa5,
+0xcf,
+0x85,
+0xce,
+0xa5,
+0xd0,
+0x49,
+0x08,
+0x84,
+0xd0,
+0xa5,
+0xd1,
+0x49,
+0x08,
+0x05,
+0xd0,
+0x85,
+0xd0,
+0x84,
+0xd1,
+0xa5,
+0xd2,
+0x49,
+0x08,
+0x05,
+0xd1,
+0x85,
+0xd1,
+0x84,
+0xd2,
+0x60,
+0x46,
+0xc6,
+0x66,
+0xc5,
+0x66,
+0xc4,
+0x46,
+0xc6,
+0x66,
+0xc5,
+0x66,
+0xc4,
+0x46,
+0xc6,
+0x66,
+0xc5,
+0x66,
+0xc4,
+0x46,
+0xc6,
+0x66,
+0xc5,
+0x66,
+0xc4,
+0xa5,
+0xc8,
+0x0a,
+0xa5,
+0xc9,
+0x2a,
+0x85,
+0xc8,
+0xa5,
+0xca,
+0x2a,
+0x85,
+0xc9,
+0xa5,
+0xcb,
+0x2a,
+0x85,
+0xca,
+0xa5,
+0xcc,
+0x0a,
+0xa5,
+0xcd,
+0x2a,
+0x85,
+0xcc,
+0xa5,
+0xce,
+0x2a,
+0x85,
+0xcd,
+0xa5,
+0xcf,
+0x2a,
+0x85,
+0xce,
+0x46,
+0xd2,
+0x66,
+0xd1,
+0x66,
+0xd0,
+0x46,
+0xd2,
+0x66,
+0xd1,
+0x66,
+0xd0,
+0x46,
+0xd2,
+0x66,
+0xd1,
+0x66,
+0xd0,
+0x46,
+0xd2,
+0x66,
+0xd1,
+0x66,
+0xd0,
+0x60,
+0x46,
+0xc6,
+0x66,
+0xc5,
+0x66,
+0xc4,
+0x46,
+0xc6,
+0x66,
+0xc5,
+0x66,
+0xc4,
+0x46,
+0xc6,
+0x66,
+0xc5,
+0x66,
+0xc4,
+0xa5,
+0xc8,
+0x49,
+0x04,
+0x84,
+0xc8,
+0xa5,
+0xc9,
+0x49,
+0x04,
+0x05,
+0xc8,
+0x85,
+0xc8,
+0x84,
+0xc9,
+0xa5,
+0xca,
+0x49,
+0x04,
+0x05,
+0xc9,
+0x85,
+0xc9,
+0x84,
+0xca,
+0xa5,
+0xcc,
+0x49,
+0x04,
+0x84,
+0xcc,
+0xa5,
+0xcd,
+0x49,
+0x04,
+0x05,
+0xcc,
+0x85,
+0xcc,
+0x84,
+0xcd,
+0xa5,
+0xce,
+0x49,
+0x04,
+0x05,
+0xcd,
+0x85,
+0xcd,
+0x84,
+0xce,
+0x46,
+0xd2,
+0x66,
+0xd1,
+0x66,
+0xd0,
+0x46,
+0xd2,
+0x66,
+0xd1,
+0x66,
+0xd0,
+0x46,
+0xd2,
+0x66,
+0xd1,
+0x66,
+0xd0,
+0x60,
+0x46,
+0xc6,
+0x66,
+0xc5,
+0x66,
+0xc4,
+0x46,
+0xc6,
+0x66,
+0xc5,
+0x66,
+0xc4,
+0xa5,
+0xc8,
+0x49,
+0x08,
+0x84,
+0xc8,
+0xa5,
+0xc9,
+0x49,
+0x08,
+0x05,
+0xc8,
+0x85,
+0xc8,
+0x84,
+0xc9,
+0xa5,
+0xca,
+0x49,
+0x08,
+0x05,
+0xc9,
+0x85,
+0xc9,
+0x84,
+0xca,
+0xa5,
+0xcc,
+0x49,
+0x08,
+0x84,
+0xcc,
+0xa5,
+0xcd,
+0x49,
+0x08,
+0x05,
+0xcc,
+0x85,
+0xcc,
+0x84,
+0xcd,
+0xa5,
+0xce,
+0x49,
+0x08,
+0x05,
+0xcd,
+0x85,
+0xcd,
+0x84,
+0xce,
+0x46,
+0xd2,
+0x66,
+0xd1,
+0x66,
+0xd0,
+0x46,
+0xd2,
+0x66,
+0xd1,
+0x66,
+0xd0,
+0x60,
+0x46,
+0xc6,
+0x66,
+0xc5,
+0x66,
+0xc4,
+0x46,
+0xca,
+0x66,
+0xc9,
+0x66,
+0xc8,
+0x46,
+0xca,
+0x66,
+0xc9,
+0x66,
+0xc8,
+0x46,
+0xca,
+0x66,
+0xc9,
+0x66,
+0xc8,
+0x46,
+0xca,
+0x66,
+0xc9,
+0x66,
+0xc8,
+0x46,
+0xce,
+0x66,
+0xcd,
+0x66,
+0xcc,
+0x46,
+0xce,
+0x66,
+0xcd,
+0x66,
+0xcc,
+0x46,
+0xce,
+0x66,
+0xcd,
+0x66,
+0xcc,
+0x46,
+0xce,
+0x66,
+0xcd,
+0x66,
+0xcc,
+0x46,
+0xd2,
+0x66,
+0xd1,
+0x66,
+0xd0,
+0x60,
+0x46,
+0xca,
+0x66,
+0xc9,
+0x66,
+0xc8,
+0x46,
+0xca,
+0x66,
+0xc9,
+0x66,
+0xc8,
+0x46,
+0xca,
+0x66,
+0xc9,
+0x66,
+0xc8,
+0x46,
+0xce,
+0x66,
+0xcd,
+0x66,
+0xcc,
+0x46,
+0xce,
+0x66,
+0xcd,
+0x66,
+0xcc,
+0x46,
+0xce,
+0x66,
+0xcd,
+0x66,
+0xcc,
+0x60,
+0x06,
+0xc4,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0x46,
+0xca,
+0x66,
+0xc9,
+0x66,
+0xc8,
+0x46,
+0xca,
+0x66,
+0xc9,
+0x66,
+0xc8,
+0x46,
+0xce,
+0x66,
+0xcd,
+0x66,
+0xcc,
+0x46,
+0xce,
+0x66,
+0xcd,
+0x66,
+0xcc,
+0x06,
+0xd0,
+0x26,
+0xd1,
+0x26,
+0xd2,
+0x60,
+0x06,
+0xc4,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0x06,
+0xc4,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0x46,
+0xca,
+0x66,
+0xc9,
+0x66,
+0xc8,
+0x46,
+0xce,
+0x66,
+0xcd,
+0x66,
+0xcc,
+0x06,
+0xd0,
+0x26,
+0xd1,
+0x26,
+0xd2,
+0x06,
+0xd0,
+0x26,
+0xd1,
+0x26,
+0xd2,
+0x60,
+0x06,
+0xc4,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0x06,
+0xc4,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0x06,
+0xc4,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0x06,
+0xd0,
+0x26,
+0xd1,
+0x26,
+0xd2,
+0x06,
+0xd0,
+0x26,
+0xd1,
+0x26,
+0xd2,
+0x06,
+0xd0,
+0x26,
+0xd1,
+0x26,
+0xd2,
+0x60,
+0x06,
+0xc4,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0x06,
+0xc4,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0x06,
+0xc4,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0x06,
+0xc4,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0x06,
+0xc8,
+0x26,
+0xc9,
+0x26,
+0xca,
+0x06,
+0xcc,
+0x26,
+0xcd,
+0x26,
+0xce,
+0x06,
+0xd0,
+0x26,
+0xd1,
+0x26,
+0xd2,
+0x06,
+0xd0,
+0x26,
+0xd1,
+0x26,
+0xd2,
+0x06,
+0xd0,
+0x26,
+0xd1,
+0x26,
+0xd2,
+0x06,
+0xd0,
+0x26,
+0xd1,
+0x26,
+0xd2,
+0x60,
+0xa5,
+0xc7,
+0x49,
+0x20,
+0x85,
+0xc7,
+0xa5,
+0xc6,
+0x49,
+0x20,
+0x85,
+0xc6,
+0x98,
+0x05,
+0xc7,
+0x85,
+0xc7,
+0xa5,
+0xc5,
+0x49,
+0x20,
+0x85,
+0xc5,
+0x98,
+0x05,
+0xc6,
+0x85,
+0xc6,
+0xa5,
+0xc4,
+0x49,
+0x20,
+0x85,
+0xc4,
+0x98,
+0x05,
+0xc5,
+0x85,
+0xc5,
+0x06,
+0xc8,
+0x26,
+0xc9,
+0x26,
+0xca,
+0x06,
+0xc8,
+0x26,
+0xc9,
+0x26,
+0xca,
+0x06,
+0xcc,
+0x26,
+0xcd,
+0x26,
+0xce,
+0x06,
+0xcc,
+0x26,
+0xcd,
+0x26,
+0xce,
+0xa5,
+0xd3,
+0x49,
+0x20,
+0x85,
+0xd3,
+0xa5,
+0xd2,
+0x49,
+0x20,
+0x85,
+0xd2,
+0x98,
+0x05,
+0xd3,
+0x85,
+0xd3,
+0xa5,
+0xd1,
+0x49,
+0x20,
+0x85,
+0xd1,
+0x98,
+0x05,
+0xd2,
+0x85,
+0xd2,
+0xa5,
+0xd0,
+0x49,
+0x20,
+0x85,
+0xd0,
+0x98,
+0x05,
+0xd1,
+0x85,
+0xd1,
+0x60,
+0xa5,
+0xc7,
+0x49,
+0x40,
+0x85,
+0xc7,
+0xa5,
+0xc6,
+0x49,
+0x40,
+0x85,
+0xc6,
+0x98,
+0x05,
+0xc7,
+0x85,
+0xc7,
+0xa5,
+0xc5,
+0x49,
+0x40,
+0x85,
+0xc5,
+0x98,
+0x05,
+0xc6,
+0x85,
+0xc6,
+0xa5,
+0xc4,
+0x49,
+0x40,
+0x85,
+0xc4,
+0x98,
+0x05,
+0xc5,
+0x85,
+0xc5,
+0x06,
+0xc8,
+0x26,
+0xc9,
+0x26,
+0xca,
+0x06,
+0xc8,
+0x26,
+0xc9,
+0x26,
+0xca,
+0x06,
+0xc8,
+0x26,
+0xc9,
+0x26,
+0xca,
+0x06,
+0xcc,
+0x26,
+0xcd,
+0x26,
+0xce,
+0x06,
+0xcc,
+0x26,
+0xcd,
+0x26,
+0xce,
+0x06,
+0xcc,
+0x26,
+0xcd,
+0x26,
+0xce,
+0xa5,
+0xd3,
+0x49,
+0x40,
+0x85,
+0xd3,
+0xa5,
+0xd2,
+0x49,
+0x40,
+0x85,
+0xd2,
+0x98,
+0x05,
+0xd3,
+0x85,
+0xd3,
+0xa5,
+0xd1,
+0x49,
+0x40,
+0x85,
+0xd1,
+0x98,
+0x05,
+0xd2,
+0x85,
+0xd2,
+0xa5,
+0xd0,
+0x49,
+0x40,
+0x85,
+0xd0,
+0x98,
+0x05,
+0xd1,
+0x85,
+0xd1,
+0x60,
+0x20,
+0x9a,
+0x3b,
+0x46,
+0xe5,
+0x66,
+0xe4,
+0x90,
+0x06,
+0xe6,
+0xe4,
+0xd0,
+0x02,
+0xe6,
+0xe5,
+0x38,
+0xa5,
+0xe6,
+0xe5,
+0xe4,
+0xa5,
+0xe7,
+0xe5,
+0xe5,
+0x30,
+0x06,
+0xe6,
+0xe2,
+0xd0,
+0x02,
+0xe6,
+0xe3,
+0x60,
+0x64,
+0x22,
+0x64,
+0xa8,
+0x9c,
+0x39,
+0x6b,
+0xa9,
+0x13,
+0x85,
+0xe2,
+0xa9,
+0x61,
+0x85,
+0xe3,
+0xa2,
+0xc0,
+0xa9,
+0x03,
+0x20,
+0xaf,
+0x3e,
+0xa9,
+0x80,
+0x85,
+0xde,
+0xa9,
+0xb7,
+0x85,
+0xe2,
+0xa9,
+0x6c,
+0x85,
+0xe3,
+0xa2,
+0x94,
+0xa9,
+0x05,
+0x20,
+0xb1,
+0x3e,
+0xa0,
+0x06,
+0x53,
+0xe6,
+0x5c,
+0x15,
+0x6c,
+0xa0,
+0x96,
+0x13,
+0xa8,
+0x00,
+0x21,
+0x6c,
+0xa9,
+0x01,
+0x8d,
+0xb4,
+0x6b,
+0x60,
+0xa0,
+0x02,
+0x53,
+0x2a,
+0xbe,
+0xe8,
+0x00,
+0x88,
+0x98,
+0x0a,
+0xaa,
+0xb9,
+0x3d,
+0x5a,
+0xd0,
+0x14,
+0x9e,
+0x38,
+0x6b,
+0x9e,
+0x39,
+0x6b,
+0x9e,
+0x90,
+0x6b,
+0x9e,
+0x91,
+0x6b,
+0x9e,
+0xa0,
+0x6b,
+0x9e,
+0xa1,
+0x6b,
+0x80,
+0x6d,
+0x5a,
+0xda,
+0xa5,
+0xe9,
+0xa6,
+0xe8,
+0x20,
+0xb7,
+0x0d,
+0x85,
+0xea,
+0x86,
+0xeb,
+0xdc,
+0x20,
+0x7a,
+0x0e,
+0xfa,
+0x9d,
+0x38,
+0x6b,
+0x9d,
+0x39,
+0x6b,
+0x49,
+0x28,
+0x85,
+0xec,
+0x84,
+0xed,
+0x38,
+0xa5,
+0xea,
+0xe5,
+0xec,
+0x85,
+0xec,
+0xa5,
+0xeb,
+0xe5,
+0xed,
+0x05,
+0xec,
+0xf0,
+0x03,
+0xfe,
+0x39,
+0x6b,
+0xbd,
+0x39,
+0x6b,
+0x85,
+0xe4,
+0x64,
+0xe5,
+0xa9,
+0x00,
+0x85,
+0xe2,
+0xa9,
+0x80,
+0x85,
+0xe3,
+0xda,
+0x20,
+0x81,
+0x1a,
+0xfa,
+0xa5,
+0xe3,
+0x9d,
+0x91,
+0x6b,
+0xa5,
+0xe2,
+0x9d,
+0x90,
+0x6b,
+0xbd,
+0x39,
+0x6b,
+0x85,
+0xe4,
+0x64,
+0xe5,
+0xa9,
+0x00,
+0x85,
+0xe2,
+0xa9,
+0x40,
+0x85,
+0xe3,
+0xda,
+0x20,
+0x81,
+0x1a,
+0xfa,
+0xa5,
+0xe3,
+0x9d,
+0xa1,
+0x6b,
+0xa5,
+0xe2,
+0x9d,
+0xa0,
+0x6b,
+0x7a,
+0xc8,
+0xc0,
+0x05,
+0xb0,
+0x03,
+0x4c,
+0xe7,
+0x1a,
+0xad,
+0x3a,
+0x6b,
+0x49,
+0x28,
+0x85,
+0xde,
+0x38,
+0xa5,
+0xe8,
+0xe5,
+0xde,
+0x4a,
+0x85,
+0xde,
+0x64,
+0xdf,
+0xa9,
+0xff,
+0x85,
+0xe8,
+0x85,
+0xe9,
+0xa2,
+0x01,
+0x18,
+0xa5,
+0xe8,
+0x6d,
+0x3a,
+0x6b,
+0x85,
+0xe8,
+0x90,
+0x02,
+0xe6,
+0xe9,
+0x8a,
+0x0a,
+0x45,
+0xde,
+0x20,
+0x74,
+0x0e,
+0xc5,
+0xdf,
+0xf0,
+0x06,
+0xe6,
+0xe8,
+0xd0,
+0x02,
+0xe6,
+0xe9,
+0x85,
+0xdf,
+0xa5,
+0xe8,
+0x9d,
+0x49,
+0x6b,
+0xa5,
+0xe9,
+0x9d,
+0x5d,
+0x6b,
+0xe8,
+0xe0,
+0x15,
+0x90,
+0xd2,
+0xa0,
+0x02,
+0x53,
+0x2c,
+0xbe,
+0xe8,
+0x00,
+0x88,
+0x98,
+0x0a,
+0xaa,
+0xb9,
+0x3d,
+0x5a,
+0xd0,
+0x14,
+0x9e,
+0x40,
+0x6b,
+0x9e,
+0x41,
+0x6b,
+0x9e,
+0x98,
+0x6b,
+0x9e,
+0x99,
+0x6b,
+0x9e,
+0xa8,
+0x6b,
+0x9e,
+0xa9,
+0x6b,
+0x80,
+0x6d,
+0x5a,
+0xda,
+0xa5,
+0xe9,
+0xa6,
+0xe8,
+0x20,
+0xb7,
+0x0d,
+0x85,
+0xea,
+0x86,
+0xeb,
+0xdc,
+0x20,
+0xb2,
+0x0e,
+0xfa,
+0x9d,
+0x40,
+0x6b,
+0x9d,
+0x41,
+0x6b,
+0x49,
+0x20,
+0x85,
+0xec,
+0x84,
+0xed,
+0x38,
+0xa5,
+0xea,
+0xe5,
+0xec,
+0x85,
+0xec,
+0xa5,
+0xeb,
+0xe5,
+0xed,
+0x05,
+0xec,
+0xf0,
+0x03,
+0xfe,
+0x41,
+0x6b,
+0xbd,
+0x41,
+0x6b,
+0x85,
+0xe4,
+0x64,
+0xe5,
+0xa9,
+0x00,
+0x85,
+0xe2,
+0xa9,
+0x80,
+0x85,
+0xe3,
+0xda,
+0x20,
+0x81,
+0x1a,
+0xfa,
+0xa5,
+0xe3,
+0x9d,
+0x99,
+0x6b,
+0xa5,
+0xe2,
+0x9d,
+0x98,
+0x6b,
+0xbd,
+0x41,
+0x6b,
+0x85,
+0xe4,
+0x64,
+0xe5,
+0xa9,
+0x00,
+0x85,
+0xe2,
+0xa9,
+0x40,
+0x85,
+0xe3,
+0xda,
+0x20,
+0x81,
+0x1a,
+0xfa,
+0xa5,
+0xe3,
+0x9d,
+0xa9,
+0x6b,
+0xa5,
+0xe2,
+0x9d,
+0xa8,
+0x6b,
+0x7a,
+0xc8,
+0xc0,
+0x05,
+0xb0,
+0x03,
+0x4c,
+0xc7,
+0x1b,
+0xad,
+0x42,
+0x6b,
+0x49,
+0x20,
+0x85,
+0xde,
+0x38,
+0xa5,
+0xe8,
+0xe5,
+0xde,
+0x4a,
+0x85,
+0xde,
+0x64,
+0xdf,
+0xa9,
+0xff,
+0x85,
+0xe8,
+0x85,
+0xe9,
+0xa2,
+0x01,
+0x18,
+0xa5,
+0xe8,
+0x6d,
+0x42,
+0x6b,
+0x85,
+0xe8,
+0x90,
+0x02,
+0xe6,
+0xe9,
+0x8a,
+0x0a,
+0x45,
+0xde,
+0x20,
+0xac,
+0x0e,
+0xc5,
+0xdf,
+0xf0,
+0x06,
+0xe6,
+0xe8,
+0xd0,
+0x02,
+0xe6,
+0xe9,
+0x85,
+0xdf,
+0xa5,
+0xe8,
+0x9d,
+0x71,
+0x6b,
+0xa5,
+0xe9,
+0x9d,
+0x81,
+0x6b,
+0xe8,
+0xe0,
+0x11,
+0x90,
+0xd2,
+0xa9,
+0x01,
+0x8d,
+0x39,
+0x6b,
+0x60,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xc8,
+0x3e,
+0x48,
+0xad,
+0x34,
+0xc0,
+0xaa,
+0x29,
+0x03,
+0xc9,
+0x02,
+0xd0,
+0x07,
+0xad,
+0x12,
+0x61,
+0xd0,
+0x07,
+0x80,
+0x38,
+0x8a,
+0x29,
+0xf8,
+0xf0,
+0x1b,
+0xac,
+0x12,
+0x61,
+0xf0,
+0x06,
+0x8a,
+0x4a,
+0x4a,
+0x20,
+0x66,
+0x3c,
+0xa5,
+0xba,
+0xf0,
+0x24,
+0x8a,
+0x29,
+0x04,
+0x09,
+0x09,
+0x8d,
+0x38,
+0xc0,
+0xc6,
+0xba,
+0x80,
+0x18,
+0xa5,
+0xab,
+0xf0,
+0x14,
+0x8a,
+0x4a,
+0x4a,
+0x20,
+0xe4,
+0x39,
+0xa0,
+0x01,
+0x8a,
+0x4a,
+0x4a,
+0x29,
+0x01,
+0xf0,
+0x02,
+0xa0,
+0x05,
+0x8c,
+0x38,
+0xc0,
+0x8a,
+0x29,
+0x03,
+0xc9,
+0x02,
+0xd0,
+0x42,
+0xa5,
+0xbe,
+0xf0,
+0x0f,
+0x49,
+0x3c,
+0xaa,
+0xa9,
+0x13,
+0x85,
+0xe2,
+0xa9,
+0x61,
+0x85,
+0xe3,
+0x98,
+0x20,
+0xaf,
+0x3e,
+0x38,
+0xa9,
+0x0f,
+0xe5,
+0xbf,
+0xf0,
+0x1a,
+0x49,
+0x3c,
+0x85,
+0xe4,
+0x84,
+0xe5,
+0x38,
+0xa9,
+0xd3,
+0xe5,
+0xe4,
+0x85,
+0xe2,
+0xa9,
+0x64,
+0xe5,
+0xe5,
+0x85,
+0xe3,
+0xa6,
+0xe4,
+0xa5,
+0xe5,
+0x20,
+0xaf,
+0x3e,
+0xa9,
+0x01,
+0x9c,
+0x24,
+0xd0,
+0x8d,
+0x24,
+0xd0,
+0x9c,
+0x11,
+0x61,
+0x20,
+0x55,
+0x3f,
+0x4c,
+0x2a,
+0x3f,
+0xa6,
+0x67,
+0xbd,
+0x16,
+0x75,
+0xaa,
+0x18,
+0x69,
+0x53,
+0x85,
+0x50,
+0xa9,
+0x7e,
+0x69,
+0x00,
+0x85,
+0x51,
+0x8a,
+0x0a,
+0xaa,
+0x69,
+0x8f,
+0x85,
+0x4a,
+0xa9,
+0x7e,
+0x69,
+0x00,
+0x85,
+0x4b,
+0x8a,
+0x69,
+0x07,
+0x85,
+0x4c,
+0xa9,
+0x7f,
+0x69,
+0x00,
+0x85,
+0x4d,
+0x8a,
+0x69,
+0xdb,
+0x85,
+0x4e,
+0xa9,
+0x7d,
+0x69,
+0x00,
+0x85,
+0x4f,
+0xa6,
+0x67,
+0xbd,
+0x28,
+0x75,
+0x0a,
+0xaa,
+0xbd,
+0xec,
+0x5e,
+0x85,
+0x56,
+0xbd,
+0xed,
+0x5e,
+0x85,
+0x57,
+0xbd,
+0xf2,
+0x5e,
+0x85,
+0x58,
+0xbd,
+0xf3,
+0x5e,
+0x85,
+0x59,
+0xa5,
+0x67,
+0x49,
+0x7e,
+0x18,
+0x69,
+0x39,
+0x85,
+0x52,
+0x98,
+0x69,
+0x75,
+0x85,
+0x53,
+0xa5,
+0x28,
+0x49,
+0x06,
+0x18,
+0x65,
+0x52,
+0x85,
+0x52,
+0x98,
+0x65,
+0x53,
+0x85,
+0x53,
+0xa0,
+0x02,
+0x53,
+0x2a,
+0x00,
+0x3a,
+0x00,
+0xa5,
+0x28,
+0x85,
+0x66,
+0x0a,
+0x85,
+0x31,
+0xa0,
+0x05,
+0xd3,
+0x3a,
+0x3e,
+0x00,
+0x18,
+0xa5,
+0x3f,
+0x65,
+0x42,
+0x6a,
+0x69,
+0x00,
+0xaa,
+0xbd,
+0xec,
+0x5d,
+0x85,
+0x33,
+0xbd,
+0xec,
+0x5c,
+0x85,
+0x32,
+0xa6,
+0x40,
+0x38,
+0xfd,
+0xec,
+0x5c,
+0xa8,
+0xa5,
+0x33,
+0xfd,
+0xec,
+0x5d,
+0xaa,
+0x10,
+0x0c,
+0x29,
+0xf0,
+0xc9,
+0xf0,
+0xf0,
+0x0e,
+0xa0,
+0x00,
+0xa2,
+0xf0,
+0x80,
+0x08,
+0x29,
+0xf0,
+0xf0,
+0x04,
+0xa0,
+0xff,
+0xa2,
+0x0f,
+0x98,
+0xa4,
+0x31,
+0x91,
+0x4a,
+0xc8,
+0x8a,
+0x91,
+0x4a,
+0xa6,
+0x41,
+0x38,
+0xa5,
+0x32,
+0xfd,
+0xec,
+0x5c,
+0xa8,
+0xa5,
+0x33,
+0xfd,
+0xec,
+0x5d,
+0xaa,
+0x10,
+0x0c,
+0x29,
+0xf0,
+0xc9,
+0xf0,
+0xf0,
+0x0e,
+0xa0,
+0x00,
+0xa2,
+0xf0,
+0x80,
+0x08,
+0x29,
+0xf0,
+0xf0,
+0x04,
+0xa0,
+0xff,
+0xa2,
+0x0f,
+0x98,
+0xa4,
+0x31,
+0x91,
+0x4c,
+0xc8,
+0x8a,
+0x91,
+0x4c,
+0xa6,
+0x3f,
+0xbd,
+0xec,
+0x5d,
+0x48,
+0xbd,
+0xec,
+0x5c,
+0xa6,
+0x42,
+0x38,
+0xfd,
+0xec,
+0x5c,
+0xa8,
+0x68,
+0xfd,
+0xec,
+0x5d,
+0xaa,
+0x10,
+0x0c,
+0x29,
+0xf8,
+0xc9,
+0xf8,
+0xf0,
+0x0e,
+0xa0,
+0x00,
+0xa2,
+0xf8,
+0x80,
+0x08,
+0x29,
+0xf8,
+0xf0,
+0x04,
+0xa0,
+0xff,
+0xa2,
+0x07,
+0x98,
+0xa4,
+0x31,
+0x91,
+0x4e,
+0xc8,
+0x8a,
+0x91,
+0x4e,
+0xa2,
+0x01,
+0xa5,
+0x3e,
+0xcd,
+0x2f,
+0xbe,
+0x90,
+0x07,
+0xcd,
+0x30,
+0xbe,
+0x90,
+0x03,
+0xf0,
+0x01,
+0xca,
+0x8a,
+0xa4,
+0x66,
+0x91,
+0x50,
+0x64,
+0x30,
+0xa9,
+0x00,
+0x85,
+0x6d,
+0x49,
+0x03,
+0x85,
+0x38,
+0x64,
+0x34,
+0x64,
+0x35,
+0xa9,
+0x03,
+0x85,
+0x6c,
+0x18,
+0xa5,
+0x38,
+0xa6,
+0x30,
+0x7d,
+0xa3,
+0x7d,
+0x65,
+0x52,
+0x85,
+0x36,
+0xa5,
+0x53,
+0x69,
+0x00,
+0x85,
+0x37,
+0xa2,
+0x00,
+0xb2,
+0x36,
+0xa0,
+0x06,
+0x71,
+0x36,
+0x90,
+0x02,
+0xe8,
+0x18,
+0xa0,
+0x7e,
+0x71,
+0x36,
+0x90,
+0x02,
+0xe8,
+0x18,
+0xa0,
+0x84,
+0x71,
+0x36,
+0x90,
+0x01,
+0xe8,
+0x86,
+0x2e,
+0x46,
+0x2e,
+0x6a,
+0x46,
+0x2e,
+0x6a,
+0x69,
+0x00,
+0x92,
+0x56,
+0xa4,
+0x30,
+0x59,
+0x15,
+0x6c,
+0x18,
+0x65,
+0x34,
+0x85,
+0x34,
+0x98,
+0x65,
+0x35,
+0x85,
+0x35,
+0xe6,
+0x56,
+0xd0,
+0x02,
+0xe6,
+0x57,
+0xe6,
+0x30,
+0xc6,
+0x6c,
+0xd0,
+0xad,
+0xa5,
+0x34,
+0x0a,
+0xaa,
+0xa5,
+0x35,
+0x2a,
+0xe0,
+0x80,
+0x90,
+0x04,
+0x1a,
+0xd0,
+0x01,
+0x3a,
+0x92,
+0x58,
+0xe6,
+0x58,
+0xd0,
+0x02,
+0xe6,
+0x59,
+0xa5,
+0x6d,
+0x1a,
+0xc9,
+0x02,
+0xd0,
+0x80,
+0xa5,
+0x52,
+0x18,
+0x69,
+0x06,
+0x85,
+0x52,
+0x90,
+0x02,
+0xe6,
+0x53,
+0xa6,
+0x66,
+0xe4,
+0x29,
+0xf0,
+0x0f,
+0xa5,
+0x3a,
+0x69,
+0x05,
+0x85,
+0x3a,
+0x90,
+0x02,
+0xe6,
+0x3b,
+0x8a,
+0x1a,
+0x4c,
+0xb5,
+0x1d,
+0xa5,
+0x2a,
+0xa6,
+0x23,
+0xf0,
+0x0b,
+0x38,
+0xe9,
+0x64,
+0x85,
+0x2a,
+0xb0,
+0x0d,
+0xc6,
+0x2b,
+0x80,
+0x09,
+0x18,
+0x69,
+0x64,
+0x85,
+0x2a,
+0x90,
+0x02,
+0xe6,
+0x2b,
+0x60,
+0xa4,
+0x28,
+0x84,
+0x61,
+0x84,
+0x62,
+0xc4,
+0x29,
+0xf0,
+0x02,
+0xe6,
+0x62,
+0xb1,
+0x5a,
+0xf0,
+0x20,
+0x31,
+0x5c,
+0x31,
+0x5e,
+0xfc,
+0xa4,
+0x61,
+0x31,
+0x5c,
+0x31,
+0x5a,
+0x31,
+0x5e,
+0xa4,
+0x62,
+0x31,
+0x5c,
+0x31,
+0x5a,
+0x31,
+0x5e,
+0xdc,
+0x29,
+0x01,
+0xd0,
+0x04,
+0xb1,
+0x5a,
+0x80,
+0x02,
+0x09,
+0x02,
+0x91,
+0x5a,
+0x84,
+0x61,
+0xc8,
+0xc4,
+0x29,
+0x90,
+0xd1,
+0xf0,
+0xd1,
+0x60,
+0xa2,
+0x01,
+0xa5,
+0x67,
+0xc5,
+0x26,
+0xf0,
+0x06,
+0xc5,
+0x27,
+0xf0,
+0x02,
+0xa2,
+0x00,
+0x86,
+0x88,
+0x85,
+0x64,
+0x1a,
+0x85,
+0x63,
+0x1a,
+0x85,
+0x65,
+0x18,
+0xa6,
+0x67,
+0xa9,
+0x53,
+0xa8,
+0x7d,
+0x15,
+0x75,
+0x85,
+0x5c,
+0xa9,
+0x7e,
+0x69,
+0x00,
+0x85,
+0x5d,
+0x98,
+0x7d,
+0x16,
+0x75,
+0x85,
+0x5a,
+0xa9,
+0x7e,
+0x69,
+0x00,
+0x85,
+0x5b,
+0x98,
+0x7d,
+0x17,
+0x75,
+0x85,
+0x5e,
+0xa9,
+0x7e,
+0x69,
+0x00,
+0x85,
+0x5f,
+0x20,
+0x36,
+0x1f,
+0xa6,
+0x63,
+0xbd,
+0x27,
+0x75,
+0x0a,
+0xaa,
+0xbd,
+0xec,
+0x5e,
+0x85,
+0x4a,
+0xbd,
+0xed,
+0x5e,
+0x85,
+0x4b,
+0xbd,
+0xf2,
+0x5e,
+0x85,
+0x52,
+0xbd,
+0xf3,
+0x5e,
+0x85,
+0x53,
+0xa5,
+0x28,
+0xc5,
+0x29,
+0xf0,
+0x1b,
+0x18,
+0xa5,
+0x4a,
+0x69,
+0x06,
+0x85,
+0x4c,
+0xa5,
+0x4b,
+0x69,
+0x00,
+0x85,
+0x4d,
+0xa5,
+0x52,
+0x69,
+0x02,
+0x85,
+0x54,
+0xa5,
+0x53,
+0x69,
+0x00,
+0x85,
+0x55,
+0x80,
+0x0c,
+0xa0,
+0x02,
+0x53,
+0x4a,
+0x00,
+0x4c,
+0x00,
+0x53,
+0x52,
+0x00,
+0x54,
+0x00,
+0xa6,
+0x64,
+0xbd,
+0x27,
+0x75,
+0x0a,
+0xaa,
+0xbd,
+0xec,
+0x5e,
+0x85,
+0x4e,
+0xbd,
+0xed,
+0x5e,
+0x85,
+0x4f,
+0xbd,
+0xf2,
+0x5e,
+0x85,
+0x56,
+0xbd,
+0xf3,
+0x5e,
+0x85,
+0x57,
+0xa6,
+0x65,
+0xbd,
+0x27,
+0x75,
+0x0a,
+0xaa,
+0xbd,
+0xec,
+0x5e,
+0x85,
+0x50,
+0xbd,
+0xed,
+0x5e,
+0x85,
+0x51,
+0xbd,
+0xf2,
+0x5e,
+0x85,
+0x58,
+0xbd,
+0xf3,
+0x5e,
+0x85,
+0x59,
+0xa0,
+0x02,
+0x53,
+0x5a,
+0x00,
+0x3c,
+0x00,
+0x18,
+0xa6,
+0x67,
+0xbd,
+0x15,
+0x75,
+0x0a,
+0x69,
+0xdb,
+0x85,
+0x5c,
+0xa9,
+0x7d,
+0xa8,
+0x69,
+0x00,
+0x85,
+0x5d,
+0xbd,
+0x16,
+0x75,
+0x0a,
+0x69,
+0xdb,
+0x85,
+0x5a,
+0x98,
+0x69,
+0x00,
+0x85,
+0x5b,
+0xbd,
+0x17,
+0x75,
+0x0a,
+0x69,
+0xdb,
+0x85,
+0x5e,
+0x98,
+0x69,
+0x00,
+0x85,
+0x5f,
+0xa5,
+0x28,
+0xaa,
+0x85,
+0x66,
+0x0a,
+0x85,
+0x61,
+0x8a,
+0xa0,
+0x01,
+0x64,
+0x89,
+0xc5,
+0x29,
+0xf0,
+0x01,
+0x1a,
+0x0a,
+0x85,
+0x62,
+0x84,
+0x87,
+0xa4,
+0x66,
+0xb1,
+0x3c,
+0x29,
+0x02,
+0xf0,
+0x0b,
+0x20,
+0x38,
+0x21,
+0x20,
+0x2c,
+0x22,
+0x20,
+0xb7,
+0x24,
+0x80,
+0x0e,
+0x64,
+0x93,
+0x64,
+0x94,
+0x64,
+0x95,
+0x64,
+0x96,
+0x20,
+0x2c,
+0x22,
+0x20,
+0xb7,
+0x24,
+0xa6,
+0x89,
+0xbd,
+0xb7,
+0x7d,
+0xe8,
+0x29,
+0x80,
+0xd0,
+0xf8,
+0x86,
+0x89,
+0x18,
+0xa5,
+0x4e,
+0x69,
+0x06,
+0x85,
+0x4e,
+0x90,
+0x03,
+0xe6,
+0x4f,
+0x18,
+0xa5,
+0x50,
+0x69,
+0x06,
+0x85,
+0x50,
+0x90,
+0x03,
+0xe6,
+0x51,
+0x18,
+0xa5,
+0x56,
+0x69,
+0x02,
+0x85,
+0x56,
+0x90,
+0x03,
+0xe6,
+0x57,
+0x18,
+0xa5,
+0x58,
+0x69,
+0x02,
+0x85,
+0x58,
+0x90,
+0x02,
+0xe6,
+0x59,
+0xa5,
+0x66,
+0xaa,
+0x0a,
+0x85,
+0x61,
+0xe4,
+0x28,
+0xf0,
+0x16,
+0x18,
+0xa5,
+0x4a,
+0x69,
+0x06,
+0x85,
+0x4a,
+0x90,
+0x03,
+0xe6,
+0x4b,
+0x18,
+0xa5,
+0x52,
+0x69,
+0x02,
+0x85,
+0x52,
+0x90,
+0x02,
+0xe6,
+0x53,
+0xa0,
+0x00,
+0xe8,
+0x86,
+0x66,
+0xe4,
+0x29,
+0xf0,
+0x16,
+0x18,
+0xa5,
+0x4c,
+0x69,
+0x06,
+0x85,
+0x4c,
+0x90,
+0x03,
+0xe6,
+0x4d,
+0x18,
+0xa5,
+0x54,
+0x69,
+0x02,
+0x85,
+0x54,
+0x90,
+0x02,
+0xe6,
+0x55,
+0x8a,
+0xe4,
+0x29,
+0xb0,
+0x03,
+0x4c,
+0x78,
+0x20,
+0xd0,
+0x04,
+0xc8,
+0x4c,
+0x7c,
+0x20,
+0xa6,
+0x8a,
+0xbd,
+0xcb,
+0x7d,
+0xa4,
+0x23,
+0xf0,
+0x03,
+0xca,
+0x80,
+0x01,
+0xe8,
+0x29,
+0x80,
+0xd0,
+0xf1,
+0x86,
+0x8a,
+0x60,
+0xa4,
+0x62,
+0xb1,
+0x5a,
+0xc8,
+0x0a,
+0xaa,
+0xb1,
+0x5a,
+0x88,
+0x2a,
+0x48,
+0x18,
+0x8a,
+0x71,
+0x5c,
+0xc8,
+0xaa,
+0x68,
+0x71,
+0x5c,
+0x88,
+0x48,
+0x18,
+0x8a,
+0x71,
+0x5e,
+0xc8,
+0xaa,
+0x68,
+0x71,
+0x5e,
+0x48,
+0xda,
+0xa4,
+0x61,
+0xb1,
+0x5a,
+0xc8,
+0x0a,
+0xaa,
+0xb1,
+0x5a,
+0x88,
+0x2a,
+0x48,
+0x18,
+0x8a,
+0x71,
+0x5c,
+0xc8,
+0xaa,
+0x68,
+0x71,
+0x5c,
+0x88,
+0x48,
+0x18,
+0x8a,
+0x71,
+0x5e,
+0x85,
+0x93,
+0xc8,
+0x68,
+0x71,
+0x5e,
+0x85,
+0x94,
+0x38,
+0x68,
+0xe5,
+0x93,
+0x85,
+0x93,
+0x68,
+0xe5,
+0x94,
+0xc9,
+0x80,
+0x6a,
+0x66,
+0x93,
+0xc9,
+0x80,
+0x6a,
+0x66,
+0x93,
+0xa6,
+0x87,
+0xd0,
+0x05,
+0xc9,
+0x80,
+0x6a,
+0x66,
+0x93,
+0x90,
+0x05,
+0xe6,
+0x93,
+0xd0,
+0x01,
+0x1a,
+0x85,
+0x94,
+0xa5,
+0x66,
+0x0a,
+0xa8,
+0x38,
+0xb1,
+0x5e,
+0xf1,
+0x5c,
+0xaa,
+0xc8,
+0xb1,
+0x5e,
+0xf1,
+0x5c,
+0x85,
+0x96,
+0x8a,
+0x0a,
+0x85,
+0x95,
+0x26,
+0x96,
+0xa4,
+0x61,
+0x38,
+0xb1,
+0x5e,
+0xf1,
+0x5c,
+0xaa,
+0xc8,
+0xb1,
+0x5e,
+0xf1,
+0x5c,
+0xa8,
+0x8a,
+0x18,
+0x65,
+0x95,
+0x85,
+0x95,
+0x98,
+0x65,
+0x96,
+0x85,
+0x96,
+0xa4,
+0x62,
+0x38,
+0xb1,
+0x5e,
+0xf1,
+0x5c,
+0xaa,
+0xc8,
+0xb1,
+0x5e,
+0xf1,
+0x5c,
+0xa8,
+0x8a,
+0x18,
+0x65,
+0x95,
+0x85,
+0x95,
+0x98,
+0x65,
+0x96,
+0xc9,
+0x80,
+0x6a,
+0x66,
+0x95,
+0xc9,
+0x80,
+0x6a,
+0x66,
+0x95,
+0xa6,
+0x88,
+0xd0,
+0x05,
+0xc9,
+0x80,
+0x6a,
+0x66,
+0x95,
+0x90,
+0x05,
+0xe6,
+0x95,
+0xd0,
+0x01,
+0x1a,
+0x85,
+0x96,
+0xa5,
+0x66,
+0x0a,
+0xa8,
+0xb1,
+0x5a,
+0x65,
+0x6e,
+0x85,
+0x6e,
+0xc8,
+0xa2,
+0xff,
+0xb1,
+0x5a,
+0x30,
+0x01,
+0xe8,
+0x65,
+0x6f,
+0x85,
+0x6f,
+0x8a,
+0x65,
+0x70,
+0x85,
+0x70,
+0x8a,
+0x65,
+0x71,
+0x85,
+0x71,
+0xe6,
+0x72,
+0xd0,
+0x02,
+0xe6,
+0x73,
+0x60,
+0xa5,
+0x66,
+0x0a,
+0x85,
+0x2e,
+0x64,
+0x2f,
+0x64,
+0x38,
+0x64,
+0x39,
+0x64,
+0x6d,
+0xa9,
+0x8f,
+0xa2,
+0x7e,
+0x80,
+0x04,
+0xa9,
+0x07,
+0xa2,
+0x7f,
+0x85,
+0x32,
+0x86,
+0x33,
+0xa4,
+0x67,
+0xb9,
+0x16,
+0x75,
+0x0a,
+0x65,
+0x32,
+0x85,
+0x34,
+0xa5,
+0x33,
+0x69,
+0x00,
+0x85,
+0x35,
+0xa4,
+0x62,
+0xb1,
+0x34,
+0xa4,
+0x61,
+0x38,
+0xf1,
+0x34,
+0xaa,
+0xa4,
+0x62,
+0xc8,
+0xb1,
+0x34,
+0xa4,
+0x61,
+0xc8,
+0xf1,
+0x34,
+0xa4,
+0x87,
+0xd0,
+0x11,
+0xc9,
+0x80,
+0x6a,
+0x85,
+0x69,
+0x8a,
+0x6a,
+0x69,
+0x00,
+0x85,
+0x68,
+0x90,
+0x1f,
+0xaa,
+0xa5,
+0x69,
+0x1a,
+0xa8,
+0x10,
+0x0c,
+0x29,
+0xf0,
+0xc9,
+0xf0,
+0xf0,
+0x0e,
+0xa2,
+0x00,
+0xa0,
+0xf0,
+0x80,
+0x08,
+0x29,
+0xf0,
+0xf0,
+0x04,
+0xa2,
+0xff,
+0xa0,
+0x0f,
+0x86,
+0x68,
+0x84,
+0x69,
+0xa4,
+0x65,
+0xb9,
+0x15,
+0x75,
+0x0a,
+0x65,
+0x32,
+0x85,
+0x34,
+0xa5,
+0x33,
+0xaa,
+0x69,
+0x00,
+0x85,
+0x35,
+0xa4,
+0x64,
+0xb9,
+0x15,
+0x75,
+0x0a,
+0x65,
+0x32,
+0x85,
+0x36,
+0x8a,
+0x69,
+0x00,
+0x85,
+0x37,
+0xa4,
+0x2e,
+0xb1,
+0x34,
+0x38,
+0xf1,
+0x36,
+0xaa,
+0xc8,
+0xb1,
+0x34,
+0xf1,
+0x36,
+0xa4,
+0x88,
+0xd0,
+0x11,
+0xc9,
+0x80,
+0x6a,
+0x85,
+0x6b,
+0x8a,
+0x6a,
+0x69,
+0x00,
+0x85,
+0x6a,
+0x90,
+0x1f,
+0xaa,
+0xa5,
+0x6b,
+0x1a,
+0xa8,
+0x10,
+0x0c,
+0x29,
+0xf0,
+0xc9,
+0xf0,
+0xf0,
+0x0e,
+0xa2,
+0x00,
+0xa0,
+0xf0,
+0x80,
+0x08,
+0x29,
+0xf0,
+0xf0,
+0x04,
+0xa2,
+0xff,
+0xa0,
+0x0f,
+0x86,
+0x6a,
+0x84,
+0x6b,
+0xa9,
+0x03,
+0x85,
+0x6c,
+0xa4,
+0x2f,
+0xb1,
+0x4a,
+0xaa,
+0xb1,
+0x4c,
+0xa8,
+0xbd,
+0xec,
+0x5c,
+0x38,
+0xf9,
+0xec,
+0x5c,
+0x85,
+0x32,
+0xbd,
+0xec,
+0x5d,
+0xf9,
+0xec,
+0x5d,
+0xa4,
+0x87,
+0xd0,
+0x0c,
+0xc9,
+0x80,
+0x6a,
+0x66,
+0x32,
+0x90,
+0x05,
+0xe6,
+0x32,
+0xd0,
+0x01,
+0x1a,
+0x85,
+0x33,
+0xaa,
+0x18,
+0xa5,
+0x32,
+0x65,
+0x68,
+0x85,
+0x32,
+0x8a,
+0x65,
+0x69,
+0x85,
+0x33,
+0x10,
+0x0d,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x32,
+0x85,
+0x32,
+0xa9,
+0x00,
+0xe5,
+0x33,
+0x85,
+0x33,
+0xa4,
+0x2f,
+0xb1,
+0x4e,
+0xaa,
+0xb1,
+0x50,
+0xa8,
+0xbd,
+0xec,
+0x5c,
+0x38,
+0xf9,
+0xec,
+0x5c,
+0x85,
+0x34,
+0xbd,
+0xec,
+0x5d,
+0xf9,
+0xec,
+0x5d,
+0xa4,
+0x88,
+0xd0,
+0x0c,
+0xc9,
+0x80,
+0x6a,
+0x66,
+0x34,
+0x90,
+0x05,
+0xe6,
+0x34,
+0xd0,
+0x01,
+0x1a,
+0x85,
+0x35,
+0xaa,
+0x18,
+0xa5,
+0x34,
+0x65,
+0x6a,
+0x85,
+0x34,
+0x8a,
+0x65,
+0x6b,
+0x85,
+0x35,
+0x10,
+0x0d,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x34,
+0x85,
+0x34,
+0xa9,
+0x00,
+0xe5,
+0x35,
+0x85,
+0x35,
+0xc5,
+0x33,
+0x90,
+0x11,
+0xf0,
+0x09,
+0xa0,
+0x02,
+0x53,
+0x34,
+0x00,
+0x32,
+0x00,
+0x80,
+0x06,
+0xa5,
+0x34,
+0xc5,
+0x32,
+0xb0,
+0xf1,
+0xa5,
+0x2f,
+0x49,
+0x03,
+0xaa,
+0x18,
+0xa5,
+0x32,
+0x7d,
+0x5f,
+0x81,
+0x9d,
+0x5f,
+0x81,
+0xa5,
+0x33,
+0x7d,
+0x60,
+0x81,
+0x9d,
+0x60,
+0x81,
+0x90,
+0x03,
+0xfe,
+0x61,
+0x81,
+0xe6,
+0x2f,
+0xc6,
+0x6c,
+0xf0,
+0x03,
+0x4c,
+0xfc,
+0x22,
+0xa4,
+0x6d,
+0xb1,
+0x52,
+0xaa,
+0xb1,
+0x54,
+0xa8,
+0xbd,
+0xec,
+0x5c,
+0x38,
+0xf9,
+0xec,
+0x5c,
+0x85,
+0x32,
+0xbd,
+0xec,
+0x5d,
+0xf9,
+0xec,
+0x5d,
+0xa4,
+0x87,
+0xd0,
+0x0c,
+0xc9,
+0x80,
+0x6a,
+0x66,
+0x32,
+0x90,
+0x05,
+0xe6,
+0x32,
+0xd0,
+0x01,
+0x1a,
+0x85,
+0x33,
+0xaa,
+0x18,
+0xa5,
+0x32,
+0x65,
+0x68,
+0x85,
+0x32,
+0x8a,
+0x65,
+0x69,
+0x85,
+0x33,
+0x10,
+0x1a,
+0x18,
+0xa5,
+0x38,
+0x65,
+0x32,
+0xa5,
+0x39,
+0x65,
+0x33,
+0xb0,
+0x21,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x32,
+0x85,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x33,
+0x85,
+0x39,
+0x80,
+0x12,
+0x38,
+0xa5,
+0x38,
+0xe5,
+0x32,
+0xa5,
+0x39,
+0xe5,
+0x33,
+0xb0,
+0x07,
+0xa0,
+0x02,
+0x53,
+0x32,
+0x00,
+0x38,
+0x00,
+0xa4,
+0x6d,
+0xb1,
+0x56,
+0xaa,
+0xb1,
+0x58,
+0xa8,
+0xbd,
+0xec,
+0x5c,
+0x38,
+0xf9,
+0xec,
+0x5c,
+0x85,
+0x34,
+0xbd,
+0xec,
+0x5d,
+0xf9,
+0xec,
+0x5d,
+0xa4,
+0x88,
+0xd0,
+0x0c,
+0xc9,
+0x80,
+0x6a,
+0x66,
+0x34,
+0x90,
+0x05,
+0xe6,
+0x34,
+0xd0,
+0x01,
+0x1a,
+0x85,
+0x35,
+0xaa,
+0x18,
+0xa5,
+0x34,
+0x65,
+0x6a,
+0x85,
+0x34,
+0x8a,
+0x65,
+0x6b,
+0x85,
+0x35,
+0x10,
+0x1a,
+0x18,
+0xa5,
+0x38,
+0x65,
+0x34,
+0xa5,
+0x39,
+0x65,
+0x35,
+0xb0,
+0x21,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x34,
+0x85,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x35,
+0x85,
+0x39,
+0x80,
+0x12,
+0x38,
+0xa5,
+0x38,
+0xe5,
+0x34,
+0xa5,
+0x39,
+0xe5,
+0x35,
+0xb0,
+0x07,
+0xa0,
+0x02,
+0x53,
+0x34,
+0x00,
+0x38,
+0x00,
+0xa0,
+0x04,
+0xa5,
+0x6d,
+0xd0,
+0x07,
+0x53,
+0x32,
+0x00,
+0x8b,
+0x00,
+0x80,
+0x05,
+0x53,
+0x32,
+0x00,
+0x8f,
+0x00,
+0xd0,
+0x05,
+0xe6,
+0x6d,
+0x4c,
+0x3f,
+0x22,
+0x38,
+0xa5,
+0x38,
+0xed,
+0x31,
+0xbe,
+0xa5,
+0x39,
+0xed,
+0x32,
+0xbe,
+0x90,
+0x09,
+0x64,
+0x8b,
+0xa0,
+0x07,
+0x13,
+0x8b,
+0x00,
+0x8c,
+0x00,
+0x60,
+0xa2,
+0x00,
+0xa5,
+0x94,
+0x10,
+0x0f,
+0x85,
+0x42,
+0x38,
+0x8a,
+0xe5,
+0x93,
+0x85,
+0x93,
+0x8a,
+0xe5,
+0x94,
+0x85,
+0x94,
+0x80,
+0x08,
+0x05,
+0x93,
+0xf0,
+0x02,
+0xa9,
+0x01,
+0x85,
+0x42,
+0xa5,
+0x2c,
+0xf0,
+0x14,
+0x45,
+0x93,
+0x84,
+0x93,
+0xa5,
+0x94,
+0xf0,
+0x0c,
+0x45,
+0x2c,
+0x18,
+0x65,
+0x93,
+0x85,
+0x93,
+0x98,
+0x69,
+0x00,
+0x85,
+0x94,
+0xa5,
+0x96,
+0x10,
+0x0f,
+0x85,
+0x43,
+0x38,
+0x8a,
+0xe5,
+0x95,
+0x85,
+0x95,
+0x8a,
+0xe5,
+0x96,
+0x85,
+0x96,
+0x80,
+0x08,
+0x05,
+0x95,
+0xf0,
+0x02,
+0xa9,
+0x01,
+0x85,
+0x43,
+0xa5,
+0x2d,
+0xf0,
+0x14,
+0x45,
+0x95,
+0x84,
+0x95,
+0xa5,
+0x96,
+0xf0,
+0x0c,
+0x45,
+0x2d,
+0x18,
+0x65,
+0x95,
+0x85,
+0x95,
+0x98,
+0x69,
+0x00,
+0x85,
+0x96,
+0xa5,
+0x8c,
+0x10,
+0x0f,
+0x85,
+0x46,
+0x38,
+0x8a,
+0xe5,
+0x8b,
+0x85,
+0x8b,
+0x8a,
+0xe5,
+0x8c,
+0x85,
+0x8c,
+0x80,
+0x08,
+0x05,
+0x8b,
+0xf0,
+0x02,
+0xa9,
+0x01,
+0x85,
+0x46,
+0xa5,
+0x2c,
+0xf0,
+0x14,
+0x45,
+0x8b,
+0x84,
+0x8b,
+0xa5,
+0x8c,
+0xf0,
+0x0c,
+0x45,
+0x2c,
+0x18,
+0x65,
+0x8b,
+0x85,
+0x8b,
+0x98,
+0x69,
+0x00,
+0x85,
+0x8c,
+0xa5,
+0x90,
+0x10,
+0x0f,
+0x85,
+0x47,
+0x38,
+0x8a,
+0xe5,
+0x8f,
+0x85,
+0x8f,
+0x8a,
+0xe5,
+0x90,
+0x85,
+0x90,
+0x80,
+0x08,
+0x05,
+0x8f,
+0xf0,
+0x02,
+0xa9,
+0x01,
+0x85,
+0x47,
+0xa5,
+0x2c,
+0xf0,
+0x14,
+0x45,
+0x8f,
+0x84,
+0x8f,
+0xa5,
+0x90,
+0xf0,
+0x0c,
+0x45,
+0x2c,
+0x18,
+0x65,
+0x8f,
+0x85,
+0x8f,
+0x98,
+0x69,
+0x00,
+0x85,
+0x90,
+0xa5,
+0x8e,
+0x10,
+0x0f,
+0x85,
+0x48,
+0x38,
+0x8a,
+0xe5,
+0x8d,
+0x85,
+0x8d,
+0x8a,
+0xe5,
+0x8e,
+0x85,
+0x8e,
+0x80,
+0x08,
+0x05,
+0x8d,
+0xf0,
+0x02,
+0xa9,
+0x01,
+0x85,
+0x48,
+0xa5,
+0x2d,
+0xf0,
+0x14,
+0x45,
+0x8d,
+0x84,
+0x8d,
+0xa5,
+0x8e,
+0xf0,
+0x0c,
+0x45,
+0x2d,
+0x18,
+0x65,
+0x8d,
+0x85,
+0x8d,
+0x98,
+0x69,
+0x00,
+0x85,
+0x8e,
+0xa5,
+0x92,
+0x10,
+0x0f,
+0x85,
+0x49,
+0x38,
+0x8a,
+0xe5,
+0x91,
+0x85,
+0x91,
+0x8a,
+0xe5,
+0x92,
+0x85,
+0x92,
+0x80,
+0x08,
+0x05,
+0x91,
+0xf0,
+0x02,
+0xa9,
+0x01,
+0x85,
+0x49,
+0xa5,
+0x2d,
+0xf0,
+0x14,
+0x45,
+0x91,
+0x84,
+0x91,
+0xa5,
+0x92,
+0xf0,
+0x0c,
+0x45,
+0x2d,
+0x18,
+0x65,
+0x91,
+0x85,
+0x91,
+0x98,
+0x69,
+0x00,
+0x85,
+0x92,
+0xa4,
+0x8a,
+0x5a,
+0x84,
+0x45,
+0xa4,
+0x89,
+0x5a,
+0x84,
+0x44,
+0xa2,
+0x00,
+0x64,
+0x30,
+0x18,
+0xa5,
+0x45,
+0x69,
+0x04,
+0x85,
+0x33,
+0x64,
+0x31,
+0x18,
+0xa5,
+0x44,
+0x69,
+0x06,
+0x85,
+0x34,
+0x20,
+0xcc,
+0x26,
+0xe6,
+0x31,
+0x20,
+0xc7,
+0x26,
+0x20,
+0xc7,
+0x26,
+0x20,
+0xc7,
+0x26,
+0xa9,
+0xff,
+0x85,
+0x31,
+0x20,
+0xc7,
+0x26,
+0xe6,
+0x30,
+0x38,
+0xa5,
+0x33,
+0xe9,
+0x04,
+0x85,
+0x33,
+0x64,
+0x31,
+0xa5,
+0x34,
+0x20,
+0xcc,
+0x26,
+0xe6,
+0x31,
+0x20,
+0xc7,
+0x26,
+0x20,
+0xc7,
+0x26,
+0x20,
+0xc7,
+0x26,
+0xa9,
+0xff,
+0x85,
+0x31,
+0x20,
+0xc7,
+0x26,
+0x38,
+0xa5,
+0x33,
+0xe9,
+0x04,
+0x85,
+0x33,
+0x64,
+0x31,
+0xa5,
+0x34,
+0x20,
+0xcc,
+0x26,
+0xe6,
+0x31,
+0x20,
+0xc7,
+0x26,
+0x38,
+0xa5,
+0x32,
+0xe9,
+0x0a,
+0x20,
+0xcc,
+0x26,
+0xa9,
+0xff,
+0x85,
+0x31,
+0x20,
+0xc7,
+0x26,
+0xa9,
+0xff,
+0x85,
+0x30,
+0x38,
+0xa5,
+0x33,
+0xe9,
+0x04,
+0x85,
+0x33,
+0x64,
+0x31,
+0xa5,
+0x34,
+0x20,
+0xcc,
+0x26,
+0xe6,
+0x31,
+0x20,
+0xc7,
+0x26,
+0x20,
+0xc7,
+0x26,
+0x20,
+0xc7,
+0x26,
+0xa9,
+0xff,
+0x85,
+0x31,
+0x20,
+0xc7,
+0x26,
+0xa9,
+0x01,
+0x85,
+0x30,
+0x38,
+0xa5,
+0x33,
+0xe9,
+0x04,
+0x85,
+0x33,
+0x64,
+0x31,
+0xa5,
+0x34,
+0x20,
+0xcc,
+0x26,
+0xe6,
+0x31,
+0x20,
+0xc7,
+0x26,
+0x20,
+0xc7,
+0x26,
+0x20,
+0xc7,
+0x26,
+0xa9,
+0xff,
+0x85,
+0x31,
+0x20,
+0xc7,
+0x26,
+0x7a,
+0xb9,
+0xb7,
+0x7d,
+0x10,
+0x04,
+0xc8,
+0x4c,
+0xf2,
+0x25,
+0x7a,
+0xb9,
+0xcb,
+0x7d,
+0x10,
+0x0c,
+0xa6,
+0x23,
+0xf0,
+0x04,
+0x88,
+0x4c,
+0xed,
+0x25,
+0xc8,
+0x4c,
+0xed,
+0x25,
+0x60,
+0x38,
+0xa5,
+0x32,
+0xe9,
+0x05,
+0x85,
+0x32,
+0xda,
+0x64,
+0x2e,
+0x64,
+0x2f,
+0xa6,
+0x33,
+0xa8,
+0x30,
+0x31,
+0xc9,
+0x0c,
+0xb0,
+0x2d,
+0x8a,
+0x30,
+0x2a,
+0xc9,
+0x08,
+0xb0,
+0x26,
+0xa5,
+0x44,
+0xd0,
+0x09,
+0xa5,
+0x31,
+0xd0,
+0x0d,
+0xbd,
+0x44,
+0x56,
+0x80,
+0x17,
+0xc9,
+0x13,
+0xd0,
+0x09,
+0xa5,
+0x31,
+0x10,
+0xf3,
+0xbd,
+0x3c,
+0x56,
+0x80,
+0x0a,
+0x8a,
+0x49,
+0x0c,
+0x18,
+0x65,
+0x32,
+0xa8,
+0xb9,
+0x4c,
+0x56,
+0x85,
+0x2e,
+0xe8,
+0x30,
+0x35,
+0xe0,
+0x0a,
+0xb0,
+0x31,
+0xa5,
+0x32,
+0x3a,
+0x30,
+0x2c,
+0xc9,
+0x0a,
+0xb0,
+0x28,
+0xa4,
+0x45,
+0xd0,
+0x0a,
+0xaa,
+0xa5,
+0x30,
+0xd0,
+0x0e,
+0xbd,
+0xb6,
+0x56,
+0x80,
+0x18,
+0xc0,
+0x0f,
+0xd0,
+0x0a,
+0xaa,
+0xa5,
+0x30,
+0x30,
+0xf2,
+0xbd,
+0xac,
+0x56,
+0x80,
+0x0a,
+0x8a,
+0x49,
+0x0a,
+0x18,
+0x65,
+0x32,
+0xaa,
+0xbd,
+0xbf,
+0x56,
+0x85,
+0x2f,
+0xfa,
+0xa5,
+0x2e,
+0xd0,
+0x03,
+0x4c,
+0x98,
+0x28,
+0xa8,
+0x10,
+0x05,
+0xa9,
+0x00,
+0x38,
+0xe5,
+0x2e,
+0x85,
+0x36,
+0x98,
+0x3c,
+0x45,
+0x42,
+0xc0,
+0x80,
+0xa5,
+0x36,
+0x90,
+0x38,
+0x45,
+0x93,
+0x85,
+0x37,
+0xbd,
+0x71,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0x71,
+0x81,
+0x84,
+0x37,
+0xbd,
+0x72,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0x72,
+0x81,
+0xb0,
+0x04,
+0xde,
+0x73,
+0x81,
+0x38,
+0xa5,
+0x94,
+0xf0,
+0x40,
+0x45,
+0x36,
+0x85,
+0x37,
+0xbd,
+0x72,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0x72,
+0x81,
+0x84,
+0x37,
+0xbd,
+0x73,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0x73,
+0x81,
+0x80,
+0x28,
+0x45,
+0x93,
+0x7d,
+0x71,
+0x81,
+0x9d,
+0x71,
+0x81,
+0x98,
+0x7d,
+0x72,
+0x81,
+0x9d,
+0x72,
+0x81,
+0x90,
+0x04,
+0xfe,
+0x73,
+0x81,
+0x18,
+0xa5,
+0x94,
+0xf0,
+0x0f,
+0x45,
+0x36,
+0x7d,
+0x72,
+0x81,
+0x9d,
+0x72,
+0x81,
+0x98,
+0x7d,
+0x73,
+0x81,
+0x9d,
+0x73,
+0x81,
+0xa5,
+0x46,
+0xf0,
+0x69,
+0x3c,
+0x45,
+0x2e,
+0xc0,
+0x80,
+0xa5,
+0x36,
+0x90,
+0x38,
+0x45,
+0x8b,
+0x85,
+0x37,
+0xbd,
+0xb9,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0xb9,
+0x81,
+0x84,
+0x37,
+0xbd,
+0xba,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0xba,
+0x81,
+0xb0,
+0x04,
+0xde,
+0xbb,
+0x81,
+0x38,
+0xa5,
+0x8c,
+0xf0,
+0x40,
+0x45,
+0x36,
+0x85,
+0x37,
+0xbd,
+0xba,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0xba,
+0x81,
+0x84,
+0x37,
+0xbd,
+0xbb,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0xbb,
+0x81,
+0x80,
+0x28,
+0x45,
+0x8b,
+0x7d,
+0xb9,
+0x81,
+0x9d,
+0xb9,
+0x81,
+0x98,
+0x7d,
+0xba,
+0x81,
+0x9d,
+0xba,
+0x81,
+0x90,
+0x04,
+0xfe,
+0xbb,
+0x81,
+0x18,
+0xa5,
+0x8c,
+0xf0,
+0x0f,
+0x45,
+0x36,
+0x7d,
+0xba,
+0x81,
+0x9d,
+0xba,
+0x81,
+0x98,
+0x7d,
+0xbb,
+0x81,
+0x9d,
+0xbb,
+0x81,
+0xa5,
+0x47,
+0xf0,
+0x6a,
+0x3c,
+0x45,
+0x2e,
+0xc0,
+0x80,
+0xa5,
+0x36,
+0x90,
+0x38,
+0x45,
+0x8f,
+0x85,
+0x37,
+0xbd,
+0x01,
+0x82,
+0xe5,
+0x37,
+0x9d,
+0x01,
+0x82,
+0x84,
+0x37,
+0xbd,
+0x02,
+0x82,
+0xe5,
+0x37,
+0x9d,
+0x02,
+0x82,
+0xb0,
+0x04,
+0xde,
+0x03,
+0x82,
+0x38,
+0xa5,
+0x90,
+0xf0,
+0x41,
+0x45,
+0x36,
+0x85,
+0x37,
+0xbd,
+0x02,
+0x82,
+0xe5,
+0x37,
+0x9d,
+0x02,
+0x82,
+0x84,
+0x37,
+0xbd,
+0x03,
+0x82,
+0xe5,
+0x37,
+0x9d,
+0x03,
+0x82,
+0x80,
+0x29,
+0x45,
+0x8f,
+0x18,
+0x7d,
+0x01,
+0x82,
+0x9d,
+0x01,
+0x82,
+0x98,
+0x7d,
+0x02,
+0x82,
+0x9d,
+0x02,
+0x82,
+0x90,
+0x04,
+0xfe,
+0x03,
+0x82,
+0x18,
+0xa5,
+0x90,
+0xf0,
+0x0f,
+0x45,
+0x36,
+0x7d,
+0x02,
+0x82,
+0x9d,
+0x02,
+0x82,
+0x98,
+0x7d,
+0x03,
+0x82,
+0x9d,
+0x03,
+0x82,
+0xa5,
+0x2f,
+0xd0,
+0x03,
+0x4c,
+0xee,
+0x29,
+0xa8,
+0x10,
+0x05,
+0xa9,
+0x00,
+0x38,
+0xe5,
+0x2f,
+0x85,
+0x36,
+0x98,
+0x3c,
+0x45,
+0x43,
+0xc0,
+0x80,
+0xa5,
+0x36,
+0x90,
+0x39,
+0x45,
+0x95,
+0x85,
+0x37,
+0xbd,
+0x71,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0x71,
+0x81,
+0x84,
+0x37,
+0xbd,
+0x72,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0x72,
+0x81,
+0xb0,
+0x04,
+0xde,
+0x73,
+0x81,
+0x38,
+0xa5,
+0x96,
+0xf0,
+0x41,
+0x45,
+0x36,
+0x38,
+0x85,
+0x37,
+0xbd,
+0x72,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0x72,
+0x81,
+0x84,
+0x37,
+0xbd,
+0x73,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0x73,
+0x81,
+0x80,
+0x28,
+0x45,
+0x95,
+0x7d,
+0x71,
+0x81,
+0x9d,
+0x71,
+0x81,
+0x98,
+0x7d,
+0x72,
+0x81,
+0x9d,
+0x72,
+0x81,
+0x90,
+0x04,
+0xfe,
+0x73,
+0x81,
+0x18,
+0xa5,
+0x96,
+0xf0,
+0x0f,
+0x45,
+0x36,
+0x7d,
+0x72,
+0x81,
+0x9d,
+0x72,
+0x81,
+0x98,
+0x7d,
+0x73,
+0x81,
+0x9d,
+0x73,
+0x81,
+0xa5,
+0x48,
+0xf0,
+0x69,
+0x3c,
+0x45,
+0x2f,
+0xc0,
+0x80,
+0xa5,
+0x36,
+0x90,
+0x38,
+0x45,
+0x8d,
+0x85,
+0x37,
+0xbd,
+0xb9,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0xb9,
+0x81,
+0x84,
+0x37,
+0xbd,
+0xba,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0xba,
+0x81,
+0xb0,
+0x04,
+0xde,
+0xbb,
+0x81,
+0x38,
+0xa5,
+0x8e,
+0xf0,
+0x40,
+0x45,
+0x36,
+0x85,
+0x37,
+0xbd,
+0xba,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0xba,
+0x81,
+0x84,
+0x37,
+0xbd,
+0xbb,
+0x81,
+0xe5,
+0x37,
+0x9d,
+0xbb,
+0x81,
+0x80,
+0x28,
+0x45,
+0x8d,
+0x7d,
+0xb9,
+0x81,
+0x9d,
+0xb9,
+0x81,
+0x98,
+0x7d,
+0xba,
+0x81,
+0x9d,
+0xba,
+0x81,
+0x90,
+0x04,
+0xfe,
+0xbb,
+0x81,
+0x18,
+0xa5,
+0x8e,
+0xf0,
+0x0f,
+0x45,
+0x36,
+0x7d,
+0xba,
+0x81,
+0x9d,
+0xba,
+0x81,
+0x98,
+0x7d,
+0xbb,
+0x81,
+0x9d,
+0xbb,
+0x81,
+0xa5,
+0x49,
+0xf0,
+0x69,
+0x3c,
+0x45,
+0x2f,
+0xc0,
+0x80,
+0xa5,
+0x36,
+0x90,
+0x38,
+0x45,
+0x91,
+0x85,
+0x37,
+0xbd,
+0x01,
+0x82,
+0xe5,
+0x37,
+0x9d,
+0x01,
+0x82,
+0x84,
+0x37,
+0xbd,
+0x02,
+0x82,
+0xe5,
+0x37,
+0x9d,
+0x02,
+0x82,
+0xb0,
+0x04,
+0xde,
+0x03,
+0x82,
+0x38,
+0xa5,
+0x92,
+0xf0,
+0x40,
+0x45,
+0x36,
+0x85,
+0x37,
+0xbd,
+0x02,
+0x82,
+0xe5,
+0x37,
+0x9d,
+0x02,
+0x82,
+0x84,
+0x37,
+0xbd,
+0x03,
+0x82,
+0xe5,
+0x37,
+0x9d,
+0x03,
+0x82,
+0x80,
+0x28,
+0x45,
+0x91,
+0x7d,
+0x01,
+0x82,
+0x9d,
+0x01,
+0x82,
+0x98,
+0x7d,
+0x02,
+0x82,
+0x9d,
+0x02,
+0x82,
+0x90,
+0x04,
+0xfe,
+0x03,
+0x82,
+0x18,
+0xa5,
+0x92,
+0xf0,
+0x0f,
+0x45,
+0x36,
+0x7d,
+0x02,
+0x82,
+0x9d,
+0x02,
+0x82,
+0x98,
+0x7d,
+0x03,
+0x82,
+0x9d,
+0x03,
+0x82,
+0xe8,
+0xe8,
+0xe8,
+0x60,
+0xe6,
+0x25,
+0x20,
+0xfa,
+0x2a,
+0x20,
+0x35,
+0x2e,
+0x20,
+0x1e,
+0x30,
+0x20,
+0x4d,
+0x31,
+0x20,
+0xb1,
+0x34,
+0x64,
+0x25,
+0x60,
+0xa5,
+0x41,
+0xc9,
+0x80,
+0x66,
+0x41,
+0x66,
+0x40,
+0x66,
+0x3f,
+0x66,
+0x3e,
+0xc9,
+0x80,
+0x66,
+0x41,
+0x66,
+0x40,
+0x66,
+0x3f,
+0x66,
+0x3e,
+0xc9,
+0x80,
+0x66,
+0x41,
+0x66,
+0x40,
+0x66,
+0x3f,
+0x66,
+0x3e,
+0xc9,
+0x80,
+0x66,
+0x41,
+0x66,
+0x40,
+0x66,
+0x3f,
+0x66,
+0x3e,
+0x60,
+0xa5,
+0x34,
+0x45,
+0x32,
+0x85,
+0x37,
+0x84,
+0x38,
+0xa5,
+0x35,
+0x45,
+0x32,
+0x18,
+0x65,
+0x38,
+0x85,
+0x38,
+0x98,
+0x69,
+0x00,
+0x85,
+0x39,
+0xa5,
+0x34,
+0x45,
+0x33,
+0x18,
+0x65,
+0x38,
+0x85,
+0x38,
+0x98,
+0x65,
+0x39,
+0x85,
+0x39,
+0xa9,
+0x00,
+0x69,
+0x00,
+0x85,
+0x3a,
+0xa5,
+0x35,
+0x45,
+0x33,
+0x18,
+0x65,
+0x39,
+0x85,
+0x39,
+0x98,
+0x65,
+0x3a,
+0x85,
+0x3a,
+0xa5,
+0x36,
+0x45,
+0x32,
+0x18,
+0x65,
+0x39,
+0x85,
+0x39,
+0x98,
+0x65,
+0x3a,
+0x85,
+0x3a,
+0xa9,
+0x00,
+0x69,
+0x00,
+0x85,
+0x3b,
+0xa5,
+0x36,
+0x45,
+0x33,
+0x18,
+0x65,
+0x3a,
+0x85,
+0x3a,
+0x98,
+0x65,
+0x3b,
+0x85,
+0x3b,
+0xa5,
+0x33,
+0x10,
+0x13,
+0x38,
+0xa5,
+0x39,
+0xe5,
+0x34,
+0x85,
+0x39,
+0xa5,
+0x3a,
+0xe5,
+0x35,
+0x85,
+0x3a,
+0xa5,
+0x3b,
+0xe5,
+0x36,
+0x85,
+0x3b,
+0x64,
+0x32,
+0xa5,
+0x37,
+0x29,
+0x0f,
+0xc9,
+0x08,
+0xd0,
+0x02,
+0xe6,
+0x32,
+0xa2,
+0x04,
+0xa5,
+0x3b,
+0xc9,
+0x80,
+0x66,
+0x3b,
+0x66,
+0x3a,
+0x66,
+0x39,
+0x66,
+0x38,
+0x66,
+0x37,
+0xca,
+0xd0,
+0xef,
+0xa5,
+0x3b,
+0xf0,
+0x22,
+0x10,
+0x13,
+0x1a,
+0xd0,
+0x04,
+0xa5,
+0x3a,
+0x30,
+0x1d,
+0x64,
+0x3e,
+0x64,
+0x3f,
+0x64,
+0x40,
+0xa9,
+0x80,
+0x85,
+0x41,
+0x18,
+0x60,
+0xa9,
+0xff,
+0x85,
+0x3e,
+0x85,
+0x3f,
+0x85,
+0x40,
+0x4a,
+0x85,
+0x41,
+0x18,
+0x60,
+0xa5,
+0x3a,
+0x30,
+0xef,
+0xa0,
+0x04,
+0x53,
+0x37,
+0x00,
+0x3e,
+0x00,
+0xa5,
+0x32,
+0xd0,
+0x03,
+0x2a,
+0x1a,
+0x6a,
+0x60,
+0xa9,
+0x80,
+0x38,
+0xed,
+0xb3,
+0x6b,
+0x85,
+0x74,
+0x64,
+0x6d,
+0xa0,
+0x09,
+0x53,
+0x5f,
+0x81,
+0x7b,
+0x00,
+0xa0,
+0x02,
+0x53,
+0xa9,
+0x7d,
+0x32,
+0x00,
+0xad,
+0xa3,
+0x7d,
+0x0a,
+0xaa,
+0xbd,
+0x97,
+0x7d,
+0x85,
+0x75,
+0xbd,
+0x98,
+0x7d,
+0x85,
+0x76,
+0xad,
+0xa4,
+0x7d,
+0x0a,
+0xaa,
+0xbd,
+0x97,
+0x7d,
+0x85,
+0x77,
+0xbd,
+0x98,
+0x7d,
+0x85,
+0x78,
+0xad,
+0xa5,
+0x7d,
+0x0a,
+0xaa,
+0xbd,
+0x97,
+0x7d,
+0x85,
+0x79,
+0xbd,
+0x98,
+0x7d,
+0x85,
+0x7a,
+0x64,
+0x84,
+0x64,
+0x85,
+0x64,
+0x86,
+0xa6,
+0x6d,
+0xb5,
+0xdc,
+0xf0,
+0x07,
+0xa9,
+0x80,
+0x85,
+0x86,
+0x4c,
+0x9b,
+0x2d,
+0x38,
+0xa5,
+0x7b,
+0xe5,
+0x7e,
+0x85,
+0x7b,
+0xa5,
+0x7c,
+0xe5,
+0x7f,
+0x85,
+0x7c,
+0xa5,
+0x7d,
+0xe5,
+0x80,
+0xa8,
+0xa5,
+0x7c,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xf0,
+0x12,
+0x98,
+0x30,
+0x09,
+0xa9,
+0xff,
+0x85,
+0x7b,
+0x4a,
+0x85,
+0x7c,
+0x80,
+0x06,
+0xa9,
+0x80,
+0x85,
+0x7c,
+0x64,
+0x7b,
+0x38,
+0xa5,
+0x81,
+0xe5,
+0x7e,
+0x85,
+0x81,
+0xa5,
+0x82,
+0xe5,
+0x7f,
+0x85,
+0x82,
+0xa5,
+0x83,
+0xe5,
+0x80,
+0xa8,
+0xa5,
+0x82,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xf0,
+0x12,
+0x98,
+0x30,
+0x09,
+0xa9,
+0xff,
+0x85,
+0x81,
+0x4a,
+0x85,
+0x82,
+0x80,
+0x06,
+0xa9,
+0x80,
+0x85,
+0x82,
+0x64,
+0x81,
+0xa0,
+0x02,
+0x53,
+0x81,
+0x00,
+0x34,
+0x00,
+0x20,
+0x6f,
+0x39,
+0x20,
+0x06,
+0x2a,
+0x90,
+0x0e,
+0xe6,
+0x3e,
+0xd0,
+0x0a,
+0xe6,
+0x3f,
+0xd0,
+0x06,
+0xe6,
+0x40,
+0xd0,
+0x02,
+0xe6,
+0x41,
+0xa2,
+0x00,
+0xa5,
+0x7b,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x42,
+0xa5,
+0x7c,
+0x10,
+0x01,
+0xca,
+0x65,
+0x3f,
+0x85,
+0x43,
+0x8a,
+0x65,
+0x40,
+0x85,
+0x44,
+0x8a,
+0x65,
+0x41,
+0x85,
+0x45,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x7b,
+0x85,
+0x34,
+0xa9,
+0x00,
+0xe5,
+0x7c,
+0x85,
+0x35,
+0xa5,
+0x6d,
+0x49,
+0x07,
+0xaa,
+0xda,
+0xbd,
+0xab,
+0x7d,
+0x85,
+0x32,
+0xbd,
+0xac,
+0x7d,
+0x85,
+0x33,
+0xa5,
+0x7c,
+0x10,
+0x05,
+0x20,
+0xb2,
+0x39,
+0x80,
+0x03,
+0x20,
+0x6f,
+0x39,
+0xa0,
+0x04,
+0x53,
+0x3e,
+0x00,
+0x46,
+0x00,
+0xfa,
+0xbd,
+0xad,
+0x7d,
+0x85,
+0x34,
+0xbd,
+0xae,
+0x7d,
+0x85,
+0x35,
+0xbd,
+0xaf,
+0x7d,
+0x85,
+0x36,
+0xa0,
+0x02,
+0x53,
+0x81,
+0x00,
+0x32,
+0x00,
+0x20,
+0x31,
+0x2a,
+0xa5,
+0x46,
+0xe5,
+0x3e,
+0x85,
+0x46,
+0xa5,
+0x47,
+0xe5,
+0x3f,
+0x85,
+0x47,
+0xa5,
+0x48,
+0xe5,
+0x40,
+0x85,
+0x48,
+0xa2,
+0x00,
+0xa5,
+0x49,
+0x10,
+0x01,
+0xca,
+0xe5,
+0x41,
+0x85,
+0x49,
+0x8a,
+0xa6,
+0x41,
+0x30,
+0x04,
+0xe9,
+0x00,
+0x80,
+0x02,
+0xe9,
+0xff,
+0x10,
+0x0f,
+0xc9,
+0xff,
+0xd0,
+0x04,
+0xa5,
+0x49,
+0x30,
+0x19,
+0xa9,
+0x80,
+0x85,
+0x49,
+0x0a,
+0x80,
+0x0c,
+0xd0,
+0x04,
+0xa5,
+0x49,
+0x10,
+0x0c,
+0xa9,
+0x7f,
+0x85,
+0x49,
+0xa9,
+0xff,
+0x85,
+0x48,
+0x85,
+0x47,
+0x85,
+0x46,
+0xa9,
+0x00,
+0xa8,
+0x38,
+0xe5,
+0x46,
+0x85,
+0x46,
+0x98,
+0xe5,
+0x47,
+0x85,
+0x47,
+0x98,
+0xe5,
+0x48,
+0x85,
+0x48,
+0x98,
+0xe5,
+0x49,
+0x85,
+0x49,
+0xa5,
+0x45,
+0x30,
+0x32,
+0x06,
+0x42,
+0x26,
+0x43,
+0x26,
+0x44,
+0x26,
+0x45,
+0xa5,
+0x42,
+0x05,
+0x43,
+0x05,
+0x44,
+0x05,
+0x45,
+0xd0,
+0x06,
+0x64,
+0x32,
+0x64,
+0x33,
+0x80,
+0x34,
+0xa5,
+0x49,
+0x30,
+0x18,
+0xa5,
+0x45,
+0x30,
+0x14,
+0x06,
+0x42,
+0x26,
+0x43,
+0x26,
+0x44,
+0x26,
+0x45,
+0x06,
+0x46,
+0x26,
+0x47,
+0x26,
+0x48,
+0x26,
+0x49,
+0x80,
+0xe6,
+0x80,
+0x6e,
+0xa0,
+0x02,
+0x53,
+0x48,
+0x00,
+0x32,
+0x00,
+0x53,
+0x44,
+0x00,
+0x34,
+0x00,
+0xa5,
+0x34,
+0x05,
+0x35,
+0xd0,
+0x03,
+0x4c,
+0x5c,
+0x2d,
+0x20,
+0x4e,
+0x39,
+0x38,
+0xa5,
+0x75,
+0xe5,
+0x32,
+0xa5,
+0x76,
+0xe5,
+0x33,
+0xb0,
+0x4b,
+0x38,
+0xa5,
+0x32,
+0xe5,
+0x79,
+0xa5,
+0x33,
+0xe5,
+0x7a,
+0xb0,
+0x40,
+0x38,
+0xa5,
+0x32,
+0xe5,
+0x77,
+0xa5,
+0x33,
+0xe5,
+0x78,
+0xb0,
+0x62,
+0xa0,
+0x02,
+0x53,
+0x77,
+0x00,
+0x34,
+0x00,
+0x38,
+0xa5,
+0x77,
+0xe5,
+0x32,
+0xaa,
+0x64,
+0x32,
+0xa5,
+0x78,
+0xe5,
+0x33,
+0x86,
+0x33,
+0x4a,
+0x66,
+0x33,
+0x66,
+0x32,
+0x4a,
+0x90,
+0x08,
+0x66,
+0x33,
+0x66,
+0x32,
+0x46,
+0x35,
+0x66,
+0x34,
+0x20,
+0x4e,
+0x39,
+0xa5,
+0x32,
+0x85,
+0x84,
+0x38,
+0xa9,
+0x80,
+0xe5,
+0x84,
+0x85,
+0x85,
+0x80,
+0x66,
+0xa2,
+0x00,
+0xa5,
+0x82,
+0x10,
+0x01,
+0xca,
+0x86,
+0x83,
+0xa2,
+0x00,
+0xa5,
+0x7c,
+0x10,
+0x01,
+0xca,
+0x86,
+0x7d,
+0x38,
+0xa5,
+0x81,
+0xe5,
+0x7b,
+0xa5,
+0x82,
+0xe5,
+0x7c,
+0xa5,
+0x83,
+0xe5,
+0x7d,
+0x10,
+0x06,
+0xa9,
+0x80,
+0x85,
+0x86,
+0x80,
+0x3f,
+0xa9,
+0x80,
+0x85,
+0x84,
+0x80,
+0x39,
+0x38,
+0xa5,
+0x79,
+0xe5,
+0x77,
+0x85,
+0x34,
+0xa5,
+0x7a,
+0xe5,
+0x78,
+0x85,
+0x35,
+0x38,
+0xa5,
+0x79,
+0xe5,
+0x32,
+0xaa,
+0x64,
+0x32,
+0xa5,
+0x7a,
+0xe5,
+0x33,
+0x86,
+0x33,
+0x4a,
+0x66,
+0x33,
+0x66,
+0x32,
+0x4a,
+0x90,
+0x08,
+0x66,
+0x33,
+0x66,
+0x32,
+0x46,
+0x35,
+0x66,
+0x34,
+0x20,
+0x4e,
+0x39,
+0xa5,
+0x32,
+0x85,
+0x85,
+0x38,
+0xa9,
+0x80,
+0xe5,
+0x85,
+0x85,
+0x86,
+0x64,
+0x2e,
+0x64,
+0x6c,
+0xa6,
+0x6c,
+0xb5,
+0x84,
+0x45,
+0x74,
+0x85,
+0x32,
+0x84,
+0x33,
+0xa5,
+0x6d,
+0x49,
+0x03,
+0x18,
+0x65,
+0x6c,
+0xaa,
+0xbd,
+0x15,
+0x6c,
+0x4d,
+0xb3,
+0x6b,
+0x18,
+0x65,
+0x32,
+0x85,
+0x32,
+0x98,
+0x65,
+0x33,
+0x06,
+0x32,
+0x2a,
+0xc5,
+0x2e,
+0x90,
+0x06,
+0xf0,
+0x04,
+0x85,
+0x2e,
+0x86,
+0x2f,
+0x9d,
+0x1b,
+0x6c,
+0xe6,
+0x6c,
+0xa5,
+0x6c,
+0xc9,
+0x03,
+0xd0,
+0xc8,
+0x38,
+0xa9,
+0x80,
+0xfd,
+0x19,
+0x6c,
+0xfd,
+0x1a,
+0x6c,
+0xfd,
+0x1b,
+0x6c,
+0xf0,
+0x09,
+0xa6,
+0x2f,
+0x18,
+0x7d,
+0x1b,
+0x6c,
+0x9d,
+0x1b,
+0x6c,
+0xe6,
+0x6d,
+0xa5,
+0x6d,
+0xc9,
+0x02,
+0xf0,
+0x3e,
+0xa0,
+0x09,
+0x53,
+0x68,
+0x81,
+0x7b,
+0x00,
+0xa0,
+0x02,
+0x53,
+0xb0,
+0x7d,
+0x32,
+0x00,
+0xad,
+0xa6,
+0x7d,
+0x0a,
+0xaa,
+0xbd,
+0x9d,
+0x7d,
+0x85,
+0x75,
+0xbd,
+0x9e,
+0x7d,
+0x85,
+0x76,
+0xad,
+0xa7,
+0x7d,
+0x0a,
+0xaa,
+0xbd,
+0x9d,
+0x7d,
+0x85,
+0x77,
+0xbd,
+0x9e,
+0x7d,
+0x85,
+0x78,
+0xad,
+0xa8,
+0x7d,
+0x0a,
+0xaa,
+0xbd,
+0x9d,
+0x7d,
+0x85,
+0x79,
+0xbd,
+0x9e,
+0x7d,
+0x85,
+0x7a,
+0x4c,
+0x3f,
+0x2b,
+0x60,
+0xa0,
+0x02,
+0x53,
+0x33,
+0xbe,
+0x36,
+0x00,
+0x53,
+0x35,
+0xbe,
+0x38,
+0x00,
+0xa0,
+0x00,
+0xfc,
+0xbd,
+0x71,
+0x81,
+0x0a,
+0xbd,
+0x72,
+0x81,
+0x69,
+0x00,
+0x99,
+0x71,
+0x81,
+0xbd,
+0x73,
+0x81,
+0x69,
+0x00,
+0x99,
+0x72,
+0x81,
+0xbd,
+0xb9,
+0x81,
+0x0a,
+0xbd,
+0xba,
+0x81,
+0x69,
+0x00,
+0x99,
+0xb9,
+0x81,
+0xbd,
+0xbb,
+0x81,
+0x69,
+0x00,
+0x99,
+0xba,
+0x81,
+0xbd,
+0x01,
+0x82,
+0x0a,
+0xbd,
+0x02,
+0x82,
+0x69,
+0x00,
+0x99,
+0x01,
+0x82,
+0xbd,
+0x03,
+0x82,
+0x69,
+0x00,
+0x99,
+0x02,
+0x82,
+0xc8,
+0xc8,
+0xe8,
+0xe8,
+0xe8,
+0xe0,
+0x48,
+0xd0,
+0xbb,
+0xa9,
+0xfc,
+0x85,
+0x50,
+0xa9,
+0x53,
+0x85,
+0x51,
+0x64,
+0x2e,
+0xa2,
+0x00,
+0x64,
+0x3e,
+0x64,
+0x3f,
+0x64,
+0x40,
+0x64,
+0x42,
+0x64,
+0x43,
+0x64,
+0x44,
+0x64,
+0x46,
+0x64,
+0x47,
+0x64,
+0x48,
+0xb2,
+0x50,
+0x85,
+0x2f,
+0x5d,
+0x71,
+0x81,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x98,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x90,
+0x03,
+0xe6,
+0x40,
+0x18,
+0xbd,
+0x72,
+0x81,
+0xf0,
+0x12,
+0x48,
+0x45,
+0x2f,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x2f,
+0x85,
+0x40,
+0xa5,
+0x2f,
+0x5d,
+0xb9,
+0x81,
+0x18,
+0x65,
+0x42,
+0x85,
+0x42,
+0x98,
+0x65,
+0x43,
+0x85,
+0x43,
+0x90,
+0x03,
+0xe6,
+0x44,
+0x18,
+0xbd,
+0xba,
+0x81,
+0xf0,
+0x12,
+0x48,
+0x45,
+0x2f,
+0x65,
+0x43,
+0x85,
+0x43,
+0x98,
+0x65,
+0x44,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x2f,
+0x85,
+0x44,
+0xa5,
+0x2f,
+0x5d,
+0x01,
+0x82,
+0x18,
+0x65,
+0x46,
+0x85,
+0x46,
+0x98,
+0x65,
+0x47,
+0x85,
+0x47,
+0x90,
+0x03,
+0xe6,
+0x48,
+0x18,
+0xbd,
+0x02,
+0x82,
+0xf0,
+0x12,
+0x48,
+0x45,
+0x2f,
+0x65,
+0x47,
+0x85,
+0x47,
+0x98,
+0x65,
+0x48,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x2f,
+0x85,
+0x48,
+0xe6,
+0x50,
+0xd0,
+0x02,
+0xe6,
+0x51,
+0xe8,
+0xe8,
+0xe0,
+0x30,
+0xf0,
+0x03,
+0x4c,
+0xa7,
+0x2e,
+0xa6,
+0x2e,
+0x06,
+0x3e,
+0x26,
+0x3f,
+0x26,
+0x40,
+0x06,
+0x3e,
+0xa9,
+0x00,
+0x65,
+0x3f,
+0x9d,
+0x49,
+0x82,
+0xa9,
+0x00,
+0x65,
+0x40,
+0x9d,
+0x4a,
+0x82,
+0x06,
+0x42,
+0x26,
+0x43,
+0x26,
+0x44,
+0x06,
+0x42,
+0xa9,
+0x00,
+0x65,
+0x43,
+0x85,
+0x42,
+0xa9,
+0x00,
+0x65,
+0x44,
+0x85,
+0x43,
+0x38,
+0xa5,
+0x42,
+0xe5,
+0x38,
+0xa5,
+0x43,
+0xe5,
+0x39,
+0x30,
+0x06,
+0xa5,
+0x38,
+0xa4,
+0x39,
+0x80,
+0x15,
+0x38,
+0xa5,
+0x42,
+0xe5,
+0x36,
+0xa5,
+0x43,
+0xe5,
+0x37,
+0x30,
+0x06,
+0xa5,
+0x42,
+0xa4,
+0x43,
+0x80,
+0x04,
+0xa5,
+0x36,
+0xa4,
+0x37,
+0x9d,
+0x7b,
+0x82,
+0x98,
+0x9d,
+0x7c,
+0x82,
+0x06,
+0x46,
+0x26,
+0x47,
+0x26,
+0x48,
+0x06,
+0x46,
+0xa9,
+0x00,
+0x65,
+0x47,
+0x85,
+0x46,
+0xa9,
+0x00,
+0x65,
+0x48,
+0x85,
+0x47,
+0x38,
+0xa5,
+0x46,
+0xe5,
+0x38,
+0xa5,
+0x47,
+0xe5,
+0x39,
+0x30,
+0x06,
+0xa5,
+0x38,
+0xa4,
+0x39,
+0x80,
+0x15,
+0x38,
+0xa5,
+0x46,
+0xe5,
+0x36,
+0xa5,
+0x47,
+0xe5,
+0x37,
+0x30,
+0x06,
+0xa5,
+0x46,
+0xa4,
+0x47,
+0x80,
+0x04,
+0xa5,
+0x36,
+0xa4,
+0x37,
+0x9d,
+0xad,
+0x82,
+0x98,
+0x9d,
+0xae,
+0x82,
+0xe8,
+0xe8,
+0xe0,
+0x18,
+0xd0,
+0x3b,
+0x9e,
+0x49,
+0x82,
+0x9e,
+0x4a,
+0x82,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x39,
+0x30,
+0x06,
+0xa5,
+0x38,
+0xa4,
+0x39,
+0x80,
+0x15,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x36,
+0xa9,
+0x00,
+0xe5,
+0x37,
+0x30,
+0x06,
+0xa9,
+0x00,
+0xa0,
+0x00,
+0x80,
+0x04,
+0xa5,
+0x36,
+0xa4,
+0x37,
+0x9d,
+0x7b,
+0x82,
+0x9d,
+0xad,
+0x82,
+0x98,
+0x9d,
+0x7c,
+0x82,
+0x9d,
+0xae,
+0x82,
+0xe8,
+0xe8,
+0x86,
+0x2e,
+0xe0,
+0x32,
+0xb0,
+0x03,
+0x4c,
+0x93,
+0x2e,
+0x60,
+0xa5,
+0x72,
+0x64,
+0x38,
+0x64,
+0x39,
+0x05,
+0x73,
+0xd0,
+0x05,
+0x64,
+0x32,
+0x64,
+0x33,
+0x60,
+0x64,
+0x2f,
+0x64,
+0x3e,
+0x64,
+0x3f,
+0x64,
+0x40,
+0xa2,
+0x00,
+0xa0,
+0x00,
+0xa5,
+0x2f,
+0xf0,
+0x05,
+0xc9,
+0x04,
+0xf0,
+0x01,
+0xc8,
+0x84,
+0x30,
+0x64,
+0x2e,
+0xa4,
+0x30,
+0xa5,
+0x2e,
+0xf0,
+0x05,
+0xc9,
+0x04,
+0xf0,
+0x01,
+0xc8,
+0xbd,
+0x4a,
+0x82,
+0x85,
+0x31,
+0xbd,
+0x49,
+0x82,
+0xc0,
+0x01,
+0x90,
+0x08,
+0xf0,
+0x03,
+0x0a,
+0x26,
+0x31,
+0x0a,
+0x26,
+0x31,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0xa5,
+0x31,
+0xa8,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x30,
+0x06,
+0x90,
+0x08,
+0xe6,
+0x40,
+0x80,
+0x04,
+0xb0,
+0x02,
+0xc6,
+0x40,
+0xe8,
+0xe8,
+0xa5,
+0x2e,
+0x1a,
+0x85,
+0x2e,
+0xc9,
+0x05,
+0xd0,
+0xbd,
+0xa5,
+0x2f,
+0x1a,
+0x85,
+0x2f,
+0xc9,
+0x05,
+0xd0,
+0xa5,
+0xa2,
+0x06,
+0xa5,
+0x40,
+0xc9,
+0x80,
+0x6a,
+0x66,
+0x3f,
+0x66,
+0x3e,
+0xca,
+0xd0,
+0xf6,
+0xa5,
+0x3f,
+0x85,
+0x39,
+0xa5,
+0x3e,
+0x90,
+0x05,
+0x1a,
+0xd0,
+0x02,
+0xe6,
+0x39,
+0x85,
+0x38,
+0xa5,
+0x72,
+0x85,
+0x34,
+0xa6,
+0x73,
+0x86,
+0x35,
+0xa6,
+0x70,
+0x10,
+0x30,
+0xa0,
+0x00,
+0x98,
+0x38,
+0xe5,
+0x6e,
+0x85,
+0x32,
+0x98,
+0xe5,
+0x6f,
+0x85,
+0x33,
+0x98,
+0xe5,
+0x70,
+0xf0,
+0x0c,
+0x46,
+0x35,
+0x66,
+0x34,
+0x4a,
+0x66,
+0x33,
+0x66,
+0x32,
+0xaa,
+0xd0,
+0xf4,
+0x20,
+0x4e,
+0x39,
+0x18,
+0xa5,
+0x32,
+0x65,
+0x38,
+0x85,
+0x32,
+0xa5,
+0x33,
+0x65,
+0x39,
+0x85,
+0x33,
+0x80,
+0x26,
+0x8a,
+0xf0,
+0x0c,
+0x46,
+0x35,
+0x66,
+0x34,
+0x4a,
+0x66,
+0x6f,
+0x66,
+0x6e,
+0xaa,
+0xd0,
+0xf4,
+0xa0,
+0x02,
+0x53,
+0x6e,
+0x00,
+0x32,
+0x00,
+0x20,
+0x4e,
+0x39,
+0x38,
+0xa5,
+0x38,
+0xe5,
+0x32,
+0x85,
+0x32,
+0xa5,
+0x39,
+0xe5,
+0x33,
+0x85,
+0x33,
+0xa2,
+0x00,
+0x38,
+0xbd,
+0x49,
+0x82,
+0xe5,
+0x32,
+0xa8,
+0xbd,
+0x4a,
+0x82,
+0xe5,
+0x33,
+0x30,
+0x10,
+0xc9,
+0x03,
+0x90,
+0x1a,
+0xd0,
+0x04,
+0xc0,
+0xff,
+0x90,
+0x14,
+0xa0,
+0xff,
+0xa9,
+0x03,
+0x80,
+0x0e,
+0xc9,
+0xfc,
+0x90,
+0x06,
+0xd0,
+0x08,
+0xc0,
+0x00,
+0xb0,
+0x04,
+0xa0,
+0x00,
+0xa9,
+0xfc,
+0x9d,
+0x4a,
+0x82,
+0x98,
+0x9d,
+0x49,
+0x82,
+0xe8,
+0xe8,
+0xe0,
+0x32,
+0xd0,
+0xc7,
+0x60,
+0x20,
+0x8d,
+0x31,
+0xa9,
+0x49,
+0x85,
+0x4a,
+0xa9,
+0x82,
+0x85,
+0x4b,
+0x20,
+0xe0,
+0x32,
+0xa0,
+0x32,
+0x53,
+0xdf,
+0x82,
+0x49,
+0x82,
+0xa9,
+0x7b,
+0x85,
+0x4a,
+0xa9,
+0x82,
+0x85,
+0x4b,
+0x20,
+0xe0,
+0x32,
+0x20,
+0x1d,
+0x34,
+0xa0,
+0x32,
+0x53,
+0xdf,
+0x82,
+0x7b,
+0x82,
+0xa9,
+0xad,
+0x85,
+0x4a,
+0xa9,
+0x82,
+0x85,
+0x4b,
+0x20,
+0xe0,
+0x32,
+0x20,
+0x1d,
+0x34,
+0xa0,
+0x32,
+0x53,
+0xdf,
+0x82,
+0xad,
+0x82,
+0x60,
+0xa5,
+0x28,
+0x49,
+0x04,
+0x85,
+0x2e,
+0x38,
+0xa5,
+0x29,
+0x1a,
+0xe5,
+0x28,
+0x49,
+0x14,
+0x85,
+0x38,
+0x84,
+0x39,
+0x64,
+0x3a,
+0x64,
+0x3b,
+0xa2,
+0x00,
+0xa5,
+0x3a,
+0x85,
+0x32,
+0xa5,
+0x3b,
+0x85,
+0x33,
+0xa9,
+0x14,
+0x85,
+0x34,
+0x64,
+0x35,
+0xda,
+0x20,
+0x2a,
+0x39,
+0xfa,
+0x18,
+0xa5,
+0x32,
+0x65,
+0x2e,
+0x9d,
+0x11,
+0x83,
+0x18,
+0xa5,
+0x3a,
+0x65,
+0x38,
+0x85,
+0x3a,
+0xa5,
+0x3b,
+0x65,
+0x39,
+0x85,
+0x3b,
+0xe8,
+0xe0,
+0x05,
+0xd0,
+0xd3,
+0xbd,
+0x10,
+0x83,
+0x1a,
+0x9d,
+0x11,
+0x83,
+0xa5,
+0x26,
+0x49,
+0x04,
+0x85,
+0x2e,
+0x38,
+0xa5,
+0x27,
+0x1a,
+0xe5,
+0x26,
+0x49,
+0x10,
+0x85,
+0x38,
+0x84,
+0x39,
+0x64,
+0x3a,
+0x64,
+0x3b,
+0xa2,
+0x00,
+0xa5,
+0x3a,
+0x85,
+0x32,
+0xa5,
+0x3b,
+0x85,
+0x33,
+0xa9,
+0x10,
+0x85,
+0x34,
+0x64,
+0x35,
+0xda,
+0x20,
+0x2a,
+0x39,
+0xfa,
+0x18,
+0xa5,
+0x32,
+0x65,
+0x2e,
+0x9d,
+0x17,
+0x83,
+0x18,
+0xa5,
+0x3a,
+0x65,
+0x38,
+0x85,
+0x3a,
+0xa5,
+0x3b,
+0x65,
+0x39,
+0x85,
+0x3b,
+0xe8,
+0xe0,
+0x05,
+0xd0,
+0xd3,
+0xbd,
+0x16,
+0x83,
+0x1a,
+0x9d,
+0x17,
+0x83,
+0x60,
+0xa5,
+0x2e,
+0xa2,
+0x00,
+0xe8,
+0xdd,
+0x11,
+0x83,
+0xb0,
+0xfa,
+0xca,
+0x8a,
+0x0a,
+0x18,
+0x60,
+0xa5,
+0x2f,
+0xa2,
+0x00,
+0xe8,
+0xdd,
+0x17,
+0x83,
+0xb0,
+0xfa,
+0xca,
+0x8a,
+0x0a,
+0x18,
+0x60,
+0xb1,
+0x4a,
+0x85,
+0x38,
+0xc8,
+0xb1,
+0x4a,
+0x85,
+0x39,
+0x38,
+0xa5,
+0x2e,
+0xfd,
+0x11,
+0x83,
+0x85,
+0x31,
+0xf0,
+0x0f,
+0xc8,
+0x38,
+0xbd,
+0x12,
+0x83,
+0xfd,
+0x11,
+0x83,
+0x85,
+0x34,
+0x64,
+0x35,
+0x20,
+0x8e,
+0x32,
+0x60,
+0xb1,
+0x4a,
+0x85,
+0x38,
+0xc8,
+0xb1,
+0x4a,
+0x85,
+0x39,
+0x38,
+0xa5,
+0x2f,
+0xfd,
+0x17,
+0x83,
+0x85,
+0x31,
+0xf0,
+0x13,
+0x18,
+0x98,
+0x69,
+0x09,
+0xa8,
+0x38,
+0xbd,
+0x18,
+0x83,
+0xfd,
+0x17,
+0x83,
+0x85,
+0x34,
+0x64,
+0x35,
+0x20,
+0x8e,
+0x32,
+0x60,
+0x38,
+0xb1,
+0x4a,
+0xe5,
+0x38,
+0x85,
+0x32,
+0xc8,
+0xb1,
+0x4a,
+0xa0,
+0x00,
+0xe5,
+0x39,
+0x85,
+0x33,
+0x10,
+0x0c,
+0x38,
+0x98,
+0xe5,
+0x32,
+0x85,
+0x32,
+0x98,
+0xe5,
+0x33,
+0x85,
+0x33,
+0xc8,
+0x5a,
+0xa5,
+0x32,
+0x45,
+0x31,
+0x85,
+0x32,
+0x84,
+0x4c,
+0xa5,
+0x33,
+0x45,
+0x31,
+0x18,
+0x65,
+0x4c,
+0x85,
+0x33,
+0x20,
+0x4e,
+0x39,
+0x7a,
+0xf0,
+0x0e,
+0x38,
+0xa5,
+0x38,
+0xe5,
+0x32,
+0x85,
+0x38,
+0xa5,
+0x39,
+0xe5,
+0x33,
+0x85,
+0x39,
+0x60,
+0x18,
+0xa5,
+0x38,
+0x65,
+0x32,
+0x85,
+0x38,
+0xa5,
+0x39,
+0x65,
+0x33,
+0x85,
+0x39,
+0x60,
+0x64,
+0x30,
+0x64,
+0x2f,
+0x64,
+0x2e,
+0xa5,
+0x2f,
+0xcd,
+0x17,
+0x83,
+0xb0,
+0x33,
+0xa5,
+0x2e,
+0xcd,
+0x11,
+0x83,
+0xb0,
+0x0d,
+0xb2,
+0x4a,
+0x85,
+0x38,
+0xa0,
+0x01,
+0xb1,
+0x4a,
+0x85,
+0x39,
+0x4c,
+0xf0,
+0x33,
+0xcd,
+0x15,
+0x83,
+0xf0,
+0x10,
+0x90,
+0x0e,
+0xa0,
+0x08,
+0xb1,
+0x4a,
+0x85,
+0x38,
+0xc8,
+0xb1,
+0x4a,
+0x85,
+0x39,
+0x4c,
+0xf0,
+0x33,
+0x20,
+0x26,
+0x32,
+0xa8,
+0x20,
+0x44,
+0x32,
+0x4c,
+0xf0,
+0x33,
+0xcd,
+0x1b,
+0x83,
+0xf0,
+0x38,
+0x90,
+0x36,
+0xa5,
+0x2e,
+0xcd,
+0x11,
+0x83,
+0xb0,
+0x0e,
+0xa0,
+0x28,
+0xb1,
+0x4a,
+0x85,
+0x38,
+0xc8,
+0xb1,
+0x4a,
+0x85,
+0x39,
+0x4c,
+0xf0,
+0x33,
+0xcd,
+0x15,
+0x83,
+0xf0,
+0x10,
+0x90,
+0x0e,
+0xa0,
+0x30,
+0xb1,
+0x4a,
+0x85,
+0x38,
+0xc8,
+0xb1,
+0x4a,
+0x85,
+0x39,
+0x4c,
+0xf0,
+0x33,
+0x20,
+0x26,
+0x32,
+0x69,
+0x28,
+0xa8,
+0x20,
+0x44,
+0x32,
+0x4c,
+0xf0,
+0x33,
+0xa5,
+0x2e,
+0xcd,
+0x11,
+0x83,
+0xb0,
+0x0c,
+0x20,
+0x35,
+0x32,
+0x49,
+0x05,
+0xa8,
+0x20,
+0x67,
+0x32,
+0x4c,
+0xf0,
+0x33,
+0xcd,
+0x15,
+0x83,
+0xf0,
+0x0f,
+0x90,
+0x0d,
+0x20,
+0x35,
+0x32,
+0x49,
+0x05,
+0x69,
+0x08,
+0xa8,
+0x20,
+0x67,
+0x32,
+0x80,
+0x6c,
+0x20,
+0x35,
+0x32,
+0x86,
+0x3d,
+0x49,
+0x05,
+0x85,
+0x4d,
+0x20,
+0x26,
+0x32,
+0x86,
+0x3c,
+0x65,
+0x4d,
+0x85,
+0x4d,
+0xa8,
+0x20,
+0x44,
+0x32,
+0xa6,
+0x3d,
+0x38,
+0xa5,
+0x2f,
+0xfd,
+0x17,
+0x83,
+0xf0,
+0x4c,
+0xa6,
+0x31,
+0xd0,
+0x09,
+0xa6,
+0x3d,
+0xa4,
+0x4d,
+0x20,
+0x67,
+0x32,
+0x80,
+0x3f,
+0x48,
+0xa5,
+0x38,
+0x85,
+0x3a,
+0xa5,
+0x39,
+0x85,
+0x3b,
+0xa6,
+0x3c,
+0x18,
+0xa5,
+0x4d,
+0x69,
+0x0a,
+0xa8,
+0x20,
+0x44,
+0x32,
+0xa6,
+0x3d,
+0x38,
+0xbd,
+0x18,
+0x83,
+0xfd,
+0x17,
+0x83,
+0x85,
+0x34,
+0x64,
+0x35,
+0x68,
+0x85,
+0x31,
+0x38,
+0xa5,
+0x38,
+0xe5,
+0x3a,
+0x85,
+0x32,
+0xa5,
+0x39,
+0xe5,
+0x3b,
+0x85,
+0x33,
+0xa0,
+0x02,
+0x53,
+0x3a,
+0x00,
+0x38,
+0x00,
+0xa0,
+0x00,
+0xa5,
+0x33,
+0x20,
+0x9e,
+0x32,
+0xa6,
+0x30,
+0xa5,
+0x38,
+0x9d,
+0xdf,
+0x82,
+0xa5,
+0x39,
+0xe8,
+0x9d,
+0xdf,
+0x82,
+0xe8,
+0x86,
+0x30,
+0x18,
+0xa5,
+0x2e,
+0x69,
+0x14,
+0x85,
+0x2e,
+0xc9,
+0x51,
+0xb0,
+0x03,
+0x4c,
+0xe6,
+0x32,
+0x18,
+0xa5,
+0x2f,
+0x69,
+0x10,
+0x85,
+0x2f,
+0xc9,
+0x41,
+0xb0,
+0x03,
+0x4c,
+0xe4,
+0x32,
+0x60,
+0xa0,
+0x02,
+0x53,
+0xf7,
+0x82,
+0x32,
+0x00,
+0xa2,
+0x00,
+0x38,
+0xbd,
+0xdf,
+0x82,
+0xe5,
+0x32,
+0x9d,
+0xdf,
+0x82,
+0xe8,
+0xbd,
+0xdf,
+0x82,
+0xe5,
+0x33,
+0x9d,
+0xdf,
+0x82,
+0xe8,
+0xe0,
+0x32,
+0xd0,
+0xe9,
+0x60,
+0x85,
+0x4c,
+0x86,
+0x4d,
+0xa2,
+0x00,
+0xdc,
+0xb1,
+0x4a,
+0x45,
+0x2e,
+0x85,
+0x3e,
+0x84,
+0x3f,
+0xdc,
+0xc8,
+0xb1,
+0x4a,
+0x48,
+0x45,
+0x2e,
+0x18,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x69,
+0x00,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x2e,
+0x85,
+0x40,
+0xdc,
+0xb1,
+0x4c,
+0x45,
+0x2f,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x98,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x90,
+0x03,
+0xe6,
+0x40,
+0x18,
+0xdc,
+0xc8,
+0xb1,
+0x4c,
+0x48,
+0x45,
+0x2f,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x2f,
+0x85,
+0x40,
+0x06,
+0x3e,
+0xa5,
+0x3f,
+0x2a,
+0xdc,
+0x91,
+0x4a,
+0xa5,
+0x40,
+0x2a,
+0xc8,
+0x91,
+0x4a,
+0xe8,
+0xe8,
+0xe0,
+0x32,
+0xd0,
+0xa2,
+0x60,
+0xc9,
+0xa7,
+0x90,
+0x03,
+0xa9,
+0xa6,
+0x60,
+0xc9,
+0x5a,
+0xb0,
+0x02,
+0xa9,
+0x5a,
+0x60,
+0xad,
+0xb3,
+0x6b,
+0x85,
+0x2e,
+0xa9,
+0x80,
+0x38,
+0xe5,
+0x2e,
+0x85,
+0x2f,
+0xa9,
+0x21,
+0x85,
+0x4a,
+0xa9,
+0x6c,
+0x85,
+0x4b,
+0xa9,
+0x7b,
+0xa2,
+0x82,
+0x20,
+0x3e,
+0x34,
+0xa9,
+0x53,
+0x85,
+0x4a,
+0xa9,
+0x6c,
+0x85,
+0x4b,
+0xa9,
+0xad,
+0xa2,
+0x82,
+0x20,
+0x3e,
+0x34,
+0xa9,
+0x85,
+0x85,
+0x4a,
+0xa9,
+0x6c,
+0x85,
+0x4b,
+0xa9,
+0x49,
+0xa2,
+0x82,
+0x20,
+0x3e,
+0x34,
+0xa9,
+0x39,
+0x85,
+0x4a,
+0xa9,
+0x75,
+0x85,
+0x4b,
+0xa9,
+0xe6,
+0x85,
+0x4c,
+0xa9,
+0x70,
+0x85,
+0x4d,
+0xa9,
+0x74,
+0x85,
+0x4e,
+0xa9,
+0x57,
+0x85,
+0x4f,
+0xa2,
+0x02,
+0xbd,
+0x1b,
+0x6c,
+0xbc,
+0xa3,
+0x7d,
+0x99,
+0x7e,
+0x00,
+0xbd,
+0x1e,
+0x6c,
+0xbc,
+0xa6,
+0x7d,
+0x99,
+0x81,
+0x00,
+0xca,
+0x10,
+0xeb,
+0xa9,
+0x11,
+0x85,
+0x2e,
+0xa9,
+0x15,
+0x85,
+0x2f,
+0xa0,
+0x06,
+0xd3,
+0x4a,
+0x75,
+0x00,
+0xa0,
+0x02,
+0xd3,
+0x4e,
+0x30,
+0x00,
+0xa6,
+0x31,
+0xa4,
+0x30,
+0xb9,
+0x24,
+0x57,
+0x85,
+0x50,
+0xd0,
+0x0d,
+0xbd,
+0x21,
+0x6c,
+0x85,
+0x3f,
+0xbd,
+0x22,
+0x6c,
+0x85,
+0x40,
+0x4c,
+0xfe,
+0x35,
+0xb9,
+0x25,
+0x57,
+0x85,
+0x51,
+0xb9,
+0x26,
+0x57,
+0x85,
+0x52,
+0xb9,
+0x27,
+0x57,
+0x85,
+0x53,
+0xbd,
+0x21,
+0x6c,
+0x45,
+0x50,
+0x85,
+0x3e,
+0x84,
+0x3f,
+0xbd,
+0x22,
+0x6c,
+0x48,
+0x45,
+0x50,
+0x18,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x69,
+0x00,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x50,
+0x85,
+0x40,
+0xa5,
+0x51,
+0xf0,
+0x27,
+0x5d,
+0x23,
+0x6c,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x98,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x90,
+0x03,
+0xe6,
+0x40,
+0x18,
+0xbd,
+0x24,
+0x6c,
+0x48,
+0x45,
+0x51,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x51,
+0x85,
+0x40,
+0xa5,
+0x52,
+0xf0,
+0x27,
+0x5d,
+0x2b,
+0x6c,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x98,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x90,
+0x03,
+0xe6,
+0x40,
+0x18,
+0xbd,
+0x2c,
+0x6c,
+0x48,
+0x45,
+0x52,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x52,
+0x85,
+0x40,
+0xa5,
+0x53,
+0xf0,
+0x27,
+0x5d,
+0x2d,
+0x6c,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x98,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x90,
+0x03,
+0xe6,
+0x40,
+0x18,
+0xbd,
+0x2e,
+0x6c,
+0x48,
+0x45,
+0x53,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x53,
+0x85,
+0x40,
+0xa5,
+0x3e,
+0x10,
+0x06,
+0xe6,
+0x3f,
+0xd0,
+0x02,
+0xe6,
+0x40,
+0xa5,
+0x40,
+0x30,
+0x15,
+0x49,
+0x0b,
+0x18,
+0x69,
+0x80,
+0x85,
+0x33,
+0xa5,
+0x3f,
+0x49,
+0x0b,
+0x85,
+0x32,
+0x98,
+0x18,
+0x65,
+0x33,
+0x85,
+0x33,
+0x80,
+0x2b,
+0xa9,
+0x00,
+0x38,
+0xe5,
+0x3f,
+0xa8,
+0xa9,
+0x00,
+0xe5,
+0x40,
+0x85,
+0x40,
+0x98,
+0x49,
+0x0b,
+0x85,
+0x3e,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x3e,
+0x85,
+0x32,
+0x84,
+0x3e,
+0xa9,
+0x80,
+0xe5,
+0x3e,
+0x48,
+0xa5,
+0x40,
+0x49,
+0x0b,
+0x85,
+0x3e,
+0x38,
+0x68,
+0xe5,
+0x3e,
+0x85,
+0x33,
+0xa5,
+0x75,
+0x45,
+0x7e,
+0x85,
+0x34,
+0x84,
+0x35,
+0xa5,
+0x76,
+0x45,
+0x7f,
+0x18,
+0x65,
+0x34,
+0x85,
+0x34,
+0x98,
+0x65,
+0x35,
+0x85,
+0x35,
+0xa5,
+0x77,
+0x45,
+0x80,
+0x18,
+0x65,
+0x34,
+0x85,
+0x34,
+0x98,
+0x65,
+0x35,
+0x06,
+0x34,
+0x2a,
+0x06,
+0x34,
+0x69,
+0x00,
+0x85,
+0x34,
+0x45,
+0x32,
+0x85,
+0x3e,
+0x84,
+0x3f,
+0xa5,
+0x34,
+0x45,
+0x33,
+0x18,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x69,
+0x00,
+0x06,
+0x3f,
+0x2a,
+0xb0,
+0x0a,
+0x06,
+0x3f,
+0x69,
+0x00,
+0xb0,
+0x04,
+0xc9,
+0xf4,
+0x90,
+0x04,
+0xa9,
+0xf3,
+0x80,
+0x06,
+0xc9,
+0x40,
+0xb0,
+0x02,
+0xa9,
+0x40,
+0x92,
+0x4c,
+0xa6,
+0x31,
+0xa5,
+0x50,
+0xd0,
+0x0d,
+0xbd,
+0x53,
+0x6c,
+0x85,
+0x3f,
+0xbd,
+0x54,
+0x6c,
+0x85,
+0x40,
+0x4c,
+0x57,
+0x37,
+0xbd,
+0x53,
+0x6c,
+0x45,
+0x50,
+0x85,
+0x3e,
+0x84,
+0x3f,
+0xbd,
+0x54,
+0x6c,
+0x48,
+0x45,
+0x50,
+0x18,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x69,
+0x00,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x50,
+0x85,
+0x40,
+0xa5,
+0x51,
+0xf0,
+0x27,
+0x5d,
+0x55,
+0x6c,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x98,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x90,
+0x03,
+0xe6,
+0x40,
+0x18,
+0xbd,
+0x56,
+0x6c,
+0x48,
+0x45,
+0x51,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x51,
+0x85,
+0x40,
+0xa5,
+0x52,
+0xf0,
+0x27,
+0x5d,
+0x5d,
+0x6c,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x98,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x90,
+0x03,
+0xe6,
+0x40,
+0x18,
+0xbd,
+0x5e,
+0x6c,
+0x48,
+0x45,
+0x52,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x52,
+0x85,
+0x40,
+0xa5,
+0x53,
+0xf0,
+0x27,
+0x5d,
+0x5f,
+0x6c,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x98,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x90,
+0x03,
+0xe6,
+0x40,
+0x18,
+0xbd,
+0x60,
+0x6c,
+0x48,
+0x45,
+0x53,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x53,
+0x85,
+0x40,
+0xa5,
+0x3e,
+0x10,
+0x06,
+0xe6,
+0x3f,
+0xd0,
+0x02,
+0xe6,
+0x40,
+0xa5,
+0x40,
+0x30,
+0x15,
+0x49,
+0x0b,
+0x18,
+0x69,
+0x80,
+0x85,
+0x33,
+0xa5,
+0x3f,
+0x49,
+0x0b,
+0x85,
+0x32,
+0x98,
+0x18,
+0x65,
+0x33,
+0x85,
+0x33,
+0x80,
+0x2b,
+0xa9,
+0x00,
+0x38,
+0xe5,
+0x3f,
+0xa8,
+0xa9,
+0x00,
+0xe5,
+0x40,
+0x85,
+0x40,
+0x98,
+0x49,
+0x0b,
+0x85,
+0x3e,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0x3e,
+0x85,
+0x32,
+0x84,
+0x3e,
+0xa9,
+0x80,
+0xe5,
+0x3e,
+0x48,
+0xa5,
+0x40,
+0x49,
+0x0b,
+0x85,
+0x3e,
+0x38,
+0x68,
+0xe5,
+0x3e,
+0x85,
+0x33,
+0xa5,
+0x81,
+0x45,
+0x78,
+0x85,
+0x34,
+0x84,
+0x35,
+0xa5,
+0x82,
+0x45,
+0x79,
+0x18,
+0x65,
+0x34,
+0x85,
+0x34,
+0x98,
+0x65,
+0x35,
+0x85,
+0x35,
+0xa5,
+0x83,
+0x45,
+0x7a,
+0x18,
+0x65,
+0x34,
+0x85,
+0x34,
+0x98,
+0x65,
+0x35,
+0x06,
+0x34,
+0x2a,
+0x06,
+0x34,
+0x69,
+0x00,
+0x85,
+0x34,
+0x45,
+0x32,
+0x85,
+0x3e,
+0x84,
+0x3f,
+0xa5,
+0x34,
+0x45,
+0x33,
+0x18,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x69,
+0x00,
+0x06,
+0x3f,
+0x2a,
+0xb0,
+0x0a,
+0x06,
+0x3f,
+0x69,
+0x00,
+0xb0,
+0x04,
+0xc9,
+0xf4,
+0x90,
+0x04,
+0xa9,
+0xf3,
+0x80,
+0x06,
+0xc9,
+0x40,
+0xb0,
+0x02,
+0xa9,
+0x40,
+0xa0,
+0x01,
+0x91,
+0x4c,
+0xa6,
+0x31,
+0xa5,
+0x50,
+0xd0,
+0x0d,
+0xbd,
+0x85,
+0x6c,
+0x85,
+0x3f,
+0xbd,
+0x86,
+0x6c,
+0x85,
+0x40,
+0x4c,
+0xb2,
+0x38,
+0xbd,
+0x85,
+0x6c,
+0x45,
+0x50,
+0x85,
+0x3e,
+0x84,
+0x3f,
+0xbd,
+0x86,
+0x6c,
+0x48,
+0x45,
+0x50,
+0x18,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x69,
+0x00,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x50,
+0x85,
+0x40,
+0xa5,
+0x51,
+0xf0,
+0x27,
+0x5d,
+0x87,
+0x6c,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x98,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x90,
+0x03,
+0xe6,
+0x40,
+0x18,
+0xbd,
+0x88,
+0x6c,
+0x48,
+0x45,
+0x51,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x51,
+0x85,
+0x40,
+0xa5,
+0x52,
+0xf0,
+0x27,
+0x5d,
+0x8f,
+0x6c,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x98,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x90,
+0x03,
+0xe6,
+0x40,
+0x18,
+0xbd,
+0x90,
+0x6c,
+0x48,
+0x45,
+0x52,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x52,
+0x85,
+0x40,
+0xa5,
+0x53,
+0xf0,
+0x27,
+0x5d,
+0x91,
+0x6c,
+0x18,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x98,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x90,
+0x03,
+0xe6,
+0x40,
+0x18,
+0xbd,
+0x92,
+0x6c,
+0x48,
+0x45,
+0x53,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x7a,
+0x10,
+0x03,
+0x38,
+0xe5,
+0x53,
+0x85,
+0x40,
+0xa5,
+0x3e,
+0x10,
+0x06,
+0xe6,
+0x3f,
+0xd0,
+0x02,
+0xe6,
+0x40,
+0xa2,
+0x00,
+0xa5,
+0x40,
+0x10,
+0x0e,
+0xe8,
+0xa9,
+0x00,
+0x38,
+0xe5,
+0x3f,
+0x85,
+0x3f,
+0xa9,
+0x00,
+0xe5,
+0x40,
+0x85,
+0x40,
+0xda,
+0xa5,
+0x3f,
+0x49,
+0x0b,
+0x85,
+0x32,
+0x84,
+0x33,
+0xa5,
+0x40,
+0x49,
+0x0b,
+0x18,
+0x65,
+0x33,
+0x85,
+0x33,
+0x46,
+0x33,
+0x66,
+0x32,
+0x10,
+0x02,
+0xe6,
+0x33,
+0x18,
+0xa5,
+0x33,
+0x69,
+0x80,
+0xaa,
+0x38,
+0xa9,
+0x80,
+0xe5,
+0x33,
+0x7a,
+0xf0,
+0x01,
+0x8a,
+0x20,
+0xa3,
+0x34,
+0xa0,
+0x02,
+0x91,
+0x4c,
+0x18,
+0xa5,
+0x4a,
+0x69,
+0x06,
+0x85,
+0x4a,
+0x90,
+0x03,
+0xe6,
+0x4b,
+0x18,
+0xa5,
+0x4c,
+0x69,
+0x03,
+0x85,
+0x4c,
+0x90,
+0x03,
+0xe6,
+0x4d,
+0x18,
+0xa5,
+0x4e,
+0x69,
+0x02,
+0x85,
+0x4e,
+0x90,
+0x02,
+0xe6,
+0x4f,
+0xc6,
+0x2f,
+0xf0,
+0x03,
+0x4c,
+0x21,
+0x35,
+0xc6,
+0x2e,
+0xf0,
+0x03,
+0x4c,
+0x1d,
+0x35,
+0xa9,
+0x01,
+0x85,
+0x22,
+0x60,
+0x64,
+0x36,
+0x64,
+0x37,
+0xa2,
+0x10,
+0x06,
+0x32,
+0x26,
+0x33,
+0x26,
+0x36,
+0x26,
+0x37,
+0xa5,
+0x36,
+0x38,
+0xe5,
+0x34,
+0xa8,
+0xa5,
+0x37,
+0xe5,
+0x35,
+0x90,
+0x06,
+0x85,
+0x37,
+0x84,
+0x36,
+0xe6,
+0x32,
+0xca,
+0xd0,
+0xe3,
+0x60,
+0x20,
+0x2a,
+0x39,
+0x46,
+0x35,
+0x66,
+0x34,
+0x90,
+0x06,
+0xe6,
+0x34,
+0xd0,
+0x02,
+0xe6,
+0x35,
+0x38,
+0xa5,
+0x36,
+0xe5,
+0x34,
+0xa5,
+0x37,
+0xe5,
+0x35,
+0x30,
+0x06,
+0xe6,
+0x32,
+0xd0,
+0x02,
+0xe6,
+0x33,
+0x60,
+0xa5,
+0x32,
+0x45,
+0x34,
+0x85,
+0x3e,
+0x84,
+0x3f,
+0xa5,
+0x32,
+0x45,
+0x35,
+0x18,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x69,
+0x00,
+0x85,
+0x40,
+0xa5,
+0x33,
+0x45,
+0x34,
+0x18,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x85,
+0x40,
+0xa5,
+0x33,
+0x45,
+0x35,
+0x65,
+0x40,
+0x85,
+0x40,
+0x98,
+0x69,
+0x00,
+0x85,
+0x41,
+0xa5,
+0x35,
+0x10,
+0x0d,
+0x38,
+0xa5,
+0x40,
+0xe5,
+0x32,
+0x85,
+0x40,
+0xa5,
+0x41,
+0xe5,
+0x33,
+0x85,
+0x41,
+0x60,
+0xa5,
+0x32,
+0x45,
+0x34,
+0x85,
+0x3e,
+0x84,
+0x3f,
+0xa5,
+0x32,
+0x45,
+0x35,
+0x18,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x69,
+0x00,
+0x85,
+0x40,
+0xa5,
+0x33,
+0x45,
+0x34,
+0x18,
+0x65,
+0x3f,
+0x85,
+0x3f,
+0x98,
+0x65,
+0x40,
+0x85,
+0x40,
+0xa5,
+0x33,
+0x45,
+0x35,
+0x65,
+0x40,
+0x85,
+0x40,
+0x98,
+0x69,
+0x00,
+0x85,
+0x41,
+0x60,
+0xda,
+0x29,
+0x01,
+0xf0,
+0x06,
+0xa9,
+0x68,
+0xa0,
+0x04,
+0x80,
+0x04,
+0xa9,
+0x90,
+0xa0,
+0x00,
+0x85,
+0xe6,
+0x84,
+0xe7,
+0x38,
+0xa5,
+0xb5,
+0xe5,
+0xb4,
+0x1a,
+0x1a,
+0x85,
+0xde,
+0xa0,
+0x02,
+0x53,
+0xac,
+0x00,
+0xea,
+0x00,
+0xa5,
+0xb4,
+0xa6,
+0xb6,
+0xf0,
+0x02,
+0xa5,
+0xb5,
+0xaa,
+0x85,
+0xdf,
+0x8a,
+0x18,
+0x65,
+0xb6,
+0x49,
+0x03,
+0x85,
+0xe8,
+0xa5,
+0xaa,
+0x48,
+0x18,
+0x65,
+0xbd,
+0x49,
+0x3f,
+0x65,
+0xe8,
+0x90,
+0x02,
+0xc8,
+0x18,
+0x69,
+0xb7,
+0x85,
+0xe2,
+0x98,
+0x69,
+0x6c,
+0x85,
+0xe3,
+0x68,
+0x1a,
+0x38,
+0xe5,
+0xbd,
+0x49,
+0x3f,
+0x18,
+0x65,
+0xe8,
+0x90,
+0x02,
+0xc8,
+0x18,
+0x69,
+0xb7,
+0x85,
+0xe4,
+0x98,
+0x69,
+0x6c,
+0x85,
+0xe5,
+0xa0,
+0x03,
+0xd3,
+0xe2,
+0xd4,
+0x00,
+0xd3,
+0xe4,
+0xd8,
+0x00,
+0xa0,
+0x02,
+0x53,
+0xe6,
+0x00,
+0x0c,
+0xc0,
+0xad,
+0x12,
+0x61,
+0xa8,
+0x29,
+0x01,
+0xd0,
+0x0a,
+0xa2,
+0x80,
+0x86,
+0xd4,
+0x86,
+0xd5,
+0x86,
+0xd8,
+0x86,
+0xd9,
+0x98,
+0x29,
+0x02,
+0xd0,
+0x06,
+0xa2,
+0x80,
+0x86,
+0xd6,
+0x86,
+0xda,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0xd6,
+0x85,
+0xd7,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0xda,
+0x85,
+0xdb,
+0xa0,
+0x08,
+0x43,
+0xd4,
+0x00,
+0x54,
+0xc0,
+0xc6,
+0xde,
+0xd0,
+0x03,
+0x4c,
+0x44,
+0x3b,
+0xa4,
+0xb6,
+0xd0,
+0x04,
+0xe6,
+0xdf,
+0x80,
+0x02,
+0xc6,
+0xdf,
+0xa0,
+0x03,
+0xc3,
+0xea,
+0x54,
+0xc0,
+0xc3,
+0xae,
+0x54,
+0xc0,
+0xc3,
+0xb0,
+0x54,
+0xc0,
+0xc3,
+0xb2,
+0x54,
+0xc0,
+0xa5,
+0xdf,
+0xa6,
+0xb6,
+0xd0,
+0x18,
+0x18,
+0xa5,
+0xe2,
+0x69,
+0x03,
+0x85,
+0xe2,
+0x90,
+0x03,
+0xe6,
+0xe3,
+0x18,
+0xa5,
+0xe4,
+0x69,
+0x03,
+0x85,
+0xe4,
+0x90,
+0x02,
+0xe6,
+0xe5,
+0x80,
+0x16,
+0x38,
+0xa5,
+0xe2,
+0xe9,
+0x03,
+0x85,
+0xe2,
+0xb0,
+0x03,
+0xc6,
+0xe3,
+0x38,
+0xa5,
+0xe4,
+0xe9,
+0x03,
+0x85,
+0xe4,
+0xb0,
+0x02,
+0xc6,
+0xe5,
+0xa5,
+0xde,
+0x3a,
+0xf0,
+0x4f,
+0xa0,
+0x02,
+0x53,
+0xea,
+0x00,
+0xb2,
+0x00,
+0xa6,
+0xb6,
+0xf0,
+0x23,
+0x38,
+0xa5,
+0xae,
+0xe9,
+0x03,
+0x85,
+0xae,
+0xb0,
+0x03,
+0xc6,
+0xaf,
+0x38,
+0xa5,
+0xea,
+0xe9,
+0x03,
+0x85,
+0xea,
+0xb0,
+0x03,
+0xc6,
+0xeb,
+0x38,
+0xa5,
+0xb0,
+0xe9,
+0x03,
+0x85,
+0xb0,
+0xb0,
+0x25,
+0xc6,
+0xb1,
+0x80,
+0x21,
+0x18,
+0xa5,
+0xae,
+0x69,
+0x03,
+0x85,
+0xae,
+0x90,
+0x03,
+0xe6,
+0xaf,
+0x18,
+0xa5,
+0xea,
+0x69,
+0x03,
+0x85,
+0xea,
+0x90,
+0x03,
+0xe6,
+0xeb,
+0x18,
+0xa5,
+0xb0,
+0x69,
+0x03,
+0x85,
+0xb0,
+0x90,
+0x02,
+0xe6,
+0xb1,
+0x18,
+0xa5,
+0xe6,
+0x69,
+0x18,
+0x85,
+0xe6,
+0x90,
+0x02,
+0xe6,
+0xe7,
+0x4c,
+0x48,
+0x3a,
+0xa0,
+0x03,
+0xc3,
+0xea,
+0x54,
+0xc0,
+0xa6,
+0xbd,
+0xf0,
+0x04,
+0xc6,
+0xaa,
+0x80,
+0x02,
+0xe6,
+0xaa,
+0xc6,
+0xab,
+0xf0,
+0x40,
+0xa5,
+0xac,
+0xa4,
+0xad,
+0x85,
+0xae,
+0x84,
+0xaf,
+0xa6,
+0xbd,
+0xf0,
+0x08,
+0x38,
+0xe9,
+0x3c,
+0xb0,
+0x09,
+0x88,
+0x80,
+0x06,
+0x18,
+0x69,
+0x3c,
+0x90,
+0x01,
+0xc8,
+0x85,
+0xac,
+0x84,
+0xad,
+0xa6,
+0xab,
+0xca,
+0xf0,
+0x12,
+0xa6,
+0xbd,
+0xf0,
+0x08,
+0x38,
+0xe9,
+0x3c,
+0xb0,
+0x09,
+0x88,
+0x80,
+0x06,
+0x18,
+0x69,
+0x3c,
+0x90,
+0x01,
+0xc8,
+0x85,
+0xb0,
+0x84,
+0xb1,
+0xa0,
+0x02,
+0x53,
+0xac,
+0x00,
+0xb2,
+0x00,
+0xfa,
+0x60,
+0x64,
+0xe6,
+0x64,
+0xe7,
+0xa2,
+0x10,
+0x06,
+0xe2,
+0x26,
+0xe3,
+0x26,
+0xe6,
+0x26,
+0xe7,
+0xa5,
+0xe6,
+0x38,
+0xe5,
+0xe4,
+0xa8,
+0xa5,
+0xe7,
+0xe5,
+0xe5,
+0x90,
+0x06,
+0x85,
+0xe7,
+0x84,
+0xe6,
+0xe6,
+0xe2,
+0xca,
+0xd0,
+0xe3,
+0x60,
+0xa5,
+0xc0,
+0x49,
+0x1a,
+0x84,
+0x17,
+0xa6,
+0xb4,
+0xbd,
+0x15,
+0x6b,
+0xc5,
+0x17,
+0xb0,
+0x01,
+0xe8,
+0x86,
+0x28,
+0xa6,
+0xb5,
+0xbd,
+0x15,
+0x6b,
+0xc5,
+0x17,
+0xb0,
+0x01,
+0xca,
+0x86,
+0x29,
+0x8a,
+0xa5,
+0xc2,
+0x49,
+0x1a,
+0x84,
+0xe3,
+0xa6,
+0xbe,
+0xbd,
+0x29,
+0x6b,
+0xc5,
+0xe3,
+0xb0,
+0x01,
+0xe8,
+0x86,
+0x26,
+0xa6,
+0xbf,
+0xbd,
+0x29,
+0x6b,
+0xc5,
+0xe3,
+0xb0,
+0x01,
+0xca,
+0x86,
+0x27,
+0xa4,
+0xbd,
+0xd0,
+0x02,
+0xa6,
+0x26,
+0x86,
+0x60,
+0xa5,
+0x26,
+0xa6,
+0xbd,
+0xf0,
+0x02,
+0xa5,
+0x27,
+0x49,
+0x64,
+0x18,
+0x69,
+0xd3,
+0x85,
+0xbb,
+0x85,
+0x2a,
+0x98,
+0x69,
+0x64,
+0x85,
+0xbc,
+0x85,
+0x2b,
+0xa5,
+0x28,
+0x49,
+0x05,
+0x65,
+0x2a,
+0x85,
+0x2a,
+0x90,
+0x03,
+0xe6,
+0x2b,
+0x18,
+0xa5,
+0x28,
+0xa6,
+0xb6,
+0xf0,
+0x02,
+0xa5,
+0x29,
+0x49,
+0x05,
+0x65,
+0xbb,
+0x85,
+0xbb,
+0x90,
+0x02,
+0xe6,
+0xbc,
+0x60,
+0xfc,
+0xf0,
+0x11,
+0xa2,
+0x07,
+0x85,
+0xe3,
+0x98,
+0x80,
+0x02,
+0x66,
+0xe3,
+0xe8,
+0x4a,
+0xd0,
+0xfa,
+0x66,
+0xe3,
+0x80,
+0x0b,
+0xa2,
+0x07,
+0xa8,
+0x30,
+0x04,
+0xca,
+0x0a,
+0x10,
+0xfc,
+0x85,
+0xe3,
+0x8a,
+0x0a,
+0xaa,
+0xa5,
+0xe3,
+0x29,
+0x7f,
+0xa8,
+0x60,
+0x7c,
+0x5a,
+0x40,
+0xda,
+0xa0,
+0x02,
+0x53,
+0xbb,
+0x00,
+0xd4,
+0x00,
+0x53,
+0xb7,
+0x00,
+0xd6,
+0x00,
+0x29,
+0x01,
+0xf0,
+0x06,
+0xa9,
+0xd0,
+0xa2,
+0x0a,
+0x80,
+0x04,
+0xa9,
+0x40,
+0xa2,
+0x08,
+0x8d,
+0x0c,
+0xc0,
+0x8e,
+0x0d,
+0xc0,
+0xa5,
+0xb4,
+0xf0,
+0x17,
+0x49,
+0x03,
+0x5a,
+0x48,
+0xa5,
+0xb9,
+0x49,
+0x3c,
+0x18,
+0x69,
+0x13,
+0x85,
+0xe2,
+0x98,
+0x69,
+0x61,
+0x85,
+0xe3,
+0xfa,
+0x68,
+0x20,
+0xaf,
+0x3e,
+0x38,
+0xa9,
+0x13,
+0xe5,
+0xb5,
+0xf0,
+0x24,
+0x49,
+0x03,
+0x5a,
+0x48,
+0xa5,
+0xb9,
+0x49,
+0x3c,
+0x18,
+0x69,
+0x13,
+0x85,
+0xe2,
+0x98,
+0x69,
+0x61,
+0x85,
+0xe3,
+0xa5,
+0xb5,
+0x1a,
+0x49,
+0x03,
+0x65,
+0xe2,
+0x85,
+0xe2,
+0x90,
+0x02,
+0xe6,
+0xe3,
+0xfa,
+0x68,
+0x20,
+0xaf,
+0x3e,
+0x38,
+0xa5,
+0xb5,
+0xaa,
+0xa4,
+0xb6,
+0xd0,
+0x02,
+0xa6,
+0xb4,
+0x86,
+0xdf,
+0xe5,
+0xb4,
+0x1a,
+0x85,
+0xde,
+0x64,
+0xf3,
+0xa2,
+0x00,
+0xa4,
+0xb9,
+0xb9,
+0x29,
+0x6b,
+0x85,
+0xe1,
+0xa5,
+0xc2,
+0x49,
+0x1a,
+0xa2,
+0x01,
+0xc4,
+0xe1,
+0xf0,
+0x03,
+0x90,
+0x01,
+0xca,
+0x86,
+0xee,
+0xa6,
+0x28,
+0xa4,
+0x29,
+0xa5,
+0xb6,
+0xf0,
+0x03,
+0x8a,
+0xfc,
+0xa8,
+0x86,
+0xf2,
+0x84,
+0xef,
+0xa6,
+0x26,
+0xa4,
+0x27,
+0xa5,
+0xbd,
+0xf0,
+0x03,
+0x8a,
+0xfc,
+0xa8,
+0x86,
+0xf0,
+0x84,
+0xf1,
+0xa0,
+0x10,
+0x13,
+0x54,
+0xc0,
+0xc4,
+0x00,
+0xa4,
+0xdf,
+0xa2,
+0x00,
+0xa5,
+0xa8,
+0xf0,
+0x0f,
+0xa5,
+0xee,
+0xf0,
+0x0b,
+0xc4,
+0x28,
+0x90,
+0x07,
+0xc4,
+0x29,
+0xf0,
+0x02,
+0xb0,
+0x01,
+0xe8,
+0x86,
+0x97,
+0xb9,
+0x15,
+0x6b,
+0x85,
+0xe2,
+0xaa,
+0x45,
+0xe1,
+0x84,
+0x9a,
+0x49,
+0x20,
+0x85,
+0x98,
+0x84,
+0x99,
+0xa5,
+0x9a,
+0x49,
+0x20,
+0x18,
+0x65,
+0x99,
+0x85,
+0x99,
+0x98,
+0x69,
+0x00,
+0x85,
+0x9a,
+0x38,
+0xa5,
+0xc4,
+0xe5,
+0x98,
+0x85,
+0xc4,
+0xa5,
+0xc5,
+0xe5,
+0x99,
+0x85,
+0xc5,
+0xa5,
+0xc6,
+0xe5,
+0x9a,
+0x85,
+0xc6,
+0xa5,
+0xc7,
+0xe9,
+0x00,
+0x85,
+0xc7,
+0x10,
+0x08,
+0x64,
+0xc4,
+0x64,
+0xc5,
+0x64,
+0xc6,
+0x64,
+0xc7,
+0x38,
+0xa5,
+0xc8,
+0xe5,
+0x98,
+0x85,
+0xc8,
+0xa5,
+0xc9,
+0xe5,
+0x99,
+0x85,
+0xc9,
+0xa5,
+0xca,
+0xe5,
+0x9a,
+0x85,
+0xca,
+0xa5,
+0xcb,
+0xe9,
+0x00,
+0x85,
+0xcb,
+0x10,
+0x08,
+0x64,
+0xc8,
+0x64,
+0xc9,
+0x64,
+0xca,
+0x64,
+0xcb,
+0x38,
+0xa5,
+0xcc,
+0xe5,
+0x98,
+0x85,
+0xcc,
+0xa5,
+0xcd,
+0xe5,
+0x99,
+0x85,
+0xcd,
+0xa5,
+0xce,
+0xe5,
+0x9a,
+0x85,
+0xce,
+0xa5,
+0xcf,
+0xe9,
+0x00,
+0x85,
+0xcf,
+0x10,
+0x08,
+0x64,
+0xcc,
+0x64,
+0xcd,
+0x64,
+0xce,
+0x64,
+0xcf,
+0x38,
+0xa5,
+0xd0,
+0xe5,
+0x98,
+0x85,
+0xd0,
+0xa5,
+0xd1,
+0xe5,
+0x99,
+0x85,
+0xd1,
+0xa5,
+0xd2,
+0xe5,
+0x9a,
+0x85,
+0xd2,
+0xa5,
+0xd3,
+0xe9,
+0x00,
+0x85,
+0xd3,
+0x10,
+0x08,
+0x64,
+0xd0,
+0x64,
+0xd1,
+0x64,
+0xd2,
+0x64,
+0xd3,
+0x8a,
+0xa6,
+0x97,
+0xf0,
+0x07,
+0xa0,
+0x10,
+0x53,
+0xc4,
+0x00,
+0x98,
+0x00,
+0xa5,
+0xe1,
+0x45,
+0xe2,
+0x20,
+0x3b,
+0x3c,
+0x5a,
+0x20,
+0x63,
+0x3c,
+0x7a,
+0xb9,
+0x66,
+0x5c,
+0x20,
+0x78,
+0x15,
+0xa0,
+0x03,
+0x73,
+0xe6,
+0x00,
+0xd6,
+0xa5,
+0x97,
+0xd0,
+0x02,
+0x80,
+0x27,
+0xa5,
+0xdf,
+0x20,
+0xed,
+0x14,
+0xa0,
+0x05,
+0x73,
+0xe9,
+0x00,
+0xd4,
+0x84,
+0xf3,
+0xa5,
+0xd4,
+0xa6,
+0xb6,
+0xf0,
+0x0b,
+0x38,
+0xe9,
+0x05,
+0x85,
+0xd4,
+0xb0,
+0x0d,
+0xc6,
+0xd5,
+0x80,
+0x09,
+0x18,
+0x69,
+0x05,
+0x85,
+0xd4,
+0x90,
+0x02,
+0xe6,
+0xd5,
+0xa5,
+0xd6,
+0xa6,
+0xb6,
+0xf0,
+0x0b,
+0x38,
+0xe9,
+0x03,
+0x85,
+0xd6,
+0xb0,
+0x0d,
+0xc6,
+0xd7,
+0x80,
+0x09,
+0x18,
+0x69,
+0x03,
+0x85,
+0xd6,
+0x90,
+0x02,
+0xe6,
+0xd7,
+0xc6,
+0xde,
+0xf0,
+0x0e,
+0xa5,
+0xb6,
+0xf0,
+0x05,
+0xc6,
+0xdf,
+0x4c,
+0x16,
+0x3d,
+0xe6,
+0xdf,
+0x4c,
+0x16,
+0x3d,
+0xa5,
+0xb7,
+0xa6,
+0xbd,
+0xf0,
+0x0b,
+0x38,
+0xe9,
+0x3c,
+0x85,
+0xb7,
+0xb0,
+0x0d,
+0xc6,
+0xb8,
+0x80,
+0x09,
+0x18,
+0x69,
+0x3c,
+0x85,
+0xb7,
+0x90,
+0x02,
+0xe6,
+0xb8,
+0xa6,
+0xb9,
+0xe4,
+0xf1,
+0xd0,
+0x02,
+0x64,
+0xa8,
+0xa5,
+0xee,
+0xf0,
+0x1a,
+0xa5,
+0xbb,
+0xa6,
+0xbd,
+0xf0,
+0x0b,
+0x38,
+0xe9,
+0x64,
+0x85,
+0xbb,
+0xb0,
+0x0d,
+0xc6,
+0xbc,
+0x80,
+0x09,
+0x18,
+0x69,
+0x64,
+0x85,
+0xbb,
+0x90,
+0x02,
+0xe6,
+0xbc,
+0xa5,
+0xf3,
+0xf0,
+0x02,
+0xe6,
+0x24,
+0xa6,
+0xbd,
+0xf0,
+0x04,
+0xc6,
+0xb9,
+0x80,
+0x02,
+0xe6,
+0xb9,
+0xfa,
+0x60,
+0x64,
+0xde,
+0xda,
+0xaa,
+0xf0,
+0x0b,
+0xa0,
+0x00,
+0x33,
+0xde,
+0x00,
+0xe2,
+0xe6,
+0xe3,
+0x3a,
+0xd0,
+0xf7,
+0x7a,
+0xf0,
+0x04,
+0x33,
+0xde,
+0x00,
+0xe2,
+0x60,
+0xba,
+0x08,
+0x78,
+0x68,
+0x48,
+0x29,
+0x1c,
+0x85,
+0xf6,
+0x86,
+0xf4,
+0xa9,
+0x01,
+0x85,
+0xf5,
+0xa0,
+0x06,
+0xb1,
+0xf4,
+0x48,
+0x29,
+0x1c,
+0xc5,
+0xf6,
+0x90,
+0x08,
+0x7a,
+0xa0,
+0x09,
+0xb1,
+0xf4,
+0x48,
+0x29,
+0x1c,
+0xc9,
+0x00,
+0xd0,
+0x38,
+0xa0,
+0x03,
+0xb1,
+0xf4,
+0xe0,
+0x7f,
+0xb0,
+0x18,
+0x8d,
+0x1e,
+0x83,
+0xc8,
+0xb1,
+0xf4,
+0x8d,
+0x1f,
+0x83,
+0xc8,
+0xb1,
+0xf4,
+0x8d,
+0x20,
+0x83,
+0x8a,
+0x18,
+0x69,
+0x05,
+0x8d,
+0x21,
+0x83,
+0x80,
+0x16,
+0x8d,
+0x22,
+0x83,
+0xc8,
+0xb1,
+0xf4,
+0x8d,
+0x23,
+0x83,
+0xc8,
+0xb1,
+0xf4,
+0x8d,
+0x24,
+0x83,
+0x8a,
+0x18,
+0x69,
+0x05,
+0x8d,
+0x25,
+0x83,
+0xa9,
+0x00,
+0xfa,
+0x28,
+0xf8,
+0x60,
+0x68,
+0xf0,
+0x04,
+0x68,
+0xfa,
+0x7a,
+0x40,
+0x08,
+0x78,
+0x68,
+0xad,
+0x1d,
+0x83,
+0xf0,
+0x0e,
+0xae,
+0x21,
+0x83,
+0x9a,
+0xad,
+0x1e,
+0x83,
+0xae,
+0x1f,
+0x83,
+0xac,
+0x20,
+0x83,
+0x40,
+0xae,
+0x25,
+0x83,
+0x9a,
+0xad,
+0x22,
+0x83,
+0xae,
+0x23,
+0x83,
+0xac,
+0x24,
+0x83,
+0x40,
+0x08,
+0x78,
+0xad,
+0x1d,
+0x83,
+0xd0,
+0x1f,
+0x1a,
+0x8d,
+0x1d,
+0x83,
+0xa9,
+0x7c,
+0x8d,
+0x21,
+0x83,
+0x9c,
+0x1e,
+0x83,
+0x9c,
+0x1f,
+0x83,
+0x9c,
+0x20,
+0x83,
+0xa9,
+0x07,
+0x8d,
+0x7f,
+0x01,
+0xa9,
+0x23,
+0x8d,
+0x7e,
+0x01,
+0x9c,
+0x7d,
+0x01,
+0x28,
+0x60,
+0x08,
+0x78,
+0xa9,
+0x0e,
+0x8d,
+0xfe,
+0x01,
+0xa9,
+0x18,
+0x8d,
+0xfd,
+0x01,
+0xad,
+0xb2,
+0x6b,
+0x8d,
+0xfc,
+0x01,
+0xa9,
+0xfb,
+0x8d,
+0x25,
+0x83,
+0x9c,
+0x22,
+0x83,
+0x9c,
+0x23,
+0x83,
+0x9c,
+0x24,
+0x83,
+0x28,
+0x60,
+0x64,
+0xe2,
+0x64,
+0xe3,
+0xa9,
+0x5b,
+0x4a,
+0x85,
+0xe7,
+0xa9,
+0xfa,
+0x6a,
+0xaa,
+0x90,
+0x06,
+0xac,
+0xf9,
+0x5e,
+0x84,
+0xe2,
+0x18,
+0xa9,
+0x00,
+0x85,
+0xe4,
+0xa9,
+0x03,
+0x85,
+0xe5,
+0xa0,
+0x00,
+0xb1,
+0xe4,
+0x65,
+0xe2,
+0x85,
+0xe2,
+0xc8,
+0xb1,
+0xe4,
+0x65,
+0xe3,
+0x85,
+0xe3,
+0xca,
+0xd0,
+0x07,
+0xa5,
+0xe7,
+0xf0,
+0x0a,
+0x3a,
+0x85,
+0xe7,
+0xc8,
+0xd0,
+0xe6,
+0xe6,
+0xe5,
+0x80,
+0xe2,
+0xa5,
+0xe2,
+0x05,
+0xe3,
+0x60,
+0xe7,
+0x03,
+0x1d,
+0x06,
+0xa5,
+0x1c,
+0xd8,
+0x06,
+0x00,
+0x00,
+0x00,
+0x00,
+0x09,
+0x0e,
+0x43,
+0x6f,
+0x70,
+0x79,
+0x72,
+0x69,
+0x67,
+0x68,
+0x74,
+0x20,
+0x28,
+0x43,
+0x29,
+0x20,
+0x44,
+0x78,
+0x4f,
+0x20,
+0x4c,
+0x61,
+0x62,
+0x73,
+0x20,
+0x32,
+0x30,
+0x30,
+0x39,
+0x2d,
+0x32,
+0x30,
+0x31,
+0x32,
+0x20,
+0x2d,
+0x20,
+0x28,
+0x41,
+0x6c,
+0x6c,
+0x20,
+0x72,
+0x69,
+0x67,
+0x74,
+0x68,
+0x73,
+0x20,
+0x72,
+0x65,
+0x73,
+0x65,
+0x72,
+0x76,
+0x65,
+0x64,
+0x29,
+0x00,
+0x80,
+0x80,
+0x80,
+0x80,
+0x00,
+0x04,
+0x08,
+0x0d,
+0x11,
+0x15,
+0x1a,
+0x1e,
+0x23,
+0x27,
+0x00,
+0x04,
+0x09,
+0x0d,
+0x12,
+0x17,
+0x1b,
+0x00,
+0x01,
+0x02,
+0x00,
+0x02,
+0x01,
+0x01,
+0x00,
+0x02,
+0x00,
+0x01,
+0x02,
+0x02,
+0x01,
+0x00,
+0x02,
+0x00,
+0x01,
+0x01,
+0x02,
+0x00,
+0x01,
+0x02,
+0x04,
+0x08,
+0x10,
+0x20,
+0x40,
+0x80,
+0x0e,
+0x1a,
+0xa7,
+0x19,
+0x6a,
+0x19,
+0x45,
+0x19,
+0x20,
+0x19,
+0xfb,
+0x18,
+0xd6,
+0x18,
+0x99,
+0x18,
+0x4c,
+0x18,
+0xf3,
+0x17,
+0x9e,
+0x17,
+0x51,
+0x17,
+0xea,
+0x16,
+0x91,
+0x16,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x7f,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x7f,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x8e,
+0x73,
+0x8e,
+0x73,
+0x4f,
+0xb2,
+0x4f,
+0xe5,
+0x1c,
+0xe3,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x9b,
+0x66,
+0x9b,
+0x66,
+0x24,
+0xdd,
+0x24,
+0x2d,
+0xd4,
+0x95,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0xa7,
+0x5a,
+0xa7,
+0x5a,
+0xfe,
+0x03,
+0xfe,
+0x5d,
+0xa4,
+0x81,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0xb4,
+0x4d,
+0xb4,
+0x4d,
+0xdd,
+0x24,
+0xdd,
+0x78,
+0x89,
+0x95,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0xc1,
+0x40,
+0xc1,
+0x40,
+0xc1,
+0x40,
+0xc1,
+0x7f,
+0x81,
+0xc1,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0xce,
+0x33,
+0xce,
+0x33,
+0xaa,
+0x57,
+0xaa,
+0x79,
+0x88,
+0xf7,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0xdb,
+0x26,
+0xdb,
+0x26,
+0x98,
+0x69,
+0x98,
+0x65,
+0x9c,
+0x2c,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0xe7,
+0x1a,
+0xe7,
+0x1a,
+0x8b,
+0x76,
+0x8b,
+0x49,
+0xb8,
+0x59,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0xf4,
+0x0d,
+0xf4,
+0x0d,
+0x84,
+0x7d,
+0x84,
+0x26,
+0xdb,
+0x76,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0x7f,
+0x81,
+0x00,
+0x00,
+0x7f,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x0d,
+0xf4,
+0x0d,
+0xf4,
+0x84,
+0x7d,
+0x84,
+0xdb,
+0x26,
+0x76,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x1a,
+0xe7,
+0x1a,
+0xe7,
+0x8b,
+0x76,
+0x8b,
+0xb8,
+0x49,
+0x59,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x26,
+0xdb,
+0x26,
+0xdb,
+0x98,
+0x69,
+0x98,
+0x9c,
+0x65,
+0x2c,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x33,
+0xce,
+0x33,
+0xce,
+0xaa,
+0x57,
+0xaa,
+0x88,
+0x79,
+0xf7,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x40,
+0xc1,
+0x40,
+0xc1,
+0xc1,
+0x40,
+0xc1,
+0x81,
+0x7f,
+0xc1,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x4d,
+0xb4,
+0x4d,
+0xb4,
+0xdd,
+0x24,
+0xdd,
+0x89,
+0x78,
+0x95,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x5a,
+0xa7,
+0x5a,
+0xa7,
+0xfe,
+0x03,
+0xfe,
+0xa4,
+0x5d,
+0x81,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x66,
+0x9b,
+0x66,
+0x9b,
+0x24,
+0xdd,
+0x24,
+0xd4,
+0x2d,
+0x95,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x73,
+0x8e,
+0x73,
+0x8e,
+0x4f,
+0xb2,
+0x4f,
+0x1c,
+0xe5,
+0xe3,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x7f,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x81,
+0x7f,
+0x7f,
+0x81,
+0x7f,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x81,
+0x70,
+0xbd,
+0x07,
+0x7f,
+0x91,
+0x44,
+0x81,
+0x70,
+0x7f,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x8e,
+0x65,
+0xc4,
+0x06,
+0x4f,
+0xbc,
+0x2a,
+0xe5,
+0x18,
+0xe3,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x9b,
+0x5a,
+0xcb,
+0x06,
+0x24,
+0xe2,
+0x13,
+0x2d,
+0xda,
+0x95,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0xa7,
+0x4e,
+0xd1,
+0x05,
+0xfe,
+0x02,
+0x00,
+0x5d,
+0xaf,
+0x81,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0xb4,
+0x43,
+0xd8,
+0x04,
+0xdd,
+0x1f,
+0xee,
+0x78,
+0x98,
+0x95,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0xc1,
+0x38,
+0xdf,
+0x04,
+0xc1,
+0x38,
+0xdf,
+0x7f,
+0x91,
+0xc1,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0xce,
+0x2d,
+0xe6,
+0x03,
+0xaa,
+0x4c,
+0xd3,
+0x79,
+0x97,
+0xf7,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0xdb,
+0x22,
+0xed,
+0x02,
+0x98,
+0x5c,
+0xc9,
+0x65,
+0xa8,
+0x2c,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0xe7,
+0x16,
+0xf3,
+0x01,
+0x8b,
+0x67,
+0xc2,
+0x49,
+0xc1,
+0x59,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0xf4,
+0x0b,
+0xfa,
+0x01,
+0x84,
+0x6e,
+0xbe,
+0x26,
+0xe0,
+0x76,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0x70,
+0xbd,
+0x00,
+0x00,
+0x7f,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x0d,
+0xf6,
+0x07,
+0x00,
+0x84,
+0x6e,
+0xbe,
+0xdb,
+0x21,
+0x76,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x1a,
+0xeb,
+0x0e,
+0x00,
+0x8b,
+0x67,
+0xc2,
+0xb8,
+0x40,
+0x59,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x26,
+0xdf,
+0x14,
+0xff,
+0x98,
+0x5c,
+0xc9,
+0x9c,
+0x59,
+0x2c,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x33,
+0xd4,
+0x1b,
+0xfe,
+0xaa,
+0x4c,
+0xd3,
+0x88,
+0x6a,
+0xf7,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x40,
+0xc9,
+0x22,
+0xfd,
+0xc1,
+0x38,
+0xdf,
+0x81,
+0x70,
+0xc1,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x4d,
+0xbe,
+0x29,
+0xfd,
+0xdd,
+0x1f,
+0xee,
+0x89,
+0x69,
+0x95,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x5a,
+0xb3,
+0x30,
+0xfc,
+0xfe,
+0x02,
+0x00,
+0xa4,
+0x52,
+0x81,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x66,
+0xa7,
+0x36,
+0xfb,
+0x24,
+0xe2,
+0x13,
+0xd4,
+0x27,
+0x95,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x73,
+0x9c,
+0x3d,
+0xfb,
+0x4f,
+0xbc,
+0x2a,
+0x1c,
+0xe9,
+0xe3,
+0x91,
+0x44,
+0xfa,
+0xc9,
+0x7f,
+0x91,
+0x44,
+0xfa,
+0x7f,
+0x91,
+0x44,
+0x7f,
+0x91,
+0x7f,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x81,
+0x60,
+0xf1,
+0xb9,
+0x7f,
+0xa1,
+0x10,
+0x81,
+0x60,
+0x7f,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x8e,
+0x56,
+0xf3,
+0xc0,
+0x4f,
+0xc5,
+0x0a,
+0xe5,
+0x15,
+0xe3,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x9b,
+0x4d,
+0xf4,
+0xc7,
+0x24,
+0xe6,
+0x04,
+0x2d,
+0xdf,
+0x95,
+0xa1,
+0x10,
+0x48,
+0x85,
+0xa7,
+0x43,
+0xf6,
+0xcf,
+0xfe,
+0x02,
+0x00,
+0x5d,
+0xbb,
+0x81,
+0xa1,
+0x10,
+0x48,
+0x85,
+0xb4,
+0x3a,
+0xf7,
+0xd6,
+0xdd,
+0x1b,
+0xfd,
+0x78,
+0xa7,
+0x95,
+0xa1,
+0x10,
+0x48,
+0x85,
+0xc1,
+0x30,
+0xf9,
+0xdd,
+0xc1,
+0x30,
+0xf9,
+0x7f,
+0xa1,
+0xc1,
+0xa1,
+0x10,
+0x48,
+0x85,
+0xce,
+0x26,
+0xfb,
+0xe4,
+0xaa,
+0x41,
+0xf6,
+0x79,
+0xa6,
+0xf7,
+0xa1,
+0x10,
+0x48,
+0x85,
+0xdb,
+0x1d,
+0xfc,
+0xeb,
+0x98,
+0x4f,
+0xf4,
+0x65,
+0xb5,
+0x2c,
+0xa1,
+0x10,
+0x48,
+0x85,
+0xe7,
+0x13,
+0xfe,
+0xf3,
+0x8b,
+0x58,
+0xf2,
+0x49,
+0xca,
+0x59,
+0xa1,
+0x10,
+0x48,
+0x85,
+0xf4,
+0x0a,
+0xff,
+0xfa,
+0x84,
+0x5e,
+0xf1,
+0x26,
+0xe5,
+0x76,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0x60,
+0xf1,
+0x00,
+0x00,
+0x7f,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x0d,
+0xf7,
+0x02,
+0x07,
+0x84,
+0x5e,
+0xf1,
+0xdb,
+0x1c,
+0x76,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x1a,
+0xee,
+0x03,
+0x0e,
+0x8b,
+0x58,
+0xf2,
+0xb8,
+0x37,
+0x59,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x26,
+0xe4,
+0x05,
+0x16,
+0x98,
+0x4f,
+0xf4,
+0x9c,
+0x4c,
+0x2c,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x33,
+0xdb,
+0x06,
+0x1d,
+0xaa,
+0x41,
+0xf6,
+0x88,
+0x5b,
+0xf7,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x40,
+0xd1,
+0x08,
+0x24,
+0xc1,
+0x30,
+0xf9,
+0x81,
+0x60,
+0xc1,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x4d,
+0xc7,
+0x0a,
+0x2b,
+0xdd,
+0x1b,
+0xfd,
+0x89,
+0x5a,
+0x95,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x5a,
+0xbe,
+0x0b,
+0x32,
+0xfe,
+0x02,
+0x00,
+0xa4,
+0x46,
+0x81,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x66,
+0xb4,
+0x0d,
+0x3a,
+0x24,
+0xe6,
+0x04,
+0xd4,
+0x22,
+0x95,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x73,
+0xab,
+0x0e,
+0x41,
+0x4f,
+0xc5,
+0x0a,
+0x1c,
+0xec,
+0xe3,
+0xa1,
+0x10,
+0x48,
+0x85,
+0x7f,
+0xa1,
+0x10,
+0x48,
+0x7f,
+0xa1,
+0x10,
+0x7f,
+0xa1,
+0x7f,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x81,
+0x50,
+0x1c,
+0x8e,
+0x7f,
+0xb1,
+0xe5,
+0x81,
+0x50,
+0x7f,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x8e,
+0x48,
+0x19,
+0x9a,
+0x4f,
+0xcf,
+0xf0,
+0xe5,
+0x11,
+0xe3,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x9b,
+0x40,
+0x16,
+0xa5,
+0x24,
+0xeb,
+0xf9,
+0x2d,
+0xe5,
+0x95,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0xa7,
+0x38,
+0x14,
+0xb0,
+0xfe,
+0x02,
+0x01,
+0x5d,
+0xc7,
+0x81,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0xb4,
+0x30,
+0x11,
+0xbc,
+0xdd,
+0x16,
+0x08,
+0x78,
+0xb6,
+0x95,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0xc1,
+0x28,
+0x0e,
+0xc7,
+0xc1,
+0x28,
+0x0e,
+0x7f,
+0xb1,
+0xc1,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0xce,
+0x20,
+0x0b,
+0xd3,
+0xaa,
+0x36,
+0x13,
+0x79,
+0xb5,
+0xf7,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0xdb,
+0x18,
+0x08,
+0xdf,
+0x98,
+0x42,
+0x17,
+0x65,
+0xc2,
+0x2c,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0xe7,
+0x10,
+0x06,
+0xea,
+0x8b,
+0x4a,
+0x1a,
+0x49,
+0xd4,
+0x59,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0xf4,
+0x08,
+0x03,
+0xf6,
+0x84,
+0x4e,
+0x1b,
+0x26,
+0xe9,
+0x76,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0x50,
+0x1c,
+0x00,
+0x00,
+0x7f,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x0d,
+0xf9,
+0xfe,
+0x0c,
+0x84,
+0x4e,
+0x1b,
+0xdb,
+0x18,
+0x76,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x1a,
+0xf1,
+0xfb,
+0x17,
+0x8b,
+0x4a,
+0x1a,
+0xb8,
+0x2d,
+0x59,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x26,
+0xe9,
+0xf9,
+0x23,
+0x98,
+0x42,
+0x17,
+0x9c,
+0x3f,
+0x2c,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x33,
+0xe1,
+0xf6,
+0x2e,
+0xaa,
+0x36,
+0x13,
+0x88,
+0x4c,
+0xf7,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x40,
+0xd9,
+0xf3,
+0x3a,
+0xc1,
+0x28,
+0x0e,
+0x81,
+0x50,
+0xc1,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x4d,
+0xd1,
+0xf0,
+0x45,
+0xdd,
+0x16,
+0x08,
+0x89,
+0x4b,
+0x95,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x5a,
+0xc9,
+0xed,
+0x50,
+0xfe,
+0x02,
+0x01,
+0xa4,
+0x3a,
+0x81,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x66,
+0xc1,
+0xeb,
+0x5c,
+0x24,
+0xeb,
+0xf9,
+0xd4,
+0x1c,
+0x95,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x73,
+0xb9,
+0xe8,
+0x67,
+0x4f,
+0xcf,
+0xf0,
+0x1c,
+0xf0,
+0xe3,
+0xb1,
+0xe5,
+0x73,
+0x8d,
+0x7f,
+0xb1,
+0xe5,
+0x73,
+0x7f,
+0xb1,
+0xe5,
+0x7f,
+0xb1,
+0x7f,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x81,
+0x40,
+0x40,
+0x81,
+0x7f,
+0xc1,
+0xc1,
+0x81,
+0x40,
+0x7f,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x8e,
+0x3a,
+0x3a,
+0x8e,
+0x4f,
+0xd9,
+0xd9,
+0xe5,
+0x0e,
+0xe3,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x9b,
+0x33,
+0x33,
+0x9b,
+0x24,
+0xef,
+0xef,
+0x2d,
+0xea,
+0x95,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0xa7,
+0x2d,
+0x2d,
+0xa7,
+0xfe,
+0x01,
+0x01,
+0x5d,
+0xd2,
+0x81,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0xb4,
+0x26,
+0x26,
+0xb4,
+0xdd,
+0x12,
+0x12,
+0x78,
+0xc5,
+0x95,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0xc1,
+0x20,
+0x20,
+0xc1,
+0xc1,
+0x20,
+0x20,
+0x7f,
+0xc1,
+0xc1,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0xce,
+0x1a,
+0x1a,
+0xce,
+0xaa,
+0x2c,
+0x2c,
+0x79,
+0xc5,
+0xf7,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0xdb,
+0x13,
+0x13,
+0xdb,
+0x98,
+0x34,
+0x34,
+0x65,
+0xce,
+0x2c,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0xe7,
+0x0d,
+0x0d,
+0xe7,
+0x8b,
+0x3b,
+0x3b,
+0x49,
+0xdd,
+0x59,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0xf4,
+0x06,
+0x06,
+0xf4,
+0x84,
+0x3f,
+0x3f,
+0x26,
+0xee,
+0x76,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0x40,
+0x40,
+0x00,
+0x00,
+0x7f,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x0d,
+0xfb,
+0xfb,
+0x0d,
+0x84,
+0x3f,
+0x3f,
+0xdb,
+0x13,
+0x76,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x1a,
+0xf4,
+0xf4,
+0x1a,
+0x8b,
+0x3b,
+0x3b,
+0xb8,
+0x24,
+0x59,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x26,
+0xee,
+0xee,
+0x26,
+0x98,
+0x34,
+0x34,
+0x9c,
+0x33,
+0x2c,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x33,
+0xe7,
+0xe7,
+0x33,
+0xaa,
+0x2c,
+0x2c,
+0x88,
+0x3c,
+0xf7,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x40,
+0xe1,
+0xe1,
+0x40,
+0xc1,
+0x20,
+0x20,
+0x81,
+0x40,
+0xc1,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x4d,
+0xdb,
+0xdb,
+0x4d,
+0xdd,
+0x12,
+0x12,
+0x89,
+0x3c,
+0x95,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x5a,
+0xd4,
+0xd4,
+0x5a,
+0xfe,
+0x01,
+0x01,
+0xa4,
+0x2f,
+0x81,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x66,
+0xce,
+0xce,
+0x66,
+0x24,
+0xef,
+0xef,
+0xd4,
+0x17,
+0x95,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x73,
+0xc7,
+0xc7,
+0x73,
+0x4f,
+0xd9,
+0xd9,
+0x1c,
+0xf3,
+0xe3,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x7f,
+0xc1,
+0xc1,
+0x7f,
+0x7f,
+0xc1,
+0xc1,
+0x7f,
+0xc1,
+0x7f,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x81,
+0x30,
+0x5c,
+0x8c,
+0x7f,
+0xd1,
+0xa5,
+0x81,
+0x30,
+0x7f,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x8e,
+0x2b,
+0x53,
+0x98,
+0x4f,
+0xe3,
+0xc8,
+0xe5,
+0x0a,
+0xe3,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x9b,
+0x26,
+0x4a,
+0xa3,
+0x24,
+0xf4,
+0xe7,
+0x2d,
+0xf0,
+0x95,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0xa7,
+0x22,
+0x40,
+0xaf,
+0xfe,
+0x01,
+0x02,
+0x5d,
+0xde,
+0x81,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0xb4,
+0x1d,
+0x37,
+0xbb,
+0xdd,
+0x0d,
+0x1a,
+0x78,
+0xd4,
+0x95,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0xc1,
+0x18,
+0x2e,
+0xc6,
+0xc1,
+0x18,
+0x2e,
+0x7f,
+0xd1,
+0xc1,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0xce,
+0x13,
+0x25,
+0xd2,
+0xaa,
+0x21,
+0x3f,
+0x79,
+0xd4,
+0xf7,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0xdb,
+0x0e,
+0x1c,
+0xde,
+0x98,
+0x27,
+0x4b,
+0x65,
+0xdb,
+0x2c,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0xe7,
+0x0a,
+0x12,
+0xea,
+0x8b,
+0x2c,
+0x55,
+0x49,
+0xe6,
+0x59,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0xf4,
+0x05,
+0x09,
+0xf5,
+0x84,
+0x2f,
+0x5a,
+0x26,
+0xf3,
+0x76,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0x30,
+0x5c,
+0x00,
+0x00,
+0x7f,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x0d,
+0xfc,
+0xf8,
+0x0c,
+0x84,
+0x2f,
+0x5a,
+0xdb,
+0x0e,
+0x76,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x1a,
+0xf7,
+0xef,
+0x17,
+0x8b,
+0x2c,
+0x55,
+0xb8,
+0x1b,
+0x59,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x26,
+0xf3,
+0xe5,
+0x23,
+0x98,
+0x27,
+0x4b,
+0x9c,
+0x26,
+0x2c,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x33,
+0xee,
+0xdc,
+0x2f,
+0xaa,
+0x21,
+0x3f,
+0x88,
+0x2d,
+0xf7,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x40,
+0xe9,
+0xd3,
+0x3b,
+0xc1,
+0x18,
+0x2e,
+0x81,
+0x30,
+0xc1,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x4d,
+0xe4,
+0xca,
+0x46,
+0xdd,
+0x0d,
+0x1a,
+0x89,
+0x2d,
+0x95,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x5a,
+0xdf,
+0xc1,
+0x52,
+0xfe,
+0x01,
+0x02,
+0xa4,
+0x23,
+0x81,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x66,
+0xdb,
+0xb7,
+0x5e,
+0x24,
+0xf4,
+0xe7,
+0xd4,
+0x11,
+0x95,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x73,
+0xd6,
+0xae,
+0x69,
+0x4f,
+0xe3,
+0xc8,
+0x1c,
+0xf7,
+0xe3,
+0xd1,
+0xa5,
+0x75,
+0x04,
+0x7f,
+0xd1,
+0xa5,
+0x75,
+0x7f,
+0xd1,
+0xa5,
+0x7f,
+0xd1,
+0x7f,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x81,
+0x20,
+0x70,
+0xa9,
+0x7f,
+0xe1,
+0x91,
+0x81,
+0x20,
+0x7f,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x8e,
+0x1d,
+0x65,
+0xb2,
+0x4f,
+0xed,
+0xbc,
+0xe5,
+0x07,
+0xe3,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x9b,
+0x1a,
+0x5a,
+0xbb,
+0x24,
+0xf8,
+0xe2,
+0x2d,
+0xf6,
+0x95,
+0xe1,
+0x91,
+0x58,
+0x44,
+0xa7,
+0x16,
+0x4e,
+0xc3,
+0xfe,
+0x01,
+0x02,
+0x5d,
+0xea,
+0x81,
+0xe1,
+0x91,
+0x58,
+0x44,
+0xb4,
+0x13,
+0x43,
+0xcc,
+0xdd,
+0x09,
+0x1f,
+0x78,
+0xe3,
+0x95,
+0xe1,
+0x91,
+0x58,
+0x44,
+0xc1,
+0x10,
+0x38,
+0xd5,
+0xc1,
+0x10,
+0x38,
+0x7f,
+0xe1,
+0xc1,
+0xe1,
+0x91,
+0x58,
+0x44,
+0xce,
+0x0d,
+0x2d,
+0xde,
+0xaa,
+0x16,
+0x4c,
+0x79,
+0xe3,
+0xf7,
+0xe1,
+0x91,
+0x58,
+0x44,
+0xdb,
+0x0a,
+0x22,
+0xe7,
+0x98,
+0x1a,
+0x5c,
+0x65,
+0xe8,
+0x2c,
+0xe1,
+0x91,
+0x58,
+0x44,
+0xe7,
+0x06,
+0x16,
+0xef,
+0x8b,
+0x1d,
+0x67,
+0x49,
+0xef,
+0x59,
+0xe1,
+0x91,
+0x58,
+0x44,
+0xf4,
+0x03,
+0x0b,
+0xf8,
+0x84,
+0x1f,
+0x6e,
+0x26,
+0xf8,
+0x76,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0x20,
+0x70,
+0x00,
+0x00,
+0x7f,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x0d,
+0xfe,
+0xf6,
+0x09,
+0x84,
+0x1f,
+0x6e,
+0xdb,
+0x09,
+0x76,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x1a,
+0xfb,
+0xeb,
+0x12,
+0x8b,
+0x1d,
+0x67,
+0xb8,
+0x12,
+0x59,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x26,
+0xf7,
+0xdf,
+0x1a,
+0x98,
+0x1a,
+0x5c,
+0x9c,
+0x19,
+0x2c,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x33,
+0xf4,
+0xd4,
+0x23,
+0xaa,
+0x16,
+0x4c,
+0x88,
+0x1e,
+0xf7,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x40,
+0xf1,
+0xc9,
+0x2c,
+0xc1,
+0x10,
+0x38,
+0x81,
+0x20,
+0xc1,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x4d,
+0xee,
+0xbe,
+0x35,
+0xdd,
+0x09,
+0x1f,
+0x89,
+0x1e,
+0x95,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x5a,
+0xeb,
+0xb3,
+0x3e,
+0xfe,
+0x01,
+0x02,
+0xa4,
+0x17,
+0x81,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x66,
+0xe7,
+0xa7,
+0x46,
+0x24,
+0xf8,
+0xe2,
+0xd4,
+0x0b,
+0x95,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x73,
+0xe4,
+0x9c,
+0x4f,
+0x4f,
+0xed,
+0xbc,
+0x1c,
+0xfa,
+0xe3,
+0xe1,
+0x91,
+0x58,
+0x44,
+0x7f,
+0xe1,
+0x91,
+0x58,
+0x7f,
+0xe1,
+0x91,
+0x7f,
+0xe1,
+0x7f,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x81,
+0x10,
+0x7c,
+0xd2,
+0x7f,
+0xf1,
+0x85,
+0x81,
+0x10,
+0x7f,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x8e,
+0x0e,
+0x70,
+0xd7,
+0x4f,
+0xf7,
+0xb4,
+0xe5,
+0x03,
+0xe3,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x9b,
+0x0d,
+0x63,
+0xdb,
+0x24,
+0xfd,
+0xde,
+0x2d,
+0xfb,
+0x95,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0xa7,
+0x0b,
+0x57,
+0xe0,
+0xfe,
+0x00,
+0x02,
+0x5d,
+0xf5,
+0x81,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0xb4,
+0x0a,
+0x4a,
+0xe5,
+0xdd,
+0x04,
+0x23,
+0x78,
+0xf2,
+0x95,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0xc1,
+0x08,
+0x3e,
+0xe9,
+0xc1,
+0x08,
+0x3e,
+0x7f,
+0xf1,
+0xc1,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0xce,
+0x06,
+0x32,
+0xee,
+0xaa,
+0x0b,
+0x54,
+0x79,
+0xf2,
+0xf7,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0xdb,
+0x05,
+0x25,
+0xf3,
+0x98,
+0x0d,
+0x66,
+0x65,
+0xf4,
+0x2c,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0xe7,
+0x03,
+0x19,
+0xf8,
+0x8b,
+0x0f,
+0x72,
+0x49,
+0xf8,
+0x59,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0xf4,
+0x02,
+0x0c,
+0xfc,
+0x84,
+0x10,
+0x7a,
+0x26,
+0xfc,
+0x76,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0x10,
+0x7c,
+0x00,
+0x00,
+0x7f,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x0d,
+0xff,
+0xf5,
+0x05,
+0x84,
+0x10,
+0x7a,
+0xdb,
+0x05,
+0x76,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x1a,
+0xfe,
+0xe8,
+0x09,
+0x8b,
+0x0f,
+0x72,
+0xb8,
+0x09,
+0x59,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x26,
+0xfc,
+0xdc,
+0x0e,
+0x98,
+0x0d,
+0x66,
+0x9c,
+0x0d,
+0x2c,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x33,
+0xfb,
+0xcf,
+0x13,
+0xaa,
+0x0b,
+0x54,
+0x88,
+0x0f,
+0xf7,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x40,
+0xf9,
+0xc3,
+0x18,
+0xc1,
+0x08,
+0x3e,
+0x81,
+0x10,
+0xc1,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x4d,
+0xf7,
+0xb7,
+0x1c,
+0xdd,
+0x04,
+0x23,
+0x89,
+0x0f,
+0x95,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x5a,
+0xf6,
+0xaa,
+0x21,
+0xfe,
+0x00,
+0x02,
+0xa4,
+0x0c,
+0x81,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x66,
+0xf4,
+0x9e,
+0x26,
+0x24,
+0xfd,
+0xde,
+0xd4,
+0x06,
+0x95,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x73,
+0xf3,
+0x91,
+0x2a,
+0x4f,
+0xf7,
+0xb4,
+0x1c,
+0xfe,
+0xe3,
+0xf1,
+0x85,
+0x2f,
+0x70,
+0x7f,
+0xf1,
+0x85,
+0x2f,
+0x7f,
+0xf1,
+0x85,
+0x7f,
+0xf1,
+0x7f,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x81,
+0x00,
+0x7f,
+0x00,
+0x7f,
+0x00,
+0x81,
+0x81,
+0x00,
+0x7f,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x8e,
+0x00,
+0x73,
+0x00,
+0x4f,
+0x00,
+0xb2,
+0xe5,
+0x00,
+0xe3,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x9b,
+0x00,
+0x66,
+0x00,
+0x24,
+0x00,
+0xdd,
+0x2d,
+0x00,
+0x95,
+0x00,
+0x81,
+0x00,
+0x7f,
+0xa7,
+0x00,
+0x5a,
+0x00,
+0xfe,
+0x00,
+0x03,
+0x5d,
+0x00,
+0x81,
+0x00,
+0x81,
+0x00,
+0x7f,
+0xb4,
+0x00,
+0x4d,
+0x00,
+0xdd,
+0x00,
+0x24,
+0x78,
+0x00,
+0x95,
+0x00,
+0x81,
+0x00,
+0x7f,
+0xc1,
+0x00,
+0x40,
+0x00,
+0xc1,
+0x00,
+0x40,
+0x7f,
+0x00,
+0xc1,
+0x00,
+0x81,
+0x00,
+0x7f,
+0xce,
+0x00,
+0x33,
+0x00,
+0xaa,
+0x00,
+0x57,
+0x79,
+0x00,
+0xf7,
+0x00,
+0x81,
+0x00,
+0x7f,
+0xdb,
+0x00,
+0x26,
+0x00,
+0x98,
+0x00,
+0x69,
+0x65,
+0x00,
+0x2c,
+0x00,
+0x81,
+0x00,
+0x7f,
+0xe7,
+0x00,
+0x1a,
+0x00,
+0x8b,
+0x00,
+0x76,
+0x49,
+0x00,
+0x59,
+0x00,
+0x81,
+0x00,
+0x7f,
+0xf4,
+0x00,
+0x0d,
+0x00,
+0x84,
+0x00,
+0x7d,
+0x26,
+0x00,
+0x76,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x00,
+0x00,
+0x7f,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x0d,
+0x00,
+0xf4,
+0x00,
+0x84,
+0x00,
+0x7d,
+0xdb,
+0x00,
+0x76,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x1a,
+0x00,
+0xe7,
+0x00,
+0x8b,
+0x00,
+0x76,
+0xb8,
+0x00,
+0x59,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x26,
+0x00,
+0xdb,
+0x00,
+0x98,
+0x00,
+0x69,
+0x9c,
+0x00,
+0x2c,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x33,
+0x00,
+0xce,
+0x00,
+0xaa,
+0x00,
+0x57,
+0x88,
+0x00,
+0xf7,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x40,
+0x00,
+0xc1,
+0x00,
+0xc1,
+0x00,
+0x40,
+0x81,
+0x00,
+0xc1,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x4d,
+0x00,
+0xb4,
+0x00,
+0xdd,
+0x00,
+0x24,
+0x89,
+0x00,
+0x95,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x5a,
+0x00,
+0xa7,
+0x00,
+0xfe,
+0x00,
+0x03,
+0xa4,
+0x00,
+0x81,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x66,
+0x00,
+0x9b,
+0x00,
+0x24,
+0x00,
+0xdd,
+0xd4,
+0x00,
+0x95,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x73,
+0x00,
+0x8e,
+0x00,
+0x4f,
+0x00,
+0xb2,
+0x1c,
+0x00,
+0xe3,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x7f,
+0x00,
+0x81,
+0x00,
+0x7f,
+0x00,
+0x81,
+0x7f,
+0x00,
+0x7f,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x81,
+0xf1,
+0x7c,
+0x2f,
+0x7f,
+0x10,
+0x85,
+0x81,
+0xf1,
+0x7f,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x8e,
+0xf3,
+0x70,
+0x2a,
+0x4f,
+0x0a,
+0xb4,
+0xe5,
+0xfe,
+0xe3,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x9b,
+0xf4,
+0x63,
+0x26,
+0x24,
+0x04,
+0xde,
+0x2d,
+0x06,
+0x95,
+0x10,
+0x85,
+0xd2,
+0x70,
+0xa7,
+0xf6,
+0x57,
+0x21,
+0xfe,
+0x00,
+0x02,
+0x5d,
+0x0c,
+0x81,
+0x10,
+0x85,
+0xd2,
+0x70,
+0xb4,
+0xf7,
+0x4a,
+0x1c,
+0xdd,
+0xfd,
+0x23,
+0x78,
+0x0f,
+0x95,
+0x10,
+0x85,
+0xd2,
+0x70,
+0xc1,
+0xf9,
+0x3e,
+0x17,
+0xc1,
+0xf9,
+0x3e,
+0x7f,
+0x10,
+0xc1,
+0x10,
+0x85,
+0xd2,
+0x70,
+0xce,
+0xfb,
+0x32,
+0x13,
+0xaa,
+0xf6,
+0x54,
+0x79,
+0x0f,
+0xf7,
+0x10,
+0x85,
+0xd2,
+0x70,
+0xdb,
+0xfc,
+0x25,
+0x0e,
+0x98,
+0xf4,
+0x66,
+0x65,
+0x0d,
+0x2c,
+0x10,
+0x85,
+0xd2,
+0x70,
+0xe7,
+0xfe,
+0x19,
+0x09,
+0x8b,
+0xf2,
+0x72,
+0x49,
+0x09,
+0x59,
+0x10,
+0x85,
+0xd2,
+0x70,
+0xf4,
+0xff,
+0x0c,
+0x05,
+0x84,
+0xf1,
+0x7a,
+0x26,
+0x05,
+0x76,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0xf1,
+0x7c,
+0x00,
+0x00,
+0x7f,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x0d,
+0x02,
+0xf5,
+0xfc,
+0x84,
+0xf1,
+0x7a,
+0xdb,
+0xfc,
+0x76,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x1a,
+0x03,
+0xe8,
+0xf8,
+0x8b,
+0xf2,
+0x72,
+0xb8,
+0xf8,
+0x59,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x26,
+0x05,
+0xdc,
+0xf3,
+0x98,
+0xf4,
+0x66,
+0x9c,
+0xf4,
+0x2c,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x33,
+0x06,
+0xcf,
+0xee,
+0xaa,
+0xf6,
+0x54,
+0x88,
+0xf2,
+0xf7,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x40,
+0x08,
+0xc3,
+0xea,
+0xc1,
+0xf9,
+0x3e,
+0x81,
+0xf1,
+0xc1,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x4d,
+0x0a,
+0xb7,
+0xe5,
+0xdd,
+0xfd,
+0x23,
+0x89,
+0xf2,
+0x95,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x5a,
+0x0b,
+0xaa,
+0xe0,
+0xfe,
+0x00,
+0x02,
+0xa4,
+0xf5,
+0x81,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x66,
+0x0d,
+0x9e,
+0xdb,
+0x24,
+0x04,
+0xde,
+0xd4,
+0xfb,
+0x95,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x73,
+0x0e,
+0x91,
+0xd7,
+0x4f,
+0x0a,
+0xb4,
+0x1c,
+0x03,
+0xe3,
+0x10,
+0x85,
+0xd2,
+0x70,
+0x7f,
+0x10,
+0x85,
+0xd2,
+0x7f,
+0x10,
+0x85,
+0x7f,
+0x10,
+0x7f,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x81,
+0xe1,
+0x70,
+0x58,
+0x7f,
+0x20,
+0x91,
+0x81,
+0xe1,
+0x7f,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x8e,
+0xe4,
+0x65,
+0x4f,
+0x4f,
+0x14,
+0xbc,
+0xe5,
+0xfa,
+0xe3,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x9b,
+0xe7,
+0x5a,
+0x46,
+0x24,
+0x09,
+0xe2,
+0x2d,
+0x0b,
+0x95,
+0x20,
+0x91,
+0xa9,
+0x44,
+0xa7,
+0xeb,
+0x4e,
+0x3e,
+0xfe,
+0x00,
+0x02,
+0x5d,
+0x17,
+0x81,
+0x20,
+0x91,
+0xa9,
+0x44,
+0xb4,
+0xee,
+0x43,
+0x35,
+0xdd,
+0xf8,
+0x1f,
+0x78,
+0x1e,
+0x95,
+0x20,
+0x91,
+0xa9,
+0x44,
+0xc1,
+0xf1,
+0x38,
+0x2c,
+0xc1,
+0xf1,
+0x38,
+0x7f,
+0x20,
+0xc1,
+0x20,
+0x91,
+0xa9,
+0x44,
+0xce,
+0xf4,
+0x2d,
+0x23,
+0xaa,
+0xeb,
+0x4c,
+0x79,
+0x1e,
+0xf7,
+0x20,
+0x91,
+0xa9,
+0x44,
+0xdb,
+0xf7,
+0x22,
+0x1a,
+0x98,
+0xe7,
+0x5c,
+0x65,
+0x19,
+0x2c,
+0x20,
+0x91,
+0xa9,
+0x44,
+0xe7,
+0xfb,
+0x16,
+0x12,
+0x8b,
+0xe4,
+0x67,
+0x49,
+0x12,
+0x59,
+0x20,
+0x91,
+0xa9,
+0x44,
+0xf4,
+0xfe,
+0x0b,
+0x09,
+0x84,
+0xe2,
+0x6e,
+0x26,
+0x09,
+0x76,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0xe1,
+0x70,
+0x00,
+0x00,
+0x7f,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x0d,
+0x03,
+0xf6,
+0xf8,
+0x84,
+0xe2,
+0x6e,
+0xdb,
+0xf8,
+0x76,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x1a,
+0x06,
+0xeb,
+0xef,
+0x8b,
+0xe4,
+0x67,
+0xb8,
+0xef,
+0x59,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x26,
+0x0a,
+0xdf,
+0xe7,
+0x98,
+0xe7,
+0x5c,
+0x9c,
+0xe8,
+0x2c,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x33,
+0x0d,
+0xd4,
+0xde,
+0xaa,
+0xeb,
+0x4c,
+0x88,
+0xe3,
+0xf7,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x40,
+0x10,
+0xc9,
+0xd5,
+0xc1,
+0xf1,
+0x38,
+0x81,
+0xe1,
+0xc1,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x4d,
+0x13,
+0xbe,
+0xcc,
+0xdd,
+0xf8,
+0x1f,
+0x89,
+0xe3,
+0x95,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x5a,
+0x16,
+0xb3,
+0xc3,
+0xfe,
+0x00,
+0x02,
+0xa4,
+0xea,
+0x81,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x66,
+0x1a,
+0xa7,
+0xbb,
+0x24,
+0x09,
+0xe2,
+0xd4,
+0xf6,
+0x95,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x73,
+0x1d,
+0x9c,
+0xb2,
+0x4f,
+0x14,
+0xbc,
+0x1c,
+0x07,
+0xe3,
+0x20,
+0x91,
+0xa9,
+0x44,
+0x7f,
+0x20,
+0x91,
+0xa9,
+0x7f,
+0x20,
+0x91,
+0x7f,
+0x20,
+0x7f,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x81,
+0xd1,
+0x5c,
+0x75,
+0x7f,
+0x30,
+0xa5,
+0x81,
+0xd1,
+0x7f,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x8e,
+0xd6,
+0x53,
+0x69,
+0x4f,
+0x1e,
+0xc8,
+0xe5,
+0xf7,
+0xe3,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x9b,
+0xdb,
+0x4a,
+0x5e,
+0x24,
+0x0d,
+0xe7,
+0x2d,
+0x11,
+0x95,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0xa7,
+0xdf,
+0x40,
+0x52,
+0xfe,
+0x00,
+0x02,
+0x5d,
+0x23,
+0x81,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0xb4,
+0xe4,
+0x37,
+0x46,
+0xdd,
+0xf4,
+0x1a,
+0x78,
+0x2d,
+0x95,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0xc1,
+0xe9,
+0x2e,
+0x3b,
+0xc1,
+0xe9,
+0x2e,
+0x7f,
+0x30,
+0xc1,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0xce,
+0xee,
+0x25,
+0x2f,
+0xaa,
+0xe0,
+0x3f,
+0x79,
+0x2d,
+0xf7,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0xdb,
+0xf3,
+0x1c,
+0x23,
+0x98,
+0xda,
+0x4b,
+0x65,
+0x26,
+0x2c,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0xe7,
+0xf7,
+0x12,
+0x17,
+0x8b,
+0xd5,
+0x55,
+0x49,
+0x1b,
+0x59,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0xf4,
+0xfc,
+0x09,
+0x0c,
+0x84,
+0xd2,
+0x5a,
+0x26,
+0x0e,
+0x76,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0xd1,
+0x5c,
+0x00,
+0x00,
+0x7f,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x0d,
+0x05,
+0xf8,
+0xf5,
+0x84,
+0xd2,
+0x5a,
+0xdb,
+0xf3,
+0x76,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x1a,
+0x0a,
+0xef,
+0xea,
+0x8b,
+0xd5,
+0x55,
+0xb8,
+0xe6,
+0x59,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x26,
+0x0e,
+0xe5,
+0xde,
+0x98,
+0xda,
+0x4b,
+0x9c,
+0xdb,
+0x2c,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x33,
+0x13,
+0xdc,
+0xd2,
+0xaa,
+0xe0,
+0x3f,
+0x88,
+0xd4,
+0xf7,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x40,
+0x18,
+0xd3,
+0xc6,
+0xc1,
+0xe9,
+0x2e,
+0x81,
+0xd1,
+0xc1,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x4d,
+0x1d,
+0xca,
+0xbb,
+0xdd,
+0xf4,
+0x1a,
+0x89,
+0xd4,
+0x95,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x5a,
+0x22,
+0xc1,
+0xaf,
+0xfe,
+0x00,
+0x02,
+0xa4,
+0xde,
+0x81,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x66,
+0x26,
+0xb7,
+0xa3,
+0x24,
+0x0d,
+0xe7,
+0xd4,
+0xf0,
+0x95,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x73,
+0x2b,
+0xae,
+0x98,
+0x4f,
+0x1e,
+0xc8,
+0x1c,
+0x0a,
+0xe3,
+0x30,
+0xa5,
+0x8c,
+0x04,
+0x7f,
+0x30,
+0xa5,
+0x8c,
+0x7f,
+0x30,
+0xa5,
+0x7f,
+0x30,
+0x7f,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x81,
+0xc1,
+0x40,
+0x7f,
+0x7f,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x7f,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x8e,
+0xc7,
+0x3a,
+0x73,
+0x4f,
+0x28,
+0xd9,
+0xe5,
+0xf3,
+0xe3,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x9b,
+0xce,
+0x33,
+0x66,
+0x24,
+0x12,
+0xef,
+0x2d,
+0x17,
+0x95,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0xa7,
+0xd4,
+0x2d,
+0x5a,
+0xfe,
+0x00,
+0x01,
+0x5d,
+0x2f,
+0x81,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0xb4,
+0xdb,
+0x26,
+0x4d,
+0xdd,
+0xef,
+0x12,
+0x78,
+0x3c,
+0x95,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0xc1,
+0xe1,
+0x20,
+0x40,
+0xc1,
+0xe1,
+0x20,
+0x7f,
+0x40,
+0xc1,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0xce,
+0xe7,
+0x1a,
+0x33,
+0xaa,
+0xd5,
+0x2c,
+0x79,
+0x3c,
+0xf7,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0xdb,
+0xee,
+0x13,
+0x26,
+0x98,
+0xcd,
+0x34,
+0x65,
+0x33,
+0x2c,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0xe7,
+0xf4,
+0x0d,
+0x1a,
+0x8b,
+0xc6,
+0x3b,
+0x49,
+0x24,
+0x59,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0xf4,
+0xfb,
+0x06,
+0x0d,
+0x84,
+0xc2,
+0x3f,
+0x26,
+0x13,
+0x76,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0xc1,
+0x40,
+0x00,
+0x00,
+0x7f,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x0d,
+0x06,
+0xfb,
+0xf4,
+0x84,
+0xc2,
+0x3f,
+0xdb,
+0xee,
+0x76,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x1a,
+0x0d,
+0xf4,
+0xe7,
+0x8b,
+0xc6,
+0x3b,
+0xb8,
+0xdd,
+0x59,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x26,
+0x13,
+0xee,
+0xdb,
+0x98,
+0xcd,
+0x34,
+0x9c,
+0xce,
+0x2c,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x33,
+0x1a,
+0xe7,
+0xce,
+0xaa,
+0xd5,
+0x2c,
+0x88,
+0xc5,
+0xf7,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x40,
+0x20,
+0xe1,
+0xc1,
+0xc1,
+0xe1,
+0x20,
+0x81,
+0xc1,
+0xc1,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x4d,
+0x26,
+0xdb,
+0xb4,
+0xdd,
+0xef,
+0x12,
+0x89,
+0xc5,
+0x95,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x5a,
+0x2d,
+0xd4,
+0xa7,
+0xfe,
+0x00,
+0x01,
+0xa4,
+0xd2,
+0x81,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x66,
+0x33,
+0xce,
+0x9b,
+0x24,
+0x12,
+0xef,
+0xd4,
+0xea,
+0x95,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x73,
+0x3a,
+0xc7,
+0x8e,
+0x4f,
+0x28,
+0xd9,
+0x1c,
+0x0e,
+0xe3,
+0x40,
+0xc1,
+0x81,
+0xc1,
+0x7f,
+0x40,
+0xc1,
+0x81,
+0x7f,
+0x40,
+0xc1,
+0x7f,
+0x40,
+0x7f,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x81,
+0xb1,
+0x1c,
+0x73,
+0x7f,
+0x50,
+0xe5,
+0x81,
+0xb1,
+0x7f,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x8e,
+0xb9,
+0x19,
+0x68,
+0x4f,
+0x32,
+0xf0,
+0xe5,
+0xf0,
+0xe3,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x9b,
+0xc1,
+0x16,
+0x5c,
+0x24,
+0x16,
+0xf9,
+0x2d,
+0x1c,
+0x95,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0xa7,
+0xc9,
+0x14,
+0x51,
+0xfe,
+0xff,
+0x01,
+0x5d,
+0x3a,
+0x81,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0xb4,
+0xd1,
+0x11,
+0x45,
+0xdd,
+0xeb,
+0x08,
+0x78,
+0x4b,
+0x95,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0xc1,
+0xd9,
+0x0e,
+0x3a,
+0xc1,
+0xd9,
+0x0e,
+0x7f,
+0x50,
+0xc1,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0xce,
+0xe1,
+0x0b,
+0x2e,
+0xaa,
+0xcb,
+0x13,
+0x79,
+0x4c,
+0xf7,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0xdb,
+0xe9,
+0x08,
+0x23,
+0x98,
+0xbf,
+0x17,
+0x65,
+0x3f,
+0x2c,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0xe7,
+0xf1,
+0x06,
+0x17,
+0x8b,
+0xb7,
+0x1a,
+0x49,
+0x2d,
+0x59,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0xf4,
+0xf9,
+0x03,
+0x0b,
+0x84,
+0xb3,
+0x1b,
+0x26,
+0x18,
+0x76,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0xb1,
+0x1c,
+0x00,
+0x00,
+0x7f,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x0d,
+0x08,
+0xfe,
+0xf5,
+0x84,
+0xb3,
+0x1b,
+0xdb,
+0xe9,
+0x76,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x1a,
+0x10,
+0xfb,
+0xea,
+0x8b,
+0xb7,
+0x1a,
+0xb8,
+0xd4,
+0x59,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x26,
+0x18,
+0xf9,
+0xde,
+0x98,
+0xbf,
+0x17,
+0x9c,
+0xc2,
+0x2c,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x33,
+0x20,
+0xf6,
+0xd3,
+0xaa,
+0xcb,
+0x13,
+0x88,
+0xb5,
+0xf7,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x40,
+0x28,
+0xf3,
+0xc7,
+0xc1,
+0xd9,
+0x0e,
+0x81,
+0xb1,
+0xc1,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x4d,
+0x30,
+0xf0,
+0xbc,
+0xdd,
+0xeb,
+0x08,
+0x89,
+0xb6,
+0x95,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x5a,
+0x38,
+0xed,
+0xb0,
+0xfe,
+0xff,
+0x01,
+0xa4,
+0xc7,
+0x81,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x66,
+0x40,
+0xeb,
+0xa5,
+0x24,
+0x16,
+0xf9,
+0xd4,
+0xe5,
+0x95,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x73,
+0x48,
+0xe8,
+0x99,
+0x4f,
+0x32,
+0xf0,
+0x1c,
+0x11,
+0xe3,
+0x50,
+0xe5,
+0x8e,
+0x8d,
+0x7f,
+0x50,
+0xe5,
+0x8e,
+0x7f,
+0x50,
+0xe5,
+0x7f,
+0x50,
+0x7f,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x81,
+0xa1,
+0xf1,
+0x48,
+0x7f,
+0x60,
+0x10,
+0x81,
+0xa1,
+0x7f,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x8e,
+0xab,
+0xf3,
+0x41,
+0x4f,
+0x3c,
+0x0a,
+0xe5,
+0xec,
+0xe3,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x9b,
+0xb4,
+0xf4,
+0x3a,
+0x24,
+0x1b,
+0x04,
+0x2d,
+0x22,
+0x95,
+0x60,
+0x10,
+0xb9,
+0x85,
+0xa7,
+0xbe,
+0xf6,
+0x32,
+0xfe,
+0xff,
+0x00,
+0x5d,
+0x46,
+0x81,
+0x60,
+0x10,
+0xb9,
+0x85,
+0xb4,
+0xc7,
+0xf7,
+0x2b,
+0xdd,
+0xe6,
+0xfd,
+0x78,
+0x5a,
+0x95,
+0x60,
+0x10,
+0xb9,
+0x85,
+0xc1,
+0xd1,
+0xf9,
+0x24,
+0xc1,
+0xd1,
+0xf9,
+0x7f,
+0x60,
+0xc1,
+0x60,
+0x10,
+0xb9,
+0x85,
+0xce,
+0xdb,
+0xfb,
+0x1d,
+0xaa,
+0xc0,
+0xf6,
+0x79,
+0x5b,
+0xf7,
+0x60,
+0x10,
+0xb9,
+0x85,
+0xdb,
+0xe4,
+0xfc,
+0x16,
+0x98,
+0xb2,
+0xf4,
+0x65,
+0x4c,
+0x2c,
+0x60,
+0x10,
+0xb9,
+0x85,
+0xe7,
+0xee,
+0xfe,
+0x0e,
+0x8b,
+0xa9,
+0xf2,
+0x49,
+0x37,
+0x59,
+0x60,
+0x10,
+0xb9,
+0x85,
+0xf4,
+0xf7,
+0xff,
+0x07,
+0x84,
+0xa3,
+0xf1,
+0x26,
+0x1c,
+0x76,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0xa1,
+0xf1,
+0x00,
+0x00,
+0x7f,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x0d,
+0x0a,
+0x02,
+0xfa,
+0x84,
+0xa3,
+0xf1,
+0xdb,
+0xe5,
+0x76,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x1a,
+0x13,
+0x03,
+0xf3,
+0x8b,
+0xa9,
+0xf2,
+0xb8,
+0xca,
+0x59,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x26,
+0x1d,
+0x05,
+0xeb,
+0x98,
+0xb2,
+0xf4,
+0x9c,
+0xb5,
+0x2c,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x33,
+0x26,
+0x06,
+0xe4,
+0xaa,
+0xc0,
+0xf6,
+0x88,
+0xa6,
+0xf7,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x40,
+0x30,
+0x08,
+0xdd,
+0xc1,
+0xd1,
+0xf9,
+0x81,
+0xa1,
+0xc1,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x4d,
+0x3a,
+0x0a,
+0xd6,
+0xdd,
+0xe6,
+0xfd,
+0x89,
+0xa7,
+0x95,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x5a,
+0x43,
+0x0b,
+0xcf,
+0xfe,
+0xff,
+0x00,
+0xa4,
+0xbb,
+0x81,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x66,
+0x4d,
+0x0d,
+0xc7,
+0x24,
+0x1b,
+0x04,
+0xd4,
+0xdf,
+0x95,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x73,
+0x56,
+0x0e,
+0xc0,
+0x4f,
+0x3c,
+0x0a,
+0x1c,
+0x15,
+0xe3,
+0x60,
+0x10,
+0xb9,
+0x85,
+0x7f,
+0x60,
+0x10,
+0xb9,
+0x7f,
+0x60,
+0x10,
+0x7f,
+0x60,
+0x7f,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x81,
+0x91,
+0xbd,
+0xfa,
+0x7f,
+0x70,
+0x44,
+0x81,
+0x91,
+0x7f,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x8e,
+0x9c,
+0xc4,
+0xfb,
+0x4f,
+0x45,
+0x2a,
+0xe5,
+0xe9,
+0xe3,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x9b,
+0xa7,
+0xcb,
+0xfb,
+0x24,
+0x1f,
+0x13,
+0x2d,
+0x27,
+0x95,
+0x70,
+0x44,
+0x07,
+0xc9,
+0xa7,
+0xb3,
+0xd1,
+0xfc,
+0xfe,
+0xff,
+0x00,
+0x5d,
+0x52,
+0x81,
+0x70,
+0x44,
+0x07,
+0xc9,
+0xb4,
+0xbe,
+0xd8,
+0xfd,
+0xdd,
+0xe2,
+0xee,
+0x78,
+0x69,
+0x95,
+0x70,
+0x44,
+0x07,
+0xc9,
+0xc1,
+0xc9,
+0xdf,
+0xfe,
+0xc1,
+0xc9,
+0xdf,
+0x7f,
+0x70,
+0xc1,
+0x70,
+0x44,
+0x07,
+0xc9,
+0xce,
+0xd4,
+0xe6,
+0xfe,
+0xaa,
+0xb5,
+0xd3,
+0x79,
+0x6a,
+0xf7,
+0x70,
+0x44,
+0x07,
+0xc9,
+0xdb,
+0xdf,
+0xed,
+0xff,
+0x98,
+0xa5,
+0xc9,
+0x65,
+0x59,
+0x2c,
+0x70,
+0x44,
+0x07,
+0xc9,
+0xe7,
+0xeb,
+0xf3,
+0x00,
+0x8b,
+0x9a,
+0xc2,
+0x49,
+0x40,
+0x59,
+0x70,
+0x44,
+0x07,
+0xc9,
+0xf4,
+0xf6,
+0xfa,
+0x00,
+0x84,
+0x93,
+0xbe,
+0x26,
+0x21,
+0x76,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0x91,
+0xbd,
+0x00,
+0x00,
+0x7f,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x0d,
+0x0b,
+0x07,
+0x01,
+0x84,
+0x93,
+0xbe,
+0xdb,
+0xe0,
+0x76,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x1a,
+0x16,
+0x0e,
+0x01,
+0x8b,
+0x9a,
+0xc2,
+0xb8,
+0xc1,
+0x59,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x26,
+0x22,
+0x14,
+0x02,
+0x98,
+0xa5,
+0xc9,
+0x9c,
+0xa8,
+0x2c,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x33,
+0x2d,
+0x1b,
+0x03,
+0xaa,
+0xb5,
+0xd3,
+0x88,
+0x97,
+0xf7,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x40,
+0x38,
+0x22,
+0x03,
+0xc1,
+0xc9,
+0xdf,
+0x81,
+0x91,
+0xc1,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x4d,
+0x43,
+0x29,
+0x04,
+0xdd,
+0xe2,
+0xee,
+0x89,
+0x98,
+0x95,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x5a,
+0x4e,
+0x30,
+0x05,
+0xfe,
+0xff,
+0x00,
+0xa4,
+0xaf,
+0x81,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x66,
+0x5a,
+0x36,
+0x06,
+0x24,
+0x1f,
+0x13,
+0xd4,
+0xda,
+0x95,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x73,
+0x65,
+0x3d,
+0x06,
+0x4f,
+0x45,
+0x2a,
+0x1c,
+0x18,
+0xe3,
+0x70,
+0x44,
+0x07,
+0xc9,
+0x7f,
+0x70,
+0x44,
+0x07,
+0x7f,
+0x70,
+0x44,
+0x7f,
+0x70,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x81,
+0x81,
+0x81,
+0x81,
+0x7f,
+0x7f,
+0x7f,
+0x81,
+0x81,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x8e,
+0x8e,
+0x8e,
+0x8e,
+0x4f,
+0x4f,
+0x4f,
+0xe5,
+0xe5,
+0xe3,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x9b,
+0x9b,
+0x9b,
+0x9b,
+0x24,
+0x24,
+0x24,
+0x2d,
+0x2d,
+0x95,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0xa7,
+0xa7,
+0xa7,
+0xa7,
+0xfe,
+0xfe,
+0xfe,
+0x5d,
+0x5d,
+0x81,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0xb4,
+0xb4,
+0xb4,
+0xb4,
+0xdd,
+0xdd,
+0xdd,
+0x78,
+0x78,
+0x95,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0xc1,
+0xc1,
+0xc1,
+0xc1,
+0xc1,
+0xc1,
+0xc1,
+0x7f,
+0x7f,
+0xc1,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0xce,
+0xce,
+0xce,
+0xce,
+0xaa,
+0xaa,
+0xaa,
+0x79,
+0x79,
+0xf7,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0xdb,
+0xdb,
+0xdb,
+0xdb,
+0x98,
+0x98,
+0x98,
+0x65,
+0x65,
+0x2c,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0xe7,
+0xe7,
+0xe7,
+0xe7,
+0x8b,
+0x8b,
+0x8b,
+0x49,
+0x49,
+0x59,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0xf4,
+0xf4,
+0xf4,
+0xf4,
+0x84,
+0x84,
+0x84,
+0x26,
+0x26,
+0x76,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x00,
+0x00,
+0x00,
+0x00,
+0x81,
+0x81,
+0x81,
+0x00,
+0x00,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x0d,
+0x0d,
+0x0d,
+0x0d,
+0x84,
+0x84,
+0x84,
+0xdb,
+0xdb,
+0x76,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x1a,
+0x1a,
+0x1a,
+0x1a,
+0x8b,
+0x8b,
+0x8b,
+0xb8,
+0xb8,
+0x59,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x26,
+0x26,
+0x26,
+0x26,
+0x98,
+0x98,
+0x98,
+0x9c,
+0x9c,
+0x2c,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x33,
+0x33,
+0x33,
+0x33,
+0xaa,
+0xaa,
+0xaa,
+0x88,
+0x88,
+0xf7,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x40,
+0x40,
+0x40,
+0x40,
+0xc1,
+0xc1,
+0xc1,
+0x81,
+0x81,
+0xc1,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x4d,
+0x4d,
+0x4d,
+0x4d,
+0xdd,
+0xdd,
+0xdd,
+0x89,
+0x89,
+0x95,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x5a,
+0x5a,
+0x5a,
+0x5a,
+0xfe,
+0xfe,
+0xfe,
+0xa4,
+0xa4,
+0x81,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x66,
+0x66,
+0x66,
+0x66,
+0x24,
+0x24,
+0x24,
+0xd4,
+0xd4,
+0x95,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x73,
+0x73,
+0x73,
+0x73,
+0x4f,
+0x4f,
+0x4f,
+0x1c,
+0x1c,
+0xe3,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0x7f,
+0xa2,
+0x36,
+0x24,
+0x1b,
+0x19,
+0x45,
+0x39,
+0x20,
+0x19,
+0x19,
+0x30,
+0x2a,
+0x19,
+0x17,
+0x26,
+0x21,
+0x19,
+0x15,
+0x17,
+0x23,
+0x20,
+0x19,
+0x17,
+0x16,
+0x36,
+0x66,
+0x23,
+0x1e,
+0x1b,
+0x3b,
+0x32,
+0x25,
+0x1a,
+0x1b,
+0x29,
+0x28,
+0x1a,
+0x18,
+0x23,
+0x1e,
+0x18,
+0x15,
+0x17,
+0x20,
+0x1e,
+0x18,
+0x17,
+0x17,
+0x24,
+0x23,
+0x5a,
+0x23,
+0x24,
+0x21,
+0x24,
+0x28,
+0x24,
+0x21,
+0x1d,
+0x1d,
+0x1d,
+0x1d,
+0x1a,
+0x17,
+0x16,
+0x17,
+0x1a,
+0x19,
+0x18,
+0x15,
+0x18,
+0x19,
+0x1b,
+0x1e,
+0x23,
+0x66,
+0x36,
+0x1b,
+0x1a,
+0x25,
+0x32,
+0x3b,
+0x18,
+0x1a,
+0x28,
+0x29,
+0x17,
+0x15,
+0x18,
+0x1e,
+0x23,
+0x17,
+0x17,
+0x18,
+0x1e,
+0x20,
+0x19,
+0x1b,
+0x24,
+0x36,
+0xa2,
+0x19,
+0x19,
+0x20,
+0x39,
+0x45,
+0x17,
+0x19,
+0x2a,
+0x30,
+0x17,
+0x15,
+0x19,
+0x21,
+0x26,
+0x16,
+0x17,
+0x19,
+0x20,
+0x23,
+0x45,
+0x3b,
+0x21,
+0x1b,
+0x19,
+0x6e,
+0x30,
+0x21,
+0x18,
+0x19,
+0x32,
+0x2e,
+0x19,
+0x17,
+0x2a,
+0x23,
+0x1a,
+0x16,
+0x17,
+0x26,
+0x23,
+0x1a,
+0x17,
+0x17,
+0x39,
+0x32,
+0x24,
+0x1a,
+0x19,
+0x30,
+0x45,
+0x1e,
+0x18,
+0x18,
+0x2b,
+0x27,
+0x18,
+0x16,
+0x23,
+0x1e,
+0x17,
+0x14,
+0x16,
+0x21,
+0x1e,
+0x17,
+0x15,
+0x15,
+0x20,
+0x25,
+0x28,
+0x25,
+0x20,
+0x21,
+0x1e,
+0x3c,
+0x1e,
+0x21,
+0x1b,
+0x1e,
+0x1e,
+0x1b,
+0x1a,
+0x17,
+0x17,
+0x17,
+0x1a,
+0x19,
+0x18,
+0x16,
+0x18,
+0x19,
+0x19,
+0x1a,
+0x24,
+0x32,
+0x39,
+0x18,
+0x18,
+0x1e,
+0x45,
+0x30,
+0x16,
+0x18,
+0x27,
+0x2b,
+0x16,
+0x14,
+0x17,
+0x1e,
+0x23,
+0x15,
+0x15,
+0x17,
+0x1e,
+0x21,
+0x19,
+0x1b,
+0x21,
+0x3b,
+0x45,
+0x19,
+0x18,
+0x21,
+0x30,
+0x6e,
+0x17,
+0x19,
+0x2e,
+0x32,
+0x17,
+0x16,
+0x1a,
+0x23,
+0x2a,
+0x17,
+0x17,
+0x1a,
+0x23,
+0x26,
+0x30,
+0x29,
+0x1d,
+0x18,
+0x17,
+0x32,
+0x2b,
+0x1b,
+0x16,
+0x17,
+0x67,
+0x2b,
+0x18,
+0x16,
+0x32,
+0x2b,
+0x1b,
+0x16,
+0x17,
+0x30,
+0x29,
+0x1d,
+0x18,
+0x17,
+0x2a,
+0x28,
+0x1d,
+0x1a,
+0x19,
+0x2e,
+0x27,
+0x1e,
+0x18,
+0x19,
+0x2b,
+0x45,
+0x1a,
+0x18,
+0x2e,
+0x27,
+0x1e,
+0x18,
+0x19,
+0x2a,
+0x28,
+0x1d,
+0x1a,
+0x19,
+0x19,
+0x1a,
+0x1d,
+0x28,
+0x2a,
+0x19,
+0x18,
+0x1e,
+0x27,
+0x2e,
+0x18,
+0x1a,
+0x45,
+0x2b,
+0x19,
+0x18,
+0x1e,
+0x27,
+0x2e,
+0x19,
+0x1a,
+0x1d,
+0x28,
+0x2a,
+0x17,
+0x18,
+0x1d,
+0x29,
+0x30,
+0x17,
+0x16,
+0x1b,
+0x2b,
+0x32,
+0x16,
+0x18,
+0x2b,
+0x67,
+0x17,
+0x16,
+0x1b,
+0x2b,
+0x32,
+0x17,
+0x18,
+0x1d,
+0x29,
+0x30,
+0x26,
+0x23,
+0x1a,
+0x17,
+0x17,
+0x2a,
+0x23,
+0x1a,
+0x16,
+0x17,
+0x32,
+0x2e,
+0x19,
+0x17,
+0x6e,
+0x30,
+0x21,
+0x18,
+0x19,
+0x45,
+0x3b,
+0x21,
+0x1b,
+0x19,
+0x21,
+0x1e,
+0x17,
+0x15,
+0x15,
+0x23,
+0x1e,
+0x17,
+0x14,
+0x16,
+0x2b,
+0x27,
+0x18,
+0x16,
+0x30,
+0x45,
+0x1e,
+0x18,
+0x18,
+0x39,
+0x32,
+0x24,
+0x1a,
+0x19,
+0x19,
+0x18,
+0x16,
+0x18,
+0x19,
+0x1a,
+0x17,
+0x17,
+0x17,
+0x1a,
+0x1b,
+0x1e,
+0x1e,
+0x1b,
+0x21,
+0x1e,
+0x3c,
+0x1e,
+0x21,
+0x20,
+0x25,
+0x28,
+0x25,
+0x20,
+0x15,
+0x15,
+0x17,
+0x1e,
+0x21,
+0x16,
+0x14,
+0x17,
+0x1e,
+0x23,
+0x16,
+0x18,
+0x27,
+0x2b,
+0x18,
+0x18,
+0x1e,
+0x45,
+0x30,
+0x19,
+0x1a,
+0x24,
+0x32,
+0x39,
+0x17,
+0x17,
+0x1a,
+0x23,
+0x26,
+0x17,
+0x16,
+0x1a,
+0x23,
+0x2a,
+0x17,
+0x19,
+0x2e,
+0x32,
+0x19,
+0x18,
+0x21,
+0x30,
+0x6e,
+0x19,
+0x1b,
+0x21,
+0x3b,
+0x45,
+0x23,
+0x20,
+0x19,
+0x17,
+0x16,
+0x26,
+0x21,
+0x19,
+0x15,
+0x17,
+0x30,
+0x2a,
+0x19,
+0x17,
+0x45,
+0x39,
+0x20,
+0x19,
+0x19,
+0xa2,
+0x36,
+0x24,
+0x1b,
+0x19,
+0x20,
+0x1e,
+0x18,
+0x17,
+0x17,
+0x23,
+0x1e,
+0x18,
+0x15,
+0x17,
+0x29,
+0x28,
+0x1a,
+0x18,
+0x3b,
+0x32,
+0x25,
+0x1a,
+0x1b,
+0x36,
+0x66,
+0x23,
+0x1e,
+0x1b,
+0x19,
+0x18,
+0x15,
+0x18,
+0x19,
+0x1a,
+0x17,
+0x16,
+0x17,
+0x1a,
+0x1d,
+0x1d,
+0x1d,
+0x1d,
+0x21,
+0x24,
+0x28,
+0x24,
+0x21,
+0x24,
+0x23,
+0x5a,
+0x23,
+0x24,
+0x17,
+0x17,
+0x18,
+0x1e,
+0x20,
+0x17,
+0x15,
+0x18,
+0x1e,
+0x23,
+0x18,
+0x1a,
+0x28,
+0x29,
+0x1b,
+0x1a,
+0x25,
+0x32,
+0x3b,
+0x1b,
+0x1e,
+0x23,
+0x66,
+0x36,
+0x16,
+0x17,
+0x19,
+0x20,
+0x23,
+0x17,
+0x15,
+0x19,
+0x21,
+0x26,
+0x17,
+0x19,
+0x2a,
+0x30,
+0x19,
+0x19,
+0x20,
+0x39,
+0x45,
+0x19,
+0x1b,
+0x24,
+0x36,
+0xa2,
+0x0d,
+0x26,
+0x40,
+0x5a,
+0x5a,
+0x40,
+0x26,
+0x0d,
+0xf3,
+0xda,
+0xc0,
+0xa6,
+0xa6,
+0xc0,
+0xda,
+0xf3,
+0x03,
+0x0a,
+0x0d,
+0x0d,
+0x0d,
+0x06,
+0xfa,
+0xf3,
+0xf3,
+0xf3,
+0xf6,
+0xfd,
+0x0a,
+0x1d,
+0x26,
+0x26,
+0x26,
+0x13,
+0xed,
+0xda,
+0xda,
+0xda,
+0xe3,
+0xf6,
+0x10,
+0x30,
+0x40,
+0x40,
+0x40,
+0x20,
+0xe0,
+0xc0,
+0xc0,
+0xc0,
+0xd0,
+0xf0,
+0x16,
+0x43,
+0x5a,
+0x5a,
+0x5a,
+0x2d,
+0xd3,
+0xa6,
+0xa6,
+0xa6,
+0xbd,
+0xea,
+0x16,
+0x43,
+0x5a,
+0x5a,
+0x5a,
+0x2d,
+0xd3,
+0xa6,
+0xa6,
+0xa6,
+0xbd,
+0xea,
+0x10,
+0x30,
+0x40,
+0x40,
+0x40,
+0x20,
+0xe0,
+0xc0,
+0xc0,
+0xc0,
+0xd0,
+0xf0,
+0x0a,
+0x1d,
+0x26,
+0x26,
+0x26,
+0x13,
+0xed,
+0xda,
+0xda,
+0xda,
+0xe3,
+0xf6,
+0x03,
+0x0a,
+0x0d,
+0x0d,
+0x0d,
+0x06,
+0xfa,
+0xf3,
+0xf3,
+0xf3,
+0xf6,
+0xfd,
+0x0d,
+0x26,
+0x40,
+0x5a,
+0x73,
+0x73,
+0x5a,
+0x40,
+0x26,
+0x0d,
+0xf3,
+0xda,
+0xc0,
+0xa6,
+0x8d,
+0x8d,
+0xa6,
+0xc0,
+0xda,
+0xf3,
+0x03,
+0x0a,
+0x10,
+0x16,
+0x1d,
+0x1d,
+0x16,
+0x10,
+0x0a,
+0x03,
+0x0a,
+0x1d,
+0x30,
+0x43,
+0x56,
+0x56,
+0x43,
+0x30,
+0x1d,
+0x0a,
+0x0d,
+0x26,
+0x40,
+0x5a,
+0x73,
+0x73,
+0x5a,
+0x40,
+0x26,
+0x0d,
+0x0d,
+0x26,
+0x40,
+0x5a,
+0x73,
+0x73,
+0x5a,
+0x40,
+0x26,
+0x0d,
+0x06,
+0x13,
+0x20,
+0x2d,
+0x3a,
+0x3a,
+0x2d,
+0x20,
+0x13,
+0x06,
+0xfa,
+0xed,
+0xe0,
+0xd3,
+0xc6,
+0xc6,
+0xd3,
+0xe0,
+0xed,
+0xfa,
+0xf3,
+0xda,
+0xc0,
+0xa6,
+0x8d,
+0x8d,
+0xa6,
+0xc0,
+0xda,
+0xf3,
+0xf3,
+0xda,
+0xc0,
+0xa6,
+0x8d,
+0x8d,
+0xa6,
+0xc0,
+0xda,
+0xf3,
+0xf6,
+0xe3,
+0xd0,
+0xbd,
+0xaa,
+0xaa,
+0xbd,
+0xd0,
+0xe3,
+0xf6,
+0xfd,
+0xf6,
+0xf0,
+0xea,
+0xe3,
+0xe3,
+0xea,
+0xf0,
+0xf6,
+0xfd,
+0x00,
+0x00,
+0x00,
+0x00,
+0xcd,
+0x33,
+0x00,
+0x00,
+0x9a,
+0x66,
+0x00,
+0x00,
+0x66,
+0x9a,
+0x00,
+0x00,
+0x33,
+0xcd,
+0x00,
+0x00,
+0xc0,
+0x00,
+0x40,
+0x00,
+0x9a,
+0x26,
+0x33,
+0x0d,
+0x73,
+0x4d,
+0x26,
+0x1a,
+0x4d,
+0x73,
+0x1a,
+0x26,
+0x26,
+0x9a,
+0x0d,
+0x33,
+0x80,
+0x00,
+0x80,
+0x00,
+0x66,
+0x1a,
+0x66,
+0x1a,
+0x4d,
+0x33,
+0x4d,
+0x33,
+0x33,
+0x4d,
+0x33,
+0x4d,
+0x1a,
+0x66,
+0x1a,
+0x66,
+0x40,
+0x00,
+0xc0,
+0x00,
+0x33,
+0x0d,
+0x9a,
+0x26,
+0x26,
+0x1a,
+0x73,
+0x4d,
+0x1a,
+0x26,
+0x4d,
+0x73,
+0x0d,
+0x33,
+0x26,
+0x9a,
+0x00,
+0x00,
+0x04,
+0x00,
+0x08,
+0x00,
+0x0c,
+0x00,
+0x10,
+0x00,
+0x00,
+0x02,
+0x04,
+0x02,
+0x08,
+0x02,
+0x0c,
+0x02,
+0x10,
+0x02,
+0x00,
+0x04,
+0x04,
+0x04,
+0x08,
+0x04,
+0x0c,
+0x04,
+0x10,
+0x04,
+0x00,
+0x06,
+0x04,
+0x06,
+0x08,
+0x06,
+0x0c,
+0x06,
+0x10,
+0x06,
+0x00,
+0x08,
+0x14,
+0x00,
+0x18,
+0x00,
+0x1c,
+0x00,
+0x20,
+0x00,
+0x24,
+0x00,
+0x14,
+0x02,
+0x18,
+0x02,
+0x1c,
+0x02,
+0x20,
+0x02,
+0x24,
+0x02,
+0x14,
+0x04,
+0x18,
+0x04,
+0x1c,
+0x04,
+0x20,
+0x04,
+0x24,
+0x04,
+0x14,
+0x06,
+0x18,
+0x06,
+0x1c,
+0x06,
+0x20,
+0x06,
+0x24,
+0x06,
+0x14,
+0x08,
+0x28,
+0x00,
+0x2c,
+0x00,
+0x30,
+0x00,
+0x34,
+0x00,
+0x38,
+0x00,
+0x28,
+0x02,
+0x2c,
+0x02,
+0x30,
+0x02,
+0x34,
+0x02,
+0x38,
+0x02,
+0x28,
+0x04,
+0x2c,
+0x04,
+0x30,
+0x04,
+0x34,
+0x04,
+0x38,
+0x04,
+0x28,
+0x06,
+0x2c,
+0x06,
+0x30,
+0x06,
+0x34,
+0x06,
+0x38,
+0x06,
+0x28,
+0x08,
+0x3c,
+0x00,
+0x40,
+0x00,
+0x44,
+0x00,
+0x48,
+0x00,
+0x4c,
+0x00,
+0x3c,
+0x02,
+0x40,
+0x02,
+0x44,
+0x02,
+0x48,
+0x02,
+0x4c,
+0x02,
+0x3c,
+0x04,
+0x40,
+0x04,
+0x44,
+0x04,
+0x48,
+0x04,
+0x4c,
+0x04,
+0x3c,
+0x06,
+0x40,
+0x06,
+0x44,
+0x06,
+0x48,
+0x06,
+0x4c,
+0x06,
+0x3c,
+0x08,
+0x00,
+0x0a,
+0x04,
+0x0a,
+0x08,
+0x0a,
+0x0c,
+0x0a,
+0x10,
+0x0a,
+0x00,
+0x0c,
+0x04,
+0x0c,
+0x08,
+0x0c,
+0x0c,
+0x0c,
+0x10,
+0x0c,
+0x00,
+0x0e,
+0x04,
+0x0e,
+0x08,
+0x0e,
+0x0c,
+0x0e,
+0x10,
+0x0e,
+0x00,
+0x10,
+0x04,
+0x10,
+0x08,
+0x10,
+0x0c,
+0x10,
+0x10,
+0x10,
+0x00,
+0x12,
+0x14,
+0x0a,
+0x18,
+0x0a,
+0x1c,
+0x0a,
+0x20,
+0x0a,
+0x24,
+0x0a,
+0x14,
+0x0c,
+0x18,
+0x0c,
+0x1c,
+0x0c,
+0x20,
+0x0c,
+0x24,
+0x0c,
+0x14,
+0x0e,
+0x18,
+0x0e,
+0x1c,
+0x0e,
+0x20,
+0x0e,
+0x24,
+0x0e,
+0x14,
+0x10,
+0x18,
+0x10,
+0x1c,
+0x10,
+0x20,
+0x10,
+0x24,
+0x10,
+0x14,
+0x12,
+0x28,
+0x0a,
+0x2c,
+0x0a,
+0x30,
+0x0a,
+0x34,
+0x0a,
+0x38,
+0x0a,
+0x28,
+0x0c,
+0x2c,
+0x0c,
+0x30,
+0x0c,
+0x34,
+0x0c,
+0x38,
+0x0c,
+0x28,
+0x0e,
+0x2c,
+0x0e,
+0x30,
+0x0e,
+0x34,
+0x0e,
+0x38,
+0x0e,
+0x28,
+0x10,
+0x2c,
+0x10,
+0x30,
+0x10,
+0x34,
+0x10,
+0x38,
+0x10,
+0x28,
+0x12,
+0x3c,
+0x0a,
+0x40,
+0x0a,
+0x44,
+0x0a,
+0x48,
+0x0a,
+0x4c,
+0x0a,
+0x3c,
+0x0c,
+0x40,
+0x0c,
+0x44,
+0x0c,
+0x48,
+0x0c,
+0x4c,
+0x0c,
+0x3c,
+0x0e,
+0x40,
+0x0e,
+0x44,
+0x0e,
+0x48,
+0x0e,
+0x4c,
+0x0e,
+0x3c,
+0x10,
+0x40,
+0x10,
+0x44,
+0x10,
+0x48,
+0x10,
+0x4c,
+0x10,
+0x3c,
+0x12,
+0x00,
+0x14,
+0x04,
+0x14,
+0x08,
+0x14,
+0x0c,
+0x14,
+0x10,
+0x14,
+0x00,
+0x16,
+0x04,
+0x16,
+0x08,
+0x16,
+0x0c,
+0x16,
+0x10,
+0x16,
+0x00,
+0x18,
+0x04,
+0x18,
+0x08,
+0x18,
+0x0c,
+0x18,
+0x10,
+0x18,
+0x00,
+0x1a,
+0x04,
+0x1a,
+0x08,
+0x1a,
+0x0c,
+0x1a,
+0x10,
+0x1a,
+0x00,
+0x1c,
+0x14,
+0x14,
+0x18,
+0x14,
+0x1c,
+0x14,
+0x20,
+0x14,
+0x24,
+0x14,
+0x14,
+0x16,
+0x18,
+0x16,
+0x1c,
+0x16,
+0x20,
+0x16,
+0x24,
+0x16,
+0x14,
+0x18,
+0x18,
+0x18,
+0x1c,
+0x18,
+0x20,
+0x18,
+0x24,
+0x18,
+0x14,
+0x1a,
+0x18,
+0x1a,
+0x1c,
+0x1a,
+0x20,
+0x1a,
+0x24,
+0x1a,
+0x14,
+0x1c,
+0x28,
+0x14,
+0x2c,
+0x14,
+0x30,
+0x14,
+0x34,
+0x14,
+0x38,
+0x14,
+0x28,
+0x16,
+0x2c,
+0x16,
+0x30,
+0x16,
+0x34,
+0x16,
+0x38,
+0x16,
+0x28,
+0x18,
+0x2c,
+0x18,
+0x30,
+0x18,
+0x34,
+0x18,
+0x38,
+0x18,
+0x28,
+0x1a,
+0x2c,
+0x1a,
+0x30,
+0x1a,
+0x34,
+0x1a,
+0x38,
+0x1a,
+0x28,
+0x1c,
+0x3c,
+0x14,
+0x40,
+0x14,
+0x44,
+0x14,
+0x48,
+0x14,
+0x4c,
+0x14,
+0x3c,
+0x16,
+0x40,
+0x16,
+0x44,
+0x16,
+0x48,
+0x16,
+0x4c,
+0x16,
+0x3c,
+0x18,
+0x40,
+0x18,
+0x44,
+0x18,
+0x48,
+0x18,
+0x4c,
+0x18,
+0x3c,
+0x1a,
+0x40,
+0x1a,
+0x44,
+0x1a,
+0x48,
+0x1a,
+0x4c,
+0x1a,
+0x3c,
+0x1c,
+0x00,
+0x1e,
+0x04,
+0x1e,
+0x08,
+0x1e,
+0x0c,
+0x1e,
+0x10,
+0x1e,
+0x00,
+0x20,
+0x04,
+0x20,
+0x08,
+0x20,
+0x0c,
+0x20,
+0x10,
+0x20,
+0x00,
+0x22,
+0x04,
+0x22,
+0x08,
+0x22,
+0x0c,
+0x22,
+0x10,
+0x22,
+0x00,
+0x24,
+0x04,
+0x24,
+0x08,
+0x24,
+0x0c,
+0x24,
+0x10,
+0x24,
+0x00,
+0x26,
+0x14,
+0x1e,
+0x18,
+0x1e,
+0x1c,
+0x1e,
+0x20,
+0x1e,
+0x24,
+0x1e,
+0x14,
+0x20,
+0x18,
+0x20,
+0x1c,
+0x20,
+0x20,
+0x20,
+0x24,
+0x20,
+0x14,
+0x22,
+0x18,
+0x22,
+0x1c,
+0x22,
+0x20,
+0x22,
+0x24,
+0x22,
+0x14,
+0x24,
+0x18,
+0x24,
+0x1c,
+0x24,
+0x20,
+0x24,
+0x24,
+0x24,
+0x14,
+0x26,
+0x28,
+0x1e,
+0x2c,
+0x1e,
+0x30,
+0x1e,
+0x34,
+0x1e,
+0x38,
+0x1e,
+0x28,
+0x20,
+0x2c,
+0x20,
+0x30,
+0x20,
+0x34,
+0x20,
+0x38,
+0x20,
+0x28,
+0x22,
+0x2c,
+0x22,
+0x30,
+0x22,
+0x34,
+0x22,
+0x38,
+0x22,
+0x28,
+0x24,
+0x2c,
+0x24,
+0x30,
+0x24,
+0x34,
+0x24,
+0x38,
+0x24,
+0x28,
+0x26,
+0x3c,
+0x1e,
+0x40,
+0x1e,
+0x44,
+0x1e,
+0x48,
+0x1e,
+0x4c,
+0x1e,
+0x3c,
+0x20,
+0x40,
+0x20,
+0x44,
+0x20,
+0x48,
+0x20,
+0x4c,
+0x20,
+0x3c,
+0x22,
+0x40,
+0x22,
+0x44,
+0x22,
+0x48,
+0x22,
+0x4c,
+0x22,
+0x3c,
+0x24,
+0x40,
+0x24,
+0x44,
+0x24,
+0x48,
+0x24,
+0x4c,
+0x24,
+0x3c,
+0x26,
+0x00,
+0x28,
+0x04,
+0x28,
+0x08,
+0x28,
+0x0c,
+0x28,
+0x10,
+0x28,
+0x00,
+0x2a,
+0x04,
+0x2a,
+0x08,
+0x2a,
+0x0c,
+0x2a,
+0x10,
+0x2a,
+0x00,
+0x2c,
+0x04,
+0x2c,
+0x08,
+0x2c,
+0x0c,
+0x2c,
+0x10,
+0x2c,
+0x00,
+0x2e,
+0x04,
+0x2e,
+0x08,
+0x2e,
+0x0c,
+0x2e,
+0x10,
+0x2e,
+0x00,
+0x30,
+0x01,
+0x01,
+0x01,
+0x01,
+0x0c,
+0x1a,
+0x26,
+0x34,
+0x40,
+0x4c,
+0x5a,
+0x66,
+0x74,
+0x80,
+0x8c,
+0x9a,
+0xa6,
+0xb4,
+0xc0,
+0xcc,
+0xda,
+0xe6,
+0xf4,
+0x00,
+0x10,
+0x20,
+0x30,
+0x40,
+0x50,
+0x60,
+0x70,
+0x80,
+0x90,
+0xa0,
+0xb0,
+0xc0,
+0xd0,
+0xe0,
+0xf0,
+0x00,
+0x00,
+0x00,
+0x00,
+0x55,
+0x00,
+0xcc,
+0xaa,
+0x24,
+0x00,
+0x1c,
+0x66,
+0xd1,
+0x55,
+0xec,
+0x92,
+0x44,
+0x00,
+0xc3,
+0x8e,
+0x5e,
+0x33,
+0x0c,
+0xe8,
+0xc8,
+0xaa,
+0x8f,
+0x76,
+0x5e,
+0x49,
+0x34,
+0x22,
+0x10,
+0x00,
+0xf0,
+0xe1,
+0xd4,
+0xc7,
+0xba,
+0xaf,
+0xa4,
+0x99,
+0x8f,
+0x86,
+0x7d,
+0x74,
+0x6c,
+0x64,
+0x5c,
+0x55,
+0x4e,
+0x47,
+0x41,
+0x3b,
+0x35,
+0x2f,
+0x29,
+0x24,
+0x1f,
+0x1a,
+0x15,
+0x11,
+0x0c,
+0x08,
+0x04,
+0x00,
+0xfc,
+0xf8,
+0xf4,
+0xf0,
+0xed,
+0xea,
+0xe6,
+0xe3,
+0xe0,
+0xdd,
+0xda,
+0xd7,
+0xd4,
+0xd2,
+0xcf,
+0xcc,
+0xca,
+0xc7,
+0xc5,
+0xc3,
+0xc0,
+0xbe,
+0xbc,
+0xba,
+0xb8,
+0xb6,
+0xb4,
+0xb2,
+0xb0,
+0xae,
+0xac,
+0xaa,
+0xa8,
+0xa7,
+0xa5,
+0xa3,
+0xa2,
+0xa0,
+0x9f,
+0x9d,
+0x9c,
+0x9a,
+0x99,
+0x97,
+0x96,
+0x94,
+0x93,
+0x92,
+0x90,
+0x8f,
+0x8e,
+0x8d,
+0x8c,
+0x8a,
+0x89,
+0x88,
+0x87,
+0x86,
+0x85,
+0x84,
+0x83,
+0x82,
+0x81,
+0x80,
+0x7f,
+0x7e,
+0x7d,
+0x7c,
+0x7b,
+0x7a,
+0x79,
+0x78,
+0x77,
+0x76,
+0x75,
+0x75,
+0x74,
+0x73,
+0x72,
+0x71,
+0x70,
+0x70,
+0x6f,
+0x6e,
+0x6d,
+0x6d,
+0x6c,
+0x6b,
+0x6b,
+0x6a,
+0x69,
+0x69,
+0x68,
+0x67,
+0x67,
+0x66,
+0x65,
+0x65,
+0x64,
+0x63,
+0x63,
+0x62,
+0x62,
+0x61,
+0x60,
+0x60,
+0x5f,
+0x5f,
+0x5e,
+0x5e,
+0x5d,
+0x5d,
+0x5c,
+0x5c,
+0x5b,
+0x5b,
+0x5a,
+0x5a,
+0x59,
+0x59,
+0x58,
+0x58,
+0x57,
+0x57,
+0x56,
+0x56,
+0x55,
+0x55,
+0x54,
+0x54,
+0x54,
+0x53,
+0x53,
+0x52,
+0x52,
+0x51,
+0x51,
+0x51,
+0x50,
+0x50,
+0x4f,
+0x4f,
+0x4f,
+0x4e,
+0x4e,
+0x4e,
+0x4d,
+0x4d,
+0x4c,
+0x4c,
+0x4c,
+0x4b,
+0x4b,
+0x4b,
+0x4a,
+0x4a,
+0x4a,
+0x49,
+0x49,
+0x49,
+0x48,
+0x48,
+0x48,
+0x47,
+0x47,
+0x47,
+0x46,
+0x46,
+0x46,
+0x46,
+0x45,
+0x45,
+0x45,
+0x44,
+0x44,
+0x44,
+0x43,
+0x43,
+0x43,
+0x43,
+0x42,
+0x42,
+0x42,
+0x42,
+0x41,
+0x41,
+0x41,
+0x41,
+0x40,
+0x40,
+0x40,
+0x40,
+0x40,
+0x20,
+0x15,
+0x10,
+0x0c,
+0x0a,
+0x09,
+0x08,
+0x07,
+0x06,
+0x05,
+0x05,
+0x04,
+0x04,
+0x04,
+0x04,
+0x03,
+0x03,
+0x03,
+0x03,
+0x03,
+0x02,
+0x02,
+0x02,
+0x02,
+0x02,
+0x02,
+0x02,
+0x02,
+0x02,
+0x02,
+0x02,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x01,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0x00,
+0xfe,
+0xfc,
+0xfa,
+0xf8,
+0xf6,
+0xf4,
+0xf2,
+0xf0,
+0xef,
+0xed,
+0xeb,
+0xe9,
+0xe8,
+0xe6,
+0xe4,
+0xe3,
+0xe1,
+0xe0,
+0xde,
+0xdd,
+0xdb,
+0xda,
+0xd8,
+0xd7,
+0xd5,
+0xd4,
+0xd3,
+0xd1,
+0xd0,
+0xcf,
+0xcd,
+0xcc,
+0xcb,
+0xc9,
+0xc8,
+0xc7,
+0xc6,
+0xc5,
+0xc3,
+0xc2,
+0xc1,
+0xc0,
+0xbf,
+0xbe,
+0xbd,
+0xbb,
+0xba,
+0xb9,
+0xb8,
+0xb7,
+0xb6,
+0xb5,
+0xb4,
+0xb3,
+0xb2,
+0xb1,
+0xb0,
+0xaf,
+0xae,
+0xad,
+0xac,
+0xac,
+0xab,
+0xaa,
+0xa9,
+0xa8,
+0xa7,
+0xa6,
+0xa5,
+0xa5,
+0xa4,
+0xa3,
+0xa2,
+0xa1,
+0xa0,
+0xa0,
+0x9f,
+0x9e,
+0x9d,
+0x9d,
+0x9c,
+0x9b,
+0x9a,
+0x9a,
+0x99,
+0x98,
+0x97,
+0x97,
+0x96,
+0x95,
+0x95,
+0x94,
+0x93,
+0x93,
+0x92,
+0x91,
+0x91,
+0x90,
+0x8f,
+0x8f,
+0x8e,
+0x8d,
+0x8d,
+0x8c,
+0x8c,
+0x8b,
+0x8a,
+0x8a,
+0x89,
+0x89,
+0x88,
+0x88,
+0x87,
+0x86,
+0x86,
+0x85,
+0x85,
+0x84,
+0x84,
+0x83,
+0x83,
+0x82,
+0x82,
+0x81,
+0x81,
+0x80,
+0x80,
+0x7f,
+0x00,
+0x80,
+0x00,
+0x00,
+0x80,
+0x00,
+0x00,
+0x00,
+0x00,
+0xae,
+0x00,
+0x93,
+0xae,
+0x75,
+0x00,
+0x5c,
+0x93,
+0xad,
+0xae,
+0x9b,
+0x75,
+0x41,
+0x00,
+0xb3,
+0x5c,
+0xfc,
+0x93,
+0x23,
+0xad,
+0x30,
+0xae,
+0x27,
+0x9b,
+0x0a,
+0x75,
+0xdd,
+0x41,
+0xa2,
+0x00,
+0x5b,
+0xb3,
+0x09,
+0x5c,
+0xad,
+0xfc,
+0x49,
+0x93,
+0xdc,
+0x23,
+0x69,
+0xad,
+0xef,
+0x30,
+0x70,
+0xae,
+0xeb,
+0x27,
+0x61,
+0x9b,
+0xd3,
+0x0a,
+0x40,
+0x75,
+0xaa,
+0xdd,
+0x10,
+0x41,
+0x72,
+0xa2,
+0xd1,
+0x00,
+0x2e,
+0x5b,
+0x87,
+0xb3,
+0xde,
+0x09,
+0x33,
+0x5c,
+0x85,
+0xad,
+0xd5,
+0xfc,
+0x22,
+0x49,
+0x6e,
+0x93,
+0xb8,
+0xdc,
+0x00,
+0x23,
+0x46,
+0x69,
+0x8b,
+0xad,
+0xce,
+0xef,
+0x10,
+0x30,
+0x50,
+0x70,
+0x8f,
+0xae,
+0xcd,
+0xeb,
+0x09,
+0x27,
+0x44,
+0x61,
+0x7e,
+0x9b,
+0xb7,
+0xd3,
+0xef,
+0x0a,
+0x25,
+0x40,
+0x5b,
+0x75,
+0x90,
+0xaa,
+0xc4,
+0xdd,
+0xf7,
+0x10,
+0x29,
+0x41,
+0x5a,
+0x72,
+0x8a,
+0xa2,
+0xba,
+0xd1,
+0xe9,
+0x00,
+0x17,
+0x2e,
+0x44,
+0x5b,
+0x71,
+0x87,
+0x9d,
+0xb3,
+0xc9,
+0xde,
+0xf4,
+0x09,
+0x1e,
+0x33,
+0x47,
+0x5c,
+0x70,
+0x85,
+0x99,
+0xad,
+0xc1,
+0xd5,
+0xe8,
+0xfc,
+0x0f,
+0x22,
+0x36,
+0x49,
+0x5b,
+0x6e,
+0x81,
+0x93,
+0xa6,
+0xb8,
+0xca,
+0xdc,
+0xee,
+0x00,
+0x12,
+0x23,
+0x35,
+0x46,
+0x58,
+0x69,
+0x7a,
+0x8b,
+0x9c,
+0xad,
+0xbe,
+0xce,
+0xdf,
+0xef,
+0x00,
+0x10,
+0x20,
+0x30,
+0x40,
+0x50,
+0x60,
+0x70,
+0x7f,
+0x8f,
+0x9f,
+0xae,
+0xbd,
+0xcd,
+0xdc,
+0xeb,
+0xfa,
+0x09,
+0x18,
+0x27,
+0x35,
+0x44,
+0x53,
+0x61,
+0x70,
+0x7e,
+0x8c,
+0x9b,
+0xa9,
+0xb7,
+0xc5,
+0xd3,
+0xe1,
+0xef,
+0xfc,
+0x0a,
+0x18,
+0x25,
+0x33,
+0x40,
+0x4e,
+0x5b,
+0x68,
+0x75,
+0x83,
+0x90,
+0x9d,
+0xaa,
+0xb7,
+0xc4,
+0xd0,
+0xdd,
+0xea,
+0xf7,
+0x03,
+0x10,
+0x1c,
+0x29,
+0x35,
+0x41,
+0x4e,
+0x5a,
+0x66,
+0x72,
+0x7e,
+0x8a,
+0x96,
+0xa2,
+0xae,
+0xba,
+0xc6,
+0xd1,
+0xdd,
+0xe9,
+0xf4,
+0x00,
+0x00,
+0x08,
+0x0c,
+0x10,
+0x12,
+0x14,
+0x16,
+0x18,
+0x19,
+0x1a,
+0x1b,
+0x1c,
+0x1d,
+0x1e,
+0x1f,
+0x20,
+0x20,
+0x21,
+0x21,
+0x22,
+0x23,
+0x23,
+0x24,
+0x24,
+0x25,
+0x25,
+0x26,
+0x26,
+0x26,
+0x27,
+0x27,
+0x28,
+0x28,
+0x28,
+0x29,
+0x29,
+0x29,
+0x29,
+0x2a,
+0x2a,
+0x2a,
+0x2b,
+0x2b,
+0x2b,
+0x2b,
+0x2c,
+0x2c,
+0x2c,
+0x2c,
+0x2d,
+0x2d,
+0x2d,
+0x2d,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2e,
+0x2f,
+0x2f,
+0x2f,
+0x2f,
+0x2f,
+0x30,
+0x30,
+0x30,
+0x30,
+0x30,
+0x30,
+0x31,
+0x31,
+0x31,
+0x31,
+0x31,
+0x31,
+0x31,
+0x32,
+0x32,
+0x32,
+0x32,
+0x32,
+0x32,
+0x33,
+0x33,
+0x33,
+0x33,
+0x33,
+0x33,
+0x33,
+0x33,
+0x34,
+0x34,
+0x34,
+0x34,
+0x34,
+0x34,
+0x34,
+0x34,
+0x35,
+0x35,
+0x35,
+0x35,
+0x35,
+0x35,
+0x35,
+0x35,
+0x35,
+0x36,
+0x36,
+0x36,
+0x36,
+0x36,
+0x36,
+0x36,
+0x36,
+0x36,
+0x36,
+0x37,
+0x37,
+0x37,
+0x37,
+0x37,
+0x37,
+0x37,
+0x37,
+0x37,
+0x37,
+0x38,
+0x38,
+0x38,
+0x38,
+0x38,
+0x38,
+0x38,
+0x38,
+0x38,
+0x38,
+0x38,
+0x38,
+0x39,
+0x39,
+0x39,
+0x39,
+0x39,
+0x39,
+0x39,
+0x39,
+0x39,
+0x39,
+0x39,
+0x39,
+0x39,
+0x3a,
+0x3a,
+0x3a,
+0x3a,
+0x3a,
+0x3a,
+0x3a,
+0x3a,
+0x3a,
+0x3a,
+0x3a,
+0x3a,
+0x3a,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3b,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3c,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3d,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3e,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x7f,
+0x7f,
+0xf7,
+0x7f,
+0x6f,
+0x80,
+0xe7,
+0x80,
+0x0f,
+0x81,
+0x37,
+0x81,
+0x21,
+0x7d,
+};
+uint8_t dopcode_u_2_1[] =
+{
+0xa0,
+0x00,
+0x80,
+0x02,
+0xa0,
+0x01,
+0x78,
+0xa2,
+0xff,
+0x9a,
+0xf8,
+0xb8,
+0xc0,
+0x00,
+0xf0,
+0x0a,
+0x20,
+0x69,
+0x27,
+0xf0,
+0x05,
+0xa2,
+0x01,
+0x4c,
+0x8f,
+0x03,
+0x64,
+0x10,
+0x64,
+0x11,
+0x64,
+0x13,
+0xa9,
+0x01,
+0x85,
+0x12,
+0xa0,
+0x50,
+0x13,
+0x10,
+0x00,
+0x52,
+0x02,
+0xa0,
+0x52,
+0x13,
+0x10,
+0x00,
+0x00,
+0x02,
+0xa9,
+0x11,
+0x8d,
+0xa4,
+0x02,
+0xa9,
+0x80,
+0x8d,
+0x4a,
+0x02,
+0x8d,
+0x4b,
+0x02,
+0x8d,
+0x4c,
+0x02,
+0x8d,
+0x4d,
+0x02,
+0x8d,
+0x4e,
+0x02,
+0x8d,
+0x4f,
+0x02,
+0x8d,
+0x50,
+0x02,
+0xa9,
+0x01,
+0x8d,
+0x00,
+0x02,
+0xa9,
+0x02,
+0x8d,
+0x01,
+0x02,
+0xa9,
+0xed,
+0x8d,
+0x02,
+0x02,
+0xa9,
+0xb4,
+0x8d,
+0x03,
+0x02,
+0xa9,
+0xff,
+0x8d,
+0xa2,
+0x02,
+0x8d,
+0xa3,
+0x02,
+0xa0,
+0x03,
+0x53,
+0xcc,
+0x3b,
+0x04,
+0x02,
+0xa9,
+0x01,
+0x8d,
+0x07,
+0x02,
+0xcd,
+0xce,
+0x3b,
+0xf0,
+0x04,
+0xa2,
+0x03,
+0x80,
+0x10,
+0xa2,
+0x02,
+0xad,
+0x00,
+0x60,
+0xc9,
+0xed,
+0xd0,
+0x07,
+0xad,
+0x01,
+0x60,
+0xc9,
+0xb4,
+0xf0,
+0x0e,
+0x8e,
+0x08,
+0x02,
+0xa9,
+0x01,
+0x9c,
+0x14,
+0x68,
+0x8d,
+0x14,
+0x68,
+0x5c,
+0x80,
+0xfd,
+0x9c,
+0x14,
+0x68,
+0x9c,
+0x18,
+0x68,
+0x9c,
+0x20,
+0x68,
+0x9c,
+0x24,
+0x68,
+0x9c,
+0x28,
+0x68,
+0xa9,
+0xf8,
+0x85,
+0x0e,
+0xa9,
+0x22,
+0x85,
+0x0f,
+0xa9,
+0x8e,
+0x85,
+0x02,
+0xa9,
+0x22,
+0x85,
+0x03,
+0xa9,
+0x40,
+0x85,
+0x04,
+0xa9,
+0x25,
+0x85,
+0x05,
+0xa9,
+0x09,
+0x85,
+0x06,
+0xa9,
+0x23,
+0x85,
+0x07,
+0xa9,
+0x7c,
+0x85,
+0x08,
+0xa9,
+0x23,
+0x85,
+0x09,
+0xa0,
+0x0e,
+0x13,
+0x10,
+0x00,
+0xa5,
+0x02,
+0x9c,
+0xbb,
+0x02,
+0x9c,
+0xbc,
+0x02,
+0xa9,
+0x01,
+0x8d,
+0xb3,
+0x02,
+0xa9,
+0x02,
+0x8d,
+0xb4,
+0x02,
+0x8d,
+0xb5,
+0x02,
+0xa0,
+0x02,
+0x53,
+0xa2,
+0x3c,
+0xb6,
+0x02,
+0x53,
+0xa4,
+0x3c,
+0xb8,
+0x02,
+0x13,
+0x10,
+0x00,
+0x5b,
+0x2d,
+0x13,
+0x10,
+0x00,
+0xbe,
+0x2d,
+0x13,
+0x10,
+0x00,
+0x63,
+0x00,
+0xa0,
+0x02,
+0x13,
+0x10,
+0x00,
+0xaf,
+0x2d,
+0x13,
+0x10,
+0x00,
+0x12,
+0x2e,
+0x13,
+0x10,
+0x00,
+0xb7,
+0x00,
+0x9c,
+0xba,
+0x02,
+0xa9,
+0x04,
+0x8d,
+0xb1,
+0x2d,
+0x8d,
+0x14,
+0x2e,
+0x64,
+0xb9,
+0x9c,
+0xa8,
+0x2c,
+0x9c,
+0xa9,
+0x2c,
+0x9c,
+0xaa,
+0x2c,
+0x9c,
+0xb1,
+0x2c,
+0x9c,
+0xb2,
+0x2c,
+0x9c,
+0xb3,
+0x2c,
+0x9c,
+0xb4,
+0x2c,
+0x9c,
+0xb5,
+0x2c,
+0x9c,
+0xb6,
+0x2c,
+0xa9,
+0x01,
+0x8d,
+0x04,
+0x60,
+0x9c,
+0xdd,
+0x28,
+0x58,
+0x8d,
+0x14,
+0x68,
+0x4c,
+0x9a,
+0x03,
+0xf0,
+0x30,
+0xad,
+0xb7,
+0x2c,
+0xaa,
+0x29,
+0x03,
+0x85,
+0x6d,
+0xd0,
+0x0a,
+0xa9,
+0x01,
+0x85,
+0x67,
+0x85,
+0x68,
+0x85,
+0x69,
+0x80,
+0x16,
+0x8a,
+0x4a,
+0x4a,
+0xaa,
+0x29,
+0x01,
+0x85,
+0x67,
+0x8a,
+0x4a,
+0xaa,
+0x29,
+0x01,
+0x85,
+0x68,
+0x8a,
+0x4a,
+0xaa,
+0x29,
+0x01,
+0x85,
+0x69,
+0x20,
+0x0c,
+0x0d,
+0xf0,
+0x01,
+0x60,
+0xad,
+0xfe,
+0x2c,
+0xd0,
+0x02,
+0xa9,
+0x11,
+0x85,
+0xb8,
+0xcd,
+0xbb,
+0x02,
+0xf0,
+0x12,
+0x29,
+0xf0,
+0xf0,
+0x08,
+0x4a,
+0x4a,
+0x4a,
+0x4a,
+0x85,
+0xb7,
+0x80,
+0x0e,
+0xa9,
+0x10,
+0x85,
+0xb7,
+0x80,
+0x08,
+0xad,
+0xbc,
+0x02,
+0x85,
+0xb7,
+0x20,
+0x70,
+0x18,
+0xad,
+0xfd,
+0x2c,
+0x85,
+0x73,
+0xa0,
+0x02,
+0x53,
+0xca,
+0x2c,
+0xc1,
+0x00,
+0x53,
+0xd0,
+0x2c,
+0xcd,
+0x00,
+0x20,
+0x3d,
+0x12,
+0xf0,
+0x01,
+0x60,
+0xa0,
+0x02,
+0x53,
+0x2d,
+0x00,
+0x5f,
+0x00,
+0xa5,
+0x60,
+0xcd,
+0xf6,
+0x3f,
+0x90,
+0x09,
+0xd0,
+0x0f,
+0xa5,
+0x5f,
+0xcd,
+0xf5,
+0x3f,
+0xb0,
+0x08,
+0xad,
+0xf7,
+0x2c,
+0xae,
+0xfa,
+0x2c,
+0x80,
+0x1e,
+0xa5,
+0x60,
+0xcd,
+0xf8,
+0x3f,
+0x90,
+0x09,
+0xd0,
+0x0f,
+0xa5,
+0x5f,
+0xcd,
+0xf7,
+0x3f,
+0xb0,
+0x08,
+0xad,
+0xf8,
+0x2c,
+0xae,
+0xfb,
+0x2c,
+0x80,
+0x06,
+0xad,
+0xf9,
+0x2c,
+0xae,
+0xfc,
+0x2c,
+0x85,
+0x76,
+0x86,
+0x78,
+0xad,
+0xf6,
+0x2c,
+0x85,
+0x77,
+0xa5,
+0x6e,
+0xd0,
+0x4e,
+0xa5,
+0x6d,
+0xc9,
+0x02,
+0xd0,
+0x48,
+0xad,
+0xb1,
+0x02,
+0xc5,
+0x77,
+0x90,
+0x11,
+0x38,
+0xe5,
+0x77,
+0x4d,
+0x0f,
+0x3c,
+0x18,
+0x69,
+0x80,
+0x98,
+0x69,
+0x00,
+0x18,
+0x65,
+0x77,
+0x80,
+0x16,
+0xa5,
+0x77,
+0x38,
+0xed,
+0xb1,
+0x02,
+0x4d,
+0x0f,
+0x3c,
+0x18,
+0x69,
+0x80,
+0x98,
+0x69,
+0x00,
+0x85,
+0xbd,
+0x38,
+0xa5,
+0x77,
+0xe5,
+0xbd,
+0x85,
+0x77,
+0xad,
+0xb0,
+0x02,
+0xc5,
+0x76,
+0x90,
+0x13,
+0x38,
+0xe5,
+0x76,
+0x4d,
+0x0f,
+0x3c,
+0x18,
+0x69,
+0x80,
+0x98,
+0x69,
+0x00,
+0x18,
+0x65,
+0x76,
+0x80,
+0x18,
+0x80,
+0x48,
+0xa5,
+0x76,
+0x38,
+0xed,
+0xb0,
+0x02,
+0x4d,
+0x0f,
+0x3c,
+0x18,
+0x69,
+0x80,
+0x98,
+0x69,
+0x00,
+0x85,
+0xbd,
+0x38,
+0xa5,
+0x76,
+0xe5,
+0xbd,
+0x85,
+0x76,
+0xad,
+0xb2,
+0x02,
+0xc5,
+0x78,
+0x90,
+0x11,
+0x38,
+0xe5,
+0x78,
+0x4d,
+0x0f,
+0x3c,
+0x18,
+0x69,
+0x80,
+0x98,
+0x69,
+0x00,
+0x18,
+0x65,
+0x78,
+0x80,
+0x16,
+0xa5,
+0x78,
+0x38,
+0xed,
+0xb2,
+0x02,
+0x4d,
+0x0f,
+0x3c,
+0x18,
+0x69,
+0x80,
+0x98,
+0x69,
+0x00,
+0x85,
+0xbd,
+0x38,
+0xa5,
+0x78,
+0xe5,
+0xbd,
+0x85,
+0x78,
+0xa0,
+0x02,
+0xad,
+0x0b,
+0x3c,
+0xd0,
+0x07,
+0x53,
+0xca,
+0x2c,
+0xc1,
+0x00,
+0x80,
+0x05,
+0x53,
+0xce,
+0x2c,
+0xc1,
+0x00,
+0x53,
+0xd4,
+0x2c,
+0xcd,
+0x00,
+0x20,
+0x3d,
+0x12,
+0xf0,
+0x01,
+0x60,
+0xa0,
+0x02,
+0x53,
+0x2d,
+0x00,
+0x2b,
+0x00,
+0x18,
+0xad,
+0xda,
+0x2c,
+0x69,
+0x02,
+0xb0,
+0x10,
+0x4a,
+0x4a,
+0xc9,
+0x08,
+0x90,
+0x06,
+0xc9,
+0x40,
+0xb0,
+0x06,
+0x80,
+0x06,
+0xa9,
+0x08,
+0x80,
+0x02,
+0xa9,
+0x3f,
+0x85,
+0x7a,
+0x18,
+0xad,
+0xdb,
+0x2c,
+0x69,
+0x02,
+0xb0,
+0x10,
+0x4a,
+0x4a,
+0xc9,
+0x08,
+0x90,
+0x06,
+0xc9,
+0x40,
+0xb0,
+0x06,
+0x80,
+0x06,
+0xa9,
+0x08,
+0x80,
+0x02,
+0xa9,
+0x3f,
+0x85,
+0x7b,
+0xa4,
+0x7a,
+0xb9,
+0x87,
+0x28,
+0x85,
+0x7c,
+0x45,
+0x7b,
+0x20,
+0x74,
+0x21,
+0x85,
+0x30,
+0xa4,
+0x7b,
+0xb9,
+0x87,
+0x28,
+0x85,
+0x7d,
+0x45,
+0x7a,
+0x20,
+0x74,
+0x21,
+0x85,
+0x2f,
+0xa0,
+0x02,
+0xad,
+0xdd,
+0x2c,
+0xd0,
+0x0c,
+0xad,
+0xdc,
+0x2c,
+0xd0,
+0x07,
+0x53,
+0xb6,
+0x02,
+0xc1,
+0x00,
+0x80,
+0x05,
+0x53,
+0xdc,
+0x2c,
+0xc1,
+0x00,
+0x20,
+0xb5,
+0x0c,
+0x85,
+0x74,
+0xa0,
+0x02,
+0xad,
+0xdf,
+0x2c,
+0xd0,
+0x0c,
+0xad,
+0xde,
+0x2c,
+0xd0,
+0x07,
+0x53,
+0xb8,
+0x02,
+0xc1,
+0x00,
+0x80,
+0x05,
+0x53,
+0xde,
+0x2c,
+0xc1,
+0x00,
+0x20,
+0xb5,
+0x0c,
+0x85,
+0x75,
+0xa5,
+0x68,
+0xf0,
+0x04,
+0x64,
+0x80,
+0x80,
+0x10,
+0xa5,
+0x75,
+0xc9,
+0x02,
+0xb0,
+0x05,
+0xad,
+0xa6,
+0x3c,
+0x80,
+0x03,
+0xad,
+0xa7,
+0x3c,
+0x85,
+0x80,
+0xad,
+0xa9,
+0x3c,
+0x49,
+0x10,
+0x84,
+0xc2,
+0x85,
+0xc1,
+0xa5,
+0x7b,
+0x85,
+0xc3,
+0x64,
+0xc4,
+0x20,
+0xcf,
+0x27,
+0xa5,
+0xc2,
+0xd0,
+0x06,
+0xa5,
+0xc1,
+0xc9,
+0x3f,
+0x90,
+0x02,
+0xa9,
+0x3f,
+0x85,
+0x81,
+0xad,
+0xa8,
+0x3c,
+0x45,
+0x7a,
+0x84,
+0xc2,
+0x85,
+0xc1,
+0xa5,
+0x7b,
+0x85,
+0xc3,
+0x64,
+0xc4,
+0x20,
+0xcf,
+0x27,
+0xa5,
+0xc2,
+0xd0,
+0x06,
+0xa5,
+0xc1,
+0xc9,
+0x3f,
+0x90,
+0x02,
+0xa9,
+0x3f,
+0x85,
+0x82,
+0xa9,
+0x00,
+0xa6,
+0x74,
+0xe0,
+0x02,
+0xb0,
+0x08,
+0xa9,
+0x01,
+0xe4,
+0x75,
+0xf0,
+0x02,
+0xa9,
+0x02,
+0x85,
+0x83,
+0xa0,
+0x00,
+0xa5,
+0x60,
+0xd9,
+0xb9,
+0x3c,
+0x90,
+0x11,
+0xd0,
+0x07,
+0xa5,
+0x5f,
+0xd9,
+0xb8,
+0x3c,
+0x90,
+0x08,
+0xc8,
+0xc8,
+0xc0,
+0x06,
+0xf0,
+0x02,
+0x80,
+0xe8,
+0x98,
+0x4a,
+0x49,
+0x03,
+0xa8,
+0xb9,
+0xbe,
+0x3c,
+0x85,
+0x84,
+0xb9,
+0xbf,
+0x3c,
+0x85,
+0x85,
+0xb9,
+0xc0,
+0x3c,
+0x85,
+0x86,
+0xa5,
+0x74,
+0x4a,
+0xaa,
+0xbd,
+0xf7,
+0x3c,
+0x85,
+0x87,
+0x29,
+0x01,
+0xf0,
+0x1e,
+0xa0,
+0x02,
+0xad,
+0x0b,
+0x3c,
+0xd0,
+0x07,
+0x53,
+0xca,
+0x2c,
+0xc1,
+0x00,
+0x80,
+0x05,
+0x53,
+0xcc,
+0x2c,
+0xc1,
+0x00,
+0x53,
+0xd2,
+0x2c,
+0xcd,
+0x00,
+0x20,
+0x3d,
+0x12,
+0xf0,
+0x01,
+0x60,
+0xa5,
+0x2d,
+0x49,
+0x10,
+0x85,
+0xc5,
+0x84,
+0xc6,
+0xa5,
+0x2e,
+0x49,
+0x10,
+0x05,
+0xc6,
+0x85,
+0xc6,
+0x84,
+0xc7,
+0x64,
+0xc8,
+0xa0,
+0x02,
+0x53,
+0x5f,
+0x00,
+0xc1,
+0x00,
+0x20,
+0x87,
+0x21,
+0xa5,
+0xc7,
+0xd0,
+0x0e,
+0xa5,
+0xc6,
+0xd0,
+0x0a,
+0xa4,
+0xc5,
+0xc0,
+0x08,
+0x90,
+0x08,
+0xc0,
+0x3f,
+0x90,
+0x06,
+0xa0,
+0x3f,
+0x80,
+0x02,
+0xa0,
+0x08,
+0xb9,
+0x87,
+0x28,
+0x85,
+0x88,
+0xa5,
+0x75,
+0xc9,
+0x02,
+0x90,
+0x05,
+0x20,
+0x29,
+0x13,
+0x80,
+0x19,
+0xad,
+0xf6,
+0x3c,
+0x85,
+0x8b,
+0xad,
+0xf5,
+0x3c,
+0x45,
+0x7a,
+0x20,
+0x58,
+0x21,
+0x85,
+0x89,
+0xad,
+0xf4,
+0x3c,
+0x45,
+0x7b,
+0x20,
+0x58,
+0x21,
+0x85,
+0x8a,
+0x20,
+0x02,
+0x14,
+0x20,
+0x48,
+0x14,
+0xa5,
+0x78,
+0xaa,
+0x20,
+0x9f,
+0x14,
+0x85,
+0xbe,
+0x8a,
+0x20,
+0xb9,
+0x14,
+0x85,
+0xbf,
+0xa5,
+0x32,
+0x0a,
+0x45,
+0xbe,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xc9,
+0x1f,
+0x90,
+0x02,
+0xa9,
+0x1f,
+0x85,
+0x8c,
+0xa5,
+0x33,
+0x0a,
+0x45,
+0xbe,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xc9,
+0x1f,
+0x90,
+0x02,
+0xa9,
+0x1f,
+0x85,
+0x8d,
+0xa5,
+0x36,
+0x0a,
+0x45,
+0xbf,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xc9,
+0x3f,
+0x90,
+0x02,
+0xa9,
+0x3f,
+0xa8,
+0xb9,
+0x47,
+0x28,
+0xaa,
+0x29,
+0x0f,
+0x85,
+0x93,
+0x8a,
+0x4a,
+0x4a,
+0x4a,
+0x4a,
+0x85,
+0x92,
+0xa5,
+0x31,
+0x85,
+0x94,
+0xa5,
+0x69,
+0xf0,
+0x08,
+0x64,
+0x8e,
+0x64,
+0x8f,
+0xa9,
+0x3f,
+0x80,
+0x5f,
+0xa5,
+0x34,
+0x0a,
+0x45,
+0xbe,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xc9,
+0x1f,
+0x90,
+0x02,
+0xa9,
+0x1f,
+0x0a,
+0x45,
+0x76,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xc9,
+0x1f,
+0x90,
+0x02,
+0xa9,
+0x1f,
+0x85,
+0x8e,
+0xa5,
+0x35,
+0x0a,
+0x45,
+0xbe,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xc9,
+0x1f,
+0x90,
+0x02,
+0xa9,
+0x1f,
+0x0a,
+0x45,
+0x76,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xc9,
+0x1f,
+0x90,
+0x02,
+0xa9,
+0x1f,
+0x85,
+0x8f,
+0xa5,
+0x76,
+0x20,
+0xcc,
+0x14,
+0x85,
+0xc0,
+0xa5,
+0x36,
+0x0a,
+0x45,
+0xbf,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xc9,
+0x3f,
+0x90,
+0x02,
+0xa9,
+0x3f,
+0x0a,
+0x45,
+0xc0,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xc9,
+0x3f,
+0x90,
+0x02,
+0xa9,
+0x3f,
+0xa8,
+0xb9,
+0x47,
+0x28,
+0xaa,
+0x29,
+0x0f,
+0x85,
+0x91,
+0x8a,
+0x4a,
+0x4a,
+0x4a,
+0x4a,
+0x85,
+0x90,
+0xa5,
+0x6a,
+0xc9,
+0x02,
+0xb0,
+0x04,
+0xa2,
+0x00,
+0x80,
+0x02,
+0xa2,
+0x36,
+0x86,
+0xbd,
+0xbd,
+0x88,
+0x3f,
+0x85,
+0x96,
+0xa2,
+0x00,
+0x18,
+0x8a,
+0x65,
+0xbd,
+0xa8,
+0xa5,
+0x60,
+0xd9,
+0x8a,
+0x3f,
+0x90,
+0x11,
+0xd0,
+0x07,
+0xa5,
+0x5f,
+0xd9,
+0x89,
+0x3f,
+0x90,
+0x08,
+0xe8,
+0xe8,
+0xe0,
+0x08,
+0xf0,
+0x02,
+0x80,
+0xe3,
+0x8a,
+0x4a,
+0x49,
+0x09,
+0x18,
+0x65,
+0xbd,
+0xaa,
+0xbd,
+0x91,
+0x3f,
+0x85,
+0x97,
+0xbd,
+0x92,
+0x3f,
+0x85,
+0x98,
+0xbd,
+0x93,
+0x3f,
+0x85,
+0x99,
+0xbd,
+0x94,
+0x3f,
+0x85,
+0x9a,
+0xbd,
+0x98,
+0x3f,
+0x85,
+0x9e,
+0xbd,
+0x99,
+0x3f,
+0x85,
+0x9f,
+0xbd,
+0x95,
+0x3f,
+0x85,
+0x9b,
+0xbd,
+0x96,
+0x3f,
+0x85,
+0x9c,
+0xbd,
+0x97,
+0x3f,
+0x85,
+0x9d,
+0xa5,
+0x69,
+0xf0,
+0x04,
+0xa9,
+0x00,
+0x80,
+0x72,
+0xa5,
+0x76,
+0x30,
+0x0f,
+0x85,
+0xbd,
+0x38,
+0xa9,
+0x80,
+0xe5,
+0xbd,
+0x85,
+0xbd,
+0xa9,
+0x20,
+0x85,
+0xbe,
+0x80,
+0x06,
+0x29,
+0x7f,
+0x85,
+0xbd,
+0x64,
+0xbe,
+0x38,
+0xa5,
+0xbe,
+0xe5,
+0x9b,
+0x85,
+0xbf,
+0x3c,
+0x45,
+0xbd,
+0xaa,
+0xa5,
+0xbd,
+0x10,
+0x05,
+0x98,
+0x18,
+0x65,
+0xbf,
+0xa8,
+0x8a,
+0x0a,
+0x98,
+0x2a,
+0x18,
+0x65,
+0x9b,
+0x85,
+0x9b,
+0x38,
+0xa5,
+0xbe,
+0xe5,
+0x9c,
+0x85,
+0xbf,
+0x3c,
+0x45,
+0xbd,
+0xaa,
+0xa5,
+0xbd,
+0x10,
+0x05,
+0x98,
+0x18,
+0x65,
+0xbf,
+0xa8,
+0x8a,
+0x0a,
+0x98,
+0x2a,
+0x18,
+0x65,
+0x9c,
+0x85,
+0x9c,
+0x38,
+0xa5,
+0xbe,
+0xe5,
+0x9d,
+0x85,
+0xbf,
+0x3c,
+0x45,
+0xbd,
+0xaa,
+0xa5,
+0xbd,
+0x10,
+0x05,
+0x98,
+0x18,
+0x65,
+0xbf,
+0xa8,
+0x8a,
+0x0a,
+0x98,
+0x2a,
+0x18,
+0x65,
+0x9d,
+0x85,
+0x9d,
+0xa9,
+0x01,
+0x85,
+0x95,
+0xa5,
+0x7a,
+0x85,
+0xbd,
+0x4a,
+0x85,
+0xc1,
+0xa9,
+0x08,
+0x85,
+0xc2,
+0x20,
+0xc4,
+0x20,
+0xa5,
+0xc2,
+0xd0,
+0x04,
+0xa5,
+0xc1,
+0x80,
+0x02,
+0xa9,
+0xff,
+0x85,
+0xa5,
+0xa5,
+0x7b,
+0x85,
+0xbd,
+0x4a,
+0x85,
+0xc1,
+0xa9,
+0x08,
+0x85,
+0xc2,
+0x20,
+0xc4,
+0x20,
+0xa5,
+0xc2,
+0xd0,
+0x04,
+0xa5,
+0xc1,
+0x80,
+0x02,
+0xa9,
+0xff,
+0x85,
+0xa4,
+0xa5,
+0x7a,
+0x85,
+0xbd,
+0x4a,
+0x18,
+0x69,
+0xf0,
+0x85,
+0xc1,
+0xa9,
+0x00,
+0x69,
+0x3d,
+0x85,
+0xc2,
+0x20,
+0xc4,
+0x20,
+0xa5,
+0xc2,
+0xc9,
+0x03,
+0x90,
+0x10,
+0xd0,
+0x06,
+0xa5,
+0xc1,
+0xc9,
+0xdf,
+0x90,
+0x08,
+0xa9,
+0xdf,
+0x85,
+0xc1,
+0xa9,
+0x03,
+0x85,
+0xc2,
+0x18,
+0xa9,
+0x20,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0x90,
+0x02,
+0xe6,
+0xc2,
+0x46,
+0xc2,
+0x66,
+0xc1,
+0x46,
+0xc2,
+0xa5,
+0xc1,
+0x6a,
+0x85,
+0xa2,
+0xa5,
+0x7b,
+0x85,
+0xbd,
+0x4a,
+0x18,
+0x69,
+0xf0,
+0x85,
+0xc1,
+0xa9,
+0x00,
+0x69,
+0x3d,
+0x85,
+0xc2,
+0x20,
+0xc4,
+0x20,
+0xa5,
+0xc2,
+0xc9,
+0x03,
+0x90,
+0x10,
+0xd0,
+0x06,
+0xa5,
+0xc1,
+0xc9,
+0xdf,
+0x90,
+0x08,
+0xa9,
+0xdf,
+0x85,
+0xc1,
+0xa9,
+0x03,
+0x85,
+0xc2,
+0x18,
+0xa9,
+0x20,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0x90,
+0x02,
+0xe6,
+0xc2,
+0x46,
+0xc2,
+0x66,
+0xc1,
+0x46,
+0xc2,
+0xa5,
+0xc1,
+0x6a,
+0x85,
+0xa0,
+0x64,
+0xa3,
+0x64,
+0xbd,
+0xa5,
+0x7a,
+0xc9,
+0x10,
+0xb0,
+0x06,
+0x85,
+0xbd,
+0xa9,
+0x01,
+0x85,
+0xa3,
+0xa5,
+0x7b,
+0xc9,
+0x10,
+0xb0,
+0x10,
+0xa5,
+0xa3,
+0x09,
+0x02,
+0x85,
+0xa3,
+0xa5,
+0x7b,
+0xc5,
+0xbd,
+0x90,
+0x08,
+0x85,
+0xbd,
+0x80,
+0x04,
+0xa5,
+0xa3,
+0xf0,
+0x45,
+0xa5,
+0xbd,
+0x49,
+0xdf,
+0x85,
+0xc1,
+0x84,
+0xc2,
+0xa5,
+0xbd,
+0x49,
+0x03,
+0x18,
+0x65,
+0xc2,
+0x85,
+0xc2,
+0x18,
+0xa9,
+0x08,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0x90,
+0x02,
+0xe6,
+0xc2,
+0xa5,
+0xc1,
+0x49,
+0x10,
+0x84,
+0xc1,
+0xa5,
+0xc2,
+0x49,
+0x10,
+0x18,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0x84,
+0xc2,
+0x18,
+0xa9,
+0x20,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0x90,
+0x02,
+0xe6,
+0xc2,
+0x46,
+0xc2,
+0x66,
+0xc1,
+0x46,
+0xc2,
+0xa5,
+0xc1,
+0x6a,
+0x85,
+0xa1,
+0x80,
+0x02,
+0x64,
+0xa1,
+0xa5,
+0x74,
+0x49,
+0x03,
+0xaa,
+0xbd,
+0x58,
+0x3f,
+0x85,
+0xa8,
+0xbd,
+0x59,
+0x3f,
+0x85,
+0xa7,
+0xbd,
+0x5a,
+0x3f,
+0x85,
+0xa6,
+0xa5,
+0x75,
+0x49,
+0x03,
+0xa8,
+0xb9,
+0x64,
+0x3f,
+0x85,
+0xab,
+0xb9,
+0x65,
+0x3f,
+0x85,
+0xaa,
+0xb9,
+0x66,
+0x3f,
+0x85,
+0xa9,
+0xa5,
+0x69,
+0xf0,
+0x06,
+0x64,
+0xac,
+0x64,
+0xad,
+0x80,
+0x5a,
+0x20,
+0x17,
+0x15,
+0xa5,
+0x76,
+0x30,
+0x0f,
+0x85,
+0xbd,
+0x38,
+0xa9,
+0x80,
+0xe5,
+0xbd,
+0x85,
+0xbd,
+0x64,
+0xbe,
+0x64,
+0xbf,
+0x80,
+0x0a,
+0x29,
+0x7f,
+0x85,
+0xbd,
+0x64,
+0xbe,
+0xa9,
+0x39,
+0x85,
+0xbf,
+0x38,
+0xa5,
+0xbe,
+0xe5,
+0xac,
+0x85,
+0xbe,
+0x3c,
+0x45,
+0xbd,
+0xaa,
+0xa5,
+0xbd,
+0x10,
+0x05,
+0x98,
+0x18,
+0x65,
+0xbe,
+0xa8,
+0x8a,
+0x0a,
+0x98,
+0x2a,
+0x18,
+0x65,
+0xac,
+0x85,
+0xac,
+0x38,
+0xa5,
+0xbf,
+0xe5,
+0xad,
+0x85,
+0xbf,
+0x3c,
+0x45,
+0xbd,
+0xaa,
+0xa5,
+0xbd,
+0x10,
+0x05,
+0x98,
+0x18,
+0x65,
+0xbf,
+0xa8,
+0x8a,
+0x0a,
+0x98,
+0x2a,
+0x18,
+0x65,
+0xad,
+0x85,
+0xad,
+0xa5,
+0x67,
+0xf0,
+0x0c,
+0xa0,
+0x92,
+0x9c,
+0x0c,
+0x2a,
+0x13,
+0x0c,
+0x2a,
+0x0d,
+0x2a,
+0x80,
+0x3d,
+0xa5,
+0x6b,
+0xc9,
+0x02,
+0xb0,
+0x04,
+0xa9,
+0x00,
+0x80,
+0x02,
+0xa9,
+0xf0,
+0x85,
+0xcb,
+0xad,
+0x77,
+0x3d,
+0x1a,
+0x49,
+0x15,
+0x85,
+0xbf,
+0xa5,
+0x75,
+0x20,
+0xe2,
+0x15,
+0xa9,
+0x0c,
+0x85,
+0xc3,
+0xa9,
+0x2a,
+0x85,
+0xc4,
+0xa9,
+0x00,
+0x20,
+0x1a,
+0x16,
+0xa5,
+0x74,
+0x20,
+0xfd,
+0x15,
+0xa9,
+0x18,
+0x85,
+0xc3,
+0xa9,
+0x2a,
+0x85,
+0xc4,
+0xa9,
+0x01,
+0x20,
+0x1a,
+0x16,
+0x20,
+0xfa,
+0x16,
+0xad,
+0x53,
+0x3c,
+0x85,
+0xb1,
+0x85,
+0xbf,
+0xa5,
+0xb7,
+0x29,
+0xf0,
+0xf0,
+0x08,
+0x64,
+0xb0,
+0x64,
+0xb2,
+0xa5,
+0xb8,
+0x80,
+0x12,
+0xa5,
+0xbf,
+0xa6,
+0x7a,
+0x20,
+0x1f,
+0x17,
+0x85,
+0xb0,
+0xa5,
+0xbf,
+0xa6,
+0x7b,
+0x20,
+0x1f,
+0x17,
+0x85,
+0xb2,
+0x20,
+0x53,
+0x17,
+0xa4,
+0x6b,
+0xb9,
+0x59,
+0x3c,
+0x85,
+0xb5,
+0xa5,
+0x6d,
+0xc9,
+0x00,
+0xf0,
+0x04,
+0xa5,
+0x6c,
+0xd0,
+0x04,
+0xa9,
+0x02,
+0x85,
+0x71,
+0xa9,
+0x00,
+0x60,
+0xad,
+0xb8,
+0x2c,
+0x29,
+0xfc,
+0xf0,
+0x03,
+0xa9,
+0x1f,
+0x60,
+0xae,
+0xd1,
+0x2c,
+0xad,
+0xd0,
+0x2c,
+0x20,
+0x75,
+0x0c,
+0xf0,
+0x03,
+0xa9,
+0x24,
+0x60,
+0xae,
+0xd3,
+0x2c,
+0xad,
+0xd2,
+0x2c,
+0x20,
+0x75,
+0x0c,
+0xf0,
+0x03,
+0xa9,
+0x25,
+0x60,
+0xae,
+0xd5,
+0x2c,
+0xad,
+0xd4,
+0x2c,
+0x20,
+0x75,
+0x0c,
+0xf0,
+0x03,
+0xa9,
+0x26,
+0x60,
+0xae,
+0xcb,
+0x2c,
+0xad,
+0xca,
+0x2c,
+0x20,
+0x95,
+0x0c,
+0xf0,
+0x03,
+0xa9,
+0x21,
+0x60,
+0xae,
+0xcd,
+0x2c,
+0xad,
+0xcc,
+0x2c,
+0x20,
+0x95,
+0x0c,
+0xf0,
+0x03,
+0xa9,
+0x22,
+0x60,
+0xae,
+0xcf,
+0x2c,
+0xad,
+0xce,
+0x2c,
+0x20,
+0x95,
+0x0c,
+0xf0,
+0x03,
+0xa9,
+0x23,
+0x60,
+0xae,
+0xe0,
+0x2c,
+0xa9,
+0x08,
+0x20,
+0x66,
+0x0c,
+0xf0,
+0x03,
+0xa9,
+0x27,
+0x60,
+0xad,
+0xda,
+0x2c,
+0xc9,
+0x10,
+0xb0,
+0x03,
+0xa9,
+0x28,
+0x60,
+0xad,
+0xdb,
+0x2c,
+0xc9,
+0x10,
+0xb0,
+0x03,
+0xa9,
+0x29,
+0x60,
+0xad,
+0xe1,
+0x2c,
+0xc9,
+0x06,
+0x90,
+0x03,
+0xa9,
+0x2b,
+0x60,
+0xf0,
+0x54,
+0x49,
+0x04,
+0x85,
+0xbd,
+0xa2,
+0x00,
+0xbd,
+0xe2,
+0x2c,
+0xcd,
+0x0c,
+0x3c,
+0x90,
+0x03,
+0xa9,
+0x2c,
+0x60,
+0xbd,
+0xe3,
+0x2c,
+0xcd,
+0x0d,
+0x3c,
+0x90,
+0x03,
+0xa9,
+0x2d,
+0x60,
+0xbd,
+0xe4,
+0x2c,
+0xcd,
+0x0c,
+0x3c,
+0x90,
+0x03,
+0xa9,
+0x2e,
+0x60,
+0xbd,
+0xe5,
+0x2c,
+0xcd,
+0x0d,
+0x3c,
+0x90,
+0x03,
+0xa9,
+0x2f,
+0x60,
+0xbd,
+0xe4,
+0x2c,
+0xdd,
+0xe2,
+0x2c,
+0xb0,
+0x03,
+0xa9,
+0x30,
+0x60,
+0xbd,
+0xe5,
+0x2c,
+0xdd,
+0xe3,
+0x2c,
+0xb0,
+0x03,
+0xa9,
+0x31,
+0x60,
+0x18,
+0x8a,
+0x69,
+0x04,
+0xc5,
+0xbd,
+0xb0,
+0x04,
+0xaa,
+0x4c,
+0xff,
+0x0b,
+0xa9,
+0x00,
+0x60,
+0xc9,
+0x01,
+0xf0,
+0x0f,
+0xc9,
+0x03,
+0xf0,
+0x0b,
+0xc9,
+0x05,
+0xf0,
+0x07,
+0xc9,
+0x07,
+0xf0,
+0x03,
+0xa9,
+0x01,
+0x60,
+0xa9,
+0x00,
+0x60,
+0x86,
+0xbd,
+0xc5,
+0xbd,
+0xf0,
+0x06,
+0x4a,
+0xd0,
+0xf9,
+0xa9,
+0x01,
+0x60,
+0xa9,
+0x00,
+0x60,
+0xec,
+0xda,
+0x3b,
+0x90,
+0x09,
+0xd0,
+0x13,
+0xcd,
+0xd9,
+0x3b,
+0xf0,
+0x02,
+0xb0,
+0x0c,
+0xec,
+0xd8,
+0x3b,
+0x90,
+0x07,
+0xd0,
+0x08,
+0xcd,
+0xd7,
+0x3b,
+0xb0,
+0x03,
+0xa9,
+0x01,
+0x60,
+0xa9,
+0x00,
+0x60,
+0xec,
+0xe2,
+0x3b,
+0x90,
+0x09,
+0xd0,
+0x13,
+0xcd,
+0xe1,
+0x3b,
+0xf0,
+0x02,
+0xb0,
+0x0c,
+0xec,
+0xe0,
+0x3b,
+0x90,
+0x07,
+0xd0,
+0x08,
+0xcd,
+0xdf,
+0x3b,
+0xb0,
+0x03,
+0xa9,
+0x01,
+0x60,
+0xa9,
+0x00,
+0x60,
+0xa0,
+0x00,
+0x18,
+0xb9,
+0x94,
+0x3c,
+0x79,
+0x96,
+0x3c,
+0x85,
+0xc3,
+0xb9,
+0x95,
+0x3c,
+0x79,
+0x97,
+0x3c,
+0x6a,
+0x85,
+0xc4,
+0x66,
+0xc3,
+0xa5,
+0xc2,
+0xc5,
+0xc4,
+0x90,
+0x10,
+0xd0,
+0x06,
+0xa5,
+0xc1,
+0xc5,
+0xc3,
+0x90,
+0x08,
+0xc8,
+0xc8,
+0xc0,
+0x06,
+0xf0,
+0x02,
+0x80,
+0xd6,
+0x98,
+0x4a,
+0x60,
+0xc9,
+0x00,
+0xf0,
+0x1d,
+0xc9,
+0x01,
+0xf0,
+0x12,
+0xc9,
+0x02,
+0xf0,
+0x07,
+0xad,
+0x9a,
+0x3c,
+0xae,
+0x9b,
+0x3c,
+0x60,
+0xad,
+0x98,
+0x3c,
+0xae,
+0x99,
+0x3c,
+0x60,
+0xad,
+0x96,
+0x3c,
+0xae,
+0x97,
+0x3c,
+0x60,
+0xad,
+0x94,
+0x3c,
+0xae,
+0x95,
+0x3c,
+0x60,
+0x64,
+0x63,
+0x64,
+0x64,
+0xad,
+0x0c,
+0x3c,
+0x85,
+0x65,
+0xad,
+0x0d,
+0x3c,
+0x85,
+0x66,
+0xa9,
+0x01,
+0x85,
+0x6c,
+0x85,
+0x6f,
+0x85,
+0x70,
+0x38,
+0xad,
+0xbd,
+0x2c,
+0xed,
+0xe3,
+0x3b,
+0xad,
+0xbe,
+0x2c,
+0xed,
+0xe4,
+0x3b,
+0x90,
+0x03,
+0xa9,
+0x0b,
+0x60,
+0xad,
+0xc4,
+0x2c,
+0xd0,
+0x10,
+0xad,
+0xc3,
+0x2c,
+0xaa,
+0x4a,
+0xb0,
+0x03,
+0xa9,
+0x15,
+0x60,
+0x8a,
+0x20,
+0x50,
+0x0c,
+0xf0,
+0x03,
+0xa9,
+0x13,
+0x60,
+0x8a,
+0x1a,
+0x4a,
+0x85,
+0x17,
+0x38,
+0xad,
+0xbd,
+0x2c,
+0x6a,
+0xb0,
+0x03,
+0xa9,
+0x0f,
+0x60,
+0x2a,
+0xed,
+0xb9,
+0x2c,
+0xa8,
+0x6a,
+0xb0,
+0x03,
+0xa9,
+0x0d,
+0x60,
+0x2a,
+0xad,
+0xbe,
+0x2c,
+0xed,
+0xba,
+0x2c,
+0xb0,
+0x03,
+0xa9,
+0x11,
+0x60,
+0xc8,
+0xd0,
+0x01,
+0x1a,
+0x84,
+0x19,
+0x85,
+0x1a,
+0xa5,
+0x19,
+0xa6,
+0x1a,
+0xa4,
+0x17,
+0x20,
+0xe4,
+0x0f,
+0x48,
+0xda,
+0x1a,
+0xd0,
+0x01,
+0xe8,
+0x29,
+0xfe,
+0x85,
+0x63,
+0x86,
+0x64,
+0xa8,
+0x8a,
+0x4a,
+0xaa,
+0x98,
+0x6a,
+0xd0,
+0x01,
+0xca,
+0x3a,
+0x85,
+0x57,
+0x86,
+0x58,
+0x68,
+0x4a,
+0x85,
+0xc2,
+0x68,
+0x6a,
+0x85,
+0xc1,
+0xad,
+0x0c,
+0x3c,
+0x85,
+0xbd,
+0x20,
+0xc4,
+0x20,
+0xa5,
+0xc1,
+0xc9,
+0x14,
+0xb0,
+0x08,
+0x46,
+0x65,
+0x06,
+0x6f,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0xa5,
+0xc2,
+0xd0,
+0x09,
+0xa5,
+0xc1,
+0xcd,
+0xa0,
+0x3c,
+0xb0,
+0x02,
+0x64,
+0x6c,
+0xa5,
+0xc1,
+0x85,
+0xc5,
+0xad,
+0xb7,
+0x2c,
+0xaa,
+0xc9,
+0x03,
+0xd0,
+0x03,
+0xa9,
+0x07,
+0x60,
+0x8a,
+0x29,
+0xe0,
+0xd0,
+0xf8,
+0x8a,
+0x29,
+0x04,
+0xf0,
+0x02,
+0x64,
+0x6c,
+0x38,
+0xad,
+0xbf,
+0x2c,
+0xed,
+0xe5,
+0x3b,
+0xad,
+0xc0,
+0x2c,
+0xed,
+0xe6,
+0x3b,
+0x90,
+0x03,
+0xa9,
+0x0c,
+0x60,
+0xad,
+0xc8,
+0x2c,
+0xd0,
+0x10,
+0xad,
+0xc7,
+0x2c,
+0xaa,
+0x4a,
+0xb0,
+0x03,
+0xa9,
+0x16,
+0x60,
+0x8a,
+0x20,
+0x50,
+0x0c,
+0xf0,
+0x03,
+0xa9,
+0x14,
+0x60,
+0x8a,
+0x1a,
+0x4a,
+0x85,
+0x18,
+0x64,
+0xb4,
+0x05,
+0x17,
+0x4a,
+0xf0,
+0x02,
+0xe6,
+0xb4,
+0xad,
+0xbf,
+0x2c,
+0x4a,
+0xb0,
+0x03,
+0xa9,
+0x10,
+0x60,
+0x2a,
+0x38,
+0xed,
+0xbb,
+0x2c,
+0xa8,
+0x6a,
+0xb0,
+0x03,
+0xa9,
+0x0e,
+0x60,
+0x2a,
+0xad,
+0xc0,
+0x2c,
+0xed,
+0xbc,
+0x2c,
+0xb0,
+0x03,
+0xa9,
+0x12,
+0x60,
+0xc8,
+0xd0,
+0x01,
+0x1a,
+0x84,
+0x1b,
+0x85,
+0x1c,
+0xa5,
+0x1b,
+0xa6,
+0x1c,
+0xa4,
+0x18,
+0x20,
+0xe4,
+0x0f,
+0x48,
+0xda,
+0x1a,
+0xd0,
+0x01,
+0xe8,
+0xa8,
+0x8a,
+0x4a,
+0xaa,
+0x98,
+0x6a,
+0xd0,
+0x01,
+0xca,
+0x3a,
+0x85,
+0x59,
+0x86,
+0x5a,
+0x68,
+0x4a,
+0x85,
+0xc2,
+0x68,
+0x6a,
+0x85,
+0xc1,
+0xad,
+0x0d,
+0x3c,
+0x85,
+0xbd,
+0x20,
+0xc4,
+0x20,
+0xa5,
+0xc1,
+0xc9,
+0x14,
+0xb0,
+0x08,
+0x46,
+0x66,
+0x06,
+0x70,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0xa5,
+0xc2,
+0xd0,
+0x09,
+0xa5,
+0xc1,
+0xcd,
+0xa1,
+0x3c,
+0xb0,
+0x02,
+0x64,
+0x6c,
+0xa2,
+0x00,
+0xa5,
+0x64,
+0xcd,
+0xa8,
+0x02,
+0xd0,
+0x09,
+0xa5,
+0x63,
+0xcd,
+0xa7,
+0x02,
+0xd0,
+0x02,
+0x80,
+0x01,
+0xe8,
+0x86,
+0x6e,
+0xa5,
+0x18,
+0xc5,
+0x17,
+0xb0,
+0x02,
+0xa5,
+0x17,
+0x85,
+0x6b,
+0xc9,
+0x03,
+0x90,
+0x0c,
+0xa2,
+0x01,
+0x86,
+0x67,
+0xc9,
+0x05,
+0x90,
+0x04,
+0x86,
+0x68,
+0x86,
+0x69,
+0xad,
+0x9f,
+0x3c,
+0xc5,
+0x6b,
+0xb0,
+0x02,
+0x64,
+0x6c,
+0xa2,
+0x01,
+0xad,
+0xc9,
+0x2c,
+0xf0,
+0x21,
+0xa8,
+0x4a,
+0x4a,
+0x4a,
+0x4a,
+0xaa,
+0xa9,
+0x04,
+0x20,
+0x66,
+0x0c,
+0xd0,
+0x0c,
+0x98,
+0x29,
+0x0f,
+0xdc,
+0xaa,
+0xa9,
+0x04,
+0x20,
+0x66,
+0x0c,
+0xf0,
+0x03,
+0xa9,
+0x1e,
+0x60,
+0xc4,
+0xbd,
+0xb0,
+0x01,
+0xfc,
+0x86,
+0x6a,
+0x64,
+0x71,
+0x64,
+0x5b,
+0x64,
+0x5c,
+0x64,
+0x5d,
+0x64,
+0x5e,
+0xad,
+0xb8,
+0x2c,
+0x85,
+0x79,
+0xd8,
+0x4d,
+0x0e,
+0x3c,
+0xf8,
+0x85,
+0x72,
+0x85,
+0xb3,
+0xad,
+0xb8,
+0x2c,
+0x29,
+0x01,
+0xd0,
+0x0a,
+0x64,
+0x1f,
+0x64,
+0x20,
+0xa9,
+0x01,
+0x85,
+0x22,
+0x80,
+0x0b,
+0xa5,
+0x65,
+0x3a,
+0x85,
+0x1f,
+0x85,
+0x20,
+0xa9,
+0xff,
+0x85,
+0x22,
+0xa0,
+0x02,
+0x53,
+0x19,
+0x00,
+0x23,
+0x00,
+0x53,
+0xb9,
+0x2c,
+0x25,
+0x00,
+0xa9,
+0xef,
+0x85,
+0xcf,
+0xa9,
+0x3b,
+0x85,
+0xd0,
+0xa9,
+0xe7,
+0x85,
+0xd1,
+0xa9,
+0x3b,
+0x85,
+0xd2,
+0xa9,
+0xcb,
+0x85,
+0xcd,
+0xa9,
+0x2b,
+0x85,
+0xce,
+0xa9,
+0x93,
+0x85,
+0x1d,
+0xa9,
+0x2b,
+0x85,
+0x1e,
+0xa5,
+0x65,
+0x85,
+0x27,
+0xa5,
+0x17,
+0x85,
+0x29,
+0x20,
+0x41,
+0x10,
+0x20,
+0x6e,
+0x0b,
+0xf0,
+0x01,
+0x60,
+0xad,
+0xe1,
+0x2c,
+0x85,
+0xb6,
+0xf0,
+0x12,
+0xa5,
+0x6f,
+0x3a,
+0x85,
+0x28,
+0xa9,
+0xe7,
+0x85,
+0xd1,
+0xa9,
+0x2b,
+0x85,
+0xd2,
+0xa9,
+0x00,
+0x20,
+0xe4,
+0x11,
+0xad,
+0xb8,
+0x2c,
+0x29,
+0x02,
+0xd0,
+0x0a,
+0x64,
+0x1f,
+0x64,
+0x20,
+0xa9,
+0x01,
+0x85,
+0x22,
+0x80,
+0x0b,
+0xa5,
+0x66,
+0x3a,
+0x85,
+0x1f,
+0x85,
+0x20,
+0xa9,
+0xff,
+0x85,
+0x22,
+0xa0,
+0x02,
+0x53,
+0x1b,
+0x00,
+0x23,
+0x00,
+0x53,
+0xbb,
+0x2c,
+0x25,
+0x00,
+0xa9,
+0xff,
+0x85,
+0xcf,
+0xa9,
+0x3b,
+0x85,
+0xd0,
+0xa9,
+0xeb,
+0x85,
+0xd1,
+0xa9,
+0x3b,
+0x85,
+0xd2,
+0xa9,
+0xdb,
+0x85,
+0xcd,
+0xa9,
+0x2b,
+0x85,
+0xce,
+0xa9,
+0xb3,
+0x85,
+0x1d,
+0xa9,
+0x2b,
+0x85,
+0x1e,
+0xa5,
+0x66,
+0x85,
+0x27,
+0xa5,
+0x18,
+0x85,
+0x29,
+0x20,
+0x41,
+0x10,
+0xa5,
+0xb6,
+0xf0,
+0x12,
+0xa5,
+0x70,
+0x3a,
+0x85,
+0x28,
+0xa9,
+0xf7,
+0x85,
+0xd1,
+0xa9,
+0x2b,
+0x85,
+0xd2,
+0xa9,
+0x01,
+0x20,
+0xe4,
+0x11,
+0xa9,
+0x00,
+0x60,
+0x88,
+0x84,
+0xbd,
+0xc8,
+0x18,
+0x65,
+0xbd,
+0x90,
+0x01,
+0xe8,
+0x20,
+0xf2,
+0x0f,
+0x60,
+0xc0,
+0x01,
+0xd0,
+0x01,
+0x60,
+0x85,
+0xbd,
+0x98,
+0xc9,
+0x01,
+0xf0,
+0x0e,
+0x29,
+0x01,
+0xd0,
+0x0d,
+0x8a,
+0x4a,
+0xaa,
+0x66,
+0xbd,
+0x98,
+0x4a,
+0xa8,
+0x80,
+0xee,
+0xa5,
+0xbd,
+0x60,
+0xa5,
+0xbd,
+0x1a,
+0xd0,
+0x01,
+0xe8,
+0x49,
+0x55,
+0x84,
+0xbf,
+0x18,
+0x65,
+0xbf,
+0x85,
+0xbe,
+0x90,
+0x03,
+0xe6,
+0xbf,
+0x18,
+0x8a,
+0x49,
+0x55,
+0x84,
+0xc0,
+0xaa,
+0x65,
+0xbe,
+0x8a,
+0x65,
+0xbf,
+0x85,
+0xbf,
+0xa5,
+0xc0,
+0x90,
+0x03,
+0xe6,
+0xc0,
+0x18,
+0x65,
+0xbf,
+0xa8,
+0xa5,
+0xc0,
+0x69,
+0x00,
+0xaa,
+0x98,
+0x60,
+0xa5,
+0x27,
+0x85,
+0xbd,
+0x3a,
+0x4a,
+0x85,
+0xc0,
+0x38,
+0xe5,
+0x27,
+0x85,
+0xc0,
+0xa0,
+0x02,
+0x53,
+0x23,
+0x00,
+0xc1,
+0x00,
+0x46,
+0xc2,
+0x66,
+0xc1,
+0x20,
+0xc4,
+0x20,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0x18,
+0xa9,
+0x02,
+0x65,
+0xc1,
+0x85,
+0xc5,
+0xa9,
+0x00,
+0x65,
+0xc2,
+0x85,
+0xc6,
+0xa0,
+0x02,
+0x53,
+0xc1,
+0x00,
+0xaf,
+0x2a,
+0x53,
+0xc5,
+0x00,
+0xb1,
+0x2a,
+0xa5,
+0x27,
+0x1a,
+0x4a,
+0x3a,
+0x85,
+0xbf,
+0xa2,
+0x00,
+0xda,
+0xe4,
+0xbf,
+0xd0,
+0x02,
+0xe6,
+0xc0,
+0x18,
+0xa5,
+0xc0,
+0x65,
+0xc3,
+0x85,
+0xc0,
+0x30,
+0x09,
+0x38,
+0xe5,
+0x27,
+0x85,
+0xc0,
+0xa9,
+0x02,
+0x80,
+0x02,
+0xa9,
+0x00,
+0xfa,
+0x9d,
+0x9f,
+0x2a,
+0xe8,
+0xe4,
+0x27,
+0xf0,
+0x03,
+0xda,
+0x80,
+0xda,
+0xa5,
+0x29,
+0x85,
+0xbd,
+0x46,
+0xc2,
+0x66,
+0xc1,
+0x20,
+0xc4,
+0x20,
+0xa0,
+0x02,
+0x53,
+0xc1,
+0x00,
+0xc9,
+0x00,
+0xa5,
+0x29,
+0x85,
+0xbd,
+0x45,
+0xc9,
+0x85,
+0xcb,
+0xfc,
+0xa5,
+0xbd,
+0x45,
+0xca,
+0x85,
+0xcc,
+0x8a,
+0x18,
+0x65,
+0xcc,
+0x85,
+0xcc,
+0x38,
+0xa5,
+0xc9,
+0xe9,
+0x01,
+0x85,
+0xc9,
+0xa5,
+0xca,
+0xe9,
+0x00,
+0x85,
+0xca,
+0xe6,
+0xbf,
+0x64,
+0xc3,
+0x64,
+0xc4,
+0x64,
+0xc1,
+0x64,
+0xc2,
+0x64,
+0xc5,
+0x64,
+0xc6,
+0x64,
+0xc0,
+0xa2,
+0x00,
+0x86,
+0xbe,
+0xbd,
+0x9f,
+0x2a,
+0xaa,
+0xe8,
+0xbd,
+0xaf,
+0x2a,
+0x4a,
+0x85,
+0xc8,
+0xca,
+0xbd,
+0xaf,
+0x2a,
+0x6a,
+0x85,
+0xc7,
+0x18,
+0xa5,
+0xc3,
+0x65,
+0xcb,
+0x85,
+0xc3,
+0xa5,
+0xc4,
+0x65,
+0xcc,
+0x85,
+0xc4,
+0x38,
+0xa5,
+0xc3,
+0xe5,
+0xc7,
+0x85,
+0xc3,
+0xa5,
+0xc4,
+0xe5,
+0xc8,
+0x85,
+0xc4,
+0x18,
+0x10,
+0x0d,
+0xa5,
+0x29,
+0x65,
+0xc3,
+0x85,
+0xc3,
+0xa9,
+0x00,
+0x65,
+0xc4,
+0x85,
+0xc4,
+0x38,
+0xa5,
+0xc9,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0xa5,
+0xca,
+0x65,
+0xc2,
+0x85,
+0xc2,
+0xa5,
+0xc1,
+0x0a,
+0x09,
+0x01,
+0x92,
+0x1d,
+0xa5,
+0xc2,
+0x2a,
+0xa0,
+0x01,
+0x91,
+0x1d,
+0x18,
+0xa5,
+0x1d,
+0x69,
+0x02,
+0x85,
+0x1d,
+0xa5,
+0x1e,
+0x69,
+0x00,
+0x85,
+0x1e,
+0xe6,
+0xc1,
+0xd0,
+0x02,
+0xe6,
+0xc2,
+0xa6,
+0xbe,
+0xbd,
+0x9f,
+0x2a,
+0xaa,
+0xbd,
+0xaf,
+0x2a,
+0x85,
+0xc7,
+0xe8,
+0xbd,
+0xaf,
+0x2a,
+0x85,
+0xc8,
+0xa5,
+0xbe,
+0xc5,
+0xbf,
+0xb0,
+0x0d,
+0x38,
+0xa5,
+0xc7,
+0xe9,
+0x01,
+0x85,
+0xc7,
+0xa5,
+0xc8,
+0xe9,
+0x00,
+0x85,
+0xc8,
+0x46,
+0xc8,
+0x66,
+0xc7,
+0x18,
+0xa5,
+0x25,
+0x65,
+0xc7,
+0x85,
+0xc7,
+0xa5,
+0x26,
+0x65,
+0xc8,
+0x85,
+0xc8,
+0xa6,
+0xbe,
+0xbd,
+0x9f,
+0x2a,
+0xaa,
+0x18,
+0xbd,
+0xaf,
+0x2a,
+0x65,
+0x25,
+0x85,
+0x25,
+0xe8,
+0xbd,
+0xaf,
+0x2a,
+0x65,
+0x26,
+0x85,
+0x26,
+0xa5,
+0xc8,
+0xc5,
+0xc6,
+0x90,
+0x1f,
+0xd0,
+0x06,
+0xa5,
+0xc7,
+0xc5,
+0xc5,
+0x90,
+0x17,
+0xa4,
+0xc0,
+0xb1,
+0xcf,
+0xa8,
+0xb1,
+0xd1,
+0x18,
+0x65,
+0xc5,
+0x85,
+0xc5,
+0xc8,
+0xb1,
+0xd1,
+0x65,
+0xc6,
+0x85,
+0xc6,
+0xe6,
+0xc0,
+0x80,
+0xdb,
+0xa5,
+0xc0,
+0x3a,
+0xa4,
+0x1f,
+0x91,
+0xcd,
+0x18,
+0x98,
+0x65,
+0x22,
+0x85,
+0x1f,
+0xa6,
+0xbe,
+0xe8,
+0xe4,
+0x27,
+0xb0,
+0x05,
+0x86,
+0xbe,
+0x4c,
+0xf1,
+0x10,
+0x60,
+0xaa,
+0x64,
+0xbd,
+0xa9,
+0x01,
+0x85,
+0xbe,
+0x64,
+0xbf,
+0xa4,
+0x20,
+0xbd,
+0xe2,
+0x2c,
+0x85,
+0xc0,
+0xbd,
+0xe4,
+0x2c,
+0x85,
+0xc1,
+0xa5,
+0x28,
+0xf0,
+0x04,
+0x46,
+0xc0,
+0x46,
+0xc1,
+0xa5,
+0xbd,
+0xd0,
+0x02,
+0x91,
+0xd1,
+0xa5,
+0xbf,
+0xc5,
+0xc0,
+0x90,
+0x0c,
+0xc5,
+0xc1,
+0xf0,
+0x02,
+0xb0,
+0x06,
+0xb1,
+0xd1,
+0x05,
+0xbe,
+0x91,
+0xd1,
+0xa5,
+0xbf,
+0x1a,
+0xc5,
+0x27,
+0xb0,
+0x09,
+0x85,
+0xbf,
+0x18,
+0x98,
+0x65,
+0x22,
+0xa8,
+0x80,
+0xd8,
+0xa5,
+0xbd,
+0x1a,
+0xcd,
+0xe1,
+0x2c,
+0xb0,
+0x0b,
+0x85,
+0xbd,
+0x8a,
+0x18,
+0x69,
+0x04,
+0xaa,
+0x06,
+0xbe,
+0x80,
+0xaf,
+0x60,
+0xad,
+0xcf,
+0x3b,
+0x0d,
+0xd0,
+0x3b,
+0xf0,
+0x2d,
+0xa0,
+0x02,
+0x53,
+0xcf,
+0x3b,
+0xc3,
+0x00,
+0x20,
+0x43,
+0x21,
+0xa0,
+0x02,
+0x53,
+0xd1,
+0x3b,
+0xc1,
+0x00,
+0x20,
+0xe8,
+0x20,
+0xa0,
+0x02,
+0x53,
+0xd5,
+0x3b,
+0xc9,
+0x00,
+0xa5,
+0xca,
+0x10,
+0x08,
+0xa2,
+0xff,
+0x86,
+0xcb,
+0x86,
+0xcc,
+0x80,
+0x38,
+0x64,
+0xcb,
+0x64,
+0xcc,
+0x80,
+0x32,
+0xa0,
+0x02,
+0x53,
+0xd3,
+0x3b,
+0xc3,
+0x00,
+0x20,
+0x43,
+0x21,
+0xa0,
+0x02,
+0x53,
+0xd5,
+0x3b,
+0xc1,
+0x00,
+0x20,
+0xe8,
+0x20,
+0xa0,
+0x04,
+0x53,
+0xc5,
+0x00,
+0xc9,
+0x00,
+0xa0,
+0x02,
+0x53,
+0xd1,
+0x3b,
+0xc5,
+0x00,
+0xa5,
+0xc6,
+0x10,
+0x08,
+0xa2,
+0xff,
+0x86,
+0xc7,
+0x86,
+0xc8,
+0x80,
+0x04,
+0x64,
+0xc7,
+0x64,
+0xc8,
+0xd8,
+0xa5,
+0xc8,
+0x45,
+0xcc,
+0xf8,
+0x10,
+0x03,
+0xa9,
+0x20,
+0x60,
+0xa5,
+0xc8,
+0x10,
+0x03,
+0x20,
+0xe0,
+0x21,
+0x20,
+0x0d,
+0x22,
+0x64,
+0xc5,
+0xa0,
+0x02,
+0x53,
+0xc1,
+0x00,
+0xc6,
+0x00,
+0x64,
+0xc8,
+0x53,
+0xc3,
+0x00,
+0xc1,
+0x00,
+0x20,
+0x87,
+0x21,
+0xa5,
+0xc7,
+0xf0,
+0x06,
+0xa9,
+0xff,
+0x85,
+0xc5,
+0x85,
+0xc6,
+0xa5,
+0xc5,
+0x45,
+0xcd,
+0x85,
+0xc9,
+0x84,
+0xca,
+0xa5,
+0xc5,
+0x45,
+0xce,
+0x18,
+0x65,
+0xca,
+0x85,
+0xca,
+0x98,
+0x69,
+0x00,
+0x85,
+0xcb,
+0xa5,
+0xc6,
+0x45,
+0xcd,
+0x18,
+0x65,
+0xca,
+0x85,
+0xca,
+0x98,
+0x65,
+0xcb,
+0x85,
+0xcb,
+0xa5,
+0xc6,
+0x45,
+0xce,
+0x65,
+0xcb,
+0x85,
+0xcb,
+0x98,
+0x69,
+0x00,
+0x85,
+0xcc,
+0xa5,
+0xc9,
+0x10,
+0x08,
+0xe6,
+0xca,
+0xd0,
+0x04,
+0xe6,
+0xcb,
+0xf0,
+0x0d,
+0xa5,
+0xcc,
+0xd0,
+0x09,
+0xa0,
+0x02,
+0x53,
+0xca,
+0x00,
+0x2d,
+0x00,
+0x80,
+0x06,
+0xa9,
+0xff,
+0x85,
+0x2d,
+0x85,
+0x2e,
+0xa9,
+0x00,
+0x60,
+0xa2,
+0x02,
+0xa5,
+0x60,
+0xdd,
+0xcb,
+0x3c,
+0x90,
+0x11,
+0xd0,
+0x07,
+0xa5,
+0x5f,
+0xdd,
+0xca,
+0x3c,
+0x90,
+0x08,
+0xe8,
+0xe8,
+0xe0,
+0x06,
+0xf0,
+0x02,
+0x80,
+0xe8,
+0xca,
+0xca,
+0xda,
+0x38,
+0xa5,
+0x5f,
+0xfd,
+0xca,
+0x3c,
+0x85,
+0xc1,
+0xa5,
+0x60,
+0xfd,
+0xcb,
+0x3c,
+0x85,
+0xc2,
+0xbd,
+0xe5,
+0x3c,
+0x85,
+0xc3,
+0xbd,
+0xe6,
+0x3c,
+0x85,
+0xc4,
+0x20,
+0x0a,
+0x21,
+0x8a,
+0x4a,
+0xaa,
+0xbd,
+0xf1,
+0x3c,
+0xf0,
+0x12,
+0x38,
+0xa9,
+0x00,
+0xa8,
+0xe5,
+0xc5,
+0x85,
+0xc5,
+0x98,
+0xe5,
+0xc6,
+0x85,
+0xc6,
+0x98,
+0xe5,
+0xc7,
+0x85,
+0xc7,
+0xa5,
+0xc6,
+0x10,
+0x02,
+0xe6,
+0xc7,
+0xbd,
+0xd6,
+0x3c,
+0x18,
+0x65,
+0xc7,
+0x85,
+0x8b,
+0xfa,
+0xda,
+0xbd,
+0xdf,
+0x3c,
+0x85,
+0xc3,
+0xbd,
+0xe0,
+0x3c,
+0x85,
+0xc4,
+0x20,
+0x0a,
+0x21,
+0x8a,
+0x4a,
+0xaa,
+0xbd,
+0xee,
+0x3c,
+0xf0,
+0x12,
+0x38,
+0xa9,
+0x00,
+0xa8,
+0xe5,
+0xc5,
+0x85,
+0xc5,
+0x98,
+0xe5,
+0xc6,
+0x85,
+0xc6,
+0x98,
+0xe5,
+0xc7,
+0x85,
+0xc7,
+0xa5,
+0xc6,
+0x10,
+0x02,
+0xe6,
+0xc7,
+0xbd,
+0xd3,
+0x3c,
+0x18,
+0x65,
+0xc7,
+0x45,
+0x7a,
+0x20,
+0x58,
+0x21,
+0x85,
+0x89,
+0xfa,
+0xbd,
+0xd9,
+0x3c,
+0x85,
+0xc3,
+0xbd,
+0xda,
+0x3c,
+0x85,
+0xc4,
+0x20,
+0x0a,
+0x21,
+0x8a,
+0x4a,
+0xaa,
+0xbd,
+0xeb,
+0x3c,
+0xf0,
+0x12,
+0x38,
+0xa9,
+0x00,
+0xa8,
+0xe5,
+0xc5,
+0x85,
+0xc5,
+0x98,
+0xe5,
+0xc6,
+0x85,
+0xc6,
+0x98,
+0xe5,
+0xc7,
+0x85,
+0xc7,
+0xa5,
+0xc6,
+0x10,
+0x02,
+0xe6,
+0xc7,
+0xbd,
+0xd0,
+0x3c,
+0x18,
+0x65,
+0xc7,
+0x45,
+0x7b,
+0x20,
+0x58,
+0x21,
+0x85,
+0x8a,
+0x60,
+0xa5,
+0x6a,
+0xc9,
+0x02,
+0xb0,
+0x04,
+0xa9,
+0x00,
+0x80,
+0x02,
+0xa9,
+0x33,
+0x85,
+0xbd,
+0xa2,
+0x00,
+0x18,
+0x8a,
+0x65,
+0xbd,
+0xa8,
+0xa5,
+0x60,
+0xd9,
+0xfa,
+0x3c,
+0x90,
+0x11,
+0xd0,
+0x07,
+0xa5,
+0x5f,
+0xd9,
+0xf9,
+0x3c,
+0x90,
+0x08,
+0xe8,
+0xe8,
+0xe0,
+0x06,
+0xf0,
+0x02,
+0x80,
+0xe3,
+0x8a,
+0x4a,
+0x49,
+0x05,
+0x18,
+0x65,
+0xbd,
+0x18,
+0x69,
+0xff,
+0x85,
+0xc3,
+0xa9,
+0x3c,
+0x69,
+0x00,
+0x85,
+0xc4,
+0xa0,
+0x05,
+0xd3,
+0xc3,
+0x31,
+0x00,
+0x60,
+0xa2,
+0x02,
+0x18,
+0x8a,
+0x65,
+0xbd,
+0xa8,
+0xa5,
+0x60,
+0xd9,
+0x14,
+0x3d,
+0x90,
+0x11,
+0xd0,
+0x07,
+0xa5,
+0x5f,
+0xd9,
+0x13,
+0x3d,
+0x90,
+0x08,
+0xe8,
+0xe8,
+0xe0,
+0x0a,
+0xf0,
+0x02,
+0x80,
+0xe3,
+0xca,
+0xca,
+0x18,
+0x8a,
+0x65,
+0xbd,
+0xa8,
+0x38,
+0xa5,
+0x5f,
+0xf9,
+0x13,
+0x3d,
+0x85,
+0xc1,
+0xa5,
+0x60,
+0xf9,
+0x14,
+0x3d,
+0x85,
+0xc2,
+0xb9,
+0x1d,
+0x3d,
+0x85,
+0xc3,
+0xb9,
+0x1e,
+0x3d,
+0x85,
+0xc4,
+0x20,
+0x43,
+0x21,
+0xa5,
+0xc6,
+0x10,
+0x02,
+0xe6,
+0xc7,
+0x8a,
+0x4a,
+0x18,
+0x65,
+0xbd,
+0xa8,
+0x18,
+0xb9,
+0x27,
+0x3d,
+0x65,
+0xc7,
+0x85,
+0x36,
+0x60,
+0x38,
+0x30,
+0x0b,
+0x85,
+0xbd,
+0xa9,
+0x00,
+0xe5,
+0xbd,
+0xd0,
+0x02,
+0xa9,
+0xff,
+0x60,
+0xe9,
+0x80,
+0x4a,
+0x4a,
+0x85,
+0xbd,
+0x38,
+0xa9,
+0x80,
+0xe5,
+0xbd,
+0x60,
+0x38,
+0xe9,
+0x80,
+0xaa,
+0xa9,
+0x00,
+0x69,
+0x00,
+0xd8,
+0x49,
+0x01,
+0xf8,
+0x4a,
+0x8a,
+0x6a,
+0x18,
+0x69,
+0x80,
+0x60,
+0x38,
+0x30,
+0x0b,
+0x85,
+0xbd,
+0xa9,
+0x00,
+0xe5,
+0xbd,
+0xd0,
+0x02,
+0xa9,
+0xff,
+0x60,
+0xe9,
+0x80,
+0x4a,
+0x85,
+0xbd,
+0x38,
+0xa9,
+0x80,
+0xe5,
+0xbd,
+0x60,
+0x38,
+0xe9,
+0x80,
+0x85,
+0xbd,
+0x8a,
+0x3c,
+0x45,
+0xbd,
+0x0a,
+0xaa,
+0x98,
+0x2a,
+0xdc,
+0x10,
+0x01,
+0x1a,
+0x18,
+0x69,
+0x80,
+0x60,
+0x0a,
+0x85,
+0xbd,
+0x8a,
+0x45,
+0xbd,
+0x0a,
+0x98,
+0x69,
+0x00,
+0x60,
+0x0a,
+0x85,
+0xbd,
+0x8a,
+0x45,
+0xbd,
+0x0a,
+0x98,
+0x69,
+0x00,
+0xc9,
+0x7f,
+0xb0,
+0x01,
+0x60,
+0xa9,
+0x7f,
+0x60,
+0xa2,
+0x02,
+0xa5,
+0x60,
+0xdd,
+0x71,
+0x3f,
+0x90,
+0x11,
+0xd0,
+0x07,
+0xa5,
+0x5f,
+0xdd,
+0x70,
+0x3f,
+0x90,
+0x08,
+0xe8,
+0xe8,
+0xe0,
+0x06,
+0xf0,
+0x02,
+0x80,
+0xe8,
+0xca,
+0xca,
+0xda,
+0x38,
+0xa5,
+0x5f,
+0xfd,
+0x70,
+0x3f,
+0x85,
+0xc1,
+0xa5,
+0x60,
+0xfd,
+0x71,
+0x3f,
+0x85,
+0xc2,
+0xbd,
+0x76,
+0x3f,
+0x85,
+0xc3,
+0xbd,
+0x77,
+0x3f,
+0x85,
+0xc4,
+0x20,
+0x43,
+0x21,
+0xa5,
+0xc6,
+0x10,
+0x02,
+0xe6,
+0xc7,
+0x8a,
+0x4a,
+0xaa,
+0x18,
+0xbd,
+0x82,
+0x3f,
+0x65,
+0xc7,
+0x85,
+0xac,
+0xfa,
+0xbd,
+0x7c,
+0x3f,
+0x85,
+0xc3,
+0xbd,
+0x7d,
+0x3f,
+0x85,
+0xc4,
+0x20,
+0x43,
+0x21,
+0xa5,
+0xc6,
+0x10,
+0x02,
+0xe6,
+0xc7,
+0x8a,
+0x4a,
+0xaa,
+0x18,
+0xbd,
+0x85,
+0x3f,
+0x65,
+0xc7,
+0x85,
+0xad,
+0x60,
+0x5a,
+0x86,
+0xbd,
+0x45,
+0xbd,
+0xaa,
+0x98,
+0x29,
+0x30,
+0xd0,
+0x12,
+0x98,
+0x49,
+0x08,
+0x85,
+0xbd,
+0x8a,
+0x49,
+0x10,
+0x98,
+0x4a,
+0x05,
+0xbd,
+0x69,
+0x00,
+0x30,
+0x02,
+0x7a,
+0x60,
+0xa9,
+0x7f,
+0x7a,
+0x60,
+0x5a,
+0x86,
+0xbd,
+0x45,
+0xbd,
+0xaa,
+0x98,
+0x29,
+0x38,
+0xd0,
+0x12,
+0x98,
+0x49,
+0x10,
+0x85,
+0xbd,
+0x8a,
+0x49,
+0x20,
+0x98,
+0x4a,
+0x05,
+0xbd,
+0x69,
+0x00,
+0x30,
+0x02,
+0x7a,
+0x60,
+0xa9,
+0x7f,
+0x7a,
+0x60,
+0x5a,
+0x86,
+0xbd,
+0x45,
+0xbd,
+0xaa,
+0x98,
+0x29,
+0xf8,
+0xd0,
+0x10,
+0x98,
+0x49,
+0x10,
+0x85,
+0xbd,
+0x8a,
+0x49,
+0x20,
+0x98,
+0x4a,
+0x05,
+0xbd,
+0x69,
+0x00,
+0x10,
+0x02,
+0xa9,
+0x7f,
+0x7a,
+0x60,
+0x49,
+0x3c,
+0x18,
+0x65,
+0xcb,
+0x85,
+0xc1,
+0xa9,
+0x00,
+0x69,
+0x00,
+0x85,
+0xc2,
+0x18,
+0xa5,
+0xc1,
+0x69,
+0x78,
+0x85,
+0xc1,
+0xa5,
+0xc2,
+0x69,
+0x3d,
+0x85,
+0xc2,
+0x60,
+0xf0,
+0x02,
+0xa9,
+0x3c,
+0x18,
+0x65,
+0xcb,
+0x85,
+0xc1,
+0xa9,
+0x00,
+0x69,
+0x00,
+0x85,
+0xc2,
+0x18,
+0xa5,
+0xc1,
+0x69,
+0x78,
+0x85,
+0xc1,
+0xa5,
+0xc2,
+0x69,
+0x3d,
+0x85,
+0xc2,
+0x60,
+0x85,
+0xca,
+0xa9,
+0x04,
+0x48,
+0x80,
+0x1a,
+0xfa,
+0xfa,
+0x48,
+0xa9,
+0x0f,
+0x18,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0x90,
+0x03,
+0x18,
+0xe6,
+0xc2,
+0xa5,
+0xbf,
+0x65,
+0xc3,
+0x85,
+0xc3,
+0x90,
+0x03,
+0x18,
+0xe6,
+0xc4,
+0xa0,
+0x0f,
+0xd3,
+0xc1,
+0x48,
+0x00,
+0xa6,
+0x54,
+0xa5,
+0x77,
+0x20,
+0xe5,
+0x14,
+0x85,
+0xbe,
+0xa6,
+0x55,
+0xa5,
+0x77,
+0x20,
+0xe5,
+0x14,
+0x85,
+0xc0,
+0xa6,
+0x56,
+0xa5,
+0x77,
+0x20,
+0xe5,
+0x14,
+0x85,
+0xc5,
+0xa5,
+0x48,
+0xa6,
+0xc0,
+0x20,
+0xfa,
+0x14,
+0xa6,
+0x7b,
+0x20,
+0xa2,
+0x15,
+0x85,
+0x48,
+0xa5,
+0x49,
+0xa6,
+0xc5,
+0x20,
+0xfa,
+0x14,
+0xa6,
+0x30,
+0x20,
+0xc3,
+0x15,
+0x85,
+0x49,
+0xa5,
+0x4a,
+0xa6,
+0xbe,
+0x20,
+0x05,
+0x15,
+0x85,
+0x4a,
+0xa5,
+0x4b,
+0xa6,
+0xbe,
+0x20,
+0x05,
+0x15,
+0x85,
+0x4b,
+0xa5,
+0x4c,
+0xa6,
+0xbe,
+0x20,
+0xfa,
+0x14,
+0xa6,
+0x7d,
+0x20,
+0x81,
+0x15,
+0x85,
+0x4c,
+0xa5,
+0x4d,
+0xa6,
+0xc5,
+0x20,
+0xfa,
+0x14,
+0xa6,
+0x7c,
+0x20,
+0x81,
+0x15,
+0x85,
+0x4d,
+0xa5,
+0x4e,
+0xa6,
+0xc0,
+0x20,
+0x05,
+0x15,
+0x85,
+0x4e,
+0xa5,
+0x4f,
+0xa6,
+0xc0,
+0x20,
+0x05,
+0x15,
+0x85,
+0x4f,
+0xa5,
+0x50,
+0xa6,
+0xc5,
+0x20,
+0x05,
+0x15,
+0x85,
+0x50,
+0xa0,
+0x09,
+0xa5,
+0xca,
+0xd0,
+0x27,
+0xa5,
+0x51,
+0xa6,
+0xbe,
+0x20,
+0xfa,
+0x14,
+0xa6,
+0x2f,
+0x20,
+0xc3,
+0x15,
+0x85,
+0x51,
+0xa5,
+0x52,
+0xa6,
+0xc0,
+0x20,
+0xfa,
+0x14,
+0xa6,
+0x7a,
+0x20,
+0xa2,
+0x15,
+0x85,
+0x52,
+0xa5,
+0x53,
+0xa6,
+0xc5,
+0x20,
+0x05,
+0x15,
+0x85,
+0x53,
+0xa0,
+0x0c,
+0x73,
+0x48,
+0x00,
+0xc3,
+0x68,
+0x3a,
+0xd0,
+0x01,
+0x60,
+0x20,
+0x21,
+0x16,
+0xa9,
+0x03,
+0x48,
+0xa2,
+0x00,
+0x80,
+0x06,
+0x48,
+0x18,
+0x8a,
+0x69,
+0x15,
+0xaa,
+0xa0,
+0x15,
+0x18,
+0xbd,
+0x0c,
+0x2a,
+0x7d,
+0x36,
+0x2a,
+0x4a,
+0x69,
+0x00,
+0x9d,
+0x21,
+0x2a,
+0xe8,
+0x88,
+0xd0,
+0xef,
+0x68,
+0x3a,
+0xd0,
+0xe3,
+0x60,
+0xbc,
+0x87,
+0x28,
+0x84,
+0xbd,
+0x45,
+0xbd,
+0x85,
+0xc1,
+0x84,
+0xc2,
+0x18,
+0xa9,
+0x10,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0x90,
+0x02,
+0xe6,
+0xc2,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0xb0,
+0x15,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0xb0,
+0x0f,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0xb0,
+0x09,
+0xa9,
+0xc0,
+0x25,
+0xc2,
+0xd0,
+0x03,
+0xa5,
+0xc2,
+0x60,
+0xa9,
+0x3f,
+0x60,
+0xa5,
+0x2b,
+0x49,
+0x10,
+0x85,
+0xc5,
+0x84,
+0xc6,
+0xa5,
+0x2c,
+0x49,
+0x10,
+0x05,
+0xc6,
+0x85,
+0xc6,
+0x84,
+0xc7,
+0x64,
+0xc8,
+0xa0,
+0x02,
+0x53,
+0x5f,
+0x00,
+0xc1,
+0x00,
+0x20,
+0x87,
+0x21,
+0xa5,
+0xc7,
+0xd0,
+0x0a,
+0xa5,
+0xc6,
+0xd0,
+0x06,
+0xa5,
+0xc5,
+0xc9,
+0x3f,
+0x90,
+0x02,
+0xa9,
+0x3f,
+0x45,
+0x7b,
+0x18,
+0x69,
+0x08,
+0x85,
+0xbd,
+0x98,
+0x69,
+0x00,
+0x49,
+0x10,
+0xc0,
+0x00,
+0xd0,
+0x0f,
+0xaa,
+0xa5,
+0xbd,
+0x49,
+0x10,
+0x84,
+0xbd,
+0x8a,
+0x05,
+0xbd,
+0xcd,
+0x62,
+0x3c,
+0x90,
+0x05,
+0xad,
+0x64,
+0x3c,
+0x80,
+0x03,
+0xad,
+0x63,
+0x3c,
+0x18,
+0x69,
+0x20,
+0x29,
+0x3f,
+0x85,
+0xbd,
+0xa4,
+0x6a,
+0xb9,
+0x5d,
+0x3c,
+0x18,
+0x69,
+0x20,
+0x29,
+0x3f,
+0x85,
+0xbe,
+0xa4,
+0x6b,
+0xb9,
+0x55,
+0x3c,
+0x45,
+0xbe,
+0x85,
+0xc1,
+0x84,
+0xc2,
+0x18,
+0xa9,
+0x10,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0x90,
+0x02,
+0xe6,
+0xc2,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0x06,
+0xc1,
+0xa5,
+0xc2,
+0x2a,
+0x85,
+0xc1,
+0xa9,
+0x00,
+0x2a,
+0x85,
+0xc2,
+0xa5,
+0xc1,
+0x45,
+0xbd,
+0x85,
+0xc1,
+0xa5,
+0xc2,
+0xf0,
+0x05,
+0x18,
+0x98,
+0x65,
+0xbd,
+0xa8,
+0x84,
+0xc2,
+0x18,
+0xa9,
+0x10,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0x90,
+0x02,
+0xe6,
+0xc2,
+0x64,
+0xbd,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0x26,
+0xbd,
+0x06,
+0xc1,
+0xa5,
+0xc2,
+0x2a,
+0x85,
+0xc3,
+0xa5,
+0xbd,
+0x2a,
+0x85,
+0xc4,
+0xa0,
+0x00,
+0x5a,
+0xb9,
+0x28,
+0x3c,
+0x18,
+0x69,
+0x20,
+0x29,
+0x3f,
+0x85,
+0xbd,
+0xa5,
+0xbd,
+0x45,
+0xc3,
+0x85,
+0xc1,
+0xfc,
+0xa5,
+0xbd,
+0x45,
+0xc4,
+0x85,
+0xc2,
+0x8a,
+0x18,
+0x65,
+0xc2,
+0x85,
+0xc2,
+0x18,
+0xa9,
+0x10,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0x90,
+0x02,
+0xe6,
+0xc2,
+0x64,
+0xbd,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0x26,
+0xbd,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0x26,
+0xbd,
+0x06,
+0xc1,
+0xa5,
+0xc2,
+0x2a,
+0xa8,
+0xa5,
+0xbd,
+0x2a,
+0xd0,
+0x05,
+0x98,
+0xc9,
+0x1f,
+0x90,
+0x02,
+0xa9,
+0x1f,
+0x7a,
+0x99,
+0x11,
+0x2c,
+0xc8,
+0xc0,
+0x07,
+0x90,
+0xae,
+0xa9,
+0x00,
+0x60,
+0xa5,
+0xb8,
+0xa8,
+0x29,
+0x0f,
+0xf0,
+0x28,
+0x98,
+0x29,
+0xf0,
+0xf0,
+0x23,
+0xa5,
+0xb7,
+0xaa,
+0x29,
+0x0f,
+0x3a,
+0xd0,
+0x11,
+0xd8,
+0x8a,
+0x49,
+0x10,
+0xaa,
+0xd0,
+0x07,
+0x98,
+0x4a,
+0x4a,
+0x4a,
+0x4a,
+0x80,
+0x03,
+0x98,
+0x29,
+0x0f,
+0xf8,
+0x85,
+0xb7,
+0x8a,
+0x29,
+0x10,
+0x05,
+0xb7,
+0x85,
+0xb7,
+0x60,
+0xa9,
+0x01,
+0x8d,
+0x10,
+0x60,
+0xa0,
+0x02,
+0x53,
+0xad,
+0x3c,
+0x58,
+0x60,
+0x53,
+0x57,
+0x00,
+0x18,
+0x60,
+0x53,
+0x59,
+0x00,
+0x1c,
+0x60,
+0x53,
+0x5b,
+0x00,
+0x28,
+0x60,
+0x53,
+0x5d,
+0x00,
+0x2c,
+0x60,
+0x53,
+0x61,
+0x00,
+0x30,
+0x60,
+0xa0,
+0x01,
+0x53,
+0xb3,
+0x3c,
+0x20,
+0x61,
+0x53,
+0xb4,
+0x3c,
+0x24,
+0x61,
+0x53,
+0xb5,
+0x3c,
+0x28,
+0x61,
+0x53,
+0xaf,
+0x3c,
+0x2c,
+0x61,
+0x53,
+0xb0,
+0x3c,
+0x30,
+0x61,
+0x53,
+0xb1,
+0x3c,
+0x34,
+0x61,
+0x53,
+0xb2,
+0x3c,
+0x38,
+0x61,
+0x53,
+0xb6,
+0x3c,
+0x3c,
+0x61,
+0x53,
+0xb7,
+0x3c,
+0x40,
+0x61,
+0x53,
+0xf4,
+0x3f,
+0x74,
+0x60,
+0x53,
+0xaa,
+0x3c,
+0x0c,
+0x61,
+0x53,
+0xab,
+0x3c,
+0x44,
+0x61,
+0x53,
+0xac,
+0x3c,
+0x88,
+0x60,
+0x53,
+0x54,
+0x3c,
+0xdc,
+0x60,
+0x53,
+0x55,
+0x3c,
+0x68,
+0x61,
+0x53,
+0x72,
+0x00,
+0x14,
+0x60,
+0x53,
+0x71,
+0x00,
+0x3c,
+0x60,
+0x53,
+0x7a,
+0x00,
+0xec,
+0x60,
+0x53,
+0x7b,
+0x00,
+0xe0,
+0x60,
+0x53,
+0x7c,
+0x00,
+0xe8,
+0x60,
+0x53,
+0x7d,
+0x00,
+0xe4,
+0x60,
+0x53,
+0x80,
+0x00,
+0x64,
+0x61,
+0x53,
+0x81,
+0x00,
+0x80,
+0x60,
+0x53,
+0x82,
+0x00,
+0x84,
+0x60,
+0x53,
+0x83,
+0x00,
+0x58,
+0x61,
+0x53,
+0x84,
+0x00,
+0xf0,
+0x60,
+0x53,
+0x85,
+0x00,
+0xf4,
+0x60,
+0x53,
+0x86,
+0x00,
+0xf8,
+0x60,
+0x53,
+0x87,
+0x00,
+0x5c,
+0x61,
+0x53,
+0x88,
+0x00,
+0xac,
+0x60,
+0x53,
+0x89,
+0x00,
+0x7c,
+0x60,
+0x53,
+0x8a,
+0x00,
+0x78,
+0x60,
+0x53,
+0x8b,
+0x00,
+0x10,
+0x61,
+0x53,
+0x8c,
+0x00,
+0xfc,
+0x60,
+0x53,
+0x8d,
+0x00,
+0x00,
+0x61,
+0x53,
+0x8e,
+0x00,
+0x04,
+0x61,
+0x53,
+0x8f,
+0x00,
+0x08,
+0x61,
+0x53,
+0x90,
+0x00,
+0x1c,
+0x61,
+0x53,
+0x91,
+0x00,
+0x4c,
+0x61,
+0x53,
+0x92,
+0x00,
+0x18,
+0x61,
+0x53,
+0x93,
+0x00,
+0x48,
+0x61,
+0x53,
+0x94,
+0x00,
+0x14,
+0x61,
+0x53,
+0x95,
+0x00,
+0x6c,
+0x61,
+0x53,
+0x96,
+0x00,
+0x5c,
+0x60,
+0x53,
+0x97,
+0x00,
+0xbc,
+0x60,
+0x53,
+0x98,
+0x00,
+0xc0,
+0x60,
+0x53,
+0x99,
+0x00,
+0xc4,
+0x60,
+0x53,
+0x9a,
+0x00,
+0xc8,
+0x60,
+0x53,
+0x9b,
+0x00,
+0xcc,
+0x60,
+0x53,
+0x9c,
+0x00,
+0xd0,
+0x60,
+0x53,
+0x9d,
+0x00,
+0xd4,
+0x60,
+0x53,
+0x9e,
+0x00,
+0xd8,
+0x60,
+0x53,
+0x9f,
+0x00,
+0x50,
+0x61,
+0x53,
+0xa0,
+0x00,
+0x60,
+0x60,
+0x53,
+0xa1,
+0x00,
+0x64,
+0x60,
+0x53,
+0xa2,
+0x00,
+0x68,
+0x60,
+0x53,
+0xa3,
+0x00,
+0x60,
+0x61,
+0x53,
+0xa4,
+0x00,
+0x6c,
+0x60,
+0x53,
+0xa5,
+0x00,
+0x70,
+0x60,
+0x53,
+0xa6,
+0x00,
+0xa8,
+0x60,
+0x53,
+0xa7,
+0x00,
+0xa4,
+0x60,
+0x53,
+0xa8,
+0x00,
+0xa0,
+0x60,
+0x53,
+0xa9,
+0x00,
+0x9c,
+0x60,
+0x53,
+0xaa,
+0x00,
+0x98,
+0x60,
+0x53,
+0xab,
+0x00,
+0x94,
+0x60,
+0x53,
+0xac,
+0x00,
+0x8c,
+0x60,
+0x53,
+0xad,
+0x00,
+0x90,
+0x60,
+0x53,
+0xb0,
+0x00,
+0xb8,
+0x60,
+0x53,
+0xb1,
+0x00,
+0xb4,
+0x60,
+0x53,
+0xb2,
+0x00,
+0xb0,
+0x60,
+0x53,
+0xb3,
+0x00,
+0x54,
+0x61,
+0x53,
+0xb4,
+0x00,
+0x70,
+0x61,
+0x9c,
+0x20,
+0x60,
+0x9c,
+0x24,
+0x60,
+0x60,
+0x29,
+0x01,
+0xf0,
+0x06,
+0xa2,
+0xb8,
+0xa9,
+0x01,
+0x80,
+0x04,
+0xa2,
+0x38,
+0xa9,
+0x00,
+0x8e,
+0x0c,
+0x60,
+0x8d,
+0x0d,
+0x60,
+0x85,
+0xc6,
+0x86,
+0xc5,
+0xa4,
+0x7f,
+0xb9,
+0xdb,
+0x2b,
+0xa8,
+0xb9,
+0x3b,
+0x28,
+0x49,
+0x04,
+0x18,
+0x69,
+0x5f,
+0x85,
+0xc1,
+0xa9,
+0x00,
+0x69,
+0x3d,
+0x85,
+0xc2,
+0xa5,
+0x65,
+0x85,
+0xbd,
+0xa0,
+0x00,
+0x5a,
+0xb9,
+0xcb,
+0x2b,
+0xa8,
+0xb9,
+0x2b,
+0x28,
+0x4a,
+0xa8,
+0xb1,
+0xc1,
+0xb0,
+0x04,
+0x4a,
+0x4a,
+0x4a,
+0x4a,
+0x29,
+0x0f,
+0x18,
+0x49,
+0x15,
+0x69,
+0x0c,
+0x85,
+0xc3,
+0xa9,
+0x2a,
+0x69,
+0x00,
+0x85,
+0xc4,
+0xa0,
+0x15,
+0xc3,
+0xc3,
+0x54,
+0x60,
+0x18,
+0xa5,
+0xc5,
+0x69,
+0x18,
+0x85,
+0xc5,
+0x90,
+0x02,
+0xe6,
+0xc6,
+0xa0,
+0x02,
+0x53,
+0xc5,
+0x00,
+0x0c,
+0x60,
+0x7a,
+0xc6,
+0xbd,
+0xf0,
+0x03,
+0xc8,
+0x80,
+0xbf,
+0xe6,
+0x7f,
+0x60,
+0xa5,
+0x6c,
+0xf0,
+0x06,
+0xa5,
+0x6d,
+0xc9,
+0x00,
+0xd0,
+0x12,
+0xa0,
+0x02,
+0x53,
+0xa2,
+0x3c,
+0xb6,
+0x02,
+0x53,
+0xa4,
+0x3c,
+0xb8,
+0x02,
+0x9c,
+0xa9,
+0x02,
+0x4c,
+0x86,
+0x1d,
+0xa9,
+0x03,
+0x85,
+0xc9,
+0xa0,
+0x02,
+0x53,
+0x42,
+0x00,
+0xc1,
+0x00,
+0xa5,
+0x3f,
+0xc5,
+0xc2,
+0x90,
+0x13,
+0xd0,
+0x06,
+0xa5,
+0x3e,
+0xc5,
+0xc1,
+0x90,
+0x0b,
+0xa9,
+0x01,
+0x85,
+0xc9,
+0xa0,
+0x02,
+0x53,
+0x3e,
+0x00,
+0xc1,
+0x00,
+0xa5,
+0x3d,
+0xc5,
+0xc2,
+0x90,
+0x13,
+0xd0,
+0x06,
+0xa5,
+0x3c,
+0xc5,
+0xc1,
+0x90,
+0x0b,
+0xa9,
+0x00,
+0x85,
+0xc9,
+0xa0,
+0x02,
+0x53,
+0x3c,
+0x00,
+0xc1,
+0x00,
+0xa5,
+0x41,
+0xc5,
+0xc2,
+0x90,
+0x13,
+0xd0,
+0x06,
+0xa5,
+0x40,
+0xc5,
+0xc1,
+0x90,
+0x0b,
+0xa9,
+0x02,
+0x85,
+0xc9,
+0xa0,
+0x02,
+0x53,
+0x40,
+0x00,
+0xc1,
+0x00,
+0xa6,
+0x6d,
+0xe0,
+0x02,
+0xf0,
+0x04,
+0xa9,
+0x00,
+0x80,
+0x02,
+0xa9,
+0x16,
+0x85,
+0xbd,
+0xa2,
+0x00,
+0x18,
+0x8a,
+0x65,
+0xbd,
+0xa8,
+0xa5,
+0x60,
+0xd9,
+0x69,
+0x3c,
+0x90,
+0x11,
+0xd0,
+0x07,
+0xa5,
+0x5f,
+0xd9,
+0x68,
+0x3c,
+0x90,
+0x08,
+0xe8,
+0xe8,
+0xe0,
+0x08,
+0xf0,
+0x02,
+0x80,
+0xe3,
+0x8a,
+0x4a,
+0x49,
+0x04,
+0x18,
+0x65,
+0xbd,
+0x48,
+0xa5,
+0x37,
+0x85,
+0xbd,
+0xd0,
+0x08,
+0x64,
+0xc5,
+0x64,
+0xc6,
+0x64,
+0xc7,
+0x80,
+0x48,
+0x4a,
+0x85,
+0xcc,
+0xa5,
+0x38,
+0x85,
+0xc2,
+0xa5,
+0xcc,
+0x85,
+0xc1,
+0x20,
+0xc4,
+0x20,
+0xa5,
+0xc2,
+0xd0,
+0x04,
+0xa5,
+0xc1,
+0x80,
+0x02,
+0xa9,
+0xff,
+0x85,
+0xc5,
+0xa5,
+0x39,
+0x85,
+0xc2,
+0xa5,
+0xcc,
+0x85,
+0xc1,
+0x20,
+0xc4,
+0x20,
+0xa5,
+0xc2,
+0xd0,
+0x04,
+0xa5,
+0xc1,
+0x80,
+0x02,
+0xa9,
+0xff,
+0x85,
+0xc6,
+0xa5,
+0x3b,
+0x85,
+0xc2,
+0xa5,
+0xcc,
+0x85,
+0xc1,
+0x20,
+0xc4,
+0x20,
+0xa5,
+0xc2,
+0xd0,
+0x04,
+0xa5,
+0xc1,
+0x80,
+0x02,
+0xa9,
+0xff,
+0x85,
+0xc7,
+0xa5,
+0x6e,
+0xf0,
+0x03,
+0x4c,
+0x72,
+0x1c,
+0xad,
+0xaa,
+0x02,
+0xc5,
+0xc5,
+0x90,
+0x16,
+0x38,
+0xe5,
+0xc5,
+0x45,
+0x73,
+0x0a,
+0xaa,
+0x98,
+0x2a,
+0xa8,
+0x8a,
+0x18,
+0x69,
+0x80,
+0x98,
+0x69,
+0x00,
+0x18,
+0x65,
+0xc5,
+0x80,
+0x21,
+0xa5,
+0xc5,
+0x38,
+0xed,
+0xaa,
+0x02,
+0x45,
+0x73,
+0x0a,
+0xaa,
+0x98,
+0x2a,
+0xa8,
+0x8a,
+0x38,
+0xe9,
+0x80,
+0x85,
+0xd1,
+0x98,
+0xe9,
+0x00,
+0x85,
+0xd2,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0xd1,
+0xa5,
+0xc5,
+0xe5,
+0xd2,
+0x85,
+0xc5,
+0xad,
+0xab,
+0x02,
+0xc5,
+0xc6,
+0x90,
+0x16,
+0x38,
+0xe5,
+0xc6,
+0x45,
+0x73,
+0x0a,
+0xaa,
+0x98,
+0x2a,
+0xa8,
+0x8a,
+0x18,
+0x69,
+0x80,
+0x98,
+0x69,
+0x00,
+0x18,
+0x65,
+0xc6,
+0x80,
+0x21,
+0xa5,
+0xc6,
+0x38,
+0xed,
+0xab,
+0x02,
+0x45,
+0x73,
+0x0a,
+0xaa,
+0x98,
+0x2a,
+0xa8,
+0x8a,
+0x38,
+0xe9,
+0x80,
+0x85,
+0xd1,
+0x98,
+0xe9,
+0x00,
+0x85,
+0xd2,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0xd1,
+0xa5,
+0xc6,
+0xe5,
+0xd2,
+0x85,
+0xc6,
+0xad,
+0xac,
+0x02,
+0xc5,
+0xc7,
+0x90,
+0x16,
+0x38,
+0xe5,
+0xc7,
+0x45,
+0x73,
+0x0a,
+0xaa,
+0x98,
+0x2a,
+0xa8,
+0x8a,
+0x18,
+0x69,
+0x80,
+0x98,
+0x69,
+0x00,
+0x18,
+0x65,
+0xc7,
+0x80,
+0x21,
+0xa5,
+0xc7,
+0x38,
+0xed,
+0xac,
+0x02,
+0x45,
+0x73,
+0x0a,
+0xaa,
+0x98,
+0x2a,
+0xa8,
+0x8a,
+0x38,
+0xe9,
+0x80,
+0x85,
+0xd1,
+0x98,
+0xe9,
+0x00,
+0x85,
+0xd2,
+0x38,
+0xa9,
+0x00,
+0xe5,
+0xd1,
+0xa5,
+0xc7,
+0xe5,
+0xd2,
+0x85,
+0xc7,
+0xa0,
+0x03,
+0x53,
+0xc5,
+0x00,
+0xaa,
+0x02,
+0x18,
+0xa5,
+0xc6,
+0x65,
+0xc5,
+0xb0,
+0x02,
+0x80,
+0x02,
+0xa9,
+0xff,
+0x85,
+0xc8,
+0xfa,
+0xa5,
+0xc5,
+0xdd,
+0x71,
+0x3c,
+0x90,
+0x16,
+0xa9,
+0x00,
+0x85,
+0xca,
+0xa5,
+0xc5,
+0xdd,
+0x70,
+0x3c,
+0x90,
+0x02,
+0x80,
+0x2a,
+0xa5,
+0xc8,
+0xdd,
+0x70,
+0x3c,
+0x90,
+0x2f,
+0x80,
+0x27,
+0xa5,
+0xc8,
+0xdd,
+0x6f,
+0x3c,
+0x90,
+0x2c,
+0xa9,
+0x01,
+0x85,
+0xca,
+0xa5,
+0xc8,
+0xdd,
+0x70,
+0x3c,
+0x90,
+0x02,
+0x80,
+0x13,
+0xa5,
+0xc7,
+0xdd,
+0x6e,
+0x3c,
+0x90,
+0x12,
+0xa9,
+0x03,
+0x85,
+0xcb,
+0x80,
+0x27,
+0xa9,
+0x00,
+0x85,
+0xcb,
+0x80,
+0x21,
+0xa9,
+0x01,
+0x85,
+0xcb,
+0x80,
+0x1b,
+0xa9,
+0x02,
+0x85,
+0xcb,
+0x80,
+0x15,
+0xa5,
+0xc7,
+0xdd,
+0x6e,
+0x3c,
+0x90,
+0x08,
+0xa9,
+0x03,
+0x85,
+0xca,
+0x85,
+0xcb,
+0x80,
+0x06,
+0xa9,
+0x02,
+0x85,
+0xca,
+0x85,
+0xcb,
+0xa5,
+0xc9,
+0xc5,
+0xca,
+0xf0,
+0x02,
+0xb0,
+0x0c,
+0xa5,
+0xca,
+0xf0,
+0x1a,
+0x85,
+0xcb,
+0xa5,
+0xc9,
+0x85,
+0xca,
+0x80,
+0x12,
+0xa5,
+0xca,
+0xc9,
+0x02,
+0xd0,
+0x08,
+0xa5,
+0xc9,
+0x85,
+0xcb,
+0x85,
+0xca,
+0x80,
+0x04,
+0xa5,
+0xc9,
+0x85,
+0xcb,
+0xa5,
+0x6e,
+0xd0,
+0x05,
+0xad,
+0xa9,
+0x02,
+0xd0,
+0x14,
+0xa9,
+0x01,
+0x8d,
+0xae,
+0x02,
+0x8d,
+0xaf,
+0x02,
+0xa5,
+0xca,
+0x8d,
+0xb4,
+0x02,
+0xa5,
+0xcb,
+0x8d,
+0xb5,
+0x02,
+0x80,
+0x3c,
+0xa5,
+0xca,
+0xcd,
+0xb4,
+0x02,
+0xd0,
+0x0d,
+0xad,
+0xae,
+0x02,
+0xcd,
+0x9e,
+0x3c,
+0xb0,
+0x0f,
+0xee,
+0xae,
+0x02,
+0x80,
+0x06,
+0x8d,
+0xb4,
+0x02,
+0x9c,
+0xae,
+0x02,
+0xa5,
+0x74,
+0x85,
+0xca,
+0xa5,
+0xcb,
+0xcd,
+0xb5,
+0x02,
+0xd0,
+0x0d,
+0xad,
+0xaf,
+0x02,
+0xcd,
+0x9e,
+0x3c,
+0xb0,
+0x0f,
+0xee,
+0xaf,
+0x02,
+0x80,
+0x06,
+0x8d,
+0xb5,
+0x02,
+0x9c,
+0xaf,
+0x02,
+0xa5,
+0x75,
+0x85,
+0xcb,
+0xa9,
+0x01,
+0x8d,
+0xa9,
+0x02,
+0xa5,
+0xca,
+0x20,
+0xe4,
+0x0c,
+0x8d,
+0xb6,
+0x02,
+0x8e,
+0xb7,
+0x02,
+0xa5,
+0xcb,
+0x20,
+0xe4,
+0x0c,
+0x8d,
+0xb8,
+0x02,
+0x8e,
+0xb9,
+0x02,
+0xa2,
+0x00,
+0xa0,
+0x00,
+0xc4,
+0xb6,
+0xb0,
+0x1e,
+0xa5,
+0xb7,
+0x29,
+0x10,
+0xf0,
+0x03,
+0x38,
+0x80,
+0x01,
+0x18,
+0x3e,
+0x0b,
+0x2d,
+0x3e,
+0x0c,
+0x2d,
+0x3e,
+0x0d,
+0x2d,
+0x3e,
+0x0e,
+0x2d,
+0xc8,
+0x18,
+0x8a,
+0x69,
+0x10,
+0xaa,
+0x80,
+0xde,
+0xa0,
+0x50,
+0x53,
+0xff,
+0x2c,
+0x52,
+0x02,
+0xa9,
+0x01,
+0x8d,
+0x04,
+0x60,
+0x60,
+0xa5,
+0xd3,
+0x45,
+0xc2,
+0x85,
+0xc5,
+0x84,
+0xc6,
+0xa5,
+0xd4,
+0x45,
+0xc2,
+0x18,
+0x65,
+0xc6,
+0x85,
+0xc6,
+0x98,
+0x69,
+0x00,
+0x85,
+0xc7,
+0xa5,
+0xd5,
+0x45,
+0xc2,
+0x18,
+0x65,
+0xc7,
+0x85,
+0xc7,
+0x98,
+0x69,
+0x00,
+0x85,
+0xc8,
+0xa5,
+0xd6,
+0x45,
+0xc2,
+0x18,
+0x65,
+0xc8,
+0x85,
+0xc8,
+0x60,
+0xa0,
+0x10,
+0x13,
+0x54,
+0x60,
+0xd3,
+0x00,
+0x38,
+0xa5,
+0xd7,
+0xe5,
+0xdb,
+0x85,
+0x44,
+0xa5,
+0xd8,
+0xe5,
+0xdc,
+0x85,
+0x45,
+0xa5,
+0xd9,
+0xe5,
+0xdd,
+0x85,
+0x46,
+0xa5,
+0xda,
+0xe5,
+0xde,
+0x85,
+0x47,
+0xad,
+0x9d,
+0x3c,
+0xc5,
+0xe0,
+0x90,
+0x0c,
+0xd0,
+0x07,
+0xad,
+0x9c,
+0x3c,
+0xc5,
+0xdf,
+0x90,
+0x03,
+0x4c,
+0xa7,
+0x1f,
+0xa5,
+0xd6,
+0xd0,
+0x2b,
+0xa5,
+0xdf,
+0x45,
+0xb5,
+0x85,
+0xcd,
+0x84,
+0xce,
+0xa5,
+0xe0,
+0x45,
+0xb5,
+0x18,
+0x65,
+0xce,
+0x85,
+0xce,
+0x98,
+0x69,
+0x00,
+0xc5,
+0xd5,
+0x90,
+0x13,
+0xd0,
+0x0e,
+0xa5,
+0xce,
+0xc5,
+0xd4,
+0x90,
+0x0b,
+0xd0,
+0x06,
+0xa5,
+0xcd,
+0xc5,
+0xd3,
+0x90,
+0x03,
+0x4c,
+0xa7,
+0x1f,
+0xe6,
+0x37,
+0xa5,
+0x79,
+0x29,
+0x01,
+0xf0,
+0x07,
+0x18,
+0xa5,
+0x65,
+0xe5,
+0xbd,
+0x80,
+0x02,
+0xa5,
+0xbd,
+0x45,
+0x6f,
+0xa8,
+0xb9,
+0x2b,
+0x28,
+0x4a,
+0xa8,
+0xb1,
+0xcb,
+0xb0,
+0x04,
+0x4a,
+0x4a,
+0x4a,
+0x4a,
+0x29,
+0x0f,
+0xa8,
+0xad,
+0xe0,
+0x2c,
+0xc9,
+0x08,
+0xf0,
+0x17,
+0xc9,
+0x02,
+0xf0,
+0x09,
+0xc9,
+0x04,
+0xf0,
+0x0a,
+0xb9,
+0x50,
+0x3c,
+0x80,
+0x0d,
+0xb9,
+0x4d,
+0x3c,
+0x80,
+0x08,
+0xb9,
+0x4a,
+0x3c,
+0x80,
+0x03,
+0xb9,
+0x47,
+0x3c,
+0x85,
+0xc0,
+0xa5,
+0x47,
+0x29,
+0x80,
+0x85,
+0xbf,
+0xf0,
+0x17,
+0x38,
+0xa9,
+0x00,
+0xaa,
+0xe5,
+0x44,
+0x85,
+0x44,
+0x8a,
+0xe5,
+0x45,
+0x85,
+0x45,
+0x8a,
+0xe5,
+0x46,
+0x85,
+0x46,
+0x8a,
+0xe5,
+0x47,
+0x85,
+0x47,
+0xa4,
+0xbd,
+0xb9,
+0xcb,
+0x2b,
+0xa8,
+0xb9,
+0x2b,
+0x28,
+0x4a,
+0xa8,
+0xb1,
+0xc9,
+0xb0,
+0x04,
+0x4a,
+0x4a,
+0x4a,
+0x4a,
+0x29,
+0x0f,
+0xa8,
+0xb9,
+0x11,
+0x2c,
+0x85,
+0xc2,
+0xa5,
+0x44,
+0x45,
+0xc2,
+0x85,
+0x44,
+0x84,
+0xd1,
+0xa5,
+0x45,
+0x45,
+0xc2,
+0x18,
+0x65,
+0xd1,
+0x85,
+0x45,
+0x98,
+0x69,
+0x00,
+0x85,
+0xd1,
+0xa5,
+0x46,
+0x45,
+0xc2,
+0x18,
+0x65,
+0xd1,
+0x85,
+0x46,
+0x98,
+0x69,
+0x00,
+0x85,
+0xd1,
+0xa5,
+0x47,
+0x45,
+0xc2,
+0x18,
+0x65,
+0xd1,
+0x85,
+0x47,
+0xa5,
+0xbf,
+0xf0,
+0x6a,
+0xad,
+0x65,
+0x3c,
+0x85,
+0xc2,
+0x20,
+0xb9,
+0x1d,
+0xa5,
+0x47,
+0xc5,
+0xc8,
+0x90,
+0x27,
+0xd0,
+0x16,
+0xa5,
+0x46,
+0xc5,
+0xc7,
+0x90,
+0x1f,
+0xd0,
+0x0e,
+0xa5,
+0x45,
+0xc5,
+0xc6,
+0x90,
+0x17,
+0xd0,
+0x06,
+0xa5,
+0x44,
+0xc5,
+0xc5,
+0x90,
+0x0f,
+0xe6,
+0x38,
+0x18,
+0xa5,
+0xc0,
+0x65,
+0x3c,
+0x85,
+0x3c,
+0x90,
+0x7b,
+0xe6,
+0x3d,
+0x80,
+0x77,
+0xad,
+0x66,
+0x3c,
+0x85,
+0xc2,
+0x20,
+0xb9,
+0x1d,
+0xa5,
+0x47,
+0xc5,
+0xc8,
+0x90,
+0x4d,
+0xd0,
+0x16,
+0xa5,
+0x46,
+0xc5,
+0xc7,
+0x90,
+0x45,
+0xd0,
+0x0e,
+0xa5,
+0x45,
+0xc5,
+0xc6,
+0x90,
+0x3d,
+0xd0,
+0x06,
+0xa5,
+0x44,
+0xc5,
+0xc5,
+0x90,
+0x35,
+0xe6,
+0x39,
+0x18,
+0xa5,
+0xc0,
+0x65,
+0x3e,
+0x85,
+0x3e,
+0x90,
+0x46,
+0xe6,
+0x3f,
+0x80,
+0x42,
+0xad,
+0x67,
+0x3c,
+0x85,
+0xc2,
+0x20,
+0xb9,
+0x1d,
+0xa5,
+0xc8,
+0xc5,
+0x47,
+0x90,
+0x27,
+0xd0,
+0x16,
+0xa5,
+0xc7,
+0xc5,
+0x46,
+0x90,
+0x1f,
+0xd0,
+0x0e,
+0xa5,
+0xc6,
+0xc5,
+0x45,
+0x90,
+0x17,
+0xd0,
+0x06,
+0xa5,
+0xc5,
+0xc5,
+0x44,
+0x90,
+0x0f,
+0xe6,
+0x3a,
+0x18,
+0xa5,
+0xc0,
+0x65,
+0x40,
+0x85,
+0x40,
+0x90,
+0x11,
+0xe6,
+0x41,
+0x80,
+0x0d,
+0xe6,
+0x3b,
+0x18,
+0xa5,
+0xc0,
+0x65,
+0x42,
+0x85,
+0x42,
+0x90,
+0x02,
+0xe6,
+0x43,
+0xa5,
+0xb6,
+0xd0,
+0x01,
+0x60,
+0xa6,
+0xbd,
+0xbd,
+0xe7,
+0x2b,
+0x25,
+0x21,
+0xd0,
+0x01,
+0x60,
+0x85,
+0xcf,
+0xa0,
+0x00,
+0xa9,
+0x01,
+0x85,
+0xd0,
+0x25,
+0xcf,
+0xd0,
+0x03,
+0x4c,
+0x44,
+0x20,
+0x98,
+0xfc,
+0x49,
+0x10,
+0xdc,
+0xaa,
+0x18,
+0xa5,
+0xd3,
+0x7d,
+0xff,
+0x2c,
+0x9d,
+0xff,
+0x2c,
+0xa5,
+0xd4,
+0x7d,
+0x00,
+0x2d,
+0x9d,
+0x00,
+0x2d,
+0xa5,
+0xd5,
+0x7d,
+0x01,
+0x2d,
+0x9d,
+0x01,
+0x2d,
+0xa5,
+0xd6,
+0x7d,
+0x02,
+0x2d,
+0x9d,
+0x02,
+0x2d,
+0x18,
+0xa5,
+0xd7,
+0x7d,
+0x03,
+0x2d,
+0x9d,
+0x03,
+0x2d,
+0xa5,
+0xd8,
+0x7d,
+0x04,
+0x2d,
+0x9d,
+0x04,
+0x2d,
+0xa5,
+0xd9,
+0x7d,
+0x05,
+0x2d,
+0x9d,
+0x05,
+0x2d,
+0xa5,
+0xda,
+0x7d,
+0x06,
+0x2d,
+0x9d,
+0x06,
+0x2d,
+0x18,
+0xa5,
+0xdb,
+0x7d,
+0x07,
+0x2d,
+0x9d,
+0x07,
+0x2d,
+0xa5,
+0xdc,
+0x7d,
+0x08,
+0x2d,
+0x9d,
+0x08,
+0x2d,
+0xa5,
+0xdd,
+0x7d,
+0x09,
+0x2d,
+0x9d,
+0x09,
+0x2d,
+0xa5,
+0xde,
+0x7d,
+0x0a,
+0x2d,
+0x9d,
+0x0a,
+0x2d,
+0x18,
+0xa5,
+0xdf,
+0x7d,
+0x0b,
+0x2d,
+0x9d,
+0x0b,
+0x2d,
+0xa5,
+0xe0,
+0x7d,
+0x0c,
+0x2d,
+0x9d,
+0x0c,
+0x2d,
+0x90,
+0x03,
+0xfe,
+0x0d,
+0x2d,
+0xc8,
+0xc4,
+0xb6,
+0xb0,
+0x06,
+0xa5,
+0xd0,
+0x0a,
+0x4c,
+0xbc,
+0x1f,
+0x60,
+0xaa,
+0xa5,
+0x6c,
+0xd0,
+0x03,
+0x4c,
+0xc1,
+0x20,
+0xa5,
+0x6d,
+0xc9,
+0x00,
+0xf0,
+0xf7,
+0x8a,
+0x29,
+0x01,
+0xf0,
+0x06,
+0xa2,
+0x38,
+0xa9,
+0x04,
+0x80,
+0x04,
+0xa2,
+0x38,
+0xa9,
+0x03,
+0x8e,
+0x0c,
+0x60,
+0x8d,
+0x0d,
+0x60,
+0xa4,
+0xaf,
+0xb9,
+0xf7,
+0x2b,
+0x85,
+0x21,
+0xb9,
+0xdb,
+0x2b,
+0xa8,
+0xb9,
+0x3b,
+0x28,
+0x49,
+0x04,
+0x18,
+0x69,
+0x10,
+0x85,
+0xc9,
+0xa9,
+0x00,
+0x69,
+0x3c,
+0x85,
+0xca,
+0xa5,
+0x79,
+0x29,
+0x02,
+0xf0,
+0x07,
+0x18,
+0xa5,
+0x66,
+0xe5,
+0xaf,
+0x80,
+0x02,
+0xa5,
+0xaf,
+0x45,
+0x70,
+0xa8,
+0xb9,
+0x3b,
+0x28,
+0x49,
+0x04,
+0x18,
+0x69,
+0x2f,
+0x85,
+0xcb,
+0xa9,
+0x00,
+0x69,
+0x3c,
+0x85,
+0xcc,
+0x64,
+0xbd,
+0xa6,
+0x65,
+0x86,
+0xbe,
+0x80,
+0x02,
+0xe6,
+0xbd,
+0x20,
+0xe7,
+0x1d,
+0xc6,
+0xbe,
+0xd0,
+0xf7,
+0xe6,
+0xaf,
+0x60,
+0x64,
+0xc3,
+0x64,
+0xc4,
+0xa2,
+0x10,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0x26,
+0xc3,
+0x26,
+0xc4,
+0xa5,
+0xc3,
+0x38,
+0xe5,
+0xbd,
+0xa8,
+0xa5,
+0xc4,
+0xe9,
+0x00,
+0x90,
+0x06,
+0x85,
+0xc4,
+0x84,
+0xc3,
+0xe6,
+0xc1,
+0xca,
+0xd0,
+0xe3,
+0x60,
+0x18,
+0xa5,
+0xc1,
+0x65,
+0xc5,
+0x85,
+0xc5,
+0xa2,
+0x00,
+0xa5,
+0xc2,
+0x10,
+0x02,
+0xa2,
+0xff,
+0x86,
+0xbd,
+0x65,
+0xc6,
+0x85,
+0xc6,
+0xa5,
+0xc7,
+0x65,
+0xbd,
+0x85,
+0xc7,
+0xa5,
+0xc8,
+0x65,
+0xbd,
+0x85,
+0xc8,
+0x60,
+0xa5,
+0xc1,
+0x45,
+0xc3,
+0x85,
+0xc5,
+0x84,
+0xc6,
+0xa5,
+0xc1,
+0x45,
+0xc4,
+0x18,
+0x65,
+0xc6,
+0x85,
+0xc6,
+0x98,
+0x69,
+0x00,
+0x85,
+0xc7,
+0x64,
+0xc8,
+0xa5,
+0xc2,
+0x45,
+0xc3,
+0x18,
+0x65,
+0xc6,
+0x85,
+0xc6,
+0x98,
+0x65,
+0xc7,
+0x85,
+0xc7,
+0x90,
+0x02,
+0xe6,
+0xc8,
+0xa5,
+0xc2,
+0x45,
+0xc4,
+0x18,
+0x65,
+0xc7,
+0x85,
+0xc7,
+0x98,
+0x65,
+0xc8,
+0x85,
+0xc8,
+0x60,
+0x20,
+0x0a,
+0x21,
+0xa5,
+0xc4,
+0x10,
+0x0d,
+0x38,
+0xa5,
+0xc7,
+0xe5,
+0xc1,
+0x85,
+0xc7,
+0xa5,
+0xc8,
+0xe5,
+0xc2,
+0x85,
+0xc8,
+0x60,
+0xfc,
+0x49,
+0x20,
+0x98,
+0x4a,
+0x69,
+0x00,
+0x85,
+0xbd,
+0x8a,
+0x49,
+0x10,
+0xc0,
+0x00,
+0xd0,
+0x09,
+0x18,
+0x65,
+0xbd,
+0xb0,
+0x04,
+0xc9,
+0x7f,
+0x90,
+0x02,
+0xa9,
+0x7f,
+0x60,
+0xfc,
+0x49,
+0x10,
+0x98,
+0x4a,
+0x69,
+0x00,
+0x85,
+0xbd,
+0x8a,
+0x49,
+0x08,
+0x18,
+0x65,
+0xbd,
+0xd0,
+0x01,
+0x3a,
+0x60,
+0x20,
+0xac,
+0x21,
+0x46,
+0xc2,
+0x66,
+0xc1,
+0x90,
+0x06,
+0xe6,
+0xc1,
+0xd0,
+0x02,
+0xe6,
+0xc2,
+0x38,
+0xa5,
+0xc3,
+0xe5,
+0xc1,
+0xa5,
+0xc4,
+0xe5,
+0xc2,
+0x30,
+0x0a,
+0xe6,
+0xc5,
+0xd0,
+0x06,
+0xe6,
+0xc6,
+0xd0,
+0x02,
+0xe6,
+0xc7,
+0x60,
+0x64,
+0xc3,
+0x64,
+0xc4,
+0x64,
+0xbd,
+0xa2,
+0x18,
+0x06,
+0xc5,
+0x26,
+0xc6,
+0x26,
+0xc7,
+0x26,
+0xc3,
+0x26,
+0xc4,
+0x26,
+0xbd,
+0xa5,
+0xc3,
+0x38,
+0xe5,
+0xc1,
+0xa8,
+0xa5,
+0xc4,
+0xe5,
+0xc2,
+0x85,
+0xbe,
+0xa5,
+0xbd,
+0xe9,
+0x00,
+0x90,
+0x0a,
+0x85,
+0xbd,
+0xa5,
+0xbe,
+0x85,
+0xc4,
+0x84,
+0xc3,
+0xe6,
+0xc5,
+0xca,
+0xd0,
+0xd5,
+0x60,
+0xa9,
+0x00,
+0xaa,
+0x38,
+0xe5,
+0xc5,
+0x85,
+0xc5,
+0x8a,
+0xe5,
+0xc6,
+0x85,
+0xc6,
+0x8a,
+0xe5,
+0xc7,
+0x85,
+0xc7,
+0x8a,
+0xe5,
+0xc8,
+0x85,
+0xc8,
+0x8a,
+0x38,
+0xe5,
+0xc9,
+0x85,
+0xc9,
+0x8a,
+0xe5,
+0xca,
+0x85,
+0xca,
+0x8a,
+0xe5,
+0xcb,
+0x85,
+0xcb,
+0x8a,
+0xe5,
+0xcc,
+0x85,
+0xcc,
+0x60,
+0xa5,
+0xc8,
+0x05,
+0xcc,
+0xf0,
+0x2b,
+0x38,
+0xa5,
+0xc8,
+0xe5,
+0xcc,
+0x30,
+0x04,
+0xa5,
+0xc8,
+0x80,
+0x11,
+0xa5,
+0xcc,
+0x80,
+0x0d,
+0x26,
+0xc6,
+0x26,
+0xc7,
+0x26,
+0xc8,
+0x26,
+0xca,
+0x26,
+0xcb,
+0x26,
+0xcc,
+0x0a,
+0x10,
+0xf1,
+0xa0,
+0x02,
+0x53,
+0xc7,
+0x00,
+0xc1,
+0x00,
+0x53,
+0xcb,
+0x00,
+0xc3,
+0x00,
+0x60,
+0xa5,
+0xc7,
+0x05,
+0xcb,
+0xf0,
+0x2b,
+0x38,
+0xa5,
+0xc7,
+0xe5,
+0xcb,
+0x30,
+0x04,
+0xa5,
+0xc7,
+0x80,
+0x11,
+0xa5,
+0xcb,
+0x80,
+0x0d,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0x26,
+0xc7,
+0x26,
+0xc9,
+0x26,
+0xca,
+0x26,
+0xcb,
+0x0a,
+0x10,
+0xf1,
+0xa0,
+0x02,
+0x53,
+0xc6,
+0x00,
+0xc1,
+0x00,
+0x53,
+0xca,
+0x00,
+0xc3,
+0x00,
+0x60,
+0xa5,
+0xc6,
+0x30,
+0x0e,
+0xa5,
+0xca,
+0x30,
+0x0a,
+0x06,
+0xc5,
+0x26,
+0xc6,
+0x06,
+0xc9,
+0x26,
+0xca,
+0x80,
+0xee,
+0xa0,
+0x02,
+0x53,
+0xc5,
+0x00,
+0xc1,
+0x00,
+0x53,
+0xc9,
+0x00,
+0xc3,
+0x00,
+0x60,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xb4,
+0x26,
+0x48,
+0xee,
+0xa8,
+0x2c,
+0xd0,
+0x08,
+0xee,
+0xa9,
+0x2c,
+0xd0,
+0x03,
+0xee,
+0xaa,
+0x2c,
+0xf8,
+0xad,
+0x08,
+0x68,
+0xc9,
+0x01,
+0xd0,
+0x4b,
+0xa5,
+0x12,
+0xf0,
+0x1e,
+0x64,
+0x12,
+0xa5,
+0x11,
+0x09,
+0x03,
+0x85,
+0x11,
+0xa0,
+0x48,
+0x53,
+0x0b,
+0x02,
+0x18,
+0x2c,
+0xa0,
+0x03,
+0x53,
+0xa8,
+0x2c,
+0xab,
+0x2c,
+0xad,
+0xa4,
+0x02,
+0x8d,
+0x5f,
+0x2c,
+0x80,
+0x1c,
+0xe6,
+0x12,
+0xa5,
+0x11,
+0x09,
+0x30,
+0x85,
+0x11,
+0xa0,
+0x48,
+0x53,
+0x0b,
+0x02,
+0x60,
+0x2c,
+0xa0,
+0x03,
+0x53,
+0xa8,
+0x2c,
+0xae,
+0x2c,
+0xad,
+0xa4,
+0x02,
+0x8d,
+0xa7,
+0x2c,
+0x9c,
+0x18,
+0x68,
+0xee,
+0x18,
+0x68,
+0xa5,
+0x10,
+0xd0,
+0x03,
+0x20,
+0x41,
+0x27,
+0x4c,
+0x16,
+0x27,
+0xa9,
+0x01,
+0x8d,
+0x18,
+0x68,
+0x68,
+0x68,
+0x68,
+0xa9,
+0x03,
+0x48,
+0xa9,
+0x00,
+0x48,
+0xba,
+0xda,
+0x40,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xb4,
+0x26,
+0x48,
+0xf8,
+0xad,
+0x34,
+0x60,
+0xaa,
+0x29,
+0x03,
+0xc9,
+0x02,
+0xd0,
+0x0f,
+0xda,
+0x64,
+0x10,
+0x20,
+0x41,
+0x27,
+0xfa,
+0xa5,
+0x71,
+0x29,
+0x02,
+0xf0,
+0x07,
+0x80,
+0x26,
+0x8a,
+0x29,
+0xf8,
+0xf0,
+0x2b,
+0x8a,
+0x29,
+0x04,
+0x48,
+0x4a,
+0x4a,
+0x20,
+0x50,
+0x20,
+0xa5,
+0xae,
+0xf0,
+0x13,
+0xc6,
+0xae,
+0x68,
+0xd0,
+0x07,
+0xa9,
+0x09,
+0x8d,
+0x38,
+0x60,
+0x80,
+0x31,
+0xa9,
+0x0d,
+0x8d,
+0x38,
+0x60,
+0x80,
+0x2a,
+0x68,
+0x20,
+0xae,
+0x1a,
+0xa9,
+0x01,
+0x8d,
+0x24,
+0x68,
+0x80,
+0x1f,
+0xa5,
+0x7e,
+0xf0,
+0x1b,
+0x3a,
+0x85,
+0x7e,
+0x8a,
+0x29,
+0x04,
+0x48,
+0x4a,
+0x4a,
+0x20,
+0x36,
+0x1a,
+0x68,
+0xd0,
+0x07,
+0xa9,
+0x01,
+0x8d,
+0x38,
+0x60,
+0x80,
+0x05,
+0xa9,
+0x05,
+0x8d,
+0x38,
+0x60,
+0x4c,
+0x16,
+0x27,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xb4,
+0x26,
+0x48,
+0xee,
+0xa5,
+0x02,
+0xd0,
+0x03,
+0xee,
+0xa6,
+0x02,
+0xa0,
+0x4f,
+0x9c,
+0x52,
+0x02,
+0x13,
+0x52,
+0x02,
+0x53,
+0x02,
+0xa9,
+0x01,
+0x9c,
+0x24,
+0x68,
+0x8d,
+0x24,
+0x68,
+0x8d,
+0x04,
+0x60,
+0x64,
+0x10,
+0x20,
+0x41,
+0x27,
+0x4c,
+0x1d,
+0x27,
+0x08,
+0x78,
+0x68,
+0x8a,
+0x29,
+0xf0,
+0xf0,
+0x09,
+0x8a,
+0x29,
+0x0f,
+0xf0,
+0x2b,
+0xa5,
+0x12,
+0xd0,
+0x27,
+0x8a,
+0x29,
+0xf0,
+0x85,
+0x11,
+0x64,
+0x14,
+0x8a,
+0x29,
+0x02,
+0x85,
+0x15,
+0xa9,
+0x2a,
+0x8d,
+0xb1,
+0x2d,
+0x64,
+0x61,
+0x64,
+0x62,
+0xa0,
+0x48,
+0x53,
+0x18,
+0x2c,
+0xb7,
+0x2c,
+0x9c,
+0xb1,
+0x2c,
+0x9c,
+0xb2,
+0x2c,
+0x9c,
+0xb3,
+0x2c,
+0x80,
+0x2b,
+0x8a,
+0x29,
+0x0f,
+0x85,
+0x11,
+0xa9,
+0x01,
+0x85,
+0x14,
+0x8a,
+0x29,
+0x20,
+0x85,
+0x15,
+0xa9,
+0x2a,
+0x8d,
+0x14,
+0x2e,
+0xa9,
+0x38,
+0x85,
+0x61,
+0xa9,
+0x03,
+0x85,
+0x62,
+0xa0,
+0x48,
+0x53,
+0x60,
+0x2c,
+0xb7,
+0x2c,
+0x9c,
+0xb4,
+0x2c,
+0x9c,
+0xb5,
+0x2c,
+0x9c,
+0xb6,
+0x2c,
+0x58,
+0xa5,
+0x15,
+0xd0,
+0x38,
+0xa0,
+0x70,
+0xa5,
+0x14,
+0xd0,
+0x0e,
+0x53,
+0xb3,
+0x2a,
+0x93,
+0x2b,
+0xa0,
+0x63,
+0x53,
+0x4f,
+0x2d,
+0x57,
+0x00,
+0x80,
+0x0c,
+0x53,
+0x23,
+0x2b,
+0x93,
+0x2b,
+0xa0,
+0x63,
+0x53,
+0xb2,
+0x2d,
+0x57,
+0x00,
+0xa5,
+0x64,
+0xcd,
+0xa8,
+0x02,
+0xd0,
+0x0b,
+0xa5,
+0x63,
+0xcd,
+0xa7,
+0x02,
+0xd0,
+0x04,
+0xa9,
+0x00,
+0x80,
+0x02,
+0xa9,
+0x01,
+0x85,
+0x6e,
+0xa5,
+0x15,
+0x20,
+0x51,
+0x04,
+0x85,
+0xb9,
+0xf0,
+0x03,
+0x4c,
+0xe6,
+0x24,
+0x64,
+0x7f,
+0x64,
+0xaf,
+0xa0,
+0x02,
+0x53,
+0x61,
+0x00,
+0x30,
+0x60,
+0xa9,
+0x00,
+0x8d,
+0x0c,
+0x60,
+0x9c,
+0x0d,
+0x60,
+0xa5,
+0x65,
+0x0a,
+0xa8,
+0x43,
+0x93,
+0x2b,
+0x54,
+0x60,
+0xa9,
+0x20,
+0x8d,
+0x0c,
+0x60,
+0x9c,
+0x0d,
+0x60,
+0xa5,
+0x66,
+0x0a,
+0xa8,
+0x43,
+0xb3,
+0x2b,
+0x54,
+0x60,
+0xa5,
+0x66,
+0x85,
+0x7e,
+0x3a,
+0x85,
+0xae,
+0xa9,
+0x02,
+0x48,
+0x20,
+0x36,
+0x1a,
+0x68,
+0xc6,
+0x7e,
+0xf0,
+0x03,
+0x3a,
+0xd0,
+0xf4,
+0xa5,
+0x14,
+0xd0,
+0x27,
+0xa0,
+0x93,
+0x53,
+0x0c,
+0x2a,
+0xe6,
+0x28,
+0xa0,
+0x07,
+0x53,
+0x11,
+0x2c,
+0x03,
+0x2c,
+0xa0,
+0x70,
+0x53,
+0x93,
+0x2b,
+0xb3,
+0x2a,
+0xa0,
+0x63,
+0x53,
+0x57,
+0x00,
+0x4f,
+0x2d,
+0xa0,
+0x03,
+0x53,
+0xab,
+0x2c,
+0xb1,
+0x2c,
+0xa2,
+0x00,
+0x80,
+0x4d,
+0xa0,
+0x93,
+0x53,
+0x0c,
+0x2a,
+0x79,
+0x29,
+0xa0,
+0x07,
+0x53,
+0x11,
+0x2c,
+0x0a,
+0x2c,
+0xa0,
+0x70,
+0x53,
+0x93,
+0x2b,
+0x23,
+0x2b,
+0xa0,
+0x63,
+0x53,
+0x57,
+0x00,
+0xb2,
+0x2d,
+0xa0,
+0x03,
+0x53,
+0xae,
+0x2c,
+0xb4,
+0x2c,
+0xa2,
+0x01,
+0x80,
+0x26,
+0xa6,
+0x14,
+0xd0,
+0x12,
+0xa0,
+0x63,
+0x53,
+0x57,
+0x00,
+0x4f,
+0x2d,
+0xa0,
+0x03,
+0x53,
+0xab,
+0x2c,
+0xb1,
+0x2c,
+0xa2,
+0x00,
+0x80,
+0x10,
+0xa0,
+0x63,
+0x53,
+0x57,
+0x00,
+0xb2,
+0x2d,
+0xa0,
+0x03,
+0x53,
+0xae,
+0x2c,
+0xb4,
+0x2c,
+0xa2,
+0x01,
+0xa5,
+0x15,
+0xf0,
+0x04,
+0x86,
+0x13,
+0x64,
+0x15,
+0x9c,
+0x1c,
+0x68,
+0xee,
+0x1c,
+0x68,
+0x60,
+0xf8,
+0xa6,
+0x11,
+0xda,
+0xa6,
+0x11,
+0xf0,
+0x05,
+0x20,
+0xa8,
+0x23,
+0x80,
+0xf7,
+0xfa,
+0xf0,
+0x0f,
+0xad,
+0xba,
+0x02,
+0xf0,
+0x0a,
+0xa0,
+0x02,
+0x53,
+0x63,
+0x00,
+0x09,
+0x02,
+0x20,
+0x55,
+0x25,
+0x9c,
+0xdd,
+0x28,
+0x4c,
+0x33,
+0x27,
+0x5a,
+0xda,
+0x48,
+0x20,
+0xb4,
+0x26,
+0x48,
+0xf8,
+0xad,
+0x0c,
+0x68,
+0xc9,
+0x01,
+0xd0,
+0x03,
+0x20,
+0x55,
+0x25,
+0x4c,
+0x16,
+0x27,
+0x9c,
+0x20,
+0x68,
+0x9c,
+0x24,
+0x68,
+0x9c,
+0x28,
+0x68,
+0xa5,
+0x10,
+0xf0,
+0x05,
+0xa9,
+0x08,
+0x4c,
+0x98,
+0x25,
+0xa2,
+0x00,
+0xad,
+0x0a,
+0x02,
+0xcd,
+0x5c,
+0x2d,
+0xd0,
+0x09,
+0xad,
+0x09,
+0x02,
+0xcd,
+0x5b,
+0x2d,
+0xd0,
+0x01,
+0xe8,
+0xad,
+0x0a,
+0x02,
+0xcd,
+0xbf,
+0x2d,
+0xd0,
+0x0a,
+0xad,
+0x09,
+0x02,
+0xcd,
+0xbe,
+0x2d,
+0xd0,
+0x02,
+0xe8,
+0xe8,
+0xe0,
+0x00,
+0xd0,
+0x11,
+0xa9,
+0x05,
+0xc9,
+0x2a,
+0xd0,
+0x02,
+0xa9,
+0x05,
+0x8d,
+0x08,
+0x02,
+0xa9,
+0x01,
+0x8d,
+0x28,
+0x68,
+0x60,
+0xe0,
+0x01,
+0xf0,
+0x1d,
+0xe0,
+0x02,
+0xf0,
+0x3c,
+0x38,
+0xad,
+0xb4,
+0x2c,
+0xed,
+0xb1,
+0x2c,
+0xad,
+0xb5,
+0x2c,
+0xed,
+0xb2,
+0x2c,
+0xad,
+0xb6,
+0x2c,
+0xed,
+0xb3,
+0x2c,
+0xa9,
+0x00,
+0x69,
+0x00,
+0xd0,
+0x23,
+0xad,
+0xb1,
+0x2d,
+0xd0,
+0xcb,
+0xa0,
+0x63,
+0x53,
+0x4f,
+0x2d,
+0x57,
+0x00,
+0xa0,
+0x93,
+0x53,
+0xe6,
+0x28,
+0x0c,
+0x2a,
+0xa0,
+0x07,
+0x53,
+0x03,
+0x2c,
+0x11,
+0x2c,
+0xa0,
+0x38,
+0x53,
+0xeb,
+0x2a,
+0xcb,
+0x2b,
+0x80,
+0x21,
+0xad,
+0x14,
+0x2e,
+0xd0,
+0xa8,
+0xa0,
+0x63,
+0x53,
+0xb2,
+0x2d,
+0x57,
+0x00,
+0xa0,
+0x93,
+0x53,
+0x79,
+0x29,
+0x0c,
+0x2a,
+0xa0,
+0x07,
+0x53,
+0x0a,
+0x2c,
+0x11,
+0x2c,
+0xa0,
+0x38,
+0x53,
+0x5b,
+0x2b,
+0xcb,
+0x2b,
+0x9c,
+0x08,
+0x02,
+0xa5,
+0x11,
+0xa0,
+0x2a,
+0xae,
+0xb1,
+0x2d,
+0xe0,
+0x00,
+0xf0,
+0x0c,
+0xe0,
+0x2a,
+0xd0,
+0x0d,
+0xa6,
+0x15,
+0xe0,
+0x00,
+0xf0,
+0x02,
+0x09,
+0x03,
+0x09,
+0x01,
+0x8c,
+0xb1,
+0x2d,
+0xae,
+0x14,
+0x2e,
+0xe0,
+0x00,
+0xf0,
+0x0c,
+0xe0,
+0x2a,
+0xd0,
+0x0d,
+0xa6,
+0x15,
+0xe0,
+0x00,
+0xf0,
+0x02,
+0x09,
+0x30,
+0x09,
+0x10,
+0x8c,
+0x14,
+0x2e,
+0x85,
+0x11,
+0xa0,
+0x03,
+0x53,
+0x76,
+0x00,
+0xb0,
+0x02,
+0xa0,
+0x02,
+0x53,
+0x63,
+0x00,
+0xa7,
+0x02,
+0xa5,
+0xb7,
+0x8d,
+0xbc,
+0x02,
+0xa5,
+0xb8,
+0x8d,
+0xbb,
+0x02,
+0x20,
+0xa0,
+0x18,
+0xa9,
+0x02,
+0x8d,
+0x38,
+0x60,
+0xa9,
+0x01,
+0x8d,
+0x38,
+0x60,
+0xa9,
+0x05,
+0x8d,
+0x38,
+0x60,
+0xa9,
+0x09,
+0x8d,
+0x38,
+0x60,
+0xa5,
+0x71,
+0x29,
+0x02,
+0xd0,
+0x0e,
+0xa9,
+0x0d,
+0x8d,
+0x38,
+0x60,
+0xa0,
+0x0c,
+0x64,
+0x37,
+0x13,
+0x37,
+0x00,
+0x38,
+0x00,
+0x18,
+0xad,
+0xa2,
+0x02,
+0x69,
+0x01,
+0x8d,
+0xa2,
+0x02,
+0xad,
+0xa3,
+0x02,
+0x69,
+0x00,
+0x8d,
+0xa3,
+0x02,
+0xa5,
+0x6c,
+0x8d,
+0xad,
+0x02,
+0xa5,
+0x6e,
+0x8d,
+0xb3,
+0x02,
+0x9c,
+0xdd,
+0x28,
+0xa9,
+0x01,
+0x8d,
+0x20,
+0x68,
+0x85,
+0x10,
+0x64,
+0xb9,
+0xa0,
+0x4f,
+0x9c,
+0xff,
+0x2c,
+0x13,
+0xff,
+0x2c,
+0x00,
+0x2d,
+0x60,
+0xba,
+0x08,
+0x78,
+0x68,
+0x48,
+0x29,
+0x1c,
+0x85,
+0xbc,
+0x86,
+0xba,
+0xa9,
+0x01,
+0x85,
+0xbb,
+0xa0,
+0x06,
+0xb1,
+0xba,
+0x48,
+0x29,
+0x1c,
+0xc5,
+0xbc,
+0x90,
+0x08,
+0x7a,
+0xa0,
+0x09,
+0xb1,
+0xba,
+0x48,
+0x29,
+0x1c,
+0xc9,
+0x00,
+0xd0,
+0x38,
+0xa0,
+0x03,
+0xb1,
+0xba,
+0xe0,
+0x7f,
+0xb0,
+0x18,
+0x8d,
+0xde,
+0x28,
+0xc8,
+0xb1,
+0xba,
+0x8d,
+0xdf,
+0x28,
+0xc8,
+0xb1,
+0xba,
+0x8d,
+0xe0,
+0x28,
+0x8a,
+0x18,
+0x69,
+0x05,
+0x8d,
+0xe1,
+0x28,
+0x80,
+0x16,
+0x8d,
+0xe2,
+0x28,
+0xc8,
+0xb1,
+0xba,
+0x8d,
+0xe3,
+0x28,
+0xc8,
+0xb1,
+0xba,
+0x8d,
+0xe4,
+0x28,
+0x8a,
+0x18,
+0x69,
+0x05,
+0x8d,
+0xe5,
+0x28,
+0xa9,
+0x00,
+0xfa,
+0x28,
+0xf8,
+0x60,
+0x68,
+0xf0,
+0x04,
+0x68,
+0xfa,
+0x7a,
+0x40,
+0x08,
+0x78,
+0x68,
+0xad,
+0xdd,
+0x28,
+0xf0,
+0x0e,
+0xae,
+0xe1,
+0x28,
+0x9a,
+0xad,
+0xde,
+0x28,
+0xae,
+0xdf,
+0x28,
+0xac,
+0xe0,
+0x28,
+0x40,
+0xae,
+0xe5,
+0x28,
+0x9a,
+0xad,
+0xe2,
+0x28,
+0xae,
+0xe3,
+0x28,
+0xac,
+0xe4,
+0x28,
+0x40,
+0x08,
+0x78,
+0xad,
+0xdd,
+0x28,
+0xd0,
+0x1f,
+0x1a,
+0x8d,
+0xdd,
+0x28,
+0xa9,
+0x7c,
+0x8d,
+0xe1,
+0x28,
+0x9c,
+0xde,
+0x28,
+0x9c,
+0xdf,
+0x28,
+0x9c,
+0xe0,
+0x28,
+0xa9,
+0x25,
+0x8d,
+0x7f,
+0x01,
+0xa9,
+0x1b,
+0x8d,
+0x7e,
+0x01,
+0x9c,
+0x7d,
+0x01,
+0x28,
+0x60,
+0x64,
+0xc1,
+0x64,
+0xc2,
+0xa9,
+0x25,
+0x4a,
+0x85,
+0xc6,
+0xa9,
+0xc7,
+0x6a,
+0xaa,
+0x90,
+0x06,
+0xac,
+0xc6,
+0x28,
+0x84,
+0xc1,
+0x18,
+0xa9,
+0x00,
+0x85,
+0xc3,
+0xa9,
+0x03,
+0x85,
+0xc4,
+0xa0,
+0x00,
+0xb1,
+0xc3,
+0x65,
+0xc1,
+0x85,
+0xc1,
+0xc8,
+0xb1,
+0xc3,
+0x65,
+0xc2,
+0x85,
+0xc2,
+0xca,
+0xd0,
+0x07,
+0xa5,
+0xc6,
+0xf0,
+0x0a,
+0x3a,
+0x85,
+0xc6,
+0xc8,
+0xd0,
+0xe6,
+0xe6,
+0xc4,
+0x80,
+0xe2,
+0xa5,
+0xc1,
+0x05,
+0xc2,
+0x60,
+0x64,
+0xc5,
+0x64,
+0xc6,
+0xa2,
+0x10,
+0x06,
+0xc1,
+0x26,
+0xc2,
+0x26,
+0xc5,
+0x26,
+0xc6,
+0xa5,
+0xc5,
+0x38,
+0xe5,
+0xc3,
+0xa8,
+0xa5,
+0xc6,
+0xe5,
+0xc4,
+0x90,
+0x06,
+0x85,
+0xc6,
+0x84,
+0xc5,
+0xe6,
+0xc1,
+0xca,
+0xd0,
+0xe3,
+0x60,
+0x20,
+0xab,
+0x27,
+0x46,
+0xc4,
+0x66,
+0xc3,
+0x90,
+0x06,
+0xe6,
+0xc3,
+0xd0,
+0x02,
+0xe6,
+0xc4,
+0x38,
+0xa5,
+0xc5,
+0xe5,
+0xc3,
+0xa5,
+0xc6,
+0xe5,
+0xc4,
+0x30,
+0x06,
+0xe6,
+0xc1,
+0xd0,
+0x02,
+0xe6,
+0xc2,
+0x60,
+0x43,
+0x6f,
+0x70,
+0x79,
+0x72,
+0x69,
+0x67,
+0x68,
+0x74,
+0x20,
+0x28,
+0x43,
+0x29,
+0x20,
+0x44,
+0x78,
+0x4f,
+0x20,
+0x4c,
+0x61,
+0x62,
+0x73,
+0x20,
+0x32,
+0x30,
+0x30,
+0x39,
+0x2d,
+0x32,
+0x30,
+0x31,
+0x32,
+0x20,
+0x2d,
+0x20,
+0x28,
+0x41,
+0x6c,
+0x6c,
+0x20,
+0x72,
+0x69,
+0x67,
+0x74,
+0x68,
+0x73,
+0x20,
+0x72,
+0x65,
+0x73,
+0x65,
+0x72,
+0x76,
+0x65,
+0x64,
+0x29,
+0x00,
+0x08,
+0x6f,
+0x00,
+0x01,
+0x02,
+0x03,
+0x04,
+0x05,
+0x06,
+0x07,
+0x07,
+0x06,
+0x05,
+0x04,
+0x03,
+0x02,
+0x01,
+0x00,
+0x00,
+0x01,
+0x02,
+0x03,
+0x04,
+0x05,
+0x05,
+0x04,
+0x03,
+0x02,
+0x01,
+0x00,
+0x00,
+0x00,
+0x01,
+0x81,
+0x02,
+0x42,
+0x82,
+0xc2,
+0x03,
+0x23,
+0x43,
+0x63,
+0x83,
+0xa3,
+0xc3,
+0xe3,
+0x04,
+0x14,
+0x24,
+0x34,
+0x44,
+0x54,
+0x64,
+0x74,
+0x84,
+0x94,
+0xa4,
+0xb4,
+0xc4,
+0xd4,
+0xe4,
+0xf4,
+0x05,
+0x05,
+0x15,
+0x15,
+0x25,
+0x25,
+0x35,
+0x35,
+0x45,
+0x45,
+0x55,
+0x55,
+0x65,
+0x65,
+0x75,
+0x75,
+0x85,
+0x85,
+0x95,
+0x95,
+0xa5,
+0xa5,
+0xb5,
+0xb5,
+0xc5,
+0xc5,
+0xd5,
+0xd5,
+0xe5,
+0xe5,
+0xf5,
+0xf5,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x3f,
+0x39,
+0x33,
+0x2f,
+0x2b,
+0x27,
+0x25,
+0x22,
+0x20,
+0x1e,
+0x1c,
+0x1b,
+0x1a,
+0x18,
+0x17,
+0x16,
+0x15,
+0x14,
+0x14,
+0x13,
+0x12,
+0x12,
+0x11,
+0x11,
+0x10,
+0x10,
+0x0f,
+0x0f,
+0x0e,
+0x0e,
+0x0d,
+0x0d,
+0x0d,
+0x0c,
+0x0c,
+0x0c,
+0x0c,
+0x0b,
+0x0b,
+0x0b,
+0x0b,
+0x0a,
+0x0a,
+0x0a,
+0x0a,
+0x0a,
+0x09,
+0x09,
+0x09,
+0x09,
+0x09,
+0x09,
+0x09,
+0x08,
+0x08,
+0x08,
+};
+
+struct yushan_reg_u_code_t yushan_u_code_r3 = {
+	.pdpcode_first_addr = 0x0234,
+	.pdpcode = &pdpcode_u_1_8[0],
+	.pdpcode_size = ARRAY_SIZE(pdpcode_u_1_8),
+
+	.pdpBootAddr  = 0x1a00,
+	.pdpStartAddr = 0x0234,
+
+	.dppcode_first_addr = 0x0300,
+	.dppcode = &dppcode_u_1_8[0],
+	.dppcode_size = ARRAY_SIZE(dppcode_u_1_8),
+
+	.dppBootAddr  = 0xd000,
+	.dppStartAddr = 0x0300,
+
+	.dopcode_first_addr = 0x0300,
+	.dopcode = &dopcode_u_2_1[0],
+	.dopcode_size = ARRAY_SIZE(dopcode_u_2_1),
+
+	.dopBootAddr  = 0x6800,
+	.dopStartAddr = 0x0300,
+
+
+};
+
diff --git a/drivers/media/video/msm/s5k3e2fx.c b/drivers/media/video/msm/s5k3e2fx.c
deleted file mode 100644
index f7591d9..0000000
--- a/drivers/media/video/msm/s5k3e2fx.c
+++ /dev/null
@@ -1,1387 +0,0 @@
-/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include "s5k3e2fx.h"
-
-#define S5K3E2FX_REG_MODEL_ID   0x0000
-#define S5K3E2FX_MODEL_ID       0x3E2F
-
-/* PLL Registers */
-#define REG_PRE_PLL_CLK_DIV           0x0305
-#define REG_PLL_MULTIPLIER_MSB        0x0306
-#define REG_PLL_MULTIPLIER_LSB        0x0307
-#define REG_VT_PIX_CLK_DIV            0x0301
-#define REG_VT_SYS_CLK_DIV            0x0303
-#define REG_OP_PIX_CLK_DIV            0x0309
-#define REG_OP_SYS_CLK_DIV            0x030B
-
-/* Data Format Registers */
-#define REG_CCP_DATA_FORMAT_MSB       0x0112
-#define REG_CCP_DATA_FORMAT_LSB       0x0113
-
-/* Output Size */
-#define REG_X_OUTPUT_SIZE_MSB         0x034C
-#define REG_X_OUTPUT_SIZE_LSB         0x034D
-#define REG_Y_OUTPUT_SIZE_MSB         0x034E
-#define REG_Y_OUTPUT_SIZE_LSB         0x034F
-
-/* Binning */
-#define REG_X_EVEN_INC                0x0381
-#define REG_X_ODD_INC                 0x0383
-#define REG_Y_EVEN_INC                0x0385
-#define REG_Y_ODD_INC                 0x0387
-/*Reserved register */
-#define REG_BINNING_ENABLE            0x3014
-
-/* Frame Fotmat */
-#define REG_FRAME_LENGTH_LINES_MSB    0x0340
-#define REG_FRAME_LENGTH_LINES_LSB    0x0341
-#define REG_LINE_LENGTH_PCK_MSB       0x0342
-#define REG_LINE_LENGTH_PCK_LSB       0x0343
-
-/* MSR setting */
-/* Reserved registers */
-#define REG_SHADE_CLK_ENABLE          0x30AC
-#define REG_SEL_CCP                   0x30C4
-#define REG_VPIX                      0x3024
-#define REG_CLAMP_ON                  0x3015
-#define REG_OFFSET                    0x307E
-
-/* CDS timing settings */
-/* Reserved registers */
-#define REG_LD_START                  0x3000
-#define REG_LD_END                    0x3001
-#define REG_SL_START                  0x3002
-#define REG_SL_END                    0x3003
-#define REG_RX_START                  0x3004
-#define REG_S1_START                  0x3005
-#define REG_S1_END                    0x3006
-#define REG_S1S_START                 0x3007
-#define REG_S1S_END                   0x3008
-#define REG_S3_START                  0x3009
-#define REG_S3_END                    0x300A
-#define REG_CMP_EN_START              0x300B
-#define REG_CLP_SL_START              0x300C
-#define REG_CLP_SL_END                0x300D
-#define REG_OFF_START                 0x300E
-#define REG_RMP_EN_START              0x300F
-#define REG_TX_START                  0x3010
-#define REG_TX_END                    0x3011
-#define REG_STX_WIDTH                 0x3012
-#define REG_TYPE1_AF_ENABLE           0x3130
-#define DRIVER_ENABLED                0x0001
-#define AUTO_START_ENABLED            0x0010
-#define REG_NEW_POSITION              0x3131
-#define REG_3152_RESERVED             0x3152
-#define REG_315A_RESERVED             0x315A
-#define REG_ANALOGUE_GAIN_CODE_GLOBAL_MSB 0x0204
-#define REG_ANALOGUE_GAIN_CODE_GLOBAL_LSB 0x0205
-#define REG_FINE_INTEGRATION_TIME         0x0200
-#define REG_COARSE_INTEGRATION_TIME       0x0202
-#define REG_COARSE_INTEGRATION_TIME_LSB   0x0203
-
-/* Mode select register */
-#define S5K3E2FX_REG_MODE_SELECT      0x0100
-#define S5K3E2FX_MODE_SELECT_STREAM     0x01   /* start streaming */
-#define S5K3E2FX_MODE_SELECT_SW_STANDBY 0x00   /* software standby */
-#define S5K3E2FX_REG_SOFTWARE_RESET   0x0103
-#define S5K3E2FX_SOFTWARE_RESET         0x01
-#define REG_TEST_PATTERN_MODE         0x0601
-
-struct reg_struct {
-  uint8_t pre_pll_clk_div;               /* 0x0305 */
-  uint8_t pll_multiplier_msb;            /* 0x0306 */
-  uint8_t pll_multiplier_lsb;            /* 0x0307 */
-  uint8_t vt_pix_clk_div;                /* 0x0301 */
-  uint8_t vt_sys_clk_div;                /* 0x0303 */
-  uint8_t op_pix_clk_div;                /* 0x0309 */
-  uint8_t op_sys_clk_div;                /* 0x030B */
-  uint8_t ccp_data_format_msb;           /* 0x0112 */
-  uint8_t ccp_data_format_lsb;           /* 0x0113 */
-  uint8_t x_output_size_msb;             /* 0x034C */
-  uint8_t x_output_size_lsb;             /* 0x034D */
-  uint8_t y_output_size_msb;             /* 0x034E */
-  uint8_t y_output_size_lsb;             /* 0x034F */
-  uint8_t x_even_inc;                    /* 0x0381 */
-  uint8_t x_odd_inc;                     /* 0x0383 */
-  uint8_t y_even_inc;                    /* 0x0385 */
-  uint8_t y_odd_inc;                     /* 0x0387 */
-  uint8_t binning_enable;                /* 0x3014 */
-  uint8_t frame_length_lines_msb;        /* 0x0340 */
-  uint8_t frame_length_lines_lsb;        /* 0x0341 */
-  uint8_t line_length_pck_msb;           /* 0x0342 */
-  uint8_t line_length_pck_lsb;           /* 0x0343 */
-  uint8_t shade_clk_enable ;             /* 0x30AC */
-  uint8_t sel_ccp;                       /* 0x30C4 */
-  uint8_t vpix;                          /* 0x3024 */
-  uint8_t clamp_on;                      /* 0x3015 */
-  uint8_t offset;                        /* 0x307E */
-  uint8_t ld_start;                      /* 0x3000 */
-  uint8_t ld_end;                        /* 0x3001 */
-  uint8_t sl_start;                      /* 0x3002 */
-  uint8_t sl_end;                        /* 0x3003 */
-  uint8_t rx_start;                      /* 0x3004 */
-  uint8_t s1_start;                      /* 0x3005 */
-  uint8_t s1_end;                        /* 0x3006 */
-  uint8_t s1s_start;                     /* 0x3007 */
-  uint8_t s1s_end;                       /* 0x3008 */
-  uint8_t s3_start;                      /* 0x3009 */
-  uint8_t s3_end;                        /* 0x300A */
-  uint8_t cmp_en_start;                  /* 0x300B */
-  uint8_t clp_sl_start;                  /* 0x300C */
-  uint8_t clp_sl_end;                    /* 0x300D */
-  uint8_t off_start;                     /* 0x300E */
-  uint8_t rmp_en_start;                  /* 0x300F */
-  uint8_t tx_start;                      /* 0x3010 */
-  uint8_t tx_end;                        /* 0x3011 */
-  uint8_t stx_width;                     /* 0x3012 */
-  uint8_t reg_3152_reserved;             /* 0x3152 */
-  uint8_t reg_315A_reserved;             /* 0x315A */
-  uint8_t analogue_gain_code_global_msb; /* 0x0204 */
-  uint8_t analogue_gain_code_global_lsb; /* 0x0205 */
-  uint8_t fine_integration_time;         /* 0x0200 */
-  uint8_t coarse_integration_time;       /* 0x0202 */
-  uint32_t  size_h;
-  uint32_t  blk_l;
-  uint32_t  size_w;
-  uint32_t  blk_p;
-};
-
-struct reg_struct s5k3e2fx_reg_pat[2] =  {
-  {	/* Preview */
-    0x06,  /* pre_pll_clk_div       REG=0x0305 */
-    0x00,  /* pll_multiplier_msb    REG=0x0306 */
-    0x88,  /* pll_multiplier_lsb    REG=0x0307 */
-    0x0a,  /* vt_pix_clk_div        REG=0x0301 */
-    0x01,  /* vt_sys_clk_div        REG=0x0303 */
-    0x0a,  /* op_pix_clk_div        REG=0x0309 */
-    0x01,  /* op_sys_clk_div        REG=0x030B */
-    0x0a,  /* ccp_data_format_msb   REG=0x0112 */
-    0x0a,  /* ccp_data_format_lsb   REG=0x0113 */
-    0x05,  /* x_output_size_msb     REG=0x034C */
-    0x10,  /* x_output_size_lsb     REG=0x034D */
-    0x03,  /* y_output_size_msb     REG=0x034E */
-    0xcc,  /* y_output_size_lsb     REG=0x034F */
-
-    /* enable binning for preview */
-    0x01,  /* x_even_inc             REG=0x0381 */
-    0x01,  /* x_odd_inc              REG=0x0383 */
-    0x01,  /* y_even_inc             REG=0x0385 */
-    0x03,  /* y_odd_inc              REG=0x0387 */
-    0x06,  /* binning_enable         REG=0x3014 */
-
-    0x03,  /* frame_length_lines_msb        REG=0x0340 */
-    0xde,  /* frame_length_lines_lsb        REG=0x0341 */
-    0x0a,  /* line_length_pck_msb           REG=0x0342 */
-    0xac,  /* line_length_pck_lsb           REG=0x0343 */
-    0x81,  /* shade_clk_enable              REG=0x30AC */
-    0x01,  /* sel_ccp                       REG=0x30C4 */
-    0x04,  /* vpix                          REG=0x3024 */
-    0x00,  /* clamp_on                      REG=0x3015 */
-    0x02,  /* offset                        REG=0x307E */
-    0x03,  /* ld_start                      REG=0x3000 */
-    0x9c,  /* ld_end                        REG=0x3001 */
-    0x02,  /* sl_start                      REG=0x3002 */
-    0x9e,  /* sl_end                        REG=0x3003 */
-    0x05,  /* rx_start                      REG=0x3004 */
-    0x0f,  /* s1_start                      REG=0x3005 */
-    0x24,  /* s1_end                        REG=0x3006 */
-    0x7c,  /* s1s_start                     REG=0x3007 */
-    0x9a,  /* s1s_end                       REG=0x3008 */
-    0x10,  /* s3_start                      REG=0x3009 */
-    0x14,  /* s3_end                        REG=0x300A */
-    0x10,  /* cmp_en_start                  REG=0x300B */
-    0x04,  /* clp_sl_start                  REG=0x300C */
-    0x26,  /* clp_sl_end                    REG=0x300D */
-    0x02,  /* off_start                     REG=0x300E */
-    0x0e,  /* rmp_en_start                  REG=0x300F */
-    0x30,  /* tx_start                      REG=0x3010 */
-    0x4e,  /* tx_end                        REG=0x3011 */
-    0x1E,  /* stx_width                     REG=0x3012 */
-    0x08,  /* reg_3152_reserved             REG=0x3152 */
-    0x10,  /* reg_315A_reserved             REG=0x315A */
-    0x00,  /* analogue_gain_code_global_msb REG=0x0204 */
-    0x80,  /* analogue_gain_code_global_lsb REG=0x0205 */
-    0x02,  /* fine_integration_time         REG=0x0200 */
-    0x03,  /* coarse_integration_time       REG=0x0202 */
-		972,
-		18,
-		1296,
-		1436
-  },
-  { /* Snapshot */
-    0x06,  /* pre_pll_clk_div               REG=0x0305 */
-    0x00,  /* pll_multiplier_msb            REG=0x0306 */
-    0x88,  /* pll_multiplier_lsb            REG=0x0307 */
-    0x0a,  /* vt_pix_clk_div                REG=0x0301 */
-    0x01,  /* vt_sys_clk_div                REG=0x0303 */
-    0x0a,  /* op_pix_clk_div                REG=0x0309 */
-    0x01,  /* op_sys_clk_div                REG=0x030B */
-    0x0a,  /* ccp_data_format_msb           REG=0x0112 */
-    0x0a,  /* ccp_data_format_lsb           REG=0x0113 */
-    0x0a,  /* x_output_size_msb             REG=0x034C */
-    0x30,  /* x_output_size_lsb             REG=0x034D */
-    0x07,  /* y_output_size_msb             REG=0x034E */
-    0xa8,  /* y_output_size_lsb             REG=0x034F */
-
-    /* disable binning for snapshot */
-    0x01,  /* x_even_inc                    REG=0x0381 */
-    0x01,  /* x_odd_inc                     REG=0x0383 */
-    0x01,  /* y_even_inc                    REG=0x0385 */
-    0x01,  /* y_odd_inc                     REG=0x0387 */
-    0x00,  /* binning_enable                REG=0x3014 */
-
-    0x07,  /* frame_length_lines_msb        REG=0x0340 */
-    0xb6,  /* frame_length_lines_lsb        REG=0x0341 */
-    0x0a,  /* line_length_pck_msb           REG=0x0342 */
-    0xac,  /* line_length_pck_lsb           REG=0x0343 */
-    0x81,  /* shade_clk_enable              REG=0x30AC */
-    0x01,  /* sel_ccp                       REG=0x30C4 */
-    0x04,  /* vpix                          REG=0x3024 */
-    0x00,  /* clamp_on                      REG=0x3015 */
-    0x02,  /* offset                        REG=0x307E */
-    0x03,  /* ld_start                      REG=0x3000 */
-    0x9c,  /* ld_end                        REG=0x3001 */
-    0x02,  /* sl_start                      REG=0x3002 */
-    0x9e,  /* sl_end                        REG=0x3003 */
-    0x05,  /* rx_start                      REG=0x3004 */
-    0x0f,  /* s1_start                      REG=0x3005 */
-    0x24,  /* s1_end                        REG=0x3006 */
-    0x7c,  /* s1s_start                     REG=0x3007 */
-    0x9a,  /* s1s_end                       REG=0x3008 */
-    0x10,  /* s3_start                      REG=0x3009 */
-    0x14,  /* s3_end                        REG=0x300A */
-    0x10,  /* cmp_en_start                  REG=0x300B */
-    0x04,  /* clp_sl_start                  REG=0x300C */
-    0x26,  /* clp_sl_end                    REG=0x300D */
-    0x02,  /* off_start                     REG=0x300E */
-    0x0e,  /* rmp_en_start                  REG=0x300F */
-    0x30,  /* tx_start                      REG=0x3010 */
-    0x4e,  /* tx_end                        REG=0x3011 */
-    0x1E,  /* stx_width                     REG=0x3012 */
-    0x08,  /* reg_3152_reserved             REG=0x3152 */
-    0x10,  /* reg_315A_reserved             REG=0x315A */
-    0x00,  /* analogue_gain_code_global_msb REG=0x0204 */
-    0x80,  /* analogue_gain_code_global_lsb REG=0x0205 */
-    0x02,  /* fine_integration_time         REG=0x0200 */
-    0x03,  /* coarse_integration_time       REG=0x0202 */
-		1960,
-		14,
-		2608,
-		124
-	}
-};
-
-struct s5k3e2fx_work {
-	struct work_struct work;
-};
-static struct s5k3e2fx_work *s5k3e2fx_sensorw;
-static struct i2c_client *s5k3e2fx_client;
-
-struct s5k3e2fx_ctrl {
-	const struct msm_camera_sensor_info *sensordata;
-
-	int sensormode;
-	uint32_t fps_divider; /* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider; /* init to 1 * 0x00000400 */
-
-	uint16_t curr_lens_pos;
-	uint16_t init_curr_lens_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-
-	enum msm_s_resolution prev_res;
-	enum msm_s_resolution pict_res;
-	enum msm_s_resolution curr_res;
-	enum msm_s_test_mode  set_test;
-};
-
-struct s5k3e2fx_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned char  bdata;
-};
-
-static struct s5k3e2fx_ctrl *s5k3e2fx_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(s5k3e2fx_wait_queue);
-DEFINE_MUTEX(s5k3e2fx_mutex);
-
-static int s5k3e2fx_i2c_rxdata(unsigned short saddr, unsigned char *rxdata,
-	int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr   = saddr,
-			.flags = 0,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-		{
-			.addr   = saddr,
-			.flags = I2C_M_RD,
-			.len   = length,
-			.buf   = rxdata,
-		},
-	};
-
-	if (i2c_transfer(s5k3e2fx_client->adapter, msgs, 2) < 0) {
-		CDBG("s5k3e2fx_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t s5k3e2fx_i2c_txdata(unsigned short saddr,
-	unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-		.addr  = saddr,
-		.flags = 0,
-		.len = length,
-		.buf = txdata,
-		},
-	};
-
-	if (i2c_transfer(s5k3e2fx_client->adapter, msg, 1) < 0) {
-		CDBG("s5k3e2fx_i2c_txdata failed\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t s5k3e2fx_i2c_write_b(unsigned short saddr, unsigned short waddr,
-	unsigned char bdata)
-{
-	int32_t rc = -EIO;
-	unsigned char buf[4];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00)>>8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-
-	rc = s5k3e2fx_i2c_txdata(saddr, buf, 3);
-
-	if (rc < 0)
-		CDBG("i2c_write_w failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, bdata);
-
-	return rc;
-}
-
-static int32_t s5k3e2fx_i2c_write_table(
-	struct s5k3e2fx_i2c_reg_conf *reg_cfg_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-	for (i = 0; i < num; i++) {
-		rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-			reg_cfg_tbl->waddr, reg_cfg_tbl->bdata);
-		if (rc < 0)
-			break;
-		reg_cfg_tbl++;
-	}
-
-	return rc;
-}
-
-static int32_t s5k3e2fx_i2c_read_w(unsigned short saddr, unsigned short raddr,
-	unsigned short *rdata)
-{
-	int32_t rc = 0;
-	unsigned char buf[4];
-
-	if (!rdata)
-		return -EIO;
-
-	memset(buf, 0, sizeof(buf));
-
-	buf[0] = (raddr & 0xFF00)>>8;
-	buf[1] = (raddr & 0x00FF);
-
-	rc = s5k3e2fx_i2c_rxdata(saddr, buf, 2);
-	if (rc < 0)
-		return rc;
-
-	*rdata = buf[0] << 8 | buf[1];
-
-	if (rc < 0)
-		CDBG("s5k3e2fx_i2c_read failed!\n");
-
-	return rc;
-}
-
-static int s5k3e2fx_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	gpio_direction_output(data->sensor_reset, 0);
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int s5k3e2fx_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t  rc;
-	uint16_t chipid = 0;
-
-	rc = gpio_request(data->sensor_reset, "s5k3e2fx");
-	if (!rc)
-		gpio_direction_output(data->sensor_reset, 1);
-	else
-		goto init_probe_done;
-
-	mdelay(20);
-
-	CDBG("s5k3e2fx_sensor_init(): reseting sensor.\n");
-
-	rc = s5k3e2fx_i2c_read_w(s5k3e2fx_client->addr,
-		S5K3E2FX_REG_MODEL_ID, &chipid);
-	if (rc < 0)
-		goto init_probe_fail;
-
-	if (chipid != S5K3E2FX_MODEL_ID) {
-		CDBG("S5K3E2FX wrong model_id = 0x%x\n", chipid);
-		rc = -ENODEV;
-		goto init_probe_fail;
-	}
-
-	goto init_probe_done;
-
-init_probe_fail:
-	s5k3e2fx_probe_init_done(data);
-init_probe_done:
-	return rc;
-}
-
-static int s5k3e2fx_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&s5k3e2fx_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id s5k3e2fx_i2c_id[] = {
-	{ "s5k3e2fx", 0},
-	{ }
-};
-
-static int s5k3e2fx_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("s5k3e2fx_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	s5k3e2fx_sensorw = kzalloc(sizeof(struct s5k3e2fx_work), GFP_KERNEL);
-	if (!s5k3e2fx_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, s5k3e2fx_sensorw);
-	s5k3e2fx_init_client(client);
-	s5k3e2fx_client = client;
-
-	mdelay(50);
-
-	CDBG("s5k3e2fx_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("s5k3e2fx_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static struct i2c_driver s5k3e2fx_i2c_driver = {
-	.id_table = s5k3e2fx_i2c_id,
-	.probe  = s5k3e2fx_i2c_probe,
-	.remove = __exit_p(s5k3e2fx_i2c_remove),
-	.driver = {
-		.name = "s5k3e2fx",
-	},
-};
-
-static int32_t s5k3e2fx_test(enum msm_s_test_mode mo)
-{
-	int32_t rc = 0;
-
-	if (mo == S_TEST_OFF)
-		rc = 0;
-	else
-		rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-			REG_TEST_PATTERN_MODE, (uint16_t)mo);
-
-	return rc;
-}
-
-static int32_t s5k3e2fx_setting(enum msm_s_reg_update rupdate,
-	enum msm_s_setting rt)
-{
-	int32_t rc = 0;
-  uint16_t num_lperf;
-
-	switch (rupdate) {
-	case S_UPDATE_PERIODIC:
-	if (rt == S_RES_PREVIEW || rt == S_RES_CAPTURE) {
-
-		struct s5k3e2fx_i2c_reg_conf tbl_1[] = {
-			{REG_CCP_DATA_FORMAT_MSB,
-				s5k3e2fx_reg_pat[rt].ccp_data_format_msb},
-			{REG_CCP_DATA_FORMAT_LSB,
-				s5k3e2fx_reg_pat[rt].ccp_data_format_lsb},
-			{REG_X_OUTPUT_SIZE_MSB,
-				s5k3e2fx_reg_pat[rt].x_output_size_msb},
-			{REG_X_OUTPUT_SIZE_LSB,
-				s5k3e2fx_reg_pat[rt].x_output_size_lsb},
-			{REG_Y_OUTPUT_SIZE_MSB,
-				s5k3e2fx_reg_pat[rt].y_output_size_msb},
-			{REG_Y_OUTPUT_SIZE_LSB,
-				s5k3e2fx_reg_pat[rt].y_output_size_lsb},
-			{REG_X_EVEN_INC,
-				s5k3e2fx_reg_pat[rt].x_even_inc},
-			{REG_X_ODD_INC,
-				s5k3e2fx_reg_pat[rt].x_odd_inc},
-			{REG_Y_EVEN_INC,
-				s5k3e2fx_reg_pat[rt].y_even_inc},
-			{REG_Y_ODD_INC,
-				s5k3e2fx_reg_pat[rt].y_odd_inc},
-			{REG_BINNING_ENABLE,
-				s5k3e2fx_reg_pat[rt].binning_enable},
-		};
-
-		struct s5k3e2fx_i2c_reg_conf tbl_2[] = {
-			{REG_FRAME_LENGTH_LINES_MSB, 0},
-			{REG_FRAME_LENGTH_LINES_LSB, 0},
-			{REG_LINE_LENGTH_PCK_MSB,
-				s5k3e2fx_reg_pat[rt].line_length_pck_msb},
-			{REG_LINE_LENGTH_PCK_LSB,
-				s5k3e2fx_reg_pat[rt].line_length_pck_lsb},
-			{REG_SHADE_CLK_ENABLE,
-				s5k3e2fx_reg_pat[rt].shade_clk_enable},
-			{REG_SEL_CCP, s5k3e2fx_reg_pat[rt].sel_ccp},
-			{REG_VPIX, s5k3e2fx_reg_pat[rt].vpix},
-			{REG_CLAMP_ON, s5k3e2fx_reg_pat[rt].clamp_on},
-			{REG_OFFSET, s5k3e2fx_reg_pat[rt].offset},
-			{REG_LD_START, s5k3e2fx_reg_pat[rt].ld_start},
-			{REG_LD_END, s5k3e2fx_reg_pat[rt].ld_end},
-			{REG_SL_START, s5k3e2fx_reg_pat[rt].sl_start},
-			{REG_SL_END, s5k3e2fx_reg_pat[rt].sl_end},
-			{REG_RX_START, s5k3e2fx_reg_pat[rt].rx_start},
-			{REG_S1_START, s5k3e2fx_reg_pat[rt].s1_start},
-			{REG_S1_END, s5k3e2fx_reg_pat[rt].s1_end},
-			{REG_S1S_START, s5k3e2fx_reg_pat[rt].s1s_start},
-			{REG_S1S_END, s5k3e2fx_reg_pat[rt].s1s_end},
-			{REG_S3_START, s5k3e2fx_reg_pat[rt].s3_start},
-			{REG_S3_END, s5k3e2fx_reg_pat[rt].s3_end},
-			{REG_CMP_EN_START, s5k3e2fx_reg_pat[rt].cmp_en_start},
-			{REG_CLP_SL_START, s5k3e2fx_reg_pat[rt].clp_sl_start},
-			{REG_CLP_SL_END, s5k3e2fx_reg_pat[rt].clp_sl_end},
-			{REG_OFF_START, s5k3e2fx_reg_pat[rt].off_start},
-			{REG_RMP_EN_START, s5k3e2fx_reg_pat[rt].rmp_en_start},
-			{REG_TX_START, s5k3e2fx_reg_pat[rt].tx_start},
-			{REG_TX_END, s5k3e2fx_reg_pat[rt].tx_end},
-			{REG_STX_WIDTH, s5k3e2fx_reg_pat[rt].stx_width},
-			{REG_3152_RESERVED,
-				s5k3e2fx_reg_pat[rt].reg_3152_reserved},
-			{REG_315A_RESERVED,
-				s5k3e2fx_reg_pat[rt].reg_315A_reserved},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_MSB,
-				s5k3e2fx_reg_pat[rt].
-				analogue_gain_code_global_msb},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_LSB,
-				s5k3e2fx_reg_pat[rt].
-				analogue_gain_code_global_lsb},
-			{REG_FINE_INTEGRATION_TIME,
-				s5k3e2fx_reg_pat[rt].fine_integration_time},
-			{REG_COARSE_INTEGRATION_TIME,
-				s5k3e2fx_reg_pat[rt].coarse_integration_time},
-			{S5K3E2FX_REG_MODE_SELECT, S5K3E2FX_MODE_SELECT_STREAM},
-		};
-
-		rc = s5k3e2fx_i2c_write_table(&tbl_1[0],
-			ARRAY_SIZE(tbl_1));
-		if (rc < 0)
-			return rc;
-
-		num_lperf = (uint16_t)
-			((s5k3e2fx_reg_pat[rt].frame_length_lines_msb << 8)
-			& 0xFF00)
-			+ s5k3e2fx_reg_pat[rt].frame_length_lines_lsb;
-
-		num_lperf = num_lperf * s5k3e2fx_ctrl->fps_divider / 0x0400;
-
-		tbl_2[0] = (struct s5k3e2fx_i2c_reg_conf)
-			{REG_FRAME_LENGTH_LINES_MSB, (num_lperf & 0xFF00) >> 8};
-		tbl_2[1] = (struct s5k3e2fx_i2c_reg_conf)
-			{REG_FRAME_LENGTH_LINES_LSB, (num_lperf & 0x00FF)};
-
-		rc = s5k3e2fx_i2c_write_table(&tbl_2[0],
-			ARRAY_SIZE(tbl_2));
-		if (rc < 0)
-			return rc;
-
-		mdelay(5);
-
-		rc = s5k3e2fx_test(s5k3e2fx_ctrl->set_test);
-		if (rc < 0)
-			return rc;
-	  }
-    break; /* UPDATE_PERIODIC */
-
-	case S_REG_INIT:
-	if (rt == S_RES_PREVIEW || rt == S_RES_CAPTURE) {
-
-		struct s5k3e2fx_i2c_reg_conf tbl_3[] = {
-			{S5K3E2FX_REG_SOFTWARE_RESET, S5K3E2FX_SOFTWARE_RESET},
-			{S5K3E2FX_REG_MODE_SELECT,
-				S5K3E2FX_MODE_SELECT_SW_STANDBY},
-			/* PLL setting */
-			{REG_PRE_PLL_CLK_DIV,
-				s5k3e2fx_reg_pat[rt].pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER_MSB,
-				s5k3e2fx_reg_pat[rt].pll_multiplier_msb},
-			{REG_PLL_MULTIPLIER_LSB,
-				s5k3e2fx_reg_pat[rt].pll_multiplier_lsb},
-			{REG_VT_PIX_CLK_DIV,
-				s5k3e2fx_reg_pat[rt].vt_pix_clk_div},
-			{REG_VT_SYS_CLK_DIV,
-				s5k3e2fx_reg_pat[rt].vt_sys_clk_div},
-			{REG_OP_PIX_CLK_DIV,
-				s5k3e2fx_reg_pat[rt].op_pix_clk_div},
-			{REG_OP_SYS_CLK_DIV,
-				s5k3e2fx_reg_pat[rt].op_sys_clk_div},
-			/*Data Format */
-			{REG_CCP_DATA_FORMAT_MSB,
-				s5k3e2fx_reg_pat[rt].ccp_data_format_msb},
-			{REG_CCP_DATA_FORMAT_LSB,
-				s5k3e2fx_reg_pat[rt].ccp_data_format_lsb},
-			/*Output Size */
-			{REG_X_OUTPUT_SIZE_MSB,
-				s5k3e2fx_reg_pat[rt].x_output_size_msb},
-			{REG_X_OUTPUT_SIZE_LSB,
-				s5k3e2fx_reg_pat[rt].x_output_size_lsb},
-			{REG_Y_OUTPUT_SIZE_MSB,
-				s5k3e2fx_reg_pat[rt].y_output_size_msb},
-			{REG_Y_OUTPUT_SIZE_LSB,
-				s5k3e2fx_reg_pat[rt].y_output_size_lsb},
-			/* Binning */
-			{REG_X_EVEN_INC, s5k3e2fx_reg_pat[rt].x_even_inc},
-			{REG_X_ODD_INC, s5k3e2fx_reg_pat[rt].x_odd_inc },
-			{REG_Y_EVEN_INC, s5k3e2fx_reg_pat[rt].y_even_inc},
-			{REG_Y_ODD_INC, s5k3e2fx_reg_pat[rt].y_odd_inc},
-			{REG_BINNING_ENABLE,
-				s5k3e2fx_reg_pat[rt].binning_enable},
-			/* Frame format */
-			{REG_FRAME_LENGTH_LINES_MSB,
-				s5k3e2fx_reg_pat[rt].frame_length_lines_msb},
-			{REG_FRAME_LENGTH_LINES_LSB,
-				s5k3e2fx_reg_pat[rt].frame_length_lines_lsb},
-			{REG_LINE_LENGTH_PCK_MSB,
-				s5k3e2fx_reg_pat[rt].line_length_pck_msb},
-			{REG_LINE_LENGTH_PCK_LSB,
-				s5k3e2fx_reg_pat[rt].line_length_pck_lsb},
-			/* MSR setting */
-			{REG_SHADE_CLK_ENABLE,
-				s5k3e2fx_reg_pat[rt].shade_clk_enable},
-			{REG_SEL_CCP, s5k3e2fx_reg_pat[rt].sel_ccp},
-			{REG_VPIX, s5k3e2fx_reg_pat[rt].vpix},
-			{REG_CLAMP_ON, s5k3e2fx_reg_pat[rt].clamp_on},
-			{REG_OFFSET, s5k3e2fx_reg_pat[rt].offset},
-			/* CDS timing setting */
-			{REG_LD_START, s5k3e2fx_reg_pat[rt].ld_start},
-			{REG_LD_END, s5k3e2fx_reg_pat[rt].ld_end},
-			{REG_SL_START, s5k3e2fx_reg_pat[rt].sl_start},
-			{REG_SL_END, s5k3e2fx_reg_pat[rt].sl_end},
-			{REG_RX_START, s5k3e2fx_reg_pat[rt].rx_start},
-			{REG_S1_START, s5k3e2fx_reg_pat[rt].s1_start},
-			{REG_S1_END, s5k3e2fx_reg_pat[rt].s1_end},
-			{REG_S1S_START, s5k3e2fx_reg_pat[rt].s1s_start},
-			{REG_S1S_END, s5k3e2fx_reg_pat[rt].s1s_end},
-			{REG_S3_START, s5k3e2fx_reg_pat[rt].s3_start},
-			{REG_S3_END, s5k3e2fx_reg_pat[rt].s3_end},
-			{REG_CMP_EN_START, s5k3e2fx_reg_pat[rt].cmp_en_start},
-			{REG_CLP_SL_START, s5k3e2fx_reg_pat[rt].clp_sl_start},
-			{REG_CLP_SL_END, s5k3e2fx_reg_pat[rt].clp_sl_end},
-			{REG_OFF_START, s5k3e2fx_reg_pat[rt].off_start},
-			{REG_RMP_EN_START, s5k3e2fx_reg_pat[rt].rmp_en_start},
-			{REG_TX_START, s5k3e2fx_reg_pat[rt].tx_start},
-			{REG_TX_END, s5k3e2fx_reg_pat[rt].tx_end},
-			{REG_STX_WIDTH, s5k3e2fx_reg_pat[rt].stx_width},
-			{REG_3152_RESERVED,
-				s5k3e2fx_reg_pat[rt].reg_3152_reserved},
-			{REG_315A_RESERVED,
-				s5k3e2fx_reg_pat[rt].reg_315A_reserved},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_MSB,
-				s5k3e2fx_reg_pat[rt].
-				analogue_gain_code_global_msb},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_LSB,
-				s5k3e2fx_reg_pat[rt].
-				analogue_gain_code_global_lsb},
-			{REG_FINE_INTEGRATION_TIME,
-				s5k3e2fx_reg_pat[rt].fine_integration_time},
-			{REG_COARSE_INTEGRATION_TIME,
-				s5k3e2fx_reg_pat[rt].coarse_integration_time},
-			{S5K3E2FX_REG_MODE_SELECT, S5K3E2FX_MODE_SELECT_STREAM},
-		};
-
-		/* reset fps_divider */
-		s5k3e2fx_ctrl->fps_divider = 1 * 0x0400;
-		rc = s5k3e2fx_i2c_write_table(&tbl_3[0],
-			ARRAY_SIZE(tbl_3));
-		if (rc < 0)
-			return rc;
-		}
-		break; /* case REG_INIT: */
-
-	default:
-		rc = -EINVAL;
-		break;
-	} /* switch (rupdate) */
-
-	return rc;
-}
-
-static int s5k3e2fx_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t  rc;
-
-	s5k3e2fx_ctrl = kzalloc(sizeof(struct s5k3e2fx_ctrl), GFP_KERNEL);
-	if (!s5k3e2fx_ctrl) {
-		CDBG("s5k3e2fx_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-
-	s5k3e2fx_ctrl->fps_divider = 1 * 0x00000400;
-	s5k3e2fx_ctrl->pict_fps_divider = 1 * 0x00000400;
-	s5k3e2fx_ctrl->set_test = S_TEST_OFF;
-	s5k3e2fx_ctrl->prev_res = S_QTR_SIZE;
-	s5k3e2fx_ctrl->pict_res = S_FULL_SIZE;
-
-	if (data)
-		s5k3e2fx_ctrl->sensordata = data;
-
-	/* enable mclk first */
-	msm_camio_clk_rate_set(24000000);
-	mdelay(20);
-
-	msm_camio_camif_pad_reg_reset();
-	mdelay(20);
-
-	rc = s5k3e2fx_probe_init_sensor(data);
-	if (rc < 0)
-		goto init_fail1;
-
-	if (s5k3e2fx_ctrl->prev_res == S_QTR_SIZE)
-		rc = s5k3e2fx_setting(S_REG_INIT, S_RES_PREVIEW);
-	else
-		rc = s5k3e2fx_setting(S_REG_INIT, S_RES_CAPTURE);
-
-	if (rc < 0) {
-		CDBG("s5k3e2fx_setting failed. rc = %d\n", rc);
-		goto init_fail1;
-	}
-
-	/* initialize AF */
-	rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-			0x3146, 0x3A);
-	if (rc < 0)
-		goto init_fail1;
-
-	rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-			0x3130, 0x03);
-	if (rc < 0)
-		goto init_fail1;
-
-	goto init_done;
-
-init_fail1:
-	s5k3e2fx_probe_init_done(data);
-	kfree(s5k3e2fx_ctrl);
-init_done:
-	return rc;
-}
-
-static int32_t s5k3e2fx_power_down(void)
-{
-	int32_t rc = 0;
-	return rc;
-}
-
-static int s5k3e2fx_sensor_release(void)
-{
-	int rc = -EBADF;
-
-	mutex_lock(&s5k3e2fx_mutex);
-
-	s5k3e2fx_power_down();
-
-	gpio_direction_output(s5k3e2fx_ctrl->sensordata->sensor_reset,
-		0);
-	gpio_free(s5k3e2fx_ctrl->sensordata->sensor_reset);
-
-	kfree(s5k3e2fx_ctrl);
-	s5k3e2fx_ctrl = NULL;
-
-	CDBG("s5k3e2fx_release completed\n");
-
-	mutex_unlock(&s5k3e2fx_mutex);
-	return rc;
-}
-
-static void s5k3e2fx_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint32_t divider;   /* Q10 */
-
-	divider = (uint32_t)
-		((s5k3e2fx_reg_pat[S_RES_PREVIEW].size_h +
-			s5k3e2fx_reg_pat[S_RES_PREVIEW].blk_l) *
-		 (s5k3e2fx_reg_pat[S_RES_PREVIEW].size_w +
-			s5k3e2fx_reg_pat[S_RES_PREVIEW].blk_p)) * 0x00000400 /
-		((s5k3e2fx_reg_pat[S_RES_CAPTURE].size_h +
-			s5k3e2fx_reg_pat[S_RES_CAPTURE].blk_l) *
-		 (s5k3e2fx_reg_pat[S_RES_CAPTURE].size_w +
-			s5k3e2fx_reg_pat[S_RES_CAPTURE].blk_p));
-
-	/* Verify PCLK settings and frame sizes. */
-	*pfps = (uint16_t)(fps * divider / 0x00000400);
-}
-
-static uint16_t s5k3e2fx_get_prev_lines_pf(void)
-{
-	return s5k3e2fx_reg_pat[S_RES_PREVIEW].size_h +
-		s5k3e2fx_reg_pat[S_RES_PREVIEW].blk_l;
-}
-
-static uint16_t s5k3e2fx_get_prev_pixels_pl(void)
-{
-	return s5k3e2fx_reg_pat[S_RES_PREVIEW].size_w +
-		s5k3e2fx_reg_pat[S_RES_PREVIEW].blk_p;
-}
-
-static uint16_t s5k3e2fx_get_pict_lines_pf(void)
-{
-	return s5k3e2fx_reg_pat[S_RES_CAPTURE].size_h +
-		s5k3e2fx_reg_pat[S_RES_CAPTURE].blk_l;
-}
-
-static uint16_t s5k3e2fx_get_pict_pixels_pl(void)
-{
-	return s5k3e2fx_reg_pat[S_RES_CAPTURE].size_w +
-		s5k3e2fx_reg_pat[S_RES_CAPTURE].blk_p;
-}
-
-static uint32_t s5k3e2fx_get_pict_max_exp_lc(void)
-{
-	uint32_t snapshot_lines_per_frame;
-
-	if (s5k3e2fx_ctrl->pict_res == S_QTR_SIZE)
-		snapshot_lines_per_frame =
-		s5k3e2fx_reg_pat[S_RES_PREVIEW].size_h +
-		s5k3e2fx_reg_pat[S_RES_PREVIEW].blk_l;
-	else
-		snapshot_lines_per_frame = 3961 * 3;
-
-	return snapshot_lines_per_frame;
-}
-
-static int32_t s5k3e2fx_set_fps(struct fps_cfg *fps)
-{
-	/* input is new fps in Q10 format */
-	int32_t rc = 0;
-	enum msm_s_setting setting;
-
-	s5k3e2fx_ctrl->fps_divider = fps->fps_div;
-
-	if (s5k3e2fx_ctrl->sensormode == SENSOR_PREVIEW_MODE)
-		setting = S_RES_PREVIEW;
-	else
-		setting = S_RES_CAPTURE;
-
-  rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-		REG_FRAME_LENGTH_LINES_MSB,
-		(((s5k3e2fx_reg_pat[setting].size_h +
-			s5k3e2fx_reg_pat[setting].blk_l) *
-			s5k3e2fx_ctrl->fps_divider / 0x400) & 0xFF00) >> 8);
-	if (rc < 0)
-		goto set_fps_done;
-
-  rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-		REG_FRAME_LENGTH_LINES_LSB,
-		(((s5k3e2fx_reg_pat[setting].size_h +
-			s5k3e2fx_reg_pat[setting].blk_l) *
-			s5k3e2fx_ctrl->fps_divider / 0x400) & 0x00FF));
-
-set_fps_done:
-	return rc;
-}
-
-static int32_t s5k3e2fx_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-
-	uint16_t max_legal_gain = 0x0200;
-	uint32_t ll_ratio; /* Q10 */
-	uint32_t ll_pck, fl_lines;
-	uint16_t offset = 4;
-	uint32_t  gain_msb, gain_lsb;
-	uint32_t  intg_t_msb, intg_t_lsb;
-	uint32_t  ll_pck_msb, ll_pck_lsb;
-
-	struct s5k3e2fx_i2c_reg_conf tbl[2];
-
-	CDBG("Line:%d s5k3e2fx_write_exp_gain \n", __LINE__);
-
-	if (s5k3e2fx_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-
-		s5k3e2fx_ctrl->my_reg_gain = gain;
-		s5k3e2fx_ctrl->my_reg_line_count = (uint16_t)line;
-
-		fl_lines = s5k3e2fx_reg_pat[S_RES_PREVIEW].size_h +
-			s5k3e2fx_reg_pat[S_RES_PREVIEW].blk_l;
-
-		ll_pck = s5k3e2fx_reg_pat[S_RES_PREVIEW].size_w +
-			s5k3e2fx_reg_pat[S_RES_PREVIEW].blk_p;
-
-	} else {
-
-		fl_lines = s5k3e2fx_reg_pat[S_RES_CAPTURE].size_h +
-			s5k3e2fx_reg_pat[S_RES_CAPTURE].blk_l;
-
-		ll_pck = s5k3e2fx_reg_pat[S_RES_CAPTURE].size_w +
-			s5k3e2fx_reg_pat[S_RES_CAPTURE].blk_p;
-	}
-
-	if (gain > max_legal_gain)
-		gain = max_legal_gain;
-
-	/* in Q10 */
-	line = (line * s5k3e2fx_ctrl->fps_divider);
-
-	if (fl_lines < (line / 0x400))
-		ll_ratio = (line / (fl_lines - offset));
-	else
-		ll_ratio = 0x400;
-
-	/* update gain registers */
-	gain_msb = (gain & 0xFF00) >> 8;
-	gain_lsb = gain & 0x00FF;
-	tbl[0].waddr = REG_ANALOGUE_GAIN_CODE_GLOBAL_MSB;
-	tbl[0].bdata = gain_msb;
-	tbl[1].waddr = REG_ANALOGUE_GAIN_CODE_GLOBAL_LSB;
-	tbl[1].bdata = gain_lsb;
-	rc = s5k3e2fx_i2c_write_table(&tbl[0], ARRAY_SIZE(tbl));
-	if (rc < 0)
-		goto write_gain_done;
-
-	ll_pck = ll_pck * ll_ratio;
-	ll_pck_msb = ((ll_pck / 0x400) & 0xFF00) >> 8;
-	ll_pck_lsb = (ll_pck / 0x400) & 0x00FF;
-	tbl[0].waddr = REG_LINE_LENGTH_PCK_MSB;
-	tbl[0].bdata = ll_pck_msb;
-	tbl[1].waddr = REG_LINE_LENGTH_PCK_LSB;
-	tbl[1].bdata = ll_pck_lsb;
-	rc = s5k3e2fx_i2c_write_table(&tbl[0], ARRAY_SIZE(tbl));
-	if (rc < 0)
-		goto write_gain_done;
-
-	line = line / ll_ratio;
-	intg_t_msb = (line & 0xFF00) >> 8;
-	intg_t_lsb = (line & 0x00FF);
-	tbl[0].waddr = REG_COARSE_INTEGRATION_TIME;
-	tbl[0].bdata = intg_t_msb;
-	tbl[1].waddr = REG_COARSE_INTEGRATION_TIME_LSB;
-	tbl[1].bdata = intg_t_lsb;
-	rc = s5k3e2fx_i2c_write_table(&tbl[0], ARRAY_SIZE(tbl));
-
-write_gain_done:
-	return rc;
-}
-
-static int32_t s5k3e2fx_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-
-	CDBG("Line:%d s5k3e2fx_set_pict_exp_gain \n", __LINE__);
-
-	rc =
-		s5k3e2fx_write_exp_gain(gain, line);
-
-	return rc;
-}
-
-static int32_t s5k3e2fx_video_config(int mode, int res)
-{
-	int32_t rc;
-
-	switch (res) {
-	case S_QTR_SIZE:
-		rc = s5k3e2fx_setting(S_UPDATE_PERIODIC, S_RES_PREVIEW);
-		if (rc < 0)
-			return rc;
-
-		CDBG("s5k3e2fx sensor configuration done!\n");
-		break;
-
-	case S_FULL_SIZE:
-		rc = s5k3e2fx_setting(S_UPDATE_PERIODIC, S_RES_CAPTURE);
-		if (rc < 0)
-			return rc;
-
-		break;
-
-	default:
-		return 0;
-	} /* switch */
-
-	s5k3e2fx_ctrl->prev_res = res;
-	s5k3e2fx_ctrl->curr_res = res;
-	s5k3e2fx_ctrl->sensormode = mode;
-
-	rc =
-		s5k3e2fx_write_exp_gain(s5k3e2fx_ctrl->my_reg_gain,
-			s5k3e2fx_ctrl->my_reg_line_count);
-
-	return rc;
-}
-
-static int32_t s5k3e2fx_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-
-	rc = s5k3e2fx_setting(S_UPDATE_PERIODIC, S_RES_CAPTURE);
-	if (rc < 0)
-		return rc;
-
-	s5k3e2fx_ctrl->curr_res = s5k3e2fx_ctrl->pict_res;
-	s5k3e2fx_ctrl->sensormode = mode;
-
-	return rc;
-}
-
-static int32_t s5k3e2fx_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-
-	rc = s5k3e2fx_setting(S_UPDATE_PERIODIC, S_RES_CAPTURE);
-	if (rc < 0)
-		return rc;
-
-	s5k3e2fx_ctrl->curr_res = s5k3e2fx_ctrl->pict_res;
-	s5k3e2fx_ctrl->sensormode = mode;
-
-	return rc;
-}
-
-static int32_t s5k3e2fx_set_sensor_mode(int mode, int res)
-{
-	int32_t rc = 0;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = s5k3e2fx_video_config(mode, res);
-		break;
-
-	case SENSOR_SNAPSHOT_MODE:
-		rc = s5k3e2fx_snapshot_config(mode);
-		break;
-
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = s5k3e2fx_raw_snapshot_config(mode);
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	return rc;
-}
-
-static int32_t s5k3e2fx_set_default_focus(void)
-{
-	int32_t rc = 0;
-
-  rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-		0x3131, 0);
-	if (rc < 0)
-		return rc;
-
-  rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-		0x3132, 0);
-	if (rc < 0)
-		return rc;
-
-	s5k3e2fx_ctrl->curr_lens_pos = 0;
-
-	return rc;
-}
-
-static int32_t s5k3e2fx_move_focus(int direction, int32_t num_steps)
-{
-	int32_t rc = 0;
-	int32_t i;
-	int16_t step_direction;
-	int16_t actual_step;
-	int16_t next_pos, pos_offset;
-	int16_t init_code = 50;
-	uint8_t next_pos_msb, next_pos_lsb;
-	int16_t s_move[5];
-	uint32_t gain; /* Q10 format */
-
-	if (direction == MOVE_NEAR)
-		step_direction = 20;
-	else if (direction == MOVE_FAR)
-		step_direction = -20;
-	else {
-		CDBG("s5k3e2fx_move_focus failed at line %d ...\n", __LINE__);
-		return -EINVAL;
-	}
-
-	actual_step = step_direction * (int16_t)num_steps;
-	pos_offset = init_code + s5k3e2fx_ctrl->curr_lens_pos;
-	gain = actual_step * 0x400 / 5;
-
-	for (i = 0; i <= 4; i++) {
-		if (actual_step >= 0)
-			s_move[i] = (((i+1)*gain+0x200)-(i*gain+0x200))/0x400;
-		else
-			s_move[i] = (((i+1)*gain-0x200)-(i*gain-0x200))/0x400;
-	}
-
-	/* Ring Damping Code */
-	for (i = 0; i <= 4; i++) {
-		next_pos = (int16_t)(pos_offset + s_move[i]);
-
-		if (next_pos > (738 + init_code))
-			next_pos = 738 + init_code;
-		else if (next_pos < 0)
-			next_pos = 0;
-
-		CDBG("next_position in damping mode = %d\n", next_pos);
-		/* Writing the Values to the actuator */
-		if (next_pos == init_code)
-			next_pos = 0x00;
-
-		next_pos_msb = next_pos >> 8;
-		next_pos_lsb = next_pos & 0x00FF;
-
-		rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-			0x3131, next_pos_msb);
-		if (rc < 0)
-			break;
-
-		rc = s5k3e2fx_i2c_write_b(s5k3e2fx_client->addr,
-			0x3132, next_pos_lsb);
-		if (rc < 0)
-			break;
-
-		pos_offset = next_pos;
-		s5k3e2fx_ctrl->curr_lens_pos = pos_offset - init_code;
-		if (i < 4)
-			mdelay(3);
-	}
-
-	return rc;
-}
-
-static int s5k3e2fx_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-
-	if (copy_from_user(&cdata,
-			(void *)argp,
-			sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-
-	mutex_lock(&s5k3e2fx_mutex);
-
-	CDBG("%s: cfgtype = %d\n", __func__, cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		s5k3e2fx_get_pict_fps(cdata.cfg.gfps.prevfps,
-			&(cdata.cfg.gfps.pictfps));
-
-		if (copy_to_user((void *)argp, &cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf = s5k3e2fx_get_prev_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl = s5k3e2fx_get_prev_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf = s5k3e2fx_get_pict_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl = s5k3e2fx_get_pict_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc =
-			s5k3e2fx_get_pict_max_exp_lc();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = s5k3e2fx_set_fps(&(cdata.cfg.fps));
-		break;
-
-	case CFG_SET_EXP_GAIN:
-		rc =
-			s5k3e2fx_write_exp_gain(cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_PICT_EXP_GAIN:
-		CDBG("Line:%d CFG_SET_PICT_EXP_GAIN \n", __LINE__);
-		rc =
-			s5k3e2fx_set_pict_exp_gain(
-				cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_MODE:
-		rc =
-			s5k3e2fx_set_sensor_mode(
-			cdata.mode, cdata.rs);
-		break;
-
-	case CFG_PWR_DOWN:
-		rc = s5k3e2fx_power_down();
-		break;
-
-	case CFG_MOVE_FOCUS:
-		rc =
-			s5k3e2fx_move_focus(
-			cdata.cfg.focus.dir,
-			cdata.cfg.focus.steps);
-		break;
-
-	case CFG_SET_DEFAULT_FOCUS:
-		rc =
-			s5k3e2fx_set_default_focus();
-		break;
-
-	case CFG_GET_AF_MAX_STEPS:
-	case CFG_SET_EFFECT:
-	case CFG_SET_LENS_SHADING:
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	mutex_unlock(&s5k3e2fx_mutex);
-	return rc;
-}
-
-static int s5k3e2fx_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-
-	rc = i2c_add_driver(&s5k3e2fx_i2c_driver);
-	if (rc < 0 || s5k3e2fx_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_fail;
-	}
-
-	msm_camio_clk_rate_set(24000000);
-	mdelay(20);
-
-	rc = s5k3e2fx_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-
-	s->s_init = s5k3e2fx_sensor_open_init;
-	s->s_release = s5k3e2fx_sensor_release;
-	s->s_config  = s5k3e2fx_sensor_config;
-	s->s_mount_angle  = 0;
-	s5k3e2fx_probe_init_done(info);
-
-	return rc;
-
-probe_fail:
-	CDBG("SENSOR PROBE FAILS!\n");
-	return rc;
-}
-
-static int __s5k3e2fx_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, s5k3e2fx_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __s5k3e2fx_probe,
-	.driver = {
-		.name = "msm_camera_s5k3e2fx",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init s5k3e2fx_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(s5k3e2fx_init);
-
diff --git a/drivers/media/video/msm/s5k3e2fx.h b/drivers/media/video/msm/s5k3e2fx.h
deleted file mode 100644
index 3cf4f8e..0000000
--- a/drivers/media/video/msm/s5k3e2fx.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef CAMSENSOR_S5K3E2FX
-#define CAMSENSOR_S5K3E2FX
-
-#include <mach/board.h>
-#endif /* CAMSENSOR_S5K3E2FX */
diff --git a/drivers/media/video/msm/s5k4e1.c b/drivers/media/video/msm/s5k4e1.c
deleted file mode 100644
index c62103e..0000000
--- a/drivers/media/video/msm/s5k4e1.c
+++ /dev/null
@@ -1,1103 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/delay.h>
-#include <linux/debugfs.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/slab.h>
-#include <linux/gpio.h>
-#include <linux/bitops.h>
-#include <mach/camera.h>
-#include <media/msm_camera.h>
-#include "s5k4e1.h"
-
-/* 16bit address - 8 bit context register structure */
-#define Q8	0x00000100
-#define Q10	0x00000400
-
-/* MCLK */
-#define S5K4E1_MASTER_CLK_RATE 24000000
-
-/* AF Total steps parameters */
-#define S5K4E1_TOTAL_STEPS_NEAR_TO_FAR	32
-
-#define S5K4E1_REG_PREV_FRAME_LEN_1	31
-#define S5K4E1_REG_PREV_FRAME_LEN_2	32
-#define S5K4E1_REG_PREV_LINE_LEN_1	33
-#define S5K4E1_REG_PREV_LINE_LEN_2	34
-
-#define S5K4E1_REG_SNAP_FRAME_LEN_1	15
-#define S5K4E1_REG_SNAP_FRAME_LEN_2	16
-#define  S5K4E1_REG_SNAP_LINE_LEN_1	17
-#define S5K4E1_REG_SNAP_LINE_LEN_2	18
-#define MSB                             1
-#define LSB                             0
-
-struct s5k4e1_work_t {
-	struct work_struct work;
-};
-
-static struct s5k4e1_work_t *s5k4e1_sensorw;
-static struct s5k4e1_work_t *s5k4e1_af_sensorw;
-static struct i2c_client *s5k4e1_af_client;
-static struct i2c_client *s5k4e1_client;
-
-struct s5k4e1_ctrl_t {
-	const struct  msm_camera_sensor_info *sensordata;
-
-	uint32_t sensormode;
-	uint32_t fps_divider;/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;/* init to 1 * 0x00000400 */
-	uint16_t fps;
-
-	uint16_t curr_lens_pos;
-	uint16_t curr_step_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint16_t total_lines_per_frame;
-
-	enum s5k4e1_resolution_t prev_res;
-	enum s5k4e1_resolution_t pict_res;
-	enum s5k4e1_resolution_t curr_res;
-	enum s5k4e1_test_mode_t  set_test;
-};
-
-static bool CSI_CONFIG;
-static struct s5k4e1_ctrl_t *s5k4e1_ctrl;
-
-static DECLARE_WAIT_QUEUE_HEAD(s5k4e1_wait_queue);
-static DECLARE_WAIT_QUEUE_HEAD(s5k4e1_af_wait_queue);
-DEFINE_MUTEX(s5k4e1_mut);
-
-static uint16_t prev_line_length_pck;
-static uint16_t prev_frame_length_lines;
-static uint16_t snap_line_length_pck;
-static uint16_t snap_frame_length_lines;
-
-static int s5k4e1_i2c_rxdata(unsigned short saddr,
-		unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = 1,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = 1,
-			.buf   = rxdata,
-		},
-	};
-	if (i2c_transfer(s5k4e1_client->adapter, msgs, 2) < 0) {
-		CDBG("s5k4e1_i2c_rxdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-	return 0;
-}
-
-static int32_t s5k4e1_i2c_txdata(unsigned short saddr,
-		unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		},
-	};
-	if (i2c_transfer(s5k4e1_client->adapter, msg, 1) < 0) {
-		CDBG("s5k4e1_i2c_txdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t s5k4e1_i2c_read(unsigned short raddr,
-		unsigned short *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-
-	if (!rdata)
-		return -EIO;
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-	rc = s5k4e1_i2c_rxdata(s5k4e1_client->addr, buf, rlen);
-	if (rc < 0) {
-		CDBG("s5k4e1_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-	CDBG("s5k4e1_i2c_read 0x%x val = 0x%x!\n", raddr, *rdata);
-
-	return rc;
-}
-
-static int32_t s5k4e1_i2c_write_b_sensor(unsigned short waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[3];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = s5k4e1_i2c_txdata(s5k4e1_client->addr, buf, 3);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-				waddr, bdata);
-	}
-	return rc;
-}
-
-static int32_t s5k4e1_i2c_write_b_table(struct s5k4e1_i2c_reg_conf const
-		*reg_conf_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-
-	for (i = 0; i < num; i++) {
-		rc = s5k4e1_i2c_write_b_sensor(reg_conf_tbl->waddr,
-				reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-	return rc;
-}
-
-static int32_t s5k4e1_af_i2c_txdata(unsigned short saddr,
-		unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		},
-	};
-	if (i2c_transfer(s5k4e1_af_client->adapter, msg, 1) < 0) {
-		pr_err("s5k4e1_af_i2c_txdata faild 0x%x\n", saddr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t s5k4e1_af_i2c_write_b_sensor(uint8_t waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[2];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = waddr;
-	buf[1] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = s5k4e1_af_i2c_txdata(s5k4e1_af_client->addr << 1, buf, 2);
-	if (rc < 0) {
-		pr_err("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-				waddr, bdata);
-	}
-	return rc;
-}
-
-static void s5k4e1_start_stream(void)
-{
-	s5k4e1_i2c_write_b_sensor(0x0100, 0x01);/* streaming on */
-}
-
-static void s5k4e1_stop_stream(void)
-{
-	s5k4e1_i2c_write_b_sensor(0x0100, 0x00);/* streaming off */
-}
-
-static void s5k4e1_group_hold_on(void)
-{
-	s5k4e1_i2c_write_b_sensor(0x0104, 0x01);
-}
-
-static void s5k4e1_group_hold_off(void)
-{
-	s5k4e1_i2c_write_b_sensor(0x0104, 0x0);
-}
-
-static void s5k4e1_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint32_t divider, d1, d2;
-
-	d1 = (prev_frame_length_lines * 0x00000400) / snap_frame_length_lines;
-	d2 = (prev_line_length_pck * 0x00000400) / snap_line_length_pck;
-	divider = (d1 * d2) / 0x400;
-
-	/*Verify PCLK settings and frame sizes.*/
-	*pfps = (uint16_t) (fps * divider / 0x400);
-}
-
-static uint16_t s5k4e1_get_prev_lines_pf(void)
-{
-	if (s5k4e1_ctrl->prev_res == QTR_SIZE)
-		return prev_frame_length_lines;
-	else
-		return snap_frame_length_lines;
-}
-
-static uint16_t s5k4e1_get_prev_pixels_pl(void)
-{
-	if (s5k4e1_ctrl->prev_res == QTR_SIZE)
-		return prev_line_length_pck;
-	else
-		return snap_line_length_pck;
-}
-
-static uint16_t s5k4e1_get_pict_lines_pf(void)
-{
-	if (s5k4e1_ctrl->pict_res == QTR_SIZE)
-		return prev_frame_length_lines;
-	else
-		return snap_frame_length_lines;
-}
-
-static uint16_t s5k4e1_get_pict_pixels_pl(void)
-{
-	if (s5k4e1_ctrl->pict_res == QTR_SIZE)
-		return prev_line_length_pck;
-	else
-		return snap_line_length_pck;
-}
-
-static uint32_t s5k4e1_get_pict_max_exp_lc(void)
-{
-	return snap_frame_length_lines * 24;
-}
-
-static int32_t s5k4e1_set_fps(struct fps_cfg   *fps)
-{
-	uint16_t total_lines_per_frame;
-	int32_t rc = 0;
-
-	s5k4e1_ctrl->fps_divider = fps->fps_div;
-	s5k4e1_ctrl->pict_fps_divider = fps->pict_fps_div;
-
-	if (s5k4e1_ctrl->sensormode == SENSOR_PREVIEW_MODE) {
-		total_lines_per_frame = (uint16_t)
-		((prev_frame_length_lines * s5k4e1_ctrl->fps_divider) / 0x400);
-	} else {
-		total_lines_per_frame = (uint16_t)
-		((snap_frame_length_lines * s5k4e1_ctrl->fps_divider) / 0x400);
-	}
-
-	s5k4e1_group_hold_on();
-	rc = s5k4e1_i2c_write_b_sensor(0x0340,
-			((total_lines_per_frame & 0xFF00) >> 8));
-	rc = s5k4e1_i2c_write_b_sensor(0x0341,
-			(total_lines_per_frame & 0x00FF));
-	s5k4e1_group_hold_off();
-
-	return rc;
-}
-
-static inline uint8_t s5k4e1_byte(uint16_t word, uint8_t offset)
-{
-	return word >> (offset * BITS_PER_BYTE);
-}
-
-static int32_t s5k4e1_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	uint16_t max_legal_gain = 0x0200;
-	int32_t rc = 0;
-	static uint32_t fl_lines;
-
-	if (gain > max_legal_gain) {
-		pr_debug("Max legal gain Line:%d\n", __LINE__);
-		gain = max_legal_gain;
-	}
-	/* Analogue Gain */
-	s5k4e1_i2c_write_b_sensor(0x0204, s5k4e1_byte(gain, MSB));
-	s5k4e1_i2c_write_b_sensor(0x0205, s5k4e1_byte(gain, LSB));
-
-	if (line > (prev_frame_length_lines - 4)) {
-		fl_lines = line+4;
-		s5k4e1_group_hold_on();
-		s5k4e1_i2c_write_b_sensor(0x0340, s5k4e1_byte(fl_lines, MSB));
-		s5k4e1_i2c_write_b_sensor(0x0341, s5k4e1_byte(fl_lines, LSB));
-		/* Coarse Integration Time */
-		s5k4e1_i2c_write_b_sensor(0x0202, s5k4e1_byte(line, MSB));
-		s5k4e1_i2c_write_b_sensor(0x0203, s5k4e1_byte(line, LSB));
-		s5k4e1_group_hold_off();
-	} else if (line < (fl_lines - 4)) {
-		fl_lines = line+4;
-		if (fl_lines < prev_frame_length_lines)
-			fl_lines = prev_frame_length_lines;
-
-		s5k4e1_group_hold_on();
-		/* Coarse Integration Time */
-		s5k4e1_i2c_write_b_sensor(0x0202, s5k4e1_byte(line, MSB));
-		s5k4e1_i2c_write_b_sensor(0x0203, s5k4e1_byte(line, LSB));
-		s5k4e1_i2c_write_b_sensor(0x0340, s5k4e1_byte(fl_lines, MSB));
-		s5k4e1_i2c_write_b_sensor(0x0341, s5k4e1_byte(fl_lines, LSB));
-		s5k4e1_group_hold_off();
-	} else {
-		fl_lines = line+4;
-		s5k4e1_group_hold_on();
-		/* Coarse Integration Time */
-		s5k4e1_i2c_write_b_sensor(0x0202, s5k4e1_byte(line, MSB));
-		s5k4e1_i2c_write_b_sensor(0x0203, s5k4e1_byte(line, LSB));
-		s5k4e1_group_hold_off();
-	}
-	return rc;
-}
-
-static int32_t s5k4e1_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	uint16_t max_legal_gain = 0x0200;
-	uint16_t min_ll_pck = 0x0AB2;
-	uint32_t ll_pck, fl_lines;
-	uint32_t ll_ratio;
-	int32_t rc = 0;
-	uint8_t gain_msb, gain_lsb;
-	uint8_t intg_time_msb, intg_time_lsb;
-	uint8_t ll_pck_msb, ll_pck_lsb;
-
-	if (gain > max_legal_gain) {
-		pr_debug("Max legal gain Line:%d\n", __LINE__);
-		gain = max_legal_gain;
-	}
-
-	pr_debug("s5k4e1_write_exp_gain : gain = %d line = %d\n", gain, line);
-	line = (uint32_t) (line * s5k4e1_ctrl->pict_fps_divider);
-	fl_lines = snap_frame_length_lines;
-	ll_pck = snap_line_length_pck;
-
-	if (fl_lines < (line / 0x400))
-		ll_ratio = (line / (fl_lines - 4));
-	else
-		ll_ratio = 0x400;
-
-	ll_pck = ll_pck * ll_ratio / 0x400;
-	line = line / ll_ratio;
-	if (ll_pck < min_ll_pck)
-		ll_pck = min_ll_pck;
-
-	gain_msb = (uint8_t) ((gain & 0xFF00) >> 8);
-	gain_lsb = (uint8_t) (gain & 0x00FF);
-
-	intg_time_msb = (uint8_t) ((line & 0xFF00) >> 8);
-	intg_time_lsb = (uint8_t) (line & 0x00FF);
-
-	ll_pck_msb = (uint8_t) ((ll_pck & 0xFF00) >> 8);
-	ll_pck_lsb = (uint8_t) (ll_pck & 0x00FF);
-
-	s5k4e1_group_hold_on();
-	s5k4e1_i2c_write_b_sensor(0x0204, gain_msb); /* Analogue Gain */
-	s5k4e1_i2c_write_b_sensor(0x0205, gain_lsb);
-
-	s5k4e1_i2c_write_b_sensor(0x0342, ll_pck_msb);
-	s5k4e1_i2c_write_b_sensor(0x0343, ll_pck_lsb);
-
-	/* Coarse Integration Time */
-	s5k4e1_i2c_write_b_sensor(0x0202, intg_time_msb);
-	s5k4e1_i2c_write_b_sensor(0x0203, intg_time_lsb);
-	s5k4e1_group_hold_off();
-
-	return rc;
-}
-
-static int32_t s5k4e1_move_focus(int direction,
-		int32_t num_steps)
-{
-	int16_t step_direction, actual_step, next_position;
-	uint8_t code_val_msb, code_val_lsb;
-
-	if (direction == MOVE_NEAR)
-		step_direction = 16;
-	else
-		step_direction = -16;
-
-	actual_step = (int16_t) (step_direction * num_steps);
-	next_position = (int16_t) (s5k4e1_ctrl->curr_lens_pos + actual_step);
-
-	if (next_position > 1023)
-		next_position = 1023;
-	else if (next_position < 0)
-		next_position = 0;
-
-	code_val_msb = next_position >> 4;
-	code_val_lsb = (next_position & 0x000F) << 4;
-
-	if (s5k4e1_af_i2c_write_b_sensor(code_val_msb, code_val_lsb) < 0) {
-		pr_err("move_focus failed at line %d ...\n", __LINE__);
-		return -EBUSY;
-	}
-
-	s5k4e1_ctrl->curr_lens_pos = next_position;
-	return 0;
-}
-
-static int32_t s5k4e1_set_default_focus(uint8_t af_step)
-{
-	int32_t rc = 0;
-
-	if (s5k4e1_ctrl->curr_step_pos != 0) {
-		rc = s5k4e1_move_focus(MOVE_FAR,
-				s5k4e1_ctrl->curr_step_pos);
-	} else {
-		s5k4e1_af_i2c_write_b_sensor(0x00, 0x00);
-	}
-
-	s5k4e1_ctrl->curr_lens_pos = 0;
-	s5k4e1_ctrl->curr_step_pos = 0;
-
-	return rc;
-}
-
-static int32_t s5k4e1_test(enum s5k4e1_test_mode_t mo)
-{
-	int32_t rc = 0;
-
-	if (mo != TEST_OFF)
-		rc = s5k4e1_i2c_write_b_sensor(0x0601, (uint8_t) mo);
-
-	return rc;
-}
-
-static void s5k4e1_reset_sensor(void)
-{
-	s5k4e1_i2c_write_b_sensor(0x103, 0x1);
-}
-
-static int32_t s5k4e1_sensor_setting(int update_type, int rt)
-{
-
-	int32_t rc = 0;
-	struct msm_camera_csi_params s5k4e1_csi_params;
-
-	s5k4e1_stop_stream();
-	msleep(30);
-
-	if (update_type == REG_INIT) {
-		s5k4e1_reset_sensor();
-		s5k4e1_i2c_write_b_table(s5k4e1_regs.reg_mipi,
-				s5k4e1_regs.reg_mipi_size);
-		s5k4e1_i2c_write_b_table(s5k4e1_regs.rec_settings,
-				s5k4e1_regs.rec_size);
-		s5k4e1_i2c_write_b_table(s5k4e1_regs.reg_pll_p,
-				s5k4e1_regs.reg_pll_p_size);
-		CSI_CONFIG = 0;
-	} else if (update_type == UPDATE_PERIODIC) {
-		if (rt == RES_PREVIEW)
-			s5k4e1_i2c_write_b_table(s5k4e1_regs.reg_prev,
-					s5k4e1_regs.reg_prev_size);
-		else
-			s5k4e1_i2c_write_b_table(s5k4e1_regs.reg_snap,
-					s5k4e1_regs.reg_snap_size);
-		msleep(20);
-		if (!CSI_CONFIG) {
-			msm_camio_vfe_clk_rate_set(192000000);
-			s5k4e1_csi_params.data_format = CSI_10BIT;
-			s5k4e1_csi_params.lane_cnt = 1;
-			s5k4e1_csi_params.lane_assign = 0xe4;
-			s5k4e1_csi_params.dpcm_scheme = 0;
-			s5k4e1_csi_params.settle_cnt = 24;
-			rc = msm_camio_csi_config(&s5k4e1_csi_params);
-			msleep(20);
-			CSI_CONFIG = 1;
-		}
-		s5k4e1_start_stream();
-		msleep(30);
-	}
-	return rc;
-}
-
-static int32_t s5k4e1_video_config(int mode)
-{
-
-	int32_t rc = 0;
-	int rt;
-	CDBG("video config\n");
-	/* change sensor resolution if needed */
-	if (s5k4e1_ctrl->prev_res == QTR_SIZE)
-		rt = RES_PREVIEW;
-	else
-		rt = RES_CAPTURE;
-	if (s5k4e1_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-		return rc;
-	if (s5k4e1_ctrl->set_test) {
-		if (s5k4e1_test(s5k4e1_ctrl->set_test) < 0)
-			return  rc;
-	}
-
-	s5k4e1_ctrl->curr_res = s5k4e1_ctrl->prev_res;
-	s5k4e1_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t s5k4e1_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-
-	/*change sensor resolution if needed */
-	if (s5k4e1_ctrl->curr_res != s5k4e1_ctrl->pict_res) {
-		if (s5k4e1_ctrl->pict_res == QTR_SIZE)
-			rt = RES_PREVIEW;
-		else
-			rt = RES_CAPTURE;
-		if (s5k4e1_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-			return rc;
-	}
-
-	s5k4e1_ctrl->curr_res = s5k4e1_ctrl->pict_res;
-	s5k4e1_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t s5k4e1_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-
-	/* change sensor resolution if needed */
-	if (s5k4e1_ctrl->curr_res != s5k4e1_ctrl->pict_res) {
-		if (s5k4e1_ctrl->pict_res == QTR_SIZE)
-			rt = RES_PREVIEW;
-		else
-			rt = RES_CAPTURE;
-		if (s5k4e1_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-			return rc;
-	}
-
-	s5k4e1_ctrl->curr_res = s5k4e1_ctrl->pict_res;
-	s5k4e1_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t s5k4e1_set_sensor_mode(int mode,
-		int res)
-{
-	int32_t rc = 0;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = s5k4e1_video_config(mode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-		rc = s5k4e1_snapshot_config(mode);
-		break;
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = s5k4e1_raw_snapshot_config(mode);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-static int32_t s5k4e1_power_down(void)
-{
-	s5k4e1_stop_stream();
-	return 0;
-}
-
-static int s5k4e1_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	CDBG("probe done\n");
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int s5k4e1_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	uint16_t regaddress1 = 0x0000;
-	uint16_t regaddress2 = 0x0001;
-	uint16_t chipid1 = 0;
-	uint16_t chipid2 = 0;
-
-	CDBG("%s: %d\n", __func__, __LINE__);
-	CDBG(" s5k4e1_probe_init_sensor is called\n");
-
-	rc = gpio_request(data->sensor_reset, "s5k4e1");
-	CDBG(" s5k4e1_probe_init_sensor\n");
-	if (!rc) {
-		CDBG("sensor_reset = %d\n", rc);
-		gpio_direction_output(data->sensor_reset, 0);
-		msleep(50);
-		gpio_set_value_cansleep(data->sensor_reset, 1);
-		msleep(20);
-	} else
-		goto gpio_req_fail;
-
-	msleep(20);
-
-	s5k4e1_i2c_read(regaddress1, &chipid1, 1);
-	if (chipid1 != 0x4E) {
-		rc = -ENODEV;
-		CDBG("s5k4e1_probe_init_sensor fail chip id doesnot match\n");
-		goto init_probe_fail;
-	}
-
-	s5k4e1_i2c_read(regaddress2, &chipid2 , 1);
-	if (chipid2 != 0x10) {
-		rc = -ENODEV;
-		CDBG("s5k4e1_probe_init_sensor fail chip id doesnot match\n");
-		goto init_probe_fail;
-	}
-
-	CDBG("ID: %d\n", chipid1);
-	CDBG("ID: %d\n", chipid1);
-
-	return rc;
-
-init_probe_fail:
-	CDBG(" s5k4e1_probe_init_sensor fails\n");
-	gpio_set_value_cansleep(data->sensor_reset, 0);
-	s5k4e1_probe_init_done(data);
-	if (data->vcm_enable) {
-		int ret = gpio_request(data->vcm_pwd, "s5k4e1_af");
-		if (!ret) {
-			gpio_direction_output(data->vcm_pwd, 0);
-			msleep(20);
-			gpio_free(data->vcm_pwd);
-		}
-	}
-gpio_req_fail:
-	return rc;
-}
-
-int s5k4e1_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-
-	CDBG("%s: %d\n", __func__, __LINE__);
-	CDBG("Calling s5k4e1_sensor_open_init\n");
-
-	s5k4e1_ctrl = kzalloc(sizeof(struct s5k4e1_ctrl_t), GFP_KERNEL);
-	if (!s5k4e1_ctrl) {
-		CDBG("s5k4e1_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	s5k4e1_ctrl->fps_divider = 1 * 0x00000400;
-	s5k4e1_ctrl->pict_fps_divider = 1 * 0x00000400;
-	s5k4e1_ctrl->set_test = TEST_OFF;
-	s5k4e1_ctrl->prev_res = QTR_SIZE;
-	s5k4e1_ctrl->pict_res = FULL_SIZE;
-
-	if (data)
-		s5k4e1_ctrl->sensordata = data;
-
-	prev_frame_length_lines =
-	((s5k4e1_regs.reg_prev[S5K4E1_REG_PREV_FRAME_LEN_1].wdata << 8) |
-		s5k4e1_regs.reg_prev[S5K4E1_REG_PREV_FRAME_LEN_2].wdata);
-
-	prev_line_length_pck =
-	(s5k4e1_regs.reg_prev[S5K4E1_REG_PREV_LINE_LEN_1].wdata << 8) |
-		s5k4e1_regs.reg_prev[S5K4E1_REG_PREV_LINE_LEN_2].wdata;
-
-	snap_frame_length_lines =
-	(s5k4e1_regs.reg_snap[S5K4E1_REG_SNAP_FRAME_LEN_1].wdata << 8) |
-		s5k4e1_regs.reg_snap[S5K4E1_REG_SNAP_FRAME_LEN_2].wdata;
-
-	snap_line_length_pck =
-	(s5k4e1_regs.reg_snap[S5K4E1_REG_SNAP_LINE_LEN_1].wdata << 8) |
-		s5k4e1_regs.reg_snap[S5K4E1_REG_SNAP_LINE_LEN_1].wdata;
-
-	/* enable mclk first */
-	msm_camio_clk_rate_set(S5K4E1_MASTER_CLK_RATE);
-	rc = s5k4e1_probe_init_sensor(data);
-	if (rc < 0)
-		goto init_fail;
-
-	CDBG("init settings\n");
-	if (s5k4e1_ctrl->prev_res == QTR_SIZE)
-		rc = s5k4e1_sensor_setting(REG_INIT, RES_PREVIEW);
-	else
-		rc = s5k4e1_sensor_setting(REG_INIT, RES_CAPTURE);
-	s5k4e1_ctrl->fps = 30 * Q8;
-
-	/* enable AF actuator */
-	if (s5k4e1_ctrl->sensordata->vcm_enable) {
-		CDBG("enable AF actuator, gpio = %d\n",
-			 s5k4e1_ctrl->sensordata->vcm_pwd);
-		rc = gpio_request(s5k4e1_ctrl->sensordata->vcm_pwd,
-						"s5k4e1_af");
-		if (!rc)
-			gpio_direction_output(
-				s5k4e1_ctrl->sensordata->vcm_pwd,
-				 1);
-		else {
-			pr_err("s5k4e1_ctrl gpio request failed!\n");
-			goto init_fail;
-		}
-		msleep(20);
-		rc = s5k4e1_set_default_focus(0);
-		if (rc < 0) {
-			gpio_direction_output(s5k4e1_ctrl->sensordata->vcm_pwd,
-								0);
-			gpio_free(s5k4e1_ctrl->sensordata->vcm_pwd);
-		}
-	}
-	if (rc < 0)
-		goto init_fail;
-	else
-		goto init_done;
-init_fail:
-	CDBG("init_fail\n");
-	s5k4e1_probe_init_done(data);
-init_done:
-	CDBG("init_done\n");
-	return rc;
-}
-
-static int s5k4e1_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&s5k4e1_wait_queue);
-	return 0;
-}
-
-static int s5k4e1_af_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&s5k4e1_af_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id s5k4e1_af_i2c_id[] = {
-	{"s5k4e1_af", 0},
-	{ }
-};
-
-static int s5k4e1_af_i2c_probe(struct i2c_client *client,
-		const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("s5k4e1_af_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	s5k4e1_af_sensorw = kzalloc(sizeof(struct s5k4e1_work_t), GFP_KERNEL);
-	if (!s5k4e1_af_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, s5k4e1_af_sensorw);
-	s5k4e1_af_init_client(client);
-	s5k4e1_af_client = client;
-
-	msleep(50);
-
-	CDBG("s5k4e1_af_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("s5k4e1_af_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static const struct i2c_device_id s5k4e1_i2c_id[] = {
-	{"s5k4e1", 0},
-	{ }
-};
-
-static int s5k4e1_i2c_probe(struct i2c_client *client,
-		const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("s5k4e1_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	s5k4e1_sensorw = kzalloc(sizeof(struct s5k4e1_work_t), GFP_KERNEL);
-	if (!s5k4e1_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, s5k4e1_sensorw);
-	s5k4e1_init_client(client);
-	s5k4e1_client = client;
-
-	msleep(50);
-
-	CDBG("s5k4e1_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("s5k4e1_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int __devexit s5k4e1_remove(struct i2c_client *client)
-{
-	struct s5k4e1_work_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	s5k4e1_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static int __devexit s5k4e1_af_remove(struct i2c_client *client)
-{
-	struct s5k4e1_work_t *s5k4e1_af = i2c_get_clientdata(client);
-	free_irq(client->irq, s5k4e1_af);
-	s5k4e1_af_client = NULL;
-	kfree(s5k4e1_af);
-	return 0;
-}
-
-static struct i2c_driver s5k4e1_i2c_driver = {
-	.id_table = s5k4e1_i2c_id,
-	.probe  = s5k4e1_i2c_probe,
-	.remove = __exit_p(s5k4e1_i2c_remove),
-	.driver = {
-		.name = "s5k4e1",
-	},
-};
-
-static struct i2c_driver s5k4e1_af_i2c_driver = {
-	.id_table = s5k4e1_af_i2c_id,
-	.probe  = s5k4e1_af_i2c_probe,
-	.remove = __exit_p(s5k4e1_af_i2c_remove),
-	.driver = {
-		.name = "s5k4e1_af",
-	},
-};
-
-int s5k4e1_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-	if (copy_from_user(&cdata,
-				(void *)argp,
-				sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(&s5k4e1_mut);
-	CDBG("s5k4e1_sensor_config: cfgtype = %d\n",
-			cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		s5k4e1_get_pict_fps(
-			cdata.cfg.gfps.prevfps,
-			&(cdata.cfg.gfps.pictfps));
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf =
-			s5k4e1_get_prev_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl =
-			s5k4e1_get_prev_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf =
-			s5k4e1_get_pict_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl =
-			s5k4e1_get_pict_pixels_pl();
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc =
-			s5k4e1_get_pict_max_exp_lc();
-
-		if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = s5k4e1_set_fps(&(cdata.cfg.fps));
-		break;
-	case CFG_SET_EXP_GAIN:
-		rc = s5k4e1_write_exp_gain(cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-		break;
-	case CFG_SET_PICT_EXP_GAIN:
-		rc = s5k4e1_set_pict_exp_gain(cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-		break;
-	case CFG_SET_MODE:
-		rc = s5k4e1_set_sensor_mode(cdata.mode, cdata.rs);
-		break;
-	case CFG_PWR_DOWN:
-		rc = s5k4e1_power_down();
-		break;
-	case CFG_MOVE_FOCUS:
-		rc = s5k4e1_move_focus(cdata.cfg.focus.dir,
-				cdata.cfg.focus.steps);
-		break;
-	case CFG_SET_DEFAULT_FOCUS:
-		rc = s5k4e1_set_default_focus(cdata.cfg.focus.steps);
-		break;
-	case CFG_GET_AF_MAX_STEPS:
-		cdata.max_steps = S5K4E1_TOTAL_STEPS_NEAR_TO_FAR;
-		if (copy_to_user((void *)argp,
-					&cdata,
-				sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-	case CFG_SET_EFFECT:
-		rc = s5k4e1_set_default_focus(cdata.cfg.effect);
-		break;
-	default:
-		rc = -EFAULT;
-		break;
-	}
-	mutex_unlock(&s5k4e1_mut);
-
-	return rc;
-}
-
-static int s5k4e1_sensor_release(void)
-{
-	int rc = -EBADF;
-
-	mutex_lock(&s5k4e1_mut);
-	s5k4e1_power_down();
-	msleep(20);
-	gpio_set_value_cansleep(s5k4e1_ctrl->sensordata->sensor_reset, 0);
-	usleep_range(5000, 5100);
-	gpio_free(s5k4e1_ctrl->sensordata->sensor_reset);
-	if (s5k4e1_ctrl->sensordata->vcm_enable) {
-		gpio_set_value_cansleep(s5k4e1_ctrl->sensordata->vcm_pwd, 0);
-		gpio_free(s5k4e1_ctrl->sensordata->vcm_pwd);
-	}
-	kfree(s5k4e1_ctrl);
-	s5k4e1_ctrl = NULL;
-	CDBG("s5k4e1_release completed\n");
-	mutex_unlock(&s5k4e1_mut);
-
-	return rc;
-}
-
-static int s5k4e1_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-
-	rc = i2c_add_driver(&s5k4e1_i2c_driver);
-	if (rc < 0 || s5k4e1_client == NULL) {
-		rc = -ENOTSUPP;
-		CDBG("I2C add driver failed");
-		goto probe_fail_1;
-	}
-
-	rc = i2c_add_driver(&s5k4e1_af_i2c_driver);
-	if (rc < 0 || s5k4e1_af_client == NULL) {
-		rc = -ENOTSUPP;
-		CDBG("I2C add driver failed");
-		goto probe_fail_2;
-	}
-
-	msm_camio_clk_rate_set(S5K4E1_MASTER_CLK_RATE);
-
-	rc = s5k4e1_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail_3;
-
-	s->s_init = s5k4e1_sensor_open_init;
-	s->s_release = s5k4e1_sensor_release;
-	s->s_config  = s5k4e1_sensor_config;
-	s->s_mount_angle = info->sensor_platform_info->mount_angle;
-	gpio_set_value_cansleep(info->sensor_reset, 0);
-	s5k4e1_probe_init_done(info);
-	/* Keep vcm_pwd to OUT Low */
-	if (info->vcm_enable) {
-		rc = gpio_request(info->vcm_pwd, "s5k4e1_af");
-		if (!rc) {
-			gpio_direction_output(info->vcm_pwd, 0);
-			msleep(20);
-			gpio_free(info->vcm_pwd);
-		} else
-			return rc;
-	}
-	return rc;
-
-probe_fail_3:
-	i2c_del_driver(&s5k4e1_af_i2c_driver);
-probe_fail_2:
-	i2c_del_driver(&s5k4e1_i2c_driver);
-probe_fail_1:
-	CDBG("s5k4e1_sensor_probe: SENSOR PROBE FAILS!\n");
-	return rc;
-}
-
-static int __devinit s5k4e1_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, s5k4e1_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = s5k4e1_probe,
-	.driver = {
-		.name = "msm_camera_s5k4e1",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init s5k4e1_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(s5k4e1_init);
-MODULE_DESCRIPTION("Samsung 5 MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/s5k4e1.h b/drivers/media/video/msm/s5k4e1.h
deleted file mode 100644
index d58b3f0..0000000
--- a/drivers/media/video/msm/s5k4e1.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef S5K4E1_H
-#define S5K4E1_H
-#include <linux/types.h>
-#include <mach/board.h>
-extern struct s5k4e1_reg s5k4e1_regs;
-
-struct s5k4e1_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-enum s5k4e1_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum s5k4e1_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-enum s5k4e1_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-enum s5k4e1_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-enum s5k4e1_reg_pll {
-	E013_VT_PIX_CLK_DIV,
-	E013_VT_SYS_CLK_DIV,
-	E013_PRE_PLL_CLK_DIV,
-	E013_PLL_MULTIPLIER,
-	E013_OP_PIX_CLK_DIV,
-	E013_OP_SYS_CLK_DIV
-};
-
-enum s5k4e1_reg_mode {
-	E013_X_ADDR_START,
-	E013_X_ADDR_END,
-	E013_Y_ADDR_START,
-	E013_Y_ADDR_END,
-	E013_X_OUTPUT_SIZE,
-	E013_Y_OUTPUT_SIZE,
-	E013_DATAPATH_SELECT,
-	E013_READ_MODE,
-	E013_ANALOG_CONTROL5,
-	E013_DAC_LD_4_5,
-	E013_SCALING_MODE,
-	E013_SCALE_M,
-	E013_LINE_LENGTH_PCK,
-	E013_FRAME_LENGTH_LINES,
-	E013_COARSE_INTEGRATION_TIME,
-	E013_FINE_INTEGRATION_TIME,
-	E013_FINE_CORRECTION
-};
-
-struct s5k4e1_reg {
-	const struct s5k4e1_i2c_reg_conf *reg_mipi;
-	const unsigned short reg_mipi_size;
-	const struct s5k4e1_i2c_reg_conf *rec_settings;
-	const unsigned short rec_size;
-	const struct s5k4e1_i2c_reg_conf *reg_pll_p;
-	const unsigned short reg_pll_p_size;
-	const struct s5k4e1_i2c_reg_conf *reg_pll_s;
-	const unsigned short reg_pll_s_size;
-	const struct s5k4e1_i2c_reg_conf *reg_prev;
-	const unsigned short reg_prev_size;
-	const struct s5k4e1_i2c_reg_conf *reg_snap;
-	const unsigned short reg_snap_size;
-};
-#endif /* S5K4E1_H */
diff --git a/drivers/media/video/msm/s5k4e1_reg.c b/drivers/media/video/msm/s5k4e1_reg.c
deleted file mode 100644
index 679ef17..0000000
--- a/drivers/media/video/msm/s5k4e1_reg.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-
-#include "s5k4e1.h"
-
-struct s5k4e1_i2c_reg_conf s5k4e1_mipi_settings[] = {
-	{0x30BD, 0x00},/* SEL_CCP[0] */
-	{0x3084, 0x15},/* SYNC Mode */
-	{0x30BE, 0x1A},/* M_PCLKDIV_AUTO[4], M_DIV_PCLK[3:0] */
-	{0x30C1, 0x01},/* pack video enable [0] */
-	{0x30EE, 0x02},/* DPHY enable [ 1] */
-	{0x3111, 0x86},/* Embedded data off [5] */
-};
-
-/* PLL Configuration */
-struct s5k4e1_i2c_reg_conf s5k4e1_pll_preview_settings[] = {
-	{0x0305, 0x04},
-	{0x0306, 0x00},
-	{0x0307, 0x44},
-	{0x30B5, 0x00},
-	{0x30E2, 0x01},/* num lanes[1:0] = 2 */
-	{0x30F1, 0xB0},
-};
-
-struct s5k4e1_i2c_reg_conf s5k4e1_pll_snap_settings[] = {
-	{0x0305, 0x04},
-	{0x0306, 0x00},
-	{0x0307, 0x44},
-	{0x30B5, 0x00},
-	{0x30E2, 0x01},/* num lanes[1:0] = 2 */
-	{0x30F1, 0xB0},
-};
-
-struct s5k4e1_i2c_reg_conf s5k4e1_prev_settings[] = {
-	/* output size (1304 x 980) */
-	{0x30A9, 0x02},/* Horizontal Binning On */
-	{0x300E, 0xEB},/* Vertical Binning On */
-	{0x0387, 0x03},/* y_odd_inc 03(10b AVG) */
-	{0x0344, 0x00},/* x_addr_start 0 */
-	{0x0345, 0x00},
-	{0x0348, 0x0A},/* x_addr_end 2607 */
-	{0x0349, 0x2F},
-	{0x0346, 0x00},/* y_addr_start 0 */
-	{0x0347, 0x00},
-	{0x034A, 0x07},/* y_addr_end 1959 */
-	{0x034B, 0xA7},
-	{0x0380, 0x00},/* x_even_inc 1 */
-	{0x0381, 0x01},
-	{0x0382, 0x00},/* x_odd_inc 1 */
-	{0x0383, 0x01},
-	{0x0384, 0x00},/* y_even_inc 1 */
-	{0x0385, 0x01},
-	{0x0386, 0x00},/* y_odd_inc 3 */
-	{0x0387, 0x03},
-	{0x034C, 0x05},/* x_output_size 1304 */
-	{0x034D, 0x18},
-	{0x034E, 0x03},/* y_output_size 980 */
-	{0x034F, 0xd4},
-	{0x30BF, 0xAB},/* outif_enable[7], data_type[5:0](2Bh = bayer 10bit} */
-	{0x30C0, 0xA0},/* video_offset[7:4] 3260%12 */
-	{0x30C8, 0x06},/* video_data_length 1600 = 1304 * 1.25 */
-	{0x30C9, 0x5E},
-	/* Timing Configuration */
-	{0x0202, 0x03},
-	{0x0203, 0x14},
-	{0x0204, 0x00},
-	{0x0205, 0x80},
-	{0x0340, 0x03},/* Frame Length */
-	{0x0341, 0xE0},
-	{0x0342, 0x0A},/* 2738  Line Length */
-	{0x0343, 0xB2},
-};
-
-struct s5k4e1_i2c_reg_conf s5k4e1_snap_settings[] = {
-	/*Output Size (2608x1960)*/
-	{0x30A9, 0x03},/* Horizontal Binning Off */
-	{0x300E, 0xE8},/* Vertical Binning Off */
-	{0x0387, 0x01},/* y_odd_inc */
-	{0x034C, 0x0A},/* x_output size */
-	{0x034D, 0x30},
-	{0x034E, 0x07},/* y_output size */
-	{0x034F, 0xA8},
-	{0x30BF, 0xAB},/* outif_enable[7], data_type[5:0](2Bh = bayer 10bit} */
-	{0x30C0, 0x80},/* video_offset[7:4] 3260%12 */
-	{0x30C8, 0x0C},/* video_data_length 3260 = 2608 * 1.25 */
-	{0x30C9, 0xBC},
-	/*Timing configuration*/
-	{0x0202, 0x06},
-	{0x0203, 0x28},
-	{0x0204, 0x00},
-	{0x0205, 0x80},
-	{0x0340, 0x07},/* Frame Length */
-	{0x0341, 0xB4},
-	{0x0342, 0x0A},/* 2738 Line Length */
-	{0x0343, 0xB2},
-};
-
-struct s5k4e1_i2c_reg_conf s5k4e1_recommend_settings[] = {
-	/*CDS timing setting ... */
-	{0x3000, 0x05},
-	{0x3001, 0x03},
-	{0x3002, 0x08},
-	{0x3003, 0x0A},
-	{0x3004, 0x50},
-	{0x3005, 0x0E},
-	{0x3006, 0x5E},
-	{0x3007, 0x00},
-	{0x3008, 0x78},
-	{0x3009, 0x78},
-	{0x300A, 0x50},
-	{0x300B, 0x08},
-	{0x300C, 0x14},
-	{0x300D, 0x00},
-	{0x300E, 0xE8},
-	{0x300F, 0x82},
-	{0x301B, 0x77},
-
-	/* CDS option setting ... */
-	{0x3010, 0x00},
-	{0x3011, 0x3A},
-	{0x3029, 0x04},
-	{0x3012, 0x30},
-	{0x3013, 0xA0},
-	{0x3014, 0x00},
-	{0x3015, 0x00},
-	{0x3016, 0x30},
-	{0x3017, 0x94},
-	{0x3018, 0x70},
-	{0x301D, 0xD4},
-	{0x3021, 0x02},
-	{0x3022, 0x24},
-	{0x3024, 0x40},
-	{0x3027, 0x08},
-
-	/* Pixel option setting ...   */
-	{0x301C, 0x04},
-	{0x30D8, 0x3F},
-	{0x302B, 0x01},
-
-	{0x3070, 0x5F},
-	{0x3071, 0x00},
-	{0x3080, 0x04},
-	{0x3081, 0x38},
-};
-
-struct s5k4e1_reg s5k4e1_regs = {
-	.reg_mipi = &s5k4e1_mipi_settings[0],
-	.reg_mipi_size = ARRAY_SIZE(s5k4e1_mipi_settings),
-	.rec_settings = &s5k4e1_recommend_settings[0],
-	.rec_size = ARRAY_SIZE(s5k4e1_recommend_settings),
-	.reg_pll_p = &s5k4e1_pll_preview_settings[0],
-	.reg_pll_p_size = ARRAY_SIZE(s5k4e1_pll_preview_settings),
-	.reg_pll_s = &s5k4e1_pll_snap_settings[0],
-	.reg_pll_s_size = ARRAY_SIZE(s5k4e1_pll_snap_settings),
-	.reg_prev = &s5k4e1_prev_settings[0],
-	.reg_prev_size = ARRAY_SIZE(s5k4e1_prev_settings),
-	.reg_snap = &s5k4e1_snap_settings[0],
-	.reg_snap_size = ARRAY_SIZE(s5k4e1_snap_settings),
-};
diff --git a/drivers/media/video/msm/sensors/Makefile b/drivers/media/video/msm/sensors/Makefile
index 25b1374..b56b811 100644
--- a/drivers/media/video/msm/sensors/Makefile
+++ b/drivers/media/video/msm/sensors/Makefile
@@ -1,19 +1,29 @@
 GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
 EXTRA_CFLAGS += -Idrivers/media/video/msm
 EXTRA_CFLAGS += -Idrivers/media/video/msm/io
-EXTRA_CFLAGS += -Idrivers/media/video/msm/eeprom
 EXTRA_CFLAGS += -Idrivers/media/video/msm/csi
-obj-$(CONFIG_MSM_CAMERA_SENSOR) += msm_sensor_common.o msm_sensor.o msm_sensor_bayer.o msm_sensor_init.o
+obj-$(CONFIG_MSM_CAMERA_SENSOR) += msm_sensor.o
 obj-$(CONFIG_OV5647) += ov5647_v4l2.o
-obj-$(CONFIG_OV8825) += ov8825_v4l2.o
+obj-$(CONFIG_IMX091) += imx091_v4l2.o
+obj-$(CONFIG_IMX105) += imx105_v4l2.o
+obj-$(CONFIG_IMX175) += imx175_v4l2.o
+obj-$(CONFIG_MACH_ELITE) += imx175_2lane_v4l2.o
+obj-$(CONFIG_MACH_JET) += imx175_2lane_v4l2.o
+obj-$(CONFIG_IMX135) += imx135_v4l2.o
+obj-$(CONFIG_OV8838) += ov8838_v4l2.o
+obj-$(CONFIG_S5K3H2YX) += s5k3h2yx_v4l2.o
+obj-$(CONFIG_S5K6A1GX) += s5k6a1gx_v4l2.o
+obj-$(CONFIG_AR0260) += ar0260_v4l2.o
 obj-$(CONFIG_IMX074) += imx074_v4l2.o
 obj-$(CONFIG_S5K3L1YX) += s5k3l1yx.o
-obj-$(CONFIG_IMX135) += imx135_v4l2.o
 obj-$(CONFIG_OV2720) += ov2720.o
 obj-$(CONFIG_MT9M114) += mt9m114_v4l2.o
 obj-$(CONFIG_S5K4E1) += s5k4e1_v4l2.o
 obj-$(CONFIG_MT9E013) += mt9e013_v4l2.o
 obj-$(CONFIG_WEBCAM_OV9726) += ov9726_v4l2.o
-obj-$(CONFIG_OV7692) += ov7692_v4l2.o
-obj-$(CONFIG_VX6953) += vx6953.o
-obj-$(CONFIG_OV9724) += ov9724_v4l2.o
+obj-$(CONFIG_WEBCAM_OV7692_QRD) += ov7692_qrd_v4l2.o
+obj-$(CONFIG_MT9V113) += mt9v113_v4l2.o mt9v113_reg_lens_9251.o
+obj-$(CONFIG_OV2722) += ov2722_v4l2.o
+obj-$(CONFIG_OV5693) += ov5693_v4l2.o
+obj-$(CONFIG_S5K6A2YA) += s5k6a2ya_v4l2.o
+
diff --git a/drivers/media/video/msm/sensors/imx074_v4l2.c b/drivers/media/video/msm/sensors/imx074_v4l2.c
deleted file mode 100644
index f0759a8..0000000
--- a/drivers/media/video/msm/sensors/imx074_v4l2.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#define SENSOR_NAME "imx074"
-#define PLATFORM_DRIVER_NAME "msm_camera_imx074"
-#define imx074_obj imx074_##obj
-
-DEFINE_MUTEX(imx074_mut);
-static struct msm_sensor_ctrl_t imx074_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf imx074_start_settings[] = {
-	{0x0100, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf imx074_stop_settings[] = {
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx074_groupon_settings[] = {
-	{0x104, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf imx074_groupoff_settings[] = {
-	{0x104, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx074_prev_settings[] = {
-	{0x0307, 0x2D}, /*pll_multiplier*/
-	{0x0340, 0x06}, /*frame_length_lines_hi*/
-	{0x0341, 0x34}, /*frame_length_lines_lo*/
-	{0x0342, 0x11}, /*line_length_pclk_hi*/
-	{0x0343, 0x78}, /*line_length_pclk_lo*/
-	{0x0347, 0x00}, /*y_addr_start*/
-	{0x034b, 0x2F}, /*y_add_end*/
-	{0x034c, 0x08}, /*x_output_size_msb*/
-	{0x034d, 0x38}, /*x_output_size_lsb*/
-	{0x034e, 0x06}, /*y_output_size_msb*/
-	{0x034f, 0x18}, /*y_output_size_lsb*/
-	{0x0381, 0x01}, /*x_even_inc*/
-	{0x0383, 0x03}, /*x_odd_inc*/
-	{0x0385, 0x01}, /*y_even_inc*/
-	{0x0387, 0x03}, /*y_odd_inc*/
-	{0x3001, 0x80}, /*hmodeadd*/
-	{0x3016, 0x16}, /*vmodeadd*/
-	{0x3069, 0x24}, /*vapplinepos_start*/
-	{0x306b, 0x53}, /*vapplinepos_end*/
-	{0x3086, 0x00}, /*shutter*/
-	{0x30e8, 0x80}, /*haddave*/
-	{0x3301, 0x83}, /*lanesel*/
-};
-
-static struct msm_camera_i2c_reg_conf imx074_snap_settings[] = {
-	{0x0307, 0x26}, /*pll_multiplier*/
-	{0x0340, 0x0C}, /*frame_length_lines_hi*/
-	{0x0341, 0x90}, /*frame_length_lines_lo*/
-	{0x0342, 0x11}, /*line_length_pclk_hi*/
-	{0x0343, 0x78}, /*line_length_pclk_lo*/
-	{0x0347, 0x00}, /*y_addr_start*/
-	{0x034b, 0x2F}, /*y_add_end*/
-	{0x034c, 0x10}, /*x_output_size_msb*/
-	{0x034d, 0x70}, /*x_output_size_lsb*/
-	{0x034e, 0x0c}, /*y_output_size_msb*/
-	{0x034f, 0x30}, /*y_output_size_lsb*/
-	{0x0381, 0x01}, /*x_even_inc*/
-	{0x0383, 0x01}, /*x_odd_inc*/
-	{0x0385, 0x01}, /*y_even_inc*/
-	{0x0387, 0x01}, /*y_odd_inc*/
-	{0x3001, 0x00}, /*hmodeadd*/
-	{0x3016, 0x06}, /*vmodeadd*/
-	{0x3069, 0x24}, /*vapplinepos_start*/
-	{0x306b, 0x53}, /*vapplinepos_end*/
-	{0x3086, 0x00}, /*shutter*/
-	{0x30e8, 0x00}, /*haddave*/
-	{0x3301, 0x03}, /*lanesel*/
-};
-
-static struct msm_camera_i2c_reg_conf imx074_recommend_settings[] = {
-	{0x0305, 0x02},
-	{0x302b, 0x4B},
-	{0x3024, 0x03},
-	{0x0101, 0x00},
-	{0x300a, 0x80},
-	{0x3014, 0x08},
-	{0x3015, 0x37},
-	{0x301c, 0x01},
-	{0x302c, 0x05},
-	{0x3031, 0x26},
-	{0x3041, 0x60},
-	{0x3051, 0x24},
-	{0x3053, 0x34},
-	{0x3057, 0xc0},
-	{0x305c, 0x09},
-	{0x305d, 0x07},
-	{0x3060, 0x30},
-	{0x3065, 0x00},
-	{0x30aa, 0x08},
-	{0x30ab, 0x1c},
-	{0x30b0, 0x32},
-	{0x30b2, 0x83},
-	{0x30d3, 0x04},
-	{0x3106, 0x78},
-	{0x310c, 0x82},
-	{0x3304, 0x05},
-	{0x3305, 0x04},
-	{0x3306, 0x11},
-	{0x3307, 0x02},
-	{0x3308, 0x0c},
-	{0x3309, 0x06},
-	{0x330a, 0x08},
-	{0x330b, 0x04},
-	{0x330c, 0x08},
-	{0x330d, 0x06},
-	{0x330f, 0x01},
-	{0x3381, 0x00},
-};
-
-static struct v4l2_subdev_info imx074_subdev_info[] = {
-	{
-	.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array imx074_init_conf[] = {
-	{&imx074_recommend_settings[0],
-	ARRAY_SIZE(imx074_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array imx074_confs[] = {
-	{&imx074_snap_settings[0],
-	ARRAY_SIZE(imx074_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&imx074_prev_settings[0],
-	ARRAY_SIZE(imx074_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t imx074_dimensions[] = {
-	{
-		.x_output = 0x1070,
-		.y_output = 0xC30,
-		.line_length_pclk = 0x1178,
-		.frame_length_lines = 0xC90,
-		.vt_pixel_clk = 182400000,
-		.op_pixel_clk = 182400000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x838,
-		.y_output = 0x618,
-		.line_length_pclk = 0x1178,
-		.frame_length_lines = 0x634,
-		.vt_pixel_clk = 216000000,
-		.op_pixel_clk = 108000000,
-		.binning_factor = 2,
-	},
-};
-
-static struct msm_sensor_output_reg_addr_t imx074_reg_addr = {
-	.x_output = 0x34C,
-	.y_output = 0x34E,
-	.line_length_pclk = 0x342,
-	.frame_length_lines = 0x340,
-};
-
-static struct msm_sensor_id_info_t imx074_id_info = {
-	.sensor_id_reg_addr = 0x0,
-	.sensor_id = 0x0074,
-};
-
-static struct msm_sensor_exp_gain_info_t imx074_exp_gain_info = {
-	.coarse_int_time_addr = 0x202,
-	.global_gain_addr = 0x204,
-	.vert_offset = 3,
-};
-
-static enum msm_camera_vreg_name_t imx074_veg_seq[] = {
-	CAM_VDIG,
-	CAM_VIO,
-	CAM_VANA,
-	CAM_VAF,
-};
-
-static const struct i2c_device_id imx074_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&imx074_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver imx074_i2c_driver = {
-	.id_table = imx074_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client imx074_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	return i2c_add_driver(&imx074_i2c_driver);
-}
-
-static struct v4l2_subdev_core_ops imx074_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops imx074_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops imx074_subdev_ops = {
-	.core = &imx074_subdev_core_ops,
-	.video  = &imx074_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t imx074_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_write_snapshot_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_setting = msm_sensor_setting,
-	.sensor_csi_setting = msm_sensor_setting1,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-	.sensor_adjust_frame_lines = msm_sensor_adjust_frame_lines1,
-	.sensor_get_csi_params = msm_sensor_get_csi_params,
-};
-
-static struct msm_sensor_reg_t imx074_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = imx074_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(imx074_start_settings),
-	.stop_stream_conf = imx074_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(imx074_stop_settings),
-	.group_hold_on_conf = imx074_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(imx074_groupon_settings),
-	.group_hold_off_conf = imx074_groupoff_settings,
-	.group_hold_off_conf_size =
-		ARRAY_SIZE(imx074_groupoff_settings),
-	.init_settings = &imx074_init_conf[0],
-	.init_size = ARRAY_SIZE(imx074_init_conf),
-	.mode_settings = &imx074_confs[0],
-	.output_settings = &imx074_dimensions[0],
-	.num_conf = ARRAY_SIZE(imx074_confs),
-};
-
-static struct msm_sensor_ctrl_t imx074_s_ctrl = {
-	.msm_sensor_reg = &imx074_regs,
-	.sensor_i2c_client = &imx074_sensor_i2c_client,
-	.sensor_i2c_addr = 0x34,
-	.vreg_seq = imx074_veg_seq,
-	.num_vreg_seq = ARRAY_SIZE(imx074_veg_seq),
-	.sensor_output_reg_addr = &imx074_reg_addr,
-	.sensor_id_info = &imx074_id_info,
-	.sensor_exp_gain_info = &imx074_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &imx074_mut,
-	.sensor_i2c_driver = &imx074_i2c_driver,
-	.sensor_v4l2_subdev_info = imx074_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(imx074_subdev_info),
-	.sensor_v4l2_subdev_ops = &imx074_subdev_ops,
-	.func_tbl = &imx074_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Sony 13MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/imx091.c b/drivers/media/video/msm/sensors/imx091.c
deleted file mode 100644
index 428067b..0000000
--- a/drivers/media/video/msm/sensors/imx091.c
+++ /dev/null
@@ -1,459 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-#include "msm_sensor.h"
-#define SENSOR_NAME "imx091"
-#define PLATFORM_DRIVER_NAME "msm_camera_imx091"
-#define imx091_obj imx091_##obj
-
-DEFINE_MUTEX(imx091_mut);
-static struct msm_sensor_ctrl_t imx091_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf imx091_start_settings[] = {
-	{0x0100, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf imx091_stop_settings[] = {
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx091_groupon_settings[] = {
-	{0x0104, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf imx091_groupoff_settings[] = {
-	{0x0104, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx091_prev_settings[] = {
-#ifdef CONFIG_MACH_LGE
-	{0x0307, 0x2F},
-	{0x303C, 0x4B},
-	{0x0340, 0x06},
-	{0x0341, 0x46},
-	{0x0346, 0x00},
-	{0x0347, 0x30},
-	{0x034A, 0x0C},
-	{0x034B, 0x5F},
-	{0x034C, 0x08},
-	{0x034D, 0x38},
-	{0x034E, 0x06},
-	{0x034F, 0x18},
-	{0x0381, 0x01},
-	{0x0383, 0x03},
-	{0x0385, 0x01},
-	{0x0387, 0x03},
-	{0x3048, 0x01},
-	{0x3064, 0x12},
-	{0x309B, 0x28},
-	{0x309E, 0x00},
-	{0x30D5, 0x09},
-	{0x30D6, 0x01},
-	{0x30D7, 0x01},
-	{0x30D8, 0x64},
-	{0x30D9, 0x89},
-	{0x30DE, 0x02},
-	{0x3102, 0x10},
-	{0x3103, 0x44},
-	{0x3104, 0x40},
-	{0x3105, 0x00},
-	{0x3106, 0x0D},
-	{0x3107, 0x01},
-	{0x310A, 0x0A},
-	{0x315C, 0x99},
-	{0x315D, 0x98},
-	{0x316E, 0x9A},
-	{0x316F, 0x99},
-	{0x3304, 0x05},
-	{0x3305, 0x04},
-	{0x3306, 0x12},
-	{0x3307, 0x03},
-	{0x3308, 0x0D},
-	{0x3309, 0x05},
-	{0x330A, 0x09},
-	{0x330B, 0x04},
-	{0x330C, 0x08},
-	{0x330D, 0x05},
-	{0x330E, 0x03},
-	{0x3318, 0x73},
-	{0x3322, 0x02},
-	{0x3342, 0x0F},
-#else
-	/* 30fps 1/2 * 1/2 */
-	/* PLL setting */
-	{0x0305, 0x02}, /* pre_pll_clk_div[7:0] */
-	{0x0307, 0x2F}, /* pll_multiplier[7:0] */
-	{0x30A4, 0x02},
-	{0x303C, 0x4B},
-	/* mode setting */
-	{0x0340, 0x06}, /* frame_length_lines[15:8] */
-	{0x0341, 0x5A}, /* frame_length_lines[7:0] */
-	{0x0342, 0x12}, /* line_length_pck[15:8] */
-	{0x0343, 0x0C}, /* line_length_pck[7:0] */
-	{0x0344, 0x00}, /* x_addr_start[15:8] */
-	{0x0345, 0x08}, /* x_addr_start[7:0] */
-	{0x0346, 0x00}, /* y_addr_start[15:8] */
-	{0x0347, 0x30}, /* y_addr_start[7:0] */
-	{0x0348, 0x10}, /* x_addr_end[15:8] */
-	{0x0349, 0x77}, /* x_addr_end[7:0] */
-	{0x034A, 0x0C}, /* y_addr_end[15:8] */
-	{0x034B, 0x5F}, /* y_addr_end[7:0] */
-	{0x034C, 0x08}, /* x_output_size[15:8] */
-	{0x034D, 0x38}, /* x_output_size[7:0] */
-	{0x034E, 0x06}, /* y_output_size[15:8] */
-	{0x034F, 0x18}, /* y_output_size[7:0] */
-	{0x0381, 0x01}, /* x_even_inc[3:0] */
-	{0x0383, 0x03}, /* x_odd_inc[3:0] */
-	{0x0385, 0x01}, /* y_even_inc[7:0] */
-	{0x0387, 0x03}, /* y_odd_inc[7:0] */
-	{0x3040, 0x08},
-	{0x3041, 0x97},
-	{0x3048, 0x01},
-	{0x3064, 0x12},
-	{0x309B, 0x28},
-	{0x309E, 0x00},
-	{0x30D5, 0x09},
-	{0x30D6, 0x01},
-	{0x30D7, 0x01},
-	{0x30D8, 0x64},
-	{0x30D9, 0x89},
-	{0x30DE, 0x02},
-	{0x3102, 0x10},
-	{0x3103, 0x44},
-	{0x3104, 0x40},
-	{0x3105, 0x00},
-	{0x3106, 0x0D},
-	{0x3107, 0x01},
-	{0x310A, 0x0A},
-	{0x315C, 0x99},
-	{0x315D, 0x98},
-	{0x316E, 0x9A},
-	{0x316F, 0x99},
-	{0x3318, 0x73},
-#endif
-};
-
-static struct msm_camera_i2c_reg_conf imx091_snap_settings[] = {
-	/* full size */
-	/* PLL setting */
-#ifdef CONFIG_MACH_LGE
-	{0x0307, 0x2F}, //pll mul 47
-	{0x303C, 0x4B}, //mclk 24M
-	{0x0340, 0x0C}, //Frame length 3212
-	{0x0341, 0x8C},
-	{0x0346, 0x00}, // y start
-	{0x0347, 0x30},
-	{0x034A, 0x0C}, // y end
-	{0x034B, 0x5F},
-	{0x034C, 0x10}, // x output 4208
-	{0x034D, 0x70},
-	{0x034E, 0x0C}, // y output 3120
-	{0x034F, 0x30},
-	{0x0381, 0x01}, // x even inc
-	{0x0383, 0x01}, // x odd inc
-	{0x0385, 0x01}, //y even inc
-	{0x0387, 0x01}, // y odd inc
-	{0x3048, 0x00},
-	{0x3064, 0x12},
-	{0x309B, 0x20},
-	{0x309E, 0x00},
-	{0x30D5, 0x00},
-	{0x30D6, 0x85},
-	{0x30D7, 0x2A},
-	{0x30D8, 0x64},
-	{0x30D9, 0x89},
-	{0x30DE, 0x00},
-	{0x3102, 0x10},
-	{0x3103, 0x44},
-	{0x3104, 0x40},
-	{0x3105, 0x00},
-	{0x3106, 0x0D},
-	{0x3107, 0x01},
-	{0x310A, 0x0A},
-	{0x315C, 0x99},
-	{0x315D, 0x98},
-	{0x316E, 0x9A},
-	{0x316F, 0x99},
-	{0x3304, 0x05},
-	{0x3305, 0x04},
-	{0x3306, 0x12},
-	{0x3307, 0x03},
-	{0x3308, 0x0D},
-	{0x3309, 0x05},
-	{0x330A, 0x09},
-	{0x330B, 0x04},
-	{0x330C, 0x08},
-	{0x330D, 0x05},
-	{0x330E, 0x03},
-	{0x3318, 0x64},
-	{0x3322, 0x02},
-	{0x3342, 0x0F},
-#else
-	{0x0305, 0x02}, /* pre_pll_clk_div[7:0] */
-	{0x0307, 0x2B}, /* pll_multiplier[7:0] */
-	{0x30A4, 0x02},
-	{0x303C, 0x4B},
-	/* mode setting */
-	{0x0340, 0x0C}, /* frame_length_lines[15:8] */
-	{0x0341, 0x8C}, /* frame_length_lines[7:0] */
-	{0x0342, 0x12}, /* line_length_pck[15:8] */
-	{0x0343, 0x0C}, /* line_length_pck[7:0] */
-	{0x0344, 0x00}, /* x_addr_start[15:8] */
-	{0x0345, 0x08}, /* x_addr_start[7:0] */
-	{0x0346, 0x00}, /* y_addr_start[15:8] */
-	{0x0347, 0x30}, /* y_addr_start[7:0] */
-	{0x0348, 0x10}, /* x_addr_end[15:8] */
-	{0x0349, 0x77}, /* x_addr_end[7:0] */
-	{0x034A, 0x0C}, /* y_addr_end[15:8] */
-	{0x034B, 0x5F}, /* y_addr_end[7:0] */
-	{0x034C, 0x10}, /* x_output_size[15:8] */
-	{0x034D, 0x70}, /* x_output_size[7:0] */
-	{0x034E, 0x0C}, /* y_output_size[15:8] */
-	{0x034F, 0x30}, /* y_output_size[7:0] */
-	{0x0381, 0x01}, /* x_even_inc[3:0] */
-	{0x0383, 0x01}, /* x_odd_inc[3:0] */
-	{0x0385, 0x01}, /* y_even_inc[7:0] */
-	{0x0387, 0x01}, /* y_odd_inc[7:0] */
-	{0x3040, 0x08},
-	{0x3041, 0x97},
-	{0x3048, 0x00},
-	{0x3064, 0x12},
-	{0x309B, 0x20},
-	{0x309E, 0x00},
-	{0x30D5, 0x00},
-	{0x30D6, 0x85},
-	{0x30D7, 0x2A},
-	{0x30D8, 0x64},
-	{0x30D9, 0x89},
-	{0x30DE, 0x00},
-	{0x3102, 0x10},
-	{0x3103, 0x44},
-	{0x3104, 0x40},
-	{0x3105, 0x00},
-	{0x3106, 0x0D},
-	{0x3107, 0x01},
-	{0x310A, 0x0A},
-	{0x315C, 0x99},
-	{0x315D, 0x98},
-	{0x316E, 0x9A},
-	{0x316F, 0x99},
-	{0x3318, 0x64},
-#endif
-};
-
-static struct msm_camera_i2c_reg_conf imx091_recommend_settings[] = {
-	/* global setting */
-	{0x3087, 0x53},
-	{0x309D, 0x94},
-	{0x30A1, 0x08},
-	{0x30C7, 0x00},
-	{0x3115, 0x0E},
-	{0x3118, 0x42},
-	{0x311D, 0x34},
-	{0x3121, 0x0D},
-	{0x3212, 0xF2},
-	{0x3213, 0x0F},
-	{0x3215, 0x0F},
-	{0x3217, 0x0B},
-	{0x3219, 0x0B},
-	{0x321B, 0x0D},
-	{0x321D, 0x0D},
-	/* black level setting */
-	{0x3032, 0x40},
-};
-
-static struct v4l2_subdev_info imx091_subdev_info[] = {
-	{
-	.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array imx091_init_conf[] = {
-	{&imx091_recommend_settings[0],
-	ARRAY_SIZE(imx091_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array imx091_confs[] = {
-	{&imx091_snap_settings[0],
-	ARRAY_SIZE(imx091_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&imx091_prev_settings[0],
-	ARRAY_SIZE(imx091_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t imx091_dimensions[] = {
-	{
-	/* full size */
-		.x_output = 0x1070, /* 4208 */
-		.y_output = 0x0C30, /* 3120 */
-		.line_length_pclk = 0x120C, /* 4620 */
-		.frame_length_lines = 0x0C8C, /* 3212 */
-		.vt_pixel_clk = 206400000,
-		.op_pixel_clk = 206400000,
-		.binning_factor = 1,
-	},
-	{
-	/* 30 fps 1/2 * 1/2 */
-		.x_output = 0x0838, /* 2104 */
-		.y_output = 0x0618, /* 1560 */
-		.line_length_pclk = 0x120C, /* 4620 */
-#ifdef CONFIG_MACH_LGE
-		.frame_length_lines = 0x0646, //1606,
-#else
-		.frame_length_lines = 0x065A, /* 1626 */
-#endif
-		.vt_pixel_clk = 225600000,
-		.op_pixel_clk = 225600000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_camera_csid_vc_cfg imx091_cid_cfg[] = {
-	{0, CSI_RAW10, CSI_DECODE_10BIT},
-	{1, CSI_EMBED_DATA, CSI_DECODE_8BIT},
-	{2, CSI_RESERVED_DATA_0, CSI_DECODE_8BIT},
-};
-
-static struct msm_camera_csi2_params imx091_csi_params = {
-	.csid_params = {
-		.lane_cnt = 4,
-		.lut_params = {
-			.num_cid = ARRAY_SIZE(imx091_cid_cfg),
-			.vc_cfg = imx091_cid_cfg,
-		},
-	},
-	.csiphy_params = {
-		.lane_cnt = 4,
-		.settle_cnt = 0x12,
-	},
-};
-
-static struct msm_camera_csi2_params *imx091_csi_params_array[] = {
-	&imx091_csi_params,
-	&imx091_csi_params,
-};
-
-static struct msm_sensor_output_reg_addr_t imx091_reg_addr = {
-	.x_output = 0x034C,
-	.y_output = 0x034E,
-	.line_length_pclk = 0x0342,
-	.frame_length_lines = 0x0340,
-};
-
-static struct msm_sensor_id_info_t imx091_id_info = {
-	.sensor_id_reg_addr = 0x0000,
-	.sensor_id = 0x0091,
-};
-
-static struct msm_sensor_exp_gain_info_t imx091_exp_gain_info = {
-	.coarse_int_time_addr = 0x0202,
-	.global_gain_addr = 0x0204,
-	.vert_offset = 5,
-};
-
-static const struct i2c_device_id imx091_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&imx091_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver imx091_i2c_driver = {
-	.id_table = imx091_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client imx091_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-
-static int __init imx091_sensor_init_module(void)
-{
-	return i2c_add_driver(&imx091_i2c_driver);
-}
-
-static struct v4l2_subdev_core_ops imx091_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops imx091_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops imx091_subdev_ops = {
-	.core = &imx091_subdev_core_ops,
-	.video  = &imx091_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t imx091_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_write_snapshot_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_setting = msm_sensor_setting,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-	.sensor_adjust_frame_lines = msm_sensor_adjust_frame_lines1,
-	.sensor_get_csi_params = msm_sensor_get_csi_params,
-};
-
-static struct msm_sensor_reg_t imx091_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = imx091_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(imx091_start_settings),
-	.stop_stream_conf = imx091_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(imx091_stop_settings),
-	.group_hold_on_conf = imx091_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(imx091_groupon_settings),
-	.group_hold_off_conf = imx091_groupoff_settings,
-	.group_hold_off_conf_size = ARRAY_SIZE(imx091_groupoff_settings),
-	.init_settings = &imx091_init_conf[0],
-	.init_size = ARRAY_SIZE(imx091_init_conf),
-	.mode_settings = &imx091_confs[0],
-	.output_settings = &imx091_dimensions[0],
-	.num_conf = ARRAY_SIZE(imx091_confs),
-};
-
-static struct msm_sensor_ctrl_t imx091_s_ctrl = {
-	.msm_sensor_reg = &imx091_regs,
-	.sensor_i2c_client = &imx091_sensor_i2c_client,
-	.sensor_i2c_addr = 0x34,
-	.sensor_output_reg_addr = &imx091_reg_addr,
-	.sensor_id_info = &imx091_id_info,
-	.sensor_exp_gain_info = &imx091_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.csi_params = &imx091_csi_params_array[0],
-	.msm_sensor_mutex = &imx091_mut,
-	.sensor_i2c_driver = &imx091_i2c_driver,
-	.sensor_v4l2_subdev_info = imx091_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(imx091_subdev_info),
-	.sensor_v4l2_subdev_ops = &imx091_subdev_ops,
-	.func_tbl = &imx091_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(imx091_sensor_init_module);
-MODULE_DESCRIPTION("Sony 13MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/imx091.h b/drivers/media/video/msm/sensors/imx091.h
deleted file mode 100644
index d2a646e..0000000
--- a/drivers/media/video/msm/sensors/imx091.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-#define IMX091_SENSOR_NAME "imx091"
-DEFINE_MSM_MUTEX(imx091_mut);
-
-static struct msm_sensor_ctrl_t imx091_s_ctrl;
-
-static struct v4l2_subdev_info imx091_subdev_info[] = {
-	{
-	.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_sensor_id_info_t imx091_id_info = {
-	.sensor_id_reg_addr = 0x0000,
-	.sensor_id = 0x0091,
-};
-
-static enum msm_camera_vreg_name_t imx091_veg_seq[] = {
-	CAM_VANA,
-	CAM_VAF,
-	CAM_VDIG,
-	CAM_VIO,
-};
-
-static struct msm_camera_power_seq_t imx091_power_seq[] = {
-	{REQUEST_GPIO, 0},
-	{REQUEST_VREG, 0},
-	{ENABLE_VREG, 0},
-	{ENABLE_GPIO, 0},
-	{CONFIG_CLK, 1},
-	{CONFIG_I2C_MUX, 0},
-};
-
-static const struct i2c_device_id imx091_i2c_id[] = {
-	{IMX091_SENSOR_NAME, (kernel_ulong_t)&imx091_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver imx091_i2c_driver = {
-	.id_table = imx091_i2c_id,
-	.probe  = msm_sensor_bayer_i2c_probe,
-	.driver = {
-		.name = IMX091_SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client imx091_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static struct v4l2_subdev_core_ops imx091_subdev_core_ops = {
-	.ioctl = msm_sensor_bayer_subdev_ioctl,
-	.s_power = msm_sensor_bayer_power,
-};
-
-static struct v4l2_subdev_video_ops imx091_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_bayer_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops imx091_subdev_ops = {
-	.core = &imx091_subdev_core_ops,
-	.video  = &imx091_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t imx091_func_tbl = {
-	.sensor_config = msm_sensor_bayer_config,
-	.sensor_power_up = msm_sensor_bayer_power_up,
-	.sensor_power_down = msm_sensor_bayer_power_down,
-	.sensor_get_csi_params = msm_sensor_bayer_get_csi_params,
-};
-
-static struct msm_sensor_ctrl_t imx091_s_ctrl = {
-	.sensor_i2c_client = &imx091_sensor_i2c_client,
-	.sensor_i2c_addr = 0x34,
-	.vreg_seq = imx091_veg_seq,
-	.num_vreg_seq = ARRAY_SIZE(imx091_veg_seq),
-	.power_seq = &imx091_power_seq[0],
-	.num_power_seq = ARRAY_SIZE(imx091_power_seq),
-	.sensor_id_info = &imx091_id_info,
-	.msm_sensor_mutex = &imx091_mut,
-	.sensor_v4l2_subdev_info = imx091_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(imx091_subdev_info),
-	.sensor_v4l2_subdev_ops = &imx091_subdev_ops,
-	.func_tbl = &imx091_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
diff --git a/drivers/media/video/msm/sensors/imx105_v4l2.c b/drivers/media/video/msm/sensors/imx105_v4l2.c
new file mode 100644
index 0000000..d838a61
--- /dev/null
+++ b/drivers/media/video/msm/sensors/imx105_v4l2.c
@@ -0,0 +1,987 @@
+/*HTC start Tom Lin 2011/12/19 Sony IMX105 8M driver */
+
+#include "msm_sensor.h"
+
+#ifdef CONFIG_RAWCHIP
+#include "rawchip/rawchip.h"
+#endif
+
+#define SENSOR_NAME "imx105"
+#define PLATFORM_DRIVER_NAME "msm_camera_imx105"
+#define imx105_obj imx105_##obj
+
+#define IMX105_REG_READ_MODE 0x0101
+#define IMX105_READ_NORMAL_MODE 0x0000	/* without mirror/flip */
+#define IMX105_READ_MIRROR 0x0001			/* with mirror */
+#define IMX105_READ_FLIP 0x0002			/* with flip */
+#define IMX105_READ_MIRROR_FLIP 0x0003/* with mirror/flip */
+
+DEFINE_MUTEX(imx105_mut);
+static struct msm_sensor_ctrl_t imx105_s_ctrl;
+
+static struct msm_camera_i2c_reg_conf imx105_start_settings[] = {
+	{0x0100, 0x01},
+};
+
+static struct msm_camera_i2c_reg_conf imx105_stop_settings[] = {
+	{0x0100, 0x00},
+};
+
+static struct msm_camera_i2c_reg_conf imx105_groupon_settings[] = {
+	{0x104, 0x01},
+};
+
+static struct msm_camera_i2c_reg_conf imx105_groupoff_settings[] = {
+	{0x104, 0x00},
+};
+
+static struct msm_camera_i2c_reg_conf imx105_mipi_settings[] = {
+	/* Global Setting V4.1 From SONY */	
+	{0x3031, 0x10},
+	{0x3064, 0x12},
+	{0x3087, 0x57},
+	{0x308A, 0x35},
+	{0x3091, 0x41},
+	{0x3098, 0x03},
+	{0x3099, 0xC0},
+	{0x309A, 0xA3},
+	{0x309D, 0x94},
+	{0x30AB, 0x01},
+	{0x30AD, 0x00},
+	{0x30B1, 0x03},
+	{0x30C4, 0x17},
+	{0x30F3, 0x03},
+	{0x3116, 0x31},
+	{0x3117, 0x38},
+	{0x3138, 0x28},
+	{0x3137, 0x14},
+	{0x3139, 0x2E},
+	{0x314D, 0x2A},
+	{0x328F, 0x01},
+	{0x3343, 0x04},
+};
+
+static struct msm_camera_i2c_reg_conf imx105_pll_settings[] = {
+	/* PLL Setting EXTCLK=24MHz, PLL=672MHz, 15fps */
+	{0x0305, 0x01}, /*Pre_PLL_clk_div*/
+	{0x0307, 0x1C}, /*PLL_multiplier */
+	{0x303C, 0x4B},/*wait time for 24MHz MCLK*/
+};
+
+
+static struct msm_camera_i2c_reg_conf imx105_prev_settings[] = {
+	/* PLL Setting EXTCLK=24MHz, PLL=672MHz, 15fps */
+	{0x0305, 0x01}, /*Pre_PLL_clk_div*/
+	{0x0307, 0x1C}, /*PLL_multiplier */
+	{0x303C, 0x4B},/*wait time for 24MHz MCLK*/
+
+	/* Global Setting V4.1 From SONY */	
+	{0x3031, 0x10},/*change to 01 for continous mode and 10 for non continous mode*/
+	{0x3064, 0x12},
+	{0x3087, 0x57},
+	{0x308A, 0x35},
+	{0x3091, 0x41},
+	{0x3098, 0x03},
+	{0x3099, 0xC0},
+	{0x309A, 0xA3},
+	{0x309D, 0x94},
+	{0x30AB, 0x01},
+	{0x30AD, 0x00},
+	{0x30B1, 0x03},
+	{0x30C4, 0x17},
+	{0x30F3, 0x03},
+	{0x3116, 0x31},
+	{0x3117, 0x38},
+	{0x3138, 0x28},
+	{0x3137, 0x14},
+	{0x3139, 0x2E},
+	{0x314D, 0x2A},
+	{0x328F, 0x01},
+	{0x3343, 0x04},		
+
+	/*VCM Init*/
+	{0x3408, 0x02}, 
+	{0x340A, 0x01}, 
+	{0x340C, 0x01},
+	{0x3081, 0x48},
+	{0x3400, 0x01}, /*[0]Damping control 0:Off, 1:On, [1]Independent standby control 0:Operation, 1:Standby*/
+	{0x3401, 0x0F},
+	{0x3404, 0x17}, 
+	{0x3405, 0x00}, 
+
+	/*Preview mode*/
+	{0x0340, 0x04}, /*frame_length_lines_hi*/
+	{0x0341, 0xF2}, /*frame_length_lines_lo*/
+	{0x0342, 0x0D}, /*line_length_pclk_hi*/
+	{0x0343, 0xD0}, /*line_length_pclk_lo*/
+	{0x0346, 0x00}, /*Y_addr_start_hi*/
+	{0x0347, 0x24}, /*Y_addr_start_lo*/
+	{0x034a, 0x09}, /*y_add_end_hi*/
+	{0x034b, 0xC3}, /*y_add_end_lo*/
+	{0x034c, 0x06}, /*x_output_size_msb*/
+	{0x034d, 0x68}, /*x_output_size_lsb*/
+	{0x034e, 0x04}, /*y_output_size_msb*/
+	{0x034f, 0xD0}, /*y_output_size_lsb*/
+	{0x0381, 0x01}, /*x_even_inc*/
+	{0x0383, 0x03}, /*x_odd_inc*/
+	{0x0385, 0x01}, /*y_even_inc*/
+	{0x0387, 0x03}, /*y_odd_inc*/
+	{0x3033, 0x00}, /*HD mode operation setting Default:0x00*/
+	{0x3048, 0x01}, /*0x3048[0]:VMODEFDS, 0x3048[1]:VMODEADD, 0x3048[5:7]:VMODEADDJMP, Default:0x00*/
+	{0x304C, 0x6F}, /*Pixel readout count number 0x304C:HCNTHALF[0:7], 0x304D:HCNTHALF[8:10], Default:0x304C=0x6F, 0x304D=0x03*/
+	{0x304D, 0x03},
+	{0x306A, 0xD2}, 
+	{0x309B, 0x28}, 
+	{0x309C, 0x34}, 
+	{0x309E, 0x00}, 
+	{0x30AA, 0x03}, 
+	{0x30D5, 0x09},
+	{0x30D6, 0x01}, 
+	{0x30D7, 0x01}, 
+	{0x30DE, 0x02},
+	{0x3102, 0x08},
+	{0x3103, 0x22},
+	{0x3104, 0x20},
+	{0x3105, 0x00},
+	{0x3106, 0x87},
+	{0x3107, 0x00},
+	{0x315C, 0xA5},
+	{0x315D, 0xA4},
+	{0x316E, 0xA6},
+	{0x316F, 0xA5},
+	{0x3318, 0x72},
+	{0x0202, 0x04}, /*0x0202-0203, 1 <= Coarse_Integration_time <= frame_length_lines -5*/
+	{0x0203, 0xED}
+};
+
+static struct msm_camera_i2c_reg_conf imx105_video_settings[] = {
+
+	/* PLL Setting EXTCLK=24MHz, PLL=876MHz */
+	{0x0305, 0x04}, /*Pre_PLL_clk_div*/
+	{0x0307, 0x92}, /*PLL_multiplier */
+	{0x30A4, 0x02}, /*Post_PLL_clk_div*/
+	{0x303C, 0x4B},/*wait time for 24MHz MCLK*/
+
+	/* Global Setting V4.1 From SONY */
+	{0x3031, 0x10}, /*change to 01 for continous mode and 10 for non continous mode*/
+	{0x3064, 0x12},
+	{0x3087, 0x57},
+	{0x308A, 0x35},
+	{0x3091, 0x41},
+	{0x3098, 0x03},
+	{0x3099, 0xC0},
+	{0x309A, 0xA3},
+	{0x309D, 0x94},
+	{0x30AB, 0x01},
+	{0x30AD, 0x08},
+	{0x30B1, 0x03},
+	{0x30C4, 0x13},
+	{0x30F3, 0x03},
+	{0x3116, 0x31},
+	{0x3117, 0x38},
+	{0x3138, 0x28},
+	{0x3137, 0x14},
+	{0x3139, 0x2E},
+	{0x314D, 0x2A},
+	{0x3343, 0x04},
+
+	{0x0340, 0x06}, /*frame_length_lines_hi*/
+	{0x0341, 0xDE}, /*frame_length_lines_lo*/
+	{0x0342, 0x0D}, /*line_length_pclk_hi*/
+	{0x0343, 0x48}, /*line_length_pclk_lo*/
+	{0x0344, 0x00}, /*0x0344-0345 x_address_Start 0x0066=102*/
+	{0x0345, 0x66},  /*x_addr_start*/
+	{0x0346, 0x01}, /*0x0346-0347 Y_address_Start 0x0190=400*/
+	{0x0347, 0x90}, /*y_addr_start*/
+	{0x0348, 0x0C},/*0x0348-0349 x_address_End 0x0c71=3185*/
+	{0x0349, 0x71}, /*x_add_end*/
+	{0x034A, 0x08}, /*0x034A-034B Y_address_End 0x0857=2135*/
+	{0x034B, 0x57}, /*y_add_end*/
+	{0x034C, 0x0C}, /*x_output_size_msb*/
+	{0x034D, 0x0C}, /*x_output_size_lsb*/
+	{0x034E, 0x06}, /*y_output_size_msb*/
+	{0x034F, 0xC8}, /*y_output_size_lsb*/
+	{0x0381, 0x01}, /*x_even_inc*/
+	{0x0383, 0x01}, /*x_odd_inc*/
+	{0x0385, 0x01}, /*y_even_inc*/
+	{0x0387, 0x01}, /*y_odd_inc*/
+	{0x3033, 0x00},
+	{0x303D, 0x70},
+	{0x303E, 0x41},
+	{0x3040, 0x08},
+	{0x3041, 0x89},
+	{0x3048, 0x00},
+	{0x304C, 0x50},
+	{0x304D, 0x03},
+	{0x306A, 0xD2},
+	{0x309B, 0x00},
+	{0x309C, 0x34},
+	{0x309E, 0x00},
+	{0x30AA, 0x02},
+	{0x30D5, 0x00},
+	{0x30D6, 0x85},
+	{0x30D7, 0x2A},
+	{0x30D8, 0x64},
+	{0x30D9, 0x89},
+	{0x30DE, 0x00},
+	{0x3102, 0x10},
+	{0x3103, 0x44},
+	{0x3104, 0x40},
+	{0x3105, 0x00},
+	{0x3106, 0x10},
+	{0x3107, 0x01},
+	{0x315C, 0x76},
+	{0x315D, 0x75},
+	{0x316E, 0x77},
+	{0x316F, 0x76},
+	{0x3301, 0x00},
+	{0x3318, 0x61},
+	{0x0202, 0x04}, /*0x0202-0203, 1 <= Coarse_Integration_time <= frame_length_lines -5*/
+	{0x0203, 0xED}
+};
+
+
+static struct msm_camera_i2c_reg_conf imx105_fast_video_settings[] = {
+
+	/* 1640x510 > 100 fps*/
+	/* PLL Setting EXTCLK=24MHz, PLL=672MHz */
+	{0x0305, 0x04}, /*Pre_PLL_clk_div*/
+	{0x0307, 0x70}, /*PLL_multiplier */
+	{0x30A4, 0x02}, /*Post_PLL_clk_div*/
+	{0x303C, 0x4B},/*wait time for 24MHz MCLK*/
+
+	/* Global Setting V4.1 From SONY */
+	{0x3031, 0x10}, /*change to 01 for continous mode and 10 for non continous mode*/
+	{0x3064, 0x12},
+	{0x3087, 0x57},
+	{0x308A, 0x35},
+	{0x3091, 0x41},
+	{0x3098, 0x03},
+	{0x3099, 0xC0},
+	{0x309A, 0xA3},
+	{0x309D, 0x94},
+	{0x30AB, 0x01},
+	{0x30AD, 0x08},
+	{0x30B1, 0x03},
+	{0x30C4, 0x13},
+	{0x30F3, 0x03},
+	{0x3116, 0x31},
+	{0x3117, 0x38},
+	{0x3138, 0x28},
+	{0x3137, 0x14},
+	{0x3139, 0x2E},
+	{0x314D, 0x2A},
+	{0x3343, 0x04},
+
+	{0x0340, 0x02}, /*0x0340-0341 Frame_length_lines*/
+	{0x0341, 0x78},
+	{0x0342, 0x06}, /*0x0342-0343 Line_length_pck*/
+	{0x0343, 0xE8},
+	{0x0344, 0x00},/*x_addr_start*/
+	{0x0345, 0x04},
+	{0x0346, 0x00},/*Y_addr_Start*/
+	{0x0347, 0xF8},
+	{0x0348, 0x0C},/*0x0348-0349 x_address_end*/
+	{0x0349, 0xD3},
+	{0x034A, 0x08}, /*0x034A-034B y_address_end*/
+	{0x034B, 0xEF},
+	{0x034C, 0x06}, /*0x034C-034D x_output_size 0x0668*/
+	{0x034D, 0x68},
+	{0x034E, 0x01}, /*0x034E-034F y_output_size 0x01FE*/
+	{0x034F, 0xFE},
+	{0x0381, 0x01},
+	{0x0383, 0x01},
+	{0x0385, 0x05},
+	{0x0387, 0x03},
+	{0x3033, 0x84},
+	{0x303D, 0x70},
+	{0x303E, 0x40},
+	{0x3040, 0x08},
+	{0x3041, 0x97},
+	{0x3048, 0x01},
+	{0x304C, 0xB7},
+	{0x304D, 0x01},
+	{0x306A, 0xD2},
+	{0x309B, 0x08},
+	{0x309C, 0x33},
+	{0x309E, 0x04},
+	{0x30AA, 0x00},
+	{0x30D5, 0x04},
+	{0x30D6, 0x85},
+	{0x30D7, 0x2A},
+	{0x30D8, 0x64},
+	{0x30D9, 0x89},
+	{0x30DE, 0x00},
+	{0x3102, 0x05},
+	{0x3103, 0x12},
+	{0x3104, 0x12},
+	{0x3105, 0x00},
+	{0x3106, 0x46},
+	{0x3107, 0x00},
+	{0x315C, 0x4A},
+	{0x315D, 0x49},
+	{0x316E, 0x4B},
+	{0x316F, 0x4A},
+	{0x3301, 0x00},
+	{0x3318, 0x62},
+	{0x0202, 0x04}, /*0x0202-0203, 1 <= Coarse_Integration_time <= frame_length_lines -5*/
+	{0x0203, 0xED}
+};
+
+
+static struct msm_camera_i2c_reg_conf imx105_snap_settings[] = {
+	/* PLL Setting EXTCLK=24MHz, PLL=876MHz */
+	{0x0305, 0x04}, /*Pre_PLL_clk_div*/
+	{0x0307, 0x92}, /*PLL_multiplier */
+	{0x30A4, 0x02}, /*Post_PLL_clk_div*/
+	{0x303C, 0x4B},/*wait time for 24MHz MCLK*/
+
+	/* Global Setting V4.1 From SONY */
+	{0x3031, 0x10}, /*change to 01 for continous mode and 10 for non continous mode*/
+	{0x3064, 0x12},
+	{0x3087, 0x57},
+	{0x308A, 0x35},
+	{0x3091, 0x41},
+	{0x3098, 0x03},
+	{0x3099, 0xC0},
+	{0x309A, 0xA3},
+	{0x309D, 0x94},
+	{0x30AB, 0x01},
+	{0x30AD, 0x08},
+	{0x30B1, 0x03},
+	{0x30C4, 0x13},
+	{0x30F3, 0x03},
+	{0x3116, 0x31},
+	{0x3117, 0x38},
+	{0x3138, 0x28},
+	{0x3137, 0x14},
+	{0x3139, 0x2E},
+	{0x314D, 0x2A},
+	{0x3343, 0x04},
+
+	{0x0340, 0x09}, /*frame_length_lines_hi*/
+	{0x0341, 0xE6}, /*frame_length_lines_lo*/
+	{0x0342, 0x0D}, /*line_length_pclk_hi*/
+	{0x0343, 0xD0}, /*line_length_pclk_lo*/
+	{0x0344, 0x00},
+	{0x0345, 0x04},
+	{0x0346, 0x00},
+	{0x0347, 0x24},
+	{0x0348, 0x0C},
+	{0x0349, 0xD3},
+	{0x034A, 0x09},
+	{0x034B, 0xC3},
+	{0x034C, 0x0C}, /*0x034C-034D X_output_size 0x0CD0=3280*/
+	{0x034D, 0xD0},
+	{0x034E, 0x09}, /*0x034E-034F Y_output_size 0x09A0=2464*/
+	{0x034F, 0xA0},
+	{0x0381, 0x01}, /*x_even_inc*/
+	{0x0383, 0x01}, /*x_odd_inc*/
+	{0x0385, 0x01}, /*y_even_inc*/
+	{0x0387, 0x01}, /*y_odd_inc*/
+	{0x3033, 0x00},
+	{0x303D, 0x70},
+	{0x303E, 0x41},
+	{0x3040, 0x08},
+	{0x3041, 0x89},
+	{0x3048, 0x00},
+	{0x304C, 0x50},
+	{0x304D, 0x03},
+	{0x306A, 0xD2},
+	{0x309B, 0x00},
+	{0x309C, 0x34},
+	{0x309E, 0x00},
+	{0x30AA, 0x02},
+	{0x30D5, 0x00},
+	{0x30D6, 0x85},
+	{0x30D7, 0x2A},
+	{0x30D8, 0x64},
+	{0x30D9, 0x89},
+	{0x30DE, 0x00},
+	{0x3102, 0x10},
+	{0x3103, 0x44},
+	{0x3104, 0x40},
+	{0x3105, 0x00},
+	{0x3106, 0x10},
+	{0x3107, 0x01},
+	{0x315C, 0x76},
+	{0x315D, 0x75},
+	{0x316E, 0x77},
+	{0x316F, 0x76},
+	{0x3301, 0x00},
+	{0x3318, 0x61},
+	{0x0202, 0x04}, /*0x0202-0203, 1 <= Coarse_Integration_time <= frame_length_lines -5*/
+	{0x0203, 0xED},
+};
+
+static struct msm_camera_i2c_reg_conf imx105_recommend_settings[] = {
+	/* PLL Setting EXTCLK=24MHz, PLL=672MHz, 15fps */
+	{0x0305, 0x01}, /*Pre_PLL_clk_div*/
+	{0x0307, 0x1C}, /*PLL_multiplier */
+	{0x303C, 0x4B},/*wait time for 24MHz MCLK*/
+
+	/* Global Setting V4.1 From SONY */	
+	{0x3031, 0x10}, /*change to 01 for continous mode and 10 for non continous mode*/
+	{0x3064, 0x12},
+	{0x3087, 0x57},
+	{0x308A, 0x35},
+	{0x3091, 0x41},
+	{0x3098, 0x03},
+	{0x3099, 0xC0},
+	{0x309A, 0xA3},
+	{0x309D, 0x94},
+	{0x30AB, 0x01},
+	{0x30AD, 0x00},
+	{0x30B1, 0x03},
+	{0x30C4, 0x17},
+	{0x30F3, 0x03},
+	{0x3116, 0x31},
+	{0x3117, 0x38},
+	{0x3138, 0x28},
+	{0x3137, 0x14},
+	{0x3139, 0x2E},
+	{0x314D, 0x2A},
+	{0x328F, 0x01},
+	{0x3343, 0x04},
+
+	/*VCM Init*/
+	{0x3408, 0x02}, 
+	{0x340A, 0x01},
+	{0x340C, 0x01},
+	{0x3081, 0x48},
+	{0x3400, 0x01}, 
+	{0x3401, 0x0F},
+	{0x3404, 0x17}, 
+	{0x3405, 0x00},  
+
+	/* Black level Setting */
+	{0x3032, 0x40}
+};
+
+static struct v4l2_subdev_info imx105_subdev_info[] = {
+	{
+		.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
+		.colorspace = V4L2_COLORSPACE_JPEG,
+		.fmt    = 1,
+		.order    = 0,
+	},
+	/* more can be supported, to be added later */
+};
+
+static struct msm_camera_i2c_conf_array imx105_init_conf[] = {
+	{&imx105_mipi_settings[0],
+		ARRAY_SIZE(imx105_mipi_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx105_recommend_settings[0],
+		ARRAY_SIZE(imx105_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx105_pll_settings[0],
+		ARRAY_SIZE(imx105_pll_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},	
+};
+
+static struct msm_camera_i2c_conf_array imx105_confs[] = {
+	{&imx105_snap_settings[0],
+		ARRAY_SIZE(imx105_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx105_prev_settings[0],
+		ARRAY_SIZE(imx105_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx105_video_settings[0],
+		ARRAY_SIZE(imx105_video_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx105_fast_video_settings[0],
+		ARRAY_SIZE(imx105_fast_video_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},	
+};
+
+static struct msm_sensor_output_info_t imx105_dimensions[] = {
+	{/*full size 3280 x 2464 at 20 fps*/
+		.x_output = 0xCD0, 
+		.y_output = 0x9A0, 
+		.line_length_pclk =  0xDD0,
+		.frame_length_lines = 0x9E6,
+		.vt_pixel_clk = 175200000,/*24Mhzx1(PreDivider)x146(PLL)/4(PostDivider)=Pixel CLK /10(vt_pixel_clk_divider)* 1(vt_sys_clk_div) = 87.6MHZx2(lanes)*/
+		.op_pixel_clk = 175200000,
+		.binning_factor = 1,
+	},
+	{/*Q size 1640 x 1232 at 30 fps*/
+		.x_output = 0x668, 
+		.y_output = 0x4D0,
+		.line_length_pclk = 0xDD0,
+		.frame_length_lines = 0x4F2,
+		.vt_pixel_clk = 134400000,
+		.op_pixel_clk = 134400000,
+		.binning_factor = 1,
+	},
+	{/*video size 3084x1736 at 30 fps*/
+		.x_output = 0xC0C,//3
+		.y_output = 0x6C8,
+		.line_length_pclk = 0xD48,
+		.frame_length_lines = 0x6DE, /* Tom 20120215 changed to fix video frame not in sync issue*/
+		.vt_pixel_clk = 175200000,
+		.op_pixel_clk = 175200000,
+		.binning_factor = 1,
+	},		
+	{/*video size 1640 X 510 at 100 fps*/
+		.x_output = 0x668,
+		.y_output = 0x1FE,
+		.line_length_pclk = 0x6E8,
+		.frame_length_lines = 0x278,
+		.vt_pixel_clk = 134400000,
+		.op_pixel_clk = 134400000,
+		.binning_factor = 1,
+	},
+};
+
+static struct msm_camera_csid_vc_cfg imx105_cid_cfg[] = {
+	{0, CSI_RAW10, CSI_DECODE_10BIT},
+	{1, CSI_EMBED_DATA, CSI_DECODE_8BIT},
+};
+
+static struct msm_camera_csi2_params imx105_csi_params = {
+	.csid_params = {
+		.lane_assign = 0xe4,
+		.lane_cnt = 2,
+		.lut_params = {
+			.num_cid = 2,
+			.vc_cfg = imx105_cid_cfg,
+		},
+	},
+	.csiphy_params = {
+		.lane_cnt = 2,
+		/*.settle_cnt = 0x1B,*/
+		.settle_cnt = 0x15,/* Tom 20120224 changed for 876 MHz*/
+	},
+};
+
+static struct msm_camera_csi2_params *imx105_csi_params_array[] = {
+	&imx105_csi_params,
+	&imx105_csi_params,
+	&imx105_csi_params,
+	&imx105_csi_params
+};
+
+static struct msm_sensor_output_reg_addr_t imx105_reg_addr = {
+	.x_output = 0x34C,
+	.y_output = 0x34E,
+	.line_length_pclk = 0x342,
+	.frame_length_lines = 0x340,
+};
+
+static struct msm_sensor_id_info_t imx105_id_info = {
+	.sensor_id_reg_addr = 0x0,
+	.sensor_id = 0x0105,
+};
+
+static struct msm_sensor_exp_gain_info_t imx105_exp_gain_info = {
+	.coarse_int_time_addr = 0x202,
+	.global_gain_addr = 0x204,
+	.vert_offset = 5, /* sony imx105 sensor limitation */ /* HTC Tom 20120210 - Fix black screen */
+	.min_vert = 4, /* min coarse integration time */ /* HTC Angie 20111019 - Fix FPS */	
+};
+
+static int imx105_sensor_open_init(const struct msm_camera_sensor_info *data)
+{
+	int rc = 0;
+	uint16_t value = 0;
+
+	pr_info("%s\n", __func__);
+
+	if (data->sensor_platform_info)
+		imx105_s_ctrl.mirror_flip = data->sensor_platform_info->mirror_flip;
+
+	/* Apply sensor mirror/flip */
+	if (imx105_s_ctrl.mirror_flip == CAMERA_SENSOR_MIRROR_FLIP)
+		value = IMX105_READ_MIRROR_FLIP;
+	else if (imx105_s_ctrl.mirror_flip == CAMERA_SENSOR_MIRROR)
+		value = IMX105_READ_MIRROR;
+	else if (imx105_s_ctrl.mirror_flip == CAMERA_SENSOR_FLIP)
+		value = IMX105_READ_FLIP;
+	else	
+		value = IMX105_READ_NORMAL_MODE;
+
+	pr_info("[CAM]:imx105 %s :IMX105_READ Value = %d\n", __func__,value);
+
+
+	msm_camera_i2c_write(imx105_s_ctrl.sensor_i2c_client,
+			IMX105_REG_READ_MODE, value, MSM_CAMERA_I2C_BYTE_DATA);
+
+	return rc;
+}
+
+static const char *imx105Vendor = "sony";
+static const char *imx105NAME = "imx105";
+static const char *imx105Size = "8M";
+
+static ssize_t sensor_vendor_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+
+	sprintf(buf, "%s %s %s\n", imx105Vendor, imx105NAME, imx105Size);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+
+static DEVICE_ATTR(sensor, 0444, sensor_vendor_show, NULL);
+
+static struct kobject *android_imx105;
+
+static int imx105_sysfs_init(void)
+{
+	int ret ;
+	pr_info("imx105:kobject creat and add\n");
+	android_imx105 = kobject_create_and_add("android_camera", NULL);
+	if (android_imx105 == NULL) {
+		pr_info("imx105_sysfs_init: subsystem_register " \
+				"failed\n");
+		ret = -ENOMEM;
+		return ret ;
+	}
+	pr_info("imx105:sysfs_create_file\n");
+	ret = sysfs_create_file(android_imx105, &dev_attr_sensor.attr);
+	if (ret) {
+		pr_info("imx105_sysfs_init: sysfs_create_file " \
+				"failed\n");
+		kobject_del(android_imx105);
+	}
+
+	return 0 ;
+}
+
+int32_t imx105_i2c_probe(struct i2c_client *client,
+		const struct i2c_device_id *id)
+{
+	int	rc = 0;
+	pr_info("%s\n", __func__);
+	rc = msm_sensor_i2c_probe(client, id);
+	if(rc >= 0)
+		imx105_sysfs_init();
+	pr_info("%s: rc(%d)\n", __func__, rc);
+	return rc;
+}
+
+static const struct i2c_device_id imx105_i2c_id[] = {
+	{SENSOR_NAME, (kernel_ulong_t)&imx105_s_ctrl},
+	{ }
+};
+
+static struct i2c_driver imx105_i2c_driver = {
+	.id_table = imx105_i2c_id,
+	.probe  = imx105_i2c_probe,
+	.driver = {
+		.name = SENSOR_NAME,
+	},
+};
+
+static struct msm_camera_i2c_client imx105_sensor_i2c_client = {
+	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
+};
+
+/*Tom start 20120215 to fix AF issue by using sensor i2c driver client to write next lens position*/
+
+int32_t msm_camera_i2c_write_lens_position(int16_t lens_position)
+{
+	struct msm_sensor_ctrl_t *s_ctrl = &imx105_s_ctrl;
+	int rc = 0;
+
+	pr_info("%s lens_position %d\n", __func__, lens_position);
+
+
+	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
+
+	rc = msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+			0x3403,
+			((lens_position & 0x0300) >> 8),
+			MSM_CAMERA_I2C_BYTE_DATA);
+	if (rc < 0) {
+		pr_err("%s VCM_CODE_MSB i2c write failed (%d)\n", __func__, rc);
+		return rc;
+	}
+
+	rc = msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+			0x3402,
+			(lens_position & 0x00FF),
+			MSM_CAMERA_I2C_BYTE_DATA);
+	if (rc < 0) {
+		pr_err("%s VCM_CODE_LSB i2c write failed (%d)\n", __func__, rc);
+		return rc;
+	}
+
+	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
+
+	return rc;
+}
+
+int32_t imx105_power_up(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int rc;
+	struct msm_camera_sensor_info *sdata = NULL;
+	pr_info("%s\n", __func__);
+
+	if (s_ctrl && s_ctrl->sensordata)
+		sdata = s_ctrl->sensordata;
+	else {
+		pr_info("%s: failed to s_ctrl sensordata NULL\n", __func__);
+		return (-1);
+	}
+
+	if (sdata->camera_power_on == NULL) {
+		pr_err("sensor platform_data didnt register\n");
+		return -EIO;
+	}
+
+	rc = sdata->camera_power_on();
+	if (rc < 0) {
+		pr_err("%s failed to enable power\n", __func__);
+		goto enable_power_on_failed;
+	}
+
+	if (!sdata->use_rawchip) {
+		rc = msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
+		if (rc < 0) {
+			pr_info("%s: msm_camio_sensor_clk_on failed:%d\n",
+					__func__, rc);
+			goto enable_mclk_failed;
+		}
+	}
+
+	rc = msm_sensor_set_power_up(s_ctrl);
+	if (rc < 0) {
+		pr_info("%s msm_sensor_power_up failed\n", __func__);
+		goto enable_sensor_power_up_failed;
+	}
+
+	imx105_sensor_open_init(sdata);
+	pr_info("%s end\n", __func__);
+
+	return rc;
+
+enable_sensor_power_up_failed:
+	if (sdata->camera_power_off == NULL)
+		pr_info("%s: failed to sensor platform_data didnt register\n", __func__);
+	else
+		sdata->camera_power_off();
+enable_power_on_failed:
+	msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
+enable_mclk_failed:
+	return rc;
+}
+
+int32_t imx105_power_down(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int rc;
+	struct msm_camera_sensor_info *sdata = NULL;
+	pr_info("%s\n", __func__);
+
+	if (s_ctrl && s_ctrl->sensordata)
+		sdata = s_ctrl->sensordata;
+	else {
+		pr_info("%s: failed to s_ctrl sensordata NULL\n", __func__);
+		return (-1);
+	}
+
+	if (sdata->camera_power_off == NULL) {
+		pr_err("sensor platform_data didnt register\n");
+		return -EIO;
+	}
+
+	rc = sdata->camera_power_off();
+	if (rc < 0) {
+		pr_err("%s failed to disable power\n", __func__);
+		return rc;
+	}
+
+	mdelay(1);
+	if (!sdata->use_rawchip) {
+		rc = msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
+		if (rc < 0)
+			pr_info("%s: msm_camio_sensor_clk_off failed:%d\n",
+					__func__, rc);
+	}
+	mdelay(1);
+
+	rc = msm_sensor_set_power_down(s_ctrl);
+	if (rc < 0)
+		pr_info("%s: msm_sensor_power_down failed\n", __func__);
+	mdelay(1);
+
+	return rc;
+}
+
+static int __init msm_sensor_init_module(void)
+{
+	pr_info("[CAM]:imx105 %s\n", __func__);
+	return i2c_add_driver(&imx105_i2c_driver);
+}
+
+static struct v4l2_subdev_core_ops imx105_subdev_core_ops;
+static struct v4l2_subdev_video_ops imx105_subdev_video_ops = {
+	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
+};
+
+static struct v4l2_subdev_ops imx105_subdev_ops = {
+	.core = &imx105_subdev_core_ops,
+	.video  = &imx105_subdev_video_ops,
+};
+
+/*HTC_START*/
+static int imx105_read_fuseid(struct sensor_cfg_data *cdata,
+		struct msm_sensor_ctrl_t *s_ctrl)
+{
+
+
+	int32_t  rc;
+	uint16_t info_value = 0;
+	unsigned short info_index = 0;
+	unsigned short  OTP[10] = {0};
+
+	struct msm_camera_i2c_client *imx105_msm_camera_i2c_client = s_ctrl->sensor_i2c_client;
+
+	pr_info("%s: sensor OTP information: E \n", __func__);
+
+
+	for (info_index = 0; info_index < 10; info_index++) {
+		rc = msm_camera_i2c_write_b(imx105_msm_camera_i2c_client ,0x34C9, info_index);
+		if (rc < 0)
+			pr_err("[CAM]%s: i2c_write_b 0x34C9 (select info_index %d) fail\n", __func__, info_index);
+
+		/*HTC start Tom change back to read word*/
+		/* read Information 0~9 according to SPEC*/
+		rc = msm_camera_i2c_read(imx105_msm_camera_i2c_client,0x3500, &info_value,2);
+		if (rc < 0)
+			pr_err("[CAM]%s: i2c_read 0x3500 fail\n", __func__);
+
+		OTP[info_index] = (unsigned short)((info_value & 0xFF00) >>8);
+		info_index++;
+		OTP[info_index] = (unsigned short)(info_value & 0x00FF);
+		info_value = 0;
+		/*HTC end Tom change back to read word*/
+	}
+
+	pr_info("[CAM]%s: VenderID=%x,LensID=%x,SensorID=%x%x\n", __func__,
+			OTP[0], OTP[1], OTP[2], OTP[3]);
+	pr_info("[CAM]%s: ModuleFuseID= %x%x%x%x%x%x\n", __func__,
+			OTP[4], OTP[5], OTP[6], OTP[7], OTP[8], OTP[9]);
+
+	cdata->cfg.fuse.fuse_id_word1 = 0;
+	cdata->cfg.fuse.fuse_id_word2 = 0;
+	cdata->cfg.fuse.fuse_id_word3 = (OTP[0]);
+	cdata->cfg.fuse.fuse_id_word4 =
+		(OTP[4]<<20) |
+		(OTP[5]<<16) |
+		(OTP[6]<<12) |
+		(OTP[7]<<8) |
+		(OTP[8]<<4) |
+		(OTP[9]);
+	/*
+	   pr_info("[CAM]imx105: fuse->fuse_id_word1:%d\n",
+	   cdata->cfg.fuse.fuse_id_word1);
+	   pr_info("[CAM]imx105: fuse->fuse_id_word2:%d\n",
+	   cdata->cfg.fuse.fuse_id_word2);
+	   pr_info("[CAM]imx105: fuse->fuse_id_word3:0x%08x\n",
+	   cdata->cfg.fuse.fuse_id_word3);
+	   pr_info("[CAM]imx105: fuse->fuse_id_word4:0x%08x\n",
+	   cdata->cfg.fuse.fuse_id_word4);
+	   */		
+	pr_info("%s: sensor OTP information: X \n", __func__);
+
+
+	return 0;
+}
+
+/* HTC_END*/
+
+int32_t imx105_sensor_write_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
+		uint16_t gain, uint32_t line) /* HTC Angie 20111019 - Fix FPS */
+{
+	uint32_t fl_lines;
+	uint8_t offset;
+	/* HTC_START Angie 20111019 - Fix FPS */
+	uint32_t fps_divider = Q10;
+
+	if (s_ctrl->cam_mode == SENSOR_PREVIEW_MODE)
+		fps_divider = s_ctrl->fps_divider;
+	fl_lines = s_ctrl->curr_frame_length_lines;
+	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
+	if (line * Q10 > (fl_lines - offset) * fps_divider)
+		fl_lines = line + offset;
+	else
+		fl_lines = (fl_lines * fps_divider) / Q10;
+	/* HTC_END */
+
+	/*HTC start Tom 20120209  - fix black screen caused by line count > frame length lines -5*/
+	if (line > fl_lines -offset)
+		line = fl_lines -offset;
+	/*HTC end*/
+
+	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+			s_ctrl->sensor_output_reg_addr->frame_length_lines, fl_lines,
+			MSM_CAMERA_I2C_WORD_DATA);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr, line,
+			MSM_CAMERA_I2C_WORD_DATA);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+			s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
+			MSM_CAMERA_I2C_WORD_DATA);
+	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
+
+	pr_info("%s write fl_lines : %d ; write line_cnt : %d ; write gain : %d \n", __func__, fl_lines,  line, gain);
+
+	return 0;
+}
+
+static struct msm_sensor_fn_t imx105_func_tbl = {
+	.sensor_start_stream = msm_sensor_start_stream,
+	.sensor_stop_stream = msm_sensor_stop_stream,
+	.sensor_group_hold_on = msm_sensor_group_hold_on,
+	.sensor_group_hold_off = msm_sensor_group_hold_off,
+	.sensor_set_fps = msm_sensor_set_fps,
+	.sensor_write_exp_gain = imx105_sensor_write_exp_gain,
+	.sensor_write_snapshot_exp_gain = imx105_sensor_write_exp_gain,
+	.sensor_setting = msm_sensor_setting,
+	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
+	.sensor_mode_init = msm_sensor_mode_init,
+	.sensor_get_output_info = msm_sensor_get_output_info,
+	.sensor_config = msm_sensor_config,
+	.sensor_power_up = imx105_power_up,
+	.sensor_power_down = imx105_power_down,
+	.sensor_i2c_read_fuseid = imx105_read_fuseid,
+};
+
+static struct msm_sensor_reg_t imx105_regs = {
+	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
+	.start_stream_conf = imx105_start_settings,
+	.start_stream_conf_size = ARRAY_SIZE(imx105_start_settings),
+	.stop_stream_conf = imx105_stop_settings,
+	.stop_stream_conf_size = ARRAY_SIZE(imx105_stop_settings),
+	.group_hold_on_conf = imx105_groupon_settings,
+	.group_hold_on_conf_size = ARRAY_SIZE(imx105_groupon_settings),
+	.group_hold_off_conf = imx105_groupoff_settings,
+	.group_hold_off_conf_size =
+		ARRAY_SIZE(imx105_groupoff_settings),
+	.init_settings = &imx105_init_conf[0],
+	.init_size = ARRAY_SIZE(imx105_init_conf),
+	.mode_settings = &imx105_confs[0],
+	.output_settings = &imx105_dimensions[0],
+	.num_conf = ARRAY_SIZE(imx105_confs),
+};
+
+static struct msm_sensor_ctrl_t imx105_s_ctrl = {
+	.msm_sensor_reg = &imx105_regs,
+	.sensor_i2c_client = &imx105_sensor_i2c_client,
+	.sensor_i2c_addr = 0x34,
+	.sensor_output_reg_addr = &imx105_reg_addr,
+	.sensor_id_info = &imx105_id_info,
+	.sensor_exp_gain_info = &imx105_exp_gain_info,
+	.cam_mode = MSM_SENSOR_MODE_INVALID,
+	.csi_params = &imx105_csi_params_array[0],
+	.msm_sensor_mutex = &imx105_mut,
+	.sensor_i2c_driver = &imx105_i2c_driver,
+	.sensor_v4l2_subdev_info = imx105_subdev_info,
+	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(imx105_subdev_info),
+	.sensor_v4l2_subdev_ops = &imx105_subdev_ops,
+	.func_tbl = &imx105_func_tbl,
+};
+
+module_init(msm_sensor_init_module);
+MODULE_DESCRIPTION("Sony 8MP Bayer sensor driver");
+MODULE_LICENSE("GPL v2");
+
+/*HTC end Tom Lin 2011/12/19 Sony IMX105 8M driver*/
diff --git a/drivers/media/video/msm/sensors/imx111.c b/drivers/media/video/msm/sensors/imx111.c
deleted file mode 100644
index 51391be..0000000
--- a/drivers/media/video/msm/sensors/imx111.c
+++ /dev/null
@@ -1,867 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#include "msm.h"
-#include "msm_ispif.h"
-#define SENSOR_NAME "imx111"
-#define PLATFORM_DRIVER_NAME "msm_camera_imx111"
-#define imx111_obj imx111_##obj
-
-DEFINE_MUTEX(imx111_mut);
-static struct msm_sensor_ctrl_t imx111_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf imx111_start_settings[] = {
-	{0x0100, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf imx111_stop_settings[] = {
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx111_groupon_settings[] = {
-	{0x104, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf imx111_groupoff_settings[] = {
-	{0x104, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx111_prev_settings[] = {
-	{0x0101, 0x00}, /* read out direction */
-	{0x0305, 0x02},
-	{0x0307, 0x38},
-	{0x30A4, 0x02},
-	{0x303C, 0x4B},
-	{0x0202, 0x03},
-	{0x0203, 0xCE},
-	{0x0204, 0x00},
-	{0x0205, 0xC0},
-	{0x0340, 0x04},
-	{0x0341, 0xE6},
-	{0x0342, 0x0D},
-	{0x0343, 0xD0},
-	{0x0344, 0x00},
-	{0x0345, 0x08},
-	{0x0346, 0x00},
-	{0x0347, 0x30},
-	{0x0348, 0x0C},
-	{0x0349, 0xD7},
-	{0x034A, 0x09},
-	{0x034B, 0xCF},
-	{0x034C, 0x06},
-	{0x034D, 0x68},
-	{0x034E, 0x04},
-	{0x034F, 0xD0},
-	{0x0381, 0x01},
-	{0x0383, 0x03},
-	{0x0385, 0x01},
-	{0x0387, 0x03},
-	{0x3033, 0x00},
-	{0x303D, 0x10},
-	{0x303E, 0x40},
-	{0x3040, 0x08},
-	{0x3041, 0x97},
-	{0x3048, 0x01},
-	{0x304C, 0x6F},
-	{0x304D, 0x03},
-	{0x3064, 0x12},
-	{0x3073, 0x00},
-	{0x3074, 0x11},
-	{0x3075, 0x11},
-	{0x3076, 0x11},
-	{0x3077, 0x11},
-	{0x3079, 0x00},
-	{0x307A, 0x00},
-	{0x309B, 0x28},
-	{0x309E, 0x00},
-	{0x30A0, 0x14},
-	{0x30A1, 0x09},
-	{0x30AA, 0x03},
-	{0x30B2, 0x05},
-	{0x30D5, 0x09},
-	{0x30D6, 0x01},
-	{0x30D7, 0x01},
-	{0x30D8, 0x64},
-	{0x30D9, 0x89},
-	{0x30DE, 0x02},
-	{0x30DF, 0x20},
-	{0x3102, 0x08},
-	{0x3103, 0x22},
-	{0x3104, 0x20},
-	{0x3105, 0x00},
-	{0x3106, 0x87},
-	{0x3107, 0x00},
-	{0x3108, 0x03},
-	{0x3109, 0x02},
-	{0x310A, 0x03},
-	{0x315C, 0x9C},
-	{0x315D, 0x9B},
-	{0x316E, 0x9D},
-	{0x316F, 0x9C},
-	{0x3318, 0x72},
-	{0x3348, 0xE0},
-};
-
-static struct msm_camera_i2c_reg_conf imx111_video_settings[] = {
-	{0x0101, 0x00}, /* read out direction */
-	{0x0305, 0x02},
-	{0x0307, 0x32},
-	{0x30A4, 0x02},
-	{0x303C, 0x4B},
-	{0x0342, 0x0D},
-	{0x0343, 0xAC},
-	{0x0344, 0x00},
-	{0x0345, 0x16},
-	{0x0346, 0x01},
-	{0x0347, 0x6E},
-	{0x0348, 0x0C},
-	{0x0349, 0xCB},
-	{0x034A, 0x08},
-	{0x034B, 0x93},
-	{0x034C, 0x07},
-	{0x034D, 0xA0},
-	{0x034E, 0x04},
-	{0x034F, 0x4A},
-	{0x0381, 0x01},
-	{0x0383, 0x01},
-	{0x0385, 0x01},
-	{0x0387, 0x01},
-	{0x3033, 0x00},
-	{0x303D, 0x10},
-	{0x303E, 0x00},
-	{0x3040, 0x08},
-	{0x3041, 0x91},
-	{0x3048, 0x00},
-	{0x304C, 0x67},
-	{0x304D, 0x03},
-	{0x3064, 0x10},
-	{0x3073, 0xA0},
-	{0x3074, 0x12},
-	{0x3075, 0x12},
-	{0x3076, 0x12},
-	{0x3077, 0x11},
-	{0x3079, 0x0A},
-	{0x307A, 0x0A},
-	{0x309B, 0x60},
-	{0x309E, 0x04},
-	{0x30A0, 0x15},
-	{0x30A1, 0x08},
-	{0x30AA, 0x03},
-	{0x30B2, 0x05},
-	{0x30D5, 0x20},
-	{0x30D6, 0x85},
-	{0x30D7, 0x2A},
-	{0x30D8, 0x64},
-	{0x30D9, 0x89},
-	{0x30DE, 0x00},
-	{0x30DF, 0x21},
-	{0x3102, 0x08},
-	{0x3103, 0x1D},
-	{0x3104, 0x1E},
-	{0x3105, 0x00},
-	{0x3106, 0x74},
-	{0x3107, 0x00},
-	{0x3108, 0x03},
-	{0x3109, 0x02},
-	{0x310A, 0x03},
-	{0x315C, 0x37},
-	{0x315D, 0x36},
-	{0x316E, 0x38},
-	{0x316F, 0x37},
-	{0x3318, 0x63},
-	{0x3348, 0xA0},
-};
-
-static struct msm_camera_i2c_reg_conf imx111_snap_settings[] = {
-	{0x0101, 0x00}, /* read out direction */
-	{0x0305, 0x02},
-	{0x0307, 0x53},
-	{0x30A4, 0x02},
-	{0x303C, 0x4B},
-	{0x0202, 0x04},
-	{0x0203, 0xEC},
-	{0x0204, 0x00},
-	{0x0205, 0xAC},
-	{0x0340, 0x09},
-	{0x0341, 0xD4},
-	{0x0342, 0x0D},
-	{0x0343, 0xD0},
-	{0x0344, 0x00},
-	{0x0345, 0x08},
-	{0x0346, 0x00},
-	{0x0347, 0x30},
-	{0x0348, 0x0C},
-	{0x0349, 0xD7},
-	{0x034A, 0x09},
-	{0x034B, 0xCF},
-	{0x034C, 0x0C},
-	{0x034D, 0xD0},
-	{0x034E, 0x09},
-	{0x034F, 0xA0},
-	{0x0381, 0x01},
-	{0x0383, 0x01},
-	{0x0385, 0x01},
-	{0x0387, 0x01},
-	{0x3033, 0x00},
-	{0x303D, 0x00},
-	{0x303E, 0x41},
-	{0x3040, 0x08},
-	{0x3041, 0x97},
-	{0x3048, 0x00},
-	{0x304C, 0x6F},
-	{0x304D, 0x03},
-	{0x3064, 0x12},
-	{0x3073, 0x00},
-	{0x3074, 0x11},
-	{0x3075, 0x11},
-	{0x3076, 0x11},
-	{0x3077, 0x11},
-	{0x3079, 0x00},
-	{0x307A, 0x00},
-	{0x309B, 0x20},
-	{0x309E, 0x00},
-	{0x30A0, 0x14},
-	{0x30A1, 0x08},
-	{0x30AA, 0x03},
-	{0x30B2, 0x07},
-	{0x30D5, 0x00},
-	{0x30D6, 0x85},
-	{0x30D7, 0x2A},
-	{0x30D8, 0x64},
-	{0x30D9, 0x89},
-	{0x30DE, 0x00},
-	{0x30DF, 0x20},
-	{0x3102, 0x10},
-	{0x3103, 0x44},
-	{0x3104, 0x40},
-	{0x3105, 0x00},
-	{0x3106, 0x0D},
-	{0x3107, 0x01},
-	{0x3108, 0x09},
-	{0x3109, 0x08},
-	{0x310A, 0x0F},
-	{0x315C, 0x5D},
-	{0x315D, 0x5C},
-	{0x316E, 0x5E},
-	{0x316F, 0x5D},
-	{0x3318, 0x60},
-	{0x3348, 0xE0},
-};
-
-static struct msm_camera_i2c_reg_conf imx111_recommend_settings[] = {
-	{0x3080, 0x50},
-	{0x3087, 0x53},
-	{0x309D, 0x94},
-	{0x30B1, 0x03},
-	{0x30C6, 0x00},
-	{0x30C7, 0x00},
-	{0x3115, 0x0B},
-	{0x3118, 0x30},
-	{0x311D, 0x25},
-	{0x3121, 0x0A},
-	{0x3212, 0xF2},
-	{0x3213, 0x0F},
-	{0x3215, 0x0F},
-	{0x3217, 0x0B},
-	{0x3219, 0x0B},
-	{0x321B, 0x0D},
-	{0x321D, 0x0D},
-	{0x32AA, 0x11},
-	{0x3032, 0x40},
-};
-
-static struct msm_camera_i2c_reg_conf imx111_comm1_settings[] = {
-	{0x3035, 0x10},
-	{0x303B, 0x14},
-	{0x3312, 0x45},
-	{0x3313, 0xC0},
-	{0x3310, 0x20},
-	{0x3310, 0x00},
-	{0x303B, 0x04},
-	{0x303D, 0x00},
-	{0x0100, 0x10},
-	{0x3035, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx111_comm2_part1_settings[] = {
-	{0x0307, 0x53},
-	{0x0340, 0x09},
-	{0x0341, 0xD4},
-	{0x034C, 0x0C},
-	{0x034D, 0xD0},
-	{0x034E, 0x09},
-	{0x034F, 0xA0},
-	{0x0383, 0x01},
-	{0x0387, 0x01},
-	{0x303D, 0x00},
-	{0x303E, 0x41},
-	{0x3048, 0x00},
-	{0x309B, 0x20},
-	{0x30A1, 0x08},
-	{0x30D5, 0x00},
-	{0x30D6, 0x85},
-	{0x30D7, 0x2A},
-	{0x30DE, 0x00},
-	{0x3102, 0x10},
-	{0x3103, 0x44},
-	{0x3104, 0x40},
-	{0x3106, 0x0D},
-	{0x3107, 0x01},
-	{0x3108, 0x09},
-	{0x3109, 0x08},
-	{0x310A, 0x0F},
-	{0x315C, 0x5D},
-	{0x315D, 0x5C},
-	{0x316E, 0x5E},
-	{0x316F, 0x5D},
-	{0x3318, 0x60},
-};
-
-static struct msm_camera_i2c_reg_conf imx111_comm2_part2_settings[] = {
-	{0x30B1, 0x43},
-	{0x3311, 0x80},
-	{0x3311, 0x00},
-};
-
-static struct msm_camera_i2c_conf_array imx111_comm_confs[] = {
-	{&imx111_comm1_settings[0],
-	ARRAY_SIZE(imx111_comm1_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&imx111_comm2_part1_settings[0],
-	ARRAY_SIZE(imx111_comm2_part1_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&imx111_comm2_part2_settings[0],
-	ARRAY_SIZE(imx111_comm2_part2_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct v4l2_subdev_info imx111_subdev_info[] = {
-	{
-	.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array imx111_init_conf[] = {
-	{&imx111_recommend_settings[0],
-	ARRAY_SIZE(imx111_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array imx111_confs[] = {
-	{&imx111_snap_settings[0],
-	ARRAY_SIZE(imx111_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&imx111_prev_settings[0],
-	ARRAY_SIZE(imx111_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&imx111_video_settings[0],
-	ARRAY_SIZE(imx111_video_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&imx111_snap_settings[0],
-	ARRAY_SIZE(imx111_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t imx111_dimensions[] = {
-	{
-		/* 22.5 fps */
-		.x_output = 0x0CD0, /* 3280 */
-		.y_output = 0x9A0, /* 2464 */
-		.line_length_pclk = 0xDD0, /* 3536 */
-		.frame_length_lines = 0x9D4, /* 2516 */
-		.vt_pixel_clk = 199200000,
-		.op_pixel_clk = 199200000,
-	},
-	{
-		/* 30 fps preview */
-		.x_output = 0x668, /* 1640 */
-		.y_output = 0x4D0, /* 1232 */
-		.line_length_pclk = 0xDD0, /* 3536 */
-		.frame_length_lines = 0x4E6, /* 1254 */
-		.vt_pixel_clk = 134400000,
-		.op_pixel_clk = 134400000,
-	},
-	{
-		/* 30 fps video */
-		.x_output = 0x7A0,
-		.y_output = 0x44A,
-		.line_length_pclk = 0xDAC,
-		.frame_length_lines = 0x75C,
-		.vt_pixel_clk = 200000000,
-		.op_pixel_clk = 200000000,
-	},
-	{
-		/* 22.5 fps */
-		.x_output = 0x0CD0, /* 3280 */
-		.y_output = 0x9A0, /* 2464 */
-		.line_length_pclk = 0xDD0, /* 3536 */
-		.frame_length_lines = 0x9D4, /* 2516 */
-		.vt_pixel_clk = 199200000,
-		.op_pixel_clk = 199200000,
-	},
-};
-
-static struct msm_camera_csid_vc_cfg imx111_cid_cfg[] = {
-	{0, CSI_RAW10, CSI_DECODE_10BIT},
-	{1, CSI_EMBED_DATA, CSI_DECODE_8BIT},
-	{2, CSI_RESERVED_DATA_0, CSI_DECODE_8BIT},
-};
-
-static struct msm_camera_csi2_params imx111_csi_params = {
-	.csid_params = {
-		.lane_assign = 0xe4,
-		.lane_cnt = 2,
-		.lut_params = {
-			.num_cid = ARRAY_SIZE(imx111_cid_cfg),
-			.vc_cfg = imx111_cid_cfg,
-		},
-	},
-	.csiphy_params = {
-		.lane_cnt = 2,
-		.settle_cnt = 0x14,
-	},
-};
-
-static struct msm_camera_csi2_params *imx111_csi_params_array[] = {
-	&imx111_csi_params,
-	&imx111_csi_params,
-	&imx111_csi_params,
-	&imx111_csi_params,
-};
-
-static struct msm_sensor_output_reg_addr_t imx111_reg_addr = {
-	.x_output = 0x34C,
-	.y_output = 0x34E,
-	.line_length_pclk = 0x342,
-	.frame_length_lines = 0x340,
-};
-
-static struct msm_sensor_id_info_t imx111_id_info = {
-	.sensor_id_reg_addr = 0x0,
-	.sensor_id = 0x0111,
-};
-
-static struct msm_sensor_exp_gain_info_t imx111_exp_gain_info = {
-	.coarse_int_time_addr = 0x202,
-	.global_gain_addr = 0x204,
-	.vert_offset = 5,
-};
-
-
-static const struct i2c_device_id imx111_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&imx111_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver imx111_i2c_driver = {
-	.id_table = imx111_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client imx111_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	pr_err("__jrchoi: %s: E\n", __func__);
-	return i2c_add_driver(&imx111_i2c_driver);
-}
-
-static struct v4l2_subdev_core_ops imx111_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-int32_t imx111_sensor_setting(struct msm_sensor_ctrl_t *s_ctrl,
-			int update_type, int res)
-{
-	int32_t rc = 0;
-
-	s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
-	msleep(30);
-	if (update_type == MSM_SENSOR_REG_INIT) {
-		s_ctrl->curr_csi_params = NULL;
-		msm_sensor_enable_debugfs(s_ctrl);
-		msm_sensor_write_init_settings(s_ctrl);
-	} else if (update_type == MSM_SENSOR_UPDATE_PERIODIC) {
-		if (res == 0) {
-			msm_camera_i2c_write_tbl(s_ctrl->sensor_i2c_client,
-				(struct msm_camera_i2c_reg_conf *)
-				imx111_comm_confs[0].conf,
-				imx111_comm_confs[0].size,
-				imx111_comm_confs[0].data_type);
-		} else {
-			msm_sensor_write_res_settings(s_ctrl, res);
-			if (s_ctrl->curr_csi_params != s_ctrl->csi_params[res]) {
-				s_ctrl->curr_csi_params = s_ctrl->csi_params[res];
-				s_ctrl->curr_csi_params->csid_params.lane_assign =
-					s_ctrl->sensordata->sensor_platform_info->
-					csi_lane_params->csi_lane_assign;
-				s_ctrl->curr_csi_params->csiphy_params.lane_mask =
-					s_ctrl->sensordata->sensor_platform_info->
-					csi_lane_params->csi_lane_mask;
-				v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-						NOTIFY_CSID_CFG,
-						&s_ctrl->curr_csi_params->csid_params);
-				mb();
-				v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-						NOTIFY_CSIPHY_CFG,
-						&s_ctrl->curr_csi_params->csiphy_params);
-				mb();
-				msleep(20);
-			}
-
-			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-				NOTIFY_PCLK_CHANGE, &s_ctrl->msm_sensor_reg->
-				output_settings[res].op_pixel_clk);
-			s_ctrl->func_tbl->sensor_start_stream(s_ctrl);
-			msleep(30);
-		}
-	}
-	CDBG("%s: X", __func__);
-	return rc;
-}
-
-int32_t imx111_sensor_set_fps(struct msm_sensor_ctrl_t *s_ctrl,
-						struct fps_cfg *fps)
-{
-	uint16_t total_lines_per_frame;
-	int32_t rc = 0;
-	s_ctrl->fps_divider = fps->fps_div;
-
-	if (s_ctrl->curr_res != MSM_SENSOR_INVALID_RES) {
-		uint16_t fl_read = 0;
-		total_lines_per_frame = (uint16_t)
-			((s_ctrl->curr_frame_length_lines) *
-			s_ctrl->fps_divider/Q10);
-
-		rc = msm_camera_i2c_read(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines,
-			&fl_read, MSM_CAMERA_I2C_WORD_DATA);
-
-		CDBG("%s: before_fl = %d, new_fl = %d", __func__, fl_read, total_lines_per_frame);
-
-		if(fl_read < total_lines_per_frame) {
-			pr_err("%s: Write new_fl (before_fl = %d, new_fl = %d)", __func__, fl_read, total_lines_per_frame);
-			rc = msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-				s_ctrl->sensor_output_reg_addr->frame_length_lines,
-				total_lines_per_frame, MSM_CAMERA_I2C_WORD_DATA);
-		}
-	}
-	return rc;
-}
-
-int32_t imx111_sensor_write_exp_gain1(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line)
-{
-	uint32_t fl_lines;
-	uint8_t offset;
-	fl_lines = s_ctrl->curr_frame_length_lines;
-	fl_lines = (fl_lines * s_ctrl->fps_divider) / Q10;
-	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
-	if (line > (fl_lines - offset))
-		fl_lines = line + offset;
-
-	CDBG("\n%s:Gain:%d, Linecount:%d\n", __func__, gain, line);
-	if (s_ctrl->curr_res == 0) {
-		msm_camera_i2c_write_tbl(s_ctrl->sensor_i2c_client,
-			(struct msm_camera_i2c_reg_conf *)
-			imx111_comm_confs[1].conf,
-			imx111_comm_confs[1].size,
-			imx111_comm_confs[1].data_type);
-
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines,
-			fl_lines, MSM_CAMERA_I2C_WORD_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-			line, MSM_CAMERA_I2C_WORD_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
-			MSM_CAMERA_I2C_WORD_DATA);
-
-		msm_camera_i2c_write_tbl(s_ctrl->sensor_i2c_client,
-			(struct msm_camera_i2c_reg_conf *)
-			imx111_comm_confs[2].conf,
-			imx111_comm_confs[2].size,
-			imx111_comm_confs[2].data_type);
-
-		if (s_ctrl->curr_csi_params !=
-			s_ctrl->csi_params[s_ctrl->curr_res]) {
-			s_ctrl->curr_csi_params =
-				s_ctrl->csi_params[s_ctrl->curr_res];
-			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-					NOTIFY_CSID_CFG,
-					&s_ctrl->curr_csi_params->csid_params);
-			mb();
-			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-					NOTIFY_CSIPHY_CFG,
-					&s_ctrl->curr_csi_params->csiphy_params);
-			mb();
-			msleep(20);
-		}
-
-		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-			NOTIFY_PCLK_CHANGE, &s_ctrl->msm_sensor_reg->
-			output_settings[s_ctrl->curr_res].op_pixel_clk);
-		s_ctrl->func_tbl->sensor_start_stream(s_ctrl);
-	} else {
-		s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines,
-			fl_lines, MSM_CAMERA_I2C_WORD_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-			line, MSM_CAMERA_I2C_WORD_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
-			MSM_CAMERA_I2C_WORD_DATA);
-		s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	}
-
-	return 0;
-}
-
-#define IMX111_EEPROM_SADDR 	0x50
-#define IMX111_EEPROM_PAGE_SIZE	0x100
-#define RED_START 	0x0A
-#define GR_START 	0xE7
-#define GB_START 	0xC4
-#define BLUE_START 	0xA1
-#define CRC_ADDR	0x7E
-#define R_REF_ADDR  0x80
-
-#ifdef CONFIG_SEKONIX_LENS_ACT
-#define AF_CAL_START 0x06
-uint8_t imx111_afcalib_data[4];
-#endif
-int32_t imx_i2c_read_eeprom_burst(unsigned char saddr,
-		unsigned char *rxdata, int length)
-{
-	int32_t rc = 0;
-	unsigned char tmp_buf = 0;
-
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = 1,
-			.buf   = &tmp_buf,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = length,
-			.buf   = rxdata,
-		},
-	};
-	rc = i2c_transfer(imx111_s_ctrl.sensor_i2c_client->client->adapter, msgs, 2);
-	if (rc < 0)
-		pr_err("imx111_i2c_rxdata failed 0x%x\n", saddr);
-	return rc;
-}
-
-static int imx111_read_eeprom_data(struct msm_sensor_ctrl_t *s_ctrl, struct sensor_cfg_data *cfg)
-{
-	int32_t rc = 0;
-	uint8_t eepromdata[IMX111_EEPROM_PAGE_SIZE];
-	uint32_t crc_5100= 0 /*, crc_2850 = 0*/;
-	int i;
-
-	CDBG("%s: E\n", __func__);
-
-	memset(eepromdata, 0, sizeof(eepromdata));
-	// for LSC data
-	if(imx_i2c_read_eeprom_burst(IMX111_EEPROM_SADDR | 0x0 /* page_no:0 */,
-		eepromdata, IMX111_EEPROM_PAGE_SIZE) < 0) {
-		pr_err("%s: Error Reading EEPROM : page_no:0 \n", __func__);
-		return rc;
-	}
-
-#ifdef CONFIG_SEKONIX_LENS_ACT
-	// for AF Cal Data
-	imx111_afcalib_data[0] = eepromdata[7];
-	imx111_afcalib_data[1] = eepromdata[6];
-	imx111_afcalib_data[2] = eepromdata[9];
-	imx111_afcalib_data[3] = eepromdata[8];
-	CDBG("[QCTK_EEPROM][AF] act_start = %d\n",(eepromdata[6]<<8) |eepromdata[7]);
-	CDBG("[QCTK_EEPROM][AF] act_macro = %d\n",(eepromdata[8]<<8) |eepromdata[9]);
-#endif
-	for (i = 0; i < ROLLOFF_CALDATA_SIZE; i++) {
-		cfg->cfg.calib_info.rolloff.r_gain[i] = eepromdata[RED_START + i];
-		crc_5100 += eepromdata[RED_START + i];
-		//CDBG("[QCTK_EEPROM] R (0x%x, %d)\n", RED_START + i, eepromdata[RED_START + i]);
-	}
-
-	for (i = 0; i < IMX111_EEPROM_PAGE_SIZE - GR_START; i++) {
-		cfg->cfg.calib_info.rolloff.gr_gain[i] = eepromdata[GR_START + i];
-		crc_5100 += eepromdata[GR_START + i];
-		//CDBG("[QCTK_EEPROM] GR (0x%x, %d)\n", GR_START + i, eepromdata[GR_START + i]);
-	}
-
-	memset(eepromdata, 0, sizeof(eepromdata));
-	if(imx_i2c_read_eeprom_burst(IMX111_EEPROM_SADDR | 0x1 /* page_no:1 */,
-		eepromdata, IMX111_EEPROM_PAGE_SIZE) < 0) {
-		pr_err("%s: Error Reading EEPROM : page_no:1 \n", __func__);
-		return rc;
-	}
-
-	// rolloff_size : 221, Gr_start: 231, eep_page_size: 256
-	// i < 221 +231 - 256 (= 196) ==> in 2nd page of eeprom
-	for (i = 0; i < ROLLOFF_CALDATA_SIZE + GR_START - IMX111_EEPROM_PAGE_SIZE; i++) {
-		cfg->cfg.calib_info.rolloff.gr_gain[IMX111_EEPROM_PAGE_SIZE - GR_START + i] = eepromdata[i];
-		crc_5100 += eepromdata[i];
-		//CDBG("[QCTK_EEPROM] GR (0x%x, %d)\n", i, eepromdata[i]);
-	}
-
-	for (i = 0; i < IMX111_EEPROM_PAGE_SIZE - GB_START; i++) {
-		cfg->cfg.calib_info.rolloff.gb_gain[i] = eepromdata[GB_START + i];
-		crc_5100 += eepromdata[GB_START + i];
-		//CDBG("[QCTK_EEPROM] GB (0x%x, %d)\n", GB_START + i, eepromdata[GB_START + i]);
-	}
-
-	memset(eepromdata, 0, sizeof(eepromdata));
-	if(imx_i2c_read_eeprom_burst(IMX111_EEPROM_SADDR | 0x2 /* page_no:2 */,
-		eepromdata, IMX111_EEPROM_PAGE_SIZE) < 0) {
-		pr_err("%s: Error Reading EEPROM : page_no:2 \n", __func__);
-		return rc;
-	}
-	for (i = 0; i < ROLLOFF_CALDATA_SIZE + GB_START - IMX111_EEPROM_PAGE_SIZE; i++) {
-		cfg->cfg.calib_info.rolloff.gb_gain[IMX111_EEPROM_PAGE_SIZE - GB_START + i] = eepromdata[i];
-		crc_5100 += eepromdata[i];
-		//CDBG("[QCTK_EEPROM] GB (0x%x, %d)\n", i, eepromdata[i]);
-	}
-
-	for (i = 0; i < IMX111_EEPROM_PAGE_SIZE - BLUE_START; i++) {
-		cfg->cfg.calib_info.rolloff.b_gain[i] = eepromdata[BLUE_START + i];
-		crc_5100 += eepromdata[BLUE_START + i];
-		//CDBG("[QCTK_EEPROM] B (0x%x, %d)\n", BLUE_START + i, eepromdata[BLUE_START + i]);
-	}
-
-	memset(eepromdata, 0, sizeof(eepromdata));
-
-	if(imx_i2c_read_eeprom_burst(IMX111_EEPROM_SADDR | 0x3 /* page_no:3 */,
-		eepromdata, IMX111_EEPROM_PAGE_SIZE) < 0) {
-			pr_err("%s: Error Reading EEPROM : page_no:3 \n", __func__);
-			return rc;
-	}
-
-	for (i = 0; i < ROLLOFF_CALDATA_SIZE + BLUE_START - IMX111_EEPROM_PAGE_SIZE; i++) {
-		cfg->cfg.calib_info.rolloff.b_gain[IMX111_EEPROM_PAGE_SIZE - BLUE_START + i] = eepromdata[i];
-		crc_5100 += eepromdata[i];
-		//CDBG("[QCTK_EEPROM] B(0x%x, %d)\n", i, eepromdata[i]);
-	}
-
-	if (eepromdata[0xCA] != 1) {
-		for (i = 0; i < 17; i++) {
-			cfg->cfg.calib_info.rolloff.red_ref[i] =
-				eepromdata[R_REF_ADDR + i];
-			CDBG("[QCTK_EEPROM] R_ref(0x%x)\n",
-				cfg->cfg.calib_info.rolloff.red_ref[i]);
-		}
-	} else {
-		cfg->cfg.calib_info.rolloff.red_ref[0] = 0xFE;
-		cfg->cfg.calib_info.rolloff.red_ref[1] = eepromdata[0xC6];
-		cfg->cfg.calib_info.rolloff.red_ref[2] = eepromdata[0xC7];
-		cfg->cfg.calib_info.rolloff.red_ref[3] = eepromdata[0xC8];
-		cfg->cfg.calib_info.rolloff.red_ref[4] = eepromdata[0xC9];
-	}
-	CDBG("%s: crc_from_eeprom(0x%x), cal_crc(0x%x)\n", __func__,
-		(eepromdata[CRC_ADDR] << 8) | eepromdata[CRC_ADDR+1], crc_5100& 0xFFFF);
-
-	// for AWB data - from Rolloff data
-	cfg->cfg.calib_info.r_over_g = (uint16_t)(((((uint32_t)cfg->cfg.calib_info.rolloff.r_gain[ROLLOFF_CALDATA_SIZE / 2])<<10)
-						+ ((uint32_t)(cfg->cfg.calib_info.rolloff.gr_gain[ROLLOFF_CALDATA_SIZE / 2]) >> 1))
-						/ (uint32_t)cfg->cfg.calib_info.rolloff.gr_gain[ROLLOFF_CALDATA_SIZE / 2]);
-	CDBG("[QCTK_EEPROM] r_over_g = 0x%4x\n", cfg->cfg.calib_info.r_over_g);
-	cfg->cfg.calib_info.b_over_g = (uint16_t)(((((uint32_t)cfg->cfg.calib_info.rolloff.b_gain[ROLLOFF_CALDATA_SIZE / 2])<<10)
-						+ ((uint32_t)(cfg->cfg.calib_info.rolloff.gb_gain[ROLLOFF_CALDATA_SIZE / 2]) >> 1))
-						/ (uint32_t)cfg->cfg.calib_info.rolloff.gb_gain[ROLLOFF_CALDATA_SIZE / 2]);
-	CDBG("[QCTK_EEPROM] b_over_g = 0x%4x\n", cfg->cfg.calib_info.b_over_g);
-	cfg->cfg.calib_info.gr_over_gb = (uint16_t)(((((uint32_t)cfg->cfg.calib_info.rolloff.gr_gain[ROLLOFF_CALDATA_SIZE / 2])<<10)
-						+ ((uint32_t)(cfg->cfg.calib_info.rolloff.gb_gain[ROLLOFF_CALDATA_SIZE / 2]) >> 1))
-						/ (uint32_t)cfg->cfg.calib_info.rolloff.gb_gain[ROLLOFF_CALDATA_SIZE / 2]);
-	CDBG("[QCTK_EEPROM] gr_over_gb = 0x%4x\n", cfg->cfg.calib_info.gr_over_gb);
-
-	CDBG("%s: X\n", __func__);
-	return 0;
-}
-
-static struct v4l2_subdev_video_ops imx111_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops imx111_subdev_ops = {
-	.core = &imx111_subdev_core_ops,
-	.video  = &imx111_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t imx111_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = imx111_sensor_set_fps,
-	.sensor_write_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_write_snapshot_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_setting = msm_sensor_setting,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_get_eeprom_data = imx111_read_eeprom_data,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-	.sensor_get_csi_params = msm_sensor_get_csi_params,
-};
-
-static struct msm_sensor_reg_t imx111_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = imx111_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(imx111_start_settings),
-	.stop_stream_conf = imx111_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(imx111_stop_settings),
-	.group_hold_on_conf = imx111_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(imx111_groupon_settings),
-	.group_hold_off_conf = imx111_groupoff_settings,
-	.group_hold_off_conf_size =
-		ARRAY_SIZE(imx111_groupoff_settings),
-	.init_settings = &imx111_init_conf[0],
-	.init_size = ARRAY_SIZE(imx111_init_conf),
-	.mode_settings = &imx111_confs[0],
-	.output_settings = &imx111_dimensions[0],
-	.num_conf = ARRAY_SIZE(imx111_confs),
-};
-
-static struct msm_sensor_ctrl_t imx111_s_ctrl = {
-	.msm_sensor_reg = &imx111_regs,
-	.sensor_i2c_client = &imx111_sensor_i2c_client,
-	.sensor_i2c_addr = 0x34,
-	.sensor_output_reg_addr = &imx111_reg_addr,
-	.sensor_id_info = &imx111_id_info,
-	.sensor_exp_gain_info = &imx111_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.csi_params = &imx111_csi_params_array[0],
-	.msm_sensor_mutex = &imx111_mut,
-	.sensor_i2c_driver = &imx111_i2c_driver,
-	.sensor_v4l2_subdev_info = imx111_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(imx111_subdev_info),
-	.sensor_v4l2_subdev_ops = &imx111_subdev_ops,
-	.func_tbl = &imx111_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ, // ADD
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Sony 8MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/imx119_v4l2.c b/drivers/media/video/msm/sensors/imx119_v4l2.c
deleted file mode 100644
index 548df52..0000000
--- a/drivers/media/video/msm/sensors/imx119_v4l2.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#define SENSOR_NAME "imx119"
-#define PLATFORM_DRIVER_NAME "msm_camera_imx119"
-#define imx119_obj imx119_##obj
-
-DEFINE_MUTEX(imx119_mut);
-static struct msm_sensor_ctrl_t imx119_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf imx119_start_settings[] = {
-	{0x0100, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf imx119_stop_settings[] = {
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx119_groupon_settings[] = {
-	{0x104, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf imx119_groupoff_settings[] = {
-	{0x104, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx119_prev_settings[] = {
-	{0x0101, 0x03}, /* read out direction */
-	{0x0340, 0x04},
-	{0x0341, 0x28},
-	{0x0346, 0x00},
-	{0x0347, 0x00},
-	{0x034A, 0x04},
-	{0x034B, 0x0F},
-	{0x034C, 0x05},
-	{0x034D, 0x10},
-	{0x034E, 0x04},
-	{0x034F, 0x10},
-	{0x0381, 0x01},
-	{0x0383, 0x01},
-	{0x0385, 0x01},
-	{0x0387, 0x01},
-	{0x3001, 0x00},
-	{0x3016, 0x02},
-	{0x3060, 0x30},
-	{0x30E8, 0x00},
-	{0x3301, 0x05},
-	{0x308A, 0x43},
-	{0x3305, 0x03},
-	{0x3309, 0x05},
-	{0x330B, 0x03},
-	{0x330D, 0x05},
-};
-
-static struct msm_camera_i2c_reg_conf imx119_recommend_settings[] = {
-	{0x0305, 0x02},
-	{0x0307, 0x26},
-	{0x3025, 0x0A},
-	{0x302B, 0x4B},
-	{0x0112, 0x0A},
-	{0x0113, 0x0A},
-	{0x301C, 0x02},
-	{0x302C, 0x85},
-	{0x303A, 0xA4},
-	{0x3108, 0x25},
-	{0x310A, 0x27},
-	{0x3122, 0x26},
-	{0x3138, 0x26},
-	{0x313A, 0x27},
-	{0x316D, 0x0A},
-	{0x308C, 0x00},
-	{0x302E, 0x8C},
-	{0x302F, 0x81},
-	{0x0101, 0x03},
-};
-
-static struct v4l2_subdev_info imx119_subdev_info[] = {
-	{
-	.code = V4L2_MBUS_FMT_SBGGR10_1X10,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt = 1,
-	.order = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array imx119_init_conf[] = {
-	{&imx119_recommend_settings[0],
-	ARRAY_SIZE(imx119_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array imx119_confs[] = {
-	{&imx119_prev_settings[0],
-	ARRAY_SIZE(imx119_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t imx119_dimensions[] = {
-	{
-		.x_output = 0x510,
-		.y_output = 0x410,
-		.line_length_pclk = 0x570,
-		.frame_length_lines = 0x432,
-		.vt_pixel_clk = 45600000,
-		.op_pixel_clk = 45600000,
-	},
-};
-
-static struct msm_camera_csid_vc_cfg imx119_cid_cfg[] = {
-	{0, CSI_RAW10, CSI_DECODE_10BIT},
-	{1, CSI_EMBED_DATA, CSI_DECODE_8BIT},
-	{2, CSI_RESERVED_DATA_0, CSI_DECODE_8BIT},
-};
-
-static struct msm_camera_csi2_params imx119_csi_params = {
-	.csid_params = {
-		.lane_assign = 0xe4,
-		.lane_cnt = 1,
-		.lut_params = {
-			.num_cid = 3,
-			.vc_cfg = imx119_cid_cfg,
-		},
-	},
-	.csiphy_params = {
-		.lane_cnt = 1,
-		.settle_cnt = 0x1B,
-	},
-};
-
-static struct msm_camera_csi2_params *imx119_csi_params_array[] = {
-	&imx119_csi_params,
-};
-
-static struct msm_sensor_output_reg_addr_t imx119_reg_addr = {
-	.x_output = 0x34C,
-	.y_output = 0x34E,
-	.line_length_pclk = 0x342,
-	.frame_length_lines = 0x340,
-};
-
-static struct msm_sensor_id_info_t imx119_id_info = {
-	.sensor_id_reg_addr = 0x0,
-	.sensor_id = 0x119,
-};
-
-static struct msm_sensor_exp_gain_info_t imx119_exp_gain_info = {
-	.coarse_int_time_addr = 0x202,
-	.global_gain_addr = 0x204,
-	.vert_offset = 3,
-};
-
-
-static const struct i2c_device_id imx119_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&imx119_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver imx119_i2c_driver = {
-	.id_table = imx119_i2c_id,
-	.probe = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client imx119_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	return i2c_add_driver(&imx119_i2c_driver);
-}
-
-static struct v4l2_subdev_core_ops imx119_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-static struct v4l2_subdev_video_ops imx119_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops imx119_subdev_ops = {
-	.core = &imx119_subdev_core_ops,
-	.video = &imx119_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t imx119_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_write_snapshot_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_setting = msm_sensor_setting,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-	.sensor_get_csi_params = msm_sensor_get_csi_params,
-};
-
-static struct msm_sensor_reg_t imx119_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = imx119_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(imx119_start_settings),
-	.stop_stream_conf = imx119_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(imx119_stop_settings),
-	.group_hold_on_conf = imx119_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(imx119_groupon_settings),
-	.group_hold_off_conf = imx119_groupoff_settings,
-	.group_hold_off_conf_size = ARRAY_SIZE(imx119_groupoff_settings),
-	.init_settings = &imx119_init_conf[0],
-	.init_size = ARRAY_SIZE(imx119_init_conf),
-	.mode_settings = &imx119_confs[0],
-	.output_settings = &imx119_dimensions[0],
-	.num_conf = ARRAY_SIZE(imx119_confs),
-};
-
-static struct msm_sensor_ctrl_t imx119_s_ctrl = {
-	.msm_sensor_reg = &imx119_regs,
-	.sensor_i2c_client = &imx119_sensor_i2c_client,
-	.sensor_i2c_addr = 0x6E,
-	.sensor_output_reg_addr = &imx119_reg_addr,
-	.sensor_id_info = &imx119_id_info,
-	.sensor_exp_gain_info = &imx119_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.csi_params = &imx119_csi_params_array[0],
-	.msm_sensor_mutex = &imx119_mut,
-	.sensor_i2c_driver = &imx119_i2c_driver,
-	.sensor_v4l2_subdev_info = imx119_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(imx119_subdev_info),
-	.sensor_v4l2_subdev_ops = &imx119_subdev_ops,
-	.func_tbl = &imx119_func_tbl,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Sony 1.3MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
-
diff --git a/drivers/media/video/msm/sensors/imx135_v4l2.c b/drivers/media/video/msm/sensors/imx135_v4l2.c
deleted file mode 100755
index b549842..0000000
--- a/drivers/media/video/msm/sensors/imx135_v4l2.c
+++ /dev/null
@@ -1,1420 +0,0 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#define SENSOR_NAME "imx135"
-#define PLATFORM_DRIVER_NAME "msm_camera_imx135"
-#define imx135_obj imx135_##obj
-
-DEFINE_MUTEX(imx135_mut);
-
-/* Register addresses for HDR control */
-#define SHORT_SHUTTER_WORD_ADDR		0x0230
-#define SHORT_GAIN_BYTE_ADDR		0x0233
-#define ABS_GAIN_R_WORD_ADDR		0x0714
-#define ABS_GAIN_B_WORD_ADDR		0x0716
-#define LSC_ENABLE_BYTE_ADDR		0x0700
-#define EN_LSC_BYTE_ADDR			0x4500
-#define RAM_SEL_TOGGLE_BYTE_ADDR	0x3A63
-#define LSC_TABLE_START_ADDR		0x4800
-#define TC_OUT_NOISE_WORD_ADDR		0x4452
-#define TC_OUT_MID_WORD_ADDR		0x4454
-#define TC_NOISE_BRATE_REGADDR		0x4458
-#define TC_MID_BRATE_REGADDR		0x4459
-#define TC_SWITCH_BYTE_ADDR			0x446C
-
-#define LSC_TABLE_LEN_BYTES			504
-
-/* Adaptive tone reduction parameters */
-#define INIT_ATR_OUT_NOISE	0xA0
-#define INIT_ATR_OUT_MID	0x800
-#define ATR_OFFSET			0x00
-#define THRESHOLD_DEAD_ZONE	10
-#define THRESHOLD_0			20
-#define THRESHOLD_1			50
-
-static struct msm_sensor_ctrl_t imx135_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf imx135_start_settings[] = {
-	{0x0100, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf imx135_stop_settings[] = {
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx135_groupon_settings[] = {
-	{0x104, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf imx135_groupoff_settings[] = {
-	{0x104, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx135_recommend_settings[] = {
-	/*Global Settings*/
-	{0x0101, 0x00},
-	{0x0105, 0x01},
-	{0x0110, 0x00},
-	{0x0220, 0x01},
-	{0x3302, 0x11},
-	{0x3833, 0x20},
-	{0x3893, 0x00},
-	{0x3906, 0x08},
-	{0x3907, 0x01},
-	{0x391B, 0x01},
-	{0x3C09, 0x01},
-	{0x600A, 0x00},
-	{0x3008, 0xB0},
-	{0x320A, 0x01},
-	{0x320D, 0x10},
-	{0x3216, 0x2E},
-	{0x322C, 0x02},
-	{0x3409, 0x0C},
-	{0x340C, 0x2D},
-	{0x3411, 0x39},
-	{0x3414, 0x1E},
-	{0x3427, 0x04},
-	{0x3480, 0x1E},
-	{0x3484, 0x1E},
-	{0x3488, 0x1E},
-	{0x348C, 0x1E},
-	{0x3490, 0x1E},
-	{0x3494, 0x1E},
-	{0x3511, 0x8F},
-	{0x364F, 0x2D},
-	/*Defect Correction Recommended Setting */
-	{0x380A, 0x00},
-	{0x380B, 0x00},
-	{0x4103, 0x00},
-	/*Color Artifact Recommended Setting */
-	{0x4243, 0x9A},
-	{0x4330, 0x01},
-	{0x4331, 0x90},
-	{0x4332, 0x02},
-	{0x4333, 0x58},
-	{0x4334, 0x03},
-	{0x4335, 0x20},
-	{0x4336, 0x03},
-	{0x4337, 0x84},
-	{0x433C, 0x01},
-	{0x4340, 0x02},
-	{0x4341, 0x58},
-	{0x4342, 0x03},
-	{0x4343, 0x52},
-	/*Moiré reduction Parameter Setting	*/
-	{0x4364, 0x0B},
-	{0x4368, 0x00},
-	{0x4369, 0x0F},
-	{0x436A, 0x03},
-	{0x436B, 0xA8},
-	{0x436C, 0x00},
-	{0x436D, 0x00},
-	{0x436E, 0x00},
-	{0x436F, 0x06},
-	/*CNR parameter setting	*/
-	{0x4281, 0x21},
-	{0x4282, 0x18},
-	{0x4283, 0x04},
-	{0x4284, 0x08},
-	{0x4287, 0x7F},
-	{0x4288, 0x08},
-	{0x428B, 0x7F},
-	{0x428C, 0x08},
-	{0x428F, 0x7F},
-	{0x4297, 0x00},
-	{0x4298, 0x7E},
-	{0x4299, 0x7E},
-	{0x429A, 0x7E},
-	{0x42A4, 0xFB},
-	{0x42A5, 0x7E},
-	{0x42A6, 0xDF},
-	{0x42A7, 0xB7},
-	{0x42AF, 0x03},
-	/*ARNR Parameter Setting*/
-	{0x4207, 0x03},
-	{0x4216, 0x08},
-	{0x4217, 0x08},
-	/*DLC Parameter Setting*/
-	{0x4218, 0x00},
-	{0x421B, 0x20},
-	{0x421F, 0x04},
-	{0x4222, 0x02},
-	{0x4223, 0x22},
-	{0x422E, 0x54},
-	{0x422F, 0xFB},
-	{0x4230, 0xFF},
-	{0x4231, 0xFE},
-	{0x4232, 0xFF},
-	{0x4235, 0x58},
-	{0x4236, 0xF7},
-	{0x4237, 0xFD},
-	{0x4239, 0x4E},
-	{0x423A, 0xFC},
-	{0x423B, 0xFD},
-	/*HDR Setting*/
-	{0x4300, 0x00},
-	{0x4316, 0x12},
-	{0x4317, 0x22},
-	{0x4318, 0x00},
-	{0x4319, 0x00},
-	{0x431A, 0x00},
-	{0x4324, 0x03},
-	{0x4325, 0x20},
-	{0x4326, 0x03},
-	{0x4327, 0x84},
-	{0x4328, 0x03},
-	{0x4329, 0x20},
-	{0x432A, 0x03},
-	{0x432B, 0x20},
-	{0x432C, 0x01},
-	{0x432D, 0x01},
-	{0x4338, 0x02},
-	{0x4339, 0x00},
-	{0x433A, 0x00},
-	{0x433B, 0x02},
-	{0x435A, 0x03},
-	{0x435B, 0x84},
-	{0x435E, 0x01},
-	{0x435F, 0xFF},
-	{0x4360, 0x01},
-	{0x4361, 0xF4},
-	{0x4362, 0x03},
-	{0x4363, 0x84},
-	{0x437B, 0x01},
-	{0x4401, 0x03}, /*0x3F*/
-	{0x4402, 0xFF},
-	{0x4404, 0x13},
-	{0x4405, 0x26},
-	{0x4406, 0x07},
-	{0x4408, 0x20},
-	{0x4409, 0xE5},
-	{0x440A, 0xFB},
-	{0x440C, 0xF6},
-	{0x440D, 0xEA},
-	{0x440E, 0x20},
-	{0x4410, 0x00},
-	{0x4411, 0x00},
-	{0x4412, 0x3F},
-	{0x4413, 0xFF},
-	{0x4414, 0x1F},
-	{0x4415, 0xFF},
-	{0x4416, 0x20},
-	{0x4417, 0x00},
-	{0x4418, 0x1F},
-	{0x4419, 0xFF},
-	{0x441A, 0x20},
-	{0x441B, 0x00},
-	{0x441D, 0x40},
-	{0x441E, 0x1E},
-	{0x441F, 0x38},
-	{0x4420, 0x01},
-	{0x4444, 0x00},
-	{0x4445, 0x00},
-	{0x4446, 0x1D},
-	{0x4447, 0xF9},
-	{0x4452, 0x00},
-	{0x4453, 0xA0},
-	{0x4454, 0x08},
-	{0x4455, 0x00},
-	{0x4456, 0x0F},
-	{0x4457, 0xFF},
-	{0x4458, 0x18},
-	{0x4459, 0x18},
-	{0x445A, 0x3F},
-	{0x445B, 0x3A},
-	{0x445C, 0x00},
-	{0x445D, 0x28},
-	{0x445E, 0x01},
-	{0x445F, 0x90},
-	{0x4460, 0x00},
-	{0x4461, 0x60},
-	{0x4462, 0x00},
-	{0x4463, 0x00},
-	{0x4464, 0x00},
-	{0x4465, 0x00},
-	{0x446C, 0x00},
-	{0x446D, 0x00},
-	{0x446E, 0x00},
-	/*LSC Setting*/
-	{0x452A, 0x02},
-	/*White Balance Setting */
-	{0x0712, 0x01},
-	{0x0713, 0x00},
-	{0x0714, 0x01},
-	{0x0715, 0x00},
-	{0x0716, 0x01},
-	{0x0717, 0x00},
-	{0x0718, 0x01},
-	{0x0719, 0x00},
-	/*Shading setting*/
-	{0x4500, 0x1F},
-};
-
-static struct msm_camera_i2c_reg_conf imx135_prev_settings[] = {
-	/* Clock Setting */
-	{0x011E, 0x18},
-	{0x011F, 0x00},
-	{0x0301, 0x05},
-	{0x0303, 0x01},
-	{0x0305, 0x03},
-	{0x0309, 0x05},
-	{0x030B, 0x02},
-	{0x030C, 0x00},
-	{0x030D, 0x71},
-	{0x030E, 0x01},
-	{0x3A06, 0x12},
-	/* Mode setting */
-	{0x0108, 0x03},
-	{0x0112, 0x0A},
-	{0x0113, 0x0A},
-	{0x0381, 0x01},
-	{0x0383, 0x01},
-	{0x0385, 0x01},
-	{0x0387, 0x01},
-	{0x0390, 0x01},
-	{0x0391, 0x22},
-	{0x0392, 0x00},
-	{0x0401, 0x00},
-	{0x0404, 0x00},
-	{0x0405, 0x10},
-	{0x4082, 0x01},
-	{0x4083, 0x01},
-	{0x7006, 0x04},
-	/* OptionalFunction setting */
-	{0x0700, 0x00},
-	{0x3A63, 0x00},
-	{0x4100, 0xF8},
-	{0x4203, 0xFF},
-	{0x4344, 0x00},
-	{0x441C, 0x01},
-	/* Size setting	*/
-	{0x0340, 0x0A},
-	{0x0341, 0x40},
-	{0x0342, 0x11},
-	{0x0343, 0xDC},
-	{0x0344, 0x00},
-	{0x0345, 0x00},
-	{0x0346, 0x00},
-	{0x0347, 0x00},
-	{0x0348, 0x10},
-	{0x0349, 0x6F},
-	{0x034A, 0x0C},
-	{0x034B, 0x2F},
-	{0x034C, 0x08},
-	{0x034D, 0x38},
-	{0x034E, 0x06},
-	{0x034F, 0x18},
-	{0x0350, 0x00},
-	{0x0351, 0x00},
-	{0x0352, 0x00},
-	{0x0353, 0x00},
-	{0x0354, 0x08},
-	{0x0355, 0x38},
-	{0x0356, 0x06},
-	{0x0357, 0x18},
-	{0x301D, 0x30},
-	{0x3310, 0x08},
-	{0x3311, 0x38},
-	{0x3312, 0x06},
-	{0x3313, 0x18},
-	{0x331C, 0x00},
-	{0x331D, 0x52},
-	{0x4084, 0x00},
-	{0x4085, 0x00},
-	{0x4086, 0x00},
-	{0x4087, 0x00},
-	{0x4400, 0x00},
-	/* Global Timing Setting */
-	{0x0830, 0x67},
-	{0x0831, 0x27},
-	{0x0832, 0x47},
-	{0x0833, 0x27},
-	{0x0834, 0x27},
-	{0x0835, 0x1F},
-	{0x0836, 0x87},
-	{0x0837, 0x2F},
-	{0x0839, 0x1F},
-	{0x083A, 0x17},
-	{0x083B, 0x02},
-	/* Integration Time Setting */
-	{0x0202, 0x06},
-	{0x0203, 0x2A},
-	/* Gain Setting	*/
-	{0x0205, 0x00},
-	{0x020E, 0x01},
-	{0x020F, 0x00},
-	{0x0210, 0x01},
-	{0x0211, 0x00},
-	{0x0212, 0x01},
-	{0x0213, 0x00},
-	{0x0214, 0x01},
-	{0x0215, 0x00},
-	/* HDR Setting */
-	{0x0230, 0x00},
-	{0x0231, 0x00},
-	{0x0233, 0x00},
-	{0x0234, 0x00},
-	{0x0235, 0x40},
-	{0x0238, 0x00},
-	{0x0239, 0x04},
-	{0x023B, 0x00},
-	{0x023C, 0x01},
-	{0x33B0, 0x04},
-	{0x33B1, 0x00},
-	{0x33B3, 0x00},
-	{0x33B4, 0x00},
-	{0x3800, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx135_LSCTable_settings[] = {
-	{0x4800, 0x02},
-	{0x4801, 0x68},
-	{0x4802, 0x02},
-	{0x4803, 0x4f},
-	{0x4804, 0x02},
-	{0x4805, 0x10},
-	{0x4806, 0x01},
-	{0x4807, 0xf3},
-	{0x4808, 0x01},
-	{0x4809, 0xc3},
-	{0x480a, 0x01},
-	{0x480b, 0xb3},
-	{0x480c, 0x01},
-	{0x480d, 0x9a},
-	{0x480e, 0x01},
-	{0x480f, 0x8e},
-	{0x4810, 0x01},
-	{0x4811, 0x84},
-	{0x4812, 0x01},
-	{0x4813, 0x7f},
-	{0x4814, 0x01},
-	{0x4815, 0x94},
-	{0x4816, 0x01},
-	{0x4817, 0x8a},
-	{0x4818, 0x01},
-	{0x4819, 0xb7},
-	{0x481a, 0x01},
-	{0x481b, 0xa6},
-	{0x481c, 0x01},
-	{0x481d, 0xf9},
-	{0x481e, 0x01},
-	{0x481f, 0xe2},
-	{0x4820, 0x02},
-	{0x4821, 0x62},
-	{0x4822, 0x02},
-	{0x4823, 0x37},
-	{0x4824, 0x02},
-	{0x4825, 0x26},
-	{0x4826, 0x02},
-	{0x4827, 0x0c},
-	{0x4828, 0x01},
-	{0x4829, 0xbb},
-	{0x482a, 0x01},
-	{0x482b, 0xaf},
-	{0x482c, 0x01},
-	{0x482d, 0x7c},
-	{0x482e, 0x01},
-	{0x482f, 0x70},
-	{0x4830, 0x01},
-	{0x4831, 0x50},
-	{0x4832, 0x01},
-	{0x4833, 0x4b},
-	{0x4834, 0x01},
-	{0x4835, 0x3e},
-	{0x4836, 0x01},
-	{0x4837, 0x39},
-	{0x4838, 0x01},
-	{0x4839, 0x4c},
-	{0x483a, 0x01},
-	{0x483b, 0x45},
-	{0x483c, 0x01},
-	{0x483d, 0x74},
-	{0x483e, 0x01},
-	{0x483f, 0x63},
-	{0x4840, 0x01},
-	{0x4841, 0xae},
-	{0x4842, 0x01},
-	{0x4843, 0x97},
-	{0x4844, 0x02},
-	{0x4845, 0x07},
-	{0x4846, 0x01},
-	{0x4847, 0xeb},
-	{0x4848, 0x01},
-	{0x4849, 0xf6},
-	{0x484a, 0x01},
-	{0x484b, 0xdf},
-	{0x484c, 0x01},
-	{0x484d, 0x93},
-	{0x484e, 0x01},
-	{0x484f, 0x8d},
-	{0x4850, 0x01},
-	{0x4851, 0x50},
-	{0x4852, 0x01},
-	{0x4853, 0x4b},
-	{0x4854, 0x01},
-	{0x4855, 0x22},
-	{0x4856, 0x01},
-	{0x4857, 0x20},
-	{0x4858, 0x01},
-	{0x4859, 0x10},
-	{0x485a, 0x01},
-	{0x485b, 0x0e},
-	{0x485c, 0x01},
-	{0x485d, 0x1d},
-	{0x485e, 0x01},
-	{0x485f, 0x18},
-	{0x4860, 0x01},
-	{0x4861, 0x48},
-	{0x4862, 0x01},
-	{0x4863, 0x3f},
-	{0x4864, 0x01},
-	{0x4865, 0x85},
-	{0x4866, 0x01},
-	{0x4867, 0x7b},
-	{0x4868, 0x01},
-	{0x4869, 0xd9},
-	{0x486a, 0x01},
-	{0x486b, 0xc5},
-	{0x486c, 0x01},
-	{0x486d, 0xdf},
-	{0x486e, 0x01},
-	{0x486f, 0xcf},
-	{0x4870, 0x01},
-	{0x4871, 0x87},
-	{0x4872, 0x01},
-	{0x4873, 0x7f},
-	{0x4874, 0x01},
-	{0x4875, 0x3d},
-	{0x4876, 0x01},
-	{0x4877, 0x3a},
-	{0x4878, 0x01},
-	{0x4879, 0x10},
-	{0x487a, 0x01},
-	{0x487b, 0x0e},
-	{0x487c, 0x01},
-	{0x487d, 0x00},
-	{0x487e, 0x01},
-	{0x487f, 0x00},
-	{0x4880, 0x01},
-	{0x4881, 0x0a},
-	{0x4882, 0x01},
-	{0x4883, 0x07},
-	{0x4884, 0x01},
-	{0x4885, 0x34},
-	{0x4886, 0x01},
-	{0x4887, 0x2f},
-	{0x4888, 0x01},
-	{0x4889, 0x77},
-	{0x488a, 0x01},
-	{0x488b, 0x69},
-	{0x488c, 0x01},
-	{0x488d, 0xcc},
-	{0x488e, 0x01},
-	{0x488f, 0xb9},
-	{0x4890, 0x01},
-	{0x4891, 0xea},
-	{0x4892, 0x01},
-	{0x4893, 0xdf},
-	{0x4894, 0x01},
-	{0x4895, 0x93},
-	{0x4896, 0x01},
-	{0x4897, 0x86},
-	{0x4898, 0x01},
-	{0x4899, 0x4c},
-	{0x489a, 0x01},
-	{0x489b, 0x48},
-	{0x489c, 0x01},
-	{0x489d, 0x20},
-	{0x489e, 0x01},
-	{0x489f, 0x1c},
-	{0x48a0, 0x01},
-	{0x48a1, 0x0d},
-	{0x48a2, 0x01},
-	{0x48a3, 0x09},
-	{0x48a4, 0x01},
-	{0x48a5, 0x1a},
-	{0x48a6, 0x01},
-	{0x48a7, 0x15},
-	{0x48a8, 0x01},
-	{0x48a9, 0x43},
-	{0x48aa, 0x01},
-	{0x48ab, 0x3d},
-	{0x48ac, 0x01},
-	{0x48ad, 0x84},
-	{0x48ae, 0x01},
-	{0x48af, 0x75},
-	{0x48b0, 0x01},
-	{0x48b1, 0xd3},
-	{0x48b2, 0x01},
-	{0x48b3, 0xbf},
-	{0x48b4, 0x02},
-	{0x48b5, 0x23},
-	{0x48b6, 0x02},
-	{0x48b7, 0x07},
-	{0x48b8, 0x01},
-	{0x48b9, 0xbc},
-	{0x48ba, 0x01},
-	{0x48bb, 0xac},
-	{0x48bc, 0x01},
-	{0x48bd, 0x7a},
-	{0x48be, 0x01},
-	{0x48bf, 0x6f},
-	{0x48c0, 0x01},
-	{0x48c1, 0x4c},
-	{0x48c2, 0x01},
-	{0x48c3, 0x47},
-	{0x48c4, 0x01},
-	{0x48c5, 0x3d},
-	{0x48c6, 0x01},
-	{0x48c7, 0x37},
-	{0x48c8, 0x01},
-	{0x48c9, 0x48},
-	{0x48ca, 0x01},
-	{0x48cb, 0x40},
-	{0x48cc, 0x01},
-	{0x48cd, 0x70},
-	{0x48ce, 0x01},
-	{0x48cf, 0x61},
-	{0x48d0, 0x01},
-	{0x48d1, 0xab},
-	{0x48d2, 0x01},
-	{0x48d3, 0x9a},
-	{0x48d4, 0x02},
-	{0x48d5, 0x03},
-	{0x48d6, 0x01},
-	{0x48d7, 0xe6},
-	{0x48d8, 0x02},
-	{0x48d9, 0x71},
-	{0x48da, 0x02},
-	{0x48db, 0x4a},
-	{0x48dc, 0x02},
-	{0x48dd, 0x07},
-	{0x48de, 0x01},
-	{0x48df, 0xef},
-	{0x48e0, 0x01},
-	{0x48e1, 0xbf},
-	{0x48e2, 0x01},
-	{0x48e3, 0xae},
-	{0x48e4, 0x01},
-	{0x48e5, 0x97},
-	{0x48e6, 0x01},
-	{0x48e7, 0x89},
-	{0x48e8, 0x01},
-	{0x48e9, 0x82},
-	{0x48ea, 0x01},
-	{0x48eb, 0x7a},
-	{0x48ec, 0x01},
-	{0x48ed, 0x91},
-	{0x48ee, 0x01},
-	{0x48ef, 0x83},
-	{0x48f0, 0x01},
-	{0x48f1, 0xb7},
-	{0x48f2, 0x01},
-	{0x48f3, 0xa9},
-	{0x48f4, 0x01},
-	{0x48f5, 0xf0},
-	{0x48f6, 0x01},
-	{0x48f7, 0xd9},
-	{0x48f8, 0x02},
-	{0x48f9, 0x55},
-	{0x48fa, 0x02},
-	{0x48fb, 0x32},
-	{0x48fc, 0x02},
-	{0x48fd, 0x4b},
-	{0x48fe, 0x02},
-	{0x48ff, 0x4c},
-	{0x4900, 0x01},
-	{0x4901, 0xec},
-	{0x4902, 0x01},
-	{0x4903, 0xf2},
-	{0x4904, 0x01},
-	{0x4905, 0xb1},
-	{0x4906, 0x01},
-	{0x4907, 0xb7},
-	{0x4908, 0x01},
-	{0x4909, 0x8a},
-	{0x490a, 0x01},
-	{0x490b, 0x8c},
-	{0x490c, 0x01},
-	{0x490d, 0x7d},
-	{0x490e, 0x01},
-	{0x490f, 0x7d},
-	{0x4910, 0x01},
-	{0x4911, 0x87},
-	{0x4912, 0x01},
-	{0x4913, 0x87},
-	{0x4914, 0x01},
-	{0x4915, 0xa8},
-	{0x4916, 0x01},
-	{0x4917, 0xa8},
-	{0x4918, 0x01},
-	{0x4919, 0xe2},
-	{0x491a, 0x01},
-	{0x491b, 0xda},
-	{0x491c, 0x02},
-	{0x491d, 0x38},
-	{0x491e, 0x02},
-	{0x491f, 0x30},
-	{0x4920, 0x02},
-	{0x4921, 0x0a},
-	{0x4922, 0x02},
-	{0x4923, 0x0e},
-	{0x4924, 0x01},
-	{0x4925, 0xae},
-	{0x4926, 0x01},
-	{0x4927, 0xaf},
-	{0x4928, 0x01},
-	{0x4929, 0x71},
-	{0x492a, 0x01},
-	{0x492b, 0x74},
-	{0x492c, 0x01},
-	{0x492d, 0x4b},
-	{0x492e, 0x01},
-	{0x492f, 0x4a},
-	{0x4930, 0x01},
-	{0x4931, 0x3b},
-	{0x4932, 0x01},
-	{0x4933, 0x3c},
-	{0x4934, 0x01},
-	{0x4935, 0x46},
-	{0x4936, 0x01},
-	{0x4937, 0x47},
-	{0x4938, 0x01},
-	{0x4939, 0x68},
-	{0x493a, 0x01},
-	{0x493b, 0x68},
-	{0x493c, 0x01},
-	{0x493d, 0x9e},
-	{0x493e, 0x01},
-	{0x493f, 0xa0},
-	{0x4940, 0x01},
-	{0x4941, 0xf4},
-	{0x4942, 0x01},
-	{0x4943, 0xec},
-	{0x4944, 0x01},
-	{0x4945, 0xdc},
-	{0x4946, 0x01},
-	{0x4947, 0xe7},
-	{0x4948, 0x01},
-	{0x4949, 0x8a},
-	{0x494a, 0x01},
-	{0x494b, 0x8e},
-	{0x494c, 0x01},
-	{0x494d, 0x4b},
-	{0x494e, 0x01},
-	{0x494f, 0x4b},
-	{0x4950, 0x01},
-	{0x4951, 0x1e},
-	{0x4952, 0x01},
-	{0x4953, 0x1f},
-	{0x4954, 0x01},
-	{0x4955, 0x0c},
-	{0x4956, 0x01},
-	{0x4957, 0x0b},
-	{0x4958, 0x01},
-	{0x4959, 0x18},
-	{0x495a, 0x01},
-	{0x495b, 0x17},
-	{0x495c, 0x01},
-	{0x495d, 0x42},
-	{0x495e, 0x01},
-	{0x495f, 0x3f},
-	{0x4960, 0x01},
-	{0x4961, 0x7b},
-	{0x4962, 0x01},
-	{0x4963, 0x79},
-	{0x4964, 0x01},
-	{0x4965, 0xcb},
-	{0x4966, 0x01},
-	{0x4967, 0xc1},
-	{0x4968, 0x01},
-	{0x4969, 0xd4},
-	{0x496a, 0x01},
-	{0x496b, 0xd4},
-	{0x496c, 0x01},
-	{0x496d, 0x80},
-	{0x496e, 0x01},
-	{0x496f, 0x81},
-	{0x4970, 0x01},
-	{0x4971, 0x3e},
-	{0x4972, 0x01},
-	{0x4973, 0x3a},
-	{0x4974, 0x01},
-	{0x4975, 0x10},
-	{0x4976, 0x01},
-	{0x4977, 0x0d},
-	{0x4978, 0x01},
-	{0x4979, 0x00},
-	{0x497a, 0x01},
-	{0x497b, 0x00},
-	{0x497c, 0x01},
-	{0x497d, 0x07},
-	{0x497e, 0x01},
-	{0x497f, 0x08},
-	{0x4980, 0x01},
-	{0x4981, 0x34},
-	{0x4982, 0x01},
-	{0x4983, 0x32},
-	{0x4984, 0x01},
-	{0x4985, 0x72},
-	{0x4986, 0x01},
-	{0x4987, 0x6d},
-	{0x4988, 0x01},
-	{0x4989, 0xc1},
-	{0x498a, 0x01},
-	{0x498b, 0xb6},
-	{0x498c, 0x01},
-	{0x498d, 0xe1},
-	{0x498e, 0x01},
-	{0x498f, 0xe5},
-	{0x4990, 0x01},
-	{0x4991, 0x8d},
-	{0x4992, 0x01},
-	{0x4993, 0x8f},
-	{0x4994, 0x01},
-	{0x4995, 0x4c},
-	{0x4996, 0x01},
-	{0x4997, 0x4d},
-	{0x4998, 0x01},
-	{0x4999, 0x1d},
-	{0x499a, 0x01},
-	{0x499b, 0x1d},
-	{0x499c, 0x01},
-	{0x499d, 0x0b},
-	{0x499e, 0x01},
-	{0x499f, 0x0b},
-	{0x49a0, 0x01},
-	{0x49a1, 0x18},
-	{0x49a2, 0x01},
-	{0x49a3, 0x16},
-	{0x49a4, 0x01},
-	{0x49a5, 0x40},
-	{0x49a6, 0x01},
-	{0x49a7, 0x3f},
-	{0x49a8, 0x01},
-	{0x49a9, 0x7c},
-	{0x49aa, 0x01},
-	{0x49ab, 0x77},
-	{0x49ac, 0x01},
-	{0x49ad, 0xcb},
-	{0x49ae, 0x01},
-	{0x49af, 0xc8},
-	{0x49b0, 0x02},
-	{0x49b1, 0x0a},
-	{0x49b2, 0x02},
-	{0x49b3, 0x0f},
-	{0x49b4, 0x01},
-	{0x49b5, 0xad},
-	{0x49b6, 0x01},
-	{0x49b7, 0xaf},
-	{0x49b8, 0x01},
-	{0x49b9, 0x74},
-	{0x49ba, 0x01},
-	{0x49bb, 0x73},
-	{0x49bc, 0x01},
-	{0x49bd, 0x49},
-	{0x49be, 0x01},
-	{0x49bf, 0x48},
-	{0x49c0, 0x01},
-	{0x49c1, 0x37},
-	{0x49c2, 0x01},
-	{0x49c3, 0x37},
-	{0x49c4, 0x01},
-	{0x49c5, 0x44},
-	{0x49c6, 0x01},
-	{0x49c7, 0x3f},
-	{0x49c8, 0x01},
-	{0x49c9, 0x68},
-	{0x49ca, 0x01},
-	{0x49cb, 0x65},
-	{0x49cc, 0x01},
-	{0x49cd, 0xa2},
-	{0x49ce, 0x01},
-	{0x49cf, 0x9d},
-	{0x49d0, 0x01},
-	{0x49d1, 0xf0},
-	{0x49d2, 0x01},
-	{0x49d3, 0xe6},
-	{0x49d4, 0x02},
-	{0x49d5, 0x4f},
-	{0x49d6, 0x02},
-	{0x49d7, 0x4c},
-	{0x49d8, 0x01},
-	{0x49d9, 0xf4},
-	{0x49da, 0x01},
-	{0x49db, 0xf8},
-	{0x49dc, 0x01},
-	{0x49dd, 0xb6},
-	{0x49de, 0x01},
-	{0x49df, 0xb4},
-	{0x49e0, 0x01},
-	{0x49e1, 0x90},
-	{0x49e2, 0x01},
-	{0x49e3, 0x91},
-	{0x49e4, 0x01},
-	{0x49e5, 0x7f},
-	{0x49e6, 0x01},
-	{0x49e7, 0x81},
-	{0x49e8, 0x01},
-	{0x49e9, 0x8a},
-	{0x49ea, 0x01},
-	{0x49eb, 0x88},
-	{0x49ec, 0x01},
-	{0x49ed, 0xa8},
-	{0x49ee, 0x01},
-	{0x49ef, 0xa9},
-	{0x49f0, 0x01},
-	{0x49f1, 0xde},
-	{0x49f2, 0x01},
-	{0x49f3, 0xd9},
-	{0x49f4, 0x02},
-	{0x49f5, 0x3b},
-	{0x49f6, 0x02},
-	{0x49f7, 0x30},
-	{0x3A63, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf imx135_snap_settings[] = {
-	/* Clock Setting	*/
-	{0x011E, 0x18},
-	{0x011F, 0x00},
-	{0x0301, 0x05},
-	{0x0303, 0x01},
-	{0x0305, 0x03},
-	{0x0309, 0x05},
-	{0x030B, 0x01},
-	{0x030C, 0x00},
-	{0x030D, 0x60},/*0x64*/
-	{0x030E, 0x01},
-	{0x3A06, 0x11},
-	/* Mode setting */
-	{0x0108, 0x03},
-	{0x0112, 0x0A},
-	{0x0113, 0x0A},
-	{0x0381, 0x01},
-	{0x0383, 0x01},
-	{0x0385, 0x01},
-	{0x0387, 0x01},
-	{0x0390, 0x00},
-	{0x0391, 0x11},
-	{0x0392, 0x00},
-	{0x0401, 0x00},
-	{0x0404, 0x00},
-	{0x0405, 0x10},
-	{0x4082, 0x01},
-	{0x4083, 0x01},
-	{0x7006, 0x04},
-	/* OptionalFunction setting */
-	{0x0700, 0x00},
-	{0x3A63, 0x00},
-	{0x4100, 0xF8},
-	{0x4203, 0xFF},
-	{0x4344, 0x00},
-	{0x441C, 0x01},
-	/* Size setting	*/
-	{0x0340, 0x0C},
-	{0x0341, 0x46},
-	{0x0342, 0x11},
-	{0x0343, 0xDC},
-	{0x0344, 0x00},
-	{0x0345, 0x00},
-	{0x0346, 0x00},
-	{0x0347, 0x00},
-	{0x0348, 0x10},
-	{0x0349, 0x6F},
-	{0x034A, 0x0C},
-	{0x034B, 0x2F},
-	{0x034C, 0x10},
-	{0x034D, 0x70},
-	{0x034E, 0x0C},
-	{0x034F, 0x30},
-	{0x0350, 0x00},
-	{0x0351, 0x00},
-	{0x0352, 0x00},
-	{0x0353, 0x00},
-	{0x0354, 0x10},
-	{0x0355, 0x70},
-	{0x0356, 0x0C},
-	{0x0357, 0x30},
-	{0x301D, 0x30},
-	{0x3310, 0x10},
-	{0x3311, 0x70},
-	{0x3312, 0x0C},
-	{0x3313, 0x30},
-	{0x331C, 0x01},
-	{0x331D, 0x68},
-	{0x4084, 0x00},
-	{0x4085, 0x00},
-	{0x4086, 0x00},
-	{0x4087, 0x00},
-	{0x4400, 0x00},
-	/* Global Timing Setting */
-	{0x0830, 0x7F},
-	{0x0831, 0x37},
-	{0x0832, 0x5F},
-	{0x0833, 0x37},
-	{0x0834, 0x37},
-	{0x0835, 0x3F},
-	{0x0836, 0xC7},
-	{0x0837, 0x3F},
-	{0x0839, 0x1F},
-	{0x083A, 0x17},
-	{0x083B, 0x02},
-	/* Integration Time Setting */
-	{0x0202, 0x0C},
-	{0x0203, 0x42},
-	/* Gain Setting	*/
-	{0x0205, 0x00},
-	{0x020E, 0x01},
-	{0x020F, 0x00},
-	{0x0210, 0x01},
-	{0x0211, 0x00},
-	{0x0212, 0x01},
-	{0x0213, 0x00},
-	{0x0214, 0x01},
-	{0x0215, 0x00},
-	/* HDR Setting */
-	{0x0230, 0x00},
-	{0x0231, 0x00},
-	{0x0233, 0x00},
-	{0x0234, 0x00},
-	{0x0235, 0x40},
-	{0x0238, 0x00},
-	{0x0239, 0x04},
-	{0x023B, 0x00},
-	{0x023C, 0x01},
-	{0x33B0, 0x04},
-	{0x33B1, 0x00},
-	{0x33B3, 0x00},
-	{0x33B4, 0x00},
-	{0x3800, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf imx135_hdr_settings[] = {
-	/* Clock Setting */
-	{0x011E, 0x18},
-	{0x011F, 0x00},
-	{0x0301, 0x05},
-	{0x0303, 0x01},
-	{0x0305, 0x03},
-	{0x0309, 0x05},
-	{0x030B, 0x02},
-	{0x030C, 0x00},
-	{0x030D, 0x71},
-	{0x030E, 0x01},
-	{0x3A06, 0x12},
-	/* Mode setting	*/
-	{0x0108, 0x03},
-	{0x0112, 0x0E},
-	{0x0113, 0x0A},
-	{0x0381, 0x01},
-	{0x0383, 0x01},
-	{0x0385, 0x01},
-	{0x0387, 0x01},
-	{0x0390, 0x00},
-	{0x0391, 0x11},
-	{0x0392, 0x00},
-	{0x0401, 0x00},
-	{0x0404, 0x00},
-	{0x0405, 0x10},
-	{0x4082, 0x01},
-	{0x4083, 0x01},
-	{0x7006, 0x04},
-	/* OptionnalFunction setting */
-	{0x0700, 0x01},
-	{0x3A63, 0x00},
-	{0x4100, 0xF8},
-	{0x4203, 0xFF},
-	{0x4344, 0x00},
-	{0x441C, 0x01},
-	/* Size setting	*/
-	{0x0340, 0x0C},
-	{0x0341, 0x48},
-	{0x0342, 0x11},
-	{0x0343, 0xDC},
-	{0x0344, 0x00},
-	{0x0345, 0x08},
-	{0x0346, 0x00},
-	{0x0347, 0x00},
-	{0x0348, 0x10},
-	{0x0349, 0x67},
-	{0x034A, 0x0C},
-	{0x034B, 0x2F},
-	{0x034C, 0x08},
-	{0x034D, 0x30},
-	{0x034E, 0x06},
-	{0x034F, 0x18},
-	{0x0350, 0x00},
-	{0x0351, 0x00},
-	{0x0352, 0x00},
-	{0x0353, 0x00},
-	{0x0354, 0x08},
-	{0x0355, 0x30},
-	{0x0356, 0x06},
-	{0x0357, 0x18},
-	{0x301D, 0x30},
-	{0x3310, 0x08},
-	{0x3311, 0x30},
-	{0x3312, 0x06},
-	{0x3313, 0x18},
-	{0x331C, 0x00},
-	{0x331D, 0x10},
-	{0x4084, 0x00},
-	{0x4085, 0x00},
-	{0x4086, 0x00},
-	{0x4087, 0x00},
-	{0x4400, 0x00},
-	/*Global Timing Setting	*/
-	{0x0830, 0x67},
-	{0x0831, 0x27},
-	{0x0832, 0x47},
-	{0x0833, 0x27},
-	{0x0834, 0x27},
-	{0x0835, 0x1F},
-	{0x0836, 0x87},
-	{0x0837, 0x2F},
-	{0x0839, 0x1F},
-	{0x083A, 0x17},
-	{0x083B, 0x02},
-	/*Integration Time Setting*/
-	{0x0202, 0x0C},
-	{0x0203, 0x44},
-	/*Gain Setting */
-	{0x0205, 0x00},
-	{0x020E, 0x01},
-	{0x020F, 0x00},
-	{0x0210, 0x01},
-	{0x0211, 0x00},
-	{0x0212, 0x01},
-	{0x0213, 0x00},
-	{0x0214, 0x01},
-	{0x0215, 0x00},
-	/* HDR Setting */
-	{0x0230, 0x00},
-	{0x0231, 0x00},
-	{0x0233, 0x00},
-	{0x0234, 0x00},
-	{0x0235, 0x40},
-	{0x0238, 0x01}, /*Direct 1 / Auto 0*/
-	{0x0239, 0x04},
-	{0x023B, 0x03},
-	{0x023C, 0x01},
-	{0x33B0, 0x08},
-	{0x33B1, 0x30},
-	{0x33B3, 0x01},
-	{0x33B4, 0x00},
-	{0x3800, 0x00},
-};
-
-static struct v4l2_subdev_info imx135_subdev_info[] = {
-	{
-	.code		= V4L2_MBUS_FMT_SBGGR10_1X10,
-	.colorspace	= V4L2_COLORSPACE_JPEG,
-	.fmt		= 1,
-	.order		= 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array imx135_init_conf[] = {
-	{&imx135_recommend_settings[0],
-	ARRAY_SIZE(imx135_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&imx135_LSCTable_settings[0],
-	ARRAY_SIZE(imx135_LSCTable_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array imx135_confs[] = {
-	{&imx135_snap_settings[0],
-	ARRAY_SIZE(imx135_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&imx135_prev_settings[0],
-	ARRAY_SIZE(imx135_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&imx135_hdr_settings[0],
-	ARRAY_SIZE(imx135_hdr_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t imx135_dimensions[] = {
-	/* RES0 snapshot(FULL SIZE) */
-	{
-		.x_output = 4208,
-		.y_output = 3120,
-		.line_length_pclk = 4572,
-		.frame_length_lines = 3142,
-		.vt_pixel_clk = 360000000,
-		.op_pixel_clk = 319680000,
-		.binning_factor = 1,
-	},
-	/* RES1 4:3 preview(1/2HV QTR SIZE) */
-	{
-		.x_output = 2104,
-		.y_output = 1560,
-		.line_length_pclk = 4572,
-		.frame_length_lines = 2624,
-		.vt_pixel_clk = 360000000,
-		.op_pixel_clk = 180000000,
-		.binning_factor = 1,
-	},
-	/* RES2 4:3 HDR movie mode */
-	{
-		.x_output = 2096,
-		.y_output = 1560,
-		.line_length_pclk = 4572,
-		.frame_length_lines = 3290,
-		.vt_pixel_clk = 360000000,
-		.op_pixel_clk = 180000000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_sensor_output_reg_addr_t imx135_reg_addr = {
-	.x_output = 0x34C,
-	.y_output = 0x34E,
-	.line_length_pclk = 0x342,
-	.frame_length_lines = 0x340,
-};
-
-static struct msm_sensor_id_info_t imx135_id_info = {
-	.sensor_id_reg_addr = 0x0000,
-	.sensor_id = 0x1210,
-};
-
-static struct msm_sensor_exp_gain_info_t imx135_exp_gain_info = {
-	.coarse_int_time_addr = 0x202,
-	.global_gain_addr = 0x205,
-	.vert_offset = 4,
-};
-
-static const struct i2c_device_id imx135_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&imx135_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver imx135_i2c_driver = {
-	.id_table = imx135_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client imx135_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	return i2c_add_driver(&imx135_i2c_driver);
-}
-
-static struct v4l2_subdev_core_ops imx135_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops imx135_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops imx135_subdev_ops = {
-	.core = &imx135_subdev_core_ops,
-	.video  = &imx135_subdev_video_ops,
-};
-
-int32_t imx135_write_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
-	uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
-{
-	uint32_t fl_lines;
-	uint8_t offset;
-	uint16_t shortshutter_gain = 0;
-	uint32_t shortshutter = 0;
-	uint16_t shortshutter_expratio = 8;
-
-	uint16_t atr_out_noise = 0;
-	uint16_t atr_out_mid = 0;
-
-	fl_lines = s_ctrl->curr_frame_length_lines;
-	fl_lines = (fl_lines * s_ctrl->fps_divider) / Q10;
-	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
-	if (line > (fl_lines - offset))
-		fl_lines = line + offset;
-	CDBG("%s luma_avg=%d\n", __func__, luma_avg);
-	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_output_reg_addr->frame_length_lines, fl_lines,
-		MSM_CAMERA_I2C_WORD_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr, line,
-		MSM_CAMERA_I2C_WORD_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* For video HDR mode */
-	if (s_ctrl->curr_res == MSM_SENSOR_RES_2) {
-		/* Short shutter update */
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			SHORT_GAIN_BYTE_ADDR, shortshutter_gain,
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-		shortshutter = (line * fgain) / (Q8 * shortshutter_expratio);
-		CDBG("longtshutter =%d, shortshutter=%d, longgain =%d\n",
-			line, shortshutter, gain);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			SHORT_SHUTTER_WORD_ADDR, shortshutter,
-			MSM_CAMERA_I2C_WORD_DATA);
-
-		/* Adaptive tone curve parameters update */
-		if (luma_avg < THRESHOLD_DEAD_ZONE) {
-			/* change to fixed tone curve */
-			msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-				TC_SWITCH_BYTE_ADDR, 0x01,
-				MSM_CAMERA_I2C_BYTE_DATA);
-		} else {
-			/* change to adaptive tone curve */
-			msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-					TC_SWITCH_BYTE_ADDR, 0x00,
-					MSM_CAMERA_I2C_BYTE_DATA);
-			if (luma_avg < THRESHOLD_0) {
-				atr_out_noise = 0;
-				atr_out_mid = 0;
-			} else if (luma_avg < THRESHOLD_1) {
-				atr_out_noise =
-					INIT_ATR_OUT_NOISE *
-					(luma_avg - THRESHOLD_0)/
-					(THRESHOLD_1 - THRESHOLD_0);
-				atr_out_mid = INIT_ATR_OUT_MID *
-					(luma_avg - THRESHOLD_0)/
-					(THRESHOLD_1 - THRESHOLD_0);
-			} else {
-				atr_out_noise = INIT_ATR_OUT_NOISE;
-				atr_out_mid = INIT_ATR_OUT_MID;
-			}
-			atr_out_noise += ATR_OFFSET;
-			atr_out_mid += ATR_OFFSET;
-			msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-				TC_OUT_NOISE_WORD_ADDR, atr_out_noise,
-				MSM_CAMERA_I2C_WORD_DATA);
-			msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-				TC_OUT_MID_WORD_ADDR, atr_out_mid,
-				MSM_CAMERA_I2C_WORD_DATA);
-		}
-	}
-
-	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	return 0;
-}
-
-int32_t imx135_hdr_update(struct msm_sensor_ctrl_t *s_ctrl,
-	struct sensor_hdr_update_parm_t *update_parm)
-{
-	int i;
-	switch (update_parm->type) {
-	case SENSOR_HDR_UPDATE_AWB:
-		CDBG("%s: SENSOR_HDR_UPDATE_AWB\n", __func__);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			ABS_GAIN_R_WORD_ADDR, update_parm->awb_gain_r,
-			MSM_CAMERA_I2C_WORD_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			ABS_GAIN_B_WORD_ADDR, update_parm->awb_gain_b,
-			MSM_CAMERA_I2C_WORD_DATA);
-		CDBG("%s: awb gains updated r=0x%x, b=0x%x\n", __func__,
-			 update_parm->awb_gain_r, update_parm->awb_gain_b);
-		break;
-	case SENSOR_HDR_UPDATE_LSC:
-		/* step1: write knot points to LSC table */
-		for (i = 0; i < LSC_TABLE_LEN_BYTES; i++) {
-			CDBG("lsc[%d] = %x\n", i, update_parm->lsc_table[i]);
-			msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-				LSC_TABLE_START_ADDR + i,
-				update_parm->lsc_table[i],
-				MSM_CAMERA_I2C_BYTE_DATA);
-		}
-		/* step2: LSC enable */
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			EN_LSC_BYTE_ADDR, 0x1F, MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			LSC_ENABLE_BYTE_ADDR, 0x01, MSM_CAMERA_I2C_BYTE_DATA);
-		/* step3: RAM_SEL_TOGGLE */
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			RAM_SEL_TOGGLE_BYTE_ADDR, 0x01,
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-		CDBG("%s: lsc table updated\n", __func__);
-		break;
-	default:
-		pr_err("%s: invalid HDR update type %d\n",
-			   __func__, update_parm->type);
-		return -EINVAL;
-	}
-	return 0;
-}
-
-static struct msm_sensor_fn_t imx135_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = imx135_write_exp_gain,
-	.sensor_write_snapshot_exp_gain = imx135_write_exp_gain,
-	.sensor_setting = msm_sensor_setting,
-	.sensor_csi_setting = msm_sensor_setting1,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-	.sensor_adjust_frame_lines = msm_sensor_adjust_frame_lines1,
-	.sensor_get_csi_params = msm_sensor_get_csi_params,
-	.sensor_hdr_update = imx135_hdr_update,
-};
-
-static struct msm_sensor_reg_t imx135_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = imx135_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(imx135_start_settings),
-	.stop_stream_conf = imx135_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(imx135_stop_settings),
-	.group_hold_on_conf = imx135_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(imx135_groupon_settings),
-	.group_hold_off_conf = imx135_groupoff_settings,
-	.group_hold_off_conf_size =
-		ARRAY_SIZE(imx135_groupoff_settings),
-	.init_settings = &imx135_init_conf[0],
-	.init_size = ARRAY_SIZE(imx135_init_conf),
-	.mode_settings = &imx135_confs[0],
-	.output_settings = &imx135_dimensions[0],
-	.num_conf = ARRAY_SIZE(imx135_confs),
-};
-
-static struct msm_sensor_ctrl_t imx135_s_ctrl = {
-	.msm_sensor_reg = &imx135_regs,
-	.sensor_i2c_client = &imx135_sensor_i2c_client,
-	.sensor_i2c_addr = 0x20,
-	.sensor_output_reg_addr = &imx135_reg_addr,
-	.sensor_id_info = &imx135_id_info,
-	.sensor_exp_gain_info = &imx135_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &imx135_mut,
-	.sensor_i2c_driver = &imx135_i2c_driver,
-	.sensor_v4l2_subdev_info = imx135_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(imx135_subdev_info),
-	.sensor_v4l2_subdev_ops = &imx135_subdev_ops,
-	.func_tbl = &imx135_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Sony 13MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/imx175_2lane_v4l2.c b/drivers/media/video/msm/sensors/imx175_2lane_v4l2.c
new file mode 100644
index 0000000..78e7ad6
--- /dev/null
+++ b/drivers/media/video/msm/sensors/imx175_2lane_v4l2.c
@@ -0,0 +1,1252 @@
+#include "msm_sensor.h"
+
+#ifdef CONFIG_RAWCHIP
+#include "rawchip/rawchip.h"
+#endif
+
+#define SENSOR_NAME "imx175"
+#define PLATFORM_DRIVER_NAME "msm_camera_imx175"
+#define imx175_obj imx175_##obj
+
+#define IMX175_REG_SW_RESET 0x0103
+
+#define IMX175_REG_READ_MODE 0x0101
+#define IMX175_READ_NORMAL_MODE 0x0000	
+#define IMX175_READ_MIRROR 0x0001			
+#define IMX175_READ_FLIP 0x0002			
+#define IMX175_READ_MIRROR_FLIP 0x0003	
+
+#define REG_DIGITAL_GAIN_GREEN_R 0x020E
+#define REG_DIGITAL_GAIN_RED 0x0210
+#define REG_DIGITAL_GAIN_BLUE 0x0212
+#define REG_DIGITAL_GAIN_GREEN_B 0x0214
+
+DEFINE_MUTEX(imx175_mut);
+DEFINE_MUTEX(imx175_sensor_init_mut);
+static struct msm_sensor_ctrl_t imx175_s_ctrl;
+
+static struct msm_camera_i2c_reg_conf imx175_start_settings[] = {
+	{0x0100, 0x01},
+};
+
+static struct msm_camera_i2c_reg_conf imx175_stop_settings[] = {
+	{0x0100, 0x00},
+};
+
+static struct msm_camera_i2c_reg_conf imx175_groupon_settings[] = {
+	{0x104, 0x01},
+};
+
+static struct msm_camera_i2c_reg_conf imx175_groupoff_settings[] = {
+	{0x104, 0x00},
+};
+
+static struct msm_camera_i2c_reg_conf imx175_mipi_settings[] = {
+	{0x3020, 0x10},
+	{0x302D, 0x03},
+	{0x302F, 0x80},
+	{0x3032, 0xA3},
+	{0x3033, 0x20},
+	{0x3034, 0x24},
+	{0x3041, 0x15},
+	{0x3042, 0x87},
+	{0x3050, 0x35},
+	{0x3056, 0x57},
+	{0x305D, 0x41},
+	{0x3097, 0x69},
+	{0x3109, 0x41},
+	{0x3148, 0x3F},
+	{0x330F, 0x07},
+	{0x4100, 0x0E},
+	{0x4104, 0x32},
+	{0x4105, 0x32},
+	{0x4108, 0x01},
+	{0x4109, 0x7C},
+	{0x410A, 0x00},
+	{0x410B, 0x00},
+};
+
+static struct msm_camera_i2c_reg_conf imx175_pll_settings[] = {
+	
+	{0x030C, 0x00}, 
+	{0x030D, 0xDD}, 
+	{0x0301, 0x0A}, 
+	{0x0303, 0x01}, 
+	{0x0305, 0x06}, 
+	{0x0309, 0x0A}, 
+	{0x030B, 0x01}, 
+	{0x3368, 0x18}, 
+	{0x3369, 0x00},
+	{0x3344, 0x6F},
+	{0x3345, 0x1F},
+	{0x3370, 0x7F},
+	{0x3371, 0x37},
+	{0x3372, 0x67},
+	{0x3373, 0x3F},
+	{0x3374, 0x3F},
+	{0x3375, 0x47},
+	{0x3376, 0xCF},
+	{0x3377, 0x47},
+};
+
+static struct msm_camera_i2c_reg_conf imx175_prev_settings[] = {
+	
+	{0x030C, 0x00}, 
+	{0x030D, 0xA4}, 
+	{0x0301, 0x0A}, 
+	{0x0303, 0x01}, 
+	{0x0305, 0x06}, 
+	{0x0309, 0x0A}, 
+	{0x030B, 0x01}, 
+	{0x3368, 0x18}, 
+	{0x3369, 0x00},
+	{0x3344, 0x57},
+	{0x3345, 0x1F},
+	{0x3370, 0x77},
+	{0x3371, 0x2F},
+	{0x3372, 0x4F},
+	{0x3373, 0x2F},
+	{0x3374, 0x2F},
+	{0x3375, 0x37},
+	{0x3376, 0x9F},
+	{0x3377, 0x37},
+	
+	{0x0340, 0x04}, 
+	{0x0341, 0xF4},
+	{0x0342, 0x0D}, 
+	{0x0343, 0x70},
+	{0x0344, 0x00}, 
+	{0x0345, 0x00},
+	{0x0346, 0x00}, 
+	{0x0347, 0x00},
+	{0x0348, 0x0C}, 
+	{0x0349, 0xCF},
+	{0x034A, 0x09}, 
+	{0x034B, 0x9F},
+	{0x034C, 0x06}, 
+	{0x034D, 0x68},
+	{0x034E, 0x04}, 
+	{0x034F, 0xD0},
+	{0x33D4, 0x06},
+	{0x33D5, 0x68},
+	{0x33D6, 0x04},
+	{0x33D7, 0xD0},
+	{0x3013, 0x04},
+	{0x30B0, 0x32},
+	{0x30D0, 0x00},
+	{0x0390, 0x01}, 
+	{0x0401, 0x00}, 
+	{0x0405, 0x10}, 
+	{0x33C8, 0x00},
+	{0x3364, 0x02}, 
+	{0x0202, 0x04}, 
+	{0x0203, 0xF0},
+	{0x0387, 0x01}, 
+};
+
+static struct msm_camera_i2c_reg_conf imx175_video_settings[] = {
+	
+	{0x030C, 0x00}, 
+	{0x030D, 0xDD}, 
+	{0x0301, 0x0A}, 
+	{0x0303, 0x01}, 
+	{0x0305, 0x06}, 
+	{0x0309, 0x0A}, 
+	{0x030B, 0x01}, 
+	{0x3368, 0x18}, 
+	{0x3369, 0x00},
+	{0x3344, 0x6F},
+	{0x3345, 0x1F},
+	{0x3370, 0x7F},
+	{0x3371, 0x37},
+	{0x3372, 0x67},
+	{0x3373, 0x3F},
+	{0x3374, 0x3F},
+	{0x3375, 0x47},
+	{0x3376, 0xCF},
+	{0x3377, 0x47},
+	
+	{0x0340, 0x06}, 
+	{0x0341, 0xEC},
+	{0x0342, 0x0D}, 
+	{0x0343, 0x70},
+	{0x0344, 0x00}, 
+	{0x0345, 0x62},
+	{0x0346, 0x01}, 
+	{0x0347, 0x6C},
+	{0x0348, 0x0C}, 
+	{0x0349, 0x6D},
+	{0x034A, 0x08}, 
+	{0x034B, 0x33},
+	{0x034C, 0x0C}, 
+	{0x034D, 0x0C},
+	{0x034E, 0x06}, 
+	{0x034F, 0xC8},
+	{0x33D4, 0x0C},
+	{0x33D5, 0x0C},
+	{0x33D6, 0x06},
+	{0x33D7, 0xC8},
+	{0x3013, 0x04},
+	{0x30B0, 0x32},
+	{0x30D0, 0x00},
+	{0x0390, 0x00}, 
+	{0x0401, 0x00}, 
+	{0x0405, 0x10}, 
+	{0x33C8, 0x00},
+	{0x3364, 0x02}, 
+	{0x0202, 0x06}, 
+	{0x0203, 0xE8},
+	{0x0387, 0x01}, 
+};
+
+static struct msm_camera_i2c_reg_conf imx175_fast_video_settings[] = {
+	
+	{0x030C, 0x00}, 
+	{0x030D, 0xDD}, 
+	{0x0301, 0x09}, 
+	{0x0303, 0x01}, 
+	{0x0305, 0x06}, 
+	{0x0309, 0x0A}, 
+	{0x030B, 0x01}, 
+	{0x3368, 0x18}, 
+	{0x3369, 0x00},
+	{0x3344, 0x6F},
+	{0x3345, 0x1F},
+	{0x3370, 0x7F},
+	{0x3371, 0x37},
+	{0x3372, 0x67},
+	{0x3373, 0x3F},
+	{0x3374, 0x3F},
+	{0x3375, 0x47},
+	{0x3376, 0xCF},
+	{0x3377, 0x47},
+	
+	{0x0340, 0x02}, 
+	{0x0341, 0x22},
+	{0x0342, 0x0E}, 
+	{0x0343, 0x0C},
+	{0x0344, 0x00}, 
+	{0x0345, 0x00},
+	{0x0346, 0x00}, 
+	{0x0347, 0xD4},
+	{0x0348, 0x0C}, 
+	{0x0349, 0xCF},
+	{0x034A, 0x08}, 
+	{0x034B, 0xCB},
+	{0x034C, 0x06}, 
+	{0x034D, 0x68},
+	{0x034E, 0x01}, 
+	{0x034F, 0xFE},
+	{0x33D4, 0x06},
+	{0x33D5, 0x68},
+	{0x33D6, 0x01},
+	{0x33D7, 0xFE},
+	{0x3013, 0x04},
+	{0x30B0, 0x32},
+	{0x30D0, 0x00},
+	{0x0390, 0x01}, 
+	{0x0401, 0x00}, 
+	{0x0405, 0x10}, 
+	{0x33C8, 0x00},
+	{0x3364, 0x02}, 
+	{0x0202, 0x02}, 
+	{0x0203, 0x1E},
+	{0x0387, 0x03}, 
+};
+
+static struct msm_camera_i2c_reg_conf imx175_snap_settings[] = {
+	
+	{0x030C, 0x00}, 
+	{0x030D, 0xDD}, 
+	{0x0301, 0x0A}, 
+	{0x0303, 0x01}, 
+	{0x0305, 0x06}, 
+	{0x0309, 0x0A}, 
+	{0x030B, 0x01}, 
+	{0x3368, 0x18}, 
+	{0x3369, 0x00},
+	{0x3344, 0x6F},
+	{0x3345, 0x1F},
+	{0x3370, 0x7F},
+	{0x3371, 0x37},
+	{0x3372, 0x67},
+	{0x3373, 0x3F},
+	{0x3374, 0x3F},
+	{0x3375, 0x47},
+	{0x3376, 0xCF},
+	{0x3377, 0x47},
+	
+	{0x0340, 0x09}, 
+	{0x0341, 0xC4},
+	{0x0342, 0x0D}, 
+	{0x0343, 0x70},
+	{0x0344, 0x00}, 
+	{0x0345, 0x00},
+	{0x0346, 0x00}, 
+	{0x0347, 0x00},
+	{0x0348, 0x0C}, 
+	{0x0349, 0xCF},
+	{0x034A, 0x09}, 
+	{0x034B, 0x9F},
+	{0x034C, 0x0C}, 
+	{0x034D, 0xD0},
+	{0x034E, 0x09}, 
+	{0x034F, 0xA0},
+	{0x33D4, 0x0C},
+	{0x33D5, 0xD0},
+	{0x33D6, 0x09},
+	{0x33D7, 0xA0},
+	{0x3013, 0x04},
+	{0x30B0, 0x32},
+	{0x30D0, 0x00},
+	{0x0390, 0x00}, 
+	{0x0401, 0x00}, 
+	{0x0405, 0x10}, 
+	{0x33C8, 0x00},
+	{0x3364, 0x02}, 
+	{0x0202, 0x09}, 
+	{0x0203, 0xC0},
+	{0x0387, 0x01}, 
+};
+
+static struct msm_camera_i2c_reg_conf imx175_snap_wide_settings[] = {
+	
+	{0x030C, 0x00}, 
+	{0x030D, 0xB4}, 
+	{0x0301, 0x0A}, 
+	{0x0303, 0x01}, 
+	{0x0305, 0x06}, 
+	{0x0309, 0x0A}, 
+	{0x030B, 0x01}, 
+	{0x3368, 0x18}, 
+	{0x3369, 0x00},
+	{0x3344, 0x5F},
+	{0x3345, 0x1F},
+	{0x3370, 0x77},
+	{0x3371, 0x2F},
+	{0x3372, 0x5F},
+	{0x3373, 0x37},
+	{0x3374, 0x37},
+	{0x3375, 0x37},
+	{0x3376, 0xB7},
+	{0x3377, 0x3F},
+	
+	{0x0340, 0x07}, 
+	{0x0341, 0x64},
+	{0x0342, 0x0D}, 
+	{0x0343, 0x70},
+	{0x0344, 0x00}, 
+	{0x0345, 0x00},
+	{0x0346, 0x01}, 
+	{0x0347, 0x30},
+	{0x0348, 0x0C}, 
+	{0x0349, 0xCF},
+	{0x034A, 0x08}, 
+	{0x034B, 0x6F},
+	{0x034C, 0x0C}, 
+	{0x034D, 0xD0},
+	{0x034E, 0x07}, 
+	{0x034F, 0x40},
+	{0x33D4, 0x0C},
+	{0x33D5, 0xD0},
+	{0x33D6, 0x07},
+	{0x33D7, 0x40},
+	{0x3013, 0x04},
+	{0x30B0, 0x32},
+	{0x30D0, 0x00},
+	{0x0390, 0x00}, 
+	{0x0401, 0x00}, 
+	{0x0405, 0x10}, 
+	{0x33C8, 0x00},
+	{0x3364, 0x02}, 
+	{0x0202, 0x07}, 
+	{0x0203, 0x60},
+	{0x0387, 0x01}, 
+};
+
+ 
+ static struct msm_camera_i2c_reg_conf imx175_night_settings[] = {
+	
+	{0x030C, 0x00}, 
+	{0x030D, 0xDD}, 
+	{0x0301, 0x0A}, 
+	{0x0303, 0x01}, 
+	{0x0305, 0x06}, 
+	{0x0309, 0x0A}, 
+	{0x030B, 0x01}, 
+	{0x3368, 0x18}, 
+	{0x3369, 0x00},
+	{0x3344, 0x6F},
+	{0x3345, 0x1F},
+	{0x3370, 0x7F},
+	{0x3371, 0x37},
+	{0x3372, 0x67},
+	{0x3373, 0x3F},
+	{0x3374, 0x3F},
+	{0x3375, 0x47},
+	{0x3376, 0xCF},
+	{0x3377, 0x47},
+	
+	{0x0340, 0x09}, 
+	{0x0341, 0xC4},
+	{0x0342, 0x0D}, 
+	{0x0343, 0x70},
+	{0x0344, 0x00}, 
+	{0x0345, 0x00},
+	{0x0346, 0x00}, 
+	{0x0347, 0x00},
+	{0x0348, 0x0C}, 
+	{0x0349, 0xCF},
+	{0x034A, 0x09}, 
+	{0x034B, 0x9F},
+	{0x034C, 0x0C}, 
+	{0x034D, 0xD0},
+	{0x034E, 0x09}, 
+	{0x034F, 0xA0},
+	{0x33D4, 0x0C},
+	{0x33D5, 0xD0},
+	{0x33D6, 0x09},
+	{0x33D7, 0xA0},
+	{0x3013, 0x04},
+	{0x30B0, 0x32},
+	{0x30D0, 0x00},
+	{0x0390, 0x00}, 
+	{0x0401, 0x00}, 
+	{0x0405, 0x10}, 
+	{0x33C8, 0x00},
+	{0x3364, 0x02}, 
+	{0x0202, 0x09}, 
+	{0x0203, 0xC0},
+	{0x0387, 0x01}, 
+};
+
+static struct msm_camera_i2c_reg_conf imx175_recommend_settings[] = {
+};
+
+static struct v4l2_subdev_info imx175_subdev_info[] = {
+	{
+	.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
+	.colorspace = V4L2_COLORSPACE_JPEG,
+	.fmt    = 1,
+	.order    = 0,
+	},
+	
+};
+
+static struct msm_camera_i2c_conf_array imx175_init_conf[] = {
+	{&imx175_mipi_settings[0],
+	ARRAY_SIZE(imx175_mipi_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx175_recommend_settings[0],
+	ARRAY_SIZE(imx175_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx175_pll_settings[0],
+	ARRAY_SIZE(imx175_pll_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+};
+
+static struct msm_camera_i2c_conf_array imx175_confs[] = {
+	{&imx175_snap_settings[0],
+	ARRAY_SIZE(imx175_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx175_prev_settings[0],
+	ARRAY_SIZE(imx175_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx175_video_settings[0],
+	ARRAY_SIZE(imx175_video_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx175_fast_video_settings[0],
+	ARRAY_SIZE(imx175_fast_video_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx175_snap_wide_settings[0],
+	ARRAY_SIZE(imx175_snap_wide_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&imx175_night_settings[0],
+	ARRAY_SIZE(imx175_night_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+};
+
+static struct msm_sensor_output_info_t imx175_dimensions[] = {
+	{
+		.x_output = 0xCD0,
+		.y_output = 0x9A0,
+		.line_length_pclk = 0xD70,
+		.frame_length_lines = 0x9C4,
+		.vt_pixel_clk = 176800000,
+		.op_pixel_clk = 176800000,
+		.binning_factor = 1,
+		.x_addr_start = 0,
+		.y_addr_start = 0,
+		.x_addr_end = 0xCCF,
+		.y_addr_end = 0x99F,
+		.x_even_inc = 1,
+		.x_odd_inc = 1,
+		.y_even_inc = 1,
+		.y_odd_inc = 1,
+		.binning_rawchip = 0x11,
+	},
+	{
+		.x_output = 0x668,
+		.y_output = 0x4D0,
+		.line_length_pclk = 0xD70,
+		.frame_length_lines = 0x4F4,
+		.vt_pixel_clk = 131200000,
+		.op_pixel_clk = 131200000,
+		.binning_factor = 1,
+		.x_addr_start = 0,
+		.y_addr_start = 0,
+		.x_addr_end = 0xCCF,
+		.y_addr_end = 0x99F,
+		.x_even_inc = 1,
+		.x_odd_inc = 3,
+		.y_even_inc = 1,
+		.y_odd_inc = 3,
+		.binning_rawchip = 0x22,
+	},
+	{
+		.x_output = 0xC0C,
+		.y_output = 0x6C8,
+		.line_length_pclk = 0xD70,
+		.frame_length_lines = 0x6EC,
+		.vt_pixel_clk = 176800000,
+		.op_pixel_clk = 176800000,
+		.binning_factor = 1,
+		.x_addr_start = 0x62,
+		.y_addr_start = 0x16C,
+		.x_addr_end = 0xC6D,
+		.y_addr_end = 0x833,
+		.x_even_inc = 1,
+		.x_odd_inc = 1,
+		.y_even_inc = 1,
+		.y_odd_inc = 1,
+		.binning_rawchip = 0x11,
+	},
+	{
+		.x_output = 0x668,
+		.y_output = 0x1FE,
+		.line_length_pclk = 0xE0C,
+		.frame_length_lines = 0x222,
+		.vt_pixel_clk = 176800000,
+		.op_pixel_clk = 176800000,
+		.binning_factor = 1,
+		.x_addr_start = 0,
+		.y_addr_start = 0xD4,
+		.x_addr_end = 0xCCF,
+		.y_addr_end = 0x8CB,
+		.x_even_inc = 1,
+		.x_odd_inc = 3,
+		.y_even_inc = 1,
+		.y_odd_inc = 7,
+		.binning_rawchip = 0x22, 
+	},
+	{
+		.x_output = 0xCD0,
+		.y_output = 0x740,
+		.line_length_pclk = 0xD70,
+		.frame_length_lines = 0x764,
+		.vt_pixel_clk = 144000000,
+		.op_pixel_clk = 144000000,
+		.binning_factor = 1,
+		.x_addr_start = 0,
+		.y_addr_start = 0x130,
+		.x_addr_end = 0xCCF,
+		.y_addr_end = 0x86F,
+		.x_even_inc = 1,
+		.x_odd_inc = 1,
+		.y_even_inc = 1,
+		.y_odd_inc = 1,
+		.binning_rawchip = 0x11,
+	},
+	{ 
+		.x_output = 0xCD0,
+		.y_output = 0x9A0,
+		.line_length_pclk = 0xD70,
+		.frame_length_lines = 0x9C4,
+		.vt_pixel_clk = 176800000,
+		.op_pixel_clk = 176800000,
+		.binning_factor = 1,
+		.x_addr_start = 0,
+		.y_addr_start = 0,
+		.x_addr_end = 0xCCF,
+		.y_addr_end = 0x99F,
+		.x_even_inc = 1,
+		.x_odd_inc = 1,
+		.y_even_inc = 1,
+		.y_odd_inc = 1,
+		.binning_rawchip = 0x11,
+	},
+};
+
+static struct msm_camera_csid_vc_cfg imx175_cid_cfg[] = {
+	{0, CSI_RAW10, CSI_DECODE_10BIT},
+	{1, CSI_EMBED_DATA, CSI_DECODE_8BIT},
+};
+
+static struct msm_camera_csi2_params imx175_csi_params = {
+	.csid_params = {
+		.lane_assign = 0xe4,
+		.lane_cnt = 2,
+		.lut_params = {
+			.num_cid = 2,
+			.vc_cfg = imx175_cid_cfg,
+		},
+	},
+	.csiphy_params = {
+		.lane_cnt = 2,
+		.settle_cnt = 0x1B,
+	},
+};
+
+static struct msm_camera_csi2_params *imx175_csi_params_array[] = {
+	&imx175_csi_params,
+	&imx175_csi_params,
+	&imx175_csi_params,
+	&imx175_csi_params,
+	&imx175_csi_params,
+	&imx175_csi_params
+};
+
+static struct msm_sensor_output_reg_addr_t imx175_reg_addr = {
+	.x_output = 0x34C,
+	.y_output = 0x34E,
+	.line_length_pclk = 0x342,
+	.frame_length_lines = 0x340,
+};
+
+static struct msm_sensor_id_info_t imx175_id_info = {
+	.sensor_id_reg_addr = 0x0,
+	.sensor_id = 0x0175,
+};
+
+static struct msm_sensor_exp_gain_info_t imx175_exp_gain_info = {
+	.coarse_int_time_addr = 0x202,
+	.global_gain_addr = 0x204,
+	.vert_offset = 4,
+	.min_vert = 4,  
+	.sensor_max_linecount = 65531,  
+};
+
+int32_t imx175_set_dig_gain(struct msm_sensor_ctrl_t *s_ctrl, uint16_t dig_gain)
+{
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		REG_DIGITAL_GAIN_GREEN_R, dig_gain,
+		MSM_CAMERA_I2C_WORD_DATA);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		REG_DIGITAL_GAIN_RED, dig_gain,
+		MSM_CAMERA_I2C_WORD_DATA);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		REG_DIGITAL_GAIN_BLUE, dig_gain,
+		MSM_CAMERA_I2C_WORD_DATA);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		REG_DIGITAL_GAIN_GREEN_B, dig_gain,
+		MSM_CAMERA_I2C_WORD_DATA);
+
+	return 0;
+}
+
+#if 0
+static uint32_t vcm_clib;
+static uint16_t vcm_clib_min,vcm_clib_med,vcm_clib_max;
+
+static int imx175_read_vcm_clib(struct sensor_cfg_data *cdata, struct msm_sensor_ctrl_t *s_ctrl)
+{
+	uint8_t rc=0;
+	unsigned short info_value = 0;
+
+	struct msm_camera_i2c_client *imx175_msm_camera_i2c_client = s_ctrl->sensor_i2c_client;
+
+	vcm_clib =0;
+	vcm_clib_min = 0;
+	vcm_clib_med = 0;
+	vcm_clib_max = 0;
+
+	pr_info("%s: sensor OTP information:\n", __func__);
+
+	
+	rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x3A1C, 0x00);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x3A1C fail\n", __func__);
+
+	
+	rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A00, 0x04);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A00 (Start) fail\n", __func__);
+
+	mdelay(4);
+
+	vcm_clib =0;
+	rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A02, 5);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, 5);
+			
+	rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A00, 0x01);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__);
+
+ 	rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A04), &info_value);
+	if (rc < 0)
+		pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04));
+	else
+		{
+		pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+		vcm_clib = (vcm_clib << 8) | info_value;
+		}
+ 	rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A05), &info_value);
+	if (rc < 0)
+		pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A05));
+	else
+		{
+		pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+		vcm_clib = (vcm_clib << 8) | info_value;
+		}
+
+	
+	if(vcm_clib >> 8 == 0x03)
+		{
+		  uint32_t p;
+
+		  rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A0C), &info_value);
+		  if (rc < 0)
+			  pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A0C));
+		  else
+			  {
+			  pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+			  vcm_clib = (vcm_clib << 8) | info_value;
+			  }
+		  rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A0D), &info_value);
+		  if (rc < 0)
+			  pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A0D));
+		  else
+			  {
+			  pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+			  vcm_clib = (vcm_clib << 8) | info_value;
+			  }
+
+		  p=((vcm_clib & 0x0000FFFF) ) >> 3 ;
+		  vcm_clib_min= p - 20;
+		  vcm_clib_max= p + 26;
+		  vcm_clib_med= (vcm_clib_max + vcm_clib_min)/2 -26/4;
+		  pr_info("%s: VCM clib=0x%x, [Sharp] (p=%d) min/med/max=%d %d %d\n"
+			  , __func__, vcm_clib, p, vcm_clib_min, vcm_clib_med, vcm_clib_max);
+		}
+	else
+		{
+    		vcm_clib =0;
+    		rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A02, 16);
+    		if (rc < 0)
+    			pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, 16);
+    				
+    		rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A00, 0x01);
+    		if (rc < 0)
+    			pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__);
+    		
+    		rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A04), &info_value);
+    		if (rc < 0)
+    			pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04));
+    		else
+    			{
+    			pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+    			vcm_clib = (vcm_clib << 8) | info_value;
+    			}
+    		rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A05), &info_value);
+    		if (rc < 0)
+    			pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A05));
+    		else
+    			{
+    			pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+    			vcm_clib = (vcm_clib << 8) | info_value;
+    			}
+    
+    		if(vcm_clib >> 8 == 0x04)
+    		{
+    		  uint32_t p;
+    
+    		  rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A0E), &info_value);
+    		  if (rc < 0)
+    			  pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A0E));
+    		  else
+    			  {
+    			  pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+    			  vcm_clib = (vcm_clib << 16) | info_value;
+    			  }
+    
+    		  p=((vcm_clib & 0x000000FF) + 0x00000080) >> 3 ;
+    		  vcm_clib_min= p - 20;
+    		  vcm_clib_max= p + 26;
+    		  vcm_clib_med= (vcm_clib_max + vcm_clib_min)/2 -26/4;
+			  pr_info("%s: VCM clib=0x%x, [Lite-On] (p=%d) min/med/max=%d %d %d\n"
+				  , __func__, vcm_clib, p, vcm_clib_min, vcm_clib_med, vcm_clib_max);
+    		}
+		}
+	if(((vcm_clib & 0x0000FFFF) == 0x0000) || (vcm_clib_min==0 && vcm_clib_med==0 && vcm_clib_max==0)
+		||(
+		     (DEFAULT_VCM_MAX < vcm_clib_max) || (DEFAULT_VCM_MAX < vcm_clib_med) || (DEFAULT_VCM_MAX < vcm_clib_min)
+		  || (DEFAULT_VCM_MIN > vcm_clib_max) || (DEFAULT_VCM_MIN > vcm_clib_med) || (DEFAULT_VCM_MIN > vcm_clib_min)
+		  || ((vcm_clib_med < vcm_clib_min) || (vcm_clib_med > vcm_clib_max))
+		))
+		{
+		  vcm_clib_min=DEFAULT_VCM_MIN;
+		  vcm_clib_med=DEFAULT_VCM_MED;
+		  vcm_clib_max=DEFAULT_VCM_MAX;
+		}
+
+    cdata->cfg.calib_vcm_pos.min=vcm_clib_min;
+    cdata->cfg.calib_vcm_pos.med=vcm_clib_med;
+    cdata->cfg.calib_vcm_pos.max=vcm_clib_max;
+
+	pr_info("%s: VCM clib=0x%x, min/med/max=%d %d %d\n"
+		, __func__, vcm_clib, cdata->cfg.calib_vcm_pos.min, cdata->cfg.calib_vcm_pos.med, cdata->cfg.calib_vcm_pos.max);
+
+	return 0;
+
+}
+#endif
+
+static int lens_info;	
+
+static void imx175_read_lens_info(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	lens_info = 6;	
+
+#if 0
+	int32_t  rc;
+	int page = 0;
+	unsigned short info_value = 0, info_index = 0;
+	unsigned short  OTP[10] = {0};
+	struct msm_camera_i2c_client *imx175_msm_camera_i2c_client = s_ctrl->sensor_i2c_client;
+
+	lens_info = 6;	
+
+	pr_info("[CAM]%s\n", __func__);
+	pr_info("%s: sensor OTP information:\n", __func__);
+
+	
+	rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x3A1C, 0x00);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x3A1C fail\n", __func__);
+
+	
+	rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A00, 0x04);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A00 (Start) fail\n", __func__);
+
+	mdelay(4);
+
+	
+	info_index = 1;
+	info_value = 0;
+	memset(OTP, 0, sizeof(OTP));
+
+	for (page = 20; page >= 16; page--) {
+		rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A02, page);
+		if (rc < 0)
+			pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, page);
+
+		
+		rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A00, 0x01);
+		if (rc < 0)
+			pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__);
+
+		
+		rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A04 + info_index), &info_value);
+		if (rc < 0)
+			pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04 + info_index));
+
+		 
+		if (((info_value&0x0F) != 0) || page == 0)
+			break;
+	}
+	OTP[info_index] = (short)(info_value&0x0F);
+
+	if (OTP[1] != 0) {
+		pr_info("Get Fuseid from Page20 to Page16\n");
+		goto get_done;
+	}
+
+	
+	info_index = 1;
+	info_value = 0;
+	memset(OTP, 0, sizeof(OTP));
+
+	for (page = 4; page >= 0; page--) {
+		rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A02, page);
+		if (rc < 0)
+			pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, page);
+
+		
+		rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A00, 0x01);
+		if (rc < 0)
+			pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__);
+
+		
+		rc = msm_camera_i2c_read_b(imx175_msm_camera_i2c_client, (0x0A04 + info_index), &info_value);
+		if (rc < 0)
+			pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04 + info_index));
+
+		 
+		if (((info_value & 0x0F) != 0) || page == 0)
+			break;
+	}
+	OTP[info_index] = (short)(info_value&0x0F);
+
+get_done:
+	
+	rc = msm_camera_i2c_write_b(imx175_msm_camera_i2c_client, 0x0A00, 0x00);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A00 (Stop) fail\n", __func__);
+
+	pr_info("%s: LensID=%x\n", __func__, OTP[1]);
+
+	if (OTP[1] == 5)	
+		lens_info = OTP[1];
+#endif
+
+	return;
+}
+
+
+static int imx175_sensor_open_init(const struct msm_camera_sensor_info *data)
+{
+	int rc = 0;
+	pr_info("%s called\n", __func__);
+
+	if (data->sensor_platform_info)
+		imx175_s_ctrl.mirror_flip = data->sensor_platform_info->mirror_flip;
+
+	imx175_read_lens_info(&imx175_s_ctrl);
+
+	return rc;
+}
+
+static const char *imx175Vendor = "sony";
+static const char *imx175NAME = "imx175";
+static const char *imx175Size = "8M";
+
+static ssize_t sensor_vendor_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+
+	sprintf(buf, "%s %s %s\n", imx175Vendor, imx175NAME, imx175Size);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+
+static ssize_t lens_info_show(struct device *dev,
+  struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+
+	sprintf(buf, "%d\n", lens_info);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+
+static DEVICE_ATTR(sensor, 0444, sensor_vendor_show, NULL);
+static DEVICE_ATTR(lensinfo, 0444, lens_info_show, NULL);
+
+static struct kobject *android_imx175;
+
+static int imx175_sysfs_init(void)
+{
+	int ret ;
+	pr_info("imx175:kobject creat and add\n");
+	android_imx175 = kobject_create_and_add("android_camera", NULL);
+	if (android_imx175 == NULL) {
+		pr_info("imx175_sysfs_init: subsystem_register " \
+		"failed\n");
+		ret = -ENOMEM;
+		return ret ;
+	}
+	pr_info("imx175:sysfs_create_file\n");
+	ret = sysfs_create_file(android_imx175, &dev_attr_sensor.attr);
+	if (ret) {
+		pr_info("imx175_sysfs_init: sysfs_create_file " \
+		"failed\n");
+		kobject_del(android_imx175);
+	}
+	pr_info("imx175:sysfs_create_file lensinfo\n");
+	ret = sysfs_create_file(android_imx175, &dev_attr_lensinfo.attr);
+	if (ret) {
+		pr_info("imx175_sysfs_init: dev_attr_lensinfo failed\n");
+		kobject_del(android_imx175);
+	}
+	return 0 ;
+}
+
+int32_t imx175_i2c_probe(struct i2c_client *client,
+	const struct i2c_device_id *id)
+{
+	int	rc = 0;
+	pr_info("%s\n", __func__);
+
+	rc = msm_sensor_i2c_probe(client, id);
+	if(rc >= 0)
+		imx175_sysfs_init();
+	pr_info("%s: rc(%d)\n", __func__, rc);
+	return rc;
+}
+
+static const struct i2c_device_id imx175_i2c_id[] = {
+	{SENSOR_NAME, (kernel_ulong_t)&imx175_s_ctrl},
+	{ }
+};
+
+static struct i2c_driver imx175_i2c_driver = {
+	.id_table = imx175_i2c_id,
+	.probe  = imx175_i2c_probe,
+	.driver = {
+		.name = SENSOR_NAME,
+	},
+};
+
+static struct msm_camera_i2c_client imx175_sensor_i2c_client = {
+	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
+};
+
+int32_t imx175_power_up(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int rc;
+	struct msm_camera_sensor_info *sdata = NULL;
+	pr_info("%s\n", __func__);
+
+	if (s_ctrl && s_ctrl->sensordata)
+		sdata = s_ctrl->sensordata;
+	else {
+		pr_info("%s: failed to s_ctrl sensordata NULL\n", __func__);
+		return (-1);
+	}
+
+	if (sdata->camera_power_on == NULL) {
+		pr_err("sensor platform_data didnt register\n");
+		return -EIO;
+	}
+
+	if (!sdata->use_rawchip) {
+		rc = msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
+		if (rc < 0) {
+			pr_err("%s: msm_camio_sensor_clk_on failed:%d\n",
+			 __func__, rc);
+			goto enable_mclk_failed;
+		}
+	}
+
+	rc = sdata->camera_power_on();
+	if (rc < 0) {
+		pr_err("%s failed to enable power\n", __func__);
+		goto enable_power_on_failed;
+	}
+
+	rc = msm_sensor_set_power_up(s_ctrl);
+	if (rc < 0) {
+		pr_err("%s msm_sensor_power_up failed\n", __func__);
+		goto enable_sensor_power_up_failed;
+	}
+
+	imx175_sensor_open_init(sdata);
+	return rc;
+
+enable_sensor_power_up_failed:
+	if (sdata->camera_power_off == NULL)
+		pr_err("sensor platform_data didnt register\n");
+	else
+		sdata->camera_power_off();
+enable_power_on_failed:
+	msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
+enable_mclk_failed:
+	return rc;
+}
+
+int32_t imx175_power_down(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int rc;
+	struct msm_camera_sensor_info *sdata = NULL;
+	pr_info("%s\n", __func__);
+
+	if (s_ctrl && s_ctrl->sensordata)
+		sdata = s_ctrl->sensordata;
+	else {
+		pr_info("%s: failed to s_ctrl sensordata NULL\n", __func__);
+		return (-1);
+	}
+
+	if (sdata->camera_power_off == NULL) {
+		pr_err("sensor platform_data didnt register\n");
+		return -EIO;
+	}
+
+	rc = sdata->camera_power_off();
+	if (rc < 0)
+		pr_err("%s failed to disable power\n", __func__);
+
+	rc = msm_sensor_set_power_down(s_ctrl);
+	if (rc < 0)
+		pr_err("%s msm_sensor_power_down failed\n", __func__);
+
+	if (!sdata->use_rawchip) {
+		msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
+		if (rc < 0)
+			pr_err("%s: msm_camio_sensor_clk_off failed:%d\n",
+				 __func__, rc);
+	}
+
+	return rc;
+}
+
+static int __init msm_sensor_init_module(void)
+{
+	pr_info("imx175 %s\n", __func__);
+	return i2c_add_driver(&imx175_i2c_driver);
+}
+
+static struct v4l2_subdev_core_ops imx175_subdev_core_ops = {
+	.ioctl = msm_sensor_subdev_ioctl,
+	.s_power = msm_sensor_power,
+};
+
+static struct v4l2_subdev_video_ops imx175_subdev_video_ops = {
+	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
+};
+
+static struct v4l2_subdev_ops imx175_subdev_ops = {
+	.core = &imx175_subdev_core_ops,
+	.video  = &imx175_subdev_video_ops,
+};
+
+static int imx175_read_fuseid(struct sensor_cfg_data *cdata,
+	struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int32_t rc = 0;
+	int i;
+	uint16_t read_data = 0;
+	uint8_t OTP[10] = {0};
+
+	rc = msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x3400, 0x01, MSM_CAMERA_I2C_BYTE_DATA);
+	if (rc < 0)
+		pr_err("%s: msm_camera_i2c_write 0x3400 failed\n", __func__);
+
+	
+	rc = msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x3402, 0x01, MSM_CAMERA_I2C_BYTE_DATA);
+	if (rc < 0)
+		pr_err("%s: msm_camera_i2c_write 0x3402 failed\n", __func__);
+
+	for (i = 0; i < 10; i++) {
+		rc = msm_camera_i2c_read(s_ctrl->sensor_i2c_client, (0x3404 + i), &read_data, MSM_CAMERA_I2C_BYTE_DATA);
+		if (rc < 0)
+			pr_err("%s: msm_camera_i2c_read 0x%x failed\n", __func__, (0x3404 + i));
+
+		OTP[i] = (uint8_t)(read_data&0x00FF);
+		read_data = 0;
+	}
+
+	pr_info("%s: VenderID=%x,LensID=%x,SensorID=%02x%02x\n", __func__,
+		OTP[0], OTP[1], OTP[2], OTP[3]);
+	pr_info("%s: ModuleFuseID= %02x%02x%02x%02x%02x%02x\n", __func__,
+		OTP[4], OTP[5], OTP[6], OTP[7], OTP[8], OTP[9]);
+
+	cdata->cfg.fuse.fuse_id_word1 = 0;
+	cdata->cfg.fuse.fuse_id_word2 = (OTP[0]);
+	cdata->cfg.fuse.fuse_id_word3 =
+		(OTP[4]<<24) |
+		(OTP[5]<<16) |
+		(OTP[6]<<8) |
+		(OTP[7]);
+	cdata->cfg.fuse.fuse_id_word4 =
+		(OTP[8]<<8) |
+		(OTP[9]);
+
+	pr_info("imx175: fuse->fuse_id_word1:%d\n",
+		cdata->cfg.fuse.fuse_id_word1);
+	pr_info("imx175: fuse->fuse_id_word2:%d\n",
+		cdata->cfg.fuse.fuse_id_word2);
+	pr_info("imx175: fuse->fuse_id_word3:0x%08x\n",
+		cdata->cfg.fuse.fuse_id_word3);
+	pr_info("imx175: fuse->fuse_id_word4:0x%08x\n",
+		cdata->cfg.fuse.fuse_id_word4);
+	return 0;
+
+}
+
+int imx175_write_output_settings_specific(struct msm_sensor_ctrl_t *s_ctrl,
+	uint16_t res)
+{
+	int rc = 0;
+	uint16_t value = 0;
+
+	
+	if (imx175_s_ctrl.mirror_flip == CAMERA_SENSOR_MIRROR_FLIP)
+		value = IMX175_READ_MIRROR_FLIP;
+	else if (imx175_s_ctrl.mirror_flip == CAMERA_SENSOR_MIRROR)
+		value = IMX175_READ_MIRROR;
+	else if (imx175_s_ctrl.mirror_flip == CAMERA_SENSOR_FLIP)
+		value = IMX175_READ_FLIP;
+	else
+		value = IMX175_READ_NORMAL_MODE;
+	rc = msm_camera_i2c_write(imx175_s_ctrl.sensor_i2c_client,
+		IMX175_REG_READ_MODE, value, MSM_CAMERA_I2C_BYTE_DATA);
+	if (rc < 0) {
+		pr_err("%s set mirror_flip failed\n", __func__);
+		return rc;
+	}
+
+	return rc;
+}
+
+static struct msm_sensor_fn_t imx175_func_tbl = {
+	.sensor_start_stream = msm_sensor_start_stream,
+	.sensor_stop_stream = msm_sensor_stop_stream,
+	.sensor_group_hold_on = msm_sensor_group_hold_on,
+	.sensor_group_hold_off = msm_sensor_group_hold_off,
+	.sensor_set_fps = msm_sensor_set_fps,
+	.sensor_write_exp_gain_ex = msm_sensor_write_exp_gain1_ex,
+	.sensor_write_snapshot_exp_gain_ex = msm_sensor_write_exp_gain1_ex,
+	.sensor_set_dig_gain = imx175_set_dig_gain,
+	.sensor_write_snapshot_exp_gain = msm_sensor_write_exp_gain1,
+	.sensor_setting = msm_sensor_setting,
+	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
+	.sensor_mode_init = msm_sensor_mode_init,
+	.sensor_get_output_info = msm_sensor_get_output_info,
+	.sensor_config = msm_sensor_config,
+	.sensor_power_up = imx175_power_up,
+	.sensor_power_down = imx175_power_down,
+	.sensor_i2c_read_fuseid = imx175_read_fuseid,
+#if 0
+	
+	.sensor_i2c_read_vcm_clib = imx175_read_vcm_clib,
+	
+#endif
+	.sensor_write_output_settings_specific = imx175_write_output_settings_specific, 
+};
+
+static struct msm_sensor_reg_t imx175_regs = {
+	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
+	.start_stream_conf = imx175_start_settings,
+	.start_stream_conf_size = ARRAY_SIZE(imx175_start_settings),
+	.stop_stream_conf = imx175_stop_settings,
+	.stop_stream_conf_size = ARRAY_SIZE(imx175_stop_settings),
+	.group_hold_on_conf = imx175_groupon_settings,
+	.group_hold_on_conf_size = ARRAY_SIZE(imx175_groupon_settings),
+	.group_hold_off_conf = imx175_groupoff_settings,
+	.group_hold_off_conf_size =
+		ARRAY_SIZE(imx175_groupoff_settings),
+	.init_settings = &imx175_init_conf[0],
+	.init_size = ARRAY_SIZE(imx175_init_conf),
+	.mode_settings = &imx175_confs[0],
+	.output_settings = &imx175_dimensions[0],
+	.num_conf = ARRAY_SIZE(imx175_confs),
+};
+
+static struct msm_sensor_ctrl_t imx175_s_ctrl = {
+	.msm_sensor_reg = &imx175_regs,
+	.sensor_i2c_client = &imx175_sensor_i2c_client,
+	.sensor_i2c_addr = 0x20,
+	.sensor_output_reg_addr = &imx175_reg_addr,
+	.sensor_id_info = &imx175_id_info,
+	.sensor_exp_gain_info = &imx175_exp_gain_info,
+	.cam_mode = MSM_SENSOR_MODE_INVALID,
+	.csi_params = &imx175_csi_params_array[0],
+	.msm_sensor_mutex = &imx175_mut,
+	.sensor_i2c_driver = &imx175_i2c_driver,
+	.sensor_v4l2_subdev_info = imx175_subdev_info,
+	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(imx175_subdev_info),
+	.sensor_v4l2_subdev_ops = &imx175_subdev_ops,
+	.func_tbl = &imx175_func_tbl,
+	.sensor_first_mutex = &imx175_sensor_init_mut, 
+};
+
+module_init(msm_sensor_init_module);
+MODULE_DESCRIPTION("Sony 8 MP Bayer sensor driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/msm_sensor.c b/drivers/media/video/msm/sensors/msm_sensor.c
index 43e2e8d..4d42181 100644
--- a/drivers/media/video/msm/sensors/msm_sensor.c
+++ b/drivers/media/video/msm/sensors/msm_sensor.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -9,20 +9,129 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-#include <mach/msm_bus.h>
-#include <mach/msm_bus_board.h>
+
 #include "msm_sensor.h"
-#include "msm_sensor_common.h"
 #include "msm.h"
 #include "msm_ispif.h"
 #include "msm_camera_i2c_mux.h"
 
-/*=============================================================*/
-void msm_sensor_adjust_frame_lines1(struct msm_sensor_ctrl_t *s_ctrl)
+#ifdef CONFIG_RAWCHIP
+#include "rawchip/rawchip.h"
+#endif
+
+static struct task_struct *tsk_sensor_init = NULL;
+static int oem_sensor_init(void *arg);
+
+static int first_init;
+
+static int oem_sensor_init(void *arg)
+{
+	struct msm_sensor_ctrl_t *s_ctrl = (struct msm_sensor_ctrl_t *) arg;
+	int res;
+
+#ifdef CONFIG_RAWCHIP
+	struct rawchip_sensor_data rawchip_data;
+	struct timespec ts_start, ts_end;
+#endif
+
+	
+	pr_info("%s: E", __func__);
+	
+
+	v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+		NOTIFY_ISPIF_STREAM, (void *)ISPIF_STREAM(
+		PIX_0, ISPIF_OFF_IMMEDIATELY));
+	s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
+
+	s_ctrl->curr_csi_params = NULL;
+	msm_sensor_enable_debugfs(s_ctrl);
+
+	res =0;
+	if (s_ctrl->curr_csi_params != s_ctrl->csi_params[res]) {
+		s_ctrl->curr_csi_params = s_ctrl->csi_params[res];
+		s_ctrl->curr_csi_params->csid_params.lane_assign =
+			s_ctrl->sensordata->sensor_platform_info->
+			csi_lane_params->csi_lane_assign;
+		s_ctrl->curr_csi_params->csiphy_params.lane_mask =
+			s_ctrl->sensordata->sensor_platform_info->
+			csi_lane_params->csi_lane_mask;
+		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+			NOTIFY_CSID_CFG,
+			&s_ctrl->curr_csi_params->csid_params);
+		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+			NOTIFY_CID_CHANGE, NULL);
+		mb();
+		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+			NOTIFY_CSIPHY_CFG,
+			&s_ctrl->curr_csi_params->csiphy_params);
+		mb();
+	}
+	msleep(30);
+
+	msm_sensor_write_init_settings(s_ctrl);
+	
+
+#ifdef CONFIG_RAWCHIP
+	if (s_ctrl->sensordata->use_rawchip) {
+		rawchip_data.sensor_name = s_ctrl->sensordata->sensor_name;
+		rawchip_data.datatype = s_ctrl->curr_csi_params->csid_params.lut_params.vc_cfg->dt;
+		rawchip_data.lane_cnt = s_ctrl->curr_csi_params->csid_params.lane_cnt;
+		rawchip_data.pixel_clk = s_ctrl->msm_sensor_reg->output_settings[res].op_pixel_clk;
+		rawchip_data.mirror_flip = s_ctrl->mirror_flip;
+
+		rawchip_data.width = s_ctrl->msm_sensor_reg->output_settings[res].x_output;
+		rawchip_data.height = s_ctrl->msm_sensor_reg->output_settings[res].y_output;
+		rawchip_data.line_length_pclk = s_ctrl->msm_sensor_reg->output_settings[res].line_length_pclk;
+		rawchip_data.frame_length_lines = s_ctrl->msm_sensor_reg->output_settings[res].frame_length_lines;
+		rawchip_data.x_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_start;
+		rawchip_data.y_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_start;
+		rawchip_data.x_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_end;
+		rawchip_data.y_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_end;
+		rawchip_data.x_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_even_inc;
+		rawchip_data.x_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_odd_inc;
+		rawchip_data.y_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_even_inc;
+		rawchip_data.y_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_odd_inc;
+		rawchip_data.binning_rawchip = s_ctrl->msm_sensor_reg->output_settings[res].binning_rawchip;
+
+		rawchip_data.fullsize_width = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].x_output;
+		rawchip_data.fullsize_height = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].y_output;
+		rawchip_data.fullsize_line_length_pclk =
+			s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].line_length_pclk;
+		rawchip_data.fullsize_frame_length_lines =
+			s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].frame_length_lines;
+		rawchip_data.use_rawchip = s_ctrl->sensordata->use_rawchip;
+
+		ktime_get_ts(&ts_start);
+		rawchip_set_size(rawchip_data);
+		ktime_get_ts(&ts_end);
+
+		res = (ts_end.tv_sec-ts_start.tv_sec)*1000+(ts_end.tv_nsec-ts_start.tv_nsec)/1000000;
+		pr_info("%s: rawchip_set_size:%ld ms\n", __func__, (long)res);
+
+	}
+#endif
+
+	pr_info("%s: X", __func__);
+	mutex_unlock(s_ctrl->sensor_first_mutex);
+
+	return 0;
+}
+
+int32_t msm_sensor_adjust_frame_lines(struct msm_sensor_ctrl_t *s_ctrl,
+	uint16_t res)
 {
 	uint16_t cur_line = 0;
 	uint16_t exp_fl_lines = 0;
+	CDBG("%s: called\n", __func__);
+
 	if (s_ctrl->sensor_exp_gain_info) {
+		if (s_ctrl->prev_gain && s_ctrl->prev_line &&
+			s_ctrl->func_tbl->sensor_write_exp_gain)
+			s_ctrl->func_tbl->sensor_write_exp_gain(
+				s_ctrl,
+				s_ctrl->prev_gain,
+				s_ctrl->prev_line);
+	
 		msm_camera_i2c_read(s_ctrl->sensor_i2c_client,
 			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
 			&cur_line,
@@ -30,7 +139,7 @@
 		exp_fl_lines = cur_line +
 			s_ctrl->sensor_exp_gain_info->vert_offset;
 		if (exp_fl_lines > s_ctrl->msm_sensor_reg->
-			output_settings[s_ctrl->curr_res].frame_length_lines)
+			output_settings[res].frame_length_lines)
 			msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
 				s_ctrl->sensor_output_reg_addr->
 				frame_length_lines,
@@ -38,78 +147,22 @@
 				MSM_CAMERA_I2C_WORD_DATA);
 		CDBG("%s cur_fl_lines %d, exp_fl_lines %d\n", __func__,
 			s_ctrl->msm_sensor_reg->
-			output_settings[s_ctrl->curr_res].frame_length_lines,
+			output_settings[res].frame_length_lines,
 			exp_fl_lines);
 	}
-	return;
+	return 0;
 }
-
-void msm_sensor_adjust_frame_lines2(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	uint16_t cur_line = 0;
-	uint16_t exp_fl_lines = 0;
-	uint8_t int_time[3];
-	uint32_t fll = (s_ctrl->msm_sensor_reg->
-			output_settings[s_ctrl->curr_res].frame_length_lines *
-			s_ctrl->fps_divider) / Q10;
-	if (s_ctrl->sensor_exp_gain_info) {
-		msm_camera_i2c_read_seq(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr-1,
-			&int_time[0], 3);
-		cur_line |= int_time[0] << 12;
-		cur_line |= int_time[1] << 4;
-		cur_line |= int_time[2] >> 4;
-		exp_fl_lines = cur_line +
-			s_ctrl->sensor_exp_gain_info->vert_offset;
-		if (exp_fl_lines > fll)
-			msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-				s_ctrl->sensor_output_reg_addr->
-				frame_length_lines,
-				exp_fl_lines,
-				MSM_CAMERA_I2C_WORD_DATA);
-		CDBG("%s cur_line %x cur_fl_lines %x, exp_fl_lines %x\n",
-			__func__,
-			cur_line,
-			s_ctrl->msm_sensor_reg->
-			output_settings[s_ctrl->curr_res].frame_length_lines,
-			exp_fl_lines);
-	}
-	return;
-}
-
-static void msm_sensor_delay_frames(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	long fps = 0;
-	uint32_t delay = 0;
-
-	if (s_ctrl->curr_res < MSM_SENSOR_INVALID_RES &&
-		s_ctrl->wait_num_frames > 0) {
-		fps = s_ctrl->msm_sensor_reg->
-			output_settings[s_ctrl->curr_res].vt_pixel_clk /
-			s_ctrl->curr_frame_length_lines /
-			s_ctrl->curr_line_length_pclk;
-		if (fps == 0)
-			delay = s_ctrl->min_delay;
-		else
-			delay = (1000 * s_ctrl->wait_num_frames) / fps / Q10;
-	}
-	CDBG("%s fps = %ld, delay = %d, min_delay %d\n", __func__, fps,
-		delay, s_ctrl->min_delay);
-	if (delay > s_ctrl->min_delay)
-		msleep(delay);
-	else if (s_ctrl->min_delay)
-		msleep(s_ctrl->min_delay);
-	return;
-}
+ 
 
 int32_t msm_sensor_write_init_settings(struct msm_sensor_ctrl_t *s_ctrl)
 {
-	int32_t rc = 0;
-	if (s_ctrl->msm_sensor_reg->init_settings)
-		rc = msm_sensor_write_all_conf_array(
-			s_ctrl->sensor_i2c_client,
-			s_ctrl->msm_sensor_reg->init_settings,
-			s_ctrl->msm_sensor_reg->init_size);
+	int32_t rc;
+	CDBG("%s: called\n", __func__);
+
+	rc = msm_sensor_write_all_conf_array(
+		s_ctrl->sensor_i2c_client,
+		s_ctrl->msm_sensor_reg->init_settings,
+		s_ctrl->msm_sensor_reg->init_size);
 	return rc;
 }
 
@@ -117,15 +170,35 @@
 	uint16_t res)
 {
 	int32_t rc;
+	CDBG("%s: called\n", __func__);
+
 	rc = msm_sensor_write_conf_array(
 		s_ctrl->sensor_i2c_client,
 		s_ctrl->msm_sensor_reg->mode_settings, res);
 	if (rc < 0)
+	{
+		pr_info("%s: failed to msm_sensor_write_conf_array return < 0\n", __func__);
 		return rc;
+	}
 
 	rc = msm_sensor_write_output_settings(s_ctrl, res);
 	if (rc < 0)
+	{
+		pr_info("%s: failed to msm_sensor_write_output_settings return < 0\n", __func__);
 		return rc;
+	}
+
+	if (s_ctrl->func_tbl->sensor_write_output_settings_specific) {
+		rc = s_ctrl->func_tbl->sensor_write_output_settings_specific(s_ctrl, res);
+		if (rc < 0)
+		{
+			pr_info("%s: failed to sensor_write_output_settings_specific return < 0\n", __func__);
+			return rc;
+		}
+	}
+
+	if (s_ctrl->func_tbl->sensor_adjust_frame_lines)
+		rc = s_ctrl->func_tbl->sensor_adjust_frame_lines(s_ctrl, res);
 
 	return rc;
 }
@@ -134,9 +207,6 @@
 	uint16_t res)
 {
 	int32_t rc = -EFAULT;
-	uint32_t fll = (s_ctrl->msm_sensor_reg->
-		output_settings[res].frame_length_lines *
-		s_ctrl->fps_divider) / Q10;
 	struct msm_camera_i2c_reg_conf dim_settings[] = {
 		{s_ctrl->sensor_output_reg_addr->x_output,
 			s_ctrl->msm_sensor_reg->
@@ -148,8 +218,10 @@
 			s_ctrl->msm_sensor_reg->
 			output_settings[res].line_length_pclk},
 		{s_ctrl->sensor_output_reg_addr->frame_length_lines,
-			fll},
+			s_ctrl->msm_sensor_reg->
+			output_settings[res].frame_length_lines},
 	};
+	CDBG("%s: called\n", __func__);
 
 	rc = msm_camera_i2c_write_tbl(s_ctrl->sensor_i2c_client, dim_settings,
 		ARRAY_SIZE(dim_settings), MSM_CAMERA_I2C_WORD_DATA);
@@ -158,33 +230,30 @@
 
 void msm_sensor_start_stream(struct msm_sensor_ctrl_t *s_ctrl)
 {
-	if (s_ctrl->curr_res >= s_ctrl->msm_sensor_reg->num_conf)
-		return;
-
-	if (s_ctrl->func_tbl->sensor_adjust_frame_lines &&
-			s_ctrl->vision_mode_flag == 0)
-		s_ctrl->func_tbl->sensor_adjust_frame_lines(s_ctrl);
+	CDBG("%s: called\n", __func__);
 
 	msm_camera_i2c_write_tbl(
 		s_ctrl->sensor_i2c_client,
 		s_ctrl->msm_sensor_reg->start_stream_conf,
 		s_ctrl->msm_sensor_reg->start_stream_conf_size,
 		s_ctrl->msm_sensor_reg->default_data_type);
-	msleep(20);
 }
 
 void msm_sensor_stop_stream(struct msm_sensor_ctrl_t *s_ctrl)
 {
+	CDBG("%s: called\n", __func__);
+
 	msm_camera_i2c_write_tbl(
 		s_ctrl->sensor_i2c_client,
 		s_ctrl->msm_sensor_reg->stop_stream_conf,
 		s_ctrl->msm_sensor_reg->stop_stream_conf_size,
 		s_ctrl->msm_sensor_reg->default_data_type);
-	msm_sensor_delay_frames(s_ctrl);
 }
 
 void msm_sensor_group_hold_on(struct msm_sensor_ctrl_t *s_ctrl)
 {
+	CDBG("%s: called\n", __func__);
+
 	msm_camera_i2c_write_tbl(
 		s_ctrl->sensor_i2c_client,
 		s_ctrl->msm_sensor_reg->group_hold_on_conf,
@@ -194,6 +263,8 @@
 
 void msm_sensor_group_hold_off(struct msm_sensor_ctrl_t *s_ctrl)
 {
+	CDBG("%s: called\n", __func__);
+
 	msm_camera_i2c_write_tbl(
 		s_ctrl->sensor_i2c_client,
 		s_ctrl->msm_sensor_reg->group_hold_off_conf,
@@ -210,10 +281,12 @@
 }
 
 int32_t msm_sensor_write_exp_gain1(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
+		uint16_t gain, uint32_t line)
 {
 	uint32_t fl_lines;
 	uint8_t offset;
+	CDBG("%s: called\n", __func__);
+
 	fl_lines = s_ctrl->curr_frame_length_lines;
 	fl_lines = (fl_lines * s_ctrl->fps_divider) / Q10;
 	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
@@ -235,10 +308,12 @@
 }
 
 int32_t msm_sensor_write_exp_gain2(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
+		uint16_t gain, uint32_t line)
 {
 	uint32_t fl_lines, ll_pclk, ll_ratio;
 	uint8_t offset;
+	CDBG("%s: called\n", __func__);
+
 	fl_lines = s_ctrl->curr_frame_length_lines * s_ctrl->fps_divider / Q10;
 	ll_pclk = s_ctrl->curr_line_length_pclk;
 	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
@@ -262,25 +337,327 @@
 	return 0;
 }
 
+int32_t msm_sensor_setting3(struct msm_sensor_ctrl_t *s_ctrl,
+			int update_type, int res)
+{
+	int32_t rc = 0;
+	static int csi_config;
+	CDBG("%s: called\n", __func__);
+
+	if (update_type == MSM_SENSOR_REG_INIT) {
+		CDBG("Register INIT\n");
+		s_ctrl->curr_csi_params = NULL;
+		csi_config = 0;
+		msm_camera_i2c_write(
+			s_ctrl->sensor_i2c_client,
+			0x0e, 0x08,
+			MSM_CAMERA_I2C_BYTE_DATA);
+	} else if (update_type == MSM_SENSOR_UPDATE_PERIODIC) {
+		CDBG("PERIODIC : %d\n", res);
+		if (res == 0)
+			return 0;
+		if (!csi_config) {
+			msm_sensor_write_conf_array(
+				s_ctrl->sensor_i2c_client,
+				s_ctrl->msm_sensor_reg->mode_settings, res);
+			msleep(30);
+			s_ctrl->curr_csic_params = s_ctrl->csic_params[res];
+			CDBG("CSI config in progress\n");
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSIC_CFG,
+				s_ctrl->curr_csic_params);
+			CDBG("CSI config is done\n");
+			mb();
+			msleep(30);
+			msm_camera_i2c_write(
+					s_ctrl->sensor_i2c_client,
+					0x0e, 0x00,
+					MSM_CAMERA_I2C_BYTE_DATA);
+			csi_config = 1;
+		}
+		msleep(50);
+	}
+	return rc;
+}
+
+int32_t msm_sensor_write_exp_gain1_ex(struct msm_sensor_ctrl_t *s_ctrl,
+		int mode, uint16_t gain, uint16_t dig_gain, uint32_t line) 
+{
+	uint32_t fl_lines;
+	uint8_t offset;
+
+	uint32_t fps_divider = Q10;
+	CDBG("%s: called\n", __func__);
+
+	if (mode == SENSOR_PREVIEW_MODE)
+		fps_divider = s_ctrl->fps_divider;
+
+	if(line > s_ctrl->sensor_exp_gain_info->sensor_max_linecount)
+		line = s_ctrl->sensor_exp_gain_info->sensor_max_linecount;
+
+	fl_lines = s_ctrl->curr_frame_length_lines;
+	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
+	if (line * Q10 > (fl_lines - offset) * fps_divider)
+		fl_lines = line + offset;
+	else
+		fl_lines = (fl_lines * fps_divider) / Q10;
+
+	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		s_ctrl->sensor_output_reg_addr->frame_length_lines, fl_lines,
+		MSM_CAMERA_I2C_WORD_DATA);
+
+	if (s_ctrl->func_tbl->sensor_ov2722_write_exp_line) {
+		s_ctrl->func_tbl->sensor_ov2722_write_exp_line (s_ctrl,line);
+	}
+	else {
+		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr, line,
+			MSM_CAMERA_I2C_WORD_DATA);
+	}
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
+		MSM_CAMERA_I2C_WORD_DATA);
+	
+	if (s_ctrl->func_tbl->sensor_set_dig_gain)
+		s_ctrl->func_tbl->sensor_set_dig_gain(s_ctrl, dig_gain);
+	
+	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
+	return 0;
+}
+
+int32_t msm_sensor_write_exp_gain2_ex(struct msm_sensor_ctrl_t *s_ctrl,
+		int mode, uint16_t gain, uint32_t line) 
+{
+	uint32_t fl_lines, ll_pclk, ll_ratio;
+	uint8_t offset;
+	uint32_t fps_divider = Q10;
+	CDBG("%s: called\n", __func__);
+
+	if (mode == SENSOR_PREVIEW_MODE)
+		fps_divider = s_ctrl->fps_divider;
+	fl_lines = s_ctrl->curr_frame_length_lines;
+	ll_pclk = s_ctrl->curr_line_length_pclk;
+	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
+	if (line * Q10 > (fl_lines - offset) * fps_divider) {
+		ll_ratio = (line * Q10) / (fl_lines - offset);
+		ll_pclk = ll_pclk * ll_ratio / Q10;
+		line = fl_lines - offset;
+	} else {
+		ll_pclk = ll_pclk * fps_divider / Q10;
+		line = line / fps_divider;
+	}
+
+	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		s_ctrl->sensor_output_reg_addr->line_length_pclk, ll_pclk,
+		MSM_CAMERA_I2C_WORD_DATA);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr, line,
+		MSM_CAMERA_I2C_WORD_DATA);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
+		MSM_CAMERA_I2C_WORD_DATA);
+	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
+	return 0;
+}
+
+int32_t msm_sensor_write_exp_gain_ov(struct msm_sensor_ctrl_t *s_ctrl,
+		int mode, uint16_t gain, uint16_t dig_gain, uint32_t line)
+{
+	uint32_t fl_lines;
+	uint8_t offset;
+	uint32_t aec_msb_24; 
+	uint16_t aec_msb;
+	uint16_t aec_lsb;
+	uint32_t phy_line_2 = 0;
+
+
+	uint32_t fps_divider = Q10;
+	CDBG("%s: called\n", __func__);
+
+	if (mode == SENSOR_PREVIEW_MODE)
+		fps_divider = s_ctrl->fps_divider;
+
+	if(line > s_ctrl->sensor_exp_gain_info->sensor_max_linecount)
+		line = s_ctrl->sensor_exp_gain_info->sensor_max_linecount;
+
+	fl_lines = s_ctrl->curr_frame_length_lines;
+	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
+	if (line * Q10 > (fl_lines - offset) * fps_divider)
+		fl_lines = line + offset;
+	else
+		fl_lines = (fl_lines * fps_divider) / Q10;
+
+	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		s_ctrl->sensor_output_reg_addr->frame_length_lines, fl_lines,
+		MSM_CAMERA_I2C_WORD_DATA);
+
+	phy_line_2 = line << 4;
+	aec_msb_24 = (uint32_t)(phy_line_2 & 0xFF0000) >> 16;
+	aec_msb = (uint16_t)(phy_line_2 & 0xFF00) >> 8;
+	aec_lsb = (uint16_t)(phy_line_2 & 0x00FF);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client, s_ctrl->sensor_exp_gain_info->coarse_int_time_addr, (uint8_t)aec_msb_24, MSM_CAMERA_I2C_BYTE_DATA);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client, s_ctrl->sensor_exp_gain_info->coarse_int_time_addr+1, (uint8_t)aec_msb, MSM_CAMERA_I2C_BYTE_DATA);
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client, s_ctrl->sensor_exp_gain_info->coarse_int_time_addr+2, (uint8_t)aec_lsb, MSM_CAMERA_I2C_BYTE_DATA);
+
+	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
+		s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
+		MSM_CAMERA_I2C_BYTE_DATA);
+	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
+	return 0;
+}
+
 int32_t msm_sensor_setting1(struct msm_sensor_ctrl_t *s_ctrl,
 			int update_type, int res)
 {
 	int32_t rc = 0;
+	static int csi_config;
+	CDBG("%s: called\n", __func__);
 
+	s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
+	msleep(30);
 	if (update_type == MSM_SENSOR_REG_INIT) {
 		CDBG("Register INIT\n");
+		s_ctrl->curr_csi_params = NULL;
 		msm_sensor_enable_debugfs(s_ctrl);
-		s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
 		msm_sensor_write_init_settings(s_ctrl);
+		csi_config = 0;
 	} else if (update_type == MSM_SENSOR_UPDATE_PERIODIC) {
 		CDBG("PERIODIC : %d\n", res);
 		msm_sensor_write_conf_array(
 			s_ctrl->sensor_i2c_client,
 			s_ctrl->msm_sensor_reg->mode_settings, res);
 		msleep(30);
+		if (!csi_config) {
+			s_ctrl->curr_csic_params = s_ctrl->csic_params[res];
+			CDBG("CSI config in progress\n");
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSIC_CFG,
+				s_ctrl->curr_csic_params);
+			CDBG("CSI config is done\n");
+			mb();
+			msleep(30);
+			csi_config = 1;
+		}
+		s_ctrl->func_tbl->sensor_start_stream(s_ctrl);
+		msleep(50);
+	}
+	return rc;
+}
+
+int32_t msm_sensor_setting_parallel(struct msm_sensor_ctrl_t *s_ctrl,
+			int update_type, int res)
+{
+	int32_t rc = 0;
+
+#ifdef CONFIG_RAWCHIP
+	struct rawchip_sensor_data rawchip_data;
+	struct timespec ts_start, ts_end;
+#endif
+
+	pr_info("%s: update_type=%d, res=%d\n", __func__, update_type, res);
+
+	if (update_type == MSM_SENSOR_REG_INIT) {
+		mutex_lock(s_ctrl->sensor_first_mutex);  
+
+		tsk_sensor_init = kthread_create(oem_sensor_init, s_ctrl, "oem_sensor_init");
+		if (IS_ERR(tsk_sensor_init)) {
+			pr_err("%s: kthread_create failed", __func__);
+			rc = PTR_ERR(tsk_sensor_init);
+			tsk_sensor_init = NULL;
+			mutex_unlock(s_ctrl->sensor_first_mutex);  
+		} else
+			wake_up_process(tsk_sensor_init);
+
+		first_init = 1;
+	} else if (update_type == MSM_SENSOR_UPDATE_PERIODIC) {
+		
+
+		
+		mutex_lock(s_ctrl->sensor_first_mutex);
+
 		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-			NOTIFY_PCLK_CHANGE,
-			&s_ctrl->sensordata->pdata->ioclk.vfe_clk_rate);
+			NOTIFY_ISPIF_STREAM, (void *)ISPIF_STREAM(
+			PIX_0, ISPIF_OFF_IMMEDIATELY));
+		s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
+
+		if(!first_init)
+			mdelay(50);
+		first_init = 0;
+
+		pr_info("%s: update_type=MSM_SENSOR_UPDATE_PERIODIC, res=%d\n", __func__, res);  
+		
+
+		msm_sensor_write_res_settings(s_ctrl, res);
+		if (s_ctrl->curr_csi_params != s_ctrl->csi_params[res]) {
+			s_ctrl->curr_csi_params = s_ctrl->csi_params[res];
+			s_ctrl->curr_csi_params->csid_params.lane_assign =
+				s_ctrl->sensordata->sensor_platform_info->
+				csi_lane_params->csi_lane_assign;
+			s_ctrl->curr_csi_params->csiphy_params.lane_mask =
+				s_ctrl->sensordata->sensor_platform_info->
+				csi_lane_params->csi_lane_mask;
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSID_CFG,
+				&s_ctrl->curr_csi_params->csid_params);
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+						NOTIFY_CID_CHANGE, NULL);
+			mb();
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSIPHY_CFG,
+				&s_ctrl->curr_csi_params->csiphy_params);
+			mb();
+			msleep(20);
+		}
+#ifdef CONFIG_RAWCHIP
+			if (s_ctrl->sensordata->use_rawchip) {
+				rawchip_data.sensor_name = s_ctrl->sensordata->sensor_name;
+				rawchip_data.datatype = s_ctrl->curr_csi_params->csid_params.lut_params.vc_cfg->dt;
+				rawchip_data.lane_cnt = s_ctrl->curr_csi_params->csid_params.lane_cnt;
+				rawchip_data.pixel_clk = s_ctrl->msm_sensor_reg->output_settings[res].op_pixel_clk;
+				rawchip_data.mirror_flip = s_ctrl->mirror_flip;
+
+				rawchip_data.width = s_ctrl->msm_sensor_reg->output_settings[res].x_output;
+				rawchip_data.height = s_ctrl->msm_sensor_reg->output_settings[res].y_output;
+				rawchip_data.line_length_pclk = s_ctrl->msm_sensor_reg->output_settings[res].line_length_pclk;
+				rawchip_data.frame_length_lines = s_ctrl->msm_sensor_reg->output_settings[res].frame_length_lines;
+				rawchip_data.x_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_start;
+				rawchip_data.y_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_start;
+				rawchip_data.x_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_end;
+				rawchip_data.y_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_end;
+				rawchip_data.x_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_even_inc;
+				rawchip_data.x_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_odd_inc;
+				rawchip_data.y_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_even_inc;
+				rawchip_data.y_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_odd_inc;
+				rawchip_data.binning_rawchip = s_ctrl->msm_sensor_reg->output_settings[res].binning_rawchip;
+
+				rawchip_data.fullsize_width = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].x_output;
+				rawchip_data.fullsize_height = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].y_output;
+				rawchip_data.fullsize_line_length_pclk =
+					s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].line_length_pclk;
+				rawchip_data.fullsize_frame_length_lines =
+					s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].frame_length_lines;
+				rawchip_data.use_rawchip = s_ctrl->sensordata->use_rawchip;
+
+				ktime_get_ts(&ts_start);
+				rawchip_set_size(rawchip_data);
+				ktime_get_ts(&ts_end);
+				pr_info("%s: %ld ms\n", __func__,
+					(ts_end.tv_sec-ts_start.tv_sec)*1000+(ts_end.tv_nsec-ts_start.tv_nsec)/1000000);
+			}
+#endif
+
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_PCLK_CHANGE, &s_ctrl->msm_sensor_reg->
+				output_settings[res].op_pixel_clk);
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_ISPIF_STREAM, (void *)ISPIF_STREAM(
+				PIX_0, ISPIF_ON_FRAME_BOUNDARY));
+			s_ctrl->func_tbl->sensor_start_stream(s_ctrl);
+			msleep(30);
+			mutex_unlock(s_ctrl->sensor_first_mutex);  
 	}
 	return rc;
 }
@@ -289,14 +666,424 @@
 			int update_type, int res)
 {
 	int32_t rc = 0;
+
+#ifdef CONFIG_RAWCHIP
+	struct rawchip_sensor_data rawchip_data;
+	struct timespec ts_start, ts_end;
+#endif
+
+	pr_info("%s: update_type=%d, res=%d\n", __func__, update_type, res);
+
+	v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+		NOTIFY_ISPIF_STREAM, (void *)ISPIF_STREAM(
+		PIX_0, ISPIF_OFF_IMMEDIATELY));
+
+	s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
+
+	msleep(30);
 	if (update_type == MSM_SENSOR_REG_INIT) {
-		s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
+		s_ctrl->curr_csi_params = NULL;
+		msm_sensor_enable_debugfs(s_ctrl);
 		msm_sensor_write_init_settings(s_ctrl);
+		first_init = 1;
 	} else if (update_type == MSM_SENSOR_UPDATE_PERIODIC) {
+		
+		if(!first_init)
+			mdelay(50);
+		first_init = 0;
+
 		msm_sensor_write_res_settings(s_ctrl, res);
+		if (s_ctrl->curr_csi_params != s_ctrl->csi_params[res]) {
+			s_ctrl->curr_csi_params = s_ctrl->csi_params[res];
+			s_ctrl->curr_csi_params->csid_params.lane_assign =
+				s_ctrl->sensordata->sensor_platform_info->
+				csi_lane_params->csi_lane_assign;
+			s_ctrl->curr_csi_params->csiphy_params.lane_mask =
+				s_ctrl->sensordata->sensor_platform_info->
+				csi_lane_params->csi_lane_mask;
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSID_CFG,
+				&s_ctrl->curr_csi_params->csid_params);
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+						NOTIFY_CID_CHANGE, NULL);
+			mb();
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSIPHY_CFG,
+				&s_ctrl->curr_csi_params->csiphy_params);
+			mb();
+			msleep(20);
+		}
+#ifdef CONFIG_RAWCHIP
+			if (s_ctrl->sensordata->use_rawchip) {
+				rawchip_data.sensor_name = s_ctrl->sensordata->sensor_name;
+				rawchip_data.datatype = s_ctrl->curr_csi_params->csid_params.lut_params.vc_cfg->dt;
+				rawchip_data.lane_cnt = s_ctrl->curr_csi_params->csid_params.lane_cnt;
+				rawchip_data.pixel_clk = s_ctrl->msm_sensor_reg->output_settings[res].op_pixel_clk;
+				rawchip_data.mirror_flip = s_ctrl->mirror_flip;
+
+				rawchip_data.width = s_ctrl->msm_sensor_reg->output_settings[res].x_output;
+				rawchip_data.height = s_ctrl->msm_sensor_reg->output_settings[res].y_output;
+				rawchip_data.line_length_pclk = s_ctrl->msm_sensor_reg->output_settings[res].line_length_pclk;
+				rawchip_data.frame_length_lines = s_ctrl->msm_sensor_reg->output_settings[res].frame_length_lines;
+				rawchip_data.x_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_start;
+				rawchip_data.y_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_start;
+				rawchip_data.x_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_end;
+				rawchip_data.y_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_end;
+				rawchip_data.x_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_even_inc;
+				rawchip_data.x_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_odd_inc;
+				rawchip_data.y_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_even_inc;
+				rawchip_data.y_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_odd_inc;
+				rawchip_data.binning_rawchip = s_ctrl->msm_sensor_reg->output_settings[res].binning_rawchip;
+
+				rawchip_data.fullsize_width = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].x_output;
+				rawchip_data.fullsize_height = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].y_output;
+				rawchip_data.fullsize_line_length_pclk =
+					s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].line_length_pclk;
+				rawchip_data.fullsize_frame_length_lines =
+					s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].frame_length_lines;
+				rawchip_data.use_rawchip = s_ctrl->sensordata->use_rawchip;
+
+				ktime_get_ts(&ts_start);
+				rawchip_set_size(rawchip_data);
+				ktime_get_ts(&ts_end);
+				pr_info("%s: %ld ms\n", __func__,
+					(ts_end.tv_sec-ts_start.tv_sec)*1000+(ts_end.tv_nsec-ts_start.tv_nsec)/1000000);
+			}
+#endif
+
+
 		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
 			NOTIFY_PCLK_CHANGE, &s_ctrl->msm_sensor_reg->
 			output_settings[res].op_pixel_clk);
+		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+			NOTIFY_ISPIF_STREAM, (void *)ISPIF_STREAM(
+			PIX_0, ISPIF_ON_FRAME_BOUNDARY));
+		s_ctrl->func_tbl->sensor_start_stream(s_ctrl);
+		msleep(30);
+	}
+	return rc;
+}
+
+int32_t msm_sensor_setting_ov(struct msm_sensor_ctrl_t *s_ctrl,
+			int update_type, int res)
+{
+	int32_t rc = 0;
+
+#ifdef CONFIG_RAWCHIP
+	struct rawchip_sensor_data rawchip_data;
+	struct timespec ts_start, ts_end;
+#endif
+
+	pr_info("%s: update_type=%d, res=%d\n", __func__, update_type, res);
+
+	v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+		NOTIFY_ISPIF_STREAM, (void *)ISPIF_STREAM(
+		PIX_0, ISPIF_OFF_IMMEDIATELY));
+
+	msleep(30);
+	if (update_type == MSM_SENSOR_REG_INIT) {
+		s_ctrl->curr_csi_params = NULL;
+		msm_sensor_enable_debugfs(s_ctrl);
+		if (s_ctrl->sensor_id_info->sensor_id == 0x4581) {
+			s_ctrl->curr_csi_params = s_ctrl->csi_params[res];
+			s_ctrl->curr_csi_params->csid_params.lane_assign =
+				s_ctrl->sensordata->sensor_platform_info->
+				csi_lane_params->csi_lane_assign;
+			s_ctrl->curr_csi_params->csiphy_params.lane_mask =
+				s_ctrl->sensordata->sensor_platform_info->
+				csi_lane_params->csi_lane_mask;
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSID_CFG,
+				&s_ctrl->curr_csi_params->csid_params);
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+						NOTIFY_CID_CHANGE, NULL);
+			mb();
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSIPHY_CFG,
+				&s_ctrl->curr_csi_params->csiphy_params);
+			mb();
+			msleep(20);
+		}
+		msm_sensor_write_init_settings(s_ctrl);
+		first_init = 1;
+	} else if (update_type == MSM_SENSOR_UPDATE_PERIODIC) {
+		
+		if(!first_init)
+			mdelay(50);
+		first_init = 0;
+
+
+		if (s_ctrl->curr_csi_params != s_ctrl->csi_params[res]) {
+			s_ctrl->curr_csi_params = s_ctrl->csi_params[res];
+			s_ctrl->curr_csi_params->csid_params.lane_assign =
+				s_ctrl->sensordata->sensor_platform_info->
+				csi_lane_params->csi_lane_assign;
+			s_ctrl->curr_csi_params->csiphy_params.lane_mask =
+				s_ctrl->sensordata->sensor_platform_info->
+				csi_lane_params->csi_lane_mask;
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSID_CFG,
+				&s_ctrl->curr_csi_params->csid_params);
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+						NOTIFY_CID_CHANGE, NULL);
+			mb();
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSIPHY_CFG,
+				&s_ctrl->curr_csi_params->csiphy_params);
+			mb();
+			msleep(20);
+		}
+
+#ifdef CONFIG_RAWCHIP
+			if (s_ctrl->sensordata->use_rawchip) {
+				rawchip_data.sensor_name = s_ctrl->sensordata->sensor_name;
+				rawchip_data.datatype = s_ctrl->curr_csi_params->csid_params.lut_params.vc_cfg->dt;
+				rawchip_data.lane_cnt = s_ctrl->curr_csi_params->csid_params.lane_cnt;
+				rawchip_data.pixel_clk = s_ctrl->msm_sensor_reg->output_settings[res].op_pixel_clk;
+				rawchip_data.mirror_flip = s_ctrl->mirror_flip;
+
+				rawchip_data.width = s_ctrl->msm_sensor_reg->output_settings[res].x_output;
+				rawchip_data.height = s_ctrl->msm_sensor_reg->output_settings[res].y_output;
+				rawchip_data.line_length_pclk = s_ctrl->msm_sensor_reg->output_settings[res].line_length_pclk;
+				rawchip_data.frame_length_lines = s_ctrl->msm_sensor_reg->output_settings[res].frame_length_lines;
+				rawchip_data.x_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_start;
+				rawchip_data.y_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_start;
+				rawchip_data.x_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_end;
+				rawchip_data.y_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_end;
+				rawchip_data.x_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_even_inc;
+				rawchip_data.x_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_odd_inc;
+				rawchip_data.y_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_even_inc;
+				rawchip_data.y_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_odd_inc;
+				rawchip_data.binning_rawchip = s_ctrl->msm_sensor_reg->output_settings[res].binning_rawchip;
+
+				rawchip_data.fullsize_width = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].x_output;
+				rawchip_data.fullsize_height = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].y_output;
+				rawchip_data.fullsize_line_length_pclk =
+					s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].line_length_pclk;
+				rawchip_data.fullsize_frame_length_lines =
+					s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].frame_length_lines;
+				rawchip_data.use_rawchip = s_ctrl->sensordata->use_rawchip;
+
+				ktime_get_ts(&ts_start);
+				rawchip_set_size(rawchip_data);
+				ktime_get_ts(&ts_end);
+				pr_info("%s: %ld ms\n", __func__,
+					(ts_end.tv_sec-ts_start.tv_sec)*1000+(ts_end.tv_nsec-ts_start.tv_nsec)/1000000);
+			}
+#endif
+
+		msm_sensor_write_res_settings(s_ctrl, res);
+
+		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+			NOTIFY_PCLK_CHANGE, &s_ctrl->msm_sensor_reg->
+			output_settings[res].op_pixel_clk);
+		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+			NOTIFY_ISPIF_STREAM, (void *)ISPIF_STREAM(
+			PIX_0, ISPIF_ON_FRAME_BOUNDARY));
+		s_ctrl->func_tbl->sensor_start_stream(s_ctrl);
+		msleep(30);
+	}
+	return rc;
+}
+
+
+static int oem_sensor_init_ov(void *arg)
+{
+	struct msm_sensor_ctrl_t *s_ctrl = (struct msm_sensor_ctrl_t *) arg;
+	int res;
+	int rc=0;
+
+#ifdef CONFIG_RAWCHIP
+	struct rawchip_sensor_data rawchip_data;
+	struct timespec ts_start, ts_end;
+#endif
+
+	mutex_lock(s_ctrl->sensor_first_mutex);
+	
+	s_ctrl->curr_csi_params = NULL;
+	msm_sensor_enable_debugfs(s_ctrl);
+	msm_sensor_write_init_settings(s_ctrl);
+	res =0;
+
+	if (s_ctrl->curr_csi_params != s_ctrl->csi_params[res]) {
+		s_ctrl->curr_csi_params = s_ctrl->csi_params[res];
+		s_ctrl->curr_csi_params->csid_params.lane_assign =
+			s_ctrl->sensordata->sensor_platform_info->
+			csi_lane_params->csi_lane_assign;
+		s_ctrl->curr_csi_params->csiphy_params.lane_mask =
+			s_ctrl->sensordata->sensor_platform_info->
+			csi_lane_params->csi_lane_mask;
+		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+			NOTIFY_CSID_CFG,
+			&s_ctrl->curr_csi_params->csid_params);
+		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+					NOTIFY_CID_CHANGE, NULL);
+		mb();
+		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+			NOTIFY_CSIPHY_CFG,
+			&s_ctrl->curr_csi_params->csiphy_params);
+		mb();
+		msleep(20);
+	}
+
+#ifdef CONFIG_RAWCHIP
+		if (s_ctrl->sensordata->use_rawchip) {
+
+			pr_info("%s: use_rawchip\n", __func__);
+
+			rawchip_data.sensor_name = s_ctrl->sensordata->sensor_name;
+			rawchip_data.datatype = s_ctrl->curr_csi_params->csid_params.lut_params.vc_cfg->dt;
+			rawchip_data.lane_cnt = s_ctrl->curr_csi_params->csid_params.lane_cnt;
+			rawchip_data.pixel_clk = s_ctrl->msm_sensor_reg->output_settings[res].op_pixel_clk;
+			rawchip_data.mirror_flip = s_ctrl->mirror_flip;
+
+			rawchip_data.width = s_ctrl->msm_sensor_reg->output_settings[res].x_output;
+			rawchip_data.height = s_ctrl->msm_sensor_reg->output_settings[res].y_output;
+			rawchip_data.line_length_pclk = s_ctrl->msm_sensor_reg->output_settings[res].line_length_pclk;
+			rawchip_data.frame_length_lines = s_ctrl->msm_sensor_reg->output_settings[res].frame_length_lines;
+			rawchip_data.x_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_start;
+			rawchip_data.y_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_start;
+			rawchip_data.x_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_end;
+			rawchip_data.y_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_end;
+			rawchip_data.x_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_even_inc;
+			rawchip_data.x_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_odd_inc;
+			rawchip_data.y_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_even_inc;
+			rawchip_data.y_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_odd_inc;
+			rawchip_data.binning_rawchip = s_ctrl->msm_sensor_reg->output_settings[res].binning_rawchip;
+
+			rawchip_data.fullsize_width = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].x_output;
+			rawchip_data.fullsize_height = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].y_output;
+			rawchip_data.fullsize_line_length_pclk =
+				s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].line_length_pclk;
+			rawchip_data.fullsize_frame_length_lines =
+				s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].frame_length_lines;
+			rawchip_data.use_rawchip = s_ctrl->sensordata->use_rawchip;
+
+			ktime_get_ts(&ts_start);
+			rawchip_set_size(rawchip_data);
+			ktime_get_ts(&ts_end);
+			pr_info("%s: %ld ms\n", __func__,
+				(ts_end.tv_sec-ts_start.tv_sec)*1000+(ts_end.tv_nsec-ts_start.tv_nsec)/1000000);
+		}
+#endif
+	mutex_unlock(s_ctrl->sensor_first_mutex);
+	
+	return rc;
+}
+
+
+int32_t msm_sensor_setting_parallel_ov(struct msm_sensor_ctrl_t *s_ctrl,
+			int update_type, int res)
+{
+	int32_t rc = 0;
+
+#ifdef CONFIG_RAWCHIP
+	struct rawchip_sensor_data rawchip_data;
+	struct timespec ts_start, ts_end;
+#endif
+
+	pr_info("%s: update_type=%d, res=%d\n", __func__, update_type, res);
+
+	v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+		NOTIFY_ISPIF_STREAM, (void *)ISPIF_STREAM(
+		PIX_0, ISPIF_OFF_IMMEDIATELY));
+
+	msleep(30);
+	if (update_type == MSM_SENSOR_REG_INIT) {
+		mutex_lock(s_ctrl->sensor_first_mutex);  
+
+		tsk_sensor_init = kthread_create(oem_sensor_init_ov, s_ctrl, "oem_sensor_init_ov");
+		if (IS_ERR(tsk_sensor_init)) {
+			pr_err("%s: kthread_create failed", __func__);
+			rc = PTR_ERR(tsk_sensor_init);
+			tsk_sensor_init = NULL;
+			mutex_unlock(s_ctrl->sensor_first_mutex);  
+		} else
+			wake_up_process(tsk_sensor_init);
+		first_init = 1;
+		
+	} else if (update_type == MSM_SENSOR_UPDATE_PERIODIC) {
+	
+		mutex_lock(s_ctrl->sensor_first_mutex);
+		
+		if(!first_init)
+			mdelay(50);
+		first_init = 0;
+
+		if (s_ctrl->curr_csi_params != s_ctrl->csi_params[res]) {
+			s_ctrl->curr_csi_params = s_ctrl->csi_params[res];
+			s_ctrl->curr_csi_params->csid_params.lane_assign =
+				s_ctrl->sensordata->sensor_platform_info->
+				csi_lane_params->csi_lane_assign;
+			s_ctrl->curr_csi_params->csiphy_params.lane_mask =
+				s_ctrl->sensordata->sensor_platform_info->
+				csi_lane_params->csi_lane_mask;
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSID_CFG,
+				&s_ctrl->curr_csi_params->csid_params);
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+						NOTIFY_CID_CHANGE, NULL);
+			mb();
+			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+				NOTIFY_CSIPHY_CFG,
+				&s_ctrl->curr_csi_params->csiphy_params);
+			mb();
+			msleep(20);
+		}
+
+#ifdef CONFIG_RAWCHIP
+			if (s_ctrl->sensordata->use_rawchip) {
+
+				pr_info("%s: use_rawchip\n", __func__);
+
+				rawchip_data.sensor_name = s_ctrl->sensordata->sensor_name;
+				rawchip_data.datatype = s_ctrl->curr_csi_params->csid_params.lut_params.vc_cfg->dt;
+				rawchip_data.lane_cnt = s_ctrl->curr_csi_params->csid_params.lane_cnt;
+				rawchip_data.pixel_clk = s_ctrl->msm_sensor_reg->output_settings[res].op_pixel_clk;
+				rawchip_data.mirror_flip = s_ctrl->mirror_flip;
+
+				rawchip_data.width = s_ctrl->msm_sensor_reg->output_settings[res].x_output;
+				rawchip_data.height = s_ctrl->msm_sensor_reg->output_settings[res].y_output;
+				rawchip_data.line_length_pclk = s_ctrl->msm_sensor_reg->output_settings[res].line_length_pclk;
+				rawchip_data.frame_length_lines = s_ctrl->msm_sensor_reg->output_settings[res].frame_length_lines;
+				rawchip_data.x_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_start;
+				rawchip_data.y_addr_start = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_start;
+				rawchip_data.x_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].x_addr_end;
+				rawchip_data.y_addr_end = s_ctrl->msm_sensor_reg->output_settings[res].y_addr_end;
+				rawchip_data.x_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_even_inc;
+				rawchip_data.x_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].x_odd_inc;
+				rawchip_data.y_even_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_even_inc;
+				rawchip_data.y_odd_inc = s_ctrl->msm_sensor_reg->output_settings[res].y_odd_inc;
+				rawchip_data.binning_rawchip = s_ctrl->msm_sensor_reg->output_settings[res].binning_rawchip;
+
+				rawchip_data.fullsize_width = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].x_output;
+				rawchip_data.fullsize_height = s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].y_output;
+				rawchip_data.fullsize_line_length_pclk =
+					s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].line_length_pclk;
+				rawchip_data.fullsize_frame_length_lines =
+					s_ctrl->msm_sensor_reg->output_settings[MSM_SENSOR_RES_FULL].frame_length_lines;
+				rawchip_data.use_rawchip = s_ctrl->sensordata->use_rawchip;
+
+				ktime_get_ts(&ts_start);
+				rawchip_set_size(rawchip_data);
+				ktime_get_ts(&ts_end);
+				pr_info("%s: %ld ms\n", __func__,
+					(ts_end.tv_sec-ts_start.tv_sec)*1000+(ts_end.tv_nsec-ts_start.tv_nsec)/1000000);
+			}
+#endif
+
+		msm_sensor_write_res_settings(s_ctrl, res);
+
+		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+			NOTIFY_PCLK_CHANGE, &s_ctrl->msm_sensor_reg->
+			output_settings[res].op_pixel_clk);
+		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
+			NOTIFY_ISPIF_STREAM, (void *)ISPIF_STREAM(
+			PIX_0, ISPIF_ON_FRAME_BOUNDARY));
+		s_ctrl->func_tbl->sensor_start_stream(s_ctrl);
+		msleep(30);
+		
+		mutex_unlock(s_ctrl->sensor_first_mutex);
 	}
 	return rc;
 }
@@ -305,6 +1092,8 @@
 	int mode, int res)
 {
 	int32_t rc = 0;
+	pr_info("%s, res=%d, mode=%d\n", __func__, res, mode);
+
 	if (s_ctrl->curr_res != res) {
 		s_ctrl->curr_frame_length_lines =
 			s_ctrl->msm_sensor_reg->
@@ -314,14 +1103,8 @@
 			s_ctrl->msm_sensor_reg->
 			output_settings[res].line_length_pclk;
 
-		if (s_ctrl->is_csic ||
-			!s_ctrl->sensordata->csi_if)
-			rc = s_ctrl->func_tbl->sensor_csi_setting(s_ctrl,
-				MSM_SENSOR_UPDATE_PERIODIC, res);
-		else
-			rc = s_ctrl->func_tbl->sensor_setting(s_ctrl,
-				MSM_SENSOR_UPDATE_PERIODIC, res);
-		if (rc < 0)
+		if (s_ctrl->func_tbl->sensor_setting
+			(s_ctrl, MSM_SENSOR_UPDATE_PERIODIC, res) < 0)
 			return rc;
 		s_ctrl->curr_res = res;
 	}
@@ -335,19 +1118,14 @@
 	int32_t rc = 0;
 	s_ctrl->fps_divider = Q10;
 	s_ctrl->cam_mode = MSM_SENSOR_MODE_INVALID;
+	pr_info("%s called\n", __func__);
 
-	CDBG("%s: %d\n", __func__, __LINE__);
 	if (mode != s_ctrl->cam_mode) {
 		s_ctrl->curr_res = MSM_SENSOR_INVALID_RES;
 		s_ctrl->cam_mode = mode;
 
-		if (s_ctrl->is_csic ||
-			!s_ctrl->sensordata->csi_if)
-			rc = s_ctrl->func_tbl->sensor_csi_setting(s_ctrl,
-				MSM_SENSOR_REG_INIT, 0);
-		else
-			rc = s_ctrl->func_tbl->sensor_setting(s_ctrl,
-				MSM_SENSOR_REG_INIT, 0);
+		rc = s_ctrl->func_tbl->sensor_setting(s_ctrl,
+			MSM_SENSOR_REG_INIT, 0);
 	}
 	return rc;
 }
@@ -356,7 +1134,19 @@
 		struct sensor_output_info_t *sensor_output_info)
 {
 	int rc = 0;
+	CDBG("%s: called\n", __func__);
+
 	sensor_output_info->num_info = s_ctrl->msm_sensor_reg->num_conf;
+	sensor_output_info->vert_offset = s_ctrl->sensor_exp_gain_info->vert_offset;
+	sensor_output_info->min_vert = s_ctrl->sensor_exp_gain_info->min_vert;
+	sensor_output_info->mirror_flip = s_ctrl->mirror_flip;
+
+
+	
+	if(s_ctrl->sensor_exp_gain_info->sensor_max_linecount == 0)
+		s_ctrl->sensor_exp_gain_info->sensor_max_linecount = 0xFFFFFFFF;
+
+	sensor_output_info->sensor_max_linecount = s_ctrl->sensor_exp_gain_info->sensor_max_linecount;
 	if (copy_to_user((void *)sensor_output_info->output_info,
 		s_ctrl->msm_sensor_reg->output_settings,
 		sizeof(struct msm_sensor_output_info_t) *
@@ -366,10 +1156,22 @@
 	return rc;
 }
 
-static int32_t msm_sensor_release(struct msm_sensor_ctrl_t *s_ctrl)
+int32_t msm_sensor_release(struct msm_sensor_ctrl_t *s_ctrl)
 {
-	CDBG("%s called\n", __func__);
+	long fps = 0;
+	uint32_t delay = 0;
+	pr_info("%s: called\n", __func__);
+
 	s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
+	if (s_ctrl->curr_res != MSM_SENSOR_INVALID_RES) {
+		fps = s_ctrl->msm_sensor_reg->
+			output_settings[s_ctrl->curr_res].vt_pixel_clk /
+			s_ctrl->curr_frame_length_lines /
+			s_ctrl->curr_line_length_pclk;
+		delay = 1000 / fps;
+		CDBG("%s fps = %ld, delay = %d\n", __func__, fps, delay);
+		msleep(delay);
+	}
 	return 0;
 }
 
@@ -378,45 +1180,20 @@
 {
 	struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(sd);
 	void __user *argp = (void __user *)arg;
-	if (s_ctrl->sensor_state == MSM_SENSOR_POWER_DOWN)
-		return -EINVAL;
+	CDBG("%s: cmd = %d\n", __func__, cmd);
+
 	switch (cmd) {
 	case VIDIOC_MSM_SENSOR_CFG:
 		return s_ctrl->func_tbl->sensor_config(s_ctrl, argp);
+
 	case VIDIOC_MSM_SENSOR_RELEASE:
 		return msm_sensor_release(s_ctrl);
-	case VIDIOC_MSM_SENSOR_CSID_INFO: {
-		struct msm_sensor_csi_info *csi_info =
-			(struct msm_sensor_csi_info *)arg;
-		s_ctrl->is_csic = csi_info->is_csic;
-		return 0;
-	}
+
 	default:
 		return -ENOIOCTLCMD;
 	}
 }
 
-int32_t msm_sensor_get_csi_params(struct msm_sensor_ctrl_t *s_ctrl,
-		struct csi_lane_params_t *sensor_output_info)
-{
-	uint8_t index;
-	struct msm_camera_csi_lane_params *csi_lane_params =
-		s_ctrl->sensordata->sensor_platform_info->csi_lane_params;
-	if (csi_lane_params) {
-		sensor_output_info->csi_lane_assign = csi_lane_params->
-			csi_lane_assign;
-		sensor_output_info->csi_lane_mask = csi_lane_params->
-			csi_lane_mask;
-		sensor_output_info->csi_phy_sel = csi_lane_params->csi_phy_sel;
-	}
-	sensor_output_info->csi_if = s_ctrl->sensordata->csi_if;
-	for (index = 0; index < sensor_output_info->csi_if; index++)
-		sensor_output_info->csid_core[index] = s_ctrl->sensordata->
-			pdata[index].csid_core;
-
-	return 0;
-}
-
 int32_t msm_sensor_config(struct msm_sensor_ctrl_t *s_ctrl, void __user *argp)
 {
 	struct sensor_cfg_data cdata;
@@ -426,9 +1203,9 @@
 		sizeof(struct sensor_cfg_data)))
 		return -EFAULT;
 	mutex_lock(s_ctrl->msm_sensor_mutex);
-	CDBG("%s:%d %s cfgtype = %d\n", __func__, __LINE__,
-		s_ctrl->sensordata->sensor_name, cdata.cfgtype);
-	switch (cdata.cfgtype) {
+	CDBG("%s: msm_sensor_config: cfgtype = %d\n", __func__, cdata.cfgtype);
+
+		switch (cdata.cfgtype) {
 		case CFG_SET_FPS:
 		case CFG_SET_PICT_FPS:
 			if (s_ctrl->func_tbl->
@@ -443,41 +1220,37 @@
 			break;
 
 		case CFG_SET_EXP_GAIN:
-			if(s_ctrl->vision_mode_flag) {
-				break;
-			}
 			if (s_ctrl->func_tbl->
-			sensor_write_exp_gain == NULL) {
+			sensor_write_exp_gain_ex == NULL) {
 				rc = -EFAULT;
 				break;
 			}
 			rc =
 				s_ctrl->func_tbl->
-				sensor_write_exp_gain(
+				sensor_write_exp_gain_ex(
 					s_ctrl,
+					cdata.mode, 
 					cdata.cfg.exp_gain.gain,
-					cdata.cfg.exp_gain.line,
-					cdata.cfg.exp_gain.luma_avg,
-					cdata.cfg.exp_gain.fgain);
+					cdata.cfg.exp_gain.dig_gain, 
+					cdata.cfg.exp_gain.line);
+			s_ctrl->prev_gain = cdata.cfg.exp_gain.gain;
+			s_ctrl->prev_line = cdata.cfg.exp_gain.line;					
 			break;
 
 		case CFG_SET_PICT_EXP_GAIN:
-			if(s_ctrl->vision_mode_flag) {
-				break;
-			}
 			if (s_ctrl->func_tbl->
-			sensor_write_snapshot_exp_gain == NULL) {
+			sensor_write_snapshot_exp_gain_ex == NULL) {
 				rc = -EFAULT;
 				break;
 			}
 			rc =
 				s_ctrl->func_tbl->
-				sensor_write_snapshot_exp_gain(
+				sensor_write_snapshot_exp_gain_ex(
 					s_ctrl,
+					cdata.mode, 
 					cdata.cfg.exp_gain.gain,
-					cdata.cfg.exp_gain.line,
-					cdata.cfg.exp_gain.luma_avg,
-					cdata.cfg.exp_gain.fgain);
+					cdata.cfg.exp_gain.dig_gain, 
+					cdata.cfg.exp_gain.line);
 			break;
 
 		case CFG_SET_MODE:
@@ -496,18 +1269,6 @@
 		case CFG_SET_EFFECT:
 			break;
 
-		case CFG_HDR_UPDATE:
-			if (s_ctrl->func_tbl->
-			sensor_hdr_update == NULL) {
-				rc = -EFAULT;
-				break;
-			}
-			rc = s_ctrl->func_tbl->
-					sensor_hdr_update(
-					   s_ctrl,
-					   &(cdata.cfg.hdr_update_parm));
-			break;
-
 		case CFG_SENSOR_INIT:
 			if (s_ctrl->func_tbl->
 			sensor_mode_init == NULL) {
@@ -538,67 +1299,37 @@
 				rc = -EFAULT;
 			break;
 
-		case CFG_START_STREAM:
-			if (s_ctrl->func_tbl->sensor_start_stream == NULL) {
+		case CFG_GET_EEPROM_DATA:
+			if (s_ctrl->sensor_eeprom_client == NULL ||
+				s_ctrl->sensor_eeprom_client->
+				func_tbl.eeprom_get_data == NULL) {
 				rc = -EFAULT;
 				break;
 			}
-			s_ctrl->func_tbl->sensor_start_stream(s_ctrl);
-			break;
-
-		case CFG_STOP_STREAM:
-			if (s_ctrl->func_tbl->sensor_stop_stream == NULL) {
-				rc = -EFAULT;
-				break;
-			}
-			s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
-			break;
-
-		case CFG_GET_CSI_PARAMS:
-			if (s_ctrl->func_tbl->sensor_get_csi_params == NULL) {
-				rc = -EFAULT;
-				break;
-			}
-			rc = s_ctrl->func_tbl->sensor_get_csi_params(
-				s_ctrl,
-				&cdata.cfg.csi_lane_params);
+			rc = s_ctrl->sensor_eeprom_client->
+				func_tbl.eeprom_get_data(
+				s_ctrl->sensor_eeprom_client,
+				&cdata.cfg.eeprom_data);
 
 			if (copy_to_user((void *)argp,
 				&cdata,
-				sizeof(struct sensor_cfg_data)))
+				sizeof(struct sensor_eeprom_data_t)))
 				rc = -EFAULT;
 			break;
-
-		case CFG_POWER_UP:
-			pr_err("%s calling power up\n", __func__);
-			if (s_ctrl->func_tbl->sensor_power_up)
-				rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
-			else
-				rc = -EFAULT;
-			break;
-
-		case CFG_POWER_DOWN:
-			if (s_ctrl->func_tbl->sensor_power_down)
-				rc = s_ctrl->func_tbl->sensor_power_down(
-					s_ctrl);
-			else
-				rc = -EFAULT;
-			break;
-		case CFG_SET_VISION_MODE:
-			if (s_ctrl->func_tbl->sensor_set_vision_mode)
-				rc = s_ctrl->func_tbl->sensor_set_vision_mode(
-					s_ctrl, cdata.cfg.vision_mode_enable);
-			else
+		
+		case CFG_I2C_IOCTL_R_OTP:{
+			pr_info("Line:%d CFG_I2C_IOCTL_R_OTP \n", __LINE__);
+			if (s_ctrl->func_tbl->sensor_i2c_read_fuseid == NULL) {
 				rc = -EFAULT;
 				break;
-		case CFG_SET_VISION_AE:
-			if (s_ctrl->func_tbl->sensor_set_vision_ae_control)
-				rc = s_ctrl->func_tbl->
-					sensor_set_vision_ae_control(
-					s_ctrl, cdata.cfg.vision_ae);
-			else
-				rc = -EFAULT;
-			break;
+			}
+			rc = s_ctrl->func_tbl->sensor_i2c_read_fuseid(&cdata, s_ctrl);
+			if (copy_to_user(argp, &cdata, sizeof(struct sensor_cfg_data)))
+			rc = -EFAULT;
+		}
+		break;
+		
+
 		default:
 			rc = -EFAULT;
 			break;
@@ -609,19 +1340,16 @@
 	return rc;
 }
 
-static struct msm_cam_clk_info cam_8960_clk_info[] = {
+static struct msm_cam_clk_info cam_clk_info[] = {
 	{"cam_clk", MSM_SENSOR_MCLK_24HZ},
 };
 
-static struct msm_cam_clk_info cam_8974_clk_info[] = {
-	{"cam_src_clk", 19200000},
-	{"cam_clk", -1},
-};
-
 int32_t msm_sensor_enable_i2c_mux(struct msm_camera_i2c_conf *i2c_conf)
 {
 	struct v4l2_subdev *i2c_mux_sd =
 		dev_get_drvdata(&i2c_conf->mux_dev->dev);
+	CDBG("%s: called\n", __func__);
+
 	v4l2_subdev_call(i2c_mux_sd, core, ioctl,
 		VIDIOC_MSM_I2C_MUX_INIT, NULL);
 	v4l2_subdev_call(i2c_mux_sd, core, ioctl,
@@ -633,869 +1361,23 @@
 {
 	struct v4l2_subdev *i2c_mux_sd =
 		dev_get_drvdata(&i2c_conf->mux_dev->dev);
+	CDBG("%s: called\n", __func__);
+
 	v4l2_subdev_call(i2c_mux_sd, core, ioctl,
 				VIDIOC_MSM_I2C_MUX_RELEASE, NULL);
 	return 0;
 }
 
-static int32_t msm_sensor_init_flash_data(struct device_node *of_node,
-	struct  msm_camera_sensor_info *sensordata)
-{
-	int32_t rc = 0;
-	uint32_t val = 0;
-
-	sensordata->flash_data = kzalloc(sizeof(
-		struct msm_camera_sensor_flash_data), GFP_KERNEL);
-	if (!sensordata->flash_data) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		return -ENOMEM;
-	}
-
-	rc = of_property_read_u32(of_node, "qcom,flash-type", &val);
-	CDBG("%s qcom,flash-type %d, rc %d\n", __func__, val, rc);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR;
-	}
-	sensordata->flash_data->flash_type = val;
-	return rc;
-ERROR:
-	kfree(sensordata->flash_data);
-	return rc;
-}
-
-static int32_t msm_sensor_init_vreg_data(struct device_node *of_node,
-	struct msm_camera_sensor_platform_info *pinfo)
-{
-	int32_t rc = 0, i = 0;
-	uint32_t count = 0;
-	uint32_t *val_array = NULL;
-
-	count = of_property_count_strings(of_node, "qcom,cam-vreg-name");
-	CDBG("%s qcom,cam-vreg-name count %d\n", __func__, count);
-
-	if (!count)
-		return 0;
-
-	pinfo->cam_vreg = kzalloc(sizeof(struct camera_vreg_t) * count,
-		GFP_KERNEL);
-	if (!pinfo->cam_vreg) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		return -ENOMEM;
-	}
-
-	pinfo->num_vreg = count;
-	for (i = 0; i < count; i++) {
-		rc = of_property_read_string_index(of_node,
-			"qcom,cam-vreg-name", i, &pinfo->cam_vreg[i].reg_name);
-		CDBG("%s reg_name[%d] = %s\n", __func__, i,
-			pinfo->cam_vreg[i].reg_name);
-		if (rc < 0) {
-			pr_err("%s failed %d\n", __func__, __LINE__);
-			goto ERROR1;
-		}
-	}
-
-	val_array = kzalloc(sizeof(uint32_t) * count, GFP_KERNEL);
-	if (!val_array) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR1;
-	}
-
-	rc = of_property_read_u32_array(of_node, "qcom,cam-vreg-type",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		pinfo->cam_vreg[i].type = val_array[i];
-		CDBG("%s cam_vreg[%d].type = %d\n", __func__, i,
-			pinfo->cam_vreg[i].type);
-	}
-
-	rc = of_property_read_u32_array(of_node, "qcom,cam-vreg-min-voltage",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		pinfo->cam_vreg[i].min_voltage = val_array[i];
-		CDBG("%s cam_vreg[%d].min_voltage = %d\n", __func__,
-			i, pinfo->cam_vreg[i].min_voltage);
-	}
-
-	rc = of_property_read_u32_array(of_node, "qcom,cam-vreg-max-voltage",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		pinfo->cam_vreg[i].max_voltage = val_array[i];
-		CDBG("%s cam_vreg[%d].max_voltage = %d\n", __func__,
-			i, pinfo->cam_vreg[i].max_voltage);
-	}
-
-	rc = of_property_read_u32_array(of_node, "qcom,cam-vreg-op-mode",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		pinfo->cam_vreg[i].op_mode = val_array[i];
-		CDBG("%s cam_vreg[%d].op_mode = %d\n", __func__, i,
-			pinfo->cam_vreg[i].op_mode);
-	}
-
-	kfree(val_array);
-	return rc;
-ERROR2:
-	kfree(val_array);
-ERROR1:
-	kfree(pinfo->cam_vreg);
-	pinfo->num_vreg = 0;
-	return rc;
-}
-
-static int32_t msm_sensor_init_gpio_common_tbl_data(struct device_node *of_node,
-	struct msm_camera_gpio_conf *gconf, uint16_t *gpio_array,
-	uint16_t gpio_array_size)
-{
-	int32_t rc = 0, i = 0;
-	uint32_t count = 0;
-	uint32_t *val_array = NULL;
-
-	if (!of_get_property(of_node, "qcom,gpio-common-tbl-num", &count))
-		return 0;
-
-	count /= sizeof(uint32_t);
-	if (!count) {
-		pr_err("%s qcom,gpio-common-tbl-num 0\n", __func__);
-		return 0;
-	} else if (count > gpio_array_size) {
-		pr_err("%s gpio common tbl size exceeds gpio array\n",
-			__func__);
-		return -EFAULT;
-	}
-
-	val_array = kzalloc(sizeof(uint32_t) * count, GFP_KERNEL);
-	if (!val_array) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		return -ENOMEM;
-	}
-
-	gconf->cam_gpio_common_tbl = kzalloc(sizeof(struct gpio) * count,
-		GFP_KERNEL);
-	if (!gconf->cam_gpio_common_tbl) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR1;
-	}
-	gconf->cam_gpio_common_tbl_size = count;
-
-	rc = of_property_read_u32_array(of_node, "qcom,gpio-common-tbl-num",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		if (val_array[i] >= gpio_array_size) {
-			pr_err("%s gpio common tbl index %d invalid\n",
-				__func__, val_array[i]);
-			return -EINVAL;
-		}
-		gconf->cam_gpio_common_tbl[i].gpio = gpio_array[val_array[i]];
-		CDBG("%s cam_gpio_common_tbl[%d].gpio = %d\n", __func__, i,
-			gconf->cam_gpio_common_tbl[i].gpio);
-	}
-
-	rc = of_property_read_u32_array(of_node, "qcom,gpio-common-tbl-flags",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		gconf->cam_gpio_common_tbl[i].flags = val_array[i];
-		CDBG("%s cam_gpio_common_tbl[%d].flags = %ld\n", __func__, i,
-			gconf->cam_gpio_common_tbl[i].flags);
-	}
-
-	for (i = 0; i < count; i++) {
-		rc = of_property_read_string_index(of_node,
-			"qcom,gpio-common-tbl-label", i,
-			&gconf->cam_gpio_common_tbl[i].label);
-		CDBG("%s cam_gpio_common_tbl[%d].label = %s\n", __func__, i,
-			gconf->cam_gpio_common_tbl[i].label);
-		if (rc < 0) {
-			pr_err("%s failed %d\n", __func__, __LINE__);
-			goto ERROR2;
-		}
-	}
-
-	kfree(val_array);
-	return rc;
-
-ERROR2:
-	kfree(gconf->cam_gpio_common_tbl);
-ERROR1:
-	kfree(val_array);
-	gconf->cam_gpio_common_tbl_size = 0;
-	return rc;
-}
-
-static int32_t msm_sensor_init_gpio_req_tbl_data(struct device_node *of_node,
-	struct msm_camera_gpio_conf *gconf, uint16_t *gpio_array,
-	uint16_t gpio_array_size)
-{
-	int32_t rc = 0, i = 0;
-	uint32_t count = 0;
-	uint32_t *val_array = NULL;
-
-	if (!of_get_property(of_node, "qcom,gpio-req-tbl-num", &count))
-		return 0;
-
-	count /= sizeof(uint32_t);
-	if (!count) {
-		pr_err("%s qcom,gpio-req-tbl-num 0\n", __func__);
-		return 0;
-	}
-
-	val_array = kzalloc(sizeof(uint32_t) * count, GFP_KERNEL);
-	if (!val_array) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		return -ENOMEM;
-	}
-
-	gconf->cam_gpio_req_tbl = kzalloc(sizeof(struct gpio) * count,
-		GFP_KERNEL);
-	if (!gconf->cam_gpio_req_tbl) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR1;
-	}
-	gconf->cam_gpio_req_tbl_size = count;
-
-	rc = of_property_read_u32_array(of_node, "qcom,gpio-req-tbl-num",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		if (val_array[i] >= gpio_array_size) {
-			pr_err("%s gpio req tbl index %d invalid\n",
-				__func__, val_array[i]);
-			return -EINVAL;
-		}
-		gconf->cam_gpio_req_tbl[i].gpio = gpio_array[val_array[i]];
-		CDBG("%s cam_gpio_req_tbl[%d].gpio = %d\n", __func__, i,
-			gconf->cam_gpio_req_tbl[i].gpio);
-	}
-
-	rc = of_property_read_u32_array(of_node, "qcom,gpio-req-tbl-flags",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		gconf->cam_gpio_req_tbl[i].flags = val_array[i];
-		CDBG("%s cam_gpio_req_tbl[%d].flags = %ld\n", __func__, i,
-			gconf->cam_gpio_req_tbl[i].flags);
-	}
-
-	for (i = 0; i < count; i++) {
-		rc = of_property_read_string_index(of_node,
-			"qcom,gpio-req-tbl-label", i,
-			&gconf->cam_gpio_req_tbl[i].label);
-		CDBG("%s cam_gpio_req_tbl[%d].label = %s\n", __func__, i,
-			gconf->cam_gpio_req_tbl[i].label);
-		if (rc < 0) {
-			pr_err("%s failed %d\n", __func__, __LINE__);
-			goto ERROR2;
-		}
-	}
-
-	kfree(val_array);
-	return rc;
-
-ERROR2:
-	kfree(gconf->cam_gpio_req_tbl);
-ERROR1:
-	kfree(val_array);
-	gconf->cam_gpio_req_tbl_size = 0;
-	return rc;
-}
-
-static int32_t msm_sensor_init_gpio_set_tbl_data(struct device_node *of_node,
-	struct msm_camera_gpio_conf *gconf, uint16_t *gpio_array,
-	uint16_t gpio_array_size)
-{
-	int32_t rc = 0, i = 0;
-	uint32_t count = 0;
-	uint32_t *val_array = NULL;
-
-	if (!of_get_property(of_node, "qcom,gpio-set-tbl-num", &count))
-		return 0;
-
-	count /= sizeof(uint32_t);
-	if (!count) {
-		pr_err("%s qcom,gpio-set-tbl-num 0\n", __func__);
-		return 0;
-	}
-
-	val_array = kzalloc(sizeof(uint32_t) * count, GFP_KERNEL);
-	if (!val_array) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		return -ENOMEM;
-	}
-
-	gconf->cam_gpio_set_tbl = kzalloc(sizeof(struct msm_gpio_set_tbl) *
-		count, GFP_KERNEL);
-	if (!gconf->cam_gpio_set_tbl) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR1;
-	}
-	gconf->cam_gpio_set_tbl_size = count;
-
-	rc = of_property_read_u32_array(of_node, "qcom,gpio-set-tbl-num",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		if (val_array[i] >= gpio_array_size) {
-			pr_err("%s gpio set tbl index %d invalid\n",
-				__func__, val_array[i]);
-			return -EINVAL;
-		}
-		gconf->cam_gpio_set_tbl[i].gpio = gpio_array[val_array[i]];
-		CDBG("%s cam_gpio_set_tbl[%d].gpio = %d\n", __func__, i,
-			gconf->cam_gpio_set_tbl[i].gpio);
-	}
-
-	rc = of_property_read_u32_array(of_node, "qcom,gpio-set-tbl-flags",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		gconf->cam_gpio_set_tbl[i].flags = val_array[i];
-		CDBG("%s cam_gpio_set_tbl[%d].flags = %ld\n", __func__, i,
-			gconf->cam_gpio_set_tbl[i].flags);
-	}
-
-	rc = of_property_read_u32_array(of_node, "qcom,gpio-set-tbl-delay",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		gconf->cam_gpio_set_tbl[i].delay = val_array[i];
-		CDBG("%s cam_gpio_set_tbl[%d].delay = %d\n", __func__, i,
-			gconf->cam_gpio_set_tbl[i].delay);
-	}
-
-	kfree(val_array);
-	return rc;
-
-ERROR2:
-	kfree(gconf->cam_gpio_set_tbl);
-ERROR1:
-	kfree(val_array);
-	gconf->cam_gpio_set_tbl_size = 0;
-	return rc;
-}
-
-static int32_t msm_sensor_init_gpio_tlmm_tbl_data(struct device_node *of_node,
-	struct msm_camera_gpio_conf *gconf, uint16_t *gpio_array,
-	uint16_t gpio_array_size)
-{
-	int32_t rc = 0, i = 0;
-	uint32_t count = 0;
-	uint32_t *val_array = NULL;
-	struct gpio_tlmm_cfg *tlmm_cfg = NULL;
-
-	if (!of_get_property(of_node, "gpio_tlmm_table_num", &count))
-		return 0;
-
-	count /= sizeof(uint32_t);
-
-	if (!count)
-		return 0;
-
-	val_array = kzalloc(sizeof(uint32_t) * count, GFP_KERNEL);
-	if (!val_array) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		return -ENOMEM;
-	}
-
-	tlmm_cfg = kzalloc(sizeof(struct gpio_tlmm_cfg) * count, GFP_KERNEL);
-	if (!tlmm_cfg) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR1;
-	}
-
-	gconf->camera_off_table = kzalloc(sizeof(uint32_t) * count, GFP_KERNEL);
-	if (!gconf->camera_off_table) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR2;
-	}
-	gconf->camera_off_table_size = count;
-
-	gconf->camera_on_table = kzalloc(sizeof(uint32_t) * count, GFP_KERNEL);
-	if (!gconf->camera_on_table) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR3;
-	}
-	gconf->camera_on_table_size = count;
-
-	rc = of_property_read_u32_array(of_node, "gpio_tlmm_table_num",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR4;
-	}
-	for (i = 0; i < count; i++) {
-		if (val_array[i] >= gpio_array_size) {
-			pr_err("%s gpio set tbl index %d invalid\n",
-				__func__, val_array[i]);
-			return -EINVAL;
-		}
-		tlmm_cfg[i].gpio = gpio_array[val_array[i]];
-		CDBG("%s tlmm_cfg[%d].gpio = %d\n", __func__, i,
-			tlmm_cfg[i].gpio);
-	}
-
-	rc = of_property_read_u32_array(of_node, "gpio_tlmm_table_dir",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR4;
-	}
-	for (i = 0; i < count; i++) {
-		tlmm_cfg[i].dir = val_array[i];
-		CDBG("%s tlmm_cfg[%d].dir = %d\n", __func__, i,
-			tlmm_cfg[i].dir);
-	}
-
-	rc = of_property_read_u32_array(of_node, "gpio_tlmm_table_pull",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR4;
-	}
-	for (i = 0; i < count; i++) {
-		tlmm_cfg[i].pull = val_array[i];
-		CDBG("%s tlmm_cfg[%d].pull = %d\n", __func__, i,
-			tlmm_cfg[i].pull);
-	}
-
-	rc = of_property_read_u32_array(of_node, "gpio_tlmm_table_drvstr",
-		val_array, count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR4;
-	}
-	for (i = 0; i < count; i++) {
-		tlmm_cfg[i].drvstr = val_array[i];
-		CDBG("%s tlmm_cfg[%d].drvstr = %d\n", __func__, i,
-			tlmm_cfg[i].drvstr);
-	}
-
-	for (i = 0; i < count; i++) {
-		gconf->camera_off_table[i] = GPIO_CFG(tlmm_cfg[i].gpio,
-			0, tlmm_cfg[i].dir, tlmm_cfg[i].pull,
-			tlmm_cfg[i].drvstr);
-		gconf->camera_on_table[i] = GPIO_CFG(tlmm_cfg[i].gpio,
-			1, tlmm_cfg[i].dir, tlmm_cfg[i].pull,
-			tlmm_cfg[i].drvstr);
-	}
-
-	kfree(tlmm_cfg);
-	kfree(val_array);
-	return rc;
-
-ERROR4:
-	kfree(gconf->camera_on_table);
-ERROR3:
-	kfree(gconf->camera_off_table);
-ERROR2:
-	kfree(tlmm_cfg);
-ERROR1:
-	kfree(val_array);
-	gconf->camera_off_table_size = 0;
-	gconf->camera_on_table_size = 0;
-	return rc;
-}
-
-static int32_t msm_sensor_init_csi_data(struct device_node *of_node,
-	struct  msm_camera_sensor_info *sensordata)
-{
-	int32_t rc = 0, i = 0;
-	uint32_t count = 0, val = 0;
-	uint32_t *val_array = NULL;
-	struct msm_camera_sensor_platform_info *pinfo =
-		sensordata->sensor_platform_info;
-
-	rc = of_property_read_u32(of_node, "qcom,csi-if", &count);
-	CDBG("%s qcom,csi-if %d, rc %d\n", __func__, count, rc);
-	if (rc < 0 || !count)
-		return rc;
-	sensordata->csi_if = count;
-
-	sensordata->pdata = kzalloc(sizeof(
-		struct msm_camera_device_platform_data) * count, GFP_KERNEL);
-	if (!sensordata->pdata) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		return -ENOMEM;
-	}
-
-	val_array = kzalloc(sizeof(uint32_t) * count, GFP_KERNEL);
-	if (!val_array) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR1;
-	}
-
-	rc = of_property_read_u32_array(of_node, "qcom,csid-core", val_array,
-		count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		sensordata->pdata[i].csid_core = val_array[i];
-		CDBG("%s csi_data[%d].csid_core = %d\n", __func__, i,
-			sensordata->pdata[i].csid_core);
-	}
-
-	rc = of_property_read_u32_array(of_node, "qcom,is-vpe", val_array,
-		count);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-	for (i = 0; i < count; i++) {
-		sensordata->pdata[i].is_vpe = val_array[i];
-		CDBG("%s csi_data[%d].is_vpe = %d\n", __func__, i,
-			sensordata->pdata[i].is_vpe);
-	}
-
-	pinfo->csi_lane_params = kzalloc(
-		sizeof(struct msm_camera_csi_lane_params), GFP_KERNEL);
-	if (!pinfo->csi_lane_params) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR2;
-	}
-
-	rc = of_property_read_u32(of_node, "qcom,csi-lane-assign", &val);
-	CDBG("%s qcom,csi-lane-assign %x, rc %d\n", __func__, val, rc);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR3;
-	}
-	pinfo->csi_lane_params->csi_lane_assign = val;
-
-	rc = of_property_read_u32(of_node, "qcom,csi-lane-mask", &val);
-	CDBG("%s qcom,csi-lane-mask %x, rc %d\n", __func__, val, rc);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR3;
-	}
-	pinfo->csi_lane_params->csi_lane_mask = val;
-
-	rc = of_property_read_u32(of_node, "qcom,csi-phy-sel", &val);
-	CDBG("%s qcom,csi-phy-sel %x, rc %d\n", __func__, val, rc);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR3;
-	}
-	pinfo->csi_lane_params->csi_phy_sel = val;
-
-	kfree(val_array);
-	return rc;
-ERROR3:
-	kfree(pinfo->csi_lane_params);
-ERROR2:
-	kfree(val_array);
-ERROR1:
-	kfree(sensordata->pdata);
-	sensordata->csi_if = 0;
-	return rc;
-}
-static int32_t msm_sensor_init_actuator_data(struct device_node *of_node,
-	struct  msm_camera_sensor_info *sensordata)
-{
-	int32_t rc = 0;
-	uint32_t val = 0;
-
-	rc = of_property_read_u32(of_node, "qcom,actuator-cam-name", &val);
-	CDBG("%s qcom,actuator-cam-name %d, rc %d\n", __func__, val, rc);
-	if (rc < 0)
-		return 0;
-
-	sensordata->actuator_info = kzalloc(sizeof(struct msm_actuator_info),
-		GFP_KERNEL);
-	if (!sensordata->actuator_info) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR;
-	}
-
-	sensordata->actuator_info->cam_name = val;
-
-	rc = of_property_read_u32(of_node, "qcom,actuator-vcm-pwd", &val);
-	CDBG("%s qcom,actuator-vcm-pwd %d, rc %d\n", __func__, val, rc);
-	if (!rc)
-		sensordata->actuator_info->vcm_pwd = val;
-
-	rc = of_property_read_u32(of_node, "qcom,actuator-vcm-enable", &val);
-	CDBG("%s qcom,actuator-vcm-enable %d, rc %d\n", __func__, val, rc);
-	if (!rc)
-		sensordata->actuator_info->vcm_enable = val;
-
-	return 0;
-ERROR:
-	return rc;
-}
-
-static int32_t msm_sensor_init_sensor_data(struct platform_device *pdev,
-	struct msm_sensor_ctrl_t *s_ctrl)
-{
-	int32_t rc = 0, i = 0;
-	uint32_t val = 0;
-	struct device_node *of_node = pdev->dev.of_node;
-	struct msm_camera_sensor_platform_info *pinfo = NULL;
-	struct msm_camera_gpio_conf *gconf = NULL;
-	struct msm_camera_sensor_info *sensordata = NULL;
-	uint16_t *gpio_array = NULL;
-	uint16_t gpio_array_size = 0;
-
-	s_ctrl->sensordata = kzalloc(sizeof(struct msm_camera_sensor_info),
-		GFP_KERNEL);
-	if (!s_ctrl->sensordata) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		return -ENOMEM;
-	}
-
-	sensordata = s_ctrl->sensordata;
-
-	rc = of_property_read_string(of_node, "qcom,sensor-name",
-		&sensordata->sensor_name);
-	CDBG("%s qcom,sensor-name %s, rc %d\n", __func__,
-		sensordata->sensor_name, rc);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR1;
-	}
-
-	rc = of_property_read_u32(of_node, "qcom,camera-type", &val);
-	CDBG("%s qcom,camera-type %d, rc %d\n", __func__, val, rc);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR1;
-	}
-	sensordata->camera_type = val;
-
-	rc = of_property_read_u32(of_node, "qcom,sensor-type", &val);
-	CDBG("%s qcom,sensor-type %d, rc %d\n", __func__, val, rc);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR1;
-	}
-	sensordata->sensor_type = val;
-
-	rc = msm_sensor_init_flash_data(of_node, sensordata);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR1;
-	}
-
-	sensordata->sensor_platform_info = kzalloc(sizeof(
-		struct msm_camera_sensor_platform_info), GFP_KERNEL);
-	if (!sensordata->sensor_platform_info) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR1;
-	}
-
-	pinfo = sensordata->sensor_platform_info;
-
-	rc = of_property_read_u32(of_node, "qcom,mount-angle",
-		&pinfo->mount_angle);
-	CDBG("%s qcom,mount-angle %d, rc %d\n", __func__, pinfo->mount_angle,
-		rc);
-	if (rc < 0) {
-		/* Set default mount angle */
-		pinfo->mount_angle = 0;
-		rc = 0;
-	}
-
-	rc = msm_sensor_init_csi_data(of_node, sensordata);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR2;
-	}
-
-	rc = msm_sensor_init_vreg_data(of_node, pinfo);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR3;
-	}
-
-	pinfo->gpio_conf = kzalloc(sizeof(struct msm_camera_gpio_conf),
-		GFP_KERNEL);
-	if (!pinfo->gpio_conf) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		rc = -ENOMEM;
-		goto ERROR4;
-	}
-	gconf = pinfo->gpio_conf;
-	rc = of_property_read_u32(of_node, "qcom,gpio-no-mux",
-		&gconf->gpio_no_mux);
-	CDBG("%s gconf->gpio_no_mux %d, rc %d\n", __func__,
-		gconf->gpio_no_mux, rc);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR5;
-	}
-
-	gpio_array_size = of_gpio_count(of_node);
-	CDBG("%s gpio count %d\n", __func__, gpio_array_size);
-
-	if (gpio_array_size) {
-		gpio_array = kzalloc(sizeof(uint16_t) * gpio_array_size,
-			GFP_KERNEL);
-		if (!gpio_array) {
-			pr_err("%s failed %d\n", __func__, __LINE__);
-			goto ERROR5;
-		}
-		for (i = 0; i < gpio_array_size; i++) {
-			gpio_array[i] = of_get_gpio(of_node, i);
-			CDBG("%s gpio_array[%d] = %d\n", __func__, i,
-				gpio_array[i]);
-		}
-
-		rc = msm_sensor_init_gpio_common_tbl_data(of_node, gconf,
-			gpio_array, gpio_array_size);
-		if (rc < 0) {
-			pr_err("%s failed %d\n", __func__, __LINE__);
-			goto ERROR5;
-		}
-
-		rc = msm_sensor_init_gpio_req_tbl_data(of_node, gconf,
-			gpio_array, gpio_array_size);
-		if (rc < 0) {
-			pr_err("%s failed %d\n", __func__, __LINE__);
-			goto ERROR6;
-		}
-
-		rc = msm_sensor_init_gpio_set_tbl_data(of_node, gconf,
-			gpio_array, gpio_array_size);
-		if (rc < 0) {
-			pr_err("%s failed %d\n", __func__, __LINE__);
-			goto ERROR7;
-		}
-
-		rc = msm_sensor_init_gpio_tlmm_tbl_data(of_node, gconf,
-			gpio_array, gpio_array_size);
-		if (rc < 0) {
-			pr_err("%s failed %d\n", __func__, __LINE__);
-			goto ERROR8;
-		}
-	}
-	rc = msm_sensor_init_actuator_data(of_node, sensordata);
-	if (rc < 0) {
-		pr_err("%s failed %d\n", __func__, __LINE__);
-		goto ERROR9;
-	}
-
-	kfree(gpio_array);
-	return rc;
-
-ERROR9:
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf->
-		camera_on_table);
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf->
-		camera_off_table);
-ERROR8:
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf->
-		cam_gpio_set_tbl);
-ERROR7:
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf->
-		cam_gpio_req_tbl);
-ERROR6:
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf->
-		cam_gpio_common_tbl);
-ERROR5:
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf);
-ERROR4:
-	kfree(s_ctrl->sensordata->sensor_platform_info->cam_vreg);
-ERROR3:
-	kfree(s_ctrl->sensordata->sensor_platform_info->csi_lane_params);
-	kfree(s_ctrl->sensordata->pdata);
-ERROR2:
-	kfree(s_ctrl->sensordata->sensor_platform_info);
-	kfree(s_ctrl->sensordata->flash_data);
-ERROR1:
-	kfree(s_ctrl->sensordata);
-	kfree(gpio_array);
-	return rc;
-}
-
-int32_t msm_sensor_free_sensor_data(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	if (!s_ctrl->pdev)
-		return 0;
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf->
-		camera_on_table);
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf->
-		camera_off_table);
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf->
-		cam_gpio_set_tbl);
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf->
-		cam_gpio_req_tbl);
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf->
-		cam_gpio_common_tbl);
-	kfree(s_ctrl->sensordata->sensor_platform_info->gpio_conf);
-	kfree(s_ctrl->sensordata->sensor_platform_info->cam_vreg);
-	kfree(s_ctrl->sensordata->sensor_platform_info->csi_lane_params);
-	kfree(s_ctrl->sensordata->pdata);
-	kfree(s_ctrl->sensordata->sensor_platform_info);
-	kfree(s_ctrl->sensordata->flash_data);
-	kfree(s_ctrl->sensordata);
-	return 0;
-}
-
 int32_t msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
 {
 	int32_t rc = 0;
 	struct msm_camera_sensor_info *data = s_ctrl->sensordata;
-	struct device *dev = NULL;
-	if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE)
-		dev = &s_ctrl->pdev->dev;
-	else
-		dev = &s_ctrl->sensor_i2c_client->client->dev;
+	CDBG("%s: called\n", __func__);
+
 	s_ctrl->reg_ptr = kzalloc(sizeof(struct regulator *)
 			* data->sensor_platform_info->num_vreg, GFP_KERNEL);
 	if (!s_ctrl->reg_ptr) {
-		pr_err("%s: could not allocate mem for regulators\n",
-			__func__);
+		pr_err("%s: failed to could not allocate mem for regulators\n", __func__);
 		return -ENOMEM;
 	}
 
@@ -1505,23 +1387,19 @@
 		goto request_gpio_failed;
 	}
 
-	rc = msm_camera_config_vreg(dev,
-		s_ctrl->sensordata->sensor_platform_info->cam_vreg,
-		s_ctrl->sensordata->sensor_platform_info->num_vreg,
-		s_ctrl->vreg_seq,
-		s_ctrl->num_vreg_seq,
-		s_ctrl->reg_ptr, 1);
+	rc = msm_camera_config_vreg(&s_ctrl->sensor_i2c_client->client->dev,
+			s_ctrl->sensordata->sensor_platform_info->cam_vreg,
+			s_ctrl->sensordata->sensor_platform_info->num_vreg,
+			s_ctrl->reg_ptr, 1);
 	if (rc < 0) {
 		pr_err("%s: regulator on failed\n", __func__);
 		goto config_vreg_failed;
 	}
 
-	rc = msm_camera_enable_vreg(dev,
-		s_ctrl->sensordata->sensor_platform_info->cam_vreg,
-		s_ctrl->sensordata->sensor_platform_info->num_vreg,
-		s_ctrl->vreg_seq,
-		s_ctrl->num_vreg_seq,
-		s_ctrl->reg_ptr, 1);
+	rc = msm_camera_enable_vreg(&s_ctrl->sensor_i2c_client->client->dev,
+			s_ctrl->sensordata->sensor_platform_info->cam_vreg,
+			s_ctrl->sensordata->sensor_platform_info->num_vreg,
+			s_ctrl->reg_ptr, 1);
 	if (rc < 0) {
 		pr_err("%s: enable regulator failed\n", __func__);
 		goto enable_vreg_failed;
@@ -1533,33 +1411,17 @@
 		goto config_gpio_failed;
 	}
 
-	if (s_ctrl->sensor_device_type == MSM_SENSOR_I2C_DEVICE) {
-		if (s_ctrl->clk_rate != 0)
-			cam_8960_clk_info->clk_rate = s_ctrl->clk_rate;
+	if (s_ctrl->clk_rate != 0)
+		cam_clk_info->clk_rate = s_ctrl->clk_rate;
 
-		rc = msm_cam_clk_enable(dev, cam_8960_clk_info,
-			s_ctrl->cam_clk, ARRAY_SIZE(cam_8960_clk_info), 1);
-		if (rc < 0) {
-			pr_err("%s: clk enable failed\n", __func__);
-			goto enable_clk_failed;
-		}
-	} else {
-		rc = msm_cam_clk_enable(dev, cam_8974_clk_info,
-			s_ctrl->cam_clk, ARRAY_SIZE(cam_8974_clk_info), 1);
-		if (rc < 0) {
-			pr_err("%s: clk enable failed\n", __func__);
-			goto enable_clk_failed;
-		}
+	rc = msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->dev,
+		cam_clk_info, &s_ctrl->cam_clk, ARRAY_SIZE(cam_clk_info), 1);
+	if (rc < 0) {
+		pr_err("%s: clk enable failed\n", __func__);
+		goto enable_clk_failed;
 	}
 
-	if (!s_ctrl->power_seq_delay)
-		usleep_range(1000, 2000);
-	else if (s_ctrl->power_seq_delay < 20)
-		usleep_range((s_ctrl->power_seq_delay * 1000),
-			((s_ctrl->power_seq_delay * 1000) + 1000));
-	else
-		msleep(s_ctrl->power_seq_delay);
-
+	usleep_range(1000, 2000);
 	if (data->sensor_platform_info->ext_power_ctrl != NULL)
 		data->sensor_platform_info->ext_power_ctrl(1);
 
@@ -1567,38 +1429,19 @@
 		data->sensor_platform_info->i2c_conf->use_i2c_mux)
 		msm_sensor_enable_i2c_mux(data->sensor_platform_info->i2c_conf);
 
-	if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) {
-		rc = msm_sensor_cci_util(s_ctrl->sensor_i2c_client,
-			MSM_CCI_INIT);
-		if (rc < 0) {
-			pr_err("%s cci_init failed\n", __func__);
-			goto cci_init_failed;
-		}
-	}
-	s_ctrl->curr_res = MSM_SENSOR_INVALID_RES;
 	return rc;
-
-cci_init_failed:
-	if (data->sensor_platform_info->i2c_conf &&
-		data->sensor_platform_info->i2c_conf->use_i2c_mux)
-		msm_sensor_disable_i2c_mux(
-			data->sensor_platform_info->i2c_conf);
 enable_clk_failed:
 		msm_camera_config_gpio_table(data, 0);
 config_gpio_failed:
-	msm_camera_enable_vreg(dev,
+	msm_camera_enable_vreg(&s_ctrl->sensor_i2c_client->client->dev,
 			s_ctrl->sensordata->sensor_platform_info->cam_vreg,
 			s_ctrl->sensordata->sensor_platform_info->num_vreg,
-			s_ctrl->vreg_seq,
-			s_ctrl->num_vreg_seq,
 			s_ctrl->reg_ptr, 0);
 
 enable_vreg_failed:
-	msm_camera_config_vreg(dev,
+	msm_camera_config_vreg(&s_ctrl->sensor_i2c_client->client->dev,
 		s_ctrl->sensordata->sensor_platform_info->cam_vreg,
 		s_ctrl->sensordata->sensor_platform_info->num_vreg,
-		s_ctrl->vreg_seq,
-		s_ctrl->num_vreg_seq,
 		s_ctrl->reg_ptr, 0);
 config_vreg_failed:
 	msm_camera_request_gpio_table(data, 0);
@@ -1610,15 +1453,7 @@
 int32_t msm_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl)
 {
 	struct msm_camera_sensor_info *data = s_ctrl->sensordata;
-	struct device *dev = NULL;
-	if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE)
-		dev = &s_ctrl->pdev->dev;
-	else
-		dev = &s_ctrl->sensor_i2c_client->client->dev;
-	if (s_ctrl->sensor_device_type == MSM_SENSOR_PLATFORM_DEVICE) {
-		msm_sensor_cci_util(s_ctrl->sensor_i2c_client,
-			MSM_CCI_RELEASE);
-	}
+	CDBG("%s: called %d\n", __func__, __LINE__);
 
 	if (data->sensor_platform_info->i2c_conf &&
 		data->sensor_platform_info->i2c_conf->use_i2c_mux)
@@ -1627,28 +1462,78 @@
 
 	if (data->sensor_platform_info->ext_power_ctrl != NULL)
 		data->sensor_platform_info->ext_power_ctrl(0);
-	if (s_ctrl->sensor_device_type == MSM_SENSOR_I2C_DEVICE)
-		msm_cam_clk_enable(dev, cam_8960_clk_info, s_ctrl->cam_clk,
-			ARRAY_SIZE(cam_8960_clk_info), 0);
-	else
-		msm_cam_clk_enable(dev, cam_8974_clk_info, s_ctrl->cam_clk,
-			ARRAY_SIZE(cam_8974_clk_info), 0);
+	msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->dev,
+		cam_clk_info, &s_ctrl->cam_clk, ARRAY_SIZE(cam_clk_info), 0);
 	msm_camera_config_gpio_table(data, 0);
-	msm_camera_enable_vreg(dev,
+	msm_camera_enable_vreg(&s_ctrl->sensor_i2c_client->client->dev,
 		s_ctrl->sensordata->sensor_platform_info->cam_vreg,
 		s_ctrl->sensordata->sensor_platform_info->num_vreg,
-		s_ctrl->vreg_seq,
-		s_ctrl->num_vreg_seq,
 		s_ctrl->reg_ptr, 0);
-	msm_camera_config_vreg(dev,
+	msm_camera_config_vreg(&s_ctrl->sensor_i2c_client->client->dev,
 		s_ctrl->sensordata->sensor_platform_info->cam_vreg,
 		s_ctrl->sensordata->sensor_platform_info->num_vreg,
-		s_ctrl->vreg_seq,
-		s_ctrl->num_vreg_seq,
 		s_ctrl->reg_ptr, 0);
 	msm_camera_request_gpio_table(data, 0);
 	kfree(s_ctrl->reg_ptr);
-	s_ctrl->curr_res = MSM_SENSOR_INVALID_RES;
+	return 0;
+}
+
+int32_t msm_sensor_set_power_up(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int32_t rc = 0;
+	int32_t gpio = 0;
+	struct msm_camera_sensor_info *data = NULL;
+	pr_info("%s: called %d\n", __func__, __LINE__);
+
+	if (s_ctrl && s_ctrl->sensordata)
+		data = s_ctrl->sensordata;
+	else {
+		pr_err("%s: failed, s_ctrl sensordata is NULL\n", __func__);
+		return (-1);
+	}
+
+	msm_camio_clk_rate_set(MSM_SENSOR_MCLK_24HZ);
+
+	if (data->sensor_platform_info->sensor_reset_enable)
+		gpio = data->sensor_platform_info->sensor_reset;
+	else
+		gpio = data->sensor_platform_info->sensor_pwd;
+
+	rc = gpio_request(gpio, "SENSOR_NAME");
+	if (!rc) {
+		CDBG("%s: reset sensor\n", __func__);
+		gpio_direction_output(gpio, 0);
+		usleep_range(1000, 2000);
+		gpio_set_value_cansleep(gpio, 1);
+		usleep_range(4000, 5000);
+	} else {
+		pr_err("%s: gpio request fail", __func__);
+	}
+
+	return rc;
+}
+
+int32_t msm_sensor_set_power_down(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int32_t gpio = 0;
+	struct msm_camera_sensor_info *data = NULL;
+	pr_info("%s: called %d\n", __func__, __LINE__);
+
+	if (s_ctrl && s_ctrl->sensordata)
+		data = s_ctrl->sensordata;
+	else {
+		pr_err("%s: failed to s_ctrl sensordata NULL\n", __func__);
+		return (-1);
+	}
+
+	if (data->sensor_platform_info->sensor_reset_enable)
+		gpio = data->sensor_platform_info->sensor_reset;
+	else
+		gpio = data->sensor_platform_info->sensor_pwd;
+
+	gpio_set_value_cansleep(gpio, 0);
+	usleep_range(1000, 2000);
+	gpio_free(gpio);
 	return 0;
 }
 
@@ -1656,181 +1541,165 @@
 {
 	int32_t rc = 0;
 	uint16_t chipid = 0;
-	rc = msm_camera_i2c_read(
-			s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_id_info->sensor_id_reg_addr, &chipid,
-			MSM_CAMERA_I2C_WORD_DATA);
+	int i=10;
+	CDBG("%s: called %d\n", __func__, __LINE__);
+
+	while(i--)
+	{
+		pr_info("%s: retry %d\n",  __func__, i);
+	
+		rc = msm_camera_i2c_read(
+				s_ctrl->sensor_i2c_client,
+				s_ctrl->sensor_id_info->sensor_id_reg_addr, &chipid,
+				MSM_CAMERA_I2C_WORD_DATA);
+
+		if(rc>=0)
+			break;
+	}
 	if (rc < 0) {
-		pr_err("%s: %s: read id failed\n", __func__,
-			s_ctrl->sensordata->sensor_name);
+		pr_err("%s: read id failed\n", __func__);
 		return rc;
 	}
 
-	CDBG("%s: read id: %x expected id %x:\n", __func__, chipid,
-		s_ctrl->sensor_id_info->sensor_id);
+	pr_info("%s: msm_sensor id: 0x%x,expect sensor_id=0x%x\n", __func__, chipid, s_ctrl->sensor_id_info->sensor_id);
+#if 1	
+		if (s_ctrl->sensor_id_info->sensor_id == 0x4581)
+		{
+			uint16_t chipid2 = 0;
+			rc = msm_camera_i2c_read(
+			s_ctrl->sensor_i2c_client,
+			0x3000, &chipid2,
+			MSM_CAMERA_I2C_WORD_DATA);
+			if (rc < 0) {
+				pr_err("%s: read id failed\n", __func__);
+				return rc;
+			}
+
+			pr_info("%s: msm_sensor id 0x3000: 0x%x,expect sensor_id=0x%x\n", __func__, chipid2, s_ctrl->sensor_id_info->sensor_id);
+		}
+#endif
 	if (chipid != s_ctrl->sensor_id_info->sensor_id) {
-		pr_err("msm_sensor_match_id chip id doesnot match\n");
+#if defined(CONFIG_MACH_MONARUDO) || defined(CONFIG_MACH_DUMMY) || defined(CONFIG_MACH_DELUXE_R) || defined(CONFIG_MACH_DUMMY)\
+    || defined(CONFIG_MACH_DUMMY) || defined(CONFIG_MACH_DUMMY)
+		if (chipid == 0x174 && s_ctrl->sensor_id_info->sensor_id == 0x175)
+		{
+			
+			pr_info("%s: WA for Liteon module written wrong sensor ID as IMX174\n", __func__);
+			return rc;
+		}
+#endif
+		pr_info("%s: failed to msm_sensor_match_id chip id doesnot match\n", __func__);
 		return -ENODEV;
 	}
 	return rc;
 }
 
+struct msm_sensor_ctrl_t *get_sctrl(struct v4l2_subdev *sd)
+{
+	return container_of(sd, struct msm_sensor_ctrl_t, sensor_v4l2_subdev);
+}
+
 int32_t msm_sensor_i2c_probe(struct i2c_client *client,
 	const struct i2c_device_id *id)
 {
 	int rc = 0;
 	struct msm_sensor_ctrl_t *s_ctrl;
-	CDBG("%s %s_i2c_probe called\n", __func__, client->name);
+	pr_info("%s: sensor_i2c_probe called - name: %s\n", __func__, client->name);
+
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		pr_err("%s %s i2c_check_functionality failed\n",
-			__func__, client->name);
+		pr_err("i2c_check_functionality failed\n");
 		rc = -EFAULT;
 		return rc;
 	}
 
 	s_ctrl = (struct msm_sensor_ctrl_t *)(id->driver_data);
-	s_ctrl->sensor_device_type = MSM_SENSOR_I2C_DEVICE;
 	if (s_ctrl->sensor_i2c_client != NULL) {
 		s_ctrl->sensor_i2c_client->client = client;
 		if (s_ctrl->sensor_i2c_addr != 0)
 			s_ctrl->sensor_i2c_client->client->addr =
 				s_ctrl->sensor_i2c_addr;
 	} else {
-		pr_err("%s %s sensor_i2c_client NULL\n",
-			__func__, client->name);
+		pr_err("%s: failed to sensor_i2c_client is NULL\n", __func__);
 		rc = -EFAULT;
 		return rc;
 	}
 
 	s_ctrl->sensordata = client->dev.platform_data;
 	if (s_ctrl->sensordata == NULL) {
-		pr_err("%s %s NULL sensor data\n", __func__, client->name);
+		pr_err("%s: failed to sensor data is NULL\n", __func__);
 		return -EFAULT;
 	}
 
-	rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
-	if (rc < 0) {
-		pr_err("%s %s power up failed\n", __func__, client->name);
-		return rc;
+	msm_camio_probe_on_bootup(s_ctrl);	
+
+	if (s_ctrl->sensordata->use_rawchip) {
+#ifdef CONFIG_RAWCHIP
+		rc = rawchip_probe_init();
+		if (rc < 0) {
+			msm_camio_probe_on_bootup(s_ctrl);	
+
+			pr_err("%s: rawchip probe init failed\n", __func__);
+			return rc;
+		}
+#endif
 	}
 
-	if (s_ctrl->func_tbl->sensor_match_id)
-		rc = s_ctrl->func_tbl->sensor_match_id(s_ctrl);
-	else
-		rc = msm_sensor_match_id(s_ctrl);
+	if (s_ctrl->func_tbl && s_ctrl->func_tbl->sensor_power_up)
+		rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
+
 	if (rc < 0)
 		goto probe_fail;
 
-	if (!s_ctrl->wait_num_frames)
-		s_ctrl->wait_num_frames = 1 * Q10;
+	rc = msm_sensor_match_id(s_ctrl);
+	if (rc < 0)
+		goto probe_fail;
 
-	pr_err("%s %s probe succeeded\n", __func__, client->name);
+	if (s_ctrl->sensor_eeprom_client != NULL) {
+		struct msm_camera_eeprom_client *eeprom_client =
+			s_ctrl->sensor_eeprom_client;
+		if (eeprom_client->func_tbl.eeprom_init != NULL &&
+			eeprom_client->func_tbl.eeprom_release != NULL) {
+			rc = eeprom_client->func_tbl.eeprom_init(
+				eeprom_client,
+				s_ctrl->sensor_i2c_client->client->adapter);
+			if (rc < 0)
+				goto probe_fail;
+
+			rc = msm_camera_eeprom_read_tbl(eeprom_client,
+			eeprom_client->read_tbl, eeprom_client->read_tbl_size);
+			eeprom_client->func_tbl.eeprom_release(eeprom_client);
+			if (rc < 0)
+				goto probe_fail;
+		}
+	}
+
 	snprintf(s_ctrl->sensor_v4l2_subdev.name,
 		sizeof(s_ctrl->sensor_v4l2_subdev.name), "%s", id->name);
 	v4l2_i2c_subdev_init(&s_ctrl->sensor_v4l2_subdev, client,
 		s_ctrl->sensor_v4l2_subdev_ops);
-	s_ctrl->sensor_v4l2_subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	media_entity_init(&s_ctrl->sensor_v4l2_subdev.entity, 0, NULL, 0);
-	s_ctrl->sensor_v4l2_subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	s_ctrl->sensor_v4l2_subdev.entity.group_id = SENSOR_DEV;
-	s_ctrl->sensor_v4l2_subdev.entity.name =
-		s_ctrl->sensor_v4l2_subdev.name;
+
+    if (s_ctrl->func_tbl->sensor_i2c_read_vcm_driver_ic != NULL)
+      s_ctrl->func_tbl->sensor_i2c_read_vcm_driver_ic(s_ctrl);
+
 	msm_sensor_register(&s_ctrl->sensor_v4l2_subdev);
-	s_ctrl->sensor_v4l2_subdev.entity.revision =
-		s_ctrl->sensor_v4l2_subdev.devnode->num;
 	goto power_down;
 probe_fail:
-	pr_err("%s %s_i2c_probe failed\n", __func__, client->name);
+	pr_info("%s_i2c_probe failed\n", client->name);
 power_down:
 	if (rc > 0)
 		rc = 0;
-	s_ctrl->func_tbl->sensor_power_down(s_ctrl);
-	s_ctrl->sensor_state = MSM_SENSOR_POWER_DOWN;
-	return rc;
-}
 
-static int msm_sensor_subdev_match_core(struct device *dev, void *data)
-{
-	int core_index = (int)data;
-	struct platform_device *pdev = to_platform_device(dev);
-	CDBG("%s cci pdev %p\n", __func__, pdev);
-	if (pdev->id == core_index)
-		return 1;
-	else
-		return 0;
-}
+	if (s_ctrl->func_tbl && s_ctrl->func_tbl->sensor_power_down)
+		s_ctrl->func_tbl->sensor_power_down(s_ctrl);
 
-int32_t msm_sensor_platform_probe(struct platform_device *pdev, void *data)
-{
-	int32_t rc = 0;
-	struct msm_sensor_ctrl_t *s_ctrl = (struct msm_sensor_ctrl_t *)data;
-	struct device_driver *driver;
-	struct device *dev;
-	s_ctrl->pdev = pdev;
-	CDBG("%s called data %p\n", __func__, data);
-	if (pdev->dev.of_node) {
-		rc = msm_sensor_init_sensor_data(pdev, s_ctrl);
-		if (rc < 0) {
-			pr_err("%s failed line %d\n", __func__, __LINE__);
-			return rc;
-		}
-	}
-	s_ctrl->sensor_device_type = MSM_SENSOR_PLATFORM_DEVICE;
-	s_ctrl->sensor_i2c_client->cci_client = kzalloc(sizeof(
-		struct msm_camera_cci_client), GFP_KERNEL);
-	if (!s_ctrl->sensor_i2c_client->cci_client) {
-		pr_err("%s failed line %d\n", __func__, __LINE__);
-		return rc;
-	}
-	driver = driver_find(MSM_CCI_DRV_NAME, &platform_bus_type);
-	if (!driver) {
-		pr_err("%s failed line %d\n", __func__, __LINE__);
-		return rc;
+	if (s_ctrl->sensordata->use_rawchip) {
+#ifdef CONFIG_RAWCHIP
+		rawchip_probe_deinit();
+#endif
 	}
 
-	dev = driver_find_device(driver, NULL, 0,
-				msm_sensor_subdev_match_core);
-	if (!dev) {
-		pr_err("%s failed line %d\n", __func__, __LINE__);
-		return rc;
-	}
-	s_ctrl->sensor_i2c_client->cci_client->cci_subdev =
-		dev_get_drvdata(dev);
-	CDBG("%s sd %p\n", __func__,
-		s_ctrl->sensor_i2c_client->cci_client->cci_subdev);
-	s_ctrl->sensor_i2c_client->cci_client->cci_i2c_master = MASTER_0;
-	s_ctrl->sensor_i2c_client->cci_client->sid =
-		s_ctrl->sensor_i2c_addr >> 1;
-	s_ctrl->sensor_i2c_client->cci_client->retries = 3;
-	s_ctrl->sensor_i2c_client->cci_client->id_map = 0;
+	msm_camio_probe_off_bootup(s_ctrl);	
 
-	rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
-	if (rc < 0) {
-		pr_err("%s %s power up failed\n", __func__,
-			pdev->id_entry->name);
-		return rc;
-	}
-
-	if (s_ctrl->func_tbl->sensor_match_id)
-		rc = s_ctrl->func_tbl->sensor_match_id(s_ctrl);
-	else
-		rc = msm_sensor_match_id(s_ctrl);
-	if (rc < 0)
-		goto probe_fail;
-
-	v4l2_subdev_init(&s_ctrl->sensor_v4l2_subdev,
-		s_ctrl->sensor_v4l2_subdev_ops);
-	snprintf(s_ctrl->sensor_v4l2_subdev.name,
-		sizeof(s_ctrl->sensor_v4l2_subdev.name), "%s",
-		s_ctrl->sensordata->sensor_name);
-	v4l2_set_subdevdata(&s_ctrl->sensor_v4l2_subdev, pdev);
-	msm_sensor_register(&s_ctrl->sensor_v4l2_subdev);
-
-	goto power_down;
-probe_fail:
-	pr_err("%s %s probe failed\n", __func__, pdev->id_entry->name);
-power_down:
-	s_ctrl->func_tbl->sensor_power_down(s_ctrl);
 	return rc;
 }
 
@@ -1838,47 +1707,13 @@
 {
 	int rc = 0;
 	struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(sd);
+	CDBG("%s: called\n", __func__);
+
 	mutex_lock(s_ctrl->msm_sensor_mutex);
-	if (on) {
-		if(s_ctrl->sensor_state == MSM_SENSOR_POWER_UP) {
-			pr_err("%s: sensor already in power up state\n", __func__);
-			mutex_unlock(s_ctrl->msm_sensor_mutex);
-			return -EINVAL;
-		}
+	if (on)
 		rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
-		if (rc < 0) {
-			pr_err("%s: %s power_up failed rc = %d\n", __func__,
-				s_ctrl->sensordata->sensor_name, rc);
-			s_ctrl->sensor_state = MSM_SENSOR_POWER_DOWN;
-		} else {
-			if (s_ctrl->func_tbl->sensor_match_id)
-				rc = s_ctrl->func_tbl->sensor_match_id(s_ctrl);
-			else
-				rc = msm_sensor_match_id(s_ctrl);
-			if (rc < 0) {
-				pr_err("%s: %s match_id failed  rc=%d\n",
-					__func__,
-					s_ctrl->sensordata->sensor_name, rc);
-				if (s_ctrl->func_tbl->sensor_power_down(s_ctrl)
-					< 0)
-					pr_err("%s: %s power_down failed\n",
-					__func__,
-					s_ctrl->sensordata->sensor_name);
-				s_ctrl->sensor_state = MSM_SENSOR_POWER_DOWN;
-				goto power_up_failed;
-			}
-			s_ctrl->sensor_state = MSM_SENSOR_POWER_UP;
-		}
-	} else {
-		if(s_ctrl->sensor_state == MSM_SENSOR_POWER_DOWN) {
-			pr_err("%s: sensor already in power down state\n",__func__);
-			mutex_unlock(s_ctrl->msm_sensor_mutex);
-			return -EINVAL;
-		}
+	else
 		rc = s_ctrl->func_tbl->sensor_power_down(s_ctrl);
-		s_ctrl->sensor_state = MSM_SENSOR_POWER_DOWN;
-	}
-power_up_failed:
 	mutex_unlock(s_ctrl->msm_sensor_mutex);
 	return rc;
 }
@@ -1887,6 +1722,7 @@
 			   enum v4l2_mbus_pixelcode *code)
 {
 	struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(sd);
+	CDBG("%s: called\n", __func__);
 
 	if ((unsigned int)index >= s_ctrl->sensor_v4l2_subdev_info_size)
 		return -EINVAL;
@@ -1902,11 +1738,14 @@
 	struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(sd);
 	struct msm_sensor_v4l2_ctrl_info_t *v4l2_ctrl =
 		s_ctrl->msm_sensor_v4l2_ctrl_info;
+	CDBG("%s: ctrl->id=%d\n", __func__, ctrl->id);
 
-	CDBG("%s\n", __func__);
-	CDBG("%d\n", ctrl->id);
 	if (v4l2_ctrl == NULL)
+	{
+		pr_info("%s: failed to v4l2_ctrl == NULL\n", __func__);
 		return rc;
+	}
+
 	for (i = 0; i < s_ctrl->num_v4l2_ctrl; i++) {
 		if (v4l2_ctrl[i].ctrl_id == ctrl->id) {
 			if (v4l2_ctrl[i].s_v4l2_ctrl != NULL) {
@@ -1929,8 +1768,6 @@
 	int rc = -1, i = 0;
 	struct msm_sensor_ctrl_t *s_ctrl =
 		(struct msm_sensor_ctrl_t *) sd->dev_priv;
-
-	CDBG("%s\n", __func__);
 	CDBG("%s id: %d\n", __func__, qctrl->id);
 
 	if (s_ctrl->msm_sensor_v4l2_ctrl_info == NULL)
@@ -1956,6 +1793,7 @@
 {
 	int rc = 0;
 	CDBG("%s enter\n", __func__);
+
 	rc = msm_sensor_write_enum_conf_array(
 		s_ctrl->sensor_i2c_client,
 		ctrl_info->enum_cfg_settings, value);
@@ -1965,6 +1803,8 @@
 static int msm_sensor_debugfs_stream_s(void *data, u64 val)
 {
 	struct msm_sensor_ctrl_t *s_ctrl = (struct msm_sensor_ctrl_t *) data;
+	CDBG("%s called\n", __func__);
+
 	if (val)
 		s_ctrl->func_tbl->sensor_start_stream(s_ctrl);
 	else
@@ -1977,7 +1817,7 @@
 
 static int msm_sensor_debugfs_test_s(void *data, u64 val)
 {
-	CDBG("val: %llu\n", val);
+	CDBG("%s: val: %llu\n", __func__, val);
 	return 0;
 }
 
@@ -1987,6 +1827,8 @@
 int msm_sensor_enable_debugfs(struct msm_sensor_ctrl_t *s_ctrl)
 {
 	struct dentry *debugfs_base, *sensor_dir;
+	CDBG("%s: called\n", __func__);
+
 	debugfs_base = debugfs_create_dir("msm_sensor", NULL);
 	if (!debugfs_base)
 		return -ENOMEM;
diff --git a/drivers/media/video/msm/sensors/msm_sensor.h b/drivers/media/video/msm/sensors/msm_sensor.h
index 40ca934..20ade5d 100644
--- a/drivers/media/video/msm/sensors/msm_sensor.h
+++ b/drivers/media/video/msm/sensors/msm_sensor.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -13,25 +13,187 @@
 #ifndef MSM_SENSOR_H
 #define MSM_SENSOR_H
 
+#include <linux/module.h>
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/i2c.h>
 #include <linux/miscdevice.h>
-#include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <linux/uaccess.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
-#include <linux/of_gpio.h>
-#include <linux/gpio.h>
 #include <mach/camera.h>
+#include <mach/gpio.h>
 #include <media/msm_camera.h>
 #include <media/v4l2-subdev.h>
 #include "msm_camera_i2c.h"
 #include "msm_camera_eeprom.h"
-#include "msm_sensor_common.h"
+#define Q8  0x00000100
+#define Q10 0x00000400
+
+#define MSM_SENSOR_MCLK_8HZ 8000000
+#define MSM_SENSOR_MCLK_16HZ 16000000
+#define MSM_SENSOR_MCLK_24HZ 24000000
+
+enum msm_sensor_reg_update {
+	
+	MSM_SENSOR_REG_INIT,
+	
+	MSM_SENSOR_UPDATE_PERIODIC,
+	
+	MSM_SENSOR_UPDATE_ALL,
+	
+	MSM_SENSOR_UPDATE_INVALID
+};
+
+enum msm_sensor_cam_mode_t {
+	MSM_SENSOR_MODE_2D_RIGHT,
+	MSM_SENSOR_MODE_2D_LEFT,
+	MSM_SENSOR_MODE_3D,
+	MSM_SENSOR_MODE_INVALID
+};
+
+struct msm_sensor_output_reg_addr_t {
+	uint16_t x_output;
+	uint16_t y_output;
+	uint16_t line_length_pclk;
+	uint16_t frame_length_lines;
+};
+
+struct msm_sensor_id_info_t {
+	uint16_t sensor_id_reg_addr;
+	uint16_t sensor_id;
+};
+
+struct msm_sensor_exp_gain_info_t {
+	uint16_t coarse_int_time_addr;
+	uint16_t global_gain_addr;
+	uint16_t vert_offset;
+	uint16_t min_vert; 
+	uint32_t sensor_max_linecount; 
+};
+
+struct msm_sensor_reg_t {
+	enum msm_camera_i2c_data_type default_data_type;
+	struct msm_camera_i2c_reg_conf *start_stream_conf;
+	uint8_t start_stream_conf_size;
+	struct msm_camera_i2c_reg_conf *stop_stream_conf;
+	uint8_t stop_stream_conf_size;
+	struct msm_camera_i2c_reg_conf *group_hold_on_conf;
+	uint8_t group_hold_on_conf_size;
+	struct msm_camera_i2c_reg_conf *group_hold_off_conf;
+	uint8_t group_hold_off_conf_size;
+	struct msm_camera_i2c_conf_array *init_settings;
+	uint8_t init_size;
+	struct msm_camera_i2c_conf_array *mode_settings;
+	struct msm_camera_i2c_conf_array *no_effect_settings;
+	struct msm_sensor_output_info_t *output_settings;
+	uint8_t num_conf;
+};
+
+struct v4l2_subdev_info {
+	enum v4l2_mbus_pixelcode code;
+	enum v4l2_colorspace colorspace;
+	uint16_t fmt;
+	uint16_t order;
+};
+
+struct msm_sensor_ctrl_t;
+
+struct msm_sensor_v4l2_ctrl_info_t {
+	uint32_t ctrl_id;
+	int16_t min;
+	int16_t max;
+	int16_t step;
+	struct msm_camera_i2c_enum_conf_array *enum_cfg_settings;
+	int (*s_v4l2_ctrl) (struct msm_sensor_ctrl_t *,
+		struct msm_sensor_v4l2_ctrl_info_t *, int);
+};
+
+struct msm_sensor_fn_t {
+	void (*sensor_start_stream) (struct msm_sensor_ctrl_t *);
+	void (*sensor_stop_stream) (struct msm_sensor_ctrl_t *);
+	void (*sensor_group_hold_on) (struct msm_sensor_ctrl_t *);
+	void (*sensor_group_hold_off) (struct msm_sensor_ctrl_t *);
+
+	int32_t (*sensor_set_fps) (struct msm_sensor_ctrl_t *,
+			struct fps_cfg *);
+	int32_t (*sensor_write_exp_gain) (struct msm_sensor_ctrl_t *,
+			uint16_t, uint32_t);
+	int32_t (*sensor_write_snapshot_exp_gain) (struct msm_sensor_ctrl_t *,
+			uint16_t, uint32_t);
+	int32_t (*sensor_write_exp_gain_ex) (struct msm_sensor_ctrl_t *,
+			int, uint16_t, uint16_t, uint32_t); 
+	int32_t (*sensor_write_snapshot_exp_gain_ex) (struct msm_sensor_ctrl_t *,
+			int, uint16_t, uint16_t, uint32_t); 
+	int32_t (*sensor_setting) (struct msm_sensor_ctrl_t *,
+			int update_type, int rt);
+	int32_t (*sensor_set_sensor_mode)
+			(struct msm_sensor_ctrl_t *, int, int);
+	int32_t (*sensor_mode_init) (struct msm_sensor_ctrl_t *,
+		int, struct sensor_init_cfg *);
+	int32_t (*sensor_get_output_info) (struct msm_sensor_ctrl_t *,
+		struct sensor_output_info_t *);
+	int (*sensor_config) (struct msm_sensor_ctrl_t *, void __user *);
+	int (*sensor_power_down)
+		(struct msm_sensor_ctrl_t *);
+	int (*sensor_power_up) (struct msm_sensor_ctrl_t *);
+	
+	int (*sensor_i2c_read_fuseid)(struct sensor_cfg_data *cdata, struct msm_sensor_ctrl_t *s_ctrl);
+	
+       int (*sensor_i2c_read_vcm_driver_ic)(struct msm_sensor_ctrl_t *s_ctrl);
+	int (*sensor_adjust_frame_lines)
+		(struct msm_sensor_ctrl_t *s_ctrl, uint16_t res);
+
+	int32_t (*sensor_set_dig_gain) (struct msm_sensor_ctrl_t *, uint16_t); 
+	
+	void (*sensor_ov2722_write_exp_line) (struct msm_sensor_ctrl_t *, uint16_t); 
+
+	int (*sensor_write_output_settings_specific)(struct msm_sensor_ctrl_t *s_ctrl, uint16_t res); 
+};
+
+struct msm_sensor_ctrl_t {
+	struct  msm_camera_sensor_info *sensordata;
+	struct i2c_client *msm_sensor_client;
+	struct i2c_driver *sensor_i2c_driver;
+	struct msm_camera_i2c_client *sensor_i2c_client;
+	uint16_t sensor_i2c_addr;
+
+	struct msm_camera_eeprom_client *sensor_eeprom_client;
+
+	struct msm_sensor_output_reg_addr_t *sensor_output_reg_addr;
+	struct msm_sensor_id_info_t *sensor_id_info;
+	struct msm_sensor_exp_gain_info_t *sensor_exp_gain_info;
+	struct msm_sensor_reg_t *msm_sensor_reg;
+	struct msm_sensor_v4l2_ctrl_info_t *msm_sensor_v4l2_ctrl_info;
+	uint16_t num_v4l2_ctrl;
+
+	uint16_t curr_line_length_pclk;
+	uint16_t curr_frame_length_lines;
+	uint16_t prev_gain;
+	uint16_t prev_line;
+
+	uint32_t fps_divider;
+	enum msm_sensor_resolution_t curr_res;
+	enum msm_sensor_cam_mode_t cam_mode;
+
+	struct mutex *msm_sensor_mutex;
+	struct msm_camera_csi2_params *curr_csi_params;
+	struct msm_camera_csi2_params **csi_params;
+	struct msm_camera_csi_params **csic_params;
+	struct msm_camera_csi_params *curr_csic_params;
+
+	struct v4l2_subdev sensor_v4l2_subdev;
+	struct v4l2_subdev_info *sensor_v4l2_subdev_info;
+	uint8_t sensor_v4l2_subdev_info_size;
+	struct v4l2_subdev_ops *sensor_v4l2_subdev_ops;
+	struct msm_sensor_fn_t *func_tbl;
+	struct regulator **reg_ptr;
+	struct clk *cam_clk;
+	long clk_rate;
+	int mirror_flip;	
+	struct mutex *sensor_first_mutex;  
+};
 
 void msm_sensor_start_stream(struct msm_sensor_ctrl_t *s_ctrl);
 void msm_sensor_stop_stream(struct msm_sensor_ctrl_t *s_ctrl);
@@ -41,9 +203,15 @@
 int32_t msm_sensor_set_fps(struct msm_sensor_ctrl_t *s_ctrl,
 			struct fps_cfg   *fps);
 int32_t msm_sensor_write_exp_gain1(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain);
+		uint16_t gain, uint32_t line);
 int32_t msm_sensor_write_exp_gain2(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain);
+		uint16_t gain, uint32_t line);
+int32_t msm_sensor_write_exp_gain1_ex(struct msm_sensor_ctrl_t *s_ctrl,
+		int mode, uint16_t gain, uint16_t dig_gain, uint32_t line);
+int32_t msm_sensor_write_exp_gain2_ex(struct msm_sensor_ctrl_t *s_ctrl,
+		int mode, uint16_t gain, uint32_t line);
+int32_t msm_sensor_write_exp_gain_ov (struct msm_sensor_ctrl_t *s_ctrl,
+		int mode, uint16_t gain, uint16_t dig_gain, uint32_t line); 
 int32_t msm_sensor_set_sensor_mode(struct msm_sensor_ctrl_t *s_ctrl,
 	int mode, int res);
 int32_t msm_sensor_mode_init(struct msm_sensor_ctrl_t *s_ctrl,
@@ -52,15 +220,32 @@
 		struct sensor_output_info_t *);
 int32_t msm_sensor_config(struct msm_sensor_ctrl_t *s_ctrl,
 			void __user *argp);
+
 int32_t msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl);
 int32_t msm_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl);
+#if 1	
+int32_t msm_sensor_set_power_up(struct msm_sensor_ctrl_t *s_ctrl);
+int32_t msm_sensor_set_power_down(struct msm_sensor_ctrl_t *s_ctrl);
 
 int32_t msm_sensor_match_id(struct msm_sensor_ctrl_t *s_ctrl);
 int msm_sensor_i2c_probe(struct i2c_client *client,
 	const struct i2c_device_id *id);
+int32_t msm_sensor_release(struct msm_sensor_ctrl_t *s_ctrl);
+int32_t msm_sensor_open_init(struct msm_sensor_ctrl_t *s_ctrl,
+				const struct msm_camera_sensor_info *data);
+int msm_sensor_probe(struct msm_sensor_ctrl_t *s_ctrl,
+		const struct msm_camera_sensor_info *info,
+		struct msm_sensor_ctrl *s);
 
-int32_t msm_sensor_platform_probe(struct platform_device *pdev, void *data);
+int msm_sensor_v4l2_probe(struct msm_sensor_ctrl_t *s_ctrl,
+	const struct msm_camera_sensor_info *info,
+	struct v4l2_subdev *sdev, struct msm_sensor_ctrl *s);
 
+#endif	
+
+int32_t msm_sensor_match_id(struct msm_sensor_ctrl_t *s_ctrl);
+int msm_sensor_i2c_probe(struct i2c_client *client,
+	const struct i2c_device_id *id);
 int32_t msm_sensor_power(struct v4l2_subdev *sd, int on);
 
 int32_t msm_sensor_v4l2_s_ctrl(struct v4l2_subdev *sd,
@@ -85,13 +270,17 @@
 int32_t msm_sensor_write_output_settings(struct msm_sensor_ctrl_t *s_ctrl,
 	uint16_t res);
 
-void msm_sensor_adjust_frame_lines1(struct msm_sensor_ctrl_t *s_ctrl);
-
-void msm_sensor_adjust_frame_lines2(struct msm_sensor_ctrl_t *s_ctrl);
-
 int32_t msm_sensor_setting(struct msm_sensor_ctrl_t *s_ctrl,
 			int update_type, int res);
 
+int32_t msm_sensor_setting_parallel(struct msm_sensor_ctrl_t *s_ctrl,
+			int update_type, int res);
+int32_t msm_sensor_setting_parallel_ov(struct msm_sensor_ctrl_t *s_ctrl,
+			int update_type, int res);
+
+int32_t msm_sensor_setting_ov(struct msm_sensor_ctrl_t *s_ctrl,
+			int update_type, int res);
+
 int32_t msm_sensor_setting1(struct msm_sensor_ctrl_t *s_ctrl,
 			int update_type, int res);
 
@@ -100,19 +289,19 @@
 long msm_sensor_subdev_ioctl(struct v4l2_subdev *sd,
 			unsigned int cmd, void *arg);
 
-int32_t msm_sensor_get_csi_params(struct msm_sensor_ctrl_t *s_ctrl,
-		struct csi_lane_params_t *sensor_output_info);
-
 struct msm_sensor_ctrl_t *get_sctrl(struct v4l2_subdev *sd);
-int32_t msm_sensor_free_sensor_data(struct msm_sensor_ctrl_t *s_ctrl);
+
+#if (defined CONFIG_WEBCAM_OV7692_QRD || defined CONFIG_OV5647)
+	extern int lcd_camera_power_onoff(int on);
+#endif
+int32_t msm_sensor_adjust_frame_lines(struct msm_sensor_ctrl_t *s_ctrl,
+	uint16_t res);
+
 
 #define VIDIOC_MSM_SENSOR_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, void __user *)
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 10, void __user *)
 
 #define VIDIOC_MSM_SENSOR_RELEASE \
 	_IO('V', BASE_VIDIOC_PRIVATE + 11)
 
-#define VIDIOC_MSM_SENSOR_CSID_INFO\
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 12, struct msm_sensor_csi_info *)
-
 #endif
diff --git a/drivers/media/video/msm/sensors/msm_sensor_bayer.c b/drivers/media/video/msm/sensors/msm_sensor_bayer.c
deleted file mode 100644
index 60eca7a..0000000
--- a/drivers/media/video/msm/sensors/msm_sensor_bayer.c
+++ /dev/null
@@ -1,907 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include "msm_sensor_bayer.h"
-#include "msm.h"
-#include "msm_ispif.h"
-#include "msm_camera_i2c_mux.h"
-#include "msm_camera_i2c.h"
-/*=============================================================*/
-
-long msm_sensor_bayer_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int cmd, void *arg)
-{
-	struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(sd);
-	void __user *argp = (void __user *)arg;
-	switch (cmd) {
-	case VIDIOC_MSM_SENSOR_CFG:
-		return s_ctrl->func_tbl->sensor_config(s_ctrl, argp);
-	case VIDIOC_MSM_SENSOR_RELEASE:
-		return 0;
-	case VIDIOC_MSM_SENSOR_CSID_INFO: {
-		struct msm_sensor_csi_info *csi_info =
-			(struct msm_sensor_csi_info *)arg;
-		s_ctrl->is_csic = csi_info->is_csic;
-		return 0;
-	}
-	default:
-		return -ENOIOCTLCMD;
-	}
-}
-
-int32_t msm_sensor_bayer_get_csi_params(struct msm_sensor_ctrl_t *s_ctrl,
-		struct csi_lane_params_t *sensor_output_info)
-{
-	uint8_t index;
-	struct msm_camera_csi_lane_params *csi_lane_params =
-		s_ctrl->sensordata->sensor_platform_info->csi_lane_params;
-	if (csi_lane_params) {
-		sensor_output_info->csi_lane_assign = csi_lane_params->
-			csi_lane_assign;
-		sensor_output_info->csi_lane_mask = csi_lane_params->
-			csi_lane_mask;
-	}
-	sensor_output_info->csi_if = s_ctrl->sensordata->csi_if;
-	for (index = 0; index < sensor_output_info->csi_if; index++)
-		sensor_output_info->csid_core[index] = s_ctrl->sensordata->
-			pdata[index].csid_core;
-
-	return 0;
-}
-
-int32_t msm_sensor_bayer_config(struct msm_sensor_ctrl_t *s_ctrl,
-	void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long rc = 0;
-	if (copy_from_user(&cdata,
-		(void *)argp,
-		sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(s_ctrl->msm_sensor_mutex);
-	CDBG("%s:%d %s cfgtype = %d\n", __func__, __LINE__,
-		s_ctrl->sensordata->sensor_name, cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_WRITE_I2C_ARRAY: {
-		struct msm_camera_i2c_reg_setting conf_array;
-		struct msm_camera_i2c_reg_array *regs = NULL;
-
-		if (copy_from_user(&conf_array,
-			(void *)cdata.cfg.setting,
-			sizeof(struct msm_camera_i2c_reg_setting))) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			rc = -EFAULT;
-			break;
-		}
-
-		regs = kzalloc(conf_array.size * sizeof(
-			struct msm_camera_i2c_reg_array),
-			GFP_KERNEL);
-		if (!regs) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			rc = -EFAULT;
-			break;
-		}
-
-		if (copy_from_user(regs, (void *)conf_array.reg_setting,
-			conf_array.size * sizeof(
-			struct msm_camera_i2c_reg_array))) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			kfree(regs);
-			rc = -EFAULT;
-			break;
-		}
-
-		conf_array.reg_setting = regs;
-		rc = msm_camera_i2c_write_bayer_table(s_ctrl->sensor_i2c_client,
-			&conf_array);
-		kfree(regs);
-		break;
-	}
-	case CFG_READ_I2C_ARRAY: {
-		struct msm_camera_i2c_reg_setting conf_array;
-		struct msm_camera_i2c_reg_array *regs;
-		int index;
-
-		if (copy_from_user(&conf_array,
-				(void *)cdata.cfg.setting,
-				sizeof(struct msm_camera_i2c_reg_setting))) {
-				pr_err("%s:%d failed\n", __func__, __LINE__);
-				rc = -EFAULT;
-				break;
-		}
-
-		regs = kzalloc(conf_array.size * sizeof(
-				struct msm_camera_i2c_reg_array),
-				GFP_KERNEL);
-		if (!regs) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			rc = -EFAULT;
-			kfree(regs);
-			break;
-		}
-
-		if (copy_from_user(regs, (void *)conf_array.reg_setting,
-				conf_array.size * sizeof(
-				struct msm_camera_i2c_reg_array))) {
-				pr_err("%s:%d failed\n", __func__, __LINE__);
-				kfree(regs);
-				rc = -EFAULT;
-				break;
-			}
-
-		s_ctrl->sensor_i2c_client->addr_type = conf_array.addr_type;
-		for (index = 0; index < conf_array.size; index++) {
-			msm_camera_i2c_read(s_ctrl->sensor_i2c_client,
-					regs[index].reg_addr,
-					&regs[index].reg_data,
-				conf_array.data_type
-				);
-		}
-
-		if (copy_to_user(conf_array.reg_setting,
-			regs,
-			conf_array.size * sizeof(
-			struct msm_camera_i2c_reg_array))) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			kfree(regs);
-			rc = -EFAULT;
-			break;
-		}
-		s_ctrl->sensor_i2c_client->addr_type = conf_array.addr_type;
-		kfree(regs);
-		break;
-	}
-	case CFG_PCLK_CHANGE: {
-		uint32_t pclk = cdata.cfg.pclk;
-		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-			NOTIFY_PCLK_CHANGE, &pclk);
-		break;
-	}
-	case CFG_GPIO_OP: {
-		struct msm_cam_gpio_operation gop;
-		if (copy_from_user(&gop,
-			(void *)cdata.cfg.setting,
-			sizeof(struct msm_cam_gpio_operation))) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-		}
-		switch (gop.op_type) {
-		case GPIO_GET_VALUE:
-			gop.value = gpio_get_value(gop.address);
-			if (copy_from_user((void *)cdata.cfg.setting,
-				&gop,
-				sizeof(struct msm_cam_gpio_operation))) {
-				pr_err("%s:%d failed\n", __func__, __LINE__);
-				rc = -EFAULT;
-				break;
-			}
-			break;
-		case GPIO_SET_VALUE:
-			gpio_set_value(gop.address, gop.value);
-			break;
-		case GPIO_SET_DIRECTION_INPUT:
-			gpio_direction_input(gop.address);
-			break;
-		case GPIO_SET_DIRECTION_OUTPUT:
-			gpio_direction_output(gop.address, gop.value);
-			break;
-		case GPIO_REQUEST:
-			gpio_request(gop.address, gop.tag);
-			break;
-		case GPIO_FREE:
-			gpio_free(gop.address);
-			break;
-		default:
-			break;
-		}
-
-		break;
-	}
-	case CFG_GET_CSI_PARAMS:
-		if (s_ctrl->func_tbl->sensor_get_csi_params == NULL) {
-			rc = -EFAULT;
-			break;
-		}
-		rc = s_ctrl->func_tbl->sensor_get_csi_params(
-			s_ctrl,
-			&cdata.cfg.csi_lane_params);
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_POWER_UP:
-		if (s_ctrl->func_tbl->sensor_power_up)
-			rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
-		else
-			rc = -EFAULT;
-		break;
-
-	case CFG_POWER_DOWN:
-		if (s_ctrl->func_tbl->sensor_power_down)
-			rc = s_ctrl->func_tbl->sensor_power_down(
-				s_ctrl);
-		else
-			rc = -EFAULT;
-		break;
-
-	case CFG_CONFIG_VREG_ARRAY: {
-		struct msm_camera_vreg_setting vreg_setting;
-		struct camera_vreg_t *cam_vreg = NULL;
-
-		if (copy_from_user(&vreg_setting,
-			(void *)cdata.cfg.setting,
-			sizeof(struct msm_camera_vreg_setting))) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			rc = -EFAULT;
-			break;
-		}
-
-		cam_vreg = kzalloc(vreg_setting.num_vreg * sizeof(
-			struct camera_vreg_t),
-			GFP_KERNEL);
-		if (!cam_vreg) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			rc = -EFAULT;
-			break;
-		}
-
-		if (copy_from_user(cam_vreg, (void *)vreg_setting.cam_vreg,
-			vreg_setting.num_vreg * sizeof(
-			struct camera_vreg_t))) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			kfree(cam_vreg);
-			rc = -EFAULT;
-			break;
-		}
-		rc = msm_camera_config_vreg(
-			&s_ctrl->sensor_i2c_client->client->dev,
-			cam_vreg,
-			vreg_setting.num_vreg,
-			NULL,
-			0,
-			s_ctrl->reg_ptr,
-			vreg_setting.enable);
-		if (rc < 0) {
-			kfree(cam_vreg);
-			pr_err("%s: regulator on failed\n", __func__);
-			break;
-		}
-
-		rc = msm_camera_enable_vreg(
-			&s_ctrl->sensor_i2c_client->client->dev,
-			cam_vreg,
-			vreg_setting.num_vreg,
-			NULL,
-			0,
-			s_ctrl->reg_ptr,
-			vreg_setting.enable);
-		if (rc < 0) {
-			kfree(cam_vreg);
-			pr_err("%s: enable regulator failed\n", __func__);
-			break;
-		}
-		kfree(cam_vreg);
-		break;
-	}
-	case CFG_CONFIG_CLK_ARRAY: {
-		struct msm_cam_clk_setting clk_setting;
-		struct msm_cam_clk_info *clk_info = NULL;
-
-		if (copy_from_user(&clk_setting,
-			(void *)cdata.cfg.setting,
-			sizeof(struct msm_camera_vreg_setting))) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			rc = -EFAULT;
-			break;
-		}
-
-		clk_info = kzalloc(clk_setting.num_clk_info * sizeof(
-			struct msm_cam_clk_info),
-			GFP_KERNEL);
-		if (!clk_info) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			rc = -EFAULT;
-			break;
-		}
-
-		if (copy_from_user(clk_info, (void *)clk_setting.clk_info,
-			clk_setting.num_clk_info * sizeof(
-			struct msm_cam_clk_info))) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			kfree(clk_info);
-			rc = -EFAULT;
-			break;
-		}
-		rc = msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->dev,
-			clk_info, s_ctrl->cam_clk,
-			clk_setting.num_clk_info,
-			clk_setting.enable);
-		kfree(clk_info);
-		break;
-	}
-	case CFG_GET_EEPROM_DATA: {
-		if (copy_to_user((void *)cdata.cfg.eeprom_data.eeprom_data,
-			&s_ctrl->eeprom_data, s_ctrl->eeprom_data.length)) {
-			pr_err("%s:%d failed\n", __func__, __LINE__);
-			rc = -EFAULT;
-		}
-		cdata.cfg.eeprom_data.index = s_ctrl->eeprom_data.length;
-		break;
-	}
-	default:
-		rc = -EFAULT;
-		break;
-	}
-
-	mutex_unlock(s_ctrl->msm_sensor_mutex);
-
-	return rc;
-}
-
-static struct msm_cam_clk_info cam_clk_info[] = {
-	{"cam_clk", MSM_SENSOR_MCLK_24HZ},
-};
-
-int32_t msm_sensor_bayer_enable_i2c_mux(struct msm_camera_i2c_conf *i2c_conf)
-{
-	struct v4l2_subdev *i2c_mux_sd =
-		dev_get_drvdata(&i2c_conf->mux_dev->dev);
-	v4l2_subdev_call(i2c_mux_sd, core, ioctl,
-		VIDIOC_MSM_I2C_MUX_INIT, NULL);
-	v4l2_subdev_call(i2c_mux_sd, core, ioctl,
-		VIDIOC_MSM_I2C_MUX_CFG, (void *)&i2c_conf->i2c_mux_mode);
-	return 0;
-}
-
-int32_t msm_sensor_bayer_disable_i2c_mux(struct msm_camera_i2c_conf *i2c_conf)
-{
-	struct v4l2_subdev *i2c_mux_sd =
-		dev_get_drvdata(&i2c_conf->mux_dev->dev);
-	v4l2_subdev_call(i2c_mux_sd, core, ioctl,
-				VIDIOC_MSM_I2C_MUX_RELEASE, NULL);
-	return 0;
-}
-
-static struct msm_camera_power_seq_t sensor_power_seq[] = {
-	{REQUEST_GPIO, 0},
-	{REQUEST_VREG, 0},
-	{ENABLE_VREG, 0},
-	{ENABLE_GPIO, 0},
-	{CONFIG_CLK, 0},
-	{CONFIG_EXT_POWER_CTRL, 0},
-	{CONFIG_I2C_MUX, 0},
-};
-
-int32_t msm_sensor_bayer_power_up(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	int32_t rc = 0, size = 0, index = 0;
-	struct msm_camera_sensor_info *data = s_ctrl->sensordata;
-	struct msm_camera_power_seq_t *power_seq = NULL;
-	CDBG("%s: %d\n", __func__, __LINE__);
-	if (s_ctrl->power_seq) {
-		power_seq = s_ctrl->power_seq;
-		size = s_ctrl->num_power_seq;
-	} else {
-		power_seq = &sensor_power_seq[0];
-		size = ARRAY_SIZE(sensor_power_seq);
-	}
-
-	s_ctrl->reg_ptr = kzalloc(sizeof(struct regulator *)
-			* data->sensor_platform_info->num_vreg, GFP_KERNEL);
-	if (!s_ctrl->reg_ptr) {
-		pr_err("%s: could not allocate mem for regulators\n",
-			__func__);
-		return -ENOMEM;
-	}
-
-	for (index = 0; index < size; index++) {
-		switch (power_seq[index].power_config) {
-		case REQUEST_GPIO:
-			rc = msm_camera_request_gpio_table(data, 1);
-			if (rc < 0) {
-				pr_err("%s: request gpio failed\n", __func__);
-				goto ERROR;
-			}
-			if (power_seq[index].delay)
-				usleep_range(power_seq[index].delay * 1000,
-					(power_seq[index].delay * 1000) + 1000);
-			break;
-		case REQUEST_VREG:
-			rc = msm_camera_config_vreg(
-				&s_ctrl->sensor_i2c_client->client->dev,
-				s_ctrl->sensordata->sensor_platform_info->
-				cam_vreg,
-				s_ctrl->sensordata->sensor_platform_info->
-				num_vreg,
-				s_ctrl->vreg_seq,
-				s_ctrl->num_vreg_seq,
-				s_ctrl->reg_ptr, 1);
-			if (rc < 0) {
-				pr_err("%s: regulator on failed\n", __func__);
-				goto ERROR;
-			}
-			if (power_seq[index].delay)
-				usleep_range(power_seq[index].delay * 1000,
-					(power_seq[index].delay * 1000) + 1000);
-			break;
-		case ENABLE_VREG:
-			rc = msm_camera_enable_vreg(
-				&s_ctrl->sensor_i2c_client->client->dev,
-				s_ctrl->sensordata->sensor_platform_info->
-				cam_vreg,
-				s_ctrl->sensordata->sensor_platform_info->
-				num_vreg,
-				s_ctrl->vreg_seq,
-				s_ctrl->num_vreg_seq,
-				s_ctrl->reg_ptr, 1);
-			if (rc < 0) {
-				pr_err("%s: enable regulator failed\n",
-					__func__);
-				goto ERROR;
-			}
-			if (power_seq[index].delay)
-				usleep_range(power_seq[index].delay * 1000,
-					(power_seq[index].delay * 1000) + 1000);
-			break;
-		case ENABLE_GPIO:
-			rc = msm_camera_config_gpio_table(data, 1);
-			if (rc < 0) {
-				pr_err("%s: config gpio failed\n", __func__);
-				goto ERROR;
-			}
-			if (power_seq[index].delay)
-				usleep_range(power_seq[index].delay * 1000,
-					(power_seq[index].delay * 1000) + 1000);
-			break;
-		case CONFIG_CLK:
-			if (s_ctrl->clk_rate != 0)
-				cam_clk_info->clk_rate = s_ctrl->clk_rate;
-
-			rc = msm_cam_clk_enable(
-				&s_ctrl->sensor_i2c_client->client->dev,
-				cam_clk_info, s_ctrl->cam_clk,
-				ARRAY_SIZE(cam_clk_info), 1);
-			if (rc < 0) {
-				pr_err("%s: clk enable failed\n", __func__);
-				goto ERROR;
-			}
-			if (power_seq[index].delay)
-				usleep_range(power_seq[index].delay * 1000,
-					(power_seq[index].delay * 1000) + 1000);
-			break;
-		case CONFIG_EXT_POWER_CTRL:
-			if (data->sensor_platform_info->ext_power_ctrl != NULL)
-				data->sensor_platform_info->ext_power_ctrl(1);
-			if (power_seq[index].delay)
-				usleep_range(power_seq[index].delay * 1000,
-					(power_seq[index].delay * 1000) + 1000);
-			break;
-		case CONFIG_I2C_MUX:
-			if (data->sensor_platform_info->i2c_conf &&
-				data->sensor_platform_info->i2c_conf->
-				use_i2c_mux)
-				msm_sensor_bayer_enable_i2c_mux(
-					data->sensor_platform_info->i2c_conf);
-			if (power_seq[index].delay)
-				usleep_range(power_seq[index].delay * 1000,
-					(power_seq[index].delay * 1000) + 1000);
-			break;
-		default:
-			pr_err("%s error power config %d\n", __func__,
-				power_seq[index].power_config);
-			rc = -EINVAL;
-			break;
-		}
-	}
-
-	return rc;
-
-ERROR:
-	for (index--; index >= 0; index--) {
-		switch (power_seq[index].power_config) {
-		case CONFIG_I2C_MUX:
-			if (data->sensor_platform_info->i2c_conf &&
-				data->sensor_platform_info->i2c_conf->
-				use_i2c_mux)
-				msm_sensor_bayer_disable_i2c_mux(
-					data->sensor_platform_info->i2c_conf);
-			break;
-		case CONFIG_EXT_POWER_CTRL:
-			if (data->sensor_platform_info->ext_power_ctrl != NULL)
-				data->sensor_platform_info->ext_power_ctrl(0);
-			break;
-		case CONFIG_CLK:
-			msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->
-				dev, cam_clk_info, s_ctrl->cam_clk,
-				ARRAY_SIZE(cam_clk_info), 0);
-			break;
-		case ENABLE_GPIO:
-			msm_camera_config_gpio_table(data, 0);
-			break;
-		case ENABLE_VREG:
-			msm_camera_enable_vreg(&s_ctrl->sensor_i2c_client->
-				client->dev,
-				s_ctrl->sensordata->sensor_platform_info->
-				cam_vreg,
-				s_ctrl->sensordata->sensor_platform_info->
-				num_vreg,
-				s_ctrl->vreg_seq,
-				s_ctrl->num_vreg_seq,
-				s_ctrl->reg_ptr, 0);
-			break;
-		case REQUEST_VREG:
-			msm_camera_config_vreg(&s_ctrl->sensor_i2c_client->
-				client->dev,
-				s_ctrl->sensordata->sensor_platform_info->
-				cam_vreg,
-				s_ctrl->sensordata->sensor_platform_info->
-				num_vreg,
-				s_ctrl->vreg_seq,
-				s_ctrl->num_vreg_seq,
-				s_ctrl->reg_ptr, 0);
-			break;
-		case REQUEST_GPIO:
-			msm_camera_request_gpio_table(data, 0);
-			break;
-		default:
-			pr_err("%s error power config %d\n", __func__,
-				power_seq[index].power_config);
-			break;
-		}
-	}
-	kfree(s_ctrl->reg_ptr);
-	return rc;
-}
-
-int32_t msm_sensor_bayer_power_down(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	int32_t size = 0, index = 0;
-	struct msm_camera_sensor_info *data = s_ctrl->sensordata;
-	struct msm_camera_power_seq_t *power_seq = NULL;
-	CDBG("%s\n", __func__);
-
-	if (s_ctrl->power_seq) {
-		power_seq = s_ctrl->power_seq;
-		size = s_ctrl->num_power_seq;
-	} else {
-		power_seq = &sensor_power_seq[0];
-		size = ARRAY_SIZE(sensor_power_seq);
-	}
-
-	for (index = (size - 1); index >= 0; index--) {
-		switch (power_seq[index].power_config) {
-		case CONFIG_I2C_MUX:
-			if (data->sensor_platform_info->i2c_conf &&
-				data->sensor_platform_info->i2c_conf->
-				use_i2c_mux)
-				msm_sensor_bayer_disable_i2c_mux(
-					data->sensor_platform_info->i2c_conf);
-			break;
-		case CONFIG_EXT_POWER_CTRL:
-			if (data->sensor_platform_info->ext_power_ctrl != NULL)
-				data->sensor_platform_info->ext_power_ctrl(0);
-			break;
-		case CONFIG_CLK:
-			msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->
-				dev, cam_clk_info, s_ctrl->cam_clk,
-				ARRAY_SIZE(cam_clk_info), 0);
-			break;
-		case ENABLE_GPIO:
-			msm_camera_config_gpio_table(data, 0);
-			break;
-		case ENABLE_VREG:
-			msm_camera_enable_vreg(&s_ctrl->sensor_i2c_client->
-				client->dev,
-				s_ctrl->sensordata->sensor_platform_info->
-				cam_vreg,
-				s_ctrl->sensordata->sensor_platform_info->
-				num_vreg,
-				s_ctrl->vreg_seq,
-				s_ctrl->num_vreg_seq,
-				s_ctrl->reg_ptr, 0);
-			break;
-		case REQUEST_VREG:
-			msm_camera_config_vreg(&s_ctrl->sensor_i2c_client->
-				client->dev,
-				s_ctrl->sensordata->sensor_platform_info->
-				cam_vreg,
-				s_ctrl->sensordata->sensor_platform_info->
-				num_vreg,
-				s_ctrl->vreg_seq,
-				s_ctrl->num_vreg_seq,
-				s_ctrl->reg_ptr, 0);
-			break;
-		case REQUEST_GPIO:
-			msm_camera_request_gpio_table(data, 0);
-			break;
-		default:
-			pr_err("%s error power config %d\n", __func__,
-				power_seq[index].power_config);
-			break;
-		}
-	}
-	kfree(s_ctrl->reg_ptr);
-	return 0;
-}
-
-int32_t msm_sensor_bayer_match_id(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	int32_t rc = 0;
-	uint16_t chipid = 0;
-	rc = msm_camera_i2c_read(
-			s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_id_info->sensor_id_reg_addr, &chipid,
-			MSM_CAMERA_I2C_WORD_DATA);
-	if (rc < 0) {
-		pr_err("%s: %s: read id failed\n", __func__,
-			s_ctrl->sensordata->sensor_name);
-		return rc;
-	}
-
-	CDBG("%s: read id: %x expected id %x:\n", __func__, chipid,
-		s_ctrl->sensor_id_info->sensor_id);
-	if (chipid != s_ctrl->sensor_id_info->sensor_id) {
-		pr_err("msm_sensor_match_id chip id doesnot match\n");
-		return -ENODEV;
-	}
-	return rc;
-}
-
-static int32_t msm_sensor_bayer_eeprom_read(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	uint32_t reg_addr = 0;
-	uint8_t *data = s_ctrl->eeprom_data.data;
-	uint32_t num_byte = 0;
-	int rc = 0;
-	uint32_t i2c_addr;
-	struct msm_camera_sensor_info *sensor_info = s_ctrl->sensordata;
-	i2c_addr = sensor_info->eeprom_info->eeprom_i2c_slave_addr;
-	num_byte = s_ctrl->eeprom_data.length = sensor_info->eeprom_info->
-		eeprom_read_length;
-	reg_addr = sensor_info->eeprom_info->eeprom_reg_addr;
-
-	data = kzalloc(num_byte * sizeof(uint8_t), GFP_KERNEL);
-	if (!data) {
-		pr_err("%s:%d failed\n", __func__, __LINE__);
-		rc = -EFAULT;
-		return rc;
-	}
-
-	s_ctrl->sensor_i2c_client->client->addr = i2c_addr;
-	CDBG("eeprom read: i2c addr is %x num byte %d  reg addr %x\n",
-		i2c_addr, num_byte, reg_addr);
-	rc = msm_camera_i2c_read_seq(s_ctrl->sensor_i2c_client, reg_addr, data,
-		num_byte);
-	s_ctrl->sensor_i2c_client->client->addr = s_ctrl->sensor_i2c_addr;
-	return rc;
-}
-
-int32_t msm_sensor_bayer_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	struct msm_sensor_ctrl_t *s_ctrl;
-	CDBG("%s %s_i2c_probe called\n", __func__, client->name);
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		pr_err("%s %s i2c_check_functionality failed\n",
-			__func__, client->name);
-		rc = -EFAULT;
-		return rc;
-	}
-
-	s_ctrl = (struct msm_sensor_ctrl_t *)(id->driver_data);
-	if (s_ctrl->sensor_i2c_client != NULL) {
-		s_ctrl->sensor_i2c_client->client = client;
-		if (s_ctrl->sensor_i2c_addr != 0)
-			s_ctrl->sensor_i2c_client->client->addr =
-				s_ctrl->sensor_i2c_addr;
-	} else {
-		pr_err("%s %s sensor_i2c_client NULL\n",
-			__func__, client->name);
-		rc = -EFAULT;
-		return rc;
-	}
-
-	s_ctrl->sensordata = client->dev.platform_data;
-	if (s_ctrl->sensordata == NULL) {
-		pr_err("%s %s NULL sensor data\n", __func__, client->name);
-		return -EFAULT;
-	}
-
-	rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
-	if (rc < 0) {
-		pr_err("%s %s power up failed\n", __func__, client->name);
-		return rc;
-	}
-
-	if (s_ctrl->func_tbl->sensor_match_id)
-		rc = s_ctrl->func_tbl->sensor_match_id(s_ctrl);
-	else
-		rc = msm_sensor_bayer_match_id(s_ctrl);
-	if (rc < 0)
-		goto probe_fail;
-
-	if (!s_ctrl->wait_num_frames)
-		s_ctrl->wait_num_frames = 1;
-
-	pr_err("%s %s probe succeeded\n", __func__, client->name);
-	snprintf(s_ctrl->sensor_v4l2_subdev.name,
-		sizeof(s_ctrl->sensor_v4l2_subdev.name), "%s", id->name);
-	v4l2_i2c_subdev_init(&s_ctrl->sensor_v4l2_subdev, client,
-		s_ctrl->sensor_v4l2_subdev_ops);
-	s_ctrl->sensor_v4l2_subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	media_entity_init(&s_ctrl->sensor_v4l2_subdev.entity, 0, NULL, 0);
-	s_ctrl->sensor_v4l2_subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	s_ctrl->sensor_v4l2_subdev.entity.group_id = SENSOR_DEV;
-	s_ctrl->sensor_v4l2_subdev.entity.name =
-		s_ctrl->sensor_v4l2_subdev.name;
-	msm_sensor_register(&s_ctrl->sensor_v4l2_subdev);
-	s_ctrl->sensor_v4l2_subdev.entity.revision =
-		s_ctrl->sensor_v4l2_subdev.devnode->num;
-	msm_sensor_bayer_eeprom_read(s_ctrl);
-	goto power_down;
-probe_fail:
-	pr_err("%s %s_i2c_probe failed\n", __func__, client->name);
-power_down:
-	if (rc > 0)
-		rc = 0;
-	s_ctrl->func_tbl->sensor_power_down(s_ctrl);
-	return rc;
-}
-
-int32_t msm_sensor_delay_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	struct msm_sensor_ctrl_t *s_ctrl;
-	CDBG("%s %s_delay_i2c_probe called\n", __func__, client->name);
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		pr_err("%s %s i2c_check_functionality failed\n",
-			__func__, client->name);
-		rc = -EFAULT;
-		return rc;
-	}
-
-	s_ctrl = (struct msm_sensor_ctrl_t *)(id->driver_data);
-	if (s_ctrl->sensor_i2c_client != NULL) {
-		s_ctrl->sensor_i2c_client->client = client;
-		if (s_ctrl->sensor_i2c_addr != 0)
-			s_ctrl->sensor_i2c_client->client->addr =
-				s_ctrl->sensor_i2c_addr;
-	} else {
-		pr_err("%s %s sensor_i2c_client NULL\n",
-			__func__, client->name);
-		rc = -EFAULT;
-		return rc;
-	}
-
-	s_ctrl->sensordata = client->dev.platform_data;
-	if (s_ctrl->sensordata == NULL) {
-		pr_err("%s %s NULL sensor data\n", __func__, client->name);
-		return -EFAULT;
-	}
-
-	if (!s_ctrl->wait_num_frames)
-		s_ctrl->wait_num_frames = 1;
-
-	pr_err("%s %s probe succeeded\n", __func__, client->name);
-	snprintf(s_ctrl->sensor_v4l2_subdev.name,
-		sizeof(s_ctrl->sensor_v4l2_subdev.name), "%s", id->name);
-	v4l2_i2c_subdev_init(&s_ctrl->sensor_v4l2_subdev, client,
-		s_ctrl->sensor_v4l2_subdev_ops);
-	s_ctrl->sensor_v4l2_subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	media_entity_init(&s_ctrl->sensor_v4l2_subdev.entity, 0, NULL, 0);
-	s_ctrl->sensor_v4l2_subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	s_ctrl->sensor_v4l2_subdev.entity.group_id = SENSOR_DEV;
-	s_ctrl->sensor_v4l2_subdev.entity.name =
-		s_ctrl->sensor_v4l2_subdev.name;
-	msm_sensor_register(&s_ctrl->sensor_v4l2_subdev);
-	s_ctrl->sensor_v4l2_subdev.entity.revision =
-		s_ctrl->sensor_v4l2_subdev.devnode->num;
-	if (rc > 0)
-		rc = 0;
-	return rc;
-}
-
-int32_t msm_sensor_bayer_power(struct v4l2_subdev *sd, int on)
-{
-	int rc = 0;
-	struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(sd);
-	mutex_lock(s_ctrl->msm_sensor_mutex);
-	if (!on)
-		rc = s_ctrl->func_tbl->sensor_power_down(s_ctrl);
-	mutex_unlock(s_ctrl->msm_sensor_mutex);
-	return rc;
-}
-
-int32_t msm_sensor_bayer_v4l2_enum_fmt(struct v4l2_subdev *sd,
-	unsigned int index, enum v4l2_mbus_pixelcode *code)
-{
-	struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(sd);
-
-	if ((unsigned int)index >= s_ctrl->sensor_v4l2_subdev_info_size)
-		return -EINVAL;
-
-	*code = s_ctrl->sensor_v4l2_subdev_info[index].code;
-	return 0;
-}
-
-int32_t msm_sensor_bayer_v4l2_s_ctrl(struct v4l2_subdev *sd,
-	struct v4l2_control *ctrl)
-{
-	int rc = -1, i = 0;
-	struct msm_sensor_ctrl_t *s_ctrl = get_sctrl(sd);
-	struct msm_sensor_v4l2_ctrl_info_t *v4l2_ctrl =
-		s_ctrl->msm_sensor_v4l2_ctrl_info;
-
-	CDBG("%s\n", __func__);
-	CDBG("%d\n", ctrl->id);
-	if (v4l2_ctrl == NULL)
-		return rc;
-	for (i = 0; i < s_ctrl->num_v4l2_ctrl; i++) {
-		if (v4l2_ctrl[i].ctrl_id == ctrl->id) {
-			if (v4l2_ctrl[i].s_v4l2_ctrl != NULL) {
-				CDBG("\n calling msm_sensor_s_ctrl_by_enum\n");
-				rc = v4l2_ctrl[i].s_v4l2_ctrl(
-					s_ctrl,
-					&s_ctrl->msm_sensor_v4l2_ctrl_info[i],
-					ctrl->value);
-			}
-			break;
-		}
-	}
-
-	return rc;
-}
-
-int32_t msm_sensor_bayer_v4l2_query_ctrl(
-	struct v4l2_subdev *sd, struct v4l2_queryctrl *qctrl)
-{
-	int rc = -1, i = 0;
-	struct msm_sensor_ctrl_t *s_ctrl =
-		(struct msm_sensor_ctrl_t *) sd->dev_priv;
-
-	CDBG("%s\n", __func__);
-	CDBG("%s id: %d\n", __func__, qctrl->id);
-
-	if (s_ctrl->msm_sensor_v4l2_ctrl_info == NULL)
-		return rc;
-
-	for (i = 0; i < s_ctrl->num_v4l2_ctrl; i++) {
-		if (s_ctrl->msm_sensor_v4l2_ctrl_info[i].ctrl_id == qctrl->id) {
-			qctrl->minimum =
-				s_ctrl->msm_sensor_v4l2_ctrl_info[i].min;
-			qctrl->maximum =
-				s_ctrl->msm_sensor_v4l2_ctrl_info[i].max;
-			qctrl->flags = 1;
-			rc = 0;
-			break;
-		}
-	}
-
-	return rc;
-}
-
-int msm_sensor_bayer_s_ctrl_by_enum(struct msm_sensor_ctrl_t *s_ctrl,
-		struct msm_sensor_v4l2_ctrl_info_t *ctrl_info, int value)
-{
-	int rc = 0;
-	CDBG("%s enter\n", __func__);
-	rc = msm_sensor_write_enum_conf_array(
-		s_ctrl->sensor_i2c_client,
-		ctrl_info->enum_cfg_settings, value);
-	return rc;
-}
-
diff --git a/drivers/media/video/msm/sensors/msm_sensor_bayer.h b/drivers/media/video/msm/sensors/msm_sensor_bayer.h
deleted file mode 100644
index 1c1ccea..0000000
--- a/drivers/media/video/msm/sensors/msm_sensor_bayer.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_SENSOR_BAYER_H
-#define MSM_SENSOR_BAYER_H
-
-#include <linux/debugfs.h>
-#include <linux/delay.h>
-#include <linux/i2c.h>
-#include <linux/miscdevice.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/types.h>
-#include <linux/uaccess.h>
-#include <mach/camera.h>
-#include <mach/gpio.h>
-#include <media/msm_camera.h>
-#include <media/v4l2-subdev.h>
-#include "msm_camera_i2c.h"
-#include "msm_camera_eeprom.h"
-#include "msm_sensor_common.h"
-
-struct sensor_driver_t {
-	struct platform_driver *platform_pdriver;
-	int32_t (*platform_probe)(struct platform_device *pdev);
-};
-
-int32_t msm_sensor_bayer_config(struct msm_sensor_ctrl_t *s_ctrl,
-			void __user *argp);
-int32_t msm_sensor_bayer_power_up(struct msm_sensor_ctrl_t *s_ctrl);
-int32_t msm_sensor_bayer_power_down(struct msm_sensor_ctrl_t *s_ctrl);
-
-int32_t msm_sensor_bayer_match_id(struct msm_sensor_ctrl_t *s_ctrl);
-int msm_sensor_bayer_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id);
-int32_t msm_sensor_delay_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id);
-int32_t msm_sensor_bayer_power(struct v4l2_subdev *sd, int on);
-
-int32_t msm_sensor_bayer_v4l2_s_ctrl(struct v4l2_subdev *sd,
-	struct v4l2_control *ctrl);
-
-int32_t msm_sensor_bayer_v4l2_query_ctrl(
-	struct v4l2_subdev *sd, struct v4l2_queryctrl *qctrl);
-
-int msm_sensor_bayer_s_ctrl_by_enum(struct msm_sensor_ctrl_t *s_ctrl,
-		struct msm_sensor_v4l2_ctrl_info_t *ctrl_info, int value);
-
-int msm_sensor_bayer_v4l2_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-			enum v4l2_mbus_pixelcode *code);
-
-long msm_sensor_bayer_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int cmd, void *arg);
-
-int32_t msm_sensor_bayer_get_csi_params(struct msm_sensor_ctrl_t *s_ctrl,
-		struct csi_lane_params_t *sensor_output_info);
-
-#define VIDIOC_MSM_SENSOR_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, void __user *)
-
-#define VIDIOC_MSM_SENSOR_RELEASE \
-	_IO('V', BASE_VIDIOC_PRIVATE + 11)
-
-#define VIDIOC_MSM_SENSOR_CSID_INFO\
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 12, struct msm_sensor_csi_info *)
-#endif
diff --git a/drivers/media/video/msm/sensors/msm_sensor_common.c b/drivers/media/video/msm/sensors/msm_sensor_common.c
deleted file mode 100644
index a8d78b0..0000000
--- a/drivers/media/video/msm/sensors/msm_sensor_common.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include "msm_sensor_common.h"
-
-struct msm_sensor_ctrl_t *get_sctrl(struct v4l2_subdev *sd)
-{
-	return container_of(sd, struct msm_sensor_ctrl_t, sensor_v4l2_subdev);
-}
diff --git a/drivers/media/video/msm/sensors/msm_sensor_common.h b/drivers/media/video/msm/sensors/msm_sensor_common.h
deleted file mode 100644
index 69e2e1a..0000000
--- a/drivers/media/video/msm/sensors/msm_sensor_common.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef MSM_SENSOR_COMMON_H
-#define MSM_SENSOR_COMMON_H
-
-#include <linux/debugfs.h>
-#include <linux/delay.h>
-#include <linux/i2c.h>
-#include <linux/miscdevice.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/types.h>
-#include <linux/uaccess.h>
-#include <linux/gpio.h>
-#include <linux/of_gpio.h>
-#include <mach/camera.h>
-#include <media/msm_camera.h>
-#include <media/v4l2-subdev.h>
-#include "msm_camera_i2c.h"
-#include "msm_camera_eeprom.h"
-#define Q8  0x00000100
-#define Q10 0x00000400
-
-#define MSM_SENSOR_MCLK_8HZ 8000000
-#define MSM_SENSOR_MCLK_16HZ 16000000
-#define MSM_SENSOR_MCLK_24HZ 24000000
-
-#define DEFINE_MSM_MUTEX(mutexname) \
-	static struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
-
-struct gpio_tlmm_cfg {
-	uint32_t gpio;
-	uint32_t dir;
-	uint32_t pull;
-	uint32_t drvstr;
-};
-
-enum msm_sensor_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	MSM_SENSOR_REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	MSM_SENSOR_UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	MSM_SENSOR_UPDATE_ALL,
-	/* Not valid update */
-	MSM_SENSOR_UPDATE_INVALID
-};
-
-enum msm_sensor_cam_mode_t {
-	MSM_SENSOR_MODE_2D_RIGHT,
-	MSM_SENSOR_MODE_2D_LEFT,
-	MSM_SENSOR_MODE_3D,
-	MSM_SENSOR_MODE_INVALID
-};
-
-enum msm_camera_power_config_t {
-	REQUEST_GPIO,
-	ENABLE_GPIO,
-	REQUEST_VREG,
-	ENABLE_VREG,
-	CONFIG_CLK,
-	CONFIG_EXT_POWER_CTRL,
-	CONFIG_I2C_MUX,
-};
-
-struct msm_camera_power_seq_t {
-	enum msm_camera_power_config_t power_config;
-	uint32_t delay;
-};
-
-struct msm_sensor_id_info_t {
-	uint16_t sensor_id_reg_addr;
-	uint16_t sensor_id;
-};
-
-struct msm_sensor_reg_t {
-	enum msm_camera_i2c_data_type default_data_type;
-	struct msm_camera_i2c_reg_conf *start_stream_conf;
-	uint8_t start_stream_conf_size;
-	struct msm_camera_i2c_reg_conf *stop_stream_conf;
-	uint8_t stop_stream_conf_size;
-	struct msm_camera_i2c_reg_conf *group_hold_on_conf;
-	uint8_t group_hold_on_conf_size;
-	struct msm_camera_i2c_reg_conf *group_hold_off_conf;
-	uint8_t group_hold_off_conf_size;
-	struct msm_camera_i2c_conf_array *init_settings;
-	uint8_t init_size;
-	struct msm_camera_i2c_conf_array *mode_settings;
-	struct msm_camera_i2c_conf_array *no_effect_settings;
-	struct msm_sensor_output_info_t *output_settings;
-	uint8_t num_conf;
-};
-
-enum msm_sensor_device_type_t {
-	MSM_SENSOR_I2C_DEVICE,
-	MSM_SENSOR_PLATFORM_DEVICE,
-};
-
-struct v4l2_subdev_info {
-	enum v4l2_mbus_pixelcode code;
-	enum v4l2_colorspace colorspace;
-	uint16_t fmt;
-	uint16_t order;
-};
-
-struct msm_sensor_ctrl_t;
-
-struct msm_sensor_v4l2_ctrl_info_t {
-	uint32_t ctrl_id;
-	int16_t min;
-	int16_t max;
-	int16_t step;
-	struct msm_camera_i2c_enum_conf_array *enum_cfg_settings;
-	int (*s_v4l2_ctrl) (struct msm_sensor_ctrl_t *,
-		struct msm_sensor_v4l2_ctrl_info_t *, int);
-};
-
-struct msm_sensor_fn_t {
-	void (*sensor_start_stream) (struct msm_sensor_ctrl_t *);
-	void (*sensor_stop_stream) (struct msm_sensor_ctrl_t *);
-	void (*sensor_group_hold_on) (struct msm_sensor_ctrl_t *);
-	void (*sensor_group_hold_off) (struct msm_sensor_ctrl_t *);
-
-	int32_t (*sensor_set_fps) (struct msm_sensor_ctrl_t *,
-			struct fps_cfg *);
-	int32_t (*sensor_write_exp_gain) (struct msm_sensor_ctrl_t *,
-			uint16_t, uint32_t, int32_t, uint16_t);
-	int32_t (*sensor_write_snapshot_exp_gain) (struct msm_sensor_ctrl_t *,
-			uint16_t, uint32_t, int32_t, uint16_t);
-	int32_t (*sensor_setting) (struct msm_sensor_ctrl_t *,
-			int update_type, int rt);
-	int32_t (*sensor_csi_setting) (struct msm_sensor_ctrl_t *,
-			int update_type, int rt);
-	int32_t (*sensor_set_sensor_mode)
-			(struct msm_sensor_ctrl_t *, int, int);
-	int32_t (*sensor_mode_init) (struct msm_sensor_ctrl_t *,
-		int, struct sensor_init_cfg *);
-	int32_t (*sensor_get_output_info) (struct msm_sensor_ctrl_t *,
-		struct sensor_output_info_t *);
-	int (*sensor_config) (struct msm_sensor_ctrl_t *, void __user *);
-	int (*sensor_power_down)
-		(struct msm_sensor_ctrl_t *);
-	int (*sensor_power_up) (struct msm_sensor_ctrl_t *);
-	int32_t (*sensor_match_id)(struct msm_sensor_ctrl_t *s_ctrl);
-	void (*sensor_adjust_frame_lines) (struct msm_sensor_ctrl_t *s_ctrl);
-	int32_t (*sensor_get_csi_params)(struct msm_sensor_ctrl_t *,
-		struct csi_lane_params_t *);
-	int (*sensor_set_vision_mode)(struct msm_sensor_ctrl_t *s_ctrl,
-			int32_t vision_mode_enable);
-	int (*sensor_set_vision_ae_control)(
-			struct msm_sensor_ctrl_t *s_ctrl, int ae_mode);
-	int32_t (*sensor_read_eeprom)(struct msm_sensor_ctrl_t *);
-	int32_t (*sensor_hdr_update)(struct msm_sensor_ctrl_t *,
-		 struct sensor_hdr_update_parm_t *);
-};
-
-struct msm_sensor_csi_info {
-	uint8_t is_csic;
-};
-
-enum msm_sensor_state {
-	MSM_SENSOR_POWER_UP,
-	MSM_SENSOR_POWER_DOWN,
-};
-
-struct msm_sensor_eeprom_data {
-	uint8_t *data;
-	uint32_t length;
-};
-
-struct msm_sensor_ctrl_t {
-	struct  msm_camera_sensor_info *sensordata;
-	struct i2c_client *msm_sensor_client;
-	struct i2c_driver *sensor_i2c_driver;
-	struct platform_device *pdev;
-	struct msm_camera_i2c_client *sensor_i2c_client;
-	uint16_t sensor_i2c_addr;
-	enum msm_camera_vreg_name_t *vreg_seq;
-	int num_vreg_seq;
-	struct msm_camera_power_seq_t *power_seq;
-	int num_power_seq;
-	enum msm_sensor_device_type_t sensor_device_type;
-
-	struct msm_sensor_output_reg_addr_t *sensor_output_reg_addr;
-	struct msm_sensor_id_info_t *sensor_id_info;
-	struct msm_sensor_exp_gain_info_t *sensor_exp_gain_info;
-	struct msm_sensor_reg_t *msm_sensor_reg;
-	struct msm_sensor_v4l2_ctrl_info_t *msm_sensor_v4l2_ctrl_info;
-	uint16_t num_v4l2_ctrl;
-	uint8_t is_csic;
-	int8_t vision_mode_flag;
-
-	uint16_t curr_line_length_pclk;
-	uint16_t curr_frame_length_lines;
-
-	uint32_t fps_divider;
-	enum msm_sensor_resolution_t curr_res;
-	enum msm_sensor_cam_mode_t cam_mode;
-
-	struct mutex *msm_sensor_mutex;
-
-	struct v4l2_subdev sensor_v4l2_subdev;
-	struct v4l2_subdev_info *sensor_v4l2_subdev_info;
-	uint8_t sensor_v4l2_subdev_info_size;
-	struct v4l2_subdev_ops *sensor_v4l2_subdev_ops;
-	struct msm_sensor_fn_t *func_tbl;
-	struct regulator **reg_ptr;
-	struct clk *cam_clk[2];
-	long clk_rate;
-	enum msm_sensor_state sensor_state;
-	/* Number of frames to delay after start / stop stream in Q10 format.
-	   Initialize to -1 for this value to be ignored */
-	int16_t wait_num_frames;
-	/* minimum delay after stop / stop stream in ms */
-	uint16_t min_delay;
-	/* delay (in ms) after power up sequence */
-	uint16_t power_seq_delay;
-	struct msm_sensor_eeprom_data eeprom_data;
-};
-
-struct msm_sensor_ctrl_t *get_sctrl(struct v4l2_subdev *sd);
-
-#endif
diff --git a/drivers/media/video/msm/sensors/msm_sensor_init.c b/drivers/media/video/msm/sensors/msm_sensor_init.c
deleted file mode 100644
index d759cf1..0000000
--- a/drivers/media/video/msm/sensors/msm_sensor_init.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#include "msm.h"
-#include "msm_sensor_bayer.h"
-#include "imx091.h"
-
-static struct i2c_driver *sensor_i2c_driver[] = {
-	/* back camera */
-	&imx091_i2c_driver,
-	/* front camera */
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	int index = 0;
-	for (index = 0; index < ARRAY_SIZE(sensor_i2c_driver); index++)
-		i2c_add_driver(sensor_i2c_driver[index]);
-	return 0;
-}
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Sensor driver probe");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/mt9e013_v4l2.c b/drivers/media/video/msm/sensors/mt9e013_v4l2.c
deleted file mode 100644
index 24373226..0000000
--- a/drivers/media/video/msm/sensors/mt9e013_v4l2.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#define SENSOR_NAME "mt9e013"
-#define PLATFORM_DRIVER_NAME "msm_camera_mt9e013"
-#define mt9e013_obj mt9e013_##obj
-
-DEFINE_MUTEX(mt9e013_mut);
-static struct msm_sensor_ctrl_t mt9e013_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf mt9e013_groupon_settings[] = {
-	{0x0104, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf mt9e013_groupoff_settings[] = {
-	{0x0104, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf mt9e013_prev_settings[] = {
-	/*Output Size (1632x1224)*/
-	{0x0344, 0x0008},/*X_ADDR_START*/
-	{0x0348, 0x0CC9},/*X_ADDR_END*/
-	{0x0346, 0x0008},/*Y_ADDR_START*/
-	{0x034A, 0x0999},/*Y_ADDR_END*/
-	{0x034C, 0x0660},/*X_OUTPUT_SIZE*/
-	{0x034E, 0x04C8},/*Y_OUTPUT_SIZE*/
-	{0x306E, 0xFCB0},/*DATAPATH_SELECT*/
-	{0x3040, 0x04C3},/*READ_MODE*/
-	{0x3178, 0x0000},/*ANALOG_CONTROL5*/
-	{0x3ED0, 0x1E24},/*DAC_LD_4_5*/
-	{0x0400, 0x0002},/*SCALING_MODE*/
-	{0x0404, 0x0010},/*SCALE_M*/
-	/*Timing configuration*/
-	{0x0342, 0x1018},/*LINE_LENGTH_PCK*/
-	{0x0340, 0x055B},/*FRAME_LENGTH_LINES*/
-	{0x0202, 0x0557},/*COARSE_INTEGRATION_TIME*/
-	{0x3014, 0x0846},/*FINE_INTEGRATION_TIME_*/
-	{0x3010, 0x0130},/*FINE_CORRECTION*/
-};
-
-static struct msm_camera_i2c_reg_conf mt9e013_snap_settings[] = {
-	/*Output Size (3264x2448)*/
-	{0x0344, 0x0000},/*X_ADDR_START */
-	{0x0348, 0x0CCF},/*X_ADDR_END*/
-	{0x0346, 0x0000},/*Y_ADDR_START */
-	{0x034A, 0x099F},/*Y_ADDR_END*/
-	{0x034C, 0x0CD0},/*X_OUTPUT_SIZE*/
-	{0x034E, 0x09A0},/*Y_OUTPUT_SIZE*/
-	{0x306E, 0xFC80},/*DATAPATH_SELECT*/
-	{0x3040, 0x0041},/*READ_MODE*/
-	{0x3178, 0x0000},/*ANALOG_CONTROL5*/
-	{0x3ED0, 0x1E24},/*DAC_LD_4_5*/
-	{0x0400, 0x0000},/*SCALING_MODE*/
-	{0x0404, 0x0010},/*SCALE_M*/
-	/*Timing configuration*/
-	{0x0342, 0x13F8},/*LINE_LENGTH_PCK*/
-	{0x0340, 0x0A2F},/*FRAME_LENGTH_LINES*/
-	{0x0202, 0x0A1F},/*COARSE_INTEGRATION_TIME*/
-	{0x3014, 0x03F6},/*FINE_INTEGRATION_TIME_ */
-	{0x3010, 0x0078},/*FINE_CORRECTION*/
-};
-
-static struct msm_camera_i2c_reg_conf mt9e013_hfr60_settings[] = {
-	{0x0300, 0x0005},/*VT_PIX_CLK_DIV*/
-	{0x0302, 0x0001},/*VT_SYS_CLK_DIV*/
-	{0x0304, 0x0002},/*PRE_PLL_CLK_DIV*/
-	{0x0306, 0x0029},/*PLL_MULTIPLIER*/
-	{0x0308, 0x000A},/*OP_PIX_CLK_DIV*/
-	{0x030A, 0x0001},/*OP_SYS_CLK_DIV*/
-	{0x0344, 0x0008},/*X_ADDR_START*/
-	{0x0348, 0x0685},/*X_ADDR_END*/
-	{0x0346, 0x013a},/*Y_ADDR_START*/
-	{0x034A, 0x055B},/*Y_ADDR_END*/
-	{0x034C, 0x0340},/*X_OUTPUT_SIZE*/
-	{0x034E, 0x0212},/*Y_OUTPUT_SIZE*/
-	{0x306E, 0xFC80},/*DATAPATH_SELECT*/
-	{0x3040, 0x00C3},/*READ_MODE*/
-	{0x3178, 0x0000},/*ANALOG_CONTROL5*/
-	{0x3ED0, 0x1E24},/*DAC_LD_4_5*/
-	{0x0400, 0x0000},/*SCALING_MODE*/
-	{0x0404, 0x0010},/*SCALE_M*/
-	/*Timing configuration*/
-	{0x0342, 0x0970},/*LINE_LENGTH_PCK*/
-	{0x0340, 0x02A1},/*FRAME_LENGTH_LINES*/
-	{0x0202, 0x02A1},/*COARSE_INTEGRATION_TIME*/
-	{0x3014, 0x03F6},/*FINE_INTEGRATION_TIME_*/
-	{0x3010, 0x0078},/*FINE_CORRECTION*/
-};
-
-static struct msm_camera_i2c_reg_conf mt9e013_hfr90_settings[] = {
-	{0x0300, 0x0005},/*VT_PIX_CLK_DIV*/
-	{0x0302, 0x0001},/*VT_SYS_CLK_DIV*/
-	{0x0304, 0x0002},/*PRE_PLL_CLK_DIV*/
-	{0x0306, 0x003D},/*PLL_MULTIPLIER*/
-	{0x0308, 0x000A},/*OP_PIX_CLK_DIV*/
-	{0x030A, 0x0001},/*OP_SYS_CLK_DIV*/
-	{0x0344, 0x0008},/*X_ADDR_START*/
-	{0x0348, 0x0685},/*X_ADDR_END*/
-	{0x0346, 0x013a},/*Y_ADDR_START*/
-	{0x034A, 0x055B},/*Y_ADDR_END*/
-	{0x034C, 0x0340},/*X_OUTPUT_SIZE*/
-	{0x034E, 0x0212},/*Y_OUTPUT_SIZE*/
-	{0x306E, 0xFC80},/*DATAPATH_SELECT*/
-	{0x3040, 0x00C3},/*READ_MODE*/
-	{0x3178, 0x0000},/*ANALOG_CONTROL5*/
-	{0x3ED0, 0x1E24},/*DAC_LD_4_5*/
-	{0x0400, 0x0000},/*SCALING_MODE*/
-	{0x0404, 0x0010},/*SCALE_M*/
-	/*Timing configuration*/
-	{0x0342, 0x0970},/*LINE_LENGTH_PCK*/
-	{0x0340, 0x02A1},/*FRAME_LENGTH_LINES*/
-	{0x0202, 0x02A1},/*COARSE_INTEGRATION_TIME*/
-	{0x3014, 0x03F6},/*FINE_INTEGRATION_TIME_*/
-	{0x3010, 0x0078},/*FINE_CORRECTION*/
-};
-
-static struct msm_camera_i2c_reg_conf mt9e013_hfr120_settings[] = {
-	{0x0300, 0x0005},/*VT_PIX_CLK_DIV*/
-	{0x0302, 0x0001},/*VT_SYS_CLK_DIV*/
-	{0x0304, 0x0002},/*PRE_PLL_CLK_DIV*/
-	{0x0306, 0x0052},/*PLL_MULTIPLIER*/
-	{0x0308, 0x000A},/*OP_PIX_CLK_DIV*/
-	{0x030A, 0x0001},/*OP_SYS_CLK_DIV*/
-	{0x0344, 0x0008},/*X_ADDR_START*/
-	{0x0348, 0x0685},/*X_ADDR_END*/
-	{0x0346, 0x013a},/*Y_ADDR_START*/
-	{0x034A, 0x055B},/*Y_ADDR_END*/
-	{0x034C, 0x0340},/*X_OUTPUT_SIZE*/
-	{0x034E, 0x0212},/*Y_OUTPUT_SIZE*/
-	{0x306E, 0xFC80},/*DATAPATH_SELECT*/
-	{0x3040, 0x00C3},/*READ_MODE*/
-	{0x3178, 0x0000},/*ANALOG_CONTROL5*/
-	{0x3ED0, 0x1E24},/*DAC_LD_4_5*/
-	{0x0400, 0x0000},/*SCALING_MODE*/
-	{0x0404, 0x0010},/*SCALE_M*/
-	/*Timing configuration*/
-	{0x0342, 0x0970},/*LINE_LENGTH_PCK*/
-	{0x0340, 0x02A1},/*FRAME_LENGTH_LINES*/
-	{0x0202, 0x02A1},/*COARSE_INTEGRATION_TIME*/
-	{0x3014, 0x03F6},/*FINE_INTEGRATION_TIME_*/
-	{0x3010, 0x0078},/*FINE_CORRECTION*/
-};
-
-static struct msm_camera_i2c_reg_conf mt9e013_recommend_settings[] = {
-	/*Disable embedded data*/
-	{0x3064, 0x7800},/*SMIA_TEST*/
-	/*configure 2-lane MIPI*/
-	{0x31AE, 0x0202},/*SERIAL_FORMAT*/
-	{0x31B8, 0x0E3F},/*MIPI_TIMING_2*/
-	/*set data to RAW10 format*/
-	{0x0112, 0x0A0A},/*CCP_DATA_FORMAT*/
-	{0x30F0, 0x800D},/*VCM CONTROL*/
-
-	{0x3044, 0x0590},
-	{0x306E, 0xFC80},
-	{0x30B2, 0xC000},
-	{0x30D6, 0x0800},
-	{0x316C, 0xB42F},
-	{0x316E, 0x869A},
-	{0x3170, 0x210E},
-	{0x317A, 0x010E},
-	{0x31E0, 0x1FB9},
-	{0x31E6, 0x07FC},
-	{0x37C0, 0x0000},
-	{0x37C2, 0x0000},
-	{0x37C4, 0x0000},
-	{0x37C6, 0x0000},
-	{0x3E00, 0x0011},
-	{0x3E02, 0x8801},
-	{0x3E04, 0x2801},
-	{0x3E06, 0x8449},
-	{0x3E08, 0x6841},
-	{0x3E0A, 0x400C},
-	{0x3E0C, 0x1001},
-	{0x3E0E, 0x2603},
-	{0x3E10, 0x4B41},
-	{0x3E12, 0x4B24},
-	{0x3E14, 0xA3CF},
-	{0x3E16, 0x8802},
-	{0x3E18, 0x8401},
-	{0x3E1A, 0x8601},
-	{0x3E1C, 0x8401},
-	{0x3E1E, 0x840A},
-	{0x3E20, 0xFF00},
-	{0x3E22, 0x8401},
-	{0x3E24, 0x00FF},
-	{0x3E26, 0x0088},
-	{0x3E28, 0x2E8A},
-	{0x3E30, 0x0000},
-	{0x3E32, 0x8801},
-	{0x3E34, 0x4029},
-	{0x3E36, 0x00FF},
-	{0x3E38, 0x8469},
-	{0x3E3A, 0x00FF},
-	{0x3E3C, 0x2801},
-	{0x3E3E, 0x3E2A},
-	{0x3E40, 0x1C01},
-	{0x3E42, 0xFF84},
-	{0x3E44, 0x8401},
-	{0x3E46, 0x0C01},
-	{0x3E48, 0x8401},
-	{0x3E4A, 0x00FF},
-	{0x3E4C, 0x8402},
-	{0x3E4E, 0x8984},
-	{0x3E50, 0x6628},
-	{0x3E52, 0x8340},
-	{0x3E54, 0x00FF},
-	{0x3E56, 0x4A42},
-	{0x3E58, 0x2703},
-	{0x3E5A, 0x6752},
-	{0x3E5C, 0x3F2A},
-	{0x3E5E, 0x846A},
-	{0x3E60, 0x4C01},
-	{0x3E62, 0x8401},
-	{0x3E66, 0x3901},
-	{0x3E90, 0x2C01},
-	{0x3E98, 0x2B02},
-	{0x3E92, 0x2A04},
-	{0x3E94, 0x2509},
-	{0x3E96, 0x0000},
-	{0x3E9A, 0x2905},
-	{0x3E9C, 0x00FF},
-	{0x3ECC, 0x00EB},
-	{0x3ED0, 0x1E24},
-	{0x3ED4, 0xAFC4},
-	{0x3ED6, 0x909B},
-	{0x3EE0, 0x2424},
-	{0x3EE2, 0x9797},
-	{0x3EE4, 0xC100},
-	{0x3EE6, 0x0540},
-	{0x3174, 0x8000},
-	/* PLL settings */
-	{0x0300, 0x0004},/*VT_PIX_CLK_DIV*/
-	{0x0302, 0x0001},/*VT_SYS_CLK_DIV*/
-	{0x0304, 0x0002},/*PRE_PLL_CLK_DIV*/
-	{0x0306, 0x003A},/*PLL_MULTIPLIER*/
-	{0x0308, 0x000A},/*OP_PIX_CLK_DIV*/
-	{0x030A, 0x0001},/*OP_SYS_CLK_DIV*/
-};
-
-static struct v4l2_subdev_info mt9e013_subdev_info[] = {
-	{
-	.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array mt9e013_init_conf[] = {
-	{&mt9e013_recommend_settings[0],
-	ARRAY_SIZE(mt9e013_recommend_settings), 0, MSM_CAMERA_I2C_WORD_DATA}
-};
-
-static struct msm_camera_i2c_conf_array mt9e013_confs[] = {
-	{&mt9e013_snap_settings[0],
-	ARRAY_SIZE(mt9e013_snap_settings), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{&mt9e013_prev_settings[0],
-	ARRAY_SIZE(mt9e013_prev_settings), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{&mt9e013_hfr60_settings[0],
-	ARRAY_SIZE(mt9e013_hfr60_settings), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{&mt9e013_hfr90_settings[0],
-	ARRAY_SIZE(mt9e013_hfr90_settings), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{&mt9e013_hfr120_settings[0],
-	ARRAY_SIZE(mt9e013_hfr120_settings), 0, MSM_CAMERA_I2C_WORD_DATA},
-};
-
-static struct msm_sensor_output_info_t mt9e013_dimensions[] = {
-	{
-		.x_output = 0xCD0,
-		.y_output = 0x9A0,
-		.line_length_pclk = 0x13F8,
-		.frame_length_lines = 0xA2F,
-		.vt_pixel_clk = 174000000,
-		.op_pixel_clk = 174000000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x660,
-		.y_output = 0x4C8,
-		.line_length_pclk = 0x1018,
-		.frame_length_lines = 0x55B,
-		.vt_pixel_clk = 174000000,
-		.op_pixel_clk = 174000000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x340,
-		.y_output = 0x212,
-		.line_length_pclk = 0x970,
-		.frame_length_lines = 0x2A1,
-		.vt_pixel_clk = 98400000,
-		.op_pixel_clk = 98400000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x340,
-		.y_output = 0x212,
-		.line_length_pclk = 0x970,
-		.frame_length_lines = 0x2A1,
-		.vt_pixel_clk = 146400000,
-		.op_pixel_clk = 146400000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x340,
-		.y_output = 0x212,
-		.line_length_pclk = 0x970,
-		.frame_length_lines = 0x2A1,
-		.vt_pixel_clk = 196800000,
-		.op_pixel_clk = 196800000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_sensor_output_reg_addr_t mt9e013_reg_addr = {
-	.x_output = 0x34C,
-	.y_output = 0x34E,
-	.line_length_pclk = 0x342,
-	.frame_length_lines = 0x340,
-};
-
-static struct msm_sensor_id_info_t mt9e013_id_info = {
-	.sensor_id_reg_addr = 0x0,
-	.sensor_id = 0x4B00,
-};
-
-static struct msm_sensor_exp_gain_info_t mt9e013_exp_gain_info = {
-	.coarse_int_time_addr = 0x202,
-	.global_gain_addr = 0x305E,
-	.vert_offset = 0,
-};
-
-static int32_t mt9e013_write_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
-{
-	uint32_t fl_lines;
-	fl_lines =
-		(s_ctrl->curr_frame_length_lines * s_ctrl->fps_divider) / Q10;
-
-	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr, gain | 0x1000,
-		MSM_CAMERA_I2C_WORD_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr, line,
-		MSM_CAMERA_I2C_WORD_DATA);
-	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	return 0;
-}
-
-static int32_t mt9e013_write_exp_snapshot_gain(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
-{
-	uint32_t fl_lines;
-	fl_lines =
-		(s_ctrl->curr_frame_length_lines * s_ctrl->fps_divider) / Q10;
-
-	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr, gain | 0x1000,
-		MSM_CAMERA_I2C_WORD_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr, line,
-		MSM_CAMERA_I2C_WORD_DATA);
-	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		0x301A, (0x065C|0x2), MSM_CAMERA_I2C_WORD_DATA);
-
-	return 0;
-}
-static void mt9e013_start_stream(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		0x301A, 0x8250, MSM_CAMERA_I2C_WORD_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		0x301A, 0x8650, MSM_CAMERA_I2C_WORD_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		0x301A, 0x8658, MSM_CAMERA_I2C_WORD_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		0x0104, 0x00, MSM_CAMERA_I2C_BYTE_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		0x301A, 0x065C, MSM_CAMERA_I2C_WORD_DATA);
-}
-
-static void mt9e013_stop_stream(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		0x301A, 0x0058, MSM_CAMERA_I2C_WORD_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		0x301A, 0x0050, MSM_CAMERA_I2C_WORD_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		0x0104, 0x01, MSM_CAMERA_I2C_BYTE_DATA);
-}
-
-static const struct i2c_device_id mt9e013_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&mt9e013_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver mt9e013_i2c_driver = {
-	.id_table = mt9e013_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client mt9e013_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	return i2c_add_driver(&mt9e013_i2c_driver);
-}
-
-static struct v4l2_subdev_core_ops mt9e013_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops mt9e013_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops mt9e013_subdev_ops = {
-	.core = &mt9e013_subdev_core_ops,
-	.video  = &mt9e013_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t mt9e013_func_tbl = {
-	.sensor_start_stream = mt9e013_start_stream,
-	.sensor_stop_stream = mt9e013_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = mt9e013_write_exp_gain,
-	.sensor_write_snapshot_exp_gain = mt9e013_write_exp_snapshot_gain,
-	.sensor_csi_setting = msm_sensor_setting1,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-};
-
-static struct msm_sensor_reg_t mt9e013_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.group_hold_on_conf = mt9e013_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(mt9e013_groupon_settings),
-	.group_hold_off_conf = mt9e013_groupoff_settings,
-	.group_hold_off_conf_size =
-		ARRAY_SIZE(mt9e013_groupoff_settings),
-	.init_settings = &mt9e013_init_conf[0],
-	.init_size = ARRAY_SIZE(mt9e013_init_conf),
-	.mode_settings = &mt9e013_confs[0],
-	.output_settings = &mt9e013_dimensions[0],
-	.num_conf = ARRAY_SIZE(mt9e013_confs),
-};
-
-static struct msm_sensor_ctrl_t mt9e013_s_ctrl = {
-	.msm_sensor_reg = &mt9e013_regs,
-	.sensor_i2c_client = &mt9e013_sensor_i2c_client,
-	.sensor_i2c_addr = 0x6C,
-	.sensor_output_reg_addr = &mt9e013_reg_addr,
-	.sensor_id_info = &mt9e013_id_info,
-	.sensor_exp_gain_info = &mt9e013_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &mt9e013_mut,
-	.sensor_i2c_driver = &mt9e013_i2c_driver,
-	.sensor_v4l2_subdev_info = mt9e013_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(mt9e013_subdev_info),
-	.sensor_v4l2_subdev_ops = &mt9e013_subdev_ops,
-	.func_tbl = &mt9e013_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Aptina 8MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
-
-
diff --git a/drivers/media/video/msm/sensors/mt9m114_v4l2.c b/drivers/media/video/msm/sensors/mt9m114_v4l2.c
deleted file mode 100644
index 6095fe1..0000000
--- a/drivers/media/video/msm/sensors/mt9m114_v4l2.c
+++ /dev/null
@@ -1,1290 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#define SENSOR_NAME "mt9m114"
-#define PLATFORM_DRIVER_NAME "msm_camera_mt9m114"
-#define mt9m114_obj mt9m114_##obj
-
-/* Sysctl registers */
-#define MT9M114_COMMAND_REGISTER                0x0080
-#define MT9M114_COMMAND_REGISTER_APPLY_PATCH    (1 << 0)
-#define MT9M114_COMMAND_REGISTER_SET_STATE      (1 << 1)
-#define MT9M114_COMMAND_REGISTER_REFRESH        (1 << 2)
-#define MT9M114_COMMAND_REGISTER_WAIT_FOR_EVENT (1 << 3)
-#define MT9M114_COMMAND_REGISTER_OK             (1 << 15)
-
-DEFINE_MUTEX(mt9m114_mut);
-static struct msm_sensor_ctrl_t mt9m114_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf mt9m114_720p_settings[] = {
-	{0xdc00, 0x50, MSM_CAMERA_I2C_BYTE_DATA, MSM_CAMERA_I2C_CMD_WRITE},
-	{MT9M114_COMMAND_REGISTER, MT9M114_COMMAND_REGISTER_SET_STATE,
-		MSM_CAMERA_I2C_UNSET_WORD_MASK, MSM_CAMERA_I2C_CMD_POLL},
-	{MT9M114_COMMAND_REGISTER, (MT9M114_COMMAND_REGISTER_OK |
-		MT9M114_COMMAND_REGISTER_SET_STATE), MSM_CAMERA_I2C_WORD_DATA,
-		MSM_CAMERA_I2C_CMD_WRITE},
-	{MT9M114_COMMAND_REGISTER, MT9M114_COMMAND_REGISTER_SET_STATE,
-		MSM_CAMERA_I2C_UNSET_WORD_MASK, MSM_CAMERA_I2C_CMD_POLL},
-	{0xDC01, 0x52, MSM_CAMERA_I2C_BYTE_DATA, MSM_CAMERA_I2C_CMD_POLL},
-
-	{0x098E, 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{0xC800, 0x007C,},/*y_addr_start = 124*/
-	{0xC802, 0x0004,},/*x_addr_start = 4*/
-	{0xC804, 0x0353,},/*y_addr_end = 851*/
-	{0xC806, 0x050B,},/*x_addr_end = 1291*/
-	{0xC808, 0x02DC,},/*pixclk = 48000000*/
-	{0xC80A, 0x6C00,},/*pixclk = 48000000*/
-	{0xC80C, 0x0001,},/*row_speed = 1*/
-	{0xC80E, 0x00DB,},/*fine_integ_time_min = 219*/
-	{0xC810, 0x05BD,},/*fine_integ_time_max = 1469*/
-	{0xC812, 0x03E8,},/*frame_length_lines = 1000*/
-	{0xC814, 0x0640,},/*line_length_pck = 1600*/
-	{0xC816, 0x0060,},/*fine_correction = 96*/
-	{0xC818, 0x02D3,},/*cpipe_last_row = 723*/
-	{0xC826, 0x0020,},/*reg_0_data = 32*/
-	{0xC834, 0x0000,},/*sensor_control_read_mode = 0*/
-	{0xC854, 0x0000,},/*crop_window_xoffset = 0*/
-	{0xC856, 0x0000,},/*crop_window_yoffset = 0*/
-	{0xC858, 0x0500,},/*crop_window_width = 1280*/
-	{0xC85A, 0x02D0,},/*crop_window_height = 720*/
-	{0xC85C, 0x03, MSM_CAMERA_I2C_BYTE_DATA},  /*crop_cropmode = 3*/
-	{0xC868, 0x0500,},/*output_width = 1280*/
-	{0xC86A, 0x02D0,},/*output_height = 720*/
-	{0xC878, 0x00, MSM_CAMERA_I2C_BYTE_DATA},  /*aet_aemode = 0*/
-	{0xC88C, 0x1E00,},/*aet_max_frame_rate = 7680*/
-	{0xC88E, 0x1E00,},/*aet_min_frame_rate = 7680*/
-	{0xC914, 0x0000,},/*stat_awb_window_xstart = 0*/
-	{0xC916, 0x0000,},/*stat_awb_window_ystart = 0*/
-	{0xC918, 0x04FF,},/*stat_awb_window_xend = 1279*/
-	{0xC91A, 0x02CF,},/*stat_awb_window_yend = 719*/
-	{0xC91C, 0x0000,},/*stat_ae_window_xstart = 0*/
-	{0xC91E, 0x0000,},/*stat_ae_window_ystart = 0*/
-	{0xC920, 0x00FF,},/*stat_ae_window_xend = 255*/
-	{0xC922, 0x008F,},/*stat_ae_window_yend = 143*/
-};
-
-static struct msm_camera_i2c_reg_conf mt9m114_recommend_settings[] = {
-	{0x301A, 0x0200, MSM_CAMERA_I2C_SET_WORD_MASK},
-	{0x098E, 0, MSM_CAMERA_I2C_BYTE_DATA},
-	/*cam_sysctl_pll_enable = 1*/
-	{0xC97E, 0x01, MSM_CAMERA_I2C_BYTE_DATA},
-	/*cam_sysctl_pll_divider_m_n = 288*/
-	{0xC980, 0x0120,},
-	/*cam_sysctl_pll_divider_p = 1792*/
-	{0xC982, 0x0700,},
-	/*output_control = 32769*/
-	{0xC984, 0x8001,},
-	/*mipi_timing_t_hs_zero = 3840*/
-	{0xC988, 0x0F00,},
-	/*mipi_timing_t_hs_exit_hs_trail = 2823*/
-	{0xC98A, 0x0B07,},
-	/*mipi_timing_t_clk_post_clk_pre = 3329*/
-	{0xC98C, 0x0D01,},
-	/*mipi_timing_t_clk_trail_clk_zero = 1821*/
-	{0xC98E, 0x071D,},
-	/*mipi_timing_t_lpx = 6*/
-	{0xC990, 0x0006,},
-	/*mipi_timing_init_timing = 2572*/
-	{0xC992, 0x0A0C,},
-	{0xC800, 0x007C,},/*y_addr_start = 124*/
-	{0xC802, 0x0004,},/*x_addr_start = 4*/
-	{0xC804, 0x0353,},/*y_addr_end = 851*/
-	{0xC806, 0x050B,},/*x_addr_end = 1291*/
-	{0xC808, 0x02DC,},/*pixclk = 48000000*/
-	{0xC80A, 0x6C00,},/*pixclk = 48000000*/
-	{0xC80C, 0x0001,},/*row_speed = 1*/
-	{0xC80E, 0x00DB,},/*fine_integ_time_min = 219*/
-	{0xC810, 0x05BD,},/*fine_integ_time_max = 1469*/
-	{0xC812, 0x03E8,},/*frame_length_lines = 1000*/
-	{0xC814, 0x0640,},/*line_length_pck = 1600*/
-	{0xC816, 0x0060,},/*fine_correction = 96*/
-	{0xC818, 0x02D3,},/*cpipe_last_row = 723*/
-	{0xC826, 0x0020,},/*reg_0_data = 32*/
-	{0xC834, 0x0000,},/*sensor_control_read_mode = 0*/
-	{0xC854, 0x0000,},/*crop_window_xoffset = 0*/
-	{0xC856, 0x0000,},/*crop_window_yoffset = 0*/
-	{0xC858, 0x0500,},/*crop_window_width = 1280*/
-	{0xC85A, 0x02D0,},/*crop_window_height = 720*/
-	{0xC85C, 0x03, MSM_CAMERA_I2C_BYTE_DATA},  /*crop_cropmode = 3*/
-	{0xC868, 0x0500,},/*output_width = 1280*/
-	{0xC86A, 0x02D0,},/*output_height = 720*/
-	{0xC878, 0x00, MSM_CAMERA_I2C_BYTE_DATA},  /*aet_aemode = 0*/
-	{0xC88C, 0x1E00,},/*aet_max_frame_rate = 7680*/
-	{0xC88E, 0x1E00,},/*aet_min_frame_rate = 7680*/
-	{0xC914, 0x0000,},/*stat_awb_window_xstart = 0*/
-	{0xC916, 0x0000,},/*stat_awb_window_ystart = 0*/
-	{0xC918, 0x04FF,},/*stat_awb_window_xend = 1279*/
-	{0xC91A, 0x02CF,},/*stat_awb_window_yend = 719*/
-	{0xC91C, 0x0000,},/*stat_ae_window_xstart = 0*/
-	{0xC91E, 0x0000,},/*stat_ae_window_ystart = 0*/
-	{0xC920, 0x00FF,},/*stat_ae_window_xend = 255*/
-	{0xC922, 0x008F,},/*stat_ae_window_yend = 143*/
-
-	/*Sensor optimization*/
-	{0x316A, 0x8270,},
-	{0x316C, 0x8270,},
-	{0x3ED0, 0x2305,},
-	{0x3ED2, 0x77CF,},
-	{0x316E, 0x8202,},
-	{0x3180, 0x87FF,},
-	{0x30D4, 0x6080,},
-	{0xA802, 0x0008,},/*AE_TRACK_MODE*/
-	{0x3E14, 0xFF39,},
-	{0x0982, 0x0001,},/*ACCESS_CTL_STAT*/
-	{0x098A, 0x5000,},/*PHYSICAL_ADDRESS_ACCESS*/
-	{0xD000, 0x70CF,},
-	{0xD002, 0xFFFF,},
-	{0xD004, 0xC5D4,},
-	{0xD006, 0x903A,},
-	{0xD008, 0x2144,},
-	{0xD00A, 0x0C00,},
-	{0xD00C, 0x2186,},
-	{0xD00E, 0x0FF3,},
-	{0xD010, 0xB844,},
-	{0xD012, 0xB948,},
-	{0xD014, 0xE082,},
-	{0xD016, 0x20CC,},
-	{0xD018, 0x80E2,},
-	{0xD01A, 0x21CC,},
-	{0xD01C, 0x80A2,},
-	{0xD01E, 0x21CC,},
-	{0xD020, 0x80E2,},
-	{0xD022, 0xF404,},
-	{0xD024, 0xD801,},
-	{0xD026, 0xF003,},
-	{0xD028, 0xD800,},
-	{0xD02A, 0x7EE0,},
-	{0xD02C, 0xC0F1,},
-	{0xD02E, 0x08BA,},
-	{0xD030, 0x0600,},
-	{0xD032, 0xC1A1,},
-	{0xD034, 0x76CF,},
-	{0xD036, 0xFFFF,},
-	{0xD038, 0xC130,},
-	{0xD03A, 0x6E04,},
-	{0xD03C, 0xC040,},
-	{0xD03E, 0x71CF,},
-	{0xD040, 0xFFFF,},
-	{0xD042, 0xC790,},
-	{0xD044, 0x8103,},
-	{0xD046, 0x77CF,},
-	{0xD048, 0xFFFF,},
-	{0xD04A, 0xC7C0,},
-	{0xD04C, 0xE001,},
-	{0xD04E, 0xA103,},
-	{0xD050, 0xD800,},
-	{0xD052, 0x0C6A,},
-	{0xD054, 0x04E0,},
-	{0xD056, 0xB89E,},
-	{0xD058, 0x7508,},
-	{0xD05A, 0x8E1C,},
-	{0xD05C, 0x0809,},
-	{0xD05E, 0x0191,},
-	{0xD060, 0xD801,},
-	{0xD062, 0xAE1D,},
-	{0xD064, 0xE580,},
-	{0xD066, 0x20CA,},
-	{0xD068, 0x0022,},
-	{0xD06A, 0x20CF,},
-	{0xD06C, 0x0522,},
-	{0xD06E, 0x0C5C,},
-	{0xD070, 0x04E2,},
-	{0xD072, 0x21CA,},
-	{0xD074, 0x0062,},
-	{0xD076, 0xE580,},
-	{0xD078, 0xD901,},
-	{0xD07A, 0x79C0,},
-	{0xD07C, 0xD800,},
-	{0xD07E, 0x0BE6,},
-	{0xD080, 0x04E0,},
-	{0xD082, 0xB89E,},
-	{0xD084, 0x70CF,},
-	{0xD086, 0xFFFF,},
-	{0xD088, 0xC8D4,},
-	{0xD08A, 0x9002,},
-	{0xD08C, 0x0857,},
-	{0xD08E, 0x025E,},
-	{0xD090, 0xFFDC,},
-	{0xD092, 0xE080,},
-	{0xD094, 0x25CC,},
-	{0xD096, 0x9022,},
-	{0xD098, 0xF225,},
-	{0xD09A, 0x1700,},
-	{0xD09C, 0x108A,},
-	{0xD09E, 0x73CF,},
-	{0xD0A0, 0xFF00,},
-	{0xD0A2, 0x3174,},
-	{0xD0A4, 0x9307,},
-	{0xD0A6, 0x2A04,},
-	{0xD0A8, 0x103E,},
-	{0xD0AA, 0x9328,},
-	{0xD0AC, 0x2942,},
-	{0xD0AE, 0x7140,},
-	{0xD0B0, 0x2A04,},
-	{0xD0B2, 0x107E,},
-	{0xD0B4, 0x9349,},
-	{0xD0B6, 0x2942,},
-	{0xD0B8, 0x7141,},
-	{0xD0BA, 0x2A04,},
-	{0xD0BC, 0x10BE,},
-	{0xD0BE, 0x934A,},
-	{0xD0C0, 0x2942,},
-	{0xD0C2, 0x714B,},
-	{0xD0C4, 0x2A04,},
-	{0xD0C6, 0x10BE,},
-	{0xD0C8, 0x130C,},
-	{0xD0CA, 0x010A,},
-	{0xD0CC, 0x2942,},
-	{0xD0CE, 0x7142,},
-	{0xD0D0, 0x2250,},
-	{0xD0D2, 0x13CA,},
-	{0xD0D4, 0x1B0C,},
-	{0xD0D6, 0x0284,},
-	{0xD0D8, 0xB307,},
-	{0xD0DA, 0xB328,},
-	{0xD0DC, 0x1B12,},
-	{0xD0DE, 0x02C4,},
-	{0xD0E0, 0xB34A,},
-	{0xD0E2, 0xED88,},
-	{0xD0E4, 0x71CF,},
-	{0xD0E6, 0xFF00,},
-	{0xD0E8, 0x3174,},
-	{0xD0EA, 0x9106,},
-	{0xD0EC, 0xB88F,},
-	{0xD0EE, 0xB106,},
-	{0xD0F0, 0x210A,},
-	{0xD0F2, 0x8340,},
-	{0xD0F4, 0xC000,},
-	{0xD0F6, 0x21CA,},
-	{0xD0F8, 0x0062,},
-	{0xD0FA, 0x20F0,},
-	{0xD0FC, 0x0040,},
-	{0xD0FE, 0x0B02,},
-	{0xD100, 0x0320,},
-	{0xD102, 0xD901,},
-	{0xD104, 0x07F1,},
-	{0xD106, 0x05E0,},
-	{0xD108, 0xC0A1,},
-	{0xD10A, 0x78E0,},
-	{0xD10C, 0xC0F1,},
-	{0xD10E, 0x71CF,},
-	{0xD110, 0xFFFF,},
-	{0xD112, 0xC7C0,},
-	{0xD114, 0xD840,},
-	{0xD116, 0xA900,},
-	{0xD118, 0x71CF,},
-	{0xD11A, 0xFFFF,},
-	{0xD11C, 0xD02C,},
-	{0xD11E, 0xD81E,},
-	{0xD120, 0x0A5A,},
-	{0xD122, 0x04E0,},
-	{0xD124, 0xDA00,},
-	{0xD126, 0xD800,},
-	{0xD128, 0xC0D1,},
-	{0xD12A, 0x7EE0,},
-	{0x098E, 0x0000,},
-
-	{0x0982, 0x0001,},
-	{0x098A, 0x5C10,},
-	{0xDC10, 0xC0F1,},
-	{0xDC12, 0x0CDA,},
-	{0xDC14, 0x0580,},
-	{0xDC16, 0x76CF,},
-	{0xDC18, 0xFF00,},
-	{0xDC1A, 0x2184,},
-	{0xDC1C, 0x9624,},
-	{0xDC1E, 0x218C,},
-	{0xDC20, 0x8FC3,},
-	{0xDC22, 0x75CF,},
-	{0xDC24, 0xFFFF,},
-	{0xDC26, 0xE058,},
-	{0xDC28, 0xF686,},
-	{0xDC2A, 0x1550,},
-	{0xDC2C, 0x1080,},
-	{0xDC2E, 0xE001,},
-	{0xDC30, 0x1D50,},
-	{0xDC32, 0x1002,},
-	{0xDC34, 0x1552,},
-	{0xDC36, 0x1100,},
-	{0xDC38, 0x6038,},
-	{0xDC3A, 0x1D52,},
-	{0xDC3C, 0x1004,},
-	{0xDC3E, 0x1540,},
-	{0xDC40, 0x1080,},
-	{0xDC42, 0x081B,},
-	{0xDC44, 0x00D1,},
-	{0xDC46, 0x8512,},
-	{0xDC48, 0x1000,},
-	{0xDC4A, 0x00C0,},
-	{0xDC4C, 0x7822,},
-	{0xDC4E, 0x2089,},
-	{0xDC50, 0x0FC1,},
-	{0xDC52, 0x2008,},
-	{0xDC54, 0x0F81,},
-	{0xDC56, 0xFFFF,},
-	{0xDC58, 0xFF80,},
-	{0xDC5A, 0x8512,},
-	{0xDC5C, 0x1801,},
-	{0xDC5E, 0x0052,},
-	{0xDC60, 0xA512,},
-	{0xDC62, 0x1544,},
-	{0xDC64, 0x1080,},
-	{0xDC66, 0xB861,},
-	{0xDC68, 0x262F,},
-	{0xDC6A, 0xF007,},
-	{0xDC6C, 0x1D44,},
-	{0xDC6E, 0x1002,},
-	{0xDC70, 0x20CA,},
-	{0xDC72, 0x0021,},
-	{0xDC74, 0x20CF,},
-	{0xDC76, 0x04E1,},
-	{0xDC78, 0x0850,},
-	{0xDC7A, 0x04A1,},
-	{0xDC7C, 0x21CA,},
-	{0xDC7E, 0x0021,},
-	{0xDC80, 0x1542,},
-	{0xDC82, 0x1140,},
-	{0xDC84, 0x8D2C,},
-	{0xDC86, 0x6038,},
-	{0xDC88, 0x1D42,},
-	{0xDC8A, 0x1004,},
-	{0xDC8C, 0x1542,},
-	{0xDC8E, 0x1140,},
-	{0xDC90, 0xB601,},
-	{0xDC92, 0x046D,},
-	{0xDC94, 0x0580,},
-	{0xDC96, 0x78E0,},
-	{0xDC98, 0xD800,},
-	{0xDC9A, 0xB893,},
-	{0xDC9C, 0x002D,},
-	{0xDC9E, 0x04A0,},
-	{0xDCA0, 0xD900,},
-	{0xDCA2, 0x78E0,},
-	{0xDCA4, 0x72CF,},
-	{0xDCA6, 0xFFFF,},
-	{0xDCA8, 0xE058,},
-	{0xDCAA, 0x2240,},
-	{0xDCAC, 0x0340,},
-	{0xDCAE, 0xA212,},
-	{0xDCB0, 0x208A,},
-	{0xDCB2, 0x0FFF,},
-	{0xDCB4, 0x1A42,},
-	{0xDCB6, 0x0004,},
-	{0xDCB8, 0xD830,},
-	{0xDCBA, 0x1A44,},
-	{0xDCBC, 0x0002,},
-	{0xDCBE, 0xD800,},
-	{0xDCC0, 0x1A50,},
-	{0xDCC2, 0x0002,},
-	{0xDCC4, 0x1A52,},
-	{0xDCC6, 0x0004,},
-	{0xDCC8, 0x1242,},
-	{0xDCCA, 0x0140,},
-	{0xDCCC, 0x8A2C,},
-	{0xDCCE, 0x6038,},
-	{0xDCD0, 0x1A42,},
-	{0xDCD2, 0x0004,},
-	{0xDCD4, 0x1242,},
-	{0xDCD6, 0x0141,},
-	{0xDCD8, 0x70CF,},
-	{0xDCDA, 0xFF00,},
-	{0xDCDC, 0x2184,},
-	{0xDCDE, 0xB021,},
-	{0xDCE0, 0xD800,},
-	{0xDCE2, 0xB893,},
-	{0xDCE4, 0x07E5,},
-	{0xDCE6, 0x0460,},
-	{0xDCE8, 0xD901,},
-	{0xDCEA, 0x78E0,},
-	{0xDCEC, 0xC0F1,},
-	{0xDCEE, 0x0BFA,},
-	{0xDCF0, 0x05A0,},
-	{0xDCF2, 0x216F,},
-	{0xDCF4, 0x0043,},
-	{0xDCF6, 0xC1A4,},
-	{0xDCF8, 0x220A,},
-	{0xDCFA, 0x1F80,},
-	{0xDCFC, 0xFFFF,},
-	{0xDCFE, 0xE058,},
-	{0xDD00, 0x2240,},
-	{0xDD02, 0x134F,},
-	{0xDD04, 0x1A48,},
-	{0xDD06, 0x13C0,},
-	{0xDD08, 0x1248,},
-	{0xDD0A, 0x1002,},
-	{0xDD0C, 0x70CF,},
-	{0xDD0E, 0x7FFF,},
-	{0xDD10, 0xFFFF,},
-	{0xDD12, 0xE230,},
-	{0xDD14, 0xC240,},
-	{0xDD16, 0xDA00,},
-	{0xDD18, 0xF00C,},
-	{0xDD1A, 0x1248,},
-	{0xDD1C, 0x1003,},
-	{0xDD1E, 0x1301,},
-	{0xDD20, 0x04CB,},
-	{0xDD22, 0x7261,},
-	{0xDD24, 0x2108,},
-	{0xDD26, 0x0081,},
-	{0xDD28, 0x2009,},
-	{0xDD2A, 0x0080,},
-	{0xDD2C, 0x1A48,},
-	{0xDD2E, 0x10C0,},
-	{0xDD30, 0x1248,},
-	{0xDD32, 0x100B,},
-	{0xDD34, 0xC300,},
-	{0xDD36, 0x0BE7,},
-	{0xDD38, 0x90C4,},
-	{0xDD3A, 0x2102,},
-	{0xDD3C, 0x0003,},
-	{0xDD3E, 0x238C,},
-	{0xDD40, 0x8FC3,},
-	{0xDD42, 0xF6C7,},
-	{0xDD44, 0xDAFF,},
-	{0xDD46, 0x1A05,},
-	{0xDD48, 0x1082,},
-	{0xDD4A, 0xC241,},
-	{0xDD4C, 0xF005,},
-	{0xDD4E, 0x7A6F,},
-	{0xDD50, 0xC241,},
-	{0xDD52, 0x1A05,},
-	{0xDD54, 0x10C2,},
-	{0xDD56, 0x2000,},
-	{0xDD58, 0x8040,},
-	{0xDD5A, 0xDA00,},
-	{0xDD5C, 0x20C0,},
-	{0xDD5E, 0x0064,},
-	{0xDD60, 0x781C,},
-	{0xDD62, 0xC042,},
-	{0xDD64, 0x1C0E,},
-	{0xDD66, 0x3082,},
-	{0xDD68, 0x1A48,},
-	{0xDD6A, 0x13C0,},
-	{0xDD6C, 0x7548,},
-	{0xDD6E, 0x7348,},
-	{0xDD70, 0x7148,},
-	{0xDD72, 0x7648,},
-	{0xDD74, 0xF002,},
-	{0xDD76, 0x7608,},
-	{0xDD78, 0x1248,},
-	{0xDD7A, 0x1000,},
-	{0xDD7C, 0x1400,},
-	{0xDD7E, 0x300B,},
-	{0xDD80, 0x084D,},
-	{0xDD82, 0x02C5,},
-	{0xDD84, 0x1248,},
-	{0xDD86, 0x1000,},
-	{0xDD88, 0xE101,},
-	{0xDD8A, 0x1001,},
-	{0xDD8C, 0x04CB,},
-	{0xDD8E, 0x1A48,},
-	{0xDD90, 0x1000,},
-	{0xDD92, 0x7361,},
-	{0xDD94, 0x1408,},
-	{0xDD96, 0x300B,},
-	{0xDD98, 0x2302,},
-	{0xDD9A, 0x02C0,},
-	{0xDD9C, 0x780D,},
-	{0xDD9E, 0x2607,},
-	{0xDDA0, 0x903E,},
-	{0xDDA2, 0x07D6,},
-	{0xDDA4, 0xFFE3,},
-	{0xDDA6, 0x792F,},
-	{0xDDA8, 0x09CF,},
-	{0xDDAA, 0x8152,},
-	{0xDDAC, 0x1248,},
-	{0xDDAE, 0x100E,},
-	{0xDDB0, 0x2400,},
-	{0xDDB2, 0x334B,},
-	{0xDDB4, 0xE501,},
-	{0xDDB6, 0x7EE2,},
-	{0xDDB8, 0x0DBF,},
-	{0xDDBA, 0x90F2,},
-	{0xDDBC, 0x1B0C,},
-	{0xDDBE, 0x1382,},
-	{0xDDC0, 0xC123,},
-	{0xDDC2, 0x140E,},
-	{0xDDC4, 0x3080,},
-	{0xDDC6, 0x7822,},
-	{0xDDC8, 0x1A07,},
-	{0xDDCA, 0x1002,},
-	{0xDDCC, 0x124C,},
-	{0xDDCE, 0x1000,},
-	{0xDDD0, 0x120B,},
-	{0xDDD2, 0x1081,},
-	{0xDDD4, 0x1207,},
-	{0xDDD6, 0x1083,},
-	{0xDDD8, 0x2142,},
-	{0xDDDA, 0x004B,},
-	{0xDDDC, 0x781B,},
-	{0xDDDE, 0x0B21,},
-	{0xDDE0, 0x02E2,},
-	{0xDDE2, 0x1A4C,},
-	{0xDDE4, 0x1000,},
-	{0xDDE6, 0xE101,},
-	{0xDDE8, 0x0915,},
-	{0xDDEA, 0x00C2,},
-	{0xDDEC, 0xC101,},
-	{0xDDEE, 0x1204,},
-	{0xDDF0, 0x1083,},
-	{0xDDF2, 0x090D,},
-	{0xDDF4, 0x00C2,},
-	{0xDDF6, 0xE001,},
-	{0xDDF8, 0x1A4C,},
-	{0xDDFA, 0x1000,},
-	{0xDDFC, 0x1A06,},
-	{0xDDFE, 0x1002,},
-	{0xDE00, 0x234A,},
-	{0xDE02, 0x1000,},
-	{0xDE04, 0x7169,},
-	{0xDE06, 0xF008,},
-	{0xDE08, 0x2053,},
-	{0xDE0A, 0x0003,},
-	{0xDE0C, 0x6179,},
-	{0xDE0E, 0x781C,},
-	{0xDE10, 0x2340,},
-	{0xDE12, 0x104B,},
-	{0xDE14, 0x1203,},
-	{0xDE16, 0x1083,},
-	{0xDE18, 0x0BF1,},
-	{0xDE1A, 0x90C2,},
-	{0xDE1C, 0x1202,},
-	{0xDE1E, 0x1080,},
-	{0xDE20, 0x091D,},
-	{0xDE22, 0x0004,},
-	{0xDE24, 0x70CF,},
-	{0xDE26, 0xFFFF,},
-	{0xDE28, 0xC644,},
-	{0xDE2A, 0x881B,},
-	{0xDE2C, 0xE0B2,},
-	{0xDE2E, 0xD83C,},
-	{0xDE30, 0x20CA,},
-	{0xDE32, 0x0CA2,},
-	{0xDE34, 0x1A01,},
-	{0xDE36, 0x1002,},
-	{0xDE38, 0x1A4C,},
-	{0xDE3A, 0x1080,},
-	{0xDE3C, 0x02B9,},
-	{0xDE3E, 0x05A0,},
-	{0xDE40, 0xC0A4,},
-	{0xDE42, 0x78E0,},
-	{0xDE44, 0xC0F1,},
-	{0xDE46, 0xFF95,},
-	{0xDE48, 0xD800,},
-	{0xDE4A, 0x71CF,},
-	{0xDE4C, 0xFF00,},
-	{0xDE4E, 0x1FE0,},
-	{0xDE50, 0x19D0,},
-	{0xDE52, 0x001C,},
-	{0xDE54, 0x19D1,},
-	{0xDE56, 0x001C,},
-	{0xDE58, 0x70CF,},
-	{0xDE5A, 0xFFFF,},
-	{0xDE5C, 0xE058,},
-	{0xDE5E, 0x901F,},
-	{0xDE60, 0xB861,},
-	{0xDE62, 0x19D2,},
-	{0xDE64, 0x001C,},
-	{0xDE66, 0xC0D1,},
-	{0xDE68, 0x7EE0,},
-	{0xDE6A, 0x78E0,},
-	{0xDE6C, 0xC0F1,},
-	{0xDE6E, 0x0A7A,},
-	{0xDE70, 0x0580,},
-	{0xDE72, 0x70CF,},
-	{0xDE74, 0xFFFF,},
-	{0xDE76, 0xC5D4,},
-	{0xDE78, 0x9041,},
-	{0xDE7A, 0x9023,},
-	{0xDE7C, 0x75CF,},
-	{0xDE7E, 0xFFFF,},
-	{0xDE80, 0xE058,},
-	{0xDE82, 0x7942,},
-	{0xDE84, 0xB967,},
-	{0xDE86, 0x7F30,},
-	{0xDE88, 0xB53F,},
-	{0xDE8A, 0x71CF,},
-	{0xDE8C, 0xFFFF,},
-	{0xDE8E, 0xC84C,},
-	{0xDE90, 0x91D3,},
-	{0xDE92, 0x108B,},
-	{0xDE94, 0x0081,},
-	{0xDE96, 0x2615,},
-	{0xDE98, 0x1380,},
-	{0xDE9A, 0x090F,},
-	{0xDE9C, 0x0C91,},
-	{0xDE9E, 0x0A8E,},
-	{0xDEA0, 0x05A0,},
-	{0xDEA2, 0xD906,},
-	{0xDEA4, 0x7E10,},
-	{0xDEA6, 0x2615,},
-	{0xDEA8, 0x1380,},
-	{0xDEAA, 0x0A82,},
-	{0xDEAC, 0x05A0,},
-	{0xDEAE, 0xD960,},
-	{0xDEB0, 0x790F,},
-	{0xDEB2, 0x090D,},
-	{0xDEB4, 0x0133,},
-	{0xDEB6, 0xAD0C,},
-	{0xDEB8, 0xD904,},
-	{0xDEBA, 0xAD2C,},
-	{0xDEBC, 0x79EC,},
-	{0xDEBE, 0x2941,},
-	{0xDEC0, 0x7402,},
-	{0xDEC2, 0x71CF,},
-	{0xDEC4, 0xFF00,},
-	{0xDEC6, 0x2184,},
-	{0xDEC8, 0xB142,},
-	{0xDECA, 0x1906,},
-	{0xDECC, 0x0E44,},
-	{0xDECE, 0xFFDE,},
-	{0xDED0, 0x70C9,},
-	{0xDED2, 0x0A5A,},
-	{0xDED4, 0x05A0,},
-	{0xDED6, 0x8D2C,},
-	{0xDED8, 0xAD0B,},
-	{0xDEDA, 0xD800,},
-	{0xDEDC, 0xAD01,},
-	{0xDEDE, 0x0219,},
-	{0xDEE0, 0x05A0,},
-	{0xDEE2, 0xA513,},
-	{0xDEE4, 0xC0F1,},
-	{0xDEE6, 0x71CF,},
-	{0xDEE8, 0xFFFF,},
-	{0xDEEA, 0xC644,},
-	{0xDEEC, 0xA91B,},
-	{0xDEEE, 0xD902,},
-	{0xDEF0, 0x70CF,},
-	{0xDEF2, 0xFFFF,},
-	{0xDEF4, 0xC84C,},
-	{0xDEF6, 0x093E,},
-	{0xDEF8, 0x03A0,},
-	{0xDEFA, 0xA826,},
-	{0xDEFC, 0xFFDC,},
-	{0xDEFE, 0xF1B5,},
-	{0xDF00, 0xC0F1,},
-	{0xDF02, 0x09EA,},
-	{0xDF04, 0x0580,},
-	{0xDF06, 0x75CF,},
-	{0xDF08, 0xFFFF,},
-	{0xDF0A, 0xE058,},
-	{0xDF0C, 0x1540,},
-	{0xDF0E, 0x1080,},
-	{0xDF10, 0x08A7,},
-	{0xDF12, 0x0010,},
-	{0xDF14, 0x8D00,},
-	{0xDF16, 0x0813,},
-	{0xDF18, 0x009E,},
-	{0xDF1A, 0x1540,},
-	{0xDF1C, 0x1081,},
-	{0xDF1E, 0xE181,},
-	{0xDF20, 0x20CA,},
-	{0xDF22, 0x00A1,},
-	{0xDF24, 0xF24B,},
-	{0xDF26, 0x1540,},
-	{0xDF28, 0x1081,},
-	{0xDF2A, 0x090F,},
-	{0xDF2C, 0x0050,},
-	{0xDF2E, 0x1540,},
-	{0xDF30, 0x1081,},
-	{0xDF32, 0x0927,},
-	{0xDF34, 0x0091,},
-	{0xDF36, 0x1550,},
-	{0xDF38, 0x1081,},
-	{0xDF3A, 0xDE00,},
-	{0xDF3C, 0xAD2A,},
-	{0xDF3E, 0x1D50,},
-	{0xDF40, 0x1382,},
-	{0xDF42, 0x1552,},
-	{0xDF44, 0x1101,},
-	{0xDF46, 0x1D52,},
-	{0xDF48, 0x1384,},
-	{0xDF4A, 0xB524,},
-	{0xDF4C, 0x082D,},
-	{0xDF4E, 0x015F,},
-	{0xDF50, 0xFF55,},
-	{0xDF52, 0xD803,},
-	{0xDF54, 0xF033,},
-	{0xDF56, 0x1540,},
-	{0xDF58, 0x1081,},
-	{0xDF5A, 0x0967,},
-	{0xDF5C, 0x00D1,},
-	{0xDF5E, 0x1550,},
-	{0xDF60, 0x1081,},
-	{0xDF62, 0xDE00,},
-	{0xDF64, 0xAD2A,},
-	{0xDF66, 0x1D50,},
-	{0xDF68, 0x1382,},
-	{0xDF6A, 0x1552,},
-	{0xDF6C, 0x1101,},
-	{0xDF6E, 0x1D52,},
-	{0xDF70, 0x1384,},
-	{0xDF72, 0xB524,},
-	{0xDF74, 0x0811,},
-	{0xDF76, 0x019E,},
-	{0xDF78, 0xB8A0,},
-	{0xDF7A, 0xAD00,},
-	{0xDF7C, 0xFF47,},
-	{0xDF7E, 0x1D40,},
-	{0xDF80, 0x1382,},
-	{0xDF82, 0xF01F,},
-	{0xDF84, 0xFF5A,},
-	{0xDF86, 0x8D01,},
-	{0xDF88, 0x8D40,},
-	{0xDF8A, 0xE812,},
-	{0xDF8C, 0x71CF,},
-	{0xDF8E, 0xFFFF,},
-	{0xDF90, 0xC644,},
-	{0xDF92, 0x893B,},
-	{0xDF94, 0x7030,},
-	{0xDF96, 0x22D1,},
-	{0xDF98, 0x8062,},
-	{0xDF9A, 0xF20A,},
-	{0xDF9C, 0x0A0F,},
-	{0xDF9E, 0x009E,},
-	{0xDFA0, 0x71CF,},
-	{0xDFA2, 0xFFFF,},
-	{0xDFA4, 0xC84C,},
-	{0xDFA6, 0x893B,},
-	{0xDFA8, 0xE902,},
-	{0xDFAA, 0xFFCF,},
-	{0xDFAC, 0x8D00,},
-	{0xDFAE, 0xB8E7,},
-	{0xDFB0, 0x26CA,},
-	{0xDFB2, 0x1022,},
-	{0xDFB4, 0xF5E2,},
-	{0xDFB6, 0xFF3C,},
-	{0xDFB8, 0xD801,},
-	{0xDFBA, 0x1D40,},
-	{0xDFBC, 0x1002,},
-	{0xDFBE, 0x0141,},
-	{0xDFC0, 0x0580,},
-	{0xDFC2, 0x78E0,},
-	{0xDFC4, 0xC0F1,},
-	{0xDFC6, 0xC5E1,},
-	{0xDFC8, 0xFF34,},
-	{0xDFCA, 0xDD00,},
-	{0xDFCC, 0x70CF,},
-	{0xDFCE, 0xFFFF,},
-	{0xDFD0, 0xE090,},
-	{0xDFD2, 0xA8A8,},
-	{0xDFD4, 0xD800,},
-	{0xDFD6, 0xB893,},
-	{0xDFD8, 0x0C8A,},
-	{0xDFDA, 0x0460,},
-	{0xDFDC, 0xD901,},
-	{0xDFDE, 0x71CF,},
-	{0xDFE0, 0xFFFF,},
-	{0xDFE2, 0xDC10,},
-	{0xDFE4, 0xD813,},
-	{0xDFE6, 0x0B96,},
-	{0xDFE8, 0x0460,},
-	{0xDFEA, 0x72A9,},
-	{0xDFEC, 0x0119,},
-	{0xDFEE, 0x0580,},
-	{0xDFF0, 0xC0F1,},
-	{0xDFF2, 0x71CF,},
-	{0xDFF4, 0x0000,},
-	{0xDFF6, 0x5BAE,},
-	{0xDFF8, 0x7940,},
-	{0xDFFA, 0xFF9D,},
-	{0xDFFC, 0xF135,},
-	{0xDFFE, 0x78E0,},
-	{0xE000, 0xC0F1,},
-	{0xE002, 0x70CF,},
-	{0xE004, 0x0000,},
-	{0xE006, 0x5CBA,},
-	{0xE008, 0x7840,},
-	{0xE00A, 0x70CF,},
-	{0xE00C, 0xFFFF,},
-	{0xE00E, 0xE058,},
-	{0xE010, 0x8800,},
-	{0xE012, 0x0815,},
-	{0xE014, 0x001E,},
-	{0xE016, 0x70CF,},
-	{0xE018, 0xFFFF,},
-	{0xE01A, 0xC84C,},
-	{0xE01C, 0x881A,},
-	{0xE01E, 0xE080,},
-	{0xE020, 0x0EE0,},
-	{0xE022, 0xFFC1,},
-	{0xE024, 0xF121,},
-	{0xE026, 0x78E0,},
-	{0xE028, 0xC0F1,},
-	{0xE02A, 0xD900,},
-	{0xE02C, 0xF009,},
-	{0xE02E, 0x70CF,},
-	{0xE030, 0xFFFF,},
-	{0xE032, 0xE0AC,},
-	{0xE034, 0x7835,},
-	{0xE036, 0x8041,},
-	{0xE038, 0x8000,},
-	{0xE03A, 0xE102,},
-	{0xE03C, 0xA040,},
-	{0xE03E, 0x09F3,},
-	{0xE040, 0x8114,},
-	{0xE042, 0x71CF,},
-	{0xE044, 0xFFFF,},
-	{0xE046, 0xE058,},
-	{0xE048, 0x70CF,},
-	{0xE04A, 0xFFFF,},
-	{0xE04C, 0xC594,},
-	{0xE04E, 0xB030,},
-	{0xE050, 0xFFDD,},
-	{0xE052, 0xD800,},
-	{0xE054, 0xF109,},
-	{0xE056, 0x0000,},
-	{0xE058, 0x0300,},
-	{0xE05A, 0x0204,},
-	{0xE05C, 0x0700,},
-	{0xE05E, 0x0000,},
-	{0xE060, 0x0000,},
-	{0xE062, 0x0000,},
-	{0xE064, 0x0000,},
-	{0xE066, 0x0000,},
-	{0xE068, 0x0000,},
-	{0xE06A, 0x0000,},
-	{0xE06C, 0x0000,},
-	{0xE06E, 0x0000,},
-	{0xE070, 0x0000,},
-	{0xE072, 0x0000,},
-	{0xE074, 0x0000,},
-	{0xE076, 0x0000,},
-	{0xE078, 0x0000,},
-	{0xE07A, 0x0000,},
-	{0xE07C, 0x0000,},
-	{0xE07E, 0x0000,},
-	{0xE080, 0x0000,},
-	{0xE082, 0x0000,},
-	{0xE084, 0x0000,},
-	{0xE086, 0x0000,},
-	{0xE088, 0x0000,},
-	{0xE08A, 0x0000,},
-	{0xE08C, 0x0000,},
-	{0xE08E, 0x0000,},
-	{0xE090, 0x0000,},
-	{0xE092, 0x0000,},
-	{0xE094, 0x0000,},
-	{0xE096, 0x0000,},
-	{0xE098, 0x0000,},
-	{0xE09A, 0x0000,},
-	{0xE09C, 0x0000,},
-	{0xE09E, 0x0000,},
-	{0xE0A0, 0x0000,},
-	{0xE0A2, 0x0000,},
-	{0xE0A4, 0x0000,},
-	{0xE0A6, 0x0000,},
-	{0xE0A8, 0x0000,},
-	{0xE0AA, 0x0000,},
-	{0xE0AC, 0xFFFF,},
-	{0xE0AE, 0xCB68,},
-	{0xE0B0, 0xFFFF,},
-	{0xE0B2, 0xDFF0,},
-	{0xE0B4, 0xFFFF,},
-	{0xE0B6, 0xCB6C,},
-	{0xE0B8, 0xFFFF,},
-	{0xE0BA, 0xE000,},
-	{0x098E, 0x0000,},
-
-	/*MIPI setting for SOC1040*/
-	{0x3C5A, 0x0009,},
-	{0x3C44, 0x0080,},/*MIPI_CUSTOM_SHORT_PKT*/
-
-	/*[Tuning_settings]*/
-
-	/*[CCM]*/
-	{0xC892, 0x0267,},/*CAM_AWB_CCM_L_0*/
-	{0xC894, 0xFF1A,},/*CAM_AWB_CCM_L_1*/
-	{0xC896, 0xFFB3,},/*CAM_AWB_CCM_L_2*/
-	{0xC898, 0xFF80,},/*CAM_AWB_CCM_L_3*/
-	{0xC89A, 0x0166,},/*CAM_AWB_CCM_L_4*/
-	{0xC89C, 0x0003,},/*CAM_AWB_CCM_L_5*/
-	{0xC89E, 0xFF9A,},/*CAM_AWB_CCM_L_6*/
-	{0xC8A0, 0xFEB4,},/*CAM_AWB_CCM_L_7*/
-	{0xC8A2, 0x024D,},/*CAM_AWB_CCM_L_8*/
-	{0xC8A4, 0x01BF,},/*CAM_AWB_CCM_M_0*/
-	{0xC8A6, 0xFF01,},/*CAM_AWB_CCM_M_1*/
-	{0xC8A8, 0xFFF3,},/*CAM_AWB_CCM_M_2*/
-	{0xC8AA, 0xFF75,},/*CAM_AWB_CCM_M_3*/
-	{0xC8AC, 0x0198,},/*CAM_AWB_CCM_M_4*/
-	{0xC8AE, 0xFFFD,},/*CAM_AWB_CCM_M_5*/
-	{0xC8B0, 0xFF9A,},/*CAM_AWB_CCM_M_6*/
-	{0xC8B2, 0xFEE7,},/*CAM_AWB_CCM_M_7*/
-	{0xC8B4, 0x02A8,},/*CAM_AWB_CCM_M_8*/
-	{0xC8B6, 0x01D9,},/*CAM_AWB_CCM_R_0*/
-	{0xC8B8, 0xFF26,},/*CAM_AWB_CCM_R_1*/
-	{0xC8BA, 0xFFF3,},/*CAM_AWB_CCM_R_2*/
-	{0xC8BC, 0xFFB3,},/*CAM_AWB_CCM_R_3*/
-	{0xC8BE, 0x0132,},/*CAM_AWB_CCM_R_4*/
-	{0xC8C0, 0xFFE8,},/*CAM_AWB_CCM_R_5*/
-	{0xC8C2, 0xFFDA,},/*CAM_AWB_CCM_R_6*/
-	{0xC8C4, 0xFECD,},/*CAM_AWB_CCM_R_7*/
-	{0xC8C6, 0x02C2,},/*CAM_AWB_CCM_R_8*/
-	{0xC8C8, 0x0075,},/*CAM_AWB_CCM_L_RG_GAIN*/
-	{0xC8CA, 0x011C,},/*CAM_AWB_CCM_L_BG_GAIN*/
-	{0xC8CC, 0x009A,},/*CAM_AWB_CCM_M_RG_GAIN*/
-	{0xC8CE, 0x0105,},/*CAM_AWB_CCM_M_BG_GAIN*/
-	{0xC8D0, 0x00A4,},/*CAM_AWB_CCM_R_RG_GAIN*/
-	{0xC8D2, 0x00AC,},/*CAM_AWB_CCM_R_BG_GAIN*/
-	{0xC8D4, 0x0A8C,},/*CAM_AWB_CCM_L_CTEMP*/
-	{0xC8D6, 0x0F0A,},/*CAM_AWB_CCM_M_CTEMP*/
-	{0xC8D8, 0x1964,},/*CAM_AWB_CCM_R_CTEMP*/
-
-	/*[AWB]*/
-	{0xC914, 0x0000,},/*CAM_STAT_AWB_CLIP_WINDOW_XSTART*/
-	{0xC916, 0x0000,},/*CAM_STAT_AWB_CLIP_WINDOW_YSTART*/
-	{0xC918, 0x04FF,},/*CAM_STAT_AWB_CLIP_WINDOW_XEND*/
-	{0xC91A, 0x02CF,},/*CAM_STAT_AWB_CLIP_WINDOW_YEND*/
-	{0xC904, 0x0033,},/*CAM_AWB_AWB_XSHIFT_PRE_ADJ*/
-	{0xC906, 0x0040,},/*CAM_AWB_AWB_YSHIFT_PRE_ADJ*/
-	{0xC8F2, 0x03, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_AWB_AWB_XSCALE*/
-	{0xC8F3, 0x02, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_AWB_AWB_YSCALE*/
-	{0xC906, 0x003C,},/*CAM_AWB_AWB_YSHIFT_PRE_ADJ*/
-	{0xC8F4, 0x0000,},/*CAM_AWB_AWB_WEIGHTS_0*/
-	{0xC8F6, 0x0000,},/*CAM_AWB_AWB_WEIGHTS_1*/
-	{0xC8F8, 0x0000,},/*CAM_AWB_AWB_WEIGHTS_2*/
-	{0xC8FA, 0xE724,},/*CAM_AWB_AWB_WEIGHTS_3*/
-	{0xC8FC, 0x1583,},/*CAM_AWB_AWB_WEIGHTS_4*/
-	{0xC8FE, 0x2045,},/*CAM_AWB_AWB_WEIGHTS_5*/
-	{0xC900, 0x03FF,},/*CAM_AWB_AWB_WEIGHTS_6*/
-	{0xC902, 0x007C,},/*CAM_AWB_AWB_WEIGHTS_7*/
-	{0xC90C, 0x80, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_AWB_K_R_L*/
-	{0xC90D, 0x80, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_AWB_K_G_L*/
-	{0xC90E, 0x80, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_AWB_K_B_L*/
-	{0xC90F, 0x88, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_AWB_K_R_R*/
-	{0xC910, 0x80, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_AWB_K_G_R*/
-	{0xC911, 0x80, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_AWB_K_B_R*/
-
-	/*[Step7-CPIPE_Preference]*/
-	{0xC926, 0x0020,},/*CAM_LL_START_BRIGHTNESS*/
-	{0xC928, 0x009A,},/*CAM_LL_STOP_BRIGHTNESS*/
-	{0xC946, 0x0070,},/*CAM_LL_START_GAIN_METRIC*/
-	{0xC948, 0x00F3,},/*CAM_LL_STOP_GAIN_METRIC*/
-	{0xC952, 0x0020,},/*CAM_LL_START_TARGET_LUMA_BM*/
-	{0xC954, 0x009A,},/*CAM_LL_STOP_TARGET_LUMA_BM*/
-	{0xC92A, 0x80, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_START_SATURATION*/
-	{0xC92B, 0x4B, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_END_SATURATION*/
-	{0xC92C, 0x00, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_START_DESATURATION*/
-	{0xC92D, 0xFF, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_END_DESATURATION*/
-	{0xC92E, 0x3C, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_START_DEMOSAIC*/
-	{0xC92F, 0x02, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_START_AP_GAIN*/
-	{0xC930, 0x06, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_START_AP_THRESH*/
-	{0xC931, 0x64, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_STOP_DEMOSAIC*/
-	{0xC932, 0x01, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_STOP_AP_GAIN*/
-	{0xC933, 0x0C, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_STOP_AP_THRESH*/
-	{0xC934, 0x3C, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_START_NR_RED*/
-	{0xC935, 0x3C, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_START_NR_GREEN*/
-	{0xC936, 0x3C, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_START_NR_BLUE*/
-	{0xC937, 0x0F, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_START_NR_THRESH*/
-	{0xC938, 0x64, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_STOP_NR_RED*/
-	{0xC939, 0x64, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_STOP_NR_GREEN*/
-	{0xC93A, 0x64, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_STOP_NR_BLUE*/
-	{0xC93B, 0x32, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_STOP_NR_THRESH*/
-	{0xC93C, 0x0020,},/*CAM_LL_START_CONTRAST_BM*/
-	{0xC93E, 0x009A,},/*CAM_LL_STOP_CONTRAST_BM*/
-	{0xC940, 0x00DC,},/*CAM_LL_GAMMA*/
-	/*CAM_LL_START_CONTRAST_GRADIENT*/
-	{0xC942, 0x38, MSM_CAMERA_I2C_BYTE_DATA},
-	/*CAM_LL_STOP_CONTRAST_GRADIENT*/
-	{0xC943, 0x30, MSM_CAMERA_I2C_BYTE_DATA},
-	{0xC944, 0x50, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_START_CONTRAST_LUMA*/
-	{0xC945, 0x19, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_STOP_CONTRAST_LUMA*/
-	{0xC94A, 0x0230,},/*CAM_LL_START_FADE_TO_BLACK_LUMA*/
-	{0xC94C, 0x0010,},/*CAM_LL_STOP_FADE_TO_BLACK_LUMA*/
-	{0xC94E, 0x01CD,},/*CAM_LL_CLUSTER_DC_TH_BM*/
-	{0xC950, 0x05, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_CLUSTER_DC_GATE*/
-	{0xC951, 0x40, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_LL_SUMMING_SENSITIVITY*/
-	/*CAM_AET_TARGET_AVERAGE_LUMA_DARK*/
-	{0xC87B, 0x1B, MSM_CAMERA_I2C_BYTE_DATA},
-	{0xC878, 0x0E, MSM_CAMERA_I2C_BYTE_DATA},/*CAM_AET_AEMODE*/
-	{0xC890, 0x0080,},/*CAM_AET_TARGET_GAIN*/
-	{0xC886, 0x0100,},/*CAM_AET_AE_MAX_VIRT_AGAIN*/
-	{0xC87C, 0x005A,},/*CAM_AET_BLACK_CLIPPING_TARGET*/
-	{0xB42A, 0x05, MSM_CAMERA_I2C_BYTE_DATA},/*CCM_DELTA_GAIN*/
-	/*AE_TRACK_AE_TRACKING_DAMPENING*/
-	{0xA80A, 0x20, MSM_CAMERA_I2C_BYTE_DATA},
-	{0x3C44, 0x0080,},
-	{0x3C40, 0x0004, MSM_CAMERA_I2C_UNSET_WORD_MASK},
-	{0xA802, 0x08, MSM_CAMERA_I2C_SET_BYTE_MASK},
-	{0xC908, 0x01, MSM_CAMERA_I2C_BYTE_DATA},
-	{0xC879, 0x01, MSM_CAMERA_I2C_BYTE_DATA},
-	{0xC909, 0x01, MSM_CAMERA_I2C_UNSET_BYTE_MASK},
-	{0xA80A, 0x18, MSM_CAMERA_I2C_BYTE_DATA},
-	{0xA80B, 0x18, MSM_CAMERA_I2C_BYTE_DATA},
-	{0xAC16, 0x18, MSM_CAMERA_I2C_BYTE_DATA},
-	{0xC878, 0x08, MSM_CAMERA_I2C_SET_BYTE_MASK},
-	{0xBC02, 0x08, MSM_CAMERA_I2C_UNSET_BYTE_MASK},
-};
-
-static struct v4l2_subdev_info mt9m114_subdev_info[] = {
-	{
-	.code   = V4L2_MBUS_FMT_YUYV8_2X8,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_reg_conf mt9m114_config_change_settings[] = {
-	{0xdc00, 0x28, MSM_CAMERA_I2C_BYTE_DATA, MSM_CAMERA_I2C_CMD_WRITE},
-	{MT9M114_COMMAND_REGISTER, MT9M114_COMMAND_REGISTER_SET_STATE,
-		MSM_CAMERA_I2C_UNSET_WORD_MASK, MSM_CAMERA_I2C_CMD_POLL},
-	{MT9M114_COMMAND_REGISTER, (MT9M114_COMMAND_REGISTER_OK |
-		MT9M114_COMMAND_REGISTER_SET_STATE), MSM_CAMERA_I2C_WORD_DATA,
-		MSM_CAMERA_I2C_CMD_WRITE},
-	{MT9M114_COMMAND_REGISTER, MT9M114_COMMAND_REGISTER_SET_STATE,
-		MSM_CAMERA_I2C_UNSET_WORD_MASK, MSM_CAMERA_I2C_CMD_POLL},
-	{0xDC01, 0x31, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static void mt9m114_stop_stream(struct msm_sensor_ctrl_t *s_ctrl) {}
-
-static struct msm_camera_i2c_conf_array mt9m114_init_conf[] = {
-	{mt9m114_recommend_settings,
-	ARRAY_SIZE(mt9m114_recommend_settings), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_config_change_settings,
-	ARRAY_SIZE(mt9m114_config_change_settings),
-	0, MSM_CAMERA_I2C_WORD_DATA},
-};
-
-static struct msm_camera_i2c_conf_array mt9m114_confs[] = {
-	{mt9m114_720p_settings,
-	ARRAY_SIZE(mt9m114_720p_settings), 0, MSM_CAMERA_I2C_WORD_DATA},
-};
-
-static struct msm_camera_i2c_reg_conf mt9m114_saturation[][1] = {
-	{{0xCC12, 0x00},},
-	{{0xCC12, 0x1A},},
-	{{0xCC12, 0x34},},
-	{{0xCC12, 0x4E},},
-	{{0xCC12, 0x68},},
-	{{0xCC12, 0x80},},
-	{{0xCC12, 0x9A},},
-	{{0xCC12, 0xB4},},
-	{{0xCC12, 0xCE},},
-	{{0xCC12, 0xE8},},
-	{{0xCC12, 0xFF},},
-};
-
-static struct msm_camera_i2c_reg_conf mt9m114_refresh[] = {
-	{MT9M114_COMMAND_REGISTER, MT9M114_COMMAND_REGISTER_REFRESH,
-		MSM_CAMERA_I2C_UNSET_WORD_MASK, MSM_CAMERA_I2C_CMD_POLL},
-	{MT9M114_COMMAND_REGISTER, (MT9M114_COMMAND_REGISTER_OK |
-		MT9M114_COMMAND_REGISTER_REFRESH), MSM_CAMERA_I2C_WORD_DATA,
-		MSM_CAMERA_I2C_CMD_WRITE},
-	{MT9M114_COMMAND_REGISTER, MT9M114_COMMAND_REGISTER_REFRESH,
-		MSM_CAMERA_I2C_UNSET_WORD_MASK, MSM_CAMERA_I2C_CMD_POLL},
-	{MT9M114_COMMAND_REGISTER, MT9M114_COMMAND_REGISTER_OK,
-		MSM_CAMERA_I2C_SET_WORD_MASK, MSM_CAMERA_I2C_CMD_POLL},
-};
-
-static struct msm_camera_i2c_conf_array mt9m114_saturation_confs[][2] = {
-	{{mt9m114_saturation[0],
-		ARRAY_SIZE(mt9m114_saturation[0]), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_refresh,
-		ARRAY_SIZE(mt9m114_refresh), 0, MSM_CAMERA_I2C_WORD_DATA},},
-	{{mt9m114_saturation[1],
-		ARRAY_SIZE(mt9m114_saturation[1]), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_refresh,
-		ARRAY_SIZE(mt9m114_refresh), 0, MSM_CAMERA_I2C_WORD_DATA},},
-	{{mt9m114_saturation[2],
-		ARRAY_SIZE(mt9m114_saturation[2]), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_refresh,
-		ARRAY_SIZE(mt9m114_refresh), 0, MSM_CAMERA_I2C_WORD_DATA},},
-	{{mt9m114_saturation[3],
-		ARRAY_SIZE(mt9m114_saturation[3]), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_refresh,
-		ARRAY_SIZE(mt9m114_refresh), 0, MSM_CAMERA_I2C_WORD_DATA},},
-	{{mt9m114_saturation[4],
-		ARRAY_SIZE(mt9m114_saturation[4]), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_refresh,
-		ARRAY_SIZE(mt9m114_refresh), 0, MSM_CAMERA_I2C_WORD_DATA},},
-	{{mt9m114_saturation[5],
-		ARRAY_SIZE(mt9m114_saturation[5]), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_refresh,
-		ARRAY_SIZE(mt9m114_refresh), 0, MSM_CAMERA_I2C_WORD_DATA},},
-	{{mt9m114_saturation[6],
-		ARRAY_SIZE(mt9m114_saturation[6]), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_refresh,
-		ARRAY_SIZE(mt9m114_refresh), 0, MSM_CAMERA_I2C_WORD_DATA},},
-	{{mt9m114_saturation[7],
-		ARRAY_SIZE(mt9m114_saturation[7]), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_refresh,
-		ARRAY_SIZE(mt9m114_refresh), 0, MSM_CAMERA_I2C_WORD_DATA},},
-	{{mt9m114_saturation[8],
-		ARRAY_SIZE(mt9m114_saturation[8]), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_refresh,
-		ARRAY_SIZE(mt9m114_refresh), 0, MSM_CAMERA_I2C_WORD_DATA},},
-	{{mt9m114_saturation[9],
-		ARRAY_SIZE(mt9m114_saturation[9]), 0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_refresh,
-		ARRAY_SIZE(mt9m114_refresh), 0, MSM_CAMERA_I2C_WORD_DATA},},
-	{{mt9m114_saturation[10],
-		ARRAY_SIZE(mt9m114_saturation[10]),
-		0, MSM_CAMERA_I2C_WORD_DATA},
-	{mt9m114_refresh,
-		ARRAY_SIZE(mt9m114_refresh), 0, MSM_CAMERA_I2C_WORD_DATA},},
-};
-
-static int mt9m114_saturation_enum_map[] = {
-	MSM_V4L2_SATURATION_L0,
-	MSM_V4L2_SATURATION_L1,
-	MSM_V4L2_SATURATION_L2,
-	MSM_V4L2_SATURATION_L3,
-	MSM_V4L2_SATURATION_L4,
-	MSM_V4L2_SATURATION_L5,
-	MSM_V4L2_SATURATION_L6,
-	MSM_V4L2_SATURATION_L7,
-	MSM_V4L2_SATURATION_L8,
-	MSM_V4L2_SATURATION_L9,
-	MSM_V4L2_SATURATION_L10,
-};
-
-static struct msm_camera_i2c_enum_conf_array mt9m114_saturation_enum_confs = {
-	.conf = &mt9m114_saturation_confs[0][0],
-	.conf_enum = mt9m114_saturation_enum_map,
-	.num_enum = ARRAY_SIZE(mt9m114_saturation_enum_map),
-	.num_index = ARRAY_SIZE(mt9m114_saturation_confs),
-	.num_conf = ARRAY_SIZE(mt9m114_saturation_confs[0]),
-	.data_type = MSM_CAMERA_I2C_WORD_DATA,
-};
-
-struct msm_sensor_v4l2_ctrl_info_t mt9m114_v4l2_ctrl_info[] = {
-	{
-		.ctrl_id = V4L2_CID_SATURATION,
-		.min = MSM_V4L2_SATURATION_L0,
-		.max = MSM_V4L2_SATURATION_L10,
-		.step = 1,
-		.enum_cfg_settings = &mt9m114_saturation_enum_confs,
-		.s_v4l2_ctrl = msm_sensor_s_ctrl_by_enum,
-	},
-};
-
-static struct msm_sensor_output_info_t mt9m114_dimensions[] = {
-	{
-		.x_output = 0x500,
-		.y_output = 0x2D0,
-		.line_length_pclk = 0x500,
-		.frame_length_lines = 0x2D0,
-		.vt_pixel_clk = 48000000,
-		.op_pixel_clk = 128000000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_sensor_output_reg_addr_t mt9m114_reg_addr = {
-	.x_output = 0xC868,
-	.y_output = 0xC86A,
-	.line_length_pclk = 0xC868,
-	.frame_length_lines = 0xC86A,
-};
-
-static enum msm_camera_vreg_name_t mt9m114_veg_seq[] = {
-	CAM_VIO,
-	CAM_VDIG,
-	CAM_VANA,
-};
-
-static struct msm_sensor_id_info_t mt9m114_id_info = {
-	.sensor_id_reg_addr = 0x0,
-	.sensor_id = 0x2481,
-};
-
-static const struct i2c_device_id mt9m114_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&mt9m114_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver mt9m114_i2c_driver = {
-	.id_table = mt9m114_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client mt9m114_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	return i2c_add_driver(&mt9m114_i2c_driver);
-}
-
-static struct v4l2_subdev_core_ops mt9m114_subdev_core_ops = {
-	.s_ctrl = msm_sensor_v4l2_s_ctrl,
-	.queryctrl = msm_sensor_v4l2_query_ctrl,
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops mt9m114_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops mt9m114_subdev_ops = {
-	.core = &mt9m114_subdev_core_ops,
-	.video  = &mt9m114_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t mt9m114_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = mt9m114_stop_stream,
-	.sensor_setting = msm_sensor_setting,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-	.sensor_get_csi_params = msm_sensor_get_csi_params,
-};
-
-static struct msm_sensor_reg_t mt9m114_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = mt9m114_config_change_settings,
-	.start_stream_conf_size = ARRAY_SIZE(mt9m114_config_change_settings),
-	.init_settings = &mt9m114_init_conf[0],
-	.init_size = ARRAY_SIZE(mt9m114_init_conf),
-	.mode_settings = &mt9m114_confs[0],
-	.output_settings = &mt9m114_dimensions[0],
-	.num_conf = ARRAY_SIZE(mt9m114_confs),
-};
-
-static struct msm_sensor_ctrl_t mt9m114_s_ctrl = {
-	.msm_sensor_reg = &mt9m114_regs,
-	.msm_sensor_v4l2_ctrl_info = mt9m114_v4l2_ctrl_info,
-	.num_v4l2_ctrl = ARRAY_SIZE(mt9m114_v4l2_ctrl_info),
-	.sensor_i2c_client = &mt9m114_sensor_i2c_client,
-	.sensor_i2c_addr = 0x90,
-	.vreg_seq = mt9m114_veg_seq,
-	.num_vreg_seq = ARRAY_SIZE(mt9m114_veg_seq),
-	.sensor_output_reg_addr = &mt9m114_reg_addr,
-	.sensor_id_info = &mt9m114_id_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.min_delay = 30,
-	.power_seq_delay = 60,
-	.msm_sensor_mutex = &mt9m114_mut,
-	.sensor_i2c_driver = &mt9m114_i2c_driver,
-	.sensor_v4l2_subdev_info = mt9m114_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(mt9m114_subdev_info),
-	.sensor_v4l2_subdev_ops = &mt9m114_subdev_ops,
-	.func_tbl = &mt9m114_func_tbl,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Aptina 1.26MP YUV sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/mt9v113.h b/drivers/media/video/msm/sensors/mt9v113.h
new file mode 100644
index 0000000..925d87a
--- /dev/null
+++ b/drivers/media/video/msm/sensors/mt9v113.h
@@ -0,0 +1,85 @@
+/*
+ * HTC Corporation Proprietary Rights Acknowledgment
+ *
+ * Copyright (C) 2008 HTC Corporation
+ *
+ * All Rights Reserved.
+ *
+ * The information contained in this work is the exclusive property
+ * of HTC Corporation("HTC").  Only the user who is legally authorized
+ * by HTC ("Authorized User") has right to employ this work within the
+ * scope of this statement.  Nevertheless, the Authorized User shall not
+ * use this work for any purpose other than the purpose agreed by HTC.
+ * Any and all addition or modification to this work shall be  unconditionally
+ * granted back to HTC and such addition or modification shall be solely
+ * owned by HTC.  No right is granted under this statement, including but not
+ * limited to, distribution, reproduction, and transmission, except as
+ * otherwise provided in this statement.  Any other usage of this work shall
+ *  be subject to the further written consent of HTC.
+ */
+
+
+
+#ifndef MT9V113_H
+#define MT9V113_H
+
+#include <linux/types.h>
+#include <mach/camera.h>
+
+extern struct mt9v113_reg mt9v113_regs;
+
+enum mt9v113_width {
+	WORD_LEN,
+	BYTE_LEN
+};
+
+struct mt9v113_i2c_reg_conf {
+	unsigned short waddr;
+	unsigned short wdata;
+	enum mt9v113_width width;
+	unsigned short mdelay_time;
+};
+
+struct mt9v113_reg {
+	struct mt9v113_i2c_reg_conf *power_up_tbl;
+	uint16_t power_up_tbl_size;
+	struct mt9v113_i2c_reg_conf *register_init_1;
+	uint16_t register_init_size_1;
+	struct mt9v113_i2c_reg_conf *register_init_2;
+	uint16_t register_init_size_2;
+	struct mt9v113_i2c_reg_conf *contract_tb0;
+	uint16_t contract_tb0_size;
+	struct mt9v113_i2c_reg_conf *contract_tb1;
+	uint16_t contract_tb1_size;
+	struct mt9v113_i2c_reg_conf *contract_tb2;
+	uint16_t contract_tb2_size;
+	struct mt9v113_i2c_reg_conf *contract_tb3;
+	uint16_t contract_tb3_size;
+	struct mt9v113_i2c_reg_conf *contract_tb4;
+	uint16_t contract_tb4_size;
+	struct mt9v113_i2c_reg_conf *wb_auto;
+	uint16_t wb_auto_size;
+	struct mt9v113_i2c_reg_conf *wb_fluorescent;
+	uint16_t wb_fluorescent_size;
+	struct mt9v113_i2c_reg_conf *wb_incandescent;
+	uint16_t wb_incandescent_size;
+	struct mt9v113_i2c_reg_conf *wb_daylight;
+	uint16_t wb_daylight_size;
+	struct mt9v113_i2c_reg_conf *wb_cloudy;
+	uint16_t wb_cloudy_size;
+};
+
+enum mt9v113_test_mode_t {
+	TEST_OFF,
+	TEST_1,
+	TEST_2,
+	TEST_3
+};
+
+enum mt9v113_resolution_t {
+	QTR_SIZE,
+	FULL_SIZE,
+	INVALID_SIZE
+};
+
+#endif 
diff --git a/drivers/media/video/msm/sensors/mt9v113_reg_lens_9251.c b/drivers/media/video/msm/sensors/mt9v113_reg_lens_9251.c
new file mode 100644
index 0000000..8df6454
--- /dev/null
+++ b/drivers/media/video/msm/sensors/mt9v113_reg_lens_9251.c
@@ -0,0 +1,1046 @@
+/*
+ * HTC Corporation Proprietary Rights Acknowledgment
+ *
+ * Copyright (C) 2008 HTC Corporation
+ *
+ * All Rights Reserved.
+ *
+ * The information contained in this work is the exclusive property
+ * of HTC Corporation("HTC").  Only the user who is legally authorized
+ * by HTC ("Authorized User") has right to employ this work within the
+ * scope of this statement.  Nevertheless, the Authorized User shall not
+ * use this work for any purpose other than the purpose agreed by HTC.
+ * Any and all addition or modification to this work shall be  unconditionally
+ * granted back to HTC and such addition or modification shall be solely
+ * owned by HTC.  No right is granted under this statement, including but not
+ * limited to, distribution, reproduction, and transmission, except as
+ * otherwise provided in this statement.  Any other usage of this work shall
+ *  be subject to the further written consent of HTC.
+ */
+
+
+
+#include "mt9v113.h"
+
+#if 0
+static const struct mt9v113_i2c_reg_conf const pll_setup_tbl[] = {
+	{0x3E, 0xD0, WORD_LEN, 5},
+	{0x3E, 0xD0, WORD_LEN, 5},
+	{0x12, 0x80, WORD_LEN, 5}
+};
+#endif
+
+static struct mt9v113_i2c_reg_conf wb_auto[] = {
+	{0x098C, 0x2306, WORD_LEN, 0},
+	{0x0990, 0x03C0, WORD_LEN, 0},
+	{0x098C, 0x2308, WORD_LEN, 0},
+	{0x0990, 0xFD7C, WORD_LEN, 0},
+	{0x098C, 0x230A, WORD_LEN, 0},
+	{0x0990, 0xFFF7, WORD_LEN, 0},
+	{0x098C, 0x230C, WORD_LEN, 0},
+	{0x0990, 0xFF25, WORD_LEN, 0},
+	{0x098C, 0x230E, WORD_LEN, 0},
+	{0x0990, 0x0384, WORD_LEN, 0},
+	{0x098C, 0x2310, WORD_LEN, 0},
+	{0x0990, 0xFFD6, WORD_LEN, 0},
+	{0x098C, 0x2312, WORD_LEN, 0},
+	{0x0990, 0xFED2, WORD_LEN, 0},
+	{0x098C, 0x2314, WORD_LEN, 0},
+	{0x0990, 0xFCB2, WORD_LEN, 0},
+	{0x098C, 0x2316, WORD_LEN, 0},
+	{0x0990, 0x068E, WORD_LEN, 0},
+	{0x098C, 0x2318, WORD_LEN, 0},
+	{0x0990, 0x001B, WORD_LEN, 0},
+	{0x098C, 0x231A, WORD_LEN, 0},
+	{0x0990, 0x0039, WORD_LEN, 0},
+	{0x098C, 0x231C, WORD_LEN, 0},
+	{0x0990, 0xFF65, WORD_LEN, 0},
+	{0x098C, 0x231E, WORD_LEN, 0},
+	{0x0990, 0x0052, WORD_LEN, 0},
+	{0x098C, 0x2320, WORD_LEN, 0},
+	{0x0990, 0x0012, WORD_LEN, 0},
+	{0x098C, 0x2322, WORD_LEN, 0},
+	{0x0990, 0x0007, WORD_LEN, 0},
+	{0x098C, 0x2324, WORD_LEN, 0},
+	{0x0990, 0xFFCF, WORD_LEN, 0},
+	{0x098C, 0x2326, WORD_LEN, 0},
+	{0x0990, 0x0037, WORD_LEN, 0},
+	{0x098C, 0x2328, WORD_LEN, 0},
+	{0x0990, 0x00DB, WORD_LEN, 0},
+	{0x098C, 0x232A, WORD_LEN, 0},
+	{0x0990, 0x01C8, WORD_LEN, 0},
+	{0x098C, 0x232C, WORD_LEN, 0},
+	{0x0990, 0xFC9F, WORD_LEN, 0},
+	{0x098C, 0x232E, WORD_LEN, 0},
+	{0x0990, 0x0010, WORD_LEN, 0},
+	{0x098C, 0x2330, WORD_LEN, 0},
+	{0x0990, 0xFFF3, WORD_LEN, 0},
+	
+	{0x098C, 0xA34A, WORD_LEN, 0},
+	{0x0990, 0x0059, WORD_LEN, 0},
+	{0x098C, 0xA34B, WORD_LEN, 0},
+	{0x0990, 0x00E6, WORD_LEN, 0},
+	{0x098C, 0xA34C, WORD_LEN, 0},
+	{0x0990, 0x0059, WORD_LEN, 0},
+	{0x098C, 0xA34D, WORD_LEN, 0},
+	{0x0990, 0x00E6, WORD_LEN, 0},
+	{0x098C, 0xA351, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0xA352, WORD_LEN, 0},
+	{0x0990, 0x007F, WORD_LEN, 0},
+};
+
+static struct mt9v113_i2c_reg_conf wb_fluorescent[] = {
+	{0x098C, 0xA353, WORD_LEN, 0},
+	{0x0990, 0x0043, WORD_LEN, 0},
+	{0x098C, 0xA34E, WORD_LEN, 0},
+	{0x0990, 0x00A0, WORD_LEN, 0},
+	{0x098C, 0xA34F, WORD_LEN, 0},
+	{0x0990, 0x0086, WORD_LEN, 0},
+	{0x098C, 0xA350, WORD_LEN, 0},
+	{0x0990, 0x008A, WORD_LEN, 0}
+};
+
+static struct mt9v113_i2c_reg_conf wb_incandescent[] = {
+	{0x098C, 0xA353, WORD_LEN, 0},
+	{0x0990, 0x000B, WORD_LEN, 0},
+	{0x098C, 0xA34E, WORD_LEN, 0},
+	{0x0990, 0x0090, WORD_LEN, 0},
+	{0x098C, 0xA34F, WORD_LEN, 0},
+	{0x0990, 0x0085, WORD_LEN, 0},
+	{0x098C, 0xA350, WORD_LEN, 0},
+	{0x0990, 0x00A0, WORD_LEN, 0}
+};
+
+static struct mt9v113_i2c_reg_conf wb_daylight[] = {
+	{0x098C, 0xA353, WORD_LEN, 0},
+	{0x0990, 0x007F, WORD_LEN, 0},
+	{0x098C, 0xA34E, WORD_LEN, 0},
+	{0x0990, 0x00A2, WORD_LEN, 0},
+	{0x098C, 0xA34F, WORD_LEN, 0},
+	{0x0990, 0x0085, WORD_LEN, 0},
+	{0x098C, 0xA350, WORD_LEN, 0},
+	{0x0990, 0x0080, WORD_LEN, 0}
+};
+
+static struct mt9v113_i2c_reg_conf wb_cloudy[] = {
+	{0x098C, 0xA353, WORD_LEN, 0},
+	{0x0990, 0x007F, WORD_LEN, 0},
+	{0x098C, 0xA34E, WORD_LEN, 0},
+	{0x0990, 0x00B2, WORD_LEN, 0},
+	{0x098C, 0xA34F, WORD_LEN, 0},
+	{0x0990, 0x0095, WORD_LEN, 0},
+	{0x098C, 0xA350, WORD_LEN, 0},
+	{0x0990, 0x0060, WORD_LEN, 0}
+};
+
+
+static struct mt9v113_i2c_reg_conf contract_setup_tb0[] = {
+#if 0
+	{0x098C, 0xAB3C, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0xAB3D, WORD_LEN, 0},
+	{0x0990, 0x0004, WORD_LEN, 0},
+	{0x098C, 0xAB3E, WORD_LEN, 0},
+	{0x0990, 0x000E, WORD_LEN, 0},
+	{0x098C, 0xAB3F, WORD_LEN, 0},
+	{0x0990, 0x0029, WORD_LEN, 0},
+	{0x098C, 0xAB40, WORD_LEN, 0},
+	{0x0990, 0x0050, WORD_LEN, 0},
+	{0x098C, 0xAB41, WORD_LEN, 0},
+	{0x0990, 0x006A, WORD_LEN, 0},
+	{0x098C, 0xAB42, WORD_LEN, 0},
+	{0x0990, 0x0081, WORD_LEN, 0},
+	{0x098C, 0xAB43, WORD_LEN, 0},
+	{0x0990, 0x0094, WORD_LEN, 0},
+	{0x098C, 0xAB44, WORD_LEN, 0},
+	{0x0990, 0x00A5, WORD_LEN, 0},
+	{0x098C, 0xAB45, WORD_LEN, 0},
+	{0x0990, 0x00B2, WORD_LEN, 0},
+	{0x098C, 0xAB46, WORD_LEN, 0},
+	{0x0990, 0x00BE, WORD_LEN, 0},
+	{0x098C, 0xAB47, WORD_LEN, 0},
+	{0x0990, 0x00C9, WORD_LEN, 0},
+	{0x098C, 0xAB48, WORD_LEN, 0},
+	{0x0990, 0x00D3, WORD_LEN, 0},
+	{0x098C, 0xAB49, WORD_LEN, 0},
+	{0x0990, 0x00DC, WORD_LEN, 0},
+	{0x098C, 0xAB4A, WORD_LEN, 0},
+	{0x0990, 0x00E4, WORD_LEN, 0},
+	{0x098C, 0xAB4B, WORD_LEN, 0},
+	{0x0990, 0x00EB, WORD_LEN, 0},
+	{0x098C, 0xAB4C, WORD_LEN, 0},
+	{0x0990, 0x00F2, WORD_LEN, 0},
+	{0x098C, 0xAB4D, WORD_LEN, 0},
+	{0x0990, 0x00F9, WORD_LEN, 0},
+	{0x098C, 0xAB4E, WORD_LEN, 0},
+	{0x0990, 0x00FF, WORD_LEN, 0},
+#endif
+{0x098C, 0xAB3C, WORD_LEN, 0},
+{0x0990, 0x0000, WORD_LEN, 0},
+{0x098C, 0xAB3D, WORD_LEN, 0},
+{0x0990, 0x0023, WORD_LEN, 0},
+{0x098C, 0xAB3E, WORD_LEN, 0},
+{0x0990, 0x0045, WORD_LEN, 0},
+{0x098C, 0xAB3F, WORD_LEN, 0},
+{0x0990, 0x0064, WORD_LEN, 0},
+{0x098C, 0xAB40, WORD_LEN, 0},
+{0x0990, 0x0080, WORD_LEN, 0},
+{0x098C, 0xAB41, WORD_LEN, 0},
+{0x0990, 0x0099, WORD_LEN, 0},
+{0x098C, 0xAB42, WORD_LEN, 0},
+{0x0990, 0x00B0, WORD_LEN, 0},
+{0x098C, 0xAB43, WORD_LEN, 0},
+{0x0990, 0x00C1, WORD_LEN, 0},
+{0x098C, 0xAB44, WORD_LEN, 0},
+{0x0990, 0x00CF, WORD_LEN, 0},
+{0x098C, 0xAB45, WORD_LEN, 0},
+{0x0990, 0x00D9, WORD_LEN, 0},
+{0x098C, 0xAB46, WORD_LEN, 0},
+{0x0990, 0x00E1, WORD_LEN, 0},
+{0x098C, 0xAB47, WORD_LEN, 0},
+{0x0990, 0x00E8, WORD_LEN, 0},
+{0x098C, 0xAB48, WORD_LEN, 0},
+{0x0990, 0x00EE, WORD_LEN, 0},
+{0x098C, 0xAB49, WORD_LEN, 0},
+{0x0990, 0x00F2, WORD_LEN, 0},
+{0x098C, 0xAB4A, WORD_LEN, 0},
+{0x0990, 0x00F6, WORD_LEN, 0},
+{0x098C, 0xAB4B, WORD_LEN, 0},
+{0x0990, 0x00F9, WORD_LEN, 0},
+{0x098C, 0xAB4C, WORD_LEN, 0},
+{0x0990, 0x00FB, WORD_LEN, 0},
+{0x098C, 0xAB4D, WORD_LEN, 0},
+{0x0990, 0x00FD, WORD_LEN, 0},
+{0x098C, 0xAB4E, WORD_LEN, 0},
+{0x0990, 0x00FF, WORD_LEN, 0}
+
+};
+
+static struct mt9v113_i2c_reg_conf contract_setup_tb1[] = {
+#if 0
+	{0x098C, 0xAB3C, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0xAB3D, WORD_LEN, 0},
+	{0x0990, 0x0004, WORD_LEN, 0},
+	{0x098C, 0xAB3E, WORD_LEN, 0},
+	{0x0990, 0x000E, WORD_LEN, 0},
+	{0x098C, 0xAB3F, WORD_LEN, 0},
+	{0x0990, 0x0029, WORD_LEN, 0},
+	{0x098C, 0xAB40, WORD_LEN, 0},
+	{0x0990, 0x0050, WORD_LEN, 0},
+	{0x098C, 0xAB41, WORD_LEN, 0},
+	{0x0990, 0x006A, WORD_LEN, 0},
+	{0x098C, 0xAB42, WORD_LEN, 0},
+	{0x0990, 0x0081, WORD_LEN, 0},
+	{0x098C, 0xAB43, WORD_LEN, 0},
+	{0x0990, 0x0094, WORD_LEN, 0},
+	{0x098C, 0xAB44, WORD_LEN, 0},
+	{0x0990, 0x00A5, WORD_LEN, 0},
+	{0x098C, 0xAB45, WORD_LEN, 0},
+	{0x0990, 0x00B2, WORD_LEN, 0},
+	{0x098C, 0xAB46, WORD_LEN, 0},
+	{0x0990, 0x00BE, WORD_LEN, 0},
+	{0x098C, 0xAB47, WORD_LEN, 0},
+	{0x0990, 0x00C9, WORD_LEN, 0},
+	{0x098C, 0xAB48, WORD_LEN, 0},
+	{0x0990, 0x00D3, WORD_LEN, 0},
+	{0x098C, 0xAB49, WORD_LEN, 0},
+	{0x0990, 0x00DC, WORD_LEN, 0},
+	{0x098C, 0xAB4A, WORD_LEN, 0},
+	{0x0990, 0x00E4, WORD_LEN, 0},
+	{0x098C, 0xAB4B, WORD_LEN, 0},
+	{0x0990, 0x00EB, WORD_LEN, 0},
+	{0x098C, 0xAB4C, WORD_LEN, 0},
+	{0x0990, 0x00F2, WORD_LEN, 0},
+	{0x098C, 0xAB4D, WORD_LEN, 0},
+	{0x0990, 0x00F9, WORD_LEN, 0},
+	{0x098C, 0xAB4E, WORD_LEN, 0},
+	{0x0990, 0x00FF, WORD_LEN, 0},
+#endif
+{0x098C, 0xAB3C, WORD_LEN, 0},
+{0x0990, 0x0000, WORD_LEN, 0},
+{0x098C, 0xAB3D, WORD_LEN, 0},
+{0x0990, 0x001B, WORD_LEN, 0},
+{0x098C, 0xAB3E, WORD_LEN, 0},
+{0x0990, 0x002E, WORD_LEN, 0},
+{0x098C, 0xAB3F, WORD_LEN, 0},
+{0x0990, 0x004C, WORD_LEN, 0},
+{0x098C, 0xAB40, WORD_LEN, 0},
+{0x0990, 0x0078, WORD_LEN, 0},
+{0x098C, 0xAB41, WORD_LEN, 0},
+{0x0990, 0x0098, WORD_LEN, 0},
+{0x098C, 0xAB42, WORD_LEN, 0},
+{0x0990, 0x00B0, WORD_LEN, 0},
+{0x098C, 0xAB43, WORD_LEN, 0},
+{0x0990, 0x00C1, WORD_LEN, 0},
+{0x098C, 0xAB44, WORD_LEN, 0},
+{0x0990, 0x00CF, WORD_LEN, 0},
+{0x098C, 0xAB45, WORD_LEN, 0},
+{0x0990, 0x00D9, WORD_LEN, 0},
+{0x098C, 0xAB46, WORD_LEN, 0},
+{0x0990, 0x00E1, WORD_LEN, 0},
+{0x098C, 0xAB47, WORD_LEN, 0},
+{0x0990, 0x00E8, WORD_LEN, 0},
+{0x098C, 0xAB48, WORD_LEN, 0},
+{0x0990, 0x00EE, WORD_LEN, 0},
+{0x098C, 0xAB49, WORD_LEN, 0},
+{0x0990, 0x00F2, WORD_LEN, 0},
+{0x098C, 0xAB4A, WORD_LEN, 0},
+{0x0990, 0x00F6, WORD_LEN, 0},
+{0x098C, 0xAB4B, WORD_LEN, 0},
+{0x0990, 0x00F9, WORD_LEN, 0},
+{0x098C, 0xAB4C, WORD_LEN, 0},
+{0x0990, 0x00FB, WORD_LEN, 0},
+{0x098C, 0xAB4D, WORD_LEN, 0},
+{0x0990, 0x00FD, WORD_LEN, 0},
+{0x098C, 0xAB4E, WORD_LEN, 0},
+{0x0990, 0x00FF, WORD_LEN, 0}
+
+};
+
+static struct mt9v113_i2c_reg_conf contract_setup_tb2[] = {
+#if 0
+	{0x098C, 0xAB3C, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0xAB3D, WORD_LEN, 0},
+	{0x0990, 0x0004, WORD_LEN, 0},
+	{0x098C, 0xAB3E, WORD_LEN, 0},
+	{0x0990, 0x000E, WORD_LEN, 0},
+	{0x098C, 0xAB3F, WORD_LEN, 0},
+	{0x0990, 0x0029, WORD_LEN, 0},
+	{0x098C, 0xAB40, WORD_LEN, 0},
+	{0x0990, 0x0050, WORD_LEN, 0},
+	{0x098C, 0xAB41, WORD_LEN, 0},
+	{0x0990, 0x006A, WORD_LEN, 0},
+	{0x098C, 0xAB42, WORD_LEN, 0},
+	{0x0990, 0x0081, WORD_LEN, 0},
+	{0x098C, 0xAB43, WORD_LEN, 0},
+	{0x0990, 0x0094, WORD_LEN, 0},
+	{0x098C, 0xAB44, WORD_LEN, 0},
+	{0x0990, 0x00A5, WORD_LEN, 0},
+	{0x098C, 0xAB45, WORD_LEN, 0},
+	{0x0990, 0x00B2, WORD_LEN, 0},
+	{0x098C, 0xAB46, WORD_LEN, 0},
+	{0x0990, 0x00BE, WORD_LEN, 0},
+	{0x098C, 0xAB47, WORD_LEN, 0},
+	{0x0990, 0x00C9, WORD_LEN, 0},
+	{0x098C, 0xAB48, WORD_LEN, 0},
+	{0x0990, 0x00D3, WORD_LEN, 0},
+	{0x098C, 0xAB49, WORD_LEN, 0},
+	{0x0990, 0x00DC, WORD_LEN, 0},
+	{0x098C, 0xAB4A, WORD_LEN, 0},
+	{0x0990, 0x00E4, WORD_LEN, 0},
+	{0x098C, 0xAB4B, WORD_LEN, 0},
+	{0x0990, 0x00EB, WORD_LEN, 0},
+	{0x098C, 0xAB4C, WORD_LEN, 0},
+	{0x0990, 0x00F2, WORD_LEN, 0},
+	{0x098C, 0xAB4D, WORD_LEN, 0},
+	{0x0990, 0x00F9, WORD_LEN, 0},
+	{0x098C, 0xAB4E, WORD_LEN, 0},
+	{0x0990, 0x00FF, WORD_LEN, 0},
+#endif
+{0x098C, 0xAB3C, WORD_LEN, 0},
+{0x0990, 0x0000, WORD_LEN, 0},
+{0x098C, 0xAB3D, WORD_LEN, 0},
+{0x0990, 0x0014, WORD_LEN, 0},
+{0x098C, 0xAB3E, WORD_LEN, 0},
+{0x0990, 0x0027, WORD_LEN, 0},
+{0x098C, 0xAB3F, WORD_LEN, 0},
+{0x0990, 0x0041, WORD_LEN, 0},
+{0x098C, 0xAB40, WORD_LEN, 0},
+{0x0990, 0x0074, WORD_LEN, 0},
+{0x098C, 0xAB41, WORD_LEN, 0},
+{0x0990, 0x0093, WORD_LEN, 0},
+{0x098C, 0xAB42, WORD_LEN, 0},
+{0x0990, 0x00AD, WORD_LEN, 0},
+{0x098C, 0xAB43, WORD_LEN, 0},
+{0x0990, 0x00C1, WORD_LEN, 0},
+{0x098C, 0xAB44, WORD_LEN, 0},
+{0x0990, 0x00CA, WORD_LEN, 0},
+{0x098C, 0xAB45, WORD_LEN, 0},
+{0x0990, 0x00D4, WORD_LEN, 0},
+{0x098C, 0xAB46, WORD_LEN, 0},
+{0x0990, 0x00DC, WORD_LEN, 0},
+{0x098C, 0xAB47, WORD_LEN, 0},
+{0x0990, 0x00E4, WORD_LEN, 0},
+{0x098C, 0xAB48, WORD_LEN, 0},
+{0x0990, 0x00E9, WORD_LEN, 0},
+{0x098C, 0xAB49, WORD_LEN, 0},
+{0x0990, 0x00EE, WORD_LEN, 0},
+{0x098C, 0xAB4A, WORD_LEN, 0},
+{0x0990, 0x00F2, WORD_LEN, 0},
+{0x098C, 0xAB4B, WORD_LEN, 0},
+{0x0990, 0x00F5, WORD_LEN, 0},
+{0x098C, 0xAB4C, WORD_LEN, 0},
+{0x0990, 0x00F8, WORD_LEN, 0},
+{0x098C, 0xAB4D, WORD_LEN, 0},
+{0x0990, 0x00FD, WORD_LEN, 0},
+{0x098C, 0xAB4E, WORD_LEN, 0},
+{0x0990, 0x00FF, WORD_LEN, 0}
+
+};
+
+static struct mt9v113_i2c_reg_conf contract_setup_tb3[] = {
+#if 0
+	{0x098C, 0xAB3C, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0xAB3D, WORD_LEN, 0},
+	{0x0990, 0x0004, WORD_LEN, 0},
+	{0x098C, 0xAB3E, WORD_LEN, 0},
+	{0x0990, 0x000E, WORD_LEN, 0},
+	{0x098C, 0xAB3F, WORD_LEN, 0},
+	{0x0990, 0x0029, WORD_LEN, 0},
+	{0x098C, 0xAB40, WORD_LEN, 0},
+	{0x0990, 0x0050, WORD_LEN, 0},
+	{0x098C, 0xAB41, WORD_LEN, 0},
+	{0x0990, 0x006A, WORD_LEN, 0},
+	{0x098C, 0xAB42, WORD_LEN, 0},
+	{0x0990, 0x0081, WORD_LEN, 0},
+	{0x098C, 0xAB43, WORD_LEN, 0},
+	{0x0990, 0x0094, WORD_LEN, 0},
+	{0x098C, 0xAB44, WORD_LEN, 0},
+	{0x0990, 0x00A5, WORD_LEN, 0},
+	{0x098C, 0xAB45, WORD_LEN, 0},
+	{0x0990, 0x00B2, WORD_LEN, 0},
+	{0x098C, 0xAB46, WORD_LEN, 0},
+	{0x0990, 0x00BE, WORD_LEN, 0},
+	{0x098C, 0xAB47, WORD_LEN, 0},
+	{0x0990, 0x00C9, WORD_LEN, 0},
+	{0x098C, 0xAB48, WORD_LEN, 0},
+	{0x0990, 0x00D3, WORD_LEN, 0},
+	{0x098C, 0xAB49, WORD_LEN, 0},
+	{0x0990, 0x00DC, WORD_LEN, 0},
+	{0x098C, 0xAB4A, WORD_LEN, 0},
+	{0x0990, 0x00E4, WORD_LEN, 0},
+	{0x098C, 0xAB4B, WORD_LEN, 0},
+	{0x0990, 0x00EB, WORD_LEN, 0},
+	{0x098C, 0xAB4C, WORD_LEN, 0},
+	{0x0990, 0x00F2, WORD_LEN, 0},
+	{0x098C, 0xAB4D, WORD_LEN, 0},
+	{0x0990, 0x00F9, WORD_LEN, 0},
+	{0x098C, 0xAB4E, WORD_LEN, 0},
+	{0x0990, 0x00FF, WORD_LEN, 0},
+#endif
+{0x098C, 0xAB3C, WORD_LEN, 0},
+{0x0990, 0x0000, WORD_LEN, 0},
+{0x098C, 0xAB3D, WORD_LEN, 0},
+{0x0990, 0x0008, WORD_LEN, 0},
+{0x098C, 0xAB3E, WORD_LEN, 0},
+{0x0990, 0x0017, WORD_LEN, 0},
+{0x098C, 0xAB3F, WORD_LEN, 0},
+{0x0990, 0x002F, WORD_LEN, 0},
+{0x098C, 0xAB40, WORD_LEN, 0},
+{0x0990, 0x0050, WORD_LEN, 0},
+{0x098C, 0xAB41, WORD_LEN, 0},
+{0x0990, 0x006D, WORD_LEN, 0},
+{0x098C, 0xAB42, WORD_LEN, 0},
+{0x0990, 0x0088, WORD_LEN, 0},
+{0x098C, 0xAB43, WORD_LEN, 0},
+{0x0990, 0x009E, WORD_LEN, 0},
+{0x098C, 0xAB44, WORD_LEN, 0},
+{0x0990, 0x00AF, WORD_LEN, 0},
+{0x098C, 0xAB45, WORD_LEN, 0},
+{0x0990, 0x00BD, WORD_LEN, 0},
+{0x098C, 0xAB46, WORD_LEN, 0},
+{0x0990, 0x00C9, WORD_LEN, 0},
+{0x098C, 0xAB47, WORD_LEN, 0},
+{0x0990, 0x00D3, WORD_LEN, 0},
+{0x098C, 0xAB48, WORD_LEN, 0},
+{0x0990, 0x00DB, WORD_LEN, 0},
+{0x098C, 0xAB49, WORD_LEN, 0},
+{0x0990, 0x00E3, WORD_LEN, 0},
+{0x098C, 0xAB4A, WORD_LEN, 0},
+{0x0990, 0x00EA, WORD_LEN, 0},
+{0x098C, 0xAB4B, WORD_LEN, 0},
+{0x0990, 0x00F0, WORD_LEN, 0},
+{0x098C, 0xAB4C, WORD_LEN, 0},
+{0x0990, 0x00F5, WORD_LEN, 0},
+{0x098C, 0xAB4D, WORD_LEN, 0},
+{0x0990, 0x00FA, WORD_LEN, 0},
+{0x098C, 0xAB4E, WORD_LEN, 0},
+{0x0990, 0x00FF, WORD_LEN, 0}
+
+};
+
+static struct mt9v113_i2c_reg_conf contract_setup_tb4[] = {
+#if 0
+	{0x098C, 0xAB3C, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0xAB3D, WORD_LEN, 0},
+	{0x0990, 0x0004, WORD_LEN, 0},
+	{0x098C, 0xAB3E, WORD_LEN, 0},
+	{0x0990, 0x000E, WORD_LEN, 0},
+	{0x098C, 0xAB3F, WORD_LEN, 0},
+	{0x0990, 0x0029, WORD_LEN, 0},
+	{0x098C, 0xAB40, WORD_LEN, 0},
+	{0x0990, 0x0050, WORD_LEN, 0},
+	{0x098C, 0xAB41, WORD_LEN, 0},
+	{0x0990, 0x006A, WORD_LEN, 0},
+	{0x098C, 0xAB42, WORD_LEN, 0},
+	{0x0990, 0x0081, WORD_LEN, 0},
+	{0x098C, 0xAB43, WORD_LEN, 0},
+	{0x0990, 0x0094, WORD_LEN, 0},
+	{0x098C, 0xAB44, WORD_LEN, 0},
+	{0x0990, 0x00A5, WORD_LEN, 0},
+	{0x098C, 0xAB45, WORD_LEN, 0},
+	{0x0990, 0x00B2, WORD_LEN, 0},
+	{0x098C, 0xAB46, WORD_LEN, 0},
+	{0x0990, 0x00BE, WORD_LEN, 0},
+	{0x098C, 0xAB47, WORD_LEN, 0},
+	{0x0990, 0x00C9, WORD_LEN, 0},
+	{0x098C, 0xAB48, WORD_LEN, 0},
+	{0x0990, 0x00D3, WORD_LEN, 0},
+	{0x098C, 0xAB49, WORD_LEN, 0},
+	{0x0990, 0x00DC, WORD_LEN, 0},
+	{0x098C, 0xAB4A, WORD_LEN, 0},
+	{0x0990, 0x00E4, WORD_LEN, 0},
+	{0x098C, 0xAB4B, WORD_LEN, 0},
+	{0x0990, 0x00EB, WORD_LEN, 0},
+	{0x098C, 0xAB4C, WORD_LEN, 0},
+	{0x0990, 0x00F2, WORD_LEN, 0},
+	{0x098C, 0xAB4D, WORD_LEN, 0},
+	{0x0990, 0x00F9, WORD_LEN, 0},
+	{0x098C, 0xAB4E, WORD_LEN, 0},
+	{0x0990, 0x00FF, WORD_LEN, 0},
+#endif
+{0x098C, 0xAB3C, WORD_LEN, 0},
+{0x0990, 0x0000, WORD_LEN, 0},
+{0x098C, 0xAB3D, WORD_LEN, 0},
+{0x0990, 0x0006, WORD_LEN, 0},
+{0x098C, 0xAB3E, WORD_LEN, 0},
+{0x0990, 0x0012, WORD_LEN, 0},
+{0x098C, 0xAB3F, WORD_LEN, 0},
+{0x0990, 0x0027, WORD_LEN, 0},
+{0x098C, 0xAB40, WORD_LEN, 0},
+{0x0990, 0x0048, WORD_LEN, 0},
+{0x098C, 0xAB41, WORD_LEN, 0},
+{0x0990, 0x0069, WORD_LEN, 0},
+{0x098C, 0xAB42, WORD_LEN, 0},
+{0x0990, 0x008A, WORD_LEN, 0},
+{0x098C, 0xAB43, WORD_LEN, 0},
+{0x0990, 0x00A4, WORD_LEN, 0},
+{0x098C, 0xAB44, WORD_LEN, 0},
+{0x0990, 0x00B7, WORD_LEN, 0},
+{0x098C, 0xAB45, WORD_LEN, 0},
+{0x0990, 0x00C6, WORD_LEN, 0},
+{0x098C, 0xAB46, WORD_LEN, 0},
+{0x0990, 0x00D1, WORD_LEN, 0},
+{0x098C, 0xAB47, WORD_LEN, 0},
+{0x0990, 0x00DB, WORD_LEN, 0},
+{0x098C, 0xAB48, WORD_LEN, 0},
+{0x0990, 0x00E2, WORD_LEN, 0},
+{0x098C, 0xAB49, WORD_LEN, 0},
+{0x0990, 0x00E9, WORD_LEN, 0},
+{0x098C, 0xAB4A, WORD_LEN, 0},
+{0x0990, 0x00EE, WORD_LEN, 0},
+{0x098C, 0xAB4B, WORD_LEN, 0},
+{0x0990, 0x00F3, WORD_LEN, 0},
+{0x098C, 0xAB4C, WORD_LEN, 0},
+{0x0990, 0x00F7, WORD_LEN, 0},
+{0x098C, 0xAB4D, WORD_LEN, 0},
+{0x0990, 0x00FB, WORD_LEN, 0},
+{0x098C, 0xAB4E, WORD_LEN, 0},
+{0x0990, 0x00FF, WORD_LEN, 0}
+
+};
+
+static struct mt9v113_i2c_reg_conf power_up_tbl[] = {
+	
+#ifdef CONFIG_MSM_CAMERA_8X60
+	{0x001A, 0x0011, WORD_LEN, 10},
+	{0x001A, 0x0010, WORD_LEN, 10},
+#else
+	{0x001A, 0x0011, WORD_LEN, 10},
+	{0x001A, 0x0010, WORD_LEN, 10},
+#endif
+};
+
+static struct mt9v113_i2c_reg_conf register_init_tbl[] = {
+	
+#if 0
+	
+	{0x0018, 0x4028, WORD_LEN, 0},
+	{0x001A, 0x0003, WORD_LEN, 2},
+	{0x001A, 0x0000, WORD_LEN, 2},
+	{0x0018, 0x4028, WORD_LEN, 0},
+	{0x001A, 0x0210, WORD_LEN, 0},
+	{0x001E, 0x0777, WORD_LEN, 0},
+	{0x0016, 0x42DF, WORD_LEN, 0},
+	
+	{0x0014, 0xB04B, WORD_LEN, 0},
+	{0x0014, 0xB049, WORD_LEN, 0},
+	{0x0010, 0x021C, WORD_LEN, 0},
+	{0x0012, 0x0000, WORD_LEN, 0},
+	{0x0014, 0x244B, WORD_LEN, 10},
+	{0x0014, 0x304B, WORD_LEN, 0},
+	{0x0014, 0xB04A, WORD_LEN, 0},
+#endif
+	
+	{0x098C, 0xA11D, WORD_LEN, 0}, 	
+	{0x0990, 0x0001, WORD_LEN, 0},
+	{0x098C, 0xA249, WORD_LEN, 0},
+	{0x0990, 0x0002, WORD_LEN, 0},
+	{0x098C, 0xA24F, WORD_LEN, 0}, 	
+	{0x0990, 0x0040, WORD_LEN, 0},	
+	{0x098C, 0xA24B, WORD_LEN, 0}, 	
+	{0x0990, 0x0086, WORD_LEN, 0},
+	{0x098C, 0xA24A, WORD_LEN, 0}, 	
+	{0x0990, 0x007E, WORD_LEN, 0},
+	{0x098C, 0xA207, WORD_LEN, 0},	
+	{0x0990, 0x0002, WORD_LEN, 0},
+	{0x098C, 0x2257, WORD_LEN, 0}, 
+	{0x0990, 0x3A98, WORD_LEN, 0}, 
+	
+	{0x098C, 0xAB1F, WORD_LEN, 0},
+	{0x0990, 0x00C9, WORD_LEN, 0},
+	{0x326C, 0x0900, WORD_LEN, 0},
+	{0x001E, 0x0400, WORD_LEN, 0},
+	
+	{0x098C, 0xAB22, WORD_LEN, 0},
+	{0x0990, 0x0005, WORD_LEN, 0},
+	
+	{0x098C, 0xA404, WORD_LEN, 0},
+	{0x0990, 0x0010, WORD_LEN, 0},
+	{0x098C, 0x222D, WORD_LEN, 0},
+	{0x0990, 0x008B, WORD_LEN, 0},
+	{0x098C, 0xA408, WORD_LEN, 0},
+	{0x0990, 0x0021, WORD_LEN, 0},
+	{0x098C, 0xA409, WORD_LEN, 0},
+	{0x0990, 0x0024, WORD_LEN, 0},
+	{0x098C, 0xA40A, WORD_LEN, 0},
+	{0x0990, 0x0028, WORD_LEN, 0},
+	{0x098C, 0xA40B, WORD_LEN, 0},
+	{0x0990, 0x002B, WORD_LEN, 0},
+	{0x098C, 0x2411, WORD_LEN, 0},
+	{0x0990, 0x008B, WORD_LEN, 0},
+	{0x098C, 0x2413, WORD_LEN, 0},
+	{0x0990, 0x00A6, WORD_LEN, 0},
+	{0x098C, 0x2415, WORD_LEN, 0},
+	{0x0990, 0x008B, WORD_LEN, 0},
+	{0x098C, 0x2417, WORD_LEN, 0},
+	{0x0990, 0x00A6, WORD_LEN, 0},
+	{0x098C, 0xA40D, WORD_LEN, 0},
+	{0x0990, 0x0002, WORD_LEN, 0},
+	{0x098C, 0xA40E, WORD_LEN, 0},
+	{0x0990, 0x0003, WORD_LEN, 0},
+	{0x098C, 0xA410, WORD_LEN, 0},
+	{0x0990, 0x000A, WORD_LEN, 0},
+	
+	{0x364E, 0x0330, WORD_LEN, 0},
+	{0x3650, 0x010B, WORD_LEN, 0},
+	{0x3652, 0x2312, WORD_LEN, 0},
+	{0x3654, 0xC2AF, WORD_LEN, 0},
+	{0x3656, 0x9F50, WORD_LEN, 0},
+	{0x3658, 0x0290, WORD_LEN, 0},
+	{0x365A, 0x0FEB, WORD_LEN, 0},
+	{0x365C, 0x4E52, WORD_LEN, 0},
+	{0x365E, 0xC0CF, WORD_LEN, 0},
+	{0x3660, 0xCB12, WORD_LEN, 0},
+	{0x3662, 0x02B0, WORD_LEN, 0},
+	{0x3664, 0x620C, WORD_LEN, 0},
+	{0x3666, 0x1AD2, WORD_LEN, 0},
+	{0x3668, 0xA7B0, WORD_LEN, 0},
+	{0x366A, 0xBB91, WORD_LEN, 0},
+	{0x366C, 0x0290, WORD_LEN, 0},
+	{0x366E, 0xCE2A, WORD_LEN, 0},
+	{0x3670, 0x2AD2, WORD_LEN, 0},
+	{0x3672, 0x8BAE, WORD_LEN, 0},
+	{0x3674, 0xABAF, WORD_LEN, 0},
+	{0x3676, 0xCB8D, WORD_LEN, 0},
+	{0x3678, 0xA24E, WORD_LEN, 0},
+	{0x367A, 0x2F91, WORD_LEN, 0},
+	{0x367C, 0x0991, WORD_LEN, 0},
+	{0x367E, 0xC594, WORD_LEN, 0},
+	{0x3680, 0xAC2B, WORD_LEN, 0},
+	{0x3682, 0xA4AC, WORD_LEN, 0},
+	{0x3684, 0x6891, WORD_LEN, 0},
+	{0x3686, 0xAD30, WORD_LEN, 0},
+	{0x3688, 0x9295, WORD_LEN, 0},
+	{0x368A, 0x380B, WORD_LEN, 0},
+	{0x368C, 0x464C, WORD_LEN, 0},
+	{0x368E, 0x4C2C, WORD_LEN, 0},
+	{0x3690, 0xE9AF, WORD_LEN, 0},
+	{0x3692, 0xC312, WORD_LEN, 0},
+	{0x3694, 0xA50D, WORD_LEN, 0},
+	{0x3696, 0xF6AD, WORD_LEN, 0},
+	{0x3698, 0x2E11, WORD_LEN, 0},
+	{0x369A, 0x11F0, WORD_LEN, 0},
+	{0x369C, 0xB534, WORD_LEN, 0},
+	{0x369E, 0x0573, WORD_LEN, 0},
+	{0x36A0, 0xA431, WORD_LEN, 0},
+	{0x36A2, 0x81B6, WORD_LEN, 0},
+	{0x36A4, 0x0895, WORD_LEN, 0},
+	{0x36A6, 0x5D19, WORD_LEN, 0},
+	{0x36A8, 0x17F3, WORD_LEN, 0},
+	{0x36AA, 0xF1F1, WORD_LEN, 0},
+	{0x36AC, 0x80D6, WORD_LEN, 0},
+	{0x36AE, 0x42B4, WORD_LEN, 0},
+	{0x36B0, 0x3499, WORD_LEN, 0},
+	{0x36B2, 0x55F2, WORD_LEN, 0},
+	{0x36B4, 0x9492, WORD_LEN, 0},
+	{0x36B6, 0x9456, WORD_LEN, 0},
+	{0x36B8, 0x22B5, WORD_LEN, 0},
+	{0x36BA, 0x4AB9, WORD_LEN, 0},
+	{0x36BC, 0x0093, WORD_LEN, 0},
+	{0x36BE, 0xA391, WORD_LEN, 0},
+	{0x36C0, 0x85B6, WORD_LEN, 0},
+	{0x36C2, 0x4C34, WORD_LEN, 0},
+	{0x36C4, 0x4BF9, WORD_LEN, 0},
+	{0x36C6, 0xBD0F, WORD_LEN, 0},
+	{0x36C8, 0x1DD1, WORD_LEN, 0},
+	{0x36CA, 0xEE54, WORD_LEN, 0},
+	{0x36CC, 0xAAB5, WORD_LEN, 0},
+	{0x36CE, 0x0CD7, WORD_LEN, 0},
+	{0x36D0, 0xA770, WORD_LEN, 0},
+	{0x36D2, 0x9C11, WORD_LEN, 0},
+	{0x36D4, 0xA635, WORD_LEN, 0},
+	{0x36D6, 0x1576, WORD_LEN, 0},
+	{0x36D8, 0x0058, WORD_LEN, 0},
+	{0x36DA, 0xC4F1, WORD_LEN, 0},
+	{0x36DC, 0xD3F1, WORD_LEN, 0},
+	{0x36DE, 0x5134, WORD_LEN, 0},
+	{0x36E0, 0x2696, WORD_LEN, 0},
+	{0x36E2, 0x8F19, WORD_LEN, 0},
+	{0x36E4, 0xD98F, WORD_LEN, 0},
+	{0x36E6, 0xA911, WORD_LEN, 0},
+	{0x36E8, 0xD1F4, WORD_LEN, 0},
+	{0x36EA, 0x7054, WORD_LEN, 0},
+	{0x36EC, 0x76D6, WORD_LEN, 0},
+	{0x36EE, 0x93D5, WORD_LEN, 0},
+	{0x36F0, 0x0934, WORD_LEN, 0},
+	{0x36F2, 0x63B9, WORD_LEN, 0},
+	{0x36F4, 0xC178, WORD_LEN, 0},
+	{0x36F6, 0xEA7C, WORD_LEN, 0},
+	{0x36F8, 0xA7D5, WORD_LEN, 0},
+	{0x36FA, 0x0A55, WORD_LEN, 0},
+	{0x36FC, 0x3979, WORD_LEN, 0},
+	{0x36FE, 0x8597, WORD_LEN, 0},
+	{0x3700, 0xA03C, WORD_LEN, 0},
+	{0x3702, 0xE194, WORD_LEN, 0},
+	{0x3704, 0x74F4, WORD_LEN, 0},
+	{0x3706, 0x7A19, WORD_LEN, 0},
+	{0x3708, 0xC5B6, WORD_LEN, 0},
+	{0x370A, 0xD9BC, WORD_LEN, 0},
+	{0x370C, 0x8F55, WORD_LEN, 0},
+	{0x370E, 0x6FF4, WORD_LEN, 0},
+	{0x3710, 0x01DA, WORD_LEN, 0},
+	{0x3712, 0xE317, WORD_LEN, 0},
+	{0x3714, 0xE93C, WORD_LEN, 0},
+	{0x3644, 0x0144, WORD_LEN, 0},
+	{0x3642, 0x00F0, WORD_LEN, 0},
+	
+};
+
+static struct mt9v113_i2c_reg_conf register_init_tb2[] = {
+
+	
+
+	
+	{0x098C, 0xA354, WORD_LEN, 0},
+	{0x0990, 0x0048, WORD_LEN, 0},
+	{0x098C, 0xAB20, WORD_LEN, 0},
+	{0x0990, 0x0048, WORD_LEN, 0},
+	
+	{0x098C, 0xA11F, WORD_LEN, 0},
+	{0x0990, 0x0001, WORD_LEN, 0},
+	{0x098C, 0x2306, WORD_LEN, 0},
+	{0x0990, 0x03C0, WORD_LEN, 0},
+	{0x098C, 0x2308, WORD_LEN, 0},
+	{0x0990, 0xFD7C, WORD_LEN, 0},
+	{0x098C, 0x230A, WORD_LEN, 0},
+	{0x0990, 0xFFF7, WORD_LEN, 0},
+	{0x098C, 0x230C, WORD_LEN, 0},
+	{0x0990, 0xFF25, WORD_LEN, 0},
+	{0x098C, 0x230E, WORD_LEN, 0},
+	{0x0990, 0x0384, WORD_LEN, 0},
+	{0x098C, 0x2310, WORD_LEN, 0},
+	{0x0990, 0xFFD6, WORD_LEN, 0},
+	{0x098C, 0x2312, WORD_LEN, 0},
+	{0x0990, 0xFED2, WORD_LEN, 0},
+	{0x098C, 0x2314, WORD_LEN, 0},
+	{0x0990, 0xFCB2, WORD_LEN, 0},
+	{0x098C, 0x2316, WORD_LEN, 0},
+	{0x0990, 0x068E, WORD_LEN, 0},
+	{0x098C, 0x2318, WORD_LEN, 0},
+	{0x0990, 0x001B, WORD_LEN, 0},
+	{0x098C, 0x231A, WORD_LEN, 0},
+	{0x0990, 0x0036, WORD_LEN, 0},
+	{0x098C, 0x231C, WORD_LEN, 0},
+	{0x0990, 0xFF65, WORD_LEN, 0},
+	{0x098C, 0x231E, WORD_LEN, 0},
+	{0x0990, 0x0052, WORD_LEN, 0},
+	{0x098C, 0x2320, WORD_LEN, 0},
+	{0x0990, 0x0012, WORD_LEN, 0},
+	{0x098C, 0x2322, WORD_LEN, 0},
+	{0x0990, 0x0007, WORD_LEN, 0},
+	{0x098C, 0x2324, WORD_LEN, 0},
+	{0x0990, 0xFFCF, WORD_LEN, 0},
+	{0x098C, 0x2326, WORD_LEN, 0},
+	{0x0990, 0x0037, WORD_LEN, 0},
+	{0x098C, 0x2328, WORD_LEN, 0},
+	{0x0990, 0x00D8, WORD_LEN, 0},
+	{0x098C, 0x232A, WORD_LEN, 0},
+	{0x0990, 0x01C8, WORD_LEN, 0},
+	{0x098C, 0x232C, WORD_LEN, 0},
+	{0x0990, 0xFC9F, WORD_LEN, 0},
+	{0x098C, 0x232E, WORD_LEN, 0},
+	{0x0990, 0x0010, WORD_LEN, 0},
+	{0x098C, 0x2330, WORD_LEN, 0},
+	{0x0990, 0xFFF7, WORD_LEN, 0},
+	{0x098C, 0xA348, WORD_LEN, 0},
+	{0x0990, 0x0008, WORD_LEN, 0},
+	{0x098C, 0xA349, WORD_LEN, 0},
+	{0x0990, 0x0002, WORD_LEN, 0},
+	{0x098C, 0xA34A, WORD_LEN, 0},
+	{0x0990, 0x0059, WORD_LEN, 0},
+	{0x098C, 0xA34B, WORD_LEN, 0},
+	{0x0990, 0x00E6, WORD_LEN, 0},
+	{0x098C, 0xA351, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0xA352, WORD_LEN, 0},
+	{0x0990, 0x007F, WORD_LEN, 0},
+	{0x098C, 0xA355, WORD_LEN, 0},
+	{0x0990, 0x0001, WORD_LEN, 0},
+	{0x098C, 0xA35D, WORD_LEN, 0},
+	{0x0990, 0x0078, WORD_LEN, 0},
+	{0x098C, 0xA35E, WORD_LEN, 0},
+	{0x0990, 0x0086, WORD_LEN, 0},
+	{0x098C, 0xA35F, WORD_LEN, 0},
+	{0x0990, 0x007E, WORD_LEN, 0},
+	{0x098C, 0xA360, WORD_LEN, 0},
+	{0x0990, 0x0082, WORD_LEN, 0},
+	{0x098C, 0x2361, WORD_LEN, 0},
+	{0x0990, 0x0040, WORD_LEN, 0},
+	{0x098C, 0xA363, WORD_LEN, 0},
+	{0x0990, 0x00D2, WORD_LEN, 0},
+	{0x098C, 0xA364, WORD_LEN, 0},
+	{0x0990, 0x00F6, WORD_LEN, 0},
+	{0x098C, 0xA302, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0xA303, WORD_LEN, 0},
+	{0x0990, 0x00EF, WORD_LEN, 0},
+	{0x098C, 0xA366, WORD_LEN, 0},
+	{0x0990, 0x00A6, WORD_LEN, 0},
+	{0x098C, 0xA367, WORD_LEN, 0},
+	{0x0990, 0x0096, WORD_LEN, 0},
+	{0x098C, 0xA368, WORD_LEN, 0},
+	{0x0990, 0x005C, WORD_LEN, 0},
+	
+#ifndef CONFIG_MSM_CAMERA_8X60
+	{0x098C, 0x2B1B, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+#endif
+	{0x098C, 0x2B28, WORD_LEN, 0},
+	{0x0990, 0x157C, WORD_LEN, 0},
+	{0x098C, 0x2B2A, WORD_LEN, 0},
+	{0x0990, 0x1B58, WORD_LEN, 0},
+	{0x098C, 0xAB37, WORD_LEN, 0},
+	{0x0990, 0x0001, WORD_LEN, 0}, 
+	{0x098C, 0x2B38, WORD_LEN, 0},
+	{0x0990, 0x157C, WORD_LEN, 0},
+	{0x098C, 0x2B3A, WORD_LEN, 0},
+	{0x0990, 0x1B58, WORD_LEN, 0},
+	
+	{0x098C, 0xAB3C, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0xAB3D, WORD_LEN, 0},
+	{0x0990, 0x0004, WORD_LEN, 0},
+	{0x098C, 0xAB3E, WORD_LEN, 0},
+	{0x0990, 0x000E, WORD_LEN, 0},
+	{0x098C, 0xAB3F, WORD_LEN, 0},
+	{0x0990, 0x0029, WORD_LEN, 0},
+	{0x098C, 0xAB40, WORD_LEN, 0},
+	{0x0990, 0x0050, WORD_LEN, 0},
+	{0x098C, 0xAB41, WORD_LEN, 0},
+	{0x0990, 0x006A, WORD_LEN, 0},
+	{0x098C, 0xAB42, WORD_LEN, 0},
+	{0x0990, 0x0081, WORD_LEN, 0},
+	{0x098C, 0xAB43, WORD_LEN, 0},
+	{0x0990, 0x0094, WORD_LEN, 0},
+	{0x098C, 0xAB44, WORD_LEN, 0},
+	{0x0990, 0x00A5, WORD_LEN, 0},
+	{0x098C, 0xAB45, WORD_LEN, 0},
+	{0x0990, 0x00B2, WORD_LEN, 0},
+	{0x098C, 0xAB46, WORD_LEN, 0},
+	{0x0990, 0x00BE, WORD_LEN, 0},
+	{0x098C, 0xAB47, WORD_LEN, 0},
+	{0x0990, 0x00C9, WORD_LEN, 0},
+	{0x098C, 0xAB48, WORD_LEN, 0},
+	{0x0990, 0x00D3, WORD_LEN, 0},
+	{0x098C, 0xAB49, WORD_LEN, 0},
+	{0x0990, 0x00DC, WORD_LEN, 0},
+	{0x098C, 0xAB4A, WORD_LEN, 0},
+	{0x0990, 0x00E4, WORD_LEN, 0},
+	{0x098C, 0xAB4B, WORD_LEN, 0},
+	{0x0990, 0x00EB, WORD_LEN, 0},
+	{0x098C, 0xAB4C, WORD_LEN, 0},
+	{0x0990, 0x00F2, WORD_LEN, 0},
+	{0x098C, 0xAB4D, WORD_LEN, 0},
+	{0x0990, 0x00F9, WORD_LEN, 0},
+	{0x098C, 0xAB4E, WORD_LEN, 0},
+	{0x0990, 0x00FF, WORD_LEN, 0},
+	
+	{0x098C, 0xAB4F, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0xAB50, WORD_LEN, 0},
+	{0x0990, 0x000F, WORD_LEN, 0},
+	{0x098C, 0xAB51, WORD_LEN, 0},
+	{0x0990, 0x001A, WORD_LEN, 0},
+	{0x098C, 0xAB52, WORD_LEN, 0},
+	{0x0990, 0x002E, WORD_LEN, 0},
+	{0x098C, 0xAB53, WORD_LEN, 0},
+	{0x0990, 0x0050, WORD_LEN, 0},
+	{0x098C, 0xAB54, WORD_LEN, 0},
+	{0x0990, 0x006A, WORD_LEN, 0},
+	{0x098C, 0xAB55, WORD_LEN, 0},
+	{0x0990, 0x0080, WORD_LEN, 0},
+	{0x098C, 0xAB56, WORD_LEN, 0},
+	{0x0990, 0x0091, WORD_LEN, 0},
+	{0x098C, 0xAB57, WORD_LEN, 0},
+	{0x0990, 0x00A1, WORD_LEN, 0},
+	{0x098C, 0xAB58, WORD_LEN, 0},
+	{0x0990, 0x00AF, WORD_LEN, 0},
+	{0x098C, 0xAB59, WORD_LEN, 0},
+	{0x0990, 0x00BB, WORD_LEN, 0},
+	{0x098C, 0xAB5A, WORD_LEN, 0},
+	{0x0990, 0x00C6, WORD_LEN, 0},
+	{0x098C, 0xAB5B, WORD_LEN, 0},
+	{0x0990, 0x00D0, WORD_LEN, 0},
+	{0x098C, 0xAB5C, WORD_LEN, 0},
+	{0x0990, 0x00D9, WORD_LEN, 0},
+	{0x098C, 0xAB5D, WORD_LEN, 0},
+	{0x0990, 0x00E2, WORD_LEN, 0},
+	{0x098C, 0xAB5E, WORD_LEN, 0},
+	{0x0990, 0x00EA, WORD_LEN, 0},
+	{0x098C, 0xAB5F, WORD_LEN, 0},
+	{0x0990, 0x00F1, WORD_LEN, 0},
+	{0x098C, 0xAB60, WORD_LEN, 0},
+	{0x0990, 0x00F9, WORD_LEN, 0},
+	{0x098C, 0xAB61, WORD_LEN, 0},
+	{0x0990, 0x00FF, WORD_LEN, 0},
+	
+	{0x098C, 0x2703, WORD_LEN, 0},
+	{0x0990, 0x0280, WORD_LEN, 0},
+	{0x098C, 0x2705, WORD_LEN, 0},
+	{0x0990, 0x01E0, WORD_LEN, 0},
+	{0x098C, 0x270D, WORD_LEN, 0},
+	{0x0990, 0x0004, WORD_LEN, 0},
+	{0x098C, 0x270F, WORD_LEN, 0},
+	{0x0990, 0x0004, WORD_LEN, 0},
+	{0x098C, 0x2711, WORD_LEN, 0},
+	{0x0990, 0x01EB, WORD_LEN, 0},
+	{0x098C, 0x2713, WORD_LEN, 0},
+	{0x0990, 0x028B, WORD_LEN, 0},
+	{0x098C, 0x2715, WORD_LEN, 0},
+	{0x0990, 0x0001, WORD_LEN, 0},
+	{0x098C, 0x2717, WORD_LEN, 0},
+#if defined(CONFIG_MSM_CAMERA_8X60) || defined(CONFIG_MSM_CAMERA_V4L2)
+	{0x0990, 0x0025, WORD_LEN, 0},
+#else
+	{0x0990, 0x0026, WORD_LEN, 0},
+#endif
+	{0x098C, 0x2719, WORD_LEN, 0},
+	{0x0990, 0x001A, WORD_LEN, 0},
+	{0x098C, 0x271B, WORD_LEN, 0},
+	{0x0990, 0x006B, WORD_LEN, 0},
+	{0x098C, 0x271D, WORD_LEN, 0},
+	{0x0990, 0x006B, WORD_LEN, 0},
+	{0x098C, 0x271F, WORD_LEN, 0},
+	{0x0990, 0x022A, WORD_LEN, 0},
+	{0x098C, 0x2721, WORD_LEN, 0},
+	{0x0990, 0x034A, WORD_LEN, 0},
+	{0x098C, 0x2739, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0x273B, WORD_LEN, 0},
+	{0x0990, 0x027F, WORD_LEN, 0},
+	{0x098C, 0x273D, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0x273F, WORD_LEN, 0},
+	{0x0990, 0x01DF, WORD_LEN, 0},
+	{0x098C, 0x2707, WORD_LEN, 0},
+	{0x0990, 0x0280, WORD_LEN, 0},
+	{0x098C, 0x2709, WORD_LEN, 0},
+	{0x0990, 0x01E0, WORD_LEN, 0},
+	{0x098C, 0x2723, WORD_LEN, 0},
+	{0x0990, 0x0004, WORD_LEN, 0},
+	{0x098C, 0x2725, WORD_LEN, 0},
+	{0x0990, 0x0004, WORD_LEN, 0},
+	{0x098C, 0x2727, WORD_LEN, 0},
+	{0x0990, 0x01EB, WORD_LEN, 0},
+	{0x098C, 0x2729, WORD_LEN, 0},
+	{0x0990, 0x028B, WORD_LEN, 0},
+	{0x098C, 0x272B, WORD_LEN, 0},
+	{0x0990, 0x0001, WORD_LEN, 0},
+	{0x098C, 0x272D, WORD_LEN, 0},
+#if defined(CONFIG_MSM_CAMERA_8X60) || defined(CONFIG_MSM_CAMERA_V4L2)
+	{0x0990, 0x0025, WORD_LEN, 0},
+#else
+	{0x0990, 0x0026, WORD_LEN, 0},
+#endif
+	{0x098C, 0x272F, WORD_LEN, 0},
+	{0x0990, 0x001A, WORD_LEN, 0},
+	{0x098C, 0x2731, WORD_LEN, 0},
+	{0x0990, 0x006B, WORD_LEN, 0},
+	{0x098C, 0x2733, WORD_LEN, 0},
+	{0x0990, 0x006B, WORD_LEN, 0},
+	{0x098C, 0x2735, WORD_LEN, 0},
+	{0x0990, 0x022A, WORD_LEN, 0},
+	{0x098C, 0x2737, WORD_LEN, 0},
+	{0x0990, 0x034A, WORD_LEN, 0},
+	{0x098C, 0x2747, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0x2749, WORD_LEN, 0},
+	{0x0990, 0x027F, WORD_LEN, 0},
+	{0x098C, 0x274B, WORD_LEN, 0},
+	{0x0990, 0x0000, WORD_LEN, 0},
+	{0x098C, 0x274D, WORD_LEN, 0},
+	{0x0990, 0x01DF, WORD_LEN, 0},
+	{0x098C, 0x2755, WORD_LEN, 0},
+	{0x0990, 0x0002, WORD_LEN, 0},
+	{0x098C, 0x2757, WORD_LEN, 0},
+	{0x0990, 0x0002, WORD_LEN, 0},
+	{0x098C, 0xA20C, WORD_LEN, 0},
+	{0x0990, 0x000C, WORD_LEN, 0},
+
+#if 0
+	
+	{0x098C, 0xA103, WORD_LEN, 0},
+	{0x0990, 0x0006, WORD_LEN, 0},
+	{0x098C, 0xA103, WORD_LEN, 0},
+	{0x0990, 0x0005, WORD_LEN, 0},
+	{0x098C, 0xA102, WORD_LEN, 0},
+	{0x0990, 0x000F, WORD_LEN, 0},
+#endif
+
+};
+
+
+struct mt9v113_reg mt9v113_regs = {
+	.power_up_tbl = (struct mt9v113_i2c_reg_conf *)&power_up_tbl,
+	.power_up_tbl_size = ARRAY_SIZE(power_up_tbl),
+	.register_init_1 = (struct mt9v113_i2c_reg_conf *)&register_init_tbl,
+	.register_init_size_1 = ARRAY_SIZE(register_init_tbl),
+	.register_init_2 = (struct mt9v113_i2c_reg_conf *)&register_init_tb2,
+	.register_init_size_2 = ARRAY_SIZE(register_init_tb2),
+	.contract_tb0 = (struct mt9v113_i2c_reg_conf *)&contract_setup_tb0,
+	.contract_tb0_size = ARRAY_SIZE(contract_setup_tb0),
+	.contract_tb1 = (struct mt9v113_i2c_reg_conf *)&contract_setup_tb1,
+	.contract_tb1_size = ARRAY_SIZE(contract_setup_tb1),
+	.contract_tb2 = (struct mt9v113_i2c_reg_conf *)&contract_setup_tb2,
+	.contract_tb2_size = ARRAY_SIZE(contract_setup_tb2),
+	.contract_tb3 = (struct mt9v113_i2c_reg_conf *)&contract_setup_tb3,
+	.contract_tb3_size = ARRAY_SIZE(contract_setup_tb3),
+	.contract_tb4 = (struct mt9v113_i2c_reg_conf *)&contract_setup_tb4,
+	.contract_tb4_size = ARRAY_SIZE(contract_setup_tb4),
+	.wb_auto = (struct mt9v113_i2c_reg_conf *)&wb_auto,
+	.wb_auto_size = ARRAY_SIZE(wb_auto),
+	.wb_fluorescent = (struct mt9v113_i2c_reg_conf *)&wb_fluorescent,
+	.wb_fluorescent_size = ARRAY_SIZE(wb_fluorescent),
+	.wb_incandescent = (struct mt9v113_i2c_reg_conf *)&wb_incandescent,
+	.wb_incandescent_size = ARRAY_SIZE(wb_incandescent),
+	.wb_daylight = (struct mt9v113_i2c_reg_conf *)&wb_daylight,
+	.wb_daylight_size = ARRAY_SIZE(wb_daylight),
+	.wb_cloudy = (struct mt9v113_i2c_reg_conf *)&wb_cloudy,
+	.wb_cloudy_size = ARRAY_SIZE(wb_cloudy)
+};
diff --git a/drivers/media/video/msm/sensors/mt9v113_v4l2.c b/drivers/media/video/msm/sensors/mt9v113_v4l2.c
new file mode 100644
index 0000000..232d2b4
--- /dev/null
+++ b/drivers/media/video/msm/sensors/mt9v113_v4l2.c
@@ -0,0 +1,2631 @@
+/*
+ * HTC Corporation Proprietary Rights Acknowledgment
+ *
+ * Copyright (C) 2008 HTC Corporation
+ *
+ * All Rights Reserved.
+ *
+ * The information contained in this work is the exclusive property
+ * of HTC Corporation("HTC").  Only the user who is legally authorized
+ * by HTC ("Authorized User") has right to employ this work within the
+ * scope of this statement.  Nevertheless, the Authorized User shall not
+ * use this work for any purpose other than the purpose agreed by HTC.
+ * Any and all addition or modification to this work shall be  unconditionally
+ * granted back to HTC and such addition or modification shall be solely
+ * owned by HTC.  No right is granted under this statement, including but not
+ * limited to, distribution, reproduction, and transmission, except as
+ * otherwise provided in this statement.  Any other usage of this work shall
+ *  be subject to the further written consent of HTC.
+ */
+
+
+#include <linux/delay.h>
+#include <linux/types.h>
+#include <linux/i2c.h>
+#include <linux/uaccess.h>
+#include <linux/miscdevice.h>
+#include <linux/slab.h>
+#include <media/msm_camera.h>
+
+
+#include <mach/gpio.h>
+#include "mt9v113.h"
+#include <asm/mach-types.h>
+#include <media/v4l2-subdev.h>
+#include <mach/camera.h>
+#include "msm.h"
+#include "msm_ispif.h"
+#include "msm_sensor.h"
+
+
+#define SENSOR_NAME "mt9v113"
+
+static struct msm_sensor_ctrl_t mt9v113_s_ctrl;
+
+DEFINE_MUTEX(mt9v113_mut);
+
+#define  MT9V113_MODEL_ID     	0x2280 
+#define  MT9V113_MODEL_ID_ADDR  0x0000 
+static int op_mode;
+static int32_t config_csi = 0;
+#define MT9V113_REG_READ_MODE_ADDR_1	0x2717
+#define MT9V113_REG_READ_MODE_ADDR_2	0x272D
+#define MT9V113_READ_NORMAL_MODE	0x0024	
+#define MT9V113_READ_MIRROR_FLIP	0x0027	
+
+struct mt9v113_work {
+	struct work_struct work;
+};
+
+static struct mt9v113_work *mt9v113_sensorw;
+static struct i2c_client *mt9v113_client;
+
+struct mt9v113_ctrl_t {
+	const struct msm_camera_sensor_info *sensordata;
+	uint32_t sensormode;
+	uint32_t fps_divider;
+	uint32_t pict_fps_divider;
+	uint16_t fps;
+	uint16_t curr_lens_pos;
+	uint16_t curr_step_pos;
+	uint16_t my_reg_gain;
+	uint32_t my_reg_line_count;
+	uint16_t total_lines_per_frame;
+
+	enum mt9v113_resolution_t prev_res;
+	enum mt9v113_resolution_t pict_res;
+	enum mt9v113_resolution_t curr_res;
+	enum mt9v113_test_mode_t set_test;
+
+	struct v4l2_subdev *sensor_dev;
+	struct mt9v113_format *fmt;
+};
+
+static struct msm_sensor_output_info_t mt9v113_dimensions[] = {
+	{
+		.x_output = 0x280,
+		.y_output = 0x1E0,
+		.line_length_pclk = 0x34A,
+		.frame_length_lines = 0x22A,
+		.vt_pixel_clk = 28000000,
+		.op_pixel_clk = 28000000,
+		.binning_factor = 1,
+	},
+	{
+		.x_output = 0x280,
+		.y_output = 0x1E0,
+		.line_length_pclk = 0x34A,
+		.frame_length_lines = 0x22A,
+		.vt_pixel_clk = 28000000,
+		.op_pixel_clk = 28000000,
+		.binning_factor = 1,
+	},
+	{
+		.x_output = 0x280,
+		.y_output = 0x1E0,
+		.line_length_pclk = 0x34A,
+		.frame_length_lines = 0x22A,
+		.vt_pixel_clk = 28000000,
+		.op_pixel_clk = 28000000,
+		.binning_factor = 1,
+	},
+	{
+		.x_output = 0x280,
+		.y_output = 0x1E0,
+		.line_length_pclk = 0x34A,
+		.frame_length_lines = 0x22A,
+		.vt_pixel_clk = 28000000,
+		.op_pixel_clk = 28000000,
+		.binning_factor = 1,
+	},
+
+};
+
+int g_csi_if = 0;
+static DECLARE_WAIT_QUEUE_HEAD(mt9v113_wait_queue);
+
+
+
+#define MAX_I2C_RETRIES 20
+#define CHECK_STATE_TIME 100
+
+struct mt9v113_format {
+	enum v4l2_mbus_pixelcode code;
+	enum v4l2_colorspace colorspace;
+	u16 fmt;
+	u16 order;
+};
+
+static int i2c_transfer_retry(struct i2c_adapter *adap,
+			struct i2c_msg *msgs,
+			int len)
+{
+	int i2c_retry = 0;
+	int ns; 
+
+	while (i2c_retry++ < MAX_I2C_RETRIES) {
+		ns = i2c_transfer(adap, msgs, len);
+		if (ns == len)
+			break;
+		pr_err("%s: try %d/%d: i2c_transfer sent: %d, len %d\n",
+			__func__,
+			i2c_retry, MAX_I2C_RETRIES, ns, len);
+		msleep(10);
+	}
+
+	return ns == len ? 0 : -EIO;
+}
+
+static int mt9v113_i2c_txdata(unsigned short saddr,
+				  unsigned char *txdata, int length)
+{
+	struct i2c_msg msg[] = {
+		{
+		 .addr = saddr >> 1,
+		 .flags = 0,
+		 .len = length,
+		 .buf = txdata,
+		 },
+	};
+
+	if (i2c_transfer_retry(mt9v113_client->adapter, msg, 1) < 0) {
+		pr_err("mt9v113_i2c_txdata failed\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int mt9v113_i2c_write(unsigned short saddr,
+				 unsigned short waddr, unsigned short wdata,
+				 enum mt9v113_width width)
+{
+	int rc = -EIO;
+	unsigned char buf[4];
+	memset(buf, 0, sizeof(buf));
+
+	switch (width) {
+	case WORD_LEN:{
+			
+
+			buf[0] = (waddr & 0xFF00) >> 8;
+			buf[1] = (waddr & 0x00FF);
+			buf[2] = (wdata & 0xFF00) >> 8;
+			buf[3] = (wdata & 0x00FF);
+
+			rc = mt9v113_i2c_txdata(saddr, buf, 4);
+		}
+		break;
+
+	case BYTE_LEN:{
+			
+
+			buf[0] = waddr;
+			buf[1] = wdata;
+			rc = mt9v113_i2c_txdata(saddr, buf, 2);
+		}
+		break;
+
+	default:
+		break;
+	}
+
+	if (rc < 0)
+		pr_info("i2c_write failed, addr = 0x%x, val = 0x%x!\n",
+		     waddr, wdata);
+
+	return rc;
+}
+
+static int mt9v113_i2c_write_table(struct mt9v113_i2c_reg_conf
+				       *reg_conf_tbl, int num_of_items_in_table)
+{
+	int i;
+	int rc = -EIO;
+
+	for (i = 0; i < num_of_items_in_table; i++) {
+		rc = mt9v113_i2c_write(mt9v113_client->addr,
+				       reg_conf_tbl->waddr, reg_conf_tbl->wdata,
+				       reg_conf_tbl->width);
+		if (rc < 0) {
+		pr_err("%s: num_of_items_in_table=%d\n", __func__,
+			num_of_items_in_table);
+			break;
+		}
+		if (reg_conf_tbl->mdelay_time != 0)
+			mdelay(reg_conf_tbl->mdelay_time);
+		reg_conf_tbl++;
+	}
+
+	return rc;
+}
+
+static int mt9v113_i2c_rxdata(unsigned short saddr,
+			      unsigned char *rxdata, int length)
+{
+	struct i2c_msg msgs[] = {
+		{
+		 .addr = saddr >> 1,
+		 .flags = 0,
+		 .len = 2,  
+		 .buf = rxdata,
+		 },
+		{
+		 .addr = saddr >> 1,
+		 .flags = I2C_M_RD,
+		 .len = length,
+		 .buf = rxdata,
+		 },
+	};
+
+	if (i2c_transfer_retry(mt9v113_client->adapter, msgs, 2) < 0) {
+		pr_err("mt9v113_i2c_rxdata failed!\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int32_t mt9v113_i2c_read_w(unsigned short saddr, unsigned short raddr,
+	unsigned short *rdata)
+{
+	int32_t rc = 0;
+	unsigned char buf[4];
+
+	if (!rdata)
+		return -EIO;
+
+	memset(buf, 0, sizeof(buf));
+
+	buf[0] = (raddr & 0xFF00)>>8;
+	buf[1] = (raddr & 0x00FF);
+
+	rc = mt9v113_i2c_rxdata(saddr, buf, 2);
+	if (rc < 0)
+		return rc;
+
+	*rdata = buf[0] << 8 | buf[1];
+
+	if (rc < 0)
+		CDBG("mt9v113_i2c_read_w failed!\n");
+
+	return rc;
+}
+
+#if 0
+static int mt9v113_i2c_read(unsigned short saddr,
+				unsigned short raddr, unsigned char *rdata)
+{
+	int rc = 0;
+	unsigned char buf[1];
+
+	if (!rdata)
+		return -EIO;
+
+	memset(buf, 0, sizeof(buf));
+	buf[0] = raddr;
+	rc = mt9v113_i2c_rxdata(saddr, buf, 1);
+	if (rc < 0)
+		return rc;
+	*rdata = buf[0];
+	if (rc < 0)
+		pr_info("mt9v113_i2c_read failed!\n");
+
+	return rc;
+}
+#endif
+
+static int mt9v113_i2c_write_bit(unsigned short saddr, unsigned short raddr,
+unsigned short bit, unsigned short state)
+{
+	int rc;
+	unsigned short check_value;
+	unsigned short check_bit;
+
+	if (state)
+		check_bit = 0x0001 << bit;
+	else
+		check_bit = 0xFFFF & (~(0x0001 << bit));
+	pr_debug("mt9v113_i2c_write_bit check_bit:0x%4x", check_bit);
+	rc = mt9v113_i2c_read_w(saddr, raddr, &check_value);
+	if (rc < 0)
+	  return rc;
+
+	pr_debug("%s: mt9v113: 0x%4x reg value = 0x%4x\n", __func__,
+		raddr, check_value);
+	if (state)
+		check_value = (check_value | check_bit);
+	else
+		check_value = (check_value & check_bit);
+
+	pr_debug("%s: mt9v113: Set to 0x%4x reg value = 0x%4x\n", __func__,
+		raddr, check_value);
+
+	rc = mt9v113_i2c_write(saddr, raddr, check_value,
+		WORD_LEN);
+	return rc;
+}
+
+static int mt9v113_i2c_check_bit(unsigned short saddr, unsigned short raddr,
+unsigned short bit, int check_state)
+{
+	int k;
+	unsigned short check_value;
+	unsigned short check_bit;
+	check_bit = 0x0001 << bit;
+	for (k = 0; k < CHECK_STATE_TIME; k++) {
+		mt9v113_i2c_read_w(mt9v113_client->addr,
+			      raddr, &check_value);
+		if (check_state) {
+			if ((check_value & check_bit))
+			break;
+		} else {
+			if (!(check_value & check_bit))
+			break;
+		}
+		msleep(1);
+	}
+	if (k == CHECK_STATE_TIME) {
+		pr_err("%s failed addr:0x%2x data check_bit:0x%2x",
+			__func__, raddr, check_bit);
+		return -1;
+	}
+	return 1;
+}
+static inline int resume(void)
+{
+	int k = 0, rc = 0;
+	unsigned short check_value;
+
+	
+	
+	rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0016, &check_value);
+	if (rc < 0)
+	  return rc;
+
+	pr_info("%s: mt9v113: 0x0016 reg value = 0x%x\n", __func__,
+		check_value);
+
+	check_value = (check_value|0x0020);
+
+	pr_info("%s: mt9v113: Set to 0x0016 reg value = 0x%x\n", __func__,
+		check_value);
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0016, check_value,
+		WORD_LEN);
+	if (rc < 0) {
+		pr_err("%s: Enter Active mode fail\n", __func__);
+		return rc;
+	}
+
+	
+	pr_info("resume, check_value=0x%x", check_value);
+	rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0018, &check_value);
+	if (rc < 0)
+	  return rc;
+
+	pr_info("%s: mt9v113: 0x0018 reg value = 0x%x\n", __func__,
+		check_value);
+
+	check_value = (check_value & 0xFFFE);
+
+	pr_info("%s: mt9v113: Set to 0x0018 reg value = 0x%x\n", __func__,
+		check_value);
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0018, check_value,
+		WORD_LEN);
+	if (rc < 0) {
+		pr_err("%s: Enter Active mode fail\n", __func__);
+		return rc;
+	}
+
+	
+	for (k = 0; k < CHECK_STATE_TIME; k++) {
+		mt9v113_i2c_read_w(mt9v113_client->addr,
+			  0x0018, &check_value);
+
+		pr_info("%s: mt9v113: 0x0018 reg value = 0x%x\n", __func__,
+			check_value);
+
+		if (!(check_value & 0x4000)) {
+			pr_info("%s: (check 0x0018[14] is 0) k=%d\n",
+				__func__, k);
+			break;
+		}
+		msleep(1);	
+	}
+	if (k == CHECK_STATE_TIME) {
+		pr_err("%s: check status time out (check 0x0018[14] is 0)\n",
+			__func__);
+		return -EIO;
+	}
+
+	
+	for (k = 0; k < CHECK_STATE_TIME; k++) {
+		mt9v113_i2c_read_w(mt9v113_client->addr,
+			  0x301A, &check_value);
+		if (check_value & 0x0004) {
+			pr_info("%s: (check 0x301A[2] is 1) k=%d\n",
+				__func__, k);
+			break;
+		}
+		msleep(1);	
+	}
+	if (k == CHECK_STATE_TIME) {
+		pr_err("%s: check status time out (check 0x301A[2] is 1)\n",
+			__func__);
+		return -EIO;
+	}
+
+	
+	for (k = 0; k < CHECK_STATE_TIME; k++) {
+		rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x31E0,
+			&check_value);
+		if (check_value == 0x0003) { 
+			pr_info("%s: (check 0x31E0 is 0x003 ) k=%d\n",
+				__func__, k);
+			break;
+		}
+		msleep(1);	
+	}
+	if (k == CHECK_STATE_TIME) {
+		pr_err("%s: check status time out (check 0x31E0 is 0x003 )\n",
+			__func__);
+		return -EIO;
+	}
+
+	
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x31E0, 0x0001,
+	WORD_LEN);
+	if (rc < 0) {
+		pr_err("%s: Enter Active mode fail\n", __func__);
+		return rc;
+	}
+
+    msleep(2);
+
+	return rc;
+}
+
+static inline int suspend(void)
+{
+	int k = 0, rc = 0;
+	unsigned short check_value;
+
+	
+	
+	rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0018, &check_value);
+	if (rc < 0)
+	  return rc;
+
+	check_value = (check_value|0x0008);
+
+	pr_info("suspend, check_value=0x%x", check_value);
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0018, check_value,
+		WORD_LEN);
+	if (rc < 0) {
+		pr_err("%s: Enter standy mode fail\n", __func__);
+		return rc;
+	}
+	
+	rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0018, &check_value);
+	if (rc < 0)
+	  return rc;
+
+	check_value = (check_value|0x0001);
+
+	pr_info("%s: mt9v113: Set to 0x0018 reg value = 0x%x\n", __func__,
+		check_value);
+
+	pr_info("suspend, 2,check_value=0x%x", check_value);
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0018, check_value,
+		WORD_LEN);
+	if (rc < 0) {
+		pr_err("%s: Enter standy mode fail\n", __func__);
+		return rc;
+	}
+
+	
+	for (k = 0; k < CHECK_STATE_TIME; k++) {
+		mt9v113_i2c_read_w(mt9v113_client->addr,
+			  0x0018, &check_value);
+		if ((check_value & 0x4000)) { 
+			pr_info("%s: ( check 0x0018[14] is 1 ) k=%d\n",
+				__func__, k);
+			break;
+		}
+		msleep(1);	
+	}
+	if (k == CHECK_STATE_TIME) {
+		pr_err("%s: check status time out\n", __func__);
+		return -EIO;
+	}
+    msleep(2);
+	return rc;
+}
+
+static int mt9v113_reg_init(void)
+{
+	int rc = 0, k = 0;
+	unsigned short check_value;
+
+    
+	pr_info("%s: Power Up Start\n", __func__);
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr,
+					0x0018, 0x4028, WORD_LEN);
+	if (rc < 0)
+		goto reg_init_fail;
+
+	rc = mt9v113_i2c_check_bit(mt9v113_client->addr, 0x0018, 14, 0);
+	if (rc < 0)
+		goto reg_init_fail;
+
+	
+	rc = mt9v113_i2c_check_bit(mt9v113_client->addr, 0x301A, 2, 1);
+	if (rc < 0)
+		goto reg_init_fail;
+
+	rc = mt9v113_i2c_write_table(&mt9v113_regs.power_up_tbl[0],
+				     mt9v113_regs.power_up_tbl_size);
+	if (rc < 0) {
+		pr_err("%s: Power Up fail\n", __func__);
+		goto reg_init_fail;
+	}
+
+	
+	pr_info("%s: RESET and MISC Control\n", __func__);
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr,
+					0x0018, 0x4028, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	rc = mt9v113_i2c_check_bit(mt9v113_client->addr, 0x0018, 14, 0);
+	if (rc < 0)
+		goto reg_init_fail;
+
+	
+	rc = mt9v113_i2c_check_bit(mt9v113_client->addr, 0x301A, 2, 1);
+	if (rc < 0)
+		goto reg_init_fail;
+
+	
+	rc = mt9v113_i2c_write_bit(mt9v113_client->addr, 0x31E0, 1, 0);
+	if (rc < 0)
+		goto reg_init_fail;
+
+	if (g_csi_if) {
+	    
+	    rc = mt9v113_i2c_write_bit(mt9v113_client->addr, 0x001A, 9, 0);
+	    if (rc < 0)
+	      goto reg_init_fail;
+
+	    
+	    
+	    
+	    
+
+	    rc = mt9v113_i2c_write_bit(mt9v113_client->addr, 0x3400, 4, 1);
+	    if (rc < 0)
+	      goto reg_init_fail;
+
+		
+		for (k = 0; k < CHECK_STATE_TIME; k++) {
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x3400,
+				&check_value);
+			pr_info("%s: mt9v113: 0x3400 reg value = 0x%4x\n", __func__, check_value);
+			if (check_value & 0x0010) { 
+				pr_info("%s: (check 0x3400[4] is 1 ) k=%d\n",
+				__func__, k);
+			break;
+		} else {
+			check_value = (check_value | 0x0010);
+			pr_info("%s: mt9v113: Set to 0x3400 reg value = 0x%4x\n", __func__, check_value);
+				rc = mt9v113_i2c_write(mt9v113_client->addr, 0x3400,
+				check_value, WORD_LEN);
+			if (rc < 0)
+				goto reg_init_fail;
+		}
+			msleep(1);	
+		}
+		if (k == CHECK_STATE_TIME) {
+			pr_err("%s: check status time out (check 0x3400[4] is 1 )\n",
+				__func__);
+			goto reg_init_fail;
+		}
+
+		mdelay(10);
+	    
+	    rc = mt9v113_i2c_write_bit(mt9v113_client->addr, 0x3400, 9, 1);
+	    if (rc < 0)
+	      goto reg_init_fail;
+
+		
+		for (k = 0; k < CHECK_STATE_TIME; k++) {
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x3400,
+				&check_value);
+			pr_info("%s: mt9v113: 0x3400 reg value = 0x%4x\n", __func__, check_value);
+			if (check_value & 0x0200) { 
+				pr_info("%s: (check 0x3400[9] is 1 ) k=%d\n",
+					__func__, k);
+				break;
+			} else {
+				check_value = (check_value | 0x0200);
+				pr_info("%s: mt9v113: Set to 0x3400 reg value = 0x%4x\n", __func__, check_value);
+				rc = mt9v113_i2c_write(mt9v113_client->addr, 0x3400,
+					check_value, WORD_LEN);
+				if (rc < 0)
+					goto reg_init_fail;
+			}
+			msleep(1);	
+		}
+		if (k == CHECK_STATE_TIME) {
+			pr_err("%s: check status time out (check 0x3400[9] is 1 )\n",
+				__func__);
+			goto reg_init_fail;
+		}
+
+	    
+	    rc = mt9v113_i2c_write_bit(mt9v113_client->addr, 0x321C, 7, 0);
+	    if (rc < 0)
+	      goto reg_init_fail;
+	} else {
+	    rc = mt9v113_i2c_write(mt9v113_client->addr, 0x001A, 0x0210, WORD_LEN);
+	    if (rc < 0)
+	      goto reg_init_fail;
+	}
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x001E, 0x0777, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0016, 0x42DF, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+
+	
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0014, 0xB04B, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0014, 0xB049, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0010, 0x021C, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0012, 0x0000, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0014, 0x244B, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	msleep(30);
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0014, 0x304B, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	rc = mt9v113_i2c_check_bit(mt9v113_client->addr, 0x0014, 15, 1);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0014, 0xB04A, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	
+	rc = mt9v113_i2c_write_table(&mt9v113_regs.register_init_1[0],
+			mt9v113_regs.register_init_size_1);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	
+	rc = mt9v113_i2c_write_bit(mt9v113_client->addr, 0x3210, 3, 1);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	
+	rc = mt9v113_i2c_write_table(&mt9v113_regs.register_init_2[0],
+			mt9v113_regs.register_init_size_2);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0006, WORD_LEN);
+	for (k = 0; k < CHECK_STATE_TIME; k++) {  
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103,
+			WORD_LEN);
+		rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+			&check_value);
+		if (check_value == 0x0000) 
+			break;
+		msleep(1);
+	}
+	if (k == CHECK_STATE_TIME)
+		goto reg_init_fail;
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	for (k = 0; k < CHECK_STATE_TIME; k++) {  
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103,
+			WORD_LEN);
+		rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+			&check_value);
+		if (check_value == 0x0000) 
+			break;
+		msleep(1);
+	}
+	if (k == CHECK_STATE_TIME)
+		goto reg_init_fail;
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA102, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x000F, WORD_LEN);
+	if (rc < 0)
+	  goto reg_init_fail;
+
+	return rc;
+reg_init_fail:
+	pr_err("mt9v113 register initial fail\n");
+	return rc;
+}
+
+#if 0
+int mt9v113_set_flip_mirror(struct msm_camera_sensor_info *info)
+{
+	int rc = 0;
+	if (info != NULL) {
+		if (info->mirror_mode) {
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2717, WORD_LEN);
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0025, WORD_LEN);
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x272D, WORD_LEN);
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0025, WORD_LEN);
+		} else {
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2717, WORD_LEN);
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0026, WORD_LEN);
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x272D, WORD_LEN);
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0026, WORD_LEN);
+		}
+		if (rc < 0)
+			goto set_flip_mirror_fail;
+	} else {
+		pr_err("camera sensor info is NULL");
+		rc = -1;
+		goto set_flip_mirror_fail;
+	}
+
+	return rc;
+set_flip_mirror_fail:
+	pr_err("mt9v113 setting flip mirror fail\n");
+	return rc;
+}
+#endif
+
+static int pre_mirror_mode;
+static int mt9v113_set_front_camera_mode(enum frontcam_t frontcam_value)
+{
+	int rc = 0;
+	int k = 0;
+	unsigned short check_value;
+
+	if (op_mode == SENSOR_SNAPSHOT_MODE)
+		return 0;
+
+	pr_info("%s: frontcam_value=%d\n", __func__, frontcam_value);
+
+	switch (frontcam_value) {
+	case CAMERA_MIRROR:
+		
+	if (mt9v113_s_ctrl.sensordata->mirror_mode) {
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2717, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0024, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x272D, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0024, WORD_LEN);
+	} else {
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2717, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0027, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x272D, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0027, WORD_LEN);
+	}
+
+	if (rc < 0)
+		return -EIO;
+
+		break;
+	case CAMERA_REVERSE:
+		
+	if (mt9v113_s_ctrl.sensordata->mirror_mode) {
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2717, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0025, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x272D, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0025, WORD_LEN);
+	} else {
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2717, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0026, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x272D, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0026, WORD_LEN);
+	}
+
+	if (rc < 0)
+		return -EIO;
+
+		break;
+
+	case CAMERA_PORTRAIT_REVERSE:
+	
+	if (mt9v113_s_ctrl.sensordata->mirror_mode) {
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2717, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0026, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x272D, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0026, WORD_LEN);
+	} else {
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2717, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0025, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x272D, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0025, WORD_LEN);
+	}
+
+	if (rc < 0)
+		return -EIO;
+
+		break;
+	default:
+		break;
+	}
+
+	
+	if (pre_mirror_mode != frontcam_value) {
+	pr_info("%s: re-flash\n", __func__);
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0006, WORD_LEN);
+
+	for (k = 0; k < CHECK_STATE_TIME; k++) {  
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+			0xA103, WORD_LEN);
+		rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+			&check_value);
+		if (check_value == 0x0000) 
+			break;
+		msleep(1);
+	}
+	if (k == CHECK_STATE_TIME) 
+		return -EIO;
+
+	}
+	pre_mirror_mode = frontcam_value;
+
+	msleep(20);
+
+#if 0
+	for (k = 0; k < CHECK_STATE_TIME; k++) {  
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+			0xA103, WORD_LEN);
+		rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+			&check_value);
+		if (rc > 0 && check_value == 0x0000) 
+			break;
+
+		msleep(1);
+		pr_info("%s: count =%d\n", __func__, k);
+	}
+	if (k == CHECK_STATE_TIME) 
+		return -EIO;
+#endif
+
+	return 0;
+}
+
+static int mt9v113_set_sensor_mode(struct msm_sensor_ctrl_t *s_ctrl, int mode)
+{
+	int rc = 0 , k;
+	uint16_t check_value = 0;
+
+	pr_info("%s: E\n", __func__);
+	pr_info("sinfo->csi_if = %d, mode = %d", g_csi_if, mode);
+
+	if (config_csi == 0) {
+		if (g_csi_if) {
+			s_ctrl->curr_frame_length_lines =
+				s_ctrl->msm_sensor_reg->output_settings[mode].frame_length_lines;
+
+			s_ctrl->curr_line_length_pclk =
+				s_ctrl->msm_sensor_reg->output_settings[mode].line_length_pclk;
+
+			
+			pr_info("set csi config\n");
+			v4l2_subdev_notify(&(mt9v113_s_ctrl.sensor_v4l2_subdev),
+				NOTIFY_ISPIF_STREAM, (void *)ISPIF_STREAM(
+				PIX_0, ISPIF_OFF_IMMEDIATELY));
+
+			rc = suspend();  
+
+			if (rc < 0)
+				pr_err("%s: suspend fail\n", __func__);
+
+			pr_info("subdev name: %s", mt9v113_s_ctrl.sensor_v4l2_subdev.name);
+
+			mt9v113_s_ctrl.curr_csi_params = mt9v113_s_ctrl.csi_params[mode];
+			v4l2_subdev_notify(&(mt9v113_s_ctrl.sensor_v4l2_subdev),
+					NOTIFY_CSID_CFG, &mt9v113_s_ctrl.curr_csi_params->csid_params);
+
+			v4l2_subdev_notify(&(mt9v113_s_ctrl.sensor_v4l2_subdev),
+					NOTIFY_CID_CHANGE, NULL);
+			dsb();
+
+			v4l2_subdev_notify(&(mt9v113_s_ctrl.sensor_v4l2_subdev),
+					NOTIFY_CSIPHY_CFG, &mt9v113_s_ctrl.curr_csi_params->csiphy_params);
+
+			dsb();
+			config_csi = 1;
+
+			msleep(20);
+			v4l2_subdev_notify(&(mt9v113_s_ctrl.sensor_v4l2_subdev),
+				NOTIFY_PCLK_CHANGE, &mt9v113_dimensions[mode].op_pixel_clk);
+
+			v4l2_subdev_notify(&(mt9v113_s_ctrl.sensor_v4l2_subdev),
+				NOTIFY_ISPIF_STREAM, (void *)ISPIF_STREAM(
+				PIX_0, ISPIF_ON_FRAME_BOUNDARY));
+
+			rc = resume();
+
+			if (rc < 0)
+				pr_err("%s: resume fail\n", __func__);
+		}
+	}
+
+#if 0 
+			while (1) {
+				msm_io_read_interrupt();
+				msleep(200);
+			}
+#endif
+
+	switch (mode) {
+	case SENSOR_PREVIEW_MODE:
+		op_mode = SENSOR_PREVIEW_MODE;
+		pr_info("mt9v113:sensor set mode: preview\n");
+
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103,
+			WORD_LEN);
+		if (rc < 0)
+			return rc;
+
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0002,
+		WORD_LEN);
+		if (rc < 0)
+			return rc;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA104,	WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			pr_info("check_value=%d", check_value);
+			if (check_value == 0x0003) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) {
+			pr_err("%s: Preview fail\n", __func__);
+			return -EIO;
+		}
+
+		
+		msleep(150);
+
+		break;
+	case SENSOR_SNAPSHOT_MODE:
+		op_mode = SENSOR_SNAPSHOT_MODE;
+		
+		pr_info("mt9v113:sensor set mode: snapshot\n");
+
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103,
+			WORD_LEN);
+		if (rc < 0)
+			return rc;
+
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0001,
+		WORD_LEN);
+		if (rc < 0)
+			return rc;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA104, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0003)
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) {
+			pr_err("%s: Snapshot fail\n", __func__);
+			return -EIO;
+		}
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	pr_info("%s: X\n", __func__);
+	return rc;
+}
+
+
+static int mt9v113_set_antibanding(enum antibanding_mode antibanding_value)
+{
+	int rc = 0;
+	unsigned short check_value = 0;
+	int iRetryCnt = 20;
+	pr_info("%s: antibanding_value =%d\n", __func__, antibanding_value);
+
+	if (op_mode == SENSOR_SNAPSHOT_MODE)
+		return 0;
+	switch (antibanding_value) {
+	case CAMERA_ANTI_BANDING_50HZ:
+	while ((check_value != 0xE0) && (iRetryCnt-- > 0)) {
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA404, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x00C0, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		msleep(5);
+
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA404, WORD_LEN);
+		rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990, &check_value);
+	}
+
+	if (check_value != 0xE0)
+		pr_info("%s: check_value: 0x%X, retry failed!\n", __func__, check_value);
+		break;
+	case CAMERA_ANTI_BANDING_60HZ:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA404, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0080, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	case CAMERA_ANTI_BANDING_AUTO: 
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA404, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0080, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	default:
+		pr_info("%s: Not support antibanding value = %d\n",
+		   __func__, antibanding_value);
+		return -EINVAL;
+	}
+	return 0;
+
+}
+
+static int mt9v113_set_sharpness(enum sharpness_mode sharpness_value)
+{
+	int rc = 0;
+
+	pr_info("%s: sharpness_value = %d\n", __func__, sharpness_value);
+	if (op_mode == SENSOR_SNAPSHOT_MODE)
+		return 0;
+
+	switch (sharpness_value) {
+	case CAMERA_SHARPNESS_X0:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB22, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0000, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x326C, 0x0400, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	case CAMERA_SHARPNESS_X1:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB22, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0001, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x326C, 0x0600, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	case CAMERA_SHARPNESS_X2:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB22, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x326C, 0x0B00, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	case CAMERA_SHARPNESS_X3:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB22, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0006, WORD_LEN); 
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x326C, 0x0B00, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	case CAMERA_SHARPNESS_X4:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB22, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0007, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x326C, 0x0FF0, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	default:
+		pr_info("%s: Not support sharpness value = %d\n",
+		   __func__, sharpness_value);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+
+static int mt9v113_set_saturation(enum saturation_mode saturation_value)
+{
+	int rc = 0;
+
+	pr_info("%s: saturation_value = %d\n", __func__, saturation_value);
+	if (op_mode == SENSOR_SNAPSHOT_MODE)
+		return 0;
+	switch (saturation_value) {
+	case CAMERA_SATURATION_X0:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB20, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0010, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB24, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0009, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	case CAMERA_SATURATION_X05:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB20, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0035, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB24, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0025, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	case CAMERA_SATURATION_X1:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB20, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0048, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB24, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0033, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	case CAMERA_SATURATION_X15:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB20, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0063, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB24, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0045, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	case CAMERA_SATURATION_X2:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB20, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0076, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB24, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0053, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+		break;
+	default:
+		pr_info("%s: Not support saturation value = %d\n",
+		   __func__, saturation_value);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static int mt9v113_set_contrast(enum contrast_mode contrast_value)
+{
+	int rc = 0;
+
+	pr_info("%s: contrast_value = %d\n", __func__, contrast_value);
+	if (op_mode == SENSOR_SNAPSHOT_MODE)
+		return 0;
+
+	switch (contrast_value) {
+	case CAMERA_CONTRAST_N2:
+		rc = mt9v113_i2c_write_table(&mt9v113_regs.contract_tb0[0],
+			mt9v113_regs.contract_tb0_size);
+		if (rc < 0) {
+			pr_err("%s: contract_tb0 fail\n", __func__);
+			return -EIO;
+		}
+
+		break;
+	case CAMERA_CONTRAST_N1:
+		rc = mt9v113_i2c_write_table(&mt9v113_regs.contract_tb1[0],
+			mt9v113_regs.contract_tb1_size);
+		if (rc < 0) {
+			pr_err("%s: contract_tb1 fail\n", __func__);
+			return -EIO;
+		}
+
+		break;
+	case CAMERA_CONTRAST_D:
+		rc = mt9v113_i2c_write_table(&mt9v113_regs.contract_tb2[0],
+			mt9v113_regs.contract_tb2_size);
+		if (rc < 0) {
+			pr_err("%s: contract_tb2 fail\n", __func__);
+			return -EIO;
+		}
+
+		break;
+	case CAMERA_CONTRAST_P1:
+		rc = mt9v113_i2c_write_table(&mt9v113_regs.contract_tb3[0],
+			mt9v113_regs.contract_tb3_size);
+		if (rc < 0) {
+			pr_err("%s: contract_tb3 fail\n", __func__);
+			return -EIO;
+		}
+
+		break;
+	case CAMERA_CONTRAST_P2:
+		rc = mt9v113_i2c_write_table(&mt9v113_regs.contract_tb4[0],
+			mt9v113_regs.contract_tb4_size);
+		if (rc < 0) {
+			pr_err("%s: contract_tb4 fail\n", __func__);
+			return -EIO;
+		}
+
+		break;
+	default:
+		pr_info("%s: Not support contrast value = %d\n",
+		   __func__, contrast_value);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static int mt9v113_set_effect(int effect)
+{
+	int rc = 0, k = 0;
+	unsigned short check_value;
+
+	if (op_mode == SENSOR_SNAPSHOT_MODE)
+		return 0;
+
+	pr_info("%s: effect = %d\n", __func__, effect);
+
+	switch (effect) {
+	case CAMERA_EFFECT_OFF:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2759, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x6440, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x275B, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x6440, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2763, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0xB023, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		break;
+
+	case CAMERA_EFFECT_MONO:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2759, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x6441, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x275B, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x6441, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2763, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0xB023, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		break;
+
+	case CAMERA_EFFECT_NEGATIVE:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2759, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x6443, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x275B, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x6443, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2763, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0xB023, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		break;
+
+	case CAMERA_EFFECT_SEPIA:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2759, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x6442, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x275B, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x6442, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2763, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0xB023, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		break;
+
+	case CAMERA_EFFECT_AQUA:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2759, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x6442, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x275B, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x6442, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x2763, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x30D0, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		break;
+	default:
+		pr_info("%s: Not support effect = %d\n",
+		   __func__, effect);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int mt9v113_set_brightness(enum brightness_t brightness_value)
+{
+	int rc = 0;
+	if (op_mode == SENSOR_SNAPSHOT_MODE)
+		return 0;
+
+	pr_info("%s: brightness_value = %d\n", __func__, brightness_value);
+
+	switch (brightness_value) {
+	case CAMERA_BRIGHTNESS_N4: 
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA24F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x001F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB1F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x00CA, WORD_LEN);
+			if (rc < 0)
+				return -EIO;
+
+			break;
+
+	case CAMERA_BRIGHTNESS_N3: 
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA24F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0025, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB1F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x00C9, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		break;
+	case CAMERA_BRIGHTNESS_N2:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA24F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0030, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB1F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x00C9, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		break;
+	case CAMERA_BRIGHTNESS_N1:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA24F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0038, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB1F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x00C8, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		break;
+	case CAMERA_BRIGHTNESS_D: 
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA24F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x004A, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB1F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x00C8, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		break;
+	case CAMERA_BRIGHTNESS_P1:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA24F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0051, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB1F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x00C8, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		break;
+	case CAMERA_BRIGHTNESS_P2:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA24F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0059, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB1F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x00C7, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		break;
+	case CAMERA_BRIGHTNESS_P3: 
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA24F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x005F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB1F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x00C7, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		break;
+	case CAMERA_BRIGHTNESS_P4: 
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA24F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0068, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xAB1F, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x00C6, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		break;
+	default:
+		pr_info("%s: Not support brightness value = %d\n",
+			__func__, brightness_value);
+		 return -EINVAL;
+	}
+	return 0;
+}
+
+static int mt9v113_set_wb(enum wb_mode wb_value)
+{
+	int rc = 0, k = 0;
+	unsigned short check_value;
+
+	if (op_mode == SENSOR_SNAPSHOT_MODE)
+		return 0;
+
+	pr_info("%s: wb_value = %d\n", __func__, wb_value);
+	switch (wb_value) {
+	case CAMERA_AWB_AUTO:
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA11F, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0001, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		rc = mt9v113_i2c_write_table(&mt9v113_regs.wb_auto[0],
+			mt9v113_regs.wb_auto_size);
+		if (rc < 0) {
+			pr_err("%s: wb_auto fail\n", __func__);
+			return -EIO;
+		}
+
+		break;
+	case CAMERA_AWB_INDOOR_HOME:
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA115, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0000, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA11F, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0000, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		rc = mt9v113_i2c_write_table(&mt9v113_regs.wb_fluorescent[0],
+			mt9v113_regs.wb_fluorescent_size);
+		if (rc < 0) {
+			pr_err("%s: wb_fluorescent fail\n", __func__);
+			return -EIO;
+		}
+
+		break;
+	case CAMERA_AWB_INDOOR_OFFICE:
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA115, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0000, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA11F, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0000, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		rc = mt9v113_i2c_write_table(&mt9v113_regs.wb_incandescent[0],
+			mt9v113_regs.wb_incandescent_size);
+		if (rc < 0) {
+			pr_err("%s: wb_incandescent fail\n", __func__);
+			return -EIO;
+		}
+
+		break;
+	case CAMERA_AWB_SUNNY:
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA115, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0000, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA11F, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0000, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		rc = mt9v113_i2c_write_table(&mt9v113_regs.wb_daylight[0],
+			mt9v113_regs.wb_daylight_size);
+		if (rc < 0) {
+			pr_err("%s: wb_daylight fail\n", __func__);
+			return -EIO;
+		}
+
+		break;
+	case CAMERA_AWB_CLOUDY: 
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA115, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0000, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA11F, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0000, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+
+			for (k = 0; k < CHECK_STATE_TIME; k++) {  
+				rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+					0xA103, WORD_LEN);
+				rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+					&check_value);
+				if (check_value == 0x0000) 
+					break;
+				msleep(1);
+			}
+			if (k == CHECK_STATE_TIME) 
+				return -EIO;
+
+			rc = mt9v113_i2c_write_table(&mt9v113_regs.wb_cloudy[0],
+				mt9v113_regs.wb_cloudy_size);
+			if (rc < 0) {
+				pr_err("%s: wb_cloudy[ fail\n", __func__);
+				return -EIO;
+			}
+		break;
+	default:
+		pr_info("%s: Not support wb_value = %d\n",
+		   __func__, wb_value);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+#if 0
+static int mt9v113_get_iso(uint16_t *real_iso_value)
+{
+	int rc = 0;
+	unsigned short check_value;
+
+	
+	*real_iso_value = 400;
+
+	rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x3028, &check_value);
+	if (rc < 0)
+		return -EIO;
+
+	*real_iso_value = (check_value * 100) / 8;
+
+	pr_info("%s real_iso_value: %d\n", __func__, *real_iso_value);
+	return rc;
+}
+#endif
+
+static int mt9v113_set_iso(enum iso_mode iso_value)
+{
+	int rc = 0, k = 0;
+	unsigned short check_value;
+	pr_info("%s: iso_value =%d\n", __func__, iso_value);
+
+	switch (iso_value) {
+	case CAMERA_ISO_MODE_AUTO:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA20E, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0080, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		break;
+	case CAMERA_ISO_MODE_100:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA20E, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0026, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		break;
+	case CAMERA_ISO_MODE_200:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA20E, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0046, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		break;
+	case CAMERA_ISO_MODE_400:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA20E, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0078, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		break;
+	case CAMERA_ISO_MODE_800:
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA20E, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x00A0, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		if (rc < 0)
+			return -EIO;
+
+		for (k = 0; k < CHECK_STATE_TIME; k++) {  
+			rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+				0xA103, WORD_LEN);
+			rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+				&check_value);
+			if (check_value == 0x0000) 
+				break;
+			msleep(1);
+		}
+		if (k == CHECK_STATE_TIME) 
+			return -EIO;
+
+		break;
+	default:
+		pr_info("%s: Not support ISO value = %d\n",
+			__func__, iso_value);
+		 return -EINVAL;
+	}
+	return 0;
+}
+
+#if 0
+static int mt9v113_vreg_enable(struct platform_device *pdev)
+{
+	struct msm_camera_sensor_info *sdata = pdev->dev.platform_data;
+	int rc;
+
+	pr_info("%s camera vreg on\n", __func__);
+
+	if (sdata->camera_power_on == NULL) {
+		pr_err("sensor platform_data didnt register\n");
+		return -EIO;
+	}
+	rc = sdata->camera_power_on();
+	return rc;
+}
+
+static int mt9v113_vreg_disable(struct platform_device *pdev)
+{
+	struct msm_camera_sensor_info *sdata = pdev->dev.platform_data;
+	int rc;
+	printk(KERN_INFO "%s camera vreg off\n", __func__);
+	if (sdata->camera_power_off == NULL) {
+		pr_err("sensor platform_data didnt register\n");
+		return -EIO;
+	}
+	rc = sdata->camera_power_off();
+	return rc;
+}
+#endif
+
+static int mt9v113_probe_init_sensor(const struct msm_camera_sensor_info *data)
+{
+	
+	int rc = 0;
+	uint16_t model_id = 0;
+
+	pr_info("mt9v113_probe_init_sensor\n");
+
+#if 0
+	rc = mt9v113_vreg_enable(mt9v113_pdev);
+	if (rc < 0) {
+		pr_err("__mt9v113_probe fail sensor power on error\n");
+		goto probe_init_fail;
+	}
+#endif
+
+	rc = gpio_request(data->sensor_reset, "mt9v113");
+	if (!rc) {
+		gpio_direction_output(data->sensor_reset, 0);
+		msleep(1);
+
+		rc = msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
+		if (rc < 0) {
+			goto probe_init_fail;
+		}
+
+		pr_info("mt9v113: MCLK enable clk\n");
+		msm_camio_clk_rate_set(MSM_SENSOR_MCLK_24HZ);
+
+		msleep(1);
+		rc = gpio_direction_output(data->sensor_reset, 1);
+		if (rc < 0) {
+			goto probe_init_fail_mclk_off;
+		}
+	}	else {
+		pr_info("mt9v113: request GPIO(sensor_reset) :%d failed\n", data->sensor_reset);
+		goto probe_init_fail;
+	}
+	gpio_free(data->sensor_reset);
+
+	msleep(1);
+
+	
+	pr_info("mt9v113_probe_init_sensor,mt9v113_client->addr=0x%x", mt9v113_client->addr >> 1);
+	rc = mt9v113_i2c_read_w(mt9v113_client->addr,
+			      MT9V113_MODEL_ID_ADDR, &model_id);
+	if (rc < 0) {
+		pr_err("%s: I2C read fail\n", __func__);
+		goto probe_init_fail_reset_off;
+	}
+
+	pr_info("%s: mt9v113: model_id = 0x%x\n", __func__, model_id);
+	
+	if (model_id != MT9V113_MODEL_ID) {
+	    pr_err("%s: Sensor is not MT9V113\n", __func__);
+		rc = -EINVAL;
+		goto probe_init_fail_reset_off;
+	}
+
+	goto init_probe_done;
+
+probe_init_fail_reset_off:
+	gpio_request(data->sensor_reset, "mt9v113");
+	gpio_direction_output(data->sensor_reset, 0);
+	gpio_free(data->sensor_reset);
+probe_init_fail_mclk_off:
+#if 0
+probe_init_fail_vreg_off:
+	mt9v113_vreg_disable(mt9v113_pdev);
+#endif
+probe_init_fail:
+	pr_err("mt9v113_probe_init_sensor fails\n");
+	return rc;
+init_probe_done:
+	pr_info("mt9v113_probe_init_sensor finishes\n");
+	return rc;
+}
+
+
+
+static int suspend_fail_retry_count_2;
+#define SUSPEND_FAIL_RETRY_MAX_2 3
+int mt9v113_sensor_open_init(const struct msm_camera_sensor_info *data)
+{
+	int rc = 0;
+	uint16_t check_value = 0;
+
+	pr_info("%s\n", __func__);
+
+	if (data == NULL) {
+		pr_err("%s sensor data is NULL\n", __func__);
+		return -EINVAL;
+	}
+
+	g_csi_if = data->csi_if;
+	suspend_fail_retry_count_2 = SUSPEND_FAIL_RETRY_MAX_2;
+
+	if (!data->power_down_disable) {
+
+probe_suspend_fail_retry_2:
+		pr_info("%s suspend_fail_retry_count_2=%d\n", __func__, suspend_fail_retry_count_2);
+
+		mdelay(5);
+	}
+
+	mdelay(2);
+
+	
+	rc = mt9v113_probe_init_sensor(data);
+	if (rc < 0) {
+		pr_info("mt9v113_probe_init_sensor failed!\n");
+		goto prob_init_sensor_fail;
+	}
+
+	if (!data->power_down_disable) {
+		
+		rc = mt9v113_reg_init();
+		if (rc < 0) {
+			pr_err("%s: mt9v113_reg_init fail\n", __func__);
+
+			if (suspend_fail_retry_count_2 > 0) {
+				suspend_fail_retry_count_2--;
+				pr_info("%s: mt9v113 reg_init fail start retry mechanism !!!\n", __func__);
+				goto probe_suspend_fail_retry_2;
+			}
+
+			goto init_fail;
+		}
+
+		
+		
+		rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0016, &check_value);
+		if (rc < 0)
+		  return rc;
+
+		pr_info("%s: mt9v113: 0x0016 reg value = 0x%x\n",
+			__func__, check_value);
+
+		check_value = (check_value&0xFFDF);
+
+		pr_info("%s: mt9v113: Set to 0x0016 reg value = 0x%x\n",
+			__func__, check_value);
+
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0016,
+			check_value, WORD_LEN);
+		if (rc < 0) {
+			pr_err("%s: Enter Standby mode fail\n", __func__);
+			return rc;
+		}
+	}
+	 
+
+	if (!data->csi_if) {
+		
+		rc = resume();
+		if (rc < 0) {
+			pr_err("%s: Enter Active mode fail\n", __func__);
+			goto init_fail;
+		}
+	}
+
+	config_csi = 0;
+	goto init_done;
+
+init_fail:
+	pr_info("%s init_fail\n", __func__);
+	
+	
+	return rc;
+prob_init_sensor_fail:
+	pr_info("%s init_fail\n", __func__);
+	
+	return rc;
+init_done:
+	pr_info("%s init_done\n", __func__);
+	return rc;
+
+}
+
+static int mt9v113_init_client(struct i2c_client *client)
+{
+	
+	init_waitqueue_head(&mt9v113_wait_queue);
+	return 0;
+}
+
+static int mt9v113_detect_sensor_status(void)
+{
+	int rc = 0, k = 0;
+	unsigned short check_value;
+
+	for (k = 0; k < CHECK_STATE_TIME; k++) {	
+		rc = mt9v113_i2c_write(mt9v113_client->addr, 0x098C,
+			0xA103, WORD_LEN);
+		rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0990,
+			&check_value);
+		if (check_value == 0x0000) 
+			break;
+
+		msleep(1);
+	}
+
+	if (k == CHECK_STATE_TIME) 
+		pr_info("mt9v113_detect_sensor_status,time out");
+
+	return 0;
+}
+
+static int mt9v113_set_FPS(struct fps_cfg *fps)
+{
+	static struct fps_cfg pre_fps_cfg = {
+		.fps_div = -1,
+	};
+
+	if (pre_fps_cfg.fps_div == fps->fps_div)
+		return 0;
+	else
+		pre_fps_cfg.fps_div = fps->fps_div;
+
+	pr_info("mt9v113_set_FPS, fps->fps_div=%d", fps->fps_div);
+
+	if (fps->fps_div == 10) {
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x271F, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x067E, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0006, WORD_LEN);
+		mdelay(1);
+
+		mt9v113_detect_sensor_status();
+
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA20C, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x000C, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		mdelay(1);
+
+		mt9v113_detect_sensor_status();
+	} else if (fps->fps_div == 15) {
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x271F, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0454, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0006, WORD_LEN);
+		mdelay(1);
+
+		mt9v113_detect_sensor_status();
+
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA20C, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0004, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		mdelay(1);
+
+		mt9v113_detect_sensor_status();
+	} else if (fps->fps_div == 1015) {
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x271F, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0454, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0006, WORD_LEN);
+		mdelay(1);
+
+		mt9v113_detect_sensor_status();
+
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA20C, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x000C, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		mdelay(1);
+
+		mt9v113_detect_sensor_status();
+	} else if (fps->fps_div == 0) {
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0x271F, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x022A, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0006, WORD_LEN);
+		mdelay(1);
+
+		mt9v113_detect_sensor_status();
+
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA20C, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x000C, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA215, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0008, WORD_LEN);
+
+		mt9v113_i2c_write(mt9v113_client->addr, 0x098C, 0xA103, WORD_LEN);
+		mt9v113_i2c_write(mt9v113_client->addr, 0x0990, 0x0005, WORD_LEN);
+		mdelay(1);
+
+		mt9v113_detect_sensor_status();
+	}
+
+	return 0;
+}
+
+static int32_t mt9v113_get_output_info(
+	struct sensor_output_info_t *sensor_output_info)
+{
+	int rc = 0;
+	sensor_output_info->num_info = 4;
+	if (copy_to_user((void *)sensor_output_info->output_info,
+		mt9v113_dimensions,
+		sizeof(struct msm_sensor_output_info_t) * 4))
+		rc = -EFAULT;
+
+	return rc;
+}
+
+int32_t mt9v113_sensor_config(struct msm_sensor_ctrl_t *s_ctrl, void __user *argp)
+{
+	struct sensor_cfg_data cfg_data;
+	long rc = 0;
+	if (copy_from_user(&cfg_data,
+			   (void *)argp, sizeof(struct sensor_cfg_data)))
+		return -EFAULT;
+
+	pr_info("mt9v113_ioctl, cfgtype = %d\n", cfg_data.cfgtype);
+
+	switch (cfg_data.cfgtype) {
+	case CFG_GET_OUTPUT_INFO:
+		rc = mt9v113_get_output_info(&cfg_data.cfg.output_info);
+		break;
+	case CFG_SET_MODE:
+		rc = mt9v113_set_sensor_mode(s_ctrl, cfg_data.mode);
+		break;
+	case CFG_SET_EFFECT:
+		rc = mt9v113_set_effect(cfg_data.cfg.effect);
+		break;
+	case CFG_SET_ANTIBANDING:
+		rc = mt9v113_set_antibanding(cfg_data.cfg.antibanding_value);
+		break;
+	case CFG_SET_BRIGHTNESS:
+		rc = mt9v113_set_brightness(cfg_data.cfg.brightness_value);
+		break;
+	case CFG_SET_WB:
+		rc = mt9v113_set_wb(cfg_data.cfg.wb_value);
+		break;
+	case CFG_SET_SHARPNESS:
+		rc = mt9v113_set_sharpness(cfg_data.cfg.sharpness_value);
+		break;
+	case CFG_SET_SATURATION:
+		rc = mt9v113_set_saturation(cfg_data.cfg.saturation_value);
+		break;
+	case CFG_SET_CONTRAST:
+		rc = mt9v113_set_contrast(cfg_data.cfg.contrast_value);
+		break;
+	case CFG_SET_FRONT_CAMERA_MODE: 
+		rc = mt9v113_set_front_camera_mode(cfg_data.cfg.frontcam_value);
+		break;
+	case CFG_GET_ISO:
+#if 0
+		rc = mt9v113_get_iso(&cfg_data.cfg.real_iso_value);
+		if (copy_to_user((void *)argp,
+			&cfg_data, sizeof(struct sensor_cfg_data))) {
+			pr_err("%s copy to user error", __func__);
+		}
+#endif
+		break;
+	case CFG_SET_ISO:
+		rc = mt9v113_set_iso(cfg_data.cfg.iso_value);
+		break;
+	case CFG_SET_FPS:
+		rc = mt9v113_set_FPS(&(cfg_data.cfg.fps));
+		break;
+	case CFG_SENSOR_INIT:
+		break;
+	default:
+		rc = -EINVAL;
+		break;
+	}
+
+	return rc;
+}
+
+#if 0
+int mt9v113_sensor_release(void)
+{
+	int rc = 0;
+	uint16_t check_value = 0;
+	struct msm_camera_sensor_info *sdata = mt9v113_pdev->dev.platform_data;
+
+	
+	pr_info("%s: enter SW standby mode\n", __func__);
+	
+
+	
+	
+	rc = mt9v113_i2c_read_w(mt9v113_client->addr, 0x0016, &check_value);
+	if (rc < 0) {
+	  pr_err("%s: read streaming off status fail\n", __func__);
+	  goto sensor_release;
+	}
+
+	pr_info("%s: mt9v113: 0x0016 reg value = 0x%x\n",
+		__func__, check_value);
+
+	check_value = (check_value&0xFFDF);
+
+	pr_info("%s: mt9v113: Set to 0x0016 reg value = 0x%x\n",
+		__func__, check_value);
+
+	rc = mt9v113_i2c_write(mt9v113_client->addr, 0x0016,
+		check_value, WORD_LEN);
+	if (rc < 0) {
+		pr_err("%s: Enter Standby mode fail\n", __func__);
+		goto sensor_release;
+	}
+
+	mdelay(2);
+
+	if (!sdata->power_down_disable) {
+		rc = gpio_request(sdata->sensor_reset, "mt9v113");
+		if (!rc) {
+			rc = gpio_direction_output(sdata->sensor_reset, 0);
+			mdelay(2);
+		} else
+			pr_err("GPIO(%d) request faile", sdata->sensor_reset);
+		gpio_free(sdata->sensor_reset);
+	}
+
+	msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
+
+	mdelay(2);
+
+	
+	if (sdata->camera_clk_switch != NULL && sdata->cam_select_pin) {
+		pr_info("%s: doing clk switch to Main CAM)\n", __func__);
+		rc = gpio_request(sdata->cam_select_pin, "mt9v113");
+		if (rc < 0)
+			pr_err("GPIO (%d) request fail\n", sdata->cam_select_pin);
+		else
+			gpio_direction_output(sdata->cam_select_pin, 0);
+		gpio_free(sdata->cam_select_pin);
+	}
+
+	mdelay(2);
+
+	if (!sdata->power_down_disable)
+		mt9v113_vreg_disable(mt9v113_pdev);
+
+sensor_release:
+	return rc;
+}
+#endif
+
+void mt9v113_stop_stream(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	return;
+}
+
+
+int32_t mt9v113_power_up(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int rc;
+	struct msm_camera_sensor_info *sdata = NULL;
+
+	pr_info("%s\n", __func__);
+	if (s_ctrl && s_ctrl->sensordata)
+		sdata = s_ctrl->sensordata;
+	else {
+		pr_err("%s: s_ctrl sensordata NULL\n", __func__);
+		return (-1);
+	}
+
+	if (sdata->camera_power_on == NULL) {
+		pr_err("sensor platform_data didn't register\n");
+		return -EIO;
+	}
+
+	rc = sdata->camera_power_on();
+	if (rc < 0) {
+		pr_err("%s failed to enable power\n", __func__);
+		goto enable_power_on_failed;
+	}
+
+	rc = mt9v113_sensor_open_init(sdata);
+	if (rc < 0) {
+		goto enable_sensor_power_up_failed;		
+	}
+	pr_info("%s end\n", __func__);
+
+	return rc;
+
+enable_sensor_power_up_failed:
+enable_power_on_failed:
+	return rc;
+}
+
+int32_t mt9v113_power_down(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int rc;
+	struct msm_camera_sensor_info *sdata = NULL;
+	pr_info("%s\n", __func__);
+
+	if (s_ctrl && s_ctrl->sensordata)
+		sdata = s_ctrl->sensordata;
+	else {
+		pr_err("%s: s_ctrl sensordata NULL\n", __func__);
+		return (-1);
+	}
+
+	if (sdata->camera_power_off == NULL) {
+		pr_err("sensor platform_data didn't register\n");
+		return -EIO;
+	}
+
+
+	rc = sdata->camera_power_off();
+	if (rc < 0)
+		pr_err("%s failed to disable power\n", __func__);
+
+	if (!sdata->use_rawchip) {
+		pr_info("%s MCLK disable clk\n", __func__);
+		msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
+		if (rc < 0)
+			pr_err("%s: msm_camio_sensor_clk_off failed:%d\n",
+				 __func__, rc);
+	}
+
+	return rc;
+}
+
+static const char *mt9v113Vendor = "Micron";
+static const char *mt9v113NAME = "mt9v113";
+static const char *mt9v113Size = "VGA CMOS";
+
+static ssize_t sensor_vendor_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+
+	sprintf(buf, "%s %s %s\n", mt9v113Vendor, mt9v113NAME, mt9v113Size);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+
+static DEVICE_ATTR(sensor, 0444, sensor_vendor_show, NULL);
+
+static struct kobject *android_mt9v113;
+
+static int mt9v113_sysfs_init(void)
+{
+	int ret ;
+	pr_info("mt9v113:kobject creat and add\n");
+	android_mt9v113 = kobject_create_and_add("android_camera2", NULL);
+	if (android_mt9v113 == NULL) {
+		pr_info("mt9v113_sysfs_init: subsystem_register " \
+		"failed\n");
+		ret = -ENOMEM;
+		return ret ;
+	}
+	pr_info("mt9v113:sysfs_create_file\n");
+	ret = sysfs_create_file(android_mt9v113, &dev_attr_sensor.attr);
+	if (ret) {
+		pr_info("mt9v113_sysfs_init: sysfs_create_file " \
+		"failed\n");
+		kobject_del(android_mt9v113);
+	}
+
+	return 0 ;
+}
+
+#define SUSPEND_FAIL_RETRY_MAX 3
+
+#if 0
+static int mt9v113_sensor_probe_cb(const struct msm_camera_sensor_info *info,
+	struct v4l2_subdev *sdev, struct msm_sensor_ctrl *s)
+{
+	int rc = 0;
+
+	mt9v113_ctrl = kzalloc(sizeof(struct mt9v113_ctrl_t), GFP_KERNEL);
+	if (!mt9v113_ctrl) {
+		pr_err("mt9v113_sensor_probe failed!\n");
+		return -ENOMEM;
+	}
+
+	rc = mt9v113_sensor_probe(info, s);
+	if (rc < 0)
+		return rc;
+
+	
+	printk(KERN_DEBUG "going into v4l2_i2c_subdev_init\n");
+	if (sdev) {
+		v4l2_i2c_subdev_init(sdev, mt9v113_client,
+						&mt9v113_subdev_ops);
+		mt9v113_ctrl->sensor_dev = sdev;
+	}
+
+	return rc;
+}
+#endif
+
+
+static int mt9v113_i2c_probe(struct i2c_client *client,
+			     const struct i2c_device_id *id)
+{
+	int rc = 0;
+
+	pr_info("%s\n", __func__);
+	
+	mt9v113_sensorw = kzalloc(sizeof(struct mt9v113_work), GFP_KERNEL);
+
+	if (!mt9v113_sensorw) {
+		rc = -ENOMEM;
+		goto probe_failure;
+	}
+
+	i2c_set_clientdata(client, mt9v113_sensorw);
+	mt9v113_init_client(client);
+	mt9v113_client = client;
+
+	rc = msm_sensor_i2c_probe(client, id);
+
+	if (rc >= 0)
+		mt9v113_sysfs_init();
+	else
+		goto probe_failure;
+
+	pr_info("%s succeeded!\n", __func__);
+
+	return rc;
+
+probe_failure:
+	kfree(mt9v113_sensorw);
+	mt9v113_sensorw = NULL;
+	pr_info("%s failed!\n", __func__);
+
+	return rc;
+}
+
+static struct msm_camera_i2c_client mt9v113_sensor_i2c_client = {
+	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
+};
+
+static struct msm_sensor_id_info_t mt9v113_id_info = {
+	.sensor_id_reg_addr = 0x0,
+	.sensor_id = MT9V113_MODEL_ID,
+};
+
+static struct msm_camera_csid_vc_cfg mt9v113_cid_cfg[] = {
+	{0, CSI_YUV422_8, CSI_DECODE_8BIT},
+	{1, CSI_EMBED_DATA, CSI_DECODE_8BIT},
+	{2, CSI_RAW8, CSI_DECODE_8BIT},
+};
+
+static struct msm_camera_csi2_params mt9v113_csi_params = {
+	.csid_params = {
+		.lane_cnt = 1,
+		.lane_assign = 0xE4,
+		.lut_params = {
+			.num_cid = ARRAY_SIZE(mt9v113_cid_cfg),
+			.vc_cfg = mt9v113_cid_cfg,
+		},
+	},
+	.csiphy_params = {
+		.lane_cnt = 1,
+		.settle_cnt = 20,
+		.lane_mask = 1,
+	},
+};
+
+static struct msm_camera_csi2_params *mt9v113_csi_params_array[] = {
+	&mt9v113_csi_params,
+	&mt9v113_csi_params,
+	&mt9v113_csi_params,
+	&mt9v113_csi_params,
+};
+
+static struct v4l2_subdev_info mt9v113_subdev_info[] = {
+	{
+	.code   = V4L2_MBUS_FMT_YUYV8_2X8,
+	.colorspace = V4L2_COLORSPACE_JPEG,
+	.fmt    = 1,
+	.order    = 0,
+	},
+	
+};
+
+static struct v4l2_subdev_core_ops mt9v113_subdev_core_ops = {
+	.ioctl = msm_sensor_subdev_ioctl,
+	.s_power = msm_sensor_power,
+};
+
+static struct v4l2_subdev_video_ops mt9v113_subdev_video_ops = {
+	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
+};
+
+static struct v4l2_subdev_ops mt9v113_subdev_ops = {
+	.core = &mt9v113_subdev_core_ops,
+	.video  = &mt9v113_subdev_video_ops,
+};
+
+static struct msm_sensor_fn_t mt9v113_func_tbl = {
+	.sensor_stop_stream = mt9v113_stop_stream,
+	.sensor_setting = msm_sensor_setting,
+	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
+	.sensor_mode_init = msm_sensor_mode_init,
+	.sensor_get_output_info = msm_sensor_get_output_info,
+	.sensor_config = mt9v113_sensor_config,
+	.sensor_power_up = mt9v113_power_up,
+	.sensor_power_down = mt9v113_power_down,
+};
+
+static const struct i2c_device_id mt9v113_i2c_id[] = {
+	{"mt9v113", (kernel_ulong_t)&mt9v113_s_ctrl},
+	{},
+};
+
+static struct i2c_driver mt9v113_i2c_driver = {
+	.id_table = mt9v113_i2c_id,
+	.probe  = mt9v113_i2c_probe,
+	.driver = {
+		.name = SENSOR_NAME,
+	},
+};
+
+static struct msm_sensor_reg_t mt9v113_sensor_regs = {
+	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
+	.output_settings = &mt9v113_dimensions[0],
+};
+
+
+static struct msm_sensor_ctrl_t mt9v113_s_ctrl = {
+	.msm_sensor_reg = &mt9v113_sensor_regs,
+	.sensor_i2c_client = &mt9v113_sensor_i2c_client,
+	.sensor_i2c_addr = 0x78,
+	.sensor_id_info = &mt9v113_id_info,
+	.cam_mode = MSM_SENSOR_MODE_INVALID,
+	.csi_params = &mt9v113_csi_params_array[0],
+	.msm_sensor_mutex = &mt9v113_mut,
+	.sensor_i2c_driver = &mt9v113_i2c_driver,
+	.sensor_v4l2_subdev_info = mt9v113_subdev_info,
+	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(mt9v113_subdev_info),
+	.sensor_v4l2_subdev_ops = &mt9v113_subdev_ops,
+	.func_tbl = &mt9v113_func_tbl,
+};
+
+static int __init mt9v113_init(void)
+{
+	pr_info("mt9v113_init\n");
+	return i2c_add_driver(&mt9v113_i2c_driver);
+}
+
+module_init(mt9v113_init);
+
+void mt9v113_exit(void)
+{
+	i2c_del_driver(&mt9v113_i2c_driver);
+}
+MODULE_DESCRIPTION("Micron 0.3 MP YUV sensor driver");
+MODULE_LICENSE("GPL v2");
+
diff --git a/drivers/media/video/msm/sensors/ov2720.c b/drivers/media/video/msm/sensors/ov2720.c
deleted file mode 100644
index e25029a..0000000
--- a/drivers/media/video/msm/sensors/ov2720.c
+++ /dev/null
@@ -1,857 +0,0 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#include "ov2720.h"
-#define SENSOR_NAME "ov2720"
-#define PLATFORM_DRIVER_NAME "msm_camera_ov2720"
-#define ov2720_obj ov2720_##obj
-
-DEFINE_MUTEX(ov2720_mut);
-static struct msm_sensor_ctrl_t ov2720_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf ov2720_start_settings[] = {
-	{0x0100, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf ov2720_stop_settings[] = {
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf ov2720_groupon_settings[] = {
-	{0x3208, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf ov2720_groupoff_settings[] = {
-	{0x3208, 0x10},
-	{0x3208, 0xA0},
-};
-
-static struct msm_camera_i2c_reg_conf ov2720_prev_settings[] = {
-	{0x3800, 0x00},
-	{0x3801, 0x02},
-	{0x3802, 0x00},
-	{0x3803, 0x00},
-	{0x3804, 0x07},
-	{0x3805, 0xA1},
-	{0x3806, 0x04},
-	{0x3807, 0x47},
-	{0x3810, 0x00},
-	{0x3811, 0x09},
-	{0x3812, 0x00},
-	{0x3813, 0x02},
-	{0x3820, 0x80},
-	{0x3821, 0x06},
-	{0x3814, 0x11},
-	{0x3815, 0x11},
-	{0x3612, 0x0b},
-	{0x3618, 0x04},
-	{0x3a08, 0x01},
-	{0x3a09, 0x50},
-	{0x3a0a, 0x01},
-	{0x3a0b, 0x18},
-	{0x3a0d, 0x03},
-	{0x3a0e, 0x03},
-	{0x4520, 0x00},
-	{0x4837, 0x1b},
-	{0x3000, 0xff},
-	{0x3001, 0xff},
-	{0x3002, 0xf0},
-	{0x3600, 0x08},
-	{0x3621, 0xc0},
-	{0x3632, 0xd2},
-	{0x3633, 0x23},
-	{0x3634, 0x54},
-	{0x3f01, 0x0c},
-	{0x5001, 0xc1},
-	{0x3614, 0xf0},
-	{0x3630, 0x2d},
-	{0x370b, 0x62},
-	{0x3706, 0x61},
-	{0x4000, 0x02},
-	{0x4002, 0xc5},
-	{0x4005, 0x08},
-	{0x404f, 0x84},
-	{0x4051, 0x00},
-	{0x5000, 0xcf},
-	{0x3a18, 0x00},
-	{0x3a19, 0x80},
-	{0x3503, 0x03},
-	{0x4521, 0x00},
-	{0x5183, 0xb0},
-	{0x5184, 0xb0},
-	{0x5185, 0xb0},
-	{0x370c, 0x0c},
-	{0x3035, 0x10},
-	{0x3036, 0x1e},
-	{0x3037, 0x21},
-	{0x303e, 0x19},
-	{0x3038, 0x06},
-	{0x3018, 0x04},
-	{0x3000, 0x00},
-	{0x3001, 0x00},
-	{0x3002, 0x00},
-	{0x3a0f, 0x40},
-	{0x3a10, 0x38},
-	{0x3a1b, 0x48},
-	{0x3a1e, 0x30},
-	{0x3a11, 0x90},
-	{0x3a1f, 0x10},
-	{0x4800, 0x24},
-};
-
-static struct msm_camera_i2c_reg_conf ov2720_720_settings[] = {
-	{0x3800, 0x01},
-	{0x3801, 0x4a},
-	{0x3802, 0x00},
-	{0x3803, 0xba},
-	{0x3804, 0x06},
-	{0x3805, 0x51+32},
-	{0x3806, 0x03},
-	{0x3807, 0x8d+24},
-	{0x3810, 0x00},
-	{0x3811, 0x05},
-	{0x3812, 0x00},
-	{0x3813, 0x02},
-	{0x3820, 0x80},
-	{0x3821, 0x06},
-	{0x3814, 0x11},
-	{0x3815, 0x11},
-	{0x3612, 0x0b},
-	{0x3618, 0x04},
-	{0x3a08, 0x01},
-	{0x3a09, 0x50},
-	{0x3a0a, 0x01},
-	{0x3a0b, 0x18},
-	{0x3a0d, 0x03},
-	{0x3a0e, 0x03},
-	{0x4520, 0x00},
-	{0x4837, 0x1b},
-	{0x3000, 0xff},
-	{0x3001, 0xff},
-	{0x3002, 0xf0},
-	{0x3600, 0x08},
-	{0x3621, 0xc0},
-	{0x3632, 0xd2},
-	{0x3633, 0x23},
-	{0x3634, 0x54},
-	{0x3f01, 0x0c},
-	{0x5001, 0xc1},
-	{0x3614, 0xf0},
-	{0x3630, 0x2d},
-	{0x370b, 0x62},
-	{0x3706, 0x61},
-	{0x4000, 0x02},
-	{0x4002, 0xc5},
-	{0x4005, 0x08},
-	{0x404f, 0x84},
-	{0x4051, 0x00},
-	{0x5000, 0xff},
-	{0x3a18, 0x00},
-	{0x3a19, 0x80},
-	{0x3503, 0x13},
-	{0x4521, 0x00},
-	{0x5183, 0xb0},
-	{0x5184, 0xb0},
-	{0x5185, 0xb0},
-	{0x370c, 0x0c},
-	{0x3035, 0x10},
-	{0x3036, 0x04},
-	{0x3037, 0x61},
-	{0x303e, 0x19},
-	{0x3038, 0x06},
-	{0x3018, 0x04},
-	{0x3000, 0x00},
-	{0x3001, 0x00},
-	{0x3002, 0x00},
-	{0x3a0f, 0x40},
-	{0x3a10, 0x38},
-	{0x3a1b, 0x48},
-	{0x3a1e, 0x30},
-	{0x3a11, 0x90},
-	{0x3a1f, 0x10},
-	{0x4800, 0x24},
-};
-
-static struct msm_camera_i2c_reg_conf ov2720_vga_settings[] = {
-	{0x3800, 0x00},
-	{0x3801, 0x0c},
-	{0x3802, 0x00},
-	{0x3803, 0x02},
-	{0x3804, 0x07},
-	{0x3805, 0x97+32},
-	{0x3806, 0x04},
-	{0x3807, 0x45+24},
-	{0x3810, 0x00},
-	{0x3811, 0x03},
-	{0x3812, 0x00},
-	{0x3813, 0x03},
-	{0x3820, 0x80},
-	{0x3821, 0x06},
-	{0x3814, 0x11},
-	{0x3815, 0x11},
-	{0x3612, 0x0b},
-	{0x3618, 0x04},
-	{0x3a08, 0x01},
-	{0x3a09, 0x50},
-	{0x3a0a, 0x01},
-	{0x3a0b, 0x18},
-	{0x3a0d, 0x03},
-	{0x3a0e, 0x03},
-	{0x4520, 0x00},
-	{0x4837, 0x1b},
-	{0x3000, 0xff},
-	{0x3001, 0xff},
-	{0x3002, 0xf0},
-	{0x3600, 0x08},
-	{0x3621, 0xc0},
-	{0x3632, 0xd2},
-	{0x3633, 0x23},
-	{0x3634, 0x54},
-	{0x3f01, 0x0c},
-	{0x5001, 0xc1},
-	{0x3614, 0xf0},
-	{0x3630, 0x2d},
-	{0x370b, 0x62},
-	{0x3706, 0x61},
-	{0x4000, 0x02},
-	{0x4002, 0xc5},
-	{0x4005, 0x08},
-	{0x404f, 0x84},
-	{0x4051, 0x00},
-	{0x5000, 0xff},
-	{0x3a18, 0x00},
-	{0x3a19, 0x80},
-	{0x3503, 0x13},
-	{0x4521, 0x00},
-	{0x5183, 0xb0},
-	{0x5184, 0xb0},
-	{0x5185, 0xb0},
-	{0x370c, 0x0c},
-	{0x3035, 0x10},
-	{0x3036, 0x04},
-	{0x3037, 0x61},
-	{0x303e, 0x19},
-	{0x3038, 0x06},
-	{0x3018, 0x04},
-	{0x3000, 0x00},
-	{0x3001, 0x00},
-	{0x3002, 0x00},
-	{0x3a0f, 0x40},
-	{0x3a10, 0x38},
-	{0x3a1b, 0x48},
-	{0x3a1e, 0x30},
-	{0x3a11, 0x90},
-	{0x3a1f, 0x10},
-	{0x4800, 0x24},
-	{0x3500, 0x00},
-	{0x3501, 0x17},
-	{0x3502, 0xf0},
-	{0x3508, 0x00},
-	{0x3509, 0x20},
-};
-
-static struct msm_camera_i2c_reg_conf ov2720_60fps_settings[] = {
-	{0x3718, 0x10},
-	{0x3702, 0x18},
-	{0x373a, 0x3c},
-	{0x3715, 0x01},
-	{0x3703, 0x1d},
-	{0x3705, 0x0b},
-	{0x3730, 0x1f},
-	{0x3704, 0x3f},
-	{0x3f06, 0x1d},
-	{0x371c, 0x00},
-	{0x371d, 0x83},
-	{0x371e, 0x00},
-	{0x371f, 0xb6},
-	{0x3708, 0x63},
-	{0x3709, 0x52},
-	{0x3800, 0x01},
-	{0x3801, 0x42},
-	{0x3802, 0x00},
-	{0x3803, 0x40},
-	{0x3804, 0x06},
-	{0x3805, 0x61},
-	{0x3806, 0x04},
-	{0x3807, 0x08},
-	{0x3808, 0x02},
-	{0x3809, 0x80},
-	{0x380a, 0x01},
-	{0x380b, 0xe0},
-	{0x380c, 0x03},
-	{0x380d, 0x0c},
-	{0x380e, 0x02},
-	{0x380f, 0x00},
-	{0x3810, 0x00},
-	{0x3811, 0x0f},
-	{0x3812, 0x00},
-	{0x3813, 0x02},
-	{0x3820, 0x80},
-	{0x3821, 0x06},
-	{0x3814, 0x31},
-	{0x3815, 0x31},
-	{0x3612, 0x0b},
-	{0x3618, 0x04},
-	{0x3a08, 0x02},
-	{0x3a09, 0x67},
-	{0x3a0a, 0x02},
-	{0x3a0b, 0x00},
-	{0x3a0d, 0x00},
-	{0x3a0e, 0x00},
-	{0x4520, 0x0a},
-	{0x4837, 0x29},
-	{0x3000, 0xff},
-	{0x3001, 0xff},
-	{0x3002, 0xf0},
-	{0x3600, 0x08},
-	{0x3621, 0xc0},
-	{0x3632, 0xd2},
-	{0x3633, 0x23},
-	{0x3634, 0x54},
-	{0x3f01, 0x0c},
-	{0x5001, 0xc1},
-	{0x3614, 0xf0},
-	{0x3630, 0x2d},
-	{0x370b, 0x62},
-	{0x3706, 0x61},
-	{0x4000, 0x02},
-	{0x4002, 0xc5},
-	{0x4005, 0x08},
-	{0x404f, 0x84},
-	{0x4051, 0x00},
-	{0x5000, 0xcf},
-	{0x3a18, 0x00},
-	{0x3a19, 0x80},
-	{0x3503, 0x07},
-	{0x4521, 0x00},
-	{0x5183, 0xb0},
-	{0x5184, 0xb0},
-	{0x5185, 0xb0},
-	{0x370c, 0x0c},
-	{0x3035, 0x30},
-	{0x3036, 0x14},
-	{0x3037, 0x21},
-	{0x303e, 0x19},
-	{0x3038, 0x06},
-	{0x3018, 0x04},
-	{0x3000, 0x00},
-	{0x3001, 0x00},
-	{0x3002, 0x00},
-	{0x3a0f, 0x40},
-	{0x3a10, 0x38},
-	{0x3a1b, 0x48},
-	{0x3a1e, 0x30},
-	{0x3a11, 0x90},
-	{0x3a1f, 0x10},
-	{0x3011, 0x22},
-	{0x3a00, 0x58},
-};
-
-static struct msm_camera_i2c_reg_conf ov2720_90fps_settings[] = {
-	{0x3718, 0x10},
-	{0x3702, 0x18},
-	{0x373a, 0x3c},
-	{0x3715, 0x01},
-	{0x3703, 0x1d},
-	{0x3705, 0x0b},
-	{0x3730, 0x1f},
-	{0x3704, 0x3f},
-	{0x3f06, 0x1d},
-	{0x371c, 0x00},
-	{0x371d, 0x83},
-	{0x371e, 0x00},
-	{0x371f, 0xb6},
-	{0x3708, 0x63},
-	{0x3709, 0x52},
-	{0x3800, 0x01},
-	{0x3801, 0x42},
-	{0x3802, 0x00},
-	{0x3803, 0x40},
-	{0x3804, 0x06},
-	{0x3805, 0x61},
-	{0x3806, 0x04},
-	{0x3807, 0x08},
-	{0x3808, 0x02},
-	{0x3809, 0x80},
-	{0x380a, 0x01},
-	{0x380b, 0xe0},
-	{0x380c, 0x03},
-	{0x380d, 0x0c},
-	{0x380e, 0x02},
-	{0x380f, 0x00},
-	{0x3810, 0x00},
-	{0x3811, 0x0f},
-	{0x3812, 0x00},
-	{0x3813, 0x02},
-	{0x3820, 0x80},
-	{0x3821, 0x06},
-	{0x3814, 0x31},
-	{0x3815, 0x31},
-	{0x3612, 0x0b},
-	{0x3618, 0x04},
-	{0x3a08, 0x02},
-	{0x3a09, 0x67},
-	{0x3a0a, 0x02},
-	{0x3a0b, 0x00},
-	{0x3a0d, 0x00},
-	{0x3a0e, 0x00},
-	{0x4520, 0x0a},
-	{0x4837, 0x29},
-	{0x3000, 0xff},
-	{0x3001, 0xff},
-	{0x3002, 0xf0},
-	{0x3600, 0x08},
-	{0x3621, 0xc0},
-	{0x3632, 0xd2},
-	{0x3633, 0x23},
-	{0x3634, 0x54},
-	{0x3f01, 0x0c},
-	{0x5001, 0xc1},
-	{0x3614, 0xf0},
-	{0x3630, 0x2d},
-	{0x370b, 0x62},
-	{0x3706, 0x61},
-	{0x4000, 0x02},
-	{0x4002, 0xc5},
-	{0x4005, 0x08},
-	{0x404f, 0x84},
-	{0x4051, 0x00},
-	{0x5000, 0xcf},
-	{0x3a18, 0x00},
-	{0x3a19, 0x80},
-	{0x3503, 0x07},
-	{0x4521, 0x00},
-	{0x5183, 0xb0},
-	{0x5184, 0xb0},
-	{0x5185, 0xb0},
-	{0x370c, 0x0c},
-	{0x3035, 0x30},
-	{0x3036, 0x1e},
-	{0x3037, 0x21},
-	{0x303e, 0x19},
-	{0x3038, 0x06},
-	{0x3018, 0x04},
-	{0x3000, 0x00},
-	{0x3001, 0x00},
-	{0x3002, 0x00},
-	{0x3a0f, 0x40},
-	{0x3a10, 0x38},
-	{0x3a1b, 0x48},
-	{0x3a1e, 0x30},
-	{0x3a11, 0x90},
-	{0x3a1f, 0x10},
-	{0x3011, 0x22},
-	{0x3a00, 0x58},
-};
-
-static struct msm_camera_i2c_reg_conf ov2720_120fps_settings[] = {
-	{0x3718, 0x10},
-	{0x3702, 0x18},
-	{0x373a, 0x3c},
-	{0x3715, 0x01},
-	{0x3703, 0x1d},
-	{0x3705, 0x0b},
-	{0x3730, 0x1f},
-	{0x3704, 0x3f},
-	{0x3f06, 0x1d},
-	{0x371c, 0x00},
-	{0x371d, 0x83},
-	{0x371e, 0x00},
-	{0x371f, 0xb6},
-	{0x3708, 0x63},
-	{0x3709, 0x52},
-	{0x3800, 0x01},
-	{0x3801, 0x42},
-	{0x3802, 0x00},
-	{0x3803, 0x40},
-	{0x3804, 0x06},
-	{0x3805, 0x61},
-	{0x3806, 0x04},
-	{0x3807, 0x08},
-	{0x3808, 0x02},
-	{0x3809, 0x80},
-	{0x380a, 0x01},
-	{0x380b, 0xe0},
-	{0x380c, 0x03},
-	{0x380d, 0x0c},
-	{0x380e, 0x02},
-	{0x380f, 0x00},
-	{0x3810, 0x00},
-	{0x3811, 0x0f},
-	{0x3812, 0x00},
-	{0x3813, 0x02},
-	{0x3820, 0x80},
-	{0x3821, 0x06},
-	{0x3814, 0x31},
-	{0x3815, 0x31},
-	{0x3612, 0x0b},
-	{0x3618, 0x04},
-	{0x3a08, 0x02},
-	{0x3a09, 0x67},
-	{0x3a0a, 0x02},
-	{0x3a0b, 0x00},
-	{0x3a0d, 0x00},
-	{0x3a0e, 0x00},
-	{0x4520, 0x0a},
-	{0x4837, 0x29},
-	{0x3000, 0xff},
-	{0x3001, 0xff},
-	{0x3002, 0xf0},
-	{0x3600, 0x08},
-	{0x3621, 0xc0},
-	{0x3632, 0xd2},
-	{0x3633, 0x23},
-	{0x3634, 0x54},
-	{0x3f01, 0x0c},
-	{0x5001, 0xc1},
-	{0x3614, 0xf0},
-	{0x3630, 0x2d},
-	{0x370b, 0x62},
-	{0x3706, 0x61},
-	{0x4000, 0x02},
-	{0x4002, 0xc5},
-	{0x4005, 0x08},
-	{0x404f, 0x84},
-	{0x4051, 0x00},
-	{0x5000, 0xcf},
-	{0x3a18, 0x00},
-	{0x3a19, 0x80},
-	{0x3503, 0x07},
-	{0x4521, 0x00},
-	{0x5183, 0xb0},
-	{0x5184, 0xb0},
-	{0x5185, 0xb0},
-	{0x370c, 0x0c},
-	{0x3035, 0x10},
-	{0x3036, 0x14},
-	{0x3037, 0x21},
-	{0x303e, 0x19},
-	{0x3038, 0x06},
-	{0x3018, 0x04},
-	{0x3000, 0x00},
-	{0x3001, 0x00},
-	{0x3002, 0x00},
-	{0x3a0f, 0x40},
-	{0x3a10, 0x38},
-	{0x3a1b, 0x48},
-	{0x3a1e, 0x30},
-	{0x3a11, 0x90},
-	{0x3a1f, 0x10},
-	{0x3011, 0x22},
-	{0x3a00, 0x58},
-};
-
-static struct msm_camera_i2c_reg_conf ov2720_recommend_settings[] = {
-	{0x0103, 0x01},
-	{0x3718, 0x10},
-	{0x3702, 0x24},
-	{0x373a, 0x60},
-	{0x3715, 0x01},
-	{0x3703, 0x2e},
-	{0x3705, 0x10},
-	{0x3730, 0x30},
-	{0x3704, 0x62},
-	{0x3f06, 0x3a},
-	{0x371c, 0x00},
-	{0x371d, 0xc4},
-	{0x371e, 0x01},
-	{0x371f, 0x0d},
-	{0x3708, 0x61},
-	{0x3709, 0x12},
-};
-
-static struct v4l2_subdev_info ov2720_subdev_info[] = {
-	{
-	.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array ov2720_init_conf[] = {
-	{&ov2720_recommend_settings[0],
-	ARRAY_SIZE(ov2720_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array ov2720_confs[] = {
-	{&ov2720_prev_settings[0],
-	ARRAY_SIZE(ov2720_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov2720_vga_settings[0],
-	ARRAY_SIZE(ov2720_vga_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov2720_720_settings[0],
-	ARRAY_SIZE(ov2720_720_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov2720_60fps_settings[0],
-	ARRAY_SIZE(ov2720_60fps_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov2720_90fps_settings[0],
-	ARRAY_SIZE(ov2720_90fps_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov2720_120fps_settings[0],
-	ARRAY_SIZE(ov2720_120fps_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t ov2720_dimensions[] = {
-	{
-		.x_output = 0x78C,
-		.y_output = 0x444,
-		.line_length_pclk = 0x85c,
-		.frame_length_lines = 0x460,
-		.vt_pixel_clk = 72000000,
-		.op_pixel_clk = 72000000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x510,
-		.y_output = 0x278,
-		.line_length_pclk = 0x85c,
-		.frame_length_lines = 0x460,
-		.vt_pixel_clk = 72000000,
-		.op_pixel_clk = 72000000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x298,
-		.y_output = 0x1F2,
-		.line_length_pclk = 0x85c,
-		.frame_length_lines = 0x460,
-		.vt_pixel_clk = 72000000,
-		.op_pixel_clk = 72000000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x280, /* 640 */
-		.y_output = 0x1E0, /* 480 */
-		.line_length_pclk = 0x30C, /* 780 */
-		.frame_length_lines = 0x200, /* 512 */
-		.vt_pixel_clk = 24000000,
-		.op_pixel_clk = 24000000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x280, /* 640 */
-		.y_output = 0x1E0, /* 480 */
-		.line_length_pclk = 0x30C, /* 780 */
-		.frame_length_lines = 0x200, /* 512 */
-		.vt_pixel_clk = 36000000,
-		.op_pixel_clk = 36000000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x280, /* 640 */
-		.y_output = 0x1E0, /* 480 */
-		.line_length_pclk = 0x30C, /* 780 */
-		.frame_length_lines = 0x200, /* 512 */
-		.vt_pixel_clk = 48000000,
-		.op_pixel_clk = 48000000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_sensor_output_reg_addr_t ov2720_reg_addr = {
-	.x_output = 0x3808,
-	.y_output = 0x380a,
-	.line_length_pclk = 0x380c,
-	.frame_length_lines = 0x380e,
-};
-
-static struct msm_sensor_id_info_t ov2720_id_info = {
-	.sensor_id_reg_addr = 0x300A,
-	.sensor_id = 0x2720,
-};
-
-static struct msm_sensor_exp_gain_info_t ov2720_exp_gain_info = {
-	.coarse_int_time_addr = 0x3501,
-	.global_gain_addr = 0x3508,
-	.vert_offset = 6,
-};
-
-static enum msm_camera_vreg_name_t ov2720_veg_seq[] = {
-	CAM_VIO,
-	CAM_VANA,
-	CAM_VDIG,
-};
-
-static int32_t ov2720_write_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
-{
-	uint32_t fl_lines, offset;
-	uint8_t int_time[3];
-	fl_lines =
-		(s_ctrl->curr_frame_length_lines * s_ctrl->fps_divider) / Q10;
-	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
-	if (line > (fl_lines - offset))
-		fl_lines = line + offset;
-
-	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_output_reg_addr->frame_length_lines, fl_lines,
-		MSM_CAMERA_I2C_WORD_DATA);
-	int_time[0] = line >> 12;
-	int_time[1] = line >> 4;
-	int_time[2] = line << 4;
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr-1,
-		int_time[0], MSM_CAMERA_I2C_BYTE_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-		int_time[1], MSM_CAMERA_I2C_BYTE_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr+1,
-		int_time[2], MSM_CAMERA_I2C_BYTE_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
-		MSM_CAMERA_I2C_WORD_DATA);
-	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	return 0;
-}
-
-static const struct i2c_device_id ov2720_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&ov2720_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver ov2720_i2c_driver = {
-	.id_table = ov2720_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client ov2720_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-
-static const struct of_device_id ov2720_dt_match[] = {
-	{.compatible = "qcom,ov2720", .data = &ov2720_s_ctrl},
-	{}
-};
-
-MODULE_DEVICE_TABLE(of, ov2720_dt_match);
-
-static struct platform_driver ov2720_platform_driver = {
-	.driver = {
-		.name = "qcom,ov2720",
-		.owner = THIS_MODULE,
-		.of_match_table = ov2720_dt_match,
-	},
-};
-
-static int32_t ov2720_platform_probe(struct platform_device *pdev)
-{
-	int32_t rc = 0;
-	const struct of_device_id *match;
-	match = of_match_device(ov2720_dt_match, &pdev->dev);
-	rc = msm_sensor_platform_probe(pdev, match->data);
-	return rc;
-}
-
-static int __init msm_sensor_init_module(void)
-{
-	int32_t rc = 0;
-	rc = platform_driver_probe(&ov2720_platform_driver,
-		ov2720_platform_probe);
-	if (!rc)
-		return rc;
-	return i2c_add_driver(&ov2720_i2c_driver);
-}
-
-static void __exit msm_sensor_exit_module(void)
-{
-	if (ov2720_s_ctrl.pdev) {
-		msm_sensor_free_sensor_data(&ov2720_s_ctrl);
-		platform_driver_unregister(&ov2720_platform_driver);
-	} else
-		i2c_del_driver(&ov2720_i2c_driver);
-	return;
-}
-
-static struct v4l2_subdev_core_ops ov2720_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops ov2720_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops ov2720_subdev_ops = {
-	.core = &ov2720_subdev_core_ops,
-	.video  = &ov2720_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t ov2720_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = ov2720_write_exp_gain,
-	.sensor_write_snapshot_exp_gain = ov2720_write_exp_gain,
-	.sensor_setting = msm_sensor_setting,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-	.sensor_adjust_frame_lines = msm_sensor_adjust_frame_lines2,
-	.sensor_get_csi_params = msm_sensor_get_csi_params,
-};
-
-static struct msm_sensor_reg_t ov2720_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = ov2720_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(ov2720_start_settings),
-	.stop_stream_conf = ov2720_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(ov2720_stop_settings),
-	.group_hold_on_conf = ov2720_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(ov2720_groupon_settings),
-	.group_hold_off_conf = ov2720_groupoff_settings,
-	.group_hold_off_conf_size =
-		ARRAY_SIZE(ov2720_groupoff_settings),
-	.init_settings = &ov2720_init_conf[0],
-	.init_size = ARRAY_SIZE(ov2720_init_conf),
-	.mode_settings = &ov2720_confs[0],
-	.output_settings = &ov2720_dimensions[0],
-	.num_conf = ARRAY_SIZE(ov2720_confs),
-};
-
-static struct msm_sensor_ctrl_t ov2720_s_ctrl = {
-	.msm_sensor_reg = &ov2720_regs,
-	.sensor_i2c_client = &ov2720_sensor_i2c_client,
-	.sensor_i2c_addr = 0x6C,
-	.vreg_seq = ov2720_veg_seq,
-	.num_vreg_seq = ARRAY_SIZE(ov2720_veg_seq),
-	.sensor_output_reg_addr = &ov2720_reg_addr,
-	.sensor_id_info = &ov2720_id_info,
-	.sensor_exp_gain_info = &ov2720_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &ov2720_mut,
-	.sensor_i2c_driver = &ov2720_i2c_driver,
-	.sensor_v4l2_subdev_info = ov2720_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(ov2720_subdev_info),
-	.sensor_v4l2_subdev_ops = &ov2720_subdev_ops,
-	.func_tbl = &ov2720_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-	.fps_divider = Q10,
-};
-
-module_init(msm_sensor_init_module);
-module_exit(msm_sensor_exit_module);
-MODULE_DESCRIPTION("Omnivision 2MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
-
-
diff --git a/drivers/media/video/msm/sensors/ov2720.h b/drivers/media/video/msm/sensors/ov2720.h
deleted file mode 100644
index 6b47666..0000000
--- a/drivers/media/video/msm/sensors/ov2720.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <mach/board.h>
-extern struct platform_driver ov2720_driver;
-
diff --git a/drivers/media/video/msm/sensors/ov5647_v4l2.c b/drivers/media/video/msm/sensors/ov5647_v4l2.c
deleted file mode 100644
index 10fe453..0000000
--- a/drivers/media/video/msm/sensors/ov5647_v4l2.c
+++ /dev/null
@@ -1,832 +0,0 @@
-/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#include "msm.h"
-#define SENSOR_NAME "ov5647"
-#define PLATFORM_DRIVER_NAME "msm_camera_ov5647"
-#define ov5647_obj ov5647_##obj
-
-static struct msm_sensor_ctrl_t ov5647_s_ctrl;
-
-DEFINE_MUTEX(ov5647_mut);
-
-static struct msm_camera_i2c_reg_conf ov5647_start_settings[] = {
-	{0x4202, 0x00},  /* streaming on */
-};
-
-static struct msm_camera_i2c_reg_conf ov5647_stop_settings[] = {
-	{0x4202, 0x0f},  /* streaming off*/
-};
-
-static struct msm_camera_i2c_reg_conf ov5647_groupon_settings[] = {
-	{0x3208, 0x0},
-};
-
-static struct msm_camera_i2c_reg_conf ov5647_groupoff_settings[] = {
-	{0x3208, 0x10},
-	{0x3208, 0xa0},
-};
-
-static struct msm_camera_i2c_reg_conf ov5647_prev_settings[] = {
-	/*1280*960 Reference Setting 24M MCLK 2lane 280Mbps/lane 30fps
-	for back to preview*/
-	{0x3035, 0x21},
-	{0x3036, 0x37},
-	{0x3821, 0x07},
-	{0x3820, 0x41},
-	{0x3612, 0x09},
-	{0x3618, 0x00},
-	{0x380c, 0x07},
-	{0x380d, 0x68},
-	{0x380e, 0x03},
-	{0x380f, 0xd8},
-	{0x3814, 0x31},
-	{0x3815, 0x31},
-	{0x3709, 0x52},
-	{0x3808, 0x05},
-	{0x3809, 0x00},
-	{0x380a, 0x03},
-	{0x380b, 0xc0},
-	{0x3800, 0x00},
-	{0x3801, 0x18},
-	{0x3802, 0x00},
-	{0x3803, 0x0e},
-	{0x3804, 0x0a},
-	{0x3805, 0x27},
-	{0x3806, 0x07},
-	{0x3807, 0x95},
-	{0x4004, 0x02},
-};
-
-static struct msm_camera_i2c_reg_conf ov5647_snap_settings[] = {
-	/*2608*1952 Reference Setting 24M MCLK 2lane 280Mbps/lane 30fps*/
-	{0x3035, 0x21},
-	{0x3036, 0x4f},
-	{0x3821, 0x06},
-	{0x3820, 0x00},
-	{0x3612, 0x0b},
-	{0x3618, 0x04},
-	{0x380c, 0x0a},
-	{0x380d, 0x8c},
-	{0x380e, 0x07},
-	{0x380f, 0xb0},
-	{0x3814, 0x11},
-	{0x3815, 0x11},
-	{0x3709, 0x12},
-	{0x3808, 0x0a},
-	{0x3809, 0x30},
-	{0x380a, 0x07},
-	{0x380b, 0xa0},
-	{0x3800, 0x00},
-	{0x3801, 0x04},
-	{0x3802, 0x00},
-	{0x3803, 0x00},
-	{0x3804, 0x0a},
-	{0x3805, 0x3b},
-	{0x3806, 0x07},
-	{0x3807, 0xa3},
-	{0x4004, 0x04},
-};
-
-static struct msm_camera_i2c_reg_conf ov5647_video_60fps_settings[] = {
-	{0x3035, 0x21},
-	{0x3036, 0x38},
-	{0x3821, 0x07},
-	{0x3820, 0x41},
-	{0x3612, 0x49},
-	{0x3618, 0x00},
-	{0x380c, 0x07},
-	{0x380d, 0x30},
-	{0x380e, 0x01},
-	{0x380f, 0xf8},
-	{0x3814, 0x71},
-	{0x3815, 0x71},
-	{0x3709, 0x52},
-	{0x3808, 0x02},
-	{0x3809, 0x80},
-	{0x380a, 0x01},
-	{0x380b, 0xe0},
-	{0x3800, 0x00},
-	{0x3801, 0x10},
-	{0x3802, 0x00},
-	{0x3803, 0x00},
-	{0x3804, 0x0a},
-	{0x3805, 0x2f},
-	{0x3806, 0x07},
-	{0x3807, 0x9f},
-	{0x4004, 0x02},
-};
-
-static struct msm_camera_i2c_reg_conf ov5647_video_90fps_settings[] = {
-	{0x3035, 0x11},
-	{0x3036, 0x2a},
-	{0x3821, 0x07},
-	{0x3820, 0x41},
-	{0x3612, 0x49},
-	{0x3618, 0x00},
-	{0x380c, 0x07},
-	{0x380d, 0x30},
-	{0x380e, 0x01},
-	{0x380f, 0xf8},
-	{0x3814, 0x71},
-	{0x3815, 0x71},
-	{0x3709, 0x52},
-	{0x3808, 0x02},
-	{0x3809, 0x80},
-	{0x380a, 0x01},
-	{0x380b, 0xe0},
-	{0x3800, 0x00},
-	{0x3801, 0x10},
-	{0x3802, 0x00},
-	{0x3803, 0x00},
-	{0x3804, 0x0a},
-	{0x3805, 0x2f},
-	{0x3806, 0x07},
-	{0x3807, 0x9f},
-	{0x4004, 0x02},
-};
-
-static struct msm_camera_i2c_reg_conf ov5647_zsl_settings[] = {
-	{0x3035, 0x21},
-	{0x3036, 0x4f},
-	{0x3821, 0x06},
-	{0x3820, 0x00},
-	{0x3612, 0x0b},
-	{0x3618, 0x04},
-	{0x380c, 0x0a},
-	{0x380d, 0x8c},
-	{0x380e, 0x07},
-	{0x380f, 0xb0},
-	{0x3814, 0x11},
-	{0x3815, 0x11},
-	{0x3709, 0x12},
-	{0x3808, 0x0a},
-	{0x3809, 0x30},
-	{0x380a, 0x07},
-	{0x380b, 0xa0},
-	{0x3800, 0x00},
-	{0x3801, 0x04},
-	{0x3802, 0x00},
-	{0x3803, 0x00},
-	{0x3804, 0x0a},
-	{0x3805, 0x3b},
-	{0x3806, 0x07},
-	{0x3807, 0xa3},
-	{0x4004, 0x04},
-};
-
-static struct msm_camera_i2c_reg_conf ov5647_recommend_settings[] = {
-	{0x3035, 0x11},
-	{0x303c, 0x11},
-	{0x370c, 0x03},
-	{0x5000, 0x06},
-	{0x5003, 0x08},
-	{0x5a00, 0x08},
-	{0x3000, 0xff},
-	{0x3001, 0xff},
-	{0x3002, 0xff},
-	{0x301d, 0xf0},
-	{0x3a18, 0x00},
-	{0x3a19, 0xf8},
-	{0x3c01, 0x80},
-	{0x3b07, 0x0c},
-	{0x3708, 0x64},
-	{0x3630, 0x2e},
-	{0x3632, 0xe2},
-	{0x3633, 0x23},
-	{0x3634, 0x44},
-	{0x3620, 0x64},
-	{0x3621, 0xe0},
-	{0x3600, 0x37},
-	{0x3704, 0xa0},
-	{0x3703, 0x5a},
-	{0x3715, 0x78},
-	{0x3717, 0x01},
-	{0x3731, 0x02},
-	{0x370b, 0x60},
-	{0x3705, 0x1a},
-	{0x3f05, 0x02},
-	{0x3f06, 0x10},
-	{0x3f01, 0x0a},
-	{0x3a08, 0x01},
-	{0x3a0f, 0x58},
-	{0x3a10, 0x50},
-	{0x3a1b, 0x58},
-	{0x3a1e, 0x50},
-	{0x3a11, 0x60},
-	{0x3a1f, 0x28},
-	{0x4001, 0x02},
-	{0x4000, 0x09},
-	{0x3000, 0x00},
-	{0x3001, 0x00},
-	{0x3002, 0x00},
-	{0x3017, 0xe0},
-	{0x301c, 0xfc},
-	{0x3636, 0x06},
-	{0x3016, 0x08},
-	{0x3827, 0xec},
-	{0x3018, 0x44},
-	{0x3035, 0x21},
-	{0x3106, 0xf5},
-	{0x3034, 0x18},
-	{0x301c, 0xf8},
-	/*lens setting*/
-	{0x5000, 0x86},
-	{0x5800, 0x11},
-	{0x5801, 0x0c},
-	{0x5802, 0x0a},
-	{0x5803, 0x0b},
-	{0x5804, 0x0d},
-	{0x5805, 0x13},
-	{0x5806, 0x09},
-	{0x5807, 0x05},
-	{0x5808, 0x03},
-	{0x5809, 0x03},
-	{0x580a, 0x06},
-	{0x580b, 0x08},
-	{0x580c, 0x05},
-	{0x580d, 0x01},
-	{0x580e, 0x00},
-	{0x580f, 0x00},
-	{0x5810, 0x02},
-	{0x5811, 0x06},
-	{0x5812, 0x05},
-	{0x5813, 0x01},
-	{0x5814, 0x00},
-	{0x5815, 0x00},
-	{0x5816, 0x02},
-	{0x5817, 0x06},
-	{0x5818, 0x09},
-	{0x5819, 0x05},
-	{0x581a, 0x04},
-	{0x581b, 0x04},
-	{0x581c, 0x06},
-	{0x581d, 0x09},
-	{0x581e, 0x11},
-	{0x581f, 0x0c},
-	{0x5820, 0x0b},
-	{0x5821, 0x0b},
-	{0x5822, 0x0d},
-	{0x5823, 0x13},
-	{0x5824, 0x22},
-	{0x5825, 0x26},
-	{0x5826, 0x26},
-	{0x5827, 0x24},
-	{0x5828, 0x24},
-	{0x5829, 0x24},
-	{0x582a, 0x22},
-	{0x582b, 0x20},
-	{0x582c, 0x22},
-	{0x582d, 0x26},
-	{0x582e, 0x22},
-	{0x582f, 0x22},
-	{0x5830, 0x42},
-	{0x5831, 0x22},
-	{0x5832, 0x02},
-	{0x5833, 0x24},
-	{0x5834, 0x22},
-	{0x5835, 0x22},
-	{0x5836, 0x22},
-	{0x5837, 0x26},
-	{0x5838, 0x42},
-	{0x5839, 0x26},
-	{0x583a, 0x06},
-	{0x583b, 0x26},
-	{0x583c, 0x24},
-	{0x583d, 0xce},
-	/* manual AWB,manual AE,close Lenc,open WBC*/
-	{0x3503, 0x03}, /*manual AE*/
-	{0x3501, 0x10},
-	{0x3502, 0x80},
-	{0x350a, 0x00},
-	{0x350b, 0x7f},
-	{0x5001, 0x01}, /*manual AWB*/
-	{0x5180, 0x08},
-	{0x5186, 0x04},
-	{0x5187, 0x00},
-	{0x5188, 0x04},
-	{0x5189, 0x00},
-	{0x518a, 0x04},
-	{0x518b, 0x00},
-	{0x5000, 0x06}, /*No lenc,WBC on*/
-	{0x4005, 0x18},
-	{0x4051, 0x8f},
-};
-
-
-static struct msm_camera_i2c_conf_array ov5647_init_conf[] = {
-	{&ov5647_recommend_settings[0],
-	ARRAY_SIZE(ov5647_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array ov5647_confs[] = {
-	{&ov5647_snap_settings[0],
-	ARRAY_SIZE(ov5647_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov5647_prev_settings[0],
-	ARRAY_SIZE(ov5647_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov5647_video_60fps_settings[0],
-	ARRAY_SIZE(ov5647_video_60fps_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov5647_video_90fps_settings[0],
-	ARRAY_SIZE(ov5647_video_90fps_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov5647_zsl_settings[0],
-	ARRAY_SIZE(ov5647_zsl_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct v4l2_subdev_info ov5647_subdev_info[] = {
-	{
-		.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
-		.colorspace = V4L2_COLORSPACE_JPEG,
-		.fmt    = 1,
-		.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_sensor_output_info_t ov5647_dimensions[] = {
-	{ /* For SNAPSHOT */
-		.x_output = 0xA30,  /*2608*/  /*for 5Mp*/
-		.y_output = 0x7A0,   /*1952*/
-		.line_length_pclk = 0xA8C,
-		.frame_length_lines = 0x7B0,
-		.vt_pixel_clk = 79704000,
-		.op_pixel_clk = 159408000,
-		.binning_factor = 0x0,
-	},
-	{ /* For PREVIEW */
-		.x_output = 0x500, /*1280*/
-		.y_output = 0x3C0, /*960*/
-		.line_length_pclk = 0x768,
-		.frame_length_lines = 0x3D8,
-		.vt_pixel_clk = 55969920,
-		.op_pixel_clk = 159408000,
-		.binning_factor = 0x0,
-	},
-	{ /* For 60fps */
-		.x_output = 0x280,  /*640*/
-		.y_output = 0x1E0,   /*480*/
-		.line_length_pclk = 0x73C,
-		.frame_length_lines = 0x1F8,
-		.vt_pixel_clk = 56004480,
-		.op_pixel_clk = 159408000,
-		.binning_factor = 0x0,
-	},
-	{ /* For 90fps */
-		.x_output = 0x280,  /*640*/
-		.y_output = 0x1E0,   /*480*/
-		.line_length_pclk = 0x73C,
-		.frame_length_lines = 0x1F8,
-		.vt_pixel_clk = 56004480,
-		.op_pixel_clk = 159408000,
-		.binning_factor = 0x0,
-	},
-	{ /* For ZSL */
-		.x_output = 0xA30,  /*2608*/  /*for 5Mp*/
-		.y_output = 0x7A0,   /*1952*/
-		.line_length_pclk = 0xA8C,
-		.frame_length_lines = 0x7B0,
-		.vt_pixel_clk = 79704000,
-		.op_pixel_clk = 159408000,
-		.binning_factor = 0x0,
-	},
-
-};
-
-static struct msm_sensor_output_reg_addr_t ov5647_reg_addr = {
-	.x_output = 0x3808,
-	.y_output = 0x380A,
-	.line_length_pclk = 0x380C,
-	.frame_length_lines = 0x380E,
-};
-
-static struct msm_sensor_id_info_t ov5647_id_info = {
-	.sensor_id_reg_addr = 0x300a,
-	.sensor_id = 0x5647,
-};
-
-static struct msm_sensor_exp_gain_info_t ov5647_exp_gain_info = {
-	.coarse_int_time_addr = 0x3500,
-	.global_gain_addr = 0x350A,
-	.vert_offset = 4,
-};
-
-void ov5647_sensor_reset_stream(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	msm_camera_i2c_write(
-		s_ctrl->sensor_i2c_client,
-		0x103, 0x1,
-		MSM_CAMERA_I2C_BYTE_DATA);
-}
-
-static int32_t ov5647_write_pict_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
-{
-
-	static uint16_t max_line = 1964;
-	uint8_t gain_lsb, gain_hsb;
-	u8 intg_time_hsb, intg_time_msb, intg_time_lsb;
-
-	gain_lsb = (uint8_t) (gain);
-	gain_hsb = (uint8_t)((gain & 0x300)>>8);
-
-	CDBG(KERN_ERR "snapshot exposure seting 0x%x, 0x%x, %d"
-		, gain, line, line);
-	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-	if (line > 1964) {
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines,
-			(uint8_t)((line+4) >> 8),
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines + 1,
-			(uint8_t)((line+4) & 0x00FF),
-			MSM_CAMERA_I2C_BYTE_DATA);
-		max_line = line + 4;
-	} else if (max_line > 1968) {
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines,
-			(uint8_t)(1968 >> 8),
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-		 msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines + 1,
-			(uint8_t)(1968 & 0x00FF),
-			MSM_CAMERA_I2C_BYTE_DATA);
-			max_line = 1968;
-	}
-
-
-	line = line<<4;
-	/* ov5647 need this operation */
-	intg_time_hsb = (u8)(line>>16);
-	intg_time_msb = (u8) ((line & 0xFF00) >> 8);
-	intg_time_lsb = (u8) (line & 0x00FF);
-
-	/* FIXME for BLC trigger */
-	/* Coarse Integration Time */
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-		intg_time_hsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr + 1,
-		intg_time_msb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr + 2,
-		intg_time_lsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* gain */
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr,
-		gain_hsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr + 1,
-		gain_lsb^0x1,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* Coarse Integration Time */
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-		intg_time_hsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr + 1,
-		intg_time_msb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr + 2,
-		intg_time_lsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* gain */
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr,
-		gain_hsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr + 1,
-		gain_lsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-
-	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	return 0;
-
-}
-
-
-static int32_t ov5647_write_prev_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
-						uint16_t gain,
-						uint32_t line,
-						int32_t luma_avg,
-						uint16_t fgain)
-{
-	u8 intg_time_hsb, intg_time_msb, intg_time_lsb;
-	uint8_t gain_lsb, gain_hsb;
-	uint32_t fl_lines = s_ctrl->curr_frame_length_lines;
-	uint8_t offset = s_ctrl->sensor_exp_gain_info->vert_offset;
-
-	CDBG(KERN_ERR "preview exposure setting 0x%x, 0x%x, %d",
-		 gain, line, line);
-
-	gain_lsb = (uint8_t) (gain);
-	gain_hsb = (uint8_t)((gain & 0x300)>>8);
-
-	fl_lines = (fl_lines * s_ctrl->fps_divider) / Q10;
-
-	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-
-	/* adjust frame rate */
-	if ((s_ctrl->curr_res < MSM_SENSOR_RES_2) &&
-		(line > (fl_lines - offset)))
-		fl_lines = line + offset;
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_output_reg_addr->frame_length_lines,
-		(uint8_t)(fl_lines >> 8),
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_output_reg_addr->frame_length_lines + 1,
-		(uint8_t)(fl_lines & 0x00FF),
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	line = line<<4;
-	/* ov5647 need this operation */
-	intg_time_hsb = (u8)(line>>16);
-	intg_time_msb = (u8) ((line & 0xFF00) >> 8);
-	intg_time_lsb = (u8) (line & 0x00FF);
-
-
-	/* Coarse Integration Time */
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-		intg_time_hsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr + 1,
-		intg_time_msb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr + 2,
-		intg_time_lsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* gain */
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr,
-		gain_hsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr + 1,
-		gain_lsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-
-	return 0;
-}
-
-static const struct i2c_device_id ov5647_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&ov5647_s_ctrl},
-	{ }
-};
-int32_t ov5647_sensor_i2c_probe(struct i2c_client *client,
-		const struct i2c_device_id *id)
-{
-	int32_t rc = 0;
-	struct msm_sensor_ctrl_t *s_ctrl;
-
-	rc = msm_sensor_i2c_probe(client, id);
-
-	if (client->dev.platform_data == NULL) {
-		pr_err("%s: NULL sensor data\n", __func__);
-		return -EFAULT;
-	}
-
-	s_ctrl = client->dev.platform_data;
-
-	return rc;
-}
-
-static struct i2c_driver ov5647_i2c_driver = {
-	.id_table = ov5647_i2c_id,
-	.probe  = ov5647_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-
-
-static struct msm_camera_i2c_client ov5647_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	return i2c_add_driver(&ov5647_i2c_driver);
-}
-
-static struct v4l2_subdev_core_ops ov5647_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops ov5647_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops ov5647_subdev_ops = {
-	.core = &ov5647_subdev_core_ops,
-	.video  = &ov5647_subdev_video_ops,
-};
-
-int32_t ov5647_sensor_power_down(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	struct msm_camera_sensor_info *info = NULL;
-	unsigned short rdata;
-	int rc;
-
-	info = s_ctrl->sensordata;
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		0x4202, 0xf,
-		MSM_CAMERA_I2C_BYTE_DATA);
-	msleep(20);
-	rc = msm_camera_i2c_read(s_ctrl->sensor_i2c_client, 0x3018,
-			&rdata, MSM_CAMERA_I2C_WORD_DATA);
-	CDBG("ov5647_sensor_power_down: %d\n", rc);
-	rdata |= 0x18;
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		0x3018, rdata,
-		MSM_CAMERA_I2C_WORD_DATA);
-	msleep(20);
-	gpio_direction_output(info->sensor_pwd, 1);
-	usleep_range(5000, 5100);
-	msm_sensor_power_down(s_ctrl);
-	return 0;
-}
-
-int32_t ov5647_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	int32_t rc = 0;
-	struct msm_camera_sensor_info *info = NULL;
-
-	info = s_ctrl->sensordata;
-	gpio_direction_output(info->sensor_pwd, 1);
-	gpio_direction_output(info->sensor_reset, 0);
-	usleep_range(10000, 11000);
-	rc = msm_sensor_power_up(s_ctrl);
-	if (rc < 0) {
-		CDBG("%s: msm_sensor_power_up failed\n", __func__);
-		return rc;
-	}
-
-	/* turn on ldo and vreg */
-
-	gpio_direction_output(info->sensor_pwd, 0);
-	msleep(20);
-	gpio_direction_output(info->sensor_reset, 1);
-	msleep(25);
-
-	return rc;
-
-}
-
-static int32_t vfe_clk = 266667000;
-
-static void ov5647_stop_stream(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	msm_camera_i2c_write_tbl(
-		s_ctrl->sensor_i2c_client,
-		s_ctrl->msm_sensor_reg->stop_stream_conf,
-		s_ctrl->msm_sensor_reg->stop_stream_conf_size,
-		s_ctrl->msm_sensor_reg->default_data_type);
-
-	if (s_ctrl->curr_res == MSM_SENSOR_RES_FULL)
-		msleep(66);
-	else
-		msleep(266);
-
-	msm_camera_i2c_write(
-			s_ctrl->sensor_i2c_client,
-			0x4800, 0x25,
-			MSM_CAMERA_I2C_BYTE_DATA);
-}
-
-int32_t ov5647_sensor_setting(struct msm_sensor_ctrl_t *s_ctrl,
-			int update_type, int res)
-{
-	int32_t rc = 0;
-	if (update_type == MSM_SENSOR_REG_INIT) {
-		CDBG("Register INIT\n");
-		s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
-		msm_camera_i2c_write(
-				s_ctrl->sensor_i2c_client,
-				0x103, 0x1,
-				MSM_CAMERA_I2C_BYTE_DATA);
-		msm_sensor_enable_debugfs(s_ctrl);
-		msm_sensor_write_init_settings(s_ctrl);
-	} else if (update_type == MSM_SENSOR_UPDATE_PERIODIC) {
-		CDBG("PERIODIC : %d\n", res);
-		msm_sensor_write_conf_array(
-			s_ctrl->sensor_i2c_client,
-			s_ctrl->msm_sensor_reg->mode_settings, res);
-		msleep(30);
-		msm_camera_i2c_write(
-			s_ctrl->sensor_i2c_client,
-			0x100, 0x1,
-			MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(
-			s_ctrl->sensor_i2c_client,
-			0x4800, 0x4,
-			MSM_CAMERA_I2C_BYTE_DATA);
-		msleep(266);
-		if (res == MSM_SENSOR_RES_4)
-			v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-					NOTIFY_PCLK_CHANGE,
-					&vfe_clk);
-	}
-	return rc;
-}
-static struct msm_sensor_fn_t ov5647_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = ov5647_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = ov5647_write_prev_exp_gain,
-	.sensor_write_snapshot_exp_gain = ov5647_write_pict_exp_gain,
-	.sensor_csi_setting = ov5647_sensor_setting,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = ov5647_sensor_power_up,
-	.sensor_power_down = ov5647_sensor_power_down,
-};
-
-static struct msm_sensor_reg_t ov5647_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = ov5647_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(ov5647_start_settings),
-	.stop_stream_conf = ov5647_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(ov5647_stop_settings),
-	.group_hold_on_conf = ov5647_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(ov5647_groupon_settings),
-	.group_hold_off_conf = ov5647_groupoff_settings,
-	.group_hold_off_conf_size =
-		ARRAY_SIZE(ov5647_groupoff_settings),
-	.init_settings = &ov5647_init_conf[0],
-	.init_size = ARRAY_SIZE(ov5647_init_conf),
-	.mode_settings = &ov5647_confs[0],
-	.output_settings = &ov5647_dimensions[0],
-	.num_conf = ARRAY_SIZE(ov5647_confs),
-};
-
-static struct msm_sensor_ctrl_t ov5647_s_ctrl = {
-	.msm_sensor_reg = &ov5647_regs,
-	.sensor_i2c_client = &ov5647_sensor_i2c_client,
-	.sensor_i2c_addr =  0x36 << 1 ,
-	.sensor_output_reg_addr = &ov5647_reg_addr,
-	.sensor_id_info = &ov5647_id_info,
-	.sensor_exp_gain_info = &ov5647_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &ov5647_mut,
-	.sensor_i2c_driver = &ov5647_i2c_driver,
-	.sensor_v4l2_subdev_info = ov5647_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(ov5647_subdev_info),
-	.sensor_v4l2_subdev_ops = &ov5647_subdev_ops,
-	.func_tbl = &ov5647_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Omnivision WXGA Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/ov7692_v4l2.c b/drivers/media/video/msm/sensors/ov7692_v4l2.c
deleted file mode 100644
index efc78f8..0000000
--- a/drivers/media/video/msm/sensors/ov7692_v4l2.c
+++ /dev/null
@@ -1,926 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#define SENSOR_NAME "ov7692"
-
-DEFINE_MUTEX(ov7692_mut);
-static struct msm_sensor_ctrl_t ov7692_s_ctrl;
-
-static int effect_value = CAMERA_EFFECT_OFF;
-static unsigned int SAT_U = 0x80; /* DEFAULT SATURATION VALUES*/
-static unsigned int SAT_V = 0x80; /* DEFAULT SATURATION VALUES*/
-
-static struct msm_camera_i2c_reg_conf ov7692_start_settings[] = {
-	{0x0e, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf ov7692_stop_settings[] = {
-	{0x0e, 0x08},
-};
-
-static struct msm_camera_i2c_reg_conf ov7692_recommend_settings[] = {
-	{0x12, 0x80},
-	{0x0e, 0x08},
-	{0x69, 0x52},
-	{0x1e, 0xb3},
-	{0x48, 0x42},
-	{0xff, 0x01},
-	{0xae, 0xa0},
-	{0xa8, 0x26},
-	{0xb4, 0xc0},
-	{0xb5, 0x40},
-	{0xff, 0x00},
-	{0x0c, 0x00},
-	{0x62, 0x10},
-	{0x12, 0x00},
-	{0x17, 0x65},
-	{0x18, 0xa4},
-	{0x19, 0x0a},
-	{0x1a, 0xf6},
-	{0x3e, 0x30},
-	{0x64, 0x0a},
-	{0xff, 0x01},
-	{0xb4, 0xc0},
-	{0xff, 0x00},
-	{0x67, 0x20},
-	{0x81, 0x3f},
-	{0xd0, 0x48},
-	{0x82, 0x03},
-	{0x70, 0x00},
-	{0x71, 0x34},
-	{0x74, 0x28},
-	{0x75, 0x98},
-	{0x76, 0x00},
-	{0x77, 0x64},
-	{0x78, 0x01},
-	{0x79, 0xc2},
-	{0x7a, 0x4e},
-	{0x7b, 0x1f},
-	{0x7c, 0x00},
-	{0x11, 0x00},
-	{0x20, 0x00},
-	{0x21, 0x23},
-	{0x50, 0x9a},
-	{0x51, 0x80},
-	{0x4c, 0x7d},
-	{0x85, 0x10},
-	{0x86, 0x00},
-	{0x87, 0x00},
-	{0x88, 0x00},
-	{0x89, 0x2a},
-	{0x8a, 0x26},
-	{0x8b, 0x22},
-	{0xbb, 0x7a},
-	{0xbc, 0x69},
-	{0xbd, 0x11},
-	{0xbe, 0x13},
-	{0xbf, 0x81},
-	{0xc0, 0x96},
-	{0xc1, 0x1e},
-	{0xb7, 0x05},
-	{0xb8, 0x09},
-	{0xb9, 0x00},
-	{0xba, 0x18},
-	{0x5a, 0x1f},
-	{0x5b, 0x9f},
-	{0x5c, 0x6a},
-	{0x5d, 0x42},
-	{0x24, 0x78},
-	{0x25, 0x68},
-	{0x26, 0xb3},
-	{0xa3, 0x0b},
-	{0xa4, 0x15},
-	{0xa5, 0x2a},
-	{0xa6, 0x51},
-	{0xa7, 0x63},
-	{0xa8, 0x74},
-	{0xa9, 0x83},
-	{0xaa, 0x91},
-	{0xab, 0x9e},
-	{0xac, 0xaa},
-	{0xad, 0xbe},
-	{0xae, 0xce},
-	{0xaf, 0xe5},
-	{0xb0, 0xf3},
-	{0xb1, 0xfb},
-	{0xb2, 0x06},
-	{0x8c, 0x5c},
-	{0x8d, 0x11},
-	{0x8e, 0x12},
-	{0x8f, 0x19},
-	{0x90, 0x50},
-	{0x91, 0x20},
-	{0x92, 0x96},
-	{0x93, 0x80},
-	{0x94, 0x13},
-	{0x95, 0x1b},
-	{0x96, 0xff},
-	{0x97, 0x00},
-	{0x98, 0x3d},
-	{0x99, 0x36},
-	{0x9a, 0x51},
-	{0x9b, 0x43},
-	{0x9c, 0xf0},
-	{0x9d, 0xf0},
-	{0x9e, 0xf0},
-	{0x9f, 0xff},
-	{0xa0, 0x68},
-	{0xa1, 0x62},
-	{0xa2, 0x0e},
-};
-
-static struct msm_camera_i2c_reg_conf ov7692_full_settings[] = {
-	{0xcc, 0x02},
-	{0xcd, 0x80},
-	{0xce, 0x01},
-	{0xcf, 0xe0},
-	{0xc8, 0x02},
-	{0xc9, 0x80},
-	{0xca, 0x01},
-	{0xcb, 0xe0},
-};
-
-static struct v4l2_subdev_info ov7692_subdev_info[] = {
-	{
-		.code   = V4L2_MBUS_FMT_YUYV8_2X8,
-		.colorspace = V4L2_COLORSPACE_JPEG,
-		.fmt    = 1,
-		.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-
-static struct msm_camera_i2c_conf_array ov7692_init_conf[] = {
-	{&ov7692_recommend_settings[0],
-	ARRAY_SIZE(ov7692_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array ov7692_confs[] = {
-	{&ov7692_full_settings[0],
-	ARRAY_SIZE(ov7692_full_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_camera_i2c_reg_conf ov7692_saturation[][4] = {
-	{{0x81, 0x33, 0x00, 0x00, 0xCC}, {0xd8, 0x00, 0x00, 0x00, 0x00},
-		{0xd9, 0x00, 0x00, 0x00, 0x00},
-		{0xd2, 0x02, 0x00, 0x00, 0x00},},/* SATURATION LEVEL0*/
-	{{0x81, 0x33, 0x00, 0x00, 0xCC}, {0xd8, 0x10, 0x00, 0x00, 0x00},
-		{0xd9, 0x10, 0x00, 0x00, 0x00},
-		{0xd2, 0x02, 0x00, 0x00, 0x00},},	/* SATURATION LEVEL1*/
-	{{0x81, 0x33, 0x00, 0x00, 0xCC}, {0xd8, 0x20, 0x00, 0x00, 0x00},
-		{0xd9, 0x20, 0x00, 0x00, 0x00},
-		{0xd2, 0x02, 0x00, 0x00, 0x00},},	/* SATURATION LEVEL2*/
-	{{0x81, 0x33, 0x00, 0x00, 0xCC}, {0xd8, 0x30, 0x00, 0x00, 0x00},
-		{0xd9, 0x30, 0x00, 0x00, 0x00},
-		{0xd2, 0x02, 0x00, 0x00, 0x00},},	/* SATURATION LEVEL3*/
-	{{0x81, 0x33, 0x00, 0x00, 0xCC}, {0xd8, 0x40, 0x00, 0x00, 0x00},
-		{0xd9, 0x40, 0x00, 0x00, 0x00},
-		{0xd2, 0x02, 0x00, 0x00, 0x00},},	/* SATURATION LEVEL4*/
-	{{0x81, 0x33, 0x00, 0x00, 0xCC}, {0xd8, 0x50, 0x00, 0x00, 0x00},
-		{0xd9, 0x50, 0x00, 0x00, 0x00},
-		{0xd2, 0x02, 0x00, 0x00, 0x00},},	/* SATURATION LEVEL5*/
-	{{0x81, 0x33, 0x00, 0x00, 0xCC}, {0xd8, 0x60, 0x00, 0x00, 0x00},
-		{0xd9, 0x60, 0x00, 0x00, 0x00},
-		{0xd2, 0x02, 0x00, 0x00, 0x00},},	/* SATURATION LEVEL6*/
-	{{0x81, 0x33, 0x00, 0x00, 0xCC}, {0xd8, 0x70, 0x00, 0x00, 0x00},
-		{0xd9, 0x70, 0x00, 0x00, 0x00},
-		{0xd2, 0x02, 0x00, 0x00, 0x00},},	/* SATURATION LEVEL7*/
-	{{0x81, 0x33, 0x00, 0x00, 0xCC}, {0xd8, 0x80, 0x00, 0x00, 0x00},
-		{0xd9, 0x80, 0x00, 0x00, 0x00},
-		{0xd2, 0x02, 0x00, 0x00, 0x00},},	/* SATURATION LEVEL8*/
-};
-static struct msm_camera_i2c_conf_array ov7692_saturation_confs[][1] = {
-	{{ov7692_saturation[0], ARRAY_SIZE(ov7692_saturation[0]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_saturation[1], ARRAY_SIZE(ov7692_saturation[1]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_saturation[2], ARRAY_SIZE(ov7692_saturation[2]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_saturation[3], ARRAY_SIZE(ov7692_saturation[3]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_saturation[4], ARRAY_SIZE(ov7692_saturation[4]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_saturation[5], ARRAY_SIZE(ov7692_saturation[5]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_saturation[6], ARRAY_SIZE(ov7692_saturation[6]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_saturation[7], ARRAY_SIZE(ov7692_saturation[7]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_saturation[8], ARRAY_SIZE(ov7692_saturation[8]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-};
-
-static int ov7692_saturation_enum_map[] = {
-	MSM_V4L2_SATURATION_L0,
-	MSM_V4L2_SATURATION_L1,
-	MSM_V4L2_SATURATION_L2,
-	MSM_V4L2_SATURATION_L3,
-	MSM_V4L2_SATURATION_L4,
-	MSM_V4L2_SATURATION_L5,
-	MSM_V4L2_SATURATION_L6,
-	MSM_V4L2_SATURATION_L7,
-	MSM_V4L2_SATURATION_L8,
-};
-static struct msm_sensor_output_info_t ov7692_dimensions[] = {
-	{
-		.x_output = 0x280,
-		.y_output = 0x1E0,
-		.line_length_pclk = 0x290,
-		.frame_length_lines = 0x1EC,
-		.vt_pixel_clk = 9216000,
-		.op_pixel_clk = 9216000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_camera_i2c_enum_conf_array ov7692_saturation_enum_confs = {
-	.conf = &ov7692_saturation_confs[0][0],
-	.conf_enum = ov7692_saturation_enum_map,
-	.num_enum = ARRAY_SIZE(ov7692_saturation_enum_map),
-	.num_index = ARRAY_SIZE(ov7692_saturation_confs),
-	.num_conf = ARRAY_SIZE(ov7692_saturation_confs[0]),
-	.data_type = MSM_CAMERA_I2C_BYTE_DATA,
-};
-
-static struct msm_camera_i2c_reg_conf ov7692_contrast[][16] = {
-	{{0xb2, 0x29}, {0xa3, 0x55}, {0xa4, 0x5b}, {0xa5, 0x67}, {0xa6, 0x7e},
-		{0xa7, 0x89}, {0xa8, 0x93}, {0xa9, 0x9c}, {0xaa, 0xa4},
-		{0xab, 0xac}, {0xac, 0xb3}, {0xad, 0xbe}, {0xae, 0xc7},
-		{0xaf, 0xd5}, {0xb0, 0xdd}, {0xb1, 0xe1},},	/* CONTRAST L0*/
-	{{0xb2, 0x20}, {0xa3, 0x43}, {0xa4, 0x4a}, {0xa5, 0x58}, {0xa6, 0x73},
-		{0xa7, 0x80}, {0xa8, 0x8b}, {0xa9, 0x96}, {0xaa, 0x9f},
-		{0xab, 0xa8}, {0xac, 0xb1}, {0xad, 0xbe}, {0xae, 0xc9},
-		{0xaf, 0xd8}, {0xb0, 0xe2}, {0xb1, 0xe8},},	/* CONTRAST L1*/
-	{{0xb2, 0x18}, {0xa3, 0x31}, {0xa4, 0x39}, {0xa5, 0x4a}, {0xa6, 0x68},
-		{0xa7, 0x77}, {0xa8, 0x84}, {0xa9, 0x90}, {0xaa, 0x9b},
-		{0xab, 0xa5}, {0xac, 0xaf}, {0xad, 0xbe}, {0xae, 0xca},
-		{0xaf, 0xdc}, {0xb0, 0xe7}, {0xb1, 0xee},},	/* CONTRAST L2*/
-	{{0xb2, 0x10}, {0xa3, 0x1f}, {0xa4, 0x28}, {0xa5, 0x3b}, {0xa6, 0x5d},
-		{0xa7, 0x6e}, {0xa8, 0x7d}, {0xa9, 0x8a}, {0xaa, 0x96},
-		{0xab, 0xa2}, {0xac, 0xad}, {0xad, 0xbe}, {0xae, 0xcc},
-		{0xaf, 0xe0}, {0xb0, 0xed}, {0xb1, 0xf4},},	/* CONTRAST L3*/
-	 {{0xb2, 0x6}, {0xa3, 0xb}, {0xa4, 0x15}, {0xa5, 0x2a}, {0xa6, 0x51},
-		{0xa7, 0x63}, {0xa8, 0x74}, {0xa9, 0x83}, {0xaa, 0x91},
-		{0xab, 0x9e}, {0xac, 0xaa}, {0xad, 0xbe}, {0xae, 0xce},
-		{0xaf, 0xe5}, {0xb0, 0xf3}, {0xb1, 0xfb},},	/* CONTRAST L4*/
-	{{0xb2, 0xc}, {0xa3, 0x4}, {0xa4, 0xc}, {0xa5, 0x1f}, {0xa6, 0x45},
-		{0xa7, 0x58}, {0xa8, 0x6b}, {0xa9, 0x7c}, {0xaa, 0x8d},
-		{0xab, 0x9d}, {0xac, 0xac}, {0xad, 0xc3}, {0xae, 0xd2},
-		{0xaf, 0xe8}, {0xb0, 0xf2}, {0xb1, 0xf7},},	/* CONTRAST L5*/
-	{{0xb2, 0x1}, {0xa3, 0x2}, {0xa4, 0x9}, {0xa5, 0x1a}, {0xa6, 0x3e},
-		{0xa7, 0x4a}, {0xa8, 0x59}, {0xa9, 0x6a}, {0xaa, 0x79},
-		{0xab, 0x8e}, {0xac, 0xa4}, {0xad, 0xc1}, {0xae, 0xdb},
-		{0xaf, 0xf4}, {0xb0, 0xff}, {0xb1, 0xff},},	/* CONTRAST L6*/
-	{{0xb2, 0xc}, {0xa3, 0x4}, {0xa4, 0x8}, {0xa5, 0x17}, {0xa6, 0x27},
-		{0xa7, 0x3d}, {0xa8, 0x54}, {0xa9, 0x60}, {0xaa, 0x77},
-		{0xab, 0x85}, {0xac, 0xa4}, {0xad, 0xc6}, {0xae, 0xd2},
-		{0xaf, 0xe9}, {0xb0, 0xf0}, {0xb1, 0xf7},},	/* CONTRAST L7*/
-	{{0xb2, 0x1}, {0xa3, 0x4}, {0xa4, 0x4}, {0xa5, 0x7}, {0xa6, 0xb},
-		{0xa7, 0x17}, {0xa8, 0x2a}, {0xa9, 0x41}, {0xaa, 0x59},
-		{0xab, 0x6b}, {0xac, 0x8b}, {0xad, 0xb1}, {0xae, 0xd2},
-		{0xaf, 0xea}, {0xb0, 0xf4}, {0xb1, 0xff},},	/* CONTRAST L8*/
-};
-
-static struct msm_camera_i2c_conf_array ov7692_contrast_confs[][1] = {
-	{{ov7692_contrast[0], ARRAY_SIZE(ov7692_contrast[0]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_contrast[1], ARRAY_SIZE(ov7692_contrast[1]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_contrast[2], ARRAY_SIZE(ov7692_contrast[2]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_contrast[3], ARRAY_SIZE(ov7692_contrast[3]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_contrast[4], ARRAY_SIZE(ov7692_contrast[4]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_contrast[5], ARRAY_SIZE(ov7692_contrast[5]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_contrast[6], ARRAY_SIZE(ov7692_contrast[6]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_contrast[7], ARRAY_SIZE(ov7692_contrast[7]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_contrast[8], ARRAY_SIZE(ov7692_contrast[8]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-};
-
-
-static int ov7692_contrast_enum_map[] = {
-	MSM_V4L2_CONTRAST_L0,
-	MSM_V4L2_CONTRAST_L1,
-	MSM_V4L2_CONTRAST_L2,
-	MSM_V4L2_CONTRAST_L3,
-	MSM_V4L2_CONTRAST_L4,
-	MSM_V4L2_CONTRAST_L5,
-	MSM_V4L2_CONTRAST_L6,
-	MSM_V4L2_CONTRAST_L7,
-	MSM_V4L2_CONTRAST_L8,
-};
-
-static struct msm_camera_i2c_enum_conf_array ov7692_contrast_enum_confs = {
-	.conf = &ov7692_contrast_confs[0][0],
-	.conf_enum = ov7692_contrast_enum_map,
-	.num_enum = ARRAY_SIZE(ov7692_contrast_enum_map),
-	.num_index = ARRAY_SIZE(ov7692_contrast_confs),
-	.num_conf = ARRAY_SIZE(ov7692_contrast_confs[0]),
-	.data_type = MSM_CAMERA_I2C_BYTE_DATA,
-};
-static struct msm_camera_i2c_reg_conf ov7692_sharpness[][2] = {
-	{{0xb4, 0x20, 0x00, 0x00, 0xDF},
-		{0xb6, 0x00, 0x00, 0x00, 0xE0},},    /* SHARPNESS LEVEL 0*/
-	{{0xb4, 0x20, 0x00, 0x00, 0xDF},
-		{0xb6, 0x01, 0x00, 0x00, 0xE0},},    /* SHARPNESS LEVEL 1*/
-	{{0xb4, 0x00, 0x00, 0x00, 0xDF},
-		{0xb6, 0x00, 0x00, 0x00, 0xE0},},    /* SHARPNESS LEVEL 2*/
-	{{0xb4, 0x20, 0x00, 0x00, 0xDF},
-		{0xb6, 0x66, 0x00, 0x00, 0xE0},},    /* SHARPNESS LEVEL 3*/
-	{{0xb4, 0x20, 0x00, 0x00, 0xDF},
-		{0xb6, 0x99, 0x00, 0x00, 0xE0},},    /* SHARPNESS LEVEL 4*/
-	{{0xb4, 0x20, 0x00, 0x00, 0xDF},
-		{0xb6, 0xcc, 0x00, 0x00, 0xE0},},    /* SHARPNESS LEVEL 5*/
-};
-
-static struct msm_camera_i2c_conf_array ov7692_sharpness_confs[][1] = {
-	{{ov7692_sharpness[0], ARRAY_SIZE(ov7692_sharpness[0]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_sharpness[1], ARRAY_SIZE(ov7692_sharpness[1]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_sharpness[2], ARRAY_SIZE(ov7692_sharpness[2]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_sharpness[3], ARRAY_SIZE(ov7692_sharpness[3]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_sharpness[4], ARRAY_SIZE(ov7692_sharpness[4]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_sharpness[5], ARRAY_SIZE(ov7692_sharpness[5]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-};
-
-static int ov7692_sharpness_enum_map[] = {
-	MSM_V4L2_SHARPNESS_L0,
-	MSM_V4L2_SHARPNESS_L1,
-	MSM_V4L2_SHARPNESS_L2,
-	MSM_V4L2_SHARPNESS_L3,
-	MSM_V4L2_SHARPNESS_L4,
-	MSM_V4L2_SHARPNESS_L5,
-};
-
-static struct msm_camera_i2c_enum_conf_array ov7692_sharpness_enum_confs = {
-	.conf = &ov7692_sharpness_confs[0][0],
-	.conf_enum = ov7692_sharpness_enum_map,
-	.num_enum = ARRAY_SIZE(ov7692_sharpness_enum_map),
-	.num_index = ARRAY_SIZE(ov7692_sharpness_confs),
-	.num_conf = ARRAY_SIZE(ov7692_sharpness_confs[0]),
-	.data_type = MSM_CAMERA_I2C_BYTE_DATA,
-};
-
-static struct msm_camera_i2c_reg_conf ov7692_exposure[][3] = {
-	{{0x24, 0x50}, {0x25, 0x40}, {0x26, 0xa2},}, /*EXPOSURECOMPENSATIONN2*/
-	{{0x24, 0x70}, {0x25, 0x60}, {0x26, 0xa2},}, /*EXPOSURECOMPENSATIONN1*/
-	{{0x24, 0x86}, {0x25, 0x76}, {0x26, 0xb3},}, /*EXPOSURECOMPENSATIOND*/
-	{{0x24, 0xa8}, {0x25, 0xa0}, {0x26, 0xc4},}, /*EXPOSURECOMPENSATIONp1*/
-	{{0x24, 0xc0}, {0x25, 0xb8}, {0x26, 0xe6},}, /*EXPOSURECOMPENSATIONP2*/
-};
-
-static struct msm_camera_i2c_conf_array ov7692_exposure_confs[][1] = {
-	{{ov7692_exposure[0], ARRAY_SIZE(ov7692_exposure[0]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_exposure[1], ARRAY_SIZE(ov7692_exposure[1]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_exposure[2], ARRAY_SIZE(ov7692_exposure[2]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_exposure[3], ARRAY_SIZE(ov7692_exposure[3]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_exposure[4], ARRAY_SIZE(ov7692_exposure[4]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-};
-
-static int ov7692_exposure_enum_map[] = {
-	MSM_V4L2_EXPOSURE_N2,
-	MSM_V4L2_EXPOSURE_N1,
-	MSM_V4L2_EXPOSURE_D,
-	MSM_V4L2_EXPOSURE_P1,
-	MSM_V4L2_EXPOSURE_P2,
-};
-
-static struct msm_camera_i2c_enum_conf_array ov7692_exposure_enum_confs = {
-	.conf = &ov7692_exposure_confs[0][0],
-	.conf_enum = ov7692_exposure_enum_map,
-	.num_enum = ARRAY_SIZE(ov7692_exposure_enum_map),
-	.num_index = ARRAY_SIZE(ov7692_exposure_confs),
-	.num_conf = ARRAY_SIZE(ov7692_exposure_confs[0]),
-	.data_type = MSM_CAMERA_I2C_BYTE_DATA,
-};
-
-static struct msm_camera_i2c_reg_conf ov7692_iso[][1] = {
-	{{0x14, 0x20, 0x00, 0x00, 0x8F},},   /*ISO_AUTO*/
-	{{0x14, 0x20, 0x00, 0x00, 0x8F},},   /*ISO_DEBLUR*/
-	{{0x14, 0x00, 0x00, 0x00, 0x8F},},   /*ISO_100*/
-	{{0x14, 0x10, 0x00, 0x00, 0x8F},},   /*ISO_200*/
-	{{0x14, 0x20, 0x00, 0x00, 0x8F},},   /*ISO_400*/
-	{{0x14, 0x30, 0x00, 0x00, 0x8F},},   /*ISO_800*/
-	{{0x14, 0x40, 0x00, 0x00, 0x8F},},   /*ISO_1600*/
-};
-
-
-static struct msm_camera_i2c_conf_array ov7692_iso_confs[][1] = {
-	{{ov7692_iso[0], ARRAY_SIZE(ov7692_iso[0]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_iso[1], ARRAY_SIZE(ov7692_iso[1]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_iso[2], ARRAY_SIZE(ov7692_iso[2]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_iso[3], ARRAY_SIZE(ov7692_iso[3]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_iso[4], ARRAY_SIZE(ov7692_iso[4]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_iso[5], ARRAY_SIZE(ov7692_iso[5]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-};
-
-static int ov7692_iso_enum_map[] = {
-	MSM_V4L2_ISO_AUTO ,
-	MSM_V4L2_ISO_DEBLUR,
-	MSM_V4L2_ISO_100,
-	MSM_V4L2_ISO_200,
-	MSM_V4L2_ISO_400,
-	MSM_V4L2_ISO_800,
-	MSM_V4L2_ISO_1600,
-};
-
-
-static struct msm_camera_i2c_enum_conf_array ov7692_iso_enum_confs = {
-	.conf = &ov7692_iso_confs[0][0],
-	.conf_enum = ov7692_iso_enum_map,
-	.num_enum = ARRAY_SIZE(ov7692_iso_enum_map),
-	.num_index = ARRAY_SIZE(ov7692_iso_confs),
-	.num_conf = ARRAY_SIZE(ov7692_iso_confs[0]),
-	.data_type = MSM_CAMERA_I2C_BYTE_DATA,
-};
-
-static struct msm_camera_i2c_reg_conf ov7692_no_effect[] = {
-	{0x81, 0x00, 0x00, 0x00, 0xDF},
-	{0x28, 0x00,},
-	{0xd2, 0x00,},
-	{0xda, 0x80,},
-	{0xdb, 0x80,},
-};
-
-static struct msm_camera_i2c_conf_array ov7692_no_effect_confs[] = {
-	{&ov7692_no_effect[0],
-	ARRAY_SIZE(ov7692_no_effect), 0,
-	MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},
-};
-
-static struct msm_camera_i2c_reg_conf ov7692_special_effect[][5] = {
-	{{0x81, 0x20, 0x00, 0x00, 0xDF}, {0x28, 0x00,}, {0xd2, 0x18,},
-		{0xda, 0x80,}, {0xdb, 0x80,},},	/*for special effect OFF*/
-	{{0x81, 0x20, 0x00, 0x00, 0xDF}, {0x28, 0x00,}, {0xd2, 0x18,},
-		{0xda, 0x80,}, {0xdb, 0x80,},},	/*for special effect MONO*/
-	{{0x81, 0x20, 0x00, 0x00, 0xDF}, {0x28, 0x80,}, {0xd2, 0x40,},
-		{0xda, 0x80,}, {0xdb, 0x80,},},	/*for special efefct Negative*/
-	{{-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},},/*Solarize is not supported by sensor*/
-	{{0x81, 0x20, 0x00, 0x00, 0xDF}, {0x28, 0x00,}, {0xd2, 0x18,},
-		{0xda, 0x40,}, {0xdb, 0xa0,},},	/*for sepia*/
-	{{-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},},		/* Posteraize not supported */
-	{{-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},},		/* White board not supported*/
-	{{-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},},		/*Blackboard not supported*/
-	{{-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},},		/*Aqua not supported*/
-	{{-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},},		/*Emboss not supported */
-	{{-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},},		/*sketch not supported*/
-	{{-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},},		/*Neon not supported*/
-	{{-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},},		/*MAX value*/
-};
-
-static struct msm_camera_i2c_conf_array ov7692_special_effect_confs[][1] = {
-	{{ov7692_special_effect[0],  ARRAY_SIZE(ov7692_special_effect[0]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[1],  ARRAY_SIZE(ov7692_special_effect[1]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[2],  ARRAY_SIZE(ov7692_special_effect[2]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[3],  ARRAY_SIZE(ov7692_special_effect[3]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[4],  ARRAY_SIZE(ov7692_special_effect[4]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[5],  ARRAY_SIZE(ov7692_special_effect[5]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[6],  ARRAY_SIZE(ov7692_special_effect[6]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[7],  ARRAY_SIZE(ov7692_special_effect[7]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[8],  ARRAY_SIZE(ov7692_special_effect[8]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[9],  ARRAY_SIZE(ov7692_special_effect[9]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[10], ARRAY_SIZE(ov7692_special_effect[10]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[11], ARRAY_SIZE(ov7692_special_effect[11]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_special_effect[12], ARRAY_SIZE(ov7692_special_effect[12]), 0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-};
-
-static int ov7692_special_effect_enum_map[] = {
-	MSM_V4L2_EFFECT_OFF,
-	MSM_V4L2_EFFECT_MONO,
-	MSM_V4L2_EFFECT_NEGATIVE,
-	MSM_V4L2_EFFECT_SOLARIZE,
-	MSM_V4L2_EFFECT_SEPIA,
-	MSM_V4L2_EFFECT_POSTERAIZE,
-	MSM_V4L2_EFFECT_WHITEBOARD,
-	MSM_V4L2_EFFECT_BLACKBOARD,
-	MSM_V4L2_EFFECT_AQUA,
-	MSM_V4L2_EFFECT_EMBOSS,
-	MSM_V4L2_EFFECT_SKETCH,
-	MSM_V4L2_EFFECT_NEON,
-	MSM_V4L2_EFFECT_MAX,
-};
-
-static struct msm_camera_i2c_enum_conf_array
-		 ov7692_special_effect_enum_confs = {
-	.conf = &ov7692_special_effect_confs[0][0],
-	.conf_enum = ov7692_special_effect_enum_map,
-	.num_enum = ARRAY_SIZE(ov7692_special_effect_enum_map),
-	.num_index = ARRAY_SIZE(ov7692_special_effect_confs),
-	.num_conf = ARRAY_SIZE(ov7692_special_effect_confs[0]),
-	.data_type = MSM_CAMERA_I2C_BYTE_DATA,
-};
-
-static struct msm_camera_i2c_reg_conf ov7692_antibanding[][2] = {
-	{{0x13, 0x20, 0x00, 0x00, 0xDF},
-		{0x14, 0x16, 0x00, 0x00, 0xE8},},   /*ANTIBANDING 60HZ*/
-	{{0x13, 0x20, 0x00, 0x00, 0xDF},
-		{0x14, 0x17, 0x00, 0x00, 0xE8},},   /*ANTIBANDING 50HZ*/
-	{{0x13, 0x20, 0x00, 0x00, 0xDF},
-		{0x14, 0x14, 0x00, 0x00, 0xE8},},   /* ANTIBANDING AUTO*/
-};
-
-
-static struct msm_camera_i2c_conf_array ov7692_antibanding_confs[][1] = {
-	{{ov7692_antibanding[0], ARRAY_SIZE(ov7692_antibanding[0]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_antibanding[1], ARRAY_SIZE(ov7692_antibanding[1]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_antibanding[2], ARRAY_SIZE(ov7692_antibanding[2]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-};
-
-static int ov7692_antibanding_enum_map[] = {
-	MSM_V4L2_POWER_LINE_60HZ,
-	MSM_V4L2_POWER_LINE_50HZ,
-	MSM_V4L2_POWER_LINE_AUTO,
-};
-
-
-static struct msm_camera_i2c_enum_conf_array ov7692_antibanding_enum_confs = {
-	.conf = &ov7692_antibanding_confs[0][0],
-	.conf_enum = ov7692_antibanding_enum_map,
-	.num_enum = ARRAY_SIZE(ov7692_antibanding_enum_map),
-	.num_index = ARRAY_SIZE(ov7692_antibanding_confs),
-	.num_conf = ARRAY_SIZE(ov7692_antibanding_confs[0]),
-	.data_type = MSM_CAMERA_I2C_BYTE_DATA,
-};
-
-static struct msm_camera_i2c_reg_conf ov7692_wb_oem[][4] = {
-	{{-1, -1, -1, -1 , -1}, {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},},/*WHITEBALNACE OFF*/
-	{{0x13, 0xf7}, {0x15, 0x00}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},}, /*WHITEBALNACE AUTO*/
-	{{0x13, 0xf5}, {0x01, 0x56}, {0x02, 0x50},
-		{0x15, 0x00},},	/*WHITEBALNACE CUSTOM*/
-	{{0x13, 0xf5}, {0x01, 0x66}, {0x02, 0x40},
-		{0x15, 0x00},},	/*INCANDISCENT*/
-	{{-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1},
-		{-1, -1, -1, -1, -1},},	/*FLOURESECT NOT SUPPORTED */
-	{{0x13, 0xf5}, {0x01, 0x43}, {0x02, 0x5d},
-		{0x15, 0x00},},	/*DAYLIGHT*/
-	{{0x13, 0xf5}, {0x01, 0x48}, {0x02, 0x63},
-		{0x15, 0x00},},	/*CLOUDY*/
-};
-
-static struct msm_camera_i2c_conf_array ov7692_wb_oem_confs[][1] = {
-	{{ov7692_wb_oem[0], ARRAY_SIZE(ov7692_wb_oem[0]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_wb_oem[1], ARRAY_SIZE(ov7692_wb_oem[1]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_wb_oem[2], ARRAY_SIZE(ov7692_wb_oem[2]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_wb_oem[3], ARRAY_SIZE(ov7692_wb_oem[3]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_wb_oem[4], ARRAY_SIZE(ov7692_wb_oem[4]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_wb_oem[5], ARRAY_SIZE(ov7692_wb_oem[5]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-	{{ov7692_wb_oem[6], ARRAY_SIZE(ov7692_wb_oem[6]),  0,
-		MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA},},
-};
-
-static int ov7692_wb_oem_enum_map[] = {
-	MSM_V4L2_WB_OFF,
-	MSM_V4L2_WB_AUTO ,
-	MSM_V4L2_WB_CUSTOM,
-	MSM_V4L2_WB_INCANDESCENT,
-	MSM_V4L2_WB_FLUORESCENT,
-	MSM_V4L2_WB_DAYLIGHT,
-	MSM_V4L2_WB_CLOUDY_DAYLIGHT,
-};
-
-static struct msm_camera_i2c_enum_conf_array ov7692_wb_oem_enum_confs = {
-	.conf = &ov7692_wb_oem_confs[0][0],
-	.conf_enum = ov7692_wb_oem_enum_map,
-	.num_enum = ARRAY_SIZE(ov7692_wb_oem_enum_map),
-	.num_index = ARRAY_SIZE(ov7692_wb_oem_confs),
-	.num_conf = ARRAY_SIZE(ov7692_wb_oem_confs[0]),
-	.data_type = MSM_CAMERA_I2C_BYTE_DATA,
-};
-
-
-int ov7692_saturation_msm_sensor_s_ctrl_by_enum(
-		struct msm_sensor_ctrl_t *s_ctrl,
-		struct msm_sensor_v4l2_ctrl_info_t *ctrl_info, int value)
-{
-	int rc = 0;
-	if (effect_value == CAMERA_EFFECT_OFF) {
-		rc = msm_sensor_write_enum_conf_array(
-			s_ctrl->sensor_i2c_client,
-			ctrl_info->enum_cfg_settings, value);
-	}
-	if (value <= MSM_V4L2_SATURATION_L8)
-		SAT_U = SAT_V = value * 0x10;
-	CDBG("--CAMERA-- %s ...(End)\n", __func__);
-	return rc;
-}
-
-
-int ov7692_contrast_msm_sensor_s_ctrl_by_enum(
-		struct msm_sensor_ctrl_t *s_ctrl,
-		struct msm_sensor_v4l2_ctrl_info_t *ctrl_info, int value)
-{
-	int rc = 0;
-	if (effect_value == CAMERA_EFFECT_OFF) {
-		rc = msm_sensor_write_enum_conf_array(
-			s_ctrl->sensor_i2c_client,
-			ctrl_info->enum_cfg_settings, value);
-	}
-	return rc;
-}
-
-int ov7692_sharpness_msm_sensor_s_ctrl_by_enum(
-		struct msm_sensor_ctrl_t *s_ctrl,
-		struct msm_sensor_v4l2_ctrl_info_t *ctrl_info, int value)
-{
-	int rc = 0;
-	if (effect_value == CAMERA_EFFECT_OFF) {
-		rc = msm_sensor_write_enum_conf_array(
-			s_ctrl->sensor_i2c_client,
-			ctrl_info->enum_cfg_settings, value);
-	}
-	return rc;
-}
-
-int ov7692_effect_msm_sensor_s_ctrl_by_enum(struct msm_sensor_ctrl_t *s_ctrl,
-		struct msm_sensor_v4l2_ctrl_info_t *ctrl_info, int value)
-{
-	int rc = 0;
-	effect_value = value;
-	if (effect_value == CAMERA_EFFECT_OFF) {
-		rc = msm_sensor_write_conf_array(
-			s_ctrl->sensor_i2c_client,
-			s_ctrl->msm_sensor_reg->no_effect_settings, 0);
-		if (rc < 0) {
-			CDBG("write faield\n");
-			return rc;
-		}
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0xda, SAT_U,
-			MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0xdb, SAT_V,
-			MSM_CAMERA_I2C_BYTE_DATA);
-	} else {
-		rc = msm_sensor_write_enum_conf_array(
-			s_ctrl->sensor_i2c_client,
-			ctrl_info->enum_cfg_settings, value);
-	}
-	return rc;
-}
-
-int ov7692_antibanding_msm_sensor_s_ctrl_by_enum(
-		struct msm_sensor_ctrl_t *s_ctrl,
-		struct msm_sensor_v4l2_ctrl_info_t *ctrl_info, int value)
-{
-	int rc = 0;
-		return rc;
-}
-
-int ov7692_msm_sensor_s_ctrl_by_enum(struct msm_sensor_ctrl_t *s_ctrl,
-		struct msm_sensor_v4l2_ctrl_info_t *ctrl_info, int value)
-{
-	int rc = 0;
-	rc = msm_sensor_write_enum_conf_array(
-		s_ctrl->sensor_i2c_client,
-		ctrl_info->enum_cfg_settings, value);
-	if (rc < 0) {
-		CDBG("write faield\n");
-		return rc;
-	}
-	return rc;
-}
-
-struct msm_sensor_v4l2_ctrl_info_t ov7692_v4l2_ctrl_info[] = {
-	{
-		.ctrl_id = V4L2_CID_SATURATION,
-		.min = MSM_V4L2_SATURATION_L0,
-		.max = MSM_V4L2_SATURATION_L8,
-		.step = 1,
-		.enum_cfg_settings = &ov7692_saturation_enum_confs,
-		.s_v4l2_ctrl = ov7692_saturation_msm_sensor_s_ctrl_by_enum,
-	},
-	{
-		.ctrl_id = V4L2_CID_CONTRAST,
-		.min = MSM_V4L2_CONTRAST_L0,
-		.max = MSM_V4L2_CONTRAST_L8,
-		.step = 1,
-		.enum_cfg_settings = &ov7692_contrast_enum_confs,
-		.s_v4l2_ctrl = ov7692_contrast_msm_sensor_s_ctrl_by_enum,
-	},
-	{
-		.ctrl_id = V4L2_CID_SHARPNESS,
-		.min = MSM_V4L2_SHARPNESS_L0,
-		.max = MSM_V4L2_SHARPNESS_L5,
-		.step = 1,
-		.enum_cfg_settings = &ov7692_sharpness_enum_confs,
-		.s_v4l2_ctrl = ov7692_sharpness_msm_sensor_s_ctrl_by_enum,
-	},
-	{
-		.ctrl_id = V4L2_CID_EXPOSURE,
-		.min = MSM_V4L2_EXPOSURE_N2,
-		.max = MSM_V4L2_EXPOSURE_P2,
-		.step = 1,
-		.enum_cfg_settings = &ov7692_exposure_enum_confs,
-		.s_v4l2_ctrl = ov7692_msm_sensor_s_ctrl_by_enum,
-	},
-	{
-		.ctrl_id = MSM_V4L2_PID_ISO,
-		.min = MSM_V4L2_ISO_AUTO,
-		.max = MSM_V4L2_ISO_1600,
-		.step = 1,
-		.enum_cfg_settings = &ov7692_iso_enum_confs,
-		.s_v4l2_ctrl = ov7692_msm_sensor_s_ctrl_by_enum,
-	},
-	{
-		.ctrl_id = V4L2_CID_SPECIAL_EFFECT,
-		.min = MSM_V4L2_EFFECT_OFF,
-		.max = MSM_V4L2_EFFECT_NEGATIVE,
-		.step = 1,
-		.enum_cfg_settings = &ov7692_special_effect_enum_confs,
-		.s_v4l2_ctrl = ov7692_effect_msm_sensor_s_ctrl_by_enum,
-	},
-	{
-		.ctrl_id = V4L2_CID_POWER_LINE_FREQUENCY,
-		.min = MSM_V4L2_POWER_LINE_60HZ,
-		.max = MSM_V4L2_POWER_LINE_AUTO,
-		.step = 1,
-		.enum_cfg_settings = &ov7692_antibanding_enum_confs,
-		.s_v4l2_ctrl = ov7692_antibanding_msm_sensor_s_ctrl_by_enum,
-	},
-	{
-		.ctrl_id = V4L2_CID_WHITE_BALANCE_TEMPERATURE,
-		.min = MSM_V4L2_WB_OFF,
-		.max = MSM_V4L2_WB_CLOUDY_DAYLIGHT,
-		.step = 1,
-		.enum_cfg_settings = &ov7692_wb_oem_enum_confs,
-		.s_v4l2_ctrl = ov7692_msm_sensor_s_ctrl_by_enum,
-	},
-
-};
-
-static struct msm_sensor_output_reg_addr_t ov7692_reg_addr = {
-	.x_output = 0xCC,
-	.y_output = 0xCE,
-	.line_length_pclk = 0xC8,
-	.frame_length_lines = 0xCA,
-};
-
-static struct msm_sensor_id_info_t ov7692_id_info = {
-	.sensor_id_reg_addr = 0x0A,
-	.sensor_id = 0x7692,
-};
-
-static const struct i2c_device_id ov7692_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&ov7692_s_ctrl},
-	{ }
-};
-
-
-static struct i2c_driver ov7692_i2c_driver = {
-	.id_table = ov7692_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client ov7692_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_BYTE_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	int rc = 0;
-	CDBG("OV7692\n");
-
-	rc = i2c_add_driver(&ov7692_i2c_driver);
-
-	return rc;
-}
-
-static struct v4l2_subdev_core_ops ov7692_subdev_core_ops = {
-	.s_ctrl = msm_sensor_v4l2_s_ctrl,
-	.queryctrl = msm_sensor_v4l2_query_ctrl,
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops ov7692_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops ov7692_subdev_ops = {
-	.core = &ov7692_subdev_core_ops,
-	.video  = &ov7692_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t ov7692_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_csi_setting = msm_sensor_setting1,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-};
-
-static struct msm_sensor_reg_t ov7692_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = ov7692_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(ov7692_start_settings),
-	.stop_stream_conf = ov7692_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(ov7692_stop_settings),
-	.init_settings = &ov7692_init_conf[0],
-	.init_size = ARRAY_SIZE(ov7692_init_conf),
-	.mode_settings = &ov7692_confs[0],
-	.no_effect_settings = &ov7692_no_effect_confs[0],
-	.output_settings = &ov7692_dimensions[0],
-	.num_conf = ARRAY_SIZE(ov7692_confs),
-};
-
-static struct msm_sensor_ctrl_t ov7692_s_ctrl = {
-	.msm_sensor_reg = &ov7692_regs,
-	.msm_sensor_v4l2_ctrl_info = ov7692_v4l2_ctrl_info,
-	.num_v4l2_ctrl = ARRAY_SIZE(ov7692_v4l2_ctrl_info),
-	.sensor_i2c_client = &ov7692_sensor_i2c_client,
-	.sensor_i2c_addr = 0x78,
-	.sensor_output_reg_addr = &ov7692_reg_addr,
-	.sensor_id_info = &ov7692_id_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &ov7692_mut,
-	.sensor_i2c_driver = &ov7692_i2c_driver,
-	.sensor_v4l2_subdev_info = ov7692_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(ov7692_subdev_info),
-	.sensor_v4l2_subdev_ops = &ov7692_subdev_ops,
-	.func_tbl = &ov7692_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Omnivision VGA YUV sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/ov8825_v4l2.c b/drivers/media/video/msm/sensors/ov8825_v4l2.c
deleted file mode 100755
index 0d489cb..0000000
--- a/drivers/media/video/msm/sensors/ov8825_v4l2.c
+++ /dev/null
@@ -1,1266 +0,0 @@
-/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/module.h>
-#include "msm_sensor.h"
-#include "msm.h"
-#define SENSOR_NAME "ov8825"
-#define PLATFORM_DRIVER_NAME "msm_camera_ov8825"
-#define ov8825_obj ov8825_##obj
-
-#define OV8825_2LANES 1
-
-#ifdef CDBG
-#undef CDBG
-#endif
-#ifdef CDBG_HIGH
-#undef CDBG_HIGH
-#endif
-
-#define OV8825_DGB
-
-#ifdef OV8825_DGB
-#define CDBG printk
-#define CDBG_HIGH(fmt, args...) printk(fmt, ##args)
-#else
-#define CDBG printk
-#define CDBG_HIGH(fmt, args...) printk(fmt, ##args)
-#endif
-
-
-/* TO DO - Currently ov5647 typical values are used
- * Need to get the exact values */
-#define OV8825_RG_RATIO_TYPICAL_VALUE 0x51 /* R/G of typical camera module */
-#define OV8825_BG_RATIO_TYPICAL_VALUE 0x4e /* B/G of typical camera module */
-
-DEFINE_MUTEX(ov8825_mut);
-static struct msm_sensor_ctrl_t ov8825_s_ctrl;
-
-struct otp_struct {
-	uint8_t customer_id;
-	uint8_t module_integrator_id;
-	uint8_t lens_id;
-	uint8_t rg_ratio;
-	uint8_t bg_ratio;
-	uint8_t user_data[5];
-} st_ov8825_otp;
-
-
-static struct msm_camera_i2c_reg_conf ov8825_start_settings[] = {
-	{0x0100, 0x01},
-	{0x301c, 0xf0}, /* release clock */
-	{0x301a, 0x70}, /* MIPI stream on */
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_stop_settings[] = {
-	{0x301a, 0x71}, /* MIPI stream off */
-	{0x301c, 0xf4}, /* clock in LP11 mode */
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_groupon_settings[] = {
-	{0x3208, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_groupoff_settings[] = {
-	{0x3208, 0x10},
-	{0x3208, 0xA0},
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_video_settings[] = {
-	{0x3501, 0x2f},
-	{0x3502, 0x90},
-	{0x350b, 0x3f},
-	{0x3003, 0xce},
-	{0x3004, 0xd8},
-	{0x3005, 0x00},
-	{0x3006, 0x00},
-	{0x3007, 0x3b},
-	{0x3011, 0x01},
-	{0x3012, 0x80},
-	{0x3020, 0x01},
-	{0x3013, 0x39},
-	{0x3106, 0x15},
-	{0x3600, 0x06},
-	{0x3601, 0x34},
-	{0x3602, 0x42},
-	{0x3700, 0x20},
-	{0x3702, 0x50},
-	{0x3703, 0xcc},
-	{0x3704, 0x19},
-	{0x3705, 0x32},
-	{0x3706, 0x4b},
-	{0x3708, 0x84},
-	{0x3709, 0x40},
-	{0x370a, 0x31},
-	{0x370e, 0x00},
-	{0x3711, 0x0f},
-	{0x3712, 0x9c},
-	{0x3724, 0x01},
-	{0x3725, 0x92},
-	{0x3726, 0x01},
-	{0x3727, 0xc7},
-	{0x3800, 0x00},
-	{0x3801, 0x00},
-	{0x3802, 0x01},
-	{0x3803, 0x30},
-	{0x3804, 0x0c},
-	{0x3805, 0xdf},
-	{0x3806, 0x08},
-	{0x3807, 0x67},
-	{0x3808, 0x07},
-	{0x3809, 0x80},
-	{0x380a, 0x04},
-	{0x380b, 0x38},
-	{0x380c, 0x0d},
-	{0x380d, 0xf0},
-	{0x380e, 0x07},
-	{0x380f, 0x4c},
-	{0x3810, 0x00},
-	{0x3811, 0x10},
-	{0x3812, 0x00},
-	{0x3813, 0x06},
-	{0x3814, 0x11},
-	{0x3815, 0x11},
-	{0x3820, 0x86},
-	{0x3821, 0x10},
-	{0x3f00, 0x02},
-	{0x4005, 0x18},
-	{0x404f, 0x8F},
-	{0x4600, 0x04},
-	{0x4601, 0x01},
-	{0x4602, 0x00},
-	{0x4837, 0x1e},
-	{0x5068, 0x53},
-	{0x506a, 0x53},
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_prev_settings[] = {
-	{0x3003, 0xce},
-	{0x3004, 0xd8},
-	{0x3005, 0x00},
-	{0x3006, 0x10},
-	{0x3007, 0x3b},
-	{0x3011, 0x01},
-	{0x3013, 0x39},
-	{0x3012, 0x80},
-	{0x3020, 0x01},
-	{0x3106, 0x15},
-	{0x3600, 0x06},
-	{0x3601, 0x34},
-	{0x3602, 0x42},
-	{0x3700, 0x20},
-	{0x3702, 0x50},
-	{0x3703, 0xcc},
-	{0x3704, 0x19},
-	{0x3705, 0x32},
-	{0x3706, 0x4b},
-	{0x3708, 0x84},
-	{0x3709, 0x40},
-	{0x370a, 0x33},
-	{0x370e, 0x00},
-	{0x3711, 0x0f},
-	{0x3712, 0x9c},
-	{0x3724, 0x01},
-	{0x3725, 0x92},
-	{0x3726, 0x01},
-	{0x3727, 0xc7},
-	{0x3800, 0x00},
-	{0x3801, 0x00},
-	{0x3802, 0x00},
-	{0x3803, 0x00},
-	{0x3804, 0x0c},
-	{0x3805, 0xdf},
-	{0x3806, 0x09},
-	{0x3807, 0x9b},
-	{0x3808, 0x06},
-	{0x3809, 0x60},
-	{0x380a, 0x04},
-	{0x380b, 0xc8},
-	{0x380c, 0x0d},
-	{0x380d, 0xbc},
-	{0x380e, 0x04},
-	{0x380f, 0xf4},
-	{0x3810, 0x00},
-	{0x3811, 0x08},
-	{0x3812, 0x00},
-	{0x3813, 0x04},
-	{0x3814, 0x31},
-	{0x3815, 0x31},
-	{0x3820, 0x87},
-	{0x3821, 0x11},
-	{0x3f00, 0x00},
-	{0x4005, 0x18},
-	{0x404f, 0x8F},
-	{0x4600, 0x04},
-	{0x4601, 0x00},
-	{0x4602, 0x30},
-	{0x4837, 0x1e},
-	{0x5068, 0x00},
-	{0x506a, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_snap_settings[] = {
-	{0x3004, 0xd8},
-	{0x3006, 0x10},
-	{0x3020, 0x81},
-	{0x3501, 0x9a},
-	{0x3502, 0xa0},
-	{0x3700, 0x10},
-	{0x3702, 0x28},
-	{0x3703, 0x6c},
-	{0x3704, 0x40},
-	{0x3705, 0x19},
-	{0x3706, 0x27},
-	{0x3708, 0x48},
-	{0x3709, 0x20},
-	{0x370a, 0x31},
-	{0x3711, 0x07},
-	{0x3712, 0x4e},
-	{0x3724, 0x00},
-	{0x3725, 0xd4},
-	{0x3726, 0x00},
-	{0x3727, 0xf0},
-	{0x3802, 0x00},
-	{0x3803, 0x00},
-	{0x3806, 0x09},
-	{0x3807, 0x9b},
-	{0x3808, 0x0c},
-	{0x3809, 0xc0},
-	{0x380a, 0x09},
-	{0x380b, 0x90},
-	{0x380c, 0x0e},
-	{0x380d, 0x00},
-	{0x380e, 0x09},
-	{0x380f, 0xbf},
-	{0x3811, 0x10},
-	{0x3813, 0x06},
-	{0x3814, 0x11},
-	{0x3815, 0x11},
-	{0x3820, 0x86},
-	{0x3821, 0x10},
-	{0x3f00, 0x02},
-	{0x4005, 0x1a},/* BLC triggered every frame */
-	{0x4601, 0x00},
-	{0x4602, 0x20},
-	{0x4837, 0x1e},
-	{0x5068, 0x00},
-	{0x506a, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_WVGA_60fps_settings[] = {
-	{0x3501, 0x2f},
-	{0x3502, 0x90},
-	{0x350b, 0x3f},
-	{0x3003, 0xce},
-	{0x3004, 0xbf},
-	{0x3005, 0x10},
-	{0x3006, 0x00},
-	{0x3007, 0x3b},
-	{0x3011, 0x01},
-	{0x3012, 0x80},
-	{0x3013, 0x39},
-	{0x3020, 0x01},
-	{0x3106, 0x15},
-	{0x3600, 0x06},
-	{0x3601, 0x34},
-	{0x3602, 0x42},
-	{0x3700, 0x20},
-	{0x3702, 0x50},
-	{0x3703, 0xcc},
-	{0x3704, 0x19},
-	{0x3705, 0x32},
-	{0x3706, 0x4b},
-	{0x3708, 0x84},
-	{0x3709, 0x40},
-	{0x370a, 0xb2},
-	{0x370e, 0x08},
-	{0x3711, 0x0f},
-	{0x3712, 0x9c},
-	{0x3724, 0x01},
-	{0x3725, 0x92},
-	{0x3726, 0x01},
-	{0x3727, 0xc7},
-	{0x3800, 0x00},
-	{0x3801, 0x08},
-	{0x3802, 0x00},
-	{0x3803, 0xf4},
-	{0x3804, 0x0c},
-	{0x3805, 0xd7},
-	{0x3806, 0x08},
-	{0x3807, 0xa3},
-	{0x3808, 0x03},
-	{0x3809, 0x20},
-	{0x380a, 0x01},
-	{0x380b, 0xe0},
-	{0x380c, 0x0a},
-	{0x380d, 0x44},
-	{0x380e, 0x04},
-	{0x380f, 0xf4},
-	{0x3810, 0x00},
-	{0x3811, 0x0a},
-	{0x3812, 0x00},
-	{0x3813, 0x06},
-	{0x3814, 0x71},
-	{0x3815, 0x35},
-	{0x3820, 0x86},
-	{0x3821, 0x10},
-	{0x3f00, 0x00},
-	{0x4005, 0x18},
-	{0x404f, 0x8f},
-	{0x4600, 0x14},
-	{0x4601, 0x14},
-	{0x4602, 0x00},
-	{0x4837, 0x19},
-	{0x5068, 0x59},
-	{0x506a, 0x5a},
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_WVGA_90fps_settings[] = {
-	{0x3501, 0x2f},
-	{0x3502, 0x90},
-	{0x350b, 0x3f},
-	{0x3003, 0xce},
-	{0x3004, 0xbf},
-	{0x3005, 0x10},
-	{0x3006, 0x00},
-	{0x3007, 0x3b},
-	{0x3011, 0x01},
-	{0x3012, 0x80},
-	{0x3013, 0x39},
-	{0x3020, 0x01},
-	{0x3106, 0x15},
-	{0x3600, 0x06},
-	{0x3601, 0x34},
-	{0x3602, 0x42},
-	{0x3700, 0x20},
-	{0x3702, 0x50},
-	{0x3703, 0xcc},
-	{0x3704, 0x19},
-	{0x3705, 0x32},
-	{0x3706, 0x4b},
-	{0x3708, 0x84},
-	{0x3709, 0x40},
-	{0x370a, 0xb2},
-	{0x370e, 0x08},
-	{0x3711, 0x0f},
-	{0x3712, 0x9c},
-	{0x3724, 0x01},
-	{0x3725, 0x92},
-	{0x3726, 0x01},
-	{0x3727, 0xc7},
-	{0x3800, 0x00},
-	{0x3801, 0x08},
-	{0x3802, 0x00},
-	{0x3803, 0xf4},
-	{0x3804, 0x0c},
-	{0x3805, 0xd7},
-	{0x3806, 0x08},
-	{0x3807, 0xa3},
-	{0x3808, 0x03},
-	{0x3809, 0x20},
-	{0x380a, 0x01},
-	{0x380b, 0xe0},
-	{0x380c, 0x0a},
-	{0x380d, 0x44},
-	{0x380e, 0x03},
-	{0x380f, 0x50},
-	{0x3810, 0x00},
-	{0x3811, 0x0a},
-	{0x3812, 0x00},
-	{0x3813, 0x06},
-	{0x3814, 0x71},
-	{0x3815, 0x35},
-	{0x3820, 0x86},
-	{0x3821, 0x10},
-	{0x3f00, 0x00},
-	{0x4005, 0x18},
-	{0x404f, 0x8F},
-	{0x4600, 0x14},
-	{0x4601, 0x14},
-	{0x4602, 0x00},
-	{0x4837, 0x19},
-	{0x5068, 0x59},
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_WVGA_120fps_settings[] = {
-	{0x3501, 0x27},
-	{0x3502, 0x90},
-	{0x350b, 0x3f},
-	{0x3003, 0xce},
-	{0x3004, 0xbf},
-	{0x3005, 0x10},
-	{0x3006, 0x00},
-	{0x3007, 0x3b},
-	{0x3011, 0x01},
-	{0x3012, 0x80},
-	{0x3013, 0x39},
-	{0x3020, 0x01},
-	{0x3106, 0x15},
-	{0x3600, 0x06},
-	{0x3601, 0x34},
-	{0x3602, 0x42},
-	{0x3700, 0x20},
-	{0x3702, 0x50},
-	{0x3703, 0xcc},
-	{0x3704, 0x19},
-	{0x3705, 0x32},
-	{0x3706, 0x4b},
-	{0x3708, 0x84},
-	{0x3709, 0x40},
-	{0x370a, 0xb2},
-	{0x370e, 0x08},
-	{0x3711, 0x0f},
-	{0x3712, 0x9c},
-	{0x3724, 0x01},
-	{0x3725, 0x92},
-	{0x3726, 0x01},
-	{0x3727, 0xc7},
-	{0x3800, 0x00},
-	{0x3801, 0x08},
-	{0x3802, 0x00},
-	{0x3803, 0xf4},
-	{0x3804, 0x0c},
-	{0x3805, 0xd7},
-	{0x3806, 0x08},
-	{0x3807, 0xa3},
-	{0x3808, 0x03},
-	{0x3809, 0x20},
-	{0x380a, 0x01},
-	{0x380b, 0xe0},
-	{0x380c, 0x0a},
-	{0x380d, 0x44},
-	{0x380e, 0x02},
-	{0x380f, 0x7a},
-	{0x3810, 0x00},
-	{0x3811, 0x0a},
-	{0x3812, 0x00},
-	{0x3813, 0x06},
-	{0x3814, 0x71},
-	{0x3815, 0x35},
-	{0x3820, 0x86},
-	{0x3821, 0x10},
-	{0x3f00, 0x00},
-	{0x4005, 0x18},
-	{0x404f, 0x8F},
-	{0x4600, 0x14},
-	{0x4601, 0x14},
-	{0x4602, 0x00},
-	{0x4837, 0x19},
-	{0x5068, 0x59},
-	{0x506a, 0x5a},
-};
-
-static struct msm_camera_i2c_reg_conf ov8825_recommend_settings[] = {
-	{0x3000, 0x16},
-	{0x3001, 0x00},
-	{0x3002, 0x6c},
-	{0x3003, 0xce},
-	{0x3004, 0xd4},
-	{0x3005, 0x00},
-	{0x3006, 0x10},
-	{0x3007, 0x3b},
-	{0x300d, 0x00},
-	{0x301f, 0x09},
-	{0x3020, 0x01},
-	{0x3010, 0x00},
-	{0x3011, 0x01},
-	{0x3012, 0x80},
-	{0x3013, 0x39},
-	{0x3018, 0x00},
-	{0x3104, 0x20},
-	{0x3106, 0x15},
-	{0x3300, 0x00},
-	{0x3500, 0x00},
-	{0x3501, 0x4e},
-	{0x3502, 0xa0},
-	{0x3503, 0x07},
-	{0x3509, 0x00},
-	{0x350b, 0x1f},
-	{0x3600, 0x06},
-	{0x3601, 0x34},
-	{0x3602, 0x42},
-	{0x3603, 0x5c},
-	{0x3604, 0x98},
-	{0x3605, 0xf5},
-	{0x3609, 0xb4},
-	{0x360a, 0x7c},
-	{0x360b, 0xc9},
-	{0x360c, 0x0b},
-	{0x3612, 0x00},
-	{0x3613, 0x02},
-	{0x3614, 0x0f},
-	{0x3615, 0x00},
-	{0x3616, 0x03},
-	{0x3617, 0xa1},
-	{0x3618, 0x00},
-	{0x3619, 0x00},
-	{0x361a, 0xb0},
-	{0x361b, 0x04},
-	{0x361c, 0x07},
-	{0x3700, 0x20},
-	{0x3701, 0x44},
-	{0x3702, 0x50},
-	{0x3703, 0xcc},
-	{0x3704, 0x19},
-	{0x3705, 0x32},
-	{0x3706, 0x4b},
-	{0x3707, 0x63},
-	{0x3708, 0x84},
-	{0x3709, 0x40},
-	{0x370a, 0x33},
-	{0x370b, 0x01},
-	{0x370c, 0x50},
-	{0x370d, 0x00},
-	{0x370e, 0x00},
-	{0x3711, 0x0f},
-	{0x3712, 0x9c},
-	{0x3724, 0x01},
-	{0x3725, 0x92},
-	{0x3726, 0x01},
-	{0x3727, 0xc7},
-	{0x3800, 0x00},
-	{0x3801, 0x00},
-	{0x3802, 0x00},
-	{0x3803, 0x00},
-	{0x3804, 0x0c},
-	{0x3805, 0xdf},
-	{0x3806, 0x09},
-	{0x3807, 0x9b},
-	{0x3808, 0x06},
-	{0x3809, 0x60},
-	{0x380a, 0x04},
-	{0x380b, 0xc8},
-	{0x380c, 0x0d},
-	{0x380d, 0xbc},
-	{0x380e, 0x04},
-	{0x380f, 0xf0},
-	{0x3810, 0x00},
-	{0x3811, 0x08},
-	{0x3812, 0x00},
-	{0x3813, 0x04},
-	{0x3814, 0x31},
-	{0x3815, 0x31},
-	{0x3816, 0x02},
-	{0x3817, 0x40},
-	{0x3818, 0x00},
-	{0x3819, 0x40},
-	{0x3820, 0x86},
-	{0x3821, 0x10},
-	{0x3b1f, 0x00},
-	{0x3d00, 0x00},
-	{0x3d01, 0x00},
-	{0x3d02, 0x00},
-	{0x3d03, 0x00},
-	{0x3d04, 0x00},
-	{0x3d05, 0x00},
-	{0x3d06, 0x00},
-	{0x3d07, 0x00},
-	{0x3d08, 0x00},
-	{0x3d09, 0x00},
-	{0x3d0a, 0x00},
-	{0x3d0b, 0x00},
-	{0x3d0c, 0x00},
-	{0x3d0d, 0x00},
-	{0x3d0e, 0x00},
-	{0x3d0f, 0x00},
-	{0x3d10, 0x00},
-	{0x3d11, 0x00},
-	{0x3d12, 0x00},
-	{0x3d13, 0x00},
-	{0x3d14, 0x00},
-	{0x3d15, 0x00},
-	{0x3d16, 0x00},
-	{0x3d17, 0x00},
-	{0x3d18, 0x00},
-	{0x3d19, 0x00},
-	{0x3d1a, 0x00},
-	{0x3d1b, 0x00},
-	{0x3d1c, 0x00},
-	{0x3d1d, 0x00},
-	{0x3d1e, 0x00},
-	{0x3d1f, 0x00},
-	{0x3d80, 0x00},
-	{0x3d81, 0x00},
-	{0x3d84, 0x00},
-	{0x3f00, 0x00},
-	{0x3f01, 0xfc},
-	{0x3f05, 0x10},
-	{0x3f06, 0x00},
-	{0x3f07, 0x00},
-	{0x4000, 0x29},
-	{0x4001, 0x02},
-	{0x4002, 0x45},
-	{0x4003, 0x08},
-	{0x4004, 0x04},
-	{0x4005, 0x18},
-	{0x404e, 0x37},
-	{0x404f, 0x8f},
-	{0x4300, 0xff},
-	{0x4303, 0x00},
-	{0x4304, 0x08},
-	{0x4307, 0x00},
-	{0x4600, 0x04},
-	{0x4601, 0x00},
-	{0x4602, 0x30},
-	{0x4800, 0x04},
-	{0x4801, 0x0f},
-	{0x4837, 0x28},
-	{0x4843, 0x02},
-	{0x5000, 0x06},
-	{0x5001, 0x00},
-	{0x5002, 0x00},
-	{0x5068, 0x00},
-	{0x506a, 0x00},
-	{0x501f, 0x00},
-	{0x5780, 0xfc},
-	{0x5c00, 0x80},
-	{0x5c01, 0x00},
-	{0x5c02, 0x00},
-	{0x5c03, 0x00},
-	{0x5c04, 0x00},
-	{0x5c05, 0x00},
-	{0x5c06, 0x00},
-	{0x5c07, 0x80},
-	{0x5c08, 0x10},
-	{0x6700, 0x05},
-	{0x6701, 0x19},
-	{0x6702, 0xfd},
-	{0x6703, 0xd7},
-	{0x6704, 0xff},
-	{0x6705, 0xff},
-	{0x6800, 0x10},
-	{0x6801, 0x02},
-	{0x6802, 0x90},
-	{0x6803, 0x10},
-	{0x6804, 0x59},
-	{0x6900, 0x60},
-	{0x6901, 0x04},
-	{0x5800, 0x0f},
-	{0x5801, 0x0d},
-	{0x5802, 0x09},
-	{0x5803, 0x0a},
-	{0x5804, 0x0d},
-	{0x5805, 0x14},
-	{0x5806, 0x0a},
-	{0x5807, 0x04},
-	{0x5808, 0x03},
-	{0x5809, 0x03},
-	{0x580a, 0x05},
-	{0x580b, 0x0a},
-	{0x580c, 0x05},
-	{0x580d, 0x02},
-	{0x580e, 0x00},
-	{0x580f, 0x00},
-	{0x5810, 0x03},
-	{0x5811, 0x05},
-	{0x5812, 0x09},
-	{0x5813, 0x03},
-	{0x5814, 0x01},
-	{0x5815, 0x01},
-	{0x5816, 0x04},
-	{0x5817, 0x09},
-	{0x5818, 0x09},
-	{0x5819, 0x08},
-	{0x581a, 0x06},
-	{0x581b, 0x06},
-	{0x581c, 0x08},
-	{0x581d, 0x06},
-	{0x581e, 0x33},
-	{0x581f, 0x11},
-	{0x5820, 0x0e},
-	{0x5821, 0x0f},
-	{0x5822, 0x11},
-	{0x5823, 0x3f},
-	{0x5824, 0x08},
-	{0x5825, 0x46},
-	{0x5826, 0x46},
-	{0x5827, 0x46},
-	{0x5828, 0x46},
-	{0x5829, 0x46},
-	{0x582a, 0x42},
-	{0x582b, 0x42},
-	{0x582c, 0x44},
-	{0x582d, 0x46},
-	{0x582e, 0x46},
-	{0x582f, 0x60},
-	{0x5830, 0x62},
-	{0x5831, 0x42},
-	{0x5832, 0x46},
-	{0x5833, 0x46},
-	{0x5834, 0x44},
-	{0x5835, 0x44},
-	{0x5836, 0x44},
-	{0x5837, 0x48},
-	{0x5838, 0x28},
-	{0x5839, 0x46},
-	{0x583a, 0x48},
-	{0x583b, 0x68},
-	{0x583c, 0x28},
-	{0x583d, 0xae},
-	{0x5842, 0x00},
-	{0x5843, 0xef},
-	{0x5844, 0x01},
-	{0x5845, 0x3f},
-	{0x5846, 0x01},
-	{0x5847, 0x3f},
-	{0x5848, 0x00},
-	{0x5849, 0xd5},
-	/* MWB */
-	{0x3400, 0x04}, /* red h */
-	{0x3401, 0x00}, /* red l */
-	{0x3402, 0x04}, /* green h */
-	{0x3403, 0x00}, /* green l */
-	{0x3404, 0x04}, /* blue h */
-	{0x3405, 0x00}, /* blue l */
-	{0x3406, 0x01}, /* MWB manual */
-	/* ISP */
-	{0x5001, 0x01}, /* MWB on */
-	{0x5000, 0x86}, /* LENC on, BPC on, WPC on */
-};
-
-static struct v4l2_subdev_info ov8825_subdev_info[] = {
-	{
-		.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
-		.colorspace = V4L2_COLORSPACE_JPEG,
-		.fmt    = 1,
-		.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array ov8825_init_conf[] = {
-	{&ov8825_recommend_settings[0],
-	ARRAY_SIZE(ov8825_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array ov8825_confs[] = {
-	{&ov8825_snap_settings[0],
-		ARRAY_SIZE(ov8825_snap_settings),
-		0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov8825_prev_settings[0],
-		ARRAY_SIZE(ov8825_prev_settings),
-		0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov8825_WVGA_60fps_settings[0],
-		ARRAY_SIZE(ov8825_WVGA_60fps_settings),
-		0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov8825_WVGA_90fps_settings[0],
-		ARRAY_SIZE(ov8825_WVGA_90fps_settings),
-		0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov8825_WVGA_120fps_settings[0],
-		ARRAY_SIZE(ov8825_WVGA_120fps_settings),
-		0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&ov8825_video_settings[0],
-		ARRAY_SIZE(ov8825_video_settings),
-		0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t ov8825_dimensions[] = {
-	{
-		.x_output = 0xCC0,
-		.y_output = 0x990,
-		.line_length_pclk = 0xE00,
-		.frame_length_lines = 0x9BF,
-#if OV8825_2LANES
-		.vt_pixel_clk = 133400000,
-#else
-		.vt_pixel_clk = 133000000,
-#endif
-		.op_pixel_clk = 176000000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 1632,
-		.y_output = 1224,
-		.line_length_pclk = 3516,
-		.frame_length_lines = 1268,
-		.vt_pixel_clk = 133400000,
-		.op_pixel_clk = 176000000,
-		.binning_factor = 1,
-	},
-	/* WVGA 60fps */
-	{
-		.x_output = 800,
-		.y_output = 480,
-		.line_length_pclk = 0xa44,
-		.frame_length_lines = 0x4f4,
-		.vt_pixel_clk = 200000000,
-		.op_pixel_clk = 176000000,
-		.binning_factor = 0,
-	},
-	/* WVGA 90fps */
-	{
-		.x_output = 800,
-		.y_output = 480,
-		.line_length_pclk = 0xa44,
-		.frame_length_lines = 0x350,
-		.vt_pixel_clk = 200000000,
-		.op_pixel_clk = 176000000,
-		.binning_factor = 0,
-	},
-	/* WVGA 120fps */
-	{
-		.x_output = 800,
-		.y_output = 480,
-		.line_length_pclk = 0xa44,
-		.frame_length_lines = 0x27a,
-		.vt_pixel_clk = 200000000,
-		.op_pixel_clk = 176000000,
-		.binning_factor = 0,
-	},
-	{
-		.x_output = 1920,
-		.y_output = 1080,
-		.line_length_pclk = 3568,
-		.frame_length_lines = 1868,
-		.vt_pixel_clk = 200000000,
-		.op_pixel_clk = 176000000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_sensor_output_reg_addr_t ov8825_reg_addr = {
-	.x_output = 0x3808,
-	.y_output = 0x380a,
-	.line_length_pclk = 0x380c,
-	.frame_length_lines = 0x380e,
-};
-
-static struct msm_sensor_id_info_t ov8825_id_info = {
-	.sensor_id_reg_addr = 0x300A,
-	.sensor_id = 0x8825,
-};
-
-static struct msm_sensor_exp_gain_info_t ov8825_exp_gain_info = {
-	.coarse_int_time_addr = 0x3500,
-	.global_gain_addr = 0x350A,
-	.vert_offset = 6,
-};
-
-/********************************************
- * index: index of otp group. (0, 1, 2)
- * return value:
- *     0, group index is empty
- *     1, group index has invalid data
- *     2, group index has valid data
- **********************************************/
-uint16_t ov8825_check_otp_wb(struct msm_sensor_ctrl_t *s_ctrl, uint16_t index)
-{
-	uint16_t temp, i;
-	uint16_t address;
-
-	/* clear otp buffer */
-
-	/* select otp bank 0 */
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x3d84, 0x08,
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* load otp into buffer */
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x3d81, 0x01,
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* read from group [index] */
-	address = 0x3d05 + index * 9;
-	msm_camera_i2c_read(s_ctrl->sensor_i2c_client, address, &temp,
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* disable otp read */
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x3d81, 0x00,
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* clear otp buffer */
-	for (i = 0; i < 32; i++) {
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, (0x3d00+i),
-				0x00, MSM_CAMERA_I2C_BYTE_DATA);
-	}
-
-	if (!temp)
-		return 0;
-	else if ((!(temp & 0x80)) && (temp & 0x7f))
-		return 2;
-	else
-		return 1;
-}
-
-void ov8825_read_otp_wb(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t index, struct otp_struct *potp)
-{
-	uint16_t temp, i;
-	uint16_t address;
-
-	/* select otp bank 0 */
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x3d84, 0x08,
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* load otp data into buffer */
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x3d81, 0x01,
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* read otp data from 0x3d00 - 0x3d1f*/
-	address = 0x3d05 + index * 9;
-
-	msm_camera_i2c_read(s_ctrl->sensor_i2c_client, address, &temp,
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-	potp->module_integrator_id = temp;
-	potp->customer_id = temp & 0x7f;
-
-	msm_camera_i2c_read(s_ctrl->sensor_i2c_client, (address+1), &temp,
-			MSM_CAMERA_I2C_BYTE_DATA);
-	potp->lens_id = temp;
-
-	msm_camera_i2c_read(s_ctrl->sensor_i2c_client, (address+2), &temp,
-			MSM_CAMERA_I2C_BYTE_DATA);
-	potp->rg_ratio = temp;
-
-	msm_camera_i2c_read(s_ctrl->sensor_i2c_client, (address+3), &temp,
-			MSM_CAMERA_I2C_BYTE_DATA);
-	potp->bg_ratio = temp;
-
-	msm_camera_i2c_read(s_ctrl->sensor_i2c_client, (address+4), &temp,
-			MSM_CAMERA_I2C_BYTE_DATA);
-	potp->user_data[0] = temp;
-
-	msm_camera_i2c_read(s_ctrl->sensor_i2c_client, (address+5), &temp,
-			MSM_CAMERA_I2C_BYTE_DATA);
-	potp->user_data[1] = temp;
-
-	msm_camera_i2c_read(s_ctrl->sensor_i2c_client, (address+6), &temp,
-			MSM_CAMERA_I2C_BYTE_DATA);
-	potp->user_data[2] = temp;
-
-	msm_camera_i2c_read(s_ctrl->sensor_i2c_client, (address+7), &temp,
-			MSM_CAMERA_I2C_BYTE_DATA);
-	potp->user_data[3] = temp;
-
-	msm_camera_i2c_read(s_ctrl->sensor_i2c_client, (address+8), &temp,
-			MSM_CAMERA_I2C_BYTE_DATA);
-	potp->user_data[4] = temp;
-
-	CDBG("%s customer_id  = 0x%02x\r\n", __func__, potp->customer_id);
-	CDBG("%s lens_id      = 0x%02x\r\n", __func__, potp->lens_id);
-	CDBG("%s rg_ratio     = 0x%02x\r\n", __func__, potp->rg_ratio);
-	CDBG("%s bg_ratio     = 0x%02x\r\n", __func__, potp->bg_ratio);
-	CDBG("%s user_data[0] = 0x%02x\r\n", __func__, potp->user_data[0]);
-	CDBG("%s user_data[1] = 0x%02x\r\n", __func__, potp->user_data[1]);
-	CDBG("%s user_data[2] = 0x%02x\r\n", __func__, potp->user_data[2]);
-	CDBG("%s user_data[3] = 0x%02x\r\n", __func__, potp->user_data[3]);
-	CDBG("%s user_data[4] = 0x%02x\r\n", __func__, potp->user_data[4]);
-
-	/* disable otp read */
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x3d81, 0x00,
-			MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* clear otp buffer */
-	for (i = 0; i < 32; i++)
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, (0x3d00+i),
-				0x00, MSM_CAMERA_I2C_BYTE_DATA);
-}
-
-/**********************************************
- * r_gain, sensor red gain of AWB, 0x400 =1
- * g_gain, sensor green gain of AWB, 0x400 =1
- * b_gain, sensor blue gain of AWB, 0x400 =1
- ***********************************************/
-void ov8825_update_awb_gain(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t r_gain, uint16_t g_gain, uint16_t b_gain)
-{
-	CDBG("%s r_gain = 0x%04x\r\n", __func__, r_gain);
-	CDBG("%s g_gain = 0x%04x\r\n", __func__, g_gain);
-	CDBG("%s b_gain = 0x%04x\r\n", __func__, b_gain);
-	if (r_gain > 0x400) {
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x5186,
-				(r_gain>>8), MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x5187,
-				(r_gain&0xff), MSM_CAMERA_I2C_BYTE_DATA);
-	}
-	if (g_gain > 0x400) {
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x5188,
-				(g_gain>>8), MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x5189,
-				(g_gain&0xff), MSM_CAMERA_I2C_BYTE_DATA);
-	}
-	if (b_gain > 0x400) {
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x518a,
-				(b_gain>>8), MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x518b,
-				(b_gain&0xff), MSM_CAMERA_I2C_BYTE_DATA);
-	}
-}
-
-/**************************************************
- * call this function after OV8825 initialization
- * return value:
- *     0, update success
- *     1, no OTP
- ***************************************************/
-uint16_t ov8825_update_otp(struct msm_sensor_ctrl_t *s_ctrl)
-{
-	uint16_t i;
-	uint16_t otp_index;
-	uint16_t temp;
-	uint16_t r_gain, g_gain, b_gain, g_gain_r, g_gain_b;
-
-	/* R/G and B/G of current camera module is read out from sensor OTP */
-	/* check first OTP with valid data */
-	for (i = 0; i < 3; i++) {
-		temp = ov8825_check_otp_wb(s_ctrl, i);
-		if (temp == 2) {
-			otp_index = i;
-			break;
-		}
-	}
-	if (i == 3) {
-		/* no valid wb OTP data */
-		CDBG("no valid wb OTP data\r\n");
-		return 1;
-	}
-	ov8825_read_otp_wb(s_ctrl, otp_index, &st_ov8825_otp);
-	/* calculate g_gain */
-	/* 0x400 = 1x gain */
-	if (st_ov8825_otp.bg_ratio < OV8825_BG_RATIO_TYPICAL_VALUE) {
-		if (st_ov8825_otp.rg_ratio < OV8825_RG_RATIO_TYPICAL_VALUE) {
-			g_gain = 0x400;
-			b_gain = 0x400 *
-				OV8825_BG_RATIO_TYPICAL_VALUE /
-				st_ov8825_otp.bg_ratio;
-			r_gain = 0x400 *
-				OV8825_RG_RATIO_TYPICAL_VALUE /
-				st_ov8825_otp.rg_ratio;
-		} else {
-			r_gain = 0x400;
-			g_gain = 0x400 *
-				st_ov8825_otp.rg_ratio /
-				OV8825_RG_RATIO_TYPICAL_VALUE;
-			b_gain = g_gain *
-				OV8825_BG_RATIO_TYPICAL_VALUE /
-				st_ov8825_otp.bg_ratio;
-		}
-	} else {
-		if (st_ov8825_otp.rg_ratio < OV8825_RG_RATIO_TYPICAL_VALUE) {
-			b_gain = 0x400;
-			g_gain = 0x400 *
-				st_ov8825_otp.bg_ratio /
-				OV8825_BG_RATIO_TYPICAL_VALUE;
-			r_gain = g_gain *
-				OV8825_RG_RATIO_TYPICAL_VALUE /
-				st_ov8825_otp.rg_ratio;
-		} else {
-			g_gain_b = 0x400 *
-				st_ov8825_otp.bg_ratio /
-				OV8825_BG_RATIO_TYPICAL_VALUE;
-			g_gain_r = 0x400 *
-				st_ov8825_otp.rg_ratio /
-				OV8825_RG_RATIO_TYPICAL_VALUE;
-			if (g_gain_b > g_gain_r) {
-				b_gain = 0x400;
-				g_gain = g_gain_b;
-				r_gain = g_gain *
-					OV8825_RG_RATIO_TYPICAL_VALUE /
-					st_ov8825_otp.rg_ratio;
-			} else {
-				r_gain = 0x400;
-				g_gain = g_gain_r;
-				b_gain = g_gain *
-					OV8825_BG_RATIO_TYPICAL_VALUE /
-					st_ov8825_otp.bg_ratio;
-			}
-		}
-	}
-	ov8825_update_awb_gain(s_ctrl, r_gain, g_gain, b_gain);
-	return 0;
-}
-
-static int32_t ov8825_write_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
-{
-	uint32_t offset;
-	uint8_t int_time[3];
-	uint32_t fl_lines = s_ctrl->curr_frame_length_lines;
-	if(s_ctrl->curr_res < MSM_SENSOR_RES_2)
-		fl_lines =
-			(s_ctrl->curr_frame_length_lines * s_ctrl->fps_divider) / Q10;
-	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
-	if (line > (fl_lines - offset))
-		fl_lines = line + offset;
-	CDBG("ov8825_write_exp_gain: %d %d %d\n", fl_lines, gain, line);
-	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_output_reg_addr->frame_length_lines, fl_lines,
-		MSM_CAMERA_I2C_WORD_DATA);
-	int_time[0] = line >> 12;
-	int_time[1] = line >> 4;
-	int_time[2] = line << 4;
-	msm_camera_i2c_write_seq(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-		&int_time[0], 3);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
-		MSM_CAMERA_I2C_WORD_DATA);
-	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	return 0;
-}
-
-static int32_t ov8825_write_pic_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
-{
-	uint32_t fl_lines, offset;
-	uint8_t int_time[3];
-
-	fl_lines =
-		(s_ctrl->curr_frame_length_lines * s_ctrl->fps_divider) / Q10;
-	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
-	if (line > (fl_lines - offset))
-		fl_lines = line + offset;
-	CDBG("ov8825_write_exp_gain: %d %d %d\n", fl_lines, gain, line);
-	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_output_reg_addr->frame_length_lines, fl_lines,
-		MSM_CAMERA_I2C_WORD_DATA);
-	int_time[0] = line >> 12;
-	int_time[1] = line >> 4;
-	int_time[2] = line << 4;
-	msm_camera_i2c_write_seq(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-		&int_time[0], 3);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
-		MSM_CAMERA_I2C_WORD_DATA);
-	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	return 0;
-}
-
-static const struct i2c_device_id ov8825_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&ov8825_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver ov8825_i2c_driver = {
-	.id_table = ov8825_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client ov8825_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	return i2c_add_driver(&ov8825_i2c_driver);
-}
-
-static struct v4l2_subdev_core_ops ov8825_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops ov8825_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops ov8825_subdev_ops = {
-	.core = &ov8825_subdev_core_ops,
-	.video  = &ov8825_subdev_video_ops,
-};
-
-int32_t ov8825_sensor_setting(struct msm_sensor_ctrl_t *s_ctrl,
-			int update_type, int res)
-{
-	int32_t rc = 0;
-
-	CDBG("function:%s,line:%d\n", __func__, __LINE__);
-
-	if (update_type == MSM_SENSOR_REG_INIT) {
-		CDBG("Register INIT\n");
-		s_ctrl->func_tbl->sensor_stop_stream(s_ctrl);
-		msm_sensor_enable_debugfs(s_ctrl);
-		msm_sensor_write_init_settings(s_ctrl);
-		CDBG("Update OTP\n");
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x100, 0x1,
-		MSM_CAMERA_I2C_BYTE_DATA);
-		msleep(66);
-		ov8825_update_otp(s_ctrl);
-		usleep_range(10000, 11000);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client, 0x100, 0x0,
-		MSM_CAMERA_I2C_BYTE_DATA);
-	} else if (update_type == MSM_SENSOR_UPDATE_PERIODIC) {
-		CDBG("PERIODIC : %d\n", res);
-		msm_sensor_write_res_settings(s_ctrl, res);
-		msleep(30);
-		v4l2_subdev_notify(&s_ctrl->sensor_v4l2_subdev,
-			NOTIFY_PCLK_CHANGE, &s_ctrl->msm_sensor_reg->
-			output_settings[res].op_pixel_clk);
-	}
-	return rc;
-}
-
-static struct msm_sensor_fn_t ov8825_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = ov8825_write_exp_gain,
-	.sensor_write_snapshot_exp_gain = ov8825_write_pic_exp_gain,
-	.sensor_setting = ov8825_sensor_setting,    /*msm_sensor_setting,*/
-	.sensor_csi_setting = msm_sensor_setting,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-	.sensor_adjust_frame_lines = msm_sensor_adjust_frame_lines1,
-	.sensor_get_csi_params = msm_sensor_get_csi_params,
-};
-
-static struct msm_sensor_reg_t ov8825_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = ov8825_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(ov8825_start_settings),
-	.stop_stream_conf = ov8825_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(ov8825_stop_settings),
-	.group_hold_on_conf = ov8825_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(ov8825_groupon_settings),
-	.group_hold_off_conf = ov8825_groupoff_settings,
-	.group_hold_off_conf_size =	ARRAY_SIZE(ov8825_groupoff_settings),
-	.init_settings = &ov8825_init_conf[0],
-	.init_size = ARRAY_SIZE(ov8825_init_conf),
-	.mode_settings = &ov8825_confs[0],
-	.output_settings = &ov8825_dimensions[0],
-	.num_conf = ARRAY_SIZE(ov8825_confs),
-};
-
-static struct msm_sensor_ctrl_t ov8825_s_ctrl = {
-	.msm_sensor_reg = &ov8825_regs,
-	.sensor_i2c_client = &ov8825_sensor_i2c_client,
-	.sensor_i2c_addr = 0x6C,
-	.sensor_output_reg_addr = &ov8825_reg_addr,
-	.sensor_id_info = &ov8825_id_info,
-	.sensor_exp_gain_info = &ov8825_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &ov8825_mut,
-	.sensor_i2c_driver = &ov8825_i2c_driver,
-	.sensor_v4l2_subdev_info = ov8825_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(ov8825_subdev_info),
-	.sensor_v4l2_subdev_ops = &ov8825_subdev_ops,
-	.func_tbl = &ov8825_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("OV 8MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/ov9724_v4l2.c b/drivers/media/video/msm/sensors/ov9724_v4l2.c
deleted file mode 100644
index a90406e..0000000
--- a/drivers/media/video/msm/sensors/ov9724_v4l2.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/* Copyright (c) 2013, The Linux Foundation. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#define SENSOR_NAME "ov9724"
-#define PLATFORM_DRIVER_NAME "msm_camera_ov9724"
-#define ov9724_obj ov9724_##obj
-
-DEFINE_MUTEX(ov9724_mut);
-static struct msm_sensor_ctrl_t ov9724_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf ov9724_start_settings[] = {
-	{0x0100, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf ov9724_stop_settings[] = {
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf ov9724_groupon_settings[] = {
-	{0x0104, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf ov9724_groupoff_settings[] = {
-	{0x0104, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf ov9724_prev_settings[] = {
-};
-
-static struct msm_camera_i2c_reg_conf ov9724_recommend_settings[] = {
-	{0x0103, 0x01},
-	{0x3210, 0x43},
-	{0x3606, 0x75},
-	{0x3705, 0x67},
-	{0x3601, 0x33},
-	{0x3607, 0x94},
-	{0x3608, 0x38},
-	{0x3712, 0x60},
-	{0x370d, 0x00},
-	{0x4010, 0x00},
-	{0x0340, 0x02},
-	{0x0341, 0xf8},
-	{0x0342, 0x06},
-	{0x0343, 0x28},
-	{0x0344, 0x00},
-	{0x0345, 0x00},
-	{0x0346, 0x00},
-	{0x0347, 0x00},
-	{0x0348, 0x04},
-	{0x0349, 0xff},
-	{0x034a, 0x02},
-	{0x034b, 0xcf},
-	{0x034c, 0x05},
-	{0x034d, 0x00},
-	{0x034e, 0x02},
-	{0x034f, 0xd0},
-	{0x4908, 0x20},
-	{0x4909, 0x14},
-	{0x3811, 0x10},
-	{0x3813, 0x0a},
-	{0x0202, 0x02},
-	{0x0203, 0xf0},
-	{0x4800, 0x64},
-	{0x4801, 0x0f},
-	{0x4801, 0x8f},
-	{0x4814, 0x2b},
-	{0x4307, 0x3a},
-	{0x5000, 0x06},
-	{0x5001, 0x73},
-	{0x0205, 0x3f},
-	{0x0101, 0x02}, /*Flip*/
-	{0x0100, 0x01},
-};
-
-static struct v4l2_subdev_info ov9724_subdev_info[] = {
-	{
-		.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
-		.colorspace = V4L2_COLORSPACE_JPEG,
-		.fmt    = 1,
-		.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array ov9724_init_conf[] = {
-	{&ov9724_recommend_settings[0],
-		ARRAY_SIZE(ov9724_recommend_settings), 0,
-		MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array ov9724_confs[] = {
-	{&ov9724_prev_settings[0],
-		ARRAY_SIZE(ov9724_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t ov9724_dimensions[] = {
-	{
-		.x_output = 0x500, /* 1280 */
-		.y_output = 0x2d0, /* 720 */
-		.line_length_pclk = 0x628, /* 1576 */
-		.frame_length_lines = 0x2f8, /* 760 */
-		.vt_pixel_clk = 36000000,
-		.op_pixel_clk = 94000000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_sensor_output_reg_addr_t ov9724_reg_addr = {
-	.x_output = 0x034c,
-	.y_output = 0x034e,
-	.line_length_pclk = 0x0342,
-	.frame_length_lines = 0x0340,
-};
-
-static struct msm_sensor_id_info_t ov9724_id_info = {
-	.sensor_id_reg_addr = 0x0000,
-	.sensor_id = 0x9724,
-};
-
-static struct msm_sensor_exp_gain_info_t ov9724_exp_gain_info = {
-	.coarse_int_time_addr = 0x0202,
-	.global_gain_addr = 0x0205,
-	.vert_offset = 6,
-};
-
-static const struct i2c_device_id ov9724_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&ov9724_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver ov9724_i2c_driver = {
-	.id_table = ov9724_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client ov9724_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	return i2c_add_driver(&ov9724_i2c_driver);
-}
-
-
-int32_t ov9724_write_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
-{
-	uint32_t fl_lines;
-	uint8_t offset;
-	fl_lines = s_ctrl->curr_frame_length_lines;
-	fl_lines = (fl_lines * s_ctrl->fps_divider) / Q10;
-	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
-	if (line > (fl_lines - offset))
-		fl_lines = line + offset;
-
-	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines,
-			fl_lines, MSM_CAMERA_I2C_WORD_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-			line, MSM_CAMERA_I2C_WORD_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->global_gain_addr, gain,
-			MSM_CAMERA_I2C_BYTE_DATA);
-	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	return 0;
-}
-
-
-static struct v4l2_subdev_core_ops ov9724_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops ov9724_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops ov9724_subdev_ops = {
-	.core = &ov9724_subdev_core_ops,
-	.video  = &ov9724_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t ov9724_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = ov9724_write_exp_gain,
-	.sensor_write_snapshot_exp_gain = ov9724_write_exp_gain,
-	.sensor_setting = msm_sensor_setting,
-	.sensor_csi_setting = msm_sensor_setting1,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-	.sensor_get_csi_params = msm_sensor_get_csi_params,
-};
-
-static struct msm_sensor_reg_t ov9724_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = ov9724_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(ov9724_start_settings),
-	.stop_stream_conf = ov9724_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(ov9724_stop_settings),
-	.group_hold_on_conf = ov9724_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(ov9724_groupon_settings),
-	.group_hold_off_conf = ov9724_groupoff_settings,
-	.group_hold_off_conf_size =
-		ARRAY_SIZE(ov9724_groupoff_settings),
-	.init_settings = &ov9724_init_conf[0],
-	.init_size = ARRAY_SIZE(ov9724_init_conf),
-	.mode_settings = &ov9724_confs[0],
-	.output_settings = &ov9724_dimensions[0],
-	.num_conf = ARRAY_SIZE(ov9724_confs),
-};
-
-static struct msm_sensor_ctrl_t ov9724_s_ctrl = {
-	.msm_sensor_reg = &ov9724_regs,
-	.sensor_i2c_client = &ov9724_sensor_i2c_client,
-	.sensor_i2c_addr = 0x20,
-	.sensor_output_reg_addr = &ov9724_reg_addr,
-	.sensor_id_info = &ov9724_id_info,
-	.sensor_exp_gain_info = &ov9724_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &ov9724_mut,
-	.sensor_i2c_driver = &ov9724_i2c_driver,
-	.sensor_v4l2_subdev_info = ov9724_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(ov9724_subdev_info),
-	.sensor_v4l2_subdev_ops = &ov9724_subdev_ops,
-	.func_tbl = &ov9724_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Omnivision WXGA Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
-
diff --git a/drivers/media/video/msm/sensors/ov9726_v4l2.c b/drivers/media/video/msm/sensors/ov9726_v4l2.c
deleted file mode 100644
index debd959..0000000
--- a/drivers/media/video/msm/sensors/ov9726_v4l2.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#define SENSOR_NAME "ov9726"
-#define PLATFORM_DRIVER_NAME "msm_camera_ov9726"
-#define ov9726_obj ov9726_##obj
-
-DEFINE_MUTEX(ov9726_mut);
-static struct msm_sensor_ctrl_t ov9726_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf ov9726_start_settings[] = {
-	{0x0100, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf ov9726_stop_settings[] = {
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf ov9726_groupon_settings[] = {
-	{0x0104, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf ov9726_groupoff_settings[] = {
-	{0x0104, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf ov9726_prev_settings[] = {
-};
-
-static struct msm_camera_i2c_reg_conf ov9726_recommend_settings[] = {
-	{0x0103, 0x01}, /* SOFTWARE_RESET */
-	{0x3026, 0x00}, /* OUTPUT_SELECT01 */
-	{0x3027, 0x00}, /* OUTPUT_SELECT02 */
-	{0x3002, 0xe8}, /* IO_CTRL00 */
-	{0x3004, 0x03}, /* IO_CTRL01 */
-	{0x3005, 0xff}, /* IO_CTRL02 */
-	{0x3703, 0x42},
-	{0x3704, 0x10},
-	{0x3705, 0x45},
-	{0x3603, 0xaa},
-	{0x3632, 0x2f},
-	{0x3620, 0x66},
-	{0x3621, 0xc0},
-	{0x0340, 0x03}, /* FRAME_LENGTH_LINES_HI */
-	{0x0341, 0xC1}, /* FRAME_LENGTH_LINES_LO */
-	{0x0342, 0x06}, /* LINE_LENGTH_PCK_HI */
-	{0x0343, 0x80}, /* LINE_LENGTH_PCK_LO */
-	{0x0202, 0x03}, /* COARSE_INTEGRATION_TIME_HI */
-	{0x0203, 0x43}, /* COARSE_INTEGRATION_TIME_LO */
-	{0x3833, 0x04},
-	{0x3835, 0x02},
-	{0x4702, 0x04},
-	{0x4704, 0x00}, /* DVP_CTRL01 */
-	{0x4706, 0x08},
-	{0x5052, 0x01},
-	{0x3819, 0x6e},
-	{0x3817, 0x94},
-	{0x3a18, 0x00}, /* AEC_GAIN_CEILING_HI */
-	{0x3a19, 0x7f}, /* AEC_GAIN_CEILING_LO */
-	{0x404e, 0x7e},
-	{0x3631, 0x52},
-	{0x3633, 0x50},
-	{0x3630, 0xd2},
-	{0x3604, 0x08},
-	{0x3601, 0x40},
-	{0x3602, 0x14},
-	{0x3610, 0xa0},
-	{0x3612, 0x20},
-	{0x034c, 0x05}, /* X_OUTPUT_SIZE_HI */
-	{0x034d, 0x10}, /* X_OUTPUT_SIZE_LO */
-	{0x034e, 0x03}, /* Y_OUTPUT_SIZE_HI */
-	{0x034f, 0x28}, /* Y_OUTPUT_SIZE_LO */
-	{0x0340, 0x03}, /* FRAME_LENGTH_LINES_HI */
-	{0x0341, 0xC1}, /* FRAME_LENGTH_LINES_LO */
-	{0x0342, 0x06}, /* LINE_LENGTH_PCK_HI */
-	{0x0343, 0x80}, /* LINE_LENGTH_PCK_LO */
-	{0x0202, 0x03}, /* COARSE_INTEGRATION_TIME_HI */
-	{0x0203, 0x43}, /* COARSE_INTEGRATION_TIME_LO */
-	{0x0303, 0x01}, /* VT_SYS_CLK_DIV_LO */
-	{0x3002, 0x00}, /* IO_CTRL00 */
-	{0x3004, 0x00}, /* IO_CTRL01 */
-	{0x3005, 0x00}, /* IO_CTRL02 */
-	{0x4801, 0x0f}, /* MIPI_CTRL01 */
-	{0x4803, 0x05}, /* MIPI_CTRL03 */
-	{0x4601, 0x16}, /* VFIFO_READ_CONTROL */
-	{0x3014, 0x05}, /* SC_CMMN_MIPI / SC_CTRL00 */
-	{0x3104, 0x80},
-	{0x0305, 0x04}, /* PRE_PLL_CLK_DIV_LO */
-	{0x0307, 0x64}, /* PLL_MULTIPLIER_LO */
-	{0x300c, 0x02},
-	{0x300d, 0x20},
-	{0x300e, 0x01},
-	{0x3010, 0x01},
-	{0x460e, 0x81}, /* VFIFO_CONTROL00 */
-	{0x0101, 0x01}, /* IMAGE_ORIENTATION */
-	{0x3707, 0x14},
-	{0x3622, 0x9f},
-	{0x5047, 0x3D}, /* ISP_CTRL47 */
-	{0x4002, 0x45}, /* BLC_CTRL02 */
-	{0x5000, 0x06}, /* ISP_CTRL0 */
-	{0x5001, 0x00}, /* ISP_CTRL1 */
-	{0x3406, 0x00}, /* AWB_MANUAL_CTRL */
-	{0x3503, 0x13}, /* AEC_ENABLE */
-	{0x4005, 0x18}, /* BLC_CTRL05 */
-	{0x4837, 0x21},
-	{0x0100, 0x01}, /* MODE_SELECT */
-	{0x3a0f, 0x64}, /* AEC_CTRL0F */
-	{0x3a10, 0x54}, /* AEC_CTRL10 */
-	{0x3a11, 0xc2}, /* AEC_CTRL11 */
-	{0x3a1b, 0x64}, /* AEC_CTRL1B */
-	{0x3a1e, 0x54}, /* AEC_CTRL1E */
-	{0x3a1a, 0x05}, /* AEC_DIFF_MAX */
-};
-
-static struct v4l2_subdev_info ov9726_subdev_info[] = {
-	{
-	.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array ov9726_init_conf[] = {
-	{&ov9726_recommend_settings[0],
-	ARRAY_SIZE(ov9726_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array ov9726_confs[] = {
-	{&ov9726_prev_settings[0],
-	ARRAY_SIZE(ov9726_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t ov9726_dimensions[] = {
-	{
-		.x_output = 0x510, /* 1296 */
-		.y_output = 0x328, /* 808 */
-		.line_length_pclk = 0x680, /* 1664 */
-		.frame_length_lines = 0x3C1, /* 961 */
-		.vt_pixel_clk = 320000000,
-		.op_pixel_clk = 320000000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_sensor_output_reg_addr_t ov9726_reg_addr = {
-	.x_output = 0x034c,
-	.y_output = 0x034e,
-	.line_length_pclk = 0x0342,
-	.frame_length_lines = 0x0340,
-};
-
-static struct msm_sensor_id_info_t ov9726_id_info = {
-	.sensor_id_reg_addr = 0x0000,
-	.sensor_id = 0x9726,
-};
-
-static struct msm_sensor_exp_gain_info_t ov9726_exp_gain_info = {
-	.coarse_int_time_addr = 0x0202,
-	.global_gain_addr = 0x0204,
-	.vert_offset = 6,
-};
-
-static const struct i2c_device_id ov9726_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&ov9726_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver ov9726_i2c_driver = {
-	.id_table = ov9726_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client ov9726_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	return i2c_add_driver(&ov9726_i2c_driver);
-}
-
-static struct v4l2_subdev_core_ops ov9726_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops ov9726_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops ov9726_subdev_ops = {
-	.core = &ov9726_subdev_core_ops,
-	.video  = &ov9726_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t ov9726_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_write_snapshot_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_csi_setting = msm_sensor_setting1,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-};
-
-static struct msm_sensor_reg_t ov9726_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = ov9726_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(ov9726_start_settings),
-	.stop_stream_conf = ov9726_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(ov9726_stop_settings),
-	.group_hold_on_conf = ov9726_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(ov9726_groupon_settings),
-	.group_hold_off_conf = ov9726_groupoff_settings,
-	.group_hold_off_conf_size =
-		ARRAY_SIZE(ov9726_groupoff_settings),
-	.init_settings = &ov9726_init_conf[0],
-	.init_size = ARRAY_SIZE(ov9726_init_conf),
-	.mode_settings = &ov9726_confs[0],
-	.output_settings = &ov9726_dimensions[0],
-	.num_conf = ARRAY_SIZE(ov9726_confs),
-};
-
-static struct msm_sensor_ctrl_t ov9726_s_ctrl = {
-	.msm_sensor_reg = &ov9726_regs,
-	.sensor_i2c_client = &ov9726_sensor_i2c_client,
-	.sensor_i2c_addr = 0x20,
-	.sensor_output_reg_addr = &ov9726_reg_addr,
-	.sensor_id_info = &ov9726_id_info,
-	.sensor_exp_gain_info = &ov9726_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &ov9726_mut,
-	.sensor_i2c_driver = &ov9726_i2c_driver,
-	.sensor_v4l2_subdev_info = ov9726_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(ov9726_subdev_info),
-	.sensor_v4l2_subdev_ops = &ov9726_subdev_ops,
-	.func_tbl = &ov9726_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Omnivision WXGA Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
-
-
diff --git a/drivers/media/video/msm/sensors/s5k3h2yx_v4l2.c b/drivers/media/video/msm/sensors/s5k3h2yx_v4l2.c
new file mode 100644
index 0000000..517c6f2
--- /dev/null
+++ b/drivers/media/video/msm/sensors/s5k3h2yx_v4l2.c
@@ -0,0 +1,1508 @@
+#include "msm_sensor.h"
+
+#ifdef CONFIG_RAWCHIP
+#include "rawchip/rawchip.h"
+#endif
+
+#define SENSOR_NAME "s5k3h2yx"
+#define PLATFORM_DRIVER_NAME "msm_camera_s5k3h2yx"
+#define s5k3h2yx_obj s5k3h2yx_##obj
+
+#define S5K3H2YX_REG_READ_MODE 0x0101
+#define S5K3H2YX_READ_NORMAL_MODE 0x0000	
+#define S5K3H2YX_READ_MIRROR 0x0001			
+#define S5K3H2YX_READ_FLIP 0x0002			
+#define S5K3H2YX_READ_MIRROR_FLIP 0x0003	
+
+#define DEFAULT_VCM_MAX 73
+#define DEFAULT_VCM_MED 35
+#define DEFAULT_VCM_MIN 8
+
+
+DEFINE_MUTEX(s5k3h2yx_mut);
+DEFINE_MUTEX(s5k3h2yx_sensor_init_mut); 
+static struct msm_sensor_ctrl_t s5k3h2yx_s_ctrl;
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_start_settings[] = {
+	{0x0100, 0x01},
+};
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_stop_settings[] = {
+	{0x0100, 0x00},
+};
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_groupon_settings[] = {
+	{0x104, 0x01},
+};
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_groupoff_settings[] = {
+	{0x104, 0x00},
+};
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_mipi_settings[] = {
+	{0x3065, 0x35},
+	{0x310E, 0x00},
+	{0x3098, 0xAB},
+	{0x30C7, 0x0A},
+	{0x309A, 0x01},
+	{0x310D, 0xC6},
+	{0x30C3, 0x40},
+	{0x30BB, 0x02},
+	{0x30BC, 0x38},
+	{0x30BD, 0x40},
+	{0x3110, 0x70},
+	{0x3111, 0x80},
+	{0x3112, 0x7B},
+	{0x3113, 0xC0},
+	{0x30C7, 0x1A},
+};
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_pll_settings[] = {
+	{0x0305, 0x04},
+	{0x0306, 0x00},
+	{0x0307, 0x98},
+	{0x0303, 0x01},
+	{0x0301, 0x05},
+	{0x030B, 0x01},
+	{0x0309, 0x05},
+	{0x30CC, 0xE0},
+	{0x31A1, 0x5A},
+};
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_prev_settings[] = {
+	
+	{0x0305, 0x04},
+	{0x0306, 0x00},
+	{0x0307, 0x6C},
+	{0x0303, 0x01},
+	{0x0301, 0x05},
+	{0x030B, 0x01},
+	{0x0309, 0x05},
+	{0x30CC, 0xB0},
+	{0x31A1, 0x56},
+
+	
+	{0x0200, 0x02},
+	{0x0201, 0x50},
+	{0x0202, 0x04},
+	{0x0203, 0xDB},
+	{0x0204, 0x00},
+	{0x0205, 0x20},
+	{0x0342, 0x0D},
+	{0x0343, 0x8E},
+#ifdef CONFIG_RAWCHIP
+	{0x0340, 0x04},
+	{0x0341, 0xF4},
+#else
+	{0x0340, 0x04},
+	{0x0341, 0xE0},
+#endif
+	
+	{0x0344, 0x00},
+	{0x0345, 0x00},
+	{0x0346, 0x00},
+	{0x0347, 0x00},
+	{0x0348, 0x0C},
+	{0x0349, 0xCD},
+	{0x034A, 0x09},
+	{0x034B, 0x9F},
+	{0x0381, 0x01},
+	{0x0383, 0x03},
+	{0x0385, 0x01},
+	{0x0387, 0x03},
+	{0x0401, 0x00},
+	{0x0405, 0x10},
+	{0x0700, 0x05},
+	{0x0701, 0x30},
+	{0x034C, 0x06},
+	{0x034D, 0x68},
+	{0x034E, 0x04},
+	{0x034F, 0xD0},
+	
+	{0x300E, 0xED},
+	{0x301D, 0x80},
+	{0x301A, 0x77},
+};
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_video_settings[] = {
+	
+	{0x0305, 0x04},
+	{0x0306, 0x00},
+	{0x0307, 0x98},
+	{0x0303, 0x01},
+	{0x0301, 0x05},
+	{0x030B, 0x01},
+	{0x0309, 0x05},
+	{0x30CC, 0xE0},
+	{0x31A1, 0x5A},
+
+	{ 0x0344 , 0x00 }, 
+	{ 0x0345 , 0x62 },
+	{ 0x0346 , 0x01 }, 
+	{ 0x0347 , 0x6C },
+	{ 0x0348 , 0x0C }, 
+	{ 0x0349 , 0x6D },
+	{ 0x034A , 0x08 }, 
+	{ 0x034B , 0x33 },
+	{ 0x0381 , 0x01 }, 
+	{ 0x0383 , 0x01 }, 
+	{ 0x0385 , 0x01 }, 
+	{ 0x0387 , 0x01 }, 
+	{ 0x0105 , 0x01 }, 
+	{ 0x0401 , 0x00 }, 
+	{ 0x0405 , 0x10 },
+	{ 0x0700 , 0x05 }, 
+	{ 0x0701 , 0x30 },
+	{ 0x034C , 0x0C }, 
+	{ 0x034D , 0x0C },
+	{ 0x034E , 0x06 }, 
+	{ 0x034F , 0xC8 },
+	{ 0x0200 , 0x02 }, 
+	{ 0x0201 , 0x50 },
+	{ 0x0202 , 0x04 }, 
+	{ 0x0203 , 0xDB },
+	{ 0x0204 , 0x00 }, 
+	{ 0x0205 , 0x20 },
+	{ 0x0342 , 0x0D }, 
+	{ 0x0343 , 0x8E },
+#ifdef CONFIG_RAWCHIP
+	{ 0x0340 , 0x06 }, 
+	{ 0x0341 , 0xEC },
+#else
+	{ 0x0340 , 0x06 }, 
+	{ 0x0341 , 0xD8 },
+#endif
+
+	
+	{ 0x300E , 0x29 }, 
+	{ 0x31A3 , 0x00 }, 
+	{ 0x301A , 0x77 }, 
+};
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_fast_video_settings[] = {
+#if 0
+  {0x0305, 0x04}, 
+  {0x0306, 0x00}, 
+  {0x0307, 0x98}, 
+  {0x0303, 0x01}, 
+  {0x0301, 0x05}, 
+  {0x030B, 0x01}, 
+  {0x0309, 0x05}, 
+  {0x30CC, 0xE0}, 
+  {0x31A1, 0x5A}, 
+  
+  
+  {0x0344, 0x00}, 
+  {0x0345, 0x70},
+  {0x0346, 0x01}, 
+  {0x0347, 0x74},
+  {0x0348, 0x0C}, 
+  {0x0349, 0x5D},
+  {0x034A, 0x08}, 
+  {0x034B, 0x2B},
+
+  {0x0381, 0x01}, 
+  {0x0383, 0x03}, 
+  {0x0385, 0x01}, 
+  {0x0387, 0x03}, 
+
+  {0x0401, 0x00}, 
+  {0x0405, 0x10},
+  {0x0700, 0x05}, 
+  {0x0701, 0x30},
+
+  {0x034C, 0x05}, 
+  {0x034D, 0xF8},
+  {0x034E, 0x03}, 
+  {0x034F, 0x5C},
+
+  {0x0200, 0x02}, 
+  {0x0201, 0x50},
+  {0x0202, 0x02}, 
+  {0x0203, 0x5c},
+  {0x0204, 0x00}, 
+  {0x0205, 0x20},
+  {0x0342, 0x0D}, 
+  {0x0343, 0x8E},
+#ifdef CONFIG_RAWCHIP
+  
+  {0x0340, 0x03},
+  {0x0341, 0xC0},
+#else
+  
+  {0x0340, 0x03},
+  {0x0341, 0x6C},
+#endif
+
+  
+  
+  {0x300E, 0x2D},
+  {0x31A3, 0x40},
+  {0x301A, 0xA7},
+  {0x3053, 0xCB}, 
+ #else
+{0x0305, 0x04},	
+{0x0306, 0x00},	
+{0x0307, 0x98},	
+{0x0303, 0x01},	
+{0x0301, 0x05},	
+{0x030B, 0x01},	
+{0x0309, 0x05},	
+{0x30CC, 0xE0},	
+{0x31A1, 0x5A},	
+
+{0x0344, 0x00},	
+{0x0345, 0x00},
+{0x0346, 0x00},	
+{0x0347, 0xD4},
+{0x0348, 0x0C},	
+{0x0349, 0xCD},
+{0x034A, 0x08},	
+{0x034B, 0xCB},
+
+{0x0381, 0x01},	
+{0x0383, 0x03},	
+{0x0385, 0x01},	
+{0x0387, 0x07},	
+
+{0x0401, 0x00},	
+{0x0405, 0x10},
+{0x0700, 0x05},	
+{0x0701, 0x30},
+
+{0x034C, 0x06},	
+{0x034D, 0x68},
+{0x034E, 0x01},	
+{0x034F, 0xFE},
+
+{0x0200, 0x02},	
+{0x0201, 0x50},
+{0x0202, 0x01},	
+{0x0203, 0x39},
+{0x0204, 0x00},	
+{0x0205, 0x20},
+{0x0342, 0x0D},	
+{0x0343, 0x8E},
+#ifdef CONFIG_RAWCHIP
+  {0x0340, 0x02},	
+  {0x0341, 0x22},
+#else
+  {0x0340, 0x02},	
+  {0x0341, 0x0E},
+#endif
+
+{0x300E, 0x2D},
+{0x31A3, 0x40},
+{0x301A, 0xA7},
+{0x3053, 0xCB}, 
+#endif 
+};
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_snap_settings[] = {
+	
+	{0x0305, 0x04},
+	{0x0306, 0x00},
+	{0x0307, 0x98},
+	{0x0303, 0x01},
+	{0x0301, 0x05},
+	{0x030B, 0x01},
+	{0x0309, 0x05},
+	{0x30CC, 0xE0},
+	{0x31A1, 0x5A},
+
+	
+	{0x0200, 0x02},
+	{0x0201, 0x50},
+	{0x0202, 0x04},
+	{0x0203, 0xE7},
+	{0x0204, 0x00},
+	{0x0205, 0x20},
+	{0x0342, 0x0D},
+	{0x0343, 0x8E},
+#ifdef CONFIG_RAWCHIP
+	{0x0340, 0x09},
+	{0x0341, 0xC4},
+#else
+	{0x0340, 0x09},
+	{0x0341, 0xC0},
+#endif
+	
+	{0x0344, 0x00},
+	{0x0345, 0x00},
+	{0x0346, 0x00},
+	{0x0347, 0x00},
+	{0x0348, 0x0C},
+	{0x0349, 0xCF},
+	{0x034A, 0x09},
+	{0x034B, 0x9F},
+	{0x0381, 0x01},
+	{0x0383, 0x01},
+	{0x0385, 0x01},
+	{0x0387, 0x01},
+	{0x0105, 0x01}, 
+	{0x0401, 0x00},
+	{0x0405, 0x10},
+	{0x0700, 0x05},
+	{0x0701, 0x30},
+	{0x034C, 0x0C},
+	{0x034D, 0xD0},
+	{0x034E, 0x09},
+	{0x034F, 0xA0},
+
+	
+	{ 0x300E , 0x29 }, 
+	{ 0x31A3 , 0x00 }, 
+	{ 0x301A , 0x77 }, 
+};
+
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_snap_wide_settings[] = {
+
+	{0x0305, 0x04},	
+	{0x0306, 0x00},	
+	{0x0307, 0x98},	
+	{0x0303, 0x01},	
+	{0x0301, 0x05},	
+	{0x030B, 0x01},	
+	{0x0309, 0x05},	
+	{0x30CC, 0xE0},	
+	{0x31A1, 0x5A},	
+
+	{0x0344, 0x00},	
+	{0x0345, 0x00},
+	{0x0346, 0x01},	
+	{0x0347, 0x30},
+	{0x0348, 0x0C},	
+	{0x0349, 0xCF},
+	{0x034A, 0x08},	
+	{0x034B, 0x6F},
+
+	{0x0381, 0x01},	
+	{0x0383, 0x01},	
+	{0x0385, 0x01},	
+	{0x0387, 0x01},	
+
+	{0x0105, 0x01}, 
+	{0x0401, 0x00},	
+	{0x0405, 0x10},
+	{0x0700, 0x05},	
+	{0x0701, 0x30},
+
+	{0x034C, 0x0C},	
+	{0x034D, 0xD0},
+	{0x034E, 0x07},	
+	{0x034F, 0x40},
+
+	{0x0200, 0x02},	
+	{0x0201, 0x50},
+	{0x0202, 0x04},	
+	{0x0203, 0xDB},
+	{0x0204, 0x00},	
+	{0x0205, 0x20},
+	{0x0342, 0x0D},	
+	{0x0343, 0x8E},
+#if 0
+	{0x0340, 0x07},	
+	{0x0341, 0x50},
+#else
+	{0x0340, 0x09},	
+	{0x0341, 0x60},
+#endif
+
+	{0x300E, 0x29},
+	{0x31A3, 0x00},
+	{0x301A, 0xA7},
+	{0x3053, 0xCB},	
+};
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_night_settings[] = {
+  {0x0305, 0x04},	
+  {0x0306, 0x00},	
+  {0x0307, 0x98},	
+  {0x0303, 0x01},	
+  {0x0301, 0x05},	
+  {0x030B, 0x01},	
+  {0x0309, 0x05},	
+  {0x30CC, 0xE0},	
+  {0x31A1, 0x5A},	
+
+  {0x0344, 0x00},	
+  {0x0345, 0x00},	
+  {0x0346, 0x00},	
+  {0x0347, 0x00},	
+  {0x0348, 0x0C},	
+  {0x0349, 0xCD},	
+  {0x034A, 0x09},	
+  {0x034B, 0x9F},	
+
+  {0x0381, 0x01},	
+  {0x0383, 0x03},	
+  {0x0385, 0x01},	
+  {0x0387, 0x03},	
+
+  {0x0401, 0x00},	
+  {0x0405, 0x10},	
+  {0x0700, 0x05},	
+  {0x0701, 0x30},	
+
+  {0x034C, 0x06},	
+  {0x034D, 0x68},	
+  {0x034E, 0x04},	
+  {0x034F, 0xD0},	
+
+  {0x0200, 0x02},	
+  {0x0201, 0x50},	
+  {0x0202, 0x04},	
+  {0x0203, 0xDB},	
+  {0x0204, 0x00},	
+  {0x0205, 0x20},	
+  {0x0342, 0x0D},	
+  {0x0343, 0x8E},	
+  {0x0340, 0x04},	
+  {0x0341, 0xE0},
+
+#ifdef CONFIG_RAWCHIP
+  {0x0340, 0x04},	
+  {0x0341, 0xF4},
+#else
+  {0x0340, 0x04},	
+  {0x0341, 0xE0},
+#endif
+
+
+  {0x300E, 0x2D},	
+  {0x31A3, 0x40},	
+  {0x301A, 0xA7},	
+  {0x3053, 0xCF},
+};
+
+
+static struct msm_camera_i2c_reg_conf s5k3h2yx_recommend_settings[] = {
+	{0x3000, 0x08},
+	{0x3001, 0x05},
+	{0x3002, 0x0D},
+	{0x3003, 0x21},
+	{0x3004, 0x62},
+	{0x3005, 0x0B},
+	{0x3006, 0x6D},
+	{0x3007, 0x02},
+	{0x3008, 0x62},
+	{0x3009, 0x62},
+	{0x300A, 0x41},
+	{0x300B, 0x10},
+	{0x300C, 0x21},
+	{0x300D, 0x04},
+	{0x307E, 0x03},
+	{0x307F, 0xA5},
+	{0x3080, 0x04},
+	{0x3081, 0x29},
+	{0x3082, 0x03},
+	{0x3083, 0x21},
+	{0x3011, 0x5F},
+	{0x3156, 0xE2},
+	{0x3027, 0x0E},
+	{0x300f, 0x02},
+	{0x3010, 0x10},
+	{0x3017, 0x74},
+	{0x3018, 0x00},
+	{0x3020, 0x02},
+	{0x3021, 0x24},
+	{0x3023, 0x80},
+	{0x3024, 0x04},
+	{0x3025, 0x08},
+	{0x301C, 0xD4},
+	{0x315D, 0x00},
+	
+	{0x300E, 0x29},
+	{0x31A3, 0x00},
+	{0x301A, 0xA7},
+	{0x3053, 0xCF},
+	{0x3054, 0x00},
+	{0x3055, 0x35},
+	{0x3062, 0x04},
+	{0x3063, 0x38},
+	{0x31A4, 0x04},
+	{0x3016, 0x54},
+	{0x3157, 0x02},
+	{0x3158, 0x00},
+	{0x315B, 0x02},
+	{0x315C, 0x00},
+	{0x301B, 0x05},
+	{0x3028, 0x41},
+	{0x302A, 0x00},
+	{0x3060, 0x01},
+	{0x302D, 0x19},
+	{0x302B, 0x04},
+	{0x3072, 0x13},
+	{0x3073, 0x21},
+	{0x3074, 0x82},
+	{0x3075, 0x20},
+	{0x3076, 0xA2},
+	{0x3077, 0x02},
+	{0x3078, 0x91},
+	{0x3079, 0x91},
+	{0x307A, 0x61},
+	{0x307B, 0x28},
+	{0x307C, 0x31},
+};
+
+static struct v4l2_subdev_info s5k3h2yx_subdev_info[] = {
+	{
+	.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
+	.colorspace = V4L2_COLORSPACE_JPEG,
+	.fmt    = 1,
+	.order    = 0,
+	},
+	
+};
+
+static struct msm_camera_i2c_conf_array s5k3h2yx_init_conf[] = {
+	{&s5k3h2yx_mipi_settings[0],
+	ARRAY_SIZE(s5k3h2yx_mipi_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&s5k3h2yx_recommend_settings[0],
+	ARRAY_SIZE(s5k3h2yx_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&s5k3h2yx_pll_settings[0],
+	ARRAY_SIZE(s5k3h2yx_pll_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+};
+
+static struct msm_camera_i2c_conf_array s5k3h2yx_confs[] = {
+	{&s5k3h2yx_snap_settings[0],
+	ARRAY_SIZE(s5k3h2yx_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&s5k3h2yx_prev_settings[0],
+	ARRAY_SIZE(s5k3h2yx_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&s5k3h2yx_video_settings[0],
+	ARRAY_SIZE(s5k3h2yx_video_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&s5k3h2yx_fast_video_settings[0],
+	ARRAY_SIZE(s5k3h2yx_fast_video_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&s5k3h2yx_snap_wide_settings[0],
+	ARRAY_SIZE(s5k3h2yx_snap_wide_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&s5k3h2yx_night_settings[0],
+	ARRAY_SIZE(s5k3h2yx_night_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+};
+
+static struct msm_sensor_output_info_t s5k3h2yx_dimensions[] = {
+	{
+		.x_output = 0xCD0,
+		.y_output = 0x9A0,
+		.line_length_pclk = 0xD8E,
+#ifdef CONFIG_RAWCHIP
+		.frame_length_lines = 0x9C4,
+#else
+		.frame_length_lines = 0x9C0,
+#endif
+		.vt_pixel_clk = 182400000,
+		.op_pixel_clk = 182400000,
+		.binning_factor = 1,
+		.x_addr_start = 0,
+		.y_addr_start = 0,
+		.x_addr_end = 0xCCF,
+		.y_addr_end = 0x99F,
+		.x_even_inc = 1,
+		.x_odd_inc = 1,
+		.y_even_inc = 1,
+		.y_odd_inc = 1,
+		.binning_rawchip = 0x11,
+	},
+	{
+		.x_output = 0x668,
+		.y_output = 0x4D0,
+		.line_length_pclk = 0xD8E,
+#ifdef CONFIG_RAWCHIP
+		.frame_length_lines = 0x4F4,
+#else
+		.frame_length_lines = 0x4E0,
+#endif
+		.vt_pixel_clk = 129600000,
+		.op_pixel_clk = 129600000,
+		.binning_factor = 1,
+		.x_addr_start = 0,
+		.y_addr_start = 0,
+		.x_addr_end = 0xCCD,
+		.y_addr_end = 0x99F,
+		.x_even_inc = 1,
+		.x_odd_inc = 3,
+		.y_even_inc = 1,
+		.y_odd_inc = 3,
+		.binning_rawchip = 0x22,
+	},
+	{
+		.x_output = 0xC0C,
+		.y_output = 0x6C8,
+		.line_length_pclk = 0xD8E,
+#ifdef CONFIG_RAWCHIP
+		.frame_length_lines = 0x6EC,
+#else
+		.frame_length_lines = 0x6D8,
+#endif
+		.vt_pixel_clk = 182400000,
+		.op_pixel_clk = 182400000,
+		.binning_factor = 1,
+		.x_addr_start = 0x062,
+		.y_addr_start = 0x16C,
+		.x_addr_end = 0xC6D,
+		.y_addr_end = 0x833,
+		.x_even_inc = 1,
+		.x_odd_inc = 1,
+		.y_even_inc = 1,
+		.y_odd_inc = 1,
+		.binning_rawchip = 0x11,
+	},
+	{
+#if 0
+		.x_output = 0x5F8,
+		.y_output = 0x35C,
+		.line_length_pclk = 0xD8E,
+#ifdef CONFIG_RAWCHIP
+		.frame_length_lines = 0x3C0,
+#else
+		.frame_length_lines = 0x36C,
+#endif
+		.vt_pixel_clk = 182400000,
+		.op_pixel_clk = 182400000,
+		.binning_factor = 1,
+		.x_addr_start = 0x070,
+		.y_addr_start = 0x174,
+		.x_addr_end = 0xC5D,
+		.y_addr_end = 0x82B,
+		.x_even_inc = 1,
+		.x_odd_inc = 3,
+		.y_even_inc = 1,
+		.y_odd_inc = 3,
+		.binning_rawchip = 0x22,
+#else
+		.x_output = 0x668,
+		.y_output = 0x1FE,
+		.line_length_pclk = 0xD8E,
+#ifdef CONFIG_RAWCHIP
+		.frame_length_lines = 0x222,
+#else
+		.frame_length_lines = 0x20E,
+#endif
+		.vt_pixel_clk = 182400000,
+		.op_pixel_clk = 182400000,
+		.binning_factor = 1,
+		.x_addr_start = 0,
+		.y_addr_start = 0x0D4,
+		.x_addr_end = 0xCCD,
+		.y_addr_end = 0x8CB,
+		.x_even_inc = 1,
+		.x_odd_inc = 3,
+		.y_even_inc = 1,
+		.y_odd_inc = 7,
+		.binning_rawchip = 0x22,
+#endif 
+	},
+	{
+		.x_output = 0xCD0,
+		.y_output = 0x740,
+		.line_length_pclk = 0xD8E,
+#ifdef CONFIG_RAWCHIP
+		.frame_length_lines = 0x960,  
+#else
+		.frame_length_lines = 0x960,  
+#endif
+		.vt_pixel_clk = 182400000,
+		.op_pixel_clk = 182400000,
+		.binning_factor = 1,
+		.x_addr_start = 0,
+		.y_addr_start = 0x0130,
+		.x_addr_end = 0xCCF,
+		.y_addr_end = 0x86F,
+		.x_even_inc = 1,
+		.x_odd_inc = 1,
+		.y_even_inc = 1,
+		.y_odd_inc = 1,
+		.binning_rawchip = 0x11,
+	},
+	{
+		.x_output = 0x668,
+		.y_output = 0x4D0,
+		.line_length_pclk = 0xD8E,
+#ifdef CONFIG_RAWCHIP
+		.frame_length_lines = 0x4F4,
+#else
+		.frame_length_lines = 0x4E0,
+#endif
+		.vt_pixel_clk = 182400000,
+		.op_pixel_clk = 182400000,
+		.binning_factor = 1,
+		.x_addr_start = 0,
+		.y_addr_start = 0,
+		.x_addr_end = 0xCCD,
+		.y_addr_end = 0x99F,
+		.x_even_inc = 1,
+		.x_odd_inc = 3,
+		.y_even_inc = 1,
+		.y_odd_inc = 3,
+		.binning_rawchip = 0x22,
+	},
+};
+
+static struct msm_camera_csid_vc_cfg s5k3h2yx_cid_cfg[] = {
+	{0, CSI_RAW10, CSI_DECODE_10BIT},
+	{1, CSI_EMBED_DATA, CSI_DECODE_8BIT},
+};
+
+static struct msm_camera_csi2_params s5k3h2yx_csi_params = {
+	.csid_params = {
+		.lane_assign = 0xe4,
+		.lane_cnt = 2,
+		.lut_params = {
+			.num_cid = 2,
+			.vc_cfg = s5k3h2yx_cid_cfg,
+		},
+	},
+	.csiphy_params = {
+		.lane_cnt = 2,
+		.settle_cnt = 0x1B,
+	},
+};
+
+static struct msm_camera_csi2_params *s5k3h2yx_csi_params_array[] = {
+	&s5k3h2yx_csi_params,
+	&s5k3h2yx_csi_params,
+	&s5k3h2yx_csi_params,
+	&s5k3h2yx_csi_params,
+	&s5k3h2yx_csi_params,
+	&s5k3h2yx_csi_params
+};
+
+static struct msm_sensor_output_reg_addr_t s5k3h2yx_reg_addr = {
+	.x_output = 0x34C,
+	.y_output = 0x34E,
+	.line_length_pclk = 0x342,
+	.frame_length_lines = 0x340,
+};
+
+static struct msm_sensor_id_info_t s5k3h2yx_id_info = {
+	.sensor_id_reg_addr = 0x0,
+	.sensor_id = 0x382B,
+};
+
+static struct msm_sensor_exp_gain_info_t s5k3h2yx_exp_gain_info = {
+	.coarse_int_time_addr = 0x202,
+	.global_gain_addr = 0x204,
+	.vert_offset = 16,
+	.min_vert = 4,  
+	.sensor_max_linecount = 65519,  
+};
+
+static uint32_t vcm_clib;
+static uint16_t vcm_clib_min,vcm_clib_med,vcm_clib_max;
+
+static void s5k3h2yx_read_vcm_clib(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int32_t rc=0;
+	unsigned short info_value = 0;
+
+	struct msm_camera_i2c_client *s5k3h2yx_msm_camera_i2c_client = s_ctrl->sensor_i2c_client;
+
+	vcm_clib =0;
+	vcm_clib_min = 0;
+	vcm_clib_med = 0;
+	vcm_clib_max = 0;
+
+
+	pr_info("%s: sensor OTP information:\n", __func__);
+
+	
+	rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x3A1C, 0x00);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x3A1C fail\n", __func__);
+
+	
+	rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x0A00, 0x04);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A00 (Start) fail\n", __func__);
+
+	mdelay(4);
+
+	vcm_clib =0;
+	rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x0A02, 5);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, 5);
+			
+	rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x0A00, 0x01);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__);
+
+ 	rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A04), &info_value);
+	if (rc < 0)
+		pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04));
+	else
+		{
+		pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+		vcm_clib = (vcm_clib << 8) | info_value;
+		}
+ 	rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A05), &info_value);
+	if (rc < 0)
+		pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A05));
+	else
+		{
+		pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+		vcm_clib = (vcm_clib << 8) | info_value;
+		}
+
+	
+	if(vcm_clib >> 8 == 0x03)
+		{
+		  uint32_t p;
+
+		  rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A0C), &info_value);
+		  if (rc < 0)
+			  pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A0C));
+		  else
+			  {
+			  pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+			  vcm_clib = (vcm_clib << 8) | info_value;
+			  }
+		  rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A0D), &info_value);
+		  if (rc < 0)
+			  pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A0D));
+		  else
+			  {
+			  pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+			  vcm_clib = (vcm_clib << 8) | info_value;
+			  }
+
+		  p=((vcm_clib & 0x0000FFFF) ) >> 3 ;
+		  vcm_clib_min= p - 20;
+		  vcm_clib_max= p + 26;
+		  vcm_clib_med= (vcm_clib_max + vcm_clib_min)/2 -26/4;
+		  pr_info("%s: VCM clib=0x%x, [Sharp] (p=%d) min/med/max=%d %d %d\n"
+			  , __func__, vcm_clib, p, vcm_clib_min, vcm_clib_med, vcm_clib_max);
+		}
+	else
+		{
+    		vcm_clib =0;
+    		rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x0A02, 16);
+    		if (rc < 0)
+    			pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, 16);
+    				
+    		rc = msm_camera_i2c_write_b(s5k3h2yx_msm_camera_i2c_client, 0x0A00, 0x01);
+    		if (rc < 0)
+    			pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__);
+    		
+    		rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A04), &info_value);
+    		if (rc < 0)
+    			pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04));
+    		else
+    			{
+    			pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+    			vcm_clib = (vcm_clib << 8) | info_value;
+    			}
+    		rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A05), &info_value);
+    		if (rc < 0)
+    			pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A05));
+    		else
+    			{
+    			pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+    			vcm_clib = (vcm_clib << 8) | info_value;
+    			}
+    
+    		if(vcm_clib >> 8 == 0x04)
+    		{
+    		  uint32_t p;
+    
+    		  rc = msm_camera_i2c_read_b(s5k3h2yx_msm_camera_i2c_client, (0x0A0E), &info_value);
+    		  if (rc < 0)
+    			  pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A0E));
+    		  else
+    			  {
+    			  pr_info("%s: i2c_read_b 0x%x\n", __func__, info_value);
+    			  vcm_clib = (vcm_clib << 16) | info_value;
+    			  }
+    
+    		  p=((vcm_clib & 0x000000FF) + 0x00000080) >> 3 ;
+    		  vcm_clib_min= p - 20;
+    		  vcm_clib_max= p + 26;
+    		  vcm_clib_med= (vcm_clib_max + vcm_clib_min)/2 -26/4;
+			  pr_info("%s: VCM clib=0x%x, [Lite-On] (p=%d) min/med/max=%d %d %d\n"
+				  , __func__, vcm_clib, p, vcm_clib_min, vcm_clib_med, vcm_clib_max);
+    		}
+		}
+	if(((vcm_clib & 0x0000FFFF) == 0x0000) || (vcm_clib_min==0 && vcm_clib_med==0 && vcm_clib_max==0)
+		||(
+		     (DEFAULT_VCM_MAX < vcm_clib_max) || (DEFAULT_VCM_MAX < vcm_clib_med) || (DEFAULT_VCM_MAX < vcm_clib_min)
+		  || (DEFAULT_VCM_MIN > vcm_clib_max) || (DEFAULT_VCM_MIN > vcm_clib_med) || (DEFAULT_VCM_MIN > vcm_clib_min)
+		  || ((vcm_clib_med < vcm_clib_min) || (vcm_clib_med > vcm_clib_max))
+		))
+		{
+		  vcm_clib_min=DEFAULT_VCM_MIN;
+		  vcm_clib_med=DEFAULT_VCM_MED;
+		  vcm_clib_max=DEFAULT_VCM_MAX;
+		}
+
+
+	pr_info("%s: VCM clib=0x%x, min/med/max=%d %d %d\n"
+		, __func__, vcm_clib, vcm_clib_min, vcm_clib_med, vcm_clib_max);
+
+	return;
+
+}
+
+
+static int lens_info;	
+
+static void s5k3h2yx_read_lens_info(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int32_t  rc;
+	int page = 0;
+	unsigned short info_value = 0, info_index = 0;
+	unsigned short  OTP[10] = {0};
+	struct msm_camera_i2c_client *s5k4e5yx_msm_camera_i2c_client = s_ctrl->sensor_i2c_client;
+
+	lens_info = 6;	
+
+	pr_info("%s\n", __func__);
+	pr_info("%s: sensor OTP information:\n", __func__);
+
+	
+	rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x3A1C, 0x00);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x3A1C fail\n", __func__);
+
+	
+	rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A00, 0x04);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A00 (Start) fail\n", __func__);
+
+	mdelay(4);
+
+	
+	info_index = 1;
+	info_value = 0;
+	memset(OTP, 0, sizeof(OTP));
+
+	for (page = 20; page >= 16; page--) {
+		rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A02, page);
+		if (rc < 0)
+			pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, page);
+
+		
+		rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A00, 0x01);
+		if (rc < 0)
+			pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__);
+
+		
+		rc = msm_camera_i2c_read_b(s5k4e5yx_msm_camera_i2c_client, (0x0A04 + info_index), &info_value);
+		if (rc < 0)
+			pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04 + info_index));
+
+		 
+		if (((info_value&0x0F) != 0) || page == 0)
+			break;
+	}
+	OTP[info_index] = (short)(info_value&0x0F);
+
+	if (OTP[1] != 0) {
+		pr_info("Get Fuseid from Page20 to Page16\n");
+		goto get_done;
+	}
+
+	
+	info_index = 1;
+	info_value = 0;
+	memset(OTP, 0, sizeof(OTP));
+
+	for (page = 4; page >= 0; page--) {
+		rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A02, page);
+		if (rc < 0)
+			pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, page);
+
+		
+		rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A00, 0x01);
+		if (rc < 0)
+			pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__);
+
+		
+		rc = msm_camera_i2c_read_b(s5k4e5yx_msm_camera_i2c_client, (0x0A04 + info_index), &info_value);
+		if (rc < 0)
+			pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04 + info_index));
+
+		 
+		if (((info_value & 0x0F) != 0) || page == 0)
+			break;
+	}
+	OTP[info_index] = (short)(info_value&0x0F);
+
+get_done:
+	
+	rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A00, 0x00);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A00 (Stop) fail\n", __func__);
+
+	pr_info("%s: LensID=%x\n", __func__, OTP[1]);
+
+	if (OTP[1] == 5)	
+		lens_info = OTP[1];
+
+	return;
+}
+
+static int s5k3h2yx_sensor_open_init(const struct msm_camera_sensor_info *data)
+{
+	int rc = 0;
+	uint16_t value = 0;
+
+	if (data->sensor_platform_info)
+		s5k3h2yx_s_ctrl.mirror_flip = data->sensor_platform_info->mirror_flip;
+
+	
+	if (s5k3h2yx_s_ctrl.mirror_flip == CAMERA_SENSOR_MIRROR_FLIP)
+		value = S5K3H2YX_READ_MIRROR_FLIP;
+	else if (s5k3h2yx_s_ctrl.mirror_flip == CAMERA_SENSOR_MIRROR)
+		value = S5K3H2YX_READ_MIRROR;
+	else if (s5k3h2yx_s_ctrl.mirror_flip == CAMERA_SENSOR_FLIP)
+		value = S5K3H2YX_READ_FLIP;
+	else
+		value = S5K3H2YX_READ_NORMAL_MODE;
+	msm_camera_i2c_write(s5k3h2yx_s_ctrl.sensor_i2c_client,
+		S5K3H2YX_REG_READ_MODE, value, MSM_CAMERA_I2C_BYTE_DATA);
+
+	s5k3h2yx_read_lens_info(&s5k3h2yx_s_ctrl);
+	s5k3h2yx_read_vcm_clib(&s5k3h2yx_s_ctrl);
+
+	return rc;
+}
+
+static const char *s5k3h2yxVendor = "samsung";
+static const char *s5k3h2yxNAME = "s5k3h2yx";
+static const char *s5k3h2yxSize = "8M";
+
+static ssize_t sensor_vendor_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+
+	sprintf(buf, "%s %s %s\n", s5k3h2yxVendor, s5k3h2yxNAME, s5k3h2yxSize);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+
+static ssize_t lens_info_show(struct device *dev,
+  struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+
+	sprintf(buf, "%d\n", lens_info);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+
+static ssize_t vcm_clib_show(struct device *dev,
+  struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+
+	sprintf(buf, "%d\n", vcm_clib);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+
+static ssize_t vcm_clib_min_show(struct device *dev,
+  struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+
+	sprintf(buf, "%d\n", vcm_clib_min);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+
+static ssize_t vcm_clib_med_show(struct device *dev,
+  struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+
+	sprintf(buf, "%d\n", vcm_clib_med);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+
+static ssize_t vcm_clib_max_show(struct device *dev,
+  struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+
+	sprintf(buf, "%d\n", vcm_clib_max);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+static DEVICE_ATTR(sensor, 0444, sensor_vendor_show, NULL);
+static DEVICE_ATTR(lensinfo, 0444, lens_info_show, NULL);
+static DEVICE_ATTR(vcmclib, 0444, vcm_clib_show, NULL);
+static DEVICE_ATTR(vcmclibmin, 0444, vcm_clib_min_show, NULL);
+static DEVICE_ATTR(vcmclibmed, 0444, vcm_clib_med_show, NULL);
+static DEVICE_ATTR(vcmclibmax, 0444, vcm_clib_max_show, NULL);
+
+static struct kobject *android_s5k3h2yx;
+
+static int s5k3h2yx_sysfs_init(void)
+{
+	int ret ;
+	pr_info("s5k3h2yx:kobject creat and add\n");
+	android_s5k3h2yx = kobject_create_and_add("android_camera", NULL);
+	if (android_s5k3h2yx == NULL) {
+		pr_info("s5k3h2yx_sysfs_init: subsystem_register " \
+		"failed\n");
+		ret = -ENOMEM;
+		return ret ;
+	}
+	pr_info("s5k3h2yx:sysfs_create_file\n");
+	ret = sysfs_create_file(android_s5k3h2yx, &dev_attr_sensor.attr);
+	if (ret) {
+		pr_info("s5k3h2yx_sysfs_init: sysfs_create_file " \
+		"failed\n");
+		kobject_del(android_s5k3h2yx);
+	}
+	pr_info("s5k3h2yx:sysfs_create_file lensinfo\n");
+	ret = sysfs_create_file(android_s5k3h2yx, &dev_attr_lensinfo.attr);
+	if (ret) {
+		pr_info("s5k3h2yx_sysfs_init: dev_attr_lensinfo failed\n");
+		kobject_del(android_s5k3h2yx);
+	}
+	pr_info("s5k3h2yx:sysfs_create_file vcmclib\n");
+	ret = sysfs_create_file(android_s5k3h2yx, &dev_attr_vcmclib.attr);
+	if (ret) {
+		pr_info("s5k3h2yx_sysfs_init: dev_attr_vcmclib failed\n");
+		kobject_del(android_s5k3h2yx);
+	}
+	pr_info("s5k3h2yx:sysfs_create_file vcmclibmin\n");
+	ret = sysfs_create_file(android_s5k3h2yx, &dev_attr_vcmclibmin.attr);
+	if (ret) {
+		pr_info("s5k3h2yx_sysfs_init: dev_attr_vcmclibmin failed\n");
+		kobject_del(android_s5k3h2yx);
+	}
+	pr_info("s5k3h2yx:sysfs_create_file vcmclibmed\n");
+	ret = sysfs_create_file(android_s5k3h2yx, &dev_attr_vcmclibmed.attr);
+	if (ret) {
+		pr_info("s5k3h2yx_sysfs_init: dev_attr_vcmclibmed failed\n");
+		kobject_del(android_s5k3h2yx);
+	}
+	pr_info("s5k3h2yx:sysfs_create_file vcmclibmax\n");
+	ret = sysfs_create_file(android_s5k3h2yx, &dev_attr_vcmclibmax.attr);
+	if (ret) {
+		pr_info("s5k3h2yx_sysfs_init: dev_attr_vcmclibmax failed\n");
+		kobject_del(android_s5k3h2yx);
+	}
+
+	return 0 ;
+}
+
+static struct msm_camera_i2c_client s5k3h2yx_sensor_i2c_client = {
+	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
+};
+
+int32_t s5k3h2yx_power_up(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int rc;
+	struct msm_camera_sensor_info *sdata = NULL;
+
+	pr_info("%s\n", __func__);
+	if (s_ctrl && s_ctrl->sensordata)
+		sdata = s_ctrl->sensordata;
+	else {
+		pr_err("%s: s_ctrl sensordata NULL\n", __func__);
+		return (-1);
+	}
+
+	if (sdata->camera_power_on == NULL) {
+		pr_err("sensor platform_data didnt register\n");
+		return -EIO;
+	}
+
+	if (!sdata->use_rawchip) {
+		rc = msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
+		if (rc < 0) {
+			pr_err("%s: msm_camio_sensor_clk_on failed:%d\n",
+			 __func__, rc);
+			goto enable_mclk_failed;
+		}
+	}
+
+	rc = sdata->camera_power_on();
+	if (rc < 0) {
+		pr_err("%s failed to enable power\n", __func__);
+		goto enable_power_on_failed;
+	}
+
+	rc = msm_sensor_set_power_up(s_ctrl);
+	if (rc < 0) {
+		pr_err("%s msm_sensor_power_up failed\n", __func__);
+		goto enable_sensor_power_up_failed;
+	}
+
+	s5k3h2yx_sensor_open_init(sdata);
+	pr_info("%s end\n", __func__);
+
+	return rc;
+
+enable_sensor_power_up_failed:
+	if (sdata->camera_power_off == NULL)
+		pr_err("sensor platform_data didnt register\n");
+	else
+		sdata->camera_power_off();
+enable_power_on_failed:
+	msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
+enable_mclk_failed:
+	return rc;
+}
+
+int32_t s5k3h2yx_power_down(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int rc;
+	struct msm_camera_sensor_info *sdata = NULL;
+	pr_info("%s\n", __func__);
+
+	if (s_ctrl && s_ctrl->sensordata)
+		sdata = s_ctrl->sensordata;
+	else {
+		pr_err("%s: s_ctrl sensordata NULL\n", __func__);
+		return (-1);
+	}
+
+	if (sdata->camera_power_off == NULL) {
+		pr_err("sensor platform_data didnt register\n");
+		return -EIO;
+	}
+
+	rc = sdata->camera_power_off();
+	if (rc < 0)
+		pr_err("%s failed to disable power\n", __func__);
+
+	rc = msm_sensor_set_power_down(s_ctrl);
+	if (rc < 0)
+		pr_err("%s msm_sensor_power_down failed\n", __func__);
+
+	if (!sdata->use_rawchip) {
+		msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
+		if (rc < 0)
+			pr_err("%s: msm_camio_sensor_clk_off failed:%d\n",
+				 __func__, rc);
+	}
+
+	return rc;
+}
+
+int32_t s5k3h2yx_i2c_probe(struct i2c_client *client,
+	const struct i2c_device_id *id)
+{
+	int	rc = 0;
+	pr_info("%s\n", __func__);
+	rc = msm_sensor_i2c_probe(client, id);
+	if(rc >= 0)
+		s5k3h2yx_sysfs_init();
+	pr_info("%s: rc(%d)\n", __func__, rc);
+	return rc;
+}
+
+static const struct i2c_device_id s5k3h2yx_i2c_id[] = {
+	{SENSOR_NAME, (kernel_ulong_t)&s5k3h2yx_s_ctrl},
+	{ }
+};
+
+static struct i2c_driver s5k3h2yx_i2c_driver = {
+	.id_table = s5k3h2yx_i2c_id,
+	.probe  = s5k3h2yx_i2c_probe,
+	.driver = {
+		.name = SENSOR_NAME,
+	},
+};
+
+static int __init msm_sensor_init_module(void)
+{
+	pr_info("%s\n", __func__);
+	return i2c_add_driver(&s5k3h2yx_i2c_driver);
+}
+
+static struct v4l2_subdev_core_ops s5k3h2yx_subdev_core_ops = {
+	.ioctl = msm_sensor_subdev_ioctl,
+	.s_power = msm_sensor_power,
+};
+
+static struct v4l2_subdev_video_ops s5k3h2yx_subdev_video_ops = {
+	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
+};
+
+static struct v4l2_subdev_ops s5k3h2yx_subdev_ops = {
+	.core = &s5k3h2yx_subdev_core_ops,
+	.video  = &s5k3h2yx_subdev_video_ops,
+};
+
+static int s5k3h2yx_read_fuseid(struct sensor_cfg_data *cdata,
+	struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int32_t  rc;
+	int page = 0;
+	unsigned short info_value = 0, info_index = 0;
+	unsigned short  OTP[10] = {0};
+
+	struct msm_camera_i2c_client *s5k4e5yx_msm_camera_i2c_client = s_ctrl->sensor_i2c_client;
+
+	pr_info("%s: sensor OTP information:\n", __func__);
+
+	
+	rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x3A1C, 0x00);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x3A1C fail\n", __func__);
+
+	
+	rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A00, 0x04);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A00 (Start) fail\n", __func__);
+
+	mdelay(4);
+
+	
+	for (info_index = 0; info_index < 10; info_index++) {
+		for (page = 20; page >= 16; page--) {
+			rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A02, page);
+			if (rc < 0)
+				pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, page);
+
+			
+			rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A00, 0x01);
+			if (rc < 0)
+				pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__);
+
+			
+			rc = msm_camera_i2c_read_b(s5k4e5yx_msm_camera_i2c_client, (0x0A04 + info_index), &info_value);
+			if (rc < 0)
+				pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04 + info_index));
+
+			 
+			if (((info_value&0x0F) != 0) || page == 0)
+				break;
+		}
+		OTP[info_index] = (short)(info_value&0x0F);
+		info_value = 0;
+	}
+
+	if (OTP[0] != 0 && OTP[1] != 0) {
+		pr_info("Get Fuseid from Page20 to Page16\n");
+		goto get_done;
+	}
+
+	
+	memset(OTP, 0, sizeof(OTP));
+	for (info_index = 0; info_index < 10; info_index++) {
+		for (page = 4; page >= 0; page--) {
+			rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A02, page);
+			if (rc < 0)
+				pr_err("%s: i2c_write_b 0x0A02 (select page %d) fail\n", __func__, page);
+
+			
+			rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A00, 0x01);
+			if (rc < 0)
+				pr_err("%s: i2c_write_b 0x0A00: Set read mode fail\n", __func__);
+
+			
+			rc = msm_camera_i2c_read_b(s5k4e5yx_msm_camera_i2c_client, (0x0A04 + info_index), &info_value);
+			if (rc < 0)
+				pr_err("%s: i2c_read_b 0x%x fail\n", __func__, (0x0A04 + info_index));
+
+			 
+			if (((info_value & 0x0F) != 0) || page == 0)
+				break;
+		}
+		OTP[info_index] = (short)(info_value&0x0F);
+		info_value = 0;
+	}
+
+get_done:
+	
+	rc = msm_camera_i2c_write_b(s5k4e5yx_msm_camera_i2c_client, 0x0A00, 0x00);
+	if (rc < 0)
+		pr_err("%s: i2c_write_b 0x0A00 (Stop) fail\n", __func__);
+
+	pr_info("%s: VenderID=%x,LensID=%x,SensorID=%x%x\n", __func__,
+		OTP[0], OTP[1], OTP[2], OTP[3]);
+	pr_info("%s: ModuleFuseID= %x%x%x%x%x%x\n", __func__,
+		OTP[4], OTP[5], OTP[6], OTP[7], OTP[8], OTP[9]);
+
+    cdata->cfg.fuse.fuse_id_word1 = 0;
+    cdata->cfg.fuse.fuse_id_word2 = 0;
+	cdata->cfg.fuse.fuse_id_word3 = (OTP[0]);
+	cdata->cfg.fuse.fuse_id_word4 =
+		(OTP[4]<<20) |
+		(OTP[5]<<16) |
+		(OTP[6]<<12) |
+		(OTP[7]<<8) |
+		(OTP[8]<<4) |
+		(OTP[9]);
+
+	pr_info("s5k3h2yx: fuse->fuse_id_word1:%d\n",
+		cdata->cfg.fuse.fuse_id_word1);
+	pr_info("s5k3h2yx: fuse->fuse_id_word2:%d\n",
+		cdata->cfg.fuse.fuse_id_word2);
+	pr_info("s5k3h2yx: fuse->fuse_id_word3:0x%08x\n",
+		cdata->cfg.fuse.fuse_id_word3);
+	pr_info("s5k3h2yx: fuse->fuse_id_word4:0x%08x\n",
+		cdata->cfg.fuse.fuse_id_word4);
+	return 0;
+
+}
+static struct msm_sensor_fn_t s5k3h2yx_func_tbl = {
+	.sensor_start_stream = msm_sensor_start_stream,
+	.sensor_stop_stream = msm_sensor_stop_stream,
+	.sensor_group_hold_on = msm_sensor_group_hold_on,
+	.sensor_group_hold_off = msm_sensor_group_hold_off,
+	.sensor_set_fps = msm_sensor_set_fps,
+	.sensor_write_exp_gain_ex = msm_sensor_write_exp_gain1_ex,
+	.sensor_write_snapshot_exp_gain_ex = msm_sensor_write_exp_gain1_ex,
+	.sensor_setting = msm_sensor_setting,
+	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
+	.sensor_mode_init = msm_sensor_mode_init,
+	.sensor_get_output_info = msm_sensor_get_output_info,
+	.sensor_config = msm_sensor_config,
+	.sensor_power_up = s5k3h2yx_power_up,
+	.sensor_power_down = s5k3h2yx_power_down,
+	.sensor_i2c_read_fuseid = s5k3h2yx_read_fuseid,
+};
+
+static struct msm_sensor_reg_t s5k3h2yx_regs = {
+	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
+	.start_stream_conf = s5k3h2yx_start_settings,
+	.start_stream_conf_size = ARRAY_SIZE(s5k3h2yx_start_settings),
+	.stop_stream_conf = s5k3h2yx_stop_settings,
+	.stop_stream_conf_size = ARRAY_SIZE(s5k3h2yx_stop_settings),
+	.group_hold_on_conf = s5k3h2yx_groupon_settings,
+	.group_hold_on_conf_size = ARRAY_SIZE(s5k3h2yx_groupon_settings),
+	.group_hold_off_conf = s5k3h2yx_groupoff_settings,
+	.group_hold_off_conf_size =
+		ARRAY_SIZE(s5k3h2yx_groupoff_settings),
+	.init_settings = &s5k3h2yx_init_conf[0],
+	.init_size = ARRAY_SIZE(s5k3h2yx_init_conf),
+	.mode_settings = &s5k3h2yx_confs[0],
+	.output_settings = &s5k3h2yx_dimensions[0],
+	.num_conf = ARRAY_SIZE(s5k3h2yx_confs),
+};
+
+static struct msm_sensor_ctrl_t s5k3h2yx_s_ctrl = {
+	.msm_sensor_reg = &s5k3h2yx_regs,
+	.sensor_i2c_client = &s5k3h2yx_sensor_i2c_client,
+	.sensor_i2c_addr = 0x20,
+	.sensor_output_reg_addr = &s5k3h2yx_reg_addr,
+	.sensor_id_info = &s5k3h2yx_id_info,
+	.sensor_exp_gain_info = &s5k3h2yx_exp_gain_info,
+	.cam_mode = MSM_SENSOR_MODE_INVALID,
+	.csi_params = &s5k3h2yx_csi_params_array[0],
+	.msm_sensor_mutex = &s5k3h2yx_mut,
+	.sensor_i2c_driver = &s5k3h2yx_i2c_driver,
+	.sensor_v4l2_subdev_info = s5k3h2yx_subdev_info,
+	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(s5k3h2yx_subdev_info),
+	.sensor_v4l2_subdev_ops = &s5k3h2yx_subdev_ops,
+	.func_tbl = &s5k3h2yx_func_tbl,
+	.sensor_first_mutex = &s5k3h2yx_sensor_init_mut, 
+};
+
+module_init(msm_sensor_init_module);
+MODULE_DESCRIPTION("Samsung 8 MP Bayer sensor driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/s5k3l1yx.c b/drivers/media/video/msm/sensors/s5k3l1yx.c
deleted file mode 100644
index 9ee22f1..0000000
--- a/drivers/media/video/msm/sensors/s5k3l1yx.c
+++ /dev/null
@@ -1,698 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#define SENSOR_NAME "s5k3l1yx"
-#define PLATFORM_DRIVER_NAME "msm_camera_s5k3l1yx"
-
-DEFINE_MUTEX(s5k3l1yx_mut);
-static struct msm_sensor_ctrl_t s5k3l1yx_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf s5k3l1yx_start_settings[] = {
-	{0x0100, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf s5k3l1yx_stop_settings[] = {
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf s5k3l1yx_groupon_settings[] = {
-	{0x104, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf s5k3l1yx_groupoff_settings[] = {
-	{0x104, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf s5k3l1yx_snap_settings[] = {
-	{0x0501, 0x00}, /* compression_algorithim_L(1d) */
-	{0x0112, 0x0A}, /* CCP_data_format_H */
-	{0x0113, 0x0A}, /* CCP_data_format_L raw8=0808 ,DCPM10 -->8= 0A08 */
-	{0x0306, 0x00}, /* pll_multiplier */
-	{0x0307, 0xA5}, /* pll_multiplier */
-	{0x0202, 0x09}, /* coarse_integration_time */
-	{0x0203, 0x32}, /* coarse_integration_time */
-	{0x0340, 0x0B}, /* frame_length_lines */
-	{0x0341, 0xEC}, /* frame_length_lines */
-	{0x0342, 0x14}, /* line_length_pck */
-	{0x0343, 0xD8}, /* line_length_pck */
-	{0x0344, 0x00}, /* x_addr_start */
-	{0x0345, 0x08}, /* x_addr_start */
-	{0x0346, 0x00}, /* y_addr_start */
-	{0x0347, 0x00}, /* y_addr_start */
-	{0x0348, 0x0F}, /* x_addr_end */
-	{0x0349, 0xA7}, /* x_addr_end */
-	{0x034A, 0x0B}, /* y_addr_end */
-	{0x034B, 0xC7}, /* y_addr_end */
-	{0x034C, 0x0F}, /* x_output_size */
-	{0x034D, 0xA0}, /* x_output_size */
-	{0x034E, 0x0B}, /* y_output_size */
-	{0x034F, 0xC8}, /* y_output_size */
-	{0x0380, 0x00}, /* x_even_inc */
-	{0x0381, 0x01}, /* x_even_inc */
-	{0x0382, 0x00}, /* x_odd_inc */
-	{0x0383, 0x01}, /* x_odd_inc */
-	{0x0384, 0x00}, /* y_even_inc */
-	{0x0385, 0x01}, /* y_even_inc */
-	{0x0386, 0x00}, /* y_odd_inc */
-	{0x0387, 0x01}, /* y_odd_inc */
-	{0x0900, 0x00}, /* binning_mode */
-	{0x0901, 0x22}, /* binning_type */
-	{0x0902, 0x01}, /* binning_weighting */
-};
-
-static struct msm_camera_i2c_reg_conf s5k3l1yx_prev_settings[] = {
-	{0x0501, 0x00}, /* compression_algorithim_L(1d) */
-	{0x0112, 0x0A}, /* CCP_data_format_H */
-	{0x0113, 0x0A}, /* CCP_data_format_L raw8=0808 ,DCPM10 -->8= 0A08 */
-	{0x0306, 0x00}, /* pll_multiplier */
-	{0x0307, 0xA5}, /* pll_multiplier */
-	{0x0202, 0x06}, /* coarse_integration_time */
-	{0x0203, 0x00}, /* coarse_integration_time */
-	{0x0340, 0x09}, /* frame_length_lines */
-	{0x0341, 0x6C}, /* frame_length_lines */
-	{0x0342, 0x11}, /* line_length_pck */
-	{0x0343, 0x80}, /* line_length_pck */
-	{0x0344, 0x00}, /* x_addr_start */
-	{0x0345, 0x18}, /* x_addr_start */
-	{0x0346, 0x00}, /* y_addr_start */
-	{0x0347, 0x00}, /* y_addr_start */
-	{0x0348, 0x0F}, /* x_addr_end */
-	{0x0349, 0x97}, /* x_addr_end */
-	{0x034A, 0x0B}, /* y_addr_end */
-	{0x034B, 0xC7}, /* y_addr_end */
-	{0x034C, 0x07}, /* x_output_size */
-	{0x034D, 0xC0}, /* x_output_size */
-	{0x034E, 0x05}, /* y_output_size */
-	{0x034F, 0xE4}, /* y_output_size */
-	{0x0380, 0x00}, /* x_even_inc */
-	{0x0381, 0x01}, /* x_even_inc */
-	{0x0382, 0x00}, /* x_odd_inc */
-	{0x0383, 0x03}, /* x_odd_inc */
-	{0x0384, 0x00}, /* y_even_inc */
-	{0x0385, 0x01}, /* y_even_inc */
-	{0x0386, 0x00}, /* y_odd_inc */
-	{0x0387, 0x03}, /* y_odd_inc */
-	{0x0900, 0x01}, /* binning_mode */
-	{0x0901, 0x22}, /* binning_type */
-	{0x0902, 0x01}, /* binning_weighting */
-};
-
-static struct msm_camera_i2c_reg_conf s5k3l1yx_video_60fps_settings[] = {
-	{0x0501, 0x00}, /* compression_algorithim_L(1d) */
-	{0x0112, 0x0A}, /* CCP_data_format_H */
-	{0x0113, 0x0A}, /* CCP_data_format_L raw8=0808 ,DCPM10 -->8= 0A08 */
-	{0x0306, 0x00}, /* pll_multiplier */
-	{0x0307, 0xA5}, /* pll_multiplier */
-	{0x0202, 0x03}, /* coarse_integration_time */
-	{0x0203, 0xD8}, /* coarse_integration_time */
-	{0x0340, 0x03}, /* frame_length_lines */
-	{0x0341, 0xE0}, /* frame_length_lines */
-	{0x0342, 0x14}, /* line_length_pck */
-	{0x0343, 0xD8}, /* line_length_pck */
-	{0x0344, 0x01}, /* x_addr_start */
-	{0x0345, 0x20}, /* x_addr_start */
-	{0x0346, 0x02}, /* y_addr_start */
-	{0x0347, 0x24}, /* y_addr_start */
-	{0x0348, 0x0E}, /* x_addr_end */
-	{0x0349, 0xA0}, /* x_addr_end */
-	{0x034A, 0x09}, /* y_addr_end */
-	{0x034B, 0xA4}, /* y_addr_end */
-	{0x034C, 0x03}, /* x_output_size */
-	{0x034D, 0x60}, /* x_output_size */
-	{0x034E, 0x01}, /* y_output_size */
-	{0x034F, 0xE0}, /* y_output_size */
-	{0x0380, 0x00}, /* x_even_inc */
-	{0x0381, 0x01}, /* x_even_inc */
-	{0x0382, 0x00}, /* x_odd_inc */
-	{0x0383, 0x07}, /* x_odd_inc */
-	{0x0384, 0x00}, /* y_even_inc */
-	{0x0385, 0x01}, /* y_even_inc */
-	{0x0386, 0x00}, /* y_odd_inc */
-	{0x0387, 0x07}, /* y_odd_inc */
-	{0x0900, 0x01}, /* binning_mode */
-	{0x0901, 0x44}, /* binning_type */
-	{0x0902, 0x01}, /* binning_weighting */
-};
-
-static struct msm_camera_i2c_reg_conf s5k3l1yx_video_90fps_settings[] = {
-	{0x0501, 0x00}, /* compression_algorithim_L(1d) */
-	{0x0112, 0x0A}, /* CCP_data_format_H */
-	{0x0113, 0x0A}, /* CCP_data_format_L raw8=0808 ,DCPM10 -->8= 0A08 */
-	{0x0306, 0x00}, /* pll_multiplier */
-	{0x0307, 0xA5}, /* pll_multiplier */
-	{0x0202, 0x02}, /* coarse_integration_time */
-	{0x0203, 0x90}, /* coarse_integration_time */
-	{0x0340, 0x02}, /* frame_length_lines */
-	{0x0341, 0x98}, /* frame_length_lines */
-	{0x0342, 0x14}, /* line_length_pck */
-	{0x0343, 0xD8}, /* line_length_pck */
-	{0x0344, 0x01}, /* x_addr_start */
-	{0x0345, 0x20}, /* x_addr_start */
-	{0x0346, 0x02}, /* y_addr_start */
-	{0x0347, 0x24}, /* y_addr_start */
-	{0x0348, 0x0E}, /* x_addr_end */
-	{0x0349, 0xA0}, /* x_addr_end */
-	{0x034A, 0x09}, /* y_addr_end */
-	{0x034B, 0xA4}, /* y_addr_end */
-	{0x034C, 0x03}, /* x_output_size */
-	{0x034D, 0x60}, /* x_output_size */
-	{0x034E, 0x01}, /* y_output_size */
-	{0x034F, 0xE0}, /* y_output_size */
-	{0x0380, 0x00}, /* x_even_inc */
-	{0x0381, 0x01}, /* x_even_inc */
-	{0x0382, 0x00}, /* x_odd_inc */
-	{0x0383, 0x07}, /* x_odd_inc */
-	{0x0384, 0x00}, /* y_even_inc */
-	{0x0385, 0x01}, /* y_even_inc */
-	{0x0386, 0x00}, /* y_odd_inc */
-	{0x0387, 0x07}, /* y_odd_inc */
-	{0x0900, 0x01}, /* binning_mode */
-	{0x0901, 0x44}, /* binning_type */
-	{0x0902, 0x01}, /* binning_weighting */
-};
-
-static struct msm_camera_i2c_reg_conf s5k3l1yx_video_120fps_settings[] = {
-	{0x0501, 0x00}, /* compression_algorithim_L(1d) */
-	{0x0112, 0x0A}, /* CCP_data_format_H */
-	{0x0113, 0x0A}, /* CCP_data_format_L raw8=0808 ,DCPM10 -->8= 0A08 */
-	{0x0306, 0x00}, /* pll_multiplier */
-	{0x0307, 0xA5}, /* pll_multiplier */
-	{0x0202, 0x01}, /* coarse_integration_time */
-	{0x0203, 0xFA}, /* coarse_integration_time */
-	{0x0340, 0x02}, /* frame_length_lines */
-	{0x0341, 0x02}, /* frame_length_lines */
-	{0x0342, 0x14}, /* line_length_pck */
-	{0x0343, 0xD8}, /* line_length_pck */
-	{0x0344, 0x01}, /* x_addr_start */
-	{0x0345, 0x20}, /* x_addr_start */
-	{0x0346, 0x02}, /* y_addr_start */
-	{0x0347, 0x24}, /* y_addr_start */
-	{0x0348, 0x0E}, /* x_addr_end */
-	{0x0349, 0xA0}, /* x_addr_end */
-	{0x034A, 0x09}, /* y_addr_end */
-	{0x034B, 0xA4}, /* y_addr_end */
-	{0x034C, 0x03}, /* x_output_size */
-	{0x034D, 0x60}, /* x_output_size */
-	{0x034E, 0x01}, /* y_output_size */
-	{0x034F, 0xE0}, /* y_output_size */
-	{0x0380, 0x00}, /* x_even_inc */
-	{0x0381, 0x01}, /* x_even_inc */
-	{0x0382, 0x00}, /* x_odd_inc */
-	{0x0383, 0x07}, /* x_odd_inc */
-	{0x0384, 0x00}, /* y_even_inc */
-	{0x0385, 0x01}, /* y_even_inc */
-	{0x0386, 0x00}, /* y_odd_inc */
-	{0x0387, 0x07}, /* y_odd_inc */
-	{0x0900, 0x01}, /* binning_mode */
-	{0x0901, 0x44}, /* binning_type */
-	{0x0902, 0x01}, /* binning_weighting */
-};
-
-static struct msm_camera_i2c_reg_conf s5k3l1yx_dpcm_settings[] = {
-	{0x0501, 0x01}, /* compression_algorithim_L(1d) */
-	{0x0112, 0x0A}, /* CCP_data_format_H */
-	{0x0113, 0x08}, /* CCP_data_format_L raw8=0808 ,DCPM10 -->8= 0A08 */
-	{0x0306, 0x00}, /* pll_multiplier */
-	{0x0307, 0xA0}, /* pll_multiplier */
-	{0x0202, 0x09}, /* coarse_integration_time */
-	{0x0203, 0x32}, /* coarse_integration_time */
-	{0x0340, 0x0B}, /* frame_length_lines */
-	{0x0341, 0xEC}, /* frame_length_lines */
-	{0x0342, 0x11}, /* line_length_pck */
-	{0x0343, 0x80}, /* line_length_pck */
-	{0x0344, 0x00}, /* x_addr_start */
-	{0x0345, 0x08}, /* x_addr_start */
-	{0x0346, 0x00}, /* y_addr_start */
-	{0x0347, 0x00}, /* y_addr_start */
-	{0x0348, 0x0F}, /* x_addr_end */
-	{0x0349, 0xA7}, /* x_addr_end */
-	{0x034A, 0x0B}, /* y_addr_end */
-	{0x034B, 0xC7}, /* y_addr_end */
-	{0x034C, 0x0F}, /* x_output_size */
-	{0x034D, 0xA0}, /* x_output_size */
-	{0x034E, 0x0B}, /* y_output_size */
-	{0x034F, 0xC8}, /* y_output_size */
-	{0x0380, 0x00}, /* x_even_inc */
-	{0x0381, 0x01}, /* x_even_inc */
-	{0x0382, 0x00}, /* x_odd_inc */
-	{0x0383, 0x01}, /* x_odd_inc */
-	{0x0384, 0x00}, /* y_even_inc */
-	{0x0385, 0x01}, /* y_even_inc */
-	{0x0386, 0x00}, /* y_odd_inc */
-	{0x0387, 0x01}, /* y_odd_inc */
-	{0x0900, 0x00}, /* binning_mode */
-	{0x0901, 0x22}, /* binning_type */
-	{0x0902, 0x01}, /* binning_weighting */
-};
-
-static struct msm_camera_i2c_reg_conf s5k3l1yx_recommend_settings[] = {
-	{0x0100, 0x00},
-	{0x0103, 0x01}, /* software_reset */
-	{0x0104, 0x00}, /* grouped_parameter_hold */
-	{0x0114, 0x03}, /* CSI_lane_mode, 4 lane setting */
-	{0x0120, 0x00}, /* gain_mode, global analogue gain*/
-	{0x0121, 0x00}, /* exposure_mode, global exposure */
-	{0x0136, 0x18}, /* Extclk_frequency_mhz */
-	{0x0137, 0x00}, /* Extclk_frequency_mhz */
-	{0x0200, 0x08}, /* fine_integration_time */
-	{0x0201, 0x88}, /* fine_integration_time */
-	{0x0204, 0x00}, /* analogue_gain_code_global */
-	{0x0205, 0x20}, /* analogue_gain_code_global */
-	{0x020E, 0x01}, /* digital_gain_greenR */
-	{0x020F, 0x00}, /* digital_gain_greenR */
-	{0x0210, 0x01}, /* digital_gain_red */
-	{0x0211, 0x00}, /* digital_gain_red */
-	{0x0212, 0x01}, /* digital_gain_blue */
-	{0x0213, 0x00}, /* digital_gain_blue */
-	{0x0214, 0x01}, /* digital_gain_greenB */
-	{0x0215, 0x00}, /* digital_gain_greenB */
-	{0x0300, 0x00}, /* vt_pix_clk_div */
-	{0x0301, 0x02}, /* vt_pix_clk_div */
-	{0x0302, 0x00}, /* vt_sys_clk_div */
-	{0x0303, 0x01}, /* vt_sys_clk_div */
-	{0x0304, 0x00}, /* pre_pll_clk_div */
-	{0x0305, 0x06}, /* pre_pll_clk_div */
-	{0x0308, 0x00}, /* op_pix_clk_div */
-	{0x0309, 0x02}, /* op_pix_clk_div */
-	{0x030A, 0x00}, /* op_sys_clk_div */
-	{0x030B, 0x01}, /* op_sys_clk_div */
-	{0x0800, 0x00}, /* tclk_post for D-PHY control */
-	{0x0801, 0x00}, /* ths_prepare for D-PHY control */
-	{0x0802, 0x00}, /* ths_zero_min for D-PHY control */
-	{0x0803, 0x00}, /* ths_trail for D-PHY control */
-	{0x0804, 0x00}, /* tclk_trail_min for D-PHY control */
-	{0x0805, 0x00}, /* tclk_prepare for D-PHY control */
-	{0x0806, 0x00}, /* tclk_zero_zero for D-PHY control */
-	{0x0807, 0x00}, /* tlpx for D-PHY control */
-	{0x0820, 0x02}, /* requested_link_bit_rate_mbps */
-	{0x0821, 0x94}, /* requested_link_bit_rate_mbps */
-	{0x0822, 0x00}, /* requested_link_bit_rate_mbps */
-	{0x0823, 0x00}, /* requested_link_bit_rate_mbps */
-	{0x3000, 0x0A},
-	{0x3001, 0xF7},
-	{0x3002, 0x0A},
-	{0x3003, 0xF7},
-	{0x3004, 0x08},
-	{0x3005, 0xF8},
-	{0x3006, 0x5B},
-	{0x3007, 0x73},
-	{0x3008, 0x49},
-	{0x3009, 0x0C},
-	{0x300A, 0xF8},
-	{0x300B, 0x4E},
-	{0x300C, 0x64},
-	{0x300D, 0x5C},
-	{0x300E, 0x71},
-	{0x300F, 0x0C},
-	{0x3010, 0x6A},
-	{0x3011, 0x14},
-	{0x3012, 0x14},
-	{0x3013, 0x0C},
-	{0x3014, 0x24},
-	{0x3015, 0x4F},
-	{0x3016, 0x86},
-	{0x3017, 0x0E},
-	{0x3018, 0x2C},
-	{0x3019, 0x30},
-	{0x301A, 0x31},
-	{0x301B, 0x32},
-	{0x301C, 0xFF},
-	{0x301D, 0x33},
-	{0x301E, 0x5C},
-	{0x301F, 0xFA},
-	{0x3020, 0x36},
-	{0x3021, 0x46},
-	{0x3022, 0x92},
-	{0x3023, 0xF5},
-	{0x3024, 0x6E},
-	{0x3025, 0x19},
-	{0x3026, 0x32},
-	{0x3027, 0x4B},
-	{0x3028, 0x04},
-	{0x3029, 0x50},
-	{0x302A, 0x0C},
-	{0x302B, 0x04},
-	{0x302C, 0xEF},
-	{0x302D, 0xC1},
-	{0x302E, 0x74},
-	{0x302F, 0x40},
-	{0x3030, 0x00},
-	{0x3031, 0x00},
-	{0x3032, 0x00},
-	{0x3033, 0x00},
-	{0x3034, 0x0F},
-	{0x3035, 0x01},
-	{0x3036, 0x00},
-	{0x3037, 0x00},
-	{0x3038, 0x88},
-	{0x3039, 0x98},
-	{0x303A, 0x1F},
-	{0x303B, 0x01},
-	{0x303C, 0x00},
-	{0x303D, 0x03},
-	{0x303E, 0x2F},
-	{0x303F, 0x09},
-	{0x3040, 0xFF},
-	{0x3041, 0x22},
-	{0x3042, 0x03},
-	{0x3043, 0x03},
-	{0x3044, 0x20},
-	{0x3045, 0x10},
-	{0x3046, 0x10},
-	{0x3047, 0x08},
-	{0x3048, 0x10},
-	{0x3049, 0x01},
-	{0x304A, 0x00},
-	{0x304B, 0x80},
-	{0x304C, 0x80},
-	{0x304D, 0x00},
-	{0x304E, 0x00},
-	{0x304F, 0x00},
-	{0x3051, 0x09},
-	{0x3052, 0xC4},
-	{0x305A, 0xE0},
-	{0x323D, 0x04},
-	{0x323E, 0x38},
-	{0x3305, 0xDD},
-	{0x3050, 0x01},
-	{0x3202, 0x01},
-	{0x3203, 0x01},
-	{0x3204, 0x01},
-	{0x3205, 0x01},
-	{0x3206, 0x01},
-	{0x3207, 0x01},
-	{0x320A, 0x05},
-	{0x320B, 0x20},
-	{0x3235, 0xB7},
-	{0x324C, 0x04},
-	{0x324A, 0x07},
-	{0x3902, 0x01},
-	{0x3915, 0x70},
-	{0x3916, 0x80},
-	{0x3A00, 0x01},
-	{0x3A06, 0x03},
-	{0x3B29, 0x01},
-	{0x3C11, 0x08},
-	{0x3C12, 0x7B},
-	{0x3C13, 0xC0},
-	{0x3C14, 0x70},
-	{0x3C15, 0x80},
-	{0x3C20, 0x04},
-	{0x3C23, 0x03},
-	{0x3C24, 0x00},
-	{0x3C50, 0x72},
-	{0x3C51, 0x85},
-	{0x3C53, 0x40},
-	{0x3C55, 0xA0},
-	{0x3D00, 0x00},
-	{0x3D01, 0x00},
-	{0x3D11, 0x01},
-	{0x3486, 0x05},
-	{0x3B35, 0x06},
-	{0x3A05, 0x01},
-	{0x3A07, 0x2B},
-	{0x3A09, 0x01},
-	{0x3940, 0xFF},
-	{0x3300, 0x00},
-	{0x3900, 0xFF},
-	{0x3914, 0x08},
-	{0x3A01, 0x0F},
-	{0x3A02, 0xA0},
-	{0x3A03, 0x0B},
-	{0x3A04, 0xC8},
-	{0x3701, 0x00},
-	{0x3702, 0x00},
-	{0x3703, 0x00},
-	{0x3704, 0x00},
-	{0x0101, 0x00}, /* image_orientation, mirror & flip off*/
-	{0x0105, 0x01}, /* mask_corrupted_frames */
-	{0x0110, 0x00}, /* CSI-2_channel_identifier */
-	{0x3942, 0x01}, /* [0] 1:mipi, 0:pvi */
-	{0x0B00, 0x00},
-};
-
-static struct v4l2_subdev_info s5k3l1yx_subdev_info[] = {
-	{
-	.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array s5k3l1yx_init_conf[] = {
-	{&s5k3l1yx_recommend_settings[0],
-	ARRAY_SIZE(s5k3l1yx_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array s5k3l1yx_confs[] = {
-	{&s5k3l1yx_snap_settings[0],
-	ARRAY_SIZE(s5k3l1yx_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&s5k3l1yx_prev_settings[0],
-	ARRAY_SIZE(s5k3l1yx_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&s5k3l1yx_video_60fps_settings[0],
-	ARRAY_SIZE(s5k3l1yx_video_60fps_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&s5k3l1yx_video_90fps_settings[0],
-	ARRAY_SIZE(s5k3l1yx_video_90fps_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&s5k3l1yx_video_120fps_settings[0],
-	ARRAY_SIZE(s5k3l1yx_video_120fps_settings), 0,
-					MSM_CAMERA_I2C_BYTE_DATA},
-	{&s5k3l1yx_dpcm_settings[0],
-	ARRAY_SIZE(s5k3l1yx_dpcm_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t s5k3l1yx_dimensions[] = {
-	/* 20 fps snapshot */
-	{
-		.x_output = 4000,
-		.y_output = 3016,
-		.line_length_pclk = 5336,
-		.frame_length_lines = 3052,
-		.vt_pixel_clk = 330000000,
-		.op_pixel_clk = 264000000,
-		.binning_factor = 1,
-	},
-	/* 30 fps preview */
-	{
-		.x_output = 1984,
-		.y_output = 1508,
-		.line_length_pclk = 4480,
-		.frame_length_lines = 2412,
-		.vt_pixel_clk = 330000000,
-		.op_pixel_clk = 264000000,
-		.binning_factor = 1,
-	},
-	/* 60 fps video */
-	{
-		.x_output = 864,
-		.y_output = 480,
-		.line_length_pclk = 5336,
-		.frame_length_lines = 992,
-		.vt_pixel_clk = 330000000,
-		.op_pixel_clk = 264000000,
-		.binning_factor = 1,
-	},
-	/* 90 fps video */
-	{
-		.x_output = 864,
-		.y_output = 480,
-		.line_length_pclk = 5336,
-		.frame_length_lines = 664,
-		.vt_pixel_clk = 330000000,
-		.op_pixel_clk = 264000000,
-		.binning_factor = 1,
-	},
-	/* 120 fps video */
-	{
-		.x_output = 864,
-		.y_output = 480,
-		.line_length_pclk = 5336,
-		.frame_length_lines = 514,
-		.vt_pixel_clk = 330000000,
-		.op_pixel_clk = 264000000,
-		.binning_factor = 1,
-	},
-	/* 24 fps snapshot */
-	{
-		.x_output = 4000,
-		.y_output = 3016,
-		.line_length_pclk = 4480,
-		.frame_length_lines = 3052,
-		.vt_pixel_clk = 330000000,
-		.op_pixel_clk = 320000000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_sensor_output_reg_addr_t s5k3l1yx_reg_addr = {
-	.x_output = 0x34C,
-	.y_output = 0x34E,
-	.line_length_pclk = 0x342,
-	.frame_length_lines = 0x340,
-};
-
-static enum msm_camera_vreg_name_t s5k3l1yx_veg_seq[] = {
-	CAM_VDIG,
-	CAM_VANA,
-	CAM_VIO,
-	CAM_VAF,
-};
-
-static struct msm_sensor_id_info_t s5k3l1yx_id_info = {
-	.sensor_id_reg_addr = 0x0,
-	.sensor_id = 0x3121,
-};
-
-static struct msm_sensor_exp_gain_info_t s5k3l1yx_exp_gain_info = {
-	.coarse_int_time_addr = 0x202,
-	.global_gain_addr = 0x204,
-	.vert_offset = 8,
-};
-
-static const struct i2c_device_id s5k3l1yx_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&s5k3l1yx_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver s5k3l1yx_i2c_driver = {
-	.id_table = s5k3l1yx_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client s5k3l1yx_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static const struct of_device_id s5k3l1yx_dt_match[] = {
-	{.compatible = "qcom,s5k3l1yx", .data = &s5k3l1yx_s_ctrl},
-	{}
-};
-
-MODULE_DEVICE_TABLE(of, s5k3l1yx_dt_match);
-
-static struct platform_driver s5k3l1yx_platform_driver = {
-	.driver = {
-		.name = "qcom,s5k3l1yx",
-		.owner = THIS_MODULE,
-		.of_match_table = s5k3l1yx_dt_match,
-	},
-};
-
-static int32_t s5k3l1yx_platform_probe(struct platform_device *pdev)
-{
-	int32_t rc = 0;
-	const struct of_device_id *match;
-	match = of_match_device(s5k3l1yx_dt_match, &pdev->dev);
-	rc = msm_sensor_platform_probe(pdev, match->data);
-	return rc;
-}
-
-static int __init msm_sensor_init_module(void)
-{
-	int32_t rc = 0;
-	rc = platform_driver_probe(&s5k3l1yx_platform_driver,
-		s5k3l1yx_platform_probe);
-	if (!rc)
-		return rc;
-	return i2c_add_driver(&s5k3l1yx_i2c_driver);
-}
-
-static void __exit msm_sensor_exit_module(void)
-{
-	if (s5k3l1yx_s_ctrl.pdev) {
-		msm_sensor_free_sensor_data(&s5k3l1yx_s_ctrl);
-		platform_driver_unregister(&s5k3l1yx_platform_driver);
-	} else
-		i2c_del_driver(&s5k3l1yx_i2c_driver);
-	return;
-}
-
-static struct v4l2_subdev_core_ops s5k3l1yx_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops s5k3l1yx_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops s5k3l1yx_subdev_ops = {
-	.core = &s5k3l1yx_subdev_core_ops,
-	.video  = &s5k3l1yx_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t s5k3l1yx_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_write_snapshot_exp_gain = msm_sensor_write_exp_gain1,
-	.sensor_setting = msm_sensor_setting,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-	.sensor_adjust_frame_lines = msm_sensor_adjust_frame_lines1,
-	.sensor_get_csi_params = msm_sensor_get_csi_params,
-};
-
-static struct msm_sensor_reg_t s5k3l1yx_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = s5k3l1yx_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(s5k3l1yx_start_settings),
-	.stop_stream_conf = s5k3l1yx_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(s5k3l1yx_stop_settings),
-	.group_hold_on_conf = s5k3l1yx_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(s5k3l1yx_groupon_settings),
-	.group_hold_off_conf = s5k3l1yx_groupoff_settings,
-	.group_hold_off_conf_size =
-		ARRAY_SIZE(s5k3l1yx_groupoff_settings),
-	.init_settings = &s5k3l1yx_init_conf[0],
-	.init_size = ARRAY_SIZE(s5k3l1yx_init_conf),
-	.mode_settings = &s5k3l1yx_confs[0],
-	.output_settings = &s5k3l1yx_dimensions[0],
-	.num_conf = ARRAY_SIZE(s5k3l1yx_confs),
-};
-
-static struct msm_sensor_ctrl_t s5k3l1yx_s_ctrl = {
-	.msm_sensor_reg = &s5k3l1yx_regs,
-	.sensor_i2c_client = &s5k3l1yx_sensor_i2c_client,
-	.sensor_i2c_addr = 0x6E,
-	.vreg_seq = s5k3l1yx_veg_seq,
-	.num_vreg_seq = ARRAY_SIZE(s5k3l1yx_veg_seq),
-	.sensor_output_reg_addr = &s5k3l1yx_reg_addr,
-	.sensor_id_info = &s5k3l1yx_id_info,
-	.sensor_exp_gain_info = &s5k3l1yx_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &s5k3l1yx_mut,
-	.sensor_i2c_driver = &s5k3l1yx_i2c_driver,
-	.sensor_v4l2_subdev_info = s5k3l1yx_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(s5k3l1yx_subdev_info),
-	.sensor_v4l2_subdev_ops = &s5k3l1yx_subdev_ops,
-	.func_tbl = &s5k3l1yx_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(msm_sensor_init_module);
-module_exit(msm_sensor_exit_module);
-MODULE_DESCRIPTION("Samsung 12MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/s5k4e1_v4l2.c b/drivers/media/video/msm/sensors/s5k4e1_v4l2.c
deleted file mode 100644
index fdb1bdf..0000000
--- a/drivers/media/video/msm/sensors/s5k4e1_v4l2.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#define SENSOR_NAME "s5k4e1"
-#define PLATFORM_DRIVER_NAME "msm_camera_s5k4e1"
-#define s5k4e1_obj s5k4e1_##obj
-#define MSB                             1
-#define LSB                             0
-
-DEFINE_MUTEX(s5k4e1_mut);
-static struct msm_sensor_ctrl_t s5k4e1_s_ctrl;
-
-static struct msm_camera_i2c_reg_conf s5k4e1_start_settings[] = {
-	{0x0100, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf s5k4e1_stop_settings[] = {
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf s5k4e1_groupon_settings[] = {
-	{0x0104, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf s5k4e1_groupoff_settings[] = {
-	{0x0104, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf s5k4e1_prev_settings[] = {
-	/* output size (1304 x 980) */
-	{0x30A9, 0x02},/* Horizontal Binning On */
-	{0x300E, 0xEB},/* Vertical Binning On */
-	{0x0387, 0x03},/* y_odd_inc 03(10b AVG) */
-	{0x0344, 0x00},/* x_addr_start 0 */
-	{0x0345, 0x00},
-	{0x0348, 0x0A},/* x_addr_end 2607 */
-	{0x0349, 0x2F},
-	{0x0346, 0x00},/* y_addr_start 0 */
-	{0x0347, 0x00},
-	{0x034A, 0x07},/* y_addr_end 1959 */
-	{0x034B, 0xA7},
-	{0x0380, 0x00},/* x_even_inc 1 */
-	{0x0381, 0x01},
-	{0x0382, 0x00},/* x_odd_inc 1 */
-	{0x0383, 0x01},
-	{0x0384, 0x00},/* y_even_inc 1 */
-	{0x0385, 0x01},
-	{0x0386, 0x00},/* y_odd_inc 3 */
-	{0x0387, 0x03},
-	{0x034C, 0x05},/* x_output_size 1304 */
-	{0x034D, 0x18},
-	{0x034E, 0x03},/* y_output_size 980 */
-	{0x034F, 0xd4},
-	{0x30BF, 0xAB},/* outif_enable[7], data_type[5:0](2Bh = bayer 10bit} */
-	{0x30C0, 0xA0},/* video_offset[7:4] 3260%12 */
-	{0x30C8, 0x06},/* video_data_length 1600 = 1304 * 1.25 */
-	{0x30C9, 0x5E},
-	/* Timing Configuration */
-	{0x0202, 0x03},
-	{0x0203, 0x14},
-	{0x0204, 0x00},
-	{0x0205, 0x80},
-	{0x0340, 0x03},/* Frame Length */
-	{0x0341, 0xE0},
-	{0x0342, 0x0A},/* 2738  Line Length */
-	{0x0343, 0xB2},
-};
-
-static struct msm_camera_i2c_reg_conf s5k4e1_snap_settings[] = {
-	/*Output Size (2608x1960)*/
-	{0x30A9, 0x03},/* Horizontal Binning Off */
-	{0x300E, 0xE8},/* Vertical Binning Off */
-	{0x0387, 0x01},/* y_odd_inc */
-	{0x034C, 0x0A},/* x_output size */
-	{0x034D, 0x30},
-	{0x034E, 0x07},/* y_output size */
-	{0x034F, 0xA8},
-	{0x30BF, 0xAB},/* outif_enable[7], data_type[5:0](2Bh = bayer 10bit} */
-	{0x30C0, 0x80},/* video_offset[7:4] 3260%12 */
-	{0x30C8, 0x0C},/* video_data_length 3260 = 2608 * 1.25 */
-	{0x30C9, 0xBC},
-	/*Timing configuration*/
-	{0x0202, 0x06},
-	{0x0203, 0x28},
-	{0x0204, 0x00},
-	{0x0205, 0x80},
-	{0x0340, 0x07},/* Frame Length */
-	{0x0341, 0xB4},
-	{0x0342, 0x0A},/* 2738 Line Length */
-	{0x0343, 0xB2},
-};
-
-static struct msm_camera_i2c_reg_conf s5k4e1_recommend_settings[] = {
-	/* Reset setting */
-	{0x0103, 0x01},
-	/* MIPI settings */
-	{0x30BD, 0x00},/* SEL_CCP[0] */
-	{0x3084, 0x15},/* SYNC Mode */
-	{0x30BE, 0x1A},/* M_PCLKDIV_AUTO[4], M_DIV_PCLK[3:0] */
-	{0x30C1, 0x01},/* pack video enable [0] */
-	{0x30EE, 0x02},/* DPHY enable [ 1] */
-	{0x3111, 0x86},/* Embedded data off [5] */
-
-	/* REC Settings */
-	/*CDS timing setting ... */
-	{0x3000, 0x05},
-	{0x3001, 0x03},
-	{0x3002, 0x08},
-	{0x3003, 0x0A},
-	{0x3004, 0x50},
-	{0x3005, 0x0E},
-	{0x3006, 0x5E},
-	{0x3007, 0x00},
-	{0x3008, 0x78},
-	{0x3009, 0x78},
-	{0x300A, 0x50},
-	{0x300B, 0x08},
-	{0x300C, 0x14},
-	{0x300D, 0x00},
-	{0x300E, 0xE8},
-	{0x300F, 0x82},
-	{0x301B, 0x77},
-
-	/* CDS option setting ... */
-	{0x3010, 0x00},
-	{0x3011, 0x3A},
-	{0x3029, 0x04},
-	{0x3012, 0x30},
-	{0x3013, 0xA0},
-	{0x3014, 0x00},
-	{0x3015, 0x00},
-	{0x3016, 0x30},
-	{0x3017, 0x94},
-	{0x3018, 0x70},
-	{0x301D, 0xD4},
-	{0x3021, 0x02},
-	{0x3022, 0x24},
-	{0x3024, 0x40},
-	{0x3027, 0x08},
-
-	/* Pixel option setting ...   */
-	{0x301C, 0x04},
-	{0x30D8, 0x3F},
-	{0x302B, 0x01},
-
-	{0x3070, 0x5F},
-	{0x3071, 0x00},
-	{0x3080, 0x04},
-	{0x3081, 0x38},
-
-	/* PLL settings */
-	{0x0305, 0x04},
-	{0x0306, 0x00},
-	{0x0307, 0x44},
-	{0x30B5, 0x00},
-	{0x30E2, 0x01},/* num lanes[1:0] = 2 */
-	{0x30F1, 0xB0},
-};
-
-static struct v4l2_subdev_info s5k4e1_subdev_info[] = {
-	{
-	.code   = V4L2_MBUS_FMT_SGRBG10_1X10,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array s5k4e1_init_conf[] = {
-	{&s5k4e1_recommend_settings[0],
-	ARRAY_SIZE(s5k4e1_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array s5k4e1_confs[] = {
-	{&s5k4e1_snap_settings[0],
-	ARRAY_SIZE(s5k4e1_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&s5k4e1_prev_settings[0],
-	ARRAY_SIZE(s5k4e1_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t s5k4e1_dimensions[] = {
-	{
-		.x_output = 0xA30,
-		.y_output = 0x7A8,
-		.line_length_pclk = 0xAB2,
-		.frame_length_lines = 0x7B4,
-		.vt_pixel_clk = 81600000,
-		.op_pixel_clk = 81600000,
-		.binning_factor = 0,
-	},
-	{
-		.x_output = 0x518,
-		.y_output = 0x3D4,
-		.line_length_pclk = 0xAB2,
-		.frame_length_lines = 0x3E0,
-		.vt_pixel_clk = 81600000,
-		.op_pixel_clk = 81600000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_sensor_output_reg_addr_t s5k4e1_reg_addr = {
-	.x_output = 0x034C,
-	.y_output = 0x034E,
-	.line_length_pclk = 0x0342,
-	.frame_length_lines = 0x0340,
-};
-
-static struct msm_sensor_id_info_t s5k4e1_id_info = {
-	.sensor_id_reg_addr = 0x0000,
-	.sensor_id = 0x4E10,
-};
-
-static struct msm_sensor_exp_gain_info_t s5k4e1_exp_gain_info = {
-	.coarse_int_time_addr = 0x0202,
-	.global_gain_addr = 0x0204,
-	.vert_offset = 4,
-};
-
-static inline uint8_t s5k4e1_byte(uint16_t word, uint8_t offset)
-{
-	return word >> (offset * BITS_PER_BYTE);
-}
-
-static int32_t s5k4e1_write_prev_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
-	uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
-{
-	uint16_t max_legal_gain = 0x0200;
-	int32_t rc = 0;
-	static uint32_t fl_lines, offset;
-
-	pr_info("s5k4e1_write_prev_exp_gain :%d %d\n", gain, line);
-	offset = s_ctrl->sensor_exp_gain_info->vert_offset;
-	if (gain > max_legal_gain) {
-		CDBG("Max legal gain Line:%d\n", __LINE__);
-		gain = max_legal_gain;
-	}
-
-	/* Analogue Gain */
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr,
-		s5k4e1_byte(gain, MSB),
-		MSM_CAMERA_I2C_BYTE_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr + 1,
-		s5k4e1_byte(gain, LSB),
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	if (line > (s_ctrl->curr_frame_length_lines - offset)) {
-		fl_lines = line + offset;
-		s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines,
-			s5k4e1_byte(fl_lines, MSB),
-			MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines + 1,
-			s5k4e1_byte(fl_lines, LSB),
-			MSM_CAMERA_I2C_BYTE_DATA);
-		/* Coarse Integration Time */
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-			s5k4e1_byte(line, MSB),
-			MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr + 1,
-			s5k4e1_byte(line, LSB),
-			MSM_CAMERA_I2C_BYTE_DATA);
-		s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	} else if (line < (fl_lines - offset)) {
-		fl_lines = line + offset;
-		if (fl_lines < s_ctrl->curr_frame_length_lines)
-			fl_lines = s_ctrl->curr_frame_length_lines;
-
-		s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-		/* Coarse Integration Time */
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-			s5k4e1_byte(line, MSB),
-			MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr + 1,
-			s5k4e1_byte(line, LSB),
-			MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines,
-			s5k4e1_byte(fl_lines, MSB),
-			MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_output_reg_addr->frame_length_lines + 1,
-			s5k4e1_byte(fl_lines, LSB),
-			MSM_CAMERA_I2C_BYTE_DATA);
-		s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	} else {
-		fl_lines = line+4;
-		s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-		/* Coarse Integration Time */
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-			s5k4e1_byte(line, MSB),
-			MSM_CAMERA_I2C_BYTE_DATA);
-		msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-			s_ctrl->sensor_exp_gain_info->coarse_int_time_addr + 1,
-			s5k4e1_byte(line, LSB),
-			MSM_CAMERA_I2C_BYTE_DATA);
-		s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-	}
-	return rc;
-}
-
-static int32_t s5k4e1_write_pict_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
-		uint16_t gain, uint32_t line, int32_t luma_avg, uint16_t fgain)
-{
-	uint16_t max_legal_gain = 0x0200;
-	uint16_t min_ll_pck = 0x0AB2;
-	uint32_t ll_pck, fl_lines;
-	uint32_t ll_ratio;
-	uint8_t gain_msb, gain_lsb;
-	uint8_t intg_time_msb, intg_time_lsb;
-	uint8_t ll_pck_msb, ll_pck_lsb;
-
-	if (gain > max_legal_gain) {
-		CDBG("Max legal gain Line:%d\n", __LINE__);
-		gain = max_legal_gain;
-	}
-
-	pr_info("s5k4e1_write_exp_gain : gain = %d line = %d\n", gain, line);
-	line = (uint32_t) (line * s_ctrl->fps_divider);
-	fl_lines = s_ctrl->curr_frame_length_lines * s_ctrl->fps_divider / Q10;
-	ll_pck = s_ctrl->curr_line_length_pclk;
-
-	if (fl_lines < (line / Q10))
-		ll_ratio = (line / (fl_lines - 4));
-	else
-		ll_ratio = Q10;
-
-	ll_pck = ll_pck * ll_ratio / Q10;
-	line = line / ll_ratio;
-	if (ll_pck < min_ll_pck)
-		ll_pck = min_ll_pck;
-
-	gain_msb = (uint8_t) ((gain & 0xFF00) >> 8);
-	gain_lsb = (uint8_t) (gain & 0x00FF);
-
-	intg_time_msb = (uint8_t) ((line & 0xFF00) >> 8);
-	intg_time_lsb = (uint8_t) (line & 0x00FF);
-
-	ll_pck_msb = (uint8_t) ((ll_pck & 0xFF00) >> 8);
-	ll_pck_lsb = (uint8_t) (ll_pck & 0x00FF);
-
-	s_ctrl->func_tbl->sensor_group_hold_on(s_ctrl);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr,
-		gain_msb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->global_gain_addr + 1,
-		gain_lsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_output_reg_addr->line_length_pclk,
-		ll_pck_msb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_output_reg_addr->line_length_pclk + 1,
-		ll_pck_lsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-
-	/* Coarse Integration Time */
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr,
-		intg_time_msb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-	msm_camera_i2c_write(s_ctrl->sensor_i2c_client,
-		s_ctrl->sensor_exp_gain_info->coarse_int_time_addr + 1,
-		intg_time_lsb,
-		MSM_CAMERA_I2C_BYTE_DATA);
-	s_ctrl->func_tbl->sensor_group_hold_off(s_ctrl);
-
-	return 0;
-}
-
-int32_t s5k4e1_sensor_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	struct msm_camera_sensor_info *s_info;
-
-	rc = msm_sensor_i2c_probe(client, id);
-
-	s_info = client->dev.platform_data;
-	if (s_info == NULL) {
-		pr_err("%s %s NULL sensor data\n", __func__, client->name);
-		return -EFAULT;
-	}
-
-	if (s_info->actuator_info->vcm_enable) {
-		rc = gpio_request(s_info->actuator_info->vcm_pwd,
-				"msm_actuator");
-		if (rc < 0)
-			pr_err("%s: gpio_request:msm_actuator %d failed\n",
-				__func__, s_info->actuator_info->vcm_pwd);
-		rc = gpio_direction_output(s_info->actuator_info->vcm_pwd, 0);
-		if (rc < 0)
-			pr_err("%s: gpio:msm_actuator %d direction can't be set\n",
-				__func__, s_info->actuator_info->vcm_pwd);
-		gpio_free(s_info->actuator_info->vcm_pwd);
-	}
-
-	return rc;
-}
-
-static const struct i2c_device_id s5k4e1_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&s5k4e1_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver s5k4e1_i2c_driver = {
-	.id_table = s5k4e1_i2c_id,
-	.probe  = s5k4e1_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client s5k4e1_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	return i2c_add_driver(&s5k4e1_i2c_driver);
-}
-
-static struct v4l2_subdev_core_ops s5k4e1_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops s5k4e1_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops s5k4e1_subdev_ops = {
-	.core = &s5k4e1_subdev_core_ops,
-	.video  = &s5k4e1_subdev_video_ops,
-};
-
-static struct msm_sensor_fn_t s5k4e1_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = msm_sensor_set_fps,
-	.sensor_write_exp_gain = s5k4e1_write_prev_exp_gain,
-	.sensor_write_snapshot_exp_gain = s5k4e1_write_pict_exp_gain,
-	.sensor_csi_setting = msm_sensor_setting1,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-};
-
-static struct msm_sensor_reg_t s5k4e1_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = s5k4e1_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(s5k4e1_start_settings),
-	.stop_stream_conf = s5k4e1_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(s5k4e1_stop_settings),
-	.group_hold_on_conf = s5k4e1_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(s5k4e1_groupon_settings),
-	.group_hold_off_conf = s5k4e1_groupoff_settings,
-	.group_hold_off_conf_size =
-		ARRAY_SIZE(s5k4e1_groupoff_settings),
-	.init_settings = &s5k4e1_init_conf[0],
-	.init_size = ARRAY_SIZE(s5k4e1_init_conf),
-	.mode_settings = &s5k4e1_confs[0],
-	.output_settings = &s5k4e1_dimensions[0],
-	.num_conf = ARRAY_SIZE(s5k4e1_confs),
-};
-
-static struct msm_sensor_ctrl_t s5k4e1_s_ctrl = {
-	.msm_sensor_reg = &s5k4e1_regs,
-	.sensor_i2c_client = &s5k4e1_sensor_i2c_client,
-	.sensor_i2c_addr = 0x6C,
-	.sensor_output_reg_addr = &s5k4e1_reg_addr,
-	.sensor_id_info = &s5k4e1_id_info,
-	.sensor_exp_gain_info = &s5k4e1_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &s5k4e1_mut,
-	.sensor_i2c_driver = &s5k4e1_i2c_driver,
-	.sensor_v4l2_subdev_info = s5k4e1_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(s5k4e1_subdev_info),
-	.sensor_v4l2_subdev_ops = &s5k4e1_subdev_ops,
-	.func_tbl = &s5k4e1_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Samsung 5MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
-
-
diff --git a/drivers/media/video/msm/sensors/s5k6a1gx_v4l2.c b/drivers/media/video/msm/sensors/s5k6a1gx_v4l2.c
new file mode 100644
index 0000000..5b0dbac
--- /dev/null
+++ b/drivers/media/video/msm/sensors/s5k6a1gx_v4l2.c
@@ -0,0 +1,418 @@
+#include "msm_sensor.h"
+#define SENSOR_NAME "s5k6a1gx"
+#define PLATFORM_DRIVER_NAME "msm_camera_s5k6a1gx"
+#define s5k6a1gx_obj s5k6a1gx_##obj
+
+DEFINE_MUTEX(s5k6a1gx_mut);
+static struct msm_sensor_ctrl_t s5k6a1gx_s_ctrl;
+
+static struct msm_camera_i2c_reg_conf s5k6a1gx_start_settings[] = {
+	{0x0100, 0x01},
+};
+
+static struct msm_camera_i2c_reg_conf s5k6a1gx_stop_settings[] = {
+	{0x0100, 0x00},
+};
+
+static struct msm_camera_i2c_reg_conf s5k6a1gx_groupon_settings[] = {
+	{0x104, 0x01},
+};
+
+static struct msm_camera_i2c_reg_conf s5k6a1gx_groupoff_settings[] = {
+	{0x104, 0x00},
+};
+
+static struct msm_camera_i2c_reg_conf s5k6a1gx_prev_settings[] = {
+	
+	{0x0202, 0x01}, 
+	{0x0203, 0x4C},
+	{0x0204, 0x00}, 
+	{0x0205, 0x20},
+	{0x0342, 0x05}, 
+	{0x0343, 0xCE},
+	{0x0340, 0x04}, 
+	{0x0341, 0x22},
+
+	
+	{0x0344, 0x00}, 
+	{0x0345, 0x00}, 
+	{0x0346, 0x00}, 
+	{0x0347, 0x00}, 
+
+	{0x0348, 0x05}, 
+	{0x0349, 0x0F}, 
+
+	{0x034A, 0x04}, 
+	{0x034B, 0x0F}, 
+
+	{0x034C, 0x05}, 
+	{0x034D, 0x10},
+
+	{0x034E, 0x04}, 
+	{0x034F, 0x10},
+};
+
+static struct msm_camera_i2c_reg_conf s5k6a1gx_snap_settings[] = {
+	
+	{0x0202, 0x01}, 
+	{0x0203, 0x4C},
+	{0x0204, 0x00}, 
+	{0x0205, 0x20},
+	{0x0342, 0x05}, 
+	{0x0343, 0xCE},
+	{0x0340, 0x04}, 
+	{0x0341, 0x22},
+
+	
+	{0x0344, 0x00}, 
+	{0x0345, 0x00}, 
+	{0x0346, 0x00}, 
+	{0x0347, 0x00}, 
+
+	{0x0348, 0x05}, 
+	{0x0349, 0x0F}, 
+
+	{0x034A, 0x04}, 
+	{0x034B, 0x0F}, 
+
+	{0x034C, 0x05}, 
+	{0x034D, 0x10},
+
+	{0x034E, 0x04}, 
+	{0x034F, 0x10},
+};
+
+static struct msm_camera_i2c_reg_conf s5k6a1gx_recommend_settings[] = {
+	{0x0103, 0x01}, 
+	{0x301C, 0x35}, 
+	{0x3016, 0x05}, 
+	{0x3034, 0x73}, 
+	{0x3037, 0x01}, 
+	{0x3035, 0x05}, 
+	{0x301E, 0x09}, 
+	{0x301B, 0xC0}, 
+	{0x3013, 0x28}, 
+	{0x3042, 0x01}, 
+	{0x303C, 0x01}, 
+
+	
+	{0x30BC, 0x38}, 
+	{0x30BD, 0x40}, 
+	{0x3110, 0x70}, 
+	{0x3111, 0x80}, 
+	{0x3112, 0x7B}, 
+	{0x3113, 0xC0}, 
+	{0x30C7, 0x1A}, 
+
+	
+	{0x0305, 0x04}, 
+	{0x0306, 0x00}, 
+	{0x0307, 0xA0},
+	{0x308D, 0x01}, 
+	{0x0301, 0x0A}, 
+	{0x0303, 0x01}, 
+
+	
+	{0x0101, 0x00}, 
+};
+
+static struct v4l2_subdev_info s5k6a1gx_subdev_info[] = {
+	{
+	.code   = V4L2_MBUS_FMT_SBGGR10_1X10,
+	.colorspace = V4L2_COLORSPACE_JPEG,
+	.fmt    = 1,
+	.order    = 0,
+	},
+	
+};
+
+static struct msm_camera_i2c_conf_array s5k6a1gx_init_conf[] = {
+	{&s5k6a1gx_recommend_settings[0],
+	ARRAY_SIZE(s5k6a1gx_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
+};
+
+static struct msm_camera_i2c_conf_array s5k6a1gx_confs[] = {
+	{&s5k6a1gx_snap_settings[0],
+	ARRAY_SIZE(s5k6a1gx_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+	{&s5k6a1gx_prev_settings[0],
+	ARRAY_SIZE(s5k6a1gx_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
+};
+
+static struct msm_sensor_output_info_t s5k6a1gx_dimensions[] = {
+	{
+		.x_output = 0x510,
+		.y_output = 0x410,
+		.line_length_pclk = 0x5CE,
+		.frame_length_lines = 0x422,
+		.vt_pixel_clk = 48000000,
+		.op_pixel_clk = 48000000,
+		.binning_factor = 1,
+	},
+	{
+		.x_output = 0x510,
+		.y_output = 0x410,
+		.line_length_pclk = 0x5CE,
+		.frame_length_lines = 0x422,
+		.vt_pixel_clk = 48000000,
+		.op_pixel_clk = 48000000,
+		.binning_factor = 1,
+	},
+};
+
+static struct msm_camera_csid_vc_cfg s5k6a1gx_cid_cfg[] = {
+	{0, CSI_RAW10, CSI_DECODE_10BIT},
+	{1, CSI_EMBED_DATA, CSI_DECODE_8BIT},
+};
+
+static struct msm_camera_csi2_params s5k6a1gx_csi_params = {
+	.csid_params = {
+		.lane_assign = 0xe4,
+		.lane_cnt = 1,
+		.lut_params = {
+			.num_cid = 2,
+			.vc_cfg = s5k6a1gx_cid_cfg,
+		},
+	},
+	.csiphy_params = {
+		.lane_cnt = 1,
+		.settle_cnt = 20,
+	},
+};
+
+static struct msm_camera_csi2_params *s5k6a1gx_csi_params_array[] = {
+	&s5k6a1gx_csi_params,
+	&s5k6a1gx_csi_params,
+};
+
+static struct msm_sensor_output_reg_addr_t s5k6a1gx_reg_addr = {
+	.x_output = 0x34C,
+	.y_output = 0x34E,
+	.line_length_pclk = 0x342,
+	.frame_length_lines = 0x340,
+};
+
+static struct msm_sensor_id_info_t s5k6a1gx_id_info = {
+	.sensor_id_reg_addr = 0x0,
+	.sensor_id = 0x6a10,
+};
+
+static struct msm_sensor_exp_gain_info_t s5k6a1gx_exp_gain_info = {
+	.coarse_int_time_addr = 0x202,
+	.global_gain_addr = 0x204,
+	.vert_offset = 4,
+	.min_vert = 4,  
+};
+
+static int s5k6a1gx_sensor_open_init(const struct msm_camera_sensor_info *data)
+{
+	return 0;
+}
+
+static const char *s5k6a1gxVendor = "samsung";
+static const char *s5k6a1gxNAME = "s5k6a1gx";
+static const char *s5k6a1gxSize = "1.3M";
+
+static ssize_t sensor_vendor_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	ssize_t ret = 0;
+
+	sprintf(buf, "%s %s %s\n", s5k6a1gxVendor, s5k6a1gxNAME, s5k6a1gxSize);
+	ret = strlen(buf) + 1;
+
+	return ret;
+}
+
+static DEVICE_ATTR(sensor, 0444, sensor_vendor_show, NULL);
+
+static struct kobject *android_s5k6a1gx;
+
+static int s5k6a1gx_sysfs_init(void)
+{
+	int ret ;
+	pr_info("s5k6a1gx:kobject creat and add\n");
+	android_s5k6a1gx = kobject_create_and_add("android_camera2", NULL);
+	if (android_s5k6a1gx == NULL) {
+		pr_info("s5k6a1gx_sysfs_init: subsystem_register " \
+		"failed\n");
+		ret = -ENOMEM;
+		return ret ;
+	}
+	pr_info("s5k6a1gx:sysfs_create_file\n");
+	ret = sysfs_create_file(android_s5k6a1gx, &dev_attr_sensor.attr);
+	if (ret) {
+		pr_info("s5k6a1gx_sysfs_init: sysfs_create_file " \
+		"failed\n");
+		kobject_del(android_s5k6a1gx);
+	}
+
+	return 0 ;
+}
+
+static struct msm_camera_i2c_client s5k6a1gx_sensor_i2c_client = {
+	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
+};
+
+int32_t s5k6a1gx_power_up(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int rc;
+	struct msm_camera_sensor_info *sdata = NULL;
+	pr_info("%s\n", __func__);
+
+	if (s_ctrl && s_ctrl->sensordata)
+		sdata = s_ctrl->sensordata;
+	else {
+		pr_err("%s: s_ctrl sensordata NULL\n", __func__);
+		return (-1);
+	}
+
+	if (sdata->camera_power_on == NULL) {
+		pr_err("sensor platform_data didnt register\n");
+		return -EIO;
+	}
+
+	rc = sdata->camera_power_on();
+	if (rc < 0) {
+		pr_err("%s failed to enable power\n", __func__);
+		return rc;
+	}
+
+	rc = msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
+	if (rc < 0) {
+		return rc;
+	}
+
+	s5k6a1gx_sensor_open_init(sdata);
+	pr_info("%s end\n", __func__);
+
+	return 0;  
+}
+
+int32_t s5k6a1gx_power_down(struct msm_sensor_ctrl_t *s_ctrl)
+{
+	int rc;
+	struct msm_camera_sensor_info *sdata = NULL;
+	pr_info("%s\n", __func__);
+
+	if (s_ctrl && s_ctrl->sensordata)
+		sdata = s_ctrl->sensordata;
+	else {
+		pr_err("%s: s_ctrl sensordata NULL\n", __func__);
+		return (-1);
+	}
+
+	if (sdata->camera_power_off == NULL) {
+		pr_err("sensor platform_data didnt register\n");
+		return -EIO;
+	}
+
+	msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
+
+	rc = sdata->camera_power_off();
+	if (rc < 0) {
+		pr_err("%s failed to disable power\n", __func__);
+		return rc;
+	}
+	return 0;  
+}
+
+int32_t s5k6a1gx_i2c_probe(struct i2c_client *client,
+	const struct i2c_device_id *id)
+{
+	int	rc = 0;
+	pr_info("%s\n", __func__);
+	rc = msm_sensor_i2c_probe(client, id);
+	if(rc >= 0)
+		s5k6a1gx_sysfs_init();
+	pr_info("%s: rc(%d)\n", __func__, rc);
+	return rc;
+}
+
+static const struct i2c_device_id s5k6a1gx_i2c_id[] = {
+	{SENSOR_NAME, (kernel_ulong_t)&s5k6a1gx_s_ctrl},
+	{ }
+};
+
+static struct i2c_driver s5k6a1gx_i2c_driver = {
+	.id_table = s5k6a1gx_i2c_id,
+	.probe  = s5k6a1gx_i2c_probe,
+	.driver = {
+		.name = SENSOR_NAME,
+	},
+};
+
+static int __init msm_sensor_init_module(void)
+{
+	pr_info("%s\n", __func__);
+	return i2c_add_driver(&s5k6a1gx_i2c_driver);
+}
+
+static struct v4l2_subdev_core_ops s5k6a1gx_subdev_core_ops = {
+	.ioctl = msm_sensor_subdev_ioctl,
+	.s_power = msm_sensor_power,
+};
+
+static struct v4l2_subdev_video_ops s5k6a1gx_subdev_video_ops = {
+	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
+};
+
+static struct v4l2_subdev_ops s5k6a1gx_subdev_ops = {
+	.core = &s5k6a1gx_subdev_core_ops,
+	.video  = &s5k6a1gx_subdev_video_ops,
+};
+
+static struct msm_sensor_fn_t s5k6a1gx_func_tbl = {
+	.sensor_start_stream = msm_sensor_start_stream,
+	.sensor_stop_stream = msm_sensor_stop_stream,
+	.sensor_group_hold_on = msm_sensor_group_hold_on,
+	.sensor_group_hold_off = msm_sensor_group_hold_off,
+	.sensor_set_fps = msm_sensor_set_fps,
+	.sensor_write_exp_gain_ex = msm_sensor_write_exp_gain1_ex,
+	.sensor_write_snapshot_exp_gain_ex = msm_sensor_write_exp_gain1_ex,
+	.sensor_setting = msm_sensor_setting,
+	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
+	.sensor_mode_init = msm_sensor_mode_init,
+	.sensor_get_output_info = msm_sensor_get_output_info,
+	.sensor_config = msm_sensor_config,
+	.sensor_power_up = s5k6a1gx_power_up,
+	.sensor_power_down = s5k6a1gx_power_down,
+};
+
+static struct msm_sensor_reg_t s5k6a1gx_regs = {
+	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
+	.start_stream_conf = s5k6a1gx_start_settings,
+	.start_stream_conf_size = ARRAY_SIZE(s5k6a1gx_start_settings),
+	.stop_stream_conf = s5k6a1gx_stop_settings,
+	.stop_stream_conf_size = ARRAY_SIZE(s5k6a1gx_stop_settings),
+	.group_hold_on_conf = s5k6a1gx_groupon_settings,
+	.group_hold_on_conf_size = ARRAY_SIZE(s5k6a1gx_groupon_settings),
+	.group_hold_off_conf = s5k6a1gx_groupoff_settings,
+	.group_hold_off_conf_size =
+		ARRAY_SIZE(s5k6a1gx_groupoff_settings),
+	.init_settings = &s5k6a1gx_init_conf[0],
+	.init_size = ARRAY_SIZE(s5k6a1gx_init_conf),
+	.mode_settings = &s5k6a1gx_confs[0],
+	.output_settings = &s5k6a1gx_dimensions[0],
+	.num_conf = ARRAY_SIZE(s5k6a1gx_confs),
+};
+
+static struct msm_sensor_ctrl_t s5k6a1gx_s_ctrl = {
+	.msm_sensor_reg = &s5k6a1gx_regs,
+	.sensor_i2c_client = &s5k6a1gx_sensor_i2c_client,
+	.sensor_i2c_addr = 0x6C,
+	.sensor_output_reg_addr = &s5k6a1gx_reg_addr,
+	.sensor_id_info = &s5k6a1gx_id_info,
+	.sensor_exp_gain_info = &s5k6a1gx_exp_gain_info,
+	.cam_mode = MSM_SENSOR_MODE_INVALID,
+	.csi_params = &s5k6a1gx_csi_params_array[0],
+	.msm_sensor_mutex = &s5k6a1gx_mut,
+	.sensor_i2c_driver = &s5k6a1gx_i2c_driver,
+	.sensor_v4l2_subdev_info = s5k6a1gx_subdev_info,
+	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(s5k6a1gx_subdev_info),
+	.sensor_v4l2_subdev_ops = &s5k6a1gx_subdev_ops,
+	.func_tbl = &s5k6a1gx_func_tbl,
+};
+
+module_init(msm_sensor_init_module);
+MODULE_DESCRIPTION("Samsung 1.3 MP Bayer sensor driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sensors/vx6953.c b/drivers/media/video/msm/sensors/vx6953.c
deleted file mode 100644
index 9867468..0000000
--- a/drivers/media/video/msm/sensors/vx6953.c
+++ /dev/null
@@ -1,2037 +0,0 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "msm_sensor.h"
-#include "msm.h"
-#include "vx6953.h"
-#include "vx6953_reg.h"
-#define SENSOR_NAME "vx6953"
-#define PLATFORM_DRIVER_NAME "msm_camera_vx6953"
-#define vx6953_obj vx6953_##obj
-
-DEFINE_MUTEX(vx6953_mut);
-
-#undef CDBG
-#define CDBG printk
-#define REG_GROUPED_PARAMETER_HOLD			0x0104
-#define GROUPED_PARAMETER_HOLD_OFF			0x00
-#define GROUPED_PARAMETER_HOLD				0x01
-#define REG_MODE_SELECT					0x0100
-#define MODE_SELECT_STANDBY_MODE			0x00
-#define MODE_SELECT_STREAM				0x01
-/* Integration Time */
-#define REG_COARSE_INTEGRATION_TIME_HI			0x0202
-#define REG_COARSE_INTEGRATION_TIME_LO			0x0203
-/* Gain */
-#define REG_ANALOGUE_GAIN_CODE_GLOBAL_HI		0x0204
-#define REG_ANALOGUE_GAIN_CODE_GLOBAL_LO		0x0205
-/* Digital Gain */
-#define REG_DIGITAL_GAIN_GREEN_R_HI			0x020E
-#define REG_DIGITAL_GAIN_GREEN_R_LO			0x020F
-#define REG_DIGITAL_GAIN_RED_HI				0x0210
-#define REG_DIGITAL_GAIN_RED_LO				0x0211
-#define REG_DIGITAL_GAIN_BLUE_HI			0x0212
-#define REG_DIGITAL_GAIN_BLUE_LO			0x0213
-#define REG_DIGITAL_GAIN_GREEN_B_HI			0x0214
-#define REG_DIGITAL_GAIN_GREEN_B_LO			0x0215
-/* output bits setting */
-#define REG_0x0112					0x0112
-#define REG_0x0113					0x0113
-/* PLL registers */
-#define REG_VT_PIX_CLK_DIV				0x0301
-#define REG_PRE_PLL_CLK_DIV				0x0305
-#define REG_PLL_MULTIPLIER				0x0307
-#define REG_OP_PIX_CLK_DIV				0x0309
-#define REG_0x034c					0x034c
-#define REG_0x034d					0x034d
-#define REG_0x034e					0x034e
-#define REG_0x034f					0x034f
-#define REG_0x0387					0x0387
-#define REG_0x0383					0x0383
-#define REG_FRAME_LENGTH_LINES_HI			0x0340
-#define REG_FRAME_LENGTH_LINES_LO			0x0341
-#define REG_LINE_LENGTH_PCK_HI				0x0342
-#define REG_LINE_LENGTH_PCK_LO				0x0343
-#define REG_0x3030					0x3030
-#define REG_0x0111					0x0111
-#define REG_0x0136					0x0136
-#define REG_0x0137					0x0137
-#define REG_0x0b00					0x0b00
-#define REG_0x3001					0x3001
-#define REG_0x3004					0x3004
-#define REG_0x3007					0x3007
-#define REG_0x301a					0x301a
-#define REG_0x3101					0x3101
-#define REG_0x3364					0x3364
-#define REG_0x3365					0x3365
-#define REG_0x0b83					0x0b83
-#define REG_0x0b84					0x0b84
-#define REG_0x0b85					0x0b85
-#define REG_0x0b88					0x0b88
-#define REG_0x0b89					0x0b89
-#define REG_0x0b8a					0x0b8a
-#define REG_0x3005					0x3005
-#define REG_0x3010					0x3010
-#define REG_0x3036					0x3036
-#define REG_0x3041					0x3041
-#define REG_0x0b80					0x0b80
-#define REG_0x0900					0x0900
-#define REG_0x0901					0x0901
-#define REG_0x0902					0x0902
-#define REG_0x3016					0x3016
-#define REG_0x301d					0x301d
-#define REG_0x317e					0x317e
-#define REG_0x317f					0x317f
-#define REG_0x3400					0x3400
-#define REG_0x303a					0x303a
-#define REG_0x1716					0x1716
-#define REG_0x1717					0x1717
-#define REG_0x1718					0x1718
-#define REG_0x1719					0x1719
-#define REG_0x3006					0x3006
-#define REG_0x301b					0x301b
-#define REG_0x3098					0x3098
-#define REG_0x309d					0x309d
-#define REG_0x3011					0x3011
-#define REG_0x3035					0x3035
-#define REG_0x3045					0x3045
-#define REG_0x3210					0x3210
-#define	REG_0x0111					0x0111
-#define REG_0x3410					0x3410
-#define REG_0x0b06					0x0b06
-#define REG_0x0b07					0x0b07
-#define REG_0x0b08					0x0b08
-#define REG_0x0b09					0x0b09
-#define REG_0x3640					0x3640
-/* Test Pattern */
-#define REG_TEST_PATTERN_MODE				0x0601
-/* 16bit address - 8 bit context register structure */
-#define	VX6953_STM5M0EDOF_OFFSET	9
-#define	Q8		0x00000100
-#define	Q10		0x00000400
-#define	VX6953_STM5M0EDOF_MAX_SNAPSHOT_EXPOSURE_LINE_COUNT	2922
-#define	VX6953_STM5M0EDOF_DEFAULT_MASTER_CLK_RATE	24000000
-#define	VX6953_STM5M0EDOF_OP_PIXEL_CLOCK_RATE	79800000
-#define	VX6953_STM5M0EDOF_VT_PIXEL_CLOCK_RATE	88670000
-/* Full	Size */
-#define	VX6953_FULL_SIZE_WIDTH	2608
-#define	VX6953_FULL_SIZE_HEIGHT		1960
-#define	VX6953_FULL_SIZE_DUMMY_PIXELS	1
-#define	VX6953_FULL_SIZE_DUMMY_LINES	0
-/* Quarter Size	*/
-#define	VX6953_QTR_SIZE_WIDTH	1304
-#define	VX6953_QTR_SIZE_HEIGHT		980
-#define	VX6953_QTR_SIZE_DUMMY_PIXELS	1
-#define	VX6953_QTR_SIZE_DUMMY_LINES		0
-/* Blanking	as measured	on the scope */
-/* Full	Size */
-#define	VX6953_HRZ_FULL_BLK_PIXELS	348
-#define	VX6953_VER_FULL_BLK_LINES	40
-/* Quarter Size	*/
-#define	VX6953_HRZ_QTR_BLK_PIXELS	1628
-#define	VX6953_VER_QTR_BLK_LINES	28
-#define	MAX_LINE_LENGTH_PCK		8190
-#define	MAX_FRAME_LENGTH_LINES	16383
-#define	VX6953_REVISION_NUMBER_CUT2	0x10/*revision number	for	Cut2.0*/
-#define	VX6953_REVISION_NUMBER_CUT3	0x20/*revision number	for	Cut3.0*/
-static struct msm_sensor_ctrl_t vx6953_s_ctrl;
-static uint32_t fps_divider;/* init to 1 * 0x00000400 */
-static uint16_t fps;
-static uint8_t vx6953_stm5m0edof_delay_msecs_stdby;
-static struct msm_camera_i2c_reg_conf vx6953_start_settings[] = {
-	{0x0100, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf vx6953_stop_settings[] = {
-	{0x0100, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf vx6953_groupon_settings[] = {
-	{0x0104, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf vx6953_groupoff_settings[] = {
-	{0x0104, 0x00},
-};
-
-static struct msm_camera_i2c_reg_conf vx6953_prev_settings[] = {
-	{0x0202, 0x03},/*REG = 0x0202 coarse integration_time_hi*/
-	{0x0203, 0xD0},/*REG = 0x0203 coarse_integration_time_lo*/
-	{0x0205, 0xC0},/*REG = 0x0205 analogue_gain_code_global*/
-	{0x0340, 0x03},/*REG = 0x0340 frame_length_lines_hi*/
-	{0x0341, 0xf0},/*REG = 0x0341 frame_length_lines_lo*/
-	{0x0342, 0x0b},/*REG = 0x0342  line_length_pck_hi*/
-	{0x0343, 0x74},/*REG = 0x0343  line_length_pck_lo*/
-	{0x3005, 0x03},/*REG = 0x3005*/
-	{0x3010, 0x00},/*REG = 0x3010*/
-	{0x3011, 0x01},/*REG = 0x3011*/
-	{0x301a, 0x6a},/*REG = 0x301a*/
-	{0x3035, 0x03},/*REG = 0x3035*/
-	{0x3036, 0x2c},/*REG = 0x3036*/
-	{0x3041, 0x00},/*REG = 0x3041*/
-	{0x3042, 0x24},/*REG = 0x3042*/
-	{0x3045, 0x81},/*REG = 0x3045*/
-	{0x0b80, 0x02},/*REG = 0x0b80 edof estimate*/
-	{0x0900, 0x01},/*REG = 0x0900*/
-	{0x0901, 0x22},/*REG = 0x0901*/
-	{0x0902, 0x04},/*REG = 0x0902*/
-	{0x0383, 0x03},/*REG = 0x0383*/
-	{0x0387, 0x03},/*REG = 0x0387*/
-	{0x034c, 0x05},/*REG = 0x034c*/
-	{0x034d, 0x18},/*REG = 0x034d*/
-	{0x034e, 0x03},/*REG = 0x034e*/
-	{0x034f, 0xd4},/*REG = 0x034f*/
-	{0x1716, 0x02},/*0x1716*/
-	{0x1717, 0x04},/*0x1717*/
-	{0x1718, 0x08},/*0x1718*/
-	{0x1719, 0x2c},/*0x1719*/
-};
-
-static struct msm_camera_i2c_reg_conf vx6953_snap_settings[] = {
-	{0x0202, 0x07},/*REG = 0x0202 coarse_integration_time_hi*/
-	{0x0203, 0x00},/*REG = 0x0203 coarse_integration_time_lo*/
-	{0x0205, 0xc0},/*REG = 0x0205 analogue_gain_code_global*/
-	{0x0340, 0x07},/*REG = 0x0340 frame_length_lines_hi*/
-	{0x0341, 0xd0},/*REG = 0x0341 frame_length_lines_lo*/
-	{0x0342, 0x0b},/*REG = 0x0342 line_length_pck_hi*/
-	{0x0343, 0x8c},/*REG = 0x0343 line_length_pck_lo*/
-	{0x3005, 0x01},/*REG = 0x3005*/
-	{0x3010, 0x00},/*REG = 0x3010*/
-	{0x3011, 0x00},/*REG = 0x3011*/
-	{0x301a, 0x55},/*REG = 0x301a*/
-	{0x3035, 0x01},/*REG = 0x3035*/
-	{0x3036, 0x23},/*REG = 0x3036*/
-	{0x3041, 0x00},/*REG = 0x3041*/
-	{0x3042, 0x24},/*REG = 0x3042*/
-	{0x3045, 0xb7},/*REG = 0x3045*/
-	{0x0b80, 0x01},/*REG = 0x0b80 edof application*/
-	{0x0900, 0x00},/*REG = 0x0900*/
-	{0x0901, 0x00},/*REG = 0x0901*/
-	{0x0902, 0x00},/*REG = 0x0902*/
-	{0x0383, 0x01},/*REG = 0x0383*/
-	{0x0387, 0x01},/*REG = 0x0387*/
-	{0x034c, 0x0A},/*REG = 0x034c*/
-	{0x034d, 0x30},/*REG = 0x034d*/
-	{0x034e, 0x07},/*REG = 0x034e*/
-	{0x034f, 0xA8},/*REG = 0x034f*/
-	{0x1716, 0x02},/*0x1716*/
-	{0x1717, 0x0d},/*0x1717*/
-	{0x1718, 0x07},/*0x1718*/
-	{0x1719, 0x7d},/*0x1719*/
-};
-
-static struct msm_camera_i2c_reg_conf vx6953_recommend_settings[] = {
-	{0x0103, 0x01}, /* standby */
-	{0x0100, 0x00}, /* stop streaming */
-	/* patch cut 2*/
-	{0xFB94, 0},	/*intialise Data Xfer Status reg*/
-	{0xFB95, 0},	/*gain 1	  (0x00)*/
-	{0xFB96, 0},	/*gain 1.07   (0x10)*/
-	{0xFB97, 0},	/*gain 1.14   (0x20)*/
-	{0xFB98, 0},	/*gain 1.23   (0x30)*/
-	{0xFB99, 0},	/*gain 1.33   (0x40)*/
-	{0xFB9A, 0},	/*gain 1.45   (0x50)*/
-	{0xFB9B, 0},	/*gain 1.6    (0x60)*/
-	{0xFB9C, 0},	/*gain 1.78   (0x70)*/
-	{0xFB9D, 2},	/*gain 2	  (0x80)*/
-	{0xFB9E, 2},	/*gain 2.29   (0x90)*/
-	{0xFB9F, 3},	/*gain 2.67   (0xA0)*/
-	{0xFBA0, 3},	/*gain 3.2    (0xB0)*/
-	{0xFBA1, 4},	/*gain 4	  (0xC0)*/
-	{0xFBA2, 7},	/*gain 5.33   (0xD0)*/
-	{0xFBA3, 10},	/*gain 8	  (0xE0)*/
-	{0xFBA4, 11},	/*gain 9.14   (0xE4)*/
-	{0xFBA5, 13},	/*gain 10.67  (0xE8)*/
-	{0xFBA6, 15},	/*gain 12.8   (0xEC)*/
-	{0xFBA7, 19},	/*gain 16     (0xF0)*/
-	{0xF800, 0x12},
-	{0xF801, 0x06},
-	{0xF802, 0xf7},
-	{0xF803, 0x90},
-	{0xF804, 0x02},
-	{0xF805, 0x05},
-	{0xF806, 0xe0},
-	{0xF807, 0xff},
-	{0xF808, 0x65},
-	{0xF809, 0x7d},
-	{0xF80A, 0x70},
-	{0xF80B, 0x03},
-	{0xF80C, 0x02},
-	{0xF80D, 0xf9},
-	{0xF80E, 0x1c},
-	{0xF80F, 0x8f},
-	{0xF810, 0x7d},
-	{0xF811, 0xe4},
-	{0xF812, 0xf5},
-	{0xF813, 0x7a},
-	{0xF814, 0x75},
-	{0xF815, 0x78},
-	{0xF816, 0x30},
-	{0xF817, 0x75},
-	{0xF818, 0x79},
-	{0xF819, 0x53},
-	{0xF81A, 0x85},
-	{0xF81B, 0x79},
-	{0xF81C, 0x82},
-	{0xF81D, 0x85},
-	{0xF81E, 0x78},
-	{0xF81F, 0x83},
-	{0xF820, 0xe0},
-	{0xF821, 0xc3},
-	{0xF822, 0x95},
-	{0xF823, 0x7b},
-	{0xF824, 0xf0},
-	{0xF825, 0x74},
-	{0xF826, 0x02},
-	{0xF827, 0x25},
-	{0xF828, 0x79},
-	{0xF829, 0xf5},
-	{0xF82A, 0x79},
-	{0xF82B, 0xe4},
-	{0xF82C, 0x35},
-	{0xF82D, 0x78},
-	{0xF82E, 0xf5},
-	{0xF82F, 0x78},
-	{0xF830, 0x05},
-	{0xF831, 0x7a},
-	{0xF832, 0xe5},
-	{0xF833, 0x7a},
-	{0xF834, 0xb4},
-	{0xF835, 0x08},
-	{0xF836, 0xe3},
-	{0xF837, 0xe5},
-	{0xF838, 0x7d},
-	{0xF839, 0x70},
-	{0xF83A, 0x04},
-	{0xF83B, 0xff},
-	{0xF83C, 0x02},
-	{0xF83D, 0xf8},
-	{0xF83E, 0xe4},
-	{0xF83F, 0xe5},
-	{0xF840, 0x7d},
-	{0xF841, 0xb4},
-	{0xF842, 0x10},
-	{0xF843, 0x05},
-	{0xF844, 0x7f},
-	{0xF845, 0x01},
-	{0xF846, 0x02},
-	{0xF847, 0xf8},
-	{0xF848, 0xe4},
-	{0xF849, 0xe5},
-	{0xF84A, 0x7d},
-	{0xF84B, 0xb4},
-	{0xF84C, 0x20},
-	{0xF84D, 0x05},
-	{0xF84E, 0x7f},
-	{0xF84F, 0x02},
-	{0xF850, 0x02},
-	{0xF851, 0xf8},
-	{0xF852, 0xe4},
-	{0xF853, 0xe5},
-	{0xF854, 0x7d},
-	{0xF855, 0xb4},
-	{0xF856, 0x30},
-	{0xF857, 0x05},
-	{0xF858, 0x7f},
-	{0xF859, 0x03},
-	{0xF85A, 0x02},
-	{0xF85B, 0xf8},
-	{0xF85C, 0xe4},
-	{0xF85D, 0xe5},
-	{0xF85E, 0x7d},
-	{0xF85F, 0xb4},
-	{0xF860, 0x40},
-	{0xF861, 0x04},
-	{0xF862, 0x7f},
-	{0xF863, 0x04},
-	{0xF864, 0x80},
-	{0xF865, 0x7e},
-	{0xF866, 0xe5},
-	{0xF867, 0x7d},
-	{0xF868, 0xb4},
-	{0xF869, 0x50},
-	{0xF86A, 0x04},
-	{0xF86B, 0x7f},
-	{0xF86C, 0x05},
-	{0xF86D, 0x80},
-	{0xF86E, 0x75},
-	{0xF86F, 0xe5},
-	{0xF870, 0x7d},
-	{0xF871, 0xb4},
-	{0xF872, 0x60},
-	{0xF873, 0x04},
-	{0xF874, 0x7f},
-	{0xF875, 0x06},
-	{0xF876, 0x80},
-	{0xF877, 0x6c},
-	{0xF878, 0xe5},
-	{0xF879, 0x7d},
-	{0xF87A, 0xb4},
-	{0xF87B, 0x70},
-	{0xF87C, 0x04},
-	{0xF87D, 0x7f},
-	{0xF87E, 0x07},
-	{0xF87F, 0x80},
-	{0xF880, 0x63},
-	{0xF881, 0xe5},
-	{0xF882, 0x7d},
-	{0xF883, 0xb4},
-	{0xF884, 0x80},
-	{0xF885, 0x04},
-	{0xF886, 0x7f},
-	{0xF887, 0x08},
-	{0xF888, 0x80},
-	{0xF889, 0x5a},
-	{0xF88A, 0xe5},
-	{0xF88B, 0x7d},
-	{0xF88C, 0xb4},
-	{0xF88D, 0x90},
-	{0xF88E, 0x04},
-	{0xF88F, 0x7f},
-	{0xF890, 0x09},
-	{0xF891, 0x80},
-	{0xF892, 0x51},
-	{0xF893, 0xe5},
-	{0xF894, 0x7d},
-	{0xF895, 0xb4},
-	{0xF896, 0xa0},
-	{0xF897, 0x04},
-	{0xF898, 0x7f},
-	{0xF899, 0x0a},
-	{0xF89A, 0x80},
-	{0xF89B, 0x48},
-	{0xF89C, 0xe5},
-	{0xF89D, 0x7d},
-	{0xF89E, 0xb4},
-	{0xF89F, 0xb0},
-	{0xF8A0, 0x04},
-	{0xF8A1, 0x7f},
-	{0xF8A2, 0x0b},
-	{0xF8A3, 0x80},
-	{0xF8A4, 0x3f},
-	{0xF8A5, 0xe5},
-	{0xF8A6, 0x7d},
-	{0xF8A7, 0xb4},
-	{0xF8A8, 0xc0},
-	{0xF8A9, 0x04},
-	{0xF8AA, 0x7f},
-	{0xF8AB, 0x0c},
-	{0xF8AC, 0x80},
-	{0xF8AD, 0x36},
-	{0xF8AE, 0xe5},
-	{0xF8AF, 0x7d},
-	{0xF8B0, 0xb4},
-	{0xF8B1, 0xd0},
-	{0xF8B2, 0x04},
-	{0xF8B3, 0x7f},
-	{0xF8B4, 0x0d},
-	{0xF8B5, 0x80},
-	{0xF8B6, 0x2d},
-	{0xF8B7, 0xe5},
-	{0xF8B8, 0x7d},
-	{0xF8B9, 0xb4},
-	{0xF8BA, 0xe0},
-	{0xF8BB, 0x04},
-	{0xF8BC, 0x7f},
-	{0xF8BD, 0x0e},
-	{0xF8BE, 0x80},
-	{0xF8BF, 0x24},
-	{0xF8C0, 0xe5},
-	{0xF8C1, 0x7d},
-	{0xF8C2, 0xb4},
-	{0xF8C3, 0xe4},
-	{0xF8C4, 0x04},
-	{0xF8C5, 0x7f},
-	{0xF8C6, 0x0f},
-	{0xF8C7, 0x80},
-	{0xF8C8, 0x1b},
-	{0xF8C9, 0xe5},
-	{0xF8CA, 0x7d},
-	{0xF8CB, 0xb4},
-	{0xF8CC, 0xe8},
-	{0xF8CD, 0x04},
-	{0xF8CE, 0x7f},
-	{0xF8CF, 0x10},
-	{0xF8D0, 0x80},
-	{0xF8D1, 0x12},
-	{0xF8D2, 0xe5},
-	{0xF8D3, 0x7d},
-	{0xF8D4, 0xb4},
-	{0xF8D5, 0xec},
-	{0xF8D6, 0x04},
-	{0xF8D7, 0x7f},
-	{0xF8D8, 0x11},
-	{0xF8D9, 0x80},
-	{0xF8DA, 0x09},
-	{0xF8DB, 0xe5},
-	{0xF8DC, 0x7d},
-	{0xF8DD, 0x7f},
-	{0xF8DE, 0x00},
-	{0xF8DF, 0xb4},
-	{0xF8E0, 0xf0},
-	{0xF8E1, 0x02},
-	{0xF8E2, 0x7f},
-	{0xF8E3, 0x12},
-	{0xF8E4, 0x8f},
-	{0xF8E5, 0x7c},
-	{0xF8E6, 0xef},
-	{0xF8E7, 0x24},
-	{0xF8E8, 0x95},
-	{0xF8E9, 0xff},
-	{0xF8EA, 0xe4},
-	{0xF8EB, 0x34},
-	{0xF8EC, 0xfb},
-	{0xF8ED, 0x8f},
-	{0xF8EE, 0x82},
-	{0xF8EF, 0xf5},
-	{0xF8F0, 0x83},
-	{0xF8F1, 0xe4},
-	{0xF8F2, 0x93},
-	{0xF8F3, 0xf5},
-	{0xF8F4, 0x7c},
-	{0xF8F5, 0xf5},
-	{0xF8F6, 0x7b},
-	{0xF8F7, 0xe4},
-	{0xF8F8, 0xf5},
-	{0xF8F9, 0x7a},
-	{0xF8FA, 0x75},
-	{0xF8FB, 0x78},
-	{0xF8FC, 0x30},
-	{0xF8FD, 0x75},
-	{0xF8FE, 0x79},
-	{0xF8FF, 0x53},
-	{0xF900, 0x85},
-	{0xF901, 0x79},
-	{0xF902, 0x82},
-	{0xF903, 0x85},
-	{0xF904, 0x78},
-	{0xF905, 0x83},
-	{0xF906, 0xe0},
-	{0xF907, 0x25},
-	{0xF908, 0x7c},
-	{0xF909, 0xf0},
-	{0xF90A, 0x74},
-	{0xF90B, 0x02},
-	{0xF90C, 0x25},
-	{0xF90D, 0x79},
-	{0xF90E, 0xf5},
-	{0xF90F, 0x79},
-	{0xF910, 0xe4},
-	{0xF911, 0x35},
-	{0xF912, 0x78},
-	{0xF913, 0xf5},
-	{0xF914, 0x78},
-	{0xF915, 0x05},
-	{0xF916, 0x7a},
-	{0xF917, 0xe5},
-	{0xF918, 0x7a},
-	{0xF919, 0xb4},
-	{0xF91A, 0x08},
-	{0xF91B, 0xe4},
-	{0xF91C, 0x02},
-	{0xF91D, 0x18},
-	{0xF91E, 0x32},
-	{0xF91F, 0x22},
-	{0xF920, 0xf0},
-	{0xF921, 0x90},
-	{0xF922, 0xa0},
-	{0xF923, 0xf8},
-	{0xF924, 0xe0},
-	{0xF925, 0x70},
-	{0xF926, 0x02},
-	{0xF927, 0xa3},
-	{0xF928, 0xe0},
-	{0xF929, 0x70},
-	{0xF92A, 0x0a},
-	{0xF92B, 0x90},
-	{0xF92C, 0xa1},
-	{0xF92D, 0x10},
-	{0xF92E, 0xe0},
-	{0xF92F, 0xfe},
-	{0xF930, 0xa3},
-	{0xF931, 0xe0},
-	{0xF932, 0xff},
-	{0xF933, 0x80},
-	{0xF934, 0x04},
-	{0xF935, 0x7e},
-	{0xF936, 0x00},
-	{0xF937, 0x7f},
-	{0xF938, 0x00},
-	{0xF939, 0x8e},
-	{0xF93A, 0x7e},
-	{0xF93B, 0x8f},
-	{0xF93C, 0x7f},
-	{0xF93D, 0x90},
-	{0xF93E, 0x36},
-	{0xF93F, 0x0d},
-	{0xF940, 0xe0},
-	{0xF941, 0x44},
-	{0xF942, 0x02},
-	{0xF943, 0xf0},
-	{0xF944, 0x90},
-	{0xF945, 0x36},
-	{0xF946, 0x0e},
-	{0xF947, 0xe5},
-	{0xF948, 0x7e},
-	{0xF949, 0xf0},
-	{0xF94A, 0xa3},
-	{0xF94B, 0xe5},
-	{0xF94C, 0x7f},
-	{0xF94D, 0xf0},
-	{0xF94E, 0xe5},
-	{0xF94F, 0x3a},
-	{0xF950, 0x60},
-	{0xF951, 0x0c},
-	{0xF952, 0x90},
-	{0xF953, 0x36},
-	{0xF954, 0x09},
-	{0xF955, 0xe0},
-	{0xF956, 0x70},
-	{0xF957, 0x06},
-	{0xF958, 0x90},
-	{0xF959, 0x36},
-	{0xF95A, 0x08},
-	{0xF95B, 0xf0},
-	{0xF95C, 0xf5},
-	{0xF95D, 0x3a},
-	{0xF95E, 0x02},
-	{0xF95F, 0x03},
-	{0xF960, 0x94},
-	{0xF961, 0x22},
-	{0xF962, 0x78},
-	{0xF963, 0x07},
-	{0xF964, 0xe6},
-	{0xF965, 0xd3},
-	{0xF966, 0x94},
-	{0xF967, 0x00},
-	{0xF968, 0x40},
-	{0xF969, 0x16},
-	{0xF96A, 0x16},
-	{0xF96B, 0xe6},
-	{0xF96C, 0x90},
-	{0xF96D, 0x30},
-	{0xF96E, 0xa1},
-	{0xF96F, 0xf0},
-	{0xF970, 0x90},
-	{0xF971, 0x43},
-	{0xF972, 0x83},
-	{0xF973, 0xe0},
-	{0xF974, 0xb4},
-	{0xF975, 0x01},
-	{0xF976, 0x0f},
-	{0xF977, 0x90},
-	{0xF978, 0x43},
-	{0xF979, 0x87},
-	{0xF97A, 0xe0},
-	{0xF97B, 0xb4},
-	{0xF97C, 0x01},
-	{0xF97D, 0x08},
-	{0xF97E, 0x80},
-	{0xF97F, 0x00},
-	{0xF980, 0x90},
-	{0xF981, 0x30},
-	{0xF982, 0xa0},
-	{0xF983, 0x74},
-	{0xF984, 0x01},
-	{0xF985, 0xf0},
-	{0xF986, 0x22},
-	{0xF987, 0xf0},
-	{0xF988, 0x90},
-	{0xF989, 0x35},
-	{0xF98A, 0xba},
-	{0xF98B, 0xe0},
-	{0xF98C, 0xb4},
-	{0xF98D, 0x0a},
-	{0xF98E, 0x0d},
-	{0xF98F, 0xa3},
-	{0xF990, 0xe0},
-	{0xF991, 0xb4},
-	{0xF992, 0x01},
-	{0xF993, 0x08},
-	{0xF994, 0x90},
-	{0xF995, 0xfb},
-	{0xF996, 0x94},
-	{0xF997, 0xe0},
-	{0xF998, 0x90},
-	{0xF999, 0x35},
-	{0xF99A, 0xb8},
-	{0xF99B, 0xf0},
-	{0xF99C, 0xd0},
-	{0xF99D, 0xd0},
-	{0xF99E, 0xd0},
-	{0xF99F, 0x82},
-	{0xF9A0, 0xd0},
-	{0xF9A1, 0x83},
-	{0xF9A2, 0xd0},
-	{0xF9A3, 0xe0},
-	{0xF9A4, 0x32},
-	{0xF9A5, 0x22},
-	{0xF9A6, 0xe5},
-	{0xF9A7, 0x7f},
-	{0xF9A8, 0x45},
-	{0xF9A9, 0x7e},
-	{0xF9AA, 0x60},
-	{0xF9AB, 0x15},
-	{0xF9AC, 0x90},
-	{0xF9AD, 0x01},
-	{0xF9AE, 0x00},
-	{0xF9AF, 0xe0},
-	{0xF9B0, 0x70},
-	{0xF9B1, 0x0f},
-	{0xF9B2, 0x90},
-	{0xF9B3, 0xa0},
-	{0xF9B4, 0xf8},
-	{0xF9B5, 0xe5},
-	{0xF9B6, 0x7e},
-	{0xF9B7, 0xf0},
-	{0xF9B8, 0xa3},
-	{0xF9B9, 0xe5},
-	{0xF9BA, 0x7f},
-	{0xF9BB, 0xf0},
-	{0xF9BC, 0xe4},
-	{0xF9BD, 0xf5},
-	{0xF9BE, 0x7e},
-	{0xF9BF, 0xf5},
-	{0xF9C0, 0x7f},
-	{0xF9C1, 0x22},
-	{0xF9C2, 0x02},
-	{0xF9C3, 0x0e},
-	{0xF9C4, 0x79},
-	{0xF9C5, 0x22},
-	/* Offsets:*/
-	{0x35C6, 0x00},/* FIDDLEDARKCAL*/
-	{0x35C7, 0x00},
-	{0x35C8, 0x01},/*STOREDISTANCEATSTOPSTREAMING*/
-	{0x35C9, 0x20},
-	{0x35CA, 0x01},/*BRUCEFIX*/
-	{0x35CB, 0x62},
-	{0x35CC, 0x01},/*FIXDATAXFERSTATUSREG*/
-	{0x35CD, 0x87},
-	{0x35CE, 0x01},/*FOCUSDISTANCEUPDATE*/
-	{0x35CF, 0xA6},
-	{0x35D0, 0x01},/*SKIPEDOFRESET*/
-	{0x35D1, 0xC2},
-	{0x35D2, 0x00},
-	{0x35D3, 0xFB},
-	{0x35D4, 0x00},
-	{0x35D5, 0x94},
-	{0x35D6, 0x00},
-	{0x35D7, 0xFB},
-	{0x35D8, 0x00},
-	{0x35D9, 0x94},
-	{0x35DA, 0x00},
-	{0x35DB, 0xFB},
-	{0x35DC, 0x00},
-	{0x35DD, 0x94},
-	{0x35DE, 0x00},
-	{0x35DF, 0xFB},
-	{0x35E0, 0x00},
-	{0x35E1, 0x94},
-	{0x35E6, 0x18},/* FIDDLEDARKCAL*/
-	{0x35E7, 0x2F},
-	{0x35E8, 0x03},/* STOREDISTANCEATSTOPSTREAMING*/
-	{0x35E9, 0x93},
-	{0x35EA, 0x18},/* BRUCEFIX*/
-	{0x35EB, 0x99},
-	{0x35EC, 0x00},/* FIXDATAXFERSTATUSREG*/
-	{0x35ED, 0xA3},
-	{0x35EE, 0x21},/* FOCUSDISTANCEUPDATE*/
-	{0x35EF, 0x5B},
-	{0x35F0, 0x0E},/* SKIPEDOFRESET*/
-	{0x35F1, 0x74},
-	{0x35F2, 0x04},
-	{0x35F3, 0x64},
-	{0x35F4, 0x04},
-	{0x35F5, 0x65},
-	{0x35F6, 0x04},
-	{0x35F7, 0x7B},
-	{0x35F8, 0x04},
-	{0x35F9, 0x7C},
-	{0x35FA, 0x04},
-	{0x35FB, 0xDD},
-	{0x35FC, 0x04},
-	{0x35FD, 0xDE},
-	{0x35FE, 0x04},
-	{0x35FF, 0xEF},
-	{0x3600, 0x04},
-	{0x3601, 0xF0},
-	/*Jump/Data:*/
-	{0x35C2, 0x3F},/* Jump Reg*/
-	{0x35C3, 0xFF},/* Jump Reg*/
-	{0x35C4, 0x3F},/* Data Reg*/
-	{0x35C5, 0xC0},/* Data Reg*/
-	{0x35C0, 0x01},/* Enable*/
-	/* end of patch cut 2 */
-	/* common settings */
-	{0x0112, 10},/*REG = 0x0112 , 10 bit */
-	{0x0113, 10},/*REG = 0x0113*/
-	{0x0301, 9},/*REG = 0x0301 vt_pix_clk_div*/
-	{0x0305, 4},/*REG = 0x0305 pre_pll_clk_div*/
-	{0x0307, 133},/*REG = 0x0307 pll_multiplier*/
-	{0x0309, 10},/*REG = 0x0309 op_pix_clk_div*/
-	{0x3030, 0x08},/*REG = 0x3030*/
-	{0x0111, 0x02},/*REG = 0x0111*/
-	{0x0b00, 0x01},/*REG = 0x0b00 ,lens shading off */
-	{0x3001, 0x30},/*REG = 0x3001*/
-	{0x3004, 0x33},/*REG = 0x3004*/
-	{0x3007, 0x09},/*REG = 0x3007*/
-	{0x3016, 0x1F},/*REG = 0x3016*/
-	{0x301d, 0x03},/*REG = 0x301d*/
-	{0x317E, 0x11},/*REG = 0x317E*/
-	{0x317F, 0x09},/*REG = 0x317F*/
-	{0x3400, 0x38},/*REG = 0x3400*/
-	{0x0b06, 0x00},/*REG_0x0b06*/
-	{0x0b07, 0x80},/*REG_0x0b07*/
-	{0x0b08, 0x01},/*REG_0x0b08*/
-	{0x0b09, 0x4F},/*REG_0x0b09*/
-	{0x0136, 0x18},/*REG_0x0136*/
-	{0x0137, 0x00},/*/REG_0x0137*/
-	{0x0b83, 0x20},/*REG = 0x0b83*/
-	{0x0b84, 0x90},/*REG = 0x0b84*/
-	{0x0b85, 0x20},/*REG = 0x0b85*/
-	{0x0b88, 0x80},/*REG = 0x0b88*/
-	{0x0b89, 0x00},/*REG = 0x0b89*/
-	{0x0b8a, 0x00},/*REG = 0x0b8a*/
-	/* end of common settings */
-};
-
-static struct v4l2_subdev_info vx6953_subdev_info[] = {
-	{
-	.code   = V4L2_MBUS_FMT_SGRBG10_1X10,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	},
-	/* more can be supported, to be added later */
-};
-
-static struct msm_camera_i2c_conf_array vx6953_init_conf[] = {
-	{&vx6953_recommend_settings[0],
-	ARRAY_SIZE(vx6953_recommend_settings), 0, MSM_CAMERA_I2C_BYTE_DATA}
-};
-
-static struct msm_camera_i2c_conf_array vx6953_confs[] = {
-	{&vx6953_snap_settings[0],
-	ARRAY_SIZE(vx6953_snap_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-	{&vx6953_prev_settings[0],
-	ARRAY_SIZE(vx6953_prev_settings), 0, MSM_CAMERA_I2C_BYTE_DATA},
-};
-
-static struct msm_sensor_output_info_t vx6953_dimensions[] = {
-	{
-		.x_output = 0xA30,
-		.y_output = 0x7A8,
-		.line_length_pclk = 0xB8C,
-		.frame_length_lines = 0x7D0,
-		.vt_pixel_clk = 88666666,
-		.op_pixel_clk = 192000000,
-		.binning_factor = 1,
-	},
-	{
-		.x_output = 0x518,
-		.y_output = 0x3D4,
-		.line_length_pclk = 0xB74,
-		.frame_length_lines = 0x3F0,
-		.vt_pixel_clk = 88666666,
-		.op_pixel_clk = 192000000,
-		.binning_factor = 1,
-	},
-};
-
-static struct msm_sensor_output_reg_addr_t vx6953_reg_addr = {
-	.x_output = 0x034C,
-	.y_output = 0x034E,
-	.line_length_pclk = 0x0342,
-	.frame_length_lines = 0x0340,
-};
-
-static struct msm_sensor_id_info_t vx6953_id_info = {
-	.sensor_id_reg_addr = 0x0000,
-	.sensor_id = 0x03B9,
-};
-
-static struct msm_sensor_exp_gain_info_t vx6953_exp_gain_info = {
-	.coarse_int_time_addr = 0x0202,
-	.global_gain_addr = 0x0204,
-	.vert_offset = 9,
-};
-
-static const struct i2c_device_id vx6953_i2c_id[] = {
-	{SENSOR_NAME, (kernel_ulong_t)&vx6953_s_ctrl},
-	{ }
-};
-
-static struct i2c_driver vx6953_i2c_driver = {
-	.id_table = vx6953_i2c_id,
-	.probe  = msm_sensor_i2c_probe,
-	.driver = {
-		.name = SENSOR_NAME,
-	},
-};
-
-static struct msm_camera_i2c_client vx6953_sensor_i2c_client = {
-	.addr_type = MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-static int __init msm_sensor_init_module(void)
-{
-	return i2c_add_driver(&vx6953_i2c_driver);
-}
-
-static int32_t vx6953_set_fps(struct msm_sensor_ctrl_t *s_ctrl,
-	struct fps_cfg *fps) {
-	return 0;
-}
-
-int32_t vx6953_write_exp_gain(struct msm_sensor_ctrl_t *s_ctrl,
-	uint16_t gain, uint32_t line) {
-	return 0;
-}
-
-static struct v4l2_subdev_core_ops vx6953_subdev_core_ops = {
-	.ioctl = msm_sensor_subdev_ioctl,
-	.s_power = msm_sensor_power,
-};
-
-static struct v4l2_subdev_video_ops vx6953_subdev_video_ops = {
-	.enum_mbus_fmt = msm_sensor_v4l2_enum_fmt,
-};
-
-static struct v4l2_subdev_ops vx6953_subdev_ops = {
-	.core = &vx6953_subdev_core_ops,
-	.video  = &vx6953_subdev_video_ops,
-};
-
-static struct msm_camera_i2c_reg_conf vx6953_edof_estimation[] = {
-	{REG_0x0b80, 0x02},
-};
-
-static struct msm_camera_i2c_reg_conf vx6953_edof_application[] = {
-	{REG_0x0b80, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf vx6953_edof_default[] = {
-	{REG_0x0b80, 0x00},
-};
-
-static int vx6953_enable_edof(enum edof_mode_t edof_mode)
-{
-	int rc = 0;
-	if (edof_mode == VX6953_EDOF_ESTIMATION) {
-		/* EDof Estimation mode for preview */
-		msm_camera_i2c_write_tbl(
-			vx6953_s_ctrl.sensor_i2c_client,
-			vx6953_edof_estimation,
-			ARRAY_SIZE(vx6953_edof_estimation),
-			vx6953_s_ctrl.msm_sensor_reg->default_data_type);
-		CDBG("VX6953_EDOF_ESTIMATION");
-	} else if (edof_mode == VX6953_EDOF_APPLICATION) {
-		/* EDof Application mode for Capture */
-		msm_camera_i2c_write_tbl(
-			vx6953_s_ctrl.sensor_i2c_client,
-			vx6953_edof_application,
-			ARRAY_SIZE(vx6953_edof_application),
-			vx6953_s_ctrl.msm_sensor_reg->default_data_type);
-		CDBG("VX6953_EDOF_APPLICATION");
-	} else {
-		/* EDOF disabled */
-		msm_camera_i2c_write_tbl(
-			vx6953_s_ctrl.sensor_i2c_client,
-			vx6953_edof_default,
-			ARRAY_SIZE(vx6953_edof_default),
-			vx6953_s_ctrl.msm_sensor_reg->default_data_type);
-		CDBG("VX6953_EDOF_DISABLE");
-	}
-	return rc;
-}
-
-static struct msm_camera_i2c_reg_conf vx6953_standby[] = {
-	{0x103, 0x01},
-};
-
-static struct msm_camera_i2c_reg_conf patch_tbl_cut2[] = {
-	{0xFB94, 0},	/*intialise Data Xfer Status reg*/
-	{0xFB95, 0},	/*gain 1	  (0x00)*/
-	{0xFB96, 0},	/*gain 1.07   (0x10)*/
-	{0xFB97, 0},	/*gain 1.14   (0x20)*/
-	{0xFB98, 0},	/*gain 1.23   (0x30)*/
-	{0xFB99, 0},	/*gain 1.33   (0x40)*/
-	{0xFB9A, 0},	/*gain 1.45   (0x50)*/
-	{0xFB9B, 0},	/*gain 1.6    (0x60)*/
-	{0xFB9C, 0},	/*gain 1.78   (0x70)*/
-	{0xFB9D, 2},	/*gain 2	  (0x80)*/
-	{0xFB9E, 2},	/*gain 2.29   (0x90)*/
-	{0xFB9F, 3},	/*gain 2.67   (0xA0)*/
-	{0xFBA0, 3},	/*gain 3.2    (0xB0)*/
-	{0xFBA1, 4},	/*gain 4	  (0xC0)*/
-	{0xFBA2, 7},	/*gain 5.33   (0xD0)*/
-	{0xFBA3, 10},	/*gain 8	  (0xE0)*/
-	{0xFBA4, 11},	/*gain 9.14   (0xE4)*/
-	{0xFBA5, 13},	/*gain 10.67  (0xE8)*/
-	{0xFBA6, 15},	/*gain 12.8   (0xEC)*/
-	{0xFBA7, 19},	/*gain 16     (0xF0)*/
-	{0xF800, 0x12},
-	{0xF801, 0x06},
-	{0xF802, 0xf7},
-	{0xF803, 0x90},
-	{0xF804, 0x02},
-	{0xF805, 0x05},
-	{0xF806, 0xe0},
-	{0xF807, 0xff},
-	{0xF808, 0x65},
-	{0xF809, 0x7d},
-	{0xF80A, 0x70},
-	{0xF80B, 0x03},
-	{0xF80C, 0x02},
-	{0xF80D, 0xf9},
-	{0xF80E, 0x1c},
-	{0xF80F, 0x8f},
-	{0xF810, 0x7d},
-	{0xF811, 0xe4},
-	{0xF812, 0xf5},
-	{0xF813, 0x7a},
-	{0xF814, 0x75},
-	{0xF815, 0x78},
-	{0xF816, 0x30},
-	{0xF817, 0x75},
-	{0xF818, 0x79},
-	{0xF819, 0x53},
-	{0xF81A, 0x85},
-	{0xF81B, 0x79},
-	{0xF81C, 0x82},
-	{0xF81D, 0x85},
-	{0xF81E, 0x78},
-	{0xF81F, 0x83},
-	{0xF820, 0xe0},
-	{0xF821, 0xc3},
-	{0xF822, 0x95},
-	{0xF823, 0x7b},
-	{0xF824, 0xf0},
-	{0xF825, 0x74},
-	{0xF826, 0x02},
-	{0xF827, 0x25},
-	{0xF828, 0x79},
-	{0xF829, 0xf5},
-	{0xF82A, 0x79},
-	{0xF82B, 0xe4},
-	{0xF82C, 0x35},
-	{0xF82D, 0x78},
-	{0xF82E, 0xf5},
-	{0xF82F, 0x78},
-	{0xF830, 0x05},
-	{0xF831, 0x7a},
-	{0xF832, 0xe5},
-	{0xF833, 0x7a},
-	{0xF834, 0xb4},
-	{0xF835, 0x08},
-	{0xF836, 0xe3},
-	{0xF837, 0xe5},
-	{0xF838, 0x7d},
-	{0xF839, 0x70},
-	{0xF83A, 0x04},
-	{0xF83B, 0xff},
-	{0xF83C, 0x02},
-	{0xF83D, 0xf8},
-	{0xF83E, 0xe4},
-	{0xF83F, 0xe5},
-	{0xF840, 0x7d},
-	{0xF841, 0xb4},
-	{0xF842, 0x10},
-	{0xF843, 0x05},
-	{0xF844, 0x7f},
-	{0xF845, 0x01},
-	{0xF846, 0x02},
-	{0xF847, 0xf8},
-	{0xF848, 0xe4},
-	{0xF849, 0xe5},
-	{0xF84A, 0x7d},
-	{0xF84B, 0xb4},
-	{0xF84C, 0x20},
-	{0xF84D, 0x05},
-	{0xF84E, 0x7f},
-	{0xF84F, 0x02},
-	{0xF850, 0x02},
-	{0xF851, 0xf8},
-	{0xF852, 0xe4},
-	{0xF853, 0xe5},
-	{0xF854, 0x7d},
-	{0xF855, 0xb4},
-	{0xF856, 0x30},
-	{0xF857, 0x05},
-	{0xF858, 0x7f},
-	{0xF859, 0x03},
-	{0xF85A, 0x02},
-	{0xF85B, 0xf8},
-	{0xF85C, 0xe4},
-	{0xF85D, 0xe5},
-	{0xF85E, 0x7d},
-	{0xF85F, 0xb4},
-	{0xF860, 0x40},
-	{0xF861, 0x04},
-	{0xF862, 0x7f},
-	{0xF863, 0x04},
-	{0xF864, 0x80},
-	{0xF865, 0x7e},
-	{0xF866, 0xe5},
-	{0xF867, 0x7d},
-	{0xF868, 0xb4},
-	{0xF869, 0x50},
-	{0xF86A, 0x04},
-	{0xF86B, 0x7f},
-	{0xF86C, 0x05},
-	{0xF86D, 0x80},
-	{0xF86E, 0x75},
-	{0xF86F, 0xe5},
-	{0xF870, 0x7d},
-	{0xF871, 0xb4},
-	{0xF872, 0x60},
-	{0xF873, 0x04},
-	{0xF874, 0x7f},
-	{0xF875, 0x06},
-	{0xF876, 0x80},
-	{0xF877, 0x6c},
-	{0xF878, 0xe5},
-	{0xF879, 0x7d},
-	{0xF87A, 0xb4},
-	{0xF87B, 0x70},
-	{0xF87C, 0x04},
-	{0xF87D, 0x7f},
-	{0xF87E, 0x07},
-	{0xF87F, 0x80},
-	{0xF880, 0x63},
-	{0xF881, 0xe5},
-	{0xF882, 0x7d},
-	{0xF883, 0xb4},
-	{0xF884, 0x80},
-	{0xF885, 0x04},
-	{0xF886, 0x7f},
-	{0xF887, 0x08},
-	{0xF888, 0x80},
-	{0xF889, 0x5a},
-	{0xF88A, 0xe5},
-	{0xF88B, 0x7d},
-	{0xF88C, 0xb4},
-	{0xF88D, 0x90},
-	{0xF88E, 0x04},
-	{0xF88F, 0x7f},
-	{0xF890, 0x09},
-	{0xF891, 0x80},
-	{0xF892, 0x51},
-	{0xF893, 0xe5},
-	{0xF894, 0x7d},
-	{0xF895, 0xb4},
-	{0xF896, 0xa0},
-	{0xF897, 0x04},
-	{0xF898, 0x7f},
-	{0xF899, 0x0a},
-	{0xF89A, 0x80},
-	{0xF89B, 0x48},
-	{0xF89C, 0xe5},
-	{0xF89D, 0x7d},
-	{0xF89E, 0xb4},
-	{0xF89F, 0xb0},
-	{0xF8A0, 0x04},
-	{0xF8A1, 0x7f},
-	{0xF8A2, 0x0b},
-	{0xF8A3, 0x80},
-	{0xF8A4, 0x3f},
-	{0xF8A5, 0xe5},
-	{0xF8A6, 0x7d},
-	{0xF8A7, 0xb4},
-	{0xF8A8, 0xc0},
-	{0xF8A9, 0x04},
-	{0xF8AA, 0x7f},
-	{0xF8AB, 0x0c},
-	{0xF8AC, 0x80},
-	{0xF8AD, 0x36},
-	{0xF8AE, 0xe5},
-	{0xF8AF, 0x7d},
-	{0xF8B0, 0xb4},
-	{0xF8B1, 0xd0},
-	{0xF8B2, 0x04},
-	{0xF8B3, 0x7f},
-	{0xF8B4, 0x0d},
-	{0xF8B5, 0x80},
-	{0xF8B6, 0x2d},
-	{0xF8B7, 0xe5},
-	{0xF8B8, 0x7d},
-	{0xF8B9, 0xb4},
-	{0xF8BA, 0xe0},
-	{0xF8BB, 0x04},
-	{0xF8BC, 0x7f},
-	{0xF8BD, 0x0e},
-	{0xF8BE, 0x80},
-	{0xF8BF, 0x24},
-	{0xF8C0, 0xe5},
-	{0xF8C1, 0x7d},
-	{0xF8C2, 0xb4},
-	{0xF8C3, 0xe4},
-	{0xF8C4, 0x04},
-	{0xF8C5, 0x7f},
-	{0xF8C6, 0x0f},
-	{0xF8C7, 0x80},
-	{0xF8C8, 0x1b},
-	{0xF8C9, 0xe5},
-	{0xF8CA, 0x7d},
-	{0xF8CB, 0xb4},
-	{0xF8CC, 0xe8},
-	{0xF8CD, 0x04},
-	{0xF8CE, 0x7f},
-	{0xF8CF, 0x10},
-	{0xF8D0, 0x80},
-	{0xF8D1, 0x12},
-	{0xF8D2, 0xe5},
-	{0xF8D3, 0x7d},
-	{0xF8D4, 0xb4},
-	{0xF8D5, 0xec},
-	{0xF8D6, 0x04},
-	{0xF8D7, 0x7f},
-	{0xF8D8, 0x11},
-	{0xF8D9, 0x80},
-	{0xF8DA, 0x09},
-	{0xF8DB, 0xe5},
-	{0xF8DC, 0x7d},
-	{0xF8DD, 0x7f},
-	{0xF8DE, 0x00},
-	{0xF8DF, 0xb4},
-	{0xF8E0, 0xf0},
-	{0xF8E1, 0x02},
-	{0xF8E2, 0x7f},
-	{0xF8E3, 0x12},
-	{0xF8E4, 0x8f},
-	{0xF8E5, 0x7c},
-	{0xF8E6, 0xef},
-	{0xF8E7, 0x24},
-	{0xF8E8, 0x95},
-	{0xF8E9, 0xff},
-	{0xF8EA, 0xe4},
-	{0xF8EB, 0x34},
-	{0xF8EC, 0xfb},
-	{0xF8ED, 0x8f},
-	{0xF8EE, 0x82},
-	{0xF8EF, 0xf5},
-	{0xF8F0, 0x83},
-	{0xF8F1, 0xe4},
-	{0xF8F2, 0x93},
-	{0xF8F3, 0xf5},
-	{0xF8F4, 0x7c},
-	{0xF8F5, 0xf5},
-	{0xF8F6, 0x7b},
-	{0xF8F7, 0xe4},
-	{0xF8F8, 0xf5},
-	{0xF8F9, 0x7a},
-	{0xF8FA, 0x75},
-	{0xF8FB, 0x78},
-	{0xF8FC, 0x30},
-	{0xF8FD, 0x75},
-	{0xF8FE, 0x79},
-	{0xF8FF, 0x53},
-	{0xF900, 0x85},
-	{0xF901, 0x79},
-	{0xF902, 0x82},
-	{0xF903, 0x85},
-	{0xF904, 0x78},
-	{0xF905, 0x83},
-	{0xF906, 0xe0},
-	{0xF907, 0x25},
-	{0xF908, 0x7c},
-	{0xF909, 0xf0},
-	{0xF90A, 0x74},
-	{0xF90B, 0x02},
-	{0xF90C, 0x25},
-	{0xF90D, 0x79},
-	{0xF90E, 0xf5},
-	{0xF90F, 0x79},
-	{0xF910, 0xe4},
-	{0xF911, 0x35},
-	{0xF912, 0x78},
-	{0xF913, 0xf5},
-	{0xF914, 0x78},
-	{0xF915, 0x05},
-	{0xF916, 0x7a},
-	{0xF917, 0xe5},
-	{0xF918, 0x7a},
-	{0xF919, 0xb4},
-	{0xF91A, 0x08},
-	{0xF91B, 0xe4},
-	{0xF91C, 0x02},
-	{0xF91D, 0x18},
-	{0xF91E, 0x32},
-	{0xF91F, 0x22},
-	{0xF920, 0xf0},
-	{0xF921, 0x90},
-	{0xF922, 0xa0},
-	{0xF923, 0xf8},
-	{0xF924, 0xe0},
-	{0xF925, 0x70},
-	{0xF926, 0x02},
-	{0xF927, 0xa3},
-	{0xF928, 0xe0},
-	{0xF929, 0x70},
-	{0xF92A, 0x0a},
-	{0xF92B, 0x90},
-	{0xF92C, 0xa1},
-	{0xF92D, 0x10},
-	{0xF92E, 0xe0},
-	{0xF92F, 0xfe},
-	{0xF930, 0xa3},
-	{0xF931, 0xe0},
-	{0xF932, 0xff},
-	{0xF933, 0x80},
-	{0xF934, 0x04},
-	{0xF935, 0x7e},
-	{0xF936, 0x00},
-	{0xF937, 0x7f},
-	{0xF938, 0x00},
-	{0xF939, 0x8e},
-	{0xF93A, 0x7e},
-	{0xF93B, 0x8f},
-	{0xF93C, 0x7f},
-	{0xF93D, 0x90},
-	{0xF93E, 0x36},
-	{0xF93F, 0x0d},
-	{0xF940, 0xe0},
-	{0xF941, 0x44},
-	{0xF942, 0x02},
-	{0xF943, 0xf0},
-	{0xF944, 0x90},
-	{0xF945, 0x36},
-	{0xF946, 0x0e},
-	{0xF947, 0xe5},
-	{0xF948, 0x7e},
-	{0xF949, 0xf0},
-	{0xF94A, 0xa3},
-	{0xF94B, 0xe5},
-	{0xF94C, 0x7f},
-	{0xF94D, 0xf0},
-	{0xF94E, 0xe5},
-	{0xF94F, 0x3a},
-	{0xF950, 0x60},
-	{0xF951, 0x0c},
-	{0xF952, 0x90},
-	{0xF953, 0x36},
-	{0xF954, 0x09},
-	{0xF955, 0xe0},
-	{0xF956, 0x70},
-	{0xF957, 0x06},
-	{0xF958, 0x90},
-	{0xF959, 0x36},
-	{0xF95A, 0x08},
-	{0xF95B, 0xf0},
-	{0xF95C, 0xf5},
-	{0xF95D, 0x3a},
-	{0xF95E, 0x02},
-	{0xF95F, 0x03},
-	{0xF960, 0x94},
-	{0xF961, 0x22},
-	{0xF962, 0x78},
-	{0xF963, 0x07},
-	{0xF964, 0xe6},
-	{0xF965, 0xd3},
-	{0xF966, 0x94},
-	{0xF967, 0x00},
-	{0xF968, 0x40},
-	{0xF969, 0x16},
-	{0xF96A, 0x16},
-	{0xF96B, 0xe6},
-	{0xF96C, 0x90},
-	{0xF96D, 0x30},
-	{0xF96E, 0xa1},
-	{0xF96F, 0xf0},
-	{0xF970, 0x90},
-	{0xF971, 0x43},
-	{0xF972, 0x83},
-	{0xF973, 0xe0},
-	{0xF974, 0xb4},
-	{0xF975, 0x01},
-	{0xF976, 0x0f},
-	{0xF977, 0x90},
-	{0xF978, 0x43},
-	{0xF979, 0x87},
-	{0xF97A, 0xe0},
-	{0xF97B, 0xb4},
-	{0xF97C, 0x01},
-	{0xF97D, 0x08},
-	{0xF97E, 0x80},
-	{0xF97F, 0x00},
-	{0xF980, 0x90},
-	{0xF981, 0x30},
-	{0xF982, 0xa0},
-	{0xF983, 0x74},
-	{0xF984, 0x01},
-	{0xF985, 0xf0},
-	{0xF986, 0x22},
-	{0xF987, 0xf0},
-	{0xF988, 0x90},
-	{0xF989, 0x35},
-	{0xF98A, 0xba},
-	{0xF98B, 0xe0},
-	{0xF98C, 0xb4},
-	{0xF98D, 0x0a},
-	{0xF98E, 0x0d},
-	{0xF98F, 0xa3},
-	{0xF990, 0xe0},
-	{0xF991, 0xb4},
-	{0xF992, 0x01},
-	{0xF993, 0x08},
-	{0xF994, 0x90},
-	{0xF995, 0xfb},
-	{0xF996, 0x94},
-	{0xF997, 0xe0},
-	{0xF998, 0x90},
-	{0xF999, 0x35},
-	{0xF99A, 0xb8},
-	{0xF99B, 0xf0},
-	{0xF99C, 0xd0},
-	{0xF99D, 0xd0},
-	{0xF99E, 0xd0},
-	{0xF99F, 0x82},
-	{0xF9A0, 0xd0},
-	{0xF9A1, 0x83},
-	{0xF9A2, 0xd0},
-	{0xF9A3, 0xe0},
-	{0xF9A4, 0x32},
-	{0xF9A5, 0x22},
-	{0xF9A6, 0xe5},
-	{0xF9A7, 0x7f},
-	{0xF9A8, 0x45},
-	{0xF9A9, 0x7e},
-	{0xF9AA, 0x60},
-	{0xF9AB, 0x15},
-	{0xF9AC, 0x90},
-	{0xF9AD, 0x01},
-	{0xF9AE, 0x00},
-	{0xF9AF, 0xe0},
-	{0xF9B0, 0x70},
-	{0xF9B1, 0x0f},
-	{0xF9B2, 0x90},
-	{0xF9B3, 0xa0},
-	{0xF9B4, 0xf8},
-	{0xF9B5, 0xe5},
-	{0xF9B6, 0x7e},
-	{0xF9B7, 0xf0},
-	{0xF9B8, 0xa3},
-	{0xF9B9, 0xe5},
-	{0xF9BA, 0x7f},
-	{0xF9BB, 0xf0},
-	{0xF9BC, 0xe4},
-	{0xF9BD, 0xf5},
-	{0xF9BE, 0x7e},
-	{0xF9BF, 0xf5},
-	{0xF9C0, 0x7f},
-	{0xF9C1, 0x22},
-	{0xF9C2, 0x02},
-	{0xF9C3, 0x0e},
-	{0xF9C4, 0x79},
-	{0xF9C5, 0x22},
-	/* Offsets:*/
-	{0x35C6, 0x00},/* FIDDLEDARKCAL*/
-	{0x35C7, 0x00},
-	{0x35C8, 0x01},/*STOREDISTANCEATSTOPSTREAMING*/
-	{0x35C9, 0x20},
-	{0x35CA, 0x01},/*BRUCEFIX*/
-	{0x35CB, 0x62},
-	{0x35CC, 0x01},/*FIXDATAXFERSTATUSREG*/
-	{0x35CD, 0x87},
-	{0x35CE, 0x01},/*FOCUSDISTANCEUPDATE*/
-	{0x35CF, 0xA6},
-	{0x35D0, 0x01},/*SKIPEDOFRESET*/
-	{0x35D1, 0xC2},
-	{0x35D2, 0x00},
-	{0x35D3, 0xFB},
-	{0x35D4, 0x00},
-	{0x35D5, 0x94},
-	{0x35D6, 0x00},
-	{0x35D7, 0xFB},
-	{0x35D8, 0x00},
-	{0x35D9, 0x94},
-	{0x35DA, 0x00},
-	{0x35DB, 0xFB},
-	{0x35DC, 0x00},
-	{0x35DD, 0x94},
-	{0x35DE, 0x00},
-	{0x35DF, 0xFB},
-	{0x35E0, 0x00},
-	{0x35E1, 0x94},
-	{0x35E6, 0x18},/* FIDDLEDARKCAL*/
-	{0x35E7, 0x2F},
-	{0x35E8, 0x03},/* STOREDISTANCEATSTOPSTREAMING*/
-	{0x35E9, 0x93},
-	{0x35EA, 0x18},/* BRUCEFIX*/
-	{0x35EB, 0x99},
-	{0x35EC, 0x00},/* FIXDATAXFERSTATUSREG*/
-	{0x35ED, 0xA3},
-	{0x35EE, 0x21},/* FOCUSDISTANCEUPDATE*/
-	{0x35EF, 0x5B},
-	{0x35F0, 0x0E},/* SKIPEDOFRESET*/
-	{0x35F1, 0x74},
-	{0x35F2, 0x04},
-	{0x35F3, 0x64},
-	{0x35F4, 0x04},
-	{0x35F5, 0x65},
-	{0x35F6, 0x04},
-	{0x35F7, 0x7B},
-	{0x35F8, 0x04},
-	{0x35F9, 0x7C},
-	{0x35FA, 0x04},
-	{0x35FB, 0xDD},
-	{0x35FC, 0x04},
-	{0x35FD, 0xDE},
-	{0x35FE, 0x04},
-	{0x35FF, 0xEF},
-	{0x3600, 0x04},
-	{0x3601, 0xF0},
-	/*Jump/Data:*/
-	{0x35C2, 0x3F},/* Jump Reg*/
-	{0x35C3, 0xFF},/* Jump Reg*/
-	{0x35C4, 0x3F},/* Data Reg*/
-	{0x35C5, 0xC0},/* Data Reg*/
-	{0x35C0, 0x01},/* Enable*/
-};
-struct msm_camera_i2c_reg_conf init_tbl[] = {
-	{0x0112, 10},
-	{0x0113, 10},
-	{0x0301, 9},
-	{0x0305, 4},
-	{0x0307, 133},
-	{0x0309, 10},
-	{0x0202, 0x03},
-	{0x0203, 0xd0},
-	{0x0205, 0xc0},
-	{0x3030, 0x08},
-	{0x0111, 0x02},
-	{0x0b00, 0x01},
-	{0x3001, 0x30},
-	{0x3004, 0x33},
-	{0x3007, 0x09},
-	{0x3016, 0x1F},
-	{0x301d, 0x03},
-	{0x317e, 0x11},
-	{0x317f, 0x09},
-	{0x3400, 0x38},
-	{0x0b06, 0x00},
-	{0x0b07, 0x80},
-	{0x0b08, 0x01},
-	{0x0b09, 0x4F},
-	{0x0136, 0x18},
-	{0x0137, 0x00},
-	{0x0b83, 0x20},
-	{0x0b84, 0x90},
-	{0x0b85, 0x20},
-	{0x0b88, 0x80},
-	{0x0b89, 0x00},
-	{0x0b8a, 0x00},
-	{0x0340, 0x03},   /*REG = 0x0340 frame_length_lines_hi*/
-	{0x0341, 0xf0},   /*REG = 0x0341 frame_length_lines_lo*/
-	{0x0342, 0x0b},   /*REG = 0x0342  line_length_pck_hi*/
-	{0x0343, 0x74},   /*REG = 0x0343  line_length_pck_lo*/
-	{0x3005, 0x03},   /*REG = 0x3005*/
-	{0x3010, 0x00},   /*REG = 0x3010*/
-	{0x3011, 0x01},   /*REG = 0x3011*/
-	{0x301a, 0x6a},   /*REG = 0x301a*/
-	{0x3035, 0x03},   /*REG = 0x3035*/
-	{0x3036, 0x2c},   /*REG = 0x3036*/
-	{0x3041, 0x00},   /*REG = 0x3041*/
-	{0x3042, 0x24},   /*REG = 0x3042*/
-	{0x3045, 0x81},   /*REG = 0x3045*/
-	{0x0b80, 0x02},   /*REG = 0x0b80 edof estimate*/
-	{0x0900, 0x01},   /*REG = 0x0900*/
-	{0x0901, 0x22},   /*REG = 0x0901*/
-	{0x0902, 0x04},   /*REG = 0x0902*/
-	{0x0383, 0x03},   /*REG = 0x0383*/
-	{0x0387, 0x03},   /*REG = 0x0387*/
-	{0x034c, 0x05},   /*REG = 0x034c*/
-	{0x034d, 0x18},   /*REG = 0x034d*/
-	{0x034e, 0x03},   /*REG = 0x034e*/
-	{0x034f, 0xd4},   /*REG = 0x034f*/
-	{0x1716, 0x02},   /*0x1716*/
-	{0x1717, 0x04},   /*0x1717*/
-	{0x1718, 0x08},   /*0x1718*/
-	{0x1719, 0x2c},   /*0x1719*/
-};
-
-struct msm_camera_i2c_reg_conf mode_tbl1[] = {
-	{REG_0x0112, 10},/*REG = 0x0112 , 10 bit */
-	{REG_0x0113, 10},/*REG = 0x0113*/
-	{REG_VT_PIX_CLK_DIV, 9},/*REG = 0x0301 vt_pix_clk_div*/
-	{REG_PRE_PLL_CLK_DIV, 4},/*REG = 0x0305 pre_pll_clk_div*/
-	{REG_PLL_MULTIPLIER, 133},/*REG = 0x0307 pll_multiplier*/
-	{REG_OP_PIX_CLK_DIV, 10},/*REG = 0x0309 op_pix_clk_div*/
-	{REG_FRAME_LENGTH_LINES_HI, 0x03},/*REG = 0x0340 frame_length_lines_hi*/
-	{REG_FRAME_LENGTH_LINES_LO, 0xf0},/*REG = 0x0341 frame_length_lines_lo*/
-	{REG_LINE_LENGTH_PCK_HI, 0x0b},   /*REG = 0x0342  line_length_pck_hi*/
-	{REG_LINE_LENGTH_PCK_LO, 0x74},   /*REG = 0x0343  line_length_pck_lo*/
-	{REG_0x3005, 0x03},   /*REG = 0x3005*/
-	{0x3010, 0x00},   /*REG = 0x3010*/
-	{REG_0x3011, 0x01},   /*REG = 0x3011*/
-	{REG_0x301a, 0x6a},   /*REG = 0x301a*/
-	{REG_0x3035, 0x03},   /*REG = 0x3035*/
-	{REG_0x3036, 0x2c},   /*REG = 0x3036*/
-	{REG_0x3041, 0x00},   /*REG = 0x3041*/
-	{0x3042, 0x24},   /*REG = 0x3042*/
-	{REG_0x3045, 0x81},   /*REG = 0x3045*/
-	{REG_0x0b80, 0x02},   /*REG = 0x0b80 edof estimate*/
-	{REG_0x0900, 0x01},   /*REG = 0x0900*/
-	{REG_0x0901, 0x22},   /*REG = 0x0901*/
-	{REG_0x0902, 0x04},   /*REG = 0x0902*/
-	{REG_0x0383, 0x03},   /*REG = 0x0383*/
-	{REG_0x0387, 0x03},   /*REG = 0x0387*/
-	{REG_0x034c, 0x05},   /*REG = 0x034c*/
-	{REG_0x034d, 0x18},   /*REG = 0x034d*/
-	{REG_0x034e, 0x03},   /*REG = 0x034e*/
-	{REG_0x034f, 0xd4},   /*REG = 0x034f*/
-	{REG_0x1716, 0x02},   /*0x1716*/
-	{REG_0x1717, 0x04},   /*0x1717*/
-	{REG_0x1718, 0x08},   /*0x1718*/
-	{REG_0x1719, 0x2c},   /*0x1719*/
-};
-
-struct msm_camera_i2c_reg_conf mode_tbl2[] = {
-	{REG_0x0112, 10},/*REG = 0x0112 , 10 bit */
-	{REG_0x0113, 10},/*REG = 0x0113*/
-	{REG_VT_PIX_CLK_DIV, 9},/*REG = 0x0301 vt_pix_clk_div*/
-	{REG_PRE_PLL_CLK_DIV, 4},/*REG = 0x0305 pre_pll_clk_div*/
-	{REG_PLL_MULTIPLIER, 133},/*REG = 0x0307 pll_multiplier*/
-	{REG_OP_PIX_CLK_DIV, 10},/*REG = 0x0309 op_pix_clk_div*/
-	{REG_FRAME_LENGTH_LINES_HI, 0x07},/*REG = 0x0340 frame_length_lines_hi*/
-	{REG_FRAME_LENGTH_LINES_LO, 0xd0},/*REG = 0x0341 frame_length_lines_lo*/
-	{REG_LINE_LENGTH_PCK_HI, 0x0b},/*REG = 0x0342 line_length_pck_hi*/
-	{REG_LINE_LENGTH_PCK_LO, 0x8c},/*REG = 0x0343 line_length_pck_lo*/
-	{REG_0x3005, 0x01},/*REG = 0x3005*/
-	{0x3010, 0x00},/*REG = 0x3010*/
-	{REG_0x3011, 0x00},/*REG = 0x3011*/
-	{REG_0x301a, 0x55},/*REG = 0x301a*/
-	{REG_0x3035, 0x01},/*REG = 0x3035*/
-	{REG_0x3036, 0x23},/*REG = 0x3036*/
-	{REG_0x3041, 0x00},/*REG = 0x3041*/
-	{0x3042, 0x24},/*REG = 0x3042*/
-	{REG_0x3045, 0xb7},/*REG = 0x3045*/
-	{REG_0x0b80, 0x01},/*REG = 0x0b80 edof application*/
-	{REG_0x0900, 0x00},/*REG = 0x0900*/
-	{REG_0x0901, 0x00},/*REG = 0x0901*/
-	{REG_0x0902, 0x00},/*REG = 0x0902*/
-	{REG_0x0383, 0x01},/*REG = 0x0383*/
-	{REG_0x0387, 0x01},/*REG = 0x0387*/
-	{REG_0x034c, 0x0A},/*REG = 0x034c*/
-	{REG_0x034d, 0x30},/*REG = 0x034d*/
-	{REG_0x034e, 0x07},/*REG = 0x034e*/
-	{REG_0x034f, 0xA8},/*REG = 0x034f*/
-	{REG_0x1716, 0x02},/*0x1716*/
-	{REG_0x1717, 0x0d},/*0x1717*/
-	{REG_0x1718, 0x07},/*0x1718*/
-	{REG_0x1719, 0x7d},/*0x1719*/
-};
-
-static int32_t vx6953_sensor_setting(int update_type, int rt)
-{
-
-	int32_t rc = 0;
-	uint16_t frame_cnt = 0;
-		CDBG("%s update type = %d, rt = %d\n",
-			__func__, update_type, rt);
-
-		switch (update_type) {
-		case REG_INIT:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-						/* reset fps_divider */
-			fps = 30 * Q8;
-			/* stop streaming */
-
-			/* Reset everything first */
-			msm_camera_i2c_write_tbl(
-				vx6953_s_ctrl.sensor_i2c_client,
-				vx6953_standby,
-				ARRAY_SIZE(vx6953_standby),
-				vx6953_s_ctrl.msm_sensor_reg->
-				default_data_type);
-
-			msleep(20);
-
-			CDBG("Init vx6953_sensor_setting standby\n");
-			msm_camera_i2c_write_tbl(
-				vx6953_s_ctrl.sensor_i2c_client,
-				vx6953_stop_settings,
-				ARRAY_SIZE(vx6953_stop_settings),
-				vx6953_s_ctrl.msm_sensor_reg->
-				default_data_type);
-				/*vx6953_stm5m0edof_delay_msecs_stdby*/
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-			msm_camera_i2c_write_tbl(
-				vx6953_s_ctrl.sensor_i2c_client,
-				patch_tbl_cut2,
-				ARRAY_SIZE(patch_tbl_cut2),
-				vx6953_s_ctrl.msm_sensor_reg->
-				default_data_type);
-			msm_camera_i2c_write_tbl(
-				vx6953_s_ctrl.sensor_i2c_client,
-				init_tbl,
-				ARRAY_SIZE(init_tbl),
-				vx6953_s_ctrl.msm_sensor_reg->
-				default_data_type);
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-		}
-		return rc;
-		case UPDATE_PERIODIC:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct msm_camera_i2c_reg_conf init_mode_tbl[] =  {
-			{REG_0x0112,
-				vx6953_regs.reg_pat_init[0].reg_0x0112},
-			{REG_0x0113,
-				vx6953_regs.reg_pat_init[0].reg_0x0113},
-			{REG_VT_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				vt_pix_clk_div},
-			{REG_PRE_PLL_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER,
-				vx6953_regs.reg_pat_init[0].
-				pll_multiplier},
-			{REG_OP_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				op_pix_clk_div},
-			{REG_COARSE_INTEGRATION_TIME_HI,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_hi},
-			{REG_COARSE_INTEGRATION_TIME_LO,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_lo},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-				vx6953_regs.reg_pat[rt].
-				analogue_gain_code_global},
-			{REG_0x3030,
-				vx6953_regs.reg_pat_init[0].reg_0x3030},
-			/* 953 specific registers */
-			{REG_0x0111,
-				vx6953_regs.reg_pat_init[0].reg_0x0111},
-			{REG_0x0b00,
-				vx6953_regs.reg_pat_init[0].reg_0x0b00},
-			{REG_0x3001,
-				vx6953_regs.reg_pat_init[0].reg_0x3001},
-			{REG_0x3004,
-				vx6953_regs.reg_pat_init[0].reg_0x3004},
-			{REG_0x3007,
-				vx6953_regs.reg_pat_init[0].reg_0x3007},
-			{REG_0x3016,
-				vx6953_regs.reg_pat_init[0].reg_0x3016},
-			{REG_0x301d,
-				vx6953_regs.reg_pat_init[0].reg_0x301d},
-			{REG_0x317e,
-				vx6953_regs.reg_pat_init[0].reg_0x317e},
-			{REG_0x317f,
-				vx6953_regs.reg_pat_init[0].reg_0x317f},
-			{REG_0x3400,
-				vx6953_regs.reg_pat_init[0].reg_0x3400},
-			{0x0b06,
-				vx6953_regs.reg_pat_init[0].reg_0x0b06},
-			/*Single_defect_correct_weight = auto*/
-			{0x0b07,
-				vx6953_regs.reg_pat_init[0].reg_0x0b07},
-			/*Dynamic couplet correction ENABLED*/
-			{0x0b08,
-				vx6953_regs.reg_pat_init[0].reg_0x0b08},
-			/*Dynamic couplet correction weight*/
-			{0x0b09,
-				vx6953_regs.reg_pat_init[0].reg_0x0b09},
-			/* Clock Setup */
-			/* Tell sensor ext clk is 24MHz*/
-			{0x0136,
-				vx6953_regs.reg_pat_init[0].reg_0x0136},
-			{0x0137,
-				vx6953_regs.reg_pat_init[0].reg_0x0137},
-			/* The white balance gains must be written
-			to the sensor every frame. */
-			/* Edof */
-			{REG_0x0b83,
-				vx6953_regs.reg_pat_init[0].reg_0x0b83},
-			{REG_0x0b84,
-				vx6953_regs.reg_pat_init[0].reg_0x0b84},
-			{0x0b85,
-				vx6953_regs.reg_pat_init[0].reg_0x0b85},
-			{0x0b88,
-				vx6953_regs.reg_pat_init[0].reg_0x0b88},
-			{0x0b89,
-				vx6953_regs.reg_pat_init[0].reg_0x0b89},
-			{REG_0x0b8a,
-				vx6953_regs.reg_pat_init[0].reg_0x0b8a},
-			/* Mode specific regieters */
-			{REG_FRAME_LENGTH_LINES_HI,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_hi},
-			{REG_FRAME_LENGTH_LINES_LO,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_lo},
-			{REG_LINE_LENGTH_PCK_HI,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_hi},
-			{REG_LINE_LENGTH_PCK_LO,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_lo},
-			{REG_0x3005,
-				vx6953_regs.reg_pat[rt].reg_0x3005},
-			{0x3010,
-				vx6953_regs.reg_pat[rt].reg_0x3010},
-			{REG_0x3011,
-				vx6953_regs.reg_pat[rt].reg_0x3011},
-			{REG_0x301a,
-				vx6953_regs.reg_pat[rt].reg_0x301a},
-			{REG_0x3035,
-				vx6953_regs.reg_pat[rt].reg_0x3035},
-			{REG_0x3036,
-				vx6953_regs.reg_pat[rt].reg_0x3036},
-			{REG_0x3041,
-				vx6953_regs.reg_pat[rt].reg_0x3041},
-			{0x3042,
-				vx6953_regs.reg_pat[rt].reg_0x3042},
-			{REG_0x3045,
-				vx6953_regs.reg_pat[rt].reg_0x3045},
-			/*EDOF: Estimation settings for Preview mode
-			Application settings for capture mode
-			(standard settings - Not tuned) */
-			{REG_0x0b80,
-				vx6953_regs.reg_pat[rt].reg_0x0b80},
-			{REG_0x0900,
-				vx6953_regs.reg_pat[rt].reg_0x0900},
-			{REG_0x0901,
-				vx6953_regs.reg_pat[rt].reg_0x0901},
-			{REG_0x0902,
-				vx6953_regs.reg_pat[rt].reg_0x0902},
-			{REG_0x0383,
-				vx6953_regs.reg_pat[rt].reg_0x0383},
-			{REG_0x0387,
-				vx6953_regs.reg_pat[rt].reg_0x0387},
-			/* Change output size / frame rate */
-			{REG_0x034c,
-				vx6953_regs.reg_pat[rt].reg_0x034c},
-			{REG_0x034d,
-				vx6953_regs.reg_pat[rt].reg_0x034d},
-			{REG_0x034e,
-				vx6953_regs.reg_pat[rt].reg_0x034e},
-			{REG_0x034f,
-				vx6953_regs.reg_pat[rt].reg_0x034f},
-			{REG_0x1716,
-				vx6953_regs.reg_pat[rt].reg_0x1716},
-			{REG_0x1717,
-				vx6953_regs.reg_pat[rt].reg_0x1717},
-			{REG_0x1718,
-				vx6953_regs.reg_pat[rt].reg_0x1718},
-			{REG_0x1719,
-				vx6953_regs.reg_pat[rt].reg_0x1719},
-			};
-			/* stop streaming */
-			msleep(20);
-
-			/* Reset everything first */
-			msm_camera_i2c_write_tbl(
-				vx6953_s_ctrl.sensor_i2c_client,
-				vx6953_standby,
-				ARRAY_SIZE(vx6953_standby),
-				vx6953_s_ctrl.msm_sensor_reg->
-				default_data_type);
-
-
-			msleep(20);
-
-			msm_camera_i2c_write_tbl(
-				vx6953_s_ctrl.sensor_i2c_client,
-				vx6953_stop_settings,
-				ARRAY_SIZE(vx6953_stop_settings),
-				vx6953_s_ctrl.msm_sensor_reg->
-				default_data_type);
-			/*vx6953_stm5m0edof_delay_msecs_stdby*/
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			msm_camera_i2c_write_tbl(
-				vx6953_s_ctrl.sensor_i2c_client,
-				patch_tbl_cut2,
-				ARRAY_SIZE(patch_tbl_cut2),
-				vx6953_s_ctrl.msm_sensor_reg->
-				default_data_type);
-
-			msm_camera_i2c_write_tbl(
-				vx6953_s_ctrl.sensor_i2c_client,
-				init_mode_tbl,
-				ARRAY_SIZE(init_mode_tbl),
-				vx6953_s_ctrl.msm_sensor_reg->
-				default_data_type);
-
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-			if (rt == RES_PREVIEW) {
-				CDBG("%s write mode_tbl for preview\n",
-					__func__);
-				msm_camera_i2c_write_tbl(
-					vx6953_s_ctrl.sensor_i2c_client,
-					mode_tbl1,
-					ARRAY_SIZE(mode_tbl1),
-					vx6953_s_ctrl.msm_sensor_reg->
-					default_data_type);
-			} else if (rt == RES_CAPTURE) {
-				CDBG("%s write mode_tbl for capture\n",
-					__func__);
-				msm_camera_i2c_write_tbl(
-					vx6953_s_ctrl.sensor_i2c_client,
-					mode_tbl2,
-					ARRAY_SIZE(mode_tbl2),
-					vx6953_s_ctrl.msm_sensor_reg->
-					default_data_type);
-			}
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			/* Start sensor streaming */
-			msm_camera_i2c_write_tbl(
-				vx6953_s_ctrl.sensor_i2c_client,
-				vx6953_start_settings,
-				ARRAY_SIZE(vx6953_start_settings),
-				vx6953_s_ctrl.msm_sensor_reg->
-				default_data_type);
-			msleep(20);
-
-			msm_camera_i2c_read(
-				vx6953_s_ctrl.sensor_i2c_client,
-				0x0005,
-				&frame_cnt,
-				MSM_CAMERA_I2C_BYTE_ADDR);
-			while (frame_cnt == 0xFF) {
-				msm_camera_i2c_read(
-					vx6953_s_ctrl.sensor_i2c_client,
-					0x0005,
-					&frame_cnt,
-					MSM_CAMERA_I2C_BYTE_ADDR);
-				CDBG("%s frame_cnt = %d\n",
-					__func__, frame_cnt);
-				usleep_range(5000, 10000);
-			}
-		}
-		return rc;
-		default:
-		return rc;
-	}
-	return rc;
-}
-
-static int32_t vx6953_init_config(void)
-{
-	int32_t rc = 0;
-	int rt;
-	/* change sensor resolution	if needed */
-	CDBG("%s called\n", __func__);
-	rt = RES_PREVIEW;
-	vx6953_stm5m0edof_delay_msecs_stdby =
-		((((2 * 1000 * fps_divider) /
-		   fps) * Q8) / Q10) + 1;
-
-	vx6953_sensor_setting(REG_INIT, rt);
-
-	vx6953_enable_edof(VX6953_EDOF_ESTIMATION);
-	return rc;
-}
-
-static int32_t vx6953_update_config(int rt)
-{
-	int32_t rc = 0;
-	CDBG("%s rt = %d\n", __func__, rt);
-	if (rt == MSM_SENSOR_RES_FULL)
-		rt = RES_CAPTURE;
-	else if (rt == MSM_SENSOR_RES_QTR)
-		rt = RES_PREVIEW;
-
-	vx6953_stm5m0edof_delay_msecs_stdby = 67;
-	vx6953_sensor_setting(UPDATE_PERIODIC, rt);
-
-	if (rt == RES_PREVIEW)
-		vx6953_enable_edof(VX6953_EDOF_ESTIMATION);
-	else if (rt == RES_CAPTURE)
-		vx6953_enable_edof(VX6953_EDOF_APPLICATION);
-
-	return rc;
-} /*end of vx6953_snapshot_config*/
-
-static int32_t vx6953_set_sensor_mode(struct msm_sensor_ctrl_t *s_ctrl,
-	int update_type, int rt)
-{
-	int32_t rc = 0;
-
-	fps_divider = 1 * 0x00000400;
-	fps = 30*Q8;
-
-	switch (update_type) {
-	case MSM_SENSOR_REG_INIT:
-		rc = vx6953_init_config();
-		break;
-	case MSM_SENSOR_UPDATE_PERIODIC:
-		rc = vx6953_update_config(rt);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-static struct msm_sensor_fn_t vx6953_func_tbl = {
-	.sensor_start_stream = msm_sensor_start_stream,
-	.sensor_stop_stream = msm_sensor_stop_stream,
-	.sensor_group_hold_on = msm_sensor_group_hold_on,
-	.sensor_group_hold_off = msm_sensor_group_hold_off,
-	.sensor_set_fps = vx6953_set_fps,
-	.sensor_write_exp_gain = vx6953_write_exp_gain,
-	.sensor_write_snapshot_exp_gain = vx6953_write_exp_gain,
-	.sensor_csi_setting = vx6953_set_sensor_mode,
-	.sensor_set_sensor_mode = msm_sensor_set_sensor_mode,
-	.sensor_mode_init = msm_sensor_mode_init,
-	.sensor_get_output_info = msm_sensor_get_output_info,
-	.sensor_config = msm_sensor_config,
-	.sensor_power_up = msm_sensor_power_up,
-	.sensor_power_down = msm_sensor_power_down,
-};
-
-static struct msm_sensor_reg_t vx6953_data_regs = {
-	.default_data_type = MSM_CAMERA_I2C_BYTE_DATA,
-	.start_stream_conf = vx6953_start_settings,
-	.start_stream_conf_size = ARRAY_SIZE(vx6953_start_settings),
-	.stop_stream_conf = vx6953_stop_settings,
-	.stop_stream_conf_size = ARRAY_SIZE(vx6953_stop_settings),
-	.group_hold_on_conf = vx6953_groupon_settings,
-	.group_hold_on_conf_size = ARRAY_SIZE(vx6953_groupon_settings),
-	.group_hold_off_conf = vx6953_groupoff_settings,
-	.group_hold_off_conf_size =
-		ARRAY_SIZE(vx6953_groupoff_settings),
-	.init_settings = &vx6953_init_conf[0],
-	.init_size = ARRAY_SIZE(vx6953_init_conf),
-	.mode_settings = &vx6953_confs[0],
-	.output_settings = &vx6953_dimensions[0],
-	.num_conf = ARRAY_SIZE(vx6953_confs),
-};
-
-static struct msm_sensor_ctrl_t vx6953_s_ctrl = {
-	.msm_sensor_reg = &vx6953_data_regs,
-	.sensor_i2c_client = &vx6953_sensor_i2c_client,
-	.sensor_i2c_addr = 0x20,
-	.sensor_output_reg_addr = &vx6953_reg_addr,
-	.sensor_id_info = &vx6953_id_info,
-	.sensor_exp_gain_info = &vx6953_exp_gain_info,
-	.cam_mode = MSM_SENSOR_MODE_INVALID,
-	.msm_sensor_mutex = &vx6953_mut,
-	.sensor_i2c_driver = &vx6953_i2c_driver,
-	.sensor_v4l2_subdev_info = vx6953_subdev_info,
-	.sensor_v4l2_subdev_info_size = ARRAY_SIZE(vx6953_subdev_info),
-	.sensor_v4l2_subdev_ops = &vx6953_subdev_ops,
-	.func_tbl = &vx6953_func_tbl,
-	.clk_rate = MSM_SENSOR_MCLK_24HZ,
-};
-
-module_init(msm_sensor_init_module);
-MODULE_DESCRIPTION("Sensor VX6953 (BAYER 5M)");
-MODULE_LICENSE("GPL v2");
-
diff --git a/drivers/media/video/msm/sensors/vx6953.h b/drivers/media/video/msm/sensors/vx6953.h
deleted file mode 100644
index 2fc2a19..0000000
--- a/drivers/media/video/msm/sensors/vx6953.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef VX6953_H
-#define VX6953_H
-#include <linux/types.h>
-#include <mach/board.h>
-struct reg_struct_init {
-	uint8_t reg_0x0112;      /* 0x0112*/
-	uint8_t reg_0x0113;      /* 0x0113*/
-	uint8_t vt_pix_clk_div;  /* 0x0301*/
-	uint8_t pre_pll_clk_div; /* 0x0305*/
-	uint8_t pll_multiplier;  /* 0x0307*/
-	uint8_t op_pix_clk_div;  /* 0x0309*/
-	uint8_t reg_0x3030;      /*0x3030*/
-	uint8_t reg_0x0111;      /*0x0111*/
-	uint8_t reg_0x0b00;      /*0x0b00*/
-	uint8_t reg_0x3001;      /*0x3001*/
-	uint8_t reg_0x3004;      /*0x3004*/
-	uint8_t reg_0x3007;      /*0x3007*/
-	uint8_t reg_0x3016;      /*0x3016*/
-	uint8_t reg_0x301d;      /*0x301d*/
-	uint8_t reg_0x317e;      /*0x317E*/
-	uint8_t reg_0x317f;      /*0x317F*/
-	uint8_t reg_0x3400;      /*0x3400*/
-	uint8_t reg_0x0b06;      /*0x0b06*/
-	uint8_t reg_0x0b07;      /*0x0b07*/
-	uint8_t reg_0x0b08;      /*0x0b08*/
-	uint8_t reg_0x0b09;      /*0x0b09*/
-	uint8_t reg_0x0136;
-	uint8_t reg_0x0137;
-	/* Edof */
-	uint8_t reg_0x0b83;      /*0x0b83*/
-	uint8_t reg_0x0b84;      /*0x0b84*/
-	uint8_t reg_0x0b85;      /*0x0b85*/
-	uint8_t reg_0x0b88;      /*0x0b88*/
-	uint8_t reg_0x0b89;      /*0x0b89*/
-	uint8_t reg_0x0b8a;      /*0x0b8a*/
-	};
-struct reg_struct {
-	uint8_t coarse_integration_time_hi; /*REG_COARSE_INTEGRATION_TIME_HI*/
-	uint8_t coarse_integration_time_lo; /*REG_COARSE_INTEGRATION_TIME_LO*/
-	uint8_t analogue_gain_code_global;
-	uint8_t frame_length_lines_hi; /* 0x0340*/
-	uint8_t frame_length_lines_lo; /* 0x0341*/
-	uint8_t line_length_pck_hi;    /* 0x0342*/
-	uint8_t line_length_pck_lo;    /* 0x0343*/
-	uint8_t reg_0x3005;   /* 0x3005*/
-	uint8_t reg_0x3010;  /* 0x3010*/
-	uint8_t reg_0x3011;  /* 0x3011*/
-	uint8_t reg_0x301a;  /* 0x301a*/
-	uint8_t reg_0x3035;  /* 0x3035*/
-	uint8_t reg_0x3036;   /* 0x3036*/
-	uint8_t reg_0x3041;  /*0x3041*/
-	uint8_t reg_0x3042;  /*0x3042*/
-	uint8_t reg_0x3045;  /*0x3045*/
-	uint8_t reg_0x0b80;   /* 0x0b80*/
-	uint8_t reg_0x0900;   /*0x0900*/
-	uint8_t reg_0x0901;   /* 0x0901*/
-	uint8_t reg_0x0902;   /*0x0902*/
-	uint8_t reg_0x0383;   /*0x0383*/
-	uint8_t reg_0x0387;   /* 0x0387*/
-	uint8_t reg_0x034c;   /* 0x034c*/
-	uint8_t reg_0x034d;   /*0x034d*/
-	uint8_t reg_0x034e;   /* 0x034e*/
-	uint8_t reg_0x034f;   /* 0x034f*/
-	uint8_t reg_0x1716; /*0x1716*/
-	uint8_t reg_0x1717; /*0x1717*/
-	uint8_t reg_0x1718; /*0x1718*/
-	uint8_t reg_0x1719; /*0x1719*/
-	uint8_t reg_0x3210;/*0x3210*/
-	uint8_t reg_0x111; /*0x111*/
-	uint8_t reg_0x3410;  /*0x3410*/
-	uint8_t reg_0x3098;
-	uint8_t reg_0x309D;
-	uint8_t reg_0x0200;
-	uint8_t reg_0x0201;
-	};
-struct vx6953_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-enum vx6953_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum vx6953_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-enum vx6953_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-enum mt9p012_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-enum sensor_revision_t {
-	VX6953_STM5M0EDOF_CUT_1,
-	VX6953_STM5M0EDOF_CUT_2,
-	VX6953_STM5M0EDOF_CUT_3
-};
-enum edof_mode_t {
-	VX6953_EDOF_DISABLE,       /* 0x00 */
-	VX6953_EDOF_APPLICATION,   /* 0x01 */
-	VX6953_EDOF_ESTIMATION     /* 0x02 */
-};
-struct vx6953_reg {
-	const struct reg_struct_init  *reg_pat_init;
-	const struct reg_struct  *reg_pat;
-};
-#endif /* VX6953_H */
diff --git a/drivers/media/video/msm/sensors/vx6953_reg.h b/drivers/media/video/msm/sensors/vx6953_reg.h
deleted file mode 100644
index fe99be5..0000000
--- a/drivers/media/video/msm/sensors/vx6953_reg.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-
-struct reg_struct_init vx6953_reg_init[1] = {
-	{
-		10,			/*REG = 0x0112 , 10 bit */
-		10,			/*REG = 0x0113*/
-		9,			/*REG = 0x0301 vt_pix_clk_div*/
-		4,		/*REG = 0x0305 pre_pll_clk_div*/
-		133,		/*REG = 0x0307 pll_multiplier*/
-		10,		/*REG = 0x0309 op_pix_clk_div*/
-		0x08,		/*REG = 0x3030*/
-		0x02,		/*REG = 0x0111*/
-		0x01,		/*REG = 0x0b00 ,lens shading off */
-		0x30,		/*REG = 0x3001*/
-		0x33,		/*REG = 0x3004*/
-		0x09,		/*REG = 0x3007*/
-		0x1F,		/*REG = 0x3016*/
-		0x03,		/*REG = 0x301d*/
-		0x11,		/*REG = 0x317E*/
-		0x09,		/*REG = 0x317F*/
-		0x38,		/*REG = 0x3400*/
-		0x00,		/*REG_0x0b06*/
-		0x80,		/*REG_0x0b07*/
-		0x01,		/*REG_0x0b08*/
-		0x4F,		/*REG_0x0b09*/
-		0x18,		/*REG_0x0136*/
-		0x00,		/*/REG_0x0137*/
-		0x20,		/*REG = 0x0b83*/
-		0x90,		/*REG = 0x0b84*/
-		0x20,		/*REG = 0x0b85*/
-		0x80,		/*REG = 0x0b88*/
-		0x00,		/*REG = 0x0b89*/
-		0x00,		/*REG = 0x0b8a*/
-	}
-};
-struct reg_struct vx6953_reg_pat[2] = {
-	{/* Preview */
-		0x03,	/*REG = 0x0202 coarse integration_time_hi*/
-		0xd0,	/*REG = 0x0203 coarse_integration_time_lo*/
-		0xc0,	/*REG = 0x0205 analogue_gain_code_global*/
-		0x03,	/*REG = 0x0340 frame_length_lines_hi*/
-		0xf0,	/*REG = 0x0341 frame_length_lines_lo*/
-		0x0b,	/*REG = 0x0342  line_length_pck_hi*/
-		0x74,	/*REG = 0x0343  line_length_pck_lo*/
-		0x03,	/*REG = 0x3005*/
-		0x00,	/*REG = 0x3010*/
-		0x01,	/*REG = 0x3011*/
-		0x6a,	/*REG = 0x301a*/
-		0x03,	/*REG = 0x3035*/
-		0x2c,	/*REG = 0x3036*/
-		0x00,	/*REG = 0x3041*/
-		0x24,	/*REG = 0x3042*/
-		0x81,	/*REG = 0x3045*/
-		0x02,	/*REG = 0x0b80 edof estimate*/
-		0x01,	/*REG = 0x0900*/
-		0x22,	/*REG = 0x0901*/
-		0x04,	/*REG = 0x0902*/
-		0x03,	/*REG = 0x0383*/
-		0x03,	/*REG = 0x0387*/
-		0x05,	/*REG = 0x034c*/
-		0x18,	/*REG = 0x034d*/
-		0x03,	/*REG = 0x034e*/
-		0xd4,	/*REG = 0x034f*/
-		0x02,	/*0x1716*/
-		0x04,	/*0x1717*/
-		0x08,	/*0x1718*/
-		0x2c,	/*0x1719*/
-		0x01,   /*0x3210*/
-		0x02,   /*0x111*/
-		0x01,   /*0x3410*/
-		0x01,   /*0x3098*/
-		0x05,   /*0x309D*/
-		0x02,
-		0x04,
-	},
-	{ /* Snapshot */
-		0x07,/*REG = 0x0202 coarse_integration_time_hi*/
-		0x00,/*REG = 0x0203 coarse_integration_time_lo*/
-		0xc0,/*REG = 0x0205 analogue_gain_code_global*/
-		0x07,/*REG = 0x0340 frame_length_lines_hi*/
-		0xd0,/*REG = 0x0341 frame_length_lines_lo*/
-		0x0b,/*REG = 0x0342 line_length_pck_hi*/
-		0x8c,/*REG = 0x0343 line_length_pck_lo*/
-		0x01,/*REG = 0x3005*/
-		0x00,/*REG = 0x3010*/
-		0x00,/*REG = 0x3011*/
-		0x55,/*REG = 0x301a*/
-		0x01,/*REG = 0x3035*/
-		0x23,/*REG = 0x3036*/
-		0x00,/*REG = 0x3041*/
-		0x24,/*REG = 0x3042*/
-		0xb7,/*REG = 0x3045*/
-		0x01,/*REG = 0x0b80 edof application*/
-		0x00,/*REG = 0x0900*/
-		0x00,/*REG = 0x0901*/
-		0x00,/*REG = 0x0902*/
-		0x01,/*REG = 0x0383*/
-		0x01,/*REG = 0x0387*/
-		0x0A,/*REG = 0x034c*/
-		0x30,/*REG = 0x034d*/
-		0x07,/*REG = 0x034e*/
-		0xA8,/*REG = 0x034f*/
-		0x02,/*0x1716*/
-		0x0d,/*0x1717*/
-		0x07,/*0x1718*/
-		0x7d,/*0x1719*/
-		0x01,/*0x3210*/
-		0x02,/*0x111*/
-		0x01,/*0x3410*/
-		0x01,/*0x3098*/
-		0x05, /*0x309D*/
-		0x02,
-		0x00,
-	}
-};
-
-
-
-struct vx6953_reg vx6953_regs = {
-	.reg_pat_init = &vx6953_reg_init[0],
-	.reg_pat = &vx6953_reg_pat[0],
-};
diff --git a/drivers/media/video/msm/server/Makefile b/drivers/media/video/msm/server/Makefile
deleted file mode 100644
index 55abeed..0000000
--- a/drivers/media/video/msm/server/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-
-ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
-  EXTRA_CFLAGS += -Idrivers/media/video/msm
-  EXTRA_CFLAGS += -Idrivers/media/video/msm/io
-  EXTRA_CFLAGS += -Idrivers/media/video/msm/csi
-  EXTRA_CFLAGS += -Idrivers/media/video/msm/eeprom
-  EXTRA_CFLAGS += -Idrivers/media/video/msm/sensors
-  EXTRA_CFLAGS += -Idrivers/media/video/msm/actuators
-  obj-$(CONFIG_MSM_CAMERA)   += msm_cam_server.o
-endif
diff --git a/drivers/media/video/msm/server/msm_cam_server.c b/drivers/media/video/msm/server/msm_cam_server.c
deleted file mode 100644
index 4bda7a3..0000000
--- a/drivers/media/video/msm/server/msm_cam_server.c
+++ /dev/null
@@ -1,3286 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/of.h>
-#include "msm_cam_server.h"
-#include "msm_csid.h"
-#include "msm_csic.h"
-#include "msm_csiphy.h"
-#include "msm_ispif.h"
-#include "msm_sensor.h"
-#include "msm_actuator.h"
-#include "msm_csi_register.h"
-
-#ifdef CONFIG_MSM_CAMERA_DEBUG
-#define D(fmt, args...) pr_debug("msm: " fmt, ##args)
-#else
-#define D(fmt, args...) do {} while (0)
-#endif
-
-static struct msm_cam_server_dev g_server_dev;
-static struct class *msm_class;
-static dev_t msm_devno;
-
-static long msm_server_send_v4l2_evt(void *evt);
-static void msm_cam_server_subdev_notify(struct v4l2_subdev *sd,
-	unsigned int notification, void *arg);
-
-void msm_queue_init(struct msm_device_queue *queue, const char *name)
-{
-	D("%s\n", __func__);
-	spin_lock_init(&queue->lock);
-	queue->len = 0;
-	queue->max = 0;
-	queue->name = name;
-	INIT_LIST_HEAD(&queue->list);
-	init_waitqueue_head(&queue->wait);
-}
-
-void msm_enqueue(struct msm_device_queue *queue,
-			struct list_head *entry)
-{
-	unsigned long flags;
-	spin_lock_irqsave(&queue->lock, flags);
-	queue->len++;
-	if (queue->len > queue->max) {
-		queue->max = queue->len;
-		pr_info("%s: queue %s new max is %d\n", __func__,
-			queue->name, queue->max);
-	}
-	list_add_tail(entry, &queue->list);
-	wake_up(&queue->wait);
-	D("%s: woke up %s\n", __func__, queue->name);
-	spin_unlock_irqrestore(&queue->lock, flags);
-}
-
-void msm_drain_eventq(struct msm_device_queue *queue)
-{
-	unsigned long flags;
-	struct msm_queue_cmd *qcmd;
-	struct msm_isp_event_ctrl *isp_event;
-	spin_lock_irqsave(&queue->lock, flags);
-	while (!list_empty(&queue->list)) {
-		qcmd = list_first_entry(&queue->list,
-			struct msm_queue_cmd, list_eventdata);
-		list_del_init(&qcmd->list_eventdata);
-		isp_event =
-			(struct msm_isp_event_ctrl *)
-			qcmd->command;
-		if (isp_event->isp_data.ctrl.value != NULL)
-			kfree(isp_event->isp_data.ctrl.value);
-		kfree(qcmd->command);
-		free_qcmd(qcmd);
-	}
-	spin_unlock_irqrestore(&queue->lock, flags);
-}
-
-int32_t msm_find_free_queue(void)
-{
-	int i;
-	for (i = 0; i < MAX_NUM_ACTIVE_CAMERA; i++) {
-		struct msm_cam_server_queue *queue;
-		queue = &g_server_dev.server_queue[i];
-		if (!queue->queue_active)
-			return i;
-	}
-	return -EINVAL;
-}
-
-void msm_setup_v4l2_event_queue(struct v4l2_fh *eventHandle,
-	struct video_device *pvdev)
-{
-	v4l2_fh_init(eventHandle, pvdev);
-	v4l2_fh_add(eventHandle);
-}
-
-void msm_destroy_v4l2_event_queue(struct v4l2_fh *eventHandle)
-{
-	v4l2_fh_del(eventHandle);
-	v4l2_fh_exit(eventHandle);
-}
-
-int msm_cam_server_config_interface_map(u32 extendedmode,
-	uint32_t mctl_handle, int vnode_id, int is_bayer_sensor)
-{
-	int i = 0;
-	int rc = 0;
-	int old_handle;
-	int interface;
-
-	if (vnode_id >= MAX_NUM_ACTIVE_CAMERA) {
-		pr_err("%s: invalid msm_dev node id = %d", __func__, vnode_id);
-		return -EINVAL;
-	}
-	D("%s: extendedmode = %d, vnode_id = %d, is_bayer_sensor = %d",
-		__func__, extendedmode, vnode_id, is_bayer_sensor);
-	switch (extendedmode) {
-	case MSM_V4L2_EXT_CAPTURE_MODE_RDI:
-		interface = RDI_0;
-		break;
-	case MSM_V4L2_EXT_CAPTURE_MODE_RDI1:
-		interface = RDI_1;
-		break;
-	case MSM_V4L2_EXT_CAPTURE_MODE_RDI2:
-		interface = RDI_2;
-		break;
-	default:
-		interface = PIX_0;
-		break;
-	}
-
-	for (i = 0; i < INTF_MAX; i++) {
-		if (g_server_dev.interface_map_table[i].interface ==
-							interface) {
-			if (is_bayer_sensor && interface == PIX_0) {
-				if (g_server_dev.
-					interface_map_table[i].mctl_handle &&
-					!g_server_dev.interface_map_table[i].
-						is_bayer_sensor) {
-					/* in simultaneous camera usecase
-					 * SoC does not use PIX interface */
-					g_server_dev.interface_map_table[i].
-						mctl_handle = 0;
-				}
-			}
-			if (!is_bayer_sensor && interface == PIX_0) {
-				if (g_server_dev.
-					interface_map_table[i].mctl_handle &&
-					g_server_dev.interface_map_table[i].
-						is_bayer_sensor) {
-					/* in simultaneous camera usecase
-					 * SoC does not use PIX interface */
-					break;
-				}
-			}
-			old_handle =
-				g_server_dev.interface_map_table[i].mctl_handle;
-			if (old_handle == 0) {
-				g_server_dev.interface_map_table[i].mctl_handle
-					= mctl_handle;
-				g_server_dev.interface_map_table[i].
-					is_bayer_sensor = is_bayer_sensor;
-				g_server_dev.interface_map_table[i].vnode_id
-					= vnode_id;
-			} else {
-				if (!g_server_dev.interface_map_table[i].
-					is_bayer_sensor &&
-					(extendedmode ==
-					MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW ||
-					extendedmode ==
-					MSM_V4L2_EXT_CAPTURE_MODE_VIDEO ||
-					extendedmode ==
-					MSM_V4L2_EXT_CAPTURE_MODE_MAIN ||
-					extendedmode ==
-					MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL)) {
-					D("%s: SoC sensor, image_mode = %d",
-					__func__, extendedmode);
-					break;
-				}
-				if (old_handle != mctl_handle) {
-					pr_err("%s: iface_map[%d] is set: %d\n",
-						__func__, i, old_handle);
-					rc = -EINVAL;
-				}
-			}
-			break;
-			}
-	}
-
-	if (i == INTF_MAX)
-		rc = -EINVAL;
-	return rc;
-}
-
-void msm_cam_server_clear_interface_map(uint32_t mctl_handle)
-{
-	int i;
-	for (i = 0; i < INTF_MAX; i++)
-		if (g_server_dev.interface_map_table[i].
-			mctl_handle == mctl_handle)
-			g_server_dev.interface_map_table[i].
-				mctl_handle = 0;
-}
-
-struct iommu_domain *msm_cam_server_get_domain()
-{
-	return g_server_dev.domain;
-}
-
-int msm_cam_server_get_domain_num()
-{
-	return g_server_dev.domain_num;
-}
-
-uint32_t msm_cam_server_get_mctl_handle(void)
-{
-	uint32_t i;
-	if ((g_server_dev.mctl_handle_cnt << 8) == 0)
-		g_server_dev.mctl_handle_cnt++;
-	for (i = 0; i < MAX_NUM_ACTIVE_CAMERA; i++) {
-		if (g_server_dev.mctl[i].handle == 0) {
-			g_server_dev.mctl[i].handle =
-				(++g_server_dev.mctl_handle_cnt) << 8 | i;
-			memset(&g_server_dev.mctl[i].mctl,
-				0, sizeof(g_server_dev.mctl[i].mctl));
-			return g_server_dev.mctl[i].handle;
-		}
-	}
-	return 0;
-}
-
-void msm_cam_server_free_mctl(uint32_t handle)
-{
-	uint32_t mctl_index;
-	mctl_index = handle & 0xff;
-	if ((mctl_index < MAX_NUM_ACTIVE_CAMERA) &&
-		(g_server_dev.mctl[mctl_index].handle == handle))
-		g_server_dev.mctl[mctl_index].handle = 0;
-	else
-		pr_err("%s: invalid free handle\n", __func__);
-}
-
-struct msm_cam_media_controller *msm_cam_server_get_mctl(uint32_t handle)
-{
-	uint32_t mctl_index;
-	mctl_index = handle & 0xff;
-	if ((mctl_index < MAX_NUM_ACTIVE_CAMERA) &&
-		(g_server_dev.mctl[mctl_index].handle == handle))
-		return &g_server_dev.mctl[mctl_index].mctl;
-	return NULL;
-}
-
-uint32_t msm_cam_find_handle_from_mctl_ptr(
-			struct msm_cam_media_controller *p_mctl)
-{
-	uint32_t idx;
-	struct msm_cam_media_controller *tmp_mctl = NULL;
-	for (idx = 0; idx < MAX_NUM_ACTIVE_CAMERA; idx++) {
-		tmp_mctl = &g_server_dev.mctl[idx].mctl;
-		if (p_mctl == tmp_mctl)
-			return g_server_dev.mctl[idx].handle;
-	}
-	return 0;
-}
-
-static void msm_cam_server_send_error_evt(
-		struct msm_cam_media_controller *pmctl, int evt_type)
-{
-	struct v4l2_event v4l2_ev;
-	v4l2_ev.id = 0;
-	v4l2_ev.type = evt_type;
-	ktime_get_ts(&v4l2_ev.timestamp);
-	v4l2_event_queue(pmctl->pcam_ptr->pvdev, &v4l2_ev);
-}
-
-static int msm_ctrl_cmd_done(void *arg)
-{
-	void __user *uptr;
-	struct msm_queue_cmd *qcmd;
-	struct msm_camera_v4l2_ioctl_t *ioctl_ptr = arg;
-	struct msm_ctrl_cmd *command;
-	D("%s\n", __func__);
-
-	command = kzalloc(sizeof(struct msm_ctrl_cmd), GFP_KERNEL);
-	if (!command) {
-		pr_err("%s Insufficient memory. return", __func__);
-		goto command_alloc_fail;
-	}
-
-	qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
-	if (!qcmd) {
-		pr_err("%s Insufficient memory. return", __func__);
-		goto qcmd_alloc_fail;
-	}
-
-	mutex_lock(&g_server_dev.server_queue_lock);
-
-	if (copy_from_user(command, (void __user *)ioctl_ptr->ioctl_ptr,
-					   sizeof(struct msm_ctrl_cmd))) {
-		pr_err("%s: copy_from_user failed, size=%d\n",
-			__func__, sizeof(struct msm_ctrl_cmd));
-		goto ctrl_cmd_done_error;
-	}
-
-	if (!g_server_dev.server_queue[command->queue_idx].queue_active) {
-		pr_err("%s: Invalid queue\n", __func__);
-		goto ctrl_cmd_done_error;
-	}
-
-	D("%s qid %d evtid %d %d\n", __func__, command->queue_idx,
-		command->evt_id,
-		g_server_dev.server_queue[command->queue_idx].evt_id);
-
-	if (command->evt_id !=
-		g_server_dev.server_queue[command->queue_idx].evt_id) {
-		pr_err("Invalid event id from userspace\n");
-		goto ctrl_cmd_done_error;
-	}
-
-	atomic_set(&qcmd->on_heap, 1);
-	uptr = command->value;
-	qcmd->command = command;
-
-	if (command->length > 0) {
-		command->value =
-			g_server_dev.server_queue[command->queue_idx].ctrl_data;
-		if (command->length > MAX_SERVER_PAYLOAD_LENGTH) {
-			pr_err("%s: user data %d is too big (max %d)\n",
-				__func__, command->length,
-				max_control_command_size);
-			goto ctrl_cmd_done_error;
-		}
-		if (copy_from_user(command->value, uptr, command->length)) {
-			pr_err("%s: copy_from_user failed, size=%d\n",
-				__func__, sizeof(struct msm_ctrl_cmd));
-			goto ctrl_cmd_done_error;
-		}
-	}
-	msm_enqueue(&g_server_dev.server_queue
-		[command->queue_idx].ctrl_q, &qcmd->list_control);
-	mutex_unlock(&g_server_dev.server_queue_lock);
-	return 0;
-
-ctrl_cmd_done_error:
-	mutex_unlock(&g_server_dev.server_queue_lock);
-	free_qcmd(qcmd);
-qcmd_alloc_fail:
-	kfree(command);
-command_alloc_fail:
-	return -EINVAL;
-}
-
-/* send control command to config and wait for results*/
-static int msm_server_control(struct msm_cam_server_dev *server_dev,
-				uint32_t id, struct msm_ctrl_cmd *out)
-{
-	int rc = 0;
-	uint8_t wait_count;
-	void *value;
-	struct msm_queue_cmd *rcmd;
-	struct msm_queue_cmd *event_qcmd;
-	struct msm_ctrl_cmd *ctrlcmd;
-	struct msm_device_queue *queue =
-		&server_dev->server_queue[out->queue_idx].ctrl_q;
-
-	struct v4l2_event v4l2_evt;
-	struct msm_isp_event_ctrl *isp_event;
-	void *ctrlcmd_data;
-
-	event_qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
-	if (!event_qcmd) {
-		pr_err("%s Insufficient memory. return", __func__);
-		rc = -ENOMEM;
-		goto event_qcmd_alloc_fail;
-	}
-
-	isp_event = kzalloc(sizeof(struct msm_isp_event_ctrl), GFP_KERNEL);
-	if (!isp_event) {
-		pr_err("%s Insufficient memory. return", __func__);
-		rc = -ENOMEM;
-		goto isp_event_alloc_fail;
-	}
-
-	D("%s\n", __func__);
-	mutex_lock(&server_dev->server_queue_lock);
-	if (++server_dev->server_evt_id == 0)
-		server_dev->server_evt_id++;
-
-	D("%s qid %d evtid %d\n", __func__, out->queue_idx,
-		server_dev->server_evt_id);
-	server_dev->server_queue[out->queue_idx].evt_id =
-		server_dev->server_evt_id;
-	v4l2_evt.type = V4L2_EVENT_PRIVATE_START + MSM_CAM_RESP_V4L2;
-	v4l2_evt.id = id;
-	v4l2_evt.u.data[0] = out->queue_idx;
-	/* setup event object to transfer the command; */
-	isp_event->resptype = MSM_CAM_RESP_V4L2;
-	isp_event->isp_data.ctrl = *out;
-	isp_event->isp_data.ctrl.evt_id = server_dev->server_evt_id;
-
-	if (out->value != NULL && out->length != 0) {
-		ctrlcmd_data = kzalloc(out->length, GFP_KERNEL);
-		if (!ctrlcmd_data) {
-			rc = -ENOMEM;
-			goto ctrlcmd_alloc_fail;
-		}
-		memcpy(ctrlcmd_data, out->value, out->length);
-		isp_event->isp_data.ctrl.value = ctrlcmd_data;
-	}
-
-	atomic_set(&event_qcmd->on_heap, 1);
-	event_qcmd->command = isp_event;
-
-	msm_enqueue(&server_dev->server_queue[out->queue_idx].eventData_q,
-				&event_qcmd->list_eventdata);
-
-	/* now send command to config thread in userspace,
-	 * and wait for results */
-	v4l2_event_queue(server_dev->server_command_queue.pvdev,
-					  &v4l2_evt);
-	D("%s v4l2_event_queue: type = 0x%x\n", __func__, v4l2_evt.type);
-	mutex_unlock(&server_dev->server_queue_lock);
-
-	/* wait for config return status */
-	D("Waiting for config status\n");
-	/* wait event may be interrupted by sugnal,
-	 * in this case -ERESTARTSYS is returned and retry is needed.
-	 * Now we only retry once. */
-	wait_count = 2;
-	do {
-		rc = wait_event_interruptible_timeout(queue->wait,
-			!list_empty_careful(&queue->list),
-			msecs_to_jiffies(out->timeout_ms));
-		wait_count--;
-		if (rc != -ERESTARTSYS)
-			break;
-		D("%s: wait_event interrupted by signal, remain_count = %d",
-			__func__, wait_count);
-	} while (1);
-	D("Waiting is over for config status\n");
-	if (list_empty_careful(&queue->list)) {
-		if (!rc) {
-			rc = -ETIMEDOUT;
-			msm_drain_eventq(
-			&server_dev->server_queue[out->queue_idx].eventData_q);
-		}
-		if (rc < 0) {
-			if (++server_dev->server_evt_id == 0)
-				server_dev->server_evt_id++;
-			pr_err("%s: wait_event error %d\n", __func__, rc);
-			return rc;
-		} else {
-			pr_err("%s: List is empty\n", __func__);
-			return -EINVAL;
-		}
-	}
-
-	rcmd = msm_dequeue(queue, list_control);
-	if (!rcmd) {
-		pr_err("%s: List is empty\n", __func__);
-		return -EINVAL;
-	}
-	D("%s Finished servicing ioctl\n", __func__);
-
-	ctrlcmd = (struct msm_ctrl_cmd *)(rcmd->command);
-	value = out->value;
-	if (ctrlcmd->length > 0 && value != NULL &&
-		ctrlcmd->length <= out->length)
-		memcpy(value, ctrlcmd->value, ctrlcmd->length);
-
-	memcpy(out, ctrlcmd, sizeof(struct msm_ctrl_cmd));
-	out->value = value;
-
-	kfree(ctrlcmd);
-	free_qcmd(rcmd);
-	D("%s: rc %d\n", __func__, rc);
-	/* rc is the time elapsed.
-	 * This means that the communication with the daemon itself was
-	 * successful(irrespective of the handling of the ctrlcmd).
-	 * So, just reset the rc to 0 to indicate success.
-	 * Its upto the caller to parse the ctrlcmd to check the status. We
-	 * dont need to parse it here. */
-	if (rc >= 0)
-		rc = 0;
-
-	return rc;
-
-ctrlcmd_alloc_fail:
-	mutex_unlock(&server_dev->server_queue_lock);
-	kfree(isp_event);
-isp_event_alloc_fail:
-	kfree(event_qcmd);
-event_qcmd_alloc_fail:
-	return rc;
-}
-
-int msm_server_private_general(struct msm_cam_v4l2_device *pcam,
-		struct msm_camera_v4l2_ioctl_t *ioctl_ptr)
-{
-	struct msm_ctrl_cmd ctrlcmd;
-	void *temp_data = NULL;
-	int rc;
-	if (ioctl_ptr->len > 0) {
-		temp_data = kzalloc(ioctl_ptr->len, GFP_KERNEL);
-		if (!temp_data) {
-			pr_err("%s could not allocate memory\n", __func__);
-			rc = -ENOMEM;
-			goto end;
-		}
-		if (copy_from_user((void *)temp_data,
-			(void __user *)ioctl_ptr->ioctl_ptr,
-			ioctl_ptr->len)) {
-			ERR_COPY_FROM_USER();
-			rc = -EFAULT;
-			goto copy_from_user_failed;
-		}
-	}
-
-	mutex_lock(&pcam->vid_lock);
-	ctrlcmd.type = MSM_V4L2_PRIVATE_CMD;
-	ctrlcmd.length = ioctl_ptr->len;
-	ctrlcmd.value = temp_data;
-	ctrlcmd.timeout_ms = 1000;
-	ctrlcmd.status = ioctl_ptr->id;
-	ctrlcmd.vnode_id = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
-	/* send command to config thread in usersspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-	if (rc < 0)
-		pr_err("%s: send event failed\n", __func__);
-	else {
-		if (ioctl_ptr->len > 0) {
-			if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
-				(void *)temp_data,
-				ioctl_ptr->len)) {
-				ERR_COPY_TO_USER();
-				rc = -EFAULT;
-			}
-		}
-	}
-	mutex_unlock(&pcam->vid_lock);
-
-	kfree(temp_data);
-	return rc;
-copy_from_user_failed:
-	kfree(temp_data);
-end:
-return rc;
-}
-
-int msm_server_get_crop(struct msm_cam_v4l2_device *pcam,
-				int idx, struct v4l2_crop *crop)
-{
-	int rc = 0;
-	struct msm_ctrl_cmd ctrlcmd;
-
-	BUG_ON(crop == NULL);
-
-	ctrlcmd.type = MSM_V4L2_GET_CROP;
-	ctrlcmd.length = sizeof(struct v4l2_crop);
-	ctrlcmd.value = (void *)crop;
-	ctrlcmd.timeout_ms = 1000;
-	ctrlcmd.vnode_id = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-	ctrlcmd.stream_type = pcam->dev_inst[idx]->image_mode;
-	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[
-						pcam->server_queue_idx];
-
-	/* send command to config thread in userspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-	D("%s: rc = %d\n", __func__, rc);
-
-	return rc;
-}
-
-/*send open command to server*/
-int msm_send_open_server(struct msm_cam_v4l2_device *pcam)
-{
-	int rc = 0;
-	struct msm_ctrl_cmd ctrlcmd;
-	int idx = pcam->server_queue_idx;
-	D("%s qid %d\n", __func__, pcam->server_queue_idx);
-	ctrlcmd.type	   = MSM_V4L2_OPEN;
-	ctrlcmd.timeout_ms = 10000;
-	ctrlcmd.length = strnlen(
-		g_server_dev.config_info.config_dev_name[idx],
-		MAX_DEV_NAME_LEN)+1;
-	ctrlcmd.value = (char *)g_server_dev.config_info.config_dev_name[idx];
-	ctrlcmd.vnode_id = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[idx];
-
-	/* send command to config thread in usersspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-
-	return rc;
-}
-
-int msm_send_close_server(struct msm_cam_v4l2_device *pcam)
-{
-	int rc = 0;
-	struct msm_ctrl_cmd ctrlcmd;
-	D("%s qid %d\n", __func__, pcam->server_queue_idx);
-	ctrlcmd.type	   = MSM_V4L2_CLOSE;
-	ctrlcmd.timeout_ms = 10000;
-	ctrlcmd.length	 = strnlen(g_server_dev.config_info.config_dev_name[
-				pcam->server_queue_idx], MAX_DEV_NAME_LEN)+1;
-	ctrlcmd.value    = (char *)g_server_dev.config_info.config_dev_name[
-				pcam->server_queue_idx];
-	ctrlcmd.vnode_id = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[
-						pcam->server_queue_idx];
-
-	/* send command to config thread in usersspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-
-	return rc;
-}
-
-int msm_server_set_fmt(struct msm_cam_v4l2_device *pcam, int idx,
-				 struct v4l2_format *pfmt)
-{
-	int rc = 0;
-	int i = 0;
-	struct v4l2_pix_format *pix = &pfmt->fmt.pix;
-	struct msm_ctrl_cmd ctrlcmd;
-	struct img_plane_info plane_info;
-
-	plane_info.width = pix->width;
-	plane_info.height = pix->height;
-	plane_info.pixelformat = pix->pixelformat;
-	plane_info.buffer_type = pfmt->type;
-	plane_info.ext_mode = pcam->dev_inst[idx]->image_mode;
-	plane_info.num_planes = 1;
-	plane_info.inst_handle = pcam->dev_inst[idx]->inst_handle;
-	D("%s: %d, %d, 0x%x\n", __func__,
-		pfmt->fmt.pix.width, pfmt->fmt.pix.height,
-		pfmt->fmt.pix.pixelformat);
-
-	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
-		D("%s, Attention! Wrong buf-type %d\n", __func__, pfmt->type);
-
-	for (i = 0; i < pcam->num_fmts; i++)
-		if (pcam->usr_fmts[i].fourcc == pix->pixelformat)
-			break;
-	if (i == pcam->num_fmts) {
-		pr_err("%s: User requested pixelformat %x not supported\n",
-						__func__, pix->pixelformat);
-		return -EINVAL;
-	}
-
-	ctrlcmd.type       = MSM_V4L2_VID_CAP_TYPE;
-	ctrlcmd.length     = sizeof(struct img_plane_info);
-	ctrlcmd.value      = (void *)&plane_info;
-	ctrlcmd.timeout_ms = 10000;
-	ctrlcmd.vnode_id   = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
-
-	/* send command to config thread in usersspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-
-	if (rc >= 0) {
-		pcam->dev_inst[idx]->vid_fmt = *pfmt;
-		pcam->dev_inst[idx]->sensor_pxlcode
-					= pcam->usr_fmts[i].pxlcode;
-		D("%s:inst=0x%x,idx=%d,width=%d,heigth=%d\n",
-			 __func__, (u32)pcam->dev_inst[idx], idx,
-			 pcam->dev_inst[idx]->vid_fmt.fmt.pix.width,
-			 pcam->dev_inst[idx]->vid_fmt.fmt.pix.height);
-		pcam->dev_inst[idx]->plane_info = plane_info;
-	}
-
-	return rc;
-}
-
-int msm_server_set_fmt_mplane(struct msm_cam_v4l2_device *pcam, int idx,
-				 struct v4l2_format *pfmt)
-{
-	int rc = 0;
-	int i = 0;
-	struct v4l2_pix_format_mplane *pix_mp = &pfmt->fmt.pix_mp;
-	struct msm_ctrl_cmd ctrlcmd;
-	struct img_plane_info plane_info;
-
-	plane_info.width = pix_mp->width;
-	plane_info.height = pix_mp->height;
-	plane_info.pixelformat = pix_mp->pixelformat;
-	plane_info.buffer_type = pfmt->type;
-	plane_info.ext_mode = pcam->dev_inst[idx]->image_mode;
-	plane_info.num_planes = pix_mp->num_planes;
-	plane_info.inst_handle = pcam->dev_inst[idx]->inst_handle;
-
-	if (plane_info.num_planes <= 0 ||
-		plane_info.num_planes > VIDEO_MAX_PLANES) {
-		pr_err("%s Invalid number of planes set %d", __func__,
-				plane_info.num_planes);
-		return -EINVAL;
-	}
-	D("%s: %d, %d, 0x%x\n", __func__,
-		pfmt->fmt.pix_mp.width, pfmt->fmt.pix_mp.height,
-		pfmt->fmt.pix_mp.pixelformat);
-
-	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
-		pr_err("%s, Attention! Wrong buf-type %d\n",
-			__func__, pfmt->type);
-		return -EINVAL;
-	}
-
-	for (i = 0; i < pcam->num_fmts; i++)
-		if (pcam->usr_fmts[i].fourcc == pix_mp->pixelformat)
-			break;
-	if (i == pcam->num_fmts) {
-		pr_err("%s: User requested pixelformat %x not supported\n",
-						__func__, pix_mp->pixelformat);
-		return -EINVAL;
-	}
-
-	ctrlcmd.type       = MSM_V4L2_VID_CAP_TYPE;
-	ctrlcmd.length     = sizeof(struct img_plane_info);
-	ctrlcmd.value      = (void *)&plane_info;
-	ctrlcmd.timeout_ms = 10000;
-	ctrlcmd.vnode_id   = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-
-	/* send command to config thread in usersspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-	if (rc >= 0) {
-		pcam->dev_inst[idx]->vid_fmt = *pfmt;
-		pcam->dev_inst[idx]->sensor_pxlcode
-					= pcam->usr_fmts[i].pxlcode;
-		D("%s:inst=0x%x,idx=%d,width=%d,heigth=%d\n",
-			 __func__, (u32)pcam->dev_inst[idx], idx,
-			 pcam->dev_inst[idx]->vid_fmt.fmt.pix_mp.width,
-			 pcam->dev_inst[idx]->vid_fmt.fmt.pix_mp.height);
-		pcam->dev_inst[idx]->plane_info = plane_info;
-	}
-
-	return rc;
-}
-
-int msm_server_streamon(struct msm_cam_v4l2_device *pcam, int idx)
-{
-	int rc = 0;
-	struct msm_ctrl_cmd ctrlcmd;
-	D("%s\n", __func__);
-	ctrlcmd.type	   = MSM_V4L2_STREAM_ON;
-	ctrlcmd.timeout_ms = 10000;
-	ctrlcmd.length	 = 0;
-	ctrlcmd.value    = NULL;
-	ctrlcmd.stream_type = pcam->dev_inst[idx]->image_mode;
-	ctrlcmd.vnode_id = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
-
-
-	/* send command to config thread in usersspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-	return rc;
-}
-
-int msm_server_streamoff(struct msm_cam_v4l2_device *pcam, int idx)
-{
-	int rc = 0;
-	struct msm_ctrl_cmd ctrlcmd;
-
-	D("%s, pcam = 0x%x\n", __func__, (u32)pcam);
-	ctrlcmd.type        = MSM_V4L2_STREAM_OFF;
-	ctrlcmd.timeout_ms  = 10000;
-	ctrlcmd.length      = 0;
-	ctrlcmd.value       = NULL;
-	ctrlcmd.stream_type = pcam->dev_inst[idx]->image_mode;
-	ctrlcmd.vnode_id = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
-
-	/* send command to config thread in usersspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-
-	return rc;
-}
-
-int msm_server_proc_ctrl_cmd(struct msm_cam_v4l2_device *pcam,
-		struct msm_camera_v4l2_ioctl_t *ioctl_ptr, int is_set_cmd)
-{
-	int rc = 0;
-	struct msm_ctrl_cmd ctrlcmd, tmp_cmd, *cmd_ptr;
-	uint8_t *ctrl_data = NULL;
-	uint32_t cmd_len = sizeof(struct msm_ctrl_cmd);
-	uint32_t value_len;
-
-	if (copy_from_user(&tmp_cmd,
-		(void __user *)ioctl_ptr->ioctl_ptr, cmd_len)) {
-		pr_err("%s: copy_from_user failed.\n", __func__);
-		rc = -EINVAL;
-		goto end;
-	}
-
-	if(tmp_cmd.length > 0xffff) {
-		 pr_err("%s Integer Overflow occurred \n",__func__);
-		 rc = -EINVAL;
-		 goto end;
-	}
-
-	value_len = tmp_cmd.length;
-	ctrl_data = kzalloc(value_len+cmd_len, GFP_KERNEL);
-	if (!ctrl_data) {
-		pr_err("%s could not allocate memory\n", __func__);
-		rc = -ENOMEM;
-		goto end;
-	}
-
-	cmd_ptr = (struct msm_ctrl_cmd *) ctrl_data;
-	*cmd_ptr = tmp_cmd;
-	if (tmp_cmd.value && tmp_cmd.length > 0) {
-		cmd_ptr->value = (void *)(ctrl_data+cmd_len);
-		if (copy_from_user((void *)cmd_ptr->value,
-				   (void __user *)tmp_cmd.value,
-				   value_len)) {
-			pr_err("%s: copy_from_user failed.\n", __func__);
-			rc = -EINVAL;
-			goto end;
-		}
-	} else {
-		cmd_ptr->value = NULL;
-	}
-
-	D("%s: cmd type = %d, up1=0x%x, ulen1=%d, up2=0x%x, ulen2=%d\n",
-		__func__, tmp_cmd.type, (uint32_t)ioctl_ptr->ioctl_ptr, cmd_len,
-		(uint32_t)tmp_cmd.value, tmp_cmd.length);
-
-	ctrlcmd.type = MSM_V4L2_SET_CTRL_CMD;
-	ctrlcmd.length = cmd_len + value_len;
-	ctrlcmd.value = (void *)ctrl_data;
-	if (tmp_cmd.timeout_ms > 0)
-		ctrlcmd.timeout_ms = tmp_cmd.timeout_ms;
-	else
-		ctrlcmd.timeout_ms = 1000;
-	ctrlcmd.vnode_id = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
-	/* send command to config thread in usersspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-	D("%s: msm_server_control rc=%d\n", __func__, rc);
-	if (rc == 0) {
-		if (tmp_cmd.value && tmp_cmd.length > 0 &&
-			copy_to_user((void __user *)tmp_cmd.value,
-				(void *)(ctrl_data+cmd_len), tmp_cmd.length)) {
-			pr_err("%s: copy_to_user failed, size=%d\n",
-				__func__, tmp_cmd.length);
-			rc = -EINVAL;
-			goto end;
-		}
-		tmp_cmd.status = cmd_ptr->status = ctrlcmd.status;
-		if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
-			(void *)cmd_ptr, cmd_len)) {
-			pr_err("%s: copy_to_user failed in cpy, size=%d\n",
-				__func__, cmd_len);
-			rc = -EINVAL;
-			goto end;
-		}
-	}
-end:
-	D("%s: END, type = %d, vaddr = 0x%x, vlen = %d, status = %d, rc = %d\n",
-		__func__, tmp_cmd.type, (uint32_t)tmp_cmd.value,
-		tmp_cmd.length, tmp_cmd.status, rc);
-	kfree(ctrl_data);
-	ctrl_data = NULL;
-	return rc;
-}
-
-int msm_server_s_ctrl(struct msm_cam_v4l2_device *pcam,
-				 struct v4l2_control *ctrl)
-{
-	int rc = 0;
-	struct msm_ctrl_cmd ctrlcmd;
-	uint8_t ctrl_data[max_control_command_size];
-
-	WARN_ON(ctrl == NULL);
-	if (ctrl == NULL) {
-		pr_err("%s Invalid control\n", __func__);
-		return -EINVAL;
-	}
-
-	memset(ctrl_data, 0, sizeof(ctrl_data));
-
-	ctrlcmd.type = MSM_V4L2_SET_CTRL;
-	ctrlcmd.length = sizeof(struct v4l2_control);
-	ctrlcmd.value = (void *)ctrl_data;
-	memcpy(ctrlcmd.value, ctrl, ctrlcmd.length);
-	ctrlcmd.timeout_ms = 1000;
-	ctrlcmd.vnode_id = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
-
-	/* send command to config thread in usersspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-
-	return rc;
-}
-
-int msm_server_g_ctrl(struct msm_cam_v4l2_device *pcam,
-				 struct v4l2_control *ctrl)
-{
-	int rc = 0;
-	struct msm_ctrl_cmd ctrlcmd;
-	uint8_t ctrl_data[max_control_command_size];
-
-	WARN_ON(ctrl == NULL);
-	if (ctrl == NULL) {
-		pr_err("%s Invalid control\n", __func__);
-		return -EINVAL;
-	}
-
-	memset(ctrl_data, 0, sizeof(ctrl_data));
-
-	ctrlcmd.type = MSM_V4L2_GET_CTRL;
-	ctrlcmd.length = sizeof(struct v4l2_control);
-	ctrlcmd.value = (void *)ctrl_data;
-	memcpy(ctrlcmd.value, ctrl, ctrlcmd.length);
-	ctrlcmd.timeout_ms = 1000;
-	ctrlcmd.vnode_id = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
-
-	/* send command to config thread in usersspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-
-	ctrl->value = ((struct v4l2_control *)ctrlcmd.value)->value;
-
-	return rc;
-}
-
-int msm_server_q_ctrl(struct msm_cam_v4l2_device *pcam,
-			struct v4l2_queryctrl *queryctrl)
-{
-	int rc = 0;
-	struct msm_ctrl_cmd ctrlcmd;
-	uint8_t ctrl_data[max_control_command_size];
-
-	WARN_ON(queryctrl == NULL);
-	memset(ctrl_data, 0, sizeof(ctrl_data));
-
-	ctrlcmd.type = MSM_V4L2_QUERY_CTRL;
-	ctrlcmd.length = sizeof(struct v4l2_queryctrl);
-	ctrlcmd.value = (void *)ctrl_data;
-	memcpy(ctrlcmd.value, queryctrl, ctrlcmd.length);
-	ctrlcmd.timeout_ms = 1000;
-	ctrlcmd.vnode_id = pcam->vnode_id;
-	ctrlcmd.queue_idx = pcam->server_queue_idx;
-	ctrlcmd.config_ident = g_server_dev.config_info.config_dev_id[0];
-
-	/* send command to config thread in userspace, and get return value */
-	rc = msm_server_control(&g_server_dev, 0, &ctrlcmd);
-	D("%s: rc = %d\n", __func__, rc);
-
-	if (rc >= 0)
-		memcpy(queryctrl, ctrlcmd.value, sizeof(struct v4l2_queryctrl));
-
-	return rc;
-}
-
-int msm_server_get_fmt(struct msm_cam_v4l2_device *pcam,
-		 int idx, struct v4l2_format *pfmt)
-{
-	struct v4l2_pix_format *pix = &pfmt->fmt.pix;
-
-	pix->width        = pcam->dev_inst[idx]->vid_fmt.fmt.pix.width;
-	pix->height       = pcam->dev_inst[idx]->vid_fmt.fmt.pix.height;
-	pix->field        = pcam->dev_inst[idx]->vid_fmt.fmt.pix.field;
-	pix->pixelformat  = pcam->dev_inst[idx]->vid_fmt.fmt.pix.pixelformat;
-	pix->bytesperline = pcam->dev_inst[idx]->vid_fmt.fmt.pix.bytesperline;
-	pix->colorspace   = pcam->dev_inst[idx]->vid_fmt.fmt.pix.colorspace;
-	if (pix->bytesperline < 0)
-		return pix->bytesperline;
-
-	pix->sizeimage    = pix->height * pix->bytesperline;
-
-	return 0;
-}
-
-int msm_server_get_fmt_mplane(struct msm_cam_v4l2_device *pcam,
-		 int idx, struct v4l2_format *pfmt)
-{
-	*pfmt = pcam->dev_inst[idx]->vid_fmt;
-	return 0;
-}
-
-int msm_server_try_fmt(struct msm_cam_v4l2_device *pcam,
-				 struct v4l2_format *pfmt)
-{
-	int rc = 0;
-	int i = 0;
-	struct v4l2_pix_format *pix = &pfmt->fmt.pix;
-
-	D("%s: 0x%x\n", __func__, pix->pixelformat);
-	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
-		pr_err("%s: pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE!\n",
-							__func__);
-		return -EINVAL;
-	}
-
-	/* check if the format is supported by this host-sensor combo */
-	for (i = 0; i < pcam->num_fmts; i++) {
-		D("%s: usr_fmts.fourcc: 0x%x\n", __func__,
-			pcam->usr_fmts[i].fourcc);
-		if (pcam->usr_fmts[i].fourcc == pix->pixelformat)
-			break;
-	}
-
-	if (i == pcam->num_fmts) {
-		pr_err("%s: Format %x not found\n", __func__, pix->pixelformat);
-		return -EINVAL;
-	}
-	return rc;
-}
-
-int msm_server_try_fmt_mplane(struct msm_cam_v4l2_device *pcam,
-				 struct v4l2_format *pfmt)
-{
-	int rc = 0;
-	int i = 0;
-	struct v4l2_pix_format_mplane *pix_mp = &pfmt->fmt.pix_mp;
-
-	D("%s: 0x%x\n", __func__, pix_mp->pixelformat);
-	if (pfmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
-		pr_err("%s: Incorrect format type %d ",
-			__func__, pfmt->type);
-		return -EINVAL;
-	}
-
-	/* check if the format is supported by this host-sensor combo */
-	for (i = 0; i < pcam->num_fmts; i++) {
-		D("%s: usr_fmts.fourcc: 0x%x\n", __func__,
-			pcam->usr_fmts[i].fourcc);
-		if (pcam->usr_fmts[i].fourcc == pix_mp->pixelformat)
-			break;
-	}
-
-	if (i == pcam->num_fmts) {
-		pr_err("%s: Format %x not found\n",
-			__func__, pix_mp->pixelformat);
-		return -EINVAL;
-	}
-	return rc;
-}
-
-int msm_server_v4l2_subscribe_event(struct v4l2_fh *fh,
-			struct v4l2_event_subscription *sub)
-{
-	int rc = 0;
-
-	D("%s: fh = 0x%x, type = 0x%x", __func__, (u32)fh, sub->type);
-	if (sub->type == V4L2_EVENT_ALL) {
-		/*sub->type = MSM_ISP_EVENT_START;*/
-		sub->type = V4L2_EVENT_PRIVATE_START + MSM_CAM_RESP_CTRL;
-		D("sub->type start = 0x%x\n", sub->type);
-		do {
-			rc = v4l2_event_subscribe(fh, sub, 100);
-			if (rc < 0) {
-				D("%s: failed for evtType = 0x%x, rc = %d\n",
-						__func__, sub->type, rc);
-			/* unsubscribe all events here and return */
-			sub->type = V4L2_EVENT_ALL;
-			v4l2_event_unsubscribe(fh, sub);
-			return rc;
-			} else
-				D("%s: subscribed evtType = 0x%x, rc = %d\n",
-						__func__, sub->type, rc);
-			sub->type++;
-			D("sub->type while = 0x%x\n", sub->type);
-		} while (sub->type !=
-			V4L2_EVENT_PRIVATE_START + MSM_SVR_RESP_MAX);
-	} else {
-		D("sub->type not V4L2_EVENT_ALL = 0x%x\n", sub->type);
-		rc = v4l2_event_subscribe(fh, sub, 100);
-		if (rc < 0)
-			D("%s: failed for evtType = 0x%x, rc = %d\n",
-						__func__, sub->type, rc);
-	}
-
-	D("%s: rc = %d\n", __func__, rc);
-	return rc;
-}
-
-int msm_server_v4l2_unsubscribe_event(struct v4l2_fh *fh,
-			struct v4l2_event_subscription *sub)
-{
-	int rc = 0;
-	struct v4l2_event ev;
-
-	D("%s: fh = 0x%x\n", __func__, (u32)fh);
-
-	/* Undequeue all pending events and free associated
-	 * msm_isp_event_ctrl  */
-	while (v4l2_event_pending(fh)) {
-		struct msm_isp_event_ctrl *isp_event;
-		rc = v4l2_event_dequeue(fh, &ev, O_NONBLOCK);
-		if (rc) {
-			pr_err("%s: v4l2_event_dequeue failed %d",
-						__func__, rc);
-			break;
-		}
-		isp_event = (struct msm_isp_event_ctrl *)
-			(*((uint32_t *)ev.u.data));
-		if (isp_event) {
-			if (ev.type == (V4L2_EVENT_PRIVATE_START +
-						MSM_CAM_RESP_STAT_EVT_MSG)) {
-				if (isp_event->isp_data.isp_msg.len != 0 &&
-				isp_event->isp_data.isp_msg.data != NULL) {
-					kfree(isp_event->isp_data.isp_msg.data);
-					isp_event->isp_data.isp_msg.len = 0;
-					isp_event->isp_data.isp_msg.data = NULL;
-				}
-				kfree(isp_event);
-				*((uint32_t *)ev.u.data) = 0;
-			}
-		}
-	}
-
-	rc = v4l2_event_unsubscribe(fh, sub);
-	D("%s: rc = %d\n", __func__, rc);
-	return rc;
-}
-
-/* open an active camera session to manage the streaming logic */
-static int msm_cam_server_open_session(struct msm_cam_server_dev *ps,
-	struct msm_cam_v4l2_device *pcam)
-{
-	int rc = 0;
-
-	D("%s\n", __func__);
-
-	if (!ps || !pcam) {
-		pr_err("%s NULL pointer passed in!\n", __func__);
-		return rc;
-	}
-
-	/*
-	 * The number of camera instance should be controlled by the
-	 * resource manager. Currently supporting two active instances
-	 */
-	if (atomic_read(&ps->number_pcam_active) > 1) {
-		pr_err("%s Cannot have more than two active camera %d\n",
-			__func__, atomic_read(&ps->number_pcam_active));
-		return -EINVAL;
-	}
-	/* book keeping this camera session*/
-	ps->pcam_active[pcam->server_queue_idx] = pcam;
-	ps->opened_pcam[pcam->vnode_id] = pcam;
-	atomic_inc(&ps->number_pcam_active);
-
-	D("config pcam = 0x%p\n", pcam);
-
-	/* initialization the media controller module*/
-	msm_mctl_init(pcam);
-
-	return rc;
-}
-
-/* close an active camera session to server */
-static int msm_cam_server_close_session(struct msm_cam_server_dev *ps,
-	struct msm_cam_v4l2_device *pcam)
-{
-	int i;
-	int rc = 0;
-	D("%s\n", __func__);
-
-	if (!ps || !pcam) {
-		D("%s NULL pointer passed in!\n", __func__);
-		return rc;
-	}
-
-	atomic_dec(&ps->number_pcam_active);
-	ps->pcam_active[pcam->server_queue_idx] = NULL;
-	ps->opened_pcam[pcam->vnode_id] = NULL;
-	for (i = 0; i < INTF_MAX; i++) {
-		if (ps->interface_map_table[i].mctl_handle ==
-			pcam->mctl_handle)
-			ps->interface_map_table[i].mctl_handle = 0;
-	}
-	msm_mctl_free(pcam);
-	return rc;
-}
-
-static int map_imem_addresses(struct msm_cam_media_controller *mctl)
-{
-	int rc = 0;
-	rc = msm_iommu_map_contig_buffer(
-		(unsigned long)IMEM_Y_PING_OFFSET, mctl->domain_num, 0,
-		((IMEM_Y_SIZE + IMEM_CBCR_SIZE + 4095) & (~4095)),
-		SZ_4K, IOMMU_WRITE | IOMMU_READ,
-		(unsigned long *)&mctl->ping_imem_y);
-	mctl->ping_imem_cbcr = mctl->ping_imem_y + IMEM_Y_SIZE;
-	if (rc < 0) {
-		pr_err("%s: ping iommu mapping returned error %d\n",
-			__func__, rc);
-		mctl->ping_imem_y = 0;
-		mctl->ping_imem_cbcr = 0;
-	}
-	msm_iommu_map_contig_buffer(
-		(unsigned long)IMEM_Y_PONG_OFFSET, mctl->domain_num, 0,
-		((IMEM_Y_SIZE + IMEM_CBCR_SIZE + 4095) & (~4095)),
-		SZ_4K, IOMMU_WRITE | IOMMU_READ,
-		(unsigned long *)&mctl->pong_imem_y);
-	mctl->pong_imem_cbcr = mctl->pong_imem_y + IMEM_Y_SIZE;
-	if (rc < 0) {
-		pr_err("%s: pong iommu mapping returned error %d\n",
-			 __func__, rc);
-		mctl->pong_imem_y = 0;
-		mctl->pong_imem_cbcr = 0;
-	}
-	return rc;
-}
-
-static void unmap_imem_addresses(struct msm_cam_media_controller *mctl)
-{
-	msm_iommu_unmap_contig_buffer(mctl->ping_imem_y,
-		mctl->domain_num, 0,
-		((IMEM_Y_SIZE + IMEM_CBCR_SIZE + 4095) & (~4095)));
-	msm_iommu_unmap_contig_buffer(mctl->pong_imem_y,
-		mctl->domain_num, 0,
-		((IMEM_Y_SIZE + IMEM_CBCR_SIZE + 4095) & (~4095)));
-	mctl->ping_imem_y = 0;
-	mctl->ping_imem_cbcr = 0;
-	mctl->pong_imem_y = 0;
-	mctl->pong_imem_cbcr = 0;
-}
-
-static long msm_ioctl_server(struct file *file, void *fh,
-		bool valid_prio, int cmd, void *arg)
-{
-	int rc = -EINVAL;
-	struct msm_camera_v4l2_ioctl_t *ioctl_ptr = arg;
-	struct msm_camera_info temp_cam_info;
-	struct msm_cam_config_dev_info temp_config_info;
-	struct msm_mctl_node_info temp_mctl_info;
-	int i;
-
-	D("%s: cmd %d\n", __func__, _IOC_NR(cmd));
-
-	switch (cmd) {
-	case MSM_CAM_V4L2_IOCTL_GET_CAMERA_INFO:
-		if (copy_from_user(&temp_cam_info,
-				(void __user *)ioctl_ptr->ioctl_ptr,
-				sizeof(struct msm_camera_info))) {
-			pr_err("%s Copy from user failed for cmd %d",
-				__func__, cmd);
-			rc = -EINVAL;
-			return rc;
-		}
-		for (i = 0; i < g_server_dev.camera_info.num_cameras; i++) {
-			if (copy_to_user((void __user *)
-			temp_cam_info.video_dev_name[i],
-			g_server_dev.camera_info.video_dev_name[i],
-			strnlen(g_server_dev.camera_info.video_dev_name[i],
-				MAX_DEV_NAME_LEN))) {
-				pr_err("%s Copy to user failed for cmd %d",
-					__func__, cmd);
-				rc = -EINVAL;
-				return rc;
-			}
-			temp_cam_info.has_3d_support[i] =
-				g_server_dev.camera_info.has_3d_support[i];
-			temp_cam_info.is_internal_cam[i] =
-				g_server_dev.camera_info.is_internal_cam[i];
-			temp_cam_info.s_mount_angle[i] =
-				g_server_dev.camera_info.s_mount_angle[i];
-			temp_cam_info.sensor_type[i] =
-				g_server_dev.camera_info.sensor_type[i];
-
-		}
-		temp_cam_info.num_cameras =
-			g_server_dev.camera_info.num_cameras;
-		if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
-			&temp_cam_info,	sizeof(struct msm_camera_info))) {
-			pr_err("%s Copy to user failed for cmd %d",
-				__func__, cmd);
-			rc = -EINVAL;
-			return rc;
-		}
-		rc = 0;
-		break;
-
-	case MSM_CAM_V4L2_IOCTL_GET_CONFIG_INFO:
-		if (copy_from_user(&temp_config_info,
-			(void __user *)ioctl_ptr->ioctl_ptr,
-			sizeof(struct msm_cam_config_dev_info))) {
-			pr_err("%s Copy from user failed for cmd %d",
-				__func__, cmd);
-			rc = -EINVAL;
-			return rc;
-		}
-		for (i = 0;
-		 i < g_server_dev.config_info.num_config_nodes; i++) {
-			if (copy_to_user(
-			(void __user *)temp_config_info.config_dev_name[i],
-			g_server_dev.config_info.config_dev_name[i],
-			strnlen(g_server_dev.config_info.config_dev_name[i],
-				MAX_DEV_NAME_LEN))) {
-				pr_err("%s Copy to user failed for cmd %d",
-					__func__, cmd);
-				rc = -EINVAL;
-				return rc;
-			}
-		}
-		temp_config_info.num_config_nodes =
-			g_server_dev.config_info.num_config_nodes;
-		if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
-			&temp_config_info,
-			sizeof(struct msm_cam_config_dev_info))) {
-			pr_err("%s Copy to user failed for cmd %d",
-				__func__, cmd);
-			rc = -EINVAL;
-			return rc;
-		}
-		rc = 0;
-		break;
-	case MSM_CAM_V4L2_IOCTL_GET_MCTL_INFO:
-		if (copy_from_user(&temp_mctl_info,
-				(void __user *)ioctl_ptr->ioctl_ptr,
-				sizeof(struct msm_mctl_node_info))) {
-			pr_err("%s Copy from user failed for cmd %d",
-				__func__, cmd);
-			rc = -EINVAL;
-			return rc;
-		}
-		for (i = 0; i < g_server_dev.mctl_node_info.num_mctl_nodes;
-				i++) {
-			if (copy_to_user((void __user *)
-			temp_mctl_info.mctl_node_name[i],
-			g_server_dev.mctl_node_info.mctl_node_name[i], strnlen(
-			g_server_dev.mctl_node_info.mctl_node_name[i],
-			MAX_DEV_NAME_LEN))) {
-				pr_err("%s Copy to user failed for cmd %d",
-					__func__, cmd);
-				rc = -EINVAL;
-				return rc;
-			}
-		}
-		temp_mctl_info.num_mctl_nodes =
-			g_server_dev.mctl_node_info.num_mctl_nodes;
-		if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
-			&temp_mctl_info, sizeof(struct msm_mctl_node_info))) {
-			pr_err("%s Copy to user failed for cmd %d",
-				__func__, cmd);
-			rc = -EINVAL;
-			return rc;
-		}
-		rc = 0;
-	break;
-
-	case MSM_CAM_V4L2_IOCTL_CTRL_CMD_DONE:
-		D("%s: MSM_CAM_IOCTL_CTRL_CMD_DONE\n", __func__);
-		rc = msm_ctrl_cmd_done(arg);
-		break;
-
-	case MSM_CAM_V4L2_IOCTL_GET_EVENT_PAYLOAD: {
-		struct msm_queue_cmd *event_cmd;
-		struct msm_isp_event_ctrl u_isp_event;
-		struct msm_isp_event_ctrl *k_isp_event;
-		struct msm_device_queue *queue;
-		void __user *u_ctrl_value = NULL;
-		if (copy_from_user(&u_isp_event,
-			(void __user *)ioctl_ptr->ioctl_ptr,
-			sizeof(struct msm_isp_event_ctrl))) {
-			pr_err("%s Copy from user failed for cmd %d",
-				__func__, cmd);
-			rc = -EINVAL;
-			return rc;
-		}
-
-		mutex_lock(&g_server_dev.server_queue_lock);
-		if (!g_server_dev.server_queue
-			[u_isp_event.isp_data.ctrl.queue_idx].queue_active) {
-			pr_err("%s: Invalid queue\n", __func__);
-			mutex_unlock(&g_server_dev.server_queue_lock);
-			rc = -EINVAL;
-			return rc;
-		}
-		queue = &g_server_dev.server_queue
-			[u_isp_event.isp_data.ctrl.queue_idx].eventData_q;
-		event_cmd = msm_dequeue(queue, list_eventdata);
-		if (!event_cmd) {
-			pr_err("%s: No event payload\n", __func__);
-			rc = -EINVAL;
-			mutex_unlock(&g_server_dev.server_queue_lock);
-			return rc;
-		}
-		k_isp_event = (struct msm_isp_event_ctrl *)
-				event_cmd->command;
-		free_qcmd(event_cmd);
-
-		/* Save the pointer of the user allocated command buffer*/
-		u_ctrl_value = u_isp_event.isp_data.ctrl.value;
-
-		/* Copy the event structure into user struct*/
-		u_isp_event = *k_isp_event;
-
-		/* Restore the saved pointer of the user
-		 * allocated command buffer. */
-		u_isp_event.isp_data.ctrl.value = u_ctrl_value;
-
-		/* Copy the ctrl cmd, if present*/
-		if (k_isp_event->isp_data.ctrl.length > 0 &&
-			k_isp_event->isp_data.ctrl.value != NULL) {
-			void *k_ctrl_value =
-				k_isp_event->isp_data.ctrl.value;
-			if (copy_to_user(u_ctrl_value, k_ctrl_value,
-				 k_isp_event->isp_data.ctrl.length)) {
-				pr_err("%s Copy to user failed for cmd %d",
-					__func__, cmd);
-				kfree(k_isp_event->isp_data.ctrl.value);
-				kfree(k_isp_event);
-				rc = -EINVAL;
-				mutex_unlock(&g_server_dev.server_queue_lock);
-				break;
-			}
-			kfree(k_isp_event->isp_data.ctrl.value);
-		}
-		if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
-			&u_isp_event, sizeof(struct msm_isp_event_ctrl))) {
-			pr_err("%s Copy to user failed for cmd %d",
-				__func__, cmd);
-			kfree(k_isp_event);
-			mutex_unlock(&g_server_dev.server_queue_lock);
-			rc = -EINVAL;
-			return rc;
-		}
-		kfree(k_isp_event);
-		mutex_unlock(&g_server_dev.server_queue_lock);
-		rc = 0;
-		break;
-	}
-
-	case MSM_CAM_IOCTL_SEND_EVENT:
-		rc = msm_server_send_v4l2_evt(arg);
-		break;
-
-	case MSM_CAM_IOCTL_V4L2_EVT_NATIVE_CMD:
-		rc = 0;
-		break;
-	case MSM_CAM_IOCTL_V4L2_EVT_NATIVE_FRONT_CMD:
-		rc = 0;
-		break;
-
-	default:
-		pr_err("%s: Invalid IOCTL = %d", __func__, cmd);
-		break;
-	}
-	return rc;
-}
-
-static int msm_open_server(struct file *fp)
-{
-	int rc = 0;
-	D("%s: open %s\n", __func__, fp->f_path.dentry->d_name.name);
-	mutex_lock(&g_server_dev.server_lock);
-	g_server_dev.use_count++;
-	if (g_server_dev.use_count == 1)
-		fp->private_data =
-			&g_server_dev.server_command_queue.eventHandle;
-	mutex_unlock(&g_server_dev.server_lock);
-	return rc;
-}
-
-static int msm_close_server(struct file *fp)
-{
-	struct v4l2_event_subscription sub;
-	D("%s\n", __func__);
-	mutex_lock(&g_server_dev.server_lock);
-	if (g_server_dev.use_count > 0)
-		g_server_dev.use_count--;
-	mutex_unlock(&g_server_dev.server_lock);
-
-	if (g_server_dev.use_count == 0) {
-		int i;
-		mutex_lock(&g_server_dev.server_lock);
-		for (i = 0; i < MAX_NUM_ACTIVE_CAMERA; i++) {
-			if (g_server_dev.pcam_active[i]) {
-				struct msm_cam_media_controller *pmctl = NULL;
-
-				pmctl = msm_cam_server_get_mctl(
-				g_server_dev.pcam_active[i]->mctl_handle);
-				if (pmctl && pmctl->mctl_release) {
-					pmctl->mctl_release(pmctl);
-					/*so that it isn't closed again*/
-					pmctl->mctl_release = NULL;
-				}
-				if (pmctl)
-					msm_cam_server_send_error_evt(pmctl,
-						V4L2_EVENT_PRIVATE_START +
-						MSM_CAM_APP_NOTIFY_ERROR_EVENT);
-			}
-		}
-		sub.type = V4L2_EVENT_ALL;
-		v4l2_event_unsubscribe(
-			&g_server_dev.server_command_queue.eventHandle, &sub);
-		mutex_unlock(&g_server_dev.server_lock);
-	}
-	return 0;
-}
-
-static unsigned int msm_poll_server(struct file *fp,
-					struct poll_table_struct *wait)
-{
-	int rc = 0;
-
-	D("%s\n", __func__);
-	poll_wait(fp,
-		 &g_server_dev.server_command_queue.eventHandle.wait,
-		 wait);
-	if (v4l2_event_pending(&g_server_dev.server_command_queue.eventHandle))
-		rc |= POLLPRI;
-
-	return rc;
-}
-
-int msm_server_get_usecount(void)
-{
-	return g_server_dev.use_count;
-}
-
-int msm_server_update_sensor_info(struct msm_cam_v4l2_device *pcam,
-	struct msm_camera_sensor_info *sdata)
-{
-	int rc = 0;
-
-	if (!pcam || !sdata) {
-		pr_err("%s Input data is null ", __func__);
-		return -EINVAL;
-	}
-
-	g_server_dev.camera_info.video_dev_name
-	[g_server_dev.camera_info.num_cameras]
-	= video_device_node_name(pcam->pvdev);
-	D("%s Connected video device %s\n", __func__,
-		g_server_dev.camera_info.video_dev_name
-		[g_server_dev.camera_info.num_cameras]);
-
-	g_server_dev.camera_info.s_mount_angle
-	[g_server_dev.camera_info.num_cameras]
-	= sdata->sensor_platform_info->mount_angle;
-
-	g_server_dev.camera_info.is_internal_cam
-	[g_server_dev.camera_info.num_cameras]
-	= sdata->camera_type;
-
-	g_server_dev.mctl_node_info.mctl_node_name
-	[g_server_dev.mctl_node_info.num_mctl_nodes]
-	= video_device_node_name(pcam->mctl_node.pvdev);
-
-	pr_info("%s mctl_node_name[%d] = %s\n", __func__,
-		g_server_dev.mctl_node_info.num_mctl_nodes,
-		g_server_dev.mctl_node_info.mctl_node_name
-		[g_server_dev.mctl_node_info.num_mctl_nodes]);
-
-	/*Temporary solution to store info in media device structure
-	  until we can expand media device structure to support more
-	  device info*/
-	snprintf(pcam->media_dev.serial,
-			sizeof(pcam->media_dev.serial),
-			"%s-%d-%d-%d", QCAMERA_NAME,
-			sdata->sensor_platform_info->mount_angle,
-			sdata->camera_type,sdata->sensor_type);
-
-	g_server_dev.camera_info.num_cameras++;
-	g_server_dev.mctl_node_info.num_mctl_nodes++;
-
-	D("%s done, rc = %d\n", __func__, rc);
-	D("%s number of sensors connected is %d\n", __func__,
-		g_server_dev.camera_info.num_cameras);
-
-	return rc;
-}
-
-int msm_server_begin_session(struct msm_cam_v4l2_device *pcam,
-	int server_q_idx)
-{
-	int rc = -EINVAL, ges_evt;
-	struct msm_cam_server_queue *queue;
-	struct msm_cam_media_controller *pmctl;
-
-	if (!pcam) {
-		pr_err("%s pcam passed is null ", __func__);
-		return rc;
-	}
-
-	ges_evt = MSM_V4L2_GES_CAM_OPEN;
-	D("%s send gesture evt\n", __func__);
-	msm_cam_server_subdev_notify(g_server_dev.gesture_device,
-		NOTIFY_GESTURE_CAM_EVT, &ges_evt);
-
-	pcam->server_queue_idx = server_q_idx;
-	queue = &g_server_dev.server_queue[server_q_idx];
-	queue->ctrl_data = kzalloc(sizeof(uint8_t) *
-			MAX_SERVER_PAYLOAD_LENGTH, GFP_KERNEL);
-	if (queue->ctrl_data == NULL) {
-		pr_err("%s: Could not allocate memory\n", __func__);
-		rc = -ENOMEM;
-		goto error;
-	}
-	msm_queue_init(&queue->ctrl_q, "control");
-	msm_queue_init(&queue->eventData_q, "eventdata");
-	queue->queue_active = 1;
-	rc = msm_cam_server_open_session(&g_server_dev, pcam);
-	if (rc < 0) {
-		pr_err("%s: cam_server_open_session failed %d\n",
-			__func__, rc);
-		goto error;
-	}
-
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-	if (!pmctl) {
-		pr_err("%s: invalid mctl controller", __func__);
-		goto error;
-	}
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-		pmctl->domain = msm_cam_server_get_domain();
-		pmctl->domain_num = msm_cam_server_get_domain_num();
-#endif
-	rc = map_imem_addresses(pmctl);
-	if (rc < 0) {
-		pr_err("%sFailed to map imem addresses %d\n", __func__, rc);
-		goto error;
-	}
-
-	return rc;
-error:
-	ges_evt = MSM_V4L2_GES_CAM_CLOSE;
-	msm_cam_server_subdev_notify(g_server_dev.gesture_device,
-		NOTIFY_GESTURE_CAM_EVT, &ges_evt);
-
-	queue->queue_active = 0;
-	msm_drain_eventq(&queue->eventData_q);
-	msm_queue_drain(&queue->ctrl_q, list_control);
-	kfree(queue->ctrl_data);
-	queue->ctrl_data = NULL;
-	queue = NULL;
-	return rc;
-}
-
-int msm_server_end_session(struct msm_cam_v4l2_device *pcam)
-{
-	int rc = -EINVAL, ges_evt;
-	struct msm_cam_server_queue *queue;
-	struct msm_cam_media_controller *pmctl;
-
-	mutex_lock(&g_server_dev.server_queue_lock);
-	queue = &g_server_dev.server_queue[pcam->server_queue_idx];
-	queue->queue_active = 0;
-	kfree(queue->ctrl_data);
-	queue->ctrl_data = NULL;
-	msm_queue_drain(&queue->ctrl_q, list_control);
-	msm_drain_eventq(&queue->eventData_q);
-	mutex_unlock(&g_server_dev.server_queue_lock);
-
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-	if (!pmctl) {
-		pr_err("%s: invalid mctl controller", __func__);
-		return -EINVAL;
-	}
-	unmap_imem_addresses(pmctl);
-
-	rc = msm_cam_server_close_session(&g_server_dev, pcam);
-	if (rc < 0)
-		pr_err("msm_cam_server_close_session fails %d\n", rc);
-
-	ges_evt = MSM_V4L2_GES_CAM_CLOSE;
-	msm_cam_server_subdev_notify(g_server_dev.gesture_device,
-			NOTIFY_GESTURE_CAM_EVT, &ges_evt);
-
-	return rc;
-}
-
-/* Init a config node for ISP control,
- * which will create a config device (/dev/config0/ and plug in
- * ISP's operation "v4l2_ioctl_ops*"
- */
-static const struct v4l2_file_operations msm_fops_server = {
-	.owner = THIS_MODULE,
-	.open  = msm_open_server,
-	.poll  = msm_poll_server,
-	.unlocked_ioctl = video_ioctl2,
-	.release = msm_close_server,
-};
-
-static const struct v4l2_ioctl_ops msm_ioctl_ops_server = {
-	.vidioc_subscribe_event = msm_server_v4l2_subscribe_event,
-	.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
-	.vidioc_default = msm_ioctl_server,
-};
-
-static uint32_t msm_camera_server_find_mctl(
-		unsigned int notification, void *arg)
-{
-	int i;
-	uint32_t interface;
-	switch (notification) {
-	case NOTIFY_ISP_MSG_EVT:
-		if (((struct isp_msg_event *)arg)->msg_id ==
-			MSG_ID_RDI0_UPDATE_ACK)
-			interface = RDI_0;
-		else if (((struct isp_msg_event *)arg)->msg_id ==
-			MSG_ID_RDI1_UPDATE_ACK)
-			interface = RDI_1;
-		else if (((struct isp_msg_event *)arg)->msg_id ==
-			MSG_ID_RDI2_UPDATE_ACK)
-			interface = RDI_2;
-		else
-			interface = PIX_0;
-		break;
-	case NOTIFY_VFE_MSG_OUT:
-		if (((struct isp_msg_output *)arg)->output_id ==
-					MSG_ID_OUTPUT_TERTIARY1)
-			interface = RDI_0;
-		else if (((struct isp_msg_output *)arg)->output_id ==
-						MSG_ID_OUTPUT_TERTIARY2)
-			interface = RDI_1;
-		else if (((struct isp_msg_output *)arg)->output_id ==
-						MSG_ID_OUTPUT_TERTIARY3)
-			interface = RDI_2;
-		else
-			interface = PIX_0;
-		break;
-	case NOTIFY_VFE_BUF_EVT: {
-		struct msm_vfe_resp *rp;
-		struct msm_frame_info *frame_info;
-		uint8_t vnode_id;
-
-		rp = (struct msm_vfe_resp *)arg;
-		frame_info = rp->evt_msg.data;
-		if (frame_info->inst_handle) {
-			vnode_id = GET_DEVID_MODE(frame_info->inst_handle);
-			if (vnode_id < MAX_NUM_ACTIVE_CAMERA &&
-				g_server_dev.opened_pcam[vnode_id]) {
-				return g_server_dev.
-					opened_pcam[vnode_id]->mctl_handle;
-			} else {
-				pr_err("%s: cannot find mctl handle", __func__);
-				return 0;
-			}
-		} else {
-			if (frame_info->path == VFE_MSG_OUTPUT_TERTIARY1)
-				interface = RDI_0;
-			else if (frame_info->path == VFE_MSG_OUTPUT_TERTIARY2)
-				interface = RDI_1;
-			else if (frame_info->path == VFE_MSG_OUTPUT_TERTIARY3)
-				interface = RDI_2;
-			else
-				interface = PIX_0;
-		}
-		}
-		break;
-	case NOTIFY_AXI_RDI_SOF_COUNT: {
-		struct rdi_count_msg *msg = (struct rdi_count_msg *)arg;
-		interface = msg->rdi_interface;
-		}
-		break;
-	case NOTIFY_VFE_MSG_STATS:
-	case NOTIFY_VFE_MSG_COMP_STATS:
-	case NOTIFY_VFE_CAMIF_ERROR:
-	default:
-		interface = PIX_0;
-		break;
-	}
-	for (i = 0; i < INTF_MAX; i++) {
-		if (interface == g_server_dev.interface_map_table[i].interface)
-			break;
-	}
-	if (i == INTF_MAX) {
-		pr_err("%s: Cannot find valid interface map\n", __func__);
-		return -EINVAL;
-	} else
-		return g_server_dev.interface_map_table[i].mctl_handle;
-}
-
-static void msm_cam_server_subdev_notify(struct v4l2_subdev *sd,
-				unsigned int notification, void *arg)
-{
-	int rc = -EINVAL;
-	uint32_t mctl_handle = 0;
-	struct msm_cam_media_controller *p_mctl = NULL;
-	int is_gesture_evt =
-		(notification == NOTIFY_GESTURE_EVT)
-		|| (notification == NOTIFY_GESTURE_CAM_EVT);
-
-	if (!is_gesture_evt) {
-		mctl_handle = msm_camera_server_find_mctl(notification, arg);
-		if (mctl_handle < 0) {
-			pr_err("%s: Couldn't find mctl instance!\n", __func__);
-			return;
-		}
-	}
-	switch (notification) {
-	case NOTIFY_ISP_MSG_EVT:
-	case NOTIFY_VFE_MSG_OUT:
-	case NOTIFY_VFE_PIX_SOF_COUNT:
-	case NOTIFY_VFE_MSG_STATS:
-	case NOTIFY_VFE_MSG_COMP_STATS:
-	case NOTIFY_VFE_BUF_EVT:
-		p_mctl = msm_cam_server_get_mctl(mctl_handle);
-		if (p_mctl == NULL) {
-			pr_err("%s: Not find p_mctl instance!\n", __func__);
-			return;
-		}
-		if (p_mctl && p_mctl->isp_notify && p_mctl->vfe_sdev)
-			rc = p_mctl->isp_notify(p_mctl,
-				p_mctl->vfe_sdev, notification, arg);
-		break;
-	case NOTIFY_VFE_IRQ:{
-		struct msm_vfe_cfg_cmd cfg_cmd;
-		struct msm_camvfe_params vfe_params;
-		cfg_cmd.cmd_type = CMD_VFE_PROCESS_IRQ;
-		vfe_params.vfe_cfg = &cfg_cmd;
-		vfe_params.data = arg;
-		rc = v4l2_subdev_call(sd,
-			core, ioctl, 0, &vfe_params);
-	}
-		break;
-	case NOTIFY_AXI_IRQ:
-		rc = v4l2_subdev_call(sd, core, ioctl, VIDIOC_MSM_AXI_IRQ, arg);
-		break;
-	case NOTIFY_AXI_RDI_SOF_COUNT:
-		p_mctl = msm_cam_server_get_mctl(mctl_handle);
-		if (p_mctl && p_mctl->axi_sdev)
-			rc = v4l2_subdev_call(p_mctl->axi_sdev, core, ioctl,
-				VIDIOC_MSM_AXI_RDI_COUNT_UPDATE, arg);
-		break;
-	case NOTIFY_PCLK_CHANGE:
-		p_mctl = v4l2_get_subdev_hostdata(sd);
-		if (p_mctl) {
-			if (p_mctl->axi_sdev)
-				rc = v4l2_subdev_call(p_mctl->axi_sdev, video,
-				s_crystal_freq, *(uint32_t *)arg, 0);
-			else
-				rc = v4l2_subdev_call(p_mctl->vfe_sdev, video,
-				s_crystal_freq, *(uint32_t *)arg, 0);
-		}
-		break;
-	case NOTIFY_GESTURE_EVT:
-		rc = v4l2_subdev_call(g_server_dev.gesture_device,
-			core, ioctl, VIDIOC_MSM_GESTURE_EVT, arg);
-		break;
-	case NOTIFY_GESTURE_CAM_EVT:
-		rc = v4l2_subdev_call(g_server_dev.gesture_device,
-			core, ioctl, VIDIOC_MSM_GESTURE_CAM_EVT, arg);
-		break;
-	case NOTIFY_VFE_CAMIF_ERROR: {
-		p_mctl = msm_cam_server_get_mctl(mctl_handle);
-		if (p_mctl)
-			msm_cam_server_send_error_evt(p_mctl,
-				V4L2_EVENT_PRIVATE_START +
-				MSM_CAM_APP_NOTIFY_ERROR_EVENT);
-		break;
-	}
-	default:
-		break;
-	}
-
-	return;
-}
-
-void msm_cam_release_subdev_node(struct video_device *vdev)
-{
-	struct v4l2_subdev *sd = video_get_drvdata(vdev);
-	sd->devnode = NULL;
-	kfree(vdev);
-}
-
-/* Helper function to get the irq_idx corresponding
- * to the irq_num. */
-int get_irq_idx_from_irq_num(int irq_num)
-{
-	int i;
-	for (i = 0; i < CAMERA_SS_IRQ_MAX; i++)
-		if (irq_num == g_server_dev.hw_irqmap[i].irq_num)
-			return g_server_dev.hw_irqmap[i].irq_idx;
-
-	return -EINVAL;
-}
-
-static struct v4l2_subdev  *msm_cam_find_subdev_node(
-	struct v4l2_subdev **sd_list, u32 revision_num)
-{
-	int i = 0;
-	for (i = 0; sd_list[i] != NULL; i++) {
-		if (sd_list[i]->entity.revision == revision_num) {
-			return sd_list[i];
-			break;
-		}
-	}
-	return NULL;
-}
-
-int msm_mctl_find_sensor_subdevs(struct msm_cam_media_controller *p_mctl,
-	int core_index)
-{
-	int rc = -ENODEV;
-
-	v4l2_set_subdev_hostdata(p_mctl->sensor_sdev, p_mctl);
-
-	rc = msm_csi_register_subdevs(p_mctl, core_index, &g_server_dev);
-	if (rc < 0)
-		pr_err("%s: Could not find sensor subdevs\n", __func__);
-
-	return rc;
-}
-
-static irqreturn_t msm_camera_server_parse_irq(int irq_num, void *data)
-{
-	unsigned long flags;
-	int irq_idx, i, rc;
-	u32 status = 0;
-	struct intr_table_entry *ind_irq_tbl;
-	struct intr_table_entry *comp_irq_tbl;
-	bool subdev_handled = 0;
-
-	irq_idx = get_irq_idx_from_irq_num(irq_num);
-	if (irq_idx < 0) {
-		pr_err("server_parse_irq: no clients for irq #%d. returning ",
-			irq_num);
-		return IRQ_HANDLED;
-	}
-
-	spin_lock_irqsave(&g_server_dev.intr_table_lock, flags);
-	ind_irq_tbl = &g_server_dev.irq_lkup_table.ind_intr_tbl[0];
-	comp_irq_tbl = &g_server_dev.irq_lkup_table.comp_intr_tbl[0];
-	if (ind_irq_tbl[irq_idx].is_composite) {
-		for (i = 0; i < comp_irq_tbl[irq_idx].num_hwcore; i++) {
-			if (comp_irq_tbl[irq_idx].subdev_list[i]) {
-				rc = v4l2_subdev_call(
-					comp_irq_tbl[irq_idx].subdev_list[i],
-					core, interrupt_service_routine,
-					status, &subdev_handled);
-				if ((rc < 0) || !subdev_handled) {
-					pr_err("server_parse_irq:Error\n"
-						"handling irq %d rc = %d",
-						irq_num, rc);
-					/* Dispatch the irq to the remaining
-					 * subdevs in the list. */
-					continue;
-				}
-			}
-		}
-	} else {
-		rc = v4l2_subdev_call(ind_irq_tbl[irq_idx].subdev_list[0],
-			core, interrupt_service_routine,
-			status, &subdev_handled);
-		if ((rc < 0) || !subdev_handled) {
-			pr_err("server_parse_irq: Error handling irq %d rc = %d",
-				irq_num, rc);
-			spin_unlock_irqrestore(&g_server_dev.intr_table_lock,
-				flags);
-			return IRQ_HANDLED;
-		}
-	}
-	spin_unlock_irqrestore(&g_server_dev.intr_table_lock, flags);
-	return IRQ_HANDLED;
-}
-
-/* Helper function to get the irq_idx corresponding
- * to the camera hwcore. This function should _only_
- * be invoked when the IRQ Router is configured
- * non-composite mode. */
-int get_irq_idx_from_camhw_idx(int cam_hw_idx)
-{
-	int i;
-	for (i = 0; i < MSM_CAM_HW_MAX; i++)
-		if (cam_hw_idx == g_server_dev.hw_irqmap[i].cam_hw_idx)
-			return g_server_dev.hw_irqmap[i].irq_idx;
-
-	return -EINVAL;
-}
-
-static inline void update_compirq_subdev_info(
-	struct intr_table_entry *irq_entry,
-	uint32_t cam_hw_mask, uint8_t cam_hw_id,
-	int *num_hwcore)
-{
-	if (cam_hw_mask & (0x1 << cam_hw_id)) {
-		/* If the mask has been set for this cam hwcore
-		 * update the subdev ptr......*/
-		irq_entry->subdev_list[cam_hw_id] =
-			g_server_dev.subdev_table[cam_hw_id];
-		(*num_hwcore)++;
-	} else {
-		/*....else, just clear it, so that the irq will
-		 * not be dispatched to this hw. */
-		irq_entry->subdev_list[cam_hw_id] = NULL;
-	}
-}
-
-static int msm_server_update_composite_irq_info(
-	struct intr_table_entry *irq_req)
-{
-	int num_hwcore = 0, rc = 0;
-	struct intr_table_entry *comp_irq_tbl =
-		&g_server_dev.irq_lkup_table.comp_intr_tbl[0];
-
-	comp_irq_tbl[irq_req->irq_idx].is_composite = 1;
-	comp_irq_tbl[irq_req->irq_idx].irq_trigger_type =
-		irq_req->irq_trigger_type;
-	comp_irq_tbl[irq_req->irq_idx].num_hwcore = irq_req->num_hwcore;
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_MICRO, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_CCI, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_CSI0, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_CSI1, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_CSI2, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_CSI3, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_ISPIF, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_CPP, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_VFE0, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_VFE1, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_JPEG0, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_JPEG1, &num_hwcore);
-
-	update_compirq_subdev_info(&comp_irq_tbl[irq_req->irq_idx],
-		irq_req->cam_hw_mask, MSM_CAM_HW_JPEG2, &num_hwcore);
-
-	if (num_hwcore != irq_req->num_hwcore) {
-		pr_warn("%s Mismatch!! requested cam hwcores: %d, Mask set %d",
-			__func__, irq_req->num_hwcore, num_hwcore);
-		rc = -EINVAL;
-	}
-	return rc;
-}
-
-int msm_cam_server_request_irq(void *arg)
-{
-	unsigned long flags;
-	int rc = 0;
-	struct intr_table_entry *irq_req =  (struct intr_table_entry *)arg;
-	struct intr_table_entry *ind_irq_tbl =
-		&g_server_dev.irq_lkup_table.ind_intr_tbl[0];
-	struct intr_table_entry *comp_irq_tbl =
-		&g_server_dev.irq_lkup_table.comp_intr_tbl[0];
-
-	if (!irq_req || !irq_req->irq_num || !irq_req->num_hwcore) {
-		pr_err("%s Invalid input ", __func__);
-		return -EINVAL;
-	}
-
-	if (!g_server_dev.irqr_device) {
-		/* This either means, the current target does not
-		 * have a IRQ Router hw or the IRQ Router device is
-		 * not probed yet. The latter should not happen.
-		 * In any case, just return back without updating
-		 * the interrupt lookup table. */
-		pr_info("%s IRQ Router hw is not present. ", __func__);
-		return -ENXIO;
-	}
-
-	if (irq_req->is_composite) {
-		if (irq_req->irq_idx >= CAMERA_SS_IRQ_0 &&
-				irq_req->irq_idx < CAMERA_SS_IRQ_MAX) {
-			spin_lock_irqsave(&g_server_dev.intr_table_lock, flags);
-			/* Update the composite irq information into
-			 * the composite irq lookup table.... */
-			if (msm_server_update_composite_irq_info(irq_req)) {
-				pr_err("%s Invalid configuration", __func__);
-				spin_unlock_irqrestore(
-					&g_server_dev.intr_table_lock, flags);
-				return -EINVAL;
-			}
-			spin_unlock_irqrestore(&g_server_dev.intr_table_lock,
-				flags);
-			/*...and then update the corresponding entry
-			 * in the individual irq lookup table to indicate
-			 * that this IRQ is a composite irq and needs to be
-			 * sent to multiple subdevs. */
-			ind_irq_tbl[irq_req->irq_idx].is_composite = 1;
-			rc = request_irq(comp_irq_tbl[irq_req->irq_idx].irq_num,
-				msm_camera_server_parse_irq,
-				irq_req->irq_trigger_type,
-				ind_irq_tbl[irq_req->irq_idx].dev_name,
-				ind_irq_tbl[irq_req->irq_idx].data);
-			if (rc < 0) {
-				pr_err("%s: request_irq failed for %s\n",
-					__func__, irq_req->dev_name);
-				return -EBUSY;
-			}
-		} else {
-			pr_err("%s Invalid irq_idx %d ",
-				__func__, irq_req->irq_idx);
-			return -EINVAL;
-		}
-	} else {
-		if (irq_req->cam_hw_idx >= MSM_CAM_HW_MICRO &&
-				irq_req->cam_hw_idx < MSM_CAM_HW_MAX) {
-			/* Update the irq information into
-			 * the individual irq lookup table.... */
-			irq_req->irq_idx =
-				get_irq_idx_from_camhw_idx(irq_req->cam_hw_idx);
-			if (irq_req->irq_idx < 0) {
-				pr_err("%s Invalid hw index %d ", __func__,
-					irq_req->cam_hw_idx);
-				return -EINVAL;
-			}
-			spin_lock_irqsave(&g_server_dev.intr_table_lock, flags);
-			/* Make sure the composite irq is not configured for
-			 * this IRQ already. */
-			BUG_ON(ind_irq_tbl[irq_req->irq_idx].is_composite);
-
-			ind_irq_tbl[irq_req->irq_idx] = *irq_req;
-			/* irq_num is stored inside the server's hw_irqmap
-			 * during the device subdevice registration. */
-			ind_irq_tbl[irq_req->irq_idx].irq_num =
-			g_server_dev.hw_irqmap[irq_req->irq_idx].irq_num;
-
-			/*...and clear the corresponding entry in the
-			 * compsoite irq lookup table to indicate that this
-			 * IRQ will only be dispatched to single subdev. */
-			memset(&comp_irq_tbl[irq_req->irq_idx], 0,
-					sizeof(struct intr_table_entry));
-			D("%s Saving Entry %d %d %d %p",
-			__func__,
-			ind_irq_tbl[irq_req->irq_idx].irq_num,
-			ind_irq_tbl[irq_req->irq_idx].cam_hw_idx,
-			ind_irq_tbl[irq_req->irq_idx].is_composite,
-			ind_irq_tbl[irq_req->irq_idx].subdev_list[0]);
-
-			spin_unlock_irqrestore(&g_server_dev.intr_table_lock,
-				flags);
-
-			rc = request_irq(ind_irq_tbl[irq_req->irq_idx].irq_num,
-				msm_camera_server_parse_irq,
-				irq_req->irq_trigger_type,
-				ind_irq_tbl[irq_req->irq_idx].dev_name,
-				ind_irq_tbl[irq_req->irq_idx].data);
-			if (rc < 0) {
-				pr_err("%s: request_irq failed for %s\n",
-					__func__, irq_req->dev_name);
-				return -EBUSY;
-			}
-		} else {
-			pr_err("%s Invalid hw index %d ", __func__,
-				irq_req->cam_hw_idx);
-			return -EINVAL;
-		}
-	}
-	D("%s Successfully requested for IRQ for device %s ", __func__,
-		irq_req->dev_name);
-	return rc;
-}
-
-int msm_cam_server_update_irqmap(
-	struct msm_cam_server_irqmap_entry *irqmap_entry)
-{
-	if (!irqmap_entry || (irqmap_entry->irq_idx < CAMERA_SS_IRQ_0 ||
-		irqmap_entry->irq_idx >= CAMERA_SS_IRQ_MAX)) {
-		pr_err("%s Invalid irqmap entry ", __func__);
-		return -EINVAL;
-	}
-	g_server_dev.hw_irqmap[irqmap_entry->irq_idx] = *irqmap_entry;
-	return 0;
-}
-
-static int msm_cam_server_register_subdev(struct v4l2_device *v4l2_dev,
-	struct v4l2_subdev *sd)
-{
-	int rc = 0;
-	struct video_device *vdev;
-
-	if (v4l2_dev == NULL || sd == NULL || !sd->name[0]) {
-		pr_err("%s Invalid input ", __func__);
-		return -EINVAL;
-	}
-
-	rc = v4l2_device_register_subdev(v4l2_dev, sd);
-	if (rc < 0) {
-		pr_err("%s v4l2 subdev register failed for %s ret = %d",
-			__func__, sd->name, rc);
-		return rc;
-	}
-
-	/* Register a device node for every subdev marked with the
-	 * V4L2_SUBDEV_FL_HAS_DEVNODE flag.
-	 */
-	if (!(sd->flags & V4L2_SUBDEV_FL_HAS_DEVNODE))
-		return rc;
-
-	vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
-	if (!vdev) {
-		pr_err("%s Not enough memory ", __func__);
-		rc = -ENOMEM;
-		goto clean_up;
-	}
-
-	video_set_drvdata(vdev, sd);
-	strlcpy(vdev->name, sd->name, sizeof(vdev->name));
-	vdev->v4l2_dev = v4l2_dev;
-	vdev->fops = &v4l2_subdev_fops;
-	vdev->release = msm_cam_release_subdev_node;
-	rc = __video_register_device(vdev, VFL_TYPE_SUBDEV, -1, 1,
-						  sd->owner);
-	if (rc < 0) {
-		pr_err("%s Error registering video device %s", __func__,
-			sd->name);
-		kfree(vdev);
-		goto clean_up;
-	}
-#if defined(CONFIG_MEDIA_CONTROLLER)
-	sd->entity.info.v4l.major = VIDEO_MAJOR;
-	sd->entity.info.v4l.minor = vdev->minor;
-#endif
-	sd->devnode = vdev;
-	return 0;
-
-clean_up:
-	if (sd->devnode)
-		video_unregister_device(sd->devnode);
-	return rc;
-}
-
-static int msm_cam_server_fill_sdev_irqnum(int cam_hw_idx,
-	int irq_num)
-{
-	int rc = 0, irq_idx;
-	irq_idx = get_irq_idx_from_camhw_idx(cam_hw_idx);
-	if (irq_idx < 0) {
-		pr_err("%s Invalid cam_hw_idx %d ", __func__, cam_hw_idx);
-		rc = -EINVAL;
-	} else {
-		g_server_dev.hw_irqmap[irq_idx].irq_num = irq_num;
-	}
-	return rc;
-}
-
-int msm_cam_register_subdev_node(struct v4l2_subdev *sd,
-	struct msm_cam_subdev_info *sd_info)
-{
-	int err = 0, cam_hw_idx;
-	uint8_t sdev_type, index;
-
-	sdev_type = sd_info->sdev_type;
-	index     = sd_info->sd_index;
-
-	switch (sdev_type) {
-	case SENSOR_DEV:
-		if (index >= MAX_NUM_SENSOR_DEV) {
-			pr_err("%s Invalid sensor idx %d", __func__, index);
-			err = -EINVAL;
-			break;
-		}
-		g_server_dev.sensor_device[index] = sd;
-		break;
-
-	case CSIPHY_DEV:
-		if (index >= MAX_NUM_CSIPHY_DEV) {
-			pr_err("%s Invalid CSIPHY idx %d", __func__, index);
-			err = -EINVAL;
-			break;
-		}
-		g_server_dev.csiphy_device[index] = sd;
-		break;
-
-	case CSID_DEV:
-		if (index >= MAX_NUM_CSID_DEV) {
-			pr_err("%s Invalid CSID idx %d", __func__, index);
-			err = -EINVAL;
-			break;
-		}
-		cam_hw_idx = MSM_CAM_HW_CSI0 + index;
-		g_server_dev.csid_device[index] = sd;
-		if (g_server_dev.irqr_device) {
-			g_server_dev.subdev_table[cam_hw_idx] = sd;
-			err = msm_cam_server_fill_sdev_irqnum(cam_hw_idx,
-				sd_info->irq_num);
-		}
-		break;
-
-	case CSIC_DEV:
-		if (index >= MAX_NUM_CSIC_DEV) {
-			pr_err("%s Invalid CSIC idx %d", __func__, index);
-			err = -EINVAL;
-			break;
-		}
-		g_server_dev.csic_device[index] = sd;
-		break;
-
-	case ISPIF_DEV:
-		if (index >= MAX_NUM_ISPIF_DEV) {
-			pr_err("%s Invalid ISPIF idx %d", __func__, index);
-			err = -EINVAL;
-			break;
-		}
-		cam_hw_idx = MSM_CAM_HW_ISPIF + index;
-		g_server_dev.ispif_device[index] = sd;
-		if (g_server_dev.irqr_device) {
-			g_server_dev.subdev_table[cam_hw_idx] = sd;
-			err = msm_cam_server_fill_sdev_irqnum(cam_hw_idx,
-				sd_info->irq_num);
-		}
-		break;
-
-	case VFE_DEV:
-		if (index >= MAX_NUM_VFE_DEV) {
-			pr_err("%s Invalid VFE idx %d", __func__, index);
-			err = -EINVAL;
-			break;
-		}
-		cam_hw_idx = MSM_CAM_HW_VFE0 + index;
-		g_server_dev.vfe_device[index] = sd;
-		if (g_server_dev.irqr_device) {
-			g_server_dev.subdev_table[cam_hw_idx] = sd;
-			err = msm_cam_server_fill_sdev_irqnum(cam_hw_idx,
-				sd_info->irq_num);
-		}
-		break;
-
-	case VPE_DEV:
-		if (index >= MAX_NUM_VPE_DEV) {
-			pr_err("%s Invalid VPE idx %d", __func__, index);
-			err = -EINVAL;
-			break;
-		}
-		g_server_dev.vpe_device[index] = sd;
-		break;
-
-	case AXI_DEV:
-		if (index >= MAX_NUM_AXI_DEV) {
-			pr_err("%s Invalid AXI idx %d", __func__, index);
-			err = -EINVAL;
-			break;
-		}
-		g_server_dev.axi_device[index] = sd;
-		break;
-
-	case GESTURE_DEV:
-		g_server_dev.gesture_device = sd;
-		break;
-
-	case IRQ_ROUTER_DEV:
-		g_server_dev.irqr_device = sd;
-
-	case CPP_DEV:
-		if (index >= MAX_NUM_CPP_DEV) {
-			pr_err("%s Invalid CPP idx %d", __func__, index);
-			err = -EINVAL;
-			break;
-		}
-		g_server_dev.cpp_device[index] = sd;
-		break;
-	case CCI_DEV:
-		g_server_dev.cci_device = sd;
-		if (g_server_dev.irqr_device) {
-			if (index >= MAX_NUM_CCI_DEV) {
-				pr_err("%s Invalid CCI idx %d", __func__,
-					index);
-				err = -EINVAL;
-				break;
-			}
-			cam_hw_idx = MSM_CAM_HW_CCI + index;
-			g_server_dev.subdev_table[cam_hw_idx] = sd;
-			err = msm_cam_server_fill_sdev_irqnum(MSM_CAM_HW_CCI,
-				sd_info->irq_num);
-		}
-		break;
-	default:
-		break;
-	}
-
-	if (err < 0)
-		return err;
-
-	err = msm_cam_server_register_subdev(&g_server_dev.v4l2_dev, sd);
-	return err;
-}
-
-#ifdef CONFIG_MSM_IOMMU
-static int camera_register_domain(void)
-{
-	struct msm_iova_partition camera_fw_partition = {
-		.start = SZ_128K,
-		.size = SZ_2G - SZ_128K,
-	};
-	struct msm_iova_layout camera_fw_layout = {
-		.partitions = &camera_fw_partition,
-		.npartitions = 1,
-		.client_name = "camera_isp",
-		.domain_flags = 0,
-	};
-
-	return msm_register_domain(&camera_fw_layout);
-}
-#endif
-
-static int msm_setup_server_dev(struct platform_device *pdev)
-{
-	int rc = -ENODEV, i;
-
-	D("%s\n", __func__);
-	g_server_dev.server_pdev = pdev;
-	g_server_dev.v4l2_dev.dev = &pdev->dev;
-	g_server_dev.v4l2_dev.notify = msm_cam_server_subdev_notify;
-	rc = v4l2_device_register(g_server_dev.v4l2_dev.dev,
-			&g_server_dev.v4l2_dev);
-	if (rc < 0)
-		return -EINVAL;
-
-	g_server_dev.video_dev = video_device_alloc();
-	if (g_server_dev.video_dev == NULL) {
-		pr_err("%s: video_device_alloc failed\n", __func__);
-		return rc;
-	}
-
-	strlcpy(g_server_dev.video_dev->name, pdev->name,
-			sizeof(g_server_dev.video_dev->name));
-
-	g_server_dev.video_dev->v4l2_dev = &g_server_dev.v4l2_dev;
-	g_server_dev.video_dev->fops = &msm_fops_server;
-	g_server_dev.video_dev->ioctl_ops = &msm_ioctl_ops_server;
-	g_server_dev.video_dev->release   = video_device_release;
-	g_server_dev.video_dev->minor = 100;
-	g_server_dev.video_dev->vfl_type = VFL_TYPE_GRABBER;
-
-	video_set_drvdata(g_server_dev.video_dev, &g_server_dev);
-
-	strlcpy(g_server_dev.media_dev.model, QCAMERA_SERVER_NAME,
-		sizeof(g_server_dev.media_dev.model));
-	g_server_dev.media_dev.dev = &pdev->dev;
-	rc = media_device_register(&g_server_dev.media_dev);
-	g_server_dev.v4l2_dev.mdev = &g_server_dev.media_dev;
-	media_entity_init(&g_server_dev.video_dev->entity, 0, NULL, 0);
-	g_server_dev.video_dev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;
-	g_server_dev.video_dev->entity.group_id = QCAMERA_VNODE_GROUP_ID;
-
-	rc = video_register_device(g_server_dev.video_dev,
-		VFL_TYPE_GRABBER, 100);
-
-	g_server_dev.video_dev->entity.name =
-		video_device_node_name(g_server_dev.video_dev);
-
-	mutex_init(&g_server_dev.server_lock);
-	mutex_init(&g_server_dev.server_queue_lock);
-	spin_lock_init(&g_server_dev.intr_table_lock);
-	memset(&g_server_dev.irq_lkup_table, 0,
-			sizeof(struct irqmgr_intr_lkup_table));
-	g_server_dev.camera_info.num_cameras = 0;
-	atomic_set(&g_server_dev.number_pcam_active, 0);
-	g_server_dev.server_evt_id = 0;
-
-	/*initialize fake video device and event queue*/
-
-	g_server_dev.server_command_queue.pvdev = g_server_dev.video_dev;
-	msm_setup_v4l2_event_queue(
-		&g_server_dev.server_command_queue.eventHandle,
-		g_server_dev.server_command_queue.pvdev);
-
-	for (i = 0; i < MAX_NUM_ACTIVE_CAMERA; i++) {
-		struct msm_cam_server_queue *queue;
-		queue = &g_server_dev.server_queue[i];
-		queue->queue_active = 0;
-		msm_queue_init(&queue->ctrl_q, "control");
-		msm_queue_init(&queue->eventData_q, "eventdata");
-		g_server_dev.pcam_active[i] = NULL;
-	}
-
-	for (i = 0; i < INTF_MAX; i++) {
-		g_server_dev.interface_map_table[i].interface = 0x01 << i;
-		g_server_dev.interface_map_table[i].mctl_handle = 0;
-	}
-#ifdef CONFIG_MSM_IOMMU
-	g_server_dev.domain_num = camera_register_domain();
-	if (g_server_dev.domain_num < 0) {
-		pr_err("%s: could not register domain\n", __func__);
-		rc = -ENODEV;
-		return rc;
-	}
-	g_server_dev.domain =
-		msm_get_iommu_domain(g_server_dev.domain_num);
-	if (!g_server_dev.domain) {
-		pr_err("%s: cannot find domain\n", __func__);
-		rc = -ENODEV;
-		return rc;
-	}
-#endif
-	return rc;
-}
-
-static long msm_server_send_v4l2_evt(void *evt)
-{
-	struct v4l2_event *v4l2_ev = (struct v4l2_event *)evt;
-	int rc = 0;
-
-	if (NULL == evt) {
-		pr_err("%s: evt is NULL\n", __func__);
-		return -EINVAL;
-	}
-
-	D("%s: evt type 0x%x\n", __func__, v4l2_ev->type);
-	if ((v4l2_ev->type >= MSM_GES_APP_EVT_MIN) &&
-		(v4l2_ev->type < MSM_GES_APP_EVT_MAX)) {
-		msm_cam_server_subdev_notify(g_server_dev.gesture_device,
-			NOTIFY_GESTURE_EVT, v4l2_ev);
-	} else {
-		pr_err("%s: Invalid evt %d\n", __func__, v4l2_ev->type);
-		rc = -EINVAL;
-	}
-	D("%s: end\n", __func__);
-
-	return rc;
-}
-
-int msm_cam_server_open_mctl_session(struct msm_cam_v4l2_device *pcam,
-	int *p_active)
-{
-	int rc = 0;
-	int i = 0;
-	struct msm_cam_media_controller *pmctl = NULL;
-	*p_active = 0;
-
-	for (i = 0; i < MAX_NUM_ACTIVE_CAMERA; i++) {
-		if (NULL != g_server_dev.pcam_active[i]) {
-			pr_info("%s: Active camera present return", __func__);
-			return 0;
-		}
-	}
-
-	rc = msm_cam_server_open_session(&g_server_dev, pcam);
-	if (rc < 0) {
-		pr_err("%s: cam_server_open_session failed %d\n",
-		__func__, rc);
-		return rc;
-	}
-
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-	if (!pmctl || !pmctl->mctl_open) {
-		D("%s: media contoller is not inited\n",
-			 __func__);
-		rc = -ENODEV;
-		return rc;
-	}
-
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-		pmctl->domain = msm_cam_server_get_domain();
-		pmctl->domain_num = msm_cam_server_get_domain_num();
-#endif
-
-	D("%s: call mctl_open\n", __func__);
-	rc = pmctl->mctl_open(pmctl, MSM_APPS_ID_V4L2);
-
-	if (rc < 0) {
-		pr_err("%s: HW open failed rc = 0x%x\n",  __func__, rc);
-		return rc;
-	}
-	pmctl->pcam_ptr = pcam;
-	*p_active = 1;
-	return rc;
-}
-
-int msm_cam_server_close_mctl_session(struct msm_cam_v4l2_device *pcam)
-{
-	int rc = 0;
-	struct msm_cam_media_controller *pmctl = NULL;
-
-	pmctl = msm_cam_server_get_mctl(pcam->mctl_handle);
-	if (!pmctl) {
-		D("%s: invalid handle\n", __func__);
-		return -ENODEV;
-	}
-
-	if (pmctl->mctl_release) {
-		pmctl->mctl_release(pmctl);
-		pmctl->mctl_release = NULL;
-	}
-
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	kref_put(&pmctl->refcount, msm_release_ion_client);
-#endif
-
-	rc = msm_cam_server_close_session(&g_server_dev, pcam);
-	if (rc < 0)
-		pr_err("msm_cam_server_close_session fails %d\n", rc);
-
-	return rc;
-}
-
-int msm_server_open_client(int *p_qidx)
-{
-	int rc = 0;
-	int server_q_idx = 0;
-	struct msm_cam_server_queue *queue = NULL;
-
-	mutex_lock(&g_server_dev.server_lock);
-	server_q_idx = msm_find_free_queue();
-	if (server_q_idx < 0) {
-		mutex_unlock(&g_server_dev.server_lock);
-		return server_q_idx;
-	}
-
-	*p_qidx = server_q_idx;
-	queue = &g_server_dev.server_queue[server_q_idx];
-	queue->ctrl_data = kzalloc(sizeof(uint8_t) *
-		MAX_SERVER_PAYLOAD_LENGTH, GFP_KERNEL);
-	if (!queue->ctrl_data) {
-		pr_err("%s: Could not find memory\n", __func__);
-		mutex_unlock(&g_server_dev.server_lock);
-		return -ENOMEM;
-	}
-	msm_queue_init(&queue->ctrl_q, "control");
-	msm_queue_init(&queue->eventData_q, "eventdata");
-	queue->queue_active = 1;
-	mutex_unlock(&g_server_dev.server_lock);
-	return rc;
-}
-
-int msm_server_send_ctrl(struct msm_ctrl_cmd *out,
-	int ctrl_id)
-{
-	int rc = 0;
-	void *value;
-	struct msm_queue_cmd *rcmd;
-	struct msm_queue_cmd *event_qcmd;
-	struct msm_ctrl_cmd *ctrlcmd;
-	struct msm_cam_server_dev *server_dev = &g_server_dev;
-	struct msm_device_queue *queue =
-		&server_dev->server_queue[out->queue_idx].ctrl_q;
-
-	struct v4l2_event v4l2_evt;
-	struct msm_isp_event_ctrl *isp_event;
-	void *ctrlcmd_data;
-
-	event_qcmd = kzalloc(sizeof(struct msm_queue_cmd), GFP_KERNEL);
-	if (!event_qcmd) {
-		pr_err("%s Insufficient memory. return", __func__);
-		rc = -ENOMEM;
-		goto event_qcmd_alloc_fail;
-	}
-
-	isp_event = kzalloc(sizeof(struct msm_isp_event_ctrl), GFP_KERNEL);
-	if (!isp_event) {
-		pr_err("%s Insufficient memory. return", __func__);
-		rc = -ENOMEM;
-		goto isp_event_alloc_fail;
-	}
-
-	D("%s\n", __func__);
-	mutex_lock(&server_dev->server_queue_lock);
-	if (++server_dev->server_evt_id == 0)
-		server_dev->server_evt_id++;
-
-	D("%s qid %d evtid %d\n", __func__, out->queue_idx,
-		server_dev->server_evt_id);
-	server_dev->server_queue[out->queue_idx].evt_id =
-		server_dev->server_evt_id;
-	v4l2_evt.type = V4L2_EVENT_PRIVATE_START + ctrl_id;
-	v4l2_evt.id = 0;
-	v4l2_evt.u.data[0] = out->queue_idx;
-	/* setup event object to transfer the command; */
-	isp_event->resptype = MSM_CAM_RESP_V4L2;
-	isp_event->isp_data.ctrl = *out;
-	isp_event->isp_data.ctrl.evt_id = server_dev->server_evt_id;
-
-	if (out->value != NULL && out->length != 0) {
-		ctrlcmd_data = kzalloc(out->length, GFP_KERNEL);
-		if (!ctrlcmd_data) {
-			rc = -ENOMEM;
-			goto ctrlcmd_alloc_fail;
-		}
-		memcpy(ctrlcmd_data, out->value, out->length);
-		isp_event->isp_data.ctrl.value = ctrlcmd_data;
-	}
-
-	atomic_set(&event_qcmd->on_heap, 1);
-	event_qcmd->command = isp_event;
-
-	msm_enqueue(&server_dev->server_queue[out->queue_idx].eventData_q,
-				&event_qcmd->list_eventdata);
-
-	/* now send command to config thread in userspace,
-	 * and wait for results */
-	v4l2_event_queue(server_dev->server_command_queue.pvdev,
-					  &v4l2_evt);
-	D("%s v4l2_event_queue: type = 0x%x\n", __func__, v4l2_evt.type);
-	mutex_unlock(&server_dev->server_queue_lock);
-
-	/* wait for config return status */
-	D("Waiting for config status\n");
-	rc = wait_event_interruptible_timeout(queue->wait,
-		!list_empty_careful(&queue->list),
-		msecs_to_jiffies(out->timeout_ms));
-	D("Waiting is over for config status\n");
-	if (list_empty_careful(&queue->list)) {
-		if (!rc)
-			rc = -ETIMEDOUT;
-		if (rc < 0) {
-			if (++server_dev->server_evt_id == 0)
-				server_dev->server_evt_id++;
-			pr_err("%s: wait_event error %d\n", __func__, rc);
-			return rc;
-		}
-	}
-
-	rcmd = msm_dequeue(queue, list_control);
-	BUG_ON(!rcmd);
-	D("%s Finished servicing ioctl\n", __func__);
-
-	ctrlcmd = (struct msm_ctrl_cmd *)(rcmd->command);
-	value = out->value;
-	if (ctrlcmd->length > 0 && value != NULL &&
-		ctrlcmd->length <= out->length)
-		memcpy(value, ctrlcmd->value, ctrlcmd->length);
-
-	memcpy(out, ctrlcmd, sizeof(struct msm_ctrl_cmd));
-	out->value = value;
-
-	kfree(ctrlcmd);
-	free_qcmd(rcmd);
-	D("%s: rc %d\n", __func__, rc);
-	/* rc is the time elapsed. */
-	if (rc >= 0) {
-		/* TODO: Refactor msm_ctrl_cmd::status field */
-		if (out->status == 0)
-			rc = -1;
-		else if (out->status == 1 || out->status == 4)
-			rc = 0;
-		else
-			rc = -EINVAL;
-	}
-	return rc;
-
-ctrlcmd_alloc_fail:
-	mutex_unlock(&server_dev->server_queue_lock);
-	kfree(isp_event);
-isp_event_alloc_fail:
-	kfree(event_qcmd);
-event_qcmd_alloc_fail:
-	return rc;
-}
-
-int msm_server_close_client(int idx)
-{
-	int rc = 0;
-	struct msm_cam_server_queue *queue = NULL;
-	mutex_lock(&g_server_dev.server_lock);
-	queue = &g_server_dev.server_queue[idx];
-	queue->queue_active = 0;
-	kfree(queue->ctrl_data);
-	queue->ctrl_data = NULL;
-	msm_queue_drain(&queue->ctrl_q, list_control);
-	msm_drain_eventq(&queue->eventData_q);
-	mutex_unlock(&g_server_dev.server_lock);
-	return rc;
-}
-
-static unsigned int msm_poll_config(struct file *fp,
-					struct poll_table_struct *wait)
-{
-	int rc = 0;
-	struct msm_cam_config_dev *config = fp->private_data;
-	if (config == NULL)
-		return -EINVAL;
-
-	D("%s\n", __func__);
-
-	poll_wait(fp,
-	&config->config_stat_event_queue.eventHandle.wait, wait);
-	if (v4l2_event_pending(&config->config_stat_event_queue.eventHandle))
-		rc |= POLLPRI;
-	return rc;
-}
-
-static int msm_open_config(struct inode *inode, struct file *fp)
-{
-	int rc;
-	struct msm_cam_config_dev *config_cam = container_of(inode->i_cdev,
-		struct msm_cam_config_dev, config_cdev);
-
-	D("%s: open %s\n", __func__, fp->f_path.dentry->d_name.name);
-
-	rc = nonseekable_open(inode, fp);
-	if (rc < 0) {
-		pr_err("%s: nonseekable_open error %d\n", __func__, rc);
-		return rc;
-	}
-	config_cam->use_count++;
-
-	/* assume there is only one active camera possible*/
-	if (!g_server_dev.pcam_active[config_cam->dev_num]) {
-		pr_err("%s: camera %d is not active\n", __func__, config_cam->dev_num);
-		config_cam->use_count--;
-		return -ENODEV;
-	}
-	config_cam->p_mctl = msm_cam_server_get_mctl(
-		g_server_dev.pcam_active[config_cam->dev_num]->mctl_handle);
-	if (!config_cam->p_mctl) {
-		pr_err("%s: cannot find mctl\n", __func__);
-		return -ENODEV;
-	}
-
-	INIT_HLIST_HEAD(&config_cam->p_mctl->stats_info.pmem_stats_list);
-	spin_lock_init(&config_cam->p_mctl->stats_info.pmem_stats_spinlock);
-
-	config_cam->p_mctl->config_device = config_cam;
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	kref_get(&config_cam->p_mctl->refcount);
-#endif
-	fp->private_data = config_cam;
-	return rc;
-}
-
-static int msm_set_mctl_subdev(struct msm_cam_media_controller *pmctl,
-	struct msm_mctl_set_sdev_data *set_data)
-{
-	int rc = 0;
-	struct v4l2_subdev *temp_sdev = NULL;
-	switch (set_data->sdev_type) {
-	case CSIPHY_DEV:
-		pmctl->csiphy_sdev = msm_cam_find_subdev_node
-			(&g_server_dev.csiphy_device[0], set_data->revision);
-		temp_sdev = pmctl->csiphy_sdev;
-		break;
-	case CSID_DEV:
-		pmctl->csid_sdev = msm_cam_find_subdev_node
-			(&g_server_dev.csid_device[0], set_data->revision);
-		temp_sdev = pmctl->csid_sdev;
-		break;
-	case CSIC_DEV:
-		pmctl->csic_sdev = msm_cam_find_subdev_node
-			(&g_server_dev.csic_device[0], set_data->revision);
-		temp_sdev = pmctl->csic_sdev;
-		break;
-	case ISPIF_DEV:
-		pmctl->ispif_sdev = msm_cam_find_subdev_node
-			(&g_server_dev.ispif_device[0], set_data->revision);
-		temp_sdev = pmctl->ispif_sdev;
-		break;
-	case VFE_DEV:
-		pmctl->vfe_sdev = msm_cam_find_subdev_node
-			(&g_server_dev.vfe_device[0], set_data->revision);
-		temp_sdev = pmctl->vfe_sdev;
-		break;
-	case AXI_DEV:
-		pmctl->axi_sdev = msm_cam_find_subdev_node
-			(&g_server_dev.axi_device[0], set_data->revision);
-		temp_sdev = pmctl->axi_sdev;
-		break;
-	case VPE_DEV:
-		pmctl->vpe_sdev = msm_cam_find_subdev_node
-			(&g_server_dev.vpe_device[0], set_data->revision);
-		temp_sdev = pmctl->vpe_sdev;
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	if (temp_sdev != NULL)
-		v4l2_set_subdev_hostdata(temp_sdev, pmctl);
-	else
-		pr_err("%s: Could not find subdev\n", __func__);
-	return rc;
-}
-
-static int msm_unset_mctl_subdev(struct msm_cam_media_controller *pmctl,
-	struct msm_mctl_set_sdev_data *set_data)
-{
-	int rc = 0;
-	switch (set_data->sdev_type) {
-	case CSIPHY_DEV:
-		pmctl->csiphy_sdev = NULL;
-		break;
-	case CSID_DEV:
-		pmctl->csid_sdev = NULL;
-		break;
-	case CSIC_DEV:
-		pmctl->csic_sdev = NULL;
-		break;
-	case ISPIF_DEV:
-		pmctl->ispif_sdev = NULL;
-		break;
-	case VFE_DEV:
-		pmctl->vfe_sdev = NULL;
-		break;
-	case AXI_DEV:
-		pmctl->axi_sdev = NULL;
-		break;
-	case VPE_DEV:
-		pmctl->vpe_sdev = NULL;
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-static long msm_ioctl_config(struct file *fp, unsigned int cmd,
-	unsigned long arg)
-{
-
-	int rc = 0;
-	struct v4l2_event ev;
-	struct msm_cam_config_dev *config_cam = fp->private_data;
-	struct v4l2_event_subscription temp_sub;
-
-	D("%s: cmd %d\n", __func__, _IOC_NR(cmd));
-	ev.id = 0;
-
-	switch (cmd) {
-	/* memory management shall be handeld here*/
-	case MSM_CAM_IOCTL_REGISTER_PMEM:
-		return msm_register_pmem(
-			&config_cam->p_mctl->stats_info.pmem_stats_list,
-			(void __user *)arg, config_cam->p_mctl->client,
-			config_cam->p_mctl->domain_num);
-		break;
-
-	case MSM_CAM_IOCTL_UNREGISTER_PMEM:
-		return msm_pmem_table_del(
-			&config_cam->p_mctl->stats_info.pmem_stats_list,
-			(void __user *)arg, config_cam->p_mctl->client,
-			config_cam->p_mctl->domain_num);
-		break;
-
-	case VIDIOC_SUBSCRIBE_EVENT:
-		if (copy_from_user(&temp_sub,
-			(void __user *)arg,
-			sizeof(struct v4l2_event_subscription))) {
-				pr_err("%s copy_from_user failed for cmd %d ",
-					__func__, cmd);
-				rc = -EINVAL;
-				return rc;
-		}
-		rc = msm_server_v4l2_subscribe_event
-			(&config_cam->config_stat_event_queue.eventHandle,
-				 &temp_sub);
-		if (rc < 0) {
-			pr_err("%s: cam_v4l2_subscribe_event failed rc=%d\n",
-				__func__, rc);
-			return rc;
-		}
-		break;
-
-	case VIDIOC_UNSUBSCRIBE_EVENT:
-		if (copy_from_user(&temp_sub, (void __user *)arg,
-			  sizeof(struct v4l2_event_subscription))) {
-			rc = -EINVAL;
-			return rc;
-		}
-		rc = msm_server_v4l2_unsubscribe_event
-			(&config_cam->config_stat_event_queue.eventHandle,
-			 &temp_sub);
-		if (rc < 0) {
-			pr_err("%s: cam_v4l2_unsubscribe_event failed rc=%d\n",
-				__func__, rc);
-			return rc;
-		}
-		break;
-
-	case VIDIOC_DQEVENT: {
-		void __user *u_msg_value = NULL, *user_ptr = NULL;
-		struct msm_isp_event_ctrl u_isp_event;
-		struct msm_isp_event_ctrl *k_isp_event;
-
-		/* First, copy the v4l2 event structure from userspace */
-		D("%s: VIDIOC_DQEVENT\n", __func__);
-		if (copy_from_user(&ev, (void __user *)arg,
-				sizeof(struct v4l2_event)))
-			break;
-		/* Next, get the pointer to event_ctrl structure
-		 * embedded inside the v4l2_event.u.data array. */
-		user_ptr = (void __user *)(*((uint32_t *)ev.u.data));
-
-		/* Next, copy the userspace event ctrl structure */
-		if (copy_from_user((void *)&u_isp_event, user_ptr,
-				   sizeof(struct msm_isp_event_ctrl))) {
-			rc = -EFAULT;
-			break;
-		}
-		/* Save the pointer of the user allocated command buffer*/
-		u_msg_value = u_isp_event.isp_data.isp_msg.data;
-
-		/* Dequeue the event queued into the v4l2 queue*/
-		rc = v4l2_event_dequeue(
-			&config_cam->config_stat_event_queue.eventHandle,
-			&ev, fp->f_flags & O_NONBLOCK);
-		if (rc < 0) {
-			pr_err("no pending events?");
-			rc = -EFAULT;
-			break;
-		}
-		/* Use k_isp_event to point to the event_ctrl structure
-		 * embedded inside v4l2_event.u.data */
-		k_isp_event = (struct msm_isp_event_ctrl *)
-				(*((uint32_t *)ev.u.data));
-		/* Copy the event structure into user struct. */
-		u_isp_event = *k_isp_event;
-		if (ev.type != (V4L2_EVENT_PRIVATE_START +
-				MSM_CAM_RESP_DIV_FRAME_EVT_MSG) &&
-				ev.type != (V4L2_EVENT_PRIVATE_START +
-				MSM_CAM_RESP_MCTL_PP_EVENT)) {
-
-			/* Restore the saved pointer of the
-			 * user allocated command buffer. */
-			u_isp_event.isp_data.isp_msg.data = u_msg_value;
-
-			if (ev.type == (V4L2_EVENT_PRIVATE_START +
-					MSM_CAM_RESP_STAT_EVT_MSG)) {
-				if (k_isp_event->isp_data.isp_msg.len > 0) {
-					void *k_msg_value =
-					k_isp_event->isp_data.isp_msg.data;
-					if (copy_to_user(u_msg_value,
-							k_msg_value,
-					 k_isp_event->isp_data.isp_msg.len)) {
-						rc = -EINVAL;
-						break;
-					}
-					kfree(k_msg_value);
-					k_isp_event->isp_data.isp_msg.len = 0;
-					k_isp_event->isp_data.isp_msg.data = 0;
-					k_msg_value = NULL;
-				}
-			}
-		}
-		/* Copy the event ctrl structure back
-		 * into user's structure. */
-		if (copy_to_user(user_ptr,
-				(void *)&u_isp_event, sizeof(
-				struct msm_isp_event_ctrl))) {
-			rc = -EINVAL;
-			break;
-		}
-		kfree(k_isp_event);
-		*((uint32_t *)ev.u.data) = 0;
-		k_isp_event = NULL;
-
-		/* Copy the v4l2_event structure back to the user*/
-		if (copy_to_user((void __user *)arg, &ev,
-				sizeof(struct v4l2_event))) {
-			rc = -EINVAL;
-			break;
-		}
-		}
-
-		break;
-
-	case MSM_CAM_IOCTL_V4L2_EVT_NOTIFY:
-		rc = msm_v4l2_evt_notify(config_cam->p_mctl, cmd, arg);
-		break;
-
-	case MSM_CAM_IOCTL_SET_MCTL_SDEV:{
-		struct msm_mctl_set_sdev_data set_data;
-		if (copy_from_user(&set_data, (void __user *)arg,
-			sizeof(struct msm_mctl_set_sdev_data))) {
-			ERR_COPY_FROM_USER();
-			rc = -EINVAL;
-			break;
-		}
-		rc = msm_set_mctl_subdev(config_cam->p_mctl, &set_data);
-		break;
-	}
-
-	case MSM_CAM_IOCTL_UNSET_MCTL_SDEV:{
-		struct msm_mctl_set_sdev_data set_data;
-		if (copy_from_user(&set_data, (void __user *)arg,
-			sizeof(struct msm_mctl_set_sdev_data))) {
-			ERR_COPY_FROM_USER();
-			rc = -EINVAL;
-			break;
-		}
-		rc = msm_unset_mctl_subdev(config_cam->p_mctl, &set_data);
-		break;
-	}
-
-	default:{
-		/* For the rest of config command, forward to media controller*/
-		struct msm_cam_media_controller *p_mctl = config_cam->p_mctl;
-		if (p_mctl && p_mctl->mctl_cmd) {
-			rc = config_cam->p_mctl->mctl_cmd(p_mctl, cmd, arg);
-		} else {
-			rc = -EINVAL;
-			pr_err("%s: media controller is null\n", __func__);
-		}
-
-		break;
-	} /* end of default*/
-	} /* end of switch*/
-	return rc;
-}
-
-static int msm_close_config(struct inode *node, struct file *f)
-{
-	struct v4l2_event_subscription sub;
-	struct msm_cam_config_dev *config_cam = f->private_data;
-
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	D("%s Decrementing ref count of config node ", __func__);
-	kref_put(&config_cam->p_mctl->refcount, msm_release_ion_client);
-#endif
-	sub.type = V4L2_EVENT_ALL;
-	msm_server_v4l2_unsubscribe_event(
-		&config_cam->config_stat_event_queue.eventHandle,
-		&sub);
-	return 0;
-}
-
-static const struct file_operations msm_fops_config = {
-	.owner = THIS_MODULE,
-	.open  = msm_open_config,
-	.poll  = msm_poll_config,
-	.unlocked_ioctl = msm_ioctl_config,
-	.release = msm_close_config,
-};
-
-static int msm_setup_config_dev(int node, char *device_name)
-{
-	int rc = -ENODEV;
-	struct device *device_config;
-	int dev_num = node;
-	dev_t devno;
-	struct msm_cam_config_dev *config_cam;
-
-	config_cam = kzalloc(sizeof(*config_cam), GFP_KERNEL);
-	if (!config_cam) {
-		pr_err("%s: could not allocate memory for config_device\n",
-			__func__);
-		return -ENOMEM;
-	}
-
-	D("%s\n", __func__);
-
-	devno = MKDEV(MAJOR(msm_devno), dev_num+1);
-	device_config = device_create(msm_class, NULL, devno, NULL, "%s%d",
-		device_name, dev_num);
-
-	if (IS_ERR(device_config)) {
-		rc = PTR_ERR(device_config);
-		pr_err("%s: error creating device: %d\n", __func__, rc);
-		goto config_setup_fail;
-	}
-
-	cdev_init(&config_cam->config_cdev, &msm_fops_config);
-	config_cam->config_cdev.owner = THIS_MODULE;
-
-	rc = cdev_add(&config_cam->config_cdev, devno, 1);
-	if (rc < 0) {
-		pr_err("%s: error adding cdev: %d\n", __func__, rc);
-		device_destroy(msm_class, devno);
-		goto config_setup_fail;
-	}
-	g_server_dev.config_info.config_dev_name[dev_num] =
-		dev_name(device_config);
-	D("%s Connected config device %s\n", __func__,
-		g_server_dev.config_info.config_dev_name[dev_num]);
-	g_server_dev.config_info.config_dev_id[dev_num] =
-		dev_num;
-
-	config_cam->config_stat_event_queue.pvdev = video_device_alloc();
-	if (config_cam->config_stat_event_queue.pvdev == NULL) {
-		pr_err("%s: video_device_alloc failed\n", __func__);
-		goto config_setup_fail;
-	}
-
-	/* v4l2_fh support */
-	spin_lock_init(&config_cam->config_stat_event_queue.pvdev->fh_lock);
-	INIT_LIST_HEAD(&config_cam->config_stat_event_queue.pvdev->fh_list);
-	msm_setup_v4l2_event_queue(
-		&config_cam->config_stat_event_queue.eventHandle,
-		config_cam->config_stat_event_queue.pvdev);
-	config_cam->dev_num = dev_num;
-
-	return rc;
-
-config_setup_fail:
-	kfree(config_cam);
-	return rc;
-}
-
-static int __devinit msm_camera_probe(struct platform_device *pdev)
-{
-	int rc = 0, i;
-	memset(&g_server_dev, 0, sizeof(struct msm_cam_server_dev));
-	/*for now just create two config nodes
-	  put logic here later to know how many configs to create*/
-	g_server_dev.config_info.num_config_nodes = 2;
-
-	if (!msm_class) {
-		rc = alloc_chrdev_region(&msm_devno, 0,
-		g_server_dev.config_info.num_config_nodes+1, "msm_camera");
-		if (rc < 0) {
-			pr_err("%s: failed to allocate chrdev: %d\n", __func__,
-			rc);
-			return rc;
-		}
-
-		msm_class = class_create(THIS_MODULE, "msm_camera");
-		if (IS_ERR(msm_class)) {
-			rc = PTR_ERR(msm_class);
-			pr_err("%s: create device class failed: %d\n",
-			__func__, rc);
-			return rc;
-		}
-	}
-
-	D("creating server and config nodes\n");
-	rc = msm_setup_server_dev(pdev);
-	if (rc < 0) {
-		pr_err("%s: failed to create server dev: %d\n", __func__,
-		rc);
-		return rc;
-	}
-
-	for (i = 0; i < g_server_dev.config_info.num_config_nodes; i++) {
-		rc = msm_setup_config_dev(i, "config");
-		if (rc < 0) {
-			pr_err("%s:failed to create config dev: %d\n",
-			 __func__, rc);
-			return rc;
-		}
-	}
-
-	return rc;
-}
-
-static int __exit msm_camera_exit(struct platform_device *pdev)
-{
-	return 0;
-}
-
-static const struct of_device_id msm_cam_server_dt_match[] = {
-	{.compatible = "qcom,cam_server"},
-}
-
-MODULE_DEVICE_TABLE(of, msm_cam_server_dt_match);
-
-static struct platform_driver msm_cam_server_driver = {
-	.probe = msm_camera_probe,
-	.remove = msm_camera_exit,
-	.driver = {
-		.name = "msm_cam_server",
-		.owner = THIS_MODULE,
-		.of_match_table = msm_cam_server_dt_match,
-	},
-};
-
-static int __init msm_cam_server_init(void)
-{
-	return platform_driver_register(&msm_cam_server_driver);
-}
-
-static void __exit msm_cam_server_exit(void)
-{
-	platform_driver_unregister(&msm_cam_server_driver);
-}
-
-module_init(msm_cam_server_init);
-module_exit(msm_cam_server_exit);
-MODULE_DESCRIPTION("msm camera server");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/server/msm_cam_server.h b/drivers/media/video/msm/server/msm_cam_server.h
deleted file mode 100644
index dc8eceb..0000000
--- a/drivers/media/video/msm/server/msm_cam_server.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef _MSM_CAM_SERVER_H
-#define _MSM_CAM_SERVER_H
-
-#include <linux/proc_fs.h>
-#include <linux/ioctl.h>
-#include <mach/camera.h>
-#include "../msm.h"
-
-uint32_t msm_cam_server_get_mctl_handle(void);
-struct iommu_domain *msm_cam_server_get_domain(void);
-int msm_cam_server_get_domain_num(void);
-struct msm_cam_media_controller *msm_cam_server_get_mctl(uint32_t handle);
-void msm_cam_server_free_mctl(uint32_t handle);
-/* Server session control APIs */
-int msm_server_begin_session(struct msm_cam_v4l2_device *pcam,
-	int server_q_idx);
-int msm_server_end_session(struct msm_cam_v4l2_device *pcam);
-int msm_send_open_server(struct msm_cam_v4l2_device *pcam);
-int msm_send_close_server(struct msm_cam_v4l2_device *pcam);
-int msm_server_update_sensor_info(struct msm_cam_v4l2_device *pcam,
-	struct msm_camera_sensor_info *sdata);
-/* Server camera control APIs */
-int msm_server_streamon(struct msm_cam_v4l2_device *pcam, int idx);
-int msm_server_streamoff(struct msm_cam_v4l2_device *pcam, int idx);
-int msm_server_get_usecount(void);
-int32_t msm_find_free_queue(void);
-int msm_server_proc_ctrl_cmd(struct msm_cam_v4l2_device *pcam,
-	struct msm_camera_v4l2_ioctl_t *ioctl_ptr, int is_set_cmd);
-int msm_server_private_general(struct msm_cam_v4l2_device *pcam,
-	struct msm_camera_v4l2_ioctl_t *ioctl_ptr);
-int msm_server_s_ctrl(struct msm_cam_v4l2_device *pcam,
-	struct v4l2_control *ctrl);
-int msm_server_g_ctrl(struct msm_cam_v4l2_device *pcam,
-	struct v4l2_control *ctrl);
-int msm_server_q_ctrl(struct msm_cam_v4l2_device *pcam,
-	struct v4l2_queryctrl *queryctrl);
-int msm_server_set_fmt(struct msm_cam_v4l2_device *pcam, int idx,
-	struct v4l2_format *pfmt);
-int msm_server_set_fmt_mplane(struct msm_cam_v4l2_device *pcam, int idx,
-	struct v4l2_format *pfmt);
-int msm_server_get_fmt(struct msm_cam_v4l2_device *pcam,
-	int idx, struct v4l2_format *pfmt);
-int msm_server_get_fmt_mplane(struct msm_cam_v4l2_device *pcam,
-	int idx, struct v4l2_format *pfmt);
-int msm_server_try_fmt(struct msm_cam_v4l2_device *pcam,
-	struct v4l2_format *pfmt);
-int msm_server_try_fmt_mplane(struct msm_cam_v4l2_device *pcam,
-	struct v4l2_format *pfmt);
-int msm_server_v4l2_subscribe_event(struct v4l2_fh *fh,
-	struct v4l2_event_subscription *sub);
-int msm_server_v4l2_unsubscribe_event(struct v4l2_fh *fh,
-	struct v4l2_event_subscription *sub);
-int msm_server_get_crop(struct msm_cam_v4l2_device *pcam,
-	int idx, struct v4l2_crop *crop);
-int msm_cam_server_request_irq(void *arg);
-int msm_cam_server_update_irqmap(
-	struct msm_cam_server_irqmap_entry *entry);
-int msm_cam_server_config_interface_map(u32 extendedmode,
-	uint32_t mctl_handle, int vnode_id, int is_bayer_sensor);
-uint32_t msm_cam_find_handle_from_mctl_ptr(
-	struct msm_cam_media_controller *p_mctl);
-#endif /* _MSM_CAM_SERVER_H */
diff --git a/drivers/media/video/msm/sn12m0pz.c b/drivers/media/video/msm/sn12m0pz.c
deleted file mode 100644
index 1fcd732..0000000
--- a/drivers/media/video/msm/sn12m0pz.c
+++ /dev/null
@@ -1,1851 +0,0 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include <linux/slab.h>
-#include "sn12m0pz.h"
-
-
-#define	Q8					0x00000100
-#define	REG_GROUPED_PARAMETER_HOLD		0x0104
-#define	GROUPED_PARAMETER_HOLD_OFF		0x00
-#define	GROUPED_PARAMETER_HOLD			0x01
-#define	REG_MODE_SELECT				0x0100
-#define	MODE_SELECT_STANDBY_MODE		0x00
-#define	MODE_SELECT_STREAM			0x01
-
-/* Integration Time */
-#define	REG_COARSE_INTEGRATION_TIME_MSB		0x0202
-#define	REG_COARSE_INTEGRATION_TIME_LSB		0x0203
-
-/* Gain */
-#define	REG_ANALOGUE_GAIN_CODE_GLOBAL_MSB	0x0204
-#define	REG_ANALOGUE_GAIN_CODE_GLOBAL_LSB	0x0205
-
-/* PLL Register Defines */
-#define	REG_PLL_MULTIPLIER			0x0307
-#define	REG_0x302B				0x302B
-
-/* MIPI Enable Settings */
-#define	REG_0x30E5				0x30E5
-#define	REG_0x3300				0x3300
-
-/* Global Setting */
-#define	REG_IMAGE_ORIENTATION			0x0101
-
-#define	REG_0x300A				0x300A
-#define	REG_0x3014				0x3014
-#define	REG_0x3015				0x3015
-#define	REG_0x3017				0x3017
-#define	REG_0x301C				0x301C
-#define	REG_0x3031				0x3031
-#define	REG_0x3040				0x3040
-#define	REG_0x3041				0x3041
-#define	REG_0x3051				0x3051
-#define	REG_0x3053				0x3053
-#define	REG_0x3055				0x3055
-#define	REG_0x3057				0x3057
-#define	REG_0x3060				0x3060
-#define	REG_0x3065				0x3065
-#define	REG_0x30AA				0x30AA
-#define	REG_0x30AB				0x30AB
-#define	REG_0x30B0				0x30B0
-#define	REG_0x30B2				0x30B2
-#define	REG_0x30D3				0x30D3
-
-#define	REG_0x3106				0x3106
-#define	REG_0x3108				0x3108
-#define	REG_0x310A				0x310A
-#define	REG_0x310C				0x310C
-#define	REG_0x310E				0x310E
-#define	REG_0x3126				0x3126
-#define	REG_0x312E				0x312E
-#define	REG_0x313C				0x313C
-#define	REG_0x313E				0x313E
-#define	REG_0x3140				0x3140
-#define	REG_0x3142				0x3142
-#define	REG_0x3144				0x3144
-#define	REG_0x3148				0x3148
-#define	REG_0x314A				0x314A
-#define	REG_0x3166				0x3166
-#define	REG_0x3168				0x3168
-#define	REG_0x316F				0x316F
-#define	REG_0x3171				0x3171
-#define	REG_0x3173				0x3173
-#define	REG_0x3175				0x3175
-#define	REG_0x3177				0x3177
-#define	REG_0x3179				0x3179
-#define	REG_0x317B				0x317B
-#define	REG_0x317D				0x317D
-#define	REG_0x317F			0x317F
-#define	REG_0x3181			0x3181
-#define	REG_0x3184			0x3184
-#define	REG_0x3185			0x3185
-#define	REG_0x3187			0x3187
-
-#define	REG_0x31A4			0x31A4
-#define	REG_0x31A6			0x31A6
-#define	REG_0x31AC			0x31AC
-#define	REG_0x31AE			0x31AE
-#define	REG_0x31B4			0x31B4
-#define	REG_0x31B6			0x31B6
-
-#define	REG_0x3254			0x3254
-#define	REG_0x3256			0x3256
-#define	REG_0x3258			0x3258
-#define	REG_0x325A			0x325A
-#define	REG_0x3260			0x3260
-#define	REG_0x3262			0x3262
-
-
-#define	REG_0x3304			0x3304
-#define	REG_0x3305			0x3305
-#define	REG_0x3306			0x3306
-#define	REG_0x3307			0x3307
-#define	REG_0x3308			0x3308
-#define	REG_0x3309			0x3309
-#define	REG_0x330A			0x330A
-#define	REG_0x330B			0x330B
-#define	REG_0x330C			0x330C
-#define	REG_0x330D			0x330D
-
-/* Mode Setting */
-#define	REG_FRAME_LENGTH_LINES_MSB	0x0340
-#define	REG_FRAME_LENGTH_LINES_LSB	0x0341
-#define	REG_LINE_LENGTH_PCK_MSB		0x0342
-#define	REG_LINE_LENGTH_PCK_LSB		0x0343
-#define	REG_X_OUTPUT_SIZE_MSB		0x034C
-#define	REG_X_OUTPUT_SIZE_LSB		0x034D
-#define	REG_Y_OUTPUT_SIZE_MSB		0x034E
-#define	REG_Y_OUTPUT_SIZE_LSB		0x034F
-#define	REG_X_EVEN_INC_LSB		0x0381
-#define	REG_X_ODD_INC_LSB		0x0383
-#define	REG_Y_EVEN_INC_LSB		0x0385
-#define	REG_Y_ODD_INC_LSB		0x0387
-#define	REG_0x3016			0x3016
-#define	REG_0x30E8			0x30E8
-#define	REG_0x3301			0x3301
-/* for 120fps support */
-#define	REG_0x0344			0x0344
-#define	REG_0x0345			0x0345
-#define	REG_0x0346			0x0346
-#define	REG_0x0347			0x0347
-#define	REG_0x0348			0x0348
-#define	REG_0x0349			0x0349
-#define	REG_0x034A			0x034A
-#define	REG_0x034B			0x034B
-
-/* Test Pattern */
-#define	REG_0x30D8			0x30D8
-#define	REG_TEST_PATTERN_MODE		0x0601
-
-/* Solid Color Test Pattern */
-#define	REG_TEST_DATA_RED_MSB		0x0603
-#define	REG_TEST_DATA_RED_LSB		0x0603
-#define	REG_TEST_DATA_GREENR_MSB	0x0604
-#define	REG_TEST_DATA_GREENR_LSB	0x0605
-#define	REG_TEST_DATA_BLUE_MSB		0x0606
-#define	REG_TEST_DATA_BLUE_LSB		0x0607
-#define	REG_TEST_DATA_GREENB_MSB	0x0608
-#define	REG_TEST_DATA_GREENB_LSB	0x0609
-#define	SN12M0PZ_AF_I2C_SLAVE_ID	0xE4
-#define	SN12M0PZ_STEPS_NEAR_TO_CLOSEST_INF	42
-#define	SN12M0PZ_TOTAL_STEPS_NEAR_TO_FAR	42
-
-
-/* TYPE DECLARATIONS */
-
-
-enum mipi_config_type {
-	IU060F_SN12M0PZ_STMIPID01,
-	IU060F_SN12M0PZ_STMIPID02
-};
-
-enum sn12m0pz_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum sn12m0pz_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE,
-	QVGA_SIZE,
-};
-
-enum sn12m0pz_setting {
-	RES_PREVIEW,
-	RES_CAPTURE,
-	RES_VIDEO_120FPS,
-};
-
-enum mt9p012_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-/* 816x612, 24MHz MCLK 96MHz PCLK */
-#define	IU060F_SN12M0PZ_OFFSET			3
-/* Time in milisecs for waiting for the sensor to reset.*/
-#define	SN12M0PZ_RESET_DELAY_MSECS		66
-#define	SN12M0PZ_WIDTH				4032
-#define	SN12M0PZ_HEIGHT				3024
-#define	SN12M0PZ_FULL_SIZE_WIDTH		4032
-#define	SN12M0PZ_FULL_SIZE_HEIGHT		3024
-#define	SN12M0PZ_HRZ_FULL_BLK_PIXELS		176
-#define	SN12M0PZ_VER_FULL_BLK_LINES		50
-#define	SN12M0PZ_QTR_SIZE_WIDTH			2016
-#define	SN12M0PZ_QTR_SIZE_HEIGHT		1512
-#define	SN12M0PZ_HRZ_QTR_BLK_PIXELS		2192
-#define	SN12M0PZ_VER_QTR_BLK_LINES		26
-
-/* 120fps mode */
-#define	SN12M0PZ_QVGA_SIZE_WIDTH		4032
-#define	SN12M0PZ_QVGA_SIZE_HEIGHT		249
-#define	SN12M0PZ_HRZ_QVGA_BLK_PIXELS		176
-#define	SN12M0PZ_VER_QVGA_BLK_LINES		9
-#define	SN12M0PZ_DEFAULT_CLOCK_RATE		24000000
-
-static uint32_t IU060F_SN12M0PZ_DELAY_MSECS = 30;
-static enum mipi_config_type mipi_config = IU060F_SN12M0PZ_STMIPID02;
-/* AF Tuning Parameters */
-static int16_t enable_single_D02_lane;
-static int16_t fullsize_cropped_at_8mp;
-
-struct sn12m0pz_work_t {
-	struct work_struct work;
-};
-
-static struct sn12m0pz_work_t *sn12m0pz_sensorw;
-static struct i2c_client *sn12m0pz_client;
-
-struct sn12m0pz_ctrl_t {
-	const struct msm_camera_sensor_info *sensordata;
-	uint32_t sensormode;
-	uint32_t fps_divider;/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;/* init to 1 * 0x00000400 */
-	uint16_t fps;
-	int16_t curr_lens_pos;
-	uint16_t curr_step_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint16_t total_lines_per_frame;
-	enum sn12m0pz_resolution_t prev_res;
-	enum sn12m0pz_resolution_t pict_res;
-	enum sn12m0pz_resolution_t curr_res;
-	enum sn12m0pz_test_mode_t  set_test;
-	unsigned short imgaddr;
-};
-
-static struct sn12m0pz_ctrl_t *sn12m0pz_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(sn12m0pz_wait_queue);
-DEFINE_MUTEX(sn12m0pz_mut);
-
-
-static int sn12m0pz_i2c_rxdata(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-	};
-
-	if (i2c_transfer(sn12m0pz_client->adapter, msgs, 2) < 0) {
-		CDBG("sn12m0pz_i2c_rxdata failed!");
-		return -EIO;
-	}
-
-	return 0;
-}
-static int32_t sn12m0pz_i2c_txdata(unsigned short saddr,
-				unsigned char *txdata, int length)
-{
-
-	struct i2c_msg msg[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len	 = length,
-			.buf	 = txdata,
-		},
-	};
-
-	if (i2c_transfer(sn12m0pz_client->adapter, msg, 1) < 0) {
-		CDBG("sn12m0pz_i2c_txdata faild 0x%x", sn12m0pz_client->addr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t sn12m0pz_i2c_read(unsigned short raddr,
-				unsigned short *rdata, int rlen)
-{
-	int32_t rc;
-	unsigned char buf[2];
-	if (!rdata)
-		return -EIO;
-
-	memset(buf, 0, sizeof(buf));
-
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-
-	rc = sn12m0pz_i2c_rxdata(sn12m0pz_client->addr, buf, rlen);
-
-	if (rc < 0) {
-		CDBG("sn12m0pz_i2c_read 0x%x failed!", raddr);
-		return rc;
-	}
-
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-
-	return rc;
-}
-
-static int32_t sn12m0pz_i2c_write_b_sensor(unsigned short waddr, uint8_t bdata)
-{
-	int32_t rc;
-	unsigned char buf[3];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-	udelay(90);
-	CDBG("i2c_write_b addr = %x, val = %x\n", waddr, bdata);
-	rc = sn12m0pz_i2c_txdata(sn12m0pz_client->addr, buf, 3);
-
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!",
-			waddr, bdata);
-	}
-
-	return rc;
-}
-
-static int16_t sn12m0pz_i2c_write_b_af(unsigned short saddr,
-				unsigned short baddr, unsigned short bdata)
-{
-	int16_t rc;
-	unsigned char buf[2];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = baddr;
-	buf[1] = bdata;
-	rc = sn12m0pz_i2c_txdata(saddr, buf, 2);
-
-	if (rc < 0)
-		CDBG("i2c_write failed, saddr = 0x%x addr = 0x%x, val =0x%x!",
-			saddr, baddr, bdata);
-
-	return rc;
-}
-
-static int32_t sn12m0pz_i2c_write_byte_bridge(unsigned short saddr,
-				unsigned short waddr, uint8_t bdata)
-{
-	int32_t rc;
-	unsigned char buf[3];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-
-	CDBG("i2c_write_b addr = %x, val = %x", waddr, bdata);
-	rc = sn12m0pz_i2c_txdata(saddr, buf, 3);
-
-	if (rc < 0)
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!",
-			waddr, bdata);
-
-	return rc;
-}
-
-static int32_t sn12m0pz_stmipid01_config(void)
-{
-	int32_t rc = 0;
-	/* Initiate I2C for D01: */
-	/* MIPI Bridge configuration */
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0002, 0x19) < 0)
-		return rc; /* enable clock lane*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0003, 0x00) < 0)
-		return rc;
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0004, 0x3E) < 0)
-		return rc; /* mipi mode clock*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0005, 0x01) < 0)
-		return rc; /* enable data line*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0006, 0x0F) < 0)
-		return rc; /* mipi mode data 0x01*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0009, 0x00) < 0)
-		return rc; /* Data_Lane1_Reg1*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x000D, 0x92) < 0)
-		return rc; /* CCPRxRegisters*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x000E, 0x28) < 0)
-		return rc; /* 10 bits for pixel width input for CCP rx.*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0014, 0xC0) < 0)
-		return rc; /* no bypass, no decomp, 1Lane System,CSIstreaming*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0015, 0x48) < 0)
-		return rc; /* ModeControlRegisters-- Don't reset error flag*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0017, 0x2B) < 0)
-		return rc; /* Data_ID_Rreg*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0018, 0x2B) < 0)
-		return rc; /* Data_ID_Rreg_emb*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0019, 0x0C) < 0)
-		return rc;
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x001E, 0x0A) < 0)
-		return rc;
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x001F, 0x0A) < 0)
-		return rc;
-
-	return rc;
-}
-static int32_t sn12m0pz_stmipid02_config(void)
-{
-	int32_t rc = 0;
-
-	/* Main Camera Clock Lane 1 (CLHP1, CLKN1)*/
-	/* Enable Clock Lane 1 (CLHP1, CLKN1), 0x15 for 400MHz */
-	if (enable_single_D02_lane) {
-		if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0002, 0x19) < 0)
-			return rc;
-		/* Main Camera Data Lane 1.1 (DATA2P1, DATA2N1) */
-		if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0009, 0x00) < 0)
-			return rc;/* Enable Data Lane 1.2 (DATA2P1, DATA2N1) */
-		if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x000A, 0x00) < 0)
-			return rc; /*CSIMode on Data Lane1.2(DATA2P1,DATA2N1)*/
-		/* Mode Control */
-		/* Enable single lane for qtr preview */
-		if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0014, 0xC0) < 0)
-			return rc; /*set 0xC0 - left justified on upper bits)*/
-		/* bit 1 set to 0 i.e. 1 lane system for qtr size preview */
-	} else {
-		if (sn12m0pz_ctrl->prev_res == QVGA_SIZE) {
-			if (sn12m0pz_i2c_write_byte_bridge(0x28>>1,
-				0x0002, 0x19) < 0)
-				return rc;
-		} else {
-			if (sn12m0pz_i2c_write_byte_bridge(0x28>>1,
-				0x0002, 0x21) < 0)
-				return rc;
-		}
-		/* Main Camera Data Lane 1.1 (DATA2P1, DATA2N1) */
-		if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0009, 0x01) < 0)
-			return rc; /* Enable Data Lane 1.2 (DATA2P1, DATA2N1) */
-		if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x000A, 0x01) < 0)
-			return rc; /* CSI Mode Data Lane1.2(DATA2P1, DATA2N1)*/
-
-		/* Mode Control */
-		/* Enable two lanes for full size preview/ snapshot */
-		if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0014, 0xC2) < 0)
-			return rc; /* No decompression, CSI dual lane */
-	}
-
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0004, 0x1E) < 0)
-		return rc;
-
-	/* Main Camera Data Lane 1.1 (DATA1P1, DATA1N1) */
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0005, 0x03) < 0)
-		return rc; /* Enable Data Lane 1.1 (DATA1P1, DATA1N1) */
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0006, 0x0f) < 0)
-		return rc; /* CSI Mode on Data Lane 1.1 (DATA1P1, DATA1N1) */
-
-	/* Tristated Output, continuous clock, */
-	/*polarity of clock is inverted and sync signals not inverted*/
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0015, 0x08) < 0)
-		return rc;
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0036, 0x20) < 0)
-		return rc; /* Enable compensation macro, main camera */
-
-	/* Data type: 0x2B Raw 10 */
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0017, 0x2B) < 0)
-		return rc;
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0018, 0x2B) < 0)
-		return rc; /* Data type of embedded data: 0x2B Raw 10 */
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x0019, 0x0C) < 0)
-		return rc; /* Data type and pixel width programmed 0x0C*/
-
-	/* Decompression Mode */
-
-	/* Pixel Width and Decompression ON/OFF */
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x001E, 0x0A) < 0)
-		return rc; /* Image data not compressed: 0x0A for 10 bits */
-	if (sn12m0pz_i2c_write_byte_bridge(0x28>>1, 0x001F, 0x0A) < 0)
-		return rc; /* Embedded data not compressed: 0x0A for 10 bits */
-	return rc;
-}
-
-static int16_t sn12m0pz_af_init(void)
-{
-	int16_t rc;
-	/* Initialize waveform */
-	rc = sn12m0pz_i2c_write_b_af(SN12M0PZ_AF_I2C_SLAVE_ID >> 1, 0x01, 0xA9);
-
-	rc = sn12m0pz_i2c_write_b_af(SN12M0PZ_AF_I2C_SLAVE_ID >> 1, 0x02, 0xD2);
-
-	rc = sn12m0pz_i2c_write_b_af(SN12M0PZ_AF_I2C_SLAVE_ID >> 1, 0x03, 0x0C);
-
-	rc = sn12m0pz_i2c_write_b_af(SN12M0PZ_AF_I2C_SLAVE_ID >> 1, 0x04, 0x14);
-
-	rc = sn12m0pz_i2c_write_b_af(SN12M0PZ_AF_I2C_SLAVE_ID >> 1, 0x05, 0xB6);
-
-	rc = sn12m0pz_i2c_write_b_af(SN12M0PZ_AF_I2C_SLAVE_ID >> 1, 0x06, 0x4F);
-
-	rc = sn12m0pz_i2c_write_b_af(SN12M0PZ_AF_I2C_SLAVE_ID >> 1, 0x07, 0x00);
-
-	return rc;
-}
-
-static int32_t sn12m0pz_move_focus(int direction,
-	int32_t num_steps)
-{
-	int8_t step_direction, dest_step_position, bit_mask;
-	int32_t rc = 0;
-	uint16_t sn12m0pz_l_region_code_per_step = 3;
-
-	if (num_steps == 0)
-		return rc;
-
-	if (direction == MOVE_NEAR) {
-		step_direction = 1;
-		bit_mask = 0x80;
-	} else if (direction == MOVE_FAR) {
-		step_direction = -1;
-		bit_mask = 0x00;
-	} else {
-		CDBG("sn12m0pz_move_focus: Illegal focus direction");
-		return -EINVAL;
-	}
-
-	dest_step_position = sn12m0pz_ctrl->curr_step_pos +
-		(step_direction * num_steps);
-
-	if (dest_step_position < 0)
-		dest_step_position = 0;
-	else if (dest_step_position > SN12M0PZ_TOTAL_STEPS_NEAR_TO_FAR)
-		dest_step_position = SN12M0PZ_TOTAL_STEPS_NEAR_TO_FAR;
-
-	rc = sn12m0pz_i2c_write_b_af(SN12M0PZ_AF_I2C_SLAVE_ID >> 1, 0x00,
-		((num_steps * sn12m0pz_l_region_code_per_step) | bit_mask));
-
-	sn12m0pz_ctrl->curr_step_pos = dest_step_position;
-
-	return rc;
-}
-static int32_t sn12m0pz_set_default_focus(uint8_t af_step)
-{
-	int32_t rc;
-
-	/* Initialize to infinity */
-
-	rc = sn12m0pz_i2c_write_b_af(SN12M0PZ_AF_I2C_SLAVE_ID >> 1, 0x00, 0x7F);
-
-	rc = sn12m0pz_i2c_write_b_af(SN12M0PZ_AF_I2C_SLAVE_ID >> 1, 0x00, 0x7F);
-
-	sn12m0pz_ctrl->curr_step_pos = 0;
-
-	return rc;
-}
-static void sn12m0pz_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint16_t preview_frame_length_lines, snapshot_frame_length_lines;
-	uint16_t preview_line_length_pck, snapshot_line_length_pck;
-	uint32_t divider, pclk_mult, d1, d2;
-
-	/* Total frame_length_lines and line_length_pck for preview */
-	CDBG("sn12m0pz_get_pict_fps prev_res %d", sn12m0pz_ctrl->prev_res);
-	if (sn12m0pz_ctrl->prev_res == QVGA_SIZE) {
-		preview_frame_length_lines = SN12M0PZ_QVGA_SIZE_HEIGHT +
-			SN12M0PZ_VER_QVGA_BLK_LINES;
-		preview_line_length_pck = SN12M0PZ_QVGA_SIZE_WIDTH +
-			SN12M0PZ_HRZ_QVGA_BLK_PIXELS;
-	} else {
-		preview_frame_length_lines = SN12M0PZ_QTR_SIZE_HEIGHT +
-			SN12M0PZ_VER_QTR_BLK_LINES;
-		preview_line_length_pck = SN12M0PZ_QTR_SIZE_WIDTH +
-			SN12M0PZ_HRZ_QTR_BLK_PIXELS;
-	}
-	/* Total frame_length_lines and line_length_pck for snapshot */
-	snapshot_frame_length_lines = SN12M0PZ_FULL_SIZE_HEIGHT
-				+ SN12M0PZ_HRZ_FULL_BLK_PIXELS;
-	snapshot_line_length_pck = SN12M0PZ_FULL_SIZE_WIDTH
-				+ SN12M0PZ_HRZ_FULL_BLK_PIXELS;
-	d1 = preview_frame_length_lines *
-				0x00000400 / snapshot_frame_length_lines;
-	d2 = preview_line_length_pck *
-				0x00000400/snapshot_line_length_pck;
-	divider = d1 * d2 / 0x400;
-	pclk_mult =
-		(uint32_t)
-		(sn12m0pz_regs.reg_pat[RES_CAPTURE].pll_multiplier_lsb *
-		0x400) / (uint32_t)
-		sn12m0pz_regs.reg_pat[RES_PREVIEW].pll_multiplier_lsb;
-	*pfps = (uint16_t) (((fps * divider) / 0x400 * pclk_mult) / 0x400);
-}
-
-static uint16_t sn12m0pz_get_prev_lines_pf(void)
-{
-	if (sn12m0pz_ctrl->prev_res == QTR_SIZE)
-		return SN12M0PZ_QTR_SIZE_HEIGHT +
-			SN12M0PZ_VER_QTR_BLK_LINES;
-	else if (sn12m0pz_ctrl->prev_res == QVGA_SIZE)
-		return SN12M0PZ_QVGA_SIZE_HEIGHT +
-			SN12M0PZ_VER_QVGA_BLK_LINES;
-
-	else
-		return SN12M0PZ_FULL_SIZE_HEIGHT +
-			SN12M0PZ_VER_FULL_BLK_LINES;
-}
-
-static uint16_t sn12m0pz_get_prev_pixels_pl(void)
-{
-	if (sn12m0pz_ctrl->prev_res == QTR_SIZE)
-		return SN12M0PZ_QTR_SIZE_WIDTH +
-			SN12M0PZ_HRZ_QTR_BLK_PIXELS;
-	else
-		return SN12M0PZ_FULL_SIZE_WIDTH +
-			SN12M0PZ_HRZ_FULL_BLK_PIXELS;
-}
-
-static uint16_t sn12m0pz_get_pict_lines_pf(void)
-{
-	if (sn12m0pz_ctrl->pict_res == QTR_SIZE)
-		return SN12M0PZ_QTR_SIZE_HEIGHT +
-			SN12M0PZ_VER_QTR_BLK_LINES;
-	else
-		return SN12M0PZ_FULL_SIZE_HEIGHT +
-			SN12M0PZ_VER_FULL_BLK_LINES;
-}
-
-static uint16_t sn12m0pz_get_pict_pixels_pl(void)
-{
-	if (sn12m0pz_ctrl->pict_res == QTR_SIZE)
-		return SN12M0PZ_QTR_SIZE_WIDTH +
-			SN12M0PZ_HRZ_QTR_BLK_PIXELS;
-	else
-		return SN12M0PZ_FULL_SIZE_WIDTH +
-			SN12M0PZ_HRZ_FULL_BLK_PIXELS;
-}
-
-static uint32_t sn12m0pz_get_pict_max_exp_lc(void)
-{
-	if (sn12m0pz_ctrl->pict_res == QTR_SIZE)
-		return (SN12M0PZ_QTR_SIZE_HEIGHT +
-			SN12M0PZ_VER_QTR_BLK_LINES) * 24;
-	else
-		return (SN12M0PZ_FULL_SIZE_HEIGHT +
-			SN12M0PZ_VER_FULL_BLK_LINES) * 24;
-}
-
-static int32_t sn12m0pz_set_fps(struct fps_cfg	*fps)
-{
-	uint16_t total_lines_per_frame;
-	int32_t rc = 0;
-
-	total_lines_per_frame = (uint16_t)((SN12M0PZ_QTR_SIZE_HEIGHT +
-				SN12M0PZ_VER_QTR_BLK_LINES) *
-				sn12m0pz_ctrl->fps_divider / 0x400);
-
-	if (sn12m0pz_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_MSB,
-				((total_lines_per_frame & 0xFF00) >> 8)) < 0)
-		return rc;
-
-	if (sn12m0pz_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_LSB,
-				(total_lines_per_frame & 0x00FF)) < 0)
-		return rc;
-
-	return rc;
-}
-
-static int32_t sn12m0pz_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	static uint16_t max_legal_gain = 0x00E0;
-	uint8_t gain_msb, gain_lsb;
-	uint8_t intg_time_msb, intg_time_lsb;
-	uint8_t line_length_pck_msb, line_length_pck_lsb;
-	uint16_t line_length_pck, frame_length_lines, temp_lines;
-	uint32_t line_length_ratio = 1 * Q8;
-	int32_t rc = 0;
-	CDBG("sn12m0pz_write_exp_gain : gain = %d line = %d", gain, line);
-
-	if (sn12m0pz_ctrl->sensormode != SENSOR_SNAPSHOT_MODE) {
-		if (sn12m0pz_ctrl->prev_res == QVGA_SIZE) {
-			frame_length_lines = SN12M0PZ_QVGA_SIZE_HEIGHT +
-						SN12M0PZ_VER_QVGA_BLK_LINES;
-			line_length_pck = SN12M0PZ_QVGA_SIZE_WIDTH +
-						SN12M0PZ_HRZ_QVGA_BLK_PIXELS;
-			if (line > (frame_length_lines -
-					IU060F_SN12M0PZ_OFFSET))
-				line = frame_length_lines -
-						IU060F_SN12M0PZ_OFFSET;
-			sn12m0pz_ctrl->fps = (uint16_t) (120 * Q8);
-		} else {
-			if (sn12m0pz_ctrl->curr_res  == QTR_SIZE) {
-				frame_length_lines = SN12M0PZ_QTR_SIZE_HEIGHT +
-						SN12M0PZ_VER_QTR_BLK_LINES;
-				line_length_pck = SN12M0PZ_QTR_SIZE_WIDTH +
-						SN12M0PZ_HRZ_QTR_BLK_PIXELS;
-			} else {
-				frame_length_lines = SN12M0PZ_HEIGHT +
-						SN12M0PZ_VER_FULL_BLK_LINES;
-				line_length_pck = SN12M0PZ_WIDTH +
-						SN12M0PZ_HRZ_FULL_BLK_PIXELS;
-			}
-			if (line > (frame_length_lines -
-						IU060F_SN12M0PZ_OFFSET))
-				sn12m0pz_ctrl->fps = (uint16_t) (30 * Q8 *
-			(frame_length_lines - IU060F_SN12M0PZ_OFFSET) / line);
-			else
-				sn12m0pz_ctrl->fps = (uint16_t) (30 * Q8);
-		}
-	} else {
-		if (sn12m0pz_ctrl->curr_res  == QTR_SIZE) {
-			frame_length_lines = SN12M0PZ_QTR_SIZE_HEIGHT +
-						SN12M0PZ_VER_QTR_BLK_LINES;
-			line_length_pck = SN12M0PZ_QTR_SIZE_WIDTH +
-						SN12M0PZ_HRZ_QTR_BLK_PIXELS;
-		} else {
-			frame_length_lines = SN12M0PZ_HEIGHT +
-						SN12M0PZ_VER_FULL_BLK_LINES;
-			line_length_pck = SN12M0PZ_WIDTH +
-						SN12M0PZ_HRZ_FULL_BLK_PIXELS;
-		}
-	}
-	if (gain > max_legal_gain)
-		/* range: 0 to 224 */
-		gain = max_legal_gain;
-	temp_lines = line;
-	/* calculate line_length_ratio */
-	if (line > (frame_length_lines - IU060F_SN12M0PZ_OFFSET)) {
-		line_length_ratio = (line * Q8) / (frame_length_lines -
-					IU060F_SN12M0PZ_OFFSET);
-		temp_lines = frame_length_lines - IU060F_SN12M0PZ_OFFSET;
-		if (line_length_ratio == 0)
-			line_length_ratio = 1 * Q8;
-	} else
-		line_length_ratio = 1 * Q8;
-
-	line = (uint32_t) (line * sn12m0pz_ctrl->fps_divider/0x400);
-
-	/* update gain registers */
-	gain_msb = (uint8_t) ((gain & 0xFF00) >> 8);
-	gain_lsb = (uint8_t) (gain & 0x00FF);
-
-	/* linear AFR horizontal stretch */
-	line_length_pck = (uint16_t) (line_length_pck * line_length_ratio / Q8);
-	line_length_pck_msb = (uint8_t) ((line_length_pck & 0xFF00) >> 8);
-	line_length_pck_lsb = (uint8_t) (line_length_pck & 0x00FF);
-
-	/* update line count registers */
-	intg_time_msb = (uint8_t) ((temp_lines & 0xFF00) >> 8);
-	intg_time_lsb = (uint8_t) (temp_lines & 0x00FF);
-
-
-	if (sn12m0pz_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-			GROUPED_PARAMETER_HOLD) < 0)
-		return rc;
-
-	if (sn12m0pz_i2c_write_b_sensor(REG_ANALOGUE_GAIN_CODE_GLOBAL_MSB,
-			gain_msb) < 0)
-		return rc;
-
-	if (sn12m0pz_i2c_write_b_sensor(REG_ANALOGUE_GAIN_CODE_GLOBAL_LSB,
-			gain_lsb) < 0)
-		return rc;
-
-	if (sn12m0pz_i2c_write_b_sensor(REG_LINE_LENGTH_PCK_MSB,
-			line_length_pck_msb) < 0)
-		return rc;
-
-	if (sn12m0pz_i2c_write_b_sensor(REG_LINE_LENGTH_PCK_LSB,
-			line_length_pck_lsb) < 0)
-		return rc;
-
-	if (sn12m0pz_i2c_write_b_sensor(REG_COARSE_INTEGRATION_TIME_MSB,
-			intg_time_msb) < 0)
-		return rc;
-
-	if (sn12m0pz_i2c_write_b_sensor(REG_COARSE_INTEGRATION_TIME_LSB,
-			intg_time_lsb) < 0)
-		return rc;
-
-	if (sn12m0pz_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-			GROUPED_PARAMETER_HOLD_OFF) < 0)
-		return rc;
-
-	return rc;
-}
-
-
-static int32_t sn12m0pz_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc;
-	rc = sn12m0pz_write_exp_gain(gain, line);
-	return rc;
-}
-
-static int32_t sn12m0pz_test(enum sn12m0pz_test_mode_t mo)
-{
-	uint8_t test_data_val_msb = 0x07;
-	uint8_t test_data_val_lsb = 0xFF;
-	int32_t rc = 0;
-	if (mo == TEST_OFF)
-		return rc;
-	else {
-		/* REG_0x30D8[4] is TESBYPEN: 0: Normal Operation,
-		 1: Bypass Signal Processing. REG_0x30D8[5] is EBDMASK:
-		 0: Output Embedded data, 1: No output embedded data */
-
-		if (sn12m0pz_i2c_write_b_sensor(REG_0x30D8, 0x10) < 0)
-			return rc;
-
-		if (sn12m0pz_i2c_write_b_sensor(REG_TEST_PATTERN_MODE,
-			(uint8_t) mo) < 0)
-			return rc;
-
-		/* Solid Color Test Pattern */
-
-		if (mo == TEST_1) {
-			if (sn12m0pz_i2c_write_b_sensor(REG_TEST_DATA_RED_MSB,
-				test_data_val_msb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_TEST_DATA_RED_LSB,
-				test_data_val_lsb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(
-						REG_TEST_DATA_GREENR_MSB,
-						test_data_val_msb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(
-						REG_TEST_DATA_GREENR_LSB,
-						test_data_val_lsb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_TEST_DATA_BLUE_MSB,
-				test_data_val_msb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_TEST_DATA_BLUE_LSB,
-				test_data_val_lsb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(
-						REG_TEST_DATA_GREENB_MSB,
-						test_data_val_msb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(
-						REG_TEST_DATA_GREENB_LSB,
-						test_data_val_lsb) < 0)
-				return rc;
-		}
-
-	}
-
-	return rc;
-}
-
-static int32_t sn12m0pz_reset(void)
-{
-	int32_t rc = 0;
-	/* register 0x0002 is Port 2, CAM_XCLRO */
-	gpio_direction_output(sn12m0pz_ctrl->
-		sensordata->sensor_reset,
-		0);
-	msleep(50);
-	gpio_direction_output(sn12m0pz_ctrl->
-		sensordata->sensor_reset,
-		1);
-	msleep(13);
-	return rc;
-}
-
-static int32_t sn12m0pz_sensor_setting(int update_type, int rt)
-{
-	uint16_t total_lines_per_frame;
-	int32_t rc = 0;
-
-	switch (update_type) {
-	case UPDATE_PERIODIC:
-		/* Put Sensor into sofware standby mode	*/
-		if (sn12m0pz_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STANDBY_MODE) <  0)
-			return rc;
-		msleep(5);
-		/* Hardware reset D02, lane config between full size/qtr size*/
-		rc = sn12m0pz_reset();
-		if (rc < 0)
-			return rc;
-
-		if (sn12m0pz_stmipid02_config() < 0)
-			return rc;
-	case REG_INIT:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE
-				|| rt == RES_VIDEO_120FPS) {
-			/* reset fps_divider */
-			sn12m0pz_ctrl->fps_divider = 1 * 0x400;
-
-			/* PLL settings */
-			if (sn12m0pz_i2c_write_b_sensor(REG_PLL_MULTIPLIER,
-			sn12m0pz_regs.reg_pat[rt].pll_multiplier_lsb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x302B,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x302B) < 0)
-				return rc;
-
-			/* MIPI Enable Settings */
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x30E5,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x30E5) < 0)
-				return rc;
-
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3300,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3300) < 0)
-				return rc;
-
-			/* Global Setting */
-			if (
-				sn12m0pz_i2c_write_b_sensor(
-				REG_IMAGE_ORIENTATION,
-				sn12m0pz_regs.reg_pat_init[0].image_orient) < 0)
-				return rc;
-			if (
-				sn12m0pz_i2c_write_b_sensor(
-				REG_COARSE_INTEGRATION_TIME_MSB,
-				sn12m0pz_regs.reg_pat[rt].coarse_integ_time_msb)
-				< 0)
-				return rc;
-			if (
-				sn12m0pz_i2c_write_b_sensor(
-				REG_COARSE_INTEGRATION_TIME_LSB,
-				sn12m0pz_regs.reg_pat[rt].coarse_integ_time_lsb)
-				 < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x300A,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x300A) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3014,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3014) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3015,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3015) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3017,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3017) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x301C,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x301C) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3031,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3031) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3040,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3040) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3041,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3041) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3051,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3051) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3053,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3053) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3055,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3055) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3057,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3057) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3060,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3060) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3065,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3065) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x30AA,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x30AA) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x30AB,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x30AB) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x30B0,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x30B0) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x30B2,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x30B2) < 0)
-				return rc;
-
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x30D3,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x30D3) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x30D8,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x30D8) < 0)
-				return rc;
-
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3106,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3106) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3108,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3108) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x310A,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x310A) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x310C,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x310C) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x310E,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x310E) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3126,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3126) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x312E,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x312E) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x313C,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x313C) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x313E,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x313E) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3140,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3140) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3142,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3142) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3144,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3144) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3148,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3148) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x314A,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x314A) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3166,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3166) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3168,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3168) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x316F,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x316F) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3171,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3171) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3173,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3173) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3175,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3175) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3177,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3177) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3179,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3179) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x317B,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x317B) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x317D,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x317D) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x317F,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x317F) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3181,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3181) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3184,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3184) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3185,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3185) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3187,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3187) < 0)
-				return rc;
-
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x31A4,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x31A4) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x31A6,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x31A6) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x31AC,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x31AC) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x31AE,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x31AE) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x31B4,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x31B4) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x31B6,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x31B6) < 0)
-				return rc;
-
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3254,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3254) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3256,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3256) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3258,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3258) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x325A,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x325A) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3260,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3260) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3262,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3262) < 0)
-				return rc;
-
-
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3304,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3304) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3305,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3305) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3306,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3306) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3307,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3307) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3308,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3308) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3309,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x3309) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x330A,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x330A) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x330B,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x330B) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x330C,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x330C) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x330D,
-				sn12m0pz_regs.reg_pat_init[0].reg_0x330D) < 0)
-				return rc;
-
-			/* Mode setting */
-			/* Update registers with correct
-				 frame_length_line value for AFR */
-			total_lines_per_frame = (uint16_t)(
-			(sn12m0pz_regs.reg_pat[rt].frame_length_lines_msb << 8)
-			& 0xFF00) +
-			sn12m0pz_regs.reg_pat[rt].frame_length_lines_lsb;
-			total_lines_per_frame = total_lines_per_frame *
-					sn12m0pz_ctrl->fps_divider / 0x400;
-
-			if (sn12m0pz_i2c_write_b_sensor(
-					REG_FRAME_LENGTH_LINES_MSB,
-					(total_lines_per_frame & 0xFF00) >> 8)
-					< 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(
-					REG_FRAME_LENGTH_LINES_LSB,
-					(total_lines_per_frame & 0x00FF)) < 0)
-				return rc;
-
-			if (sn12m0pz_i2c_write_b_sensor(REG_LINE_LENGTH_PCK_MSB,
-				sn12m0pz_regs.reg_pat[rt].line_length_pck_msb) <
-				0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_LINE_LENGTH_PCK_LSB,
-				sn12m0pz_regs.reg_pat[rt].line_length_pck_lsb) <
-				0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_X_OUTPUT_SIZE_MSB,
-				sn12m0pz_regs.reg_pat[rt].x_output_size_msb) <
-				0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_X_OUTPUT_SIZE_LSB,
-				sn12m0pz_regs.reg_pat[rt].x_output_size_lsb) <
-				0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_Y_OUTPUT_SIZE_MSB,
-				sn12m0pz_regs.reg_pat[rt].y_output_size_msb) <
-				0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_Y_OUTPUT_SIZE_LSB,
-				sn12m0pz_regs.reg_pat[rt].y_output_size_lsb) <
-				0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_X_EVEN_INC_LSB,
-				sn12m0pz_regs.reg_pat[rt].x_even_inc_lsb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_X_ODD_INC_LSB,
-				sn12m0pz_regs.reg_pat[rt].x_odd_inc_lsb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_Y_EVEN_INC_LSB,
-				sn12m0pz_regs.reg_pat[rt].y_even_inc_lsb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_Y_ODD_INC_LSB,
-				sn12m0pz_regs.reg_pat[rt].y_odd_inc_lsb) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3016,
-				sn12m0pz_regs.reg_pat[rt].reg_0x3016) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x30E8,
-				sn12m0pz_regs.reg_pat[rt].reg_0x30E8) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x3301,
-				sn12m0pz_regs.reg_pat[rt].reg_0x3301) < 0)
-				return rc;
-
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x0344,
-				sn12m0pz_regs.reg_pat[rt].reg_0x0344) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x0345,
-				sn12m0pz_regs.reg_pat[rt].reg_0x0345) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x0346,
-				sn12m0pz_regs.reg_pat[rt].reg_0x0346) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x0347,
-				sn12m0pz_regs.reg_pat[rt].reg_0x0347) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x0348,
-				sn12m0pz_regs.reg_pat[rt].reg_0x0348) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x0349,
-				sn12m0pz_regs.reg_pat[rt].reg_0x0349) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x034A,
-				sn12m0pz_regs.reg_pat[rt].reg_0x034A) < 0)
-				return rc;
-			if (sn12m0pz_i2c_write_b_sensor(REG_0x034B,
-				sn12m0pz_regs.reg_pat[rt].reg_0x034B) < 0)
-				return rc;
-
-			if ((rt == RES_CAPTURE) && fullsize_cropped_at_8mp) {
-				/* x address end */
-				if (sn12m0pz_i2c_write_b_sensor(0x0348,
-								0x0C) < 0)
-					return rc;
-				if (sn12m0pz_i2c_write_b_sensor(0x0349,
-								0x0CF) < 0)
-					return rc;
-				/* y address end */
-				if (sn12m0pz_i2c_write_b_sensor(0x034A,
-								0x09) < 0)
-					return rc;
-				if (sn12m0pz_i2c_write_b_sensor(0x034B,
-								0x9F) < 0)
-					return rc;
-			}
-
-			if (mipi_config == IU060F_SN12M0PZ_STMIPID01) {
-				if (sn12m0pz_i2c_write_b_sensor(
-						REG_PLL_MULTIPLIER, 0x43) < 0)
-					return rc;
-				if (rt == RES_CAPTURE) {
-					if (sn12m0pz_i2c_write_b_sensor(
-						REG_0x3301, 0x01) < 0)
-						return rc;
-				if (sn12m0pz_i2c_write_b_sensor(
-						REG_0x3017, 0xE0) < 0)
-					return rc;
-				}
-			}
-
-			if (sn12m0pz_i2c_write_b_sensor(REG_MODE_SELECT,
-						MODE_SELECT_STREAM) < 0)
-				return rc;
-
-			msleep(IU060F_SN12M0PZ_DELAY_MSECS);
-
-			if (sn12m0pz_test(sn12m0pz_ctrl->set_test) < 0)
-				return rc;
-
-			if (mipi_config == IU060F_SN12M0PZ_STMIPID02)
-				CDBG("%s,%d", __func__, __LINE__);
-			return rc;
-		}
-	default:
-		return rc;
-		}
-}
-
-
-static int32_t sn12m0pz_video_config(int mode)
-{
-
-	int32_t rc = 0;
-	int rt;
-
-
-	if (mode == SENSOR_HFR_120FPS_MODE)
-		sn12m0pz_ctrl->prev_res = QVGA_SIZE;
-
-	/* change sensor resolution if needed */
-	if (sn12m0pz_ctrl->curr_res != sn12m0pz_ctrl->prev_res) {
-		if (sn12m0pz_ctrl->prev_res == QTR_SIZE) {
-			rt = RES_PREVIEW;
-			IU060F_SN12M0PZ_DELAY_MSECS = 35; /*measured on scope*/
-			enable_single_D02_lane = 1;
-		} else if (sn12m0pz_ctrl->prev_res == QVGA_SIZE) {
-			rt = RES_VIDEO_120FPS;
-			IU060F_SN12M0PZ_DELAY_MSECS = 35; /*measured on scope*/
-			enable_single_D02_lane = 0;
-		} else {
-			rt = RES_CAPTURE;
-			enable_single_D02_lane = 0;
-		}
-
-		if (sn12m0pz_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-			return rc;
-	}
-
-	sn12m0pz_ctrl->curr_res = sn12m0pz_ctrl->prev_res;
-	sn12m0pz_ctrl->sensormode = mode;
-
-	return rc;
-}
-static int32_t sn12m0pz_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-	/* change sensor resolution if needed */
-	if (sn12m0pz_ctrl->curr_res != sn12m0pz_ctrl->pict_res) {
-		if (sn12m0pz_ctrl->pict_res == QTR_SIZE) {
-			rt = RES_PREVIEW;
-			enable_single_D02_lane = 1;
-		} else {
-			rt = RES_CAPTURE;
-			IU060F_SN12M0PZ_DELAY_MSECS = 100;/*measured on scope*/
-			enable_single_D02_lane = 0;
-		}
-
-		if (sn12m0pz_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-			return rc;
-	}
-
-	sn12m0pz_ctrl->curr_res = sn12m0pz_ctrl->pict_res;
-	sn12m0pz_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t sn12m0pz_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-	/* change sensor resolution if needed */
-	if (sn12m0pz_ctrl->curr_res != sn12m0pz_ctrl->pict_res) {
-		if (sn12m0pz_ctrl->pict_res == QTR_SIZE) {
-			rt = RES_PREVIEW;
-			enable_single_D02_lane = 1;
-		} else {
-			rt = RES_CAPTURE;
-			IU060F_SN12M0PZ_DELAY_MSECS = 100;/*measured on scope*/
-			enable_single_D02_lane = 0;
-		}
-		if (sn12m0pz_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-			return rc;
-		}
-	sn12m0pz_ctrl->curr_res = sn12m0pz_ctrl->pict_res;
-	sn12m0pz_ctrl->sensormode = mode;
-	return rc;
-}
-static int32_t sn12m0pz_set_sensor_mode(int  mode,
-	int  res)
-{
-	int32_t rc;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-	case SENSOR_HFR_120FPS_MODE:
-		rc = sn12m0pz_video_config(mode);
-		break;
-
-	case SENSOR_SNAPSHOT_MODE:
-		rc = sn12m0pz_snapshot_config(mode);
-		break;
-
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = sn12m0pz_raw_snapshot_config(mode);
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-
-static int32_t sn12m0pz_power_down(void)
-{
-	return 0;
-}
-
-
-static int sn12m0pz_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-
-	gpio_direction_output(data->sensor_reset, 0);
-	gpio_free(data->sensor_reset);
-	gpio_direction_output(data->vcm_pwd, 0);
-	gpio_free(data->vcm_pwd);
-	return 0;
-}
-
-static int sn12m0pz_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc;
-	unsigned short chipidl, chipidh;
-	CDBG("Requesting gpio");
-	rc = gpio_request(data->sensor_reset, "sn12m0pz");
-	CDBG(" sn12m0pz_probe_init_sensor");
-	if (!rc) {
-		gpio_direction_output(data->sensor_reset, 0);
-		msleep(20);
-		gpio_direction_output(data->sensor_reset, 1);
-		msleep(13);
-	} else {
-		goto init_probe_done;
-	}
-	CDBG("Requestion gpio");
-	rc = gpio_request(data->vcm_pwd, "sn12m0pz");
-	CDBG(" sn12m0pz_probe_init_sensor");
-
-	if (!rc) {
-		gpio_direction_output(data->vcm_pwd, 0);
-		msleep(20);
-		gpio_direction_output(data->vcm_pwd, 1);
-		msleep(13);
-	} else {
-		gpio_direction_output(data->sensor_reset, 0);
-		gpio_free(data->sensor_reset);
-		goto init_probe_done;
-	}
-
-	msleep(20);
-
-	/* 3. Read sensor Model ID: */
-	rc = sn12m0pz_i2c_read(0x0000, &chipidh, 1);
-	if (rc < 0) {
-		CDBG(" sn12m0pz_probe_init_sensor3");
-		goto init_probe_fail;
-	}
-	rc = sn12m0pz_i2c_read(0x0001, &chipidl, 1);
-	if (rc < 0) {
-		CDBG(" sn12m0pz_probe_init_sensor4");
-		goto init_probe_fail;
-	}
-
-	/* 4. Compare sensor ID to SN12M0PZ ID: */
-	if (chipidh != 0x00 || chipidl != 0x60) {
-		rc = -ENODEV;
-		CDBG("sn12m0pz_probe_init_sensor fail chip id doesnot match");
-		goto init_probe_fail;
-	}
-
-	msleep(SN12M0PZ_RESET_DELAY_MSECS);
-
-	goto init_probe_done;
-
-init_probe_fail:
-	CDBG(" sn12m0pz_probe_init_sensor fails");
-	sn12m0pz_probe_init_done(data);
-
-init_probe_done:
-	CDBG(" sn12m0pz_probe_init_sensor finishes");
-	return rc;
-}
-
-int sn12m0pz_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	CDBG("Calling sn12m0pz_sensor_open_init");
-
-	sn12m0pz_ctrl = kzalloc(sizeof(struct sn12m0pz_ctrl_t), GFP_KERNEL);
-	if (!sn12m0pz_ctrl) {
-		CDBG("sn12m0pz_init failed!");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-
-	sn12m0pz_ctrl->fps_divider      = 1 * 0x00000400;
-	sn12m0pz_ctrl->pict_fps_divider = 1 * 0x00000400;
-	sn12m0pz_ctrl->set_test = TEST_OFF;
-	sn12m0pz_ctrl->prev_res = QTR_SIZE;
-	sn12m0pz_ctrl->pict_res = FULL_SIZE;
-	sn12m0pz_ctrl->curr_res = INVALID_SIZE;
-	if (data)
-		sn12m0pz_ctrl->sensordata = data;
-
-	if (rc < 0)
-		return rc;
-
-	/* enable mclk first */
-	msm_camio_clk_rate_set(SN12M0PZ_DEFAULT_CLOCK_RATE);
-	msleep(20);
-	msm_camio_camif_pad_reg_reset();
-	msleep(20);
-	CDBG("Calling sn12m0pz_sensor_open_init");
-	rc = sn12m0pz_probe_init_sensor(data);
-
-	if (rc < 0)
-		goto init_fail;
-	/* send reset signal */
-	if (mipi_config == IU060F_SN12M0PZ_STMIPID01) {
-		if (sn12m0pz_stmipid01_config() < 0) {
-			CDBG("Calling sn12m0pz_sensor_open_init fail");
-			return rc;
-		}
-	} else {
-		if (sn12m0pz_ctrl->prev_res  == QTR_SIZE)
-			enable_single_D02_lane = 1;
-		else /* FULL_SIZE */
-			enable_single_D02_lane = 0;
-
-		if (sn12m0pz_stmipid02_config() < 0) {
-			CDBG("Calling sn12m0pz_sensor_open_init fail");
-			return rc;
-		}
-	}
-
-
-	if (sn12m0pz_ctrl->prev_res == QTR_SIZE) {
-		if (sn12m0pz_sensor_setting(REG_INIT, RES_PREVIEW) < 0)
-			return rc;
-	} else if (sn12m0pz_ctrl->prev_res == QVGA_SIZE) {
-		if (sn12m0pz_sensor_setting(REG_INIT, RES_VIDEO_120FPS) < 0)
-			return rc;
-	} else {
-		if (sn12m0pz_sensor_setting(REG_INIT, RES_CAPTURE) < 0)
-			return rc;
-	}
-
-	if (sn12m0pz_af_init() < 0)
-		return rc;
-	sn12m0pz_ctrl->fps = 30*Q8;
-	if (rc < 0)
-		goto init_fail;
-	else
-		goto init_done;
-init_fail:
-	CDBG(" init_fail");
-	sn12m0pz_probe_init_done(data);
-	kfree(sn12m0pz_ctrl);
-init_done:
-	CDBG("init_done");
-	return rc;
-}
-static int __devinit sn12m0pz_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&sn12m0pz_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id sn12m0pz_i2c_id[] = {
-	{ "sn12m0pz", 0},
-	{ }
-};
-
-static int __devinit sn12m0pz_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("sn12m0pz_probe called!");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed");
-		goto probe_failure;
-	}
-
-	sn12m0pz_sensorw = kzalloc(sizeof(struct sn12m0pz_work_t), GFP_KERNEL);
-	if (!sn12m0pz_sensorw) {
-		CDBG("kzalloc failed");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, sn12m0pz_sensorw);
-	sn12m0pz_init_client(client);
-	sn12m0pz_client = client;
-
-	msleep(50);
-
-	CDBG("sn12m0pz_probe successed! rc = %d", rc);
-	return 0;
-
-probe_failure:
-	CDBG("sn12m0pz_probe failed! rc = %d", rc);
-	return rc;
-}
-
-static int __exit sn12m0pz_remove(struct i2c_client *client)
-{
-	struct sn12m0pz_work_t_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	sn12m0pz_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static struct i2c_driver sn12m0pz_i2c_driver = {
-	.id_table = sn12m0pz_i2c_id,
-	.probe	= sn12m0pz_i2c_probe,
-	.remove = __exit_p(sn12m0pz_i2c_remove),
-	.driver = {
-		.name = "sn12m0pz",
-	},
-};
-
-int sn12m0pz_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	int32_t rc = 0;
-	if (copy_from_user(&cdata,
-				(void *)argp,
-				sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-
-	mutex_lock(&sn12m0pz_mut);
-
-	CDBG("sn12m0pz_sensor_config: cfgtype = %d",
-		cdata.cfgtype);
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		sn12m0pz_get_pict_fps(cdata.cfg.gfps.prevfps,
-					&(cdata.cfg.gfps.pictfps));
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf =
-			sn12m0pz_get_prev_lines_pf();
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl =
-			sn12m0pz_get_prev_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf =
-			sn12m0pz_get_pict_lines_pf();
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl =
-			sn12m0pz_get_pict_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc =
-			sn12m0pz_get_pict_max_exp_lc();
-
-		if (copy_to_user((void *)argp,
-			&cdata,
-			sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = sn12m0pz_set_fps(&(cdata.cfg.fps));
-		break;
-
-	case CFG_SET_EXP_GAIN:
-		rc =
-			sn12m0pz_write_exp_gain(
-				cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-		break;
-	case CFG_SET_PICT_EXP_GAIN:
-		rc =
-			sn12m0pz_set_pict_exp_gain(
-				cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_MODE:
-		rc = sn12m0pz_set_sensor_mode(cdata.mode,
-					cdata.rs);
-		break;
-
-	case CFG_PWR_DOWN:
-		rc = sn12m0pz_power_down();
-		break;
-
-	case CFG_MOVE_FOCUS:
-		rc = sn12m0pz_move_focus(cdata.cfg.focus.dir,
-					cdata.cfg.focus.steps);
-		break;
-
-	case CFG_SET_DEFAULT_FOCUS:
-		rc = sn12m0pz_set_default_focus(cdata.cfg.focus.steps);
-		break;
-
-	case CFG_SET_EFFECT:
-		rc = 0;
-		break;
-	case CFG_SET_LENS_SHADING:
-		rc = 0;
-		break;
-	default:
-		rc = -EFAULT;
-		break;
-	}
-
-	mutex_unlock(&sn12m0pz_mut);
-
-	return rc;
-}
-
-static int sn12m0pz_sensor_release(void)
-{
-	int rc = -EBADF;
-
-	mutex_lock(&sn12m0pz_mut);
-
-	sn12m0pz_power_down();
-
-	gpio_direction_output(sn12m0pz_ctrl->sensordata->sensor_reset,
-		0);
-	gpio_free(sn12m0pz_ctrl->sensordata->sensor_reset);
-
-	gpio_direction_output(sn12m0pz_ctrl->sensordata->vcm_pwd,
-		0);
-	gpio_free(sn12m0pz_ctrl->sensordata->vcm_pwd);
-
-	kfree(sn12m0pz_ctrl);
-	sn12m0pz_ctrl = NULL;
-
-	CDBG("sn12m0pz_release completed");
-
-
-	mutex_unlock(&sn12m0pz_mut);
-
-	return rc;
-}
-
-static int sn12m0pz_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc;
-
-	rc = i2c_add_driver(&sn12m0pz_i2c_driver);
-	if (rc < 0 || sn12m0pz_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_fail;
-	}
-
-	msm_camio_clk_rate_set(SN12M0PZ_DEFAULT_CLOCK_RATE);
-	msleep(20);
-
-	rc = sn12m0pz_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-
-	s->s_init = sn12m0pz_sensor_open_init;
-	s->s_release = sn12m0pz_sensor_release;
-	s->s_config  = sn12m0pz_sensor_config;
-	s->s_mount_angle  = 0;
-	sn12m0pz_probe_init_done(info);
-
-	return rc;
-
-probe_fail:
-	CDBG("SENSOR PROBE FAILS!");
-	i2c_del_driver(&sn12m0pz_i2c_driver);
-	return rc;
-}
-
-static int __sn12m0pz_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, sn12m0pz_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __sn12m0pz_probe,
-	.driver = {
-		.name = "msm_camera_sn12m0pz",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init sn12m0pz_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(sn12m0pz_init);
-
-MODULE_DESCRIPTION("Sony 12M MP Bayer sensor driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/sn12m0pz.h b/drivers/media/video/msm/sn12m0pz.h
deleted file mode 100644
index c3d3346..0000000
--- a/drivers/media/video/msm/sn12m0pz.h
+++ /dev/null
@@ -1,138 +0,0 @@
-
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-#ifndef SN12M0PZ_H
-#define SN12M0PZ_H
-
-#include <linux/types.h>
-extern struct sn12m0pz_reg sn12m0pz_regs; /* from mt9t013_reg.c */
-struct reg_struct{
-	uint8_t pll_multiplier_lsb;            /* 0x0307*/
-	uint8_t coarse_integ_time_msb;   /* 0x0202*/
-	uint8_t coarse_integ_time_lsb;   /* 0x0203*/
-	uint8_t frame_length_lines_msb;        /* 0x0340*/
-	uint8_t frame_length_lines_lsb;        /* 0x0341*/
-	uint8_t line_length_pck_msb;           /* 0x0342*/
-	uint8_t line_length_pck_lsb;           /* 0x0343*/
-	uint8_t x_output_size_msb;             /* 0x034C*/
-	uint8_t x_output_size_lsb;             /* 0x034D*/
-	uint8_t y_output_size_msb;             /* 0x034E*/
-	uint8_t y_output_size_lsb;             /* 0x034F*/
-	uint8_t x_even_inc_lsb;                /* 0x0381*/
-	uint8_t x_odd_inc_lsb;                 /* 0x0383*/
-	uint8_t y_even_inc_lsb;                /* 0x0385*/
-	uint8_t y_odd_inc_lsb;                 /* 0x0387*/
-	uint8_t reg_0x3016;                    /* 0x3016 VMODEADD*/
-	uint8_t reg_0x30E8;                    /* 0x30E8 HADDAVE*/
-	uint8_t reg_0x3301;                    /* 0x3301 RGLANESEL*/
-	/*added for 120fps support */
-	uint8_t reg_0x0344;
-	uint8_t reg_0x0345;
-	uint8_t reg_0x0346;
-	uint8_t reg_0x0347;
-	uint8_t reg_0x0348;
-	uint8_t reg_0x0349;
-	uint8_t reg_0x034A;
-	uint8_t reg_0x034B;
-};
-struct reg_struct_init{
-	uint8_t reg_0x302B;/* 0x302B*/
-
-	uint8_t reg_0x30E5;/* 0x30E5*/
-	uint8_t reg_0x3300;   /* 0x3300*/
-
-	uint8_t image_orient;   /* 0x0101*/
-
-	uint8_t reg_0x300A;   /* 0x300A*/
-	uint8_t reg_0x3014;   /* 0x3014*/
-	uint8_t reg_0x3015;   /* 0x3015*/
-	uint8_t reg_0x3017;   /* 0x3017*/
-	uint8_t reg_0x301C;   /* 0x301C*/
-	uint8_t reg_0x3031;   /* 0x3031*/
-	uint8_t reg_0x3040;   /* 0x3040*/
-	uint8_t reg_0x3041;   /* 0x3041*/
-	uint8_t reg_0x3051;   /* 0x3051*/
-	uint8_t reg_0x3053;   /* 0x3053*/
-	uint8_t reg_0x3055;   /* 0x3055*/
-	uint8_t reg_0x3057;   /* 0x3057*/
-	uint8_t reg_0x3060;   /* 0x3060*/
-	uint8_t reg_0x3065;   /* 0x3065*/
-	uint8_t reg_0x30AA;   /* 0x30AA*/
-	uint8_t reg_0x30AB;   /* 0x30AB*/
-	uint8_t reg_0x30B0;   /* 0x30B0*/
-	uint8_t reg_0x30B2;   /* 0x30B2*/
-
-	uint8_t reg_0x30D3;   /* 0X30D3*/
-	uint8_t reg_0x30D8;   /* 0X30D8*/
-
-	uint8_t reg_0x3106;   /* 0x3106*/
-	uint8_t reg_0x3108;   /* 0x3108*/
-	uint8_t reg_0x310A;   /* 0x310A*/
-	uint8_t reg_0x310C;   /* 0x310C*/
-	uint8_t reg_0x310E;   /* 0x310E*/
-	uint8_t reg_0x3126;   /* 0x3126*/
-	uint8_t reg_0x312E;   /* 0x312E*/
-	uint8_t reg_0x313C;   /* 0x313C*/
-	uint8_t reg_0x313E;   /* 0x313E*/
-	uint8_t reg_0x3140;   /* 0x3140*/
-	uint8_t reg_0x3142;   /* 0x3142*/
-	uint8_t reg_0x3144;   /* 0x3144*/
-	uint8_t reg_0x3148;   /* 0x3148*/
-	uint8_t reg_0x314A;   /* 0x314A*/
-	uint8_t reg_0x3166;   /* 0x3166*/
-	uint8_t reg_0x3168;   /* 0x3168*/
-	uint8_t reg_0x316F;   /* 0x316F*/
-	uint8_t reg_0x3171;   /* 0x3171*/
-	uint8_t reg_0x3173;   /* 0x3173*/
-	uint8_t reg_0x3175;   /* 0x3175*/
-	uint8_t reg_0x3177;   /* 0x3177*/
-	uint8_t reg_0x3179;   /* 0x3179*/
-	uint8_t reg_0x317B;   /* 0x317B*/
-	uint8_t reg_0x317D;   /* 0x317D*/
-	uint8_t reg_0x317F;   /* 0x317F*/
-	uint8_t reg_0x3181;   /* 0x3181*/
-	uint8_t reg_0x3184;   /* 0x3184*/
-	uint8_t reg_0x3185;   /* 0x3185*/
-	uint8_t reg_0x3187;   /* 0x3187*/
-
-	uint8_t reg_0x31A4;   /* 0x31A4*/
-	uint8_t reg_0x31A6;   /* 0x31A6*/
-	uint8_t reg_0x31AC;   /* 0x31AC*/
-	uint8_t reg_0x31AE;   /* 0x31AE*/
-	uint8_t reg_0x31B4;   /* 0x31B4*/
-	uint8_t reg_0x31B6;   /* 0x31B6*/
-
-	uint8_t reg_0x3254;   /* 0x3254*/
-	uint8_t reg_0x3256;   /* 0x3256*/
-	uint8_t reg_0x3258;   /* 0x3258*/
-	uint8_t reg_0x325A;   /* 0x325A*/
-	uint8_t reg_0x3260;   /* 0x3260*/
-	uint8_t reg_0x3262;   /* 0x3262*/
-
-	uint8_t reg_0x3304;   /* 0x3304*/
-	uint8_t reg_0x3305;   /* 0x3305*/
-	uint8_t reg_0x3306;   /* 0x3306*/
-	uint8_t reg_0x3307;   /* 0x3307*/
-	uint8_t reg_0x3308;   /* 0x3308*/
-	uint8_t reg_0x3309;   /* 0x3309*/
-	uint8_t reg_0x330A;   /* 0x330A*/
-	uint8_t reg_0x330B;   /* 0x330B*/
-	uint8_t reg_0x330C;   /* 0x330C*/
-	uint8_t reg_0x330D;   /* 0x330D*/
-
-};
-struct sn12m0pz_reg{
-	const struct reg_struct  *reg_pat;
-	const struct reg_struct_init  *reg_pat_init;
-};
-#endif
diff --git a/drivers/media/video/msm/sn12m0pz_reg.c b/drivers/media/video/msm/sn12m0pz_reg.c
deleted file mode 100644
index c406d98..0000000
--- a/drivers/media/video/msm/sn12m0pz_reg.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include "sn12m0pz.h"
-/* Initialisation settings */
-
-const struct reg_struct_init iu060f_reg_pat_init[1] = {{
-	/* PLL setting */
-	0x4B, /* reg 0x302B*/
-	/* MIPI Enable Setting */
-	0x04, /* reg 0x30E5*/
-	0x00, /* reg 0x3300*/
-	/* Global Setting */
-	0x00, /* image_orientation*/
-	0x80, /* reg 0x300A*/
-	0x08, /* reg 0x3014*/
-	0x37, /* reg 0x3015*/
-	0x60, /* reg 0x3017*/
-	0x01, /* reg 0x301C*/
-	0x28, /* reg 0x3031*/
-	0x00, /* reg 0x3040*/
-	0x60, /* reg 0x3041*/
-	0x24, /* reg 0x3051*/
-	0x34, /* reg 0x3053*/
-	0x3B, /* reg 0x3055*/
-	0xC0, /* reg 0x3057*/
-	0x30, /* reg 0x3060*/
-	0x00, /* reg 0x3065*/
-	0x88, /* reg 0x30AA*/
-	0x1C, /* reg 0x30AB*/
-	0x32, /* reg 0x30B0*/
-	0x83, /* reg 0x30B2*/
-	0x04, /* reg 0x30D3*/
-	0xC0, /* reg 0x30D8*/
-	0x50, /* reg 0x3106*/
-	0xA5, /* reg 0x3108*/
-	0xA9, /* reg 0x310A*/
-	0x0C, /* reg 0x310C*/
-	0x55, /* reg 0x310E*/
-	0xCC, /* reg 0x3126*/
-	0x83, /* reg 0x312E*/
-	0xC7, /* reg 0x313C*/
-	0x07, /* reg 0x313E*/
-	0x32, /* reg 0x3140*/
-	0x35, /* reg 0x3142*/
-	0x35, /* reg 0x3144*/
-	0x73, /* reg 0x3148*/
-	0x80, /* reg 0x314A*/
-	0xBE, /* reg 0x3166*/
-	0xBD, /* reg 0x3168*/
-	0x82, /* reg 0x316F*/
-	0xBC, /* reg 0x3171*/
-	0x82, /* reg 0x3173*/
-	0xBC, /* reg 0x3175*/
-	0x0C, /* reg 0x3177*/
-	0x2C, /* reg 0x3179*/
-	0x83, /* reg 0x317B*/
-	0xAF, /* reg 0x317D*/
-	0x83, /* reg 0x317F*/
-	0xAF, /* reg 0x3181*/
-	0x06, /* reg 0x3184*/
-	0xBA, /* reg 0x3185*/
-	0xBE, /* reg 0x3187*/
-	0xD8, /* reg 0x31A4*/
-	0x17, /* reg 0x31A6*/
-	0xCF, /* reg 0x31AC*/
-	0xF1, /* reg 0x31AE*/
-	0xD8, /* reg 0x31B4*/
-	0x17, /* reg 0x31B6*/
-	0x09, /* reg 0x3254 */
-	0xC5, /* reg 0x3256 */
-	0x84, /* reg 0x3258 */
-	0x6C, /* reg 0x325A */
-	0x0B, /* reg 0x3260 */
-	0x09, /* reg 0x3262 */
-	0x05, /* reg 0x3304*/
-	0x04, /* reg 0x3305*/
-	0x15, /* reg 0x3306*/
-	0x03, /* reg 0x3307*/
-	0x13, /* reg 0x3308*/
-	0x05, /* reg 0x3309*/
-	0x0B, /* reg 0x330A*/
-	0x04, /* reg 0x330B*/
-	0x0B, /* reg 0x330C*/
-	0x06  /* reg 0x330D*/
-}
-};
-
-/* Preview / Snapshot register settings */
-const struct reg_struct iu060f_reg_pat[3] = {
-	{ /* Preview */
-		0x22, /*0x1b*/ /* fps*/
-
-		/* Global Setting */
-		0x01, /* coarse_integration_time_msb*/
-		0xFF, /* coarse_integration_time_lsb*/
-
-		/* Mode Setting */
-		/* V: 1/2 V-addition (1,3),
-		H: 1/2 H-averaging (1,3) */
-
-		0x06, /* frame_length_lines_msb     0x0340*/
-		0x02, /* frame_length_lines_lsb     0x0341*/
-		0x10, /* line_length_pck_msb        0x0342*/
-		0x70, /* line_length_pck_lsb        0x0343*/
-		0x07, /* x_output_size_msb          0x034C*/
-		0xe0, /* x_output_size_lsb          0x034D*/
-		0x05, /* y_output_size_msb          0x034E*/
-		0xe8, /* y_output_size_lsb          0x034F*/
-		0x01, /* x_even_inc_lsb             0x0381*/
-		0x03, /* x_odd_inc_lsb              0x0383*/
-		0x01, /* y_even_inc_lsb             0x0385*/
-		0x03, /* y_odd_inc_lsb              0x0387*/
-		0x46, /* reg 0x3016 VMODEADD        0x3016*/
-		0x86, /* reg 0x30E8 HADDAVE         0x30E8*/
-		0x01, /* reg 0x3301 RGLANESEL       0x3301*/
-
-		0x00,  /* 0x0344 */
-		0x00,  /* 0x0345 */
-		0x00,  /* 0x0346 */
-		0x00,  /* 0x0347 */
-		0x0F,  /* 0x0348 */
-		0xBF,  /* 0x0349 */
-		0x0B,  /* 0x034A */
-		0xCF,  /* 0x034B */
-	},
-	{ /* Snapshot */
-		0x14, /* pll_multiplier_lsb    // 20/10 fps*/
-		/* 0x14 for pclk 96MHz at 7.5 fps */
-
-		/* Global Setting */
-		0x0B, /* coarse_integration_time_msb*/
-		0xFF, /* coarse_integration_time_lsb*/
-
-		/* Mode Setting */
-		/* Full */
-		0x0C,/*frame_length_lines_msb 0x0340*/
-		0x02,/*frame_length_lines_lsb 0x0341*/
-		0x10,/*line_length_pck_msb 0x0342*/
-		0x70,/* line_length_pck_lsb 0x0343*/
-		0x0F,/* x_output_size_msb   0x034C*/
-		0xC0, /* x_output_size_lsb  0x034D*/
-		0x0B, /* y_output_size_msb  0x034E*/
-		0xD0, /* y_output_size_lsb  0x034F*/
-		0x01, /* x_even_inc_lsb     0x0381*/
-		0x01, /* x_odd_inc_lsb      0x0383*/
-		0x01, /* y_even_inc_lsb                     0x0385*/
-		0x01, /* y_odd_inc_lsb                      0x0387*/
-		0x06, /* reg 0x3016 VMODEADD                0x3016*/
-		0x06, /* reg 0x30E8 HADDAVE                 0x30E8*/
-		0x00, /* reg 0x3301 RGLANESEL               0x3301*/
-
-		0x00,  /* 0x0344 */
-		0x00,  /* 0x0345 */
-		0x00,  /* 0x0346 */
-		0x00,  /* 0x0347 */
-		0x0F,  /* 0x0348 */
-		0xBF,  /* 0x0349 */
-		0x0B,  /* 0x034A */
-		0xCF,  /* 0x034B */
-	},
-	/* 120 fps settings */
-	{
-		0x1B, /*0x1B fps*/
-		/* Global Setting */
-		0x00, /* coarse_integration_time_msb*/
-		0xFE, /* coarse_integration_time_lsb*/
-
-		/* Mode Setting */
-		/* V: 1/8 V-addition (9,7),
-		H: Full */
-
-		0x01, /* frame_length_lines_msb     0x0340*/
-		0x01, /* frame_length_lines_lsb     0x0341*/
-		0x10, /* line_length_pck_msb        0x0342*/
-		0x70, /* line_length_pck_lsb        0x0343*/
-		0x0f, /* x_output_size_msb          0x034C*/
-		0xc0, /* x_output_size_lsb          0x034D*/
-		0x00, /* y_output_size_msb          0x034E*/
-		0xF8, /* y_output_size_lsb          0x034F*/
-		0x01, /* x_even_inc_lsb             0x0381*/
-		0x01, /* x_odd_inc_lsb              0x0383*/
-		0x09, /* y_even_inc_lsb             0x0385*/
-		0x07, /* y_odd_inc_lsb              0x0387*/
-		0x46, /* reg 0x3016 VMODEADD        0x3016*/
-		0x86, /* reg 0x30E8 HADDAVE         0x30E8*/
-		0x00, /* reg 0x3301 RGLANESEL       0x3301*/
-		/* add for 120fps support */
-		0x00, /* 0x0344*/
-		0x00, /* 0x0345*/
-		0x02, /* 0x0346*/
-		0x10, /* 0x0347*/
-		0x0F, /* 0x0348*/
-		0xBF, /* 0x0349*/
-		0x09, /* 0x034A*/
-		0xCF, /* 0x034B*/
-	}
-};
-struct sn12m0pz_reg sn12m0pz_regs = {
-	.reg_pat = &iu060f_reg_pat[0],
-	.reg_pat_init = &iu060f_reg_pat_init[0],
-};
-
diff --git a/drivers/media/video/msm/vb6801.c b/drivers/media/video/msm/vb6801.c
deleted file mode 100644
index f916a1c..0000000
--- a/drivers/media/video/msm/vb6801.c
+++ /dev/null
@@ -1,1616 +0,0 @@
-/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include "vb6801.h"
-
-/*=============================================================
-	SENSOR REGISTER DEFINES
-==============================================================*/
-enum {
-	REG_HOLD = 0x0104,
-	RELEASE_HOLD = 0x0000,
-	HOLD = 0x0001,
-	STANDBY_MODE = 0x0000,
-	REG_COARSE_INTEGRATION_TIME = 0x0202,
-	REG_ANALOGUE_GAIN_CODE_GLOBAL = 0x0204,
-	REG_RAMP_SCALE = 0x3116,
-	REG_POWER_MAN_ENABLE_3 = 0x3142,
-	REG_POWER_MAN_ENABLE_4 = 0x3143,
-	REG_POWER_MAN_ENABLE_5 = 0x3144,
-	REG_CCP2_DATA_FORMAT = 0x0112,
-	REG_PRE_PLL_CLK_DIV = 0x0304,
-	REG_PLL_MULTIPLIER = 0x0306,
-	REG_VT_SYS_CLK_DIV = 0x0302,
-	REG_VT_PIX_CLK_DIV = 0x0300,
-	REG_OP_SYS_CLK_DIV = 0x030A,
-	REG_OP_PIX_CLK_DIV = 0x0308,
-	REG_VT_LINE_LENGTH_PCK = 0x0342,
-	REG_X_OUTPUT_SIZE = 0x034C,
-	REG_Y_OUTPUT_SIZE = 0x034E,
-	REG_X_ODD_INC = 0x0382,
-	REG_Y_ODD_INC = 0x0386,
-	REG_VT_FRAME_LENGTH_LINES = 0x0340,
-	REG_ANALOG_TIMING_MODES_2 = 0x3113,
-	REG_BRUCE_ENABLE = 0x37B0,
-	REG_OP_CODER_SYNC_CLK_SETUP = 0x3400,
-	REG_OP_CODER_ENABLE = 0x3401,
-	REG_OP_CODER_SLOW_PAD_EN = 0x3402,
-	REG_OP_CODER_AUTO_STARTUP = 0x3414,
-	REG_SCYTHE_ENABLE = 0x3204,
-	REG_SCYTHE_WEIGHT = 0x3206,
-	REG_FRAME_COUNT = 0x0005,
-	REG_MODE_SELECT = 0x0100,
-	REG_CCP2_CHANNEL_IDENTIFIER = 0x0110,
-	REG_CCP2_SIGNALLING_MODE = 0x0111,
-	REG_BTL_LEVEL_SETUP = 0x311B,
-	REG_OP_CODER_AUTOMATIC_MODE_ENABLE = 0x3403,
-	REG_PLL_CTRL = 0x3801,
-	REG_VCM_DAC_CODE = 0x3860,
-	REG_VCM_DAC_STROBE = 0x3868,
-	REG_VCM_DAC_ENABLE = 0x386C,
-	REG_NVM_T1_ADDR_00 = 0x3600,
-	REG_NVM_T1_ADDR_01 = 0x3601,
-	REG_NVM_T1_ADDR_02 = 0x3602,
-	REG_NVM_T1_ADDR_03 = 0x3603,
-	REG_NVM_T1_ADDR_04 = 0x3604,
-	REG_NVM_T1_ADDR_05 = 0x3605,
-	REG_NVM_T1_ADDR_06 = 0x3606,
-	REG_NVM_T1_ADDR_07 = 0x3607,
-	REG_NVM_T1_ADDR_08 = 0x3608,
-	REG_NVM_T1_ADDR_09 = 0x3609,
-	REG_NVM_T1_ADDR_0A = 0x360A,
-	REG_NVM_T1_ADDR_0B = 0x360B,
-	REG_NVM_T1_ADDR_0C = 0x360C,
-	REG_NVM_T1_ADDR_0D = 0x360D,
-	REG_NVM_T1_ADDR_0E = 0x360E,
-	REG_NVM_T1_ADDR_0F = 0x360F,
-	REG_NVM_T1_ADDR_10 = 0x3610,
-	REG_NVM_T1_ADDR_11 = 0x3611,
-	REG_NVM_T1_ADDR_12 = 0x3612,
-	REG_NVM_T1_ADDR_13 = 0x3613,
-	REG_NVM_CTRL = 0x3680,
-	REG_NVM_PDN = 0x3681,
-	REG_NVM_PULSE_WIDTH = 0x368B,
-};
-
-#define VB6801_LINES_PER_FRAME_PREVIEW   800
-#define VB6801_LINES_PER_FRAME_SNAPSHOT 1600
-#define VB6801_PIXELS_PER_LINE_PREVIEW  2500
-#define VB6801_PIXELS_PER_LINE_SNAPSHOT 2500
-
-/* AF constant */
-#define VB6801_TOTAL_STEPS_NEAR_TO_FAR    25
-#define VB6801_STEPS_NEAR_TO_CLOSEST_INF  25
-
-/* for 30 fps preview */
-#define VB6801_DEFAULT_CLOCK_RATE    12000000
-
-enum vb6801_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum vb6801_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-
-enum vb6801_setting_t {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-
-struct vb6801_work_t {
-	struct work_struct work;
-};
-
-struct sensor_dynamic_params_t {
-	uint16_t preview_pixelsPerLine;
-	uint16_t preview_linesPerFrame;
-	uint16_t snapshot_pixelsPerLine;
-	uint16_t snapshot_linesPerFrame;
-	uint8_t snapshot_changed_fps;
-	uint32_t pclk;
-};
-
-struct vb6801_sensor_info {
-	/* Sensor Configuration Input Parameters */
-	uint32_t ext_clk_freq_mhz;
-	uint32_t target_frame_rate_fps;
-	uint32_t target_vt_pix_clk_freq_mhz;
-	uint32_t sub_sampling_factor;
-	uint32_t analog_binning_allowed;
-	uint32_t raw_mode;
-	uint32_t capture_mode;
-
-	/* Image Readout Registers */
-	uint32_t x_odd_inc;	/* x pixel array addressing odd increment */
-	uint32_t y_odd_inc;	/* y pixel array addressing odd increment */
-	uint32_t x_output_size;	/* width of output image  */
-	uint32_t y_output_size;	/* height of output image */
-
-	/* Declare data format */
-	uint32_t ccp2_data_format;
-
-	/* Clock Tree Registers */
-	uint32_t pre_pll_clk_div;
-	uint32_t pll_multiplier;
-	uint32_t vt_sys_clk_div;
-	uint32_t vt_pix_clk_div;
-	uint32_t op_sys_clk_div;
-	uint32_t op_pix_clk_div;
-
-	/* Video Timing Registers */
-	uint32_t vt_line_length_pck;
-	uint32_t vt_frame_length_lines;
-
-	/* Analogue Binning Registers */
-	uint8_t vtiming_major;
-	uint8_t analog_timing_modes_4;
-
-	/* Fine (pixel) Integration Time Registers */
-	uint32_t fine_integration_time;
-
-	/* Coarse (lines) Integration Time Limit Registers */
-	uint32_t coarse_integration_time_max;
-
-	/* Coarse (lines) Integration Timit Register (16-bit) */
-	uint32_t coarse_integration_time;
-
-	/* Analogue Gain Code Global Registers */
-	uint32_t analogue_gain_code_global;
-
-	/* Digital Gain Code Registers */
-	uint32_t digital_gain_code;
-
-	/* Overall gain (analogue & digital) code
-	 * Note that this is not a real register but just
-	 * an abstraction for the combination of analogue
-	 * and digital gain */
-	uint32_t gain_code;
-
-	/* FMT Test Information */
-	uint32_t pass_fail;
-	uint32_t day;
-	uint32_t month;
-	uint32_t year;
-	uint32_t tester;
-	uint32_t part_number;
-
-	/* Autofocus controls */
-	uint32_t vcm_dac_code;
-	int vcm_max_dac_code_step;
-	int vcm_proportional_factor;
-	int vcm_dac_code_spacing_ms;
-
-	/* VCM NVM Characterisation Information */
-	uint32_t vcm_dac_code_infinity_dn;
-	uint32_t vcm_dac_code_macro_up;
-	uint32_t vcm_dac_code_up_dn_delta;
-
-	/* Internal Variables */
-	uint32_t min_vt_frame_length_lines;
-};
-
-struct vb6801_work_t *vb6801_sensorw;
-struct i2c_client *vb6801_client;
-
-struct vb6801_ctrl_t {
-	const struct msm_camera_sensor_info *sensordata;
-
-	int sensormode;
-	uint32_t factor_fps;	/* init to 1 * 0x00000400 */
-	uint16_t curr_fps;
-	uint16_t max_fps;
-	int8_t pict_exp_update;
-	int8_t reducel;
-	uint16_t curr_lens_pos;
-	uint16_t init_curr_lens_pos;
-	enum vb6801_resolution_t prev_res;
-	enum vb6801_resolution_t pict_res;
-	enum vb6801_resolution_t curr_res;
-	enum vb6801_test_mode_t set_test;
-
-	struct vb6801_sensor_info s_info;
-	struct sensor_dynamic_params_t s_dynamic_params;
-};
-
-static struct vb6801_ctrl_t *vb6801_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(vb6801_wait_queue);
-DEFINE_MUTEX(vb6801_mut);
-
-static int vb6801_i2c_rxdata(unsigned short saddr,
-			     unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = 2,
-			.buf = rxdata,
-		},
-		{
-			.addr = saddr,
-			.flags = I2C_M_RD,
-			.len = 2,
-			.buf = rxdata,
-		},
-	};
-
-	if (i2c_transfer(vb6801_client->adapter, msgs, 2) < 0) {
-		CDBG("vb6801_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t vb6801_i2c_read(unsigned short raddr,
-			       unsigned short *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-
-	if (!rdata)
-		return -EIO;
-
-	memset(buf, 0, sizeof(buf));
-
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-
-	rc = vb6801_i2c_rxdata(vb6801_client->addr, buf, rlen);
-
-	if (rc < 0) {
-		CDBG("vb6801_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-
-	return rc;
-}
-
-static int32_t vb6801_i2c_read_table(struct vb6801_i2c_reg_conf_t *regs,
-				     int items)
-{
-	int i;
-	int32_t rc = -EFAULT;
-
-	for (i = 0; i < items; i++) {
-		unsigned short *buf =
-		    regs->dlen == D_LEN_BYTE ?
-		    (unsigned short *)&regs->bdata :
-		    (unsigned short *)&regs->wdata;
-		rc = vb6801_i2c_read(regs->waddr, buf, regs->dlen + 1);
-
-		if (rc < 0) {
-			CDBG("vb6801_i2c_read_table Failed!!!\n");
-			break;
-		}
-
-		regs++;
-	}
-
-	return rc;
-}
-
-static int32_t vb6801_i2c_txdata(unsigned short saddr,
-				 unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		},
-	};
-
-	if (i2c_transfer(vb6801_client->adapter, msg, 1) < 0) {
-		CDBG("vb6801_i2c_txdata faild 0x%x\n", vb6801_client->addr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-static int32_t vb6801_i2c_write_b(unsigned short waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[3];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-
-	CDBG("i2c_write_b addr = %d, val = %d\n", waddr, bdata);
-	rc = vb6801_i2c_txdata(vb6801_client->addr, buf, 3);
-
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-		     waddr, bdata);
-	}
-
-	return rc;
-}
-
-static int32_t vb6801_i2c_write_w(unsigned short waddr, unsigned short wdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[4];
-
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = (wdata & 0xFF00) >> 8;
-	buf[3] = (wdata & 0x00FF);
-
-	CDBG("i2c_write_w addr = %d, val = %d, buf[2] = 0x%x, buf[3] = 0x%x\n",
-	     waddr, wdata, buf[2], buf[3]);
-
-	rc = vb6801_i2c_txdata(vb6801_client->addr, buf, 4);
-	if (rc < 0) {
-		CDBG("i2c_write_w failed, addr = 0x%x, val = 0x%x!\n",
-		     waddr, wdata);
-	}
-
-	return rc;
-}
-
-static int32_t vb6801_i2c_write_table(struct vb6801_i2c_reg_conf_t *regs,
-				      int items)
-{
-	int i;
-	int32_t rc = -EFAULT;
-
-	for (i = 0; i < items; i++) {
-		rc = ((regs->dlen == D_LEN_BYTE) ?
-		      vb6801_i2c_write_b(regs->waddr, regs->bdata) :
-		      vb6801_i2c_write_w(regs->waddr, regs->wdata));
-
-		if (rc < 0) {
-			CDBG("vb6801_i2c_write_table Failed!!!\n");
-			break;
-		}
-
-		regs++;
-	}
-
-	return rc;
-}
-
-static int32_t vb6801_reset(const struct msm_camera_sensor_info *data)
-{
-	int rc;
-
-	rc = gpio_request(data->sensor_reset, "vb6801");
-	if (!rc) {
-		CDBG("sensor_reset SUcceeded\n");
-		gpio_direction_output(data->sensor_reset, 0);
-		mdelay(50);
-		gpio_direction_output(data->sensor_reset, 1);
-		mdelay(13);
-	} else
-		CDBG("sensor_reset FAiled\n");
-
-	return rc;
-}
-
-static int32_t vb6801_set_default_focus(void)
-{
-	int32_t rc = 0;
-
-	/* FIXME: Default focus not supported */
-
-	return rc;
-}
-
-static void vb6801_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint32_t divider; /*Q10 */
-	uint32_t pclk_mult; /*Q10 */
-	uint32_t d1;
-	uint32_t d2;
-
-	d1 =
-		(uint32_t)(
-		(vb6801_ctrl->s_dynamic_params.preview_linesPerFrame *
-		0x00000400) /
-		vb6801_ctrl->s_dynamic_params.snapshot_linesPerFrame);
-
-	d2 =
-		(uint32_t)(
-		(vb6801_ctrl->s_dynamic_params.preview_pixelsPerLine *
-		0x00000400) /
-		vb6801_ctrl->s_dynamic_params.snapshot_pixelsPerLine);
-
-
-	divider = (uint32_t) (d1 * d2) / 0x00000400;
-
-	pclk_mult = (48 * 0x400) / 60;
-
-	/* Verify PCLK settings and frame sizes. */
-	*pfps = (uint16_t)((((fps * pclk_mult) / 0x00000400) * divider)/
-				0x00000400);
-}
-
-static uint16_t vb6801_get_prev_lines_pf(void)
-{
-	if (vb6801_ctrl->prev_res == QTR_SIZE)
-		return vb6801_ctrl->s_dynamic_params.preview_linesPerFrame;
-	else
-		return vb6801_ctrl->s_dynamic_params.snapshot_linesPerFrame;
-}
-
-static uint16_t vb6801_get_prev_pixels_pl(void)
-{
-	if (vb6801_ctrl->prev_res == QTR_SIZE)
-		return vb6801_ctrl->s_dynamic_params.preview_pixelsPerLine;
-	else
-		return vb6801_ctrl->s_dynamic_params.snapshot_pixelsPerLine;
-}
-
-static uint16_t vb6801_get_pict_lines_pf(void)
-{
-	return vb6801_ctrl->s_dynamic_params.snapshot_linesPerFrame;
-}
-
-static uint16_t vb6801_get_pict_pixels_pl(void)
-{
-	return vb6801_ctrl->s_dynamic_params.snapshot_pixelsPerLine;
-}
-
-static uint32_t vb6801_get_pict_max_exp_lc(void)
-{
-	uint16_t snapshot_lines_per_frame;
-
-	if (vb6801_ctrl->pict_res == QTR_SIZE) {
-		snapshot_lines_per_frame =
-		    vb6801_ctrl->s_dynamic_params.preview_linesPerFrame - 3;
-	} else {
-		snapshot_lines_per_frame =
-		    vb6801_ctrl->s_dynamic_params.snapshot_linesPerFrame - 3;
-	}
-
-	return snapshot_lines_per_frame;
-}
-
-static int32_t vb6801_set_fps(struct fps_cfg *fps)
-{
-	int32_t rc = 0;
-
-	/* input is new fps in Q8 format */
-	switch (fps->fps_div) {
-	case 7680:		/* 30 * Q8 */
-		vb6801_ctrl->factor_fps = 1;
-		break;
-
-	case 3840:		/* 15 * Q8 */
-		vb6801_ctrl->factor_fps = 2;
-		break;
-
-	case 2560:		/* 10 * Q8 */
-		vb6801_ctrl->factor_fps = 3;
-		break;
-
-	case 1920:		/* 7.5 * Q8 */
-		vb6801_ctrl->factor_fps = 4;
-		break;
-
-	default:
-		rc = -ENODEV;
-		break;
-	}
-
-	return rc;
-}
-
-static int32_t vb6801_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-	uint16_t lpf;
-
-	if (vb6801_ctrl->curr_res == SENSOR_FULL_SIZE)
-		lpf = VB6801_LINES_PER_FRAME_SNAPSHOT;
-	else
-		lpf = VB6801_LINES_PER_FRAME_PREVIEW;
-
-	/* hold */
-	rc = vb6801_i2c_write_w(REG_HOLD, HOLD);
-	if (rc < 0)
-		goto exp_gain_done;
-
-	if ((vb6801_ctrl->curr_fps <
-	     vb6801_ctrl->max_fps / vb6801_ctrl->factor_fps) &&
-	    (!vb6801_ctrl->pict_exp_update)) {
-
-		if (vb6801_ctrl->reducel) {
-
-			rc = vb6801_i2c_write_w(REG_VT_FRAME_LENGTH_LINES,
-						lpf * vb6801_ctrl->factor_fps);
-
-			vb6801_ctrl->curr_fps =
-			    vb6801_ctrl->max_fps / vb6801_ctrl->factor_fps;
-
-		} else if (!vb6801_ctrl->reducel) {
-
-			rc = vb6801_i2c_write_w(REG_COARSE_INTEGRATION_TIME,
-						line * vb6801_ctrl->factor_fps);
-
-			vb6801_ctrl->reducel = 1;
-		}
-	} else if ((vb6801_ctrl->curr_fps >
-		    vb6801_ctrl->max_fps / vb6801_ctrl->factor_fps) &&
-		   (!vb6801_ctrl->pict_exp_update)) {
-
-		rc = vb6801_i2c_write_w(REG_VT_FRAME_LENGTH_LINES,
-					lpf * vb6801_ctrl->factor_fps);
-
-		vb6801_ctrl->curr_fps =
-		    vb6801_ctrl->max_fps / vb6801_ctrl->factor_fps;
-
-	} else {
-		/* analogue_gain_code_global */
-		rc = vb6801_i2c_write_w(REG_ANALOGUE_GAIN_CODE_GLOBAL, gain);
-		if (rc < 0)
-			goto exp_gain_done;
-
-		/* coarse_integration_time */
-		rc = vb6801_i2c_write_w(REG_COARSE_INTEGRATION_TIME,
-					line * vb6801_ctrl->factor_fps);
-		if (rc < 0)
-			goto exp_gain_done;
-
-		vb6801_ctrl->pict_exp_update = 1;
-	}
-
-	rc = vb6801_i2c_write_w(REG_HOLD, RELEASE_HOLD);
-
-exp_gain_done:
-	return rc;
-}
-
-static int32_t vb6801_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	vb6801_ctrl->pict_exp_update = 1;
-	return vb6801_write_exp_gain(gain, line);
-}
-
-static int32_t vb6801_power_down(void)
-{
-	int32_t rc = 0;
-	rc = vb6801_i2c_write_b(REG_NVM_PDN, 0);
-
-	mdelay(5);
-	return rc;
-}
-
-static int32_t vb6801_go_to_position(uint32_t target_vcm_dac_code,
-				     struct vb6801_sensor_info *ps)
-{
-	/* Prior to running this function the following values must
-	 * be initialised in the sensor data structure, PS
-	 * ps->vcm_dac_code
-	 * ps->vcm_max_dac_code_step
-	 * ps->vcm_dac_code_spacing_ms */
-
-	int32_t rc = 0;
-
-	ps->vcm_dac_code = target_vcm_dac_code;
-
-	/* Restore Strobe to zero state */
-	rc = vb6801_i2c_write_b(REG_VCM_DAC_STROBE, 0x00);
-	if (rc < 0)
-		return rc;
-
-	/* Write 9-bit VCM DAC Code */
-	rc = vb6801_i2c_write_w(REG_VCM_DAC_CODE, ps->vcm_dac_code);
-	if (rc < 0)
-		return rc;
-
-	/* Generate a rising edge on the dac_strobe to latch
-	 * new DAC value */
-
-	rc = vb6801_i2c_write_w(REG_VCM_DAC_STROBE, 0x01);
-
-	return rc;
-}
-
-static int32_t vb6801_move_focus(int direction, int32_t num_steps)
-{
-	int16_t step_direction;
-	int16_t actual_step;
-	int16_t next_position;
-	uint32_t step_size;
-	int16_t small_move[4];
-	uint16_t i;
-	int32_t rc = 0;
-
-	step_size = (vb6801_ctrl->s_info.vcm_dac_code_macro_up -
-		     vb6801_ctrl->s_info.vcm_dac_code_infinity_dn) /
-	    VB6801_TOTAL_STEPS_NEAR_TO_FAR;
-
-	if (num_steps > VB6801_TOTAL_STEPS_NEAR_TO_FAR)
-		num_steps = VB6801_TOTAL_STEPS_NEAR_TO_FAR;
-	else if (num_steps == 0)
-		return -EINVAL;
-
-	if (direction == MOVE_NEAR)
-		step_direction = 4;
-	else if (direction == MOVE_FAR)
-		step_direction = -4;
-	else
-		return -EINVAL;
-
-	/* need to decide about default position and power supplied
-	 * at start up and reset */
-	if (vb6801_ctrl->curr_lens_pos < vb6801_ctrl->init_curr_lens_pos)
-		vb6801_ctrl->curr_lens_pos = vb6801_ctrl->init_curr_lens_pos;
-
-	actual_step = (step_direction * num_steps);
-
-	next_position = vb6801_ctrl->curr_lens_pos;
-
-	for (i = 0; i < 4; i++) {
-		if (actual_step >= 0)
-			small_move[i] =
-			    (i + 1) * actual_step / 4 - i * actual_step / 4;
-
-		if (actual_step < 0)
-			small_move[i] =
-			    (i + 1) * actual_step / 4 - i * actual_step / 4;
-	}
-
-	if (next_position > 511)
-		next_position = 511;
-	else if (next_position < 0)
-		next_position = 0;
-
-	/* for damping */
-	for (i = 0; i < 4; i++) {
-		next_position =
-		    (int16_t) (vb6801_ctrl->curr_lens_pos + small_move[i]);
-
-		/* Writing the digital code for current to the actuator */
-		CDBG("next_position in damping mode = %d\n", next_position);
-
-		rc = vb6801_go_to_position(next_position, &vb6801_ctrl->s_info);
-		if (rc < 0) {
-			CDBG("go_to_position Failed!!!\n");
-			return rc;
-		}
-
-		vb6801_ctrl->curr_lens_pos = next_position;
-		if (i < 3)
-			mdelay(5);
-	}
-
-	return rc;
-}
-
-static int vb6801_read_nvm_data(struct vb6801_sensor_info *ps)
-{
-	/* +--------+------+------+----------------+---------------+
-	 * | Index | NVM | NVM | Name | Description |
-	 * | | Addr | Byte | | |
-	 * +--------+------+------+----------------+---------------+
-	 * | 0x3600 | 0 | 3 | nvm_t1_addr_00 | {PF[2:0]:Day[4:0]} |
-	 * | 0x3601 | 0 | 2 | nvm_t1_addr_01 | {Month[3:0]:Year[3:0]} |
-	 * | 0x3602 | 0 | 1 | nvm_t1_addr_02 | Tester[7:0] |
-	 * | 0x3603 | 0 | 0 | nvm_t1_addr_03 | Part[15:8] |
-	 * +--------+------+------+----------------+---------------+
-	 * | 0x3604 | 1 | 3 | nvm_t1_addr_04 | Part[7:0] |
-	 * | 0x3605 | 1 | 2 | nvm_t1_addr_05 | StartWPM[7:0] |
-	 * | 0x3606 | 1 | 1 | nvm_t1_addr_06 | Infinity[7:0] |
-	 * | 0x3607 | 1 | 0 | nvm_t1_addr_07 | Macro[7:0] |
-	 * +--------+------+------+----------------+---------------+
-	 * | 0x3608 | 2 | 3 | nvm_t1_addr_08 | Reserved |
-	 * | 0x3609 | 2 | 2 | nvm_t1_addr_09 | Reserved |
-	 * | 0x360A | 2 | 1 | nvm_t1_addr_0A | UpDown[7:0] |
-	 * | 0x360B | 2 | 0 | nvm_t1_addr_0B | Reserved |
-	 * +--------+------+------+----------------+---------------+
-	 * | 0x360C | 3 | 3 | nvm_t1_addr_0C | Reserved |
-	 * | 0x360D | 3 | 2 | nvm_t1_addr_0D | Reserved |
-	 * | 0x360E | 3 | 1 | nvm_t1_addr_0E | Reserved |
-	 * | 0x360F | 3 | 0 | nvm_t1_addr_0F | Reserved |
-	 * +--------+------+------+----------------+---------------+
-	 * | 0x3610 | 4 | 3 | nvm_t1_addr_10 | Reserved |
-	 * | 0x3611 | 4 | 2 | nvm_t1_addr_11 | Reserved |
-	 * | 0x3612 | 4 | 1 | nvm_t1_addr_12 | Reserved |
-	 * | 0x3613 | 4 | 0 | nvm_t1_addr_13 | Reserved |
-	 * +--------+------+------+----------------+---------------+*/
-
-	int32_t rc;
-	struct vb6801_i2c_reg_conf_t rreg[] = {
-		{REG_NVM_T1_ADDR_00, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_01, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_02, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_03, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_04, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_05, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_06, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_07, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_08, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_09, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_0A, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_0B, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_0C, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_0D, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_0E, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_0F, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_10, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_11, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_12, 0, 0, D_LEN_BYTE},
-		{REG_NVM_T1_ADDR_13, 0, 0, D_LEN_BYTE},
-	};
-
-	struct vb6801_i2c_reg_conf_t wreg[] = {
-		/* Enable NVM for Direct Reading */
-		{REG_NVM_CTRL, 0, 2, D_LEN_BYTE},
-
-		/* Power up NVM */
-		{REG_NVM_PDN, 0, 1, D_LEN_BYTE},
-	};
-
-	rc = vb6801_i2c_write_table(wreg, ARRAY_SIZE(wreg));
-	if (rc < 0) {
-		CDBG("I2C Write Table FAILED!!!\n");
-		return rc;
-	}
-
-	/* NVM Read Pulse Width
-	 * ====================
-	 * nvm_pulse_width_us = nvm_pulse_width_ext_clk / ext_clk_freq_mhz
-	 * Valid Range for Read Pulse Width = 400ns -> 3.0us
-	 * Min ext_clk_freq_mhz = 6MHz  => 3.0 *  6  = 18
-	 * Max ext_clk_freq_mhz = 27MHz => 0.4 * 27 = 10.8
-	 * Choose 15 as a common value
-	 *  - 15 /  6.0 = 2.5000us
-	 *  - 15 / 12.0 = 1.2500us
-	 *  - 15 / 27.0 = 0.5555us */
-	rc = vb6801_i2c_write_w(REG_NVM_PULSE_WIDTH, 15);
-	if (rc < 0) {
-		rc = -EBUSY;
-		goto nv_shutdown;
-	}
-
-	rc = vb6801_i2c_read_table(rreg, ARRAY_SIZE(rreg));
-	if (rc < 0) {
-		CDBG("I2C Read Table FAILED!!!\n");
-		rc = -EBUSY;
-		goto nv_shutdown;
-	}
-
-	/* Decode and Save FMT Info */
-	ps->pass_fail = (rreg[0].bdata & 0x00E0) >> 5;
-	ps->day = (rreg[0].bdata & 0x001F);
-	ps->month = (rreg[1].bdata & 0x00F0) >> 4;
-	ps->year = (rreg[1].bdata & 0x000F) + 2000;
-	ps->tester = rreg[2].bdata;
-	ps->part_number = (rreg[3].bdata << 8) + rreg[4].bdata;
-
-	/* Decode and Save VCM Dac Values in data structure */
-	ps->vcm_dac_code_infinity_dn = rreg[6].bdata;
-	ps->vcm_dac_code_macro_up = rreg[7].bdata << 1;
-	ps->vcm_dac_code_up_dn_delta = rreg[10].bdata;
-
-nv_shutdown:
-	/* Power Down NVM to extend life time */
-	rc = vb6801_i2c_write_b(REG_NVM_PDN, 0);
-
-	return rc;
-}
-
-static int vb6801_config_sensor(int32_t ext_clk_freq_mhz,
-				int32_t target_frame_rate_fps,
-				int32_t target_vt_pix_clk_freq_mhz,
-				uint32_t sub_sampling_factor,
-				uint32_t analog_binning_allowed,
-				uint32_t raw_mode, int capture_mode,
-				enum vb6801_resolution_t res)
-{
-	uint32_t rc;
-	/* ext_clk_freq_mhz      = 6.0 -> 27.0 MHz
-	 * target_frame_rate_fps  = 15 fps
-	 * target_vt_pix_clk_freq_mhz = 24.0 -> 64.0MHz
-	 * sub_sampling factor   = 1, 2, 3, or 4
-	 * raw_mode factor       = 10
-	 *
-	 * capture_mode, 0 = CCP1
-	 * capture_mode, 1 = CCP2
-	 * capture_mode, 2 = 10-bit parallel + hsync + vsync */
-
-	/* Declare data format */
-	uint32_t ccp2_data_format = 0x0A0A;
-
-	/*  Declare clock tree variables */
-	int32_t min_pll_ip_freq_mhz = 6;
-	int32_t max_pll_op_freq_mhz = 640;
-	uint32_t pre_pll_clk_div = 1;
-	int32_t pll_ip_freq_mhz = 6;
-	uint32_t pll_multiplier = 100;
-	int32_t pll_op_freq_mhz = 600;
-	uint32_t vt_sys_clk_div = 1;
-	int32_t vt_sys_clk_freq_mhz = 600;
-	uint32_t vt_pix_clk_div = 10;
-	int32_t vt_pix_clk_freq_mhz = 60;
-	uint32_t op_sys_clk_div = 1;
-	int32_t op_sys_clk_freq_mhz = 60;
-	uint32_t op_pix_clk_div = 10;
-	int32_t op_pix_clk_freq_mhz = 60;
-
-	/* Declare pixel array and frame timing variables */
-	uint32_t x_pixel_array = 2064;
-	uint32_t y_pixel_array = 1544;
-	uint32_t x_even_inc = 1;
-	uint32_t x_odd_inc = 1;
-	uint32_t y_even_inc = 1;
-	uint32_t y_odd_inc = 1;
-	uint32_t x_output_size = 2064;
-	uint32_t y_output_size = 1544;
-	uint32_t additional_rows = 2;
-	uint32_t min_vt_frame_blanking_lines = 16;
-	uint32_t vt_line_length_pck = 2500;
-	uint32_t vt_line_length_us = 0;
-	uint32_t min_vt_frame_length_lines = 1562;
-	uint32_t vt_frame_length_lines = 1600;
-	uint32_t target_vt_frame_length_ms;	/* 200 * 0x0001000 / 3; */
-	uint32_t vt_frame_length_ms;	/* 200 * 0x0001000 / 3; */
-	uint32_t frame_rate_fps = 15;
-
-	/* Coarse intergration time */
-	uint32_t coarse_integration_time = 1597;
-	uint32_t coarse_integration_time_max_margin = 3;
-	uint16_t frame_count;
-	int timeout;
-
-	struct vb6801_sensor_info *pinfo = &vb6801_ctrl->s_info;
-
-	struct vb6801_i2c_reg_conf_t rreg[] = {
-		{REG_PRE_PLL_CLK_DIV, 0, 0, D_LEN_WORD},
-		{REG_PLL_MULTIPLIER, 0, 0, D_LEN_WORD},
-		{REG_VT_SYS_CLK_DIV, 0, 0, D_LEN_WORD},
-		{REG_VT_PIX_CLK_DIV, 0, 0, D_LEN_WORD},
-		{REG_OP_SYS_CLK_DIV, 0, 0, D_LEN_WORD},
-		{REG_OP_PIX_CLK_DIV, 0, 0, D_LEN_WORD},
-		{REG_FRAME_COUNT, 0, 0, D_LEN_BYTE},
-	};
-
-	struct vb6801_i2c_reg_conf_t wreg2[] = {
-		{REG_POWER_MAN_ENABLE_3, 0, 95, D_LEN_BYTE},
-		{REG_POWER_MAN_ENABLE_4, 0, 142, D_LEN_BYTE},
-		{REG_POWER_MAN_ENABLE_5, 0, 7, D_LEN_BYTE},
-	};
-
-	/* VIDEO TIMING CALCULATIONS
-	 * ========================= */
-
-	/* Pixel Array Size */
-	x_pixel_array = 2064;
-	y_pixel_array = 1544;
-
-	/* set current resolution */
-	vb6801_ctrl->curr_res = res;
-
-	/* Analogue binning setup */
-	if (pinfo->analog_binning_allowed > 0 &&
-	    pinfo->sub_sampling_factor == 4) {
-
-		pinfo->vtiming_major = 1;
-		pinfo->analog_timing_modes_4 = 32;
-	} else if (pinfo->analog_binning_allowed > 0 &&
-		   pinfo->sub_sampling_factor == 2) {
-
-		pinfo->vtiming_major = 1;
-		pinfo->analog_timing_modes_4 = 0;
-	} else {
-
-		pinfo->vtiming_major = 0;
-		pinfo->analog_timing_modes_4 = 0;
-	}
-
-	/* Sub-Sampling X & Y Odd Increments: valid values 1, 3, 5, 7 */
-	x_even_inc = 1;
-	y_even_inc = 1;
-	x_odd_inc = (sub_sampling_factor << 1) - x_even_inc;
-	y_odd_inc = (sub_sampling_factor << 1) - y_even_inc;
-
-	/* Output image size
-	 * Must always be a multiple of 2 - round down */
-	x_output_size = ((x_pixel_array / sub_sampling_factor) >> 1) << 1;
-	y_output_size = ((y_pixel_array / sub_sampling_factor) >> 1) << 1;
-
-	/* Output data format */
-	ccp2_data_format = (raw_mode << 8) + raw_mode;
-
-	/* Pre PLL clock divider : valid values 1, 2 or 4
-	 * The 1st step is to ensure that PLL input frequency is as close
-	 * as possible to the min allowed PLL input frequency.
-	 * This yields the smallest step size in the PLL output frequency. */
-	pre_pll_clk_div =
-	    ((int)(ext_clk_freq_mhz / min_pll_ip_freq_mhz) >> 1) << 1;
-	if (pre_pll_clk_div < 2)
-		pre_pll_clk_div = 1;
-
-	pll_ip_freq_mhz = ext_clk_freq_mhz / pre_pll_clk_div;
-
-	/* Video Timing System Clock divider: valid values 1, 2, 4
-	 * Now need to work backwards through the clock tree to determine the
-	 * 1st pass estimates for vt_sys_clk_freq_mhz and then the PLL output
-	 * frequency.*/
-	vt_sys_clk_freq_mhz = vt_pix_clk_div * target_vt_pix_clk_freq_mhz;
-	vt_sys_clk_div = max_pll_op_freq_mhz / vt_sys_clk_freq_mhz;
-	if (vt_sys_clk_div < 2)
-		vt_sys_clk_div = 1;
-
-	/* PLL Mulitplier: min , max 106 */
-	pll_op_freq_mhz = vt_sys_clk_div * vt_sys_clk_freq_mhz;
-	pll_multiplier = (pll_op_freq_mhz * 0x0001000) / pll_ip_freq_mhz;
-
-	/* Calculate the acutal pll output frequency
-	 * - the pll_multiplier calculation introduces a quantisation error
-	 *   due the integer nature of the pll multiplier */
-	pll_op_freq_mhz = (pll_ip_freq_mhz * pll_multiplier) / 0x0001000;
-
-	/* Re-calculate video timing clock frequencies based
-	 * on actual PLL freq */
-	vt_sys_clk_freq_mhz = pll_op_freq_mhz / vt_sys_clk_div;
-	vt_pix_clk_freq_mhz = ((vt_sys_clk_freq_mhz * 0x0001000) /
-				vt_pix_clk_div)/0x0001000;
-
-	/* Output System Clock Divider: valid value 1, 2, 4, 6, 8
-	 * op_sys_clk_div = vt_sys_clk_div;*/
-	op_sys_clk_div = (vt_sys_clk_div * sub_sampling_factor);
-	if (op_sys_clk_div < 2)
-		op_sys_clk_div = 1;
-
-	/* Calculate output timing clock frequencies */
-	op_sys_clk_freq_mhz = pll_op_freq_mhz / op_sys_clk_div;
-	op_pix_clk_freq_mhz =
-	    (op_sys_clk_freq_mhz * 0x0001000) / (op_pix_clk_div * 0x0001000);
-
-	/* Line length in pixels and us */
-	vt_line_length_pck = 2500;
-	vt_line_length_us =
-	    vt_line_length_pck * 0x0001000 / vt_pix_clk_freq_mhz;
-
-	/* Target vt_frame_length_ms */
-	target_vt_frame_length_ms = (1000 * 0x0001000 / target_frame_rate_fps);
-
-	/* Frame length in lines */
-	min_vt_frame_length_lines =
-	    additional_rows + y_output_size + min_vt_frame_blanking_lines;
-
-	vt_frame_length_lines =
-	    ((1000 * target_vt_frame_length_ms) / vt_line_length_us);
-
-	if (vt_frame_length_lines <= min_vt_frame_length_lines)
-		vt_frame_length_lines = min_vt_frame_length_lines;
-
-	/* Calcuate the actual frame length in ms */
-	vt_frame_length_ms = (vt_frame_length_lines * vt_line_length_us / 1000);
-
-	/* Frame Rate in fps */
-	frame_rate_fps = (1000 * 0x0001000 / vt_frame_length_ms);
-
-	/* Set coarse integration to max */
-	coarse_integration_time =
-	    vt_frame_length_lines - coarse_integration_time_max_margin;
-
-	CDBG("SENSOR VIDEO TIMING SUMMARY:\n");
-	CDBG(" ============================\n");
-	CDBG("ext_clk_freq_mhz      = %d\n", ext_clk_freq_mhz);
-	CDBG("pre_pll_clk_div       = %d\n", pre_pll_clk_div);
-	CDBG("pll_ip_freq_mhz       = %d\n", pll_ip_freq_mhz);
-	CDBG("pll_multiplier        = %d\n", pll_multiplier);
-	CDBG("pll_op_freq_mhz       = %d\n", pll_op_freq_mhz);
-	CDBG("vt_sys_clk_div        = %d\n", vt_sys_clk_div);
-	CDBG("vt_sys_clk_freq_mhz   = %d\n", vt_sys_clk_freq_mhz);
-	CDBG("vt_pix_clk_div        = %d\n", vt_pix_clk_div);
-	CDBG("vt_pix_clk_freq_mhz   = %d\n", vt_pix_clk_freq_mhz);
-	CDBG("op_sys_clk_div        = %d\n", op_sys_clk_div);
-	CDBG("op_sys_clk_freq_mhz   = %d\n", op_sys_clk_freq_mhz);
-	CDBG("op_pix_clk_div        = %d\n", op_pix_clk_div);
-	CDBG("op_pix_clk_freq_mhz   = %d\n", op_pix_clk_freq_mhz);
-	CDBG("vt_line_length_pck    = %d\n", vt_line_length_pck);
-	CDBG("vt_line_length_us     = %d\n", vt_line_length_us/0x0001000);
-	CDBG("vt_frame_length_lines = %d\n", vt_frame_length_lines);
-	CDBG("vt_frame_length_ms    = %d\n", vt_frame_length_ms/0x0001000);
-	CDBG("frame_rate_fps        = %d\n", frame_rate_fps);
-	CDBG("ccp2_data_format = %d\n", ccp2_data_format);
-	CDBG("x_output_size = %d\n", x_output_size);
-	CDBG("y_output_size = %d\n", y_output_size);
-	CDBG("x_odd_inc = %d\n", x_odd_inc);
-	CDBG("y_odd_inc = %d\n", y_odd_inc);
-	CDBG("(vt_frame_length_lines * frame_rate_factor ) = %d\n",
-	    (vt_frame_length_lines * vb6801_ctrl->factor_fps));
-	CDBG("coarse_integration_time = %d\n", coarse_integration_time);
-	CDBG("pinfo->vcm_dac_code = %d\n", pinfo->vcm_dac_code);
-	CDBG("capture_mode = %d\n", capture_mode);
-
-	/* RE-CONFIGURE SENSOR WITH NEW TIMINGS
-	 * ====================================
-	 * Enter Software Standby Mode */
-	rc = vb6801_i2c_write_b(REG_MODE_SELECT, 0);
-	if (rc < 0) {
-		CDBG("I2C vb6801_i2c_write_b FAILED!!!\n");
-		return rc;
-	}
-
-	/* Wait 100ms */
-	mdelay(100);
-
-	if (capture_mode == 0) {
-
-		rc = vb6801_i2c_write_b(REG_CCP2_CHANNEL_IDENTIFIER, 0);
-		rc = vb6801_i2c_write_b(REG_CCP2_SIGNALLING_MODE, 0);
-	} else if (capture_mode == 1) {
-
-		rc = vb6801_i2c_write_b(REG_CCP2_CHANNEL_IDENTIFIER, 0);
-		rc = vb6801_i2c_write_b(REG_CCP2_SIGNALLING_MODE, 1);
-	}
-
-	{
-		struct vb6801_i2c_reg_conf_t wreg[] = {
-			/* Re-configure Sensor */
-			{REG_CCP2_DATA_FORMAT, ccp2_data_format, 0,
-			 D_LEN_WORD},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL, 128, 0, D_LEN_WORD},
-			{REG_PRE_PLL_CLK_DIV, pre_pll_clk_div, 0, D_LEN_WORD},
-			{REG_VT_SYS_CLK_DIV, vt_sys_clk_div, 0, D_LEN_WORD},
-			{REG_VT_PIX_CLK_DIV, vt_pix_clk_div, 0, D_LEN_WORD},
-			{REG_OP_SYS_CLK_DIV, vt_sys_clk_div, 0, D_LEN_WORD},
-			{REG_OP_PIX_CLK_DIV, vt_pix_clk_div, 0, D_LEN_WORD},
-			{REG_VT_LINE_LENGTH_PCK, vt_line_length_pck, 0,
-			 D_LEN_WORD},
-			{REG_X_OUTPUT_SIZE, x_output_size, 0, D_LEN_WORD},
-			{REG_Y_OUTPUT_SIZE, y_output_size, 0, D_LEN_WORD},
-			{REG_X_ODD_INC, x_odd_inc, 0, D_LEN_WORD},
-			{REG_Y_ODD_INC, y_odd_inc, 0, D_LEN_WORD},
-			{REG_VT_FRAME_LENGTH_LINES,
-			 vt_frame_length_lines * vb6801_ctrl->factor_fps, 0,
-			 D_LEN_WORD},
-			{REG_COARSE_INTEGRATION_TIME,
-			 coarse_integration_time, 0, D_LEN_WORD},
-			/* Analogue Settings */
-			{REG_ANALOG_TIMING_MODES_2, 0, 132, D_LEN_BYTE},
-			{REG_RAMP_SCALE, 0, 5, D_LEN_BYTE},
-			{REG_BTL_LEVEL_SETUP, 0, 11, D_LEN_BYTE},
-			/* Enable Defect Correction */
-			{REG_SCYTHE_ENABLE, 0, 1, D_LEN_BYTE},
-			{REG_SCYTHE_WEIGHT, 0, 16, D_LEN_BYTE},
-			{REG_BRUCE_ENABLE, 0, 1, D_LEN_BYTE},
-			/* Auto Focus Configuration
-			 * Please note that the DAC Code is a written as a
-			 * 16-bit value 0 = infinity (no DAC current) */
-			{REG_VCM_DAC_CODE, pinfo->vcm_dac_code, 0, D_LEN_WORD},
-			{REG_VCM_DAC_STROBE, 0, 0, D_LEN_BYTE},
-			{REG_VCM_DAC_ENABLE, 0, 1, D_LEN_BYTE},
-		};
-
-		rc = vb6801_i2c_write_table(wreg, ARRAY_SIZE(wreg));
-		if (rc < 0) {
-			CDBG("I2C Write Table FAILED!!!\n");
-			return rc;
-		}
-	}
-	/* Parallel Interface Configuration */
-	if (capture_mode >= 2) {
-		struct vb6801_i2c_reg_conf_t wreg1[] = {
-			{REG_OP_CODER_SYNC_CLK_SETUP, 0, 15, D_LEN_BYTE},
-			{REG_OP_CODER_ENABLE, 0, 3, D_LEN_BYTE},
-			{REG_OP_CODER_SLOW_PAD_EN, 0, 1, D_LEN_BYTE},
-			{REG_OP_CODER_AUTOMATIC_MODE_ENABLE, 0, 3, D_LEN_BYTE},
-			{REG_OP_CODER_AUTO_STARTUP, 0, 2, D_LEN_BYTE},
-		};
-
-		rc = vb6801_i2c_write_table(wreg1, ARRAY_SIZE(wreg1));
-		if (rc < 0) {
-			CDBG("I2C Write Table FAILED!!!\n");
-			return rc;
-		}
-	}
-
-	/* Enter Streaming Mode */
-	rc = vb6801_i2c_write_b(REG_MODE_SELECT, 1);
-	if (rc < 0) {
-		CDBG("I2C Write Table FAILED!!!\n");
-		return rc;
-	}
-
-	/* Wait until the sensor starts streaming
-	 * Poll until the reported frame_count value is != 0xFF */
-	frame_count = 0xFF;
-	timeout = 2000;
-	while (frame_count == 0xFF && timeout > 0) {
-		rc = vb6801_i2c_read(REG_FRAME_COUNT, &frame_count, 1);
-		if (rc < 0)
-			return rc;
-
-		CDBG("REG_FRAME_COUNT  = 0x%x\n", frame_count);
-		timeout--;
-	}
-
-	/* Post Streaming Configuration */
-
-	rc = vb6801_i2c_write_table(wreg2, ARRAY_SIZE(wreg2));
-	if (rc < 0) {
-		CDBG("I2C Write Table FAILED!!!\n");
-		return rc;
-	}
-
-	rc = vb6801_i2c_read_table(rreg, ARRAY_SIZE(rreg));
-	if (rc < 0) {
-		CDBG("I2C Read Table FAILED!!!\n");
-		return rc;
-	}
-
-	CDBG("REG_PRE_PLL_CLK_DIV = 0x%x\n", rreg[0].wdata);
-	CDBG("REG_PLL_MULTIPLIER  = 0x%x\n", rreg[1].wdata);
-	CDBG("REG_VT_SYS_CLK_DIV  = 0x%x\n", rreg[2].wdata);
-	CDBG("REG_VT_PIX_CLK_DIV  = 0x%x\n", rreg[3].wdata);
-	CDBG("REG_OP_SYS_CLK_DIV  = 0x%x\n", rreg[4].wdata);
-	CDBG("REG_OP_PIX_CLK_DIV  = 0x%x\n", rreg[5].wdata);
-	CDBG("REG_FRAME_COUNT  = 0x%x\n", rreg[6].bdata);
-
-	mdelay(50);
-	frame_count = 0;
-	rc = vb6801_i2c_read(REG_FRAME_COUNT, &frame_count, 1);
-	CDBG("REG_FRAME_COUNT1  = 0x%x\n", frame_count);
-
-	mdelay(150);
-	frame_count = 0;
-	rc = vb6801_i2c_read(REG_FRAME_COUNT, &frame_count, 1);
-	CDBG("REG_FRAME_COUNT2  = 0x%x\n", frame_count);
-
-	mdelay(100);
-	frame_count = 0;
-	rc = vb6801_i2c_read(REG_FRAME_COUNT, &frame_count, 1);
-	CDBG("REG_FRAME_COUNT3  = 0x%x\n", frame_count);
-
-	mdelay(250);
-	frame_count = 0;
-	rc = vb6801_i2c_read(REG_FRAME_COUNT, &frame_count, 1);
-	CDBG("REG_FRAME_COUNT4  = 0x%x\n", frame_count);
-
-	return rc;
-}
-
-static int vb6801_sensor_init_done(const struct msm_camera_sensor_info *data)
-{
-	gpio_direction_output(data->sensor_reset, 0);
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-
-static int vb6801_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&vb6801_wait_queue);
-	return 0;
-}
-
-static int32_t vb6801_video_config(int mode, int res)
-{
-	int32_t rc = 0;
-
-	vb6801_ctrl->prev_res = res;
-	vb6801_ctrl->curr_res = res;
-	vb6801_ctrl->sensormode = mode;
-
-	rc = vb6801_config_sensor(12, 30, 60, 2, 1, 10, 2, RES_PREVIEW);
-	if (rc < 0)
-		return rc;
-
-	rc = vb6801_i2c_read(REG_VT_LINE_LENGTH_PCK,
-			     &vb6801_ctrl->s_dynamic_params.
-			     preview_pixelsPerLine, 2);
-	if (rc < 0)
-		return rc;
-
-	rc = vb6801_i2c_read(REG_VT_LINE_LENGTH_PCK,
-			     &vb6801_ctrl->s_dynamic_params.
-			     preview_linesPerFrame, 2);
-
-	return rc;
-}
-
-static int32_t vb6801_snapshot_config(int mode, int res)
-{
-	int32_t rc = 0;
-
-	vb6801_ctrl->curr_res = vb6801_ctrl->pict_res;
-	vb6801_ctrl->sensormode = mode;
-
-	rc = vb6801_config_sensor(12, 12, 48, 1, 1, 10, 2, RES_CAPTURE);
-	if (rc < 0)
-		return rc;
-
-	rc = vb6801_i2c_read(REG_VT_LINE_LENGTH_PCK,
-			     &vb6801_ctrl->s_dynamic_params.
-			     snapshot_pixelsPerLine, 2);
-	if (rc < 0)
-		return rc;
-
-	rc = vb6801_i2c_read(REG_VT_LINE_LENGTH_PCK,
-			     &vb6801_ctrl->s_dynamic_params.
-			     snapshot_linesPerFrame, 2);
-
-	return rc;
-}
-
-static int32_t vb6801_set_sensor_mode(int mode, int res)
-{
-	int32_t rc = 0;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = vb6801_video_config(mode, res);
-		break;
-
-	case SENSOR_SNAPSHOT_MODE:
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = vb6801_snapshot_config(mode, res);
-		break;
-
-	default:
-		rc = -EINVAL;
-		break;
-	}
-
-	return rc;
-}
-
-int vb6801_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long rc = 0;
-
-	if (copy_from_user(&cdata,
-			   (void *)argp, sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-
-	mutex_lock(&vb6801_mut);
-
-	CDBG("vb6801_sensor_config, cfgtype = %d\n", cdata.cfgtype);
-
-	switch (cdata.cfgtype) {
-	case CFG_GET_PICT_FPS:
-		vb6801_get_pict_fps(cdata.cfg.gfps.prevfps,
-				    &(cdata.cfg.gfps.pictfps));
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_L_PF:
-		cdata.cfg.prevl_pf = vb6801_get_prev_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PREV_P_PL:
-		cdata.cfg.prevp_pl = vb6801_get_prev_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_L_PF:
-		cdata.cfg.pictl_pf = vb6801_get_pict_lines_pf();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_P_PL:
-		cdata.cfg.pictp_pl = vb6801_get_pict_pixels_pl();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_GET_PICT_MAX_EXP_LC:
-		cdata.cfg.pict_max_exp_lc = vb6801_get_pict_max_exp_lc();
-
-		if (copy_to_user((void *)argp,
-				 &cdata, sizeof(struct sensor_cfg_data)))
-			rc = -EFAULT;
-		break;
-
-	case CFG_SET_FPS:
-	case CFG_SET_PICT_FPS:
-		rc = vb6801_set_fps(&(cdata.cfg.fps));
-		break;
-
-	case CFG_SET_EXP_GAIN:
-		rc = vb6801_write_exp_gain(cdata.cfg.exp_gain.gain,
-					   cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_PICT_EXP_GAIN:
-		rc = vb6801_set_pict_exp_gain(cdata.cfg.exp_gain.gain,
-					      cdata.cfg.exp_gain.line);
-		break;
-
-	case CFG_SET_MODE:
-		rc = vb6801_set_sensor_mode(cdata.mode, cdata.rs);
-		break;
-
-	case CFG_PWR_DOWN:
-		rc = vb6801_power_down();
-		break;
-
-	case CFG_MOVE_FOCUS:
-		rc = vb6801_move_focus(cdata.cfg.focus.dir,
-				       cdata.cfg.focus.steps);
-		break;
-
-	case CFG_SET_DEFAULT_FOCUS:
-		rc = vb6801_set_default_focus();
-		break;
-
-	default:
-		rc = -EFAULT;
-		break;
-	}
-
-	mutex_unlock(&vb6801_mut);
-
-	return rc;
-}
-
-static int vb6801_sensor_release(void)
-{
-	int rc = -EBADF;
-
-	mutex_lock(&vb6801_mut);
-
-	vb6801_power_down();
-	vb6801_sensor_init_done(vb6801_ctrl->sensordata);
-	kfree(vb6801_ctrl);
-	mutex_unlock(&vb6801_mut);
-
-	return rc;
-}
-
-static int vb6801_i2c_probe(struct i2c_client *client,
-			    const struct i2c_device_id *id)
-{
-	int rc = 0;
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		rc = -ENOTSUPP;
-		goto probe_failure;
-	}
-
-	vb6801_sensorw = kzalloc(sizeof(struct vb6801_work_t), GFP_KERNEL);
-
-	if (!vb6801_sensorw) {
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, vb6801_sensorw);
-	vb6801_init_client(client);
-	vb6801_client = client;
-	vb6801_client->addr = vb6801_client->addr >> 1;
-
-	return 0;
-
-probe_failure:
-	if (vb6801_sensorw != NULL) {
-		kfree(vb6801_sensorw);
-		vb6801_sensorw = NULL;
-	}
-	return rc;
-}
-
-static int __exit vb6801_i2c_remove(struct i2c_client *client)
-{
-	struct vb6801_work_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	vb6801_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static const struct i2c_device_id vb6801_i2c_id[] = {
-	{"vb6801", 0},
-	{}
-};
-
-static struct i2c_driver vb6801_i2c_driver = {
-	.id_table = vb6801_i2c_id,
-	.probe = vb6801_i2c_probe,
-	.remove = __exit_p(vb6801_i2c_remove),
-	.driver = {
-		   .name = "vb6801",
-		   },
-};
-
-static int vb6801_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int rc;
-
-	struct vb6801_i2c_reg_conf_t rreg[] = {
-		{0x0000, 0, 0, D_LEN_BYTE},
-		{0x0001, 0, 0, D_LEN_BYTE},
-	};
-
-	rc = vb6801_reset(data);
-	if (rc < 0)
-		goto init_probe_done;
-
-	mdelay(20);
-
-	rc = vb6801_i2c_read_table(rreg, ARRAY_SIZE(rreg));
-	if (rc < 0) {
-		CDBG("I2C Read Table FAILED!!!\n");
-		goto init_probe_fail;
-	}
-
-	/* 4. Compare sensor ID to VB6801 ID: */
-	if (rreg[0].bdata != 0x03 || rreg[1].bdata != 0x53) {
-		CDBG("vb6801_sensor_init: sensor ID don't match!\n");
-		goto init_probe_fail;
-	}
-
-	goto init_probe_done;
-
-init_probe_fail:
-	vb6801_sensor_init_done(data);
-init_probe_done:
-	return rc;
-}
-
-int vb6801_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc;
-	struct vb6801_i2c_reg_conf_t wreg[] = {
-		{REG_MODE_SELECT, 0, STANDBY_MODE, D_LEN_BYTE},
-		{0x0113, 0, 0x0A, D_LEN_BYTE},
-	};
-
-	vb6801_ctrl = kzalloc(sizeof(struct vb6801_ctrl_t), GFP_KERNEL);
-	if (!vb6801_ctrl) {
-		rc = -ENOMEM;
-		goto open_init_fail1;
-	}
-
-	vb6801_ctrl->factor_fps = 1 /** 0x00000400*/ ;
-	vb6801_ctrl->curr_fps = 7680; /* 30 * Q8 */ ;
-	vb6801_ctrl->max_fps = 7680; /* 30 * Q8 */ ;
-	vb6801_ctrl->pict_exp_update = 0; /* 30 * Q8 */ ;
-	vb6801_ctrl->reducel = 0; /* 30 * Q8 */ ;
-
-	vb6801_ctrl->set_test = TEST_OFF;
-	vb6801_ctrl->prev_res = QTR_SIZE;
-	vb6801_ctrl->pict_res = FULL_SIZE;
-
-	vb6801_ctrl->s_dynamic_params.preview_linesPerFrame =
-	    VB6801_LINES_PER_FRAME_PREVIEW;
-	vb6801_ctrl->s_dynamic_params.preview_pixelsPerLine =
-	    VB6801_PIXELS_PER_LINE_PREVIEW;
-	vb6801_ctrl->s_dynamic_params.snapshot_linesPerFrame =
-	    VB6801_LINES_PER_FRAME_SNAPSHOT;
-	vb6801_ctrl->s_dynamic_params.snapshot_pixelsPerLine =
-	    VB6801_PIXELS_PER_LINE_SNAPSHOT;
-
-	if (data)
-		vb6801_ctrl->sensordata = data;
-
-	/* enable mclk first */
-	msm_camio_clk_rate_set(VB6801_DEFAULT_CLOCK_RATE);
-	mdelay(20);
-
-	rc = vb6801_reset(data);
-	if (rc < 0)
-		goto open_init_fail1;
-
-	rc = vb6801_i2c_write_table(wreg, ARRAY_SIZE(wreg));
-	if (rc < 0) {
-		CDBG("I2C Write Table FAILED!!!\n");
-		goto open_init_fail2;
-	}
-
-	rc = vb6801_read_nvm_data(&vb6801_ctrl->s_info);
-	if (rc < 0) {
-		CDBG("vb6801_read_nvm_data FAILED!!!\n");
-		goto open_init_fail2;
-	}
-	mdelay(66);
-
-	rc = vb6801_config_sensor(12, 30, 60, 2, 1, 10, 2, RES_PREVIEW);
-	if (rc < 0)
-		goto open_init_fail2;
-
-	goto open_init_done;
-
-open_init_fail2:
-	vb6801_sensor_init_done(data);
-open_init_fail1:
-	kfree(vb6801_ctrl);
-open_init_done:
-	return rc;
-}
-
-static int vb6801_sensor_probe(const struct msm_camera_sensor_info *info,
-			       struct msm_sensor_ctrl *s)
-{
-	int rc = i2c_add_driver(&vb6801_i2c_driver);
-	if (rc < 0 || vb6801_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_done;
-	}
-
-	/* enable mclk first */
-	msm_camio_clk_rate_set(VB6801_DEFAULT_CLOCK_RATE);
-	mdelay(20);
-
-	rc = vb6801_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_done;
-
-	s->s_init = vb6801_sensor_open_init;
-	s->s_release = vb6801_sensor_release;
-	s->s_config = vb6801_sensor_config;
-	s->s_mount_angle  = 0;
-	vb6801_sensor_init_done(info);
-
-probe_done:
-	return rc;
-}
-
-static int __vb6801_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, vb6801_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __vb6801_probe,
-	.driver = {
-		   .name = "msm_camera_vb6801",
-		   .owner = THIS_MODULE,
-		   },
-};
-
-static int __init vb6801_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(vb6801_init);
-void vb6801_exit(void)
-{
-	i2c_del_driver(&vb6801_i2c_driver);
-}
diff --git a/drivers/media/video/msm/vb6801.h b/drivers/media/video/msm/vb6801.h
deleted file mode 100644
index 5a8842c..0000000
--- a/drivers/media/video/msm/vb6801.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (c) 2008-2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef VB6801_H
-#define VB6801_H
-
-#include <mach/board.h>
-
-extern struct vb6801_reg_t vb6801_regs;	/* from vb6801_reg.c */
-
-struct reg_struct {
-	uint16_t vt_pix_clk_div;	/*  0x0300 */
-	uint16_t vt_sys_clk_div;	/*  0x0302 */
-	uint16_t pre_pll_clk_div;	/*  0x0304 */
-	uint16_t pll_multiplier;	/*  0x0306 */
-	uint16_t op_pix_clk_div;	/*  0x0308 */
-	uint16_t op_sys_clk_div;	/*  0x030A */
-	uint16_t scale_m;	/*  0x0404 */
-	uint16_t row_speed;	/*  0x3016 */
-	uint16_t x_addr_start;	/*  0x3004 */
-	uint16_t x_addr_end;	/*  0x3008 */
-	uint16_t y_addr_start;	/*  0x3002 */
-	uint16_t y_addr_end;	/*  0x3006 */
-	uint16_t read_mode;	/*  0x3040 */
-	uint16_t x_output_size;	/*  0x034C */
-	uint16_t y_output_size;	/*  0x034E */
-	uint16_t line_length_pck;	/*  0x300C */
-	uint16_t frame_length_lines;	/*  0x300A */
-	uint16_t coarse_int_time;	/*  0x3012 */
-	uint16_t fine_int_time;	/*  0x3014 */
-};
-
-enum i2c_data_len {
-	D_LEN_BYTE,
-	D_LEN_WORD
-};
-
-struct vb6801_i2c_reg_conf_t {
-	unsigned short waddr;
-	unsigned short wdata;
-	uint8_t bdata;
-	enum i2c_data_len dlen;
-};
-
-struct vb6801_reg_t {
-	struct reg_struct const *reg_pat;
-	uint16_t reg_pat_size;
-	struct vb6801_i2c_reg_conf_t const *ttbl;
-	uint16_t ttbl_size;
-	struct vb6801_i2c_reg_conf_t const *lctbl;
-	uint16_t lctbl_size;
-	struct vb6801_i2c_reg_conf_t const *rftbl;
-	uint16_t rftbl_size;
-};
-
-#endif /* VB6801_H */
diff --git a/drivers/media/video/msm/vfe/Makefile b/drivers/media/video/msm/vfe/Makefile
deleted file mode 100644
index 250b55f..0000000
--- a/drivers/media/video/msm/vfe/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-GCC_VERSION      := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
-ccflags-y += -Idrivers/media/video/msm
-ccflags-y += -Idrivers/media/video/msm/server
-ifeq ($(GCC_VERSION),0404)
-CFLAGS_REMOVE_msm_vfe8x.o = -Wframe-larger-than=1024
-endif
-ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
-  obj-$(CONFIG_ARCH_MSM7X27A) += msm_vfe7x27a_v4l2.o
-  obj-$(CONFIG_ARCH_MSM8X60) += msm_vfe31_v4l2.o
-  obj-$(CONFIG_ARCH_MSM7X30) += msm_vfe31_v4l2.o
-else
-  obj-$(CONFIG_ARCH_MSM7X27A) += msm_vfe7x27a.o
-  obj-$(CONFIG_ARCH_MSM8X60) += msm_vfe31.o
-  obj-$(CONFIG_ARCH_MSM7X30) += msm_vfe31.o
-endif
-obj-$(CONFIG_ARCH_MSM_ARM11) += msm_vfe7x.o
-obj-$(CONFIG_ARCH_QSD8X50) += msm_vfe8x.o msm_vfe8x_proc.o
-obj-$(CONFIG_ARCH_MSM8960) += msm_vfe32.o
-obj-$(CONFIG_ARCH_MSM8974) += msm_vfe40.o
-obj-$(CONFIG_MSM_CAMERA_V4L2) += msm_vfe_stats_buf.o
diff --git a/drivers/media/video/msm/vfe/msm_vfe31.c b/drivers/media/video/msm/vfe/msm_vfe31.c
deleted file mode 100644
index ab92085..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe31.c
+++ /dev/null
@@ -1,4012 +0,0 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/uaccess.h>
-#include <linux/interrupt.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <mach/irqs.h>
-#include <mach/camera.h>
-#include <asm/atomic.h>
-
-#include "msm_vfe31.h"
-#include "msm_vpe1.h"
-atomic_t irq_cnt;
-
-static struct vfe31_ctrl_type *vfe31_ctrl;
-static struct msm_camera_io_clk camio_clk;
-static void *vfe_syncdata;
-static void vfe31_send_msg_no_payload(enum VFE31_MESSAGE_ID id);
-static void vfe31_reset_hist_cfg(void);
-
-struct vfe31_isr_queue_cmd {
-	struct list_head list;
-	uint32_t                           vfeInterruptStatus0;
-	uint32_t                           vfeInterruptStatus1;
-	uint32_t                           vfePingPongStatus;
-	struct vfe_frame_asf_info          vfeAsfFrameInfo;
-	struct vfe_frame_bpc_info          vfeBpcFrameInfo;
-	struct vfe_msg_camif_status        vfeCamifStatusLocal;
-};
-
-static struct vfe31_cmd_type vfe31_cmd[] = {
-/* 0*/	{V31_DUMMY_0},
-		{V31_SET_CLK},
-		{V31_RESET},
-		{V31_START},
-		{V31_TEST_GEN_START},
-/* 5*/	{V31_OPERATION_CFG, V31_OPERATION_CFG_LEN},
-		{V31_AXI_OUT_CFG, V31_AXI_OUT_LEN, V31_AXI_OUT_OFF, 0xFF},
-		{V31_CAMIF_CFG, V31_CAMIF_LEN, V31_CAMIF_OFF, 0xFF},
-		{V31_AXI_INPUT_CFG},
-		{V31_BLACK_LEVEL_CFG, V31_BLACK_LEVEL_LEN, V31_BLACK_LEVEL_OFF,
-		0xFF},
-/*10*/  {V31_ROLL_OFF_CFG, V31_ROLL_OFF_CFG_LEN, V31_ROLL_OFF_CFG_OFF,
-		0xFF},
-		{V31_DEMUX_CFG, V31_DEMUX_LEN, V31_DEMUX_OFF, 0xFF},
-		{V31_DEMOSAIC_0_CFG, V31_DEMOSAIC_0_LEN, V31_DEMOSAIC_0_OFF,
-		0xFF},
-		{V31_DEMOSAIC_1_CFG, V31_DEMOSAIC_1_LEN, V31_DEMOSAIC_1_OFF,
-		0xFF},
-		{V31_DEMOSAIC_2_CFG, V31_DEMOSAIC_2_LEN, V31_DEMOSAIC_2_OFF,
-		0xFF},
-/*15*/	{V31_FOV_CFG, V31_FOV_LEN, V31_FOV_OFF, 0xFF},
-		{V31_MAIN_SCALER_CFG, V31_MAIN_SCALER_LEN, V31_MAIN_SCALER_OFF,
-		0xFF},
-		{V31_WB_CFG, V31_WB_LEN, V31_WB_OFF, 0xFF},
-		{V31_COLOR_COR_CFG, V31_COLOR_COR_LEN, V31_COLOR_COR_OFF, 0xFF},
-		{V31_RGB_G_CFG, V31_RGB_G_LEN, V31_RGB_G_OFF, 0xFF},
-/*20*/	{V31_LA_CFG, V31_LA_LEN, V31_LA_OFF, 0xFF },
-		{V31_CHROMA_EN_CFG, V31_CHROMA_EN_LEN, V31_CHROMA_EN_OFF, 0xFF},
-		{V31_CHROMA_SUP_CFG, V31_CHROMA_SUP_LEN, V31_CHROMA_SUP_OFF,
-		0xFF},
-		{V31_MCE_CFG, V31_MCE_LEN, V31_MCE_OFF, 0xFF},
-		{V31_SK_ENHAN_CFG, V31_SCE_LEN, V31_SCE_OFF, 0xFF},
-/*25*/	{V31_ASF_CFG, V31_ASF_LEN, V31_ASF_OFF, 0xFF},
-		{V31_S2Y_CFG, V31_S2Y_LEN, V31_S2Y_OFF, 0xFF},
-		{V31_S2CbCr_CFG, V31_S2CbCr_LEN, V31_S2CbCr_OFF, 0xFF},
-		{V31_CHROMA_SUBS_CFG, V31_CHROMA_SUBS_LEN, V31_CHROMA_SUBS_OFF,
-		0xFF},
-		{V31_OUT_CLAMP_CFG, V31_OUT_CLAMP_LEN, V31_OUT_CLAMP_OFF,
-		0xFF},
-/*30*/	{V31_FRAME_SKIP_CFG, V31_FRAME_SKIP_LEN, V31_FRAME_SKIP_OFF,
-		0xFF},
-		{V31_DUMMY_1},
-		{V31_DUMMY_2},
-		{V31_DUMMY_3},
-		{V31_UPDATE},
-/*35*/	{V31_BL_LVL_UPDATE, V31_BLACK_LEVEL_LEN, V31_BLACK_LEVEL_OFF,
-		0xFF},
-		{V31_DEMUX_UPDATE, V31_DEMUX_LEN, V31_DEMUX_OFF, 0xFF},
-		{V31_DEMOSAIC_1_UPDATE, V31_DEMOSAIC_1_LEN, V31_DEMOSAIC_1_OFF,
-		0xFF},
-		{V31_DEMOSAIC_2_UPDATE, V31_DEMOSAIC_2_LEN, V31_DEMOSAIC_2_OFF,
-		0xFF},
-		{V31_FOV_UPDATE, V31_FOV_LEN, V31_FOV_OFF, 0xFF},
-/*40*/	{V31_MAIN_SCALER_UPDATE, V31_MAIN_SCALER_LEN, V31_MAIN_SCALER_OFF,
-		0xFF},
-		{V31_WB_UPDATE, V31_WB_LEN, V31_WB_OFF, 0xFF},
-		{V31_COLOR_COR_UPDATE, V31_COLOR_COR_LEN, V31_COLOR_COR_OFF,
-		0xFF},
-		{V31_RGB_G_UPDATE, V31_RGB_G_LEN, V31_CHROMA_EN_OFF, 0xFF},
-		{V31_LA_UPDATE, V31_LA_LEN, V31_LA_OFF, 0xFF },
-/*45*/	{V31_CHROMA_EN_UPDATE, V31_CHROMA_EN_LEN, V31_CHROMA_EN_OFF,
-		0xFF},
-		{V31_CHROMA_SUP_UPDATE, V31_CHROMA_SUP_LEN, V31_CHROMA_SUP_OFF,
-		0xFF},
-		{V31_MCE_UPDATE, V31_MCE_LEN, V31_MCE_OFF, 0xFF},
-		{V31_SK_ENHAN_UPDATE, V31_SCE_LEN, V31_SCE_OFF, 0xFF},
-		{V31_S2CbCr_UPDATE, V31_S2CbCr_LEN, V31_S2CbCr_OFF, 0xFF},
-/*50*/	{V31_S2Y_UPDATE, V31_S2Y_LEN, V31_S2Y_OFF, 0xFF},
-		{V31_ASF_UPDATE, V31_ASF_UPDATE_LEN, V31_ASF_OFF, 0xFF},
-		{V31_FRAME_SKIP_UPDATE},
-		{V31_CAMIF_FRAME_UPDATE},
-		{V31_STATS_AF_UPDATE, V31_STATS_AF_LEN, V31_STATS_AF_OFF},
-/*55*/	{V31_STATS_AE_UPDATE, V31_STATS_AE_LEN, V31_STATS_AE_OFF},
-		{V31_STATS_AWB_UPDATE, V31_STATS_AWB_LEN, V31_STATS_AWB_OFF},
-		{V31_STATS_RS_UPDATE, V31_STATS_RS_LEN, V31_STATS_RS_OFF},
-		{V31_STATS_CS_UPDATE, V31_STATS_CS_LEN, V31_STATS_CS_OFF},
-		{V31_STATS_SKIN_UPDATE},
-/*60*/	{V31_STATS_IHIST_UPDATE, V31_STATS_IHIST_LEN, V31_STATS_IHIST_OFF},
-		{V31_DUMMY_4},
-		{V31_EPOCH1_ACK},
-		{V31_EPOCH2_ACK},
-		{V31_START_RECORDING},
-/*65*/	{V31_STOP_RECORDING},
-		{V31_DUMMY_5},
-		{V31_DUMMY_6},
-		{V31_CAPTURE, V31_CAPTURE_LEN, 0xFF},
-		{V31_DUMMY_7},
-/*70*/	{V31_STOP},
-		{V31_GET_HW_VERSION},
-		{V31_GET_FRAME_SKIP_COUNTS},
-		{V31_OUTPUT1_BUFFER_ENQ},
-		{V31_OUTPUT2_BUFFER_ENQ},
-/*75*/	{V31_OUTPUT3_BUFFER_ENQ},
-		{V31_JPEG_OUT_BUF_ENQ},
-		{V31_RAW_OUT_BUF_ENQ},
-		{V31_RAW_IN_BUF_ENQ},
-		{V31_STATS_AF_ENQ},
-/*80*/	{V31_STATS_AE_ENQ},
-		{V31_STATS_AWB_ENQ},
-		{V31_STATS_RS_ENQ},
-		{V31_STATS_CS_ENQ},
-		{V31_STATS_SKIN_ENQ},
-/*85*/	{V31_STATS_IHIST_ENQ},
-		{V31_DUMMY_8},
-		{V31_JPEG_ENC_CFG},
-		{V31_DUMMY_9},
-		{V31_STATS_AF_START, V31_STATS_AF_LEN, V31_STATS_AF_OFF},
-/*90*/	{V31_STATS_AF_STOP},
-		{V31_STATS_AE_START, V31_STATS_AE_LEN, V31_STATS_AE_OFF},
-		{V31_STATS_AE_STOP},
-		{V31_STATS_AWB_START, V31_STATS_AWB_LEN, V31_STATS_AWB_OFF},
-		{V31_STATS_AWB_STOP},
-/*95*/	{V31_STATS_RS_START, V31_STATS_RS_LEN, V31_STATS_RS_OFF},
-		{V31_STATS_RS_STOP},
-		{V31_STATS_CS_START, V31_STATS_CS_LEN, V31_STATS_CS_OFF},
-		{V31_STATS_CS_STOP},
-		{V31_STATS_SKIN_START},
-/*100*/	{V31_STATS_SKIN_STOP},
-		{V31_STATS_IHIST_START,
-		V31_STATS_IHIST_LEN, V31_STATS_IHIST_OFF},
-		{V31_STATS_IHIST_STOP},
-		{V31_DUMMY_10},
-		{V31_SYNC_TIMER_SETTING, V31_SYNC_TIMER_LEN,
-			V31_SYNC_TIMER_OFF},
-/*105*/	{V31_ASYNC_TIMER_SETTING, V31_ASYNC_TIMER_LEN, V31_ASYNC_TIMER_OFF},
-		{V31_LIVESHOT},
-		{V31_ZSL, V31_CAPTURE_LEN, 0xFF},
-		{V31_STEREOCAM},
-		{V31_LA_SETUP},
-/*110*/	{V31_XBAR_CFG, V31_XBAR_CFG_LEN, V31_XBAR_CFG_OFF},
-/*111*/	{V31_EZTUNE_CFG, V31_EZTUNE_CFG_LEN, V31_EZTUNE_CFG_OFF},
-};
-
-uint32_t vfe31_AXI_WM_CFG[] = {
-	0x0000004C,
-	0x00000064,
-	0x0000007C,
-	0x00000094,
-	0x000000AC,
-	0x000000C4,
-	0x000000DC,
-};
-
-static const char *vfe31_general_cmd[] = {
-	"DUMMY_0",  /* 0 */
-	"SET_CLK",
-	"RESET",
-	"START",
-	"TEST_GEN_START",
-	"OPERATION_CFG",  /* 5 */
-	"AXI_OUT_CFG",
-	"CAMIF_CFG",
-	"AXI_INPUT_CFG",
-	"BLACK_LEVEL_CFG",
-	"ROLL_OFF_CFG",  /* 10 */
-	"DEMUX_CFG",
-	"DEMOSAIC_0_CFG",  /* general */
-	"DEMOSAIC_1_CFG",  /* ABF     */
-	"DEMOSAIC_2_CFG",  /* BPC     */
-	"FOV_CFG",  /* 15  */
-	"MAIN_SCALER_CFG",
-	"WB_CFG",
-	"COLOR_COR_CFG",
-	"RGB_G_CFG",
-	"LA_CFG",  /* 20 */
-	"CHROMA_EN_CFG",
-	"CHROMA_SUP_CFG",
-	"MCE_CFG",
-	"SK_ENHAN_CFG",
-	"ASF_CFG",  /* 25 */
-	"S2Y_CFG",
-	"S2CbCr_CFG",
-	"CHROMA_SUBS_CFG",
-	"OUT_CLAMP_CFG",
-	"FRAME_SKIP_CFG",  /* 30 */
-	"DUMMY_1",
-	"DUMMY_2",
-	"DUMMY_3",
-	"UPDATE",
-	"BL_LVL_UPDATE",  /* 35 */
-	"DEMUX_UPDATE",
-	"DEMOSAIC_1_UPDATE",  /* BPC */
-	"DEMOSAIC_2_UPDATE",  /* ABF */
-	"FOV_UPDATE",
-	"MAIN_SCALER_UPDATE",  /* 40 */
-	"WB_UPDATE",
-	"COLOR_COR_UPDATE",
-	"RGB_G_UPDATE",
-	"LA_UPDATE",
-	"CHROMA_EN_UPDATE",  /* 45 */
-	"CHROMA_SUP_UPDATE",
-	"MCE_UPDATE",
-	"SK_ENHAN_UPDATE",
-	"S2CbCr_UPDATE",
-	"S2Y_UPDATE",  /* 50 */
-	"ASF_UPDATE",
-	"FRAME_SKIP_UPDATE",
-	"CAMIF_FRAME_UPDATE",
-	"STATS_AF_UPDATE",
-	"STATS_AE_UPDATE",  /* 55 */
-	"STATS_AWB_UPDATE",
-	"STATS_RS_UPDATE",
-	"STATS_CS_UPDATE",
-	"STATS_SKIN_UPDATE",
-	"STATS_IHIST_UPDATE",  /* 60 */
-	"DUMMY_4",
-	"EPOCH1_ACK",
-	"EPOCH2_ACK",
-	"START_RECORDING",
-	"STOP_RECORDING",  /* 65 */
-	"DUMMY_5",
-	"DUMMY_6",
-	"CAPTURE",
-	"DUMMY_7",
-	"STOP",  /* 70 */
-	"GET_HW_VERSION",
-	"GET_FRAME_SKIP_COUNTS",
-	"OUTPUT1_BUFFER_ENQ",
-	"OUTPUT2_BUFFER_ENQ",
-	"OUTPUT3_BUFFER_ENQ",  /* 75 */
-	"JPEG_OUT_BUF_ENQ",
-	"RAW_OUT_BUF_ENQ",
-	"RAW_IN_BUF_ENQ",
-	"STATS_AF_ENQ",
-	"STATS_AE_ENQ",  /* 80 */
-	"STATS_AWB_ENQ",
-	"STATS_RS_ENQ",
-	"STATS_CS_ENQ",
-	"STATS_SKIN_ENQ",
-	"STATS_IHIST_ENQ",  /* 85 */
-	"DUMMY_8",
-	"JPEG_ENC_CFG",
-	"DUMMY_9",
-	"STATS_AF_START",
-	"STATS_AF_STOP",  /* 90 */
-	"STATS_AE_START",
-	"STATS_AE_STOP",
-	"STATS_AWB_START",
-	"STATS_AWB_STOP",
-	"STATS_RS_START",  /* 95 */
-	"STATS_RS_STOP",
-	"STATS_CS_START",
-	"STATS_CS_STOP",
-	"STATS_SKIN_START",
-	"STATS_SKIN_STOP",  /* 100 */
-	"STATS_IHIST_START",
-	"STATS_IHIST_STOP",
-	"DUMMY_10",
-	"SYNC_TIMER_SETTING",
-	"ASYNC_TIMER_SETTING",  /* 105 */
-	"V31_LIVESHOT",
-	"V31_ZSL",
-	"V31_STEREOCAM",
-	"V31_LA_SETUP",
-	"V31_XBAR_CFG",
-};
-
-static void vfe_addr_convert(struct msm_vfe_phy_info *pinfo,
-	enum vfe_resp_msg type, void *data, void **ext, int32_t *elen)
-{
-	uint8_t outid;
-	switch (type) {
-	case VFE_MSG_OUTPUT_T:
-	case VFE_MSG_OUTPUT_P:
-	case VFE_MSG_OUTPUT_S:
-	case VFE_MSG_OUTPUT_V:
-	{
-		pinfo->output_id =
-			((struct vfe_message *)data)->_u.msgOut.output_id;
-
-		switch (type) {
-		case VFE_MSG_OUTPUT_P:
-			outid = OUTPUT_TYPE_P;
-			break;
-		case VFE_MSG_OUTPUT_V:
-			outid = OUTPUT_TYPE_V;
-			break;
-		case VFE_MSG_OUTPUT_T:
-			outid = OUTPUT_TYPE_T;
-			break;
-		case VFE_MSG_OUTPUT_S:
-			outid = OUTPUT_TYPE_S;
-			break;
-		default:
-			outid = 0xff;
-			break;
-		}
-		pinfo->output_id = outid;
-		pinfo->p0_phy =
-			((struct vfe_message *)data)->_u.msgOut.p0_addr;
-		pinfo->p1_phy =
-			((struct vfe_message *)data)->_u.msgOut.p1_addr;
-		pinfo->p2_phy =
-			((struct vfe_message *)data)->_u.msgOut.p2_addr;
-
-		pinfo->frame_id =
-		((struct vfe_message *)data)->_u.msgOut.frameCounter;
-
-		((struct vfe_msg_output *)(vfe31_ctrl->extdata))->bpcInfo =
-		((struct vfe_message *)data)->_u.msgOut.bpcInfo;
-		((struct vfe_msg_output *)(vfe31_ctrl->extdata))->asfInfo =
-		((struct vfe_message *)data)->_u.msgOut.asfInfo;
-		((struct vfe_msg_output *)(vfe31_ctrl->extdata))->frameCounter =
-		((struct vfe_message *)data)->_u.msgOut.frameCounter;
-		*ext  = vfe31_ctrl->extdata;
-		*elen = vfe31_ctrl->extlen;
-	}
-		break;
-
-	default:
-		break;
-	} /* switch */
-}
-
-
-static void vfe31_proc_ops(enum VFE31_MESSAGE_ID id, void *msg, size_t len)
-{
-	struct msm_vfe_resp *rp;
-
-	rp = vfe31_ctrl->resp->vfe_alloc(sizeof(struct msm_vfe_resp),
-		vfe31_ctrl->syncdata, GFP_ATOMIC);
-	if (!rp) {
-		CDBG("rp: cannot allocate buffer\n");
-		return;
-	}
-	CDBG("vfe31_proc_ops, msgId = %d\n", id);
-	rp->evt_msg.type   = MSM_CAMERA_MSG;
-	rp->evt_msg.msg_id = id;
-	rp->evt_msg.len    = len;
-	rp->evt_msg.data   = msg;
-
-	switch (rp->evt_msg.msg_id) {
-	case MSG_ID_SNAPSHOT_DONE:
-		rp->type = VFE_MSG_SNAPSHOT;
-		break;
-
-	case MSG_ID_OUTPUT_P:
-		rp->type = VFE_MSG_OUTPUT_P;
-		vfe_addr_convert(&(rp->phy), VFE_MSG_OUTPUT_P,
-			rp->evt_msg.data, &(rp->extdata),
-			&(rp->extlen));
-		break;
-
-	case MSG_ID_OUTPUT_T:
-		rp->type = VFE_MSG_OUTPUT_T;
-		vfe_addr_convert(&(rp->phy), VFE_MSG_OUTPUT_T,
-			rp->evt_msg.data, &(rp->extdata),
-			&(rp->extlen));
-		break;
-
-	case MSG_ID_OUTPUT_S:
-		rp->type = VFE_MSG_OUTPUT_S;
-		vfe_addr_convert(&(rp->phy), VFE_MSG_OUTPUT_S,
-			rp->evt_msg.data, &(rp->extdata),
-			&(rp->extlen));
-		break;
-
-	case MSG_ID_OUTPUT_V:
-		rp->type = VFE_MSG_OUTPUT_V;
-		vfe_addr_convert(&(rp->phy), VFE_MSG_OUTPUT_V,
-			rp->evt_msg.data, &(rp->extdata),
-			&(rp->extlen));
-		break;
-
-	case MSG_ID_COMMON:
-		rp->type = VFE_MSG_COMMON;
-		rp->stats_msg.status_bits = ((struct vfe_message *)
-			rp->evt_msg.data)->_u.msgStats.status_bits;
-		rp->stats_msg.frame_id = ((struct vfe_message *)
-			rp->evt_msg.data)->_u.msgStats.frameCounter;
-
-		rp->stats_msg.aec_buff = ((struct vfe_message *)
-			rp->evt_msg.data)->_u.msgStats.buff.aec;
-		rp->stats_msg.awb_buff = ((struct vfe_message *)
-			rp->evt_msg.data)->_u.msgStats.buff.awb;
-		rp->stats_msg.af_buff = ((struct vfe_message *)
-			rp->evt_msg.data)->_u.msgStats.buff.af;
-		rp->stats_msg.ihist_buff = ((struct vfe_message *)
-			rp->evt_msg.data)->_u.msgStats.buff.ihist;
-		rp->stats_msg.rs_buff = ((struct vfe_message *)
-			rp->evt_msg.data)->_u.msgStats.buff.rs;
-		rp->stats_msg.cs_buff = ((struct vfe_message *)
-			rp->evt_msg.data)->_u.msgStats.buff.cs;
-		rp->stats_msg.awb_ymin = ((struct vfe_message *)
-			rp->evt_msg.data)->_u.msgStats.buff.awb_ymin;
-		break;
-
-	case MSG_ID_SYNC_TIMER0_DONE:
-		rp->type = VFE_MSG_SYNC_TIMER0;
-		break;
-
-	case MSG_ID_SYNC_TIMER1_DONE:
-		rp->type = VFE_MSG_SYNC_TIMER1;
-		break;
-
-	case MSG_ID_SYNC_TIMER2_DONE:
-		rp->type = VFE_MSG_SYNC_TIMER2;
-		break;
-
-	default:
-		rp->type = VFE_MSG_GENERAL;
-		break;
-	}
-
-	/* save the frame id.*/
-	rp->evt_msg.frame_id = rp->phy.frame_id;
-
-	vfe31_ctrl->resp->vfe_resp(rp, MSM_CAM_Q_VFE_MSG, vfe31_ctrl->syncdata,
-		GFP_ATOMIC);
-}
-
-static void vfe_send_outmsg(uint8_t msgid, uint32_t p0_addr,
-	uint32_t p1_addr, uint32_t p2_addr)
-{
-	struct vfe_message msg;
-	uint8_t outid;
-
-	msg._d = msgid;   /* now the output mode is redundnat. */
-	msg._u.msgOut.frameCounter = vfe31_ctrl->vfeFrameId;
-
-	switch (msgid) {
-	case MSG_ID_OUTPUT_P:
-		outid = OUTPUT_TYPE_P;
-		break;
-	case MSG_ID_OUTPUT_V:
-		outid = OUTPUT_TYPE_V;
-		break;
-	case MSG_ID_OUTPUT_T:
-		outid = OUTPUT_TYPE_T;
-		break;
-	case MSG_ID_OUTPUT_S:
-		outid = OUTPUT_TYPE_S;
-		break;
-	default:
-		outid = 0xff;  /* -1 for error condition.*/
-		break;
-	}
-	msg._u.msgOut.output_id   = msgid;
-	msg._u.msgOut.p0_addr     = p0_addr;
-	msg._u.msgOut.p1_addr     = p1_addr;
-	msg._u.msgOut.p2_addr     = p2_addr;
-	CDBG("%s p2_addr = 0x%x\n", __func__, p2_addr);
-	vfe31_proc_ops(msgid, &msg, sizeof(struct vfe_message));
-	return;
-}
-static int vfe31_enable(struct camera_enable_cmd *enable)
-{
-	return 0;
-}
-
-static void vfe31_stop(void)
-{
-	atomic_set(&vfe31_ctrl->vstate, 0);
-	atomic_set(&vfe31_ctrl->stop_ack_pending, 1);
-
-	/* in either continuous or snapshot mode, stop command can be issued
-	 * at any time. stop camif immediately. */
-	msm_camera_io_w_mb(CAMIF_COMMAND_STOP_IMMEDIATELY,
-		vfe31_ctrl->vfebase + VFE_CAMIF_COMMAND);
-
-	/* disable all interrupts.  */
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* clear all pending interrupts*/
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1,
-		vfe31_ctrl->vfebase + VFE_IRQ_CMD);
-
-	/* now enable only halt_irq & reset_irq */
-	msm_camera_io_w(0xf0000000,          /* this is for async timer. */
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(VFE_IMASK_AXI_HALT,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* then apply axi halt command. */
-	msm_camera_io_w_mb(AXI_HALT,
-		vfe31_ctrl->vfebase + VFE_AXI_CMD);
-}
-
-static int vfe31_disable(struct camera_enable_cmd *enable,
-	struct platform_device *dev)
-{
-	msm_camio_set_perf_lvl(S_EXIT);
-	msm_camio_disable(dev);
-	return 0;
-}
-
-static int vfe31_add_free_buf2(struct vfe31_output_ch *outch,
-	uint32_t paddr, uint32_t p0_off, uint32_t p1_off, uint32_t p2_off)
-{
-	struct vfe31_free_buf *free_buf = NULL;
-	unsigned long flags = 0;
-	free_buf = kmalloc(sizeof(struct vfe31_free_buf), GFP_KERNEL);
-	if (!free_buf)
-		return -ENOMEM;
-
-	spin_lock_irqsave(&outch->free_buf_lock, flags);
-	free_buf->paddr = paddr;
-	free_buf->planar0_off = p0_off;
-	free_buf->planar1_off = p1_off;
-	free_buf->planar2_off = p2_off;
-	list_add_tail(&free_buf->node, &outch->free_buf_head);
-
-	CDBG("%s: free_buf paddr = 0x%x, y_off = %d, cbcr_off = %d\n",
-		__func__, free_buf->paddr, free_buf->planar0_off,
-		free_buf->planar1_off);
-	spin_unlock_irqrestore(&outch->free_buf_lock, flags);
-	return 0;
-}
-
-#define vfe31_add_free_buf(outch, regptr) \
-	vfe31_add_free_buf2(outch, regptr->paddr, \
-	regptr->info.planar0_off,	\
-	regptr->info.planar1_off,	\
-	regptr->info.planar2_off)
-
-#define vfe31_free_buf_available(outch) \
-	(!list_empty(&outch.free_buf_head))
-
-static inline struct vfe31_free_buf *vfe31_get_free_buf(
-	struct vfe31_output_ch *outch)
-{
-	unsigned long flags = 0;
-	struct vfe31_free_buf *free_buf = NULL;
-	spin_lock_irqsave(&outch->free_buf_lock, flags);
-	if (!list_empty(&outch->free_buf_head)) {
-		free_buf = list_first_entry(&outch->free_buf_head,
-			struct vfe31_free_buf, node);
-		if (free_buf)
-			list_del_init(&free_buf->node);
-	}
-	spin_unlock_irqrestore(&outch->free_buf_lock, flags);
-	return free_buf;
-}
-
-static inline void vfe31_reset_free_buf_queue(
-	struct vfe31_output_ch *outch)
-{
-	unsigned long flags = 0;
-	struct vfe31_free_buf *free_buf = NULL;
-	spin_lock_irqsave(&outch->free_buf_lock, flags);
-	while (!list_empty(&outch->free_buf_head)) {
-		free_buf = list_first_entry(&outch->free_buf_head,
-			struct vfe31_free_buf, node);
-		if (free_buf) {
-			list_del_init(&free_buf->node);
-			kfree(free_buf);
-		}
-	}
-	spin_unlock_irqrestore(&outch->free_buf_lock, flags);
-}
-
-#define vfe31_init_free_buf_queue() do {	\
-	INIT_LIST_HEAD(&vfe31_ctrl->outpath.out0.free_buf_head);	\
-	INIT_LIST_HEAD(&vfe31_ctrl->outpath.out1.free_buf_head);	\
-	INIT_LIST_HEAD(&vfe31_ctrl->outpath.out2.free_buf_head);	\
-	spin_lock_init(&vfe31_ctrl->outpath.out0.free_buf_lock);	\
-	spin_lock_init(&vfe31_ctrl->outpath.out1.free_buf_lock);	\
-	spin_lock_init(&vfe31_ctrl->outpath.out2.free_buf_lock);	\
-} while (0)
-
-#define vfe31_reset_free_buf_queue_all() do {	\
-	vfe31_reset_free_buf_queue(&vfe31_ctrl->outpath.out0);	\
-	vfe31_reset_free_buf_queue(&vfe31_ctrl->outpath.out1);	\
-	vfe31_reset_free_buf_queue(&vfe31_ctrl->outpath.out2);	\
-} while (0)
-
-static int vfe31_config_axi(int mode, struct axidata *ad, uint32_t *ao)
-{
-	int i;
-	uint32_t *p, *p1, *p2, *p3;
-	int32_t *ch_info;
-	struct vfe31_output_ch *outp1, *outp2, *outp3;
-	struct msm_pmem_region *regp1 = NULL;
-	struct msm_pmem_region *regp2 = NULL;
-	struct msm_pmem_region *regp3 = NULL;
-	int ret;
-	struct msm_sync* p_sync = (struct msm_sync *)vfe_syncdata;
-
-	outp1 = NULL;
-	outp2 = NULL;
-	outp3 = NULL;
-
-	p = ao + 2;
-
-	/* Update the corresponding write masters for each output*/
-	ch_info = ao + V31_AXI_CFG_LEN;
-	vfe31_ctrl->outpath.out0.ch0 = 0x0000FFFF & *ch_info;
-	vfe31_ctrl->outpath.out0.ch1 = 0x0000FFFF & (*ch_info++ >> 16);
-	vfe31_ctrl->outpath.out0.ch2 = 0x0000FFFF & *ch_info++;
-	vfe31_ctrl->outpath.out1.ch0 = 0x0000FFFF & *ch_info;
-	vfe31_ctrl->outpath.out1.ch1 = 0x0000FFFF & (*ch_info++ >> 16);
-	vfe31_ctrl->outpath.out1.ch2 = 0x0000FFFF & *ch_info++;
-	vfe31_ctrl->outpath.out2.ch0 = 0x0000FFFF & *ch_info;
-	vfe31_ctrl->outpath.out2.ch1 = 0x0000FFFF & (*ch_info++ >> 16);
-	vfe31_ctrl->outpath.out2.ch2 = 0x0000FFFF & *ch_info++;
-
-	CDBG("vfe31_config_axi: mode = %d, bufnum1 = %d, bufnum2 = %d"
-		"bufnum3 = %d", mode, ad->bufnum1, ad->bufnum2, ad->bufnum3);
-
-	switch (mode) {
-
-	case OUTPUT_2: {
-		if (ad->bufnum2 != 3)
-			return -EINVAL;
-		regp1 = &(ad->region[ad->bufnum1]);
-		outp1 = &(vfe31_ctrl->outpath.out0);
-		vfe31_ctrl->outpath.output_mode |= VFE31_OUTPUT_MODE_PT;
-
-		for (i = 0; i < 2; i++) {
-			p1 = ao + 6 + i;    /* wm0 for y  */
-			*p1 = (regp1->paddr + regp1->info.planar0_off);
-
-			p1 = ao + 12 + i;  /* wm1 for cbcr */
-			*p1 = (regp1->paddr + regp1->info.planar1_off);
-			regp1++;
-		}
-		ret = vfe31_add_free_buf(outp1, regp1);
-		if (ret < 0)
-			return ret;
-	}
-		break;
-
-	case OUTPUT_1_AND_2:
-		/* use wm0& 4 for thumbnail, wm1&5 for main image.*/
-		if ((ad->bufnum1 < 1) || (ad->bufnum2 < 1))
-			return -EINVAL;
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_S;  /* main image.*/
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_PT;  /* thumbnail. */
-
-		/* this is thumbnail buffer. */
-		regp1 = &(ad->region[ad->bufnum1-1]);
-		/* this is main image buffer. */
-		regp2 = &(ad->region[ad->bufnum1+ad->bufnum2-1]);
-
-		outp1 = &(vfe31_ctrl->outpath.out0);
-		outp2 = &(vfe31_ctrl->outpath.out1); /* snapshot */
-
-		/*  Parse the buffers!!! */
-		if (ad->bufnum2 == 1) {	/* assuming bufnum1 = bufnum2 */
-			p1 = ao + 6;   /* wm0 ping */
-			*p1++ = (regp1->paddr + regp1->info.planar0_off);
-
-			/* this is to duplicate ping address to pong.*/
-			*p1 = (regp1->paddr + regp1->info.planar0_off);
-
-			p1 = ao + 30;  /* wm4 ping */
-			*p1++ = (regp1->paddr + regp1->info.planar1_off);
-			CDBG("%s: regp1->info.cbcr_off = 0x%x\n", __func__,
-						 regp1->info.planar1_off);
-
-			/* this is to duplicate ping address to pong.*/
-			*p1 = (regp1->paddr + regp1->info.planar1_off);
-
-			p1 = ao + 12;   /* wm1 ping */
-			*p1++ = (regp2->paddr + regp2->info.planar0_off);
-
-			/* pong = ping,*/
-			*p1 = (regp2->paddr + regp2->info.planar0_off);
-
-			p1 = ao + 36;  /* wm5 */
-			*p1++ = (regp2->paddr + regp2->info.planar1_off);
-			CDBG("%s: regp2->info.cbcr_off = 0x%x\n", __func__,
-						 regp2->info.planar1_off);
-
-			/* pong = ping,*/
-			*p1 = (regp2->paddr + regp2->info.planar1_off);
-		} else { /* more than one snapshot */
-			/* first fill ping & pong */
-			for (i = 0; i < 2; i++) {
-				p1 = ao + 6 + i;    /* wm0 for y  */
-				*p1 = (regp1->paddr + regp1->info.planar0_off);
-				p1 = ao + 30 + i;  /* wm4 for cbcr */
-				*p1 = (regp1->paddr + regp1->info.planar1_off);
-				regp1--;
-			}
-
-			for (i = 0; i < 2; i++) {
-				p2 = ao + 12 + i;    /* wm1 for y  */
-				*p2 = (regp2->paddr + regp2->info.planar0_off);
-				p2 = ao + 36 + i;  /* wm5 for cbcr */
-				*p2 = (regp2->paddr + regp2->info.planar1_off);
-				regp2--;
-			}
-
-			for (i = 2; i < ad->bufnum1; i++) {
-				ret = vfe31_add_free_buf(outp1, regp1);
-				if (ret < 0)
-					return ret;
-				regp1--;
-			}
-
-			for (i = 2; i < ad->bufnum2; i++) {
-				ret = vfe31_add_free_buf(outp2, regp2);
-				if (ret < 0)
-					return ret;
-				regp2--;
-			}
-		}
-		break;
-
-	case OUTPUT_1_2_AND_3:
-		CDBG("%s: OUTPUT_1_2_AND_3", __func__);
-		CDBG("%s: %d %d %d", __func__, ad->bufnum1, ad->bufnum2,
-			ad->bufnum3);
-		/* use wm0& 4 for postview, wm1&5 for preview.*/
-		/* use wm2& 6 for main img */
-		if ((ad->bufnum1 < 1) || (ad->bufnum2 < 1) || (ad->bufnum3 < 1))
-			return -EINVAL;
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_S;  /* main image.*/
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_P;  /* preview. */
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_T;  /* thumbnail. */
-
-		/* this is preview buffer. */
-		regp1 = &(ad->region[0]);
-		/* this is thumbnail buffer. */
-		regp2 = &(ad->region[ad->bufnum1]);
-		/* this is main image buffer. */
-		regp3 = &(ad->region[ad->bufnum1+ad->bufnum2]);
-		outp1 = &(vfe31_ctrl->outpath.out0);
-		outp2 = &(vfe31_ctrl->outpath.out1);
-		outp3 = &(vfe31_ctrl->outpath.out2);
-
-		/*  Parse the buffers!!! */
-		/* first fill ping & pong */
-		for (i = 0; i < 2; i++) {
-			p1 = ao + 6 + i;    /* wm0 for y  */
-			*p1 = (regp1->paddr + regp1->info.planar0_off);
-			p1 = ao + 30 + i;  /* wm4 for cbcr */
-			*p1 = (regp1->paddr + regp1->info.planar1_off);
-			regp1++;
-		}
-
-		for (i = 0; i < 2; i++) {
-			p2 = ao + 12 + i;    /* wm1 for y  */
-			*p2 = (regp2->paddr + regp2->info.planar0_off);
-			p2 = ao + 36 + i;  /* wm5 for cbcr */
-			*p2 = (regp2->paddr + regp2->info.planar1_off);
-			regp2++;
-		}
-
-		for (i = 0; i < 2; i++) {
-			p3 = ao + 18 + i;    /* wm2 for y  */
-			*p3 = (regp3->paddr + regp3->info.planar0_off);
-			p3 = ao + 42 + i;  /* wm6 for cbcr */
-			*p3 = (regp3->paddr + regp3->info.planar1_off);
-			regp3++;
-		}
-
-		for (i = 2; i < ad->bufnum1; i++) {
-			ret = vfe31_add_free_buf(outp1, regp1);
-			if (ret < 0)
-				return ret;
-			regp1++;
-		}
-
-		for (i = 2; i < ad->bufnum2; i++) {
-			ret = vfe31_add_free_buf(outp2, regp2);
-			if (ret < 0)
-				return ret;
-			regp2++;
-		}
-
-		for (i = 2; i < ad->bufnum3; i++) {
-			ret = vfe31_add_free_buf(outp3, regp3);
-			if (ret < 0)
-				return ret;
-			regp3++;
-		}
-		break;
-
-	case OUTPUT_ZSL_ALL_CHNLS:
-		CDBG("%s: OUTPUT_ZSL_ALL_CHNLS", __func__);
-		CDBG("%s: %d %d %d", __func__, ad->bufnum1, ad->bufnum2,
-			ad->bufnum3);
-		/* use wm0& 4 for postview, wm1&5 for preview.*/
-		/* use wm2& 6 for main img */
-		if ((ad->bufnum1 < 1) || (ad->bufnum2 < 1) || (ad->bufnum3 < 1))
-			return -EINVAL;
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_S;  /* main image.*/
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_P_ALL_CHNLS;  /* preview. */
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_T;  /* thumbnail. */
-
-		/* this is preview buffer. */
-		regp1 = &(ad->region[0]);
-		/* this is thumbnail buffer. */
-		regp2 = &(ad->region[ad->bufnum1]);
-		/* this is main image buffer. */
-		regp3 = &(ad->region[ad->bufnum1+ad->bufnum2]);
-		outp1 = &(vfe31_ctrl->outpath.out0);
-		outp2 = &(vfe31_ctrl->outpath.out1);
-		outp3 = &(vfe31_ctrl->outpath.out2);
-
-		/*  Parse the buffers!!! */
-		/* first fill ping & pong */
-		for (i = 0; i < 2; i++) {
-			p1 = ao + 6 + i;    /* wm0 for y  */
-			*p1 = (regp2->paddr + regp2->info.planar0_off);
-			p1 = ao + 12 + i;  /* wm1 for cbcr */
-			*p1 = (regp2->paddr + regp2->info.planar1_off);
-			regp2++;
-		}
-
-		for (i = 0; i < 2; i++) {
-			p2 = ao + 30 + i;    /* wm4 for y  */
-			*p2 = (regp1->paddr + regp1->info.planar0_off);
-			p2 = ao + 36 + i;  /* wm5 for cbcr */
-			*p2 = (regp1->paddr + regp1->info.planar1_off);
-			p2 = ao + 42 + i;  /* wm5 for cbcr */
-			*p2 = (regp1->paddr + regp1->info.planar2_off);
-			regp1++;
-		}
-
-		for (i = 0; i < 2; i++) {
-			p3 = ao + 18 + i;    /* wm2 for y  */
-			*p3 = (regp3->paddr + regp3->info.planar0_off);
-			p3 = ao + 24 + i;  /* wm3 for cbcr */
-			*p3 = (regp3->paddr + regp3->info.planar1_off);
-			regp3++;
-		}
-		for (i = 2; i < ad->bufnum1; i++) {
-			ret = vfe31_add_free_buf(outp1, regp1);
-			if (ret < 0)
-				return ret;
-			regp1++;
-		}
-
-		for (i = 2; i < ad->bufnum2; i++) {
-			ret = vfe31_add_free_buf(outp2, regp2);
-			if (ret < 0)
-				return ret;
-			regp2++;
-		}
-
-		for (i = 2; i < ad->bufnum3; i++) {
-			ret = vfe31_add_free_buf(outp3, regp3);
-			if (ret < 0)
-				return ret;
-			regp3++;
-		}
-		break;
-
-	case OUTPUT_1_AND_3: {
-		/* use wm0&4 for preview, wm1&5 for video.*/
-		if ((ad->bufnum1 < 2) || (ad->bufnum2 < 2))
-			return -EINVAL;
-
-#ifdef CONFIG_MSM_CAMERA_V4L2
-		*p++ = 0x1;    /* xbar cfg0 */
-		*p = 0x1a03;    /* xbar cfg1 */
-#endif
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_V;  /* video*/
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_PT;  /* preview */
-
-		regp1 = &(ad->region[0]); /* this is preview buffer. */
-		regp2 = &(ad->region[ad->bufnum1]);/* this is video buffer. */
-		outp1 = &(vfe31_ctrl->outpath.out0); /* preview */
-		outp2 = &(vfe31_ctrl->outpath.out2); /* video */
-
-
-		for (i = 0; i < 2; i++) {
-			p1 = ao + 6 + i;    /* wm0 for y  */
-			*p1 = (regp1->paddr + regp1->info.planar0_off);
-
-			p1 = ao + 30 + i;  /* wm4 for cbcr */
-			*p1 = (regp1->paddr + regp1->info.planar1_off);
-			regp1++;
-		}
-
-		for (i = 0; i < 2; i++) {
-			p2 = ao + 12 + i;    /* wm1 for y  */
-			*p2 = (regp2->paddr + regp2->info.planar0_off);
-
-			p2 = ao + 36 + i;  /* wm5 for cbcr */
-			*p2 = (regp2->paddr + regp2->info.planar1_off);
-			regp2++;
-		}
-		for (i = 2; i < ad->bufnum1; i++) {
-			ret = vfe31_add_free_buf(outp1, regp1);
-			if (ret < 0)
-				return ret;
-			regp1++;
-		}
-
-		for (i = 2; i < ad->bufnum2; i++) {
-			ret = vfe31_add_free_buf(outp2, regp2);
-			if (ret < 0)
-				return ret;
-			regp2++;
-		}
-	}
-		break;
-
-	case OUTPUT_VIDEO_ALL_CHNLS: {
-		/* use wm0&4 for preview, wm1&5 for video.*/
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_V;  /* video*/
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_P_ALL_CHNLS;
-		regp1 = &(ad->region[0]);
-		regp2 = &(ad->region[ad->bufnum1]);
-		outp1 = &(vfe31_ctrl->outpath.out0);
-		outp2 = &(vfe31_ctrl->outpath.out2);
-
-		for (i = 0; i < 2; i++) {
-			p1 = ao + 6 + i;    /* wm0 for y  */
-			*p1 = (regp1->paddr + regp1->info.planar0_off);
-
-			p1 = ao + 12 + i;  /* wm1 for cbcr */
-			*p1 = (regp1->paddr + regp1->info.planar1_off);
-
-			p1 = ao + 18 + i;  /* wm2 for cbcr */
-			*p1 = (regp1->paddr + regp1->info.planar2_off);
-			regp1++;
-		}
-		for (i = 0; i < 2; i++) {
-			p2 = ao + 30 + i;    /* wm4 for y  */
-			*p2 = (regp2->paddr + regp2->info.planar0_off);
-
-			p2 = ao + 36 + i;  /* wm5 for cbcr */
-			*p2 = (regp2->paddr + regp2->info.planar1_off);
-			regp2++;
-		}
-		for (i = 2; i < ad->bufnum1; i++) {
-			ret = vfe31_add_free_buf(outp1, regp1);
-			if (ret < 0)
-				return ret;
-			regp1++;
-		}
-		for (i = 2; i < ad->bufnum2; i++) {
-			ret = vfe31_add_free_buf(outp2, regp2);
-			if (ret < 0)
-				return ret;
-			regp2++;
-		}
-	}
-		break;
-
-	case CAMIF_TO_AXI_VIA_OUTPUT_2: {  /* use wm0 only */
-		if (ad->bufnum2 < 1)
-			return -EINVAL;
-		CDBG("config axi for raw snapshot.\n");
-		vfe31_ctrl->outpath.out1.ch0 = 0; /* raw */
-		regp1 = &(ad->region[ad->bufnum1]);
-		vfe31_ctrl->outpath.output_mode |= VFE31_OUTPUT_MODE_S;
-		p1 = ao + 6;    /* wm0 for y  */
-		*p1 = (regp1->paddr + regp1->info.planar0_off);
-		if (p_sync->stereocam_enabled)
-			p_sync->stereo_state = STEREO_RAW_SNAP_IDLE;
-	}
-		break;
-	default:
-		break;
-	}
-	msm_camera_io_memcpy(
-		vfe31_ctrl->vfebase + vfe31_cmd[V31_AXI_OUT_CFG].offset,
-		ao, vfe31_cmd[V31_AXI_OUT_CFG].length - V31_AXI_CH_INF_LEN);
-
-	return 0;
-}
-
-static void vfe31_reset_internal_variables(void)
-{
-	unsigned long flags;
-	vfe31_ctrl->vfeImaskCompositePacked = 0;
-	/* state control variables */
-	vfe31_ctrl->start_ack_pending = FALSE;
-	atomic_set(&irq_cnt, 0);
-
-	spin_lock_irqsave(&vfe31_ctrl->xbar_lock, flags);
-	vfe31_ctrl->xbar_update_pending = 0;
-	spin_unlock_irqrestore(&vfe31_ctrl->xbar_lock, flags);
-
-	atomic_set(&vfe31_ctrl->stop_ack_pending, 0);
-	atomic_set(&vfe31_ctrl->vstate, 0);
-
-	vfe31_ctrl->aec_ack_pending = FALSE;
-	vfe31_ctrl->af_ack_pending = FALSE;
-	vfe31_ctrl->awb_ack_pending = FALSE;
-	vfe31_ctrl->ihist_ack_pending = FALSE;
-	vfe31_ctrl->rs_ack_pending = FALSE;
-	vfe31_ctrl->cs_ack_pending = FALSE;
-
-	vfe31_ctrl->reset_ack_pending  = FALSE;
-
-	spin_lock_irqsave(&vfe31_ctrl->update_ack_lock, flags);
-	vfe31_ctrl->update_ack_pending = FALSE;
-	spin_unlock_irqrestore(&vfe31_ctrl->update_ack_lock, flags);
-
-	vfe31_ctrl->recording_state = VFE_REC_STATE_IDLE;
-
-	/* 0 for continuous mode, 1 for snapshot mode */
-	vfe31_ctrl->operation_mode = VFE_MODE_OF_OPERATION_CONTINUOUS;
-	vfe31_ctrl->outpath.output_mode = 0;
-	vfe31_ctrl->vfe_capture_count = 0;
-
-	/* this is unsigned 32 bit integer. */
-	vfe31_ctrl->vfeFrameId = 0;
-
-	vfe31_ctrl->output1Pattern = 0xffffffff;
-	vfe31_ctrl->output1Period  = 31;
-	vfe31_ctrl->output2Pattern = 0xffffffff;
-	vfe31_ctrl->output2Period  = 31;
-	vfe31_ctrl->vfeFrameSkipCount   = 0;
-	vfe31_ctrl->vfeFrameSkipPeriod  = 31;
-
-	/* Stats control variables. */
-	memset(&(vfe31_ctrl->afStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe31_ctrl->awbStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe31_ctrl->aecStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe31_ctrl->ihistStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe31_ctrl->rsStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe31_ctrl->csStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-}
-
-static void vfe31_reset(void)
-{
-	uint32_t vfe_version;
-	vfe31_reset_free_buf_queue_all();
-	vfe31_reset_internal_variables();
-
-	vfe31_reset_hist_cfg();
-	vfe_version = msm_camera_io_r(vfe31_ctrl->vfebase);
-	CDBG("vfe_version = 0x%x\n", vfe_version);
-	/* disable all interrupts.  vfeImaskLocal is also reset to 0
-	* to begin with. */
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_0);
-
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* clear all pending interrupts*/
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_IRQ_CMD);
-
-	/* enable reset_ack interrupt.  */
-	msm_camera_io_w(VFE_IMASK_RESET,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* Write to VFE_GLOBAL_RESET_CMD to reset the vfe hardware. Once reset
-	 * is done, hardware interrupt will be generated.  VFE ist processes
-	 * the interrupt to complete the function call.  Note that the reset
-	 * function is synchronous. */
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(VFE_RESET_UPON_RESET_CMD,
-		vfe31_ctrl->vfebase + VFE_GLOBAL_RESET);
-}
-
-static int vfe31_operation_config(uint32_t *cmd)
-{
-	uint32_t *p = cmd;
-
-	vfe31_ctrl->operation_mode = *p;
-	vpe_ctrl->pad_2k_bool = (vfe31_ctrl->operation_mode & 1) ?
-		FALSE : TRUE;
-
-	vfe31_ctrl->stats_comp = *(++p);
-	vfe31_ctrl->hfr_mode = *(++p);
-
-	msm_camera_io_w(*(++p), vfe31_ctrl->vfebase + VFE_CFG_OFF);
-	msm_camera_io_w(*(++p), vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-	msm_camera_io_w(*(++p), vfe31_ctrl->vfebase + VFE_REALIGN_BUF);
-	msm_camera_io_w(*(++p), vfe31_ctrl->vfebase + VFE_CHROMA_UP);
-	msm_camera_io_w(*(++p), vfe31_ctrl->vfebase + VFE_STATS_CFG);
-	wmb();
-	return 0;
-}
-static uint32_t vfe_stats_awb_buf_init(struct vfe_cmd_stats_buf *in)
-{
-	uint32_t *ptr = in->statsBuf;
-	uint32_t addr;
-
-	addr = ptr[0];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PING_ADDR);
-	addr = ptr[1];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PONG_ADDR);
-	vfe31_ctrl->awbStatsControl.nextFrameAddrBuf = in->statsBuf[2];
-	return 0;
-}
-
-
-static uint32_t vfe_stats_aec_buf_init(struct vfe_cmd_stats_buf *in)
-{
-	uint32_t *ptr = in->statsBuf;
-	uint32_t addr;
-
-	addr = ptr[0];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AEC_WR_PING_ADDR);
-	addr = ptr[1];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AEC_WR_PONG_ADDR);
-
-	vfe31_ctrl->aecStatsControl.nextFrameAddrBuf = in->statsBuf[2];
-	return 0;
-}
-
-static uint32_t vfe_stats_af_buf_init(struct vfe_cmd_stats_buf *in)
-{
-	uint32_t *ptr = in->statsBuf;
-	uint32_t addr;
-
-	addr = ptr[0];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AF_WR_PING_ADDR);
-	addr = ptr[1];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AF_WR_PONG_ADDR);
-
-	vfe31_ctrl->afStatsControl.nextFrameAddrBuf = in->statsBuf[2];
-	return 0;
-}
-
-static uint32_t vfe_stats_ihist_buf_init(struct vfe_cmd_stats_buf *in)
-{
-	uint32_t *ptr = in->statsBuf;
-	uint32_t addr;
-
-	addr = ptr[0];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_HIST_WR_PING_ADDR);
-	addr = ptr[1];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_HIST_WR_PONG_ADDR);
-
-	vfe31_ctrl->ihistStatsControl.nextFrameAddrBuf = in->statsBuf[2];
-	return 0;
-}
-
-static uint32_t vfe_stats_rs_buf_init(struct vfe_cmd_stats_buf *in)
-{
-	uint32_t *ptr = in->statsBuf;
-	uint32_t addr;
-
-	addr = ptr[0];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_RS_WR_PING_ADDR);
-	addr = ptr[1];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_RS_WR_PONG_ADDR);
-
-	vfe31_ctrl->rsStatsControl.nextFrameAddrBuf = in->statsBuf[2];
-	return 0;
-}
-static uint32_t vfe_stats_cs_buf_init(struct vfe_cmd_stats_buf *in)
-{
-	uint32_t *ptr = in->statsBuf;
-	uint32_t addr;
-
-	addr = ptr[0];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_CS_WR_PING_ADDR);
-	addr = ptr[1];
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_CS_WR_PONG_ADDR);
-
-	vfe31_ctrl->csStatsControl.nextFrameAddrBuf = in->statsBuf[2];
-	return 0;
-}
-
-static void vfe31_start_common(void)
-{
-	uint32_t irq_mask = 0x00E00021;
-	vfe31_ctrl->start_ack_pending = TRUE;
-	CDBG("VFE opertaion mode = 0x%x, output mode = 0x%x\n",
-		vfe31_ctrl->operation_mode, vfe31_ctrl->outpath.output_mode);
-	/* Enable IRQ for comp stats, Image master, SOF & Reg Update*/
-	if (vfe31_ctrl->stats_comp)
-		irq_mask |= 0x01000000;
-	else /* Enable IRQ for Image masters, AF stats, SOF & Reg Update */
-		irq_mask |= 0x00004000;
-
-	/* Enable EOF for video mode */
-	if (VFE_MODE_OF_OPERATION_VIDEO == vfe31_ctrl->operation_mode)
-		irq_mask |= 0x4;
-
-	msm_camera_io_w(irq_mask, vfe31_ctrl->vfebase + VFE_IRQ_MASK_0);
-
-	msm_camera_io_w(VFE_IMASK_RESET,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-	/* enable out of order option */
-	msm_camera_io_w(0x80000000, vfe31_ctrl->vfebase + VFE_AXI_CFG);
-	/* enable performance monitor */
-	msm_camera_io_w(1, vfe31_ctrl->vfebase + VFE_BUS_PM_CFG);
-	msm_camera_io_w(1, vfe31_ctrl->vfebase + VFE_BUS_PM_CMD);
-
-
-	msm_camera_io_dump(vfe31_ctrl->vfebase, 0x600);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	msm_camera_io_w(1, vfe31_ctrl->vfebase + VFE_CAMIF_COMMAND);
-	wmb();
-
-	atomic_set(&vfe31_ctrl->vstate, 1);
-}
-
-static int vfe31_start_recording(void)
-{
-	msm_camio_set_perf_lvl(S_VIDEO);
-	usleep(1000);
-	vfe31_ctrl->recording_state = VFE_REC_STATE_START_REQUESTED;
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	return 0;
-}
-
-static int vfe31_stop_recording(void)
-{
-	vfe31_ctrl->recording_state = VFE_REC_STATE_STOP_REQUESTED;
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	msm_camio_set_perf_lvl(S_PREVIEW);
-	return 0;
-}
-
-static void vfe31_liveshot(void)
-{
-	struct msm_sync* p_sync = (struct msm_sync *)vfe_syncdata;
-	if (p_sync)
-		p_sync->liveshot_enabled = true;
-}
-
-static void vfe31_stereocam(uint32_t enable)
-{
-	struct msm_sync* p_sync = (struct msm_sync *)vfe_syncdata;
-	if (p_sync) {
-		CDBG("%s: Enable StereoCam %d!!!\n", __func__, enable);
-		p_sync->stereocam_enabled = enable;
-	}
-}
-
-static int vfe31_zsl(void)
-{
-	uint32_t irq_comp_mask = 0;
-	/* capture command is valid for both idle and active state. */
-	irq_comp_mask	=
-		msm_camera_io_r(vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-
-	CDBG("%s:op mode %d O/P Mode %d\n", __func__,
-		vfe31_ctrl->operation_mode, vfe31_ctrl->outpath.output_mode);
-	if ((vfe31_ctrl->operation_mode == VFE_MODE_OF_OPERATION_ZSL)) {
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_P) {
-			irq_comp_mask |=
-				((0x1 << (vfe31_ctrl->outpath.out0.ch0)) |
-				(0x1 << (vfe31_ctrl->outpath.out0.ch1)));
-		} else if (vfe31_ctrl->outpath.output_mode &
-				VFE31_OUTPUT_MODE_P_ALL_CHNLS) {
-			irq_comp_mask |= (0x1 << vfe31_ctrl->outpath.out0.ch0 |
-				0x1 << vfe31_ctrl->outpath.out0.ch1 |
-				0x1 << vfe31_ctrl->outpath.out0.ch2);
-		}
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_T) {
-			irq_comp_mask |=
-				((0x1 << (vfe31_ctrl->outpath.out1.ch0 + 8)) |
-				(0x1 << (vfe31_ctrl->outpath.out1.ch1 + 8)));
-		}
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_S) {
-			irq_comp_mask |=
-			((0x1 << (vfe31_ctrl->outpath.out2.ch0 + 8)) |
-			(0x1 << (vfe31_ctrl->outpath.out2.ch1 + 8)));
-		}
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_P) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-		} else if (vfe31_ctrl->outpath.output_mode &
-				VFE31_OUTPUT_MODE_P_ALL_CHNLS) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch2]);
-		}
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_T) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch1]);
-		}
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_S) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out2.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out2.ch1]);
-		}
-	}
-	msm_camera_io_w(irq_comp_mask, vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-	vfe31_start_common();
-	msm_camio_set_perf_lvl(S_ZSL);
-	usleep(1000);
-	/* for debug */
-	msm_camera_io_w(1, vfe31_ctrl->vfebase + 0x18C);
-	msm_camera_io_w(1, vfe31_ctrl->vfebase + 0x188);
-	return 0;
-}
-
-static int vfe31_capture(uint32_t num_frames_capture)
-{
-	uint32_t irq_comp_mask = 0;
-	struct msm_sync* p_sync = (struct msm_sync *)vfe_syncdata;
-
-	/* capture command is valid for both idle and active state. */
-	vfe31_ctrl->vfe_capture_count = num_frames_capture;
-	if (p_sync) {
-		p_sync->snap_count = num_frames_capture;
-		p_sync->thumb_count = num_frames_capture;
-	}
-
-	irq_comp_mask	=
-		msm_camera_io_r(vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-
-	if ((vfe31_ctrl->operation_mode ==
-		 VFE_MODE_OF_OPERATION_SNAPSHOT) ||
-		(vfe31_ctrl->operation_mode ==
-		 VFE_MODE_OF_OPERATION_ZSL)){
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_PT) {
-			irq_comp_mask |=
-				((0x1 << (vfe31_ctrl->outpath.out0.ch0 + 8)) |
-				(0x1 << (vfe31_ctrl->outpath.out0.ch1 + 8)));
-		}
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_S) {
-			irq_comp_mask |=
-			((0x1 << (vfe31_ctrl->outpath.out1.ch0 + 8)) |
-			(0x1 << (vfe31_ctrl->outpath.out1.ch1 + 8)));
-		}
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_PT) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-		}
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_S) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch1]);
-		}
-	} else {  /* this is raw snapshot mode. */
-		CDBG("config the comp imask for raw snapshot mode.\n");
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_S) {
-			irq_comp_mask |=
-			(0x1 << (vfe31_ctrl->outpath.out1.ch0 + 8));
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch0]);
-		}
-	}
-	msm_camera_io_w(irq_comp_mask, vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-	if (p_sync->stereocam_enabled)
-		msm_camio_set_perf_lvl(S_STEREO_CAPTURE);
-	else
-		msm_camio_set_perf_lvl(S_CAPTURE);
-
-	usleep(1000);
-	vfe31_start_common();
-	return 0;
-}
-
-static int vfe31_start(void)
-{
-	uint32_t irq_comp_mask = 0;
-	struct msm_sync* p_sync = (struct msm_sync *)vfe_syncdata;
-	/* start command now is only good for continuous mode. */
-	if ((vfe31_ctrl->operation_mode != VFE_MODE_OF_OPERATION_CONTINUOUS) &&
-		(vfe31_ctrl->operation_mode != VFE_MODE_OF_OPERATION_VIDEO))
-		return 0;
-	irq_comp_mask =
-		msm_camera_io_r(vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-
-	if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_PT) {
-		irq_comp_mask |= (0x1 << vfe31_ctrl->outpath.out0.ch0 |
-			0x1 << vfe31_ctrl->outpath.out0.ch1);
-			if (vfe31_ctrl->outpath.out0.ch2 >= 0)
-				irq_comp_mask |=
-					(0x1 << vfe31_ctrl->outpath.out0.ch0 |
-					0x1 << vfe31_ctrl->outpath.out0.ch1 |
-					0x1 << vfe31_ctrl->outpath.out0.ch2);
-	} else if (vfe31_ctrl->outpath.output_mode &
-		VFE31_OUTPUT_MODE_P_ALL_CHNLS) {
-			irq_comp_mask |= (0x1 << vfe31_ctrl->outpath.out0.ch0 |
-				0x1 << vfe31_ctrl->outpath.out0.ch1 |
-				0x1 << vfe31_ctrl->outpath.out0.ch2);
-	}
-
-	if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_V) {
-		irq_comp_mask |= (0x1 << (vfe31_ctrl->outpath.out2.ch0 + 16)|
-			0x1 << (vfe31_ctrl->outpath.out2.ch1 + 16));
-	}
-
-	msm_camera_io_w(irq_comp_mask, vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-
-
-	if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_PT) {
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-		if (vfe31_ctrl->outpath.out0.ch2 >= 0)
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch2]);
-	} else if (vfe31_ctrl->outpath.output_mode &
-		VFE31_OUTPUT_MODE_P_ALL_CHNLS) {
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch2]);
-	}
-
-	if (p_sync->stereocam_enabled)
-		msm_camio_set_perf_lvl(S_STEREO_VIDEO);
-	else
-		msm_camio_set_perf_lvl(S_PREVIEW);
-
-	usleep(1000);
-	vfe31_start_common();
-	return 0;
-}
-
-static void vfe31_update(void)
-{
-	unsigned long flags;
-	CDBG("vfe31_update\n");
-
-	if (vfe31_ctrl->update_gamma) {
-		if (!msm_camera_io_r(vfe31_ctrl->vfebase + V31_GAMMA_CFG_OFF))
-			msm_camera_io_w(7,
-				vfe31_ctrl->vfebase+V31_GAMMA_CFG_OFF);
-		else
-			msm_camera_io_w(0,
-				vfe31_ctrl->vfebase+V31_GAMMA_CFG_OFF);
-		vfe31_ctrl->update_gamma = false;
-	}
-	if (vfe31_ctrl->update_luma) {
-		if (!msm_camera_io_r(vfe31_ctrl->vfebase + V31_LUMA_CFG_OFF))
-			msm_camera_io_w(1,
-				vfe31_ctrl->vfebase + V31_LUMA_CFG_OFF);
-		else
-			msm_camera_io_w(0,
-				vfe31_ctrl->vfebase + V31_LUMA_CFG_OFF);
-		vfe31_ctrl->update_luma = false;
-	}
-	spin_lock_irqsave(&vfe31_ctrl->update_ack_lock, flags);
-	vfe31_ctrl->update_ack_pending = TRUE;
-	spin_unlock_irqrestore(&vfe31_ctrl->update_ack_lock, flags);
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	return;
-}
-
-static void vfe31_sync_timer_stop(void)
-{
-	uint32_t value = 0;
-	vfe31_ctrl->sync_timer_state = 0;
-	if (vfe31_ctrl->sync_timer_number == 0)
-		value = 0x10000;
-	else if (vfe31_ctrl->sync_timer_number == 1)
-		value = 0x20000;
-	else if (vfe31_ctrl->sync_timer_number == 2)
-		value = 0x40000;
-
-	/* Timer Stop */
-	msm_camera_io_w_mb(value, vfe31_ctrl->vfebase + V31_SYNC_TIMER_OFF);
-}
-
-static void vfe31_sync_timer_start(const uint32_t *tbl)
-{
-	/* set bit 8 for auto increment. */
-	uint32_t value = 1;
-	uint32_t val;
-
-	vfe31_ctrl->sync_timer_state = *tbl++;
-	vfe31_ctrl->sync_timer_repeat_count = *tbl++;
-	vfe31_ctrl->sync_timer_number = *tbl++;
-	CDBG("%s timer_state %d, repeat_cnt %d timer number %d\n",
-		 __func__, vfe31_ctrl->sync_timer_state,
-		 vfe31_ctrl->sync_timer_repeat_count,
-		 vfe31_ctrl->sync_timer_number);
-
-	if (vfe31_ctrl->sync_timer_state) { /* Start Timer */
-		value = value << vfe31_ctrl->sync_timer_number;
-	} else { /* Stop Timer */
-		CDBG("Failed to Start timer\n");
-		 return;
-	}
-
-	/* Timer Start */
-	msm_camera_io_w(value, vfe31_ctrl->vfebase + V31_SYNC_TIMER_OFF);
-	/* Sync Timer Line Start */
-	value = *tbl++;
-	msm_camera_io_w(value, vfe31_ctrl->vfebase + V31_SYNC_TIMER_OFF +
-		4 + ((vfe31_ctrl->sync_timer_number) * 12));
-	/* Sync Timer Pixel Start */
-	value = *tbl++;
-	msm_camera_io_w(value, vfe31_ctrl->vfebase + V31_SYNC_TIMER_OFF +
-			 8 + ((vfe31_ctrl->sync_timer_number) * 12));
-	/* Sync Timer Pixel Duration */
-	value = *tbl++;
-	val = camio_clk.vfe_clk_rate / 10000;
-	val = 10000000 / val;
-	val = value * 10000 / val;
-	CDBG("%s: Pixel Clk Cycles!!! %d\n", __func__, val);
-	msm_camera_io_w(val, vfe31_ctrl->vfebase + V31_SYNC_TIMER_OFF +
-		12 + ((vfe31_ctrl->sync_timer_number) * 12));
-	/* Timer0 Active High/LOW */
-	value = *tbl++;
-	msm_camera_io_w(value,
-		vfe31_ctrl->vfebase + V31_SYNC_TIMER_POLARITY_OFF);
-	/* Selects sync timer 0 output to drive onto timer1 port */
-	value = 0;
-	msm_camera_io_w(value, vfe31_ctrl->vfebase + V31_TIMER_SELECT_OFF);
-	wmb();
-}
-
-static void vfe31_program_dmi_cfg(enum VFE31_DMI_RAM_SEL bankSel)
-{
-	/* set bit 8 for auto increment. */
-	uint32_t value = VFE_DMI_CFG_DEFAULT;
-	value += (uint32_t)bankSel;
-
-	msm_camera_io_w_mb(value, vfe31_ctrl->vfebase + VFE_DMI_CFG);
-	/* by default, always starts with offset 0.*/
-	msm_camera_io_w(0, vfe31_ctrl->vfebase + VFE_DMI_ADDR);
-	wmb();
-}
-static void vfe31_write_gamma_cfg(enum VFE31_DMI_RAM_SEL channel_sel,
-						const uint32_t *tbl)
-{
-	int i;
-	uint32_t value, value1, value2;
-	vfe31_program_dmi_cfg(channel_sel);
-	/* for loop for extracting init table. */
-	for (i = 0 ; i < (VFE31_GAMMA_NUM_ENTRIES/2) ; i++) {
-		value = *tbl++;
-		value1 = value & 0x0000FFFF;
-		value2 = (value & 0xFFFF0000)>>16;
-		msm_camera_io_w((value1),
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-		msm_camera_io_w((value2),
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-	}
-	vfe31_program_dmi_cfg(NO_MEM_SELECTED);
-}
-
-static void vfe31_reset_hist_cfg()
-{
-	uint32_t i;
-	uint32_t value = 0;
-
-	vfe31_program_dmi_cfg(STATS_HIST_RAM);
-	for (i = 0 ; i < VFE31_HIST_TABLE_LENGTH ; i++)
-		msm_camera_io_w(value, vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-	vfe31_program_dmi_cfg(NO_MEM_SELECTED);
-}
-
-static void vfe31_write_la_cfg(enum VFE31_DMI_RAM_SEL channel_sel,
-						const uint32_t *tbl)
-{
-	uint32_t i;
-	uint32_t value, value1, value2;
-
-	vfe31_program_dmi_cfg(channel_sel);
-	/* for loop for extracting init table. */
-	for (i = 0 ; i < (VFE31_LA_TABLE_LENGTH/2) ; i++) {
-		value = *tbl++;
-		value1 = value & 0x0000FFFF;
-		value2 = (value & 0xFFFF0000)>>16;
-		msm_camera_io_w((value1),
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-		msm_camera_io_w((value2),
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-	}
-	vfe31_program_dmi_cfg(NO_MEM_SELECTED);
-}
-
-static int vfe31_proc_general(struct msm_vfe31_cmd *cmd)
-{
-	int i , rc = 0;
-	uint32_t old_val = 0 , new_val = 0;
-	uint32_t *cmdp = NULL;
-	uint32_t *cmdp_local = NULL;
-	uint32_t snapshot_cnt = 0;
-	uint32_t stereo_cam_enable = 0;
-	struct msm_sync* p_sync = (struct msm_sync *)vfe_syncdata;
-
-	CDBG("vfe31_proc_general: cmdID = %s, length = %d\n",
-		vfe31_general_cmd[cmd->id], cmd->length);
-	switch (cmd->id) {
-	case V31_RESET:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		vfe31_reset();
-		break;
-	case V31_START:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		rc = vfe31_start();
-		break;
-	case V31_UPDATE:
-		vfe31_update();
-		break;
-	case V31_ZSL:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		vfe31_zsl();
-		break;
-	case V31_CAPTURE:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		if (copy_from_user(&snapshot_cnt, (void __user *)(cmd->value),
-				sizeof(uint32_t))) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe31_capture(snapshot_cnt);
-		break;
-	case V31_START_RECORDING:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		rc = vfe31_start_recording();
-		if (p_sync->stereocam_enabled)
-			p_sync->stereo_state = STEREO_VIDEO_ACTIVE;
-		break;
-	case V31_STOP_RECORDING:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		rc = vfe31_stop_recording();
-		if (p_sync->stereocam_enabled)
-			p_sync->stereo_state = STEREO_VIDEO_IDLE;
-		break;
-	case V31_OPERATION_CFG: {
-		if (cmd->length != V31_OPERATION_CFG_LEN) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(V31_OPERATION_CFG_LEN, GFP_ATOMIC);
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			V31_OPERATION_CFG_LEN)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe31_operation_config(cmdp);
-		}
-		break;
-
-	case V31_STATS_AE_START: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= AE_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-		cmdp, (vfe31_cmd[cmd->id].length));
-		}
-		break;
-	case V31_STATS_AF_START: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= AF_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-		cmdp, (vfe31_cmd[cmd->id].length));
-		}
-		break;
-	case V31_STATS_AWB_START: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= AWB_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		}
-		break;
-
-	case V31_STATS_IHIST_START: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= IHIST_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		}
-		break;
-
-	case V31_XBAR_CFG: {
-		unsigned long flags = 0;
-		spin_lock_irqsave(&vfe31_ctrl->xbar_lock, flags);
-		if ((cmd->length != V31_XBAR_CFG_LEN)
-			|| vfe31_ctrl->xbar_update_pending) {
-			rc = -EINVAL;
-			spin_unlock_irqrestore(&vfe31_ctrl->xbar_lock, flags);
-			goto proc_general_done;
-		}
-		spin_unlock_irqrestore(&vfe31_ctrl->xbar_lock, flags);
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		spin_lock_irqsave(&vfe31_ctrl->xbar_lock, flags);
-		vfe31_ctrl->xbar_cfg[0] = *cmdp;
-		vfe31_ctrl->xbar_cfg[1] = *(cmdp+1);
-		vfe31_ctrl->xbar_update_pending = 1;
-		spin_unlock_irqrestore(&vfe31_ctrl->xbar_lock, flags);
-		CDBG("%s: xbar0 0x%x xbar1 0x%x", __func__,
-			vfe31_ctrl->xbar_cfg[0],
-			vfe31_ctrl->xbar_cfg[1]);
-		}
-		break;
-
-	case V31_STATS_RS_START: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		}
-		break;
-
-	case V31_STATS_CS_START: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		}
-		break;
-
-	case V31_MCE_UPDATE:
-	case V31_MCE_CFG:{
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		/* Incrementing with 4 so as to point to the 2nd Register as
-		the 2nd register has the mce_enable bit */
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-						V31_CHROMA_SUP_OFF + 4);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-		old_val &= MCE_EN_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + V31_CHROMA_SUP_OFF + 4,
-			&new_val, 4);
-		cmdp_local += 1;
-
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-						V31_CHROMA_SUP_OFF + 8);
-		new_val = *cmdp_local;
-		old_val &= MCE_Q_K_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + V31_CHROMA_SUP_OFF + 8,
-			&new_val, 4);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp_local, (vfe31_cmd[cmd->id].length));
-		}
-		break;
-	case V31_DEMOSAIC_2_UPDATE: /* 38 BPC update   */
-	case V31_DEMOSAIC_2_CFG: {  /* 14 BPC config   */
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-				vfe31_ctrl->vfebase + V31_DEMOSAIC_0_OFF);
-		old_val &= BPC_MASK;
-
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_DEMOSAIC_0_OFF,
-					cmdp_local, 4);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp_local, (vfe31_cmd[cmd->id].length));
-		}
-		break;
-	case V31_DEMOSAIC_1_UPDATE:/* 37 ABF update  */
-	case V31_DEMOSAIC_1_CFG: { /* 13 ABF config  */
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-				vfe31_ctrl->vfebase + V31_DEMOSAIC_0_OFF);
-		old_val &= ABF_MASK;
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_DEMOSAIC_0_OFF,
-		    cmdp_local, 4);
-
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp_local, (vfe31_cmd[cmd->id].length));
-		}
-		break;
-	case V31_ROLL_OFF_CFG: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value) , cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-		cmdp_local, 16);
-		cmdp_local += 4;
-		vfe31_program_dmi_cfg(ROLLOFF_RAM);
-		/* for loop for extrcting init table. */
-		for (i = 0 ; i < (VFE31_ROLL_OFF_INIT_TABLE_SIZE * 2) ; i++) {
-			msm_camera_io_w(*cmdp_local ,
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-			cmdp_local++;
-		}
-		CDBG("done writing init table\n");
-		/* by default, always starts with offset 0. */
-		msm_camera_io_w(LENS_ROLL_OFF_DELTA_TABLE_OFFSET,
-		vfe31_ctrl->vfebase + VFE_DMI_ADDR);
-		/* for loop for extracting delta table. */
-		for (i = 0 ; i < (VFE31_ROLL_OFF_DELTA_TABLE_SIZE * 2) ; i++) {
-			msm_camera_io_w(*cmdp_local,
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-			cmdp_local++;
-		}
-		vfe31_program_dmi_cfg(NO_MEM_SELECTED);
-		}
-		break;
-
-	case V31_LA_CFG:{
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		/* Select Bank 0*/
-		*cmdp = 0;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		cmdp += 1;
-		vfe31_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK0 , cmdp);
-		cmdp -= 1;
-		}
-		break;
-
-	case V31_LA_UPDATE: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-				vfe31_ctrl->vfebase + V31_LUMA_CFG_OFF);
-		cmdp += 1;
-		if (old_val != 0x0)
-			vfe31_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK0 , cmdp);
-		else
-			vfe31_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK1 , cmdp);
-		vfe31_ctrl->update_luma = true;
-		cmdp -= 1;
-		}
-		break;
-
-	case V31_SK_ENHAN_CFG:
-	case V31_SK_ENHAN_UPDATE:{
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_SCE_OFF,
-				cmdp, V31_SCE_LEN);
-		}
-		break;
-
-	case V31_LIVESHOT:
-		vfe31_liveshot();
-		break;
-
-	case V31_STEREOCAM:
-		if (copy_from_user(&stereo_cam_enable,
-			(void __user *)(cmd->value), sizeof(uint32_t))) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		vfe31_stereocam(stereo_cam_enable);
-		break;
-
-	case V31_RGB_G_CFG: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		/* Select Bank 0*/
-		*cmdp = 0;
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_RGB_G_OFF,
-				cmdp, 4);
-		cmdp += 1;
-		vfe31_write_gamma_cfg(RGBLUT_CHX_BANK0, cmdp);
-		cmdp -= 1;
-		}
-		break;
-
-	case V31_RGB_G_UPDATE: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-				vfe31_ctrl->vfebase + V31_GAMMA_CFG_OFF);
-		cmdp += 1;
-
-		if (!old_val) {
-			vfe31_write_gamma_cfg(RGBLUT_CHX_BANK1, cmdp);
-		} else {
-			vfe31_write_gamma_cfg(RGBLUT_CHX_BANK0, cmdp);
-			}
-		vfe31_ctrl->update_gamma = true;
-		cmdp -= 1;
-		}
-		break;
-
-	case V31_STATS_AWB_STOP: {
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~AWB_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-	case V31_STATS_AE_STOP: {
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~AE_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-	case V31_STATS_AF_STOP: {
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~AF_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-
-	case V31_STATS_IHIST_STOP: {
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~IHIST_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-
-	case V31_STATS_RS_STOP: {
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~RS_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-
-	case V31_STATS_CS_STOP: {
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~CS_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-	case V31_STOP:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		vfe31_stop();
-		break;
-
-	case V31_SYNC_TIMER_SETTING:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		vfe31_sync_timer_start(cmdp);
-		break;
-
-	case V31_EZTUNE_CFG: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		*cmdp &= ~STATS_ENABLE_MASK;
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= STATS_ENABLE_MASK;
-		*cmdp |= old_val;
-
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		}
-		break;
-
-	default: {
-		if (cmd->length != vfe31_cmd[cmd->id].length)
-			return -EINVAL;
-
-		cmdp = kmalloc(vfe31_cmd[cmd->id].length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-
-		if (copy_from_user(cmdp, (void __user *)cmd->value,
-				cmd->length)) {
-			rc = -EFAULT;
-			pr_err("%s copy from user failed for cmd %d",
-				__func__, cmd->id);
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-	}
-	break;
-
-	}
-
-proc_general_done:
-	kfree(cmdp);
-
-	return rc;
-}
-
-static void vfe31_stats_af_ack(struct vfe_cmd_stats_ack *pAck)
-{
-	vfe31_ctrl->afStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
-	vfe31_ctrl->af_ack_pending = FALSE;
-}
-
-static void vfe31_stats_awb_ack(struct vfe_cmd_stats_ack *pAck)
-{
-	vfe31_ctrl->awbStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
-	vfe31_ctrl->awb_ack_pending = FALSE;
-}
-
-static void vfe31_stats_aec_ack(struct vfe_cmd_stats_ack *pAck)
-{
-	vfe31_ctrl->aecStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
-	vfe31_ctrl->aec_ack_pending = FALSE;
-}
-
-static void vfe31_stats_ihist_ack(struct vfe_cmd_stats_ack *pAck)
-{
-	vfe31_ctrl->ihistStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
-	vfe31_ctrl->ihist_ack_pending = FALSE;
-}
-
-static void vfe31_stats_rs_ack(struct vfe_cmd_stats_ack *pAck)
-{
-	vfe31_ctrl->rsStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
-	vfe31_ctrl->rs_ack_pending = FALSE;
-}
-
-static void vfe31_stats_cs_ack(struct vfe_cmd_stats_ack *pAck)
-{
-	vfe31_ctrl->csStatsControl.nextFrameAddrBuf = pAck->nextStatsBuf;
-	vfe31_ctrl->cs_ack_pending = FALSE;
-}
-
-static int vfe31_config(struct msm_vfe_cfg_cmd *cmd, void *data)
-{
-	struct msm_vfe31_cmd vfecmd;
-
-	long rc = 0;
-	uint32_t i = 0;
-	struct vfe_cmd_stats_buf *scfg = NULL;
-	struct msm_pmem_region   *regptr = NULL;
-	struct vfe_cmd_stats_ack *sack = NULL;
-
-	if (cmd->cmd_type != CMD_FRAME_BUF_RELEASE &&
-		cmd->cmd_type != CMD_SNAP_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_AEC_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_AWB_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_IHIST_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_RS_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_CS_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_AF_BUF_RELEASE) {
-		if (copy_from_user(&vfecmd,
-				(void __user *)(cmd->value),
-				sizeof(vfecmd))) {
-			pr_err("%s %d: copy_from_user failed\n", __func__,
-				__LINE__);
-			return -EFAULT;
-		}
-	} else {
-	/* here eith stats release or frame release. */
-		if (cmd->cmd_type != CMD_FRAME_BUF_RELEASE &&
-			cmd->cmd_type != CMD_SNAP_BUF_RELEASE) {
-			/* then must be stats release. */
-			if (!data)
-				return -EFAULT;
-				sack = kmalloc(sizeof(struct vfe_cmd_stats_ack),
-				GFP_ATOMIC);
-				if (!sack)
-					return -ENOMEM;
-
-				sack->nextStatsBuf = *(uint32_t *)data;
-			}
-	}
-
-	CDBG("%s: cmdType = %d\n", __func__, cmd->cmd_type);
-
-	if ((cmd->cmd_type == CMD_STATS_AF_ENABLE) ||
-		(cmd->cmd_type == CMD_STATS_AWB_ENABLE) ||
-		(cmd->cmd_type == CMD_STATS_IHIST_ENABLE) ||
-		(cmd->cmd_type == CMD_STATS_RS_ENABLE) ||
-		(cmd->cmd_type == CMD_STATS_CS_ENABLE) ||
-		(cmd->cmd_type == CMD_STATS_AEC_ENABLE)) {
-		struct axidata *axid;
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto vfe31_config_done;
-		}
-
-		scfg =
-			kmalloc(sizeof(struct vfe_cmd_stats_buf),
-				GFP_ATOMIC);
-		if (!scfg) {
-			rc = -ENOMEM;
-			goto vfe31_config_done;
-		}
-		regptr = axid->region;
-		if (axid->bufnum1 > 0) {
-			for (i = 0; i < axid->bufnum1; i++) {
-				scfg->statsBuf[i] =
-					(uint32_t)(regptr->paddr);
-				regptr++;
-			}
-		}
-		/* individual */
-		switch (cmd->cmd_type) {
-		case CMD_STATS_AEC_ENABLE:
-			rc = vfe_stats_aec_buf_init(scfg);
-			break;
-		case CMD_STATS_AF_ENABLE:
-			rc = vfe_stats_af_buf_init(scfg);
-			break;
-		case CMD_STATS_AWB_ENABLE:
-			rc = vfe_stats_awb_buf_init(scfg);
-			break;
-		case CMD_STATS_IHIST_ENABLE:
-			rc = vfe_stats_ihist_buf_init(scfg);
-			break;
-		case CMD_STATS_RS_ENABLE:
-			rc = vfe_stats_rs_buf_init(scfg);
-			break;
-		case CMD_STATS_CS_ENABLE:
-			rc = vfe_stats_cs_buf_init(scfg);
-			break;
-		}
-	}
-
-	switch (cmd->cmd_type) {
-	case CMD_GENERAL:
-		rc = vfe31_proc_general(&vfecmd);
-		break;
-
-	case CMD_FRAME_BUF_RELEASE: {
-		struct msm_frame *b;
-		unsigned long p;
-		int ret;
-		struct vfe31_output_ch *outch = NULL;
-		if (!data) {
-			rc = -EFAULT;
-			break;
-		}
-
-		b = (struct msm_frame *)(cmd->value);
-		p = *(unsigned long *)data;
-
-		CDBG("CMD_FRAME_BUF_RELEASE b->path = %d\n", b->path);
-
-		if (b->path & OUTPUT_TYPE_P) {
-			CDBG("CMD_FRAME_BUF_RELEASE got free buffer\n");
-			outch = &vfe31_ctrl->outpath.out0;
-		} else if (b->path & OUTPUT_TYPE_S) {
-			outch = &vfe31_ctrl->outpath.out1;
-		} else if (b->path & OUTPUT_TYPE_V) {
-			outch = &vfe31_ctrl->outpath.out2;
-		} else {
-			rc = -EFAULT;
-			break;
-		}
-
-		ret = vfe31_add_free_buf2(outch, p, b->planar0_off,
-			b->planar1_off, b->planar2_off);
-		if (ret < 0)
-			return ret;
-		break;
-	}
-
-	case CMD_SNAP_BUF_RELEASE: {
-		struct msm_frame *b;
-		unsigned long p;
-		int ret;
-		struct vfe31_output_ch *outch = NULL;
-		if (!data)
-			return -EFAULT;
-
-		b = (struct msm_frame *)(cmd->value);
-		p = *(unsigned long *)data;
-
-		CDBG("CMD_PIC_BUF_RELEASE b->path = %d\n", b->path);
-
-		if (b->path & OUTPUT_TYPE_T) {
-			CDBG("CMD_FRAME_BUF_RELEASE got free buffer\n");
-			outch = &vfe31_ctrl->outpath.out1;
-		} else if (b->path & OUTPUT_TYPE_S) {
-			outch = &vfe31_ctrl->outpath.out2;
-		} else
-			return -EFAULT;
-
-		ret = vfe31_add_free_buf2(outch, p, b->planar0_off,
-			b->planar1_off,	b->planar2_off);
-		if (ret < 0)
-			return ret;
-		break;
-	}
-
-	case CMD_STATS_AEC_BUF_RELEASE:
-		vfe31_stats_aec_ack(sack);
-		break;
-
-	case CMD_STATS_AF_BUF_RELEASE:
-		vfe31_stats_af_ack(sack);
-		break;
-
-	case CMD_STATS_AWB_BUF_RELEASE:
-		vfe31_stats_awb_ack(sack);
-		break;
-
-	case CMD_STATS_IHIST_BUF_RELEASE:
-		vfe31_stats_ihist_ack(sack);
-		break;
-
-	case CMD_STATS_RS_BUF_RELEASE:
-		vfe31_stats_rs_ack(sack);
-		break;
-
-	case CMD_STATS_CS_BUF_RELEASE:
-		vfe31_stats_cs_ack(sack);
-		break;
-
-	case CMD_AXI_CFG_PREVIEW: {
-		struct axidata *axid;
-		uint32_t *axio = NULL;
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			break;
-		}
-		axio =
-			kmalloc(vfe31_cmd[V31_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[V31_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe31_config_axi(OUTPUT_2, axid, axio);
-		kfree(axio);
-		break;
-	}
-
-	case CMD_RAW_PICT_AXI_CFG: {
-		struct axidata *axid;
-		uint32_t *axio = NULL;
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			break;
-		}
-		axio =
-			kmalloc(vfe31_cmd[V31_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[V31_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe31_config_axi(CAMIF_TO_AXI_VIA_OUTPUT_2, axid, axio);
-		kfree(axio);
-		break;
-	}
-
-	case CMD_AXI_CFG_SNAP: {
-		struct axidata *axid;
-		uint32_t *axio = NULL;
-		CDBG("%s, CMD_AXI_CFG_SNAP\n", __func__);
-		axid = data;
-		if (!axid)
-			return -EFAULT;
-		axio =
-			kmalloc(vfe31_cmd[V31_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[V31_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe31_config_axi(OUTPUT_1_AND_2, axid, axio);
-		kfree(axio);
-		break;
-	}
-
-	case CMD_AXI_CFG_ZSL: {
-		struct axidata *axid;
-		uint32_t *axio = NULL;
-		CDBG("%s, CMD_AXI_CFG_ZSL\n", __func__);
-		axid = data;
-		if (!axid)
-			return -EFAULT;
-		axio =
-			kmalloc(vfe31_cmd[V31_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[V31_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe31_config_axi(OUTPUT_1_2_AND_3, axid, axio);
-		kfree(axio);
-	}
-		break;
-
-	case CMD_AXI_CFG_ZSL_ALL_CHNLS: {
-		struct axidata *axid;
-		uint32_t *axio;
-		CDBG("%s, CMD_AXI_CFG_ZSL\n", __func__);
-		axid = data;
-		if (!axid)
-			return -EFAULT;
-		axio =
-			kmalloc(vfe31_cmd[V31_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[V31_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe31_config_axi(OUTPUT_ZSL_ALL_CHNLS, axid, axio);
-		kfree(axio);
-	}
-		break;
-
-	case CMD_AXI_CFG_VIDEO: {
-		struct axidata *axid;
-		uint32_t *axio = NULL;
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			break;
-		}
-
-		axio =
-			kmalloc(vfe31_cmd[V31_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[V31_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe31_config_axi(OUTPUT_1_AND_3, axid, axio);
-		kfree(axio);
-		break;
-	}
-
-	case CMD_AXI_CFG_VIDEO_ALL_CHNLS: {
-		struct axidata *axid;
-		uint32_t *axio = NULL;
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			break;
-		}
-
-		axio =
-			kmalloc(vfe31_cmd[V31_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[V31_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe31_config_axi(OUTPUT_VIDEO_ALL_CHNLS, axid, axio);
-		kfree(axio);
-		break;
-	}
-
-	default:
-		break;
-	}
-vfe31_config_done:
-	kfree(scfg);
-	kfree(sack);
-	CDBG("%s done: rc = %d\n", __func__, (int) rc);
-	return rc;
-}
-
-static void vfe31_send_msg_no_payload(enum VFE31_MESSAGE_ID id)
-{
-	struct vfe_message msg;
-
-	CDBG("vfe31_send_msg_no_payload\n");
-	msg._d = id;
-	vfe31_proc_ops(id, &msg, 0);
-}
-
-static void vfe31_process_reg_update_irq(void)
-{
-	uint32_t  temp, old_val;
-	unsigned long flags;
-	if (vfe31_ctrl->recording_state == VFE_REC_STATE_START_REQUESTED) {
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_V) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out2.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out2.ch1]);
-		}
-		vfe31_ctrl->recording_state = VFE_REC_STATE_STARTED;
-		if (vpe_ctrl->dis_en) {
-			old_val = msm_camera_io_r(
-				vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-			old_val |= RS_CS_ENABLE_MASK;
-			msm_camera_io_w(old_val,
-				vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-		CDBG("start video triggered .\n");
-	} else if (vfe31_ctrl->recording_state
-			== VFE_REC_STATE_STOP_REQUESTED) {
-		if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_V) {
-			msm_camera_io_w(0, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out2.ch0]);
-			msm_camera_io_w(0, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out2.ch1]);
-		}
-
-		/*disable rs& cs when stop recording. */
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= (~RS_CS_ENABLE_MASK);
-		msm_camera_io_w(old_val,
-				vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		CDBG("stop video triggered\n");
-	}
-	if (vfe31_ctrl->start_ack_pending == TRUE) {
-		vfe31_send_msg_no_payload(MSG_ID_START_ACK);
-		vfe31_ctrl->start_ack_pending = FALSE;
-	} else {
-		if (vfe31_ctrl->recording_state ==
-			VFE_REC_STATE_STOP_REQUESTED) {
-			vfe31_ctrl->recording_state = VFE_REC_STATE_STOPPED;
-			msm_camera_io_w_mb(1, vfe31_ctrl->vfebase +
-						VFE_REG_UPDATE_CMD);
-		} else if (vfe31_ctrl->recording_state ==
-			VFE_REC_STATE_STOPPED) {
-			CDBG("sent stop video rec ACK");
-			vfe31_send_msg_no_payload(MSG_ID_STOP_REC_ACK);
-			vfe31_ctrl->recording_state = VFE_REC_STATE_IDLE;
-		}
-		spin_lock_irqsave(&vfe31_ctrl->update_ack_lock, flags);
-		if (vfe31_ctrl->update_ack_pending == TRUE) {
-			vfe31_ctrl->update_ack_pending = FALSE;
-			spin_unlock_irqrestore(
-				&vfe31_ctrl->update_ack_lock, flags);
-			vfe31_send_msg_no_payload(MSG_ID_UPDATE_ACK);
-		} else {
-			spin_unlock_irqrestore(
-				&vfe31_ctrl->update_ack_lock, flags);
-		}
-	}
-	/* in snapshot mode */
-	if (vfe31_ctrl->operation_mode ==
-		VFE_MODE_OF_OPERATION_SNAPSHOT) {
-		/* later we need to add check for live snapshot mode. */
-
-		if (vfe31_ctrl->vfe_capture_count)
-			vfe31_ctrl->vfe_capture_count--;
-		/* if last frame to be captured: */
-		if (vfe31_ctrl->vfe_capture_count == 0) {
-			/* stop the bus output:  write master enable = 0*/
-			if (vfe31_ctrl->outpath.output_mode &
-					VFE31_OUTPUT_MODE_PT) {
-				msm_camera_io_w(0, vfe31_ctrl->vfebase +
-					vfe31_AXI_WM_CFG[
-						vfe31_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(0, vfe31_ctrl->vfebase +
-					vfe31_AXI_WM_CFG[vfe31_ctrl->
-						outpath.out0.ch1]);
-			}
-			if (vfe31_ctrl->outpath.output_mode &
-					VFE31_OUTPUT_MODE_S) {
-				msm_camera_io_w(0, vfe31_ctrl->vfebase +
-					vfe31_AXI_WM_CFG[vfe31_ctrl->
-						outpath.out1.ch0]);
-				msm_camera_io_w(0, vfe31_ctrl->vfebase +
-					vfe31_AXI_WM_CFG[vfe31_ctrl->
-						outpath.out1.ch1]);
-			}
-
-			/* Ensure the write order while writing
-			to the command register using the barrier */
-			msm_camera_io_w_mb(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-				vfe31_ctrl->vfebase + VFE_CAMIF_COMMAND);
-
-			/* Ensure the read order while reading
-			to the command register using the barrier */
-			temp = msm_camera_io_r_mb(vfe31_ctrl->vfebase +
-				VFE_CAMIF_COMMAND);
-		}
-		/* then do reg_update. */
-		msm_camera_io_w_mb(1, vfe31_ctrl->vfebase +
-			VFE_REG_UPDATE_CMD);
-	} /* if snapshot mode. */
-}
-
-static void vfe31_set_default_reg_values(void)
-{
-	msm_camera_io_w(0x800080, vfe31_ctrl->vfebase + VFE_DEMUX_GAIN_0);
-	msm_camera_io_w(0x800080, vfe31_ctrl->vfebase + VFE_DEMUX_GAIN_1);
-	msm_camera_io_w(0xFFFFF, vfe31_ctrl->vfebase + VFE_CGC_OVERRIDE);
-
-	/* default frame drop period and pattern */
-	msm_camera_io_w(0x1f, vfe31_ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_CFG);
-	msm_camera_io_w(0x1f, vfe31_ctrl->vfebase + VFE_FRAMEDROP_ENC_CBCR_CFG);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe31_ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe31_ctrl->vfebase + VFE_FRAMEDROP_ENC_CBCR_PATTERN);
-	msm_camera_io_w(0x1f, vfe31_ctrl->vfebase + VFE_FRAMEDROP_VIEW_Y);
-	msm_camera_io_w(0x1f, vfe31_ctrl->vfebase + VFE_FRAMEDROP_VIEW_CBCR);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe31_ctrl->vfebase + VFE_FRAMEDROP_VIEW_Y_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe31_ctrl->vfebase + VFE_FRAMEDROP_VIEW_CBCR_PATTERN);
-	msm_camera_io_w(0, vfe31_ctrl->vfebase + VFE_CLAMP_MIN);
-	msm_camera_io_w(0xFFFFFF, vfe31_ctrl->vfebase + VFE_CLAMP_MAX);
-
-	/* stats UB config */
-	msm_camera_io_w(0x3980007,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AEC_UB_CFG);
-	msm_camera_io_w(0x3A00007,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AF_UB_CFG);
-	msm_camera_io_w(0x3A8000F,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AWB_UB_CFG);
-	msm_camera_io_w(0x3B80007,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_RS_UB_CFG);
-	msm_camera_io_w(0x3C0001F,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_CS_UB_CFG);
-	msm_camera_io_w(0x3E0001F,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_HIST_UB_CFG);
-}
-
-static void vfe31_process_reset_irq(void)
-{
-	atomic_set(&vfe31_ctrl->vstate, 0);
-	vfe31_ctrl->while_stopping_mask = VFE_IMASK_WHILE_STOPPING_1;
-	if (atomic_read(&vfe31_ctrl->stop_ack_pending)) {
-		/* this is from the stop command. */
-		atomic_set(&vfe31_ctrl->stop_ack_pending, 0);
-		vfe31_send_msg_no_payload(MSG_ID_STOP_ACK);
-	} else {
-		/* this is from reset command. */
-		vfe31_set_default_reg_values();
-
-		/* reload all write masters. (frame & line)*/
-		msm_camera_io_w_mb(0x7FFF, vfe31_ctrl->vfebase + VFE_BUS_CMD);
-		vfe31_send_msg_no_payload(MSG_ID_RESET_ACK);
-	}
-}
-
-
-static void vfe31_process_axi_halt_irq(void)
-{
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(AXI_HALT_CLEAR,
-		vfe31_ctrl->vfebase + VFE_AXI_CMD);
-	vfe31_ctrl->while_stopping_mask = VFE_IMASK_RESET;
-
-	/* disable all interrupts.  */
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* clear all pending interrupts*/
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1,
-		vfe31_ctrl->vfebase + VFE_IRQ_CMD);
-
-	/* now enable only halt_irq & reset_irq */
-	msm_camera_io_w(0xf0000000,          /* this is for async timer. */
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(VFE_IMASK_RESET,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	CDBG("%s: about to reset vfe...\n", __func__);
-	msm_camera_io_w_mb(VFE_RESET_UPON_STOP_CMD,
-		vfe31_ctrl->vfebase + VFE_GLOBAL_RESET);
-
-}
-
-static void vfe31_process_camif_sof_irq(void)
-{
-	uint32_t  temp;
-
-	/* in raw snapshot mode */
-	if (vfe31_ctrl->operation_mode ==
-		VFE_MODE_OF_OPERATION_RAW_SNAPSHOT) {
-		if (vfe31_ctrl->start_ack_pending) {
-			vfe31_send_msg_no_payload(MSG_ID_START_ACK);
-			vfe31_ctrl->start_ack_pending = FALSE;
-		}
-		if (vfe31_ctrl->vfe_capture_count)
-			vfe31_ctrl->vfe_capture_count--;
-		/* if last frame to be captured: */
-		if (vfe31_ctrl->vfe_capture_count == 0) {
-			/* Ensure the write order while writing
-			to the command register using the barrier */
-			msm_camera_io_w_mb(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-				vfe31_ctrl->vfebase + VFE_CAMIF_COMMAND);
-			temp = msm_camera_io_r_mb(vfe31_ctrl->vfebase +
-				VFE_CAMIF_COMMAND);
-		}
-	} /* if raw snapshot mode. */
-
-	if ((vfe31_ctrl->hfr_mode != HFR_MODE_OFF) &&
-		(vfe31_ctrl->operation_mode == VFE_MODE_OF_OPERATION_VIDEO) &&
-		(vfe31_ctrl->vfeFrameId % vfe31_ctrl->hfr_mode != 0)) {
-		vfe31_ctrl->vfeFrameId++;
-		CDBG("Skip the SOF notification when HFR enabled\n");
-		return;
-	}
-	vfe31_send_msg_no_payload(MSG_ID_SOF_ACK);
-	vfe31_ctrl->vfeFrameId++;
-	CDBG("camif_sof_irq, frameId = %d\n", vfe31_ctrl->vfeFrameId);
-
-	if (vfe31_ctrl->sync_timer_state) {
-		if (vfe31_ctrl->sync_timer_repeat_count == 0)
-			vfe31_sync_timer_stop();
-		else
-		vfe31_ctrl->sync_timer_repeat_count--;
-	}
-}
-
-static void vfe31_process_error_irq(uint32_t errStatus)
-{
-	uint32_t camifStatus, read_val;
-	uint32_t *temp;
-
-	if (errStatus & VFE31_IMASK_CAMIF_ERROR) {
-		pr_err("vfe31_irq: camif errors\n");
-		temp = (uint32_t *)(vfe31_ctrl->vfebase + VFE_CAMIF_STATUS);
-		camifStatus = msm_camera_io_r(temp);
-		pr_err("camifStatus  = 0x%x\n", camifStatus);
-		vfe31_send_msg_no_payload(MSG_ID_CAMIF_ERROR);
-	}
-
-	if (errStatus & VFE31_IMASK_STATS_CS_OVWR)
-		pr_err("vfe31_irq: stats cs overwrite\n");
-
-	if (errStatus & VFE31_IMASK_STATS_IHIST_OVWR)
-		pr_err("vfe31_irq: stats ihist overwrite\n");
-
-	if (errStatus & VFE31_IMASK_REALIGN_BUF_Y_OVFL)
-		pr_err("vfe31_irq: realign bug Y overflow\n");
-
-	if (errStatus & VFE31_IMASK_REALIGN_BUF_CB_OVFL)
-		pr_err("vfe31_irq: realign bug CB overflow\n");
-
-	if (errStatus & VFE31_IMASK_REALIGN_BUF_CR_OVFL)
-		pr_err("vfe31_irq: realign bug CR overflow\n");
-
-	if (errStatus & VFE31_IMASK_VIOLATION)
-		pr_err("vfe31_irq: violation interrupt\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_0_BUS_OVFL)
-		pr_err("vfe31_irq: image master 0 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_1_BUS_OVFL)
-		pr_err("vfe31_irq: image master 1 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_2_BUS_OVFL)
-		pr_err("vfe31_irq: image master 2 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_3_BUS_OVFL)
-		pr_err("vfe31_irq: image master 3 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_4_BUS_OVFL)
-		pr_err("vfe31_irq: image master 4 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_5_BUS_OVFL)
-		pr_err("vfe31_irq: image master 5 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_6_BUS_OVFL)
-		pr_err("vfe31_irq: image master 6 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_AE_BUS_OVFL)
-		pr_err("vfe31_irq: ae stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_AF_BUS_OVFL)
-		pr_err("vfe31_irq: af stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_AWB_BUS_OVFL)
-		pr_err("vfe31_irq: awb stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_RS_BUS_OVFL)
-		pr_err("vfe31_irq: rs stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_CS_BUS_OVFL)
-		pr_err("vfe31_irq: cs stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_IHIST_BUS_OVFL)
-		pr_err("vfe31_irq: ihist stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_SKIN_BUS_OVFL)
-		pr_err("vfe31_irq: skin stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_AXI_ERROR) {
-		pr_err("vfe31_irq: axi error\n");
-		/* read status too when overflow happens.*/
-		read_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_BUS_PING_PONG_STATUS);
-		pr_debug("VFE_BUS_PING_PONG_STATUS = 0x%x\n", read_val);
-		read_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_BUS_OPERATION_STATUS);
-		pr_debug("VFE_BUS_OPERATION_STATUS = 0x%x\n", read_val);
-		read_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_0);
-		pr_debug("VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_0 = 0x%x\n",
-			read_val);
-		read_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_1);
-		pr_debug("VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_1 = 0x%x\n",
-			read_val);
-		read_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_AXI_STATUS);
-		pr_debug("VFE_AXI_STATUS = 0x%x\n", read_val);
-	}
-}
-
-#define VFE31_AXI_OFFSET 0x0050
-#define vfe31_get_ch_ping_addr(chn) \
-	(msm_camera_io_r(vfe31_ctrl->vfebase + 0x0050 + 0x18 * (chn)))
-#define vfe31_get_ch_pong_addr(chn) \
-	(msm_camera_io_r(vfe31_ctrl->vfebase + 0x0050 + 0x18 * (chn) + 4))
-#define vfe31_get_ch_addr(ping_pong, chn) \
-	(((ping_pong) & (1 << (chn))) == 0 ? \
-	vfe31_get_ch_pong_addr(chn) : vfe31_get_ch_ping_addr(chn))
-
-#define vfe31_put_ch_ping_addr(chn, addr) \
-	(msm_camera_io_w((addr), vfe31_ctrl->vfebase + 0x0050 + 0x18 * (chn)))
-#define vfe31_put_ch_pong_addr(chn, addr) \
-	(msm_camera_io_w((addr), \
-	vfe31_ctrl->vfebase + 0x0050 + 0x18 * (chn) + 4))
-#define vfe31_put_ch_addr(ping_pong, chn, addr) \
-	(((ping_pong) & (1 << (chn))) == 0 ?   \
-	vfe31_put_ch_pong_addr((chn), (addr)) : \
-	vfe31_put_ch_ping_addr((chn), (addr)))
-
-static void vfe31_process_output_path_irq_0(uint32_t ping_pong)
-{
-	uint32_t p0_addr, p1_addr, p2_addr;
-#ifdef CONFIG_MSM_CAMERA_V4L2
-	uint32_t pyaddr_ping, pcbcraddr_ping, pyaddr_pong, pcbcraddr_pong;
-#endif
-	struct vfe31_free_buf *free_buf = NULL;
-	/* we render frames in the following conditions:
-	1. Continuous mode and the free buffer is avaialable.
-	*/
-	if (vfe31_ctrl->outpath.output_mode &
-		VFE31_OUTPUT_MODE_P_ALL_CHNLS) {
-		if (!(((ping_pong & PINGPONG_LOWER) == PINGPONG_LOWER) ||
-			((ping_pong & PINGPONG_LOWER) == 0x0))) {
-			pr_err(" Irq_2 - skip the frame pp_status is not proper"
-				"PP_status = 0x%x\n", ping_pong);
-			return;
-		}
-	}
-	free_buf = vfe31_get_free_buf(&vfe31_ctrl->outpath.out0);
-
-	if (free_buf) {
-		/* Y channel */
-		p0_addr = vfe31_get_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out0.ch0);
-		/* Chroma channel */
-		p1_addr = vfe31_get_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out0.ch1);
-		if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_P_ALL_CHNLS) {
-			p2_addr = vfe31_get_ch_addr(ping_pong,
-				vfe31_ctrl->outpath.out0.ch2);
-		} else {
-			p2_addr = p0_addr;
-		}
-		CDBG("Output path 0, p0_addr = 0x%x, p1_addr = 0x%x,"
-			 "p2_addr = 0x%x\n", p0_addr, p1_addr, p2_addr);
-		/* Y channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out0.ch0,
-			free_buf->paddr + free_buf->planar0_off);
-		/* Chroma channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out0.ch1,
-			free_buf->paddr + free_buf->planar1_off);
-		if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_P_ALL_CHNLS)
-			vfe31_put_ch_addr(ping_pong,
-				vfe31_ctrl->outpath.out0.ch2,
-			free_buf->paddr + free_buf->planar2_off);
-			kfree(free_buf);
-			/* if continuous mode, for display. (preview) */
-			vfe_send_outmsg(MSG_ID_OUTPUT_P,  p0_addr, p1_addr,
-				p2_addr);
-	} else {
-		vfe31_ctrl->outpath.out0.frame_drop_cnt++;
-		pr_warning("path_irq_0 - no free buffer!\n");
-#ifdef CONFIG_MSM_CAMERA_V4L2
-		pr_info("Swapping ping and pong\n");
-
-		/*get addresses*/
-		/* Y channel */
-		pyaddr_ping = vfe31_get_ch_ping_addr(
-			vfe31_ctrl->outpath.out0.ch0);
-		/* Chroma channel */
-		pcbcraddr_ping = vfe31_get_ch_ping_addr(
-			vfe31_ctrl->outpath.out0.ch1);
-		/* Y channel */
-		pyaddr_pong = vfe31_get_ch_pong_addr(
-			vfe31_ctrl->outpath.out0.ch0);
-		/* Chroma channel */
-		pcbcraddr_pong = vfe31_get_ch_pong_addr(
-			vfe31_ctrl->outpath.out0.ch1);
-
-		CDBG("ping = 0x%p, pong = 0x%p\n", (void *)pyaddr_ping,
-			(void *)pyaddr_pong);
-		CDBG("ping_cbcr = 0x%p, pong_cbcr = 0x%p\n",
-			(void *)pcbcraddr_ping, (void *)pcbcraddr_pong);
-
-		/*put addresses*/
-		/* SWAP y channel*/
-		vfe31_put_ch_ping_addr(vfe31_ctrl->outpath.out0.ch0,
-			pyaddr_pong);
-		vfe31_put_ch_pong_addr(vfe31_ctrl->outpath.out0.ch0,
-			pyaddr_ping);
-		/* SWAP chroma channel*/
-		vfe31_put_ch_ping_addr(vfe31_ctrl->outpath.out0.ch1,
-			pcbcraddr_pong);
-		vfe31_put_ch_pong_addr(vfe31_ctrl->outpath.out0.ch1,
-			pcbcraddr_ping);
-		CDBG("after swap: ping = 0x%p, pong = 0x%p\n",
-			(void *)pyaddr_pong, (void *)pyaddr_ping);
-#endif
-	}
-}
-
-static void vfe31_process_snapshot_frame(uint32_t ping_pong)
-{
-	uint32_t p0_addr, p1_addr;
-	struct vfe31_free_buf *free_buf = NULL;
-	/* Y channel- Main Image */
-	p0_addr = vfe31_get_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out1.ch0);
-	/* Chroma channel - TN Image */
-	p1_addr = vfe31_get_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out1.ch1);
-
-	free_buf = vfe31_get_free_buf(&vfe31_ctrl->outpath.out1);
-	CDBG("%s: snapshot main, p0_addr = 0x%x, p1_addr = 0x%x\n",
-		__func__, p0_addr, p1_addr);
-	if (free_buf) {
-		/* Y channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out1.ch0,
-			free_buf->paddr + free_buf->planar0_off);
-		/* Chroma channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out1.ch1,
-			free_buf->paddr + free_buf->planar1_off);
-		kfree(free_buf);
-	}
-	vfe_send_outmsg(MSG_ID_OUTPUT_S, p0_addr, p1_addr, p0_addr);
-
-	/* Y channel- TN Image */
-	p0_addr = vfe31_get_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out0.ch0);
-	/* Chroma channel - TN Image */
-	p1_addr = vfe31_get_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out0.ch1);
-
-	free_buf = vfe31_get_free_buf(&vfe31_ctrl->outpath.out0);
-	CDBG("%s: snapshot TN, p0_addr = 0x%x, p1_addr = 0x%x\n",
-		__func__, p0_addr, p1_addr);
-	if (free_buf) {
-		/* Y channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out0.ch0,
-			free_buf->paddr + free_buf->planar0_off);
-		/* Chroma channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out0.ch1,
-			free_buf->paddr + free_buf->planar1_off);
-		kfree(free_buf);
-	}
-
-	vfe_send_outmsg(MSG_ID_OUTPUT_T, p0_addr, p1_addr, p0_addr);
-
-	/* in snapshot mode if done then send
-		snapshot done message */
-	if (vfe31_ctrl->vfe_capture_count == 0) {
-		vfe31_send_msg_no_payload(MSG_ID_SNAPSHOT_DONE);
-		/* Ensure the write order while writing
-			to the cmd register using barrier */
-		msm_camera_io_w_mb(CAMIF_COMMAND_STOP_IMMEDIATELY,
-			vfe31_ctrl->vfebase +
-			VFE_CAMIF_COMMAND);
-	}
-}
-
-static void vfe31_process_raw_snapshot_frame(uint32_t ping_pong)
-{
-	uint32_t pyaddr, pcbcraddr;
-	struct vfe31_free_buf *free_buf = NULL;
-	struct msm_sync* p_sync = (struct msm_sync *)vfe_syncdata;
-
-	if (p_sync->stereocam_enabled)
-		p_sync->stereo_state = STEREO_RAW_SNAP_STARTED;
-
-	/* Y channel- Main Image */
-	pyaddr = vfe31_get_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out1.ch0);
-	/* Chroma channel - Main Image */
-	pcbcraddr = vfe31_get_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out1.ch1);
-
-	free_buf = vfe31_get_free_buf(&vfe31_ctrl->outpath.out1);
-	CDBG("%s: snapshot raw, pyaddr = 0x%x, pcbcraddr = 0x%x\n",
-		__func__, pyaddr, pcbcraddr);
-	if (free_buf) {
-		/* Y channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out1.ch0,
-			free_buf->paddr + free_buf->planar0_off);
-		/* Chroma channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out1.ch1,
-			free_buf->paddr + free_buf->planar1_off);
-		kfree(free_buf);
-	}
-	 vfe_send_outmsg(MSG_ID_OUTPUT_S, pyaddr, pcbcraddr, 0);
-
-	/* in snapshot mode if done then send
-		snapshot done message */
-	if (vfe31_ctrl->vfe_capture_count == 0) {
-		vfe31_send_msg_no_payload(MSG_ID_SNAPSHOT_DONE);
-		/* Ensure the write order while writing
-		to the cmd register using barrier */
-		msm_camera_io_w_mb(CAMIF_COMMAND_STOP_IMMEDIATELY,
-			vfe31_ctrl->vfebase +
-			VFE_CAMIF_COMMAND);
-	}
-}
-static void vfe31_process_zsl_frame(uint32_t ping_pong)
-{
-	uint32_t p0_addr, p1_addr;
-	struct vfe31_free_buf *free_buf = NULL;
-	/* Y channel- Main Image */
-	p0_addr = vfe31_get_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out2.ch0);
-	/* Chroma channel - Main Image */
-	p1_addr = vfe31_get_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out2.ch1);
-
-	free_buf = vfe31_get_free_buf(&vfe31_ctrl->outpath.out2);
-	CDBG("%s: snapshot main, pyaddr = 0x%x, pcbcraddr = 0x%x\n",
-		__func__, p0_addr, p1_addr);
-	if (free_buf) {
-		/* Y channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out2.ch0,
-			free_buf->paddr + free_buf->planar0_off);
-		/* Chroma channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out2.ch1,
-			free_buf->paddr + free_buf->planar1_off);
-		kfree(free_buf);
-	}
-	 vfe_send_outmsg(MSG_ID_OUTPUT_S, p0_addr, p1_addr, p0_addr);
-
-	/* Y channel- TN Image */
-	p0_addr = vfe31_get_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out1.ch0);
-	/* Chroma channel - TN Image */
-	p1_addr = vfe31_get_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out1.ch1);
-
-	free_buf = vfe31_get_free_buf(&vfe31_ctrl->outpath.out1);
-	CDBG("%s: snapshot TN, pyaddr = 0x%x, pcbcraddr = 0x%x\n",
-		__func__, p0_addr, p1_addr);
-	if (free_buf) {
-		/* Y channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out1.ch0,
-			free_buf->paddr + free_buf->planar0_off);
-		/* Chroma channel */
-		vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out1.ch1,
-			free_buf->paddr + free_buf->planar1_off);
-		kfree(free_buf);
-	}
-
-	vfe_send_outmsg(MSG_ID_OUTPUT_T, p0_addr, p1_addr, p0_addr);
-}
-
-static void vfe31_process_output_path_irq_1(uint32_t ping_pong)
-{
-
-#ifdef CONFIG_MSM_CAMERA_V4L2
-	uint32_t pyaddr_ping, pcbcraddr_ping, pyaddr_pong, pcbcraddr_pong;
-#endif
-	CDBG("%s, operation_mode = %d, cap_cnt = %d\n", __func__,
-		vfe31_ctrl->operation_mode, vfe31_ctrl->vfe_capture_count);
-
-	/* In Snapshot mode */
-	if ((VFE_MODE_OF_OPERATION_SNAPSHOT == vfe31_ctrl->operation_mode)
-		&& ((vfe31_ctrl->vfe_capture_count <= 1)
-		|| (vfe31_free_buf_available(vfe31_ctrl->outpath.out0) &&
-		vfe31_free_buf_available(vfe31_ctrl->outpath.out1)))) {
-		vfe31_process_snapshot_frame(ping_pong);
-	} else if ((VFE_MODE_OF_OPERATION_RAW_SNAPSHOT ==
-		vfe31_ctrl->operation_mode) &&
-		((vfe31_ctrl->vfe_capture_count <= 1) ||
-		vfe31_free_buf_available(vfe31_ctrl->outpath.out1))) {
-		vfe31_process_raw_snapshot_frame(ping_pong);
-	} else if ((VFE_MODE_OF_OPERATION_ZSL == vfe31_ctrl->operation_mode)
-		&& (vfe31_free_buf_available(vfe31_ctrl->outpath.out1)
-		&& vfe31_free_buf_available(vfe31_ctrl->outpath.out2))) {
-		vfe31_process_zsl_frame(ping_pong);
-	} else {
-		vfe31_ctrl->outpath.out1.frame_drop_cnt++;
-		pr_info("path_irq_1 - no free buffer!\n");
-#ifdef CONFIG_MSM_CAMERA_V4L2
-		pr_info("Swapping ping and pong\n");
-
-		/*get addresses*/
-		/* Y channel */
-		pyaddr_ping = vfe31_get_ch_ping_addr(
-			vfe31_ctrl->outpath.out1.ch0);
-		/* Chroma channel */
-		pcbcraddr_ping = vfe31_get_ch_ping_addr(
-			vfe31_ctrl->outpath.out1.ch1);
-		/* Y channel */
-		pyaddr_pong = vfe31_get_ch_pong_addr(
-			vfe31_ctrl->outpath.out1.ch0);
-		/* Chroma channel */
-		pcbcraddr_pong = vfe31_get_ch_pong_addr(
-			vfe31_ctrl->outpath.out1.ch1);
-
-		CDBG("ping = 0x%p, pong = 0x%p\n", (void *)pyaddr_ping,
-			(void *)pyaddr_pong);
-		CDBG("ping_cbcr = 0x%p, pong_cbcr = 0x%p\n",
-			(void *)pcbcraddr_ping, (void *)pcbcraddr_pong);
-
-		/*put addresses*/
-		/* SWAP y channel*/
-		vfe31_put_ch_ping_addr(vfe31_ctrl->outpath.out1.ch0,
-			pyaddr_pong);
-		vfe31_put_ch_pong_addr(vfe31_ctrl->outpath.out1.ch0,
-			pyaddr_ping);
-		/* SWAP chroma channel*/
-		vfe31_put_ch_ping_addr(vfe31_ctrl->outpath.out1.ch1,
-			pcbcraddr_pong);
-		vfe31_put_ch_pong_addr(vfe31_ctrl->outpath.out1.ch1,
-			pcbcraddr_ping);
-		CDBG("after swap: ping = 0x%p, pong = 0x%p\n",
-			(void *)pyaddr_pong, (void *)pyaddr_ping);
-#endif
-	}
-
-}
-
-static void vfe31_process_output_path_irq_2(uint32_t ping_pong)
-{
-	uint32_t p0_addr, p1_addr, p2_addr;
-	struct vfe31_free_buf *free_buf = NULL;
-
-#ifdef CONFIG_MSM_CAMERA_V4L2
-	uint32_t pyaddr_ping, pcbcraddr_ping, pyaddr_pong, pcbcraddr_pong;
-#endif
-	/* we render frames in the following conditions:
-	1. Continuous mode and the free buffer is avaialable.
-	*/
-	CDBG("%s, operation_mode = %d, state %d\n", __func__,
-		vfe31_ctrl->operation_mode,
-		vfe31_ctrl->recording_state);
-	/* Ensure that both wm1 and wm5 ping and pong buffers are active*/
-	if (!(((ping_pong & 0x22) == 0x22) ||
-		((ping_pong & 0x22) == 0x0))) {
-		pr_err(" Irq_2 - skip the frame pp_status is not proper"
-			"PP_status = 0x%x\n", ping_pong);
-		return;
-	}
-	if ((vfe31_ctrl->recording_state == VFE_REC_STATE_STOP_REQUESTED)
-		|| (vfe31_ctrl->recording_state == VFE_REC_STATE_STOPPED)) {
-		vfe31_ctrl->outpath.out2.frame_drop_cnt++;
-		pr_warning("path_irq_2 - recording stopped\n");
-		return;
-	}
-
-	free_buf = vfe31_get_free_buf(&vfe31_ctrl->outpath.out2);
-
-	if (free_buf) {
-		/* Y channel */
-		p0_addr = vfe31_get_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out2.ch0);
-		/* Chroma channel */
-		p1_addr = vfe31_get_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out2.ch1);
-		p2_addr = p0_addr;
-		CDBG("video output, pyaddr = 0x%x, pcbcraddr = 0x%x\n",
-			p0_addr, p1_addr);
-
-		/* Y channel */
-		vfe31_put_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out2.ch0,
-		free_buf->paddr + free_buf->planar0_off);
-		/* Chroma channel */
-		vfe31_put_ch_addr(ping_pong,
-		vfe31_ctrl->outpath.out2.ch1,
-		free_buf->paddr + free_buf->planar1_off);
-		kfree(free_buf);
-		vfe_send_outmsg(MSG_ID_OUTPUT_V, p0_addr, p1_addr, p2_addr);
-	} else {
-		vfe31_ctrl->outpath.out2.frame_drop_cnt++;
-		pr_warning("path_irq_2 - no free buffer!\n");
-
-#ifdef CONFIG_MSM_CAMERA_V4L2
-		pr_info("Swapping ping and pong\n");
-
-		/*get addresses*/
-		/* Y channel */
-		pyaddr_ping = vfe31_get_ch_ping_addr(
-			vfe31_ctrl->outpath.out2.ch0);
-		/* Chroma channel */
-		pcbcraddr_ping = vfe31_get_ch_ping_addr(
-			vfe31_ctrl->outpath.out2.ch1);
-		/* Y channel */
-		pyaddr_pong = vfe31_get_ch_pong_addr(
-			vfe31_ctrl->outpath.out2.ch0);
-		/* Chroma channel */
-		pcbcraddr_pong = vfe31_get_ch_pong_addr(
-			vfe31_ctrl->outpath.out2.ch1);
-
-		CDBG("ping = 0x%p, pong = 0x%p\n", (void *)pyaddr_ping,
-			(void *)pyaddr_pong);
-		CDBG("ping_cbcr = 0x%p, pong_cbcr = 0x%p\n",
-			(void *)pcbcraddr_ping, (void *)pcbcraddr_pong);
-
-		/*put addresses*/
-		/* SWAP y channel*/
-		vfe31_put_ch_ping_addr(vfe31_ctrl->outpath.out2.ch0,
-			pyaddr_pong);
-		vfe31_put_ch_pong_addr(vfe31_ctrl->outpath.out2.ch0,
-			pyaddr_ping);
-		/* SWAP chroma channel*/
-		vfe31_put_ch_ping_addr(vfe31_ctrl->outpath.out2.ch1,
-			pcbcraddr_pong);
-		vfe31_put_ch_pong_addr(vfe31_ctrl->outpath.out2.ch1,
-			pcbcraddr_ping);
-		CDBG("after swap: ping = 0x%p, pong = 0x%p\n",
-			(void *)pyaddr_pong, (void *)pyaddr_ping);
-#endif
-	}
-}
-
-
-static uint32_t  vfe31_process_stats_irq_common(uint32_t statsNum,
-						uint32_t newAddr) {
-
-	uint32_t pingpongStatus;
-	uint32_t returnAddr;
-	uint32_t pingpongAddr;
-
-	/* must be 0=ping, 1=pong */
-	pingpongStatus =
-		((msm_camera_io_r(vfe31_ctrl->vfebase +
-		VFE_BUS_PING_PONG_STATUS))
-	& ((uint32_t)(1<<(statsNum + 7)))) >> (statsNum + 7);
-	/* stats bits starts at 7 */
-	CDBG("statsNum %d, pingpongStatus %d\n", statsNum, pingpongStatus);
-	pingpongAddr =
-		((uint32_t)(vfe31_ctrl->vfebase +
-				VFE_BUS_STATS_PING_PONG_BASE)) +
-				(3*statsNum)*4 + (1-pingpongStatus)*4;
-	returnAddr = msm_camera_io_r((uint32_t *)pingpongAddr);
-	msm_camera_io_w(newAddr, (uint32_t *)pingpongAddr);
-	return returnAddr;
-}
-
-static void vfe_send_stats_msg(void)
-{
-	struct  vfe_message msg;
-	uint32_t temp;
-
-	/* fill message with right content. */
-	msg._u.msgStats.frameCounter = vfe31_ctrl->vfeFrameId;
-	msg._u.msgStats.status_bits = vfe31_ctrl->status_bits;
-	msg._d = MSG_ID_COMMON;
-
-	msg._u.msgStats.buff.aec = vfe31_ctrl->aecStatsControl.bufToRender;
-	msg._u.msgStats.buff.awb = vfe31_ctrl->awbStatsControl.bufToRender;
-	msg._u.msgStats.buff.af = vfe31_ctrl->afStatsControl.bufToRender;
-
-	msg._u.msgStats.buff.ihist = vfe31_ctrl->ihistStatsControl.bufToRender;
-	msg._u.msgStats.buff.rs = vfe31_ctrl->rsStatsControl.bufToRender;
-	msg._u.msgStats.buff.cs = vfe31_ctrl->csStatsControl.bufToRender;
-
-	temp = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_STATS_AWB_SGW_CFG);
-	msg._u.msgStats.buff.awb_ymin = (0xFF00 & temp) >> 8;
-
-	vfe31_proc_ops(msg._d,
-		&msg, sizeof(struct vfe_message));
-	return;
-}
-
-static void vfe31_process_stats(void)
-{
-	int32_t process_stats = false;
-
-	CDBG("%s, stats = 0x%x\n", __func__, vfe31_ctrl->status_bits);
-
-	if (vfe31_ctrl->status_bits & VFE_IRQ_STATUS0_STATS_AEC) {
-		if (!vfe31_ctrl->aec_ack_pending) {
-			vfe31_ctrl->aec_ack_pending = TRUE;
-			vfe31_ctrl->aecStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(statsAeNum,
-				vfe31_ctrl->aecStatsControl.nextFrameAddrBuf);
-			process_stats = true;
-		} else{
-			vfe31_ctrl->aecStatsControl.bufToRender = 0;
-			vfe31_ctrl->aecStatsControl.droppedStatsFrameCount++;
-		}
-	} else {
-		vfe31_ctrl->aecStatsControl.bufToRender = 0;
-	}
-
-	if (vfe31_ctrl->status_bits & VFE_IRQ_STATUS0_STATS_AWB) {
-		if (!vfe31_ctrl->awb_ack_pending) {
-			vfe31_ctrl->awb_ack_pending = TRUE;
-			vfe31_ctrl->awbStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(statsAwbNum,
-				vfe31_ctrl->awbStatsControl.nextFrameAddrBuf);
-			process_stats = true;
-		} else{
-			vfe31_ctrl->awbStatsControl.droppedStatsFrameCount++;
-			vfe31_ctrl->awbStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe31_ctrl->awbStatsControl.bufToRender = 0;
-	}
-
-
-	if (vfe31_ctrl->status_bits & VFE_IRQ_STATUS0_STATS_AF) {
-		if (!vfe31_ctrl->af_ack_pending) {
-			vfe31_ctrl->af_ack_pending = TRUE;
-			vfe31_ctrl->afStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(statsAfNum,
-				vfe31_ctrl->afStatsControl.nextFrameAddrBuf);
-			process_stats = true;
-		} else {
-			vfe31_ctrl->afStatsControl.bufToRender = 0;
-			vfe31_ctrl->afStatsControl.droppedStatsFrameCount++;
-		}
-	} else {
-		vfe31_ctrl->afStatsControl.bufToRender = 0;
-	}
-
-	if (vfe31_ctrl->status_bits & VFE_IRQ_STATUS0_STATS_IHIST) {
-		if (!vfe31_ctrl->ihist_ack_pending) {
-			vfe31_ctrl->ihist_ack_pending = TRUE;
-			vfe31_ctrl->ihistStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(statsIhistNum,
-				vfe31_ctrl->ihistStatsControl.nextFrameAddrBuf);
-			process_stats = true;
-		} else {
-			vfe31_ctrl->ihistStatsControl.droppedStatsFrameCount++;
-			vfe31_ctrl->ihistStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe31_ctrl->ihistStatsControl.bufToRender = 0;
-	}
-
-	if (vfe31_ctrl->status_bits & VFE_IRQ_STATUS0_STATS_RS) {
-		if (!vfe31_ctrl->rs_ack_pending) {
-			vfe31_ctrl->rs_ack_pending = TRUE;
-			vfe31_ctrl->rsStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(statsRsNum,
-				vfe31_ctrl->rsStatsControl.nextFrameAddrBuf);
-			process_stats = true;
-		} else {
-			vfe31_ctrl->rsStatsControl.droppedStatsFrameCount++;
-			vfe31_ctrl->rsStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe31_ctrl->rsStatsControl.bufToRender = 0;
-	}
-
-
-	if (vfe31_ctrl->status_bits & VFE_IRQ_STATUS0_STATS_CS) {
-		if (!vfe31_ctrl->cs_ack_pending) {
-			vfe31_ctrl->cs_ack_pending = TRUE;
-			vfe31_ctrl->csStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(statsCsNum,
-				vfe31_ctrl->csStatsControl.nextFrameAddrBuf);
-			process_stats = true;
-		} else {
-			vfe31_ctrl->csStatsControl.droppedStatsFrameCount++;
-			vfe31_ctrl->csStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe31_ctrl->csStatsControl.bufToRender = 0;
-	}
-
-	if (process_stats)
-		vfe_send_stats_msg();
-
-	return;
-}
-
-static void vfe31_process_stats_irq(uint32_t *irqstatus)
-{
-	/* Subsample the stats according to the hfr speed*/
-	if ((vfe31_ctrl->hfr_mode != HFR_MODE_OFF) &&
-		(vfe31_ctrl->vfeFrameId % vfe31_ctrl->hfr_mode != 0)) {
-		CDBG("Skip the stats when HFR enabled\n");
-		return;
-	}
-
-	vfe31_ctrl->status_bits = VFE_COM_STATUS & *irqstatus;
-	vfe31_process_stats();
-	return;
-}
-
-static void vfe31_do_tasklet(unsigned long data)
-{
-	unsigned long flags;
-
-	struct vfe31_isr_queue_cmd *qcmd = NULL;
-
-	CDBG("=== vfe31_do_tasklet start === \n");
-
-	while (atomic_read(&irq_cnt)) {
-		spin_lock_irqsave(&vfe31_ctrl->tasklet_lock, flags);
-		qcmd = list_first_entry(&vfe31_ctrl->tasklet_q,
-			struct vfe31_isr_queue_cmd, list);
-		atomic_sub(1, &irq_cnt);
-
-		if (!qcmd) {
-			spin_unlock_irqrestore(&vfe31_ctrl->tasklet_lock,
-				flags);
-			return;
-		}
-
-		list_del(&qcmd->list);
-		spin_unlock_irqrestore(&vfe31_ctrl->tasklet_lock,
-			flags);
-
-		/* interrupt to be processed,  *qcmd has the payload.  */
-		if (qcmd->vfeInterruptStatus0 &
-			VFE_IRQ_STATUS0_REG_UPDATE_MASK) {
-			CDBG("irq regUpdateIrq\n");
-			vfe31_process_reg_update_irq();
-		}
-
-		if (qcmd->vfeInterruptStatus1 &
-			VFE_IMASK_RESET) {
-			CDBG("irq resetAckIrq\n");
-			vfe31_process_reset_irq();
-		}
-
-
-		if (qcmd->vfeInterruptStatus1 &
-			VFE_IMASK_AXI_HALT) {
-			CDBG("irq axi halt irq\n");
-			vfe31_process_axi_halt_irq();
-		}
-
-		if (atomic_read(&vfe31_ctrl->vstate)) {
-			if (qcmd->vfeInterruptStatus1 &
-					VFE31_IMASK_ERROR_ONLY_1) {
-				pr_err("irq	errorIrq\n");
-				vfe31_process_error_irq(
-					qcmd->vfeInterruptStatus1 &
-					VFE31_IMASK_ERROR_ONLY_1);
-			}
-
-			/* irqs below are only valid when in active state. */
-			/* next, check output path related interrupts. */
-			if (qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK) {
-				CDBG("Image composite done 0 irq occured.\n");
-				vfe31_process_output_path_irq_0(
-					qcmd->vfePingPongStatus);
-			}
-
-			if (qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK) {
-				CDBG("Image composite done 1 irq occured.\n");
-				vfe31_process_output_path_irq_1(
-					qcmd->vfePingPongStatus);
-			}
-
-			if (qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE2_MASK) {
-				CDBG("Image composite done 2 irq occured.\n");
-				vfe31_process_output_path_irq_2(
-					qcmd->vfePingPongStatus);
-			}
-
-			/* then process stats irq. */
-			if (vfe31_ctrl->stats_comp) {
-				/* process stats comb interrupt. */
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK) {
-					CDBG("Stats composite irq occured.\n");
-					vfe31_process_stats_irq(
-						&qcmd->vfeInterruptStatus0);
-				}
-			} else {
-				/* process individual stats interrupt. */
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_COM_STATUS) {
-					CDBG("VFE stats occured.\n");
-					vfe31_process_stats_irq(
-						&qcmd->vfeInterruptStatus0);
-				}
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_SYNC_TIMER0) {
-					CDBG("SYNC_TIMER 0 irq occured.\n");
-					vfe31_send_msg_no_payload(
-						MSG_ID_SYNC_TIMER0_DONE);
-				}
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_SYNC_TIMER1) {
-					CDBG("SYNC_TIMER 1 irq occured.\n");
-					vfe31_send_msg_no_payload(
-						MSG_ID_SYNC_TIMER1_DONE);
-				}
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_SYNC_TIMER2) {
-					CDBG("SYNC_TIMER 2 irq occured.\n");
-					vfe31_send_msg_no_payload(
-						MSG_ID_SYNC_TIMER2_DONE);
-				}
-			}
-		}
-		if (qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_CAMIF_SOF_MASK) {
-			CDBG("irq	camifSofIrq\n");
-			vfe31_process_camif_sof_irq();
-		}
-		kfree(qcmd);
-	}
-	CDBG("=== vfe31_do_tasklet end === \n");
-}
-
-DECLARE_TASKLET(vfe31_tasklet, vfe31_do_tasklet, 0);
-
-static irqreturn_t vfe31_parse_irq(int irq_num, void *data)
-{
-	unsigned long flags;
-	struct vfe31_irq_status irq;
-	struct vfe31_isr_queue_cmd *qcmd;
-	uint32_t *val;
-	CDBG("vfe_parse_irq\n");
-	memset(&irq, 0, sizeof(struct vfe31_irq_status));
-
-	val = (uint32_t *)(vfe31_ctrl->vfebase + VFE_IRQ_STATUS_0);
-	irq.vfeIrqStatus0 = msm_camera_io_r(val);
-
-	val = (uint32_t *)(vfe31_ctrl->vfebase + VFE_IRQ_STATUS_1);
-	irq.vfeIrqStatus1 = msm_camera_io_r(val);
-
-	if (irq.vfeIrqStatus1 & VFE_IMASK_AXI_HALT) {
-		msm_camera_io_w(VFE_IMASK_RESET,
-			vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-		msm_camera_io_w_mb(AXI_HALT_CLEAR,
-			vfe31_ctrl->vfebase + VFE_AXI_CMD);
-	}
-
-	val = (uint32_t *)(vfe31_ctrl->vfebase + VFE_CAMIF_STATUS);
-	irq.camifStatus = msm_camera_io_r(val);
-	CDBG("camifStatus  = 0x%x\n", irq.camifStatus);
-
-	val = (uint32_t *)(vfe31_ctrl->vfebase + VFE_BUS_PING_PONG_STATUS);
-	irq.vfePingPongStatus = msm_camera_io_r(val);
-
-	/* clear the pending interrupt of the same kind.*/
-	msm_camera_io_w(irq.vfeIrqStatus0,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(irq.vfeIrqStatus1,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_IRQ_CMD);
-
-	if ((irq.vfeIrqStatus0 == 0) && (irq.vfeIrqStatus1 == 0)) {
-		CDBG("vfe_parse_irq: vfeIrqStatus0 & 1 are both 0!\n");
-		return IRQ_HANDLED;
-	}
-
-	qcmd = kzalloc(sizeof(struct vfe31_isr_queue_cmd),
-		GFP_ATOMIC);
-	if (!qcmd) {
-		pr_err("vfe_parse_irq: qcmd malloc failed!\n");
-		return IRQ_HANDLED;
-	}
-
-	if (atomic_read(&vfe31_ctrl->stop_ack_pending)) {
-		irq.vfeIrqStatus0 &= VFE_IMASK_WHILE_STOPPING_0;
-		irq.vfeIrqStatus1 &= vfe31_ctrl->while_stopping_mask;
-	}
-
-	spin_lock_irqsave(&vfe31_ctrl->xbar_lock, flags);
-	if ((irq.vfeIrqStatus0 &
-		VFE_IRQ_STATUS0_CAMIF_EOF_MASK) &&
-		vfe31_ctrl->xbar_update_pending) {
-		CDBG("irq camifEofIrq\n");
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_XBAR_CFG_OFF,
-			(void *)vfe31_ctrl->xbar_cfg, V31_XBAR_CFG_LEN);
-		vfe31_ctrl->xbar_update_pending = 0;
-	}
-	spin_unlock_irqrestore(&vfe31_ctrl->xbar_lock, flags);
-	CDBG("vfe_parse_irq: Irq_status0 = 0x%x, Irq_status1 = 0x%x.\n",
-		irq.vfeIrqStatus0, irq.vfeIrqStatus1);
-
-	qcmd->vfeInterruptStatus0 = irq.vfeIrqStatus0;
-	qcmd->vfeInterruptStatus1 = irq.vfeIrqStatus1;
-	qcmd->vfePingPongStatus = irq.vfePingPongStatus;
-
-	spin_lock_irqsave(&vfe31_ctrl->tasklet_lock, flags);
-	list_add_tail(&qcmd->list, &vfe31_ctrl->tasklet_q);
-
-	atomic_add(1, &irq_cnt);
-	spin_unlock_irqrestore(&vfe31_ctrl->tasklet_lock, flags);
-	tasklet_schedule(&vfe31_tasklet);
-	return IRQ_HANDLED;
-}
-
-static void vfe31_release(struct platform_device *pdev)
-{
-	struct resource	*vfemem, *vfeio;
-
-	vfe31_reset_free_buf_queue_all();
-	CDBG("%s, free_irq\n", __func__);
-	free_irq(vfe31_ctrl->vfeirq, 0);
-	tasklet_kill(&vfe31_tasklet);
-
-	if (atomic_read(&irq_cnt))
-		pr_warning("%s, Warning IRQ Count not ZERO\n", __func__);
-
-	vfemem = vfe31_ctrl->vfemem;
-	vfeio  = vfe31_ctrl->vfeio;
-
-	msm_vpe_release();
-
-	kfree(vfe31_ctrl->extdata);
-	iounmap(vfe31_ctrl->vfebase);
-	kfree(vfe31_ctrl);
-	vfe31_ctrl = NULL;
-	release_mem_region(vfemem->start, (vfemem->end - vfemem->start) + 1);
-	CDBG("%s, msm_camio_disable\n", __func__);
-	msm_camio_disable(pdev);
-	msm_camio_set_perf_lvl(S_EXIT);
-
-	vfe_syncdata = NULL;
-}
-
-static int vfe31_resource_init(struct msm_vfe_callback *presp,
-	struct platform_device *pdev, void *sdata)
-{
-	struct resource	*vfemem, *vfeirq, *vfeio;
-	int rc;
-	struct msm_camera_sensor_info *s_info;
-	s_info = pdev->dev.platform_data;
-
-	pdev->resource = s_info->resource;
-	pdev->num_resources = s_info->num_resources;
-
-	vfemem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!vfemem) {
-		pr_err("%s: no mem resource?\n", __func__);
-		return -ENODEV;
-	}
-
-	vfeirq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!vfeirq) {
-		pr_err("%s: no irq resource?\n", __func__);
-		return -ENODEV;
-	}
-
-	vfeio = request_mem_region(vfemem->start,
-		resource_size(vfemem), pdev->name);
-	if (!vfeio) {
-		pr_err("%s: VFE region already claimed\n", __func__);
-		return -EBUSY;
-	}
-
-	vfe31_ctrl = kzalloc(sizeof(struct vfe31_ctrl_type), GFP_KERNEL);
-	if (!vfe31_ctrl) {
-		rc = -ENOMEM;
-		goto cmd_init_failed1;
-	}
-
-	vfe31_ctrl->vfeirq = vfeirq->start;
-
-	vfe31_ctrl->vfebase =
-		ioremap(vfemem->start, (vfemem->end - vfemem->start) + 1);
-	if (!vfe31_ctrl->vfebase) {
-		rc = -ENOMEM;
-		pr_err("%s: vfe ioremap failed\n", __func__);
-		goto cmd_init_failed2;
-	}
-
-	if (presp && presp->vfe_resp)
-		vfe31_ctrl->resp = presp;
-	else {
-		rc = -EINVAL;
-		goto cmd_init_failed3;
-	}
-
-	vfe31_ctrl->extdata =
-		kmalloc(sizeof(struct vfe31_frame_extra), GFP_KERNEL);
-	if (!vfe31_ctrl->extdata) {
-		rc = -ENOMEM;
-		goto cmd_init_failed3;
-	}
-
-	vfe31_ctrl->extlen = sizeof(struct vfe31_frame_extra);
-
-	spin_lock_init(&vfe31_ctrl->io_lock);
-	spin_lock_init(&vfe31_ctrl->update_ack_lock);
-	spin_lock_init(&vfe31_ctrl->tasklet_lock);
-	spin_lock_init(&vfe31_ctrl->xbar_lock);
-
-	INIT_LIST_HEAD(&vfe31_ctrl->tasklet_q);
-	vfe31_init_free_buf_queue();
-
-	vfe31_ctrl->syncdata = sdata;
-	vfe31_ctrl->vfemem = vfemem;
-	vfe31_ctrl->vfeio  = vfeio;
-	vfe31_ctrl->update_gamma = false;
-	vfe31_ctrl->update_luma = false;
-	vfe31_ctrl->s_info = s_info;
-	vfe31_ctrl->stats_comp = 0;
-	vfe31_ctrl->hfr_mode = HFR_MODE_OFF;
-	return 0;
-
-cmd_init_failed3:
-	free_irq(vfe31_ctrl->vfeirq, 0);
-	iounmap(vfe31_ctrl->vfebase);
-cmd_init_failed2:
-	kfree(vfe31_ctrl);
-cmd_init_failed1:
-	release_mem_region(vfemem->start, (vfemem->end - vfemem->start) + 1);
-	return rc;
-}
-
-static int vfe31_init(struct msm_vfe_callback *presp,
-	struct platform_device *pdev)
-{
-	int rc = 0;
-	struct msm_camera_sensor_info *sinfo = pdev->dev.platform_data;
-	struct msm_camera_device_platform_data *camdev = sinfo->pdata;
-
-	camio_clk = camdev->ioclk;
-
-	rc = vfe31_resource_init(presp, pdev, vfe_syncdata);
-	if (rc < 0)
-		return rc;
-	/* Bring up all the required GPIOs and Clocks */
-	rc = msm_camio_enable(pdev);
-	msm_camio_set_perf_lvl(S_INIT);
-	if (msm_vpe_open() < 0)
-		CDBG("%s: vpe_open failed\n", __func__);
-
-	/* TO DO: Need to release the VFE resources */
-	rc = request_irq(vfe31_ctrl->vfeirq, vfe31_parse_irq,
-			IRQF_TRIGGER_RISING, "vfe", 0);
-
-	return rc;
-}
-
-void msm_camvfe_fn_init(struct msm_camvfe_fn *fptr, void *data)
-{
-	fptr->vfe_init    = vfe31_init;
-	fptr->vfe_enable  = vfe31_enable;
-	fptr->vfe_config  = vfe31_config;
-	fptr->vfe_disable = vfe31_disable;
-	fptr->vfe_release = vfe31_release;
-	fptr->vfe_stop = vfe31_stop;
-	vfe_syncdata = data;
-}
-
-void msm_camvpe_fn_init(struct msm_camvpe_fn *fptr, void *data)
-{
-	fptr->vpe_reg		= msm_vpe_reg;
-	fptr->send_frame_to_vpe	= msm_send_frame_to_vpe;
-	fptr->vpe_config	= msm_vpe_config;
-	fptr->vpe_cfg_update	= msm_vpe_cfg_update;
-	fptr->dis		= &(vpe_ctrl->dis_en);
-	fptr->vpe_cfg_offset = msm_vpe_offset_update;
-	vpe_ctrl->syncdata = data;
-}
diff --git a/drivers/media/video/msm/vfe/msm_vfe31.h b/drivers/media/video/msm/vfe/msm_vfe31.h
deleted file mode 100644
index 4e1a8d4..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe31.h
+++ /dev/null
@@ -1,1119 +0,0 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MSM_VFE31_H__
-#define __MSM_VFE31_H__
-
-#define TRUE  1
-#define FALSE 0
-
-/* at start of camif,  bit 1:0 = 0x01:enable
- * image data capture at frame boundary. */
-#define CAMIF_COMMAND_START  0x00000005
-
-/* bit 2= 0x1:clear the CAMIF_STATUS register
- * value. */
-#define CAMIF_COMMAND_CLEAR  0x00000004
-
-/* at stop of vfe pipeline, for now it is assumed
- * that camif will stop at any time. Bit 1:0 = 0x10:
- * disable image data capture immediately. */
-#define CAMIF_COMMAND_STOP_IMMEDIATELY  0x00000002
-
-/* at stop of vfe pipeline, for now it is assumed
- * that camif will stop at any time. Bit 1:0 = 0x00:
- * disable image data capture at frame boundary */
-#define CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY  0x00000000
-
-/* to halt axi bridge */
-#define AXI_HALT  0x00000001
-
-/* clear the halt bit. */
-#define AXI_HALT_CLEAR  0x00000000
-
-/* clear axi_halt_irq */
-#define MASK_AXI_HALT_IRQ	0xFF7FFFFF
-
-/* reset the pipeline when stop command is issued.
- * (without reset the register.) bit 26-31 = 0,
- * domain reset, bit 0-9 = 1 for module reset, except
- * register module. */
-#define VFE_RESET_UPON_STOP_CMD  0x000003ef
-
-/* reset the pipeline when reset command.
- * bit 26-31 = 0, domain reset, bit 0-9 = 1 for module reset. */
-#define VFE_RESET_UPON_RESET_CMD  0x000003ff
-
-/* bit 5 is for axi status idle or busy.
- * 1 =  halted,  0 = busy */
-#define AXI_STATUS_BUSY_MASK 0x00000020
-
-/* bit 0 & bit 1 = 1, both y and cbcr irqs need to be present
- * for frame done interrupt */
-#define VFE_COMP_IRQ_BOTH_Y_CBCR 3
-
-/* bit 1 = 1, only cbcr irq triggers frame done interrupt */
-#define VFE_COMP_IRQ_CBCR_ONLY 2
-
-/* bit 0 = 1, only y irq triggers frame done interrupt */
-#define VFE_COMP_IRQ_Y_ONLY 1
-
-/* bit 0 = 1, PM go;   bit1 = 1, PM stop */
-#define VFE_PERFORMANCE_MONITOR_GO   0x00000001
-#define VFE_PERFORMANCE_MONITOR_STOP 0x00000002
-
-/* bit 0 = 1, test gen go;   bit1 = 1, test gen stop */
-#define VFE_TEST_GEN_GO   0x00000001
-#define VFE_TEST_GEN_STOP 0x00000002
-
-/* the chroma is assumed to be interpolated between
- * the luma samples.  JPEG 4:2:2 */
-#define VFE_CHROMA_UPSAMPLE_INTERPOLATED 0
-
-/* constants for irq registers */
-#define VFE_DISABLE_ALL_IRQS 0
-/* bit =1 is to clear the corresponding bit in VFE_IRQ_STATUS.  */
-#define VFE_CLEAR_ALL_IRQS   0xffffffff
-
-#define VFE_IRQ_STATUS0_CAMIF_SOF_MASK            0x00000001
-#define VFE_IRQ_STATUS0_CAMIF_EOF_MASK            0x00000004
-#define VFE_IRQ_STATUS0_REG_UPDATE_MASK           0x00000020
-#define VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK 0x00200000
-#define VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK 0x00400000
-#define VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE2_MASK 0x00800000
-#define VFE_IRQ_STATUS1_RESET_AXI_HALT_ACK_MASK   0x00800000
-#define VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK       0x01000000
-
-#define VFE_IRQ_STATUS0_STATS_AEC     0x2000  /* bit 13 */
-#define VFE_IRQ_STATUS0_STATS_AF      0x4000  /* bit 14 */
-#define VFE_IRQ_STATUS0_STATS_AWB     0x8000  /* bit 15 */
-#define VFE_IRQ_STATUS0_STATS_RS      0x10000  /* bit 16 */
-#define VFE_IRQ_STATUS0_STATS_CS      0x20000  /* bit 17 */
-#define VFE_IRQ_STATUS0_STATS_IHIST   0x40000  /* bit 18 */
-
-#define VFE_IRQ_STATUS0_SYNC_TIMER0   0x2000000  /* bit 25 */
-#define VFE_IRQ_STATUS0_SYNC_TIMER1   0x4000000  /* bit 26 */
-#define VFE_IRQ_STATUS0_SYNC_TIMER2   0x8000000  /* bit 27 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER0  0x10000000  /* bit 28 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER1  0x20000000  /* bit 29 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER2  0x40000000  /* bit 30 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER3  0x80000000  /* bit 31 */
-
-/* imask for while waiting for stop ack,  driver has already
- * requested stop, waiting for reset irq, and async timer irq.
- * For irq_status_0, bit 28-31 are for async timer. For
- * irq_status_1, bit 22 for reset irq, bit 23 for axi_halt_ack
-   irq */
-#define VFE_IMASK_WHILE_STOPPING_0  0xF0000000
-#define VFE_IMASK_WHILE_STOPPING_1  0x00C00000
-#define VFE_IMASK_RESET             0x00400000
-#define VFE_IMASK_AXI_HALT          0x00800000
-
-
-/* no error irq in mask 0 */
-#define VFE_IMASK_ERROR_ONLY_0  0x0
-/* when normal case, don't want to block error status. */
-/* bit 0-21 are error irq bits */
-#define VFE_IMASK_ERROR_ONLY_1  0x003fffff
-
-/* For BPC bit 0,bit 12-17 and bit 26 -20 are set to zero and other's 1 */
-#define BPC_MASK 0xF80C0FFE
-
-/* For BPC bit 1 and 2 are set to zero and other's 1 */
-#define ABF_MASK 0xFFFFFFF9
-
-/* For MCE enable bit 28 set to zero and other's 1 */
-#define MCE_EN_MASK 0xEFFFFFFF
-
-/* For MCE Q_K bit 28 to 31 set to zero and other's 1 */
-#define MCE_Q_K_MASK 0x0FFFFFFF
-
-#define AWB_ENABLE_MASK 0x00000080     /* bit 7 */
-#define AF_ENABLE_MASK 0x00000040      /* bit 6 */
-#define AE_ENABLE_MASK 0x00000020      /* bit 5 */
-#define IHIST_ENABLE_MASK 0x00008000   /* bit 15 */
-#define RS_ENABLE_MASK 0x00000100      /* bit 8  */
-#define CS_ENABLE_MASK 0x00000200      /* bit 9  */
-#define RS_CS_ENABLE_MASK 0x00000300   /* bit 8,9  */
-#define STATS_ENABLE_MASK 0x000483E0   /* bit 18,15,9,8,7,6,5*/
-
-#define VFE_REG_UPDATE_TRIGGER           1
-#define VFE_PM_BUF_MAX_CNT_MASK          0xFF
-#define VFE_DMI_CFG_DEFAULT              0x00000100
-#define LENS_ROLL_OFF_DELTA_TABLE_OFFSET 32
-#define VFE_AE_PINGPONG_STATUS_BIT       0x80
-#define VFE_AF_PINGPONG_STATUS_BIT       0x100
-#define VFE_AWB_PINGPONG_STATUS_BIT      0x200
-#define PINGPONG_LOWER                   0x7
-
-#define HFR_MODE_OFF 1
-
-enum VFE31_DMI_RAM_SEL {
-	 NO_MEM_SELECTED          = 0,
-	 ROLLOFF_RAM              = 0x1,
-	 RGBLUT_RAM_CH0_BANK0     = 0x2,
-	 RGBLUT_RAM_CH0_BANK1     = 0x3,
-	 RGBLUT_RAM_CH1_BANK0     = 0x4,
-	 RGBLUT_RAM_CH1_BANK1     = 0x5,
-	 RGBLUT_RAM_CH2_BANK0     = 0x6,
-	 RGBLUT_RAM_CH2_BANK1     = 0x7,
-	 STATS_HIST_RAM           = 0x8,
-	 RGBLUT_CHX_BANK0         = 0x9,
-	 RGBLUT_CHX_BANK1         = 0xa,
-	 LUMA_ADAPT_LUT_RAM_BANK0 = 0xb,
-	 LUMA_ADAPT_LUT_RAM_BANK1 = 0xc
-};
-
-enum  VFE_STATE {
-	VFE_STATE_IDLE,
-	VFE_STATE_ACTIVE
-};
-
-enum  vfe_recording_state {
-	VFE_REC_STATE_IDLE,
-	VFE_REC_STATE_START_REQUESTED,
-	VFE_REC_STATE_STARTED,
-	VFE_REC_STATE_STOP_REQUESTED,
-	VFE_REC_STATE_STOPPED,
-};
-
-#define V31_DUMMY_0               0
-#define V31_SET_CLK               1
-#define V31_RESET                 2
-#define V31_START                 3
-#define V31_TEST_GEN_START        4
-#define V31_OPERATION_CFG         5
-#define V31_AXI_OUT_CFG           6
-#define V31_CAMIF_CFG             7
-#define V31_AXI_INPUT_CFG         8
-#define V31_BLACK_LEVEL_CFG       9
-#define V31_ROLL_OFF_CFG          10
-#define V31_DEMUX_CFG             11
-#define V31_DEMOSAIC_0_CFG        12 /* general */
-#define V31_DEMOSAIC_1_CFG        13 /* ABF     */
-#define V31_DEMOSAIC_2_CFG        14 /* BPC     */
-#define V31_FOV_CFG               15
-#define V31_MAIN_SCALER_CFG       16
-#define V31_WB_CFG                17
-#define V31_COLOR_COR_CFG         18
-#define V31_RGB_G_CFG             19
-#define V31_LA_CFG                20
-#define V31_CHROMA_EN_CFG         21
-#define V31_CHROMA_SUP_CFG        22
-#define V31_MCE_CFG               23
-#define V31_SK_ENHAN_CFG          24
-#define V31_ASF_CFG               25
-#define V31_S2Y_CFG               26
-#define V31_S2CbCr_CFG            27
-#define V31_CHROMA_SUBS_CFG       28
-#define V31_OUT_CLAMP_CFG         29
-#define V31_FRAME_SKIP_CFG        30
-#define V31_DUMMY_1               31
-#define V31_DUMMY_2               32
-#define V31_DUMMY_3               33
-#define V31_UPDATE                34
-#define V31_BL_LVL_UPDATE         35
-#define V31_DEMUX_UPDATE          36
-#define V31_DEMOSAIC_1_UPDATE     37 /* BPC */
-#define V31_DEMOSAIC_2_UPDATE     38 /* ABF */
-#define V31_FOV_UPDATE            39
-#define V31_MAIN_SCALER_UPDATE    40
-#define V31_WB_UPDATE             41
-#define V31_COLOR_COR_UPDATE      42
-#define V31_RGB_G_UPDATE          43
-#define V31_LA_UPDATE             44
-#define V31_CHROMA_EN_UPDATE      45
-#define V31_CHROMA_SUP_UPDATE     46
-#define V31_MCE_UPDATE            47
-#define V31_SK_ENHAN_UPDATE       48
-#define V31_S2CbCr_UPDATE         49
-#define V31_S2Y_UPDATE            50
-#define V31_ASF_UPDATE            51
-#define V31_FRAME_SKIP_UPDATE     52
-#define V31_CAMIF_FRAME_UPDATE    53
-#define V31_STATS_AF_UPDATE       54
-#define V31_STATS_AE_UPDATE       55
-#define V31_STATS_AWB_UPDATE      56
-#define V31_STATS_RS_UPDATE       57
-#define V31_STATS_CS_UPDATE       58
-#define V31_STATS_SKIN_UPDATE     59
-#define V31_STATS_IHIST_UPDATE    60
-#define V31_DUMMY_4               61
-#define V31_EPOCH1_ACK            62
-#define V31_EPOCH2_ACK            63
-#define V31_START_RECORDING       64
-#define V31_STOP_RECORDING        65
-#define V31_DUMMY_5               66
-#define V31_DUMMY_6               67
-#define V31_CAPTURE               68
-#define V31_DUMMY_7               69
-#define V31_STOP                  70
-#define V31_GET_HW_VERSION        71
-#define V31_GET_FRAME_SKIP_COUNTS 72
-#define V31_OUTPUT1_BUFFER_ENQ    73
-#define V31_OUTPUT2_BUFFER_ENQ    74
-#define V31_OUTPUT3_BUFFER_ENQ    75
-#define V31_JPEG_OUT_BUF_ENQ      76
-#define V31_RAW_OUT_BUF_ENQ       77
-#define V31_RAW_IN_BUF_ENQ        78
-#define V31_STATS_AF_ENQ          79
-#define V31_STATS_AE_ENQ          80
-#define V31_STATS_AWB_ENQ         81
-#define V31_STATS_RS_ENQ          82
-#define V31_STATS_CS_ENQ          83
-#define V31_STATS_SKIN_ENQ        84
-#define V31_STATS_IHIST_ENQ       85
-#define V31_DUMMY_8               86
-#define V31_JPEG_ENC_CFG          87
-#define V31_DUMMY_9               88
-#define V31_STATS_AF_START        89
-#define V31_STATS_AF_STOP         90
-#define V31_STATS_AE_START        91
-#define V31_STATS_AE_STOP         92
-#define V31_STATS_AWB_START       93
-#define V31_STATS_AWB_STOP        94
-#define V31_STATS_RS_START        95
-#define V31_STATS_RS_STOP         96
-#define V31_STATS_CS_START        97
-#define V31_STATS_CS_STOP         98
-#define V31_STATS_SKIN_START      99
-#define V31_STATS_SKIN_STOP       100
-#define V31_STATS_IHIST_START     101
-#define V31_STATS_IHIST_STOP      102
-#define V31_DUMMY_10              103
-#define V31_SYNC_TIMER_SETTING    104
-#define V31_ASYNC_TIMER_SETTING   105
-#define V31_LIVESHOT              106
-#define V31_ZSL                   107
-#define V31_STEREOCAM             108
-#define V31_LA_SETUP              109
-#define V31_XBAR_CFG              110
-#define V31_EZTUNE_CFG            111
-
-#define V31_CAMIF_OFF             0x000001E4
-#define V31_CAMIF_LEN             32
-
-#define V31_DEMUX_OFF             0x00000284
-#define V31_DEMUX_LEN             20
-
-#define V31_DEMOSAIC_0_OFF        0x00000298
-#define V31_DEMOSAIC_0_LEN        4
-/* ABF     */
-#define V31_DEMOSAIC_1_OFF        0x000002A4
-#define V31_DEMOSAIC_1_LEN        180
-/* BPC     */
-#define V31_DEMOSAIC_2_OFF        0x0000029C
-#define V31_DEMOSAIC_2_LEN        8
-
-/* gamma VFE_LUT_BANK_SEL*/
-#define V31_GAMMA_CFG_OFF         0x000003BC
-#define V31_LUMA_CFG_OFF          0x000003C0
-
-#define V31_OUT_CLAMP_OFF         0x00000524
-#define V31_OUT_CLAMP_LEN         8
-
-#define V31_OPERATION_CFG_LEN     32
-
-#define V31_AXI_OUT_OFF           0x00000038
-#define V31_AXI_OUT_LEN           220
-#define V31_AXI_CH_INF_LEN        32
-#define V31_AXI_CFG_LEN           47
-
-#define V31_FRAME_SKIP_OFF        0x00000504
-#define V31_FRAME_SKIP_LEN        32
-
-#define V31_CHROMA_SUBS_OFF       0x000004F8
-#define V31_CHROMA_SUBS_LEN       12
-
-#define V31_FOV_OFF           0x00000360
-#define V31_FOV_LEN           8
-
-#define V31_MAIN_SCALER_OFF 0x00000368
-#define V31_MAIN_SCALER_LEN 28
-
-#define V31_S2Y_OFF 0x000004D0
-#define V31_S2Y_LEN 20
-
-#define V31_S2CbCr_OFF 0x000004E4
-#define V31_S2CbCr_LEN 20
-
-#define V31_CHROMA_EN_OFF 0x000003C4
-#define V31_CHROMA_EN_LEN 36
-
-#define V31_SYNC_TIMER_OFF      0x0000020C
-#define V31_SYNC_TIMER_POLARITY_OFF 0x00000234
-#define V31_TIMER_SELECT_OFF        0x0000025C
-#define V31_SYNC_TIMER_LEN 28
-
-#define V31_ASYNC_TIMER_OFF 0x00000238
-#define V31_ASYNC_TIMER_LEN 28
-
-#define V31_BLACK_LEVEL_OFF 0x00000264
-#define V31_BLACK_LEVEL_LEN 16
-
-#define V31_ROLL_OFF_CFG_OFF 0x00000274
-#define V31_ROLL_OFF_CFG_LEN 16
-
-#define V31_COLOR_COR_OFF 0x00000388
-#define V31_COLOR_COR_LEN 52
-
-#define V31_WB_OFF 0x00000384
-#define V31_WB_LEN 4
-
-#define V31_RGB_G_OFF 0x000003BC
-#define V31_RGB_G_LEN 4
-
-#define V31_LA_OFF 0x000003C0
-#define V31_LA_LEN 4
-
-#define V31_SCE_OFF 0x00000418
-#define V31_SCE_LEN 136
-
-#define V31_CHROMA_SUP_OFF 0x000003E8
-#define V31_CHROMA_SUP_LEN 12
-
-#define V31_MCE_OFF 0x000003F4
-#define V31_MCE_LEN 36
-#define V31_STATS_AF_OFF 0x0000053c
-#define V31_STATS_AF_LEN 16
-
-#define V31_STATS_AE_OFF 0x00000534
-#define V31_STATS_AE_LEN 8
-
-#define V31_STATS_AWB_OFF 0x0000054c
-#define V31_STATS_AWB_LEN 32
-
-#define V31_STATS_IHIST_OFF 0x0000057c
-#define V31_STATS_IHIST_LEN 8
-
-#define V31_STATS_RS_OFF 0x0000056c
-#define V31_STATS_RS_LEN 8
-
-#define V31_STATS_CS_OFF 0x00000574
-#define V31_STATS_CS_LEN 8
-
-#define V31_XBAR_CFG_OFF 0x00000040
-#define V31_XBAR_CFG_LEN 8
-
-#define V31_EZTUNE_CFG_OFF 0x00000010
-#define V31_EZTUNE_CFG_LEN 4
-
-#define V31_ASF_OFF 0x000004A0
-#define V31_ASF_LEN 48
-#define V31_ASF_UPDATE_LEN 36
-
-#define V31_CAPTURE_LEN 4
-
-struct vfe_cmd_hw_version {
-	uint32_t minorVersion;
-	uint32_t majorVersion;
-	uint32_t coreVersion;
-};
-
-enum VFE_AXI_OUTPUT_MODE {
-	VFE_AXI_OUTPUT_MODE_Output1,
-	VFE_AXI_OUTPUT_MODE_Output2,
-	VFE_AXI_OUTPUT_MODE_Output1AndOutput2,
-	VFE_AXI_OUTPUT_MODE_CAMIFToAXIViaOutput2,
-	VFE_AXI_OUTPUT_MODE_Output2AndCAMIFToAXIViaOutput1,
-	VFE_AXI_OUTPUT_MODE_Output1AndCAMIFToAXIViaOutput2,
-	VFE_AXI_LAST_OUTPUT_MODE_ENUM
-};
-
-enum VFE_RAW_WR_PATH_SEL {
-	VFE_RAW_OUTPUT_DISABLED,
-	VFE_RAW_OUTPUT_ENC_CBCR_PATH,
-	VFE_RAW_OUTPUT_VIEW_CBCR_PATH,
-	VFE_RAW_OUTPUT_PATH_INVALID
-};
-
-
-#define VFE_AXI_OUTPUT_BURST_LENGTH     4
-#define VFE_MAX_NUM_FRAGMENTS_PER_FRAME 4
-#define VFE_AXI_OUTPUT_CFG_FRAME_COUNT  3
-
-struct vfe_cmds_per_write_master {
-	uint16_t imageWidth;
-	uint16_t imageHeight;
-	uint16_t outRowCount;
-	uint16_t outRowIncrement;
-	uint32_t outFragments[VFE_AXI_OUTPUT_CFG_FRAME_COUNT]
-		[VFE_MAX_NUM_FRAGMENTS_PER_FRAME];
-};
-
-struct vfe_cmds_axi_per_output_path {
-	uint8_t fragmentCount;
-	struct vfe_cmds_per_write_master firstWM;
-	struct vfe_cmds_per_write_master secondWM;
-};
-
-enum VFE_AXI_BURST_LENGTH {
-	VFE_AXI_BURST_LENGTH_IS_2  = 2,
-	VFE_AXI_BURST_LENGTH_IS_4  = 4,
-	VFE_AXI_BURST_LENGTH_IS_8  = 8,
-	VFE_AXI_BURST_LENGTH_IS_16 = 16
-};
-
-
-struct vfe_cmd_fov_crop_config {
-	uint8_t enable;
-	uint16_t firstPixel;
-	uint16_t lastPixel;
-	uint16_t firstLine;
-	uint16_t lastLine;
-};
-
-struct vfe_cmds_main_scaler_stripe_init {
-	uint16_t MNCounterInit;
-	uint16_t phaseInit;
-};
-
-struct vfe_cmds_scaler_one_dimension {
-	uint8_t  enable;
-	uint16_t inputSize;
-	uint16_t outputSize;
-	uint32_t phaseMultiplicationFactor;
-	uint8_t  interpolationResolution;
-};
-
-struct vfe_cmd_main_scaler_config {
-	uint8_t enable;
-	struct vfe_cmds_scaler_one_dimension    hconfig;
-	struct vfe_cmds_scaler_one_dimension    vconfig;
-	struct vfe_cmds_main_scaler_stripe_init MNInitH;
-	struct vfe_cmds_main_scaler_stripe_init MNInitV;
-};
-
-struct vfe_cmd_scaler2_config {
-	uint8_t enable;
-	struct vfe_cmds_scaler_one_dimension hconfig;
-	struct vfe_cmds_scaler_one_dimension vconfig;
-};
-
-
-struct vfe_cmd_frame_skip_update {
-	uint32_t output1Pattern;
-	uint32_t output2Pattern;
-};
-
-struct vfe_cmd_output_clamp_config {
-	uint8_t minCh0;
-	uint8_t minCh1;
-	uint8_t minCh2;
-	uint8_t maxCh0;
-	uint8_t maxCh1;
-	uint8_t maxCh2;
-};
-
-struct vfe_cmd_chroma_subsample_config {
-	uint8_t enable;
-	uint8_t cropEnable;
-	uint8_t vsubSampleEnable;
-	uint8_t hsubSampleEnable;
-	uint8_t vCosited;
-	uint8_t hCosited;
-	uint8_t vCositedPhase;
-	uint8_t hCositedPhase;
-	uint16_t cropWidthFirstPixel;
-	uint16_t cropWidthLastPixel;
-	uint16_t cropHeightFirstLine;
-	uint16_t cropHeightLastLine;
-};
-
-enum VFE_START_INPUT_SOURCE {
-	VFE_START_INPUT_SOURCE_CAMIF,
-	VFE_START_INPUT_SOURCE_TESTGEN,
-	VFE_START_INPUT_SOURCE_AXI,
-	VFE_START_INPUT_SOURCE_INVALID
-};
-
-enum VFE_START_PIXEL_PATTERN {
-	VFE_BAYER_RGRGRG,
-	VFE_BAYER_GRGRGR,
-	VFE_BAYER_BGBGBG,
-	VFE_BAYER_GBGBGB,
-	VFE_YUV_YCbYCr,
-	VFE_YUV_YCrYCb,
-	VFE_YUV_CbYCrY,
-	VFE_YUV_CrYCbY
-};
-
-enum VFE_BUS_RD_INPUT_PIXEL_PATTERN {
-	VFE_BAYER_RAW,
-	VFE_YUV_INTERLEAVED,
-	VFE_YUV_PSEUDO_PLANAR_Y,
-	VFE_YUV_PSEUDO_PLANAR_CBCR
-};
-
-enum VFE_YUV_INPUT_COSITING_MODE {
-	VFE_YUV_COSITED,
-	VFE_YUV_INTERPOLATED
-};
-
-
-/* 13*1  */
-#define VFE31_ROLL_OFF_INIT_TABLE_SIZE  13
-/* 13*16 */
-#define VFE31_ROLL_OFF_DELTA_TABLE_SIZE 208
-
-#define VFE31_GAMMA_NUM_ENTRIES  64
-
-#define VFE31_LA_TABLE_LENGTH    64
-
-#define VFE31_HIST_TABLE_LENGTH  256
-
-struct vfe_cmds_demosaic_abf {
-	uint8_t   enable;
-	uint8_t   forceOn;
-	uint8_t   shift;
-	uint16_t  lpThreshold;
-	uint16_t  max;
-	uint16_t  min;
-	uint8_t   ratio;
-};
-
-struct vfe_cmds_demosaic_bpc {
-	uint8_t   enable;
-	uint16_t  fmaxThreshold;
-	uint16_t  fminThreshold;
-	uint16_t  redDiffThreshold;
-	uint16_t  blueDiffThreshold;
-	uint16_t  greenDiffThreshold;
-};
-
-struct vfe_cmd_demosaic_config {
-	uint8_t   enable;
-	uint8_t   slopeShift;
-	struct vfe_cmds_demosaic_abf abfConfig;
-	struct vfe_cmds_demosaic_bpc bpcConfig;
-};
-
-struct vfe_cmd_demosaic_bpc_update {
-	struct vfe_cmds_demosaic_bpc bpcUpdate;
-};
-
-struct vfe_cmd_demosaic_abf_update {
-	struct vfe_cmds_demosaic_abf abfUpdate;
-};
-
-struct vfe_cmd_white_balance_config {
-	uint8_t  enable;
-	uint16_t ch2Gain;
-	uint16_t ch1Gain;
-	uint16_t ch0Gain;
-};
-
-enum VFE_COLOR_CORRECTION_COEF_QFACTOR {
-	COEF_IS_Q7_SIGNED,
-	COEF_IS_Q8_SIGNED,
-	COEF_IS_Q9_SIGNED,
-	COEF_IS_Q10_SIGNED
-};
-
-struct vfe_cmd_color_correction_config {
-	uint8_t     enable;
-	enum VFE_COLOR_CORRECTION_COEF_QFACTOR coefQFactor;
-	int16_t  C0;
-	int16_t  C1;
-	int16_t  C2;
-	int16_t  C3;
-	int16_t  C4;
-	int16_t  C5;
-	int16_t  C6;
-	int16_t  C7;
-	int16_t  C8;
-	int16_t  K0;
-	int16_t  K1;
-	int16_t  K2;
-};
-
-#define VFE_LA_TABLE_LENGTH 64
-
-struct vfe_cmd_la_config {
-	uint8_t enable;
-	int16_t table[VFE_LA_TABLE_LENGTH];
-};
-
-#define VFE_GAMMA_TABLE_LENGTH 256
-enum VFE_RGB_GAMMA_TABLE_SELECT {
-	RGB_GAMMA_CH0_SELECTED,
-	RGB_GAMMA_CH1_SELECTED,
-	RGB_GAMMA_CH2_SELECTED,
-	RGB_GAMMA_CH0_CH1_SELECTED,
-	RGB_GAMMA_CH0_CH2_SELECTED,
-	RGB_GAMMA_CH1_CH2_SELECTED,
-	RGB_GAMMA_CH0_CH1_CH2_SELECTED
-};
-
-struct vfe_cmd_rgb_gamma_config {
-	uint8_t enable;
-	enum VFE_RGB_GAMMA_TABLE_SELECT channelSelect;
-	int16_t table[VFE_GAMMA_TABLE_LENGTH];
-};
-
-struct vfe_cmd_chroma_enhan_config {
-	uint8_t  enable;
-	int16_t am;
-	int16_t ap;
-	int16_t bm;
-	int16_t bp;
-	int16_t cm;
-	int16_t cp;
-	int16_t dm;
-	int16_t dp;
-	int16_t kcr;
-	int16_t kcb;
-	int16_t RGBtoYConversionV0;
-	int16_t RGBtoYConversionV1;
-	int16_t RGBtoYConversionV2;
-	uint8_t RGBtoYConversionOffset;
-};
-
-struct vfe_cmd_chroma_suppression_config {
-	uint8_t enable;
-	uint8_t m1;
-	uint8_t m3;
-	uint8_t n1;
-	uint8_t n3;
-	uint8_t nn1;
-	uint8_t mm1;
-};
-
-struct vfe_cmd_asf_config {
-	uint8_t enable;
-	uint8_t smoothFilterEnabled;
-	uint8_t sharpMode;
-	uint8_t smoothCoefCenter;
-	uint8_t smoothCoefSurr;
-	uint8_t normalizeFactor;
-	uint8_t sharpK1;
-	uint8_t sharpK2;
-	uint8_t sharpThreshE1;
-	int8_t sharpThreshE2;
-	int8_t sharpThreshE3;
-	int8_t sharpThreshE4;
-	int8_t sharpThreshE5;
-	int8_t filter1Coefficients[9];
-	int8_t filter2Coefficients[9];
-	uint8_t  cropEnable;
-	uint16_t cropFirstPixel;
-	uint16_t cropLastPixel;
-	uint16_t cropFirstLine;
-	uint16_t cropLastLine;
-};
-
-struct vfe_cmd_asf_update {
-	uint8_t enable;
-	uint8_t smoothFilterEnabled;
-	uint8_t sharpMode;
-	uint8_t smoothCoefCenter;
-	uint8_t smoothCoefSurr;
-	uint8_t normalizeFactor;
-	uint8_t sharpK1;
-	uint8_t sharpK2;
-	uint8_t sharpThreshE1;
-	int8_t  sharpThreshE2;
-	int8_t  sharpThreshE3;
-	int8_t  sharpThreshE4;
-	int8_t  sharpThreshE5;
-	int8_t  filter1Coefficients[9];
-	int8_t  filter2Coefficients[9];
-	uint8_t cropEnable;
-};
-
-enum VFE_TEST_GEN_SYNC_EDGE {
-	VFE_TEST_GEN_SYNC_EDGE_ActiveHigh,
-	VFE_TEST_GEN_SYNC_EDGE_ActiveLow
-};
-
-
-struct vfe_cmd_bus_pm_start {
-	uint8_t output2YWrPmEnable;
-	uint8_t output2CbcrWrPmEnable;
-	uint8_t output1YWrPmEnable;
-	uint8_t output1CbcrWrPmEnable;
-};
-
-struct  vfe_frame_skip_counts {
-	uint32_t  totalFrameCount;
-	uint32_t  output1Count;
-	uint32_t  output2Count;
-};
-
-enum VFE_AXI_RD_UNPACK_HBI_SEL {
-	VFE_AXI_RD_HBI_32_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_64_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_128_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_256_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_512_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_1024_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_2048_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_4096_CLOCK_CYCLES
-};
-
-enum VFE31_MESSAGE_ID {
-	MSG_ID_RESET_ACK, /* 0 */
-	MSG_ID_START_ACK,
-	MSG_ID_STOP_ACK,
-	MSG_ID_UPDATE_ACK,
-	MSG_ID_OUTPUT_P,
-	MSG_ID_OUTPUT_T,
-	MSG_ID_OUTPUT_S,
-	MSG_ID_OUTPUT_V,
-	MSG_ID_SNAPSHOT_DONE,
-	MSG_ID_COMMON,
-	MSG_ID_EPOCH1, /* 10 */
-	MSG_ID_EPOCH2,
-	MSG_ID_SYNC_TIMER0_DONE,
-	MSG_ID_SYNC_TIMER1_DONE,
-	MSG_ID_SYNC_TIMER2_DONE,
-	MSG_ID_ASYNC_TIMER0_DONE,
-	MSG_ID_ASYNC_TIMER1_DONE,
-	MSG_ID_ASYNC_TIMER2_DONE,
-	MSG_ID_ASYNC_TIMER3_DONE,
-	MSG_ID_AE_OVERFLOW,
-	MSG_ID_AF_OVERFLOW, /* 20 */
-	MSG_ID_AWB_OVERFLOW,
-	MSG_ID_RS_OVERFLOW,
-	MSG_ID_CS_OVERFLOW,
-	MSG_ID_IHIST_OVERFLOW,
-	MSG_ID_SKIN_OVERFLOW,
-	MSG_ID_AXI_ERROR,
-	MSG_ID_CAMIF_OVERFLOW,
-	MSG_ID_VIOLATION,
-	MSG_ID_CAMIF_ERROR,
-	MSG_ID_BUS_OVERFLOW, /* 30 */
-	MSG_ID_SOF_ACK,
-	MSG_ID_STOP_REC_ACK,
-};
-
-struct stats_buffer {
-	uint8_t awb_ymin;
-	uint32_t aec;
-	uint32_t awb;
-	uint32_t af;
-	uint32_t ihist;
-	uint32_t rs;
-	uint32_t cs;
-	uint32_t skin;
-};
-
-struct vfe_msg_stats {
-	struct stats_buffer buff;
-	uint32_t    frameCounter;
-	uint32_t    status_bits;
-};
-
-
-struct vfe_frame_bpc_info {
-	uint32_t greenDefectPixelCount;
-	uint32_t redBlueDefectPixelCount;
-};
-
-struct vfe_frame_asf_info {
-	uint32_t  asfMaxEdge;
-	uint32_t  asfHbiCount;
-};
-
-struct vfe_msg_camif_status {
-	uint8_t  camifState;
-	uint32_t pixelCount;
-	uint32_t lineCount;
-};
-
-
-struct vfe31_irq_status {
-	uint32_t vfeIrqStatus0;
-	uint32_t vfeIrqStatus1;
-	uint32_t camifStatus;
-	uint32_t demosaicStatus;
-	uint32_t asfMaxEdge;
-	uint32_t vfePingPongStatus;
-};
-
-struct vfe_msg_output {
-	uint8_t   output_id;
-	uint32_t  p0_addr;
-	uint32_t  p1_addr;
-	uint32_t  p2_addr;
-	struct vfe_frame_bpc_info bpcInfo;
-	struct vfe_frame_asf_info asfInfo;
-	uint32_t  frameCounter;
-};
-
-struct vfe_message {
-	enum VFE31_MESSAGE_ID _d;
-	union {
-		struct vfe_msg_output              msgOut;
-		struct vfe_msg_stats               msgStats;
-		struct vfe_msg_camif_status        msgCamifError;
-   } _u;
-};
-
-/* New one for 7x30 */
-struct msm_vfe31_cmd {
-	int32_t  id;
-	uint16_t length;
-	void     *value;
-};
-
-#define V31_PREVIEW_AXI_FLAG  0x00000001
-#define V31_SNAPSHOT_AXI_FLAG (0x00000001<<1)
-
-struct vfe31_cmd_type {
-	uint16_t id;
-	uint32_t length;
-	uint32_t offset;
-	uint32_t flag;
-};
-
-struct vfe31_free_buf {
-	struct list_head node;
-	uint32_t paddr;
-	uint32_t planar0_off;
-	uint32_t planar1_off;
-	uint32_t planar2_off;
-	uint32_t cbcr_off;
-};
-
-struct vfe31_output_ch {
-	struct list_head free_buf_head;
-	spinlock_t free_buf_lock;
-	uint16_t output_fmt;
-	int8_t ch0;
-	int8_t ch1;
-	int8_t ch2;
-	uint32_t  frame_drop_cnt;
-};
-
-/* no error irq in mask 0 */
-#define VFE31_IMASK_ERROR_ONLY_0  0x0
-/* when normal case, don't want to block error status. */
-/* bit 0-21 are error irq bits */
-#define VFE31_IMASK_ERROR_ONLY_1               0x003FFFFF
-#define VFE31_IMASK_CAMIF_ERROR               (0x00000001<<0)
-#define VFE31_IMASK_STATS_CS_OVWR             (0x00000001<<1)
-#define VFE31_IMASK_STATS_IHIST_OVWR          (0x00000001<<2)
-#define VFE31_IMASK_REALIGN_BUF_Y_OVFL        (0x00000001<<3)
-#define VFE31_IMASK_REALIGN_BUF_CB_OVFL       (0x00000001<<4)
-#define VFE31_IMASK_REALIGN_BUF_CR_OVFL       (0x00000001<<5)
-#define VFE31_IMASK_VIOLATION                 (0x00000001<<6)
-#define VFE31_IMASK_IMG_MAST_0_BUS_OVFL       (0x00000001<<7)
-#define VFE31_IMASK_IMG_MAST_1_BUS_OVFL       (0x00000001<<8)
-#define VFE31_IMASK_IMG_MAST_2_BUS_OVFL       (0x00000001<<9)
-#define VFE31_IMASK_IMG_MAST_3_BUS_OVFL       (0x00000001<<10)
-#define VFE31_IMASK_IMG_MAST_4_BUS_OVFL       (0x00000001<<11)
-#define VFE31_IMASK_IMG_MAST_5_BUS_OVFL       (0x00000001<<12)
-#define VFE31_IMASK_IMG_MAST_6_BUS_OVFL       (0x00000001<<13)
-#define VFE31_IMASK_STATS_AE_BUS_OVFL         (0x00000001<<14)
-#define VFE31_IMASK_STATS_AF_BUS_OVFL         (0x00000001<<15)
-#define VFE31_IMASK_STATS_AWB_BUS_OVFL        (0x00000001<<16)
-#define VFE31_IMASK_STATS_RS_BUS_OVFL         (0x00000001<<17)
-#define VFE31_IMASK_STATS_CS_BUS_OVFL         (0x00000001<<18)
-#define VFE31_IMASK_STATS_IHIST_BUS_OVFL      (0x00000001<<19)
-#define VFE31_IMASK_STATS_SKIN_BUS_OVFL       (0x00000001<<20)
-#define VFE31_IMASK_AXI_ERROR                 (0x00000001<<21)
-
-#define VFE_COM_STATUS 0x000FE000
-
-struct vfe31_output_path {
-	uint16_t output_mode;     /* bitmask  */
-
-	struct vfe31_output_ch out0; /* preview and thumbnail */
-	struct vfe31_output_ch out1; /* snapshot */
-	struct vfe31_output_ch out2; /* video    */
-};
-
-struct vfe31_frame_extra {
-	uint32_t greenDefectPixelCount;
-	uint32_t redBlueDefectPixelCount;
-
-	uint32_t  asfMaxEdge;
-	uint32_t  asfHbiCount;
-
-	uint32_t yWrPmStats0;
-	uint32_t yWrPmStats1;
-	uint32_t cbcrWrPmStats0;
-	uint32_t cbcrWrPmStats1;
-
-	uint32_t  frameCounter;
-};
-
-#define VFE_DISABLE_ALL_IRQS             0
-#define VFE_CLEAR_ALL_IRQS               0xffffffff
-
-#define VFE_GLOBAL_RESET                 0x00000004
-#define VFE_CGC_OVERRIDE                 0x0000000C
-#define VFE_MODULE_CFG                   0x00000010
-#define VFE_CFG_OFF                      0x00000014
-#define VFE_IRQ_CMD                      0x00000018
-#define VFE_IRQ_MASK_0                   0x0000001C
-#define VFE_IRQ_MASK_1                   0x00000020
-#define VFE_IRQ_CLEAR_0                  0x00000024
-#define VFE_IRQ_CLEAR_1                  0x00000028
-#define VFE_IRQ_STATUS_0                 0x0000002C
-#define VFE_IRQ_STATUS_1                 0x00000030
-#define VFE_IRQ_COMP_MASK                0x00000034
-#define VFE_BUS_CMD                      0x00000038
-#define VFE_BUS_PING_PONG_STATUS         0x00000180
-#define VFE_BUS_OPERATION_STATUS         0x00000184
-
-#define VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_0        0x00000190
-#define VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_1        0x00000194
-
-#define VFE_AXI_CMD                      0x000001D8
-#define VFE_AXI_STATUS                   0x000001DC
-#define VFE_BUS_STATS_PING_PONG_BASE     0x000000F4
-
-#define VFE_BUS_STATS_AEC_WR_PING_ADDR   0x000000F4
-#define VFE_BUS_STATS_AEC_WR_PONG_ADDR   0x000000F8
-#define VFE_BUS_STATS_AEC_UB_CFG         0x000000FC
-#define VFE_BUS_STATS_AF_WR_PING_ADDR    0x00000100
-#define VFE_BUS_STATS_AF_WR_PONG_ADDR    0x00000104
-#define VFE_BUS_STATS_AF_UB_CFG          0x00000108
-#define VFE_BUS_STATS_AWB_WR_PING_ADDR   0x0000010C
-#define VFE_BUS_STATS_AWB_WR_PONG_ADDR   0x00000110
-#define VFE_BUS_STATS_AWB_UB_CFG         0x00000114
-#define VFE_BUS_STATS_RS_WR_PING_ADDR    0x00000118
-#define VFE_BUS_STATS_RS_WR_PONG_ADDR    0x0000011C
-#define VFE_BUS_STATS_RS_UB_CFG          0x00000120
-
-#define VFE_BUS_STATS_CS_WR_PING_ADDR    0x00000124
-#define VFE_BUS_STATS_CS_WR_PONG_ADDR    0x00000128
-#define VFE_BUS_STATS_CS_UB_CFG          0x0000012C
-#define VFE_BUS_STATS_HIST_WR_PING_ADDR  0x00000130
-#define VFE_BUS_STATS_HIST_WR_PONG_ADDR  0x00000134
-#define VFE_BUS_STATS_HIST_UB_CFG        0x00000138
-#define VFE_BUS_STATS_SKIN_WR_PING_ADDR  0x0000013C
-#define VFE_BUS_STATS_SKIN_WR_PONG_ADDR  0x00000140
-#define VFE_BUS_STATS_SKIN_UB_CFG        0x00000144
-#define VFE_BUS_PM_CMD                   0x00000188
-#define VFE_BUS_PM_CFG                   0x0000018C
-#define VFE_CAMIF_COMMAND                0x000001E0
-#define VFE_CAMIF_STATUS                 0x00000204
-#define VFE_REG_UPDATE_CMD               0x00000260
-#define VFE_DEMUX_GAIN_0                 0x00000288
-#define VFE_DEMUX_GAIN_1                 0x0000028C
-#define VFE_CHROMA_UP                    0x0000035C
-#define VFE_FRAMEDROP_ENC_Y_CFG          0x00000504
-#define VFE_FRAMEDROP_ENC_CBCR_CFG       0x00000508
-#define VFE_FRAMEDROP_ENC_Y_PATTERN      0x0000050C
-#define VFE_FRAMEDROP_ENC_CBCR_PATTERN   0x00000510
-#define VFE_FRAMEDROP_VIEW_Y             0x00000514
-#define VFE_FRAMEDROP_VIEW_CBCR          0x00000518
-#define VFE_FRAMEDROP_VIEW_Y_PATTERN     0x0000051C
-#define VFE_FRAMEDROP_VIEW_CBCR_PATTERN  0x00000520
-#define VFE_CLAMP_MAX                    0x00000524
-#define VFE_CLAMP_MIN                    0x00000528
-#define VFE_REALIGN_BUF                  0x0000052C
-#define VFE_STATS_CFG                    0x00000530
-#define VFE_STATS_AWB_SGW_CFG            0x00000554
-#define VFE_DMI_CFG                      0x00000598
-#define VFE_DMI_ADDR                     0x0000059C
-#define VFE_DMI_DATA_LO                  0x000005A4
-#define VFE_AXI_CFG                      0x00000600
-
-struct vfe_stats_control {
-	uint8_t  ackPending;
-	uint32_t nextFrameAddrBuf;
-	uint32_t droppedStatsFrameCount;
-	uint32_t bufToRender;
-};
-
-struct vfe31_ctrl_type {
-	uint16_t operation_mode;     /* streaming or snapshot */
-	struct vfe31_output_path outpath;
-
-	uint32_t vfeImaskCompositePacked;
-
-	spinlock_t  update_ack_lock;
-	spinlock_t  io_lock;
-
-	int8_t aec_ack_pending;
-	int8_t awb_ack_pending;
-	int8_t af_ack_pending;
-	int8_t ihist_ack_pending;
-	int8_t rs_ack_pending;
-	int8_t cs_ack_pending;
-
-	struct msm_vfe_callback *resp;
-	uint32_t extlen;
-	void *extdata;
-
-	int8_t start_ack_pending;
-	atomic_t stop_ack_pending;
-	int8_t reset_ack_pending;
-	int8_t update_ack_pending;
-	enum vfe_recording_state recording_state;
-	int8_t output0_available;
-	int8_t output1_available;
-	int8_t update_gamma;
-	int8_t update_luma;
-	spinlock_t  tasklet_lock;
-	struct list_head tasklet_q;
-	int vfeirq;
-	void __iomem *vfebase;
-	void *syncdata;
-
-	struct resource	*vfemem;
-	struct resource *vfeio;
-
-	uint32_t stats_comp;
-	uint32_t hfr_mode;
-	atomic_t vstate;
-	uint32_t vfe_capture_count;
-	uint32_t sync_timer_repeat_count;
-	uint32_t sync_timer_state;
-	uint32_t sync_timer_number;
-
-	uint32_t vfeFrameId;
-	uint32_t output1Pattern;
-	uint32_t output1Period;
-	uint32_t output2Pattern;
-	uint32_t output2Period;
-	uint32_t vfeFrameSkipCount;
-	uint32_t vfeFrameSkipPeriod;
-	uint32_t status_bits;
-	struct vfe_stats_control afStatsControl;
-	struct vfe_stats_control awbStatsControl;
-	struct vfe_stats_control aecStatsControl;
-	struct vfe_stats_control ihistStatsControl;
-	struct vfe_stats_control rsStatsControl;
-	struct vfe_stats_control csStatsControl;
-	struct msm_camera_sensor_info *s_info;
-	struct vfe_message vMsgHold_Snap;
-	struct vfe_message vMsgHold_Thumb;
-	int8_t xbar_update_pending;
-	uint32_t xbar_cfg[2];
-	spinlock_t xbar_lock;
-	uint32_t while_stopping_mask;
-};
-
-#define statsAeNum      0
-#define statsAfNum      1
-#define statsAwbNum     2
-#define statsRsNum      3
-#define statsCsNum      4
-#define statsIhistNum   5
-#define statsSkinNum    6
-
-struct vfe_cmd_stats_ack{
-  uint32_t  nextStatsBuf;
-};
-
-#define VFE_STATS_BUFFER_COUNT            3
-
-struct vfe_cmd_stats_buf{
-   uint32_t statsBuf[VFE_STATS_BUFFER_COUNT];
-};
-#endif /* __MSM_VFE31_H__ */
diff --git a/drivers/media/video/msm/vfe/msm_vfe31_v4l2.c b/drivers/media/video/msm/vfe/msm_vfe31_v4l2.c
deleted file mode 100644
index 10ddd4b..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe31_v4l2.c
+++ /dev/null
@@ -1,4241 +0,0 @@
-/* Copyright (c) 2012 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/uaccess.h>
-#include <linux/interrupt.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/atomic.h>
-#include <linux/regulator/consumer.h>
-#include <linux/clk.h>
-#include <linux/module.h>
-#include <mach/clk.h>
-#include <mach/irqs.h>
-#include <mach/camera.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-subdev.h>
-#include <media/msm_isp.h>
-
-#include "msm.h"
-#include "msm_vfe31_v4l2.h"
-
-atomic_t irq_cnt;
-
-#define BUFF_SIZE_128 128
-
-#define VFE31_AXI_OFFSET 0x0050
-#define vfe31_get_ch_ping_addr(chn) \
-	(msm_camera_io_r(vfe31_ctrl->vfebase + 0x0050 + 0x18 * (chn)))
-#define vfe31_get_ch_pong_addr(chn) \
-	(msm_camera_io_r(vfe31_ctrl->vfebase + 0x0050 + 0x18 * (chn) + 4))
-#define vfe31_get_ch_addr(ping_pong, chn) \
-	(((ping_pong) & (1 << (chn))) == 0 ? \
-	vfe31_get_ch_pong_addr(chn) : vfe31_get_ch_ping_addr(chn))
-
-#define vfe31_put_ch_ping_addr(chn, addr) \
-	(msm_camera_io_w((addr), vfe31_ctrl->vfebase + 0x0050 + 0x18 * (chn)))
-#define vfe31_put_ch_pong_addr(chn, addr) \
-	(msm_camera_io_w((addr), \
-	vfe31_ctrl->vfebase + 0x0050 + 0x18 * (chn) + 4))
-#define vfe31_put_ch_addr(ping_pong, chn, addr) \
-	(((ping_pong) & (1 << (chn))) == 0 ?   \
-	vfe31_put_ch_pong_addr((chn), (addr)) : \
-	vfe31_put_ch_ping_addr((chn), (addr)))
-
-#define VFE_CLK_RATE	153600000
-#define CAMIF_CFG_RMSK             0x1fffff
-
-static struct vfe31_ctrl_type *vfe31_ctrl;
-static uint32_t vfe_clk_rate;
-
-struct vfe31_isr_queue_cmd {
-	struct list_head	list;
-	uint32_t		vfeInterruptStatus0;
-	uint32_t		vfeInterruptStatus1;
-};
-
-static struct vfe31_cmd_type vfe31_cmd[] = {
-/* 0*/	{VFE_CMD_DUMMY_0},
-		{VFE_CMD_SET_CLK},
-		{VFE_CMD_RESET},
-		{VFE_CMD_START},
-		{VFE_CMD_TEST_GEN_START},
-/* 5*/	{VFE_CMD_OPERATION_CFG, V31_OPERATION_CFG_LEN},
-		{VFE_CMD_AXI_OUT_CFG, V31_AXI_OUT_LEN, V31_AXI_OUT_OFF, 0xFF},
-		{VFE_CMD_CAMIF_CFG, V31_CAMIF_LEN, V31_CAMIF_OFF, 0xFF},
-		{VFE_CMD_AXI_INPUT_CFG},
-		{VFE_CMD_BLACK_LEVEL_CFG, V31_BLACK_LEVEL_LEN,
-		V31_BLACK_LEVEL_OFF,
-		0xFF},
-/*10*/  {VFE_CMD_MESH_ROLL_OFF_CFG, V31_MESH_ROLL_OFF_CFG_LEN,
-		V31_MESH_ROLL_OFF_CFG_OFF, 0xFF},
-		{VFE_CMD_DEMUX_CFG, V31_DEMUX_LEN, V31_DEMUX_OFF, 0xFF},
-		{VFE_CMD_FOV_CFG, V31_FOV_LEN, V31_FOV_OFF, 0xFF},
-		{VFE_CMD_MAIN_SCALER_CFG, V31_MAIN_SCALER_LEN,
-		V31_MAIN_SCALER_OFF, 0xFF},
-		{VFE_CMD_WB_CFG, V31_WB_LEN, V31_WB_OFF, 0xFF},
-/*15*/	{VFE_CMD_COLOR_COR_CFG, V31_COLOR_COR_LEN, V31_COLOR_COR_OFF, 0xFF},
-		{VFE_CMD_RGB_G_CFG, V31_RGB_G_LEN, V31_RGB_G_OFF, 0xFF},
-		{VFE_CMD_LA_CFG, V31_LA_LEN, V31_LA_OFF, 0xFF },
-		{VFE_CMD_CHROMA_EN_CFG, V31_CHROMA_EN_LEN, V31_CHROMA_EN_OFF,
-		0xFF},
-		{VFE_CMD_CHROMA_SUP_CFG, V31_CHROMA_SUP_LEN, V31_CHROMA_SUP_OFF,
-		0xFF},
-/*20*/	{VFE_CMD_MCE_CFG, V31_MCE_LEN, V31_MCE_OFF, 0xFF},
-		{VFE_CMD_SK_ENHAN_CFG, V31_SCE_LEN, V31_SCE_OFF, 0xFF},
-		{VFE_CMD_ASF_CFG, V31_ASF_LEN, V31_ASF_OFF, 0xFF},
-		{VFE_CMD_S2Y_CFG, V31_S2Y_LEN, V31_S2Y_OFF, 0xFF},
-		{VFE_CMD_S2CbCr_CFG, V31_S2CbCr_LEN, V31_S2CbCr_OFF, 0xFF},
-/*25*/	{VFE_CMD_CHROMA_SUBS_CFG, V31_CHROMA_SUBS_LEN, V31_CHROMA_SUBS_OFF,
-		0xFF},
-		{VFE_CMD_OUT_CLAMP_CFG, V31_OUT_CLAMP_LEN, V31_OUT_CLAMP_OFF,
-		0xFF},
-		{VFE_CMD_FRAME_SKIP_CFG, V31_FRAME_SKIP_LEN, V31_FRAME_SKIP_OFF,
-		0xFF},
-		{VFE_CMD_DUMMY_1},
-		{VFE_CMD_DUMMY_2},
-/*30*/	{VFE_CMD_DUMMY_3},
-		{VFE_CMD_UPDATE},
-		{VFE_CMD_BL_LVL_UPDATE, V31_BLACK_LEVEL_LEN,
-		V31_BLACK_LEVEL_OFF, 0xFF},
-		{VFE_CMD_DEMUX_UPDATE, V31_DEMUX_LEN, V31_DEMUX_OFF, 0xFF},
-		{VFE_CMD_FOV_UPDATE, V31_FOV_LEN, V31_FOV_OFF, 0xFF},
-/*35*/	{VFE_CMD_MAIN_SCALER_UPDATE, V31_MAIN_SCALER_LEN, V31_MAIN_SCALER_OFF,
-		0xFF},
-		{VFE_CMD_WB_UPDATE, V31_WB_LEN, V31_WB_OFF, 0xFF},
-		{VFE_CMD_COLOR_COR_UPDATE, V31_COLOR_COR_LEN, V31_COLOR_COR_OFF,
-		0xFF},
-		{VFE_CMD_RGB_G_UPDATE, V31_RGB_G_LEN, V31_CHROMA_EN_OFF, 0xFF},
-		{VFE_CMD_LA_UPDATE, V31_LA_LEN, V31_LA_OFF, 0xFF },
-/*40*/	{VFE_CMD_CHROMA_EN_UPDATE, V31_CHROMA_EN_LEN, V31_CHROMA_EN_OFF,
-		0xFF},
-		{VFE_CMD_CHROMA_SUP_UPDATE, V31_CHROMA_SUP_LEN,
-		V31_CHROMA_SUP_OFF, 0xFF},
-		{VFE_CMD_MCE_UPDATE, V31_MCE_LEN, V31_MCE_OFF, 0xFF},
-		{VFE_CMD_SK_ENHAN_UPDATE, V31_SCE_LEN, V31_SCE_OFF, 0xFF},
-		{VFE_CMD_S2CbCr_UPDATE, V31_S2CbCr_LEN, V31_S2CbCr_OFF, 0xFF},
-/*45*/	{VFE_CMD_S2Y_UPDATE, V31_S2Y_LEN, V31_S2Y_OFF, 0xFF},
-		{VFE_CMD_ASF_UPDATE, V31_ASF_UPDATE_LEN, V31_ASF_OFF, 0xFF},
-		{VFE_CMD_FRAME_SKIP_UPDATE},
-		{VFE_CMD_CAMIF_FRAME_UPDATE},
-		{VFE_CMD_STATS_AF_UPDATE, V31_STATS_AF_LEN, V31_STATS_AF_OFF},
-/*50*/	{VFE_CMD_STATS_AE_UPDATE, V31_STATS_AE_LEN, V31_STATS_AE_OFF},
-		{VFE_CMD_STATS_AWB_UPDATE, V31_STATS_AWB_LEN,
-		V31_STATS_AWB_OFF},
-		{VFE_CMD_STATS_RS_UPDATE, V31_STATS_RS_LEN, V31_STATS_RS_OFF},
-		{VFE_CMD_STATS_CS_UPDATE, V31_STATS_CS_LEN, V31_STATS_CS_OFF},
-		{VFE_CMD_STATS_SKIN_UPDATE},
-/*55*/	{VFE_CMD_STATS_IHIST_UPDATE, V31_STATS_IHIST_LEN, V31_STATS_IHIST_OFF},
-		{VFE_CMD_DUMMY_4},
-		{VFE_CMD_EPOCH1_ACK},
-		{VFE_CMD_EPOCH2_ACK},
-		{VFE_CMD_START_RECORDING},
-/*60*/	{VFE_CMD_STOP_RECORDING},
-		{VFE_CMD_DUMMY_5},
-		{VFE_CMD_DUMMY_6},
-		{VFE_CMD_CAPTURE, V31_CAPTURE_LEN, 0xFF},
-		{VFE_CMD_DUMMY_7},
-/*65*/	{VFE_CMD_STOP},
-		{VFE_CMD_GET_HW_VERSION, V31_GET_HW_VERSION_LEN,
-		V31_GET_HW_VERSION_OFF},
-		{VFE_CMD_GET_FRAME_SKIP_COUNTS},
-		{VFE_CMD_OUTPUT1_BUFFER_ENQ},
-		{VFE_CMD_OUTPUT2_BUFFER_ENQ},
-/*70*/	{VFE_CMD_OUTPUT3_BUFFER_ENQ},
-		{VFE_CMD_JPEG_OUT_BUF_ENQ},
-		{VFE_CMD_RAW_OUT_BUF_ENQ},
-		{VFE_CMD_RAW_IN_BUF_ENQ},
-		{VFE_CMD_STATS_AF_ENQ},
-/*75*/	{VFE_CMD_STATS_AE_ENQ},
-		{VFE_CMD_STATS_AWB_ENQ},
-		{VFE_CMD_STATS_RS_ENQ},
-		{VFE_CMD_STATS_CS_ENQ},
-		{VFE_CMD_STATS_SKIN_ENQ},
-/*80*/	{VFE_CMD_STATS_IHIST_ENQ},
-		{VFE_CMD_DUMMY_8},
-		{VFE_CMD_JPEG_ENC_CFG},
-		{VFE_CMD_DUMMY_9},
-		{VFE_CMD_STATS_AF_START, V31_STATS_AF_LEN, V31_STATS_AF_OFF},
-/*85*/	{VFE_CMD_STATS_AF_STOP},
-		{VFE_CMD_STATS_AE_START, V31_STATS_AE_LEN, V31_STATS_AE_OFF},
-		{VFE_CMD_STATS_AE_STOP},
-		{VFE_CMD_STATS_AWB_START, V31_STATS_AWB_LEN, V31_STATS_AWB_OFF},
-		{VFE_CMD_STATS_AWB_STOP},
-/*90*/	{VFE_CMD_STATS_RS_START, V31_STATS_RS_LEN, V31_STATS_RS_OFF},
-		{VFE_CMD_STATS_RS_STOP},
-		{VFE_CMD_STATS_CS_START, V31_STATS_CS_LEN, V31_STATS_CS_OFF},
-		{VFE_CMD_STATS_CS_STOP},
-		{VFE_CMD_STATS_SKIN_START},
-/*95*/	{VFE_CMD_STATS_SKIN_STOP},
-		{VFE_CMD_STATS_IHIST_START,
-		V31_STATS_IHIST_LEN, V31_STATS_IHIST_OFF},
-		{VFE_CMD_STATS_IHIST_STOP},
-		{VFE_CMD_DUMMY_10},
-		{VFE_CMD_SYNC_TIMER_SETTING, V31_SYNC_TIMER_LEN,
-			V31_SYNC_TIMER_OFF},
-/*100*/	{VFE_CMD_ASYNC_TIMER_SETTING, V31_ASYNC_TIMER_LEN, V31_ASYNC_TIMER_OFF},
-		{VFE_CMD_LIVESHOT},
-		{VFE_CMD_LA_SETUP},
-		{VFE_CMD_LINEARIZATION_CFG},
-		{VFE_CMD_DEMOSAICV3},
-/*105*/	{VFE_CMD_DEMOSAICV3_ABCC_CFG},
-	{VFE_CMD_DEMOSAICV3_DBCC_CFG},
-		{VFE_CMD_DEMOSAICV3_DBPC_CFG, V31_DEMOSAICV3_DBPC_LEN,
-			V31_DEMOSAICV3_DBPC_CFG_OFF},
-		{VFE_CMD_DEMOSAICV3_ABF_CFG, V31_DEMOSAICV3_ABF_LEN,
-			V31_DEMOSAICV3_ABF_OFF},
-		{VFE_CMD_DEMOSAICV3_ABCC_UPDATE},
-/*110*/	{VFE_CMD_DEMOSAICV3_DBCC_UPDATE},
-		{VFE_CMD_DEMOSAICV3_DBPC_UPDATE, V31_DEMOSAICV3_DBPC_LEN,
-			V31_DEMOSAICV3_DBPC_CFG_OFF},
-		{VFE_CMD_XBAR_CFG},
-		{VFE_CMD_MODULE_CFG, V31_MODULE_CFG_LEN, V31_MODULE_CFG_OFF},
-		{VFE_CMD_ZSL},
-/*115*/	{VFE_CMD_LINEARIZATION_UPDATE},
-		{VFE_CMD_DEMOSAICV3_ABF_UPDATE, V31_DEMOSAICV3_ABF_LEN,
-			V31_DEMOSAICV3_ABF_OFF},
-		{VFE_CMD_CLF_CFG},
-		{VFE_CMD_CLF_LUMA_UPDATE},
-		{VFE_CMD_CLF_CHROMA_UPDATE},
-/*120*/ {VFE_CMD_PCA_ROLL_OFF_CFG},
-		{VFE_CMD_PCA_ROLL_OFF_UPDATE},
-		{VFE_CMD_GET_REG_DUMP},
-		{VFE_CMD_GET_LINEARIZATON_TABLE},
-		{VFE_CMD_GET_MESH_ROLLOFF_TABLE},
-/*125*/ {VFE_CMD_GET_PCA_ROLLOFF_TABLE},
-		{VFE_CMD_GET_RGB_G_TABLE},
-		{VFE_CMD_GET_LA_TABLE},
-		{VFE_CMD_DEMOSAICV3_UPDATE},
-};
-
-uint32_t vfe31_AXI_WM_CFG[] = {
-	0x0000004C,
-	0x00000064,
-	0x0000007C,
-	0x00000094,
-	0x000000AC,
-	0x000000C4,
-	0x000000DC,
-};
-
-static const char * const vfe31_general_cmd[] = {
-	"DUMMY_0",  /* 0 */
-	"SET_CLK",
-	"RESET",
-	"START",
-	"TEST_GEN_START",
-	"OPERATION_CFG",  /* 5 */
-	"AXI_OUT_CFG",
-	"CAMIF_CFG",
-	"AXI_INPUT_CFG",
-	"BLACK_LEVEL_CFG",
-	"ROLL_OFF_CFG",  /* 10 */
-	"DEMUX_CFG",
-	"FOV_CFG",
-	"MAIN_SCALER_CFG",
-	"WB_CFG",
-	"COLOR_COR_CFG", /* 15 */
-	"RGB_G_CFG",
-	"LA_CFG",
-	"CHROMA_EN_CFG",
-	"CHROMA_SUP_CFG",
-	"MCE_CFG", /* 20 */
-	"SK_ENHAN_CFG",
-	"ASF_CFG",
-	"S2Y_CFG",
-	"S2CbCr_CFG",
-	"CHROMA_SUBS_CFG",  /* 25 */
-	"OUT_CLAMP_CFG",
-	"FRAME_SKIP_CFG",
-	"DUMMY_1",
-	"DUMMY_2",
-	"DUMMY_3",  /* 30 */
-	"UPDATE",
-	"BL_LVL_UPDATE",
-	"DEMUX_UPDATE",
-	"FOV_UPDATE",
-	"MAIN_SCALER_UPDATE",  /* 35 */
-	"WB_UPDATE",
-	"COLOR_COR_UPDATE",
-	"RGB_G_UPDATE",
-	"LA_UPDATE",
-	"CHROMA_EN_UPDATE",  /* 40 */
-	"CHROMA_SUP_UPDATE",
-	"MCE_UPDATE",
-	"SK_ENHAN_UPDATE",
-	"S2CbCr_UPDATE",
-	"S2Y_UPDATE",  /* 45 */
-	"ASF_UPDATE",
-	"FRAME_SKIP_UPDATE",
-	"CAMIF_FRAME_UPDATE",
-	"STATS_AF_UPDATE",
-	"STATS_AE_UPDATE",  /* 50 */
-	"STATS_AWB_UPDATE",
-	"STATS_RS_UPDATE",
-	"STATS_CS_UPDATE",
-	"STATS_SKIN_UPDATE",
-	"STATS_IHIST_UPDATE",  /* 55 */
-	"DUMMY_4",
-	"EPOCH1_ACK",
-	"EPOCH2_ACK",
-	"START_RECORDING",
-	"STOP_RECORDING",  /* 60 */
-	"DUMMY_5",
-	"DUMMY_6",
-	"CAPTURE",
-	"DUMMY_7",
-	"STOP",  /* 65 */
-	"GET_HW_VERSION",
-	"GET_FRAME_SKIP_COUNTS",
-	"OUTPUT1_BUFFER_ENQ",
-	"OUTPUT2_BUFFER_ENQ",
-	"OUTPUT3_BUFFER_ENQ",  /* 70 */
-	"JPEG_OUT_BUF_ENQ",
-	"RAW_OUT_BUF_ENQ",
-	"RAW_IN_BUF_ENQ",
-	"STATS_AF_ENQ",
-	"STATS_AE_ENQ",  /* 75 */
-	"STATS_AWB_ENQ",
-	"STATS_RS_ENQ",
-	"STATS_CS_ENQ",
-	"STATS_SKIN_ENQ",
-	"STATS_IHIST_ENQ",  /* 80 */
-	"DUMMY_8",
-	"JPEG_ENC_CFG",
-	"DUMMY_9",
-	"STATS_AF_START",
-	"STATS_AF_STOP",  /* 85 */
-	"STATS_AE_START",
-	"STATS_AE_STOP",
-	"STATS_AWB_START",
-	"STATS_AWB_STOP",
-	"STATS_RS_START",  /* 90 */
-	"STATS_RS_STOP",
-	"STATS_CS_START",
-	"STATS_CS_STOP",
-	"STATS_SKIN_START",
-	"STATS_SKIN_STOP",  /* 95 */
-	"STATS_IHIST_START",
-	"STATS_IHIST_STOP",
-	"DUMMY_10",
-	"SYNC_TIMER_SETTING",
-	"ASYNC_TIMER_SETTING",  /* 100 */
-	"LIVESHOT",
-	"LA_SETUP",
-	"LINEARIZATION_CFG",
-	"DEMOSAICV3",
-	"DEMOSAICV3_ABCC_CFG", /* 105 */
-	"DEMOSAICV3_DBCC_CFG",
-	"DEMOSAICV3_DBPC_CFG",
-	"DEMOSAICV3_ABF_CFG",
-	"DEMOSAICV3_ABCC_UPDATE",
-	"DEMOSAICV3_DBCC_UPDATE", /* 110 */
-	"DEMOSAICV3_DBPC_UPDATE",
-	"XBAR_CFG",
-	"EZTUNE_CFG",
-	"V31_ZSL",
-	"LINEARIZATION_UPDATE", /*115*/
-	"DEMOSAICV3_ABF_UPDATE",
-	"CLF_CFG",
-	"CLF_LUMA_UPDATE",
-	"CLF_CHROMA_UPDATE",
-	"PCA_ROLL_OFF_CFG", /*120*/
-	"PCA_ROLL_OFF_UPDATE",
-	"GET_REG_DUMP",
-	"GET_LINEARIZATON_TABLE",
-	"GET_MESH_ROLLOFF_TABLE",
-	"GET_PCA_ROLLOFF_TABLE", /*125*/
-	"GET_RGB_G_TABLE",
-	"GET_LA_TABLE",
-	"DEMOSAICV3_UPDATE",
-};
-
-
-static unsigned long vfe31_stats_dqbuf(enum msm_stats_enum_type stats_type)
-{
-	struct msm_stats_meta_buf *buf = NULL;
-	int rc = 0;
-	rc = vfe31_ctrl->stats_ops.dqbuf(vfe31_ctrl->stats_ops.stats_ctrl,
-			stats_type, &buf);
-	if (rc < 0) {
-		CDBG("%s: dq stats buf (type = %d) err = %d",
-			__func__, stats_type, rc);
-		return 0L;
-	}
-	return buf->paddr;
-}
-
-static unsigned long vfe31_stats_flush_enqueue(
-	enum msm_stats_enum_type stats_type)
-{
-	struct msm_stats_bufq *bufq = NULL;
-	struct msm_stats_meta_buf *stats_buf = NULL;
-	int rc = 0;
-	int i;
-	/*
-	 * Passing NULL for ion client as the buffers are already
-	 * mapped at this stage, client is not required, flush all
-	 * the buffers, and buffers move to PREPARE state
-	 */
-
-	rc = vfe31_ctrl->stats_ops.bufq_flush(
-			vfe31_ctrl->stats_ops.stats_ctrl, stats_type, NULL);
-	if (rc < 0) {
-		pr_err("%s: dq stats buf (type = %d) err = %d",
-			__func__, stats_type, rc);
-		return 0L;
-	}
-
-	/* Queue all the buffers back to QUEUED state */
-	bufq = vfe31_ctrl->stats_ctrl.bufq[stats_type];
-	for (i = 0; i < bufq->num_bufs; i++) {
-		stats_buf = &bufq->bufs[i];
-		rc = vfe31_ctrl->stats_ops.enqueue_buf(
-				vfe31_ctrl->stats_ops.stats_ctrl,
-				&(stats_buf->info), NULL, -1);
-		if (rc < 0) {
-			pr_err("%s: dq stats buf (type = %d) err = %d",
-				__func__, stats_type, rc);
-			return rc;
-		}
-	}
-	return 0L;
-}
-
-static unsigned long vfe31_stats_unregbuf(
-	struct msm_stats_reqbuf *req_buf, int domain_num)
-{
-	int i = 0, rc = 0;
-
-	for (i = 0; i < req_buf->num_buf; i++) {
-		rc = vfe31_ctrl->stats_ops.buf_unprepare(
-			vfe31_ctrl->stats_ops.stats_ctrl,
-			req_buf->stats_type, i,
-			vfe31_ctrl->stats_ops.client, domain_num);
-		if (rc < 0) {
-			pr_err("%s: unreg stats buf (type = %d) err = %d",
-				__func__, req_buf->stats_type, rc);
-		return rc;
-		}
-	}
-	return 0L;
-}
-
-static int vfe_stats_awb_buf_init(
-	struct vfe_cmd_stats_buf *in)
-{
-	uint32_t addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AWB);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq awb ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AWB);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq awb ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PONG_ADDR);
-	return 0;
-}
-
-static int vfe_stats_aec_buf_init(
-	struct vfe_cmd_stats_buf *in)
-{
-	uint32_t addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AEC);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq aec ping buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase +
-		VFE_BUS_STATS_AEC_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AEC);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq aec pong buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase +
-		VFE_BUS_STATS_AEC_WR_PONG_ADDR);
-	return 0;
-}
-
-static int vfe_stats_af_buf_init(
-	struct vfe_cmd_stats_buf *in)
-{
-	uint32_t addr;
-	unsigned long flags;
-	int rc = 0;
-
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	rc = vfe31_stats_flush_enqueue(MSM_STATS_TYPE_AF);
-	if (rc < 0) {
-		pr_err("%s: dq stats buf err = %d",
-			__func__, rc);
-		spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-		return -EINVAL;
-	}
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AF);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq af ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AF_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AF);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq af pong buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AF_WR_PONG_ADDR);
-	return 0;
-}
-
-static int vfe_stats_ihist_buf_init(
-	struct vfe_cmd_stats_buf *in)
-{
-	uint32_t addr;
-	unsigned long flags;
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_IHIST);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq ihist ping buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_HIST_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_IHIST);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq ihist pong buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_HIST_WR_PONG_ADDR);
-	return 0;
-}
-
-static int vfe_stats_rs_buf_init(struct vfe_cmd_stats_buf *in)
-{
-	uint32_t addr;
-	unsigned long flags;
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_RS);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq rs ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_RS_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_RS);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq rs pong buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_RS_WR_PONG_ADDR);
-	return 0;
-}
-
-static int vfe_stats_cs_buf_init(struct vfe_cmd_stats_buf *in)
-{
-	uint32_t addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_CS);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq cs ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_CS_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_CS);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq cs pong buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_CS_WR_PONG_ADDR);
-	return 0;
-}
-
-static void vfe31_stop(void)
-{
-	uint8_t  axiBusyFlag = true;
-	unsigned long flags;
-
-	atomic_set(&vfe31_ctrl->vstate, 0);
-
-	/* for reset hw modules, and send msg when reset_irq comes.*/
-	spin_lock_irqsave(&vfe31_ctrl->stop_flag_lock, flags);
-	vfe31_ctrl->stop_ack_pending = TRUE;
-	spin_unlock_irqrestore(&vfe31_ctrl->stop_flag_lock, flags);
-
-	/* disable all interrupts.  */
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* clear all pending interrupts*/
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1,
-		vfe31_ctrl->vfebase + VFE_IRQ_CMD);
-
-	/* in either continuous or snapshot mode, stop command can be issued
-	 * at any time. stop camif immediately. */
-	msm_camera_io_w_mb(CAMIF_COMMAND_STOP_IMMEDIATELY,
-		vfe31_ctrl->vfebase + VFE_CAMIF_COMMAND);
-	/* axi halt command. */
-	msm_camera_io_w(AXI_HALT,
-		vfe31_ctrl->vfebase + VFE_AXI_CMD);
-	wmb();
-	while (axiBusyFlag) {
-		if (msm_camera_io_r(vfe31_ctrl->vfebase + VFE_AXI_STATUS) & 0x1)
-			axiBusyFlag = false;
-	}
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(AXI_HALT_CLEAR,
-		vfe31_ctrl->vfebase + VFE_AXI_CMD);
-
-	/* now enable only halt_irq & reset_irq */
-	msm_camera_io_w(0xf0000000,          /* this is for async timer. */
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(VFE_IMASK_WHILE_STOPPING_1,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	msm_camera_io_w_mb(VFE_RESET_UPON_STOP_CMD,
-		vfe31_ctrl->vfebase + VFE_GLOBAL_RESET);
-}
-
-static void vfe31_subdev_notify(int id, int path, uint32_t inst_handle)
-{
-	struct msm_vfe_resp rp;
-	struct msm_frame_info frame_info;
-	unsigned long flags;
-	spin_lock_irqsave(&vfe31_ctrl->sd_notify_lock, flags);
-	memset(&rp, 0, sizeof(struct msm_vfe_resp));
-	CDBG("vfe31_subdev_notify : msgId = %d\n", id);
-	rp.evt_msg.type   = MSM_CAMERA_MSG;
-	frame_info.inst_handle = inst_handle;
-	frame_info.path = path;
-	rp.evt_msg.data = &frame_info;
-	rp.type	   = id;
-	v4l2_subdev_notify(&vfe31_ctrl->subdev, NOTIFY_VFE_BUF_EVT, &rp);
-	spin_unlock_irqrestore(&vfe31_ctrl->sd_notify_lock, flags);
-}
-
-static int vfe31_config_axi(int mode, uint32_t *ao)
-{
-	uint32_t *ch_info;
-	uint32_t *axi_cfg = ao + V31_AXI_RESERVED;
-	uint32_t bus_cmd = *axi_cfg;
-	int i;
-
-	/* Update the corresponding write masters for each output*/
-	ch_info = axi_cfg + V31_AXI_CFG_LEN;
-	vfe31_ctrl->outpath.out0.ch0 = 0x0000FFFF & *ch_info;
-	vfe31_ctrl->outpath.out0.ch1 = 0x0000FFFF & (*ch_info++ >> 16);
-	vfe31_ctrl->outpath.out0.ch2 = 0x0000FFFF & *ch_info++;
-	vfe31_ctrl->outpath.out0.inst_handle = *ch_info++;
-	vfe31_ctrl->outpath.out1.ch0 = 0x0000FFFF & *ch_info;
-	vfe31_ctrl->outpath.out1.ch1 = 0x0000FFFF & (*ch_info++ >> 16);
-	vfe31_ctrl->outpath.out1.ch2 = 0x0000FFFF & *ch_info++;
-	vfe31_ctrl->outpath.out1.inst_handle = *ch_info++;
-	vfe31_ctrl->outpath.out2.ch0 = 0x0000FFFF & *ch_info;
-	vfe31_ctrl->outpath.out2.ch1 = 0x0000FFFF & (*ch_info++ >> 16);
-	vfe31_ctrl->outpath.out2.ch2 = 0x0000FFFF & *ch_info++;
-	vfe31_ctrl->outpath.out2.inst_handle = *ch_info++;
-
-	switch (mode) {
-	case OUTPUT_PRIM:
-		vfe31_ctrl->outpath.output_mode =
-			VFE31_OUTPUT_MODE_PRIMARY;
-		break;
-	case OUTPUT_PRIM_ALL_CHNLS:
-		vfe31_ctrl->outpath.output_mode =
-			VFE31_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
-		break;
-	case OUTPUT_PRIM|OUTPUT_SEC:
-		vfe31_ctrl->outpath.output_mode =
-			VFE31_OUTPUT_MODE_PRIMARY;
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_SECONDARY;
-		break;
-	case OUTPUT_PRIM|OUTPUT_SEC_ALL_CHNLS:
-		vfe31_ctrl->outpath.output_mode =
-			VFE31_OUTPUT_MODE_PRIMARY;
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_SECONDARY_ALL_CHNLS;
-		break;
-	case OUTPUT_PRIM_ALL_CHNLS|OUTPUT_SEC:
-		vfe31_ctrl->outpath.output_mode =
-			VFE31_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
-		vfe31_ctrl->outpath.output_mode |=
-			VFE31_OUTPUT_MODE_SECONDARY;
-		break;
-	default:
-		pr_err("%s Invalid AXI mode %d ", __func__, mode);
-		return -EINVAL;
-	}
-
-	axi_cfg++;
-	msm_camera_io_memcpy(vfe31_ctrl->vfebase +
-		vfe31_cmd[VFE_CMD_AXI_OUT_CFG].offset, axi_cfg,
-		V31_AXI_BUS_CFG_LEN);
-	axi_cfg += V31_AXI_BUS_CFG_LEN/4;
-	for (i = 0; i < ARRAY_SIZE(vfe31_AXI_WM_CFG); i++) {
-		msm_camera_io_w(*axi_cfg,
-		vfe31_ctrl->vfebase+vfe31_AXI_WM_CFG[i]);
-		axi_cfg += 3;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase+vfe31_AXI_WM_CFG[i]+12,
-							axi_cfg, 12);
-		axi_cfg += 3;
-	}
-	msm_camera_io_w(bus_cmd, vfe31_ctrl->vfebase +
-					V31_AXI_BUS_CMD_OFF);
-
-	return 0;
-}
-
-static void vfe31_reset_internal_variables(void)
-{
-	unsigned long flags;
-	vfe31_ctrl->vfeImaskCompositePacked = 0;
-	/* state control variables */
-	vfe31_ctrl->start_ack_pending = FALSE;
-	atomic_set(&irq_cnt, 0);
-
-	spin_lock_irqsave(&vfe31_ctrl->stop_flag_lock, flags);
-	vfe31_ctrl->stop_ack_pending  = FALSE;
-	spin_unlock_irqrestore(&vfe31_ctrl->stop_flag_lock, flags);
-
-	vfe31_ctrl->reset_ack_pending  = FALSE;
-
-	spin_lock_irqsave(&vfe31_ctrl->update_ack_lock, flags);
-	vfe31_ctrl->update_ack_pending = FALSE;
-	spin_unlock_irqrestore(&vfe31_ctrl->update_ack_lock, flags);
-
-	vfe31_ctrl->recording_state = VFE_STATE_IDLE;
-	vfe31_ctrl->liveshot_state = VFE_STATE_IDLE;
-
-	atomic_set(&vfe31_ctrl->vstate, 0);
-
-	/* 0 for continuous mode, 1 for snapshot mode */
-	vfe31_ctrl->operation_mode = 0;
-	vfe31_ctrl->outpath.output_mode = 0;
-	vfe31_ctrl->vfe_capture_count = 0;
-
-	/* this is unsigned 32 bit integer. */
-	vfe31_ctrl->vfeFrameId = 0;
-	/* Stats control variables. */
-	memset(&(vfe31_ctrl->afStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe31_ctrl->awbStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe31_ctrl->aecStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe31_ctrl->ihistStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe31_ctrl->rsStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe31_ctrl->csStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	vfe31_ctrl->frame_skip_cnt = 31;
-	vfe31_ctrl->frame_skip_pattern = 0xffffffff;
-	vfe31_ctrl->snapshot_frame_cnt = 0;
-}
-
-static void vfe31_reset(void)
-{
-	vfe31_reset_internal_variables();
-	/* disable all interrupts.  vfeImaskLocal is also reset to 0
-	* to begin with. */
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_0);
-
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* clear all pending interrupts*/
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_IRQ_CMD);
-
-	/* enable reset_ack interrupt.  */
-	msm_camera_io_w(VFE_IMASK_WHILE_STOPPING_1,
-	vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* Write to VFE_GLOBAL_RESET_CMD to reset the vfe hardware. Once reset
-	 * is done, hardware interrupt will be generated.  VFE ist processes
-	 * the interrupt to complete the function call.  Note that the reset
-	 * function is synchronous. */
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(VFE_RESET_UPON_RESET_CMD,
-		vfe31_ctrl->vfebase + VFE_GLOBAL_RESET);
-}
-
-static int vfe31_operation_config(uint32_t *cmd)
-{
-	uint32_t *p = cmd;
-
-	vfe31_ctrl->operation_mode = *p;
-	vfe31_ctrl->stats_comp = *(++p);
-	vfe31_ctrl->hfr_mode = *(++p);
-
-	msm_camera_io_w(*(++p), vfe31_ctrl->vfebase + VFE_CFG);
-	msm_camera_io_w(*(++p), vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-	msm_camera_io_w(*(++p), vfe31_ctrl->vfebase + VFE_REALIGN_BUF);
-	msm_camera_io_w(*(++p), vfe31_ctrl->vfebase + VFE_CHROMA_UP);
-	msm_camera_io_w(*(++p), vfe31_ctrl->vfebase + VFE_STATS_CFG);
-	return 0;
-}
-
-static void msm_camera_io_dump2(void __iomem *addr, int size)
-{
-	char line_str[BUFF_SIZE_128], *p_str;
-	int i;
-	u32 *p = (u32 *) addr;
-	u32 data;
-	CDBG("%s: %p %d\n", __func__, addr, size);
-	line_str[0] = '\0';
-	p_str = line_str;
-	for (i = 0; i < size/4; i++) {
-		if (i % 4 == 0) {
-			snprintf(p_str, 12, "%08x: ", (u32) p);
-			p_str += 10;
-		}
-		data = readl_relaxed(p++);
-		snprintf(p_str, 12, "%08x ", data);
-		p_str += 9;
-		if ((i + 1) % 4 == 0) {
-			CDBG("%s\n", line_str);
-			line_str[0] = '\0';
-			p_str = line_str;
-		}
-	}
-	if (line_str[0] != '\0')
-		CDBG("%s\n", line_str);
-}
-
-static void vfe31_start_common(void)
-{
-	uint32_t irq_mask = 0x00E00021;
-	vfe31_ctrl->start_ack_pending = TRUE;
-	CDBG("VFE opertaion mode = 0x%x, output mode = 0x%x\n",
-		vfe31_ctrl->operation_mode, vfe31_ctrl->outpath.output_mode);
-	if (vfe31_ctrl->stats_comp)
-		irq_mask |= VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK;
-	else
-		irq_mask |= 0x000FE000;
-
-	msm_camera_io_w(irq_mask, vfe31_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(VFE_IMASK_WHILE_STOPPING_1,
-		vfe31_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_CAMIF_COMMAND);
-
-	msm_camera_io_dump2(vfe31_ctrl->vfebase, vfe31_ctrl->register_total*4);
-	atomic_set(&vfe31_ctrl->vstate, 1);
-}
-
-static int vfe31_start_recording(struct msm_cam_media_controller *pmctl)
-{
-	msm_camio_bus_scale_cfg(
-		pmctl->sdata->pdata->cam_bus_scale_table, S_VIDEO);
-	vfe31_ctrl->recording_state = VFE_STATE_START_REQUESTED;
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	return 0;
-}
-
-static int vfe31_stop_recording(struct msm_cam_media_controller *pmctl)
-{
-	vfe31_ctrl->recording_state = VFE_STATE_STOP_REQUESTED;
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	msm_camio_bus_scale_cfg(
-		pmctl->sdata->pdata->cam_bus_scale_table, S_PREVIEW);
-	return 0;
-}
-
-static void vfe31_start_liveshot(struct msm_cam_media_controller *pmctl)
-{
-	/* Hardcode 1 live snapshot for now. */
-	vfe31_ctrl->outpath.out0.capture_cnt = 1;
-	vfe31_ctrl->vfe_capture_count = vfe31_ctrl->outpath.out0.capture_cnt;
-
-	vfe31_ctrl->liveshot_state = VFE_STATE_START_REQUESTED;
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-static int vfe31_zsl(struct msm_cam_media_controller *pmctl)
-{
-	uint32_t irq_comp_mask = 0;
-	/* capture command is valid for both idle and active state. */
-	irq_comp_mask	=
-		msm_camera_io_r(vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-
-	CDBG("%s:op mode %d O/P Mode %d\n", __func__,
-		vfe31_ctrl->operation_mode, vfe31_ctrl->outpath.output_mode);
-
-	if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_PRIMARY) {
-		irq_comp_mask |= ((0x1 << (vfe31_ctrl->outpath.out0.ch0)) |
-			(0x1 << (vfe31_ctrl->outpath.out0.ch1)));
-	} else if (vfe31_ctrl->outpath.output_mode &
-		VFE31_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-		irq_comp_mask |= ((0x1 << (vfe31_ctrl->outpath.out0.ch0)) |
-			(0x1 << (vfe31_ctrl->outpath.out0.ch1)) |
-			(0x1 << (vfe31_ctrl->outpath.out0.ch2)));
-	}
-
-	if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_SECONDARY) {
-		irq_comp_mask |= ((0x1 << (vfe31_ctrl->outpath.out1.ch0 + 8)) |
-			(0x1 << (vfe31_ctrl->outpath.out1.ch1 + 8)));
-	} else if (vfe31_ctrl->outpath.output_mode &
-		VFE31_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-		irq_comp_mask |= ((0x1 << (vfe31_ctrl->outpath.out1.ch0 + 8)) |
-			(0x1 << (vfe31_ctrl->outpath.out1.ch1 + 8)) |
-			(0x1 << (vfe31_ctrl->outpath.out1.ch2 + 8)));
-	}
-
-	if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_PRIMARY) {
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-	} else if (vfe31_ctrl->outpath.output_mode &
-		VFE31_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch2]);
-	}
-
-	if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_SECONDARY) {
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch0]);
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch1]);
-	} else if (vfe31_ctrl->outpath.output_mode &
-		VFE31_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch0]);
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch1]);
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch2]);
-	}
-
-	msm_camera_io_w(irq_comp_mask, vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-	vfe31_start_common();
-	msm_camio_bus_scale_cfg(
-		pmctl->sdata->pdata->cam_bus_scale_table, S_ZSL);
-
-	msm_camera_io_w(1, vfe31_ctrl->vfebase + 0x18C);
-	msm_camera_io_w(1, vfe31_ctrl->vfebase + 0x188);
-	return 0;
-}
-static int vfe31_capture_raw(
-	struct msm_cam_media_controller *pmctl,
-	uint32_t num_frames_capture)
-{
-	uint32_t irq_comp_mask = 0;
-
-	vfe31_ctrl->outpath.out0.capture_cnt = num_frames_capture;
-	vfe31_ctrl->vfe_capture_count = num_frames_capture;
-
-	irq_comp_mask =
-		msm_camera_io_r(vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-
-	if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_PRIMARY) {
-		irq_comp_mask |= (0x1 << (vfe31_ctrl->outpath.out0.ch0));
-		msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-	}
-
-	msm_camera_io_w(irq_comp_mask, vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-	msm_camio_bus_scale_cfg(
-		pmctl->sdata->pdata->cam_bus_scale_table, S_CAPTURE);
-	vfe31_start_common();
-	return 0;
-}
-
-static int vfe31_capture(
-	struct msm_cam_media_controller *pmctl,
-	uint32_t num_frames_capture)
-{
-	uint32_t irq_comp_mask = 0;
-	/* capture command is valid for both idle and active state. */
-	vfe31_ctrl->outpath.out1.capture_cnt = num_frames_capture;
-	if (vfe31_ctrl->operation_mode == VFE_OUTPUTS_MAIN_AND_THUMB ||
-		vfe31_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_MAIN ||
-		vfe31_ctrl->operation_mode == VFE_OUTPUTS_JPEG_AND_THUMB ||
-		vfe31_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_JPEG) {
-		vfe31_ctrl->outpath.out0.capture_cnt =
-			num_frames_capture;
-	}
-
-	vfe31_ctrl->vfe_capture_count = num_frames_capture;
-	irq_comp_mask = msm_camera_io_r(
-				vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-
-	if (vfe31_ctrl->operation_mode == VFE_OUTPUTS_MAIN_AND_THUMB ||
-		vfe31_ctrl->operation_mode == VFE_OUTPUTS_JPEG_AND_THUMB ||
-		vfe31_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_MAIN) {
-		if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_PRIMARY) {
-			irq_comp_mask |= (0x1 << vfe31_ctrl->outpath.out0.ch0 |
-				0x1 << vfe31_ctrl->outpath.out0.ch1);
-		}
-		if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_SECONDARY) {
-			irq_comp_mask |=
-				(0x1 << (vfe31_ctrl->outpath.out1.ch0 + 8) |
-				0x1 << (vfe31_ctrl->outpath.out1.ch1 + 8));
-		}
-		if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_PRIMARY) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-		}
-		if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_SECONDARY) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch1]);
-		}
-	}
-
-	vfe31_ctrl->vfe_capture_count = num_frames_capture;
-
-	msm_camera_io_w(irq_comp_mask, vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-	msm_camera_io_r(vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-	msm_camio_bus_scale_cfg(
-		pmctl->sdata->pdata->cam_bus_scale_table, S_CAPTURE);
-
-	vfe31_start_common();
-	/* for debug */
-	msm_camera_io_w(1, vfe31_ctrl->vfebase + 0x18C);
-	msm_camera_io_w(1, vfe31_ctrl->vfebase + 0x188);
-	return 0;
-}
-
-static int vfe31_start(struct msm_cam_media_controller *pmctl)
-{
-	uint32_t irq_comp_mask = 0;
-
-	irq_comp_mask	=
-		msm_camera_io_r(vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-
-	if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_PRIMARY) {
-		irq_comp_mask |= (0x1 << vfe31_ctrl->outpath.out0.ch0 |
-			0x1 << vfe31_ctrl->outpath.out0.ch1);
-	} else if (vfe31_ctrl->outpath.output_mode &
-		VFE31_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-		irq_comp_mask |= (0x1 << vfe31_ctrl->outpath.out0.ch0 |
-			0x1 << vfe31_ctrl->outpath.out0.ch1 |
-			0x1 << vfe31_ctrl->outpath.out0.ch2);
-	}
-	if (vfe31_ctrl->outpath.output_mode & VFE31_OUTPUT_MODE_SECONDARY) {
-		irq_comp_mask |= (0x1 << (vfe31_ctrl->outpath.out1.ch0 + 8) |
-			0x1 << (vfe31_ctrl->outpath.out1.ch1 + 8));
-	} else if (vfe31_ctrl->outpath.output_mode &
-		VFE31_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-		irq_comp_mask |= (0x1 << (vfe31_ctrl->outpath.out1.ch0 + 8) |
-			0x1 << (vfe31_ctrl->outpath.out1.ch1 + 8) |
-			0x1 << (vfe31_ctrl->outpath.out1.ch2 + 8));
-	}
-	msm_camera_io_w(irq_comp_mask, vfe31_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-
-	switch (vfe31_ctrl->operation_mode) {
-	case VFE_OUTPUTS_PREVIEW:
-	case VFE_OUTPUTS_PREVIEW_AND_VIDEO:
-		if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_PRIMARY) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-		} else if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch2]);
-		}
-		break;
-	default:
-		if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_SECONDARY) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch1]);
-		} else if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch1]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch2]);
-		}
-		break;
-	}
-	msm_camio_bus_scale_cfg(
-		pmctl->sdata->pdata->cam_bus_scale_table, S_PREVIEW);
-	vfe31_start_common();
-	return 0;
-}
-
-static void vfe31_update(void)
-{
-	unsigned long flags;
-
-	if (vfe31_ctrl->update_la) {
-		if (!msm_camera_io_r(vfe31_ctrl->vfebase + V31_LA_OFF))
-			msm_camera_io_w(1, vfe31_ctrl->vfebase + V31_LA_OFF);
-		else
-			msm_camera_io_w(0, vfe31_ctrl->vfebase + V31_LA_OFF);
-		vfe31_ctrl->update_la = false;
-	}
-
-	if (vfe31_ctrl->update_gamma) {
-		if (!msm_camera_io_r(vfe31_ctrl->vfebase + V31_RGB_G_OFF))
-			msm_camera_io_w(7, vfe31_ctrl->vfebase+V31_RGB_G_OFF);
-		else
-			msm_camera_io_w(0, vfe31_ctrl->vfebase+V31_RGB_G_OFF);
-		vfe31_ctrl->update_gamma = false;
-	}
-
-	spin_lock_irqsave(&vfe31_ctrl->update_ack_lock, flags);
-	vfe31_ctrl->update_ack_pending = TRUE;
-	spin_unlock_irqrestore(&vfe31_ctrl->update_ack_lock, flags);
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	return;
-}
-
-static void vfe31_sync_timer_stop(void)
-{
-	uint32_t value = 0;
-	vfe31_ctrl->sync_timer_state = 0;
-	if (vfe31_ctrl->sync_timer_number == 0)
-		value = 0x10000;
-	else if (vfe31_ctrl->sync_timer_number == 1)
-		value = 0x20000;
-	else if (vfe31_ctrl->sync_timer_number == 2)
-		value = 0x40000;
-
-	/* Timer Stop */
-	msm_camera_io_w(value, vfe31_ctrl->vfebase + V31_SYNC_TIMER_OFF);
-}
-
-static void vfe31_sync_timer_start(const uint32_t *tbl)
-{
-	/* set bit 8 for auto increment. */
-	uint32_t value = 1;
-	uint32_t val;
-
-	vfe31_ctrl->sync_timer_state = *tbl++;
-	vfe31_ctrl->sync_timer_repeat_count = *tbl++;
-	vfe31_ctrl->sync_timer_number = *tbl++;
-	CDBG("%s timer_state %d, repeat_cnt %d timer number %d\n",
-		 __func__, vfe31_ctrl->sync_timer_state,
-		 vfe31_ctrl->sync_timer_repeat_count,
-		 vfe31_ctrl->sync_timer_number);
-
-	if (vfe31_ctrl->sync_timer_state) { /* Start Timer */
-		value = value << vfe31_ctrl->sync_timer_number;
-	} else { /* Stop Timer */
-		CDBG("Failed to Start timer\n");
-		return;
-	}
-
-	/* Timer Start */
-	msm_camera_io_w(value, vfe31_ctrl->vfebase + V31_SYNC_TIMER_OFF);
-	/* Sync Timer Line Start */
-	value = *tbl++;
-	msm_camera_io_w(value, vfe31_ctrl->vfebase + V31_SYNC_TIMER_OFF +
-		4 + ((vfe31_ctrl->sync_timer_number) * 12));
-	/* Sync Timer Pixel Start */
-	value = *tbl++;
-	msm_camera_io_w(value, vfe31_ctrl->vfebase + V31_SYNC_TIMER_OFF +
-		 8 + ((vfe31_ctrl->sync_timer_number) * 12));
-	/* Sync Timer Pixel Duration */
-	value = *tbl++;
-	val = vfe_clk_rate / 10000;
-	val = 10000000 / val;
-	val = value * 10000 / val;
-	CDBG("%s: Pixel Clk Cycles!!! %d\n", __func__, val);
-	msm_camera_io_w(val, vfe31_ctrl->vfebase + V31_SYNC_TIMER_OFF +
-		12 + ((vfe31_ctrl->sync_timer_number) * 12));
-	/* Timer0 Active High/LOW */
-	value = *tbl++;
-	msm_camera_io_w(value,
-		vfe31_ctrl->vfebase + V31_SYNC_TIMER_POLARITY_OFF);
-	/* Selects sync timer 0 output to drive onto timer1 port */
-	value = 0;
-	msm_camera_io_w(value, vfe31_ctrl->vfebase + V31_TIMER_SELECT_OFF);
-}
-
-static void vfe31_program_dmi_cfg(enum VFE31_DMI_RAM_SEL bankSel)
-{
-	/* set bit 8 for auto increment. */
-	uint32_t value = VFE_DMI_CFG_DEFAULT;
-	value += (uint32_t)bankSel;
-	CDBG("%s: banksel = %d\n", __func__, bankSel);
-
-	msm_camera_io_w(value, vfe31_ctrl->vfebase + VFE_DMI_CFG);
-	/* by default, always starts with offset 0.*/
-	msm_camera_io_w(0, vfe31_ctrl->vfebase + VFE_DMI_ADDR);
-}
-static void vfe31_write_gamma_cfg(enum VFE31_DMI_RAM_SEL channel_sel,
-						const uint32_t *tbl)
-{
-	int i;
-	uint32_t value, value1, value2;
-	vfe31_program_dmi_cfg(channel_sel);
-	for (i = 0 ; i < (VFE31_GAMMA_NUM_ENTRIES/2) ; i++) {
-		value = *tbl++;
-		value1 = value & 0x0000FFFF;
-		value2 = (value & 0xFFFF0000)>>16;
-		msm_camera_io_w((value1),
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-		msm_camera_io_w((value2),
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-	}
-	vfe31_program_dmi_cfg(NO_MEM_SELECTED);
-}
-
-static void vfe31_read_gamma_cfg(enum VFE31_DMI_RAM_SEL channel_sel,
-	uint32_t *tbl)
-{
-	int i;
-	vfe31_program_dmi_cfg(channel_sel);
-	CDBG("%s: Gamma table channel: %d\n", __func__, channel_sel);
-	for (i = 0 ; i < VFE31_GAMMA_NUM_ENTRIES ; i++) {
-		*tbl = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-		CDBG("%s: %08x\n", __func__, *tbl);
-		tbl++;
-	}
-	vfe31_program_dmi_cfg(NO_MEM_SELECTED);
-}
-
-static void vfe31_write_la_cfg(enum VFE31_DMI_RAM_SEL channel_sel,
-						const uint32_t *tbl)
-{
-	uint32_t i;
-	uint32_t value, value1, value2;
-
-	vfe31_program_dmi_cfg(channel_sel);
-	for (i = 0 ; i < (VFE31_LA_TABLE_LENGTH/2) ; i++) {
-		value = *tbl++;
-		value1 = value & 0x0000FFFF;
-		value2 = (value & 0xFFFF0000)>>16;
-		msm_camera_io_w((value1),
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-		msm_camera_io_w((value2),
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-	}
-	vfe31_program_dmi_cfg(NO_MEM_SELECTED);
-}
-
-static struct vfe31_output_ch *vfe31_get_ch(int path)
-{
-	struct vfe31_output_ch *ch = NULL;
-
-	if (path == VFE_MSG_OUTPUT_PRIMARY)
-		ch = &vfe31_ctrl->outpath.out0;
-	else if (path == VFE_MSG_OUTPUT_SECONDARY)
-		ch = &vfe31_ctrl->outpath.out1;
-	else
-		pr_err("%s: Invalid path %d\n", __func__, path);
-
-	BUG_ON(ch == NULL);
-	return ch;
-}
-static struct msm_free_buf *vfe31_check_free_buffer(int id, int path)
-{
-	struct vfe31_output_ch *outch = NULL;
-	struct msm_free_buf *b = NULL;
-	uint32_t inst_handle = 0;
-
-	if (path == VFE_MSG_OUTPUT_PRIMARY)
-		inst_handle = vfe31_ctrl->outpath.out0.inst_handle;
-	else
-		inst_handle = vfe31_ctrl->outpath.out1.inst_handle;
-
-	vfe31_subdev_notify(id, path, inst_handle);
-	outch = vfe31_get_ch(path);
-	if (outch->free_buf.ch_paddr[0])
-		b = &outch->free_buf;
-	return b;
-}
-static int vfe31_configure_pingpong_buffers(int id, int path)
-{
-	struct vfe31_output_ch *outch = NULL;
-	int rc = 0;
-	uint32_t inst_handle = 0;
-
-	if (path == VFE_MSG_OUTPUT_PRIMARY)
-		inst_handle = vfe31_ctrl->outpath.out0.inst_handle;
-	else
-		inst_handle = vfe31_ctrl->outpath.out1.inst_handle;
-
-	vfe31_subdev_notify(id, path, inst_handle);
-	outch = vfe31_get_ch(path);
-	if (outch->ping.ch_paddr[0] && outch->pong.ch_paddr[0]) {
-		/* Configure Preview Ping Pong */
-		CDBG("%s Configure ping/pong address for %d",
-			__func__, path);
-		vfe31_put_ch_ping_addr(outch->ch0,
-			outch->ping.ch_paddr[0]);
-		vfe31_put_ch_pong_addr(outch->ch0,
-			outch->pong.ch_paddr[0]);
-
-		if (vfe31_ctrl->operation_mode !=
-			VFE_OUTPUTS_RAW) {
-			vfe31_put_ch_ping_addr(outch->ch1,
-				outch->ping.ch_paddr[1]);
-			vfe31_put_ch_pong_addr(outch->ch1,
-				outch->pong.ch_paddr[1]);
-		}
-
-		if (outch->ping.num_planes > 2)
-			vfe31_put_ch_ping_addr(outch->ch2,
-				outch->ping.ch_paddr[2]);
-		if (outch->pong.num_planes > 2)
-			vfe31_put_ch_pong_addr(outch->ch2,
-				outch->pong.ch_paddr[2]);
-
-		/* avoid stale info */
-		memset(&outch->ping, 0, sizeof(struct msm_free_buf));
-		memset(&outch->pong, 0, sizeof(struct msm_free_buf));
-	} else {
-		pr_err("%s ping/pong addr is null!!", __func__);
-		rc = -EINVAL;
-	}
-	return rc;
-}
-
-static void vfe31_send_isp_msg(struct vfe31_ctrl_type *vctrl,
-	uint32_t isp_msg_id)
-{
-	struct isp_msg_event isp_msg_evt;
-
-	isp_msg_evt.msg_id = isp_msg_id;
-	isp_msg_evt.sof_count = vfe31_ctrl->vfeFrameId;
-	v4l2_subdev_notify(&vctrl->subdev,
-		NOTIFY_ISP_MSG_EVT, (void *)&isp_msg_evt);
-}
-
-static int vfe31_proc_general(
-	struct msm_cam_media_controller *pmctl,
-	struct msm_isp_cmd *cmd)
-{
-	int i , rc = 0;
-	uint32_t old_val = 0 , new_val = 0;
-	uint32_t *cmdp = NULL;
-	uint32_t *cmdp_local = NULL;
-	uint32_t snapshot_cnt = 0;
-	uint32_t temp1 = 0, temp2 = 0;
-
-	CDBG("vfe31_proc_general: cmdID = %s, length = %d\n",
-		vfe31_general_cmd[cmd->id], cmd->length);
-	switch (cmd->id) {
-	case VFE_CMD_RESET:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		vfe31_reset();
-		break;
-	case VFE_CMD_START:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		if ((vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_PREVIEW_AND_VIDEO) ||
-			(vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_PREVIEW))
-			/* Configure primary channel */
-			rc = vfe31_configure_pingpong_buffers(
-				VFE_MSG_START, VFE_MSG_OUTPUT_PRIMARY);
-		else
-			/* Configure secondary channel */
-			rc = vfe31_configure_pingpong_buffers(
-				VFE_MSG_START, VFE_MSG_OUTPUT_SECONDARY);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers"
-				" for preview", __func__);
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		rc = vfe31_start(pmctl);
-		break;
-	case VFE_CMD_UPDATE:
-		vfe31_update();
-		break;
-	case VFE_CMD_CAPTURE_RAW:
-		pr_info("%s: cmdID = VFE_CMD_CAPTURE_RAW\n", __func__);
-		if (copy_from_user(&snapshot_cnt, (void __user *)(cmd->value),
-			sizeof(uint32_t))) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe31_configure_pingpong_buffers(VFE_MSG_CAPTURE,
-			VFE_MSG_OUTPUT_PRIMARY);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers"
-				" for snapshot", __func__);
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		rc = vfe31_capture_raw(pmctl, snapshot_cnt);
-		break;
-	case VFE_CMD_CAPTURE:
-		if (copy_from_user(&snapshot_cnt, (void __user *)(cmd->value),
-			sizeof(uint32_t))) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-
-		if (vfe31_ctrl->operation_mode == VFE_OUTPUTS_JPEG_AND_THUMB ||
-		vfe31_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_JPEG) {
-			if (snapshot_cnt != 1) {
-				pr_err("only support 1 inline snapshot\n");
-				rc = -EINVAL;
-				goto proc_general_done;
-			}
-			/* Configure primary channel for JPEG */
-			rc = vfe31_configure_pingpong_buffers(
-				VFE_MSG_JPEG_CAPTURE,
-				VFE_MSG_OUTPUT_PRIMARY);
-		} else {
-			/* Configure primary channel */
-			rc = vfe31_configure_pingpong_buffers(
-				VFE_MSG_CAPTURE,
-				VFE_MSG_OUTPUT_PRIMARY);
-		}
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers"
-				" for primary output", __func__);
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		/* Configure secondary channel */
-		rc = vfe31_configure_pingpong_buffers(VFE_MSG_CAPTURE,
-			VFE_MSG_OUTPUT_SECONDARY);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers"
-				" for secondary output", __func__);
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		rc = vfe31_capture(pmctl, snapshot_cnt);
-		break;
-	case VFE_CMD_START_RECORDING:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		if (copy_from_user(&temp1, (void __user *)(cmd->value),
-				sizeof(uint32_t))) {
-			pr_err("%s Error copying inst_handle for recording\n",
-				__func__);
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		if (vfe31_ctrl->operation_mode ==
-			VFE_OUTPUTS_PREVIEW_AND_VIDEO) {
-			vfe31_ctrl->outpath.out1.inst_handle = temp1;
-			rc = vfe31_configure_pingpong_buffers(
-				VFE_MSG_START_RECORDING,
-				VFE_MSG_OUTPUT_SECONDARY);
-		} else if (vfe31_ctrl->operation_mode ==
-			VFE_OUTPUTS_VIDEO_AND_PREVIEW) {
-			vfe31_ctrl->outpath.out0.inst_handle = temp1;
-			rc = vfe31_configure_pingpong_buffers(
-				VFE_MSG_START_RECORDING,
-				VFE_MSG_OUTPUT_PRIMARY);
-		}
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers"
-				" for video", __func__);
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		rc = vfe31_start_recording(pmctl);
-		break;
-	case VFE_CMD_STOP_RECORDING:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		rc = vfe31_stop_recording(pmctl);
-		break;
-	case VFE_CMD_OPERATION_CFG:
-		if (cmd->length != V31_OPERATION_CFG_LEN) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(V31_OPERATION_CFG_LEN, GFP_ATOMIC);
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			V31_OPERATION_CFG_LEN)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe31_operation_config(cmdp);
-		break;
-
-	case VFE_CMD_STATS_AE_START:
-		rc = vfe_stats_aec_buf_init(NULL);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of AEC",
-				__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= AE_BG_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-		cmdp, (vfe31_cmd[cmd->id].length));
-		break;
-	case VFE_CMD_STATS_AF_START:
-		rc = vfe_stats_af_buf_init(NULL);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of AF",
-				__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= AF_BF_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-		cmdp, (vfe31_cmd[cmd->id].length));
-		break;
-	case VFE_CMD_STATS_AWB_START:
-		rc = vfe_stats_awb_buf_init(NULL);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of AWB",
-				__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= AWB_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		break;
-
-	case VFE_CMD_STATS_IHIST_START:
-		rc = vfe_stats_ihist_buf_init(NULL);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of IHIST",
-			__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= IHIST_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		break;
-
-	case VFE_CMD_STATS_RS_START:
-		rc = vfe_stats_rs_buf_init(NULL);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of RS",
-				__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		break;
-
-	case VFE_CMD_STATS_CS_START:
-		rc = vfe_stats_cs_buf_init(NULL);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of CS",
-				__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		break;
-
-	case VFE_CMD_MCE_UPDATE:
-	case VFE_CMD_MCE_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		/* Incrementing with 4 so as to point to the 2nd Register as
-		the 2nd register has the mce_enable bit */
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			V31_CHROMA_SUP_OFF + 4);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-		old_val &= MCE_EN_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + V31_CHROMA_SUP_OFF + 4,
-			&new_val, 4);
-		cmdp_local += 1;
-
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			V31_CHROMA_SUP_OFF + 8);
-		new_val = *cmdp_local;
-		old_val &= MCE_Q_K_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + V31_CHROMA_SUP_OFF + 8,
-			&new_val, 4);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp_local, (vfe31_cmd[cmd->id].length));
-		break;
-	case VFE_CMD_CHROMA_SUP_UPDATE:
-	case VFE_CMD_CHROMA_SUP_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_CHROMA_SUP_OFF,
-			cmdp_local, 4);
-
-		cmdp_local += 1;
-		new_val = *cmdp_local;
-		/* Incrementing with 4 so as to point to the 2nd Register as
-		 * the 2nd register has the mce_enable bit
-		 */
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			V31_CHROMA_SUP_OFF + 4);
-		old_val &= ~MCE_EN_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + V31_CHROMA_SUP_OFF + 4,
-			&new_val, 4);
-		cmdp_local += 1;
-
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			V31_CHROMA_SUP_OFF + 8);
-		new_val = *cmdp_local;
-		old_val &= ~MCE_Q_K_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + V31_CHROMA_SUP_OFF + 8,
-			&new_val, 4);
-		break;
-
-	case VFE_CMD_MESH_ROLL_OFF_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value) , cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp_local, 16);
-		cmdp_local += 4;
-		vfe31_program_dmi_cfg(ROLLOFF_RAM);
-		/* for loop for extrcting init table. */
-		for (i = 0; i < (V31_MESH_ROLL_OFF_INIT_TABLE_SIZE * 2); i++) {
-			msm_camera_io_w(*cmdp_local ,
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-			cmdp_local++;
-		}
-		CDBG("done writing init table\n");
-		/* by default, always starts with offset 0. */
-		msm_camera_io_w(V31_MESH_ROLL_OFF_DELTA_TABLE_OFFSET,
-		vfe31_ctrl->vfebase + VFE_DMI_ADDR);
-		/* for loop for extracting delta table. */
-		for (i = 0; i < (V31_MESH_ROLL_OFF_DELTA_TABLE_SIZE * 2); i++) {
-			msm_camera_io_w(*cmdp_local,
-			vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-			cmdp_local++;
-		}
-		vfe31_program_dmi_cfg(NO_MEM_SELECTED);
-		break;
-
-	case VFE_CMD_GET_MESH_ROLLOFF_TABLE:
-		temp1 = sizeof(uint32_t) * ((V31_MESH_ROLL_OFF_INIT_TABLE_SIZE *
-			2) + (V31_MESH_ROLL_OFF_DELTA_TABLE_SIZE * 2));
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kzalloc(temp1, GFP_KERNEL);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		vfe31_program_dmi_cfg(ROLLOFF_RAM);
-		CDBG("%s: Mesh Rolloff init Table\n", __func__);
-		for (i = 0; i < (V31_MESH_ROLL_OFF_INIT_TABLE_SIZE * 2); i++) {
-			*cmdp_local = msm_camera_io_r(
-					vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-			CDBG("%s: %08x\n", __func__, *cmdp_local);
-			cmdp_local++;
-		}
-		msm_camera_io_w(V31_MESH_ROLL_OFF_DELTA_TABLE_OFFSET,
-			vfe31_ctrl->vfebase + VFE_DMI_ADDR);
-		CDBG("%s: Mesh Rolloff Delta Table\n", __func__);
-		for (i = 0; i < (V31_MESH_ROLL_OFF_DELTA_TABLE_SIZE * 2); i++) {
-			*cmdp_local = msm_camera_io_r(
-					vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-			CDBG("%s: %08x\n", __func__, *cmdp_local);
-			cmdp_local++;
-		}
-		CDBG("done reading delta table\n");
-		vfe31_program_dmi_cfg(NO_MEM_SELECTED);
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_LA_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp_local, (vfe31_cmd[cmd->id].length));
-
-		cmdp_local += 1;
-		vfe31_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK0, cmdp_local);
-		break;
-
-	case VFE_CMD_LA_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-
-		cmdp_local = cmdp + 1;
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + V31_LA_OFF);
-		if (old_val != 0x0)
-			vfe31_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK0,
-				cmdp_local);
-		else
-			vfe31_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK1,
-				cmdp_local);
-		vfe31_ctrl->update_la = true;
-		break;
-
-	case VFE_CMD_GET_LA_TABLE:
-		temp1 = sizeof(uint32_t) * VFE31_LA_TABLE_LENGTH / 2;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kzalloc(temp1, GFP_KERNEL);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		if (msm_camera_io_r(vfe31_ctrl->vfebase + V31_LA_OFF))
-			vfe31_program_dmi_cfg(LUMA_ADAPT_LUT_RAM_BANK1);
-		else
-			vfe31_program_dmi_cfg(LUMA_ADAPT_LUT_RAM_BANK0);
-		for (i = 0 ; i < (VFE31_LA_TABLE_LENGTH / 2) ; i++) {
-			*cmdp_local = msm_camera_io_r(
-					vfe31_ctrl->vfebase + VFE_DMI_DATA_LO);
-			*cmdp_local |= (msm_camera_io_r(vfe31_ctrl->vfebase +
-				VFE_DMI_DATA_LO)) << 16;
-			cmdp_local++;
-		}
-		vfe31_program_dmi_cfg(NO_MEM_SELECTED);
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_SK_ENHAN_CFG:
-	case VFE_CMD_SK_ENHAN_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_SCE_OFF,
-			cmdp, V31_SCE_LEN);
-		break;
-
-	case VFE_CMD_LIVESHOT:
-		if (copy_from_user(&temp1, (void __user *)(cmd->value),
-				sizeof(uint32_t))) {
-			pr_err("%s Error copying inst_handle for liveshot ",
-				__func__);
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		vfe31_ctrl->outpath.out0.inst_handle = temp1;
-		/* Configure primary channel */
-		rc = vfe31_configure_pingpong_buffers(VFE_MSG_CAPTURE,
-			VFE_MSG_OUTPUT_PRIMARY);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers"
-				" for primary output", __func__);
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		vfe31_start_liveshot(pmctl);
-		break;
-
-	case VFE_CMD_DEMOSAICV3:
-		if (cmd->length != V31_DEMOSAICV3_LEN) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-				vfe31_ctrl->vfebase + V31_DEMOSAICV3_OFF);
-		old_val &= DEMOSAIC_MASK;
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_DEMOSAICV3_OFF,
-			cmdp_local, V31_DEMOSAICV3_LEN);
-		break;
-
-	case VFE_CMD_DEMOSAICV3_UPDATE:
-		if (cmd->length !=
-			V31_DEMOSAICV3_LEN * V31_DEMOSAICV3_UP_REG_CNT) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-				vfe31_ctrl->vfebase + V31_DEMOSAICV3_OFF);
-		old_val &= DEMOSAIC_MASK;
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_DEMOSAICV3_OFF,
-			cmdp_local, V31_DEMOSAICV3_LEN);
-
-		break;
-
-	case VFE_CMD_DEMOSAICV3_ABCC_CFG:
-		rc = -EFAULT;
-		break;
-
-	case VFE_CMD_DEMOSAICV3_ABF_UPDATE:/* 116 ABF update  */
-	case VFE_CMD_DEMOSAICV3_ABF_CFG: /* 108 ABF config  */
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-				vfe31_ctrl->vfebase + V31_DEMOSAICV3_OFF);
-		old_val &= ABF_MASK;
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_DEMOSAICV3_OFF,
-		    cmdp_local, 4);
-
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp_local, (vfe31_cmd[cmd->id].length));
-		break;
-
-	case VFE_CMD_DEMOSAICV3_DBCC_CFG:
-	case VFE_CMD_DEMOSAICV3_DBCC_UPDATE:
-		return -EINVAL;
-
-	case VFE_CMD_DEMOSAICV3_DBPC_CFG:
-	case VFE_CMD_DEMOSAICV3_DBPC_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-				vfe31_ctrl->vfebase + V31_DEMOSAICV3_OFF);
-		old_val &= BPC_MASK;
-
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_DEMOSAICV3_OFF,
-					cmdp_local, V31_DEMOSAICV3_LEN);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + V31_DEMOSAICV3_DBPC_CFG_OFF,
-			cmdp_local, V31_DEMOSAICV3_DBPC_LEN);
-		break;
-
-	case VFE_CMD_RGB_G_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(vfe31_ctrl->vfebase + V31_RGB_G_OFF,
-			cmdp, 4);
-		cmdp += 1;
-
-		vfe31_write_gamma_cfg(RGBLUT_RAM_CH0_BANK0, cmdp);
-		vfe31_write_gamma_cfg(RGBLUT_RAM_CH1_BANK0, cmdp);
-		vfe31_write_gamma_cfg(RGBLUT_RAM_CH2_BANK0, cmdp);
-		cmdp -= 1;
-		break;
-
-	case VFE_CMD_RGB_G_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + V31_RGB_G_OFF);
-		cmdp += 1;
-		if (old_val != 0x0) {
-			vfe31_write_gamma_cfg(RGBLUT_RAM_CH0_BANK0, cmdp);
-			vfe31_write_gamma_cfg(RGBLUT_RAM_CH1_BANK0, cmdp);
-			vfe31_write_gamma_cfg(RGBLUT_RAM_CH2_BANK0, cmdp);
-		} else {
-			vfe31_write_gamma_cfg(RGBLUT_RAM_CH0_BANK1, cmdp);
-			vfe31_write_gamma_cfg(RGBLUT_RAM_CH1_BANK1, cmdp);
-			vfe31_write_gamma_cfg(RGBLUT_RAM_CH2_BANK1, cmdp);
-		}
-		vfe31_ctrl->update_gamma = TRUE;
-		cmdp -= 1;
-		break;
-
-	case VFE_CMD_GET_RGB_G_TABLE:
-		temp1 = sizeof(uint32_t) * VFE31_GAMMA_NUM_ENTRIES * 3;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kzalloc(temp1, GFP_KERNEL);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + V31_RGB_G_OFF);
-		temp2 = old_val ? RGBLUT_RAM_CH0_BANK1 :
-			RGBLUT_RAM_CH0_BANK0;
-		for (i = 0; i < 3; i++) {
-			vfe31_read_gamma_cfg(temp2,
-				cmdp_local + (VFE31_GAMMA_NUM_ENTRIES * i));
-			temp2 += 2;
-		}
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-
-	case VFE_CMD_STATS_AWB_STOP:
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~AWB_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		break;
-	case VFE_CMD_STATS_AE_STOP:
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~AE_BG_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		break;
-	case VFE_CMD_STATS_AF_STOP:
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~AF_BF_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		rc = vfe31_stats_flush_enqueue(MSM_STATS_TYPE_AF);
-		if (rc < 0) {
-			pr_err("%s: dq stats buf err = %d",
-				   __func__, rc);
-			return -EINVAL;
-		}
-		break;
-
-	case VFE_CMD_STATS_IHIST_STOP:
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~IHIST_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		break;
-
-	case VFE_CMD_STATS_RS_STOP:
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~RS_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		break;
-
-	case VFE_CMD_STATS_CS_STOP:
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~CS_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		break;
-
-	case VFE_CMD_STOP:
-		pr_info("vfe31_proc_general: cmdID = %s\n",
-			vfe31_general_cmd[cmd->id]);
-		vfe31_stop();
-		break;
-
-	case VFE_CMD_SYNC_TIMER_SETTING:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		vfe31_sync_timer_start(cmdp);
-		break;
-
-	case VFE_CMD_MODULE_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		*cmdp &= ~STATS_ENABLE_MASK;
-		old_val = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= STATS_ENABLE_MASK;
-		*cmdp |= old_val;
-
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		break;
-
-	case VFE_CMD_ZSL:
-		rc = vfe31_configure_pingpong_buffers(VFE_MSG_START,
-			VFE_MSG_OUTPUT_PRIMARY);
-		if (rc < 0)
-			goto proc_general_done;
-		rc = vfe31_configure_pingpong_buffers(VFE_MSG_START,
-			VFE_MSG_OUTPUT_SECONDARY);
-		if (rc < 0)
-			goto proc_general_done;
-
-		rc = vfe31_zsl(pmctl);
-		break;
-
-	case VFE_CMD_ASF_CFG:
-	case VFE_CMD_ASF_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		cmdp_local = cmdp + V31_ASF_LEN/4;
-		break;
-
-	case VFE_CMD_GET_HW_VERSION:
-		if (cmd->length != V31_GET_HW_VERSION_LEN) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(V31_GET_HW_VERSION_LEN, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		*cmdp = msm_camera_io_r(
-				vfe31_ctrl->vfebase+V31_GET_HW_VERSION_OFF);
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			V31_GET_HW_VERSION_LEN)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_GET_REG_DUMP:
-		temp1 = sizeof(uint32_t) * vfe31_ctrl->register_total;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(temp1, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		msm_camera_io_dump(
-			vfe31_ctrl->vfebase, vfe31_ctrl->register_total*4);
-		CDBG("%s: %p %p %d\n", __func__, (void *)cmdp,
-			vfe31_ctrl->vfebase, temp1);
-		memcpy_fromio((void *)cmdp, vfe31_ctrl->vfebase, temp1);
-		if (copy_to_user((void __user *)(cmd->value), cmdp, temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_FRAME_SKIP_CFG:
-		if (cmd->length != vfe31_cmd[cmd->id].length)
-			return -EINVAL;
-
-		cmdp = kmalloc(vfe31_cmd[cmd->id].length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		vfe31_ctrl->frame_skip_cnt = ((uint32_t)
-			*cmdp & VFE_FRAME_SKIP_PERIOD_MASK) + 1;
-		vfe31_ctrl->frame_skip_pattern = (uint32_t)(*(cmdp + 2));
-		break;
-	default:
-		if (cmd->length != vfe31_cmd[cmd->id].length)
-			return -EINVAL;
-
-		cmdp = kmalloc(vfe31_cmd[cmd->id].length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe31_ctrl->vfebase + vfe31_cmd[cmd->id].offset,
-			cmdp, (vfe31_cmd[cmd->id].length));
-		break;
-
-	}
-
-proc_general_done:
-	kfree(cmdp);
-
-	return rc;
-}
-
-static inline void vfe31_read_irq_status(struct vfe31_irq_status *out)
-{
-	uint32_t *temp;
-	memset(out, 0, sizeof(struct vfe31_irq_status));
-	temp = (uint32_t *)(vfe31_ctrl->vfebase + VFE_IRQ_STATUS_0);
-	out->vfeIrqStatus0 = msm_camera_io_r(temp);
-
-	temp = (uint32_t *)(vfe31_ctrl->vfebase + VFE_IRQ_STATUS_1);
-	out->vfeIrqStatus1 = msm_camera_io_r(temp);
-
-	temp = (uint32_t *)(vfe31_ctrl->vfebase + VFE_CAMIF_STATUS);
-	out->camifStatus = msm_camera_io_r(temp);
-	CDBG("camifStatus  = 0x%x\n", out->camifStatus);
-
-	/* clear the pending interrupt of the same kind.*/
-	msm_camera_io_w(out->vfeIrqStatus0,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(out->vfeIrqStatus1,
-		vfe31_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_IRQ_CMD);
-
-}
-
-static void vfe31_process_reg_update_irq(void)
-{
-	unsigned long flags;
-
-	if (vfe31_ctrl->recording_state == VFE_STATE_START_REQUESTED) {
-		if (vfe31_ctrl->operation_mode ==
-			VFE_OUTPUTS_VIDEO_AND_PREVIEW) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-		} else if (vfe31_ctrl->operation_mode ==
-			VFE_OUTPUTS_PREVIEW_AND_VIDEO) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch1]);
-		}
-		vfe31_ctrl->recording_state = VFE_STATE_STARTED;
-		msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-		CDBG("start video triggered .\n");
-	} else if (vfe31_ctrl->recording_state ==
-		VFE_STATE_STOP_REQUESTED) {
-		if (vfe31_ctrl->operation_mode ==
-			VFE_OUTPUTS_VIDEO_AND_PREVIEW) {
-			msm_camera_io_w(0, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(0, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-		} else if (vfe31_ctrl->operation_mode ==
-			VFE_OUTPUTS_PREVIEW_AND_VIDEO) {
-			msm_camera_io_w(0, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(0, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out1.ch1]);
-		}
-		CDBG("stop video triggered .\n");
-	}
-
-	if (vfe31_ctrl->start_ack_pending == TRUE) {
-		vfe31_send_isp_msg(vfe31_ctrl, MSG_ID_START_ACK);
-		vfe31_ctrl->start_ack_pending = FALSE;
-	} else {
-		if (vfe31_ctrl->recording_state ==
-			VFE_STATE_STOP_REQUESTED) {
-			vfe31_ctrl->recording_state = VFE_STATE_STOPPED;
-			/* request a reg update and send STOP_REC_ACK
-			 * when we process the next reg update irq.
-			 */
-			msm_camera_io_w_mb(1,
-			vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-		} else if (vfe31_ctrl->recording_state ==
-			VFE_STATE_STOPPED) {
-			vfe31_send_isp_msg(vfe31_ctrl, MSG_ID_STOP_REC_ACK);
-			vfe31_ctrl->recording_state = VFE_STATE_IDLE;
-		}
-		spin_lock_irqsave(&vfe31_ctrl->update_ack_lock, flags);
-		if (vfe31_ctrl->update_ack_pending == TRUE) {
-			vfe31_ctrl->update_ack_pending = FALSE;
-			spin_unlock_irqrestore(
-				&vfe31_ctrl->update_ack_lock, flags);
-			vfe31_send_isp_msg(vfe31_ctrl, MSG_ID_UPDATE_ACK);
-		} else {
-			spin_unlock_irqrestore(
-				&vfe31_ctrl->update_ack_lock, flags);
-		}
-	}
-
-	if (vfe31_ctrl->liveshot_state == VFE_STATE_START_REQUESTED) {
-		pr_info("%s enabling liveshot output\n", __func__);
-		if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_PRIMARY) {
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, vfe31_ctrl->vfebase +
-			vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-			vfe31_ctrl->liveshot_state = VFE_STATE_STARTED;
-		}
-	}
-
-	if (vfe31_ctrl->liveshot_state == VFE_STATE_STARTED) {
-		vfe31_ctrl->vfe_capture_count--;
-		if (!vfe31_ctrl->vfe_capture_count)
-			vfe31_ctrl->liveshot_state = VFE_STATE_STOP_REQUESTED;
-		msm_camera_io_w_mb(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	} else if (vfe31_ctrl->liveshot_state == VFE_STATE_STOP_REQUESTED) {
-		CDBG("%s: disabling liveshot output\n", __func__);
-		if (vfe31_ctrl->outpath.output_mode &
-			VFE31_OUTPUT_MODE_PRIMARY) {
-			msm_camera_io_w(0, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(0, vfe31_ctrl->vfebase +
-				vfe31_AXI_WM_CFG[vfe31_ctrl->outpath.out0.ch1]);
-			vfe31_ctrl->liveshot_state = VFE_STATE_STOPPED;
-			msm_camera_io_w_mb(1, vfe31_ctrl->vfebase +
-				VFE_REG_UPDATE_CMD);
-		}
-	} else if (vfe31_ctrl->liveshot_state == VFE_STATE_STOPPED) {
-		vfe31_ctrl->liveshot_state = VFE_STATE_IDLE;
-	}
-
-	if ((vfe31_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_MAIN) ||
-		(vfe31_ctrl->operation_mode == VFE_OUTPUTS_MAIN_AND_THUMB) ||
-		(vfe31_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_JPEG) ||
-		(vfe31_ctrl->operation_mode == VFE_OUTPUTS_JPEG_AND_THUMB)) {
-		/* in snapshot mode */
-		/* later we need to add check for live snapshot mode. */
-		if (vfe31_ctrl->frame_skip_pattern & (0x1 <<
-			(vfe31_ctrl->snapshot_frame_cnt %
-				vfe31_ctrl->frame_skip_cnt))) {
-			/* if last frame to be captured: */
-			if (vfe31_ctrl->vfe_capture_count == 0) {
-				/* stop the bus output:write master enable = 0*/
-				if (vfe31_ctrl->outpath.output_mode &
-					VFE31_OUTPUT_MODE_PRIMARY) {
-					msm_camera_io_w(0, vfe31_ctrl->vfebase +
-						vfe31_AXI_WM_CFG[vfe31_ctrl->
-						outpath.out0.ch0]);
-					msm_camera_io_w(0, vfe31_ctrl->vfebase +
-						vfe31_AXI_WM_CFG[vfe31_ctrl->
-						outpath.out0.ch1]);
-				}
-				if (vfe31_ctrl->outpath.output_mode &
-					VFE31_OUTPUT_MODE_SECONDARY) {
-					msm_camera_io_w(0, vfe31_ctrl->vfebase +
-						vfe31_AXI_WM_CFG[vfe31_ctrl->
-						outpath.out1.ch0]);
-					msm_camera_io_w(0, vfe31_ctrl->vfebase +
-						vfe31_AXI_WM_CFG[vfe31_ctrl->
-						outpath.out1.ch1]);
-				}
-				msm_camera_io_w_mb
-				(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-				vfe31_ctrl->vfebase + VFE_CAMIF_COMMAND);
-				vfe31_ctrl->snapshot_frame_cnt = -1;
-				vfe31_ctrl->frame_skip_cnt = 31;
-				vfe31_ctrl->frame_skip_pattern = 0xffffffff;
-			} /*if snapshot count is 0*/
-		} /*if frame is not being dropped*/
-		/* then do reg_update. */
-		msm_camera_io_w(1, vfe31_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	} /* if snapshot mode. */
-}
-
-static void vfe31_set_default_reg_values(void)
-{
-	msm_camera_io_w(0x800080, vfe31_ctrl->vfebase + VFE_DEMUX_GAIN_0);
-	msm_camera_io_w(0x800080, vfe31_ctrl->vfebase + VFE_DEMUX_GAIN_1);
-	/* What value should we program CGC_OVERRIDE to? */
-	msm_camera_io_w(0xFFFFF, vfe31_ctrl->vfebase + VFE_CGC_OVERRIDE);
-
-	/* default frame drop period and pattern */
-	msm_camera_io_w(0x1f, vfe31_ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_CFG);
-	msm_camera_io_w(0x1f, vfe31_ctrl->vfebase + VFE_FRAMEDROP_ENC_CBCR_CFG);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe31_ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe31_ctrl->vfebase + VFE_FRAMEDROP_ENC_CBCR_PATTERN);
-	msm_camera_io_w(0x1f, vfe31_ctrl->vfebase + VFE_FRAMEDROP_VIEW_Y);
-	msm_camera_io_w(0x1f, vfe31_ctrl->vfebase + VFE_FRAMEDROP_VIEW_CBCR);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe31_ctrl->vfebase + VFE_FRAMEDROP_VIEW_Y_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe31_ctrl->vfebase + VFE_FRAMEDROP_VIEW_CBCR_PATTERN);
-	msm_camera_io_w(0, vfe31_ctrl->vfebase + VFE_CLAMP_MIN);
-	msm_camera_io_w(0xFFFFFF, vfe31_ctrl->vfebase + VFE_CLAMP_MAX);
-
-	/* stats UB config */
-	msm_camera_io_w(0x3980007,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AEC_UB_CFG);
-	msm_camera_io_w(0x3A00007,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AF_UB_CFG);
-	msm_camera_io_w(0x3A8000F,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_AWB_UB_CFG);
-	msm_camera_io_w(0x3B80007,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_RS_UB_CFG);
-	msm_camera_io_w(0x3C0001F,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_CS_UB_CFG);
-	msm_camera_io_w(0x3E0001F,
-		vfe31_ctrl->vfebase + VFE_BUS_STATS_HIST_UB_CFG);
-}
-
-static void vfe31_process_reset_irq(void)
-{
-	unsigned long flags;
-
-	atomic_set(&vfe31_ctrl->vstate, 0);
-
-	spin_lock_irqsave(&vfe31_ctrl->stop_flag_lock, flags);
-	if (vfe31_ctrl->stop_ack_pending) {
-		vfe31_ctrl->stop_ack_pending = FALSE;
-		spin_unlock_irqrestore(&vfe31_ctrl->stop_flag_lock, flags);
-		vfe31_send_isp_msg(vfe31_ctrl, MSG_ID_STOP_ACK);
-	} else {
-		spin_unlock_irqrestore(&vfe31_ctrl->stop_flag_lock, flags);
-		/* this is from reset command. */
-		vfe31_set_default_reg_values();
-
-		/* reload all write masters. (frame & line)*/
-		msm_camera_io_w(0x7FFF, vfe31_ctrl->vfebase + VFE_BUS_CMD);
-		vfe31_send_isp_msg(vfe31_ctrl, MSG_ID_RESET_ACK);
-	}
-}
-
-static void vfe31_process_camif_sof_irq(void)
-{
-	if (vfe31_ctrl->operation_mode ==
-		VFE_OUTPUTS_RAW) {
-		if (vfe31_ctrl->start_ack_pending) {
-			vfe31_send_isp_msg(vfe31_ctrl, MSG_ID_START_ACK);
-			vfe31_ctrl->start_ack_pending = FALSE;
-		}
-		vfe31_ctrl->vfe_capture_count--;
-		/* if last frame to be captured: */
-		if (vfe31_ctrl->vfe_capture_count == 0) {
-			/* Ensure the write order while writing
-			 to the command register using the barrier */
-			msm_camera_io_w_mb(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-				vfe31_ctrl->vfebase + VFE_CAMIF_COMMAND);
-		}
-	} /* if raw snapshot mode. */
-	if ((vfe31_ctrl->hfr_mode != HFR_MODE_OFF) &&
-		(vfe31_ctrl->operation_mode == VFE_MODE_OF_OPERATION_VIDEO) &&
-		(vfe31_ctrl->vfeFrameId % vfe31_ctrl->hfr_mode != 0)) {
-		vfe31_ctrl->vfeFrameId++;
-		CDBG("Skip the SOF notification when HFR enabled\n");
-		return;
-	}
-	vfe31_ctrl->vfeFrameId++;
-	vfe31_send_isp_msg(vfe31_ctrl, MSG_ID_SOF_ACK);
-	CDBG("camif_sof_irq, frameId = %d\n", vfe31_ctrl->vfeFrameId);
-
-	if (vfe31_ctrl->sync_timer_state) {
-		if (vfe31_ctrl->sync_timer_repeat_count == 0)
-			vfe31_sync_timer_stop();
-		else
-			vfe31_ctrl->sync_timer_repeat_count--;
-	}
-	if ((vfe31_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_MAIN) ||
-		(vfe31_ctrl->operation_mode == VFE_OUTPUTS_MAIN_AND_THUMB) ||
-		(vfe31_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_JPEG) ||
-		(vfe31_ctrl->operation_mode == VFE_OUTPUTS_JPEG_AND_THUMB)) {
-		if (vfe31_ctrl->frame_skip_pattern & (0x1 <<
-			(vfe31_ctrl->snapshot_frame_cnt %
-				vfe31_ctrl->frame_skip_cnt))) {
-			vfe31_ctrl->vfe_capture_count--;
-		}
-		vfe31_ctrl->snapshot_frame_cnt++;
-	}
-}
-
-static void vfe31_process_error_irq(uint32_t errStatus)
-{
-	uint32_t reg_value, read_val;
-
-	if (errStatus & VFE31_IMASK_CAMIF_ERROR) {
-		pr_err("vfe31_irq: camif errors\n");
-		reg_value = msm_camera_io_r(
-				vfe31_ctrl->vfebase + VFE_CAMIF_STATUS);
-		pr_err("camifStatus  = 0x%x\n", reg_value);
-		vfe31_send_isp_msg(vfe31_ctrl, MSG_ID_CAMIF_ERROR);
-	}
-
-	if (errStatus & VFE31_IMASK_STATS_CS_OVWR)
-		pr_err("vfe31_irq: stats cs overwrite\n");
-
-	if (errStatus & VFE31_IMASK_STATS_IHIST_OVWR)
-		pr_err("vfe31_irq: stats ihist overwrite\n");
-
-	if (errStatus & VFE31_IMASK_REALIGN_BUF_Y_OVFL)
-		pr_err("vfe31_irq: realign bug Y overflow\n");
-
-	if (errStatus & VFE31_IMASK_REALIGN_BUF_CB_OVFL)
-		pr_err("vfe31_irq: realign bug CB overflow\n");
-
-	if (errStatus & VFE31_IMASK_REALIGN_BUF_CR_OVFL)
-		pr_err("vfe31_irq: realign bug CR overflow\n");
-
-	if (errStatus & VFE31_IMASK_VIOLATION)
-		pr_err("vfe31_irq: violation interrupt\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_0_BUS_OVFL)
-		pr_err("vfe31_irq: image master 0 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_1_BUS_OVFL)
-		pr_err("vfe31_irq: image master 1 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_2_BUS_OVFL)
-		pr_err("vfe31_irq: image master 2 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_3_BUS_OVFL)
-		pr_err("vfe31_irq: image master 3 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_4_BUS_OVFL)
-		pr_err("vfe31_irq: image master 4 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_5_BUS_OVFL)
-		pr_err("vfe31_irq: image master 5 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_IMG_MAST_6_BUS_OVFL)
-		pr_err("vfe31_irq: image master 6 bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_AE_BG_BUS_OVFL)
-		pr_err("vfe31_irq: ae/bg stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_AF_BF_BUS_OVFL)
-		pr_err("vfe31_irq: af/bf stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_AWB_BUS_OVFL)
-		pr_err("vfe31_irq: awb stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_RS_BUS_OVFL)
-		pr_err("vfe31_irq: rs stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_CS_BUS_OVFL)
-		pr_err("vfe31_irq: cs stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_IHIST_BUS_OVFL)
-		pr_err("vfe31_irq: ihist stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_STATS_SKIN_BHIST_BUS_OVFL)
-		pr_err("vfe31_irq: skin/bhist stats bus overflow\n");
-
-	if (errStatus & VFE31_IMASK_AXI_ERROR) {
-		pr_err("vfe31_irq: axi error\n");
-		/* read status too when overflow happens.*/
-		read_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_BUS_PING_PONG_STATUS);
-		pr_debug("VFE_BUS_PING_PONG_STATUS = 0x%x\n", read_val);
-		read_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_BUS_OPERATION_STATUS);
-		pr_debug("VFE_BUS_OPERATION_STATUS = 0x%x\n", read_val);
-		read_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_0);
-		pr_debug("VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_0 = 0x%x\n",
-			read_val);
-		read_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_1);
-		pr_debug("VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_1 = 0x%x\n",
-			read_val);
-		read_val = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_AXI_STATUS);
-		pr_debug("VFE_AXI_STATUS = 0x%x\n", read_val);
-	}
-}
-static void vfe_send_outmsg(struct v4l2_subdev *sd, uint8_t msgid,
-	uint32_t ch0_paddr, uint32_t ch1_paddr,
-	uint32_t ch2_paddr, uint32_t inst_handle)
-{
-	struct isp_msg_output msg;
-
-	msg.output_id		= msgid;
-	msg.buf.inst_handle	= inst_handle;
-	msg.buf.ch_paddr[0]	= ch0_paddr;
-	msg.buf.ch_paddr[1]	= ch1_paddr;
-	msg.buf.ch_paddr[2]	= ch2_paddr;
-	msg.frameCounter	= vfe31_ctrl->vfeFrameId;
-
-	v4l2_subdev_notify(&vfe31_ctrl->subdev,
-		NOTIFY_VFE_MSG_OUT, &msg);
-	return;
-}
-
-static void vfe31_process_output_path_irq_0(void)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr, ch1_paddr, ch2_paddr;
-	uint8_t out_bool = 0;
-	struct msm_free_buf *free_buf = NULL;
-
-	free_buf = vfe31_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-		VFE_MSG_OUTPUT_PRIMARY);
-
-	/* we render frames in the following conditions:
-	 * 1. Continuous mode and the free buffer is avaialable.
-	 * 2. In snapshot shot mode, free buffer is not always available.
-	 * when pending snapshot count is <=1,  then no need to use
-	 * free buffer.
-	 */
-	out_bool = ((vfe31_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_MAIN ||
-		vfe31_ctrl->operation_mode == VFE_OUTPUTS_MAIN_AND_THUMB ||
-		vfe31_ctrl->operation_mode == VFE_OUTPUTS_THUMB_AND_JPEG ||
-		vfe31_ctrl->operation_mode == VFE_OUTPUTS_JPEG_AND_THUMB ||
-		vfe31_ctrl->operation_mode == VFE_OUTPUTS_RAW ||
-		vfe31_ctrl->liveshot_state == VFE_STATE_STARTED ||
-		vfe31_ctrl->liveshot_state == VFE_STATE_STOP_REQUESTED ||
-		vfe31_ctrl->liveshot_state == VFE_STATE_STOPPED) &&
-		(vfe31_ctrl->vfe_capture_count <= 1)) || free_buf;
-
-	if (out_bool) {
-		ping_pong = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_BUS_PING_PONG_STATUS);
-
-		/* Channel 0*/
-		ch0_paddr = vfe31_get_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out0.ch0);
-		/* Channel 1*/
-		ch1_paddr = vfe31_get_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out0.ch1);
-		/* Channel 2*/
-		ch2_paddr = vfe31_get_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out0.ch2);
-
-		CDBG("output path 0, ch0 = 0x%x, ch1 = 0x%x, ch2 = 0x%x\n",
-			ch0_paddr, ch1_paddr, ch2_paddr);
-		if (free_buf) {
-			/* Y channel */
-			vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out0.ch0,
-			free_buf->ch_paddr[0]);
-			/* Chroma channel */
-			vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out0.ch1,
-			free_buf->ch_paddr[1]);
-			if (free_buf->num_planes > 2)
-				vfe31_put_ch_addr(ping_pong,
-					vfe31_ctrl->outpath.out0.ch2,
-					free_buf->ch_paddr[2]);
-		}
-		if (vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_THUMB_AND_JPEG ||
-			vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_JPEG_AND_THUMB ||
-			vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_RAW ||
-			vfe31_ctrl->liveshot_state == VFE_STATE_STOPPED)
-			vfe31_ctrl->outpath.out0.capture_cnt--;
-
-		vfe_send_outmsg(&vfe31_ctrl->subdev,
-			MSG_ID_OUTPUT_PRIMARY, ch0_paddr,
-			ch1_paddr, ch2_paddr,
-			vfe31_ctrl->outpath.out0.inst_handle);
-
-		if (vfe31_ctrl->liveshot_state == VFE_STATE_STOPPED)
-			vfe31_ctrl->liveshot_state = VFE_STATE_IDLE;
-
-	} else {
-		vfe31_ctrl->outpath.out0.frame_drop_cnt++;
-		CDBG("path_irq_0 - no free buffer!\n");
-	}
-}
-
-static void vfe31_process_output_path_irq_1(void)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr, ch1_paddr, ch2_paddr;
-	/* this must be snapshot main image output. */
-	uint8_t out_bool = 0;
-	struct msm_free_buf *free_buf = NULL;
-
-	free_buf = vfe31_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-		VFE_MSG_OUTPUT_SECONDARY);
-	out_bool = ((vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_RAW ||
-			vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_JPEG_AND_THUMB) &&
-			(vfe31_ctrl->vfe_capture_count <= 1)) || free_buf;
-
-	if (out_bool) {
-		ping_pong = msm_camera_io_r(vfe31_ctrl->vfebase +
-			VFE_BUS_PING_PONG_STATUS);
-
-		/* Y channel */
-		ch0_paddr = vfe31_get_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out1.ch0);
-		/* Chroma channel */
-		ch1_paddr = vfe31_get_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out1.ch1);
-		ch2_paddr = vfe31_get_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out1.ch2);
-
-		pr_debug("%s ch0 = 0x%x, ch1 = 0x%x, ch2 = 0x%x\n",
-			__func__, ch0_paddr, ch1_paddr, ch2_paddr);
-		if (free_buf) {
-			/* Y channel */
-			vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out1.ch0,
-			free_buf->ch_paddr[0]);
-			/* Chroma channel */
-			vfe31_put_ch_addr(ping_pong,
-			vfe31_ctrl->outpath.out1.ch1,
-			free_buf->ch_paddr[1]);
-			if (free_buf->num_planes > 2)
-				vfe31_put_ch_addr(ping_pong,
-					vfe31_ctrl->outpath.out1.ch2,
-					free_buf->ch_paddr[2]);
-		}
-		if (vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_RAW ||
-			vfe31_ctrl->operation_mode ==
-				VFE_OUTPUTS_JPEG_AND_THUMB)
-			vfe31_ctrl->outpath.out1.capture_cnt--;
-
-		vfe_send_outmsg(&vfe31_ctrl->subdev,
-			MSG_ID_OUTPUT_SECONDARY, ch0_paddr,
-			ch1_paddr, ch2_paddr,
-			vfe31_ctrl->outpath.out1.inst_handle);
-	} else {
-		vfe31_ctrl->outpath.out1.frame_drop_cnt++;
-		CDBG("path_irq_1 - no free buffer!\n");
-	}
-}
-
-static uint32_t  vfe31_process_stats_irq_common(uint32_t statsNum,
-	uint32_t newAddr)
-{
-
-	uint32_t pingpongStatus;
-	uint32_t returnAddr;
-	uint32_t pingpongAddr;
-
-	/* must be 0=ping, 1=pong */
-	pingpongStatus =
-		((msm_camera_io_r(vfe31_ctrl->vfebase +
-		VFE_BUS_PING_PONG_STATUS))
-		& ((uint32_t)(1<<(statsNum + 7)))) >> (statsNum + 7);
-	/* stats bits starts at 7 */
-	CDBG("statsNum %d, pingpongStatus %d\n", statsNum, pingpongStatus);
-	pingpongAddr =
-		((uint32_t)(vfe31_ctrl->vfebase +
-		VFE_BUS_STATS_PING_PONG_BASE)) +
-		(3*statsNum)*4 + (1-pingpongStatus)*4;
-	returnAddr = msm_camera_io_r((uint32_t *)pingpongAddr);
-	msm_camera_io_w(newAddr, (uint32_t *)pingpongAddr);
-	return returnAddr;
-}
-
-static void
-vfe_send_stats_msg(uint32_t bufAddress, uint32_t statsNum)
-{
-	int rc = 0;
-	void *vaddr = NULL;
-	/* fill message with right content. */
-	/* @todo This is causing issues, need further investigate */
-	/* spin_lock_irqsave(&ctrl->state_lock, flags); */
-	struct isp_msg_stats msgStats;
-	msgStats.frameCounter = vfe31_ctrl->vfeFrameId;
-	msgStats.buffer = bufAddress;
-
-	switch (statsNum) {
-	case STATS_AE_NUM:{
-		msgStats.id = MSG_ID_STATS_AEC;
-		rc = vfe31_ctrl->stats_ops.dispatch(
-				vfe31_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_AEC,	bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe31_ctrl->stats_ops.client);
-		}
-		break;
-	case STATS_AF_NUM:{
-		msgStats.id = MSG_ID_STATS_AF;
-		rc = vfe31_ctrl->stats_ops.dispatch(
-				vfe31_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_AF, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe31_ctrl->stats_ops.client);
-		}
-		break;
-	case STATS_AWB_NUM: {
-		msgStats.id = MSG_ID_STATS_AWB;
-		rc = vfe31_ctrl->stats_ops.dispatch(
-				vfe31_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_AWB, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe31_ctrl->stats_ops.client);
-		}
-		break;
-
-	case STATS_IHIST_NUM: {
-		msgStats.id = MSG_ID_STATS_IHIST;
-		rc = vfe31_ctrl->stats_ops.dispatch(
-				vfe31_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_IHIST, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe31_ctrl->stats_ops.client);
-		}
-		break;
-	case STATS_RS_NUM: {
-		msgStats.id = MSG_ID_STATS_RS;
-		rc = vfe31_ctrl->stats_ops.dispatch(
-				vfe31_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_RS, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe31_ctrl->stats_ops.client);
-		}
-		break;
-	case STATS_CS_NUM: {
-		msgStats.id = MSG_ID_STATS_CS;
-		rc = vfe31_ctrl->stats_ops.dispatch(
-				vfe31_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_CS, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe31_ctrl->stats_ops.client);
-		}
-		break;
-
-	default:
-		goto stats_done;
-	}
-	if (rc == 0) {
-		msgStats.buffer = (uint32_t)vaddr;
-		v4l2_subdev_notify(&vfe31_ctrl->subdev,
-			NOTIFY_VFE_MSG_STATS, &msgStats);
-	} else {
-		pr_err("%s: paddr to idx mapping error, stats_id = %d,\n"
-			"paddr = 0x%d\n", __func__,
-			 msgStats.id, msgStats.buffer);
-	}
-stats_done:
-	/* spin_unlock_irqrestore(&ctrl->state_lock, flags); */
-	return;
-}
-
-static void vfe_send_comp_stats_msg(uint32_t status_bits)
-{
-	struct msm_stats_buf msgStats;
-	uint32_t temp;
-
-	msgStats.frame_id = vfe31_ctrl->vfeFrameId;
-	msgStats.status_bits = status_bits;
-
-	msgStats.aec.buff = vfe31_ctrl->aecStatsControl.bufToRender;
-	msgStats.awb.buff = vfe31_ctrl->awbStatsControl.bufToRender;
-	msgStats.af.buff = vfe31_ctrl->afStatsControl.bufToRender;
-
-	msgStats.ihist.buff = vfe31_ctrl->ihistStatsControl.bufToRender;
-	msgStats.rs.buff = vfe31_ctrl->rsStatsControl.bufToRender;
-	msgStats.cs.buff = vfe31_ctrl->csStatsControl.bufToRender;
-
-	temp = msm_camera_io_r(vfe31_ctrl->vfebase + VFE_STATS_AWB_SGW_CFG);
-	msgStats.awb_ymin = (0xFF00 & temp) >> 8;
-
-	v4l2_subdev_notify(&vfe31_ctrl->subdev,
-		NOTIFY_VFE_MSG_COMP_STATS, &msgStats);
-}
-
-static void vfe31_process_stats_ae_irq(void)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AEC);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe31_ctrl->aecStatsControl.bufToRender =
-			vfe31_process_stats_irq_common(STATS_AE_NUM,
-			addr);
-
-		vfe_send_stats_msg(vfe31_ctrl->aecStatsControl.bufToRender,
-			STATS_AE_NUM);
-	} else{
-		vfe31_ctrl->aecStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe31_ctrl->aecStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe31_process_stats_awb_irq(void)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AWB);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe31_ctrl->awbStatsControl.bufToRender =
-			vfe31_process_stats_irq_common(STATS_AWB_NUM,
-			addr);
-
-		vfe_send_stats_msg(vfe31_ctrl->awbStatsControl.bufToRender,
-			STATS_AWB_NUM);
-	} else{
-		vfe31_ctrl->awbStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe31_ctrl->awbStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe31_process_stats_af_irq(void)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AF);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe31_ctrl->afStatsControl.bufToRender =
-			vfe31_process_stats_irq_common(STATS_AF_NUM,
-			addr);
-
-		vfe_send_stats_msg(vfe31_ctrl->afStatsControl.bufToRender,
-			STATS_AF_NUM);
-	} else{
-		vfe31_ctrl->afStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe31_ctrl->afStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe31_process_stats_ihist_irq(void)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_IHIST);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe31_ctrl->ihistStatsControl.bufToRender =
-			  vfe31_process_stats_irq_common(STATS_IHIST_NUM,
-				addr);
-		vfe_send_stats_msg(vfe31_ctrl->ihistStatsControl.bufToRender,
-			  STATS_IHIST_NUM);
-	} else {
-		vfe31_ctrl->ihistStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			 vfe31_ctrl->ihistStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe31_process_stats_rs_irq(void)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_RS);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe31_ctrl->rsStatsControl.bufToRender =
-			vfe31_process_stats_irq_common(STATS_RS_NUM,
-			addr);
-		vfe_send_stats_msg(vfe31_ctrl->rsStatsControl.bufToRender,
-			STATS_RS_NUM);
-	} else {
-		vfe31_ctrl->rsStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe31_ctrl->rsStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe31_process_stats_cs_irq(void)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_CS);
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe31_ctrl->csStatsControl.bufToRender =
-			vfe31_process_stats_irq_common(STATS_CS_NUM,
-				addr);
-			vfe_send_stats_msg(
-				vfe31_ctrl->csStatsControl.bufToRender,
-				STATS_CS_NUM);
-	} else {
-		vfe31_ctrl->csStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe31_ctrl->csStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe31_process_stats(uint32_t status_bits)
-{
-	unsigned long flags;
-	int32_t process_stats = false;
-	uint32_t addr;
-	CDBG("%s, stats = 0x%x\n", __func__, status_bits);
-
-	spin_lock_irqsave(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (status_bits & VFE_IRQ_STATUS0_STATS_AEC) {
-		addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AEC);
-		if (addr) {
-			vfe31_ctrl->aecStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(STATS_AE_NUM,
-				addr);
-			process_stats = true;
-		} else{
-			vfe31_ctrl->aecStatsControl.bufToRender = 0;
-			vfe31_ctrl->aecStatsControl.droppedStatsFrameCount++;
-		}
-	} else {
-		vfe31_ctrl->aecStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_AWB) {
-		addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AWB);
-		if (addr) {
-			vfe31_ctrl->awbStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(STATS_AWB_NUM,
-				addr);
-			process_stats = true;
-		} else{
-			vfe31_ctrl->awbStatsControl.droppedStatsFrameCount++;
-			vfe31_ctrl->awbStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe31_ctrl->awbStatsControl.bufToRender = 0;
-	}
-
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_AF) {
-		addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_AF);
-		if (addr) {
-			vfe31_ctrl->afStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(STATS_AF_NUM,
-				addr);
-			process_stats = true;
-		} else {
-			vfe31_ctrl->afStatsControl.bufToRender = 0;
-			vfe31_ctrl->afStatsControl.droppedStatsFrameCount++;
-		}
-	} else {
-		vfe31_ctrl->afStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_IHIST) {
-		addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_IHIST);
-		if (addr) {
-			vfe31_ctrl->ihistStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(STATS_IHIST_NUM,
-				addr);
-			process_stats = true;
-		} else {
-			vfe31_ctrl->ihistStatsControl.droppedStatsFrameCount++;
-			vfe31_ctrl->ihistStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe31_ctrl->ihistStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_RS) {
-		addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_RS);
-		if (!addr) {
-			vfe31_ctrl->rsStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(STATS_RS_NUM,
-				addr);
-			process_stats = true;
-		} else {
-			vfe31_ctrl->rsStatsControl.droppedStatsFrameCount++;
-			vfe31_ctrl->rsStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe31_ctrl->rsStatsControl.bufToRender = 0;
-	}
-
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_CS) {
-		addr = (uint32_t)vfe31_stats_dqbuf(MSM_STATS_TYPE_CS);
-		if (addr) {
-			vfe31_ctrl->csStatsControl.bufToRender =
-				vfe31_process_stats_irq_common(STATS_CS_NUM,
-				addr);
-			process_stats = true;
-		} else {
-			vfe31_ctrl->csStatsControl.droppedStatsFrameCount++;
-			vfe31_ctrl->csStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe31_ctrl->csStatsControl.bufToRender = 0;
-	}
-
-	spin_unlock_irqrestore(&vfe31_ctrl->stats_bufq_lock, flags);
-	if (process_stats)
-		vfe_send_comp_stats_msg(status_bits);
-
-	return;
-}
-
-static long vfe_stats_bufq_sub_ioctl(struct msm_vfe_cfg_cmd *cmd,
-	void *ion_client, int domain_num)
-{
-	long rc = 0;
-	switch (cmd->cmd_type) {
-	case VFE_CMD_STATS_REQBUF:
-		if (!vfe31_ctrl->stats_ops.stats_ctrl) {
-			/* stats_ctrl has not been init yet */
-			rc = msm_stats_buf_ops_init(&vfe31_ctrl->stats_ctrl,
-					(struct ion_client *)ion_client,
-					&vfe31_ctrl->stats_ops);
-		if (rc < 0) {
-			pr_err("%s: cannot init stats ops", __func__);
-			goto end;
-		}
-		rc = vfe31_ctrl->stats_ops.stats_ctrl_init(
-				&vfe31_ctrl->stats_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot init stats_ctrl ops", __func__);
-			memset(&vfe31_ctrl->stats_ops, 0,
-				sizeof(vfe31_ctrl->stats_ops));
-			goto end;
-		}
-		if (sizeof(struct msm_stats_reqbuf) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats reqbuf input size = %d,\n"
-				"struct size = %d, mis match\n",
-				 __func__, cmd->length,
-				 sizeof(struct msm_stats_reqbuf));
-			rc = -EINVAL;
-			goto end;
-		}
-	}
-	rc = vfe31_ctrl->stats_ops.reqbuf(&vfe31_ctrl->stats_ctrl,
-			(struct msm_stats_reqbuf *)cmd->value,
-			vfe31_ctrl->stats_ops.client);
-	break;
-	case VFE_CMD_STATS_ENQUEUEBUF:
-		if (sizeof(struct msm_stats_buf_info) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats enqueuebuf input size = %d,\n"
-				"struct size = %d, mis match\n",
-				__func__, cmd->length,
-				sizeof(struct msm_stats_buf_info));
-			rc = -EINVAL ;
-			goto end;
-		}
-		rc = vfe31_ctrl->stats_ops.enqueue_buf(&vfe31_ctrl->stats_ctrl,
-				(struct msm_stats_buf_info *)cmd->value,
-				vfe31_ctrl->stats_ops.client, domain_num);
-	break;
-	case VFE_CMD_STATS_FLUSH_BUFQ: {
-		struct msm_stats_flush_bufq *flush_req = NULL;
-		flush_req = (struct msm_stats_flush_bufq *)cmd->value;
-		if (sizeof(struct msm_stats_flush_bufq) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats flush queue input size = %d,\n"
-				"struct size = %d, mitch match\n",
-				__func__, cmd->length,
-				sizeof(struct msm_stats_flush_bufq));
-			rc = -EINVAL ;
-			goto end;
-		}
-		rc = vfe31_ctrl->stats_ops.bufq_flush(&vfe31_ctrl->stats_ctrl,
-				(enum msm_stats_enum_type)flush_req->stats_type,
-				vfe31_ctrl->stats_ops.client);
-	}
-	break;
-	case VFE_CMD_STATS_UNREGBUF:
-	{
-		struct msm_stats_reqbuf *req_buf = NULL;
-		req_buf = (struct msm_stats_reqbuf *)cmd->value;
-		if (sizeof(struct msm_stats_reqbuf) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats reqbuf input size = %d,\n"
-				"struct size = %d, mitch match\n",
-				 __func__, cmd->length,
-				sizeof(struct msm_stats_reqbuf));
-			rc = -EINVAL ;
-			goto end;
-		}
-		rc = vfe31_stats_unregbuf(req_buf, domain_num);
-	}
-	break;
-	default:
-		rc = -1;
-		pr_err("%s: cmd_type %d not supported", __func__,
-			cmd->cmd_type);
-	break;
-	}
-end:
-	return rc;
-}
-
-static void vfe31_process_stats_irq(uint32_t *irqstatus)
-{
-	uint32_t status_bits = VFE_COM_STATUS & *irqstatus;
-
-	if ((vfe31_ctrl->hfr_mode != HFR_MODE_OFF) &&
-		(vfe31_ctrl->vfeFrameId % vfe31_ctrl->hfr_mode != 0)) {
-		CDBG("Skip the stats when HFR enabled\n");
-		return;
-	}
-
-	vfe31_process_stats(status_bits);
-	return;
-}
-
-static void vfe31_do_tasklet(unsigned long data)
-{
-	unsigned long flags;
-
-	struct vfe31_isr_queue_cmd *qcmd = NULL;
-
-	CDBG("=== vfe31_do_tasklet start ===\n");
-
-	while (atomic_read(&irq_cnt)) {
-		spin_lock_irqsave(&vfe31_ctrl->tasklet_lock, flags);
-		qcmd = list_first_entry(&vfe31_ctrl->tasklet_q,
-			struct vfe31_isr_queue_cmd, list);
-		atomic_sub(1, &irq_cnt);
-
-		if (!qcmd) {
-			spin_unlock_irqrestore(&vfe31_ctrl->tasklet_lock,
-				flags);
-			return;
-		}
-
-		list_del(&qcmd->list);
-		spin_unlock_irqrestore(&vfe31_ctrl->tasklet_lock,
-			flags);
-
-		if (qcmd->vfeInterruptStatus0 &
-			VFE_IRQ_STATUS0_CAMIF_SOF_MASK) {
-			CDBG("irq	camifSofIrq\n");
-			vfe31_process_camif_sof_irq();
-		}
-		/* interrupt to be processed,  *qcmd has the payload.  */
-		if (qcmd->vfeInterruptStatus0 &
-			VFE_IRQ_STATUS0_REG_UPDATE_MASK) {
-			CDBG("irq	regUpdateIrq\n");
-			vfe31_process_reg_update_irq();
-		}
-
-		if (qcmd->vfeInterruptStatus1 &
-			VFE_IMASK_WHILE_STOPPING_1) {
-			CDBG("irq	resetAckIrq\n");
-			vfe31_process_reset_irq();
-		}
-
-		if (atomic_read(&vfe31_ctrl->vstate)) {
-			if (qcmd->vfeInterruptStatus1 &
-				VFE31_IMASK_ERROR_ONLY_1) {
-				pr_err("irq	errorIrq\n");
-				vfe31_process_error_irq(
-					qcmd->vfeInterruptStatus1 &
-					VFE31_IMASK_ERROR_ONLY_1);
-			}
-			/* next, check output path related interrupts. */
-			if (qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK) {
-				CDBG("Image composite done 0 irq occured.\n");
-				vfe31_process_output_path_irq_0();
-			}
-			if (qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK) {
-				CDBG("Image composite done 1 irq occured.\n");
-				vfe31_process_output_path_irq_1();
-			}
-			/* in snapshot mode if done then send
-			snapshot done message */
-			if (vfe31_ctrl->operation_mode ==
-					VFE_OUTPUTS_THUMB_AND_MAIN ||
-				vfe31_ctrl->operation_mode ==
-					VFE_OUTPUTS_MAIN_AND_THUMB ||
-				vfe31_ctrl->operation_mode ==
-					VFE_OUTPUTS_THUMB_AND_JPEG ||
-				vfe31_ctrl->operation_mode ==
-					VFE_OUTPUTS_JPEG_AND_THUMB ||
-				vfe31_ctrl->operation_mode ==
-					VFE_OUTPUTS_RAW) {
-				if ((vfe31_ctrl->outpath.out0.capture_cnt == 0)
-					&& (vfe31_ctrl->outpath.out1.
-					capture_cnt == 0)) {
-					msm_camera_io_w_mb(
-						CAMIF_COMMAND_STOP_IMMEDIATELY,
-						vfe31_ctrl->vfebase +
-						VFE_CAMIF_COMMAND);
-					vfe31_send_isp_msg(vfe31_ctrl,
-						MSG_ID_SNAPSHOT_DONE);
-				}
-			}
-			/* then process stats irq. */
-			if (vfe31_ctrl->stats_comp) {
-				/* process stats comb interrupt. */
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK) {
-					CDBG("Stats composite irq occured.\n");
-					vfe31_process_stats_irq(
-						&qcmd->vfeInterruptStatus0);
-				}
-			} else {
-				/* process individual stats interrupt. */
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_AEC) {
-					CDBG("Stats AEC irq occured.\n");
-					vfe31_process_stats_ae_irq();
-				}
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_AWB) {
-					CDBG("Stats AWB irq occured.\n");
-					vfe31_process_stats_awb_irq();
-				}
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_AF) {
-					CDBG("Stats AF irq occured.\n");
-					vfe31_process_stats_af_irq();
-				}
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_IHIST) {
-					CDBG("Stats IHIST irq occured.\n");
-					vfe31_process_stats_ihist_irq();
-				}
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_RS) {
-					CDBG("Stats RS irq occured.\n");
-					vfe31_process_stats_rs_irq();
-				}
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_CS) {
-					CDBG("Stats CS irq occured.\n");
-					vfe31_process_stats_cs_irq();
-				}
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_SYNC_TIMER0) {
-					CDBG("SYNC_TIMER 0 irq occured.\n");
-					vfe31_send_isp_msg(vfe31_ctrl,
-						MSG_ID_SYNC_TIMER0_DONE);
-				}
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_SYNC_TIMER1) {
-					CDBG("SYNC_TIMER 1 irq occured.\n");
-					vfe31_send_isp_msg(vfe31_ctrl,
-						MSG_ID_SYNC_TIMER1_DONE);
-				}
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_SYNC_TIMER2) {
-					CDBG("SYNC_TIMER 2 irq occured.\n");
-					vfe31_send_isp_msg(vfe31_ctrl,
-						MSG_ID_SYNC_TIMER2_DONE);
-				}
-			}
-		}
-		kfree(qcmd);
-	}
-	CDBG("=== vfe31_do_tasklet end ===\n");
-}
-
-DECLARE_TASKLET(vfe31_tasklet, vfe31_do_tasklet, 0);
-
-static irqreturn_t vfe31_parse_irq(int irq_num, void *data)
-{
-	unsigned long flags;
-	struct vfe31_irq_status irq;
-	struct vfe31_isr_queue_cmd *qcmd;
-
-	CDBG("vfe_parse_irq\n");
-
-	vfe31_read_irq_status(&irq);
-
-	if ((irq.vfeIrqStatus0 == 0) && (irq.vfeIrqStatus1 == 0)) {
-		CDBG("vfe_parse_irq: vfeIrqStatus0 & 1 are both 0!\n");
-		return IRQ_HANDLED;
-	}
-
-	qcmd = kzalloc(sizeof(struct vfe31_isr_queue_cmd),
-		GFP_ATOMIC);
-	if (!qcmd) {
-		pr_err("vfe_parse_irq: qcmd malloc failed!\n");
-		return IRQ_HANDLED;
-	}
-
-	spin_lock_irqsave(&vfe31_ctrl->stop_flag_lock, flags);
-	if (vfe31_ctrl->stop_ack_pending) {
-		irq.vfeIrqStatus0 &= VFE_IMASK_WHILE_STOPPING_0;
-		irq.vfeIrqStatus1 &= VFE_IMASK_WHILE_STOPPING_1;
-	}
-	spin_unlock_irqrestore(&vfe31_ctrl->stop_flag_lock, flags);
-
-	CDBG("vfe_parse_irq: Irq_status0 = 0x%x, Irq_status1 = 0x%x.\n",
-		irq.vfeIrqStatus0, irq.vfeIrqStatus1);
-
-	qcmd->vfeInterruptStatus0 = irq.vfeIrqStatus0;
-	qcmd->vfeInterruptStatus1 = irq.vfeIrqStatus1;
-
-	spin_lock_irqsave(&vfe31_ctrl->tasklet_lock, flags);
-	list_add_tail(&qcmd->list, &vfe31_ctrl->tasklet_q);
-
-	atomic_add(1, &irq_cnt);
-	spin_unlock_irqrestore(&vfe31_ctrl->tasklet_lock, flags);
-	tasklet_schedule(&vfe31_tasklet);
-	return IRQ_HANDLED;
-}
-
-static long msm_vfe_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int subdev_cmd, void *arg)
-{
-	struct msm_cam_media_controller *pmctl =
-		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
-	struct msm_isp_cmd vfecmd;
-	struct msm_camvfe_params *vfe_params;
-	struct msm_vfe_cfg_cmd *cmd;
-	void *data;
-
-	long rc = 0;
-	struct vfe_cmd_stats_buf *scfg = NULL;
-	struct vfe_cmd_stats_ack *sack = NULL;
-
-	if (subdev_cmd == VIDIOC_MSM_VFE_INIT) {
-		CDBG("%s init\n", __func__);
-		return msm_vfe_subdev_init(sd);
-	} else if (subdev_cmd == VIDIOC_MSM_VFE_RELEASE) {
-		msm_vfe_subdev_release(sd);
-		return 0;
-	}
-	vfe_params = (struct msm_camvfe_params *)arg;
-	cmd = vfe_params->vfe_cfg;
-	data = vfe_params->data;
-
-	switch (cmd->cmd_type) {
-	case VFE_CMD_STATS_REQBUF:
-	case VFE_CMD_STATS_ENQUEUEBUF:
-	case VFE_CMD_STATS_FLUSH_BUFQ:
-	case VFE_CMD_STATS_UNREGBUF:
-		/* for easy porting put in one envelope */
-		rc = vfe_stats_bufq_sub_ioctl(cmd, vfe_params->data,
-			pmctl->domain_num);
-		return rc;
-	default:
-		if (cmd->cmd_type != CMD_CONFIG_PING_ADDR &&
-			cmd->cmd_type != CMD_CONFIG_PONG_ADDR &&
-			cmd->cmd_type != CMD_CONFIG_FREE_BUF_ADDR &&
-			cmd->cmd_type != CMD_STATS_AEC_BUF_RELEASE &&
-			cmd->cmd_type != CMD_STATS_AWB_BUF_RELEASE &&
-			cmd->cmd_type != CMD_STATS_IHIST_BUF_RELEASE &&
-			cmd->cmd_type != CMD_STATS_RS_BUF_RELEASE &&
-			cmd->cmd_type != CMD_STATS_CS_BUF_RELEASE &&
-			cmd->cmd_type != CMD_STATS_AF_BUF_RELEASE) {
-				if (copy_from_user(&vfecmd,
-					(void __user *)(cmd->value),
-					sizeof(vfecmd))) {
-						pr_err("%s %d: copy_from_user failed\n",
-						__func__, __LINE__);
-					return -EFAULT;
-				}
-		} else {
-			/* here eith stats release or frame release. */
-			if (cmd->cmd_type != CMD_CONFIG_PING_ADDR &&
-				cmd->cmd_type != CMD_CONFIG_PONG_ADDR &&
-				cmd->cmd_type != CMD_CONFIG_FREE_BUF_ADDR) {
-				/* then must be stats release. */
-				if (!data) {
-					pr_err("%s: data = NULL," \
-						"cmd->cmd_type = %d\n",
-						__func__, cmd->cmd_type);
-					return -EFAULT;
-				}
-				sack = kmalloc(sizeof(struct vfe_cmd_stats_ack),
-							GFP_ATOMIC);
-				if (!sack) {
-					pr_err("%s: no mem for" \
-						"cmd->cmd_type = %d\n",
-						__func__, cmd->cmd_type);
-					return -ENOMEM;
-				}
-
-				sack->nextStatsBuf = *(uint32_t *)data;
-			}
-		}
-
-		CDBG("%s: cmdType = %d\n", __func__, cmd->cmd_type);
-
-		if ((cmd->cmd_type == CMD_STATS_AF_ENABLE)    ||
-			(cmd->cmd_type == CMD_STATS_AWB_ENABLE)   ||
-			(cmd->cmd_type == CMD_STATS_IHIST_ENABLE) ||
-			(cmd->cmd_type == CMD_STATS_RS_ENABLE)    ||
-			(cmd->cmd_type == CMD_STATS_CS_ENABLE)    ||
-			(cmd->cmd_type == CMD_STATS_AEC_ENABLE)) {
-			scfg = NULL;
-			goto vfe31_config_done;
-		}
-		switch (cmd->cmd_type) {
-		case CMD_GENERAL: {
-			rc = vfe31_proc_general(pmctl, &vfecmd);
-			}
-			break;
-		case CMD_CONFIG_PING_ADDR: {
-			int path = *((int *)cmd->value);
-			struct vfe31_output_ch *outch = vfe31_get_ch(path);
-			outch->ping = *((struct msm_free_buf *)data);
-			}
-			break;
-
-		case CMD_CONFIG_PONG_ADDR: {
-			int path = *((int *)cmd->value);
-			struct vfe31_output_ch *outch = vfe31_get_ch(path);
-			outch->pong = *((struct msm_free_buf *)data);
-			}
-			break;
-
-		case CMD_CONFIG_FREE_BUF_ADDR: {
-			int path = *((int *)cmd->value);
-			struct vfe31_output_ch *outch = vfe31_get_ch(path);
-			outch->free_buf = *((struct msm_free_buf *)data);
-			}
-			break;
-
-		case CMD_SNAP_BUF_RELEASE:
-			break;
-
-		case CMD_AXI_CFG_PRIM: {
-			uint32_t *axio = NULL;
-			axio = kmalloc(vfe31_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-			if (!axio) {
-				rc = -ENOMEM;
-				break;
-			}
-
-			if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-				kfree(axio);
-				rc = -EFAULT;
-				break;
-			}
-			vfe31_config_axi(OUTPUT_PRIM, axio);
-			kfree(axio);
-			}
-			break;
-
-		case CMD_AXI_CFG_PRIM_ALL_CHNLS: {
-			uint32_t *axio = NULL;
-			axio = kmalloc(vfe31_cmd[VFE_CMD_AXI_OUT_CFG].length,
-					GFP_ATOMIC);
-			if (!axio) {
-				rc = -ENOMEM;
-				break;
-			}
-
-			if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-				kfree(axio);
-				rc = -EFAULT;
-				break;
-			}
-			vfe31_config_axi(OUTPUT_PRIM_ALL_CHNLS, axio);
-			kfree(axio);
-		}
-			break;
-
-		case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC: {
-			uint32_t *axio = NULL;
-			axio = kmalloc(vfe31_cmd[VFE_CMD_AXI_OUT_CFG].length,
-					GFP_ATOMIC);
-			if (!axio) {
-				rc = -ENOMEM;
-				break;
-			}
-
-			if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-				kfree(axio);
-				rc = -EFAULT;
-				break;
-			}
-			vfe31_config_axi(OUTPUT_PRIM|OUTPUT_SEC, axio);
-			kfree(axio);
-			}
-			break;
-
-		case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC_ALL_CHNLS: {
-			uint32_t *axio = NULL;
-			axio = kmalloc(vfe31_cmd[VFE_CMD_AXI_OUT_CFG].length,
-					GFP_ATOMIC);
-			if (!axio) {
-				rc = -ENOMEM;
-				break;
-			}
-
-			if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-				kfree(axio);
-				rc = -EFAULT;
-				break;
-			}
-			vfe31_config_axi
-				(OUTPUT_PRIM|OUTPUT_SEC_ALL_CHNLS, axio);
-			kfree(axio);
-			}
-			break;
-
-		case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC: {
-			uint32_t *axio = NULL;
-			axio = kmalloc(vfe31_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-			if (!axio) {
-				rc = -ENOMEM;
-				break;
-			}
-
-			if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe31_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-				kfree(axio);
-				rc = -EFAULT;
-				break;
-			}
-			vfe31_config_axi
-				(OUTPUT_PRIM_ALL_CHNLS|OUTPUT_SEC, axio);
-			kfree(axio);
-			}
-			break;
-
-		case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC_ALL_CHNLS: {
-			pr_err("%s Invalid/Unsupported AXI configuration %x",
-				__func__, cmd->cmd_type);
-			}
-			break;
-
-		case CMD_AXI_START:
-			/* No need to decouple AXI/VFE for VFE3.1*/
-			break;
-
-		case CMD_AXI_STOP:
-			/* No need to decouple AXI/VFE for VFE3.1*/
-			break;
-
-		case CMD_AXI_RESET:
-			/* No need to decouple AXI/VFE for VFE3.1*/
-			break;
-
-		default:
-			pr_err("%s Unsupported AXI configuration %x ", __func__,
-				cmd->cmd_type);
-			break;
-		}
-	}
-vfe31_config_done:
-	kfree(scfg);
-	kfree(sack);
-	CDBG("%s done: rc = %d\n", __func__, (int) rc);
-	return rc;
-}
-
-static int msm_vfe_subdev_s_crystal_freq(struct v4l2_subdev *sd,
-	u32 freq, u32 flags)
-{
-	int rc = 0;
-	int round_rate;
-
-	round_rate = clk_round_rate(vfe31_ctrl->vfe_clk[0], freq);
-	if (rc < 0) {
-		pr_err("%s: clk_round_rate failed %d\n",
-			__func__, rc);
-		return rc;
-	}
-
-	vfe_clk_rate = round_rate;
-	rc = clk_set_rate(vfe31_ctrl->vfe_clk[0], round_rate);
-	if (rc < 0)
-		pr_err("%s: clk_set_rate failed %d\n",
-			__func__, rc);
-
-	return rc;
-}
-
-static const struct v4l2_subdev_video_ops msm_vfe_subdev_video_ops = {
-	.s_crystal_freq = msm_vfe_subdev_s_crystal_freq,
-};
-
-static const struct v4l2_subdev_core_ops msm_vfe_subdev_core_ops = {
-	.ioctl = msm_vfe_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_ops msm_vfe_subdev_ops = {
-	.core = &msm_vfe_subdev_core_ops,
-	.video = &msm_vfe_subdev_video_ops,
-};
-
-static struct msm_cam_clk_info vfe_clk_info[] = {
-	{"vfe_clk", VFE_CLK_RATE},
-	{"vfe_pclk", -1},
-};
-
-static struct msm_cam_clk_info vfe_camif_clk_info[] = {
-	{"camif_pad_pclk", -1},
-	{"vfe_camif_clk", -1},
-};
-
-static void msm_vfe_camio_clk_sel(enum msm_camio_clk_src_type srctype)
-{
-	struct clk *clk = NULL;
-
-	clk = vfe31_ctrl->vfe_clk[0];
-
-	if (clk != NULL) {
-		switch (srctype) {
-		case MSM_CAMIO_CLK_SRC_INTERNAL:
-			clk_set_flags(clk, 0x00000100 << 1);
-			break;
-
-		case MSM_CAMIO_CLK_SRC_EXTERNAL:
-			clk_set_flags(clk, 0x00000100);
-			break;
-
-		default:
-			break;
-		}
-	}
-}
-
-static void msm_vfe_camif_pad_reg_reset(void)
-{
-	uint32_t reg;
-
-	msm_vfe_camio_clk_sel(MSM_CAMIO_CLK_SRC_INTERNAL);
-	usleep_range(10000, 15000);
-
-	reg = (msm_camera_io_r(vfe31_ctrl->camifbase)) & CAMIF_CFG_RMSK;
-	reg |= 0x3;
-	msm_camera_io_w(reg, vfe31_ctrl->camifbase);
-	usleep_range(10000, 15000);
-
-	reg = (msm_camera_io_r(vfe31_ctrl->camifbase)) & CAMIF_CFG_RMSK;
-	reg |= 0x10;
-	msm_camera_io_w(reg, vfe31_ctrl->camifbase);
-	usleep_range(10000, 15000);
-
-	reg = (msm_camera_io_r(vfe31_ctrl->camifbase)) & CAMIF_CFG_RMSK;
-	/* Need to be uninverted*/
-	reg &= 0x03;
-	msm_camera_io_w(reg, vfe31_ctrl->camifbase);
-	usleep_range(10000, 15000);
-}
-
-int msm_vfe_subdev_init(struct v4l2_subdev *sd)
-{
-	int rc = 0;
-	struct msm_cam_media_controller *mctl;
-	mctl = v4l2_get_subdev_hostdata(sd);
-	if (mctl == NULL) {
-		rc = -EINVAL;
-		goto mctl_failed;
-	}
-
-	spin_lock_init(&vfe31_ctrl->stop_flag_lock);
-	spin_lock_init(&vfe31_ctrl->state_lock);
-	spin_lock_init(&vfe31_ctrl->stats_bufq_lock);
-	spin_lock_init(&vfe31_ctrl->io_lock);
-	spin_lock_init(&vfe31_ctrl->update_ack_lock);
-	spin_lock_init(&vfe31_ctrl->tasklet_lock);
-	spin_lock_init(&vfe31_ctrl->sd_notify_lock);
-	INIT_LIST_HEAD(&vfe31_ctrl->tasklet_q);
-
-	memset(&vfe31_ctrl->stats_ctrl, 0, sizeof(struct msm_stats_bufq_ctrl));
-	memset(&vfe31_ctrl->stats_ops, 0, sizeof(struct msm_stats_ops));
-
-	vfe31_ctrl->update_linear = false;
-	vfe31_ctrl->update_rolloff = false;
-	vfe31_ctrl->update_la = false;
-	vfe31_ctrl->update_gamma = false;
-	vfe31_ctrl->hfr_mode = HFR_MODE_OFF;
-
-	vfe31_ctrl->vfebase = ioremap(vfe31_ctrl->vfemem->start,
-		resource_size(vfe31_ctrl->vfemem));
-	if (!vfe31_ctrl->vfebase) {
-		rc = -ENOMEM;
-		pr_err("%s: vfe ioremap failed\n", __func__);
-		goto vfe_remap_failed;
-	}
-	if (!mctl->sdata->csi_if) {
-		vfe31_ctrl->camifbase = ioremap(vfe31_ctrl->camifmem->start,
-			resource_size(vfe31_ctrl->camifmem));
-		if (!vfe31_ctrl->camifbase) {
-			rc = -ENOMEM;
-			pr_err("%s: camif ioremap failed\n", __func__);
-			goto camif_remap_failed;
-		}
-	}
-
-	if (vfe31_ctrl->fs_vfe) {
-		rc = regulator_enable(vfe31_ctrl->fs_vfe);
-		if (rc) {
-			pr_err("%s: Regulator FS_VFE enable failed\n",
-							__func__);
-			goto vfe_fs_failed;
-		}
-	}
-
-	rc = msm_cam_clk_enable(&vfe31_ctrl->pdev->dev, vfe_clk_info,
-		vfe31_ctrl->vfe_clk, ARRAY_SIZE(vfe_clk_info), 1);
-	if (rc < 0)
-		goto vfe_clk_enable_failed;
-
-	if (!mctl->sdata->csi_if) {
-		rc = msm_cam_clk_enable(&vfe31_ctrl->pdev->dev,
-			vfe_camif_clk_info,
-			vfe31_ctrl->vfe_camif_clk,
-			ARRAY_SIZE(vfe_camif_clk_info), 1);
-		if (rc < 0)
-			goto vfe_camif_clk_enable_failed;
-		msm_vfe_camif_pad_reg_reset();
-	}
-
-#ifdef CONFIG_MSM_IOMMU
-	rc = iommu_attach_device(mctl->domain, vfe31_ctrl->iommu_ctx_imgwr);
-	if (rc < 0) {
-		rc = -ENODEV;
-		pr_err("%s: Device attach failed\n", __func__);
-		goto device_imgwr_attach_failed;
-	}
-	rc = iommu_attach_device(mctl->domain, vfe31_ctrl->iommu_ctx_misc);
-	if (rc < 0) {
-		rc = -ENODEV;
-		pr_err("%s: Device attach failed\n", __func__);
-		goto device_misc_attach_failed;
-	}
-#endif
-
-	msm_camio_bus_scale_cfg(
-		mctl->sdata->pdata->cam_bus_scale_table, S_INIT);
-	msm_camio_bus_scale_cfg(
-		mctl->sdata->pdata->cam_bus_scale_table, S_PREVIEW);
-	vfe31_ctrl->register_total = VFE31_REGISTER_TOTAL;
-
-	enable_irq(vfe31_ctrl->vfeirq->start);
-
-	return rc;
-
-#ifdef CONFIG_MSM_IOMMU
-device_misc_attach_failed:
-	iommu_detach_device(mctl->domain, vfe31_ctrl->iommu_ctx_imgwr);
-device_imgwr_attach_failed:
-#endif
-	if (!mctl->sdata->csi_if)
-		msm_cam_clk_enable(&vfe31_ctrl->pdev->dev,
-			vfe_camif_clk_info,
-			vfe31_ctrl->vfe_camif_clk,
-			ARRAY_SIZE(vfe_camif_clk_info), 0);
-vfe_camif_clk_enable_failed:
-	msm_cam_clk_enable(&vfe31_ctrl->pdev->dev, vfe_clk_info,
-		vfe31_ctrl->vfe_clk, ARRAY_SIZE(vfe_clk_info), 0);
-vfe_clk_enable_failed:
-	regulator_disable(vfe31_ctrl->fs_vfe);
-vfe_fs_failed:
-	if (!mctl->sdata->csi_if)
-		iounmap(vfe31_ctrl->camifbase);
-camif_remap_failed:
-	iounmap(vfe31_ctrl->vfebase);
-vfe_remap_failed:
-mctl_failed:
-	return rc;
-}
-
-void msm_vfe_subdev_release(struct v4l2_subdev *sd)
-{
-	struct msm_cam_media_controller *pmctl =
-		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
-	disable_irq(vfe31_ctrl->vfeirq->start);
-	tasklet_kill(&vfe31_tasklet);
-
-#ifdef CONFIG_MSM_IOMMU
-	iommu_detach_device(pmctl->domain, vfe31_ctrl->iommu_ctx_misc);
-	iommu_detach_device(pmctl->domain, vfe31_ctrl->iommu_ctx_imgwr);
-#endif
-
-	if (!pmctl->sdata->csi_if)
-		msm_cam_clk_enable(&vfe31_ctrl->pdev->dev,
-			vfe_camif_clk_info,
-			vfe31_ctrl->vfe_camif_clk,
-			ARRAY_SIZE(vfe_camif_clk_info), 0);
-
-	msm_cam_clk_enable(&vfe31_ctrl->pdev->dev, vfe_clk_info,
-		vfe31_ctrl->vfe_clk, ARRAY_SIZE(vfe_clk_info), 0);
-
-	if (vfe31_ctrl->fs_vfe)
-		regulator_disable(vfe31_ctrl->fs_vfe);
-
-	CDBG("%s Releasing resources\n", __func__);
-	if (!pmctl->sdata->csi_if)
-		iounmap(vfe31_ctrl->camifbase);
-	iounmap(vfe31_ctrl->vfebase);
-
-	if (atomic_read(&irq_cnt))
-		pr_warning("%s, Warning IRQ Count not ZERO\n", __func__);
-
-	msm_camio_bus_scale_cfg(
-		pmctl->sdata->pdata->cam_bus_scale_table, S_EXIT);
-}
-
-static const struct v4l2_subdev_internal_ops msm_vfe_internal_ops;
-
-static int __devinit vfe31_probe(struct platform_device *pdev)
-{
-	int rc = 0;
-	struct msm_cam_subdev_info sd_info;
-
-	CDBG("%s: device id = %d\n", __func__, pdev->id);
-
-	vfe31_ctrl = kzalloc(sizeof(struct vfe31_ctrl_type), GFP_KERNEL);
-	if (!vfe31_ctrl) {
-		pr_err("%s: no enough memory\n", __func__);
-		return -ENOMEM;
-	}
-
-	v4l2_subdev_init(&vfe31_ctrl->subdev, &msm_vfe_subdev_ops);
-	vfe31_ctrl->subdev.internal_ops = &msm_vfe_internal_ops;
-	vfe31_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(vfe31_ctrl->subdev.name,
-			 sizeof(vfe31_ctrl->subdev.name), "vfe3.1");
-	v4l2_set_subdevdata(&vfe31_ctrl->subdev, vfe31_ctrl);
-	platform_set_drvdata(pdev, &vfe31_ctrl->subdev);
-
-	vfe31_ctrl->vfemem = platform_get_resource_byname(pdev,
-		IORESOURCE_MEM, "msm_vfe");
-	if (!vfe31_ctrl->vfemem) {
-		pr_err("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto vfe31_no_resource;
-	}
-	vfe31_ctrl->vfeirq = platform_get_resource_byname(pdev,
-		IORESOURCE_IRQ, "msm_vfe");
-	if (!vfe31_ctrl->vfeirq) {
-		pr_err("%s: no irq resource?\n", __func__);
-		rc = -ENODEV;
-		goto vfe31_no_resource;
-	}
-	vfe31_ctrl->camifmem = platform_get_resource_byname(pdev,
-		IORESOURCE_MEM, "msm_camif");
-	if (!vfe31_ctrl->camifmem)
-		pr_err("%s: camif not supported\n", __func__);
-
-	vfe31_ctrl->vfeio = request_mem_region(vfe31_ctrl->vfemem->start,
-		resource_size(vfe31_ctrl->vfemem), pdev->name);
-	if (!vfe31_ctrl->vfeio) {
-		pr_err("%s: no valid mem region\n", __func__);
-		rc = -EBUSY;
-		goto vfe31_no_resource;
-	}
-
-	if (vfe31_ctrl->camifmem) {
-		vfe31_ctrl->camifio = request_mem_region(
-			vfe31_ctrl->camifmem->start,
-			resource_size(vfe31_ctrl->camifmem), pdev->name);
-		if (!vfe31_ctrl->camifio) {
-			release_mem_region(vfe31_ctrl->vfemem->start,
-				resource_size(vfe31_ctrl->vfemem));
-			pr_err("%s: no valid mem region\n", __func__);
-			rc = -EBUSY;
-			goto vfe31_no_resource;
-		}
-	}
-
-	rc = request_irq(vfe31_ctrl->vfeirq->start, vfe31_parse_irq,
-		IRQF_TRIGGER_RISING, "vfe", 0);
-	if (rc < 0) {
-		if (vfe31_ctrl->camifmem) {
-			release_mem_region(vfe31_ctrl->camifmem->start,
-				resource_size(vfe31_ctrl->camifmem));
-		}
-		release_mem_region(vfe31_ctrl->vfemem->start,
-			resource_size(vfe31_ctrl->vfemem));
-		pr_err("%s: irq request fail\n", __func__);
-		rc = -EBUSY;
-		goto vfe31_no_resource;
-	}
-
-	disable_irq(vfe31_ctrl->vfeirq->start);
-
-#ifdef CONFIG_MSM_IOMMU
-	/*get device context for IOMMU*/
-	vfe31_ctrl->iommu_ctx_imgwr =
-		msm_iommu_get_ctx("vfe_imgwr"); /*re-confirm*/
-	vfe31_ctrl->iommu_ctx_misc =
-		msm_iommu_get_ctx("vfe_misc"); /*re-confirm*/
-	if (!vfe31_ctrl->iommu_ctx_imgwr || !vfe31_ctrl->iommu_ctx_misc) {
-		if (vfe31_ctrl->camifmem) {
-			release_mem_region(vfe31_ctrl->camifmem->start,
-				resource_size(vfe31_ctrl->camifmem));
-		}
-		release_mem_region(vfe31_ctrl->vfemem->start,
-			resource_size(vfe31_ctrl->vfemem));
-		pr_err("%s: No iommu fw context found\n", __func__);
-		rc = -ENODEV;
-		goto vfe31_no_resource;
-	}
-#endif
-
-	vfe31_ctrl->pdev = pdev;
-	vfe31_ctrl->fs_vfe = regulator_get(&vfe31_ctrl->pdev->dev, "vdd");
-	if (IS_ERR(vfe31_ctrl->fs_vfe)) {
-		pr_err("%s: Regulator get failed %ld\n", __func__,
-			PTR_ERR(vfe31_ctrl->fs_vfe));
-		vfe31_ctrl->fs_vfe = NULL;
-	}
-
-	sd_info.sdev_type = VFE_DEV;
-	sd_info.sd_index = 0;
-	sd_info.irq_num = vfe31_ctrl->vfeirq->start;
-	msm_cam_register_subdev_node(&vfe31_ctrl->subdev, &sd_info);
-
-	media_entity_init(&vfe31_ctrl->subdev.entity, 0, NULL, 0);
-	vfe31_ctrl->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	vfe31_ctrl->subdev.entity.group_id = VFE_DEV;
-	vfe31_ctrl->subdev.entity.name = pdev->name;
-	vfe31_ctrl->subdev.entity.revision = vfe31_ctrl->subdev.devnode->num;
-	return 0;
-
-vfe31_no_resource:
-	kfree(vfe31_ctrl);
-	return 0;
-}
-
-static struct platform_driver vfe31_driver = {
-	.probe = vfe31_probe,
-	.driver = {
-	.name = MSM_VFE_DRV_NAME,
-	.owner = THIS_MODULE,
-	},
-};
-
-static int __init msm_vfe31_init_module(void)
-{
-	return platform_driver_register(&vfe31_driver);
-}
-
-static void __exit msm_vfe31_exit_module(void)
-{
-	platform_driver_unregister(&vfe31_driver);
-}
-
-module_init(msm_vfe31_init_module);
-module_exit(msm_vfe31_exit_module);
-MODULE_DESCRIPTION("VFE 3.1 driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/vfe/msm_vfe31_v4l2.h b/drivers/media/video/msm/vfe/msm_vfe31_v4l2.h
deleted file mode 100644
index eea8078..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe31_v4l2.h
+++ /dev/null
@@ -1,955 +0,0 @@
-/* Copyright (c) 2012 The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MSM_VFE31_V4L2_H__
-#define __MSM_VFE31_V4L2_H__
-
-#include <linux/bitops.h>
-#include "msm_vfe_stats_buf.h"
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-/* This defines total number registers in VFE.
- * Each register is 4 bytes so to get the range,
- * multiply this number with 4. */
-#define VFE31_REGISTER_TOTAL 0x0000017F
-
-/* at start of camif,  bit 1:0 = 0x01:enable
- * image data capture at frame boundary. */
-#define CAMIF_COMMAND_START  0x00000005
-
-/* bit 2= 0x1:clear the CAMIF_STATUS register
- * value. */
-#define CAMIF_COMMAND_CLEAR  0x00000004
-
-/* at stop of vfe pipeline, for now it is assumed
- * that camif will stop at any time. Bit 1:0 = 0x10:
- * disable image data capture immediately. */
-#define CAMIF_COMMAND_STOP_IMMEDIATELY  0x00000002
-
-/* at stop of vfe pipeline, for now it is assumed
- * that camif will stop at any time. Bit 1:0 = 0x00:
- * disable image data capture at frame boundary */
-#define CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY  0x00000000
-
-/* to halt axi bridge */
-#define AXI_HALT  0x00000001
-
-/* clear the halt bit. */
-#define AXI_HALT_CLEAR  0x00000000
-
-/* clear axi_halt_irq */
-#define MASK_AXI_HALT_IRQ	0xFF7FFFFF
-
-/* reset the pipeline when stop command is issued.
- * (without reset the register.) bit 26-31 = 0,
- * domain reset, bit 0-9 = 1 for module reset, except
- * register module. */
-#define VFE_RESET_UPON_STOP_CMD  0x000003ef
-
-/* reset the pipeline when reset command.
- * bit 26-31 = 0, domain reset, bit 0-9 = 1 for module reset. */
-#define VFE_RESET_UPON_RESET_CMD  0x000003ff
-
-/* bit 5 is for axi status idle or busy.
- * 1 =  halted,  0 = busy */
-#define AXI_STATUS_BUSY_MASK 0x00000020
-
-/* bit 0 & bit 1 = 1, both y and cbcr irqs need to be present
- * for frame done interrupt */
-#define VFE_COMP_IRQ_BOTH_Y_CBCR 3
-
-/* bit 1 = 1, only cbcr irq triggers frame done interrupt */
-#define VFE_COMP_IRQ_CBCR_ONLY 2
-
-/* bit 0 = 1, only y irq triggers frame done interrupt */
-#define VFE_COMP_IRQ_Y_ONLY 1
-
-/* bit 0 = 1, PM go;   bit1 = 1, PM stop */
-#define VFE_PERFORMANCE_MONITOR_GO   0x00000001
-#define VFE_PERFORMANCE_MONITOR_STOP 0x00000002
-
-/* bit 0 = 1, test gen go;   bit1 = 1, test gen stop */
-#define VFE_TEST_GEN_GO   0x00000001
-#define VFE_TEST_GEN_STOP 0x00000002
-
-/* the chroma is assumed to be interpolated between
- * the luma samples.  JPEG 4:2:2 */
-#define VFE_CHROMA_UPSAMPLE_INTERPOLATED 0
-
-/* constants for irq registers */
-#define VFE_DISABLE_ALL_IRQS 0
-/* bit =1 is to clear the corresponding bit in VFE_IRQ_STATUS.  */
-#define VFE_CLEAR_ALL_IRQS   0xffffffff
-
-#define VFE_IRQ_STATUS0_CAMIF_SOF_MASK            0x00000001
-#define VFE_IRQ_STATUS0_CAMIF_EOF_MASK            0x00000004
-#define VFE_IRQ_STATUS0_REG_UPDATE_MASK           0x00000020
-#define VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK 0x00200000
-#define VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK 0x00400000
-#define VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE2_MASK 0x00800000
-#define VFE_IRQ_STATUS1_RESET_AXI_HALT_ACK_MASK   0x00800000
-#define VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK       0x01000000
-
-#define VFE_IRQ_STATUS0_STATS_AEC     0x2000  /* bit 13 */
-#define VFE_IRQ_STATUS0_STATS_AF      0x4000  /* bit 14 */
-#define VFE_IRQ_STATUS0_STATS_AWB     0x8000  /* bit 15 */
-#define VFE_IRQ_STATUS0_STATS_RS      0x10000  /* bit 16 */
-#define VFE_IRQ_STATUS0_STATS_CS      0x20000  /* bit 17 */
-#define VFE_IRQ_STATUS0_STATS_IHIST   0x40000  /* bit 18 */
-
-#define VFE_IRQ_STATUS0_SYNC_TIMER0   0x2000000  /* bit 25 */
-#define VFE_IRQ_STATUS0_SYNC_TIMER1   0x4000000  /* bit 26 */
-#define VFE_IRQ_STATUS0_SYNC_TIMER2   0x8000000  /* bit 27 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER0  0x10000000  /* bit 28 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER1  0x20000000  /* bit 29 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER2  0x40000000  /* bit 30 */
-#define VFE_IRQ_STATUS0_ASYNC_TIMER3  0x80000000  /* bit 31 */
-
-/* imask for while waiting for stop ack,  driver has already
- * requested stop, waiting for reset irq, and async timer irq.
- * For irq_status_0, bit 28-31 are for async timer. For
- * irq_status_1, bit 22 for reset irq, bit 23 for axi_halt_ack
-   irq */
-#define VFE_IMASK_WHILE_STOPPING_0  0xF0000000
-#define VFE_IMASK_WHILE_STOPPING_1  0x00C00000
-#define VFE_IMASK_RESET             0x00400000
-#define VFE_IMASK_AXI_HALT          0x00800000
-
-
-/* no error irq in mask 0 */
-#define VFE_IMASK_ERROR_ONLY_0  0x0
-/* when normal case, don't want to block error status. */
-/* bit 0-21 are error irq bits */
-#define VFE_IMASK_ERROR_ONLY_1  0x003fffff
-
-/* For BPC bit 0,bit 12-17 and bit 26 -20 are set to zero and other's 1 */
-#define BPC_MASK 0xF80C0FFE
-
-/* For BPC bit 1 and 2 are set to zero and other's 1 */
-#define ABF_MASK 0xFFFFFFF9
-
-/* For DBPC bit 0 is set to zero and other's 1 */
-#define DBPC_MASK 0xFFFFFFFE
-
-/* For DBCC bit 1 is set to zero and other's 1 */
-#define DBCC_MASK 0xFFFFFFFD
-
-/* For DBPC/ABF/DBCC/ABCC bits are set to 1 all others 0 */
-#define DEMOSAIC_MASK 0x8FFFFFFF
-/* For MCE enable bit 28 set to zero and other's 1 */
-#define MCE_EN_MASK 0xEFFFFFFF
-
-/* For MCE Q_K bit 28 to 31 set to zero and other's 1 */
-#define MCE_Q_K_MASK 0x0FFFFFFF
-
-#define AE_BG_ENABLE_MASK 0x00000020      /* bit 5 */
-#define AF_BF_ENABLE_MASK 0x00000040      /* bit 6 */
-#define AWB_ENABLE_MASK 0x00000080     /* bit 7 */
-
-#define RS_ENABLE_MASK 0x00000100      /* bit 8  */
-#define CS_ENABLE_MASK 0x00000200      /* bit 9  */
-#define RS_CS_ENABLE_MASK 0x00000300   /* bit 8,9  */
-#define IHIST_ENABLE_MASK 0x00008000   /* bit 15 */
-#define STATS_ENABLE_MASK 0x000483E0   /* bit 18,15,9,8,7,6,5*/
-
-#define VFE_REG_UPDATE_TRIGGER           1
-#define VFE_PM_BUF_MAX_CNT_MASK          0xFF
-#define VFE_DMI_CFG_DEFAULT              0x00000100
-#define VFE_AE_PINGPONG_STATUS_BIT       0x80
-#define VFE_AF_PINGPONG_STATUS_BIT       0x100
-#define VFE_AWB_PINGPONG_STATUS_BIT      0x200
-
-#define HFR_MODE_OFF 1
-#define VFE_FRAME_SKIP_PERIOD_MASK 0x0000001F /*bits 0 -4*/
-
-enum VFE31_DMI_RAM_SEL {
-	 NO_MEM_SELECTED          = 0,
-	 ROLLOFF_RAM              = 0x1,
-	 RGBLUT_RAM_CH0_BANK0     = 0x2,
-	 RGBLUT_RAM_CH0_BANK1     = 0x3,
-	 RGBLUT_RAM_CH1_BANK0     = 0x4,
-	 RGBLUT_RAM_CH1_BANK1     = 0x5,
-	 RGBLUT_RAM_CH2_BANK0     = 0x6,
-	 RGBLUT_RAM_CH2_BANK1     = 0x7,
-	 STATS_HIST_RAM           = 0x8,
-	 RGBLUT_CHX_BANK0         = 0x9,
-	 RGBLUT_CHX_BANK1         = 0xa,
-	 LUMA_ADAPT_LUT_RAM_BANK0 = 0xb,
-	 LUMA_ADAPT_LUT_RAM_BANK1 = 0xc
-};
-
-enum vfe_output_state {
-	VFE_STATE_IDLE,
-	VFE_STATE_START_REQUESTED,
-	VFE_STATE_STARTED,
-	VFE_STATE_STOP_REQUESTED,
-	VFE_STATE_STOPPED,
-};
-
-#define V31_CAMIF_OFF             0x000001E4
-#define V31_CAMIF_LEN             32
-
-#define V31_DEMUX_OFF             0x00000284
-#define V31_DEMUX_LEN             20
-
-#define V31_DEMOSAICV3_UP_REG_CNT 5
-
-#define V31_OUT_CLAMP_OFF         0x00000524
-#define V31_OUT_CLAMP_LEN         8
-
-#define V31_OPERATION_CFG_LEN     32
-
-#define V31_AXI_BUS_CMD_OFF       0x00000038
-#define V31_AXI_OUT_OFF           0x0000003C
-#define V31_AXI_OUT_LEN           240
-#define V31_AXI_CFG_LEN           47
-#define V31_AXI_RESERVED            1
-#define V31_AXI_RESERVED_LEN        4
-#define V31_AXI_BUS_CFG_LEN       16
-
-#define V31_FRAME_SKIP_OFF        0x00000504
-#define V31_FRAME_SKIP_LEN        32
-
-#define V31_CHROMA_SUBS_OFF       0x000004F8
-#define V31_CHROMA_SUBS_LEN       12
-
-#define V31_FOV_OFF           0x00000360
-#define V31_FOV_LEN           8
-
-#define V31_MAIN_SCALER_OFF 0x00000368
-#define V31_MAIN_SCALER_LEN 28
-
-#define V31_S2Y_OFF 0x000004D0
-#define V31_S2Y_LEN 20
-
-#define V31_S2CbCr_OFF 0x000004E4
-#define V31_S2CbCr_LEN 20
-
-#define V31_CHROMA_EN_OFF 0x000003C4
-#define V31_CHROMA_EN_LEN 36
-
-#define V31_SYNC_TIMER_OFF      0x0000020C
-#define V31_SYNC_TIMER_POLARITY_OFF 0x00000234
-#define V31_TIMER_SELECT_OFF        0x0000025C
-#define V31_SYNC_TIMER_LEN 28
-
-#define V31_ASYNC_TIMER_OFF 0x00000238
-#define V31_ASYNC_TIMER_LEN 28
-
-#define V31_BLACK_LEVEL_OFF 0x00000264
-#define V31_BLACK_LEVEL_LEN 16
-
-#define V31_MESH_ROLL_OFF_CFG_OFF             0x00000274
-#define V31_MESH_ROLL_OFF_CFG_LEN             16
-#define V31_MESH_ROLL_OFF_INIT_TABLE_SIZE     13
-#define V31_MESH_ROLL_OFF_DELTA_TABLE_SIZE    208
-#define V31_MESH_ROLL_OFF_DELTA_TABLE_OFFSET  32
-
-#define V31_COLOR_COR_OFF 0x00000388
-#define V31_COLOR_COR_LEN 52
-
-#define V31_WB_OFF 0x00000384
-#define V31_WB_LEN 4
-
-#define V31_RGB_G_OFF 0x000003BC
-#define V31_RGB_G_LEN 4
-
-#define V31_LA_OFF 0x000003C0
-#define V31_LA_LEN 4
-
-#define V31_SCE_OFF 0x00000418
-#define V31_SCE_LEN 136
-
-#define V31_CHROMA_SUP_OFF 0x000003E8
-#define V31_CHROMA_SUP_LEN 12
-
-#define V31_MCE_OFF 0x000003F4
-#define V31_MCE_LEN 36
-#define V31_STATS_AF_OFF 0x0000053c
-#define V31_STATS_AF_LEN 16
-
-#define V31_STATS_AE_OFF 0x00000534
-#define V31_STATS_AE_LEN 8
-
-#define V31_STATS_AWB_OFF 0x0000054c
-#define V31_STATS_AWB_LEN 32
-
-#define V31_STATS_IHIST_OFF 0x0000057c
-#define V31_STATS_IHIST_LEN 8
-
-#define V31_STATS_RS_OFF 0x0000056c
-#define V31_STATS_RS_LEN 8
-
-#define V31_STATS_CS_OFF 0x00000574
-#define V31_STATS_CS_LEN 8
-
-#define V31_ASF_OFF 0x000004A0
-#define V31_ASF_LEN 48
-#define V31_ASF_UPDATE_LEN 36
-#define V31_CAPTURE_LEN 4
-#define V31_GET_HW_VERSION_OFF 0
-#define V31_GET_HW_VERSION_LEN 4
-#define V31_DEMOSAICV3_OFF 0x00000298
-#define V31_DEMOSAICV3_LEN 4
-/* BPC     */
-#define V31_DEMOSAICV3_DBPC_CFG_OFF  0x0000029C
-#define V31_DEMOSAICV3_DBPC_LEN 8
-#define V31_XBAR_CFG_OFF 0x00000040
-/* ABF     */
-#define V31_DEMOSAICV3_ABF_OFF 0x000002A4
-#define V31_DEMOSAICV3_ABF_LEN 180
-#define V31_XBAR_CFG_LEN 8
-
-#define V31_MODULE_CFG_OFF 0x00000010
-#define V31_MODULE_CFG_LEN 4
-#define V31_EZTUNE_CFG_OFF 0x00000010
-#define V31_EZTUNE_CFG_LEN 4
-
-struct vfe_cmd_hw_version {
-	uint32_t minorVersion;
-	uint32_t majorVersion;
-	uint32_t coreVersion;
-};
-
-enum VFE_AXI_OUTPUT_MODE {
-	VFE_AXI_OUTPUT_MODE_Output1,
-	VFE_AXI_OUTPUT_MODE_Output2,
-	VFE_AXI_OUTPUT_MODE_Output1AndOutput2,
-	VFE_AXI_OUTPUT_MODE_CAMIFToAXIViaOutput2,
-	VFE_AXI_OUTPUT_MODE_Output2AndCAMIFToAXIViaOutput1,
-	VFE_AXI_OUTPUT_MODE_Output1AndCAMIFToAXIViaOutput2,
-	VFE_AXI_LAST_OUTPUT_MODE_ENUM
-};
-
-enum VFE_RAW_WR_PATH_SEL {
-	VFE_RAW_OUTPUT_DISABLED,
-	VFE_RAW_OUTPUT_ENC_CBCR_PATH,
-	VFE_RAW_OUTPUT_VIEW_CBCR_PATH,
-	VFE_RAW_OUTPUT_PATH_INVALID
-};
-
-#define VFE_AXI_OUTPUT_BURST_LENGTH     4
-#define VFE_MAX_NUM_FRAGMENTS_PER_FRAME 4
-#define VFE_AXI_OUTPUT_CFG_FRAME_COUNT  3
-
-struct vfe_cmds_per_write_master {
-	uint16_t imageWidth;
-	uint16_t imageHeight;
-	uint16_t outRowCount;
-	uint16_t outRowIncrement;
-	uint32_t outFragments[VFE_AXI_OUTPUT_CFG_FRAME_COUNT]
-		[VFE_MAX_NUM_FRAGMENTS_PER_FRAME];
-};
-
-struct vfe_cmds_axi_per_output_path {
-	uint8_t fragmentCount;
-	struct vfe_cmds_per_write_master firstWM;
-	struct vfe_cmds_per_write_master secondWM;
-};
-
-enum VFE_AXI_BURST_LENGTH {
-	VFE_AXI_BURST_LENGTH_IS_2  = 2,
-	VFE_AXI_BURST_LENGTH_IS_4  = 4,
-	VFE_AXI_BURST_LENGTH_IS_8  = 8,
-	VFE_AXI_BURST_LENGTH_IS_16 = 16
-};
-
-struct vfe_cmd_fov_crop_config {
-	uint8_t enable;
-	uint16_t firstPixel;
-	uint16_t lastPixel;
-	uint16_t firstLine;
-	uint16_t lastLine;
-};
-
-struct vfe_cmds_main_scaler_stripe_init {
-	uint16_t MNCounterInit;
-	uint16_t phaseInit;
-};
-
-struct vfe_cmds_scaler_one_dimension {
-	uint8_t  enable;
-	uint16_t inputSize;
-	uint16_t outputSize;
-	uint32_t phaseMultiplicationFactor;
-	uint8_t  interpolationResolution;
-};
-
-struct vfe_cmd_main_scaler_config {
-	uint8_t enable;
-	struct vfe_cmds_scaler_one_dimension    hconfig;
-	struct vfe_cmds_scaler_one_dimension    vconfig;
-	struct vfe_cmds_main_scaler_stripe_init MNInitH;
-	struct vfe_cmds_main_scaler_stripe_init MNInitV;
-};
-
-struct vfe_cmd_scaler2_config {
-	uint8_t enable;
-	struct vfe_cmds_scaler_one_dimension hconfig;
-	struct vfe_cmds_scaler_one_dimension vconfig;
-};
-
-
-struct vfe_cmd_frame_skip_update {
-	uint32_t output1Pattern;
-	uint32_t output2Pattern;
-};
-
-struct vfe_cmd_output_clamp_config {
-	uint8_t minCh0;
-	uint8_t minCh1;
-	uint8_t minCh2;
-	uint8_t maxCh0;
-	uint8_t maxCh1;
-	uint8_t maxCh2;
-};
-
-struct vfe_cmd_chroma_subsample_config {
-	uint8_t enable;
-	uint8_t cropEnable;
-	uint8_t vsubSampleEnable;
-	uint8_t hsubSampleEnable;
-	uint8_t vCosited;
-	uint8_t hCosited;
-	uint8_t vCositedPhase;
-	uint8_t hCositedPhase;
-	uint16_t cropWidthFirstPixel;
-	uint16_t cropWidthLastPixel;
-	uint16_t cropHeightFirstLine;
-	uint16_t cropHeightLastLine;
-};
-
-enum VFE_START_PIXEL_PATTERN {
-	VFE_BAYER_RGRGRG,
-	VFE_BAYER_GRGRGR,
-	VFE_BAYER_BGBGBG,
-	VFE_BAYER_GBGBGB,
-	VFE_YUV_YCbYCr,
-	VFE_YUV_YCrYCb,
-	VFE_YUV_CbYCrY,
-	VFE_YUV_CrYCbY
-};
-
-enum VFE_BUS_RD_INPUT_PIXEL_PATTERN {
-	VFE_BAYER_RAW,
-	VFE_YUV_INTERLEAVED,
-	VFE_YUV_PSEUDO_PLANAR_Y,
-	VFE_YUV_PSEUDO_PLANAR_CBCR
-};
-
-enum VFE_YUV_INPUT_COSITING_MODE {
-	VFE_YUV_COSITED,
-	VFE_YUV_INTERPOLATED
-};
-
-#define VFE31_GAMMA_NUM_ENTRIES  64
-
-#define VFE31_LA_TABLE_LENGTH    64
-
-#define VFE31_HIST_TABLE_LENGTH  256
-
-struct vfe_cmds_demosaic_abf {
-	uint8_t   enable;
-	uint8_t   forceOn;
-	uint8_t   shift;
-	uint16_t  lpThreshold;
-	uint16_t  max;
-	uint16_t  min;
-	uint8_t   ratio;
-};
-
-struct vfe_cmds_demosaic_bpc {
-	uint8_t   enable;
-	uint16_t  fmaxThreshold;
-	uint16_t  fminThreshold;
-	uint16_t  redDiffThreshold;
-	uint16_t  blueDiffThreshold;
-	uint16_t  greenDiffThreshold;
-};
-
-struct vfe_cmd_demosaic_config {
-	uint8_t   enable;
-	uint8_t   slopeShift;
-	struct vfe_cmds_demosaic_abf abfConfig;
-	struct vfe_cmds_demosaic_bpc bpcConfig;
-};
-
-struct vfe_cmd_demosaic_bpc_update {
-	struct vfe_cmds_demosaic_bpc bpcUpdate;
-};
-
-struct vfe_cmd_demosaic_abf_update {
-	struct vfe_cmds_demosaic_abf abfUpdate;
-};
-
-struct vfe_cmd_white_balance_config {
-	uint8_t  enable;
-	uint16_t ch2Gain;
-	uint16_t ch1Gain;
-	uint16_t ch0Gain;
-};
-
-enum VFE_COLOR_CORRECTION_COEF_QFACTOR {
-	COEF_IS_Q7_SIGNED,
-	COEF_IS_Q8_SIGNED,
-	COEF_IS_Q9_SIGNED,
-	COEF_IS_Q10_SIGNED
-};
-
-struct vfe_cmd_color_correction_config {
-	uint8_t     enable;
-	enum VFE_COLOR_CORRECTION_COEF_QFACTOR coefQFactor;
-	int16_t  C0;
-	int16_t  C1;
-	int16_t  C2;
-	int16_t  C3;
-	int16_t  C4;
-	int16_t  C5;
-	int16_t  C6;
-	int16_t  C7;
-	int16_t  C8;
-	int16_t  K0;
-	int16_t  K1;
-	int16_t  K2;
-};
-
-#define VFE_LA_TABLE_LENGTH 64
-
-struct vfe_cmd_la_config {
-	uint8_t enable;
-	int16_t table[VFE_LA_TABLE_LENGTH];
-};
-
-#define VFE_GAMMA_TABLE_LENGTH 256
-enum VFE_RGB_GAMMA_TABLE_SELECT {
-	RGB_GAMMA_CH0_SELECTED,
-	RGB_GAMMA_CH1_SELECTED,
-	RGB_GAMMA_CH2_SELECTED,
-	RGB_GAMMA_CH0_CH1_SELECTED,
-	RGB_GAMMA_CH0_CH2_SELECTED,
-	RGB_GAMMA_CH1_CH2_SELECTED,
-	RGB_GAMMA_CH0_CH1_CH2_SELECTED
-};
-
-struct vfe_cmd_rgb_gamma_config {
-	uint8_t enable;
-	enum VFE_RGB_GAMMA_TABLE_SELECT channelSelect;
-	int16_t table[VFE_GAMMA_TABLE_LENGTH];
-};
-
-struct vfe_cmd_chroma_enhan_config {
-	uint8_t  enable;
-	int16_t am;
-	int16_t ap;
-	int16_t bm;
-	int16_t bp;
-	int16_t cm;
-	int16_t cp;
-	int16_t dm;
-	int16_t dp;
-	int16_t kcr;
-	int16_t kcb;
-	int16_t RGBtoYConversionV0;
-	int16_t RGBtoYConversionV1;
-	int16_t RGBtoYConversionV2;
-	uint8_t RGBtoYConversionOffset;
-};
-
-struct vfe_cmd_chroma_suppression_config {
-	uint8_t enable;
-	uint8_t m1;
-	uint8_t m3;
-	uint8_t n1;
-	uint8_t n3;
-	uint8_t nn1;
-	uint8_t mm1;
-};
-
-struct vfe_cmd_asf_config {
-	uint8_t enable;
-	uint8_t smoothFilterEnabled;
-	uint8_t sharpMode;
-	uint8_t smoothCoefCenter;
-	uint8_t smoothCoefSurr;
-	uint8_t normalizeFactor;
-	uint8_t sharpK1;
-	uint8_t sharpK2;
-	uint8_t sharpThreshE1;
-	int8_t sharpThreshE2;
-	int8_t sharpThreshE3;
-	int8_t sharpThreshE4;
-	int8_t sharpThreshE5;
-	int8_t filter1Coefficients[9];
-	int8_t filter2Coefficients[9];
-	uint8_t  cropEnable;
-	uint16_t cropFirstPixel;
-	uint16_t cropLastPixel;
-	uint16_t cropFirstLine;
-	uint16_t cropLastLine;
-};
-
-struct vfe_cmd_asf_update {
-	uint8_t enable;
-	uint8_t smoothFilterEnabled;
-	uint8_t sharpMode;
-	uint8_t smoothCoefCenter;
-	uint8_t smoothCoefSurr;
-	uint8_t normalizeFactor;
-	uint8_t sharpK1;
-	uint8_t sharpK2;
-	uint8_t sharpThreshE1;
-	int8_t  sharpThreshE2;
-	int8_t  sharpThreshE3;
-	int8_t  sharpThreshE4;
-	int8_t  sharpThreshE5;
-	int8_t  filter1Coefficients[9];
-	int8_t  filter2Coefficients[9];
-	uint8_t cropEnable;
-};
-
-enum VFE_TEST_GEN_SYNC_EDGE {
-	VFE_TEST_GEN_SYNC_EDGE_ActiveHigh,
-	VFE_TEST_GEN_SYNC_EDGE_ActiveLow
-};
-
-
-struct vfe_cmd_bus_pm_start {
-	uint8_t output2YWrPmEnable;
-	uint8_t output2CbcrWrPmEnable;
-	uint8_t output1YWrPmEnable;
-	uint8_t output1CbcrWrPmEnable;
-};
-
-struct  vfe_frame_skip_counts {
-	uint32_t  totalFrameCount;
-	uint32_t  output1Count;
-	uint32_t  output2Count;
-};
-
-enum VFE_AXI_RD_UNPACK_HBI_SEL {
-	VFE_AXI_RD_HBI_32_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_64_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_128_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_256_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_512_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_1024_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_2048_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_4096_CLOCK_CYCLES
-};
-
-struct vfe_frame_bpc_info {
-	uint32_t greenDefectPixelCount;
-	uint32_t redBlueDefectPixelCount;
-};
-
-struct vfe_frame_asf_info {
-	uint32_t  asfMaxEdge;
-	uint32_t  asfHbiCount;
-};
-
-struct vfe_msg_camif_status {
-	uint8_t  camifState;
-	uint32_t pixelCount;
-	uint32_t lineCount;
-};
-
-struct vfe31_irq_status {
-	uint32_t vfeIrqStatus0;
-	uint32_t vfeIrqStatus1;
-	uint32_t camifStatus;
-	uint32_t demosaicStatus;
-	uint32_t asfMaxEdge;
-};
-
-#define V31_PREVIEW_AXI_FLAG  0x00000001
-#define V31_SNAPSHOT_AXI_FLAG (0x00000001<<1)
-
-struct vfe31_cmd_type {
-	uint16_t id;
-	uint32_t length;
-	uint32_t offset;
-	uint32_t flag;
-};
-
-struct vfe31_free_buf {
-	struct list_head node;
-	uint32_t paddr;
-	uint32_t y_off;
-	uint32_t cbcr_off;
-};
-
-struct vfe31_output_ch {
-	struct list_head free_buf_queue;
-	spinlock_t free_buf_lock;
-	uint32_t inst_handle;
-	int8_t ch0;
-	int8_t ch1;
-	int8_t ch2;
-	uint32_t  capture_cnt;
-	uint32_t  frame_drop_cnt;
-	struct msm_free_buf ping;
-	struct msm_free_buf pong;
-	struct msm_free_buf free_buf;
-};
-
-/* no error irq in mask 0 */
-#define VFE31_IMASK_ERROR_ONLY_0  0x0
-/* when normal case, don't want to block error status. */
-/* bit 0-21 are error irq bits */
-#define VFE31_IMASK_ERROR_ONLY_1               0x003FFFFF
-#define VFE31_IMASK_CAMIF_ERROR               (0x00000001<<0)
-#define VFE31_IMASK_STATS_CS_OVWR             (0x00000001<<1)
-#define VFE31_IMASK_STATS_IHIST_OVWR          (0x00000001<<2)
-#define VFE31_IMASK_REALIGN_BUF_Y_OVFL        (0x00000001<<3)
-#define VFE31_IMASK_REALIGN_BUF_CB_OVFL       (0x00000001<<4)
-#define VFE31_IMASK_REALIGN_BUF_CR_OVFL       (0x00000001<<5)
-#define VFE31_IMASK_VIOLATION                 (0x00000001<<6)
-#define VFE31_IMASK_IMG_MAST_0_BUS_OVFL       (0x00000001<<7)
-#define VFE31_IMASK_IMG_MAST_1_BUS_OVFL       (0x00000001<<8)
-#define VFE31_IMASK_IMG_MAST_2_BUS_OVFL       (0x00000001<<9)
-#define VFE31_IMASK_IMG_MAST_3_BUS_OVFL       (0x00000001<<10)
-#define VFE31_IMASK_IMG_MAST_4_BUS_OVFL       (0x00000001<<11)
-#define VFE31_IMASK_IMG_MAST_5_BUS_OVFL       (0x00000001<<12)
-#define VFE31_IMASK_IMG_MAST_6_BUS_OVFL       (0x00000001<<13)
-#define VFE31_IMASK_STATS_AE_BG_BUS_OVFL         (0x00000001<<14)
-#define VFE31_IMASK_STATS_AF_BF_BUS_OVFL         (0x00000001<<15)
-#define VFE31_IMASK_STATS_AWB_BUS_OVFL        (0x00000001<<16)
-#define VFE31_IMASK_STATS_RS_BUS_OVFL         (0x00000001<<17)
-#define VFE31_IMASK_STATS_CS_BUS_OVFL         (0x00000001<<18)
-#define VFE31_IMASK_STATS_IHIST_BUS_OVFL      (0x00000001<<19)
-#define VFE31_IMASK_STATS_SKIN_BHIST_BUS_OVFL       (0x00000001<<20)
-#define VFE31_IMASK_AXI_ERROR                 (0x00000001<<21)
-
-#define VFE_COM_STATUS 0x000FE000
-
-struct vfe31_output_path {
-	uint16_t output_mode;     /* bitmask  */
-
-	struct vfe31_output_ch out0; /* preview and thumbnail */
-	struct vfe31_output_ch out1; /* snapshot */
-	struct vfe31_output_ch out2; /* video    */
-};
-
-struct vfe31_frame_extra {
-	uint32_t greenDefectPixelCount;
-	uint32_t redBlueDefectPixelCount;
-
-	uint32_t  asfMaxEdge;
-	uint32_t  asfHbiCount;
-
-	uint32_t yWrPmStats0;
-	uint32_t yWrPmStats1;
-	uint32_t cbcrWrPmStats0;
-	uint32_t cbcrWrPmStats1;
-
-	uint32_t  frameCounter;
-};
-
-#define VFE_DISABLE_ALL_IRQS             0
-#define VFE_CLEAR_ALL_IRQS               0xffffffff
-
-#define VFE_HW_VERSION					 0x00000000
-#define VFE_GLOBAL_RESET                 0x00000004
-#define VFE_MODULE_RESET				 0x00000008
-#define VFE_CGC_OVERRIDE                 0x0000000C
-#define VFE_MODULE_CFG                   0x00000010
-#define VFE_CFG				 0x00000014
-#define VFE_IRQ_CMD                      0x00000018
-#define VFE_IRQ_MASK_0                   0x0000001C
-#define VFE_IRQ_MASK_1                   0x00000020
-#define VFE_IRQ_CLEAR_0                  0x00000024
-#define VFE_IRQ_CLEAR_1                  0x00000028
-#define VFE_IRQ_STATUS_0                 0x0000002C
-#define VFE_IRQ_STATUS_1                 0x00000030
-#define VFE_IRQ_COMP_MASK                0x00000034
-#define VFE_BUS_CMD                      0x00000038
-#define VFE_BUS_PING_PONG_STATUS         0x00000180
-#define VFE_BUS_OPERATION_STATUS         0x00000184
-
-#define VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_0        0x00000190
-#define VFE_BUS_IMAGE_MASTER_0_WR_PM_STATS_1        0x00000194
-
-#define VFE_AXI_CMD                      0x000001D8
-#define VFE_AXI_STATUS                   0x000001DC
-#define VFE_BUS_STATS_PING_PONG_BASE     0x000000F4
-
-#define VFE_BUS_STATS_AEC_WR_PING_ADDR   0x000000F4
-#define VFE_BUS_STATS_AEC_WR_PONG_ADDR   0x000000F8
-#define VFE_BUS_STATS_AEC_UB_CFG         0x000000FC
-#define VFE_BUS_STATS_AF_WR_PING_ADDR    0x00000100
-#define VFE_BUS_STATS_AF_WR_PONG_ADDR    0x00000104
-#define VFE_BUS_STATS_AF_UB_CFG          0x00000108
-#define VFE_BUS_STATS_AWB_WR_PING_ADDR   0x0000010C
-#define VFE_BUS_STATS_AWB_WR_PONG_ADDR   0x00000110
-#define VFE_BUS_STATS_AWB_UB_CFG         0x00000114
-#define VFE_BUS_STATS_RS_WR_PING_ADDR    0x00000118
-#define VFE_BUS_STATS_RS_WR_PONG_ADDR    0x0000011C
-#define VFE_BUS_STATS_RS_UB_CFG          0x00000120
-
-#define VFE_BUS_STATS_CS_WR_PING_ADDR    0x00000124
-#define VFE_BUS_STATS_CS_WR_PONG_ADDR    0x00000128
-#define VFE_BUS_STATS_CS_UB_CFG          0x0000012C
-#define VFE_BUS_STATS_HIST_WR_PING_ADDR  0x00000130
-#define VFE_BUS_STATS_HIST_WR_PONG_ADDR  0x00000134
-#define VFE_BUS_STATS_HIST_UB_CFG        0x00000138
-#define VFE_BUS_STATS_SKIN_WR_PING_ADDR  0x0000013C
-#define VFE_BUS_STATS_SKIN_WR_PONG_ADDR  0x00000140
-#define VFE_BUS_STATS_SKIN_UB_CFG        0x00000144
-#define VFE_BUS_PM_CMD                   0x00000188
-#define VFE_BUS_PM_CFG                   0x0000018C
-#define VFE_CAMIF_COMMAND                0x000001E0
-#define VFE_CAMIF_STATUS                 0x00000204
-#define VFE_REG_UPDATE_CMD               0x00000260
-#define VFE_DEMUX_GAIN_0                 0x00000288
-#define VFE_DEMUX_GAIN_1                 0x0000028C
-#define VFE_CHROMA_UP                    0x0000035C
-#define VFE_FRAMEDROP_ENC_Y_CFG          0x00000504
-#define VFE_FRAMEDROP_ENC_CBCR_CFG       0x00000508
-#define VFE_FRAMEDROP_ENC_Y_PATTERN      0x0000050C
-#define VFE_FRAMEDROP_ENC_CBCR_PATTERN   0x00000510
-#define VFE_FRAMEDROP_VIEW_Y             0x00000514
-#define VFE_FRAMEDROP_VIEW_CBCR          0x00000518
-#define VFE_FRAMEDROP_VIEW_Y_PATTERN     0x0000051C
-#define VFE_FRAMEDROP_VIEW_CBCR_PATTERN  0x00000520
-#define VFE_CLAMP_MAX                    0x00000524
-#define VFE_CLAMP_MIN                    0x00000528
-#define VFE_REALIGN_BUF                  0x0000052C
-#define VFE_STATS_CFG                    0x00000530
-#define VFE_STATS_AWB_SGW_CFG            0x00000554
-#define VFE_DMI_CFG                      0x00000598
-#define VFE_DMI_ADDR                     0x0000059C
-#define VFE_DMI_DATA_LO                  0x000005A4
-#define VFE_AXI_CFG                      0x00000600
-
-#define VFE31_OUTPUT_MODE_PT		BIT(0)
-#define VFE31_OUTPUT_MODE_S			BIT(1)
-#define VFE31_OUTPUT_MODE_V			BIT(2)
-#define VFE31_OUTPUT_MODE_P			BIT(3)
-#define VFE31_OUTPUT_MODE_T			BIT(4)
-#define VFE31_OUTPUT_MODE_P_ALL_CHNLS		BIT(5)
-#define VFE31_OUTPUT_MODE_PRIMARY		BIT(6)
-#define VFE31_OUTPUT_MODE_PRIMARY_ALL_CHNLS	BIT(7)
-#define VFE31_OUTPUT_MODE_SECONDARY		BIT(8)
-#define VFE31_OUTPUT_MODE_SECONDARY_ALL_CHNLS	BIT(9)
-struct vfe_stats_control {
-	uint8_t  ackPending;
-	uint32_t nextFrameAddrBuf;
-	uint32_t droppedStatsFrameCount;
-	uint32_t bufToRender;
-};
-
-struct vfe31_ctrl_type {
-	uint16_t operation_mode;     /* streaming or snapshot */
-	struct vfe31_output_path outpath;
-
-	uint32_t vfeImaskCompositePacked;
-
-	spinlock_t  stop_flag_lock;
-	spinlock_t  update_ack_lock;
-	spinlock_t  state_lock;
-	spinlock_t  io_lock;
-	spinlock_t  stats_bufq_lock;
-
-	uint32_t extlen;
-	void *extdata;
-
-	int8_t start_ack_pending;
-	int8_t stop_ack_pending;
-	int8_t reset_ack_pending;
-	int8_t update_ack_pending;
-	enum vfe_output_state recording_state;
-	int8_t update_linear;
-	int8_t update_rolloff;
-	int8_t update_la;
-	int8_t update_gamma;
-	enum vfe_output_state liveshot_state;
-
-	spinlock_t  tasklet_lock;
-	struct list_head tasklet_q;
-	void __iomem *vfebase;
-	void __iomem *camifbase;
-	void *syncdata;
-	uint32_t register_total;
-
-	struct resource	*vfemem;
-	struct resource	*camifmem;
-	struct resource *vfeio;
-	struct resource *camifio;
-	struct resource *vfeirq;
-	struct regulator *fs_vfe;
-
-	uint32_t stats_comp;
-	atomic_t vstate;
-	uint32_t vfe_capture_count;
-	uint32_t sync_timer_repeat_count;
-	uint32_t sync_timer_state;
-	uint32_t sync_timer_number;
-
-	uint32_t vfeFrameId;
-	uint32_t output1Pattern;
-	uint32_t output1Period;
-	uint32_t output2Pattern;
-	uint32_t output2Period;
-	uint32_t vfeFrameSkipCount;
-	uint32_t vfeFrameSkipPeriod;
-	struct vfe_stats_control afStatsControl;
-	struct vfe_stats_control awbStatsControl;
-	struct vfe_stats_control aecStatsControl;
-	struct vfe_stats_control ihistStatsControl;
-	struct vfe_stats_control rsStatsControl;
-	struct vfe_stats_control csStatsControl;
-
-	/* v4l2 subdev */
-	struct v4l2_subdev subdev;
-	struct platform_device *pdev;
-	struct clk *vfe_clk[5];
-	struct clk *vfe_camif_clk[2];
-	spinlock_t  sd_notify_lock;
-	uint32_t hfr_mode;
-	uint32_t frame_skip_cnt;
-	uint32_t frame_skip_pattern;
-	uint32_t snapshot_frame_cnt;
-	struct msm_stats_bufq_ctrl stats_ctrl;
-	struct msm_stats_ops stats_ops;
-	struct device *iommu_ctx_imgwr;
-	struct device *iommu_ctx_misc;
-};
-
-enum VFE31_STATS_NUM {
-	STATS_AE_NUM,
-	STATS_AF_NUM,
-	STATS_AWB_NUM,
-	STATS_RS_NUM,
-	STATS_CS_NUM,
-	STATS_IHIST_NUM,
-	STATS_SKIN_NUM,
-	STATS_MAX_NUM,
-};
-
-struct vfe_cmd_stats_ack {
-	uint32_t  nextStatsBuf;
-};
-
-#define VFE_STATS_BUFFER_COUNT            3
-
-struct vfe_cmd_stats_buf {
-	uint32_t statsBuf[VFE_STATS_BUFFER_COUNT];
-};
-#endif /* __MSM_VFE31_H__ */
diff --git a/drivers/media/video/msm/vfe/msm_vfe32.c b/drivers/media/video/msm/vfe/msm_vfe32.c
deleted file mode 100644
index d38660a..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe32.c
+++ /dev/null
@@ -1,7683 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/module.h>
-#include <linux/uaccess.h>
-#include <linux/interrupt.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/atomic.h>
-#include <linux/regulator/consumer.h>
-#include <linux/clk.h>
-#include <mach/irqs.h>
-#include <mach/camera.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-subdev.h>
-#include <media/msm_isp.h>
-
-#include "msm.h"
-#include "msm_cam_server.h"
-#include "msm_vfe32.h"
-
-atomic_t irq_cnt;
-
-#define VFE32_AXI_OFFSET 0x0050
-#define vfe32_get_ch_ping_addr(base, chn) \
-	(msm_camera_io_r((base) + 0x0050 + 0x18 * (chn)))
-#define vfe32_get_ch_pong_addr(base, chn) \
-	(msm_camera_io_r((base) + 0x0050 + 0x18 * (chn) + 4))
-#define vfe32_get_ch_addr(ping_pong, base, chn) \
-	((((ping_pong) & (1 << (chn))) == 0) ? \
-	(vfe32_get_ch_pong_addr((base), chn)) : \
-	(vfe32_get_ch_ping_addr((base), chn)))
-
-#define vfe32_put_ch_ping_addr(base, chn, addr) \
-	(msm_camera_io_w((addr), (base) + 0x0050 + 0x18 * (chn)))
-#define vfe32_put_ch_pong_addr(base, chn, addr) \
-	(msm_camera_io_w((addr), (base) + 0x0050 + 0x18 * (chn) + 4))
-#define vfe32_put_ch_addr(ping_pong, base, chn, addr) \
-	(((ping_pong) & (1 << (chn))) == 0 ?   \
-	vfe32_put_ch_pong_addr((base), (chn), (addr)) : \
-	vfe32_put_ch_ping_addr((base), (chn), (addr)))
-
-static uint32_t vfe_clk_rate;
-static void vfe32_send_isp_msg(struct v4l2_subdev *sd,
-	uint32_t vfeFrameId, uint32_t isp_msg_id);
-
-
-struct vfe32_isr_queue_cmd {
-	struct list_head list;
-	uint32_t                           vfeInterruptStatus0;
-	uint32_t                           vfeInterruptStatus1;
-};
-
-static struct vfe32_cmd_type vfe32_cmd[] = {
-/* 0*/	{VFE_CMD_DUMMY_0},
-		{VFE_CMD_SET_CLK},
-		{VFE_CMD_RESET},
-		{VFE_CMD_START},
-		{VFE_CMD_TEST_GEN_START},
-/* 5*/	{VFE_CMD_OPERATION_CFG, V32_OPERATION_CFG_LEN},
-		{VFE_CMD_AXI_OUT_CFG, V32_AXI_OUT_LEN, V32_AXI_OUT_OFF, 0xFF},
-		{VFE_CMD_CAMIF_CFG, V32_CAMIF_LEN, V32_CAMIF_OFF, 0xFF},
-		{VFE_CMD_AXI_INPUT_CFG},
-		{VFE_CMD_BLACK_LEVEL_CFG, V32_BLACK_LEVEL_LEN,
-		V32_BLACK_LEVEL_OFF,
-		0xFF},
-/*10*/  {VFE_CMD_MESH_ROLL_OFF_CFG, V32_MESH_ROLL_OFF_CFG_LEN,
-		V32_MESH_ROLL_OFF_CFG_OFF, 0xFF},
-		{VFE_CMD_DEMUX_CFG, V32_DEMUX_LEN, V32_DEMUX_OFF, 0xFF},
-		{VFE_CMD_FOV_CFG, V32_FOV_LEN, V32_FOV_OFF, 0xFF},
-		{VFE_CMD_MAIN_SCALER_CFG, V32_MAIN_SCALER_LEN,
-		V32_MAIN_SCALER_OFF, 0xFF},
-		{VFE_CMD_WB_CFG, V32_WB_LEN, V32_WB_OFF, 0xFF},
-/*15*/	{VFE_CMD_COLOR_COR_CFG, V32_COLOR_COR_LEN, V32_COLOR_COR_OFF, 0xFF},
-		{VFE_CMD_RGB_G_CFG, V32_RGB_G_LEN, V32_RGB_G_OFF, 0xFF},
-		{VFE_CMD_LA_CFG, V32_LA_LEN, V32_LA_OFF, 0xFF },
-		{VFE_CMD_CHROMA_EN_CFG, V32_CHROMA_EN_LEN, V32_CHROMA_EN_OFF,
-		0xFF},
-		{VFE_CMD_CHROMA_SUP_CFG, V32_CHROMA_SUP_LEN, V32_CHROMA_SUP_OFF,
-		0xFF},
-/*20*/	{VFE_CMD_MCE_CFG, V32_MCE_LEN, V32_MCE_OFF, 0xFF},
-		{VFE_CMD_SK_ENHAN_CFG, V32_SCE_LEN, V32_SCE_OFF, 0xFF},
-		{VFE_CMD_ASF_CFG, V32_ASF_LEN, V32_ASF_OFF, 0xFF},
-		{VFE_CMD_S2Y_CFG, V32_S2Y_LEN, V32_S2Y_OFF, 0xFF},
-		{VFE_CMD_S2CbCr_CFG, V32_S2CbCr_LEN, V32_S2CbCr_OFF, 0xFF},
-/*25*/	{VFE_CMD_CHROMA_SUBS_CFG, V32_CHROMA_SUBS_LEN, V32_CHROMA_SUBS_OFF,
-		0xFF},
-		{VFE_CMD_OUT_CLAMP_CFG, V32_OUT_CLAMP_LEN, V32_OUT_CLAMP_OFF,
-		0xFF},
-		{VFE_CMD_FRAME_SKIP_CFG, V32_FRAME_SKIP_LEN, V32_FRAME_SKIP_OFF,
-		0xFF},
-		{VFE_CMD_DUMMY_1},
-		{VFE_CMD_DUMMY_2},
-/*30*/	{VFE_CMD_DUMMY_3},
-		{VFE_CMD_UPDATE},
-		{VFE_CMD_BL_LVL_UPDATE, V32_BLACK_LEVEL_LEN,
-		V32_BLACK_LEVEL_OFF, 0xFF},
-		{VFE_CMD_DEMUX_UPDATE, V32_DEMUX_LEN, V32_DEMUX_OFF, 0xFF},
-		{VFE_CMD_FOV_UPDATE, V32_FOV_LEN, V32_FOV_OFF, 0xFF},
-/*35*/	{VFE_CMD_MAIN_SCALER_UPDATE, V32_MAIN_SCALER_LEN, V32_MAIN_SCALER_OFF,
-		0xFF},
-		{VFE_CMD_WB_UPDATE, V32_WB_LEN, V32_WB_OFF, 0xFF},
-		{VFE_CMD_COLOR_COR_UPDATE, V32_COLOR_COR_LEN, V32_COLOR_COR_OFF,
-		0xFF},
-		{VFE_CMD_RGB_G_UPDATE, V32_RGB_G_LEN, V32_CHROMA_EN_OFF, 0xFF},
-		{VFE_CMD_LA_UPDATE, V32_LA_LEN, V32_LA_OFF, 0xFF },
-/*40*/	{VFE_CMD_CHROMA_EN_UPDATE, V32_CHROMA_EN_LEN, V32_CHROMA_EN_OFF,
-		0xFF},
-		{VFE_CMD_CHROMA_SUP_UPDATE, V32_CHROMA_SUP_LEN,
-		V32_CHROMA_SUP_OFF, 0xFF},
-		{VFE_CMD_MCE_UPDATE, V32_MCE_LEN, V32_MCE_OFF, 0xFF},
-		{VFE_CMD_SK_ENHAN_UPDATE, V32_SCE_LEN, V32_SCE_OFF, 0xFF},
-		{VFE_CMD_S2CbCr_UPDATE, V32_S2CbCr_LEN, V32_S2CbCr_OFF, 0xFF},
-/*45*/	{VFE_CMD_S2Y_UPDATE, V32_S2Y_LEN, V32_S2Y_OFF, 0xFF},
-		{VFE_CMD_ASF_UPDATE, V32_ASF_UPDATE_LEN, V32_ASF_OFF, 0xFF},
-		{VFE_CMD_FRAME_SKIP_UPDATE},
-		{VFE_CMD_CAMIF_FRAME_UPDATE},
-		{VFE_CMD_STATS_AF_UPDATE, V32_STATS_AF_LEN, V32_STATS_AF_OFF},
-/*50*/	{VFE_CMD_STATS_AE_UPDATE, V32_STATS_AE_LEN, V32_STATS_AE_OFF},
-		{VFE_CMD_STATS_AWB_UPDATE, V32_STATS_AWB_LEN,
-		V32_STATS_AWB_OFF},
-		{VFE_CMD_STATS_RS_UPDATE, V32_STATS_RS_LEN, V32_STATS_RS_OFF},
-		{VFE_CMD_STATS_CS_UPDATE, V32_STATS_CS_LEN, V32_STATS_CS_OFF},
-		{VFE_CMD_STATS_SKIN_UPDATE},
-/*55*/	{VFE_CMD_STATS_IHIST_UPDATE, V32_STATS_IHIST_LEN, V32_STATS_IHIST_OFF},
-		{VFE_CMD_DUMMY_4},
-		{VFE_CMD_EPOCH1_ACK},
-		{VFE_CMD_EPOCH2_ACK},
-		{VFE_CMD_START_RECORDING},
-/*60*/	{VFE_CMD_STOP_RECORDING},
-		{VFE_CMD_DUMMY_5},
-		{VFE_CMD_DUMMY_6},
-		{VFE_CMD_CAPTURE, V32_CAPTURE_LEN, 0xFF},
-		{VFE_CMD_DUMMY_7},
-/*65*/	{VFE_CMD_STOP},
-		{VFE_CMD_GET_HW_VERSION, V32_GET_HW_VERSION_LEN,
-		V32_GET_HW_VERSION_OFF},
-		{VFE_CMD_GET_FRAME_SKIP_COUNTS},
-		{VFE_CMD_OUTPUT1_BUFFER_ENQ},
-		{VFE_CMD_OUTPUT2_BUFFER_ENQ},
-/*70*/	{VFE_CMD_OUTPUT3_BUFFER_ENQ},
-		{VFE_CMD_JPEG_OUT_BUF_ENQ},
-		{VFE_CMD_RAW_OUT_BUF_ENQ},
-		{VFE_CMD_RAW_IN_BUF_ENQ},
-		{VFE_CMD_STATS_AF_ENQ},
-/*75*/	{VFE_CMD_STATS_AE_ENQ},
-		{VFE_CMD_STATS_AWB_ENQ},
-		{VFE_CMD_STATS_RS_ENQ},
-		{VFE_CMD_STATS_CS_ENQ},
-		{VFE_CMD_STATS_SKIN_ENQ},
-/*80*/	{VFE_CMD_STATS_IHIST_ENQ},
-		{VFE_CMD_DUMMY_8},
-		{VFE_CMD_JPEG_ENC_CFG},
-		{VFE_CMD_DUMMY_9},
-		{VFE_CMD_STATS_AF_START, V32_STATS_AF_LEN, V32_STATS_AF_OFF},
-/*85*/	{VFE_CMD_STATS_AF_STOP},
-		{VFE_CMD_STATS_AE_START, V32_STATS_AE_LEN, V32_STATS_AE_OFF},
-		{VFE_CMD_STATS_AE_STOP},
-		{VFE_CMD_STATS_AWB_START, V32_STATS_AWB_LEN, V32_STATS_AWB_OFF},
-		{VFE_CMD_STATS_AWB_STOP},
-/*90*/	{VFE_CMD_STATS_RS_START, V32_STATS_RS_LEN, V32_STATS_RS_OFF},
-		{VFE_CMD_STATS_RS_STOP},
-		{VFE_CMD_STATS_CS_START, V32_STATS_CS_LEN, V32_STATS_CS_OFF},
-		{VFE_CMD_STATS_CS_STOP},
-		{VFE_CMD_STATS_SKIN_START},
-/*95*/	{VFE_CMD_STATS_SKIN_STOP},
-		{VFE_CMD_STATS_IHIST_START,
-		V32_STATS_IHIST_LEN, V32_STATS_IHIST_OFF},
-		{VFE_CMD_STATS_IHIST_STOP},
-		{VFE_CMD_DUMMY_10},
-		{VFE_CMD_SYNC_TIMER_SETTING, V32_SYNC_TIMER_LEN,
-			V32_SYNC_TIMER_OFF},
-/*100*/	{VFE_CMD_ASYNC_TIMER_SETTING, V32_ASYNC_TIMER_LEN, V32_ASYNC_TIMER_OFF},
-		{VFE_CMD_LIVESHOT},
-		{VFE_CMD_LA_SETUP},
-		{VFE_CMD_LINEARIZATION_CFG, V32_LINEARIZATION_LEN1,
-			V32_LINEARIZATION_OFF1},
-		{VFE_CMD_DEMOSAICV3},
-/*105*/	{VFE_CMD_DEMOSAICV3_ABCC_CFG},
-		{VFE_CMD_DEMOSAICV3_DBCC_CFG, V32_DEMOSAICV3_DBCC_LEN,
-			V32_DEMOSAICV3_DBCC_OFF},
-		{VFE_CMD_DEMOSAICV3_DBPC_CFG},
-		{VFE_CMD_DEMOSAICV3_ABF_CFG, V32_DEMOSAICV3_ABF_LEN,
-			V32_DEMOSAICV3_ABF_OFF},
-		{VFE_CMD_DEMOSAICV3_ABCC_UPDATE},
-/*110*/	{VFE_CMD_DEMOSAICV3_DBCC_UPDATE, V32_DEMOSAICV3_DBCC_LEN,
-			V32_DEMOSAICV3_DBCC_OFF},
-		{VFE_CMD_DEMOSAICV3_DBPC_UPDATE},
-		{VFE_CMD_XBAR_CFG},
-		{VFE_CMD_MODULE_CFG, V32_MODULE_CFG_LEN, V32_MODULE_CFG_OFF},
-		{VFE_CMD_ZSL},
-/*115*/	{VFE_CMD_LINEARIZATION_UPDATE, V32_LINEARIZATION_LEN1,
-			V32_LINEARIZATION_OFF1},
-		{VFE_CMD_DEMOSAICV3_ABF_UPDATE, V32_DEMOSAICV3_ABF_LEN,
-			V32_DEMOSAICV3_ABF_OFF},
-		{VFE_CMD_CLF_CFG, V32_CLF_CFG_LEN, V32_CLF_CFG_OFF},
-		{VFE_CMD_CLF_LUMA_UPDATE, V32_CLF_LUMA_UPDATE_LEN,
-			V32_CLF_LUMA_UPDATE_OFF},
-		{VFE_CMD_CLF_CHROMA_UPDATE, V32_CLF_CHROMA_UPDATE_LEN,
-			V32_CLF_CHROMA_UPDATE_OFF},
-/*120*/ {VFE_CMD_PCA_ROLL_OFF_CFG},
-		{VFE_CMD_PCA_ROLL_OFF_UPDATE},
-		{VFE_CMD_GET_REG_DUMP},
-		{VFE_CMD_GET_LINEARIZATON_TABLE},
-		{VFE_CMD_GET_MESH_ROLLOFF_TABLE},
-/*125*/ {VFE_CMD_GET_PCA_ROLLOFF_TABLE},
-		{VFE_CMD_GET_RGB_G_TABLE},
-		{VFE_CMD_GET_LA_TABLE},
-		{VFE_CMD_DEMOSAICV3_UPDATE},
-		{VFE_CMD_ACTIVE_REGION_CFG},
-/*130*/ {VFE_CMD_COLOR_PROCESSING_CONFIG},
-		{VFE_CMD_STATS_WB_AEC_CONFIG},
-		{VFE_CMD_STATS_WB_AEC_UPDATE},
-		{VFE_CMD_Y_GAMMA_CONFIG},
-		{VFE_CMD_SCALE_OUTPUT1_CONFIG},
-/*135*/ {VFE_CMD_SCALE_OUTPUT2_CONFIG},
-		{VFE_CMD_CAPTURE_RAW},
-		{VFE_CMD_STOP_LIVESHOT},
-		{VFE_CMD_RECONFIG_VFE},
-		{VFE_CMD_STATS_REQBUF},
-/*140*/	{VFE_CMD_STATS_ENQUEUEBUF},
-		{VFE_CMD_STATS_FLUSH_BUFQ},
-		{VFE_CMD_STATS_UNREGBUF},
-		{VFE_CMD_STATS_BG_START, V32_STATS_BG_LEN, V32_STATS_BG_OFF},
-		{VFE_CMD_STATS_BG_STOP},
-/*145*/	{VFE_CMD_STATS_BF_START, V32_STATS_BF_LEN, V32_STATS_BF_OFF},
-		{VFE_CMD_STATS_BF_STOP},
-		{VFE_CMD_STATS_BHIST_START, V32_STATS_BHIST_LEN,
-			V32_STATS_BHIST_OFF},
-		{VFE_CMD_STATS_BHIST_STOP},
-/*149*/	{VFE_CMD_SELECT_RDI},
-};
-
-uint32_t vfe32_AXI_WM_CFG[] = {
-	0x0000004C,
-	0x00000064,
-	0x0000007C,
-	0x00000094,
-	0x000000AC,
-	0x000000C4,
-	0x000000DC,
-};
-
-static const char * const vfe32_general_cmd[] = {
-	"DUMMY_0",  /* 0 */
-	"SET_CLK",
-	"RESET",
-	"START",
-	"TEST_GEN_START",
-	"OPERATION_CFG",  /* 5 */
-	"AXI_OUT_CFG",
-	"CAMIF_CFG",
-	"AXI_INPUT_CFG",
-	"BLACK_LEVEL_CFG",
-	"ROLL_OFF_CFG",  /* 10 */
-	"DEMUX_CFG",
-	"FOV_CFG",
-	"MAIN_SCALER_CFG",
-	"WB_CFG",
-	"COLOR_COR_CFG", /* 15 */
-	"RGB_G_CFG",
-	"LA_CFG",
-	"CHROMA_EN_CFG",
-	"CHROMA_SUP_CFG",
-	"MCE_CFG", /* 20 */
-	"SK_ENHAN_CFG",
-	"ASF_CFG",
-	"S2Y_CFG",
-	"S2CbCr_CFG",
-	"CHROMA_SUBS_CFG",  /* 25 */
-	"OUT_CLAMP_CFG",
-	"FRAME_SKIP_CFG",
-	"DUMMY_1",
-	"DUMMY_2",
-	"DUMMY_3",  /* 30 */
-	"UPDATE",
-	"BL_LVL_UPDATE",
-	"DEMUX_UPDATE",
-	"FOV_UPDATE",
-	"MAIN_SCALER_UPDATE",  /* 35 */
-	"WB_UPDATE",
-	"COLOR_COR_UPDATE",
-	"RGB_G_UPDATE",
-	"LA_UPDATE",
-	"CHROMA_EN_UPDATE",  /* 40 */
-	"CHROMA_SUP_UPDATE",
-	"MCE_UPDATE",
-	"SK_ENHAN_UPDATE",
-	"S2CbCr_UPDATE",
-	"S2Y_UPDATE",  /* 45 */
-	"ASF_UPDATE",
-	"FRAME_SKIP_UPDATE",
-	"CAMIF_FRAME_UPDATE",
-	"STATS_AF_UPDATE",
-	"STATS_AE_UPDATE",  /* 50 */
-	"STATS_AWB_UPDATE",
-	"STATS_RS_UPDATE",
-	"STATS_CS_UPDATE",
-	"STATS_SKIN_UPDATE",
-	"STATS_IHIST_UPDATE",  /* 55 */
-	"DUMMY_4",
-	"EPOCH1_ACK",
-	"EPOCH2_ACK",
-	"START_RECORDING",
-	"STOP_RECORDING",  /* 60 */
-	"DUMMY_5",
-	"DUMMY_6",
-	"CAPTURE",
-	"DUMMY_7",
-	"STOP",  /* 65 */
-	"GET_HW_VERSION",
-	"GET_FRAME_SKIP_COUNTS",
-	"OUTPUT1_BUFFER_ENQ",
-	"OUTPUT2_BUFFER_ENQ",
-	"OUTPUT3_BUFFER_ENQ",  /* 70 */
-	"JPEG_OUT_BUF_ENQ",
-	"RAW_OUT_BUF_ENQ",
-	"RAW_IN_BUF_ENQ",
-	"STATS_AF_ENQ",
-	"STATS_AE_ENQ",  /* 75 */
-	"STATS_AWB_ENQ",
-	"STATS_RS_ENQ",
-	"STATS_CS_ENQ",
-	"STATS_SKIN_ENQ",
-	"STATS_IHIST_ENQ",  /* 80 */
-	"DUMMY_8",
-	"JPEG_ENC_CFG",
-	"DUMMY_9",
-	"STATS_AF_START",
-	"STATS_AF_STOP",  /* 85 */
-	"STATS_AE_START",
-	"STATS_AE_STOP",
-	"STATS_AWB_START",
-	"STATS_AWB_STOP",
-	"STATS_RS_START",  /* 90 */
-	"STATS_RS_STOP",
-	"STATS_CS_START",
-	"STATS_CS_STOP",
-	"STATS_SKIN_START",
-	"STATS_SKIN_STOP",  /* 95 */
-	"STATS_IHIST_START",
-	"STATS_IHIST_STOP",
-	"DUMMY_10",
-	"SYNC_TIMER_SETTING",
-	"ASYNC_TIMER_SETTING",  /* 100 */
-	"LIVESHOT",
-	"LA_SETUP",
-	"LINEARIZATION_CFG",
-	"DEMOSAICV3",
-	"DEMOSAICV3_ABCC_CFG", /* 105 */
-	"DEMOSAICV3_DBCC_CFG",
-	"DEMOSAICV3_DBPC_CFG",
-	"DEMOSAICV3_ABF_CFG",
-	"DEMOSAICV3_ABCC_UPDATE",
-	"DEMOSAICV3_DBCC_UPDATE", /* 110 */
-	"DEMOSAICV3_DBPC_UPDATE",
-	"XBAR_CFG",
-	"MODULE_CFG",
-	"V32_ZSL",
-	"LINEARIZATION_UPDATE", /*115*/
-	"DEMOSAICV3_ABF_UPDATE",
-	"CLF_CFG",
-	"CLF_LUMA_UPDATE",
-	"CLF_CHROMA_UPDATE",
-	"PCA_ROLL_OFF_CFG", /*120*/
-	"PCA_ROLL_OFF_UPDATE",
-	"GET_REG_DUMP",
-	"GET_LINEARIZATON_TABLE",
-	"GET_MESH_ROLLOFF_TABLE",
-	"GET_PCA_ROLLOFF_TABLE", /*125*/
-	"GET_RGB_G_TABLE",
-	"GET_LA_TABLE",
-	"DEMOSAICV3_UPDATE",
-	"VFE_CMD_ACTIVE_REGION_CFG",
-	"VFE_CMD_COLOR_PROCESSING_CONFIG", /*130*/
-	"VFE_CMD_STATS_WB_AEC_CONFIG",
-	"VFE_CMD_STATS_WB_AEC_UPDATE",
-	"VFE_CMD_Y_GAMMA_CONFIG",
-	"VFE_CMD_SCALE_OUTPUT1_CONFIG",
-	"VFE_CMD_SCALE_OUTPUT2_CONFIG", /*135*/
-	"VFE_CMD_CAPTURE_RAW",
-	"VFE_CMD_STOP_LIVESHOT",
-	"VFE_CMD_RECONFIG_VFE",
-	"STATS_REQBUF",
-	"STATS_ENQUEUEBUF", /*140*/
-	"STATS_FLUSH_BUFQ",
-	"STATS_UNREGBUF",
-	"STATS_BG_START",
-	"STATS_BG_STOP",
-	"STATS_BF_START", /*145*/
-	"STATS_BF_STOP",
-	"STATS_BHIST_START",
-	"STATS_BHIST_STOP",
-	"RDI_SEL" /*150*/
-};
-
-static atomic_t recovery_active, fault_recovery;
-static uint32_t recover_irq_mask0, recover_irq_mask1;
-
-uint8_t vfe32_use_bayer_stats(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	if (vfe32_ctrl->ver_num.main >= VFE_STATS_TYPE_BAYER) {
-		/* VFE 4 or above uses bayer stats */
-		return TRUE;
-	} else {
-		return FALSE;
-	}
-}
-
-static void axi_enable_wm_irq(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t irq_mask = 0, irq_comp_mask = 0;
-	uint16_t vfe_output_mode1 = 0;
-	uint32_t rdi_comp_select = 0;
-
-	uint16_t vfe_output_mode =
-		share_ctrl->outpath.output_mode &
-			~(VFE32_OUTPUT_MODE_TERTIARY1|
-			VFE32_OUTPUT_MODE_TERTIARY2|
-			  VFE32_OUTPUT_MODE_TERTIARY3);
-
-	vfe_output_mode1 =
-		((share_ctrl->outpath.output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY1)  &&
-		(share_ctrl->outpath.output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY2));
-
-	if (vfe_output_mode || vfe_output_mode1)
-		irq_comp_mask =
-		msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_COMP_MASK);
-	irq_mask = msm_camera_io_r(share_ctrl->vfebase +
-				VFE_IRQ_MASK_0);
-
-	if (share_ctrl->outpath.output_mode &
-			VFE32_OUTPUT_MODE_PRIMARY) {
-		if (share_ctrl->current_mode == VFE_OUTPUTS_RAW)
-			irq_comp_mask |= (
-				0x1 << share_ctrl->outpath.out0.ch0);
-		else
-			irq_comp_mask |= (
-				0x1 << share_ctrl->outpath.out0.ch0 |
-				0x1 << share_ctrl->outpath.out0.ch1);
-		irq_mask |= VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK;
-	} else if (share_ctrl->outpath.output_mode &
-			   VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-		irq_comp_mask |= (
-			0x1 << share_ctrl->outpath.out0.ch0 |
-			0x1 << share_ctrl->outpath.out0.ch1 |
-			0x1 << share_ctrl->outpath.out0.ch2);
-		irq_mask |= VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK;
-	}
-	if (share_ctrl->outpath.output_mode &
-			VFE32_OUTPUT_MODE_SECONDARY) {
-		irq_comp_mask |= (
-			0x1 << (share_ctrl->outpath.out1.ch0 + 8) |
-			0x1 << (share_ctrl->outpath.out1.ch1 + 8));
-		irq_mask |= VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK;
-	} else if (share_ctrl->outpath.output_mode &
-			VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-		irq_comp_mask |= (
-			0x1 << (share_ctrl->outpath.out1.ch0 + 8) |
-			0x1 << (share_ctrl->outpath.out1.ch1 + 8) |
-			0x1 << (share_ctrl->outpath.out1.ch2 + 8));
-		irq_mask |= VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK;
-	}
-
-	if (share_ctrl->outpath.output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY1) {
-		irq_mask |= (0x1 << (share_ctrl->outpath.out2.ch0 +
-			VFE_WM_OFFSET));
-	}
-
-	if (share_ctrl->outpath.output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY2) {
-		irq_mask |= (0x1 << (share_ctrl->outpath.out3.ch0 +
-			VFE_WM_OFFSET));
-	}
-	if (share_ctrl->outpath.output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY3) {
-		irq_mask |= (0x1 << (share_ctrl->outpath.out4.ch0 +
-			VFE_WM_OFFSET));
-	}
-	rdi_comp_select = (vfe_output_mode1 &&
-		(share_ctrl->rdi_comp == VFE_RDI_COMPOSITE));
-	if (rdi_comp_select) {
-		irq_comp_mask |= (
-		0x1 << (share_ctrl->outpath.out2.ch0 + 16) |
-		0x1 << (share_ctrl->outpath.out3.ch0 + 16));
-		irq_mask |= VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE2_MASK;
-	}
-
-	msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-	if (vfe_output_mode || rdi_comp_select)
-		msm_camera_io_w(irq_comp_mask,
-			share_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-}
-
-static void axi_disable_wm_irq(struct vfe_share_ctrl_t *share_ctrl,
-	uint16_t output_mode)
-{
-	uint32_t irq_mask, irq_comp_mask = 0;
-	uint16_t vfe_output_mode1 = 0;
-	uint32_t rdi_comp_select = 0;
-	uint16_t vfe_output_mode =
-		output_mode &
-			~(VFE32_OUTPUT_MODE_TERTIARY1|
-			VFE32_OUTPUT_MODE_TERTIARY2|
-			  VFE32_OUTPUT_MODE_TERTIARY3);
-
-	vfe_output_mode1 =
-		(output_mode & VFE32_OUTPUT_MODE_TERTIARY2);
-
-	if (vfe_output_mode || vfe_output_mode1)
-		irq_comp_mask =
-		msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_COMP_MASK);
-	irq_mask = msm_camera_io_r(share_ctrl->vfebase +
-				VFE_IRQ_MASK_0);
-
-	if (output_mode &
-			VFE32_OUTPUT_MODE_PRIMARY) {
-		irq_comp_mask &= ~(
-			0x1 << share_ctrl->outpath.out0.ch0 |
-			0x1 << share_ctrl->outpath.out0.ch1);
-		irq_mask &= ~VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK;
-	} else if (output_mode &
-			   VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-		irq_comp_mask &= ~(
-			0x1 << share_ctrl->outpath.out0.ch0 |
-			0x1 << share_ctrl->outpath.out0.ch1 |
-			0x1 << share_ctrl->outpath.out0.ch2);
-		irq_mask &= ~VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK;
-	}
-	if (output_mode &
-			VFE32_OUTPUT_MODE_SECONDARY) {
-		irq_comp_mask &= ~(
-			0x1 << (share_ctrl->outpath.out1.ch0 + 8) |
-			0x1 << (share_ctrl->outpath.out1.ch1 + 8));
-		irq_mask &= ~VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK;
-	} else if (output_mode &
-			VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-		irq_comp_mask &= ~(
-			0x1 << (share_ctrl->outpath.out1.ch0 + 8) |
-			0x1 << (share_ctrl->outpath.out1.ch1 + 8) |
-			0x1 << (share_ctrl->outpath.out1.ch2 + 8));
-		irq_mask &= ~VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK;
-	}
-	if (output_mode &
-			VFE32_OUTPUT_MODE_TERTIARY1) {
-			irq_mask &= ~(0x1 << (share_ctrl->outpath.out2.ch0 +
-				VFE_WM_OFFSET));
-	}
-	if (output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY2) {
-		irq_mask &= ~(0x1 << (share_ctrl->outpath.out3.ch0 +
-			VFE_WM_OFFSET));
-	}
-	if (output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY3) {
-		irq_mask &= ~(0x1 << (share_ctrl->outpath.out4.ch0 +
-			VFE_WM_OFFSET));
-	}
-	rdi_comp_select = (vfe_output_mode1 &&
-		(share_ctrl->rdi_comp == VFE_RDI_COMPOSITE));
-	if (rdi_comp_select) {
-		irq_comp_mask &= ~(
-		0x1 << (share_ctrl->outpath.out2.ch0 + 16) |
-		0x1 << (share_ctrl->outpath.out3.ch0 + 16));
-		irq_mask &= ~VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE2_MASK;
-	}
-	msm_camera_io_w(irq_mask, share_ctrl->vfebase + VFE_IRQ_MASK_0);
-	if (vfe_output_mode || vfe_output_mode1)
-		msm_camera_io_w(irq_comp_mask,
-			share_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-}
-
-static void axi_enable_irq(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t irq_mask, irq_mask1;
-	uint32_t vfe_mode =
-		share_ctrl->current_mode & ~(VFE_OUTPUTS_RDI0 |
-			VFE_OUTPUTS_RDI1 | VFE_OUTPUTS_RDI2);
-
-	if (share_ctrl->axi_ref_cnt == 1) {
-		irq_mask1 =
-			msm_camera_io_r(share_ctrl->vfebase +
-				VFE_IRQ_MASK_1);
-
-		irq_mask1 |= VFE_IMASK_WHILE_STOPPING_1;
-			msm_camera_io_w(irq_mask1, share_ctrl->vfebase +
-				VFE_IRQ_MASK_1);
-	}
-
-	if (share_ctrl->current_mode & (VFE_OUTPUTS_RDI0 |
-		VFE_OUTPUTS_RDI1|VFE_OUTPUTS_RDI2)) {
-		irq_mask1 =
-			msm_camera_io_r(share_ctrl->vfebase +
-				VFE_IRQ_MASK_1);
-
-		if (share_ctrl->current_mode & VFE_OUTPUTS_RDI0)
-			irq_mask1 |= VFE_IRQ_STATUS1_RDI0_REG_UPDATE_MASK;
-
-		if (share_ctrl->current_mode & VFE_OUTPUTS_RDI1)
-			irq_mask1 |= VFE_IRQ_STATUS1_RDI1_REG_UPDATE_MASK;
-
-		if (share_ctrl->current_mode & VFE_OUTPUTS_RDI2)
-			irq_mask1 |= VFE_IRQ_STATUS1_RDI2_REG_UPDATE_MASK;
-
-		msm_camera_io_w(irq_mask1, share_ctrl->vfebase +
-			VFE_IRQ_MASK_1);
-	}
-
-	if (vfe_mode) {
-		irq_mask =
-		msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-		irq_mask |= 0x00000021;
-		if (share_ctrl->stats_comp)
-			irq_mask |= VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK;
-		else
-			irq_mask |= 0x000FE000;
-		msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-		atomic_set(&share_ctrl->vstate, 1);
-	}
-	atomic_set(&share_ctrl->handle_common_irq, 1);
-}
-
-static void axi_clear_all_interrupts(struct vfe_share_ctrl_t *share_ctrl)
-{
-	atomic_set(&share_ctrl->handle_common_irq, 0);
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		share_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		share_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* clear all pending interrupts*/
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		share_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		share_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-	/* Ensure the write order while writing
-	*to the command register using the barrier */
-	msm_camera_io_w_mb(1,
-		share_ctrl->vfebase + VFE_IRQ_CMD);
-}
-
-static void axi_disable_irq(struct vfe_share_ctrl_t *share_ctrl,
-	uint32_t mode)
-{
-
-	/* disable all interrupts.  */
-
-	uint32_t irq_mask = 0, irq_mask1 = 0, clear_mask1 = 0;
-	uint32_t vfe_mode =
-		(mode & ~(VFE_OUTPUTS_RDI0|
-			VFE_OUTPUTS_RDI1|VFE_OUTPUTS_RDI2));
-
-	if (mode & (VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI1|VFE_OUTPUTS_RDI2)) {
-		irq_mask1 =
-			msm_camera_io_r(share_ctrl->vfebase +
-				VFE_IRQ_MASK_1);
-
-		if (mode & VFE_OUTPUTS_RDI0) {
-			irq_mask1 &= ~(VFE_IRQ_STATUS1_RDI0_REG_UPDATE_MASK);
-			clear_mask1 |= VFE_IRQ_STATUS1_RDI0_REG_UPDATE_MASK;
-		}
-
-		if (mode & VFE_OUTPUTS_RDI1) {
-			irq_mask1 &= ~(VFE_IRQ_STATUS1_RDI1_REG_UPDATE_MASK);
-			clear_mask1 |= VFE_IRQ_STATUS1_RDI1_REG_UPDATE_MASK;
-		}
-		if (mode & VFE_OUTPUTS_RDI2) {
-			irq_mask1 &= ~(VFE_IRQ_STATUS1_RDI2_REG_UPDATE_MASK);
-			clear_mask1 |= VFE_IRQ_STATUS1_RDI2_REG_UPDATE_MASK;
-		}
-
-		msm_camera_io_w(irq_mask1, share_ctrl->vfebase +
-			VFE_IRQ_MASK_1);
-		msm_camera_io_w(clear_mask1,
-			share_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-	}
-
-	if (vfe_mode) {
-		atomic_set(&share_ctrl->vstate, 0);
-		irq_mask =
-		msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-		irq_mask &= ~(0x00000021);
-		if (share_ctrl->stats_comp)
-			irq_mask &= ~(VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK);
-		else
-			irq_mask &= ~0x000FE000;
-		msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-	}
-}
-
-static void vfe32_stop(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-
-	/* in either continuous or snapshot mode, stop command can be issued
-	 * at any time. stop camif immediately. */
-	if (!vfe32_ctrl->share_ctrl->dual_enabled)
-		msm_camera_io_w_mb(CAMIF_COMMAND_STOP_IMMEDIATELY,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_CAMIF_COMMAND);
-	else
-		msm_camera_io_w(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_CAMIF_COMMAND);
-	vfe32_ctrl->share_ctrl->operation_mode &=
-		(VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI1|VFE_OUTPUTS_RDI2);
-}
-
-static void vfe32_subdev_notify(int id, int path, uint32_t inst_handle,
-	struct v4l2_subdev *sd, struct vfe_share_ctrl_t *share_ctrl)
-{
-	struct msm_vfe_resp rp;
-	struct msm_frame_info frame_info;
-	unsigned long flags = 0;
-	spin_lock_irqsave(&share_ctrl->sd_notify_lock, flags);
-	CDBG("vfe32_subdev_notify : msgId = %d\n", id);
-	memset(&rp, 0, sizeof(struct msm_vfe_resp));
-	rp.evt_msg.type   = MSM_CAMERA_MSG;
-	frame_info.inst_handle = inst_handle;
-	frame_info.path = path;
-	rp.evt_msg.data = &frame_info;
-	rp.type	   = id;
-	v4l2_subdev_notify(sd, NOTIFY_VFE_BUF_EVT, &rp);
-	spin_unlock_irqrestore(&share_ctrl->sd_notify_lock, flags);
-}
-
-static int vfe32_config_axi(
-	struct axi_ctrl_t *axi_ctrl, int mode, uint32_t *ao)
-{
-	uint32_t *ch_info;
-	uint32_t *axi_cfg = ao+V32_AXI_BUS_FMT_OFF;
-	int vfe_mode = (mode & ~(OUTPUT_TERT1|OUTPUT_TERT2|OUTPUT_TERT3));
-	uint32_t bus_cmd = *axi_cfg;
-	int i;
-
-	/* Update the corresponding write masters for each output*/
-	ch_info = axi_cfg + V32_AXI_CFG_LEN;
-	axi_ctrl->share_ctrl->outpath.out0.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out0.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out0.ch2 = 0x0000FFFF & *ch_info++;
-	axi_ctrl->share_ctrl->outpath.out0.inst_handle = *ch_info++;
-
-	axi_ctrl->share_ctrl->outpath.out1.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out1.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out1.ch2 = 0x0000FFFF & *ch_info++;
-	axi_ctrl->share_ctrl->outpath.out1.inst_handle = *ch_info++;
-
-	axi_ctrl->share_ctrl->outpath.out2.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out2.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out2.ch2 = 0x0000FFFF & *ch_info++;
-	axi_ctrl->share_ctrl->outpath.out2.inst_handle = *ch_info++;
-
-	axi_ctrl->share_ctrl->outpath.out3.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out3.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out3.ch2 = 0x0000FFFF & *ch_info++;
-	axi_ctrl->share_ctrl->outpath.out3.inst_handle = *ch_info++;
-
-	axi_ctrl->share_ctrl->outpath.out4.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out4.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out4.ch2 = 0x0000FFFF & *ch_info++;
-	axi_ctrl->share_ctrl->outpath.out4.inst_handle = *ch_info++;
-
-	axi_ctrl->share_ctrl->outpath.output_mode = 0;
-
-	if (mode & OUTPUT_TERT1)
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE32_OUTPUT_MODE_TERTIARY1;
-	if (mode & OUTPUT_TERT2)
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE32_OUTPUT_MODE_TERTIARY2;
-	if (mode & OUTPUT_TERT3)
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE32_OUTPUT_MODE_TERTIARY3;
-	if (mode == OUTPUT_TERT1
-		|| mode == OUTPUT_TERT2
-		|| mode == OUTPUT_TERT3
-		|| mode == (OUTPUT_TERT1|OUTPUT_TERT2)
-		|| mode == (OUTPUT_TERT1|OUTPUT_TERT3)
-		|| mode == (OUTPUT_TERT2|OUTPUT_TERT3)
-		|| mode == (OUTPUT_TERT1|OUTPUT_TERT2|OUTPUT_TERT3))
-			goto bus_cfg;
-
-	switch (vfe_mode) {
-	case OUTPUT_PRIM:
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE32_OUTPUT_MODE_PRIMARY;
-		break;
-	case OUTPUT_PRIM_ALL_CHNLS:
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
-		break;
-	case OUTPUT_PRIM|OUTPUT_SEC:
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE32_OUTPUT_MODE_PRIMARY;
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE32_OUTPUT_MODE_SECONDARY;
-		break;
-	case OUTPUT_PRIM|OUTPUT_SEC_ALL_CHNLS:
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE32_OUTPUT_MODE_PRIMARY;
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS;
-		break;
-	case OUTPUT_PRIM_ALL_CHNLS|OUTPUT_SEC:
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE32_OUTPUT_MODE_SECONDARY;
-		break;
-	default:
-		pr_err("%s Invalid AXI mode %d ", __func__, mode);
-		return -EINVAL;
-	}
-
-bus_cfg:
-	msm_camera_io_w(*ao, axi_ctrl->share_ctrl->vfebase +
-		VFE_BUS_IO_FORMAT_CFG);
-	axi_cfg++;
-	msm_camera_io_memcpy(axi_ctrl->share_ctrl->vfebase +
-		vfe32_cmd[VFE_CMD_AXI_OUT_CFG].offset, axi_cfg,
-		V32_AXI_BUS_CFG_LEN);
-	axi_cfg += V32_AXI_BUS_CFG_LEN/4;
-	for (i = 0; i < ARRAY_SIZE(vfe32_AXI_WM_CFG); i++) {
-		axi_cfg += 3;
-		msm_camera_io_memcpy(
-			axi_ctrl->share_ctrl->vfebase+vfe32_AXI_WM_CFG[i]+12,
-								axi_cfg, 12);
-		axi_cfg += 3;
-	}
-	msm_camera_io_w(bus_cmd, axi_ctrl->share_ctrl->vfebase +
-					V32_AXI_BUS_CMD_OFF);
-	msm_camera_io_w(*ch_info++,
-		axi_ctrl->share_ctrl->vfebase + VFE_PIXEL_IF_CFG);
-	if (msm_camera_io_r(axi_ctrl->share_ctrl->vfebase +
-		V32_GET_HW_VERSION_OFF) ==
-		VFE33_HW_NUMBER) {
-		msm_camera_io_w(*ch_info++,
-			axi_ctrl->share_ctrl->vfebase + VFE_RDI0_CFG);
-		msm_camera_io_w(*ch_info++,
-			axi_ctrl->share_ctrl->vfebase + VFE_RDI1_CFG);
-	}
-	return 0;
-}
-
-static void axi_reset_internal_variables(
-	struct axi_ctrl_t *axi_ctrl,
-	struct msm_camera_vfe_params_t vfe_params)
-{
-	if (vfe_params.operation_mode & VFE_OUTPUTS_RDI0) {
-		atomic_set(&axi_ctrl->share_ctrl->rdi0_update_ack_pending, 0);
-		axi_ctrl->share_ctrl->rdi0_capture_count = -1;
-		axi_ctrl->share_ctrl->outpath.out2.capture_cnt = -1;
-		axi_ctrl->share_ctrl->rdi0FrameId = 0;
-		axi_ctrl->share_ctrl->comp_output_mode &=
-			~VFE32_OUTPUT_MODE_TERTIARY1;
-		axi_ctrl->share_ctrl->operation_mode &=
-			~(VFE_OUTPUTS_RDI0);
-	}
-
-	if (vfe_params.operation_mode & VFE_OUTPUTS_RDI1) {
-		atomic_set(&axi_ctrl->share_ctrl->rdi1_update_ack_pending, 0);
-		axi_ctrl->share_ctrl->rdi1_capture_count = -1;
-		axi_ctrl->share_ctrl->outpath.out3.capture_cnt = -1;
-		axi_ctrl->share_ctrl->rdi1FrameId = 0;
-		axi_ctrl->share_ctrl->comp_output_mode &=
-			~VFE32_OUTPUT_MODE_TERTIARY2;
-		axi_ctrl->share_ctrl->operation_mode &=
-			~(VFE_OUTPUTS_RDI1);
-	}
-
-	if (vfe_params.operation_mode & VFE_OUTPUTS_RDI2) {
-		atomic_set(&axi_ctrl->share_ctrl->rdi2_update_ack_pending, 0);
-		axi_ctrl->share_ctrl->rdi2_capture_count = -1;
-		axi_ctrl->share_ctrl->outpath.out4.capture_cnt = -1;
-		axi_ctrl->share_ctrl->rdi2FrameId = 0;
-		axi_ctrl->share_ctrl->comp_output_mode &=
-			~VFE32_OUTPUT_MODE_TERTIARY3;
-		axi_ctrl->share_ctrl->operation_mode &=
-			~(VFE_OUTPUTS_RDI2);
-	}
-}
-
-static void axi_global_reset_internal_variables(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	unsigned long flags;
-	/* state control variables */
-	axi_ctrl->share_ctrl->start_ack_pending = FALSE;
-	atomic_set(&irq_cnt, 0);
-
-	spin_lock_irqsave(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-	axi_ctrl->share_ctrl->stop_ack_pending  = FALSE;
-	spin_unlock_irqrestore(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-
-	init_completion(&axi_ctrl->share_ctrl->reset_complete);
-
-	spin_lock_irqsave(&axi_ctrl->share_ctrl->update_ack_lock, flags);
-	axi_ctrl->share_ctrl->update_ack_pending = FALSE;
-	spin_unlock_irqrestore(&axi_ctrl->share_ctrl->update_ack_lock, flags);
-
-	axi_ctrl->share_ctrl->recording_state = VFE_STATE_IDLE;
-	axi_ctrl->share_ctrl->liveshot_state = VFE_STATE_IDLE;
-
-	atomic_set(&axi_ctrl->share_ctrl->vstate, 0);
-	atomic_set(&axi_ctrl->share_ctrl->handle_common_irq, 0);
-	atomic_set(&axi_ctrl->share_ctrl->pix0_update_ack_pending, 0);
-	atomic_set(&axi_ctrl->share_ctrl->rdi0_update_ack_pending, 0);
-	atomic_set(&axi_ctrl->share_ctrl->rdi1_update_ack_pending, 0);
-	atomic_set(&axi_ctrl->share_ctrl->rdi2_update_ack_pending, 0);
-        atomic_set(&fault_recovery, 0);
-
-	/* 0 for continuous mode, 1 for snapshot mode */
-	axi_ctrl->share_ctrl->operation_mode = 0;
-	axi_ctrl->share_ctrl->current_mode = 0;
-	axi_ctrl->share_ctrl->outpath.output_mode = 0;
-	axi_ctrl->share_ctrl->comp_output_mode = 0;
-	axi_ctrl->share_ctrl->vfe_capture_count = 0;
-	axi_ctrl->share_ctrl->rdi0_capture_count = -1;
-	axi_ctrl->share_ctrl->rdi1_capture_count = -1;
-	axi_ctrl->share_ctrl->rdi2_capture_count = -1;
-	axi_ctrl->share_ctrl->outpath.out0.capture_cnt = -1;
-	axi_ctrl->share_ctrl->outpath.out1.capture_cnt = -1;
-	axi_ctrl->share_ctrl->outpath.out2.capture_cnt = -1;
-	axi_ctrl->share_ctrl->outpath.out3.capture_cnt = -1;
-	axi_ctrl->share_ctrl->outpath.out4.capture_cnt = -1;
-
-	/* this is unsigned 32 bit integer. */
-	axi_ctrl->share_ctrl->vfeFrameId = 0;
-	axi_ctrl->share_ctrl->rdi0FrameId = 0;
-	axi_ctrl->share_ctrl->rdi1FrameId = 0;
-	axi_ctrl->share_ctrl->rdi2FrameId = 0;
-}
-
-
-static void vfe32_program_dmi_cfg(
-	enum VFE32_DMI_RAM_SEL bankSel,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	/* set bit 8 for auto increment. */
-	uint32_t value = VFE_DMI_CFG_DEFAULT;
-	value += (uint32_t)bankSel;
-	CDBG("%s: banksel = %d\n", __func__, bankSel);
-
-	msm_camera_io_w(value, vfe32_ctrl->share_ctrl->vfebase +
-		VFE_DMI_CFG);
-	/* by default, always starts with offset 0.*/
-	msm_camera_io_w(0, vfe32_ctrl->share_ctrl->vfebase +
-		VFE_DMI_ADDR);
-}
-
-static void vfe32_reset_dmi_tables(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	int i = 0;
-
-	/* Reset Histogram LUTs */
-	CDBG("Reset Bayer histogram LUT : 0\n");
-	vfe32_program_dmi_cfg(STATS_BHIST_RAM0, vfe32_ctrl);
-	/* Loop for configuring LUT */
-	for (i = 0; i < 256; i++) {
-		msm_camera_io_w(0, vfe32_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_HI);
-		msm_camera_io_w(0, vfe32_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_LO);
-	}
-	vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-
-	CDBG("Reset Bayer Histogram LUT: 1\n");
-	vfe32_program_dmi_cfg(STATS_BHIST_RAM1, vfe32_ctrl);
-	/* Loop for configuring LUT */
-	for (i = 0; i < 256; i++) {
-		msm_camera_io_w(0, vfe32_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_HI);
-		msm_camera_io_w(0, vfe32_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_LO);
-	}
-	vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-
-	CDBG("Reset IHistogram LUT\n");
-	vfe32_program_dmi_cfg(STATS_IHIST_RAM, vfe32_ctrl);
-	/* Loop for configuring LUT */
-	for (i = 0; i < 256; i++) {
-		msm_camera_io_w(0, vfe32_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_HI);
-		msm_camera_io_w(0, vfe32_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_LO);
-	}
-	vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-}
-
-static void vfe32_set_default_reg_values(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	msm_camera_io_w(0x800080,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_DEMUX_GAIN_0);
-	msm_camera_io_w(0x800080,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_DEMUX_GAIN_1);
-	/* What value should we program CGC_OVERRIDE to? */
-	msm_camera_io_w(0xFFFFF,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_CGC_OVERRIDE);
-
-	/* default frame drop period and pattern */
-	msm_camera_io_w(0x1f,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_CFG);
-	msm_camera_io_w(0x1f,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_FRAMEDROP_ENC_CBCR_CFG);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_FRAMEDROP_ENC_CBCR_PATTERN);
-	msm_camera_io_w(0x1f,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_FRAMEDROP_VIEW_Y);
-	msm_camera_io_w(0x1f,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_FRAMEDROP_VIEW_CBCR);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_FRAMEDROP_VIEW_Y_PATTERN);
-	msm_camera_io_w(0xFFFFFFFF,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_FRAMEDROP_VIEW_CBCR_PATTERN);
-	msm_camera_io_w(0, vfe32_ctrl->share_ctrl->vfebase + VFE_CLAMP_MIN);
-	msm_camera_io_w(0xFFFFFF,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_CLAMP_MAX);
-
-	/* stats UB config */
-	CDBG("%s: Use bayer stats = %d\n", __func__,
-		 vfe32_use_bayer_stats(vfe32_ctrl));
-	if (!vfe32_use_bayer_stats(vfe32_ctrl)) {
-		msm_camera_io_w(0x3980007,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_AEC_BG_UB_CFG);
-		msm_camera_io_w(0x3A00007,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_AF_BF_UB_CFG);
-		msm_camera_io_w(0x3A8000F,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_AWB_UB_CFG);
-		msm_camera_io_w(0x3B80007,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_RS_UB_CFG);
-		msm_camera_io_w(0x3C0001F,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_CS_UB_CFG);
-		msm_camera_io_w(0x3E0001F,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_HIST_UB_CFG);
-	} else {
-		msm_camera_io_w(0x316001F,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_HIST_UB_CFG);
-		msm_camera_io_w(0x336005C,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_AEC_BG_UB_CFG);
-		msm_camera_io_w(0x393003C,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_AF_BF_UB_CFG);
-		msm_camera_io_w(0x3D00007,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_RS_UB_CFG);
-		msm_camera_io_w(0x3D8001F,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_CS_UB_CFG);
-		msm_camera_io_w(0x3F80007,
-			vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_SKIN_BHIST_UB_CFG);
-	}
-	vfe32_reset_dmi_tables(vfe32_ctrl);
-}
-
-static void vfe32_reset_internal_variables(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-	spin_lock_irqsave(&vfe32_ctrl->share_ctrl->update_ack_lock,
-		flags);
-	vfe32_ctrl->share_ctrl->update_ack_pending = FALSE;
-	spin_unlock_irqrestore(&vfe32_ctrl->share_ctrl->update_ack_lock,
-		flags);
-	vfe32_ctrl->share_ctrl->vfe_capture_count = 0;
-	/* this is unsigned 32 bit integer. */
-	vfe32_ctrl->share_ctrl->vfeFrameId = 0;
-	vfe32_ctrl->share_ctrl->update_counter = 0;
-
-	/* Stats control variables. */
-	memset(&(vfe32_ctrl->afbfStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe32_ctrl->awbStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe32_ctrl->aecbgStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe32_ctrl->bhistStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe32_ctrl->ihistStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe32_ctrl->rsStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe32_ctrl->csStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-	vfe32_ctrl->share_ctrl->outpath.out0.capture_cnt = -1;
-	vfe32_ctrl->share_ctrl->outpath.out1.capture_cnt = -1;
-	vfe32_ctrl->share_ctrl->outpath.out2.capture_cnt = -1;
-	vfe32_ctrl->share_ctrl->outpath.out3.capture_cnt = -1;
-	vfe32_ctrl->share_ctrl->outpath.out4.capture_cnt = -1;
-
-	vfe32_ctrl->share_ctrl->recording_state = VFE_STATE_IDLE;
-	vfe32_ctrl->share_ctrl->liveshot_state = VFE_STATE_IDLE;
-
-	atomic_set(&vfe32_ctrl->share_ctrl->vstate, 0);
-	atomic_set(&vfe32_ctrl->share_ctrl->pix0_update_ack_pending, 0);
-	atomic_set(&vfe32_ctrl->share_ctrl->rdi0_update_ack_pending, 0);
-	atomic_set(&vfe32_ctrl->share_ctrl->rdi1_update_ack_pending, 0);
-	atomic_set(&vfe32_ctrl->share_ctrl->rdi2_update_ack_pending, 0);
-	vfe32_ctrl->frame_skip_cnt = 31;
-	vfe32_ctrl->frame_skip_pattern = 0xffffffff;
-	vfe32_ctrl->snapshot_frame_cnt = 0;
-	atomic_set(&recovery_active, 0);
-	vfe32_set_default_reg_values(vfe32_ctrl);
-}
-
-
-static int vfe32_reset(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	uint32_t irq_mask1, irq_mask;
-	atomic_set(&vfe32_ctrl->share_ctrl->vstate, 0);
-	msm_camera_io_w(VFE_MODULE_RESET_CMD,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_RESET);
-	msm_camera_io_w(0,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_RESET);
-
-	irq_mask =
-		msm_camera_io_r(vfe32_ctrl->share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-	irq_mask &= ~(0x000FE021|VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK);
-
-	msm_camera_io_w(irq_mask, vfe32_ctrl->share_ctrl->vfebase +
-		VFE_IRQ_MASK_0);
-	vfe32_ctrl->share_ctrl->operation_mode &=
-		(VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI1|VFE_OUTPUTS_RDI2);
-	vfe32_ctrl->share_ctrl->comp_output_mode &=
-			(VFE32_OUTPUT_MODE_TERTIARY1|
-			VFE32_OUTPUT_MODE_TERTIARY2|
-			VFE32_OUTPUT_MODE_TERTIARY3);
-
-	/* enable reset_ack interrupt.  */
-	irq_mask1 = msm_camera_io_r(
-		vfe32_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-	irq_mask1 |= VFE_IMASK_WHILE_STOPPING_1;
-	msm_camera_io_w(irq_mask1,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-	msm_camera_io_w_mb(VFE_ONLY_RESET_CMD,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_GLOBAL_RESET);
-
-	return wait_for_completion_interruptible(
-			&vfe32_ctrl->share_ctrl->reset_complete);
-}
-
-static int axi_reset(struct axi_ctrl_t *axi_ctrl,
-	struct msm_camera_vfe_params_t vfe_params)
-{
-	int rc = 0;
-	if (vfe_params.skip_reset) {
-		axi_reset_internal_variables(axi_ctrl, vfe_params);
-		return rc;
-	}
-	axi_global_reset_internal_variables(axi_ctrl);
-	/* disable all interrupts.  vfeImaskLocal is also reset to 0
-	* to begin with. */
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_0);
-
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* clear all pending interrupts*/
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CMD);
-
-	/* enable reset_ack interrupt.  */
-	msm_camera_io_w(VFE_IMASK_WHILE_STOPPING_1,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* Write to VFE_GLOBAL_RESET_CMD to reset the vfe hardware. Once reset
-	 * is done, hardware interrupt will be generated.  VFE ist processes
-	 * the interrupt to complete the function call.  Note that the reset
-	 * function is synchronous. */
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(VFE_RESET_UPON_RESET_CMD,
-		axi_ctrl->share_ctrl->vfebase + VFE_GLOBAL_RESET);
-
-	return wait_for_completion_interruptible(
-			&axi_ctrl->share_ctrl->reset_complete);
-}
-
-static int vfe32_operation_config(uint32_t *cmd,
-			struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	uint32_t *p = cmd;
-
-	vfe32_ctrl->share_ctrl->stats_comp = *(++p);
-	vfe32_ctrl->hfr_mode = *(++p);
-
-	msm_camera_io_w(*(++p),
-		vfe32_ctrl->share_ctrl->vfebase + VFE_CFG);
-	msm_camera_io_w(*(++p),
-		vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-	msm_camera_io_w(*(++p),
-		vfe32_ctrl->share_ctrl->vfebase + VFE_REALIGN_BUF);
-	msm_camera_io_w(*(++p),
-		vfe32_ctrl->share_ctrl->vfebase + VFE_CHROMA_UP);
-	msm_camera_io_w(*(++p),
-		vfe32_ctrl->share_ctrl->vfebase + VFE_STATS_CFG);
-	return 0;
-}
-
-static unsigned long vfe32_stats_dqbuf(struct vfe32_ctrl_type *vfe32_ctrl,
-	enum msm_stats_enum_type stats_type)
-{
-	struct msm_stats_meta_buf *buf = NULL;
-	int rc = 0;
-	rc = vfe32_ctrl->stats_ops.dqbuf(
-			vfe32_ctrl->stats_ops.stats_ctrl, stats_type, &buf);
-	if (rc < 0) {
-		CDBG("%s: dq stats buf (type = %d) err = %d",
-			__func__, stats_type, rc);
-		return 0L;
-	}
-	return buf->paddr;
-}
-
-static unsigned long vfe32_stats_flush_enqueue(
-	struct vfe32_ctrl_type *vfe32_ctrl,
-	enum msm_stats_enum_type stats_type)
-{
-	struct msm_stats_bufq *bufq = NULL;
-	struct msm_stats_meta_buf *stats_buf = NULL;
-	int rc = 0;
-	int i;
-
-	/*
-	 * Passing NULL for ion client as the buffers are already
-	 * mapped at this stage, client is not required, flush all
-	 * the buffers, and buffers move to PREPARE state
-	 */
-
-	rc = vfe32_ctrl->stats_ops.bufq_flush(
-			vfe32_ctrl->stats_ops.stats_ctrl, stats_type, NULL);
-	if (rc < 0) {
-		pr_err("%s: dq stats buf (type = %d) err = %d",
-			__func__, stats_type, rc);
-		return 0L;
-	}
-	/* Queue all the buffers back to QUEUED state */
-	bufq = vfe32_ctrl->stats_ctrl.bufq[stats_type];
-	for (i = 0; i < bufq->num_bufs; i++) {
-		stats_buf = &bufq->bufs[i];
-		rc = vfe32_ctrl->stats_ops.enqueue_buf(
-				vfe32_ctrl->stats_ops.stats_ctrl,
-				&(stats_buf->info), NULL, -1);
-		if (rc < 0) {
-			pr_err("%s: dq stats buf (type = %d) err = %d",
-				 __func__, stats_type, rc);
-			return rc;
-		}
-	}
-	return 0L;
-}
-
-
-static unsigned long vfe32_stats_unregbuf(
-	struct vfe32_ctrl_type *vfe32_ctrl,
-	struct msm_stats_reqbuf *req_buf, int domain_num)
-{
-	int i = 0, rc = 0;
-
-	for (i = 0; i < req_buf->num_buf; i++) {
-		rc = vfe32_ctrl->stats_ops.buf_unprepare(
-			vfe32_ctrl->stats_ops.stats_ctrl,
-			req_buf->stats_type, i,
-			vfe32_ctrl->stats_ops.client, domain_num);
-		if (rc < 0) {
-			pr_err("%s: unreg stats buf (type = %d) err = %d",
-				__func__, req_buf->stats_type, rc);
-		return rc;
-		}
-	}
-	return 0L;
-}
-static int vfe_stats_awb_buf_init(
-	struct vfe32_ctrl_type *vfe32_ctrl,
-	struct vfe_cmd_stats_buf *in)
-{
-	uint32_t addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_AWB);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq awb ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_AWB_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_AWB);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq awb ping buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_AWB_WR_PONG_ADDR);
-	return 0;
-}
-
-static uint32_t vfe_stats_aec_bg_buf_init(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-	uint32_t stats_type;
-
-	stats_type =
-		(!vfe32_use_bayer_stats(vfe32_ctrl)) ? MSM_STATS_TYPE_AEC
-			: MSM_STATS_TYPE_BG;
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq aec ping buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_AEC_BG_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq aec pong buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_AEC_BG_WR_PONG_ADDR);
-	return 0;
-}
-
-static int vfe_stats_af_bf_buf_init(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-	int rc = 0;
-
-	uint32_t stats_type;
-	stats_type =
-		(!vfe32_use_bayer_stats(vfe32_ctrl)) ? MSM_STATS_TYPE_AF
-			: MSM_STATS_TYPE_BF;
-
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	rc = vfe32_stats_flush_enqueue(vfe32_ctrl, stats_type);
-	if (rc < 0) {
-		pr_err("%s: dq stats buf err = %d",
-			   __func__, rc);
-		spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-		return -EINVAL;
-	}
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq af ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_AF_BF_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq af pong buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_AF_BF_WR_PONG_ADDR);
-	return 0;
-}
-
-static uint32_t vfe_stats_bhist_buf_init(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_BHIST);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq ihist ping buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_SKIN_BHIST_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_BHIST);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq ihist pong buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_SKIN_BHIST_WR_PONG_ADDR);
-
-	return 0;
-}
-
-static int vfe_stats_ihist_buf_init(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_IHIST);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq ihist ping buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_HIST_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_IHIST);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq ihist pong buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_HIST_WR_PONG_ADDR);
-
-	return 0;
-}
-
-static int vfe_stats_rs_buf_init(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_RS);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq rs ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_RS_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_RS);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq rs pong buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_RS_WR_PONG_ADDR);
-	return 0;
-}
-
-static int vfe_stats_cs_buf_init(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_CS);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq cs ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_CS_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_CS);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq cs pong buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_CS_WR_PONG_ADDR);
-	return 0;
-}
-
-static void vfe32_start_common(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	CDBG("VFE opertaion mode = 0x%x, output mode = 0x%x\n",
-		vfe32_ctrl->share_ctrl->operation_mode,
-		vfe32_ctrl->share_ctrl->outpath.output_mode);
-	msm_camera_io_w_mb(1, vfe32_ctrl->share_ctrl->vfebase +
-		VFE_CAMIF_COMMAND);
-	msm_camera_io_w_mb(VFE_AXI_CFG_MASK,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_AXI_CFG);
-}
-
-static int vfe32_start_recording(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	vfe32_ctrl->share_ctrl->recording_state = VFE_STATE_START_REQUESTED;
-	msm_camera_io_w_mb(1,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	return 0;
-}
-
-static int vfe32_stop_recording(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	vfe32_ctrl->share_ctrl->recording_state = VFE_STATE_STOP_REQUESTED;
-	msm_camera_io_w_mb(1,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	return 0;
-}
-
-static void vfe32_start_liveshot(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	/* Hardcode 1 live snapshot for now. */
-	vfe32_ctrl->share_ctrl->outpath.out0.capture_cnt = 1;
-	vfe32_ctrl->share_ctrl->vfe_capture_count =
-		vfe32_ctrl->share_ctrl->outpath.out0.capture_cnt;
-
-	vfe32_ctrl->share_ctrl->liveshot_state = VFE_STATE_START_REQUESTED;
-	msm_camera_io_w_mb(1, vfe32_ctrl->
-		share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-static void vfe32_stop_liveshot(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	vfe32_ctrl->share_ctrl->liveshot_state = VFE_STATE_STOP_REQUESTED;
-	msm_camera_io_w_mb(1,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-static int vfe32_zsl(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	vfe32_ctrl->share_ctrl->start_ack_pending = TRUE;
-	vfe32_start_common(vfe32_ctrl);
-
-	msm_camera_io_w(1, vfe32_ctrl->share_ctrl->vfebase + 0x18C);
-	msm_camera_io_w(1, vfe32_ctrl->share_ctrl->vfebase + 0x188);
-	return 0;
-}
-static int vfe32_capture_raw(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe32_ctrl_type *vfe32_ctrl,
-	uint32_t num_frames_capture)
-{
-	vfe32_ctrl->share_ctrl->outpath.out0.capture_cnt = num_frames_capture;
-	vfe32_ctrl->share_ctrl->vfe_capture_count = num_frames_capture;
-	vfe32_start_common(vfe32_ctrl);
-	return 0;
-}
-
-static int vfe32_capture(
-	struct msm_cam_media_controller *pmctl,
-	uint32_t num_frames_capture,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	/* capture command is valid for both idle and active state. */
-	vfe32_ctrl->share_ctrl->outpath.out1.capture_cnt = num_frames_capture;
-	if (vfe32_ctrl->share_ctrl->current_mode ==
-			VFE_OUTPUTS_MAIN_AND_THUMB ||
-		vfe32_ctrl->share_ctrl->current_mode ==
-			VFE_OUTPUTS_THUMB_AND_MAIN ||
-		vfe32_ctrl->share_ctrl->current_mode ==
-			VFE_OUTPUTS_JPEG_AND_THUMB ||
-		vfe32_ctrl->share_ctrl->current_mode ==
-			VFE_OUTPUTS_THUMB_AND_JPEG) {
-		vfe32_ctrl->share_ctrl->outpath.out0.capture_cnt =
-			num_frames_capture;
-	}
-
-	vfe32_ctrl->share_ctrl->vfe_capture_count = num_frames_capture;
-
-	vfe32_ctrl->share_ctrl->vfe_capture_count = num_frames_capture;
-
-	vfe32_start_common(vfe32_ctrl);
-	/* for debug */
-	msm_camera_io_w(1, vfe32_ctrl->share_ctrl->vfebase + 0x18C);
-	msm_camera_io_w(1, vfe32_ctrl->share_ctrl->vfebase + 0x188);
-	return 0;
-}
-
-static int vfe32_start(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	vfe32_start_common(vfe32_ctrl);
-	return 0;
-}
-
-static void vfe32_update(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-	uint32_t value = 0;
-	if (vfe32_ctrl->update_linear) {
-		if (!msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V32_LINEARIZATION_OFF1))
-			msm_camera_io_w(1,
-				vfe32_ctrl->share_ctrl->vfebase +
-				V32_LINEARIZATION_OFF1);
-		else
-			msm_camera_io_w(0,
-				vfe32_ctrl->share_ctrl->vfebase +
-				V32_LINEARIZATION_OFF1);
-		vfe32_ctrl->update_linear = false;
-	}
-
-	if (vfe32_ctrl->update_rolloff) {
-		value = msm_camera_io_r(vfe32_ctrl->share_ctrl->vfebase +
-			V33_PCA_ROLL_OFF_CFG_OFF1);
-		value ^= V33_PCA_ROLL_OFF_LUT_BANK_SEL_MASK;
-		msm_camera_io_w(value, vfe32_ctrl->share_ctrl->vfebase +
-			V33_PCA_ROLL_OFF_CFG_OFF1);
-		vfe32_ctrl->update_rolloff = false;
-	}
-
-	if (vfe32_ctrl->update_la) {
-		if (!msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + V32_LA_OFF))
-			msm_camera_io_w(1,
-				vfe32_ctrl->share_ctrl->vfebase + V32_LA_OFF);
-		else
-			msm_camera_io_w(0,
-				vfe32_ctrl->share_ctrl->vfebase + V32_LA_OFF);
-		vfe32_ctrl->update_la = false;
-	}
-
-	if (vfe32_ctrl->update_gamma) {
-		value = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + V32_RGB_G_OFF);
-		value ^= V32_GAMMA_LUT_BANK_SEL_MASK;
-		msm_camera_io_w(value,
-			vfe32_ctrl->share_ctrl->vfebase + V32_RGB_G_OFF);
-		vfe32_ctrl->update_gamma = false;
-	}
-
-	spin_lock_irqsave(&vfe32_ctrl->share_ctrl->update_ack_lock, flags);
-	vfe32_ctrl->share_ctrl->update_ack_pending = TRUE;
-	spin_unlock_irqrestore(&vfe32_ctrl->share_ctrl->update_ack_lock, flags);
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	return;
-}
-
-static void vfe32_sync_timer_stop(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	uint32_t value = 0;
-	vfe32_ctrl->sync_timer_state = 0;
-	if (vfe32_ctrl->sync_timer_number == 0)
-		value = 0x10000;
-	else if (vfe32_ctrl->sync_timer_number == 1)
-		value = 0x20000;
-	else if (vfe32_ctrl->sync_timer_number == 2)
-		value = 0x40000;
-
-	/* Timer Stop */
-	msm_camera_io_w(value,
-		vfe32_ctrl->share_ctrl->vfebase + V32_SYNC_TIMER_OFF);
-}
-
-static void vfe32_sync_timer_start(
-	const uint32_t *tbl,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	/* set bit 8 for auto increment. */
-	uint32_t value = 1;
-	uint32_t val;
-
-	vfe32_ctrl->sync_timer_state = *tbl++;
-	vfe32_ctrl->sync_timer_repeat_count = *tbl++;
-	vfe32_ctrl->sync_timer_number = *tbl++;
-	CDBG("%s timer_state %d, repeat_cnt %d timer number %d\n",
-		 __func__, vfe32_ctrl->sync_timer_state,
-		 vfe32_ctrl->sync_timer_repeat_count,
-		 vfe32_ctrl->sync_timer_number);
-
-	if (vfe32_ctrl->sync_timer_state) { /* Start Timer */
-		value = value << vfe32_ctrl->sync_timer_number;
-	} else { /* Stop Timer */
-		CDBG("Failed to Start timer\n");
-		return;
-	}
-
-	/* Timer Start */
-	msm_camera_io_w(value,
-		vfe32_ctrl->share_ctrl->vfebase + V32_SYNC_TIMER_OFF);
-	/* Sync Timer Line Start */
-	value = *tbl++;
-	msm_camera_io_w(value,
-		vfe32_ctrl->share_ctrl->vfebase + V32_SYNC_TIMER_OFF +
-		4 + ((vfe32_ctrl->sync_timer_number) * 12));
-	/* Sync Timer Pixel Start */
-	value = *tbl++;
-	msm_camera_io_w(value,
-			vfe32_ctrl->share_ctrl->vfebase + V32_SYNC_TIMER_OFF +
-			 8 + ((vfe32_ctrl->sync_timer_number) * 12));
-	/* Sync Timer Pixel Duration */
-	value = *tbl++;
-	val = vfe_clk_rate / 10000;
-	val = 10000000 / val;
-	val = value * 10000 / val;
-	CDBG("%s: Pixel Clk Cycles!!! %d\n", __func__, val);
-	msm_camera_io_w(val,
-		vfe32_ctrl->share_ctrl->vfebase + V32_SYNC_TIMER_OFF +
-		12 + ((vfe32_ctrl->sync_timer_number) * 12));
-	/* Timer0 Active High/LOW */
-	value = *tbl++;
-	msm_camera_io_w(value,
-		vfe32_ctrl->share_ctrl->vfebase + V32_SYNC_TIMER_POLARITY_OFF);
-	/* Selects sync timer 0 output to drive onto timer1 port */
-	value = 0;
-	msm_camera_io_w(value,
-		vfe32_ctrl->share_ctrl->vfebase + V32_TIMER_SELECT_OFF);
-}
-
-
-static void vfe32_write_gamma_cfg(
-	enum VFE32_DMI_RAM_SEL channel_sel,
-	const uint32_t *tbl,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	int i;
-	uint32_t value, value1, value2;
-	vfe32_program_dmi_cfg(channel_sel, vfe32_ctrl);
-	for (i = 0 ; i < (VFE32_GAMMA_NUM_ENTRIES/2) ; i++) {
-		value = *tbl++;
-		value1 = value & 0x0000FFFF;
-		value2 = (value & 0xFFFF0000)>>16;
-		msm_camera_io_w((value1),
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-		msm_camera_io_w((value2),
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-	}
-	vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-}
-
-static void vfe32_read_gamma_cfg(
-	enum VFE32_DMI_RAM_SEL channel_sel,
-	uint32_t *tbl,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	int i;
-	vfe32_program_dmi_cfg(channel_sel, vfe32_ctrl);
-	CDBG("%s: Gamma table channel: %d\n", __func__, channel_sel);
-	for (i = 0 ; i < VFE32_GAMMA_NUM_ENTRIES ; i++) {
-		*tbl = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-		CDBG("%s: %08x\n", __func__, *tbl);
-		tbl++;
-	}
-	vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-}
-
-static void vfe32_write_la_cfg(
-	enum VFE32_DMI_RAM_SEL channel_sel,
-	const uint32_t *tbl,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	uint32_t i;
-	uint32_t value, value1, value2;
-
-	vfe32_program_dmi_cfg(channel_sel, vfe32_ctrl);
-	for (i = 0 ; i < (VFE32_LA_TABLE_LENGTH/2) ; i++) {
-		value = *tbl++;
-		value1 = value & 0x0000FFFF;
-		value2 = (value & 0xFFFF0000)>>16;
-		msm_camera_io_w((value1),
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-		msm_camera_io_w((value2),
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-	}
-	vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-}
-
-static struct vfe32_output_ch *vfe32_get_ch(
-	int path, struct vfe_share_ctrl_t *share_ctrl)
-{
-	struct vfe32_output_ch *ch = NULL;
-
-	if (path == VFE_MSG_OUTPUT_PRIMARY)
-		ch = &share_ctrl->outpath.out0;
-	else if (path == VFE_MSG_OUTPUT_SECONDARY)
-		ch = &share_ctrl->outpath.out1;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY1)
-		ch = &share_ctrl->outpath.out2;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY2)
-		ch = &share_ctrl->outpath.out3;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY3)
-		ch = &share_ctrl->outpath.out4;
-	else
-		pr_err("%s: Invalid path %d\n", __func__,
-			path);
-
-	BUG_ON(ch == NULL);
-	return ch;
-}
-static struct msm_free_buf *vfe32_check_free_buffer(
-	int id, int path, struct axi_ctrl_t *axi_ctrl)
-{
-	struct vfe32_output_ch *outch = NULL;
-	struct msm_free_buf *b = NULL;
-	uint32_t inst_handle = 0;
-
-	if (path == VFE_MSG_OUTPUT_PRIMARY)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out0.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_SECONDARY)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out1.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY1)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out2.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY2)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out3.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY3)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out4.inst_handle;
-
-	vfe32_subdev_notify(id, path, inst_handle,
-		&axi_ctrl->subdev, axi_ctrl->share_ctrl);
-	outch = vfe32_get_ch(path, axi_ctrl->share_ctrl);
-	if (outch->free_buf.ch_paddr[0])
-		b = &outch->free_buf;
-	return b;
-}
-static int configure_pingpong_buffers(
-	int id, int path, struct axi_ctrl_t *axi_ctrl)
-{
-	struct vfe32_output_ch *outch = NULL;
-	int rc = 0;
-	uint32_t inst_handle = 0;
-	uint32_t rdi_comp_select = 0;
-	static uint32_t ping_t1_ch0_paddr, pong_t1_ch0_paddr;
-
-	if (path == VFE_MSG_OUTPUT_PRIMARY)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out0.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_SECONDARY)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out1.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY1)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out2.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY2)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out3.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY3)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out4.inst_handle;
-
-	CDBG("%s path %d, inst_handle 0x%x\n", __func__, path, inst_handle);
-	if ((axi_ctrl->share_ctrl->rdi_comp == VFE_RDI_COMPOSITE) &&
-		path == VFE_MSG_OUTPUT_TERTIARY2) {
-		/* Do Nothing, since buf address will be
-			fetched in TERTIARY1 case */
-	} else {
-		vfe32_subdev_notify(id, path, inst_handle,
-			&axi_ctrl->subdev, axi_ctrl->share_ctrl);
-	}
-
-	outch = vfe32_get_ch(path, axi_ctrl->share_ctrl);
-
-	if ((axi_ctrl->share_ctrl->rdi_comp == VFE_RDI_COMPOSITE) &&
-		(path == VFE_MSG_OUTPUT_TERTIARY1)) {
-		ping_t1_ch0_paddr = outch->ping.ch_paddr[1];
-		pong_t1_ch0_paddr = outch->pong.ch_paddr[1];
-	}
-	rdi_comp_select =
-		(axi_ctrl->share_ctrl->rdi_comp  == VFE_RDI_COMPOSITE) &&
-		(path == VFE_MSG_OUTPUT_TERTIARY2) && ping_t1_ch0_paddr &&
-		pong_t1_ch0_paddr;
-	if (rdi_comp_select) {
-		vfe32_put_ch_ping_addr(
-			axi_ctrl->share_ctrl->vfebase, outch->ch0,
-			ping_t1_ch0_paddr);
-		vfe32_put_ch_pong_addr(
-			axi_ctrl->share_ctrl->vfebase, outch->ch0,
-			pong_t1_ch0_paddr);
-		    ping_t1_ch0_paddr = 0;
-			pong_t1_ch0_paddr = 0;
-
-		memset(&outch->ping, 0, sizeof(struct msm_free_buf));
-		memset(&outch->pong, 0, sizeof(struct msm_free_buf));
-	} else if (outch->ping.ch_paddr[0] && outch->pong.ch_paddr[0]) {
-		/* Configure Preview Ping Pong */
-		CDBG("%s Configure ping/pong address for %d\n",
-						__func__, path);
-		CDBG("%s Ping/pong address 0x%x, 0x%x, 0x%x, 0x%x\n",
-			__func__, outch->ping.ch_paddr[0],
-			outch->pong.ch_paddr[0], outch->ping.ch_paddr[1],
-			outch->pong.ch_paddr[1]);
-		vfe32_put_ch_ping_addr(
-			axi_ctrl->share_ctrl->vfebase, outch->ch0,
-			outch->ping.ch_paddr[0]);
-		vfe32_put_ch_pong_addr(
-			axi_ctrl->share_ctrl->vfebase, outch->ch0,
-			outch->pong.ch_paddr[0]);
-
-		if ((axi_ctrl->share_ctrl->current_mode !=
-			VFE_OUTPUTS_RAW) && (path != VFE_MSG_OUTPUT_TERTIARY1)
-			&& (path != VFE_MSG_OUTPUT_TERTIARY2)
-			&& (path != VFE_MSG_OUTPUT_TERTIARY3)) {
-			vfe32_put_ch_ping_addr(
-				axi_ctrl->share_ctrl->vfebase, outch->ch1,
-				outch->ping.ch_paddr[1]);
-			vfe32_put_ch_pong_addr(
-				axi_ctrl->share_ctrl->vfebase, outch->ch1,
-				outch->pong.ch_paddr[1]);
-		}
-
-		if (outch->ping.num_planes > 2)
-			vfe32_put_ch_ping_addr(
-				axi_ctrl->share_ctrl->vfebase, outch->ch2,
-				outch->ping.ch_paddr[2]);
-		if (outch->pong.num_planes > 2)
-			vfe32_put_ch_pong_addr(
-				axi_ctrl->share_ctrl->vfebase, outch->ch2,
-				outch->pong.ch_paddr[2]);
-
-		/* avoid stale info */
-		memset(&outch->ping, 0, sizeof(struct msm_free_buf));
-		memset(&outch->pong, 0, sizeof(struct msm_free_buf));
-	} else {
-		pr_err("%s ping/pong addr is null!!", __func__);
-		rc = -EINVAL;
-	}
-	return rc;
-}
-
-static void vfe32_write_linear_cfg(
-	enum VFE32_DMI_RAM_SEL channel_sel,
-	const uint32_t *tbl, struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	uint32_t i;
-
-	vfe32_program_dmi_cfg(channel_sel, vfe32_ctrl);
-	/* for loop for configuring LUT. */
-	for (i = 0 ; i < VFE32_LINEARIZATON_TABLE_LENGTH ; i++) {
-		msm_camera_io_w(*tbl,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-		tbl++;
-	}
-	CDBG("done writing to linearization table\n");
-	vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-}
-
-static void vfe32_send_isp_msg(
-	struct v4l2_subdev *sd,
-	uint32_t vfeFrameId,
-	uint32_t isp_msg_id)
-{
-	struct isp_msg_event isp_msg_evt;
-
-	isp_msg_evt.msg_id = isp_msg_id;
-	isp_msg_evt.sof_count = vfeFrameId;
-	v4l2_subdev_notify(sd,
-			NOTIFY_ISP_MSG_EVT,
-			(void *)&isp_msg_evt);
-}
-
-static int vfe32_proc_general(
-	struct msm_cam_media_controller *pmctl,
-	struct msm_isp_cmd *cmd,
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	int i , rc = 0;
-	uint32_t old_val = 0 , new_val = 0, module_val = 0;
-	uint32_t *cmdp = NULL;
-	uint32_t *cmdp_local = NULL;
-	uint32_t snapshot_cnt = 0;
-	uint32_t temp1 = 0, temp2 = 0;
-	struct msm_camera_vfe_params_t vfe_params;
-
-	CDBG("vfe32_proc_general: cmdID = %s, length = %d\n",
-		vfe32_general_cmd[cmd->id], cmd->length);
-	switch (cmd->id) {
-	case VFE_CMD_RESET:
-		pr_info("vfe32_proc_general: cmdID = %s\n",
-			vfe32_general_cmd[cmd->id]);
-		vfe32_ctrl->share_ctrl->vfe_reset_flag = true;
-		vfe32_reset(vfe32_ctrl);
-		break;
-	case VFE_CMD_START:
-		pr_info("vfe32_proc_general: cmdID = %s\n",
-			vfe32_general_cmd[cmd->id]);
-		if (copy_from_user(&vfe_params,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				rc = -EFAULT;
-				goto proc_general_done;
-		}
-
-		vfe32_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-
-		rc = vfe32_start(pmctl, vfe32_ctrl);
-		break;
-	case VFE_CMD_UPDATE:
-		vfe32_update(vfe32_ctrl);
-		break;
-	case VFE_CMD_CAPTURE_RAW:
-		pr_info("%s: cmdID = VFE_CMD_CAPTURE_RAW\n", __func__);
-		if (copy_from_user(&vfe_params,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				rc = -EFAULT;
-				goto proc_general_done;
-		}
-
-		snapshot_cnt = vfe_params.capture_count;
-		vfe32_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-		rc = vfe32_capture_raw(pmctl, vfe32_ctrl, snapshot_cnt);
-		break;
-	case VFE_CMD_CAPTURE:
-		if (copy_from_user(&vfe_params,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				rc = -EFAULT;
-				goto proc_general_done;
-		}
-
-		snapshot_cnt = vfe_params.capture_count;
-		vfe32_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-
-		rc = vfe32_capture(pmctl, snapshot_cnt, vfe32_ctrl);
-		break;
-	case VFE_CMD_START_RECORDING:
-		pr_info("vfe32_proc_general: cmdID = %s\n",
-			vfe32_general_cmd[cmd->id]);
-		rc = vfe32_start_recording(pmctl, vfe32_ctrl);
-		break;
-	case VFE_CMD_STOP_RECORDING:
-		pr_info("vfe32_proc_general: cmdID = %s\n",
-			vfe32_general_cmd[cmd->id]);
-		rc = vfe32_stop_recording(pmctl, vfe32_ctrl);
-		break;
-	case VFE_CMD_OPERATION_CFG: {
-		if (cmd->length != V32_OPERATION_CFG_LEN) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(V32_OPERATION_CFG_LEN, GFP_ATOMIC);
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			V32_OPERATION_CFG_LEN)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe32_operation_config(cmdp, vfe32_ctrl);
-		}
-		break;
-
-	case VFE_CMD_STATS_AE_START: {
-		if (vfe32_use_bayer_stats(vfe32_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe_stats_aec_bg_buf_init(vfe32_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of AEC",
-				 __func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= AE_BG_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp, (vfe32_cmd[cmd->id].length));
-		}
-		break;
-	case VFE_CMD_STATS_AF_START: {
-		if (vfe32_use_bayer_stats(vfe32_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe_stats_af_bf_buf_init(vfe32_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of AF",
-				__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(vfe32_ctrl->share_ctrl->vfebase +
-			VFE_MODULE_CFG);
-		old_val |= AF_BF_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp, (vfe32_cmd[cmd->id].length));
-		}
-		break;
-	case VFE_CMD_STATS_AWB_START: {
-		if (vfe32_use_bayer_stats(vfe32_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe_stats_awb_buf_init(vfe32_ctrl, NULL);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of AWB",
-				 __func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= AWB_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp, (vfe32_cmd[cmd->id].length));
-		}
-		break;
-
-	case VFE_CMD_STATS_IHIST_START: {
-		rc = vfe_stats_ihist_buf_init(vfe32_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of IHIST",
-				 __func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= IHIST_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp, (vfe32_cmd[cmd->id].length));
-		}
-		break;
-
-
-	case VFE_CMD_STATS_RS_START: {
-		rc = vfe_stats_rs_buf_init(vfe32_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of RS",
-				__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp, (vfe32_cmd[cmd->id].length));
-		}
-		break;
-
-	case VFE_CMD_STATS_CS_START: {
-		rc = vfe_stats_cs_buf_init(vfe32_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of CS",
-				__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp, (vfe32_cmd[cmd->id].length));
-		}
-		break;
-
-	case VFE_CMD_STATS_BG_START:
-	case VFE_CMD_STATS_BF_START:
-	case VFE_CMD_STATS_BHIST_START: {
-		if (!vfe32_use_bayer_stats(vfe32_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_STATS_CFG);
-		module_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		if (VFE_CMD_STATS_BG_START == cmd->id) {
-			module_val |= AE_BG_ENABLE_MASK;
-			old_val |= STATS_BG_ENABLE_MASK;
-			rc = vfe_stats_aec_bg_buf_init(vfe32_ctrl);
-			if (rc < 0) {
-				pr_err("%s: cannot config ping/pong address of CS",
-					__func__);
-				goto proc_general_done;
-			}
-		} else if (VFE_CMD_STATS_BF_START == cmd->id) {
-			module_val |= AF_BF_ENABLE_MASK;
-			old_val |= STATS_BF_ENABLE_MASK;
-			rc = vfe_stats_af_bf_buf_init(vfe32_ctrl);
-			if (rc < 0) {
-				pr_err("%s: cannot config ping/pong address of CS",
-					__func__);
-				goto proc_general_done;
-			}
-		} else {
-			module_val |= SKIN_BHIST_ENABLE_MASK;
-			old_val |= STATS_BHIST_ENABLE_MASK;
-			rc = vfe_stats_bhist_buf_init(vfe32_ctrl);
-			if (rc < 0) {
-				pr_err("%s: cannot config ping/pong address of CS",
-					__func__);
-				goto proc_general_done;
-			}
-		}
-		msm_camera_io_w(old_val, vfe32_ctrl->share_ctrl->vfebase +
-			VFE_STATS_CFG);
-		msm_camera_io_w(module_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-				(void __user *)(cmd->value),
-				cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp, (vfe32_cmd[cmd->id].length));
-		}
-		break;
-	case VFE_CMD_MCE_UPDATE:
-	case VFE_CMD_MCE_CFG:{
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		/* Incrementing with 4 so as to point to the 2nd Register as
-		the 2nd register has the mce_enable bit */
-		old_val = msm_camera_io_r(vfe32_ctrl->share_ctrl->vfebase +
-			V32_CHROMA_SUP_OFF + 4);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-		old_val &= MCE_EN_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V32_CHROMA_SUP_OFF + 4, &new_val, 4);
-		cmdp_local += 1;
-
-		old_val = msm_camera_io_r(vfe32_ctrl->share_ctrl->vfebase +
-			V32_CHROMA_SUP_OFF + 8);
-		new_val = *cmdp_local;
-		old_val &= MCE_Q_K_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V32_CHROMA_SUP_OFF + 8, &new_val, 4);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp_local, (vfe32_cmd[cmd->id].length));
-		}
-		break;
-	case VFE_CMD_CHROMA_SUP_UPDATE:
-	case VFE_CMD_CHROMA_SUP_CFG:{
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(vfe32_ctrl->share_ctrl->vfebase +
-			V32_CHROMA_SUP_OFF, cmdp_local, 4);
-
-		cmdp_local += 1;
-		new_val = *cmdp_local;
-		/* Incrementing with 4 so as to point to the 2nd Register as
-		 * the 2nd register has the mce_enable bit
-		 */
-		old_val = msm_camera_io_r(vfe32_ctrl->share_ctrl->vfebase +
-			V32_CHROMA_SUP_OFF + 4);
-		old_val &= ~MCE_EN_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V32_CHROMA_SUP_OFF + 4, &new_val, 4);
-		cmdp_local += 1;
-
-		old_val = msm_camera_io_r(vfe32_ctrl->share_ctrl->vfebase +
-			V32_CHROMA_SUP_OFF + 8);
-		new_val = *cmdp_local;
-		old_val &= ~MCE_Q_K_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V32_CHROMA_SUP_OFF + 8, &new_val, 4);
-		}
-		break;
-	case VFE_CMD_BLACK_LEVEL_CFG:
-		rc = -EFAULT;
-		goto proc_general_done;
-
-	case VFE_CMD_MESH_ROLL_OFF_CFG: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value) , cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp_local, 16);
-		cmdp_local += 4;
-		vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK0, vfe32_ctrl);
-		/* for loop for extrcting init table. */
-		for (i = 0; i < (V32_MESH_ROLL_OFF_INIT_TABLE_SIZE * 2); i++) {
-			msm_camera_io_w(*cmdp_local ,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-			cmdp_local++;
-		}
-		CDBG("done writing init table\n");
-		/* by default, always starts with offset 0. */
-		msm_camera_io_w(V32_MESH_ROLL_OFF_DELTA_TABLE_OFFSET,
-		vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_ADDR);
-		/* for loop for extracting delta table. */
-		for (i = 0; i < (V32_MESH_ROLL_OFF_DELTA_TABLE_SIZE * 2); i++) {
-			msm_camera_io_w(*cmdp_local,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-			cmdp_local++;
-		}
-		vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-		}
-		break;
-
-	case VFE_CMD_GET_MESH_ROLLOFF_TABLE:
-		temp1 = sizeof(uint32_t) * ((V32_MESH_ROLL_OFF_INIT_TABLE_SIZE *
-			2) + (V32_MESH_ROLL_OFF_DELTA_TABLE_SIZE * 2));
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kzalloc(temp1, GFP_KERNEL);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK0, vfe32_ctrl);
-		CDBG("%s: Mesh Rolloff init Table\n", __func__);
-		for (i = 0; i < (V32_MESH_ROLL_OFF_INIT_TABLE_SIZE * 2); i++) {
-			*cmdp_local =
-				msm_camera_io_r(
-					vfe32_ctrl->share_ctrl->vfebase +
-					VFE_DMI_DATA_LO);
-			CDBG("%s: %08x\n", __func__, *cmdp_local);
-			cmdp_local++;
-		}
-		msm_camera_io_w(V32_MESH_ROLL_OFF_DELTA_TABLE_OFFSET,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_ADDR);
-		CDBG("%s: Mesh Rolloff Delta Table\n", __func__);
-		for (i = 0; i < (V32_MESH_ROLL_OFF_DELTA_TABLE_SIZE * 2); i++) {
-			*cmdp_local =
-				msm_camera_io_r(
-					vfe32_ctrl->share_ctrl->vfebase +
-					VFE_DMI_DATA_LO);
-			CDBG("%s: %08x\n", __func__, *cmdp_local);
-			cmdp_local++;
-		}
-		CDBG("done reading delta table\n");
-		vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_LA_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp_local, (vfe32_cmd[cmd->id].length));
-
-		cmdp_local += 1;
-		vfe32_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK0,
-						   cmdp_local, vfe32_ctrl);
-		break;
-
-	case VFE_CMD_LA_UPDATE: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-
-		cmdp_local = cmdp + 1;
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + V32_LA_OFF);
-		if (old_val != 0x0)
-			vfe32_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK0,
-				cmdp_local, vfe32_ctrl);
-		else
-			vfe32_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK1,
-				cmdp_local, vfe32_ctrl);
-		}
-		vfe32_ctrl->update_la = true;
-		break;
-
-	case VFE_CMD_GET_LA_TABLE:
-		temp1 = sizeof(uint32_t) * VFE32_LA_TABLE_LENGTH / 2;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kzalloc(temp1, GFP_KERNEL);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		if (msm_camera_io_r(vfe32_ctrl->
-				share_ctrl->vfebase + V32_LA_OFF))
-			vfe32_program_dmi_cfg(LUMA_ADAPT_LUT_RAM_BANK1,
-						vfe32_ctrl);
-		else
-			vfe32_program_dmi_cfg(LUMA_ADAPT_LUT_RAM_BANK0,
-						vfe32_ctrl);
-		for (i = 0 ; i < (VFE32_LA_TABLE_LENGTH / 2) ; i++) {
-			*cmdp_local =
-				msm_camera_io_r(
-					vfe32_ctrl->share_ctrl->vfebase +
-					VFE_DMI_DATA_LO);
-			*cmdp_local |= (msm_camera_io_r(
-				vfe32_ctrl->share_ctrl->vfebase +
-				VFE_DMI_DATA_LO)) << 16;
-			cmdp_local++;
-		}
-		vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_SK_ENHAN_CFG:
-	case VFE_CMD_SK_ENHAN_UPDATE:{
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase + V32_SCE_OFF,
-			cmdp, V32_SCE_LEN);
-		}
-		break;
-
-	case VFE_CMD_LIVESHOT:
-		/* Configure primary channel */
-		vfe32_start_liveshot(pmctl, vfe32_ctrl);
-		break;
-
-	case VFE_CMD_LINEARIZATION_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V32_LINEARIZATION_OFF1,
-			cmdp_local, V32_LINEARIZATION_LEN1);
-		cmdp_local += 4;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V32_LINEARIZATION_OFF2,
-			cmdp_local, V32_LINEARIZATION_LEN2);
-
-		cmdp_local = cmdp + 17;
-		vfe32_write_linear_cfg(BLACK_LUT_RAM_BANK0,
-					cmdp_local, vfe32_ctrl);
-		break;
-
-	case VFE_CMD_LINEARIZATION_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		cmdp_local++;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V32_LINEARIZATION_OFF1 + 4,
-			cmdp_local, (V32_LINEARIZATION_LEN1 - 4));
-		cmdp_local += 3;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V32_LINEARIZATION_OFF2,
-			cmdp_local, V32_LINEARIZATION_LEN2);
-		cmdp_local = cmdp + 17;
-		/*extracting the bank select*/
-		old_val = msm_camera_io_r(
-				vfe32_ctrl->share_ctrl->vfebase +
-				V32_LINEARIZATION_OFF1);
-
-		if (old_val != 0x0)
-			vfe32_write_linear_cfg(BLACK_LUT_RAM_BANK0,
-						cmdp_local, vfe32_ctrl);
-		else
-			vfe32_write_linear_cfg(BLACK_LUT_RAM_BANK1,
-						cmdp_local, vfe32_ctrl);
-		vfe32_ctrl->update_linear = true;
-		break;
-
-	case VFE_CMD_GET_LINEARIZATON_TABLE:
-		temp1 = sizeof(uint32_t) * VFE32_LINEARIZATON_TABLE_LENGTH;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kzalloc(temp1, GFP_KERNEL);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		if (msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V32_LINEARIZATION_OFF1))
-			vfe32_program_dmi_cfg(BLACK_LUT_RAM_BANK1, vfe32_ctrl);
-		else
-			vfe32_program_dmi_cfg(BLACK_LUT_RAM_BANK0, vfe32_ctrl);
-		CDBG("%s: Linearization Table\n", __func__);
-		for (i = 0 ; i < VFE32_LINEARIZATON_TABLE_LENGTH ; i++) {
-			*cmdp_local = msm_camera_io_r(
-				vfe32_ctrl->share_ctrl->vfebase +
-				VFE_DMI_DATA_LO);
-			CDBG("%s: %08x\n", __func__, *cmdp_local);
-			cmdp_local++;
-		}
-		vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_DEMOSAICV3:
-		if (cmd->length !=
-			V32_DEMOSAICV3_0_LEN+V32_DEMOSAICV3_1_LEN) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_0_OFF);
-		old_val &= DEMOSAIC_MASK;
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_0_OFF,
-			cmdp_local, V32_DEMOSAICV3_0_LEN);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_1_OFF,
-			cmdp_local, V32_DEMOSAICV3_1_LEN);
-		break;
-
-	case VFE_CMD_DEMOSAICV3_UPDATE:
-		if (cmd->length !=
-			V32_DEMOSAICV3_0_LEN * V32_DEMOSAICV3_UP_REG_CNT) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_0_OFF);
-		old_val &= DEMOSAIC_MASK;
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_0_OFF,
-			cmdp_local, V32_DEMOSAICV3_0_LEN);
-		/* As the address space is not contiguous increment by 2
-		 * before copying to next address space */
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_1_OFF,
-			cmdp_local, 2 * V32_DEMOSAICV3_0_LEN);
-		/* As the address space is not contiguous increment by 2
-		 * before copying to next address space */
-		cmdp_local += 2;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_2_OFF,
-			cmdp_local, 2 * V32_DEMOSAICV3_0_LEN);
-		break;
-
-	case VFE_CMD_DEMOSAICV3_ABCC_CFG:
-		rc = -EFAULT;
-		break;
-
-	case VFE_CMD_DEMOSAICV3_ABF_UPDATE:/* 116 ABF update  */
-	case VFE_CMD_DEMOSAICV3_ABF_CFG: { /* 108 ABF config  */
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_0_OFF);
-		old_val &= ABF_MASK;
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_0_OFF,
-			cmdp_local, 4);
-
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp_local, (vfe32_cmd[cmd->id].length));
-		}
-		break;
-
-	case VFE_CMD_DEMOSAICV3_DBCC_CFG:
-	case VFE_CMD_DEMOSAICV3_DBCC_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_0_OFF);
-		old_val &= DBCC_MASK;
-
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_0_OFF,
-			cmdp_local, 4);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp_local, (vfe32_cmd[cmd->id].length));
-		break;
-
-	case VFE_CMD_DEMOSAICV3_DBPC_CFG:
-	case VFE_CMD_DEMOSAICV3_DBPC_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + V32_DEMOSAICV3_0_OFF);
-		old_val &= DBPC_MASK;
-
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-		msm_camera_io_memcpy(vfe32_ctrl->share_ctrl->vfebase +
-			V32_DEMOSAICV3_0_OFF,
-			cmdp_local, V32_DEMOSAICV3_LEN);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(vfe32_ctrl->share_ctrl->vfebase +
-			V32_DEMOSAICV3_DBPC_CFG_OFF,
-			cmdp_local, V32_DEMOSAICV3_DBPC_LEN);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(vfe32_ctrl->share_ctrl->vfebase +
-			V32_DEMOSAICV3_DBPC_CFG_OFF0,
-			cmdp_local, V32_DEMOSAICV3_DBPC_LEN);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(vfe32_ctrl->share_ctrl->vfebase +
-			V32_DEMOSAICV3_DBPC_CFG_OFF1,
-			cmdp_local, V32_DEMOSAICV3_DBPC_LEN);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(vfe32_ctrl->share_ctrl->vfebase +
-			V32_DEMOSAICV3_DBPC_CFG_OFF2,
-			cmdp_local, V32_DEMOSAICV3_DBPC_LEN);
-		break;
-
-	case VFE_CMD_RGB_G_CFG: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase + V32_RGB_G_OFF,
-			cmdp, 4);
-		cmdp += 1;
-
-		vfe32_write_gamma_cfg(RGBLUT_RAM_CH0_BANK0, cmdp, vfe32_ctrl);
-		vfe32_write_gamma_cfg(RGBLUT_RAM_CH1_BANK0, cmdp, vfe32_ctrl);
-		vfe32_write_gamma_cfg(RGBLUT_RAM_CH2_BANK0, cmdp, vfe32_ctrl);
-		}
-	    cmdp -= 1;
-		break;
-
-	case VFE_CMD_RGB_ALL_CFG: {
-		cmdp = kmalloc((cmd->length), GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase + V32_RGB_G_OFF,
-			cmdp, 4);
-		cmdp += 1;
-
-		vfe32_write_gamma_cfg(RGBLUT_RAM_CH0_BANK0,
-			cmdp + VFE32_GAMMA_CH0_G_POS, vfe32_ctrl);
-		vfe32_write_gamma_cfg(RGBLUT_RAM_CH1_BANK0,
-			cmdp + VFE32_GAMMA_CH1_B_POS, vfe32_ctrl);
-		vfe32_write_gamma_cfg(RGBLUT_RAM_CH2_BANK0,
-			cmdp + VFE32_GAMMA_CH2_R_POS, vfe32_ctrl);
-		}
-	    cmdp -= 1;
-		break;
-
-	case VFE_CMD_RGB_ALL_UPDATE: {
-		cmdp = kmalloc((cmd->length), GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + V32_RGB_G_OFF);
-			cmdp += 1;
-		if (old_val != 0x0) {
-			vfe32_write_gamma_cfg(RGBLUT_RAM_CH0_BANK0,
-				cmdp + VFE32_GAMMA_CH0_G_POS, vfe32_ctrl);
-			vfe32_write_gamma_cfg(RGBLUT_RAM_CH1_BANK0,
-				cmdp + VFE32_GAMMA_CH1_B_POS, vfe32_ctrl);
-			vfe32_write_gamma_cfg(RGBLUT_RAM_CH2_BANK0,
-				cmdp + VFE32_GAMMA_CH2_R_POS, vfe32_ctrl);
-		} else {
-			vfe32_write_gamma_cfg(RGBLUT_RAM_CH0_BANK1,
-				cmdp + VFE32_GAMMA_CH0_G_POS, vfe32_ctrl);
-			vfe32_write_gamma_cfg(RGBLUT_RAM_CH1_BANK1,
-				cmdp + VFE32_GAMMA_CH1_B_POS, vfe32_ctrl);
-			vfe32_write_gamma_cfg(RGBLUT_RAM_CH2_BANK1,
-				cmdp + VFE32_GAMMA_CH2_R_POS, vfe32_ctrl);
-		}
-		}
-		vfe32_ctrl->update_gamma = TRUE;
-		cmdp -= 1;
-		break;
-
-	case VFE_CMD_RGB_G_UPDATE: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + V32_RGB_G_OFF);
-		cmdp += 1;
-		if (old_val != 0x0) {
-			vfe32_write_gamma_cfg(
-				RGBLUT_RAM_CH0_BANK0, cmdp, vfe32_ctrl);
-			vfe32_write_gamma_cfg(
-				RGBLUT_RAM_CH1_BANK0, cmdp, vfe32_ctrl);
-			vfe32_write_gamma_cfg(
-				RGBLUT_RAM_CH2_BANK0, cmdp, vfe32_ctrl);
-		} else {
-			vfe32_write_gamma_cfg(
-				RGBLUT_RAM_CH0_BANK1, cmdp, vfe32_ctrl);
-			vfe32_write_gamma_cfg(
-				RGBLUT_RAM_CH1_BANK1, cmdp, vfe32_ctrl);
-			vfe32_write_gamma_cfg(
-				RGBLUT_RAM_CH2_BANK1, cmdp, vfe32_ctrl);
-		}
-		}
-		vfe32_ctrl->update_gamma = TRUE;
-		cmdp -= 1;
-		break;
-
-	case VFE_CMD_GET_RGB_G_TABLE:
-		temp1 = sizeof(uint32_t) * VFE32_GAMMA_NUM_ENTRIES * 3;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kzalloc(temp1, GFP_KERNEL);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + V32_RGB_G_OFF);
-		temp2 = old_val ? RGBLUT_RAM_CH0_BANK1 :
-			RGBLUT_RAM_CH0_BANK0;
-		for (i = 0; i < 3; i++) {
-			vfe32_read_gamma_cfg(temp2,
-				cmdp_local + (VFE32_GAMMA_NUM_ENTRIES * i),
-				vfe32_ctrl);
-			temp2 += 2;
-		}
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-
-	case VFE_CMD_STATS_AWB_STOP: {
-		if (vfe32_use_bayer_stats(vfe32_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~AWB_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-	case VFE_CMD_STATS_AE_STOP: {
-		if (vfe32_use_bayer_stats(vfe32_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~AE_BG_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-	case VFE_CMD_STATS_AF_STOP: {
-		if (vfe32_use_bayer_stats(vfe32_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~AF_BF_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-
-	case VFE_CMD_STATS_IHIST_STOP: {
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~IHIST_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-
-	case VFE_CMD_STATS_RS_STOP: {
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~RS_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-
-	case VFE_CMD_STATS_CS_STOP: {
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~CS_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-
-	case VFE_CMD_STATS_BG_STOP:
-	case VFE_CMD_STATS_BF_STOP:
-	case VFE_CMD_STATS_BHIST_STOP: {
-		if (!vfe32_use_bayer_stats(vfe32_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_STATS_CFG);
-		if (VFE_CMD_STATS_BG_STOP == cmd->id)
-			old_val &= ~STATS_BG_ENABLE_MASK;
-		else if (VFE_CMD_STATS_BF_STOP == cmd->id)
-			old_val &= ~STATS_BF_ENABLE_MASK;
-		else
-			old_val &= ~STATS_BHIST_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_STATS_CFG);
-		if (VFE_CMD_STATS_BF_STOP == cmd->id) {
-			rc = vfe32_stats_flush_enqueue(vfe32_ctrl,
-					MSM_STATS_TYPE_BF);
-			if (rc < 0) {
-				pr_err("%s: dq stats buf err = %d",
-					   __func__, rc);
-				return -EINVAL;
-			}
-		}
-		}
-		break;
-
-	case VFE_CMD_STOP:
-		pr_info("vfe32_proc_general: cmdID = %s\n",
-			vfe32_general_cmd[cmd->id]);
-		if (copy_from_user(&vfe_params,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				rc = -EFAULT;
-				goto proc_general_done;
-		}
-
-		vfe32_stop(vfe32_ctrl);
-		break;
-
-	case VFE_CMD_SYNC_TIMER_SETTING:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		vfe32_sync_timer_start(cmdp, vfe32_ctrl);
-		break;
-
-	case VFE_CMD_MODULE_CFG: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		*cmdp &= ~STATS_ENABLE_MASK;
-		old_val = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= STATS_ENABLE_MASK;
-		*cmdp |= old_val;
-
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp, (vfe32_cmd[cmd->id].length));
-		}
-		break;
-
-	case VFE_CMD_ZSL:
-		if (copy_from_user(&vfe_params,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				rc = -EFAULT;
-				goto proc_general_done;
-		}
-
-		vfe32_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-
-		rc = vfe32_zsl(pmctl, vfe32_ctrl);
-		break;
-
-	case VFE_CMD_ASF_CFG:
-	case VFE_CMD_ASF_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp, (vfe32_cmd[cmd->id].length));
-		cmdp_local = cmdp + V32_ASF_LEN/4;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V32_ASF_SPECIAL_EFX_CFG_OFF,
-			cmdp_local, V32_ASF_SPECIAL_EFX_CFG_LEN);
-		break;
-
-	case VFE_CMD_PCA_ROLL_OFF_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value) , cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-
-		cmdp_local = cmdp;
-
-		temp1 = *cmdp_local;
-		cmdp_local++;
-
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V33_PCA_ROLL_OFF_CFG_OFF1,
-			cmdp_local, V33_PCA_ROLL_OFF_CFG_LEN1);
-		cmdp_local += 4;
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			V33_PCA_ROLL_OFF_CFG_OFF2,
-			cmdp_local, V33_PCA_ROLL_OFF_CFG_LEN2);
-
-		cmdp_local += 3;
-		CDBG("%s: start writing RollOff Ram0 table\n", __func__);
-		vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK0, vfe32_ctrl);
-		msm_camera_io_w(temp1,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_ADDR);
-		for (i = 0 ; i < V33_PCA_ROLL_OFF_TABLE_SIZE ; i++) {
-			msm_camera_io_w(*(cmdp_local + 1),
-				vfe32_ctrl->share_ctrl->vfebase +
-				VFE33_DMI_DATA_HI);
-			msm_camera_io_w(*cmdp_local,
-				vfe32_ctrl->share_ctrl->vfebase +
-				VFE33_DMI_DATA_LO);
-			cmdp_local += 2;
-		}
-		CDBG("%s: end writing RollOff Ram0 table\n", __func__);
-
-		CDBG("%s: start writing RollOff Ram1 table\n", __func__);
-		vfe32_program_dmi_cfg(ROLLOFF_RAM1_BANK0, vfe32_ctrl);
-		msm_camera_io_w(temp1,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_ADDR);
-		for (i = 0 ; i < V33_PCA_ROLL_OFF_TABLE_SIZE ; i++) {
-			msm_camera_io_w(*cmdp_local,
-				vfe32_ctrl->share_ctrl->vfebase +
-				VFE33_DMI_DATA_LO);
-			cmdp_local += 2;
-		}
-		CDBG("%s: end writing RollOff Ram1 table\n", __func__);
-
-		vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-		break;
-
-	case VFE_CMD_PCA_ROLL_OFF_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value), cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-
-		cmdp_local = cmdp;
-
-		temp1 = *cmdp_local;
-		cmdp_local += 8;
-
-		temp2 = msm_camera_io_r(vfe32_ctrl->share_ctrl->vfebase +
-			V33_PCA_ROLL_OFF_CFG_OFF1)
-			& V33_PCA_ROLL_OFF_LUT_BANK_SEL_MASK;
-
-		CDBG("%s: start writing RollOff Ram0 table\n", __func__);
-		if (temp2)
-			vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK0, vfe32_ctrl);
-		else
-			vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK1, vfe32_ctrl);
-
-		msm_camera_io_w(temp1,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_ADDR);
-		for (i = 0 ; i < V33_PCA_ROLL_OFF_TABLE_SIZE ; i++) {
-			msm_camera_io_w(*(cmdp_local + 1),
-				vfe32_ctrl->share_ctrl->vfebase +
-				VFE33_DMI_DATA_HI);
-			msm_camera_io_w(*cmdp_local,
-				vfe32_ctrl->share_ctrl->vfebase +
-				VFE33_DMI_DATA_LO);
-			cmdp_local += 2;
-		}
-		CDBG("%s: end writing RollOff Ram0 table\n", __func__);
-
-		CDBG("%s: start writing RollOff Ram1 table\n", __func__);
-		if (temp2)
-			vfe32_program_dmi_cfg(ROLLOFF_RAM1_BANK0, vfe32_ctrl);
-		else
-			vfe32_program_dmi_cfg(ROLLOFF_RAM1_BANK1, vfe32_ctrl);
-
-		msm_camera_io_w(temp1,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_DMI_ADDR);
-		for (i = 0 ; i < V33_PCA_ROLL_OFF_TABLE_SIZE ; i++) {
-			msm_camera_io_w(*cmdp_local,
-				vfe32_ctrl->share_ctrl->vfebase +
-				VFE33_DMI_DATA_LO);
-			cmdp_local += 2;
-		}
-		CDBG("%s: end writing RollOff Ram1 table\n", __func__);
-
-		vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-		vfe32_ctrl->update_rolloff = true;
-		break;
-	case VFE_CMD_GET_PCA_ROLLOFF_TABLE:
-		temp1 = sizeof(uint64_t) * V33_PCA_ROLL_OFF_TABLE_SIZE * 2;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kzalloc(temp1, GFP_KERNEL);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		old_val = msm_camera_io_r(vfe32_ctrl->share_ctrl->vfebase +
-			V33_PCA_ROLL_OFF_CFG_OFF1) &
-			V33_PCA_ROLL_OFF_LUT_BANK_SEL_MASK;
-
-		if (old_val)
-			vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK1, vfe32_ctrl);
-		else
-			vfe32_program_dmi_cfg(ROLLOFF_RAM0_BANK0, vfe32_ctrl);
-
-		CDBG("%s: PCA Rolloff Ram0\n", __func__);
-		for (i = 0 ; i < V33_PCA_ROLL_OFF_TABLE_SIZE * 2; i++) {
-			temp2 = (i == (V33_PCA_ROLL_OFF_TABLE_SIZE));
-			if (old_val && temp2)
-				vfe32_program_dmi_cfg(ROLLOFF_RAM1_BANK1,
-				vfe32_ctrl);
-			else if (!old_val && temp2)
-				vfe32_program_dmi_cfg(ROLLOFF_RAM1_BANK0,
-				vfe32_ctrl);
-
-			*cmdp_local = msm_camera_io_r(
-				vfe32_ctrl->share_ctrl->vfebase +
-				VFE33_DMI_DATA_LO);
-			*(cmdp_local + 1) =
-				msm_camera_io_r(
-				vfe32_ctrl->share_ctrl->vfebase +
-				VFE33_DMI_DATA_HI);
-			CDBG("%s: %08x%08x\n", __func__,
-				*(cmdp_local + 1), *cmdp_local);
-			cmdp_local += 2;
-		}
-		vfe32_program_dmi_cfg(NO_MEM_SELECTED, vfe32_ctrl);
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_GET_HW_VERSION:
-		if (cmd->length != V32_GET_HW_VERSION_LEN) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(V32_GET_HW_VERSION_LEN, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		*cmdp = msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase+V32_GET_HW_VERSION_OFF);
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			V32_GET_HW_VERSION_LEN)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_GET_REG_DUMP:
-		temp1 = sizeof(uint32_t) *
-			vfe32_ctrl->share_ctrl->register_total;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(temp1, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		msm_camera_io_dump(vfe32_ctrl->share_ctrl->vfebase,
-			vfe32_ctrl->share_ctrl->register_total*4);
-		CDBG("%s: %p %p %d\n", __func__, (void *)cmdp,
-			vfe32_ctrl->share_ctrl->vfebase, temp1);
-		memcpy_fromio((void *)cmdp,
-			vfe32_ctrl->share_ctrl->vfebase, temp1);
-		if (copy_to_user((void __user *)(cmd->value), cmdp, temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_FRAME_SKIP_CFG:
-		if (cmd->length != vfe32_cmd[cmd->id].length)
-			return -EINVAL;
-
-		cmdp = kmalloc(vfe32_cmd[cmd->id].length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-
-		if (copy_from_user((cmdp), (void __user *)cmd->value,
-				cmd->length)) {
-			rc = -EFAULT;
-			pr_err("%s copy from user failed for cmd %d",
-				__func__, cmd->id);
-			break;
-		}
-
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp, (vfe32_cmd[cmd->id].length));
-		vfe32_ctrl->frame_skip_cnt = ((uint32_t)
-			*cmdp & VFE_FRAME_SKIP_PERIOD_MASK) + 1;
-		vfe32_ctrl->frame_skip_pattern = (uint32_t)(*(cmdp + 2));
-		break;
-	case VFE_CMD_STOP_LIVESHOT:
-		CDBG("%s Stopping liveshot ", __func__);
-		vfe32_stop_liveshot(pmctl, vfe32_ctrl);
-		break;
-	case VFE_CMD_SELECT_RDI: {
-		uint32_t rdi_sel;
-		if (copy_from_user(&rdi_sel,
-				(void __user *)(cmd->value),
-				sizeof(uint32_t))) {
-				rc = -EFAULT;
-				goto proc_general_done;
-		}
-		pr_info("%s: rdi interface: %d\n", __func__, rdi_sel);
-		vfe32_ctrl->share_ctrl->rdi_comp = rdi_sel;
-	}
-		break;
-	case VFE_CMD_SET_STATS_VER:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		vfe32_ctrl->ver_num.main = *(uint32_t *)cmdp;
-		CDBG("%s:Set Stats version %d", __func__,
-			vfe32_ctrl->ver_num.main);
-
-		break;
-	default:
-		if (cmd->length != vfe32_cmd[cmd->id].length)
-			return -EINVAL;
-
-		cmdp = kmalloc(vfe32_cmd[cmd->id].length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-
-		if (copy_from_user((cmdp), (void __user *)cmd->value,
-				cmd->length)) {
-			rc = -EFAULT;
-			pr_err("%s copy from user failed for cmd %d",
-				__func__, cmd->id);
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe32_ctrl->share_ctrl->vfebase +
-			vfe32_cmd[cmd->id].offset,
-			cmdp, (vfe32_cmd[cmd->id].length));
-		break;
-
-	}
-
-proc_general_done:
-	kfree(cmdp);
-
-	return rc;
-}
-
-static inline void vfe32_read_irq_status(
-	struct axi_ctrl_t *axi_ctrl, struct vfe32_irq_status *out)
-{
-	uint32_t *temp;
-	memset(out, 0, sizeof(struct vfe32_irq_status));
-	temp = (uint32_t *)(axi_ctrl->share_ctrl->vfebase + VFE_IRQ_STATUS_0);
-	out->vfeIrqStatus0 = msm_camera_io_r(temp);
-
-	temp = (uint32_t *)(axi_ctrl->share_ctrl->vfebase + VFE_IRQ_STATUS_1);
-	out->vfeIrqStatus1 = msm_camera_io_r(temp);
-
-	temp = (uint32_t *)(axi_ctrl->share_ctrl->vfebase + VFE_CAMIF_STATUS);
-	out->camifStatus = msm_camera_io_r(temp);
-	CDBG("camifStatus  = 0x%x\n", out->camifStatus);
-
-	/* clear the pending interrupt of the same kind.*/
-	msm_camera_io_w(out->vfeIrqStatus0,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(out->vfeIrqStatus1,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CMD);
-
-}
-
-void axi_stop_pix(struct vfe_share_ctrl_t *share_ctrl,
-	uint32_t vfe_mode, uint8_t cmd_type)
-{
-	uint32_t reg_update = 0x1;
-	switch (cmd_type) {
-	case AXI_CMD_RAW_CAPTURE:
-		msm_camera_io_w(0, share_ctrl->vfebase
-			+ vfe32_AXI_WM_CFG[share_ctrl->outpath.out0.ch0]);
-		break;
-	case AXI_CMD_PREVIEW: {
-		switch (vfe_mode) {
-		case VFE_OUTPUTS_PREVIEW:
-		case VFE_OUTPUTS_PREVIEW_AND_VIDEO:
-			if (share_ctrl->comp_output_mode &
-				VFE32_OUTPUT_MODE_PRIMARY) {
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[share_ctrl->
-					outpath.out0.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[share_ctrl->
-					outpath.out0.ch1]);
-			} else if (share_ctrl->comp_output_mode &
-					VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[share_ctrl->
-					outpath.out0.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[share_ctrl->
-					outpath.out0.ch1]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[share_ctrl->
-					outpath.out0.ch2]);
-			}
-			break;
-		default:
-			if (share_ctrl->comp_output_mode &
-				VFE32_OUTPUT_MODE_SECONDARY) {
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[share_ctrl->
-					outpath.out1.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[share_ctrl->
-					outpath.out1.ch1]);
-			} else if (share_ctrl->comp_output_mode &
-				VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[share_ctrl->
-					outpath.out1.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[share_ctrl->
-					outpath.out1.ch1]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[share_ctrl->
-					outpath.out1.ch2]);
-			}
-			break;
-			}
-		}
-		break;
-	default:
-		if (share_ctrl->comp_output_mode &
-			VFE32_OUTPUT_MODE_PRIMARY) {
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[share_ctrl->
-				outpath.out0.ch0]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[share_ctrl->
-				outpath.out0.ch1]);
-		} else if (share_ctrl->comp_output_mode &
-				VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[share_ctrl->
-				outpath.out0.ch0]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[share_ctrl->
-				outpath.out0.ch1]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[share_ctrl->
-				outpath.out0.ch2]);
-		}
-
-		if (share_ctrl->comp_output_mode &
-			VFE32_OUTPUT_MODE_SECONDARY) {
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[share_ctrl->
-				outpath.out1.ch0]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[share_ctrl->outpath.out1.ch1]);
-		} else if (share_ctrl->comp_output_mode &
-			VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[share_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[share_ctrl->outpath.out1.ch1]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[share_ctrl->outpath.out1.ch2]);
-		}
-		break;
-	}
-
-	msm_camera_io_w_mb(reg_update,
-		share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-void axi_stop_rdi0(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t reg_update = 0x2;
-	msm_camera_io_w(0, share_ctrl->vfebase +
-		vfe32_AXI_WM_CFG[share_ctrl->outpath.out2.ch0]);
-	msm_camera_io_w_mb(reg_update,
-		share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-void axi_stop_rdi1(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t reg_update = 0x4;
-	msm_camera_io_w(0, share_ctrl->vfebase +
-		vfe32_AXI_WM_CFG[share_ctrl->outpath.out3.ch0]);
-	msm_camera_io_w_mb(reg_update,
-		share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-void axi_stop_rdi2(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t reg_update = 0x8; /* bit 3 */
-	msm_camera_io_w(0, share_ctrl->vfebase +
-		vfe32_AXI_WM_CFG[share_ctrl->outpath.out4.ch0]);
-	msm_camera_io_w_mb(reg_update,
-		share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-void axi_stop_process(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t vfe_mode =
-	share_ctrl->current_mode & ~(VFE_OUTPUTS_RDI0|
-		VFE_OUTPUTS_RDI1|VFE_OUTPUTS_RDI2);
-
-	if (share_ctrl->current_mode & VFE_OUTPUTS_RDI0) {
-		axi_stop_rdi0(share_ctrl);
-		axi_disable_wm_irq(share_ctrl,
-			VFE32_OUTPUT_MODE_TERTIARY1);
-		share_ctrl->comp_output_mode &= ~VFE32_OUTPUT_MODE_TERTIARY1;
-		share_ctrl->operation_mode &=
-			~(VFE_OUTPUTS_RDI0);
-	}
-	if (share_ctrl->current_mode & VFE_OUTPUTS_RDI1) {
-		axi_stop_rdi1(share_ctrl);
-		axi_disable_wm_irq(share_ctrl,
-			VFE32_OUTPUT_MODE_TERTIARY2);
-		share_ctrl->comp_output_mode &= ~VFE32_OUTPUT_MODE_TERTIARY2;
-		share_ctrl->operation_mode &=
-			~(VFE_OUTPUTS_RDI1);
-	}
-	if (share_ctrl->current_mode & VFE_OUTPUTS_RDI2) {
-		axi_stop_rdi2(share_ctrl);
-		axi_disable_wm_irq(share_ctrl,
-			VFE32_OUTPUT_MODE_TERTIARY3);
-		share_ctrl->comp_output_mode &= ~VFE32_OUTPUT_MODE_TERTIARY3;
-		share_ctrl->operation_mode &=
-			~(VFE_OUTPUTS_RDI2);
-	}
-	if (vfe_mode) {
-		uint16_t mode = share_ctrl->comp_output_mode &
-			~(VFE32_OUTPUT_MODE_TERTIARY1|
-			VFE32_OUTPUT_MODE_TERTIARY2|
-			  VFE32_OUTPUT_MODE_TERTIARY3);
-		axi_stop_pix(share_ctrl, vfe_mode, share_ctrl->cmd_type);
-		axi_disable_wm_irq(share_ctrl, mode);
-		share_ctrl->comp_output_mode &=
-				(VFE32_OUTPUT_MODE_TERTIARY1|
-				VFE32_OUTPUT_MODE_TERTIARY2|
-				 VFE32_OUTPUT_MODE_TERTIARY3);
-	}
-}
-
-static void vfe32_process_reg_update_irq(
-		struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-	struct vfe_share_ctrl_t *share_ctrl = vfe32_ctrl->share_ctrl;
-	if (atomic_read(
-		&share_ctrl->pix0_update_ack_pending) == 2) {
-		uint32_t vfe_mode =
-				share_ctrl->operation_mode & ~(VFE_OUTPUTS_RDI0|
-					VFE_OUTPUTS_RDI1|VFE_OUTPUTS_RDI2);
-
-		if (share_ctrl->dual_enabled && !share_ctrl->update_counter) {
-			axi_stop_pix(share_ctrl, vfe_mode,
-				share_ctrl->cmd_type);
-			share_ctrl->update_counter++;
-		} else {
-			uint16_t output_mode =
-				share_ctrl->comp_output_mode &
-				~(VFE32_OUTPUT_MODE_TERTIARY1|
-				VFE32_OUTPUT_MODE_TERTIARY2|
-				  VFE32_OUTPUT_MODE_TERTIARY3);
-			share_ctrl->update_counter = 0;
-			if (!share_ctrl->dual_enabled)
-				axi_stop_pix(share_ctrl, vfe_mode,
-					share_ctrl->cmd_type);
-			axi_disable_wm_irq(share_ctrl, output_mode);
-			axi_disable_irq(share_ctrl, vfe_mode);
-			atomic_set(&share_ctrl->pix0_update_ack_pending, 0);
-			msm_camera_io_w_mb(
-					CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-					share_ctrl->vfebase +
-					VFE_CAMIF_COMMAND);
-			vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-				share_ctrl->vfeFrameId,
-				MSG_ID_PIX0_UPDATE_ACK);
-			share_ctrl->comp_output_mode &=
-				(VFE32_OUTPUT_MODE_TERTIARY1|
-				VFE32_OUTPUT_MODE_TERTIARY2|
-				 VFE32_OUTPUT_MODE_TERTIARY3);
-		}
-	}  else {
-		if (share_ctrl->recording_state == VFE_STATE_START_REQUESTED) {
-			if (share_ctrl->operation_mode &
-					VFE_OUTPUTS_VIDEO_AND_PREVIEW) {
-				msm_camera_io_w((
-					0x1 << share_ctrl->outpath.out0.ch0 |
-					0x1 << share_ctrl->outpath.out0.ch1),
-					share_ctrl->vfebase + VFE_BUS_CMD);
-				msm_camera_io_w(1,
-					share_ctrl->vfebase + vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(1,
-					share_ctrl->vfebase + vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out0.ch1]);
-			} else if (share_ctrl->operation_mode &
-					VFE_OUTPUTS_PREVIEW_AND_VIDEO) {
-				msm_camera_io_w((
-					0x1 << share_ctrl->outpath.out1.ch0 |
-					0x1 << share_ctrl->outpath.out1.ch1),
-					share_ctrl->vfebase + VFE_BUS_CMD);
-				msm_camera_io_w(1,
-					share_ctrl->vfebase + vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out1.ch0]);
-				msm_camera_io_w(1,
-					share_ctrl->vfebase + vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out1.ch1]);
-			}
-			share_ctrl->recording_state = VFE_STATE_STARTED;
-			msm_camera_io_w_mb(1,
-				share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-			CDBG("start video triggered .\n");
-		} else if (share_ctrl->recording_state ==
-					VFE_STATE_STOP_REQUESTED) {
-			if (share_ctrl->operation_mode &
-					VFE_OUTPUTS_VIDEO_AND_PREVIEW) {
-				msm_camera_io_w(0,
-					share_ctrl->vfebase + vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(0,
-					share_ctrl->vfebase + vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out0.ch1]);
-			} else if (share_ctrl->operation_mode &
-					VFE_OUTPUTS_PREVIEW_AND_VIDEO) {
-				msm_camera_io_w(0,
-					share_ctrl->vfebase + vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out1.ch0]);
-				msm_camera_io_w(0,
-					share_ctrl->vfebase + vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out1.ch1]);
-			}
-			CDBG("stop video triggered .\n");
-		}
-
-		if (atomic_cmpxchg(
-		&share_ctrl->pix0_update_ack_pending, 1, 0) == 1) {
-			share_ctrl->comp_output_mode |=
-				(share_ctrl->outpath.output_mode
-				& ~(VFE32_OUTPUT_MODE_TERTIARY1|
-					VFE32_OUTPUT_MODE_TERTIARY2|
-					VFE32_OUTPUT_MODE_TERTIARY3));
-			vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-				share_ctrl->vfeFrameId, MSG_ID_PIX0_UPDATE_ACK);
-		} else {
-			if (share_ctrl->recording_state ==
-						VFE_STATE_STOP_REQUESTED) {
-				share_ctrl->recording_state = VFE_STATE_STOPPED;
-				/* request a reg update and send STOP_REC_ACK
-				 * when we process the next reg update irq.
-				 */
-				msm_camera_io_w_mb(1, share_ctrl->vfebase +
-							VFE_REG_UPDATE_CMD);
-			} else if (share_ctrl->recording_state ==
-						VFE_STATE_STOPPED) {
-				vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-					share_ctrl->vfeFrameId,
-					MSG_ID_STOP_REC_ACK);
-				share_ctrl->recording_state = VFE_STATE_IDLE;
-			}
-			spin_lock_irqsave(
-				&share_ctrl->update_ack_lock,
-				flags);
-			if (share_ctrl->update_ack_pending == TRUE) {
-				share_ctrl->update_ack_pending = FALSE;
-				spin_unlock_irqrestore(
-					&share_ctrl->update_ack_lock, flags);
-				vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-					share_ctrl->vfeFrameId,
-					MSG_ID_UPDATE_ACK);
-			} else {
-				spin_unlock_irqrestore(
-					&share_ctrl->update_ack_lock, flags);
-			}
-		}
-
-		switch (share_ctrl->liveshot_state) {
-		case VFE_STATE_START_REQUESTED:
-			CDBG("%s enabling liveshot output\n", __func__);
-			if (share_ctrl->comp_output_mode &
-						VFE32_OUTPUT_MODE_PRIMARY) {
-				msm_camera_io_w((
-					0x1 << share_ctrl->outpath.out0.ch0 |
-					0x1 << share_ctrl->outpath.out0.ch1),
-					share_ctrl->vfebase + VFE_BUS_CMD);
-				msm_camera_io_w(1, share_ctrl->vfebase +
-					vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(1, share_ctrl->vfebase +
-					vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out0.ch1]);
-
-				share_ctrl->liveshot_state =
-					VFE_STATE_STARTED;
-				msm_camera_io_w_mb(1, share_ctrl->vfebase +
-					VFE_REG_UPDATE_CMD);
-			}
-			break;
-		case VFE_STATE_STARTED:
-			share_ctrl->vfe_capture_count--;
-			if (!share_ctrl->vfe_capture_count &&
-				(share_ctrl->comp_output_mode &
-					VFE32_OUTPUT_MODE_PRIMARY)) {
-				msm_camera_io_w(0, share_ctrl->vfebase +
-					vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase +
-					vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out0.ch1]);
-				share_ctrl->liveshot_state = VFE_STATE_HW_STOP_REQUESTED;
-				msm_camera_io_w_mb(1, share_ctrl->vfebase +
-					VFE_REG_UPDATE_CMD);
-			}
-			break;
-		case VFE_STATE_HW_STOP_REQUESTED:
-			share_ctrl->liveshot_state = VFE_STATE_HW_STOPPED;
-			vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-				share_ctrl->vfeFrameId, MSG_ID_STOP_LS_ACK);
-			break;
-		case VFE_STATE_STOP_REQUESTED:
-			if (share_ctrl->comp_output_mode &
-					VFE32_OUTPUT_MODE_PRIMARY) {
-				/* Stop requested, stop write masters, and
-				 * trigger REG_UPDATE. Send STOP_LS_ACK in
-				 * next reg update. */
-				msm_camera_io_w(0, share_ctrl->vfebase +
-					vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase +
-					vfe32_AXI_WM_CFG[
-					share_ctrl->outpath.out0.ch1]);
-
-				share_ctrl->liveshot_state = VFE_STATE_STOPPED;
-				msm_camera_io_w_mb(1, share_ctrl->vfebase +
-					VFE_REG_UPDATE_CMD);
-			}
-			break;
-		case VFE_STATE_STOPPED:
-			CDBG("%s Sending STOP_LS ACK\n", __func__);
-			vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-				share_ctrl->vfeFrameId, MSG_ID_STOP_LS_ACK);
-			share_ctrl->liveshot_state = VFE_STATE_IDLE;
-			break;
-		default:
-			break;
-		}
-
-		if ((share_ctrl->operation_mode & VFE_OUTPUTS_THUMB_AND_MAIN) ||
-			(share_ctrl->operation_mode &
-				VFE_OUTPUTS_MAIN_AND_THUMB) ||
-			(share_ctrl->operation_mode &
-				VFE_OUTPUTS_THUMB_AND_JPEG) ||
-			(share_ctrl->operation_mode &
-				VFE_OUTPUTS_JPEG_AND_THUMB)) {
-			/* in snapshot mode */
-			/* later we need to add check for live snapshot mode. */
-			if (vfe32_ctrl->frame_skip_pattern & (0x1 <<
-				(vfe32_ctrl->snapshot_frame_cnt %
-					vfe32_ctrl->frame_skip_cnt))) {
-				share_ctrl->vfe_capture_count--;
-				/* if last frame to be captured: */
-				if (share_ctrl->vfe_capture_count == 0) {
-					/* stop the bus output: */
-					uint32_t vfe_mode =
-						share_ctrl->operation_mode &
-							~(VFE_OUTPUTS_RDI0|
-							VFE_OUTPUTS_RDI1|
-							VFE_OUTPUTS_RDI2);
-					axi_stop_pix(share_ctrl, vfe_mode,
-						AXI_CMD_CAPTURE);
-					msm_camera_io_w_mb
-					(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-					share_ctrl->vfebase +
-					VFE_CAMIF_COMMAND);
-					vfe32_ctrl->snapshot_frame_cnt = -1;
-					vfe32_ctrl->frame_skip_cnt = 31;
-					vfe32_ctrl->frame_skip_pattern =
-								0xffffffff;
-				} /*if snapshot count is 0*/
-			} /*if frame is not being dropped*/
-			vfe32_ctrl->snapshot_frame_cnt++;
-			/* then do reg_update. */
-			msm_camera_io_w(1,
-				share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-		} /* if snapshot mode. */
-	}
-}
-
-static void vfe32_process_rdi0_reg_update_irq(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	if (atomic_cmpxchg(
-		&vfe32_ctrl->share_ctrl->rdi0_update_ack_pending, 1, 0) == 1) {
-		vfe32_ctrl->share_ctrl->comp_output_mode |=
-			VFE32_OUTPUT_MODE_TERTIARY1;
-		vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-			vfe32_ctrl->share_ctrl->rdi0FrameId,
-			MSG_ID_RDI0_UPDATE_ACK);
-	}
-
-	if ((atomic_read(
-		&vfe32_ctrl->share_ctrl->rdi0_update_ack_pending) == 2)
-		|| (vfe32_ctrl->share_ctrl->rdi0_capture_count == 0)) {
-		axi_disable_wm_irq(vfe32_ctrl->share_ctrl,
-			VFE32_OUTPUT_MODE_TERTIARY1);
-		axi_disable_irq(vfe32_ctrl->share_ctrl, VFE_OUTPUTS_RDI0);
-		atomic_set(&vfe32_ctrl->share_ctrl->rdi0_update_ack_pending, 0);
-		vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-			vfe32_ctrl->share_ctrl->rdi0FrameId,
-			MSG_ID_RDI0_UPDATE_ACK);
-
-		if (vfe32_ctrl->share_ctrl->rdi0_capture_count == 0)
-			vfe32_ctrl->share_ctrl->rdi0_capture_count = -1;
-		if (vfe32_ctrl->share_ctrl->outpath.out2.capture_cnt
-			== 0)
-			vfe32_ctrl->share_ctrl->outpath.out2.capture_cnt = -1;
-		vfe32_ctrl->share_ctrl->comp_output_mode &=
-			~VFE32_OUTPUT_MODE_TERTIARY1;
-		vfe32_ctrl->share_ctrl->operation_mode &=
-			~(VFE_OUTPUTS_RDI0);
-	}
-
-	if (vfe32_ctrl->share_ctrl->rdi0_capture_count > 0) {
-		vfe32_ctrl->share_ctrl->rdi0_capture_count--;
-		if (!vfe32_ctrl->share_ctrl->rdi0_capture_count)
-			axi_stop_rdi0(vfe32_ctrl->share_ctrl);
-	}
-}
-
-static void vfe32_process_rdi1_reg_update_irq(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-
-	if (atomic_cmpxchg(
-		&vfe32_ctrl->share_ctrl->rdi1_update_ack_pending, 1, 0)
-				== 1) {
-		vfe32_ctrl->share_ctrl->comp_output_mode |=
-			VFE32_OUTPUT_MODE_TERTIARY2;
-		vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-			vfe32_ctrl->share_ctrl->rdi1FrameId,
-			MSG_ID_RDI1_UPDATE_ACK);
-	}
-
-	if ((atomic_read(
-		&vfe32_ctrl->share_ctrl->rdi1_update_ack_pending) == 2)
-		|| (vfe32_ctrl->share_ctrl->rdi1_capture_count == 0)) {
-		axi_disable_wm_irq(vfe32_ctrl->share_ctrl,
-			VFE32_OUTPUT_MODE_TERTIARY2);
-		axi_disable_irq(vfe32_ctrl->share_ctrl, VFE_OUTPUTS_RDI1);
-		atomic_set(&vfe32_ctrl->share_ctrl->rdi1_update_ack_pending, 0);
-		vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-			vfe32_ctrl->share_ctrl->rdi1FrameId,
-			MSG_ID_RDI1_UPDATE_ACK);
-
-		if (vfe32_ctrl->share_ctrl->rdi1_capture_count == 0)
-			vfe32_ctrl->share_ctrl->rdi1_capture_count = -1;
-		if (vfe32_ctrl->share_ctrl->outpath.out3.capture_cnt
-			== 0)
-			vfe32_ctrl->share_ctrl->outpath.out3.capture_cnt = -1;
-		vfe32_ctrl->share_ctrl->comp_output_mode &=
-			~VFE32_OUTPUT_MODE_TERTIARY2;
-		vfe32_ctrl->share_ctrl->operation_mode &=
-			~(VFE_OUTPUTS_RDI1);
-	}
-
-	if (vfe32_ctrl->share_ctrl->rdi1_capture_count > 0) {
-		vfe32_ctrl->share_ctrl->rdi1_capture_count--;
-		if (!vfe32_ctrl->share_ctrl->rdi1_capture_count)
-			axi_stop_rdi1(vfe32_ctrl->share_ctrl);
-	}
-}
-
-static void vfe32_process_rdi2_reg_update_irq(
-	struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	pr_err("%s: RDI2\n", __func__);
-	if (atomic_cmpxchg(
-		&vfe32_ctrl->share_ctrl->rdi2_update_ack_pending, 1, 0)
-				== 1) {
-		vfe32_ctrl->share_ctrl->comp_output_mode |=
-			VFE32_OUTPUT_MODE_TERTIARY3;
-		vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-			vfe32_ctrl->share_ctrl->rdi2FrameId,
-			MSG_ID_RDI2_UPDATE_ACK);
-	}
-
-	if ((atomic_read(
-		&vfe32_ctrl->share_ctrl->rdi2_update_ack_pending) == 2)
-		|| (vfe32_ctrl->share_ctrl->rdi2_capture_count == 0)) {
-		axi_disable_wm_irq(vfe32_ctrl->share_ctrl,
-			VFE32_OUTPUT_MODE_TERTIARY3);
-		axi_disable_irq(vfe32_ctrl->share_ctrl, VFE_OUTPUTS_RDI2);
-		atomic_set(&vfe32_ctrl->share_ctrl->rdi2_update_ack_pending, 0);
-		vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-			vfe32_ctrl->share_ctrl->rdi2FrameId,
-			MSG_ID_RDI2_UPDATE_ACK);
-
-		if (vfe32_ctrl->share_ctrl->rdi2_capture_count == 0)
-			vfe32_ctrl->share_ctrl->rdi2_capture_count = -1;
-		if (vfe32_ctrl->share_ctrl->outpath.out4.capture_cnt
-			== 0)
-			vfe32_ctrl->share_ctrl->outpath.out4.capture_cnt = -1;
-		vfe32_ctrl->share_ctrl->comp_output_mode &=
-			~VFE32_OUTPUT_MODE_TERTIARY3;
-		vfe32_ctrl->share_ctrl->operation_mode &=
-			~(VFE_OUTPUTS_RDI2);
-	}
-
-	if (vfe32_ctrl->share_ctrl->rdi2_capture_count > 0) {
-		vfe32_ctrl->share_ctrl->rdi2_capture_count--;
-		if (!vfe32_ctrl->share_ctrl->rdi2_capture_count)
-			axi_stop_rdi2(vfe32_ctrl->share_ctrl);
-	}
-}
-
-static void vfe32_process_reset_irq(
-		struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-
-	if (atomic_read(&recovery_active) == 1) {
-		pr_info("Recovery restart start\n");
-		if (atomic_read(&fault_recovery) == 1) {
-			atomic_set(&recovery_active, 0);
-			pr_err("potential page fault occured, stop recovery & send app notification");
-			v4l2_subdev_notify(&vfe32_ctrl->subdev, NOTIFY_VFE_CAMIF_ERROR,
-					(void *)NULL);
-			vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-					vfe32_ctrl->share_ctrl->vfeFrameId, MSG_ID_CAMIF_ERROR);
-			return;
-		}
-
-		msm_camera_io_w(VFE_RELOAD_ALL_WRITE_MASTERS,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-		msm_camera_io_w(recover_irq_mask0,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_0);
-		msm_camera_io_w(recover_irq_mask1,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-		if ((vfe32_ctrl->share_ctrl->liveshot_state ==
-				VFE_STATE_START_REQUESTED) ||
-			(vfe32_ctrl->share_ctrl->liveshot_state ==
-				VFE_STATE_STARTED) ||
-			(vfe32_ctrl->share_ctrl->liveshot_state ==
-				VFE_STATE_HW_STOP_REQUESTED)) {
-			pr_info("Liveshot recovery\n");
-			vfe32_ctrl->share_ctrl->outpath.out0.capture_cnt = 1;
-			vfe32_ctrl->share_ctrl->vfe_capture_count =
-			vfe32_ctrl->share_ctrl->outpath.out0.capture_cnt;
-			vfe32_ctrl->share_ctrl->liveshot_state =
-				VFE_STATE_START_REQUESTED;
-		}
-		msm_camera_io_w_mb(1,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-		pr_info("camif cfg: 0x%x\n",
-			msm_camera_io_r(
-			vfe32_ctrl->share_ctrl->vfebase + VFE_CAMIF_FRAME_CFG));
-		/* Clear CAMIF Status */
-		msm_camera_io_w_mb(0x4,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_CAMIF_COMMAND);
-		/* Enable CAMIF capture */
-		msm_camera_io_w_mb(0x1,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_CAMIF_COMMAND);
-		atomic_set(&recovery_active, 0);
-		pr_info("Recovery restart done\n");
-		return;
-	}
-
-	atomic_set(&vfe32_ctrl->share_ctrl->vstate, 0);
-	atomic_set(&vfe32_ctrl->share_ctrl->handle_common_irq, 0);
-
-	spin_lock_irqsave(&vfe32_ctrl->share_ctrl->stop_flag_lock, flags);
-	if (vfe32_ctrl->share_ctrl->stop_ack_pending) {
-		vfe32_ctrl->share_ctrl->stop_ack_pending = FALSE;
-		spin_unlock_irqrestore(
-			&vfe32_ctrl->share_ctrl->stop_flag_lock, flags);
-		if (vfe32_ctrl->share_ctrl->sync_abort)
-			complete(&vfe32_ctrl->share_ctrl->reset_complete);
-		else
-			vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-				vfe32_ctrl->share_ctrl->vfeFrameId,
-				MSG_ID_STOP_ACK);
-	} else {
-		spin_unlock_irqrestore(
-			&vfe32_ctrl->share_ctrl->stop_flag_lock, flags);
-		/* this is from reset command. */
-		vfe32_reset_internal_variables(vfe32_ctrl);
-		if (vfe32_ctrl->share_ctrl->vfe_reset_flag) {
-			vfe32_ctrl->share_ctrl->vfe_reset_flag = false;
-			msm_camera_io_w(0x7F80,
-				vfe32_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-		} else {
-			/* reload all write masters. (frame & line)*/
-			msm_camera_io_w(0x7FFF,
-				vfe32_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-		}
-		complete(&vfe32_ctrl->share_ctrl->reset_complete);
-	}
-}
-
-static void vfe32_process_camif_sof_irq(
-		struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	if (vfe32_ctrl->share_ctrl->operation_mode ==
-		VFE_OUTPUTS_RAW) {
-		if (atomic_cmpxchg(
-			&vfe32_ctrl->share_ctrl->pix0_update_ack_pending,
-					1, 0) == 1) {
-			vfe32_ctrl->share_ctrl->comp_output_mode |=
-				(vfe32_ctrl->share_ctrl->outpath.output_mode
-				& ~(VFE32_OUTPUT_MODE_TERTIARY1|
-				VFE32_OUTPUT_MODE_TERTIARY2|
-				VFE32_OUTPUT_MODE_TERTIARY3));
-			vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-				vfe32_ctrl->share_ctrl->vfeFrameId,
-				MSG_ID_PIX0_UPDATE_ACK);
-		}
-
-		vfe32_ctrl->share_ctrl->vfe_capture_count--;
-		/* if last frame to be captured: */
-		if (vfe32_ctrl->share_ctrl->vfe_capture_count == 0) {
-			/* Ensure the write order while writing
-			 to the command register using the barrier */
-			msm_camera_io_w_mb(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-			vfe32_ctrl->share_ctrl->vfebase + VFE_CAMIF_COMMAND);
-		}
-	} /* if raw snapshot mode. */
-	if ((vfe32_ctrl->hfr_mode != HFR_MODE_OFF) &&
-		(vfe32_ctrl->share_ctrl->operation_mode ==
-			VFE_MODE_OF_OPERATION_VIDEO) &&
-		(vfe32_ctrl->share_ctrl->vfeFrameId %
-			vfe32_ctrl->hfr_mode != 0)) {
-		if (vfe32_ctrl->vfe_sof_count_enable)
-			vfe32_ctrl->share_ctrl->vfeFrameId++;
-		CDBG("Skip the SOF notification when HFR enabled\n");
-		return;
-	}
-	if (vfe32_ctrl->vfe_sof_count_enable)
-		vfe32_ctrl->share_ctrl->vfeFrameId++;
-
-	vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-		vfe32_ctrl->share_ctrl->vfeFrameId, MSG_ID_SOF_ACK);
-	CDBG("camif_sof_irq, frameId = %d\n",
-		vfe32_ctrl->share_ctrl->vfeFrameId);
-
-	if (vfe32_ctrl->sync_timer_state) {
-		if (vfe32_ctrl->sync_timer_repeat_count == 0)
-			vfe32_sync_timer_stop(vfe32_ctrl);
-		else
-			vfe32_ctrl->sync_timer_repeat_count--;
-	}
-}
-
-static void vfe32_process_error_irq(
-	struct axi_ctrl_t *axi_ctrl, uint32_t errStatus)
-{
-	uint32_t reg_value;
-	if (errStatus & VFE32_IMASK_VIOLATION) {
-		pr_err("vfe32_irq: violation interrupt\n");
-		reg_value = msm_camera_io_r(
-			axi_ctrl->share_ctrl->vfebase + VFE_VIOLATION_STATUS);
-		pr_err("%s: violationStatus  = 0x%x\n", __func__, reg_value);
-	}
-
-	if (errStatus & VFE32_IMASK_CAMIF_ERROR) {
-		pr_err("vfe32_irq: camif errors\n");
-		reg_value = msm_camera_io_r(
-			axi_ctrl->share_ctrl->vfebase + VFE_CAMIF_STATUS);
-		if (reg_value & ~0x80000000) {
-#if 0 ////Erased for bus overflow recovery patch, automatically recover.
-			v4l2_subdev_notify(&axi_ctrl->subdev,
-				NOTIFY_VFE_CAMIF_ERROR, (void *)NULL);
-			pr_err("camifStatus  = 0x%x\n", reg_value);
-			vfe32_send_isp_msg(&axi_ctrl->subdev,
-			axi_ctrl->share_ctrl->vfeFrameId, MSG_ID_CAMIF_ERROR);
-#endif
-		}
-	}
-
-	if (errStatus & VFE32_IMASK_BHIST_OVWR)
-		pr_err("vfe32_irq: stats bhist overwrite\n");
-
-	if (errStatus & VFE32_IMASK_STATS_CS_OVWR)
-		pr_err("vfe32_irq: stats cs overwrite\n");
-
-	if (errStatus & VFE32_IMASK_STATS_IHIST_OVWR)
-		pr_err("vfe32_irq: stats ihist overwrite\n");
-
-	if (errStatus & VFE32_IMASK_REALIGN_BUF_Y_OVFL)
-		pr_err("vfe32_irq: realign bug Y overflow\n");
-
-	if (errStatus & VFE32_IMASK_REALIGN_BUF_CB_OVFL)
-		pr_err("vfe32_irq: realign bug CB overflow\n");
-
-	if (errStatus & VFE32_IMASK_REALIGN_BUF_CR_OVFL)
-		pr_err("vfe32_irq: realign bug CR overflow\n");
-
-	if (errStatus & VFE32_IMASK_STATS_AE_BG_BUS_OVFL)
-		pr_err("vfe32_irq: ae/bg stats bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_STATS_AF_BF_BUS_OVFL)
-		pr_err("vfe32_irq: af/bf stats bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_STATS_AWB_BUS_OVFL)
-		pr_err("vfe32_irq: awb stats bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_STATS_RS_BUS_OVFL)
-		pr_err("vfe32_irq: rs stats bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_STATS_CS_BUS_OVFL)
-		pr_err("vfe32_irq: cs stats bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_STATS_IHIST_BUS_OVFL)
-		pr_err("vfe32_irq: ihist stats bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_STATS_SKIN_BHIST_BUS_OVFL)
-		pr_err("vfe32_irq: skin/bhist stats bus overflow\n");
-}
-
-static void vfe32_process_common_error_irq(
-	struct axi_ctrl_t *axi_ctrl, uint32_t errStatus)
-{
-
-	if (errStatus & VFE32_IMASK_IMG_MAST_0_BUS_OVFL)
-		pr_err("vfe32_irq: image master 0 bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_IMG_MAST_1_BUS_OVFL)
-		pr_err("vfe32_irq: image master 1 bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_IMG_MAST_2_BUS_OVFL)
-		pr_err("vfe32_irq: image master 2 bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_IMG_MAST_3_BUS_OVFL)
-		pr_err("vfe32_irq: image master 3 bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_IMG_MAST_4_BUS_OVFL)
-		pr_err("vfe32_irq: image master 4 bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_IMG_MAST_5_BUS_OVFL)
-		pr_err("vfe32_irq: image master 5 bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_IMG_MAST_6_BUS_OVFL)
-		pr_err("vfe32_irq: image master 6 bus overflow\n");
-
-	if (errStatus & VFE32_IMASK_AXI_ERROR)
-		pr_err("vfe32_irq: axi error\n");
-}
-
-
-static void vfe_send_outmsg(
-	struct axi_ctrl_t *axi_ctrl, uint8_t msgid,
-	uint32_t ch0_paddr, uint32_t ch1_paddr,
-	uint32_t ch2_paddr, uint32_t inst_handle)
-{
-	struct isp_msg_output msg;
-
-	msg.output_id = msgid;
-	msg.buf.inst_handle = inst_handle;
-	msg.buf.ch_paddr[0]	= ch0_paddr;
-	msg.buf.ch_paddr[1]	= ch1_paddr;
-	msg.buf.ch_paddr[2]	= ch2_paddr;
-	switch (msgid) {
-	case MSG_ID_OUTPUT_TERTIARY1:
-		msg.frameCounter = axi_ctrl->share_ctrl->rdi0FrameId;
-		break;
-	case MSG_ID_OUTPUT_TERTIARY2:
-		msg.frameCounter = axi_ctrl->share_ctrl->rdi1FrameId;
-		break;
-	case MSG_ID_OUTPUT_TERTIARY3:
-		msg.frameCounter = axi_ctrl->share_ctrl->rdi2FrameId;
-		break;
-	default:
-		msg.frameCounter = axi_ctrl->share_ctrl->vfeFrameId;
-		break;
-	}
-
-	if (axi_ctrl->simultaneous_sof_frame) {
-		msg.frameCounter--;
-		CDBG("SOF and Frame IRQs together, adjusting frame counter");
-	}
-
-	v4l2_subdev_notify(&axi_ctrl->subdev,
-			NOTIFY_VFE_MSG_OUT,
-			&msg);
-	return;
-}
-
-static void vfe32_process_output_path_irq_0(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr, ch1_paddr, ch2_paddr;
-	uint8_t out_bool = 0;
-	struct msm_free_buf *free_buf = NULL;
-	free_buf = vfe32_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-		VFE_MSG_OUTPUT_PRIMARY, axi_ctrl);
-
-	/* we render frames in the following conditions:
-	1. Continuous mode and the free buffer is avaialable.
-	2. In snapshot shot mode, free buffer is not always available.
-	when pending snapshot count is <=1,  then no need to use
-	free buffer.
-	*/
-	out_bool = (
-		(axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_THUMB_AND_MAIN ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_MAIN_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_THUMB_AND_JPEG ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_JPEG_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_RAW ||
-		axi_ctrl->share_ctrl->liveshot_state ==
-			VFE_STATE_STARTED ||
-		axi_ctrl->share_ctrl->liveshot_state ==
-			VFE_STATE_HW_STOP_REQUESTED ||
-		axi_ctrl->share_ctrl->liveshot_state ==
-			VFE_STATE_HW_STOPPED ||
-		axi_ctrl->share_ctrl->liveshot_state ==
-			VFE_STATE_STOP_REQUESTED ||
-		axi_ctrl->share_ctrl->liveshot_state ==
-			VFE_STATE_STOPPED) &&
-		(axi_ctrl->share_ctrl->vfe_capture_count <= 1)) ||
-			free_buf;
-
-	if (out_bool) {
-		ping_pong = msm_camera_io_r(axi_ctrl->share_ctrl->vfebase +
-			VFE_BUS_PING_PONG_STATUS);
-
-		/* Channel 0*/
-		ch0_paddr = vfe32_get_ch_addr(
-			ping_pong, axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch0);
-		/* Channel 1*/
-		ch1_paddr = vfe32_get_ch_addr(
-			ping_pong, axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch1);
-		/* Channel 2*/
-		ch2_paddr = vfe32_get_ch_addr(
-			ping_pong, axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch2);
-
-		CDBG("output path 0, ch0 = 0x%x, ch1 = 0x%x, ch2 = 0x%x\n",
-			ch0_paddr, ch1_paddr, ch2_paddr);
-		if (free_buf) {
-			/* Y channel */
-			vfe32_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch0,
-			free_buf->ch_paddr[0]);
-			/* Chroma channel */
-			vfe32_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch1,
-			free_buf->ch_paddr[1]);
-			if (free_buf->num_planes > 2)
-				vfe32_put_ch_addr(ping_pong,
-					axi_ctrl->share_ctrl->vfebase,
-					axi_ctrl->share_ctrl->outpath.out0.ch2,
-					free_buf->ch_paddr[2]);
-		}
-		if (axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_THUMB_AND_JPEG ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_JPEG_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_RAW ||
-			axi_ctrl->share_ctrl->liveshot_state ==
-				VFE_STATE_STOPPED)
-			axi_ctrl->share_ctrl->outpath.out0.capture_cnt--;
-
-		vfe_send_outmsg(axi_ctrl,
-			MSG_ID_OUTPUT_PRIMARY, ch0_paddr,
-			ch1_paddr, ch2_paddr,
-			axi_ctrl->share_ctrl->outpath.out0.inst_handle);
-
-	} else {
-		axi_ctrl->share_ctrl->outpath.out0.frame_drop_cnt++;
-		CDBG("path_irq_0 - no free buffer!\n");
-	}
-}
-
-static void vfe32_process_output_path_irq_1(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr, ch1_paddr, ch2_paddr;
-	/* this must be snapshot main image output. */
-	uint8_t out_bool = 0;
-	struct msm_free_buf *free_buf = NULL;
-
-	free_buf = vfe32_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-		VFE_MSG_OUTPUT_SECONDARY, axi_ctrl);
-	out_bool = ((axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_RAW ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_JPEG_AND_THUMB) &&
-			(axi_ctrl->share_ctrl->vfe_capture_count <= 1)) ||
-				free_buf;
-
-	if (out_bool) {
-		ping_pong = msm_camera_io_r(axi_ctrl->share_ctrl->vfebase +
-			VFE_BUS_PING_PONG_STATUS);
-
-		/* Y channel */
-		ch0_paddr = vfe32_get_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch0);
-		/* Chroma channel */
-		ch1_paddr = vfe32_get_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch1);
-		ch2_paddr = vfe32_get_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch2);
-
-		CDBG("%s ch0 = 0x%x, ch1 = 0x%x, ch2 = 0x%x\n",
-			__func__, ch0_paddr, ch1_paddr, ch2_paddr);
-		if (free_buf) {
-			/* Y channel */
-			vfe32_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch0,
-			free_buf->ch_paddr[0]);
-			/* Chroma channel */
-			vfe32_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch1,
-			free_buf->ch_paddr[1]);
-			if (free_buf->num_planes > 2)
-				vfe32_put_ch_addr(ping_pong,
-					axi_ctrl->share_ctrl->vfebase,
-					axi_ctrl->share_ctrl->outpath.out1.ch2,
-					free_buf->ch_paddr[2]);
-		}
-		if (axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_RAW ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_JPEG_AND_THUMB)
-			axi_ctrl->share_ctrl->outpath.out1.capture_cnt--;
-
-		vfe_send_outmsg(axi_ctrl,
-			MSG_ID_OUTPUT_SECONDARY, ch0_paddr,
-			ch1_paddr, ch2_paddr,
-			axi_ctrl->share_ctrl->outpath.out1.inst_handle);
-
-	} else {
-		axi_ctrl->share_ctrl->outpath.out1.frame_drop_cnt++;
-		CDBG("path_irq_1 - no free buffer!\n");
-	}
-}
-
-static void vfe32_process_output_path_irq_rdi0(
-			struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr = 0;
-	/* this must be rdi image output. */
-	struct msm_free_buf *free_buf = NULL;
-	/*RDI0*/
-	CDBG("rdi0 out irq\n");
-	if (axi_ctrl->share_ctrl->operation_mode & VFE_OUTPUTS_RDI0) {
-		free_buf = vfe32_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-			VFE_MSG_OUTPUT_TERTIARY1, axi_ctrl);
-		if (axi_ctrl->share_ctrl->outpath.out2.capture_cnt > 0 ||
-							free_buf) {
-			ping_pong = msm_camera_io_r(axi_ctrl->
-				share_ctrl->vfebase +
-				VFE_BUS_PING_PONG_STATUS);
-
-			/* Y only channel */
-			ch0_paddr = vfe32_get_ch_addr(ping_pong,
-				axi_ctrl->share_ctrl->vfebase,
-				axi_ctrl->share_ctrl->outpath.out2.ch0);
-
-			pr_debug("%s ch0 = 0x%x\n",
-				__func__, ch0_paddr);
-
-			if (free_buf)
-				vfe32_put_ch_addr(ping_pong,
-					axi_ctrl->share_ctrl->vfebase,
-					axi_ctrl->share_ctrl->outpath.out2.ch0,
-					free_buf->ch_paddr[0]);
-			if (axi_ctrl->share_ctrl->outpath.out2.capture_cnt == 1)
-				axi_ctrl->share_ctrl->
-					outpath.out2.capture_cnt = 0;
-
-			vfe_send_outmsg(axi_ctrl,
-				MSG_ID_OUTPUT_TERTIARY1, ch0_paddr,
-				0, 0,
-				axi_ctrl->share_ctrl->outpath.out2.inst_handle);
-
-		} else {
-			axi_ctrl->share_ctrl->outpath.out2.frame_drop_cnt++;
-			pr_err("path_irq_2 irq - no free buffer for rdi0!\n");
-		}
-	}
-}
-
-static void vfe32_process_output_path_irq_rdi1(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr = 0;
-	/* this must be rdi image output. */
-	struct msm_free_buf *free_buf = NULL;
-	/*RDI1*/
-	if (axi_ctrl->share_ctrl->operation_mode & VFE_OUTPUTS_RDI1) {
-		free_buf = vfe32_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-			VFE_MSG_OUTPUT_TERTIARY2, axi_ctrl);
-		if (axi_ctrl->share_ctrl->outpath.out3.capture_cnt > 0 ||
-							free_buf) {
-			ping_pong = msm_camera_io_r(axi_ctrl->
-				share_ctrl->vfebase +
-				VFE_BUS_PING_PONG_STATUS);
-
-			/* Y channel */
-			ch0_paddr = vfe32_get_ch_addr(ping_pong,
-				axi_ctrl->share_ctrl->vfebase,
-				axi_ctrl->share_ctrl->outpath.out3.ch0);
-			pr_debug("%s ch0 = 0x%x\n",
-				__func__, ch0_paddr);
-
-			if (free_buf)
-				vfe32_put_ch_addr(ping_pong,
-					axi_ctrl->share_ctrl->vfebase,
-					axi_ctrl->share_ctrl->outpath.out3.ch0,
-					free_buf->ch_paddr[0]);
-			if (axi_ctrl->share_ctrl->
-					outpath.out3.capture_cnt == 1)
-				axi_ctrl->share_ctrl->
-				outpath.out3.capture_cnt = 0;
-
-			vfe_send_outmsg(axi_ctrl,
-				MSG_ID_OUTPUT_TERTIARY2, ch0_paddr,
-				0, 0,
-				axi_ctrl->share_ctrl->outpath.out3.inst_handle);
-		} else {
-			axi_ctrl->share_ctrl->outpath.out3.frame_drop_cnt++;
-			pr_err("path_irq irq - no free buffer for rdi1!\n");
-		}
-	}
-}
-
-static void vfe32_process_output_path_irq_rdi2(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr = 0;
-	/* this must be rdi image output. */
-	struct msm_free_buf *free_buf = NULL;
-	/*RDI2*/
-	CDBG("rdi2 out irq\n");
-	if (axi_ctrl->share_ctrl->operation_mode & VFE_OUTPUTS_RDI2) {
-		free_buf = vfe32_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-			VFE_MSG_OUTPUT_TERTIARY3, axi_ctrl);
-		if (free_buf) {
-			ping_pong = msm_camera_io_r(axi_ctrl->
-				share_ctrl->vfebase +
-				VFE_BUS_PING_PONG_STATUS);
-
-			/* Y channel */
-			ch0_paddr = vfe32_get_ch_addr(ping_pong,
-				axi_ctrl->share_ctrl->vfebase,
-				axi_ctrl->share_ctrl->outpath.out4.ch0);
-			CDBG("%s ch0 = 0x%x\n",
-				__func__, free_buf->ch_paddr[0]);
-
-			/* Y channel */
-			vfe32_put_ch_addr(ping_pong,
-				axi_ctrl->share_ctrl->vfebase,
-				axi_ctrl->share_ctrl->outpath.out4.ch0,
-				free_buf->ch_paddr[0]);
-
-			vfe_send_outmsg(axi_ctrl,
-				MSG_ID_OUTPUT_TERTIARY3, ch0_paddr,
-				0, 0,
-				axi_ctrl->share_ctrl->outpath.out4.inst_handle);
-		} else {
-			axi_ctrl->share_ctrl->outpath.out4.frame_drop_cnt++;
-			pr_err("path_irq irq - no free buffer for rdi2!\n");
-		}
-	}
-}
-static void vfe32_process_output_path_irq_rdi0_and_rdi1(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr = 0;
-	uint32_t ch1_paddr = 0;
-	struct msm_free_buf *free_buf = NULL;
-
-	if (axi_ctrl->share_ctrl->operation_mode & VFE_OUTPUTS_RDI0) {
-		free_buf = vfe32_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-			VFE_MSG_OUTPUT_TERTIARY1, axi_ctrl);
-		if (axi_ctrl->share_ctrl->outpath.out2.capture_cnt > 0 ||
-							free_buf) {
-			ping_pong = msm_camera_io_r(axi_ctrl->
-				share_ctrl->vfebase +
-				VFE_BUS_PING_PONG_STATUS);
-
-			/* Y only channel */
-			ch0_paddr = vfe32_get_ch_addr(ping_pong,
-				axi_ctrl->share_ctrl->vfebase,
-				axi_ctrl->share_ctrl->outpath.out2.ch0);
-
-			ch1_paddr = vfe32_get_ch_addr(ping_pong,
-				axi_ctrl->share_ctrl->vfebase,
-				axi_ctrl->share_ctrl->outpath.out3.ch0);
-
-			CDBG("%s ch0 = 0x%x, ch1 0x%x\n", __func__, ch0_paddr,
-				ch1_paddr);
-
-			if (free_buf) {
-				CDBG("%s buffer address ch0 = 0x%x, ch1 0x%x\n",
-					__func__,
-					free_buf->ch_paddr[0],
-					free_buf->ch_paddr[1]);
-
-				vfe32_put_ch_addr(ping_pong,
-					axi_ctrl->share_ctrl->vfebase,
-					axi_ctrl->share_ctrl->outpath.out2.ch0,
-					free_buf->ch_paddr[0]);
-
-				vfe32_put_ch_addr(ping_pong,
-					axi_ctrl->share_ctrl->vfebase,
-					axi_ctrl->share_ctrl->outpath.out3.ch0,
-					free_buf->ch_paddr[1]);
-				}
-			if (axi_ctrl->share_ctrl->outpath.out2.capture_cnt == 1)
-				axi_ctrl->share_ctrl
-				->outpath.out2.capture_cnt = 0;
-
-			if (axi_ctrl->share_ctrl->outpath.out3.capture_cnt == 1)
-				axi_ctrl->share_ctrl
-				->outpath.out3.capture_cnt = 0;
-
-			vfe_send_outmsg(axi_ctrl,
-				MSG_ID_OUTPUT_TERTIARY1, ch0_paddr,
-				0, 0,
-				axi_ctrl->share_ctrl->outpath.out2.inst_handle);
-
-		} else {
-			axi_ctrl->share_ctrl->outpath.out2.frame_drop_cnt++;
-			pr_err("path_irq_2 irq - no free buffer for rdi0!\n");
-		}
-	}
-
-}
-
-static uint32_t  vfe32_process_stats_irq_common(
-	struct vfe32_ctrl_type *vfe32_ctrl,
-	uint32_t statsNum, uint32_t newAddr)
-{
-	uint32_t pingpongStatus;
-	uint32_t returnAddr;
-	uint32_t pingpongAddr;
-
-	/* must be 0=ping, 1=pong */
-	pingpongStatus =
-		((msm_camera_io_r(vfe32_ctrl->share_ctrl->vfebase +
-		VFE_BUS_PING_PONG_STATUS))
-	& ((uint32_t)(1<<(statsNum + 7)))) >> (statsNum + 7);
-	/* stats bits starts at 7 */
-	CDBG("statsNum %d, pingpongStatus %d\n", statsNum, pingpongStatus);
-	pingpongAddr =
-		((uint32_t)(vfe32_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_PING_PONG_BASE)) +
-				(3*statsNum)*4 + (1-pingpongStatus)*4;
-	returnAddr = msm_camera_io_r((uint32_t *)pingpongAddr);
-	msm_camera_io_w(newAddr, (uint32_t *)pingpongAddr);
-	return returnAddr;
-}
-
-static void vfe_send_stats_msg(
-	struct vfe32_ctrl_type *vfe32_ctrl,
-	uint32_t bufAddress, uint32_t statsNum)
-{
-	int rc = 0;
-	void *vaddr = NULL;
-	/* fill message with right content. */
-	/* @todo This is causing issues, need further investigate */
-	/* spin_lock_irqsave(&ctrl->state_lock, flags); */
-	struct isp_msg_stats msgStats;
-	uint32_t stats_type;
-	msgStats.frameCounter = vfe32_ctrl->share_ctrl->vfeFrameId;
-	if (vfe32_ctrl->simultaneous_sof_stat)
-		msgStats.frameCounter--;
-	msgStats.buffer = bufAddress;
-	switch (statsNum) {
-	case statsAeNum:{
-		msgStats.id =
-			(!vfe32_use_bayer_stats(vfe32_ctrl)) ? MSG_ID_STATS_AEC
-				: MSG_ID_STATS_BG;
-		stats_type =
-			(!vfe32_use_bayer_stats(vfe32_ctrl)) ?
-				MSM_STATS_TYPE_AEC : MSM_STATS_TYPE_BG;
-		rc = vfe32_ctrl->stats_ops.dispatch(
-				vfe32_ctrl->stats_ops.stats_ctrl,
-				stats_type, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe32_ctrl->stats_ops.client);
-		}
-		break;
-	case statsAfNum:{
-		msgStats.id =
-			(!vfe32_use_bayer_stats(vfe32_ctrl)) ? MSG_ID_STATS_AF
-				: MSG_ID_STATS_BF;
-		stats_type =
-			(!vfe32_use_bayer_stats(vfe32_ctrl)) ? MSM_STATS_TYPE_AF
-				: MSM_STATS_TYPE_BF;
-		rc = vfe32_ctrl->stats_ops.dispatch(
-				vfe32_ctrl->stats_ops.stats_ctrl,
-				stats_type, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe32_ctrl->stats_ops.client);
-		}
-		break;
-	case statsAwbNum: {
-		msgStats.id = MSG_ID_STATS_AWB;
-		rc = vfe32_ctrl->stats_ops.dispatch(
-				vfe32_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_AWB, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe32_ctrl->stats_ops.client);
-		}
-		break;
-
-	case statsIhistNum: {
-		msgStats.id = MSG_ID_STATS_IHIST;
-		rc = vfe32_ctrl->stats_ops.dispatch(
-				vfe32_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_IHIST, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe32_ctrl->stats_ops.client);
-		}
-		break;
-	case statsRsNum: {
-		msgStats.id = MSG_ID_STATS_RS;
-		rc = vfe32_ctrl->stats_ops.dispatch(
-				vfe32_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_RS, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe32_ctrl->stats_ops.client);
-		}
-		break;
-	case statsCsNum: {
-		msgStats.id = MSG_ID_STATS_CS;
-		rc = vfe32_ctrl->stats_ops.dispatch(
-				vfe32_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_CS, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe32_ctrl->stats_ops.client);
-		}
-		break;
-	case statsSkinNum: {
-		msgStats.id = MSG_ID_STATS_BHIST;
-		rc = vfe32_ctrl->stats_ops.dispatch(
-				vfe32_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_BHIST, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe32_ctrl->stats_ops.client);
-		}
-		break;
-
-	default:
-		goto stats_done;
-	}
-	if (rc == 0) {
-		msgStats.buffer = (uint32_t)vaddr;
-		v4l2_subdev_notify(&vfe32_ctrl->subdev,
-			NOTIFY_VFE_MSG_STATS,
-			&msgStats);
-	} else {
-		pr_err("%s: paddr to idx mapping error, stats_id = %d, paddr = 0x%d",
-			 __func__, msgStats.id, msgStats.buffer);
-	}
-stats_done:
-	/* spin_unlock_irqrestore(&ctrl->state_lock, flags); */
-	return;
-}
-
-static void vfe_send_comp_stats_msg(
-	struct vfe32_ctrl_type *vfe32_ctrl, uint32_t status_bits)
-{
-	struct msm_stats_buf msgStats;
-	uint32_t stats_type;
-	int rc = 0;
-	void *vaddr = NULL;
-
-	msgStats.frame_id = vfe32_ctrl->share_ctrl->vfeFrameId;
-	if (vfe32_ctrl->simultaneous_sof_stat)
-		msgStats.frame_id--;
-
-	msgStats.status_bits = status_bits;
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_AEC_BG) {
-		stats_type = (!vfe32_use_bayer_stats(vfe32_ctrl)) ?
-			MSM_STATS_TYPE_AEC : MSM_STATS_TYPE_BG;
-		rc = vfe32_ctrl->stats_ops.dispatch(
-			vfe32_ctrl->stats_ops.stats_ctrl, stats_type,
-			vfe32_ctrl->aecbgStatsControl.bufToRender,
-			&msgStats.buf_idx, &vaddr, &msgStats.aec.fd,
-			vfe32_ctrl->stats_ops.client);
-		if (rc == 0)
-			msgStats.aec.buff = (uint32_t)vaddr;
-		else
-			CDBG("%s: Could not dispatch AEC/BG stats buffer %d",
-				__func__, stats_type);
-	} else {
-		msgStats.aec.buff = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_AWB) {
-		rc = vfe32_ctrl->stats_ops.dispatch(
-			vfe32_ctrl->stats_ops.stats_ctrl, MSM_STATS_TYPE_AWB,
-			vfe32_ctrl->awbStatsControl.bufToRender,
-			&msgStats.buf_idx, &vaddr, &msgStats.awb.fd,
-			vfe32_ctrl->stats_ops.client);
-		if (rc == 0)
-			msgStats.awb.buff = (uint32_t)vaddr;
-		else
-			CDBG("%s: Could not dispatch AWB stats buffer",
-				__func__);
-	} else {
-		msgStats.awb.buff = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_AF_BF) {
-		stats_type = (!vfe32_use_bayer_stats(vfe32_ctrl)) ?
-			MSM_STATS_TYPE_AF : MSM_STATS_TYPE_BF;
-		rc = vfe32_ctrl->stats_ops.dispatch(
-			vfe32_ctrl->stats_ops.stats_ctrl, stats_type,
-			vfe32_ctrl->afbfStatsControl.bufToRender,
-			&msgStats.buf_idx, &vaddr, &msgStats.af.fd,
-			vfe32_ctrl->stats_ops.client);
-		if (rc == 0)
-			msgStats.af.buff = (uint32_t)vaddr;
-		else
-			CDBG("%s: Could not dispatch AF/BF stats buffer %d",
-				__func__, stats_type);
-	} else {
-		msgStats.af.buff = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_IHIST) {
-		rc = vfe32_ctrl->stats_ops.dispatch(
-			vfe32_ctrl->stats_ops.stats_ctrl, MSM_STATS_TYPE_IHIST,
-			vfe32_ctrl->ihistStatsControl.bufToRender,
-			&msgStats.buf_idx, &vaddr, &msgStats.ihist.fd,
-			vfe32_ctrl->stats_ops.client);
-		if (rc == 0)
-			msgStats.ihist.buff = (uint32_t)vaddr;
-		else
-			CDBG("%s: Could not dispatch IHIST stats buffer",
-				__func__);
-	} else {
-		msgStats.ihist.buff = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_RS) {
-		rc = vfe32_ctrl->stats_ops.dispatch(
-			vfe32_ctrl->stats_ops.stats_ctrl, MSM_STATS_TYPE_RS,
-			vfe32_ctrl->rsStatsControl.bufToRender,
-			&msgStats.buf_idx, &vaddr, &msgStats.rs.fd,
-			vfe32_ctrl->stats_ops.client);
-		if (rc == 0)
-			msgStats.rs.buff = (uint32_t)vaddr;
-		else
-			CDBG("%s: Could not dispatch RS stats buffer",
-				__func__);
-	} else {
-		msgStats.rs.buff = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_CS) {
-		rc = vfe32_ctrl->stats_ops.dispatch(
-			vfe32_ctrl->stats_ops.stats_ctrl, MSM_STATS_TYPE_CS,
-			vfe32_ctrl->csStatsControl.bufToRender,
-			&msgStats.buf_idx, &vaddr, &msgStats.cs.fd,
-			vfe32_ctrl->stats_ops.client);
-		if (rc == 0)
-			msgStats.cs.buff = (uint32_t)vaddr;
-		else
-			CDBG("%s: Could not dispatch CS stats buffer",
-				__func__);
-	} else {
-		msgStats.cs.buff = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_SK_BHIST) {
-		rc = vfe32_ctrl->stats_ops.dispatch(
-			vfe32_ctrl->stats_ops.stats_ctrl, MSM_STATS_TYPE_BHIST,
-			vfe32_ctrl->bhistStatsControl.bufToRender,
-			&msgStats.buf_idx, &vaddr, &msgStats.skin.fd,
-			vfe32_ctrl->stats_ops.client);
-		if (rc == 0)
-			msgStats.skin.buff = (uint32_t)vaddr;
-		else
-			CDBG("%s: Could not dispatch BHIST stats buffer",
-				__func__);
-	} else {
-	  msgStats.skin.buff = 0;
-	}
-	v4l2_subdev_notify(&vfe32_ctrl->subdev,
-		NOTIFY_VFE_MSG_COMP_STATS, &msgStats);
-}
-
-static void vfe32_process_stats_ae_bg_irq(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	uint32_t stats_type;
-	stats_type =
-		(!vfe32_use_bayer_stats(vfe32_ctrl)) ? MSM_STATS_TYPE_AEC
-			: MSM_STATS_TYPE_BG;
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe32_ctrl->aecbgStatsControl.bufToRender =
-			vfe32_process_stats_irq_common(vfe32_ctrl, statsAeNum,
-			addr);
-
-		vfe_send_stats_msg(vfe32_ctrl,
-			vfe32_ctrl->aecbgStatsControl.bufToRender, statsAeNum);
-	} else{
-		vfe32_ctrl->aecbgStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe32_ctrl->aecbgStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe32_process_stats_awb_irq(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_AWB);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe32_ctrl->awbStatsControl.bufToRender =
-			vfe32_process_stats_irq_common(vfe32_ctrl, statsAwbNum,
-			addr);
-
-		vfe_send_stats_msg(vfe32_ctrl,
-			vfe32_ctrl->awbStatsControl.bufToRender, statsAwbNum);
-	} else{
-		vfe32_ctrl->awbStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe32_ctrl->awbStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe32_process_stats_af_bf_irq(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	uint32_t stats_type;
-	stats_type =
-		(!vfe32_use_bayer_stats(vfe32_ctrl)) ? MSM_STATS_TYPE_AF
-			: MSM_STATS_TYPE_BF;
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe32_ctrl->afbfStatsControl.bufToRender =
-			vfe32_process_stats_irq_common(vfe32_ctrl, statsAfNum,
-			addr);
-
-		vfe_send_stats_msg(vfe32_ctrl,
-			vfe32_ctrl->afbfStatsControl.bufToRender, statsAfNum);
-	} else{
-		vfe32_ctrl->afbfStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe32_ctrl->afbfStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe32_process_stats_bhist_irq(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_BHIST);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe32_ctrl->bhistStatsControl.bufToRender =
-			vfe32_process_stats_irq_common(vfe32_ctrl,
-				statsSkinNum, addr);
-
-		vfe_send_stats_msg(vfe32_ctrl,
-			vfe32_ctrl->bhistStatsControl.bufToRender,
-			statsSkinNum);
-	} else{
-		vfe32_ctrl->bhistStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe32_ctrl->bhistStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe32_process_stats_ihist_irq(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_IHIST);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe32_ctrl->ihistStatsControl.bufToRender =
-			vfe32_process_stats_irq_common(
-			vfe32_ctrl, statsIhistNum, addr);
-
-		vfe_send_stats_msg(vfe32_ctrl,
-			vfe32_ctrl->ihistStatsControl.bufToRender,
-			statsIhistNum);
-	} else {
-		vfe32_ctrl->ihistStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe32_ctrl->ihistStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe32_process_stats_rs_irq(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_RS);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe32_ctrl->rsStatsControl.bufToRender =
-			vfe32_process_stats_irq_common(vfe32_ctrl, statsRsNum,
-			addr);
-
-		vfe_send_stats_msg(vfe32_ctrl,
-			vfe32_ctrl->rsStatsControl.bufToRender, statsRsNum);
-	} else {
-		vfe32_ctrl->rsStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe32_ctrl->rsStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe32_process_stats_cs_irq(struct vfe32_ctrl_type *vfe32_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl, MSM_STATS_TYPE_CS);
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe32_ctrl->csStatsControl.bufToRender =
-			vfe32_process_stats_irq_common(vfe32_ctrl, statsCsNum,
-			addr);
-
-			vfe_send_stats_msg(vfe32_ctrl,
-				vfe32_ctrl->csStatsControl.bufToRender,
-				statsCsNum);
-	} else {
-		vfe32_ctrl->csStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe32_ctrl->csStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe32_process_stats(struct vfe32_ctrl_type *vfe32_ctrl,
-	uint32_t status_bits)
-{
-	unsigned long flags;
-	int32_t process_stats = false;
-	uint32_t addr;
-	uint32_t stats_type;
-
-	CDBG("%s, stats = 0x%x\n", __func__, status_bits);
-	spin_lock_irqsave(&vfe32_ctrl->stats_bufq_lock, flags);
-	stats_type =
-		(!vfe32_use_bayer_stats(vfe32_ctrl)) ? MSM_STATS_TYPE_AEC
-			: MSM_STATS_TYPE_BG;
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_AEC_BG) {
-		addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl,
-				stats_type);
-		if (addr) {
-			vfe32_ctrl->aecbgStatsControl.bufToRender =
-				vfe32_process_stats_irq_common(
-				vfe32_ctrl, statsAeNum,	addr);
-			process_stats = true;
-		} else{
-			vfe32_ctrl->aecbgStatsControl.bufToRender = 0;
-			vfe32_ctrl->aecbgStatsControl.droppedStatsFrameCount++;
-		}
-	} else {
-		vfe32_ctrl->aecbgStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_AWB) {
-		addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl,
-			MSM_STATS_TYPE_AWB);
-		if (addr) {
-			vfe32_ctrl->awbStatsControl.bufToRender =
-				vfe32_process_stats_irq_common(
-				vfe32_ctrl, statsAwbNum,
-				addr);
-			process_stats = true;
-		} else{
-			vfe32_ctrl->awbStatsControl.droppedStatsFrameCount++;
-			vfe32_ctrl->awbStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe32_ctrl->awbStatsControl.bufToRender = 0;
-	}
-
-	stats_type =
-		(!vfe32_use_bayer_stats(vfe32_ctrl)) ? MSM_STATS_TYPE_AF
-			: MSM_STATS_TYPE_BF;
-	if (status_bits & VFE_IRQ_STATUS0_STATS_AF_BF) {
-		addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl,
-					stats_type);
-		if (addr) {
-			vfe32_ctrl->afbfStatsControl.bufToRender =
-				vfe32_process_stats_irq_common(
-				vfe32_ctrl, statsAfNum,
-				addr);
-			process_stats = true;
-		} else {
-			vfe32_ctrl->afbfStatsControl.bufToRender = 0;
-			vfe32_ctrl->afbfStatsControl.droppedStatsFrameCount++;
-		}
-	} else {
-		vfe32_ctrl->afbfStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_IHIST) {
-		addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl,
-					MSM_STATS_TYPE_IHIST);
-		if (addr) {
-			vfe32_ctrl->ihistStatsControl.bufToRender =
-				vfe32_process_stats_irq_common(
-				vfe32_ctrl, statsIhistNum,
-				addr);
-			process_stats = true;
-		} else {
-			vfe32_ctrl->ihistStatsControl.droppedStatsFrameCount++;
-			vfe32_ctrl->ihistStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe32_ctrl->ihistStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_RS) {
-		addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl,
-					MSM_STATS_TYPE_RS);
-		if (addr) {
-			vfe32_ctrl->rsStatsControl.bufToRender =
-				vfe32_process_stats_irq_common(
-				vfe32_ctrl, statsRsNum,
-				addr);
-			process_stats = true;
-		} else {
-			vfe32_ctrl->rsStatsControl.droppedStatsFrameCount++;
-			vfe32_ctrl->rsStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe32_ctrl->rsStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_CS) {
-		addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl,
-					MSM_STATS_TYPE_CS);
-		if (addr) {
-			vfe32_ctrl->csStatsControl.bufToRender =
-				vfe32_process_stats_irq_common(
-				vfe32_ctrl, statsCsNum,
-				addr);
-			process_stats = true;
-		} else {
-			vfe32_ctrl->csStatsControl.droppedStatsFrameCount++;
-			vfe32_ctrl->csStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe32_ctrl->csStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_SK_BHIST) {
-		addr = (uint32_t)vfe32_stats_dqbuf(vfe32_ctrl,
-				MSM_STATS_TYPE_BHIST);
-		if (addr) {
-			vfe32_ctrl->bhistStatsControl.bufToRender =
-				vfe32_process_stats_irq_common(
-				vfe32_ctrl,	statsSkinNum,
-				addr);
-			process_stats = true;
-		} else {
-			vfe32_ctrl->bhistStatsControl.droppedStatsFrameCount++;
-			vfe32_ctrl->bhistStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe32_ctrl->bhistStatsControl.bufToRender = 0;
-	}
-
-	spin_unlock_irqrestore(&vfe32_ctrl->stats_bufq_lock, flags);
-	if (process_stats)
-		vfe_send_comp_stats_msg(vfe32_ctrl, status_bits);
-
-	return;
-}
-
-static void vfe32_process_stats_irq(
-	struct vfe32_ctrl_type *vfe32_ctrl, uint32_t irqstatus)
-{
-	uint32_t status_bits = VFE_COM_STATUS & irqstatus;
-
-	if ((vfe32_ctrl->hfr_mode != HFR_MODE_OFF) &&
-		(vfe32_ctrl->share_ctrl->vfeFrameId %
-		 vfe32_ctrl->hfr_mode != 0)) {
-		CDBG("Skip the stats when HFR enabled\n");
-		return;
-	}
-
-	vfe32_process_stats(vfe32_ctrl, status_bits);
-	return;
-}
-
-static void vfe32_process_irq(
-	struct vfe32_ctrl_type *vfe32_ctrl, uint32_t irqstatus)
-{
-	if (irqstatus &
-		VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK) {
-		vfe32_process_stats_irq(vfe32_ctrl, irqstatus);
-		return;
-	}
-
-	switch (irqstatus) {
-	case VFE_IRQ_STATUS0_CAMIF_SOF_MASK:
-		CDBG("irq	camifSofIrq\n");
-		vfe32_process_camif_sof_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_REG_UPDATE_MASK:
-		CDBG("irq	regUpdateIrq\n");
-		vfe32_process_reg_update_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS1_RDI0_REG_UPDATE:
-		CDBG("irq	rdi0 regUpdateIrq\n");
-		vfe32_process_rdi0_reg_update_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS1_RDI1_REG_UPDATE:
-		CDBG("irq	rdi1 regUpdateIrq\n");
-		vfe32_process_rdi1_reg_update_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS1_RDI2_REG_UPDATE:
-		pr_err("irq	rdi2 regUpdateIrq\n");
-		vfe32_process_rdi2_reg_update_irq(vfe32_ctrl);
-		break;
-	case VFE_IMASK_WHILE_STOPPING_1:
-		CDBG("irq	resetAckIrq\n");
-		vfe32_process_reset_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_AEC_BG:
-		CDBG("Stats AEC irq occured.\n");
-		vfe32_process_stats_ae_bg_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_AWB:
-		CDBG("Stats AWB irq occured.\n");
-		vfe32_process_stats_awb_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_AF_BF:
-		CDBG("Stats AF irq occured.\n");
-		vfe32_process_stats_af_bf_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_SK_BHIST:
-		CDBG("Stats BHIST irq occured.\n");
-		vfe32_process_stats_bhist_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_IHIST:
-		CDBG("Stats IHIST irq occured.\n");
-		vfe32_process_stats_ihist_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_RS:
-		CDBG("Stats RS irq occured.\n");
-		vfe32_process_stats_rs_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_CS:
-		CDBG("Stats CS irq occured.\n");
-		vfe32_process_stats_cs_irq(vfe32_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_SYNC_TIMER0:
-		CDBG("SYNC_TIMER 0 irq occured.\n");
-		vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-			vfe32_ctrl->share_ctrl->vfeFrameId,
-			MSG_ID_SYNC_TIMER0_DONE);
-		break;
-	case VFE_IRQ_STATUS0_SYNC_TIMER1:
-		CDBG("SYNC_TIMER 1 irq occured.\n");
-		vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-			vfe32_ctrl->share_ctrl->vfeFrameId,
-			MSG_ID_SYNC_TIMER1_DONE);
-		break;
-	case VFE_IRQ_STATUS0_SYNC_TIMER2:
-		CDBG("SYNC_TIMER 2 irq occured.\n");
-		vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-			vfe32_ctrl->share_ctrl->vfeFrameId,
-			MSG_ID_SYNC_TIMER2_DONE);
-		break;
-	default:
-		pr_err("Invalid IRQ status\n");
-	}
-}
-
-static void axi32_do_tasklet(unsigned long data)
-{
-	unsigned long flags;
-	uint8_t  axi_busy_flag = true;
-	uint32_t halt_timeout = 100;
-	struct axi_ctrl_t *axi_ctrl = (struct axi_ctrl_t *)data;
-	struct vfe32_ctrl_type *vfe32_ctrl = axi_ctrl->share_ctrl->vfe32_ctrl;
-	struct vfe32_isr_queue_cmd *qcmd = NULL;
-	int stat_interrupt;
-
-	CDBG("=== axi32_do_tasklet start ===\n");
-
-	while (atomic_read(&irq_cnt)) {
-		spin_lock_irqsave(&axi_ctrl->tasklet_lock, flags);
-		qcmd = list_first_entry(&axi_ctrl->tasklet_q,
-			struct vfe32_isr_queue_cmd, list);
-		atomic_sub(1, &irq_cnt);
-
-		if (!qcmd) {
-			spin_unlock_irqrestore(&axi_ctrl->tasklet_lock,
-				flags);
-			return;
-		}
-
-		list_del(&qcmd->list);
-		spin_unlock_irqrestore(&axi_ctrl->tasklet_lock,
-			flags);
-
-		/* Detect simultaneous SOF and output irqs to avoid
-		 * unexpected frame id sequences.*/
-		axi_ctrl->simultaneous_sof_frame =
-			(qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_CAMIF_SOF_MASK)	&&
-			((qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK) ||
-			(qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK));
-
-		if (axi_ctrl->share_ctrl->stats_comp) {
-			stat_interrupt = (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK);
-		} else {
-			stat_interrupt =
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_AEC_BG) |
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_AWB) |
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_AF_BF) |
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_IHIST) |
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_RS) |
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_CS);
-		}
-
-		if (atomic_read(&fault_recovery) && !atomic_read(&recovery_active)) {
-			pr_err("avert page fault when overflow recovery not in progress");
-			msm_camera_io_w_mb(AXI_HALT_CLEAR, axi_ctrl->share_ctrl->vfebase + VFE_AXI_CMD);
-			v4l2_subdev_notify(&vfe32_ctrl->subdev, NOTIFY_VFE_CAMIF_ERROR,
-					(void *)NULL);
-			vfe32_send_isp_msg(&vfe32_ctrl->subdev,
-					vfe32_ctrl->share_ctrl->vfeFrameId, MSG_ID_CAMIF_ERROR);
-		}
-
-		if (!atomic_read(&recovery_active)) {
-			if (qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_CAMIF_SOF_MASK) {
-				if (stat_interrupt)
-					vfe32_ctrl->simultaneous_sof_stat = 1;
-				v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_CAMIF_SOF_MASK);
-			}
-
-			/* interrupt to be processed,  *qcmd has the payload. */
-			if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_REG_UPDATE_MASK)
-				v4l2_subdev_notify(&vfe32_ctrl->subdev,
-				NOTIFY_VFE_IRQ,
-				(void *)VFE_IRQ_STATUS0_REG_UPDATE_MASK);
-
-			if (qcmd->vfeInterruptStatus1 &
-					VFE_IRQ_STATUS1_RDI0_REG_UPDATE_MASK)
-				v4l2_subdev_notify(&vfe32_ctrl->subdev,
-				NOTIFY_VFE_IRQ,
-				(void *)VFE_IRQ_STATUS1_RDI0_REG_UPDATE);
-
-			if (qcmd->vfeInterruptStatus1 &
-					VFE_IRQ_STATUS1_RDI1_REG_UPDATE_MASK)
-				v4l2_subdev_notify(&vfe32_ctrl->subdev,
-				NOTIFY_VFE_IRQ,
-				(void *)VFE_IRQ_STATUS1_RDI1_REG_UPDATE);
-
-			if (qcmd->vfeInterruptStatus1 &
-					VFE_IRQ_STATUS1_RDI2_REG_UPDATE_MASK)
-				v4l2_subdev_notify(&vfe32_ctrl->subdev,
-				NOTIFY_VFE_IRQ,
-				(void *)VFE_IRQ_STATUS1_RDI2_REG_UPDATE);
-		}
-
-		if ((qcmd->vfeInterruptStatus1 &
-			VFE_IMASK_WHILE_STOPPING_1) &&
-			atomic_read(&recovery_active) != 2)
-			v4l2_subdev_notify(&vfe32_ctrl->subdev,
-				NOTIFY_VFE_IRQ,
-				(void *)VFE_IMASK_WHILE_STOPPING_1);
-
-		if (atomic_read(&axi_ctrl->share_ctrl->handle_common_irq)) {
-			if ((qcmd->vfeInterruptStatus1 &
-				VFE32_IMASK_COMMON_ERROR_ONLY_1) &&
-				atomic_read(&recovery_active) != 1) {
-				pr_err("irq	errorIrq\n");
-				vfe32_process_common_error_irq(
-					axi_ctrl,
-					qcmd->vfeInterruptStatus1 &
-					VFE32_IMASK_COMMON_ERROR_ONLY_1);
-			}
-
-			if ((qcmd->vfeInterruptStatus1 & 0x3FFF00) &&
-					atomic_read(&recovery_active) == 2) {
-				while (axi_busy_flag && halt_timeout--) {
-					if (msm_camera_io_r(
-						axi_ctrl->share_ctrl->vfebase + 
-							VFE_AXI_STATUS) & 0x1)
-						axi_busy_flag = false;
-				}
-				msm_camera_io_w_mb(AXI_HALT_CLEAR,
-					axi_ctrl->share_ctrl->vfebase +
-						VFE_AXI_CMD);
-				printk("Halt done\n");
-				msm_camera_io_w_mb(VFE_RESET_UPON_STOP_CMD,
-					axi_ctrl->share_ctrl->vfebase +
-						VFE_GLOBAL_RESET);
-				atomic_set(&recovery_active, 1);
-			}
-
-			if(!atomic_read(&recovery_active))
-			v4l2_subdev_notify(&axi_ctrl->subdev,
-				NOTIFY_AXI_IRQ,
-				(void *)qcmd->vfeInterruptStatus0);
-		}
-
-
-
-		if (atomic_read(&axi_ctrl->share_ctrl->vstate) &&
-					!atomic_read(&recovery_active)) {
-			if (qcmd->vfeInterruptStatus1 &
-					VFE32_IMASK_VFE_ERROR_ONLY_1) {
-				pr_err("irq	errorIrq\n");
-				vfe32_process_error_irq(
-					axi_ctrl,
-					qcmd->vfeInterruptStatus1 &
-					VFE32_IMASK_VFE_ERROR_ONLY_1);
-			}
-
-			/* then process stats irq. */
-			if (axi_ctrl->share_ctrl->stats_comp) {
-				/* process stats comb interrupt. */
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK) {
-					CDBG("Stats composite irq occured.\n");
-					v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)qcmd->vfeInterruptStatus0);
-				}
-			} else {
-				/* process individual stats interrupt. */
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_AEC_BG)
-					v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_AEC_BG);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_AWB)
-					v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_AWB);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_AF_BF)
-					v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_AF_BF);
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_SK_BHIST)
-					v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_SK_BHIST);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_IHIST)
-					v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_IHIST);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_RS)
-					v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_RS);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_CS)
-					v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_CS);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_SYNC_TIMER0)
-					v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_SYNC_TIMER0);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_SYNC_TIMER1)
-					v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_SYNC_TIMER1);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_SYNC_TIMER2)
-					v4l2_subdev_notify(&vfe32_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_SYNC_TIMER2);
-			}
-		}
-		vfe32_ctrl->simultaneous_sof_stat = 0;
-		axi_ctrl->simultaneous_sof_frame = 0;
-		kfree(qcmd);
-	}
-	CDBG("=== axi32_do_tasklet end ===\n");
-}
-
-static irqreturn_t vfe32_parse_irq(int irq_num, void *data)
-{
-	unsigned long flags;
-	struct vfe32_irq_status irq;
-	struct vfe32_isr_queue_cmd *qcmd;
-	struct axi_ctrl_t *axi_ctrl = data;
-
-	CDBG("vfe_parse_irq\n");
-	if (!axi_ctrl->share_ctrl->vfebase)
-		return IRQ_HANDLED;
-	vfe32_read_irq_status(axi_ctrl, &irq);
-
-	if ((irq.vfeIrqStatus0 == 0) && (irq.vfeIrqStatus1 == 0)) {
-		CDBG("vfe_parse_irq: vfeIrqStatus0 & 1 are both 0!\n");
-		return IRQ_HANDLED;
-	}
-
-	qcmd = kzalloc(sizeof(struct vfe32_isr_queue_cmd),
-		GFP_ATOMIC);
-	if (!qcmd) {
-		pr_err("vfe_parse_irq: qcmd malloc failed!\n");
-		return IRQ_HANDLED;
-	}
-
-	spin_lock_irqsave(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-	if (axi_ctrl->share_ctrl->stop_ack_pending ||
-			atomic_read(&recovery_active)) {
-		irq.vfeIrqStatus0 &= VFE_IMASK_WHILE_STOPPING_0;
-		irq.vfeIrqStatus1 &= VFE_IMASK_WHILE_STOPPING_1;
-	}
-	spin_unlock_irqrestore(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-
-	CDBG("vfe_parse_irq: Irq_status0 = 0x%x, Irq_status1 = 0x%x.\n",
-		irq.vfeIrqStatus0, irq.vfeIrqStatus1);
-
-	qcmd->vfeInterruptStatus0 = irq.vfeIrqStatus0;
-	qcmd->vfeInterruptStatus1 = irq.vfeIrqStatus1;
-        if (atomic_read(&fault_recovery)) {
-		printk("Start fault recovery\n");
-		msm_camera_io_w(0x0, axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_0);
-		msm_camera_io_w((0x1 << 23), axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-		msm_camera_io_w(VFE_CLEAR_ALL_IRQS, axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-		msm_camera_io_w(VFE_CLEAR_ALL_IRQS, axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-		msm_camera_io_w(0x2, axi_ctrl->share_ctrl->vfebase + 0x1E0);
-		msm_camera_io_w(AXI_HALT, axi_ctrl->share_ctrl->vfebase + VFE_AXI_CMD);
-	} else if ((qcmd->vfeInterruptStatus1 & 0x3FFF00) && !atomic_read(&recovery_active)) {
-		printk("Start bus overflow recovery\n");
-
-		recover_irq_mask0 = msm_camera_io_r(
-			axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_0);
-		recover_irq_mask1 = msm_camera_io_r(
-			axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-		/* Clear all IRQs from MASK 0 */
-		msm_camera_io_w(0x0, axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_0);
-		/* Clear all IRQs from MASK 1 except RESET IRQ */
-		msm_camera_io_w((0x1 << 23),
-			axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-		msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-			axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-		msm_camera_io_w(VFE_CLEAR_ALL_IRQS,
-			axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-		/* Disable CAMIF capture */
-		msm_camera_io_w(0x2, axi_ctrl->share_ctrl->vfebase +
-			VFE_CAMIF_COMMAND);
-		msm_camera_io_w(AXI_HALT,
-			axi_ctrl->share_ctrl->vfebase + VFE_AXI_CMD);
-		wmb();
-		atomic_set(&recovery_active, 2);
-	}
-	spin_lock_irqsave(&axi_ctrl->tasklet_lock, flags);
-	list_add_tail(&qcmd->list, &axi_ctrl->tasklet_q);
-
-	atomic_add(1, &irq_cnt);
-	spin_unlock_irqrestore(&axi_ctrl->tasklet_lock, flags);
-	tasklet_schedule(&axi_ctrl->vfe32_tasklet);
-	return IRQ_HANDLED;
-}
-
-int msm_axi_subdev_isr_routine(struct v4l2_subdev *sd,
-	u32 status, bool *handled)
-{
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	irqreturn_t ret;
-	pr_info("%s E ", __func__);
-	ret = vfe32_parse_irq(axi_ctrl->vfeirq->start, axi_ctrl);
-	*handled = TRUE;
-	return 0;
-}
-
-static long vfe_stats_bufq_sub_ioctl(
-	struct vfe32_ctrl_type *vfe_ctrl,
-	struct msm_vfe_cfg_cmd *cmd, void *ion_client, int domain_num)
-{
-	long rc = 0;
-	switch (cmd->cmd_type) {
-	case VFE_CMD_STATS_REQBUF:
-	if (!vfe_ctrl->stats_ops.stats_ctrl) {
-		/* stats_ctrl has not been init yet */
-		rc = msm_stats_buf_ops_init(&vfe_ctrl->stats_ctrl,
-				(struct ion_client *)ion_client,
-				&vfe_ctrl->stats_ops);
-		if (rc < 0) {
-			pr_err("%s: cannot init stats ops", __func__);
-			goto end;
-		}
-		rc = vfe_ctrl->stats_ops.stats_ctrl_init(&vfe_ctrl->stats_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot init stats_ctrl ops", __func__);
-			memset(&vfe_ctrl->stats_ops, 0,
-				sizeof(vfe_ctrl->stats_ops));
-			goto end;
-		}
-		if (sizeof(struct msm_stats_reqbuf) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats reqbuf input size = %d,\n"
-				"struct size = %d, mitch match\n",
-				 __func__, cmd->length,
-				sizeof(struct msm_stats_reqbuf));
-			rc = -EINVAL ;
-			goto end;
-		}
-	}
-	rc = vfe_ctrl->stats_ops.reqbuf(
-			&vfe_ctrl->stats_ctrl,
-			(struct msm_stats_reqbuf *)cmd->value,
-			vfe_ctrl->stats_ops.client);
-	break;
-	case VFE_CMD_STATS_ENQUEUEBUF:
-	if (sizeof(struct msm_stats_buf_info) != cmd->length) {
-		/* error. the length not match */
-		pr_err("%s: stats enqueuebuf input size = %d,\n"
-			"struct size = %d, mitch match\n",
-			 __func__, cmd->length,
-			sizeof(struct msm_stats_buf_info));
-			rc = -EINVAL;
-			goto end;
-	}
-	rc = vfe_ctrl->stats_ops.enqueue_buf(
-			&vfe_ctrl->stats_ctrl,
-			(struct msm_stats_buf_info *)cmd->value,
-			vfe_ctrl->stats_ops.client, domain_num);
-	break;
-	case VFE_CMD_STATS_FLUSH_BUFQ:
-	{
-		struct msm_stats_flush_bufq *flush_req = NULL;
-		flush_req = (struct msm_stats_flush_bufq *)cmd->value;
-		if (sizeof(struct msm_stats_flush_bufq) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats flush queue input size = %d,\n"
-				"struct size = %d, mitch match\n",
-				__func__, cmd->length,
-				sizeof(struct msm_stats_flush_bufq));
-			rc = -EINVAL;
-			goto end;
-	}
-	rc = vfe_ctrl->stats_ops.bufq_flush(
-			&vfe_ctrl->stats_ctrl,
-			(enum msm_stats_enum_type)flush_req->stats_type,
-			vfe_ctrl->stats_ops.client);
-	}
-	break;
-	case VFE_CMD_STATS_UNREGBUF:
-	{
-		struct msm_stats_reqbuf *req_buf = NULL;
-		req_buf = (struct msm_stats_reqbuf *)cmd->value;
-		if (sizeof(struct msm_stats_reqbuf) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats reqbuf input size = %d,\n"
-				"struct size = %d, mitch match\n",
-				 __func__, cmd->length,
-				sizeof(struct msm_stats_reqbuf));
-			rc = -EINVAL ;
-			goto end;
-		}
-		rc = vfe32_stats_unregbuf(vfe_ctrl, req_buf, domain_num);
-	}
-	break;
-	default:
-		rc = -1;
-		pr_err("%s: cmd_type %d not supported", __func__,
-			cmd->cmd_type);
-	break;
-	}
-end:
-	return rc;
-}
-
-static long msm_vfe_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int subdev_cmd, void *arg)
-{
-	struct msm_cam_media_controller *pmctl =
-		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
-	struct vfe32_ctrl_type *vfe32_ctrl =
-		(struct vfe32_ctrl_type *)v4l2_get_subdevdata(sd);
-	struct msm_isp_cmd vfecmd;
-	struct msm_camvfe_params *vfe_params;
-	struct msm_vfe_cfg_cmd *cmd;
-	void *data;
-
-	long rc = 0;
-	struct vfe_cmd_stats_buf *scfg = NULL;
-	struct vfe_cmd_stats_ack *sack = NULL;
-
-	if (!vfe32_ctrl->share_ctrl->vfebase) {
-		if (arg) {
-			vfe_params = (struct msm_camvfe_params *)arg;
-			cmd = vfe_params->vfe_cfg;
-			if (cmd && cmd->cmd_type != VFE_CMD_STATS_REQBUF &&
-				cmd->cmd_type != VFE_CMD_STATS_ENQUEUEBUF &&
-				cmd->cmd_type != VFE_CMD_STATS_FLUSH_BUFQ &&
-				cmd->cmd_type != VFE_CMD_STATS_UNREGBUF &&
-				subdev_cmd != VIDIOC_MSM_VFE_RELEASE) {
-				pr_err("%s: base address unmapped\n", __func__);
-				return -EFAULT;
-			}
-		} else
-			return -EFAULT;
-	}
-	CDBG("%s\n", __func__);
-	if (subdev_cmd == VIDIOC_MSM_VFE_INIT) {
-		CDBG("%s init\n", __func__);
-		return msm_vfe_subdev_init(sd);
-	} else if (subdev_cmd == VIDIOC_MSM_VFE_RELEASE) {
-		msm_vfe_subdev_release(sd);
-		return 0;
-	}
-	vfe_params = (struct msm_camvfe_params *)arg;
-	if (vfe_params) {
-		cmd = vfe_params->vfe_cfg;
-		data = vfe_params->data;
-		if (!cmd) {
-			pr_err("%s: vfe_params->vfe_cfg is NULL\n",__func__);
-			return -EFAULT;
-		}
-	} else {
-		pr_err("%s: vfe_params is NULL\n",__func__);
-		return -EFAULT;
-	}
-	switch (cmd->cmd_type) {
-	case CMD_VFE_PROCESS_IRQ:
-		vfe32_process_irq(vfe32_ctrl, (uint32_t) data);
-		return rc;
-	case VFE_CMD_STATS_REQBUF:
-	case VFE_CMD_STATS_ENQUEUEBUF:
-	case VFE_CMD_STATS_FLUSH_BUFQ:
-	case VFE_CMD_STATS_UNREGBUF:
-		/* for easy porting put in one envelope */
-		rc = vfe_stats_bufq_sub_ioctl(vfe32_ctrl,
-				cmd, vfe_params->data, pmctl->domain_num);
-		return rc;
-	default:
-		if (cmd->cmd_type != CMD_CONFIG_PING_ADDR &&
-		cmd->cmd_type != CMD_CONFIG_PONG_ADDR &&
-		cmd->cmd_type != CMD_CONFIG_FREE_BUF_ADDR &&
-		cmd->cmd_type != CMD_STATS_AEC_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_AWB_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_IHIST_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_RS_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_CS_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_AF_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_BG_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_BF_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_BHIST_BUF_RELEASE &&
-		cmd->cmd_type != CMD_VFE_PIX_SOF_COUNT_UPDATE &&
-		cmd->cmd_type != CMD_VFE_COUNT_PIX_SOF_ENABLE) {
-			if (copy_from_user(&vfecmd,
-					(void __user *)(cmd->value),
-					sizeof(vfecmd))) {
-				pr_err("%s %d: copy_from_user failed\n",
-					__func__, __LINE__);
-				return -EFAULT;
-			}
-		} else {
-			/* here eith stats release or frame release. */
-			if (cmd->cmd_type != CMD_CONFIG_PING_ADDR &&
-				cmd->cmd_type != CMD_CONFIG_PONG_ADDR &&
-				cmd->cmd_type != CMD_CONFIG_FREE_BUF_ADDR) {
-				/* then must be stats release. */
-				if (!data) {
-					pr_err("%s: data = NULL, cmd->cmd_type = %d",
-						__func__, cmd->cmd_type);
-					return -EFAULT;
-				}
-				sack = kmalloc(sizeof(struct vfe_cmd_stats_ack),
-							GFP_ATOMIC);
-				if (!sack) {
-					pr_err("%s: no mem for cmd->cmd_type = %d",
-					 __func__, cmd->cmd_type);
-					return -ENOMEM;
-				}
-				sack->nextStatsBuf = *(uint32_t *)data;
-			}
-		}
-	}
-
-	CDBG("%s: cmdType = %d\n", __func__, cmd->cmd_type);
-
-	if ((cmd->cmd_type == CMD_STATS_AF_ENABLE)    ||
-		(cmd->cmd_type == CMD_STATS_AWB_ENABLE)   ||
-		(cmd->cmd_type == CMD_STATS_IHIST_ENABLE) ||
-		(cmd->cmd_type == CMD_STATS_RS_ENABLE)    ||
-		(cmd->cmd_type == CMD_STATS_CS_ENABLE)    ||
-		(cmd->cmd_type == CMD_STATS_AEC_ENABLE)   ||
-		(cmd->cmd_type == CMD_STATS_BG_ENABLE)    ||
-		(cmd->cmd_type == CMD_STATS_BF_ENABLE)    ||
-		(cmd->cmd_type == CMD_STATS_BHIST_ENABLE)) {
-		struct axidata *axid;
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto vfe32_config_done;
-		}
-		CDBG("%s: cmdType = %d\n", __func__, cmd->cmd_type);
-
-		if ((cmd->cmd_type == CMD_STATS_AF_ENABLE)    ||
-			(cmd->cmd_type == CMD_STATS_AWB_ENABLE)   ||
-			(cmd->cmd_type == CMD_STATS_IHIST_ENABLE) ||
-			(cmd->cmd_type == CMD_STATS_RS_ENABLE)    ||
-			(cmd->cmd_type == CMD_STATS_CS_ENABLE)    ||
-			(cmd->cmd_type == CMD_STATS_AEC_ENABLE)) {
-				scfg = NULL;
-				/* individual */
-				goto vfe32_config_done;
-		}
-		switch (cmd->cmd_type) {
-		case CMD_STATS_AEC_ENABLE:
-		case CMD_STATS_BG_ENABLE:
-		case CMD_STATS_BF_ENABLE:
-		case CMD_STATS_BHIST_ENABLE:
-		case CMD_STATS_AWB_ENABLE:
-		case CMD_STATS_IHIST_ENABLE:
-		case CMD_STATS_RS_ENABLE:
-		case CMD_STATS_CS_ENABLE:
-		default:
-			pr_err("%s Unsupported cmd type %d",
-				__func__, cmd->cmd_type);
-			break;
-		}
-		goto vfe32_config_done;
-	}
-	switch (cmd->cmd_type) {
-	case CMD_GENERAL:
-		rc = vfe32_proc_general(pmctl, &vfecmd, vfe32_ctrl);
-	break;
-	case CMD_VFE_COUNT_PIX_SOF_ENABLE: {
-		int enable = *((int *)cmd->value);
-		if (enable)
-			vfe32_ctrl->vfe_sof_count_enable = TRUE;
-		else
-			vfe32_ctrl->vfe_sof_count_enable = false;
-	}
-	break;
-	case CMD_VFE_PIX_SOF_COUNT_UPDATE:
-		if (!vfe32_ctrl->vfe_sof_count_enable)
-			vfe32_ctrl->share_ctrl->vfeFrameId =
-			*((uint32_t *)vfe_params->data);
-	break;
-	case CMD_CONFIG_PING_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe32_output_ch *outch =
-			vfe32_get_ch(path, vfe32_ctrl->share_ctrl);
-		outch->ping = *((struct msm_free_buf *)data);
-	}
-	break;
-
-	case CMD_CONFIG_PONG_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe32_output_ch *outch =
-			vfe32_get_ch(path, vfe32_ctrl->share_ctrl);
-		outch->pong = *((struct msm_free_buf *)data);
-	}
-	break;
-
-	case CMD_CONFIG_FREE_BUF_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe32_output_ch *outch =
-			vfe32_get_ch(path, vfe32_ctrl->share_ctrl);
-		outch->free_buf = *((struct msm_free_buf *)data);
-	}
-	break;
-
-	case CMD_SNAP_BUF_RELEASE:
-		break;
-
-	default:
-		pr_err("%s Unsupported AXI configuration %x ", __func__,
-			cmd->cmd_type);
-	break;
-	}
-vfe32_config_done:
-	kfree(scfg);
-	kfree(sack);
-	CDBG("%s done: rc = %d\n", __func__, (int) rc);
-	return rc;
-}
-
-static struct msm_cam_clk_info vfe32_clk_info[] = {
-	{"vfe_clk", 228570000},
-	{"vfe_pclk", -1},
-	{"csi_vfe_clk", -1},
-};
-
-static int msm_axi_subdev_s_crystal_freq(struct v4l2_subdev *sd,
-						u32 freq, u32 flags)
-{
-	int rc = 0;
-	int round_rate;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	if (axi_ctrl->share_ctrl->dual_enabled) {
-		CDBG("%s Dual camera Enabled hence returning "\
-			"without clock change\n", __func__);
-		return rc;
-	}
-	round_rate = clk_round_rate(axi_ctrl->vfe_clk[0], freq);
-	if (rc < 0) {
-		pr_err("%s: clk_round_rate failed %d\n",
-					__func__, rc);
-		return rc;
-	}
-
-	vfe_clk_rate = round_rate;
-	rc = clk_set_rate(axi_ctrl->vfe_clk[0], round_rate);
-	if (rc < 0)
-		pr_err("%s: clk_set_rate failed %d\n",
-					__func__, rc);
-
-	return rc;
-}
-
-static const struct v4l2_subdev_core_ops msm_vfe_subdev_core_ops = {
-	.ioctl = msm_vfe_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_ops msm_vfe_subdev_ops = {
-	.core = &msm_vfe_subdev_core_ops,
-};
-
-#if defined(CONFIG_MSM_IOMMU) && defined(VFE_IOMMU_FAULT_HANDLER)
-static int vfe_iommu_fault_handler(struct iommu_domain *domain,
-		struct device *dev, unsigned long iova, int flags)
-{
-	pr_err("iommu page fault has happened\n");
-        atomic_set(&fault_recovery, 1);
-	return -ENOSYS;
-}
-#endif
-
-int msm_axi_subdev_init(struct v4l2_subdev *sd,
-	uint8_t dual_enabled)
-{
-	int rc = 0;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	struct msm_cam_media_controller *mctl =
-		v4l2_get_subdev_hostdata(sd);
-	if (mctl == NULL) {
-		rc = -EINVAL;
-		goto mctl_failed;
-	}
-
-	axi_ctrl->share_ctrl->axi_ref_cnt++;
-	if (axi_ctrl->share_ctrl->axi_ref_cnt > 1)
-		return rc;
-	axi_ctrl->share_ctrl->dual_enabled = dual_enabled;
-	axi_ctrl->share_ctrl->lp_mode = 0;
-        atomic_set(&fault_recovery, 0);
-	spin_lock_init(&axi_ctrl->tasklet_lock);
-	INIT_LIST_HEAD(&axi_ctrl->tasklet_q);
-	spin_lock_init(&axi_ctrl->share_ctrl->sd_notify_lock);
-
-	axi_ctrl->share_ctrl->vfebase = ioremap(axi_ctrl->vfemem->start,
-		resource_size(axi_ctrl->vfemem));
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		rc = -ENOMEM;
-		pr_err("%s: vfe ioremap failed\n", __func__);
-		goto remap_failed;
-	}
-
-	if (axi_ctrl->fs_vfe) {
-		rc = regulator_enable(axi_ctrl->fs_vfe);
-		if (rc) {
-			pr_err("%s: Regulator enable failed\n",	__func__);
-			goto fs_failed;
-		}
-	}
-
-	rc = msm_cam_clk_enable(&axi_ctrl->pdev->dev, vfe32_clk_info,
-			axi_ctrl->vfe_clk, ARRAY_SIZE(vfe32_clk_info), 1);
-	if (rc < 0)
-		goto clk_enable_failed;
-
-#ifdef CONFIG_MSM_IOMMU
-	rc = iommu_attach_device(mctl->domain, axi_ctrl->iommu_ctx_imgwr);
-	if (rc < 0) {
-		pr_err("%s: imgwr attach failed rc = %d\n", __func__, rc);
-		rc = -ENODEV;
-		goto device_imgwr_attach_failed;
-	}
-	rc = iommu_attach_device(mctl->domain, axi_ctrl->iommu_ctx_misc);
-	if (rc < 0) {
-		pr_err("%s: misc attach failed rc = %d\n", __func__, rc);
-		rc = -ENODEV;
-		goto device_misc_attach_failed;
-	}
-#ifdef VFE_IOMMU_FAULT_HANDLER
-	iommu_set_fault_handler(mctl->domain,
-                        vfe_iommu_fault_handler);
-#endif
-
-#endif
-
-	msm_camio_bus_scale_cfg(
-		mctl->sdata->pdata->cam_bus_scale_table, S_INIT);
-
-	CDBG("%s: axi_ctrl->share_ctrl->dual_enabled ? = %d\n", __func__,
-			axi_ctrl->share_ctrl->dual_enabled);
-	if (axi_ctrl->share_ctrl->dual_enabled){
-		pr_info("%s: Scaling bus config for dual bus vectors\n",
-			__func__);
-		msm_camio_bus_scale_cfg(
-			mctl->sdata->pdata->cam_bus_scale_table, S_DUAL);
-	} else
-		msm_camio_bus_scale_cfg(
-			mctl->sdata->pdata->cam_bus_scale_table, S_PREVIEW);
-
-	if (msm_camera_io_r(
-		axi_ctrl->share_ctrl->vfebase + V32_GET_HW_VERSION_OFF) ==
-		VFE32_HW_NUMBER)
-		axi_ctrl->share_ctrl->register_total = VFE32_REGISTER_TOTAL;
-	else
-		axi_ctrl->share_ctrl->register_total = VFE33_REGISTER_TOTAL;
-
-	spin_lock_init(&axi_ctrl->share_ctrl->stop_flag_lock);
-	spin_lock_init(&axi_ctrl->share_ctrl->update_ack_lock);
-	spin_lock_init(&axi_ctrl->share_ctrl->start_ack_lock);
-
-	enable_irq(axi_ctrl->vfeirq->start);
-
-	return rc;
-
-#ifdef CONFIG_MSM_IOMMU
-device_misc_attach_failed:
-	iommu_detach_device(mctl->domain, axi_ctrl->iommu_ctx_imgwr);
-device_imgwr_attach_failed:
-#endif
-	msm_cam_clk_enable(&axi_ctrl->pdev->dev, vfe32_clk_info,
-			axi_ctrl->vfe_clk, ARRAY_SIZE(vfe32_clk_info), 0);
-clk_enable_failed:
-	if (axi_ctrl->fs_vfe)
-		regulator_disable(axi_ctrl->fs_vfe);
-fs_failed:
-	iounmap(axi_ctrl->share_ctrl->vfebase);
-	axi_ctrl->share_ctrl->vfebase = NULL;
-remap_failed:
-mctl_failed:
-	return rc;
-}
-
-int msm_vfe_subdev_init(struct v4l2_subdev *sd)
-{
-	int rc = 0;
-	struct vfe32_ctrl_type *vfe32_ctrl =
-		(struct vfe32_ctrl_type *)v4l2_get_subdevdata(sd);
-
-	spin_lock_init(&vfe32_ctrl->state_lock);
-	spin_lock_init(&vfe32_ctrl->stats_bufq_lock);
-
-	vfe32_ctrl->update_linear = false;
-	vfe32_ctrl->update_rolloff = false;
-	vfe32_ctrl->update_la = false;
-	vfe32_ctrl->update_gamma = false;
-
-	if (vfe32_ctrl->share_ctrl->dual_enabled)
-		vfe32_ctrl->vfe_sof_count_enable = false;
-	else
-		vfe32_ctrl->vfe_sof_count_enable = true;
-
-	vfe32_ctrl->hfr_mode = HFR_MODE_OFF;
-	vfe32_ctrl->share_ctrl->rdi_comp = VFE_RDI_COMPOSITE;
-
-	memset(&vfe32_ctrl->stats_ctrl, 0,
-		sizeof(struct msm_stats_bufq_ctrl));
-	memset(&vfe32_ctrl->stats_ops, 0, sizeof(struct msm_stats_ops));
-
-	return rc;
-}
-
-void msm_axi_subdev_release(struct v4l2_subdev *sd)
-{
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	struct msm_cam_media_controller *pmctl =
-		v4l2_get_subdev_hostdata(sd);
-
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return;
-	}
-
-	axi_ctrl->share_ctrl->axi_ref_cnt--;
-	if (axi_ctrl->share_ctrl->axi_ref_cnt > 0)
-		return;
-
-        atomic_set(&fault_recovery, 0);
-	axi_clear_all_interrupts(axi_ctrl->share_ctrl);
-
-	axi_ctrl->share_ctrl->dual_enabled = 0;
-	disable_irq(axi_ctrl->vfeirq->start);
-	tasklet_kill(&axi_ctrl->vfe32_tasklet);
-#ifdef CONFIG_MSM_IOMMU
-	iommu_detach_device(pmctl->domain, axi_ctrl->iommu_ctx_misc);
-	iommu_detach_device(pmctl->domain, axi_ctrl->iommu_ctx_imgwr);
-#endif
-	msm_cam_clk_enable(&axi_ctrl->pdev->dev, vfe32_clk_info,
-			axi_ctrl->vfe_clk, ARRAY_SIZE(vfe32_clk_info), 0);
-	if (axi_ctrl->fs_vfe)
-		regulator_disable(axi_ctrl->fs_vfe);
-
-	iounmap(axi_ctrl->share_ctrl->vfebase);
-	axi_ctrl->share_ctrl->vfebase = NULL;
-
-	if (atomic_read(&irq_cnt))
-		pr_warning("%s, Warning IRQ Count not ZERO\n", __func__);
-
-	msm_camio_bus_scale_cfg(
-		pmctl->sdata->pdata->cam_bus_scale_table, S_EXIT);
-
-}
-
-void msm_vfe_subdev_release(struct v4l2_subdev *sd)
-{
-	struct vfe32_ctrl_type *vfe32_ctrl =
-		(struct vfe32_ctrl_type *)v4l2_get_subdevdata(sd);
-	CDBG("vfe subdev release %p\n",
-		vfe32_ctrl->share_ctrl->vfebase);
-}
-
-int msm_axi_set_low_power_mode(struct v4l2_subdev *sd, void *arg)
-{
-	uint8_t lp_mode = 0;
-	int rc = 0;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	if (copy_from_user(&lp_mode,
-		(void __user *)(arg),
-		sizeof(uint8_t))) {
-		rc = -EFAULT;
-		return rc;
-	}
-	axi_ctrl->share_ctrl->lp_mode = lp_mode;
-	if (lp_mode)
-		axi_ctrl->share_ctrl->dual_enabled = 0;
-	else
-		axi_ctrl->share_ctrl->dual_enabled = 1;
-	return rc;
-}
-
-void axi_abort(struct axi_ctrl_t *axi_ctrl)
-{
-	uint8_t  axi_busy_flag = true;
-	unsigned long flags;
-	/* axi halt command. */
-
-	spin_lock_irqsave(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-	axi_ctrl->share_ctrl->stop_ack_pending  = TRUE;
-	spin_unlock_irqrestore(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-	msm_camera_io_w(AXI_HALT,
-		axi_ctrl->share_ctrl->vfebase + VFE_AXI_CMD);
-	wmb();
-	while (axi_busy_flag) {
-		if (msm_camera_io_r(
-			axi_ctrl->share_ctrl->vfebase + VFE_AXI_STATUS) & 0x1)
-			axi_busy_flag = false;
-	}
-	/* Ensure the write order while writing
-	* to the command register using the barrier */
-	msm_camera_io_w_mb(AXI_HALT_CLEAR,
-		axi_ctrl->share_ctrl->vfebase + VFE_AXI_CMD);
-
-	/* after axi halt, then ok to apply global reset.
-	* enable reset_ack and async timer interrupt only while
-	* stopping the pipeline.*/
-	msm_camera_io_w(0xf0000000,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(VFE_IMASK_WHILE_STOPPING_1,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* Ensure the write order while writing
-	* to the command register using the barrier */
-	msm_camera_io_w_mb(VFE_RESET_UPON_STOP_CMD,
-		axi_ctrl->share_ctrl->vfebase + VFE_GLOBAL_RESET);
-	if (axi_ctrl->share_ctrl->sync_abort)
-		wait_for_completion_interruptible(
-			&axi_ctrl->share_ctrl->reset_complete);
-}
-
-int axi_config_buffers(struct axi_ctrl_t *axi_ctrl,
-	struct msm_camera_vfe_params_t vfe_params)
-{
-	uint16_t vfe_mode = axi_ctrl->share_ctrl->current_mode
-			& ~(VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI1|
-				VFE_OUTPUTS_RDI2);
-	int rc = 0;
-	pr_info("%s: cmd type %d, axi mode %d\n", __func__,
-		vfe_params.cmd_type, axi_ctrl->share_ctrl->current_mode);
-	switch (vfe_params.cmd_type) {
-	case AXI_CMD_PREVIEW:
-		if (vfe_mode) {
-			if ((axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_PREVIEW_AND_VIDEO) ||
-				(axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_PREVIEW))
-				/* Configure primary channel */
-				rc = configure_pingpong_buffers(
-					VFE_MSG_START,
-					VFE_MSG_OUTPUT_PRIMARY,
-					axi_ctrl);
-			else
-			/* Configure secondary channel */
-				rc = configure_pingpong_buffers(
-					VFE_MSG_START,
-					VFE_MSG_OUTPUT_SECONDARY,
-					axi_ctrl);
-		}
-		if (axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_RDI0){
-			rc = configure_pingpong_buffers(
-				VFE_MSG_START, VFE_MSG_OUTPUT_TERTIARY1,
-				axi_ctrl);
-		}
-		if (axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_RDI1){
-			rc = configure_pingpong_buffers(
-				VFE_MSG_START, VFE_MSG_OUTPUT_TERTIARY2,
-				axi_ctrl);
-		}
-		if (axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_RDI2)
-			rc = configure_pingpong_buffers(
-				VFE_MSG_START, VFE_MSG_OUTPUT_TERTIARY3,
-				axi_ctrl);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers for preview",
-				__func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-		break;
-	case AXI_CMD_RAW_CAPTURE:
-		rc = configure_pingpong_buffers(
-			VFE_MSG_CAPTURE, VFE_MSG_OUTPUT_PRIMARY,
-			axi_ctrl);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers for snapshot",
-				__func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-		break;
-	case AXI_CMD_ZSL:
-		rc = configure_pingpong_buffers(VFE_MSG_START,
-			VFE_MSG_OUTPUT_PRIMARY, axi_ctrl);
-		if (rc < 0)
-			goto config_done;
-		rc = configure_pingpong_buffers(VFE_MSG_START,
-			VFE_MSG_OUTPUT_SECONDARY, axi_ctrl);
-		if (rc < 0)
-			goto config_done;
-		break;
-	case AXI_CMD_RECORD:
-		if (axi_ctrl->share_ctrl->current_mode &
-			VFE_OUTPUTS_PREVIEW_AND_VIDEO) {
-			axi_ctrl->share_ctrl->outpath.out1.inst_handle =
-				vfe_params.inst_handle;
-			rc = configure_pingpong_buffers(
-				VFE_MSG_START_RECORDING,
-				VFE_MSG_OUTPUT_SECONDARY,
-				axi_ctrl);
-		} else if (axi_ctrl->share_ctrl->current_mode &
-			VFE_OUTPUTS_VIDEO_AND_PREVIEW) {
-			axi_ctrl->share_ctrl->outpath.out0.inst_handle =
-				vfe_params.inst_handle;
-			rc = configure_pingpong_buffers(
-				VFE_MSG_START_RECORDING,
-				VFE_MSG_OUTPUT_PRIMARY,
-				axi_ctrl);
-		}
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers for video",
-				__func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-		break;
-	case AXI_CMD_LIVESHOT:
-		axi_ctrl->share_ctrl->outpath.out0.inst_handle =
-			vfe_params.inst_handle;
-		rc = configure_pingpong_buffers(VFE_MSG_CAPTURE,
-					VFE_MSG_OUTPUT_PRIMARY, axi_ctrl);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers for primary output",
-				__func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-		break;
-	case AXI_CMD_CAPTURE:
-		if (vfe_mode) {
-			if (axi_ctrl->share_ctrl->current_mode ==
-				VFE_OUTPUTS_JPEG_AND_THUMB ||
-			axi_ctrl->share_ctrl->current_mode ==
-				VFE_OUTPUTS_THUMB_AND_JPEG) {
-
-				/* Configure primary channel for JPEG */
-				rc = configure_pingpong_buffers(
-					VFE_MSG_JPEG_CAPTURE,
-					VFE_MSG_OUTPUT_PRIMARY,
-					axi_ctrl);
-			} else {
-				/* Configure primary channel */
-				rc = configure_pingpong_buffers(
-					VFE_MSG_CAPTURE,
-					VFE_MSG_OUTPUT_PRIMARY,
-					axi_ctrl);
-			}
-			if (rc < 0) {
-				pr_err("%s error configuring pingpong buffers for primary output",
-					__func__);
-				rc = -EINVAL;
-				goto config_done;
-			}
-			/* Configure secondary channel */
-			rc = configure_pingpong_buffers(
-					VFE_MSG_CAPTURE,
-					VFE_MSG_OUTPUT_SECONDARY,
-					axi_ctrl);
-			if (rc < 0) {
-				pr_err("%s error configuring pingpong buffers for secondary output",
-					__func__);
-				rc = -EINVAL;
-				goto config_done;
-			}
-		}
-
-		if (axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_RDI0)
-			rc = configure_pingpong_buffers(
-				VFE_MSG_CAPTURE, VFE_MSG_OUTPUT_TERTIARY1,
-				axi_ctrl);
-		if (axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_RDI1)
-			rc = configure_pingpong_buffers(
-				VFE_MSG_CAPTURE, VFE_MSG_OUTPUT_TERTIARY2,
-				axi_ctrl);
-		if (axi_ctrl->share_ctrl->current_mode &
-			VFE_OUTPUTS_RDI2)
-			rc = configure_pingpong_buffers(
-				VFE_MSG_CAPTURE, VFE_MSG_OUTPUT_TERTIARY3,
-				axi_ctrl);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-
-	}
-config_done:
-	return rc;
-}
-
-void axi_start(struct msm_cam_media_controller *pmctl,
-	struct axi_ctrl_t *axi_ctrl, struct msm_camera_vfe_params_t vfe_params)
-{
-	int rc = 0;
-	uint32_t reg_update = 0;
-	uint32_t vfe_mode =
-		(axi_ctrl->share_ctrl->current_mode &
-		~(VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI1|VFE_OUTPUTS_RDI2));
-	CDBG("axi start = %d\n",
-		axi_ctrl->share_ctrl->current_mode);
-	rc = axi_config_buffers(axi_ctrl, vfe_params);
-	if (rc < 0)
-		return;
-
-	switch (vfe_params.cmd_type) {
-	case AXI_CMD_PREVIEW:
-		if (axi_ctrl->share_ctrl->lp_mode)
-			msm_camio_bus_scale_cfg(
-				pmctl->sdata->pdata->cam_bus_scale_table,
-				S_LOW_POWER);
-		else if (!axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-				pmctl->sdata->pdata->cam_bus_scale_table,
-				S_PREVIEW);
-		else if(axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-				pmctl->sdata->pdata->cam_bus_scale_table,
-				S_DUAL);
-		break;
-	case AXI_CMD_CAPTURE:
-	case AXI_CMD_RAW_CAPTURE:
-		if (!axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-			pmctl->sdata->pdata->cam_bus_scale_table, S_CAPTURE);
-		break;
-	case AXI_CMD_RECORD:
-		if (!axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-			pmctl->sdata->pdata->cam_bus_scale_table, S_VIDEO);
-		return;
-	case AXI_CMD_ZSL:
-		if (axi_ctrl->share_ctrl->lp_mode)
-			msm_camio_bus_scale_cfg(
-				pmctl->sdata->pdata->cam_bus_scale_table,
-				S_LOW_POWER);
-		else if (!axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-				pmctl->sdata->pdata->cam_bus_scale_table,
-				S_ZSL);
-		else if(axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-				pmctl->sdata->pdata->cam_bus_scale_table,
-				S_DUAL);
-		break;
-	case AXI_CMD_LIVESHOT:
-		if (!axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-			pmctl->sdata->pdata->cam_bus_scale_table, S_LIVESHOT);
-		return;
-	default:
-		return;
-	}
-	axi_enable_wm_irq(axi_ctrl->share_ctrl);
-
-	switch (vfe_params.cmd_type) {
-	case AXI_CMD_RAW_CAPTURE:
-		msm_camera_io_w((
-			0x1 << axi_ctrl->share_ctrl->outpath.out0.ch0),
-			axi_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-		msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-			+ vfe32_AXI_WM_CFG[axi_ctrl->
-			share_ctrl->outpath.out0.ch0]);
-		break;
-	case AXI_CMD_PREVIEW: {
-		switch (vfe_mode) {
-		case VFE_OUTPUTS_PREVIEW:
-		case VFE_OUTPUTS_PREVIEW_AND_VIDEO:
-			if (axi_ctrl->share_ctrl->outpath.output_mode &
-				VFE32_OUTPUT_MODE_PRIMARY) {
-				msm_camera_io_w((
-					0x1 << axi_ctrl->share_ctrl->
-							outpath.out0.ch0 |
-					0x1 << axi_ctrl->share_ctrl->
-							outpath.out0.ch1),
-					axi_ctrl->share_ctrl->vfebase +
-							VFE_BUS_CMD);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch1]);
-
-
-			} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-					VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-				msm_camera_io_w((
-					0x1 << axi_ctrl->share_ctrl->
-							outpath.out0.ch0 |
-					0x1 << axi_ctrl->share_ctrl->
-							outpath.out0.ch1 |
-					0x1 << axi_ctrl->share_ctrl->
-							outpath.out0.ch2),
-					axi_ctrl->share_ctrl->vfebase +
-							VFE_BUS_CMD);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch1]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch2]);
-			}
-			break;
-		default:
-			if (axi_ctrl->share_ctrl->outpath.output_mode &
-				VFE32_OUTPUT_MODE_SECONDARY) {
-				msm_camera_io_w((
-					0x1 << axi_ctrl->share_ctrl->
-						outpath.out1.ch0 |
-					0x1 << axi_ctrl->share_ctrl->
-						outpath.out1.ch1),
-					axi_ctrl->share_ctrl->vfebase +
-						VFE_BUS_CMD);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out1.ch0]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out1.ch1]);
-			} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-				VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-				msm_camera_io_w((
-					0x1 << axi_ctrl->share_ctrl->
-							outpath.out1.ch0 |
-					0x1 << axi_ctrl->share_ctrl->
-							outpath.out1.ch1 |
-					0x1 << axi_ctrl->share_ctrl->
-							outpath.out1.ch2),
-					axi_ctrl->share_ctrl->vfebase +
-							VFE_BUS_CMD);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out1.ch0]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out1.ch1]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe32_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out1.ch2]);
-			}
-			break;
-			}
-		}
-		break;
-	default:
-		if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE32_OUTPUT_MODE_PRIMARY) {
-			msm_camera_io_w((
-				0x1 << axi_ctrl->share_ctrl->outpath.out0.ch0 |
-				0x1 << axi_ctrl->share_ctrl->outpath.out0.ch1),
-				axi_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch1]);
-		} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-				VFE32_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-			msm_camera_io_w((
-				0x1 << axi_ctrl->share_ctrl->outpath.out0.ch0 |
-				0x1 << axi_ctrl->share_ctrl->outpath.out0.ch1 |
-				0x1 << axi_ctrl->share_ctrl->outpath.out0.ch2),
-				axi_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch1]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch2]);
-		}
-
-		if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE32_OUTPUT_MODE_SECONDARY) {
-			msm_camera_io_w((
-				0x1 << axi_ctrl->share_ctrl->outpath.out1.ch0 |
-				0x1 << axi_ctrl->share_ctrl->outpath.out1.ch1),
-				axi_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch1]);
-		} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE32_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-			msm_camera_io_w((
-				0x1 << axi_ctrl->share_ctrl->outpath.out1.ch0 |
-				0x1 << axi_ctrl->share_ctrl->outpath.out1.ch1 |
-				0x1 << axi_ctrl->share_ctrl->outpath.out1.ch2),
-				axi_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch1]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe32_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch2]);
-		}
-		break;
-	}
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI0) {
-		axi_ctrl->share_ctrl->outpath.out2.capture_cnt =
-						vfe_params.capture_count;
-		axi_ctrl->share_ctrl->rdi0_capture_count =
-						vfe_params.capture_count;
-		msm_camera_io_w((
-				0x1 << axi_ctrl->share_ctrl->outpath.out2.ch0),
-				axi_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-		msm_camera_io_w(0x3, axi_ctrl->share_ctrl->vfebase +
-			vfe32_AXI_WM_CFG[axi_ctrl->share_ctrl->
-			outpath.out2.ch0]);
-	}
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI1) {
-		axi_ctrl->share_ctrl->outpath.out3.capture_cnt =
-						vfe_params.capture_count;
-		axi_ctrl->share_ctrl->rdi1_capture_count =
-						vfe_params.capture_count;
-		msm_camera_io_w((
-				0x1 << axi_ctrl->share_ctrl->outpath.out3.ch0),
-				axi_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-		msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-			vfe32_AXI_WM_CFG[axi_ctrl->share_ctrl->
-			outpath.out3.ch0]);
-	}
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI2) {
-		axi_ctrl->share_ctrl->outpath.out4.capture_cnt =
-						vfe_params.capture_count;
-		axi_ctrl->share_ctrl->rdi2_capture_count =
-						vfe_params.capture_count;
-		msm_camera_io_w((
-				0x1 << axi_ctrl->share_ctrl->outpath.out4.ch0),
-				axi_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-		CDBG("AXI WM configured as frame based\n");
-		msm_camera_io_w(0x3, axi_ctrl->share_ctrl->vfebase +
-			vfe32_AXI_WM_CFG[axi_ctrl->share_ctrl->
-			outpath.out4.ch0]);
-	}
-
-	axi_enable_irq(axi_ctrl->share_ctrl);
-
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI0) {
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->rdi0_update_ack_pending,
-				0, 1))
-			reg_update |= 0x2;
-	}
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI1) {
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->rdi1_update_ack_pending,
-				0, 1))
-			reg_update |= 0x4;
-	}
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI2) {
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->rdi2_update_ack_pending,
-				0, 1))
-			reg_update |= 0x8;
-	}
-
-	if (vfe_mode) {
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->pix0_update_ack_pending,
-				0, 1))
-			reg_update |= 0x1;
-	}
-
-	msm_camera_io_w_mb(reg_update,
-			axi_ctrl->share_ctrl->vfebase +
-			VFE_REG_UPDATE_CMD);
-	axi_ctrl->share_ctrl->operation_mode |=
-		axi_ctrl->share_ctrl->current_mode;
-}
-
-void axi_stop(struct msm_cam_media_controller *pmctl,
-	struct axi_ctrl_t *axi_ctrl, struct msm_camera_vfe_params_t vfe_params)
-{
-	uint32_t reg_update = 0;
-	uint32_t vfe_mode =
-	axi_ctrl->share_ctrl->current_mode & ~(VFE_OUTPUTS_RDI0|
-		VFE_OUTPUTS_RDI1|VFE_OUTPUTS_RDI2);
-	switch (vfe_params.cmd_type) {
-	case AXI_CMD_PREVIEW:
-	case AXI_CMD_CAPTURE:
-	case AXI_CMD_RAW_CAPTURE:
-	case AXI_CMD_ZSL:
-		axi_ctrl->share_ctrl->cmd_type = vfe_params.cmd_type;
-		break;
-	case AXI_CMD_RECORD:
-		if (!axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-			pmctl->sdata->pdata->cam_bus_scale_table, S_PREVIEW);
-		return;
-	case AXI_CMD_LIVESHOT:
-		if (!axi_ctrl->share_ctrl->dual_enabled)
-			msm_camio_bus_scale_cfg(
-			pmctl->sdata->pdata->cam_bus_scale_table, S_VIDEO);
-		return;
-	default:
-		return;
-	}
-
-	if (axi_ctrl->share_ctrl->stop_immediately) {
-		axi_disable_irq(axi_ctrl->share_ctrl,
-			axi_ctrl->share_ctrl->current_mode);
-		axi_stop_process(axi_ctrl->share_ctrl);
-
-		if (axi_ctrl->share_ctrl->stream_error == 1) {
-			pr_err(" Indicate stream error");
-			vfe32_send_isp_msg(
-				&(axi_ctrl->share_ctrl->vfe32_ctrl->subdev),
-				axi_ctrl->share_ctrl->vfe32_ctrl->
-				share_ctrl->vfeFrameId,
-				MSG_ID_PREV_STOP_ACK);
-		}
-
-		return;
-	}
-
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI0) {
-		msm_camera_io_w(0, axi_ctrl->share_ctrl->vfebase +
-			vfe32_AXI_WM_CFG[axi_ctrl->share_ctrl->
-				outpath.out2.ch0]);
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->rdi0_update_ack_pending,
-				0, 2))
-			reg_update |= 0x2;
-	}
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI1) {
-		msm_camera_io_w(0, axi_ctrl->share_ctrl->vfebase +
-			vfe32_AXI_WM_CFG[axi_ctrl->share_ctrl->
-				outpath.out3.ch0]);
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->rdi1_update_ack_pending,
-				0, 2))
-			reg_update |= 0x4;
-	}
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI2) {
-		msm_camera_io_w(0, axi_ctrl->share_ctrl->vfebase +
-			vfe32_AXI_WM_CFG[axi_ctrl->share_ctrl->
-				outpath.out4.ch0]);
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->rdi2_update_ack_pending,
-				0, 2))
-			reg_update |= 0x8;
-	}
-	if (vfe_mode) {
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->pix0_update_ack_pending,
-				0, 2))
-			reg_update |= 0x1;
-	}
-	msm_camera_io_w_mb(reg_update,
-		axi_ctrl->share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-static int msm_axi_config(struct v4l2_subdev *sd, void __user *arg)
-{
-	struct msm_vfe_cfg_cmd cfgcmd;
-	struct msm_isp_cmd vfecmd;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	struct msm_cam_media_controller *pmctl =
-		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
-	int rc = 0, vfe_cmd_type = 0, rdi_mode = 0;
-
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return -EFAULT;
-	}
-	memset(&cfgcmd, 0, sizeof(struct msm_vfe_cfg_cmd));
-	if (NULL != arg) {
-		if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
-			ERR_COPY_FROM_USER();
-			return -EFAULT;
-		}
-	}
-	memset(&vfecmd, 0, sizeof(struct msm_isp_cmd));
-	if (NULL != cfgcmd.value) {
-		if (copy_from_user(&vfecmd,
-				(void __user *)(cfgcmd.value),
-				sizeof(vfecmd))) {
-			pr_err("%s %d: copy_from_user failed\n", __func__,
-				__LINE__);
-			return -EFAULT;
-		}
-	}
-
-	vfe_cmd_type = (cfgcmd.cmd_type & ~(CMD_AXI_CFG_TERT1|
-		CMD_AXI_CFG_TERT2 | CMD_AXI_CFG_TERT3));
-	switch (cfgcmd.cmd_type) {
-	case CMD_AXI_CFG_TERT1:{
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio)
-			return -ENOMEM;
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			return -EFAULT;
-		}
-		vfe32_config_axi(axi_ctrl, OUTPUT_TERT1, axio);
-		kfree(axio);
-		return rc;
-		}
-	case CMD_AXI_CFG_TERT2:{
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio)
-			return -ENOMEM;
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			return -EFAULT;
-		}
-		vfe32_config_axi(axi_ctrl, OUTPUT_TERT2, axio);
-		kfree(axio);
-		return rc;
-		}
-	case CMD_AXI_CFG_TERT3:{
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio)
-			return -ENOMEM;
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			return -EFAULT;
-		}
-		vfe32_config_axi(axi_ctrl, OUTPUT_TERT3, axio);
-		kfree(axio);
-		return rc;
-		}
-	case CMD_AXI_CFG_TERT1|CMD_AXI_CFG_TERT2:{
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio)
-			return -ENOMEM;
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			return -EFAULT;
-		}
-		vfe32_config_axi(axi_ctrl, OUTPUT_TERT1|OUTPUT_TERT2, axio);
-		kfree(axio);
-		return rc;
-		}
-	case CMD_AXI_CFG_TERT1|CMD_AXI_CFG_TERT3:{
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio)
-			return -ENOMEM;
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			return -EFAULT;
-		}
-		vfe32_config_axi(axi_ctrl, OUTPUT_TERT1|OUTPUT_TERT3, axio);
-		kfree(axio);
-		return rc;
-		}
-	case CMD_AXI_CFG_TERT2|CMD_AXI_CFG_TERT3:{
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio)
-			return -ENOMEM;
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			return -EFAULT;
-		}
-		vfe32_config_axi(axi_ctrl, OUTPUT_TERT2|OUTPUT_TERT3, axio);
-		kfree(axio);
-		return rc;
-		}
-	case CMD_AXI_CFG_TERT1|CMD_AXI_CFG_TERT2|CMD_AXI_CFG_TERT3:{
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio)
-			return -ENOMEM;
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			return -EFAULT;
-		}
-		vfe32_config_axi(axi_ctrl, OUTPUT_TERT1|OUTPUT_TERT2|
-			OUTPUT_TERT3, axio);
-		kfree(axio);
-		return rc;
-		}
-	default:
-		if (cfgcmd.cmd_type & CMD_AXI_CFG_TERT1)
-			rdi_mode |= OUTPUT_TERT1;
-		if (cfgcmd.cmd_type & CMD_AXI_CFG_TERT2)
-			rdi_mode |= OUTPUT_TERT2;
-		if (cfgcmd.cmd_type & CMD_AXI_CFG_TERT3)
-			rdi_mode |= OUTPUT_TERT3;
-	}
-	switch (vfe_cmd_type) {
-	case CMD_AXI_CFG_PRIM: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe32_config_axi(axi_ctrl, rdi_mode|OUTPUT_PRIM, axio);
-		kfree(axio);
-		break;
-		}
-	case CMD_AXI_CFG_PRIM_ALL_CHNLS: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe32_config_axi(axi_ctrl, rdi_mode|OUTPUT_PRIM_ALL_CHNLS,
-			axio);
-		kfree(axio);
-		break;
-		}
-	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe32_config_axi(axi_ctrl,
-			rdi_mode|OUTPUT_PRIM|OUTPUT_SEC, axio);
-		kfree(axio);
-		break;
-		}
-	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC_ALL_CHNLS: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe32_config_axi(axi_ctrl,
-			rdi_mode|OUTPUT_PRIM|OUTPUT_SEC_ALL_CHNLS, axio);
-		kfree(axio);
-		break;
-		}
-	case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe32_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe32_config_axi(axi_ctrl,
-			rdi_mode|OUTPUT_PRIM_ALL_CHNLS|OUTPUT_SEC, axio);
-		kfree(axio);
-		break;
-		}
-
-	case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC_ALL_CHNLS:
-		pr_err("%s Invalid/Unsupported AXI configuration %x",
-			__func__, cfgcmd.cmd_type);
-		break;
-	case CMD_AXI_START: {
-		struct msm_camera_vfe_params_t vfe_params;
-		if (copy_from_user(&vfe_params,
-				(void __user *)(vfecmd.value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				return -EFAULT;
-		}
-		axi_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-		axi_start(pmctl, axi_ctrl, vfe_params);
-		}
-		break;
-	case CMD_AXI_STOP: {
-		struct msm_camera_vfe_params_t vfe_params;
-		if (copy_from_user(&vfe_params,
-				(void __user *)(vfecmd.value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				return -EFAULT;
-		}
-		axi_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-		axi_ctrl->share_ctrl->stop_immediately =
-			vfe_params.stop_immediately;
-		axi_ctrl->share_ctrl->stream_error =
-			vfe_params.stream_error;
-		axi_stop(pmctl, axi_ctrl, vfe_params);
-		}
-		break;
-	case CMD_AXI_RESET: {
-		struct msm_camera_vfe_params_t vfe_params;
-		if (copy_from_user(&vfe_params,
-				(void __user *)(vfecmd.value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				return -EFAULT;
-		}
-		axi_reset(axi_ctrl, vfe_params);
-		}
-		break;
-	case CMD_AXI_ABORT:
-		if (copy_from_user(&axi_ctrl->share_ctrl->sync_abort,
-				(void __user *)(vfecmd.value),
-				sizeof(uint8_t))) {
-				return -EFAULT;
-		}
-		axi_abort(axi_ctrl);
-		break;
-	case CMD_AXI_STOP_RECOVERY:
-		pr_err("bus overflow recovery is stopped to avoid IOMMU page faults\n");
-		atomic_set(&fault_recovery, 1);
-		break;
-	default:
-		pr_err("%s Unsupported AXI configuration %x ", __func__,
-			cfgcmd.cmd_type);
-		break;
-	}
-	return rc;
-}
-
-static void msm_axi_process_irq(struct v4l2_subdev *sd, void *arg)
-{
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	uint32_t irqstatus = (uint32_t) arg;
-
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return;
-	}
-
-	/* next, check output path related interrupts. */
-	if (irqstatus &
-		VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK) {
-		CDBG("Image composite done 0 irq occured.\n");
-		vfe32_process_output_path_irq_0(axi_ctrl);
-	}
-	if (irqstatus &
-		VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK) {
-		CDBG("Image composite done 1 irq occured.\n");
-		vfe32_process_output_path_irq_1(axi_ctrl);
-	}
-	if (irqstatus &
-		VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE2_MASK &&
-		(axi_ctrl->share_ctrl->rdi_comp == VFE_RDI_COMPOSITE)) {
-		CDBG("Image composite done 2 irq occured.\n");
-		vfe32_process_output_path_irq_rdi0_and_rdi1(axi_ctrl);
-	}
-
-	if (axi_ctrl->share_ctrl->comp_output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY1 &&
-		(axi_ctrl->share_ctrl->rdi_comp == VFE_RDI_NON_COMPOSITE)) {
-		if (irqstatus & (0x1 << (axi_ctrl->share_ctrl->outpath.out2.ch0
-			+ VFE_WM_OFFSET))) {
-			CDBG("VFE32_OUTPUT_MODE_TERTIARY1\n");
-			vfe32_process_output_path_irq_rdi0(axi_ctrl);
-		}
-	}
-	if (axi_ctrl->share_ctrl->comp_output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY2 &&
-		(axi_ctrl->share_ctrl->rdi_comp == VFE_RDI_NON_COMPOSITE)) {
-		if (irqstatus & (0x1 << (axi_ctrl->share_ctrl->outpath.out3.ch0
-			+ VFE_WM_OFFSET))) {
-			CDBG("VFE32_OUTPUT_MODE_TERTIARY2\n");
-			vfe32_process_output_path_irq_rdi1(axi_ctrl);
-		}
-	}
-	if (axi_ctrl->share_ctrl->comp_output_mode &
-		VFE32_OUTPUT_MODE_TERTIARY3) {
-		CDBG("Before process output path" \
-			"of RDI2 irqstatus %x\n", irqstatus);
-		if (irqstatus & (0x1 << (axi_ctrl->share_ctrl->outpath.out4.ch0
-			+ VFE_WM_OFFSET)))
-			vfe32_process_output_path_irq_rdi2(axi_ctrl);
-	}
-
-	/* in snapshot mode if done then send
-	snapshot done message */
-	if (
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_THUMB_AND_MAIN ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_MAIN_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_THUMB_AND_JPEG ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_JPEG_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_RAW) {
-		if ((axi_ctrl->share_ctrl->outpath.out0.capture_cnt == 0)
-				&& (axi_ctrl->share_ctrl->outpath.out1.
-				capture_cnt == 0)) {
-			uint32_t mode =
-				(axi_ctrl->share_ctrl->operation_mode &
-				~(VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI1|
-				  VFE_OUTPUTS_RDI2));
-			uint16_t output_mode =
-			axi_ctrl->share_ctrl->comp_output_mode &
-				~(VFE32_OUTPUT_MODE_TERTIARY1|
-				VFE32_OUTPUT_MODE_TERTIARY2|
-				  VFE32_OUTPUT_MODE_TERTIARY3);
-			if (!axi_ctrl->share_ctrl->dual_enabled)
-				msm_camera_io_w_mb(
-					CAMIF_COMMAND_STOP_IMMEDIATELY,
-					axi_ctrl->share_ctrl->vfebase +
-					VFE_CAMIF_COMMAND);
-			axi_disable_wm_irq(axi_ctrl->share_ctrl, output_mode);
-			axi_disable_irq(axi_ctrl->share_ctrl, mode);
-			vfe32_send_isp_msg(&axi_ctrl->subdev,
-				axi_ctrl->share_ctrl->vfeFrameId,
-				MSG_ID_PIX0_UPDATE_ACK);
-			axi_ctrl->share_ctrl->outpath.out0.
-				capture_cnt = -1;
-			axi_ctrl->share_ctrl->outpath.out1.
-				capture_cnt = -1;
-			axi_ctrl->share_ctrl->comp_output_mode &=
-				(VFE32_OUTPUT_MODE_TERTIARY1|
-				VFE32_OUTPUT_MODE_TERTIARY2|
-				 VFE32_OUTPUT_MODE_TERTIARY3);
-		}
-	}
-
-	if (axi_ctrl->share_ctrl->outpath.out2.capture_cnt == 0) {
-		axi_ctrl->share_ctrl->comp_output_mode &=
-				~VFE32_OUTPUT_MODE_TERTIARY1;
-		axi_ctrl->share_ctrl->outpath.out2.capture_cnt = -1;
-	}
-
-	if (axi_ctrl->share_ctrl->outpath.out3.capture_cnt == 0) {
-		axi_ctrl->share_ctrl->comp_output_mode &=
-				~VFE32_OUTPUT_MODE_TERTIARY2;
-		axi_ctrl->share_ctrl->outpath.out3.capture_cnt = -1;
-	}
-
-	if (axi_ctrl->share_ctrl->outpath.out4.capture_cnt == 0) {
-		axi_ctrl->share_ctrl->comp_output_mode &=
-				~VFE32_OUTPUT_MODE_TERTIARY3;
-		axi_ctrl->share_ctrl->outpath.out4.capture_cnt = -1;
-	}
-}
-
-static int msm_axi_buf_cfg(struct v4l2_subdev *sd, void __user *arg)
-{
-	struct msm_camvfe_params *vfe_params =
-		(struct msm_camvfe_params *)arg;
-	struct msm_vfe_cfg_cmd *cmd = vfe_params->vfe_cfg;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	void *data = vfe_params->data;
-	int rc = 0;
-
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return -EFAULT;
-	}
-
-	switch (cmd->cmd_type) {
-	case CMD_CONFIG_PING_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe32_output_ch *outch =
-			vfe32_get_ch(path, axi_ctrl->share_ctrl);
-		outch->ping = *((struct msm_free_buf *)data);
-	}
-		break;
-
-	case CMD_CONFIG_PONG_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe32_output_ch *outch =
-			vfe32_get_ch(path, axi_ctrl->share_ctrl);
-		outch->pong = *((struct msm_free_buf *)data);
-	}
-		break;
-
-	case CMD_CONFIG_FREE_BUF_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe32_output_ch *outch =
-			vfe32_get_ch(path, axi_ctrl->share_ctrl);
-		outch->free_buf = *((struct msm_free_buf *)data);
-	}
-		break;
-	default:
-		pr_err("%s Unsupported AXI Buf config %x ", __func__,
-			cmd->cmd_type);
-	}
-	return rc;
-};
-
-static const struct v4l2_subdev_internal_ops msm_vfe_internal_ops;
-
-static long msm_axi_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int cmd, void *arg)
-{
-	int rc = -ENOIOCTLCMD;
-	switch (cmd) {
-	case VIDIOC_MSM_AXI_INIT: {
-		uint8_t dual_enabled;
-		if (copy_from_user(&dual_enabled,
-				(void __user *)(arg),
-				sizeof(uint8_t))) {
-				rc = -EFAULT;
-				break;
-		}
-		rc = msm_axi_subdev_init(sd, dual_enabled);
-		}
-		break;
-	case VIDIOC_MSM_AXI_LOW_POWER_MODE:
-		rc = msm_axi_set_low_power_mode(sd, arg);
-		break;
-	case VIDIOC_MSM_AXI_CFG:
-		rc = msm_axi_config(sd, arg);
-		break;
-	case VIDIOC_MSM_AXI_IRQ:
-		msm_axi_process_irq(sd, arg);
-		rc = 0;
-		break;
-	case VIDIOC_MSM_AXI_BUF_CFG:
-		msm_axi_buf_cfg(sd, arg);
-		rc = 0;
-		break;
-	case VIDIOC_MSM_AXI_RELEASE:
-		msm_axi_subdev_release(sd);
-		rc = 0;
-		break;
-	case VIDIOC_MSM_AXI_RDI_COUNT_UPDATE: {
-		struct rdi_count_msg *msg = (struct rdi_count_msg *)arg;
-		struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-		switch (msg->rdi_interface) {
-		case RDI_0:
-			axi_ctrl->share_ctrl->rdi0FrameId = msg->count;
-			rc = 0;
-			break;
-		case RDI_1:
-			axi_ctrl->share_ctrl->rdi1FrameId = msg->count;
-			rc = 0;
-			break;
-		case RDI_2:
-			axi_ctrl->share_ctrl->rdi2FrameId = msg->count;
-			rc = 0;
-			break;
-		default:
-			pr_err("%s: Incorrect interface sent\n", __func__);
-			rc = -EINVAL;
-			break;
-		}
-		break;
-	}
-	default:
-		pr_err("%s: command %d not found\n", __func__,
-						_IOC_NR(cmd));
-		break;
-	}
-	return rc;
-}
-
-static const struct v4l2_subdev_core_ops msm_axi_subdev_core_ops = {
-	.ioctl = msm_axi_subdev_ioctl,
-	.interrupt_service_routine = msm_axi_subdev_isr_routine,
-};
-
-static const struct v4l2_subdev_video_ops msm_axi_subdev_video_ops = {
-	.s_crystal_freq = msm_axi_subdev_s_crystal_freq,
-};
-
-static const struct v4l2_subdev_ops msm_axi_subdev_ops = {
-	.core = &msm_axi_subdev_core_ops,
-	.video = &msm_axi_subdev_video_ops,
-};
-
-static const struct v4l2_subdev_internal_ops msm_axi_internal_ops;
-
-static int __devinit vfe32_probe(struct platform_device *pdev)
-{
-	int rc = 0;
-	struct axi_ctrl_t *axi_ctrl;
-	struct vfe32_ctrl_type *vfe32_ctrl;
-	struct vfe_share_ctrl_t *share_ctrl;
-	struct intr_table_entry irq_req;
-	struct msm_cam_subdev_info sd_info;
-
-	CDBG("%s: device id = %d\n", __func__, pdev->id);
-
-	share_ctrl = kzalloc(sizeof(struct vfe_share_ctrl_t), GFP_KERNEL);
-	if (!share_ctrl) {
-		pr_err("%s: no enough memory\n", __func__);
-		return -ENOMEM;
-	}
-
-	axi_ctrl = kzalloc(sizeof(struct axi_ctrl_t), GFP_KERNEL);
-	if (!axi_ctrl) {
-		pr_err("%s: no enough memory\n", __func__);
-		kfree(share_ctrl);
-		return -ENOMEM;
-	}
-
-	vfe32_ctrl = kzalloc(sizeof(struct vfe32_ctrl_type), GFP_KERNEL);
-	if (!vfe32_ctrl) {
-		pr_err("%s: no enough memory\n", __func__);
-		kfree(share_ctrl);
-		kfree(axi_ctrl);
-		return -ENOMEM;
-	}
-
-	share_ctrl->axi_ctrl = axi_ctrl;
-	share_ctrl->vfe32_ctrl = vfe32_ctrl;
-	axi_ctrl->share_ctrl = share_ctrl;
-	vfe32_ctrl->share_ctrl = share_ctrl;
-	axi_ctrl->share_ctrl->axi_ref_cnt = 0;
-	v4l2_subdev_init(&axi_ctrl->subdev, &msm_axi_subdev_ops);
-	axi_ctrl->subdev.internal_ops = &msm_axi_internal_ops;
-	axi_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(axi_ctrl->subdev.name,
-			 sizeof(axi_ctrl->subdev.name), "axi");
-	v4l2_set_subdevdata(&axi_ctrl->subdev, axi_ctrl);
-	axi_ctrl->pdev = pdev;
-
-	sd_info.sdev_type = AXI_DEV;
-	sd_info.sd_index = 0;
-	sd_info.irq_num = 0;
-	msm_cam_register_subdev_node(&axi_ctrl->subdev, &sd_info);
-
-	media_entity_init(&axi_ctrl->subdev.entity, 0, NULL, 0);
-	axi_ctrl->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	axi_ctrl->subdev.entity.group_id = AXI_DEV;
-	axi_ctrl->subdev.entity.name = pdev->name;
-	axi_ctrl->subdev.entity.revision = axi_ctrl->subdev.devnode->num;
-
-	v4l2_subdev_init(&vfe32_ctrl->subdev, &msm_vfe_subdev_ops);
-	vfe32_ctrl->subdev.internal_ops = &msm_vfe_internal_ops;
-	vfe32_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(vfe32_ctrl->subdev.name,
-			 sizeof(vfe32_ctrl->subdev.name), "vfe3.2");
-	v4l2_set_subdevdata(&vfe32_ctrl->subdev, vfe32_ctrl);
-	platform_set_drvdata(pdev, &vfe32_ctrl->subdev);
-
-	axi_ctrl->vfemem = platform_get_resource_byname(pdev,
-					IORESOURCE_MEM, "vfe32");
-	if (!axi_ctrl->vfemem) {
-		pr_err("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto vfe32_no_resource;
-	}
-	axi_ctrl->vfeirq = platform_get_resource_byname(pdev,
-					IORESOURCE_IRQ, "vfe32");
-	if (!axi_ctrl->vfeirq) {
-		pr_err("%s: no irq resource?\n", __func__);
-		rc = -ENODEV;
-		goto vfe32_no_resource;
-	}
-
-	axi_ctrl->vfeio = request_mem_region(axi_ctrl->vfemem->start,
-		resource_size(axi_ctrl->vfemem), pdev->name);
-	if (!axi_ctrl->vfeio) {
-		pr_err("%s: no valid mem region\n", __func__);
-		rc = -EBUSY;
-		goto vfe32_no_resource;
-	}
-
-	axi_ctrl->fs_vfe = regulator_get(&pdev->dev, "vdd");
-	if (IS_ERR(axi_ctrl->fs_vfe)) {
-		pr_err("%s: Regulator get failed %ld\n", __func__,
-			PTR_ERR(axi_ctrl->fs_vfe));
-		axi_ctrl->fs_vfe = NULL;
-	}
-
-	/* Register subdev node before requesting irq since
-	 * irq_num is needed by msm_cam_server */
-	sd_info.sdev_type = VFE_DEV;
-	sd_info.sd_index = 0;
-	sd_info.irq_num = axi_ctrl->vfeirq->start;
-	msm_cam_register_subdev_node(&vfe32_ctrl->subdev, &sd_info);
-
-	media_entity_init(&vfe32_ctrl->subdev.entity, 0, NULL, 0);
-	vfe32_ctrl->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	vfe32_ctrl->subdev.entity.group_id = VFE_DEV;
-	vfe32_ctrl->subdev.entity.name = pdev->name;
-	vfe32_ctrl->subdev.entity.revision = vfe32_ctrl->subdev.devnode->num;
-
-	/* Request for this device irq from the camera server. If the
-	 * IRQ Router is present on this target, the interrupt will be
-	 * handled by the camera server and the interrupt service
-	 * routine called. If the request_irq call returns ENXIO, then
-	 * the IRQ Router hardware is not present on this target. We
-	 * have to request for the irq ourselves and register the
-	 * appropriate interrupt handler. */
-	irq_req.cam_hw_idx       = MSM_CAM_HW_VFE0;
-	irq_req.dev_name         = "vfe";
-	irq_req.irq_idx          = CAMERA_SS_IRQ_8;
-	irq_req.irq_num          = axi_ctrl->vfeirq->start;
-	irq_req.is_composite     = 0;
-	irq_req.irq_trigger_type = IRQF_TRIGGER_RISING;
-	irq_req.num_hwcore       = 1;
-	irq_req.subdev_list[0]   = &axi_ctrl->subdev;
-	irq_req.data             = (void *)axi_ctrl;
-	rc = msm_cam_server_request_irq(&irq_req);
-	if (rc == -ENXIO) {
-		/* IRQ Router hardware is not present on this hardware.
-		 * Request for the IRQ and register the interrupt handler. */
-		rc = request_irq(axi_ctrl->vfeirq->start, vfe32_parse_irq,
-			IRQF_TRIGGER_RISING, "vfe", axi_ctrl);
-		if (rc < 0) {
-			release_mem_region(axi_ctrl->vfemem->start,
-				resource_size(axi_ctrl->vfemem));
-			pr_err("%s: irq request fail\n", __func__);
-			rc = -EBUSY;
-			goto vfe32_no_resource;
-		}
-		disable_irq(axi_ctrl->vfeirq->start);
-	} else if (rc < 0) {
-		pr_err("%s Error registering irq ", __func__);
-		goto vfe32_no_resource;
-	}
-
-#ifdef CONFIG_MSM_IOMMU
-	/*get device context for IOMMU*/
-	axi_ctrl->iommu_ctx_imgwr =
-		msm_iommu_get_ctx("vfe_imgwr"); /*re-confirm*/
-	axi_ctrl->iommu_ctx_misc =
-		msm_iommu_get_ctx("vfe_misc"); /*re-confirm*/
-	if (!axi_ctrl->iommu_ctx_imgwr || !axi_ctrl->iommu_ctx_misc) {
-		release_mem_region(axi_ctrl->vfemem->start,
-			resource_size(axi_ctrl->vfemem));
-		pr_err("%s: No iommu fw context found\n", __func__);
-		rc = -ENODEV;
-		goto vfe32_no_resource;
-	}
-#endif
-
-	tasklet_init(&axi_ctrl->vfe32_tasklet,
-		axi32_do_tasklet, (unsigned long)axi_ctrl);
-
-	vfe32_ctrl->pdev = pdev;
-	/*disable bayer stats by default*/
-	vfe32_ctrl->ver_num.main = VFE_STATS_TYPE_LEGACY;
-	return 0;
-
-vfe32_no_resource:
-	kfree(vfe32_ctrl);
-	kfree(axi_ctrl);
-	return rc;
-}
-
-static struct platform_driver vfe32_driver = {
-	.probe = vfe32_probe,
-	.driver = {
-		.name = MSM_VFE_DRV_NAME,
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init msm_vfe32_init_module(void)
-{
-	return platform_driver_register(&vfe32_driver);
-}
-
-static void __exit msm_vfe32_exit_module(void)
-{
-	platform_driver_unregister(&vfe32_driver);
-}
-
-module_init(msm_vfe32_init_module);
-module_exit(msm_vfe32_exit_module);
-MODULE_DESCRIPTION("VFE 3.2 driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/vfe/msm_vfe40.c b/drivers/media/video/msm/vfe/msm_vfe40.c
deleted file mode 100644
index 767baae..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe40.c
+++ /dev/null
@@ -1,6330 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/module.h>
-#include <linux/uaccess.h>
-#include <linux/interrupt.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/of.h>
-#include <linux/atomic.h>
-#include <linux/regulator/consumer.h>
-#include <linux/clk.h>
-#include <mach/irqs.h>
-#include <mach/camera.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-subdev.h>
-#include <media/msm_isp.h>
-#include <mach/msm_bus.h>
-#include <mach/msm_bus_board.h>
-
-#include "msm.h"
-#include "msm_cam_server.h"
-#include "msm_vfe40.h"
-
-atomic_t irq_cnt;
-
-#define VFE_WM_CFG_BASE 0x0070
-#define VFE_WM_CFG_LEN 0x0024
-
-#define vfe40_get_ch_ping_addr(base, chn) \
-	(msm_camera_io_r((base) + VFE_WM_CFG_BASE + VFE_WM_CFG_LEN * (chn)))
-#define vfe40_get_ch_pong_addr(base, chn) \
-	(msm_camera_io_r((base) + VFE_WM_CFG_BASE + VFE_WM_CFG_LEN * (chn) + 4))
-#define vfe40_get_ch_addr(ping_pong, base, chn) \
-	((((ping_pong) & (1 << (chn))) == 0) ? \
-	(vfe40_get_ch_pong_addr((base), chn)) : \
-	(vfe40_get_ch_ping_addr((base), chn)))
-
-#define vfe40_put_ch_ping_addr(base, chn, addr) \
-	(msm_camera_io_w((addr), \
-	(base) + VFE_WM_CFG_BASE + VFE_WM_CFG_LEN * (chn)))
-#define vfe40_put_ch_pong_addr(base, chn, addr) \
-	(msm_camera_io_w((addr), \
-	(base) + VFE_WM_CFG_BASE + VFE_WM_CFG_LEN * (chn) + 4))
-#define vfe40_put_ch_addr(ping_pong, base, chn, addr) \
-	(((ping_pong) & (1 << (chn))) == 0 ?   \
-	vfe40_put_ch_pong_addr((base), (chn), (addr)) : \
-	vfe40_put_ch_ping_addr((base), (chn), (addr)))
-
-static uint32_t vfe_clk_rate;
-static void vfe40_send_isp_msg(struct v4l2_subdev *sd,
-	uint32_t vfeFrameId, uint32_t isp_msg_id);
-
-
-struct vfe40_isr_queue_cmd {
-	struct list_head list;
-	uint32_t                           vfeInterruptStatus0;
-	uint32_t                           vfeInterruptStatus1;
-};
-
-static struct vfe40_cmd_type vfe40_cmd[] = {
-	[1] = {VFE_CMD_SET_CLK},
-	[2] = {VFE_CMD_RESET},
-	[3] = {VFE_CMD_START},
-	[4] = {VFE_CMD_TEST_GEN_START},
-	[5] = {VFE_CMD_OPERATION_CFG, V40_OPERATION_CFG_LEN},
-	[6] = {VFE_CMD_AXI_OUT_CFG, V40_AXI_OUT_LEN, V40_AXI_BUS_CMD_OFF, 0xFF},
-	[7] = {VFE_CMD_CAMIF_CFG, V40_CAMIF_LEN, V40_CAMIF_OFF, 0xFF},
-	[8] = {VFE_CMD_AXI_INPUT_CFG},
-	[9] = {VFE_CMD_BLACK_LEVEL_CFG},
-	[10] = {VFE_CMD_MESH_ROLL_OFF_CFG, V40_MESH_ROLL_OFF_CFG_LEN,
-		V40_MESH_ROLL_OFF_CFG_OFF, 0xFF},
-	[11] = {VFE_CMD_DEMUX_CFG, V40_DEMUX_LEN, V40_DEMUX_OFF, 0xFF},
-	[12] = {VFE_CMD_FOV_CFG},
-	[13] = {VFE_CMD_MAIN_SCALER_CFG},
-	[14] = {VFE_CMD_WB_CFG, V40_WB_LEN, V40_WB_OFF, 0xFF},
-	[15] = {VFE_CMD_COLOR_COR_CFG, V40_COLOR_COR_LEN,
-		V40_COLOR_COR_OFF, 0xFF},
-	[16] = {VFE_CMD_RGB_G_CFG, V40_RGB_G_LEN, V40_RGB_G_OFF, 0xFF},
-	[17] = {VFE_CMD_LA_CFG, V40_LA_LEN, V40_LA_OFF, 0xFF },
-	[18] = {VFE_CMD_CHROMA_EN_CFG, V40_CHROMA_EN_LEN, V40_CHROMA_EN_OFF,
-		0xFF},
-	[19] = {VFE_CMD_CHROMA_SUP_CFG, V40_CHROMA_SUP_LEN,
-		V40_CHROMA_SUP_OFF, 0xFF},
-	[20] = {VFE_CMD_MCE_CFG, V40_MCE_LEN, V40_MCE_OFF, 0xFF},
-	[21] = {VFE_CMD_SK_ENHAN_CFG, V40_SCE_LEN, V40_SCE_OFF, 0xFF},
-	[22] = {VFE_CMD_ASF_CFG, V40_ASF_LEN, V40_ASF_OFF, 0xFF},
-	[23] = {VFE_CMD_S2Y_CFG},
-	[24] = {VFE_CMD_S2CbCr_CFG},
-	[25] = {VFE_CMD_CHROMA_SUBS_CFG},
-	[26] = {VFE_CMD_OUT_CLAMP_CFG, V40_OUT_CLAMP_LEN, V40_OUT_CLAMP_OFF,
-		0xFF},
-	[27] = {VFE_CMD_FRAME_SKIP_CFG},
-	[31] = {VFE_CMD_UPDATE},
-	[32] = {VFE_CMD_BL_LVL_UPDATE},
-	[33] = {VFE_CMD_DEMUX_UPDATE, V40_DEMUX_LEN, V40_DEMUX_OFF, 0xFF},
-	[34] = {VFE_CMD_FOV_UPDATE},
-	[35] = {VFE_CMD_MAIN_SCALER_UPDATE},
-	[36] = {VFE_CMD_WB_UPDATE, V40_WB_LEN, V40_WB_OFF, 0xFF},
-	[37] = {VFE_CMD_COLOR_COR_UPDATE, V40_COLOR_COR_LEN,
-		V40_COLOR_COR_OFF, 0xFF},
-	[38] = {VFE_CMD_RGB_G_UPDATE, V40_RGB_G_LEN, V40_CHROMA_EN_OFF, 0xFF},
-	[39] = {VFE_CMD_LA_UPDATE, V40_LA_LEN, V40_LA_OFF, 0xFF },
-	[40] = {VFE_CMD_CHROMA_EN_UPDATE, V40_CHROMA_EN_LEN,
-		V40_CHROMA_EN_OFF, 0xFF},
-	[41] = {VFE_CMD_CHROMA_SUP_UPDATE, V40_CHROMA_SUP_LEN,
-		V40_CHROMA_SUP_OFF, 0xFF},
-	[42] = {VFE_CMD_MCE_UPDATE, V40_MCE_LEN, V40_MCE_OFF, 0xFF},
-	[43] = {VFE_CMD_SK_ENHAN_UPDATE, V40_SCE_LEN, V40_SCE_OFF, 0xFF},
-	[44] = {VFE_CMD_S2CbCr_UPDATE},
-	[45] = {VFE_CMD_S2Y_UPDATE},
-	[46] = {VFE_CMD_ASF_UPDATE, V40_ASF_UPDATE_LEN, V40_ASF_OFF, 0xFF},
-	[47] = {VFE_CMD_FRAME_SKIP_UPDATE},
-	[48] = {VFE_CMD_CAMIF_FRAME_UPDATE},
-	[49] = {VFE_CMD_STATS_AF_UPDATE},
-	[50] = {VFE_CMD_STATS_AE_UPDATE},
-	[51] = {VFE_CMD_STATS_AWB_UPDATE, V40_STATS_AWB_LEN,
-		V40_STATS_AWB_OFF},
-	[52] = {VFE_CMD_STATS_RS_UPDATE, V40_STATS_RS_LEN, V40_STATS_RS_OFF},
-	[53] = {VFE_CMD_STATS_CS_UPDATE, V40_STATS_CS_LEN, V40_STATS_CS_OFF},
-	[54] = {VFE_CMD_STATS_SKIN_UPDATE},
-	[55] = {VFE_CMD_STATS_IHIST_UPDATE, V40_STATS_IHIST_LEN,
-		V40_STATS_IHIST_OFF},
-	[57] = {VFE_CMD_EPOCH1_ACK},
-	[58] = {VFE_CMD_EPOCH2_ACK},
-	[59] = {VFE_CMD_START_RECORDING},
-	[60] = {VFE_CMD_STOP_RECORDING},
-	[63] = {VFE_CMD_CAPTURE, V40_CAPTURE_LEN, 0xFF},
-	[65] = {VFE_CMD_STOP},
-	[66] = {VFE_CMD_GET_HW_VERSION, V40_GET_HW_VERSION_LEN,
-		V40_GET_HW_VERSION_OFF},
-	[67] = {VFE_CMD_GET_FRAME_SKIP_COUNTS},
-	[68] = {VFE_CMD_OUTPUT1_BUFFER_ENQ},
-	[69] = {VFE_CMD_OUTPUT2_BUFFER_ENQ},
-	[70] = {VFE_CMD_OUTPUT3_BUFFER_ENQ},
-	[71] = {VFE_CMD_JPEG_OUT_BUF_ENQ},
-	[72] = {VFE_CMD_RAW_OUT_BUF_ENQ},
-	[73] = {VFE_CMD_RAW_IN_BUF_ENQ},
-	[74] = {VFE_CMD_STATS_AF_ENQ},
-	[75] = {VFE_CMD_STATS_AE_ENQ},
-	[76] = {VFE_CMD_STATS_AWB_ENQ},
-	[77] = {VFE_CMD_STATS_RS_ENQ},
-	[78] = {VFE_CMD_STATS_CS_ENQ},
-	[79] = {VFE_CMD_STATS_SKIN_ENQ},
-	[80] = {VFE_CMD_STATS_IHIST_ENQ},
-	[82] = {VFE_CMD_JPEG_ENC_CFG},
-	[84] = {VFE_CMD_STATS_AF_START},
-	[85] = {VFE_CMD_STATS_AF_STOP},
-	[86] = {VFE_CMD_STATS_AE_START},
-	[87] = {VFE_CMD_STATS_AE_STOP},
-	[88] = {VFE_CMD_STATS_AWB_START, V40_STATS_AWB_LEN, V40_STATS_AWB_OFF},
-	[89] = {VFE_CMD_STATS_AWB_STOP},
-	[90] = {VFE_CMD_STATS_RS_START, V40_STATS_RS_LEN, V40_STATS_RS_OFF},
-	[91] = {VFE_CMD_STATS_RS_STOP},
-	[92] = {VFE_CMD_STATS_CS_START, V40_STATS_CS_LEN, V40_STATS_CS_OFF},
-	[93] = {VFE_CMD_STATS_CS_STOP},
-	[94] = {VFE_CMD_STATS_SKIN_START},
-	[95] = {VFE_CMD_STATS_SKIN_STOP},
-	[96] = {VFE_CMD_STATS_IHIST_START,
-		V40_STATS_IHIST_LEN, V40_STATS_IHIST_OFF},
-	[97] = {VFE_CMD_STATS_IHIST_STOP},
-	[99] = {VFE_CMD_SYNC_TIMER_SETTING, V40_SYNC_TIMER_LEN,
-			V40_SYNC_TIMER_OFF},
-	[100] = {VFE_CMD_ASYNC_TIMER_SETTING, V40_ASYNC_TIMER_LEN,
-		V40_ASYNC_TIMER_OFF},
-	[101] = {VFE_CMD_LIVESHOT},
-	[102] = {VFE_CMD_LA_SETUP},
-	[103] = {VFE_CMD_LINEARIZATION_CFG, V40_LINEARIZATION_LEN1,
-			V40_LINEARIZATION_OFF1},
-	[104] = {VFE_CMD_DEMOSAICV3},
-	[105] = {VFE_CMD_DEMOSAICV3_ABCC_CFG},
-	[106] = {VFE_CMD_DEMOSAICV3_DBCC_CFG, V40_DEMOSAICV3_DBCC_LEN,
-			V40_DEMOSAICV3_DBCC_OFF},
-	[107] = {VFE_CMD_DEMOSAICV3_DBPC_CFG},
-	[108] = {VFE_CMD_DEMOSAICV3_ABF_CFG, V40_DEMOSAICV3_ABF_LEN,
-			V40_DEMOSAICV3_ABF_OFF},
-	[109] = {VFE_CMD_DEMOSAICV3_ABCC_UPDATE},
-	[110] = {VFE_CMD_DEMOSAICV3_DBCC_UPDATE, V40_DEMOSAICV3_DBCC_LEN,
-			V40_DEMOSAICV3_DBCC_OFF},
-	[111] = {VFE_CMD_DEMOSAICV3_DBPC_UPDATE},
-	[112] = {VFE_CMD_XBAR_CFG},
-	[113] = {VFE_CMD_MODULE_CFG, V40_MODULE_CFG_LEN, V40_MODULE_CFG_OFF},
-	[114] = {VFE_CMD_ZSL},
-	[115] = {VFE_CMD_LINEARIZATION_UPDATE, V40_LINEARIZATION_LEN1,
-			V40_LINEARIZATION_OFF1},
-	[116] = {VFE_CMD_DEMOSAICV3_ABF_UPDATE, V40_DEMOSAICV3_ABF_LEN,
-			V40_DEMOSAICV3_ABF_OFF},
-	[117] = {VFE_CMD_CLF_CFG, V40_CLF_CFG_LEN, V40_CLF_CFG_OFF},
-	[118] = {VFE_CMD_CLF_LUMA_UPDATE, V40_CLF_LUMA_UPDATE_LEN,
-			V40_CLF_LUMA_UPDATE_OFF},
-	[119] = {VFE_CMD_CLF_CHROMA_UPDATE, V40_CLF_CHROMA_UPDATE_LEN,
-			V40_CLF_CHROMA_UPDATE_OFF},
-	[120] = {VFE_CMD_PCA_ROLL_OFF_CFG},
-	[121] = {VFE_CMD_PCA_ROLL_OFF_UPDATE},
-	[122] = {VFE_CMD_GET_REG_DUMP},
-	[123] = {VFE_CMD_GET_LINEARIZATON_TABLE},
-	[124] = {VFE_CMD_GET_MESH_ROLLOFF_TABLE},
-	[125] = {VFE_CMD_GET_PCA_ROLLOFF_TABLE},
-	[126] = {VFE_CMD_GET_RGB_G_TABLE},
-	[127] = {VFE_CMD_GET_LA_TABLE},
-	[128] = {VFE_CMD_DEMOSAICV3_UPDATE},
-	[129] = {VFE_CMD_ACTIVE_REGION_CFG},
-	[130] = {VFE_CMD_COLOR_PROCESSING_CONFIG},
-	[131] = {VFE_CMD_STATS_WB_AEC_CONFIG},
-	[132] = {VFE_CMD_STATS_WB_AEC_UPDATE},
-	[133] = {VFE_CMD_Y_GAMMA_CONFIG},
-	[134] = {VFE_CMD_SCALE_OUTPUT1_CONFIG},
-	[135] = {VFE_CMD_SCALE_OUTPUT2_CONFIG},
-	[136] = {VFE_CMD_CAPTURE_RAW},
-	[137] = {VFE_CMD_STOP_LIVESHOT},
-	[138] = {VFE_CMD_RECONFIG_VFE},
-	[139] = {VFE_CMD_STATS_REQBUF},
-	[140] = {VFE_CMD_STATS_ENQUEUEBUF},
-	[141] = {VFE_CMD_STATS_FLUSH_BUFQ},
-	[142] = {VFE_CMD_STATS_UNREGBUF},
-	[143] = {VFE_CMD_STATS_BG_START, V40_STATS_BG_LEN, V40_STATS_BG_OFF},
-	[144] = {VFE_CMD_STATS_BG_STOP},
-	[145] = {VFE_CMD_STATS_BF_START, V40_STATS_BF_LEN, V40_STATS_BF_OFF},
-	[146] = {VFE_CMD_STATS_BF_STOP},
-	[147] = {VFE_CMD_STATS_BHIST_START, V40_STATS_BHIST_LEN,
-			V40_STATS_BHIST_OFF},
-	[148] = {VFE_CMD_STATS_BHIST_STOP},
-	[149] = {VFE_CMD_RESET_2},
-	[150] = {VFE_CMD_FOV_ENC_CFG, V40_FOV_ENC_LEN,
-		V40_FOV_ENC_OFF, 0xFF},
-	[151] = {VFE_CMD_FOV_VIEW_CFG, V40_FOV_VIEW_LEN,
-		V40_FOV_VIEW_OFF, 0xFF},
-	[152] = {VFE_CMD_FOV_ENC_UPDATE, V40_FOV_ENC_LEN,
-		V40_FOV_ENC_OFF, 0xFF},
-	[153] = {VFE_CMD_FOV_VIEW_UPDATE, V40_FOV_VIEW_LEN,
-		V40_FOV_VIEW_OFF, 0xFF},
-	[154] = {VFE_CMD_SCALER_ENC_CFG, V40_SCALER_ENC_LEN,
-		V40_SCALER_ENC_OFF, 0xFF},
-	[155] = {VFE_CMD_SCALER_VIEW_CFG, V40_SCALER_VIEW_LEN,
-		V40_SCALER_VIEW_OFF, 0xFF},
-	[156] = {VFE_CMD_SCALER_ENC_UPDATE, V40_SCALER_ENC_LEN,
-		V40_SCALER_ENC_OFF, 0xFF},
-	[157] = {VFE_CMD_SCALER_VIEW_UPDATE, V40_SCALER_VIEW_LEN,
-		V40_SCALER_VIEW_OFF, 0xFF},
-	[158] = {VFE_CMD_COLORXFORM_ENC_CFG, V40_COLORXFORM_ENC_CFG_LEN,
-		V40_COLORXFORM_ENC_CFG_OFF, 0xFF},
-	[159] = {VFE_CMD_COLORXFORM_VIEW_CFG, V40_COLORXFORM_VIEW_CFG_LEN,
-		V40_COLORXFORM_VIEW_CFG_OFF},
-	[160] = {VFE_CMD_COLORXFORM_ENC_UPDATE, V40_COLORXFORM_ENC_CFG_LEN,
-		V40_COLORXFORM_ENC_CFG_OFF, 0xFF},
-	[161] = {VFE_CMD_COLORXFORM_VIEW_UPDATE, V40_COLORXFORM_VIEW_CFG_LEN,
-		V40_COLORXFORM_VIEW_CFG_OFF, 0xFF},
-};
-
-static const uint32_t vfe40_AXI_WM_CFG[] = {
-	0x0000006C,
-	0x00000090,
-	0x000000B4,
-	0x000000D8,
-	0x000000FC,
-	0x00000120,
-	0x00000144,
-};
-
-static const char * const vfe40_general_cmd[] = {
-	[1] = "SET_CLK",
-	[2] = "RESET",
-	[3] = "START",
-	[4] = "TEST_GEN_START",
-	[5] = "OPERATION_CFG",  /* 5 */
-	[6] = "AXI_OUT_CFG",
-	[7] = "CAMIF_CFG",
-	[8] = "AXI_INPUT_CFG",
-	[9] = "BLACK_LEVEL_CFG",
-	[10] = "ROLL_OFF_CFG",  /* 10 */
-	[11] = "DEMUX_CFG",
-	[12] = "FOV_CFG",
-	[13] = "MAIN_SCALER_CFG",
-	[14] = "WB_CFG",
-	[15] = "COLOR_COR_CFG", /* 15 */
-	[16] = "RGB_G_CFG",
-	[17] = "LA_CFG",
-	[18] = "CHROMA_EN_CFG",
-	[19] = "CHROMA_SUP_CFG",
-	[20] = "MCE_CFG", /* 20 */
-	[21] = "SK_ENHAN_CFG",
-	[22] = "ASF_CFG",
-	[23] = "S2Y_CFG",
-	[24] = "S2CbCr_CFG",
-	[25] = "CHROMA_SUBS_CFG",  /* 25 */
-	[26] = "OUT_CLAMP_CFG",
-	[27] = "FRAME_SKIP_CFG",
-	[31] = "UPDATE",
-	[32] = "BL_LVL_UPDATE",
-	[33] = "DEMUX_UPDATE",
-	[34] = "FOV_UPDATE",
-	[35] = "MAIN_SCALER_UPDATE",  /* 35 */
-	[36] = "WB_UPDATE",
-	[37] = "COLOR_COR_UPDATE",
-	[38] = "RGB_G_UPDATE",
-	[39] = "LA_UPDATE",
-	[40] = "CHROMA_EN_UPDATE",  /* 40 */
-	[41] = "CHROMA_SUP_UPDATE",
-	[42] = "MCE_UPDATE",
-	[43] = "SK_ENHAN_UPDATE",
-	[44] = "S2CbCr_UPDATE",
-	[45] = "S2Y_UPDATE",  /* 45 */
-	[46] = "ASF_UPDATE",
-	[47] = "FRAME_SKIP_UPDATE",
-	[48] = "CAMIF_FRAME_UPDATE",
-	[49] = "STATS_AF_UPDATE",
-	[50] = "STATS_AE_UPDATE",  /* 50 */
-	[51] = "STATS_AWB_UPDATE",
-	[52] = "STATS_RS_UPDATE",
-	[53] = "STATS_CS_UPDATE",
-	[54] = "STATS_SKIN_UPDATE",
-	[55] = "STATS_IHIST_UPDATE",  /* 55 */
-	[57] = "EPOCH1_ACK",
-	[58] = "EPOCH2_ACK",
-	[59] = "START_RECORDING",
-	[60] = "STOP_RECORDING",  /* 60 */
-	[63] = "CAPTURE",
-	[65] = "STOP",  /* 65 */
-	[66] = "GET_HW_VERSION",
-	[67] = "GET_FRAME_SKIP_COUNTS",
-	[68] = "OUTPUT1_BUFFER_ENQ",
-	[69] = "OUTPUT2_BUFFER_ENQ",
-	[70] = "OUTPUT3_BUFFER_ENQ",  /* 70 */
-	[71] = "JPEG_OUT_BUF_ENQ",
-	[72] = "RAW_OUT_BUF_ENQ",
-	[73] = "RAW_IN_BUF_ENQ",
-	[74] = "STATS_AF_ENQ",
-	[75] = "STATS_AE_ENQ",  /* 75 */
-	[76] = "STATS_AWB_ENQ",
-	[77] = "STATS_RS_ENQ",
-	[78] = "STATS_CS_ENQ",
-	[79] = "STATS_SKIN_ENQ",
-	[80] = "STATS_IHIST_ENQ",  /* 80 */
-	[82] = "JPEG_ENC_CFG",
-	[84] = "STATS_AF_START",
-	[85] = "STATS_AF_STOP",  /* 85 */
-	[86] = "STATS_AE_START",
-	[87] = "STATS_AE_STOP",
-	[88] = "STATS_AWB_START",
-	[89] = "STATS_AWB_STOP",
-	[90] = "STATS_RS_START",  /* 90 */
-	[91] = "STATS_RS_STOP",
-	[92] = "STATS_CS_START",
-	[93] = "STATS_CS_STOP",
-	[94] = "STATS_SKIN_START",
-	[95] = "STATS_SKIN_STOP",  /* 95 */
-	[96] = "STATS_IHIST_START",
-	[97] = "STATS_IHIST_STOP",
-	[99] = "SYNC_TIMER_SETTING",
-	[100] = "ASYNC_TIMER_SETTING",  /* 100 */
-	[101] = "LIVESHOT",
-	[102] = "LA_SETUP",
-	[103] = "LINEARIZATION_CFG",
-	[104] = "DEMOSAICV3",
-	[105] = "DEMOSAICV3_ABCC_CFG", /* 105 */
-	[106] = "DEMOSAICV3_DBCC_CFG",
-	[107] = "DEMOSAICV3_DBPC_CFG",
-	[108] = "DEMOSAICV3_ABF_CFG",
-	[109] = "DEMOSAICV3_ABCC_UPDATE",
-	[110] = "DEMOSAICV3_DBCC_UPDATE", /* 110 */
-	[111] = "DEMOSAICV3_DBPC_UPDATE",
-	[112] = "XBAR_CFG",
-	[113] = "EZTUNE_CFG",
-	[114] = "V40_ZSL",
-	[115] = "LINEARIZATION_UPDATE", /*115*/
-	[116] = "DEMOSAICV3_ABF_UPDATE",
-	[117] = "CLF_CFG",
-	[118] = "CLF_LUMA_UPDATE",
-	[119] = "CLF_CHROMA_UPDATE",
-	[120] = "PCA_ROLL_OFF_CFG", /*120*/
-	[121] = "PCA_ROLL_OFF_UPDATE",
-	[122] = "GET_REG_DUMP",
-	[123] = "GET_LINEARIZATON_TABLE",
-	[124] = "GET_MESH_ROLLOFF_TABLE",
-	[125] = "GET_PCA_ROLLOFF_TABLE", /*125*/
-	[126] = "GET_RGB_G_TABLE",
-	[127] = "GET_LA_TABLE",
-	[128] = "DEMOSAICV3_UPDATE",
-	[139] = "STATS_REQBUF",
-	[140] = "STATS_ENQUEUEBUF", /*140*/
-	[141] = "STATS_FLUSH_BUFQ",
-	[142] = "STATS_UNREGBUF",
-	[143] = "STATS_BG_START",
-	[144] = "STATS_BG_STOP",
-	[145] = "STATS_BF_START", /*145*/
-	[146] = "STATS_BF_STOP",
-	[147] = "STATS_BHIST_START",
-	[148] = "STATS_BHIST_STOP",
-	[149] = "RESET_2",
-};
-
-/*Temporary use fixed bus vectors in VFE */
-static struct msm_bus_vectors vfe_init_vectors[] = {
-	{
-		.src = MSM_BUS_MASTER_VFE,
-		.dst = MSM_BUS_SLAVE_EBI_CH0,
-		.ab  = 0,
-		.ib  = 0,
-	},
-};
-
-static struct msm_bus_vectors vfe_preview_vectors[] = {
-	{
-		.src = MSM_BUS_MASTER_VFE,
-		.dst = MSM_BUS_SLAVE_EBI_CH0,
-		.ab  = 27648000,
-		.ib  = 110592000,
-	},
-};
-
-static struct msm_bus_vectors vfe_video_vectors[] = {
-	{
-		.src = MSM_BUS_MASTER_VFE,
-		.dst = MSM_BUS_SLAVE_EBI_CH0,
-		.ab  = 154275840,
-		.ib  = 617103360,
-	},
-};
-
-static struct msm_bus_vectors vfe_snapshot_vectors[] = {
-	{
-		.src = MSM_BUS_MASTER_VFE,
-		.dst = MSM_BUS_SLAVE_EBI_CH0,
-		.ab  = 274423680,
-		.ib  = 1097694720,
-	},
-};
-
-static struct msm_bus_vectors vfe_zsl_vectors[] = {
-	{
-		.src = MSM_BUS_MASTER_VFE,
-		.dst = MSM_BUS_SLAVE_EBI_CH0,
-		.ab  = 302071680,
-		.ib  = 1208286720,
-	},
-};
-
-static struct msm_bus_paths vfe_bus_client_config[] = {
-	{
-		ARRAY_SIZE(vfe_init_vectors),
-		vfe_init_vectors,
-	},
-	{
-		ARRAY_SIZE(vfe_preview_vectors),
-		vfe_preview_vectors,
-	},
-	{
-		ARRAY_SIZE(vfe_video_vectors),
-		vfe_video_vectors,
-	},
-	{
-		ARRAY_SIZE(vfe_snapshot_vectors),
-		vfe_snapshot_vectors,
-	},
-	{
-		ARRAY_SIZE(vfe_zsl_vectors),
-		vfe_zsl_vectors,
-	},
-};
-
-static struct msm_bus_scale_pdata vfe_bus_client_pdata = {
-		vfe_bus_client_config,
-		ARRAY_SIZE(vfe_bus_client_config),
-		.name = "msm_camera_vfe",
-};
-
-uint8_t vfe40_use_bayer_stats(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	if (vfe40_ctrl->ver_num.main >= 4) {
-		/* VFE 4 or above uses bayer stats */
-		return TRUE;
-	} else {
-		return FALSE;
-	}
-}
-
-static void axi_enable_irq(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t irq_mask;
-	uint16_t vfe_operation_mode =
-		share_ctrl->current_mode & ~(VFE_OUTPUTS_RDI0|
-			VFE_OUTPUTS_RDI1);
-	irq_mask =
-		msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-
-	irq_mask |= VFE_IMASK_WHILE_STOPPING_0;
-
-	if (share_ctrl->current_mode & VFE_OUTPUTS_RDI0)
-		irq_mask |= VFE_IRQ_STATUS0_RDI0_REG_UPDATE_MASK;
-
-	if (share_ctrl->current_mode & VFE_OUTPUTS_RDI1)
-		irq_mask |= VFE_IRQ_STATUS0_RDI1_REG_UPDATE_MASK;
-
-	msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-		VFE_IRQ_MASK_0);
-
-	if (vfe_operation_mode) {
-		irq_mask =
-		msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-		irq_mask |= 0x00000021;
-		if (share_ctrl->stats_comp)
-			irq_mask |= VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK_0;
-		else
-			irq_mask |= 0x00FF0000;
-		msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-		atomic_set(&share_ctrl->vstate, 1);
-	}
-	atomic_set(&share_ctrl->handle_common_irq, 1);
-}
-
-static void axi_disable_irq(struct vfe_share_ctrl_t *share_ctrl)
-{
-
-	/* disable all interrupts.  */
-
-	uint32_t irq_mask = 0;
-	uint16_t vfe_operation_mode =
-		share_ctrl->current_mode & ~(VFE_OUTPUTS_RDI0|
-			VFE_OUTPUTS_RDI1);
-
-	if (share_ctrl->current_mode & VFE_OUTPUTS_RDI0) {
-		irq_mask =
-		msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-		irq_mask &= ~(VFE_IRQ_STATUS0_RDI0_REG_UPDATE_MASK);
-		msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-		msm_camera_io_w(VFE_IRQ_STATUS0_RDI0_REG_UPDATE_MASK,
-			share_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	}
-	if (share_ctrl->current_mode & VFE_OUTPUTS_RDI1) {
-		irq_mask =
-		msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-		irq_mask &= ~(VFE_IRQ_STATUS0_RDI1_REG_UPDATE_MASK);
-		msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-		msm_camera_io_w(VFE_IRQ_STATUS0_RDI1_REG_UPDATE_MASK,
-			share_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	}
-	if (vfe_operation_mode) {
-		atomic_set(&share_ctrl->vstate, 0);
-		irq_mask =
-		msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-		irq_mask &= ~(0x00000011);
-		if (share_ctrl->stats_comp)
-			irq_mask &= ~(VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK_0);
-		else
-			irq_mask &= ~0x00FF0000;
-		msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-	}
-
-	if (share_ctrl->axi_ref_cnt == 1) {
-		atomic_set(&share_ctrl->handle_common_irq, 0);
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		share_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		share_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* clear all pending interrupts*/
-	msm_camera_io_w(0xFFFFFFFF,
-		share_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(0xFFFFFFFF,
-		share_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1,
-		share_ctrl->vfebase + VFE_IRQ_CMD);
-	}
-}
-
-static void vfe40_stop(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-
-	/* in either continuous or snapshot mode, stop command can be issued
-	 * at any time. stop camif immediately. */
-	msm_camera_io_w(CAMIF_COMMAND_STOP_IMMEDIATELY,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_CAMIF_COMMAND);
-	vfe40_ctrl->share_ctrl->operation_mode &=
-		~(vfe40_ctrl->share_ctrl->current_mode);
-	vfe40_ctrl->share_ctrl->current_mode = 0;
-}
-
-static void vfe40_subdev_notify(int id, int path, uint32_t inst_handle,
-	struct v4l2_subdev *sd, struct vfe_share_ctrl_t *share_ctrl)
-{
-	struct msm_vfe_resp rp;
-	struct msm_frame_info frame_info;
-	unsigned long flags = 0;
-	spin_lock_irqsave(&share_ctrl->sd_notify_lock, flags);
-	CDBG("vfe40_subdev_notify : msgId = %d\n", id);
-	memset(&rp, 0, sizeof(struct msm_vfe_resp));
-	rp.evt_msg.type   = MSM_CAMERA_MSG;
-	frame_info.inst_handle = inst_handle;
-	frame_info.path = path;
-	rp.evt_msg.data = &frame_info;
-	rp.type	   = id;
-	v4l2_subdev_notify(sd, NOTIFY_VFE_BUF_EVT, &rp);
-	spin_unlock_irqrestore(&share_ctrl->sd_notify_lock, flags);
-}
-
-static int vfe40_config_axi(
-	struct axi_ctrl_t *axi_ctrl, int mode, uint32_t *ao)
-{
-	uint32_t *ch_info;
-	uint32_t *axi_cfg = ao;
-	int vfe_mode = (mode & ~(OUTPUT_TERT1|OUTPUT_TERT2));
-
-	/* Update the corresponding write masters for each output*/
-	ch_info = axi_cfg + V40_AXI_CFG_LEN;
-	axi_ctrl->share_ctrl->outpath.out0.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out0.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out0.ch2 = 0x0000FFFF & *ch_info++;
-	axi_ctrl->share_ctrl->outpath.out0.inst_handle = *ch_info++;
-
-	axi_ctrl->share_ctrl->outpath.out1.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out1.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out1.ch2 = 0x0000FFFF & *ch_info++;
-	axi_ctrl->share_ctrl->outpath.out1.inst_handle = *ch_info++;
-
-	axi_ctrl->share_ctrl->outpath.out2.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out2.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out2.ch2 = 0x0000FFFF & *ch_info++;
-	axi_ctrl->share_ctrl->outpath.out2.inst_handle = *ch_info++;
-
-	axi_ctrl->share_ctrl->outpath.out3.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out3.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out3.ch2 = 0x0000FFFF & *ch_info++;
-	axi_ctrl->share_ctrl->outpath.out3.inst_handle = *ch_info++;
-
-	axi_ctrl->share_ctrl->outpath.output_mode = 0;
-
-	if (mode & OUTPUT_TERT1)
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_TERTIARY1;
-	if (mode & OUTPUT_TERT2)
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_TERTIARY2;
-	if (mode == OUTPUT_TERT1 || mode == OUTPUT_TERT1
-		|| mode == (OUTPUT_TERT1|OUTPUT_TERT2))
-			goto bus_cfg;
-
-	switch (vfe_mode) {
-	case OUTPUT_PRIM:
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_PRIMARY;
-		break;
-	case OUTPUT_PRIM_ALL_CHNLS:
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
-		break;
-	case OUTPUT_PRIM|OUTPUT_SEC:
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_PRIMARY;
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_SECONDARY;
-		break;
-	case OUTPUT_PRIM|OUTPUT_SEC_ALL_CHNLS:
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_PRIMARY;
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_SECONDARY_ALL_CHNLS;
-		break;
-	case OUTPUT_PRIM_ALL_CHNLS|OUTPUT_SEC:
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_SECONDARY;
-		break;
-	default:
-		pr_err("%s Invalid AXI mode %d ", __func__, mode);
-		return -EINVAL;
-	}
-
-bus_cfg:
-	msm_camera_io_memcpy(axi_ctrl->share_ctrl->vfebase +
-		vfe40_cmd[VFE_CMD_AXI_OUT_CFG].offset, axi_cfg,
-		V40_AXI_BUS_CFG_LEN);
-	msm_camera_io_w(*ch_info++,
-		axi_ctrl->share_ctrl->vfebase + VFE_RDI0_CFG);
-	msm_camera_io_w(*ch_info++,
-		axi_ctrl->share_ctrl->vfebase + VFE_RDI1_CFG);
-	msm_camera_io_w(*ch_info++,
-		axi_ctrl->share_ctrl->vfebase + VFE_RDI2_CFG);
-	return 0;
-}
-
-static void axi_reset_internal_variables(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	unsigned long flags;
-	/* state control variables */
-	axi_ctrl->share_ctrl->start_ack_pending = FALSE;
-	atomic_set(&irq_cnt, 0);
-
-	spin_lock_irqsave(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-	axi_ctrl->share_ctrl->stop_ack_pending  = FALSE;
-	spin_unlock_irqrestore(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-
-	spin_lock_irqsave(&axi_ctrl->share_ctrl->update_ack_lock, flags);
-	axi_ctrl->share_ctrl->update_ack_pending = FALSE;
-	spin_unlock_irqrestore(&axi_ctrl->share_ctrl->update_ack_lock, flags);
-
-	axi_ctrl->share_ctrl->recording_state = VFE_STATE_IDLE;
-	axi_ctrl->share_ctrl->liveshot_state = VFE_STATE_IDLE;
-
-	atomic_set(&axi_ctrl->share_ctrl->vstate, 0);
-	atomic_set(&axi_ctrl->share_ctrl->handle_common_irq, 0);
-	atomic_set(&axi_ctrl->share_ctrl->pix0_update_ack_pending, 0);
-	atomic_set(&axi_ctrl->share_ctrl->rdi0_update_ack_pending, 0);
-	atomic_set(&axi_ctrl->share_ctrl->rdi1_update_ack_pending, 0);
-	atomic_set(&axi_ctrl->share_ctrl->rdi2_update_ack_pending, 0);
-
-	/* 0 for continuous mode, 1 for snapshot mode */
-	axi_ctrl->share_ctrl->operation_mode = 0;
-	axi_ctrl->share_ctrl->current_mode = 0;
-	axi_ctrl->share_ctrl->outpath.output_mode = 0;
-	axi_ctrl->share_ctrl->comp_output_mode = 0;
-	axi_ctrl->share_ctrl->vfe_capture_count = 0;
-
-	/* this is unsigned 32 bit integer. */
-	axi_ctrl->share_ctrl->vfeFrameId = 0;
-	axi_ctrl->share_ctrl->rdi0FrameId = 0;
-	axi_ctrl->share_ctrl->rdi1FrameId = 0;
-	axi_ctrl->share_ctrl->rdi2FrameId = 0;
-}
-
-static void vfe40_program_dmi_cfg(
-	enum VFE40_DMI_RAM_SEL bankSel,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	/* set bit 8 for auto increment. */
-	uint32_t value = VFE_DMI_CFG_DEFAULT;
-	value += (uint32_t)bankSel;
-	CDBG("%s: banksel = %d\n", __func__, bankSel);
-
-	msm_camera_io_w(value, vfe40_ctrl->share_ctrl->vfebase +
-		VFE_DMI_CFG);
-	/* by default, always starts with offset 0.*/
-	msm_camera_io_w(0, vfe40_ctrl->share_ctrl->vfebase +
-		VFE_DMI_ADDR);
-}
-
-static void vfe40_reset_dmi_tables(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	int i = 0;
-
-	/* Reset Histogram LUTs */
-	CDBG("Reset Bayer histogram LUT : 0\n");
-	vfe40_program_dmi_cfg(STATS_BHIST_RAM0, vfe40_ctrl);
-	/* Loop for configuring LUT */
-	for (i = 0; i < 256; i++) {
-		msm_camera_io_w(0, vfe40_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_HI);
-		msm_camera_io_w(0, vfe40_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_LO);
-	}
-	vfe40_program_dmi_cfg(NO_MEM_SELECTED, vfe40_ctrl);
-
-	CDBG("Reset Bayer Histogram LUT: 1\n");
-	vfe40_program_dmi_cfg(STATS_BHIST_RAM1, vfe40_ctrl);
-	/* Loop for configuring LUT */
-	for (i = 0; i < 256; i++) {
-		msm_camera_io_w(0, vfe40_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_HI);
-		msm_camera_io_w(0, vfe40_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_LO);
-	}
-	vfe40_program_dmi_cfg(NO_MEM_SELECTED, vfe40_ctrl);
-
-	CDBG("Reset IHistogram LUT\n");
-	vfe40_program_dmi_cfg(STATS_IHIST_RAM, vfe40_ctrl);
-	/* Loop for configuring LUT */
-	for (i = 0; i < 256; i++) {
-		msm_camera_io_w(0, vfe40_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_HI);
-		msm_camera_io_w(0, vfe40_ctrl->share_ctrl->vfebase +
-			VFE_DMI_DATA_LO);
-	}
-	vfe40_program_dmi_cfg(NO_MEM_SELECTED, vfe40_ctrl);
-}
-
-static void vfe40_set_default_reg_values(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	msm_camera_io_w(0x800080,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_DEMUX_GAIN_0);
-	msm_camera_io_w(0x800080,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_DEMUX_GAIN_1);
-	msm_camera_io_w(0x198FFFFF,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_CGC_OVERRIDE);
-
-	msm_camera_io_w(0,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_CLAMP_ENC_MIN);
-	msm_camera_io_w(0xFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_CLAMP_ENC_MAX);
-	msm_camera_io_w(0,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_CLAMP_VIEW_MIN);
-	msm_camera_io_w(0xFFFFFF,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_CLAMP_VIEW_MAX);
-
-	/* stats UB config */
-	CDBG("%s: Use bayer stats = %d\n", __func__,
-		 vfe40_use_bayer_stats(vfe40_ctrl));
-	msm_camera_io_w(0x350001F,
-	vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_HIST_WR_UB_CFG);
-	msm_camera_io_w(0x370002F,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_BG_WR_UB_CFG);
-	msm_camera_io_w(0x3A0002F,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_BF_WR_UB_CFG);
-	msm_camera_io_w(0x3D00007,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_RS_WR_UB_CFG);
-	msm_camera_io_w(0x3D8001F,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_CS_WR_UB_CFG);
-	msm_camera_io_w(0x3F80007,
-		vfe40_ctrl->share_ctrl->vfebase +
-			VFE_BUS_STATS_SKIN_WR_UB_CFG);
-	vfe40_reset_dmi_tables(vfe40_ctrl);
-}
-
-static void vfe40_reset_internal_variables(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	/* Stats control variables. */
-	memset(&(vfe40_ctrl->afbfStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe40_ctrl->awbStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe40_ctrl->aecbgStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe40_ctrl->bhistStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe40_ctrl->ihistStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe40_ctrl->rsStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	memset(&(vfe40_ctrl->csStatsControl), 0,
-		sizeof(struct vfe_stats_control));
-
-	vfe40_ctrl->frame_skip_cnt = 31;
-	vfe40_ctrl->frame_skip_pattern = 0xffffffff;
-	vfe40_ctrl->snapshot_frame_cnt = 0;
-	vfe40_set_default_reg_values(vfe40_ctrl);
-}
-
-static int vfe40_reset(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t irq_mask;
-	atomic_set(&vfe40_ctrl->share_ctrl->vstate, 0);
-	msm_camera_io_w(VFE_MODULE_RESET_CMD,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_RESET);
-	msm_camera_io_w(0,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_RESET);
-
-	irq_mask =
-		msm_camera_io_r(vfe40_ctrl->share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-	irq_mask &= ~(0x00FF0011|VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK_0);
-
-	/* enable reset_ack interrupt.  */
-	irq_mask |= VFE_IMASK_WHILE_STOPPING_0;
-	msm_camera_io_w(irq_mask, vfe40_ctrl->share_ctrl->vfebase +
-		VFE_IRQ_MASK_0);
-
-	msm_camera_io_w_mb(VFE_ONLY_RESET_CMD,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_GLOBAL_RESET);
-
-	return wait_for_completion_interruptible(
-			&vfe40_ctrl->share_ctrl->reset_complete);
-}
-
-static int axi_reset(struct axi_ctrl_t *axi_ctrl)
-{
-	axi_reset_internal_variables(axi_ctrl);
-	/* disable all interrupts.  vfeImaskLocal is also reset to 0
-	* to begin with. */
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_0);
-
-	msm_camera_io_w(VFE_DISABLE_ALL_IRQS,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* clear all pending interrupts*/
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQ0,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(VFE_CLEAR_ALL_IRQ1,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CMD);
-
-	/* enable reset_ack interrupt.  */
-	msm_camera_io_w(VFE_IMASK_WHILE_STOPPING_0,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_0);
-
-	/* Write to VFE_GLOBAL_RESET_CMD to reset the vfe hardware. Once reset
-	 * is done, hardware interrupt will be generated.  VFE ist processes
-	 * the interrupt to complete the function call.  Note that the reset
-	 * function is synchronous. */
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(VFE_RESET_UPON_RESET_CMD,
-		axi_ctrl->share_ctrl->vfebase + VFE_GLOBAL_RESET);
-
-	return wait_for_completion_interruptible(
-			&axi_ctrl->share_ctrl->reset_complete);
-}
-
-static int vfe40_operation_config(uint32_t *cmd,
-			struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t *p = cmd;
-
-	vfe40_ctrl->share_ctrl->stats_comp = *(++p);
-	vfe40_ctrl->hfr_mode = *(++p);
-
-	msm_camera_io_w(*(++p),
-		vfe40_ctrl->share_ctrl->vfebase + VFE_CFG);
-	msm_camera_io_w(*(++p),
-		vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-	msm_camera_io_w(*(++p),
-		vfe40_ctrl->share_ctrl->vfebase + VFE_REALIGN_BUF);
-	msm_camera_io_w(*(++p),
-		vfe40_ctrl->share_ctrl->vfebase + VFE_CHROMA_UP);
-	msm_camera_io_w(*(++p),
-		vfe40_ctrl->share_ctrl->vfebase + VFE_STATS_CFG);
-	return 0;
-}
-
-static unsigned long vfe40_stats_dqbuf(struct vfe40_ctrl_type *vfe40_ctrl,
-	enum msm_stats_enum_type stats_type)
-{
-	struct msm_stats_meta_buf *buf = NULL;
-	int rc = 0;
-	rc = vfe40_ctrl->stats_ops.dqbuf(
-			vfe40_ctrl->stats_ops.stats_ctrl, stats_type, &buf);
-	if (rc < 0) {
-		pr_err("%s: dq stats buf (type = %d) err = %d",
-			__func__, stats_type, rc);
-		return 0L;
-	}
-	return buf->paddr;
-}
-
-static unsigned long vfe40_stats_flush_enqueue(
-	struct vfe40_ctrl_type *vfe40_ctrl,
-	enum msm_stats_enum_type stats_type)
-{
-	struct msm_stats_bufq *bufq = NULL;
-	struct msm_stats_meta_buf *stats_buf = NULL;
-	int rc = 0;
-	int i;
-
-	/*
-	 * Passing NULL for ion client as the buffers are already
-	 * mapped at this stage, client is not required, flush all
-	 * the buffers, and buffers move to PREPARE state
-	 */
-
-	rc = vfe40_ctrl->stats_ops.bufq_flush(
-			vfe40_ctrl->stats_ops.stats_ctrl, stats_type, NULL);
-	if (rc < 0) {
-		pr_err("%s: dq stats buf (type = %d) err = %d",
-			__func__, stats_type, rc);
-		return 0L;
-	}
-	/* Queue all the buffers back to QUEUED state */
-	bufq = vfe40_ctrl->stats_ctrl.bufq[stats_type];
-	for (i = 0; i < bufq->num_bufs; i++) {
-		stats_buf = &bufq->bufs[i];
-		rc = vfe40_ctrl->stats_ops.enqueue_buf(
-				vfe40_ctrl->stats_ops.stats_ctrl,
-				&(stats_buf->info), NULL, -1);
-		if (rc < 0) {
-			pr_err("%s: dq stats buf (type = %d) err = %d",
-				 __func__, stats_type, rc);
-			return rc;
-		}
-	}
-	return 0L;
-}
-
-
-static unsigned long vfe40_stats_unregbuf(
-	struct vfe40_ctrl_type *vfe40_ctrl,
-	struct msm_stats_reqbuf *req_buf, int domain_num)
-{
-	int i = 0, rc = 0;
-
-	for (i = 0; i < req_buf->num_buf; i++) {
-		rc = vfe40_ctrl->stats_ops.buf_unprepare(
-			vfe40_ctrl->stats_ops.stats_ctrl,
-			req_buf->stats_type, i,
-			vfe40_ctrl->stats_ops.client, domain_num);
-		if (rc < 0) {
-			pr_err("%s: unreg stats buf (type = %d) err = %d",
-				__func__, req_buf->stats_type, rc);
-		return rc;
-		}
-	}
-	return 0L;
-}
-static int vfe_stats_awb_buf_init(
-	struct vfe40_ctrl_type *vfe40_ctrl,
-	struct vfe_cmd_stats_buf *in)
-{
-	uint32_t addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_AWB);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq awb ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_AWB_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_AWB);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq awb ping buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_AWB_WR_PONG_ADDR);
-	return 0;
-}
-
-static uint32_t vfe_stats_aec_bg_buf_init(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-	uint32_t stats_type;
-
-	stats_type =
-		(!vfe40_use_bayer_stats(vfe40_ctrl)) ? MSM_STATS_TYPE_AEC
-			: MSM_STATS_TYPE_BG;
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq aec ping buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_BG_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq aec pong buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_BG_WR_PONG_ADDR);
-	return 0;
-}
-
-static int vfe_stats_af_bf_buf_init(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-	int rc = 0;
-
-	uint32_t stats_type;
-	stats_type =
-		(!vfe40_use_bayer_stats(vfe40_ctrl)) ? MSM_STATS_TYPE_AF
-			: MSM_STATS_TYPE_BF;
-
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	rc = vfe40_stats_flush_enqueue(vfe40_ctrl, stats_type);
-	if (rc < 0) {
-		pr_err("%s: dq stats buf err = %d",
-			   __func__, rc);
-		spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-		return -EINVAL;
-	}
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq af ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_BF_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq af pong buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_BF_WR_PONG_ADDR);
-	return 0;
-}
-
-static uint32_t vfe_stats_bhist_buf_init(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_BHIST);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq ihist ping buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_SKIN_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_BHIST);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq ihist pong buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_SKIN_WR_PONG_ADDR);
-
-	return 0;
-}
-
-static int vfe_stats_ihist_buf_init(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_IHIST);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq ihist ping buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_HIST_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_IHIST);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq ihist pong buf from free buf queue",
-			__func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_HIST_WR_PONG_ADDR);
-
-	return 0;
-}
-
-static int vfe_stats_rs_buf_init(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_RS);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq rs ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_RS_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_RS);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq rs pong buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_RS_WR_PONG_ADDR);
-	return 0;
-}
-
-static int vfe_stats_cs_buf_init(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t addr;
-	unsigned long flags;
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_CS);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq cs ping buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_CS_WR_PING_ADDR);
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_CS);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (!addr) {
-		pr_err("%s: dq cs pong buf from free buf queue", __func__);
-		return -ENOMEM;
-	}
-	msm_camera_io_w(addr,
-		vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_STATS_CS_WR_PONG_ADDR);
-	return 0;
-}
-
-static void vfe40_cfg_qos_parms(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	void __iomem *vfebase = vfe40_ctrl->share_ctrl->vfebase;
-	msm_camera_io_w(0xAAAAAAAA, vfebase + VFE_0_BUS_BDG_QOS_CFG_0);
-	msm_camera_io_w(0xAAAAAAAA, vfebase + VFE_0_BUS_BDG_QOS_CFG_1);
-	msm_camera_io_w(0xAAAAAAAA, vfebase + VFE_0_BUS_BDG_QOS_CFG_2);
-	msm_camera_io_w(0xAAAAAAAA, vfebase + VFE_0_BUS_BDG_QOS_CFG_3);
-	msm_camera_io_w(0xAAAAAAAA, vfebase + VFE_0_BUS_BDG_QOS_CFG_4);
-	msm_camera_io_w(0xAAAAAAAA, vfebase + VFE_0_BUS_BDG_QOS_CFG_5);
-	msm_camera_io_w(0xAAAAAAAA, vfebase + VFE_0_BUS_BDG_QOS_CFG_6);
-	msm_camera_io_w(0x0002AAAA, vfebase + VFE_0_BUS_BDG_QOS_CFG_7);
-}
-
-static void vfe40_start_common(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint16_t vfe_operation_mode =
-		vfe40_ctrl->share_ctrl->current_mode & ~(VFE_OUTPUTS_RDI0|
-			VFE_OUTPUTS_RDI1);
-	CDBG("VFE opertaion mode = 0x%x, output mode = 0x%x\n",
-		vfe40_ctrl->share_ctrl->current_mode,
-		vfe40_ctrl->share_ctrl->outpath.output_mode);
-
-	vfe40_cfg_qos_parms(vfe40_ctrl);
-
-	msm_camera_io_w_mb(0x1,
-			vfe40_ctrl->share_ctrl->vfebase +
-			VFE_REG_UPDATE_CMD);
-
-	msm_camera_io_w_mb(0x00003fff,
-			vfe40_ctrl->share_ctrl->vfebase +
-			V40_AXI_BUS_CMD_OFF);
-	msm_camera_io_w_mb(1,
-			vfe40_ctrl->share_ctrl->vfebase +
-			V40_BUS_PM_CMD);
-	if (vfe_operation_mode) {
-		msm_camera_io_w_mb(1, vfe40_ctrl->share_ctrl->vfebase +
-			VFE_CAMIF_COMMAND);
-	}
-}
-
-static int vfe40_start_recording(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	vfe40_ctrl->share_ctrl->recording_state = VFE_STATE_START_REQUESTED;
-	msm_camera_io_w_mb(1,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	return 0;
-}
-
-static int vfe40_stop_recording(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	vfe40_ctrl->share_ctrl->recording_state = VFE_STATE_STOP_REQUESTED;
-	msm_camera_io_w_mb(1,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	return 0;
-}
-
-static void vfe40_start_liveshot(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	/* Hardcode 1 live snapshot for now. */
-	vfe40_ctrl->share_ctrl->outpath.out0.capture_cnt = 1;
-	vfe40_ctrl->share_ctrl->vfe_capture_count =
-		vfe40_ctrl->share_ctrl->outpath.out0.capture_cnt;
-
-	vfe40_ctrl->share_ctrl->liveshot_state = VFE_STATE_START_REQUESTED;
-	msm_camera_io_w_mb(1, vfe40_ctrl->
-		share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-static void vfe40_stop_liveshot(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	vfe40_ctrl->share_ctrl->liveshot_state = VFE_STATE_STOP_REQUESTED;
-	msm_camera_io_w_mb(1,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-static int vfe40_zsl(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	vfe40_ctrl->share_ctrl->start_ack_pending = TRUE;
-	vfe40_start_common(vfe40_ctrl);
-
-	return 0;
-}
-static int vfe40_capture_raw(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe40_ctrl_type *vfe40_ctrl,
-	uint32_t num_frames_capture)
-{
-	vfe40_ctrl->share_ctrl->outpath.out0.capture_cnt = num_frames_capture;
-	vfe40_ctrl->share_ctrl->vfe_capture_count = num_frames_capture;
-	vfe40_start_common(vfe40_ctrl);
-	return 0;
-}
-
-static int vfe40_capture(
-	struct msm_cam_media_controller *pmctl,
-	uint32_t num_frames_capture,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	/* capture command is valid for both idle and active state. */
-	vfe40_ctrl->share_ctrl->outpath.out1.capture_cnt = num_frames_capture;
-	if (vfe40_ctrl->share_ctrl->current_mode ==
-			VFE_OUTPUTS_MAIN_AND_THUMB ||
-		vfe40_ctrl->share_ctrl->current_mode ==
-			VFE_OUTPUTS_THUMB_AND_MAIN ||
-		vfe40_ctrl->share_ctrl->current_mode ==
-			VFE_OUTPUTS_JPEG_AND_THUMB ||
-		vfe40_ctrl->share_ctrl->current_mode ==
-			VFE_OUTPUTS_THUMB_AND_JPEG) {
-		vfe40_ctrl->share_ctrl->outpath.out0.capture_cnt =
-			num_frames_capture;
-	}
-
-	vfe40_ctrl->share_ctrl->vfe_capture_count = num_frames_capture;
-
-
-	vfe40_start_common(vfe40_ctrl);
-	/* for debug */
-	return 0;
-}
-
-static int vfe40_start(
-	struct msm_cam_media_controller *pmctl,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	vfe40_start_common(vfe40_ctrl);
-	return 0;
-}
-
-static void vfe40_update(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	unsigned long flags;
-	uint32_t value = 0;
-	if (vfe40_ctrl->update_linear) {
-		if (!msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase +
-			V40_LINEARIZATION_OFF1))
-			msm_camera_io_w(1,
-				vfe40_ctrl->share_ctrl->vfebase +
-				V40_LINEARIZATION_OFF1);
-		else
-			msm_camera_io_w(0,
-				vfe40_ctrl->share_ctrl->vfebase +
-				V40_LINEARIZATION_OFF1);
-		vfe40_ctrl->update_linear = false;
-	}
-
-	if (vfe40_ctrl->update_la) {
-		if (!msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + V40_LA_OFF))
-			msm_camera_io_w(1,
-				vfe40_ctrl->share_ctrl->vfebase + V40_LA_OFF);
-		else
-			msm_camera_io_w(0,
-				vfe40_ctrl->share_ctrl->vfebase + V40_LA_OFF);
-		vfe40_ctrl->update_la = false;
-	}
-
-	if (vfe40_ctrl->update_gamma) {
-		value = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + V40_RGB_G_OFF);
-		value ^= V40_GAMMA_LUT_BANK_SEL_MASK;
-		msm_camera_io_w(value,
-			vfe40_ctrl->share_ctrl->vfebase + V40_RGB_G_OFF);
-		vfe40_ctrl->update_gamma = false;
-	}
-
-	spin_lock_irqsave(&vfe40_ctrl->share_ctrl->update_ack_lock, flags);
-	vfe40_ctrl->share_ctrl->update_ack_pending = TRUE;
-	spin_unlock_irqrestore(&vfe40_ctrl->share_ctrl->update_ack_lock, flags);
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1,
-		vfe40_ctrl->share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	return;
-}
-
-static void vfe40_sync_timer_stop(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t value = 0;
-	vfe40_ctrl->sync_timer_state = 0;
-	if (vfe40_ctrl->sync_timer_number == 0)
-		value = 0x10000;
-	else if (vfe40_ctrl->sync_timer_number == 1)
-		value = 0x20000;
-	else if (vfe40_ctrl->sync_timer_number == 2)
-		value = 0x40000;
-
-	/* Timer Stop */
-	msm_camera_io_w(value,
-		vfe40_ctrl->share_ctrl->vfebase + V40_SYNC_TIMER_OFF);
-}
-
-static void vfe40_sync_timer_start(
-	const uint32_t *tbl,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	/* set bit 8 for auto increment. */
-	uint32_t value = 1;
-	uint32_t val;
-
-	vfe40_ctrl->sync_timer_state = *tbl++;
-	vfe40_ctrl->sync_timer_repeat_count = *tbl++;
-	vfe40_ctrl->sync_timer_number = *tbl++;
-	CDBG("%s timer_state %d, repeat_cnt %d timer number %d\n",
-		 __func__, vfe40_ctrl->sync_timer_state,
-		 vfe40_ctrl->sync_timer_repeat_count,
-		 vfe40_ctrl->sync_timer_number);
-
-	if (vfe40_ctrl->sync_timer_state) { /* Start Timer */
-		value = value << vfe40_ctrl->sync_timer_number;
-	} else { /* Stop Timer */
-		CDBG("Failed to Start timer\n");
-		return;
-	}
-
-	/* Timer Start */
-	msm_camera_io_w(value,
-		vfe40_ctrl->share_ctrl->vfebase + V40_SYNC_TIMER_OFF);
-	/* Sync Timer Line Start */
-	value = *tbl++;
-	msm_camera_io_w(value,
-		vfe40_ctrl->share_ctrl->vfebase + V40_SYNC_TIMER_OFF +
-		4 + ((vfe40_ctrl->sync_timer_number) * 12));
-	/* Sync Timer Pixel Start */
-	value = *tbl++;
-	msm_camera_io_w(value,
-			vfe40_ctrl->share_ctrl->vfebase + V40_SYNC_TIMER_OFF +
-			 8 + ((vfe40_ctrl->sync_timer_number) * 12));
-	/* Sync Timer Pixel Duration */
-	value = *tbl++;
-	val = vfe_clk_rate / 10000;
-	val = 10000000 / val;
-	val = value * 10000 / val;
-	CDBG("%s: Pixel Clk Cycles!!! %d\n", __func__, val);
-	msm_camera_io_w(val,
-		vfe40_ctrl->share_ctrl->vfebase + V40_SYNC_TIMER_OFF +
-		12 + ((vfe40_ctrl->sync_timer_number) * 12));
-	/* Timer0 Active High/LOW */
-	value = *tbl++;
-	msm_camera_io_w(value,
-		vfe40_ctrl->share_ctrl->vfebase + V40_SYNC_TIMER_POLARITY_OFF);
-	/* Selects sync timer 0 output to drive onto timer1 port */
-	value = 0;
-	msm_camera_io_w(value,
-		vfe40_ctrl->share_ctrl->vfebase + V40_TIMER_SELECT_OFF);
-}
-
-
-static void vfe40_write_gamma_cfg(
-	enum VFE40_DMI_RAM_SEL channel_sel,
-	const uint32_t *tbl,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	int i;
-	uint32_t value, value1, value2;
-	vfe40_program_dmi_cfg(channel_sel, vfe40_ctrl);
-	for (i = 0 ; i < (VFE40_GAMMA_NUM_ENTRIES/2) ; i++) {
-		value = *tbl++;
-		value1 = value & 0x0000FFFF;
-		value2 = (value & 0xFFFF0000)>>16;
-		msm_camera_io_w((value1),
-			vfe40_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-		msm_camera_io_w((value2),
-			vfe40_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-	}
-	vfe40_program_dmi_cfg(NO_MEM_SELECTED, vfe40_ctrl);
-}
-
-static void vfe40_read_gamma_cfg(
-	enum VFE40_DMI_RAM_SEL channel_sel,
-	uint32_t *tbl,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	int i;
-	vfe40_program_dmi_cfg(channel_sel, vfe40_ctrl);
-	CDBG("%s: Gamma table channel: %d\n", __func__, channel_sel);
-	for (i = 0 ; i < VFE40_GAMMA_NUM_ENTRIES ; i++) {
-		*tbl = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-		CDBG("%s: %08x\n", __func__, *tbl);
-		tbl++;
-	}
-	vfe40_program_dmi_cfg(NO_MEM_SELECTED, vfe40_ctrl);
-}
-
-static void vfe40_write_la_cfg(
-	enum VFE40_DMI_RAM_SEL channel_sel,
-	const uint32_t *tbl,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t i;
-	uint32_t value, value1, value2;
-
-	vfe40_program_dmi_cfg(channel_sel, vfe40_ctrl);
-	for (i = 0 ; i < (VFE40_LA_TABLE_LENGTH/2) ; i++) {
-		value = *tbl++;
-		value1 = value & 0x0000FFFF;
-		value2 = (value & 0xFFFF0000)>>16;
-		msm_camera_io_w((value1),
-			vfe40_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-		msm_camera_io_w((value2),
-			vfe40_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-	}
-	vfe40_program_dmi_cfg(NO_MEM_SELECTED, vfe40_ctrl);
-}
-
-static struct vfe40_output_ch *vfe40_get_ch(
-	int path, struct vfe_share_ctrl_t *share_ctrl)
-{
-	struct vfe40_output_ch *ch = NULL;
-
-	if (path == VFE_MSG_OUTPUT_PRIMARY)
-		ch = &share_ctrl->outpath.out0;
-	else if (path == VFE_MSG_OUTPUT_SECONDARY)
-		ch = &share_ctrl->outpath.out1;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY1)
-		ch = &share_ctrl->outpath.out2;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY2)
-		ch = &share_ctrl->outpath.out3;
-	else
-		pr_err("%s: Invalid path %d\n", __func__,
-			path);
-
-	BUG_ON(ch == NULL);
-	return ch;
-}
-static struct msm_free_buf *vfe40_check_free_buffer(
-	int id, int path, struct axi_ctrl_t *axi_ctrl)
-{
-	struct vfe40_output_ch *outch = NULL;
-	struct msm_free_buf *b = NULL;
-	uint32_t inst_handle = 0;
-
-	if (path == VFE_MSG_OUTPUT_PRIMARY)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out0.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_SECONDARY)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out1.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY1)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out2.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY2)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out3.inst_handle;
-
-	vfe40_subdev_notify(id, path, inst_handle,
-		&axi_ctrl->subdev, axi_ctrl->share_ctrl);
-	outch = vfe40_get_ch(path, axi_ctrl->share_ctrl);
-	if (outch->free_buf.ch_paddr[0])
-		b = &outch->free_buf;
-	return b;
-}
-static int configure_pingpong_buffers(
-	int id, int path, struct axi_ctrl_t *axi_ctrl)
-{
-	struct vfe40_output_ch *outch = NULL;
-	int rc = 0;
-	uint32_t inst_handle = 0;
-	if (path == VFE_MSG_OUTPUT_PRIMARY)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out0.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_SECONDARY)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out1.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY1)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out2.inst_handle;
-	else if (path == VFE_MSG_OUTPUT_TERTIARY2)
-		inst_handle = axi_ctrl->share_ctrl->outpath.out3.inst_handle;
-
-	vfe40_subdev_notify(id, path, inst_handle,
-		&axi_ctrl->subdev, axi_ctrl->share_ctrl);
-	outch = vfe40_get_ch(path, axi_ctrl->share_ctrl);
-	if (outch->ping.ch_paddr[0] && outch->pong.ch_paddr[0]) {
-		/* Configure Preview Ping Pong */
-		pr_info("%s Configure ping/pong address for %d\n",
-						__func__, path);
-		vfe40_put_ch_ping_addr(
-			axi_ctrl->share_ctrl->vfebase, outch->ch0,
-			outch->ping.ch_paddr[0]);
-		vfe40_put_ch_pong_addr(
-			axi_ctrl->share_ctrl->vfebase, outch->ch0,
-			outch->pong.ch_paddr[0]);
-
-		if ((axi_ctrl->share_ctrl->current_mode !=
-			VFE_OUTPUTS_RAW) && (path != VFE_MSG_OUTPUT_TERTIARY1)
-			&& (path != VFE_MSG_OUTPUT_TERTIARY2)) {
-			vfe40_put_ch_ping_addr(
-				axi_ctrl->share_ctrl->vfebase, outch->ch1,
-				outch->ping.ch_paddr[1]);
-			vfe40_put_ch_pong_addr(
-				axi_ctrl->share_ctrl->vfebase, outch->ch1,
-				outch->pong.ch_paddr[1]);
-		}
-
-		if (outch->ping.num_planes > 2)
-			vfe40_put_ch_ping_addr(
-				axi_ctrl->share_ctrl->vfebase, outch->ch2,
-				outch->ping.ch_paddr[2]);
-		if (outch->pong.num_planes > 2)
-			vfe40_put_ch_pong_addr(
-				axi_ctrl->share_ctrl->vfebase, outch->ch2,
-				outch->pong.ch_paddr[2]);
-
-		/* avoid stale info */
-		memset(&outch->ping, 0, sizeof(struct msm_free_buf));
-		memset(&outch->pong, 0, sizeof(struct msm_free_buf));
-	} else {
-		pr_err("%s ping/pong addr is null!!", __func__);
-		rc = -EINVAL;
-	}
-	return rc;
-}
-
-static void vfe40_write_linear_cfg(
-	enum VFE40_DMI_RAM_SEL channel_sel,
-	const uint32_t *tbl, struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	uint32_t i;
-
-	vfe40_program_dmi_cfg(channel_sel, vfe40_ctrl);
-	/* for loop for configuring LUT. */
-	for (i = 0 ; i < VFE40_LINEARIZATON_TABLE_LENGTH ; i++) {
-		msm_camera_io_w(*tbl,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_DMI_DATA_LO);
-		tbl++;
-	}
-	CDBG("done writing to linearization table\n");
-	vfe40_program_dmi_cfg(NO_MEM_SELECTED, vfe40_ctrl);
-}
-
-static void vfe40_send_isp_msg(
-	struct v4l2_subdev *sd,
-	uint32_t vfeFrameId,
-	uint32_t isp_msg_id)
-{
-	struct isp_msg_event isp_msg_evt;
-
-	isp_msg_evt.msg_id = isp_msg_id;
-	isp_msg_evt.sof_count = vfeFrameId;
-	v4l2_subdev_notify(sd,
-			NOTIFY_ISP_MSG_EVT,
-			(void *)&isp_msg_evt);
-}
-
-static int vfe40_proc_general(
-	struct msm_cam_media_controller *pmctl,
-	struct msm_isp_cmd *cmd,
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	int i , rc = 0;
-	uint32_t old_val = 0 , new_val = 0, module_val = 0;
-	uint32_t *cmdp = NULL;
-	uint32_t *cmdp_local = NULL;
-	uint32_t snapshot_cnt = 0;
-	uint32_t temp1 = 0, temp2 = 0;
-	struct msm_camera_vfe_params_t vfe_params;
-
-	CDBG("vfe40_proc_general: cmdID = %s, length = %d\n",
-		vfe40_general_cmd[cmd->id], cmd->length);
-	switch (cmd->id) {
-	case VFE_CMD_RESET:
-		pr_info("vfe40_proc_general: cmdID = %s\n",
-			vfe40_general_cmd[cmd->id]);
-		vfe40_ctrl->share_ctrl->vfe_reset_flag = true;
-		vfe40_reset(vfe40_ctrl);
-		break;
-	case VFE_CMD_START:
-		pr_info("vfe40_proc_general: cmdID = %s\n",
-			vfe40_general_cmd[cmd->id]);
-		if (copy_from_user(&vfe_params,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				rc = -EFAULT;
-				goto proc_general_done;
-		}
-
-		vfe40_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-
-		rc = vfe40_start(pmctl, vfe40_ctrl);
-		break;
-	case VFE_CMD_UPDATE:
-		vfe40_update(vfe40_ctrl);
-		break;
-	case VFE_CMD_CAPTURE_RAW:
-		pr_info("%s: cmdID = VFE_CMD_CAPTURE_RAW\n", __func__);
-		if (copy_from_user(&vfe_params,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				rc = -EFAULT;
-				goto proc_general_done;
-		}
-
-		snapshot_cnt = vfe_params.capture_count;
-		vfe40_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-		rc = vfe40_capture_raw(pmctl, vfe40_ctrl, snapshot_cnt);
-		break;
-	case VFE_CMD_CAPTURE:
-		pr_info("%s: cmdID = VFE_CMD_CAPTURE\n", __func__);
-		if (copy_from_user(&vfe_params,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				rc = -EFAULT;
-				goto proc_general_done;
-		}
-
-		snapshot_cnt = vfe_params.capture_count;
-		vfe40_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-
-		rc = vfe40_capture(pmctl, snapshot_cnt, vfe40_ctrl);
-		break;
-	case VFE_CMD_START_RECORDING:
-		pr_info("vfe40_proc_general: cmdID = %s\n",
-			vfe40_general_cmd[cmd->id]);
-		rc = vfe40_start_recording(pmctl, vfe40_ctrl);
-		break;
-	case VFE_CMD_STOP_RECORDING:
-		pr_info("vfe40_proc_general: cmdID = %s\n",
-			vfe40_general_cmd[cmd->id]);
-		rc = vfe40_stop_recording(pmctl, vfe40_ctrl);
-		break;
-	case VFE_CMD_OPERATION_CFG: {
-		if (cmd->length != V40_OPERATION_CFG_LEN) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(V40_OPERATION_CFG_LEN, GFP_ATOMIC);
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			V40_OPERATION_CFG_LEN)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe40_operation_config(cmdp, vfe40_ctrl);
-		}
-		break;
-
-	case VFE_CMD_STATS_AE_START: {
-		if (vfe40_use_bayer_stats(vfe40_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe_stats_aec_bg_buf_init(vfe40_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of AEC",
-				 __func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= BG_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp, (vfe40_cmd[cmd->id].length));
-		}
-		break;
-	case VFE_CMD_STATS_AF_START: {
-		if (vfe40_use_bayer_stats(vfe40_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe_stats_af_bf_buf_init(vfe40_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of AF",
-				__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(vfe40_ctrl->share_ctrl->vfebase +
-			VFE_MODULE_CFG);
-		old_val |= BF_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp, (vfe40_cmd[cmd->id].length));
-		}
-		break;
-	case VFE_CMD_STATS_AWB_START: {
-		if (vfe40_use_bayer_stats(vfe40_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		rc = vfe_stats_awb_buf_init(vfe40_ctrl, NULL);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of AWB",
-				 __func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= AWB_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp, (vfe40_cmd[cmd->id].length));
-		}
-		break;
-
-	case VFE_CMD_STATS_IHIST_START: {
-		rc = vfe_stats_ihist_buf_init(vfe40_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of IHIST",
-				 __func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val |= IHIST_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp, (vfe40_cmd[cmd->id].length));
-		}
-		break;
-
-
-	case VFE_CMD_STATS_RS_START: {
-		rc = vfe_stats_rs_buf_init(vfe40_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of RS",
-				__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp, (vfe40_cmd[cmd->id].length));
-		}
-		break;
-
-	case VFE_CMD_STATS_CS_START: {
-		rc = vfe_stats_cs_buf_init(vfe40_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of CS",
-				__func__);
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp, (vfe40_cmd[cmd->id].length));
-		}
-		break;
-
-	case VFE_CMD_STATS_BG_START:
-	case VFE_CMD_STATS_BF_START:
-	case VFE_CMD_STATS_BHIST_START: {
-		if (!vfe40_use_bayer_stats(vfe40_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_STATS_CFG);
-		module_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		if (VFE_CMD_STATS_BG_START == cmd->id) {
-			module_val |= BG_ENABLE_MASK;
-			rc = vfe_stats_aec_bg_buf_init(vfe40_ctrl);
-			if (rc < 0) {
-				pr_err("%s: cannot config ping/pong address of CS",
-					__func__);
-				goto proc_general_done;
-			}
-		} else if (VFE_CMD_STATS_BF_START == cmd->id) {
-			module_val |= BF_ENABLE_MASK;
-			rc = vfe_stats_af_bf_buf_init(vfe40_ctrl);
-			if (rc < 0) {
-				pr_err("%s: cannot config ping/pong address of CS",
-					__func__);
-				goto proc_general_done;
-			}
-		} else {
-			module_val |= BHIST_ENABLE_MASK;
-			old_val |= STATS_BHIST_ENABLE_MASK;
-			rc = vfe_stats_bhist_buf_init(vfe40_ctrl);
-			if (rc < 0) {
-				pr_err("%s: cannot config ping/pong address of CS",
-					__func__);
-				goto proc_general_done;
-			}
-		}
-		msm_camera_io_w(old_val, vfe40_ctrl->share_ctrl->vfebase +
-			VFE_STATS_CFG);
-		msm_camera_io_w(module_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-				(void __user *)(cmd->value),
-				cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp, (vfe40_cmd[cmd->id].length));
-		}
-		break;
-	case VFE_CMD_MCE_UPDATE:
-	case VFE_CMD_MCE_CFG:{
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		/* Incrementing with 4 so as to point to the 2nd Register as
-		the 2nd register has the mce_enable bit */
-		old_val = msm_camera_io_r(vfe40_ctrl->share_ctrl->vfebase +
-			V40_CHROMA_SUP_OFF + 4);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-		old_val &= MCE_EN_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			V40_CHROMA_SUP_OFF + 4, &new_val, 4);
-		cmdp_local += 1;
-
-		old_val = msm_camera_io_r(vfe40_ctrl->share_ctrl->vfebase +
-			V40_CHROMA_SUP_OFF + 8);
-		new_val = *cmdp_local;
-		old_val &= MCE_Q_K_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			V40_CHROMA_SUP_OFF + 8, &new_val, 4);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp_local, (vfe40_cmd[cmd->id].length));
-		}
-		break;
-	case VFE_CMD_CHROMA_SUP_UPDATE:
-	case VFE_CMD_CHROMA_SUP_CFG:{
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(vfe40_ctrl->share_ctrl->vfebase +
-			V40_CHROMA_SUP_OFF, cmdp_local, 4);
-
-		cmdp_local += 1;
-		new_val = *cmdp_local;
-		/* Incrementing with 4 so as to point to the 2nd Register as
-		 * the 2nd register has the mce_enable bit
-		 */
-		old_val = msm_camera_io_r(vfe40_ctrl->share_ctrl->vfebase +
-			V40_CHROMA_SUP_OFF + 4);
-		old_val &= ~MCE_EN_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			V40_CHROMA_SUP_OFF + 4, &new_val, 4);
-		cmdp_local += 1;
-
-		old_val = msm_camera_io_r(vfe40_ctrl->share_ctrl->vfebase +
-			V40_CHROMA_SUP_OFF + 8);
-		new_val = *cmdp_local;
-		old_val &= ~MCE_Q_K_MASK;
-		new_val = new_val | old_val;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			V40_CHROMA_SUP_OFF + 8, &new_val, 4);
-		}
-		break;
-	case VFE_CMD_BLACK_LEVEL_CFG:
-		rc = -EFAULT;
-		goto proc_general_done;
-
-	case VFE_CMD_MESH_ROLL_OFF_CFG: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value) , cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp_local, V40_MESH_ROLL_OFF_CFG_LEN);
-		cmdp_local += 9;
-		vfe40_program_dmi_cfg(ROLLOFF_RAM0_BANK0, vfe40_ctrl);
-		/* for loop for extrcting table. */
-		for (i = 0; i < (V40_MESH_ROLL_OFF_TABLE_SIZE * 2); i++) {
-			msm_camera_io_w(*cmdp_local,
-				vfe40_ctrl->share_ctrl->vfebase +
-				VFE_DMI_DATA_LO);
-			cmdp_local++;
-		}
-		CDBG("done writing mesh table\n");
-		vfe40_program_dmi_cfg(NO_MEM_SELECTED, vfe40_ctrl);
-	}
-	break;
-	case VFE_CMD_GET_MESH_ROLLOFF_TABLE:
-		break;
-
-	case VFE_CMD_LA_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp_local, (vfe40_cmd[cmd->id].length));
-
-		cmdp_local += 1;
-		vfe40_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK0,
-						   cmdp_local, vfe40_ctrl);
-		break;
-
-	case VFE_CMD_LA_UPDATE: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-
-		cmdp_local = cmdp + 1;
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + V40_LA_OFF);
-		if (old_val != 0x0)
-			vfe40_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK0,
-				cmdp_local, vfe40_ctrl);
-		else
-			vfe40_write_la_cfg(LUMA_ADAPT_LUT_RAM_BANK1,
-				cmdp_local, vfe40_ctrl);
-		}
-		vfe40_ctrl->update_la = true;
-		break;
-
-	case VFE_CMD_GET_LA_TABLE:
-		temp1 = sizeof(uint32_t) * VFE40_LA_TABLE_LENGTH / 2;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kzalloc(temp1, GFP_KERNEL);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		if (msm_camera_io_r(vfe40_ctrl->
-				share_ctrl->vfebase + V40_LA_OFF))
-			vfe40_program_dmi_cfg(LUMA_ADAPT_LUT_RAM_BANK1,
-						vfe40_ctrl);
-		else
-			vfe40_program_dmi_cfg(LUMA_ADAPT_LUT_RAM_BANK0,
-						vfe40_ctrl);
-		for (i = 0 ; i < (VFE40_LA_TABLE_LENGTH / 2) ; i++) {
-			*cmdp_local =
-				msm_camera_io_r(
-					vfe40_ctrl->share_ctrl->vfebase +
-					VFE_DMI_DATA_LO);
-			*cmdp_local |= (msm_camera_io_r(
-				vfe40_ctrl->share_ctrl->vfebase +
-				VFE_DMI_DATA_LO)) << 16;
-			cmdp_local++;
-		}
-		vfe40_program_dmi_cfg(NO_MEM_SELECTED, vfe40_ctrl);
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_SK_ENHAN_CFG:
-	case VFE_CMD_SK_ENHAN_UPDATE:{
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase + V40_SCE_OFF,
-			cmdp, V40_SCE_LEN);
-		}
-		break;
-
-	case VFE_CMD_LIVESHOT:
-		/* Configure primary channel */
-		vfe40_start_liveshot(pmctl, vfe40_ctrl);
-		break;
-
-	case VFE_CMD_LINEARIZATION_CFG:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			V40_LINEARIZATION_OFF1,
-			cmdp_local, V40_LINEARIZATION_LEN1);
-		cmdp_local = cmdp + 17;
-		vfe40_write_linear_cfg(BLACK_LUT_RAM_BANK0,
-					cmdp_local, vfe40_ctrl);
-		break;
-
-	case VFE_CMD_LINEARIZATION_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		cmdp_local++;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			V40_LINEARIZATION_OFF1 + 4,
-			cmdp_local, (V40_LINEARIZATION_LEN1 - 4));
-		cmdp_local = cmdp + 17;
-		/*extracting the bank select*/
-		old_val = msm_camera_io_r(
-				vfe40_ctrl->share_ctrl->vfebase +
-				V40_LINEARIZATION_OFF1);
-
-		if (old_val != 0x0)
-			vfe40_write_linear_cfg(BLACK_LUT_RAM_BANK0,
-						cmdp_local, vfe40_ctrl);
-		else
-			vfe40_write_linear_cfg(BLACK_LUT_RAM_BANK1,
-						cmdp_local, vfe40_ctrl);
-		vfe40_ctrl->update_linear = true;
-		break;
-
-	case VFE_CMD_GET_LINEARIZATON_TABLE:
-		temp1 = sizeof(uint32_t) * VFE40_LINEARIZATON_TABLE_LENGTH;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kzalloc(temp1, GFP_KERNEL);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		if (msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase +
-			V40_LINEARIZATION_OFF1))
-			vfe40_program_dmi_cfg(BLACK_LUT_RAM_BANK1, vfe40_ctrl);
-		else
-			vfe40_program_dmi_cfg(BLACK_LUT_RAM_BANK0, vfe40_ctrl);
-		CDBG("%s: Linearization Table\n", __func__);
-		for (i = 0 ; i < VFE40_LINEARIZATON_TABLE_LENGTH ; i++) {
-			*cmdp_local = msm_camera_io_r(
-				vfe40_ctrl->share_ctrl->vfebase +
-				VFE_DMI_DATA_LO);
-			CDBG("%s: %08x\n", __func__, *cmdp_local);
-			cmdp_local++;
-		}
-		vfe40_program_dmi_cfg(NO_MEM_SELECTED, vfe40_ctrl);
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_DEMOSAICV3:
-		if (cmd->length !=
-			V40_DEMOSAICV3_0_LEN+V40_DEMOSAICV3_1_LEN) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_0_OFF);
-		old_val &= DEMOSAIC_MASK;
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_0_OFF,
-			cmdp_local, V40_DEMOSAICV3_0_LEN);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_1_OFF,
-			cmdp_local, V40_DEMOSAICV3_1_LEN);
-		break;
-
-	case VFE_CMD_DEMOSAICV3_UPDATE:
-		if (cmd->length !=
-			V40_DEMOSAICV3_0_LEN * V40_DEMOSAICV3_UP_REG_CNT) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_0_OFF);
-		old_val &= DEMOSAIC_MASK;
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_0_OFF,
-			cmdp_local, V40_DEMOSAICV3_0_LEN);
-		/* As the address space is not contiguous increment by 2
-		 * before copying to next address space */
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_1_OFF,
-			cmdp_local, 2 * V40_DEMOSAICV3_0_LEN);
-		/* As the address space is not contiguous increment by 2
-		 * before copying to next address space */
-		cmdp_local += 2;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_2_OFF,
-			cmdp_local, 2 * V40_DEMOSAICV3_0_LEN);
-		break;
-
-	case VFE_CMD_DEMOSAICV3_ABCC_CFG:
-		rc = -EFAULT;
-		break;
-
-	case VFE_CMD_DEMOSAICV3_ABF_UPDATE:/* 116 ABF update  */
-	case VFE_CMD_DEMOSAICV3_ABF_CFG: { /* 108 ABF config  */
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_0_OFF);
-		old_val &= ABF_MASK;
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_0_OFF,
-			cmdp_local, 4);
-
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp_local, (vfe40_cmd[cmd->id].length));
-		}
-		break;
-
-	case VFE_CMD_DEMOSAICV3_DBCC_CFG:
-	case VFE_CMD_DEMOSAICV3_DBCC_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_0_OFF);
-		old_val &= DBCC_MASK;
-
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_0_OFF,
-			cmdp_local, 4);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp_local, (vfe40_cmd[cmd->id].length));
-		break;
-
-	case VFE_CMD_DEMOSAICV3_DBPC_CFG:
-	case VFE_CMD_DEMOSAICV3_DBPC_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-		new_val = *cmdp_local;
-
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + V40_DEMOSAICV3_0_OFF);
-		old_val &= DBPC_MASK;
-
-		new_val = new_val | old_val;
-		*cmdp_local = new_val;
-		msm_camera_io_memcpy(vfe40_ctrl->share_ctrl->vfebase +
-			V40_DEMOSAICV3_0_OFF,
-			cmdp_local, V40_DEMOSAICV3_0_LEN);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(vfe40_ctrl->share_ctrl->vfebase +
-			V40_DEMOSAICV3_DBPC_CFG_OFF,
-			cmdp_local, V40_DEMOSAICV3_DBPC_LEN);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(vfe40_ctrl->share_ctrl->vfebase +
-			V40_DEMOSAICV3_DBPC_CFG_OFF0,
-			cmdp_local, V40_DEMOSAICV3_DBPC_LEN);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(vfe40_ctrl->share_ctrl->vfebase +
-			V40_DEMOSAICV3_DBPC_CFG_OFF1,
-			cmdp_local, V40_DEMOSAICV3_DBPC_LEN);
-		cmdp_local += 1;
-		msm_camera_io_memcpy(vfe40_ctrl->share_ctrl->vfebase +
-			V40_DEMOSAICV3_DBPC_CFG_OFF2,
-			cmdp_local, V40_DEMOSAICV3_DBPC_LEN);
-		break;
-
-	case VFE_CMD_RGB_G_CFG: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase + V40_RGB_G_OFF,
-			cmdp, 4);
-		cmdp += 1;
-
-		vfe40_write_gamma_cfg(RGBLUT_RAM_CH0_BANK0, cmdp, vfe40_ctrl);
-		vfe40_write_gamma_cfg(RGBLUT_RAM_CH1_BANK0, cmdp, vfe40_ctrl);
-		vfe40_write_gamma_cfg(RGBLUT_RAM_CH2_BANK0, cmdp, vfe40_ctrl);
-		}
-	    cmdp -= 1;
-		break;
-
-	case VFE_CMD_RGB_G_UPDATE: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + V40_RGB_G_OFF);
-		cmdp += 1;
-		if (old_val != 0x0) {
-			vfe40_write_gamma_cfg(
-				RGBLUT_RAM_CH0_BANK0, cmdp, vfe40_ctrl);
-			vfe40_write_gamma_cfg(
-				RGBLUT_RAM_CH1_BANK0, cmdp, vfe40_ctrl);
-			vfe40_write_gamma_cfg(
-				RGBLUT_RAM_CH2_BANK0, cmdp, vfe40_ctrl);
-		} else {
-			vfe40_write_gamma_cfg(
-				RGBLUT_RAM_CH0_BANK1, cmdp, vfe40_ctrl);
-			vfe40_write_gamma_cfg(
-				RGBLUT_RAM_CH1_BANK1, cmdp, vfe40_ctrl);
-			vfe40_write_gamma_cfg(
-				RGBLUT_RAM_CH2_BANK1, cmdp, vfe40_ctrl);
-		}
-		}
-		vfe40_ctrl->update_gamma = TRUE;
-		cmdp -= 1;
-		break;
-
-	case VFE_CMD_GET_RGB_G_TABLE:
-		temp1 = sizeof(uint32_t) * VFE40_GAMMA_NUM_ENTRIES * 3;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kzalloc(temp1, GFP_KERNEL);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		cmdp_local = cmdp;
-
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + V40_RGB_G_OFF);
-		temp2 = old_val ? RGBLUT_RAM_CH0_BANK1 :
-			RGBLUT_RAM_CH0_BANK0;
-		for (i = 0; i < 3; i++) {
-			vfe40_read_gamma_cfg(temp2,
-				cmdp_local + (VFE40_GAMMA_NUM_ENTRIES * i),
-				vfe40_ctrl);
-			temp2 += 2;
-		}
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-
-	case VFE_CMD_STATS_AWB_STOP: {
-		if (vfe40_use_bayer_stats(vfe40_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~AWB_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-	case VFE_CMD_STATS_AE_STOP: {
-		if (vfe40_use_bayer_stats(vfe40_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= BG_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-	case VFE_CMD_STATS_AF_STOP: {
-		if (vfe40_use_bayer_stats(vfe40_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~BF_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-
-	case VFE_CMD_STATS_IHIST_STOP: {
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~IHIST_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-
-	case VFE_CMD_STATS_RS_STOP: {
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~RS_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-
-	case VFE_CMD_STATS_CS_STOP: {
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= ~CS_ENABLE_MASK;
-		msm_camera_io_w(old_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		}
-		break;
-
-	case VFE_CMD_STATS_BG_STOP:
-	case VFE_CMD_STATS_BF_STOP:
-	case VFE_CMD_STATS_BHIST_STOP: {
-		if (!vfe40_use_bayer_stats(vfe40_ctrl)) {
-			/* Error */
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_STATS_CFG);
-
-		if (VFE_CMD_STATS_BHIST_STOP == cmd->id)
-			old_val &= ~STATS_BHIST_ENABLE_MASK;
-
-		msm_camera_io_w(old_val,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_STATS_CFG);
-		if (VFE_CMD_STATS_BF_STOP == cmd->id) {
-			rc = vfe40_stats_flush_enqueue(vfe40_ctrl,
-					MSM_STATS_TYPE_BF);
-			if (rc < 0) {
-				pr_err("%s: dq stats buf err = %d",
-					   __func__, rc);
-				return -EINVAL;
-			}
-		}
-		}
-		break;
-
-	case VFE_CMD_STOP:
-		pr_info("vfe40_proc_general: cmdID = %s\n",
-			vfe40_general_cmd[cmd->id]);
-		if (copy_from_user(&vfe_params,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				rc = -EFAULT;
-				goto proc_general_done;
-		}
-
-		vfe40_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-		vfe40_stop(vfe40_ctrl);
-		break;
-
-	case VFE_CMD_SYNC_TIMER_SETTING:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		vfe40_sync_timer_start(cmdp, vfe40_ctrl);
-		break;
-
-	case VFE_CMD_MODULE_CFG: {
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp,
-			(void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		*cmdp &= ~STATS_ENABLE_MASK;
-		old_val = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase + VFE_MODULE_CFG);
-		old_val &= STATS_ENABLE_MASK;
-		*cmdp |= old_val;
-
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp, (vfe40_cmd[cmd->id].length));
-		}
-		break;
-
-	case VFE_CMD_ZSL:
-		if (copy_from_user(&vfe_params,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				rc = -EFAULT;
-				goto proc_general_done;
-		}
-
-		vfe40_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-
-		rc = vfe40_zsl(pmctl, vfe40_ctrl);
-		break;
-
-	case VFE_CMD_ASF_CFG:
-	case VFE_CMD_ASF_UPDATE:
-		cmdp = kmalloc(cmd->length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		if (copy_from_user(cmdp, (void __user *)(cmd->value),
-			cmd->length)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp, (vfe40_cmd[cmd->id].length));
-		cmdp_local = cmdp + V40_ASF_LEN/4;
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			V40_ASF_SPECIAL_EFX_CFG_OFF,
-			cmdp_local, V40_ASF_SPECIAL_EFX_CFG_LEN);
-		break;
-
-	case VFE_CMD_GET_HW_VERSION:
-		if (cmd->length != V40_GET_HW_VERSION_LEN) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(V40_GET_HW_VERSION_LEN, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		*cmdp = msm_camera_io_r(
-			vfe40_ctrl->share_ctrl->vfebase+V40_GET_HW_VERSION_OFF);
-		if (copy_to_user((void __user *)(cmd->value), cmdp,
-			V40_GET_HW_VERSION_LEN)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_GET_REG_DUMP:
-		temp1 = sizeof(uint32_t) *
-			vfe40_ctrl->share_ctrl->register_total;
-		if (cmd->length != temp1) {
-			rc = -EINVAL;
-			goto proc_general_done;
-		}
-		cmdp = kmalloc(temp1, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-		msm_camera_io_dump(vfe40_ctrl->share_ctrl->vfebase,
-			vfe40_ctrl->share_ctrl->register_total*4);
-		CDBG("%s: %p %p %d\n", __func__, (void *)cmdp,
-			vfe40_ctrl->share_ctrl->vfebase, temp1);
-		memcpy_fromio((void *)cmdp,
-			vfe40_ctrl->share_ctrl->vfebase, temp1);
-		if (copy_to_user((void __user *)(cmd->value), cmdp, temp1)) {
-			rc = -EFAULT;
-			goto proc_general_done;
-		}
-		break;
-	case VFE_CMD_FRAME_SKIP_CFG:
-		if (cmd->length != vfe40_cmd[cmd->id].length)
-			return -EINVAL;
-
-		cmdp = kmalloc(vfe40_cmd[cmd->id].length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-
-		if (copy_from_user((cmdp), (void __user *)cmd->value,
-				cmd->length)) {
-			rc = -EFAULT;
-			pr_err("%s copy from user failed for cmd %d",
-				__func__, cmd->id);
-			break;
-		}
-
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp, (vfe40_cmd[cmd->id].length));
-		vfe40_ctrl->frame_skip_cnt = ((uint32_t)
-			*cmdp & VFE_FRAME_SKIP_PERIOD_MASK) + 1;
-		vfe40_ctrl->frame_skip_pattern = (uint32_t)(*(cmdp + 2));
-		break;
-	case VFE_CMD_STOP_LIVESHOT:
-		CDBG("%s Stopping liveshot ", __func__);
-		vfe40_stop_liveshot(pmctl, vfe40_ctrl);
-		break;
-	default:
-		if (cmd->length != vfe40_cmd[cmd->id].length)
-			return -EINVAL;
-
-		cmdp = kmalloc(vfe40_cmd[cmd->id].length, GFP_ATOMIC);
-		if (!cmdp) {
-			rc = -ENOMEM;
-			goto proc_general_done;
-		}
-
-		if (copy_from_user((cmdp), (void __user *)cmd->value,
-				cmd->length)) {
-			rc = -EFAULT;
-			pr_err("%s copy from user failed for cmd %d",
-				__func__, cmd->id);
-			goto proc_general_done;
-		}
-		msm_camera_io_memcpy(
-			vfe40_ctrl->share_ctrl->vfebase +
-			vfe40_cmd[cmd->id].offset,
-			cmdp, (vfe40_cmd[cmd->id].length));
-		break;
-
-	}
-
-proc_general_done:
-	kfree(cmdp);
-
-	return rc;
-}
-
-static inline void vfe40_read_irq_status(
-	struct axi_ctrl_t *axi_ctrl, struct vfe40_irq_status *out)
-{
-	uint32_t *temp;
-	memset(out, 0, sizeof(struct vfe40_irq_status));
-	temp = (uint32_t *)(axi_ctrl->share_ctrl->vfebase + VFE_IRQ_STATUS_0);
-	out->vfeIrqStatus0 = msm_camera_io_r(temp);
-
-	temp = (uint32_t *)(axi_ctrl->share_ctrl->vfebase + VFE_IRQ_STATUS_1);
-	out->vfeIrqStatus1 = msm_camera_io_r(temp);
-
-	temp = (uint32_t *)(axi_ctrl->share_ctrl->vfebase + VFE_CAMIF_STATUS);
-	out->camifStatus = msm_camera_io_r(temp);
-	CDBG("camifStatus  = 0x%x\n", out->camifStatus);
-
-	/* clear the pending interrupt of the same kind.*/
-	msm_camera_io_w(out->vfeIrqStatus0,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_0);
-	msm_camera_io_w(out->vfeIrqStatus1,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CLEAR_1);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(1, axi_ctrl->share_ctrl->vfebase + VFE_IRQ_CMD);
-
-}
-
-void axi_stop_pix(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t operation_mode =
-	share_ctrl->current_mode & ~(VFE_OUTPUTS_RDI0|
-		VFE_OUTPUTS_RDI1);
-	uint32_t irq_comp_mask, irq_mask;
-	uint32_t reg_update = 0x1;
-
-	irq_comp_mask =
-		msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_COMP_MASK);
-	irq_mask = msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-
-	switch (share_ctrl->cmd_type) {
-	case AXI_CMD_PREVIEW: {
-		switch (operation_mode) {
-		case VFE_OUTPUTS_PREVIEW:
-		case VFE_OUTPUTS_PREVIEW_AND_VIDEO:
-			if (share_ctrl->comp_output_mode &
-				VFE40_OUTPUT_MODE_PRIMARY) {
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[share_ctrl->
-					outpath.out0.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[share_ctrl->
-					outpath.out0.ch1]);
-				irq_comp_mask &= ~(
-					0x1 << share_ctrl->outpath.out0.ch0 |
-					0x1 << share_ctrl->outpath.out0.ch1);
-				share_ctrl->outpath.output_mode |=
-					VFE40_OUTPUT_MODE_PRIMARY;
-			} else if (share_ctrl->comp_output_mode &
-					VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[share_ctrl->
-					outpath.out0.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[share_ctrl->
-					outpath.out0.ch1]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[share_ctrl->
-					outpath.out0.ch2]);
-				irq_comp_mask &= ~(
-					0x1 << share_ctrl->outpath.out0.ch0 |
-					0x1 << share_ctrl->outpath.out0.ch1 |
-					0x1 << share_ctrl->outpath.out0.ch2);
-				share_ctrl->outpath.output_mode |=
-					VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
-			}
-			irq_mask &= ~VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK;
-			break;
-		default:
-			if (share_ctrl->comp_output_mode &
-				VFE40_OUTPUT_MODE_SECONDARY) {
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[share_ctrl->
-					outpath.out1.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[share_ctrl->
-					outpath.out1.ch1]);
-				irq_comp_mask &= ~(
-					0x1 << share_ctrl->outpath.out1.ch0 |
-					0x1 << share_ctrl->outpath.out1.ch1);
-				share_ctrl->outpath.output_mode |=
-					VFE40_OUTPUT_MODE_SECONDARY;
-			} else if (share_ctrl->comp_output_mode &
-				VFE40_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[share_ctrl->
-					outpath.out1.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[share_ctrl->
-					outpath.out1.ch1]);
-				msm_camera_io_w(0, share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[share_ctrl->
-					outpath.out1.ch2]);
-				irq_comp_mask &= ~(
-					0x1 << share_ctrl->outpath.out1.ch0 |
-					0x1 << share_ctrl->outpath.out1.ch1 |
-					0x1 << share_ctrl->outpath.out1.ch2);
-				share_ctrl->outpath.output_mode |=
-					VFE40_OUTPUT_MODE_SECONDARY_ALL_CHNLS;
-			}
-			irq_mask &= ~VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK;
-			break;
-			}
-		}
-		break;
-	default:
-		if (share_ctrl->comp_output_mode &
-			VFE40_OUTPUT_MODE_PRIMARY) {
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[share_ctrl->
-				outpath.out0.ch0]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[share_ctrl->
-				outpath.out0.ch1]);
-			irq_comp_mask &= ~(
-				0x1 << share_ctrl->outpath.out0.ch0 |
-				0x1 << share_ctrl->outpath.out0.ch1);
-			irq_mask &= ~VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK;
-			share_ctrl->outpath.output_mode |=
-					VFE40_OUTPUT_MODE_PRIMARY;
-		} else if (share_ctrl->comp_output_mode &
-				VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[share_ctrl->
-				outpath.out0.ch0]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[share_ctrl->
-				outpath.out0.ch1]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[share_ctrl->
-				outpath.out0.ch2]);
-			irq_comp_mask &= ~(
-				0x1 << share_ctrl->outpath.out0.ch0 |
-				0x1 << share_ctrl->outpath.out0.ch1 |
-				0x1 << share_ctrl->outpath.out0.ch2);
-			irq_mask &= ~VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK;
-			share_ctrl->outpath.output_mode |=
-					VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
-		}
-
-		if (share_ctrl->comp_output_mode &
-			VFE40_OUTPUT_MODE_SECONDARY) {
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[share_ctrl->
-				outpath.out1.ch0]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[share_ctrl->outpath.out1.ch1]);
-			irq_comp_mask &= ~(
-				0x1 << share_ctrl->outpath.out1.ch0 |
-				0x1 << share_ctrl->outpath.out1.ch1);
-			irq_mask &= ~VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK;
-			share_ctrl->outpath.output_mode |=
-					VFE40_OUTPUT_MODE_SECONDARY;
-		} else if (share_ctrl->comp_output_mode &
-			VFE40_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[share_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[share_ctrl->outpath.out1.ch1]);
-			msm_camera_io_w(0, share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[share_ctrl->outpath.out1.ch2]);
-			irq_comp_mask &= ~(
-				0x1 << share_ctrl->outpath.out1.ch0 |
-				0x1 << share_ctrl->outpath.out1.ch1 |
-				0x1 << share_ctrl->outpath.out1.ch2);
-			irq_mask &= ~VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK;
-			share_ctrl->outpath.output_mode |=
-					VFE40_OUTPUT_MODE_SECONDARY_ALL_CHNLS;
-		}
-		break;
-	}
-
-	msm_camera_io_w_mb(reg_update,
-		share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	msm_camera_io_w(irq_comp_mask,
-		share_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-	msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-}
-
-void axi_stop_rdi0(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t reg_update = 0x2;
-	uint32_t irq_mask;
-	irq_mask = msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-
-	if (share_ctrl->current_mode & VFE_OUTPUTS_RDI0) {
-		msm_camera_io_w(0, share_ctrl->vfebase +
-			vfe40_AXI_WM_CFG[share_ctrl->outpath.out2.ch0]);
-		irq_mask &= ~(0x1 << (share_ctrl->outpath.out2.ch0 +
-				VFE_WM_OFFSET));
-	}
-	msm_camera_io_w_mb(reg_update,
-		share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-}
-
-void axi_stop_rdi1(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t reg_update = 0x4;
-	uint32_t irq_mask;
-	irq_mask = msm_camera_io_r(share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-
-	if (share_ctrl->current_mode & VFE_OUTPUTS_RDI1) {
-		msm_camera_io_w(1, share_ctrl->vfebase +
-			vfe40_AXI_WM_CFG[share_ctrl->outpath.out3.ch0]);
-		irq_mask &= ~(0x1 << (share_ctrl->outpath.out3.ch0 +
-			VFE_WM_OFFSET));
-	}
-	msm_camera_io_w_mb(reg_update,
-		share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	msm_camera_io_w(irq_mask, share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-}
-
-void axi_stop_process(struct vfe_share_ctrl_t *share_ctrl)
-{
-	uint32_t operation_mode =
-	share_ctrl->current_mode & ~(VFE_OUTPUTS_RDI0|
-		VFE_OUTPUTS_RDI1);
-
-	if (share_ctrl->current_mode & VFE_OUTPUTS_RDI0) {
-		axi_stop_rdi0(share_ctrl);
-		share_ctrl->comp_output_mode &= ~VFE40_OUTPUT_MODE_TERTIARY1;
-	}
-	if (share_ctrl->current_mode & VFE_OUTPUTS_RDI1) {
-		axi_stop_rdi1(share_ctrl);
-		share_ctrl->comp_output_mode &= ~VFE40_OUTPUT_MODE_TERTIARY2;
-	}
-	if (operation_mode) {
-		axi_stop_pix(share_ctrl);
-		share_ctrl->comp_output_mode &=
-				~(share_ctrl->outpath.output_mode);
-	}
-}
-
-static void vfe40_process_reg_update_irq(
-		struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	unsigned long flags;
-	struct vfe_share_ctrl_t *share_ctrl = vfe40_ctrl->share_ctrl;
-
-	if (atomic_cmpxchg(
-		&share_ctrl->pix0_update_ack_pending, 2, 0) == 2) {
-		axi_stop_pix(share_ctrl);
-		msm_camera_io_w_mb(
-				CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-				share_ctrl->vfebase + VFE_CAMIF_COMMAND);
-		axi_disable_irq(share_ctrl);
-		vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-			share_ctrl->vfeFrameId,
-			MSG_ID_PIX0_UPDATE_ACK);
-		share_ctrl->comp_output_mode &=
-				~(share_ctrl->outpath.output_mode);
-		share_ctrl->current_mode &=
-			(VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI0);
-	}  else {
-		if (share_ctrl->recording_state == VFE_STATE_START_REQUESTED) {
-			if (share_ctrl->operation_mode &
-				VFE_OUTPUTS_VIDEO_AND_PREVIEW) {
-				msm_camera_io_w(1,
-					share_ctrl->vfebase + vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(1,
-					share_ctrl->vfebase + vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out0.ch1]);
-			} else if (share_ctrl->operation_mode &
-				VFE_OUTPUTS_PREVIEW_AND_VIDEO) {
-				msm_camera_io_w(1,
-					share_ctrl->vfebase + vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out1.ch0]);
-				msm_camera_io_w(1,
-					share_ctrl->vfebase + vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out1.ch1]);
-		}
-			share_ctrl->recording_state = VFE_STATE_STARTED;
-		msm_camera_io_w_mb(1,
-				share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-		CDBG("start video triggered .\n");
-		} else if (share_ctrl->recording_state ==
-			VFE_STATE_STOP_REQUESTED) {
-			if (share_ctrl->operation_mode &
-				VFE_OUTPUTS_VIDEO_AND_PREVIEW) {
-				msm_camera_io_w(0,
-					share_ctrl->vfebase + vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(0,
-					share_ctrl->vfebase + vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out0.ch1]);
-			} else if (share_ctrl->operation_mode &
-				VFE_OUTPUTS_PREVIEW_AND_VIDEO) {
-				msm_camera_io_w(0,
-					share_ctrl->vfebase + vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out1.ch0]);
-				msm_camera_io_w(0,
-					share_ctrl->vfebase + vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out1.ch1]);
-		}
-		CDBG("stop video triggered .\n");
-	}
-
-		if (atomic_cmpxchg(
-			&share_ctrl->pix0_update_ack_pending, 1, 0) == 1) {
-			share_ctrl->comp_output_mode |=
-				(share_ctrl->outpath.output_mode
-				& ~(VFE40_OUTPUT_MODE_TERTIARY1|
-					VFE40_OUTPUT_MODE_TERTIARY2));
-		vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-				share_ctrl->vfeFrameId, MSG_ID_PIX0_UPDATE_ACK);
-			share_ctrl->current_mode &=
-				(VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI0);
-	} else {
-		if (share_ctrl->recording_state ==
-			VFE_STATE_STOP_REQUESTED) {
-				share_ctrl->recording_state = VFE_STATE_STOPPED;
-			/* request a reg update and send STOP_REC_ACK
-			 * when we process the next reg update irq.
-			 */
-			msm_camera_io_w_mb(1, share_ctrl->vfebase +
-						VFE_REG_UPDATE_CMD);
-		} else if (share_ctrl->recording_state ==
-					VFE_STATE_STOPPED) {
-			vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-					share_ctrl->vfeFrameId,
-				MSG_ID_STOP_REC_ACK);
-				share_ctrl->recording_state = VFE_STATE_IDLE;
-		}
-		spin_lock_irqsave(&share_ctrl->update_ack_lock, flags);
-		if (share_ctrl->update_ack_pending == TRUE) {
-			share_ctrl->update_ack_pending = FALSE;
-			spin_unlock_irqrestore(
-				&share_ctrl->update_ack_lock, flags);
-			vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-				share_ctrl->vfeFrameId, MSG_ID_UPDATE_ACK);
-		} else {
-			spin_unlock_irqrestore(
-					&share_ctrl->update_ack_lock, flags);
-		}
-	}
-
-	switch (share_ctrl->liveshot_state) {
-	case VFE_STATE_START_REQUESTED:
-		CDBG("%s enabling liveshot output\n", __func__);
-			if (share_ctrl->comp_output_mode &
-			VFE40_OUTPUT_MODE_PRIMARY) {
-				msm_camera_io_w(1, share_ctrl->vfebase +
-					vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(1, share_ctrl->vfebase +
-					vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out0.ch1]);
-
-				share_ctrl->liveshot_state =
-				VFE_STATE_STARTED;
-		}
-		break;
-	case VFE_STATE_STARTED:
-			share_ctrl->vfe_capture_count--;
-			if (!share_ctrl->vfe_capture_count &&
-				(share_ctrl->comp_output_mode &
-				VFE40_OUTPUT_MODE_PRIMARY)) {
-				msm_camera_io_w(0, share_ctrl->vfebase +
-					vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase +
-					vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out0.ch1]);
-		}
-		break;
-	case VFE_STATE_STOP_REQUESTED:
-		if (share_ctrl->comp_output_mode &
-			VFE40_OUTPUT_MODE_PRIMARY) {
-			/* Stop requested, stop write masters, and
-			 * trigger REG_UPDATE. Send STOP_LS_ACK in
-			 * next reg update. */
-				msm_camera_io_w(0, share_ctrl->vfebase +
-					vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(0, share_ctrl->vfebase +
-					vfe40_AXI_WM_CFG[
-				share_ctrl->outpath.out0.ch1]);
-				share_ctrl->liveshot_state = VFE_STATE_STOPPED;
-				msm_camera_io_w_mb(1, share_ctrl->vfebase +
-				VFE_REG_UPDATE_CMD);
-		}
-		break;
-	case VFE_STATE_STOPPED:
-		CDBG("%s Sending STOP_LS ACK\n", __func__);
-		vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-				share_ctrl->vfeFrameId, MSG_ID_STOP_LS_ACK);
-			share_ctrl->liveshot_state = VFE_STATE_IDLE;
-		break;
-	default:
-		break;
-	}
-
-	if ((share_ctrl->operation_mode & VFE_OUTPUTS_THUMB_AND_MAIN) ||
-		(share_ctrl->operation_mode &
-		VFE_OUTPUTS_MAIN_AND_THUMB) ||
-		(share_ctrl->operation_mode &
-		VFE_OUTPUTS_THUMB_AND_JPEG) ||
-		(share_ctrl->operation_mode &
-		VFE_OUTPUTS_JPEG_AND_THUMB)) {
-		/* in snapshot mode */
-		/* later we need to add check for live snapshot mode. */
-		if (vfe40_ctrl->frame_skip_pattern & (0x1 <<
-			(vfe40_ctrl->snapshot_frame_cnt %
-				vfe40_ctrl->frame_skip_cnt))) {
-				share_ctrl->vfe_capture_count--;
-			/* if last frame to be captured: */
-				if (share_ctrl->vfe_capture_count == 0) {
-					/* stop the bus output: */
-					if (share_ctrl->comp_output_mode
-					& VFE40_OUTPUT_MODE_PRIMARY) {
-						msm_camera_io_w(0,
-							share_ctrl->vfebase+
-							vfe40_AXI_WM_CFG[
-							share_ctrl->
-							outpath.out0.ch0]);
-						msm_camera_io_w(0,
-							share_ctrl->vfebase+
-							vfe40_AXI_WM_CFG[
-							share_ctrl->
-							outpath.out0.ch1]);
-					}
-					if (share_ctrl->comp_output_mode &
-						VFE40_OUTPUT_MODE_SECONDARY) {
-						msm_camera_io_w(0,
-							share_ctrl->vfebase+
-							vfe40_AXI_WM_CFG[
-							share_ctrl->
-							outpath.out1.ch0]);
-						msm_camera_io_w(0,
-							share_ctrl->vfebase+
-							vfe40_AXI_WM_CFG[
-							share_ctrl->
-							outpath.out1.ch1]);
-				}
-				msm_camera_io_w_mb
-				(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-					share_ctrl->vfebase +
-					VFE_CAMIF_COMMAND);
-				vfe40_ctrl->snapshot_frame_cnt = -1;
-				vfe40_ctrl->frame_skip_cnt = 31;
-				vfe40_ctrl->frame_skip_pattern = 0xffffffff;
-			} /*if snapshot count is 0*/
-		} /*if frame is not being dropped*/
-		vfe40_ctrl->snapshot_frame_cnt++;
-		/* then do reg_update. */
-		msm_camera_io_w(1,
-				share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-	} /* if snapshot mode. */
-}
-}
-
-static void vfe40_process_rdi0_reg_update_irq(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	if (atomic_cmpxchg(
-		&vfe40_ctrl->share_ctrl->rdi0_update_ack_pending, 2, 0) == 2) {
-		axi_stop_rdi0(vfe40_ctrl->share_ctrl);
-		axi_disable_irq(vfe40_ctrl->share_ctrl);
-		vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-			vfe40_ctrl->share_ctrl->vfeFrameId,
-			MSG_ID_RDI0_UPDATE_ACK);
-		vfe40_ctrl->share_ctrl->comp_output_mode &=
-			~VFE40_OUTPUT_MODE_TERTIARY1;
-		vfe40_ctrl->share_ctrl->current_mode &=
-			~(VFE_OUTPUTS_RDI0);
-	}
-
-	if (atomic_cmpxchg(
-		&vfe40_ctrl->share_ctrl->rdi0_update_ack_pending, 1, 0) == 1) {
-		vfe40_ctrl->share_ctrl->comp_output_mode |=
-			VFE40_OUTPUT_MODE_TERTIARY1;
-		vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-			vfe40_ctrl->share_ctrl->vfeFrameId,
-			MSG_ID_RDI0_UPDATE_ACK);
-		vfe40_ctrl->share_ctrl->current_mode &=
-			~(VFE_OUTPUTS_RDI0);
-	}
-}
-
-static void vfe40_process_rdi1_reg_update_irq(
-	struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	if (atomic_cmpxchg(
-		&vfe40_ctrl->share_ctrl->rdi1_update_ack_pending, 2, 0) == 2) {
-		axi_stop_rdi1(vfe40_ctrl->share_ctrl);
-		axi_disable_irq(vfe40_ctrl->share_ctrl);
-		vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-			vfe40_ctrl->share_ctrl->vfeFrameId,
-			MSG_ID_RDI1_UPDATE_ACK);
-			vfe40_ctrl->share_ctrl->comp_output_mode &=
-				~VFE40_OUTPUT_MODE_TERTIARY2;
-		vfe40_ctrl->share_ctrl->current_mode &=
-			~(VFE_OUTPUTS_RDI1);
-	}
-
-	if (atomic_cmpxchg(
-		&vfe40_ctrl->share_ctrl->rdi1_update_ack_pending, 1, 0) == 1) {
-		vfe40_ctrl->share_ctrl->comp_output_mode |=
-			VFE40_OUTPUT_MODE_TERTIARY2;
-		vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-			vfe40_ctrl->share_ctrl->vfeFrameId,
-			MSG_ID_RDI1_UPDATE_ACK);
-		vfe40_ctrl->share_ctrl->current_mode &=
-			~(VFE_OUTPUTS_RDI1);
-	}
-}
-
-static void vfe40_process_reset_irq(
-		struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	unsigned long flags;
-
-	atomic_set(&vfe40_ctrl->share_ctrl->vstate, 0);
-	atomic_set(&vfe40_ctrl->share_ctrl->handle_common_irq, 0);
-
-	spin_lock_irqsave(&vfe40_ctrl->share_ctrl->stop_flag_lock, flags);
-	if (vfe40_ctrl->share_ctrl->stop_ack_pending) {
-		vfe40_ctrl->share_ctrl->stop_ack_pending = FALSE;
-		spin_unlock_irqrestore(
-			&vfe40_ctrl->share_ctrl->stop_flag_lock, flags);
-		if (vfe40_ctrl->share_ctrl->sync_abort)
-			complete(&vfe40_ctrl->share_ctrl->reset_complete);
-		else
-		vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-				vfe40_ctrl->share_ctrl->vfeFrameId,
-				MSG_ID_STOP_ACK);
-	} else {
-		spin_unlock_irqrestore(
-			&vfe40_ctrl->share_ctrl->stop_flag_lock, flags);
-		/* this is from reset command. */
-		vfe40_reset_internal_variables(vfe40_ctrl);
-		if (vfe40_ctrl->share_ctrl->vfe_reset_flag) {
-			vfe40_ctrl->share_ctrl->vfe_reset_flag = false;
-			msm_camera_io_w(0xFF00,
-				vfe40_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-		} else {
-		/* reload all write masters. (frame & line)*/
-		msm_camera_io_w(0xFF7F,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_BUS_CMD);
-		}
-		complete(&vfe40_ctrl->share_ctrl->reset_complete);
-	}
-}
-
-static void vfe40_process_camif_sof_irq(
-		struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	if (vfe40_ctrl->share_ctrl->operation_mode &
-		VFE_OUTPUTS_RAW) {
-		if (vfe40_ctrl->share_ctrl->start_ack_pending)
-			vfe40_ctrl->share_ctrl->start_ack_pending = FALSE;
-
-		vfe40_ctrl->share_ctrl->vfe_capture_count--;
-		/* if last frame to be captured: */
-		if (vfe40_ctrl->share_ctrl->vfe_capture_count == 0) {
-			/* Ensure the write order while writing
-			 to the command register using the barrier */
-			msm_camera_io_w_mb(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-			vfe40_ctrl->share_ctrl->vfebase + VFE_CAMIF_COMMAND);
-		}
-	} /* if raw snapshot mode. */
-	if ((vfe40_ctrl->hfr_mode != HFR_MODE_OFF) &&
-		(vfe40_ctrl->share_ctrl->operation_mode ==
-			VFE_MODE_OF_OPERATION_VIDEO) &&
-		(vfe40_ctrl->share_ctrl->vfeFrameId %
-			vfe40_ctrl->hfr_mode != 0)) {
-		if (vfe40_ctrl->vfe_sof_count_enable)
-			vfe40_ctrl->share_ctrl->vfeFrameId++;
-		CDBG("Skip the SOF notification when HFR enabled\n");
-		return;
-	}
-
-	if (vfe40_ctrl->vfe_sof_count_enable)
-		vfe40_ctrl->share_ctrl->vfeFrameId++;
-
-	vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-		vfe40_ctrl->share_ctrl->vfeFrameId, MSG_ID_SOF_ACK);
-	CDBG("camif_sof_irq, frameId = %d\n",
-		vfe40_ctrl->share_ctrl->vfeFrameId);
-
-	if (vfe40_ctrl->sync_timer_state) {
-		if (vfe40_ctrl->sync_timer_repeat_count == 0)
-			vfe40_sync_timer_stop(vfe40_ctrl);
-		else
-			vfe40_ctrl->sync_timer_repeat_count--;
-	}
-}
-
-static void vfe40_process_error_irq(
-	struct axi_ctrl_t *axi_ctrl, uint32_t errStatus)
-{
-	uint32_t reg_value;
-	if (errStatus & VFE40_IMASK_VIOLATION) {
-		pr_err("vfe40_irq: violation interrupt\n");
-		reg_value = msm_camera_io_r(
-			axi_ctrl->share_ctrl->vfebase + VFE_VIOLATION_STATUS);
-		pr_err("%s: violationStatus  = 0x%x\n", __func__, reg_value);
-	}
-
-	if (errStatus & VFE40_IMASK_CAMIF_ERROR) {
-		pr_err("vfe40_irq: camif errors\n");
-		reg_value = msm_camera_io_r(
-			axi_ctrl->share_ctrl->vfebase + VFE_CAMIF_STATUS);
-		v4l2_subdev_notify(&axi_ctrl->subdev,
-			NOTIFY_VFE_CAMIF_ERROR, (void *)NULL);
-		pr_err("camifStatus  = 0x%x\n", reg_value);
-		vfe40_send_isp_msg(&axi_ctrl->subdev,
-			axi_ctrl->share_ctrl->vfeFrameId, MSG_ID_CAMIF_ERROR);
-	}
-
-	if (errStatus & VFE40_IMASK_BHIST_OVWR)
-		pr_err("vfe40_irq: stats bhist overwrite\n");
-
-	if (errStatus & VFE40_IMASK_STATS_CS_OVWR)
-		pr_err("vfe40_irq: stats cs overwrite\n");
-
-	if (errStatus & VFE40_IMASK_STATS_IHIST_OVWR)
-		pr_err("vfe40_irq: stats ihist overwrite\n");
-
-	if (errStatus & VFE40_IMASK_REALIGN_BUF_Y_OVFL)
-		pr_err("vfe40_irq: realign bug Y overflow\n");
-
-	if (errStatus & VFE40_IMASK_REALIGN_BUF_CB_OVFL)
-		pr_err("vfe40_irq: realign bug CB overflow\n");
-
-	if (errStatus & VFE40_IMASK_REALIGN_BUF_CR_OVFL)
-		pr_err("vfe40_irq: realign bug CR overflow\n");
-
-	if (errStatus & VFE40_IMASK_STATS_BE_BUS_OVFL)
-		pr_err("vfe40_irq: be stats bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_STATS_BG_BUS_OVFL)
-		pr_err("vfe40_irq: bg stats bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_STATS_BF_BUS_OVFL)
-		pr_err("vfe40_irq: bf stats bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_STATS_AWB_BUS_OVFL)
-		pr_err("vfe40_irq: awb stats bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_STATS_RS_BUS_OVFL)
-		pr_err("vfe40_irq: rs stats bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_STATS_CS_BUS_OVFL)
-		pr_err("vfe40_irq: cs stats bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_STATS_IHIST_BUS_OVFL)
-		pr_err("vfe40_irq: ihist stats bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_STATS_SKIN_BHIST_BUS_OVFL)
-		pr_err("vfe40_irq: skin/bhist stats bus overflow\n");
-}
-
-static void vfe40_process_common_error_irq(
-	struct axi_ctrl_t *axi_ctrl, uint32_t errStatus)
-{
-	if (errStatus & VFE40_IMASK_BUS_BDG_HALT_ACK)
-		pr_err("vfe40_irq: BUS BDG HALT ACK\n");
-
-	if (errStatus & VFE40_IMASK_IMG_MAST_0_BUS_OVFL)
-		pr_err("vfe40_irq: image master 0 bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_IMG_MAST_1_BUS_OVFL)
-		pr_err("vfe40_irq: image master 1 bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_IMG_MAST_2_BUS_OVFL)
-		pr_err("vfe40_irq: image master 2 bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_IMG_MAST_3_BUS_OVFL)
-		pr_err("vfe40_irq: image master 3 bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_IMG_MAST_4_BUS_OVFL)
-		pr_err("vfe40_irq: image master 4 bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_IMG_MAST_5_BUS_OVFL)
-		pr_err("vfe40_irq: image master 5 bus overflow\n");
-
-	if (errStatus & VFE40_IMASK_IMG_MAST_6_BUS_OVFL)
-		pr_err("vfe40_irq: image master 6 bus overflow\n");
-
-}
-
-static void vfe_send_outmsg(
-	struct axi_ctrl_t *axi_ctrl, uint8_t msgid,
-	uint32_t ch0_paddr, uint32_t ch1_paddr,
-	uint32_t ch2_paddr, uint32_t inst_handle)
-{
-	struct isp_msg_output msg;
-
-	msg.output_id = msgid;
-	msg.buf.inst_handle = inst_handle;
-	msg.buf.ch_paddr[0]	= ch0_paddr;
-	msg.buf.ch_paddr[1]	= ch1_paddr;
-	msg.buf.ch_paddr[2]	= ch2_paddr;
-	switch (msgid) {
-	case MSG_ID_OUTPUT_TERTIARY1:
-		msg.frameCounter = axi_ctrl->share_ctrl->rdi0FrameId;
-		break;
-	case MSG_ID_OUTPUT_TERTIARY2:
-		msg.frameCounter = axi_ctrl->share_ctrl->rdi1FrameId;
-		break;
-	default:
-		msg.frameCounter = axi_ctrl->share_ctrl->vfeFrameId;
-		break;
-	}
-
-	v4l2_subdev_notify(&axi_ctrl->subdev,
-			NOTIFY_VFE_MSG_OUT,
-			&msg);
-	return;
-}
-
-static void vfe40_process_output_path_irq_0(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr, ch1_paddr, ch2_paddr;
-	uint8_t out_bool = 0;
-	struct msm_free_buf *free_buf = NULL;
-
-	free_buf = vfe40_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-		VFE_MSG_OUTPUT_PRIMARY, axi_ctrl);
-
-	/* we render frames in the following conditions:
-	1. Continuous mode and the free buffer is avaialable.
-	2. In snapshot shot mode, free buffer is not always available.
-	when pending snapshot count is <=1,  then no need to use
-	free buffer.
-	*/
-	out_bool = (
-		(axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_THUMB_AND_MAIN ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_MAIN_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_THUMB_AND_JPEG ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_JPEG_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_RAW ||
-		axi_ctrl->share_ctrl->liveshot_state ==
-			VFE_STATE_STARTED ||
-		axi_ctrl->share_ctrl->liveshot_state ==
-			VFE_STATE_STOP_REQUESTED ||
-		axi_ctrl->share_ctrl->liveshot_state ==
-			VFE_STATE_STOPPED) &&
-		(axi_ctrl->share_ctrl->vfe_capture_count <= 1)) ||
-			free_buf;
-
-	if (out_bool) {
-		ping_pong = msm_camera_io_r(axi_ctrl->share_ctrl->vfebase +
-			VFE_BUS_PING_PONG_STATUS);
-
-		/* Channel 0*/
-		ch0_paddr = vfe40_get_ch_addr(
-			ping_pong, axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch0);
-		/* Channel 1*/
-		ch1_paddr = vfe40_get_ch_addr(
-			ping_pong, axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch1);
-		/* Channel 2*/
-		ch2_paddr = vfe40_get_ch_addr(
-			ping_pong, axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch2);
-
-		CDBG("output path 0, ch0 = 0x%x, ch1 = 0x%x, ch2 = 0x%x\n",
-			ch0_paddr, ch1_paddr, ch2_paddr);
-		if (free_buf) {
-			/* Y channel */
-			vfe40_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch0,
-			free_buf->ch_paddr[0]);
-			/* Chroma channel */
-			vfe40_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch1,
-			free_buf->ch_paddr[1]);
-			if (free_buf->num_planes > 2)
-				vfe40_put_ch_addr(ping_pong,
-					axi_ctrl->share_ctrl->vfebase,
-					axi_ctrl->share_ctrl->outpath.out0.ch2,
-					free_buf->ch_paddr[2]);
-		}
-		if (axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_THUMB_AND_JPEG ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_JPEG_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_RAW ||
-			axi_ctrl->share_ctrl->liveshot_state ==
-				VFE_STATE_STOPPED)
-			axi_ctrl->share_ctrl->outpath.out0.capture_cnt--;
-
-		vfe_send_outmsg(axi_ctrl,
-			MSG_ID_OUTPUT_PRIMARY, ch0_paddr,
-			ch1_paddr, ch2_paddr,
-			axi_ctrl->share_ctrl->outpath.out0.inst_handle);
-
-	} else {
-		axi_ctrl->share_ctrl->outpath.out0.frame_drop_cnt++;
-		CDBG("path_irq_0 - no free buffer!\n");
-	}
-}
-
-static void vfe40_process_output_path_irq_1(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr, ch1_paddr, ch2_paddr;
-	/* this must be snapshot main image output. */
-	uint8_t out_bool = 0;
-	struct msm_free_buf *free_buf = NULL;
-
-	free_buf = vfe40_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-		VFE_MSG_OUTPUT_SECONDARY, axi_ctrl);
-	out_bool = ((axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_RAW ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_JPEG_AND_THUMB) &&
-			(axi_ctrl->share_ctrl->vfe_capture_count <= 1)) ||
-				free_buf;
-
-	if (out_bool) {
-		ping_pong = msm_camera_io_r(axi_ctrl->share_ctrl->vfebase +
-			VFE_BUS_PING_PONG_STATUS);
-
-		/* Y channel */
-		ch0_paddr = vfe40_get_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch0);
-		/* Chroma channel */
-		ch1_paddr = vfe40_get_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch1);
-		ch2_paddr = vfe40_get_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch2);
-
-		CDBG("%s ch0 = 0x%x, ch1 = 0x%x, ch2 = 0x%x\n",
-			__func__, ch0_paddr, ch1_paddr, ch2_paddr);
-		if (free_buf) {
-			/* Y channel */
-			vfe40_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch0,
-			free_buf->ch_paddr[0]);
-			/* Chroma channel */
-			vfe40_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch1,
-			free_buf->ch_paddr[1]);
-			if (free_buf->num_planes > 2)
-				vfe40_put_ch_addr(ping_pong,
-					axi_ctrl->share_ctrl->vfebase,
-					axi_ctrl->share_ctrl->outpath.out1.ch2,
-					free_buf->ch_paddr[2]);
-		}
-		if (axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_RAW ||
-			axi_ctrl->share_ctrl->operation_mode &
-				VFE_OUTPUTS_JPEG_AND_THUMB)
-			axi_ctrl->share_ctrl->outpath.out1.capture_cnt--;
-
-		vfe_send_outmsg(axi_ctrl,
-			MSG_ID_OUTPUT_SECONDARY, ch0_paddr,
-			ch1_paddr, ch2_paddr,
-			axi_ctrl->share_ctrl->outpath.out1.inst_handle);
-
-	} else {
-		axi_ctrl->share_ctrl->outpath.out1.frame_drop_cnt++;
-		CDBG("path_irq_1 - no free buffer!\n");
-	}
-}
-
-static void vfe40_process_output_path_irq_rdi0(
-			struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr = 0;
-	/* this must be rdi image output. */
-	struct msm_free_buf *free_buf = NULL;
-	/*RDI0*/
-	if (axi_ctrl->share_ctrl->operation_mode & VFE_OUTPUTS_RDI0) {
-		free_buf = vfe40_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-			VFE_MSG_OUTPUT_TERTIARY1, axi_ctrl);
-		if (free_buf) {
-			ping_pong = msm_camera_io_r(axi_ctrl->
-				share_ctrl->vfebase +
-				VFE_BUS_PING_PONG_STATUS);
-
-			/* Y only channel */
-			ch0_paddr = vfe40_get_ch_addr(ping_pong,
-				axi_ctrl->share_ctrl->vfebase,
-				axi_ctrl->share_ctrl->outpath.out2.ch0);
-
-			pr_debug("%s ch0 = 0x%x\n",
-				__func__, ch0_paddr);
-
-			/* Y channel */
-			vfe40_put_ch_addr(ping_pong,
-				axi_ctrl->share_ctrl->vfebase,
-				axi_ctrl->share_ctrl->outpath.out2.ch0,
-				free_buf->ch_paddr[0]);
-
-			vfe_send_outmsg(axi_ctrl,
-				MSG_ID_OUTPUT_TERTIARY1, ch0_paddr,
-				0, 0,
-				axi_ctrl->share_ctrl->outpath.out2.inst_handle);
-
-		} else {
-			axi_ctrl->share_ctrl->outpath.out2.frame_drop_cnt++;
-			pr_err("path_irq_2 irq - no free buffer for rdi0!\n");
-		}
-	}
-}
-
-static void vfe40_process_output_path_irq_rdi1(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr = 0;
-	/* this must be rdi image output. */
-	struct msm_free_buf *free_buf = NULL;
-	/*RDI1*/
-	if (axi_ctrl->share_ctrl->operation_mode & VFE_OUTPUTS_RDI1) {
-		free_buf = vfe40_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-			VFE_MSG_OUTPUT_TERTIARY2, axi_ctrl);
-		if (free_buf) {
-			ping_pong = msm_camera_io_r(axi_ctrl->
-				share_ctrl->vfebase +
-				VFE_BUS_PING_PONG_STATUS);
-
-			/* Y channel */
-			ch0_paddr = vfe40_get_ch_addr(ping_pong,
-				axi_ctrl->share_ctrl->vfebase,
-				axi_ctrl->share_ctrl->outpath.out3.ch0);
-			pr_debug("%s ch0 = 0x%x\n",
-				__func__, ch0_paddr);
-
-			/* Y channel */
-			vfe40_put_ch_addr(ping_pong,
-				axi_ctrl->share_ctrl->vfebase,
-				axi_ctrl->share_ctrl->outpath.out3.ch0,
-				free_buf->ch_paddr[0]);
-
-			vfe_send_outmsg(axi_ctrl,
-				MSG_ID_OUTPUT_TERTIARY2, ch0_paddr,
-				0, 0,
-				axi_ctrl->share_ctrl->outpath.out3.inst_handle);
-		} else {
-			axi_ctrl->share_ctrl->outpath.out3.frame_drop_cnt++;
-			pr_err("path_irq irq - no free buffer for rdi1!\n");
-		}
-	}
-}
-
-static uint32_t  vfe40_process_stats_irq_common(
-	struct vfe40_ctrl_type *vfe40_ctrl,
-	uint32_t statsNum, uint32_t newAddr)
-{
-	uint32_t pingpongStatus;
-	uint32_t returnAddr;
-	uint32_t pingpongAddr;
-
-	/* must be 0=ping, 1=pong */
-	pingpongStatus =
-		((msm_camera_io_r(vfe40_ctrl->share_ctrl->vfebase +
-		VFE_BUS_PING_PONG_STATUS))
-	& ((uint32_t)(1<<(statsNum + 7)))) >> (statsNum + 7);
-	/* stats bits starts at 7 */
-	CDBG("statsNum %d, pingpongStatus %d\n", statsNum, pingpongStatus);
-	pingpongAddr =
-		((uint32_t)(vfe40_ctrl->share_ctrl->vfebase +
-				VFE_BUS_STATS_PING_PONG_BASE)) +
-				(3*statsNum)*4 + (1-pingpongStatus)*4;
-	returnAddr = msm_camera_io_r((uint32_t *)pingpongAddr);
-	msm_camera_io_w(newAddr, (uint32_t *)pingpongAddr);
-	return returnAddr;
-}
-
-static void vfe_send_stats_msg(
-	struct vfe40_ctrl_type *vfe40_ctrl,
-	uint32_t bufAddress, uint32_t statsNum)
-{
-	int rc = 0;
-	void *vaddr = NULL;
-	/* fill message with right content. */
-	/* @todo This is causing issues, need further investigate */
-	/* spin_lock_irqsave(&ctrl->state_lock, flags); */
-	struct isp_msg_stats msgStats;
-	uint32_t stats_type;
-	msgStats.frameCounter = vfe40_ctrl->share_ctrl->vfeFrameId;
-	if (vfe40_ctrl->simultaneous_sof_stat)
-		msgStats.frameCounter--;
-	msgStats.buffer = bufAddress;
-	switch (statsNum) {
-	case statsAeNum:{
-		msgStats.id =
-			(!vfe40_use_bayer_stats(vfe40_ctrl)) ? MSG_ID_STATS_AEC
-				: MSG_ID_STATS_BG;
-		stats_type =
-			(!vfe40_use_bayer_stats(vfe40_ctrl)) ?
-				MSM_STATS_TYPE_AEC : MSM_STATS_TYPE_BG;
-		rc = vfe40_ctrl->stats_ops.dispatch(
-				vfe40_ctrl->stats_ops.stats_ctrl,
-				stats_type, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe40_ctrl->stats_ops.client);
-		}
-		break;
-	case statsAfNum:{
-		msgStats.id =
-			(!vfe40_use_bayer_stats(vfe40_ctrl)) ? MSG_ID_STATS_AF
-				: MSG_ID_STATS_BF;
-		stats_type =
-			(!vfe40_use_bayer_stats(vfe40_ctrl)) ? MSM_STATS_TYPE_AF
-				: MSM_STATS_TYPE_BF;
-		rc = vfe40_ctrl->stats_ops.dispatch(
-				vfe40_ctrl->stats_ops.stats_ctrl,
-				stats_type, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe40_ctrl->stats_ops.client);
-		}
-		break;
-	case statsAwbNum: {
-		msgStats.id = MSG_ID_STATS_AWB;
-		rc = vfe40_ctrl->stats_ops.dispatch(
-				vfe40_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_AWB, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe40_ctrl->stats_ops.client);
-		}
-		break;
-
-	case statsIhistNum: {
-		msgStats.id = MSG_ID_STATS_IHIST;
-		rc = vfe40_ctrl->stats_ops.dispatch(
-				vfe40_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_IHIST, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe40_ctrl->stats_ops.client);
-		}
-		break;
-	case statsRsNum: {
-		msgStats.id = MSG_ID_STATS_RS;
-		rc = vfe40_ctrl->stats_ops.dispatch(
-				vfe40_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_RS, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe40_ctrl->stats_ops.client);
-		}
-		break;
-	case statsCsNum: {
-		msgStats.id = MSG_ID_STATS_CS;
-		rc = vfe40_ctrl->stats_ops.dispatch(
-				vfe40_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_CS, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe40_ctrl->stats_ops.client);
-		}
-		break;
-	case statsSkinNum: {
-		msgStats.id = MSG_ID_STATS_BHIST;
-		rc = vfe40_ctrl->stats_ops.dispatch(
-				vfe40_ctrl->stats_ops.stats_ctrl,
-				MSM_STATS_TYPE_BHIST, bufAddress,
-				&msgStats.buf_idx, &vaddr, &msgStats.fd,
-				vfe40_ctrl->stats_ops.client);
-		}
-		break;
-
-	default:
-		goto stats_done;
-	}
-	if (rc == 0) {
-		msgStats.buffer = (uint32_t)vaddr;
-		v4l2_subdev_notify(&vfe40_ctrl->subdev,
-			NOTIFY_VFE_MSG_STATS,
-			&msgStats);
-	} else {
-		pr_err("%s: paddr to idx mapping error, stats_id = %d, paddr = 0x%d",
-			 __func__, msgStats.id, msgStats.buffer);
-	}
-stats_done:
-	/* spin_unlock_irqrestore(&ctrl->state_lock, flags); */
-	return;
-}
-
-static void vfe_send_comp_stats_msg(
-	struct vfe40_ctrl_type *vfe40_ctrl, uint32_t status_bits)
-{
-	struct msm_stats_buf msgStats;
-	uint32_t temp;
-
-	msgStats.frame_id = vfe40_ctrl->share_ctrl->vfeFrameId;
-	if (vfe40_ctrl->simultaneous_sof_stat)
-		msgStats.frame_id--;
-
-	msgStats.status_bits = status_bits;
-
-	msgStats.aec.buff = vfe40_ctrl->aecbgStatsControl.bufToRender;
-	msgStats.awb.buff = vfe40_ctrl->awbStatsControl.bufToRender;
-	msgStats.af.buff = vfe40_ctrl->afbfStatsControl.bufToRender;
-
-	msgStats.ihist.buff = vfe40_ctrl->ihistStatsControl.bufToRender;
-	msgStats.rs.buff = vfe40_ctrl->rsStatsControl.bufToRender;
-	msgStats.cs.buff = vfe40_ctrl->csStatsControl.bufToRender;
-
-	temp = msm_camera_io_r(
-		vfe40_ctrl->share_ctrl->vfebase + VFE_STATS_AWB_SGW_CFG);
-	msgStats.awb_ymin = (0xFF00 & temp) >> 8;
-
-	v4l2_subdev_notify(&vfe40_ctrl->subdev,
-				NOTIFY_VFE_MSG_COMP_STATS,
-				&msgStats);
-}
-
-static void vfe40_process_stats_bg_irq(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	uint32_t stats_type;
-	stats_type =
-		(!vfe40_use_bayer_stats(vfe40_ctrl)) ? MSM_STATS_TYPE_AEC
-			: MSM_STATS_TYPE_BG;
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe40_ctrl->aecbgStatsControl.bufToRender =
-			vfe40_process_stats_irq_common(vfe40_ctrl, statsAeNum,
-			addr);
-
-		vfe_send_stats_msg(vfe40_ctrl,
-			vfe40_ctrl->aecbgStatsControl.bufToRender, statsAeNum);
-	} else{
-		vfe40_ctrl->aecbgStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe40_ctrl->aecbgStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe40_process_stats_awb_irq(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_AWB);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe40_ctrl->awbStatsControl.bufToRender =
-			vfe40_process_stats_irq_common(vfe40_ctrl, statsAwbNum,
-			addr);
-
-		vfe_send_stats_msg(vfe40_ctrl,
-			vfe40_ctrl->awbStatsControl.bufToRender, statsAwbNum);
-	} else{
-		vfe40_ctrl->awbStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe40_ctrl->awbStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe40_process_stats_bf_irq(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	uint32_t stats_type;
-	stats_type =
-		(!vfe40_use_bayer_stats(vfe40_ctrl)) ? MSM_STATS_TYPE_AF
-			: MSM_STATS_TYPE_BF;
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, stats_type);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe40_ctrl->afbfStatsControl.bufToRender =
-			vfe40_process_stats_irq_common(vfe40_ctrl, statsAfNum,
-			addr);
-
-		vfe_send_stats_msg(vfe40_ctrl,
-			vfe40_ctrl->afbfStatsControl.bufToRender, statsAfNum);
-	} else{
-		vfe40_ctrl->afbfStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe40_ctrl->afbfStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe40_process_stats_bhist_irq(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_BHIST);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe40_ctrl->bhistStatsControl.bufToRender =
-			vfe40_process_stats_irq_common(vfe40_ctrl,
-				statsSkinNum, addr);
-
-		vfe_send_stats_msg(vfe40_ctrl,
-			vfe40_ctrl->bhistStatsControl.bufToRender,
-			statsSkinNum);
-	} else{
-		vfe40_ctrl->bhistStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe40_ctrl->bhistStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe40_process_stats_ihist_irq(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_IHIST);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe40_ctrl->ihistStatsControl.bufToRender =
-			vfe40_process_stats_irq_common(
-			vfe40_ctrl, statsIhistNum, addr);
-
-		vfe_send_stats_msg(vfe40_ctrl,
-			vfe40_ctrl->ihistStatsControl.bufToRender,
-			statsIhistNum);
-	} else {
-		vfe40_ctrl->ihistStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe40_ctrl->ihistStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe40_process_stats_rs_irq(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_RS);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe40_ctrl->rsStatsControl.bufToRender =
-			vfe40_process_stats_irq_common(vfe40_ctrl, statsRsNum,
-			addr);
-
-		vfe_send_stats_msg(vfe40_ctrl,
-			vfe40_ctrl->rsStatsControl.bufToRender, statsRsNum);
-	} else {
-		vfe40_ctrl->rsStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe40_ctrl->rsStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe40_process_stats_cs_irq(struct vfe40_ctrl_type *vfe40_ctrl)
-{
-	unsigned long flags;
-	uint32_t addr;
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl, MSM_STATS_TYPE_CS);
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (addr) {
-		vfe40_ctrl->csStatsControl.bufToRender =
-			vfe40_process_stats_irq_common(vfe40_ctrl, statsCsNum,
-			addr);
-
-			vfe_send_stats_msg(vfe40_ctrl,
-				vfe40_ctrl->csStatsControl.bufToRender,
-				statsCsNum);
-	} else {
-		vfe40_ctrl->csStatsControl.droppedStatsFrameCount++;
-		CDBG("%s: droppedStatsFrameCount = %d", __func__,
-			vfe40_ctrl->csStatsControl.droppedStatsFrameCount);
-	}
-}
-
-static void vfe40_process_stats(struct vfe40_ctrl_type *vfe40_ctrl,
-	uint32_t status_bits)
-{
-	unsigned long flags;
-	int32_t process_stats = false;
-	uint32_t addr;
-	uint32_t stats_type;
-
-	CDBG("%s, stats = 0x%x\n", __func__, status_bits);
-	spin_lock_irqsave(&vfe40_ctrl->stats_bufq_lock, flags);
-	stats_type =
-		(!vfe40_use_bayer_stats(vfe40_ctrl)) ? MSM_STATS_TYPE_AEC
-			: MSM_STATS_TYPE_BG;
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_BG) {
-		addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl,
-				stats_type);
-		if (addr) {
-			vfe40_ctrl->aecbgStatsControl.bufToRender =
-				vfe40_process_stats_irq_common(
-				vfe40_ctrl, statsAeNum,	addr);
-			process_stats = true;
-		} else{
-			vfe40_ctrl->aecbgStatsControl.bufToRender = 0;
-			vfe40_ctrl->aecbgStatsControl.droppedStatsFrameCount++;
-		}
-	} else {
-		vfe40_ctrl->aecbgStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_AWB) {
-		addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl,
-			MSM_STATS_TYPE_AWB);
-		if (addr) {
-			vfe40_ctrl->awbStatsControl.bufToRender =
-				vfe40_process_stats_irq_common(
-				vfe40_ctrl, statsAwbNum,
-				addr);
-			process_stats = true;
-		} else{
-			vfe40_ctrl->awbStatsControl.droppedStatsFrameCount++;
-			vfe40_ctrl->awbStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe40_ctrl->awbStatsControl.bufToRender = 0;
-	}
-
-	stats_type =
-		(!vfe40_use_bayer_stats(vfe40_ctrl)) ? MSM_STATS_TYPE_AF
-			: MSM_STATS_TYPE_BF;
-	if (status_bits & VFE_IRQ_STATUS0_STATS_BF) {
-		addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl,
-					stats_type);
-		if (addr) {
-			vfe40_ctrl->afbfStatsControl.bufToRender =
-				vfe40_process_stats_irq_common(
-				vfe40_ctrl, statsAfNum,
-				addr);
-			process_stats = true;
-		} else {
-			vfe40_ctrl->afbfStatsControl.bufToRender = 0;
-			vfe40_ctrl->afbfStatsControl.droppedStatsFrameCount++;
-		}
-	} else {
-		vfe40_ctrl->afbfStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_IHIST) {
-		addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl,
-					MSM_STATS_TYPE_IHIST);
-		if (addr) {
-			vfe40_ctrl->ihistStatsControl.bufToRender =
-				vfe40_process_stats_irq_common(
-				vfe40_ctrl, statsIhistNum,
-				addr);
-			process_stats = true;
-		} else {
-			vfe40_ctrl->ihistStatsControl.droppedStatsFrameCount++;
-			vfe40_ctrl->ihistStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe40_ctrl->ihistStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_RS) {
-		addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl,
-					MSM_STATS_TYPE_RS);
-		if (addr) {
-			vfe40_ctrl->rsStatsControl.bufToRender =
-				vfe40_process_stats_irq_common(
-				vfe40_ctrl, statsRsNum,
-				addr);
-			process_stats = true;
-		} else {
-			vfe40_ctrl->rsStatsControl.droppedStatsFrameCount++;
-			vfe40_ctrl->rsStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe40_ctrl->rsStatsControl.bufToRender = 0;
-	}
-
-	if (status_bits & VFE_IRQ_STATUS0_STATS_CS) {
-		addr = (uint32_t)vfe40_stats_dqbuf(vfe40_ctrl,
-					MSM_STATS_TYPE_CS);
-		if (addr) {
-			vfe40_ctrl->csStatsControl.bufToRender =
-				vfe40_process_stats_irq_common(
-				vfe40_ctrl, statsCsNum,
-				addr);
-			process_stats = true;
-		} else {
-			vfe40_ctrl->csStatsControl.droppedStatsFrameCount++;
-			vfe40_ctrl->csStatsControl.bufToRender = 0;
-		}
-	} else {
-		vfe40_ctrl->csStatsControl.bufToRender = 0;
-	}
-	spin_unlock_irqrestore(&vfe40_ctrl->stats_bufq_lock, flags);
-	if (process_stats)
-		vfe_send_comp_stats_msg(vfe40_ctrl, status_bits);
-
-	return;
-}
-
-static void vfe40_process_stats_irq(
-	struct vfe40_ctrl_type *vfe40_ctrl, uint32_t irqstatus)
-{
-	uint32_t status_bits = VFE_COM_STATUS & irqstatus;
-	if ((vfe40_ctrl->hfr_mode != HFR_MODE_OFF) &&
-		(vfe40_ctrl->share_ctrl->vfeFrameId %
-		 vfe40_ctrl->hfr_mode != 0)) {
-		CDBG("Skip the stats when HFR enabled\n");
-		return;
-	}
-
-	vfe40_process_stats(vfe40_ctrl, status_bits);
-	return;
-}
-
-static void vfe40_process_irq(
-	struct vfe40_ctrl_type *vfe40_ctrl, uint32_t irqstatus)
-{
-	if (irqstatus &
-		VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK_0) {
-		vfe40_process_stats_irq(vfe40_ctrl, irqstatus);
-		return;
-	}
-
-	switch (irqstatus) {
-	case VFE_IRQ_STATUS0_CAMIF_SOF_MASK:
-		CDBG("irq	camifSofIrq\n");
-		vfe40_process_camif_sof_irq(vfe40_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_REG_UPDATE_MASK:
-		CDBG("irq	regUpdateIrq\n");
-		vfe40_process_reg_update_irq(vfe40_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_RDI0_REG_UPDATE:
-		CDBG("irq	rdi0 regUpdateIrq\n");
-		vfe40_process_rdi0_reg_update_irq(vfe40_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_RDI1_REG_UPDATE:
-		CDBG("irq	rdi1 regUpdateIrq\n");
-		vfe40_process_rdi1_reg_update_irq(vfe40_ctrl);
-		break;
-	case VFE_IMASK_WHILE_STOPPING_0:
-		CDBG("irq	resetAckIrq\n");
-		vfe40_process_reset_irq(vfe40_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_BG:
-		CDBG("Stats BG irq occured.\n");
-		vfe40_process_stats_bg_irq(vfe40_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_BF:
-		CDBG("Stats BF irq occured.\n");
-		vfe40_process_stats_bf_irq(vfe40_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_AWB:
-		CDBG("Stats AWB irq occured.\n");
-		vfe40_process_stats_awb_irq(vfe40_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_SKIN_BHIST:
-		CDBG("Stats BHIST irq occured.\n");
-		vfe40_process_stats_bhist_irq(vfe40_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_IHIST:
-		CDBG("Stats IHIST irq occured.\n");
-		vfe40_process_stats_ihist_irq(vfe40_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_RS:
-		CDBG("Stats RS irq occured.\n");
-		vfe40_process_stats_rs_irq(vfe40_ctrl);
-		break;
-	case VFE_IRQ_STATUS0_STATS_CS:
-		CDBG("Stats CS irq occured.\n");
-		vfe40_process_stats_cs_irq(vfe40_ctrl);
-		break;
-	case VFE_IRQ_STATUS1_SYNC_TIMER0:
-		CDBG("SYNC_TIMER 0 irq occured.\n");
-		vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-			vfe40_ctrl->share_ctrl->vfeFrameId,
-			MSG_ID_SYNC_TIMER0_DONE);
-		break;
-	case VFE_IRQ_STATUS1_SYNC_TIMER1:
-		CDBG("SYNC_TIMER 1 irq occured.\n");
-		vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-			vfe40_ctrl->share_ctrl->vfeFrameId,
-			MSG_ID_SYNC_TIMER1_DONE);
-		break;
-	case VFE_IRQ_STATUS1_SYNC_TIMER2:
-		CDBG("SYNC_TIMER 2 irq occured.\n");
-		vfe40_send_isp_msg(&vfe40_ctrl->subdev,
-			vfe40_ctrl->share_ctrl->vfeFrameId,
-			MSG_ID_SYNC_TIMER2_DONE);
-		break;
-	default:
-		pr_err("Invalid IRQ status\n");
-	}
-}
-
-static void axi40_do_tasklet(unsigned long data)
-{
-	unsigned long flags;
-	struct axi_ctrl_t *axi_ctrl = (struct axi_ctrl_t *)data;
-	struct vfe40_ctrl_type *vfe40_ctrl = axi_ctrl->share_ctrl->vfe40_ctrl;
-	struct vfe40_isr_queue_cmd *qcmd = NULL;
-	int stat_interrupt;
-
-	CDBG("=== axi40_do_tasklet start ===\n");
-
-	while (atomic_read(&irq_cnt)) {
-		spin_lock_irqsave(&axi_ctrl->tasklet_lock, flags);
-		qcmd = list_first_entry(&axi_ctrl->tasklet_q,
-			struct vfe40_isr_queue_cmd, list);
-		atomic_sub(1, &irq_cnt);
-
-		if (!qcmd) {
-			spin_unlock_irqrestore(&axi_ctrl->tasklet_lock,
-				flags);
-			return;
-		}
-
-		list_del(&qcmd->list);
-		spin_unlock_irqrestore(&axi_ctrl->tasklet_lock,
-			flags);
-
-		if (axi_ctrl->share_ctrl->stats_comp) {
-			stat_interrupt = (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK_0);
-		} else {
-			stat_interrupt =
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_BG) |
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_AWB) |
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_BF) |
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_IHIST) |
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_RS) |
-				(qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_CS);
-		}
-		if (qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_CAMIF_SOF_MASK) {
-			if (stat_interrupt)
-				vfe40_ctrl->simultaneous_sof_stat = 1;
-			v4l2_subdev_notify(&vfe40_ctrl->subdev,
-				NOTIFY_VFE_IRQ,
-				(void *)VFE_IRQ_STATUS0_CAMIF_SOF_MASK);
-		}
-
-		/* interrupt to be processed,  *qcmd has the payload.  */
-		if (qcmd->vfeInterruptStatus0 &
-				VFE_IRQ_STATUS0_REG_UPDATE_MASK)
-			v4l2_subdev_notify(&vfe40_ctrl->subdev,
-				NOTIFY_VFE_IRQ,
-				(void *)VFE_IRQ_STATUS0_REG_UPDATE_MASK);
-
-		if (qcmd->vfeInterruptStatus1 &
-				VFE_IRQ_STATUS0_RDI0_REG_UPDATE_MASK)
-			v4l2_subdev_notify(&vfe40_ctrl->subdev,
-				NOTIFY_VFE_IRQ,
-				(void *)VFE_IRQ_STATUS0_RDI0_REG_UPDATE);
-
-		if (qcmd->vfeInterruptStatus1 &
-				VFE_IRQ_STATUS0_RDI1_REG_UPDATE_MASK)
-			v4l2_subdev_notify(&vfe40_ctrl->subdev,
-				NOTIFY_VFE_IRQ,
-				(void *)VFE_IRQ_STATUS0_RDI1_REG_UPDATE);
-
-		if (qcmd->vfeInterruptStatus0 &
-				VFE_IMASK_WHILE_STOPPING_0)
-			v4l2_subdev_notify(&vfe40_ctrl->subdev,
-				NOTIFY_VFE_IRQ,
-				(void *)VFE_IMASK_WHILE_STOPPING_0);
-
-		if (atomic_read(&axi_ctrl->share_ctrl->handle_common_irq)) {
-			if (qcmd->vfeInterruptStatus1 &
-					VFE40_IMASK_COMMON_ERROR_ONLY_1) {
-				pr_err("irq	errorIrq\n");
-				vfe40_process_common_error_irq(
-					axi_ctrl,
-					qcmd->vfeInterruptStatus1 &
-					VFE40_IMASK_COMMON_ERROR_ONLY_1);
-			}
-
-			v4l2_subdev_notify(&axi_ctrl->subdev,
-				NOTIFY_AXI_IRQ,
-				(void *)qcmd->vfeInterruptStatus0);
-		}
-
-		if (atomic_read(&axi_ctrl->share_ctrl->vstate)) {
-			if (qcmd->vfeInterruptStatus1 &
-					VFE40_IMASK_VFE_ERROR_ONLY_1) {
-				pr_err("irq	errorIrq\n");
-				vfe40_process_error_irq(
-					axi_ctrl,
-					qcmd->vfeInterruptStatus1 &
-					VFE40_IMASK_VFE_ERROR_ONLY_1);
-			}
-
-			/* then process stats irq. */
-			if (axi_ctrl->share_ctrl->stats_comp) {
-				/* process stats comb interrupt. */
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK_0) {
-					CDBG("Stats composite irq occured.\n");
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)qcmd->vfeInterruptStatus0);
-				}
-			} else {
-				/* process individual stats interrupt. */
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_BG)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_BG);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_AWB)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_AWB);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_BF)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_BF);
-				if (qcmd->vfeInterruptStatus0 &
-					VFE_IRQ_STATUS0_STATS_SKIN_BHIST)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)
-					VFE_IRQ_STATUS0_STATS_SKIN_BHIST);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_IHIST)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_IHIST);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_RS)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_RS);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS0_STATS_CS)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS0_STATS_CS);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS1_SYNC_TIMER0)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS1_SYNC_TIMER0);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS1_SYNC_TIMER1)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS1_SYNC_TIMER1);
-
-				if (qcmd->vfeInterruptStatus0 &
-						VFE_IRQ_STATUS1_SYNC_TIMER2)
-					v4l2_subdev_notify(&vfe40_ctrl->subdev,
-					NOTIFY_VFE_IRQ,
-					(void *)VFE_IRQ_STATUS1_SYNC_TIMER2);
-			}
-		}
-		vfe40_ctrl->simultaneous_sof_stat = 0;
-		kfree(qcmd);
-	}
-	CDBG("=== axi40_do_tasklet end ===\n");
-}
-
-static irqreturn_t vfe40_parse_irq(int irq_num, void *data)
-{
-	unsigned long flags;
-	struct vfe40_irq_status irq;
-	struct vfe40_isr_queue_cmd *qcmd;
-	struct axi_ctrl_t *axi_ctrl = data;
-
-	CDBG("vfe_parse_irq\n");
-
-	vfe40_read_irq_status(axi_ctrl, &irq);
-
-	if ((irq.vfeIrqStatus0 == 0) && (irq.vfeIrqStatus1 == 0)) {
-		CDBG("vfe_parse_irq: vfeIrqStatus0 & 1 are both 0!\n");
-		return IRQ_HANDLED;
-	}
-
-	qcmd = kzalloc(sizeof(struct vfe40_isr_queue_cmd),
-		GFP_ATOMIC);
-	if (!qcmd) {
-		pr_err("vfe_parse_irq: qcmd malloc failed!\n");
-		return IRQ_HANDLED;
-	}
-
-	spin_lock_irqsave(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-	if (axi_ctrl->share_ctrl->stop_ack_pending) {
-		irq.vfeIrqStatus0 &= VFE_IMASK_WHILE_STOPPING_0;
-		irq.vfeIrqStatus1 &= VFE_IMASK_WHILE_STOPPING_1;
-	}
-	spin_unlock_irqrestore(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-
-	CDBG("vfe_parse_irq: Irq_status0 = 0x%x, Irq_status1 = 0x%x.\n",
-		irq.vfeIrqStatus0, irq.vfeIrqStatus1);
-
-	qcmd->vfeInterruptStatus0 = irq.vfeIrqStatus0;
-	qcmd->vfeInterruptStatus1 = irq.vfeIrqStatus1;
-
-	spin_lock_irqsave(&axi_ctrl->tasklet_lock, flags);
-	list_add_tail(&qcmd->list, &axi_ctrl->tasklet_q);
-
-	atomic_add(1, &irq_cnt);
-	spin_unlock_irqrestore(&axi_ctrl->tasklet_lock, flags);
-	tasklet_schedule(&axi_ctrl->vfe40_tasklet);
-	return IRQ_HANDLED;
-}
-
-int msm_axi_subdev_isr_routine(struct v4l2_subdev *sd,
-	u32 status, bool *handled)
-{
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	irqreturn_t ret;
-	CDBG("%s E ", __func__);
-	ret = vfe40_parse_irq(axi_ctrl->vfeirq->start, axi_ctrl);
-	*handled = TRUE;
-	return 0;
-}
-
-static long vfe_stats_bufq_sub_ioctl(
-	struct vfe40_ctrl_type *vfe_ctrl,
-	struct msm_vfe_cfg_cmd *cmd, void *ion_client, int domain_num)
-{
-	long rc = 0;
-	switch (cmd->cmd_type) {
-	case VFE_CMD_STATS_REQBUF:
-	if (!vfe_ctrl->stats_ops.stats_ctrl) {
-		/* stats_ctrl has not been init yet */
-		rc = msm_stats_buf_ops_init(&vfe_ctrl->stats_ctrl,
-				(struct ion_client *)ion_client,
-				&vfe_ctrl->stats_ops);
-		if (rc < 0) {
-			pr_err("%s: cannot init stats ops", __func__);
-			goto end;
-		}
-		rc = vfe_ctrl->stats_ops.stats_ctrl_init(&vfe_ctrl->stats_ctrl);
-		if (rc < 0) {
-			pr_err("%s: cannot init stats_ctrl ops", __func__);
-			memset(&vfe_ctrl->stats_ops, 0,
-				sizeof(vfe_ctrl->stats_ops));
-			goto end;
-		}
-		if (sizeof(struct msm_stats_reqbuf) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats reqbuf input size = %d,\n"
-				"struct size = %d, mitch match\n",
-				 __func__, cmd->length,
-				sizeof(struct msm_stats_reqbuf));
-			rc = -EINVAL ;
-			goto end;
-		}
-	}
-	rc = vfe_ctrl->stats_ops.reqbuf(
-			&vfe_ctrl->stats_ctrl,
-			(struct msm_stats_reqbuf *)cmd->value,
-			vfe_ctrl->stats_ops.client);
-	break;
-	case VFE_CMD_STATS_ENQUEUEBUF:
-	if (sizeof(struct msm_stats_buf_info) != cmd->length) {
-		/* error. the length not match */
-		pr_err("%s: stats enqueuebuf input size = %d,\n"
-			"struct size = %d, mitch match\n",
-			 __func__, cmd->length,
-			sizeof(struct msm_stats_buf_info));
-			rc = -EINVAL;
-			goto end;
-	}
-	rc = vfe_ctrl->stats_ops.enqueue_buf(
-			&vfe_ctrl->stats_ctrl,
-			(struct msm_stats_buf_info *)cmd->value,
-			vfe_ctrl->stats_ops.client, domain_num);
-	break;
-	case VFE_CMD_STATS_FLUSH_BUFQ:
-	{
-		struct msm_stats_flush_bufq *flush_req = NULL;
-		flush_req = (struct msm_stats_flush_bufq *)cmd->value;
-		if (sizeof(struct msm_stats_flush_bufq) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats flush queue input size = %d,\n"
-				"struct size = %d, mitch match\n",
-				__func__, cmd->length,
-				sizeof(struct msm_stats_flush_bufq));
-			rc = -EINVAL;
-			goto end;
-	}
-	rc = vfe_ctrl->stats_ops.bufq_flush(
-			&vfe_ctrl->stats_ctrl,
-			(enum msm_stats_enum_type)flush_req->stats_type,
-			vfe_ctrl->stats_ops.client);
-	}
-	break;
-	case VFE_CMD_STATS_UNREGBUF:
-	{
-		struct msm_stats_reqbuf *req_buf = NULL;
-		req_buf = (struct msm_stats_reqbuf *)cmd->value;
-		if (sizeof(struct msm_stats_reqbuf) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats reqbuf input size = %d,\n"
-				"struct size = %d, mitch match\n",
-				 __func__, cmd->length,
-				sizeof(struct msm_stats_reqbuf));
-			rc = -EINVAL ;
-			goto end;
-		}
-		rc = vfe40_stats_unregbuf(vfe_ctrl, req_buf, domain_num);
-	}
-	break;
-	default:
-		rc = -1;
-		pr_err("%s: cmd_type %d not supported", __func__,
-			cmd->cmd_type);
-	break;
-	}
-end:
-	return rc;
-}
-
-static long msm_vfe_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int subdev_cmd, void *arg)
-{
-	struct msm_cam_media_controller *pmctl =
-		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
-	struct vfe40_ctrl_type *vfe40_ctrl =
-		(struct vfe40_ctrl_type *)v4l2_get_subdevdata(sd);
-	struct msm_isp_cmd vfecmd;
-	struct msm_camvfe_params *vfe_params;
-	struct msm_vfe_cfg_cmd *cmd;
-	void *data;
-
-	long rc = 0;
-	struct vfe_cmd_stats_buf *scfg = NULL;
-	struct vfe_cmd_stats_ack *sack = NULL;
-
-	if (!vfe40_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return -EFAULT;
-	}
-
-	CDBG("%s\n", __func__);
-	if (subdev_cmd == VIDIOC_MSM_VFE_INIT) {
-		CDBG("%s init\n", __func__);
-		return msm_vfe_subdev_init(sd);
-	} else if (subdev_cmd == VIDIOC_MSM_VFE_RELEASE) {
-		msm_vfe_subdev_release(sd);
-		return 0;
-	}
-	vfe_params = (struct msm_camvfe_params *)arg;
-	cmd = vfe_params->vfe_cfg;
-	data = vfe_params->data;
-	switch (cmd->cmd_type) {
-	case CMD_VFE_PROCESS_IRQ:
-		vfe40_process_irq(vfe40_ctrl, (uint32_t) data);
-		return rc;
-	case VFE_CMD_STATS_REQBUF:
-	case VFE_CMD_STATS_ENQUEUEBUF:
-	case VFE_CMD_STATS_FLUSH_BUFQ:
-	case VFE_CMD_STATS_UNREGBUF:
-		/* for easy porting put in one envelope */
-		rc = vfe_stats_bufq_sub_ioctl(vfe40_ctrl,
-				cmd, vfe_params->data, pmctl->domain_num);
-		return rc;
-	default:
-		if (cmd->cmd_type != CMD_CONFIG_PING_ADDR &&
-		cmd->cmd_type != CMD_CONFIG_PONG_ADDR &&
-		cmd->cmd_type != CMD_CONFIG_FREE_BUF_ADDR &&
-		cmd->cmd_type != CMD_STATS_AEC_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_AWB_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_IHIST_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_RS_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_CS_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_AF_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_BG_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_BF_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_BHIST_BUF_RELEASE &&
-		cmd->cmd_type != CMD_VFE_PIX_SOF_COUNT_UPDATE &&
-		cmd->cmd_type != CMD_VFE_COUNT_PIX_SOF_ENABLE) {
-			if (copy_from_user(&vfecmd,
-					(void __user *)(cmd->value),
-					sizeof(vfecmd))) {
-				pr_err("%s %d: copy_from_user failed\n",
-					__func__, __LINE__);
-				return -EFAULT;
-			}
-		} else {
-			/* here eith stats release or frame release. */
-			if (cmd->cmd_type != CMD_CONFIG_PING_ADDR &&
-				cmd->cmd_type != CMD_CONFIG_PONG_ADDR &&
-				cmd->cmd_type != CMD_CONFIG_FREE_BUF_ADDR) {
-				/* then must be stats release. */
-				if (!data) {
-					pr_err("%s: data = NULL, cmd->cmd_type = %d",
-						__func__, cmd->cmd_type);
-					return -EFAULT;
-				}
-				sack = kmalloc(sizeof(struct vfe_cmd_stats_ack),
-							GFP_ATOMIC);
-				if (!sack) {
-					pr_err("%s: no mem for cmd->cmd_type = %d",
-					 __func__, cmd->cmd_type);
-					return -ENOMEM;
-				}
-				sack->nextStatsBuf = *(uint32_t *)data;
-			}
-		}
-	}
-
-	CDBG("%s: cmdType = %d\n", __func__, cmd->cmd_type);
-
-	if ((cmd->cmd_type == CMD_STATS_AF_ENABLE)    ||
-		(cmd->cmd_type == CMD_STATS_AWB_ENABLE)   ||
-		(cmd->cmd_type == CMD_STATS_IHIST_ENABLE) ||
-		(cmd->cmd_type == CMD_STATS_RS_ENABLE)    ||
-		(cmd->cmd_type == CMD_STATS_CS_ENABLE)    ||
-		(cmd->cmd_type == CMD_STATS_AEC_ENABLE)   ||
-		(cmd->cmd_type == CMD_STATS_BG_ENABLE)    ||
-		(cmd->cmd_type == CMD_STATS_BF_ENABLE)    ||
-		(cmd->cmd_type == CMD_STATS_BHIST_ENABLE)) {
-		struct axidata *axid;
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto vfe40_config_done;
-		}
-		CDBG("%s: cmdType = %d\n", __func__, cmd->cmd_type);
-
-		if ((cmd->cmd_type == CMD_STATS_AF_ENABLE)    ||
-			(cmd->cmd_type == CMD_STATS_AWB_ENABLE)   ||
-			(cmd->cmd_type == CMD_STATS_IHIST_ENABLE) ||
-			(cmd->cmd_type == CMD_STATS_RS_ENABLE)    ||
-			(cmd->cmd_type == CMD_STATS_CS_ENABLE)    ||
-			(cmd->cmd_type == CMD_STATS_AEC_ENABLE)) {
-				scfg = NULL;
-				/* individual */
-				goto vfe40_config_done;
-		}
-		switch (cmd->cmd_type) {
-		case CMD_STATS_AEC_ENABLE:
-		case CMD_STATS_BG_ENABLE:
-		case CMD_STATS_BF_ENABLE:
-		case CMD_STATS_BHIST_ENABLE:
-		case CMD_STATS_AWB_ENABLE:
-		case CMD_STATS_IHIST_ENABLE:
-		case CMD_STATS_RS_ENABLE:
-		case CMD_STATS_CS_ENABLE:
-		default:
-			pr_err("%s Unsupported cmd type %d",
-				__func__, cmd->cmd_type);
-			break;
-		}
-		goto vfe40_config_done;
-	}
-	switch (cmd->cmd_type) {
-	case CMD_GENERAL:
-		rc = vfe40_proc_general(pmctl, &vfecmd, vfe40_ctrl);
-	break;
-	case CMD_VFE_COUNT_PIX_SOF_ENABLE: {
-		int enable = *((int *)cmd->value);
-		if (enable)
-			vfe40_ctrl->vfe_sof_count_enable = TRUE;
-		else
-			vfe40_ctrl->vfe_sof_count_enable = false;
-	}
-	break;
-	case CMD_VFE_PIX_SOF_COUNT_UPDATE:
-		if (!vfe40_ctrl->vfe_sof_count_enable)
-			vfe40_ctrl->share_ctrl->vfeFrameId =
-			*((uint32_t *)vfe_params->data);
-	break;
-	case CMD_CONFIG_PING_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe40_output_ch *outch =
-			vfe40_get_ch(path, vfe40_ctrl->share_ctrl);
-		outch->ping = *((struct msm_free_buf *)data);
-	}
-	break;
-
-	case CMD_CONFIG_PONG_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe40_output_ch *outch =
-			vfe40_get_ch(path, vfe40_ctrl->share_ctrl);
-		outch->pong = *((struct msm_free_buf *)data);
-	}
-	break;
-
-	case CMD_CONFIG_FREE_BUF_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe40_output_ch *outch =
-			vfe40_get_ch(path, vfe40_ctrl->share_ctrl);
-		outch->free_buf = *((struct msm_free_buf *)data);
-	}
-	break;
-
-	case CMD_SNAP_BUF_RELEASE:
-		break;
-
-	default:
-		pr_err("%s Unsupported AXI configuration %x ", __func__,
-			cmd->cmd_type);
-	break;
-	}
-vfe40_config_done:
-	kfree(scfg);
-	kfree(sack);
-	CDBG("%s done: rc = %d\n", __func__, (int) rc);
-	return rc;
-}
-
-static struct msm_cam_clk_info vfe40_clk_info[] = {
-	{"camss_top_ahb_clk", -1},
-	{"vfe_clk_src", 266670000},
-	{"camss_vfe_vfe_clk", -1},
-	{"camss_csi_vfe_clk", -1},
-	{"iface_clk", -1},
-	{"bus_clk", -1},
-	{"alt_bus_clk", -1},
-};
-
-static int msm_axi_subdev_s_crystal_freq(struct v4l2_subdev *sd,
-						u32 freq, u32 flags)
-{
-	int rc = 0;
-	int round_rate;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-
-	round_rate = clk_round_rate(axi_ctrl->vfe_clk[1], freq);
-	if (rc < 0) {
-		pr_err("%s: clk_round_rate failed %d\n",
-					__func__, rc);
-		return rc;
-	}
-
-	vfe_clk_rate = round_rate;
-	rc = clk_set_rate(axi_ctrl->vfe_clk[1], round_rate);
-	if (rc < 0)
-		pr_err("%s: clk_set_rate failed %d\n",
-					__func__, rc);
-
-	return rc;
-}
-
-static const struct v4l2_subdev_core_ops msm_vfe_subdev_core_ops = {
-	.ioctl = msm_vfe_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_ops msm_vfe_subdev_ops = {
-	.core = &msm_vfe_subdev_core_ops,
-};
-
-static void msm_vfe40_init_vbif_parms(void __iomem *vfe_vbif_base)
-{
-	msm_camera_io_w_mb(0x1,
-		vfe_vbif_base + VFE40_VBIF_CLKON);
-	msm_camera_io_w_mb(0x1,
-		vfe_vbif_base + VFE40_VBIF_ROUND_ROBIN_QOS_ARB);
-	msm_camera_io_w_mb(0xFFFF,
-		vfe_vbif_base + VFE40_VBIF_OUT_AXI_AOOO_EN);
-	msm_camera_io_w_mb(0xFFFFFFFF,
-		vfe_vbif_base + VFE40_VBIF_OUT_AXI_AOOO);
-
-	msm_camera_io_w_mb(0x10101010,
-		vfe_vbif_base + VFE40_VBIF_IN_RD_LIM_CONF0);
-	msm_camera_io_w_mb(0x10101010,
-		vfe_vbif_base + VFE40_VBIF_IN_RD_LIM_CONF1);
-	msm_camera_io_w_mb(0x10101010,
-		vfe_vbif_base + VFE40_VBIF_IN_RD_LIM_CONF2);
-	msm_camera_io_w_mb(0x10101010,
-		vfe_vbif_base + VFE40_VBIF_IN_WR_LIM_CONF0);
-	msm_camera_io_w_mb(0x10101010,
-		vfe_vbif_base + VFE40_VBIF_IN_WR_LIM_CONF1);
-	msm_camera_io_w_mb(0x10101010,
-		vfe_vbif_base + VFE40_VBIF_IN_WR_LIM_CONF2);
-	msm_camera_io_w_mb(0x00001010,
-		vfe_vbif_base + VFE40_VBIF_OUT_RD_LIM_CONF0);
-	msm_camera_io_w_mb(0x00001010,
-		vfe_vbif_base + VFE40_VBIF_OUT_WR_LIM_CONF0);
-	msm_camera_io_w_mb(0x00000707,
-		vfe_vbif_base + VFE40_VBIF_DDR_OUT_MAX_BURST);
-	msm_camera_io_w_mb(0x00000030,
-		vfe_vbif_base + VFE40_VBIF_ARB_CTL);
-	msm_camera_io_w_mb(0x04210842,
-		vfe_vbif_base + VFE40_VBIF_DDR_ARB_CONF0);
-	msm_camera_io_w_mb(0x04210842,
-		vfe_vbif_base + VFE40_VBIF_DDR_ARB_CONF1);
-}
-
-int msm_axi_subdev_init(struct v4l2_subdev *sd)
-{
-	int rc = 0;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	struct msm_cam_media_controller *mctl;
-	mctl = v4l2_get_subdev_hostdata(sd);
-	if (mctl == NULL) {
-		pr_err("%s: mctl is NULL\n", __func__);
-		rc = -EINVAL;
-		goto mctl_failed;
-	}
-	axi_ctrl->share_ctrl->axi_ref_cnt++;
-	if (axi_ctrl->share_ctrl->axi_ref_cnt > 1)
-		return rc;
-
-	spin_lock_init(&axi_ctrl->tasklet_lock);
-	INIT_LIST_HEAD(&axi_ctrl->tasklet_q);
-	spin_lock_init(&axi_ctrl->share_ctrl->sd_notify_lock);
-
-	axi_ctrl->share_ctrl->vfebase = ioremap(axi_ctrl->vfemem->start,
-		resource_size(axi_ctrl->vfemem));
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		rc = -ENOMEM;
-		pr_err("%s: vfe ioremap failed\n", __func__);
-		goto remap_failed;
-	}
-
-	axi_ctrl->share_ctrl->vfe_vbif_base =
-		ioremap(axi_ctrl->vfe_vbif_mem->start,
-			resource_size(axi_ctrl->vfe_vbif_mem));
-	if (!axi_ctrl->share_ctrl->vfe_vbif_base) {
-		rc = -ENOMEM;
-		pr_err("%s: vfe ioremap failed\n", __func__);
-		goto remap_failed;
-	}
-
-	if (axi_ctrl->fs_vfe) {
-		rc = regulator_enable(axi_ctrl->fs_vfe);
-		if (rc) {
-			pr_err("%s: Regulator enable failed\n",	__func__);
-			goto fs_failed;
-		}
-	}
-
-	rc = msm_cam_clk_enable(&axi_ctrl->pdev->dev, vfe40_clk_info,
-			axi_ctrl->vfe_clk, ARRAY_SIZE(vfe40_clk_info), 1);
-	if (rc < 0)
-		goto clk_enable_failed;
-
-	axi_ctrl->bus_perf_client =
-		msm_bus_scale_register_client(&vfe_bus_client_pdata);
-	if (!axi_ctrl->bus_perf_client) {
-		pr_err("%s: Registration Failed!\n", __func__);
-		axi_ctrl->bus_perf_client = 0;
-		goto bus_scale_register_failed;
-	}
-
-	msm_camera_bus_scale_cfg(axi_ctrl->bus_perf_client, S_PREVIEW);
-
-	rc = iommu_attach_device(mctl->domain, axi_ctrl->iommu_ctx);
-	if (rc < 0) {
-		pr_err("%s: imgwr attach failed rc = %d\n", __func__, rc);
-		rc = -ENODEV;
-		goto device_imgwr_attach_failed;
-	}
-
-	msm_vfe40_init_vbif_parms(axi_ctrl->share_ctrl->vfe_vbif_base);
-
-	axi_ctrl->share_ctrl->register_total = VFE40_REGISTER_TOTAL;
-
-	spin_lock_init(&axi_ctrl->share_ctrl->stop_flag_lock);
-	spin_lock_init(&axi_ctrl->share_ctrl->update_ack_lock);
-	spin_lock_init(&axi_ctrl->share_ctrl->start_ack_lock);
-	init_completion(&axi_ctrl->share_ctrl->reset_complete);
-
-	if (!axi_ctrl->use_irq_router)
-		enable_irq(axi_ctrl->vfeirq->start);
-
-	return rc;
-
-bus_scale_register_failed:
-	msm_cam_clk_enable(&axi_ctrl->pdev->dev, vfe40_clk_info,
-		axi_ctrl->vfe_clk, ARRAY_SIZE(vfe40_clk_info), 0);
-clk_enable_failed:
-	if (axi_ctrl->fs_vfe)
-		regulator_disable(axi_ctrl->fs_vfe);
-fs_failed:
-	iounmap(axi_ctrl->share_ctrl->vfebase);
-	axi_ctrl->share_ctrl->vfebase = NULL;
-remap_failed:
-	iommu_detach_device(mctl->domain, axi_ctrl->iommu_ctx);
-device_imgwr_attach_failed:
-	if (!axi_ctrl->use_irq_router)
-		disable_irq(axi_ctrl->vfeirq->start);
-mctl_failed:
-	return rc;
-}
-
-int msm_vfe_subdev_init(struct v4l2_subdev *sd)
-{
-	int rc = 0;
-	struct vfe40_ctrl_type *vfe40_ctrl =
-		(struct vfe40_ctrl_type *)v4l2_get_subdevdata(sd);
-
-	spin_lock_init(&vfe40_ctrl->state_lock);
-	spin_lock_init(&vfe40_ctrl->stats_bufq_lock);
-
-	vfe40_ctrl->update_linear = false;
-	vfe40_ctrl->update_rolloff = false;
-	vfe40_ctrl->update_la = false;
-	vfe40_ctrl->update_gamma = false;
-	vfe40_ctrl->vfe_sof_count_enable = true;
-	vfe40_ctrl->hfr_mode = HFR_MODE_OFF;
-
-	memset(&vfe40_ctrl->stats_ctrl, 0,
-		   sizeof(struct msm_stats_bufq_ctrl));
-	memset(&vfe40_ctrl->stats_ops, 0, sizeof(struct msm_stats_ops));
-
-	return rc;
-}
-
-void msm_axi_subdev_release(struct v4l2_subdev *sd)
-{
-	struct msm_cam_media_controller *pmctl =
-		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return;
-	}
-
-	CDBG("%s, free_irq\n", __func__);
-	axi_ctrl->share_ctrl->axi_ref_cnt--;
-	if (axi_ctrl->share_ctrl->axi_ref_cnt > 0)
-		return;
-	if (!axi_ctrl->use_irq_router)
-		disable_irq(axi_ctrl->vfeirq->start);
-	tasklet_kill(&axi_ctrl->vfe40_tasklet);
-
-	iommu_detach_device(pmctl->domain, axi_ctrl->iommu_ctx);
-
-	msm_cam_clk_enable(&axi_ctrl->pdev->dev, vfe40_clk_info,
-			axi_ctrl->vfe_clk, ARRAY_SIZE(vfe40_clk_info), 0);
-	if (axi_ctrl->fs_vfe)
-		regulator_disable(axi_ctrl->fs_vfe);
-
-	iounmap(axi_ctrl->share_ctrl->vfebase);
-	iounmap(axi_ctrl->share_ctrl->vfe_vbif_base);
-	axi_ctrl->share_ctrl->vfebase = NULL;
-
-	if (atomic_read(&irq_cnt))
-		pr_warning("%s, Warning IRQ Count not ZERO\n", __func__);
-
-	msm_camera_bus_scale_cfg(axi_ctrl->bus_perf_client, S_EXIT);
-	axi_ctrl->bus_perf_client = 0;
-
-	msm_vfe_subdev_release(&axi_ctrl->share_ctrl->vfe40_ctrl->subdev);
-}
-
-void msm_vfe_subdev_release(struct v4l2_subdev *sd)
-{
-	struct vfe40_ctrl_type *vfe40_ctrl =
-		(struct vfe40_ctrl_type *)v4l2_get_subdevdata(sd);
-	CDBG("vfe subdev release %p\n",
-		vfe40_ctrl->share_ctrl->vfebase);
-}
-
-void axi_abort(struct axi_ctrl_t *axi_ctrl)
-{
-	uint8_t  axi_busy_flag = true;
-	unsigned long flags;
-	/* axi halt command. */
-
-	spin_lock_irqsave(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-	axi_ctrl->share_ctrl->stop_ack_pending  = TRUE;
-	spin_unlock_irqrestore(&axi_ctrl->share_ctrl->stop_flag_lock, flags);
-	msm_camera_io_w(AXI_HALT,
-		axi_ctrl->share_ctrl->vfebase + VFE_AXI_CMD);
-	wmb();
-	while (axi_busy_flag) {
-		if (msm_camera_io_r(
-			axi_ctrl->share_ctrl->vfebase + VFE_AXI_STATUS) & 0x1)
-			axi_busy_flag = false;
-	}
-	/* Ensure the write order while writing
-	* to the command register using the barrier */
-	msm_camera_io_w_mb(AXI_HALT_CLEAR,
-		axi_ctrl->share_ctrl->vfebase + VFE_AXI_CMD);
-
-	/* after axi halt, then ok to apply global reset.
-	* enable reset_ack and async timer interrupt only while
-	* stopping the pipeline.*/
-	msm_camera_io_w(0x80000000,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(0xF0000000,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* Ensure the write order while writing
-	* to the command register using the barrier */
-	msm_camera_io_w_mb(VFE_RESET_UPON_STOP_CMD,
-		axi_ctrl->share_ctrl->vfebase + VFE_GLOBAL_RESET);
-	if (axi_ctrl->share_ctrl->sync_abort)
-		wait_for_completion_interruptible(
-			&axi_ctrl->share_ctrl->reset_complete);
-}
-
-int axi_config_buffers(struct axi_ctrl_t *axi_ctrl,
-	struct msm_camera_vfe_params_t vfe_params)
-{
-	uint16_t vfe_mode = axi_ctrl->share_ctrl->current_mode
-			& ~(VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI1);
-	int rc = 0;
-	switch (vfe_params.cmd_type) {
-	case AXI_CMD_PREVIEW:
-		if (vfe_mode) {
-			if ((axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_PREVIEW_AND_VIDEO) ||
-				(axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_PREVIEW))
-				/* Configure primary channel */
-				rc = configure_pingpong_buffers(
-					VFE_MSG_START,
-					VFE_MSG_OUTPUT_PRIMARY,
-					axi_ctrl);
-			else
-			/* Configure secondary channel */
-				rc = configure_pingpong_buffers(
-					VFE_MSG_START,
-					VFE_MSG_OUTPUT_SECONDARY,
-					axi_ctrl);
-		}
-		if (axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_RDI0)
-			rc = configure_pingpong_buffers(
-				VFE_MSG_START, VFE_MSG_OUTPUT_TERTIARY1,
-				axi_ctrl);
-		if (axi_ctrl->share_ctrl->current_mode &
-				VFE_OUTPUTS_RDI1)
-			rc = configure_pingpong_buffers(
-				VFE_MSG_START, VFE_MSG_OUTPUT_TERTIARY2,
-				axi_ctrl);
-
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers for preview",
-				__func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-		break;
-	case AXI_CMD_RAW_CAPTURE:
-		rc = configure_pingpong_buffers(
-			VFE_MSG_CAPTURE, VFE_MSG_OUTPUT_PRIMARY,
-			axi_ctrl);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers for snapshot",
-				__func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-		break;
-	case AXI_CMD_ZSL:
-		rc = configure_pingpong_buffers(VFE_MSG_START,
-			VFE_MSG_OUTPUT_PRIMARY, axi_ctrl);
-		if (rc < 0)
-			goto config_done;
-		rc = configure_pingpong_buffers(VFE_MSG_START,
-			VFE_MSG_OUTPUT_SECONDARY, axi_ctrl);
-		if (rc < 0)
-			goto config_done;
-		break;
-	case AXI_CMD_RECORD:
-		if (axi_ctrl->share_ctrl->current_mode &
-			VFE_OUTPUTS_PREVIEW_AND_VIDEO) {
-			axi_ctrl->share_ctrl->outpath.out1.inst_handle =
-				vfe_params.inst_handle;
-			rc = configure_pingpong_buffers(
-				VFE_MSG_START_RECORDING,
-				VFE_MSG_OUTPUT_SECONDARY,
-				axi_ctrl);
-		} else if (axi_ctrl->share_ctrl->current_mode &
-			VFE_OUTPUTS_VIDEO_AND_PREVIEW) {
-			axi_ctrl->share_ctrl->outpath.out0.inst_handle =
-				vfe_params.inst_handle;
-			rc = configure_pingpong_buffers(
-				VFE_MSG_START_RECORDING,
-				VFE_MSG_OUTPUT_PRIMARY,
-				axi_ctrl);
-		}
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers for video",
-				__func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-		break;
-	case AXI_CMD_LIVESHOT:
-		axi_ctrl->share_ctrl->outpath.out0.inst_handle =
-			vfe_params.inst_handle;
-		rc = configure_pingpong_buffers(VFE_MSG_CAPTURE,
-					VFE_MSG_OUTPUT_PRIMARY, axi_ctrl);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers for primary output",
-				__func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-		break;
-	case AXI_CMD_CAPTURE:
-		if (axi_ctrl->share_ctrl->current_mode ==
-			VFE_OUTPUTS_JPEG_AND_THUMB ||
-		axi_ctrl->share_ctrl->current_mode ==
-			VFE_OUTPUTS_THUMB_AND_JPEG) {
-
-			/* Configure primary channel for JPEG */
-			rc = configure_pingpong_buffers(
-				VFE_MSG_JPEG_CAPTURE,
-				VFE_MSG_OUTPUT_PRIMARY,
-				axi_ctrl);
-		} else {
-			/* Configure primary channel */
-			rc = configure_pingpong_buffers(
-				VFE_MSG_CAPTURE,
-				VFE_MSG_OUTPUT_PRIMARY,
-				axi_ctrl);
-		}
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers for primary output",
-				__func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-		/* Configure secondary channel */
-		rc = configure_pingpong_buffers(
-				VFE_MSG_CAPTURE, VFE_MSG_OUTPUT_SECONDARY,
-				axi_ctrl);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers for secondary output",
-				__func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-
-	}
-config_done:
-	return rc;
-}
-
-void axi_start(struct msm_cam_media_controller *pmctl,
-	struct axi_ctrl_t *axi_ctrl, struct msm_camera_vfe_params_t vfe_params)
-{
-	uint32_t irq_comp_mask = 0, irq_mask = 0;
-	int rc = 0;
-	uint32_t reg_update = 0;
-	uint16_t operation_mode =
-		(axi_ctrl->share_ctrl->current_mode &
-		~(VFE_OUTPUTS_RDI0|VFE_OUTPUTS_RDI1));
-	rc = axi_config_buffers(axi_ctrl, vfe_params);
-	if (rc < 0)
-		return;
-
-	switch (vfe_params.cmd_type) {
-	case AXI_CMD_PREVIEW:
-		msm_camera_bus_scale_cfg(axi_ctrl->bus_perf_client, S_PREVIEW);
-		break;
-	case AXI_CMD_CAPTURE:
-	case AXI_CMD_RAW_CAPTURE:
-		msm_camera_bus_scale_cfg(axi_ctrl->bus_perf_client, S_CAPTURE);
-		break;
-	case AXI_CMD_RECORD:
-		msm_camera_bus_scale_cfg(axi_ctrl->bus_perf_client, S_VIDEO);
-		return;
-	case AXI_CMD_ZSL:
-		msm_camera_bus_scale_cfg(axi_ctrl->bus_perf_client, S_ZSL);
-		break;
-	case AXI_CMD_LIVESHOT:
-		msm_camera_bus_scale_cfg(axi_ctrl->bus_perf_client, S_LIVESHOT);
-		return;
-	default:
-		return;
-	}
-
-	irq_comp_mask =
-		msm_camera_io_r(axi_ctrl->share_ctrl->vfebase +
-			VFE_IRQ_COMP_MASK);
-	irq_mask = msm_camera_io_r(axi_ctrl->share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-
-	if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE40_OUTPUT_MODE_PRIMARY) {
-		if (vfe_params.cmd_type == AXI_CMD_RAW_CAPTURE) {
-			irq_comp_mask |=
-				0x1 << axi_ctrl->share_ctrl->outpath.out0.ch0;
-		} else {
-			irq_comp_mask |= (
-				0x1 << axi_ctrl->share_ctrl->outpath.out0.ch0 |
-				0x1 << axi_ctrl->share_ctrl->outpath.out0.ch1);
-		}
-		irq_mask |= VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK;
-	} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-			   VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-		irq_comp_mask |= (
-			0x1 << axi_ctrl->share_ctrl->outpath.out0.ch0 |
-			0x1 << axi_ctrl->share_ctrl->outpath.out0.ch1 |
-			0x1 << axi_ctrl->share_ctrl->outpath.out0.ch2);
-		irq_mask |= VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK;
-	}
-	if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE40_OUTPUT_MODE_SECONDARY) {
-		irq_comp_mask |= (
-			0x1 << (axi_ctrl->share_ctrl->outpath.out1.ch0 + 8) |
-			0x1 << (axi_ctrl->share_ctrl->outpath.out1.ch1 + 8));
-		irq_mask |= VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK;
-	} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE40_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-		irq_comp_mask |= (
-			0x1 << (axi_ctrl->share_ctrl->outpath.out1.ch0 + 8) |
-			0x1 << (axi_ctrl->share_ctrl->outpath.out1.ch1 + 8) |
-			0x1 << (axi_ctrl->share_ctrl->outpath.out1.ch2 + 8));
-		irq_mask |= VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK;
-	}
-	if (axi_ctrl->share_ctrl->outpath.output_mode &
-		VFE40_OUTPUT_MODE_TERTIARY1) {
-		irq_mask |= (0x1 << (axi_ctrl->share_ctrl->outpath.out2.ch0 +
-			VFE_WM_OFFSET));
-	}
-	if (axi_ctrl->share_ctrl->outpath.output_mode &
-		VFE40_OUTPUT_MODE_TERTIARY2) {
-		irq_mask |= (0x1 << (axi_ctrl->share_ctrl->outpath.out3.ch0 +
-			VFE_WM_OFFSET));
-	}
-
-	msm_camera_io_w(irq_comp_mask,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_COMP_MASK);
-	msm_camera_io_w(irq_mask, axi_ctrl->share_ctrl->vfebase +
-			VFE_IRQ_MASK_0);
-
-	switch (vfe_params.cmd_type) {
-	case AXI_CMD_PREVIEW: {
-		switch (operation_mode) {
-		case VFE_OUTPUTS_PREVIEW:
-		case VFE_OUTPUTS_PREVIEW_AND_VIDEO:
-			if (axi_ctrl->share_ctrl->outpath.output_mode &
-				VFE40_OUTPUT_MODE_PRIMARY) {
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch1]);
-			} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-					VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch1]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch2]);
-			}
-			break;
-		default:
-			if (axi_ctrl->share_ctrl->outpath.output_mode &
-				VFE40_OUTPUT_MODE_SECONDARY) {
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out1.ch0]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out1.ch1]);
-			} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-				VFE40_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out1.ch0]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out1.ch1]);
-				msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase
-					+ vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out1.ch2]);
-			}
-			break;
-			}
-		}
-		break;
-	default:
-		if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE40_OUTPUT_MODE_PRIMARY) {
-			if (vfe_params.cmd_type == AXI_CMD_RAW_CAPTURE) {
-				msm_camera_io_w(1,
-					axi_ctrl->share_ctrl->vfebase +
-					vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch0]);
-			} else {
-				msm_camera_io_w(1,
-					axi_ctrl->share_ctrl->vfebase +
-					vfe40_AXI_WM_CFG[axi_ctrl
-					->share_ctrl->outpath.out0.ch0]);
-				msm_camera_io_w(1,
-					axi_ctrl->share_ctrl->vfebase +
-					vfe40_AXI_WM_CFG[axi_ctrl->
-					share_ctrl->outpath.out0.ch1]);
-			}
-		} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-				VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch1]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch2]);
-		}
-
-		if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE40_OUTPUT_MODE_SECONDARY) {
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch1]);
-		} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE40_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch1]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch2]);
-		}
-		break;
-	}
-
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI0)
-		msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-			vfe40_AXI_WM_CFG[axi_ctrl->share_ctrl->
-			outpath.out2.ch0]);
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI1)
-		msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-			vfe40_AXI_WM_CFG[axi_ctrl->share_ctrl->
-			outpath.out3.ch0]);
-
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI0) {
-		irq_mask |= VFE_IRQ_STATUS0_RDI0_REG_UPDATE_MASK;
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->rdi0_update_ack_pending,
-				0, 1))
-			reg_update |= 0x2;
-	}
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI1) {
-		irq_mask |= VFE_IRQ_STATUS0_RDI1_REG_UPDATE_MASK;
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->rdi1_update_ack_pending,
-				0, 1))
-			reg_update |= 0x4;
-	}
-	msm_camera_io_w(irq_mask, axi_ctrl->share_ctrl->vfebase +
-		VFE_IRQ_MASK_0);
-	if (operation_mode) {
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->pix0_update_ack_pending,
-				0, 1))
-			reg_update |= 0x1;
-	}
-
-	msm_camera_io_w_mb(reg_update,
-			axi_ctrl->share_ctrl->vfebase +
-			VFE_REG_UPDATE_CMD);
-	axi_ctrl->share_ctrl->operation_mode |=
-		axi_ctrl->share_ctrl->current_mode;
-	axi_enable_irq(axi_ctrl->share_ctrl);
-}
-
-void axi_stop(struct msm_cam_media_controller *pmctl,
-	struct axi_ctrl_t *axi_ctrl, struct msm_camera_vfe_params_t vfe_params)
-{
-	uint32_t reg_update = 0;
-	uint32_t operation_mode =
-	axi_ctrl->share_ctrl->current_mode & ~(VFE_OUTPUTS_RDI0|
-		VFE_OUTPUTS_RDI1);
-
-	switch (vfe_params.cmd_type) {
-	case AXI_CMD_PREVIEW:
-	case AXI_CMD_CAPTURE:
-	case AXI_CMD_RAW_CAPTURE:
-	case AXI_CMD_ZSL:
-		break;
-	case AXI_CMD_RECORD:
-		msm_camera_bus_scale_cfg(axi_ctrl->bus_perf_client, S_PREVIEW);
-		return;
-	case AXI_CMD_LIVESHOT:
-		msm_camera_bus_scale_cfg(axi_ctrl->bus_perf_client, S_VIDEO);
-		return;
-	default:
-		return;
-	}
-
-	if (axi_ctrl->share_ctrl->stop_immediately) {
-		axi_disable_irq(axi_ctrl->share_ctrl);
-		axi_stop_process(axi_ctrl->share_ctrl);
-		return;
-	}
-
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI0) {
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->rdi0_update_ack_pending, 0, 2))
-			reg_update |= 0x2;
-	}
-	if (axi_ctrl->share_ctrl->current_mode & VFE_OUTPUTS_RDI1) {
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->rdi1_update_ack_pending, 0, 2))
-			reg_update |= 0x4;
-	}
-	if (operation_mode) {
-		if (!atomic_cmpxchg(
-			&axi_ctrl->share_ctrl->pix0_update_ack_pending, 0, 2))
-			reg_update |= 0x1;
-	}
-	msm_camera_io_w_mb(reg_update,
-		axi_ctrl->share_ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-static int msm_axi_config(struct v4l2_subdev *sd, void __user *arg)
-{
-	struct msm_vfe_cfg_cmd cfgcmd;
-	struct msm_isp_cmd vfecmd;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	struct msm_cam_media_controller *pmctl =
-		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
-	int rc = 0, vfe_cmd_type = 0, rdi_mode = 0;
-
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return -EFAULT;
-	}
-	memset(&cfgcmd, 0, sizeof(struct msm_vfe_cfg_cmd));
-	if (NULL != arg) {
-		if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
-			ERR_COPY_FROM_USER();
-			return -EFAULT;
-		}
-	}
-	memset(&vfecmd, 0, sizeof(struct msm_isp_cmd));
-	if (NULL != cfgcmd.value) {
-		if (copy_from_user(&vfecmd,
-				(void __user *)(cfgcmd.value),
-				sizeof(vfecmd))) {
-			pr_err("%s %d: copy_from_user failed\n", __func__,
-				__LINE__);
-			return -EFAULT;
-		}
-	}
-
-	vfe_cmd_type = (cfgcmd.cmd_type & ~(CMD_AXI_CFG_TERT1|
-		CMD_AXI_CFG_TERT2));
-	switch (cfgcmd.cmd_type) {
-	case CMD_AXI_CFG_TERT1:{
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio)
-			return -ENOMEM;
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			return -EFAULT;
-		}
-		vfe40_config_axi(axi_ctrl, OUTPUT_TERT1, axio);
-		kfree(axio);
-		return rc;
-		}
-	case CMD_AXI_CFG_TERT2:{
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio)
-			return -ENOMEM;
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			return -EFAULT;
-		}
-		vfe40_config_axi(axi_ctrl, OUTPUT_TERT2, axio);
-		kfree(axio);
-		return rc;
-		}
-	case CMD_AXI_CFG_TERT1|CMD_AXI_CFG_TERT2:{
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio)
-			return -ENOMEM;
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			return -EFAULT;
-		}
-		vfe40_config_axi(axi_ctrl, OUTPUT_TERT1|OUTPUT_TERT2, axio);
-		kfree(axio);
-		return rc;
-		}
-	default:
-		if (cfgcmd.cmd_type & CMD_AXI_CFG_TERT1)
-			rdi_mode |= OUTPUT_TERT1;
-		if (cfgcmd.cmd_type & CMD_AXI_CFG_TERT2)
-			rdi_mode |= OUTPUT_TERT2;
-	}
-	switch (vfe_cmd_type) {
-	case CMD_AXI_CFG_PRIM: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe40_config_axi(axi_ctrl, rdi_mode|OUTPUT_PRIM, axio);
-		kfree(axio);
-		break;
-		}
-	case CMD_AXI_CFG_PRIM_ALL_CHNLS: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe40_config_axi(axi_ctrl, rdi_mode|OUTPUT_PRIM_ALL_CHNLS,
-			axio);
-		kfree(axio);
-		break;
-		}
-	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe40_config_axi(axi_ctrl,
-			rdi_mode|OUTPUT_PRIM|OUTPUT_SEC, axio);
-		kfree(axio);
-		break;
-		}
-	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC_ALL_CHNLS: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe40_config_axi(axi_ctrl,
-			rdi_mode|OUTPUT_PRIM|OUTPUT_SEC_ALL_CHNLS, axio);
-		kfree(axio);
-		break;
-		}
-	case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe40_config_axi(axi_ctrl,
-			rdi_mode|OUTPUT_PRIM_ALL_CHNLS|OUTPUT_SEC, axio);
-		kfree(axio);
-		break;
-		}
-
-	case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC_ALL_CHNLS:
-		pr_err("%s Invalid/Unsupported AXI configuration %x",
-			__func__, cfgcmd.cmd_type);
-		break;
-	case CMD_AXI_START: {
-		struct msm_camera_vfe_params_t vfe_params;
-		if (copy_from_user(&vfe_params,
-				(void __user *)(vfecmd.value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				return -EFAULT;
-		}
-		axi_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-		axi_start(pmctl, axi_ctrl, vfe_params);
-		}
-		break;
-	case CMD_AXI_STOP: {
-		struct msm_camera_vfe_params_t vfe_params;
-		if (copy_from_user(&vfe_params,
-				(void __user *)(vfecmd.value),
-				sizeof(struct msm_camera_vfe_params_t))) {
-				return -EFAULT;
-		}
-		axi_ctrl->share_ctrl->current_mode =
-			vfe_params.operation_mode;
-		axi_ctrl->share_ctrl->stop_immediately =
-			vfe_params.stop_immediately;
-		axi_stop(pmctl, axi_ctrl, vfe_params);
-		}
-		break;
-	case CMD_AXI_RESET:
-		axi_reset(axi_ctrl);
-		break;
-	case CMD_AXI_ABORT:
-		if (copy_from_user(&axi_ctrl->share_ctrl->sync_abort,
-				(void __user *)(vfecmd.value),
-				sizeof(uint8_t))) {
-				return -EFAULT;
-		}
-		axi_abort(axi_ctrl);
-		break;
-	default:
-		pr_err("%s Unsupported AXI configuration %x ", __func__,
-			cfgcmd.cmd_type);
-		break;
-	}
-	return rc;
-}
-
-static void msm_axi_process_irq(struct v4l2_subdev *sd, void *arg)
-{
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	uint32_t irqstatus = (uint32_t) arg;
-
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return;
-	}
-
-	/* next, check output path related interrupts. */
-	if (irqstatus &
-		VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK) {
-		CDBG("Image composite done 0 irq occured.\n");
-		vfe40_process_output_path_irq_0(axi_ctrl);
-	}
-	if (irqstatus &
-		VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK) {
-		CDBG("Image composite done 1 irq occured.\n");
-		vfe40_process_output_path_irq_1(axi_ctrl);
-	}
-
-	if (axi_ctrl->share_ctrl->comp_output_mode &
-		VFE40_OUTPUT_MODE_TERTIARY1)
-		if (irqstatus & (0x1 << (axi_ctrl->share_ctrl->outpath.out2.ch0
-			+ VFE_WM_OFFSET)))
-			vfe40_process_output_path_irq_rdi0(axi_ctrl);
-	if (axi_ctrl->share_ctrl->comp_output_mode &
-		VFE40_OUTPUT_MODE_TERTIARY2)
-		if (irqstatus & (0x1 << (axi_ctrl->share_ctrl->outpath.out3.ch0
-			+ VFE_WM_OFFSET)))
-			vfe40_process_output_path_irq_rdi1(axi_ctrl);
-
-	/* in snapshot mode if done then send
-	snapshot done message */
-	if (
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_THUMB_AND_MAIN ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_MAIN_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_THUMB_AND_JPEG ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_JPEG_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode &
-			VFE_OUTPUTS_RAW) {
-		if ((axi_ctrl->share_ctrl->outpath.out0.capture_cnt == 0)
-				&& (axi_ctrl->share_ctrl->outpath.out1.
-				capture_cnt == 0)) {
-			msm_camera_io_w_mb(
-				CAMIF_COMMAND_STOP_IMMEDIATELY,
-				axi_ctrl->share_ctrl->vfebase +
-				VFE_CAMIF_COMMAND);
-			axi_disable_irq(axi_ctrl->share_ctrl);
-			vfe40_send_isp_msg(&axi_ctrl->subdev,
-				axi_ctrl->share_ctrl->vfeFrameId,
-				MSG_ID_PIX0_UPDATE_ACK);
-			vfe40_send_isp_msg(&axi_ctrl->subdev,
-				axi_ctrl->share_ctrl->vfeFrameId,
-				MSG_ID_SNAPSHOT_DONE);
-		}
-	}
-}
-
-static int msm_axi_buf_cfg(struct v4l2_subdev *sd, void __user *arg)
-{
-	struct msm_camvfe_params *vfe_params =
-		(struct msm_camvfe_params *)arg;
-	struct msm_vfe_cfg_cmd *cmd = vfe_params->vfe_cfg;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	void *data = vfe_params->data;
-	int rc = 0;
-
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return -EFAULT;
-	}
-
-	switch (cmd->cmd_type) {
-	case CMD_CONFIG_PING_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe40_output_ch *outch =
-			vfe40_get_ch(path, axi_ctrl->share_ctrl);
-		outch->ping = *((struct msm_free_buf *)data);
-	}
-		break;
-
-	case CMD_CONFIG_PONG_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe40_output_ch *outch =
-			vfe40_get_ch(path, axi_ctrl->share_ctrl);
-		outch->pong = *((struct msm_free_buf *)data);
-	}
-		break;
-
-	case CMD_CONFIG_FREE_BUF_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe40_output_ch *outch =
-			vfe40_get_ch(path, axi_ctrl->share_ctrl);
-		outch->free_buf = *((struct msm_free_buf *)data);
-	}
-		break;
-	default:
-		pr_err("%s Unsupported AXI Buf config %x ", __func__,
-			cmd->cmd_type);
-	}
-	return rc;
-};
-
-static const struct v4l2_subdev_internal_ops msm_vfe_internal_ops;
-
-static long msm_axi_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int cmd, void *arg)
-{
-	int rc = -ENOIOCTLCMD;
-	switch (cmd) {
-	case VIDIOC_MSM_AXI_INIT:
-		rc = msm_axi_subdev_init(sd);
-		break;
-	case VIDIOC_MSM_AXI_CFG:
-		rc = msm_axi_config(sd, arg);
-		break;
-	case VIDIOC_MSM_AXI_IRQ:
-		msm_axi_process_irq(sd, arg);
-		rc = 0;
-		break;
-	case VIDIOC_MSM_AXI_BUF_CFG:
-		msm_axi_buf_cfg(sd, arg);
-		rc = 0;
-		break;
-	case VIDIOC_MSM_AXI_RELEASE:
-		msm_axi_subdev_release(sd);
-		rc = 0;
-		break;
-	case VIDIOC_MSM_AXI_RDI_COUNT_UPDATE: {
-		struct rdi_count_msg *msg = (struct rdi_count_msg *)arg;
-		struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-		switch (msg->rdi_interface) {
-		case RDI_0:
-			axi_ctrl->share_ctrl->rdi0FrameId = msg->count;
-			rc = 0;
-			break;
-		case RDI_1:
-			axi_ctrl->share_ctrl->rdi1FrameId = msg->count;
-			rc = 0;
-			break;
-		case RDI_2:
-			axi_ctrl->share_ctrl->rdi2FrameId = msg->count;
-			rc = 0;
-			break;
-		default:
-			pr_err("%s: Incorrect interface sent\n", __func__);
-			rc = -EINVAL;
-			break;
-		}
-		break;
-	}
-	default:
-		pr_err("%s: command %d not found\n", __func__,
-						_IOC_NR(cmd));
-		break;
-	}
-	return rc;
-}
-
-static const struct v4l2_subdev_core_ops msm_axi_subdev_core_ops = {
-	.ioctl = msm_axi_subdev_ioctl,
-	.interrupt_service_routine = msm_axi_subdev_isr_routine,
-};
-
-static const struct v4l2_subdev_video_ops msm_axi_subdev_video_ops = {
-	.s_crystal_freq = msm_axi_subdev_s_crystal_freq,
-};
-
-static const struct v4l2_subdev_ops msm_axi_subdev_ops = {
-	.core = &msm_axi_subdev_core_ops,
-	.video = &msm_axi_subdev_video_ops,
-};
-
-static const struct v4l2_subdev_internal_ops msm_axi_internal_ops;
-
-static int __devinit vfe40_probe(struct platform_device *pdev)
-{
-	int rc = 0;
-	struct axi_ctrl_t *axi_ctrl;
-	struct vfe40_ctrl_type *vfe40_ctrl;
-	struct vfe_share_ctrl_t *share_ctrl;
-	struct intr_table_entry irq_req;
-	struct msm_cam_subdev_info sd_info;
-	CDBG("%s: device id = %d\n", __func__, pdev->id);
-
-	share_ctrl = kzalloc(sizeof(struct vfe_share_ctrl_t), GFP_KERNEL);
-	if (!share_ctrl) {
-		pr_err("%s: no enough memory\n", __func__);
-		return -ENOMEM;
-	}
-
-	axi_ctrl = kzalloc(sizeof(struct axi_ctrl_t), GFP_KERNEL);
-	if (!axi_ctrl) {
-		pr_err("%s: no enough memory\n", __func__);
-		kfree(share_ctrl);
-		return -ENOMEM;
-	}
-
-	vfe40_ctrl = kzalloc(sizeof(struct vfe40_ctrl_type), GFP_KERNEL);
-	if (!vfe40_ctrl) {
-		pr_err("%s: no enough memory\n", __func__);
-		kfree(share_ctrl);
-		kfree(axi_ctrl);
-		return -ENOMEM;
-	}
-
-	if (pdev->dev.of_node)
-		of_property_read_u32((&pdev->dev)->of_node,
-			"cell-index", &pdev->id);
-
-	share_ctrl->axi_ctrl = axi_ctrl;
-	share_ctrl->vfe40_ctrl = vfe40_ctrl;
-	axi_ctrl->share_ctrl = share_ctrl;
-	vfe40_ctrl->share_ctrl = share_ctrl;
-	axi_ctrl->share_ctrl->axi_ref_cnt = 0;
-	v4l2_subdev_init(&axi_ctrl->subdev, &msm_axi_subdev_ops);
-	axi_ctrl->subdev.internal_ops = &msm_axi_internal_ops;
-	axi_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(axi_ctrl->subdev.name,
-			 sizeof(axi_ctrl->subdev.name), "axi");
-	v4l2_set_subdevdata(&axi_ctrl->subdev, axi_ctrl);
-	axi_ctrl->pdev = pdev;
-
-	sd_info.sdev_type = AXI_DEV;
-	sd_info.sd_index = pdev->id;
-	sd_info.irq_num = 0;
-	msm_cam_register_subdev_node(&axi_ctrl->subdev, &sd_info);
-
-	media_entity_init(&axi_ctrl->subdev.entity, 0, NULL, 0);
-	axi_ctrl->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	axi_ctrl->subdev.entity.group_id = AXI_DEV;
-	axi_ctrl->subdev.entity.name = pdev->name;
-	axi_ctrl->subdev.entity.revision = axi_ctrl->subdev.devnode->num;
-
-	v4l2_subdev_init(&vfe40_ctrl->subdev, &msm_vfe_subdev_ops);
-	vfe40_ctrl->subdev.internal_ops = &msm_vfe_internal_ops;
-	vfe40_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(vfe40_ctrl->subdev.name,
-			 sizeof(vfe40_ctrl->subdev.name), "vfe4.0");
-	v4l2_set_subdevdata(&vfe40_ctrl->subdev, vfe40_ctrl);
-	platform_set_drvdata(pdev, &vfe40_ctrl->subdev);
-
-	axi_ctrl->vfemem = platform_get_resource_byname(pdev,
-					IORESOURCE_MEM, "vfe");
-	if (!axi_ctrl->vfemem) {
-		pr_err("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto vfe40_no_resource;
-	}
-
-	axi_ctrl->vfe_vbif_mem = platform_get_resource_byname(pdev,
-					IORESOURCE_MEM, "vfe_vbif");
-	if (!axi_ctrl->vfe_vbif_mem) {
-		pr_err("%s: no mem resource?\n", __func__);
-		rc = -ENODEV;
-		goto vfe40_no_resource;
-	}
-
-	axi_ctrl->vfeirq = platform_get_resource_byname(pdev,
-					IORESOURCE_IRQ, "vfe");
-	if (!axi_ctrl->vfeirq) {
-		pr_err("%s: no irq resource?\n", __func__);
-		rc = -ENODEV;
-		goto vfe40_no_resource;
-	}
-
-	axi_ctrl->vfeio = request_mem_region(axi_ctrl->vfemem->start,
-		resource_size(axi_ctrl->vfemem), pdev->name);
-	if (!axi_ctrl->vfeio) {
-		pr_err("%s: no valid mem region\n", __func__);
-		rc = -EBUSY;
-		goto vfe40_no_resource;
-	}
-
-	axi_ctrl->fs_vfe = regulator_get(&pdev->dev, "vdd");
-	if (IS_ERR(axi_ctrl->fs_vfe)) {
-		pr_err("%s: Regulator get failed %ld\n", __func__,
-			PTR_ERR(axi_ctrl->fs_vfe));
-		axi_ctrl->fs_vfe = NULL;
-	}
-
-	/* Register subdev node before requesting irq since
-	 * irq_num is needed by msm_cam_server */
-	sd_info.sdev_type = VFE_DEV;
-	sd_info.sd_index = pdev->id;
-	sd_info.irq_num = axi_ctrl->vfeirq->start;
-	msm_cam_register_subdev_node(&vfe40_ctrl->subdev, &sd_info);
-
-	media_entity_init(&vfe40_ctrl->subdev.entity, 0, NULL, 0);
-	vfe40_ctrl->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	vfe40_ctrl->subdev.entity.group_id = VFE_DEV;
-	vfe40_ctrl->subdev.entity.name = pdev->name;
-	vfe40_ctrl->subdev.entity.revision = vfe40_ctrl->subdev.devnode->num;
-
-	/* Request for this device irq from the camera server. If the
-	 * IRQ Router is present on this target, the interrupt will be
-	 * handled by the camera server and the interrupt service
-	 * routine called. If the request_irq call returns ENXIO, then
-	 * the IRQ Router hardware is not present on this target. We
-	 * have to request for the irq ourselves and register the
-	 * appropriate interrupt handler. */
-	axi_ctrl->use_irq_router = true;
-	irq_req.cam_hw_idx       = MSM_CAM_HW_VFE0 + pdev->id;
-	irq_req.dev_name         = "vfe";
-	irq_req.irq_idx          = CAMERA_SS_IRQ_8;
-	irq_req.irq_num          = axi_ctrl->vfeirq->start;
-	irq_req.is_composite     = 0;
-	irq_req.irq_trigger_type = IRQF_TRIGGER_RISING;
-	irq_req.num_hwcore       = 1;
-	irq_req.subdev_list[0]   = &axi_ctrl->subdev;
-	irq_req.data             = (void *)axi_ctrl;
-	rc = msm_cam_server_request_irq(&irq_req);
-	if (rc == -ENXIO) {
-		/* IRQ Router hardware is not present on this hardware.
-		 * Request for the IRQ and register the interrupt handler. */
-		axi_ctrl->use_irq_router = false;
-		rc = request_irq(axi_ctrl->vfeirq->start, vfe40_parse_irq,
-			IRQF_TRIGGER_RISING, "vfe", axi_ctrl);
-		if (rc < 0) {
-			release_mem_region(axi_ctrl->vfemem->start,
-				resource_size(axi_ctrl->vfemem));
-			pr_err("%s: irq request fail\n", __func__);
-			rc = -EBUSY;
-			goto vfe40_no_resource;
-		}
-		disable_irq(axi_ctrl->vfeirq->start);
-	} else if (rc < 0) {
-		pr_err("%s Error registering irq ", __func__);
-		goto vfe40_no_resource;
-	}
-
-	/*get device context for IOMMU*/
-	if (pdev->id == 0)
-		axi_ctrl->iommu_ctx = msm_iommu_get_ctx("vfe0");
-	else if (pdev->id == 1)
-		axi_ctrl->iommu_ctx = msm_iommu_get_ctx("vfe1");
-	if (!axi_ctrl->iommu_ctx) {
-		release_mem_region(axi_ctrl->vfemem->start,
-			resource_size(axi_ctrl->vfemem));
-		pr_err("%s: No iommu fw context found\n", __func__);
-		rc = -ENODEV;
-		goto vfe40_no_resource;
-	}
-
-	tasklet_init(&axi_ctrl->vfe40_tasklet,
-		axi40_do_tasklet, (unsigned long)axi_ctrl);
-
-	vfe40_ctrl->pdev = pdev;
-	/*disable bayer stats by default*/
-	vfe40_ctrl->ver_num.main = 0;
-
-	return 0;
-
-vfe40_no_resource:
-	kfree(vfe40_ctrl);
-	kfree(axi_ctrl);
-	return 0;
-}
-
-static const struct of_device_id msm_vfe_dt_match[] = {
-	{.compatible = "qcom,vfe40"},
-};
-
-MODULE_DEVICE_TABLE(of, msm_vfe_dt_match);
-
-static struct platform_driver vfe40_driver = {
-	.probe = vfe40_probe,
-	.driver = {
-		.name = MSM_VFE_DRV_NAME,
-		.owner = THIS_MODULE,
-		.of_match_table = msm_vfe_dt_match,
-	},
-};
-
-static int __init msm_vfe40_init_module(void)
-{
-	return platform_driver_register(&vfe40_driver);
-}
-
-static void __exit msm_vfe40_exit_module(void)
-{
-	platform_driver_unregister(&vfe40_driver);
-}
-
-module_init(msm_vfe40_init_module);
-module_exit(msm_vfe40_exit_module);
-MODULE_DESCRIPTION("VFE 4.0 driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/vfe/msm_vfe40.h b/drivers/media/video/msm/vfe/msm_vfe40.h
deleted file mode 100644
index f2499bc..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe40.h
+++ /dev/null
@@ -1,1056 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __MSM_VFE40_H__
-#define __MSM_VFE40_H__
-
-#include <linux/bitops.h>
-#include "msm_vfe_stats_buf.h"
-
-#define TRUE  1
-#define FALSE 0
-
-#define VFE40_HW_NUMBER 0x10000015
-
-/* This defines total number registers in VFE.
- * Each register is 4 bytes so to get the range,
- * multiply this number with 4. */
-#define VFE40_REGISTER_TOTAL 0x00000320
-
-/* at stop of vfe pipeline, for now it is assumed
- * that camif will stop at any time. Bit 1:0 = 0x10:
- * disable image data capture immediately. */
-#define CAMIF_COMMAND_STOP_IMMEDIATELY  0x00000002
-
-/* at stop of vfe pipeline, for now it is assumed
- * that camif will stop at any time. Bit 1:0 = 0x00:
- * disable image data capture at frame boundary */
-#define CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY  0x00000000
-
-/* to halt axi bridge */
-#define AXI_HALT  0x00000001
-
-/* clear the halt bit. */
-#define AXI_HALT_CLEAR  0x00000000
-
-/* reset the pipeline when stop command is issued.
- * (without reset the register.) bit 26-32 = 0,
- * domain reset, bit 0-9 = 1 for module reset, except
- * register module. */
-#define VFE_RESET_UPON_STOP_CMD  0x000003ef
-
-/* reset the pipeline when reset command.
- * bit 26-32 = 0, domain reset, bit 0-9 = 1 for module reset. */
-#define VFE_RESET_UPON_RESET_CMD  0x000003ff
-
-/* reset the vfe only when reset command*/
-#define VFE_ONLY_RESET_CMD  0x00000002
-
-/*Vfe module reset command*/
-#define VFE_MODULE_RESET_CMD 0x07ffffff
-
-/* wm bit offset for IRQ MASK and IRQ STATUS register */
-#define VFE_WM_OFFSET 6
-
-/* constants for irq registers */
-#define VFE_DISABLE_ALL_IRQS 0
-/* bit =1 is to clear the corresponding bit in VFE_IRQ_STATUS.  */
-#define VFE_CLEAR_ALL_IRQ0   0xffff7fff
-#define VFE_CLEAR_ALL_IRQ1   0xffffffff
-
-#define VFE_IRQ_STATUS0_CAMIF_SOF_MASK            (0x00000001<<0)
-#define VFE_IRQ_STATUS0_REG_UPDATE_MASK           (0x00000001<<4)
-#define VFE_IRQ_STATUS0_RDI0_REG_UPDATE_MASK      (0x00000001<<5)
-#define VFE_IRQ_STATUS0_RDI1_REG_UPDATE_MASK      (0x00000001<<6)
-#define VFE_IRQ_STATUS0_RDI2_REG_UPDATE_MASK      (0x00000001<<7)
-#define VFE_IRQ_STATUS0_STATS_BE                  (0x00000001<<16)
-#define VFE_IRQ_STATUS0_STATS_BG                  (0x00000001<<17)
-#define VFE_IRQ_STATUS0_STATS_BF                  (0x00000001<<18)
-#define VFE_IRQ_STATUS0_STATS_AWB                 (0x00000001<<19)
-#define VFE_IRQ_STATUS0_STATS_RS                  (0x00000001<<20)
-#define VFE_IRQ_STATUS0_STATS_CS                  (0x00000001<<21)
-#define VFE_IRQ_STATUS0_STATS_IHIST               (0x00000001<<22)
-#define VFE_IRQ_STATUS0_STATS_SKIN_BHIST          (0x00000001<<23)
-#define VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK (0x00000001<<25)
-#define VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK (0x00000001<<26)
-#define VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE2_MASK (0x00000001<<27)
-#define VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE3_MASK (0x00000001<<28)
-#define VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK_0     (0x00000001<<29)
-#define VFE_IRQ_STATUS0_STATS_COMPOSIT_MASK_1     (0x00000001<<30)
-#define VFE_IRQ_STATUS0_RESET_AXI_HALT_ACK_MASK   (0x00000001<<31)
-
-#define VFE_IRQ_STATUS1_SYNC_TIMER0               (0x00000001<<25)
-#define VFE_IRQ_STATUS1_SYNC_TIMER1               (0x00000001<<26)
-#define VFE_IRQ_STATUS1_SYNC_TIMER2               (0x00000001<<27)
-#define VFE_IRQ_STATUS1_ASYNC_TIMER0              (0x00000001<<28)
-#define VFE_IRQ_STATUS1_ASYNC_TIMER1              (0x00000001<<29)
-#define VFE_IRQ_STATUS1_ASYNC_TIMER2              (0x00000001<<30)
-#define VFE_IRQ_STATUS1_ASYNC_TIMER3              (0x00000001<<31)
-
-/*TODOs the irq status passed from axi to vfe irq handler does not account
-* for 2 irq status registers. So below macro is added to differentiate between
-* same bit set on both irq status registers. This wil be fixed later by passing
-*entire payload to vfe irq handler and parsing there instead of passing just the
-*status bit*/
-
-#define VFE_IRQ_STATUS0_RDI0_REG_UPDATE  VFE_IRQ_STATUS0_RDI0_REG_UPDATE_MASK
-#define VFE_IRQ_STATUS0_RDI1_REG_UPDATE  VFE_IRQ_STATUS0_RDI1_REG_UPDATE_MASK
-
-/* imask for while waiting for stop ack,  driver has already
- * requested stop, waiting for reset irq, and async timer irq.
- * For irq_status_1, bit 28-32 are for async timer. For
- * irq_status_0, bit 31 for reset irq, bit 23 for axi_halt_ack
-   irq */
-#define VFE_IMASK_WHILE_STOPPING_0  0x80000000
-#define VFE_IMASK_WHILE_STOPPING_1  0xF0000000
-
-/* For ABF bit 4 is set to zero and other's 1 */
-#define ABF_MASK 0xFFFFFFF7
-
-/* For DBPC bit 0 is set to zero and other's 1 */
-#define DBPC_MASK 0xFFFFFFFE
-
-/* For DBPC bit 1 is set to zero and other's 1 */
-#define DBCC_MASK 0xFFFFFFFD
-
-/* For DBPC/ABF/DBCC/ABCC bits are set to 1 all others 0 */
-#define DEMOSAIC_MASK 0xF
-
-/* For MCE enable bit 28 set to zero and other's 1 */
-#define MCE_EN_MASK 0xEFFFFFFF
-
-/* For MCE Q_K bit 28 to 32 set to zero and other's 1 */
-#define MCE_Q_K_MASK 0x0FFFFFFF
-
-#define BE_ENABLE_MASK    (0x00000001<<5)
-#define BG_ENABLE_MASK    (0x00000001<<6)
-#define BF_ENABLE_MASK    (0x00000001<<7)
-#define AWB_ENABLE_MASK   (0x00000001<<8)
-#define RS_ENABLE_MASK    (0x00000001<<9)
-#define CS_ENABLE_MASK    (0x00000001<<10)
-#define CLF_ENABLE_MASK   (0x00000001<<12)
-#define IHIST_ENABLE_MASK (0x00000001<<15)
-#define BHIST_ENABLE_MASK (0x00000001<<18)
-#define RS_CS_ENABLE_MASK (RS_ENABLE_MASK|CS_ENABLE_MASK)
-#define STATS_ENABLE_MASK 0x000487E0   /* bit 18,15,10,9,8,7,6,5*/
-
-#define STATS_BHIST_ENABLE_MASK (0x00000001<<1)
-
-#define VFE_DMI_CFG_DEFAULT              0x00000100
-
-#define HFR_MODE_OFF 1
-#define VFE_FRAME_SKIP_PERIOD_MASK 0x0000001F /*bits 0 -4*/
-
-enum VFE40_DMI_RAM_SEL {
-	NO_MEM_SELECTED          = 0,
-	BLACK_LUT_RAM_BANK0      = 0x1,
-	BLACK_LUT_RAM_BANK1      = 0x2,
-	ROLLOFF_RAM0_BANK0       = 0x3,
-	ROLLOFF_RAM0_BANK1       = 0x4,
-	DEMOSAIC_LUT_RAM_BANK0   = 0x5,
-	DEMOSAIC_LUT_RAM_BANK1   = 0x6,
-	STATS_BHIST_RAM0         = 0x7,
-	STATS_BHIST_RAM1         = 0x8,
-	RGBLUT_RAM_CH0_BANK0     = 0x9,
-	RGBLUT_RAM_CH0_BANK1     = 0xa,
-	RGBLUT_RAM_CH1_BANK0     = 0xb,
-	RGBLUT_RAM_CH1_BANK1     = 0xc,
-	RGBLUT_RAM_CH2_BANK0     = 0xd,
-	RGBLUT_RAM_CH2_BANK1     = 0xe,
-	RGBLUT_CHX_BANK0         = 0xf,
-	RGBLUT_CHX_BANK1         = 0x10,
-	STATS_IHIST_RAM          = 0x11,
-	LUMA_ADAPT_LUT_RAM_BANK0 = 0x12,
-	LUMA_ADAPT_LUT_RAM_BANK1 = 0x13,
-};
-
-enum vfe_output_state {
-	VFE_STATE_IDLE,
-	VFE_STATE_START_REQUESTED,
-	VFE_STATE_STARTED,
-	VFE_STATE_STOP_REQUESTED,
-	VFE_STATE_STOPPED,
-};
-
-#define V40_CAMIF_OFF             0x000002F8
-#define V40_CAMIF_LEN             36
-
-#define V40_DEMUX_OFF             0x00000424
-#define V40_DEMUX_LEN             28
-
-#define V40_DEMOSAICV3_0_OFF      0x00000440
-#define V40_DEMOSAICV3_0_LEN      4
-#define V40_DEMOSAICV3_1_OFF      0x00000518
-#define V40_DEMOSAICV3_1_LEN      88
-#define V40_DEMOSAICV3_2_OFF      0x00000568
-#define V40_DEMOSAICV3_UP_REG_CNT 5
-
-#define V40_OUT_CLAMP_OFF         0x00000874
-#define V40_OUT_CLAMP_LEN         16
-
-#define V40_OPERATION_CFG_LEN     32
-
-#define V40_AXI_BUS_CMD_OFF       0x0000004C
-#define V40_AXI_BUS_CFG_LEN       284
-#define V40_AXI_OUT_LEN           344
-#define V40_AXI_CFG_LEN           71
-
-#define V40_BUS_PM_CMD            0x00000270
-#define V40_FOV_ENC_OFF           0x00000854
-#define V40_FOV_ENC_LEN           16
-#define V40_FOV_VIEW_OFF          0x00000864
-#define V40_FOV_VIEW_LEN          16
-
-#define V40_SCALER_ENC_OFF 0x0000075C
-#define V40_SCALER_ENC_LEN 72
-
-#define V40_SCALER_VIEW_OFF 0x000007A4
-#define V40_SCALER_VIEW_LEN 72
-
-#define V40_COLORXFORM_ENC_CFG_OFF 0x0000071C
-#define V40_COLORXFORM_ENC_CFG_LEN 32
-
-#define V40_COLORXFORM_VIEW_CFG_OFF 0x0000073C
-#define V40_COLORXFORM_VIEW_CFG_LEN 32
-
-#define V40_CHROMA_EN_OFF 0x00000640
-#define V40_CHROMA_EN_LEN 36
-
-#define V40_SYNC_TIMER_OFF      0x00000324
-#define V40_SYNC_TIMER_POLARITY_OFF 0x0000034C
-#define V40_TIMER_SELECT_OFF        0x00000374
-#define V40_SYNC_TIMER_LEN 28
-
-#define V40_ASYNC_TIMER_OFF 0x00000350
-#define V40_ASYNC_TIMER_LEN 28
-
-/* use 10x13 mesh table in vfe40*/
-#define V40_MESH_ROLL_OFF_CFG_OFF             0x00000400
-#define V40_MESH_ROLL_OFF_CFG_LEN             36
-#define V40_MESH_ROLL_OFF_TABLE_SIZE          130
-
-#define V40_COLOR_COR_OFF 0x000005D0
-#define V40_COLOR_COR_LEN 52
-
-#define V40_WB_OFF 0x00000580
-#define V40_WB_LEN 4
-
-#define V40_RGB_G_OFF 0x00000638
-#define V40_RGB_G_LEN 4
-#define V40_GAMMA_LUT_BANK_SEL_MASK           0x00000007
-
-#define V40_LA_OFF 0x0000063C
-#define V40_LA_LEN 4
-
-#define V40_SCE_OFF 0x00000694
-#define V40_SCE_LEN 136
-
-#define V40_CHROMA_SUP_OFF 0x00000664
-#define V40_CHROMA_SUP_LEN 12
-
-#define V40_MCE_OFF 0x00000670
-#define V40_MCE_LEN 36
-
-#define V40_STATS_BE_OFF 0x0000088C
-#define V40_STATS_BE_LEN 12
-
-#define V40_STATS_BG_OFF 0x00000898
-#define V40_STATS_BG_LEN 12
-
-#define V40_STATS_BF_OFF 0x000008A4
-#define V40_STATS_BF_LEN 24
-
-#define V40_STATS_BHIST_OFF 0x000008BC
-#define V40_STATS_BHIST_LEN 8
-
-#define V40_STATS_AWB_OFF 0x000008C4
-#define V40_STATS_AWB_LEN 32
-
-#define V40_STATS_RS_OFF 0x000008E4
-#define V40_STATS_RS_LEN 8
-
-#define V40_STATS_CS_OFF 0x000008EC
-#define V40_STATS_CS_LEN 8
-
-#define V40_STATS_IHIST_OFF 0x000008F4
-#define V40_STATS_IHIST_LEN 8
-
-#define V40_STATS_SKIN_OFF 0x000008FC
-#define V40_STATS_SKIN_LEN 20
-
-#define V40_ASF_OFF 0x000007EC
-#define V40_ASF_LEN 48
-#define V40_ASF_UPDATE_LEN 36
-
-#define V40_CAPTURE_LEN 4
-
-#define V40_GET_HW_VERSION_OFF 0
-#define V40_GET_HW_VERSION_LEN 4
-
-#define V40_LINEARIZATION_OFF1 0x0000037C
-#define V40_LINEARIZATION_LEN1 68
-
-#define V40_DEMOSAICV3_DBPC_CFG_OFF  0x00000444
-#define V40_DEMOSAICV3_DBPC_LEN 4
-
-#define V40_DEMOSAICV3_DBPC_CFG_OFF0 0x00000448
-#define V40_DEMOSAICV3_DBPC_CFG_OFF1 0x0000044C
-#define V40_DEMOSAICV3_DBPC_CFG_OFF2 0x00000450
-
-#define V40_DEMOSAICV3_DBCC_OFF 0x00000454
-#define V40_DEMOSAICV3_DBCC_LEN 16
-
-#define V40_DEMOSAICV3_ABF_OFF 0x00000464
-#define V40_DEMOSAICV3_ABF_LEN 180
-
-#define V40_MODULE_CFG_OFF 0x00000018
-#define V40_MODULE_CFG_LEN 4
-
-#define V40_ASF_SPECIAL_EFX_CFG_OFF 0x0000081C
-#define V40_ASF_SPECIAL_EFX_CFG_LEN 4
-
-#define V40_CLF_CFG_OFF 0x00000588
-#define V40_CLF_CFG_LEN 72
-
-#define V40_CLF_LUMA_UPDATE_OFF 0x0000058C
-#define V40_CLF_LUMA_UPDATE_LEN 60
-
-#define V40_CLF_CHROMA_UPDATE_OFF 0x000005C8
-#define V40_CLF_CHROMA_UPDATE_LEN 8
-
-#define VFE40_GAMMA_NUM_ENTRIES  64
-
-#define VFE40_LA_TABLE_LENGTH    64
-
-#define VFE40_LINEARIZATON_TABLE_LENGTH    36
-
-struct vfe_cmd_hw_version {
-	uint32_t minorVersion;
-	uint32_t majorVersion;
-	uint32_t coreVersion;
-};
-
-enum VFE_AXI_OUTPUT_MODE {
-	VFE_AXI_OUTPUT_MODE_Output1,
-	VFE_AXI_OUTPUT_MODE_Output2,
-	VFE_AXI_OUTPUT_MODE_Output1AndOutput2,
-	VFE_AXI_OUTPUT_MODE_CAMIFToAXIViaOutput2,
-	VFE_AXI_OUTPUT_MODE_Output2AndCAMIFToAXIViaOutput1,
-	VFE_AXI_OUTPUT_MODE_Output1AndCAMIFToAXIViaOutput2,
-	VFE_AXI_LAST_OUTPUT_MODE_ENUM
-};
-
-enum VFE_RAW_WR_PATH_SEL {
-	VFE_RAW_OUTPUT_DISABLED,
-	VFE_RAW_OUTPUT_ENC_CBCR_PATH,
-	VFE_RAW_OUTPUT_VIEW_CBCR_PATH,
-	VFE_RAW_OUTPUT_PATH_INVALID
-};
-
-
-#define VFE_AXI_OUTPUT_BURST_LENGTH     4
-#define VFE_MAX_NUM_FRAGMENTS_PER_FRAME 4
-#define VFE_AXI_OUTPUT_CFG_FRAME_COUNT  3
-
-struct vfe_cmds_per_write_master {
-	uint16_t imageWidth;
-	uint16_t imageHeight;
-	uint16_t outRowCount;
-	uint16_t outRowIncrement;
-	uint32_t outFragments[VFE_AXI_OUTPUT_CFG_FRAME_COUNT]
-		[VFE_MAX_NUM_FRAGMENTS_PER_FRAME];
-};
-
-struct vfe_cmds_axi_per_output_path {
-	uint8_t fragmentCount;
-	struct vfe_cmds_per_write_master firstWM;
-	struct vfe_cmds_per_write_master secondWM;
-};
-
-enum VFE_AXI_BURST_LENGTH {
-	VFE_AXI_BURST_LENGTH_IS_2  = 2,
-	VFE_AXI_BURST_LENGTH_IS_4  = 4,
-	VFE_AXI_BURST_LENGTH_IS_8  = 8,
-	VFE_AXI_BURST_LENGTH_IS_16 = 16
-};
-
-
-struct vfe_cmd_fov_crop_config {
-	uint8_t enable;
-	uint16_t firstPixel;
-	uint16_t lastPixel;
-	uint16_t firstLine;
-	uint16_t lastLine;
-};
-
-struct vfe_cmds_main_scaler_stripe_init {
-	uint16_t MNCounterInit;
-	uint16_t phaseInit;
-};
-
-struct vfe_cmds_scaler_one_dimension {
-	uint8_t  enable;
-	uint16_t inputSize;
-	uint16_t outputSize;
-	uint32_t phaseMultiplicationFactor;
-	uint8_t  interpolationResolution;
-};
-
-struct vfe_cmd_main_scaler_config {
-	uint8_t enable;
-	struct vfe_cmds_scaler_one_dimension    hconfig;
-	struct vfe_cmds_scaler_one_dimension    vconfig;
-	struct vfe_cmds_main_scaler_stripe_init MNInitH;
-	struct vfe_cmds_main_scaler_stripe_init MNInitV;
-};
-
-struct vfe_cmd_scaler2_config {
-	uint8_t enable;
-	struct vfe_cmds_scaler_one_dimension hconfig;
-	struct vfe_cmds_scaler_one_dimension vconfig;
-};
-
-
-struct vfe_cmd_frame_skip_update {
-	uint32_t output1Pattern;
-	uint32_t output2Pattern;
-};
-
-struct vfe_cmd_output_clamp_config {
-	uint8_t minCh0;
-	uint8_t minCh1;
-	uint8_t minCh2;
-	uint8_t maxCh0;
-	uint8_t maxCh1;
-	uint8_t maxCh2;
-};
-
-struct vfe_cmd_chroma_subsample_config {
-	uint8_t enable;
-	uint8_t cropEnable;
-	uint8_t vsubSampleEnable;
-	uint8_t hsubSampleEnable;
-	uint8_t vCosited;
-	uint8_t hCosited;
-	uint8_t vCositedPhase;
-	uint8_t hCositedPhase;
-	uint16_t cropWidthFirstPixel;
-	uint16_t cropWidthLastPixel;
-	uint16_t cropHeightFirstLine;
-	uint16_t cropHeightLastLine;
-};
-
-enum VFE_START_PIXEL_PATTERN {
-	VFE_BAYER_RGRGRG,
-	VFE_BAYER_GRGRGR,
-	VFE_BAYER_BGBGBG,
-	VFE_BAYER_GBGBGB,
-	VFE_YUV_YCbYCr,
-	VFE_YUV_YCrYCb,
-	VFE_YUV_CbYCrY,
-	VFE_YUV_CrYCbY
-};
-
-enum VFE_BUS_RD_INPUT_PIXEL_PATTERN {
-	VFE_BAYER_RAW,
-	VFE_YUV_INTERLEAVED,
-	VFE_YUV_PSEUDO_PLANAR_Y,
-	VFE_YUV_PSEUDO_PLANAR_CBCR
-};
-
-enum VFE_YUV_INPUT_COSITING_MODE {
-	VFE_YUV_COSITED,
-	VFE_YUV_INTERPOLATED
-};
-
-struct vfe_cmds_demosaic_abf {
-	uint8_t   enable;
-	uint8_t   forceOn;
-	uint8_t   shift;
-	uint16_t  lpThreshold;
-	uint16_t  max;
-	uint16_t  min;
-	uint8_t   ratio;
-};
-
-struct vfe_cmds_demosaic_bpc {
-	uint8_t   enable;
-	uint16_t  fmaxThreshold;
-	uint16_t  fminThreshold;
-	uint16_t  redDiffThreshold;
-	uint16_t  blueDiffThreshold;
-	uint16_t  greenDiffThreshold;
-};
-
-struct vfe_cmd_demosaic_config {
-	uint8_t   enable;
-	uint8_t   slopeShift;
-	struct vfe_cmds_demosaic_abf abfConfig;
-	struct vfe_cmds_demosaic_bpc bpcConfig;
-};
-
-struct vfe_cmd_demosaic_bpc_update {
-	struct vfe_cmds_demosaic_bpc bpcUpdate;
-};
-
-struct vfe_cmd_demosaic_abf_update {
-	struct vfe_cmds_demosaic_abf abfUpdate;
-};
-
-struct vfe_cmd_white_balance_config {
-	uint8_t  enable;
-	uint16_t ch2Gain;
-	uint16_t ch1Gain;
-	uint16_t ch0Gain;
-};
-
-enum VFE_COLOR_CORRECTION_COEF_QFACTOR {
-	COEF_IS_Q7_SIGNED,
-	COEF_IS_Q8_SIGNED,
-	COEF_IS_Q9_SIGNED,
-	COEF_IS_Q10_SIGNED
-};
-
-struct vfe_cmd_color_correction_config {
-	uint8_t     enable;
-	enum VFE_COLOR_CORRECTION_COEF_QFACTOR coefQFactor;
-	int16_t  C0;
-	int16_t  C1;
-	int16_t  C2;
-	int16_t  C3;
-	int16_t  C4;
-	int16_t  C5;
-	int16_t  C6;
-	int16_t  C7;
-	int16_t  C8;
-	int16_t  K0;
-	int16_t  K1;
-	int16_t  K2;
-};
-
-#define VFE_LA_TABLE_LENGTH 64
-
-struct vfe_cmd_la_config {
-	uint8_t enable;
-	int16_t table[VFE_LA_TABLE_LENGTH];
-};
-
-#define VFE_GAMMA_TABLE_LENGTH 256
-enum VFE_RGB_GAMMA_TABLE_SELECT {
-	RGB_GAMMA_CH0_SELECTED,
-	RGB_GAMMA_CH1_SELECTED,
-	RGB_GAMMA_CH2_SELECTED,
-	RGB_GAMMA_CH0_CH1_SELECTED,
-	RGB_GAMMA_CH0_CH2_SELECTED,
-	RGB_GAMMA_CH1_CH2_SELECTED,
-	RGB_GAMMA_CH0_CH1_CH2_SELECTED
-};
-
-struct vfe_cmd_rgb_gamma_config {
-	uint8_t enable;
-	enum VFE_RGB_GAMMA_TABLE_SELECT channelSelect;
-	int16_t table[VFE_GAMMA_TABLE_LENGTH];
-};
-
-struct vfe_cmd_chroma_enhan_config {
-	uint8_t  enable;
-	int16_t am;
-	int16_t ap;
-	int16_t bm;
-	int16_t bp;
-	int16_t cm;
-	int16_t cp;
-	int16_t dm;
-	int16_t dp;
-	int16_t kcr;
-	int16_t kcb;
-	int16_t RGBtoYConversionV0;
-	int16_t RGBtoYConversionV1;
-	int16_t RGBtoYConversionV2;
-	uint8_t RGBtoYConversionOffset;
-};
-
-struct vfe_cmd_chroma_suppression_config {
-	uint8_t enable;
-	uint8_t m1;
-	uint8_t m3;
-	uint8_t n1;
-	uint8_t n3;
-	uint8_t nn1;
-	uint8_t mm1;
-};
-
-struct vfe_cmd_asf_config {
-	uint8_t enable;
-	uint8_t smoothFilterEnabled;
-	uint8_t sharpMode;
-	uint8_t smoothCoefCenter;
-	uint8_t smoothCoefSurr;
-	uint8_t normalizeFactor;
-	uint8_t sharpK1;
-	uint8_t sharpK2;
-	uint8_t sharpThreshE1;
-	int8_t sharpThreshE2;
-	int8_t sharpThreshE3;
-	int8_t sharpThreshE4;
-	int8_t sharpThreshE5;
-	int8_t filter1Coefficients[9];
-	int8_t filter2Coefficients[9];
-	uint8_t  cropEnable;
-	uint16_t cropFirstPixel;
-	uint16_t cropLastPixel;
-	uint16_t cropFirstLine;
-	uint16_t cropLastLine;
-};
-
-struct vfe_cmd_asf_update {
-	uint8_t enable;
-	uint8_t smoothFilterEnabled;
-	uint8_t sharpMode;
-	uint8_t smoothCoefCenter;
-	uint8_t smoothCoefSurr;
-	uint8_t normalizeFactor;
-	uint8_t sharpK1;
-	uint8_t sharpK2;
-	uint8_t sharpThreshE1;
-	int8_t  sharpThreshE2;
-	int8_t  sharpThreshE3;
-	int8_t  sharpThreshE4;
-	int8_t  sharpThreshE5;
-	int8_t  filter1Coefficients[9];
-	int8_t  filter2Coefficients[9];
-	uint8_t cropEnable;
-};
-
-enum VFE_TEST_GEN_SYNC_EDGE {
-	VFE_TEST_GEN_SYNC_EDGE_ActiveHigh,
-	VFE_TEST_GEN_SYNC_EDGE_ActiveLow
-};
-
-
-struct vfe_cmd_bus_pm_start {
-	uint8_t output2YWrPmEnable;
-	uint8_t output2CbcrWrPmEnable;
-	uint8_t output1YWrPmEnable;
-	uint8_t output1CbcrWrPmEnable;
-};
-
-struct  vfe_frame_skip_counts {
-	uint32_t  totalFrameCount;
-	uint32_t  output1Count;
-	uint32_t  output2Count;
-};
-
-enum VFE_AXI_RD_UNPACK_HBI_SEL {
-	VFE_AXI_RD_HBI_32_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_64_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_128_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_256_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_512_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_1024_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_2048_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_4096_CLOCK_CYCLES
-};
-
-struct vfe_frame_bpc_info {
-	uint32_t greenDefectPixelCount;
-	uint32_t redBlueDefectPixelCount;
-};
-
-struct vfe_frame_asf_info {
-	uint32_t  asfMaxEdge;
-	uint32_t  asfHbiCount;
-};
-
-struct vfe_msg_camif_status {
-	uint8_t  camifState;
-	uint32_t pixelCount;
-	uint32_t lineCount;
-};
-
-struct vfe40_irq_status {
-	uint32_t vfeIrqStatus0;
-	uint32_t vfeIrqStatus1;
-	uint32_t camifStatus;
-	uint32_t demosaicStatus;
-	uint32_t asfMaxEdge;
-};
-
-#define V40_PREVIEW_AXI_FLAG  0x00000001
-#define V40_SNAPSHOT_AXI_FLAG (0x00000001<<1)
-
-struct vfe40_cmd_type {
-	uint16_t id;
-	uint32_t length;
-	uint32_t offset;
-	uint32_t flag;
-};
-
-struct vfe40_free_buf {
-	struct list_head node;
-	uint32_t paddr;
-	uint32_t y_off;
-	uint32_t cbcr_off;
-};
-
-struct vfe40_output_ch {
-	struct list_head free_buf_queue;
-	spinlock_t free_buf_lock;
-	uint32_t inst_handle;
-	int8_t ch0;
-	int8_t ch1;
-	int8_t ch2;
-	uint32_t  capture_cnt;
-	uint32_t  frame_drop_cnt;
-	struct msm_free_buf ping;
-	struct msm_free_buf pong;
-	struct msm_free_buf free_buf;
-};
-
-/* no error irq in mask 0 */
-#define VFE40_IMASK_ERROR_ONLY_0  0x0
-/* when normal case, don't want to block error status. */
-/* bit 0-21 are error irq bits */
-#define VFE40_IMASK_COMMON_ERROR_ONLY_1       0x0000FF00
-#define VFE40_IMASK_VFE_ERROR_ONLY_1          0x00FF01FF
-#define VFE40_IMASK_CAMIF_ERROR               (0x00000001<<0)
-#define VFE40_IMASK_BHIST_OVWR                (0x00000001<<1)
-#define VFE40_IMASK_STATS_CS_OVWR             (0x00000001<<2)
-#define VFE40_IMASK_STATS_IHIST_OVWR          (0x00000001<<3)
-#define VFE40_IMASK_REALIGN_BUF_Y_OVFL        (0x00000001<<4)
-#define VFE40_IMASK_REALIGN_BUF_CB_OVFL       (0x00000001<<5)
-#define VFE40_IMASK_REALIGN_BUF_CR_OVFL       (0x00000001<<6)
-#define VFE40_IMASK_VIOLATION                 (0x00000001<<7)
-#define VFE40_IMASK_BUS_BDG_HALT_ACK          (0x00000001<<8)
-#define VFE40_IMASK_IMG_MAST_0_BUS_OVFL       (0x00000001<<9)
-#define VFE40_IMASK_IMG_MAST_1_BUS_OVFL       (0x00000001<<10)
-#define VFE40_IMASK_IMG_MAST_2_BUS_OVFL       (0x00000001<<11)
-#define VFE40_IMASK_IMG_MAST_3_BUS_OVFL       (0x00000001<<12)
-#define VFE40_IMASK_IMG_MAST_4_BUS_OVFL       (0x00000001<<13)
-#define VFE40_IMASK_IMG_MAST_5_BUS_OVFL       (0x00000001<<14)
-#define VFE40_IMASK_IMG_MAST_6_BUS_OVFL       (0x00000001<<15)
-#define VFE40_IMASK_STATS_BE_BUS_OVFL         (0x00000001<<16)
-#define VFE40_IMASK_STATS_BG_BUS_OVFL         (0x00000001<<17)
-#define VFE40_IMASK_STATS_BF_BUS_OVFL         (0x00000001<<18)
-#define VFE40_IMASK_STATS_AWB_BUS_OVFL        (0x00000001<<19)
-#define VFE40_IMASK_STATS_RS_BUS_OVFL         (0x00000001<<10)
-#define VFE40_IMASK_STATS_CS_BUS_OVFL         (0x00000001<<21)
-#define VFE40_IMASK_STATS_IHIST_BUS_OVFL      (0x00000001<<22)
-#define VFE40_IMASK_STATS_SKIN_BHIST_BUS_OVFL (0x00000001<<23)
-
-#define VFE_COM_STATUS 0x000FE000
-
-struct vfe40_output_path {
-	uint16_t output_mode;     /* bitmask  */
-
-	struct vfe40_output_ch out0; /* preview and thumbnail */
-	struct vfe40_output_ch out1; /* snapshot */
-	struct vfe40_output_ch out2; /* rdi0    */
-	struct vfe40_output_ch out3; /* rdi01   */
-};
-
-struct vfe40_frame_extra {
-	uint32_t greenDefectPixelCount;
-	uint32_t redBlueDefectPixelCount;
-
-	uint32_t  asfMaxEdge;
-	uint32_t  asfHbiCount;
-
-	uint32_t yWrPmStats0;
-	uint32_t yWrPmStats1;
-	uint32_t cbcrWrPmStats0;
-	uint32_t cbcrWrPmStats1;
-
-	uint32_t  frameCounter;
-};
-
-#define VFE_HW_VERSION			0x00000000
-#define VFE_GLOBAL_RESET                0x0000000C
-#define VFE_MODULE_RESET                0x00000010
-#define VFE_CGC_OVERRIDE                0x00000014
-#define VFE_MODULE_CFG                  0x00000018
-#define VFE_CFG				            0x0000001C
-#define VFE_IRQ_CMD                     0x00000024
-#define VFE_IRQ_MASK_0                  0x00000028
-#define VFE_IRQ_MASK_1                  0x0000002C
-#define VFE_IRQ_CLEAR_0                 0x00000030
-#define VFE_IRQ_CLEAR_1                 0x00000034
-#define VFE_IRQ_STATUS_0                0x00000038
-#define VFE_IRQ_STATUS_1                0x0000003C
-#define VFE_IRQ_COMP_MASK               0x00000040
-#define VFE_BUS_CMD                     0x0000004C
-#define VFE_BUS_PING_PONG_STATUS        0x00000268
-#define VFE_AXI_CMD                     0x000002C0
-#define VFE_AXI_STATUS                  0x000002E4
-#define VFE_BUS_STATS_PING_PONG_BASE    0x00000168
-
-#define VFE_BUS_STATS_BE_WR_PING_ADDR    0x00000168
-#define VFE_BUS_STATS_BE_WR_PONG_ADDR    0x0000016C
-#define VFE_BUS_STATS_BE_WR_ADDR_CFG    0x00000170
-#define VFE_BUS_STATS_BE_UB_CFG          0x00000174
-#define VFE_BUS_STATS_BE_WR_FRAMEDROP_PATTERN  0x00000178
-#define VFE_BUS_STATS_BE_WR_IRQ_SUBSAMPLE_PATTERN 0x0000017C
-
-#define VFE_BUS_STATS_BG_WR_PING_ADDR     0x00000180
-#define VFE_BUS_STATS_BG_WR_PONG_ADDR     0x00000184
-#define VFE_BUS_STATS_BG_WR_ADDR_CFG      0x00000188
-#define VFE_BUS_STATS_BG_WR_UB_CFG        0x0000018C
-#define VFE_BUS_STATS_BG_WR_FRAMEDROP_PATTERN 0x00000190
-#define VFE_BUS_STATS_BG_WR_IRQ_SUBSAMPLE_PATTERN 0x00000194
-
-#define VFE_BUS_STATS_BF_WR_PING_ADDR     0x00000198
-#define VFE_BUS_STATS_BF_WR_PONG_ADDR     0x0000019C
-#define VFE_BUS_STATS_BF_WR_ADDR_CFG      0x000001A0
-#define VFE_BUS_STATS_BF_WR_UB_CFG        0x000001A4
-#define VFE_BUS_STATS_BF_WR_FRAMEDROP_PATTERN  0x000001A8
-#define VFE_BUS_STATS_BF_WR_IRQ_SUBSAMPLE_PATTERN  0x000001AC
-
-#define VFE_BUS_STATS_AWB_WR_PING_ADDR    0x000001B0
-#define VFE_BUS_STATS_AWB_WR_PONG_ADDR    0x000001B4
-#define VFE_BUS_STATS_AWB_WR_ADDR_CFG     0x000001B8
-#define VFE_BUS_STATS_AWB_WR_UB_CFG       0x000001BC
-#define VFE_BUS_STATS_AWB_WR_FRAMEDROP_PATTERN  0x000001C0
-#define VFE_BUS_STATS_AWB_WR_IRQ_SUBSAMPLE_PATTERN  0x000001C4
-
-#define VFE_BUS_STATS_RS_WR_PING_ADDR     0x000001C8
-#define VFE_BUS_STATS_RS_WR_PONG_ADDR     0x000001CC
-#define VFE_BUS_STATS_RS_WR_ADDR_CFG      0x000001D0
-#define VFE_BUS_STATS_RS_WR_UB_CFG    0x000001D4
-#define VFE_BUS_STATS_RS_WR_FRAMEDROP_PATTERN      0x000001D8
-#define VFE_BUS_STATS_RS_WR_IRQ_SUBSAMPLE_PATTERN  0x000001DC
-
-#define VFE_BUS_STATS_CS_WR_PING_ADDR     0x000001E0
-#define VFE_BUS_STATS_CS_WR_PONG_ADDR     0x000001E4
-#define VFE_BUS_STATS_CS_WR_ADDR_CFG      0x000001E8
-#define VFE_BUS_STATS_CS_WR_UB_CFG        0x000001EC
-#define VFE_BUS_STATS_CS_WR_FRAMEDROP_PATTERN     0x000001F0
-#define VFE_BUS_STATS_CS_WR_IRQ_SUBSAMPLE_PATTERN 0x000001F4
-
-#define VFE_BUS_STATS_HIST_WR_PING_ADDR   0x000001F8
-#define VFE_BUS_STATS_HIST_WR_PONG_ADDR   0x000001FC
-#define VFE_BUS_STATS_HIST_WR_ADDR_CFG    0x00000200
-#define VFE_BUS_STATS_HIST_WR_UB_CFG      0x00000204
-#define VFE_BUS_STATS_HIST_WR_FRAMEDROP_PATTERN      0x00000208
-#define VFE_BUS_STATS_HIST_WR_IRQ_SUBSAMPLE_PATTERN  0x0000020C
-
-
-#define VFE_BUS_STATS_SKIN_WR_PING_ADDR   0x00000210
-#define VFE_BUS_STATS_SKIN_WR_PONG_ADDR   0x00000214
-#define VFE_BUS_STATS_SKIN_WR_ADDR_CFG    0x00000218
-#define VFE_BUS_STATS_SKIN_WR_UB_CFG      0x0000021C
-#define VFE_BUS_STATS_SKIN_WR_FRAMEDROP_PATTERN       0x00000220
-#define VFE_BUS_STATS_SKIN_WR_IRQ_SUBSAMPLE_PATTERN   0x00000224
-
-#define VFE_0_BUS_BDG_QOS_CFG_0     0x000002C4
-#define VFE_0_BUS_BDG_QOS_CFG_1     0x000002C8
-#define VFE_0_BUS_BDG_QOS_CFG_2     0x000002CC
-#define VFE_0_BUS_BDG_QOS_CFG_3     0x000002D0
-#define VFE_0_BUS_BDG_QOS_CFG_4     0x000002D4
-#define VFE_0_BUS_BDG_QOS_CFG_5     0x000002D8
-#define VFE_0_BUS_BDG_QOS_CFG_6     0x000002DC
-#define VFE_0_BUS_BDG_QOS_CFG_7     0x000002E0
-
-#define VFE_CAMIF_COMMAND               0x000002F4
-#define VFE_CAMIF_STATUS                0x0000031C
-#define VFE_REG_UPDATE_CMD              0x00000378
-#define VFE_DEMUX_GAIN_0                0x00000428
-#define VFE_DEMUX_GAIN_1                0x0000042C
-#define VFE_CHROMA_UP                   0x0000057C
-
-#define VFE_CLAMP_ENC_MAX               0x00000874
-#define VFE_CLAMP_ENC_MIN               0x00000878
-#define VFE_CLAMP_VIEW_MAX              0x0000087C
-#define VFE_CLAMP_VIEW_MIN              0x00000880
-
-#define VFE_REALIGN_BUF                 0x00000884
-#define VFE_STATS_CFG                   0x00000888
-#define VFE_STATS_AWB_SGW_CFG           0x000008CC
-#define VFE_DMI_CFG                     0x00000910
-#define VFE_DMI_ADDR                    0x00000914
-#define VFE_DMI_DATA_HI                 0x00000918
-#define VFE_DMI_DATA_LO                 0x0000091C
-#define VFE_BUS_IO_FORMAT_CFG           0x00000054
-#define VFE_RDI0_CFG                    0x000002E8
-#define VFE_RDI1_CFG                    0x000002EC
-#define VFE_RDI2_CFG                    0x000002F0
-
-#define VFE_VIOLATION_STATUS            0x00000048
-
-#define VFE40_DMI_DATA_HI               0x00000918
-#define VFE40_DMI_DATA_LO               0x0000091C
-
-#define VFE40_OUTPUT_MODE_PT			BIT(0)
-#define VFE40_OUTPUT_MODE_S			BIT(1)
-#define VFE40_OUTPUT_MODE_V			BIT(2)
-#define VFE40_OUTPUT_MODE_P			BIT(3)
-#define VFE40_OUTPUT_MODE_T			BIT(4)
-#define VFE40_OUTPUT_MODE_P_ALL_CHNLS		BIT(5)
-#define VFE40_OUTPUT_MODE_PRIMARY		BIT(6)
-#define VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS	BIT(7)
-#define VFE40_OUTPUT_MODE_SECONDARY		BIT(8)
-#define VFE40_OUTPUT_MODE_SECONDARY_ALL_CHNLS	BIT(9)
-#define VFE40_OUTPUT_MODE_TERTIARY1		BIT(10)
-#define VFE40_OUTPUT_MODE_TERTIARY2		BIT(11)
-
-#define VFE40_VBIF_CLKON				0x4
-#define VFE40_VBIF_IN_RD_LIM_CONF0		0xB0
-#define VFE40_VBIF_IN_RD_LIM_CONF1		0xB4
-#define VFE40_VBIF_IN_RD_LIM_CONF2		0xB8
-#define VFE40_VBIF_IN_WR_LIM_CONF0		0xC0
-#define VFE40_VBIF_IN_WR_LIM_CONF1		0xC4
-#define VFE40_VBIF_IN_WR_LIM_CONF2		0xC8
-#define VFE40_VBIF_OUT_RD_LIM_CONF0		0xD0
-#define VFE40_VBIF_OUT_WR_LIM_CONF0		0xD4
-#define VFE40_VBIF_DDR_OUT_MAX_BURST	0xD8
-#define VFE40_VBIF_ARB_CTL				0xF0
-#define VFE40_VBIF_DDR_ARB_CONF0		0xF4
-#define VFE40_VBIF_DDR_ARB_CONF1		0xF8
-#define VFE40_VBIF_ROUND_ROBIN_QOS_ARB	0x124
-#define VFE40_VBIF_OUT_AXI_AOOO_EN		0x178
-#define VFE40_VBIF_OUT_AXI_AOOO			0x17C
-
-struct vfe_stats_control {
-	uint32_t droppedStatsFrameCount;
-	uint32_t bufToRender;
-};
-struct axi_ctrl_t;
-struct vfe40_ctrl_type;
-
-struct vfe_share_ctrl_t {
-	void __iomem *vfebase;
-	void __iomem *vfe_vbif_base;
-	uint32_t register_total;
-
-	atomic_t vstate;
-	atomic_t handle_common_irq;
-	uint32_t vfeFrameId;
-	uint32_t rdi0FrameId;
-	uint32_t rdi1FrameId;
-	uint32_t rdi2FrameId;
-	uint32_t stats_comp;
-	spinlock_t  sd_notify_lock;
-	spinlock_t  stop_flag_lock;
-	int8_t stop_ack_pending;
-	enum vfe_output_state liveshot_state;
-	uint32_t vfe_capture_count;
-
-	uint32_t operation_mode;     /* streaming or snapshot */
-	uint32_t current_mode;
-	struct vfe40_output_path outpath;
-
-	uint16_t port_info;
-	uint8_t stop_immediately;
-	uint8_t sync_abort;
-	uint16_t cmd_type;
-	uint8_t vfe_reset_flag;
-
-	uint8_t axi_ref_cnt;
-	uint16_t comp_output_mode;
-
-	struct completion reset_complete;
-
-	spinlock_t  update_ack_lock;
-	spinlock_t  start_ack_lock;
-
-	struct axi_ctrl_t *axi_ctrl;
-	struct vfe40_ctrl_type *vfe40_ctrl;
-	int8_t start_ack_pending;
-	int8_t update_ack_pending;
-	enum vfe_output_state recording_state;
-
-	atomic_t pix0_update_ack_pending;
-	atomic_t rdi0_update_ack_pending;
-	atomic_t rdi1_update_ack_pending;
-	atomic_t rdi2_update_ack_pending;
-};
-
-struct axi_ctrl_t {
-	struct v4l2_subdev subdev;
-	struct platform_device *pdev;
-	struct resource *vfeirq;
-	spinlock_t  tasklet_lock;
-	struct list_head tasklet_q;
-
-	void *syncdata;
-
-	struct resource	*vfemem;
-	struct resource	*vfe_vbif_mem;
-	struct resource *vfeio;
-	struct resource *vfe_vbif_io;
-	struct regulator *fs_vfe;
-	struct clk *vfe_clk[7];
-	struct tasklet_struct vfe40_tasklet;
-	struct vfe_share_ctrl_t *share_ctrl;
-	struct device *iommu_ctx;
-	uint32_t bus_perf_client;
-	uint32_t use_irq_router;
-};
-
-struct vfe40_ctrl_type {
-	spinlock_t  state_lock;
-	spinlock_t  stats_bufq_lock;
-	uint32_t extlen;
-	void *extdata;
-
-	int8_t vfe_sof_count_enable;
-	int8_t update_linear;
-	int8_t update_rolloff;
-	int8_t update_la;
-	int8_t update_gamma;
-
-	struct vfe_share_ctrl_t *share_ctrl;
-
-	uint32_t sync_timer_repeat_count;
-	uint32_t sync_timer_state;
-	uint32_t sync_timer_number;
-
-	struct msm_ver_num_info ver_num;
-	struct vfe_stats_control afbfStatsControl;
-	struct vfe_stats_control awbStatsControl;
-	struct vfe_stats_control aecbgStatsControl;
-	struct vfe_stats_control ihistStatsControl;
-	struct vfe_stats_control rsStatsControl;
-	struct vfe_stats_control csStatsControl;
-	struct vfe_stats_control bhistStatsControl;
-
-	/* v4l2 subdev */
-	struct v4l2_subdev subdev;
-	struct platform_device *pdev;
-	uint32_t hfr_mode;
-	uint32_t frame_skip_cnt;
-	uint32_t frame_skip_pattern;
-	uint32_t snapshot_frame_cnt;
-	struct msm_stats_bufq_ctrl stats_ctrl;
-	struct msm_stats_ops stats_ops;
-
-	uint32_t simultaneous_sof_stat;
-};
-
-#define statsAeNum      0
-#define statsAfNum      1
-#define statsAwbNum     2
-#define statsRsNum      3
-#define statsCsNum      4
-#define statsIhistNum   5
-#define statsSkinNum    6
-
-struct vfe_cmd_stats_ack {
-	uint32_t  nextStatsBuf;
-};
-
-#define VFE_STATS_BUFFER_COUNT            3
-
-struct vfe_cmd_stats_buf {
-	uint32_t statsBuf[VFE_STATS_BUFFER_COUNT];
-};
-
-#endif /* __MSM_VFE40_H__ */
diff --git a/drivers/media/video/msm/vfe/msm_vfe40_axi.c b/drivers/media/video/msm/vfe/msm_vfe40_axi.c
deleted file mode 100644
index 88a219c..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe40_axi.c
+++ /dev/null
@@ -1,824 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/module.h>
-#include <linux/uaccess.h>
-#include <linux/interrupt.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/atomic.h>
-#include <linux/regulator/consumer.h>
-#include <linux/clk.h>
-#include <mach/irqs.h>
-#include <mach/camera.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-subdev.h>
-#include <media/msm_isp.h>
-
-#include "msm.h"
-#include "msm_vfe40.h"
-
-static int msm_axi_subdev_s_crystal_freq(struct v4l2_subdev *sd,
-						u32 freq, u32 flags)
-{
-	int rc = 0;
-	int round_rate;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-
-	round_rate = clk_round_rate(axi_ctrl->vfe_clk[0], freq);
-	if (rc < 0) {
-		pr_err("%s: clk_round_rate failed %d\n",
-					__func__, rc);
-		return rc;
-	}
-
-	axi_ctrl->share_ctrl->vfe_clk_rate = round_rate;
-	rc = clk_set_rate(axi_ctrl->vfe_clk[0], round_rate);
-	if (rc < 0)
-		pr_err("%s: clk_set_rate failed %d\n",
-					__func__, rc);
-
-	return rc;
-}
-
-void axi_start(struct axi_ctrl_t *axi_ctrl)
-{
-	switch (axi_ctrl->share_ctrl->operation_mode) {
-	case VFE_OUTPUTS_PREVIEW:
-	case VFE_OUTPUTS_PREVIEW_AND_VIDEO:
-		if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE40_OUTPUT_MODE_PRIMARY) {
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch1]);
-		} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-				VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS) {
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch0]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch1]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out0.ch2]);
-		}
-		break;
-	default:
-		if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE40_OUTPUT_MODE_SECONDARY) {
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch1]);
-		} else if (axi_ctrl->share_ctrl->outpath.output_mode &
-			VFE40_OUTPUT_MODE_SECONDARY_ALL_CHNLS) {
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch0]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch1]);
-			msm_camera_io_w(1, axi_ctrl->share_ctrl->vfebase +
-				vfe40_AXI_WM_CFG[axi_ctrl->
-				share_ctrl->outpath.out1.ch2]);
-		}
-		break;
-	}
-}
-
-void axi_stop(struct axi_ctrl_t *axi_ctrl)
-{
-	uint8_t  axiBusyFlag = true;
-	/* axi halt command. */
-	msm_camera_io_w(AXI_HALT,
-		axi_ctrl->share_ctrl->vfebase + VFE_AXI_CMD);
-	wmb();
-	while (axiBusyFlag) {
-		if (msm_camera_io_r(
-			axi_ctrl->share_ctrl->vfebase + VFE_AXI_STATUS) & 0x1)
-			axiBusyFlag = false;
-	}
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(AXI_HALT_CLEAR,
-		axi_ctrl->share_ctrl->vfebase + VFE_AXI_CMD);
-
-	/* after axi halt, then ok to apply global reset. */
-	/* enable reset_ack and async timer interrupt only while
-	stopping the pipeline.*/
-	msm_camera_io_w(0xf0000000,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_0);
-	msm_camera_io_w(VFE_IMASK_WHILE_STOPPING_1,
-		axi_ctrl->share_ctrl->vfebase + VFE_IRQ_MASK_1);
-
-	/* Ensure the write order while writing
-	to the command register using the barrier */
-	msm_camera_io_w_mb(VFE_RESET_UPON_STOP_CMD,
-		axi_ctrl->share_ctrl->vfebase + VFE_GLOBAL_RESET);
-}
-
-static int vfe40_config_axi(
-	struct axi_ctrl_t *axi_ctrl, int mode, uint32_t *ao)
-{
-	uint32_t *ch_info;
-	uint32_t *axi_cfg = ao;
-
-	/* Update the corresponding write masters for each output*/
-	ch_info = axi_cfg + V40_AXI_CFG_LEN;
-	axi_ctrl->share_ctrl->outpath.out0.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out0.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out0.ch2 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out0.image_mode =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out1.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out1.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out1.ch2 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out1.image_mode =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out2.ch0 = 0x0000FFFF & *ch_info;
-	axi_ctrl->share_ctrl->outpath.out2.ch1 =
-		0x0000FFFF & (*ch_info++ >> 16);
-	axi_ctrl->share_ctrl->outpath.out2.ch2 = 0x0000FFFF & *ch_info++;
-
-	switch (mode) {
-	case OUTPUT_PRIM:
-		axi_ctrl->share_ctrl->outpath.output_mode =
-			VFE40_OUTPUT_MODE_PRIMARY;
-		break;
-	case OUTPUT_PRIM_ALL_CHNLS:
-		axi_ctrl->share_ctrl->outpath.output_mode =
-			VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
-		break;
-	case OUTPUT_PRIM|OUTPUT_SEC:
-		axi_ctrl->share_ctrl->outpath.output_mode =
-			VFE40_OUTPUT_MODE_PRIMARY;
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_SECONDARY;
-		break;
-	case OUTPUT_PRIM|OUTPUT_SEC_ALL_CHNLS:
-		axi_ctrl->share_ctrl->outpath.output_mode =
-			VFE40_OUTPUT_MODE_PRIMARY;
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_SECONDARY_ALL_CHNLS;
-		break;
-	case OUTPUT_PRIM_ALL_CHNLS|OUTPUT_SEC:
-		axi_ctrl->share_ctrl->outpath.output_mode =
-			VFE40_OUTPUT_MODE_PRIMARY_ALL_CHNLS;
-		axi_ctrl->share_ctrl->outpath.output_mode |=
-			VFE40_OUTPUT_MODE_SECONDARY;
-		break;
-	default:
-		pr_err("%s Invalid AXI mode %d ", __func__, mode);
-		return -EINVAL;
-	}
-	msm_camera_io_w(*ao, axi_ctrl->share_ctrl->vfebase +
-		VFE_BUS_IO_FORMAT_CFG);
-	msm_camera_io_memcpy(axi_ctrl->share_ctrl->vfebase +
-		vfe40_cmd[VFE_CMD_AXI_OUT_CFG].offset, axi_cfg,
-		vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length - V40_AXI_CH_INF_LEN);
-	msm_camera_io_w(*ch_info++,
-		axi_ctrl->share_ctrl->vfebase + VFE_RDI0_CFG);
-	if (msm_camera_io_r(axi_ctrl->share_ctrl->vfebase +
-		V40_GET_HW_VERSION_OFF) ==
-		VFE40_HW_NUMBER) {
-		msm_camera_io_w(*ch_info++,
-			axi_ctrl->share_ctrl->vfebase + VFE_RDI1_CFG);
-		msm_camera_io_w(*ch_info++,
-			axi_ctrl->share_ctrl->vfebase + VFE_RDI2_CFG);
-	}
-	return 0;
-}
-
-static int msm_axi_config(struct v4l2_subdev *sd, void __user *arg)
-{
-	struct msm_vfe_cfg_cmd cfgcmd;
-	struct msm_isp_cmd vfecmd;
-	int rc = 0;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return -EFAULT;
-	}
-	if (NULL != arg) {
-		if (copy_from_user(&cfgcmd, arg, sizeof(cfgcmd))) {
-			ERR_COPY_FROM_USER();
-			return -EFAULT;
-		}
-	}
-	if (NULL != cfgcmd.value) {
-		if (copy_from_user(&vfecmd,
-				(void __user *)(cfgcmd.value),
-				sizeof(vfecmd))) {
-			pr_err("%s %d: copy_from_user failed\n", __func__,
-				__LINE__);
-			return -EFAULT;
-		}
-	}
-
-	switch (cfgcmd.cmd_type) {
-	case CMD_AXI_CFG_PRIM: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe40_config_axi(axi_ctrl, OUTPUT_PRIM, axio);
-		kfree(axio);
-	}
-		break;
-	case CMD_AXI_CFG_PRIM_ALL_CHNLS: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe40_config_axi(axi_ctrl, OUTPUT_PRIM_ALL_CHNLS, axio);
-		kfree(axio);
-	}
-		break;
-	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe40_config_axi(axi_ctrl, OUTPUT_PRIM|OUTPUT_SEC, axio);
-		kfree(axio);
-	}
-		break;
-	case CMD_AXI_CFG_PRIM|CMD_AXI_CFG_SEC_ALL_CHNLS: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe40_config_axi(axi_ctrl,
-			OUTPUT_PRIM|OUTPUT_SEC_ALL_CHNLS, axio);
-		kfree(axio);
-	}
-		break;
-	case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC: {
-		uint32_t *axio = NULL;
-		axio = kmalloc(vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length,
-				GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			break;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd.value),
-				vfe40_cmd[VFE_CMD_AXI_OUT_CFG].length)) {
-			kfree(axio);
-			rc = -EFAULT;
-			break;
-		}
-		vfe40_config_axi(axi_ctrl,
-			OUTPUT_PRIM_ALL_CHNLS|OUTPUT_SEC, axio);
-		kfree(axio);
-	}
-		break;
-	case CMD_AXI_CFG_PRIM_ALL_CHNLS|CMD_AXI_CFG_SEC_ALL_CHNLS:
-		pr_err("%s Invalid/Unsupported AXI configuration %x",
-			__func__, cfgcmd.cmd_type);
-		break;
-	case CMD_AXI_START:
-		axi_start(axi_ctrl);
-		break;
-	case CMD_AXI_STOP:
-		axi_stop(axi_ctrl);
-		break;
-	case CMD_AXI_RESET:
-		break;
-	default:
-		pr_err("%s Unsupported AXI configuration %x ", __func__,
-			cfgcmd.cmd_type);
-		break;
-	}
-	return rc;
-}
-
-static struct msm_free_buf *vfe40_check_free_buffer(
-	int id, int path, struct axi_ctrl_t *axi_ctrl)
-{
-	struct vfe40_output_ch *outch = NULL;
-	struct msm_free_buf *b = NULL;
-	uint32_t image_mode = 0;
-
-	if (path == VFE_MSG_OUTPUT_PRIMARY)
-		image_mode = axi_ctrl->share_ctrl->outpath.out0.image_mode;
-	else
-		image_mode = axi_ctrl->share_ctrl->outpath.out1.image_mode;
-
-	vfe40_subdev_notify(id, path, image_mode,
-		&axi_ctrl->subdev, axi_ctrl->share_ctrl);
-	outch = vfe40_get_ch(path, axi_ctrl->share_ctrl);
-	if (outch->free_buf.ch_paddr[0])
-		b = &outch->free_buf;
-	return b;
-}
-
-static void vfe_send_outmsg(
-	struct axi_ctrl_t *axi_ctrl, uint8_t msgid,
-	uint32_t ch0_paddr, uint32_t ch1_paddr,
-	uint32_t ch2_paddr, uint32_t image_mode)
-{
-	struct isp_msg_output msg;
-
-	msg.output_id = msgid;
-	msg.buf.image_mode = image_mode;
-	msg.buf.ch_paddr[0]	= ch0_paddr;
-	msg.buf.ch_paddr[1]	= ch1_paddr;
-	msg.buf.ch_paddr[2]	= ch2_paddr;
-	msg.frameCounter = axi_ctrl->share_ctrl->vfeFrameId;
-
-	v4l2_subdev_notify(&axi_ctrl->subdev,
-			NOTIFY_VFE_MSG_OUT,
-			&msg);
-	return;
-}
-
-static void vfe40_process_output_path_irq_0(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr, ch1_paddr, ch2_paddr;
-	uint8_t out_bool = 0;
-	struct msm_free_buf *free_buf = NULL;
-
-	free_buf = vfe40_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-		VFE_MSG_OUTPUT_PRIMARY, axi_ctrl);
-
-	/* we render frames in the following conditions:
-	1. Continuous mode and the free buffer is avaialable.
-	2. In snapshot shot mode, free buffer is not always available.
-	when pending snapshot count is <=1,  then no need to use
-	free buffer.
-	*/
-	out_bool = (
-		(axi_ctrl->share_ctrl->operation_mode ==
-			VFE_OUTPUTS_THUMB_AND_MAIN ||
-		axi_ctrl->share_ctrl->operation_mode ==
-			VFE_OUTPUTS_MAIN_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode ==
-			VFE_OUTPUTS_THUMB_AND_JPEG ||
-		axi_ctrl->share_ctrl->operation_mode ==
-			VFE_OUTPUTS_JPEG_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode ==
-			VFE_OUTPUTS_RAW ||
-		axi_ctrl->share_ctrl->liveshot_state ==
-			VFE_STATE_STARTED ||
-		axi_ctrl->share_ctrl->liveshot_state ==
-			VFE_STATE_STOP_REQUESTED ||
-		axi_ctrl->share_ctrl->liveshot_state ==
-			VFE_STATE_STOPPED) &&
-		(axi_ctrl->share_ctrl->vfe_capture_count <= 1)) ||
-			free_buf;
-
-	if (out_bool) {
-		ping_pong = msm_camera_io_r(axi_ctrl->share_ctrl->vfebase +
-			VFE_BUS_PING_PONG_STATUS);
-
-		/* Channel 0*/
-		ch0_paddr = vfe40_get_ch_addr(
-			ping_pong, axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch0);
-		/* Channel 1*/
-		ch1_paddr = vfe40_get_ch_addr(
-			ping_pong, axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch1);
-		/* Channel 2*/
-		ch2_paddr = vfe40_get_ch_addr(
-			ping_pong, axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch2);
-
-		CDBG("output path 0, ch0 = 0x%x, ch1 = 0x%x, ch2 = 0x%x\n",
-			ch0_paddr, ch1_paddr, ch2_paddr);
-		if (free_buf) {
-			/* Y channel */
-			vfe40_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch0,
-			free_buf->ch_paddr[0]);
-			/* Chroma channel */
-			vfe40_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out0.ch1,
-			free_buf->ch_paddr[1]);
-			if (free_buf->num_planes > 2)
-				vfe40_put_ch_addr(ping_pong,
-					axi_ctrl->share_ctrl->vfebase,
-					axi_ctrl->share_ctrl->outpath.out0.ch2,
-					free_buf->ch_paddr[2]);
-		}
-		if (axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_THUMB_AND_JPEG ||
-			axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_JPEG_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_RAW ||
-			axi_ctrl->share_ctrl->liveshot_state ==
-				VFE_STATE_STOPPED)
-			axi_ctrl->share_ctrl->outpath.out0.capture_cnt--;
-
-		vfe_send_outmsg(axi_ctrl,
-			MSG_ID_OUTPUT_PRIMARY, ch0_paddr,
-			ch1_paddr, ch2_paddr,
-			axi_ctrl->share_ctrl->outpath.out0.image_mode);
-
-		if (axi_ctrl->share_ctrl->liveshot_state == VFE_STATE_STOPPED)
-			axi_ctrl->share_ctrl->liveshot_state = VFE_STATE_IDLE;
-
-	} else {
-		axi_ctrl->share_ctrl->outpath.out0.frame_drop_cnt++;
-		CDBG("path_irq_0 - no free buffer!\n");
-	}
-}
-
-static void vfe40_process_output_path_irq_1(
-	struct axi_ctrl_t *axi_ctrl)
-{
-	uint32_t ping_pong;
-	uint32_t ch0_paddr, ch1_paddr, ch2_paddr;
-	/* this must be snapshot main image output. */
-	uint8_t out_bool = 0;
-	struct msm_free_buf *free_buf = NULL;
-
-	free_buf = vfe40_check_free_buffer(VFE_MSG_OUTPUT_IRQ,
-		VFE_MSG_OUTPUT_SECONDARY, axi_ctrl);
-	out_bool = ((axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_RAW ||
-			axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_JPEG_AND_THUMB) &&
-			(axi_ctrl->share_ctrl->vfe_capture_count <= 1)) ||
-				free_buf;
-
-	if (out_bool) {
-		ping_pong = msm_camera_io_r(axi_ctrl->share_ctrl->vfebase +
-			VFE_BUS_PING_PONG_STATUS);
-
-		/* Y channel */
-		ch0_paddr = vfe40_get_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch0);
-		/* Chroma channel */
-		ch1_paddr = vfe40_get_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch1);
-		ch2_paddr = vfe40_get_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch2);
-
-		CDBG("%s ch0 = 0x%x, ch1 = 0x%x, ch2 = 0x%x\n",
-			__func__, ch0_paddr, ch1_paddr, ch2_paddr);
-		if (free_buf) {
-			/* Y channel */
-			vfe40_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch0,
-			free_buf->ch_paddr[0]);
-			/* Chroma channel */
-			vfe40_put_ch_addr(ping_pong,
-			axi_ctrl->share_ctrl->vfebase,
-			axi_ctrl->share_ctrl->outpath.out1.ch1,
-			free_buf->ch_paddr[1]);
-			if (free_buf->num_planes > 2)
-				vfe40_put_ch_addr(ping_pong,
-					axi_ctrl->share_ctrl->vfebase,
-					axi_ctrl->share_ctrl->outpath.out1.ch2,
-					free_buf->ch_paddr[2]);
-		}
-		if (axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_THUMB_AND_MAIN ||
-			axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_MAIN_AND_THUMB ||
-			axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_RAW ||
-			axi_ctrl->share_ctrl->operation_mode ==
-				VFE_OUTPUTS_JPEG_AND_THUMB)
-			axi_ctrl->share_ctrl->outpath.out1.capture_cnt--;
-
-		vfe_send_outmsg(axi_ctrl,
-			MSG_ID_OUTPUT_SECONDARY, ch0_paddr,
-			ch1_paddr, ch2_paddr,
-			axi_ctrl->share_ctrl->outpath.out1.image_mode);
-
-	} else {
-		axi_ctrl->share_ctrl->outpath.out1.frame_drop_cnt++;
-		CDBG("path_irq_1 - no free buffer!\n");
-	}
-}
-
-static void msm_axi_process_irq(struct v4l2_subdev *sd, void *arg)
-{
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	uint32_t irqstatus = (uint32_t) arg;
-
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return;
-	}
-	/* next, check output path related interrupts. */
-	if (irqstatus &
-		VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE0_MASK) {
-		CDBG("Image composite done 0 irq occured.\n");
-		vfe40_process_output_path_irq_0(axi_ctrl);
-	}
-	if (irqstatus &
-		VFE_IRQ_STATUS0_IMAGE_COMPOSIT_DONE1_MASK) {
-		CDBG("Image composite done 1 irq occured.\n");
-		vfe40_process_output_path_irq_1(axi_ctrl);
-	}
-	/* in snapshot mode if done then send
-	snapshot done message */
-	if (axi_ctrl->share_ctrl->operation_mode ==
-			VFE_OUTPUTS_THUMB_AND_MAIN ||
-		axi_ctrl->share_ctrl->operation_mode ==
-			VFE_OUTPUTS_MAIN_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode ==
-			VFE_OUTPUTS_THUMB_AND_JPEG ||
-		axi_ctrl->share_ctrl->operation_mode ==
-			VFE_OUTPUTS_JPEG_AND_THUMB ||
-		axi_ctrl->share_ctrl->operation_mode ==
-			VFE_OUTPUTS_RAW) {
-		if ((axi_ctrl->share_ctrl->outpath.out0.capture_cnt == 0)
-				&& (axi_ctrl->share_ctrl->outpath.out1.
-				capture_cnt == 0)) {
-			msm_camera_io_w_mb(
-				CAMIF_COMMAND_STOP_IMMEDIATELY,
-				axi_ctrl->share_ctrl->vfebase +
-				VFE_CAMIF_COMMAND);
-			vfe40_send_isp_msg(&axi_ctrl->subdev,
-				axi_ctrl->share_ctrl->vfeFrameId,
-				MSG_ID_SNAPSHOT_DONE);
-		}
-	}
-}
-
-static int msm_axi_buf_cfg(struct v4l2_subdev *sd, void __user *arg)
-{
-	struct msm_camvfe_params *vfe_params =
-		(struct msm_camvfe_params *)arg;
-	struct msm_vfe_cfg_cmd *cmd = vfe_params->vfe_cfg;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	void *data = vfe_params->data;
-	int rc = 0;
-
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return -EFAULT;
-	}
-
-	switch (cmd->cmd_type) {
-	case CMD_CONFIG_PING_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe40_output_ch *outch =
-			vfe40_get_ch(path, axi_ctrl->share_ctrl);
-		outch->ping = *((struct msm_free_buf *)data);
-	}
-		break;
-
-	case CMD_CONFIG_PONG_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe40_output_ch *outch =
-			vfe40_get_ch(path, axi_ctrl->share_ctrl);
-		outch->pong = *((struct msm_free_buf *)data);
-	}
-		break;
-
-	case CMD_CONFIG_FREE_BUF_ADDR: {
-		int path = *((int *)cmd->value);
-		struct vfe40_output_ch *outch =
-			vfe40_get_ch(path, axi_ctrl->share_ctrl);
-		outch->free_buf = *((struct msm_free_buf *)data);
-	}
-		break;
-	default:
-		pr_err("%s Unsupported AXI Buf config %x ", __func__,
-			cmd->cmd_type);
-	}
-	return rc;
-};
-
-static struct msm_cam_clk_info vfe40_clk_info[] = {
-	{"vfe_clk_src", 266670000},
-	{"camss_vfe_vfe_clk", -1},
-	{"camss_csi_vfe_clk", -1},
-	{"top_clk", -1},
-	{"iface_clk", -1},
-	{"bus_clk", -1},
-};
-
-int msm_axi_subdev_init(struct v4l2_subdev *sd,
-			struct msm_cam_media_controller *mctl)
-{
-	int rc = 0;
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	v4l2_set_subdev_hostdata(sd, mctl);
-	spin_lock_init(&axi_ctrl->tasklet_lock);
-	INIT_LIST_HEAD(&axi_ctrl->tasklet_q);
-	spin_lock_init(&axi_ctrl->share_ctrl->sd_notify_lock);
-
-	axi_ctrl->share_ctrl->vfebase = ioremap(axi_ctrl->vfemem->start,
-		resource_size(axi_ctrl->vfemem));
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		rc = -ENOMEM;
-		pr_err("%s: vfe ioremap failed\n", __func__);
-		goto remap_failed;
-	}
-
-	if (axi_ctrl->fs_vfe == NULL) {
-		axi_ctrl->fs_vfe =
-			regulator_get(&axi_ctrl->pdev->dev, "vdd");
-		if (IS_ERR(axi_ctrl->fs_vfe)) {
-			pr_err("%s: Regulator FS_VFE get failed %ld\n",
-				__func__, PTR_ERR(axi_ctrl->fs_vfe));
-			axi_ctrl->fs_vfe = NULL;
-			goto fs_failed;
-		} else if (regulator_enable(axi_ctrl->fs_vfe)) {
-			pr_err("%s: Regulator FS_VFE enable failed\n",
-							__func__);
-			regulator_put(axi_ctrl->fs_vfe);
-			axi_ctrl->fs_vfe = NULL;
-			goto fs_failed;
-		}
-	}
-	rc = msm_cam_clk_enable(&axi_ctrl->pdev->dev, vfe40_clk_info,
-			axi_ctrl->vfe_clk, ARRAY_SIZE(vfe40_clk_info), 1);
-	if (rc < 0)
-			goto clk_enable_failed;
-
-	msm_camio_bus_scale_cfg(
-		mctl->sdata->pdata->cam_bus_scale_table, S_INIT);
-	msm_camio_bus_scale_cfg(
-		mctl->sdata->pdata->cam_bus_scale_table, S_PREVIEW);
-
-	axi_ctrl->share_ctrl->register_total = VFE40_REGISTER_TOTAL;
-
-	enable_irq(axi_ctrl->vfeirq->start);
-
-	return rc;
-clk_enable_failed:
-	regulator_disable(axi_ctrl->fs_vfe);
-	regulator_put(axi_ctrl->fs_vfe);
-	axi_ctrl->fs_vfe = NULL;
-fs_failed:
-	iounmap(axi_ctrl->share_ctrl->vfebase);
-	axi_ctrl->share_ctrl->vfebase = NULL;
-remap_failed:
-	disable_irq(axi_ctrl->vfeirq->start);
-	return rc;
-}
-
-void msm_axi_subdev_release(struct v4l2_subdev *sd)
-{
-	struct msm_cam_media_controller *pmctl =
-		(struct msm_cam_media_controller *)v4l2_get_subdev_hostdata(sd);
-	struct axi_ctrl_t *axi_ctrl = v4l2_get_subdevdata(sd);
-	if (!axi_ctrl->share_ctrl->vfebase) {
-		pr_err("%s: base address unmapped\n", __func__);
-		return;
-	}
-
-	CDBG("%s, free_irq\n", __func__);
-	disable_irq(axi_ctrl->vfeirq->start);
-	tasklet_kill(&axi_ctrl->vfe40_tasklet);
-	msm_cam_clk_enable(&axi_ctrl->pdev->dev, vfe40_clk_info,
-		axi_ctrl->vfe_clk, ARRAY_SIZE(vfe40_clk_info), 0);
-
-	if (axi_ctrl->fs_vfe) {
-		regulator_disable(axi_ctrl->fs_vfe);
-		regulator_put(axi_ctrl->fs_vfe);
-		axi_ctrl->fs_vfe = NULL;
-	}
-	iounmap(axi_ctrl->share_ctrl->vfebase);
-	axi_ctrl->share_ctrl->vfebase = NULL;
-
-	if (atomic_read(&axi_ctrl->share_ctrl->irq_cnt))
-		pr_warning("%s, Warning IRQ Count not ZERO\n", __func__);
-
-	msm_camio_bus_scale_cfg(
-		pmctl->sdata->pdata->cam_bus_scale_table, S_EXIT);
-}
-
-static long msm_axi_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int cmd, void *arg)
-{
-	int rc = -ENOIOCTLCMD;
-	switch (cmd) {
-	case VIDIOC_MSM_AXI_INIT:
-		rc = msm_axi_subdev_init(sd,
-			(struct msm_cam_media_controller *)arg);
-		break;
-	case VIDIOC_MSM_AXI_CFG:
-		rc = msm_axi_config(sd, arg);
-		break;
-	case VIDIOC_MSM_AXI_IRQ:
-		msm_axi_process_irq(sd, arg);
-		rc = 0;
-		break;
-	case VIDIOC_MSM_AXI_BUF_CFG:
-		msm_axi_buf_cfg(sd, arg);
-		rc = 0;
-		break;
-	case VIDIOC_MSM_AXI_RELEASE:
-		msm_axi_subdev_release(sd);
-		rc = 0;
-		break;
-	default:
-		pr_err("%s: command not found\n", __func__);
-	}
-	return rc;
-}
-
-static const struct v4l2_subdev_core_ops msm_axi_subdev_core_ops = {
-	.ioctl = msm_axi_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_video_ops msm_axi_subdev_video_ops = {
-	.s_crystal_freq = msm_axi_subdev_s_crystal_freq,
-};
-
-static const struct v4l2_subdev_ops msm_axi_subdev_ops = {
-	.core = &msm_axi_subdev_core_ops,
-	.video = &msm_axi_subdev_video_ops,
-};
-
-static const struct v4l2_subdev_internal_ops msm_axi_internal_ops;
-
-void vfe40_axi_probe(struct axi_ctrl_t *axi_ctrl)
-{
-	struct msm_cam_subdev_info sd_info;
-	v4l2_subdev_init(&axi_ctrl->subdev, &msm_axi_subdev_ops);
-	axi_ctrl->subdev.internal_ops = &msm_axi_internal_ops;
-	axi_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(axi_ctrl->subdev.name,
-			 sizeof(axi_ctrl->subdev.name), "axi");
-	v4l2_set_subdevdata(&axi_ctrl->subdev, axi_ctrl);
-
-	sd_info.sdev_type = AXI_DEV;
-	sd_info.sd_index = axi_ctrl->pdev->id;
-	sd_info.irq_num = 0;
-	msm_cam_register_subdev_node(&axi_ctrl->subdev, &sd_info);
-}
diff --git a/drivers/media/video/msm/vfe/msm_vfe7x.c b/drivers/media/video/msm/vfe/msm_vfe7x.c
deleted file mode 100644
index bbf9d1b..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe7x.c
+++ /dev/null
@@ -1,786 +0,0 @@
-/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/msm_adsp.h>
-#include <linux/uaccess.h>
-#include <linux/fs.h>
-#include <linux/android_pmem.h>
-#include <linux/slab.h>
-#include <mach/msm_adsp.h>
-#include <mach/clk.h>
-#include <linux/delay.h>
-#include <linux/wait.h>
-#include "msm_vfe7x.h"
-#include <linux/pm_qos.h>
-
-#define QDSP_CMDQUEUE 25
-
-#define VFE_RESET_CMD 0
-#define VFE_START_CMD 1
-#define VFE_STOP_CMD  2
-#define VFE_FRAME_ACK 20
-#define STATS_AF_ACK  21
-#define STATS_WE_ACK  22
-
-#define MSG_STOP_ACK  1
-#define MSG_SNAPSHOT  2
-#define MSG_OUTPUT1   6
-#define MSG_OUTPUT2   7
-#define MSG_STATS_AF  8
-#define MSG_STATS_WE  9
-#define MSG_OUTPUT_S  10
-#define MSG_OUTPUT_T  11
-
-#define VFE_ADSP_EVENT 0xFFFF
-#define SNAPSHOT_MASK_MODE 0x00000002
-#define MSM_AXI_QOS_PREVIEW	192000
-#define MSM_AXI_QOS_SNAPSHOT	192000
-
-
-static struct msm_adsp_module *qcam_mod;
-static struct msm_adsp_module *vfe_mod;
-static struct msm_vfe_callback *resp;
-static void *extdata;
-static uint32_t extlen;
-
-struct mutex vfe_lock;
-static void     *vfe_syncdata;
-static uint8_t vfestopped;
-static uint32_t vfetask_state;
-static int cnt;
-
-static struct stop_event stopevent;
-
-unsigned long paddr_s_y;
-unsigned long paddr_s_cbcr;
-unsigned long paddr_t_y;
-unsigned long paddr_t_cbcr;
-
-static void vfe_7x_convert(struct msm_vfe_phy_info *pinfo,
-		enum vfe_resp_msg type,
-		void *data, void **ext, int32_t *elen)
-{
-	switch (type) {
-	case VFE_MSG_OUTPUT_P: {
-		pinfo->p0_phy = ((struct vfe_endframe *)data)->y_address;
-		pinfo->p1_phy =
-			((struct vfe_endframe *)data)->cbcr_address;
-		pinfo->p2_phy = pinfo->p0_phy;
-		pinfo->output_id = OUTPUT_TYPE_P;
-
-		CDBG("vfe_7x_convert, y_phy = 0x%x, cbcr_phy = 0x%x\n",
-				 pinfo->p0_phy, pinfo->p1_phy);
-
-		((struct vfe_frame_extra *)extdata)->bl_evencol =
-		((struct vfe_endframe *)data)->blacklevelevencolumn;
-
-		((struct vfe_frame_extra *)extdata)->bl_oddcol =
-		((struct vfe_endframe *)data)->blackleveloddcolumn;
-
-		((struct vfe_frame_extra *)extdata)->g_def_p_cnt =
-		((struct vfe_endframe *)data)->greendefectpixelcount;
-
-		((struct vfe_frame_extra *)extdata)->r_b_def_p_cnt =
-		((struct vfe_endframe *)data)->redbluedefectpixelcount;
-
-		*ext  = extdata;
-		*elen = extlen;
-	}
-		break;
-
-	case VFE_MSG_OUTPUT_S: {
-		pinfo->p0_phy = paddr_s_y;
-		pinfo->p1_phy = paddr_s_cbcr;
-		pinfo->p2_phy = pinfo->p0_phy;
-		pinfo->output_id = OUTPUT_TYPE_S;
-		CDBG("vfe_7x_convert: y_phy = 0x%x cbcr_phy = 0x%x\n",
-					pinfo->p0_phy, pinfo->p1_phy);
-	}
-		break;
-
-	case VFE_MSG_OUTPUT_T: {
-		pinfo->p0_phy = paddr_t_y;
-		pinfo->p1_phy = paddr_t_cbcr;
-		pinfo->p2_phy = pinfo->p0_phy;
-		pinfo->output_id = OUTPUT_TYPE_T;
-		CDBG("vfe_7x_convert: y_phy = 0x%x cbcr_phy = 0x%x\n",
-					pinfo->p0_phy, pinfo->p1_phy);
-	}
-		break;
-
-	case VFE_MSG_STATS_AF:
-	case VFE_MSG_STATS_WE:
-		pinfo->sbuf_phy = *(uint32_t *)data;
-		break;
-
-	default:
-		break;
-	} /* switch */
-}
-
-static void vfe_7x_ops(void *driver_data, unsigned id, size_t len,
-		void (*getevent)(void *ptr, size_t len))
-{
-	uint32_t evt_buf[3];
-	struct msm_vfe_resp *rp;
-	void *data;
-	CDBG("%s:id=%d\n", __func__, id);
-
-	len = (id == VFE_ADSP_EVENT) ? 0 : len;
-	data = resp->vfe_alloc(sizeof(struct msm_vfe_resp) + len,
-		vfe_syncdata,  GFP_ATOMIC);
-
-	if (!data) {
-		pr_err("%s: rp: cannot allocate buffer\n", __func__);
-		return;
-	}
-	rp = (struct msm_vfe_resp *)data;
-	rp->evt_msg.len = len;
-
-	if (id == VFE_ADSP_EVENT) {
-		/* event */
-		rp->type           = VFE_EVENT;
-		rp->evt_msg.type   = MSM_CAMERA_EVT;
-		getevent(evt_buf, sizeof(evt_buf));
-		rp->evt_msg.msg_id = evt_buf[0];
-	CDBG("%s:event:msg_id=%d\n", __func__, rp->evt_msg.msg_id);
-		resp->vfe_resp(rp, MSM_CAM_Q_VFE_EVT, vfe_syncdata,
-		GFP_ATOMIC);
-	} else {
-		/* messages */
-		rp->evt_msg.type   = MSM_CAMERA_MSG;
-		rp->evt_msg.msg_id = id;
-		rp->evt_msg.data = rp + 1;
-		getevent(rp->evt_msg.data, len);
-	CDBG("%s:messages:msg_id=%d\n", __func__, rp->evt_msg.msg_id);
-
-		switch (rp->evt_msg.msg_id) {
-		case MSG_SNAPSHOT:
-			update_axi_qos(MSM_AXI_QOS_PREVIEW);
-			vfe_7x_ops(driver_data, MSG_OUTPUT_S, len, getevent);
-			vfe_7x_ops(driver_data, MSG_OUTPUT_T, len, getevent);
-			rp->type = VFE_MSG_SNAPSHOT;
-			break;
-
-		case MSG_OUTPUT_S:
-			rp->type = VFE_MSG_OUTPUT_S;
-			vfe_7x_convert(&(rp->phy), VFE_MSG_OUTPUT_S,
-				rp->evt_msg.data, &(rp->extdata),
-				&(rp->extlen));
-			break;
-
-		case MSG_OUTPUT_T:
-			rp->type = VFE_MSG_OUTPUT_T;
-			vfe_7x_convert(&(rp->phy), VFE_MSG_OUTPUT_T,
-				rp->evt_msg.data, &(rp->extdata),
-				&(rp->extlen));
-			break;
-
-		case MSG_OUTPUT1:
-		case MSG_OUTPUT2:
-			rp->type = VFE_MSG_OUTPUT_P;
-			vfe_7x_convert(&(rp->phy), VFE_MSG_OUTPUT_P,
-				rp->evt_msg.data, &(rp->extdata),
-				&(rp->extlen));
-			break;
-
-		case MSG_STATS_AF:
-			rp->type = VFE_MSG_STATS_AF;
-			vfe_7x_convert(&(rp->phy), VFE_MSG_STATS_AF,
-					rp->evt_msg.data, NULL, NULL);
-			break;
-
-		case MSG_STATS_WE:
-			rp->type = VFE_MSG_STATS_WE;
-			vfe_7x_convert(&(rp->phy), VFE_MSG_STATS_WE,
-					rp->evt_msg.data, NULL, NULL);
-
-			CDBG("MSG_STATS_WE: phy = 0x%x\n", rp->phy.sbuf_phy);
-			break;
-
-		case MSG_STOP_ACK:
-			rp->type = VFE_MSG_GENERAL;
-			stopevent.state = 1;
-			wake_up(&stopevent.wait);
-			break;
-
-
-		default:
-			rp->type = VFE_MSG_GENERAL;
-			break;
-		}
-		resp->vfe_resp(rp, MSM_CAM_Q_VFE_MSG, vfe_syncdata, GFP_ATOMIC);
-	}
-}
-
-static struct msm_adsp_ops vfe_7x_sync = {
-	.event = vfe_7x_ops,
-};
-
-static int vfe_7x_enable(struct camera_enable_cmd *enable)
-{
-	int rc = -EFAULT;
-
-	if (!strcmp(enable->name, "QCAMTASK"))
-		rc = msm_adsp_enable(qcam_mod);
-	else if (!strcmp(enable->name, "VFETASK")) {
-		rc = msm_adsp_enable(vfe_mod);
-		vfetask_state = 1;
-	}
-
-	if (!cnt) {
-		add_axi_qos();
-		cnt++;
-	}
-	return rc;
-}
-
-static int vfe_7x_disable(struct camera_enable_cmd *enable,
-		struct platform_device *dev __attribute__((unused)))
-{
-	int rc = -EFAULT;
-
-	if (!strcmp(enable->name, "QCAMTASK"))
-		rc = msm_adsp_disable(qcam_mod);
-	else if (!strcmp(enable->name, "VFETASK")) {
-		rc = msm_adsp_disable(vfe_mod);
-		vfetask_state = 0;
-	}
-
-	return rc;
-}
-
-static int vfe_7x_stop(void)
-{
-	int rc = 0;
-	uint32_t stopcmd = VFE_STOP_CMD;
-	rc = msm_adsp_write(vfe_mod, QDSP_CMDQUEUE,
-				&stopcmd, sizeof(uint32_t));
-	if (rc < 0) {
-		CDBG("%s:%d: failed rc = %d \n", __func__, __LINE__, rc);
-		return rc;
-	}
-
-	stopevent.state = 0;
-	rc = wait_event_timeout(stopevent.wait,
-		stopevent.state != 0,
-		msecs_to_jiffies(stopevent.timeout));
-
-	return rc;
-}
-
-static void vfe_7x_release(struct platform_device *pdev)
-{
-	mutex_lock(&vfe_lock);
-	vfe_syncdata = NULL;
-	mutex_unlock(&vfe_lock);
-
-	if (!vfestopped) {
-		CDBG("%s:%d:Calling vfe_7x_stop()\n", __func__, __LINE__);
-		vfe_7x_stop();
-	} else
-		vfestopped = 0;
-
-	msm_adsp_disable(qcam_mod);
-	msm_adsp_disable(vfe_mod);
-	vfetask_state = 0;
-
-	msm_adsp_put(qcam_mod);
-	msm_adsp_put(vfe_mod);
-
-	msm_camio_disable(pdev);
-
-	kfree(extdata);
-	extlen = 0;
-
-	/* Release AXI */
-	release_axi_qos();
-	cnt = 0;
-}
-
-static int vfe_7x_init(struct msm_vfe_callback *presp,
-	struct platform_device *dev)
-{
-	int rc = 0;
-
-	init_waitqueue_head(&stopevent.wait);
-	stopevent.timeout = 200;
-	stopevent.state = 0;
-
-	if (presp && presp->vfe_resp)
-		resp = presp;
-	else
-		return -EFAULT;
-
-	/* Bring up all the required GPIOs and Clocks */
-	rc = msm_camio_enable(dev);
-	if (rc < 0)
-		return rc;
-	msm_camio_camif_pad_reg_reset();
-
-	extlen = sizeof(struct vfe_frame_extra);
-
-	extdata =
-		kmalloc(extlen, GFP_ATOMIC);
-	if (!extdata) {
-		rc = -ENOMEM;
-		goto init_fail;
-	}
-
-	rc = msm_adsp_get("QCAMTASK", &qcam_mod, &vfe_7x_sync, NULL);
-	if (rc) {
-		rc = -EBUSY;
-		goto get_qcam_fail;
-	}
-
-	rc = msm_adsp_get("VFETASK", &vfe_mod, &vfe_7x_sync, NULL);
-	if (rc) {
-		rc = -EBUSY;
-		goto get_vfe_fail;
-	}
-
-	return 0;
-
-get_vfe_fail:
-	msm_adsp_put(qcam_mod);
-get_qcam_fail:
-	kfree(extdata);
-init_fail:
-	extlen = 0;
-	return rc;
-}
-
-static int vfe_7x_config_axi(int mode,
-	struct axidata *ad, struct axiout *ao)
-{
-	struct msm_pmem_region *regptr;
-	unsigned long *bptr;
-	int    cnt;
-
-	int rc = 0;
-
-	if (mode == OUTPUT_1 || mode == OUTPUT_1_AND_2) {
-		regptr = ad->region;
-
-		CDBG("bufnum1 = %d\n", ad->bufnum1);
-		if (mode == OUTPUT_1_AND_2) {
-			paddr_t_y = regptr->paddr + regptr->info.planar0_off;
-			paddr_t_cbcr = regptr->paddr + regptr->info.planar1_off;
-		}
-
-		CDBG("config_axi1: O1, phy = 0x%lx, y_off = %d, cbcr_off =%d\n",
-			regptr->paddr, regptr->info.planar0_off,
-			regptr->info.planar1_off);
-
-		bptr = &ao->output1buffer1_y_phy;
-		for (cnt = 0; cnt < ad->bufnum1; cnt++) {
-			*bptr = regptr->paddr + regptr->info.planar0_off;
-			bptr++;
-			*bptr = regptr->paddr + regptr->info.planar1_off;
-
-			bptr++;
-			regptr++;
-		}
-
-		regptr--;
-		for (cnt = 0; cnt < (8 - ad->bufnum1); cnt++) {
-			*bptr = regptr->paddr + regptr->info.planar0_off;
-			bptr++;
-			*bptr = regptr->paddr + regptr->info.planar1_off;
-			bptr++;
-		}
-	} /* if OUTPUT1 or Both */
-
-	if (mode == OUTPUT_2 || mode == OUTPUT_1_AND_2) {
-		regptr = &(ad->region[ad->bufnum1]);
-
-		CDBG("bufnum2 = %d\n", ad->bufnum2);
-		paddr_s_y = regptr->paddr +  regptr->info.planar0_off;
-		paddr_s_cbcr = regptr->paddr +  regptr->info.planar1_off;
-		CDBG("config_axi2: O2, phy = 0x%lx, y_off = %d, cbcr_off =%d\n",
-			regptr->paddr, regptr->info.planar0_off,
-			regptr->info.planar1_off);
-
-		bptr = &ao->output2buffer1_y_phy;
-		for (cnt = 0; cnt < ad->bufnum2; cnt++) {
-			*bptr = regptr->paddr + regptr->info.planar0_off;
-			bptr++;
-			*bptr = regptr->paddr + regptr->info.planar1_off;
-
-			bptr++;
-			regptr++;
-		}
-
-		regptr--;
-		for (cnt = 0; cnt < (8 - ad->bufnum2); cnt++) {
-			*bptr = regptr->paddr + regptr->info.planar0_off;
-			bptr++;
-			*bptr = regptr->paddr + regptr->info.planar1_off;
-			bptr++;
-		}
-	}
-
-	return rc;
-}
-
-static int vfe_7x_config(struct msm_vfe_cfg_cmd *cmd, void *data)
-{
-	struct msm_pmem_region *regptr;
-	unsigned char buf[256];
-
-	struct vfe_stats_ack sack;
-	struct axidata *axid;
-	uint32_t i, op_mode;
-	uint32_t *_mode;
-
-	struct vfe_stats_we_cfg *scfg = NULL;
-	struct vfe_stats_af_cfg *sfcfg = NULL;
-
-	struct axiout *axio = NULL;
-	void   *cmd_data = NULL;
-	void   *cmd_data_alloc = NULL;
-	long rc = 0;
-	struct msm_vfe_command_7k *vfecmd;
-
-	vfecmd =
-			kmalloc(sizeof(struct msm_vfe_command_7k),
-				GFP_ATOMIC);
-	if (!vfecmd) {
-		pr_err("vfecmd alloc failed!\n");
-		return -ENOMEM;
-	}
-
-	if (cmd->cmd_type != CMD_FRAME_BUF_RELEASE &&
-	    cmd->cmd_type != CMD_STATS_BUF_RELEASE &&
-	    cmd->cmd_type != CMD_STATS_AF_BUF_RELEASE) {
-		if (copy_from_user(vfecmd,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_vfe_command_7k))) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-	}
-
-	switch (cmd->cmd_type) {
-	case CMD_STATS_AEC_AWB_ENABLE:
-	case CMD_STATS_AXI_CFG: {
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		scfg =
-			kmalloc(sizeof(struct vfe_stats_we_cfg),
-				GFP_ATOMIC);
-		if (!scfg) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user(scfg,
-					(void __user *)(vfecmd->value),
-					vfecmd->length)) {
-
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		CDBG("STATS_ENABLE: bufnum = %d, enabling = %d\n",
-			axid->bufnum1, scfg->wb_expstatsenable);
-
-		if (axid->bufnum1 > 0) {
-			regptr = axid->region;
-
-			for (i = 0; i < axid->bufnum1; i++) {
-
-				CDBG("STATS_ENABLE, phy = 0x%lx\n",
-					regptr->paddr);
-
-				scfg->wb_expstatoutputbuffer[i] =
-					(void *)regptr->paddr;
-				regptr++;
-			}
-
-			cmd_data = scfg;
-
-		} else {
-			rc = -EINVAL;
-			goto config_done;
-		}
-	}
-		break;
-
-	case CMD_STATS_AF_ENABLE:
-	case CMD_STATS_AF_AXI_CFG: {
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		sfcfg =
-			kmalloc(sizeof(struct vfe_stats_af_cfg),
-				GFP_ATOMIC);
-
-		if (!sfcfg) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user(sfcfg,
-					(void __user *)(vfecmd->value),
-					vfecmd->length)) {
-
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		CDBG("AF_ENABLE: bufnum = %d, enabling = %d\n",
-			axid->bufnum1, sfcfg->af_enable);
-
-		if (axid->bufnum1 > 0) {
-			regptr = &axid->region[0];
-
-			for (i = 0; i < axid->bufnum1; i++) {
-
-				CDBG("STATS_ENABLE, phy = 0x%lx\n",
-					regptr->paddr);
-
-				sfcfg->af_outbuf[i] =
-					(void *)regptr->paddr;
-
-				regptr++;
-			}
-
-			cmd_data = sfcfg;
-
-		} else {
-			rc = -EINVAL;
-			goto config_done;
-		}
-	}
-		break;
-
-	case CMD_FRAME_BUF_RELEASE: {
-		struct msm_frame *b;
-		unsigned long p;
-		struct vfe_outputack fack;
-		if (!data)  {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		b = (struct msm_frame *)(cmd->value);
-		p = *(unsigned long *)data;
-
-		fack.header = VFE_FRAME_ACK;
-
-		fack.output2newybufferaddress =
-			(void *)(p + b->planar0_off);
-
-		fack.output2newcbcrbufferaddress =
-			(void *)(p + b->planar1_off);
-
-		vfecmd->queue = QDSP_CMDQUEUE;
-		vfecmd->length = sizeof(struct vfe_outputack);
-		cmd_data = &fack;
-	}
-		break;
-
-	case CMD_SNAP_BUF_RELEASE:
-		break;
-
-	case CMD_STATS_BUF_RELEASE: {
-		CDBG("vfe_7x_config: CMD_STATS_BUF_RELEASE\n");
-		if (!data) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		sack.header = STATS_WE_ACK;
-		sack.bufaddr = (void *)*(uint32_t *)data;
-
-		vfecmd->queue  = QDSP_CMDQUEUE;
-		vfecmd->length = sizeof(struct vfe_stats_ack);
-		cmd_data = &sack;
-	}
-		break;
-
-	case CMD_STATS_AF_BUF_RELEASE: {
-		CDBG("vfe_7x_config: CMD_STATS_AF_BUF_RELEASE\n");
-		if (!data) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		sack.header = STATS_AF_ACK;
-		sack.bufaddr = (void *)*(uint32_t *)data;
-
-		vfecmd->queue  = QDSP_CMDQUEUE;
-		vfecmd->length = sizeof(struct vfe_stats_ack);
-		cmd_data = &sack;
-	}
-		break;
-
-	case CMD_GENERAL:
-	case CMD_STATS_DISABLE: {
-		if (vfecmd->length > 256) {
-			cmd_data_alloc =
-			cmd_data = kmalloc(vfecmd->length, GFP_ATOMIC);
-			if (!cmd_data) {
-				rc = -ENOMEM;
-				goto config_failure;
-			}
-		} else
-			cmd_data = buf;
-
-		if (copy_from_user(cmd_data,
-					(void __user *)(vfecmd->value),
-					vfecmd->length)) {
-
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		if (vfecmd->queue == QDSP_CMDQUEUE) {
-			switch (*(uint32_t *)cmd_data) {
-			case VFE_RESET_CMD:
-				msm_camio_vfe_blk_reset();
-				vfestopped = 0;
-				break;
-
-			case VFE_START_CMD:
-				_mode = (uint32_t *)cmd_data;
-				op_mode = *(++_mode);
-				if (op_mode & SNAPSHOT_MASK_MODE) {
-					/* request AXI bus for snapshot */
-					if (update_axi_qos(MSM_AXI_QOS_SNAPSHOT)
-						< 0) {
-						rc = -EFAULT;
-						goto config_failure;
-					}
-				} else {
-					/* request AXI bus for snapshot */
-					if (update_axi_qos(MSM_AXI_QOS_PREVIEW)
-						< 0) {
-						rc = -EFAULT;
-						goto config_failure;
-					}
-				}
-				msm_camio_camif_pad_reg_reset_2();
-				vfestopped = 0;
-				break;
-
-			case VFE_STOP_CMD:
-				vfestopped = 1;
-				goto config_send;
-
-			default:
-				break;
-			}
-		} /* QDSP_CMDQUEUE */
-	}
-		break;
-	case CMD_AXI_CFG_PREVIEW:
-	case CMD_RAW_PICT_AXI_CFG: {
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		axio = kmalloc(sizeof(struct axiout), GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd->value),
-					sizeof(struct axiout))) {
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		vfe_7x_config_axi(OUTPUT_2, axid, axio);
-		cmd_data = axio;
-	}
-		break;
-
-	case CMD_AXI_CFG_SNAP: {
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		axio = kmalloc(sizeof(struct axiout), GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd->value),
-					sizeof(struct axiout))) {
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		vfe_7x_config_axi(OUTPUT_1_AND_2, axid, axio);
-
-		cmd_data = axio;
-	}
-		break;
-
-	default:
-		break;
-	} /* switch */
-
-	if (vfestopped)
-		goto config_done;
-
-config_send:
-	CDBG("send adsp command = %d\n", *(uint32_t *)cmd_data);
-	if (vfetask_state)
-		rc = msm_adsp_write(vfe_mod, vfecmd->queue,
-					cmd_data, vfecmd->length);
-config_done:
-	if (cmd_data_alloc != NULL)
-		kfree(cmd_data_alloc);
-
-config_failure:
-	kfree(scfg);
-	kfree(axio);
-	kfree(vfecmd);
-	return rc;
-}
-
-void msm_camvfe_fn_init(struct msm_camvfe_fn *fptr, void *data)
-{
-	mutex_init(&vfe_lock);
-	fptr->vfe_init    = vfe_7x_init;
-	fptr->vfe_enable  = vfe_7x_enable;
-	fptr->vfe_config  = vfe_7x_config;
-	fptr->vfe_disable = vfe_7x_disable;
-	fptr->vfe_release = vfe_7x_release;
-	vfe_syncdata = data;
-}
-
-void msm_camvpe_fn_init(struct msm_camvpe_fn *fptr, void *data)
-{
-	fptr->vpe_reg		= NULL;
-	fptr->send_frame_to_vpe	= NULL;
-	fptr->vpe_config	= NULL;
-	fptr->vpe_cfg_update	= NULL;
-	fptr->dis		= NULL;
-}
diff --git a/drivers/media/video/msm/vfe/msm_vfe7x.h b/drivers/media/video/msm/vfe/msm_vfe7x.h
deleted file mode 100644
index 944bfea..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe7x.h
+++ /dev/null
@@ -1,265 +0,0 @@
-/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MSM_VFE7X_H__
-#define __MSM_VFE7X_H__
-#include <media/msm_camera.h>
-#include <mach/camera.h>
-
-struct vfe_frame_extra {
-	uint32_t  bl_evencol;
-	uint32_t  bl_oddcol;
-	uint16_t  g_def_p_cnt;
-	uint16_t  r_b_def_p_cnt;
-};
-
-struct vfe_endframe {
-	uint32_t      y_address;
-	uint32_t      cbcr_address;
-
-	unsigned int  blacklevelevencolumn:23;
-	uint16_t      reserved1:9;
-	unsigned int  blackleveloddcolumn:23;
-	uint16_t      reserved2:9;
-
-	uint16_t      greendefectpixelcount:8;
-	uint16_t      reserved3:8;
-	uint16_t      redbluedefectpixelcount:8;
-	uint16_t      reserved4:8;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_outputack {
-	uint32_t  header;
-	void      *output2newybufferaddress;
-	void      *output2newcbcrbufferaddress;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_stats_ack {
-	uint32_t header;
-	/* MUST BE 64 bit ALIGNED */
-	void     *bufaddr;
-} __attribute__((packed, aligned(4)));
-
-/* AXI Output Config Command sent to DSP */
-struct axiout {
-	uint32_t            cmdheader:32;
-	int 		    outputmode:3;
-	uint8_t             format:2;
-	uint32_t            /* reserved */ : 27;
-
-	/* AXI Output 1 Y Configuration, Part 1 */
-	uint32_t            out1yimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out1yimagewidthin64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 1 Y Configuration, Part 2 */
-	uint8_t             out1yburstlen:2;
-	uint32_t            out1ynumrows:12;
-	uint32_t            out1yrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 1 CbCr Configuration, Part 1 */
-	uint32_t            out1cbcrimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out1cbcrimagewidthin64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 1 CbCr Configuration, Part 2 */
-	uint8_t             out1cbcrburstlen:2;
-	uint32_t            out1cbcrnumrows:12;
-	uint32_t            out1cbcrrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 Y Configuration, Part 1 */
-	uint32_t            out2yimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out2yimagewidthin64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 Y Configuration, Part 2 */
-	uint8_t             out2yburstlen:2;
-	uint32_t            out2ynumrows:12;
-	uint32_t            out2yrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 CbCr Configuration, Part 1 */
-	uint32_t            out2cbcrimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out2cbcrimagewidtein64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 CbCr Configuration, Part 2 */
-	uint8_t             out2cbcrburstlen:2;
-	uint32_t            out2cbcrnumrows:12;
-	uint32_t            out2cbcrrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* Address configuration:
-	 * output1 phisycal address */
-	unsigned long   output1buffer1_y_phy;
-	unsigned long   output1buffer1_cbcr_phy;
-	unsigned long   output1buffer2_y_phy;
-	unsigned long   output1buffer2_cbcr_phy;
-	unsigned long   output1buffer3_y_phy;
-	unsigned long   output1buffer3_cbcr_phy;
-	unsigned long   output1buffer4_y_phy;
-	unsigned long   output1buffer4_cbcr_phy;
-	unsigned long   output1buffer5_y_phy;
-	unsigned long   output1buffer5_cbcr_phy;
-	unsigned long   output1buffer6_y_phy;
-	unsigned long   output1buffer6_cbcr_phy;
-	unsigned long   output1buffer7_y_phy;
-	unsigned long   output1buffer7_cbcr_phy;
-	unsigned long   output1buffer8_y_phy;
-	unsigned long   output1buffer8_cbcr_phy;
-
-	/* output2 phisycal address */
-	unsigned long   output2buffer1_y_phy;
-	unsigned long   output2buffer1_cbcr_phy;
-	unsigned long   output2buffer2_y_phy;
-	unsigned long   output2buffer2_cbcr_phy;
-	unsigned long   output2buffer3_y_phy;
-	unsigned long   output2buffer3_cbcr_phy;
-	unsigned long   output2buffer4_y_phy;
-	unsigned long   output2buffer4_cbcr_phy;
-	unsigned long   output2buffer5_y_phy;
-	unsigned long   output2buffer5_cbcr_phy;
-	unsigned long   output2buffer6_y_phy;
-	unsigned long   output2buffer6_cbcr_phy;
-	unsigned long   output2buffer7_y_phy;
-	unsigned long   output2buffer7_cbcr_phy;
-	unsigned long   output2buffer8_y_phy;
-	unsigned long   output2buffer8_cbcr_phy;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_stats_we_cfg {
-	uint32_t       header;
-
-	/* White Balance/Exposure Statistic Selection */
-	uint8_t        wb_expstatsenable:1;
-	uint8_t        wb_expstatbuspriorityselection:1;
-	unsigned int   wb_expstatbuspriorityvalue:4;
-	unsigned int   /* reserved */ : 26;
-
-	/* White Balance/Exposure Statistic Configuration, Part 1 */
-	uint8_t        exposurestatregions:1;
-	uint8_t        exposurestatsubregions:1;
-	unsigned int   /* reserved */ : 14;
-
-	unsigned int   whitebalanceminimumy:8;
-	unsigned int   whitebalancemaximumy:8;
-
-	/* White Balance/Exposure Statistic Configuration, Part 2 */
-	uint8_t wb_expstatslopeofneutralregionline[
-		NUM_WB_EXP_NEUTRAL_REGION_LINES];
-
-	/* White Balance/Exposure Statistic Configuration, Part 3 */
-	unsigned int   wb_expstatcrinterceptofneutralregionline2:12;
-	unsigned int   /* reserved */ : 4;
-	unsigned int   wb_expstatcbinterceptofneutralreginnline1:12;
-	unsigned int    /* reserved */ : 4;
-
-	/* White Balance/Exposure Statistic Configuration, Part 4 */
-	unsigned int   wb_expstatcrinterceptofneutralregionline4:12;
-	unsigned int   /* reserved */ : 4;
-	unsigned int   wb_expstatcbinterceptofneutralregionline3:12;
-	unsigned int   /* reserved */ : 4;
-
-	/* White Balance/Exposure Statistic Output Buffer Header */
-	unsigned int   wb_expmetricheaderpattern:8;
-	unsigned int   /* reserved */ : 24;
-
-	/* White Balance/Exposure Statistic Output Buffers-MUST
-	* BE 64 bit ALIGNED */
-	void  *wb_expstatoutputbuffer[NUM_WB_EXP_STAT_OUTPUT_BUFFERS];
-} __attribute__((packed, aligned(4)));
-
-struct vfe_stats_af_cfg {
-	uint32_t header;
-
-	/* Autofocus Statistic Selection */
-	uint8_t       af_enable:1;
-	uint8_t       af_busprioritysel:1;
-	unsigned int  af_buspriorityval:4;
-	unsigned int  /* reserved */ : 26;
-
-	/* Autofocus Statistic Configuration, Part 1 */
-	unsigned int  af_singlewinvoffset:12;
-	unsigned int  /* reserved */ : 4;
-	unsigned int  af_singlewinhoffset:12;
-	unsigned int  /* reserved */ : 3;
-	uint8_t       af_winmode:1;
-
-	/* Autofocus Statistic Configuration, Part 2 */
-	unsigned int  af_singglewinvh:11;
-	unsigned int  /* reserved */ : 5;
-	unsigned int  af_singlewinhw:11;
-	unsigned int  /* reserved */ : 5;
-
-	/* Autofocus Statistic Configuration, Parts 3-6 */
-	uint8_t       af_multiwingrid[NUM_AUTOFOCUS_MULTI_WINDOW_GRIDS];
-
-	/* Autofocus Statistic Configuration, Part 7 */
-	signed int    af_metrichpfcoefa00:5;
-	signed int    af_metrichpfcoefa04:5;
-	unsigned int  af_metricmaxval:11;
-	uint8_t       af_metricsel:1;
-	unsigned int  /* reserved */ : 10;
-
-	/* Autofocus Statistic Configuration, Part 8 */
-	signed int    af_metrichpfcoefa20:5;
-	signed int    af_metrichpfcoefa21:5;
-	signed int    af_metrichpfcoefa22:5;
-	signed int    af_metrichpfcoefa23:5;
-	signed int    af_metrichpfcoefa24:5;
-	unsigned int  /* reserved */ : 7;
-
-	/* Autofocus Statistic Output Buffer Header */
-	unsigned int  af_metrichp:8;
-	unsigned int  /* reserved */ : 24;
-
-	/* Autofocus Statistic Output Buffers - MUST BE 64 bit ALIGNED!!! */
-	void *af_outbuf[NUM_AF_STAT_OUTPUT_BUFFERS];
-} __attribute__((packed, aligned(4))); /* VFE_StatsAutofocusConfigCmdType */
-
-struct msm_camera_frame_msg {
-	unsigned long   output_y_address;
-	unsigned long   output_cbcr_address;
-
-	unsigned int    blacklevelevenColumn:23;
-	uint16_t        reserved1:9;
-	unsigned int    blackleveloddColumn:23;
-	uint16_t        reserved2:9;
-
-	uint16_t        greendefectpixelcount:8;
-	uint16_t        reserved3:8;
-	uint16_t        redbluedefectpixelcount:8;
-	uint16_t        reserved4:8;
-} __attribute__((packed, aligned(4)));
-
-/* New one for 7k */
-struct msm_vfe_command_7k {
-	uint16_t queue;
-	uint16_t length;
-	void     *value;
-};
-
-struct stop_event {
-  wait_queue_head_t wait;
-	int state;
-  int timeout;
-};
-
-
-#endif /* __MSM_VFE7X_H__ */
diff --git a/drivers/media/video/msm/vfe/msm_vfe7x27a.c b/drivers/media/video/msm/vfe/msm_vfe7x27a.c
deleted file mode 100644
index 0279c78..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe7x27a.c
+++ /dev/null
@@ -1,745 +0,0 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/msm_adsp.h>
-#include <linux/uaccess.h>
-#include <linux/fs.h>
-#include <linux/android_pmem.h>
-#include <linux/slab.h>
-#include <linux/pm_qos.h>
-#include <linux/delay.h>
-#include <linux/wait.h>
-#include <mach/msm_adsp.h>
-#include <mach/clk.h>
-#include <mach/camera.h>
-#include "msm_vfe7x27a.h"
-
-#define QDSP_CMDQUEUE 25
-
-#define VFE_RESET_CMD 0
-#define VFE_START_CMD 1
-#define VFE_STOP_CMD  2
-#define VFE_FRAME_ACK 20
-#define STATS_AF_ACK  21
-#define STATS_WE_ACK  22
-
-#define MSG_STOP_ACK  1
-#define MSG_SNAPSHOT  2
-#define MSG_OUTPUT1   6
-#define MSG_OUTPUT2   7
-#define MSG_STATS_AF  8
-#define MSG_STATS_WE  9
-#define MSG_OUTPUT_S  23
-#define MSG_OUTPUT_T  22
-#define MSG_SOF       15
-
-#define VFE_ADSP_EVENT 0xFFFF
-#define SNAPSHOT_MASK_MODE 0x00000002
-#define MSM_AXI_QOS_PREVIEW	122000
-#define MSM_AXI_QOS_SNAPSHOT	192000
-
-
-static struct msm_adsp_module *qcam_mod;
-static struct msm_adsp_module *vfe_mod;
-static struct msm_vfe_callback *resp;
-static void *extdata;
-static uint32_t extlen;
-
-struct mutex vfe_lock;
-static void     *vfe_syncdata;
-static uint8_t vfestopped;
-
-static struct stop_event stopevent;
-
-unsigned long paddr_s_y;
-unsigned long paddr_s_cbcr;
-unsigned long paddr_t_y;
-unsigned long paddr_t_cbcr;
-static uint32_t op_mode;
-
-static void vfe_7x_convert(struct msm_vfe_phy_info *pinfo,
-		enum vfe_resp_msg type,
-		void *data, void **ext, int32_t *elen)
-{
-	switch (type) {
-	case VFE_MSG_OUTPUT_P: {
-		pinfo->p0_phy = ((struct vfe_endframe *)data)->y_address;
-		pinfo->p1_phy =
-			((struct vfe_endframe *)data)->cbcr_address;
-		pinfo->p2_phy = pinfo->p0_phy;
-		pinfo->output_id = OUTPUT_TYPE_P;
-
-		CDBG("vfe_7x_convert, y_phy = 0x%x, cbcr_phy = 0x%x\n",
-				 pinfo->p0_phy, pinfo->p1_phy);
-
-		memcpy(((struct vfe_frame_extra *)extdata),
-			&((struct vfe_endframe *)data)->extra,
-			sizeof(struct vfe_frame_extra));
-
-		*ext  = extdata;
-		*elen = extlen;
-		pinfo->frame_id =
-				((struct vfe_frame_extra *)extdata)->frame_id;
-	}
-		break;
-	case VFE_MSG_OUTPUT_S: {
-		pinfo->p0_phy = paddr_s_y;
-		pinfo->p1_phy = paddr_s_cbcr;
-		pinfo->p2_phy = pinfo->p0_phy;
-		pinfo->output_id = OUTPUT_TYPE_S;
-		CDBG("vfe_7x_convert: y_phy = 0x%x cbcr_phy = 0x%x\n",
-					pinfo->p0_phy, pinfo->p1_phy);
-	}
-		break;
-	case VFE_MSG_OUTPUT_T: {
-		pinfo->p0_phy = paddr_t_y;
-		pinfo->p1_phy = paddr_t_cbcr;
-		pinfo->p2_phy = pinfo->p0_phy;
-		pinfo->output_id = OUTPUT_TYPE_T;
-		CDBG("vfe_7x_convert: y_phy = 0x%x cbcr_phy = 0x%x\n",
-					pinfo->p0_phy, pinfo->p1_phy);
-	}
-		break;
-	case VFE_MSG_STATS_AF:
-	case VFE_MSG_STATS_WE:
-		pinfo->sbuf_phy = *(uint32_t *)data;
-		pinfo->frame_id = *(((uint32_t *)data) + 1);
-		CDBG("frame id = %d\n", pinfo->frame_id);
-		break;
-	default:
-		break;
-	}
-}
-
-static void vfe_7x_ops(void *driver_data, unsigned id, size_t len,
-		void (*getevent)(void *ptr, size_t len))
-{
-	uint32_t evt_buf[3];
-	struct msm_vfe_resp *rp;
-	void *data;
-	CDBG("%s:id=%d\n", __func__, id);
-
-	len = (id == VFE_ADSP_EVENT) ? 0 : len;
-	data = resp->vfe_alloc(sizeof(struct msm_vfe_resp) + len,
-		vfe_syncdata,  GFP_ATOMIC);
-
-	if (!data) {
-		pr_err("%s: rp: cannot allocate buffer\n", __func__);
-		return;
-	}
-	rp = data;
-	rp->evt_msg.len = len;
-
-	if (id == VFE_ADSP_EVENT) {
-		/* event */
-		rp->type           = VFE_EVENT;
-		rp->evt_msg.type   = MSM_CAMERA_EVT;
-		getevent(evt_buf, sizeof(evt_buf));
-		rp->evt_msg.msg_id = evt_buf[0];
-		CDBG("%s:event:msg_id=%d\n", __func__, rp->evt_msg.msg_id);
-		resp->vfe_resp(rp, MSM_CAM_Q_VFE_EVT, vfe_syncdata,
-		GFP_ATOMIC);
-	} else {
-		/* messages */
-		rp->evt_msg.type   = MSM_CAMERA_MSG;
-		rp->evt_msg.msg_id = id;
-		rp->evt_msg.data = rp + 1;
-		getevent(rp->evt_msg.data, len);
-		CDBG("%s:messages:msg_id=%d\n", __func__, rp->evt_msg.msg_id);
-
-		switch (rp->evt_msg.msg_id) {
-		case MSG_SNAPSHOT:
-			msm_camio_set_perf_lvl(S_PREVIEW);
-			vfe_7x_ops(driver_data, MSG_OUTPUT_S, len, getevent);
-			vfe_7x_ops(driver_data, MSG_OUTPUT_T, len, getevent);
-			rp->type = VFE_MSG_SNAPSHOT;
-			break;
-		case MSG_OUTPUT_S:
-			rp->type = VFE_MSG_OUTPUT_S;
-			vfe_7x_convert(&(rp->phy), VFE_MSG_OUTPUT_S,
-					rp->evt_msg.data, &(rp->extdata),
-					&(rp->extlen));
-			break;
-		case MSG_OUTPUT_T:
-			rp->type = VFE_MSG_OUTPUT_T;
-			vfe_7x_convert(&(rp->phy), VFE_MSG_OUTPUT_T,
-					rp->evt_msg.data, &(rp->extdata),
-					&(rp->extlen));
-			break;
-		case MSG_OUTPUT1:
-		case MSG_OUTPUT2:
-			if (op_mode & SNAPSHOT_MASK_MODE) {
-				resp->vfe_free(data);
-				return;
-			}
-			rp->type = VFE_MSG_OUTPUT_P;
-			vfe_7x_convert(&(rp->phy), VFE_MSG_OUTPUT_P,
-				rp->evt_msg.data, &(rp->extdata),
-				&(rp->extlen));
-			break;
-		case MSG_STATS_AF:
-			rp->type = VFE_MSG_STATS_AF;
-			vfe_7x_convert(&(rp->phy), VFE_MSG_STATS_AF,
-					rp->evt_msg.data, NULL, NULL);
-			break;
-		case MSG_STATS_WE:
-			rp->type = VFE_MSG_STATS_WE;
-			vfe_7x_convert(&(rp->phy), VFE_MSG_STATS_WE,
-					rp->evt_msg.data, NULL, NULL);
-
-			CDBG("MSG_STATS_WE: phy = 0x%x\n", rp->phy.sbuf_phy);
-			break;
-		case MSG_STOP_ACK:
-			rp->type = VFE_MSG_GENERAL;
-			stopevent.state = 1;
-			wake_up(&stopevent.wait);
-			break;
-		default:
-			rp->type = VFE_MSG_GENERAL;
-			break;
-		}
-		if (id != MSG_SOF)
-			resp->vfe_resp(rp, MSM_CAM_Q_VFE_MSG,
-					vfe_syncdata, GFP_ATOMIC);
-	}
-}
-
-static struct msm_adsp_ops vfe_7x_sync = {
-	.event = vfe_7x_ops,
-};
-
-static int vfe_7x_enable(struct camera_enable_cmd *enable)
-{
-	int rc = -EFAULT;
-	static int cnt;
-
-	if (!strcmp(enable->name, "QCAMTASK"))
-		rc = msm_adsp_enable(qcam_mod);
-	else if (!strcmp(enable->name, "VFETASK"))
-		rc = msm_adsp_enable(vfe_mod);
-
-	if (!cnt) {
-		msm_camio_set_perf_lvl(S_INIT);
-		cnt++;
-	}
-	return rc;
-}
-
-static int vfe_7x_disable(struct camera_enable_cmd *enable,
-		struct platform_device *dev __attribute__((unused)))
-{
-	int rc = -EFAULT;
-
-	if (!strcmp(enable->name, "QCAMTASK"))
-		rc = msm_adsp_disable(qcam_mod);
-	else if (!strcmp(enable->name, "VFETASK"))
-		rc = msm_adsp_disable(vfe_mod);
-
-	return rc;
-}
-
-static int vfe_7x_stop(void)
-{
-	int rc = 0;
-	uint32_t stopcmd = VFE_STOP_CMD;
-	rc = msm_adsp_write(vfe_mod, QDSP_CMDQUEUE,
-				&stopcmd, sizeof(uint32_t));
-	if (rc < 0) {
-		CDBG("%s:%d: failed rc = %d\n", __func__, __LINE__, rc);
-		return rc;
-	}
-
-	stopevent.state = 0;
-	rc = wait_event_timeout(stopevent.wait,
-		stopevent.state != 0,
-		msecs_to_jiffies(stopevent.timeout));
-
-	return rc;
-}
-
-static void vfe_7x_release(struct platform_device *pdev)
-{
-	mutex_lock(&vfe_lock);
-	vfe_syncdata = NULL;
-	mutex_unlock(&vfe_lock);
-
-	if (!vfestopped) {
-		CDBG("%s:%d:Calling vfe_7x_stop()\n", __func__, __LINE__);
-		vfe_7x_stop();
-	} else
-		vfestopped = 0;
-
-	msm_adsp_disable(qcam_mod);
-	msm_adsp_disable(vfe_mod);
-
-	msm_adsp_put(qcam_mod);
-	msm_adsp_put(vfe_mod);
-
-	msm_camio_disable(pdev);
-
-	kfree(extdata);
-	extlen = 0;
-
-	msm_camio_set_perf_lvl(S_EXIT);
-}
-
-static int vfe_7x_init(struct msm_vfe_callback *presp,
-	struct platform_device *dev)
-{
-	int rc = 0;
-
-	init_waitqueue_head(&stopevent.wait);
-	stopevent.timeout = 200;
-	stopevent.state = 0;
-
-	if (presp && presp->vfe_resp)
-		resp = presp;
-	else
-		return -EFAULT;
-
-	/* Bring up all the required GPIOs and Clocks */
-	rc = msm_camio_enable(dev);
-	if (rc < 0)
-		return rc;
-
-	extlen = sizeof(struct vfe_frame_extra);
-
-	extdata = kmalloc(extlen, GFP_ATOMIC);
-	if (!extdata) {
-		rc = -ENOMEM;
-		goto init_fail;
-	}
-
-	rc = msm_adsp_get("QCAMTASK", &qcam_mod, &vfe_7x_sync, NULL);
-	if (rc) {
-		rc = -EBUSY;
-		goto get_qcam_fail;
-	}
-
-	rc = msm_adsp_get("VFETASK", &vfe_mod, &vfe_7x_sync, NULL);
-	if (rc) {
-		rc = -EBUSY;
-		goto get_vfe_fail;
-	}
-
-	return 0;
-
-get_vfe_fail:
-	msm_adsp_put(qcam_mod);
-get_qcam_fail:
-	kfree(extdata);
-init_fail:
-	extlen = 0;
-	return rc;
-}
-
-static int vfe_7x_config_axi(int mode,
-	struct axidata *ad, struct axiout *ao)
-{
-	struct msm_pmem_region *regptr;
-	unsigned long *bptr;
-	int    cnt;
-
-	int rc = 0;
-
-	if (mode == OUTPUT_1 || mode == OUTPUT_1_AND_2) {
-		regptr = ad->region;
-
-		CDBG("bufnum1 = %d\n", ad->bufnum1);
-		if (mode == OUTPUT_1_AND_2) {
-			paddr_t_y = regptr->paddr + regptr->info.planar0_off;
-			paddr_t_cbcr = regptr->paddr +
-			regptr->info.planar1_off;
-		}
-
-		CDBG("config_axi1: O1, phy = 0x%lx, y_off = %d, cbcr_off =%d\n",
-			regptr->paddr, regptr->info.planar0_off,
-			regptr->info.planar1_off);
-
-		bptr = &ao->output1buffer1_y_phy;
-		for (cnt = 0; cnt < ad->bufnum1; cnt++) {
-			*bptr = regptr->paddr + regptr->info.planar0_off;
-			bptr++;
-			*bptr = regptr->paddr + regptr->info.planar1_off;
-
-			bptr++;
-			regptr++;
-		}
-
-		regptr--;
-		for (cnt = 0; cnt < (8 - ad->bufnum1); cnt++) {
-			*bptr = regptr->paddr + regptr->info.planar0_off;
-			bptr++;
-			*bptr = regptr->paddr + regptr->info.planar1_off;
-			bptr++;
-		}
-	}
-
-	if (mode == OUTPUT_2 || mode == OUTPUT_1_AND_2) {
-		regptr = &(ad->region[ad->bufnum1]);
-
-		CDBG("bufnum2 = %d\n", ad->bufnum2);
-		paddr_s_y = regptr->paddr +  regptr->info.planar0_off;
-		paddr_s_cbcr = regptr->paddr +  regptr->info.planar1_off;
-
-		CDBG("config_axi2: O2, phy = 0x%lx, y_off = %d, cbcr_off =%d\n",
-			regptr->paddr, regptr->info.planar0_off,
-			regptr->info.planar1_off);
-
-		bptr = &ao->output2buffer1_y_phy;
-		for (cnt = 0; cnt < ad->bufnum2; cnt++) {
-			*bptr = regptr->paddr + regptr->info.planar0_off;
-			bptr++;
-			*bptr = regptr->paddr + regptr->info.planar1_off;
-
-			bptr++;
-			regptr++;
-		}
-
-		regptr--;
-		for (cnt = 0; cnt < (8 - ad->bufnum2); cnt++) {
-			*bptr = regptr->paddr + regptr->info.planar0_off;
-			bptr++;
-			*bptr = regptr->paddr + regptr->info.planar1_off;
-			bptr++;
-		}
-	}
-
-	return rc;
-}
-
-static int vfe_7x_config(struct msm_vfe_cfg_cmd *cmd, void *data)
-{
-	struct msm_pmem_region *regptr;
-	unsigned char buf[256];
-
-	struct vfe_stats_ack sack;
-	struct axidata *axid;
-	uint32_t i;
-	uint32_t *_mode;
-
-	struct vfe_stats_we_cfg *scfg = NULL;
-	struct vfe_stats_af_cfg *sfcfg = NULL;
-
-	struct axiout *axio = NULL;
-	void   *cmd_data = NULL;
-	void   *cmd_data_alloc = NULL;
-	long rc = 0;
-	struct msm_vfe_command_7k *vfecmd;
-
-	vfecmd = kmalloc(sizeof(struct msm_vfe_command_7k), GFP_ATOMIC);
-	if (!vfecmd) {
-		pr_err("vfecmd alloc failed!\n");
-		return -ENOMEM;
-	}
-
-	if (cmd->cmd_type != CMD_FRAME_BUF_RELEASE &&
-	    cmd->cmd_type != CMD_STATS_BUF_RELEASE &&
-	    cmd->cmd_type != CMD_STATS_AF_BUF_RELEASE) {
-		if (copy_from_user(vfecmd,
-				(void __user *)(cmd->value),
-				sizeof(struct msm_vfe_command_7k))) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-	}
-
-	switch (cmd->cmd_type) {
-	case CMD_STATS_AEC_AWB_ENABLE:
-	case CMD_STATS_AXI_CFG: {
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		scfg =
-			kmalloc(sizeof(struct vfe_stats_we_cfg),
-				GFP_ATOMIC);
-		if (!scfg) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user(scfg,
-					(void __user *)(vfecmd->value),
-					vfecmd->length)) {
-
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		CDBG("STATS_ENABLE: bufnum = %d, enabling = %d\n",
-			axid->bufnum1, scfg->wb_expstatsenable);
-
-		if (axid->bufnum1 > 0) {
-			regptr = axid->region;
-
-			for (i = 0; i < axid->bufnum1; i++) {
-
-				CDBG("STATS_ENABLE, phy = 0x%lx\n",
-					regptr->paddr);
-
-				scfg->wb_expstatoutputbuffer[i] =
-					(void *)regptr->paddr;
-				regptr++;
-			}
-
-			cmd_data = scfg;
-
-		} else {
-			rc = -EINVAL;
-			goto config_done;
-		}
-	}
-		break;
-	case CMD_STATS_AF_ENABLE:
-	case CMD_STATS_AF_AXI_CFG: {
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		sfcfg =
-			kmalloc(sizeof(struct vfe_stats_af_cfg),
-				GFP_ATOMIC);
-
-		if (!sfcfg) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user(sfcfg,
-					(void __user *)(vfecmd->value),
-					vfecmd->length)) {
-
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		CDBG("AF_ENABLE: bufnum = %d, enabling = %d\n",
-			axid->bufnum1, sfcfg->af_enable);
-
-		if (axid->bufnum1 > 0) {
-			regptr = &axid->region[0];
-
-			for (i = 0; i < axid->bufnum1; i++) {
-
-				CDBG("STATS_ENABLE, phy = 0x%lx\n",
-					regptr->paddr);
-
-				sfcfg->af_outbuf[i] =
-					(void *)regptr->paddr;
-
-				regptr++;
-			}
-
-			cmd_data = sfcfg;
-
-		} else {
-			rc = -EINVAL;
-			goto config_done;
-		}
-	}
-		break;
-	case CMD_FRAME_BUF_RELEASE: {
-		struct msm_frame *b;
-		unsigned long p;
-		struct vfe_outputack fack;
-		if (!data)  {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		b = (struct msm_frame *)(cmd->value);
-		p = *(unsigned long *)data;
-
-		fack.header = VFE_FRAME_ACK;
-
-		fack.output2newybufferaddress =
-			(void *)(p + b->planar0_off);
-
-		fack.output2newcbcrbufferaddress =
-			(void *)(p + b->planar1_off);
-
-		vfecmd->queue = QDSP_CMDQUEUE;
-		vfecmd->length = sizeof(struct vfe_outputack);
-		cmd_data = &fack;
-	}
-		break;
-	case CMD_SNAP_BUF_RELEASE:
-		break;
-	case CMD_STATS_BUF_RELEASE: {
-		CDBG("vfe_7x_config: CMD_STATS_BUF_RELEASE\n");
-		if (!data) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		sack.header = STATS_WE_ACK;
-		sack.bufaddr = (void *)*(uint32_t *)data;
-
-		vfecmd->queue  = QDSP_CMDQUEUE;
-		vfecmd->length = sizeof(struct vfe_stats_ack);
-		cmd_data = &sack;
-	}
-		break;
-	case CMD_STATS_AF_BUF_RELEASE: {
-		CDBG("vfe_7x_config: CMD_STATS_AF_BUF_RELEASE\n");
-		if (!data) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		sack.header = STATS_AF_ACK;
-		sack.bufaddr = (void *)*(uint32_t *)data;
-
-		vfecmd->queue  = QDSP_CMDQUEUE;
-		vfecmd->length = sizeof(struct vfe_stats_ack);
-		cmd_data = &sack;
-	}
-		break;
-	case CMD_GENERAL:
-	case CMD_STATS_DISABLE: {
-		if (vfecmd->length > 256) {
-			cmd_data_alloc =
-			cmd_data = kmalloc(vfecmd->length, GFP_ATOMIC);
-			if (!cmd_data) {
-				rc = -ENOMEM;
-				goto config_failure;
-			}
-		} else
-			cmd_data = buf;
-
-		if (copy_from_user(cmd_data,
-					(void __user *)(vfecmd->value),
-					vfecmd->length)) {
-
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		if (vfecmd->queue == QDSP_CMDQUEUE) {
-			switch (*(uint32_t *)cmd_data) {
-			case VFE_RESET_CMD:
-				msm_camio_vfe_blk_reset();
-				vfestopped = 0;
-				break;
-			case VFE_START_CMD:
-				_mode = (uint32_t *)cmd_data;
-				op_mode = *(++_mode);
-				if (op_mode & SNAPSHOT_MASK_MODE)
-					msm_camio_set_perf_lvl(S_CAPTURE);
-				else
-					msm_camio_set_perf_lvl(S_PREVIEW);
-				vfestopped = 0;
-				break;
-			case VFE_STOP_CMD:
-				vfestopped = 1;
-				goto config_send;
-
-			default:
-				break;
-			}
-		} /* QDSP_CMDQUEUE */
-	}
-		break;
-	case CMD_AXI_CFG_PREVIEW:
-	case CMD_RAW_PICT_AXI_CFG: {
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		axio = kmalloc(sizeof(struct axiout), GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd->value),
-					sizeof(struct axiout))) {
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		vfe_7x_config_axi(OUTPUT_2, axid, axio);
-		cmd_data = axio;
-	}
-		break;
-	case CMD_AXI_CFG_SNAP: {
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		axio = kmalloc(sizeof(struct axiout), GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user(axio, (void __user *)(vfecmd->value),
-					sizeof(struct axiout))) {
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		vfe_7x_config_axi(OUTPUT_1_AND_2, axid, axio);
-
-		cmd_data = axio;
-	}
-		break;
-	default:
-		break;
-	}
-
-	if (vfestopped)
-		goto config_done;
-
-config_send:
-	CDBG("send adsp command = %d\n", *(uint32_t *)cmd_data);
-	rc = msm_adsp_write(vfe_mod, vfecmd->queue,
-				cmd_data, vfecmd->length);
-
-config_done:
-	kfree(cmd_data_alloc);
-
-config_failure:
-	kfree(scfg);
-	kfree(axio);
-	kfree(vfecmd);
-	return rc;
-}
-
-void msm_camvfe_fn_init(struct msm_camvfe_fn *fptr, void *data)
-{
-	mutex_init(&vfe_lock);
-	fptr->vfe_init    = vfe_7x_init;
-	fptr->vfe_enable  = vfe_7x_enable;
-	fptr->vfe_config  = vfe_7x_config;
-	fptr->vfe_disable = vfe_7x_disable;
-	fptr->vfe_release = vfe_7x_release;
-	vfe_syncdata = data;
-}
-
-void msm_camvpe_fn_init(struct msm_camvpe_fn *fptr, void *data)
-{
-	fptr->vpe_reg		= NULL;
-	fptr->send_frame_to_vpe	= NULL;
-	fptr->vpe_config	= NULL;
-	fptr->vpe_cfg_update	= NULL;
-	fptr->dis		= NULL;
-}
diff --git a/drivers/media/video/msm/vfe/msm_vfe7x27a.h b/drivers/media/video/msm/vfe/msm_vfe7x27a.h
deleted file mode 100644
index fbebb60..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe7x27a.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __MSM_VFE7X_H__
-#define __MSM_VFE7X_H__
-#include <media/msm_camera.h>
-#include <mach/camera.h>
-
-struct vfe_frame_extra {
-	uint32_t	bl_evencol:23;
-	uint32_t	rvd1:9;
-	uint32_t	bl_oddcol:23;
-	uint32_t	rvd2:9;
-
-	uint32_t	d_dbpc_stats_hot:16;
-	uint32_t	d_dbpc_stats_cold:16;
-
-	uint32_t	d_dbpc_stats_0_hot:10;
-	uint32_t	rvd3:6;
-	uint32_t	d_dbpc_stats_0_cold:10;
-	uint32_t	rvd4:6;
-	uint32_t	d_dbpc_stats_1_hot:10;
-	uint32_t	rvd5:6;
-	uint32_t	d_dbpc_stats_1_cold:10;
-	uint32_t	rvd6:6;
-
-	uint32_t	asf_max_edge;
-
-	uint32_t	e_y_wm_pm_stats_0:21;
-	uint32_t	rvd7:11;
-	uint32_t	e_y_wm_pm_stats_1_bl:8;
-	uint32_t	rvd8:8;
-	uint32_t	e_y_wm_pm_stats_1_nl:12;
-	uint32_t	rvd9:4;
-
-	uint32_t	e_cbcr_wm_pm_stats_0:21;
-	uint32_t	rvd10:11;
-	uint32_t	e_cbcr_wm_pm_stats_1_bl:8;
-	uint32_t	rvd11:8;
-	uint32_t	e_cbcr_wm_pm_stats_1_nl:12;
-	uint32_t	rvd12:4;
-
-	uint32_t	v_y_wm_pm_stats_0:21;
-	uint32_t	rvd13:11;
-	uint32_t	v_y_wm_pm_stats_1_bl:8;
-	uint32_t	rvd14:8;
-	uint32_t	v_y_wm_pm_stats_1_nl:12;
-	uint32_t	rvd15:4;
-
-	uint32_t	v_cbcr_wm_pm_stats_0:21;
-	uint32_t	rvd16:11;
-	uint32_t	v_cbcr_wm_pm_stats_1_bl:8;
-	uint32_t	rvd17:8;
-	uint32_t	v_cbcr_wm_pm_stats_1_nl:12;
-	uint32_t	rvd18:4;
-
-	uint32_t      frame_id;
-};
-
-struct vfe_endframe {
-	uint32_t      y_address;
-	uint32_t      cbcr_address;
-
-	struct vfe_frame_extra extra;
-} __packed;
-
-struct vfe_outputack {
-	uint32_t  header;
-	void      *output2newybufferaddress;
-	void      *output2newcbcrbufferaddress;
-} __packed;
-
-struct vfe_stats_ack {
-	uint32_t header;
-	/* MUST BE 64 bit ALIGNED */
-	void     *bufaddr;
-} __packed;
-
-/* AXI Output Config Command sent to DSP */
-struct axiout {
-	uint32_t            cmdheader:32;
-	int                 outputmode:3;
-	uint8_t             format:2;
-	uint32_t            /* reserved */ : 27;
-
-	/* AXI Output 1 Y Configuration, Part 1 */
-	uint32_t            out1yimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out1yimagewidthin64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 1 Y Configuration, Part 2 */
-	uint8_t             out1yburstlen:2;
-	uint32_t            out1ynumrows:12;
-	uint32_t            out1yrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 1 CbCr Configuration, Part 1 */
-	uint32_t            out1cbcrimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out1cbcrimagewidthin64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 1 CbCr Configuration, Part 2 */
-	uint8_t             out1cbcrburstlen:2;
-	uint32_t            out1cbcrnumrows:12;
-	uint32_t            out1cbcrrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 Y Configuration, Part 1 */
-	uint32_t            out2yimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out2yimagewidthin64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 Y Configuration, Part 2 */
-	uint8_t             out2yburstlen:2;
-	uint32_t            out2ynumrows:12;
-	uint32_t            out2yrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 CbCr Configuration, Part 1 */
-	uint32_t            out2cbcrimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out2cbcrimagewidtein64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 CbCr Configuration, Part 2 */
-	uint8_t             out2cbcrburstlen:2;
-	uint32_t            out2cbcrnumrows:12;
-	uint32_t            out2cbcrrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* Address configuration:
-	 * output1 phisycal address */
-	unsigned long   output1buffer1_y_phy;
-	unsigned long   output1buffer1_cbcr_phy;
-	unsigned long   output1buffer2_y_phy;
-	unsigned long   output1buffer2_cbcr_phy;
-	unsigned long   output1buffer3_y_phy;
-	unsigned long   output1buffer3_cbcr_phy;
-	unsigned long   output1buffer4_y_phy;
-	unsigned long   output1buffer4_cbcr_phy;
-	unsigned long   output1buffer5_y_phy;
-	unsigned long   output1buffer5_cbcr_phy;
-	unsigned long   output1buffer6_y_phy;
-	unsigned long   output1buffer6_cbcr_phy;
-	unsigned long   output1buffer7_y_phy;
-	unsigned long   output1buffer7_cbcr_phy;
-	unsigned long   output1buffer8_y_phy;
-	unsigned long   output1buffer8_cbcr_phy;
-
-	/* output2 phisycal address */
-	unsigned long   output2buffer1_y_phy;
-	unsigned long   output2buffer1_cbcr_phy;
-	unsigned long   output2buffer2_y_phy;
-	unsigned long   output2buffer2_cbcr_phy;
-	unsigned long   output2buffer3_y_phy;
-	unsigned long   output2buffer3_cbcr_phy;
-	unsigned long   output2buffer4_y_phy;
-	unsigned long   output2buffer4_cbcr_phy;
-	unsigned long   output2buffer5_y_phy;
-	unsigned long   output2buffer5_cbcr_phy;
-	unsigned long   output2buffer6_y_phy;
-	unsigned long   output2buffer6_cbcr_phy;
-	unsigned long   output2buffer7_y_phy;
-	unsigned long   output2buffer7_cbcr_phy;
-	unsigned long   output2buffer8_y_phy;
-	unsigned long   output2buffer8_cbcr_phy;
-} __packed;
-
-struct vfe_stats_we_cfg {
-	uint32_t       header;
-
-	/* White Balance/Exposure Statistic Selection */
-	uint8_t        wb_expstatsenable:1;
-	uint8_t        wb_expstatbuspriorityselection:1;
-	unsigned int   wb_expstatbuspriorityvalue:4;
-	unsigned int   /* reserved */ : 26;
-
-	/* White Balance/Exposure Statistic Configuration, Part 1 */
-	uint8_t        exposurestatregions:1;
-	uint8_t        exposurestatsubregions:1;
-	unsigned int   /* reserved */ : 14;
-
-	unsigned int   whitebalanceminimumy:8;
-	unsigned int   whitebalancemaximumy:8;
-
-	/* White Balance/Exposure Statistic Configuration, Part 2 */
-	uint8_t wb_expstatslopeofneutralregionline[
-		NUM_WB_EXP_NEUTRAL_REGION_LINES];
-
-	/* White Balance/Exposure Statistic Configuration, Part 3 */
-	unsigned int   wb_expstatcrinterceptofneutralregionline2:12;
-	unsigned int   /* reserved */ : 4;
-	unsigned int   wb_expstatcbinterceptofneutralreginnline1:12;
-	unsigned int    /* reserved */ : 4;
-
-	/* White Balance/Exposure Statistic Configuration, Part 4 */
-	unsigned int   wb_expstatcrinterceptofneutralregionline4:12;
-	unsigned int   /* reserved */ : 4;
-	unsigned int   wb_expstatcbinterceptofneutralregionline3:12;
-	unsigned int   /* reserved */ : 4;
-
-	/* White Balance/Exposure Statistic Output Buffer Header */
-	unsigned int   wb_expmetricheaderpattern:8;
-	unsigned int   /* reserved */ : 24;
-
-	/* White Balance/Exposure Statistic Output Buffers-MUST
-	* BE 64 bit ALIGNED */
-	void  *wb_expstatoutputbuffer[NUM_WB_EXP_STAT_OUTPUT_BUFFERS];
-} __packed;
-
-struct vfe_stats_af_cfg {
-	uint32_t header;
-
-	/* Autofocus Statistic Selection */
-	uint8_t       af_enable:1;
-	uint8_t       af_busprioritysel:1;
-	unsigned int  af_buspriorityval:4;
-	unsigned int  /* reserved */ : 26;
-
-	/* Autofocus Statistic Configuration, Part 1 */
-	unsigned int  af_singlewinvoffset:12;
-	unsigned int  /* reserved */ : 4;
-	unsigned int  af_singlewinhoffset:12;
-	unsigned int  /* reserved */ : 3;
-	uint8_t       af_winmode:1;
-
-	/* Autofocus Statistic Configuration, Part 2 */
-	unsigned int  af_singglewinvh:11;
-	unsigned int  /* reserved */ : 5;
-	unsigned int  af_singlewinhw:11;
-	unsigned int  /* reserved */ : 5;
-
-	/* Autofocus Statistic Configuration, Parts 3-6 */
-	uint8_t       af_multiwingrid[NUM_AUTOFOCUS_MULTI_WINDOW_GRIDS];
-
-	/* Autofocus Statistic Configuration, Part 7 */
-	signed int    af_metrichpfcoefa00:5;
-	signed int    af_metrichpfcoefa04:5;
-	unsigned int  af_metricmaxval:11;
-	uint8_t       af_metricsel:1;
-	unsigned int  /* reserved */ : 10;
-
-	/* Autofocus Statistic Configuration, Part 8 */
-	signed int    af_metrichpfcoefa20:5;
-	signed int    af_metrichpfcoefa21:5;
-	signed int    af_metrichpfcoefa22:5;
-	signed int    af_metrichpfcoefa23:5;
-	signed int    af_metrichpfcoefa24:5;
-	unsigned int  /* reserved */ : 7;
-
-	/* Autofocus Statistic Output Buffer Header */
-	unsigned int  af_metrichp:8;
-	unsigned int  /* reserved */ : 24;
-
-	/* Autofocus Statistic Output Buffers - MUST BE 64 bit ALIGNED!!! */
-	void *af_outbuf[NUM_AF_STAT_OUTPUT_BUFFERS];
-} __packed; /* VFE_StatsAutofocusConfigCmdType */
-
-struct msm_camera_frame_msg {
-	unsigned long   output_y_address;
-	unsigned long   output_cbcr_address;
-
-	unsigned int    blacklevelevenColumn:23;
-	uint16_t        reserved1:9;
-	unsigned int    blackleveloddColumn:23;
-	uint16_t        reserved2:9;
-
-	uint16_t        greendefectpixelcount:8;
-	uint16_t        reserved3:8;
-	uint16_t        redbluedefectpixelcount:8;
-	uint16_t        reserved4:8;
-} __packed;
-
-/* New one for 7k */
-struct msm_vfe_command_7k {
-	uint16_t queue;
-	uint16_t length;
-	void     *value;
-};
-
-struct stop_event {
-	wait_queue_head_t wait;
-	int state;
-	int timeout;
-};
-
-
-#endif /* __MSM_VFE7X_H__ */
diff --git a/drivers/media/video/msm/vfe/msm_vfe7x27a_v4l2.c b/drivers/media/video/msm/vfe/msm_vfe7x27a_v4l2.c
deleted file mode 100644
index cfb1574..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe7x27a_v4l2.c
+++ /dev/null
@@ -1,2466 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#include <linux/msm_adsp.h>
-#include <linux/uaccess.h>
-#include <linux/fs.h>
-#include <linux/android_pmem.h>
-#include <linux/slab.h>
-#include <linux/pm_qos.h>
-#include <linux/delay.h>
-#include <linux/wait.h>
-#include <linux/module.h>
-#include <media/v4l2-device.h>
-#include <media/v4l2-subdev.h>
-#include <media/msm_isp.h>
-#include <mach/msm_adsp.h>
-#include <linux/clk.h>
-#include <mach/clk.h>
-#include <mach/camera.h>
-#include "msm_vfe7x27a_v4l2.h"
-#include "msm.h"
-
-/* ADSP Messages */
-#define MSG_RESET_ACK  0
-#define MSG_STOP_ACK  1
-#define MSG_SNAPSHOT  2
-#define MSG_ILLEGAL_COMMAND  3
-#define MSG_START_ACK  4
-#define MSG_UPDATE_ACK  5
-#define MSG_OUTPUT1  6
-#define MSG_OUTPUT2  7
-#define MSG_STATS_AF  8
-#define MSG_STATS_WE  9
-#define MSG_STATS_HISTOGRAM  10
-#define MSG_EPOCH1  11
-#define MSG_EPOCH2  12
-#define MSG_VFE_ERROR 13
-#define MSG_SYNC_TIMER1_DONE  14
-#define MSG_SYNC_TIMER2_DONE  15
-#define MSG_ASYNC_TIMER1_DONE  16
-#define MSG_ASYNC_TIMER2_DONE  17
-#define MSG_CAPTURE_COMPLETE  18
-#define MSG_TABLE_CMD_ACK  19
-#define MSG_EXP_TIMEOUT_ACK  20
-#define MSG_SOF  21
-#define MSG_OUTPUT_T  22
-#define MSG_OUTPUT_S  23
-
-#define VFE_ADSP_EVENT 0xFFFF
-#define SNAPSHOT_MASK_MODE 0x00000001
-#define MSM_AXI_QOS_PREVIEW	122000
-#define MSM_AXI_QOS_SNAPSHOT	192000
-
-
-#define QDSP_CMDQUEUE 25
-#define QDSP_SCALEQUEUE 26
-#define QDSP_TABLEQUEUE 27
-
-/* ADSP Scler queue Cmd IDs */
-#define VFE_SCALE_OUTPUT1_CONFIG  0
-#define VFE_SCALE_OUTPUT2_CONFIG  1
-#define VFE_SCALE_MAX  0xFFFFFFFF
-
-/* ADSP table queue Cmd IDs */
-#define VFE_AXI_INPUT_CONFIG  0
-#define VFE_AXI_OUTPUT_CONFIG  1
-#define VFE_RGB_GAMMA_CONFIG  2
-#define VFE_Y_GAMMA_CONFIG  3
-#define VFE_ROLL_OFF_CONFIG  4
-#define VFE_DEMOSAICv3_BPC_CFG  6
-#define VFE_DEMOSAICv3_ABF_CFG  7
-#define VFE_DEMOSAICv3_CFG  8
-#define VFE_MAX  0xFFFFFFFF
-
-/* ADSP cfg queue cmd IDs */
-#define VFE_RESET  0
-#define VFE_START  1
-#define VFE_STOP  2
-#define VFE_UPDATE  3
-#define VFE_CAMIF_CONFIG  4
-#define VFE_ACTIVE_REGION_CONFIG  5
-#define VFE_DEMOSAIC_CONFIG  6
-#define VFE_INPUT_FORMAT_CONFIG  7
-#define VFE_OUTPUT_CLAMP_CONFIG  8
-#define VFE_CHROMA_SUBSAMPLE_CONFIG  9
-#define VFE_BLACK_LEVEL_CONFIG  10
-#define VFE_WHITE_BALANCE_CONFIG  11
-#define VFE_COLOR_PROCESSING_CONFIG  12
-#define VFE_ADAPTIVE_FILTER_CONFIG  13
-#define VFE_FRAME_SKIP_CONFIG  14
-#define VFE_FOV_CROP  15
-#define VFE_STATS_AUTOFOCUS_CONFIG  16
-#define VFE_STATS_WB_EXP_CONFIG  17
-#define VFE_STATS_HISTOGRAM_CONFIG  18
-#define VFE_OUTPUT1_ACK  19
-#define VFE_OUTPUT2_ACK  20
-#define VFE_STATS_AUTOFOCUS_ACK  21
-#define VFE_STATS_WB_EXP_ACK  22
-#define VFE_EPOCH1_ACK  23
-#define VFE_EPOCH2_ACK  24
-#define VFE_UPDATE_CAMIF_FRAME_CONFIG  25
-#define VFE_SYNC_TIMER1_CONFIG  26
-#define VFE_SYNC_TIMER2_CONFIG  27
-#define VFE_ASYNC_TIMER1_START  28
-#define VFE_ASYNC_TIMER2_START  29
-#define VFE_STATS_AUTOFOCUS_UPDATE  30
-#define VFE_STATS_WB_EXP_UPDATE  31
-#define VFE_ROLL_OFF_UPDATE  33
-#define VFE_DEMOSAICv3_BPC_UPDATE  34
-#define VFE_TESTGEN_START  35
-#define VFE_STATS_MA  0xFFFFFFFF
-
-struct msg_id_map msgs_map[] = {
-	{MSG_RESET_ACK, MSG_ID_RESET_ACK},
-	{MSG_STOP_ACK, MSG_ID_STOP_ACK},
-	{MSG_SNAPSHOT, MSG_ID_SNAPSHOT_DONE},
-	{MSG_ILLEGAL_COMMAND, VFE_MAX},
-	{MSG_START_ACK, MSG_ID_START_ACK},
-	{MSG_UPDATE_ACK, MSG_ID_UPDATE_ACK},
-	{MSG_OUTPUT1, VFE_MAX},
-	{MSG_OUTPUT2, VFE_MAX},
-	{MSG_STATS_AF, MSG_ID_STATS_AF},
-	{MSG_STATS_WE, MSG_ID_STATS_AWB_AEC},
-	{MSG_STATS_HISTOGRAM, MSG_ID_STATS_IHIST},
-	{MSG_EPOCH1, MSG_ID_EPOCH1},
-	{MSG_EPOCH2, MSG_ID_EPOCH2},
-	{MSG_VFE_ERROR, MSG_ID_CAMIF_ERROR},
-	{MSG_SYNC_TIMER1_DONE, MSG_ID_SYNC_TIMER1_DONE},
-	{MSG_SYNC_TIMER2_DONE, MSG_ID_SYNC_TIMER2_DONE},
-	{MSG_ASYNC_TIMER1_DONE, MSG_ID_ASYNC_TIMER1_DONE},
-	{MSG_ASYNC_TIMER2_DONE, MSG_ID_ASYNC_TIMER2_DONE},
-	{MSG_CAPTURE_COMPLETE, MSG_CAPTURE_COMPLETE},
-	{MSG_TABLE_CMD_ACK, MSG_TABLE_CMD_ACK},
-	{MSG_EXP_TIMEOUT_ACK, MSG_EXP_TIMEOUT_ACK},
-	{MSG_SOF, MSG_ID_SOF_ACK},
-	{MSG_OUTPUT_T, MSG_ID_OUTPUT_T},
-	{MSG_OUTPUT_S, MSG_ID_OUTPUT_S},
-};
-
-struct cmd_id_map cmds_map[] = {
-	{VFE_CMD_DUMMY_0, VFE_MAX, VFE_MAX},
-	{VFE_CMD_SET_CLK, VFE_MAX, VFE_MAX},
-	{VFE_CMD_RESET, VFE_RESET, QDSP_CMDQUEUE,
-			"VFE_CMD_RESET", "VFE_RESET"},
-	{VFE_CMD_START, VFE_START, QDSP_CMDQUEUE,
-			"VFE_CMD_START", "VFE_START"},
-	{VFE_CMD_TEST_GEN_START, VFE_TESTGEN_START, QDSP_CMDQUEUE,
-		"VFE_CMD_TEST_GEN_START", "VFE_TESTGEN_START"},
-	{VFE_CMD_OPERATION_CFG, VFE_MAX , VFE_MAX},
-	{VFE_CMD_AXI_OUT_CFG, VFE_AXI_OUTPUT_CONFIG, QDSP_TABLEQUEUE,
-		"VFE_CMD_AXI_OUT_CFG", "VFE_AXI_OUTPUT_CONFIG"},
-	{VFE_CMD_CAMIF_CFG, VFE_CAMIF_CONFIG, QDSP_CMDQUEUE,
-			"VFE_CMD_CAMIF_CFG", "VFE_CAMIF_CONFIG"},
-	{VFE_CMD_AXI_INPUT_CFG, VFE_AXI_INPUT_CONFIG, QDSP_TABLEQUEUE,
-		"VFE_CMD_AXI_INPUT_CFG", "VFE_AXI_INPUT_CONFIG"},
-	{VFE_CMD_BLACK_LEVEL_CFG, VFE_BLACK_LEVEL_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_BLACK_LEVEL_CFG", "VFE_BLACK_LEVEL_CONFIG"},
-	{VFE_CMD_MESH_ROLL_OFF_CFG, VFE_ROLL_OFF_CONFIG, QDSP_TABLEQUEUE,
-		"VFE_CMD_MESH_ROLL_OFF_CFG", "VFE_ROLL_OFF_CONFIG"},
-	{VFE_CMD_DEMUX_CFG, VFE_INPUT_FORMAT_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_DEMUX_CFG", "VFE_INPUT_FORMAT_CONFIG"},
-	{VFE_CMD_FOV_CFG, VFE_FOV_CROP, QDSP_CMDQUEUE,
-		"VFE_CMD_FOV_CFG", "VFE_FOV_CROP"},
-	{VFE_CMD_MAIN_SCALER_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_WB_CFG, VFE_WHITE_BALANCE_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_WB_CFG", "VFE_WHITE_BALANCE_CONFIG"},
-	{VFE_CMD_COLOR_COR_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_RGB_G_CFG, VFE_RGB_GAMMA_CONFIG, QDSP_TABLEQUEUE,
-		"VFE_CMD_RGB_G_CFG", "VFE_RGB_GAMMA_CONFIG"},
-	{VFE_CMD_LA_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_CHROMA_EN_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_CHROMA_SUP_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_MCE_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_SK_ENHAN_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_ASF_CFG, VFE_ADAPTIVE_FILTER_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_ASF_CFG", "VFE_ADAPTIVE_FILTER_CONFIG"},
-	{VFE_CMD_S2Y_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_S2CbCr_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_CHROMA_SUBS_CFG, VFE_CHROMA_SUBSAMPLE_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_CHROMA_SUBS_CFG", "VFE_CHROMA_SUBSAMPLE_CONFIG"},
-	{VFE_CMD_OUT_CLAMP_CFG, VFE_OUTPUT_CLAMP_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_OUT_CLAMP_CFG", "VFE_OUTPUT_CLAMP_CONFIG"},
-	{VFE_CMD_FRAME_SKIP_CFG, VFE_FRAME_SKIP_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_FRAME_SKIP_CFG", "VFE_FRAME_SKIP_CONFIG"},
-	{VFE_CMD_DUMMY_1, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DUMMY_2, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DUMMY_3, VFE_MAX, VFE_MAX},
-	{VFE_CMD_UPDATE, VFE_UPDATE, QDSP_CMDQUEUE,
-		"VFE_CMD_UPDATE", "VFE_UPDATE"},
-	{VFE_CMD_BL_LVL_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DEMUX_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_FOV_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_MAIN_SCALER_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_WB_UPDATE, VFE_WHITE_BALANCE_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_WB_UPDATE", "VFE_WHITE_BALANCE_CONFIG"},
-	{VFE_CMD_COLOR_COR_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_RGB_G_UPDATE, VFE_RGB_GAMMA_CONFIG, QDSP_TABLEQUEUE,
-		"VFE_CMD_RGB_G_UPDATE", "VFE_RGB_GAMMA_CONFIG"},
-	{VFE_CMD_LA_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_CHROMA_EN_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_CHROMA_SUP_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_MCE_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_SK_ENHAN_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_S2CbCr_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_S2Y_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_ASF_UPDATE, VFE_ADAPTIVE_FILTER_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_ASF_UPDATE", "VFE_ADAPTIVE_FILTER_CONFIG"},
-	{VFE_CMD_FRAME_SKIP_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_CAMIF_FRAME_UPDATE, VFE_UPDATE_CAMIF_FRAME_CONFIG,
-		QDSP_CMDQUEUE, "VFE_CMD_CAMIF_FRAME_UPDATE",
-		"VFE_UPDATE_CAMIF_FRAME_CONFIG"},
-	{VFE_CMD_STATS_AF_UPDATE, VFE_STATS_AUTOFOCUS_UPDATE, QDSP_CMDQUEUE,
-		"VFE_CMD_STATS_AF_UPDATE", "VFE_STATS_AUTOFOCUS_UPDATE"},
-	{VFE_CMD_STATS_AE_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_AWB_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_RS_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_CS_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_SKIN_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_IHIST_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DUMMY_4, VFE_MAX, VFE_MAX},
-	{VFE_CMD_EPOCH1_ACK, VFE_EPOCH1_ACK, QDSP_CMDQUEUE,
-			"VFE_CMD_EPOCH1_ACK", "VFE_EPOCH1_ACK"},
-	{VFE_CMD_EPOCH2_ACK, VFE_EPOCH2_ACK, QDSP_CMDQUEUE,
-			"VFE_CMD_EPOCH2_ACK", "VFE_EPOCH2_ACK"},
-	{VFE_CMD_START_RECORDING, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STOP_RECORDING, VFE_MAX , VFE_MAX},
-	{VFE_CMD_DUMMY_5, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DUMMY_6, VFE_MAX, VFE_MAX},
-	{VFE_CMD_CAPTURE, VFE_START, QDSP_CMDQUEUE,
-			"VFE_CMD_CAPTURE", "VFE_START"},
-	{VFE_CMD_DUMMY_7, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STOP, VFE_STOP, QDSP_CMDQUEUE, "VFE_CMD_STOP", "VFE_STOP"},
-	{VFE_CMD_GET_HW_VERSION, VFE_MAX, VFE_MAX},
-	{VFE_CMD_GET_FRAME_SKIP_COUNTS, VFE_MAX, VFE_MAX},
-	{VFE_CMD_OUTPUT1_BUFFER_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_OUTPUT2_BUFFER_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_OUTPUT3_BUFFER_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_JPEG_OUT_BUF_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_RAW_OUT_BUF_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_RAW_IN_BUF_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_AF_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_AE_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_AWB_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_RS_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_CS_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_SKIN_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_IHIST_ENQ, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DUMMY_8, VFE_MAX, VFE_MAX},
-	{VFE_CMD_JPEG_ENC_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DUMMY_9, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_AF_START, VFE_STATS_AUTOFOCUS_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_STATS_AF_START", "VFE_STATS_AUTOFOCUS_CONFIG"},
-	{VFE_CMD_STATS_AF_STOP, VFE_STATS_AUTOFOCUS_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_STATS_AF_STOP", "VFE_STATS_AUTOFOCUS_CONFIG"},
-	{VFE_CMD_STATS_AE_START, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_AE_STOP, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_AWB_START, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_AWB_STOP, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_RS_START, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_RS_STOP, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_CS_START, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_CS_STOP, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_SKIN_START, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_SKIN_STOP, VFE_MAX, VFE_MAX},
-	{VFE_CMD_STATS_IHIST_START, VFE_STATS_HISTOGRAM_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_STATS_IHIST_START", "VFE_STATS_HISTOGRAM_CONFIG"},
-	{VFE_CMD_STATS_IHIST_STOP, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DUMMY_10, VFE_MAX, VFE_MAX},
-	{VFE_CMD_SYNC_TIMER_SETTING, VFE_MAX, VFE_MAX},
-	{VFE_CMD_ASYNC_TIMER_SETTING, VFE_MAX, VFE_MAX},
-	{VFE_CMD_LIVESHOT, VFE_MAX, VFE_MAX},
-	{VFE_CMD_LA_SETUP, VFE_MAX, VFE_MAX},
-	{VFE_CMD_LINEARIZATION_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DEMOSAICV3, VFE_DEMOSAICv3_CFG, QDSP_TABLEQUEUE,
-		"VFE_CMD_DEMOSAICV3", "VFE_DEMOSAICv3_CFG"},
-	{VFE_CMD_DEMOSAICV3_ABCC_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DEMOSAICV3_DBCC_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DEMOSAICV3_DBPC_CFG, VFE_DEMOSAICv3_BPC_CFG, QDSP_TABLEQUEUE,
-		"VFE_CMD_DEMOSAICV3_DBPC_CFG", "VFE_DEMOSAICv3_BPC_CFG"},
-	{VFE_CMD_DEMOSAICV3_ABF_CFG, VFE_DEMOSAICv3_ABF_CFG, QDSP_TABLEQUEUE,
-		"VFE_CMD_DEMOSAICV3_ABF_CFG", "VFE_DEMOSAICv3_ABF_CFG"},
-	{VFE_CMD_DEMOSAICV3_ABCC_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DEMOSAICV3_DBCC_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DEMOSAICV3_DBPC_UPDATE, VFE_DEMOSAICv3_BPC_UPDATE,
-		QDSP_CMDQUEUE, "VFE_CMD_DEMOSAICV3_DBPC_UPDATE",
-		"VFE_DEMOSAICv3_BPC_UPDATE"},
-	{VFE_CMD_XBAR_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_MODULE_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_ZSL, VFE_START, QDSP_CMDQUEUE,
-			"VFE_CMD_ZSL", "VFE_START"},
-	{VFE_CMD_LINEARIZATION_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DEMOSAICV3_ABF_UPDATE, VFE_DEMOSAICv3_ABF_CFG,
-		QDSP_TABLEQUEUE, "VFE_CMD_DEMOSAICV3_ABF_UPDATE",
-		"VFE_DEMOSAICv3_ABF_CFG"},
-	{VFE_CMD_CLF_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_CLF_LUMA_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_CLF_CHROMA_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_PCA_ROLL_OFF_CFG, VFE_MAX, VFE_MAX},
-	{VFE_CMD_PCA_ROLL_OFF_UPDATE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_GET_REG_DUMP, VFE_MAX, VFE_MAX},
-	{VFE_CMD_GET_LINEARIZATON_TABLE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_GET_MESH_ROLLOFF_TABLE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_GET_PCA_ROLLOFF_TABLE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_GET_RGB_G_TABLE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_GET_LA_TABLE, VFE_MAX, VFE_MAX},
-	{VFE_CMD_DEMOSAICV3_UPDATE, VFE_DEMOSAICv3_CFG, QDSP_TABLEQUEUE,
-		"VFE_CMD_DEMOSAICV3_UPDATE", "VFE_DEMOSAICv3_CFG"},
-	{VFE_CMD_ACTIVE_REGION_CFG, VFE_ACTIVE_REGION_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_ACTIVE_REGION_CFG", "VFE_ACTIVE_REGION_CONFIG"},
-	{VFE_CMD_COLOR_PROCESSING_CONFIG, VFE_COLOR_PROCESSING_CONFIG,
-		QDSP_CMDQUEUE, "VFE_CMD_COLOR_PROCESSING_CONFIG",
-		"VFE_COLOR_PROCESSING_CONFIG"},
-	{VFE_CMD_STATS_WB_AEC_CONFIG, VFE_STATS_WB_EXP_CONFIG, QDSP_CMDQUEUE,
-		"VFE_CMD_STATS_WB_AEC_CONFIG", "VFE_STATS_WB_EXP_CONFIG"},
-	{VFE_CMD_STATS_WB_AEC_UPDATE, VFE_STATS_WB_EXP_UPDATE, QDSP_CMDQUEUE,
-		"VFE_CMD_STATS_WB_AEC_UPDATE", "VFE_STATS_WB_EXP_UPDATE"},
-	{VFE_CMD_Y_GAMMA_CONFIG, VFE_Y_GAMMA_CONFIG, QDSP_TABLEQUEUE,
-		"VFE_CMD_Y_GAMMA_CONFIG", "VFE_Y_GAMMA_CONFIG"},
-	{VFE_CMD_SCALE_OUTPUT1_CONFIG, VFE_SCALE_OUTPUT1_CONFIG,
-		QDSP_SCALEQUEUE, "VFE_CMD_SCALE_OUTPUT1_CONFIG",
-		"VFE_SCALE_OUTPUT1_CONFIG"},
-	{VFE_CMD_SCALE_OUTPUT2_CONFIG, VFE_SCALE_OUTPUT2_CONFIG,
-		QDSP_SCALEQUEUE, "VFE_CMD_SCALE_OUTPUT2_CONFIG",
-		"VFE_SCALE_OUTPUT2_CONFIG"},
-	{VFE_CMD_CAPTURE_RAW, VFE_START, QDSP_CMDQUEUE,
-			"VFE_CMD_CAPTURE_RAW", "VFE_START"},
-	{VFE_CMD_STOP_LIVESHOT, VFE_MAX, VFE_MAX},
-	{VFE_CMD_RECONFIG_VFE, VFE_MAX, VFE_MAX},
-};
-
-
-static struct msm_adsp_module *qcam_mod;
-static struct msm_adsp_module *vfe_mod;
-static void *extdata;
-static uint32_t extlen;
-
-struct mutex vfe_lock;
-static uint8_t vfestopped;
-
-static struct stop_event stopevent;
-
-static uint32_t op_mode;
-static uint32_t raw_mode;
-static struct vfe2x_ctrl_type *vfe2x_ctrl;
-
-static unsigned long vfe2x_stats_dqbuf(enum msm_stats_enum_type stats_type)
-{
-	struct msm_stats_meta_buf *buf = NULL;
-	int rc = 0;
-
-	rc = vfe2x_ctrl->stats_ops.dqbuf(vfe2x_ctrl->stats_ops.stats_ctrl,
-							  stats_type, &buf);
-	if (rc < 0) {
-		CDBG("%s: dq stats buf (type = %d) err = %d",
-			   __func__, stats_type, rc);
-		return 0;
-	}
-	return buf->paddr;
-}
-
-static unsigned long vfe2x_stats_flush_enqueue(
-	enum msm_stats_enum_type stats_type)
-{
-	struct msm_stats_bufq *bufq = NULL;
-	struct msm_stats_meta_buf *stats_buf = NULL;
-	int rc = 0;
-	int i;
-
-	/*
-	 * Passing NULL for ion client as the buffers are already
-	 * mapped at this stage, client is not required, flush all
-	 * the buffers, and buffers move to PREPARE state
-	 */
-	rc = vfe2x_ctrl->stats_ops.bufq_flush(
-			vfe2x_ctrl->stats_ops.stats_ctrl,
-			stats_type, NULL);
-	if (rc < 0) {
-		pr_err("%s: dq stats buf (type = %d) err = %d",
-			 __func__, stats_type, rc);
-		return 0L;
-	}
-
-	/* Queue all the buffers back to QUEUED state */
-	bufq = vfe2x_ctrl->stats_ctrl.bufq[stats_type];
-	for (i = 0; i < bufq->num_bufs; i++) {
-		stats_buf = &bufq->bufs[i];
-		rc = vfe2x_ctrl->stats_ops.enqueue_buf(
-				vfe2x_ctrl->stats_ops.stats_ctrl,
-				&(stats_buf->info), NULL, -1);
-			if (rc < 0) {
-				pr_err("%s: dq stats buf (type = %d) err = %d",
-					 __func__, stats_type, rc);
-				return rc;
-			}
-	}
-	return 0L;
-}
-
-static unsigned long vfe2x_stats_unregbuf(
-	struct msm_stats_reqbuf *req_buf)
-{
-	int i = 0, rc = 0;
-
-	for (i = 0; i < req_buf->num_buf; i++) {
-		rc = vfe2x_ctrl->stats_ops.buf_unprepare(
-			vfe2x_ctrl->stats_ops.stats_ctrl,
-			req_buf->stats_type, i,
-			vfe2x_ctrl->stats_ops.client, -1);
-		if (rc < 0) {
-			pr_err("%s: unreg stats buf (type = %d) err = %d",
-				__func__, req_buf->stats_type, rc);
-		return rc;
-		}
-	}
-	return 0L;
-}
-
-static int vfe2x_stats_buf_init(enum msm_stats_enum_type type)
-{
-	unsigned long flags;
-	int i = 0, rc = 0;
-	if (type == MSM_STATS_TYPE_AF) {
-		spin_lock_irqsave(&vfe2x_ctrl->stats_bufq_lock, flags);
-		rc = vfe2x_stats_flush_enqueue(MSM_STATS_TYPE_AF);
-		if (rc < 0) {
-			pr_err("%s: dq stats buf err = %d",
-				 __func__, rc);
-			spin_unlock_irqrestore(&vfe2x_ctrl->stats_bufq_lock,
-				flags);
-			return -EINVAL;
-		}
-		spin_unlock_irqrestore(&vfe2x_ctrl->stats_bufq_lock, flags);
-	}
-	for (i = 0; i < 3; i++) {
-		spin_lock_irqsave(&vfe2x_ctrl->stats_bufq_lock, flags);
-		if (type == MSM_STATS_TYPE_AE_AW)
-			vfe2x_ctrl->stats_we_buf_ptr[i] =
-				vfe2x_stats_dqbuf(type);
-		else
-			vfe2x_ctrl->stats_af_buf_ptr[i] =
-				vfe2x_stats_dqbuf(type);
-		spin_unlock_irqrestore(&vfe2x_ctrl->stats_bufq_lock, flags);
-		if (!vfe2x_ctrl->stats_we_buf_ptr[i]) {
-			pr_err("%s: dq error type %d ", __func__, type);
-			return -ENOMEM;
-		}
-	}
-	return rc;
-}
-
-static unsigned long vfe2x_stats_enqueuebuf(
-	struct msm_stats_buf_info *info, struct vfe_stats_ack *sack)
-{
-	struct msm_stats_bufq *bufq = NULL;
-	struct msm_stats_meta_buf *stats_buf = NULL;
-	struct msm_stats_meta_buf *buf = NULL;
-	int rc = 0;
-
-	bufq = vfe2x_ctrl->stats_ctrl.bufq[info->type];
-	stats_buf = &bufq->bufs[info->buf_idx];
-
-	CDBG("vfe2x_stats_enqueuebuf: %d\n", stats_buf->state);
-	if (stats_buf->state == MSM_STATS_BUFFER_STATE_INITIALIZED ||
-		stats_buf->state == MSM_STATS_BUFFER_STATE_PREPARED) {
-		rc = vfe2x_ctrl->stats_ops.enqueue_buf(
-				&vfe2x_ctrl->stats_ctrl,
-				info, vfe2x_ctrl->stats_ops.client, -1);
-		if (rc < 0) {
-			pr_err("%s: enqueue_buf (type = %d), index : %d, err = %d",
-				 __func__, info->type, info->buf_idx, rc);
-			return rc;
-		}
-
-	} else {
-		rc = vfe2x_ctrl->stats_ops.querybuf(
-				vfe2x_ctrl->stats_ops.stats_ctrl, info, &buf);
-		if (rc < 0) {
-			pr_err("%s: querybuf (type = %d), index : %d, err = %d",
-				__func__, info->type, info->buf_idx, rc);
-			return rc;
-	}
-		stats_buf->state = MSM_STATS_BUFFER_STATE_DEQUEUED;
-	if (info->type == MSM_STATS_TYPE_AE_AW) {
-		sack->header = VFE_STATS_WB_EXP_ACK;
-		sack->bufaddr = (void *)(uint32_t *)buf->paddr;
-	} else if (info->type == MSM_STATS_TYPE_AF) {
-		sack->header = VFE_STATS_AUTOFOCUS_ACK;
-		sack->bufaddr = (void *)(uint32_t *)buf->paddr;
-	} else
-		pr_err("%s: Invalid stats: should never come here\n", __func__);
-	}
-	return 0L;
-}
-
-static long vfe2x_stats_bufq_sub_ioctl(struct msm_vfe_cfg_cmd *cmd,
-	void *ion_client)
-{
-	long rc = 0;
-
-	switch (cmd->cmd_type) {
-	case VFE_CMD_STATS_REQBUF:
-		if (!vfe2x_ctrl->stats_ops.stats_ctrl) {
-			/* stats_ctrl has not been init yet */
-			rc = msm_stats_buf_ops_init(
-					&vfe2x_ctrl->stats_ctrl,
-					(struct ion_client *)ion_client,
-					&vfe2x_ctrl->stats_ops);
-			if (rc < 0) {
-				pr_err("%s: cannot init stats ops", __func__);
-				goto end;
-			}
-			rc = vfe2x_ctrl->stats_ops.stats_ctrl_init(
-					&vfe2x_ctrl->stats_ctrl);
-			if (rc < 0) {
-				pr_err("%s: cannot init stats_ctrl ops",
-					 __func__);
-				memset(&vfe2x_ctrl->stats_ops, 0,
-				sizeof(vfe2x_ctrl->stats_ops));
-				goto end;
-			}
-			if (sizeof(struct msm_stats_reqbuf) != cmd->length) {
-				/* error. the length not match */
-				pr_err("%s: stats reqbuf input size = %d,\n"
-					"struct size = %d, mismatch\n",
-					__func__, cmd->length,
-					sizeof(struct msm_stats_reqbuf));
-				rc = -EINVAL;
-				goto end;
-			}
-		}
-		rc = vfe2x_ctrl->stats_ops.reqbuf(
-				&vfe2x_ctrl->stats_ctrl,
-				(struct msm_stats_reqbuf *)cmd->value,
-				vfe2x_ctrl->stats_ops.client);
-		break;
-		case VFE_CMD_STATS_ENQUEUEBUF: {
-			if (sizeof(struct msm_stats_buf_info) != cmd->length) {
-				/* error. the length not match */
-				pr_err("%s: stats enqueuebuf input size = %d,\n"
-					"struct size = %d, mismatch\n",
-					 __func__, cmd->length,
-					sizeof(struct msm_stats_buf_info));
-				rc = -EINVAL;
-				goto end;
-		}
-		rc = vfe2x_ctrl->stats_ops.enqueue_buf(
-				&vfe2x_ctrl->stats_ctrl,
-				(struct msm_stats_buf_info *)cmd->value,
-				vfe2x_ctrl->stats_ops.client, -1);
-	}
-	break;
-	case VFE_CMD_STATS_FLUSH_BUFQ: {
-		struct msm_stats_flush_bufq *flush_req = NULL;
-		flush_req = (struct msm_stats_flush_bufq *)cmd->value;
-		if (sizeof(struct msm_stats_flush_bufq) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats flush queue input size = %d,\n"
-				"struct size = %d, mismatch\n",
-				__func__, cmd->length,
-				sizeof(struct msm_stats_flush_bufq));
-				rc = -EINVAL;
-				goto end;
-		}
-		rc = vfe2x_ctrl->stats_ops.bufq_flush(
-				&vfe2x_ctrl->stats_ctrl,
-				(enum msm_stats_enum_type)flush_req->stats_type,
-				vfe2x_ctrl->stats_ops.client);
-	}
-	break;
-	case VFE_CMD_STATS_UNREGBUF:
-	{
-		struct msm_stats_reqbuf *req_buf = NULL;
-		req_buf = (struct msm_stats_reqbuf *)cmd->value;
-		if (sizeof(struct msm_stats_reqbuf) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats reqbuf input size = %d,\n"
-				"struct size = %d, mitch match\n",
-				 __func__, cmd->length,
-				sizeof(struct msm_stats_reqbuf));
-			rc = -EINVAL ;
-			goto end;
-		}
-		rc = vfe2x_stats_unregbuf(req_buf);
-	}
-	break;
-	default:
-		rc = -1;
-		pr_err("%s: cmd_type %d not supported",
-			 __func__, cmd->cmd_type);
-	break;
-	}
-end:
-	return rc;
-}
-
-static void vfe2x_send_isp_msg(
-	struct vfe2x_ctrl_type *vctrl,
-	uint32_t isp_msg_id)
-{
-	struct isp_msg_event isp_msg_evt;
-
-	isp_msg_evt.msg_id = isp_msg_id;
-	isp_msg_evt.sof_count = vfe2x_ctrl->vfeFrameId;
-	v4l2_subdev_notify(&vctrl->subdev,
-			NOTIFY_ISP_MSG_EVT,
-			(void *)&isp_msg_evt);
-}
-
-static void vfe_send_outmsg(struct v4l2_subdev *sd, uint8_t msgid,
-		uint32_t ch0_paddr, uint32_t ch1_paddr)
-{
-	struct isp_msg_output msg;
-
-	msg.output_id = msgid;
-	msg.buf.inst_handle = 0;
-	msg.buf.ch_paddr[0]     = ch0_paddr;
-	msg.buf.ch_paddr[1]     = ch1_paddr;
-	msg.frameCounter = vfe2x_ctrl->vfeFrameId;
-
-	v4l2_subdev_notify(&vfe2x_ctrl->subdev,
-			NOTIFY_VFE_MSG_OUT,
-			&msg);
-	return;
-}
-
-static void vfe_send_stats_msg(uint32_t buf_addr, uint32_t msg_id)
-{
-	struct isp_msg_stats msg_stats;
-	void *vaddr = NULL;
-	int rc;
-
-	msg_stats.frameCounter = vfe2x_ctrl->vfeFrameId;
-	msg_stats.buffer       = buf_addr;
-	msg_stats.id           = msg_id;
-
-	if (MSG_ID_STATS_AWB_AEC == msg_id)
-		rc = vfe2x_ctrl->stats_ops.dispatch(
-			vfe2x_ctrl->stats_ops.stats_ctrl,
-			MSM_STATS_TYPE_AE_AW, buf_addr,
-			&msg_stats.buf_idx, &vaddr, &msg_stats.fd,
-			vfe2x_ctrl->stats_ops.client);
-	else if (MSG_ID_STATS_AF == msg_id)
-		rc = vfe2x_ctrl->stats_ops.dispatch(
-			vfe2x_ctrl->stats_ops.stats_ctrl,
-			MSM_STATS_TYPE_AF, buf_addr,
-			&msg_stats.buf_idx, &vaddr, &msg_stats.fd,
-			vfe2x_ctrl->stats_ops.client);
-
-	v4l2_subdev_notify(&vfe2x_ctrl->subdev,
-				NOTIFY_VFE_MSG_STATS,
-				&msg_stats);
-}
-
-static void vfe_7x_ops(void *driver_data, unsigned id, size_t len,
-		void (*getevent)(void *ptr, size_t len))
-{
-	uint32_t evt_buf[3];
-	void *data = NULL;
-	struct buf_info *outch = NULL;
-	uint32_t y_phy, cbcr_phy;
-	static uint32_t liveshot_y_phy;
-	static struct vfe_endframe liveshot_swap;
-	struct table_cmd *table_pending = NULL;
-	unsigned long flags;
-	void   *cmd_data = NULL;
-	unsigned char buf[256];
-	struct msm_free_buf *free_buf = NULL;
-	struct vfe_outputack fack;
-	int i;
-
-	CDBG("%s:id=%d\n", __func__, id);
-	if (id != VFE_ADSP_EVENT) {
-		data = kzalloc(len, GFP_ATOMIC);
-		if (!data) {
-			pr_err("%s: rp: cannot allocate buffer\n", __func__);
-			return;
-		}
-	}
-	if (id == VFE_ADSP_EVENT) {
-		/* event */
-		getevent(evt_buf, sizeof(evt_buf));
-		CDBG("%s:event:msg_id=%d\n", __func__, id);
-	} else {
-		/* messages */
-		getevent(data, len);
-		CDBG("%s:messages:msg_id=%d\n", __func__, id);
-
-		switch (id) {
-		case MSG_SNAPSHOT:
-			while (vfe2x_ctrl->snap.frame_cnt <
-				vfe2x_ctrl->num_snap) {
-				vfe_7x_ops(driver_data, MSG_OUTPUT_S, len,
-					getevent);
-				if (!raw_mode)
-					vfe_7x_ops(driver_data, MSG_OUTPUT_T,
-						len, getevent);
-			}
-			vfe2x_send_isp_msg(vfe2x_ctrl, MSG_ID_SNAPSHOT_DONE);
-			kfree(data);
-			return;
-		case MSG_OUTPUT_S:
-			outch = &vfe2x_ctrl->snap;
-			if (outch->frame_cnt == 0) {
-				y_phy = outch->ping.ch_paddr[0];
-				cbcr_phy = outch->ping.ch_paddr[1];
-			} else if (outch->frame_cnt == 1) {
-				y_phy = outch->pong.ch_paddr[0];
-				cbcr_phy = outch->pong.ch_paddr[1];
-			} else if (outch->frame_cnt == 2) {
-				y_phy = outch->free_buf.ch_paddr[0];
-				cbcr_phy = outch->free_buf.ch_paddr[1];
-			} else {
-				y_phy = outch->free_buf_arr[outch->frame_cnt
-					- 3].ch_paddr[0];
-				cbcr_phy = outch->free_buf_arr[outch->frame_cnt
-					- 3].ch_paddr[1];
-			}
-			outch->frame_cnt++;
-			CDBG("MSG_OUTPUT_S: %x %x %d\n",
-				(unsigned int)y_phy, (unsigned int)cbcr_phy,
-					outch->frame_cnt);
-			vfe_send_outmsg(&vfe2x_ctrl->subdev,
-					MSG_ID_OUTPUT_PRIMARY,
-						y_phy, cbcr_phy);
-			break;
-		case MSG_OUTPUT_T:
-			outch = &vfe2x_ctrl->thumb;
-			if (outch->frame_cnt == 0) {
-				y_phy = outch->ping.ch_paddr[0];
-				cbcr_phy = outch->ping.ch_paddr[1];
-			} else if (outch->frame_cnt == 1) {
-				y_phy = outch->pong.ch_paddr[0];
-				cbcr_phy = outch->pong.ch_paddr[1];
-			} else if (outch->frame_cnt == 2) {
-				y_phy = outch->free_buf.ch_paddr[0];
-				cbcr_phy = outch->free_buf.ch_paddr[1];
-			} else {
-				y_phy = outch->free_buf_arr[outch->frame_cnt
-					- 3].ch_paddr[0];
-				cbcr_phy = outch->free_buf_arr[outch->frame_cnt
-					- 3].ch_paddr[1];
-			}
-			outch->frame_cnt++;
-			CDBG("MSG_OUTPUT_T: %x %x %d\n",
-				(unsigned int)y_phy, (unsigned int)cbcr_phy,
-				outch->frame_cnt);
-			vfe_send_outmsg(&vfe2x_ctrl->subdev,
-						MSG_ID_OUTPUT_SECONDARY,
-							y_phy, cbcr_phy);
-			break;
-		case MSG_OUTPUT1:
-			if (op_mode & SNAPSHOT_MASK_MODE) {
-				kfree(data);
-				return;
-			} else {
-				free_buf = vfe2x_check_free_buffer(
-							VFE_MSG_OUTPUT_IRQ,
-							VFE_MSG_OUTPUT_SECONDARY
-							);
-				CDBG("free_buf = %x\n",
-						(unsigned int) free_buf);
-				if (free_buf) {
-					fack.header = VFE_OUTPUT1_ACK;
-
-					fack.output2newybufferaddress =
-						(void *)(free_buf->ch_paddr[0]);
-
-					fack.output2newcbcrbufferaddress =
-						(void *)(free_buf->ch_paddr[1]);
-
-					cmd_data = &fack;
-					len = sizeof(fack);
-					msm_adsp_write(vfe_mod, QDSP_CMDQUEUE,
-							cmd_data, len);
-			      } else {
-					fack.header = VFE_OUTPUT1_ACK;
-					fack.output2newybufferaddress =
-					(void *)
-				((struct vfe_endframe *)data)->y_address;
-					fack.output2newcbcrbufferaddress =
-					(void *)
-				((struct vfe_endframe *)data)->cbcr_address;
-					cmd_data = &fack;
-					len = sizeof(fack);
-					msm_adsp_write(vfe_mod, QDSP_CMDQUEUE,
-						cmd_data, len);
-					if (!vfe2x_ctrl->zsl_mode) {
-						kfree(data);
-						return;
-					}
-				}
-			}
-			y_phy = ((struct vfe_endframe *)data)->y_address;
-			cbcr_phy = ((struct vfe_endframe *)data)->cbcr_address;
-
-
-			CDBG("vfe_7x_convert, y_phy = 0x%x, cbcr_phy = 0x%x\n",
-				 y_phy, cbcr_phy);
-			if (free_buf) {
-				for (i = 0; i < 3; i++) {
-					if (vfe2x_ctrl->free_buf.buf[i].
-							ch_paddr[0] == y_phy) {
-						vfe2x_ctrl->free_buf.
-							buf[i].ch_paddr[0] =
-							free_buf->ch_paddr[0];
-						vfe2x_ctrl->free_buf.
-							buf[i].ch_paddr[1] =
-							free_buf->ch_paddr[1];
-						break;
-					}
-				}
-				if (i == 3)
-					CDBG("Address doesnt match\n");
-			}
-			memcpy(((struct vfe_frame_extra *)extdata),
-				&((struct vfe_endframe *)data)->extra,
-				sizeof(struct vfe_frame_extra));
-
-			vfe2x_ctrl->vfeFrameId =
-				((struct vfe_frame_extra *)extdata)->frame_id;
-			vfe_send_outmsg(&vfe2x_ctrl->subdev,
-						MSG_ID_OUTPUT_SECONDARY,
-						y_phy, cbcr_phy);
-			break;
-		case MSG_OUTPUT2:
-			if (op_mode & SNAPSHOT_MASK_MODE) {
-				kfree(data);
-				return;
-			}
-			free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_OUTPUT_PRIMARY);
-			CDBG("free_buf = %x\n",
-					(unsigned int) free_buf);
-			spin_lock_irqsave(
-					&vfe2x_ctrl->liveshot_enabled_lock,
-					flags);
-			if (!vfe2x_ctrl->liveshot_enabled) {
-				spin_unlock_irqrestore(
-						&vfe2x_ctrl->
-						liveshot_enabled_lock,
-						flags);
-				if (free_buf) {
-					fack.header = VFE_OUTPUT2_ACK;
-
-					fack.output2newybufferaddress =
-						(void *)
-						(free_buf->ch_paddr[0]);
-
-					fack.output2newcbcrbufferaddress =
-						(void *)
-						(free_buf->ch_paddr[1]);
-
-					cmd_data = &fack;
-					len = sizeof(fack);
-					msm_adsp_write(vfe_mod,
-							QDSP_CMDQUEUE,
-							cmd_data, len);
-				} else {
-					fack.header = VFE_OUTPUT2_ACK;
-					fack.output2newybufferaddress =
-						(void *)
-						((struct vfe_endframe *)
-						 data)->y_address;
-					fack.output2newcbcrbufferaddress =
-						(void *)
-						((struct vfe_endframe *)
-						 data)->cbcr_address;
-					cmd_data = &fack;
-					len = sizeof(fack);
-					msm_adsp_write(vfe_mod,
-							QDSP_CMDQUEUE,
-							cmd_data, len);
-					if (!vfe2x_ctrl->zsl_mode) {
-						kfree(data);
-						return;
-					}
-				}
-			} else { /* Live snapshot */
-				spin_unlock_irqrestore(
-						&vfe2x_ctrl->
-						liveshot_enabled_lock,
-						flags);
-				if (free_buf) {
-					/* liveshot_swap to enqueue
-					   when liveshot snapshot buffer
-					   is obtainedi from adsp */
-					liveshot_swap.y_address =
-						((struct vfe_endframe *)
-						 data)->y_address;
-					liveshot_swap.cbcr_address =
-						((struct vfe_endframe *)
-						 data)->cbcr_address;
-
-					fack.header = VFE_OUTPUT2_ACK;
-
-					fack.output2newybufferaddress =
-						(void *)
-						(free_buf->ch_paddr[0]);
-
-					fack.output2newcbcrbufferaddress =
-						(void *)
-						(free_buf->ch_paddr[1]);
-
-					liveshot_y_phy =
-						(uint32_t)
-						fack.output2newybufferaddress;
-
-					cmd_data = &fack;
-					len = sizeof(fack);
-					msm_adsp_write(vfe_mod,
-							QDSP_CMDQUEUE,
-							cmd_data, len);
-				} else if (liveshot_y_phy !=
-						((struct vfe_endframe *)
-						 data)->y_address) {
-
-					fack.header = VFE_OUTPUT2_ACK;
-					fack.output2newybufferaddress =
-						(void *)
-						((struct vfe_endframe *)
-						 data)->y_address;
-
-					fack.output2newcbcrbufferaddress =
-						(void *)
-						((struct vfe_endframe *)
-						 data)->cbcr_address;
-
-					cmd_data = &fack;
-					len = sizeof(fack);
-					msm_adsp_write(vfe_mod,
-							QDSP_CMDQUEUE,
-							cmd_data, len);
-					kfree(data);
-					return;
-				} else {
-					/* Enque data got
-					 * during freebuf */
-					fack.header = VFE_OUTPUT2_ACK;
-					fack.output2newybufferaddress =
-						(void *)
-						(liveshot_swap.y_address);
-
-					fack.output2newcbcrbufferaddress =
-						(void *)
-						(liveshot_swap.cbcr_address);
-					cmd_data = &fack;
-					len = sizeof(fack);
-					msm_adsp_write(vfe_mod,
-							QDSP_CMDQUEUE,
-							cmd_data, len);
-				}
-			}
-			y_phy = ((struct vfe_endframe *)data)->
-				y_address;
-			cbcr_phy = ((struct vfe_endframe *)data)->
-				cbcr_address;
-
-
-			CDBG("MSG_OUT2:y_phy= 0x%x, cbcr_phy= 0x%x\n",
-					y_phy, cbcr_phy);
-			if (free_buf) {
-				for (i = 0; i < 3; i++) {
-					if (vfe2x_ctrl->free_buf.buf[i].
-							ch_paddr[0] == y_phy) {
-						vfe2x_ctrl->free_buf.
-							buf[i].ch_paddr[0] =
-							free_buf->ch_paddr[0];
-						vfe2x_ctrl->free_buf.
-							buf[i].ch_paddr[1] =
-							free_buf->ch_paddr[1];
-						break;
-					}
-				}
-				if (i == 3)
-					CDBG("Address doesnt match\n");
-			}
-			memcpy(((struct vfe_frame_extra *)extdata),
-					&((struct vfe_endframe *)data)->extra,
-					sizeof(struct vfe_frame_extra));
-
-			vfe2x_ctrl->vfeFrameId =
-				((struct vfe_frame_extra *)extdata)->
-				frame_id;
-
-			if (!vfe2x_ctrl->liveshot_enabled) {
-				/* Liveshot not enalbed */
-				vfe_send_outmsg(&vfe2x_ctrl->subdev,
-						MSG_ID_OUTPUT_PRIMARY,
-						y_phy, cbcr_phy);
-			} else if (liveshot_y_phy == y_phy) {
-				vfe_send_outmsg(&vfe2x_ctrl->subdev,
-						MSG_ID_OUTPUT_PRIMARY,
-						y_phy, cbcr_phy);
-			}
-			break;
-		case MSG_RESET_ACK:
-		case MSG_START_ACK:
-		case MSG_UPDATE_ACK:
-		case MSG_VFE_ERROR:
-		case MSG_SYNC_TIMER1_DONE:
-		case MSG_SYNC_TIMER2_DONE:
-			vfe2x_send_isp_msg(vfe2x_ctrl, msgs_map[id].isp_id);
-			if (id == MSG_START_ACK)
-				vfe2x_ctrl->vfe_started = 1;
-			if (id == MSG_VFE_ERROR) {
-				uint16_t *ptr;
-				struct vfe_error_msg *VFE_ErrorMessageBuffer
-					= data;
-				ptr = data;
-				CDBG("Error: %x %x\n", ptr[0], ptr[1]);
-				CDBG("CAMIF_Error              = %d\n",
-					VFE_ErrorMessageBuffer->camif_error);
-				CDBG("output1YBusOverflow      = %d\n",
-					VFE_ErrorMessageBuffer->
-					output1ybusoverflow);
-				CDBG("output1CbCrBusOverflow   = %d\n",
-					VFE_ErrorMessageBuffer->
-					output1cbcrbusoverflow);
-				CDBG("output2YBusOverflow      = %d\n",
-					VFE_ErrorMessageBuffer->
-					output2ybusoverflow);
-				CDBG("output2CbCrBusOverflow   = %d\n",
-						VFE_ErrorMessageBuffer->
-						output2cbcrbusoverflow);
-				CDBG("autofocusStatBusOverflow = %d\n",
-						VFE_ErrorMessageBuffer->
-						autofocusstatbusoverflow);
-				CDBG("WB_EXPStatBusOverflow    = %d\n",
-						VFE_ErrorMessageBuffer->
-						wb_expstatbusoverflow);
-				CDBG("AXIError                 = %d\n",
-						VFE_ErrorMessageBuffer->
-						axierror);
-				CDBG("CAMIF_Staus              = %d\n",
-						VFE_ErrorMessageBuffer->
-						camif_staus);
-				CDBG("pixel_count              = %d\n",
-						VFE_ErrorMessageBuffer->
-						pixel_count);
-				CDBG("line_count               = %d\n",
-						VFE_ErrorMessageBuffer->
-						line_count);
-			}
-			break;
-		case MSG_SOF:
-			vfe2x_ctrl->vfeFrameId++;
-			if (vfe2x_ctrl->vfeFrameId == 0)
-				vfe2x_ctrl->vfeFrameId = 1; /* wrapped back */
-			if ((op_mode & SNAPSHOT_MASK_MODE) && !raw_mode
-				&& (vfe2x_ctrl->num_snap <= 1)) {
-				CDBG("Ignore SOF for snapshot\n");
-				kfree(data);
-				return;
-			}
-			vfe2x_send_isp_msg(vfe2x_ctrl, MSG_ID_SOF_ACK);
-			if (raw_mode)
-				vfe2x_send_isp_msg(vfe2x_ctrl,
-						MSG_ID_START_ACK);
-			break;
-		case MSG_STOP_ACK:
-			stopevent.state = 1;
-			vfe2x_ctrl->vfe_started = 0;
-			wake_up(&stopevent.wait);
-			vfe2x_send_isp_msg(vfe2x_ctrl, MSG_ID_STOP_ACK);
-			break;
-		case MSG_STATS_AF:
-		case MSG_STATS_WE:
-			vfe_send_stats_msg(*(uint32_t *)data,
-						msgs_map[id].isp_id);
-			break;
-		default:
-			if (MSG_TABLE_CMD_ACK != id)
-				vfe2x_send_isp_msg(vfe2x_ctrl,
-						msgs_map[id].isp_id);
-			break;
-		}
-	}
-	if (MSG_TABLE_CMD_ACK == id) {
-		spin_lock_irqsave(&vfe2x_ctrl->table_lock, flags);
-		vfe2x_ctrl->tableack_pending = 0;
-		if (list_empty(&vfe2x_ctrl->table_q)) {
-			if (vfe2x_ctrl->start_pending) {
-				CDBG("Send START\n");
-				cmd_data = buf;
-				*(uint32_t *)cmd_data = VFE_START;
-				memcpy(((char *)cmd_data) + 4,
-					&vfe2x_ctrl->start_cmd,
-					sizeof(vfe2x_ctrl->start_cmd));
-				/* Send Start cmd here */
-				len  = sizeof(vfe2x_ctrl->start_cmd) + 4;
-				msm_adsp_write(vfe_mod, QDSP_CMDQUEUE,
-						cmd_data, len);
-				vfe2x_ctrl->start_pending = 0;
-			} else if (vfe2x_ctrl->stop_pending) {
-				CDBG("Send STOP\n");
-				cmd_data = buf;
-				*(uint32_t *)cmd_data = VFE_STOP;
-				/* Send Stop cmd here */
-				len  = 4;
-				msm_adsp_write(vfe_mod, QDSP_CMDQUEUE,
-						cmd_data, len);
-				vfe2x_ctrl->stop_pending = 0;
-			} else if (vfe2x_ctrl->update_pending) {
-				CDBG("Send Update\n");
-				cmd_data = buf;
-				*(uint32_t *)cmd_data = VFE_UPDATE;
-				/* Send Update cmd here */
-				len  = 4;
-				msm_adsp_write(vfe_mod, QDSP_CMDQUEUE,
-						cmd_data, len);
-				vfe2x_ctrl->update_pending = 0;
-			}
-			spin_unlock_irqrestore(&vfe2x_ctrl->table_lock, flags);
-			kfree(data);
-			return;
-		}
-		table_pending = list_first_entry(&vfe2x_ctrl->table_q,
-					struct table_cmd, list);
-		if (!table_pending) {
-			spin_unlock_irqrestore(&vfe2x_ctrl->table_lock, flags);
-			kfree(data);
-			return;
-		}
-		msm_adsp_write(vfe_mod, table_pending->queue,
-				table_pending->cmd, table_pending->size);
-		list_del(&table_pending->list);
-		kfree(table_pending->cmd);
-		kfree(table_pending);
-		vfe2x_ctrl->tableack_pending = 1;
-		spin_unlock_irqrestore(&vfe2x_ctrl->table_lock, flags);
-	} else if (!vfe2x_ctrl->tableack_pending) {
-		if (!list_empty(&vfe2x_ctrl->table_q)) {
-			kfree(data);
-			return;
-		}
-	}
-	kfree(data);
-}
-
-static struct msm_adsp_ops vfe_7x_sync = {
-	.event = vfe_7x_ops,
-};
-
-static int vfe_7x_config_axi(int mode,
-	struct buf_info *ad, struct axiout *ao)
-{
-	unsigned long *bptr;
-	int    cnt;
-	int rc = 0;
-	int o_mode = 0;
-	unsigned long flags;
-
-	if (op_mode & SNAPSHOT_MASK_MODE)
-		o_mode = SNAPSHOT_MASK_MODE;
-
-	if ((o_mode == SNAPSHOT_MASK_MODE) && (vfe2x_ctrl->num_snap > 1)) {
-		CDBG("%s: BURST mode freebuf cnt %d", __func__,
-			ad->free_buf_cnt);
-		/* Burst */
-		if (mode == OUTPUT_SEC) {
-			ao->output1buffer1_y_phy = ad->ping.ch_paddr[0];
-			ao->output1buffer1_cbcr_phy = ad->ping.ch_paddr[1];
-			ao->output1buffer2_y_phy = ad->pong.ch_paddr[0];
-			ao->output1buffer2_cbcr_phy = ad->pong.ch_paddr[1];
-			ao->output1buffer3_y_phy = ad->free_buf.ch_paddr[0];
-			ao->output1buffer3_cbcr_phy = ad->free_buf.ch_paddr[1];
-			bptr = &ao->output1buffer4_y_phy;
-			for (cnt = 0; cnt < 5; cnt++) {
-				*bptr = (cnt < ad->free_buf_cnt-3) ?
-					ad->free_buf_arr[cnt].ch_paddr[0] :
-						ad->pong.ch_paddr[0];
-				bptr++;
-				*bptr = (cnt < ad->free_buf_cnt-3) ?
-					ad->free_buf_arr[cnt].ch_paddr[1] :
-						ad->pong.ch_paddr[1];
-				bptr++;
-			}
-			CDBG("%x %x\n", (unsigned int)ao->output1buffer1_y_phy,
-				(unsigned int)ao->output1buffer1_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output1buffer2_y_phy,
-				(unsigned int)ao->output1buffer2_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output1buffer3_y_phy,
-				(unsigned int)ao->output1buffer3_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output1buffer4_y_phy,
-				(unsigned int)ao->output1buffer4_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output1buffer5_y_phy,
-				(unsigned int)ao->output1buffer5_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output1buffer6_y_phy,
-				(unsigned int)ao->output1buffer6_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output1buffer7_y_phy,
-				(unsigned int)ao->output1buffer7_cbcr_phy);
-		} else { /*Primary*/
-			ao->output2buffer1_y_phy = ad->ping.ch_paddr[0];
-			ao->output2buffer1_cbcr_phy = ad->ping.ch_paddr[1];
-			ao->output2buffer2_y_phy = ad->pong.ch_paddr[0];
-			ao->output2buffer2_cbcr_phy = ad->pong.ch_paddr[1];
-			ao->output2buffer3_y_phy = ad->free_buf.ch_paddr[0];
-			ao->output2buffer3_cbcr_phy = ad->free_buf.ch_paddr[1];
-			bptr = &ao->output2buffer4_y_phy;
-			for (cnt = 0; cnt < 5; cnt++) {
-				*bptr = (cnt < ad->free_buf_cnt-3) ?
-					ad->free_buf_arr[cnt].ch_paddr[0] :
-						ad->pong.ch_paddr[0];
-				bptr++;
-				*bptr = (cnt < ad->free_buf_cnt-3) ?
-					ad->free_buf_arr[cnt].ch_paddr[1] :
-						ad->pong.ch_paddr[1];
-				bptr++;
-			}
-			CDBG("%x %x\n", (unsigned int)ao->output2buffer1_y_phy,
-				(unsigned int)ao->output2buffer1_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output2buffer2_y_phy,
-				(unsigned int)ao->output2buffer2_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output2buffer3_y_phy,
-				(unsigned int)ao->output2buffer3_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output2buffer4_y_phy,
-				(unsigned int)ao->output2buffer4_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output2buffer5_y_phy,
-				(unsigned int)ao->output2buffer5_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output2buffer6_y_phy,
-				(unsigned int)ao->output2buffer6_cbcr_phy);
-			CDBG("%x %x\n", (unsigned int)ao->output2buffer7_y_phy,
-				(unsigned int)ao->output2buffer7_cbcr_phy);
-		}
-	} else if (mode == OUTPUT_SEC) {
-		/* Thumbnail */
-		if (vfe2x_ctrl->zsl_mode) {
-			ao->output1buffer1_y_phy = ad->ping.ch_paddr[0];
-			ao->output1buffer1_cbcr_phy = ad->ping.ch_paddr[1];
-			ao->output1buffer2_y_phy = ad->pong.ch_paddr[0];
-			ao->output1buffer2_cbcr_phy = ad->pong.ch_paddr[1];
-			ao->output1buffer3_y_phy = ad->free_buf.ch_paddr[0];
-			ao->output1buffer3_cbcr_phy = ad->free_buf.ch_paddr[1];
-			bptr = &ao->output1buffer4_y_phy;
-			for (cnt = 0; cnt < 5; cnt++) {
-				*bptr = ad->pong.ch_paddr[0];
-				bptr++;
-				*bptr = ad->pong.ch_paddr[1];
-				bptr++;
-			}
-		} else {
-			ao->output1buffer1_y_phy = ad->ping.ch_paddr[0];
-			ao->output1buffer1_cbcr_phy = ad->ping.ch_paddr[1];
-			ao->output1buffer2_y_phy = ad->pong.ch_paddr[0];
-			ao->output1buffer2_cbcr_phy = ad->pong.ch_paddr[1];
-			bptr = &ao->output1buffer3_y_phy;
-			for (cnt = 0; cnt < 6; cnt++) {
-				*bptr = ad->pong.ch_paddr[0];
-				bptr++;
-				*bptr = ad->pong.ch_paddr[1];
-				bptr++;
-			}
-		}
-	} else if (mode == OUTPUT_PRIM && o_mode != SNAPSHOT_MASK_MODE) {
-		/* Preview */
-		ao->output2buffer1_y_phy = ad->ping.ch_paddr[0];
-		ao->output2buffer1_cbcr_phy = ad->ping.ch_paddr[1];
-		ao->output2buffer2_y_phy = ad->pong.ch_paddr[0];
-		ao->output2buffer2_cbcr_phy = ad->pong.ch_paddr[1];
-		spin_lock_irqsave(&vfe2x_ctrl->liveshot_enabled_lock,
-				flags);
-		if (vfe2x_ctrl->liveshot_enabled) { /* Live shot */
-			ao->output2buffer3_y_phy = ad->pong.ch_paddr[0];
-			ao->output2buffer3_cbcr_phy = ad->pong.ch_paddr[1];
-		} else {
-			ao->output2buffer3_y_phy = ad->free_buf.ch_paddr[0];
-			ao->output2buffer3_cbcr_phy = ad->free_buf.ch_paddr[1];
-		}
-		spin_unlock_irqrestore(&vfe2x_ctrl->liveshot_enabled_lock,
-				flags);
-		bptr = &ao->output2buffer4_y_phy;
-		for (cnt = 0; cnt < 5; cnt++) {
-			*bptr = ad->pong.ch_paddr[0];
-			bptr++;
-			*bptr = ad->pong.ch_paddr[1];
-			bptr++;
-		}
-		CDBG("%x %x\n", (unsigned int)ao->output2buffer1_y_phy,
-			(unsigned int)ao->output2buffer1_cbcr_phy);
-		CDBG("%x %x\n", (unsigned int)ao->output2buffer2_y_phy,
-			(unsigned int)ao->output2buffer2_cbcr_phy);
-		CDBG("%x %x\n", (unsigned int)ao->output2buffer3_y_phy,
-			(unsigned int)ao->output2buffer3_cbcr_phy);
-		CDBG("%x %x\n", (unsigned int)ao->output2buffer4_y_phy,
-			(unsigned int)ao->output2buffer4_cbcr_phy);
-		CDBG("%x %x\n", (unsigned int)ao->output2buffer5_y_phy,
-			(unsigned int)ao->output2buffer5_cbcr_phy);
-		CDBG("%x %x\n", (unsigned int)ao->output2buffer6_y_phy,
-			(unsigned int)ao->output2buffer6_cbcr_phy);
-		CDBG("%x %x\n", (unsigned int)ao->output2buffer7_y_phy,
-			(unsigned int)ao->output2buffer7_cbcr_phy);
-		vfe2x_ctrl->free_buf.buf[0].ch_paddr[0] = ad->ping.ch_paddr[0];
-		vfe2x_ctrl->free_buf.buf[0].ch_paddr[1] = ad->ping.ch_paddr[1];
-		vfe2x_ctrl->free_buf.buf[1].ch_paddr[0] = ad->pong.ch_paddr[0];
-		vfe2x_ctrl->free_buf.buf[1].ch_paddr[1] = ad->pong.ch_paddr[1];
-		vfe2x_ctrl->free_buf.buf[2].ch_paddr[0] =
-			ad->free_buf.ch_paddr[0];
-		vfe2x_ctrl->free_buf.buf[2].ch_paddr[1] =
-			ad->free_buf.ch_paddr[1];
-	} else if (mode == OUTPUT_PRIM && o_mode == SNAPSHOT_MASK_MODE) {
-		vfe2x_ctrl->reconfig_vfe = 0;
-		if (raw_mode) {
-			ao->output2buffer1_y_phy = ad->ping.ch_paddr[0];
-			ao->output2buffer1_cbcr_phy = ad->ping.ch_paddr[0];
-			ao->output2buffer2_y_phy = ad->pong.ch_paddr[0];
-			ao->output2buffer2_cbcr_phy = ad->pong.ch_paddr[0];
-		} else {
-			ao->output2buffer1_y_phy = ad->ping.ch_paddr[0];
-			ao->output2buffer1_cbcr_phy = ad->ping.ch_paddr[1];
-			ao->output2buffer2_y_phy = ad->pong.ch_paddr[0];
-			ao->output2buffer2_cbcr_phy = ad->pong.ch_paddr[1];
-	}
-		bptr = &ao->output2buffer3_y_phy;
-		for (cnt = 0; cnt < 6; cnt++) {
-			*bptr = ad->pong.ch_paddr[0];
-			bptr++;
-			*bptr = ad->pong.ch_paddr[1];
-			bptr++;
-		}
-	}
-
-	return rc;
-}
-
-static void vfe2x_subdev_notify(int id, int path)
-{
-	struct msm_vfe_resp rp;
-	unsigned long flags = 0;
-	spin_lock_irqsave(&vfe2x_ctrl->sd_notify_lock, flags);
-	memset(&rp, 0, sizeof(struct msm_vfe_resp));
-	CDBG("vfe2x_subdev_notify : msgId = %d\n", id);
-	rp.evt_msg.type   = MSM_CAMERA_MSG;
-	rp.evt_msg.msg_id = path;
-	rp.evt_msg.data = NULL;
-	rp.type	   = id;
-	v4l2_subdev_notify(&vfe2x_ctrl->subdev, NOTIFY_VFE_BUF_EVT, &rp);
-	spin_unlock_irqrestore(&vfe2x_ctrl->sd_notify_lock, flags);
-}
-
-static struct msm_free_buf *vfe2x_check_free_buffer(int id, int path)
-{
-	struct buf_info *outch = NULL;
-
-	vfe2x_subdev_notify(id, path);
-	if (op_mode & SNAPSHOT_MASK_MODE) {
-		if (path == VFE_MSG_OUTPUT_PRIMARY)
-			outch = &vfe2x_ctrl->snap;
-		else if (path == VFE_MSG_OUTPUT_SECONDARY)
-			outch = &vfe2x_ctrl->thumb;
-	} else {
-		if (path == VFE_MSG_OUTPUT_PRIMARY) {
-			if (vfe2x_ctrl->zsl_mode)
-				outch = &vfe2x_ctrl->zsl_prim;
-			else
-				outch = &vfe2x_ctrl->prev;
-		} else if (path == VFE_MSG_OUTPUT_SECONDARY)
-				outch = &vfe2x_ctrl->zsl_sec;
-	}
-	if (outch->free_buf.ch_paddr[0])
-		return &outch->free_buf;
-
-	return NULL;
-}
-
-static int vfe2x_configure_pingpong_buffers(int id, int path)
-{
-	struct buf_info *outch = NULL;
-	int rc = 0;
-
-	vfe2x_subdev_notify(id, path);
-	CDBG("Opmode = %d\n", op_mode);
-	if (op_mode & SNAPSHOT_MASK_MODE) {
-		if (path == VFE_MSG_OUTPUT_PRIMARY)
-			outch = &vfe2x_ctrl->snap;
-		else if (path == VFE_MSG_OUTPUT_SECONDARY)
-			outch = &vfe2x_ctrl->thumb;
-	} else {
-		if (path == VFE_MSG_OUTPUT_PRIMARY) {
-			if (vfe2x_ctrl->zsl_mode)
-				outch = &vfe2x_ctrl->zsl_prim;
-			else
-				outch = &vfe2x_ctrl->prev;
-		} else if (path == VFE_MSG_OUTPUT_SECONDARY)
-			outch = &vfe2x_ctrl->zsl_sec;
-	}
-	if (outch->ping.ch_paddr[0] && outch->pong.ch_paddr[0]) {
-		/* Configure Preview Ping Pong */
-		CDBG("%s Configure ping/pong address for %d",
-						__func__, path);
-	} else {
-		pr_err("%s ping/pong addr is null!!", __func__);
-		rc = -EINVAL;
-	}
-	return rc;
-}
-
-static struct buf_info *vfe2x_get_ch(int path)
-{
-	struct buf_info *ch = NULL;
-
-	CDBG("path = %d op_mode = %d\n", path, op_mode);
-	/* TODO: Remove Mode specific stuff */
-	if (op_mode & SNAPSHOT_MASK_MODE) {
-		if (path == VFE_MSG_OUTPUT_SECONDARY)
-			ch = &vfe2x_ctrl->thumb;
-		else if (path == VFE_MSG_OUTPUT_PRIMARY)
-			ch = &vfe2x_ctrl->snap;
-	} else {
-		if (path == VFE_MSG_OUTPUT_PRIMARY) {
-			if (vfe2x_ctrl->zsl_mode)
-				ch = &vfe2x_ctrl->zsl_prim;
-			else
-				ch = &vfe2x_ctrl->prev;
-		} else if (path == VFE_MSG_OUTPUT_SECONDARY)
-			ch = &vfe2x_ctrl->zsl_sec;
-	}
-
-	BUG_ON(ch == NULL);
-	return ch;
-}
-
-static long msm_vfe_subdev_ioctl(struct v4l2_subdev *sd,
-			unsigned int subdev_cmd, void *arg)
-{
-	struct msm_isp_cmd vfecmd;
-	struct msm_camvfe_params *vfe_params;
-	struct msm_vfe_cfg_cmd *cmd;
-	struct table_cmd *table_pending;
-	long rc = 0;
-	void *data;
-
-	struct msm_pmem_region *regptr;
-	unsigned char buf[256];
-
-	struct vfe_stats_ack sack;
-	struct axidata *axid;
-	uint32_t i;
-	uint32_t header = 0;
-	uint32_t queue = 0;
-	struct vfe_stats_we_cfg *scfg = NULL;
-	struct vfe_stats_af_cfg *sfcfg = NULL;
-
-	struct axiout *axio = NULL;
-	void   *cmd_data = NULL;
-	void   *cmd_data_alloc = NULL;
-	unsigned long flags;
-	struct msm_free_buf *free_buf = NULL;
-	struct vfe_outputack fack;
-
-	CDBG("msm_vfe_subdev_ioctl is called\n");
-	if (subdev_cmd == VIDIOC_MSM_VFE_INIT) {
-		CDBG("%s init\n", __func__);
-		return msm_vfe_subdev_init(sd);
-	} else if (subdev_cmd == VIDIOC_MSM_VFE_RELEASE) {
-		msm_vfe_subdev_release(sd);
-		return 0;
-	}
-
-	vfe_params = (struct msm_camvfe_params *)arg;
-	cmd = vfe_params->vfe_cfg;
-	data = vfe_params->data;
-
-	if (cmd->cmd_type != CMD_FRAME_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_AF_BUF_RELEASE &&
-		cmd->cmd_type != CMD_CONFIG_PING_ADDR &&
-		cmd->cmd_type != CMD_CONFIG_PONG_ADDR &&
-		cmd->cmd_type != CMD_CONFIG_FREE_BUF_ADDR &&
-		cmd->cmd_type != CMD_VFE_BUFFER_RELEASE &&
-		cmd->cmd_type != VFE_CMD_STATS_REQBUF &&
-		cmd->cmd_type != VFE_CMD_STATS_FLUSH_BUFQ &&
-		cmd->cmd_type != VFE_CMD_STATS_UNREGBUF &&
-		cmd->cmd_type != VFE_CMD_STATS_ENQUEUEBUF) {
-		if (copy_from_user(&vfecmd,
-			   (void __user *)(cmd->value),
-			   sizeof(vfecmd))) {
-			pr_err("copy_from_user in msm_vfe_subdev_ioctl fail\n");
-			return -EFAULT;
-		}
-	}
-	switch (cmd->cmd_type) {
-	case VFE_CMD_STATS_REQBUF:
-	case VFE_CMD_STATS_FLUSH_BUFQ:
-	case VFE_CMD_STATS_UNREGBUF:
-		/* for easy porting put in one envelope */
-		rc = vfe2x_stats_bufq_sub_ioctl(cmd, vfe_params->data);
-		return rc;
-	case VFE_CMD_STATS_ENQUEUEBUF:
-		if (sizeof(struct msm_stats_buf_info) != cmd->length) {
-			/* error. the length not match */
-			pr_err("%s: stats enqueuebuf input size = %d,\n"
-				"struct size = %d, mitch match\n",\
-				__func__, cmd->length,
-				sizeof(struct msm_stats_buf_info));
-			rc = -EINVAL;
-			return rc;
-		}
-		sack.header = 0;
-		sack.bufaddr = NULL;
-		rc = vfe2x_stats_enqueuebuf(cmd->value, &sack);
-		if (rc < 0) {
-			pr_err("%s: error", __func__);
-			rc = -EINVAL;
-			return rc;
-		}
-		if (sack.header != 0 && sack.bufaddr != NULL) {
-			queue  = QDSP_CMDQUEUE;
-			vfecmd.length = sizeof(struct vfe_stats_ack) - 4;
-			cmd_data = &sack;
-		} else {
-			return 0;
-		}
-	break;
-	case CMD_VFE_BUFFER_RELEASE: {
-		if (!(vfe2x_ctrl->vfe_started) || op_mode == 1)
-			return 0;
-		if (op_mode & SNAPSHOT_MASK_MODE) {
-			free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_OUTPUT_SECONDARY);
-		} else {
-			free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_OUTPUT_PRIMARY);
-			if (free_buf) {
-				fack.header = VFE_OUTPUT2_ACK;
-
-				fack.output2newybufferaddress =
-						(void *)(free_buf->ch_paddr[0]);
-
-				fack.output2newcbcrbufferaddress =
-						(void *)(free_buf->ch_paddr[1]);
-
-				cmd_data = &fack;
-				vfecmd.length = sizeof(fack) - 4;
-				queue = QDSP_CMDQUEUE;
-			}
-		}
-	}
-	break;
-	case CMD_CONFIG_PING_ADDR: {
-		int path = *((int *)cmd->value);
-		struct buf_info *outch = vfe2x_get_ch(path);
-		outch->ping = *((struct msm_free_buf *)data);
-	}
-		return 0;
-	case CMD_CONFIG_PONG_ADDR: {
-		int path = *((int *)cmd->value);
-		struct buf_info *outch = vfe2x_get_ch(path);
-		outch->pong = *((struct msm_free_buf *)data);
-	}
-		return 0;
-
-	case CMD_CONFIG_FREE_BUF_ADDR: {
-		int path = *((int *)cmd->value);
-		struct buf_info *outch = vfe2x_get_ch(path);
-		if ((op_mode & SNAPSHOT_MASK_MODE) &&
-			(vfe2x_ctrl->num_snap > 1)) {
-			CDBG("%s: CMD_CONFIG_FREE_BUF_ADDR Burst mode %d",
-					__func__, outch->free_buf_cnt);
-			if (outch->free_buf_cnt <= 0)
-				outch->free_buf =
-					*((struct msm_free_buf *)data);
-			else
-				outch->free_buf_arr[outch->free_buf_cnt-1] =
-					*((struct msm_free_buf *)data);
-			++outch->free_buf_cnt;
-		} else {
-			outch->free_buf = *((struct msm_free_buf *)data);
-		}
-	}
-		return 0;
-
-	case CMD_STATS_AXI_CFG: {
-		axid = data;
-		if (!axid) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		scfg =
-			kmalloc(sizeof(struct vfe_stats_we_cfg),
-				GFP_ATOMIC);
-		if (!scfg) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user((char *)scfg + 4,
-					(void __user *)(vfecmd.value),
-					vfecmd.length)) {
-
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		CDBG("STATS_ENABLE: bufnum = %d, enabling = %d\n",
-			axid->bufnum1, scfg->wb_expstatsenable);
-
-		header = cmds_map[vfecmd.id].vfe_id;
-		queue = cmds_map[vfecmd.id].queue;
-		if (header == -1 && queue == -1) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-		*(uint32_t *)scfg = header;
-		if (axid->bufnum1 > 0) {
-			regptr = axid->region;
-
-			for (i = 0; i < axid->bufnum1; i++) {
-
-				CDBG("STATS_ENABLE, phy = 0x%lx\n",
-					regptr->paddr);
-
-				scfg->wb_expstatoutputbuffer[i] =
-					(void *)regptr->paddr;
-				regptr++;
-			}
-
-			cmd_data = scfg;
-
-		} else {
-			rc = -EINVAL;
-			goto config_done;
-		}
-	}
-		break;
-	case CMD_STATS_AEC_AWB_ENABLE: {
-		pr_err("CMD_STATS_AEC_AWB_ENABLE\n");
-		scfg =
-			kmalloc(sizeof(struct vfe_stats_we_cfg),
-				GFP_ATOMIC);
-		if (!scfg) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user((char *)scfg + 4,
-					(void __user *)(vfecmd.value),
-					vfecmd.length)) {
-
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		header = cmds_map[vfecmd.id].vfe_id;
-		queue = cmds_map[vfecmd.id].queue;
-		if (header == -1 && queue == -1) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-		*(uint32_t *)scfg = header;
-		rc = vfe2x_stats_buf_init(MSM_STATS_TYPE_AE_AW);
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of AWB",
-				 __func__);
-			goto config_failure;
-		}
-		scfg->wb_expstatoutputbuffer[0] =
-			(void *)vfe2x_ctrl->stats_we_buf_ptr[0];
-		scfg->wb_expstatoutputbuffer[1] =
-			(void *)vfe2x_ctrl->stats_we_buf_ptr[1];
-		scfg->wb_expstatoutputbuffer[2] =
-			(void *)vfe2x_ctrl->stats_we_buf_ptr[2];
-		cmd_data = scfg;
-	}
-	break;
-	case CMD_STATS_AF_ENABLE:
-	case CMD_STATS_AF_AXI_CFG: {
-		CDBG("CMD_STATS_AF_ENABLE CMD_STATS_AF_AXI_CFG\n");
-		sfcfg =
-			kmalloc(sizeof(struct vfe_stats_af_cfg),
-				GFP_ATOMIC);
-
-		if (!sfcfg) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user((char *)sfcfg + 4,
-					(void __user *)(vfecmd.value),
-					vfecmd.length)) {
-
-			rc = -EFAULT;
-			goto config_done;
-		}
-
-		header = cmds_map[vfecmd.id].vfe_id;
-		queue = cmds_map[vfecmd.id].queue;
-		if (header == -1 && queue == -1) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-		*(uint32_t *)sfcfg = header;
-		rc = vfe2x_stats_buf_init(MSM_STATS_TYPE_AF);
-		sfcfg->af_outbuf[0] = (void *)vfe2x_ctrl->stats_af_buf_ptr[0];
-		sfcfg->af_outbuf[1] = (void *)vfe2x_ctrl->stats_af_buf_ptr[1];
-		sfcfg->af_outbuf[2] = (void *)vfe2x_ctrl->stats_af_buf_ptr[2];
-		if (rc < 0) {
-			pr_err("%s: cannot config ping/pong address of AWB",
-				__func__);
-			goto config_failure;
-		}
-		cmd_data = sfcfg;
-	}
-		break;
-	case CMD_SNAP_BUF_RELEASE:
-		break;
-	case CMD_STATS_BUF_RELEASE: {
-		CDBG("vfe_7x_config: CMD_STATS_BUF_RELEASE\n");
-		if (!data) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		sack.header = VFE_STATS_WB_EXP_ACK;
-		sack.bufaddr = (void *)*(uint32_t *)data;
-
-		queue  = QDSP_CMDQUEUE;
-		vfecmd.length = sizeof(struct vfe_stats_ack) - 4;
-		cmd_data = &sack;
-	}
-		break;
-	case CMD_STATS_AF_BUF_RELEASE: {
-		CDBG("vfe_7x_config: CMD_STATS_AF_BUF_RELEASE\n");
-		if (!data) {
-			rc = -EFAULT;
-			goto config_failure;
-		}
-
-		sack.header = VFE_STATS_AUTOFOCUS_ACK;
-		sack.bufaddr = (void *)*(uint32_t *)data;
-
-		queue  = QDSP_CMDQUEUE;
-		vfecmd.length = sizeof(struct vfe_stats_ack) - 4;
-		cmd_data = &sack;
-	}
-		break;
-	case CMD_GENERAL:
-	case CMD_STATS_DISABLE: {
-		CDBG("CMD_GENERAL:%d %d\n", vfecmd.id, vfecmd.length);
-		if (vfecmd.id == VFE_CMD_OPERATION_CFG) {
-			if (copy_from_user(&vfe2x_ctrl->start_cmd,
-						(void __user *)(vfecmd.value),
-							vfecmd.length))
-				rc = -EFAULT;
-			op_mode = vfe2x_ctrl->start_cmd.mode_of_operation;
-			vfe2x_ctrl->snap.free_buf_cnt = 0;
-			vfe2x_ctrl->thumb.free_buf_cnt = 0;
-			vfe2x_ctrl->snap.frame_cnt = 0;
-			vfe2x_ctrl->thumb.frame_cnt = 0;
-			vfe2x_ctrl->num_snap =
-				vfe2x_ctrl->start_cmd.snap_number;
-			return rc;
-		}
-		if (vfecmd.id == VFE_CMD_RECONFIG_VFE) {
-			CDBG("VFE is RECONFIGURED\n");
-			vfe2x_ctrl->reconfig_vfe = 1;
-			return 0;
-		}
-		if (vfecmd.id == VFE_CMD_LIVESHOT) {
-			CDBG("live shot enabled\n");
-			spin_lock_irqsave(&vfe2x_ctrl->liveshot_enabled_lock,
-					flags);
-			vfe2x_ctrl->liveshot_enabled = 1;
-			spin_unlock_irqrestore(&vfe2x_ctrl->
-					liveshot_enabled_lock,
-					flags);
-			return 0;
-		}
-		if (vfecmd.id == VFE_CMD_STOP_LIVESHOT) {
-			CDBG("live shot disabled\n");
-			spin_lock_irqsave(&vfe2x_ctrl->liveshot_enabled_lock,
-					flags);
-			vfe2x_ctrl->liveshot_enabled = 0;
-			spin_unlock_irqrestore(
-					&vfe2x_ctrl->liveshot_enabled_lock,
-					flags);
-			return 0;
-		}
-		if (vfecmd.length > 256 - 4) {
-			cmd_data_alloc =
-			cmd_data = kmalloc(vfecmd.length + 4, GFP_ATOMIC);
-			if (!cmd_data) {
-				rc = -ENOMEM;
-				goto config_failure;
-			}
-		} else
-			cmd_data = buf;
-
-		if (copy_from_user(((char *)cmd_data) + 4,
-					(void __user *)(vfecmd.value),
-					vfecmd.length)) {
-
-			rc = -EFAULT;
-			goto config_done;
-		}
-		header = cmds_map[vfecmd.id].vfe_id;
-		queue = cmds_map[vfecmd.id].queue;
-		if (header == -1 && queue == -1) {
-			rc = -EFAULT;
-			goto config_done;
-		}
-		CDBG("%s %s\n", cmds_map[vfecmd.id].isp_id_name,
-			cmds_map[vfecmd.id].vfe_id_name);
-		*(uint32_t *)cmd_data = header;
-		if (queue == QDSP_CMDQUEUE) {
-			switch (vfecmd.id) {
-			case VFE_CMD_RESET:
-				msm_camio_vfe_blk_reset_2();
-				vfestopped = 0;
-				break;
-			case VFE_CMD_START:
-			case VFE_CMD_CAPTURE:
-			case VFE_CMD_CAPTURE_RAW:
-			case VFE_CMD_ZSL:
-				spin_lock_irqsave(&vfe2x_ctrl->table_lock,
-									flags);
-				if ((!list_empty(&vfe2x_ctrl->table_q)) ||
-						vfe2x_ctrl->tableack_pending) {
-					CDBG("start pending\n");
-					vfe2x_ctrl->start_pending = 1;
-					spin_unlock_irqrestore(
-						&vfe2x_ctrl->table_lock,
-								flags);
-					return 0;
-				}
-				spin_unlock_irqrestore(&vfe2x_ctrl->table_lock,
-									flags);
-				vfecmd.length = sizeof(vfe2x_ctrl->start_cmd);
-				memcpy(((char *)cmd_data) + 4,
-					&vfe2x_ctrl->start_cmd,
-					sizeof(vfe2x_ctrl->start_cmd));
-				if (op_mode & SNAPSHOT_MASK_MODE)
-					msm_camio_set_perf_lvl(S_CAPTURE);
-				else
-					msm_camio_set_perf_lvl(S_PREVIEW);
-				vfestopped = 0;
-				break;
-			case VFE_CMD_STOP:
-				vfestopped = 1;
-				spin_lock_irqsave(&vfe2x_ctrl->table_lock,
-						flags);
-				if (op_mode & SNAPSHOT_MASK_MODE) {
-					vfe2x_ctrl->stop_pending = 0;
-					vfe2x_send_isp_msg(vfe2x_ctrl,
-						msgs_map[MSG_STOP_ACK].
-						isp_id);
-					spin_unlock_irqrestore(
-							&vfe2x_ctrl->table_lock,
-							flags);
-					return 0;
-				}
-				if ((!list_empty(&vfe2x_ctrl->table_q)) ||
-						vfe2x_ctrl->tableack_pending) {
-					CDBG("stop pending\n");
-					vfe2x_ctrl->stop_pending = 1;
-					spin_unlock_irqrestore(
-							&vfe2x_ctrl->table_lock,
-							flags);
-					return 0;
-				}
-				spin_unlock_irqrestore(&vfe2x_ctrl->table_lock,
-						flags);
-				vfe2x_ctrl->vfe_started = 0;
-				goto config_send;
-			case VFE_CMD_UPDATE:
-				spin_lock_irqsave(&vfe2x_ctrl->table_lock,
-						flags);
-				if ((!list_empty(&vfe2x_ctrl->table_q)) ||
-						vfe2x_ctrl->tableack_pending) {
-					CDBG("update pending\n");
-					vfe2x_ctrl->update_pending = 0;
-					vfe2x_send_isp_msg(vfe2x_ctrl,
-						msgs_map[MSG_UPDATE_ACK].
-						isp_id);
-					spin_unlock_irqrestore(
-							&vfe2x_ctrl->table_lock,
-							flags);
-					return 0;
-				}
-				spin_unlock_irqrestore(&vfe2x_ctrl->table_lock,
-						flags);
-				goto config_send;
-			default:
-				break;
-			}
-		} /* QDSP_CMDQUEUE */
-	}
-		break;
-	case CMD_AXI_CFG_SEC: {
-		CDBG("CMD_AXI_CFG_SEC\n");
-		raw_mode = 0;
-		vfe2x_ctrl->zsl_mode = 0;
-		axio = kmalloc(sizeof(struct axiout), GFP_ATOMIC);
-		if (!axio) {
-			pr_err("NULL axio\n");
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user((char *)axio + 4,
-					(void __user *)(vfecmd.value),
-					sizeof(struct axiout))) {
-			CDBG("copy_from_user failed\n");
-			rc = -EFAULT;
-			goto config_done;
-		}
-		if (op_mode & SNAPSHOT_MASK_MODE)
-			rc = vfe2x_configure_pingpong_buffers(
-						VFE_MSG_CAPTURE,
-						VFE_MSG_OUTPUT_SECONDARY);
-		else
-			rc = vfe2x_configure_pingpong_buffers(
-						VFE_MSG_PREVIEW,
-						VFE_MSG_OUTPUT_SECONDARY);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers"
-				" for preview", __func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-
-		if (!(op_mode & SNAPSHOT_MASK_MODE))
-			free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_OUTPUT_SECONDARY);
-		header = cmds_map[vfecmd.id].vfe_id;
-		queue = cmds_map[vfecmd.id].queue;
-		if (header == -1 && queue == -1) {
-			rc = -EFAULT;
-			goto config_done;
-		}
-		*(uint32_t *)axio = header;
-		if (op_mode & SNAPSHOT_MASK_MODE)
-			vfe_7x_config_axi(OUTPUT_SEC,
-					&vfe2x_ctrl->thumb, axio);
-		else
-			vfe_7x_config_axi(OUTPUT_SEC,
-					&vfe2x_ctrl->video, axio);
-		cmd_data = axio;
-	}
-		break;
-	case CMD_AXI_CFG_PRIM: {
-		CDBG("CMD_AXI_CFG_PRIM : %d\n", op_mode);
-		raw_mode = 0;
-		vfe2x_ctrl->zsl_mode = 0;
-		axio = kmalloc(sizeof(struct axiout), GFP_ATOMIC);
-		if (!axio) {
-			pr_err("NULL axio\n");
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user((char *)axio + 4,
-					(void __user *)(vfecmd.value),
-					sizeof(struct axiout))) {
-			pr_err("copy_from_user failed\n");
-			rc = -EFAULT;
-			goto config_done;
-		}
-		if (!vfe2x_ctrl->reconfig_vfe) {
-			if (op_mode & SNAPSHOT_MASK_MODE)
-				rc = vfe2x_configure_pingpong_buffers(
-						VFE_MSG_CAPTURE,
-						VFE_MSG_OUTPUT_PRIMARY);
-			else
-				rc = vfe2x_configure_pingpong_buffers(
-						VFE_MSG_PREVIEW,
-						VFE_MSG_OUTPUT_PRIMARY);
-			if (rc < 0) {
-				pr_err("%s error configuring pingpong buffers"
-					" for preview", __func__);
-				rc = -EINVAL;
-				goto config_done;
-			}
-			if (!(op_mode & SNAPSHOT_MASK_MODE))
-				free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_OUTPUT_PRIMARY);
-		} else {
-			vfe2x_ctrl->prev.ping.ch_paddr[0] =
-				vfe2x_ctrl->free_buf.buf[0].ch_paddr[0];
-			vfe2x_ctrl->prev.ping.ch_paddr[1] =
-				vfe2x_ctrl->free_buf.buf[0].ch_paddr[1];
-			vfe2x_ctrl->prev.pong.ch_paddr[0] =
-				vfe2x_ctrl->free_buf.buf[1].ch_paddr[0];
-			vfe2x_ctrl->prev.pong.ch_paddr[1] =
-				vfe2x_ctrl->free_buf.buf[1].ch_paddr[1];
-			vfe2x_ctrl->prev.free_buf.ch_paddr[0] =
-				vfe2x_ctrl->free_buf.buf[2].ch_paddr[0];
-			vfe2x_ctrl->prev.free_buf.ch_paddr[1] =
-				vfe2x_ctrl->free_buf.buf[2].ch_paddr[1];
-			vfe2x_ctrl->reconfig_vfe = 0;
-		}
-		header = cmds_map[vfecmd.id].vfe_id;
-		queue = cmds_map[vfecmd.id].queue;
-		if (header == -1 && queue == -1) {
-			rc = -EFAULT;
-			goto config_done;
-		}
-		*(uint32_t *)axio = header;
-		if (op_mode & SNAPSHOT_MASK_MODE)
-			vfe_7x_config_axi(OUTPUT_PRIM, &vfe2x_ctrl->snap, axio);
-		else
-			vfe_7x_config_axi(OUTPUT_PRIM, &vfe2x_ctrl->prev, axio);
-		cmd_data = axio;
-	}
-		break;
-	case CMD_AXI_CFG_ZSL: {
-		CDBG("CMD_AXI_CFG_ZSL: %d\n", op_mode);
-		raw_mode = 0;
-		vfe2x_ctrl->zsl_mode = 1;
-		axio = kmalloc(sizeof(struct axiout), GFP_ATOMIC);
-		if (!axio) {
-			pr_err("NULL axio\n");
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user((char *)axio + 4,
-					(void __user *)(vfecmd.value),
-					sizeof(struct axiout))) {
-			pr_err("copy_from_user failed\n");
-			rc = -EFAULT;
-			goto config_done;
-		}
-		if (!vfe2x_ctrl->reconfig_vfe) {
-				rc = vfe2x_configure_pingpong_buffers(
-						VFE_MSG_PREVIEW,
-						VFE_MSG_OUTPUT_PRIMARY);
-				rc = vfe2x_configure_pingpong_buffers(
-						VFE_MSG_PREVIEW,
-						VFE_MSG_OUTPUT_SECONDARY);
-			if (rc < 0) {
-				pr_err("%s error configuring pingpong buffers"
-					" for preview", __func__);
-				rc = -EINVAL;
-				goto config_done;
-			}
-				free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_OUTPUT_PRIMARY);
-				free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_OUTPUT_SECONDARY);
-		} else {
-			vfe2x_ctrl->prev.ping.ch_paddr[0] =
-				vfe2x_ctrl->free_buf.buf[0].ch_paddr[0];
-			vfe2x_ctrl->prev.ping.ch_paddr[1] =
-				vfe2x_ctrl->free_buf.buf[0].ch_paddr[1];
-			vfe2x_ctrl->prev.pong.ch_paddr[0] =
-				vfe2x_ctrl->free_buf.buf[1].ch_paddr[0];
-			vfe2x_ctrl->prev.pong.ch_paddr[1] =
-				vfe2x_ctrl->free_buf.buf[1].ch_paddr[1];
-			vfe2x_ctrl->prev.free_buf.ch_paddr[0] =
-				vfe2x_ctrl->free_buf.buf[2].ch_paddr[0];
-			vfe2x_ctrl->prev.free_buf.ch_paddr[1] =
-				vfe2x_ctrl->free_buf.buf[2].ch_paddr[1];
-			vfe2x_ctrl->reconfig_vfe = 0;
-		}
-		header = cmds_map[vfecmd.id].vfe_id;
-		queue = cmds_map[vfecmd.id].queue;
-		if (header == -1 && queue == -1) {
-			rc = -EFAULT;
-			goto config_done;
-		}
-		*(uint32_t *)axio = header;
-		vfe_7x_config_axi(OUTPUT_PRIM, &vfe2x_ctrl->zsl_prim, axio);
-		vfe_7x_config_axi(OUTPUT_SEC, &vfe2x_ctrl->zsl_sec, axio);
-		cmd_data = axio;
-	}
-		break;
-	case CMD_AXI_CFG_SEC|CMD_AXI_CFG_PRIM: {
-		CDBG("CMD_AXI_CFG_SEC|PRIM\n");
-		raw_mode = 0;
-		vfe2x_ctrl->zsl_mode = 0;
-		axio = kmalloc(sizeof(struct axiout), GFP_ATOMIC);
-		if (!axio) {
-			pr_err("NULL axio\n");
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user((char *)axio + 4,
-					(void __user *)(vfecmd.value),
-					sizeof(struct axiout))) {
-			pr_err("copy_from_user failed\n");
-			rc = -EFAULT;
-			goto config_done;
-		}
-		if (op_mode & SNAPSHOT_MASK_MODE)
-			rc = vfe2x_configure_pingpong_buffers(
-						VFE_MSG_CAPTURE,
-						VFE_MSG_OUTPUT_SECONDARY);
-		else
-			rc = vfe2x_configure_pingpong_buffers(
-						VFE_MSG_PREVIEW,
-						VFE_MSG_OUTPUT_SECONDARY);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers"
-				" for preview", __func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-
-		if (!(op_mode & SNAPSHOT_MASK_MODE)) {
-			free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_OUTPUT_SECONDARY);
-		} else if ((op_mode & SNAPSHOT_MASK_MODE) &&
-				(vfe2x_ctrl->num_snap > 1)) {
-			int i = 0;
-			CDBG("Burst mode AXI config SEC snap cnt %d\n",
-				vfe2x_ctrl->num_snap);
-			for (i = 0; i < vfe2x_ctrl->num_snap - 2; i++) {
-				free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_OUTPUT_SECONDARY);
-			}
-		}
-		header = cmds_map[vfecmd.id].vfe_id;
-		queue = cmds_map[vfecmd.id].queue;
-		if (header == -1 && queue == -1) {
-			rc = -EFAULT;
-			goto config_done;
-		}
-		*(uint32_t *)axio = header;
-		if (op_mode & SNAPSHOT_MASK_MODE)
-			vfe_7x_config_axi(OUTPUT_SEC, &vfe2x_ctrl->thumb, axio);
-		else
-			vfe_7x_config_axi(OUTPUT_SEC, &vfe2x_ctrl->prev, axio);
-
-		if (op_mode & SNAPSHOT_MASK_MODE)
-			rc = vfe2x_configure_pingpong_buffers(
-						VFE_MSG_CAPTURE,
-						VFE_MSG_OUTPUT_PRIMARY);
-		else
-			rc = vfe2x_configure_pingpong_buffers(
-						VFE_MSG_PREVIEW,
-						VFE_MSG_OUTPUT_PRIMARY);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers"
-				" for preview", __func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-
-		if (!(op_mode & SNAPSHOT_MASK_MODE)) {
-			free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_OUTPUT_PRIMARY);
-		} else if ((op_mode & SNAPSHOT_MASK_MODE) &&
-				(vfe2x_ctrl->num_snap > 1)) {
-			int i = 0;
-			CDBG("Burst mode AXI config PRIM snap cnt %d\n",
-				vfe2x_ctrl->num_snap);
-			for (i = 0; i < vfe2x_ctrl->num_snap - 2; i++) {
-				free_buf = vfe2x_check_free_buffer(
-					VFE_MSG_OUTPUT_IRQ,
-					VFE_MSG_OUTPUT_PRIMARY);
-			}
-		}
-
-		if (op_mode & SNAPSHOT_MASK_MODE)
-			vfe_7x_config_axi(OUTPUT_PRIM,
-					&vfe2x_ctrl->snap, axio);
-		else
-			vfe_7x_config_axi(OUTPUT_PRIM,
-					&vfe2x_ctrl->prev, axio);
-		cmd_data = axio;
-	}
-		break;
-	case CMD_RAW_PICT_AXI_CFG: {
-		CDBG("CMD_RAW_PICT_AXI_CFG:%d\n", op_mode);
-		raw_mode = 1;
-		axio = kmalloc(sizeof(struct axiout), GFP_ATOMIC);
-		if (!axio) {
-			rc = -ENOMEM;
-			goto config_failure;
-		}
-
-		if (copy_from_user((char *)axio + 4,
-					(void __user *)(vfecmd.value),
-					sizeof(struct axiout))) {
-			rc = -EFAULT;
-			goto config_done;
-		}
-		header = cmds_map[vfecmd.id].vfe_id;
-		queue = cmds_map[vfecmd.id].queue;
-		rc = vfe2x_configure_pingpong_buffers(VFE_MSG_CAPTURE,
-						VFE_MSG_OUTPUT_PRIMARY);
-		if (rc < 0) {
-			pr_err("%s error configuring pingpong buffers"
-				" for preview", __func__);
-			rc = -EINVAL;
-			goto config_done;
-		}
-		if (header == -1 && queue == -1) {
-			rc = -EFAULT;
-			goto config_done;
-		}
-		*(uint32_t *)axio = header;
-		vfe_7x_config_axi(OUTPUT_PRIM, &vfe2x_ctrl->snap, axio);
-		cmd_data = axio;
-	}
-		break;
-	default:
-		break;
-	}
-
-	if (vfestopped)
-		goto config_done;
-
-config_send:
-	CDBG("send adsp command = %d\n", *(uint32_t *)cmd_data);
-	spin_lock_irqsave(&vfe2x_ctrl->table_lock, flags);
-	if (queue == QDSP_TABLEQUEUE &&
-			vfe2x_ctrl->tableack_pending) {
-		CDBG("store table cmd\n");
-		table_pending = kzalloc(sizeof(struct table_cmd), GFP_ATOMIC);
-		if (!table_pending) {
-			rc = -ENOMEM;
-			spin_unlock_irqrestore(&vfe2x_ctrl->table_lock, flags);
-			goto config_done;
-		}
-		table_pending->cmd = kzalloc(vfecmd.length + 4, GFP_ATOMIC);
-		if (!table_pending->cmd) {
-			kfree(table_pending);
-			rc = -ENOMEM;
-			spin_unlock_irqrestore(&vfe2x_ctrl->table_lock, flags);
-			goto config_done;
-		}
-		memcpy(table_pending->cmd, cmd_data, vfecmd.length + 4);
-		table_pending->queue = queue;
-		table_pending->size = vfecmd.length + 4;
-		list_add_tail(&table_pending->list, &vfe2x_ctrl->table_q);
-		spin_unlock_irqrestore(&vfe2x_ctrl->table_lock, flags);
-	} else {
-		if (queue == QDSP_TABLEQUEUE) {
-			CDBG("sending table cmd\n");
-			vfe2x_ctrl->tableack_pending = 1;
-			rc = msm_adsp_write(vfe_mod, queue,
-				cmd_data, vfecmd.length + 4);
-			spin_unlock_irqrestore(&vfe2x_ctrl->table_lock, flags);
-		} else {
-			if (*(uint32_t *)cmd_data == VFE_OUTPUT2_ACK) {
-				uint32_t *ptr = cmd_data;
-				CDBG("%x %x %x\n", ptr[0], ptr[1], ptr[2]);
-			}
-			CDBG("send n-table cmd\n");
-			rc = msm_adsp_write(vfe_mod, queue,
-				cmd_data, vfecmd.length + 4);
-			spin_unlock_irqrestore(&vfe2x_ctrl->table_lock, flags);
-			CDBG("%x\n", vfecmd.length + 4);
-		}
-	}
-
-config_done:
-	kfree(cmd_data_alloc);
-
-config_failure:
-	kfree(scfg);
-	kfree(axio);
-	kfree(sfcfg);
-	return rc;
-}
-
-static struct msm_cam_clk_info vfe2x_clk_info[] = {
-	{"vfe_clk", 192000000},
-};
-
-int msm_vfe_subdev_init(struct v4l2_subdev *sd)
-{
-	int rc = 0;
-	struct msm_cam_media_controller *mctl;
-	mctl = v4l2_get_subdev_hostdata(sd);
-	if (mctl == NULL) {
-		pr_err("%s: mctl is NULL\n", __func__);
-		rc = -EINVAL;
-		goto mctl_failed;
-	}
-
-	spin_lock_init(&vfe2x_ctrl->sd_notify_lock);
-	spin_lock_init(&vfe2x_ctrl->table_lock);
-	spin_lock_init(&vfe2x_ctrl->vfe_msg_lock);
-	spin_lock_init(&vfe2x_ctrl->liveshot_enabled_lock);
-	init_waitqueue_head(&stopevent.wait);
-	INIT_LIST_HEAD(&vfe2x_ctrl->table_q);
-	INIT_LIST_HEAD(&vfe2x_ctrl->vfe_msg_q);
-	stopevent.timeout = 200;
-	stopevent.state = 0;
-	vfe2x_ctrl->vfe_started = 0;
-
-	memset(&vfe2x_ctrl->stats_ctrl, 0, sizeof(struct msm_stats_bufq_ctrl));
-	memset(&vfe2x_ctrl->stats_ops, 0, sizeof(struct msm_stats_ops));
-
-	CDBG("msm_cam_clk_enable: enable vfe_clk\n");
-	rc = msm_cam_clk_enable(&vfe2x_ctrl->pdev->dev, vfe2x_clk_info,
-			vfe2x_ctrl->vfe_clk, ARRAY_SIZE(vfe2x_clk_info), 1);
-	if (rc < 0)
-		return rc;
-
-	msm_camio_set_perf_lvl(S_INIT);
-
-	/* TODO : check is it required */
-	extlen = sizeof(struct vfe_frame_extra);
-
-	extdata = kmalloc(extlen, GFP_ATOMIC);
-	if (!extdata) {
-		rc = -ENOMEM;
-		goto init_fail;
-	}
-
-	rc = msm_adsp_get("QCAMTASK", &qcam_mod, &vfe_7x_sync, NULL);
-	if (rc) {
-		rc = -EBUSY;
-		goto get_qcam_fail;
-	}
-
-	rc = msm_adsp_get("VFETASK", &vfe_mod, &vfe_7x_sync, NULL);
-	if (rc) {
-		rc = -EBUSY;
-		goto get_vfe_fail;
-	}
-	msm_adsp_enable(qcam_mod);
-	msm_adsp_enable(vfe_mod);
-	return 0;
-
-get_vfe_fail:
-	msm_adsp_put(qcam_mod);
-get_qcam_fail:
-	kfree(extdata);
-init_fail:
-	extlen = 0;
-mctl_failed:
-	return rc;
-}
-
-int msm_vpe_subdev_init(struct v4l2_subdev *sd)
-{
-	return 0;
-}
-
-void msm_vpe_subdev_release(struct v4l2_subdev *sd)
-{
-	return;
-}
-
-void msm_vfe_subdev_release(struct v4l2_subdev *sd)
-{
-	CDBG("msm_cam_clk_enable: disable vfe_clk\n");
-	msm_cam_clk_enable(&vfe2x_ctrl->pdev->dev, vfe2x_clk_info,
-			vfe2x_ctrl->vfe_clk, ARRAY_SIZE(vfe2x_clk_info), 0);
-	msm_adsp_disable(qcam_mod);
-	msm_adsp_disable(vfe_mod);
-
-	msm_adsp_put(qcam_mod);
-	msm_adsp_put(vfe_mod);
-
-	kfree(extdata);
-	msm_camio_set_perf_lvl(S_EXIT);
-	return;
-}
-
-static int msm_vfe_subdev_s_crystal_freq(struct v4l2_subdev *sd,
-	u32 freq, u32 flags)
-{
-	int rc = 0;
-	int round_rate;
-
-	round_rate = clk_round_rate(vfe2x_ctrl->vfe_clk[0], freq);
-	if (rc < 0) {
-		pr_err("%s: clk_round_rate failed %d\n",
-			__func__, rc);
-		return rc;
-	}
-
-	rc = clk_set_rate(vfe2x_ctrl->vfe_clk[0], round_rate);
-	if (rc < 0)
-		pr_err("%s: clk_set_rate failed %d\n",
-			__func__, rc);
-
-	return rc;
-}
-
-static const struct v4l2_subdev_video_ops msm_vfe_subdev_video_ops = {
-	.s_crystal_freq = msm_vfe_subdev_s_crystal_freq,
-};
-
-static const struct v4l2_subdev_core_ops msm_vfe_subdev_core_ops = {
-	.ioctl = msm_vfe_subdev_ioctl,
-};
-
-static const struct v4l2_subdev_ops msm_vfe_subdev_ops = {
-	.core = &msm_vfe_subdev_core_ops,
-	.video = &msm_vfe_subdev_video_ops,
-};
-
-static const struct v4l2_subdev_internal_ops msm_vfe_internal_ops;
-
-static int __devinit vfe2x_probe(struct platform_device *pdev)
-{
-	struct msm_cam_subdev_info sd_info;
-
-	CDBG("%s: device id = %d\n", __func__, pdev->id);
-	vfe2x_ctrl = kzalloc(sizeof(struct vfe2x_ctrl_type), GFP_KERNEL);
-	if (!vfe2x_ctrl) {
-		pr_err("%s: no enough memory\n", __func__);
-		return -ENOMEM;
-	}
-
-	v4l2_subdev_init(&vfe2x_ctrl->subdev, &msm_vfe_subdev_ops);
-	vfe2x_ctrl->subdev.internal_ops = &msm_vfe_internal_ops;
-	vfe2x_ctrl->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	snprintf(vfe2x_ctrl->subdev.name,
-			 sizeof(vfe2x_ctrl->subdev.name), "vfe2.x");
-	v4l2_set_subdevdata(&vfe2x_ctrl->subdev, vfe2x_ctrl);
-	platform_set_drvdata(pdev, &vfe2x_ctrl->subdev);
-
-	vfe2x_ctrl->pdev = pdev;
-	sd_info.sdev_type = VFE_DEV;
-	sd_info.sd_index = 0;
-	sd_info.irq_num = 0;
-	msm_cam_register_subdev_node(&vfe2x_ctrl->subdev, &sd_info);
-
-	media_entity_init(&vfe2x_ctrl->subdev.entity, 0, NULL, 0);
-	vfe2x_ctrl->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
-	vfe2x_ctrl->subdev.entity.group_id = VFE_DEV;
-	vfe2x_ctrl->subdev.entity.name = pdev->name;
-	vfe2x_ctrl->subdev.entity.revision = vfe2x_ctrl->subdev.devnode->num;
-	return 0;
-}
-
-static struct platform_driver vfe2x_driver = {
-	.probe = vfe2x_probe,
-	.driver = {
-		.name = MSM_VFE_DRV_NAME,
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init msm_vfe2x_init_module(void)
-{
-	return platform_driver_register(&vfe2x_driver);
-}
-
-static void __exit msm_vfe2x_exit_module(void)
-{
-	platform_driver_unregister(&vfe2x_driver);
-}
-
-module_init(msm_vfe2x_init_module);
-module_exit(msm_vfe2x_exit_module);
-MODULE_DESCRIPTION("VFE 2.x driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/video/msm/vfe/msm_vfe7x27a_v4l2.h b/drivers/media/video/msm/vfe/msm_vfe7x27a_v4l2.h
deleted file mode 100644
index 78b1929..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe7x27a_v4l2.h
+++ /dev/null
@@ -1,431 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __MSM_VFE7X_H__
-#define __MSM_VFE7X_H__
-#include <media/msm_camera.h>
-#include <mach/camera.h>
-#include <linux/list.h>
-#include "msm.h"
-#include "msm_vfe_stats_buf.h"
-
-/*8 DSP buffers, 3 - ping, pong, free*/
-#define FREE_BUF_ARR_SIZE 5
-
-struct cmd_id_map {
-	uint32_t isp_id;
-	uint32_t vfe_id;
-	uint32_t queue;
-	char isp_id_name[64];
-	char vfe_id_name[64];
-} __packed;
-
-struct msg_id_map {
-	uint32_t vfe_id;
-	uint32_t isp_id;
-} __packed;
-
-struct table_cmd {
-	struct list_head list;
-	void *cmd;
-	int size;
-	int queue;
-} __packed;
-
-struct vfe_msg {
-	struct list_head list;
-	void *cmd;
-	int len;
-	int id;
-} __packed;
-
-struct buf_info {
-	/* Buffer */
-	struct msm_free_buf ping;
-	struct msm_free_buf pong;
-	struct msm_free_buf free_buf;
-	/*Array for holding the free buffer if more than one*/
-	struct msm_free_buf free_buf_arr[FREE_BUF_ARR_SIZE];
-	int free_buf_cnt;
-	int frame_cnt;
-} __packed;
-
-struct prev_free_buf_info {
-	struct msm_free_buf buf[3];
-};
-
-struct vfe_cmd_start {
-	uint32_t input_source:1;
-	uint32_t mode_of_operation:1;
-	uint32_t snap_number:4;
-	uint32_t /* reserved */ : 26;
-
-	/* Image Pipeline Modules */
-	uint32_t blacklevel_correction_enable:1;
-	uint32_t lens_rolloff_correction_enable:1;
-	uint32_t white_balance_enable:1;
-	uint32_t rgb_gamma_enable:1;
-	uint32_t luma_noise_reductionpath_enable:1;
-	uint32_t adaptive_spatialfilter_enable:1;
-	uint32_t chroma_subsample_enable:1;
-	uint32_t /* reserved */ : 25;
-
-	/* The dimension fed to the statistics module */
-	uint32_t last_pixel:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t last_line:12;
-	uint32_t /* reserved */ : 4;
-} __packed;
-
-struct vfe2x_ctrl_type {
-	struct buf_info prev;
-	struct buf_info video;
-	struct buf_info snap;
-	struct buf_info raw;
-	struct buf_info thumb;
-	struct prev_free_buf_info free_buf;
-	struct buf_info zsl_prim;
-	struct buf_info zsl_sec;
-	struct prev_free_buf_info zsl_free_buf[2];
-
-
-	spinlock_t  table_lock;
-	struct list_head table_q;
-	uint32_t tableack_pending;
-	uint32_t vfeFrameId;
-
-	spinlock_t vfe_msg_lock;
-	struct list_head vfe_msg_q;
-
-	struct vfe_cmd_start start_cmd;
-	uint32_t start_pending;
-	uint32_t vfe_started;
-	uint32_t stop_pending;
-	uint32_t update_pending;
-
-	spinlock_t liveshot_enabled_lock;
-	uint32_t liveshot_enabled;
-
-	/* v4l2 subdev */
-	struct v4l2_subdev subdev;
-	struct platform_device *pdev;
-	struct clk *vfe_clk[3];
-	spinlock_t  sd_notify_lock;
-	uint32_t    reconfig_vfe;
-	uint32_t    zsl_mode;
-	spinlock_t  stats_bufq_lock;
-	struct msm_stats_bufq_ctrl stats_ctrl;
-	struct msm_stats_ops stats_ops;
-	unsigned long stats_we_buf_ptr[3];
-	unsigned long stats_af_buf_ptr[3];
-	int num_snap;
-} __packed;
-
-struct vfe_frame_extra {
-	uint32_t	bl_evencol:23;
-	uint32_t	rvd1:9;
-	uint32_t	bl_oddcol:23;
-	uint32_t	rvd2:9;
-
-	uint32_t	d_dbpc_stats_hot:16;
-	uint32_t	d_dbpc_stats_cold:16;
-
-	uint32_t	d_dbpc_stats_0_hot:10;
-	uint32_t	rvd3:6;
-	uint32_t	d_dbpc_stats_0_cold:10;
-	uint32_t	rvd4:6;
-	uint32_t	d_dbpc_stats_1_hot:10;
-	uint32_t	rvd5:6;
-	uint32_t	d_dbpc_stats_1_cold:10;
-	uint32_t	rvd6:6;
-
-	uint32_t	asf_max_edge;
-
-	uint32_t	e_y_wm_pm_stats_0:21;
-	uint32_t	rvd7:11;
-	uint32_t	e_y_wm_pm_stats_1_bl:8;
-	uint32_t	rvd8:8;
-	uint32_t	e_y_wm_pm_stats_1_nl:12;
-	uint32_t	rvd9:4;
-
-	uint32_t	e_cbcr_wm_pm_stats_0:21;
-	uint32_t	rvd10:11;
-	uint32_t	e_cbcr_wm_pm_stats_1_bl:8;
-	uint32_t	rvd11:8;
-	uint32_t	e_cbcr_wm_pm_stats_1_nl:12;
-	uint32_t	rvd12:4;
-
-	uint32_t	v_y_wm_pm_stats_0:21;
-	uint32_t	rvd13:11;
-	uint32_t	v_y_wm_pm_stats_1_bl:8;
-	uint32_t	rvd14:8;
-	uint32_t	v_y_wm_pm_stats_1_nl:12;
-	uint32_t	rvd15:4;
-
-	uint32_t	v_cbcr_wm_pm_stats_0:21;
-	uint32_t	rvd16:11;
-	uint32_t	v_cbcr_wm_pm_stats_1_bl:8;
-	uint32_t	rvd17:8;
-	uint32_t	v_cbcr_wm_pm_stats_1_nl:12;
-	uint32_t	rvd18:4;
-
-	uint32_t      frame_id;
-} __packed;
-
-struct vfe_endframe {
-	uint32_t      y_address;
-	uint32_t      cbcr_address;
-
-	struct vfe_frame_extra extra;
-} __packed;
-
-struct vfe_outputack {
-	uint32_t  header;
-	void      *output2newybufferaddress;
-	void      *output2newcbcrbufferaddress;
-} __packed;
-
-struct vfe_stats_ack {
-	uint32_t header;
-	/* MUST BE 64 bit ALIGNED */
-	void     *bufaddr;
-} __packed;
-
-/* AXI Output Config Command sent to DSP */
-struct axiout {
-	uint32_t            cmdheader:32;
-	int                 outputmode:3;
-	uint8_t             format:2;
-	uint32_t            /* reserved */ : 27;
-
-	/* AXI Output 1 Y Configuration, Part 1 */
-	uint32_t            out1yimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out1yimagewidthin64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 1 Y Configuration, Part 2 */
-	uint8_t             out1yburstlen:2;
-	uint32_t            out1ynumrows:12;
-	uint32_t            out1yrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 1 CbCr Configuration, Part 1 */
-	uint32_t            out1cbcrimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out1cbcrimagewidthin64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 1 CbCr Configuration, Part 2 */
-	uint8_t             out1cbcrburstlen:2;
-	uint32_t            out1cbcrnumrows:12;
-	uint32_t            out1cbcrrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 Y Configuration, Part 1 */
-	uint32_t            out2yimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out2yimagewidthin64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 Y Configuration, Part 2 */
-	uint8_t             out2yburstlen:2;
-	uint32_t            out2ynumrows:12;
-	uint32_t            out2yrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 CbCr Configuration, Part 1 */
-	uint32_t            out2cbcrimageheight:12;
-	uint32_t            /* reserved */ : 4;
-	uint32_t            out2cbcrimagewidtein64bitwords:10;
-	uint32_t            /* reserved */ : 6;
-
-	/* AXI Output 2 CbCr Configuration, Part 2 */
-	uint8_t             out2cbcrburstlen:2;
-	uint32_t            out2cbcrnumrows:12;
-	uint32_t            out2cbcrrowincin64bitincs:12;
-	uint32_t            /* reserved */ : 6;
-
-	/* Address configuration:
-	 * output1 phisycal address */
-	unsigned long   output1buffer1_y_phy;
-	unsigned long   output1buffer1_cbcr_phy;
-	unsigned long   output1buffer2_y_phy;
-	unsigned long   output1buffer2_cbcr_phy;
-	unsigned long   output1buffer3_y_phy;
-	unsigned long   output1buffer3_cbcr_phy;
-	unsigned long   output1buffer4_y_phy;
-	unsigned long   output1buffer4_cbcr_phy;
-	unsigned long   output1buffer5_y_phy;
-	unsigned long   output1buffer5_cbcr_phy;
-	unsigned long   output1buffer6_y_phy;
-	unsigned long   output1buffer6_cbcr_phy;
-	unsigned long   output1buffer7_y_phy;
-	unsigned long   output1buffer7_cbcr_phy;
-	unsigned long   output1buffer8_y_phy;
-	unsigned long   output1buffer8_cbcr_phy;
-
-	/* output2 phisycal address */
-	unsigned long   output2buffer1_y_phy;
-	unsigned long   output2buffer1_cbcr_phy;
-	unsigned long   output2buffer2_y_phy;
-	unsigned long   output2buffer2_cbcr_phy;
-	unsigned long   output2buffer3_y_phy;
-	unsigned long   output2buffer3_cbcr_phy;
-	unsigned long   output2buffer4_y_phy;
-	unsigned long   output2buffer4_cbcr_phy;
-	unsigned long   output2buffer5_y_phy;
-	unsigned long   output2buffer5_cbcr_phy;
-	unsigned long   output2buffer6_y_phy;
-	unsigned long   output2buffer6_cbcr_phy;
-	unsigned long   output2buffer7_y_phy;
-	unsigned long   output2buffer7_cbcr_phy;
-	unsigned long   output2buffer8_y_phy;
-	unsigned long   output2buffer8_cbcr_phy;
-} __packed;
-
-struct vfe_stats_we_cfg {
-	uint32_t       header;
-
-	/* White Balance/Exposure Statistic Selection */
-	uint8_t        wb_expstatsenable:1;
-	uint8_t        wb_expstatbuspriorityselection:1;
-	unsigned int   wb_expstatbuspriorityvalue:4;
-	unsigned int   /* reserved */ : 26;
-
-	/* White Balance/Exposure Statistic Configuration, Part 1 */
-	uint8_t        exposurestatregions:1;
-	uint8_t        exposurestatsubregions:1;
-	unsigned int   /* reserved */ : 14;
-
-	unsigned int   whitebalanceminimumy:8;
-	unsigned int   whitebalancemaximumy:8;
-
-	/* White Balance/Exposure Statistic Configuration, Part 2 */
-	uint8_t wb_expstatslopeofneutralregionline[
-		NUM_WB_EXP_NEUTRAL_REGION_LINES];
-
-	/* White Balance/Exposure Statistic Configuration, Part 3 */
-	unsigned int   wb_expstatcrinterceptofneutralregionline2:12;
-	unsigned int   /* reserved */ : 4;
-	unsigned int   wb_expstatcbinterceptofneutralreginnline1:12;
-	unsigned int    /* reserved */ : 4;
-
-	/* White Balance/Exposure Statistic Configuration, Part 4 */
-	unsigned int   wb_expstatcrinterceptofneutralregionline4:12;
-	unsigned int   /* reserved */ : 4;
-	unsigned int   wb_expstatcbinterceptofneutralregionline3:12;
-	unsigned int   /* reserved */ : 4;
-
-	/* White Balance/Exposure Statistic Output Buffer Header */
-	unsigned int   wb_expmetricheaderpattern:8;
-	unsigned int   /* reserved */ : 24;
-
-	/* White Balance/Exposure Statistic Output Buffers-MUST
-	* BE 64 bit ALIGNED */
-	void  *wb_expstatoutputbuffer[NUM_WB_EXP_STAT_OUTPUT_BUFFERS];
-} __packed;
-
-struct vfe_stats_af_cfg {
-	uint32_t header;
-
-	/* Autofocus Statistic Selection */
-	uint8_t       af_enable:1;
-	uint8_t       af_busprioritysel:1;
-	unsigned int  af_buspriorityval:4;
-	unsigned int  /* reserved */ : 26;
-
-	/* Autofocus Statistic Configuration, Part 1 */
-	unsigned int  af_singlewinvoffset:12;
-	unsigned int  /* reserved */ : 4;
-	unsigned int  af_singlewinhoffset:12;
-	unsigned int  /* reserved */ : 3;
-	uint8_t       af_winmode:1;
-
-	/* Autofocus Statistic Configuration, Part 2 */
-	unsigned int  af_singglewinvh:11;
-	unsigned int  /* reserved */ : 5;
-	unsigned int  af_singlewinhw:11;
-	unsigned int  /* reserved */ : 5;
-
-	/* Autofocus Statistic Configuration, Parts 3-6 */
-	uint8_t       af_multiwingrid[NUM_AUTOFOCUS_MULTI_WINDOW_GRIDS];
-
-	/* Autofocus Statistic Configuration, Part 7 */
-	signed int    af_metrichpfcoefa00:5;
-	signed int    af_metrichpfcoefa04:5;
-	unsigned int  af_metricmaxval:11;
-	uint8_t       af_metricsel:1;
-	unsigned int  /* reserved */ : 10;
-
-	/* Autofocus Statistic Configuration, Part 8 */
-	signed int    af_metrichpfcoefa20:5;
-	signed int    af_metrichpfcoefa21:5;
-	signed int    af_metrichpfcoefa22:5;
-	signed int    af_metrichpfcoefa23:5;
-	signed int    af_metrichpfcoefa24:5;
-	unsigned int  /* reserved */ : 7;
-
-	/* Autofocus Statistic Output Buffer Header */
-	unsigned int  af_metrichp:8;
-	unsigned int  /* reserved */ : 24;
-
-	/* Autofocus Statistic Output Buffers - MUST BE 64 bit ALIGNED!!! */
-	void *af_outbuf[NUM_AF_STAT_OUTPUT_BUFFERS];
-} __packed; /* VFE_StatsAutofocusConfigCmdType */
-
-struct msm_camera_frame_msg {
-	unsigned long   output_y_address;
-	unsigned long   output_cbcr_address;
-
-	unsigned int    blacklevelevenColumn:23;
-	uint16_t        reserved1:9;
-	unsigned int    blackleveloddColumn:23;
-	uint16_t        reserved2:9;
-
-	uint16_t        greendefectpixelcount:8;
-	uint16_t        reserved3:8;
-	uint16_t        redbluedefectpixelcount:8;
-	uint16_t        reserved4:8;
-} __packed;
-
-/* New one for 7k */
-struct msm_vfe_command_7k {
-	uint16_t queue;
-	uint16_t length;
-	void     *value;
-};
-
-struct stop_event {
-	wait_queue_head_t wait;
-	int state;
-	int timeout;
-};
-struct vfe_error_msg {
-	unsigned int camif_error:1;
-	unsigned int output1ybusoverflow:1;
-	unsigned int output1cbcrbusoverflow:1;
-	unsigned int output2ybusoverflow:1;
-	unsigned int output2cbcrbusoverflow:1;
-	unsigned int autofocusstatbusoverflow:1;
-	unsigned int wb_expstatbusoverflow:1;
-	unsigned int axierror:1;
-	unsigned int /* reserved */ : 24;
-	unsigned int camif_staus:1;
-	unsigned int pixel_count:14;
-	unsigned int line_count:14;
-	unsigned int /*reserved */ : 3;
-} __packed;
-
-static struct msm_free_buf *vfe2x_check_free_buffer(int id, int path);
-
-#endif /* __MSM_VFE7X_H__ */
diff --git a/drivers/media/video/msm/vfe/msm_vfe8x.c b/drivers/media/video/msm/vfe/msm_vfe8x.c
deleted file mode 100644
index 953d634..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe8x.c
+++ /dev/null
@@ -1,843 +0,0 @@
-/* Copyright (c) 2009, 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/slab.h>
-#include <linux/uaccess.h>
-#include <linux/interrupt.h>
-#include <mach/irqs.h>
-#include "msm_vfe8x_proc.h"
-#include <linux/pm_qos.h>
-
-#define ON  1
-#define OFF 0
-
-static const char *vfe_general_cmd[] = {
-	"START",  /* 0 */
-	"RESET",
-	"AXI_INPUT_CONFIG",
-	"CAMIF_CONFIG",
-	"AXI_OUTPUT_CONFIG",
-	"BLACK_LEVEL_CONFIG",  /* 5 */
-	"ROLL_OFF_CONFIG",
-	"DEMUX_CHANNEL_GAIN_CONFIG",
-	"DEMOSAIC_CONFIG",
-	"FOV_CROP_CONFIG",
-	"MAIN_SCALER_CONFIG",  /* 10 */
-	"WHITE_BALANCE_CONFIG",
-	"COLOR_CORRECTION_CONFIG",
-	"LA_CONFIG",
-	"RGB_GAMMA_CONFIG",
-	"CHROMA_ENHAN_CONFIG",  /* 15 */
-	"CHROMA_SUPPRESSION_CONFIG",
-	"ASF_CONFIG",
-	"SCALER2Y_CONFIG",
-	"SCALER2CbCr_CONFIG",
-	"CHROMA_SUBSAMPLE_CONFIG",  /* 20 */
-	"FRAME_SKIP_CONFIG",
-	"OUTPUT_CLAMP_CONFIG",
-	"TEST_GEN_START",
-	"UPDATE",
-	"OUTPUT1_ACK",  /* 25 */
-	"OUTPUT2_ACK",
-	"EPOCH1_ACK",
-	"EPOCH2_ACK",
-	"STATS_AUTOFOCUS_ACK",
-	"STATS_WB_EXP_ACK",  /* 30 */
-	"BLACK_LEVEL_UPDATE",
-	"DEMUX_CHANNEL_GAIN_UPDATE",
-	"DEMOSAIC_BPC_UPDATE",
-	"DEMOSAIC_ABF_UPDATE",
-	"FOV_CROP_UPDATE",  /* 35 */
-	"WHITE_BALANCE_UPDATE",
-	"COLOR_CORRECTION_UPDATE",
-	"LA_UPDATE",
-	"RGB_GAMMA_UPDATE",
-	"CHROMA_ENHAN_UPDATE",  /* 40 */
-	"CHROMA_SUPPRESSION_UPDATE",
-	"MAIN_SCALER_UPDATE",
-	"SCALER2CbCr_UPDATE",
-	"SCALER2Y_UPDATE",
-	"ASF_UPDATE",  /* 45 */
-	"FRAME_SKIP_UPDATE",
-	"CAMIF_FRAME_UPDATE",
-	"STATS_AUTOFOCUS_UPDATE",
-	"STATS_WB_EXP_UPDATE",
-	"STOP",  /* 50 */
-	"GET_HW_VERSION",
-	"STATS_SETTING",
-	"STATS_AUTOFOCUS_START",
-	"STATS_AUTOFOCUS_STOP",
-	"STATS_WB_EXP_START",  /* 55 */
-	"STATS_WB_EXP_STOP",
-	"ASYNC_TIMER_SETTING",
-};
-
-static void     *vfe_syncdata;
-
-static int vfe_enable(struct camera_enable_cmd *enable)
-{
-	return 0;
-}
-
-static int vfe_disable(struct camera_enable_cmd *enable,
-	struct platform_device *dev)
-{
-	vfe_stop();
-	msm_camio_disable(dev);
-	return 0;
-}
-
-static void vfe_release(struct platform_device *dev)
-{
-	msm_camio_disable(dev);
-	vfe_cmd_release(dev);
-	update_axi_qos(PM_QOS_DEFAULT_VALUE);
-	vfe_syncdata = NULL;
-}
-
-static void vfe_config_axi(int mode,
-			   struct axidata *ad,
-			   struct vfe_cmd_axi_output_config *ao)
-{
-	struct msm_pmem_region *regptr, *regptr1;
-	int i, j;
-	uint32_t *p1, *p2;
-
-	if (mode == OUTPUT_1 || mode == OUTPUT_1_AND_2) {
-		regptr = ad->region;
-		for (i = 0; i < ad->bufnum1; i++) {
-
-			p1 = &(ao->output1.outputY.outFragments[i][0]);
-			p2 = &(ao->output1.outputCbcr.outFragments[i][0]);
-
-			for (j = 0; j < ao->output1.fragmentCount; j++) {
-
-				*p1 = regptr->paddr + regptr->info.planar0_off;
-				p1++;
-
-				*p2 = regptr->paddr + regptr->info.planar1_off;
-				p2++;
-			}
-			regptr++;
-		}
-	} /* if OUTPUT1 or Both */
-
-	if (mode == OUTPUT_2 || mode == OUTPUT_1_AND_2) {
-
-		regptr = &(ad->region[ad->bufnum1]);
-		CDBG("bufnum2 = %d\n", ad->bufnum2);
-
-		for (i = 0; i < ad->bufnum2; i++) {
-
-			p1 = &(ao->output2.outputY.outFragments[i][0]);
-			p2 = &(ao->output2.outputCbcr.outFragments[i][0]);
-
-			CDBG("config_axi: O2, phy = 0x%lx, y_off = %d, "\
-			     "cbcr_off = %d\n", regptr->paddr,
-				regptr->info.planar0_off,
-				regptr->info.planar1_off);
-
-			for (j = 0; j < ao->output2.fragmentCount; j++) {
-
-				*p1 = regptr->paddr + regptr->info.planar0_off;
-				CDBG("vfe_config_axi: p1 = 0x%x\n", *p1);
-				p1++;
-
-				*p2 = regptr->paddr + regptr->info.planar1_off;
-				CDBG("vfe_config_axi: p2 = 0x%x\n", *p2);
-				p2++;
-			}
-			regptr++;
-		}
-	}
-	/* For video configuration */
-	if (mode == OUTPUT_1_AND_3) {
-		/* this is preview buffer. */
-		regptr =  &(ad->region[0]);
-		/* this is video buffer. */
-		regptr1 = &(ad->region[ad->bufnum1]);
-		CDBG("bufnum1 = %d\n", ad->bufnum1);
-		CDBG("bufnum2 = %d\n", ad->bufnum2);
-
-	for (i = 0; i < ad->bufnum1; i++) {
-		p1 = &(ao->output1.outputY.outFragments[i][0]);
-		p2 = &(ao->output1.outputCbcr.outFragments[i][0]);
-
-		CDBG("config_axi: O1, phy = 0x%lx, y_off = %d, "\
-			 "cbcr_off = %d\n", regptr->paddr,
-			 regptr->info.planar0_off, regptr->info.planar1_off);
-
-			for (j = 0; j < ao->output1.fragmentCount; j++) {
-
-				*p1 = regptr->paddr + regptr->info.planar0_off;
-				CDBG("vfe_config_axi: p1 = 0x%x\n", *p1);
-				p1++;
-
-				*p2 = regptr->paddr + regptr->info.planar1_off;
-				CDBG("vfe_config_axi: p2 = 0x%x\n", *p2);
-				p2++;
-			}
-			regptr++;
-		}
-	for (i = 0; i < ad->bufnum2; i++) {
-		p1 = &(ao->output2.outputY.outFragments[i][0]);
-		p2 = &(ao->output2.outputCbcr.outFragments[i][0]);
-
-		CDBG("config_axi: O2, phy = 0x%lx, y_off = %d, "\
-			 "cbcr_off = %d\n", regptr1->paddr,
-			 regptr1->info.planar0_off, regptr1->info.planar1_off);
-
-			for (j = 0; j < ao->output2.fragmentCount; j++) {
-				*p1 = regptr1->paddr +
-					regptr1->info.planar0_off;
-				CDBG("vfe_config_axi: p1 = 0x%x\n", *p1);
-				p1++;
-				*p2 = regptr1->paddr +
-					r1->info.planar1_off;
-				CDBG("vfe_config_axi: p2 = 0x%x\n", *p2);
-				p2++;
-			}
-			regptr1++;
-		}
-	}
-
-}
-
-#define CHECKED_COPY_FROM_USER(in) {					\
-	if (cmd->length != sizeof(*(in))) {				\
-		pr_err("msm_camera: %s:%d cmd %d: user data size %d "	\
-			"!= kernel data size %d\n",			\
-			__func__, __LINE__,				\
-			cmd->id, cmd->length, sizeof(*(in)));		\
-		rc = -EIO;						\
-		break;							\
-	}								\
-	if (copy_from_user((in), (void __user *)cmd->value,		\
-			sizeof(*(in)))) {				\
-		rc = -EFAULT;						\
-		break;							\
-	}								\
-}
-
-static int vfe_proc_general(struct msm_vfe_command_8k *cmd)
-{
-	int rc = 0;
-
-	CDBG("%s: cmdID = %s\n", __func__, vfe_general_cmd[cmd->id]);
-
-	switch (cmd->id) {
-	case VFE_CMD_ID_RESET:
-		msm_camio_vfe_blk_reset();
-		msm_camio_camif_pad_reg_reset_2();
-		vfe_reset();
-		break;
-
-	case VFE_CMD_ID_START: {
-		struct vfe_cmd_start start;
-			CHECKED_COPY_FROM_USER(&start);
-
-		/* msm_camio_camif_pad_reg_reset_2(); */
-		msm_camio_camif_pad_reg_reset();
-		vfe_start(&start);
-	}
-		break;
-
-	case VFE_CMD_ID_CAMIF_CONFIG: {
-		struct vfe_cmd_camif_config camif;
-			CHECKED_COPY_FROM_USER(&camif);
-
-		vfe_camif_config(&camif);
-	}
-		break;
-
-	case VFE_CMD_ID_BLACK_LEVEL_CONFIG: {
-		struct vfe_cmd_black_level_config bl;
-			CHECKED_COPY_FROM_USER(&bl);
-
-		vfe_black_level_config(&bl);
-	}
-		break;
-
-	case VFE_CMD_ID_ROLL_OFF_CONFIG:{
-			/* rolloff is too big to be on the stack */
-			struct vfe_cmd_roll_off_config *rolloff =
-			    kmalloc(sizeof(struct vfe_cmd_roll_off_config),
-				    GFP_KERNEL);
-			if (!rolloff) {
-				pr_err("%s: out of memory\n", __func__);
-				rc = -ENOMEM;
-				break;
-			}
-			/* Wrap CHECKED_COPY_FROM_USER() in a do-while(0) loop
-			 * to make sure we free rolloff when copy_from_user()
-			 * fails.
-			 */
-			do {
-				CHECKED_COPY_FROM_USER(rolloff);
-				vfe_roll_off_config(rolloff);
-			} while (0);
-			kfree(rolloff);
-	}
-		break;
-
-	case VFE_CMD_ID_DEMUX_CHANNEL_GAIN_CONFIG: {
-		struct vfe_cmd_demux_channel_gain_config demuxc;
-			CHECKED_COPY_FROM_USER(&demuxc);
-
-		/* demux is always enabled.  */
-		vfe_demux_channel_gain_config(&demuxc);
-	}
-		break;
-
-	case VFE_CMD_ID_DEMOSAIC_CONFIG: {
-		struct vfe_cmd_demosaic_config demosaic;
-			CHECKED_COPY_FROM_USER(&demosaic);
-
-		vfe_demosaic_config(&demosaic);
-	}
-		break;
-
-	case VFE_CMD_ID_FOV_CROP_CONFIG:
-	case VFE_CMD_ID_FOV_CROP_UPDATE: {
-		struct vfe_cmd_fov_crop_config fov;
-			CHECKED_COPY_FROM_USER(&fov);
-
-		vfe_fov_crop_config(&fov);
-	}
-		break;
-
-	case VFE_CMD_ID_MAIN_SCALER_CONFIG:
-	case VFE_CMD_ID_MAIN_SCALER_UPDATE: {
-		struct vfe_cmd_main_scaler_config mainds;
-			CHECKED_COPY_FROM_USER(&mainds);
-
-		vfe_main_scaler_config(&mainds);
-	}
-		break;
-
-	case VFE_CMD_ID_WHITE_BALANCE_CONFIG:
-	case VFE_CMD_ID_WHITE_BALANCE_UPDATE: {
-		struct vfe_cmd_white_balance_config wb;
-			CHECKED_COPY_FROM_USER(&wb);
-
-		vfe_white_balance_config(&wb);
-	}
-		break;
-
-	case VFE_CMD_ID_COLOR_CORRECTION_CONFIG:
-	case VFE_CMD_ID_COLOR_CORRECTION_UPDATE: {
-		struct vfe_cmd_color_correction_config cc;
-			CHECKED_COPY_FROM_USER(&cc);
-
-		vfe_color_correction_config(&cc);
-	}
-		break;
-
-	case VFE_CMD_ID_LA_CONFIG: {
-		struct vfe_cmd_la_config la;
-			CHECKED_COPY_FROM_USER(&la);
-
-		vfe_la_config(&la);
-	}
-		break;
-
-	case VFE_CMD_ID_RGB_GAMMA_CONFIG: {
-		struct vfe_cmd_rgb_gamma_config rgb;
-			CHECKED_COPY_FROM_USER(&rgb);
-
-		rc = vfe_rgb_gamma_config(&rgb);
-	}
-		break;
-
-	case VFE_CMD_ID_CHROMA_ENHAN_CONFIG:
-	case VFE_CMD_ID_CHROMA_ENHAN_UPDATE: {
-		struct vfe_cmd_chroma_enhan_config chrom;
-			CHECKED_COPY_FROM_USER(&chrom);
-
-		vfe_chroma_enhan_config(&chrom);
-	}
-		break;
-
-	case VFE_CMD_ID_CHROMA_SUPPRESSION_CONFIG:
-	case VFE_CMD_ID_CHROMA_SUPPRESSION_UPDATE: {
-		struct vfe_cmd_chroma_suppression_config chromsup;
-			CHECKED_COPY_FROM_USER(&chromsup);
-
-		vfe_chroma_sup_config(&chromsup);
-	}
-		break;
-
-	case VFE_CMD_ID_ASF_CONFIG: {
-		struct vfe_cmd_asf_config asf;
-			CHECKED_COPY_FROM_USER(&asf);
-
-		vfe_asf_config(&asf);
-	}
-		break;
-
-	case VFE_CMD_ID_SCALER2Y_CONFIG:
-	case VFE_CMD_ID_SCALER2Y_UPDATE: {
-		struct vfe_cmd_scaler2_config ds2y;
-			CHECKED_COPY_FROM_USER(&ds2y);
-
-		vfe_scaler2y_config(&ds2y);
-	}
-		break;
-
-	case VFE_CMD_ID_SCALER2CbCr_CONFIG:
-	case VFE_CMD_ID_SCALER2CbCr_UPDATE: {
-		struct vfe_cmd_scaler2_config ds2cbcr;
-			CHECKED_COPY_FROM_USER(&ds2cbcr);
-
-		vfe_scaler2cbcr_config(&ds2cbcr);
-	}
-		break;
-
-	case VFE_CMD_ID_CHROMA_SUBSAMPLE_CONFIG: {
-		struct vfe_cmd_chroma_subsample_config sub;
-			CHECKED_COPY_FROM_USER(&sub);
-
-		vfe_chroma_subsample_config(&sub);
-	}
-		break;
-
-	case VFE_CMD_ID_FRAME_SKIP_CONFIG: {
-		struct vfe_cmd_frame_skip_config fskip;
-			CHECKED_COPY_FROM_USER(&fskip);
-
-		vfe_frame_skip_config(&fskip);
-	}
-		break;
-
-	case VFE_CMD_ID_OUTPUT_CLAMP_CONFIG: {
-		struct vfe_cmd_output_clamp_config clamp;
-			CHECKED_COPY_FROM_USER(&clamp);
-
-		vfe_output_clamp_config(&clamp);
-	}
-		break;
-
-	/* module update commands */
-	case VFE_CMD_ID_BLACK_LEVEL_UPDATE: {
-		struct vfe_cmd_black_level_config blk;
-			CHECKED_COPY_FROM_USER(&blk);
-
-		vfe_black_level_update(&blk);
-	}
-		break;
-
-	case VFE_CMD_ID_DEMUX_CHANNEL_GAIN_UPDATE: {
-		struct vfe_cmd_demux_channel_gain_config dmu;
-			CHECKED_COPY_FROM_USER(&dmu);
-
-		vfe_demux_channel_gain_update(&dmu);
-	}
-		break;
-
-	case VFE_CMD_ID_DEMOSAIC_BPC_UPDATE: {
-		struct vfe_cmd_demosaic_bpc_update demo_bpc;
-			CHECKED_COPY_FROM_USER(&demo_bpc);
-
-		vfe_demosaic_bpc_update(&demo_bpc);
-	}
-		break;
-
-	case VFE_CMD_ID_DEMOSAIC_ABF_UPDATE: {
-		struct vfe_cmd_demosaic_abf_update demo_abf;
-			CHECKED_COPY_FROM_USER(&demo_abf);
-
-		vfe_demosaic_abf_update(&demo_abf);
-	}
-		break;
-
-	case VFE_CMD_ID_LA_UPDATE: {
-		struct vfe_cmd_la_config la;
-			CHECKED_COPY_FROM_USER(&la);
-
-		vfe_la_update(&la);
-	}
-		break;
-
-	case VFE_CMD_ID_RGB_GAMMA_UPDATE: {
-		struct vfe_cmd_rgb_gamma_config rgb;
-			CHECKED_COPY_FROM_USER(&rgb);
-
-		rc = vfe_rgb_gamma_update(&rgb);
-	}
-		break;
-
-	case VFE_CMD_ID_ASF_UPDATE: {
-		struct vfe_cmd_asf_update asf;
-			CHECKED_COPY_FROM_USER(&asf);
-
-		vfe_asf_update(&asf);
-	}
-		break;
-
-	case VFE_CMD_ID_FRAME_SKIP_UPDATE: {
-		struct vfe_cmd_frame_skip_update fskip;
-			CHECKED_COPY_FROM_USER(&fskip);
-			/* Start recording */
-			if (fskip.output2Pattern == 0xffffffff)
-				update_axi_qos(MSM_AXI_QOS_RECORDING);
-			 else if (fskip.output2Pattern == 0)
-				update_axi_qos(MSM_AXI_QOS_PREVIEW);
-
-		vfe_frame_skip_update(&fskip);
-	}
-		break;
-
-	case VFE_CMD_ID_CAMIF_FRAME_UPDATE: {
-		struct vfe_cmds_camif_frame fup;
-			CHECKED_COPY_FROM_USER(&fup);
-
-		vfe_camif_frame_update(&fup);
-	}
-		break;
-
-	/* stats update commands */
-	case VFE_CMD_ID_STATS_AUTOFOCUS_UPDATE: {
-		struct vfe_cmd_stats_af_update afup;
-			CHECKED_COPY_FROM_USER(&afup);
-
-		vfe_stats_update_af(&afup);
-	}
-		break;
-
-	case VFE_CMD_ID_STATS_WB_EXP_UPDATE: {
-		struct vfe_cmd_stats_wb_exp_update wbexp;
-			CHECKED_COPY_FROM_USER(&wbexp);
-
-		vfe_stats_update_wb_exp(&wbexp);
-	}
-		break;
-
-	/* control of start, stop, update, etc... */
-	case VFE_CMD_ID_STOP:
-		vfe_stop();
-		break;
-
-	case VFE_CMD_ID_GET_HW_VERSION:
-		break;
-
-	/* stats */
-	case VFE_CMD_ID_STATS_SETTING: {
-		struct vfe_cmd_stats_setting stats;
-			CHECKED_COPY_FROM_USER(&stats);
-
-		vfe_stats_setting(&stats);
-	}
-		break;
-
-	case VFE_CMD_ID_STATS_AUTOFOCUS_START: {
-		struct vfe_cmd_stats_af_start af;
-			CHECKED_COPY_FROM_USER(&af);
-
-		vfe_stats_start_af(&af);
-	}
-		break;
-
-	case VFE_CMD_ID_STATS_AUTOFOCUS_STOP:
-		vfe_stats_af_stop();
-		break;
-
-	case VFE_CMD_ID_STATS_WB_EXP_START: {
-		struct vfe_cmd_stats_wb_exp_start awexp;
-			CHECKED_COPY_FROM_USER(&awexp);
-
-		vfe_stats_start_wb_exp(&awexp);
-	}
-		break;
-
-	case VFE_CMD_ID_STATS_WB_EXP_STOP:
-		vfe_stats_wb_exp_stop();
-		break;
-
-	case VFE_CMD_ID_ASYNC_TIMER_SETTING:
-		break;
-
-	case VFE_CMD_ID_UPDATE:
-		vfe_update();
-		break;
-
-	/* test gen */
-	case VFE_CMD_ID_TEST_GEN_START:
-		break;
-
-/*
-  acknowledge from upper layer
-	these are not in general command.
-
-	case VFE_CMD_ID_OUTPUT1_ACK:
-		break;
-	case VFE_CMD_ID_OUTPUT2_ACK:
-		break;
-	case VFE_CMD_ID_EPOCH1_ACK:
-		break;
-	case VFE_CMD_ID_EPOCH2_ACK:
-		break;
-	case VFE_CMD_ID_STATS_AUTOFOCUS_ACK:
-		break;
-	case VFE_CMD_ID_STATS_WB_EXP_ACK:
-		break;
-*/
-
-	default:
-		pr_err("%s: invalid cmd id %d\n", __func__, cmd->id);
-		rc = -EINVAL;
-		break;
-	} /* switch */
-
-	return rc;
-}
-
-static int vfe_config(struct msm_vfe_cfg_cmd *cmd, void *data)
-{
-	struct msm_pmem_region *regptr;
-	struct msm_vfe_command_8k vfecmd;
-	struct vfe_cmd_axi_output_config axio;
-	struct axidata *axid = data;
-
-	int rc = 0;
-
-
-	if (cmd->cmd_type != CMD_FRAME_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_BUF_RELEASE &&
-		cmd->cmd_type != CMD_STATS_AF_BUF_RELEASE) {
-
-		if (copy_from_user(&vfecmd,
-			(void __user *)(cmd->value), sizeof(vfecmd))) {
-			pr_err("%s %d: copy_from_user failed\n",
-				__func__, __LINE__);
-			return -EFAULT;
-		}
-	}
-
-	CDBG("%s: cmdType = %d\n", __func__, cmd->cmd_type);
-
-	switch (cmd->cmd_type) {
-	case CMD_GENERAL:
-		rc = vfe_proc_general(&vfecmd);
-		break;
-
-	case CMD_STATS_ENABLE:
-	case CMD_STATS_AXI_CFG: {
-			int i;
-			struct vfe_cmd_stats_setting scfg;
-
-			BUG_ON(!axid);
-
-			if (vfecmd.length != sizeof(scfg)) {
-				pr_err
-				("msm_camera: %s: cmd %d: user-space "\
-				"data size %d != kernel data size %d\n",
-				__func__,
-				cmd->cmd_type, vfecmd.length,
-				sizeof(scfg));
-				return -EIO;
-			}
-
-			if (copy_from_user(&scfg,
-				(void __user *)(vfecmd.value),
-				sizeof(scfg))) {
-				pr_err("%s %d: copy_from_user failed\n",
-				__func__, __LINE__);
-			return -EFAULT;
-		}
-
-		regptr = axid->region;
-		if (axid->bufnum1 > 0) {
-			for (i = 0; i < axid->bufnum1; i++) {
-					scfg.awbBuffer[i] =
-					(uint32_t)(regptr->paddr);
-				regptr++;
-			}
-		}
-
-		if (axid->bufnum2 > 0) {
-			for (i = 0; i < axid->bufnum2; i++) {
-					scfg.afBuffer[i] =
-					(uint32_t)(regptr->paddr);
-				regptr++;
-			}
-		}
-
-			vfe_stats_setting(&scfg);
-	}
-		break;
-
-	case CMD_STATS_AF_AXI_CFG:
-		break;
-
-	case CMD_FRAME_BUF_RELEASE: {
-		/* preview buffer release */
-		struct msm_frame *b;
-		unsigned long p;
-		struct vfe_cmd_output_ack fack;
-
-			BUG_ON(!data);
-
-		b = (struct msm_frame *)(cmd->value);
-		p = *(unsigned long *)data;
-
-			fack.ybufaddr[0] = (uint32_t) (p + b->planar0_off);
-
-			fack.chromabufaddr[0] = (uint32_t) (p + b->planar1_off);
-
-		if (b->path == OUTPUT_TYPE_P)
-			vfe_output_p_ack(&fack);
-
-		if ((b->path == OUTPUT_TYPE_V)
-			 || (b->path == OUTPUT_TYPE_S))
-			vfe_output_v_ack(&fack);
-	}
-		break;
-
-	case CMD_SNAP_BUF_RELEASE:
-		break;
-
-	case CMD_STATS_BUF_RELEASE: {
-		struct vfe_cmd_stats_wb_exp_ack sack;
-
-			BUG_ON(!data);
-
-		sack.nextWbExpOutputBufferAddr = *(uint32_t *)data;
-		vfe_stats_wb_exp_ack(&sack);
-	}
-		break;
-
-	case CMD_STATS_AF_BUF_RELEASE: {
-		struct vfe_cmd_stats_af_ack ack;
-
-			BUG_ON(!data);
-
-		ack.nextAFOutputBufferAddr = *(uint32_t *)data;
-		vfe_stats_af_ack(&ack);
-	}
-		break;
-
-	case CMD_AXI_CFG_PREVIEW:
-	case CMD_RAW_PICT_AXI_CFG: {
-
-			BUG_ON(!axid);
-
-			if (copy_from_user(&axio, (void __user *)(vfecmd.value),
-				sizeof(axio))) {
-				pr_err("%s %d: copy_from_user failed\n",
-					__func__, __LINE__);
-			return -EFAULT;
-		}
-			/* Validate the data from user space */
-			if (axio.output2.fragmentCount <
-				VFE_MIN_NUM_FRAGMENTS_PER_FRAME ||
-				axio.output2.fragmentCount >
-				VFE_MAX_NUM_FRAGMENTS_PER_FRAME)
-				return -EINVAL;
-
-			vfe_config_axi(OUTPUT_2, axid, &axio);
-			axio.outputDataSize = 0;
-			vfe_axi_output_config(&axio);
-	}
-		break;
-
-	case CMD_AXI_CFG_SNAP: {
-
-			BUG_ON(!axid);
-
-			if (copy_from_user(&axio, (void __user *)(vfecmd.value),
-				sizeof(axio))) {
-				pr_err("%s %d: copy_from_user failed\n",
-					__func__, __LINE__);
-			return -EFAULT;
-		}
-			/* Validate the data from user space */
-			if (axio.output1.fragmentCount <
-				VFE_MIN_NUM_FRAGMENTS_PER_FRAME ||
-				axio.output1.fragmentCount >
-				VFE_MAX_NUM_FRAGMENTS_PER_FRAME ||
-				axio.output2.fragmentCount <
-				VFE_MIN_NUM_FRAGMENTS_PER_FRAME ||
-				axio.output2.fragmentCount >
-				VFE_MAX_NUM_FRAGMENTS_PER_FRAME)
-				return -EINVAL;
-
-			vfe_config_axi(OUTPUT_1_AND_2, axid, &axio);
-			vfe_axi_output_config(&axio);
-	}
-		break;
-
-	case CMD_AXI_CFG_VIDEO: {
-			BUG_ON(!axid);
-
-			if (copy_from_user(&axio, (void __user *)(vfecmd.value),
-				sizeof(axio))) {
-				pr_err("%s %d: copy_from_user failed\n",
-					__func__, __LINE__);
-			return -EFAULT;
-		}
-			/* Validate the data from user space */
-			if (axio.output1.fragmentCount <
-				VFE_MIN_NUM_FRAGMENTS_PER_FRAME ||
-				axio.output1.fragmentCount >
-				VFE_MAX_NUM_FRAGMENTS_PER_FRAME ||
-				axio.output2.fragmentCount <
-				VFE_MIN_NUM_FRAGMENTS_PER_FRAME ||
-				axio.output2.fragmentCount >
-				VFE_MAX_NUM_FRAGMENTS_PER_FRAME)
-				return -EINVAL;
-
-			vfe_config_axi(OUTPUT_1_AND_3, axid, &axio);
-			axio.outputDataSize = 0;
-			vfe_axi_output_config(&axio);
-	}
-		break;
-
-	default:
-		break;
-	} /* switch */
-
-	return rc;
-}
-
-static int vfe_init(struct msm_vfe_callback *presp, struct platform_device *dev)
-{
-	int rc = 0;
-
-	rc = vfe_cmd_init(presp, dev, vfe_syncdata);
-	if (rc < 0)
-		return rc;
-
-	/* Bring up all the required GPIOs and Clocks */
-	rc = msm_camio_enable(dev);
-
-	return rc;
-}
-
-void msm_camvfe_fn_init(struct msm_camvfe_fn *fptr, void *data)
-{
-	fptr->vfe_init    = vfe_init;
-	fptr->vfe_enable  = vfe_enable;
-	fptr->vfe_config  = vfe_config;
-	fptr->vfe_disable = vfe_disable;
-	fptr->vfe_release = vfe_release;
-	vfe_syncdata = data;
-}
-
-void msm_camvpe_fn_init(struct msm_camvpe_fn *fptr, void *data)
-{
-	fptr->vpe_reg		= NULL;
-	fptr->send_frame_to_vpe	= NULL;
-	fptr->vpe_config	= NULL;
-	fptr->vpe_cfg_update	= NULL;
-	fptr->dis		= NULL;
-}
diff --git a/drivers/media/video/msm/vfe/msm_vfe8x.h b/drivers/media/video/msm/vfe/msm_vfe8x.h
deleted file mode 100644
index 54e9c95..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe8x.h
+++ /dev/null
@@ -1,909 +0,0 @@
-/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MSM_VFE8X_H__
-#define __MSM_VFE8X_H__
-
-#define TRUE  1
-#define FALSE 0
-#define boolean uint8_t
-
-enum  VFE_STATE {
-	VFE_STATE_IDLE,
-	VFE_STATE_ACTIVE
-};
-
-enum vfe_cmd_id {
-	/*
-	*Important! Command_ID are arranged in order.
-	*Don't change!*/
-	VFE_CMD_ID_START,
-	VFE_CMD_ID_RESET,
-
-	/* bus and camif config */
-	VFE_CMD_ID_AXI_INPUT_CONFIG,
-	VFE_CMD_ID_CAMIF_CONFIG,
-	VFE_CMD_ID_AXI_OUTPUT_CONFIG,
-
-	/* module config  */
-	VFE_CMD_ID_BLACK_LEVEL_CONFIG,
-	VFE_CMD_ID_ROLL_OFF_CONFIG,
-	VFE_CMD_ID_DEMUX_CHANNEL_GAIN_CONFIG,
-	VFE_CMD_ID_DEMOSAIC_CONFIG,
-	VFE_CMD_ID_FOV_CROP_CONFIG,
-	VFE_CMD_ID_MAIN_SCALER_CONFIG,
-	VFE_CMD_ID_WHITE_BALANCE_CONFIG,
-	VFE_CMD_ID_COLOR_CORRECTION_CONFIG,
-	VFE_CMD_ID_LA_CONFIG,
-	VFE_CMD_ID_RGB_GAMMA_CONFIG,
-	VFE_CMD_ID_CHROMA_ENHAN_CONFIG,
-	VFE_CMD_ID_CHROMA_SUPPRESSION_CONFIG,
-	VFE_CMD_ID_ASF_CONFIG,
-	VFE_CMD_ID_SCALER2Y_CONFIG,
-	VFE_CMD_ID_SCALER2CbCr_CONFIG,
-	VFE_CMD_ID_CHROMA_SUBSAMPLE_CONFIG,
-	VFE_CMD_ID_FRAME_SKIP_CONFIG,
-	VFE_CMD_ID_OUTPUT_CLAMP_CONFIG,
-
-	/* test gen */
-	VFE_CMD_ID_TEST_GEN_START,
-
-	VFE_CMD_ID_UPDATE,
-
-	/* ackownledge from upper layer */
-	VFE_CMD_ID_OUTPUT1_ACK,
-	VFE_CMD_ID_OUTPUT2_ACK,
-	VFE_CMD_ID_EPOCH1_ACK,
-	VFE_CMD_ID_EPOCH2_ACK,
-	VFE_CMD_ID_STATS_AUTOFOCUS_ACK,
-	VFE_CMD_ID_STATS_WB_EXP_ACK,
-
-	/* module update commands */
-	VFE_CMD_ID_BLACK_LEVEL_UPDATE,
-	VFE_CMD_ID_DEMUX_CHANNEL_GAIN_UPDATE,
-	VFE_CMD_ID_DEMOSAIC_BPC_UPDATE,
-	VFE_CMD_ID_DEMOSAIC_ABF_UPDATE,
-	VFE_CMD_ID_FOV_CROP_UPDATE,
-	VFE_CMD_ID_WHITE_BALANCE_UPDATE,
-	VFE_CMD_ID_COLOR_CORRECTION_UPDATE,
-	VFE_CMD_ID_LA_UPDATE,
-	VFE_CMD_ID_RGB_GAMMA_UPDATE,
-	VFE_CMD_ID_CHROMA_ENHAN_UPDATE,
-	VFE_CMD_ID_CHROMA_SUPPRESSION_UPDATE,
-	VFE_CMD_ID_MAIN_SCALER_UPDATE,
-	VFE_CMD_ID_SCALER2CbCr_UPDATE,
-	VFE_CMD_ID_SCALER2Y_UPDATE,
-	VFE_CMD_ID_ASF_UPDATE,
-	VFE_CMD_ID_FRAME_SKIP_UPDATE,
-	VFE_CMD_ID_CAMIF_FRAME_UPDATE,
-
-	/* stats update commands */
-	VFE_CMD_ID_STATS_AUTOFOCUS_UPDATE,
-	VFE_CMD_ID_STATS_WB_EXP_UPDATE,
-
-	/* control of start, stop, update, etc... */
-  VFE_CMD_ID_STOP,
-	VFE_CMD_ID_GET_HW_VERSION,
-
-	/* stats */
-	VFE_CMD_ID_STATS_SETTING,
-	VFE_CMD_ID_STATS_AUTOFOCUS_START,
-	VFE_CMD_ID_STATS_AUTOFOCUS_STOP,
-	VFE_CMD_ID_STATS_WB_EXP_START,
-	VFE_CMD_ID_STATS_WB_EXP_STOP,
-
-	VFE_CMD_ID_ASYNC_TIMER_SETTING,
-
-	/* max id  */
-	VFE_CMD_ID_MAX
-};
-
-struct vfe_cmd_hw_version {
-	uint32_t minorVersion;
-	uint32_t majorVersion;
-	uint32_t coreVersion;
-};
-
-enum VFE_CAMIF_SYNC_EDGE {
-	VFE_CAMIF_SYNC_EDGE_ActiveHigh,
-	VFE_CAMIF_SYNC_EDGE_ActiveLow
-};
-
-enum VFE_CAMIF_SYNC_MODE {
-	VFE_CAMIF_SYNC_MODE_APS,
-	VFE_CAMIF_SYNC_MODE_EFS,
-	VFE_CAMIF_SYNC_MODE_ELS,
-	VFE_CAMIF_SYNC_MODE_ILLEGAL
-};
-
-struct vfe_cmds_camif_efs {
-	uint8_t efsendofline;
-	uint8_t efsstartofline;
-	uint8_t efsendofframe;
-	uint8_t efsstartofframe;
-};
-
-struct vfe_cmds_camif_frame {
-	uint16_t pixelsPerLine;
-	uint16_t linesPerFrame;
-};
-
-struct vfe_cmds_camif_window {
-	uint16_t firstpixel;
-	uint16_t lastpixel;
-	uint16_t firstline;
-	uint16_t lastline;
-};
-
-enum CAMIF_SUBSAMPLE_FRAME_SKIP {
-	CAMIF_SUBSAMPLE_FRAME_SKIP_0,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_AllFrames,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_2Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_3Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_4Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_5Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_6Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_7Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_8Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_9Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_10Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_11Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_12Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_13Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_14Frame,
-	CAMIF_SUBSAMPLE_FRAME_SKIP_ONE_OUT_OF_EVERY_15Frame
-};
-
-struct vfe_cmds_camif_subsample {
-	uint16_t pixelskipmask;
-	uint16_t lineskipmask;
-	enum CAMIF_SUBSAMPLE_FRAME_SKIP frameskip;
-	uint8_t frameskipmode;
-	uint8_t pixelskipwrap;
-};
-
-struct vfe_cmds_camif_epoch {
-	uint8_t  enable;
-	uint16_t lineindex;
-};
-
-struct vfe_cmds_camif_cfg {
-	enum VFE_CAMIF_SYNC_EDGE  vSyncEdge;
-	enum VFE_CAMIF_SYNC_EDGE  hSyncEdge;
-	enum VFE_CAMIF_SYNC_MODE  syncMode;
-	uint8_t vfeSubSampleEnable;
-	uint8_t busSubSampleEnable;
-	uint8_t irqSubSampleEnable;
-	uint8_t binningEnable;
-	uint8_t misrEnable;
-};
-
-struct vfe_cmd_camif_config {
-	struct vfe_cmds_camif_cfg camifConfig;
-	struct vfe_cmds_camif_efs EFS;
-	struct vfe_cmds_camif_frame     frame;
-	struct vfe_cmds_camif_window    window;
-	struct vfe_cmds_camif_subsample subsample;
-	struct vfe_cmds_camif_epoch     epoch1;
-	struct vfe_cmds_camif_epoch     epoch2;
-};
-
-enum VFE_AXI_OUTPUT_MODE {
-	VFE_AXI_OUTPUT_MODE_Output1,
-	VFE_AXI_OUTPUT_MODE_Output2,
-	VFE_AXI_OUTPUT_MODE_Output1AndOutput2,
-	VFE_AXI_OUTPUT_MODE_CAMIFToAXIViaOutput2,
-	VFE_AXI_OUTPUT_MODE_Output2AndCAMIFToAXIViaOutput1,
-	VFE_AXI_OUTPUT_MODE_Output1AndCAMIFToAXIViaOutput2,
-	VFE_AXI_LAST_OUTPUT_MODE_ENUM
-};
-
-enum VFE_RAW_WR_PATH_SEL {
-	VFE_RAW_OUTPUT_DISABLED,
-	VFE_RAW_OUTPUT_ENC_CBCR_PATH,
-	VFE_RAW_OUTPUT_VIEW_CBCR_PATH,
-	VFE_RAW_OUTPUT_PATH_INVALID
-};
-
-enum VFE_RAW_PIXEL_DATA_SIZE {
-	VFE_RAW_PIXEL_DATA_SIZE_8BIT,
-	VFE_RAW_PIXEL_DATA_SIZE_10BIT,
-	VFE_RAW_PIXEL_DATA_SIZE_12BIT,
-};
-
-#define VFE_AXI_OUTPUT_BURST_LENGTH     4
-#define VFE_MAX_NUM_FRAGMENTS_PER_FRAME 4
-#define VFE_MIN_NUM_FRAGMENTS_PER_FRAME 1
-#define VFE_AXI_OUTPUT_CFG_FRAME_COUNT  3
-
-struct vfe_cmds_axi_out_per_component {
-	uint16_t imageWidth;
-	uint16_t imageHeight;
-	uint16_t outRowCount;
-	uint16_t outRowIncrement;
-	uint32_t outFragments[VFE_AXI_OUTPUT_CFG_FRAME_COUNT]
-		[VFE_MAX_NUM_FRAGMENTS_PER_FRAME];
-};
-
-struct vfe_cmds_axi_per_output_path {
-	uint8_t fragmentCount;
-	struct vfe_cmds_axi_out_per_component outputY;
-	struct vfe_cmds_axi_out_per_component outputCbcr;
-};
-
-enum VFE_AXI_BURST_LENGTH {
-	VFE_AXI_BURST_LENGTH_IS_2  = 2,
-	VFE_AXI_BURST_LENGTH_IS_4  = 4,
-	VFE_AXI_BURST_LENGTH_IS_8  = 8,
-	VFE_AXI_BURST_LENGTH_IS_16 = 16
-};
-
-struct vfe_cmd_axi_output_config {
-	enum VFE_AXI_BURST_LENGTH burstLength;
-	enum VFE_AXI_OUTPUT_MODE outputMode;
-	enum VFE_RAW_PIXEL_DATA_SIZE outputDataSize;
-	struct vfe_cmds_axi_per_output_path output1;
-	struct vfe_cmds_axi_per_output_path output2;
-};
-
-struct vfe_cmd_fov_crop_config {
-	uint8_t enable;
-	uint16_t firstPixel;
-	uint16_t lastPixel;
-	uint16_t firstLine;
-	uint16_t lastLine;
-};
-
-struct vfe_cmds_main_scaler_stripe_init {
-	uint16_t MNCounterInit;
-	uint16_t phaseInit;
-};
-
-struct vfe_cmds_scaler_one_dimension {
-	uint8_t  enable;
-	uint16_t inputSize;
-	uint16_t outputSize;
-	uint32_t phaseMultiplicationFactor;
-	uint8_t  interpolationResolution;
-};
-
-struct vfe_cmd_main_scaler_config {
-	uint8_t enable;
-	struct vfe_cmds_scaler_one_dimension    hconfig;
-	struct vfe_cmds_scaler_one_dimension    vconfig;
-	struct vfe_cmds_main_scaler_stripe_init MNInitH;
-	struct vfe_cmds_main_scaler_stripe_init MNInitV;
-};
-
-struct vfe_cmd_scaler2_config {
-	uint8_t enable;
-	struct vfe_cmds_scaler_one_dimension hconfig;
-	struct vfe_cmds_scaler_one_dimension vconfig;
-};
-
-struct vfe_cmd_frame_skip_config {
-	uint8_t output1Period;
-	uint32_t output1Pattern;
-	uint8_t output2Period;
-	uint32_t output2Pattern;
-};
-
-struct vfe_cmd_frame_skip_update {
-	uint32_t output1Pattern;
-	uint32_t output2Pattern;
-};
-
-struct vfe_cmd_output_clamp_config {
-	uint8_t minCh0;
-	uint8_t minCh1;
-	uint8_t minCh2;
-	uint8_t maxCh0;
-	uint8_t maxCh1;
-	uint8_t maxCh2;
-};
-
-struct vfe_cmd_chroma_subsample_config {
-	uint8_t enable;
-	uint8_t cropEnable;
-	uint8_t vsubSampleEnable;
-	uint8_t hsubSampleEnable;
-	uint8_t vCosited;
-	uint8_t hCosited;
-	uint8_t vCositedPhase;
-	uint8_t hCositedPhase;
-	uint16_t cropWidthFirstPixel;
-	uint16_t cropWidthLastPixel;
-	uint16_t cropHeightFirstLine;
-	uint16_t cropHeightLastLine;
-};
-
-enum VFE_START_INPUT_SOURCE {
-	VFE_START_INPUT_SOURCE_CAMIF,
-	VFE_START_INPUT_SOURCE_TESTGEN,
-	VFE_START_INPUT_SOURCE_AXI,
-	VFE_START_INPUT_SOURCE_INVALID
-};
-
-enum VFE_START_OPERATION_MODE {
-	VFE_START_OPERATION_MODE_CONTINUOUS,
-	VFE_START_OPERATION_MODE_SNAPSHOT
-};
-
-enum VFE_START_PIXEL_PATTERN {
-	VFE_BAYER_RGRGRG,
-	VFE_BAYER_GRGRGR,
-	VFE_BAYER_BGBGBG,
-	VFE_BAYER_GBGBGB,
-	VFE_YUV_YCbYCr,
-	VFE_YUV_YCrYCb,
-	VFE_YUV_CbYCrY,
-	VFE_YUV_CrYCbY
-};
-
-enum VFE_BUS_RD_INPUT_PIXEL_PATTERN {
-	VFE_BAYER_RAW,
-	VFE_YUV_INTERLEAVED,
-	VFE_YUV_PSEUDO_PLANAR_Y,
-	VFE_YUV_PSEUDO_PLANAR_CBCR
-};
-
-enum VFE_YUV_INPUT_COSITING_MODE {
-	VFE_YUV_COSITED,
-	VFE_YUV_INTERPOLATED
-};
-
-struct vfe_cmd_start {
-	enum VFE_START_INPUT_SOURCE inputSource;
-	enum VFE_START_OPERATION_MODE operationMode;
-	uint8_t     snapshotCount;
-	enum VFE_START_PIXEL_PATTERN pixel;
-	enum VFE_YUV_INPUT_COSITING_MODE yuvInputCositingMode;
-};
-
-struct vfe_cmd_output_ack {
-	uint32_t ybufaddr[VFE_MAX_NUM_FRAGMENTS_PER_FRAME];
-	uint32_t chromabufaddr[VFE_MAX_NUM_FRAGMENTS_PER_FRAME];
-};
-
-#define VFE_STATS_BUFFER_COUNT 3
-
-struct vfe_cmd_stats_setting {
-	uint16_t frameHDimension;
-	uint16_t frameVDimension;
-	uint8_t  afBusPrioritySelection;
-	uint8_t  afBusPriority;
-	uint8_t  awbBusPrioritySelection;
-	uint8_t  awbBusPriority;
-	uint8_t  histBusPrioritySelection;
-	uint8_t  histBusPriority;
-	uint32_t afBuffer[VFE_STATS_BUFFER_COUNT];
-	uint32_t awbBuffer[VFE_STATS_BUFFER_COUNT];
-	uint32_t histBuffer[VFE_STATS_BUFFER_COUNT];
-};
-
-struct vfe_cmd_stats_af_start {
-	uint8_t  enable;
-	uint8_t  windowMode;
-	uint16_t windowHOffset;
-	uint16_t windowVOffset;
-	uint16_t windowWidth;
-	uint16_t windowHeight;
-	uint8_t  gridForMultiWindows[16];
-	uint8_t     metricSelection;
-	int16_t  metricMax;
-	int8_t   highPassCoef[7];
-	int8_t   bufferHeader;
-};
-
-struct vfe_cmd_stats_af_update {
-	uint8_t  windowMode;
-	uint16_t windowHOffset;
-	uint16_t windowVOffset;
-	uint16_t windowWidth;
-	uint16_t windowHeight;
-};
-
-struct vfe_cmd_stats_wb_exp_start {
-	uint8_t   enable;
-	uint8_t   wbExpRegions;
-	uint8_t   wbExpSubRegion;
-	uint8_t   awbYMin;
-	uint8_t   awbYMax;
-	int8_t    awbMCFG[4];
-	int16_t   awbCCFG[4];
-	int8_t    axwHeader;
-};
-
-struct vfe_cmd_stats_wb_exp_update {
-	uint8_t wbExpRegions;
-	uint8_t wbExpSubRegion;
-	int8_t  awbYMin;
-	int8_t  awbYMax;
-	int8_t  awbMCFG[4];
-	int16_t awbCCFG[4];
-};
-
-struct vfe_cmd_stats_af_ack {
-	uint32_t nextAFOutputBufferAddr;
-};
-
-struct vfe_cmd_stats_wb_exp_ack {
-	uint32_t  nextWbExpOutputBufferAddr;
-};
-
-struct vfe_cmd_black_level_config {
-	uint8_t  enable;
-	uint16_t evenEvenAdjustment;
-	uint16_t evenOddAdjustment;
-	uint16_t oddEvenAdjustment;
-	uint16_t oddOddAdjustment;
-};
-
-/* 13*1  */
-#define  VFE_ROLL_OFF_INIT_TABLE_SIZE  13
-/* 13*16 */
-#define  VFE_ROLL_OFF_DELTA_TABLE_SIZE 208
-
-struct vfe_cmd_roll_off_config {
-	uint8_t  enable;
-	uint16_t gridWidth;
-	uint16_t gridHeight;
-	uint16_t  yDelta;
-	uint8_t  gridXIndex;
-	uint8_t  gridYIndex;
-	uint16_t gridPixelXIndex;
-	uint16_t gridPixelYIndex;
-	uint16_t yDeltaAccum;
-	uint16_t initTableR[VFE_ROLL_OFF_INIT_TABLE_SIZE];
-	uint16_t initTableGr[VFE_ROLL_OFF_INIT_TABLE_SIZE];
-	uint16_t initTableB[VFE_ROLL_OFF_INIT_TABLE_SIZE];
-	uint16_t initTableGb[VFE_ROLL_OFF_INIT_TABLE_SIZE];
-	int16_t  deltaTableR[VFE_ROLL_OFF_DELTA_TABLE_SIZE];
-	int16_t  deltaTableGr[VFE_ROLL_OFF_DELTA_TABLE_SIZE];
-	int16_t  deltaTableB[VFE_ROLL_OFF_DELTA_TABLE_SIZE];
-	int16_t  deltaTableGb[VFE_ROLL_OFF_DELTA_TABLE_SIZE];
-};
-
-struct vfe_cmd_demux_channel_gain_config {
-	uint16_t ch0EvenGain;
-	uint16_t ch0OddGain;
-	uint16_t ch1Gain;
-	uint16_t ch2Gain;
-};
-
-struct vfe_cmds_demosaic_abf {
-	uint8_t   enable;
-	uint8_t   forceOn;
-	uint8_t   shift;
-	uint16_t  lpThreshold;
-	uint16_t  max;
-	uint16_t  min;
-	uint8_t   ratio;
-};
-
-struct vfe_cmds_demosaic_bpc {
-	uint8_t   enable;
-	uint16_t  fmaxThreshold;
-	uint16_t  fminThreshold;
-	uint16_t  redDiffThreshold;
-	uint16_t  blueDiffThreshold;
-	uint16_t  greenDiffThreshold;
-};
-
-struct vfe_cmd_demosaic_config {
-	uint8_t   enable;
-	uint8_t   slopeShift;
-	struct vfe_cmds_demosaic_abf abfConfig;
-	struct vfe_cmds_demosaic_bpc bpcConfig;
-};
-
-struct vfe_cmd_demosaic_bpc_update {
-	struct vfe_cmds_demosaic_bpc bpcUpdate;
-};
-
-struct vfe_cmd_demosaic_abf_update {
-	struct vfe_cmds_demosaic_abf abfUpdate;
-};
-
-struct vfe_cmd_white_balance_config {
-	uint8_t  enable;
-	uint16_t ch2Gain;
-	uint16_t ch1Gain;
-	uint16_t ch0Gain;
-};
-
-enum VFE_COLOR_CORRECTION_COEF_QFACTOR {
-	COEF_IS_Q7_SIGNED,
-	COEF_IS_Q8_SIGNED,
-	COEF_IS_Q9_SIGNED,
-	COEF_IS_Q10_SIGNED
-};
-
-struct vfe_cmd_color_correction_config {
-	uint8_t     enable;
-	enum VFE_COLOR_CORRECTION_COEF_QFACTOR coefQFactor;
-	int16_t  C0;
-	int16_t  C1;
-	int16_t  C2;
-	int16_t  C3;
-	int16_t  C4;
-	int16_t  C5;
-	int16_t  C6;
-	int16_t  C7;
-	int16_t  C8;
-	int16_t  K0;
-	int16_t  K1;
-	int16_t  K2;
-};
-
-#define VFE_LA_TABLE_LENGTH 256
-struct vfe_cmd_la_config {
-	uint8_t enable;
-	int16_t table[VFE_LA_TABLE_LENGTH];
-};
-
-#define VFE_GAMMA_TABLE_LENGTH 256
-enum VFE_RGB_GAMMA_TABLE_SELECT {
-	RGB_GAMMA_CH0_SELECTED,
-	RGB_GAMMA_CH1_SELECTED,
-	RGB_GAMMA_CH2_SELECTED,
-	RGB_GAMMA_CH0_CH1_SELECTED,
-	RGB_GAMMA_CH0_CH2_SELECTED,
-	RGB_GAMMA_CH1_CH2_SELECTED,
-	RGB_GAMMA_CH0_CH1_CH2_SELECTED
-};
-
-struct vfe_cmd_rgb_gamma_config {
-	uint8_t enable;
-	enum VFE_RGB_GAMMA_TABLE_SELECT channelSelect;
-	int16_t table[VFE_GAMMA_TABLE_LENGTH];
-};
-
-struct vfe_cmd_chroma_enhan_config {
-	uint8_t  enable;
-	int16_t am;
-	int16_t ap;
-	int16_t bm;
-	int16_t bp;
-	int16_t cm;
-	int16_t cp;
-	int16_t dm;
-	int16_t dp;
-	int16_t kcr;
-	int16_t kcb;
-	int16_t RGBtoYConversionV0;
-	int16_t RGBtoYConversionV1;
-	int16_t RGBtoYConversionV2;
-	uint8_t RGBtoYConversionOffset;
-};
-
-struct vfe_cmd_chroma_suppression_config {
-	uint8_t enable;
-	uint8_t m1;
-	uint8_t m3;
-	uint8_t n1;
-	uint8_t n3;
-	uint8_t nn1;
-	uint8_t mm1;
-};
-
-struct vfe_cmd_asf_config {
-	uint8_t enable;
-	uint8_t smoothFilterEnabled;
-	uint8_t sharpMode;
-	uint8_t smoothCoefCenter;
-	uint8_t smoothCoefSurr;
-	uint8_t normalizeFactor;
-	uint8_t sharpK1;
-	uint8_t sharpK2;
-	uint8_t sharpThreshE1;
-	int8_t sharpThreshE2;
-	int8_t sharpThreshE3;
-	int8_t sharpThreshE4;
-	int8_t sharpThreshE5;
-	int8_t filter1Coefficients[9];
-	int8_t filter2Coefficients[9];
-	uint8_t  cropEnable;
-	uint16_t cropFirstPixel;
-	uint16_t cropLastPixel;
-	uint16_t cropFirstLine;
-	uint16_t cropLastLine;
-};
-
-struct vfe_cmd_asf_update {
-	uint8_t enable;
-	uint8_t smoothFilterEnabled;
-	uint8_t sharpMode;
-	uint8_t smoothCoefCenter;
-	uint8_t smoothCoefSurr;
-	uint8_t normalizeFactor;
-	uint8_t sharpK1;
-	uint8_t sharpK2;
-	uint8_t sharpThreshE1;
-	int8_t  sharpThreshE2;
-	int8_t  sharpThreshE3;
-	int8_t  sharpThreshE4;
-	int8_t  sharpThreshE5;
-	int8_t  filter1Coefficients[9];
-	int8_t  filter2Coefficients[9];
-	uint8_t cropEnable;
-};
-
-enum VFE_TEST_GEN_SYNC_EDGE {
-	VFE_TEST_GEN_SYNC_EDGE_ActiveHigh,
-	VFE_TEST_GEN_SYNC_EDGE_ActiveLow
-};
-
-struct vfe_cmd_test_gen_start {
-	uint8_t pixelDataSelect;
-	uint8_t systematicDataSelect;
-	enum VFE_TEST_GEN_SYNC_EDGE  hsyncEdge;
-	enum VFE_TEST_GEN_SYNC_EDGE  vsyncEdge;
-	uint16_t numFrame;
-	enum VFE_RAW_PIXEL_DATA_SIZE pixelDataSize;
-	uint16_t imageWidth;
-	uint16_t imageHeight;
-	uint32_t startOfFrameOffset;
-	uint32_t endOfFrameNOffset;
-	uint16_t startOfLineOffset;
-	uint16_t endOfLineNOffset;
-	uint16_t hbi;
-	uint8_t  vblEnable;
-	uint16_t vbl;
-	uint8_t  startOfFrameDummyLine;
-	uint8_t  endOfFrameDummyLine;
-	uint8_t  unicolorBarEnable;
-	uint8_t  colorBarsSplitEnable;
-	uint8_t  unicolorBarSelect;
-	enum VFE_START_PIXEL_PATTERN  colorBarsPixelPattern;
-	uint8_t  colorBarsRotatePeriod;
-	uint16_t testGenRandomSeed;
-};
-
-struct vfe_cmd_bus_pm_start {
-	uint8_t output2YWrPmEnable;
-	uint8_t output2CbcrWrPmEnable;
-	uint8_t output1YWrPmEnable;
-	uint8_t output1CbcrWrPmEnable;
-};
-
-struct vfe_cmd_camif_frame_update {
-	struct vfe_cmds_camif_frame camifFrame;
-};
-
-struct vfe_cmd_sync_timer_setting {
-	uint8_t  whichSyncTimer;
-	uint8_t  operation;
-	uint8_t  polarity;
-	uint16_t repeatCount;
-	uint16_t hsyncCount;
-	uint32_t pclkCount;
-	uint32_t outputDuration;
-};
-
-struct vfe_cmd_async_timer_setting {
-	uint8_t  whichAsyncTimer;
-	uint8_t  operation;
-	uint8_t  polarity;
-	uint16_t repeatCount;
-	uint16_t inactiveCount;
-	uint32_t activeCount;
-};
-
-struct  vfe_frame_skip_counts {
-	uint32_t  totalFrameCount;
-	uint32_t  output1Count;
-	uint32_t  output2Count;
-};
-
-enum VFE_AXI_RD_UNPACK_HBI_SEL {
-	VFE_AXI_RD_HBI_32_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_64_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_128_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_256_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_512_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_1024_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_2048_CLOCK_CYCLES,
-	VFE_AXI_RD_HBI_4096_CLOCK_CYCLES
-};
-
-struct vfe_cmd_axi_input_config {
-	uint32_t  fragAddr[4];
-	uint8_t   totalFragmentCount;
-	uint16_t  ySize;
-	uint16_t  xOffset;
-	uint16_t  xSize;
-	uint16_t  rowIncrement;
-	uint16_t  numOfRows;
-	enum VFE_AXI_BURST_LENGTH burstLength;
-	uint8_t   unpackPhase;
-	enum VFE_AXI_RD_UNPACK_HBI_SEL unpackHbi;
-	enum VFE_RAW_PIXEL_DATA_SIZE   pixelSize;
-	uint8_t   padRepeatCountLeft;
-	uint8_t   padRepeatCountRight;
-	uint8_t   padRepeatCountTop;
-	uint8_t   padRepeatCountBottom;
-	uint8_t   padLeftComponentSelectCycle0;
-	uint8_t   padLeftComponentSelectCycle1;
-	uint8_t   padLeftComponentSelectCycle2;
-	uint8_t   padLeftComponentSelectCycle3;
-	uint8_t   padLeftStopCycle0;
-	uint8_t   padLeftStopCycle1;
-	uint8_t   padLeftStopCycle2;
-	uint8_t   padLeftStopCycle3;
-	uint8_t   padRightComponentSelectCycle0;
-	uint8_t   padRightComponentSelectCycle1;
-	uint8_t   padRightComponentSelectCycle2;
-	uint8_t   padRightComponentSelectCycle3;
-	uint8_t   padRightStopCycle0;
-	uint8_t   padRightStopCycle1;
-	uint8_t   padRightStopCycle2;
-	uint8_t   padRightStopCycle3;
-	uint8_t   padTopLineCount;
-	uint8_t   padBottomLineCount;
-};
-
-struct vfe_interrupt_status {
-	uint8_t camifErrorIrq;
-	uint8_t camifSofIrq;
-	uint8_t camifEolIrq;
-	uint8_t camifEofIrq;
-	uint8_t camifEpoch1Irq;
-	uint8_t camifEpoch2Irq;
-	uint8_t camifOverflowIrq;
-	uint8_t ceIrq;
-	uint8_t regUpdateIrq;
-	uint8_t resetAckIrq;
-	uint8_t encYPingpongIrq;
-	uint8_t encCbcrPingpongIrq;
-	uint8_t viewYPingpongIrq;
-	uint8_t viewCbcrPingpongIrq;
-	uint8_t rdPingpongIrq;
-	uint8_t afPingpongIrq;
-	uint8_t awbPingpongIrq;
-	uint8_t histPingpongIrq;
-	uint8_t encIrq;
-	uint8_t viewIrq;
-	uint8_t busOverflowIrq;
-	uint8_t afOverflowIrq;
-	uint8_t awbOverflowIrq;
-	uint8_t syncTimer0Irq;
-	uint8_t syncTimer1Irq;
-	uint8_t syncTimer2Irq;
-	uint8_t asyncTimer0Irq;
-	uint8_t asyncTimer1Irq;
-	uint8_t asyncTimer2Irq;
-	uint8_t asyncTimer3Irq;
-	uint8_t axiErrorIrq;
-	uint8_t violationIrq;
-	uint8_t anyErrorIrqs;
-	uint8_t anyOutput1PathIrqs;
-	uint8_t anyOutput2PathIrqs;
-	uint8_t anyOutputPathIrqs;
-	uint8_t anyAsyncTimerIrqs;
-	uint8_t anySyncTimerIrqs;
-	uint8_t anyIrqForActiveStatesOnly;
-};
-
-enum VFE_MESSAGE_ID {
-	VFE_MSG_ID_RESET_ACK,
-	VFE_MSG_ID_START_ACK,
-	VFE_MSG_ID_STOP_ACK,
-	VFE_MSG_ID_UPDATE_ACK,
-	VFE_MSG_ID_OUTPUT_P,
-	VFE_MSG_ID_OUTPUT_V,
-	VFE_MSG_ID_OUTPUT_S,
-	VFE_MSG_ID_OUTPUT_T,
-	VFE_MSG_ID_SNAPSHOT_DONE,
-	VFE_MSG_ID_STATS_AUTOFOCUS,
-	VFE_MSG_ID_STATS_WB_EXP,
-	VFE_MSG_ID_EPOCH1,
-	VFE_MSG_ID_EPOCH2,
-	VFE_MSG_ID_SYNC_TIMER0_DONE,
-	VFE_MSG_ID_SYNC_TIMER1_DONE,
-	VFE_MSG_ID_SYNC_TIMER2_DONE,
-	VFE_MSG_ID_ASYNC_TIMER0_DONE,
-	VFE_MSG_ID_ASYNC_TIMER1_DONE,
-	VFE_MSG_ID_ASYNC_TIMER2_DONE,
-	VFE_MSG_ID_ASYNC_TIMER3_DONE,
-	VFE_MSG_ID_AF_OVERFLOW,
-	VFE_MSG_ID_AWB_OVERFLOW,
-	VFE_MSG_ID_AXI_ERROR,
-	VFE_MSG_ID_CAMIF_OVERFLOW,
-	VFE_MSG_ID_VIOLATION,
-	VFE_MSG_ID_CAMIF_ERROR,
-	VFE_MSG_ID_BUS_OVERFLOW,
-	VFE_MSG_ID_SOF_ACK,
-};
-
-struct vfe_msg_stats_autofocus {
-	uint32_t    afBuffer;
-	uint32_t    frameCounter;
-};
-
-struct vfe_msg_stats_wb_exp {
-	uint32_t awbBuffer;
-	uint32_t frameCounter;
-};
-
-struct vfe_frame_bpc_info {
-	uint32_t greenDefectPixelCount;
-	uint32_t redBlueDefectPixelCount;
-};
-
-struct vfe_frame_asf_info {
-	uint32_t  asfMaxEdge;
-	uint32_t  asfHbiCount;
-};
-
-struct vfe_msg_camif_status {
-	uint8_t  camifState;
-	uint32_t pixelCount;
-	uint32_t lineCount;
-};
-
-struct vfe_bus_pm_per_path {
-	uint32_t yWrPmStats0;
-	uint32_t yWrPmStats1;
-	uint32_t cbcrWrPmStats0;
-	uint32_t cbcrWrPmStats1;
-};
-
-struct vfe_bus_performance_monitor {
-	struct vfe_bus_pm_per_path encPathPmInfo;
-	struct vfe_bus_pm_per_path viewPathPmInfo;
-};
-
-struct vfe_irq_thread_msg {
-	uint32_t  vfeIrqStatus;
-	uint32_t  camifStatus;
-	uint32_t  demosaicStatus;
-	uint32_t  asfMaxEdge;
-	struct vfe_bus_performance_monitor pmInfo;
-};
-
-struct vfe_msg_output {
-	uint32_t  yBuffer;
-	uint32_t  cbcrBuffer;
-	struct vfe_frame_bpc_info bpcInfo;
-	struct vfe_frame_asf_info asfInfo;
-	uint32_t  frameCounter;
-	struct vfe_bus_pm_per_path pmData;
-};
-
-struct vfe_message {
-	enum VFE_MESSAGE_ID _d;
-	union {
-		struct vfe_msg_output              msgOutput1;
-		struct vfe_msg_output              msgOutput2;
-		struct vfe_msg_stats_autofocus     msgStatsAf;
-		struct vfe_msg_stats_wb_exp        msgStatsWbExp;
-		struct vfe_msg_camif_status        msgCamifError;
-		struct vfe_bus_performance_monitor msgBusOverflow;
-   } _u;
-};
-
-/* New one for 8k */
-struct msm_vfe_command_8k {
-	int id;
-	uint16_t length;
-	void     *value;
-};
-
-struct vfe_frame_extra {
-	struct vfe_frame_bpc_info bpcInfo;
-	struct vfe_frame_asf_info asfInfo;
-	uint32_t  frameCounter;
-	struct vfe_bus_pm_per_path pmData;
-};
-#endif /* __MSM_VFE8X_H__ */
diff --git a/drivers/media/video/msm/vfe/msm_vfe8x_proc.c b/drivers/media/video/msm/vfe/msm_vfe8x_proc.c
deleted file mode 100644
index 4ebb30d..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe8x_proc.c
+++ /dev/null
@@ -1,3889 +0,0 @@
-/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/spinlock.h>
-#include <linux/io.h>
-#include <linux/list.h>
-#include <linux/delay.h>
-#include <linux/platform_device.h>
-#include "msm_vfe8x_proc.h"
-#include <media/msm_camera.h>
-#include <mach/board.h>
-
-struct isr_queue_cmd {
-	struct list_head list;
-	struct vfe_interrupt_status vfeInterruptStatus;
-	struct vfe_frame_asf_info vfeAsfFrameInfo;
-	struct vfe_frame_bpc_info vfeBpcFrameInfo;
-	struct vfe_msg_camif_status vfeCamifStatusLocal;
-	struct vfe_bus_performance_monitor vfePmData;
-};
-
-struct msm_vfe8x_ctrl {
-	/* bit 1:0 ENC_IRQ_MASK = 0x11:
-	 * generate IRQ when both y and cbcr frame is ready. */
-
-	/* bit 1:0 VIEW_IRQ_MASK= 0x11:
-	 * generate IRQ when both y and cbcr frame is ready. */
-	struct vfe_irq_composite_mask_config vfeIrqCompositeMaskLocal;
-	struct vfe_module_enable vfeModuleEnableLocal;
-	struct vfe_camif_cfg_data   vfeCamifConfigLocal;
-	struct vfe_interrupt_mask   vfeImaskLocal;
-	struct vfe_stats_cmd_data   vfeStatsCmdLocal;
-	struct vfe_bus_cfg_data     vfeBusConfigLocal;
-	struct vfe_cmd_bus_pm_start vfeBusPmConfigLocal;
-	struct vfe_bus_cmd_data     vfeBusCmdLocal;
-	enum vfe_interrupt_name     vfeInterruptNameLocal;
-	uint32_t vfeLaBankSel;
-	struct vfe_gamma_lut_sel  vfeGammaLutSel;
-
-	boolean vfeStartAckPendingFlag;
-	boolean vfeStopAckPending;
-	boolean vfeResetAckPending;
-	boolean vfeUpdateAckPending;
-
-	enum VFE_AXI_OUTPUT_MODE        axiOutputMode;
-	enum VFE_START_OPERATION_MODE   vfeOperationMode;
-
-	atomic_t vfe_serv_interrupt;
-
-	uint32_t            vfeSnapShotCount;
-	uint32_t            vfeRequestedSnapShotCount;
-	boolean             vfeStatsPingPongReloadFlag;
-	uint32_t            vfeFrameId;
-
-	struct vfe_cmd_frame_skip_config vfeFrameSkip;
-	uint32_t vfeFrameSkipPattern;
-	uint8_t  vfeFrameSkipCount;
-	uint8_t  vfeFrameSkipPeriod;
-
-	boolean  vfeTestGenStartFlag;
-	uint32_t vfeImaskPacked;
-	uint32_t vfeImaskCompositePacked;
-	enum VFE_RAW_PIXEL_DATA_SIZE       axiInputDataSize;
-	struct vfe_irq_thread_msg          vfeIrqThreadMsgLocal;
-
-	struct vfe_output_path_combo  viewPath;
-	struct vfe_output_path_combo  encPath;
-	struct vfe_frame_skip_counts vfeDroppedFrameCounts;
-	struct vfe_stats_control afStatsControl;
-	struct vfe_stats_control awbStatsControl;
-
-	enum VFE_STATE  vstate;
-
-	struct msm_vfe_callback *resp;
-	struct vfe_frame_extra extdata;
-
-	struct isr_queue_cmd irqs[10];
-	spinlock_t irqs_lock;
-	int irq_get;
-	int irq_put;
-
-	int vfeirq;
-	void __iomem *vfebase;
-
-	void *syncdata;
-};
-
-static struct msm_vfe8x_ctrl *ctrl;
-static spinlock_t msm_vfe_ctrl_lock;
-
-static void vfe_prog_hw(uint8_t *hwreg, uint32_t *inptr, uint32_t regcnt)
-{
-	/* unsigned long flags; */
-	uint32_t i;
-	uint32_t *p;
-
-	/* @todo This is causing issues, need further investigate */
-	/* spin_lock_irqsave(&ctrl->io_lock, flags); */
-
-	p = (uint32_t *)(hwreg);
-	for (i = 0; i < (regcnt >> 2); i++)
-		writel(*inptr++, p++);
-		/* *p++ = *inptr++; */
-
-	/* spin_unlock_irqrestore(&ctrl->io_lock, flags); */
-}
-
-static void
-vfe_set_bus_pipo_addr(struct vfe_output_path_combo *vpath,
-	struct vfe_output_path_combo *epath)
-{
-	vpath->yPath.hwRegPingAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_VIEW_Y_WR_PING_ADDR);
-	vpath->yPath.hwRegPongAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_VIEW_Y_WR_PONG_ADDR);
-	vpath->cbcrPath.hwRegPingAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_VIEW_CBCR_WR_PING_ADDR);
-	vpath->cbcrPath.hwRegPongAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_VIEW_CBCR_WR_PONG_ADDR);
-
-	epath->yPath.hwRegPingAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_ENC_Y_WR_PING_ADDR);
-	epath->yPath.hwRegPongAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_ENC_Y_WR_PONG_ADDR);
-	epath->cbcrPath.hwRegPingAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_ENC_CBCR_WR_PING_ADDR);
-	epath->cbcrPath.hwRegPongAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_ENC_CBCR_WR_PONG_ADDR);
-}
-
-static void vfe_axi_output(struct vfe_cmd_axi_output_config *in,
-	struct vfe_output_path_combo *out1,
-	struct vfe_output_path_combo *out2, uint16_t out)
-{
-	struct vfe_axi_out_cfg cmd;
-
-	uint16_t temp;
-	uint32_t burstLength;
-
-	memset(&cmd, 0, sizeof(cmd));
-	/* force it to burst length 4, hardware does not support it. */
-	burstLength = 1;
-
-	/* AXI Output 2 Y Configuration*/
-	/* VFE_BUS_ENC_Y_WR_PING_ADDR  */
-	cmd.out2YPingAddr = out2->yPath.addressBuffer[0];
-
-	/* VFE_BUS_ENC_Y_WR_PONG_ADDR  */
-	cmd.out2YPongAddr = out2->yPath.addressBuffer[1];
-
-	/* VFE_BUS_ENC_Y_WR_IMAGE_SIZE */
-	cmd.out2YImageHeight = in->output2.outputY.imageHeight;
-	/* convert the image width and row increment to be in
-	 * unit of 64bit (8 bytes) */
-	temp = (in->output2.outputY.imageWidth + (out - 1)) / out;
-	cmd.out2YImageWidthin64bit = temp;
-
-	/* VFE_BUS_ENC_Y_WR_BUFFER_CFG */
-	cmd.out2YBurstLength = burstLength;
-	cmd.out2YNumRows = in->output2.outputY.outRowCount;
-	temp = (in->output2.outputY.outRowIncrement + (out - 1)) / out;
-	cmd.out2YRowIncrementIn64bit = temp;
-
-	/* AXI Output 2 Cbcr Configuration*/
-	/* VFE_BUS_ENC_Cbcr_WR_PING_ADDR  */
-	cmd.out2CbcrPingAddr = out2->cbcrPath.addressBuffer[0];
-
-	/* VFE_BUS_ENC_Cbcr_WR_PONG_ADDR  */
-	cmd.out2CbcrPongAddr = out2->cbcrPath.addressBuffer[1];
-
-	/* VFE_BUS_ENC_Cbcr_WR_IMAGE_SIZE */
-	cmd.out2CbcrImageHeight = in->output2.outputCbcr.imageHeight;
-	temp = (in->output2.outputCbcr.imageWidth + (out - 1)) / out;
-	cmd.out2CbcrImageWidthIn64bit = temp;
-
-	/* VFE_BUS_ENC_Cbcr_WR_BUFFER_CFG */
-	cmd.out2CbcrBurstLength = burstLength;
-	cmd.out2CbcrNumRows = in->output2.outputCbcr.outRowCount;
-	temp = (in->output2.outputCbcr.outRowIncrement + (out - 1)) / out;
-	cmd.out2CbcrRowIncrementIn64bit = temp;
-
-	/* AXI Output 1 Y Configuration */
-	/* VFE_BUS_VIEW_Y_WR_PING_ADDR  */
-	cmd.out1YPingAddr = out1->yPath.addressBuffer[0];
-
-	/* VFE_BUS_VIEW_Y_WR_PONG_ADDR */
-	cmd.out1YPongAddr = out1->yPath.addressBuffer[1];
-
-	/* VFE_BUS_VIEW_Y_WR_IMAGE_SIZE */
-	cmd.out1YImageHeight = in->output1.outputY.imageHeight;
-	temp = (in->output1.outputY.imageWidth + (out - 1)) / out;
-	cmd.out1YImageWidthin64bit = temp;
-
-	/* VFE_BUS_VIEW_Y_WR_BUFFER_CFG     */
-	cmd.out1YBurstLength = burstLength;
-	cmd.out1YNumRows = in->output1.outputY.outRowCount;
-
-	temp = (in->output1.outputY.outRowIncrement + (out - 1)) / out;
-	cmd.out1YRowIncrementIn64bit = temp;
-
-	/* AXI Output 1 Cbcr Configuration*/
-	cmd.out1CbcrPingAddr = out1->cbcrPath.addressBuffer[0];
-
-	/* VFE_BUS_VIEW_Cbcr_WR_PONG_ADDR  */
-	cmd.out1CbcrPongAddr = out1->cbcrPath.addressBuffer[1];
-
-	/* VFE_BUS_VIEW_Cbcr_WR_IMAGE_SIZE */
-	cmd.out1CbcrImageHeight = in->output1.outputCbcr.imageHeight;
-	temp = (in->output1.outputCbcr.imageWidth + (out - 1)) / out;
-	cmd.out1CbcrImageWidthIn64bit = temp;
-
-	cmd.out1CbcrBurstLength = burstLength;
-	cmd.out1CbcrNumRows = in->output1.outputCbcr.outRowCount;
-	temp = (in->output1.outputCbcr.outRowIncrement + (out - 1)) / out;
-
-	cmd.out1CbcrRowIncrementIn64bit = temp;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_BUS_ENC_Y_WR_PING_ADDR,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-static void vfe_reg_bus_cfg(struct vfe_bus_cfg_data *in)
-{
-	struct vfe_axi_bus_cfg cmd;
-
-	memset(&cmd, 0, sizeof(cmd));
-	cmd.stripeRdPathEn      = in->stripeRdPathEn;
-	cmd.encYWrPathEn        = in->encYWrPathEn;
-	cmd.encCbcrWrPathEn     = in->encCbcrWrPathEn;
-	cmd.viewYWrPathEn       = in->viewYWrPathEn;
-	cmd.viewCbcrWrPathEn    = in->viewCbcrWrPathEn;
-	cmd.rawPixelDataSize    = (uint32_t)in->rawPixelDataSize;
-	cmd.rawWritePathSelect  = (uint32_t)in->rawWritePathSelect;
-
-	/*  program vfe_bus_cfg */
-	writel(*((uint32_t *)&cmd), ctrl->vfebase + VFE_BUS_CFG);
-}
-
-static void vfe_reg_camif_config(struct vfe_camif_cfg_data *in)
-{
-	struct VFE_CAMIFConfigType cfg;
-
-	memset(&cfg, 0, sizeof(cfg));
-
-	cfg.VSyncEdge = in->camifCfgFromCmd.vSyncEdge;
-
-	cfg.HSyncEdge = in->camifCfgFromCmd.hSyncEdge;
-
-	cfg.syncMode = in->camifCfgFromCmd.syncMode;
-
-	cfg.vfeSubsampleEnable = in->camifCfgFromCmd.vfeSubSampleEnable;
-
-	cfg.busSubsampleEnable = in->camifCfgFromCmd.busSubSampleEnable;
-
-	cfg.camif2vfeEnable = in->camif2OutputEnable;
-
-	cfg.camif2busEnable = in->camif2BusEnable;
-
-	cfg.irqSubsampleEnable = in->camifCfgFromCmd.irqSubSampleEnable;
-
-	cfg.binningEnable = in->camifCfgFromCmd.binningEnable;
-
-	cfg.misrEnable = in->camifCfgFromCmd.misrEnable;
-
-	/*  program camif_config */
-	writel(*((uint32_t *)&cfg), ctrl->vfebase + CAMIF_CONFIG);
-}
-
-static void vfe_reg_bus_cmd(struct vfe_bus_cmd_data *in)
-{
-	struct vfe_buscmd cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	cmd.stripeReload        = in->stripeReload;
-	cmd.busPingpongReload   = in->busPingpongReload;
-	cmd.statsPingpongReload = in->statsPingpongReload;
-
-	writel(*((uint32_t *)&cmd), ctrl->vfebase + VFE_BUS_CMD);
-
-	CDBG("bus command = 0x%x\n", (*((uint32_t *)&cmd)));
-
-	/* this is needed, as the control bits are pulse based.
-	 * Don't want to reload bus pingpong again. */
-	in->busPingpongReload = 0;
-	in->statsPingpongReload = 0;
-	in->stripeReload = 0;
-}
-
-static void vfe_reg_module_cfg(struct vfe_module_enable *in)
-{
-	struct vfe_mod_enable ena;
-
-	memset(&ena, 0, sizeof(ena));
-
-	ena.blackLevelCorrectionEnable = in->blackLevelCorrectionEnable;
-	ena.lensRollOffEnable          = in->lensRollOffEnable;
-	ena.demuxEnable                = in->demuxEnable;
-	ena.chromaUpsampleEnable       = in->chromaUpsampleEnable;
-	ena.demosaicEnable             = in->demosaicEnable;
-	ena.statsEnable                = in->statsEnable;
-	ena.cropEnable                 = in->cropEnable;
-	ena.mainScalerEnable           = in->mainScalerEnable;
-	ena.whiteBalanceEnable         = in->whiteBalanceEnable;
-	ena.colorCorrectionEnable      = in->colorCorrectionEnable;
-	ena.yHistEnable                = in->yHistEnable;
-	ena.skinToneEnable             = in->skinToneEnable;
-	ena.lumaAdaptationEnable       = in->lumaAdaptationEnable;
-	ena.rgbLUTEnable               = in->rgbLUTEnable;
-	ena.chromaEnhanEnable          = in->chromaEnhanEnable;
-	ena.asfEnable                  = in->asfEnable;
-	ena.chromaSuppressionEnable    = in->chromaSuppressionEnable;
-	ena.chromaSubsampleEnable      = in->chromaSubsampleEnable;
-	ena.scaler2YEnable             = in->scaler2YEnable;
-	ena.scaler2CbcrEnable          = in->scaler2CbcrEnable;
-
-	writel(*((uint32_t *)&ena), ctrl->vfebase + VFE_MODULE_CFG);
-}
-
-static void vfe_program_dmi_cfg(enum VFE_DMI_RAM_SEL bankSel)
-{
-	/* set bit 8 for auto increment. */
-	uint32_t value = (uint32_t) ctrl->vfebase + VFE_DMI_CFG_DEFAULT;
-
-	value += (uint32_t)bankSel;
-	/* CDBG("dmi cfg input bank is  0x%x\n", bankSel); */
-
-	writel(value, ctrl->vfebase + VFE_DMI_CFG);
-	writel(0, ctrl->vfebase + VFE_DMI_ADDR);
-}
-
-static void vfe_write_lens_roll_off_table(struct vfe_cmd_roll_off_config *in)
-{
-	uint16_t i;
-	uint32_t data;
-
-	uint16_t *initGr = in->initTableGr;
-	uint16_t *initGb = in->initTableGb;
-	uint16_t *initB =  in->initTableB;
-	uint16_t *initR =  in->initTableR;
-
-	int16_t *pDeltaGr = in->deltaTableGr;
-	int16_t *pDeltaGb = in->deltaTableGb;
-	int16_t *pDeltaB =  in->deltaTableB;
-	int16_t *pDeltaR =  in->deltaTableR;
-
-	vfe_program_dmi_cfg(ROLLOFF_RAM);
-
-	/* first pack and write init table */
-	for (i = 0; i < VFE_ROLL_OFF_INIT_TABLE_SIZE; i++) {
-		data = (((uint32_t)(*initR)) & 0x0000FFFF) |
-			(((uint32_t)(*initGr)) << 16);
-		initR++;
-		initGr++;
-
-		writel(data, ctrl->vfebase + VFE_DMI_DATA_LO);
-
-		data = (((uint32_t)(*initB)) & 0x0000FFFF) |
-			(((uint32_t)(*initGb))<<16);
-		initB++;
-		initGb++;
-
-		writel(data, ctrl->vfebase + VFE_DMI_DATA_LO);
-	}
-
-	/* there are gaps between the init table and delta table,
-	 * set the offset for delta table. */
-	writel(LENS_ROLL_OFF_DELTA_TABLE_OFFSET, ctrl->vfebase + VFE_DMI_ADDR);
-
-	/* pack and write delta table */
-	for (i = 0; i < VFE_ROLL_OFF_DELTA_TABLE_SIZE; i++) {
-		data = (((int)(*pDeltaR)) & 0x0000FFFF) |
-			(((int)(*pDeltaGr))<<16);
-		pDeltaR++;
-		pDeltaGr++;
-
-		writel(data, ctrl->vfebase + VFE_DMI_DATA_LO);
-
-		data = (((int)(*pDeltaB)) & 0x0000FFFF) |
-			(((int)(*pDeltaGb))<<16);
-		pDeltaB++;
-		pDeltaGb++;
-
-		writel(data, ctrl->vfebase + VFE_DMI_DATA_LO);
-	}
-
-	/* After DMI transfer, to make it safe, need to set the
-	 * DMI_CFG to unselect any SRAM
-	 */
-	/* unselect the SRAM Bank. */
-	writel(VFE_DMI_CFG_DEFAULT, ctrl->vfebase + VFE_DMI_CFG);
-}
-
-static void vfe_set_default_reg_values(void)
-{
-	writel(0x800080, ctrl->vfebase + VFE_DEMUX_GAIN_0);
-	writel(0x800080, ctrl->vfebase + VFE_DEMUX_GAIN_1);
-	writel(0xFFFFF, ctrl->vfebase + VFE_CGC_OVERRIDE);
-
-	/* default frame drop period and pattern */
-	writel(0x1f, ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_CFG);
-	writel(0x1f, ctrl->vfebase + VFE_FRAMEDROP_ENC_CBCR_CFG);
-	writel(0xFFFFFFFF, ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_PATTERN);
-	writel(0xFFFFFFFF, ctrl->vfebase + VFE_FRAMEDROP_ENC_CBCR_PATTERN);
-	writel(0x1f, ctrl->vfebase + VFE_FRAMEDROP_VIEW_Y_CFG);
-	writel(0x1f, ctrl->vfebase + VFE_FRAMEDROP_VIEW_CBCR_CFG);
-	writel(0xFFFFFFFF, ctrl->vfebase + VFE_FRAMEDROP_VIEW_Y_PATTERN);
-	writel(0xFFFFFFFF, ctrl->vfebase + VFE_FRAMEDROP_VIEW_CBCR_PATTERN);
-	writel(0, ctrl->vfebase + VFE_CLAMP_MIN_CFG);
-	writel(0xFFFFFF, ctrl->vfebase + VFE_CLAMP_MAX_CFG);
-}
-
-static void vfe_config_demux(uint32_t period, uint32_t even, uint32_t odd)
-{
-	writel(period, ctrl->vfebase + VFE_DEMUX_CFG);
-	writel(even, ctrl->vfebase + VFE_DEMUX_EVEN_CFG);
-	writel(odd, ctrl->vfebase + VFE_DEMUX_ODD_CFG);
-}
-
-static void vfe_pm_stop(void)
-{
-	writel(VFE_PERFORMANCE_MONITOR_STOP, ctrl->vfebase + VFE_BUS_PM_CMD);
-}
-
-static void vfe_camif_stop_immediately(void)
-{
-	writel(CAMIF_COMMAND_STOP_IMMEDIATELY, ctrl->vfebase + CAMIF_COMMAND);
-	writel(0, ctrl->vfebase + VFE_CGC_OVERRIDE);
-}
-
-static void vfe_program_reg_update_cmd(uint32_t value)
-{
-	writel(value, ctrl->vfebase + VFE_REG_UPDATE_CMD);
-}
-
-static void vfe_program_global_reset_cmd(uint32_t value)
-{
-	writel(value, ctrl->vfebase + VFE_GLOBAL_RESET_CMD);
-}
-
-static void vfe_program_axi_cmd(uint32_t value)
-{
-	writel(value, ctrl->vfebase + VFE_AXI_CMD);
-}
-
-static void vfe_program_irq_composite_mask(uint32_t value)
-{
-	writel(value, ctrl->vfebase + VFE_IRQ_COMPOSITE_MASK);
-}
-
-static inline void vfe_program_irq_mask(uint32_t value)
-{
-	writel(value, ctrl->vfebase + VFE_IRQ_MASK);
-}
-
-static uint32_t vfe_read_axi_status(void)
-{
-	return readl(ctrl->vfebase + VFE_AXI_STATUS);
-}
-
-static void
-vfe_set_stats_pingpong_address(struct vfe_stats_control *afControl,
-	struct vfe_stats_control *awbControl)
-{
-	afControl->hwRegPingAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_STATS_AF_WR_PING_ADDR);
-	afControl->hwRegPongAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_STATS_AF_WR_PONG_ADDR);
-
-	awbControl->hwRegPingAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PING_ADDR);
-	awbControl->hwRegPongAddress = (uint8_t *)
-		(ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PONG_ADDR);
-}
-
-static void vfe_program_lut_bank_sel(struct vfe_gamma_lut_sel *in)
-{
-	struct VFE_GammaLutSelect_ConfigCmdType cmd;
-
-	memset(&cmd, 0, sizeof(cmd));
-
-	cmd.ch0BankSelect = in->ch0BankSelect;
-	cmd.ch1BankSelect = in->ch1BankSelect;
-	cmd.ch2BankSelect = in->ch2BankSelect;
-	CDBG("VFE gamma lut bank selection is 0x%x\n", *((uint32_t *)&cmd));
-	vfe_prog_hw(ctrl->vfebase + VFE_LUT_BANK_SEL,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-static void vfe_program_stats_cmd(struct vfe_stats_cmd_data *in)
-{
-	struct VFE_StatsCmdType stats;
-	memset(&stats, 0, sizeof(stats));
-
-	stats.autoFocusEnable        = in->autoFocusEnable;
-	stats.axwEnable              = in->axwEnable;
-	stats.histEnable             = in->histEnable;
-	stats.clearHistEnable        = in->clearHistEnable;
-	stats.histAutoClearEnable    = in->histAutoClearEnable;
-	stats.colorConversionEnable  = in->colorConversionEnable;
-
-	writel(*((uint32_t *)&stats), ctrl->vfebase + VFE_STATS_CMD);
-}
-
-static void vfe_pm_start(struct vfe_cmd_bus_pm_start *in)
-{
-	struct VFE_Bus_Pm_ConfigCmdType cmd;
-	memset(&cmd, 0, sizeof(struct VFE_Bus_Pm_ConfigCmdType));
-
-	cmd.output2YWrPmEnable     = in->output2YWrPmEnable;
-	cmd.output2CbcrWrPmEnable  = in->output2CbcrWrPmEnable;
-	cmd.output1YWrPmEnable     = in->output1YWrPmEnable;
-	cmd.output1CbcrWrPmEnable  = in->output1CbcrWrPmEnable;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_BUS_PM_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-static void vfe_8k_pm_start(struct vfe_cmd_bus_pm_start *in)
-{
-	in->output1CbcrWrPmEnable = ctrl->vfeBusConfigLocal.viewCbcrWrPathEn;
-	in->output1YWrPmEnable    = ctrl->vfeBusConfigLocal.viewYWrPathEn;
-	in->output2CbcrWrPmEnable = ctrl->vfeBusConfigLocal.encCbcrWrPathEn;
-	in->output2YWrPmEnable    = ctrl->vfeBusConfigLocal.encYWrPathEn;
-
-	if (in->output1CbcrWrPmEnable || in->output1YWrPmEnable)
-		ctrl->viewPath.pmEnabled = TRUE;
-
-	if (in->output2CbcrWrPmEnable || in->output2YWrPmEnable)
-		ctrl->encPath.pmEnabled = TRUE;
-
-	vfe_pm_start(in);
-
-	writel(VFE_PERFORMANCE_MONITOR_GO, ctrl->vfebase + VFE_BUS_PM_CMD);
-}
-
-static uint32_t vfe_irq_pack(struct vfe_interrupt_mask data)
-{
-	struct vfe_irqenable packedData;
-
-	memset(&packedData, 0, sizeof(packedData));
-
-	packedData.camifErrorIrq          = data.camifErrorIrq;
-	packedData.camifSofIrq            = data.camifSofIrq;
-	packedData.camifEolIrq            = data.camifEolIrq;
-	packedData.camifEofIrq            = data.camifEofIrq;
-	packedData.camifEpoch1Irq         = data.camifEpoch1Irq;
-	packedData.camifEpoch2Irq         = data.camifEpoch2Irq;
-	packedData.camifOverflowIrq       = data.camifOverflowIrq;
-	packedData.ceIrq                  = data.ceIrq;
-	packedData.regUpdateIrq           = data.regUpdateIrq;
-	packedData.resetAckIrq            = data.resetAckIrq;
-	packedData.encYPingpongIrq        = data.encYPingpongIrq;
-	packedData.encCbcrPingpongIrq     = data.encCbcrPingpongIrq;
-	packedData.viewYPingpongIrq       = data.viewYPingpongIrq;
-	packedData.viewCbcrPingpongIrq    = data.viewCbcrPingpongIrq;
-	packedData.rdPingpongIrq          = data.rdPingpongIrq;
-	packedData.afPingpongIrq          = data.afPingpongIrq;
-	packedData.awbPingpongIrq         = data.awbPingpongIrq;
-	packedData.histPingpongIrq        = data.histPingpongIrq;
-	packedData.encIrq                 = data.encIrq;
-	packedData.viewIrq                = data.viewIrq;
-	packedData.busOverflowIrq         = data.busOverflowIrq;
-	packedData.afOverflowIrq          = data.afOverflowIrq;
-	packedData.awbOverflowIrq         = data.awbOverflowIrq;
-	packedData.syncTimer0Irq          = data.syncTimer0Irq;
-	packedData.syncTimer1Irq          = data.syncTimer1Irq;
-	packedData.syncTimer2Irq          = data.syncTimer2Irq;
-	packedData.asyncTimer0Irq         = data.asyncTimer0Irq;
-	packedData.asyncTimer1Irq         = data.asyncTimer1Irq;
-	packedData.asyncTimer2Irq         = data.asyncTimer2Irq;
-	packedData.asyncTimer3Irq         = data.asyncTimer3Irq;
-	packedData.axiErrorIrq            = data.axiErrorIrq;
-	packedData.violationIrq           = data.violationIrq;
-
-	return *((uint32_t *)&packedData);
-}
-
-static uint32_t
-vfe_irq_composite_pack(struct vfe_irq_composite_mask_config data)
-{
-	struct VFE_Irq_Composite_MaskType packedData;
-
-	memset(&packedData, 0, sizeof(packedData));
-
-	packedData.encIrqComMaskBits   = data.encIrqComMask;
-	packedData.viewIrqComMaskBits  = data.viewIrqComMask;
-	packedData.ceDoneSelBits       = data.ceDoneSel;
-
-	return *((uint32_t *)&packedData);
-}
-
-static void vfe_addr_convert(struct msm_vfe_phy_info *pinfo,
-				enum vfe_resp_msg type, void *data, void **ext,
-				int *elen)
-{
-	switch (type) {
-	case VFE_MSG_OUTPUT_P:
-	case VFE_MSG_OUTPUT_V:{
-		pinfo->planar0_off =
-			((struct vfe_message *)data)->_u.msgOutput2.yBuffer;
-		pinfo->planar1_off =
-			((struct vfe_message *)data)->_u.msgOutput2.
-			cbcrBuffer;
-		pinfo->planar2_off = pinfo->planar0_off;
-		ctrl->extdata.bpcInfo =
-			((struct vfe_message *)data)->_u.msgOutput2.bpcInfo;
-		ctrl->extdata.asfInfo =
-			((struct vfe_message *)data)->_u.msgOutput2.asfInfo;
-		ctrl->extdata.frameCounter =
-			((struct vfe_message *)data)->_u.msgOutput2.
-			frameCounter;
-		ctrl->extdata.pmData =
-		((struct vfe_message *)data)->_u.msgOutput2.pmData;
-		*ext = &ctrl->extdata;
-		*elen = sizeof(ctrl->extdata);
-	}
-		break;
-
-	case VFE_MSG_STATS_AF:
-		pinfo->sbuf_phy =
-		((struct vfe_message *)data)->_u.msgStatsAf.afBuffer;
-		break;
-
-	case VFE_MSG_STATS_WE:
-		pinfo->sbuf_phy =
-		((struct vfe_message *)data)->_u.msgStatsWbExp.awbBuffer;
-		break;
-
-	default:
-		break;
-	} /* switch */
-}
-
-static boolean vfe_send_preview_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg, void *data);
-static boolean vfe_send_video_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg, void *data);
-static boolean vfe_send_mainimage_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg, void *data);
-static boolean vfe_send_thumbnail_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg, void *data);
-static boolean vfe_send_af_stats_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg, void *data);
-static boolean vfe_send_awb_stats_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg, void *data);
-static boolean vfe_send_camif_error_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg, void *data);
-static boolean vfe_send_bus_overflow_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg, void *data);
-static boolean vfe_send_sof_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg, void *data);
-
-static boolean invalid(struct msm_vfe_resp *rp,
-		struct vfe_message *_m, void *_d)
-{
-	BUG_ON(1); /* this function should not be called. */
-	return FALSE;
-}
-
-static struct {
-	boolean (*fn)(struct msm_vfe_resp *rp, struct vfe_message *msg,
-		void *data);
-	enum vfe_resp_msg rt; /* reponse type */
-} vfe_funcs[] = {
-	[VFE_MSG_ID_RESET_ACK] = { NULL, VFE_MSG_GENERAL },
-	[VFE_MSG_ID_START_ACK] = { NULL, VFE_MSG_GENERAL },
-	[VFE_MSG_ID_STOP_ACK] = { NULL, VFE_MSG_GENERAL },
-	[VFE_MSG_ID_UPDATE_ACK] = { NULL, VFE_MSG_GENERAL },
-	[VFE_MSG_ID_OUTPUT_P] = { vfe_send_preview_msg, VFE_MSG_OUTPUT_P },
-	[VFE_MSG_ID_OUTPUT_V] = { vfe_send_video_msg, VFE_MSG_OUTPUT_V },
-	[VFE_MSG_ID_OUTPUT_S] = { vfe_send_mainimage_msg, VFE_MSG_OUTPUT_S },
-	[VFE_MSG_ID_OUTPUT_T] = { vfe_send_thumbnail_msg, VFE_MSG_OUTPUT_T },
-	[VFE_MSG_ID_SNAPSHOT_DONE] = { NULL, VFE_MSG_SNAPSHOT },
-	[VFE_MSG_ID_STATS_AUTOFOCUS] = { vfe_send_af_stats_msg,
-		VFE_MSG_STATS_AF },
-	[VFE_MSG_ID_STATS_WB_EXP] = { vfe_send_awb_stats_msg,
-		VFE_MSG_STATS_WE },
-	[VFE_MSG_ID_EPOCH1] = { NULL, VFE_MSG_GENERAL },
-	[VFE_MSG_ID_EPOCH2] = { NULL, VFE_MSG_GENERAL },
-	[VFE_MSG_ID_SYNC_TIMER0_DONE] = { invalid },
-	[VFE_MSG_ID_SYNC_TIMER1_DONE] = { invalid },
-	[VFE_MSG_ID_SYNC_TIMER2_DONE] = { invalid },
-	[VFE_MSG_ID_ASYNC_TIMER0_DONE] = { invalid },
-	[VFE_MSG_ID_ASYNC_TIMER1_DONE] = { invalid },
-	[VFE_MSG_ID_ASYNC_TIMER2_DONE] = { invalid },
-	[VFE_MSG_ID_ASYNC_TIMER3_DONE] = { invalid },
-	[VFE_MSG_ID_AF_OVERFLOW] = { NULL, VFE_MSG_GENERAL },
-	[VFE_MSG_ID_AWB_OVERFLOW] = { NULL, VFE_MSG_GENERAL },
-	[VFE_MSG_ID_AXI_ERROR] = { NULL, VFE_MSG_GENERAL },
-	[VFE_MSG_ID_CAMIF_OVERFLOW] = { NULL, VFE_MSG_GENERAL },
-	[VFE_MSG_ID_VIOLATION] = { invalid },
-	[VFE_MSG_ID_CAMIF_ERROR] = { vfe_send_camif_error_msg,
-		VFE_MSG_GENERAL },
-	[VFE_MSG_ID_BUS_OVERFLOW] = { vfe_send_bus_overflow_msg,
-		VFE_MSG_GENERAL },
-	[VFE_MSG_ID_SOF_ACK] = { vfe_send_sof_msg,
-		VFE_MSG_GENERAL },
-};
-
-static void vfe_proc_ops(enum VFE_MESSAGE_ID id, void *data)
-{
-	struct msm_vfe_resp *rp;
-	struct vfe_message *msg;
-
-	if (id >= ARRAY_SIZE(vfe_funcs) || vfe_funcs[id].fn == invalid) {
-		pr_err("%s: invalid VFE message id %d\n", __func__, id);
-		return;
-	}
-
-	/* In 8k, OUTPUT1 & OUTPUT2 messages arrive before SNAPSHOT_DONE.
-	 * We don't send such messages to the user.  Note that we can do
-	 * this in the vfe_func[] callback, but that would cause us to
-	 * allocate and then immediately free the msm_vfe_resp structure,
-	 * which is wasteful.
-	 */
-	if ((ctrl->vfeOperationMode == VFE_START_OPERATION_MODE_SNAPSHOT) &&
-			(id == VFE_MSG_ID_OUTPUT_T ||
-			 id == VFE_MSG_ID_OUTPUT_S))
-		return;
-
-	rp = ctrl->resp->vfe_alloc(sizeof(*rp) +
-					(vfe_funcs[id].fn ? sizeof(*msg) : 0),
-					ctrl->syncdata,
-					GFP_ATOMIC);
-	if (!rp) {
-		pr_err("%s: out of memory\n", __func__);
-		return;
-	}
-
-	rp->type = vfe_funcs[id].rt;
-	rp->evt_msg.type = MSM_CAMERA_MSG;
-	rp->evt_msg.msg_id = id;
-
-	if (!vfe_funcs[id].fn) {
-		rp->evt_msg.len = 0;
-		rp->evt_msg.data = 0;
-	} else {
-		/* populate the message accordingly */
-		if (vfe_funcs[id].fn)
-			rp->evt_msg.data = msg =
-				(struct vfe_message *)(rp + 1);
-		else
-			rp->evt_msg.data = msg = 0;
-		rp->evt_msg.len = sizeof(*msg);
-		msg->_d = id;
-		if (vfe_funcs[id].fn(rp, msg, data) == FALSE) {
-			pr_warning("%s: freeing memory: handler for %d "
-				"returned false\n", __func__, id);
-			ctrl->resp->vfe_free(rp);
-			return;
-		}
-}
-
-	ctrl->resp->vfe_resp(rp, MSM_CAM_Q_VFE_MSG, ctrl->syncdata, GFP_KERNEL);
-}
-
-static boolean vfe_send_bus_overflow_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg,
-			void *data)
-{
-#if 0
-	memcpy(&(msg->_u.msgBusOverflow),
-		&ctrl->vfePmData, sizeof(ctrl->vfePmData));
-#endif
-	return TRUE;
-}
-
-static boolean vfe_send_sof_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg,
-			void *data)
-{
-	return TRUE;
-}
-static boolean vfe_send_camif_error_msg(struct msm_vfe_resp *rp,
-			struct vfe_message *msg,
-			void *data)
-{
-#if 0
-	memcpy(&(msg->_u.msgCamifError),
-	       &ctrl->vfeCamifStatusLocal, sizeof(ctrl->vfeCamifStatusLocal));
-#endif
-	return TRUE;
-}
-
-static void vfe_process_error_irq(struct vfe_interrupt_status *irqstatus)
-{
-	/* all possible error irq.  Note error irqs are not enabled, it is
-	 * checked only when other interrupts are present. */
-	if (irqstatus->afOverflowIrq)
-		vfe_proc_ops(VFE_MSG_ID_AF_OVERFLOW, NULL);
-
-	if (irqstatus->awbOverflowIrq)
-		vfe_proc_ops(VFE_MSG_ID_AWB_OVERFLOW, NULL);
-
-	if (irqstatus->axiErrorIrq)
-		vfe_proc_ops(VFE_MSG_ID_AXI_ERROR, NULL);
-
-	if (irqstatus->busOverflowIrq)
-		vfe_proc_ops(VFE_MSG_ID_BUS_OVERFLOW, NULL);
-
-	if (irqstatus->camifErrorIrq) {
-		CDBG("vfe_irq: camif errors\n");
-		vfe_proc_ops(VFE_MSG_ID_CAMIF_ERROR, NULL);
-	}
-
-	if (irqstatus->camifOverflowIrq)
-		vfe_proc_ops(VFE_MSG_ID_CAMIF_OVERFLOW, NULL);
-
-	if (irqstatus->violationIrq)
-		pr_err("%s: violation irq\n", __func__);
-}
-
-static void vfe_process_camif_sof_irq(void)
-{
-	/* increment the frame id number. */
-	ctrl->vfeFrameId++;
-
-	CDBG("camif_sof_irq, frameId = %d\n", ctrl->vfeFrameId);
-
-	/* In snapshot mode, if frame skip is programmed,
-	* need to check it accordingly to stop camif at
-	* correct frame boundary. For the dropped frames,
-	* there won't be any output path irqs, but there is
-	* still SOF irq, which can help us determine when
-	* to stop the camif.
-	*/
-	if (ctrl->vfeOperationMode) {
-		if ((1 << ctrl->vfeFrameSkipCount)&ctrl->vfeFrameSkipPattern) {
-
-			ctrl->vfeSnapShotCount--;
-			if (ctrl->vfeSnapShotCount == 0)
-				/* terminate vfe pipeline at frame boundary. */
-				writel(CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY,
-					ctrl->vfebase + CAMIF_COMMAND);
-		}
-
-		/* update frame skip counter for bit checking. */
-		ctrl->vfeFrameSkipCount++;
-		if (ctrl->vfeFrameSkipCount == (ctrl->vfeFrameSkipPeriod + 1))
-			ctrl->vfeFrameSkipCount = 0;
-	}
-	vfe_proc_ops(VFE_MSG_ID_SOF_ACK, NULL);
-}
-
-static boolean vfe_get_af_pingpong_status(void)
-{
-	uint32_t busPingPongStatus =
-		readl(ctrl->vfebase + VFE_BUS_PINGPONG_STATUS);
-	return !!(busPingPongStatus & VFE_AF_PINGPONG_STATUS_BIT);
-}
-
-static uint32_t vfe_read_af_buf_addr(boolean pipo)
-{
-	if (pipo == FALSE)
-		return readl(ctrl->vfebase + VFE_BUS_STATS_AF_WR_PING_ADDR);
-	else
-		return readl(ctrl->vfebase + VFE_BUS_STATS_AF_WR_PONG_ADDR);
-}
-
-static void vfe_update_af_buf_addr(boolean pipo, uint32_t addr)
-{
-	if (pipo == FALSE)
-		writel(addr, ctrl->vfebase + VFE_BUS_STATS_AF_WR_PING_ADDR);
-	else
-		writel(addr, ctrl->vfebase + VFE_BUS_STATS_AF_WR_PONG_ADDR);
-}
-
-static boolean vfe_send_af_stats_msg(struct msm_vfe_resp *rp,
-		struct vfe_message *msg, void *data)
-{
-	uint32_t afBufAddress = (uint32_t)data;
-
-	/* fill message with right content. */
-	/* @todo This is causing issues, need further investigate */
-	/* spin_lock_irqsave(&ctrl->state_lock, flags); */
-	if (ctrl->vstate != VFE_STATE_ACTIVE)
-		return FALSE;
-
-	msg->_u.msgStatsAf.afBuffer = afBufAddress;
-	msg->_u.msgStatsAf.frameCounter = ctrl->vfeFrameId;
-
-	ctrl->afStatsControl.ackPending = TRUE;
-
-	vfe_addr_convert(&(rp->phy), rp->type, msg, NULL, NULL);
-	/* spin_unlock_irqrestore(&ctrl->state_lock, flags); */
-	return TRUE;
-}
-
-static void vfe_process_stats_af_irq(void)
-{
-	boolean bufferAvailable;
-
-	if (!(ctrl->afStatsControl.ackPending)) {
-
-		/* read hardware status. */
-		ctrl->afStatsControl.pingPongStatus =
-			vfe_get_af_pingpong_status();
-
-		bufferAvailable = (ctrl->afStatsControl.pingPongStatus) ^ 1;
-
-		ctrl->afStatsControl.bufToRender =
-			vfe_read_af_buf_addr(bufferAvailable);
-
-		/* update the same buffer address (ping or pong) */
-		vfe_update_af_buf_addr(bufferAvailable,
-			ctrl->afStatsControl.nextFrameAddrBuf);
-
-		vfe_proc_ops(VFE_MSG_ID_STATS_AUTOFOCUS,
-			(void *)ctrl->afStatsControl.bufToRender);
-	} else
-		ctrl->afStatsControl.droppedStatsFrameCount++;
-}
-
-static boolean vfe_get_awb_pingpong_status(void)
-{
-	uint32_t busPingPongStatus =
-
-		readl(ctrl->vfebase + VFE_BUS_PINGPONG_STATUS);
-
-	return !!(busPingPongStatus & VFE_AWB_PINGPONG_STATUS_BIT);
-
-}
-
-static uint32_t vfe_read_awb_buf_addr(boolean pingpong)
-{
-	if (pingpong == FALSE)
-		return readl(ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PING_ADDR);
-	else
-		return readl(ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PONG_ADDR);
-}
-
-static void vfe_update_awb_buf_addr(boolean pingpong, uint32_t addr)
-{
-	if (pingpong == FALSE)
-		writel(addr, ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PING_ADDR);
-	else
-		writel(addr, ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PONG_ADDR);
-}
-
-static boolean vfe_send_awb_stats_msg(struct msm_vfe_resp *rp,
-		struct vfe_message *msg, void *data)
-{
-	uint32_t awbBufAddress = (uint32_t)data;
-
-	/* fill message with right content. */
-	/* @todo This is causing issues, need further investigate */
-	/* spin_lock_irqsave(&ctrl->state_lock, flags); */
-	if (ctrl->vstate != VFE_STATE_ACTIVE)
-		return FALSE;
-
-	msg->_u.msgStatsWbExp.awbBuffer = awbBufAddress;
-	msg->_u.msgStatsWbExp.frameCounter = ctrl->vfeFrameId;
-
-
-	ctrl->awbStatsControl.ackPending = TRUE;
-
-	vfe_addr_convert(&(rp->phy),
-			rp->type, msg,
-			NULL, NULL);
-
-	return TRUE;
-}
-
-static void vfe_process_stats_awb_irq(void)
-{
-	boolean bufferAvailable;
-
-	if (!(ctrl->awbStatsControl.ackPending)) {
-
-		ctrl->awbStatsControl.pingPongStatus =
-			vfe_get_awb_pingpong_status();
-
-		bufferAvailable = (ctrl->awbStatsControl.pingPongStatus) ^ 1;
-
-		ctrl->awbStatsControl.bufToRender =
-			vfe_read_awb_buf_addr(bufferAvailable);
-
-		vfe_update_awb_buf_addr(bufferAvailable,
-			ctrl->awbStatsControl.nextFrameAddrBuf);
-
-		vfe_proc_ops(VFE_MSG_ID_STATS_WB_EXP,
-			(void *)ctrl->awbStatsControl.bufToRender);
-
-	} else
-		ctrl->awbStatsControl.droppedStatsFrameCount++;
-}
-
-static void vfe_write_gamma_table(uint8_t channel,
-	boolean bank, int16_t *pTable)
-{
-	uint16_t i;
-
-	enum VFE_DMI_RAM_SEL dmiRamSel = NO_MEM_SELECTED;
-
-	switch (channel) {
-	case 0:
-		if (bank == 0)
-			dmiRamSel = RGBLUT_RAM_CH0_BANK0;
-		else
-			dmiRamSel = RGBLUT_RAM_CH0_BANK1;
-		break;
-
-	case 1:
-		if (bank == 0)
-			dmiRamSel = RGBLUT_RAM_CH1_BANK0;
-		else
-			dmiRamSel = RGBLUT_RAM_CH1_BANK1;
-		break;
-
-	case 2:
-		if (bank == 0)
-			dmiRamSel = RGBLUT_RAM_CH2_BANK0;
-		else
-			dmiRamSel = RGBLUT_RAM_CH2_BANK1;
-		break;
-
-	default:
-		break;
-	}
-
-	vfe_program_dmi_cfg(dmiRamSel);
-
-	for (i = 0; i < VFE_GAMMA_TABLE_LENGTH; i++) {
-		writel((uint32_t)(*pTable), ctrl->vfebase + VFE_DMI_DATA_LO);
-		pTable++;
-	}
-
-	/* After DMI transfer, need to set the DMI_CFG to unselect any SRAM
-	unselect the SRAM Bank. */
-	writel(VFE_DMI_CFG_DEFAULT, ctrl->vfebase + VFE_DMI_CFG);
-}
-
-static void vfe_prog_hw_testgen_cmd(uint32_t value)
-{
-	writel(value, ctrl->vfebase + VFE_HW_TESTGEN_CMD);
-}
-
-static inline void vfe_read_irq_status(struct vfe_irq_thread_msg *out)
-{
-	uint32_t *temp;
-
-	memset(out, 0, sizeof(struct vfe_irq_thread_msg));
-
-	temp = (uint32_t *)(ctrl->vfebase + VFE_IRQ_STATUS);
-	out->vfeIrqStatus = readl(temp);
-
-	temp = (uint32_t *)(ctrl->vfebase + CAMIF_STATUS);
-	out->camifStatus = readl(temp);
-
-/*	this for YUV performance tuning
-	writel(0x7, ctrl->vfebase + CAMIF_COMMAND);
-	writel(0x3, ctrl->vfebase + CAMIF_COMMAND);
-	CDBG("camifStatus  = 0x%x\n", out->camifStatus);
-*/
-/*
-	temp = (uint32_t *)(ctrl->vfebase + VFE_DEMOSAIC_STATUS);
-	out->demosaicStatus = readl(temp);
-
-	temp = (uint32_t *)(ctrl->vfebase + VFE_ASF_MAX_EDGE);
-	out->asfMaxEdge = readl(temp);
-
-	temp = (uint32_t *)(ctrl->vfebase + VFE_BUS_ENC_Y_WR_PM_STATS_0);
-*/
-
-#if 0
-	out->pmInfo.encPathPmInfo.yWrPmStats0      = readl(temp++);
-	out->pmInfo.encPathPmInfo.yWrPmStats1      = readl(temp++);
-	out->pmInfo.encPathPmInfo.cbcrWrPmStats0   = readl(temp++);
-	out->pmInfo.encPathPmInfo.cbcrWrPmStats1   = readl(temp++);
-	out->pmInfo.viewPathPmInfo.yWrPmStats0     = readl(temp++);
-	out->pmInfo.viewPathPmInfo.yWrPmStats1     = readl(temp++);
-	out->pmInfo.viewPathPmInfo.cbcrWrPmStats0  = readl(temp++);
-	out->pmInfo.viewPathPmInfo.cbcrWrPmStats1  = readl(temp);
-#endif /* if 0 Jeff */
-}
-
-static void
-vfe_parse_interrupt_status(struct vfe_interrupt_status *ret,
-uint32_t irqStatusIn)
-{
-	struct vfe_irqenable hwstat;
-	boolean temp;
-
-	memset(&hwstat, 0, sizeof(hwstat));
-	memset(ret, 0, sizeof(*ret));
-
-	hwstat = *((struct vfe_irqenable *)(&irqStatusIn));
-
-	ret->camifErrorIrq = hwstat.camifErrorIrq;
-	ret->camifSofIrq = hwstat.camifSofIrq;
-	ret->camifEolIrq = hwstat.camifEolIrq;
-	ret->camifEofIrq = hwstat.camifEofIrq;
-	ret->camifEpoch1Irq = hwstat.camifEpoch1Irq;
-	ret->camifEpoch2Irq = hwstat.camifEpoch2Irq;
-	ret->camifOverflowIrq = hwstat.camifOverflowIrq;
-	ret->ceIrq = hwstat.ceIrq;
-	ret->regUpdateIrq = hwstat.regUpdateIrq;
-	ret->resetAckIrq = hwstat.resetAckIrq;
-	ret->encYPingpongIrq = hwstat.encYPingpongIrq;
-	ret->encCbcrPingpongIrq = hwstat.encCbcrPingpongIrq;
-	ret->viewYPingpongIrq = hwstat.viewYPingpongIrq;
-	ret->viewCbcrPingpongIrq = hwstat.viewCbcrPingpongIrq;
-	ret->rdPingpongIrq = hwstat.rdPingpongIrq;
-	ret->afPingpongIrq = hwstat.afPingpongIrq;
-	ret->awbPingpongIrq = hwstat.awbPingpongIrq;
-	ret->histPingpongIrq = hwstat.histPingpongIrq;
-	ret->encIrq = hwstat.encIrq;
-	ret->viewIrq = hwstat.viewIrq;
-	ret->busOverflowIrq = hwstat.busOverflowIrq;
-	ret->afOverflowIrq = hwstat.afOverflowIrq;
-	ret->awbOverflowIrq = hwstat.awbOverflowIrq;
-	ret->syncTimer0Irq = hwstat.syncTimer0Irq;
-	ret->syncTimer1Irq = hwstat.syncTimer1Irq;
-	ret->syncTimer2Irq = hwstat.syncTimer2Irq;
-	ret->asyncTimer0Irq = hwstat.asyncTimer0Irq;
-	ret->asyncTimer1Irq = hwstat.asyncTimer1Irq;
-	ret->asyncTimer2Irq = hwstat.asyncTimer2Irq;
-	ret->asyncTimer3Irq = hwstat.asyncTimer3Irq;
-	ret->axiErrorIrq = hwstat.axiErrorIrq;
-	ret->violationIrq = hwstat.violationIrq;
-
-	/* logic OR of any error bits
-	 * although each irq corresponds to a bit, the data type here is a
-	 * boolean already. hence use logic operation.
-	 */
-	temp =
-	    ret->camifErrorIrq ||
-	    ret->camifOverflowIrq ||
-	    ret->afOverflowIrq ||
-	    ret->awbOverflowIrq ||
-	    ret->awbPingpongIrq ||
-	    ret->afPingpongIrq ||
-	    ret->busOverflowIrq || ret->axiErrorIrq || ret->violationIrq;
-
-	ret->anyErrorIrqs = temp;
-
-	/* logic OR of any output path bits*/
-	temp = ret->encYPingpongIrq || ret->encCbcrPingpongIrq || ret->encIrq;
-
-	ret->anyOutput2PathIrqs = temp;
-
-	temp = ret->viewYPingpongIrq || ret->viewCbcrPingpongIrq ||
-		ret->viewIrq;
-
-	ret->anyOutput1PathIrqs = temp;
-
-	ret->anyOutputPathIrqs =
-	    ret->anyOutput1PathIrqs || ret->anyOutput2PathIrqs;
-
-	/* logic OR of any sync timer bits*/
-	temp = ret->syncTimer0Irq || ret->syncTimer1Irq || ret->syncTimer2Irq;
-
-	ret->anySyncTimerIrqs = temp;
-
-	/* logic OR of any async timer bits*/
-	temp =
-	    ret->asyncTimer0Irq ||
-	    ret->asyncTimer1Irq || ret->asyncTimer2Irq || ret->asyncTimer3Irq;
-
-	ret->anyAsyncTimerIrqs = temp;
-
-	/* bool for all interrupts that are not allowed in idle state */
-	temp =
-	    ret->anyErrorIrqs ||
-	    ret->anyOutputPathIrqs ||
-	    ret->anySyncTimerIrqs ||
-	    ret->regUpdateIrq ||
-	    ret->awbPingpongIrq ||
-	    ret->afPingpongIrq ||
-	    ret->camifSofIrq || ret->camifEpoch2Irq || ret->camifEpoch1Irq;
-
-	ret->anyIrqForActiveStatesOnly = temp;
-}
-
-static void
-vfe_get_asf_frame_info(struct vfe_frame_asf_info *rc,
-struct vfe_irq_thread_msg *in)
-{
-	struct vfe_asf_info     asfInfoTemp;
-
-	memset(rc, 0, sizeof(*rc));
-	memset(&asfInfoTemp, 0, sizeof(asfInfoTemp));
-
-	asfInfoTemp = *((struct vfe_asf_info *)(&(in->asfMaxEdge)));
-
-	rc->asfHbiCount = asfInfoTemp.HBICount;
-	rc->asfMaxEdge = asfInfoTemp.maxEdge;
-}
-
-static void
-vfe_get_demosaic_frame_info(struct vfe_frame_bpc_info *rc,
-struct vfe_irq_thread_msg *in)
-{
-	struct vfe_bps_info     bpcInfoTemp;
-
-	memset(rc, 0, sizeof(*rc));
-	memset(&bpcInfoTemp, 0, sizeof(bpcInfoTemp));
-
-	bpcInfoTemp = *((struct vfe_bps_info *)(&(in->demosaicStatus)));
-
-	rc->greenDefectPixelCount = bpcInfoTemp.greenBadPixelCount;
-
-	rc->redBlueDefectPixelCount = bpcInfoTemp.RedBlueBadPixelCount;
-}
-
-static void
-vfe_get_camif_status(struct vfe_msg_camif_status *rc,
-struct vfe_irq_thread_msg *in)
-{
-	struct vfe_camif_stats camifStatusTemp;
-
-	memset(rc, 0, sizeof(*rc));
-	memset(&camifStatusTemp, 0, sizeof(camifStatusTemp));
-
-	camifStatusTemp = *((struct vfe_camif_stats *)(&(in->camifStatus)));
-
-	rc->camifState = (boolean) camifStatusTemp.camifHalt;
-	rc->lineCount = camifStatusTemp.lineCount;
-	rc->pixelCount = camifStatusTemp.pixelCount;
-}
-
-static void
-vfe_get_performance_monitor_data(struct vfe_bus_performance_monitor *rc,
-		struct vfe_irq_thread_msg *in)
-{
-	memset(rc, 0, sizeof(*rc));
-
-	rc->encPathPmInfo.yWrPmStats0 = in->pmInfo.encPathPmInfo.yWrPmStats0;
-	rc->encPathPmInfo.yWrPmStats1 = in->pmInfo.encPathPmInfo.yWrPmStats1;
-	rc->encPathPmInfo.cbcrWrPmStats0 =
-		in->pmInfo.encPathPmInfo.cbcrWrPmStats0;
-	rc->encPathPmInfo.cbcrWrPmStats1 =
-		in->pmInfo.encPathPmInfo.cbcrWrPmStats1;
-	rc->viewPathPmInfo.yWrPmStats0 = in->pmInfo.viewPathPmInfo.yWrPmStats0;
-	rc->viewPathPmInfo.yWrPmStats1 = in->pmInfo.viewPathPmInfo.yWrPmStats1;
-	rc->viewPathPmInfo.cbcrWrPmStats0 =
-		in->pmInfo.viewPathPmInfo.cbcrWrPmStats0;
-	rc->viewPathPmInfo.cbcrWrPmStats1 =
-	    in->pmInfo.viewPathPmInfo.cbcrWrPmStats1;
-}
-
-static void vfe_process_reg_update_irq(void)
-{
-	CDBG("vfe_process_reg_update_irq: ackPendingFlag is %d\n",
-	ctrl->vfeStartAckPendingFlag);
-	if (ctrl->vfeStartAckPendingFlag == TRUE) {
-		vfe_proc_ops(VFE_MSG_ID_START_ACK, NULL);
-		ctrl->vfeStartAckPendingFlag = FALSE;
-	} else
-		vfe_proc_ops(VFE_MSG_ID_UPDATE_ACK, NULL);
-}
-
-static void vfe_process_reset_irq(void)
-{
-	/* unsigned long flags; */
-
-	/* @todo This is causing issues, need further investigate */
-	/* spin_lock_irqsave(&ctrl->state_lock, flags); */
-	ctrl->vstate = VFE_STATE_IDLE;
-	/* spin_unlock_irqrestore(&ctrl->state_lock, flags); */
-
-	if (ctrl->vfeStopAckPending == TRUE) {
-		ctrl->vfeStopAckPending = FALSE;
-		vfe_proc_ops(VFE_MSG_ID_STOP_ACK, NULL);
-	} else {
-		vfe_set_default_reg_values();
-		vfe_proc_ops(VFE_MSG_ID_RESET_ACK, NULL);
-	}
-}
-
-static void vfe_process_pingpong_irq(struct vfe_output_path *in,
-	uint8_t fragmentCount)
-{
-	uint16_t circularIndex;
-	uint32_t nextFragmentAddr;
-
-	/* get next fragment address from circular buffer */
-	circularIndex    = (in->fragIndex) % (2 * fragmentCount);
-	nextFragmentAddr = in->addressBuffer[circularIndex];
-
-	in->fragIndex = circularIndex + 1;
-
-	/* use next fragment to program hardware ping/pong address. */
-	if (in->hwCurrentFlag == ping) {
-		writel(nextFragmentAddr, in->hwRegPingAddress);
-		in->hwCurrentFlag = pong;
-
-	} else {
-		writel(nextFragmentAddr, in->hwRegPongAddress);
-		in->hwCurrentFlag = ping;
-	}
-}
-
-static boolean vfe_send_video_msg(struct msm_vfe_resp *rp,
-		struct vfe_message *msg, void *data)
-{
-	struct vfe_msg_output *pPayload = data;
-
-	if (ctrl->vstate != VFE_STATE_ACTIVE)
-		return FALSE;
-	memcpy(&(msg->_u),
-		(void *)pPayload, sizeof(struct vfe_msg_output));
-
-	rp->phy.output_id = OUTPUT_TYPE_V;
-	CDBG("vfe_send_video_msg rp->type= %d\n", rp->type);
-
-	vfe_addr_convert(&(rp->phy),
-			rp->type, msg,
-			&(rp->extdata), &(rp->extlen));
-	return TRUE;
-}
-
-static boolean vfe_send_preview_msg(struct msm_vfe_resp *rp,
-		struct vfe_message *msg, void *data)
-{
-	struct vfe_msg_output *pPayload = data;
-
-	if (ctrl->vstate != VFE_STATE_ACTIVE)
-		return FALSE;
-
-	memcpy(&(msg->_u), (void *)pPayload, sizeof(struct vfe_msg_output));
-
-	rp->phy.output_id = OUTPUT_TYPE_P;
-	CDBG("vfe_send_preview_msg rp->type= %d\n", rp->type);
-
-	vfe_addr_convert(&(rp->phy),
-			rp->type, msg,
-			&(rp->extdata), &(rp->extlen));
-
-	return TRUE;
-}
-
-
-static boolean vfe_send_thumbnail_msg(struct msm_vfe_resp *rp,
-		struct vfe_message *msg, void *data)
-{
-	struct vfe_msg_output *pPayload = data;
-
-	if (ctrl->vstate != VFE_STATE_ACTIVE)
-		return FALSE;
-
-	memcpy(&(msg->_u), (void *)pPayload, sizeof(struct vfe_msg_output));
-
-	rp->phy.output_id = OUTPUT_TYPE_T;
-	CDBG("vfe_send_thumbnail_msg rp->type= %d\n", rp->type);
-
-	if (ctrl->viewPath.snapshotPendingCount <= 1)
-		ctrl->viewPath.ackPending = FALSE;
-
-	vfe_addr_convert(&(rp->phy),
-			rp->type, msg,
-			&(rp->extdata), &(rp->extlen));
-	return TRUE;
-}
-
-static boolean vfe_send_mainimage_msg(struct msm_vfe_resp *rp,
-		struct vfe_message *msg, void *data)
-{
-	struct vfe_msg_output *pPayload = data;
-
-	if (ctrl->vstate != VFE_STATE_ACTIVE)
-		return FALSE;
-
-	memcpy(&(msg->_u), (void *)pPayload, sizeof(struct vfe_msg_output));
-
-	rp->phy.output_id = OUTPUT_TYPE_S;
-	CDBG("vfe_send_mainimage_msg rp->type= %d\n", rp->type);
-
-	if (ctrl->encPath.snapshotPendingCount <= 1) {
-		ctrl->encPath.ackPending = FALSE;
-	}
-
-	vfe_addr_convert(&(rp->phy),
-			rp->type, msg,
-			&(rp->extdata), &(rp->extlen));
-
-	return TRUE;
-}
-
-static void vfe_send_output_msg(boolean whichOutputPath,
-	uint32_t yPathAddr, uint32_t cbcrPathAddr)
-{
-	struct vfe_msg_output msgPayload;
-
-	msgPayload.yBuffer = yPathAddr;
-	msgPayload.cbcrBuffer = cbcrPathAddr;
-
-	/* asf info is common for both output1 and output2 */
-#if 0
-	msgPayload.asfInfo.asfHbiCount = ctrl->vfeAsfFrameInfo.asfHbiCount;
-	msgPayload.asfInfo.asfMaxEdge = ctrl->vfeAsfFrameInfo.asfMaxEdge;
-
-	/* demosaic info is common for both output1 and output2 */
-	msgPayload.bpcInfo.greenDefectPixelCount =
-		ctrl->vfeBpcFrameInfo.greenDefectPixelCount;
-	msgPayload.bpcInfo.redBlueDefectPixelCount =
-		ctrl->vfeBpcFrameInfo.redBlueDefectPixelCount;
-#endif /* if 0 */
-
-	/* frame ID is common for both paths. */
-	msgPayload.frameCounter = ctrl->vfeFrameId;
-
-	if (whichOutputPath) {
-		/* msgPayload.pmData = ctrl->vfePmData.encPathPmInfo; */
-		ctrl->encPath.ackPending = TRUE;
-
-		if (ctrl->vfeOperationMode == 0) {
-			if (ctrl->axiOutputMode ==
-				VFE_AXI_OUTPUT_MODE_Output1AndOutput2) {
-				/* video mode */
-				vfe_proc_ops(VFE_MSG_ID_OUTPUT_V, &msgPayload);
-			} else{
-				/* preview mode */
-				vfe_proc_ops(VFE_MSG_ID_OUTPUT_P, &msgPayload);
-			}
-		} else {
-			vfe_proc_ops(VFE_MSG_ID_OUTPUT_S, &msgPayload);
-		}
-
-	} else {
-		/* physical output1 path from vfe */
-		ctrl->viewPath.ackPending = TRUE;
-
-		if (ctrl->vfeOperationMode == 0) {
-			vfe_proc_ops(VFE_MSG_ID_OUTPUT_P, &msgPayload);
-			CDBG(" video mode display output.\n");
-
-		} else{
-			vfe_proc_ops(VFE_MSG_ID_OUTPUT_T, &msgPayload);
-			CDBG(" snapshot mode thumbnail output.\n");
-		}
-	}
-}
-
-static void vfe_process_frame_done_irq_multi_frag(struct vfe_output_path_combo
-						  *in)
-{
-	uint32_t yAddress, cbcrAddress;
-	uint16_t idx;
-	uint32_t *ptrY;
-	uint32_t *ptrCbcr;
-	const uint32_t *ptrSrc;
-	uint8_t i;
-
-	if (!in->ackPending) {
-
-		idx = (in->currentFrame) * (in->fragCount);
-
-		/* Send output message. */
-		yAddress = in->yPath.addressBuffer[idx];
-		cbcrAddress = in->cbcrPath.addressBuffer[idx];
-
-		/* copy next frame to current frame. */
-		ptrSrc  = in->nextFrameAddrBuf;
-		ptrY = (uint32_t *)&in->yPath.addressBuffer[idx];
-		ptrCbcr = (uint32_t *)&in->cbcrPath.addressBuffer[idx];
-
-		/* Copy Y address */
-		for (i = 0; i < in->fragCount; i++)
-			*ptrY++ = *ptrSrc++;
-
-		/* Copy Cbcr address */
-		for (i = 0; i < in->fragCount; i++)
-			*ptrCbcr++ = *ptrSrc++;
-
-		vfe_send_output_msg(in->whichOutputPath, yAddress, cbcrAddress);
-
-	} else {
-		if (in->whichOutputPath == 0)
-			ctrl->vfeDroppedFrameCounts.output1Count++;
-
-		if (in->whichOutputPath == 1)
-			ctrl->vfeDroppedFrameCounts.output2Count++;
-	}
-
-	/* toggle current frame. */
-	in->currentFrame = in->currentFrame^1;
-
-	if (ctrl->vfeOperationMode)
-		in->snapshotPendingCount--;
-}
-
-static void vfe_process_frame_done_irq_no_frag_io(
-		struct vfe_output_path_combo *in,
-		uint32_t *pNextAddr,
-	uint32_t *pdestRenderAddr)
-{
-	uint32_t busPingPongStatus;
-	uint32_t tempAddress;
-
-	/* 1. read hw status register. */
-	busPingPongStatus = readl(ctrl->vfebase + VFE_BUS_PINGPONG_STATUS);
-
-	CDBG("hardware status is 0x%x\n", busPingPongStatus);
-
-	/* 2. determine ping or pong */
-	/* use cbcr status */
-	busPingPongStatus = busPingPongStatus & (1<<(in->cbcrStatusBit));
-
-	/* 3. read out address and update address */
-	if (busPingPongStatus == 0) {
-		/* hw is working on ping, render pong buffer */
-		/* a. read out pong address */
-		/* read out y address. */
-		tempAddress = readl(in->yPath.hwRegPongAddress);
-
-		CDBG("pong 1 addr = 0x%x\n", tempAddress);
-		*pdestRenderAddr++ = tempAddress;
-		/* read out cbcr address. */
-		tempAddress = readl(in->cbcrPath.hwRegPongAddress);
-
-		CDBG("pong 2 addr = 0x%x\n", tempAddress);
-		*pdestRenderAddr = tempAddress;
-
-		/* b. update pong address */
-		writel(*pNextAddr++, in->yPath.hwRegPongAddress);
-		writel(*pNextAddr, in->cbcrPath.hwRegPongAddress);
-	} else {
-		/* hw is working on pong, render ping buffer */
-
-		/* a. read out ping address */
-		tempAddress = readl(in->yPath.hwRegPingAddress);
-		CDBG("ping 1 addr = 0x%x\n", tempAddress);
-		*pdestRenderAddr++ = tempAddress;
-		tempAddress = readl(in->cbcrPath.hwRegPingAddress);
-
-		CDBG("ping 2 addr = 0x%x\n", tempAddress);
-		*pdestRenderAddr = tempAddress;
-
-		/* b. update ping address */
-		writel(*pNextAddr++, in->yPath.hwRegPingAddress);
-		CDBG("NextAddress = 0x%x\n", *pNextAddr);
-		writel(*pNextAddr, in->cbcrPath.hwRegPingAddress);
-	}
-}
-
-static void vfe_process_frame_done_irq_no_frag(struct vfe_output_path_combo *in)
-{
-	uint32_t addressToRender[2];
-
-	if (!in->ackPending) {
-		vfe_process_frame_done_irq_no_frag_io(in,
-						      in->nextFrameAddrBuf,
-						      addressToRender);
-
-		/* use addressToRender to send out message. */
-		vfe_send_output_msg(in->whichOutputPath,
-				addressToRender[0], addressToRender[1]);
-
-	} else {
-		/* ackPending is still there, accumulate dropped frame count.
-		 * These count can be read through ioctrl command. */
-		CDBG("waiting frame ACK\n");
-
-		if (in->whichOutputPath == 0)
-			ctrl->vfeDroppedFrameCounts.output1Count++;
-
-		if (in->whichOutputPath == 1)
-			ctrl->vfeDroppedFrameCounts.output2Count++;
-	}
-
-	/* in case of multishot when upper layer did not ack, there will still
-	 * be a snapshot done msg sent out, even though the number of frames
-	 * sent out may be less than the desired number of frames.  snapshot
-	 * done msg would be helpful to indicate that vfe pipeline has stop,
-	 * and in good known state.
-	 */
-	if (ctrl->vfeOperationMode)
-		in->snapshotPendingCount--;
-}
-
-static void vfe_process_output_path_irq(struct vfe_interrupt_status *irqstatus)
-{
-	/* unsigned long flags; */
-
-	/* process the view path interrupts */
-	if (irqstatus->anyOutput1PathIrqs) {
-		if (ctrl->viewPath.multiFrag) {
-
-			if (irqstatus->viewCbcrPingpongIrq)
-				vfe_process_pingpong_irq(&
-							 (ctrl->viewPath.
-							  cbcrPath),
-							 ctrl->viewPath.
-							 fragCount);
-
-			if (irqstatus->viewYPingpongIrq)
-				vfe_process_pingpong_irq(&
-							 (ctrl->viewPath.yPath),
-							 ctrl->viewPath.
-							 fragCount);
-
-			if (irqstatus->viewIrq)
-				vfe_process_frame_done_irq_multi_frag(&ctrl->
-								      viewPath);
-
-		} else {
-			/* typical case for no fragment,
-			 only frame done irq is enabled. */
-			if (irqstatus->viewIrq)
-				vfe_process_frame_done_irq_no_frag(&ctrl->
-								   viewPath);
-		}
-	}
-
-	/* process the encoder path interrupts */
-	if (irqstatus->anyOutput2PathIrqs) {
-		if (ctrl->encPath.multiFrag) {
-			if (irqstatus->encCbcrPingpongIrq)
-				vfe_process_pingpong_irq(&
-							 (ctrl->encPath.
-							  cbcrPath),
-							 ctrl->encPath.
-							 fragCount);
-
-			if (irqstatus->encYPingpongIrq)
-				vfe_process_pingpong_irq(&(ctrl->encPath.yPath),
-							 ctrl->encPath.
-							 fragCount);
-
-			if (irqstatus->encIrq)
-				vfe_process_frame_done_irq_multi_frag(&ctrl->
-								      encPath);
-
-		} else {
-			if (irqstatus->encIrq)
-				vfe_process_frame_done_irq_no_frag(&ctrl->
-								   encPath);
-		}
-	}
-
-	if (ctrl->vfeOperationMode) {
-		if ((ctrl->encPath.snapshotPendingCount == 0) &&
-				(ctrl->viewPath.snapshotPendingCount == 0)) {
-
-			/* @todo This is causing issues, further investigate */
-			/* spin_lock_irqsave(&ctrl->state_lock, flags); */
-			ctrl->vstate = VFE_STATE_IDLE;
-			/* spin_unlock_irqrestore(&ctrl->state_lock, flags); */
-
-			vfe_proc_ops(VFE_MSG_ID_SNAPSHOT_DONE, NULL);
-			vfe_camif_stop_immediately();
-			vfe_prog_hw_testgen_cmd(VFE_TEST_GEN_STOP);
-			vfe_pm_stop();
-		}
-	}
-}
-
-static void __vfe_do_tasklet(struct isr_queue_cmd *qcmd)
-{
-	if (qcmd->vfeInterruptStatus.regUpdateIrq) {
-		CDBG("irq regUpdateIrq\n");
-		vfe_process_reg_update_irq();
-	}
-
-	if (qcmd->vfeInterruptStatus.resetAckIrq) {
-		CDBG("%s: process resetAckIrq\n", __func__);
-		vfe_process_reset_irq();
-	}
-
-	if (ctrl->vstate != VFE_STATE_ACTIVE)
-		return;
-
-#if 0
-	if (qcmd->vfeInterruptStatus.camifEpoch1Irq)
-		vfe_proc_ops(VFE_MSG_ID_EPOCH1);
-
-	if (qcmd->vfeInterruptStatus.camifEpoch2Irq)
-		vfe_proc_ops(VFE_MSG_ID_EPOCH2);
-#endif /* Jeff */
-
-	/* next, check output path related interrupts. */
-	if (qcmd->vfeInterruptStatus.anyOutputPathIrqs) {
-		CDBG("irq: anyOutputPathIrqs\n");
-		vfe_process_output_path_irq(&qcmd->vfeInterruptStatus);
-	}
-
-	if (qcmd->vfeInterruptStatus.afPingpongIrq)
-		vfe_process_stats_af_irq();
-
-	if (qcmd->vfeInterruptStatus.awbPingpongIrq)
-		vfe_process_stats_awb_irq();
-
-	/* any error irqs*/
-	if (qcmd->vfeInterruptStatus.anyErrorIrqs)
-		vfe_process_error_irq(&qcmd->vfeInterruptStatus);
-
-#if 0
-	if (qcmd->vfeInterruptStatus.anySyncTimerIrqs)
-		vfe_process_sync_timer_irq();
-
-	if (qcmd->vfeInterruptStatus.anyAsyncTimerIrqs)
-		vfe_process_async_timer_irq();
-#endif /* Jeff */
-
-	if (qcmd->vfeInterruptStatus.camifSofIrq) {
-		CDBG("irq: camifSofIrq\n");
-		vfe_process_camif_sof_irq();
-	}
-}
-
-static struct isr_queue_cmd *get_irq_cmd_nosync(void)
-{
-	int old_get = ctrl->irq_get++;
-	ctrl->irq_get = ctrl->irq_get % ARRAY_SIZE(ctrl->irqs);
-	if (ctrl->irq_get == ctrl->irq_put) {
-		pr_err("%s: out of irq command packets\n", __func__);
-		ctrl->irq_get = old_get;
-		return NULL;
-	}
-
-	return ctrl->irqs + old_get;
-}
-
-static struct isr_queue_cmd *next_irq_cmd(void)
-{
-	unsigned long flags;
-	struct isr_queue_cmd *cmd;
-	spin_lock_irqsave(&ctrl->irqs_lock, flags);
-	if (ctrl->irq_get == ctrl->irq_put) {
-		spin_unlock_irqrestore(&ctrl->irqs_lock, flags);
-		return NULL; /* already empty */
-	}
-	cmd = ctrl->irqs + ctrl->irq_put;
-	spin_unlock_irqrestore(&ctrl->irqs_lock, flags);
-	return cmd;
-}
-
-static void put_irq_cmd(void)
-{
-	unsigned long flags;
-	spin_lock_irqsave(&ctrl->irqs_lock, flags);
-	if (ctrl->irq_get == ctrl->irq_put) {
-		spin_unlock_irqrestore(&ctrl->irqs_lock, flags);
-		return; /* already empty */
-	}
-	ctrl->irq_put++;
-	ctrl->irq_put %= ARRAY_SIZE(ctrl->irqs);
-	spin_unlock_irqrestore(&ctrl->irqs_lock, flags);
-}
-
-static void vfe_do_tasklet(unsigned long data)
-{
-	int cnt = 0;
-	unsigned long flags;
-	struct isr_queue_cmd *qcmd = NULL;
-
-	spin_lock_irqsave(&msm_vfe_ctrl_lock, flags);
-	if (!ctrl) {
-		spin_unlock_irqrestore(&msm_vfe_ctrl_lock, flags);
-		return;
-	}
-
-	CDBG("%s\n", __func__);
-
-	while ((qcmd = next_irq_cmd())) {
-		__vfe_do_tasklet(qcmd);
-		put_irq_cmd();
-		cnt++;
-	}
-
-	if (cnt > ARRAY_SIZE(ctrl->irqs)/2)
-		CDBG("%s: serviced %d vfe interrupts\n", __func__, cnt);
-
-	spin_unlock_irqrestore(&msm_vfe_ctrl_lock, flags);
-}
-
-DECLARE_TASKLET(vfe_tasklet, vfe_do_tasklet, 0);
-
-static irqreturn_t vfe_parse_irq(int irq_num, void *data)
-{
-	unsigned long flags;
-	uint32_t irqStatusLocal;
-	struct vfe_irq_thread_msg irq;
-	struct isr_queue_cmd *qcmd;
-
-	CDBG("vfe_parse_irq\n");
-
-	if (!atomic_read(&ctrl->vfe_serv_interrupt))
-		return IRQ_HANDLED;
-
-	vfe_read_irq_status(&irq);
-
-	if (irq.vfeIrqStatus == 0) {
-		CDBG("vfe_parse_irq: irq.vfeIrqStatus is 0\n");
-		return IRQ_HANDLED;
-	}
-
-	if (ctrl->vfeStopAckPending)
-		irqStatusLocal = (VFE_IMASK_WHILE_STOPPING & irq.vfeIrqStatus);
-	else
-		irqStatusLocal =
-			((ctrl->vfeImaskPacked | VFE_IMASK_ERROR_ONLY) &
-				irq.vfeIrqStatus);
-
-	spin_lock_irqsave(&ctrl->irqs_lock, flags);
-	qcmd = get_irq_cmd_nosync();
-	if (!qcmd) {
-		spin_unlock_irqrestore(&ctrl->irqs_lock, flags);
-		goto done;
-	}
-	/* first parse the interrupt status to local data structures. */
-	vfe_parse_interrupt_status(&qcmd->vfeInterruptStatus, irqStatusLocal);
-	vfe_get_asf_frame_info(&qcmd->vfeAsfFrameInfo, &irq);
-	vfe_get_demosaic_frame_info(&qcmd->vfeBpcFrameInfo, &irq);
-	vfe_get_camif_status(&qcmd->vfeCamifStatusLocal, &irq);
-	vfe_get_performance_monitor_data(&qcmd->vfePmData, &irq);
-	spin_unlock_irqrestore(&ctrl->irqs_lock, flags);
-	tasklet_schedule(&vfe_tasklet);
-
-done:
-	/* clear the pending interrupt of the same kind.*/
-	writel(irq.vfeIrqStatus, ctrl->vfebase + VFE_IRQ_CLEAR);
-
-	return IRQ_HANDLED;
-}
-
-int vfe_cmd_init(struct msm_vfe_callback *presp,
-	struct platform_device *pdev, void *sdata)
-{
-	struct resource	*vfemem, *vfeirq, *vfeio;
-	int rc;
-	struct msm_camera_sensor_info *s_info;
-	s_info = pdev->dev.platform_data;
-
-	pdev->resource = s_info->resource;
-	pdev->num_resources = s_info->num_resources;
-
-	vfemem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!vfemem) {
-		pr_err("%s: no mem resource\n", __func__);
-		return -ENODEV;
-	}
-
-	vfeirq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!vfeirq) {
-		pr_err("%s: no irq resource\n", __func__);
-		return -ENODEV;
-	}
-
-	vfeio = request_mem_region(vfemem->start,
-		resource_size(vfemem), pdev->name);
-	if (!vfeio) {
-		pr_err("%s: VFE region already claimed\n", __func__);
-		return -EBUSY;
-	}
-
-	ctrl = kzalloc(sizeof(struct msm_vfe8x_ctrl), GFP_KERNEL);
-	if (!ctrl) {
-		pr_err("%s: out of memory\n", __func__);
-		rc = -ENOMEM;
-		goto cmd_init_failed1;
-	}
-	atomic_set(&ctrl->vfe_serv_interrupt, 0);
-	ctrl->vfeirq  = vfeirq->start;
-
-	ctrl->vfebase =
-		ioremap(vfemem->start, (vfemem->end - vfemem->start) + 1);
-	if (!ctrl->vfebase) {
-		pr_err("%s: ioremap failed\n", __func__);
-		rc = -ENOMEM;
-		goto cmd_init_failed2;
-	}
-
-	rc = request_irq(ctrl->vfeirq, vfe_parse_irq,
-		IRQF_TRIGGER_RISING, "vfe", 0);
-	if (rc < 0) {
-		pr_err("%s: request_irq(%d) failed\n", __func__, ctrl->vfeirq);
-		goto cmd_init_failed2;
-	}
-
-	if (presp && presp->vfe_resp)
-		ctrl->resp = presp;
-	else {
-		pr_err("%s: no vfe_resp function\n", __func__);
-
-		rc = -EIO;
-		goto cmd_init_failed3;
-	}
-
-	ctrl->syncdata = sdata;
-	return 0;
-
-cmd_init_failed3:
-	disable_irq(ctrl->vfeirq);
-	free_irq(ctrl->vfeirq, 0);
-	iounmap(ctrl->vfebase);
-cmd_init_failed2:
-	kfree(ctrl);
-cmd_init_failed1:
-	release_mem_region(vfemem->start, (vfemem->end - vfemem->start) + 1);
-	return rc;
-}
-
-void vfe_cmd_release(struct platform_device *dev)
-{
-	struct resource	*mem;
-	unsigned long flags;
-	atomic_set(&ctrl->vfe_serv_interrupt, 0);
-	disable_irq(ctrl->vfeirq);
-	free_irq(ctrl->vfeirq, 0);
-
-	iounmap(ctrl->vfebase);
-	mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
-	release_mem_region(mem->start, (mem->end - mem->start) + 1);
-
-	spin_lock_irqsave(&msm_vfe_ctrl_lock, flags);
-	kfree(ctrl);
-	ctrl = 0;
-	spin_unlock_irqrestore(&msm_vfe_ctrl_lock, flags);
-}
-
-void vfe_stats_af_stop(void)
-{
-	ctrl->vfeStatsCmdLocal.autoFocusEnable = FALSE;
-	ctrl->vfeImaskLocal.afPingpongIrq = FALSE;
-}
-
-void vfe_stop(void)
-{
-	int spin_cnt = 0;
-	uint32_t vfeAxiStauts;
-
-	/* for reset hw modules, and send msg when reset_irq comes.*/
-	ctrl->vfeStopAckPending = TRUE;
-
-	ctrl->vfeStatsPingPongReloadFlag = FALSE;
-	vfe_pm_stop();
-
-	/* disable all interrupts.  */
-	vfe_program_irq_mask(VFE_DISABLE_ALL_IRQS);
-
-	/* in either continuous or snapshot mode, stop command can be issued
-	 * at any time.
-	 */
-	vfe_camif_stop_immediately();
-	vfe_program_axi_cmd(AXI_HALT);
-	vfe_prog_hw_testgen_cmd(VFE_TEST_GEN_STOP);
-
-	do {
-		vfeAxiStauts = vfe_read_axi_status();
-		spin_cnt++;
-	} while (!(vfeAxiStauts & AXI_STATUS_BUSY_MASK));
-	if (spin_cnt > 1)
-		pr_warning("%s: spin_cnt %d\n", __func__, spin_cnt);
-
-	vfe_program_axi_cmd(AXI_HALT_CLEAR);
-
-	/* clear all pending interrupts */
-	writel(VFE_CLEAR_ALL_IRQS, ctrl->vfebase + VFE_IRQ_CLEAR);
-
-	/* enable reset_ack and async timer interrupt only while stopping
-	 * the pipeline.
-	 */
-	vfe_program_irq_mask(VFE_IMASK_WHILE_STOPPING);
-
-	vfe_program_global_reset_cmd(VFE_RESET_UPON_STOP_CMD);
-}
-
-void vfe_update(void)
-{
-	ctrl->vfeModuleEnableLocal.statsEnable =
-		ctrl->vfeStatsCmdLocal.autoFocusEnable |
-		ctrl->vfeStatsCmdLocal.axwEnable;
-
-	vfe_reg_module_cfg(&ctrl->vfeModuleEnableLocal);
-
-	vfe_program_stats_cmd(&ctrl->vfeStatsCmdLocal);
-
-	ctrl->vfeImaskPacked = vfe_irq_pack(ctrl->vfeImaskLocal);
-	vfe_program_irq_mask(ctrl->vfeImaskPacked);
-
-	if ((ctrl->vfeModuleEnableLocal.statsEnable == TRUE) &&
-			(ctrl->vfeStatsPingPongReloadFlag == FALSE)) {
-		ctrl->vfeStatsPingPongReloadFlag = TRUE;
-
-		ctrl->vfeBusCmdLocal.statsPingpongReload = TRUE;
-		vfe_reg_bus_cmd(&ctrl->vfeBusCmdLocal);
-	}
-
-	vfe_program_reg_update_cmd(VFE_REG_UPDATE_TRIGGER);
-}
-
-int vfe_rgb_gamma_update(struct vfe_cmd_rgb_gamma_config *in)
-{
-	int rc = 0;
-
-	ctrl->vfeModuleEnableLocal.rgbLUTEnable = in->enable;
-
-	switch (in->channelSelect) {
-	case RGB_GAMMA_CH0_SELECTED:
-		ctrl->vfeGammaLutSel.ch0BankSelect ^= 1;
-		vfe_write_gamma_table(0,
-				      ctrl->vfeGammaLutSel.ch0BankSelect,
-				      in->table);
-		break;
-
-	case RGB_GAMMA_CH1_SELECTED:
-		ctrl->vfeGammaLutSel.ch1BankSelect ^= 1;
-		vfe_write_gamma_table(1,
-				      ctrl->vfeGammaLutSel.ch1BankSelect,
-				      in->table);
-		break;
-
-	case RGB_GAMMA_CH2_SELECTED:
-		ctrl->vfeGammaLutSel.ch2BankSelect ^= 1;
-		vfe_write_gamma_table(2,
-				      ctrl->vfeGammaLutSel.ch2BankSelect,
-				      in->table);
-		break;
-
-	case RGB_GAMMA_CH0_CH1_SELECTED:
-		ctrl->vfeGammaLutSel.ch0BankSelect ^= 1;
-		ctrl->vfeGammaLutSel.ch1BankSelect ^= 1;
-		vfe_write_gamma_table(0, ctrl->vfeGammaLutSel.ch0BankSelect,
-			in->table);
-		vfe_write_gamma_table(1, ctrl->vfeGammaLutSel.ch1BankSelect,
-			in->table);
-		break;
-
-	case RGB_GAMMA_CH0_CH2_SELECTED:
-		ctrl->vfeGammaLutSel.ch0BankSelect ^= 1;
-		ctrl->vfeGammaLutSel.ch2BankSelect ^= 1;
-		vfe_write_gamma_table(0, ctrl->vfeGammaLutSel.ch0BankSelect,
-			in->table);
-		vfe_write_gamma_table(2, ctrl->vfeGammaLutSel.ch2BankSelect,
-			in->table);
-		break;
-
-	case RGB_GAMMA_CH1_CH2_SELECTED:
-		ctrl->vfeGammaLutSel.ch1BankSelect ^= 1;
-		ctrl->vfeGammaLutSel.ch2BankSelect ^= 1;
-		vfe_write_gamma_table(1, ctrl->vfeGammaLutSel.ch1BankSelect,
-			in->table);
-		vfe_write_gamma_table(2, ctrl->vfeGammaLutSel.ch2BankSelect,
-			in->table);
-		break;
-
-	case RGB_GAMMA_CH0_CH1_CH2_SELECTED:
-		ctrl->vfeGammaLutSel.ch0BankSelect ^= 1;
-		ctrl->vfeGammaLutSel.ch1BankSelect ^= 1;
-		ctrl->vfeGammaLutSel.ch2BankSelect ^= 1;
-		vfe_write_gamma_table(0, ctrl->vfeGammaLutSel.ch0BankSelect,
-			in->table);
-		vfe_write_gamma_table(1, ctrl->vfeGammaLutSel.ch1BankSelect,
-			in->table);
-		vfe_write_gamma_table(2, ctrl->vfeGammaLutSel.ch2BankSelect,
-			in->table);
-		break;
-
-	default:
-		pr_err("%s: invalid gamma channel %d\n", __func__,
-			in->channelSelect);
-		return -EINVAL;
-	} /* switch */
-
-	/* update the gammaLutSel register. */
-	vfe_program_lut_bank_sel(&ctrl->vfeGammaLutSel);
-
-	return rc;
-}
-
-int vfe_rgb_gamma_config(struct vfe_cmd_rgb_gamma_config *in)
-{
-	int rc = 0;
-
-	ctrl->vfeModuleEnableLocal.rgbLUTEnable = in->enable;
-
-	switch (in->channelSelect) {
-	case RGB_GAMMA_CH0_SELECTED:
-vfe_write_gamma_table(0, 0, in->table);
-break;
-
-	case RGB_GAMMA_CH1_SELECTED:
-		vfe_write_gamma_table(1, 0, in->table);
-		break;
-
-	case RGB_GAMMA_CH2_SELECTED:
-		vfe_write_gamma_table(2, 0, in->table);
-		break;
-
-	case RGB_GAMMA_CH0_CH1_SELECTED:
-		vfe_write_gamma_table(0, 0, in->table);
-		vfe_write_gamma_table(1, 0, in->table);
-		break;
-
-	case RGB_GAMMA_CH0_CH2_SELECTED:
-		vfe_write_gamma_table(0, 0, in->table);
-		vfe_write_gamma_table(2, 0, in->table);
-		break;
-
-	case RGB_GAMMA_CH1_CH2_SELECTED:
-		vfe_write_gamma_table(1, 0, in->table);
-		vfe_write_gamma_table(2, 0, in->table);
-		break;
-
-	case RGB_GAMMA_CH0_CH1_CH2_SELECTED:
-		vfe_write_gamma_table(0, 0, in->table);
-		vfe_write_gamma_table(1, 0, in->table);
-		vfe_write_gamma_table(2, 0, in->table);
-		break;
-
-	default:
-		pr_err("%s: invalid gamma channel %d\n", __func__,
-			in->channelSelect);
-		rc = -EINVAL;
-		break;
-	} /* switch */
-
-	return rc;
-}
-
-void vfe_stats_af_ack(struct vfe_cmd_stats_af_ack *in)
-{
-	ctrl->afStatsControl.nextFrameAddrBuf = in->nextAFOutputBufferAddr;
-	ctrl->afStatsControl.ackPending = FALSE;
-}
-
-void vfe_stats_wb_exp_ack(struct vfe_cmd_stats_wb_exp_ack *in)
-{
-	ctrl->awbStatsControl.nextFrameAddrBuf = in->nextWbExpOutputBufferAddr;
-	ctrl->awbStatsControl.ackPending = FALSE;
-}
-
-
-void vfe_output_v_ack(struct vfe_cmd_output_ack *in)
-{
-	const uint32_t *psrc;
-	uint32_t *pdest;
-	uint8_t i;
-
-	pdest = ctrl->encPath.nextFrameAddrBuf;
-
-	CDBG("video_frame_ack: ack addr = 0x%x\n", in->ybufaddr[0]);
-
-	psrc = in->ybufaddr;
-	for (i = 0; i < ctrl->encPath.fragCount; i++)
-		*pdest++ = *psrc++;
-
-	psrc = in->chromabufaddr;
-	for (i = 0; i < ctrl->encPath.fragCount; i++)
-		*pdest++ = *psrc++;
-
-	ctrl->encPath.ackPending = FALSE;
-}
-
-void vfe_output_p_ack(struct vfe_cmd_output_ack *in)
-{
-	const uint32_t *psrc;
-	uint32_t *pdest;
-	uint8_t i;
-
-	if (ctrl->axiOutputMode == VFE_AXI_OUTPUT_MODE_Output1AndOutput2) {
-		/* video mode, preview comes from output1 path */
-
-	pdest = ctrl->viewPath.nextFrameAddrBuf;
-
-	psrc = in->ybufaddr;
-	for (i = 0; i < ctrl->viewPath.fragCount; i++)
-		*pdest++ = *psrc++;
-
-	psrc = in->chromabufaddr;
-	for (i = 0; i < ctrl->viewPath.fragCount; i++)
-		*pdest++ = *psrc++;
-
-	ctrl->viewPath.ackPending = FALSE;
-
-	} else { /* preview mode, preview comes from output2 path. */
-		pdest = ctrl->encPath.nextFrameAddrBuf;
-
-		psrc = in->ybufaddr;
-		for (i = 0; i < ctrl->encPath.fragCount; i++)
-			*pdest++ = *psrc++;
-
-		psrc = in->chromabufaddr;
-		for (i = 0; i < ctrl->encPath.fragCount; i++)
-			*pdest++ = *psrc++;
-
-		ctrl->encPath.ackPending = FALSE;
-
-	}
-}
-
-void vfe_start(struct vfe_cmd_start *in)
-{
-	uint32_t  pmstatus = 0;
-	boolean rawmode;
-	uint32_t  demperiod = 0;
-	uint32_t  demeven = 0;
-	uint32_t  demodd = 0;
-
-	/* derived from other commands.  (camif config, axi output config,
-	 * etc)
-	*/
-	struct vfe_cfg hwcfg;
-	struct vfe_upsample_cfg chromupcfg;
-
-	CDBG("vfe_start operationMode = %d\n", in->operationMode);
-
-	memset(&hwcfg, 0, sizeof(hwcfg));
-	memset(&chromupcfg, 0, sizeof(chromupcfg));
-
-	switch (in->pixel) {
-	case VFE_BAYER_RGRGRG:
-		demperiod = 1;
-		demeven = 0xC9;
-		demodd = 0xAC;
-		break;
-
-	case VFE_BAYER_GRGRGR:
-		demperiod = 1;
-		demeven = 0x9C;
-		demodd = 0xCA;
-		break;
-
-	case VFE_BAYER_BGBGBG:
-		demperiod = 1;
-		demeven = 0xCA;
-		demodd = 0x9C;
-		break;
-
-	case VFE_BAYER_GBGBGB:
-		demperiod = 1;
-		demeven = 0xAC;
-		demodd = 0xC9;
-		break;
-
-	case VFE_YUV_YCbYCr:
-		demperiod = 3;
-		demeven = 0x9CAC;
-		demodd = 0x9CAC;
-		break;
-
-	case VFE_YUV_YCrYCb:
-		demperiod = 3;
-		demeven = 0xAC9C;
-		demodd = 0xAC9C;
-		break;
-
-	case VFE_YUV_CbYCrY:
-		demperiod = 3;
-		demeven = 0xC9CA;
-		demodd = 0xC9CA;
-		break;
-
-	case VFE_YUV_CrYCbY:
-		demperiod = 3;
-		demeven = 0xCAC9;
-		demodd = 0xCAC9;
-		break;
-
-	default:
-		return;
-	}
-
-	vfe_config_demux(demperiod, demeven, demodd);
-
-	vfe_program_lut_bank_sel(&ctrl->vfeGammaLutSel);
-
-	/* save variables to local. */
-	ctrl->vfeOperationMode = in->operationMode;
-	if (ctrl->vfeOperationMode == VFE_START_OPERATION_MODE_SNAPSHOT) {
-
-		update_axi_qos(MSM_AXI_QOS_SNAPSHOT);
-		/* in snapshot mode, initialize snapshot count*/
-		ctrl->vfeSnapShotCount = in->snapshotCount;
-
-		/* save the requested count, this is temporarily done, to
-		help with HJR / multishot. */
-		ctrl->vfeRequestedSnapShotCount = ctrl->vfeSnapShotCount;
-
-		CDBG("requested snapshot count = %d\n", ctrl->vfeSnapShotCount);
-
-		/* Assumption is to have the same pattern and period for both
-		paths, if both paths are used. */
-		if (ctrl->viewPath.pathEnabled) {
-			ctrl->viewPath.snapshotPendingCount = in->snapshotCount;
-
-			ctrl->vfeFrameSkipPattern =
-				ctrl->vfeFrameSkip.output1Pattern;
-			ctrl->vfeFrameSkipPeriod =
-				ctrl->vfeFrameSkip.output1Period;
-		}
-
-		if (ctrl->encPath.pathEnabled) {
-			ctrl->encPath.snapshotPendingCount = in->snapshotCount;
-
-			ctrl->vfeFrameSkipPattern =
-				ctrl->vfeFrameSkip.output2Pattern;
-			ctrl->vfeFrameSkipPeriod =
-				ctrl->vfeFrameSkip.output2Period;
-		}
-	} else
-		update_axi_qos(MSM_AXI_QOS_PREVIEW);
-
-	/* enable color conversion for bayer sensor
-	if stats enabled, need to do color conversion. */
-	if (in->pixel <= VFE_BAYER_GBGBGB)
-		ctrl->vfeStatsCmdLocal.colorConversionEnable = TRUE;
-
-	vfe_program_stats_cmd(&ctrl->vfeStatsCmdLocal);
-
-	if (in->pixel >= VFE_YUV_YCbYCr)
-		ctrl->vfeModuleEnableLocal.chromaUpsampleEnable = TRUE;
-
-	ctrl->vfeModuleEnableLocal.demuxEnable = TRUE;
-
-	/* if any stats module is enabled, the main bit is enabled. */
-	ctrl->vfeModuleEnableLocal.statsEnable =
-		ctrl->vfeStatsCmdLocal.autoFocusEnable |
-		ctrl->vfeStatsCmdLocal.axwEnable;
-
-	vfe_reg_module_cfg(&ctrl->vfeModuleEnableLocal);
-
-	/* in case of offline processing, do not need to config camif. Having
-	 * bus output enabled in camif_config register might confuse the
-	 * hardware?
-	 */
-	if (in->inputSource != VFE_START_INPUT_SOURCE_AXI) {
-		vfe_reg_camif_config(&ctrl->vfeCamifConfigLocal);
-	} else {
-		/* offline processing, enable axi read */
-		ctrl->vfeBusConfigLocal.stripeRdPathEn = TRUE;
-		ctrl->vfeBusCmdLocal.stripeReload = TRUE;
-		ctrl->vfeBusConfigLocal.rawPixelDataSize =
-			ctrl->axiInputDataSize;
-	}
-
-	vfe_reg_bus_cfg(&ctrl->vfeBusConfigLocal);
-
-	/* directly from start command */
-	hwcfg.pixelPattern = in->pixel;
-	hwcfg.inputSource = in->inputSource;
-	writel(*(uint32_t *)&hwcfg, ctrl->vfebase + VFE_CFG);
-
-	/* regardless module enabled or not, it does not hurt
-	 * to program the cositing mode. */
-	chromupcfg.chromaCositingForYCbCrInputs = in->yuvInputCositingMode;
-
-	writel(*(uint32_t *)&chromupcfg,
-		ctrl->vfebase + VFE_CHROMA_UPSAMPLE_CFG);
-
-	/* MISR to monitor the axi read. */
-	writel(0xd8, ctrl->vfebase + VFE_BUS_MISR_MAST_CFG_0);
-
-	/* clear all pending interrupts. */
-	writel(VFE_CLEAR_ALL_IRQS, ctrl->vfebase + VFE_IRQ_CLEAR);
-
-	/*  define how composite interrupt work.  */
-	ctrl->vfeImaskCompositePacked =
-		vfe_irq_composite_pack(ctrl->vfeIrqCompositeMaskLocal);
-
-	vfe_program_irq_composite_mask(ctrl->vfeImaskCompositePacked);
-
-	/*  enable all necessary interrupts.      */
-	ctrl->vfeImaskLocal.camifSofIrq  = TRUE;
-	ctrl->vfeImaskLocal.regUpdateIrq = TRUE;
-	ctrl->vfeImaskLocal.resetAckIrq  = TRUE;
-
-	ctrl->vfeImaskPacked = vfe_irq_pack(ctrl->vfeImaskLocal);
-	vfe_program_irq_mask(ctrl->vfeImaskPacked);
-
-	/* enable bus performance monitor */
-	vfe_8k_pm_start(&ctrl->vfeBusPmConfigLocal);
-
-	/* trigger vfe reg update */
-	ctrl->vfeStartAckPendingFlag = TRUE;
-
-	/* write bus command to trigger reload of ping pong buffer. */
-	ctrl->vfeBusCmdLocal.busPingpongReload = TRUE;
-
-	if (ctrl->vfeModuleEnableLocal.statsEnable == TRUE) {
-		ctrl->vfeBusCmdLocal.statsPingpongReload = TRUE;
-		ctrl->vfeStatsPingPongReloadFlag = TRUE;
-	}
-
-	writel(VFE_REG_UPDATE_TRIGGER, ctrl->vfebase + VFE_REG_UPDATE_CMD);
-
-	/* program later than the reg update. */
-	vfe_reg_bus_cmd(&ctrl->vfeBusCmdLocal);
-
-	if ((in->inputSource ==
-			 VFE_START_INPUT_SOURCE_CAMIF) ||
-	    (in->inputSource == VFE_START_INPUT_SOURCE_TESTGEN))
-		writel(CAMIF_COMMAND_START, ctrl->vfebase + CAMIF_COMMAND);
-
-	/* start test gen if it is enabled */
-	if (ctrl->vfeTestGenStartFlag == TRUE) {
-		ctrl->vfeTestGenStartFlag = FALSE;
-		vfe_prog_hw_testgen_cmd(VFE_TEST_GEN_GO);
-	}
-
-	CDBG("ctrl->axiOutputMode = %d\n", ctrl->axiOutputMode);
-	if (ctrl->axiOutputMode == VFE_AXI_OUTPUT_MODE_CAMIFToAXIViaOutput2) {
-		/* raw dump mode */
-		rawmode = TRUE;
-
-		while (rawmode) {
-			pmstatus =
-				readl(ctrl->vfebase +
-					VFE_BUS_ENC_CBCR_WR_PM_STATS_1);
-
-			if ((pmstatus & VFE_PM_BUF_MAX_CNT_MASK) != 0)
-				rawmode = FALSE;
-		}
-
-		vfe_proc_ops(VFE_MSG_ID_START_ACK, NULL);
-		ctrl->vfeStartAckPendingFlag = FALSE;
-	}
-
-	ctrl->vstate = VFE_STATE_ACTIVE;
-}
-
-void vfe_la_update(struct vfe_cmd_la_config *in)
-{
-	int16_t *pTable;
-	enum VFE_DMI_RAM_SEL dmiRamSel;
-	int i;
-
-	pTable = in->table;
-	ctrl->vfeModuleEnableLocal.lumaAdaptationEnable = in->enable;
-
-	/* toggle the bank to be used. */
-	ctrl->vfeLaBankSel ^= 1;
-
-	if (ctrl->vfeLaBankSel == 0)
-		dmiRamSel = LUMA_ADAPT_LUT_RAM_BANK0;
-	else
-		dmiRamSel = LUMA_ADAPT_LUT_RAM_BANK1;
-
-	/* configure the DMI_CFG to select right sram */
-	vfe_program_dmi_cfg(dmiRamSel);
-
-	for (i = 0; i < VFE_LA_TABLE_LENGTH; i++) {
-		writel((uint32_t)(*pTable), ctrl->vfebase + VFE_DMI_DATA_LO);
-		pTable++;
-	}
-
-	/* After DMI transfer, to make it safe, need to set
-	 * the DMI_CFG to unselect any SRAM */
-	writel(VFE_DMI_CFG_DEFAULT, ctrl->vfebase + VFE_DMI_CFG);
-	writel(ctrl->vfeLaBankSel, ctrl->vfebase + VFE_LA_CFG);
-}
-
-void vfe_la_config(struct vfe_cmd_la_config *in)
-{
-	uint16_t i;
-	int16_t  *pTable;
-	enum VFE_DMI_RAM_SEL dmiRamSel;
-
-	pTable = in->table;
-	ctrl->vfeModuleEnableLocal.lumaAdaptationEnable = in->enable;
-
-	if (ctrl->vfeLaBankSel == 0)
-		dmiRamSel = LUMA_ADAPT_LUT_RAM_BANK0;
-	else
-		dmiRamSel = LUMA_ADAPT_LUT_RAM_BANK1;
-
-	/* configure the DMI_CFG to select right sram */
-	vfe_program_dmi_cfg(dmiRamSel);
-
-	for (i = 0; i < VFE_LA_TABLE_LENGTH; i++) {
-		writel((uint32_t)(*pTable), ctrl->vfebase + VFE_DMI_DATA_LO);
-		pTable++;
-	}
-
-	/* After DMI transfer, to make it safe, need to set the
-	 * DMI_CFG to unselect any SRAM */
-	writel(VFE_DMI_CFG_DEFAULT, ctrl->vfebase + VFE_DMI_CFG);
-
-	/* can only be bank 0 or bank 1 for now. */
-	writel(ctrl->vfeLaBankSel, ctrl->vfebase + VFE_LA_CFG);
-	CDBG("VFE Luma adaptation bank selection is 0x%x\n",
-			 *(uint32_t *)&ctrl->vfeLaBankSel);
-}
-
-void vfe_test_gen_start(struct vfe_cmd_test_gen_start *in)
-{
-	struct VFE_TestGen_ConfigCmdType cmd;
-
-	memset(&cmd, 0, sizeof(cmd));
-
-	cmd.numFrame              = in->numFrame;
-	cmd.pixelDataSelect       = in->pixelDataSelect;
-	cmd.systematicDataSelect  = in->systematicDataSelect;
-	cmd.pixelDataSize         = (uint32_t)in->pixelDataSize;
-	cmd.hsyncEdge             = (uint32_t)in->hsyncEdge;
-	cmd.vsyncEdge             = (uint32_t)in->vsyncEdge;
-	cmd.imageWidth            = in->imageWidth;
-	cmd.imageHeight           = in->imageHeight;
-	cmd.sofOffset             = in->startOfFrameOffset;
-	cmd.eofNOffset            = in->endOfFrameNOffset;
-	cmd.solOffset             = in->startOfLineOffset;
-	cmd.eolNOffset            = in->endOfLineNOffset;
-	cmd.hBlankInterval        = in->hbi;
-	cmd.vBlankInterval        = in->vbl;
-	cmd.vBlankIntervalEnable  = in->vblEnable;
-	cmd.sofDummy              = in->startOfFrameDummyLine;
-	cmd.eofDummy              = in->endOfFrameDummyLine;
-	cmd.unicolorBarSelect     = in->unicolorBarSelect;
-	cmd.unicolorBarEnable     = in->unicolorBarEnable;
-	cmd.splitEnable           = in->colorBarsSplitEnable;
-	cmd.pixelPattern          = (uint32_t)in->colorBarsPixelPattern;
-	cmd.rotatePeriod          = in->colorBarsRotatePeriod;
-	cmd.randomSeed            = in->testGenRandomSeed;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_HW_TESTGEN_CFG,
-		(uint32_t *) &cmd, sizeof(cmd));
-}
-
-void vfe_frame_skip_update(struct vfe_cmd_frame_skip_update *in)
-{
-	struct VFE_FRAME_SKIP_UpdateCmdType cmd;
-
-	cmd.yPattern    = in->output1Pattern;
-	cmd.cbcrPattern = in->output1Pattern;
-	vfe_prog_hw(ctrl->vfebase + VFE_FRAMEDROP_VIEW_Y_PATTERN,
-		(uint32_t *)&cmd, sizeof(cmd));
-
-	cmd.yPattern    = in->output2Pattern;
-	cmd.cbcrPattern = in->output2Pattern;
-	vfe_prog_hw(ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_PATTERN,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_frame_skip_config(struct vfe_cmd_frame_skip_config *in)
-{
-	struct vfe_frame_skip_cfg cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	ctrl->vfeFrameSkip = *in;
-
-	cmd.output2YPeriod     = in->output2Period;
-	cmd.output2CbCrPeriod  = in->output2Period;
-	cmd.output2YPattern    = in->output2Pattern;
-	cmd.output2CbCrPattern = in->output2Pattern;
-	cmd.output1YPeriod     = in->output1Period;
-	cmd.output1CbCrPeriod  = in->output1Period;
-	cmd.output1YPattern    = in->output1Pattern;
-	cmd.output1CbCrPattern = in->output1Pattern;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_FRAMEDROP_ENC_Y_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_output_clamp_config(struct vfe_cmd_output_clamp_config *in)
-{
-	struct vfe_output_clamp_cfg cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	cmd.yChanMax  = in->maxCh0;
-	cmd.cbChanMax = in->maxCh1;
-	cmd.crChanMax = in->maxCh2;
-
-	cmd.yChanMin  = in->minCh0;
-	cmd.cbChanMin = in->minCh1;
-	cmd.crChanMin = in->minCh2;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_CLAMP_MAX_CFG, (uint32_t *)&cmd,
-		sizeof(cmd));
-}
-
-void vfe_camif_frame_update(struct vfe_cmds_camif_frame *in)
-{
-	struct vfe_camifframe_update cmd;
-
-	memset(&cmd, 0, sizeof(cmd));
-
-	cmd.pixelsPerLine = in->pixelsPerLine;
-	cmd.linesPerFrame = in->linesPerFrame;
-
-	vfe_prog_hw(ctrl->vfebase + CAMIF_FRAME_CONFIG, (uint32_t *)&cmd,
-		sizeof(cmd));
-}
-
-void vfe_color_correction_config(struct vfe_cmd_color_correction_config *in)
-{
-	struct vfe_color_correction_cfg cmd;
-
-	memset(&cmd, 0, sizeof(cmd));
-	ctrl->vfeModuleEnableLocal.colorCorrectionEnable = in->enable;
-
-	cmd.c0 = in->C0;
-	cmd.c1 = in->C1;
-	cmd.c2 = in->C2;
-	cmd.c3 = in->C3;
-	cmd.c4 = in->C4;
-	cmd.c5 = in->C5;
-	cmd.c6 = in->C6;
-	cmd.c7 = in->C7;
-	cmd.c8 = in->C8;
-
-	cmd.k0 = in->K0;
-	cmd.k1 = in->K1;
-	cmd.k2 = in->K2;
-
-	cmd.coefQFactor = in->coefQFactor;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_COLOR_CORRECT_COEFF_0,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_demosaic_abf_update(struct vfe_cmd_demosaic_abf_update *in)
-{
-struct vfe_demosaic_cfg cmd;
-	struct vfe_demosaic_abf_cfg cmdabf;
-	uint32_t temp;
-
-	memset(&cmd, 0, sizeof(cmd));
-	temp = readl(ctrl->vfebase + VFE_DEMOSAIC_CFG);
-
-	cmd = *((struct vfe_demosaic_cfg *)(&temp));
-	cmd.abfEnable       = in->abfUpdate.enable;
-	cmd.forceAbfOn      = in->abfUpdate.forceOn;
-	cmd.abfShift        = in->abfUpdate.shift;
-	vfe_prog_hw(ctrl->vfebase + VFE_DEMOSAIC_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-
-	cmdabf.lpThreshold  = in->abfUpdate.lpThreshold;
-	cmdabf.ratio        = in->abfUpdate.ratio;
-	cmdabf.minValue     = in->abfUpdate.min;
-	cmdabf.maxValue     = in->abfUpdate.max;
-	vfe_prog_hw(ctrl->vfebase + VFE_DEMOSAIC_ABF_CFG_0,
-		(uint32_t *)&cmdabf, sizeof(cmdabf));
-}
-
-void vfe_demosaic_bpc_update(struct vfe_cmd_demosaic_bpc_update *in)
-{
-	struct vfe_demosaic_cfg cmd;
-	struct vfe_demosaic_bpc_cfg cmdbpc;
-	uint32_t temp;
-
-	memset(&cmd, 0, sizeof(cmd));
-
-	temp = readl(ctrl->vfebase + VFE_DEMOSAIC_CFG);
-
-	cmd = *((struct vfe_demosaic_cfg *)(&temp));
-	cmd.badPixelCorrEnable = in->bpcUpdate.enable;
-	cmd.fminThreshold      = in->bpcUpdate.fminThreshold;
-	cmd.fmaxThreshold      = in->bpcUpdate.fmaxThreshold;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_DEMOSAIC_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-
-	cmdbpc.blueDiffThreshold  = in->bpcUpdate.blueDiffThreshold;
-	cmdbpc.redDiffThreshold   = in->bpcUpdate.redDiffThreshold;
-	cmdbpc.greenDiffThreshold = in->bpcUpdate.greenDiffThreshold;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_DEMOSAIC_BPC_CFG_0,
-		(uint32_t *)&cmdbpc, sizeof(cmdbpc));
-}
-
-void vfe_demosaic_config(struct vfe_cmd_demosaic_config *in)
-{
-	struct vfe_demosaic_cfg cmd;
-	struct vfe_demosaic_bpc_cfg cmd_bpc;
-	struct vfe_demosaic_abf_cfg cmd_abf;
-
-	memset(&cmd, 0, sizeof(cmd));
-	memset(&cmd_bpc, 0, sizeof(cmd_bpc));
-	memset(&cmd_abf, 0, sizeof(cmd_abf));
-
-	ctrl->vfeModuleEnableLocal.demosaicEnable = in->enable;
-
-	cmd.abfEnable          = in->abfConfig.enable;
-	cmd.badPixelCorrEnable = in->bpcConfig.enable;
-	cmd.forceAbfOn         = in->abfConfig.forceOn;
-	cmd.abfShift           = in->abfConfig.shift;
-	cmd.fminThreshold      = in->bpcConfig.fminThreshold;
-	cmd.fmaxThreshold      = in->bpcConfig.fmaxThreshold;
-	cmd.slopeShift         = in->slopeShift;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_DEMOSAIC_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-
-	cmd_abf.lpThreshold = in->abfConfig.lpThreshold;
-	cmd_abf.ratio       = in->abfConfig.ratio;
-	cmd_abf.minValue    = in->abfConfig.min;
-	cmd_abf.maxValue    = in->abfConfig.max;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_DEMOSAIC_ABF_CFG_0,
-		(uint32_t *)&cmd_abf, sizeof(cmd_abf));
-
-	cmd_bpc.blueDiffThreshold   = in->bpcConfig.blueDiffThreshold;
-	cmd_bpc.redDiffThreshold    = in->bpcConfig.redDiffThreshold;
-	cmd_bpc.greenDiffThreshold  = in->bpcConfig.greenDiffThreshold;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_DEMOSAIC_BPC_CFG_0,
-		(uint32_t *)&cmd_bpc, sizeof(cmd_bpc));
-}
-
-void vfe_demux_channel_gain_update(struct vfe_cmd_demux_channel_gain_config *in)
-{
-	struct vfe_demux_cfg cmd;
-
-	memset(&cmd, 0, sizeof(cmd));
-
-	cmd.ch0EvenGain  = in->ch0EvenGain;
-	cmd.ch0OddGain   = in->ch0OddGain;
-	cmd.ch1Gain      = in->ch1Gain;
-	cmd.ch2Gain      = in->ch2Gain;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_DEMUX_GAIN_0,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_demux_channel_gain_config(struct vfe_cmd_demux_channel_gain_config *in)
-{
-	struct vfe_demux_cfg cmd;
-
-	memset(&cmd, 0, sizeof(cmd));
-
-	cmd.ch0EvenGain = in->ch0EvenGain;
-	cmd.ch0OddGain  = in->ch0OddGain;
-	cmd.ch1Gain     = in->ch1Gain;
-	cmd.ch2Gain     = in->ch2Gain;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_DEMUX_GAIN_0,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_black_level_update(struct vfe_cmd_black_level_config *in)
-{
-	struct vfe_blacklevel_cfg cmd;
-
-	memset(&cmd, 0, sizeof(cmd));
-	ctrl->vfeModuleEnableLocal.blackLevelCorrectionEnable = in->enable;
-
-	cmd.evenEvenAdjustment = in->evenEvenAdjustment;
-	cmd.evenOddAdjustment  = in->evenOddAdjustment;
-	cmd.oddEvenAdjustment  = in->oddEvenAdjustment;
-	cmd.oddOddAdjustment   = in->oddOddAdjustment;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_BLACK_EVEN_EVEN_VALUE,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_black_level_config(struct vfe_cmd_black_level_config *in)
-{
-	struct vfe_blacklevel_cfg cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	ctrl->vfeModuleEnableLocal.blackLevelCorrectionEnable = in->enable;
-
-	cmd.evenEvenAdjustment = in->evenEvenAdjustment;
-	cmd.evenOddAdjustment  = in->evenOddAdjustment;
-	cmd.oddEvenAdjustment  = in->oddEvenAdjustment;
-	cmd.oddOddAdjustment   = in->oddOddAdjustment;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_BLACK_EVEN_EVEN_VALUE,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_asf_update(struct vfe_cmd_asf_update *in)
-{
-	struct vfe_asf_update cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	ctrl->vfeModuleEnableLocal.asfEnable = in->enable;
-
-	cmd.smoothEnable     = in->smoothFilterEnabled;
-	cmd.sharpMode        = in->sharpMode;
-	cmd.smoothCoeff0     = in->smoothCoefCenter;
-	cmd.smoothCoeff1     = in->smoothCoefSurr;
-	cmd.cropEnable       = in->cropEnable;
-	cmd.sharpThresholdE1 = in->sharpThreshE1;
-	cmd.sharpDegreeK1    = in->sharpK1;
-	cmd.sharpDegreeK2    = in->sharpK2;
-	cmd.normalizeFactor  = in->normalizeFactor;
-	cmd.sharpThresholdE2 = in->sharpThreshE2;
-	cmd.sharpThresholdE3 = in->sharpThreshE3;
-	cmd.sharpThresholdE4 = in->sharpThreshE4;
-	cmd.sharpThresholdE5 = in->sharpThreshE5;
-	cmd.F1Coeff0         = in->filter1Coefficients[0];
-	cmd.F1Coeff1         = in->filter1Coefficients[1];
-	cmd.F1Coeff2         = in->filter1Coefficients[2];
-	cmd.F1Coeff3         = in->filter1Coefficients[3];
-	cmd.F1Coeff4         = in->filter1Coefficients[4];
-	cmd.F1Coeff5         = in->filter1Coefficients[5];
-	cmd.F1Coeff6         = in->filter1Coefficients[6];
-	cmd.F1Coeff7         = in->filter1Coefficients[7];
-	cmd.F1Coeff8         = in->filter1Coefficients[8];
-	cmd.F2Coeff0         = in->filter2Coefficients[0];
-	cmd.F2Coeff1         = in->filter2Coefficients[1];
-	cmd.F2Coeff2         = in->filter2Coefficients[2];
-	cmd.F2Coeff3         = in->filter2Coefficients[3];
-	cmd.F2Coeff4         = in->filter2Coefficients[4];
-	cmd.F2Coeff5         = in->filter2Coefficients[5];
-	cmd.F2Coeff6         = in->filter2Coefficients[6];
-	cmd.F2Coeff7         = in->filter2Coefficients[7];
-	cmd.F2Coeff8         = in->filter2Coefficients[8];
-
-	vfe_prog_hw(ctrl->vfebase + VFE_ASF_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_asf_config(struct vfe_cmd_asf_config *in)
-{
-	struct vfe_asf_update     cmd;
-	struct vfe_asfcrop_cfg cmd2;
-
-	memset(&cmd, 0, sizeof(cmd));
-	memset(&cmd2, 0, sizeof(cmd2));
-
-	ctrl->vfeModuleEnableLocal.asfEnable = in->enable;
-
-	cmd.smoothEnable       = in->smoothFilterEnabled;
-	cmd.sharpMode          = in->sharpMode;
-	cmd.smoothCoeff0       = in->smoothCoefCenter;
-	cmd.smoothCoeff1       = in->smoothCoefSurr;
-	cmd.cropEnable         = in->cropEnable;
-	cmd.sharpThresholdE1   = in->sharpThreshE1;
-	cmd.sharpDegreeK1      = in->sharpK1;
-	cmd.sharpDegreeK2      = in->sharpK2;
-	cmd.normalizeFactor    = in->normalizeFactor;
-	cmd.sharpThresholdE2   = in->sharpThreshE2;
-	cmd.sharpThresholdE3   = in->sharpThreshE3;
-	cmd.sharpThresholdE4   = in->sharpThreshE4;
-	cmd.sharpThresholdE5   = in->sharpThreshE5;
-	cmd.F1Coeff0           = in->filter1Coefficients[0];
-	cmd.F1Coeff1           = in->filter1Coefficients[1];
-	cmd.F1Coeff2           = in->filter1Coefficients[2];
-	cmd.F1Coeff3           = in->filter1Coefficients[3];
-	cmd.F1Coeff4           = in->filter1Coefficients[4];
-	cmd.F1Coeff5           = in->filter1Coefficients[5];
-	cmd.F1Coeff6           = in->filter1Coefficients[6];
-	cmd.F1Coeff7           = in->filter1Coefficients[7];
-	cmd.F1Coeff8           = in->filter1Coefficients[8];
-	cmd.F2Coeff0           = in->filter2Coefficients[0];
-	cmd.F2Coeff1           = in->filter2Coefficients[1];
-	cmd.F2Coeff2           = in->filter2Coefficients[2];
-	cmd.F2Coeff3           = in->filter2Coefficients[3];
-	cmd.F2Coeff4           = in->filter2Coefficients[4];
-	cmd.F2Coeff5           = in->filter2Coefficients[5];
-	cmd.F2Coeff6           = in->filter2Coefficients[6];
-	cmd.F2Coeff7           = in->filter2Coefficients[7];
-	cmd.F2Coeff8           = in->filter2Coefficients[8];
-
-	vfe_prog_hw(ctrl->vfebase + VFE_ASF_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-
-	cmd2.firstLine  = in->cropFirstLine;
-	cmd2.lastLine   = in->cropLastLine;
-	cmd2.firstPixel = in->cropFirstPixel;
-	cmd2.lastPixel  = in->cropLastPixel;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_ASF_CROP_WIDTH_CFG,
-		(uint32_t *)&cmd2, sizeof(cmd2));
-}
-
-void vfe_white_balance_config(struct vfe_cmd_white_balance_config *in)
-{
-	struct vfe_wb_cfg cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	ctrl->vfeModuleEnableLocal.whiteBalanceEnable = in->enable;
-
-	cmd.ch0Gain = in->ch0Gain;
-	cmd.ch1Gain = in->ch1Gain;
-	cmd.ch2Gain = in->ch2Gain;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_WB_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_chroma_sup_config(struct vfe_cmd_chroma_suppression_config *in)
-{
-	struct vfe_chroma_suppress_cfg cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	ctrl->vfeModuleEnableLocal.chromaSuppressionEnable = in->enable;
-
-	cmd.m1  = in->m1;
-	cmd.m3  = in->m3;
-	cmd.n1  = in->n1;
-	cmd.n3  = in->n3;
-	cmd.mm1 = in->mm1;
-	cmd.nn1 = in->nn1;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_CHROMA_SUPPRESS_CFG_0,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_roll_off_config(struct vfe_cmd_roll_off_config *in)
-{
-	struct vfe_rolloff_cfg cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	ctrl->vfeModuleEnableLocal.lensRollOffEnable = in->enable;
-
-	cmd.gridWidth   = in->gridWidth;
-	cmd.gridHeight  = in->gridHeight;
-	cmd.yDelta      = in->yDelta;
-	cmd.gridX       = in->gridXIndex;
-	cmd.gridY       = in->gridYIndex;
-	cmd.pixelX      = in->gridPixelXIndex;
-	cmd.pixelY      = in->gridPixelYIndex;
-	cmd.yDeltaAccum = in->yDeltaAccum;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_ROLLOFF_CFG_0,
-		(uint32_t *)&cmd, sizeof(cmd));
-
-	vfe_write_lens_roll_off_table(in);
-}
-
-void vfe_chroma_subsample_config(struct vfe_cmd_chroma_subsample_config *in)
-{
-	struct vfe_chromasubsample_cfg cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	ctrl->vfeModuleEnableLocal.chromaSubsampleEnable = in->enable;
-
-	cmd.hCositedPhase       = in->hCositedPhase;
-	cmd.vCositedPhase       = in->vCositedPhase;
-	cmd.hCosited            = in->hCosited;
-	cmd.vCosited            = in->vCosited;
-	cmd.hsubSampleEnable    = in->hsubSampleEnable;
-	cmd.vsubSampleEnable    = in->vsubSampleEnable;
-	cmd.cropEnable          = in->cropEnable;
-	cmd.cropWidthLastPixel  = in->cropWidthLastPixel;
-	cmd.cropWidthFirstPixel = in->cropWidthFirstPixel;
-	cmd.cropHeightLastLine  = in->cropHeightLastLine;
-	cmd.cropHeightFirstLine = in->cropHeightFirstLine;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_CHROMA_SUBSAMPLE_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_chroma_enhan_config(struct vfe_cmd_chroma_enhan_config *in)
-{
-	struct vfe_chroma_enhance_cfg cmd;
-	struct vfe_color_convert_cfg cmd2;
-
-	memset(&cmd, 0, sizeof(cmd));
-	memset(&cmd2, 0, sizeof(cmd2));
-
-	ctrl->vfeModuleEnableLocal.chromaEnhanEnable = in->enable;
-
-	cmd.ap             = in->ap;
-	cmd.am             = in->am;
-	cmd.bp             = in->bp;
-	cmd.bm             = in->bm;
-	cmd.cp             = in->cp;
-	cmd.cm             = in->cm;
-	cmd.dp             = in->dp;
-	cmd.dm             = in->dm;
-	cmd.kcb            = in->kcb;
-	cmd.kcr            = in->kcr;
-
-	cmd2.v0            = in->RGBtoYConversionV0;
-	cmd2.v1            = in->RGBtoYConversionV1;
-	cmd2.v2            = in->RGBtoYConversionV2;
-	cmd2.ConvertOffset = in->RGBtoYConversionOffset;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_CHROMA_ENHAN_A,
-		(uint32_t *)&cmd, sizeof(cmd));
-
-	vfe_prog_hw(ctrl->vfebase + VFE_COLOR_CONVERT_COEFF_0,
-		(uint32_t *)&cmd2, sizeof(cmd2));
-}
-
-void vfe_scaler2cbcr_config(struct vfe_cmd_scaler2_config *in)
-{
-	struct vfe_scaler2_cfg cmd;
-
-	memset(&cmd, 0, sizeof(cmd));
-
-	ctrl->vfeModuleEnableLocal.scaler2CbcrEnable = in->enable;
-
-	cmd.hEnable              = in->hconfig.enable;
-	cmd.vEnable              = in->vconfig.enable;
-	cmd.inWidth              = in->hconfig.inputSize;
-	cmd.outWidth             = in->hconfig.outputSize;
-	cmd.horizPhaseMult       = in->hconfig.phaseMultiplicationFactor;
-	cmd.horizInterResolution = in->hconfig.interpolationResolution;
-	cmd.inHeight             = in->vconfig.inputSize;
-	cmd.outHeight            = in->vconfig.outputSize;
-	cmd.vertPhaseMult        = in->vconfig.phaseMultiplicationFactor;
-	cmd.vertInterResolution  = in->vconfig.interpolationResolution;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_SCALE_CBCR_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_scaler2y_config(struct vfe_cmd_scaler2_config *in)
-{
-	struct vfe_scaler2_cfg cmd;
-
-	memset(&cmd, 0, sizeof(cmd));
-
-	ctrl->vfeModuleEnableLocal.scaler2YEnable = in->enable;
-
-	cmd.hEnable               = in->hconfig.enable;
-	cmd.vEnable               = in->vconfig.enable;
-	cmd.inWidth               = in->hconfig.inputSize;
-	cmd.outWidth              = in->hconfig.outputSize;
-	cmd.horizPhaseMult        = in->hconfig.phaseMultiplicationFactor;
-	cmd.horizInterResolution  = in->hconfig.interpolationResolution;
-	cmd.inHeight              = in->vconfig.inputSize;
-	cmd.outHeight             = in->vconfig.outputSize;
-	cmd.vertPhaseMult         = in->vconfig.phaseMultiplicationFactor;
-	cmd.vertInterResolution   = in->vconfig.interpolationResolution;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_SCALE_Y_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_main_scaler_config(struct vfe_cmd_main_scaler_config *in)
-{
-	struct vfe_main_scaler_cfg cmd;
-
-	memset(&cmd, 0, sizeof(cmd));
-
-	ctrl->vfeModuleEnableLocal.mainScalerEnable = in->enable;
-
-	cmd.hEnable              = in->hconfig.enable;
-	cmd.vEnable              = in->vconfig.enable;
-	cmd.inWidth              = in->hconfig.inputSize;
-	cmd.outWidth             = in->hconfig.outputSize;
-	cmd.horizPhaseMult       = in->hconfig.phaseMultiplicationFactor;
-	cmd.horizInterResolution = in->hconfig.interpolationResolution;
-	cmd.horizMNInit          = in->MNInitH.MNCounterInit;
-	cmd.horizPhaseInit       = in->MNInitH.phaseInit;
-	cmd.inHeight             = in->vconfig.inputSize;
-	cmd.outHeight            = in->vconfig.outputSize;
-	cmd.vertPhaseMult        = in->vconfig.phaseMultiplicationFactor;
-	cmd.vertInterResolution  = in->vconfig.interpolationResolution;
-	cmd.vertMNInit           = in->MNInitV.MNCounterInit;
-	cmd.vertPhaseInit        = in->MNInitV.phaseInit;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_SCALE_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_stats_wb_exp_stop(void)
-{
-	ctrl->vfeStatsCmdLocal.axwEnable = FALSE;
-	ctrl->vfeImaskLocal.awbPingpongIrq = FALSE;
-}
-
-void vfe_stats_update_wb_exp(struct vfe_cmd_stats_wb_exp_update *in)
-{
-	struct vfe_statsawb_update   cmd;
-	struct vfe_statsawbae_update cmd2;
-
-	memset(&cmd, 0, sizeof(cmd));
-	memset(&cmd2, 0, sizeof(cmd2));
-
-	cmd.m1  = in->awbMCFG[0];
-	cmd.m2  = in->awbMCFG[1];
-	cmd.m3  = in->awbMCFG[2];
-	cmd.m4  = in->awbMCFG[3];
-	cmd.c1  = in->awbCCFG[0];
-	cmd.c2  = in->awbCCFG[1];
-	cmd.c3  = in->awbCCFG[2];
-	cmd.c4  = in->awbCCFG[3];
-	vfe_prog_hw(ctrl->vfebase + VFE_STATS_AWB_MCFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-
-	cmd2.aeRegionCfg    = in->wbExpRegions;
-	cmd2.aeSubregionCfg = in->wbExpSubRegion;
-	cmd2.awbYMin        = in->awbYMin;
-	cmd2.awbYMax        = in->awbYMax;
-	vfe_prog_hw(ctrl->vfebase + VFE_STATS_AWBAE_CFG,
-		(uint32_t *)&cmd2, sizeof(cmd2));
-}
-
-void vfe_stats_update_af(struct vfe_cmd_stats_af_update *in)
-{
-	struct vfe_statsaf_update cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	cmd.windowVOffset = in->windowVOffset;
-	cmd.windowHOffset = in->windowHOffset;
-	cmd.windowMode    = in->windowMode;
-	cmd.windowHeight  = in->windowHeight;
-	cmd.windowWidth   = in->windowWidth;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_STATS_AF_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_stats_start_wb_exp(struct vfe_cmd_stats_wb_exp_start *in)
-{
-	struct vfe_statsawb_update   cmd;
-	struct vfe_statsawbae_update cmd2;
-	struct vfe_statsaxw_hdr_cfg  cmd3;
-
-	ctrl->vfeStatsCmdLocal.axwEnable   =  in->enable;
-	ctrl->vfeImaskLocal.awbPingpongIrq = TRUE;
-
-	memset(&cmd, 0, sizeof(cmd));
-	memset(&cmd2, 0, sizeof(cmd2));
-	memset(&cmd3, 0, sizeof(cmd3));
-
-	cmd.m1  = in->awbMCFG[0];
-	cmd.m2  = in->awbMCFG[1];
-	cmd.m3  = in->awbMCFG[2];
-	cmd.m4  = in->awbMCFG[3];
-	cmd.c1  = in->awbCCFG[0];
-	cmd.c2  = in->awbCCFG[1];
-	cmd.c3  = in->awbCCFG[2];
-	cmd.c4  = in->awbCCFG[3];
-	vfe_prog_hw(ctrl->vfebase + VFE_STATS_AWB_MCFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-
-	cmd2.aeRegionCfg     = in->wbExpRegions;
-	cmd2.aeSubregionCfg  = in->wbExpSubRegion;
-	cmd2.awbYMin         = in->awbYMin;
-	cmd2.awbYMax         = in->awbYMax;
-	vfe_prog_hw(ctrl->vfebase + VFE_STATS_AWBAE_CFG,
-		(uint32_t *)&cmd2, sizeof(cmd2));
-
-	cmd3.axwHeader       = in->axwHeader;
-	vfe_prog_hw(ctrl->vfebase + VFE_STATS_AXW_HEADER,
-		(uint32_t *)&cmd3, sizeof(cmd3));
-}
-
-void vfe_stats_start_af(struct vfe_cmd_stats_af_start *in)
-{
-	struct vfe_statsaf_update cmd;
-	struct vfe_statsaf_cfg    cmd2;
-
-	memset(&cmd, 0, sizeof(cmd));
-	memset(&cmd2, 0, sizeof(cmd2));
-
-	ctrl->vfeStatsCmdLocal.autoFocusEnable = in->enable;
-	ctrl->vfeImaskLocal.afPingpongIrq = TRUE;
-
-	cmd.windowVOffset = in->windowVOffset;
-	cmd.windowHOffset = in->windowHOffset;
-	cmd.windowMode    = in->windowMode;
-	cmd.windowHeight  = in->windowHeight;
-	cmd.windowWidth   = in->windowWidth;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_STATS_AF_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-
-	cmd2.a00       = in->highPassCoef[0];
-	cmd2.a04       = in->highPassCoef[1];
-	cmd2.a20       = in->highPassCoef[2];
-	cmd2.a21       = in->highPassCoef[3];
-	cmd2.a22       = in->highPassCoef[4];
-	cmd2.a23       = in->highPassCoef[5];
-	cmd2.a24       = in->highPassCoef[6];
-	cmd2.fvMax     = in->metricMax;
-	cmd2.fvMetric  = in->metricSelection;
-	cmd2.afHeader  = in->bufferHeader;
-	cmd2.entry00   = in->gridForMultiWindows[0];
-	cmd2.entry01   = in->gridForMultiWindows[1];
-	cmd2.entry02   = in->gridForMultiWindows[2];
-	cmd2.entry03   = in->gridForMultiWindows[3];
-	cmd2.entry10   = in->gridForMultiWindows[4];
-	cmd2.entry11   = in->gridForMultiWindows[5];
-	cmd2.entry12   = in->gridForMultiWindows[6];
-	cmd2.entry13   = in->gridForMultiWindows[7];
-	cmd2.entry20   = in->gridForMultiWindows[8];
-	cmd2.entry21   = in->gridForMultiWindows[9];
-	cmd2.entry22   = in->gridForMultiWindows[10];
-	cmd2.entry23   = in->gridForMultiWindows[11];
-	cmd2.entry30   = in->gridForMultiWindows[12];
-	cmd2.entry31   = in->gridForMultiWindows[13];
-	cmd2.entry32   = in->gridForMultiWindows[14];
-	cmd2.entry33   = in->gridForMultiWindows[15];
-
-	vfe_prog_hw(ctrl->vfebase + VFE_STATS_AF_GRID_0,
-		(uint32_t *)&cmd2, sizeof(cmd2));
-}
-
-void vfe_stats_setting(struct vfe_cmd_stats_setting *in)
-{
-	struct vfe_statsframe cmd1;
-	struct vfe_busstats_wrprio cmd2;
-
-	memset(&cmd1, 0, sizeof(cmd1));
-	memset(&cmd2, 0, sizeof(cmd2));
-
-	ctrl->afStatsControl.addressBuffer[0] = in->afBuffer[0];
-	ctrl->afStatsControl.addressBuffer[1] = in->afBuffer[1];
-	ctrl->afStatsControl.nextFrameAddrBuf = in->afBuffer[2];
-
-	ctrl->awbStatsControl.addressBuffer[0] = in->awbBuffer[0];
-	ctrl->awbStatsControl.addressBuffer[1] = in->awbBuffer[1];
-	ctrl->awbStatsControl.nextFrameAddrBuf = in->awbBuffer[2];
-
-	cmd1.lastPixel = in->frameHDimension;
-	cmd1.lastLine  = in->frameVDimension;
-	vfe_prog_hw(ctrl->vfebase + VFE_STATS_FRAME_SIZE,
-		(uint32_t *)&cmd1, sizeof(cmd1));
-
-	cmd2.afBusPriority    = in->afBusPriority;
-	cmd2.awbBusPriority   = in->awbBusPriority;
-	cmd2.histBusPriority  = in->histBusPriority;
-	cmd2.afBusPriorityEn  = in->afBusPrioritySelection;
-	cmd2.awbBusPriorityEn = in->awbBusPrioritySelection;
-	cmd2.histBusPriorityEn = in->histBusPrioritySelection;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_BUS_STATS_WR_PRIORITY,
-		(uint32_t *)&cmd2, sizeof(cmd2));
-
-	/* Program the bus ping pong address for statistics modules. */
-	writel(in->afBuffer[0], ctrl->vfebase + VFE_BUS_STATS_AF_WR_PING_ADDR);
-	writel(in->afBuffer[1], ctrl->vfebase + VFE_BUS_STATS_AF_WR_PONG_ADDR);
-	writel(in->awbBuffer[0],
-		ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PING_ADDR);
-	writel(in->awbBuffer[1],
-		ctrl->vfebase + VFE_BUS_STATS_AWB_WR_PONG_ADDR);
-	writel(in->histBuffer[0],
-		ctrl->vfebase + VFE_BUS_STATS_HIST_WR_PING_ADDR);
-	writel(in->histBuffer[1],
-		ctrl->vfebase + VFE_BUS_STATS_HIST_WR_PONG_ADDR);
-}
-
-void vfe_axi_input_config(struct vfe_cmd_axi_input_config *in)
-{
-	struct VFE_AxiInputCmdType cmd;
-	uint32_t xSizeWord, axiRdUnpackPattern;
-	uint8_t  axiInputPpw;
-	uint32_t busPingpongRdIrqEnable;
-
-	ctrl->vfeImaskLocal.rdPingpongIrq = TRUE;
-
-	switch (in->pixelSize) {
-	case VFE_RAW_PIXEL_DATA_SIZE_10BIT:
-		ctrl->axiInputDataSize = VFE_RAW_PIXEL_DATA_SIZE_10BIT;
-		break;
-
-	case VFE_RAW_PIXEL_DATA_SIZE_12BIT:
-		ctrl->axiInputDataSize = VFE_RAW_PIXEL_DATA_SIZE_12BIT;
-		break;
-
-	case VFE_RAW_PIXEL_DATA_SIZE_8BIT:
-	default:
-		ctrl->axiInputDataSize = VFE_RAW_PIXEL_DATA_SIZE_8BIT;
-		break;
-	}
-
-	memset(&cmd, 0, sizeof(cmd));
-
-	switch (in->pixelSize) {
-	case VFE_RAW_PIXEL_DATA_SIZE_10BIT:
-		axiInputPpw = 6;
-		axiRdUnpackPattern = 0xD43210;
-		break;
-
-	case VFE_RAW_PIXEL_DATA_SIZE_12BIT:
-		axiInputPpw = 5;
-		axiRdUnpackPattern = 0xC3210;
-		break;
-
-	case VFE_RAW_PIXEL_DATA_SIZE_8BIT:
-	default:
-		axiInputPpw = 8;
-		axiRdUnpackPattern = 0xF6543210;
-		break;
-	}
-
-	xSizeWord =
-		((((in->xOffset % axiInputPpw) + in->xSize) +
-			(axiInputPpw-1)) / axiInputPpw) - 1;
-
-	cmd.stripeStartAddr0  = in->fragAddr[0];
-	cmd.stripeStartAddr1  = in->fragAddr[1];
-	cmd.stripeStartAddr2  = in->fragAddr[2];
-	cmd.stripeStartAddr3  = in->fragAddr[3];
-	cmd.ySize             = in->ySize;
-	cmd.yOffsetDelta      = 0;
-	cmd.xSizeWord         = xSizeWord;
-	cmd.burstLength       = 1;
-	cmd.NumOfRows         = in->numOfRows;
-	cmd.RowIncrement = (in->rowIncrement + (axiInputPpw - 1)) / axiInputPpw;
-	cmd.mainUnpackHeight  = in->ySize;
-	cmd.mainUnpackWidth   = in->xSize - 1;
-	cmd.mainUnpackHbiSel  = (uint32_t)in->unpackHbi;
-	cmd.mainUnpackPhase   = in->unpackPhase;
-	cmd.unpackPattern     = axiRdUnpackPattern;
-	cmd.padLeft           = in->padRepeatCountLeft;
-	cmd.padRight          = in->padRepeatCountRight;
-	cmd.padTop            = in->padRepeatCountTop;
-	cmd.padBottom         = in->padRepeatCountBottom;
-	cmd.leftUnpackPattern0   = in->padLeftComponentSelectCycle0;
-	cmd.leftUnpackPattern1   = in->padLeftComponentSelectCycle1;
-	cmd.leftUnpackPattern2   = in->padLeftComponentSelectCycle2;
-	cmd.leftUnpackPattern3   = in->padLeftComponentSelectCycle3;
-	cmd.leftUnpackStop0      = in->padLeftStopCycle0;
-	cmd.leftUnpackStop1      = in->padLeftStopCycle1;
-	cmd.leftUnpackStop2      = in->padLeftStopCycle2;
-	cmd.leftUnpackStop3      = in->padLeftStopCycle3;
-	cmd.rightUnpackPattern0  = in->padRightComponentSelectCycle0;
-	cmd.rightUnpackPattern1  = in->padRightComponentSelectCycle1;
-	cmd.rightUnpackPattern2  = in->padRightComponentSelectCycle2;
-	cmd.rightUnpackPattern3  = in->padRightComponentSelectCycle3;
-	cmd.rightUnpackStop0     = in->padRightStopCycle0;
-	cmd.rightUnpackStop1     = in->padRightStopCycle1;
-	cmd.rightUnpackStop2     = in->padRightStopCycle2;
-	cmd.rightUnpackStop3     = in->padRightStopCycle3;
-	cmd.topUnapckPattern     = in->padTopLineCount;
-	cmd.bottomUnapckPattern  = in->padBottomLineCount;
-
-	/*  program vfe_bus_cfg */
-	vfe_prog_hw(ctrl->vfebase + VFE_BUS_STRIPE_RD_ADDR_0,
-		(uint32_t *)&cmd, sizeof(cmd));
-
-	/* hacking code, put it to default value */
-	busPingpongRdIrqEnable = 0xf;
-
-	writel(busPingpongRdIrqEnable, ctrl->vfebase + VFE_BUS_PINGPONG_IRQ_EN);
-}
-
-void vfe_axi_output_config(struct vfe_cmd_axi_output_config *in)
-{
-	/* local variable  */
-	uint32_t *pcircle;
-	uint32_t *pdest;
-	uint32_t *psrc;
-	uint8_t  i;
-	uint8_t  fcnt;
-	uint16_t axioutpw = 8;
-
-	/* parameters check, condition and usage mode check */
-	ctrl->encPath.fragCount = in->output2.fragmentCount;
-	if (ctrl->encPath.fragCount > 1)
-		ctrl->encPath.multiFrag = TRUE;
-
-	ctrl->viewPath.fragCount = in->output1.fragmentCount;
-	if (ctrl->viewPath.fragCount > 1)
-		ctrl->viewPath.multiFrag = TRUE;
-
-	/* VFE_BUS_CFG.  raw data size */
-	ctrl->vfeBusConfigLocal.rawPixelDataSize = in->outputDataSize;
-
-	switch (in->outputDataSize) {
-	case VFE_RAW_PIXEL_DATA_SIZE_8BIT:
-		axioutpw = 8;
-		break;
-
-	case VFE_RAW_PIXEL_DATA_SIZE_10BIT:
-		axioutpw = 6;
-		break;
-
-	case VFE_RAW_PIXEL_DATA_SIZE_12BIT:
-		axioutpw = 5;
-		break;
-	}
-
-	ctrl->axiOutputMode = in->outputMode;
-
-	CDBG("axiOutputMode = %d\n", ctrl->axiOutputMode);
-
-	switch (ctrl->axiOutputMode) {
-	case VFE_AXI_OUTPUT_MODE_Output1: {
-		ctrl->vfeCamifConfigLocal.camif2BusEnable   = FALSE;
-		ctrl->vfeCamifConfigLocal.camif2OutputEnable = TRUE;
-		ctrl->vfeBusConfigLocal.rawWritePathSelect  =
-			VFE_RAW_OUTPUT_DISABLED;
-
-		ctrl->encPath.pathEnabled                   = FALSE;
-		ctrl->vfeImaskLocal.encIrq                  = FALSE;
-		ctrl->vfeIrqCompositeMaskLocal.encIrqComMask =
-			VFE_COMP_IRQ_BOTH_Y_CBCR;
-
-		ctrl->vfeBusConfigLocal.encYWrPathEn          = FALSE;
-		ctrl->vfeBusConfigLocal.encCbcrWrPathEn       = FALSE;
-		ctrl->viewPath.pathEnabled                    = TRUE;
-		ctrl->vfeImaskLocal.viewIrq                   = TRUE;
-		ctrl->vfeIrqCompositeMaskLocal.viewIrqComMask =
-			VFE_COMP_IRQ_BOTH_Y_CBCR;
-
-		ctrl->vfeBusConfigLocal.viewYWrPathEn    = TRUE;
-		ctrl->vfeBusConfigLocal.viewCbcrWrPathEn = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.encYWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encYPingpongIrq    = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.encCbcrWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encCbcrPingpongIrq = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewYWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewYPingpongIrq   = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewCbcrWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewCbcrPingpongIrq = TRUE;
-	} /* VFE_AXI_OUTPUT_MODE_Output1 */
-		break;
-
-	case VFE_AXI_OUTPUT_MODE_Output2: {
-		ctrl->vfeCamifConfigLocal.camif2BusEnable   = FALSE;
-		ctrl->vfeCamifConfigLocal.camif2OutputEnable = TRUE;
-		ctrl->vfeBusConfigLocal.rawWritePathSelect  =
-			VFE_RAW_OUTPUT_DISABLED;
-
-		ctrl->encPath.pathEnabled                   = TRUE;
-		ctrl->vfeImaskLocal.encIrq                  = TRUE;
-		ctrl->vfeIrqCompositeMaskLocal.encIrqComMask =
-			VFE_COMP_IRQ_BOTH_Y_CBCR;
-
-		ctrl->vfeBusConfigLocal.encYWrPathEn        = TRUE;
-		ctrl->vfeBusConfigLocal.encCbcrWrPathEn     = TRUE;
-
-		ctrl->viewPath.pathEnabled                   = FALSE;
-		ctrl->vfeImaskLocal.viewIrq                  = FALSE;
-		ctrl->vfeIrqCompositeMaskLocal.viewIrqComMask =
-			VFE_COMP_IRQ_BOTH_Y_CBCR;
-
-		ctrl->vfeBusConfigLocal.viewYWrPathEn        = FALSE;
-		ctrl->vfeBusConfigLocal.viewCbcrWrPathEn     = FALSE;
-
-		if (ctrl->vfeBusConfigLocal.encYWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encYPingpongIrq    = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.encCbcrWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encCbcrPingpongIrq = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewYWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewYPingpongIrq   = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewCbcrWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewCbcrPingpongIrq = TRUE;
-	} /* VFE_AXI_OUTPUT_MODE_Output2 */
-			break;
-
-	case VFE_AXI_OUTPUT_MODE_Output1AndOutput2: {
-		ctrl->vfeCamifConfigLocal.camif2BusEnable    = FALSE;
-		ctrl->vfeCamifConfigLocal.camif2OutputEnable = TRUE;
-		ctrl->vfeBusConfigLocal.rawWritePathSelect   =
-			VFE_RAW_OUTPUT_DISABLED;
-
-		ctrl->encPath.pathEnabled                    = TRUE;
-		ctrl->vfeImaskLocal.encIrq                   = TRUE;
-		ctrl->vfeIrqCompositeMaskLocal.encIrqComMask =
-			VFE_COMP_IRQ_BOTH_Y_CBCR;
-
-		ctrl->vfeBusConfigLocal.encYWrPathEn         = TRUE;
-		ctrl->vfeBusConfigLocal.encCbcrWrPathEn      = TRUE;
-		ctrl->viewPath.pathEnabled                   = TRUE;
-		ctrl->vfeImaskLocal.viewIrq                  = TRUE;
-		ctrl->vfeIrqCompositeMaskLocal.viewIrqComMask =
-			VFE_COMP_IRQ_BOTH_Y_CBCR;
-
-		ctrl->vfeBusConfigLocal.viewYWrPathEn        = TRUE;
-		ctrl->vfeBusConfigLocal.viewCbcrWrPathEn     = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.encYWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encYPingpongIrq    = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.encCbcrWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encCbcrPingpongIrq = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewYWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewYPingpongIrq   = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewCbcrWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewCbcrPingpongIrq = TRUE;
-	} /* VFE_AXI_OUTPUT_MODE_Output1AndOutput2 */
-		break;
-
-	case VFE_AXI_OUTPUT_MODE_CAMIFToAXIViaOutput2: {
-		/* For raw snapshot, we need both ping and pong buffer
-		 * initialized to the same address. Otherwise, if we
-		 * leave the pong buffer to NULL, there will be axi_error.
-		 * Note that ideally we should deal with this at upper layer,
-		 * which is in msm_vfe8x.c */
-		if (!in->output2.outputCbcr.outFragments[1][0]) {
-			in->output2.outputCbcr.outFragments[1][0] =
-				in->output2.outputCbcr.outFragments[0][0];
-		}
-
-		ctrl->vfeCamifConfigLocal.camif2BusEnable   = TRUE;
-		ctrl->vfeCamifConfigLocal.camif2OutputEnable = FALSE;
-		ctrl->vfeBusConfigLocal.rawWritePathSelect  =
-			VFE_RAW_OUTPUT_ENC_CBCR_PATH;
-
-		ctrl->encPath.pathEnabled                   = TRUE;
-		ctrl->vfeImaskLocal.encIrq                  = TRUE;
-		ctrl->vfeIrqCompositeMaskLocal.encIrqComMask =
-			VFE_COMP_IRQ_CBCR_ONLY;
-
-		ctrl->vfeBusConfigLocal.encYWrPathEn        = FALSE;
-		ctrl->vfeBusConfigLocal.encCbcrWrPathEn     = TRUE;
-
-		ctrl->viewPath.pathEnabled                   = FALSE;
-		ctrl->vfeImaskLocal.viewIrq                  = FALSE;
-		ctrl->vfeIrqCompositeMaskLocal.viewIrqComMask =
-			VFE_COMP_IRQ_BOTH_Y_CBCR;
-
-		ctrl->vfeBusConfigLocal.viewYWrPathEn        = FALSE;
-		ctrl->vfeBusConfigLocal.viewCbcrWrPathEn     = FALSE;
-
-		if (ctrl->vfeBusConfigLocal.encYWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encYPingpongIrq    = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.encCbcrWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encCbcrPingpongIrq = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewYWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewYPingpongIrq   = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewCbcrWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewCbcrPingpongIrq = TRUE;
-	} /* VFE_AXI_OUTPUT_MODE_CAMIFToAXIViaOutput2 */
-		break;
-
-	case VFE_AXI_OUTPUT_MODE_Output2AndCAMIFToAXIViaOutput1: {
-		ctrl->vfeCamifConfigLocal.camif2BusEnable   = TRUE;
-		ctrl->vfeCamifConfigLocal.camif2OutputEnable = TRUE;
-		ctrl->vfeBusConfigLocal.rawWritePathSelect  =
-			VFE_RAW_OUTPUT_VIEW_CBCR_PATH;
-
-		ctrl->encPath.pathEnabled                   = TRUE;
-		ctrl->vfeImaskLocal.encIrq                  = TRUE;
-		ctrl->vfeIrqCompositeMaskLocal.encIrqComMask =
-			VFE_COMP_IRQ_BOTH_Y_CBCR;
-
-		ctrl->vfeBusConfigLocal.encYWrPathEn        = TRUE;
-		ctrl->vfeBusConfigLocal.encCbcrWrPathEn     = TRUE;
-
-		ctrl->viewPath.pathEnabled                   = TRUE;
-		ctrl->vfeImaskLocal.viewIrq                  = TRUE;
-		ctrl->vfeIrqCompositeMaskLocal.viewIrqComMask =
-			VFE_COMP_IRQ_CBCR_ONLY;
-
-		ctrl->vfeBusConfigLocal.viewYWrPathEn        = FALSE;
-		ctrl->vfeBusConfigLocal.viewCbcrWrPathEn     = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.encYWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encYPingpongIrq    = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.encCbcrWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encCbcrPingpongIrq = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewYWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewYPingpongIrq   = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewCbcrWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewCbcrPingpongIrq = TRUE;
-	} /* VFE_AXI_OUTPUT_MODE_Output2AndCAMIFToAXIViaOutput1 */
-		break;
-
-	case VFE_AXI_OUTPUT_MODE_Output1AndCAMIFToAXIViaOutput2: {
-		ctrl->vfeCamifConfigLocal.camif2BusEnable   = TRUE;
-		ctrl->vfeCamifConfigLocal.camif2OutputEnable = TRUE;
-		ctrl->vfeBusConfigLocal.rawWritePathSelect  =
-			VFE_RAW_OUTPUT_ENC_CBCR_PATH;
-
-		ctrl->encPath.pathEnabled                     = TRUE;
-		ctrl->vfeImaskLocal.encIrq                    = TRUE;
-		ctrl->vfeIrqCompositeMaskLocal.encIrqComMask  =
-			VFE_COMP_IRQ_CBCR_ONLY;
-
-		ctrl->vfeBusConfigLocal.encYWrPathEn          = FALSE;
-		ctrl->vfeBusConfigLocal.encCbcrWrPathEn       = TRUE;
-
-		ctrl->viewPath.pathEnabled                    = TRUE;
-		ctrl->vfeImaskLocal.viewIrq                   = TRUE;
-
-		ctrl->vfeIrqCompositeMaskLocal.viewIrqComMask =
-			VFE_COMP_IRQ_BOTH_Y_CBCR;
-
-		ctrl->vfeBusConfigLocal.viewYWrPathEn         = TRUE;
-		ctrl->vfeBusConfigLocal.viewCbcrWrPathEn      = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.encYWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encYPingpongIrq       = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.encCbcrWrPathEn &&
-				ctrl->encPath.multiFrag)
-			ctrl->vfeImaskLocal.encCbcrPingpongIrq    = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewYWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewYPingpongIrq      = TRUE;
-
-		if (ctrl->vfeBusConfigLocal.viewCbcrWrPathEn &&
-				ctrl->viewPath.multiFrag)
-			ctrl->vfeImaskLocal.viewCbcrPingpongIrq   = TRUE;
-	} /* VFE_AXI_OUTPUT_MODE_Output1AndCAMIFToAXIViaOutput2 */
-		break;
-
-	case VFE_AXI_LAST_OUTPUT_MODE_ENUM:
-		break;
-	} /* switch */
-
-	/* Save the addresses for each path. */
-	/* output2 path */
-	fcnt = ctrl->encPath.fragCount;
-
-	pcircle = ctrl->encPath.yPath.addressBuffer;
-	pdest = ctrl->encPath.nextFrameAddrBuf;
-
-	psrc = &(in->output2.outputY.outFragments[0][0]);
-	for (i = 0; i < fcnt; i++)
-		*pcircle++ = *psrc++;
-
-	psrc = &(in->output2.outputY.outFragments[1][0]);
-	for (i = 0; i < fcnt; i++)
-		*pcircle++ = *psrc++;
-
-	psrc = &(in->output2.outputY.outFragments[2][0]);
-	for (i = 0; i < fcnt; i++)
-		*pdest++ = *psrc++;
-
-	pcircle = ctrl->encPath.cbcrPath.addressBuffer;
-
-	psrc = &(in->output2.outputCbcr.outFragments[0][0]);
-	for (i = 0; i < fcnt; i++)
-		*pcircle++ = *psrc++;
-
-	psrc = &(in->output2.outputCbcr.outFragments[1][0]);
-	for (i = 0; i < fcnt; i++)
-		*pcircle++ = *psrc++;
-
-	psrc = &(in->output2.outputCbcr.outFragments[2][0]);
-	for (i = 0; i < fcnt; i++)
-		*pdest++ = *psrc++;
-
-	vfe_set_bus_pipo_addr(&ctrl->viewPath, &ctrl->encPath);
-
-	ctrl->encPath.ackPending = FALSE;
-	ctrl->encPath.currentFrame = ping;
-	ctrl->encPath.whichOutputPath = 1;
-	ctrl->encPath.yPath.fragIndex = 2;
-	ctrl->encPath.cbcrPath.fragIndex = 2;
-	ctrl->encPath.yPath.hwCurrentFlag = ping;
-	ctrl->encPath.cbcrPath.hwCurrentFlag = ping;
-
-	/* output1 path */
-	pcircle = ctrl->viewPath.yPath.addressBuffer;
-	pdest = ctrl->viewPath.nextFrameAddrBuf;
-	fcnt = ctrl->viewPath.fragCount;
-
-	psrc = &(in->output1.outputY.outFragments[0][0]);
-	for (i = 0; i < fcnt; i++)
-		*pcircle++ = *psrc++;
-
-	psrc = &(in->output1.outputY.outFragments[1][0]);
-	for (i = 0; i < fcnt; i++)
-		*pcircle++ = *psrc++;
-
-	psrc = &(in->output1.outputY.outFragments[2][0]);
-	for (i = 0; i < fcnt; i++)
-		*pdest++ = *psrc++;
-
-	pcircle = ctrl->viewPath.cbcrPath.addressBuffer;
-
-	psrc = &(in->output1.outputCbcr.outFragments[0][0]);
-	for (i = 0; i < fcnt; i++)
-		*pcircle++ = *psrc++;
-
-	psrc = &(in->output1.outputCbcr.outFragments[1][0]);
-	for (i = 0; i < fcnt; i++)
-		*pcircle++ = *psrc++;
-
-	psrc = &(in->output1.outputCbcr.outFragments[2][0]);
-	for (i = 0; i < fcnt; i++)
-		*pdest++ = *psrc++;
-
-	ctrl->viewPath.ackPending = FALSE;
-	ctrl->viewPath.currentFrame = ping;
-	ctrl->viewPath.whichOutputPath = 0;
-	ctrl->viewPath.yPath.fragIndex = 2;
-	ctrl->viewPath.cbcrPath.fragIndex = 2;
-	ctrl->viewPath.yPath.hwCurrentFlag = ping;
-	ctrl->viewPath.cbcrPath.hwCurrentFlag = ping;
-
-	/* call to program the registers. */
-	vfe_axi_output(in, &ctrl->viewPath, &ctrl->encPath, axioutpw);
-}
-
-void vfe_camif_config(struct vfe_cmd_camif_config *in)
-{
-	struct vfe_camifcfg cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	CDBG("camif.frame pixelsPerLine = %d\n", in->frame.pixelsPerLine);
-	CDBG("camif.frame linesPerFrame = %d\n", in->frame.linesPerFrame);
-	CDBG("camif.window firstpixel = %d\n", in->window.firstpixel);
-	CDBG("camif.window lastpixel = %d\n",  in->window.lastpixel);
-	CDBG("camif.window firstline = %d\n",  in->window.firstline);
-	CDBG("camif.window lastline = %d\n",   in->window.lastline);
-
-	/* determine if epoch interrupt needs to be enabled.  */
-	if ((in->epoch1.enable == TRUE) &&
-	    (in->epoch1.lineindex <= in->frame.linesPerFrame))
-		ctrl->vfeImaskLocal.camifEpoch1Irq = 1;
-
-	if ((in->epoch2.enable == TRUE) &&
-	    (in->epoch2.lineindex <= in->frame.linesPerFrame)) {
-		ctrl->vfeImaskLocal.camifEpoch2Irq = 1;
-	}
-
-	/*  save the content to program CAMIF_CONFIG seperately. */
-	ctrl->vfeCamifConfigLocal.camifCfgFromCmd = in->camifConfig;
-
-	/* EFS_Config */
-	cmd.efsEndOfLine     = in->EFS.efsendofline;
-	cmd.efsStartOfLine   = in->EFS.efsstartofline;
-	cmd.efsEndOfFrame    = in->EFS.efsendofframe;
-	cmd.efsStartOfFrame  = in->EFS.efsstartofframe;
-
-	/* Frame Config */
-	cmd.frameConfigPixelsPerLine = in->frame.pixelsPerLine;
-	cmd.frameConfigLinesPerFrame = in->frame.linesPerFrame;
-
-	/* Window Width Config */
-	cmd.windowWidthCfgLastPixel  = in->window.lastpixel;
-	cmd.windowWidthCfgFirstPixel = in->window.firstpixel;
-
-	/* Window Height Config */
-	cmd.windowHeightCfglastLine   = in->window.lastline;
-	cmd.windowHeightCfgfirstLine  = in->window.firstline;
-
-	/* Subsample 1 Config */
-	cmd.subsample1CfgPixelSkip = in->subsample.pixelskipmask;
-	cmd.subsample1CfgLineSkip  = in->subsample.lineskipmask;
-
-	/* Subsample 2 Config */
-	cmd.subsample2CfgFrameSkip      = in->subsample.frameskip;
-	cmd.subsample2CfgFrameSkipMode  = in->subsample.frameskipmode;
-	cmd.subsample2CfgPixelSkipWrap  = in->subsample.pixelskipwrap;
-
-	/* Epoch Interrupt */
-	cmd.epoch1Line = in->epoch1.lineindex;
-	cmd.epoch2Line = in->epoch2.lineindex;
-
-	vfe_prog_hw(ctrl->vfebase + CAMIF_EFS_CONFIG,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_fov_crop_config(struct vfe_cmd_fov_crop_config *in)
-{
-	struct vfe_fov_crop_cfg cmd;
-	memset(&cmd, 0, sizeof(cmd));
-
-	ctrl->vfeModuleEnableLocal.cropEnable = in->enable;
-
-	/* FOV Corp, Part 1 */
-	cmd.lastPixel  = in->lastPixel;
-	cmd.firstPixel = in->firstPixel;
-
-	/* FOV Corp, Part 2 */
-	cmd.lastLine   = in->lastLine;
-	cmd.firstLine  = in->firstLine;
-
-	vfe_prog_hw(ctrl->vfebase + VFE_CROP_WIDTH_CFG,
-		(uint32_t *)&cmd, sizeof(cmd));
-}
-
-void vfe_get_hw_version(struct vfe_cmd_hw_version *out)
-{
-	uint32_t vfeHwVersionPacked;
-	struct vfe_hw_ver ver;
-
-	vfeHwVersionPacked = readl(ctrl->vfebase + VFE_HW_VERSION);
-
-	ver = *((struct vfe_hw_ver *)&vfeHwVersionPacked);
-
-	out->coreVersion  = ver.coreVersion;
-	out->minorVersion = ver.minorVersion;
-	out->majorVersion = ver.majorVersion;
-}
-
-static void vfe_reset_internal_variables(void)
-{
-	/* local variables to program the hardware. */
-	ctrl->vfeImaskPacked = 0;
-	ctrl->vfeImaskCompositePacked = 0;
-
-	/* FALSE = disable,  1 = enable. */
-	memset(&ctrl->vfeModuleEnableLocal, 0,
-		sizeof(ctrl->vfeModuleEnableLocal));
-
-	/* 0 = disable, 1 = enable */
-	memset(&ctrl->vfeCamifConfigLocal, 0,
-		sizeof(ctrl->vfeCamifConfigLocal));
-	/* 0 = disable, 1 = enable */
-	memset(&ctrl->vfeImaskLocal, 0, sizeof(ctrl->vfeImaskLocal));
-	memset(&ctrl->vfeStatsCmdLocal, 0, sizeof(ctrl->vfeStatsCmdLocal));
-	memset(&ctrl->vfeBusConfigLocal, 0, sizeof(ctrl->vfeBusConfigLocal));
-	memset(&ctrl->vfeBusPmConfigLocal, 0,
-		sizeof(ctrl->vfeBusPmConfigLocal));
-	memset(&ctrl->vfeBusCmdLocal, 0, sizeof(ctrl->vfeBusCmdLocal));
-	memset(&ctrl->vfeInterruptNameLocal, 0,
-		sizeof(ctrl->vfeInterruptNameLocal));
-	memset(&ctrl->vfeDroppedFrameCounts, 0,
-		sizeof(ctrl->vfeDroppedFrameCounts));
-	memset(&ctrl->vfeIrqThreadMsgLocal, 0,
-		sizeof(ctrl->vfeIrqThreadMsgLocal));
-
-	/* state control variables */
-	ctrl->vfeStartAckPendingFlag = FALSE;
-	ctrl->vfeStopAckPending = FALSE;
-	ctrl->vfeIrqCompositeMaskLocal.ceDoneSel = 0;
-	ctrl->vfeIrqCompositeMaskLocal.encIrqComMask = VFE_COMP_IRQ_BOTH_Y_CBCR;
-	ctrl->vfeIrqCompositeMaskLocal.viewIrqComMask =
-		VFE_COMP_IRQ_BOTH_Y_CBCR;
-
-	ctrl->vstate = VFE_STATE_IDLE;
-
-	ctrl->axiOutputMode = VFE_AXI_LAST_OUTPUT_MODE_ENUM;
-	/* 0 for continuous mode, 1 for snapshot mode */
-	ctrl->vfeOperationMode = VFE_START_OPERATION_MODE_CONTINUOUS;
-	ctrl->vfeSnapShotCount = 0;
-	ctrl->vfeStatsPingPongReloadFlag = FALSE;
-	/* this is unsigned 32 bit integer. */
-	ctrl->vfeFrameId = 0;
-	ctrl->vfeFrameSkip.output1Pattern = 0xffffffff;
-	ctrl->vfeFrameSkip.output1Period  = 31;
-	ctrl->vfeFrameSkip.output2Pattern = 0xffffffff;
-	ctrl->vfeFrameSkip.output2Period  = 31;
-	ctrl->vfeFrameSkipPattern = 0xffffffff;
-	ctrl->vfeFrameSkipCount   = 0;
-	ctrl->vfeFrameSkipPeriod  = 31;
-
-	memset((void *)&ctrl->encPath, 0, sizeof(ctrl->encPath));
-	memset((void *)&ctrl->viewPath, 0, sizeof(ctrl->viewPath));
-
-	ctrl->encPath.whichOutputPath  = 1;
-	ctrl->encPath.cbcrStatusBit    = 5;
-	ctrl->viewPath.whichOutputPath = 0;
-	ctrl->viewPath.cbcrStatusBit   = 7;
-
-	ctrl->vfeTestGenStartFlag = FALSE;
-
-	/* default to bank 0. */
-	ctrl->vfeLaBankSel = 0;
-
-	/* default to bank 0 for all channels. */
-	memset(&ctrl->vfeGammaLutSel, 0, sizeof(ctrl->vfeGammaLutSel));
-
-	/* Stats control variables. */
-	memset(&ctrl->afStatsControl, 0, sizeof(ctrl->afStatsControl));
-	memset(&ctrl->awbStatsControl, 0, sizeof(ctrl->awbStatsControl));
-	vfe_set_stats_pingpong_address(&ctrl->afStatsControl,
-		&ctrl->awbStatsControl);
-}
-
-void vfe_reset(void)
-{
-	spin_lock_init(&msm_vfe_ctrl_lock);
-	vfe_reset_internal_variables();
-
-	atomic_set(&ctrl->vfe_serv_interrupt, 1);
-	ctrl->vfeImaskLocal.resetAckIrq = TRUE;
-	ctrl->vfeImaskPacked = vfe_irq_pack(ctrl->vfeImaskLocal);
-
-	/* disable all interrupts. */
-	writel(VFE_DISABLE_ALL_IRQS, ctrl->vfebase + VFE_IRQ_COMPOSITE_MASK);
-
-	/* clear all pending interrupts*/
-	writel(VFE_CLEAR_ALL_IRQS, ctrl->vfebase + VFE_IRQ_CLEAR);
-
-	/* enable reset_ack interrupt.  */
-	writel(ctrl->vfeImaskPacked, ctrl->vfebase + VFE_IRQ_MASK);
-
-	writel(VFE_RESET_UPON_RESET_CMD, ctrl->vfebase + VFE_GLOBAL_RESET_CMD);
-}
diff --git a/drivers/media/video/msm/vfe/msm_vfe8x_proc.h b/drivers/media/video/msm/vfe/msm_vfe8x_proc.h
deleted file mode 100644
index 4e18c7c..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe8x_proc.h
+++ /dev/null
@@ -1,1563 +0,0 @@
-/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MSM_VFE8X_REG_H__
-#define __MSM_VFE8X_REG_H__
-
-#include <mach/msm_iomap.h>
-#include <mach/camera.h>
-#include "msm_vfe8x.h"
-
-
-#define MSM_AXI_QOS_PREVIEW		128000
-#define MSM_AXI_QOS_SNAPSHOT	128000
-#define MSM_AXI_QOS_RECORDING	128000
-
-
-/* at start of camif,  bit 1:0 = 0x01:enable
- * image data capture at frame boundary. */
-#define CAMIF_COMMAND_START  0x00000005
-
-/* bit 2= 0x1:clear the CAMIF_STATUS register
- * value. */
-#define CAMIF_COMMAND_CLEAR  0x00000004
-
-/* at stop of vfe pipeline, for now it is assumed
- * that camif will stop at any time. Bit 1:0 = 0x10:
- * disable image data capture immediately. */
-#define CAMIF_COMMAND_STOP_IMMEDIATELY  0x00000002
-
-/* at stop of vfe pipeline, for now it is assumed
- * that camif will stop at any time. Bit 1:0 = 0x00:
- * disable image data capture at frame boundary */
-#define CAMIF_COMMAND_STOP_AT_FRAME_BOUNDARY  0x00000000
-
-/* to halt axi bridge */
-#define AXI_HALT  0x00000001
-
-/* clear the halt bit. */
-#define AXI_HALT_CLEAR  0x00000000
-
-/* reset the pipeline when stop command is issued.
- * (without reset the register.) bit 26-31 = 0,
- * domain reset, bit 0-9 = 1 for module reset, except
- * register module. */
-#define VFE_RESET_UPON_STOP_CMD  0x000003ef
-
-/* reset the pipeline when reset command.
- * bit 26-31 = 0, domain reset, bit 0-9 = 1 for module reset. */
-#define VFE_RESET_UPON_RESET_CMD  0x000003ff
-
-/* bit 5 is for axi status idle or busy.
- * 1 =  halted,  0 = busy */
-#define AXI_STATUS_BUSY_MASK 0x00000020
-
-/* bit 0 & bit 1 = 1, both y and cbcr irqs need to be present
- * for frame done interrupt */
-#define VFE_COMP_IRQ_BOTH_Y_CBCR 3
-
-/* bit 1 = 1, only cbcr irq triggers frame done interrupt */
-#define VFE_COMP_IRQ_CBCR_ONLY 2
-
-/* bit 0 = 1, only y irq triggers frame done interrupt */
-#define VFE_COMP_IRQ_Y_ONLY 1
-
-/* bit 0 = 1, PM go;   bit1 = 1, PM stop */
-#define VFE_PERFORMANCE_MONITOR_GO   0x00000001
-#define VFE_PERFORMANCE_MONITOR_STOP 0x00000002
-
-/* bit 0 = 1, test gen go;   bit1 = 1, test gen stop */
-#define VFE_TEST_GEN_GO   0x00000001
-#define VFE_TEST_GEN_STOP 0x00000002
-
-/* the chroma is assumed to be interpolated between
- * the luma samples.  JPEG 4:2:2 */
-#define VFE_CHROMA_UPSAMPLE_INTERPOLATED 0
-
-/* constants for irq registers */
-#define VFE_DISABLE_ALL_IRQS 0
-/* bit =1 is to clear the corresponding bit in VFE_IRQ_STATUS.  */
-#define VFE_CLEAR_ALL_IRQS   0xffffffff
-/* imask for while waiting for stop ack,  driver has already
- * requested stop, waiting for reset irq,
- * bit 29,28,27,26 for async timer, bit 9 for reset */
-#define VFE_IMASK_WHILE_STOPPING  0x3c000200
-
-/* when normal case, don't want to block error status.
- * bit 0,6,20,21,22,30,31 */
-#define VFE_IMASK_ERROR_ONLY             0xC0700041
-#define VFE_REG_UPDATE_TRIGGER           1
-#define VFE_PM_BUF_MAX_CNT_MASK          0xFF
-#define VFE_DMI_CFG_DEFAULT              0x00000100
-#define LENS_ROLL_OFF_DELTA_TABLE_OFFSET 32
-#define VFE_AF_PINGPONG_STATUS_BIT       0x100
-#define VFE_AWB_PINGPONG_STATUS_BIT      0x200
-
-/* VFE I/O registers */
-enum {
-	VFE_HW_VERSION                    = 0x00000000,
-	VFE_GLOBAL_RESET_CMD              = 0x00000004,
-	VFE_MODULE_RESET                  = 0x00000008,
-	VFE_CGC_OVERRIDE                  = 0x0000000C,
-	VFE_MODULE_CFG                    = 0x00000010,
-	VFE_CFG                           = 0x00000014,
-	VFE_IRQ_MASK                      = 0x00000018,
-	VFE_IRQ_CLEAR                     = 0x0000001C,
-VFE_IRQ_STATUS                    = 0x00000020,
-VFE_IRQ_COMPOSITE_MASK            = 0x00000024,
-VFE_BUS_CMD                       = 0x00000028,
-VFE_BUS_CFG                       = 0x0000002C,
-VFE_BUS_ENC_Y_WR_PING_ADDR        = 0x00000030,
-VFE_BUS_ENC_Y_WR_PONG_ADDR        = 0x00000034,
-VFE_BUS_ENC_Y_WR_IMAGE_SIZE       = 0x00000038,
-VFE_BUS_ENC_Y_WR_BUFFER_CFG       = 0x0000003C,
-VFE_BUS_ENC_CBCR_WR_PING_ADDR     = 0x00000040,
-VFE_BUS_ENC_CBCR_WR_PONG_ADDR     = 0x00000044,
-VFE_BUS_ENC_CBCR_WR_IMAGE_SIZE    = 0x00000048,
-VFE_BUS_ENC_CBCR_WR_BUFFER_CFG    = 0x0000004C,
-VFE_BUS_VIEW_Y_WR_PING_ADDR       = 0x00000050,
-VFE_BUS_VIEW_Y_WR_PONG_ADDR       = 0x00000054,
-VFE_BUS_VIEW_Y_WR_IMAGE_SIZE      = 0x00000058,
-VFE_BUS_VIEW_Y_WR_BUFFER_CFG      = 0x0000005C,
-VFE_BUS_VIEW_CBCR_WR_PING_ADDR    = 0x00000060,
-VFE_BUS_VIEW_CBCR_WR_PONG_ADDR    = 0x00000064,
-VFE_BUS_VIEW_CBCR_WR_IMAGE_SIZE   = 0x00000068,
-VFE_BUS_VIEW_CBCR_WR_BUFFER_CFG   = 0x0000006C,
-VFE_BUS_STATS_AF_WR_PING_ADDR     = 0x00000070,
-VFE_BUS_STATS_AF_WR_PONG_ADDR     = 0x00000074,
-VFE_BUS_STATS_AWB_WR_PING_ADDR    = 0x00000078,
-VFE_BUS_STATS_AWB_WR_PONG_ADDR    = 0x0000007C,
-VFE_BUS_STATS_HIST_WR_PING_ADDR   = 0x00000080,
-VFE_BUS_STATS_HIST_WR_PONG_ADDR   = 0x00000084,
-VFE_BUS_STATS_WR_PRIORITY         = 0x00000088,
-VFE_BUS_STRIPE_RD_ADDR_0          = 0x0000008C,
-VFE_BUS_STRIPE_RD_ADDR_1          = 0x00000090,
-VFE_BUS_STRIPE_RD_ADDR_2          = 0x00000094,
-VFE_BUS_STRIPE_RD_ADDR_3          = 0x00000098,
-VFE_BUS_STRIPE_RD_VSIZE           = 0x0000009C,
-VFE_BUS_STRIPE_RD_HSIZE           = 0x000000A0,
-VFE_BUS_STRIPE_RD_BUFFER_CFG      = 0x000000A4,
-VFE_BUS_STRIPE_RD_UNPACK_CFG      = 0x000000A8,
-VFE_BUS_STRIPE_RD_UNPACK          = 0x000000AC,
-VFE_BUS_STRIPE_RD_PAD_SIZE        = 0x000000B0,
-VFE_BUS_STRIPE_RD_PAD_L_UNPACK    = 0x000000B4,
-VFE_BUS_STRIPE_RD_PAD_R_UNPACK    = 0x000000B8,
-VFE_BUS_STRIPE_RD_PAD_TB_UNPACK   = 0x000000BC,
-VFE_BUS_PINGPONG_IRQ_EN           = 0x000000C0,
-VFE_BUS_PINGPONG_STATUS           = 0x000000C4,
-VFE_BUS_PM_CMD                    = 0x000000C8,
-VFE_BUS_PM_CFG                    = 0x000000CC,
-VFE_BUS_ENC_Y_WR_PM_STATS_0       = 0x000000D0,
-VFE_BUS_ENC_Y_WR_PM_STATS_1       = 0x000000D4,
-VFE_BUS_ENC_CBCR_WR_PM_STATS_0    = 0x000000D8,
-VFE_BUS_ENC_CBCR_WR_PM_STATS_1    = 0x000000DC,
-VFE_BUS_VIEW_Y_WR_PM_STATS_0      = 0x000000E0,
-VFE_BUS_VIEW_Y_WR_PM_STATS_1      = 0x000000E4,
-VFE_BUS_VIEW_CBCR_WR_PM_STATS_0   = 0x000000E8,
-VFE_BUS_VIEW_CBCR_WR_PM_STATS_1   = 0x000000EC,
-VFE_BUS_MISR_CFG                  = 0x000000F4,
-VFE_BUS_MISR_MAST_CFG_0           = 0x000000F8,
-VFE_BUS_MISR_MAST_CFG_1           = 0x000000FC,
-VFE_BUS_MISR_RD_VAL               = 0x00000100,
-VFE_AXI_CMD                       = 0x00000104,
-VFE_AXI_CFG                       = 0x00000108,
-VFE_AXI_STATUS                    = 0x0000010C,
-CAMIF_COMMAND                     = 0x00000110,
-CAMIF_CONFIG                      = 0x00000114,
-CAMIF_EFS_CONFIG                  = 0x00000118,
-CAMIF_FRAME_CONFIG                = 0x0000011C,
-CAMIF_WINDOW_WIDTH_CONFIG         = 0x00000120,
-CAMIF_WINDOW_HEIGHT_CONFIG        = 0x00000124,
-CAMIF_SUBSAMPLE1_CONFIG           = 0x00000128,
-CAMIF_SUBSAMPLE2_CONFIG           = 0x0000012C,
-CAMIF_EPOCH_IRQ                   = 0x00000130,
-CAMIF_STATUS                      = 0x00000134,
-CAMIF_MISR                        = 0x00000138,
-VFE_SYNC_TIMER_CMD                = 0x0000013C,
-VFE_SYNC_TIMER0_LINE_START        = 0x00000140,
-VFE_SYNC_TIMER0_PIXEL_START       = 0x00000144,
-VFE_SYNC_TIMER0_PIXEL_DURATION    = 0x00000148,
-VFE_SYNC_TIMER1_LINE_START        = 0x0000014C,
-VFE_SYNC_TIMER1_PIXEL_START       = 0x00000150,
-VFE_SYNC_TIMER1_PIXEL_DURATION    = 0x00000154,
-VFE_SYNC_TIMER2_LINE_START        = 0x00000158,
-VFE_SYNC_TIMER2_PIXEL_START       = 0x0000015C,
-VFE_SYNC_TIMER2_PIXEL_DURATION    = 0x00000160,
-VFE_SYNC_TIMER_POLARITY           = 0x00000164,
-VFE_ASYNC_TIMER_CMD               = 0x00000168,
-VFE_ASYNC_TIMER0_CFG_0            = 0x0000016C,
-VFE_ASYNC_TIMER0_CFG_1            = 0x00000170,
-VFE_ASYNC_TIMER1_CFG_0            = 0x00000174,
-VFE_ASYNC_TIMER1_CFG_1            = 0x00000178,
-VFE_ASYNC_TIMER2_CFG_0            = 0x0000017C,
-VFE_ASYNC_TIMER2_CFG_1            = 0x00000180,
-VFE_ASYNC_TIMER3_CFG_0            = 0x00000184,
-VFE_ASYNC_TIMER3_CFG_1            = 0x00000188,
-VFE_TIMER_SEL                     = 0x0000018C,
-VFE_REG_UPDATE_CMD                = 0x00000190,
-VFE_BLACK_EVEN_EVEN_VALUE         = 0x00000194,
-VFE_BLACK_EVEN_ODD_VALUE          = 0x00000198,
-VFE_BLACK_ODD_EVEN_VALUE          = 0x0000019C,
-VFE_BLACK_ODD_ODD_VALUE           = 0x000001A0,
-VFE_ROLLOFF_CFG_0                 = 0x000001A4,
-VFE_ROLLOFF_CFG_1                 = 0x000001A8,
-VFE_ROLLOFF_CFG_2                 = 0x000001AC,
-VFE_DEMUX_CFG                     = 0x000001B0,
-VFE_DEMUX_GAIN_0                  = 0x000001B4,
-VFE_DEMUX_GAIN_1                  = 0x000001B8,
-VFE_DEMUX_EVEN_CFG                = 0x000001BC,
-VFE_DEMUX_ODD_CFG                 = 0x000001C0,
-VFE_DEMOSAIC_CFG                  = 0x000001C4,
-VFE_DEMOSAIC_ABF_CFG_0            = 0x000001C8,
-VFE_DEMOSAIC_ABF_CFG_1            = 0x000001CC,
-VFE_DEMOSAIC_BPC_CFG_0            = 0x000001D0,
-VFE_DEMOSAIC_BPC_CFG_1            = 0x000001D4,
-VFE_DEMOSAIC_STATUS               = 0x000001D8,
-VFE_CHROMA_UPSAMPLE_CFG           = 0x000001DC,
-VFE_CROP_WIDTH_CFG                = 0x000001E0,
-VFE_CROP_HEIGHT_CFG               = 0x000001E4,
-VFE_COLOR_CORRECT_COEFF_0         = 0x000001E8,
-VFE_COLOR_CORRECT_COEFF_1         = 0x000001EC,
-VFE_COLOR_CORRECT_COEFF_2         = 0x000001F0,
-VFE_COLOR_CORRECT_COEFF_3         = 0x000001F4,
-VFE_COLOR_CORRECT_COEFF_4         = 0x000001F8,
-VFE_COLOR_CORRECT_COEFF_5         = 0x000001FC,
-VFE_COLOR_CORRECT_COEFF_6         = 0x00000200,
-VFE_COLOR_CORRECT_COEFF_7         = 0x00000204,
-VFE_COLOR_CORRECT_COEFF_8         = 0x00000208,
-VFE_COLOR_CORRECT_OFFSET_0        = 0x0000020C,
-VFE_COLOR_CORRECT_OFFSET_1        = 0x00000210,
-VFE_COLOR_CORRECT_OFFSET_2        = 0x00000214,
-VFE_COLOR_CORRECT_COEFF_Q         = 0x00000218,
-VFE_LA_CFG                        = 0x0000021C,
-VFE_LUT_BANK_SEL                  = 0x00000220,
-VFE_CHROMA_ENHAN_A                = 0x00000224,
-VFE_CHROMA_ENHAN_B                = 0x00000228,
-VFE_CHROMA_ENHAN_C                = 0x0000022C,
-VFE_CHROMA_ENHAN_D                = 0x00000230,
-VFE_CHROMA_ENHAN_K                = 0x00000234,
-VFE_COLOR_CONVERT_COEFF_0         = 0x00000238,
-VFE_COLOR_CONVERT_COEFF_1         = 0x0000023C,
-VFE_COLOR_CONVERT_COEFF_2         = 0x00000240,
-VFE_COLOR_CONVERT_OFFSET          = 0x00000244,
-VFE_ASF_CFG                       = 0x00000248,
-VFE_ASF_SHARP_CFG_0               = 0x0000024C,
-VFE_ASF_SHARP_CFG_1               = 0x00000250,
-VFE_ASF_SHARP_COEFF_0             = 0x00000254,
-VFE_ASF_SHARP_COEFF_1             = 0x00000258,
-VFE_ASF_SHARP_COEFF_2             = 0x0000025C,
-VFE_ASF_SHARP_COEFF_3             = 0x00000260,
-VFE_ASF_MAX_EDGE                  = 0x00000264,
-VFE_ASF_CROP_WIDTH_CFG            = 0x00000268,
-VFE_ASF_CROP_HEIGHT_CFG           = 0x0000026C,
-VFE_SCALE_CFG                     = 0x00000270,
-VFE_SCALE_H_IMAGE_SIZE_CFG        = 0x00000274,
-VFE_SCALE_H_PHASE_CFG             = 0x00000278,
-VFE_SCALE_H_STRIPE_CFG            = 0x0000027C,
-VFE_SCALE_V_IMAGE_SIZE_CFG        = 0x00000280,
-VFE_SCALE_V_PHASE_CFG             = 0x00000284,
-VFE_SCALE_V_STRIPE_CFG            = 0x00000288,
-VFE_SCALE_Y_CFG                   = 0x0000028C,
-VFE_SCALE_Y_H_IMAGE_SIZE_CFG      = 0x00000290,
-VFE_SCALE_Y_H_PHASE_CFG           = 0x00000294,
-VFE_SCALE_Y_V_IMAGE_SIZE_CFG      = 0x00000298,
-VFE_SCALE_Y_V_PHASE_CFG           = 0x0000029C,
-VFE_SCALE_CBCR_CFG                = 0x000002A0,
-VFE_SCALE_CBCR_H_IMAGE_SIZE_CFG   = 0x000002A4,
-VFE_SCALE_CBCR_H_PHASE_CFG        = 0x000002A8,
-VFE_SCALE_CBCR_V_IMAGE_SIZE_CFG   = 0x000002AC,
-VFE_SCALE_CBCR_V_PHASE_CFG        = 0x000002B0,
-VFE_WB_CFG                        = 0x000002B4,
-VFE_CHROMA_SUPPRESS_CFG_0         = 0x000002B8,
-VFE_CHROMA_SUPPRESS_CFG_1         = 0x000002BC,
-VFE_CHROMA_SUBSAMPLE_CFG          = 0x000002C0,
-VFE_CHROMA_SUB_CROP_WIDTH_CFG     = 0x000002C4,
-VFE_CHROMA_SUB_CROP_HEIGHT_CFG    = 0x000002C8,
-VFE_FRAMEDROP_ENC_Y_CFG           = 0x000002CC,
-VFE_FRAMEDROP_ENC_CBCR_CFG        = 0x000002D0,
-VFE_FRAMEDROP_ENC_Y_PATTERN       = 0x000002D4,
-VFE_FRAMEDROP_ENC_CBCR_PATTERN    = 0x000002D8,
-VFE_FRAMEDROP_VIEW_Y_CFG          = 0x000002DC,
-VFE_FRAMEDROP_VIEW_CBCR_CFG       = 0x000002E0,
-VFE_FRAMEDROP_VIEW_Y_PATTERN      = 0x000002E4,
-VFE_FRAMEDROP_VIEW_CBCR_PATTERN   = 0x000002E8,
-VFE_CLAMP_MAX_CFG                 = 0x000002EC,
-VFE_CLAMP_MIN_CFG                 = 0x000002F0,
-VFE_STATS_CMD                     = 0x000002F4,
-VFE_STATS_AF_CFG                  = 0x000002F8,
-VFE_STATS_AF_DIM                  = 0x000002FC,
-VFE_STATS_AF_GRID_0               = 0x00000300,
-VFE_STATS_AF_GRID_1               = 0x00000304,
-VFE_STATS_AF_GRID_2               = 0x00000308,
-VFE_STATS_AF_GRID_3               = 0x0000030C,
-VFE_STATS_AF_HEADER               = 0x00000310,
-VFE_STATS_AF_COEF0                = 0x00000314,
-VFE_STATS_AF_COEF1                = 0x00000318,
-VFE_STATS_AWBAE_CFG               = 0x0000031C,
-VFE_STATS_AXW_HEADER              = 0x00000320,
-VFE_STATS_AWB_MCFG                = 0x00000324,
-VFE_STATS_AWB_CCFG1               = 0x00000328,
-VFE_STATS_AWB_CCFG2               = 0x0000032C,
-VFE_STATS_HIST_HEADER             = 0x00000330,
-VFE_STATS_HIST_INNER_OFFSET       = 0x00000334,
-VFE_STATS_HIST_INNER_DIM          = 0x00000338,
-VFE_STATS_FRAME_SIZE              = 0x0000033C,
-VFE_DMI_CFG                       = 0x00000340,
-VFE_DMI_ADDR                      = 0x00000344,
-VFE_DMI_DATA_HI                   = 0x00000348,
-VFE_DMI_DATA_LO                   = 0x0000034C,
-VFE_DMI_RAM_AUTO_LOAD_CMD         = 0x00000350,
-VFE_DMI_RAM_AUTO_LOAD_STATUS      = 0x00000354,
-VFE_DMI_RAM_AUTO_LOAD_CFG         = 0x00000358,
-VFE_DMI_RAM_AUTO_LOAD_SEED        = 0x0000035C,
-VFE_TESTBUS_SEL                   = 0x00000360,
-VFE_TESTGEN_CFG                   = 0x00000364,
-VFE_SW_TESTGEN_CMD                = 0x00000368,
-VFE_HW_TESTGEN_CMD                = 0x0000036C,
-VFE_HW_TESTGEN_CFG                = 0x00000370,
-VFE_HW_TESTGEN_IMAGE_CFG          = 0x00000374,
-VFE_HW_TESTGEN_SOF_OFFSET_CFG     = 0x00000378,
-VFE_HW_TESTGEN_EOF_NOFFSET_CFG    = 0x0000037C,
-VFE_HW_TESTGEN_SOL_OFFSET_CFG     = 0x00000380,
-VFE_HW_TESTGEN_EOL_NOFFSET_CFG    = 0x00000384,
-VFE_HW_TESTGEN_HBI_CFG            = 0x00000388,
-VFE_HW_TESTGEN_VBL_CFG            = 0x0000038C,
-VFE_HW_TESTGEN_SOF_DUMMY_LINE_CFG2 = 0x00000390,
-VFE_HW_TESTGEN_EOF_DUMMY_LINE_CFG2 = 0x00000394,
-VFE_HW_TESTGEN_COLOR_BARS_CFG     = 0x00000398,
-VFE_HW_TESTGEN_RANDOM_CFG         = 0x0000039C,
-VFE_SPARE                         = 0x000003A0,
-};
-
-#define ping 0x0
-#define pong 0x1
-
-struct vfe_bus_cfg_data {
-	boolean                  stripeRdPathEn;
-	boolean                  encYWrPathEn;
-	boolean                  encCbcrWrPathEn;
-	boolean                  viewYWrPathEn;
-	boolean                  viewCbcrWrPathEn;
-	enum VFE_RAW_PIXEL_DATA_SIZE rawPixelDataSize;
-	enum VFE_RAW_WR_PATH_SEL     rawWritePathSelect;
-};
-
-struct vfe_camif_cfg_data {
-	boolean camif2OutputEnable;
-	boolean camif2BusEnable;
-	struct vfe_cmds_camif_cfg camifCfgFromCmd;
-};
-
-struct vfe_irq_composite_mask_config {
-	uint8_t encIrqComMask;
-	uint8_t viewIrqComMask;
-	uint8_t ceDoneSel;
-};
-
-/* define a structure for each output path.*/
-struct vfe_output_path {
-	uint32_t addressBuffer[8];
-	uint16_t fragIndex;
-	boolean  hwCurrentFlag;
-	uint8_t  *hwRegPingAddress;
-	uint8_t  *hwRegPongAddress;
-};
-
-struct vfe_output_path_combo {
-	boolean           whichOutputPath;
-	boolean           pathEnabled;
-	boolean           multiFrag;
-	uint8_t           fragCount;
-	boolean           ackPending;
-	uint8_t           currentFrame;
-	uint32_t          nextFrameAddrBuf[8];
-	struct vfe_output_path   yPath;
-	struct vfe_output_path   cbcrPath;
-	uint8_t           snapshotPendingCount;
-	boolean           pmEnabled;
-	uint8_t           cbcrStatusBit;
-};
-
-struct vfe_stats_control {
-	boolean  ackPending;
-	uint32_t addressBuffer[2];
-	uint32_t nextFrameAddrBuf;
-	boolean  pingPongStatus;
-	uint8_t  *hwRegPingAddress;
-	uint8_t  *hwRegPongAddress;
-	uint32_t droppedStatsFrameCount;
-	uint32_t bufToRender;
-};
-
-struct vfe_gamma_lut_sel {
-	boolean  ch0BankSelect;
-	boolean  ch1BankSelect;
-	boolean  ch2BankSelect;
-};
-
-struct vfe_interrupt_mask {
-	boolean  camifErrorIrq;
-	boolean  camifSofIrq;
-	boolean  camifEolIrq;
-	boolean  camifEofIrq;
-	boolean  camifEpoch1Irq;
-	boolean  camifEpoch2Irq;
-	boolean  camifOverflowIrq;
-	boolean  ceIrq;
-	boolean  regUpdateIrq;
-	boolean  resetAckIrq;
-	boolean  encYPingpongIrq;
-	boolean  encCbcrPingpongIrq;
-	boolean  viewYPingpongIrq;
-	boolean  viewCbcrPingpongIrq;
-	boolean  rdPingpongIrq;
-	boolean  afPingpongIrq;
-	boolean  awbPingpongIrq;
-	boolean  histPingpongIrq;
-	boolean  encIrq;
-	boolean  viewIrq;
-	boolean  busOverflowIrq;
-	boolean  afOverflowIrq;
-	boolean  awbOverflowIrq;
-	boolean  syncTimer0Irq;
-	boolean  syncTimer1Irq;
-	boolean  syncTimer2Irq;
-	boolean  asyncTimer0Irq;
-	boolean  asyncTimer1Irq;
-	boolean  asyncTimer2Irq;
-	boolean  asyncTimer3Irq;
-	boolean  axiErrorIrq;
-	boolean  violationIrq;
-};
-
-enum vfe_interrupt_name {
-	CAMIF_ERROR_IRQ,
-	CAMIF_SOF_IRQ,
-	CAMIF_EOL_IRQ,
-	CAMIF_EOF_IRQ,
-	CAMIF_EPOCH1_IRQ,
-	CAMIF_EPOCH2_IRQ,
-	CAMIF_OVERFLOW_IRQ,
-	CE_IRQ,
-	REG_UPDATE_IRQ,
-	RESET_ACK_IRQ,
-	ENC_Y_PINGPONG_IRQ,
-	ENC_CBCR_PINGPONG_IRQ,
-	VIEW_Y_PINGPONG_IRQ,
-	VIEW_CBCR_PINGPONG_IRQ,
-	RD_PINGPONG_IRQ,
-	AF_PINGPONG_IRQ,
-	AWB_PINGPONG_IRQ,
-	HIST_PINGPONG_IRQ,
-	ENC_IRQ,
-	VIEW_IRQ,
-	BUS_OVERFLOW_IRQ,
-	AF_OVERFLOW_IRQ,
-	AWB_OVERFLOW_IRQ,
-	SYNC_TIMER0_IRQ,
-	SYNC_TIMER1_IRQ,
-	SYNC_TIMER2_IRQ,
-	ASYNC_TIMER0_IRQ,
-	ASYNC_TIMER1_IRQ,
-	ASYNC_TIMER2_IRQ,
-	ASYNC_TIMER3_IRQ,
-	AXI_ERROR_IRQ,
-	VIOLATION_IRQ
-};
-
-enum VFE_DMI_RAM_SEL {
-	NO_MEM_SELECTED          = 0,
-	ROLLOFF_RAM              = 0x1,
-	RGBLUT_RAM_CH0_BANK0     = 0x2,
-	RGBLUT_RAM_CH0_BANK1     = 0x3,
-	RGBLUT_RAM_CH1_BANK0     = 0x4,
-	RGBLUT_RAM_CH1_BANK1     = 0x5,
-	RGBLUT_RAM_CH2_BANK0     = 0x6,
-	RGBLUT_RAM_CH2_BANK1     = 0x7,
-	STATS_HIST_CB_EVEN_RAM   = 0x8,
-	STATS_HIST_CB_ODD_RAM    = 0x9,
-	STATS_HIST_CR_EVEN_RAM   = 0xa,
-	STATS_HIST_CR_ODD_RAM    = 0xb,
-	RGBLUT_CHX_BANK0         = 0xc,
-	RGBLUT_CHX_BANK1         = 0xd,
-	LUMA_ADAPT_LUT_RAM_BANK0 = 0xe,
-	LUMA_ADAPT_LUT_RAM_BANK1 = 0xf
-};
-
-struct vfe_module_enable {
-	boolean  blackLevelCorrectionEnable;
-	boolean  lensRollOffEnable;
-	boolean  demuxEnable;
-	boolean  chromaUpsampleEnable;
-	boolean  demosaicEnable;
-	boolean  statsEnable;
-	boolean  cropEnable;
-	boolean  mainScalerEnable;
-	boolean  whiteBalanceEnable;
-	boolean  colorCorrectionEnable;
-	boolean  yHistEnable;
-	boolean  skinToneEnable;
-	boolean  lumaAdaptationEnable;
-	boolean  rgbLUTEnable;
-	boolean  chromaEnhanEnable;
-	boolean  asfEnable;
-	boolean  chromaSuppressionEnable;
-	boolean  chromaSubsampleEnable;
-	boolean  scaler2YEnable;
-	boolean  scaler2CbcrEnable;
-};
-
-struct vfe_bus_cmd_data {
-	boolean  stripeReload;
-	boolean  busPingpongReload;
-	boolean  statsPingpongReload;
-};
-
-struct vfe_stats_cmd_data {
-	boolean  autoFocusEnable;
-	boolean  axwEnable;
-	boolean  histEnable;
-	boolean  clearHistEnable;
-	boolean  histAutoClearEnable;
-	boolean  colorConversionEnable;
-};
-
-struct vfe_hw_ver {
-	uint32_t minorVersion:8;
-	uint32_t majorVersion:8;
-	uint32_t coreVersion:4;
-	uint32_t /* reserved */ : 12;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_cfg {
-	uint32_t pixelPattern:3;
-	uint32_t /* reserved */ : 13;
-	uint32_t inputSource:2;
-	uint32_t /* reserved */ : 14;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_buscmd {
-	uint32_t  stripeReload:1;
-	uint32_t  /* reserved */ : 3;
-	uint32_t  busPingpongReload:1;
-	uint32_t  statsPingpongReload:1;
-	uint32_t  /* reserved */ : 26;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_Irq_Composite_MaskType {
-	uint32_t  encIrqComMaskBits:2;
-	uint32_t  viewIrqComMaskBits:2;
-	uint32_t  ceDoneSelBits:5;
-	uint32_t  /* reserved */ : 23;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_mod_enable {
-	uint32_t blackLevelCorrectionEnable:1;
-	uint32_t lensRollOffEnable:1;
-	uint32_t demuxEnable:1;
-	uint32_t chromaUpsampleEnable:1;
-	uint32_t demosaicEnable:1;
-	uint32_t statsEnable:1;
-	uint32_t cropEnable:1;
-	uint32_t mainScalerEnable:1;
-	uint32_t whiteBalanceEnable:1;
-	uint32_t colorCorrectionEnable:1;
-	uint32_t yHistEnable:1;
-	uint32_t skinToneEnable:1;
-	uint32_t lumaAdaptationEnable:1;
-	uint32_t rgbLUTEnable:1;
-	uint32_t chromaEnhanEnable:1;
-	uint32_t asfEnable:1;
-	uint32_t chromaSuppressionEnable:1;
-	uint32_t chromaSubsampleEnable:1;
-	uint32_t scaler2YEnable:1;
-	uint32_t scaler2CbcrEnable:1;
-	uint32_t /* reserved */ : 14;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_irqenable {
-	uint32_t camifErrorIrq:1;
-	uint32_t camifSofIrq:1;
-	uint32_t camifEolIrq:1;
-	uint32_t camifEofIrq:1;
-	uint32_t camifEpoch1Irq:1;
-	uint32_t camifEpoch2Irq:1;
-	uint32_t camifOverflowIrq:1;
-	uint32_t ceIrq:1;
-	uint32_t regUpdateIrq:1;
-	uint32_t resetAckIrq:1;
-	uint32_t encYPingpongIrq:1;
-	uint32_t encCbcrPingpongIrq:1;
-	uint32_t viewYPingpongIrq:1;
-	uint32_t viewCbcrPingpongIrq:1;
-	uint32_t rdPingpongIrq:1;
-	uint32_t afPingpongIrq:1;
-	uint32_t awbPingpongIrq:1;
-	uint32_t histPingpongIrq:1;
-	uint32_t encIrq:1;
-	uint32_t viewIrq:1;
-	uint32_t busOverflowIrq:1;
-	uint32_t afOverflowIrq:1;
-	uint32_t awbOverflowIrq:1;
-	uint32_t syncTimer0Irq:1;
-	uint32_t syncTimer1Irq:1;
-	uint32_t syncTimer2Irq:1;
-	uint32_t asyncTimer0Irq:1;
-	uint32_t asyncTimer1Irq:1;
-	uint32_t asyncTimer2Irq:1;
-	uint32_t asyncTimer3Irq:1;
-	uint32_t axiErrorIrq:1;
-	uint32_t violationIrq:1;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_upsample_cfg {
-	uint32_t chromaCositingForYCbCrInputs:1;
-	uint32_t /* reserved */ : 31;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_CAMIFConfigType {
-	/* CAMIF Config */
-	uint32_t  /* reserved */ : 1;
-	uint32_t  VSyncEdge:1;
-	uint32_t  HSyncEdge:1;
-	uint32_t  syncMode:2;
-	uint32_t  vfeSubsampleEnable:1;
-	uint32_t  /* reserved */ : 1;
-	uint32_t  busSubsampleEnable:1;
-	uint32_t  camif2vfeEnable:1;
-	uint32_t  /* reserved */ : 1;
-	uint32_t  camif2busEnable:1;
-	uint32_t  irqSubsampleEnable:1;
-	uint32_t  binningEnable:1;
-	uint32_t  /* reserved */ : 18;
-	uint32_t  misrEnable:1;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_camifcfg {
-	/* EFS_Config */
-	uint32_t efsEndOfLine:8;
-	uint32_t efsStartOfLine:8;
-	uint32_t efsEndOfFrame:8;
-	uint32_t efsStartOfFrame:8;
-	/* Frame Config */
-	uint32_t frameConfigPixelsPerLine:14;
-	uint32_t /* reserved */ : 2;
-	uint32_t frameConfigLinesPerFrame:14;
-	uint32_t /* reserved */ : 2;
-	/* Window Width Config */
-	uint32_t windowWidthCfgLastPixel:14;
-	uint32_t /* reserved */ : 2;
-	uint32_t windowWidthCfgFirstPixel:14;
-	uint32_t /* reserved */ : 2;
-	/* Window Height Config */
-	uint32_t windowHeightCfglastLine:14;
-	uint32_t /* reserved */ : 2;
-	uint32_t windowHeightCfgfirstLine:14;
-	uint32_t /* reserved */ : 2;
-	/* Subsample 1 Config */
-	uint32_t subsample1CfgPixelSkip:16;
-	uint32_t subsample1CfgLineSkip:16;
-	/* Subsample 2 Config */
-	uint32_t subsample2CfgFrameSkip:4;
-	uint32_t subsample2CfgFrameSkipMode:1;
-	uint32_t subsample2CfgPixelSkipWrap:1;
-	uint32_t /* reserved */ : 26;
-	/* Epoch Interrupt */
-	uint32_t epoch1Line:14;
-	uint32_t /* reserved */ : 2;
-	uint32_t epoch2Line:14;
-	uint32_t /* reserved */ : 2;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_camifframe_update {
-	uint32_t pixelsPerLine:14;
-	uint32_t /* reserved */ : 2;
-	uint32_t linesPerFrame:14;
-	uint32_t /* reserved */ : 2;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_axi_bus_cfg {
-	uint32_t  stripeRdPathEn:1;
-	uint32_t  /* reserved */ : 3;
-	uint32_t  encYWrPathEn:1;
-	uint32_t  encCbcrWrPathEn:1;
-	uint32_t  viewYWrPathEn:1;
-	uint32_t  viewCbcrWrPathEn:1;
-	uint32_t  rawPixelDataSize:2;
-	uint32_t  rawWritePathSelect:2;
-	uint32_t  /* reserved */ : 20;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_axi_out_cfg {
-	uint32_t  out2YPingAddr:32;
-	uint32_t  out2YPongAddr:32;
-	uint32_t  out2YImageHeight:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  out2YImageWidthin64bit:10;
-	uint32_t  /* reserved */ : 6;
-	uint32_t  out2YBurstLength:2;
-	uint32_t  /* reserved */ : 2;
-	uint32_t  out2YNumRows:12;
-	uint32_t  out2YRowIncrementIn64bit:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  out2CbcrPingAddr:32;
-	uint32_t  out2CbcrPongAddr:32;
-	uint32_t  out2CbcrImageHeight:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  out2CbcrImageWidthIn64bit:10;
-	uint32_t  /* reserved */ : 6;
-	uint32_t  out2CbcrBurstLength:2;
-	uint32_t  /* reserved */ : 2;
-	uint32_t  out2CbcrNumRows:12;
-	uint32_t  out2CbcrRowIncrementIn64bit:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  out1YPingAddr:32;
-	uint32_t  out1YPongAddr:32;
-	uint32_t  out1YImageHeight:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  out1YImageWidthin64bit:10;
-	uint32_t  /* reserved */ : 6;
-	uint32_t  out1YBurstLength:2;
-	uint32_t  /* reserved */ : 2;
-	uint32_t  out1YNumRows:12;
-	uint32_t  out1YRowIncrementIn64bit:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  out1CbcrPingAddr:32;
-	uint32_t  out1CbcrPongAddr:32;
-	uint32_t  out1CbcrImageHeight:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  out1CbcrImageWidthIn64bit:10;
-	uint32_t  /* reserved */ : 6;
-	uint32_t  out1CbcrBurstLength:2;
-	uint32_t  /* reserved */ : 2;
-	uint32_t  out1CbcrNumRows:12;
-	uint32_t  out1CbcrRowIncrementIn64bit:12;
-	uint32_t  /* reserved */ : 4;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_output_clamp_cfg {
-	/* Output Clamp Maximums */
-	uint32_t yChanMax:8;
-	uint32_t cbChanMax:8;
-	uint32_t crChanMax:8;
-	uint32_t /* reserved */ : 8;
-	/* Output Clamp Minimums */
-	uint32_t yChanMin:8;
-	uint32_t cbChanMin:8;
-	uint32_t crChanMin:8;
-	uint32_t /* reserved */ : 8;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_fov_crop_cfg {
-	uint32_t lastPixel:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t firstPixel:12;
-	uint32_t /* reserved */ : 4;
-
-	/* FOV Corp, Part 2 */
-	uint32_t lastLine:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t firstLine:12;
-	uint32_t /* reserved */ : 4;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_FRAME_SKIP_UpdateCmdType {
-	uint32_t  yPattern:32;
-	uint32_t  cbcrPattern:32;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_frame_skip_cfg {
-	/* Frame Drop Enc (output2) */
-	uint32_t output2YPeriod:5;
-	uint32_t /* reserved */	: 27;
-	uint32_t output2CbCrPeriod:5;
-	uint32_t /* reserved */ : 27;
-	uint32_t output2YPattern:32;
-	uint32_t output2CbCrPattern:32;
-	/* Frame Drop View (output1) */
-	uint32_t output1YPeriod:5;
-	uint32_t /* reserved */ : 27;
-	uint32_t output1CbCrPeriod:5;
-	uint32_t /* reserved */ : 27;
-	uint32_t output1YPattern:32;
-	uint32_t output1CbCrPattern:32;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_main_scaler_cfg {
-	/* Scaler Enable Config */
-	uint32_t hEnable:1;
-	uint32_t vEnable:1;
-	uint32_t /* reserved */ : 30;
-	/* Scale H Image Size Config */
-	uint32_t inWidth:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t outWidth:12;
-	uint32_t /* reserved */ : 4;
-	/* Scale H Phase Config */
-	uint32_t horizPhaseMult:18;
-	uint32_t /* reserved */ : 2;
-	uint32_t horizInterResolution:2;
-	uint32_t /* reserved */ : 10;
-	/* Scale H Stripe Config */
-	uint32_t horizMNInit:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t horizPhaseInit:15;
-	uint32_t /* reserved */ : 1;
-	/* Scale V Image Size Config */
-	uint32_t inHeight:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t outHeight:12;
-	uint32_t /* reserved */ : 4;
-	/* Scale V Phase Config */
-	uint32_t vertPhaseMult:18;
-	uint32_t /* reserved */ : 2;
-	uint32_t vertInterResolution:2;
-	uint32_t /* reserved */ : 10;
-	/* Scale V Stripe Config */
-	uint32_t vertMNInit:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t vertPhaseInit:15;
-	uint32_t /* reserved */ : 1;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_scaler2_cfg {
-	/* Scaler   Enable Config */
-	uint32_t  hEnable:1;
-	uint32_t  vEnable:1;
-	uint32_t  /* reserved */ : 30;
-	/* Scaler   H Image Size Config */
-	uint32_t  inWidth:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  outWidth:12;
-	uint32_t  /* reserved */ : 4;
-	/* Scaler   H Phase Config */
-	uint32_t  horizPhaseMult:18;
-	uint32_t  /* reserved */ : 2;
-	uint32_t  horizInterResolution:2;
-	uint32_t  /* reserved */ : 10;
-	/* Scaler   V Image Size Config */
-	uint32_t  inHeight:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  outHeight:12;
-	uint32_t  /* reserved */ : 4;
-	/* Scaler   V Phase Config */
-	uint32_t  vertPhaseMult:18;
-	uint32_t  /* reserved */ : 2;
-	uint32_t  vertInterResolution:2;
-	uint32_t  /* reserved */ : 10;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_rolloff_cfg {
-	/* Rolloff 0 Config */
-	uint32_t  gridWidth:9;
-	uint32_t  gridHeight:9;
-	uint32_t  yDelta:9;
-	uint32_t  /* reserved */ : 5;
-	/* Rolloff 1 Config*/
-	uint32_t  gridX:4;
-	uint32_t  gridY:4;
-	uint32_t  pixelX:9;
-	uint32_t  /* reserved */ : 3;
-	uint32_t  pixelY:9;
-	uint32_t  /* reserved */ : 3;
-	/* Rolloff 2 Config */
-	uint32_t  yDeltaAccum:12;
-	uint32_t  /* reserved */ : 20;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_asf_update {
-	/* ASF Config Command */
-	uint32_t smoothEnable:1;
-	uint32_t sharpMode:2;
-	uint32_t /* reserved */ : 1;
-	uint32_t smoothCoeff1:4;
-	uint32_t smoothCoeff0:8;
-	uint32_t pipeFlushCount:12;
-	uint32_t pipeFlushOvd:1;
-	uint32_t flushHaltOvd:1;
-	uint32_t cropEnable:1;
-	uint32_t /* reserved */ : 1;
-	/* Sharpening Config 0 */
-	uint32_t sharpThresholdE1:7;
-	uint32_t /* reserved */ : 1;
-	uint32_t sharpDegreeK1:5;
-	uint32_t /* reserved */ : 3;
-	uint32_t sharpDegreeK2:5;
-	uint32_t /* reserved */ : 3;
-	uint32_t normalizeFactor:7;
-	uint32_t /* reserved */ : 1;
-	/* Sharpening Config 1 */
-	uint32_t sharpThresholdE2:8;
-	uint32_t sharpThresholdE3:8;
-	uint32_t sharpThresholdE4:8;
-	uint32_t sharpThresholdE5:8;
-	/* Sharpening Coefficients 0 */
-	uint32_t F1Coeff0:6;
-	uint32_t F1Coeff1:6;
-	uint32_t F1Coeff2:6;
-	uint32_t F1Coeff3:6;
-	uint32_t F1Coeff4:6;
-	uint32_t /* reserved */ : 2;
-	/* Sharpening Coefficients 1 */
-	uint32_t F1Coeff5:6;
-	uint32_t F1Coeff6:6;
-	uint32_t F1Coeff7:6;
-	uint32_t F1Coeff8:7;
-	uint32_t /* reserved */ : 7;
-	/* Sharpening Coefficients 2 */
-	uint32_t F2Coeff0:6;
-	uint32_t F2Coeff1:6;
-	uint32_t F2Coeff2:6;
-	uint32_t F2Coeff3:6;
-	uint32_t F2Coeff4:6;
-	uint32_t /* reserved */ : 2;
-	/* Sharpening Coefficients 3 */
-	uint32_t F2Coeff5:6;
-	uint32_t F2Coeff6:6;
-	uint32_t F2Coeff7:6;
-	uint32_t F2Coeff8:7;
-	uint32_t /* reserved */ : 7;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_asfcrop_cfg {
-	/* ASF Crop Width Config */
-	uint32_t lastPixel:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t firstPixel:12;
-	uint32_t /* reserved */ : 4;
-	/* ASP Crop Height Config */
-	uint32_t lastLine:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t firstLine:12;
-	uint32_t /* reserved */ : 4;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_chroma_suppress_cfg {
-	/* Chroma Suppress 0 Config */
-	uint32_t m1:8;
-	uint32_t m3:8;
-	uint32_t n1:3;
-	uint32_t /* reserved */ : 1;
-	uint32_t n3:3;
-	uint32_t /* reserved */ : 9;
-	/* Chroma Suppress 1 Config */
-	uint32_t mm1:8;
-	uint32_t nn1:3;
-	uint32_t /* reserved */ : 21;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_chromasubsample_cfg {
-	/* Chroma Subsample Selection */
-	uint32_t  hCositedPhase:1;
-	uint32_t  vCositedPhase:1;
-	uint32_t  hCosited:1;
-	uint32_t  vCosited:1;
-	uint32_t  hsubSampleEnable:1;
-	uint32_t  vsubSampleEnable:1;
-	uint32_t  cropEnable:1;
-	uint32_t  /* reserved */ : 25;
-	uint32_t  cropWidthLastPixel:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  cropWidthFirstPixel:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  cropHeightLastLine:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  cropHeightFirstLine:12;
-	uint32_t  /* reserved */ : 4;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_blacklevel_cfg {
-	/* Black Even-Even Value Config */
-	uint32_t    evenEvenAdjustment:9;
-	uint32_t   /* reserved */ : 23;
-	/* Black Even-Odd Value Config */
-	uint32_t    evenOddAdjustment:9;
-	uint32_t   /* reserved */ : 23;
-	/* Black Odd-Even Value Config */
-	uint32_t    oddEvenAdjustment:9;
-	uint32_t   /* reserved */ : 23;
-	/* Black Odd-Odd Value Config */
-	uint32_t    oddOddAdjustment:9;
-	uint32_t   /* reserved */ : 23;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_demux_cfg {
-	/* Demux Gain 0 Config */
-	uint32_t  ch0EvenGain:10;
-	uint32_t  /* reserved */ : 6;
-	uint32_t  ch0OddGain:10;
-	uint32_t  /* reserved */ : 6;
-	/* Demux Gain 1 Config */
-	uint32_t  ch1Gain:10;
-	uint32_t  /* reserved */ : 6;
-	uint32_t  ch2Gain:10;
-	uint32_t  /* reserved */ : 6;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_bps_info {
-  uint32_t greenBadPixelCount:8;
-  uint32_t /* reserved */ : 8;
-  uint32_t RedBlueBadPixelCount:8;
-  uint32_t /* reserved */ : 8;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_demosaic_cfg {
-	/* Demosaic Config */
-	uint32_t abfEnable:1;
-	uint32_t badPixelCorrEnable:1;
-	uint32_t forceAbfOn:1;
-	uint32_t /* reserved */ : 1;
-	uint32_t abfShift:4;
-	uint32_t fminThreshold:7;
-	uint32_t /* reserved */ : 1;
-	uint32_t fmaxThreshold:7;
-	uint32_t /* reserved */ : 5;
-	uint32_t slopeShift:3;
-	uint32_t /* reserved */ : 1;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_demosaic_bpc_cfg {
-	/* Demosaic BPC Config 0 */
-	uint32_t blueDiffThreshold:12;
-	uint32_t redDiffThreshold:12;
-	uint32_t /* reserved */ : 8;
-	/* Demosaic BPC Config 1 */
-	uint32_t greenDiffThreshold:12;
-	uint32_t /* reserved */ : 20;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_demosaic_abf_cfg {
-	/* Demosaic ABF Config 0 */
-	uint32_t lpThreshold:10;
-	uint32_t /* reserved */ : 22;
-	/* Demosaic ABF Config 1 */
-	uint32_t ratio:4;
-	uint32_t minValue:10;
-	uint32_t /* reserved */ : 2;
-	uint32_t maxValue:10;
-	uint32_t /* reserved */ : 6;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_color_correction_cfg {
-	/* Color Corr. Coefficient 0 Config */
-	uint32_t   c0:12;
-	uint32_t   /* reserved */ : 20;
-	/* Color Corr. Coefficient 1 Config */
-	uint32_t   c1:12;
-	uint32_t   /* reserved */ : 20;
-	/* Color Corr. Coefficient 2 Config */
-	uint32_t   c2:12;
-	uint32_t   /* reserved */ : 20;
-	/* Color Corr. Coefficient 3 Config */
-	uint32_t   c3:12;
-	uint32_t   /* reserved */ : 20;
-	/* Color Corr. Coefficient 4 Config */
-	uint32_t   c4:12;
-	uint32_t   /* reserved */ : 20;
-	/* Color Corr. Coefficient 5 Config */
-	uint32_t   c5:12;
-	uint32_t   /* reserved */ : 20;
-	/* Color Corr. Coefficient 6 Config */
-	uint32_t   c6:12;
-	uint32_t   /* reserved */ : 20;
-	/* Color Corr. Coefficient 7 Config */
-	uint32_t   c7:12;
-	uint32_t   /* reserved */ : 20;
-	/* Color Corr. Coefficient 8 Config */
-	uint32_t   c8:12;
-	uint32_t   /* reserved */ : 20;
-	/* Color Corr. Offset 0 Config */
-	uint32_t   k0:11;
-	uint32_t   /* reserved */ : 21;
-	/* Color Corr. Offset 1 Config */
-	uint32_t   k1:11;
-	uint32_t   /* reserved */ : 21;
-	/* Color Corr. Offset 2 Config */
-	uint32_t   k2:11;
-	uint32_t   /* reserved */ : 21;
-	/* Color Corr. Coefficient Q Config */
-	uint32_t   coefQFactor:2;
-	uint32_t   /* reserved */ : 30;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_LumaAdaptation_ConfigCmdType {
-	/* LA Config */
-	uint32_t   lutBankSelect:1;
-	uint32_t   /* reserved */ : 31;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_wb_cfg {
-	/* WB Config */
-	uint32_t ch0Gain:9;
-	uint32_t ch1Gain:9;
-	uint32_t ch2Gain:9;
-	uint32_t /* reserved */ : 5;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_GammaLutSelect_ConfigCmdType {
-	/* LUT Bank Select Config */
-	uint32_t   ch0BankSelect:1;
-	uint32_t   ch1BankSelect:1;
-	uint32_t   ch2BankSelect:1;
-	uint32_t   /* reserved */ : 29;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_chroma_enhance_cfg {
-	/* Chroma Enhance A Config */
-	uint32_t ap:11;
-	uint32_t /* reserved */ : 5;
-	uint32_t am:11;
-	uint32_t /* reserved */ : 5;
-	/* Chroma Enhance B Config */
-	uint32_t bp:11;
-	uint32_t /* reserved */ : 5;
-	uint32_t bm:11;
-	uint32_t /* reserved */ : 5;
-	/* Chroma Enhance C Config */
-	uint32_t cp:11;
-	uint32_t /* reserved */ : 5;
-	uint32_t cm:11;
-	uint32_t /* reserved */ : 5;
-	/* Chroma Enhance D Config */
-	uint32_t dp:11;
-	uint32_t /* reserved */ : 5;
-	uint32_t dm:11;
-	uint32_t /* reserved */ : 5;
-	/* Chroma Enhance K Config */
-	uint32_t kcb:11;
-	uint32_t /* reserved */ : 5;
-	uint32_t kcr:11;
-	uint32_t /* reserved */ : 5;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_color_convert_cfg {
-	/* Conversion Coefficient 0 */
-	uint32_t v0:12;
-	uint32_t /* reserved */ : 20;
-	/* Conversion Coefficient 1 */
-	uint32_t v1:12;
-	uint32_t /* reserved */ : 20;
-	/* Conversion Coefficient 2 */
-	uint32_t v2:12;
-	uint32_t /* reserved */ : 20;
-	/* Conversion Offset */
-	uint32_t ConvertOffset:8;
-	uint32_t /* reserved */ : 24;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_SyncTimer_ConfigCmdType {
-	/* Timer Line Start Config */
-	uint32_t       timerLineStart:12;
-	uint32_t       /* reserved */ : 20;
-	/* Timer Pixel Start Config */
-	uint32_t       timerPixelStart:18;
-	uint32_t       /* reserved */ : 14;
-	/* Timer Pixel Duration Config */
-	uint32_t       timerPixelDuration:28;
-	uint32_t       /* reserved */ : 4;
-	/* Sync Timer Polarity Config */
-	uint32_t       timer0Polarity:1;
-	uint32_t       timer1Polarity:1;
-	uint32_t       timer2Polarity:1;
-	uint32_t       /* reserved */ : 29;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_AsyncTimer_ConfigCmdType {
-	/* Async Timer Config 0 */
-	uint32_t     inactiveLength:20;
-	uint32_t     numRepetition:10;
-	uint32_t     /* reserved */ : 1;
-	uint32_t     polarity:1;
-	/* Async Timer Config 1 */
-	uint32_t     activeLength:20;
-	uint32_t     /* reserved */ : 12;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_AWBAEStatistics_ConfigCmdType {
-	/* AWB autoexposure Config */
-	uint32_t    aeRegionConfig:1;
-	uint32_t    aeSubregionConfig:1;
-	uint32_t    /* reserved */ : 14;
-	uint32_t    awbYMin:8;
-	uint32_t    awbYMax:8;
-	/* AXW Header */
-	uint32_t    axwHeader:8;
-	uint32_t    /* reserved */ : 24;
-	/* AWB Mconfig */
-	uint32_t    m4:8;
-	uint32_t    m3:8;
-	uint32_t    m2:8;
-	uint32_t    m1:8;
-	/* AWB Cconfig */
-	uint32_t    c2:12;
-	uint32_t    /* reserved */ : 4;
-	uint32_t    c1:12;
-	uint32_t    /* reserved */ : 4;
-	/* AWB Cconfig 2 */
-	uint32_t    c4:12;
-	uint32_t    /* reserved */ : 4;
-	uint32_t    c3:12;
-	uint32_t    /* reserved */ : 4;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_TestGen_ConfigCmdType {
-	/* HW Test Gen Config */
-	uint32_t   numFrame:10;
-	uint32_t   /* reserved */ : 2;
-	uint32_t   pixelDataSelect:1;
-	uint32_t   systematicDataSelect:1;
-	uint32_t   /* reserved */ : 2;
-	uint32_t   pixelDataSize:2;
-	uint32_t   hsyncEdge:1;
-	uint32_t   vsyncEdge:1;
-	uint32_t   /* reserved */ : 12;
-	/* HW Test Gen Image Config */
-	uint32_t   imageWidth:14;
-	uint32_t   /* reserved */ : 2;
-	uint32_t   imageHeight:14;
-	uint32_t   /* reserved */ : 2;
-	/* SOF Offset Config */
-	uint32_t   sofOffset:24;
-	uint32_t   /* reserved */ : 8;
-	/* EOF NOffset Config */
-	uint32_t   eofNOffset:24;
-	uint32_t   /* reserved */ : 8;
-	/* SOL Offset Config */
-	uint32_t   solOffset:9;
-	uint32_t   /* reserved */ : 23;
-	/* EOL NOffset Config */
-	uint32_t   eolNOffset:9;
-	uint32_t   /* reserved */ : 23;
-	/* HBI Config */
-	uint32_t   hBlankInterval:14;
-	uint32_t   /* reserved */ : 18;
-	/* VBL Config */
-	uint32_t   vBlankInterval:14;
-	uint32_t   /* reserved */ : 2;
-	uint32_t   vBlankIntervalEnable:1;
-	uint32_t   /* reserved */ : 15;
-	/* SOF Dummy Line Config */
-	uint32_t   sofDummy:8;
-	uint32_t   /* reserved */ : 24;
-	/* EOF Dummy Line Config */
-	uint32_t   eofDummy:8;
-	uint32_t   /* reserved */ : 24;
-	/* Color Bars Config */
-	uint32_t   unicolorBarSelect:3;
-	uint32_t   /* reserved */ : 1;
-	uint32_t   unicolorBarEnable:1;
-	uint32_t   splitEnable:1;
-	uint32_t   pixelPattern:2;
-	uint32_t   rotatePeriod:6;
-	uint32_t   /* reserved */ : 18;
-	/* Random Config */
-	uint32_t   randomSeed:16;
-	uint32_t   /* reserved */ : 16;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_Bus_Pm_ConfigCmdType {
-	/* VFE Bus Performance Monitor Config */
-	uint32_t  output2YWrPmEnable:1;
-	uint32_t  output2CbcrWrPmEnable:1;
-	uint32_t  output1YWrPmEnable:1;
-	uint32_t  output1CbcrWrPmEnable:1;
-	uint32_t  /* reserved */ : 28;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_asf_info {
-	/* asf max edge  */
-	uint32_t maxEdge:13;
-	uint32_t /* reserved */ : 3;
-	/* HBi count  */
-	uint32_t HBICount:12;
-	uint32_t /* reserved */ : 4;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_camif_stats {
-  uint32_t  pixelCount:14;
-  uint32_t  /* reserved */ : 2;
-  uint32_t  lineCount:14;
-  uint32_t  /* reserved */ : 1;
-  uint32_t  camifHalt:1;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_StatsCmdType {
-	uint32_t  autoFocusEnable:1;
-	uint32_t  axwEnable:1;
-	uint32_t  histEnable:1;
-	uint32_t  clearHistEnable:1;
-	uint32_t  histAutoClearEnable:1;
-	uint32_t  colorConversionEnable:1;
-	uint32_t  /* reserved */ : 26;
-} __attribute__((packed, aligned(4)));
-
-
-struct vfe_statsframe {
-	uint32_t lastPixel:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t lastLine:12;
-	uint32_t /* reserved */ : 4;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_busstats_wrprio {
-	uint32_t afBusPriority:4;
-	uint32_t awbBusPriority:4;
-	uint32_t histBusPriority:4;
-	uint32_t afBusPriorityEn:1;
-	uint32_t awbBusPriorityEn:1;
-	uint32_t histBusPriorityEn:1;
-	uint32_t /* reserved */ : 17;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_statsaf_update {
-	/* VFE_STATS_AF_CFG */
-	uint32_t windowVOffset:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t windowHOffset:12;
-	uint32_t /* reserved */ : 3;
-	uint32_t windowMode:1;
-
-	/* VFE_STATS_AF_DIM */
-	uint32_t windowHeight:12;
-	uint32_t /* reserved */ : 4;
-	uint32_t windowWidth:12;
-	uint32_t /* reserved */ : 4;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_statsaf_cfg {
-	/* VFE_STATS_AF_GRID_0 */
-	uint32_t  entry00:8;
-	uint32_t  entry01:8;
-	uint32_t  entry02:8;
-	uint32_t  entry03:8;
-
-	/* VFE_STATS_AF_GRID_1 */
-	uint32_t  entry10:8;
-	uint32_t  entry11:8;
-	uint32_t  entry12:8;
-	uint32_t  entry13:8;
-
-	/* VFE_STATS_AF_GRID_2 */
-	uint32_t  entry20:8;
-	uint32_t  entry21:8;
-	uint32_t  entry22:8;
-	uint32_t  entry23:8;
-
-	/* VFE_STATS_AF_GRID_3 */
-	uint32_t  entry30:8;
-	uint32_t  entry31:8;
-	uint32_t  entry32:8;
-	uint32_t  entry33:8;
-
-	/* VFE_STATS_AF_HEADER */
-	uint32_t  afHeader:8;
-	uint32_t  /* reserved */ : 24;
-	/*  VFE_STATS_AF_COEF0 */
-	uint32_t  a00:5;
-	uint32_t  a04:5;
-	uint32_t  fvMax:11;
-	uint32_t  fvMetric:1;
-	uint32_t  /* reserved */ : 10;
-
-	/* VFE_STATS_AF_COEF1 */
-	uint32_t  a20:5;
-	uint32_t  a21:5;
-	uint32_t  a22:5;
-	uint32_t  a23:5;
-	uint32_t  a24:5;
-	uint32_t  /* reserved */ : 7;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_statsawbae_update {
-	uint32_t  aeRegionCfg:1;
-	uint32_t  aeSubregionCfg:1;
-	uint32_t  /* reserved */ : 14;
-	uint32_t  awbYMin:8;
-	uint32_t  awbYMax:8;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_statsaxw_hdr_cfg {
-	/* Stats AXW Header Config */
-	uint32_t axwHeader:8;
-	uint32_t /* reserved */ : 24;
-} __attribute__((packed, aligned(4)));
-
-struct vfe_statsawb_update {
-	/* AWB MConfig */
-	uint32_t  m4:8;
-	uint32_t  m3:8;
-	uint32_t  m2:8;
-	uint32_t  m1:8;
-
-	/* AWB CConfig1 */
-	uint32_t  c2:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  c1:12;
-	uint32_t  /* reserved */ : 4;
-
-	/* AWB CConfig2 */
-	uint32_t  c4:12;
-	uint32_t  /* reserved */ : 4;
-	uint32_t  c3:12;
-	uint32_t  /* reserved */ : 4;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_SyncTimerCmdType {
-	uint32_t  hsyncCount:12;
-	uint32_t  /* reserved */ : 20;
-	uint32_t  pclkCount:18;
-	uint32_t  /* reserved */ : 14;
-	uint32_t  outputDuration:28;
-	uint32_t  /* reserved */ : 4;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_AsyncTimerCmdType {
-	/*  config 0 */
-	uint32_t    inactiveCount:20;
-	uint32_t    repeatCount:10;
-	uint32_t    /* reserved */ : 1;
-	uint32_t    polarity:1;
-	/*  config 1 */
-	uint32_t    activeCount:20;
-	uint32_t    /* reserved */ : 12;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_AxiInputCmdType {
-	uint32_t   stripeStartAddr0:32;
-	uint32_t   stripeStartAddr1:32;
-	uint32_t   stripeStartAddr2:32;
-	uint32_t   stripeStartAddr3:32;
-
-	uint32_t   ySize:12;
-	uint32_t   yOffsetDelta:12;
-	uint32_t   /* reserved */ : 8;
-
-	/* bus_stripe_rd_hSize */
-	uint32_t   /* reserved */ : 16;
-	uint32_t   xSizeWord:10;
-	uint32_t   /* reserved */ : 6;
-
-	/* bus_stripe_rd_buffer_cfg */
-	uint32_t   burstLength:2;
-	uint32_t   /* reserved */ : 2;
-	uint32_t   NumOfRows:12;
-	uint32_t   RowIncrement:12;
-	uint32_t   /* reserved */ : 4;
-
-	/* bus_stripe_rd_unpack_cfg */
-	uint32_t   mainUnpackHeight:12;
-	uint32_t   mainUnpackWidth:13;
-	uint32_t   mainUnpackHbiSel:3;
-	uint32_t   mainUnpackPhase:3;
-	uint32_t   /* reserved */ : 1;
-
-	/* bus_stripe_rd_unpack */
-	uint32_t   unpackPattern:32;
-
-	/* bus_stripe_rd_pad_size */
-	uint32_t   padLeft:7;
-	uint32_t   /* reserved */ : 1;
-	uint32_t   padRight:7;
-	uint32_t   /* reserved */ : 1;
-	uint32_t   padTop:7;
-	uint32_t   /* reserved */ : 1;
-	uint32_t   padBottom:7;
-	uint32_t   /* reserved */ : 1;
-
-	/* bus_stripe_rd_pad_L_unpack */
-	uint32_t   leftUnpackPattern0:4;
-	uint32_t   leftUnpackPattern1:4;
-	uint32_t   leftUnpackPattern2:4;
-	uint32_t   leftUnpackPattern3:4;
-	uint32_t   leftUnpackStop0:1;
-	uint32_t   leftUnpackStop1:1;
-	uint32_t   leftUnpackStop2:1;
-	uint32_t   leftUnpackStop3:1;
-	uint32_t   /* reserved */ : 12;
-
-	/* bus_stripe_rd_pad_R_unpack */
-	uint32_t   rightUnpackPattern0:4;
-	uint32_t   rightUnpackPattern1:4;
-	uint32_t   rightUnpackPattern2:4;
-	uint32_t   rightUnpackPattern3:4;
-	uint32_t   rightUnpackStop0:1;
-	uint32_t   rightUnpackStop1:1;
-	uint32_t   rightUnpackStop2:1;
-	uint32_t   rightUnpackStop3:1;
-	uint32_t   /* reserved */ : 12;
-
-	/* bus_stripe_rd_pad_tb_unpack */
-	uint32_t   topUnapckPattern:4;
-	uint32_t   /* reserved */ : 12;
-	uint32_t   bottomUnapckPattern:4;
-	uint32_t   /* reserved */ : 12;
-} __attribute__((packed, aligned(4)));
-
-struct VFE_AxiRdFragIrqEnable {
-	uint32_t stripeRdFragirq0Enable:1;
-	uint32_t stripeRdFragirq1Enable:1;
-	uint32_t stripeRdFragirq2Enable:1;
-	uint32_t stripeRdFragirq3Enable:1;
-	uint32_t   /* reserved */ : 28;
-} __attribute__((packed, aligned(4)));
-
-int vfe_cmd_init(struct msm_vfe_callback *, struct platform_device *, void *);
-void vfe_stats_af_stop(void);
-void vfe_stop(void);
-void vfe_update(void);
-int vfe_rgb_gamma_update(struct vfe_cmd_rgb_gamma_config *);
-int vfe_rgb_gamma_config(struct vfe_cmd_rgb_gamma_config *);
-void vfe_stats_wb_exp_ack(struct vfe_cmd_stats_wb_exp_ack *);
-void vfe_stats_af_ack(struct vfe_cmd_stats_af_ack *);
-void vfe_start(struct vfe_cmd_start *);
-void vfe_la_update(struct vfe_cmd_la_config *);
-void vfe_la_config(struct vfe_cmd_la_config *);
-void vfe_test_gen_start(struct vfe_cmd_test_gen_start *);
-void vfe_frame_skip_update(struct vfe_cmd_frame_skip_update *);
-void vfe_frame_skip_config(struct vfe_cmd_frame_skip_config *);
-void vfe_output_clamp_config(struct vfe_cmd_output_clamp_config *);
-void vfe_camif_frame_update(struct vfe_cmds_camif_frame *);
-void vfe_color_correction_config(struct vfe_cmd_color_correction_config *);
-void vfe_demosaic_abf_update(struct vfe_cmd_demosaic_abf_update *);
-void vfe_demosaic_bpc_update(struct vfe_cmd_demosaic_bpc_update *);
-void vfe_demosaic_config(struct vfe_cmd_demosaic_config *);
-void vfe_demux_channel_gain_update(struct vfe_cmd_demux_channel_gain_config *);
-void vfe_demux_channel_gain_config(struct vfe_cmd_demux_channel_gain_config *);
-void vfe_black_level_update(struct vfe_cmd_black_level_config *);
-void vfe_black_level_config(struct vfe_cmd_black_level_config *);
-void vfe_asf_update(struct vfe_cmd_asf_update *);
-void vfe_asf_config(struct vfe_cmd_asf_config *);
-void vfe_white_balance_config(struct vfe_cmd_white_balance_config *);
-void vfe_chroma_sup_config(struct vfe_cmd_chroma_suppression_config *);
-void vfe_roll_off_config(struct vfe_cmd_roll_off_config *);
-void vfe_chroma_subsample_config(struct vfe_cmd_chroma_subsample_config *);
-void vfe_chroma_enhan_config(struct vfe_cmd_chroma_enhan_config *);
-void vfe_scaler2cbcr_config(struct vfe_cmd_scaler2_config *);
-void vfe_scaler2y_config(struct vfe_cmd_scaler2_config *);
-void vfe_main_scaler_config(struct vfe_cmd_main_scaler_config *);
-void vfe_stats_wb_exp_stop(void);
-void vfe_stats_update_wb_exp(struct vfe_cmd_stats_wb_exp_update *);
-void vfe_stats_update_af(struct vfe_cmd_stats_af_update *);
-void vfe_stats_start_wb_exp(struct vfe_cmd_stats_wb_exp_start *);
-void vfe_stats_start_af(struct vfe_cmd_stats_af_start *);
-void vfe_stats_setting(struct vfe_cmd_stats_setting *);
-void vfe_axi_input_config(struct vfe_cmd_axi_input_config *);
-void vfe_axi_output_config(struct vfe_cmd_axi_output_config *);
-void vfe_camif_config(struct vfe_cmd_camif_config *);
-void vfe_fov_crop_config(struct vfe_cmd_fov_crop_config *);
-void vfe_get_hw_version(struct vfe_cmd_hw_version *);
-void vfe_reset(void);
-void vfe_cmd_release(struct platform_device *);
-void vfe_output_p_ack(struct vfe_cmd_output_ack *);
-void vfe_output_v_ack(struct vfe_cmd_output_ack *);
-#endif /* __MSM_VFE8X_REG_H__ */
diff --git a/drivers/media/video/msm/vfe/msm_vfe_stats_buf.c b/drivers/media/video/msm/vfe/msm_vfe_stats_buf.c
deleted file mode 100644
index e2e2f24..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe_stats_buf.c
+++ /dev/null
@@ -1,563 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/workqueue.h>
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/list.h>
-#include <linux/ioctl.h>
-#include <linux/spinlock.h>
-#include <linux/videodev2.h>
-#include <linux/proc_fs.h>
-#include <linux/vmalloc.h>
-
-#include <media/v4l2-dev.h>
-#include <media/v4l2-ioctl.h>
-#include <media/v4l2-device.h>
-
-#include <linux/android_pmem.h>
-#include <media/msm_camera.h>
-#include <media/msm_isp.h>
-#include "msm.h"
-#include "msm_vfe_stats_buf.h"
-
-#ifdef CONFIG_MSM_CAMERA_DEBUG
-	#define D(fmt, args...) pr_debug("msm_stats: " fmt, ##args)
-#else
-	#define D(fmt, args...) do {} while (0)
-#endif
-
-static int msm_stats_init(struct msm_stats_bufq_ctrl *stats_ctrl)
-{
-	int rc = 0;
-	/* cannot get spinlock here */
-	if (stats_ctrl->init_done > 0) {
-		pr_err("%s: already initialized stats ctrl. no op", __func__);
-		return 0;
-	}
-	memset(stats_ctrl,  0,  sizeof(struct msm_stats_bufq_ctrl));
-	spin_lock_init(&stats_ctrl->lock);
-	stats_ctrl->init_done = 1;
-	return rc;
-}
-
-static int msm_stats_reqbuf(struct msm_stats_bufq_ctrl *stats_ctrl,
-	struct msm_stats_reqbuf *reqbuf,
-	struct ion_client *client)
-{
-	int rc = 0;
-	struct msm_stats_bufq *bufq;
-	struct msm_stats_meta_buf *bufs;
-	int idx = reqbuf->stats_type;
-	int i;
-
-	D("%s: type : %d, buf num : %d\n", __func__,
-		reqbuf->stats_type, reqbuf->num_buf);
-	if (reqbuf->num_buf > 0) {
-		if (stats_ctrl->bufq[idx]) {
-			/* already in use. Error */
-			pr_err("%s: stats type %d aleady requested",
-				 __func__, reqbuf->stats_type);
-			rc = -EEXIST;
-			goto end;
-		} else {
-			/* good case */
-			bufq = (struct msm_stats_bufq *)
-				kzalloc(
-					sizeof(struct msm_stats_bufq),
-					GFP_KERNEL);
-			if (!bufq) {
-				/* no memory */
-				rc = -ENOMEM;
-				pr_err("%s: no mem for stats type %d",
-					__func__, reqbuf->stats_type);
-				goto end;
-			}
-			bufs = (struct msm_stats_meta_buf *)
-				kzalloc((reqbuf->num_buf *
-					sizeof(struct msm_stats_meta_buf)),
-					GFP_KERNEL);
-			if (!bufs) {
-				/* no memory */
-				rc = -ENOMEM;
-				pr_err("%s: no mem for stats buf, stats type = %d",
-					__func__, reqbuf->stats_type);
-				kfree(bufq);
-				goto end;
-			}
-			/* init bufq list head */
-			INIT_LIST_HEAD(&bufq->head);
-			/* set the meta buf state to initialized */
-			bufq->num_bufs = reqbuf->num_buf;
-			for (i = 0; i < reqbuf->num_buf; i++)
-				bufs[i].state =
-					MSM_STATS_BUFFER_STATE_INITIALIZED;
-			bufq->bufs = bufs;
-			bufq->num_bufs = reqbuf->num_buf;
-			bufq->type = reqbuf->stats_type;
-			stats_ctrl->bufq[idx] = bufq;
-			/* done reqbuf (larger than zero case) */
-			goto end;
-		}
-	} else if (reqbuf->num_buf == 0) {
-		if (stats_ctrl->bufq[idx] == NULL) {
-			/* double free case? */
-			pr_err("%s: stats type %d aleady freed",
-				 __func__, reqbuf->stats_type);
-			rc = -ENXIO;
-			goto end;
-		} else {
-			/* good case. need to de-reqbuf */
-			kfree(stats_ctrl->bufq[idx]->bufs);
-			kfree(stats_ctrl->bufq[idx]);
-			stats_ctrl->bufq[idx] = NULL;
-			goto end;
-		}
-	} else {
-		/* error case */
-		pr_err("%s: stats type = %d, req_num_buf = %d, error",
-			   __func__, reqbuf->stats_type, reqbuf->num_buf);
-		rc = -EPERM;
-		goto end;
-	}
-end:
-	return rc;
-}
-static int msm_stats_deinit(struct msm_stats_bufq_ctrl *stats_ctrl)
-{
-	int rc = 0;
-	int i;
-
-	if (stats_ctrl->init_done == 0) {
-		pr_err("%s: not inited yet. no op", __func__);
-		return 0;
-	}
-	/* safe guard in case deallocate memory not done yet. */
-	for (i = 0; i < MSM_STATS_TYPE_MAX; i++) {
-		if (stats_ctrl->bufq[i]) {
-			if (stats_ctrl->bufq[i]->bufs) {
-				rc = -1;
-				pr_err("%s: stats type = %d, buf not freed yet",
-					 __func__, i);
-				BUG_ON(stats_ctrl->bufq[i]->bufs);
-			} else {
-				rc = -1;
-				pr_err("%s: stats type = %d, bufq not freed yet",
-					__func__, i);
-				BUG_ON(stats_ctrl->bufq[i]);
-			}
-		}
-	}
-	memset(stats_ctrl,  0,  sizeof(struct msm_stats_bufq_ctrl));
-	return rc;
-}
-
-#ifdef CONFIG_ANDROID_PMEM
-static int msm_stats_check_pmem_info(struct msm_stats_buf_info *info, int len)
-{
-	if (info->offset < len &&
-		info->offset + info->len <= len &&
-		info->planar0_off < len && info->planar1_off < len)
-		return 0;
-
-	pr_err("%s: check failed: off %d len %d y %d cbcr %d (total len %d)\n",
-		   __func__,
-		   info->offset,
-		   info->len,
-		   info->planar0_off,
-		   info->planar1_off,
-		   len);
-	return -EINVAL;
-}
-#endif
-
-static int msm_stats_buf_prepare(struct msm_stats_bufq_ctrl *stats_ctrl,
-	struct msm_stats_buf_info *info, struct ion_client *client,
-	int domain_num)
-{
-	unsigned long paddr;
-#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
-	unsigned long kvstart;
-	struct file *file;
-#endif
-	int rc = 0;
-	unsigned long len;
-	struct msm_stats_bufq *bufq = NULL;
-	struct msm_stats_meta_buf *stats_buf = NULL;
-
-	D("%s: type : %d, buf num : %d\n", __func__,
-		info->type, info->buf_idx);
-
-	if (stats_ctrl)
-		bufq = stats_ctrl->bufq[info->type];
-	if(!bufq) {
-		pr_err("%s:%d bufq is NULL stats_ctrl :%x\n", __func__, __LINE__,
-				(unsigned int)stats_ctrl);
-		rc = -1;
-		goto out1;
-	}
-
-	stats_buf = &bufq->bufs[info->buf_idx];
-	if (stats_buf->state == MSM_STATS_BUFFER_STATE_UNUSED) {
-		pr_err("%s: need reqbuf first, stats type = %d",
-			__func__, info->type);
-		rc = -1;
-		goto out1;
-	}
-	if (stats_buf->state != MSM_STATS_BUFFER_STATE_INITIALIZED) {
-		D("%s: stats already mapped, no op, stats type = %d",
-			__func__, info->type);
-		goto out1;
-	}
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	stats_buf->handle = ion_import_dma_buf(client, info->fd);
-	if (IS_ERR_OR_NULL(stats_buf->handle)) {
-		rc = -EINVAL;
-		pr_err("%s: stats_buf has null/error ION handle %p",
-			   __func__, stats_buf->handle);
-		goto out1;
-	}
-	if (ion_map_iommu(client, stats_buf->handle,
-			domain_num, 0, SZ_4K,
-			0, &paddr, &len, 0, 0) < 0) {
-		rc = -EINVAL;
-		pr_err("%s: cannot map address", __func__);
-		goto out2;
-	}
-#elif CONFIG_ANDROID_PMEM
-	rc = get_pmem_file(info->fd, &paddr, &kvstart, &len, &file);
-	if (rc < 0) {
-		pr_err("%s: get_pmem_file fd %d error %d\n",
-			   __func__, info->fd, rc);
-		goto out1;
-	}
-	stats_buf->file = file;
-#else
-	paddr = 0;
-	file = NULL;
-	kvstart = 0;
-#endif
-	if (!info->len)
-		info->len = len;
-	rc = msm_stats_check_pmem_info(info, len);
-	if (rc < 0) {
-		pr_err("%s: msm_stats_check_pmem_info err = %d", __func__, rc);
-		goto out3;
-	}
-	paddr += info->offset;
-	len = info->len;
-	stats_buf->paddr = paddr;
-	stats_buf->len = len;
-	memcpy(&stats_buf->info, info, sizeof(stats_buf->info));
-	D("%s Adding buf to list with type %d\n", __func__,
-	  stats_buf->info.type);
-	D("%s pmem_stats address is 0x%ld\n", __func__, paddr);
-	stats_buf->state = MSM_STATS_BUFFER_STATE_PREPARED;
-	return 0;
-out3:
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_unmap_iommu(client, stats_buf->handle, domain_num, 0);
-#endif
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-out2:
-	ion_free(client, stats_buf->handle);
-#elif CONFIG_ANDROID_PMEM
-	put_pmem_file(stats_buf->file);
-#endif
-out1:
-	return rc;
-}
-static int msm_stats_buf_unprepare(struct msm_stats_bufq_ctrl *stats_ctrl,
-	enum msm_stats_enum_type stats_type, int buf_idx,
-	struct ion_client *client, int domain_num)
-{
-	int rc = 0;
-	struct msm_stats_bufq *bufq = NULL;
-	struct msm_stats_meta_buf *stats_buf = NULL;
-
-	D("%s: type : %d, idx : %d\n", __func__, stats_type, buf_idx);
-	if(stats_ctrl)
-		bufq = stats_ctrl->bufq[stats_type];
-	if(bufq == NULL) {
-		pr_err("%s: bufq is NULL for stats type %d",
-			__func__, stats_type);
-		rc = -1;
-		goto end;
-	}
-
-	stats_buf = &bufq->bufs[buf_idx];
-	if (stats_buf->state == MSM_STATS_BUFFER_STATE_UNUSED) {
-		pr_err("%s: need reqbuf first, stats type = %d",
-			__func__, stats_type);
-		rc = -1;
-		goto end;
-	}
-	if (stats_buf->state == MSM_STATS_BUFFER_STATE_INITIALIZED) {
-		D("%s: stats already mapped, no op, stats type = %d",
-			__func__, stats_type);
-		goto end;
-	}
-#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_unmap_iommu(client, stats_buf->handle,
-					domain_num, 0);
-	ion_free(client, stats_buf->handle);
-#else
-	put_pmem_file(stats_buf->file);
-#endif
-	if (stats_buf->state == MSM_STATS_BUFFER_STATE_QUEUED) {
-		/* buf queued need delete from list */
-		D("%s: delete stats buf, type = %d, idx = %d",
-		  __func__,  stats_type,  buf_idx);
-		list_del_init(&stats_buf->list);
-	}
-end:
-	return rc;
-}
-
-static int msm_stats_bufq_flush(struct msm_stats_bufq_ctrl *stats_ctrl,
-	enum msm_stats_enum_type stats_type, struct ion_client *client)
-{
-	int rc = 0;
-	int i;
-	struct msm_stats_bufq *bufq = NULL;
-	struct msm_stats_meta_buf *stats_buf = NULL;
-
-	if(stats_ctrl)
-		bufq = stats_ctrl->bufq[stats_type];
-	if(!bufq) {
-		pr_err("%s:%d bufq is NULL stats_ctrl :%x\n", __func__, __LINE__,
-			(unsigned int)stats_ctrl);
-		rc = -1;
-		return rc;
-	}
-
-	for (i = 0; i < bufq->num_bufs; i++) {
-		stats_buf = &bufq->bufs[i];
-		switch (stats_buf->state) {
-		case MSM_STATS_BUFFER_STATE_QUEUED:
-			/* buf queued in stats free queue */
-			stats_buf->state = MSM_STATS_BUFFER_STATE_PREPARED;
-			list_del_init(&stats_buf->list);
-			break;
-		case MSM_STATS_BUFFER_STATE_DEQUEUED:
-			/* if stats buf in VFE reset the state */
-			stats_buf->state = MSM_STATS_BUFFER_STATE_PREPARED;
-			break;
-		case MSM_STATS_BUFFER_STATE_DISPATCHED:
-			/* if stats buf in userspace reset the state */
-			stats_buf->state = MSM_STATS_BUFFER_STATE_PREPARED;
-			break;
-		default:
-			break;
-		}
-	}
-	return rc;
-}
-
-static int msm_stats_dqbuf(struct msm_stats_bufq_ctrl *stats_ctrl,
-	enum msm_stats_enum_type stats_type,
-	struct msm_stats_meta_buf **pp_stats_buf)
-{
-	int rc = 0;
-	struct msm_stats_bufq *bufq = NULL;
-	struct msm_stats_meta_buf *stats_buf = NULL;
-
-	D("%s: type : %d\n", __func__, stats_type);
-	*pp_stats_buf = NULL;
-	if(stats_ctrl)
-		bufq = stats_ctrl->bufq[stats_type];
-	if(!bufq) {
-		pr_err("%s:%d bufq is NULL stats_ctrl :%x\n", __func__, __LINE__,
-			(unsigned int)stats_ctrl);
-		rc = -1;
-		return rc;
-	}
-	bufq = stats_ctrl->bufq[stats_type];
-
-	list_for_each_entry(stats_buf, &bufq->head, list) {
-		if(!stats_buf)
-			return -1;
-		if (stats_buf->state == MSM_STATS_BUFFER_STATE_QUEUED) {
-			/* found one buf */
-			list_del_init(&stats_buf->list);
-			*pp_stats_buf = stats_buf;
-			break;
-		}
-	}
-	if (!(*pp_stats_buf)) {
-		D("%s: no free stats buf, type = %d",
-			__func__, stats_type);
-		rc = -1;
-		return rc;
-	}
-	stats_buf->state = MSM_STATS_BUFFER_STATE_DEQUEUED;
-	return rc;
-}
-
-
-static int msm_stats_querybuf(struct msm_stats_bufq_ctrl *stats_ctrl,
-	struct msm_stats_buf_info *info,
-	struct msm_stats_meta_buf **pp_stats_buf)
-{
-	int rc = 0;
-	struct msm_stats_bufq *bufq = NULL;
-
-	*pp_stats_buf = NULL;
-	D("%s: stats type : %d, buf_idx : %d", __func__, info->type,
-		   info->buf_idx);
-	if(stats_ctrl)
-		bufq = stats_ctrl->bufq[info->type];
-	if(!bufq) {
-		pr_err("%s:%d bufq is NULL stats_ctrl :%x\n", __func__, __LINE__,
-			(unsigned int)stats_ctrl);
-		rc = -1;
-		return rc;
-	}
-	bufq = stats_ctrl->bufq[info->type];
-	*pp_stats_buf = &bufq->bufs[info->buf_idx];
-
-	return rc;
-}
-
-static int msm_stats_qbuf(struct msm_stats_bufq_ctrl *stats_ctrl,
-	enum msm_stats_enum_type stats_type,
-	int buf_idx)
-{
-	int rc = 0;
-	struct msm_stats_bufq *bufq = NULL;
-	struct msm_stats_meta_buf *stats_buf = NULL;
-	D("%s: stats type : %d, buf_idx : %d", __func__, stats_type,
-		   buf_idx);
-
-	if(stats_ctrl)
-		bufq = stats_ctrl->bufq[stats_type];
-	if (!bufq) {
-		pr_err("%s: null bufq, stats type = %d", __func__, stats_type);
-		rc = -1;
-		goto end;
-	}
-	if (buf_idx >= bufq->num_bufs) {
-		pr_err("%s: stats type = %d, its idx %d larger than buf count %d",
-			   __func__, stats_type, buf_idx, bufq->num_bufs);
-		rc = -1;
-		goto end;
-	}
-	stats_buf = &bufq->bufs[buf_idx];
-	switch (stats_buf->state) {
-	case MSM_STATS_BUFFER_STATE_PREPARED:
-	case MSM_STATS_BUFFER_STATE_DEQUEUED:
-	case MSM_STATS_BUFFER_STATE_DISPATCHED:
-		stats_buf->state = MSM_STATS_BUFFER_STATE_QUEUED;
-		list_add_tail(&stats_buf->list, &bufq->head);
-		break;
-	default:
-		pr_err("%s: incorrect state = %d, stats type = %d, cannot qbuf",
-			   __func__, stats_buf->state, stats_type);
-		rc = -1;
-		break;
-	}
-end:
-	return rc;
-}
-
-static int msm_stats_buf_dispatch(struct msm_stats_bufq_ctrl *stats_ctrl,
-	enum msm_stats_enum_type stats_type,
-	unsigned long phy_addr, int *buf_idx,
-	void **vaddr, int *fd,
-	struct ion_client *client)
-{
-	int rc = 0;
-	int i;
-	struct msm_stats_bufq *bufq = NULL;
-	struct msm_stats_meta_buf *stats_buf = NULL;
-	D("%s: stats type : %d\n", __func__, stats_type);
-
-	*buf_idx = -1;
-	*vaddr = NULL;
-	*fd = 0;
-	if(stats_ctrl)
-	 	bufq = stats_ctrl->bufq[stats_type];
-	if(!bufq) {
-		pr_err("%s:%d bufq is NULL stats_ctrl :%x\n", __func__, __LINE__,
-			(unsigned int)stats_ctrl);
-		rc = -1;
-		return rc;
-	}
-
-	bufq = stats_ctrl->bufq[stats_type];
-	for (i = 0; i < bufq->num_bufs; i++) {
-		if (bufq->bufs[i].paddr == phy_addr) {
-			stats_buf = &bufq->bufs[i];
-			*buf_idx = i;
-			*vaddr = stats_buf->info.vaddr;
-			*fd = stats_buf->info.fd;
-			break;
-		}
-	}
-	if (!stats_buf) {
-		pr_err("%s: no match, phy_addr = 0x%ld, stats_type = %d",
-			   __func__, phy_addr, stats_type);
-		return -EFAULT;
-	}
-	switch (stats_buf->state) {
-	case MSM_STATS_BUFFER_STATE_DEQUEUED:
-		stats_buf->state = MSM_STATS_BUFFER_STATE_DISPATCHED;
-		break;
-	default:
-		pr_err("%s: type = %d, idx = %d, cur_state = %d,\n"
-			   "cannot set state to DISPATCHED\n",
-			   __func__, stats_type, *buf_idx, stats_buf->state);
-		rc = -EFAULT;
-		break;
-	}
-	return rc;
-}
-static int msm_stats_enqueue_buf(struct msm_stats_bufq_ctrl *stats_ctrl,
-	struct msm_stats_buf_info *info, struct ion_client *client,
-	int domain_num)
-{
-	int rc = 0;
-	D("%s: stats type : %d, idx : %d\n", __func__,
-		info->type, info->buf_idx);
-	rc = msm_stats_buf_prepare(stats_ctrl, info, client, domain_num);
-	if (rc < 0) {
-		pr_err("%s: buf_prepare failed, rc = %d", __func__, rc);
-		return -EINVAL;
-	}
-	rc = msm_stats_qbuf(stats_ctrl,   info->type, info->buf_idx);
-	if (rc < 0) {
-		pr_err("%s: msm_stats_qbuf failed, rc = %d", __func__, rc);
-		return -EINVAL;
-	}
-	return rc;
-}
-
-int msm_stats_buf_ops_init(struct msm_stats_bufq_ctrl *stats_ctrl,
-	struct ion_client *client, struct msm_stats_ops *ops)
-{
-	ops->stats_ctrl = stats_ctrl;
-	ops->client = client;
-	ops->enqueue_buf = msm_stats_enqueue_buf;
-	ops->qbuf = msm_stats_qbuf;
-	ops->dqbuf = msm_stats_dqbuf;
-	ops->bufq_flush = msm_stats_bufq_flush;
-	ops->buf_unprepare = msm_stats_buf_unprepare;
-	ops->buf_prepare = msm_stats_buf_prepare;
-	ops->reqbuf = msm_stats_reqbuf;
-	ops->querybuf = msm_stats_querybuf;
-	ops->dispatch = msm_stats_buf_dispatch;
-	ops->stats_ctrl_init = msm_stats_init;
-	ops->stats_ctrl_deinit = msm_stats_deinit;
-	return 0;
-}
-
diff --git a/drivers/media/video/msm/vfe/msm_vfe_stats_buf.h b/drivers/media/video/msm/vfe/msm_vfe_stats_buf.h
deleted file mode 100644
index 6a1c79d..0000000
--- a/drivers/media/video/msm/vfe/msm_vfe_stats_buf.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef _MSM_STATS_BUF_H_
-#define _MSM_STATS_BUF_H_
-
-enum msm_stats_buffer_state {
-	MSM_STATS_BUFFER_STATE_UNUSED,	  /* not used */
-	MSM_STATS_BUFFER_STATE_INITIALIZED,	   /* REQBUF done */
-	MSM_STATS_BUFFER_STATE_PREPARED,	/* BUF mapped */
-	MSM_STATS_BUFFER_STATE_QUEUED,	  /* buf queued */
-	MSM_STATS_BUFFER_STATE_DEQUEUED,	/* in use in VFE */
-	MSM_STATS_BUFFER_STATE_DISPATCHED,	  /* sent to userspace */
-};
-
-struct msm_stats_meta_buf {
-	struct list_head list;
-	enum msm_stats_buffer_state state;
-	int type;
-	int fd;
-	uint32_t offset;
-	unsigned long paddr;
-	unsigned long len;
-	struct file *file;
-	struct msm_stats_buf_info info;
-	struct ion_handle *handle;
-};
-
-struct msm_stats_bufq {
-	struct list_head head;
-	int num_bufs;
-	int type;
-	struct msm_stats_meta_buf *bufs;
-};
-
-
-struct msm_stats_bufq_ctrl {
-	/* not use spin lock for now. Assume vfe holds spin lock */
-	spinlock_t lock;
-	int init_done;
-	struct msm_stats_bufq *bufq[MSM_STATS_TYPE_MAX];
-};
-
-struct msm_stats_ops {
-	struct msm_stats_bufq_ctrl *stats_ctrl;
-	struct ion_client *client;
-	int (*enqueue_buf) (struct msm_stats_bufq_ctrl *stats_ctrl,
-				struct msm_stats_buf_info *info,
-				struct ion_client *client, int domain_num);
-	int (*qbuf) (struct msm_stats_bufq_ctrl *stats_ctrl,
-				 enum msm_stats_enum_type stats_type,
-				 int buf_idx);
-	int (*dqbuf) (struct msm_stats_bufq_ctrl *stats_ctrl,
-				  enum msm_stats_enum_type stats_type,
-				  struct msm_stats_meta_buf **pp_stats_buf);
-	int (*bufq_flush) (struct msm_stats_bufq_ctrl *stats_ctrl,
-					   enum msm_stats_enum_type stats_type,
-					   struct ion_client *client);
-	int (*buf_unprepare) (struct msm_stats_bufq_ctrl *stats_ctrl,
-		enum msm_stats_enum_type stats_type,
-		int buf_idx,
-		struct ion_client *client, int domain_num);
-	int (*buf_prepare) (struct msm_stats_bufq_ctrl *stats_ctrl,
-				struct msm_stats_buf_info *info,
-				struct ion_client *client, int domain_num);
-	int (*reqbuf) (struct msm_stats_bufq_ctrl *stats_ctrl,
-				   struct msm_stats_reqbuf *reqbuf,
-				   struct ion_client *client);
-	int (*dispatch) (struct msm_stats_bufq_ctrl *stats_ctrl,
-		enum msm_stats_enum_type stats_type,
-		unsigned long phy_addr, int *buf_idx, void **vaddr, int *fd,
-		struct ion_client *client);
-	int (*querybuf) (struct msm_stats_bufq_ctrl *stats_ctrl,
-		struct msm_stats_buf_info *info,
-		struct msm_stats_meta_buf **pp_stats_buf);
-	int (*stats_ctrl_init) (struct msm_stats_bufq_ctrl *stats_ctrl);
-	int (*stats_ctrl_deinit) (struct msm_stats_bufq_ctrl *stats_ctrl);
-};
-
-int msm_stats_buf_ops_init(struct msm_stats_bufq_ctrl *stats_ctrl,
-	struct ion_client *client, struct msm_stats_ops *ops);
-
-#endif /* _MSM_STATS_BUF_H_ */
diff --git a/drivers/media/video/msm/vx6953.c b/drivers/media/video/msm/vx6953.c
deleted file mode 100644
index cc09a0d..0000000
--- a/drivers/media/video/msm/vx6953.c
+++ /dev/null
@@ -1,3667 +0,0 @@
-/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <linux/module.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include <linux/slab.h>
-#include "vx6953.h"
-
-/*=============================================================
-	SENSOR REGISTER DEFINES
-==============================================================*/
-
-#define REG_GROUPED_PARAMETER_HOLD			0x0104
-#define GROUPED_PARAMETER_HOLD_OFF			0x00
-#define GROUPED_PARAMETER_HOLD				0x01
-#define REG_MODE_SELECT					0x0100
-#define MODE_SELECT_STANDBY_MODE			0x00
-#define MODE_SELECT_STREAM				0x01
-/* Integration Time */
-#define REG_COARSE_INTEGRATION_TIME_HI			0x0202
-#define REG_COARSE_INTEGRATION_TIME_LO			0x0203
-/* Gain */
-#define REG_ANALOGUE_GAIN_CODE_GLOBAL_HI		0x0204
-#define REG_ANALOGUE_GAIN_CODE_GLOBAL_LO		0x0205
-/* Digital Gain */
-#define REG_DIGITAL_GAIN_GREEN_R_HI			0x020E
-#define REG_DIGITAL_GAIN_GREEN_R_LO			0x020F
-#define REG_DIGITAL_GAIN_RED_HI				0x0210
-#define REG_DIGITAL_GAIN_RED_LO				0x0211
-#define REG_DIGITAL_GAIN_BLUE_HI			0x0212
-#define REG_DIGITAL_GAIN_BLUE_LO			0x0213
-#define REG_DIGITAL_GAIN_GREEN_B_HI			0x0214
-#define REG_DIGITAL_GAIN_GREEN_B_LO			0x0215
-/* output bits setting */
-#define REG_0x0112					0x0112
-#define REG_0x0113					0x0113
-/* PLL registers */
-#define REG_VT_PIX_CLK_DIV				0x0301
-#define REG_PRE_PLL_CLK_DIV				0x0305
-#define REG_PLL_MULTIPLIER				0x0307
-#define REG_OP_PIX_CLK_DIV				0x0309
-#define REG_0x034c					0x034c
-#define REG_0x034d					0x034d
-#define REG_0x034e					0x034e
-#define REG_0x034f					0x034f
-#define REG_0x0387					0x0387
-#define REG_0x0383					0x0383
-#define REG_FRAME_LENGTH_LINES_HI			0x0340
-#define REG_FRAME_LENGTH_LINES_LO			0x0341
-#define REG_LINE_LENGTH_PCK_HI				0x0342
-#define REG_LINE_LENGTH_PCK_LO				0x0343
-#define REG_0x3030					0x3030
-#define REG_0x0111					0x0111
-#define REG_0x0136					0x0136
-#define REG_0x0137					0x0137
-#define REG_0x0b00					0x0b00
-#define REG_0x3001					0x3001
-#define REG_0x3004					0x3004
-#define REG_0x3007					0x3007
-#define REG_0x301a					0x301a
-#define REG_0x3101					0x3101
-#define REG_0x3364					0x3364
-#define REG_0x3365					0x3365
-#define REG_0x0b83					0x0b83
-#define REG_0x0b84					0x0b84
-#define REG_0x0b85					0x0b85
-#define REG_0x0b88					0x0b88
-#define REG_0x0b89					0x0b89
-#define REG_0x0b8a					0x0b8a
-#define REG_0x3005					0x3005
-#define REG_0x3010					0x3010
-#define REG_0x3036					0x3036
-#define REG_0x3041					0x3041
-#define REG_0x0b80					0x0b80
-#define REG_0x0900					0x0900
-#define REG_0x0901					0x0901
-#define REG_0x0902					0x0902
-#define REG_0x3016					0x3016
-#define REG_0x301d					0x301d
-#define REG_0x317e					0x317e
-#define REG_0x317f					0x317f
-#define REG_0x3400					0x3400
-#define REG_0x303a					0x303a
-#define REG_0x1716					0x1716
-#define REG_0x1717					0x1717
-#define REG_0x1718					0x1718
-#define REG_0x1719					0x1719
-#define REG_0x3006					0x3006
-#define REG_0x301b					0x301b
-#define REG_0x3098					0x3098
-#define REG_0x309d					0x309d
-#define REG_0x3011					0x3011
-#define REG_0x3035					0x3035
-#define REG_0x3045					0x3045
-#define REG_0x3210					0x3210
-#define	REG_0x0111					0x0111
-#define REG_0x3410					0x3410
-#define REG_0x0b06					0x0b06
-#define REG_0x0b07					0x0b07
-#define REG_0x0b08					0x0b08
-#define REG_0x0b09					0x0b09
-#define REG_0x3640					0x3640
-/* Test Pattern */
-#define REG_TEST_PATTERN_MODE				0x0601
-
-/*============================================================================
-							 TYPE DECLARATIONS
-============================================================================*/
-
-/* 16bit address - 8 bit context register structure */
-#define	VX6953_STM5M0EDOF_OFFSET	9
-#define	Q8		0x00000100
-#define	Q10		0x00000400
-#define	VX6953_STM5M0EDOF_MAX_SNAPSHOT_EXPOSURE_LINE_COUNT	2922
-#define	VX6953_STM5M0EDOF_DEFAULT_MASTER_CLK_RATE	24000000
-#define	VX6953_STM5M0EDOF_OP_PIXEL_CLOCK_RATE	79800000
-#define	VX6953_STM5M0EDOF_VT_PIXEL_CLOCK_RATE	88670000
-/* Full	Size */
-#define	VX6953_FULL_SIZE_WIDTH	2608
-#define	VX6953_FULL_SIZE_HEIGHT		1960
-#define	VX6953_FULL_SIZE_DUMMY_PIXELS	1
-#define	VX6953_FULL_SIZE_DUMMY_LINES	0
-/* Quarter Size	*/
-#define	VX6953_QTR_SIZE_WIDTH	1304
-#define	VX6953_QTR_SIZE_HEIGHT		980
-#define	VX6953_QTR_SIZE_DUMMY_PIXELS	1
-#define	VX6953_QTR_SIZE_DUMMY_LINES		0
-/* Blanking	as measured	on the scope */
-/* Full	Size */
-#define	VX6953_HRZ_FULL_BLK_PIXELS	348
-#define	VX6953_VER_FULL_BLK_LINES	40
-/* Quarter Size	*/
-#define	VX6953_HRZ_QTR_BLK_PIXELS	1628
-#define	VX6953_VER_QTR_BLK_LINES	28
-#define	MAX_LINE_LENGTH_PCK		8190
-#define	MAX_FRAME_LENGTH_LINES	16383
-#define	VX6953_REVISION_NUMBER_CUT2	0x10/*revision number	for	Cut2.0*/
-#define	VX6953_REVISION_NUMBER_CUT3	0x20/*revision number	for	Cut3.0*/
-/* FIXME: Changes from here */
-struct vx6953_work_t {
-	struct work_struct work;
-};
-
-static struct vx6953_work_t *vx6953_sensorw;
-static struct i2c_client *vx6953_client;
-
-struct vx6953_ctrl_t {
-	const struct  msm_camera_sensor_info *sensordata;
-
-	uint32_t sensormode;
-	uint32_t fps_divider;   	/* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;  /* init to 1 * 0x00000400 */
-	uint16_t fps;
-
-	int16_t curr_lens_pos;
-	uint16_t curr_step_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint16_t total_lines_per_frame;
-
-	enum vx6953_resolution_t prev_res;
-	enum vx6953_resolution_t pict_res;
-	enum vx6953_resolution_t curr_res;
-	enum vx6953_test_mode_t  set_test;
-	enum sensor_revision_t sensor_type;
-
-	enum edof_mode_t edof_mode;
-
-	unsigned short imgaddr;
-};
-
-
-static uint8_t vx6953_stm5m0edof_delay_msecs_stdby;
-static uint16_t vx6953_stm5m0edof_delay_msecs_stream = 20;
-static uint8_t count;
-static struct vx6953_ctrl_t *vx6953_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(vx6953_wait_queue);
-DEFINE_MUTEX(vx6953_mut);
-static struct vx6953_i2c_reg_conf patch_tbl_cut2[] = {
-	{0xFB94, 0},	/*intialise Data Xfer Status reg*/
-	{0xFB95, 0},	/*gain 1	  (0x00)*/
-	{0xFB96, 0},	/*gain 1.07   (0x10)*/
-	{0xFB97, 0},	/*gain 1.14   (0x20)*/
-	{0xFB98, 0},	/*gain 1.23   (0x30)*/
-	{0xFB99, 0},	/*gain 1.33   (0x40)*/
-	{0xFB9A, 0},	/*gain 1.45   (0x50)*/
-	{0xFB9B, 0},	/*gain 1.6    (0x60)*/
-	{0xFB9C, 0},	/*gain 1.78   (0x70)*/
-	{0xFB9D, 2},	/*gain 2	  (0x80)*/
-	{0xFB9E, 2},	/*gain 2.29   (0x90)*/
-	{0xFB9F, 3},	/*gain 2.67   (0xA0)*/
-	{0xFBA0, 3},	/*gain 3.2    (0xB0)*/
-	{0xFBA1, 4},	/*gain 4	  (0xC0)*/
-	{0xFBA2, 7},	/*gain 5.33   (0xD0)*/
-	{0xFBA3, 10},	/*gain 8	  (0xE0)*/
-	{0xFBA4, 11},	/*gain 9.14   (0xE4)*/
-	{0xFBA5, 13},	/*gain 10.67  (0xE8)*/
-	{0xFBA6, 15},	/*gain 12.8   (0xEC)*/
-	{0xFBA7, 19},	/*gain 16     (0xF0)*/
-	{0xF800, 0x12},
-	{0xF801, 0x06},
-	{0xF802, 0xf7},
-	{0xF803, 0x90},
-	{0xF804, 0x02},
-	{0xF805, 0x05},
-	{0xF806, 0xe0},
-	{0xF807, 0xff},
-	{0xF808, 0x65},
-	{0xF809, 0x7d},
-	{0xF80A, 0x70},
-	{0xF80B, 0x03},
-	{0xF80C, 0x02},
-	{0xF80D, 0xf9},
-	{0xF80E, 0x1c},
-	{0xF80F, 0x8f},
-	{0xF810, 0x7d},
-	{0xF811, 0xe4},
-	{0xF812, 0xf5},
-	{0xF813, 0x7a},
-	{0xF814, 0x75},
-	{0xF815, 0x78},
-	{0xF816, 0x30},
-	{0xF817, 0x75},
-	{0xF818, 0x79},
-	{0xF819, 0x53},
-	{0xF81A, 0x85},
-	{0xF81B, 0x79},
-	{0xF81C, 0x82},
-	{0xF81D, 0x85},
-	{0xF81E, 0x78},
-	{0xF81F, 0x83},
-	{0xF820, 0xe0},
-	{0xF821, 0xc3},
-	{0xF822, 0x95},
-	{0xF823, 0x7b},
-	{0xF824, 0xf0},
-	{0xF825, 0x74},
-	{0xF826, 0x02},
-	{0xF827, 0x25},
-	{0xF828, 0x79},
-	{0xF829, 0xf5},
-	{0xF82A, 0x79},
-	{0xF82B, 0xe4},
-	{0xF82C, 0x35},
-	{0xF82D, 0x78},
-	{0xF82E, 0xf5},
-	{0xF82F, 0x78},
-	{0xF830, 0x05},
-	{0xF831, 0x7a},
-	{0xF832, 0xe5},
-	{0xF833, 0x7a},
-	{0xF834, 0xb4},
-	{0xF835, 0x08},
-	{0xF836, 0xe3},
-	{0xF837, 0xe5},
-	{0xF838, 0x7d},
-	{0xF839, 0x70},
-	{0xF83A, 0x04},
-	{0xF83B, 0xff},
-	{0xF83C, 0x02},
-	{0xF83D, 0xf8},
-	{0xF83E, 0xe4},
-	{0xF83F, 0xe5},
-	{0xF840, 0x7d},
-	{0xF841, 0xb4},
-	{0xF842, 0x10},
-	{0xF843, 0x05},
-	{0xF844, 0x7f},
-	{0xF845, 0x01},
-	{0xF846, 0x02},
-	{0xF847, 0xf8},
-	{0xF848, 0xe4},
-	{0xF849, 0xe5},
-	{0xF84A, 0x7d},
-	{0xF84B, 0xb4},
-	{0xF84C, 0x20},
-	{0xF84D, 0x05},
-	{0xF84E, 0x7f},
-	{0xF84F, 0x02},
-	{0xF850, 0x02},
-	{0xF851, 0xf8},
-	{0xF852, 0xe4},
-	{0xF853, 0xe5},
-	{0xF854, 0x7d},
-	{0xF855, 0xb4},
-	{0xF856, 0x30},
-	{0xF857, 0x05},
-	{0xF858, 0x7f},
-	{0xF859, 0x03},
-	{0xF85A, 0x02},
-	{0xF85B, 0xf8},
-	{0xF85C, 0xe4},
-	{0xF85D, 0xe5},
-	{0xF85E, 0x7d},
-	{0xF85F, 0xb4},
-	{0xF860, 0x40},
-	{0xF861, 0x04},
-	{0xF862, 0x7f},
-	{0xF863, 0x04},
-	{0xF864, 0x80},
-	{0xF865, 0x7e},
-	{0xF866, 0xe5},
-	{0xF867, 0x7d},
-	{0xF868, 0xb4},
-	{0xF869, 0x50},
-	{0xF86A, 0x04},
-	{0xF86B, 0x7f},
-	{0xF86C, 0x05},
-	{0xF86D, 0x80},
-	{0xF86E, 0x75},
-	{0xF86F, 0xe5},
-	{0xF870, 0x7d},
-	{0xF871, 0xb4},
-	{0xF872, 0x60},
-	{0xF873, 0x04},
-	{0xF874, 0x7f},
-	{0xF875, 0x06},
-	{0xF876, 0x80},
-	{0xF877, 0x6c},
-	{0xF878, 0xe5},
-	{0xF879, 0x7d},
-	{0xF87A, 0xb4},
-	{0xF87B, 0x70},
-	{0xF87C, 0x04},
-	{0xF87D, 0x7f},
-	{0xF87E, 0x07},
-	{0xF87F, 0x80},
-	{0xF880, 0x63},
-	{0xF881, 0xe5},
-	{0xF882, 0x7d},
-	{0xF883, 0xb4},
-	{0xF884, 0x80},
-	{0xF885, 0x04},
-	{0xF886, 0x7f},
-	{0xF887, 0x08},
-	{0xF888, 0x80},
-	{0xF889, 0x5a},
-	{0xF88A, 0xe5},
-	{0xF88B, 0x7d},
-	{0xF88C, 0xb4},
-	{0xF88D, 0x90},
-	{0xF88E, 0x04},
-	{0xF88F, 0x7f},
-	{0xF890, 0x09},
-	{0xF891, 0x80},
-	{0xF892, 0x51},
-	{0xF893, 0xe5},
-	{0xF894, 0x7d},
-	{0xF895, 0xb4},
-	{0xF896, 0xa0},
-	{0xF897, 0x04},
-	{0xF898, 0x7f},
-	{0xF899, 0x0a},
-	{0xF89A, 0x80},
-	{0xF89B, 0x48},
-	{0xF89C, 0xe5},
-	{0xF89D, 0x7d},
-	{0xF89E, 0xb4},
-	{0xF89F, 0xb0},
-	{0xF8A0, 0x04},
-	{0xF8A1, 0x7f},
-	{0xF8A2, 0x0b},
-	{0xF8A3, 0x80},
-	{0xF8A4, 0x3f},
-	{0xF8A5, 0xe5},
-	{0xF8A6, 0x7d},
-	{0xF8A7, 0xb4},
-	{0xF8A8, 0xc0},
-	{0xF8A9, 0x04},
-	{0xF8AA, 0x7f},
-	{0xF8AB, 0x0c},
-	{0xF8AC, 0x80},
-	{0xF8AD, 0x36},
-	{0xF8AE, 0xe5},
-	{0xF8AF, 0x7d},
-	{0xF8B0, 0xb4},
-	{0xF8B1, 0xd0},
-	{0xF8B2, 0x04},
-	{0xF8B3, 0x7f},
-	{0xF8B4, 0x0d},
-	{0xF8B5, 0x80},
-	{0xF8B6, 0x2d},
-	{0xF8B7, 0xe5},
-	{0xF8B8, 0x7d},
-	{0xF8B9, 0xb4},
-	{0xF8BA, 0xe0},
-	{0xF8BB, 0x04},
-	{0xF8BC, 0x7f},
-	{0xF8BD, 0x0e},
-	{0xF8BE, 0x80},
-	{0xF8BF, 0x24},
-	{0xF8C0, 0xe5},
-	{0xF8C1, 0x7d},
-	{0xF8C2, 0xb4},
-	{0xF8C3, 0xe4},
-	{0xF8C4, 0x04},
-	{0xF8C5, 0x7f},
-	{0xF8C6, 0x0f},
-	{0xF8C7, 0x80},
-	{0xF8C8, 0x1b},
-	{0xF8C9, 0xe5},
-	{0xF8CA, 0x7d},
-	{0xF8CB, 0xb4},
-	{0xF8CC, 0xe8},
-	{0xF8CD, 0x04},
-	{0xF8CE, 0x7f},
-	{0xF8CF, 0x10},
-	{0xF8D0, 0x80},
-	{0xF8D1, 0x12},
-	{0xF8D2, 0xe5},
-	{0xF8D3, 0x7d},
-	{0xF8D4, 0xb4},
-	{0xF8D5, 0xec},
-	{0xF8D6, 0x04},
-	{0xF8D7, 0x7f},
-	{0xF8D8, 0x11},
-	{0xF8D9, 0x80},
-	{0xF8DA, 0x09},
-	{0xF8DB, 0xe5},
-	{0xF8DC, 0x7d},
-	{0xF8DD, 0x7f},
-	{0xF8DE, 0x00},
-	{0xF8DF, 0xb4},
-	{0xF8E0, 0xf0},
-	{0xF8E1, 0x02},
-	{0xF8E2, 0x7f},
-	{0xF8E3, 0x12},
-	{0xF8E4, 0x8f},
-	{0xF8E5, 0x7c},
-	{0xF8E6, 0xef},
-	{0xF8E7, 0x24},
-	{0xF8E8, 0x95},
-	{0xF8E9, 0xff},
-	{0xF8EA, 0xe4},
-	{0xF8EB, 0x34},
-	{0xF8EC, 0xfb},
-	{0xF8ED, 0x8f},
-	{0xF8EE, 0x82},
-	{0xF8EF, 0xf5},
-	{0xF8F0, 0x83},
-	{0xF8F1, 0xe4},
-	{0xF8F2, 0x93},
-	{0xF8F3, 0xf5},
-	{0xF8F4, 0x7c},
-	{0xF8F5, 0xf5},
-	{0xF8F6, 0x7b},
-	{0xF8F7, 0xe4},
-	{0xF8F8, 0xf5},
-	{0xF8F9, 0x7a},
-	{0xF8FA, 0x75},
-	{0xF8FB, 0x78},
-	{0xF8FC, 0x30},
-	{0xF8FD, 0x75},
-	{0xF8FE, 0x79},
-	{0xF8FF, 0x53},
-	{0xF900, 0x85},
-	{0xF901, 0x79},
-	{0xF902, 0x82},
-	{0xF903, 0x85},
-	{0xF904, 0x78},
-	{0xF905, 0x83},
-	{0xF906, 0xe0},
-	{0xF907, 0x25},
-	{0xF908, 0x7c},
-	{0xF909, 0xf0},
-	{0xF90A, 0x74},
-	{0xF90B, 0x02},
-	{0xF90C, 0x25},
-	{0xF90D, 0x79},
-	{0xF90E, 0xf5},
-	{0xF90F, 0x79},
-	{0xF910, 0xe4},
-	{0xF911, 0x35},
-	{0xF912, 0x78},
-	{0xF913, 0xf5},
-	{0xF914, 0x78},
-	{0xF915, 0x05},
-	{0xF916, 0x7a},
-	{0xF917, 0xe5},
-	{0xF918, 0x7a},
-	{0xF919, 0xb4},
-	{0xF91A, 0x08},
-	{0xF91B, 0xe4},
-	{0xF91C, 0x02},
-	{0xF91D, 0x18},
-	{0xF91E, 0x32},
-	{0xF91F, 0x22},
-	{0xF920, 0xf0},
-	{0xF921, 0x90},
-	{0xF922, 0xa0},
-	{0xF923, 0xf8},
-	{0xF924, 0xe0},
-	{0xF925, 0x70},
-	{0xF926, 0x02},
-	{0xF927, 0xa3},
-	{0xF928, 0xe0},
-	{0xF929, 0x70},
-	{0xF92A, 0x0a},
-	{0xF92B, 0x90},
-	{0xF92C, 0xa1},
-	{0xF92D, 0x10},
-	{0xF92E, 0xe0},
-	{0xF92F, 0xfe},
-	{0xF930, 0xa3},
-	{0xF931, 0xe0},
-	{0xF932, 0xff},
-	{0xF933, 0x80},
-	{0xF934, 0x04},
-	{0xF935, 0x7e},
-	{0xF936, 0x00},
-	{0xF937, 0x7f},
-	{0xF938, 0x00},
-	{0xF939, 0x8e},
-	{0xF93A, 0x7e},
-	{0xF93B, 0x8f},
-	{0xF93C, 0x7f},
-	{0xF93D, 0x90},
-	{0xF93E, 0x36},
-	{0xF93F, 0x0d},
-	{0xF940, 0xe0},
-	{0xF941, 0x44},
-	{0xF942, 0x02},
-	{0xF943, 0xf0},
-	{0xF944, 0x90},
-	{0xF945, 0x36},
-	{0xF946, 0x0e},
-	{0xF947, 0xe5},
-	{0xF948, 0x7e},
-	{0xF949, 0xf0},
-	{0xF94A, 0xa3},
-	{0xF94B, 0xe5},
-	{0xF94C, 0x7f},
-	{0xF94D, 0xf0},
-	{0xF94E, 0xe5},
-	{0xF94F, 0x3a},
-	{0xF950, 0x60},
-	{0xF951, 0x0c},
-	{0xF952, 0x90},
-	{0xF953, 0x36},
-	{0xF954, 0x09},
-	{0xF955, 0xe0},
-	{0xF956, 0x70},
-	{0xF957, 0x06},
-	{0xF958, 0x90},
-	{0xF959, 0x36},
-	{0xF95A, 0x08},
-	{0xF95B, 0xf0},
-	{0xF95C, 0xf5},
-	{0xF95D, 0x3a},
-	{0xF95E, 0x02},
-	{0xF95F, 0x03},
-	{0xF960, 0x94},
-	{0xF961, 0x22},
-	{0xF962, 0x78},
-	{0xF963, 0x07},
-	{0xF964, 0xe6},
-	{0xF965, 0xd3},
-	{0xF966, 0x94},
-	{0xF967, 0x00},
-	{0xF968, 0x40},
-	{0xF969, 0x16},
-	{0xF96A, 0x16},
-	{0xF96B, 0xe6},
-	{0xF96C, 0x90},
-	{0xF96D, 0x30},
-	{0xF96E, 0xa1},
-	{0xF96F, 0xf0},
-	{0xF970, 0x90},
-	{0xF971, 0x43},
-	{0xF972, 0x83},
-	{0xF973, 0xe0},
-	{0xF974, 0xb4},
-	{0xF975, 0x01},
-	{0xF976, 0x0f},
-	{0xF977, 0x90},
-	{0xF978, 0x43},
-	{0xF979, 0x87},
-	{0xF97A, 0xe0},
-	{0xF97B, 0xb4},
-	{0xF97C, 0x01},
-	{0xF97D, 0x08},
-	{0xF97E, 0x80},
-	{0xF97F, 0x00},
-	{0xF980, 0x90},
-	{0xF981, 0x30},
-	{0xF982, 0xa0},
-	{0xF983, 0x74},
-	{0xF984, 0x01},
-	{0xF985, 0xf0},
-	{0xF986, 0x22},
-	{0xF987, 0xf0},
-	{0xF988, 0x90},
-	{0xF989, 0x35},
-	{0xF98A, 0xba},
-	{0xF98B, 0xe0},
-	{0xF98C, 0xb4},
-	{0xF98D, 0x0a},
-	{0xF98E, 0x0d},
-	{0xF98F, 0xa3},
-	{0xF990, 0xe0},
-	{0xF991, 0xb4},
-	{0xF992, 0x01},
-	{0xF993, 0x08},
-	{0xF994, 0x90},
-	{0xF995, 0xfb},
-	{0xF996, 0x94},
-	{0xF997, 0xe0},
-	{0xF998, 0x90},
-	{0xF999, 0x35},
-	{0xF99A, 0xb8},
-	{0xF99B, 0xf0},
-	{0xF99C, 0xd0},
-	{0xF99D, 0xd0},
-	{0xF99E, 0xd0},
-	{0xF99F, 0x82},
-	{0xF9A0, 0xd0},
-	{0xF9A1, 0x83},
-	{0xF9A2, 0xd0},
-	{0xF9A3, 0xe0},
-	{0xF9A4, 0x32},
-	{0xF9A5, 0x22},
-	{0xF9A6, 0xe5},
-	{0xF9A7, 0x7f},
-	{0xF9A8, 0x45},
-	{0xF9A9, 0x7e},
-	{0xF9AA, 0x60},
-	{0xF9AB, 0x15},
-	{0xF9AC, 0x90},
-	{0xF9AD, 0x01},
-	{0xF9AE, 0x00},
-	{0xF9AF, 0xe0},
-	{0xF9B0, 0x70},
-	{0xF9B1, 0x0f},
-	{0xF9B2, 0x90},
-	{0xF9B3, 0xa0},
-	{0xF9B4, 0xf8},
-	{0xF9B5, 0xe5},
-	{0xF9B6, 0x7e},
-	{0xF9B7, 0xf0},
-	{0xF9B8, 0xa3},
-	{0xF9B9, 0xe5},
-	{0xF9BA, 0x7f},
-	{0xF9BB, 0xf0},
-	{0xF9BC, 0xe4},
-	{0xF9BD, 0xf5},
-	{0xF9BE, 0x7e},
-	{0xF9BF, 0xf5},
-	{0xF9C0, 0x7f},
-	{0xF9C1, 0x22},
-	{0xF9C2, 0x02},
-	{0xF9C3, 0x0e},
-	{0xF9C4, 0x79},
-	{0xF9C5, 0x22},
-	/* Offsets:*/
-	{0x35C6, 0x00},/* FIDDLEDARKCAL*/
-	{0x35C7, 0x00},
-	{0x35C8, 0x01},/*STOREDISTANCEATSTOPSTREAMING*/
-	{0x35C9, 0x20},
-	{0x35CA, 0x01},/*BRUCEFIX*/
-	{0x35CB, 0x62},
-	{0x35CC, 0x01},/*FIXDATAXFERSTATUSREG*/
-	{0x35CD, 0x87},
-	{0x35CE, 0x01},/*FOCUSDISTANCEUPDATE*/
-	{0x35CF, 0xA6},
-	{0x35D0, 0x01},/*SKIPEDOFRESET*/
-	{0x35D1, 0xC2},
-	{0x35D2, 0x00},
-	{0x35D3, 0xFB},
-	{0x35D4, 0x00},
-	{0x35D5, 0x94},
-	{0x35D6, 0x00},
-	{0x35D7, 0xFB},
-	{0x35D8, 0x00},
-	{0x35D9, 0x94},
-	{0x35DA, 0x00},
-	{0x35DB, 0xFB},
-	{0x35DC, 0x00},
-	{0x35DD, 0x94},
-	{0x35DE, 0x00},
-	{0x35DF, 0xFB},
-	{0x35E0, 0x00},
-	{0x35E1, 0x94},
-	{0x35E6, 0x18},/* FIDDLEDARKCAL*/
-	{0x35E7, 0x2F},
-	{0x35E8, 0x03},/* STOREDISTANCEATSTOPSTREAMING*/
-	{0x35E9, 0x93},
-	{0x35EA, 0x18},/* BRUCEFIX*/
-	{0x35EB, 0x99},
-	{0x35EC, 0x00},/* FIXDATAXFERSTATUSREG*/
-	{0x35ED, 0xA3},
-	{0x35EE, 0x21},/* FOCUSDISTANCEUPDATE*/
-	{0x35EF, 0x5B},
-	{0x35F0, 0x0E},/* SKIPEDOFRESET*/
-	{0x35F1, 0x74},
-	{0x35F2, 0x04},
-	{0x35F3, 0x64},
-	{0x35F4, 0x04},
-	{0x35F5, 0x65},
-	{0x35F6, 0x04},
-	{0x35F7, 0x7B},
-	{0x35F8, 0x04},
-	{0x35F9, 0x7C},
-	{0x35FA, 0x04},
-	{0x35FB, 0xDD},
-	{0x35FC, 0x04},
-	{0x35FD, 0xDE},
-	{0x35FE, 0x04},
-	{0x35FF, 0xEF},
-	{0x3600, 0x04},
-	{0x3601, 0xF0},
-	/*Jump/Data:*/
-	{0x35C2, 0x3F},/* Jump Reg*/
-	{0x35C3, 0xFF},/* Jump Reg*/
-	{0x35C4, 0x3F},/* Data Reg*/
-	{0x35C5, 0xC0},/* Data Reg*/
-	{0x35C0, 0x01},/* Enable*/
-
-};
-
-static struct vx6953_i2c_reg_conf cut3_cali_data[] = {
-		{0x360A, 0x07 },
-		{0x3530, 0x07 },
-		{0x35B5, 0x00 },
-		{0x35BC, 0x00 },
-		{0xAFF8, 0x00 },
-		{0xAFF9, 0x01 },
-		{0xF800, 0x90 },
-		{0xF801, 0x30 },
-		{0xF802, 0x31 },
-		{0xF803, 0xe0 },
-		{0xF804, 0xf5 },
-		{0xF805, 0x7d },
-		{0xF806, 0xb4 },
-		{0xF807, 0x01 },
-		{0xF808, 0x06 },
-		{0xF809, 0x75 },
-		{0xF80A, 0x7d },
-		{0xF80B, 0x03 },
-		{0xF80C, 0x74 },
-		{0xF80D, 0x03 },
-		{0xF80E, 0xf0 },
-		{0xF80F, 0x90 },
-		{0xF810, 0x30 },
-		{0xF811, 0x04 },
-		{0xF812, 0x74 },
-		{0xF813, 0x33 },
-		{0xF814, 0xf0 },
-		{0xF815, 0x90 },
-		{0xF816, 0x30 },
-		{0xF817, 0x06 },
-		{0xF818, 0xe4 },
-		{0xF819, 0xf0 },
-		{0xF81A, 0xa3 },
-		{0xF81B, 0x74 },
-		{0xF81C, 0x08 },
-		{0xF81D, 0xf0 },
-		{0xF81E, 0x90 },
-		{0xF81F, 0x30 },
-		{0xF820, 0x10 },
-		{0xF821, 0xe4 },
-		{0xF822, 0xf0 },
-		{0xF823, 0xa3 },
-		{0xF824, 0xf0 },
-		{0xF825, 0x90 },
-		{0xF826, 0x30 },
-		{0xF827, 0x16 },
-		{0xF828, 0x74 },
-		{0xF829, 0x1e },
-		{0xF82A, 0xf0 },
-		{0xF82B, 0x90 },
-		{0xF82C, 0x30 },
-		{0xF82D, 0x1a },
-		{0xF82E, 0x74 },
-		{0xF82F, 0x6a },
-		{0xF830, 0xf0 },
-		{0xF831, 0x90 },
-		{0xF832, 0x30 },
-		{0xF833, 0x30 },
-		{0xF834, 0x74 },
-		{0xF835, 0x08 },
-		{0xF836, 0xf0 },
-		{0xF837, 0x90 },
-		{0xF838, 0x30 },
-		{0xF839, 0x36 },
-		{0xF83A, 0x74 },
-		{0xF83B, 0x2c },
-		{0xF83C, 0xf0 },
-		{0xF83D, 0x90 },
-		{0xF83E, 0x30 },
-		{0xF83F, 0x41 },
-		{0xF840, 0xe4 },
-		{0xF841, 0xf0 },
-		{0xF842, 0xa3 },
-		{0xF843, 0x74 },
-		{0xF844, 0x24 },
-		{0xF845, 0xf0 },
-		{0xF846, 0x90 },
-		{0xF847, 0x30 },
-		{0xF848, 0x45 },
-		{0xF849, 0x74 },
-		{0xF84A, 0x81 },
-		{0xF84B, 0xf0 },
-		{0xF84C, 0x90 },
-		{0xF84D, 0x30 },
-		{0xF84E, 0x98 },
-		{0xF84F, 0x74 },
-		{0xF850, 0x01 },
-		{0xF851, 0xf0 },
-		{0xF852, 0x90 },
-		{0xF853, 0x30 },
-		{0xF854, 0x9d },
-		{0xF855, 0x74 },
-		{0xF856, 0x05 },
-		{0xF857, 0xf0 },
-		{0xF858, 0xe5 },
-		{0xF859, 0x7d },
-		{0xF85A, 0x70 },
-		{0xF85B, 0x22 },
-		{0xF85C, 0x90 },
-		{0xF85D, 0x02 },
-		{0xF85E, 0x00 },
-		{0xF85F, 0x74 },
-		{0xF860, 0x02 },
-		{0xF861, 0xf0 },
-		{0xF862, 0xa3 },
-		{0xF863, 0x74 },
-		{0xF864, 0x54 },
-		{0xF865, 0xf0 },
-		{0xF866, 0x90 },
-		{0xF867, 0x30 },
-		{0xF868, 0x05 },
-		{0xF869, 0x74 },
-		{0xF86A, 0x01 },
-		{0xF86B, 0xf0 },
-		{0xF86C, 0x90 },
-		{0xF86D, 0x30 },
-		{0xF86E, 0x1b },
-		{0xF86F, 0x74 },
-		{0xF870, 0x29 },
-		{0xF871, 0xf0 },
-		{0xF872, 0x90 },
-		{0xF873, 0x30 },
-		{0xF874, 0x30 },
-		{0xF875, 0xe4 },
-		{0xF876, 0xf0 },
-		{0xF877, 0x90 },
-		{0xF878, 0x30 },
-		{0xF879, 0x35 },
-		{0xF87A, 0x04 },
-		{0xF87B, 0xf0 },
-		{0xF87C, 0x80 },
-		{0xF87D, 0x69 },
-		{0xF87E, 0xe5 },
-		{0xF87F, 0x7d },
-		{0xF880, 0x64 },
-		{0xF881, 0x02 },
-		{0xF882, 0x70 },
-		{0xF883, 0x3c },
-		{0xF884, 0x90 },
-		{0xF885, 0x02 },
-		{0xF886, 0x00 },
-		{0xF887, 0x74 },
-		{0xF888, 0x04 },
-		{0xF889, 0xf0 },
-		{0xF88A, 0xa3 },
-		{0xF88B, 0x74 },
-		{0xF88C, 0x10 },
-		{0xF88D, 0xf0 },
-		{0xF88E, 0x90 },
-		{0xF88F, 0x30 },
-		{0xF890, 0x04 },
-		{0xF891, 0x74 },
-		{0xF892, 0x34 },
-		{0xF893, 0xf0 },
-		{0xF894, 0xa3 },
-		{0xF895, 0x74 },
-		{0xF896, 0x07 },
-		{0xF897, 0xf0 },
-		{0xF898, 0x90 },
-		{0xF899, 0x30 },
-		{0xF89A, 0x10 },
-		{0xF89B, 0x74 },
-		{0xF89C, 0x10 },
-		{0xF89D, 0xf0 },
-		{0xF89E, 0x90 },
-		{0xF89F, 0x30 },
-		{0xF8A0, 0x16 },
-		{0xF8A1, 0x74 },
-		{0xF8A2, 0x1f },
-		{0xF8A3, 0xf0 },
-		{0xF8A4, 0x90 },
-		{0xF8A5, 0x30 },
-		{0xF8A6, 0x1a },
-		{0xF8A7, 0x74 },
-		{0xF8A8, 0x62 },
-		{0xF8A9, 0xf0 },
-		{0xF8AA, 0xa3 },
-		{0xF8AB, 0x74 },
-		{0xF8AC, 0x2a },
-		{0xF8AD, 0xf0 },
-		{0xF8AE, 0x90 },
-		{0xF8AF, 0x30 },
-		{0xF8B0, 0x35 },
-		{0xF8B1, 0x74 },
-		{0xF8B2, 0x04 },
-		{0xF8B3, 0xf0 },
-		{0xF8B4, 0x90 },
-		{0xF8B5, 0x30 },
-		{0xF8B6, 0x41 },
-		{0xF8B7, 0x74 },
-		{0xF8B8, 0x60 },
-		{0xF8B9, 0xf0 },
-		{0xF8BA, 0xa3 },
-		{0xF8BB, 0x74 },
-		{0xF8BC, 0x64 },
-		{0xF8BD, 0xf0 },
-		{0xF8BE, 0x80 },
-		{0xF8BF, 0x27 },
-		{0xF8C0, 0xe5 },
-		{0xF8C1, 0x7d },
-		{0xF8C2, 0xb4 },
-		{0xF8C3, 0x03 },
-		{0xF8C4, 0x22 },
-		{0xF8C5, 0x90 },
-		{0xF8C6, 0x02 },
-		{0xF8C7, 0x00 },
-		{0xF8C8, 0x74 },
-		{0xF8C9, 0x02 },
-		{0xF8CA, 0xf0 },
-		{0xF8CB, 0xa3 },
-		{0xF8CC, 0x74 },
-		{0xF8CD, 0x26 },
-		{0xF8CE, 0xf0 },
-		{0xF8CF, 0x90 },
-		{0xF8D0, 0x30 },
-		{0xF8D1, 0x05 },
-		{0xF8D2, 0x74 },
-		{0xF8D3, 0x03 },
-		{0xF8D4, 0xf0 },
-		{0xF8D5, 0x90 },
-		{0xF8D6, 0x30 },
-		{0xF8D7, 0x11 },
-		{0xF8D8, 0x74 },
-		{0xF8D9, 0x01 },
-		{0xF8DA, 0xf0 },
-		{0xF8DB, 0x90 },
-		{0xF8DC, 0x30 },
-		{0xF8DD, 0x1b },
-		{0xF8DE, 0x74 },
-		{0xF8DF, 0x2a },
-		{0xF8E0, 0xf0 },
-		{0xF8E1, 0x90 },
-		{0xF8E2, 0x30 },
-		{0xF8E3, 0x35 },
-		{0xF8E4, 0x74 },
-		{0xF8E5, 0x03 },
-		{0xF8E6, 0xf0 },
-		{0xF8E7, 0x90 },
-		{0xF8E8, 0x41 },
-		{0xF8E9, 0x01 },
-		{0xF8EA, 0xe0 },
-		{0xF8EB, 0xf5 },
-		{0xF8EC, 0x79 },
-		{0xF8ED, 0x90 },
-		{0xF8EE, 0x43 },
-		{0xF8EF, 0x87 },
-		{0xF8F0, 0xe0 },
-		{0xF8F1, 0xf5 },
-		{0xF8F2, 0x7a },
-		{0xF8F3, 0x90 },
-		{0xF8F4, 0x42 },
-		{0xF8F5, 0x05 },
-		{0xF8F6, 0xe0 },
-		{0xF8F7, 0xf5 },
-		{0xF8F8, 0x7b },
-		{0xF8F9, 0x22 },
-		{0xF8FA, 0x78 },
-		{0xF8FB, 0x07 },
-		{0xF8FC, 0xe6 },
-		{0xF8FD, 0xf5 },
-		{0xF8FE, 0x7c },
-		{0xF8FF, 0xe5 },
-		{0xF900, 0x7c },
-		{0xF901, 0x60 },
-		{0xF902, 0x1e },
-		{0xF903, 0x90 },
-		{0xF904, 0x43 },
-		{0xF905, 0x83 },
-		{0xF906, 0xe0 },
-		{0xF907, 0xb4 },
-		{0xF908, 0x01 },
-		{0xF909, 0x17 },
-		{0xF90A, 0x90 },
-		{0xF90B, 0x43 },
-		{0xF90C, 0x87 },
-		{0xF90D, 0xe0 },
-		{0xF90E, 0xb4 },
-		{0xF90F, 0x01 },
-		{0xF910, 0x10 },
-		{0xF911, 0x15 },
-		{0xF912, 0x7c },
-		{0xF913, 0x90 },
-		{0xF914, 0x30 },
-		{0xF915, 0xa1 },
-		{0xF916, 0xe5 },
-		{0xF917, 0x7c },
-		{0xF918, 0xf0 },
-		{0xF919, 0x90 },
-		{0xF91A, 0x30 },
-		{0xF91B, 0xa0 },
-		{0xF91C, 0x74 },
-		{0xF91D, 0x01 },
-		{0xF91E, 0xf0 },
-		{0xF91F, 0x80 },
-		{0xF920, 0x05 },
-		{0xF921, 0xe4 },
-		{0xF922, 0x90 },
-		{0xF923, 0x30 },
-		{0xF924, 0xa0 },
-		{0xF925, 0xf0 },
-		{0xF926, 0x90 },
-		{0xF927, 0x41 },
-		{0xF928, 0x01 },
-		{0xF929, 0xe0 },
-		{0xF92A, 0xfc },
-		{0xF92B, 0x54 },
-		{0xF92C, 0x02 },
-		{0xF92D, 0xfe },
-		{0xF92E, 0xe5 },
-		{0xF92F, 0x79 },
-		{0xF930, 0x54 },
-		{0xF931, 0x02 },
-		{0xF932, 0xb5 },
-		{0xF933, 0x06 },
-		{0xF934, 0x0f },
-		{0xF935, 0x90 },
-		{0xF936, 0x43 },
-		{0xF937, 0x87 },
-		{0xF938, 0xe0 },
-		{0xF939, 0xb5 },
-		{0xF93A, 0x7a },
-		{0xF93B, 0x08 },
-		{0xF93C, 0x90 },
-		{0xF93D, 0x42 },
-		{0xF93E, 0x05 },
-		{0xF93F, 0xe0 },
-		{0xF940, 0x65 },
-		{0xF941, 0x7b },
-		{0xF942, 0x60 },
-		{0xF943, 0x0b },
-		{0xF944, 0x90 },
-		{0xF945, 0x30 },
-		{0xF946, 0x50 },
-		{0xF947, 0xe0 },
-		{0xF948, 0x54 },
-		{0xF949, 0xf9 },
-		{0xF94A, 0x44 },
-		{0xF94B, 0x02 },
-		{0xF94C, 0xf0 },
-		{0xF94D, 0x80 },
-		{0xF94E, 0x09 },
-		{0xF94F, 0x90 },
-		{0xF950, 0x30 },
-		{0xF951, 0x50 },
-		{0xF952, 0xe0 },
-		{0xF953, 0x54 },
-		{0xF954, 0xf9 },
-		{0xF955, 0x44 },
-		{0xF956, 0x04 },
-		{0xF957, 0xf0 },
-		{0xF958, 0x8c },
-		{0xF959, 0x79 },
-		{0xF95A, 0x90 },
-		{0xF95B, 0x43 },
-		{0xF95C, 0x87 },
-		{0xF95D, 0xe0 },
-		{0xF95E, 0xf5 },
-		{0xF95F, 0x7a },
-		{0xF960, 0x90 },
-		{0xF961, 0x42 },
-		{0xF962, 0x05 },
-		{0xF963, 0xe0 },
-		{0xF964, 0xf5 },
-		{0xF965, 0x7b },
-		{0xF966, 0x22 },
-		{0xF967, 0xc3 },
-		{0xF968, 0x90 },
-		{0xF969, 0x0b },
-		{0xF96A, 0x89 },
-		{0xF96B, 0xe0 },
-		{0xF96C, 0x94 },
-		{0xF96D, 0x1e },
-		{0xF96E, 0x90 },
-		{0xF96F, 0x0b },
-		{0xF970, 0x88 },
-		{0xF971, 0xe0 },
-		{0xF972, 0x94 },
-		{0xF973, 0x00 },
-		{0xF974, 0x50 },
-		{0xF975, 0x06 },
-		{0xF976, 0x7e },
-		{0xF977, 0x00 },
-		{0xF978, 0x7f },
-		{0xF979, 0x01 },
-		{0xF97A, 0x80 },
-		{0xF97B, 0x3d },
-		{0xF97C, 0xc3 },
-		{0xF97D, 0x90 },
-		{0xF97E, 0x0b },
-		{0xF97F, 0x89 },
-		{0xF980, 0xe0 },
-		{0xF981, 0x94 },
-		{0xF982, 0x3c },
-		{0xF983, 0x90 },
-		{0xF984, 0x0b },
-		{0xF985, 0x88 },
-		{0xF986, 0xe0 },
-		{0xF987, 0x94 },
-		{0xF988, 0x00 },
-		{0xF989, 0x50 },
-		{0xF98A, 0x06 },
-		{0xF98B, 0x7e },
-		{0xF98C, 0x00 },
-		{0xF98D, 0x7f },
-		{0xF98E, 0x02 },
-		{0xF98F, 0x80 },
-		{0xF990, 0x28 },
-		{0xF991, 0xc3 },
-		{0xF992, 0x90 },
-		{0xF993, 0x0b },
-		{0xF994, 0x89 },
-		{0xF995, 0xe0 },
-		{0xF996, 0x94 },
-		{0xF997, 0xfa },
-		{0xF998, 0x90 },
-		{0xF999, 0x0b },
-		{0xF99A, 0x88 },
-		{0xF99B, 0xe0 },
-		{0xF99C, 0x94 },
-		{0xF99D, 0x00 },
-		{0xF99E, 0x50 },
-		{0xF99F, 0x06 },
-		{0xF9A0, 0x7e },
-		{0xF9A1, 0x00 },
-		{0xF9A2, 0x7f },
-		{0xF9A3, 0x03 },
-		{0xF9A4, 0x80 },
-		{0xF9A5, 0x13 },
-		{0xF9A6, 0xc3 },
-		{0xF9A7, 0x90 },
-		{0xF9A8, 0x0b },
-		{0xF9A9, 0x88 },
-		{0xF9AA, 0xe0 },
-		{0xF9AB, 0x94 },
-		{0xF9AC, 0x80 },
-		{0xF9AD, 0x50 },
-		{0xF9AE, 0x06 },
-		{0xF9AF, 0x7e },
-		{0xF9B0, 0x00 },
-		{0xF9B1, 0x7f },
-		{0xF9B2, 0x04 },
-		{0xF9B3, 0x80 },
-		{0xF9B4, 0x04 },
-		{0xF9B5, 0xae },
-		{0xF9B6, 0x7e },
-		{0xF9B7, 0xaf },
-		{0xF9B8, 0x7f },
-		{0xF9B9, 0x90 },
-		{0xF9BA, 0xa0 },
-		{0xF9BB, 0xf8 },
-		{0xF9BC, 0xee },
-		{0xF9BD, 0xf0 },
-		{0xF9BE, 0xa3 },
-		{0xF9BF, 0xef },
-		{0xF9C0, 0xf0 },
-		{0xF9C1, 0x22 },
-		{0xF9C2, 0x90 },
-		{0xF9C3, 0x33 },
-		{0xF9C4, 0x82 },
-		{0xF9C5, 0xe0 },
-		{0xF9C6, 0xff },
-		{0xF9C7, 0x64 },
-		{0xF9C8, 0x01 },
-		{0xF9C9, 0x70 },
-		{0xF9CA, 0x30 },
-		{0xF9CB, 0xe5 },
-		{0xF9CC, 0x7f },
-		{0xF9CD, 0x64 },
-		{0xF9CE, 0x02 },
-		{0xF9CF, 0x45 },
-		{0xF9D0, 0x7e },
-		{0xF9D1, 0x70 },
-		{0xF9D2, 0x04 },
-		{0xF9D3, 0x7d },
-		{0xF9D4, 0x1e },
-		{0xF9D5, 0x80 },
-		{0xF9D6, 0x1d },
-		{0xF9D7, 0xe5 },
-		{0xF9D8, 0x7f },
-		{0xF9D9, 0x64 },
-		{0xF9DA, 0x03 },
-		{0xF9DB, 0x45 },
-		{0xF9DC, 0x7e },
-		{0xF9DD, 0x70 },
-		{0xF9DE, 0x04 },
-		{0xF9DF, 0x7d },
-		{0xF9E0, 0x3c },
-		{0xF9E1, 0x80 },
-		{0xF9E2, 0x11 },
-		{0xF9E3, 0xe5 },
-		{0xF9E4, 0x7f },
-		{0xF9E5, 0x64 },
-		{0xF9E6, 0x04 },
-		{0xF9E7, 0x45 },
-		{0xF9E8, 0x7e },
-		{0xF9E9, 0x70 },
-		{0xF9EA, 0x04 },
-		{0xF9EB, 0x7d },
-		{0xF9EC, 0xfa },
-		{0xF9ED, 0x80 },
-		{0xF9EE, 0x05 },
-		{0xF9EF, 0x90 },
-		{0xF9F0, 0x33 },
-		{0xF9F1, 0x81 },
-		{0xF9F2, 0xe0 },
-		{0xF9F3, 0xfd },
-		{0xF9F4, 0xae },
-		{0xF9F5, 0x05 },
-		{0xF9F6, 0x90 },
-		{0xF9F7, 0x33 },
-		{0xF9F8, 0x81 },
-		{0xF9F9, 0xed },
-		{0xF9FA, 0xf0 },
-		{0xF9FB, 0xef },
-		{0xF9FC, 0xb4 },
-		{0xF9FD, 0x01 },
-		{0xF9FE, 0x10 },
-		{0xF9FF, 0x90 },
-		{0xFA00, 0x01 },
-		{0xFA01, 0x00 },
-		{0xFA02, 0xe0 },
-		{0xFA03, 0x60 },
-		{0xFA04, 0x0a },
-		{0xFA05, 0x90 },
-		{0xFA06, 0xa1 },
-		{0xFA07, 0x10 },
-		{0xFA08, 0xe0 },
-		{0xFA09, 0xf5 },
-		{0xFA0A, 0x7e },
-		{0xFA0B, 0xa3 },
-		{0xFA0C, 0xe0 },
-		{0xFA0D, 0xf5 },
-		{0xFA0E, 0x7f },
-		{0xFA0F, 0x22 },
-		{0xFA10, 0x12 },
-		{0xFA11, 0x2f },
-		{0xFA12, 0x4d },
-		{0xFA13, 0x90 },
-		{0xFA14, 0x35 },
-		{0xFA15, 0x38 },
-		{0xFA16, 0xe0 },
-		{0xFA17, 0x70 },
-		{0xFA18, 0x05 },
-		{0xFA19, 0x12 },
-		{0xFA1A, 0x00 },
-		{0xFA1B, 0x0e },
-		{0xFA1C, 0x80 },
-		{0xFA1D, 0x03 },
-		{0xFA1E, 0x12 },
-		{0xFA1F, 0x07 },
-		{0xFA20, 0xc9 },
-		{0xFA21, 0x90 },
-		{0xFA22, 0x40 },
-		{0xFA23, 0x06 },
-		{0xFA24, 0xe0 },
-		{0xFA25, 0xf4 },
-		{0xFA26, 0x54 },
-		{0xFA27, 0x02 },
-		{0xFA28, 0xff },
-		{0xFA29, 0xe0 },
-		{0xFA2A, 0x54 },
-		{0xFA2B, 0x01 },
-		{0xFA2C, 0x4f },
-		{0xFA2D, 0x90 },
-		{0xFA2E, 0x31 },
-		{0xFA2F, 0x32 },
-		{0xFA30, 0xf0 },
-		{0xFA31, 0x90 },
-		{0xFA32, 0xfa },
-		{0xFA33, 0x9d },
-		{0xFA34, 0xe0 },
-		{0xFA35, 0x70 },
-		{0xFA36, 0x03 },
-		{0xFA37, 0x12 },
-		{0xFA38, 0x27 },
-		{0xFA39, 0x27 },
-		{0xFA3A, 0x02 },
-		{0xFA3B, 0x05 },
-		{0xFA3C, 0xac },
-		{0xFA3D, 0x22 },
-		{0xFA3E, 0xf0 },
-		{0xFA3F, 0xe5 },
-		{0xFA40, 0x3a },
-		{0xFA41, 0xb4 },
-		{0xFA42, 0x06 },
-		{0xFA43, 0x06 },
-		{0xFA44, 0x63 },
-		{0xFA45, 0x3e },
-		{0xFA46, 0x02 },
-		{0xFA47, 0x12 },
-		{0xFA48, 0x03 },
-		{0xFA49, 0xea },
-		{0xFA4A, 0x02 },
-		{0xFA4B, 0x17 },
-		{0xFA4C, 0x4a },
-		{0xFA4D, 0x22 },
-		{0x35C9, 0xFA },
-		{0x35CA, 0x01 },
-		{0x35CB, 0x67 },
-		{0x35CC, 0x01 },
-		{0x35CD, 0xC2 },
-		{0x35CE, 0x02 },
-		{0x35CF, 0x10 },
-		{0x35D0, 0x02 },
-		{0x35D1, 0x3E },
-		{0x35D3, 0xF6 },
-		{0x35D5, 0x07 },
-		{0x35D7, 0xA3 },
-		{0x35DB, 0x02 },
-		{0x35DD, 0x06 },
-		{0x35DF, 0x27 },
-		{0x35E6, 0x28 },
-		{0x35E7, 0x76 },
-		{0x35E8, 0x2A },
-		{0x35E9, 0x15 },
-		{0x35EA, 0x2D },
-		{0x35EB, 0x07 },
-		{0x35EC, 0x04 },
-		{0x35ED, 0x43 },
-		{0x35EE, 0x05 },
-		{0x35EF, 0xA9 },
-		{0x35F0, 0x17 },
-		{0x35F1, 0x41 },
-		{0x35F2, 0x24 },
-		{0x35F3, 0x88 },
-		{0x35F4, 0x01 },
-		{0x35F5, 0x54 },
-		{0x35F6, 0x01 },
-		{0x35F7, 0x55 },
-		{0x35F8, 0x2E },
-		{0x35F9, 0xF2 },
-		{0x35FA, 0x06 },
-		{0x35FB, 0x02 },
-		{0x35FC, 0x06 },
-		{0x35FD, 0x03 },
-		{0x35FE, 0x06 },
-		{0x35FF, 0x04 },
-		{0x3600, 0x0F },
-		{0x3601, 0x48 },
-		{0x3602, 0x0F },
-		{0x3603, 0x49 },
-		{0x3604, 0x0F },
-		{0x3605, 0x4A },
-		{0x35C2, 0xFF },
-		{0x35C3, 0xFF },
-		{0x35C4, 0xFF },
-		{0x35C5, 0xC0 },
-		{0x35C0, 0x01 },
-
-
-		{0xa098, 0x02 },
-		{0xa099, 0x87 },
-		{0xa09c, 0x00 },
-		{0xa09d, 0xc5 },
-		{0xa4ec, 0x05 },
-		{0xa4ed, 0x05 },
-		{0xa4f0, 0x04 },
-		{0xa4f1, 0x04 },
-		{0xa4f4, 0x04 },
-		{0xa4f5, 0x05 },
-		{0xa4f8, 0x05 },
-		{0xa4f9, 0x07 },
-		{0xa4fc, 0x07 },
-		{0xa4fd, 0x07 },
-		{0xa500, 0x07 },
-		{0xa501, 0x07 },
-		{0xa504, 0x08 },
-		{0xa505, 0x08 },
-		{0xa518, 0x01 },
-		{0xa519, 0x02 },
-		{0xa51c, 0x01 },
-		{0xa51d, 0x00 },
-		{0xa534, 0x00 },
-		{0xa535, 0x04 },
-		{0xa538, 0x04 },
-		{0xa539, 0x03 },
-		{0xa53c, 0x05 },
-		{0xa53d, 0x07 },
-		{0xa540, 0x07 },
-		{0xa541, 0x06 },
-		{0xa544, 0x07 },
-		{0xa545, 0x06 },
-		{0xa548, 0x05 },
-		{0xa549, 0x06 },
-		{0xa54c, 0x06 },
-		{0xa54d, 0x07 },
-		{0xa550, 0x07 },
-		{0xa551, 0x04 },
-		{0xa554, 0x04 },
-		{0xa555, 0x04 },
-		{0xa558, 0x05 },
-		{0xa559, 0x06 },
-		{0xa55c, 0x07 },
-		{0xa55d, 0x07 },
-		{0xa56c, 0x00 },
-		{0xa56d, 0x0a },
-		{0xa570, 0x08 },
-		{0xa571, 0x05 },
-		{0xa574, 0x04 },
-		{0xa575, 0x03 },
-		{0xa578, 0x04 },
-		{0xa579, 0x04 },
-		{0xa58c, 0x1f },
-		{0xa58d, 0x1b },
-		{0xa590, 0x17 },
-		{0xa591, 0x13 },
-		{0xa594, 0x10 },
-		{0xa595, 0x0d },
-		{0xa598, 0x0f },
-		{0xa599, 0x11 },
-		{0xa59c, 0x03 },
-		{0xa59d, 0x03 },
-		{0xa5a0, 0x03 },
-		{0xa5a1, 0x03 },
-		{0xa5a4, 0x03 },
-		{0xa5a5, 0x04 },
-		{0xa5a8, 0x05 },
-		{0xa5a9, 0x00 },
-		{0xa5ac, 0x00 },
-		{0xa5ad, 0x00 },
-		{0xa5b0, 0x00 },
-		{0xa5b1, 0x00 },
-		{0xa5b4, 0x00 },
-		{0xa5b5, 0x00 },
-		{0xa5c4, 0x1f },
-		{0xa5c5, 0x13 },
-		{0xa5c8, 0x14 },
-		{0xa5c9, 0x14 },
-		{0xa5cc, 0x14 },
-		{0xa5cd, 0x13 },
-		{0xa5d0, 0x17 },
-		{0xa5d1, 0x1a },
-		{0xa5f4, 0x05 },
-		{0xa5f5, 0x05 },
-		{0xa5f8, 0x05 },
-		{0xa5f9, 0x06 },
-		{0xa5fc, 0x06 },
-		{0xa5fd, 0x06 },
-		{0xa600, 0x06 },
-		{0xa601, 0x06 },
-		{0xa608, 0x07 },
-		{0xa609, 0x08 },
-		{0xa60c, 0x08 },
-		{0xa60d, 0x07 },
-		{0xa63c, 0x00 },
-		{0xa63d, 0x02 },
-		{0xa640, 0x02 },
-		{0xa641, 0x02 },
-		{0xa644, 0x02 },
-		{0xa645, 0x02 },
-		{0xa648, 0x03 },
-		{0xa649, 0x04 },
-		{0xa64c, 0x0a },
-		{0xa64d, 0x09 },
-		{0xa650, 0x08 },
-		{0xa651, 0x09 },
-		{0xa654, 0x09 },
-		{0xa655, 0x0a },
-		{0xa658, 0x0a },
-		{0xa659, 0x0a },
-		{0xa65c, 0x0a },
-		{0xa65d, 0x09 },
-		{0xa660, 0x09 },
-		{0xa661, 0x09 },
-		{0xa664, 0x09 },
-		{0xa665, 0x08 },
-		{0xa680, 0x01 },
-		{0xa681, 0x02 },
-		{0xa694, 0x1f },
-		{0xa695, 0x10 },
-		{0xa698, 0x0e },
-		{0xa699, 0x0c },
-		{0xa69c, 0x0d },
-		{0xa69d, 0x0d },
-		{0xa6a0, 0x0f },
-		{0xa6a1, 0x11 },
-		{0xa6a4, 0x00 },
-		{0xa6a5, 0x00 },
-		{0xa6a8, 0x00 },
-		{0xa6a9, 0x00 },
-		{0xa6ac, 0x00 },
-		{0xa6ad, 0x00 },
-		{0xa6b0, 0x00 },
-		{0xa6b1, 0x04 },
-		{0xa6b4, 0x04 },
-		{0xa6b5, 0x04 },
-		{0xa6b8, 0x04 },
-		{0xa6b9, 0x04 },
-		{0xa6bc, 0x05 },
-		{0xa6bd, 0x05 },
-		{0xa6c0, 0x1f },
-		{0xa6c1, 0x1f },
-		{0xa6c4, 0x1f },
-		{0xa6c5, 0x1f },
-		{0xa6c8, 0x1f },
-		{0xa6c9, 0x1f },
-		{0xa6cc, 0x1f },
-		{0xa6cd, 0x0b },
-		{0xa6d0, 0x0c },
-		{0xa6d1, 0x0d },
-		{0xa6d4, 0x0d },
-		{0xa6d5, 0x0d },
-		{0xa6d8, 0x11 },
-		{0xa6d9, 0x14 },
-		{0xa6fc, 0x02 },
-		{0xa6fd, 0x03 },
-		{0xa700, 0x03 },
-		{0xa701, 0x03 },
-		{0xa704, 0x03 },
-		{0xa705, 0x04 },
-		{0xa708, 0x05 },
-		{0xa709, 0x02 },
-		{0xa70c, 0x02 },
-		{0xa70d, 0x02 },
-		{0xa710, 0x03 },
-		{0xa711, 0x04 },
-		{0xa714, 0x04 },
-		{0xa715, 0x04 },
-		{0xa744, 0x00 },
-		{0xa745, 0x03 },
-		{0xa748, 0x04 },
-		{0xa749, 0x04 },
-		{0xa74c, 0x05 },
-		{0xa74d, 0x06 },
-		{0xa750, 0x07 },
-		{0xa751, 0x07 },
-		{0xa754, 0x05 },
-		{0xa755, 0x05 },
-		{0xa758, 0x05 },
-		{0xa759, 0x05 },
-		{0xa75c, 0x05 },
-		{0xa75d, 0x06 },
-		{0xa760, 0x07 },
-		{0xa761, 0x07 },
-		{0xa764, 0x06 },
-		{0xa765, 0x05 },
-		{0xa768, 0x05 },
-		{0xa769, 0x05 },
-		{0xa76c, 0x06 },
-		{0xa76d, 0x07 },
-		{0xa77c, 0x00 },
-		{0xa77d, 0x05 },
-		{0xa780, 0x05 },
-		{0xa781, 0x05 },
-		{0xa784, 0x05 },
-		{0xa785, 0x04 },
-		{0xa788, 0x05 },
-		{0xa789, 0x06 },
-		{0xa79c, 0x1f },
-		{0xa79d, 0x15 },
-		{0xa7a0, 0x13 },
-		{0xa7a1, 0x10 },
-		{0xa7a4, 0x0f },
-		{0xa7a5, 0x0d },
-		{0xa7a8, 0x11 },
-		{0xa7a9, 0x14 },
-		{0xa7ac, 0x02 },
-		{0xa7ad, 0x02 },
-		{0xa7b0, 0x02 },
-		{0xa7b1, 0x02 },
-		{0xa7b4, 0x02 },
-		{0xa7b5, 0x03 },
-		{0xa7b8, 0x03 },
-		{0xa7b9, 0x00 },
-		{0xa7bc, 0x00 },
-		{0xa7bd, 0x00 },
-		{0xa7c0, 0x00 },
-		{0xa7c1, 0x00 },
-		{0xa7c4, 0x00 },
-		{0xa7c5, 0x00 },
-		{0xa7d4, 0x1f },
-		{0xa7d5, 0x0d },
-		{0xa7d8, 0x0f },
-		{0xa7d9, 0x10 },
-		{0xa7dc, 0x10 },
-		{0xa7dd, 0x10 },
-		{0xa7e0, 0x13 },
-		{0xa7e1, 0x16 },
-		{0xa7f4, 0x00 },
-		{0xa7f5, 0x03 },
-		{0xa7f8, 0x04 },
-		{0xa7f9, 0x04 },
-		{0xa7fc, 0x04 },
-		{0xa7fd, 0x03 },
-		{0xa800, 0x03 },
-		{0xa801, 0x03 },
-		{0xa804, 0x03 },
-		{0xa805, 0x03 },
-		{0xa808, 0x03 },
-		{0xa809, 0x03 },
-		{0xa80c, 0x03 },
-		{0xa80d, 0x04 },
-		{0xa810, 0x04 },
-		{0xa811, 0x0a },
-		{0xa814, 0x0a },
-		{0xa815, 0x0a },
-		{0xa818, 0x0f },
-		{0xa819, 0x14 },
-		{0xa81c, 0x14 },
-		{0xa81d, 0x14 },
-		{0xa82c, 0x00 },
-		{0xa82d, 0x04 },
-		{0xa830, 0x02 },
-		{0xa831, 0x00 },
-		{0xa834, 0x00 },
-		{0xa835, 0x00 },
-		{0xa838, 0x00 },
-		{0xa839, 0x00 },
-		{0xa840, 0x1f },
-		{0xa841, 0x1f },
-		{0xa848, 0x1f },
-		{0xa849, 0x1f },
-		{0xa84c, 0x1f },
-		{0xa84d, 0x0c },
-		{0xa850, 0x0c },
-		{0xa851, 0x0c },
-		{0xa854, 0x0c },
-		{0xa855, 0x0c },
-		{0xa858, 0x0c },
-		{0xa859, 0x0c },
-		{0xa85c, 0x0c },
-		{0xa85d, 0x0c },
-		{0xa860, 0x0c },
-		{0xa861, 0x0c },
-		{0xa864, 0x0c },
-		{0xa865, 0x0c },
-		{0xa868, 0x0c },
-		{0xa869, 0x0c },
-		{0xa86c, 0x0c },
-		{0xa86d, 0x0c },
-		{0xa870, 0x0c },
-		{0xa871, 0x0c },
-		{0xa874, 0x0c },
-		{0xa875, 0x0c },
-		{0xa878, 0x1f },
-		{0xa879, 0x1f },
-		{0xa87c, 0x1f },
-		{0xa87d, 0x1f },
-		{0xa880, 0x1f },
-		{0xa881, 0x1f },
-		{0xa884, 0x1f },
-		{0xa885, 0x0c },
-		{0xa888, 0x0c },
-		{0xa889, 0x0c },
-		{0xa88c, 0x0c },
-		{0xa88d, 0x0c },
-		{0xa890, 0x0c },
-		{0xa891, 0x0c },
-		{0xa898, 0x1f },
-		{0xa899, 0x1f },
-		{0xa8a0, 0x1f },
-		{0xa8a1, 0x1f },
-		{0xa8a4, 0x1f },
-		{0xa8a5, 0x0c },
-		{0xa8a8, 0x0c },
-		{0xa8a9, 0x0c },
-		{0xa8ac, 0x0c },
-		{0xa8ad, 0x0c },
-		{0xa8b0, 0x0c },
-		{0xa8b1, 0x0c },
-		{0xa8b4, 0x0c },
-		{0xa8b5, 0x0c },
-		{0xa8b8, 0x0c },
-		{0xa8b9, 0x0c },
-		{0xa8bc, 0x0c },
-		{0xa8bd, 0x0c },
-		{0xa8c0, 0x0c },
-		{0xa8c1, 0x0c },
-		{0xa8c4, 0x0c },
-		{0xa8c5, 0x0c },
-		{0xa8c8, 0x0c },
-		{0xa8c9, 0x0c },
-		{0xa8cc, 0x0c },
-		{0xa8cd, 0x0c },
-		{0xa8d0, 0x1f },
-		{0xa8d1, 0x1f },
-		{0xa8d4, 0x1f },
-		{0xa8d5, 0x1f },
-		{0xa8d8, 0x1f },
-		{0xa8d9, 0x1f },
-		{0xa8dc, 0x1f },
-		{0xa8dd, 0x0c },
-		{0xa8e0, 0x0c },
-		{0xa8e1, 0x0c },
-		{0xa8e4, 0x0c },
-		{0xa8e5, 0x0c },
-		{0xa8e8, 0x0c },
-		{0xa8e9, 0x0c },
-		{0xa8f0, 0x1f },
-		{0xa8f1, 0x1f },
-		{0xa8f8, 0x1f },
-		{0xa8f9, 0x1f },
-		{0xa8fc, 0x1f },
-		{0xa8fd, 0x0c },
-		{0xa900, 0x0c },
-		{0xa901, 0x0c },
-		{0xa904, 0x0c },
-		{0xa905, 0x0c },
-		{0xa908, 0x0c },
-		{0xa909, 0x0c },
-		{0xa90c, 0x0c },
-		{0xa90d, 0x0c },
-		{0xa910, 0x0c },
-		{0xa911, 0x0c },
-		{0xa914, 0x0c },
-		{0xa915, 0x0c },
-		{0xa918, 0x0c },
-		{0xa919, 0x0c },
-		{0xa91c, 0x0c },
-		{0xa91d, 0x0c },
-		{0xa920, 0x0c },
-		{0xa921, 0x0c },
-		{0xa924, 0x0c },
-		{0xa925, 0x0c },
-		{0xa928, 0x1f },
-		{0xa929, 0x1f },
-		{0xa92c, 0x1f },
-		{0xa92d, 0x1f },
-		{0xa930, 0x1f },
-		{0xa931, 0x1f },
-		{0xa934, 0x1f },
-		{0xa935, 0x0c },
-		{0xa938, 0x0c },
-		{0xa939, 0x0c },
-		{0xa93c, 0x0c },
-		{0xa93d, 0x0c },
-		{0xa940, 0x0c },
-		{0xa941, 0x0c },
-		{0xa96c, 0x0d },
-		{0xa96d, 0x16 },
-		{0xa970, 0x19 },
-		{0xa971, 0x0e },
-		{0xa974, 0x16 },
-		{0xa975, 0x1a },
-		{0xa978, 0x0d },
-		{0xa979, 0x15 },
-		{0xa97c, 0x19 },
-		{0xa97d, 0x0d },
-		{0xa980, 0x15 },
-		{0xa981, 0x1a },
-		{0xa984, 0x0d },
-		{0xa985, 0x15 },
-		{0xa988, 0x1a },
-		{0xa989, 0x0d },
-		{0xa98c, 0x15 },
-		{0xa98d, 0x1a },
-		{0xa990, 0x0b },
-		{0xa991, 0x11 },
-		{0xa994, 0x02 },
-		{0xa995, 0x0e },
-		{0xa998, 0x16 },
-		{0xa999, 0x02 },
-		{0xa99c, 0x0c },
-		{0xa99d, 0x13 },
-		{0xa9a0, 0x02 },
-		{0xa9a1, 0x0c },
-		{0xa9a4, 0x12 },
-		{0xa9a5, 0x02 },
-		{0xa9a8, 0x0c },
-		{0xa9a9, 0x12 },
-		{0xa9ac, 0x02 },
-		{0xa9ad, 0x0c },
-		{0xa9b0, 0x12 },
-		{0xa9b1, 0x02 },
-		{0xa9b4, 0x10 },
-		{0xa9b5, 0x1e },
-		{0xa9b8, 0x0f },
-		{0xa9b9, 0x13 },
-		{0xa9bc, 0x20 },
-		{0xa9bd, 0x10 },
-		{0xa9c0, 0x11 },
-		{0xa9c1, 0x1e },
-		{0xa9c4, 0x10 },
-		{0xa9c5, 0x11 },
-		{0xa9c8, 0x1e },
-		{0xa9c9, 0x10 },
-		{0xa9cc, 0x11 },
-		{0xa9cd, 0x20 },
-		{0xa9d0, 0x10 },
-		{0xa9d1, 0x13 },
-		{0xa9d4, 0x24 },
-		{0xa9d5, 0x10 },
-		{0xa9f0, 0x02 },
-		{0xa9f1, 0x01 },
-		{0xa9f8, 0x19 },
-		{0xa9f9, 0x0b },
-		{0xa9fc, 0x0a },
-		{0xa9fd, 0x07 },
-		{0xaa00, 0x0c },
-		{0xaa01, 0x0e },
-		{0xaa08, 0x0c },
-		{0xaa09, 0x06 },
-		{0xaa0c, 0x0c },
-		{0xaa0d, 0x0a },
-		{0xaa24, 0x10 },
-		{0xaa25, 0x12 },
-		{0xaa28, 0x0b },
-		{0xaa29, 0x07 },
-		{0xaa2c, 0x10 },
-		{0xaa2d, 0x14 },
-		{0xaa34, 0x0e },
-		{0xaa35, 0x0e },
-		{0xaa38, 0x07 },
-		{0xaa39, 0x07 },
-		{0xaa3c, 0x0e },
-		{0xaa3d, 0x0c },
-		{0xaa48, 0x09 },
-		{0xaa49, 0x0c },
-		{0xaa4c, 0x0c },
-		{0xaa4d, 0x07 },
-		{0xaa54, 0x08 },
-		{0xaa55, 0x06 },
-		{0xaa58, 0x04 },
-		{0xaa59, 0x05 },
-		{0xaa5c, 0x06 },
-		{0xaa5d, 0x06 },
-		{0xaa68, 0x05 },
-		{0xaa69, 0x05 },
-		{0xaa6c, 0x04 },
-		{0xaa6d, 0x05 },
-		{0xaa74, 0x06 },
-		{0xaa75, 0x04 },
-		{0xaa78, 0x05 },
-		{0xaa79, 0x05 },
-		{0xaa7c, 0x04 },
-		{0xaa7d, 0x06 },
-		{0xac18, 0x14 },
-		{0xac19, 0x00 },
-		{0xac1c, 0x14 },
-		{0xac1d, 0x00 },
-		{0xac20, 0x14 },
-		{0xac21, 0x00 },
-		{0xac24, 0x14 },
-		{0xac25, 0x00 },
-		{0xac28, 0x14 },
-		{0xac29, 0x00 },
-		{0xac2c, 0x14 },
-		{0xac2d, 0x00 },
-		{0xac34, 0x16 },
-		{0xac35, 0x00 },
-		{0xac38, 0x16 },
-		{0xac39, 0x00 },
-		{0xac3c, 0x16 },
-		{0xac3d, 0x00 },
-		{0xac40, 0x16 },
-		{0xac41, 0x00 },
-		{0xac44, 0x16 },
-		{0xac45, 0x00 },
-		{0xac48, 0x16 },
-		{0xac49, 0x00 },
-		{0xac50, 0x1b },
-		{0xac51, 0x00 },
-		{0xac54, 0x1b },
-		{0xac55, 0x00 },
-		{0xac58, 0x1b },
-		{0xac59, 0x00 },
-		{0xac5c, 0x1b },
-		{0xac5d, 0x00 },
-		{0xac60, 0x1b },
-		{0xac61, 0x00 },
-		{0xac64, 0x1b },
-		{0xac65, 0x00 },
-		{0xac74, 0x09 },
-		{0xac75, 0x0c },
-		{0xac78, 0x0f },
-		{0xac79, 0x11 },
-		{0xac7c, 0x12 },
-		{0xac7d, 0x14 },
-		{0xac80, 0x09 },
-		{0xac81, 0x0c },
-		{0xac84, 0x0f },
-		{0xac85, 0x11 },
-		{0xac88, 0x12 },
-		{0xac89, 0x14 },
-		{0xac8c, 0x09 },
-		{0xac8d, 0x0c },
-		{0xac90, 0x0f },
-		{0xac91, 0x11 },
-		{0xac94, 0x12 },
-		{0xac95, 0x14 },
-		{0xac98, 0x09 },
-		{0xac99, 0x0c },
-		{0xac9c, 0x0f },
-		{0xac9d, 0x11 },
-		{0xaca0, 0x12 },
-		{0xaca1, 0x14 },
-		{0xaca4, 0x09 },
-		{0xaca5, 0x0c },
-		{0xaca8, 0x0f },
-		{0xaca9, 0x11 },
-		{0xacac, 0x12 },
-		{0xacad, 0x14 },
-		{0xacb0, 0x07 },
-		{0xacb1, 0x09 },
-		{0xacb4, 0x0c },
-		{0xacb5, 0x0d },
-		{0xacb8, 0x0d },
-		{0xacb9, 0x0e },
-		{0xacbc, 0x05 },
-		{0xacbd, 0x07 },
-		{0xacc0, 0x0a },
-		{0xacc1, 0x0b },
-		{0xacc4, 0x0b },
-		{0xacc5, 0x0c },
-		{0xacc8, 0x03 },
-		{0xacc9, 0x04 },
-		{0xaccc, 0x07 },
-		{0xaccd, 0x08 },
-		{0xacd0, 0x09 },
-		{0xacd1, 0x09 },
-		{0x35B5, 0x01 },
-		{0x35BC, 0x01 },
-		{0x360A, 0x02 },
-		{0xFA9B, 0x01 },
-};
-
-#define NUM_LSC_CAST_REGS      33
-
-enum LSC_Cast_t{
-	cast_H = 0,
-	cast_U30,
-	cast_CW,
-	cast_D,
-	cast_MAX
-};
-
-static short int LSC_CorrectionForCast[cast_MAX][NUM_LSC_CAST_REGS] = {
-	{-30, -20,  8, 11, -16, -26, -35, -53, -9, -10, 44, 57, -39,
-		-14, 50, -173, -38, -32, -1, 9, 39, 51, -33, -49, -28,
-		-22, 7, 11, -21, 17, -62, -56, 0},
-	{-29, -18,  6,  1,  17, -35, -77, 0, 5, -17, -6, -22, -41, -1,
-		-37, 83, -38, -32, 1, -2, 15, 25, -67, 19, -28, -22, 5,
-		2, -18, 21, -86, 0, 0},
-	{-10, -15, -4, -6,  -8,  -3, -63, 8, 25, -9, -39, -51, -9,
-		0, -21, 112, -10, -23, -7, -9, 10, 18, -11, 23, -10,
-		-15, -4, -6, -10, -3, -52, 7, 0},
-	{  5,   3, -4, -5,  -1,   3,   4, 8, 12, 3, -22, -21, 7, 17,
-		2, 35, 8, 2, -3, -2, -9, -5, 10, 4, 9, 2, -4, -5,
-		-2, 0, -6, 9, 0}
-};
-
-static unsigned short LSC_CastRegs[] = {
-	0xFB7E,			/* H   */
-	0xFB3C,			/* U30 */
-	0xFAFA,			/* CW  */
-	0xFAB8			/* D65 */
-};
-
-/*=============================================================*/
-
-static int vx6953_i2c_rxdata(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-	};
-	if (i2c_transfer(vx6953_client->adapter, msgs, 2) < 0) {
-		CDBG("vx6953_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-	return 0;
-}
-static int32_t vx6953_i2c_txdata(unsigned short saddr,
-				unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		 },
-	};
-	if (i2c_transfer(vx6953_client->adapter, msg, 1) < 0) {
-		CDBG("vx6953_i2c_txdata faild 0x%x\n", vx6953_client->addr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-
-static int32_t vx6953_i2c_read(unsigned short raddr,
-	unsigned short *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-	if (!rdata)
-		return -EIO;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-	rc = vx6953_i2c_rxdata(vx6953_client->addr>>1, buf, rlen);
-	if (rc < 0) {
-		CDBG("vx6953_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-	return rc;
-}
-static int32_t vx6953_i2c_write_b_sensor(unsigned short waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[3];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = vx6953_i2c_txdata(vx6953_client->addr>>1, buf, 3);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, bdata);
-	}
-	return rc;
-}
-static int32_t vx6953_i2c_write_w_sensor(unsigned short waddr, uint16_t wdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[4];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = (wdata & 0xFF00) >> 8;
-	buf[3] = (wdata & 0x00FF);
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, wdata);
-	rc = vx6953_i2c_txdata(vx6953_client->addr>>1, buf, 4);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, wdata);
-	}
-	return rc;
-}
-static int32_t vx6953_i2c_write_seq_sensor(unsigned short waddr,
-	uint8_t *bdata, uint16_t len)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[len+2];
-	int i;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	for (i = 2; i < len+2; i++)
-		buf[i] = *bdata++;
-	rc = vx6953_i2c_txdata(vx6953_client->addr>>1, buf, len+2);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			 waddr, bdata[0]);
-	}
-	return rc;
-}
-
-static int32_t vx6953_i2c_write_w_table(struct vx6953_i2c_reg_conf const
-					 *reg_conf_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-	for (i = 0; i < num; i++) {
-		rc = vx6953_i2c_write_b_sensor(reg_conf_tbl->waddr,
-			reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-	return rc;
-}
-
-static void vx6953_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint16_t preview_frame_length_lines, snapshot_frame_length_lines;
-	uint16_t preview_line_length_pck, snapshot_line_length_pck;
-	uint32_t divider, d1, d2;
-	/* Total frame_length_lines and line_length_pck for preview */
-	preview_frame_length_lines = VX6953_QTR_SIZE_HEIGHT +
-		VX6953_VER_QTR_BLK_LINES;
-	preview_line_length_pck = VX6953_QTR_SIZE_WIDTH +
-		VX6953_HRZ_QTR_BLK_PIXELS;
-	/* Total frame_length_lines and line_length_pck for snapshot */
-	snapshot_frame_length_lines = VX6953_FULL_SIZE_HEIGHT +
-		VX6953_VER_FULL_BLK_LINES;
-	snapshot_line_length_pck = VX6953_FULL_SIZE_WIDTH +
-		VX6953_HRZ_FULL_BLK_PIXELS;
-	d1 = preview_frame_length_lines * 0x00000400/
-		snapshot_frame_length_lines;
-	d2 = preview_line_length_pck * 0x00000400/
-		snapshot_line_length_pck;
-	divider = d1 * d2 / 0x400;
-	/*Verify PCLK settings and frame sizes.*/
-	*pfps = (uint16_t) (fps * divider / 0x400);
-	/* 2 is the ratio of no.of snapshot channels
-	to number of preview channels */
-
-}
-
-static uint16_t vx6953_get_prev_lines_pf(void)
-{
-	if (vx6953_ctrl->prev_res == QTR_SIZE)
-		return VX6953_QTR_SIZE_HEIGHT + VX6953_VER_QTR_BLK_LINES;
-	else
-		return VX6953_FULL_SIZE_HEIGHT + VX6953_VER_FULL_BLK_LINES;
-
-}
-
-static uint16_t vx6953_get_prev_pixels_pl(void)
-{
-	if (vx6953_ctrl->prev_res == QTR_SIZE)
-		return VX6953_QTR_SIZE_WIDTH + VX6953_HRZ_QTR_BLK_PIXELS;
-	else
-		return VX6953_FULL_SIZE_WIDTH + VX6953_HRZ_FULL_BLK_PIXELS;
-}
-
-static uint16_t vx6953_get_pict_lines_pf(void)
-{
-		if (vx6953_ctrl->pict_res == QTR_SIZE)
-			return VX6953_QTR_SIZE_HEIGHT +
-				VX6953_VER_QTR_BLK_LINES;
-		else
-			return VX6953_FULL_SIZE_HEIGHT +
-				VX6953_VER_FULL_BLK_LINES;
-}
-
-static uint16_t vx6953_get_pict_pixels_pl(void)
-{
-	if (vx6953_ctrl->pict_res == QTR_SIZE)
-		return VX6953_QTR_SIZE_WIDTH +
-			VX6953_HRZ_QTR_BLK_PIXELS;
-	else
-		return VX6953_FULL_SIZE_WIDTH +
-			VX6953_HRZ_FULL_BLK_PIXELS;
-}
-
-static uint32_t vx6953_get_pict_max_exp_lc(void)
-{
-	if (vx6953_ctrl->pict_res == QTR_SIZE)
-		return (VX6953_QTR_SIZE_HEIGHT +
-			VX6953_VER_QTR_BLK_LINES)*24;
-	else
-		return (VX6953_FULL_SIZE_HEIGHT +
-			VX6953_VER_FULL_BLK_LINES)*24;
-}
-
-static int32_t vx6953_set_fps(struct fps_cfg	*fps)
-{
-	uint16_t total_lines_per_frame;
-	int32_t rc = 0;
-	total_lines_per_frame = (uint16_t)((VX6953_QTR_SIZE_HEIGHT +
-		VX6953_VER_QTR_BLK_LINES) * vx6953_ctrl->fps_divider/0x400);
-
-	vx6953_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-		GROUPED_PARAMETER_HOLD);
-	if (vx6953_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_HI,
-		((total_lines_per_frame & 0xFF00) >> 8)) < 0)
-		return rc;
-	if (vx6953_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_LO,
-		(total_lines_per_frame & 0x00FF)) < 0)
-		return rc;
-	vx6953_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-		GROUPED_PARAMETER_HOLD_OFF);
-	return rc;
-}
-
-static int32_t vx6953_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	uint16_t line_length_pck, frame_length_lines;
-	uint8_t gain_hi, gain_lo;
-	uint8_t intg_time_hi, intg_time_lo;
-	uint8_t frame_length_lines_hi = 0, frame_length_lines_lo = 0;
-	int32_t rc = 0;
-	if (vx6953_ctrl->sensormode != SENSOR_SNAPSHOT_MODE) {
-		frame_length_lines = VX6953_QTR_SIZE_HEIGHT +
-		VX6953_VER_QTR_BLK_LINES;
-		line_length_pck = VX6953_QTR_SIZE_WIDTH +
-			VX6953_HRZ_QTR_BLK_PIXELS;
-		if (line > (frame_length_lines -
-			VX6953_STM5M0EDOF_OFFSET)) {
-			vx6953_ctrl->fps = (uint16_t) (30 * Q8 *
-			(frame_length_lines - VX6953_STM5M0EDOF_OFFSET)/
-			line);
-		} else {
-			vx6953_ctrl->fps = (uint16_t) (30 * Q8);
-		}
-	} else {
-		frame_length_lines = VX6953_FULL_SIZE_HEIGHT +
-				VX6953_VER_FULL_BLK_LINES;
-		line_length_pck = VX6953_FULL_SIZE_WIDTH +
-				VX6953_HRZ_FULL_BLK_PIXELS;
-	}
-
-	vx6953_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-		GROUPED_PARAMETER_HOLD);
-	if ((line + VX6953_STM5M0EDOF_OFFSET) > MAX_FRAME_LENGTH_LINES) {
-		frame_length_lines = MAX_FRAME_LENGTH_LINES;
-		line = MAX_FRAME_LENGTH_LINES - VX6953_STM5M0EDOF_OFFSET;
-	} else if ((line + VX6953_STM5M0EDOF_OFFSET) > frame_length_lines) {
-		frame_length_lines = line + VX6953_STM5M0EDOF_OFFSET;
-		line = frame_length_lines;
-	}
-
-	frame_length_lines_hi = (uint8_t) ((frame_length_lines &
-		0xFF00) >> 8);
-	frame_length_lines_lo = (uint8_t) (frame_length_lines &
-		0x00FF);
-	vx6953_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_HI,
-		frame_length_lines_hi);
-	vx6953_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_LO,
-		frame_length_lines_lo);
-
-	/* update analogue gain registers */
-	gain_hi = (uint8_t) ((gain & 0xFF00) >> 8);
-	gain_lo = (uint8_t) (gain & 0x00FF);
-	vx6953_i2c_write_b_sensor(REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-		gain_lo);
-	vx6953_i2c_write_b_sensor(REG_DIGITAL_GAIN_GREEN_R_LO, gain_hi);
-	vx6953_i2c_write_b_sensor(REG_DIGITAL_GAIN_RED_LO, gain_hi);
-	vx6953_i2c_write_b_sensor(REG_DIGITAL_GAIN_BLUE_LO, gain_hi);
-	vx6953_i2c_write_b_sensor(REG_DIGITAL_GAIN_GREEN_B_LO, gain_hi);
-	CDBG("%s, gain_hi 0x%x, gain_lo 0x%x\n", __func__,
-		gain_hi, gain_lo);
-	/* update line count registers */
-	intg_time_hi = (uint8_t) (((uint16_t)line & 0xFF00) >> 8);
-	intg_time_lo = (uint8_t) ((uint16_t)line & 0x00FF);
-	vx6953_i2c_write_b_sensor(REG_COARSE_INTEGRATION_TIME_HI,
-		intg_time_hi);
-	vx6953_i2c_write_b_sensor(REG_COARSE_INTEGRATION_TIME_LO,
-		intg_time_lo);
-	vx6953_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-		GROUPED_PARAMETER_HOLD_OFF);
-
-	return rc;
-}
-
-static int32_t vx6953_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-	rc = vx6953_write_exp_gain(gain, line);
-	return rc;
-} /* endof vx6953_set_pict_exp_gain*/
-
-static int32_t vx6953_move_focus(int direction,
-	int32_t num_steps)
-{
-	return 0;
-}
-
-
-static int32_t vx6953_set_default_focus(uint8_t af_step)
-{
-	return 0;
-}
-
-static int32_t vx6953_test(enum vx6953_test_mode_t mo)
-{
-	int32_t rc = 0;
-	if (mo == TEST_OFF)
-		return rc;
-	else {
-		/* REG_0x30D8[4] is TESBYPEN: 0: Normal Operation,
-		1: Bypass Signal Processing
-		REG_0x30D8[5] is EBDMASK: 0:
-		Output Embedded data, 1: No output embedded data */
-		if (vx6953_i2c_write_b_sensor(REG_TEST_PATTERN_MODE,
-			(uint8_t) mo) < 0) {
-			return rc;
-		}
-	}
-	return rc;
-}
-
-static int vx6953_enable_edof(enum edof_mode_t edof_mode)
-{
-	int rc = 0;
-	if (edof_mode == VX6953_EDOF_ESTIMATION) {
-		/* EDof Estimation mode for preview */
-		if (vx6953_i2c_write_b_sensor(REG_0x0b80, 0x02) < 0)
-			return rc;
-		CDBG("VX6953_EDOF_ESTIMATION");
-	} else if (edof_mode == VX6953_EDOF_APPLICATION) {
-		/* EDof Application mode for Capture */
-		if (vx6953_i2c_write_b_sensor(REG_0x0b80, 0x01) < 0)
-			return rc;
-		CDBG("VX6953_EDOF_APPLICATION");
-	} else {
-		/* EDOF disabled */
-		if (vx6953_i2c_write_b_sensor(REG_0x0b80, 0x00) < 0)
-			return rc;
-		CDBG("VX6953_EDOF_DISABLE");
-	}
-	return rc;
-}
-
-static int32_t vx6953_patch_for_cut2(void)
-{
-	int32_t rc = 0;
-	rc = vx6953_i2c_write_w_table(patch_tbl_cut2,
-		ARRAY_SIZE(patch_tbl_cut2));
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-
-static int32_t vx6953_lsc_patch(void)
-{
-	int32_t rc = 0;
-	int i, j;
-	short int  v;
-	unsigned short version = 0;
-	unsigned short LSC_Raw[NUM_LSC_CAST_REGS];
-	unsigned short LSC_Fixed[NUM_LSC_CAST_REGS];
-
-	vx6953_i2c_read(0x10, &version, 1);
-	CDBG("Cut 3 Version %d\n", version);
-	if (version != 1)
-		return 0;
-
-	vx6953_i2c_write_b_sensor(0x3640, 0x00);
-	for (j = cast_H; j < cast_MAX; j++) {
-		for (i = 0; i < NUM_LSC_CAST_REGS; i++) {
-			rc = vx6953_i2c_read(LSC_CastRegs[cast_D]+(2*i),
-								&LSC_Raw[i], 2);
-			if (rc < 0)
-				return rc;
-			v = LSC_Raw[i];
-			v +=  LSC_CorrectionForCast[j][i];
-			LSC_Fixed[i] = (unsigned short) v;
-		}
-		for (i = 0; i < NUM_LSC_CAST_REGS; i++) {
-			rc = vx6953_i2c_write_w_sensor(LSC_CastRegs[j]+(2*i),
-								LSC_Fixed[i]);
-			if (rc < 0)
-				return rc;
-		}
-	}
-	CDBG("vx6953_lsc_patch done\n");
-	return rc;
-}
-
-static int32_t vx6953_sensor_setting(int update_type, int rt)
-{
-
-	int32_t rc = 0;
-	unsigned short frame_cnt;
-	struct msm_camera_csi_params vx6953_csi_params;
-	if (vx6953_ctrl->sensor_type != VX6953_STM5M0EDOF_CUT_2) {
-		switch (update_type) {
-		case REG_INIT:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct vx6953_i2c_reg_conf init_tbl[] = {
-				{REG_0x0112,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0112},
-				{REG_0x0113,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0113},
-				{REG_VT_PIX_CLK_DIV,
-					vx6953_regs.reg_pat_init[0].
-					vt_pix_clk_div},
-				{0x303, 0x01},
-				{0x30b, 0x01},
-				{REG_PRE_PLL_CLK_DIV,
-					vx6953_regs.reg_pat_init[0].
-					pre_pll_clk_div},
-				{REG_PLL_MULTIPLIER,
-					vx6953_regs.reg_pat_init[0].
-					pll_multiplier},
-				{REG_OP_PIX_CLK_DIV,
-					vx6953_regs.reg_pat_init[0].
-					op_pix_clk_div},
-				{REG_0x3210, 0x01},
-				{REG_0x0111,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0111},
-				{REG_0x0b00,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0b00},
-				{REG_0x0136,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0136},
-				{REG_0x0137,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0137},
-				{REG_0x0b06,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0b06},
-				{REG_0x0b07,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0b07},
-				{REG_0x0b08,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0b08},
-				{REG_0x0b09,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0b09},
-				{REG_0x0b83,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0b83},
-				{REG_0x0b84,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0b84},
-				{REG_0x0b85,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0b85},
-				{REG_0x0b88,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0b88},
-				{REG_0x0b89,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0b89},
-				{REG_0x0b8a,
-					vx6953_regs.reg_pat_init[0].
-					reg_0x0b8a},
-				{0x3393, 0x06},
-				{0x3394, 0x07},
-				{0x338d, 0x08},
-				{0x338e, 0x08},
-				{0x338f, 0x00},
-			};
-			/* reset fps_divider */
-			vx6953_ctrl->fps = 30 * Q8;
-			/* stop streaming */
-
-			count = 0;
-			CDBG("Init vx6953_sensor_setting standby\n");
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STANDBY_MODE) < 0)
-				return rc;
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-			vx6953_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-			GROUPED_PARAMETER_HOLD);
-
-			rc = vx6953_i2c_write_w_table(cut3_cali_data,
-				ARRAY_SIZE(cut3_cali_data));
-
-			vx6953_lsc_patch();
-
-			vx6953_i2c_write_w_sensor(0x100A, 0x07A3);
-			vx6953_i2c_write_w_sensor(0x114A, 0x002A);
-			vx6953_i2c_write_w_sensor(0x1716, 0x0204);
-			vx6953_i2c_write_w_sensor(0x1718, 0x0880);
-
-			rc = vx6953_i2c_write_w_table(&init_tbl[0],
-				ARRAY_SIZE(init_tbl));
-			if (rc < 0)
-				return rc;
-
-			msleep(10);
-
-		}
-		return rc;
-		case UPDATE_PERIODIC:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct vx6953_i2c_reg_conf preview_mode_tbl[] = {
-				{0x200, 0x02},
-				{0x201, 0x26},
-				{REG_COARSE_INTEGRATION_TIME_HI,
-					vx6953_regs.reg_pat[rt].
-					coarse_integration_time_hi},
-				{REG_COARSE_INTEGRATION_TIME_LO,
-					vx6953_regs.reg_pat[rt].
-					coarse_integration_time_lo},
-				{REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-					vx6953_regs.reg_pat[rt].
-					analogue_gain_code_global},
-				{REG_FRAME_LENGTH_LINES_HI,
-					vx6953_regs.reg_pat[rt].
-					frame_length_lines_hi},
-				{REG_FRAME_LENGTH_LINES_LO,
-					vx6953_regs.reg_pat[rt].
-					frame_length_lines_lo},
-				{REG_LINE_LENGTH_PCK_HI,
-					vx6953_regs.reg_pat[rt].
-					line_length_pck_hi},
-				{REG_LINE_LENGTH_PCK_LO,
-					vx6953_regs.reg_pat[rt].
-					line_length_pck_lo},
-				{REG_0x0b80,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0b80},
-				{REG_0x0900,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0900},
-				{REG_0x0901,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0901},
-				{REG_0x0902,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0902},
-				{REG_0x0383,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0383},
-				{REG_0x0387,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0387},
-				{REG_0x034c,
-					vx6953_regs.reg_pat[rt].
-					reg_0x034c},
-				{REG_0x034d,
-					vx6953_regs.reg_pat[rt].
-					reg_0x034d},
-				{REG_0x034e,
-					vx6953_regs.reg_pat[rt].
-					reg_0x034e},
-				{REG_0x034f,
-					vx6953_regs.reg_pat[rt].
-					reg_0x034f},
-				{REG_0x3640, 0x00},
-			};
-
-			struct vx6953_i2c_reg_conf snapshot_mode_tbl[] = {
-				{0x0200, 0x02},
-				{0x0201, 0x54},
-				{REG_COARSE_INTEGRATION_TIME_HI,
-					vx6953_regs.reg_pat[rt].
-					coarse_integration_time_hi},
-				{REG_COARSE_INTEGRATION_TIME_LO,
-					vx6953_regs.reg_pat[rt].
-					coarse_integration_time_lo},
-				{REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-					vx6953_regs.reg_pat[rt].
-					analogue_gain_code_global},
-				{REG_FRAME_LENGTH_LINES_HI,
-					vx6953_regs.reg_pat[rt].
-					frame_length_lines_hi},
-				{REG_FRAME_LENGTH_LINES_LO,
-					vx6953_regs.reg_pat[rt].
-					frame_length_lines_lo},
-				{REG_LINE_LENGTH_PCK_HI,
-					vx6953_regs.reg_pat[rt].
-					line_length_pck_hi},
-				{REG_LINE_LENGTH_PCK_LO,
-					vx6953_regs.reg_pat[rt].
-					line_length_pck_lo},
-				{REG_0x0b80,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0b80},
-				{REG_0x0900,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0900},
-				{REG_0x0901,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0901},
-				{REG_0x0902,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0902},
-				{REG_0x0383,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0383},
-				{REG_0x0387,
-					vx6953_regs.reg_pat[rt].
-					reg_0x0387},
-				{REG_0x034c,
-					vx6953_regs.reg_pat[rt].
-					reg_0x034c},
-				{REG_0x034d,
-					vx6953_regs.reg_pat[rt].
-					reg_0x034d},
-				{REG_0x034e,
-					vx6953_regs.reg_pat[rt].
-					reg_0x034e},
-				{REG_0x034f,
-					vx6953_regs.reg_pat[rt].
-					reg_0x034f},
-				{0x3140, 0x01},
-				{REG_0x3640, 0x00},
-			};
-			/* stop streaming */
-
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STANDBY_MODE) < 0)
-				return rc;
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			if (count == 0) {
-				vx6953_csi_params.data_format = CSI_8BIT;
-				vx6953_csi_params.lane_cnt = 1;
-				vx6953_csi_params.lane_assign = 0xe4;
-				vx6953_csi_params.dpcm_scheme = 0;
-				vx6953_csi_params.settle_cnt = 7;
-				rc = msm_camio_csi_config(&vx6953_csi_params);
-				if (rc < 0)
-					CDBG("config csi controller failed\n");
-
-				msleep(20);
-				count = 1;
-			}
-
-			vx6953_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-			GROUPED_PARAMETER_HOLD);
-
-			if (rt == RES_PREVIEW) {
-				rc = vx6953_i2c_write_w_table(
-					&preview_mode_tbl[0],
-					ARRAY_SIZE(preview_mode_tbl));
-				if (rc < 0)
-					return rc;
-			}
-			if (rt == RES_CAPTURE) {
-				rc = vx6953_i2c_write_w_table(
-					&snapshot_mode_tbl[0],
-					ARRAY_SIZE(snapshot_mode_tbl));
-				if (rc < 0)
-					return rc;
-			}
-
-			vx6953_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-			GROUPED_PARAMETER_HOLD_OFF);
-
-			/* Start sensor streaming */
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STREAM) < 0)
-				return rc;
-			msleep(10);
-
-			if (vx6953_i2c_read(0x0005, &frame_cnt, 1) < 0)
-				return rc;
-
-			while (frame_cnt == 0xFF) {
-				if (vx6953_i2c_read(0x0005, &frame_cnt, 1) < 0)
-					return rc;
-				CDBG("frame_cnt=%d\n", frame_cnt);
-				msleep(2);
-			}
-		}
-		return rc;
-		default:
-			return rc;
-		}
-	} else {
-		switch (update_type) {
-		case REG_INIT:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct vx6953_i2c_reg_conf init_tbl[] = {
-			{REG_0x0112,
-				vx6953_regs.reg_pat_init[0].reg_0x0112},
-			{REG_0x0113,
-				vx6953_regs.reg_pat_init[0].reg_0x0113},
-			{REG_VT_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				vt_pix_clk_div},
-			{REG_PRE_PLL_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER,
-				vx6953_regs.reg_pat_init[0].
-				pll_multiplier},
-			{REG_OP_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				op_pix_clk_div},
-			{REG_COARSE_INTEGRATION_TIME_HI,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_hi},
-			{REG_COARSE_INTEGRATION_TIME_LO,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_lo},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-				vx6953_regs.reg_pat[rt].
-				analogue_gain_code_global},
-			{REG_0x3030,
-				vx6953_regs.reg_pat_init[0].reg_0x3030},
-			/* 953 specific registers */
-			{REG_0x0111,
-				vx6953_regs.reg_pat_init[0].reg_0x0111},
-			{REG_0x0b00,
-				vx6953_regs.reg_pat_init[0].reg_0x0b00},
-			{REG_0x3001,
-				vx6953_regs.reg_pat_init[0].reg_0x3001},
-			{REG_0x3004,
-				vx6953_regs.reg_pat_init[0].reg_0x3004},
-			{REG_0x3007,
-				vx6953_regs.reg_pat_init[0].reg_0x3007},
-			{REG_0x3016,
-				vx6953_regs.reg_pat_init[0].reg_0x3016},
-			{REG_0x301d,
-				vx6953_regs.reg_pat_init[0].reg_0x301d},
-			{REG_0x317e,
-				vx6953_regs.reg_pat_init[0].reg_0x317e},
-			{REG_0x317f,
-				vx6953_regs.reg_pat_init[0].reg_0x317f},
-			{REG_0x3400,
-				vx6953_regs.reg_pat_init[0].reg_0x3400},
-			/* DEFCOR settings */
-			/*Single Defect Correction Weight DISABLE*/
-			{0x0b06,
-				vx6953_regs.reg_pat_init[0].reg_0x0b06},
-			/*Single_defect_correct_weight = auto*/
-			{0x0b07,
-				vx6953_regs.reg_pat_init[0].reg_0x0b07},
-			/*Dynamic couplet correction ENABLED*/
-			{0x0b08,
-				vx6953_regs.reg_pat_init[0].reg_0x0b08},
-			/*Dynamic couplet correction weight*/
-			{0x0b09,
-				vx6953_regs.reg_pat_init[0].reg_0x0b09},
-			/* Clock Setup */
-			/* Tell sensor ext clk is 24MHz*/
-			{0x0136,
-				vx6953_regs.reg_pat_init[0].reg_0x0136},
-			{0x0137,
-				vx6953_regs.reg_pat_init[0].reg_0x0137},
-			/* The white balance gains must be written
-			to the sensor every frame. */
-			/* Edof */
-			{REG_0x0b83,
-				vx6953_regs.reg_pat_init[0].reg_0x0b83},
-			{REG_0x0b84,
-				vx6953_regs.reg_pat_init[0].reg_0x0b84},
-			{0x0b85,
-				vx6953_regs.reg_pat_init[0].reg_0x0b85},
-			{0x0b88,
-				vx6953_regs.reg_pat_init[0].reg_0x0b88},
-			{0x0b89,
-				vx6953_regs.reg_pat_init[0].reg_0x0b89},
-			{REG_0x0b8a,
-				vx6953_regs.reg_pat_init[0].reg_0x0b8a},
-			/* Mode specific regieters */
-			{REG_FRAME_LENGTH_LINES_HI,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_hi},
-			{REG_FRAME_LENGTH_LINES_LO,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_lo},
-			{REG_LINE_LENGTH_PCK_HI,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_hi},
-			{REG_LINE_LENGTH_PCK_LO,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_lo},
-			{REG_0x3005,
-				vx6953_regs.reg_pat[rt].reg_0x3005},
-			{0x3010,
-				vx6953_regs.reg_pat[rt].reg_0x3010},
-			{REG_0x3011,
-				vx6953_regs.reg_pat[rt].reg_0x3011},
-			{REG_0x301a,
-				vx6953_regs.reg_pat[rt].reg_0x301a},
-			{REG_0x3035,
-				vx6953_regs.reg_pat[rt].reg_0x3035},
-			{REG_0x3036,
-				vx6953_regs.reg_pat[rt].reg_0x3036},
-			{REG_0x3041,
-				vx6953_regs.reg_pat[rt].reg_0x3041},
-			{0x3042,
-				vx6953_regs.reg_pat[rt].reg_0x3042},
-			{REG_0x3045,
-				vx6953_regs.reg_pat[rt].reg_0x3045},
-			/*EDOF: Estimation settings for Preview mode
-			Application settings for capture mode
-			(standard settings - Not tuned) */
-			{REG_0x0b80,
-				vx6953_regs.reg_pat[rt].reg_0x0b80},
-			{REG_0x0900,
-				vx6953_regs.reg_pat[rt].reg_0x0900},
-			{REG_0x0901,
-				vx6953_regs.reg_pat[rt].reg_0x0901},
-			{REG_0x0902,
-				vx6953_regs.reg_pat[rt].reg_0x0902},
-			{REG_0x0383,
-				vx6953_regs.reg_pat[rt].reg_0x0383},
-			{REG_0x0387,
-				vx6953_regs.reg_pat[rt].reg_0x0387},
-			/* Change output size / frame rate */
-			{REG_0x034c,
-				vx6953_regs.reg_pat[rt].reg_0x034c},
-			{REG_0x034d,
-				vx6953_regs.reg_pat[rt].reg_0x034d},
-			{REG_0x034e,
-				vx6953_regs.reg_pat[rt].reg_0x034e},
-			{REG_0x034f,
-				vx6953_regs.reg_pat[rt].reg_0x034f},
-			{REG_0x1716,
-				vx6953_regs.reg_pat[rt].reg_0x1716},
-			{REG_0x1717,
-				vx6953_regs.reg_pat[rt].reg_0x1717},
-			{REG_0x1718,
-				vx6953_regs.reg_pat[rt].reg_0x1718},
-			{REG_0x1719,
-				vx6953_regs.reg_pat[rt].reg_0x1719},
-			};
-						/* reset fps_divider */
-			vx6953_ctrl->fps = 30 * Q8;
-			/* stop streaming */
-
-			/* Reset everything first */
-			if (vx6953_i2c_write_b_sensor(0x103, 0x01) < 0) {
-				CDBG("S/W reset failed\n");
-				return rc;
-			} else
-				CDBG("S/W reset successful\n");
-
-			msleep(10);
-
-			CDBG("Init vx6953_sensor_setting standby\n");
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STANDBY_MODE) < 0)
-				return rc;
-				/*vx6953_stm5m0edof_delay_msecs_stdby*/
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-			vx6953_patch_for_cut2();
-			rc = vx6953_i2c_write_w_table(&init_tbl[0],
-				ARRAY_SIZE(init_tbl));
-			if (rc < 0)
-				return rc;
-				msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-		}
-	return rc;
-	case UPDATE_PERIODIC:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct vx6953_i2c_reg_conf init_mode_tbl[] =  {
-			{REG_0x0112,
-				vx6953_regs.reg_pat_init[0].reg_0x0112},
-			{REG_0x0113,
-				vx6953_regs.reg_pat_init[0].reg_0x0113},
-			{REG_VT_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				vt_pix_clk_div},
-			{REG_PRE_PLL_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER,
-				vx6953_regs.reg_pat_init[0].
-				pll_multiplier},
-			{REG_OP_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				op_pix_clk_div},
-			{REG_COARSE_INTEGRATION_TIME_HI,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_hi},
-			{REG_COARSE_INTEGRATION_TIME_LO,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_lo},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-				vx6953_regs.reg_pat[rt].
-				analogue_gain_code_global},
-			{REG_0x3030,
-				vx6953_regs.reg_pat_init[0].reg_0x3030},
-			/* 953 specific registers */
-			{REG_0x0111,
-				vx6953_regs.reg_pat_init[0].reg_0x0111},
-			{REG_0x0b00,
-				vx6953_regs.reg_pat_init[0].reg_0x0b00},
-			{REG_0x3001,
-				vx6953_regs.reg_pat_init[0].reg_0x3001},
-			{REG_0x3004,
-				vx6953_regs.reg_pat_init[0].reg_0x3004},
-			{REG_0x3007,
-				vx6953_regs.reg_pat_init[0].reg_0x3007},
-			{REG_0x3016,
-				vx6953_regs.reg_pat_init[0].reg_0x3016},
-			{REG_0x301d,
-				vx6953_regs.reg_pat_init[0].reg_0x301d},
-			{REG_0x317e,
-				vx6953_regs.reg_pat_init[0].reg_0x317e},
-			{REG_0x317f,
-				vx6953_regs.reg_pat_init[0].reg_0x317f},
-			{REG_0x3400,
-				vx6953_regs.reg_pat_init[0].reg_0x3400},
-			{0x0b06,
-				vx6953_regs.reg_pat_init[0].reg_0x0b06},
-			/*Single_defect_correct_weight = auto*/
-			{0x0b07,
-				vx6953_regs.reg_pat_init[0].reg_0x0b07},
-			/*Dynamic couplet correction ENABLED*/
-			{0x0b08,
-				vx6953_regs.reg_pat_init[0].reg_0x0b08},
-			/*Dynamic couplet correction weight*/
-			{0x0b09,
-				vx6953_regs.reg_pat_init[0].reg_0x0b09},
-			/* Clock Setup */
-			/* Tell sensor ext clk is 24MHz*/
-			{0x0136,
-				vx6953_regs.reg_pat_init[0].reg_0x0136},
-			{0x0137,
-				vx6953_regs.reg_pat_init[0].reg_0x0137},
-			/* The white balance gains must be written
-			to the sensor every frame. */
-			/* Edof */
-			{REG_0x0b83,
-				vx6953_regs.reg_pat_init[0].reg_0x0b83},
-			{REG_0x0b84,
-				vx6953_regs.reg_pat_init[0].reg_0x0b84},
-			{0x0b85,
-				vx6953_regs.reg_pat_init[0].reg_0x0b85},
-			{0x0b88,
-				vx6953_regs.reg_pat_init[0].reg_0x0b88},
-			{0x0b89,
-				vx6953_regs.reg_pat_init[0].reg_0x0b89},
-			{REG_0x0b8a,
-				vx6953_regs.reg_pat_init[0].reg_0x0b8a},
-			/* Mode specific regieters */
-			{REG_FRAME_LENGTH_LINES_HI,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_hi},
-			{REG_FRAME_LENGTH_LINES_LO,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_lo},
-			{REG_LINE_LENGTH_PCK_HI,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_hi},
-			{REG_LINE_LENGTH_PCK_LO,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_lo},
-			{REG_0x3005,
-				vx6953_regs.reg_pat[rt].reg_0x3005},
-			{0x3010,
-				vx6953_regs.reg_pat[rt].reg_0x3010},
-			{REG_0x3011,
-				vx6953_regs.reg_pat[rt].reg_0x3011},
-			{REG_0x301a,
-				vx6953_regs.reg_pat[rt].reg_0x301a},
-			{REG_0x3035,
-				vx6953_regs.reg_pat[rt].reg_0x3035},
-			{REG_0x3036,
-				vx6953_regs.reg_pat[rt].reg_0x3036},
-			{REG_0x3041,
-				vx6953_regs.reg_pat[rt].reg_0x3041},
-			{0x3042,
-				vx6953_regs.reg_pat[rt].reg_0x3042},
-			{REG_0x3045,
-				vx6953_regs.reg_pat[rt].reg_0x3045},
-			/*EDOF: Estimation settings for Preview mode
-			Application settings for capture mode
-			(standard settings - Not tuned) */
-			{REG_0x0b80,
-				vx6953_regs.reg_pat[rt].reg_0x0b80},
-			{REG_0x0900,
-				vx6953_regs.reg_pat[rt].reg_0x0900},
-			{REG_0x0901,
-				vx6953_regs.reg_pat[rt].reg_0x0901},
-			{REG_0x0902,
-				vx6953_regs.reg_pat[rt].reg_0x0902},
-			{REG_0x0383,
-				vx6953_regs.reg_pat[rt].reg_0x0383},
-			{REG_0x0387,
-				vx6953_regs.reg_pat[rt].reg_0x0387},
-			/* Change output size / frame rate */
-			{REG_0x034c,
-				vx6953_regs.reg_pat[rt].reg_0x034c},
-			{REG_0x034d,
-				vx6953_regs.reg_pat[rt].reg_0x034d},
-			{REG_0x034e,
-				vx6953_regs.reg_pat[rt].reg_0x034e},
-			{REG_0x034f,
-				vx6953_regs.reg_pat[rt].reg_0x034f},
-			{REG_0x1716,
-				vx6953_regs.reg_pat[rt].reg_0x1716},
-			{REG_0x1717,
-				vx6953_regs.reg_pat[rt].reg_0x1717},
-			{REG_0x1718,
-				vx6953_regs.reg_pat[rt].reg_0x1718},
-			{REG_0x1719,
-				vx6953_regs.reg_pat[rt].reg_0x1719},
-			};
-			struct vx6953_i2c_reg_conf mode_tbl[] = {
-			{REG_0x0112,
-				vx6953_regs.reg_pat_init[0].reg_0x0112},
-			{REG_0x0113,
-				vx6953_regs.reg_pat_init[0].reg_0x0113},
-			{REG_VT_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				vt_pix_clk_div},
-			{REG_PRE_PLL_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER,
-				vx6953_regs.reg_pat_init[0].
-				pll_multiplier},
-			{REG_OP_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				op_pix_clk_div},
-		/* Mode specific regieters */
-			{REG_FRAME_LENGTH_LINES_HI,
-				vx6953_regs.reg_pat[rt].frame_length_lines_hi},
-			{REG_FRAME_LENGTH_LINES_LO,
-				vx6953_regs.reg_pat[rt].frame_length_lines_lo},
-			{REG_LINE_LENGTH_PCK_HI,
-				vx6953_regs.reg_pat[rt].line_length_pck_hi},
-			{REG_LINE_LENGTH_PCK_LO,
-				vx6953_regs.reg_pat[rt].line_length_pck_lo},
-			{REG_0x3005, vx6953_regs.reg_pat[rt].reg_0x3005},
-			{0x3010, vx6953_regs.reg_pat[rt].reg_0x3010},
-			{REG_0x3011, vx6953_regs.reg_pat[rt].reg_0x3011},
-			{REG_0x301a, vx6953_regs.reg_pat[rt].reg_0x301a},
-			{REG_0x3035, vx6953_regs.reg_pat[rt].reg_0x3035},
-			{REG_0x3036, vx6953_regs.reg_pat[rt].reg_0x3036},
-			{REG_0x3041, vx6953_regs.reg_pat[rt].reg_0x3041},
-			{0x3042, vx6953_regs.reg_pat[rt].reg_0x3042},
-			{REG_0x3045, vx6953_regs.reg_pat[rt].reg_0x3045},
-			/*EDOF: Estimation settings for Preview mode
-			Application settings for capture
-			mode(standard settings - Not tuned) */
-			{REG_0x0b80, vx6953_regs.reg_pat[rt].reg_0x0b80},
-			{REG_0x0900, vx6953_regs.reg_pat[rt].reg_0x0900},
-			{REG_0x0901, vx6953_regs.reg_pat[rt].reg_0x0901},
-			{REG_0x0902, vx6953_regs.reg_pat[rt].reg_0x0902},
-			{REG_0x0383, vx6953_regs.reg_pat[rt].reg_0x0383},
-			{REG_0x0387, vx6953_regs.reg_pat[rt].reg_0x0387},
-			/* Change output size / frame rate */
-			{REG_0x034c, vx6953_regs.reg_pat[rt].reg_0x034c},
-			{REG_0x034d, vx6953_regs.reg_pat[rt].reg_0x034d},
-			{REG_0x034e, vx6953_regs.reg_pat[rt].reg_0x034e},
-			{REG_0x034f, vx6953_regs.reg_pat[rt].reg_0x034f},
-			/*{0x200, vx6953_regs.reg_pat[rt].reg_0x0200},
-			{0x201, vx6953_regs.reg_pat[rt].reg_0x0201},*/
-			{REG_0x1716, vx6953_regs.reg_pat[rt].reg_0x1716},
-			{REG_0x1717, vx6953_regs.reg_pat[rt].reg_0x1717},
-			{REG_0x1718, vx6953_regs.reg_pat[rt].reg_0x1718},
-			{REG_0x1719, vx6953_regs.reg_pat[rt].reg_0x1719},
-			};
-			/* stop streaming */
-			msleep(5);
-
-			/* Reset everything first */
-			if (vx6953_i2c_write_b_sensor(0x103, 0x01) < 0) {
-				CDBG("S/W reset failed\n");
-				return rc;
-			} else
-				CDBG("S/W reset successful\n");
-
-			msleep(10);
-
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STANDBY_MODE) < 0)
-				return rc;
-			/*vx6953_stm5m0edof_delay_msecs_stdby*/
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-
-			vx6953_csi_params.data_format = CSI_8BIT;
-			vx6953_csi_params.lane_cnt = 1;
-			vx6953_csi_params.lane_assign = 0xe4;
-			vx6953_csi_params.dpcm_scheme = 0;
-			vx6953_csi_params.settle_cnt = 7;
-			rc = msm_camio_csi_config(&vx6953_csi_params);
-			if (rc < 0)
-				return rc;
-
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			vx6953_patch_for_cut2();
-			rc = vx6953_i2c_write_w_table(&init_mode_tbl[0],
-				ARRAY_SIZE(init_mode_tbl));
-			if (rc < 0)
-				return rc;
-
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			rc = vx6953_i2c_write_w_table(&mode_tbl[0],
-				ARRAY_SIZE(mode_tbl));
-			if (rc < 0)
-				return rc;
-
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			/* Start sensor streaming */
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STREAM) < 0)
-				return rc;
-			msleep(vx6953_stm5m0edof_delay_msecs_stream);
-
-			if (vx6953_i2c_read(0x0005, &frame_cnt, 1) < 0)
-				return rc;
-
-			while (frame_cnt == 0xFF) {
-				if (vx6953_i2c_read(0x0005, &frame_cnt, 1) < 0)
-					return rc;
-				CDBG("frame_cnt=%d", frame_cnt);
-				msleep(10);
-			}
-		}
-		return rc;
-	default:
-		return rc;
-	}
-	}
-	return rc;
-}
-
-
-static int32_t vx6953_video_config(int mode)
-{
-
-	int32_t	rc = 0;
-	int	rt;
-	/* change sensor resolution	if needed */
-	if (vx6953_ctrl->curr_res != vx6953_ctrl->prev_res) {
-		if (vx6953_ctrl->prev_res == QTR_SIZE) {
-			rt = RES_PREVIEW;
-			vx6953_stm5m0edof_delay_msecs_stdby	=
-				((((2 * 1000 * vx6953_ctrl->fps_divider) /
-				   vx6953_ctrl->fps) * Q8) / Q10) + 1;
-		} else {
-			rt = RES_CAPTURE;
-			vx6953_stm5m0edof_delay_msecs_stdby	=
-				((((1000 * vx6953_ctrl->fps_divider) /
-				   vx6953_ctrl->fps) * Q8) / Q10) + 1;
-		}
-		if (vx6953_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-			return rc;
-	}
-	if (vx6953_ctrl->set_test) {
-		if (vx6953_test(vx6953_ctrl->set_test) < 0)
-			return	rc;
-	}
-	vx6953_ctrl->edof_mode = VX6953_EDOF_ESTIMATION;
-	rc = vx6953_enable_edof(vx6953_ctrl->edof_mode);
-	if (rc < 0)
-		return rc;
-	vx6953_ctrl->curr_res = vx6953_ctrl->prev_res;
-	vx6953_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t vx6953_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-	/*change sensor resolution if needed */
-	if (vx6953_ctrl->curr_res != vx6953_ctrl->pict_res) {
-		if (vx6953_ctrl->pict_res == QTR_SIZE) {
-			rt = RES_PREVIEW;
-			vx6953_stm5m0edof_delay_msecs_stdby =
-				((((2 * 1000 * vx6953_ctrl->fps_divider) /
-				vx6953_ctrl->fps) * Q8) / Q10) + 1;
-		} else {
-			rt = RES_CAPTURE;
-			vx6953_stm5m0edof_delay_msecs_stdby =
-				((((1000 * vx6953_ctrl->fps_divider) /
-				vx6953_ctrl->fps) * Q8) / Q10) + 1;
-		}
-	if (vx6953_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-		return rc;
-	}
-
-	vx6953_ctrl->edof_mode = VX6953_EDOF_APPLICATION;
-	if (vx6953_enable_edof(vx6953_ctrl->edof_mode) < 0)
-		return rc;
-	vx6953_ctrl->curr_res = vx6953_ctrl->pict_res;
-	vx6953_ctrl->sensormode = mode;
-	return rc;
-} /*end of vx6953_snapshot_config*/
-
-static int32_t vx6953_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-	/* change sensor resolution if needed */
-	if (vx6953_ctrl->curr_res != vx6953_ctrl->pict_res) {
-		if (vx6953_ctrl->pict_res == QTR_SIZE) {
-			rt = RES_PREVIEW;
-			vx6953_stm5m0edof_delay_msecs_stdby =
-				((((2 * 1000 * vx6953_ctrl->fps_divider)/
-				vx6953_ctrl->fps) * Q8) / Q10) + 1;
-		} else {
-			rt = RES_CAPTURE;
-			vx6953_stm5m0edof_delay_msecs_stdby =
-				((((1000 * vx6953_ctrl->fps_divider)/
-				vx6953_ctrl->fps) * Q8) / Q10) + 1;
-		}
-		if (vx6953_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-			return rc;
-	}
-	vx6953_ctrl->edof_mode = VX6953_EDOF_APPLICATION;
-	if (vx6953_enable_edof(vx6953_ctrl->edof_mode) < 0)
-		return rc;
-	vx6953_ctrl->curr_res = vx6953_ctrl->pict_res;
-	vx6953_ctrl->sensormode = mode;
-	return rc;
-} /*end of vx6953_raw_snapshot_config*/
-static int32_t vx6953_set_sensor_mode(int mode,
-	int res)
-{
-	int32_t rc = 0;
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = vx6953_video_config(mode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-		rc = vx6953_snapshot_config(mode);
-		break;
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = vx6953_raw_snapshot_config(mode);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-static int32_t vx6953_power_down(void)
-{
-	return 0;
-}
-
-
-static int vx6953_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	gpio_set_value_cansleep(data->sensor_reset, 0);
-	gpio_free(data->sensor_reset);
-	return 0;
-}
-static int vx6953_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	int32_t rc = 0;
-	unsigned short chipidl, chipidh;
-	CDBG("%s: %d\n", __func__, __LINE__);
-	rc = gpio_request(data->sensor_reset, "vx6953");
-	CDBG(" vx6953_probe_init_sensor \n");
-	if (!rc) {
-		CDBG("sensor_reset = %d\n", rc);
-		CDBG(" vx6953_probe_init_sensor 1\n");
-		gpio_direction_output(data->sensor_reset, 0);
-		msleep(10);
-		CDBG(" vx6953_probe_init_sensor 1\n");
-		gpio_set_value_cansleep(data->sensor_reset, 1);
-	} else {
-		CDBG(" vx6953_probe_init_sensor 2\n");
-		goto init_probe_done;
-	}
-	msleep(20);
-	CDBG(" vx6953_probe_init_sensor is called\n");
-	/* 3. Read sensor Model ID: */
-	rc = vx6953_i2c_read(0x0000, &chipidh, 1);
-	if (rc < 0) {
-		CDBG(" vx6953_probe_init_sensor 3\n");
-		goto init_probe_fail;
-	}
-	rc = vx6953_i2c_read(0x0001, &chipidl, 1);
-	if (rc < 0) {
-		CDBG(" vx6953_probe_init_sensor4\n");
-		goto init_probe_fail;
-	}
-	CDBG("vx6953 model_id = 0x%x  0x%x\n", chipidh, chipidl);
-	/* 4. Compare sensor ID to VX6953 ID: */
-	if (chipidh != 0x03 || chipidl != 0xB9) {
-		rc = -ENODEV;
-		CDBG("vx6953_probe_init_sensor fail chip id doesnot match\n");
-		goto init_probe_fail;
-	}
-	goto init_probe_done;
-init_probe_fail:
-	CDBG(" vx6953_probe_init_sensor fails\n");
-	vx6953_probe_init_done(data);
-init_probe_done:
-	CDBG(" vx6953_probe_init_sensor finishes\n");
-	return rc;
-	}
-/* camsensor_iu060f_vx6953_reset */
-int vx6953_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	unsigned short revision_number;
-	int32_t rc = 0;
-
-	CDBG("%s: %d\n", __func__, __LINE__);
-	CDBG("Calling vx6953_sensor_open_init\n");
-	vx6953_ctrl = kzalloc(sizeof(struct vx6953_ctrl_t), GFP_KERNEL);
-	if (!vx6953_ctrl) {
-		CDBG("vx6953_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	vx6953_ctrl->fps_divider = 1 * 0x00000400;
-	vx6953_ctrl->pict_fps_divider = 1 * 0x00000400;
-	vx6953_ctrl->set_test = TEST_OFF;
-	vx6953_ctrl->prev_res = QTR_SIZE;
-	vx6953_ctrl->pict_res = FULL_SIZE;
-	vx6953_ctrl->curr_res = INVALID_SIZE;
-	vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_2;
-	vx6953_ctrl->edof_mode = VX6953_EDOF_ESTIMATION;
-	if (data)
-		vx6953_ctrl->sensordata = data;
-	if (rc < 0) {
-		CDBG("Calling vx6953_sensor_open_init fail1\n");
-		return rc;
-	}
-	CDBG("%s: %d\n", __func__, __LINE__);
-	/* enable mclk first */
-	msm_camio_clk_rate_set(VX6953_STM5M0EDOF_DEFAULT_MASTER_CLK_RATE);
-	CDBG("%s: %d\n", __func__, __LINE__);
-	rc = vx6953_probe_init_sensor(data);
-	if (rc < 0) {
-		CDBG("Calling vx6953_sensor_open_init fail3\n");
-		goto init_fail;
-	}
-	if (vx6953_i2c_read(0x0002, &revision_number, 1) < 0)
-		return rc;
-		CDBG("sensor revision number major = 0x%x\n", revision_number);
-	if (vx6953_i2c_read(0x0018, &revision_number, 1) < 0)
-		return rc;
-		CDBG("sensor revision number = 0x%x\n", revision_number);
-	if (revision_number == VX6953_REVISION_NUMBER_CUT3) {
-		vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_3;
-		CDBG("VX6953 EDof Cut 3.0 sensor\n ");
-	} else if (revision_number == VX6953_REVISION_NUMBER_CUT2) {
-		vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_2;
-		CDBG("VX6953 EDof Cut 2.0 sensor\n ");
-	} else {/* Cut1.0 reads 0x00 for register 0x0018*/
-		vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_1;
-		CDBG("VX6953 EDof Cut 1.0 sensor\n ");
-	}
-	if (vx6953_ctrl->prev_res == QTR_SIZE) {
-		if (vx6953_sensor_setting(REG_INIT, RES_PREVIEW) < 0)
-			return rc;
-	} else {
-		if (vx6953_sensor_setting(REG_INIT, RES_CAPTURE) < 0)
-			return rc;
-	}
-	vx6953_ctrl->fps = 30*Q8;
-	if (rc < 0)
-		goto init_fail;
-	else
-		goto init_done;
-init_fail:
-	CDBG("init_fail\n");
-	vx6953_probe_init_done(data);
-	kfree(vx6953_ctrl);
-init_done:
-	CDBG("init_done\n");
-	return rc;
-} /*endof vx6953_sensor_open_init*/
-
-static int vx6953_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&vx6953_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id vx6953_i2c_id[] = {
-	{"vx6953", 0},
-	{ }
-};
-
-static int vx6953_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("vx6953_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	vx6953_sensorw = kzalloc(sizeof(struct vx6953_work_t), GFP_KERNEL);
-	if (!vx6953_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, vx6953_sensorw);
-	vx6953_init_client(client);
-	vx6953_client = client;
-
-	msleep(50);
-
-	CDBG("vx6953_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("vx6953_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int vx6953_send_wb_info(struct wb_info_cfg *wb)
-{
-	unsigned short read_data;
-	uint8_t temp[8];
-	int rc = 0;
-	int i = 0;
-
-	/* red_gain */
-	temp[2] = wb->red_gain >> 8;
-	temp[3] = wb->red_gain & 0xFF;
-
-	/* green_gain */
-	temp[0] = wb->green_gain >> 8;
-	temp[1] = wb->green_gain & 0xFF;
-	temp[6] = temp[0];
-	temp[7] = temp[1];
-
-	/* blue_gain */
-	temp[4] = wb->blue_gain >> 8;
-	temp[5] = wb->blue_gain & 0xFF;
-	rc = vx6953_i2c_write_seq_sensor(0x0B8E, &temp[0], 8);
-
-	for (i = 0; i < 6; i++) {
-		rc = vx6953_i2c_read(0x0B8E + i, &read_data, 1);
-		CDBG("%s addr 0x%x val %d \n", __func__, 0x0B8E + i, read_data);
-	}
-	rc = vx6953_i2c_read(0x0B82, &read_data, 1);
-	CDBG("%s addr 0x%x val %d \n", __func__, 0x0B82, read_data);
-	if (rc < 0)
-		return rc;
-	return rc;
-} /*end of vx6953_snapshot_config*/
-
-static int __exit vx6953_remove(struct i2c_client *client)
-{
-	struct vx6953_work_t_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	vx6953_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static struct i2c_driver vx6953_i2c_driver = {
-	.id_table = vx6953_i2c_id,
-	.probe  = vx6953_i2c_probe,
-	.remove = __exit_p(vx6953_i2c_remove),
-	.driver = {
-		.name = "vx6953",
-	},
-};
-
-int vx6953_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-	if (copy_from_user(&cdata,
-		(void *)argp,
-		sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(&vx6953_mut);
-	CDBG("vx6953_sensor_config: cfgtype = %d\n",
-	cdata.cfgtype);
-		switch (cdata.cfgtype) {
-		case CFG_GET_PICT_FPS:
-			vx6953_get_pict_fps(
-				cdata.cfg.gfps.prevfps,
-				&(cdata.cfg.gfps.pictfps));
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PREV_L_PF:
-			cdata.cfg.prevl_pf =
-			vx6953_get_prev_lines_pf();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PREV_P_PL:
-			cdata.cfg.prevp_pl =
-				vx6953_get_prev_pixels_pl();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_L_PF:
-			cdata.cfg.pictl_pf =
-				vx6953_get_pict_lines_pf();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_P_PL:
-			cdata.cfg.pictp_pl =
-				vx6953_get_pict_pixels_pl();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_MAX_EXP_LC:
-			cdata.cfg.pict_max_exp_lc =
-				vx6953_get_pict_max_exp_lc();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_SET_FPS:
-		case CFG_SET_PICT_FPS:
-			rc = vx6953_set_fps(&(cdata.cfg.fps));
-			break;
-
-		case CFG_SET_EXP_GAIN:
-			rc =
-				vx6953_write_exp_gain(
-					cdata.cfg.exp_gain.gain,
-					cdata.cfg.exp_gain.line);
-			break;
-
-		case CFG_SET_PICT_EXP_GAIN:
-			rc =
-				vx6953_set_pict_exp_gain(
-				cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-			break;
-
-		case CFG_SET_MODE:
-			rc = vx6953_set_sensor_mode(cdata.mode,
-					cdata.rs);
-			break;
-
-		case CFG_PWR_DOWN:
-			rc = vx6953_power_down();
-			break;
-
-		case CFG_MOVE_FOCUS:
-			rc =
-				vx6953_move_focus(
-				cdata.cfg.focus.dir,
-				cdata.cfg.focus.steps);
-			break;
-
-		case CFG_SET_DEFAULT_FOCUS:
-			rc =
-				vx6953_set_default_focus(
-				cdata.cfg.focus.steps);
-			break;
-
-		case CFG_SET_EFFECT:
-			rc = vx6953_set_default_focus(
-				cdata.cfg.effect);
-			break;
-
-
-		case CFG_SEND_WB_INFO:
-			rc = vx6953_send_wb_info(
-				&(cdata.cfg.wb_info));
-			break;
-
-		default:
-			rc = -EFAULT;
-			break;
-		}
-
-	mutex_unlock(&vx6953_mut);
-
-	return rc;
-}
-
-
-
-
-static int vx6953_sensor_release(void)
-{
-	int rc = -EBADF;
-	mutex_lock(&vx6953_mut);
-	vx6953_power_down();
-	gpio_direction_output(vx6953_ctrl->sensordata->sensor_reset, 0);
-	gpio_free(vx6953_ctrl->sensordata->sensor_reset);
-	kfree(vx6953_ctrl);
-	vx6953_ctrl = NULL;
-	CDBG("vx6953_release completed\n");
-	mutex_unlock(&vx6953_mut);
-
-	return rc;
-}
-
-static int vx6953_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-	rc = i2c_add_driver(&vx6953_i2c_driver);
-	if (rc < 0 || vx6953_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_fail;
-	}
-	msm_camio_clk_rate_set(24000000);
-	rc = vx6953_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-	s->s_init = vx6953_sensor_open_init;
-	s->s_release = vx6953_sensor_release;
-	s->s_config  = vx6953_sensor_config;
-	s->s_mount_angle  = info->sensor_platform_info->mount_angle;
-	vx6953_probe_init_done(info);
-	return rc;
-
-probe_fail:
-	CDBG("vx6953_sensor_probe: SENSOR PROBE FAILS!\n");
-	return rc;
-}
-
-static int __vx6953_probe(struct platform_device *pdev)
-{
-	return msm_camera_drv_start(pdev, vx6953_sensor_probe);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __vx6953_probe,
-	.driver = {
-		.name = "msm_camera_vx6953",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init vx6953_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(vx6953_init);
-void vx6953_exit(void)
-{
-	i2c_del_driver(&vx6953_i2c_driver);
-}
-
-
diff --git a/drivers/media/video/msm/vx6953.h b/drivers/media/video/msm/vx6953.h
deleted file mode 100644
index 175facc..0000000
--- a/drivers/media/video/msm/vx6953.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef VX6953_H
-#define VX6953_H
-#include <linux/types.h>
-#include <mach/board.h>
-extern struct vx6953_reg vx6953_regs;
-struct reg_struct_init {
-	uint8_t reg_0x0112;      /* 0x0112*/
-	uint8_t reg_0x0113;      /* 0x0113*/
-	uint8_t vt_pix_clk_div;  /* 0x0301*/
-	uint8_t pre_pll_clk_div; /* 0x0305*/
-	uint8_t pll_multiplier;  /* 0x0307*/
-	uint8_t op_pix_clk_div;  /* 0x0309*/
-	uint8_t reg_0x3030;      /*0x3030*/
-	uint8_t reg_0x0111;      /*0x0111*/
-	uint8_t reg_0x0b00;      /*0x0b00*/
-	uint8_t reg_0x3001;      /*0x3001*/
-	uint8_t reg_0x3004;      /*0x3004*/
-	uint8_t reg_0x3007;      /*0x3007*/
-	uint8_t reg_0x3016;      /*0x3016*/
-	uint8_t reg_0x301d;      /*0x301d*/
-	uint8_t reg_0x317e;      /*0x317E*/
-	uint8_t reg_0x317f;      /*0x317F*/
-	uint8_t reg_0x3400;      /*0x3400*/
-	uint8_t reg_0x0b06;      /*0x0b06*/
-	uint8_t reg_0x0b07;      /*0x0b07*/
-	uint8_t reg_0x0b08;      /*0x0b08*/
-	uint8_t reg_0x0b09;      /*0x0b09*/
-	uint8_t reg_0x0136;
-	uint8_t reg_0x0137;
-	/* Edof */
-	uint8_t reg_0x0b83;      /*0x0b83*/
-	uint8_t reg_0x0b84;      /*0x0b84*/
-	uint8_t reg_0x0b85;      /*0x0b85*/
-	uint8_t reg_0x0b88;      /*0x0b88*/
-	uint8_t reg_0x0b89;      /*0x0b89*/
-	uint8_t reg_0x0b8a;      /*0x0b8a*/
-	};
-struct reg_struct {
-	uint8_t coarse_integration_time_hi; /*REG_COARSE_INTEGRATION_TIME_HI*/
-	uint8_t coarse_integration_time_lo; /*REG_COARSE_INTEGRATION_TIME_LO*/
-	uint8_t analogue_gain_code_global;
-	uint8_t frame_length_lines_hi; /* 0x0340*/
-	uint8_t frame_length_lines_lo; /* 0x0341*/
-	uint8_t line_length_pck_hi;    /* 0x0342*/
-	uint8_t line_length_pck_lo;    /* 0x0343*/
-	uint8_t reg_0x3005;   /* 0x3005*/
-	uint8_t reg_0x3010;  /* 0x3010*/
-	uint8_t reg_0x3011;  /* 0x3011*/
-	uint8_t reg_0x301a;  /* 0x301a*/
-	uint8_t reg_0x3035;  /* 0x3035*/
-	uint8_t reg_0x3036;   /* 0x3036*/
-	uint8_t reg_0x3041;  /*0x3041*/
-	uint8_t reg_0x3042;  /*0x3042*/
-	uint8_t reg_0x3045;  /*0x3045*/
-	uint8_t reg_0x0b80;   /* 0x0b80*/
-	uint8_t reg_0x0900;   /*0x0900*/
-	uint8_t reg_0x0901;   /* 0x0901*/
-	uint8_t reg_0x0902;   /*0x0902*/
-	uint8_t reg_0x0383;   /*0x0383*/
-	uint8_t reg_0x0387;   /* 0x0387*/
-	uint8_t reg_0x034c;   /* 0x034c*/
-	uint8_t reg_0x034d;   /*0x034d*/
-	uint8_t reg_0x034e;   /* 0x034e*/
-	uint8_t reg_0x034f;   /* 0x034f*/
-	uint8_t reg_0x1716; /*0x1716*/
-	uint8_t reg_0x1717; /*0x1717*/
-	uint8_t reg_0x1718; /*0x1718*/
-	uint8_t reg_0x1719; /*0x1719*/
-	uint8_t reg_0x3210;/*0x3210*/
-	uint8_t reg_0x111; /*0x111*/
-	uint8_t reg_0x3410;  /*0x3410*/
-	uint8_t reg_0x3098;
-	uint8_t reg_0x309D;
-	uint8_t reg_0x0200;
-	uint8_t reg_0x0201;
-	};
-struct vx6953_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-enum vx6953_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum vx6953_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-enum vx6953_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-enum mt9p012_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-enum sensor_revision_t {
-	VX6953_STM5M0EDOF_CUT_1,
-	VX6953_STM5M0EDOF_CUT_2,
-	VX6953_STM5M0EDOF_CUT_3
-};
-enum edof_mode_t {
-	VX6953_EDOF_DISABLE,       /* 0x00 */
-	VX6953_EDOF_APPLICATION,   /* 0x01 */
-	VX6953_EDOF_ESTIMATION     /* 0x02 */
-};
-struct vx6953_reg {
-	const struct reg_struct_init  *reg_pat_init;
-	const struct reg_struct  *reg_pat;
-};
-#endif /* VX6953_H */
diff --git a/drivers/media/video/msm/vx6953_reg.c b/drivers/media/video/msm/vx6953_reg.c
deleted file mode 100644
index eee6904..0000000
--- a/drivers/media/video/msm/vx6953_reg.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Copyright (c) 2010, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-
-#include "vx6953.h"
-const struct reg_struct_init vx6953_reg_init[1] = {
-	{
-		10,			/*REG = 0x0112 , 10 bit */
-		10,			/*REG = 0x0113*/
-		9,			/*REG = 0x0301 vt_pix_clk_div*/
-		4,		/*REG = 0x0305 pre_pll_clk_div*/
-		133,		/*REG = 0x0307 pll_multiplier*/
-		10,		/*REG = 0x0309 op_pix_clk_div*/
-		0x08,		/*REG = 0x3030*/
-		0x02,		/*REG = 0x0111*/
-		0x01,		/*REG = 0x0b00 ,lens shading off */
-		0x30,		/*REG = 0x3001*/
-		0x33,		/*REG = 0x3004*/
-		0x09,		/*REG = 0x3007*/
-		0x1F,		/*REG = 0x3016*/
-		0x03,		/*REG = 0x301d*/
-		0x11,		/*REG = 0x317E*/
-		0x09,		/*REG = 0x317F*/
-		0x38,		/*REG = 0x3400*/
-		0x00,		/*REG_0x0b06*/
-		0x80,		/*REG_0x0b07*/
-		0x01,		/*REG_0x0b08*/
-		0x4F,		/*REG_0x0b09*/
-		0x18,		/*REG_0x0136*/
-		0x00,		/*/REG_0x0137*/
-		0x20,		/*REG = 0x0b83*/
-		0x90,		/*REG = 0x0b84*/
-		0x20,		/*REG = 0x0b85*/
-		0x80,		/*REG = 0x0b88*/
-		0x00,		/*REG = 0x0b89*/
-		0x00,		/*REG = 0x0b8a*/
-	}
-};
-const struct reg_struct vx6953_reg_pat[2] = {
-	{/* Preview */
-		0x03,	/*REG = 0x0202 coarse integration_time_hi*/
-		0xd0,	/*REG = 0x0203 coarse_integration_time_lo*/
-		0xc0,	/*REG = 0x0205 analogue_gain_code_global*/
-		0x03,	/*REG = 0x0340 frame_length_lines_hi*/
-		0xf0,	/*REG = 0x0341 frame_length_lines_lo*/
-		0x0b,	/*REG = 0x0342  line_length_pck_hi*/
-		0x74,	/*REG = 0x0343  line_length_pck_lo*/
-		0x03,	/*REG = 0x3005*/
-		0x00,	/*REG = 0x3010*/
-		0x01,	/*REG = 0x3011*/
-		0x6a,	/*REG = 0x301a*/
-		0x03,	/*REG = 0x3035*/
-		0x2c,	/*REG = 0x3036*/
-		0x00,	/*REG = 0x3041*/
-		0x24,	/*REG = 0x3042*/
-		0x81,	/*REG = 0x3045*/
-		0x02,	/*REG = 0x0b80 edof estimate*/
-		0x01,	/*REG = 0x0900*/
-		0x22,	/*REG = 0x0901*/
-		0x04,	/*REG = 0x0902*/
-		0x03,	/*REG = 0x0383*/
-		0x03,	/*REG = 0x0387*/
-		0x05,	/*REG = 0x034c*/
-		0x18,	/*REG = 0x034d*/
-		0x03,	/*REG = 0x034e*/
-		0xd4,	/*REG = 0x034f*/
-		0x02,	/*0x1716*/
-		0x04,	/*0x1717*/
-		0x08,	/*0x1718*/
-		0x2c,	/*0x1719*/
-		0x01,   /*0x3210*/
-		0x02,   /*0x111*/
-		0x01,   /*0x3410*/
-		0x01,   /*0x3098*/
-		0x05,   /*0x309D*/
-		0x02,
-		0x04,
-	},
-	{ /* Snapshot */
-		0x07,/*REG = 0x0202 coarse_integration_time_hi*/
-		0x00,/*REG = 0x0203 coarse_integration_time_lo*/
-		0xc0,/*REG = 0x0205 analogue_gain_code_global*/
-		0x07,/*REG = 0x0340 frame_length_lines_hi*/
-		0xd0,/*REG = 0x0341 frame_length_lines_lo*/
-		0x0b,/*REG = 0x0342 line_length_pck_hi*/
-		0x8c,/*REG = 0x0343 line_length_pck_lo*/
-		0x01,/*REG = 0x3005*/
-		0x00,/*REG = 0x3010*/
-		0x00,/*REG = 0x3011*/
-		0x55,/*REG = 0x301a*/
-		0x01,/*REG = 0x3035*/
-		0x23,/*REG = 0x3036*/
-		0x00,/*REG = 0x3041*/
-		0x24,/*REG = 0x3042*/
-		0xb7,/*REG = 0x3045*/
-		0x01,/*REG = 0x0b80 edof application*/
-		0x00,/*REG = 0x0900*/
-		0x00,/*REG = 0x0901*/
-		0x00,/*REG = 0x0902*/
-		0x01,/*REG = 0x0383*/
-		0x01,/*REG = 0x0387*/
-		0x0A,/*REG = 0x034c*/
-		0x30,/*REG = 0x034d*/
-		0x07,/*REG = 0x034e*/
-		0xA8,/*REG = 0x034f*/
-		0x02,/*0x1716*/
-		0x0d,/*0x1717*/
-		0x07,/*0x1718*/
-		0x7d,/*0x1719*/
-		0x01,/*0x3210*/
-		0x02,/*0x111*/
-		0x01,/*0x3410*/
-		0x01,/*0x3098*/
-		0x05, /*0x309D*/
-		0x02,
-		0x00,
-	}
-};
-
-
-
-struct vx6953_reg vx6953_regs = {
-	.reg_pat_init = &vx6953_reg_init[0],
-	.reg_pat = &vx6953_reg_pat[0],
-};
diff --git a/drivers/media/video/msm/vx6953_reg_v4l2.c b/drivers/media/video/msm/vx6953_reg_v4l2.c
deleted file mode 100644
index 8b1c1be..0000000
--- a/drivers/media/video/msm/vx6953_reg_v4l2.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-
-#include "vx6953_v4l2.h"
-const struct reg_struct_init vx6953_reg_init[1] = {
-	{
-		10,			/*REG = 0x0112 , 10 bit */
-		10,			/*REG = 0x0113*/
-		9,			/*REG = 0x0301 vt_pix_clk_div*/
-		4,		/*REG = 0x0305 pre_pll_clk_div*/
-		133,		/*REG = 0x0307 pll_multiplier*/
-		10,		/*REG = 0x0309 op_pix_clk_div*/
-		0x08,		/*REG = 0x3030*/
-		0x02,		/*REG = 0x0111*/
-		0x01,		/*REG = 0x0b00 ,lens shading off */
-		0x30,		/*REG = 0x3001*/
-		0x33,		/*REG = 0x3004*/
-		0x09,		/*REG = 0x3007*/
-		0x1F,		/*REG = 0x3016*/
-		0x03,		/*REG = 0x301d*/
-		0x11,		/*REG = 0x317E*/
-		0x09,		/*REG = 0x317F*/
-		0x38,		/*REG = 0x3400*/
-		0x00,		/*REG_0x0b06*/
-		0x80,		/*REG_0x0b07*/
-		0x01,		/*REG_0x0b08*/
-		0x4F,		/*REG_0x0b09*/
-		0x18,		/*REG_0x0136*/
-		0x00,		/*/REG_0x0137*/
-		0x20,		/*REG = 0x0b83*/
-		0x90,		/*REG = 0x0b84*/
-		0x20,		/*REG = 0x0b85*/
-		0x80,		/*REG = 0x0b88*/
-		0x00,		/*REG = 0x0b89*/
-		0x00,		/*REG = 0x0b8a*/
-	}
-};
-const struct reg_struct vx6953_reg_pat[2] = {
-	{/* Preview */
-		0x03,	/*REG = 0x0202 coarse integration_time_hi*/
-		0xd0,	/*REG = 0x0203 coarse_integration_time_lo*/
-		0xc0,	/*REG = 0x0205 analogue_gain_code_global*/
-		0x03,	/*REG = 0x0340 frame_length_lines_hi*/
-		0xf0,	/*REG = 0x0341 frame_length_lines_lo*/
-		0x0b,	/*REG = 0x0342  line_length_pck_hi*/
-		0xa5,	/*REG = 0x0343  line_length_pck_lo*/
-		0x03,	/*REG = 0x3005*/
-		0x00,	/*REG = 0x3010*/
-		0x01,	/*REG = 0x3011*/
-		0x6a,	/*REG = 0x301a*/
-		0x03,	/*REG = 0x3035*/
-		0x2c,	/*REG = 0x3036*/
-		0x00,	/*REG = 0x3041*/
-		0x24,	/*REG = 0x3042*/
-		0x81,	/*REG = 0x3045*/
-		0x02,	/*REG = 0x0b80 edof estimate*/
-		0x01,	/*REG = 0x0900*/
-		0x22,	/*REG = 0x0901*/
-		0x04,	/*REG = 0x0902*/
-		0x03,	/*REG = 0x0383*/
-		0x03,	/*REG = 0x0387*/
-		0x05,	/*REG = 0x034c*/
-		0x18,	/*REG = 0x034d*/
-		0x03,	/*REG = 0x034e*/
-		0xd4,	/*REG = 0x034f*/
-		0x02,	/*0x1716*/
-		0x04,	/*0x1717*/
-		0x08,	/*0x1718*/
-		0x80,	/*0x1719*/
-		0x01,   /*0x3210*/
-		0x02,   /*0x111*/
-		0x01,   /*0x3410*/
-		0x01,   /*0x3098*/
-		0x05,   /*0x309D*/
-		0x02,
-		0x04,
-	},
-	{ /* Snapshot */
-		0x07,/*REG = 0x0202 coarse_integration_time_hi*/
-		0x00,/*REG = 0x0203 coarse_integration_time_lo*/
-		0xc0,/*REG = 0x0205 analogue_gain_code_global*/
-		0x07,/*REG = 0x0340 frame_length_lines_hi*/
-		0xd0,/*REG = 0x0341 frame_length_lines_lo*/
-		0x0b,/*REG = 0x0342 line_length_pck_hi*/
-		0x8c,/*REG = 0x0343 line_length_pck_lo*/
-		0x01,/*REG = 0x3005*/
-		0x00,/*REG = 0x3010*/
-		0x00,/*REG = 0x3011*/
-		0x55,/*REG = 0x301a*/
-		0x01,/*REG = 0x3035*/
-		0x23,/*REG = 0x3036*/
-		0x00,/*REG = 0x3041*/
-		0x24,/*REG = 0x3042*/
-		0xb7,/*REG = 0x3045*/
-		0x01,/*REG = 0x0b80 edof application*/
-		0x00,/*REG = 0x0900*/
-		0x00,/*REG = 0x0901*/
-		0x00,/*REG = 0x0902*/
-		0x01,/*REG = 0x0383*/
-		0x01,/*REG = 0x0387*/
-		0x0A,/*REG = 0x034c*/
-		0x30,/*REG = 0x034d*/
-		0x07,/*REG = 0x034e*/
-		0xA8,/*REG = 0x034f*/
-		0x02,/*0x1716*/
-		0x0d,/*0x1717*/
-		0x07,/*0x1718*/
-		0x7d,/*0x1719*/
-		0x01,/*0x3210*/
-		0x02,/*0x111*/
-		0x01,/*0x3410*/
-		0x01,/*0x3098*/
-		0x05, /*0x309D*/
-		0x02,
-		0x00,
-	}
-};
-
-
-
-struct vx6953_reg vx6953_regs = {
-	.reg_pat_init = &vx6953_reg_init[0],
-	.reg_pat = &vx6953_reg_pat[0],
-};
diff --git a/drivers/media/video/msm/vx6953_v4l2.c b/drivers/media/video/msm/vx6953_v4l2.c
deleted file mode 100644
index 7913752..0000000
--- a/drivers/media/video/msm/vx6953_v4l2.c
+++ /dev/null
@@ -1,4149 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/types.h>
-#include <linux/i2c.h>
-#include <linux/uaccess.h>
-#include <linux/miscdevice.h>
-#include <media/v4l2-subdev.h>
-#include <media/msm_camera.h>
-#include <mach/gpio.h>
-#include <mach/camera.h>
-#include <linux/slab.h>
-#include "vx6953_v4l2.h"
-#include "msm.h"
-
-#define V4L2_IDENT_VX6953  50000
-
-/*=============================================================
-	SENSOR REGISTER DEFINES
-==============================================================*/
-
-#define REG_GROUPED_PARAMETER_HOLD			0x0104
-#define GROUPED_PARAMETER_HOLD_OFF			0x00
-#define GROUPED_PARAMETER_HOLD				0x01
-#define REG_MODE_SELECT					0x0100
-#define MODE_SELECT_STANDBY_MODE			0x00
-#define MODE_SELECT_STREAM				0x01
-/* Integration Time */
-#define REG_COARSE_INTEGRATION_TIME_HI			0x0202
-#define REG_COARSE_INTEGRATION_TIME_LO			0x0203
-/* Gain */
-#define REG_ANALOGUE_GAIN_CODE_GLOBAL_HI		0x0204
-#define REG_ANALOGUE_GAIN_CODE_GLOBAL_LO		0x0205
-/* Digital Gain */
-#define REG_DIGITAL_GAIN_GREEN_R_HI			0x020E
-#define REG_DIGITAL_GAIN_GREEN_R_LO			0x020F
-#define REG_DIGITAL_GAIN_RED_HI				0x0210
-#define REG_DIGITAL_GAIN_RED_LO				0x0211
-#define REG_DIGITAL_GAIN_BLUE_HI			0x0212
-#define REG_DIGITAL_GAIN_BLUE_LO			0x0213
-#define REG_DIGITAL_GAIN_GREEN_B_HI			0x0214
-#define REG_DIGITAL_GAIN_GREEN_B_LO			0x0215
-/* output bits setting */
-#define REG_0x0112					0x0112
-#define REG_0x0113					0x0113
-/* PLL registers */
-#define REG_VT_PIX_CLK_DIV				0x0301
-#define REG_PRE_PLL_CLK_DIV				0x0305
-#define REG_PLL_MULTIPLIER				0x0307
-#define REG_OP_PIX_CLK_DIV				0x0309
-#define REG_0x034c					0x034c
-#define REG_0x034d					0x034d
-#define REG_0x034e					0x034e
-#define REG_0x034f					0x034f
-#define REG_0x0387					0x0387
-#define REG_0x0383					0x0383
-#define REG_FRAME_LENGTH_LINES_HI			0x0340
-#define REG_FRAME_LENGTH_LINES_LO			0x0341
-#define REG_LINE_LENGTH_PCK_HI				0x0342
-#define REG_LINE_LENGTH_PCK_LO				0x0343
-#define REG_0x3030					0x3030
-#define REG_0x0111					0x0111
-#define REG_0x0136					0x0136
-#define REG_0x0137					0x0137
-#define REG_0x0b00					0x0b00
-#define REG_0x3001					0x3001
-#define REG_0x3004					0x3004
-#define REG_0x3007					0x3007
-#define REG_0x301a					0x301a
-#define REG_0x3101					0x3101
-#define REG_0x3364					0x3364
-#define REG_0x3365					0x3365
-#define REG_0x0b83					0x0b83
-#define REG_0x0b84					0x0b84
-#define REG_0x0b85					0x0b85
-#define REG_0x0b88					0x0b88
-#define REG_0x0b89					0x0b89
-#define REG_0x0b8a					0x0b8a
-#define REG_0x3005					0x3005
-#define REG_0x3010					0x3010
-#define REG_0x3036					0x3036
-#define REG_0x3041					0x3041
-#define REG_0x0b80					0x0b80
-#define REG_0x0900					0x0900
-#define REG_0x0901					0x0901
-#define REG_0x0902					0x0902
-#define REG_0x3016					0x3016
-#define REG_0x301d					0x301d
-#define REG_0x317e					0x317e
-#define REG_0x317f					0x317f
-#define REG_0x3400					0x3400
-#define REG_0x303a					0x303a
-#define REG_0x1716					0x1716
-#define REG_0x1717					0x1717
-#define REG_0x1718					0x1718
-#define REG_0x1719					0x1719
-#define REG_0x3006					0x3006
-#define REG_0x301b					0x301b
-#define REG_0x3098					0x3098
-#define REG_0x309d					0x309d
-#define REG_0x3011					0x3011
-#define REG_0x3035					0x3035
-#define REG_0x3045					0x3045
-#define REG_0x3210					0x3210
-#define	REG_0x0111					0x0111
-#define REG_0x3410					0x3410
-/* Test Pattern */
-#define REG_TEST_PATTERN_MODE				0x0601
-
-/*============================================================================
-							 TYPE DECLARATIONS
-============================================================================*/
-
-/* 16bit address - 8 bit context register structure */
-#define	VX6953_STM5M0EDOF_OFFSET	9
-#define	Q8		0x00000100
-#define	Q10		0x00000400
-#define	VX6953_STM5M0EDOF_MAX_SNAPSHOT_EXPOSURE_LINE_COUNT	2922
-#define	VX6953_STM5M0EDOF_DEFAULT_MASTER_CLK_RATE	24000000
-#define	VX6953_STM5M0EDOF_OP_PIXEL_CLOCK_RATE	79800000
-#define	VX6953_STM5M0EDOF_VT_PIXEL_CLOCK_RATE	88670000
-/* Full	Size */
-#define	VX6953_FULL_SIZE_WIDTH	2608
-#define	VX6953_FULL_SIZE_HEIGHT		1960
-#define	VX6953_FULL_SIZE_DUMMY_PIXELS	1
-#define	VX6953_FULL_SIZE_DUMMY_LINES	0
-/* Quarter Size	*/
-#define	VX6953_QTR_SIZE_WIDTH	1304
-#define	VX6953_QTR_SIZE_HEIGHT		980
-#define	VX6953_QTR_SIZE_DUMMY_PIXELS	1
-#define	VX6953_QTR_SIZE_DUMMY_LINES		0
-/* Blanking	as measured	on the scope */
-/* Full	Size */
-#define	VX6953_HRZ_FULL_BLK_PIXELS	348
-#define	VX6953_VER_FULL_BLK_LINES	40
-/* Quarter Size	*/
-#define	VX6953_HRZ_QTR_BLK_PIXELS	1628
-#define	VX6953_VER_QTR_BLK_LINES	28
-#define	MAX_LINE_LENGTH_PCK		8190
-#define	VX6953_REVISION_NUMBER_CUT2	0x10/*revision number	for	Cut2.0*/
-#define	VX6953_REVISION_NUMBER_CUT3	0x20/*revision number	for	Cut3.0*/
-/* FIXME: Changes from here */
-struct vx6953_work_t {
-	struct work_struct work;
-};
-
-static struct vx6953_work_t *vx6953_sensorw;
-static struct i2c_client *vx6953_client;
-
-struct vx6953_ctrl_t {
-	const struct  msm_camera_sensor_info *sensordata;
-
-	uint32_t sensormode;
-	uint32_t fps_divider;  /* init to 1 * 0x00000400 */
-	uint32_t pict_fps_divider;  /* init to 1 * 0x00000400 */
-	uint16_t fps;
-
-	int16_t curr_lens_pos;
-	uint16_t curr_step_pos;
-	uint16_t my_reg_gain;
-	uint32_t my_reg_line_count;
-	uint16_t total_lines_per_frame;
-
-	enum vx6953_resolution_t prev_res;
-	enum vx6953_resolution_t pict_res;
-	enum vx6953_resolution_t curr_res;
-	enum vx6953_test_mode_t  set_test;
-	enum sensor_revision_t sensor_type;
-
-	enum edof_mode_t edof_mode;
-
-	unsigned short imgaddr;
-
-	struct v4l2_subdev *sensor_dev;
-	struct vx6953_format *fmt;
-};
-
-
-static uint8_t vx6953_stm5m0edof_delay_msecs_stdby;
-static uint16_t vx6953_stm5m0edof_delay_msecs_stream = 20;
-
-static struct vx6953_ctrl_t *vx6953_ctrl;
-static DECLARE_WAIT_QUEUE_HEAD(vx6953_wait_queue);
-DEFINE_MUTEX(vx6953_mut);
-static struct vx6953_i2c_reg_conf patch_tbl_cut2[] = {
-	{0xFB94, 0},	/*intialise Data Xfer Status reg*/
-	{0xFB95, 0},	/*gain 1	  (0x00)*/
-	{0xFB96, 0},	/*gain 1.07   (0x10)*/
-	{0xFB97, 0},	/*gain 1.14   (0x20)*/
-	{0xFB98, 0},	/*gain 1.23   (0x30)*/
-	{0xFB99, 0},	/*gain 1.33   (0x40)*/
-	{0xFB9A, 0},	/*gain 1.45   (0x50)*/
-	{0xFB9B, 0},	/*gain 1.6    (0x60)*/
-	{0xFB9C, 0},	/*gain 1.78   (0x70)*/
-	{0xFB9D, 2},	/*gain 2	  (0x80)*/
-	{0xFB9E, 2},	/*gain 2.29   (0x90)*/
-	{0xFB9F, 3},	/*gain 2.67   (0xA0)*/
-	{0xFBA0, 3},	/*gain 3.2    (0xB0)*/
-	{0xFBA1, 4},	/*gain 4	  (0xC0)*/
-	{0xFBA2, 7},	/*gain 5.33   (0xD0)*/
-	{0xFBA3, 10},	/*gain 8	  (0xE0)*/
-	{0xFBA4, 11},	/*gain 9.14   (0xE4)*/
-	{0xFBA5, 13},	/*gain 10.67  (0xE8)*/
-	{0xFBA6, 15},	/*gain 12.8   (0xEC)*/
-	{0xFBA7, 19},	/*gain 16     (0xF0)*/
-	{0xF800, 0x12},
-	{0xF801, 0x06},
-	{0xF802, 0xf7},
-	{0xF803, 0x90},
-	{0xF804, 0x02},
-	{0xF805, 0x05},
-	{0xF806, 0xe0},
-	{0xF807, 0xff},
-	{0xF808, 0x65},
-	{0xF809, 0x7d},
-	{0xF80A, 0x70},
-	{0xF80B, 0x03},
-	{0xF80C, 0x02},
-	{0xF80D, 0xf9},
-	{0xF80E, 0x1c},
-	{0xF80F, 0x8f},
-	{0xF810, 0x7d},
-	{0xF811, 0xe4},
-	{0xF812, 0xf5},
-	{0xF813, 0x7a},
-	{0xF814, 0x75},
-	{0xF815, 0x78},
-	{0xF816, 0x30},
-	{0xF817, 0x75},
-	{0xF818, 0x79},
-	{0xF819, 0x53},
-	{0xF81A, 0x85},
-	{0xF81B, 0x79},
-	{0xF81C, 0x82},
-	{0xF81D, 0x85},
-	{0xF81E, 0x78},
-	{0xF81F, 0x83},
-	{0xF820, 0xe0},
-	{0xF821, 0xc3},
-	{0xF822, 0x95},
-	{0xF823, 0x7b},
-	{0xF824, 0xf0},
-	{0xF825, 0x74},
-	{0xF826, 0x02},
-	{0xF827, 0x25},
-	{0xF828, 0x79},
-	{0xF829, 0xf5},
-	{0xF82A, 0x79},
-	{0xF82B, 0xe4},
-	{0xF82C, 0x35},
-	{0xF82D, 0x78},
-	{0xF82E, 0xf5},
-	{0xF82F, 0x78},
-	{0xF830, 0x05},
-	{0xF831, 0x7a},
-	{0xF832, 0xe5},
-	{0xF833, 0x7a},
-	{0xF834, 0xb4},
-	{0xF835, 0x08},
-	{0xF836, 0xe3},
-	{0xF837, 0xe5},
-	{0xF838, 0x7d},
-	{0xF839, 0x70},
-	{0xF83A, 0x04},
-	{0xF83B, 0xff},
-	{0xF83C, 0x02},
-	{0xF83D, 0xf8},
-	{0xF83E, 0xe4},
-	{0xF83F, 0xe5},
-	{0xF840, 0x7d},
-	{0xF841, 0xb4},
-	{0xF842, 0x10},
-	{0xF843, 0x05},
-	{0xF844, 0x7f},
-	{0xF845, 0x01},
-	{0xF846, 0x02},
-	{0xF847, 0xf8},
-	{0xF848, 0xe4},
-	{0xF849, 0xe5},
-	{0xF84A, 0x7d},
-	{0xF84B, 0xb4},
-	{0xF84C, 0x20},
-	{0xF84D, 0x05},
-	{0xF84E, 0x7f},
-	{0xF84F, 0x02},
-	{0xF850, 0x02},
-	{0xF851, 0xf8},
-	{0xF852, 0xe4},
-	{0xF853, 0xe5},
-	{0xF854, 0x7d},
-	{0xF855, 0xb4},
-	{0xF856, 0x30},
-	{0xF857, 0x05},
-	{0xF858, 0x7f},
-	{0xF859, 0x03},
-	{0xF85A, 0x02},
-	{0xF85B, 0xf8},
-	{0xF85C, 0xe4},
-	{0xF85D, 0xe5},
-	{0xF85E, 0x7d},
-	{0xF85F, 0xb4},
-	{0xF860, 0x40},
-	{0xF861, 0x04},
-	{0xF862, 0x7f},
-	{0xF863, 0x04},
-	{0xF864, 0x80},
-	{0xF865, 0x7e},
-	{0xF866, 0xe5},
-	{0xF867, 0x7d},
-	{0xF868, 0xb4},
-	{0xF869, 0x50},
-	{0xF86A, 0x04},
-	{0xF86B, 0x7f},
-	{0xF86C, 0x05},
-	{0xF86D, 0x80},
-	{0xF86E, 0x75},
-	{0xF86F, 0xe5},
-	{0xF870, 0x7d},
-	{0xF871, 0xb4},
-	{0xF872, 0x60},
-	{0xF873, 0x04},
-	{0xF874, 0x7f},
-	{0xF875, 0x06},
-	{0xF876, 0x80},
-	{0xF877, 0x6c},
-	{0xF878, 0xe5},
-	{0xF879, 0x7d},
-	{0xF87A, 0xb4},
-	{0xF87B, 0x70},
-	{0xF87C, 0x04},
-	{0xF87D, 0x7f},
-	{0xF87E, 0x07},
-	{0xF87F, 0x80},
-	{0xF880, 0x63},
-	{0xF881, 0xe5},
-	{0xF882, 0x7d},
-	{0xF883, 0xb4},
-	{0xF884, 0x80},
-	{0xF885, 0x04},
-	{0xF886, 0x7f},
-	{0xF887, 0x08},
-	{0xF888, 0x80},
-	{0xF889, 0x5a},
-	{0xF88A, 0xe5},
-	{0xF88B, 0x7d},
-	{0xF88C, 0xb4},
-	{0xF88D, 0x90},
-	{0xF88E, 0x04},
-	{0xF88F, 0x7f},
-	{0xF890, 0x09},
-	{0xF891, 0x80},
-	{0xF892, 0x51},
-	{0xF893, 0xe5},
-	{0xF894, 0x7d},
-	{0xF895, 0xb4},
-	{0xF896, 0xa0},
-	{0xF897, 0x04},
-	{0xF898, 0x7f},
-	{0xF899, 0x0a},
-	{0xF89A, 0x80},
-	{0xF89B, 0x48},
-	{0xF89C, 0xe5},
-	{0xF89D, 0x7d},
-	{0xF89E, 0xb4},
-	{0xF89F, 0xb0},
-	{0xF8A0, 0x04},
-	{0xF8A1, 0x7f},
-	{0xF8A2, 0x0b},
-	{0xF8A3, 0x80},
-	{0xF8A4, 0x3f},
-	{0xF8A5, 0xe5},
-	{0xF8A6, 0x7d},
-	{0xF8A7, 0xb4},
-	{0xF8A8, 0xc0},
-	{0xF8A9, 0x04},
-	{0xF8AA, 0x7f},
-	{0xF8AB, 0x0c},
-	{0xF8AC, 0x80},
-	{0xF8AD, 0x36},
-	{0xF8AE, 0xe5},
-	{0xF8AF, 0x7d},
-	{0xF8B0, 0xb4},
-	{0xF8B1, 0xd0},
-	{0xF8B2, 0x04},
-	{0xF8B3, 0x7f},
-	{0xF8B4, 0x0d},
-	{0xF8B5, 0x80},
-	{0xF8B6, 0x2d},
-	{0xF8B7, 0xe5},
-	{0xF8B8, 0x7d},
-	{0xF8B9, 0xb4},
-	{0xF8BA, 0xe0},
-	{0xF8BB, 0x04},
-	{0xF8BC, 0x7f},
-	{0xF8BD, 0x0e},
-	{0xF8BE, 0x80},
-	{0xF8BF, 0x24},
-	{0xF8C0, 0xe5},
-	{0xF8C1, 0x7d},
-	{0xF8C2, 0xb4},
-	{0xF8C3, 0xe4},
-	{0xF8C4, 0x04},
-	{0xF8C5, 0x7f},
-	{0xF8C6, 0x0f},
-	{0xF8C7, 0x80},
-	{0xF8C8, 0x1b},
-	{0xF8C9, 0xe5},
-	{0xF8CA, 0x7d},
-	{0xF8CB, 0xb4},
-	{0xF8CC, 0xe8},
-	{0xF8CD, 0x04},
-	{0xF8CE, 0x7f},
-	{0xF8CF, 0x10},
-	{0xF8D0, 0x80},
-	{0xF8D1, 0x12},
-	{0xF8D2, 0xe5},
-	{0xF8D3, 0x7d},
-	{0xF8D4, 0xb4},
-	{0xF8D5, 0xec},
-	{0xF8D6, 0x04},
-	{0xF8D7, 0x7f},
-	{0xF8D8, 0x11},
-	{0xF8D9, 0x80},
-	{0xF8DA, 0x09},
-	{0xF8DB, 0xe5},
-	{0xF8DC, 0x7d},
-	{0xF8DD, 0x7f},
-	{0xF8DE, 0x00},
-	{0xF8DF, 0xb4},
-	{0xF8E0, 0xf0},
-	{0xF8E1, 0x02},
-	{0xF8E2, 0x7f},
-	{0xF8E3, 0x12},
-	{0xF8E4, 0x8f},
-	{0xF8E5, 0x7c},
-	{0xF8E6, 0xef},
-	{0xF8E7, 0x24},
-	{0xF8E8, 0x95},
-	{0xF8E9, 0xff},
-	{0xF8EA, 0xe4},
-	{0xF8EB, 0x34},
-	{0xF8EC, 0xfb},
-	{0xF8ED, 0x8f},
-	{0xF8EE, 0x82},
-	{0xF8EF, 0xf5},
-	{0xF8F0, 0x83},
-	{0xF8F1, 0xe4},
-	{0xF8F2, 0x93},
-	{0xF8F3, 0xf5},
-	{0xF8F4, 0x7c},
-	{0xF8F5, 0xf5},
-	{0xF8F6, 0x7b},
-	{0xF8F7, 0xe4},
-	{0xF8F8, 0xf5},
-	{0xF8F9, 0x7a},
-	{0xF8FA, 0x75},
-	{0xF8FB, 0x78},
-	{0xF8FC, 0x30},
-	{0xF8FD, 0x75},
-	{0xF8FE, 0x79},
-	{0xF8FF, 0x53},
-	{0xF900, 0x85},
-	{0xF901, 0x79},
-	{0xF902, 0x82},
-	{0xF903, 0x85},
-	{0xF904, 0x78},
-	{0xF905, 0x83},
-	{0xF906, 0xe0},
-	{0xF907, 0x25},
-	{0xF908, 0x7c},
-	{0xF909, 0xf0},
-	{0xF90A, 0x74},
-	{0xF90B, 0x02},
-	{0xF90C, 0x25},
-	{0xF90D, 0x79},
-	{0xF90E, 0xf5},
-	{0xF90F, 0x79},
-	{0xF910, 0xe4},
-	{0xF911, 0x35},
-	{0xF912, 0x78},
-	{0xF913, 0xf5},
-	{0xF914, 0x78},
-	{0xF915, 0x05},
-	{0xF916, 0x7a},
-	{0xF917, 0xe5},
-	{0xF918, 0x7a},
-	{0xF919, 0xb4},
-	{0xF91A, 0x08},
-	{0xF91B, 0xe4},
-	{0xF91C, 0x02},
-	{0xF91D, 0x18},
-	{0xF91E, 0x32},
-	{0xF91F, 0x22},
-	{0xF920, 0xf0},
-	{0xF921, 0x90},
-	{0xF922, 0xa0},
-	{0xF923, 0xf8},
-	{0xF924, 0xe0},
-	{0xF925, 0x70},
-	{0xF926, 0x02},
-	{0xF927, 0xa3},
-	{0xF928, 0xe0},
-	{0xF929, 0x70},
-	{0xF92A, 0x0a},
-	{0xF92B, 0x90},
-	{0xF92C, 0xa1},
-	{0xF92D, 0x10},
-	{0xF92E, 0xe0},
-	{0xF92F, 0xfe},
-	{0xF930, 0xa3},
-	{0xF931, 0xe0},
-	{0xF932, 0xff},
-	{0xF933, 0x80},
-	{0xF934, 0x04},
-	{0xF935, 0x7e},
-	{0xF936, 0x00},
-	{0xF937, 0x7f},
-	{0xF938, 0x00},
-	{0xF939, 0x8e},
-	{0xF93A, 0x7e},
-	{0xF93B, 0x8f},
-	{0xF93C, 0x7f},
-	{0xF93D, 0x90},
-	{0xF93E, 0x36},
-	{0xF93F, 0x0d},
-	{0xF940, 0xe0},
-	{0xF941, 0x44},
-	{0xF942, 0x02},
-	{0xF943, 0xf0},
-	{0xF944, 0x90},
-	{0xF945, 0x36},
-	{0xF946, 0x0e},
-	{0xF947, 0xe5},
-	{0xF948, 0x7e},
-	{0xF949, 0xf0},
-	{0xF94A, 0xa3},
-	{0xF94B, 0xe5},
-	{0xF94C, 0x7f},
-	{0xF94D, 0xf0},
-	{0xF94E, 0xe5},
-	{0xF94F, 0x3a},
-	{0xF950, 0x60},
-	{0xF951, 0x0c},
-	{0xF952, 0x90},
-	{0xF953, 0x36},
-	{0xF954, 0x09},
-	{0xF955, 0xe0},
-	{0xF956, 0x70},
-	{0xF957, 0x06},
-	{0xF958, 0x90},
-	{0xF959, 0x36},
-	{0xF95A, 0x08},
-	{0xF95B, 0xf0},
-	{0xF95C, 0xf5},
-	{0xF95D, 0x3a},
-	{0xF95E, 0x02},
-	{0xF95F, 0x03},
-	{0xF960, 0x94},
-	{0xF961, 0x22},
-	{0xF962, 0x78},
-	{0xF963, 0x07},
-	{0xF964, 0xe6},
-	{0xF965, 0xd3},
-	{0xF966, 0x94},
-	{0xF967, 0x00},
-	{0xF968, 0x40},
-	{0xF969, 0x16},
-	{0xF96A, 0x16},
-	{0xF96B, 0xe6},
-	{0xF96C, 0x90},
-	{0xF96D, 0x30},
-	{0xF96E, 0xa1},
-	{0xF96F, 0xf0},
-	{0xF970, 0x90},
-	{0xF971, 0x43},
-	{0xF972, 0x83},
-	{0xF973, 0xe0},
-	{0xF974, 0xb4},
-	{0xF975, 0x01},
-	{0xF976, 0x0f},
-	{0xF977, 0x90},
-	{0xF978, 0x43},
-	{0xF979, 0x87},
-	{0xF97A, 0xe0},
-	{0xF97B, 0xb4},
-	{0xF97C, 0x01},
-	{0xF97D, 0x08},
-	{0xF97E, 0x80},
-	{0xF97F, 0x00},
-	{0xF980, 0x90},
-	{0xF981, 0x30},
-	{0xF982, 0xa0},
-	{0xF983, 0x74},
-	{0xF984, 0x01},
-	{0xF985, 0xf0},
-	{0xF986, 0x22},
-	{0xF987, 0xf0},
-	{0xF988, 0x90},
-	{0xF989, 0x35},
-	{0xF98A, 0xba},
-	{0xF98B, 0xe0},
-	{0xF98C, 0xb4},
-	{0xF98D, 0x0a},
-	{0xF98E, 0x0d},
-	{0xF98F, 0xa3},
-	{0xF990, 0xe0},
-	{0xF991, 0xb4},
-	{0xF992, 0x01},
-	{0xF993, 0x08},
-	{0xF994, 0x90},
-	{0xF995, 0xfb},
-	{0xF996, 0x94},
-	{0xF997, 0xe0},
-	{0xF998, 0x90},
-	{0xF999, 0x35},
-	{0xF99A, 0xb8},
-	{0xF99B, 0xf0},
-	{0xF99C, 0xd0},
-	{0xF99D, 0xd0},
-	{0xF99E, 0xd0},
-	{0xF99F, 0x82},
-	{0xF9A0, 0xd0},
-	{0xF9A1, 0x83},
-	{0xF9A2, 0xd0},
-	{0xF9A3, 0xe0},
-	{0xF9A4, 0x32},
-	{0xF9A5, 0x22},
-	{0xF9A6, 0xe5},
-	{0xF9A7, 0x7f},
-	{0xF9A8, 0x45},
-	{0xF9A9, 0x7e},
-	{0xF9AA, 0x60},
-	{0xF9AB, 0x15},
-	{0xF9AC, 0x90},
-	{0xF9AD, 0x01},
-	{0xF9AE, 0x00},
-	{0xF9AF, 0xe0},
-	{0xF9B0, 0x70},
-	{0xF9B1, 0x0f},
-	{0xF9B2, 0x90},
-	{0xF9B3, 0xa0},
-	{0xF9B4, 0xf8},
-	{0xF9B5, 0xe5},
-	{0xF9B6, 0x7e},
-	{0xF9B7, 0xf0},
-	{0xF9B8, 0xa3},
-	{0xF9B9, 0xe5},
-	{0xF9BA, 0x7f},
-	{0xF9BB, 0xf0},
-	{0xF9BC, 0xe4},
-	{0xF9BD, 0xf5},
-	{0xF9BE, 0x7e},
-	{0xF9BF, 0xf5},
-	{0xF9C0, 0x7f},
-	{0xF9C1, 0x22},
-	{0xF9C2, 0x02},
-	{0xF9C3, 0x0e},
-	{0xF9C4, 0x79},
-	{0xF9C5, 0x22},
-	/* Offsets:*/
-	{0x35C6, 0x00},/* FIDDLEDARKCAL*/
-	{0x35C7, 0x00},
-	{0x35C8, 0x01},/*STOREDISTANCEATSTOPSTREAMING*/
-	{0x35C9, 0x20},
-	{0x35CA, 0x01},/*BRUCEFIX*/
-	{0x35CB, 0x62},
-	{0x35CC, 0x01},/*FIXDATAXFERSTATUSREG*/
-	{0x35CD, 0x87},
-	{0x35CE, 0x01},/*FOCUSDISTANCEUPDATE*/
-	{0x35CF, 0xA6},
-	{0x35D0, 0x01},/*SKIPEDOFRESET*/
-	{0x35D1, 0xC2},
-	{0x35D2, 0x00},
-	{0x35D3, 0xFB},
-	{0x35D4, 0x00},
-	{0x35D5, 0x94},
-	{0x35D6, 0x00},
-	{0x35D7, 0xFB},
-	{0x35D8, 0x00},
-	{0x35D9, 0x94},
-	{0x35DA, 0x00},
-	{0x35DB, 0xFB},
-	{0x35DC, 0x00},
-	{0x35DD, 0x94},
-	{0x35DE, 0x00},
-	{0x35DF, 0xFB},
-	{0x35E0, 0x00},
-	{0x35E1, 0x94},
-	{0x35E6, 0x18},/* FIDDLEDARKCAL*/
-	{0x35E7, 0x2F},
-	{0x35E8, 0x03},/* STOREDISTANCEATSTOPSTREAMING*/
-	{0x35E9, 0x93},
-	{0x35EA, 0x18},/* BRUCEFIX*/
-	{0x35EB, 0x99},
-	{0x35EC, 0x00},/* FIXDATAXFERSTATUSREG*/
-	{0x35ED, 0xA3},
-	{0x35EE, 0x21},/* FOCUSDISTANCEUPDATE*/
-	{0x35EF, 0x5B},
-	{0x35F0, 0x0E},/* SKIPEDOFRESET*/
-	{0x35F1, 0x74},
-	{0x35F2, 0x04},
-	{0x35F3, 0x64},
-	{0x35F4, 0x04},
-	{0x35F5, 0x65},
-	{0x35F6, 0x04},
-	{0x35F7, 0x7B},
-	{0x35F8, 0x04},
-	{0x35F9, 0x7C},
-	{0x35FA, 0x04},
-	{0x35FB, 0xDD},
-	{0x35FC, 0x04},
-	{0x35FD, 0xDE},
-	{0x35FE, 0x04},
-	{0x35FF, 0xEF},
-	{0x3600, 0x04},
-	{0x3601, 0xF0},
-	/*Jump/Data:*/
-	{0x35C2, 0x3F},/* Jump Reg*/
-	{0x35C3, 0xFF},/* Jump Reg*/
-	{0x35C4, 0x3F},/* Data Reg*/
-	{0x35C5, 0xC0},/* Data Reg*/
-	{0x35C0, 0x01},/* Enable*/
-
-};
-
-static struct vx6953_i2c_reg_conf edof_tbl[] = {
-	{0xa098, 0x02},
-	{0xa099, 0x87},
-	{0xa09c, 0x00},
-	{0xa09d, 0xc5},
-	{0xa4ec, 0x05},
-	{0xa4ed, 0x05},
-	{0xa4f0, 0x04},
-	{0xa4f1, 0x04},
-	{0xa4f4, 0x04},
-	{0xa4f5, 0x05},
-	{0xa4f8, 0x05},
-	{0xa4f9, 0x07},
-	{0xa4fc, 0x07},
-	{0xa4fd, 0x07},
-	{0xa500, 0x07},
-	{0xa501, 0x07},
-	{0xa504, 0x08},
-	{0xa505, 0x08},
-	{0xa518, 0x01},
-	{0xa519, 0x02},
-	{0xa51c, 0x01},
-	{0xa51d, 0x00},
-	{0xa534, 0x00},
-	{0xa535, 0x04},
-	{0xa538, 0x04},
-	{0xa539, 0x03},
-	{0xa53c, 0x05},
-	{0xa53d, 0x07},
-	{0xa540, 0x07},
-	{0xa541, 0x06},
-	{0xa544, 0x07},
-	{0xa545, 0x06},
-	{0xa548, 0x05},
-	{0xa549, 0x06},
-	{0xa54c, 0x06},
-	{0xa54d, 0x07},
-	{0xa550, 0x07},
-	{0xa551, 0x04},
-	{0xa554, 0x04},
-	{0xa555, 0x04},
-	{0xa558, 0x05},
-	{0xa559, 0x06},
-	{0xa55c, 0x07},
-	{0xa55d, 0x07},
-	{0xa56c, 0x00},
-	{0xa56d, 0x0a},
-	{0xa570, 0x08},
-	{0xa571, 0x05},
-	{0xa574, 0x04},
-	{0xa575, 0x03},
-	{0xa578, 0x04},
-	{0xa579, 0x04},
-	{0xa58c, 0x1f},
-	{0xa58d, 0x1b},
-	{0xa590, 0x17},
-	{0xa591, 0x13},
-	{0xa594, 0x10},
-	{0xa595, 0x0d},
-	{0xa598, 0x0f},
-	{0xa599, 0x11},
-	{0xa59c, 0x03},
-	{0xa59d, 0x03},
-	{0xa5a0, 0x03},
-	{0xa5a1, 0x03},
-	{0xa5a4, 0x03},
-	{0xa5a5, 0x04},
-	{0xa5a8, 0x05},
-	{0xa5a9, 0x00},
-	{0xa5ac, 0x00},
-	{0xa5ad, 0x00},
-	{0xa5b0, 0x00},
-	{0xa5b1, 0x00},
-	{0xa5b4, 0x00},
-	{0xa5b5, 0x00},
-	{0xa5c4, 0x1f},
-	{0xa5c5, 0x13},
-	{0xa5c8, 0x14},
-	{0xa5c9, 0x14},
-	{0xa5cc, 0x14},
-	{0xa5cd, 0x13},
-	{0xa5d0, 0x17},
-	{0xa5d1, 0x1a},
-	{0xa5f4, 0x05},
-	{0xa5f5, 0x05},
-	{0xa5f8, 0x05},
-	{0xa5f9, 0x06},
-	{0xa5fc, 0x06},
-	{0xa5fd, 0x06},
-	{0xa600, 0x06},
-	{0xa601, 0x06},
-	{0xa608, 0x07},
-	{0xa609, 0x08},
-	{0xa60c, 0x08},
-	{0xa60d, 0x07},
-	{0xa63c, 0x00},
-	{0xa63d, 0x02},
-	{0xa640, 0x02},
-	{0xa641, 0x02},
-	{0xa644, 0x02},
-	{0xa645, 0x02},
-	{0xa648, 0x03},
-	{0xa649, 0x04},
-	{0xa64c, 0x0a},
-	{0xa64d, 0x09},
-	{0xa650, 0x08},
-	{0xa651, 0x09},
-	{0xa654, 0x09},
-	{0xa655, 0x0a},
-	{0xa658, 0x0a},
-	{0xa659, 0x0a},
-	{0xa65c, 0x0a},
-	{0xa65d, 0x09},
-	{0xa660, 0x09},
-	{0xa661, 0x09},
-	{0xa664, 0x09},
-	{0xa665, 0x08},
-	{0xa680, 0x01},
-	{0xa681, 0x02},
-	{0xa694, 0x1f},
-	{0xa695, 0x10},
-	{0xa698, 0x0e},
-	{0xa699, 0x0c},
-	{0xa69c, 0x0d},
-	{0xa69d, 0x0d},
-	{0xa6a0, 0x0f},
-	{0xa6a1, 0x11},
-	{0xa6a4, 0x00},
-	{0xa6a5, 0x00},
-	{0xa6a8, 0x00},
-	{0xa6a9, 0x00},
-	{0xa6ac, 0x00},
-	{0xa6ad, 0x00},
-	{0xa6b0, 0x00},
-	{0xa6b1, 0x04},
-	{0xa6b4, 0x04},
-	{0xa6b5, 0x04},
-	{0xa6b8, 0x04},
-	{0xa6b9, 0x04},
-	{0xa6bc, 0x05},
-	{0xa6bd, 0x05},
-	{0xa6c0, 0x1f},
-	{0xa6c1, 0x1f},
-	{0xa6c4, 0x1f},
-	{0xa6c5, 0x1f},
-	{0xa6c8, 0x1f},
-	{0xa6c9, 0x1f},
-	{0xa6cc, 0x1f},
-	{0xa6cd, 0x0b},
-	{0xa6d0, 0x0c},
-	{0xa6d1, 0x0d},
-	{0xa6d4, 0x0d},
-	{0xa6d5, 0x0d},
-	{0xa6d8, 0x11},
-	{0xa6d9, 0x14},
-	{0xa6fc, 0x02},
-	{0xa6fd, 0x03},
-	{0xa700, 0x03},
-	{0xa701, 0x03},
-	{0xa704, 0x03},
-	{0xa705, 0x04},
-	{0xa708, 0x05},
-	{0xa709, 0x02},
-	{0xa70c, 0x02},
-	{0xa70d, 0x02},
-	{0xa710, 0x03},
-	{0xa711, 0x04},
-	{0xa714, 0x04},
-	{0xa715, 0x04},
-	{0xa744, 0x00},
-	{0xa745, 0x03},
-	{0xa748, 0x04},
-	{0xa749, 0x04},
-	{0xa74c, 0x05},
-	{0xa74d, 0x06},
-	{0xa750, 0x07},
-	{0xa751, 0x07},
-	{0xa754, 0x05},
-	{0xa755, 0x05},
-	{0xa758, 0x05},
-	{0xa759, 0x05},
-	{0xa75c, 0x05},
-	{0xa75d, 0x06},
-	{0xa760, 0x07},
-	{0xa761, 0x07},
-	{0xa764, 0x06},
-	{0xa765, 0x05},
-	{0xa768, 0x05},
-	{0xa769, 0x05},
-	{0xa76c, 0x06},
-	{0xa76d, 0x07},
-	{0xa77c, 0x00},
-	{0xa77d, 0x05},
-	{0xa780, 0x05},
-	{0xa781, 0x05},
-	{0xa784, 0x05},
-	{0xa785, 0x04},
-	{0xa788, 0x05},
-	{0xa789, 0x06},
-	{0xa79c, 0x1f},
-	{0xa79d, 0x15},
-	{0xa7a0, 0x13},
-	{0xa7a1, 0x10},
-	{0xa7a4, 0x0f},
-	{0xa7a5, 0x0d},
-	{0xa7a8, 0x11},
-	{0xa7a9, 0x14},
-	{0xa7ac, 0x02},
-	{0xa7ad, 0x02},
-	{0xa7b0, 0x02},
-	{0xa7b1, 0x02},
-	{0xa7b4, 0x02},
-	{0xa7b5, 0x03},
-	{0xa7b8, 0x03},
-	{0xa7b9, 0x00},
-	{0xa7bc, 0x00},
-	{0xa7bd, 0x00},
-	{0xa7c0, 0x00},
-	{0xa7c1, 0x00},
-	{0xa7c4, 0x00},
-	{0xa7c5, 0x00},
-	{0xa7d4, 0x1f},
-	{0xa7d5, 0x0d},
-	{0xa7d8, 0x0f},
-	{0xa7d9, 0x10},
-	{0xa7dc, 0x10},
-	{0xa7dd, 0x10},
-	{0xa7e0, 0x13},
-	{0xa7e1, 0x16},
-	{0xa7f4, 0x00},
-	{0xa7f5, 0x03},
-	{0xa7f8, 0x04},
-	{0xa7f9, 0x04},
-	{0xa7fc, 0x04},
-	{0xa7fd, 0x03},
-	{0xa800, 0x03},
-	{0xa801, 0x03},
-	{0xa804, 0x03},
-	{0xa805, 0x03},
-	{0xa808, 0x03},
-	{0xa809, 0x03},
-	{0xa80c, 0x03},
-	{0xa80d, 0x04},
-	{0xa810, 0x04},
-	{0xa811, 0x0a},
-	{0xa814, 0x0a},
-	{0xa815, 0x0a},
-	{0xa818, 0x0f},
-	{0xa819, 0x14},
-	{0xa81c, 0x14},
-	{0xa81d, 0x14},
-	{0xa82c, 0x00},
-	{0xa82d, 0x04},
-	{0xa830, 0x02},
-	{0xa831, 0x00},
-	{0xa834, 0x00},
-	{0xa835, 0x00},
-	{0xa838, 0x00},
-	{0xa839, 0x00},
-	{0xa840, 0x1f},
-	{0xa841, 0x1f},
-	{0xa848, 0x1f},
-	{0xa849, 0x1f},
-	{0xa84c, 0x1f},
-	{0xa84d, 0x0c},
-	{0xa850, 0x0c},
-	{0xa851, 0x0c},
-	{0xa854, 0x0c},
-	{0xa855, 0x0c},
-	{0xa858, 0x0c},
-	{0xa859, 0x0c},
-	{0xa85c, 0x0c},
-	{0xa85d, 0x0c},
-	{0xa860, 0x0c},
-	{0xa861, 0x0c},
-	{0xa864, 0x0c},
-	{0xa865, 0x0c},
-	{0xa868, 0x0c},
-	{0xa869, 0x0c},
-	{0xa86c, 0x0c},
-	{0xa86d, 0x0c},
-	{0xa870, 0x0c},
-	{0xa871, 0x0c},
-	{0xa874, 0x0c},
-	{0xa875, 0x0c},
-	{0xa878, 0x1f},
-	{0xa879, 0x1f},
-	{0xa87c, 0x1f},
-	{0xa87d, 0x1f},
-	{0xa880, 0x1f},
-	{0xa881, 0x1f},
-	{0xa884, 0x1f},
-	{0xa885, 0x0c},
-	{0xa888, 0x0c},
-	{0xa889, 0x0c},
-	{0xa88c, 0x0c},
-	{0xa88d, 0x0c},
-	{0xa890, 0x0c},
-	{0xa891, 0x0c},
-	{0xa898, 0x1f},
-	{0xa899, 0x1f},
-	{0xa8a0, 0x1f},
-	{0xa8a1, 0x1f},
-	{0xa8a4, 0x1f},
-	{0xa8a5, 0x0c},
-	{0xa8a8, 0x0c},
-	{0xa8a9, 0x0c},
-	{0xa8ac, 0x0c},
-	{0xa8ad, 0x0c},
-	{0xa8b0, 0x0c},
-	{0xa8b1, 0x0c},
-	{0xa8b4, 0x0c},
-	{0xa8b5, 0x0c},
-	{0xa8b8, 0x0c},
-	{0xa8b9, 0x0c},
-	{0xa8bc, 0x0c},
-	{0xa8bd, 0x0c},
-	{0xa8c0, 0x0c},
-	{0xa8c1, 0x0c},
-	{0xa8c4, 0x0c},
-	{0xa8c5, 0x0c},
-	{0xa8c8, 0x0c},
-	{0xa8c9, 0x0c},
-	{0xa8cc, 0x0c},
-	{0xa8cd, 0x0c},
-	{0xa8d0, 0x1f},
-	{0xa8d1, 0x1f},
-	{0xa8d4, 0x1f},
-	{0xa8d5, 0x1f},
-	{0xa8d8, 0x1f},
-	{0xa8d9, 0x1f},
-	{0xa8dc, 0x1f},
-	{0xa8dd, 0x0c},
-	{0xa8e0, 0x0c},
-	{0xa8e1, 0x0c},
-	{0xa8e4, 0x0c},
-	{0xa8e5, 0x0c},
-	{0xa8e8, 0x0c},
-	{0xa8e9, 0x0c},
-	{0xa8f0, 0x1f},
-	{0xa8f1, 0x1f},
-	{0xa8f8, 0x1f},
-	{0xa8f9, 0x1f},
-	{0xa8fc, 0x1f},
-	{0xa8fd, 0x0c},
-	{0xa900, 0x0c},
-	{0xa901, 0x0c},
-	{0xa904, 0x0c},
-	{0xa905, 0x0c},
-	{0xa908, 0x0c},
-	{0xa909, 0x0c},
-	{0xa90c, 0x0c},
-	{0xa90d, 0x0c},
-	{0xa910, 0x0c},
-	{0xa911, 0x0c},
-	{0xa914, 0x0c},
-	{0xa915, 0x0c},
-	{0xa918, 0x0c},
-	{0xa919, 0x0c},
-	{0xa91c, 0x0c},
-	{0xa91d, 0x0c},
-	{0xa920, 0x0c},
-	{0xa921, 0x0c},
-	{0xa924, 0x0c},
-	{0xa925, 0x0c},
-	{0xa928, 0x1f},
-	{0xa929, 0x1f},
-	{0xa92c, 0x1f},
-	{0xa92d, 0x1f},
-	{0xa930, 0x1f},
-	{0xa931, 0x1f},
-	{0xa934, 0x1f},
-	{0xa935, 0x0c},
-	{0xa938, 0x0c},
-	{0xa939, 0x0c},
-	{0xa93c, 0x0c},
-	{0xa93d, 0x0c},
-	{0xa940, 0x0c},
-	{0xa941, 0x0c},
-	{0xa96c, 0x0d},
-	{0xa96d, 0x16},
-	{0xa970, 0x19},
-	{0xa971, 0x0e},
-	{0xa974, 0x16},
-	{0xa975, 0x1a},
-	{0xa978, 0x0d},
-	{0xa979, 0x15},
-	{0xa97c, 0x19},
-	{0xa97d, 0x0d},
-	{0xa980, 0x15},
-	{0xa981, 0x1a},
-	{0xa984, 0x0d},
-	{0xa985, 0x15},
-	{0xa988, 0x1a},
-	{0xa989, 0x0d},
-	{0xa98c, 0x15},
-	{0xa98d, 0x1a},
-	{0xa990, 0x0b},
-	{0xa991, 0x11},
-	{0xa994, 0x02},
-	{0xa995, 0x0e},
-	{0xa998, 0x16},
-	{0xa999, 0x02},
-	{0xa99c, 0x0c},
-	{0xa99d, 0x13},
-	{0xa9a0, 0x02},
-	{0xa9a1, 0x0c},
-	{0xa9a4, 0x12},
-	{0xa9a5, 0x02},
-	{0xa9a8, 0x0c},
-	{0xa9a9, 0x12},
-	{0xa9ac, 0x02},
-	{0xa9ad, 0x0c},
-	{0xa9b0, 0x12},
-	{0xa9b1, 0x02},
-	{0xa9b4, 0x10},
-	{0xa9b5, 0x1e},
-	{0xa9b8, 0x0f},
-	{0xa9b9, 0x13},
-	{0xa9bc, 0x20},
-	{0xa9bd, 0x10},
-	{0xa9c0, 0x11},
-	{0xa9c1, 0x1e},
-	{0xa9c4, 0x10},
-	{0xa9c5, 0x11},
-	{0xa9c8, 0x1e},
-	{0xa9c9, 0x10},
-	{0xa9cc, 0x11},
-	{0xa9cd, 0x20},
-	{0xa9d0, 0x10},
-	{0xa9d1, 0x13},
-	{0xa9d4, 0x24},
-	{0xa9d5, 0x10},
-	{0xa9f0, 0x02},
-	{0xa9f1, 0x01},
-	{0xa9f8, 0x19},
-	{0xa9f9, 0x0b},
-	{0xa9fc, 0x0a},
-	{0xa9fd, 0x07},
-	{0xaa00, 0x0c},
-	{0xaa01, 0x0e},
-	{0xaa08, 0x0c},
-	{0xaa09, 0x06},
-	{0xaa0c, 0x0c},
-	{0xaa0d, 0x0a},
-	{0xaa24, 0x10},
-	{0xaa25, 0x12},
-	{0xaa28, 0x0b},
-	{0xaa29, 0x07},
-	{0xaa2c, 0x10},
-	{0xaa2d, 0x14},
-	{0xaa34, 0x0e},
-	{0xaa35, 0x0e},
-	{0xaa38, 0x07},
-	{0xaa39, 0x07},
-	{0xaa3c, 0x0e},
-	{0xaa3d, 0x0c},
-	{0xaa48, 0x09},
-	{0xaa49, 0x0c},
-	{0xaa4c, 0x0c},
-	{0xaa4d, 0x07},
-	{0xaa54, 0x08},
-	{0xaa55, 0x06},
-	{0xaa58, 0x04},
-	{0xaa59, 0x05},
-	{0xaa5c, 0x06},
-	{0xaa5d, 0x06},
-	{0xaa68, 0x05},
-	{0xaa69, 0x05},
-	{0xaa6c, 0x04},
-	{0xaa6d, 0x05},
-	{0xaa74, 0x06},
-	{0xaa75, 0x04},
-	{0xaa78, 0x05},
-	{0xaa79, 0x05},
-	{0xaa7c, 0x04},
-	{0xaa7d, 0x06},
-	{0xac18, 0x14},
-	{0xac19, 0x00},
-	{0xac1c, 0x14},
-	{0xac1d, 0x00},
-	{0xac20, 0x14},
-	{0xac21, 0x00},
-	{0xac24, 0x14},
-	{0xac25, 0x00},
-	{0xac28, 0x14},
-	{0xac29, 0x00},
-	{0xac2c, 0x14},
-	{0xac2d, 0x00},
-	{0xac34, 0x16},
-	{0xac35, 0x00},
-	{0xac38, 0x16},
-	{0xac39, 0x00},
-	{0xac3c, 0x16},
-	{0xac3d, 0x00},
-	{0xac40, 0x16},
-	{0xac41, 0x00},
-	{0xac44, 0x16},
-	{0xac45, 0x00},
-	{0xac48, 0x16},
-	{0xac49, 0x00},
-	{0xac50, 0x1b},
-	{0xac51, 0x00},
-	{0xac54, 0x1b},
-	{0xac55, 0x00},
-	{0xac58, 0x1b},
-	{0xac59, 0x00},
-	{0xac5c, 0x1b},
-	{0xac5d, 0x00},
-	{0xac60, 0x1b},
-	{0xac61, 0x00},
-	{0xac64, 0x1b},
-	{0xac65, 0x00},
-	{0xac74, 0x09},
-	{0xac75, 0x0c},
-	{0xac78, 0x0f},
-	{0xac79, 0x11},
-	{0xac7c, 0x12},
-	{0xac7d, 0x14},
-	{0xac80, 0x09},
-	{0xac81, 0x0c},
-	{0xac84, 0x0f},
-	{0xac85, 0x11},
-	{0xac88, 0x12},
-	{0xac89, 0x14},
-	{0xac8c, 0x09},
-	{0xac8d, 0x0c},
-	{0xac90, 0x0f},
-	{0xac91, 0x11},
-	{0xac94, 0x12},
-	{0xac95, 0x14},
-	{0xac98, 0x09},
-	{0xac99, 0x0c},
-	{0xac9c, 0x0f},
-	{0xac9d, 0x11},
-	{0xaca0, 0x12},
-	{0xaca1, 0x14},
-	{0xaca4, 0x09},
-	{0xaca5, 0x0c},
-	{0xaca8, 0x0f},
-	{0xaca9, 0x11},
-	{0xacac, 0x12},
-	{0xacad, 0x14},
-	{0xacb0, 0x07},
-	{0xacb1, 0x09},
-	{0xacb4, 0x0c},
-	{0xacb5, 0x0d},
-	{0xacb8, 0x0d},
-	{0xacb9, 0x0e},
-	{0xacbc, 0x05},
-	{0xacbd, 0x07},
-	{0xacc0, 0x0a},
-	{0xacc1, 0x0b},
-	{0xacc4, 0x0b},
-	{0xacc5, 0x0c},
-	{0xacc8, 0x03},
-	{0xacc9, 0x04},
-	{0xaccc, 0x07},
-	{0xaccd, 0x08},
-	{0xacd0, 0x09},
-	{0xacd1, 0x09}
-};
-
-static struct vx6953_i2c_reg_conf patch_tbl_cut3[] = {
-	{0xF800, 0x90},
-	{0xF801, 0x30},
-	{0xF802, 0x31},
-	{0xF803, 0xe0},
-	{0xF804, 0xf5},
-	{0xF805, 0x7d},
-	{0xF806, 0xb4},
-	{0xF807, 0x01},
-	{0xF808, 0x06},
-	{0xF809, 0x75},
-	{0xF80A, 0x7d},
-	{0xF80B, 0x03},
-	{0xF80C, 0x74},
-	{0xF80D, 0x03},
-	{0xF80E, 0xf0},
-	{0xF80F, 0x90},
-	{0xF810, 0x30},
-	{0xF811, 0x04},
-	{0xF812, 0x74},
-	{0xF813, 0x33},
-	{0xF814, 0xf0},
-	{0xF815, 0x90},
-	{0xF816, 0x30},
-	{0xF817, 0x06},
-	{0xF818, 0xe4},
-	{0xF819, 0xf0},
-	{0xF81A, 0xa3},
-	{0xF81B, 0x74},
-	{0xF81C, 0x09},
-	{0xF81D, 0xf0},
-	{0xF81E, 0x90},
-	{0xF81F, 0x30},
-	{0xF820, 0x10},
-	{0xF821, 0xe4},
-	{0xF822, 0xf0},
-	{0xF823, 0xa3},
-	{0xF824, 0xf0},
-	{0xF825, 0x90},
-	{0xF826, 0x30},
-	{0xF827, 0x16},
-	{0xF828, 0x74},
-	{0xF829, 0x1e},
-	{0xF82A, 0xf0},
-	{0xF82B, 0x90},
-	{0xF82C, 0x30},
-	{0xF82D, 0x1a},
-	{0xF82E, 0x74},
-	{0xF82F, 0x6a},
-	{0xF830, 0xf0},
-	{0xF831, 0xa3},
-	{0xF832, 0x74},
-	{0xF833, 0x29},
-	{0xF834, 0xf0},
-	{0xF835, 0x90},
-	{0xF836, 0x30},
-	{0xF837, 0x30},
-	{0xF838, 0x74},
-	{0xF839, 0x08},
-	{0xF83A, 0xf0},
-	{0xF83B, 0x90},
-	{0xF83C, 0x30},
-	{0xF83D, 0x36},
-	{0xF83E, 0x74},
-	{0xF83F, 0x2c},
-	{0xF840, 0xf0},
-	{0xF841, 0x90},
-	{0xF842, 0x30},
-	{0xF843, 0x41},
-	{0xF844, 0xe4},
-	{0xF845, 0xf0},
-	{0xF846, 0xa3},
-	{0xF847, 0x74},
-	{0xF848, 0x24},
-	{0xF849, 0xf0},
-	{0xF84A, 0x90},
-	{0xF84B, 0x30},
-	{0xF84C, 0x45},
-	{0xF84D, 0x74},
-	{0xF84E, 0x81},
-	{0xF84F, 0xf0},
-	{0xF850, 0x90},
-	{0xF851, 0x30},
-	{0xF852, 0x98},
-	{0xF853, 0x74},
-	{0xF854, 0x01},
-	{0xF855, 0xf0},
-	{0xF856, 0x90},
-	{0xF857, 0x30},
-	{0xF858, 0x9d},
-	{0xF859, 0x74},
-	{0xF85A, 0x05},
-	{0xF85B, 0xf0},
-	{0xF85C, 0xe5},
-	{0xF85D, 0x7d},
-	{0xF85E, 0x70},
-	{0xF85F, 0x10},
-	{0xF860, 0x90},
-	{0xF861, 0x30},
-	{0xF862, 0x05},
-	{0xF863, 0x04},
-	{0xF864, 0xf0},
-	{0xF865, 0x90},
-	{0xF866, 0x30},
-	{0xF867, 0x30},
-	{0xF868, 0xe4},
-	{0xF869, 0xf0},
-	{0xF86A, 0x90},
-	{0xF86B, 0x30},
-	{0xF86C, 0x35},
-	{0xF86D, 0x04},
-	{0xF86E, 0xf0},
-	{0xF86F, 0x22},
-	{0xF870, 0xe5},
-	{0xF871, 0x7d},
-	{0xF872, 0x64},
-	{0xF873, 0x02},
-	{0xF874, 0x70},
-	{0xF875, 0x2d},
-	{0xF876, 0x90},
-	{0xF877, 0x30},
-	{0xF878, 0x04},
-	{0xF879, 0x74},
-	{0xF87A, 0x34},
-	{0xF87B, 0xf0},
-	{0xF87C, 0xa3},
-	{0xF87D, 0x74},
-	{0xF87E, 0x07},
-	{0xF87F, 0xf0},
-	{0xF880, 0x90},
-	{0xF881, 0x30},
-	{0xF882, 0x10},
-	{0xF883, 0x74},
-	{0xF884, 0x10},
-	{0xF885, 0xf0},
-	{0xF886, 0x90},
-	{0xF887, 0x30},
-	{0xF888, 0x16},
-	{0xF889, 0x74},
-	{0xF88A, 0x1f},
-	{0xF88B, 0xf0},
-	{0xF88C, 0x90},
-	{0xF88D, 0x30},
-	{0xF88E, 0x1a},
-	{0xF88F, 0x74},
-	{0xF890, 0x62},
-	{0xF891, 0xf0},
-	{0xF892, 0x90},
-	{0xF893, 0x30},
-	{0xF894, 0x35},
-	{0xF895, 0x74},
-	{0xF896, 0x04},
-	{0xF897, 0xf0},
-	{0xF898, 0x90},
-	{0xF899, 0x30},
-	{0xF89A, 0x41},
-	{0xF89B, 0x74},
-	{0xF89C, 0x60},
-	{0xF89D, 0xf0},
-	{0xF89E, 0xa3},
-	{0xF89F, 0x74},
-	{0xF8A0, 0x64},
-	{0xF8A1, 0xf0},
-	{0xF8A2, 0x22},
-	{0xF8A3, 0xe5},
-	{0xF8A4, 0x7d},
-	{0xF8A5, 0xb4},
-	{0xF8A6, 0x03},
-	{0xF8A7, 0x12},
-	{0xF8A8, 0x90},
-	{0xF8A9, 0x30},
-	{0xF8AA, 0x05},
-	{0xF8AB, 0x74},
-	{0xF8AC, 0x03},
-	{0xF8AD, 0xf0},
-	{0xF8AE, 0x90},
-	{0xF8AF, 0x30},
-	{0xF8B0, 0x11},
-	{0xF8B1, 0x74},
-	{0xF8B2, 0x01},
-	{0xF8B3, 0xf0},
-	{0xF8B4, 0x90},
-	{0xF8B5, 0x30},
-	{0xF8B6, 0x35},
-	{0xF8B7, 0x74},
-	{0xF8B8, 0x03},
-	{0xF8B9, 0xf0},
-	{0xF8BA, 0x22},
-	{0xF8BB, 0xc3},
-	{0xF8BC, 0x90},
-	{0xF8BD, 0x0b},
-	{0xF8BE, 0x89},
-	{0xF8BF, 0xe0},
-	{0xF8C0, 0x94},
-	{0xF8C1, 0x1e},
-	{0xF8C2, 0x90},
-	{0xF8C3, 0x0b},
-	{0xF8C4, 0x88},
-	{0xF8C5, 0xe0},
-	{0xF8C6, 0x94},
-	{0xF8C7, 0x00},
-	{0xF8C8, 0x50},
-	{0xF8C9, 0x06},
-	{0xF8CA, 0x7e},
-	{0xF8CB, 0x00},
-	{0xF8CC, 0x7f},
-	{0xF8CD, 0x01},
-	{0xF8CE, 0x80},
-	{0xF8CF, 0x3d},
-	{0xF8D0, 0xc3},
-	{0xF8D1, 0x90},
-	{0xF8D2, 0x0b},
-	{0xF8D3, 0x89},
-	{0xF8D4, 0xe0},
-	{0xF8D5, 0x94},
-	{0xF8D6, 0x3c},
-	{0xF8D7, 0x90},
-	{0xF8D8, 0x0b},
-	{0xF8D9, 0x88},
-	{0xF8DA, 0xe0},
-	{0xF8DB, 0x94},
-	{0xF8DC, 0x00},
-	{0xF8DD, 0x50},
-	{0xF8DE, 0x06},
-	{0xF8DF, 0x7e},
-	{0xF8E0, 0x00},
-	{0xF8E1, 0x7f},
-	{0xF8E2, 0x02},
-	{0xF8E3, 0x80},
-	{0xF8E4, 0x28},
-	{0xF8E5, 0xc3},
-	{0xF8E6, 0x90},
-	{0xF8E7, 0x0b},
-	{0xF8E8, 0x89},
-	{0xF8E9, 0xe0},
-	{0xF8EA, 0x94},
-	{0xF8EB, 0xfa},
-	{0xF8EC, 0x90},
-	{0xF8ED, 0x0b},
-	{0xF8EE, 0x88},
-	{0xF8EF, 0xe0},
-	{0xF8F0, 0x94},
-	{0xF8F1, 0x00},
-	{0xF8F2, 0x50},
-	{0xF8F3, 0x06},
-	{0xF8F4, 0x7e},
-	{0xF8F5, 0x00},
-	{0xF8F6, 0x7f},
-	{0xF8F7, 0x03},
-	{0xF8F8, 0x80},
-	{0xF8F9, 0x13},
-	{0xF8FA, 0xc3},
-	{0xF8FB, 0x90},
-	{0xF8FC, 0x0b},
-	{0xF8FD, 0x88},
-	{0xF8FE, 0xe0},
-	{0xF8FF, 0x94},
-	{0xF900, 0x80},
-	{0xF901, 0x50},
-	{0xF902, 0x06},
-	{0xF903, 0x7e},
-	{0xF904, 0x00},
-	{0xF905, 0x7f},
-	{0xF906, 0x04},
-	{0xF907, 0x80},
-	{0xF908, 0x04},
-	{0xF909, 0xae},
-	{0xF90A, 0x7e},
-	{0xF90B, 0xaf},
-	{0xF90C, 0x7f},
-	{0xF90D, 0x90},
-	{0xF90E, 0xa0},
-	{0xF90F, 0xf8},
-	{0xF910, 0xee},
-	{0xF911, 0xf0},
-	{0xF912, 0xa3},
-	{0xF913, 0xef},
-	{0xF914, 0xf0},
-	{0xF915, 0x22},
-	{0xF916, 0x90},
-	{0xF917, 0x33},
-	{0xF918, 0x82},
-	{0xF919, 0xe0},
-	{0xF91A, 0xff},
-	{0xF91B, 0x64},
-	{0xF91C, 0x01},
-	{0xF91D, 0x70},
-	{0xF91E, 0x30},
-	{0xF91F, 0xe5},
-	{0xF920, 0x7f},
-	{0xF921, 0x64},
-	{0xF922, 0x02},
-	{0xF923, 0x45},
-	{0xF924, 0x7e},
-	{0xF925, 0x70},
-	{0xF926, 0x04},
-	{0xF927, 0x7d},
-	{0xF928, 0x1e},
-	{0xF929, 0x80},
-	{0xF92A, 0x1d},
-	{0xF92B, 0xe5},
-	{0xF92C, 0x7f},
-	{0xF92D, 0x64},
-	{0xF92E, 0x03},
-	{0xF92F, 0x45},
-	{0xF930, 0x7e},
-	{0xF931, 0x70},
-	{0xF932, 0x04},
-	{0xF933, 0x7d},
-	{0xF934, 0x3c},
-	{0xF935, 0x80},
-	{0xF936, 0x11},
-	{0xF937, 0xe5},
-	{0xF938, 0x7f},
-	{0xF939, 0x64},
-	{0xF93A, 0x04},
-	{0xF93B, 0x45},
-	{0xF93C, 0x7e},
-	{0xF93D, 0x70},
-	{0xF93E, 0x04},
-	{0xF93F, 0x7d},
-	{0xF940, 0xfa},
-	{0xF941, 0x80},
-	{0xF942, 0x05},
-	{0xF943, 0x90},
-	{0xF944, 0x33},
-	{0xF945, 0x81},
-	{0xF946, 0xe0},
-	{0xF947, 0xfd},
-	{0xF948, 0xae},
-	{0xF949, 0x05},
-	{0xF94A, 0x90},
-	{0xF94B, 0x33},
-	{0xF94C, 0x81},
-	{0xF94D, 0xed},
-	{0xF94E, 0xf0},
-	{0xF94F, 0xef},
-	{0xF950, 0xb4},
-	{0xF951, 0x01},
-	{0xF952, 0x10},
-	{0xF953, 0x90},
-	{0xF954, 0x01},
-	{0xF955, 0x00},
-	{0xF956, 0xe0},
-	{0xF957, 0x60},
-	{0xF958, 0x0a},
-	{0xF959, 0x90},
-	{0xF95A, 0xa1},
-	{0xF95B, 0x10},
-	{0xF95C, 0xe0},
-	{0xF95D, 0xf5},
-	{0xF95E, 0x7e},
-	{0xF95F, 0xa3},
-	{0xF960, 0xe0},
-	{0xF961, 0xf5},
-	{0xF962, 0x7f},
-	{0xF963, 0x22},
-	{0xF964, 0x12},
-	{0xF965, 0x2f},
-	{0xF966, 0x4d},
-	{0xF967, 0x90},
-	{0xF968, 0x35},
-	{0xF969, 0x38},
-	{0xF96A, 0xe0},
-	{0xF96B, 0x70},
-	{0xF96C, 0x05},
-	{0xF96D, 0x12},
-	{0xF96E, 0x00},
-	{0xF96F, 0x0e},
-	{0xF970, 0x80},
-	{0xF971, 0x03},
-	{0xF972, 0x12},
-	{0xF973, 0x07},
-	{0xF974, 0xc9},
-	{0xF975, 0x90},
-	{0xF976, 0x40},
-	{0xF977, 0x06},
-	{0xF978, 0xe0},
-	{0xF979, 0xf4},
-	{0xF97A, 0x54},
-	{0xF97B, 0x02},
-	{0xF97C, 0xff},
-	{0xF97D, 0xe0},
-	{0xF97E, 0x54},
-	{0xF97F, 0x01},
-	{0xF980, 0x4f},
-	{0xF981, 0x90},
-	{0xF982, 0x31},
-	{0xF983, 0x32},
-	{0xF984, 0xf0},
-	{0xF985, 0x90},
-	{0xF986, 0xfa},
-	{0xF987, 0x9d},
-	{0xF988, 0xe0},
-	{0xF989, 0x70},
-	{0xF98A, 0x03},
-	{0xF98B, 0x12},
-	{0xF98C, 0x27},
-	{0xF98D, 0x27},
-	{0xF98E, 0x02},
-	{0xF98F, 0x05},
-	{0xF990, 0xac},
-	{0xF991, 0x22},
-	{0xF992, 0x78},
-	{0xF993, 0x07},
-	{0xF994, 0xe6},
-	{0xF995, 0xf5},
-	{0xF996, 0x7c},
-	{0xF997, 0xe5},
-	{0xF998, 0x7c},
-	{0xF999, 0x60},
-	{0xF99A, 0x1d},
-	{0xF99B, 0x90},
-	{0xF99C, 0x43},
-	{0xF99D, 0x83},
-	{0xF99E, 0xe0},
-	{0xF99F, 0xb4},
-	{0xF9A0, 0x01},
-	{0xF9A1, 0x16},
-	{0xF9A2, 0x90},
-	{0xF9A3, 0x43},
-	{0xF9A4, 0x87},
-	{0xF9A5, 0xe0},
-	{0xF9A6, 0xb4},
-	{0xF9A7, 0x01},
-	{0xF9A8, 0x0f},
-	{0xF9A9, 0x15},
-	{0xF9AA, 0x7c},
-	{0xF9AB, 0x90},
-	{0xF9AC, 0x30},
-	{0xF9AD, 0xa1},
-	{0xF9AE, 0xe5},
-	{0xF9AF, 0x7c},
-	{0xF9B0, 0xf0},
-	{0xF9B1, 0x90},
-	{0xF9B2, 0x30},
-	{0xF9B3, 0xa0},
-	{0xF9B4, 0x74},
-	{0xF9B5, 0x01},
-	{0xF9B6, 0xf0},
-	{0xF9B7, 0x22},
-	{0xF9B8, 0xe4},
-	{0xF9B9, 0x90},
-	{0xF9BA, 0x30},
-	{0xF9BB, 0xa0},
-	{0xF9BC, 0xf0},
-	{0xF9BD, 0x22},
-	{0xF9BE, 0xf0},
-	{0xF9BF, 0xe5},
-	{0xF9C0, 0x3a},
-	{0xF9C1, 0xb4},
-	{0xF9C2, 0x06},
-	{0xF9C3, 0x06},
-	{0xF9C4, 0x63},
-	{0xF9C5, 0x3e},
-	{0xF9C6, 0x02},
-	{0xF9C7, 0x12},
-	{0xF9C8, 0x03},
-	{0xF9C9, 0xea},
-	{0xF9CA, 0x02},
-	{0xF9CB, 0x17},
-	{0xF9CC, 0x4a},
-	{0xF9CD, 0x22},
-	{0x35C9, 0xBB},
-	{0x35CA, 0x01},
-	{0x35CB, 0x16},
-	{0x35CC, 0x01},
-	{0x35CD, 0x64},
-	{0x35CE, 0x01},
-	{0x35CF, 0x92},
-	{0x35D0, 0x01},
-	{0x35D1, 0xBE},
-	{0x35D3, 0xF6},
-	{0x35D5, 0x07},
-	{0x35D7, 0xA3},
-	{0x35DB, 0x02},
-	{0x35DD, 0x06},
-	{0x35DF, 0x1B},
-	{0x35E6, 0x28},
-	{0x35E7, 0x76},
-	{0x35E8, 0x2D},
-	{0x35E9, 0x07},
-	{0x35EA, 0x04},
-	{0x35EB, 0x43},
-	{0x35EC, 0x05},
-	{0x35ED, 0xA9},
-	{0x35EE, 0x2A},
-	{0x35EF, 0x15},
-	{0x35F0, 0x17},
-	{0x35F1, 0x41},
-	{0x35F2, 0x24},
-	{0x35F3, 0x88},
-	{0x35F4, 0x01},
-	{0x35F5, 0x54},
-	{0x35F6, 0x01},
-	{0x35F7, 0x55},
-	{0x35F8, 0x2E},
-	{0x35F9, 0xF2},
-	{0x35FA, 0x06},
-	{0x35FB, 0x02},
-	{0x35FC, 0x06},
-	{0x35FD, 0x03},
-	{0x35FE, 0x06},
-	{0x35FF, 0x04},
-	{0x35C2, 0x1F},
-	{0x35C3, 0xFF},
-	{0x35C4, 0x1F},
-	{0x35C5, 0xC0},
-	{0x35C0, 0x01},
-};
-
-struct vx6953_format {
-	enum v4l2_mbus_pixelcode code;
-	enum v4l2_colorspace colorspace;
-	u16 fmt;
-	u16 order;
-};
-
-static const struct vx6953_format vx6953_cfmts[] = {
-	{
-	.code   = V4L2_MBUS_FMT_YUYV8_2X8,
-	.colorspace = V4L2_COLORSPACE_JPEG,
-	.fmt    = 1,
-	.order    = 0,
-	}
-	/* more can be supported, to be added later */
-};
-
-
-/*=============================================================*/
-
-static int vx6953_i2c_rxdata(unsigned short saddr,
-	unsigned char *rxdata, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr  = saddr,
-			.flags = 0,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-		{
-			.addr  = saddr,
-			.flags = I2C_M_RD,
-			.len   = 2,
-			.buf   = rxdata,
-		},
-	};
-	if (i2c_transfer(vx6953_client->adapter, msgs, 2) < 0) {
-		CDBG("vx6953_i2c_rxdata failed!\n");
-		return -EIO;
-	}
-	return 0;
-}
-static int32_t vx6953_i2c_txdata(unsigned short saddr,
-				unsigned char *txdata, int length)
-{
-	struct i2c_msg msg[] = {
-		{
-			.addr = saddr,
-			.flags = 0,
-			.len = length,
-			.buf = txdata,
-		 },
-	};
-	if (i2c_transfer(vx6953_client->adapter, msg, 1) < 0) {
-		CDBG("vx6953_i2c_txdata faild 0x%x\n", vx6953_client->addr);
-		return -EIO;
-	}
-
-	return 0;
-}
-
-
-static int32_t vx6953_i2c_read(unsigned short raddr,
-	unsigned short *rdata, int rlen)
-{
-	int32_t rc = 0;
-	unsigned char buf[2];
-	if (!rdata)
-		return -EIO;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (raddr & 0xFF00) >> 8;
-	buf[1] = (raddr & 0x00FF);
-	rc = vx6953_i2c_rxdata(vx6953_client->addr>>1, buf, rlen);
-	if (rc < 0) {
-		CDBG("vx6953_i2c_read 0x%x failed!\n", raddr);
-		return rc;
-	}
-	*rdata = (rlen == 2 ? buf[0] << 8 | buf[1] : buf[0]);
-	return rc;
-}
-static int32_t vx6953_i2c_write_b_sensor(unsigned short waddr, uint8_t bdata)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[3];
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	buf[2] = bdata;
-	CDBG("i2c_write_b addr = 0x%x, val = 0x%x\n", waddr, bdata);
-	rc = vx6953_i2c_txdata(vx6953_client->addr>>1, buf, 3);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			waddr, bdata);
-	}
-	return rc;
-}
-static int32_t vx6953_i2c_write_seq_sensor(unsigned short waddr,
-	uint8_t *bdata, uint16_t len)
-{
-	int32_t rc = -EFAULT;
-	unsigned char buf[len+2];
-	int i;
-	memset(buf, 0, sizeof(buf));
-	buf[0] = (waddr & 0xFF00) >> 8;
-	buf[1] = (waddr & 0x00FF);
-	for (i = 2; i < len+2; i++)
-		buf[i] = *bdata++;
-	rc = vx6953_i2c_txdata(vx6953_client->addr>>1, buf, len+2);
-	if (rc < 0) {
-		CDBG("i2c_write_b failed, addr = 0x%x, val = 0x%x!\n",
-			 waddr, bdata[0]);
-	}
-	return rc;
-}
-
-static int32_t vx6953_i2c_write_w_table(struct vx6953_i2c_reg_conf const
-					 *reg_conf_tbl, int num)
-{
-	int i;
-	int32_t rc = -EIO;
-	for (i = 0; i < num; i++) {
-		rc = vx6953_i2c_write_b_sensor(reg_conf_tbl->waddr,
-			reg_conf_tbl->wdata);
-		if (rc < 0)
-			break;
-		reg_conf_tbl++;
-	}
-	return rc;
-}
-
-static void vx6953_get_pict_fps(uint16_t fps, uint16_t *pfps)
-{
-	/* input fps is preview fps in Q8 format */
-	uint16_t preview_frame_length_lines, snapshot_frame_length_lines;
-	uint16_t preview_line_length_pck, snapshot_line_length_pck;
-	uint32_t divider, d1, d2;
-	/* Total frame_length_lines and line_length_pck for preview */
-	preview_frame_length_lines = VX6953_QTR_SIZE_HEIGHT +
-		VX6953_VER_QTR_BLK_LINES;
-	preview_line_length_pck = VX6953_QTR_SIZE_WIDTH +
-		VX6953_HRZ_QTR_BLK_PIXELS;
-	/* Total frame_length_lines and line_length_pck for snapshot */
-	snapshot_frame_length_lines = VX6953_FULL_SIZE_HEIGHT +
-		VX6953_VER_FULL_BLK_LINES;
-	snapshot_line_length_pck = VX6953_FULL_SIZE_WIDTH +
-		VX6953_HRZ_FULL_BLK_PIXELS;
-	d1 = preview_frame_length_lines * 0x00000400/
-		snapshot_frame_length_lines;
-	d2 = preview_line_length_pck * 0x00000400/
-		snapshot_line_length_pck;
-	divider = d1 * d2 / 0x400;
-	/*Verify PCLK settings and frame sizes.*/
-	*pfps = (uint16_t) (fps * divider / 0x400);
-	/* 2 is the ratio of no.of snapshot channels
-	to number of preview channels */
-
-}
-
-static uint16_t vx6953_get_prev_lines_pf(void)
-{
-	if (vx6953_ctrl->prev_res == QTR_SIZE)
-		return VX6953_QTR_SIZE_HEIGHT + VX6953_VER_QTR_BLK_LINES;
-	else
-		return VX6953_FULL_SIZE_HEIGHT + VX6953_VER_FULL_BLK_LINES;
-
-}
-
-static uint16_t vx6953_get_prev_pixels_pl(void)
-{
-	if (vx6953_ctrl->prev_res == QTR_SIZE)
-		return VX6953_QTR_SIZE_WIDTH + VX6953_HRZ_QTR_BLK_PIXELS;
-	else
-		return VX6953_FULL_SIZE_WIDTH + VX6953_HRZ_FULL_BLK_PIXELS;
-}
-
-static uint16_t vx6953_get_pict_lines_pf(void)
-{
-		if (vx6953_ctrl->pict_res == QTR_SIZE)
-			return VX6953_QTR_SIZE_HEIGHT +
-				VX6953_VER_QTR_BLK_LINES;
-		else
-			return VX6953_FULL_SIZE_HEIGHT +
-				VX6953_VER_FULL_BLK_LINES;
-}
-
-static uint16_t vx6953_get_pict_pixels_pl(void)
-{
-	if (vx6953_ctrl->pict_res == QTR_SIZE)
-		return VX6953_QTR_SIZE_WIDTH +
-			VX6953_HRZ_QTR_BLK_PIXELS;
-	else
-		return VX6953_FULL_SIZE_WIDTH +
-			VX6953_HRZ_FULL_BLK_PIXELS;
-}
-
-static uint32_t vx6953_get_pict_max_exp_lc(void)
-{
-	if (vx6953_ctrl->pict_res == QTR_SIZE)
-		return (VX6953_QTR_SIZE_HEIGHT +
-			VX6953_VER_QTR_BLK_LINES)*24;
-	else
-		return (VX6953_FULL_SIZE_HEIGHT +
-			VX6953_VER_FULL_BLK_LINES)*24;
-}
-
-static int32_t vx6953_set_fps(struct fps_cfg	*fps)
-{
-	uint16_t total_lines_per_frame;
-	int32_t rc = 0;
-	total_lines_per_frame = (uint16_t)((VX6953_QTR_SIZE_HEIGHT +
-		VX6953_VER_QTR_BLK_LINES) * vx6953_ctrl->fps_divider/0x400);
-	if (vx6953_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_HI,
-		((total_lines_per_frame & 0xFF00) >> 8)) < 0)
-		return rc;
-	if (vx6953_i2c_write_b_sensor(REG_FRAME_LENGTH_LINES_LO,
-		(total_lines_per_frame & 0x00FF)) < 0)
-		return rc;
-	return rc;
-}
-
-static int32_t vx6953_write_exp_gain(uint16_t gain, uint32_t line)
-{
-	uint16_t line_length_pck, frame_length_lines;
-	uint8_t gain_hi, gain_lo;
-	uint8_t intg_time_hi, intg_time_lo;
-	uint8_t line_length_pck_hi = 0, line_length_pck_lo = 0;
-	uint16_t line_length_ratio = 1 * Q8;
-	int32_t rc = 0;
-	if (vx6953_ctrl->sensormode != SENSOR_SNAPSHOT_MODE) {
-		frame_length_lines = VX6953_QTR_SIZE_HEIGHT +
-		VX6953_VER_QTR_BLK_LINES;
-		line_length_pck = VX6953_QTR_SIZE_WIDTH +
-			VX6953_HRZ_QTR_BLK_PIXELS;
-		if (line > (frame_length_lines -
-			VX6953_STM5M0EDOF_OFFSET)) {
-			vx6953_ctrl->fps = (uint16_t) (30 * Q8 *
-			(frame_length_lines - VX6953_STM5M0EDOF_OFFSET)/
-			line);
-		} else {
-			vx6953_ctrl->fps = (uint16_t) (30 * Q8);
-		}
-	} else {
-		frame_length_lines = VX6953_FULL_SIZE_HEIGHT +
-				VX6953_VER_FULL_BLK_LINES;
-		line_length_pck = VX6953_FULL_SIZE_WIDTH +
-				VX6953_HRZ_FULL_BLK_PIXELS;
-	}
-	/* calculate line_length_ratio */
-	if ((frame_length_lines - VX6953_STM5M0EDOF_OFFSET) < line) {
-		line_length_ratio = (line*Q8) /
-			(frame_length_lines - VX6953_STM5M0EDOF_OFFSET);
-		line = frame_length_lines - VX6953_STM5M0EDOF_OFFSET;
-	} else {
-		line_length_ratio = 1*Q8;
-	}
-	vx6953_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-		GROUPED_PARAMETER_HOLD);
-	line_length_pck = (line_length_pck >
-		MAX_LINE_LENGTH_PCK) ?
-		MAX_LINE_LENGTH_PCK : line_length_pck;
-	line_length_pck = (uint16_t) (line_length_pck *
-		line_length_ratio/Q8);
-	line_length_pck_hi = (uint8_t) ((line_length_pck &
-		0xFF00) >> 8);
-	line_length_pck_lo = (uint8_t) (line_length_pck &
-		0x00FF);
-	vx6953_i2c_write_b_sensor(REG_LINE_LENGTH_PCK_HI,
-		line_length_pck_hi);
-	vx6953_i2c_write_b_sensor(REG_LINE_LENGTH_PCK_LO,
-		line_length_pck_lo);
-	/* update analogue gain registers */
-	gain_hi = (uint8_t) ((gain & 0xFF00) >> 8);
-	gain_lo = (uint8_t) (gain & 0x00FF);
-	vx6953_i2c_write_b_sensor(REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-		gain_lo);
-	vx6953_i2c_write_b_sensor(REG_DIGITAL_GAIN_GREEN_R_LO, gain_hi);
-	vx6953_i2c_write_b_sensor(REG_DIGITAL_GAIN_RED_LO, gain_hi);
-	vx6953_i2c_write_b_sensor(REG_DIGITAL_GAIN_BLUE_LO, gain_hi);
-	vx6953_i2c_write_b_sensor(REG_DIGITAL_GAIN_GREEN_B_LO, gain_hi);
-	CDBG("%s, gain_hi 0x%x, gain_lo 0x%x\n", __func__,
-		gain_hi, gain_lo);
-	/* update line count registers */
-	intg_time_hi = (uint8_t) (((uint16_t)line & 0xFF00) >> 8);
-	intg_time_lo = (uint8_t) ((uint16_t)line & 0x00FF);
-	vx6953_i2c_write_b_sensor(REG_COARSE_INTEGRATION_TIME_HI,
-		intg_time_hi);
-	vx6953_i2c_write_b_sensor(REG_COARSE_INTEGRATION_TIME_LO,
-		intg_time_lo);
-	vx6953_i2c_write_b_sensor(REG_GROUPED_PARAMETER_HOLD,
-		GROUPED_PARAMETER_HOLD_OFF);
-
-	return rc;
-}
-
-static int32_t vx6953_set_pict_exp_gain(uint16_t gain, uint32_t line)
-{
-	int32_t rc = 0;
-	rc = vx6953_write_exp_gain(gain, line);
-	return rc;
-} /* endof vx6953_set_pict_exp_gain*/
-
-static int32_t vx6953_move_focus(int direction,
-	int32_t num_steps)
-{
-	return 0;
-}
-
-
-static int32_t vx6953_set_default_focus(uint8_t af_step)
-{
-	return 0;
-}
-
-static int32_t vx6953_test(enum vx6953_test_mode_t mo)
-{
-	int32_t rc = 0;
-	if (mo == TEST_OFF)
-		return rc;
-	else {
-		/* REG_0x30D8[4] is TESBYPEN: 0: Normal Operation,
-		1: Bypass Signal Processing
-		REG_0x30D8[5] is EBDMASK: 0:
-		Output Embedded data, 1: No output embedded data */
-		if (vx6953_i2c_write_b_sensor(REG_TEST_PATTERN_MODE,
-			(uint8_t) mo) < 0) {
-			return rc;
-		}
-	}
-	return rc;
-}
-
-static int vx6953_enable_edof(enum edof_mode_t edof_mode)
-{
-	int rc = 0;
-	if (edof_mode == VX6953_EDOF_ESTIMATION) {
-		/* EDof Estimation mode for preview */
-		if (vx6953_i2c_write_b_sensor(REG_0x0b80, 0x02) < 0)
-			return rc;
-		CDBG("VX6953_EDOF_ESTIMATION");
-	} else if (edof_mode == VX6953_EDOF_APPLICATION) {
-		/* EDof Application mode for Capture */
-		if (vx6953_i2c_write_b_sensor(REG_0x0b80, 0x01) < 0)
-			return rc;
-		CDBG("VX6953_EDOF_APPLICATION");
-	} else {
-		/* EDOF disabled */
-		if (vx6953_i2c_write_b_sensor(REG_0x0b80, 0x00) < 0)
-			return rc;
-		CDBG("VX6953_EDOF_DISABLE");
-	}
-	return rc;
-}
-
-static int32_t vx6953_patch_for_cut2(void)
-{
-	int32_t rc = 0;
-	rc = vx6953_i2c_write_w_table(patch_tbl_cut2,
-		ARRAY_SIZE(patch_tbl_cut2));
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-static int32_t vx6953_patch_for_cut3(void)
-{
-	int32_t rc = 0;
-	rc = vx6953_i2c_write_w_table(patch_tbl_cut3,
-		ARRAY_SIZE(patch_tbl_cut3));
-	if (rc < 0)
-		return rc;
-
-	return rc;
-}
-static int32_t vx6953_sensor_setting(int update_type, int rt)
-{
-
-	int32_t rc = 0;
-	unsigned short frame_cnt;
-	struct msm_camera_csi_params vx6953_csi_params;
-	if (vx6953_ctrl->sensor_type != VX6953_STM5M0EDOF_CUT_2) {
-		switch (update_type) {
-		case REG_INIT:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct vx6953_i2c_reg_conf init_tbl[] = {
-			{REG_0x0112,
-				vx6953_regs.reg_pat_init[0].reg_0x0112},
-			{0x6003, 0x01},
-			{REG_0x0113,
-				vx6953_regs.reg_pat_init[0].reg_0x0113},
-			{REG_VT_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				vt_pix_clk_div},
-			{REG_PRE_PLL_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER,
-				vx6953_regs.reg_pat_init[0].
-				pll_multiplier},
-			{REG_OP_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				op_pix_clk_div},
-			{REG_COARSE_INTEGRATION_TIME_HI,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_hi},
-			{REG_COARSE_INTEGRATION_TIME_LO,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_lo},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-				vx6953_regs.reg_pat[rt].
-				analogue_gain_code_global},
-			{REG_0x3030,
-				vx6953_regs.reg_pat_init[0].reg_0x3030},
-			/* 953 specific registers */
-			{REG_0x0111,
-				vx6953_regs.reg_pat_init[0].reg_0x0111},
-			{REG_0x0b00,
-				vx6953_regs.reg_pat_init[0].reg_0x0b00},
-			{REG_0x3001,
-				vx6953_regs.reg_pat_init[0].reg_0x3001},
-			{REG_0x3004,
-				vx6953_regs.reg_pat_init[0].reg_0x3004},
-			{0x3006, 0x00},
-			{REG_0x3007,
-				vx6953_regs.reg_pat_init[0].reg_0x3007},
-			{0x301b, 0x29},
-			/* DEFCOR settings */
-			/*Single Defect Correction Weight DISABLE*/
-			{0x0b06,
-				vx6953_regs.reg_pat_init[0].reg_0x0b06},
-			/*Single_defect_correct_weight = auto*/
-			{0x0b07,
-				vx6953_regs.reg_pat_init[0].reg_0x0b07},
-			/*Dynamic couplet correction ENABLED*/
-			{0x0b08,
-				vx6953_regs.reg_pat_init[0].reg_0x0b08},
-			/*Dynamic couplet correction weight*/
-			{0x0b09,
-				vx6953_regs.reg_pat_init[0].reg_0x0b09},
-			/* Clock Setup */
-			/* Tell sensor ext clk is 24MHz*/
-			{REG_0x0136,
-				vx6953_regs.reg_pat_init[0].reg_0x0136},
-			{REG_0x0137,
-				vx6953_regs.reg_pat_init[0].reg_0x0137},
-			/* The white balance gains must be written
-			to the sensor every frame. */
-			/* Edof */
-			{REG_0x0b83,
-				vx6953_regs.reg_pat_init[0].reg_0x0b83},
-			{REG_0x0b84,
-				vx6953_regs.reg_pat_init[0].reg_0x0b84},
-			{REG_0x0b85,
-				vx6953_regs.reg_pat_init[0].reg_0x0b85},
-			{REG_0x0b88,
-				vx6953_regs.reg_pat_init[0].reg_0x0b88},
-			{REG_0x0b89,
-				vx6953_regs.reg_pat_init[0].reg_0x0b89},
-			{REG_0x0b8a,
-				vx6953_regs.reg_pat_init[0].reg_0x0b8a},
-			/* Mode specific regieters */
-			{REG_FRAME_LENGTH_LINES_HI,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_hi},
-			{REG_FRAME_LENGTH_LINES_LO,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_lo},
-			{REG_LINE_LENGTH_PCK_HI,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_hi},
-			{REG_LINE_LENGTH_PCK_LO,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_lo},
-			{REG_0x3005,
-				vx6953_regs.reg_pat[rt].reg_0x3005},
-			{0x3010,
-				vx6953_regs.reg_pat[rt].reg_0x3010},
-			{REG_0x3011,
-				vx6953_regs.reg_pat[rt].reg_0x3011},
-			{REG_0x301a,
-				vx6953_regs.reg_pat[rt].reg_0x301a},
-			{REG_0x3035,
-				vx6953_regs.reg_pat[rt].reg_0x3035},
-			{REG_0x3036,
-				vx6953_regs.reg_pat[rt].reg_0x3036},
-			{REG_0x3041,
-				vx6953_regs.reg_pat[rt].reg_0x3041},
-			{0x3042,
-				vx6953_regs.reg_pat[rt].reg_0x3042},
-			{REG_0x3045,
-				vx6953_regs.reg_pat[rt].reg_0x3045},
-			/*EDOF: Estimation settings for Preview mode
-			Application settings for capture mode
-			(standard settings - Not tuned) */
-			{REG_0x0b80,
-				vx6953_regs.reg_pat[rt].reg_0x0b80},
-			{REG_0x0900,
-				vx6953_regs.reg_pat[rt].reg_0x0900},
-			{REG_0x0901,
-				vx6953_regs.reg_pat[rt].reg_0x0901},
-			{REG_0x0902,
-				vx6953_regs.reg_pat[rt].reg_0x0902},
-			{REG_0x0383,
-				vx6953_regs.reg_pat[rt].reg_0x0383},
-			{REG_0x0387,
-				vx6953_regs.reg_pat[rt].reg_0x0387},
-			/* Change output size / frame rate */
-			{REG_0x034c,
-				vx6953_regs.reg_pat[rt].reg_0x034c},
-			{REG_0x034d,
-				vx6953_regs.reg_pat[rt].reg_0x034d},
-			{REG_0x034e,
-				vx6953_regs.reg_pat[rt].reg_0x034e},
-			{REG_0x034f,
-				vx6953_regs.reg_pat[rt].reg_0x034f},
-			};
-			/* reset fps_divider */
-			vx6953_ctrl->fps = 30 * Q8;
-			/* stop streaming */
-
-			/* Reset everything first */
-			if (vx6953_i2c_write_b_sensor(0x103, 0x01) < 0) {
-				CDBG("S/W reset failed\n");
-				return rc;
-			} else
-				CDBG("S/W reset successful\n");
-
-			msleep(10);
-
-			CDBG("Init vx6953_sensor_setting standby\n");
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STANDBY_MODE) < 0)
-				return rc;
-			/*vx6953_stm5m0edof_delay_msecs_stdby*/
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-
-
-			vx6953_patch_for_cut3();
-			rc = vx6953_i2c_write_w_table(&init_tbl[0],
-				ARRAY_SIZE(init_tbl));
-			if (rc < 0)
-				return rc;
-
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			vx6953_i2c_write_b_sensor(0x0b80, 0x00);
-			vx6953_i2c_write_b_sensor(0x3388, 0x03);
-			vx6953_i2c_write_b_sensor(0x3640, 0x00);
-
-			rc = vx6953_i2c_write_w_table(&edof_tbl[0],
-				ARRAY_SIZE(edof_tbl));
-			vx6953_i2c_write_b_sensor(0x3388, 0x00);
-
-		}
-		return rc;
-		case UPDATE_PERIODIC:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct vx6953_i2c_reg_conf preview_mode_tbl[] = {
-			{REG_0x0112,
-				vx6953_regs.reg_pat_init[0].reg_0x0112},
-			{0x6003, 0x01},
-			{REG_0x0113,
-				vx6953_regs.reg_pat_init[0].reg_0x0113},
-			{REG_VT_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				vt_pix_clk_div},
-			{REG_PRE_PLL_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER,
-				vx6953_regs.reg_pat_init[0].
-				pll_multiplier},
-			{REG_OP_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				op_pix_clk_div},
-
-			{REG_COARSE_INTEGRATION_TIME_HI,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_hi},
-			{REG_COARSE_INTEGRATION_TIME_LO,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_lo},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-				vx6953_regs.reg_pat[rt].
-				analogue_gain_code_global},
-
-			{REG_0x3210, vx6953_regs.reg_pat[rt].reg_0x3210},
-			{REG_0x0111, vx6953_regs.reg_pat[rt].reg_0x111},
-			{REG_0x3410, vx6953_regs.reg_pat[rt].reg_0x3410},
-
-			{REG_0x3004,
-				vx6953_regs.reg_pat_init[0].reg_0x3004},
-			{REG_0x3006, 0x00},
-			{REG_0x3007,
-				vx6953_regs.reg_pat_init[0].reg_0x3007},
-			{REG_0x301b, 0x29},
-			{REG_0x3036,
-				vx6953_regs.reg_pat[rt].reg_0x3036},
-			{REG_0x3045, vx6953_regs.reg_pat[rt].reg_0x3045},
-			{REG_0x3098, vx6953_regs.reg_pat[rt].reg_0x3098},
-			{REG_0x309d, vx6953_regs.reg_pat[rt].reg_0x309D},
-
-			{REG_0x0900, vx6953_regs.reg_pat[rt].reg_0x0900},
-			{REG_0x0901, vx6953_regs.reg_pat[rt].reg_0x0901},
-			{REG_0x0902, vx6953_regs.reg_pat[rt].reg_0x0902},
-			{REG_0x0383, vx6953_regs.reg_pat[rt].reg_0x0383},
-			{REG_0x0387, vx6953_regs.reg_pat[rt].reg_0x0387},
-
-			{REG_FRAME_LENGTH_LINES_HI,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_hi},
-			{REG_FRAME_LENGTH_LINES_LO,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_lo},
-			{REG_LINE_LENGTH_PCK_HI,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_hi},
-			{REG_LINE_LENGTH_PCK_LO,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_lo},
-			{REG_0x034c,
-				vx6953_regs.reg_pat[rt].reg_0x034c},
-			{REG_0x034d,
-				vx6953_regs.reg_pat[rt].reg_0x034d},
-			{REG_0x034e,
-				vx6953_regs.reg_pat[rt].reg_0x034e},
-			{REG_0x034f,
-				vx6953_regs.reg_pat[rt].reg_0x034f},
-
-			{REG_0x3005, vx6953_regs.reg_pat[rt].reg_0x3005},
-			{REG_0x3010, vx6953_regs.reg_pat[rt].reg_0x3010},
-			{REG_0x3011, vx6953_regs.reg_pat[rt].reg_0x3011},
-			{REG_0x301a, vx6953_regs.reg_pat[rt].reg_0x301a},
-			{REG_0x3030, 0x08},
-			{REG_0x3035, vx6953_regs.reg_pat[rt].reg_0x3035},
-			{REG_0x3041, vx6953_regs.reg_pat[rt].reg_0x3041},
-			{0x3042, vx6953_regs.reg_pat[rt].reg_0x3042},
-
-			{0x200, vx6953_regs.reg_pat[rt].reg_0x0200},
-			{0x201, vx6953_regs.reg_pat[rt].reg_0x0201},
-
-			{0x0b06,
-				vx6953_regs.reg_pat_init[0].reg_0x0b06},
-			/*Single_defect_correct_weight = auto*/
-			{0x0b07,
-				vx6953_regs.reg_pat_init[0].reg_0x0b07},
-			/*Dynamic couplet correction ENABLED*/
-			{0x0b08,
-				vx6953_regs.reg_pat_init[0].reg_0x0b08},
-			/*Dynamic couplet correction weight*/
-			{0x0b09,
-				vx6953_regs.reg_pat_init[0].reg_0x0b09},
-
-			{REG_0x0136,
-				vx6953_regs.reg_pat_init[0].reg_0x0136},
-			{REG_0x0137,
-				vx6953_regs.reg_pat_init[0].reg_0x0137},
-
-			/*EDOF: Estimation settings for Preview mode
-			Application settings for capture
-			mode(standard settings - Not tuned) */
-			{REG_0x0b80, vx6953_regs.reg_pat[rt].reg_0x0b80},
-			{REG_0x0b83,
-				vx6953_regs.reg_pat_init[0].reg_0x0b83},
-			{REG_0x0b84,
-				vx6953_regs.reg_pat_init[0].reg_0x0b84},
-			{REG_0x0b85,
-				vx6953_regs.reg_pat_init[0].reg_0x0b85},
-			{REG_0x0b88,
-				vx6953_regs.reg_pat_init[0].reg_0x0b88},
-			{REG_0x0b89,
-				vx6953_regs.reg_pat_init[0].reg_0x0b89},
-			{REG_0x0b8a,
-				vx6953_regs.reg_pat_init[0].reg_0x0b8a},
-			{0x3393, 0x06}, /* man_spec_edof_ctrl_edof*/
-			{0x3394, 0x07}, /* man_spec_edof_ctrl_edof*/
-			};
-
-			struct vx6953_i2c_reg_conf snapshot_mode_tbl[] = {
-			{REG_MODE_SELECT,	MODE_SELECT_STANDBY_MODE},
-			{REG_0x0112,
-				vx6953_regs.reg_pat_init[0].reg_0x0112},
-			{0x6003, 0x01},
-			{REG_0x0113,
-				vx6953_regs.reg_pat_init[0].reg_0x0113},
-			{REG_VT_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				vt_pix_clk_div},
-			{0x303,	1}, /* VT_SYS_CLK_DIV */
-			{REG_PRE_PLL_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER,
-				vx6953_regs.reg_pat_init[0].
-				pll_multiplier},
-			{REG_OP_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				op_pix_clk_div},
-			{0x30b,	1},
-			{REG_COARSE_INTEGRATION_TIME_HI,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_hi},
-			{REG_COARSE_INTEGRATION_TIME_LO,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_lo},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-				vx6953_regs.reg_pat[rt].
-				analogue_gain_code_global},
-			{REG_LINE_LENGTH_PCK_HI,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_hi},
-			{REG_LINE_LENGTH_PCK_LO,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_lo},
-			{REG_FRAME_LENGTH_LINES_HI,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_hi},
-			{REG_FRAME_LENGTH_LINES_LO,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_lo},
-			{REG_0x3210, vx6953_regs.reg_pat[rt].reg_0x3210},
-			{REG_0x0111, vx6953_regs.reg_pat[rt].reg_0x111},
-
-			{REG_0x0b00,
-				vx6953_regs.reg_pat_init[0].reg_0x0b00},
-			{0x3140, 0x01},  /* AV2X2 block enabled */
-			{REG_0x3410, vx6953_regs.reg_pat[rt].reg_0x3410},
-			{0x0b06,
-				vx6953_regs.reg_pat_init[0].reg_0x0b06},
-			/*Single_defect_correct_weight = auto*/
-			{0x0b07,
-				vx6953_regs.reg_pat_init[0].reg_0x0b07},
-			/*Dynamic couplet correction ENABLED*/
-			{0x0b08,
-				vx6953_regs.reg_pat_init[0].reg_0x0b08},
-			/*Dynamic couplet correction weight*/
-			{0x0b09,
-				vx6953_regs.reg_pat_init[0].reg_0x0b09},
-
-
-			{REG_0x3004,
-				vx6953_regs.reg_pat_init[0].reg_0x3004},
-			{REG_0x3006, 0x00},
-			{REG_0x3007,
-				vx6953_regs.reg_pat_init[0].reg_0x3007},
-			{0x301A, 0x6A},
-			{REG_0x301b, 0x29},
-			{REG_0x3036,
-				vx6953_regs.reg_pat[rt].reg_0x3036},
-			{REG_0x3045, vx6953_regs.reg_pat[rt].reg_0x3045},
-			{REG_0x3098, vx6953_regs.reg_pat[rt].reg_0x3098},
-			{REG_0x309d, vx6953_regs.reg_pat[rt].reg_0x309D},
-
-			{REG_0x0136,
-				vx6953_regs.reg_pat_init[0].reg_0x0136},
-			{REG_0x0137,
-				vx6953_regs.reg_pat_init[0].reg_0x0137},
-
-			{REG_0x0b80, vx6953_regs.reg_pat[rt].reg_0x0b80},
-			{REG_0x0b83,
-				vx6953_regs.reg_pat_init[0].reg_0x0b83},
-			{REG_0x0b84,
-				vx6953_regs.reg_pat_init[0].reg_0x0b84},
-			{REG_0x0b85,
-				vx6953_regs.reg_pat_init[0].reg_0x0b85},
-			{REG_0x0b88,
-				vx6953_regs.reg_pat_init[0].reg_0x0b88},
-			{REG_0x0b89,
-				vx6953_regs.reg_pat_init[0].reg_0x0b89},
-			{REG_0x0b8a,
-				vx6953_regs.reg_pat_init[0].reg_0x0b8a},
-			{0x3393, 0x06}, /* man_spec_edof_ctrl*/
-			{0x3394, 0x07}, /* man_spec_edof_ctrl*/
-			};
-			/* stop streaming */
-			msleep(5);
-
-			/* Reset everything first */
-
-			if (vx6953_i2c_write_b_sensor(0x103, 0x01) < 0) {
-				CDBG("S/W reset failed\n");
-				return rc;
-			} else
-				CDBG("S/W reset successful\n");
-
-			msleep(10);
-
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STANDBY_MODE) < 0)
-				return rc;
-			/*vx6953_stm5m0edof_delay_msecs_stdby*/
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			vx6953_csi_params.data_format = CSI_8BIT;
-			vx6953_csi_params.lane_cnt = 1;
-			vx6953_csi_params.lane_assign = 0xe4;
-			vx6953_csi_params.dpcm_scheme = 0;
-			vx6953_csi_params.settle_cnt = 7;
-			rc = msm_camio_csi_config(&vx6953_csi_params);
-			if (rc < 0)
-				CDBG(" config csi controller failed\n");
-
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			vx6953_patch_for_cut3();
-
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			if (rt == RES_PREVIEW) {
-				rc = vx6953_i2c_write_w_table(
-					&preview_mode_tbl[0],
-					ARRAY_SIZE(preview_mode_tbl));
-				if (rc < 0)
-					return rc;
-			}
-			if (rt == RES_CAPTURE) {
-				rc = vx6953_i2c_write_w_table(
-					&snapshot_mode_tbl[0],
-					ARRAY_SIZE(snapshot_mode_tbl));
-				if (rc < 0)
-					return rc;
-			}
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			/* Start sensor streaming */
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STREAM) < 0)
-				return rc;
-			msleep(vx6953_stm5m0edof_delay_msecs_stream);
-			/* man_spec_edof_ctrl_tune_smooth_lowlight*/
-			vx6953_i2c_write_b_sensor(0x338d, 0x08);
-			/* man_spec_edof_ctrl_tune_smooth_indoor*/
-			vx6953_i2c_write_b_sensor(0x338e, 0x08);
-			/* man_spec_edof_ctrl_tune_smooth_outdoor*/
-			vx6953_i2c_write_b_sensor(0x338f, 0x00);
-			/*Apply Capture FPGA state machine reset*/
-			vx6953_i2c_write_b_sensor(0x16, 0x00);
-			msleep(100);
-			vx6953_i2c_write_b_sensor(0x16, 0x01);
-
-			if (vx6953_i2c_read(0x0005, &frame_cnt, 1) < 0)
-				return rc;
-
-			while (frame_cnt == 0xFF) {
-				if (vx6953_i2c_read(0x0005, &frame_cnt, 1) < 0)
-					return rc;
-				CDBG("frame_cnt=%d", frame_cnt);
-				msleep(10);
-			}
-		}
-		return rc;
-		default:
-			return rc;
-		}
-	} else {
-		switch (update_type) {
-		case REG_INIT:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct vx6953_i2c_reg_conf init_tbl[] = {
-			{REG_0x0112,
-				vx6953_regs.reg_pat_init[0].reg_0x0112},
-			{REG_0x0113,
-				vx6953_regs.reg_pat_init[0].reg_0x0113},
-			{REG_VT_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				vt_pix_clk_div},
-			{REG_PRE_PLL_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER,
-				vx6953_regs.reg_pat_init[0].
-				pll_multiplier},
-			{REG_OP_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				op_pix_clk_div},
-			{REG_COARSE_INTEGRATION_TIME_HI,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_hi},
-			{REG_COARSE_INTEGRATION_TIME_LO,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_lo},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-				vx6953_regs.reg_pat[rt].
-				analogue_gain_code_global},
-			{REG_0x3030,
-				vx6953_regs.reg_pat_init[0].reg_0x3030},
-			/* 953 specific registers */
-			{REG_0x0111,
-				vx6953_regs.reg_pat_init[0].reg_0x0111},
-			{REG_0x0b00,
-				vx6953_regs.reg_pat_init[0].reg_0x0b00},
-			{REG_0x3001,
-				vx6953_regs.reg_pat_init[0].reg_0x3001},
-			{REG_0x3004,
-				vx6953_regs.reg_pat_init[0].reg_0x3004},
-			{REG_0x3007,
-				vx6953_regs.reg_pat_init[0].reg_0x3007},
-			{REG_0x3016,
-				vx6953_regs.reg_pat_init[0].reg_0x3016},
-			{REG_0x301d,
-				vx6953_regs.reg_pat_init[0].reg_0x301d},
-			{REG_0x317e,
-				vx6953_regs.reg_pat_init[0].reg_0x317e},
-			{REG_0x317f,
-				vx6953_regs.reg_pat_init[0].reg_0x317f},
-			{REG_0x3400,
-				vx6953_regs.reg_pat_init[0].reg_0x3400},
-			/* DEFCOR settings */
-			/*Single Defect Correction Weight DISABLE*/
-			{0x0b06,
-				vx6953_regs.reg_pat_init[0].reg_0x0b06},
-			/*Single_defect_correct_weight = auto*/
-			{0x0b07,
-				vx6953_regs.reg_pat_init[0].reg_0x0b07},
-			/*Dynamic couplet correction ENABLED*/
-			{0x0b08,
-				vx6953_regs.reg_pat_init[0].reg_0x0b08},
-			/*Dynamic couplet correction weight*/
-			{0x0b09,
-				vx6953_regs.reg_pat_init[0].reg_0x0b09},
-			/* Clock Setup */
-			/* Tell sensor ext clk is 24MHz*/
-			{0x0136,
-				vx6953_regs.reg_pat_init[0].reg_0x0136},
-			{0x0137,
-				vx6953_regs.reg_pat_init[0].reg_0x0137},
-			/* The white balance gains must be written
-			to the sensor every frame. */
-			/* Edof */
-			{REG_0x0b83,
-				vx6953_regs.reg_pat_init[0].reg_0x0b83},
-			{REG_0x0b84,
-				vx6953_regs.reg_pat_init[0].reg_0x0b84},
-			{0x0b85,
-				vx6953_regs.reg_pat_init[0].reg_0x0b85},
-			{0x0b88,
-				vx6953_regs.reg_pat_init[0].reg_0x0b88},
-			{0x0b89,
-				vx6953_regs.reg_pat_init[0].reg_0x0b89},
-			{REG_0x0b8a,
-				vx6953_regs.reg_pat_init[0].reg_0x0b8a},
-			/* Mode specific regieters */
-			{REG_FRAME_LENGTH_LINES_HI,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_hi},
-			{REG_FRAME_LENGTH_LINES_LO,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_lo},
-			{REG_LINE_LENGTH_PCK_HI,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_hi},
-			{REG_LINE_LENGTH_PCK_LO,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_lo},
-			{REG_0x3005,
-				vx6953_regs.reg_pat[rt].reg_0x3005},
-			{0x3010,
-				vx6953_regs.reg_pat[rt].reg_0x3010},
-			{REG_0x3011,
-				vx6953_regs.reg_pat[rt].reg_0x3011},
-			{REG_0x301a,
-				vx6953_regs.reg_pat[rt].reg_0x301a},
-			{REG_0x3035,
-				vx6953_regs.reg_pat[rt].reg_0x3035},
-			{REG_0x3036,
-				vx6953_regs.reg_pat[rt].reg_0x3036},
-			{REG_0x3041,
-				vx6953_regs.reg_pat[rt].reg_0x3041},
-			{0x3042,
-				vx6953_regs.reg_pat[rt].reg_0x3042},
-			{REG_0x3045,
-				vx6953_regs.reg_pat[rt].reg_0x3045},
-			/*EDOF: Estimation settings for Preview mode
-			Application settings for capture mode
-			(standard settings - Not tuned) */
-			{REG_0x0b80,
-				vx6953_regs.reg_pat[rt].reg_0x0b80},
-			{REG_0x0900,
-				vx6953_regs.reg_pat[rt].reg_0x0900},
-			{REG_0x0901,
-				vx6953_regs.reg_pat[rt].reg_0x0901},
-			{REG_0x0902,
-				vx6953_regs.reg_pat[rt].reg_0x0902},
-			{REG_0x0383,
-				vx6953_regs.reg_pat[rt].reg_0x0383},
-			{REG_0x0387,
-				vx6953_regs.reg_pat[rt].reg_0x0387},
-			/* Change output size / frame rate */
-			{REG_0x034c,
-				vx6953_regs.reg_pat[rt].reg_0x034c},
-			{REG_0x034d,
-				vx6953_regs.reg_pat[rt].reg_0x034d},
-			{REG_0x034e,
-				vx6953_regs.reg_pat[rt].reg_0x034e},
-			{REG_0x034f,
-				vx6953_regs.reg_pat[rt].reg_0x034f},
-			{REG_0x1716,
-				vx6953_regs.reg_pat[rt].reg_0x1716},
-			{REG_0x1717,
-				vx6953_regs.reg_pat[rt].reg_0x1717},
-			{REG_0x1718,
-				vx6953_regs.reg_pat[rt].reg_0x1718},
-			{REG_0x1719,
-				vx6953_regs.reg_pat[rt].reg_0x1719},
-			};
-			/* reset fps_divider */
-			vx6953_ctrl->fps = 30 * Q8;
-			/* stop streaming */
-
-			/* Reset everything first */
-			if (vx6953_i2c_write_b_sensor(0x103, 0x01) < 0) {
-				CDBG("S/W reset failed\n");
-				return rc;
-			} else
-				CDBG("S/W reset successful\n");
-
-			msleep(10);
-
-			CDBG("Init vx6953_sensor_setting standby\n");
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STANDBY_MODE) < 0)
-				return rc;
-				/*vx6953_stm5m0edof_delay_msecs_stdby*/
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-			vx6953_patch_for_cut2();
-			rc = vx6953_i2c_write_w_table(&init_tbl[0],
-				ARRAY_SIZE(init_tbl));
-			if (rc < 0)
-				return rc;
-				msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-		}
-		return rc;
-		case UPDATE_PERIODIC:
-		if (rt == RES_PREVIEW || rt == RES_CAPTURE) {
-			struct vx6953_i2c_reg_conf init_mode_tbl[] =  {
-			{REG_0x0112,
-				vx6953_regs.reg_pat_init[0].reg_0x0112},
-			{REG_0x0113,
-				vx6953_regs.reg_pat_init[0].reg_0x0113},
-			{REG_VT_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				vt_pix_clk_div},
-			{REG_PRE_PLL_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER,
-				vx6953_regs.reg_pat_init[0].
-				pll_multiplier},
-			{REG_OP_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				op_pix_clk_div},
-			{REG_COARSE_INTEGRATION_TIME_HI,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_hi},
-			{REG_COARSE_INTEGRATION_TIME_LO,
-				vx6953_regs.reg_pat[rt].
-				coarse_integration_time_lo},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-				vx6953_regs.reg_pat[rt].
-				analogue_gain_code_global},
-			{REG_0x3030,
-				vx6953_regs.reg_pat_init[0].reg_0x3030},
-			/* 953 specific registers */
-			{REG_0x0111,
-				vx6953_regs.reg_pat_init[0].reg_0x0111},
-			{REG_0x0b00,
-				vx6953_regs.reg_pat_init[0].reg_0x0b00},
-			{REG_0x3001,
-				vx6953_regs.reg_pat_init[0].reg_0x3001},
-			{REG_0x3004,
-				vx6953_regs.reg_pat_init[0].reg_0x3004},
-			{REG_0x3007,
-				vx6953_regs.reg_pat_init[0].reg_0x3007},
-			{REG_0x3016,
-				vx6953_regs.reg_pat_init[0].reg_0x3016},
-			{REG_0x301d,
-				vx6953_regs.reg_pat_init[0].reg_0x301d},
-			{REG_0x317e,
-				vx6953_regs.reg_pat_init[0].reg_0x317e},
-			{REG_0x317f,
-				vx6953_regs.reg_pat_init[0].reg_0x317f},
-			{REG_0x3400,
-				vx6953_regs.reg_pat_init[0].reg_0x3400},
-			{0x0b06,
-				vx6953_regs.reg_pat_init[0].reg_0x0b06},
-			/*Single_defect_correct_weight = auto*/
-			{0x0b07,
-				vx6953_regs.reg_pat_init[0].reg_0x0b07},
-			/*Dynamic couplet correction ENABLED*/
-			{0x0b08,
-				vx6953_regs.reg_pat_init[0].reg_0x0b08},
-			/*Dynamic couplet correction weight*/
-			{0x0b09,
-				vx6953_regs.reg_pat_init[0].reg_0x0b09},
-			/* Clock Setup */
-			/* Tell sensor ext clk is 24MHz*/
-			{0x0136,
-				vx6953_regs.reg_pat_init[0].reg_0x0136},
-			{0x0137,
-				vx6953_regs.reg_pat_init[0].reg_0x0137},
-			/* The white balance gains must be written
-			to the sensor every frame. */
-			/* Edof */
-			{REG_0x0b83,
-				vx6953_regs.reg_pat_init[0].reg_0x0b83},
-			{REG_0x0b84,
-				vx6953_regs.reg_pat_init[0].reg_0x0b84},
-			{0x0b85,
-				vx6953_regs.reg_pat_init[0].reg_0x0b85},
-			{0x0b88,
-				vx6953_regs.reg_pat_init[0].reg_0x0b88},
-			{0x0b89,
-				vx6953_regs.reg_pat_init[0].reg_0x0b89},
-			{REG_0x0b8a,
-				vx6953_regs.reg_pat_init[0].reg_0x0b8a},
-			/* Mode specific regieters */
-			{REG_FRAME_LENGTH_LINES_HI,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_hi},
-			{REG_FRAME_LENGTH_LINES_LO,
-				vx6953_regs.reg_pat[rt].
-				frame_length_lines_lo},
-			{REG_LINE_LENGTH_PCK_HI,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_hi},
-			{REG_LINE_LENGTH_PCK_LO,
-				vx6953_regs.reg_pat[rt].
-				line_length_pck_lo},
-			{REG_0x3005,
-				vx6953_regs.reg_pat[rt].reg_0x3005},
-			{0x3010,
-				vx6953_regs.reg_pat[rt].reg_0x3010},
-			{REG_0x3011,
-				vx6953_regs.reg_pat[rt].reg_0x3011},
-			{REG_0x301a,
-				vx6953_regs.reg_pat[rt].reg_0x301a},
-			{REG_0x3035,
-				vx6953_regs.reg_pat[rt].reg_0x3035},
-			{REG_0x3036,
-				vx6953_regs.reg_pat[rt].reg_0x3036},
-			{REG_0x3041,
-				vx6953_regs.reg_pat[rt].reg_0x3041},
-			{0x3042,
-				vx6953_regs.reg_pat[rt].reg_0x3042},
-			{REG_0x3045,
-				vx6953_regs.reg_pat[rt].reg_0x3045},
-			/*EDOF: Estimation settings for Preview mode
-			Application settings for capture mode
-			(standard settings - Not tuned) */
-			{REG_0x0b80,
-				vx6953_regs.reg_pat[rt].reg_0x0b80},
-			{REG_0x0900,
-				vx6953_regs.reg_pat[rt].reg_0x0900},
-			{REG_0x0901,
-				vx6953_regs.reg_pat[rt].reg_0x0901},
-			{REG_0x0902,
-				vx6953_regs.reg_pat[rt].reg_0x0902},
-			{REG_0x0383,
-				vx6953_regs.reg_pat[rt].reg_0x0383},
-			{REG_0x0387,
-				vx6953_regs.reg_pat[rt].reg_0x0387},
-			/* Change output size / frame rate */
-			{REG_0x034c,
-				vx6953_regs.reg_pat[rt].reg_0x034c},
-			{REG_0x034d,
-				vx6953_regs.reg_pat[rt].reg_0x034d},
-			{REG_0x034e,
-				vx6953_regs.reg_pat[rt].reg_0x034e},
-			{REG_0x034f,
-				vx6953_regs.reg_pat[rt].reg_0x034f},
-			{REG_0x1716,
-				vx6953_regs.reg_pat[rt].reg_0x1716},
-			{REG_0x1717,
-				vx6953_regs.reg_pat[rt].reg_0x1717},
-			{REG_0x1718,
-				vx6953_regs.reg_pat[rt].reg_0x1718},
-			{REG_0x1719,
-				vx6953_regs.reg_pat[rt].reg_0x1719},
-			};
-			struct vx6953_i2c_reg_conf mode_tbl[] = {
-			{REG_0x0112,
-				vx6953_regs.reg_pat_init[0].reg_0x0112},
-			{REG_0x0113,
-				vx6953_regs.reg_pat_init[0].reg_0x0113},
-			{REG_VT_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				vt_pix_clk_div},
-			{REG_PRE_PLL_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER,
-				vx6953_regs.reg_pat_init[0].
-				pll_multiplier},
-			{REG_OP_PIX_CLK_DIV,
-				vx6953_regs.reg_pat_init[0].
-				op_pix_clk_div},
-		/* Mode specific regieters */
-			{REG_FRAME_LENGTH_LINES_HI,
-				vx6953_regs.reg_pat[rt].frame_length_lines_hi},
-			{REG_FRAME_LENGTH_LINES_LO,
-				vx6953_regs.reg_pat[rt].frame_length_lines_lo},
-			{REG_LINE_LENGTH_PCK_HI,
-				vx6953_regs.reg_pat[rt].line_length_pck_hi},
-			{REG_LINE_LENGTH_PCK_LO,
-				vx6953_regs.reg_pat[rt].line_length_pck_lo},
-			{REG_0x3005, vx6953_regs.reg_pat[rt].reg_0x3005},
-			{0x3010, vx6953_regs.reg_pat[rt].reg_0x3010},
-			{REG_0x3011, vx6953_regs.reg_pat[rt].reg_0x3011},
-			{REG_0x301a, vx6953_regs.reg_pat[rt].reg_0x301a},
-			{REG_0x3035, vx6953_regs.reg_pat[rt].reg_0x3035},
-			{REG_0x3036, vx6953_regs.reg_pat[rt].reg_0x3036},
-			{REG_0x3041, vx6953_regs.reg_pat[rt].reg_0x3041},
-			{0x3042, vx6953_regs.reg_pat[rt].reg_0x3042},
-			{REG_0x3045, vx6953_regs.reg_pat[rt].reg_0x3045},
-			/*EDOF: Estimation settings for Preview mode
-			Application settings for capture
-			mode(standard settings - Not tuned) */
-			{REG_0x0b80, vx6953_regs.reg_pat[rt].reg_0x0b80},
-			{REG_0x0900, vx6953_regs.reg_pat[rt].reg_0x0900},
-			{REG_0x0901, vx6953_regs.reg_pat[rt].reg_0x0901},
-			{REG_0x0902, vx6953_regs.reg_pat[rt].reg_0x0902},
-			{REG_0x0383, vx6953_regs.reg_pat[rt].reg_0x0383},
-			{REG_0x0387, vx6953_regs.reg_pat[rt].reg_0x0387},
-			/* Change output size / frame rate */
-			{REG_0x034c, vx6953_regs.reg_pat[rt].reg_0x034c},
-			{REG_0x034d, vx6953_regs.reg_pat[rt].reg_0x034d},
-			{REG_0x034e, vx6953_regs.reg_pat[rt].reg_0x034e},
-			{REG_0x034f, vx6953_regs.reg_pat[rt].reg_0x034f},
-			/*{0x200, vx6953_regs.reg_pat[rt].reg_0x0200},
-			{0x201, vx6953_regs.reg_pat[rt].reg_0x0201},*/
-			{REG_0x1716, vx6953_regs.reg_pat[rt].reg_0x1716},
-			{REG_0x1717, vx6953_regs.reg_pat[rt].reg_0x1717},
-			{REG_0x1718, vx6953_regs.reg_pat[rt].reg_0x1718},
-			{REG_0x1719, vx6953_regs.reg_pat[rt].reg_0x1719},
-			};
-			/* stop streaming */
-			msleep(5);
-
-			/* Reset everything first */
-			if (vx6953_i2c_write_b_sensor(0x103, 0x01) < 0) {
-				CDBG("S/W reset failed\n");
-				return rc;
-			} else
-				CDBG("S/W reset successful\n");
-
-			msleep(10);
-
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STANDBY_MODE) < 0)
-				return rc;
-			/*vx6953_stm5m0edof_delay_msecs_stdby*/
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			vx6953_csi_params.data_format = CSI_8BIT;
-			vx6953_csi_params.lane_cnt = 1;
-			vx6953_csi_params.lane_assign = 0xe4;
-			vx6953_csi_params.dpcm_scheme = 0;
-			vx6953_csi_params.settle_cnt = 7;
-			rc = msm_camio_csi_config(&vx6953_csi_params);
-			if (rc < 0)
-				CDBG(" config csi controller failed\n");
-
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			vx6953_patch_for_cut2();
-			rc = vx6953_i2c_write_w_table(&init_mode_tbl[0],
-				ARRAY_SIZE(init_mode_tbl));
-			if (rc < 0)
-				return rc;
-
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			rc = vx6953_i2c_write_w_table(&mode_tbl[0],
-				ARRAY_SIZE(mode_tbl));
-			if (rc < 0)
-				return rc;
-
-			msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-			/* Start sensor streaming */
-			if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				MODE_SELECT_STREAM) < 0)
-				return rc;
-			msleep(vx6953_stm5m0edof_delay_msecs_stream);
-
-			if (vx6953_i2c_read(0x0005, &frame_cnt, 1) < 0)
-				return rc;
-
-			while (frame_cnt == 0xFF) {
-				if (vx6953_i2c_read(0x0005, &frame_cnt, 1) < 0)
-					return rc;
-				CDBG("frame_cnt=%d", frame_cnt);
-				msleep(10);
-			}
-		}
-		return rc;
-		default:
-		return rc;
-	}
-	}
-	return rc;
-}
-
-
-static int32_t vx6953_video_config(int mode)
-{
-
-	int32_t	rc = 0;
-	int	rt;
-	/* change sensor resolution	if needed */
-	if (vx6953_ctrl->prev_res == QTR_SIZE) {
-		rt = RES_PREVIEW;
-		vx6953_stm5m0edof_delay_msecs_stdby	=
-			((((2 * 1000 * vx6953_ctrl->fps_divider) /
-			vx6953_ctrl->fps) * Q8) / Q10) + 1;
-	} else {
-		rt = RES_CAPTURE;
-		vx6953_stm5m0edof_delay_msecs_stdby	=
-			((((1000 * vx6953_ctrl->fps_divider) /
-			vx6953_ctrl->fps) * Q8) / Q10) + 1;
-	}
-	if (vx6953_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-		return rc;
-	if (vx6953_ctrl->set_test) {
-		if (vx6953_test(vx6953_ctrl->set_test) < 0)
-			return	rc;
-	}
-	vx6953_ctrl->edof_mode = VX6953_EDOF_ESTIMATION;
-	rc = vx6953_enable_edof(vx6953_ctrl->edof_mode);
-	if (rc < 0)
-		return rc;
-	vx6953_ctrl->curr_res = vx6953_ctrl->prev_res;
-	vx6953_ctrl->sensormode = mode;
-	return rc;
-}
-
-static int32_t vx6953_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-	/*change sensor resolution if needed */
-	if (vx6953_ctrl->curr_res != vx6953_ctrl->pict_res) {
-		if (vx6953_ctrl->pict_res == QTR_SIZE) {
-			rt = RES_PREVIEW;
-			vx6953_stm5m0edof_delay_msecs_stdby =
-				((((2 * 1000 * vx6953_ctrl->fps_divider) /
-				vx6953_ctrl->fps) * Q8) / Q10) + 1;
-		} else {
-			rt = RES_CAPTURE;
-			vx6953_stm5m0edof_delay_msecs_stdby =
-				((((1000 * vx6953_ctrl->fps_divider) /
-				vx6953_ctrl->fps) * Q8) / Q10) + 1;
-		}
-	if (vx6953_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-		return rc;
-	}
-
-	vx6953_ctrl->edof_mode = VX6953_EDOF_APPLICATION;
-	if (vx6953_enable_edof(vx6953_ctrl->edof_mode) < 0)
-		return rc;
-	vx6953_ctrl->curr_res = vx6953_ctrl->pict_res;
-	vx6953_ctrl->sensormode = mode;
-	return rc;
-} /*end of vx6953_snapshot_config*/
-
-static int32_t vx6953_raw_snapshot_config(int mode)
-{
-	int32_t rc = 0;
-	int rt;
-	/* change sensor resolution if needed */
-	if (vx6953_ctrl->curr_res != vx6953_ctrl->pict_res) {
-		if (vx6953_ctrl->pict_res == QTR_SIZE) {
-			rt = RES_PREVIEW;
-			vx6953_stm5m0edof_delay_msecs_stdby =
-				((((2 * 1000 * vx6953_ctrl->fps_divider)/
-				vx6953_ctrl->fps) * Q8) / Q10) + 1;
-		} else {
-			rt = RES_CAPTURE;
-			vx6953_stm5m0edof_delay_msecs_stdby =
-				((((1000 * vx6953_ctrl->fps_divider)/
-				vx6953_ctrl->fps) * Q8) / Q10) + 1;
-		}
-		if (vx6953_sensor_setting(UPDATE_PERIODIC, rt) < 0)
-			return rc;
-	}
-	vx6953_ctrl->edof_mode = VX6953_EDOF_APPLICATION;
-	if (vx6953_enable_edof(vx6953_ctrl->edof_mode) < 0)
-		return rc;
-	vx6953_ctrl->curr_res = vx6953_ctrl->pict_res;
-	vx6953_ctrl->sensormode = mode;
-	return rc;
-} /*end of vx6953_raw_snapshot_config*/
-static int32_t vx6953_set_sensor_mode(int mode,
-	int res)
-{
-	int32_t rc = 0;
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		rc = vx6953_video_config(mode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-		rc = vx6953_snapshot_config(mode);
-		break;
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		rc = vx6953_raw_snapshot_config(mode);
-		break;
-	default:
-		rc = -EINVAL;
-		break;
-	}
-	return rc;
-}
-static int32_t vx6953_power_down(void)
-{
-	vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-	MODE_SELECT_STANDBY_MODE);
-	return 0;
-}
-
-
-static int vx6953_probe_init_done(const struct msm_camera_sensor_info *data)
-{
-	gpio_free(data->sensor_reset);
-	kfree(vx6953_ctrl);
-	vx6953_ctrl = NULL;
-	return 0;
-}
-static int vx6953_probe_init_sensor(const struct msm_camera_sensor_info *data)
-{
-	unsigned short revision_number;
-	int32_t rc = 0;
-	unsigned short chipidl, chipidh;
-	CDBG("%s: %d\n", __func__, __LINE__);
-	rc = gpio_request(data->sensor_reset, "vx6953");
-	CDBG(" vx6953_probe_init_sensor\n");
-	if (!rc) {
-		CDBG("sensor_reset = %d\n", rc);
-		CDBG(" vx6953_probe_init_sensor 1\n");
-		gpio_direction_output(data->sensor_reset, 0);
-		msleep(50);
-		CDBG(" vx6953_probe_init_sensor 1\n");
-		gpio_direction_output(data->sensor_reset, 1);
-		msleep(13);
-	} else {
-		CDBG(" vx6953_probe_init_sensor 2\n");
-		goto init_probe_done;
-	}
-	msleep(20);
-	CDBG(" vx6953_probe_init_sensor is called\n");
-	/* 3. Read sensor Model ID: */
-	rc = vx6953_i2c_read(0x0000, &chipidh, 1);
-	if (rc < 0) {
-		CDBG(" vx6953_probe_init_sensor 3\n");
-		goto init_probe_fail;
-	}
-	rc = vx6953_i2c_read(0x0001, &chipidl, 1);
-	if (rc < 0) {
-		CDBG(" vx6953_probe_init_sensor4\n");
-		goto init_probe_fail;
-	}
-	CDBG("vx6953 model_id = 0x%x  0x%x\n", chipidh, chipidl);
-	/* 4. Compare sensor ID to VX6953 ID: */
-	if (chipidh != 0x03 || chipidl != 0xB9) {
-		rc = -ENODEV;
-		CDBG("vx6953_probe_init_sensor fail chip id doesnot match\n");
-		goto init_probe_fail;
-	}
-
-	vx6953_ctrl = kzalloc(sizeof(struct vx6953_ctrl_t), GFP_KERNEL);
-	if (!vx6953_ctrl) {
-		CDBG("vx6953_init failed!\n");
-		rc = -ENOMEM;
-	}
-	vx6953_ctrl->fps_divider = 1 * 0x00000400;
-	vx6953_ctrl->pict_fps_divider = 1 * 0x00000400;
-	vx6953_ctrl->set_test = TEST_OFF;
-	vx6953_ctrl->prev_res = QTR_SIZE;
-	vx6953_ctrl->pict_res = FULL_SIZE;
-	vx6953_ctrl->curr_res = INVALID_SIZE;
-	vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_2;
-	vx6953_ctrl->edof_mode = VX6953_EDOF_ESTIMATION;
-
-	if (data)
-		vx6953_ctrl->sensordata = data;
-
-	if (vx6953_i2c_read(0x0002, &revision_number, 1) < 0)
-		return rc;
-		CDBG("sensor revision number major = 0x%x\n", revision_number);
-	if (vx6953_i2c_read(0x0018, &revision_number, 1) < 0)
-		return rc;
-		CDBG("sensor revision number = 0x%x\n", revision_number);
-	if (revision_number == VX6953_REVISION_NUMBER_CUT3) {
-		vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_3;
-		CDBG("VX6953 EDof Cut 3.0 sensor\n ");
-	} else if (revision_number == VX6953_REVISION_NUMBER_CUT2) {
-		vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_2;
-		CDBG("VX6953 EDof Cut 2.0 sensor\n ");
-	} else {/* Cut1.0 reads 0x00 for register 0x0018*/
-		vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_1;
-		CDBG("VX6953 EDof Cut 1.0 sensor\n ");
-	}
-
-	if (vx6953_ctrl->prev_res == QTR_SIZE) {
-		if (vx6953_sensor_setting(REG_INIT, RES_PREVIEW) < 0)
-			goto init_probe_fail;
-	} else {
-		if (vx6953_sensor_setting(REG_INIT, RES_CAPTURE) < 0)
-			goto init_probe_fail;
-	}
-
-	goto init_probe_done;
-init_probe_fail:
-	CDBG(" vx6953_probe_init_sensor fails\n");
-	gpio_direction_output(data->sensor_reset, 0);
-	vx6953_probe_init_done(data);
-init_probe_done:
-	CDBG(" vx6953_probe_init_sensor finishes\n");
-	return rc;
-	}
-/* camsensor_iu060f_vx6953_reset */
-int vx6953_sensor_open_init(const struct msm_camera_sensor_info *data)
-{
-	unsigned short revision_number;
-	int32_t rc = 0;
-
-	CDBG("%s: %d\n", __func__, __LINE__);
-	CDBG("Calling vx6953_sensor_open_init\n");
-	rc = gpio_request(data->sensor_reset, "vx6953");
-	if (!rc)
-		CDBG("vx6953 gpio_request fail\n");
-
-	vx6953_ctrl = kzalloc(sizeof(struct vx6953_ctrl_t), GFP_KERNEL);
-	if (!vx6953_ctrl) {
-		CDBG("vx6953_init failed!\n");
-		rc = -ENOMEM;
-		goto init_done;
-	}
-	vx6953_ctrl->fps_divider = 1 * 0x00000400;
-	vx6953_ctrl->pict_fps_divider = 1 * 0x00000400;
-	vx6953_ctrl->set_test = TEST_OFF;
-	vx6953_ctrl->prev_res = QTR_SIZE;
-	vx6953_ctrl->pict_res = FULL_SIZE;
-	vx6953_ctrl->curr_res = INVALID_SIZE;
-	vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_2;
-	vx6953_ctrl->edof_mode = VX6953_EDOF_ESTIMATION;
-	if (data)
-		vx6953_ctrl->sensordata = data;
-	if (rc < 0) {
-		CDBG("Calling vx6953_sensor_open_init fail1\n");
-		return rc;
-	}
-	CDBG("%s: %d\n", __func__, __LINE__);
-	/* enable mclk first */
-	msm_camio_clk_rate_set(VX6953_STM5M0EDOF_DEFAULT_MASTER_CLK_RATE);
-	CDBG("%s: %d\n", __func__, __LINE__);
-	if (vx6953_i2c_read(0x0002, &revision_number, 1) < 0)
-		return rc;
-		CDBG("sensor revision number major = 0x%x\n", revision_number);
-	if (vx6953_i2c_read(0x0018, &revision_number, 1) < 0)
-		return rc;
-		CDBG("sensor revision number = 0x%x\n", revision_number);
-	if (revision_number == VX6953_REVISION_NUMBER_CUT3) {
-		vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_3;
-		CDBG("VX6953 EDof Cut 3.0 sensor\n ");
-	} else if (revision_number == VX6953_REVISION_NUMBER_CUT2) {
-		vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_2;
-		CDBG("VX6953 EDof Cut 2.0 sensor\n ");
-	} else {/* Cut1.0 reads 0x00 for register 0x0018*/
-		vx6953_ctrl->sensor_type = VX6953_STM5M0EDOF_CUT_1;
-		CDBG("VX6953 EDof Cut 1.0 sensor\n ");
-	}
-
-	vx6953_ctrl->fps = 30*Q8;
-	if (rc < 0)
-		goto init_fail;
-	else
-		goto init_done;
-init_fail:
-	CDBG("init_fail\n");
-	gpio_direction_output(data->sensor_reset, 0);
-	vx6953_probe_init_done(data);
-init_done:
-	CDBG("init_done\n");
-	return rc;
-} /*endof vx6953_sensor_open_init*/
-
-static int vx6953_init_client(struct i2c_client *client)
-{
-	/* Initialize the MSM_CAMI2C Chip */
-	init_waitqueue_head(&vx6953_wait_queue);
-	return 0;
-}
-
-static const struct i2c_device_id vx6953_i2c_id[] = {
-	{"vx6953", 0},
-	{ }
-};
-
-static int vx6953_i2c_probe(struct i2c_client *client,
-	const struct i2c_device_id *id)
-{
-	int rc = 0;
-	CDBG("vx6953_probe called!\n");
-
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		CDBG("i2c_check_functionality failed\n");
-		goto probe_failure;
-	}
-
-	vx6953_sensorw = kzalloc(sizeof(struct vx6953_work_t), GFP_KERNEL);
-	if (!vx6953_sensorw) {
-		CDBG("kzalloc failed.\n");
-		rc = -ENOMEM;
-		goto probe_failure;
-	}
-
-	i2c_set_clientdata(client, vx6953_sensorw);
-	vx6953_init_client(client);
-	vx6953_client = client;
-
-	msleep(50);
-
-	CDBG("vx6953_probe successed! rc = %d\n", rc);
-	return 0;
-
-probe_failure:
-	CDBG("vx6953_probe failed! rc = %d\n", rc);
-	return rc;
-}
-
-static int vx6953_send_wb_info(struct wb_info_cfg *wb)
-{
-	unsigned short read_data;
-	uint8_t temp[8];
-	int rc = 0;
-	int i = 0;
-
-	/* red_gain */
-	temp[2] = wb->red_gain >> 8;
-	temp[3] = wb->red_gain & 0xFF;
-
-	/* green_gain */
-	temp[0] = wb->green_gain >> 8;
-	temp[1] = wb->green_gain & 0xFF;
-	temp[6] = temp[0];
-	temp[7] = temp[1];
-
-	/* blue_gain */
-	temp[4] = wb->blue_gain >> 8;
-	temp[5] = wb->blue_gain & 0xFF;
-	rc = vx6953_i2c_write_seq_sensor(0x0B8E, &temp[0], 8);
-
-	for (i = 0; i < 6; i++) {
-		rc = vx6953_i2c_read(0x0B8E + i, &read_data, 1);
-		CDBG("%s addr 0x%x val %d\n", __func__, 0x0B8E + i, read_data);
-	}
-	rc = vx6953_i2c_read(0x0B82, &read_data, 1);
-	CDBG("%s addr 0x%x val %d\n", __func__, 0x0B82, read_data);
-	if (rc < 0)
-		return rc;
-	return rc;
-} /*end of vx6953_snapshot_config*/
-
-static int __exit vx6953_remove(struct i2c_client *client)
-{
-	struct vx6953_work_t_t *sensorw = i2c_get_clientdata(client);
-	free_irq(client->irq, sensorw);
-	vx6953_client = NULL;
-	kfree(sensorw);
-	return 0;
-}
-
-static struct i2c_driver vx6953_i2c_driver = {
-	.id_table = vx6953_i2c_id,
-	.probe  = vx6953_i2c_probe,
-	.remove = __exit_p(vx6953_i2c_remove),
-	.driver = {
-		.name = "vx6953",
-	},
-};
-
-static int vx6953_sensor_config(void __user *argp)
-{
-	struct sensor_cfg_data cdata;
-	long   rc = 0;
-	if (copy_from_user(&cdata,
-		(void *)argp,
-		sizeof(struct sensor_cfg_data)))
-		return -EFAULT;
-	mutex_lock(&vx6953_mut);
-	CDBG("vx6953_sensor_config: cfgtype = %d\n",
-	cdata.cfgtype);
-		switch (cdata.cfgtype) {
-		case CFG_GET_PICT_FPS:
-			vx6953_get_pict_fps(
-				cdata.cfg.gfps.prevfps,
-				&(cdata.cfg.gfps.pictfps));
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PREV_L_PF:
-			cdata.cfg.prevl_pf =
-			vx6953_get_prev_lines_pf();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PREV_P_PL:
-			cdata.cfg.prevp_pl =
-				vx6953_get_prev_pixels_pl();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_L_PF:
-			cdata.cfg.pictl_pf =
-				vx6953_get_pict_lines_pf();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_P_PL:
-			cdata.cfg.pictp_pl =
-				vx6953_get_pict_pixels_pl();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_GET_PICT_MAX_EXP_LC:
-			cdata.cfg.pict_max_exp_lc =
-				vx6953_get_pict_max_exp_lc();
-
-			if (copy_to_user((void *)argp,
-				&cdata,
-				sizeof(struct sensor_cfg_data)))
-				rc = -EFAULT;
-			break;
-
-		case CFG_SET_FPS:
-		case CFG_SET_PICT_FPS:
-			rc = vx6953_set_fps(&(cdata.cfg.fps));
-			break;
-
-		case CFG_SET_EXP_GAIN:
-			rc =
-				vx6953_write_exp_gain(
-					cdata.cfg.exp_gain.gain,
-					cdata.cfg.exp_gain.line);
-			break;
-
-		case CFG_SET_PICT_EXP_GAIN:
-			rc =
-				vx6953_set_pict_exp_gain(
-				cdata.cfg.exp_gain.gain,
-				cdata.cfg.exp_gain.line);
-			break;
-
-		case CFG_SET_MODE:
-			rc = vx6953_set_sensor_mode(cdata.mode,
-					cdata.rs);
-			break;
-
-		case CFG_PWR_DOWN:
-			rc = vx6953_power_down();
-			break;
-
-		case CFG_MOVE_FOCUS:
-			rc =
-				vx6953_move_focus(
-				cdata.cfg.focus.dir,
-				cdata.cfg.focus.steps);
-			break;
-
-		case CFG_SET_DEFAULT_FOCUS:
-			rc =
-				vx6953_set_default_focus(
-				cdata.cfg.focus.steps);
-			break;
-
-		case CFG_SET_EFFECT:
-			rc = vx6953_set_default_focus(
-				cdata.cfg.effect);
-			break;
-
-
-		case CFG_SEND_WB_INFO:
-			rc = vx6953_send_wb_info(
-				&(cdata.cfg.wb_info));
-			break;
-
-		default:
-			rc = -EFAULT;
-			break;
-		}
-
-	mutex_unlock(&vx6953_mut);
-
-	return rc;
-}
-
-
-
-
-static int vx6953_sensor_release(void)
-{
-	int rc = -EBADF;
-	mutex_lock(&vx6953_mut);
-	vx6953_power_down();
-	gpio_free(vx6953_ctrl->sensordata->sensor_reset);
-	kfree(vx6953_ctrl);
-	vx6953_ctrl = NULL;
-	CDBG("vx6953_release completed\n");
-	mutex_unlock(&vx6953_mut);
-
-	return rc;
-}
-
-static int vx6953_g_chip_ident(struct v4l2_subdev *sd,
-			struct v4l2_dbg_chip_ident *id)
-{
-	/* TODO: Need to add this ID in v4l2-chip-ident.h */
-	id->ident    = V4L2_IDENT_VX6953;
-	id->revision = 0;
-
-	return 0;
-}
-
-static int vx6953_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *param)
-{
-	int ret = 0;
-	/* return current mode value */
-	param->parm.capture.capturemode = vx6953_ctrl->sensormode;
-	return ret;
-}
-
-static int vx6953_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *param)
-{
-	/* set the desired mode */
-	/* right now, the only purpose is to set the desired mode -
-	 preview or snapshot */
-	vx6953_ctrl->sensormode = param->parm.capture.capturemode;
-	return 0;
-}
-
-static int vx6953_s_stream(struct v4l2_subdev *sd, int enable)
-{
-	long rc = 0;
-	int mode = vx6953_ctrl->sensormode;
-	int rt = RES_PREVIEW;
-	unsigned short frame_cnt;
-	struct msm_camera_csi_params vx6953_csi_params;
-
-	CDBG("mode = %d, enable = %d\n", mode, enable);
-
-	if (!enable) {
-		/* turn off streaming */
-		/* TODO: Make call to I2C write to turn streaming off */
-		/* rc = vx6953_i2c_write_b_sensor(); */
-
-		struct vx6953_i2c_reg_conf init_tbl[] = {
-			{REG_0x0112,
-			vx6953_regs.reg_pat_init[0].reg_0x0112},
-			{0x6003, 0x01},
-			{REG_0x0113,
-			vx6953_regs.reg_pat_init[0].reg_0x0113},
-			{REG_VT_PIX_CLK_DIV,
-			vx6953_regs.reg_pat_init[0].
-			vt_pix_clk_div},
-			{REG_PRE_PLL_CLK_DIV,
-			vx6953_regs.reg_pat_init[0].
-			pre_pll_clk_div},
-			{REG_PLL_MULTIPLIER,
-			vx6953_regs.reg_pat_init[0].
-			pll_multiplier},
-			{REG_OP_PIX_CLK_DIV,
-			vx6953_regs.reg_pat_init[0].
-			op_pix_clk_div},
-			{REG_COARSE_INTEGRATION_TIME_HI,
-			vx6953_regs.reg_pat[rt].
-			coarse_integration_time_hi},
-			{REG_COARSE_INTEGRATION_TIME_LO,
-			vx6953_regs.reg_pat[rt].
-			coarse_integration_time_lo},
-			{REG_ANALOGUE_GAIN_CODE_GLOBAL_LO,
-			vx6953_regs.reg_pat[rt].
-			analogue_gain_code_global},
-			{REG_0x3030,
-			vx6953_regs.reg_pat_init[0].reg_0x3030},
-			/* 953 specific registers */
-			{REG_0x0111,
-			vx6953_regs.reg_pat_init[0].reg_0x0111},
-			{REG_0x0b00,
-			vx6953_regs.reg_pat_init[0].reg_0x0b00},
-			{REG_0x3001,
-			vx6953_regs.reg_pat_init[0].reg_0x3001},
-			{REG_0x3004,
-			vx6953_regs.reg_pat_init[0].reg_0x3004},
-			{0x3006, 0x00},
-			{REG_0x3007,
-			vx6953_regs.reg_pat_init[0].reg_0x3007},
-			{0x301b, 0x29},
-			/* DEFCOR settings */
-			/*Single Defect Correction Weight DISABLE*/
-			{0x0b06,
-			vx6953_regs.reg_pat_init[0].reg_0x0b06},
-			/*Single_defect_correct_weight = auto*/
-			{0x0b07,
-			vx6953_regs.reg_pat_init[0].reg_0x0b07},
-			/*Dynamic couplet correction ENABLED*/
-			{0x0b08,
-			vx6953_regs.reg_pat_init[0].reg_0x0b08},
-			/*Dynamic couplet correction weight*/
-			{0x0b09,
-			vx6953_regs.reg_pat_init[0].reg_0x0b09},
-			/* Clock Setup */
-			/* Tell sensor ext clk is 24MHz*/
-			{REG_0x0136,
-			vx6953_regs.reg_pat_init[0].reg_0x0136},
-			{REG_0x0137,
-			vx6953_regs.reg_pat_init[0].reg_0x0137},
-			/* The white balance gains must be written
-			 to the sensor every frame. */
-			/* Edof */
-			{REG_0x0b83,
-			vx6953_regs.reg_pat_init[0].reg_0x0b83},
-			{REG_0x0b84,
-			vx6953_regs.reg_pat_init[0].reg_0x0b84},
-			{REG_0x0b85,
-			vx6953_regs.reg_pat_init[0].reg_0x0b85},
-			{REG_0x0b88,
-			vx6953_regs.reg_pat_init[0].reg_0x0b88},
-			{REG_0x0b89,
-			vx6953_regs.reg_pat_init[0].reg_0x0b89},
-			{REG_0x0b8a,
-			vx6953_regs.reg_pat_init[0].reg_0x0b8a},
-			/* Mode specific regieters */
-			{REG_FRAME_LENGTH_LINES_HI,
-			vx6953_regs.reg_pat[rt].
-			frame_length_lines_hi},
-			{REG_FRAME_LENGTH_LINES_LO,
-			vx6953_regs.reg_pat[rt].
-			frame_length_lines_lo},
-			{REG_LINE_LENGTH_PCK_HI,
-			vx6953_regs.reg_pat[rt].
-			line_length_pck_hi},
-			{REG_LINE_LENGTH_PCK_LO,
-			vx6953_regs.reg_pat[rt].
-			line_length_pck_lo},
-			{REG_0x3005,
-			vx6953_regs.reg_pat[rt].reg_0x3005},
-			{0x3010,
-			vx6953_regs.reg_pat[rt].reg_0x3010},
-			{REG_0x3011,
-			vx6953_regs.reg_pat[rt].reg_0x3011},
-			{REG_0x301a,
-			vx6953_regs.reg_pat[rt].reg_0x301a},
-			{REG_0x3035,
-			vx6953_regs.reg_pat[rt].reg_0x3035},
-			{REG_0x3036,
-			vx6953_regs.reg_pat[rt].reg_0x3036},
-			{REG_0x3041,
-			vx6953_regs.reg_pat[rt].reg_0x3041},
-			{0x3042,
-			vx6953_regs.reg_pat[rt].reg_0x3042},
-			{REG_0x3045,
-			vx6953_regs.reg_pat[rt].reg_0x3045},
-			/*EDOF: Estimation settings for Preview mode
-			  Application settings for capture mode
-			  (standard settings - Not tuned) */
-			{REG_0x0b80,
-			vx6953_regs.reg_pat[rt].reg_0x0b80},
-			{REG_0x0900,
-			vx6953_regs.reg_pat[rt].reg_0x0900},
-			{REG_0x0901,
-			vx6953_regs.reg_pat[rt].reg_0x0901},
-			{REG_0x0902,
-			vx6953_regs.reg_pat[rt].reg_0x0902},
-			{REG_0x0383,
-			vx6953_regs.reg_pat[rt].reg_0x0383},
-			{REG_0x0387,
-			vx6953_regs.reg_pat[rt].reg_0x0387},
-			/* Change output size / frame rate */
-			{REG_0x034c,
-			vx6953_regs.reg_pat[rt].reg_0x034c},
-			{REG_0x034d,
-			vx6953_regs.reg_pat[rt].reg_0x034d},
-			{REG_0x034e,
-			vx6953_regs.reg_pat[rt].reg_0x034e},
-			{REG_0x034f,
-			vx6953_regs.reg_pat[rt].reg_0x034f},
-		};
-		/* reset fps_divider */
-		vx6953_ctrl->fps = 30 * Q8;
-		/* stop streaming */
-
-		/* Reset everything first */
-		if (vx6953_i2c_write_b_sensor(0x103, 0x01) < 0) {
-			CDBG("S/W reset failed\n");
-			return rc;
-		} else
-			CDBG("S/W reset successful\n");
-
-		msleep(10);
-
-		CDBG("Init vx6953_sensor_setting standby\n");
-		if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-				    MODE_SELECT_STANDBY_MODE) < 0)
-			return rc;
-
-		/*vx6953_stm5m0edof_delay_msecs_stdby*/
-		msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-		vx6953_csi_params.data_format = CSI_8BIT;
-		vx6953_csi_params.lane_cnt = 1;
-		vx6953_csi_params.lane_assign = 0xe4;
-		vx6953_csi_params.dpcm_scheme = 0;
-		vx6953_csi_params.settle_cnt = 7;
-		rc = msm_camio_csi_config(&vx6953_csi_params);
-		if (rc < 0)
-			CDBG(" config csi controller failed\n");
-		msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-		vx6953_patch_for_cut3();
-		rc = vx6953_i2c_write_w_table(&init_tbl[0],
-					    ARRAY_SIZE(init_tbl));
-		if (rc < 0)
-			return rc;
-
-		msleep(vx6953_stm5m0edof_delay_msecs_stdby);
-
-		vx6953_i2c_write_b_sensor(0x0b80, 0x00);
-		vx6953_i2c_write_b_sensor(0x3388, 0x03);
-		vx6953_i2c_write_b_sensor(0x3640, 0x00);
-		return rc;
-	} else {
-		/* Start sensor streaming */
-		if (vx6953_i2c_write_b_sensor(REG_MODE_SELECT,
-					    MODE_SELECT_STREAM) < 0)
-			return rc;
-		CDBG("Init vx6953_sensor_setting stream\n");
-		msleep(vx6953_stm5m0edof_delay_msecs_stream);
-		if (vx6953_i2c_read(0x0005, &frame_cnt, 1) < 0)
-			return rc;
-
-		rc = vx6953_i2c_write_w_table(&edof_tbl[0],
-					    ARRAY_SIZE(edof_tbl));
-		vx6953_i2c_write_b_sensor(0x3388, 0x00);
-
-		while (frame_cnt == 0xFF) {
-			if (vx6953_i2c_read(0x0005, &frame_cnt, 1) < 0)
-				return rc;
-			CDBG("frame_cnt=%d", frame_cnt);
-			msleep(10);
-		}
-
-		/* set desired mode */
-		switch (mode) {
-		case SENSOR_PREVIEW_MODE:
-			CDBG("SENSOR_PREVIEW_MODE\n");
-			rc = vx6953_video_config(mode);
-			break;
-		case SENSOR_SNAPSHOT_MODE:
-			CDBG("SENSOR_SNAPSHOT_MODE\n");
-			rc = vx6953_snapshot_config(mode);
-			break;
-		case SENSOR_RAW_SNAPSHOT_MODE:
-			CDBG("SENSOR_RAW_SNAPSHOT_MODE\n");
-			rc = vx6953_raw_snapshot_config(mode);
-			break;
-		default:
-			CDBG("default\n");
-			return -EINVAL;
-		}
-	}
-
-	return 0;
-}
-
-static void vx6953_frame_check(u32 *width, u32 *height)
-{
-	/* get mode first */
-	int mode = vx6953_ctrl->sensormode;
-
-	switch (mode) {
-	case SENSOR_PREVIEW_MODE:
-		if (*width > VX6953_QTR_SIZE_WIDTH)
-			*width = VX6953_QTR_SIZE_WIDTH;
-
-		if (*height > VX6953_QTR_SIZE_HEIGHT)
-			*height = VX6953_QTR_SIZE_HEIGHT;
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		if (*width > VX6953_HRZ_FULL_BLK_PIXELS)
-			*width = VX6953_HRZ_FULL_BLK_PIXELS;
-
-		if (*height > VX6953_VER_FULL_BLK_LINES)
-			*height = VX6953_VER_FULL_BLK_LINES;
-		break;
-	default:
-		break;
-	}
-}
-
-
-static int vx6953_set_params(struct i2c_client *client, u32 width, u32 height,
-			     enum v4l2_mbus_pixelcode code)
-{
-	int i;
-	vx6953_ctrl->fmt = NULL;
-
-	/*
-	 * frame size check
-	 */
-	vx6953_frame_check(&width, &height);
-
-	/*
-	 * get color format
-	 */
-	for (i = 0; i < ARRAY_SIZE(vx6953_cfmts); i++)
-		if (vx6953_cfmts[i].code == code)
-			break;
-	if (i == ARRAY_SIZE(vx6953_cfmts))
-		return -EINVAL;
-
-	/* sensor supports one fixed size depending upon the mode */
-	switch (vx6953_ctrl->sensormode) {
-	case SENSOR_PREVIEW_MODE:
-		vx6953_video_config(vx6953_ctrl->sensormode);
-		break;
-	case SENSOR_SNAPSHOT_MODE:
-		vx6953_snapshot_config(vx6953_ctrl->sensormode);
-		break;
-	case SENSOR_RAW_SNAPSHOT_MODE:
-		vx6953_raw_snapshot_config(vx6953_ctrl->sensormode);
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	/* why need this ? vx6953_ctrl->fmt = &(vx6953_cfmts[i]); */
-
-	return 0;
-}
-
-static int vx6953_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
-{
-	/* right now we are not supporting, probably vfe can take care */
-	return -EINVAL;
-}
-
-static int vx6953_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
-{
-	return -EINVAL;
-}
-
-static int vx6953_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
-{
-	return -EINVAL;
-}
-
-static int vx6953_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
-{
-	/* by this time vx6953_client should already be set */
-	struct i2c_client *client = vx6953_client;
-
-	/* currently sensor supports fixed dimensions only
-	 * depending upon the mode*/
-	if (!vx6953_ctrl->fmt) {
-		int ret = vx6953_set_params(client, VX6953_QTR_SIZE_WIDTH,
-						VX6953_QTR_SIZE_HEIGHT,
-						V4L2_MBUS_FMT_YUYV8_2X8);
-		if (ret < 0)
-			return ret;
-	}
-
-	mf->width = vx6953_get_pict_pixels_pl();
-	mf->height  = vx6953_get_pict_lines_pf();
-	/* TODO: set colorspace */
-	mf->code  = vx6953_ctrl->fmt->code;
-	mf->field = V4L2_FIELD_NONE;
-
-	return 0;
-}
-
-static int vx6953_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
-{
-	/* by this time vx6953_client should already be set */
-	struct i2c_client *client = vx6953_client;
-
-	/* TODO: We need to define this function */
-	/* TODO: set colorspace */
-	return vx6953_set_params(client, mf->width, mf->height, mf->code);
-}
-
-static int vx6953_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(vx6953_cfmts); i++)
-		if (mf->code == vx6953_cfmts[i].code)
-			break;
-
-	if (i == ARRAY_SIZE(vx6953_cfmts))
-		return -EINVAL;
-
-	/* check that frame is within max sensor supported frame size */
-	vx6953_frame_check(&mf->width, &mf->height);
-
-	/* TODO: set colorspace */
-	mf->field = V4L2_FIELD_NONE;
-
-	return 0;
-}
-
-static int vx6953_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-			   enum v4l2_mbus_pixelcode *code)
-{
-	printk(KERN_DEBUG "Index is %d\n", index);
-	if ((unsigned int)index >= ARRAY_SIZE(vx6953_cfmts))
-		return -EINVAL;
-
-	*code = vx6953_cfmts[index].code;
-	return 0;
-}
-
-static struct v4l2_subdev_core_ops vx6953_subdev_core_ops = {
-	.g_chip_ident = vx6953_g_chip_ident,
-};
-
-static struct v4l2_subdev_video_ops vx6953_subdev_video_ops = {
-	.g_parm			   = vx6953_g_parm,
-	.s_parm			   = vx6953_s_parm,
-	.s_stream = vx6953_s_stream,
-	.g_mbus_fmt = vx6953_g_fmt,
-	.s_mbus_fmt = vx6953_s_fmt,
-	.try_mbus_fmt = vx6953_try_fmt,
-	.cropcap  = vx6953_cropcap,
-	.g_crop   = vx6953_g_crop,
-	.s_crop   = vx6953_s_crop,
-	.enum_mbus_fmt  = vx6953_enum_fmt,
-};
-
-static struct v4l2_subdev_ops vx6953_subdev_ops = {
-	.core = &vx6953_subdev_core_ops,
-	.video  = &vx6953_subdev_video_ops,
-};
-
-static int vx6953_sensor_probe(const struct msm_camera_sensor_info *info,
-		struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-	rc = i2c_add_driver(&vx6953_i2c_driver);
-	if (rc < 0 || vx6953_client == NULL) {
-		rc = -ENOTSUPP;
-		goto probe_fail;
-	}
-	msm_camio_clk_rate_set(24000000);
-	rc = vx6953_probe_init_sensor(info);
-	if (rc < 0)
-		goto probe_fail;
-	s->s_init = vx6953_sensor_open_init;
-	s->s_release = vx6953_sensor_release;
-	s->s_config  = vx6953_sensor_config;
-	vx6953_probe_init_done(info);
-	return rc;
-
-probe_fail:
-	CDBG("vx6953_sensor_probe: SENSOR PROBE FAILS!\n");
-	return rc;
-}
-
-
-static int vx6953_sensor_probe_cb(const struct msm_camera_sensor_info *info,
-	struct v4l2_subdev *sdev, struct msm_sensor_ctrl *s)
-{
-	int rc = 0;
-	rc = vx6953_sensor_probe(info, s);
-	if (rc < 0)
-		return rc;
-
-	vx6953_ctrl = kzalloc(sizeof(struct vx6953_ctrl_t), GFP_KERNEL);
-	if (!vx6953_ctrl) {
-		CDBG("vx6953_sensor_probe failed!\n");
-		return -ENOMEM;
-	}
-
-	/* probe is successful, init a v4l2 subdevice */
-	printk(KERN_DEBUG "going into v4l2_i2c_subdev_init\n");
-	if (sdev) {
-		v4l2_i2c_subdev_init(sdev, vx6953_client,
-						&vx6953_subdev_ops);
-		vx6953_ctrl->sensor_dev = sdev;
-	}
-	return rc;
-}
-
-static int __vx6953_probe(struct platform_device *pdev)
-{
-	return msm_sensor_register(pdev, vx6953_sensor_probe_cb);
-}
-
-static struct platform_driver msm_camera_driver = {
-	.probe = __vx6953_probe,
-	.driver = {
-		.name = "msm_camera_vx6953",
-		.owner = THIS_MODULE,
-	},
-};
-
-static int __init vx6953_init(void)
-{
-	return platform_driver_register(&msm_camera_driver);
-}
-
-module_init(vx6953_init);
-void vx6953_exit(void)
-{
-	i2c_del_driver(&vx6953_i2c_driver);
-}
-
-
diff --git a/drivers/media/video/msm/vx6953_v4l2.h b/drivers/media/video/msm/vx6953_v4l2.h
deleted file mode 100644
index 4c7e90f..0000000
--- a/drivers/media/video/msm/vx6953_v4l2.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef VX6953_V4L2_H
-#define VX6953_V4L2_H
-#include <linux/types.h>
-#include <mach/board.h>
-extern struct vx6953_reg vx6953_regs;
-struct reg_struct_init {
-	uint8_t reg_0x0112;      /* 0x0112*/
-	uint8_t reg_0x0113;      /* 0x0113*/
-	uint8_t vt_pix_clk_div;  /* 0x0301*/
-	uint8_t pre_pll_clk_div; /* 0x0305*/
-	uint8_t pll_multiplier;  /* 0x0307*/
-	uint8_t op_pix_clk_div;  /* 0x0309*/
-	uint8_t reg_0x3030;      /*0x3030*/
-	uint8_t reg_0x0111;      /*0x0111*/
-	uint8_t reg_0x0b00;      /*0x0b00*/
-	uint8_t reg_0x3001;      /*0x3001*/
-	uint8_t reg_0x3004;      /*0x3004*/
-	uint8_t reg_0x3007;      /*0x3007*/
-	uint8_t reg_0x3016;      /*0x3016*/
-	uint8_t reg_0x301d;      /*0x301d*/
-	uint8_t reg_0x317e;      /*0x317E*/
-	uint8_t reg_0x317f;      /*0x317F*/
-	uint8_t reg_0x3400;      /*0x3400*/
-	uint8_t reg_0x0b06;      /*0x0b06*/
-	uint8_t reg_0x0b07;      /*0x0b07*/
-	uint8_t reg_0x0b08;      /*0x0b08*/
-	uint8_t reg_0x0b09;      /*0x0b09*/
-	uint8_t reg_0x0136;
-	uint8_t reg_0x0137;
-	/* Edof */
-	uint8_t reg_0x0b83;      /*0x0b83*/
-	uint8_t reg_0x0b84;      /*0x0b84*/
-	uint8_t reg_0x0b85;      /*0x0b85*/
-	uint8_t reg_0x0b88;      /*0x0b88*/
-	uint8_t reg_0x0b89;      /*0x0b89*/
-	uint8_t reg_0x0b8a;      /*0x0b8a*/
-	};
-struct reg_struct {
-	uint8_t coarse_integration_time_hi; /*REG_COARSE_INTEGRATION_TIME_HI*/
-	uint8_t coarse_integration_time_lo; /*REG_COARSE_INTEGRATION_TIME_LO*/
-	uint8_t analogue_gain_code_global;
-	uint8_t frame_length_lines_hi; /* 0x0340*/
-	uint8_t frame_length_lines_lo; /* 0x0341*/
-	uint8_t line_length_pck_hi;    /* 0x0342*/
-	uint8_t line_length_pck_lo;    /* 0x0343*/
-	uint8_t reg_0x3005;   /* 0x3005*/
-	uint8_t reg_0x3010;  /* 0x3010*/
-	uint8_t reg_0x3011;  /* 0x3011*/
-	uint8_t reg_0x301a;  /* 0x301a*/
-	uint8_t reg_0x3035;  /* 0x3035*/
-	uint8_t reg_0x3036;   /* 0x3036*/
-	uint8_t reg_0x3041;  /*0x3041*/
-	uint8_t reg_0x3042;  /*0x3042*/
-	uint8_t reg_0x3045;  /*0x3045*/
-	uint8_t reg_0x0b80;   /* 0x0b80*/
-	uint8_t reg_0x0900;   /*0x0900*/
-	uint8_t reg_0x0901;   /* 0x0901*/
-	uint8_t reg_0x0902;   /*0x0902*/
-	uint8_t reg_0x0383;   /*0x0383*/
-	uint8_t reg_0x0387;   /* 0x0387*/
-	uint8_t reg_0x034c;   /* 0x034c*/
-	uint8_t reg_0x034d;   /*0x034d*/
-	uint8_t reg_0x034e;   /* 0x034e*/
-	uint8_t reg_0x034f;   /* 0x034f*/
-	uint8_t reg_0x1716; /*0x1716*/
-	uint8_t reg_0x1717; /*0x1717*/
-	uint8_t reg_0x1718; /*0x1718*/
-	uint8_t reg_0x1719; /*0x1719*/
-	uint8_t reg_0x3210;/*0x3210*/
-	uint8_t reg_0x111; /*0x111*/
-	uint8_t reg_0x3410;  /*0x3410*/
-	uint8_t reg_0x3098;
-	uint8_t reg_0x309D;
-	uint8_t reg_0x0200;
-	uint8_t reg_0x0201;
-	};
-struct vx6953_i2c_reg_conf {
-	unsigned short waddr;
-	unsigned short wdata;
-};
-
-enum vx6953_test_mode_t {
-	TEST_OFF,
-	TEST_1,
-	TEST_2,
-	TEST_3
-};
-
-enum vx6953_resolution_t {
-	QTR_SIZE,
-	FULL_SIZE,
-	INVALID_SIZE
-};
-enum vx6953_setting {
-	RES_PREVIEW,
-	RES_CAPTURE
-};
-enum mt9p012_reg_update {
-	/* Sensor egisters that need to be updated during initialization */
-	REG_INIT,
-	/* Sensor egisters that needs periodic I2C writes */
-	UPDATE_PERIODIC,
-	/* All the sensor Registers will be updated */
-	UPDATE_ALL,
-	/* Not valid update */
-	UPDATE_INVALID
-};
-
-enum sensor_revision_t {
-	VX6953_STM5M0EDOF_CUT_1,
-	VX6953_STM5M0EDOF_CUT_2,
-	VX6953_STM5M0EDOF_CUT_3
-};
-enum edof_mode_t {
-	VX6953_EDOF_DISABLE,       /* 0x00 */
-	VX6953_EDOF_APPLICATION,   /* 0x01 */
-	VX6953_EDOF_ESTIMATION     /* 0x02 */
-};
-struct vx6953_reg {
-	const struct reg_struct_init  *reg_pat_init;
-	const struct reg_struct  *reg_pat;
-};
-#endif /* VX6953_H */
diff --git a/drivers/media/video/msm_wfd/enc-venus-subdev.c b/drivers/media/video/msm_wfd/enc-venus-subdev.c
index bc1878d..64dea42 100644
--- a/drivers/media/video/msm_wfd/enc-venus-subdev.c
+++ b/drivers/media/video/msm_wfd/enc-venus-subdev.c
@@ -13,7 +13,7 @@
 
 #include <linux/bitmap.h>
 #include <linux/completion.h>
-#include <linux/ion.h>
+#include <linux/msm_ion.h>
 #include <linux/kthread.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
index b2ef948..1d2b341 100644
--- a/drivers/media/video/uvc/uvc_v4l2.c
+++ b/drivers/media/video/uvc/uvc_v4l2.c
@@ -696,7 +696,7 @@
 					break;
 			}
 			pin = iterm->id;
-		} else if (pin < selector->bNrInPins) {
+		} else if (index < selector->bNrInPins) {
 			pin = selector->baSourceID[index];
 			list_for_each_entry(iterm, &chain->entities, chain) {
 				if (!UVC_ENTITY_IS_ITERM(iterm))
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 1baec83..0969f47 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -33,16 +33,6 @@
  * Fixes:
  */
 
-/*
- * Video4linux 1/2 integration by Justin Schoeman
- * <justin@suntiger.ee.up.ac.za>
- * 2.4 PROCFS support ported from 2.4 kernels by
- *  Iñaki García Etxebarria <garetxe@euskalnet.net>
- * Makefile fix by "W. Michael Petullo" <mike@flyn.org>
- * 2.4 devfs support ported from 2.4 kernels by
- *  Dan Merillat <dan@merillat.org>
- * Added Gerd Knorrs v4l1 enhancements (Justin Schoeman)
- */
 
 #include <linux/module.h>
 #include <linux/types.h>
@@ -55,6 +45,7 @@
 #include <linux/spi/spi.h>
 #endif
 #include <asm/uaccess.h>
+#include <asm/system.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
 #include <asm/div64.h>
@@ -69,21 +60,9 @@
 MODULE_DESCRIPTION("misc helper functions for v4l2 device drivers");
 MODULE_LICENSE("GPL");
 
-/*
- *
- *	V 4 L 2   D R I V E R   H E L P E R   A P I
- *
- */
 
-/*
- *  Video Standard Operations (contributed by Michael Schimek)
- */
 
-/* Helper functions for control handling			     */
 
-/* Check for correctness of the ctrl's value based on the data from
-   struct v4l2_queryctrl and the available menu items. Note that
-   menu_items may be NULL, in that case it is ignored. */
 int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
 		const char * const *menu_items)
 {
@@ -104,14 +83,10 @@
 		    menu_items[ctrl->value][0] == '\0')
 			return -EINVAL;
 	}
-	if (qctrl->type == V4L2_CTRL_TYPE_BITMASK &&
-			(ctrl->value & ~qctrl->maximum))
-		return -ERANGE;
 	return 0;
 }
 EXPORT_SYMBOL(v4l2_ctrl_check);
 
-/* Fill in a struct v4l2_queryctrl */
 int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def)
 {
 	const char *name;
@@ -132,10 +107,6 @@
 }
 EXPORT_SYMBOL(v4l2_ctrl_query_fill);
 
-/* Fill in a struct v4l2_querymenu based on the struct v4l2_queryctrl and
-   the menu. The qctrl pointer may be NULL, in which case it is ignored.
-   If menu_items is NULL, then the menu items are retrieved using
-   v4l2_ctrl_get_menu. */
 int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qctrl,
 	       const char * const *menu_items)
 {
@@ -155,9 +126,6 @@
 }
 EXPORT_SYMBOL(v4l2_ctrl_query_menu);
 
-/* Fill in a struct v4l2_querymenu based on the specified array of valid
-   menu items (terminated by V4L2_CTRL_MENU_IDS_END).
-   Use this if there are 'holes' in the list of valid menu items. */
 int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids)
 {
 	const char * const *menu_items = v4l2_ctrl_get_menu(qmenu->id);
@@ -176,14 +144,6 @@
 }
 EXPORT_SYMBOL(v4l2_ctrl_query_menu_valid_items);
 
-/* ctrl_classes points to an array of u32 pointers, the last element is
-   a NULL pointer. Each u32 array is a 0-terminated array of control IDs.
-   Each array must be sorted low to high and belong to the same control
-   class. The array of u32 pointers must also be sorted, from low class IDs
-   to high class IDs.
-
-   This function returns the first ID that follows after the given ID.
-   When no more controls are available 0 is returned. */
 u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id)
 {
 	u32 ctrl_class = V4L2_CTRL_ID2CLASS(id);
@@ -192,34 +152,32 @@
 	if (ctrl_classes == NULL)
 		return 0;
 
-	/* if no query is desired, then check if the ID is part of ctrl_classes */
+	
 	if ((id & V4L2_CTRL_FLAG_NEXT_CTRL) == 0) {
-		/* find class */
+		
 		while (*ctrl_classes && V4L2_CTRL_ID2CLASS(**ctrl_classes) != ctrl_class)
 			ctrl_classes++;
 		if (*ctrl_classes == NULL)
 			return 0;
 		pctrl = *ctrl_classes;
-		/* find control ID */
+		
 		while (*pctrl && *pctrl != id) pctrl++;
 		return *pctrl ? id : 0;
 	}
 	id &= V4L2_CTRL_ID_MASK;
-	id++;	/* select next control */
-	/* find first class that matches (or is greater than) the class of
-	   the ID */
+	id++;	
 	while (*ctrl_classes && V4L2_CTRL_ID2CLASS(**ctrl_classes) < ctrl_class)
 		ctrl_classes++;
-	/* no more classes */
+	
 	if (*ctrl_classes == NULL)
 		return 0;
 	pctrl = *ctrl_classes;
-	/* find first ctrl within the class that is >= ID */
+	
 	while (*pctrl && *pctrl < id) pctrl++;
 	if (*pctrl)
 		return *pctrl;
-	/* we are at the end of the controls of the current class. */
-	/* continue with next class if available */
+	
+	
 	ctrl_classes++;
 	if (*ctrl_classes == NULL)
 		return 0;
@@ -251,7 +209,7 @@
 		if (c->driver == NULL || c->driver->driver.name == NULL)
 			return 0;
 		len = strlen(c->driver->driver.name);
-		/* legacy drivers have a ' suffix, don't try to match that */
+		
 		if (len && c->driver->driver.name[len - 1] == '\'')
 			len--;
 		return len && !strncmp(c->driver->driver.name, match->name, len);
@@ -280,9 +238,7 @@
 }
 EXPORT_SYMBOL(v4l2_chip_ident_i2c_client);
 
-/* ----------------------------------------------------------------- */
 
-/* I2C Helper functions */
 
 
 void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
@@ -290,12 +246,12 @@
 {
 	v4l2_subdev_init(sd, ops);
 	sd->flags |= V4L2_SUBDEV_FL_IS_I2C;
-	/* the owner is the same as the i2c_client's driver owner */
+	
 	sd->owner = client->driver->driver.owner;
-	/* i2c_client and v4l2_subdev point to one another */
+	
 	v4l2_set_subdevdata(sd, client);
 	i2c_set_clientdata(client, sd);
-	/* initialize name */
+	
 	snprintf(sd->name, sizeof(sd->name), "%s %d-%04x",
 		client->driver->driver.name, i2c_adapter_id(client->adapter),
 		client->addr);
@@ -304,7 +260,6 @@
 
 
 
-/* Load an i2c sub-device. */
 struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
 		struct i2c_adapter *adapter, struct i2c_board_info *info,
 		const unsigned short *probe_addrs)
@@ -316,38 +271,27 @@
 
 	request_module(I2C_MODULE_PREFIX "%s", info->type);
 
-	/* Create the i2c client */
+	
 	if (info->addr == 0 && probe_addrs)
 		client = i2c_new_probed_device(adapter, info, probe_addrs,
 					       NULL);
 	else
 		client = i2c_new_device(adapter, info);
 
-	/* Note: by loading the module first we are certain that c->driver
-	   will be set if the driver was found. If the module was not loaded
-	   first, then the i2c core tries to delay-load the module for us,
-	   and then c->driver is still NULL until the module is finally
-	   loaded. This delay-load mechanism doesn't work if other drivers
-	   want to use the i2c device, so explicitly loading the module
-	   is the best alternative. */
 	if (client == NULL || client->driver == NULL)
 		goto error;
 
-	/* Lock the module so we can safely get the v4l2_subdev pointer */
+	
 	if (!try_module_get(client->driver->driver.owner))
 		goto error;
 	sd = i2c_get_clientdata(client);
 
-	/* Register with the v4l2_device which increases the module's
-	   use count as well. */
 	if (v4l2_device_register_subdev(v4l2_dev, sd))
 		sd = NULL;
-	/* Decrease the module use count to match the first try_module_get. */
+	
 	module_put(client->driver->driver.owner);
 
 error:
-	/* If we have a client but no subdev, then something went wrong and
-	   we must unregister the client. */
 	if (client && sd == NULL)
 		i2c_unregister_device(client);
 	return sd;
@@ -360,8 +304,6 @@
 {
 	struct i2c_board_info info;
 
-	/* Setup the i2c board info with the device type and
-	   the device address. */
 	memset(&info, 0, sizeof(info));
 	strlcpy(info.type, client_type, sizeof(info.type));
 	info.addr = addr;
@@ -370,7 +312,6 @@
 }
 EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev);
 
-/* Return i2c client address of v4l2_subdev. */
 unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -379,8 +320,6 @@
 }
 EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_addr);
 
-/* Return a list of I2C tuner addresses to probe. Use only if the tuner
-   addresses are unknown. */
 const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type)
 {
 	static const unsigned short radio_addrs[] = {
@@ -395,7 +334,7 @@
 		I2C_CLIENT_END
 	};
 	static const unsigned short tv_addrs[] = {
-		0x42, 0x43, 0x4a, 0x4b,		/* tda8290 */
+		0x42, 0x43, 0x4a, 0x4b,		
 		0x60, 0x61, 0x62, 0x63, 0x64,
 		I2C_CLIENT_END
 	};
@@ -414,23 +353,22 @@
 }
 EXPORT_SYMBOL_GPL(v4l2_i2c_tuner_addrs);
 
-#endif /* defined(CONFIG_I2C) */
+#endif 
 
 #if defined(CONFIG_SPI)
 
-/* Load a spi sub-device. */
 
 void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi,
 		const struct v4l2_subdev_ops *ops)
 {
 	v4l2_subdev_init(sd, ops);
 	sd->flags |= V4L2_SUBDEV_FL_IS_SPI;
-	/* the owner is the same as the spi_device's driver owner */
+	
 	sd->owner = spi->dev.driver->owner;
-	/* spi_device and v4l2_subdev point to one another */
+	
 	v4l2_set_subdevdata(sd, spi);
 	spi_set_drvdata(spi, sd);
-	/* initialize name */
+	
 	strlcpy(sd->name, spi->dev.driver->name, sizeof(sd->name));
 }
 EXPORT_SYMBOL_GPL(v4l2_spi_subdev_init);
@@ -456,17 +394,13 @@
 
 	sd = spi_get_drvdata(spi);
 
-	/* Register with the v4l2_device which increases the module's
-	   use count as well. */
 	if (v4l2_device_register_subdev(v4l2_dev, sd))
 		sd = NULL;
 
-	/* Decrease the module use count to match the first try_module_get. */
+	
 	module_put(spi->dev.driver->owner);
 
 error:
-	/* If we have a client but no subdev, then something went wrong and
-	   we must unregister the client. */
 	if (spi && sd == NULL)
 		spi_unregister_device(spi);
 
@@ -474,23 +408,19 @@
 }
 EXPORT_SYMBOL_GPL(v4l2_spi_new_subdev);
 
-#endif /* defined(CONFIG_SPI) */
+#endif 
 
-/* Clamp x to be between min and max, aligned to a multiple of 2^align.  min
- * and max don't have to be aligned, but there must be at least one valid
- * value.  E.g., min=17,max=31,align=4 is not allowed as there are no multiples
- * of 16 between 17 and 31.  */
 static unsigned int clamp_align(unsigned int x, unsigned int min,
 				unsigned int max, unsigned int align)
 {
-	/* Bits that must be zero to be aligned */
+	
 	unsigned int mask = ~((1 << align) - 1);
 
-	/* Round to nearest aligned value */
+	
 	if (align)
 		x = (x + (1 << (align - 1))) & mask;
 
-	/* Clamp to aligned value of min and max */
+	
 	if (x < min)
 		x = (min + ~mask) & mask;
 	else if (x > max)
@@ -499,20 +429,6 @@
 	return x;
 }
 
-/* Bound an image to have a width between wmin and wmax, and height between
- * hmin and hmax, inclusive.  Additionally, the width will be a multiple of
- * 2^walign, the height will be a multiple of 2^halign, and the overall size
- * (width*height) will be a multiple of 2^salign.  The image may be shrunk
- * or enlarged to fit the alignment constraints.
- *
- * The width or height maximum must not be smaller than the corresponding
- * minimum.  The alignments must not be so high there are no possible image
- * sizes within the allowed bounds.  wmin and hmin must be at least 1
- * (don't use 0).  If you don't care about a certain alignment, specify 0,
- * as 2^0 is 1 and one byte alignment is equivalent to no alignment.  If
- * you only want to adjust downward, specify a maximum that's the same as
- * the initial value.
- */
 void v4l_bound_align_image(u32 *w, unsigned int wmin, unsigned int wmax,
 			   unsigned int walign,
 			   u32 *h, unsigned int hmin, unsigned int hmax,
@@ -521,21 +437,21 @@
 	*w = clamp_align(*w, wmin, wmax, walign);
 	*h = clamp_align(*h, hmin, hmax, halign);
 
-	/* Usually we don't need to align the size and are done now. */
+	
 	if (!salign)
 		return;
 
-	/* How much alignment do we have? */
+	
 	walign = __ffs(*w);
 	halign = __ffs(*h);
-	/* Enough to satisfy the image alignment? */
+	
 	if (walign + halign < salign) {
-		/* Max walign where there is still a valid width */
+		
 		unsigned int wmaxa = __fls(wmax ^ (wmin - 1));
-		/* Max halign where there is still a valid height */
+		
 		unsigned int hmaxa = __fls(hmax ^ (hmin - 1));
 
-		/* up the smaller alignment until we have enough */
+		
 		do {
 			if (halign >= hmaxa ||
 			    (walign <= halign && walign < wmaxa)) {
@@ -550,14 +466,6 @@
 }
 EXPORT_SYMBOL_GPL(v4l_bound_align_image);
 
-/**
- * v4l_fill_dv_preset_info - fill description of a digital video preset
- * @preset - preset value
- * @info - pointer to struct v4l2_dv_enum_preset
- *
- * drivers can use this helper function to fill description of dv preset
- * in info.
- */
 int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
 {
 	static const struct v4l2_dv_preset_info {
@@ -565,25 +473,25 @@
 		u16 height;
 		const char *name;
 	} dv_presets[] = {
-		{ 0, 0, "Invalid" },		/* V4L2_DV_INVALID */
-		{ 720,  480, "480p@59.94" },	/* V4L2_DV_480P59_94 */
-		{ 720,  576, "576p@50" },	/* V4L2_DV_576P50 */
-		{ 1280, 720, "720p@24" },	/* V4L2_DV_720P24 */
-		{ 1280, 720, "720p@25" },	/* V4L2_DV_720P25 */
-		{ 1280, 720, "720p@30" },	/* V4L2_DV_720P30 */
-		{ 1280, 720, "720p@50" },	/* V4L2_DV_720P50 */
-		{ 1280, 720, "720p@59.94" },	/* V4L2_DV_720P59_94 */
-		{ 1280, 720, "720p@60" },	/* V4L2_DV_720P60 */
-		{ 1920, 1080, "1080i@29.97" },	/* V4L2_DV_1080I29_97 */
-		{ 1920, 1080, "1080i@30" },	/* V4L2_DV_1080I30 */
-		{ 1920, 1080, "1080i@25" },	/* V4L2_DV_1080I25 */
-		{ 1920, 1080, "1080i@50" },	/* V4L2_DV_1080I50 */
-		{ 1920, 1080, "1080i@60" },	/* V4L2_DV_1080I60 */
-		{ 1920, 1080, "1080p@24" },	/* V4L2_DV_1080P24 */
-		{ 1920, 1080, "1080p@25" },	/* V4L2_DV_1080P25 */
-		{ 1920, 1080, "1080p@30" },	/* V4L2_DV_1080P30 */
-		{ 1920, 1080, "1080p@50" },	/* V4L2_DV_1080P50 */
-		{ 1920, 1080, "1080p@60" },	/* V4L2_DV_1080P60 */
+		{ 0, 0, "Invalid" },		
+		{ 720,  480, "480p@59.94" },	
+		{ 720,  576, "576p@50" },	
+		{ 1280, 720, "720p@24" },	
+		{ 1280, 720, "720p@25" },	
+		{ 1280, 720, "720p@30" },	
+		{ 1280, 720, "720p@50" },	
+		{ 1280, 720, "720p@59.94" },	
+		{ 1280, 720, "720p@60" },	
+		{ 1920, 1080, "1080i@29.97" },	
+		{ 1920, 1080, "1080i@30" },	
+		{ 1920, 1080, "1080i@25" },	
+		{ 1920, 1080, "1080i@50" },	
+		{ 1920, 1080, "1080i@60" },	
+		{ 1920, 1080, "1080p@24" },	
+		{ 1920, 1080, "1080p@25" },	
+		{ 1920, 1080, "1080p@30" },	
+		{ 1920, 1080, "1080p@50" },	
+		{ 1920, 1080, "1080p@60" },	
 	};
 
 	if (info == NULL || preset >= ARRAY_SIZE(dv_presets))
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 7da4657..6cbd317 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -18,49 +18,20 @@
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/module.h>
 #include <linux/ctype.h>
 #include <linux/slab.h>
-#include <linux/export.h>
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ctrls.h>
-#include <media/v4l2-event.h>
 #include <media/v4l2-dev.h>
 
-#define has_op(master, op) \
-	(master->ops && master->ops->op)
-#define call_op(master, op) \
-	(has_op(master, op) ? master->ops->op(master) : 0)
-
-/* Internal temporary helper struct, one for each v4l2_ext_control */
-struct v4l2_ctrl_helper {
-	/* Pointer to the control reference of the master control */
-	struct v4l2_ctrl_ref *mref;
-	/* The control corresponding to the v4l2_ext_control ID field. */
+struct ctrl_helper {
+	
 	struct v4l2_ctrl *ctrl;
-	/* v4l2_ext_control index of the next control belonging to the
-	   same cluster, or 0 if there isn't any. */
-	u32 next;
+	bool handled;
 };
 
-/* Small helper function to determine if the autocluster is set to manual
-   mode. */
-static bool is_cur_manual(const struct v4l2_ctrl *master)
-{
-	return master->is_auto && master->cur.val == master->manual_mode_value;
-}
-
-/* Same as above, but this checks the against the new value instead of the
-   current value. */
-static bool is_new_manual(const struct v4l2_ctrl *master)
-{
-	return master->is_auto && master->val == master->manual_mode_value;
-}
-
-/* Returns NULL or a character pointer array containing the menu for
-   the given control ID. The pointer array ends with a NULL pointer.
-   An empty string signifies a menu entry that is invalid. This allows
-   drivers to disable certain options if it is not supported. */
 const char * const *v4l2_ctrl_get_menu(u32 id)
 {
 	static const char * const mpeg_audio_sampling_freq[] = {
@@ -175,15 +146,6 @@
 		"16-bit CRC",
 		NULL
 	};
-	static const char * const mpeg_audio_dec_playback[] = {
-		"Auto",
-		"Stereo",
-		"Left",
-		"Right",
-		"Mono",
-		"Swapped Stereo",
-		NULL
-	};
 	static const char * const mpeg_video_encoding[] = {
 		"MPEG-1",
 		"MPEG-2",
@@ -213,14 +175,13 @@
 	};
 	static const char * const mpeg_stream_vbi_fmt[] = {
 		"No VBI",
-		"Private Packet, IVTV Format",
+		"Private packet, IVTV format",
 		NULL
 	};
 	static const char * const camera_power_line_frequency[] = {
 		"Disabled",
 		"50 Hz",
 		"60 Hz",
-		"Auto",
 		NULL
 	};
 	static const char * const camera_exposure_auto[] = {
@@ -237,147 +198,18 @@
 		"Negative",
 		"Emboss",
 		"Sketch",
-		"Sky Blue",
-		"Grass Green",
-		"Skin Whiten",
+		"Sky blue",
+		"Grass green",
+		"Skin whiten",
 		"Vivid",
 		NULL
 	};
 	static const char * const tune_preemphasis[] = {
-		"No Preemphasis",
-		"50 Microseconds",
-		"75 Microseconds",
+		"No preemphasis",
+		"50 useconds",
+		"75 useconds",
 		NULL,
 	};
-	static const char * const header_mode[] = {
-		"Separate Buffer",
-		"Joined With 1st Frame",
-		NULL,
-	};
-	static const char * const multi_slice[] = {
-		"Single",
-		"Max Macroblocks",
-		"Max Bytes",
-		NULL,
-	};
-	static const char * const entropy_mode[] = {
-		"CAVLC",
-		"CABAC",
-		NULL,
-	};
-	static const char * const mpeg_h264_level[] = {
-		"1",
-		"1b",
-		"1.1",
-		"1.2",
-		"1.3",
-		"2",
-		"2.1",
-		"2.2",
-		"3",
-		"3.1",
-		"3.2",
-		"4",
-		"4.1",
-		"4.2",
-		"5",
-		"5.1",
-		NULL,
-	};
-	static const char * const h264_loop_filter[] = {
-		"Enabled",
-		"Disabled",
-		"Disabled at Slice Boundary",
-		NULL,
-	};
-	static const char * const h264_profile[] = {
-		"Baseline",
-		"Constrained Baseline",
-		"Main",
-		"Extended",
-		"High",
-		"High 10",
-		"High 422",
-		"High 444 Predictive",
-		"High 10 Intra",
-		"High 422 Intra",
-		"High 444 Intra",
-		"CAVLC 444 Intra",
-		"Scalable Baseline",
-		"Scalable High",
-		"Scalable High Intra",
-		"Multiview High",
-		NULL,
-	};
-	static const char * const vui_sar_idc[] = {
-		"Unspecified",
-		"1:1",
-		"12:11",
-		"10:11",
-		"16:11",
-		"40:33",
-		"24:11",
-		"20:11",
-		"32:11",
-		"80:33",
-		"18:11",
-		"15:11",
-		"64:33",
-		"160:99",
-		"4:3",
-		"3:2",
-		"2:1",
-		"Extended SAR",
-		NULL,
-	};
-	static const char * const mpeg_mpeg4_level[] = {
-		"0",
-		"0b",
-		"1",
-		"2",
-		"3",
-		"3b",
-		"4",
-		"5",
-		NULL,
-	};
-	static const char * const mpeg4_profile[] = {
-		"Simple",
-		"Advanced Simple",
-		"Core",
-		"Simple Scalable",
-		"Advanced Coding Efficency",
-		NULL,
-	};
-
-	static const char * const flash_led_mode[] = {
-		"Off",
-		"Flash",
-		"Torch",
-		NULL,
-	};
-	static const char * const flash_strobe_source[] = {
-		"Software",
-		"External",
-		NULL,
-	};
-
-	static const char * const jpeg_chroma_subsampling[] = {
-		"4:4:4",
-		"4:2:2",
-		"4:2:0",
-		"4:1:1",
-		"4:1:0",
-		"Gray",
-		NULL,
-	};
-	static const char *const mpeg_video_intra_refresh_mode[] = {
-		"No Intra Refresh",
-		"AIR MBS",
-		"AIR REF",
-		"CIR MBS",
-		NULL
-	};
 
 	switch (id) {
 	case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -400,9 +232,6 @@
 		return mpeg_audio_emphasis;
 	case V4L2_CID_MPEG_AUDIO_CRC:
 		return mpeg_audio_crc;
-	case V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK:
-	case V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK:
-		return mpeg_audio_dec_playback;
 	case V4L2_CID_MPEG_VIDEO_ENCODING:
 		return mpeg_video_encoding;
 	case V4L2_CID_MPEG_VIDEO_ASPECT:
@@ -421,44 +250,17 @@
 		return colorfx;
 	case V4L2_CID_TUNE_PREEMPHASIS:
 		return tune_preemphasis;
-	case V4L2_CID_FLASH_LED_MODE:
-		return flash_led_mode;
-	case V4L2_CID_FLASH_STROBE_SOURCE:
-		return flash_strobe_source;
-	case V4L2_CID_MPEG_VIDEO_HEADER_MODE:
-		return header_mode;
-	case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE:
-		return multi_slice;
-	case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE:
-		return entropy_mode;
-	case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
-		return mpeg_h264_level;
-	case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE:
-		return h264_loop_filter;
-	case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
-		return h264_profile;
-	case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC:
-		return vui_sar_idc;
-	case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
-		return mpeg_mpeg4_level;
-	case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
-		return mpeg4_profile;
-	case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
-		return jpeg_chroma_subsampling;
-	case V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_MODE:
-		return mpeg_video_intra_refresh_mode;
 	default:
 		return NULL;
 	}
 }
 EXPORT_SYMBOL(v4l2_ctrl_get_menu);
 
-/* Return the control name. */
 const char *v4l2_ctrl_get_name(u32 id)
 {
 	switch (id) {
-	/* USER controls */
-	/* Keep the order of the 'case's the same as in videodev2.h! */
+	
+	
 	case V4L2_CID_USER_CLASS:		return "User Controls";
 	case V4L2_CID_BRIGHTNESS:		return "Brightness";
 	case V4L2_CID_CONTRAST:			return "Contrast";
@@ -498,12 +300,9 @@
 	case V4L2_CID_CHROMA_GAIN:		return "Chroma Gain";
 	case V4L2_CID_ILLUMINATORS_1:		return "Illuminator 1";
 	case V4L2_CID_ILLUMINATORS_2:		return "Illuminator 2";
-	case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:	return "Min Number of Capture Buffers";
-	case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT:	return "Min Number of Output Buffers";
-	case V4L2_CID_ALPHA_COMPONENT:		return "Alpha Component";
 
-	/* MPEG controls */
-	/* Keep the order of the 'case's the same as in videodev2.h! */
+	
+	
 	case V4L2_CID_MPEG_CLASS:		return "MPEG Encoder Controls";
 	case V4L2_CID_MPEG_STREAM_TYPE:		return "Stream Type";
 	case V4L2_CID_MPEG_STREAM_PID_PMT:	return "Stream PMT Program ID";
@@ -525,8 +324,6 @@
 	case V4L2_CID_MPEG_AUDIO_MUTE:		return "Audio Mute";
 	case V4L2_CID_MPEG_AUDIO_AAC_BITRATE:	return "Audio AAC Bitrate";
 	case V4L2_CID_MPEG_AUDIO_AC3_BITRATE:	return "Audio AC-3 Bitrate";
-	case V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK:	return "Audio Playback";
-	case V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK: return "Audio Multilingual Playback";
 	case V4L2_CID_MPEG_VIDEO_ENCODING:	return "Video Encoding";
 	case V4L2_CID_MPEG_VIDEO_ASPECT:	return "Video Aspect";
 	case V4L2_CID_MPEG_VIDEO_B_FRAMES:	return "Video B Frames";
@@ -539,61 +336,9 @@
 	case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION: return "Video Temporal Decimation";
 	case V4L2_CID_MPEG_VIDEO_MUTE:		return "Video Mute";
 	case V4L2_CID_MPEG_VIDEO_MUTE_YUV:	return "Video Mute YUV";
-	case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE:	return "Decoder Slice Interface";
-	case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER:	return "MPEG4 Loop Filter Enable";
-	case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB:	return "Number of Intra Refresh MBs";
-	case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE:		return "Frame Level Rate Control Enable";
-	case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE:			return "H264 MB Level Rate Control";
-	case V4L2_CID_MPEG_VIDEO_HEADER_MODE:			return "Sequence Header Mode";
-	case V4L2_CID_MPEG_VIDEO_MAX_REF_PIC:			return "Max Number of Reference Pics";
-	case V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP:		return "H263 I-Frame QP Value";
-	case V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP:		return "H263 P-Frame QP Value";
-	case V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP:		return "H263 B-Frame QP Value";
-	case V4L2_CID_MPEG_VIDEO_H263_MIN_QP:			return "H263 Minimum QP Value";
-	case V4L2_CID_MPEG_VIDEO_H263_MAX_QP:			return "H263 Maximum QP Value";
-	case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP:		return "H264 I-Frame QP Value";
-	case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP:		return "H264 P-Frame QP Value";
-	case V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP:		return "H264 B-Frame QP Value";
-	case V4L2_CID_MPEG_VIDEO_H264_MAX_QP:			return "H264 Maximum QP Value";
-	case V4L2_CID_MPEG_VIDEO_H264_MIN_QP:			return "H264 Minimum QP Value";
-	case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:		return "H264 8x8 Transform Enable";
-	case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE:			return "H264 CPB Buffer Size";
-	case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE:		return "H264 Entropy Mode";
-	case V4L2_CID_MPEG_VIDEO_H264_I_PERIOD:			return "H264 I-Frame Period";
-	case V4L2_CID_MPEG_VIDEO_H264_LEVEL:			return "H264 Level";
-	case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA:	return "H264 Loop Filter Alpha Offset";
-	case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA:		return "H264 Loop Filter Beta Offset";
-	case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE:		return "H264 Loop Filter Mode";
-	case V4L2_CID_MPEG_VIDEO_H264_PROFILE:			return "H264 Profile";
-	case V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT:	return "Vertical Size of SAR";
-	case V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH:	return "Horizontal Size of SAR";
-	case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE:		return "Aspect Ratio VUI Enable";
-	case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC:		return "VUI Aspect Ratio IDC";
-	case V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP:		return "MPEG4 I-Frame QP Value";
-	case V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP:		return "MPEG4 P-Frame QP Value";
-	case V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP:		return "MPEG4 B-Frame QP Value";
-	case V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP:			return "MPEG4 Minimum QP Value";
-	case V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP:			return "MPEG4 Maximum QP Value";
-	case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:			return "MPEG4 Level";
-	case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:			return "MPEG4 Profile";
-	case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:			return "Quarter Pixel Search Enable";
-	case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES:		return "Maximum Bytes in a Slice";
-	case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB:		return "Number of MBs in a Slice";
-	case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE:		return "Slice Partitioning Method";
-	case V4L2_CID_MPEG_VIDEO_VBV_SIZE:			return "VBV Buffer Size";
-	case V4L2_CID_MPEG_VIDEO_DEC_PTS:			return "Video Decoder PTS";
-	case V4L2_CID_MPEG_VIDEO_DEC_FRAME:			return "Video Decoder Frame Count";
-	case V4L2_CID_MPEG_VIDC_VIDEO_ROTATION: return "Rotation";
-	case V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL: return "Rate Control";
-	case V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL: return "CABAC Model";
-	case V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_MODE:
-		return "Intra Refresh Mode";
-	case V4L2_CID_MPEG_VIDC_VIDEO_AIR_MBS: return "Intra Refresh AIR MBS";
-	case V4L2_CID_MPEG_VIDC_VIDEO_AIR_REF: return "Intra Refresh AIR REF";
-	case V4L2_CID_MPEG_VIDC_VIDEO_CIR_MBS: return "Intra Refresh CIR MBS";
 
-	/* CAMERA controls */
-	/* Keep the order of the 'case's the same as in videodev2.h! */
+	
+	
 	case V4L2_CID_CAMERA_CLASS:		return "Camera Controls";
 	case V4L2_CID_EXPOSURE_AUTO:		return "Auto Exposure";
 	case V4L2_CID_EXPOSURE_ABSOLUTE:	return "Exposure Time, Absolute";
@@ -614,8 +359,8 @@
 	case V4L2_CID_IRIS_ABSOLUTE:		return "Iris, Absolute";
 	case V4L2_CID_IRIS_RELATIVE:		return "Iris, Relative";
 
-	/* FM Radio Modulator control */
-	/* Keep the order of the 'case's the same as in videodev2.h! */
+	
+	
 	case V4L2_CID_FM_TX_CLASS:		return "FM Radio Modulator Controls";
 	case V4L2_CID_RDS_TX_DEVIATION:		return "RDS Signal Deviation";
 	case V4L2_CID_RDS_TX_PI:		return "RDS Program ID";
@@ -625,7 +370,7 @@
 	case V4L2_CID_AUDIO_LIMITER_ENABLED:	return "Audio Limiter Feature Enabled";
 	case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: return "Audio Limiter Release Time";
 	case V4L2_CID_AUDIO_LIMITER_DEVIATION:	return "Audio Limiter Deviation";
-	case V4L2_CID_AUDIO_COMPRESSION_ENABLED: return "Audio Compression Enabled";
+	case V4L2_CID_AUDIO_COMPRESSION_ENABLED: return "Audio Compression Feature Enabled";
 	case V4L2_CID_AUDIO_COMPRESSION_GAIN:	return "Audio Compression Gain";
 	case V4L2_CID_AUDIO_COMPRESSION_THRESHOLD: return "Audio Compression Threshold";
 	case V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME: return "Audio Compression Attack Time";
@@ -633,33 +378,10 @@
 	case V4L2_CID_PILOT_TONE_ENABLED:	return "Pilot Tone Feature Enabled";
 	case V4L2_CID_PILOT_TONE_DEVIATION:	return "Pilot Tone Deviation";
 	case V4L2_CID_PILOT_TONE_FREQUENCY:	return "Pilot Tone Frequency";
-	case V4L2_CID_TUNE_PREEMPHASIS:		return "Pre-Emphasis";
+	case V4L2_CID_TUNE_PREEMPHASIS:		return "Pre-emphasis settings";
 	case V4L2_CID_TUNE_POWER_LEVEL:		return "Tune Power Level";
 	case V4L2_CID_TUNE_ANTENNA_CAPACITOR:	return "Tune Antenna Capacitor";
 
-	/* Flash controls */
-	case V4L2_CID_FLASH_CLASS:		return "Flash Controls";
-	case V4L2_CID_FLASH_LED_MODE:		return "LED Mode";
-	case V4L2_CID_FLASH_STROBE_SOURCE:	return "Strobe Source";
-	case V4L2_CID_FLASH_STROBE:		return "Strobe";
-	case V4L2_CID_FLASH_STROBE_STOP:	return "Stop Strobe";
-	case V4L2_CID_FLASH_STROBE_STATUS:	return "Strobe Status";
-	case V4L2_CID_FLASH_TIMEOUT:		return "Strobe Timeout";
-	case V4L2_CID_FLASH_INTENSITY:		return "Intensity, Flash Mode";
-	case V4L2_CID_FLASH_TORCH_INTENSITY:	return "Intensity, Torch Mode";
-	case V4L2_CID_FLASH_INDICATOR_INTENSITY: return "Intensity, Indicator";
-	case V4L2_CID_FLASH_FAULT:		return "Faults";
-	case V4L2_CID_FLASH_CHARGE:		return "Charge";
-	case V4L2_CID_FLASH_READY:		return "Ready to Strobe";
-
-	/* JPEG encoder controls */
-	/* Keep the order of the 'case's the same as in videodev2.h! */
-	case V4L2_CID_JPEG_CLASS:		return "JPEG Compression Controls";
-	case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:	return "Chroma Subsampling";
-	case V4L2_CID_JPEG_RESTART_INTERVAL:	return "Restart Interval";
-	case V4L2_CID_JPEG_COMPRESSION_QUALITY:	return "Compression Quality";
-	case V4L2_CID_JPEG_ACTIVE_MARKER:	return "Active Markers";
-
 	default:
 		return NULL;
 	}
@@ -694,24 +416,12 @@
 	case V4L2_CID_PILOT_TONE_ENABLED:
 	case V4L2_CID_ILLUMINATORS_1:
 	case V4L2_CID_ILLUMINATORS_2:
-	case V4L2_CID_FLASH_STROBE_STATUS:
-	case V4L2_CID_FLASH_CHARGE:
-	case V4L2_CID_FLASH_READY:
-	case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER:
-	case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE:
-	case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE:
-	case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE:
-	case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:
-	case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE:
-	case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
 		*type = V4L2_CTRL_TYPE_BOOLEAN;
 		*min = 0;
 		*max = *step = 1;
 		break;
 	case V4L2_CID_PAN_RESET:
 	case V4L2_CID_TILT_RESET:
-	case V4L2_CID_FLASH_STROBE:
-	case V4L2_CID_FLASH_STROBE_STOP:
 		*type = V4L2_CTRL_TYPE_BUTTON;
 		*flags |= V4L2_CTRL_FLAG_WRITE_ONLY;
 		*min = *max = *step = *def = 0;
@@ -727,8 +437,6 @@
 	case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION:
 	case V4L2_CID_MPEG_AUDIO_EMPHASIS:
 	case V4L2_CID_MPEG_AUDIO_CRC:
-	case V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK:
-	case V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK:
 	case V4L2_CID_MPEG_VIDEO_ENCODING:
 	case V4L2_CID_MPEG_VIDEO_ASPECT:
 	case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
@@ -737,21 +445,6 @@
 	case V4L2_CID_EXPOSURE_AUTO:
 	case V4L2_CID_COLORFX:
 	case V4L2_CID_TUNE_PREEMPHASIS:
-	case V4L2_CID_FLASH_LED_MODE:
-	case V4L2_CID_FLASH_STROBE_SOURCE:
-	case V4L2_CID_MPEG_VIDEO_HEADER_MODE:
-	case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE:
-	case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE:
-	case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
-	case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE:
-	case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
-	case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC:
-	case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
-	case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
-	case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
-	case V4L2_CID_MPEG_VIDC_VIDEO_ROTATION:
-	case V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL:
-	case V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL:
 		*type = V4L2_CTRL_TYPE_MENU;
 		break;
 	case V4L2_CID_RDS_TX_PS_NAME:
@@ -762,39 +455,18 @@
 	case V4L2_CID_CAMERA_CLASS:
 	case V4L2_CID_MPEG_CLASS:
 	case V4L2_CID_FM_TX_CLASS:
-	case V4L2_CID_FLASH_CLASS:
-	case V4L2_CID_JPEG_CLASS:
 		*type = V4L2_CTRL_TYPE_CTRL_CLASS;
-		/* You can neither read not write these */
+		
 		*flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
 		*min = *max = *step = *def = 0;
 		break;
 	case V4L2_CID_BG_COLOR:
-	case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP:
-	case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP:
-	case V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP:
-	case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES:
-	case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB:
-	*type = V4L2_CTRL_TYPE_INTEGER;
+		*type = V4L2_CTRL_TYPE_INTEGER;
 		*step = 1;
 		*min = 0;
-		/* Max is calculated as RGB888 that is 2^24 */
+		
 		*max = 0xFFFFFF;
 		break;
-	case V4L2_CID_FLASH_FAULT:
-	case V4L2_CID_JPEG_ACTIVE_MARKER:
-		*type = V4L2_CTRL_TYPE_BITMASK;
-		break;
-	case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
-	case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT:
-		*type = V4L2_CTRL_TYPE_INTEGER;
-		*flags |= V4L2_CTRL_FLAG_READ_ONLY;
-		break;
-	case V4L2_CID_MPEG_VIDEO_DEC_FRAME:
-	case V4L2_CID_MPEG_VIDEO_DEC_PTS:
-		*type = V4L2_CTRL_TYPE_INTEGER64;
-		*flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE;
-		break;
 	default:
 		*type = V4L2_CTRL_TYPE_INTEGER;
 		break;
@@ -840,65 +512,22 @@
 	case V4L2_CID_ZOOM_RELATIVE:
 		*flags |= V4L2_CTRL_FLAG_WRITE_ONLY;
 		break;
-	case V4L2_CID_FLASH_STROBE_STATUS:
-	case V4L2_CID_FLASH_READY:
-		*flags |= V4L2_CTRL_FLAG_READ_ONLY;
-		break;
 	}
 }
 EXPORT_SYMBOL(v4l2_ctrl_fill);
 
-/* Helper function to determine whether the control type is compatible with
-   VIDIOC_G/S_CTRL. */
 static bool type_is_int(const struct v4l2_ctrl *ctrl)
 {
 	switch (ctrl->type) {
 	case V4L2_CTRL_TYPE_INTEGER64:
 	case V4L2_CTRL_TYPE_STRING:
-		/* Nope, these need v4l2_ext_control */
+		
 		return false;
 	default:
 		return true;
 	}
 }
 
-static void fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl, u32 changes)
-{
-	memset(ev->reserved, 0, sizeof(ev->reserved));
-	ev->type = V4L2_EVENT_CTRL;
-	ev->id = ctrl->id;
-	ev->u.ctrl.changes = changes;
-	ev->u.ctrl.type = ctrl->type;
-	ev->u.ctrl.flags = ctrl->flags;
-	if (ctrl->type == V4L2_CTRL_TYPE_STRING)
-		ev->u.ctrl.value64 = 0;
-	else
-		ev->u.ctrl.value64 = ctrl->cur.val64;
-	ev->u.ctrl.minimum = ctrl->minimum;
-	ev->u.ctrl.maximum = ctrl->maximum;
-	if (ctrl->type == V4L2_CTRL_TYPE_MENU)
-		ev->u.ctrl.step = 1;
-	else
-		ev->u.ctrl.step = ctrl->step;
-	ev->u.ctrl.default_value = ctrl->default_value;
-}
-
-static void send_event(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 changes)
-{
-	struct v4l2_event ev;
-	struct v4l2_subscribed_event *sev;
-
-	if (list_empty(&ctrl->ev_subs))
-		return;
-	fill_event(&ev, ctrl, changes);
-
-	list_for_each_entry(sev, &ctrl->ev_subs, node)
-		if (sev->fh != fh ||
-		    (sev->flags & V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK))
-			v4l2_event_queue_fh(sev->fh, &ev);
-}
-
-/* Helper function: copy the current control value back to the caller */
 static int cur_to_user(struct v4l2_ext_control *c,
 		       struct v4l2_ctrl *ctrl)
 {
@@ -923,7 +552,6 @@
 	return 0;
 }
 
-/* Helper function: copy the caller-provider value as the new control value */
 static int user_to_new(struct v4l2_ext_control *c,
 		       struct v4l2_ctrl *ctrl)
 {
@@ -946,8 +574,6 @@
 			char last = ctrl->string[size - 1];
 
 			ctrl->string[size - 1] = 0;
-			/* If the string was longer than ctrl->maximum,
-			   then return an error. */
 			if (strlen(ctrl->string) == ctrl->maximum && last)
 				return -ERANGE;
 		}
@@ -959,7 +585,6 @@
 	return 0;
 }
 
-/* Helper function: copy the new control value back to the caller */
 static int new_to_user(struct v4l2_ext_control *c,
 		       struct v4l2_ctrl *ctrl)
 {
@@ -984,62 +609,31 @@
 	return 0;
 }
 
-/* Copy the new value to the current value. */
-static void new_to_cur(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl,
-						bool update_inactive)
+static void new_to_cur(struct v4l2_ctrl *ctrl)
 {
-	bool changed = false;
-
 	if (ctrl == NULL)
 		return;
 	switch (ctrl->type) {
-	case V4L2_CTRL_TYPE_BUTTON:
-		changed = true;
-		break;
 	case V4L2_CTRL_TYPE_STRING:
-		/* strings are always 0-terminated */
-		changed = strcmp(ctrl->string, ctrl->cur.string);
+		
 		strcpy(ctrl->cur.string, ctrl->string);
 		break;
 	case V4L2_CTRL_TYPE_INTEGER64:
-		changed = ctrl->val64 != ctrl->cur.val64;
 		ctrl->cur.val64 = ctrl->val64;
 		break;
 	default:
-		changed = ctrl->val != ctrl->cur.val;
 		ctrl->cur.val = ctrl->val;
 		break;
 	}
-	if (update_inactive) {
-		/* Note: update_inactive can only be true for auto clusters. */
-		ctrl->flags &=
-			~(V4L2_CTRL_FLAG_INACTIVE | V4L2_CTRL_FLAG_VOLATILE);
-		if (!is_cur_manual(ctrl->cluster[0])) {
-			ctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
-			if (ctrl->cluster[0]->has_volatiles)
-				ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
-		}
-		fh = NULL;
-	}
-	if (changed || update_inactive) {
-		/* If a control was changed that was not one of the controls
-		   modified by the application, then send the event to all. */
-		if (!ctrl->is_new)
-			fh = NULL;
-		send_event(fh, ctrl,
-			(changed ? V4L2_EVENT_CTRL_CH_VALUE : 0) |
-			(update_inactive ? V4L2_EVENT_CTRL_CH_FLAGS : 0));
-	}
 }
 
-/* Copy the current value to the new value */
 static void cur_to_new(struct v4l2_ctrl *ctrl)
 {
 	if (ctrl == NULL)
 		return;
 	switch (ctrl->type) {
 	case V4L2_CTRL_TYPE_STRING:
-		/* strings are always 0-terminated */
+		
 		strcpy(ctrl->string, ctrl->cur.string);
 		break;
 	case V4L2_CTRL_TYPE_INTEGER64:
@@ -1051,8 +645,6 @@
 	}
 }
 
-/* Return non-zero if one or more of the controls in the cluster has a new
-   value that differs from the current value. */
 static int cluster_changed(struct v4l2_ctrl *master)
 {
 	int diff = 0;
@@ -1065,10 +657,10 @@
 			continue;
 		switch (ctrl->type) {
 		case V4L2_CTRL_TYPE_BUTTON:
-			/* Button controls are always 'different' */
+			
 			return 1;
 		case V4L2_CTRL_TYPE_STRING:
-			/* strings are always 0-terminated */
+			
 			diff = strcmp(ctrl->string, ctrl->cur.string);
 			break;
 		case V4L2_CTRL_TYPE_INTEGER64:
@@ -1082,15 +674,16 @@
 	return diff;
 }
 
-/* Validate integer-type control */
-static int validate_new_int(const struct v4l2_ctrl *ctrl, s32 *pval)
+static int validate_new(struct v4l2_ctrl *ctrl)
 {
-	s32 val = *pval;
+	s32 val = ctrl->val;
+	char *s = ctrl->string;
 	u32 offset;
+	size_t len;
 
 	switch (ctrl->type) {
 	case V4L2_CTRL_TYPE_INTEGER:
-		/* Round towards the closest legal value */
+		
 		val += ctrl->step / 2;
 		if (val < ctrl->minimum)
 			val = ctrl->minimum;
@@ -1099,11 +692,11 @@
 		offset = val - ctrl->minimum;
 		offset = ctrl->step * (offset / ctrl->step);
 		val = ctrl->minimum + offset;
-		*pval = val;
+		ctrl->val = val;
 		return 0;
 
 	case V4L2_CTRL_TYPE_BOOLEAN:
-		*pval = !!val;
+		ctrl->val = !!ctrl->val;
 		return 0;
 
 	case V4L2_CTRL_TYPE_MENU:
@@ -1114,35 +707,11 @@
 			return -EINVAL;
 		return 0;
 
-	case V4L2_CTRL_TYPE_BITMASK:
-		*pval &= ctrl->maximum;
-		return 0;
-
 	case V4L2_CTRL_TYPE_BUTTON:
 	case V4L2_CTRL_TYPE_CTRL_CLASS:
-		*pval = 0;
+		ctrl->val64 = 0;
 		return 0;
 
-	default:
-		return -EINVAL;
-	}
-}
-
-/* Validate a new control */
-static int validate_new(const struct v4l2_ctrl *ctrl, struct v4l2_ext_control *c)
-{
-	char *s = c->string;
-	size_t len;
-
-	switch (ctrl->type) {
-	case V4L2_CTRL_TYPE_INTEGER:
-	case V4L2_CTRL_TYPE_BOOLEAN:
-	case V4L2_CTRL_TYPE_MENU:
-	case V4L2_CTRL_TYPE_BITMASK:
-	case V4L2_CTRL_TYPE_BUTTON:
-	case V4L2_CTRL_TYPE_CTRL_CLASS:
-		return validate_new_int(ctrl, &c->value);
-
 	case V4L2_CTRL_TYPE_INTEGER64:
 		return 0;
 
@@ -1164,7 +733,6 @@
 	return list_entry(node, struct v4l2_ctrl_ref, node)->ctrl->id;
 }
 
-/* Set the handler's error code if it wasn't set earlier already */
 static inline int handler_set_err(struct v4l2_ctrl_handler *hdl, int err)
 {
 	if (hdl->error == 0)
@@ -1172,7 +740,6 @@
 	return err;
 }
 
-/* Initialize the handler */
 int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl,
 			   unsigned nr_of_controls_hint)
 {
@@ -1180,34 +747,30 @@
 	INIT_LIST_HEAD(&hdl->ctrls);
 	INIT_LIST_HEAD(&hdl->ctrl_refs);
 	hdl->nr_of_buckets = 1 + nr_of_controls_hint / 8;
-	hdl->buckets = kcalloc(hdl->nr_of_buckets, sizeof(hdl->buckets[0]),
-			       GFP_KERNEL);
+	hdl->buckets = kzalloc(sizeof(hdl->buckets[0]) * hdl->nr_of_buckets,
+								GFP_KERNEL);
 	hdl->error = hdl->buckets ? 0 : -ENOMEM;
 	return hdl->error;
 }
 EXPORT_SYMBOL(v4l2_ctrl_handler_init);
 
-/* Free all controls and control refs */
 void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl)
 {
 	struct v4l2_ctrl_ref *ref, *next_ref;
 	struct v4l2_ctrl *ctrl, *next_ctrl;
-	struct v4l2_subscribed_event *sev, *next_sev;
 
 	if (hdl == NULL || hdl->buckets == NULL)
 		return;
 
 	mutex_lock(&hdl->lock);
-	/* Free all nodes */
+	
 	list_for_each_entry_safe(ref, next_ref, &hdl->ctrl_refs, node) {
 		list_del(&ref->node);
 		kfree(ref);
 	}
-	/* Free all controls owned by the handler */
+	
 	list_for_each_entry_safe(ctrl, next_ctrl, &hdl->ctrls, node) {
 		list_del(&ctrl->node);
-		list_for_each_entry_safe(sev, next_sev, &ctrl->ev_subs, node)
-			list_del(&sev->node);
 		kfree(ctrl);
 	}
 	kfree(hdl->buckets);
@@ -1218,12 +781,6 @@
 }
 EXPORT_SYMBOL(v4l2_ctrl_handler_free);
 
-/* For backwards compatibility: V4L2_CID_PRIVATE_BASE should no longer
-   be used except in G_CTRL, S_CTRL, QUERYCTRL and QUERYMENU when dealing
-   with applications that do not use the NEXT_CTRL flag.
-
-   We just find the n-th private user control. It's O(N), but that should not
-   be an issue in this particular case. */
 static struct v4l2_ctrl_ref *find_private_ref(
 		struct v4l2_ctrl_handler *hdl, u32 id)
 {
@@ -1231,8 +788,6 @@
 
 	id -= V4L2_CID_PRIVATE_BASE;
 	list_for_each_entry(ref, &hdl->ctrl_refs, node) {
-		/* Search for private user controls that are compatible with
-		   VIDIOC_G/S_CTRL. */
 		if (V4L2_CTRL_ID2CLASS(ref->ctrl->id) == V4L2_CTRL_CLASS_USER &&
 		    V4L2_CTRL_DRIVER_PRIV(ref->ctrl->id)) {
 			if (!type_is_int(ref->ctrl))
@@ -1245,7 +800,6 @@
 	return NULL;
 }
 
-/* Find a control with the given ID. */
 static struct v4l2_ctrl_ref *find_ref(struct v4l2_ctrl_handler *hdl, u32 id)
 {
 	struct v4l2_ctrl_ref *ref;
@@ -1253,26 +807,25 @@
 
 	id &= V4L2_CTRL_ID_MASK;
 
-	/* Old-style private controls need special handling */
+	
 	if (id >= V4L2_CID_PRIVATE_BASE)
 		return find_private_ref(hdl, id);
 	bucket = id % hdl->nr_of_buckets;
 
-	/* Simple optimization: cache the last control found */
+	
 	if (hdl->cached && hdl->cached->ctrl->id == id)
 		return hdl->cached;
 
-	/* Not in cache, search the hash */
+	
 	ref = hdl->buckets ? hdl->buckets[bucket] : NULL;
 	while (ref && ref->ctrl->id != id)
 		ref = ref->next;
 
 	if (ref)
-		hdl->cached = ref; /* cache it! */
+		hdl->cached = ref; 
 	return ref;
 }
 
-/* Find a control with the given ID. Take the handler's lock first. */
 static struct v4l2_ctrl_ref *find_ref_lock(
 		struct v4l2_ctrl_handler *hdl, u32 id)
 {
@@ -1286,7 +839,6 @@
 	return ref;
 }
 
-/* Find a control with the given ID. */
 struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id)
 {
 	struct v4l2_ctrl_ref *ref = find_ref_lock(hdl, id);
@@ -1295,7 +847,6 @@
 }
 EXPORT_SYMBOL(v4l2_ctrl_find);
 
-/* Allocate a new v4l2_ctrl_ref and hook it into the handler. */
 static int handler_new_ref(struct v4l2_ctrl_handler *hdl,
 			   struct v4l2_ctrl *ctrl)
 {
@@ -1303,9 +854,9 @@
 	struct v4l2_ctrl_ref *new_ref;
 	u32 id = ctrl->id;
 	u32 class_ctrl = V4L2_CTRL_ID2CLASS(id) | 1;
-	int bucket = id % hdl->nr_of_buckets;	/* which bucket to use */
+	int bucket = id % hdl->nr_of_buckets;	
 
-	/* Automatically add the control class if it is not yet present. */
+	
 	if (id != class_ctrl && find_ref_lock(hdl, class_ctrl) == NULL)
 		if (!v4l2_ctrl_new_std(hdl, NULL, class_ctrl, 0, 0, 0, 0))
 			return hdl->error;
@@ -1318,10 +869,6 @@
 		return handler_set_err(hdl, -ENOMEM);
 	new_ref->ctrl = ctrl;
 	if (ctrl->handler == hdl) {
-		/* By default each control starts in a cluster of its own.
-		   new_ref->ctrl is basically a cluster array with one
-		   element, so that's perfect to use as the cluster pointer.
-		   But only do this for the handler that owns the control. */
 		ctrl->cluster = &new_ref->ctrl;
 		ctrl->ncontrols = 1;
 	}
@@ -1330,20 +877,16 @@
 
 	mutex_lock(&hdl->lock);
 
-	/* Add immediately at the end of the list if the list is empty, or if
-	   the last element in the list has a lower ID.
-	   This ensures that when elements are added in ascending order the
-	   insertion is an O(1) operation. */
 	if (list_empty(&hdl->ctrl_refs) || id > node2id(hdl->ctrl_refs.prev)) {
 		list_add_tail(&new_ref->node, &hdl->ctrl_refs);
 		goto insert_in_hash;
 	}
 
-	/* Find insert position in sorted list */
+	
 	list_for_each_entry(ref, &hdl->ctrl_refs, node) {
 		if (ref->ctrl->id < id)
 			continue;
-		/* Don't add duplicates */
+		
 		if (ref->ctrl->id == id) {
 			kfree(new_ref);
 			goto unlock;
@@ -1353,7 +896,7 @@
 	}
 
 insert_in_hash:
-	/* Insert the control node in the hash */
+	
 	new_ref->next = hdl->buckets[bucket];
 	hdl->buckets[bucket] = new_ref;
 
@@ -1362,7 +905,6 @@
 	return 0;
 }
 
-/* Add a new control */
 static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
 			const struct v4l2_ctrl_ops *ops,
 			u32 id, const char *name, enum v4l2_ctrl_type type,
@@ -1375,19 +917,15 @@
 	if (hdl->error)
 		return NULL;
 
-	/* Sanity checks */
+	
 	if (id == 0 || name == NULL || id >= V4L2_CID_PRIVATE_BASE ||
+	    max < min ||
 	    (type == V4L2_CTRL_TYPE_INTEGER && step == 0) ||
-	    (type == V4L2_CTRL_TYPE_BITMASK && max == 0) ||
 	    (type == V4L2_CTRL_TYPE_MENU && qmenu == NULL) ||
 	    (type == V4L2_CTRL_TYPE_STRING && max == 0)) {
 		handler_set_err(hdl, -ERANGE);
 		return NULL;
 	}
-	if (type != V4L2_CTRL_TYPE_BITMASK && max < min) {
-		handler_set_err(hdl, -ERANGE);
-		return NULL;
-	}
 	if ((type == V4L2_CTRL_TYPE_INTEGER ||
 	     type == V4L2_CTRL_TYPE_MENU ||
 	     type == V4L2_CTRL_TYPE_BOOLEAN) &&
@@ -1395,10 +933,6 @@
 		handler_set_err(hdl, -ERANGE);
 		return NULL;
 	}
-	if (type == V4L2_CTRL_TYPE_BITMASK && ((def & ~max) || min || step)) {
-		handler_set_err(hdl, -ERANGE);
-		return NULL;
-	}
 
 	if (type == V4L2_CTRL_TYPE_BUTTON)
 		flags |= V4L2_CTRL_FLAG_WRITE_ONLY;
@@ -1414,7 +948,6 @@
 	}
 
 	INIT_LIST_HEAD(&ctrl->node);
-	INIT_LIST_HEAD(&ctrl->ev_subs);
 	ctrl->handler = hdl;
 	ctrl->ops = ops;
 	ctrl->id = id;
@@ -1474,13 +1007,14 @@
 			type, min, max,
 			is_menu ? cfg->menu_skip_mask : step,
 			def, flags, qmenu, priv);
-	if (ctrl)
+	if (ctrl) {
 		ctrl->is_private = cfg->is_private;
+		ctrl->is_volatile = cfg->is_volatile;
+	}
 	return ctrl;
 }
 EXPORT_SYMBOL(v4l2_ctrl_new_custom);
 
-/* Helper function for standard non-menu controls */
 struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
 			const struct v4l2_ctrl_ops *ops,
 			u32 id, s32 min, s32 max, u32 step, s32 def)
@@ -1499,7 +1033,6 @@
 }
 EXPORT_SYMBOL(v4l2_ctrl_new_std);
 
-/* Helper function for standard menu controls */
 struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
 			const struct v4l2_ctrl_ops *ops,
 			u32 id, s32 max, s32 mask, s32 def)
@@ -1521,7 +1054,6 @@
 }
 EXPORT_SYMBOL(v4l2_ctrl_new_std_menu);
 
-/* Add a control from another handler to this handler */
 struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl,
 					  struct v4l2_ctrl *ctrl)
 {
@@ -1537,28 +1069,22 @@
 }
 EXPORT_SYMBOL(v4l2_ctrl_add_ctrl);
 
-/* Add the controls from another handler to our own. */
 int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
 			  struct v4l2_ctrl_handler *add)
 {
-	struct v4l2_ctrl_ref *ref;
+	struct v4l2_ctrl *ctrl;
 	int ret = 0;
 
-	/* Do nothing if either handler is NULL or if they are the same */
+	
 	if (!hdl || !add || hdl == add)
 		return 0;
 	if (hdl->error)
 		return hdl->error;
 	mutex_lock(&add->lock);
-	list_for_each_entry(ref, &add->ctrl_refs, node) {
-		struct v4l2_ctrl *ctrl = ref->ctrl;
-
-		/* Skip handler-private controls. */
+	list_for_each_entry(ctrl, &add->ctrls, node) {
+		
 		if (ctrl->is_private)
 			continue;
-		/* And control classes */
-		if (ctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS)
-			continue;
 		ret = handler_new_ref(hdl, ctrl);
 		if (ret)
 			break;
@@ -1568,104 +1094,56 @@
 }
 EXPORT_SYMBOL(v4l2_ctrl_add_handler);
 
-/* Cluster controls */
 void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls)
 {
-	bool has_volatiles = false;
 	int i;
 
-	/* The first control is the master control and it must not be NULL */
-	BUG_ON(ncontrols == 0 || controls[0] == NULL);
+	
+	BUG_ON(controls[0] == NULL);
 
 	for (i = 0; i < ncontrols; i++) {
 		if (controls[i]) {
 			controls[i]->cluster = controls;
 			controls[i]->ncontrols = ncontrols;
-			if (controls[i]->flags & V4L2_CTRL_FLAG_VOLATILE)
-				has_volatiles = true;
 		}
 	}
-	controls[0]->has_volatiles = has_volatiles;
 }
 EXPORT_SYMBOL(v4l2_ctrl_cluster);
 
-void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls,
-			    u8 manual_val, bool set_volatile)
-{
-	struct v4l2_ctrl *master = controls[0];
-	u32 flag = 0;
-	int i;
-
-	v4l2_ctrl_cluster(ncontrols, controls);
-	WARN_ON(ncontrols <= 1);
-	WARN_ON(manual_val < master->minimum || manual_val > master->maximum);
-	WARN_ON(set_volatile && !has_op(master, g_volatile_ctrl));
-	master->is_auto = true;
-	master->has_volatiles = set_volatile;
-	master->manual_mode_value = manual_val;
-	master->flags |= V4L2_CTRL_FLAG_UPDATE;
-
-	if (!is_cur_manual(master))
-		flag = V4L2_CTRL_FLAG_INACTIVE |
-			(set_volatile ? V4L2_CTRL_FLAG_VOLATILE : 0);
-
-	for (i = 1; i < ncontrols; i++)
-		if (controls[i])
-			controls[i]->flags |= flag;
-}
-EXPORT_SYMBOL(v4l2_ctrl_auto_cluster);
-
-/* Activate/deactivate a control. */
 void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active)
 {
-	/* invert since the actual flag is called 'inactive' */
-	bool inactive = !active;
-	bool old;
-
 	if (ctrl == NULL)
 		return;
 
-	if (inactive)
-		/* set V4L2_CTRL_FLAG_INACTIVE */
-		old = test_and_set_bit(4, &ctrl->flags);
+	if (!active)
+		
+		set_bit(4, &ctrl->flags);
 	else
-		/* clear V4L2_CTRL_FLAG_INACTIVE */
-		old = test_and_clear_bit(4, &ctrl->flags);
-	if (old != inactive)
-		send_event(NULL, ctrl, V4L2_EVENT_CTRL_CH_FLAGS);
+		
+		clear_bit(4, &ctrl->flags);
 }
 EXPORT_SYMBOL(v4l2_ctrl_activate);
 
-/* Grab/ungrab a control.
-   Typically used when streaming starts and you want to grab controls,
-   preventing the user from changing them.
-
-   Just call this and the framework will block any attempts to change
-   these controls. */
 void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed)
 {
-	bool old;
-
 	if (ctrl == NULL)
 		return;
 
-	v4l2_ctrl_lock(ctrl);
 	if (grabbed)
-		/* set V4L2_CTRL_FLAG_GRABBED */
-		old = test_and_set_bit(1, &ctrl->flags);
+		
+		set_bit(1, &ctrl->flags);
 	else
-		/* clear V4L2_CTRL_FLAG_GRABBED */
-		old = test_and_clear_bit(1, &ctrl->flags);
-	if (old != grabbed)
-		send_event(NULL, ctrl, V4L2_EVENT_CTRL_CH_FLAGS);
-	v4l2_ctrl_unlock(ctrl);
+		
+		clear_bit(1, &ctrl->flags);
 }
 EXPORT_SYMBOL(v4l2_ctrl_grab);
 
-/* Log the control name and value */
 static void log_ctrl(const struct v4l2_ctrl *ctrl,
 		     const char *prefix, const char *colon)
 {
+	int fl_inact = ctrl->flags & V4L2_CTRL_FLAG_INACTIVE;
+	int fl_grabbed = ctrl->flags & V4L2_CTRL_FLAG_GRABBED;
+
 	if (ctrl->flags & (V4L2_CTRL_FLAG_DISABLED | V4L2_CTRL_FLAG_WRITE_ONLY))
 		return;
 	if (ctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS)
@@ -1683,9 +1161,6 @@
 	case V4L2_CTRL_TYPE_MENU:
 		printk(KERN_CONT "%s", ctrl->qmenu[ctrl->cur.val]);
 		break;
-	case V4L2_CTRL_TYPE_BITMASK:
-		printk(KERN_CONT "0x%08x", ctrl->cur.val);
-		break;
 	case V4L2_CTRL_TYPE_INTEGER64:
 		printk(KERN_CONT "%lld", ctrl->cur.val64);
 		break;
@@ -1696,20 +1171,16 @@
 		printk(KERN_CONT "unknown type %d", ctrl->type);
 		break;
 	}
-	if (ctrl->flags & (V4L2_CTRL_FLAG_INACTIVE |
-			   V4L2_CTRL_FLAG_GRABBED |
-			   V4L2_CTRL_FLAG_VOLATILE)) {
-		if (ctrl->flags & V4L2_CTRL_FLAG_INACTIVE)
-			printk(KERN_CONT " inactive");
-		if (ctrl->flags & V4L2_CTRL_FLAG_GRABBED)
-			printk(KERN_CONT " grabbed");
-		if (ctrl->flags & V4L2_CTRL_FLAG_VOLATILE)
-			printk(KERN_CONT " volatile");
-	}
-	printk(KERN_CONT "\n");
+	if (fl_inact && fl_grabbed)
+		printk(KERN_CONT " (inactive, grabbed)\n");
+	else if (fl_inact)
+		printk(KERN_CONT " (inactive)\n");
+	else if (fl_grabbed)
+		printk(KERN_CONT " (grabbed)\n");
+	else
+		printk(KERN_CONT "\n");
 }
 
-/* Log all controls owned by the handler */
 void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
 				  const char *prefix)
 {
@@ -1732,7 +1203,6 @@
 }
 EXPORT_SYMBOL(v4l2_ctrl_handler_log_status);
 
-/* Call s_ctrl for all controls owned by the handler */
 int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl)
 {
 	struct v4l2_ctrl *ctrl;
@@ -1748,29 +1218,33 @@
 		struct v4l2_ctrl *master = ctrl->cluster[0];
 		int i;
 
-		/* Skip if this control was already handled by a cluster. */
-		/* Skip button controls and read-only controls. */
-		if (ctrl->done || ctrl->type == V4L2_CTRL_TYPE_BUTTON ||
-		    (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY))
+		
+		if (ctrl->done)
 			continue;
 
 		for (i = 0; i < master->ncontrols; i++) {
 			if (master->cluster[i]) {
 				cur_to_new(master->cluster[i]);
 				master->cluster[i]->is_new = 1;
-				master->cluster[i]->done = true;
 			}
 		}
-		ret = call_op(master, s_ctrl);
+
+		
+		if (ctrl->type == V4L2_CTRL_TYPE_BUTTON ||
+		    (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY))
+			continue;
+		ret = master->ops->s_ctrl(master);
 		if (ret)
 			break;
+		for (i = 0; i < master->ncontrols; i++)
+			if (master->cluster[i])
+				master->cluster[i]->done = true;
 	}
 	mutex_unlock(&hdl->lock);
 	return ret;
 }
 EXPORT_SYMBOL(v4l2_ctrl_handler_setup);
 
-/* Implement VIDIOC_QUERYCTRL */
 int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc)
 {
 	u32 id = qc->id & V4L2_CTRL_ID_MASK;
@@ -1782,24 +1256,18 @@
 
 	mutex_lock(&hdl->lock);
 
-	/* Try to find it */
+	
 	ref = find_ref(hdl, id);
 
 	if ((qc->id & V4L2_CTRL_FLAG_NEXT_CTRL) && !list_empty(&hdl->ctrl_refs)) {
-		/* Find the next control with ID > qc->id */
+		
 
-		/* Did we reach the end of the control list? */
+		
 		if (id >= node2id(hdl->ctrl_refs.prev)) {
-			ref = NULL; /* Yes, so there is no next control */
+			ref = NULL; 
 		} else if (ref) {
-			/* We found a control with the given ID, so just get
-			   the next one in the list. */
 			ref = list_entry(ref->node.next, typeof(*ref), node);
 		} else {
-			/* No control with the given ID exists, so start
-			   searching for the next largest ID. We know there
-			   is one, otherwise the first 'if' above would have
-			   been true. */
 			list_for_each_entry(ref, &hdl->ctrl_refs, node)
 				if (id < ref->ctrl->id)
 					break;
@@ -1837,7 +1305,6 @@
 }
 EXPORT_SYMBOL(v4l2_subdev_queryctrl);
 
-/* Implement VIDIOC_QUERYMENU */
 int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm)
 {
 	struct v4l2_ctrl *ctrl;
@@ -1848,14 +1315,14 @@
 		return -EINVAL;
 
 	qm->reserved = 0;
-	/* Sanity checks */
+	
 	if (ctrl->qmenu == NULL ||
 	    i < ctrl->minimum || i > ctrl->maximum)
 		return -EINVAL;
-	/* Use mask to see if this menu item should be skipped */
+	
 	if (ctrl->menu_skip_mask & (1 << i))
 		return -EINVAL;
-	/* Empty menu items should also be skipped */
+	
 	if (ctrl->qmenu[i] == NULL || ctrl->qmenu[i][0] == '\0')
 		return -EINVAL;
 	strlcpy(qm->name, ctrl->qmenu[i], sizeof(qm->name));
@@ -1871,128 +1338,74 @@
 
 
 
-/* Some general notes on the atomic requirements of VIDIOC_G/TRY/S_EXT_CTRLS:
 
-   It is not a fully atomic operation, just best-effort only. After all, if
-   multiple controls have to be set through multiple i2c writes (for example)
-   then some initial writes may succeed while others fail. Thus leaving the
-   system in an inconsistent state. The question is how much effort you are
-   willing to spend on trying to make something atomic that really isn't.
-
-   From the point of view of an application the main requirement is that
-   when you call VIDIOC_S_EXT_CTRLS and some values are invalid then an
-   error should be returned without actually affecting any controls.
-
-   If all the values are correct, then it is acceptable to just give up
-   in case of low-level errors.
-
-   It is important though that the application can tell when only a partial
-   configuration was done. The way we do that is through the error_idx field
-   of struct v4l2_ext_controls: if that is equal to the count field then no
-   controls were affected. Otherwise all controls before that index were
-   successful in performing their 'get' or 'set' operation, the control at
-   the given index failed, and you don't know what happened with the controls
-   after the failed one. Since if they were part of a control cluster they
-   could have been successfully processed (if a cluster member was encountered
-   at index < error_idx), they could have failed (if a cluster member was at
-   error_idx), or they may not have been processed yet (if the first cluster
-   member appeared after error_idx).
-
-   It is all fairly theoretical, though. In practice all you can do is to
-   bail out. If error_idx == count, then it is an application bug. If
-   error_idx < count then it is only an application bug if the error code was
-   EBUSY. That usually means that something started streaming just when you
-   tried to set the controls. In all other cases it is a driver/hardware
-   problem and all you can do is to retry or bail out.
-
-   Note that these rules do not apply to VIDIOC_TRY_EXT_CTRLS: since that
-   never modifies controls the error_idx is just set to whatever control
-   has an invalid value.
- */
-
-/* Prepare for the extended g/s/try functions.
-   Find the controls in the control array and do some basic checks. */
 static int prepare_ext_ctrls(struct v4l2_ctrl_handler *hdl,
 			     struct v4l2_ext_controls *cs,
-			     struct v4l2_ctrl_helper *helpers)
+			     struct ctrl_helper *helpers,
+			     bool try)
 {
-	struct v4l2_ctrl_helper *h;
-	bool have_clusters = false;
 	u32 i;
 
-	for (i = 0, h = helpers; i < cs->count; i++, h++) {
+	for (i = 0; i < cs->count; i++) {
 		struct v4l2_ext_control *c = &cs->controls[i];
-		struct v4l2_ctrl_ref *ref;
 		struct v4l2_ctrl *ctrl;
 		u32 id = c->id & V4L2_CTRL_ID_MASK;
 
-		cs->error_idx = i;
+		if (try)
+			cs->error_idx = i;
 
 		if (cs->ctrl_class && V4L2_CTRL_ID2CLASS(id) != cs->ctrl_class)
 			return -EINVAL;
 
-		/* Old-style private controls are not allowed for
-		   extended controls */
 		if (id >= V4L2_CID_PRIVATE_BASE)
 			return -EINVAL;
-		ref = find_ref_lock(hdl, id);
-		if (ref == NULL)
+		ctrl = v4l2_ctrl_find(hdl, id);
+		if (ctrl == NULL)
 			return -EINVAL;
-		ctrl = ref->ctrl;
 		if (ctrl->flags & V4L2_CTRL_FLAG_DISABLED)
 			return -EINVAL;
 
-		if (ctrl->cluster[0]->ncontrols > 1)
-			have_clusters = true;
-		if (ctrl->cluster[0] != ctrl)
-			ref = find_ref_lock(hdl, ctrl->cluster[0]->id);
-		/* Store the ref to the master control of the cluster */
-		h->mref = ref;
-		h->ctrl = ctrl;
-		/* Initially set next to 0, meaning that there is no other
-		   control in this helper array belonging to the same
-		   cluster */
-		h->next = 0;
+		helpers[i].ctrl = ctrl;
+		helpers[i].handled = false;
 	}
-
-	/* We are done if there were no controls that belong to a multi-
-	   control cluster. */
-	if (!have_clusters)
-		return 0;
-
-	/* The code below figures out in O(n) time which controls in the list
-	   belong to the same cluster. */
-
-	/* This has to be done with the handler lock taken. */
-	mutex_lock(&hdl->lock);
-
-	/* First zero the helper field in the master control references */
-	for (i = 0; i < cs->count; i++)
-		helpers[i].mref->helper = 0;
-	for (i = 0, h = helpers; i < cs->count; i++, h++) {
-		struct v4l2_ctrl_ref *mref = h->mref;
-
-		/* If the mref->helper is set, then it points to an earlier
-		   helper that belongs to the same cluster. */
-		if (mref->helper) {
-			/* Set the next field of mref->helper to the current
-			   index: this means that that earlier helper now
-			   points to the next helper in the same cluster. */
-			mref->helper->next = i;
-			/* mref should be set only for the first helper in the
-			   cluster, clear the others. */
-			h->mref = NULL;
-		}
-		/* Point the mref helper to the current helper struct. */
-		mref->helper = h;
-	}
-	mutex_unlock(&hdl->lock);
 	return 0;
 }
 
-/* Handles the corner case where cs->count == 0. It checks whether the
-   specified control class exists. If that class ID is 0, then it checks
-   whether there are any controls at all. */
+typedef int (*cluster_func)(struct v4l2_ext_control *c,
+			    struct v4l2_ctrl *ctrl);
+
+static int cluster_walk(unsigned from,
+			struct v4l2_ext_controls *cs,
+			struct ctrl_helper *helpers,
+			cluster_func f)
+{
+	struct v4l2_ctrl **cluster = helpers[from].ctrl->cluster;
+	int ret = 0;
+	int i;
+
+	
+	for (i = from; !ret && i < cs->count; i++) {
+		struct v4l2_ctrl *ctrl = helpers[i].ctrl;
+
+		if (!helpers[i].handled && ctrl->cluster == cluster)
+			ret = f(&cs->controls[i], ctrl);
+	}
+	return ret;
+}
+
+static void cluster_done(unsigned from,
+			 struct v4l2_ext_controls *cs,
+			 struct ctrl_helper *helpers)
+{
+	struct v4l2_ctrl **cluster = helpers[from].ctrl->cluster;
+	int i;
+
+	
+	for (i = from; i < cs->count; i++)
+		if (helpers[i].ctrl->cluster == cluster)
+			helpers[i].handled = true;
+}
+
 static int class_check(struct v4l2_ctrl_handler *hdl, u32 ctrl_class)
 {
 	if (ctrl_class == 0)
@@ -2002,13 +1415,12 @@
 
 
 
-/* Get extended controls. Allocates the helpers array if needed. */
 int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *cs)
 {
-	struct v4l2_ctrl_helper helper[4];
-	struct v4l2_ctrl_helper *helpers = helper;
+	struct ctrl_helper helper[4];
+	struct ctrl_helper *helpers = helper;
 	int ret;
-	int i, j;
+	int i;
 
 	cs->error_idx = cs->count;
 	cs->ctrl_class = V4L2_CTRL_ID2CLASS(cs->ctrl_class);
@@ -2025,47 +1437,30 @@
 			return -ENOMEM;
 	}
 
-	ret = prepare_ext_ctrls(hdl, cs, helpers);
-	cs->error_idx = cs->count;
+	ret = prepare_ext_ctrls(hdl, cs, helpers, false);
 
 	for (i = 0; !ret && i < cs->count; i++)
 		if (helpers[i].ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY)
 			ret = -EACCES;
 
 	for (i = 0; !ret && i < cs->count; i++) {
-		int (*ctrl_to_user)(struct v4l2_ext_control *c,
-				    struct v4l2_ctrl *ctrl) = cur_to_user;
-		struct v4l2_ctrl *master;
+		struct v4l2_ctrl *ctrl = helpers[i].ctrl;
+		struct v4l2_ctrl *master = ctrl->cluster[0];
 
-		if (helpers[i].mref == NULL)
+		if (helpers[i].handled)
 			continue;
 
-		master = helpers[i].mref->ctrl;
 		cs->error_idx = i;
 
 		v4l2_ctrl_lock(master);
-
-		/* g_volatile_ctrl will update the new control values */
-		if ((master->flags & V4L2_CTRL_FLAG_VOLATILE) ||
-			(master->has_volatiles && !is_cur_manual(master))) {
-			for (j = 0; j < master->ncontrols; j++)
-				cur_to_new(master->cluster[j]);
-			ret = call_op(master, g_volatile_ctrl);
-			ctrl_to_user = new_to_user;
-		}
-		/* If OK, then copy the current (for non-volatile controls)
-		   or the new (for volatile controls) control values to the
-		   caller */
-		if (!ret) {
-			u32 idx = i;
-
-			do {
-				ret = ctrl_to_user(cs->controls + idx,
-						   helpers[idx].ctrl);
-				idx = helpers[idx].next;
-			} while (!ret && idx);
-		}
+		
+		if (ctrl->is_volatile && master->ops->g_volatile_ctrl)
+			ret = master->ops->g_volatile_ctrl(master);
+		
+		if (!ret)
+			ret = cluster_walk(i, cs, helpers, cur_to_user);
 		v4l2_ctrl_unlock(master);
+		cluster_done(i, cs, helpers);
 	}
 
 	if (cs->count > ARRAY_SIZE(helper))
@@ -2080,26 +1475,19 @@
 }
 EXPORT_SYMBOL(v4l2_subdev_g_ext_ctrls);
 
-/* Helper function to get a single control */
 static int get_ctrl(struct v4l2_ctrl *ctrl, s32 *val)
 {
 	struct v4l2_ctrl *master = ctrl->cluster[0];
 	int ret = 0;
-	int i;
 
 	if (ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY)
 		return -EACCES;
 
 	v4l2_ctrl_lock(master);
-	/* g_volatile_ctrl will update the current control values */
-	if (ctrl->flags & V4L2_CTRL_FLAG_VOLATILE) {
-		for (i = 0; i < master->ncontrols; i++)
-			cur_to_new(master->cluster[i]);
-		ret = call_op(master, g_volatile_ctrl);
-		*val = ctrl->val;
-	} else {
-		*val = ctrl->cur.val;
-	}
+	
+	if (ctrl->is_volatile && master->ops->g_volatile_ctrl)
+		ret = master->ops->g_volatile_ctrl(master);
+	*val = ctrl->cur.val;
 	v4l2_ctrl_unlock(master);
 	return ret;
 }
@@ -2124,7 +1512,7 @@
 {
 	s32 val = 0;
 
-	/* It's a driver bug if this happens. */
+	
 	WARN_ON(!type_is_int(ctrl));
 	get_ctrl(ctrl, &val);
 	return val;
@@ -2132,105 +1520,105 @@
 EXPORT_SYMBOL(v4l2_ctrl_g_ctrl);
 
 
-/* Core function that calls try/s_ctrl and ensures that the new value is
-   copied to the current value on a set.
-   Must be called with ctrl->handler->lock held. */
-static int try_or_set_cluster(struct v4l2_fh *fh,
-			      struct v4l2_ctrl *master, bool set)
+static int try_or_set_control_cluster(struct v4l2_ctrl *master, bool set)
 {
-	bool update_flag;
-	int ret;
+	bool try = !set;
+	int ret = 0;
 	int i;
 
-	/* Go through the cluster and either validate the new value or
-	   (if no new value was set), copy the current value to the new
-	   value, ensuring a consistent view for the control ops when
-	   called. */
-	for (i = 0; i < master->ncontrols; i++) {
+	for (i = 0; !ret && i < master->ncontrols; i++) {
 		struct v4l2_ctrl *ctrl = master->cluster[i];
 
 		if (ctrl == NULL)
 			continue;
 
-		if (!ctrl->is_new) {
-			cur_to_new(ctrl);
+		if (ctrl->is_new) {
+			if (set && (ctrl->flags & V4L2_CTRL_FLAG_GRABBED))
+				return -EBUSY;
+
+			
+			if (!set)
+				ret = validate_new(ctrl);
 			continue;
 		}
-		/* Check again: it may have changed since the
-		   previous check in try_or_set_ext_ctrls(). */
-		if (set && (ctrl->flags & V4L2_CTRL_FLAG_GRABBED))
-			return -EBUSY;
+		try = true;
+		cur_to_new(ctrl);
 	}
 
-	ret = call_op(master, try_ctrl);
+	if (!ret && master->ops->try_ctrl && try)
+		ret = master->ops->try_ctrl(master);
 
-	/* Don't set if there is no change */
-	if (ret || !set || !cluster_changed(master))
-		return ret;
-	ret = call_op(master, s_ctrl);
-	if (ret)
-		return ret;
-
-	/* If OK, then make the new values permanent. */
-	update_flag = is_cur_manual(master) != is_new_manual(master);
-	for (i = 0; i < master->ncontrols; i++)
-		new_to_cur(fh, master->cluster[i], update_flag && i > 0);
-	return 0;
+	
+	if (!ret && set && cluster_changed(master)) {
+		ret = master->ops->s_ctrl(master);
+		
+		if (!ret)
+			for (i = 0; i < master->ncontrols; i++)
+				new_to_cur(master->cluster[i]);
+	}
+	return ret;
 }
 
-/* Validate controls. */
-static int validate_ctrls(struct v4l2_ext_controls *cs,
-			  struct v4l2_ctrl_helper *helpers, bool set)
+static int try_or_set_ext_ctrls(struct v4l2_ctrl_handler *hdl,
+				struct v4l2_ext_controls *cs,
+				struct ctrl_helper *helpers,
+				bool set)
 {
-	unsigned i;
+	unsigned i, j;
 	int ret = 0;
 
 	cs->error_idx = cs->count;
 	for (i = 0; i < cs->count; i++) {
 		struct v4l2_ctrl *ctrl = helpers[i].ctrl;
 
-		cs->error_idx = i;
+		if (!set)
+			cs->error_idx = i;
 
 		if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
 			return -EACCES;
-		/* This test is also done in try_set_control_cluster() which
-		   is called in atomic context, so that has the final say,
-		   but it makes sense to do an up-front check as well. Once
-		   an error occurs in try_set_control_cluster() some other
-		   controls may have been set already and we want to do a
-		   best-effort to avoid that. */
 		if (set && (ctrl->flags & V4L2_CTRL_FLAG_GRABBED))
 			return -EBUSY;
-		ret = validate_new(ctrl, &cs->controls[i]);
-		if (ret)
-			return ret;
 	}
-	return 0;
+
+	for (i = 0; !ret && i < cs->count; i++) {
+		struct v4l2_ctrl *ctrl = helpers[i].ctrl;
+		struct v4l2_ctrl *master = ctrl->cluster[0];
+
+		cs->error_idx = i;
+
+		if (helpers[i].handled)
+			continue;
+
+		v4l2_ctrl_lock(ctrl);
+
+		
+		for (j = 0; j < master->ncontrols; j++)
+			if (master->cluster[j])
+				master->cluster[j]->is_new = 0;
+
+		ret = cluster_walk(i, cs, helpers, user_to_new);
+
+		if (!ret)
+			ret = try_or_set_control_cluster(master, set);
+
+		
+		if (!ret)
+			ret = cluster_walk(i, cs, helpers, new_to_user);
+
+		v4l2_ctrl_unlock(ctrl);
+		cluster_done(i, cs, helpers);
+	}
+	return ret;
 }
 
-/* Obtain the current volatile values of an autocluster and mark them
-   as new. */
-static void update_from_auto_cluster(struct v4l2_ctrl *master)
-{
-	int i;
-
-	for (i = 0; i < master->ncontrols; i++)
-		cur_to_new(master->cluster[i]);
-	if (!call_op(master, g_volatile_ctrl))
-		for (i = 1; i < master->ncontrols; i++)
-			if (master->cluster[i])
-				master->cluster[i]->is_new = 1;
-}
-
-/* Try or try-and-set controls */
-static int try_set_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
+static int try_set_ext_ctrls(struct v4l2_ctrl_handler *hdl,
 			     struct v4l2_ext_controls *cs,
 			     bool set)
 {
-	struct v4l2_ctrl_helper helper[4];
-	struct v4l2_ctrl_helper *helpers = helper;
-	unsigned i, j;
+	struct ctrl_helper helper[4];
+	struct ctrl_helper *helpers = helper;
 	int ret;
+	int i;
 
 	cs->error_idx = cs->count;
 	cs->ctrl_class = V4L2_CTRL_ID2CLASS(cs->ctrl_class);
@@ -2246,74 +1634,22 @@
 		if (!helpers)
 			return -ENOMEM;
 	}
-	ret = prepare_ext_ctrls(hdl, cs, helpers);
-	if (!ret)
-		ret = validate_ctrls(cs, helpers, set);
-	if (ret && set)
+	ret = prepare_ext_ctrls(hdl, cs, helpers, !set);
+	if (ret)
+		goto free;
+
+	
+	ret = try_or_set_ext_ctrls(hdl, cs, helpers, false);
+	if (set)
 		cs->error_idx = cs->count;
-	for (i = 0; !ret && i < cs->count; i++) {
-		struct v4l2_ctrl *master;
-		u32 idx = i;
-
-		if (helpers[i].mref == NULL)
-			continue;
-
-		cs->error_idx = i;
-		master = helpers[i].mref->ctrl;
-		v4l2_ctrl_lock(master);
-
-		/* Reset the 'is_new' flags of the cluster */
-		for (j = 0; j < master->ncontrols; j++)
-			if (master->cluster[j])
-				master->cluster[j]->is_new = 0;
-
-		/* For volatile autoclusters that are currently in auto mode
-		   we need to discover if it will be set to manual mode.
-		   If so, then we have to copy the current volatile values
-		   first since those will become the new manual values (which
-		   may be overwritten by explicit new values from this set
-		   of controls). */
-		if (master->is_auto && master->has_volatiles &&
-						!is_cur_manual(master)) {
-			/* Pick an initial non-manual value */
-			s32 new_auto_val = master->manual_mode_value + 1;
-			u32 tmp_idx = idx;
-
-			do {
-				/* Check if the auto control is part of the
-				   list, and remember the new value. */
-				if (helpers[tmp_idx].ctrl == master)
-					new_auto_val = cs->controls[tmp_idx].value;
-				tmp_idx = helpers[tmp_idx].next;
-			} while (tmp_idx);
-			/* If the new value == the manual value, then copy
-			   the current volatile values. */
-			if (new_auto_val == master->manual_mode_value)
-				update_from_auto_cluster(master);
-		}
-
-		/* Copy the new caller-supplied control values.
-		   user_to_new() sets 'is_new' to 1. */
-		do {
-			ret = user_to_new(cs->controls + idx, helpers[idx].ctrl);
-			idx = helpers[idx].next;
-		} while (!ret && idx);
-
-		if (!ret)
-			ret = try_or_set_cluster(fh, master, set);
-
-		/* Copy the new values back to userspace. */
-		if (!ret) {
-			idx = i;
-			do {
-				ret = new_to_user(cs->controls + idx,
-						helpers[idx].ctrl);
-				idx = helpers[idx].next;
-			} while (!ret && idx);
-		}
-		v4l2_ctrl_unlock(master);
+	if (!ret && set) {
+		
+		for (i = 0; i < cs->count; i++)
+			helpers[i].handled = false;
+		ret = try_or_set_ext_ctrls(hdl, cs, helpers, true);
 	}
 
+free:
 	if (cs->count > ARRAY_SIZE(helper))
 		kfree(helpers);
 	return ret;
@@ -2321,146 +1657,75 @@
 
 int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *cs)
 {
-	return try_set_ext_ctrls(NULL, hdl, cs, false);
+	return try_set_ext_ctrls(hdl, cs, false);
 }
 EXPORT_SYMBOL(v4l2_try_ext_ctrls);
 
-int v4l2_s_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
-					struct v4l2_ext_controls *cs)
+int v4l2_s_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *cs)
 {
-	return try_set_ext_ctrls(fh, hdl, cs, true);
+	return try_set_ext_ctrls(hdl, cs, true);
 }
 EXPORT_SYMBOL(v4l2_s_ext_ctrls);
 
 int v4l2_subdev_try_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs)
 {
-	return try_set_ext_ctrls(NULL, sd->ctrl_handler, cs, false);
+	return try_set_ext_ctrls(sd->ctrl_handler, cs, false);
 }
 EXPORT_SYMBOL(v4l2_subdev_try_ext_ctrls);
 
 int v4l2_subdev_s_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs)
 {
-	return try_set_ext_ctrls(NULL, sd->ctrl_handler, cs, true);
+	return try_set_ext_ctrls(sd->ctrl_handler, cs, true);
 }
 EXPORT_SYMBOL(v4l2_subdev_s_ext_ctrls);
 
-/* Helper function for VIDIOC_S_CTRL compatibility */
-static int set_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, s32 *val)
+static int set_ctrl(struct v4l2_ctrl *ctrl, s32 *val)
 {
 	struct v4l2_ctrl *master = ctrl->cluster[0];
 	int ret;
 	int i;
 
-	ret = validate_new_int(ctrl, val);
-	if (ret)
-		return ret;
+	if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
+		return -EACCES;
 
 	v4l2_ctrl_lock(ctrl);
 
-	/* Reset the 'is_new' flags of the cluster */
+	
 	for (i = 0; i < master->ncontrols; i++)
 		if (master->cluster[i])
 			master->cluster[i]->is_new = 0;
 
-	/* For autoclusters with volatiles that are switched from auto to
-	   manual mode we have to update the current volatile values since
-	   those will become the initial manual values after such a switch. */
-	if (master->is_auto && master->has_volatiles && ctrl == master &&
-	    !is_cur_manual(master) && *val == master->manual_mode_value)
-		update_from_auto_cluster(master);
 	ctrl->val = *val;
 	ctrl->is_new = 1;
-	ret = try_or_set_cluster(fh, master, true);
+	ret = try_or_set_control_cluster(master, false);
+	if (!ret)
+		ret = try_or_set_control_cluster(master, true);
 	*val = ctrl->cur.val;
 	v4l2_ctrl_unlock(ctrl);
 	return ret;
 }
 
-int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
-					struct v4l2_control *control)
+int v4l2_s_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *control)
 {
 	struct v4l2_ctrl *ctrl = v4l2_ctrl_find(hdl, control->id);
 
 	if (ctrl == NULL || !type_is_int(ctrl))
 		return -EINVAL;
 
-	if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
-		return -EACCES;
-
-	return set_ctrl(fh, ctrl, &control->value);
+	return set_ctrl(ctrl, &control->value);
 }
 EXPORT_SYMBOL(v4l2_s_ctrl);
 
 int v4l2_subdev_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *control)
 {
-	return v4l2_s_ctrl(NULL, sd->ctrl_handler, control);
+	return v4l2_s_ctrl(sd->ctrl_handler, control);
 }
 EXPORT_SYMBOL(v4l2_subdev_s_ctrl);
 
 int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
 {
-	/* It's a driver bug if this happens. */
+	
 	WARN_ON(!type_is_int(ctrl));
-	return set_ctrl(NULL, ctrl, &val);
+	return set_ctrl(ctrl, &val);
 }
 EXPORT_SYMBOL(v4l2_ctrl_s_ctrl);
-
-void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl,
-				struct v4l2_subscribed_event *sev)
-{
-	v4l2_ctrl_lock(ctrl);
-	list_add_tail(&sev->node, &ctrl->ev_subs);
-	if (ctrl->type != V4L2_CTRL_TYPE_CTRL_CLASS &&
-	    (sev->flags & V4L2_EVENT_SUB_FL_SEND_INITIAL)) {
-		struct v4l2_event ev;
-		u32 changes = V4L2_EVENT_CTRL_CH_FLAGS;
-
-		if (!(ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY))
-			changes |= V4L2_EVENT_CTRL_CH_VALUE;
-		fill_event(&ev, ctrl, changes);
-		v4l2_event_queue_fh(sev->fh, &ev);
-	}
-	v4l2_ctrl_unlock(ctrl);
-}
-EXPORT_SYMBOL(v4l2_ctrl_add_event);
-
-void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl,
-				struct v4l2_subscribed_event *sev)
-{
-	v4l2_ctrl_lock(ctrl);
-	list_del(&sev->node);
-	v4l2_ctrl_unlock(ctrl);
-}
-EXPORT_SYMBOL(v4l2_ctrl_del_event);
-
-int v4l2_ctrl_log_status(struct file *file, void *fh)
-{
-	struct video_device *vfd = video_devdata(file);
-	struct v4l2_fh *vfh = file->private_data;
-
-	if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) && vfd->v4l2_dev)
-		v4l2_ctrl_handler_log_status(vfh->ctrl_handler,
-			vfd->v4l2_dev->name);
-	return 0;
-}
-EXPORT_SYMBOL(v4l2_ctrl_log_status);
-
-int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
-				struct v4l2_event_subscription *sub)
-{
-	if (sub->type == V4L2_EVENT_CTRL)
-		return v4l2_event_subscribe(fh, sub, 0);
-	return -EINVAL;
-}
-EXPORT_SYMBOL(v4l2_ctrl_subscribe_event);
-
-unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait)
-{
-	struct v4l2_fh *fh = file->private_data;
-
-	if (v4l2_event_pending(fh))
-		return POLLPRI;
-	poll_wait(file, &fh->wait, wait);
-	return 0;
-}
-EXPORT_SYMBOL(v4l2_ctrl_poll);
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 70bec54..ba13a3e 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -26,6 +26,7 @@
 #include <linux/kmod.h>
 #include <linux/slab.h>
 #include <asm/uaccess.h>
+#include <asm/system.h>
 
 #include <media/v4l2-common.h>
 #include <media/v4l2-device.h>
@@ -34,9 +35,6 @@
 #define VIDEO_NUM_DEVICES	256
 #define VIDEO_NAME              "video4linux"
 
-/*
- *	sysfs stuff
- */
 
 static ssize_t show_index(struct device *cd,
 			 struct device_attribute *attr, char *buf)
@@ -60,50 +58,36 @@
 	__ATTR_NULL
 };
 
-/*
- *	Active devices
- */
 static struct video_device *video_device[VIDEO_NUM_DEVICES];
 static DEFINE_MUTEX(videodev_lock);
 static DECLARE_BITMAP(devnode_nums[VFL_TYPE_MAX], VIDEO_NUM_DEVICES);
 
-/* Device node utility functions */
 
-/* Note: these utility functions all assume that vfl_type is in the range
-   [0, VFL_TYPE_MAX-1]. */
 
 #ifdef CONFIG_VIDEO_FIXED_MINOR_RANGES
-/* Return the bitmap corresponding to vfl_type. */
 static inline unsigned long *devnode_bits(int vfl_type)
 {
-	/* Any types not assigned to fixed minor ranges must be mapped to
-	   one single bitmap for the purposes of finding a free node number
-	   since all those unassigned types use the same minor range. */
 	int idx = (vfl_type > VFL_TYPE_RADIO) ? VFL_TYPE_MAX - 1 : vfl_type;
 
 	return devnode_nums[idx];
 }
 #else
-/* Return the bitmap corresponding to vfl_type. */
 static inline unsigned long *devnode_bits(int vfl_type)
 {
 	return devnode_nums[vfl_type];
 }
 #endif
 
-/* Mark device node number vdev->num as used */
 static inline void devnode_set(struct video_device *vdev)
 {
 	set_bit(vdev->num, devnode_bits(vdev->vfl_type));
 }
 
-/* Mark device node number vdev->num as unused */
 static inline void devnode_clear(struct video_device *vdev)
 {
 	clear_bit(vdev->num, devnode_bits(vdev->vfl_type));
 }
 
-/* Try to find a free device node number in the range [from, to> */
 static inline int devnode_find(struct video_device *vdev, int from, int to)
 {
 	return find_next_zero_bit(devnode_bits(vdev->vfl_type), to, from);
@@ -123,8 +107,8 @@
 
 void video_device_release_empty(struct video_device *vdev)
 {
-	/* Do nothing */
-	/* Only valid when the video_device struct is a static. */
+	
+	
 }
 EXPORT_SYMBOL(video_device_release_empty);
 
@@ -138,55 +122,40 @@
 	put_device(&vdev->dev);
 }
 
-/* Called when the last user of the video device exits. */
 static void v4l2_device_release(struct device *cd)
 {
 	struct video_device *vdev = to_video_device(cd);
 	struct v4l2_device *v4l2_dev = vdev->v4l2_dev;
 
 	mutex_lock(&videodev_lock);
-	if (WARN_ON(video_device[vdev->minor] != vdev)) {
-		/* should not happen */
+	if (video_device[vdev->minor] != vdev) {
 		mutex_unlock(&videodev_lock);
+		
+		WARN_ON(1);
 		return;
 	}
 
-	/* Free up this device for reuse */
+	
 	video_device[vdev->minor] = NULL;
 
-	/* Delete the cdev on this minor as well */
+	
 	cdev_del(vdev->cdev);
-	/* Just in case some driver tries to access this from
-	   the release() callback. */
 	vdev->cdev = NULL;
 
-	/* Mark device node number as free */
+	
 	devnode_clear(vdev);
 
 	mutex_unlock(&videodev_lock);
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
-	if (v4l2_dev && v4l2_dev->mdev &&
+	if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
 	    vdev->vfl_type != VFL_TYPE_SUBDEV)
 		media_device_unregister_entity(&vdev->entity);
 #endif
 
-	/* Do not call v4l2_device_put if there is no release callback set.
-	 * Drivers that have no v4l2_device release callback might free the
-	 * v4l2_dev instance in the video_device release callback below, so we
-	 * must perform this check here.
-	 *
-	 * TODO: In the long run all drivers that use v4l2_device should use the
-	 * v4l2_device release callback. This check will then be unnecessary.
-	 */
-	if (v4l2_dev && v4l2_dev->release == NULL)
-		v4l2_dev = NULL;
-
-	/* Release video_device and perform other
-	   cleanups as needed. */
 	vdev->release(vdev);
 
-	/* Decrease v4l2_device refcount */
+	
 	if (v4l2_dev)
 		v4l2_device_put(v4l2_dev);
 }
@@ -198,12 +167,19 @@
 
 struct video_device *video_devdata(struct file *file)
 {
-	return video_device[iminor(file->f_path.dentry->d_inode)];
+    struct video_device *vdev = NULL;
+    int index;
+    
+	index = iminor(file->f_path.dentry->d_inode);
+	
+    if(index < VIDEO_NUM_DEVICES)
+		vdev = video_device[index];
+
+	return vdev;
 }
 EXPORT_SYMBOL(video_devdata);
 
 
-/* Priority handling */
 
 static inline bool prio_is_valid(enum v4l2_priority prio)
 {
@@ -329,28 +305,6 @@
 		if (vdev->lock)
 			mutex_unlock(vdev->lock);
 	} else if (vdev->fops->ioctl) {
-		/* This code path is a replacement for the BKL. It is a major
-		 * hack but it will have to do for those drivers that are not
-		 * yet converted to use unlocked_ioctl.
-		 *
-		 * There are two options: if the driver implements struct
-		 * v4l2_device, then the lock defined there is used to
-		 * serialize the ioctls. Otherwise the v4l2 core lock defined
-		 * below is used. This lock is really bad since it serializes
-		 * completely independent devices.
-		 *
-		 * Both variants suffer from the same problem: if the driver
-		 * sleeps, then it blocks all ioctls since the lock is still
-		 * held. This is very common for VIDIOC_DQBUF since that
-		 * normally waits for a frame to arrive. As a result any other
-		 * ioctl calls will proceed very, very slowly since each call
-		 * will have to wait for the VIDIOC_QBUF to finish. Things that
-		 * should take 0.01s may now take 10-20 seconds.
-		 *
-		 * The workaround is to *not* take the lock for VIDIOC_DQBUF.
-		 * This actually works OK for videobuf-based drivers, since
-		 * videobuf will take its own internal lock.
-		 */
 		static DEFINE_MUTEX(v4l2_ioctl_mutex);
 		struct mutex *m = vdev->v4l2_dev ?
 			&vdev->v4l2_dev->ioctl_lock : &v4l2_ioctl_mutex;
@@ -400,21 +354,20 @@
 	return ret;
 }
 
-/* Override for the open function */
 static int v4l2_open(struct inode *inode, struct file *filp)
 {
 	struct video_device *vdev;
 	int ret = 0;
 
-	/* Check if the video device is available */
+	
 	mutex_lock(&videodev_lock);
 	vdev = video_devdata(filp);
-	/* return ENODEV if the video device has already been removed. */
+	
 	if (vdev == NULL || !video_is_registered(vdev)) {
 		mutex_unlock(&videodev_lock);
 		return -ENODEV;
 	}
-	/* and increase the device refcount */
+	
 	video_get(vdev);
 	mutex_unlock(&videodev_lock);
 	if (vdev->fops->open) {
@@ -431,13 +384,12 @@
 	}
 
 err:
-	/* decrease the refcount in case of an error */
+	
 	if (ret)
 		video_put(vdev);
 	return ret;
 }
 
-/* Override for the release function */
 static int v4l2_release(struct inode *inode, struct file *filp)
 {
 	struct video_device *vdev = video_devdata(filp);
@@ -450,8 +402,6 @@
 		if (vdev->lock)
 			mutex_unlock(vdev->lock);
 	}
-	/* decrease the refcount unconditionally since the release()
-	   return value is ignored. */
 	video_put(vdev);
 	return ret;
 }
@@ -472,27 +422,12 @@
 	.llseek = no_llseek,
 };
 
-/**
- * get_index - assign stream index number based on parent device
- * @vdev: video_device to assign index number to, vdev->parent should be assigned
- *
- * Note that when this is called the new device has not yet been registered
- * in the video_device array, but it was able to obtain a minor number.
- *
- * This means that we can always obtain a free stream index number since
- * the worst case scenario is that there are VIDEO_NUM_DEVICES - 1 slots in
- * use of the video_device array.
- *
- * Returns a free index number.
- */
 static int get_index(struct video_device *vdev)
 {
-	/* This can be static since this function is called with the global
-	   videodev_lock held. */
 	static DECLARE_BITMAP(used, VIDEO_NUM_DEVICES);
 	int i;
 
-	/* Some drivers do not set the parent. In that case always return 0. */
+	
 	if (vdev->parent == NULL)
 		return 0;
 
@@ -508,38 +443,6 @@
 	return find_first_zero_bit(used, VIDEO_NUM_DEVICES);
 }
 
-/**
- *	__video_register_device - register video4linux devices
- *	@vdev: video device structure we want to register
- *	@type: type of device to register
- *	@nr:   which device node number (0 == /dev/video0, 1 == /dev/video1, ...
- *             -1 == first free)
- *	@warn_if_nr_in_use: warn if the desired device node number
- *	       was already in use and another number was chosen instead.
- *	@owner: module that owns the video device node
- *
- *	The registration code assigns minor numbers and device node numbers
- *	based on the requested type and registers the new device node with
- *	the kernel.
- *
- *	This function assumes that struct video_device was zeroed when it
- *	was allocated and does not contain any stale date.
- *
- *	An error is returned if no free minor or device node number could be
- *	found, or if the registration of the device node failed.
- *
- *	Zero is returned on success.
- *
- *	Valid types are
- *
- *	%VFL_TYPE_GRABBER - A frame grabber
- *
- *	%VFL_TYPE_VBI - Vertical blank data (undecoded)
- *
- *	%VFL_TYPE_RADIO - A radio card
- *
- *	%VFL_TYPE_SUBDEV - A subdevice
- */
 int __video_register_device(struct video_device *vdev, int type, int nr,
 		int warn_if_nr_in_use, struct module *owner)
 {
@@ -549,19 +452,18 @@
 	int minor_cnt = VIDEO_NUM_DEVICES;
 	const char *name_base;
 
-	/* A minor value of -1 marks this video device as never
-	   having been registered */
 	vdev->minor = -1;
 
-	/* the release callback MUST be present */
-	if (WARN_ON(!vdev->release))
+	
+	WARN_ON(!vdev->release);
+	if (!vdev->release)
 		return -EINVAL;
 
-	/* v4l2_fh support */
+	
 	spin_lock_init(&vdev->fh_lock);
 	INIT_LIST_HEAD(&vdev->fh_list);
 
-	/* Part 1: check device type */
+	
 	switch (type) {
 	case VFL_TYPE_GRABBER:
 		name_base = "video";
@@ -588,19 +490,12 @@
 			vdev->parent = vdev->v4l2_dev->dev;
 		if (vdev->ctrl_handler == NULL)
 			vdev->ctrl_handler = vdev->v4l2_dev->ctrl_handler;
-		/* If the prio state pointer is NULL, then use the v4l2_device
-		   prio state. */
 		if (vdev->prio == NULL)
 			vdev->prio = &vdev->v4l2_dev->prio;
 	}
 
-	/* Part 2: find a free minor, device node number and device index. */
+	
 #ifdef CONFIG_VIDEO_FIXED_MINOR_RANGES
-	/* Keep the ranges for the first four types for historical
-	 * reasons.
-	 * Newer devices (not yet in place) should use the range
-	 * of 128-191 and just pick the first free minor there
-	 * (new style). */
 	switch (type) {
 	case VFL_TYPE_GRABBER:
 		minor_offset = 0;
@@ -621,7 +516,7 @@
 	}
 #endif
 
-	/* Pick a device node number */
+	
 	mutex_lock(&videodev_lock);
 	nr = devnode_find(vdev, nr == -1 ? 0 : nr, minor_cnt);
 	if (nr == minor_cnt)
@@ -632,11 +527,9 @@
 		return -ENFILE;
 	}
 #ifdef CONFIG_VIDEO_FIXED_MINOR_RANGES
-	/* 1-on-1 mapping of device node number to minor number */
+	
 	i = nr;
 #else
-	/* The device node number and minor numbers are independent, so
-	   we just find the first free minor number. */
 	for (i = 0; i < VIDEO_NUM_DEVICES; i++)
 		if (video_device[i] == NULL)
 			break;
@@ -650,12 +543,12 @@
 	vdev->num = nr;
 	devnode_set(vdev);
 
-	/* Should not happen since we thought this minor was free */
+	
 	WARN_ON(video_device[vdev->minor] != NULL);
 	vdev->index = get_index(vdev);
 	mutex_unlock(&videodev_lock);
 
-	/* Part 3: Initialize the character device */
+	
 	vdev->cdev = cdev_alloc();
 	if (vdev->cdev == NULL) {
 		ret = -ENOMEM;
@@ -671,7 +564,7 @@
 		goto cleanup;
 	}
 
-	/* Part 4: register the device with sysfs */
+	
 	vdev->dev.class = &video_class;
 	vdev->dev.devt = MKDEV(VIDEO_MAJOR, vdev->minor);
 	if (vdev->parent)
@@ -682,26 +575,24 @@
 		printk(KERN_ERR "%s: device_register failed\n", __func__);
 		goto cleanup;
 	}
-	/* Register the release callback that will be called when the last
-	   reference to the device goes away. */
 	vdev->dev.release = v4l2_device_release;
 
 	if (nr != -1 && nr != vdev->num && warn_if_nr_in_use)
 		printk(KERN_WARNING "%s: requested %s%d, got %s\n", __func__,
 			name_base, nr, video_device_node_name(vdev));
 
-	/* Increase v4l2_device refcount */
+	
 	if (vdev->v4l2_dev)
 		v4l2_device_get(vdev->v4l2_dev);
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
-	/* Part 5: Register the entity. */
+	
 	if (vdev->v4l2_dev && vdev->v4l2_dev->mdev &&
 	    vdev->vfl_type != VFL_TYPE_SUBDEV) {
 		vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;
 		vdev->entity.name = vdev->name;
-		vdev->entity.info.v4l.major = VIDEO_MAJOR;
-		vdev->entity.info.v4l.minor = vdev->minor;
+		vdev->entity.v4l.major = VIDEO_MAJOR;
+		vdev->entity.v4l.minor = vdev->minor;
 		ret = media_device_register_entity(vdev->v4l2_dev->mdev,
 			&vdev->entity);
 		if (ret < 0)
@@ -710,7 +601,7 @@
 			       __func__);
 	}
 #endif
-	/* Part 6: Activate this minor. The char device can now be used. */
+	
 	set_bit(V4L2_FL_REGISTERED, &vdev->flags);
 	mutex_lock(&videodev_lock);
 	video_device[vdev->minor] = vdev;
@@ -724,38 +615,25 @@
 		cdev_del(vdev->cdev);
 	devnode_clear(vdev);
 	mutex_unlock(&videodev_lock);
-	/* Mark this video device as never having been registered. */
+	
 	vdev->minor = -1;
 	return ret;
 }
 EXPORT_SYMBOL(__video_register_device);
 
-/**
- *	video_unregister_device - unregister a video4linux device
- *	@vdev: the device to unregister
- *
- *	This unregisters the passed device. Future open calls will
- *	be met with errors.
- */
 void video_unregister_device(struct video_device *vdev)
 {
-	/* Check if vdev was ever registered at all */
+	
 	if (!vdev || !video_is_registered(vdev))
 		return;
 
 	mutex_lock(&videodev_lock);
-	/* This must be in a critical section to prevent a race with v4l2_open.
-	 * Once this bit has been cleared video_get may never be called again.
-	 */
 	clear_bit(V4L2_FL_REGISTERED, &vdev->flags);
 	mutex_unlock(&videodev_lock);
 	device_unregister(&vdev->dev);
 }
 EXPORT_SYMBOL(video_unregister_device);
 
-/*
- *	Initialise video for linux
- */
 static int __init videodev_init(void)
 {
 	dev_t dev = MKDEV(VIDEO_MAJOR, 0);
@@ -787,7 +665,7 @@
 	unregister_chrdev_region(dev, VIDEO_NUM_DEVICES);
 }
 
-subsys_initcall(videodev_init);
+module_init(videodev_init)
 module_exit(videodev_exit)
 
 MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>");
@@ -796,8 +674,3 @@
 MODULE_ALIAS_CHARDEV_MAJOR(VIDEO_MAJOR);
 
 
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- */
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c
index 1f203b8..5ae49af 100644
--- a/drivers/media/video/v4l2-device.c
+++ b/drivers/media/video/v4l2-device.c
@@ -18,11 +18,10 @@
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/module.h>
 #include <linux/types.h>
 #include <linux/ioctl.h>
-#include <linux/module.h>
 #include <linux/i2c.h>
-#include <linux/slab.h>
 #if defined(CONFIG_SPI)
 #include <linux/spi/spi.h>
 #endif
@@ -40,15 +39,14 @@
 	mutex_init(&v4l2_dev->ioctl_lock);
 	v4l2_prio_init(&v4l2_dev->prio);
 	kref_init(&v4l2_dev->ref);
-	get_device(dev);
 	v4l2_dev->dev = dev;
 	if (dev == NULL) {
-		/* If dev == NULL, then name must be filled in by the caller */
+		
 		WARN_ON(!v4l2_dev->name[0]);
 		return 0;
 	}
 
-	/* Set name to driver name + device name if it is empty. */
+	
 	if (!v4l2_dev->name[0])
 		snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s %s",
 			dev->driver->name, dev_name(dev));
@@ -96,7 +94,6 @@
 
 	if (dev_get_drvdata(v4l2_dev->dev) == v4l2_dev)
 		dev_set_drvdata(v4l2_dev->dev, NULL);
-	put_device(v4l2_dev->dev);
 	v4l2_dev->dev = NULL;
 }
 EXPORT_SYMBOL_GPL(v4l2_device_disconnect);
@@ -109,17 +106,13 @@
 		return;
 	v4l2_device_disconnect(v4l2_dev);
 
-	/* Unregister subdevs */
+	
 	list_for_each_entry_safe(sd, next, &v4l2_dev->subdevs, list) {
 		v4l2_device_unregister_subdev(sd);
 #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
 		if (sd->flags & V4L2_SUBDEV_FL_IS_I2C) {
 			struct i2c_client *client = v4l2_get_subdevdata(sd);
 
-			/* We need to unregister the i2c client explicitly.
-			   We cannot rely on i2c_del_adapter to always
-			   unregister clients for us, since if the i2c bus
-			   is a platform bus, then it is never deleted. */
 			if (client)
 				i2c_unregister_device(client);
 			continue;
@@ -146,11 +139,11 @@
 #endif
 	int err;
 
-	/* Check for valid input */
+	
 	if (v4l2_dev == NULL || sd == NULL || !sd->name[0])
 		return -EINVAL;
 
-	/* Warn if we apparently re-register a subdev */
+	
 	WARN_ON(sd->v4l2_dev != NULL);
 
 	if (!try_module_get(sd->owner))
@@ -165,7 +158,7 @@
 		}
 	}
 
-	/* This just returns 0 if either of the two args is NULL */
+	
 	err = v4l2_ctrl_add_handler(v4l2_dev->ctrl_handler, sd->ctrl_handler);
 	if (err) {
 		if (sd->internal_ops && sd->internal_ops->unregistered)
@@ -175,7 +168,7 @@
 	}
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
-	/* Register the entity. */
+	
 	if (v4l2_dev->mdev) {
 		err = media_device_register_entity(v4l2_dev->mdev, entity);
 		if (err < 0) {
@@ -187,6 +180,10 @@
 	}
 #endif
 
+#if defined(CONFIG_MACH_DUMMY)
+	if (v4l2_dev->subdevs.prev == NULL)
+		return -EINVAL;
+#endif
 	spin_lock(&v4l2_dev->lock);
 	list_add_tail(&sd->list, &v4l2_dev->subdevs);
 	spin_unlock(&v4l2_dev->lock);
@@ -195,60 +192,31 @@
 }
 EXPORT_SYMBOL_GPL(v4l2_device_register_subdev);
 
-static void v4l2_device_release_subdev_node(struct video_device *vdev)
-{
-	struct v4l2_subdev *sd = video_get_drvdata(vdev);
-	sd->devnode = NULL;
-	kfree(vdev);
-}
-
 int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev)
 {
 	struct video_device *vdev;
 	struct v4l2_subdev *sd;
 	int err;
 
-	/* Register a device node for every subdev marked with the
-	 * V4L2_SUBDEV_FL_HAS_DEVNODE flag.
-	 */
 	list_for_each_entry(sd, &v4l2_dev->subdevs, list) {
 		if (!(sd->flags & V4L2_SUBDEV_FL_HAS_DEVNODE))
 			continue;
 
-		vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
-		if (!vdev) {
-			err = -ENOMEM;
-			goto clean_up;
-		}
-
-		video_set_drvdata(vdev, sd);
+		vdev = &sd->devnode;
 		strlcpy(vdev->name, sd->name, sizeof(vdev->name));
 		vdev->v4l2_dev = v4l2_dev;
 		vdev->fops = &v4l2_subdev_fops;
-		vdev->release = v4l2_device_release_subdev_node;
-		vdev->ctrl_handler = sd->ctrl_handler;
+		vdev->release = video_device_release_empty;
 		err = __video_register_device(vdev, VFL_TYPE_SUBDEV, -1, 1,
 					      sd->owner);
-		if (err < 0) {
-			kfree(vdev);
-			goto clean_up;
-		}
+		if (err < 0)
+			return err;
 #if defined(CONFIG_MEDIA_CONTROLLER)
-		sd->entity.info.v4l.major = VIDEO_MAJOR;
-		sd->entity.info.v4l.minor = vdev->minor;
+		sd->entity.v4l.major = VIDEO_MAJOR;
+		sd->entity.v4l.minor = vdev->minor;
 #endif
-		sd->devnode = vdev;
 	}
 	return 0;
-
-clean_up:
-	list_for_each_entry(sd, &v4l2_dev->subdevs, list) {
-		if (!sd->devnode)
-			break;
-		video_unregister_device(sd->devnode);
-	}
-
-	return err;
 }
 EXPORT_SYMBOL_GPL(v4l2_device_register_subdev_nodes);
 
@@ -256,7 +224,7 @@
 {
 	struct v4l2_device *v4l2_dev;
 
-	/* return if it isn't registered */
+	
 	if (sd == NULL || sd->v4l2_dev == NULL)
 		return;
 
@@ -274,7 +242,7 @@
 	if (v4l2_dev->mdev)
 		media_device_unregister_entity(&sd->entity);
 #endif
-	video_unregister_device(sd->devnode);
+	video_unregister_device(&sd->devnode);
 	module_put(sd->owner);
 }
 EXPORT_SYMBOL_GPL(v4l2_device_unregister_subdev);
diff --git a/drivers/media/video/v4l2-event.c b/drivers/media/video/v4l2-event.c
index f3d16ab..9a61197 100644
--- a/drivers/media/video/v4l2-event.c
+++ b/drivers/media/video/v4l2-event.c
@@ -22,43 +22,104 @@
  * 02110-1301 USA
  */
 
+#include <linux/module.h>
 #include <media/v4l2-dev.h>
 #include <media/v4l2-fh.h>
 #include <media/v4l2-event.h>
-#include <media/v4l2-ctrls.h>
 
 #include <linux/sched.h>
 #include <linux/slab.h>
-#include <linux/export.h>
 
-static unsigned sev_pos(const struct v4l2_subscribed_event *sev, unsigned idx)
+int v4l2_event_init(struct v4l2_fh *fh)
 {
-	idx += sev->first;
-	return idx >= sev->elems ? idx - sev->elems : idx;
+	fh->events = kzalloc(sizeof(*fh->events), GFP_KERNEL);
+	if (fh->events == NULL)
+		return -ENOMEM;
+
+	init_waitqueue_head(&fh->events->wait);
+
+	INIT_LIST_HEAD(&fh->events->free);
+	INIT_LIST_HEAD(&fh->events->available);
+	INIT_LIST_HEAD(&fh->events->subscribed);
+
+	fh->events->sequence = -1;
+
+	return 0;
 }
+EXPORT_SYMBOL_GPL(v4l2_event_init);
+
+int v4l2_event_alloc(struct v4l2_fh *fh, unsigned int n)
+{
+	struct v4l2_events *events = fh->events;
+	unsigned long flags;
+
+	if (!events) {
+		WARN_ON(1);
+		return -ENOMEM;
+	}
+
+	while (events->nallocated < n) {
+		struct v4l2_kevent *kev;
+
+		kev = kzalloc(sizeof(*kev), GFP_KERNEL);
+		if (kev == NULL)
+			return -ENOMEM;
+
+		spin_lock_irqsave(&fh->vdev->fh_lock, flags);
+		list_add_tail(&kev->list, &events->free);
+		events->nallocated++;
+		spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(v4l2_event_alloc);
+
+#define list_kfree(list, type, member)				\
+	while (!list_empty(list)) {				\
+		type *hi;					\
+		hi = list_first_entry(list, type, member);	\
+		list_del(&hi->member);				\
+		kfree(hi);					\
+	}
+
+void v4l2_event_free(struct v4l2_fh *fh)
+{
+	struct v4l2_events *events = fh->events;
+
+	if (!events)
+		return;
+
+	list_kfree(&events->free, struct v4l2_kevent, list);
+	list_kfree(&events->available, struct v4l2_kevent, list);
+	list_kfree(&events->subscribed, struct v4l2_subscribed_event, list);
+
+	kfree(events);
+	fh->events = NULL;
+}
+EXPORT_SYMBOL_GPL(v4l2_event_free);
 
 static int __v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event)
 {
+	struct v4l2_events *events = fh->events;
 	struct v4l2_kevent *kev;
 	unsigned long flags;
 
 	spin_lock_irqsave(&fh->vdev->fh_lock, flags);
 
-	if (list_empty(&fh->available)) {
+	if (list_empty(&events->available)) {
 		spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
 		return -ENOENT;
 	}
 
-	WARN_ON(fh->navailable == 0);
+	WARN_ON(events->navailable == 0);
 
-	kev = list_first_entry(&fh->available, struct v4l2_kevent, list);
-	list_del(&kev->list);
-	fh->navailable--;
+	kev = list_first_entry(&events->available, struct v4l2_kevent, list);
+	list_move(&kev->list, &events->free);
+	events->navailable--;
 
-	kev->event.pending = fh->navailable;
+	kev->event.pending = events->navailable;
 	*event = kev->event;
-	kev->sev->first = sev_pos(kev->sev, 1);
-	kev->sev->in_use--;
 
 	spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
 
@@ -68,18 +129,19 @@
 int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event,
 		       int nonblocking)
 {
+	struct v4l2_events *events = fh->events;
 	int ret;
 
 	if (nonblocking)
 		return __v4l2_event_dequeue(fh, event);
 
-	/* Release the vdev lock while waiting */
+	
 	if (fh->vdev->lock)
 		mutex_unlock(fh->vdev->lock);
 
 	do {
-		ret = wait_event_interruptible(fh->wait,
-					       fh->navailable != 0);
+		ret = wait_event_interruptible(events->wait,
+					       events->navailable != 0);
 		if (ret < 0)
 			break;
 
@@ -93,70 +155,20 @@
 }
 EXPORT_SYMBOL_GPL(v4l2_event_dequeue);
 
-/* Caller must hold fh->vdev->fh_lock! */
 static struct v4l2_subscribed_event *v4l2_event_subscribed(
-		struct v4l2_fh *fh, u32 type, u32 id)
+	struct v4l2_fh *fh, u32 type)
 {
+	struct v4l2_events *events = fh->events;
 	struct v4l2_subscribed_event *sev;
 
 	assert_spin_locked(&fh->vdev->fh_lock);
 
-	list_for_each_entry(sev, &fh->subscribed, list)
-		if (sev->type == type && sev->id == id)
+	list_for_each_entry(sev, &events->subscribed, list) {
+		if (sev->type == type)
 			return sev;
-
-	return NULL;
-}
-
-static void __v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev,
-		const struct timespec *ts)
-{
-	struct v4l2_subscribed_event *sev;
-	struct v4l2_kevent *kev;
-	bool copy_payload = true;
-
-	/* Are we subscribed? */
-	sev = v4l2_event_subscribed(fh, ev->type, ev->id);
-	if (sev == NULL)
-		return;
-
-	/* Increase event sequence number on fh. */
-	fh->sequence++;
-
-	/* Do we have any free events? */
-	if (sev->in_use == sev->elems) {
-		/* no, remove the oldest one */
-		kev = sev->events + sev_pos(sev, 0);
-		list_del(&kev->list);
-		sev->in_use--;
-		sev->first = sev_pos(sev, 1);
-		fh->navailable--;
-		if (sev->elems == 1) {
-			if (sev->replace) {
-				sev->replace(&kev->event, ev);
-				copy_payload = false;
-			}
-		} else if (sev->merge) {
-			struct v4l2_kevent *second_oldest =
-				sev->events + sev_pos(sev, 0);
-			sev->merge(&kev->event, &second_oldest->event);
-		}
 	}
 
-	/* Take one and fill it. */
-	kev = sev->events + sev_pos(sev, sev->in_use);
-	kev->event.type = ev->type;
-	if (copy_payload)
-		kev->event.u = ev->u;
-	kev->event.id = ev->id;
-	kev->event.timestamp = *ts;
-	kev->event.sequence = fh->sequence;
-	sev->in_use++;
-	list_add_tail(&kev->list, &fh->available);
-
-	fh->navailable++;
-
-	wake_up_all(&fh->wait);
+	return NULL;
 }
 
 void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev)
@@ -169,103 +181,84 @@
 
 	spin_lock_irqsave(&vdev->fh_lock, flags);
 
-	list_for_each_entry(fh, &vdev->fh_list, list)
-		__v4l2_event_queue_fh(fh, ev, &timestamp);
+	list_for_each_entry(fh, &vdev->fh_list, list) {
+		struct v4l2_events *events = fh->events;
+		struct v4l2_kevent *kev;
+
+		
+		if (!v4l2_event_subscribed(fh, ev->type))
+			continue;
+
+		
+		events->sequence++;
+
+		
+		if (list_empty(&events->free)) {
+			
+			pr_err("%s, no free event queues", __func__);
+			continue;
+		}
+		
+		kev = list_first_entry(&events->free, struct v4l2_kevent, list);
+		kev->event.type = ev->type;
+		kev->event.u = ev->u;
+		kev->event.timestamp = timestamp;
+		kev->event.sequence = events->sequence;
+		list_move_tail(&kev->list, &events->available);
+
+		events->navailable++;
+
+		wake_up_all(&events->wait);
+	}
 
 	spin_unlock_irqrestore(&vdev->fh_lock, flags);
 }
 EXPORT_SYMBOL_GPL(v4l2_event_queue);
 
-void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev)
-{
-	unsigned long flags;
-	struct timespec timestamp;
-
-	ktime_get_ts(&timestamp);
-
-	spin_lock_irqsave(&fh->vdev->fh_lock, flags);
-	__v4l2_event_queue_fh(fh, ev, &timestamp);
-	spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
-}
-EXPORT_SYMBOL_GPL(v4l2_event_queue_fh);
-
 int v4l2_event_pending(struct v4l2_fh *fh)
 {
-	return fh->navailable;
+	if (!(fh) || !(fh)->events) return 0;
+	return fh->events->navailable;
 }
 EXPORT_SYMBOL_GPL(v4l2_event_pending);
 
-static void ctrls_replace(struct v4l2_event *old, const struct v4l2_event *new)
-{
-	u32 old_changes = old->u.ctrl.changes;
-
-	old->u.ctrl = new->u.ctrl;
-	old->u.ctrl.changes |= old_changes;
-}
-
-static void ctrls_merge(const struct v4l2_event *old, struct v4l2_event *new)
-{
-	new->u.ctrl.changes |= old->u.ctrl.changes;
-}
-
 int v4l2_event_subscribe(struct v4l2_fh *fh,
-			 struct v4l2_event_subscription *sub, unsigned elems)
+			 struct v4l2_event_subscription *sub)
 {
-	struct v4l2_subscribed_event *sev, *found_ev;
-	struct v4l2_ctrl *ctrl = NULL;
+	struct v4l2_events *events = fh->events;
+	struct v4l2_subscribed_event *sev;
 	unsigned long flags;
-	unsigned i;
 
-	if (sub->type == V4L2_EVENT_ALL)
-		return -EINVAL;
-
-	if (elems < 1)
-		elems = 1;
-	if (sub->type == V4L2_EVENT_CTRL) {
-		ctrl = v4l2_ctrl_find(fh->ctrl_handler, sub->id);
-		if (ctrl == NULL)
-			return -EINVAL;
+	if (fh->events == NULL) {
+		WARN_ON(1);
+		return -ENOMEM;
 	}
 
-	if (!fh->vdev) {
-		pr_err("%s: fh->vdev is NULL\n", __func__);
-		return -EIO;
-	}
-
-	sev = kzalloc(sizeof(*sev) + sizeof(struct v4l2_kevent) * elems, GFP_KERNEL);
+	sev = kmalloc(sizeof(*sev), GFP_KERNEL);
 	if (!sev)
 		return -ENOMEM;
-	for (i = 0; i < elems; i++)
-		sev->events[i].sev = sev;
-	sev->type = sub->type;
-	sev->id = sub->id;
-	sev->flags = sub->flags;
-	sev->fh = fh;
-	sev->elems = elems;
-	if (ctrl) {
-		sev->replace = ctrls_replace;
-		sev->merge = ctrls_merge;
-	}
 
 	spin_lock_irqsave(&fh->vdev->fh_lock, flags);
-	found_ev = v4l2_event_subscribed(fh, sub->type, sub->id);
-	if (!found_ev)
-		list_add(&sev->list, &fh->subscribed);
+
+	if (v4l2_event_subscribed(fh, sub->type) == NULL) {
+		INIT_LIST_HEAD(&sev->list);
+		sev->type = sub->type;
+
+		list_add(&sev->list, &events->subscribed);
+		sev = NULL;
+	}
+
 	spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
 
-	/* v4l2_ctrl_add_event uses a mutex, so do this outside the spin lock */
-	if (found_ev)
-		kfree(sev);
-	else if (ctrl)
-		v4l2_ctrl_add_event(ctrl, sev);
+	kfree(sev);
 
 	return 0;
 }
 EXPORT_SYMBOL_GPL(v4l2_event_subscribe);
 
-void v4l2_event_unsubscribe_all(struct v4l2_fh *fh)
+static void v4l2_event_unsubscribe_all(struct v4l2_fh *fh)
 {
-	struct v4l2_event_subscription sub;
+	struct v4l2_events *events = fh->events;
 	struct v4l2_subscribed_event *sev;
 	unsigned long flags;
 
@@ -273,25 +266,21 @@
 		sev = NULL;
 
 		spin_lock_irqsave(&fh->vdev->fh_lock, flags);
-		if (!list_empty(&fh->subscribed)) {
-			sev = list_first_entry(&fh->subscribed,
-					struct v4l2_subscribed_event, list);
-			sub.type = sev->type;
-			sub.id = sev->id;
+		if (!list_empty(&events->subscribed)) {
+			sev = list_first_entry(&events->subscribed,
+				       struct v4l2_subscribed_event, list);
+			list_del(&sev->list);
 		}
 		spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
-		if (sev)
-			v4l2_event_unsubscribe(fh, &sub);
+		kfree(sev);
 	} while (sev);
 }
-EXPORT_SYMBOL_GPL(v4l2_event_unsubscribe_all);
 
 int v4l2_event_unsubscribe(struct v4l2_fh *fh,
 			   struct v4l2_event_subscription *sub)
 {
 	struct v4l2_subscribed_event *sev;
 	unsigned long flags;
-	int i;
 
 	if (sub->type == V4L2_EVENT_ALL) {
 		v4l2_event_unsubscribe_all(fh);
@@ -300,23 +289,11 @@
 
 	spin_lock_irqsave(&fh->vdev->fh_lock, flags);
 
-	sev = v4l2_event_subscribed(fh, sub->type, sub->id);
-	if (sev != NULL) {
-		/* Remove any pending events for this subscription */
-		for (i = 0; i < sev->in_use; i++) {
-			list_del(&sev->events[sev_pos(sev, i)].list);
-			fh->navailable--;
-		}
+	sev = v4l2_event_subscribed(fh, sub->type);
+	if (sev != NULL)
 		list_del(&sev->list);
-	}
 
 	spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
-	if (sev && sev->type == V4L2_EVENT_CTRL) {
-		struct v4l2_ctrl *ctrl = v4l2_ctrl_find(fh->ctrl_handler, sev->id);
-
-		if (ctrl)
-			v4l2_ctrl_del_event(ctrl, sev);
-	}
 
 	kfree(sev);
 
diff --git a/drivers/media/video/v4l2-fh.c b/drivers/media/video/v4l2-fh.c
index bf5cd5b..1081a11 100644
--- a/drivers/media/video/v4l2-fh.c
+++ b/drivers/media/video/v4l2-fh.c
@@ -22,26 +22,27 @@
  * 02110-1301 USA
  */
 
+#include <linux/module.h>
 #include <linux/bitops.h>
 #include <linux/slab.h>
-#include <linux/export.h>
 #include <media/v4l2-dev.h>
 #include <media/v4l2-fh.h>
 #include <media/v4l2-event.h>
 #include <media/v4l2-ioctl.h>
 
-void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev)
+int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev)
 {
 	fh->vdev = vdev;
-	/* Inherit from video_device. May be overridden by the driver. */
-	fh->ctrl_handler = vdev->ctrl_handler;
 	INIT_LIST_HEAD(&fh->list);
 	set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags);
 	fh->prio = V4L2_PRIORITY_UNSET;
-	init_waitqueue_head(&fh->wait);
-	INIT_LIST_HEAD(&fh->available);
-	INIT_LIST_HEAD(&fh->subscribed);
-	fh->sequence = -1;
+
+	if (vdev->ioctl_ops && vdev->ioctl_ops->vidioc_subscribe_event)
+		return v4l2_event_init(fh);
+
+	fh->events = NULL;
+
+	return 0;
 }
 EXPORT_SYMBOL_GPL(v4l2_fh_init);
 
@@ -75,11 +76,6 @@
 {
 	unsigned long flags;
 
-	if (!fh->vdev) {
-		pr_err("%s: fd->vdev is NULL\n", __func__);
-		return;
-	}
-
 	spin_lock_irqsave(&fh->vdev->fh_lock, flags);
 	list_del_init(&fh->list);
 	spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
@@ -92,8 +88,10 @@
 {
 	if (fh->vdev == NULL)
 		return;
-	v4l2_event_unsubscribe_all(fh);
+
 	fh->vdev = NULL;
+
+	v4l2_event_free(fh);
 }
 EXPORT_SYMBOL_GPL(v4l2_fh_exit);
 
diff --git a/drivers/media/video/v4l2-int-device.c b/drivers/media/video/v4l2-int-device.c
index f447349..b991afd 100644
--- a/drivers/media/video/v4l2-int-device.c
+++ b/drivers/media/video/v4l2-int-device.c
@@ -26,7 +26,6 @@
 #include <linux/list.h>
 #include <linux/sort.h>
 #include <linux/string.h>
-#include <linux/module.h>
 
 #include <media/v4l2-int-device.h>
 
@@ -45,11 +44,11 @@
 			if (s->type != v4l2_int_type_slave)
 				continue;
 
-			/* Slave is connected? */
+			
 			if (s->u.slave->master)
 				continue;
 
-			/* Slave wants to attach to master? */
+			
 			if (s->u.slave->attach_to[0] != 0
 			    && strncmp(m->name, s->u.slave->attach_to,
 				       V4L2NAMESIZE))
@@ -111,7 +110,6 @@
 }
 EXPORT_SYMBOL_GPL(v4l2_int_device_unregister);
 
-/* Adapted from search_extable in extable.c. */
 static v4l2_int_ioctl_func *find_ioctl(struct v4l2_int_slave *slave, int cmd,
 				       v4l2_int_ioctl_func *no_such_ioctl)
 {
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 5b2ec1f..c45f285 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -16,7 +16,6 @@
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/version.h>
 
 #include <linux/videodev2.h>
 
@@ -49,25 +48,10 @@
 			printk(KERN_CONT "%s: " fmt, vfd->name, ## arg);\
 		} while (0)
 
-/* Zero out the end of the struct pointed to by p.  Everything after, but
- * not including, the specified field is cleared. */
 #define CLEAR_AFTER_FIELD(p, field) \
 	memset((u8 *)(p) + offsetof(typeof(*(p)), field) + sizeof((p)->field), \
 	0, sizeof(*(p)) - offsetof(typeof(*(p)), field) - sizeof((p)->field))
 
-#define have_fmt_ops(foo) (						\
-	ops->vidioc_##foo##_fmt_vid_cap ||				\
-	ops->vidioc_##foo##_fmt_vid_out ||				\
-	ops->vidioc_##foo##_fmt_vid_cap_mplane ||			\
-	ops->vidioc_##foo##_fmt_vid_out_mplane ||			\
-	ops->vidioc_##foo##_fmt_vid_overlay ||				\
-	ops->vidioc_##foo##_fmt_vbi_cap ||				\
-	ops->vidioc_##foo##_fmt_vid_out_overlay ||			\
-	ops->vidioc_##foo##_fmt_vbi_out ||				\
-	ops->vidioc_##foo##_fmt_sliced_vbi_cap ||			\
-	ops->vidioc_##foo##_fmt_sliced_vbi_out ||			\
-	ops->vidioc_##foo##_fmt_type_private)
-
 struct std_descr {
 	v4l2_std_id std;
 	const char *descr;
@@ -107,17 +91,11 @@
 	{ 0, 			"Unknown"   }
 };
 
-/* video4linux standard ID conversion to standard name
- */
 const char *v4l2_norm_to_name(v4l2_std_id id)
 {
 	u32 myid = id;
 	int i;
 
-	/* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle
-	   64 bit comparations. So, on that architecture, with some gcc
-	   variants, compilation fails. Currently, the max value is 30bit wide.
-	 */
 	BUG_ON(myid != id);
 
 	for (i = 0; standards[i].std; i++)
@@ -127,7 +105,6 @@
 }
 EXPORT_SYMBOL(v4l2_norm_to_name);
 
-/* Returns frame period for the given standard */
 void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod)
 {
 	if (id & V4L2_STD_525_60) {
@@ -140,8 +117,6 @@
 }
 EXPORT_SYMBOL(v4l2_video_std_frame_period);
 
-/* Fill in the fields of a v4l2_standard structure according to the
-   'id' and 'transmission' parameters.  Returns negative on error.  */
 int v4l2_video_std_construct(struct v4l2_standard *vs,
 			     int id, const char *name)
 {
@@ -153,8 +128,6 @@
 }
 EXPORT_SYMBOL(v4l2_video_std_construct);
 
-/* ----------------------------------------------------------------- */
-/* some arrays for pretty-printing debug messages of enum types      */
 
 const char *v4l2_field_names[] = {
 	[V4L2_FIELD_ANY]        = "any",
@@ -193,8 +166,6 @@
 #define prt_names(a, arr) ((((a) >= 0) && ((a) < ARRAY_SIZE(arr))) ? \
 			   arr[a] : "unknown")
 
-/* ------------------------------------------------------------------ */
-/* debug help functions                                               */
 static const char *v4l2_ioctls[] = {
 	[_IOC_NR(VIDIOC_QUERYCAP)]         = "VIDIOC_QUERYCAP",
 	[_IOC_NR(VIDIOC_RESERVED)]         = "VIDIOC_RESERVED",
@@ -238,8 +209,6 @@
 	[_IOC_NR(VIDIOC_CROPCAP)]          = "VIDIOC_CROPCAP",
 	[_IOC_NR(VIDIOC_G_CROP)]           = "VIDIOC_G_CROP",
 	[_IOC_NR(VIDIOC_S_CROP)]           = "VIDIOC_S_CROP",
-	[_IOC_NR(VIDIOC_G_SELECTION)]      = "VIDIOC_G_SELECTION",
-	[_IOC_NR(VIDIOC_S_SELECTION)]      = "VIDIOC_S_SELECTION",
 	[_IOC_NR(VIDIOC_G_JPEGCOMP)]       = "VIDIOC_G_JPEGCOMP",
 	[_IOC_NR(VIDIOC_S_JPEGCOMP)]       = "VIDIOC_S_JPEGCOMP",
 	[_IOC_NR(VIDIOC_QUERYSTD)]         = "VIDIOC_QUERYSTD",
@@ -260,8 +229,6 @@
 	[_IOC_NR(VIDIOC_ENCODER_CMD)] 	   = "VIDIOC_ENCODER_CMD",
 	[_IOC_NR(VIDIOC_TRY_ENCODER_CMD)]  = "VIDIOC_TRY_ENCODER_CMD",
 
-	[_IOC_NR(VIDIOC_DECODER_CMD)]	   = "VIDIOC_DECODER_CMD",
-	[_IOC_NR(VIDIOC_TRY_DECODER_CMD)]  = "VIDIOC_TRY_DECODER_CMD",
 	[_IOC_NR(VIDIOC_DBG_S_REGISTER)]   = "VIDIOC_DBG_S_REGISTER",
 	[_IOC_NR(VIDIOC_DBG_G_REGISTER)]   = "VIDIOC_DBG_G_REGISTER",
 
@@ -277,13 +244,9 @@
 	[_IOC_NR(VIDIOC_DQEVENT)]	   = "VIDIOC_DQEVENT",
 	[_IOC_NR(VIDIOC_SUBSCRIBE_EVENT)]  = "VIDIOC_SUBSCRIBE_EVENT",
 	[_IOC_NR(VIDIOC_UNSUBSCRIBE_EVENT)] = "VIDIOC_UNSUBSCRIBE_EVENT",
-	[_IOC_NR(VIDIOC_CREATE_BUFS)]      = "VIDIOC_CREATE_BUFS",
-	[_IOC_NR(VIDIOC_PREPARE_BUF)]      = "VIDIOC_PREPARE_BUF",
 };
 #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
 
-/* Common ioctl debug function. This function can be used by
-   external ioctl messages as well as internal V4L ioctl */
 void v4l_printk_ioctl(unsigned int cmd)
 {
 	char *dir, *type;
@@ -418,19 +381,14 @@
 {
 	__u32 i;
 
-	/* zero the reserved fields */
+	
 	c->reserved[0] = c->reserved[1] = 0;
 	for (i = 0; i < c->count; i++)
 		c->controls[i].reserved2[0] = 0;
 
-	/* V4L2_CID_PRIVATE_BASE cannot be used as control class
-	   when using extended controls.
-	   Only when passed in through VIDIOC_G_CTRL and VIDIOC_S_CTRL
-	   is it allowed for backwards compatibility.
-	 */
 	if (!allow_priv && c->ctrl_class == V4L2_CID_PRIVATE_BASE)
 		return 0;
-	/* Check that all controls are from the same control class. */
+	
 	for (i = 0; i < c->count; i++) {
 		if (V4L2_CTRL_ID2CLASS(c->controls[i].id) != c->ctrl_class) {
 			c->error_idx = i;
@@ -496,6 +454,55 @@
 	return -EINVAL;
 }
 
+static int fmt_sp_to_mp(const struct v4l2_format *f_sp,
+			struct v4l2_format *f_mp)
+{
+	struct v4l2_pix_format_mplane *pix_mp = &f_mp->fmt.pix_mp;
+	const struct v4l2_pix_format *pix = &f_sp->fmt.pix;
+
+	if (f_sp->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
+		f_mp->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+	else if (f_sp->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
+		f_mp->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+	else
+		return -EINVAL;
+
+	pix_mp->width = pix->width;
+	pix_mp->height = pix->height;
+	pix_mp->pixelformat = pix->pixelformat;
+	pix_mp->field = pix->field;
+	pix_mp->colorspace = pix->colorspace;
+	pix_mp->num_planes = 1;
+	pix_mp->plane_fmt[0].sizeimage = pix->sizeimage;
+	pix_mp->plane_fmt[0].bytesperline = pix->bytesperline;
+
+	return 0;
+}
+
+static int fmt_mp_to_sp(const struct v4l2_format *f_mp,
+			struct v4l2_format *f_sp)
+{
+	const struct v4l2_pix_format_mplane *pix_mp = &f_mp->fmt.pix_mp;
+	struct v4l2_pix_format *pix = &f_sp->fmt.pix;
+
+	if (f_mp->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
+		f_sp->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+	else if (f_mp->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
+		f_sp->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+	else
+		return -EINVAL;
+
+	pix->width = pix_mp->width;
+	pix->height = pix_mp->height;
+	pix->pixelformat = pix_mp->pixelformat;
+	pix->field = pix_mp->field;
+	pix->colorspace = pix_mp->colorspace;
+	pix->sizeimage = pix_mp->plane_fmt[0].sizeimage;
+	pix->bytesperline = pix_mp->plane_fmt[0].bytesperline;
+
+	return 0;
+}
+
 static long __video_do_ioctl(struct file *file,
 		unsigned int cmd, void *arg)
 {
@@ -503,14 +510,14 @@
 	const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops;
 	void *fh = file->private_data;
 	struct v4l2_fh *vfh = NULL;
+	struct v4l2_format f_copy;
 	int use_fh_prio = 0;
-	long ret_prio = 0;
-	long ret = -ENOTTY;
+	long ret = -EINVAL;
 
 	if (ops == NULL) {
 		printk(KERN_WARNING "videodev: \"%s\" has no ioctl_ops.\n",
 				vfd->name);
-		return ret;
+		return -EINVAL;
 	}
 
 	if ((vfd->debug & V4L2_DEBUG_IOCTL) &&
@@ -524,12 +531,43 @@
 		use_fh_prio = test_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags);
 	}
 
-	if (use_fh_prio)
-		ret_prio = v4l2_prio_check(vfd->prio, vfh->prio);
+	if (use_fh_prio) {
+		switch (cmd) {
+		case VIDIOC_S_CTRL:
+		case VIDIOC_S_STD:
+		case VIDIOC_S_INPUT:
+		case VIDIOC_S_OUTPUT:
+		case VIDIOC_S_TUNER:
+		case VIDIOC_S_FREQUENCY:
+		case VIDIOC_S_FMT:
+		case VIDIOC_S_CROP:
+		case VIDIOC_S_AUDIO:
+		case VIDIOC_S_AUDOUT:
+		case VIDIOC_S_EXT_CTRLS:
+		case VIDIOC_S_FBUF:
+		case VIDIOC_S_PRIORITY:
+		case VIDIOC_S_DV_PRESET:
+		case VIDIOC_S_DV_TIMINGS:
+		case VIDIOC_S_JPEGCOMP:
+		case VIDIOC_S_MODULATOR:
+		case VIDIOC_S_PARM:
+		case VIDIOC_S_HW_FREQ_SEEK:
+		case VIDIOC_ENCODER_CMD:
+		case VIDIOC_OVERLAY:
+		case VIDIOC_REQBUFS:
+		case VIDIOC_STREAMON:
+		case VIDIOC_STREAMOFF:
+			ret = v4l2_prio_check(vfd->prio, vfh->prio);
+			if (ret)
+				goto exit_prio;
+			ret = -EINVAL;
+			break;
+		}
+	}
 
 	switch (cmd) {
 
-	/* --- capabilities ------------------------------------------ */
+	
 	case VIDIOC_QUERYCAP:
 	{
 		struct v4l2_capability *cap = (struct v4l2_capability *)arg;
@@ -537,21 +575,18 @@
 		if (!ops->vidioc_querycap)
 			break;
 
-		cap->version = LINUX_VERSION_CODE;
 		ret = ops->vidioc_querycap(file, fh, cap);
 		if (!ret)
 			dbgarg(cmd, "driver=%s, card=%s, bus=%s, "
 					"version=0x%08x, "
-					"capabilities=0x%08x, "
-					"device_caps=0x%08x\n",
+					"capabilities=0x%08x\n",
 					cap->driver, cap->card, cap->bus_info,
 					cap->version,
-					cap->capabilities,
-					cap->device_caps);
+					cap->capabilities);
 		break;
 	}
 
-	/* --- priority ------------------------------------------ */
+	
 	case VIDIOC_G_PRIORITY:
 	{
 		enum v4l2_priority *p = arg;
@@ -571,55 +606,53 @@
 		enum v4l2_priority *p = arg;
 
 		if (!ops->vidioc_s_priority && !use_fh_prio)
-			break;
+				break;
 		dbgarg(cmd, "setting priority to %d\n", *p);
 		if (ops->vidioc_s_priority)
 			ret = ops->vidioc_s_priority(file, fh, *p);
 		else
-			ret = ret_prio ? ret_prio :
-				v4l2_prio_change(&vfd->v4l2_dev->prio,
-							&vfh->prio, *p);
+			ret = v4l2_prio_change(&vfd->v4l2_dev->prio, &vfh->prio, *p);
 		break;
 	}
 
-	/* --- capture ioctls ---------------------------------------- */
+	
 	case VIDIOC_ENUM_FMT:
 	{
 		struct v4l2_fmtdesc *f = arg;
 
 		switch (f->type) {
 		case V4L2_BUF_TYPE_VIDEO_CAPTURE:
-			if (likely(ops->vidioc_enum_fmt_vid_cap))
+			if (ops->vidioc_enum_fmt_vid_cap)
 				ret = ops->vidioc_enum_fmt_vid_cap(file, fh, f);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
-			if (likely(ops->vidioc_enum_fmt_vid_cap_mplane))
+			if (ops->vidioc_enum_fmt_vid_cap_mplane)
 				ret = ops->vidioc_enum_fmt_vid_cap_mplane(file,
 									fh, f);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OVERLAY:
-			if (likely(ops->vidioc_enum_fmt_vid_overlay))
+			if (ops->vidioc_enum_fmt_vid_overlay)
 				ret = ops->vidioc_enum_fmt_vid_overlay(file,
 					fh, f);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OUTPUT:
-			if (likely(ops->vidioc_enum_fmt_vid_out))
+			if (ops->vidioc_enum_fmt_vid_out)
 				ret = ops->vidioc_enum_fmt_vid_out(file, fh, f);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
-			if (likely(ops->vidioc_enum_fmt_vid_out_mplane))
+			if (ops->vidioc_enum_fmt_vid_out_mplane)
 				ret = ops->vidioc_enum_fmt_vid_out_mplane(file,
 									fh, f);
 			break;
 		case V4L2_BUF_TYPE_PRIVATE:
-			if (likely(ops->vidioc_enum_fmt_type_private))
+			if (ops->vidioc_enum_fmt_type_private)
 				ret = ops->vidioc_enum_fmt_type_private(file,
 								fh, f);
 			break;
 		default:
 			break;
 		}
-		if (likely (!ret))
+		if (!ret)
 			dbgarg(cmd, "index=%d, type=%d, flags=%d, "
 				"pixelformat=%c%c%c%c, description='%s'\n",
 				f->index, f->type, f->flags,
@@ -628,86 +661,126 @@
 				(f->pixelformat >> 16) & 0xff,
 				(f->pixelformat >> 24) & 0xff,
 				f->description);
-		else if (ret == -ENOTTY &&
-			 (ops->vidioc_enum_fmt_vid_cap ||
-			  ops->vidioc_enum_fmt_vid_out ||
-			  ops->vidioc_enum_fmt_vid_cap_mplane ||
-			  ops->vidioc_enum_fmt_vid_out_mplane ||
-			  ops->vidioc_enum_fmt_vid_overlay ||
-			  ops->vidioc_enum_fmt_type_private))
-			ret = -EINVAL;
 		break;
 	}
 	case VIDIOC_G_FMT:
 	{
 		struct v4l2_format *f = (struct v4l2_format *)arg;
 
-		/* FIXME: Should be one dump per type */
+		
 		dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
 
 		switch (f->type) {
 		case V4L2_BUF_TYPE_VIDEO_CAPTURE:
-			if (ops->vidioc_g_fmt_vid_cap)
+			if (ops->vidioc_g_fmt_vid_cap) {
 				ret = ops->vidioc_g_fmt_vid_cap(file, fh, f);
+			} else if (ops->vidioc_g_fmt_vid_cap_mplane) {
+				if (fmt_sp_to_mp(f, &f_copy))
+					break;
+				ret = ops->vidioc_g_fmt_vid_cap_mplane(file, fh,
+								       &f_copy);
+				if (ret)
+					break;
+
+				if (f_copy.fmt.pix_mp.num_planes > 1) {
+					ret = -EBUSY;
+					break;
+				}
+
+				ret = fmt_mp_to_sp(&f_copy, f);
+			}
 			if (!ret)
 				v4l_print_pix_fmt(vfd, &f->fmt.pix);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
-			if (ops->vidioc_g_fmt_vid_cap_mplane)
+			if (ops->vidioc_g_fmt_vid_cap_mplane) {
 				ret = ops->vidioc_g_fmt_vid_cap_mplane(file,
 									fh, f);
+			} else if (ops->vidioc_g_fmt_vid_cap) {
+				if (fmt_mp_to_sp(f, &f_copy))
+					break;
+				ret = ops->vidioc_g_fmt_vid_cap(file,
+								fh, &f_copy);
+				if (ret)
+					break;
+
+				ret = fmt_sp_to_mp(&f_copy, f);
+			}
 			if (!ret)
 				v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OVERLAY:
-			if (likely(ops->vidioc_g_fmt_vid_overlay))
+			if (ops->vidioc_g_fmt_vid_overlay)
 				ret = ops->vidioc_g_fmt_vid_overlay(file,
 								    fh, f);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OUTPUT:
-			if (ops->vidioc_g_fmt_vid_out)
+			if (ops->vidioc_g_fmt_vid_out) {
 				ret = ops->vidioc_g_fmt_vid_out(file, fh, f);
+			} else if (ops->vidioc_g_fmt_vid_out_mplane) {
+				if (fmt_sp_to_mp(f, &f_copy))
+					break;
+				ret = ops->vidioc_g_fmt_vid_out_mplane(file, fh,
+									&f_copy);
+				if (ret)
+					break;
+
+				if (f_copy.fmt.pix_mp.num_planes > 1) {
+					ret = -EBUSY;
+					break;
+				}
+
+				ret = fmt_mp_to_sp(&f_copy, f);
+			}
 			if (!ret)
 				v4l_print_pix_fmt(vfd, &f->fmt.pix);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
-			if (ops->vidioc_g_fmt_vid_out_mplane)
+			if (ops->vidioc_g_fmt_vid_out_mplane) {
 				ret = ops->vidioc_g_fmt_vid_out_mplane(file,
 									fh, f);
+			} else if (ops->vidioc_g_fmt_vid_out) {
+				if (fmt_mp_to_sp(f, &f_copy))
+					break;
+				ret = ops->vidioc_g_fmt_vid_out(file,
+								fh, &f_copy);
+				if (ret)
+					break;
+
+				ret = fmt_sp_to_mp(&f_copy, f);
+			}
 			if (!ret)
 				v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
-			if (likely(ops->vidioc_g_fmt_vid_out_overlay))
+			if (ops->vidioc_g_fmt_vid_out_overlay)
 				ret = ops->vidioc_g_fmt_vid_out_overlay(file,
 				       fh, f);
 			break;
 		case V4L2_BUF_TYPE_VBI_CAPTURE:
-			if (likely(ops->vidioc_g_fmt_vbi_cap))
+			if (ops->vidioc_g_fmt_vbi_cap)
 				ret = ops->vidioc_g_fmt_vbi_cap(file, fh, f);
 			break;
 		case V4L2_BUF_TYPE_VBI_OUTPUT:
-			if (likely(ops->vidioc_g_fmt_vbi_out))
+			if (ops->vidioc_g_fmt_vbi_out)
 				ret = ops->vidioc_g_fmt_vbi_out(file, fh, f);
 			break;
 		case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
-			if (likely(ops->vidioc_g_fmt_sliced_vbi_cap))
+			if (ops->vidioc_g_fmt_sliced_vbi_cap)
 				ret = ops->vidioc_g_fmt_sliced_vbi_cap(file,
 									fh, f);
 			break;
 		case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
-			if (likely(ops->vidioc_g_fmt_sliced_vbi_out))
+			if (ops->vidioc_g_fmt_sliced_vbi_out)
 				ret = ops->vidioc_g_fmt_sliced_vbi_out(file,
 									fh, f);
 			break;
 		case V4L2_BUF_TYPE_PRIVATE:
-			if (likely(ops->vidioc_g_fmt_type_private))
+			if (ops->vidioc_g_fmt_type_private)
 				ret = ops->vidioc_g_fmt_type_private(file,
 								fh, f);
 			break;
 		}
-		if (unlikely(ret == -ENOTTY && have_fmt_ops(g)))
-			ret = -EINVAL;
 
 		break;
 	}
@@ -715,30 +788,49 @@
 	{
 		struct v4l2_format *f = (struct v4l2_format *)arg;
 
-		if (!have_fmt_ops(s))
-			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
-		ret = -EINVAL;
-
-		/* FIXME: Should be one dump per type */
+		
 		dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
 
 		switch (f->type) {
 		case V4L2_BUF_TYPE_VIDEO_CAPTURE:
 			CLEAR_AFTER_FIELD(f, fmt.pix);
 			v4l_print_pix_fmt(vfd, &f->fmt.pix);
-			if (ops->vidioc_s_fmt_vid_cap)
+			if (ops->vidioc_s_fmt_vid_cap) {
 				ret = ops->vidioc_s_fmt_vid_cap(file, fh, f);
+			} else if (ops->vidioc_s_fmt_vid_cap_mplane) {
+				if (fmt_sp_to_mp(f, &f_copy))
+					break;
+				ret = ops->vidioc_s_fmt_vid_cap_mplane(file, fh,
+									&f_copy);
+				if (ret)
+					break;
+
+				if (f_copy.fmt.pix_mp.num_planes > 1) {
+					ret = -EBUSY;
+					WARN_ON(1);
+					break;
+				}
+
+				ret = fmt_mp_to_sp(&f_copy, f);
+			}
 			break;
 		case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
 			CLEAR_AFTER_FIELD(f, fmt.pix_mp);
 			v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp);
-			if (ops->vidioc_s_fmt_vid_cap_mplane)
+			if (ops->vidioc_s_fmt_vid_cap_mplane) {
 				ret = ops->vidioc_s_fmt_vid_cap_mplane(file,
 									fh, f);
+			} else if (ops->vidioc_s_fmt_vid_cap &&
+					f->fmt.pix_mp.num_planes == 1) {
+				if (fmt_mp_to_sp(f, &f_copy))
+					break;
+				ret = ops->vidioc_s_fmt_vid_cap(file,
+								fh, &f_copy);
+				if (ret)
+					break;
+
+				ret = fmt_sp_to_mp(&f_copy, f);
+			}
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OVERLAY:
 			CLEAR_AFTER_FIELD(f, fmt.win);
@@ -749,15 +841,42 @@
 		case V4L2_BUF_TYPE_VIDEO_OUTPUT:
 			CLEAR_AFTER_FIELD(f, fmt.pix);
 			v4l_print_pix_fmt(vfd, &f->fmt.pix);
-			if (ops->vidioc_s_fmt_vid_out)
+			if (ops->vidioc_s_fmt_vid_out) {
 				ret = ops->vidioc_s_fmt_vid_out(file, fh, f);
+			} else if (ops->vidioc_s_fmt_vid_out_mplane) {
+				if (fmt_sp_to_mp(f, &f_copy))
+					break;
+				ret = ops->vidioc_s_fmt_vid_out_mplane(file, fh,
+									&f_copy);
+				if (ret)
+					break;
+
+				if (f_copy.fmt.pix_mp.num_planes > 1) {
+					ret = -EBUSY;
+					WARN_ON(1);
+					break;
+				}
+
+				ret = fmt_mp_to_sp(&f_copy, f);
+			}
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
 			CLEAR_AFTER_FIELD(f, fmt.pix_mp);
 			v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp);
-			if (ops->vidioc_s_fmt_vid_out_mplane)
+			if (ops->vidioc_s_fmt_vid_out_mplane) {
 				ret = ops->vidioc_s_fmt_vid_out_mplane(file,
 									fh, f);
+			} else if (ops->vidioc_s_fmt_vid_out &&
+					f->fmt.pix_mp.num_planes == 1) {
+				if (fmt_mp_to_sp(f, &f_copy))
+					break;
+				ret = ops->vidioc_s_fmt_vid_out(file,
+								fh, &f_copy);
+				if (ret)
+					break;
+
+				ret = fmt_mp_to_sp(&f_copy, f);
+			}
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
 			CLEAR_AFTER_FIELD(f, fmt.win);
@@ -767,30 +886,29 @@
 			break;
 		case V4L2_BUF_TYPE_VBI_CAPTURE:
 			CLEAR_AFTER_FIELD(f, fmt.vbi);
-			if (likely(ops->vidioc_s_fmt_vbi_cap))
+			if (ops->vidioc_s_fmt_vbi_cap)
 				ret = ops->vidioc_s_fmt_vbi_cap(file, fh, f);
 			break;
 		case V4L2_BUF_TYPE_VBI_OUTPUT:
 			CLEAR_AFTER_FIELD(f, fmt.vbi);
-			if (likely(ops->vidioc_s_fmt_vbi_out))
+			if (ops->vidioc_s_fmt_vbi_out)
 				ret = ops->vidioc_s_fmt_vbi_out(file, fh, f);
 			break;
 		case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
 			CLEAR_AFTER_FIELD(f, fmt.sliced);
-			if (likely(ops->vidioc_s_fmt_sliced_vbi_cap))
+			if (ops->vidioc_s_fmt_sliced_vbi_cap)
 				ret = ops->vidioc_s_fmt_sliced_vbi_cap(file,
 									fh, f);
 			break;
 		case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
 			CLEAR_AFTER_FIELD(f, fmt.sliced);
-			if (likely(ops->vidioc_s_fmt_sliced_vbi_out))
+			if (ops->vidioc_s_fmt_sliced_vbi_out)
 				ret = ops->vidioc_s_fmt_sliced_vbi_out(file,
 									fh, f);
-
 			break;
 		case V4L2_BUF_TYPE_PRIVATE:
-			/* CLEAR_AFTER_FIELD(f, fmt.raw_data); <- does nothing */
-			if (likely(ops->vidioc_s_fmt_type_private))
+			
+			if (ops->vidioc_s_fmt_type_private)
 				ret = ops->vidioc_s_fmt_type_private(file,
 								fh, f);
 			break;
@@ -801,99 +919,142 @@
 	{
 		struct v4l2_format *f = (struct v4l2_format *)arg;
 
-		/* FIXME: Should be one dump per type */
+		
 		dbgarg(cmd, "type=%s\n", prt_names(f->type,
 						v4l2_type_names));
 		switch (f->type) {
 		case V4L2_BUF_TYPE_VIDEO_CAPTURE:
 			CLEAR_AFTER_FIELD(f, fmt.pix);
-			if (ops->vidioc_try_fmt_vid_cap)
+			if (ops->vidioc_try_fmt_vid_cap) {
 				ret = ops->vidioc_try_fmt_vid_cap(file, fh, f);
+			} else if (ops->vidioc_try_fmt_vid_cap_mplane) {
+				if (fmt_sp_to_mp(f, &f_copy))
+					break;
+				ret = ops->vidioc_try_fmt_vid_cap_mplane(file,
+								fh, &f_copy);
+				if (ret)
+					break;
+
+				if (f_copy.fmt.pix_mp.num_planes > 1) {
+					ret = -EBUSY;
+					WARN_ON(1);
+					break;
+				}
+				ret = fmt_mp_to_sp(&f_copy, f);
+			}
 			if (!ret)
 				v4l_print_pix_fmt(vfd, &f->fmt.pix);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
 			CLEAR_AFTER_FIELD(f, fmt.pix_mp);
-			if (ops->vidioc_try_fmt_vid_cap_mplane)
+			if (ops->vidioc_try_fmt_vid_cap_mplane) {
 				ret = ops->vidioc_try_fmt_vid_cap_mplane(file,
 									 fh, f);
+			} else if (ops->vidioc_try_fmt_vid_cap &&
+					f->fmt.pix_mp.num_planes == 1) {
+				if (fmt_mp_to_sp(f, &f_copy))
+					break;
+				ret = ops->vidioc_try_fmt_vid_cap(file,
+								  fh, &f_copy);
+				if (ret)
+					break;
+
+				ret = fmt_sp_to_mp(&f_copy, f);
+			}
 			if (!ret)
 				v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OVERLAY:
 			CLEAR_AFTER_FIELD(f, fmt.win);
-			if (likely(ops->vidioc_try_fmt_vid_overlay))
+			if (ops->vidioc_try_fmt_vid_overlay)
 				ret = ops->vidioc_try_fmt_vid_overlay(file,
 					fh, f);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OUTPUT:
 			CLEAR_AFTER_FIELD(f, fmt.pix);
-			if (ops->vidioc_try_fmt_vid_out)
+			if (ops->vidioc_try_fmt_vid_out) {
 				ret = ops->vidioc_try_fmt_vid_out(file, fh, f);
+			} else if (ops->vidioc_try_fmt_vid_out_mplane) {
+				if (fmt_sp_to_mp(f, &f_copy))
+					break;
+				ret = ops->vidioc_try_fmt_vid_out_mplane(file,
+								fh, &f_copy);
+				if (ret)
+					break;
+
+				if (f_copy.fmt.pix_mp.num_planes > 1) {
+					ret = -EBUSY;
+					WARN_ON(1);
+					break;
+				}
+				ret = fmt_mp_to_sp(&f_copy, f);
+			}
 			if (!ret)
 				v4l_print_pix_fmt(vfd, &f->fmt.pix);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
 			CLEAR_AFTER_FIELD(f, fmt.pix_mp);
-			if (ops->vidioc_try_fmt_vid_out_mplane)
+			if (ops->vidioc_try_fmt_vid_out_mplane) {
 				ret = ops->vidioc_try_fmt_vid_out_mplane(file,
 									 fh, f);
+			} else if (ops->vidioc_try_fmt_vid_out &&
+					f->fmt.pix_mp.num_planes == 1) {
+				if (fmt_mp_to_sp(f, &f_copy))
+					break;
+				ret = ops->vidioc_try_fmt_vid_out(file,
+								  fh, &f_copy);
+				if (ret)
+					break;
+
+				ret = fmt_sp_to_mp(&f_copy, f);
+			}
 			if (!ret)
 				v4l_print_pix_fmt_mplane(vfd, &f->fmt.pix_mp);
 			break;
 		case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
 			CLEAR_AFTER_FIELD(f, fmt.win);
-			if (likely(ops->vidioc_try_fmt_vid_out_overlay))
+			if (ops->vidioc_try_fmt_vid_out_overlay)
 				ret = ops->vidioc_try_fmt_vid_out_overlay(file,
 				       fh, f);
 			break;
 		case V4L2_BUF_TYPE_VBI_CAPTURE:
 			CLEAR_AFTER_FIELD(f, fmt.vbi);
-			if (likely(ops->vidioc_try_fmt_vbi_cap))
+			if (ops->vidioc_try_fmt_vbi_cap)
 				ret = ops->vidioc_try_fmt_vbi_cap(file, fh, f);
 			break;
 		case V4L2_BUF_TYPE_VBI_OUTPUT:
 			CLEAR_AFTER_FIELD(f, fmt.vbi);
-			if (likely(ops->vidioc_try_fmt_vbi_out))
+			if (ops->vidioc_try_fmt_vbi_out)
 				ret = ops->vidioc_try_fmt_vbi_out(file, fh, f);
 			break;
 		case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
 			CLEAR_AFTER_FIELD(f, fmt.sliced);
-			if (likely(ops->vidioc_try_fmt_sliced_vbi_cap))
+			if (ops->vidioc_try_fmt_sliced_vbi_cap)
 				ret = ops->vidioc_try_fmt_sliced_vbi_cap(file,
 								fh, f);
 			break;
 		case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
 			CLEAR_AFTER_FIELD(f, fmt.sliced);
-			if (likely(ops->vidioc_try_fmt_sliced_vbi_out))
+			if (ops->vidioc_try_fmt_sliced_vbi_out)
 				ret = ops->vidioc_try_fmt_sliced_vbi_out(file,
 								fh, f);
 			break;
 		case V4L2_BUF_TYPE_PRIVATE:
-			/* CLEAR_AFTER_FIELD(f, fmt.raw_data); <- does nothing */
-			if (likely(ops->vidioc_try_fmt_type_private))
+			
+			if (ops->vidioc_try_fmt_type_private)
 				ret = ops->vidioc_try_fmt_type_private(file,
 								fh, f);
 			break;
 		}
-		if (unlikely(ret == -ENOTTY && have_fmt_ops(try)))
-			ret = -EINVAL;
+
 		break;
 	}
-	/* FIXME: Those buf reqs could be handled here,
-	   with some changes on videobuf to allow its header to be included at
-	   videodev2.h or being merged at videodev2.
-	 */
 	case VIDIOC_REQBUFS:
 	{
 		struct v4l2_requestbuffers *p = arg;
 
 		if (!ops->vidioc_reqbufs)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		ret = check_fmt(ops, p->type);
 		if (ret)
 			break;
@@ -959,10 +1120,6 @@
 
 		if (!ops->vidioc_overlay)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		dbgarg(cmd, "value=%d\n", *i);
 		ret = ops->vidioc_overlay(file, fh, *i);
 		break;
@@ -988,10 +1145,6 @@
 
 		if (!ops->vidioc_s_fbuf)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
 			p->capability, p->flags, (unsigned long)p->base);
 		v4l_print_pix_fmt(vfd, &p->fmt);
@@ -1004,10 +1157,6 @@
 
 		if (!ops->vidioc_streamon)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
 		ret = ops->vidioc_streamon(file, fh, i);
 		break;
@@ -1018,15 +1167,11 @@
 
 		if (!ops->vidioc_streamoff)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
 		ret = ops->vidioc_streamoff(file, fh, i);
 		break;
 	}
-	/* ---------- tv norms ---------- */
+	
 	case VIDIOC_ENUMSTD:
 	{
 		struct v4l2_standard *p = arg;
@@ -1034,14 +1179,8 @@
 		unsigned int index = p->index, i, j = 0;
 		const char *descr = "";
 
-		if (id == 0)
-			break;
-		ret = -EINVAL;
-
-		/* Return norm array in a canonical way */
+		
 		for (i = 0; i <= index && id; i++) {
-			/* last std value in the standards array is 0, so this
-			   while always ends there since (id & 0) == 0. */
 			while ((id & standards[j].std) != standards[j].std)
 				j++;
 			curr_id = standards[j].std;
@@ -1073,15 +1212,16 @@
 	{
 		v4l2_std_id *id = arg;
 
-		/* Calls the specific handler */
+		ret = 0;
+		
 		if (ops->vidioc_g_std)
 			ret = ops->vidioc_g_std(file, fh, id);
-		else if (vfd->current_norm) {
-			ret = 0;
+		else if (vfd->current_norm)
 			*id = vfd->current_norm;
-		}
+		else
+			ret = -EINVAL;
 
-		if (likely(!ret))
+		if (!ret)
 			dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id);
 		break;
 	}
@@ -1091,22 +1231,17 @@
 
 		dbgarg(cmd, "std=%08Lx\n", (long long unsigned)*id);
 
-		if (!ops->vidioc_s_std)
-			break;
-
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
-		ret = -EINVAL;
 		norm = (*id) & vfd->tvnorms;
-		if (vfd->tvnorms && !norm)	/* Check if std is supported */
+		if (vfd->tvnorms && !norm)	
 			break;
 
-		/* Calls the specific handler */
-		ret = ops->vidioc_s_std(file, fh, &norm);
+		
+		if (ops->vidioc_s_std)
+			ret = ops->vidioc_s_std(file, fh, &norm);
+		else
+			ret = -EINVAL;
 
-		/* Updates standard information */
+		
 		if (ret >= 0)
 			vfd->current_norm = norm;
 		break;
@@ -1117,32 +1252,18 @@
 
 		if (!ops->vidioc_querystd)
 			break;
-		/*
-		 * If nothing detected, it should return all supported
-		 * Drivers just need to mask the std argument, in order
-		 * to remove the standards that don't apply from the mask.
-		 * This means that tuners, audio and video decoders can join
-		 * their efforts to improve the standards detection
-		 */
-		*p = vfd->tvnorms;
 		ret = ops->vidioc_querystd(file, fh, arg);
 		if (!ret)
 			dbgarg(cmd, "detected std=%08Lx\n",
 						(unsigned long long)*p);
 		break;
 	}
-	/* ------ input switching ---------- */
-	/* FIXME: Inputs can be handled inside videodev2 */
+	
+	
 	case VIDIOC_ENUMINPUT:
 	{
 		struct v4l2_input *p = arg;
 
-		/*
-		 * We set the flags for CAP_PRESETS, CAP_CUSTOM_TIMINGS &
-		 * CAP_STD here based on ioctl handler provided by the
-		 * driver. If the driver doesn't support these
-		 * for a specific input, it must override these flags.
-		 */
 		if (ops->vidioc_s_std)
 			p->capabilities |= V4L2_IN_CAP_STD;
 		if (ops->vidioc_s_dv_preset)
@@ -1181,16 +1302,12 @@
 
 		if (!ops->vidioc_s_input)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		dbgarg(cmd, "value=%d\n", *i);
 		ret = ops->vidioc_s_input(file, fh, *i);
 		break;
 	}
 
-	/* ------ output switching ---------- */
+	
 	case VIDIOC_ENUMOUTPUT:
 	{
 		struct v4l2_output *p = arg;
@@ -1198,12 +1315,6 @@
 		if (!ops->vidioc_enum_output)
 			break;
 
-		/*
-		 * We set the flags for CAP_PRESETS, CAP_CUSTOM_TIMINGS &
-		 * CAP_STD here based on ioctl handler provided by the
-		 * driver. If the driver doesn't support these
-		 * for a specific output, it must override these flags.
-		 */
 		if (ops->vidioc_s_std)
 			p->capabilities |= V4L2_OUT_CAP_STD;
 		if (ops->vidioc_s_dv_preset)
@@ -1237,23 +1348,17 @@
 
 		if (!ops->vidioc_s_output)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		dbgarg(cmd, "value=%d\n", *i);
 		ret = ops->vidioc_s_output(file, fh, *i);
 		break;
 	}
 
-	/* --- controls ---------------------------------------------- */
+	
 	case VIDIOC_QUERYCTRL:
 	{
 		struct v4l2_queryctrl *p = arg;
 
-		if (vfh && vfh->ctrl_handler)
-			ret = v4l2_queryctrl(vfh->ctrl_handler, p);
-		else if (vfd->ctrl_handler)
+		if (vfd->ctrl_handler)
 			ret = v4l2_queryctrl(vfd->ctrl_handler, p);
 		else if (ops->vidioc_queryctrl)
 			ret = ops->vidioc_queryctrl(file, fh, p);
@@ -1273,9 +1378,7 @@
 	{
 		struct v4l2_control *p = arg;
 
-		if (vfh && vfh->ctrl_handler)
-			ret = v4l2_g_ctrl(vfh->ctrl_handler, p);
-		else if (vfd->ctrl_handler)
+		if (vfd->ctrl_handler)
 			ret = v4l2_g_ctrl(vfd->ctrl_handler, p);
 		else if (ops->vidioc_g_ctrl)
 			ret = ops->vidioc_g_ctrl(file, fh, p);
@@ -1307,22 +1410,14 @@
 		struct v4l2_ext_controls ctrls;
 		struct v4l2_ext_control ctrl;
 
-		if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler &&
+		if (!vfd->ctrl_handler &&
 			!ops->vidioc_s_ctrl && !ops->vidioc_s_ext_ctrls)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 
 		dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
 
-		if (vfh && vfh->ctrl_handler) {
-			ret = v4l2_s_ctrl(vfh, vfh->ctrl_handler, p);
-			break;
-		}
 		if (vfd->ctrl_handler) {
-			ret = v4l2_s_ctrl(NULL, vfd->ctrl_handler, p);
+			ret = v4l2_s_ctrl(vfd->ctrl_handler, p);
 			break;
 		}
 		if (ops->vidioc_s_ctrl) {
@@ -1339,8 +1434,6 @@
 		ctrl.value = p->value;
 		if (check_ext_ctrls(&ctrls, 1))
 			ret = ops->vidioc_s_ext_ctrls(file, fh, &ctrls);
-		else
-			ret = -EINVAL;
 		break;
 	}
 	case VIDIOC_G_EXT_CTRLS:
@@ -1348,14 +1441,10 @@
 		struct v4l2_ext_controls *p = arg;
 
 		p->error_idx = p->count;
-		if (vfh && vfh->ctrl_handler)
-			ret = v4l2_g_ext_ctrls(vfh->ctrl_handler, p);
-		else if (vfd->ctrl_handler)
+		if (vfd->ctrl_handler)
 			ret = v4l2_g_ext_ctrls(vfd->ctrl_handler, p);
-		else if (ops->vidioc_g_ext_ctrls)
-			ret = check_ext_ctrls(p, 0) ?
-				ops->vidioc_g_ext_ctrls(file, fh, p) :
-				-EINVAL;
+		else if (ops->vidioc_g_ext_ctrls && check_ext_ctrls(p, 0))
+			ret = ops->vidioc_g_ext_ctrls(file, fh, p);
 		else
 			break;
 		v4l_print_ext_ctrls(cmd, vfd, p, !ret);
@@ -1366,22 +1455,13 @@
 		struct v4l2_ext_controls *p = arg;
 
 		p->error_idx = p->count;
-		if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler &&
-				!ops->vidioc_s_ext_ctrls)
+		if (!vfd->ctrl_handler && !ops->vidioc_s_ext_ctrls)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		v4l_print_ext_ctrls(cmd, vfd, p, 1);
-		if (vfh && vfh->ctrl_handler)
-			ret = v4l2_s_ext_ctrls(vfh, vfh->ctrl_handler, p);
-		else if (vfd->ctrl_handler)
-			ret = v4l2_s_ext_ctrls(NULL, vfd->ctrl_handler, p);
+		if (vfd->ctrl_handler)
+			ret = v4l2_s_ext_ctrls(vfd->ctrl_handler, p);
 		else if (check_ext_ctrls(p, 0))
 			ret = ops->vidioc_s_ext_ctrls(file, fh, p);
-		else
-			ret = -EINVAL;
 		break;
 	}
 	case VIDIOC_TRY_EXT_CTRLS:
@@ -1389,27 +1469,20 @@
 		struct v4l2_ext_controls *p = arg;
 
 		p->error_idx = p->count;
-		if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler &&
-				!ops->vidioc_try_ext_ctrls)
+		if (!vfd->ctrl_handler && !ops->vidioc_try_ext_ctrls)
 			break;
 		v4l_print_ext_ctrls(cmd, vfd, p, 1);
-		if (vfh && vfh->ctrl_handler)
-			ret = v4l2_try_ext_ctrls(vfh->ctrl_handler, p);
-		else if (vfd->ctrl_handler)
+		if (vfd->ctrl_handler)
 			ret = v4l2_try_ext_ctrls(vfd->ctrl_handler, p);
 		else if (check_ext_ctrls(p, 0))
 			ret = ops->vidioc_try_ext_ctrls(file, fh, p);
-		else
-			ret = -EINVAL;
 		break;
 	}
 	case VIDIOC_QUERYMENU:
 	{
 		struct v4l2_querymenu *p = arg;
 
-		if (vfh && vfh->ctrl_handler)
-			ret = v4l2_querymenu(vfh->ctrl_handler, p);
-		else if (vfd->ctrl_handler)
+		if (vfd->ctrl_handler)
 			ret = v4l2_querymenu(vfd->ctrl_handler, p);
 		else if (ops->vidioc_querymenu)
 			ret = ops->vidioc_querymenu(file, fh, p);
@@ -1423,7 +1496,7 @@
 				p->id, p->index);
 		break;
 	}
-	/* --- audio ---------------------------------------------- */
+	
 	case VIDIOC_ENUMAUDIO:
 	{
 		struct v4l2_audio *p = arg;
@@ -1461,10 +1534,6 @@
 
 		if (!ops->vidioc_s_audio)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
 					"mode=0x%x\n", p->index, p->name,
 					p->capability, p->mode);
@@ -1505,10 +1574,6 @@
 
 		if (!ops->vidioc_s_audout)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		dbgarg(cmd, "index=%d, name=%s, capability=%d, "
 					"mode=%d\n", p->index, p->name,
 					p->capability, p->mode);
@@ -1538,10 +1603,6 @@
 
 		if (!ops->vidioc_s_modulator)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		dbgarg(cmd, "index=%d, name=%s, capability=%d, "
 				"rangelow=%d, rangehigh=%d, txsubchans=%d\n",
 				p->index, p->name, p->capability, p->rangelow,
@@ -1553,32 +1614,11 @@
 	{
 		struct v4l2_crop *p = arg;
 
-		if (!ops->vidioc_g_crop && !ops->vidioc_g_selection)
+		if (!ops->vidioc_g_crop)
 			break;
 
 		dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
-
-		if (ops->vidioc_g_crop) {
-			ret = ops->vidioc_g_crop(file, fh, p);
-		} else {
-			/* simulate capture crop using selection api */
-			struct v4l2_selection s = {
-				.type = p->type,
-			};
-
-			/* crop means compose for output devices */
-			if (V4L2_TYPE_IS_OUTPUT(p->type))
-				s.target = V4L2_SEL_TGT_COMPOSE_ACTIVE;
-			else
-				s.target = V4L2_SEL_TGT_CROP_ACTIVE;
-
-			ret = ops->vidioc_g_selection(file, fh, &s);
-
-			/* copying results to old structure on success */
-			if (!ret)
-				p->c = s.r;
-		}
-
+		ret = ops->vidioc_g_crop(file, fh, p);
 		if (!ret)
 			dbgrect(vfd, "", &p->c);
 		break;
@@ -1587,108 +1627,23 @@
 	{
 		struct v4l2_crop *p = arg;
 
-		if (!ops->vidioc_s_crop && !ops->vidioc_s_selection)
+		if (!ops->vidioc_s_crop)
 			break;
-
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
 		dbgrect(vfd, "", &p->c);
-
-		if (ops->vidioc_s_crop) {
-			ret = ops->vidioc_s_crop(file, fh, p);
-		} else {
-			/* simulate capture crop using selection api */
-			struct v4l2_selection s = {
-				.type = p->type,
-				.r = p->c,
-			};
-
-			/* crop means compose for output devices */
-			if (V4L2_TYPE_IS_OUTPUT(p->type))
-				s.target = V4L2_SEL_TGT_COMPOSE_ACTIVE;
-			else
-				s.target = V4L2_SEL_TGT_CROP_ACTIVE;
-
-			ret = ops->vidioc_s_selection(file, fh, &s);
-		}
-		break;
-	}
-	case VIDIOC_G_SELECTION:
-	{
-		struct v4l2_selection *p = arg;
-
-		if (!ops->vidioc_g_selection)
-			break;
-
-		dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
-
-		ret = ops->vidioc_g_selection(file, fh, p);
-		if (!ret)
-			dbgrect(vfd, "", &p->r);
-		break;
-	}
-	case VIDIOC_S_SELECTION:
-	{
-		struct v4l2_selection *p = arg;
-
-		if (!ops->vidioc_s_selection)
-			break;
-
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
-
-		dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
-		dbgrect(vfd, "", &p->r);
-
-		ret = ops->vidioc_s_selection(file, fh, p);
+		ret = ops->vidioc_s_crop(file, fh, p);
 		break;
 	}
 	case VIDIOC_CROPCAP:
 	{
 		struct v4l2_cropcap *p = arg;
 
-		/*FIXME: Should also show v4l2_fract pixelaspect */
-		if (!ops->vidioc_cropcap && !ops->vidioc_g_selection)
+		
+		if (!ops->vidioc_cropcap)
 			break;
 
 		dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
-		if (ops->vidioc_cropcap) {
-			ret = ops->vidioc_cropcap(file, fh, p);
-		} else {
-			struct v4l2_selection s = { .type = p->type };
-
-			/* obtaining bounds */
-			if (V4L2_TYPE_IS_OUTPUT(p->type))
-				s.target = V4L2_SEL_TGT_COMPOSE_BOUNDS;
-			else
-				s.target = V4L2_SEL_TGT_CROP_BOUNDS;
-
-			ret = ops->vidioc_g_selection(file, fh, &s);
-			if (ret)
-				break;
-			p->bounds = s.r;
-
-			/* obtaining defrect */
-			if (V4L2_TYPE_IS_OUTPUT(p->type))
-				s.target = V4L2_SEL_TGT_COMPOSE_DEFAULT;
-			else
-				s.target = V4L2_SEL_TGT_CROP_DEFAULT;
-
-			ret = ops->vidioc_g_selection(file, fh, &s);
-			if (ret)
-				break;
-			p->defrect = s.r;
-
-			/* setting trivial pixelaspect */
-			p->pixelaspect.numerator = 1;
-			p->pixelaspect.denominator = 1;
-		}
-
+		ret = ops->vidioc_cropcap(file, fh, p);
 		if (!ret) {
 			dbgrect(vfd, "bounds ", &p->bounds);
 			dbgrect(vfd, "defrect ", &p->defrect);
@@ -1717,15 +1672,11 @@
 
 		if (!ops->vidioc_g_jpegcomp)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		dbgarg(cmd, "quality=%d, APPn=%d, APP_len=%d, "
 					"COM_len=%d, jpeg_markers=%d\n",
 					p->quality, p->APPn, p->APP_len,
 					p->COM_len, p->jpeg_markers);
-		ret = ops->vidioc_s_jpegcomp(file, fh, p);
+			ret = ops->vidioc_s_jpegcomp(file, fh, p);
 		break;
 	}
 	case VIDIOC_G_ENC_INDEX:
@@ -1746,10 +1697,6 @@
 
 		if (!ops->vidioc_encoder_cmd)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		ret = ops->vidioc_encoder_cmd(file, fh, p);
 		if (!ret)
 			dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
@@ -1766,38 +1713,10 @@
 			dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
 		break;
 	}
-	case VIDIOC_DECODER_CMD:
-	{
-		struct v4l2_decoder_cmd *p = arg;
-
-		if (!ops->vidioc_decoder_cmd)
-			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
-		ret = ops->vidioc_decoder_cmd(file, fh, p);
-		if (!ret)
-			dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
-		break;
-	}
-	case VIDIOC_TRY_DECODER_CMD:
-	{
-		struct v4l2_decoder_cmd *p = arg;
-
-		if (!ops->vidioc_try_decoder_cmd)
-			break;
-		ret = ops->vidioc_try_decoder_cmd(file, fh, p);
-		if (!ret)
-			dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
-		break;
-	}
 	case VIDIOC_G_PARM:
 	{
 		struct v4l2_streamparm *p = arg;
 
-		if (!ops->vidioc_g_parm && !vfd->current_norm)
-			break;
 		if (ops->vidioc_g_parm) {
 			ret = check_fmt(ops, p->type);
 			if (ret)
@@ -1806,13 +1725,14 @@
 		} else {
 			v4l2_std_id std = vfd->current_norm;
 
-			ret = -EINVAL;
 			if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
 				break;
 
 			ret = 0;
 			if (ops->vidioc_g_std)
 				ret = ops->vidioc_g_std(file, fh, &std);
+			else if (std == 0)
+				ret = -EINVAL;
 			if (ret == 0)
 				v4l2_video_std_frame_period(std,
 						    &p->parm.capture.timeperframe);
@@ -1827,10 +1747,6 @@
 
 		if (!ops->vidioc_s_parm)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		ret = check_fmt(ops, p->type);
 		if (ret)
 			break;
@@ -1866,10 +1782,6 @@
 
 		if (!ops->vidioc_s_tuner)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
 			V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 		dbgarg(cmd, "index=%d, name=%s, type=%d, "
@@ -1901,22 +1813,12 @@
 	case VIDIOC_S_FREQUENCY:
 	{
 		struct v4l2_frequency *p = arg;
-		enum v4l2_tuner_type type;
 
 		if (!ops->vidioc_s_frequency)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
-		type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
-			V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 		dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
 				p->tuner, p->type, p->frequency);
-		if (p->type != type)
-			ret = -EINVAL;
-		else
-			ret = ops->vidioc_s_frequency(file, fh, p);
+		ret = ops->vidioc_s_frequency(file, fh, p);
 		break;
 	}
 	case VIDIOC_G_SLICED_VBI_CAP:
@@ -1926,7 +1828,7 @@
 		if (!ops->vidioc_g_sliced_vbi_cap)
 			break;
 
-		/* Clear up to type, everything after type is zerod already */
+		
 		memset(p, 0, offsetof(struct v4l2_sliced_vbi_cap, type));
 
 		dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
@@ -1939,13 +1841,7 @@
 	{
 		if (!ops->vidioc_log_status)
 			break;
-		if (vfd->v4l2_dev)
-			pr_info("%s: =================  START STATUS  =================\n",
-				vfd->v4l2_dev->name);
 		ret = ops->vidioc_log_status(file, fh);
-		if (vfd->v4l2_dev)
-			pr_info("%s: ==================  END STATUS  ==================\n",
-				vfd->v4l2_dev->name);
 		break;
 	}
 #ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -1994,10 +1890,6 @@
 
 		if (!ops->vidioc_s_hw_freq_seek)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 		type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
 			V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 		dbgarg(cmd,
@@ -2102,10 +1994,6 @@
 
 		if (!ops->vidioc_s_dv_preset)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 
 		dbgarg(cmd, "preset=%d\n", p->preset);
 		ret = ops->vidioc_s_dv_preset(file, fh, p);
@@ -2141,10 +2029,6 @@
 
 		if (!ops->vidioc_s_dv_timings)
 			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
 
 		switch (p->type) {
 		case V4L2_DV_BT_656_1120:
@@ -2252,47 +2136,20 @@
 		dbgarg(cmd, "type=0x%8.8x", sub->type);
 		break;
 	}
-	case VIDIOC_CREATE_BUFS:
-	{
-		struct v4l2_create_buffers *create = arg;
-
-		if (!ops->vidioc_create_bufs)
-			break;
-		if (ret_prio) {
-			ret = ret_prio;
-			break;
-		}
-		ret = check_fmt(ops, create->format.type);
-		if (ret)
-			break;
-
-		ret = ops->vidioc_create_bufs(file, fh, create);
-
-		dbgarg(cmd, "count=%d @ %d\n", create->count, create->index);
-		break;
-	}
-	case VIDIOC_PREPARE_BUF:
-	{
-		struct v4l2_buffer *b = arg;
-
-		if (!ops->vidioc_prepare_buf)
-			break;
-		ret = check_fmt(ops, b->type);
-		if (ret)
-			break;
-
-		ret = ops->vidioc_prepare_buf(file, fh, b);
-
-		dbgarg(cmd, "index=%d", b->index);
-		break;
-	}
 	default:
+	{
+		bool valid_prio = true;
+
 		if (!ops->vidioc_default)
 			break;
-		ret = ops->vidioc_default(file, fh, ret_prio >= 0, cmd, arg);
+		if (use_fh_prio)
+			valid_prio = v4l2_prio_check(vfd->prio, vfh->prio) >= 0;
+		ret = ops->vidioc_default(file, fh, valid_prio, cmd, arg);
 		break;
-	} /* switch */
+	}
+	} 
 
+exit_prio:
 	if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {
 		if (ret < 0) {
 			v4l_print_ioctl(vfd->name, cmd);
@@ -2303,12 +2160,9 @@
 	return ret;
 }
 
-/* In some cases, only a few fields are used as input, i.e. when the app sets
- * "index" and then the driver fills in the rest of the structure for the thing
- * with that index.  We only need to copy up the first non-input field.  */
 static unsigned long cmd_input_size(unsigned int cmd)
 {
-	/* Size of structure up to and including 'field' */
+	
 #define CMDINSIZE(cmd, type, field) 				\
 	case VIDIOC_##cmd: 					\
 		return offsetof(struct v4l2_##type, field) + 	\
@@ -2359,7 +2213,7 @@
 				break;
 			}
 			*user_ptr = (void __user *)buf->m.planes;
-			*kernel_ptr = (void *)&buf->m.planes;
+			*kernel_ptr = (void **)&buf->m.planes;
 			*array_size = sizeof(struct v4l2_plane) * buf->length;
 			ret = 1;
 		}
@@ -2377,7 +2231,7 @@
 				break;
 			}
 			*user_ptr = (void __user *)ctrls->controls;
-			*kernel_ptr = (void *)&ctrls->controls;
+			*kernel_ptr = (void **)&ctrls->controls;
 			*array_size = sizeof(struct v4l2_ext_control)
 				    * ctrls->count;
 			ret = 1;
@@ -2402,12 +2256,12 @@
 	void __user *user_ptr = NULL;
 	void	**kernel_ptr = NULL;
 
-	/*  Copy arguments into temp kernel buffer  */
+	
 	if (_IOC_DIR(cmd) != _IOC_NONE) {
 		if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
 			parg = sbuf;
 		} else {
-			/* too big to allocate from stack */
+			
 			mbuf = kmalloc(_IOC_SIZE(cmd), GFP_KERNEL);
 			if (NULL == mbuf)
 				return -ENOMEM;
@@ -2421,11 +2275,11 @@
 			if (copy_from_user(parg, (void __user *)arg, n))
 				goto out;
 
-			/* zero out anything we don't copy from userspace */
+			
 			if (n < _IOC_SIZE(cmd))
 				memset((u8 *)parg + n, 0, _IOC_SIZE(cmd) - n);
 		} else {
-			/* read-only ioctl */
+			
 			memset(parg, 0, _IOC_SIZE(cmd));
 		}
 	}
@@ -2436,12 +2290,6 @@
 	has_array_args = err;
 
 	if (has_array_args) {
-		/*
-		 * When adding new types of array args, make sure that the
-		 * parent argument to ioctl (which contains the pointer to the
-		 * array) fits into sbuf (so that mbuf will still remain
-		 * unused up to here).
-		 */
 		mbuf = kmalloc(array_size, GFP_KERNEL);
 		err = -ENOMEM;
 		if (NULL == mbuf)
@@ -2452,10 +2300,10 @@
 		*kernel_ptr = mbuf;
 	}
 
-	/* Handles IOCTL */
+	
 	err = func(file, cmd, parg);
 	if (err == -ENOIOCTLCMD)
-		err = -ENOTTY;
+		err = -EINVAL;
 
 	if (has_array_args) {
 		*kernel_ptr = user_ptr;
@@ -2467,7 +2315,7 @@
 		goto out;
 
 out_array_args:
-	/*  Copy results into user buffer  */
+	
 	switch (_IOC_DIR(cmd)) {
 	case _IOC_READ:
 	case (_IOC_WRITE | _IOC_READ):
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c
index 6fe88e9..2d1560a 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -20,11 +20,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/module.h>
 #include <linux/ioctl.h>
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <linux/videodev2.h>
-#include <linux/export.h>
 
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
@@ -35,7 +35,7 @@
 static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)
 {
 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
-	/* Allocate try format and crop in the same memory block */
+	
 	fh->try_fmt = kzalloc((sizeof(*fh->try_fmt) + sizeof(*fh->try_crop))
 			      * sd->entity.num_pads, GFP_KERNEL);
 	if (fh->try_fmt == NULL)
@@ -76,7 +76,20 @@
 		return ret;
 	}
 
-	v4l2_fh_init(&subdev_fh->vfh, vdev);
+	ret = v4l2_fh_init(&subdev_fh->vfh, vdev);
+	if (ret)
+		goto err;
+
+	if (sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS) {
+		ret = v4l2_event_init(&subdev_fh->vfh);
+		if (ret)
+			goto err;
+
+		ret = v4l2_event_alloc(&subdev_fh->vfh, sd->nevents);
+		if (ret)
+			goto err;
+	}
+
 	v4l2_fh_add(&subdev_fh->vfh);
 	file->private_data = &subdev_fh->vfh;
 #if defined(CONFIG_MEDIA_CONTROLLER)
@@ -143,25 +156,25 @@
 
 	switch (cmd) {
 	case VIDIOC_QUERYCTRL:
-		return v4l2_queryctrl(vfh->ctrl_handler, arg);
+		return v4l2_queryctrl(sd->ctrl_handler, arg);
 
 	case VIDIOC_QUERYMENU:
-		return v4l2_querymenu(vfh->ctrl_handler, arg);
+		return v4l2_querymenu(sd->ctrl_handler, arg);
 
 	case VIDIOC_G_CTRL:
-		return v4l2_g_ctrl(vfh->ctrl_handler, arg);
+		return v4l2_g_ctrl(sd->ctrl_handler, arg);
 
 	case VIDIOC_S_CTRL:
-		return v4l2_s_ctrl(vfh, vfh->ctrl_handler, arg);
+		return v4l2_s_ctrl(sd->ctrl_handler, arg);
 
 	case VIDIOC_G_EXT_CTRLS:
-		return v4l2_g_ext_ctrls(vfh->ctrl_handler, arg);
+		return v4l2_g_ext_ctrls(sd->ctrl_handler, arg);
 
 	case VIDIOC_S_EXT_CTRLS:
-		return v4l2_s_ext_ctrls(vfh, vfh->ctrl_handler, arg);
+		return v4l2_s_ext_ctrls(sd->ctrl_handler, arg);
 
 	case VIDIOC_TRY_EXT_CTRLS:
-		return v4l2_try_ext_ctrls(vfh->ctrl_handler, arg);
+		return v4l2_try_ext_ctrls(sd->ctrl_handler, arg);
 
 	case VIDIOC_DQEVENT:
 		if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS))
@@ -174,37 +187,6 @@
 
 	case VIDIOC_UNSUBSCRIBE_EVENT:
 		return v4l2_subdev_call(sd, core, unsubscribe_event, vfh, arg);
-
-#ifdef CONFIG_VIDEO_ADV_DEBUG
-	case VIDIOC_DBG_G_REGISTER:
-	{
-		struct v4l2_dbg_register *p = arg;
-
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-		return v4l2_subdev_call(sd, core, g_register, p);
-	}
-	case VIDIOC_DBG_S_REGISTER:
-	{
-		struct v4l2_dbg_register *p = arg;
-
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-		return v4l2_subdev_call(sd, core, s_register, p);
-	}
-#endif
-
-	case VIDIOC_LOG_STATUS: {
-		int ret;
-
-		pr_info("%s: =================  START STATUS  =================\n",
-			sd->name);
-		ret = v4l2_subdev_call(sd, core, log_status);
-		pr_info("%s: ==================  END STATUS  ==================\n",
-			sd->name);
-		return ret;
-	}
-
 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
 	case VIDIOC_SUBDEV_G_FMT: {
 		struct v4l2_subdev_format *format = arg;
@@ -316,7 +298,7 @@
 	if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS))
 		return POLLERR;
 
-	poll_wait(file, &fh->wait, wait);
+	poll_wait(file, &fh->events->wait, wait);
 
 	if (v4l2_event_pending(fh))
 		return POLLPRI;
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c
index ac48afd..de4fa4e 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -330,7 +330,6 @@
 		break;
 	case V4L2_MEMORY_USERPTR:
 		b->m.userptr = vb->baddr;
-		b->reserved = vb->boff;
 		b->length    = vb->bsize;
 		break;
 	case V4L2_MEMORY_OVERLAY:
@@ -601,7 +600,6 @@
 		    buf->baddr != b->m.userptr)
 			q->ops->buf_release(q, buf);
 		buf->baddr = b->m.userptr;
-		buf->boff = b->reserved;
 		break;
 	case V4L2_MEMORY_OVERLAY:
 		buf->boff = b->m.offset;
@@ -1140,6 +1138,8 @@
 			buf = list_entry(q->stream.next,
 					 struct videobuf_buffer, stream);
 	} else {
+		if (!q->reading)
+			__videobuf_read_start(q);
 		if (!q->reading) {
 			rc = POLLERR;
 		} else if (NULL == q->read_buf) {
diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c
index a7d13a8..6951a42 100644
--- a/drivers/media/video/videobuf2-core.c
+++ b/drivers/media/video/videobuf2-core.c
@@ -30,7 +30,7 @@
 			printk(KERN_DEBUG "vb2: " fmt, ## arg);		\
 	} while (0)
 
-#define call_memop(q, op, args...)					\
+#define call_memop(q, plane, op, args...)				\
 	(((q)->mem_ops->op) ?						\
 		((q)->mem_ops->op(args)) : 0)
 
@@ -38,99 +38,76 @@
 	(((q)->ops->op) ? ((q)->ops->op(args)) : 0)
 
 #define V4L2_BUFFER_STATE_FLAGS	(V4L2_BUF_FLAG_MAPPED | V4L2_BUF_FLAG_QUEUED | \
-				 V4L2_BUF_FLAG_DONE | V4L2_BUF_FLAG_ERROR | \
-				 V4L2_BUF_FLAG_PREPARED)
+				 V4L2_BUF_FLAG_DONE | V4L2_BUF_FLAG_ERROR)
 
-/**
- * __vb2_buf_mem_alloc() - allocate video memory for the given buffer
- */
-static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
+static int __vb2_buf_mem_alloc(struct vb2_buffer *vb,
+				unsigned long *plane_sizes)
 {
 	struct vb2_queue *q = vb->vb2_queue;
 	void *mem_priv;
 	int plane;
 
-	/* Allocate memory for all planes in this buffer */
+	
 	for (plane = 0; plane < vb->num_planes; ++plane) {
-		mem_priv = call_memop(q, alloc, q->alloc_ctx[plane],
-				      q->plane_sizes[plane]);
+		mem_priv = call_memop(q, plane, alloc, q->alloc_ctx[plane],
+					plane_sizes[plane]);
 		if (IS_ERR_OR_NULL(mem_priv))
 			goto free;
 
-		/* Associate allocator private data with this plane */
+		
 		vb->planes[plane].mem_priv = mem_priv;
-		vb->v4l2_planes[plane].length = q->plane_sizes[plane];
+		vb->v4l2_planes[plane].length = plane_sizes[plane];
 	}
 
 	return 0;
 free:
-	/* Free already allocated memory if one of the allocations failed */
-	for (; plane > 0; --plane) {
-		call_memop(q, put, vb->planes[plane - 1].mem_priv);
-		vb->planes[plane - 1].mem_priv = NULL;
-	}
+	
+	for (; plane > 0; --plane)
+		call_memop(q, plane, put, vb->planes[plane - 1].mem_priv);
 
 	return -ENOMEM;
 }
 
-/**
- * __vb2_buf_mem_free() - free memory of the given buffer
- */
 static void __vb2_buf_mem_free(struct vb2_buffer *vb)
 {
 	struct vb2_queue *q = vb->vb2_queue;
 	unsigned int plane;
 
 	for (plane = 0; plane < vb->num_planes; ++plane) {
-		call_memop(q, put, vb->planes[plane].mem_priv);
+		call_memop(q, plane, put, vb->planes[plane].mem_priv);
 		vb->planes[plane].mem_priv = NULL;
-		dprintk(3, "Freed plane %d of buffer %d\n", plane,
-			vb->v4l2_buf.index);
+		dprintk(3, "Freed plane %d of buffer %d\n",
+				plane, vb->v4l2_buf.index);
 	}
 }
 
-/**
- * __vb2_buf_userptr_put() - release userspace memory associated with
- * a USERPTR buffer
- */
 static void __vb2_buf_userptr_put(struct vb2_buffer *vb)
 {
 	struct vb2_queue *q = vb->vb2_queue;
 	unsigned int plane;
 
 	for (plane = 0; plane < vb->num_planes; ++plane) {
-		if (vb->planes[plane].mem_priv)
-			call_memop(q, put_userptr, vb->planes[plane].mem_priv);
-		vb->planes[plane].mem_priv = NULL;
+		void *mem_priv = vb->planes[plane].mem_priv;
+
+		if (mem_priv) {
+			call_memop(q, plane, put_userptr, mem_priv);
+			vb->planes[plane].mem_priv = NULL;
+		}
 	}
 }
 
-/**
- * __setup_offsets() - setup unique offsets ("cookies") for every plane in
- * every buffer on the queue
- */
-static void __setup_offsets(struct vb2_queue *q, unsigned int n)
+static void __setup_offsets(struct vb2_queue *q)
 {
 	unsigned int buffer, plane;
 	struct vb2_buffer *vb;
-	unsigned long off;
+	unsigned long off = 0;
 
-	if (q->num_buffers) {
-		struct v4l2_plane *p;
-		vb = q->bufs[q->num_buffers - 1];
-		p = &vb->v4l2_planes[vb->num_planes - 1];
-		off = PAGE_ALIGN(p->m.mem_offset + p->length);
-	} else {
-		off = 0;
-	}
-
-	for (buffer = q->num_buffers; buffer < q->num_buffers + n; ++buffer) {
+	for (buffer = 0; buffer < q->num_buffers; ++buffer) {
 		vb = q->bufs[buffer];
 		if (!vb)
 			continue;
 
 		for (plane = 0; plane < vb->num_planes; ++plane) {
-			vb->v4l2_planes[plane].length = q->plane_sizes[plane];
 			vb->v4l2_planes[plane].m.mem_offset = off;
 
 			dprintk(3, "Buffer %d, plane %d offset 0x%08lx\n",
@@ -142,53 +119,42 @@
 	}
 }
 
-/**
- * __vb2_queue_alloc() - allocate videobuf buffer structures and (for MMAP type)
- * video buffer memory for all buffers/planes on the queue and initializes the
- * queue
- *
- * Returns the number of buffers successfully allocated.
- */
 static int __vb2_queue_alloc(struct vb2_queue *q, enum v4l2_memory memory,
-			     unsigned int num_buffers, unsigned int num_planes)
+			     unsigned int num_buffers, unsigned int num_planes,
+			     unsigned long plane_sizes[])
 {
 	unsigned int buffer;
 	struct vb2_buffer *vb;
 	int ret;
 
 	for (buffer = 0; buffer < num_buffers; ++buffer) {
-		/* Allocate videobuf buffer structures */
+		
 		vb = kzalloc(q->buf_struct_size, GFP_KERNEL);
 		if (!vb) {
 			dprintk(1, "Memory alloc for buffer struct failed\n");
 			break;
 		}
 
-		/* Length stores number of planes for multiplanar buffers */
+		
 		if (V4L2_TYPE_IS_MULTIPLANAR(q->type))
 			vb->v4l2_buf.length = num_planes;
 
 		vb->state = VB2_BUF_STATE_DEQUEUED;
 		vb->vb2_queue = q;
 		vb->num_planes = num_planes;
-		vb->v4l2_buf.index = q->num_buffers + buffer;
+		vb->v4l2_buf.index = buffer;
 		vb->v4l2_buf.type = q->type;
 		vb->v4l2_buf.memory = memory;
 
-		/* Allocate video buffer memory for the MMAP type */
+		
 		if (memory == V4L2_MEMORY_MMAP) {
-			ret = __vb2_buf_mem_alloc(vb);
+			ret = __vb2_buf_mem_alloc(vb, plane_sizes);
 			if (ret) {
 				dprintk(1, "Failed allocating memory for "
 						"buffer %d\n", buffer);
 				kfree(vb);
 				break;
 			}
-			/*
-			 * Call the driver-provided buffer initialization
-			 * callback, if given. An error in initialization
-			 * results in queue setup failure.
-			 */
 			ret = call_qop(q, buf_init, vb);
 			if (ret) {
 				dprintk(1, "Buffer %d %p initialization"
@@ -199,32 +165,30 @@
 			}
 		}
 
-		q->bufs[q->num_buffers + buffer] = vb;
+		q->bufs[buffer] = vb;
 	}
 
-	__setup_offsets(q, buffer);
+	q->num_buffers = buffer;
+
+	__setup_offsets(q);
 
 	dprintk(1, "Allocated %d buffers, %d plane(s) each\n",
-			buffer, num_planes);
+			q->num_buffers, num_planes);
 
 	return buffer;
 }
 
-/**
- * __vb2_free_mem() - release all video buffer memory for a given queue
- */
-static void __vb2_free_mem(struct vb2_queue *q, unsigned int buffers)
+static void __vb2_free_mem(struct vb2_queue *q)
 {
 	unsigned int buffer;
 	struct vb2_buffer *vb;
 
-	for (buffer = q->num_buffers - buffers; buffer < q->num_buffers;
-	     ++buffer) {
+	for (buffer = 0; buffer < q->num_buffers; ++buffer) {
 		vb = q->bufs[buffer];
 		if (!vb)
 			continue;
 
-		/* Free MMAP buffers or release USERPTR buffers */
+		
 		if (q->memory == V4L2_MEMORY_MMAP)
 			__vb2_buf_mem_free(vb);
 		else
@@ -232,48 +196,35 @@
 	}
 }
 
-/**
- * __vb2_queue_free() - free buffers at the end of the queue - video memory and
- * related information, if no buffers are left return the queue to an
- * uninitialized state. Might be called even if the queue has already been freed.
- */
-static void __vb2_queue_free(struct vb2_queue *q, unsigned int buffers)
+static void __vb2_queue_free(struct vb2_queue *q)
 {
 	unsigned int buffer;
 
-	/* Call driver-provided cleanup function for each buffer, if provided */
+	
 	if (q->ops->buf_cleanup) {
-		for (buffer = q->num_buffers - buffers; buffer < q->num_buffers;
-		     ++buffer) {
+		for (buffer = 0; buffer < q->num_buffers; ++buffer) {
 			if (NULL == q->bufs[buffer])
 				continue;
 			q->ops->buf_cleanup(q->bufs[buffer]);
 		}
 	}
 
-	/* Release video buffer memory */
-	__vb2_free_mem(q, buffers);
+	
+	__vb2_free_mem(q);
 
-	/* Free videobuf buffers */
-	for (buffer = q->num_buffers - buffers; buffer < q->num_buffers;
-	     ++buffer) {
+	
+	for (buffer = 0; buffer < q->num_buffers; ++buffer) {
 		kfree(q->bufs[buffer]);
 		q->bufs[buffer] = NULL;
 	}
 
-	q->num_buffers -= buffers;
-	if (!q->num_buffers)
-		q->memory = 0;
-	INIT_LIST_HEAD(&q->queued_list);
+	q->num_buffers = 0;
+	q->memory = 0;
 }
 
-/**
- * __verify_planes_array() - verify that the planes array passed in struct
- * v4l2_buffer from userspace can be safely used
- */
-static int __verify_planes_array(struct vb2_buffer *vb, const struct v4l2_buffer *b)
+static int __verify_planes_array(struct vb2_buffer *vb, struct v4l2_buffer *b)
 {
-	/* Is memory for copying plane information present? */
+	
 	if (NULL == b->m.planes) {
 		dprintk(1, "Multi-planar buffer passed but "
 			   "planes array not provided\n");
@@ -289,51 +240,12 @@
 	return 0;
 }
 
-/**
- * __buffer_in_use() - return true if the buffer is in use and
- * the queue cannot be freed (by the means of REQBUFS(0)) call
- */
-static bool __buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb)
-{
-	unsigned int plane;
-	for (plane = 0; plane < vb->num_planes; ++plane) {
-		void *mem_priv = vb->planes[plane].mem_priv;
-		/*
-		 * If num_users() has not been provided, call_memop
-		 * will return 0, apparently nobody cares about this
-		 * case anyway. If num_users() returns more than 1,
-		 * we are not the only user of the plane's memory.
-		 */
-		if (mem_priv && call_memop(q, num_users, mem_priv) > 1)
-			return true;
-	}
-	return false;
-}
-
-/**
- * __buffers_in_use() - return true if any buffers on the queue are in use and
- * the queue cannot be freed (by the means of REQBUFS(0)) call
- */
-static bool __buffers_in_use(struct vb2_queue *q)
-{
-	unsigned int buffer;
-	for (buffer = 0; buffer < q->num_buffers; ++buffer) {
-		if (__buffer_in_use(q, q->bufs[buffer]))
-			return true;
-	}
-	return false;
-}
-
-/**
- * __fill_v4l2_buffer() - fill in a struct v4l2_buffer with information to be
- * returned to userspace
- */
 static int __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b)
 {
 	struct vb2_queue *q = vb->vb2_queue;
-	int ret;
+	int ret = 0;
 
-	/* Copy back data such as timestamp, flags, input, etc. */
+	
 	memcpy(b, &vb->v4l2_buf, offsetof(struct v4l2_buffer, m));
 	b->input = vb->v4l2_buf.input;
 	b->reserved = vb->v4l2_buf.reserved;
@@ -343,17 +255,9 @@
 		if (ret)
 			return ret;
 
-		/*
-		 * Fill in plane-related data if userspace provided an array
-		 * for it. The memory and size is verified above.
-		 */
 		memcpy(b->m.planes, vb->v4l2_planes,
 			b->length * sizeof(struct v4l2_plane));
 	} else {
-		/*
-		 * We use length and offset in v4l2_planes array even for
-		 * single-planar buffers, but userspace does not.
-		 */
 		b->length = vb->v4l2_planes[0].length;
 		b->bytesused = vb->v4l2_planes[0].bytesused;
 		if (q->memory == V4L2_MEMORY_MMAP)
@@ -362,9 +266,6 @@
 			b->m.userptr = vb->v4l2_planes[0].m.userptr;
 	}
 
-	/*
-	 * Clear any buffer state related flags.
-	 */
 	b->flags &= ~V4L2_BUFFER_STATE_FLAGS;
 
 	switch (vb->state) {
@@ -374,37 +275,21 @@
 		break;
 	case VB2_BUF_STATE_ERROR:
 		b->flags |= V4L2_BUF_FLAG_ERROR;
-		/* fall through */
+		
 	case VB2_BUF_STATE_DONE:
 		b->flags |= V4L2_BUF_FLAG_DONE;
 		break;
-	case VB2_BUF_STATE_PREPARED:
-		b->flags |= V4L2_BUF_FLAG_PREPARED;
-		break;
 	case VB2_BUF_STATE_DEQUEUED:
-		/* nothing */
+		
 		break;
 	}
 
-	if (__buffer_in_use(q, vb))
+	if (vb->num_planes_mapped == vb->num_planes)
 		b->flags |= V4L2_BUF_FLAG_MAPPED;
 
-	return 0;
+	return ret;
 }
 
-/**
- * vb2_querybuf() - query video buffer information
- * @q:		videobuf queue
- * @b:		buffer struct passed from userspace to vidioc_querybuf handler
- *		in driver
- *
- * Should be called from vidioc_querybuf ioctl handler in driver.
- * This function will verify the passed v4l2_buffer structure and fill the
- * relevant information for the userspace.
- *
- * The return values from this function are intended to be directly returned
- * from vidioc_querybuf handler in driver.
- */
 int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b)
 {
 	struct vb2_buffer *vb;
@@ -424,10 +309,6 @@
 }
 EXPORT_SYMBOL(vb2_querybuf);
 
-/**
- * __verify_userptr_ops() - verify that all memory operations required for
- * USERPTR queue type have been provided
- */
 static int __verify_userptr_ops(struct vb2_queue *q)
 {
 	if (!(q->io_modes & VB2_USERPTR) || !q->mem_ops->get_userptr ||
@@ -437,10 +318,6 @@
 	return 0;
 }
 
-/**
- * __verify_mmap_ops() - verify that all memory operations required for
- * MMAP queue type have been provided
- */
 static int __verify_mmap_ops(struct vb2_queue *q)
 {
 	if (!(q->io_modes & VB2_MMAP) || !q->mem_ops->alloc ||
@@ -450,33 +327,31 @@
 	return 0;
 }
 
-/**
- * vb2_reqbufs() - Initiate streaming
- * @q:		videobuf2 queue
- * @req:	struct passed from userspace to vidioc_reqbufs handler in driver
- *
- * Should be called from vidioc_reqbufs ioctl handler of a driver.
- * This function:
- * 1) verifies streaming parameters passed from the userspace,
- * 2) sets up the queue,
- * 3) negotiates number of buffers and planes per buffer with the driver
- *    to be used during streaming,
- * 4) allocates internal buffer structures (struct vb2_buffer), according to
- *    the agreed parameters,
- * 5) for MMAP memory type, allocates actual video memory, using the
- *    memory handling/allocation routines provided during queue initialization
- *
- * If req->count is 0, all the memory will be freed instead.
- * If the queue has been allocated previously (by a previous vb2_reqbufs) call
- * and the queue is not busy, memory will be reallocated.
- *
- * The return values from this function are intended to be directly returned
- * from vidioc_reqbufs handler in driver.
- */
+static bool __buffers_in_use(struct vb2_queue *q)
+{
+	unsigned int buffer, plane;
+	struct vb2_buffer *vb;
+
+	for (buffer = 0; buffer < q->num_buffers; ++buffer) {
+		vb = q->bufs[buffer];
+		for (plane = 0; plane < vb->num_planes; ++plane) {
+			if (call_memop(q, plane, num_users,
+					vb->planes[plane].mem_priv) > 1)
+				return true;
+		}
+	}
+
+	return false;
+}
+
 int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
 {
-	unsigned int num_buffers, allocated_buffers, num_planes = 0;
+	unsigned int num_buffers, num_planes;
+	unsigned long plane_sizes[VIDEO_MAX_PLANES];
 	int ret = 0;
+	
+	num_buffers = 0;
+	num_planes = 0;
 
 	if (q->fileio) {
 		dprintk(1, "reqbufs: file io in progress\n");
@@ -499,10 +374,6 @@
 		return -EBUSY;
 	}
 
-	/*
-	 * Make sure all the required memory ops for given memory type
-	 * are available.
-	 */
 	if (req->memory == V4L2_MEMORY_MMAP && __verify_mmap_ops(q)) {
 		dprintk(1, "reqbufs: MMAP for current setup unsupported\n");
 		return -EINVAL;
@@ -513,272 +384,89 @@
 		return -EINVAL;
 	}
 
-	/*
-	 * If the same number of buffers and memory access method is requested
-	 * then return immediately.
-	 */
 	if (q->memory == req->memory && req->count == q->num_buffers)
 		return 0;
 
 	if (req->count == 0 || q->num_buffers != 0 || q->memory != req->memory) {
-		/*
-		 * We already have buffers allocated, so first check if they
-		 * are not in use and can be freed.
-		 */
 		if (q->memory == V4L2_MEMORY_MMAP && __buffers_in_use(q)) {
 			dprintk(1, "reqbufs: memory in use, cannot free\n");
 			return -EBUSY;
 		}
 
-		__vb2_queue_free(q, q->num_buffers);
+		__vb2_queue_free(q);
 
-		/*
-		 * In case of REQBUFS(0) return immediately without calling
-		 * driver's queue_setup() callback and allocating resources.
-		 */
 		if (req->count == 0)
 			return 0;
 	}
 
-	/*
-	 * Make sure the requested values and current defaults are sane.
-	 */
 	num_buffers = min_t(unsigned int, req->count, VIDEO_MAX_FRAME);
-	memset(q->plane_sizes, 0, sizeof(q->plane_sizes));
+	memset(plane_sizes, 0, sizeof(plane_sizes));
 	memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx));
 	q->memory = req->memory;
 
-	/*
-	 * Ask the driver how many buffers and planes per buffer it requires.
-	 * Driver also sets the size and allocator context for each plane.
-	 */
-	ret = call_qop(q, queue_setup, q, NULL, &num_buffers, &num_planes,
-		       q->plane_sizes, q->alloc_ctx);
+	ret = call_qop(q, queue_setup, q, &num_buffers, &num_planes,
+		       plane_sizes, q->alloc_ctx);
 	if (ret)
 		return ret;
 
-	/* Finally, allocate buffers and video memory */
-	ret = __vb2_queue_alloc(q, req->memory, num_buffers, num_planes);
+	
+	ret = __vb2_queue_alloc(q, req->memory, num_buffers, num_planes,
+				plane_sizes);
 	if (ret == 0) {
 		dprintk(1, "Memory allocation failed\n");
 		return -ENOMEM;
 	}
 
-	allocated_buffers = ret;
+	if (ret < num_buffers) {
+		unsigned int orig_num_buffers;
 
-	/*
-	 * Check if driver can handle the allocated number of buffers.
-	 */
-	if (allocated_buffers < num_buffers) {
-		num_buffers = allocated_buffers;
+		orig_num_buffers = num_buffers = ret;
+		ret = call_qop(q, queue_setup, q, &num_buffers, &num_planes,
+			       plane_sizes, q->alloc_ctx);
+		if (ret)
+			goto free_mem;
 
-		ret = call_qop(q, queue_setup, q, NULL, &num_buffers,
-			       &num_planes, q->plane_sizes, q->alloc_ctx);
-
-		if (!ret && allocated_buffers < num_buffers)
+		if (orig_num_buffers < num_buffers) {
 			ret = -ENOMEM;
+			goto free_mem;
+		}
 
-		/*
-		 * Either the driver has accepted a smaller number of buffers,
-		 * or .queue_setup() returned an error
-		 */
+		ret = num_buffers;
 	}
 
-	q->num_buffers = allocated_buffers;
-
-	if (ret < 0) {
-		__vb2_queue_free(q, allocated_buffers);
-		return ret;
-	}
-
-	/*
-	 * Return the number of successfully allocated buffers
-	 * to the userspace.
-	 */
-	req->count = allocated_buffers;
+	req->count = ret;
 
 	return 0;
+
+free_mem:
+	__vb2_queue_free(q);
+	return ret;
 }
 EXPORT_SYMBOL_GPL(vb2_reqbufs);
 
-/**
- * vb2_create_bufs() - Allocate buffers and any required auxiliary structs
- * @q:		videobuf2 queue
- * @create:	creation parameters, passed from userspace to vidioc_create_bufs
- *		handler in driver
- *
- * Should be called from vidioc_create_bufs ioctl handler of a driver.
- * This function:
- * 1) verifies parameter sanity
- * 2) calls the .queue_setup() queue operation
- * 3) performs any necessary memory allocations
- *
- * The return values from this function are intended to be directly returned
- * from vidioc_create_bufs handler in driver.
- */
-int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create)
-{
-	unsigned int num_planes = 0, num_buffers, allocated_buffers;
-	int ret = 0;
-
-	if (q->fileio) {
-		dprintk(1, "%s(): file io in progress\n", __func__);
-		return -EBUSY;
-	}
-
-	if (create->memory != V4L2_MEMORY_MMAP
-			&& create->memory != V4L2_MEMORY_USERPTR) {
-		dprintk(1, "%s(): unsupported memory type\n", __func__);
-		return -EINVAL;
-	}
-
-	if (create->format.type != q->type) {
-		dprintk(1, "%s(): requested type is incorrect\n", __func__);
-		return -EINVAL;
-	}
-
-	/*
-	 * Make sure all the required memory ops for given memory type
-	 * are available.
-	 */
-	if (create->memory == V4L2_MEMORY_MMAP && __verify_mmap_ops(q)) {
-		dprintk(1, "%s(): MMAP for current setup unsupported\n", __func__);
-		return -EINVAL;
-	}
-
-	if (create->memory == V4L2_MEMORY_USERPTR && __verify_userptr_ops(q)) {
-		dprintk(1, "%s(): USERPTR for current setup unsupported\n", __func__);
-		return -EINVAL;
-	}
-
-	if (q->num_buffers == VIDEO_MAX_FRAME) {
-		dprintk(1, "%s(): maximum number of buffers already allocated\n",
-			__func__);
-		return -ENOBUFS;
-	}
-
-	create->index = q->num_buffers;
-
-	if (!q->num_buffers) {
-		memset(q->plane_sizes, 0, sizeof(q->plane_sizes));
-		memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx));
-		q->memory = create->memory;
-	}
-
-	num_buffers = min(create->count, VIDEO_MAX_FRAME - q->num_buffers);
-
-	/*
-	 * Ask the driver, whether the requested number of buffers, planes per
-	 * buffer and their sizes are acceptable
-	 */
-	ret = call_qop(q, queue_setup, q, &create->format, &num_buffers,
-		       &num_planes, q->plane_sizes, q->alloc_ctx);
-	if (ret)
-		return ret;
-
-	/* Finally, allocate buffers and video memory */
-	ret = __vb2_queue_alloc(q, create->memory, num_buffers,
-				num_planes);
-	if (ret < 0) {
-		dprintk(1, "Memory allocation failed with error: %d\n", ret);
-		return ret;
-	}
-
-	allocated_buffers = ret;
-
-	/*
-	 * Check if driver can handle the so far allocated number of buffers.
-	 */
-	if (ret < num_buffers) {
-		num_buffers = ret;
-
-		/*
-		 * q->num_buffers contains the total number of buffers, that the
-		 * queue driver has set up
-		 */
-		ret = call_qop(q, queue_setup, q, &create->format, &num_buffers,
-			       &num_planes, q->plane_sizes, q->alloc_ctx);
-
-		if (!ret && allocated_buffers < num_buffers)
-			ret = -ENOMEM;
-
-		/*
-		 * Either the driver has accepted a smaller number of buffers,
-		 * or .queue_setup() returned an error
-		 */
-	}
-
-	q->num_buffers += allocated_buffers;
-
-	if (ret < 0) {
-		__vb2_queue_free(q, allocated_buffers);
-		return ret;
-	}
-
-	/*
-	 * Return the number of successfully allocated buffers
-	 * to the userspace.
-	 */
-	create->count = allocated_buffers;
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(vb2_create_bufs);
-
-/**
- * vb2_plane_vaddr() - Return a kernel virtual address of a given plane
- * @vb:		vb2_buffer to which the plane in question belongs to
- * @plane_no:	plane number for which the address is to be returned
- *
- * This function returns a kernel virtual address of a given plane if
- * such a mapping exist, NULL otherwise.
- */
 void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no)
 {
 	struct vb2_queue *q = vb->vb2_queue;
 
-	if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv)
+	if (plane_no > vb->num_planes)
 		return NULL;
 
-	return call_memop(q, vaddr, vb->planes[plane_no].mem_priv);
+	return call_memop(q, plane_no, vaddr, vb->planes[plane_no].mem_priv);
 
 }
 EXPORT_SYMBOL_GPL(vb2_plane_vaddr);
 
-/**
- * vb2_plane_cookie() - Return allocator specific cookie for the given plane
- * @vb:		vb2_buffer to which the plane in question belongs to
- * @plane_no:	plane number for which the cookie is to be returned
- *
- * This function returns an allocator specific cookie for a given plane if
- * available, NULL otherwise. The allocator should provide some simple static
- * inline function, which would convert this cookie to the allocator specific
- * type that can be used directly by the driver to access the buffer. This can
- * be for example physical address, pointer to scatter list or IOMMU mapping.
- */
 void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no)
 {
 	struct vb2_queue *q = vb->vb2_queue;
 
-	if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv)
+	if (plane_no > vb->num_planes)
 		return NULL;
 
-	return call_memop(q, cookie, vb->planes[plane_no].mem_priv);
+	return call_memop(q, plane_no, cookie, vb->planes[plane_no].mem_priv);
 }
 EXPORT_SYMBOL_GPL(vb2_plane_cookie);
 
-/**
- * vb2_buffer_done() - inform videobuf that an operation on a buffer is finished
- * @vb:		vb2_buffer returned from the driver
- * @state:	either VB2_BUF_STATE_DONE if the operation finished successfully
- *		or VB2_BUF_STATE_ERROR if the operation finished with an error
- *
- * This function should be called by the driver after a hardware operation on
- * a buffer is finished and the buffer may be returned to userspace. The driver
- * cannot use this buffer anymore until it is queued back to it by videobuf
- * by the means of buf_queue callback. Only buffers previously queued to the
- * driver by buf_queue can be passed to this function.
- */
 void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state)
 {
 	struct vb2_queue *q = vb->vb2_queue;
@@ -793,43 +481,31 @@
 	dprintk(4, "Done processing on buffer %d, state: %d\n",
 			vb->v4l2_buf.index, vb->state);
 
-	/* Add the buffer to the done buffers list */
+	
 	spin_lock_irqsave(&q->done_lock, flags);
 	vb->state = state;
 	list_add_tail(&vb->done_entry, &q->done_list);
 	atomic_dec(&q->queued_count);
 	spin_unlock_irqrestore(&q->done_lock, flags);
 
-	/* Inform any processes that may be waiting for buffers */
+	
 	wake_up(&q->done_wq);
 }
 EXPORT_SYMBOL_GPL(vb2_buffer_done);
 
-/**
- * __fill_vb2_buffer() - fill a vb2_buffer with information provided in
- * a v4l2_buffer by the userspace
- */
-static int __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b,
+static int __fill_vb2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b,
 				struct v4l2_plane *v4l2_planes)
 {
 	unsigned int plane;
 	int ret;
 
 	if (V4L2_TYPE_IS_MULTIPLANAR(b->type)) {
-		/*
-		 * Verify that the userspace gave us a valid array for
-		 * plane information.
-		 */
 		ret = __verify_planes_array(vb, b);
 		if (ret)
 			return ret;
 
-		/* Fill in driver-provided information for OUTPUT types */
+		
 		if (V4L2_TYPE_IS_OUTPUT(b->type)) {
-			/*
-			 * Will have to go up to b->length when API starts
-			 * accepting variable number of planes.
-			 */
 			for (plane = 0; plane < vb->num_planes; ++plane) {
 				v4l2_planes[plane].bytesused =
 					b->m.planes[plane].bytesused;
@@ -847,12 +523,6 @@
 			}
 		}
 	} else {
-		/*
-		 * Single-planar buffers do not use planes array,
-		 * so fill in relevant v4l2_buffer struct fields instead.
-		 * In videobuf we use our internal V4l2_planes struct for
-		 * single-planar buffers as well, for simplicity.
-		 */
 		if (V4L2_TYPE_IS_OUTPUT(b->type))
 			v4l2_planes[0].bytesused = b->bytesused;
 
@@ -870,10 +540,7 @@
 	return 0;
 }
 
-/**
- * __qbuf_userptr() - handle qbuf of a USERPTR buffer
- */
-static int __qbuf_userptr(struct vb2_buffer *vb, const struct v4l2_buffer *b)
+static int __qbuf_userptr(struct vb2_buffer *vb, struct v4l2_buffer *b)
 {
 	struct v4l2_plane planes[VIDEO_MAX_PLANES];
 	struct vb2_queue *q = vb->vb2_queue;
@@ -882,90 +549,69 @@
 	int ret;
 	int write = !V4L2_TYPE_IS_OUTPUT(q->type);
 
-	/* Verify and copy relevant information provided by the userspace */
+	
 	ret = __fill_vb2_buffer(vb, b, planes);
 	if (ret)
 		return ret;
 
 	for (plane = 0; plane < vb->num_planes; ++plane) {
-		/* Skip the plane if already verified */
-		if (vb->v4l2_planes[plane].m.userptr &&
-		    vb->v4l2_planes[plane].m.userptr == planes[plane].m.userptr
+		
+		if (vb->v4l2_planes[plane].m.userptr == planes[plane].m.userptr
 		    && vb->v4l2_planes[plane].length == planes[plane].length)
 			continue;
 
 		dprintk(3, "qbuf: userspace address for plane %d changed, "
 				"reacquiring memory\n", plane);
 
-		/* Check if the provided plane buffer is large enough */
-		if (planes[plane].length < q->plane_sizes[plane]) {
-			ret = -EINVAL;
-			goto err;
-		}
-
-		/* Release previously acquired memory if present */
+		
 		if (vb->planes[plane].mem_priv)
-			call_memop(q, put_userptr, vb->planes[plane].mem_priv);
+			call_memop(q, plane, put_userptr,
+					vb->planes[plane].mem_priv);
 
 		vb->planes[plane].mem_priv = NULL;
-		vb->v4l2_planes[plane].m.userptr = 0;
-		vb->v4l2_planes[plane].length = 0;
 
-		/* Acquire each plane's memory */
-		mem_priv = call_memop(q, get_userptr, q->alloc_ctx[plane],
-				      planes[plane].m.userptr,
-				      planes[plane].length, write);
-		if (IS_ERR_OR_NULL(mem_priv)) {
-			dprintk(1, "qbuf: failed acquiring userspace "
+		
+		if (q->mem_ops->get_userptr) {
+			mem_priv = q->mem_ops->get_userptr(q->alloc_ctx[plane],
+							planes[plane].m.userptr,
+							planes[plane].length,
+							write);
+			if (IS_ERR(mem_priv)) {
+				dprintk(1, "qbuf: failed acquiring userspace "
 						"memory for plane %d\n", plane);
-			ret = mem_priv ? PTR_ERR(mem_priv) : -EINVAL;
-			goto err;
+				ret = PTR_ERR(mem_priv);
+				goto err;
+			}
+			vb->planes[plane].mem_priv = mem_priv;
 		}
-		vb->planes[plane].mem_priv = mem_priv;
 	}
 
-	/*
-	 * Call driver-specific initialization on the newly acquired buffer,
-	 * if provided.
-	 */
 	ret = call_qop(q, buf_init, vb);
 	if (ret) {
 		dprintk(1, "qbuf: buffer initialization failed\n");
 		goto err;
 	}
 
-	/*
-	 * Now that everything is in order, copy relevant information
-	 * provided by userspace.
-	 */
 	for (plane = 0; plane < vb->num_planes; ++plane)
 		vb->v4l2_planes[plane] = planes[plane];
 
 	return 0;
 err:
-	/* In case of errors, release planes that were already acquired */
-	for (plane = 0; plane < vb->num_planes; ++plane) {
-		if (vb->planes[plane].mem_priv)
-			call_memop(q, put_userptr, vb->planes[plane].mem_priv);
-		vb->planes[plane].mem_priv = NULL;
-		vb->v4l2_planes[plane].m.userptr = 0;
-		vb->v4l2_planes[plane].length = 0;
+	
+	for (; plane > 0; --plane) {
+		call_memop(q, plane, put_userptr,
+				vb->planes[plane - 1].mem_priv);
+		vb->planes[plane - 1].mem_priv = NULL;
 	}
 
 	return ret;
 }
 
-/**
- * __qbuf_mmap() - handle qbuf of an MMAP buffer
- */
-static int __qbuf_mmap(struct vb2_buffer *vb, const struct v4l2_buffer *b)
+static int __qbuf_mmap(struct vb2_buffer *vb, struct v4l2_buffer *b)
 {
 	return __fill_vb2_buffer(vb, b, vb->v4l2_planes);
 }
 
-/**
- * __enqueue_in_driver() - enqueue a vb2_buffer in driver for processing
- */
 static void __enqueue_in_driver(struct vb2_buffer *vb)
 {
 	struct vb2_queue *q = vb->vb2_queue;
@@ -975,227 +621,74 @@
 	q->ops->buf_queue(vb);
 }
 
-static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b)
-{
-	struct vb2_queue *q = vb->vb2_queue;
-	int ret;
-
-	switch (q->memory) {
-	case V4L2_MEMORY_MMAP:
-		ret = __qbuf_mmap(vb, b);
-		break;
-	case V4L2_MEMORY_USERPTR:
-		ret = __qbuf_userptr(vb, b);
-		break;
-	default:
-		WARN(1, "Invalid queue type\n");
-		ret = -EINVAL;
-	}
-
-	if (!ret)
-		ret = call_qop(q, buf_prepare, vb);
-	if (ret)
-		dprintk(1, "qbuf: buffer preparation failed: %d\n", ret);
-	else
-		vb->state = VB2_BUF_STATE_PREPARED;
-
-	return ret;
-}
-
-/**
- * vb2_prepare_buf() - Pass ownership of a buffer from userspace to the kernel
- * @q:		videobuf2 queue
- * @b:		buffer structure passed from userspace to vidioc_prepare_buf
- *		handler in driver
- *
- * Should be called from vidioc_prepare_buf ioctl handler of a driver.
- * This function:
- * 1) verifies the passed buffer,
- * 2) calls buf_prepare callback in the driver (if provided), in which
- *    driver-specific buffer initialization can be performed,
- *
- * The return values from this function are intended to be directly returned
- * from vidioc_prepare_buf handler in driver.
- */
-int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b)
+int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b)
 {
 	struct vb2_buffer *vb;
-	int ret;
+	int ret = 0;
 
 	if (q->fileio) {
-		dprintk(1, "%s(): file io in progress\n", __func__);
+		dprintk(1, "qbuf: file io in progress\n");
 		return -EBUSY;
 	}
 
 	if (b->type != q->type) {
-		dprintk(1, "%s(): invalid buffer type\n", __func__);
-		return -EINVAL;
-	}
-
-	if (b->index >= q->num_buffers) {
-		dprintk(1, "%s(): buffer index out of range\n", __func__);
-		return -EINVAL;
-	}
-
-	vb = q->bufs[b->index];
-	if (NULL == vb) {
-		/* Should never happen */
-		dprintk(1, "%s(): buffer is NULL\n", __func__);
-		return -EINVAL;
-	}
-
-	if (b->memory != q->memory) {
-		dprintk(1, "%s(): invalid memory type\n", __func__);
-		return -EINVAL;
-	}
-
-	if (vb->state != VB2_BUF_STATE_DEQUEUED) {
-		dprintk(1, "%s(): invalid buffer state %d\n", __func__, vb->state);
-		return -EINVAL;
-	}
-
-	ret = __buf_prepare(vb, b);
-	if (ret < 0)
-		return ret;
-
-	__fill_v4l2_buffer(vb, b);
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(vb2_prepare_buf);
-
-/**
- * vb2_qbuf() - Queue a buffer from userspace
- * @q:		videobuf2 queue
- * @b:		buffer structure passed from userspace to vidioc_qbuf handler
- *		in driver
- *
- * Should be called from vidioc_qbuf ioctl handler of a driver.
- * This function:
- * 1) verifies the passed buffer,
- * 2) if necessary, calls buf_prepare callback in the driver (if provided), in
- *    which driver-specific buffer initialization can be performed,
- * 3) if streaming is on, queues the buffer in driver by the means of buf_queue
- *    callback for processing.
- *
- * The return values from this function are intended to be directly returned
- * from vidioc_qbuf handler in driver.
- */
-int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b)
-{
-	struct rw_semaphore *mmap_sem = NULL;
-	struct vb2_buffer *vb;
-	int ret = 0;
-
-	/*
-	 * In case of user pointer buffers vb2 allocator needs to get direct
-	 * access to userspace pages. This requires getting read access on
-	 * mmap semaphore in the current process structure. The same
-	 * semaphore is taken before calling mmap operation, while both mmap
-	 * and qbuf are called by the driver or v4l2 core with driver's lock
-	 * held. To avoid a AB-BA deadlock (mmap_sem then driver's lock in
-	 * mmap and driver's lock then mmap_sem in qbuf) the videobuf2 core
-	 * release driver's lock, takes mmap_sem and then takes again driver's
-	 * lock.
-	 *
-	 * To avoid race with other vb2 calls, which might be called after
-	 * releasing driver's lock, this operation is performed at the
-	 * beggining of qbuf processing. This way the queue status is
-	 * consistent after getting driver's lock back.
-	 */
-	if (q->memory == V4L2_MEMORY_USERPTR) {
-		mmap_sem = &current->active_mm->mmap_sem;
-		call_qop(q, wait_prepare, q);
-		down_read(mmap_sem);
-		call_qop(q, wait_finish, q);
-	}
-
-	if (q->fileio) {
-		dprintk(1, "qbuf: file io in progress\n");
-		ret = -EBUSY;
-		goto unlock;
-	}
-
-	if (b->type != q->type) {
 		dprintk(1, "qbuf: invalid buffer type\n");
-		ret = -EINVAL;
-		goto unlock;
+		return -EINVAL;
 	}
 
 	if (b->index >= q->num_buffers) {
 		dprintk(1, "qbuf: buffer index out of range\n");
-		ret = -EINVAL;
-		goto unlock;
+		return -EINVAL;
 	}
 
 	vb = q->bufs[b->index];
 	if (NULL == vb) {
-		/* Should never happen */
+		
 		dprintk(1, "qbuf: buffer is NULL\n");
-		ret = -EINVAL;
-		goto unlock;
+		return -EINVAL;
 	}
 
 	if (b->memory != q->memory) {
 		dprintk(1, "qbuf: invalid memory type\n");
-		ret = -EINVAL;
-		goto unlock;
+		return -EINVAL;
 	}
 
-	switch (vb->state) {
-	case VB2_BUF_STATE_DEQUEUED:
-		ret = __buf_prepare(vb, b);
-		if (ret)
-			goto unlock;
-	case VB2_BUF_STATE_PREPARED:
-		break;
-	default:
+	if (vb->state != VB2_BUF_STATE_DEQUEUED) {
 		dprintk(1, "qbuf: buffer already in use\n");
-		ret = -EINVAL;
-		goto unlock;
+		return -EINVAL;
 	}
 
-	/*
-	 * Add to the queued buffers list, a buffer will stay on it until
-	 * dequeued in dqbuf.
-	 */
+	if (q->memory == V4L2_MEMORY_MMAP)
+		ret = __qbuf_mmap(vb, b);
+	else if (q->memory == V4L2_MEMORY_USERPTR)
+		ret = __qbuf_userptr(vb, b);
+	else {
+		WARN(1, "Invalid queue type\n");
+		return -EINVAL;
+	}
+
+	if (ret)
+		return ret;
+
+	ret = call_qop(q, buf_prepare, vb);
+	if (ret) {
+		dprintk(1, "qbuf: buffer preparation failed\n");
+		return ret;
+	}
+
 	list_add_tail(&vb->queued_entry, &q->queued_list);
 	vb->state = VB2_BUF_STATE_QUEUED;
 
-	/*
-	 * If already streaming, give the buffer to driver for processing.
-	 * If not, the buffer will be given to driver on next streamon.
-	 */
 	if (q->streaming)
 		__enqueue_in_driver(vb);
 
-	/* Fill buffer information for the userspace */
-	__fill_v4l2_buffer(vb, b);
-
 	dprintk(1, "qbuf of buffer %d succeeded\n", vb->v4l2_buf.index);
-unlock:
-	if (mmap_sem)
-		up_read(mmap_sem);
-	return ret;
+	return 0;
 }
 EXPORT_SYMBOL_GPL(vb2_qbuf);
 
-/**
- * __vb2_wait_for_done_vb() - wait for a buffer to become available
- * for dequeuing
- *
- * Will sleep if required for nonblocking == false.
- */
 static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking)
 {
-	/*
-	 * All operations on vb_done_list are performed under done_lock
-	 * spinlock protection. However, buffers may be removed from
-	 * it and returned to userspace only while holding both driver's
-	 * lock and the done_lock spinlock. Thus we can be sure that as
-	 * long as we hold the driver's lock, the list will remain not
-	 * empty if list_empty() check succeeds.
-	 */
 
 	for (;;) {
 		int ret;
@@ -1206,9 +699,6 @@
 		}
 
 		if (!list_empty(&q->done_list)) {
-			/*
-			 * Found a buffer that we were waiting for.
-			 */
 			break;
 		}
 
@@ -1218,24 +708,12 @@
 			return -EAGAIN;
 		}
 
-		/*
-		 * We are streaming and blocking, wait for another buffer to
-		 * become ready or for streamoff. Driver's lock is released to
-		 * allow streamoff or qbuf to be called while waiting.
-		 */
 		call_qop(q, wait_prepare, q);
 
-		/*
-		 * All locks have been released, it is safe to sleep now.
-		 */
 		dprintk(3, "Will sleep waiting for buffers\n");
 		ret = wait_event_interruptible(q->done_wq,
 				!list_empty(&q->done_list) || !q->streaming);
 
-		/*
-		 * We need to reevaluate both conditions again after reacquiring
-		 * the locks or return an error if one occurred.
-		 */
 		call_qop(q, wait_finish, q);
 		if (ret)
 			return ret;
@@ -1243,28 +721,16 @@
 	return 0;
 }
 
-/**
- * __vb2_get_done_vb() - get a buffer ready for dequeuing
- *
- * Will sleep if required for nonblocking == false.
- */
 static int __vb2_get_done_vb(struct vb2_queue *q, struct vb2_buffer **vb,
 				int nonblocking)
 {
 	unsigned long flags;
 	int ret;
 
-	/*
-	 * Wait for at least one buffer to become available on the done_list.
-	 */
 	ret = __vb2_wait_for_done_vb(q, nonblocking);
 	if (ret)
 		return ret;
 
-	/*
-	 * Driver's lock has been held since we last verified that done_list
-	 * is not empty, so no need for another list_empty(done_list) check.
-	 */
 	spin_lock_irqsave(&q->done_lock, flags);
 	*vb = list_first_entry(&q->done_list, struct vb2_buffer, done_entry);
 	list_del(&(*vb)->done_entry);
@@ -1273,48 +739,17 @@
 	return 0;
 }
 
-/**
- * vb2_wait_for_all_buffers() - wait until all buffers are given back to vb2
- * @q:		videobuf2 queue
- *
- * This function will wait until all buffers that have been given to the driver
- * by buf_queue() are given back to vb2 with vb2_buffer_done(). It doesn't call
- * wait_prepare, wait_finish pair. It is intended to be called with all locks
- * taken, for example from stop_streaming() callback.
- */
 int vb2_wait_for_all_buffers(struct vb2_queue *q)
 {
 	if (!q->streaming) {
 		dprintk(1, "Streaming off, will not wait for buffers\n");
 		return -EINVAL;
 	}
-
 	wait_event(q->done_wq, !atomic_read(&q->queued_count));
 	return 0;
 }
 EXPORT_SYMBOL_GPL(vb2_wait_for_all_buffers);
 
-/**
- * vb2_dqbuf() - Dequeue a buffer to the userspace
- * @q:		videobuf2 queue
- * @b:		buffer structure passed from userspace to vidioc_dqbuf handler
- *		in driver
- * @nonblocking: if true, this call will not sleep waiting for a buffer if no
- *		 buffers ready for dequeuing are present. Normally the driver
- *		 would be passing (file->f_flags & O_NONBLOCK) here
- *
- * Should be called from vidioc_dqbuf ioctl handler of a driver.
- * This function:
- * 1) verifies the passed buffer,
- * 2) calls buf_finish callback in the driver (if provided), in which
- *    driver can perform any additional operations that may be required before
- *    returning the buffer to userspace, such as cache sync,
- * 3) the buffer struct members are filled with relevant information for
- *    the userspace.
- *
- * The return values from this function are intended to be directly returned
- * from vidioc_dqbuf handler in driver.
- */
 int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking)
 {
 	struct vb2_buffer *vb = NULL;
@@ -1330,14 +765,12 @@
 		return -EINVAL;
 	}
 
-	mutex_lock(&q->q_lock);
 	ret = __vb2_get_done_vb(q, &vb, nonblocking);
 	if (ret < 0) {
 		dprintk(1, "dqbuf: error getting next done buffer\n");
-		mutex_unlock(&q->q_lock);
 		return ret;
 	}
-	mutex_unlock(&q->q_lock);
+
 	ret = call_qop(q, buf_finish, vb);
 	if (ret) {
 		dprintk(1, "dqbuf: buffer finish failed\n");
@@ -1356,9 +789,9 @@
 		return -EINVAL;
 	}
 
-	/* Fill buffer information for the userspace */
+	
 	__fill_v4l2_buffer(vb, b);
-	/* Remove from videobuf queue */
+	
 	list_del(&vb->queued_entry);
 
 	dprintk(1, "dqbuf of buffer %d, with state %d\n",
@@ -1369,56 +802,6 @@
 }
 EXPORT_SYMBOL_GPL(vb2_dqbuf);
 
-/**
- * __vb2_queue_cancel() - cancel and stop (pause) streaming
- *
- * Removes all queued buffers from driver's queue and all buffers queued by
- * userspace from videobuf's queue. Returns to state after reqbufs.
- */
-static void __vb2_queue_cancel(struct vb2_queue *q)
-{
-	unsigned int i;
-
-	/*
-	 * Tell driver to stop all transactions and release all queued
-	 * buffers.
-	 */
-	if (q->streaming)
-		call_qop(q, stop_streaming, q);
-	q->streaming = 0;
-
-	/*
-	 * Remove all buffers from videobuf's list...
-	 */
-	INIT_LIST_HEAD(&q->queued_list);
-	/*
-	 * ...and done list; userspace will not receive any buffers it
-	 * has not already dequeued before initiating cancel.
-	 */
-	INIT_LIST_HEAD(&q->done_list);
-	atomic_set(&q->queued_count, 0);
-	wake_up_all(&q->done_wq);
-
-	/*
-	 * Reinitialize all buffers for next use.
-	 */
-	for (i = 0; i < q->num_buffers; ++i)
-		q->bufs[i]->state = VB2_BUF_STATE_DEQUEUED;
-}
-
-/**
- * vb2_streamon - start streaming
- * @q:		videobuf2 queue
- * @type:	type argument passed from userspace to vidioc_streamon handler
- *
- * Should be called from vidioc_streamon handler of a driver.
- * This function:
- * 1) verifies current state
- * 2) passes any previously queued buffers to the driver and starts streaming
- *
- * The return values from this function are intended to be directly returned
- * from vidioc_streamon handler in the driver.
- */
 int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type)
 {
 	struct vb2_buffer *vb;
@@ -1439,48 +822,46 @@
 		return -EBUSY;
 	}
 
-	/*
-	 * If any buffers were queued before streamon,
-	 * we can now pass them to driver for processing.
-	 */
-	list_for_each_entry(vb, &q->queued_list, queued_entry)
-		__enqueue_in_driver(vb);
+	if (V4L2_TYPE_IS_OUTPUT(q->type)) {
+		if (list_empty(&q->queued_list)) {
+			dprintk(1, "streamon: no output buffers queued\n");
+			return -EINVAL;
+		}
+	}
 
-	/*
-	 * Let driver notice that streaming state has been enabled.
-	 */
-	mutex_lock(&q->q_lock);
-	ret = call_qop(q, start_streaming, q, atomic_read(&q->queued_count));
+	ret = call_qop(q, start_streaming, q);
 	if (ret) {
 		dprintk(1, "streamon: driver refused to start streaming\n");
-		__vb2_queue_cancel(q);
-		mutex_unlock(&q->q_lock);
 		return ret;
 	}
 
 	q->streaming = 1;
-	mutex_unlock(&q->q_lock);
+
+	list_for_each_entry(vb, &q->queued_list, queued_entry)
+		__enqueue_in_driver(vb);
+
 	dprintk(3, "Streamon successful\n");
 	return 0;
 }
 EXPORT_SYMBOL_GPL(vb2_streamon);
 
+static void __vb2_queue_cancel(struct vb2_queue *q)
+{
+	unsigned int i;
 
-/**
- * vb2_streamoff - stop streaming
- * @q:		videobuf2 queue
- * @type:	type argument passed from userspace to vidioc_streamoff handler
- *
- * Should be called from vidioc_streamoff handler of a driver.
- * This function:
- * 1) verifies current state,
- * 2) stop streaming and dequeues any queued buffers, including those previously
- *    passed to the driver (after waiting for the driver to finish).
- *
- * This call can be used for pausing playback.
- * The return values from this function are intended to be directly returned
- * from vidioc_streamoff handler in the driver
- */
+	if (q->streaming)
+		call_qop(q, stop_streaming, q);
+	q->streaming = 0;
+
+	INIT_LIST_HEAD(&q->queued_list);
+	INIT_LIST_HEAD(&q->done_list);
+	atomic_set(&q->queued_count, 0);
+	wake_up_all(&q->done_wq);
+
+	for (i = 0; i < q->num_buffers; ++i)
+		q->bufs[i]->state = VB2_BUF_STATE_DEQUEUED;
+}
+
 int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type)
 {
 	if (q->fileio) {
@@ -1498,10 +879,6 @@
 		return -EINVAL;
 	}
 
-	/*
-	 * Cancel will pause streaming and remove all buffers from the driver
-	 * and videobuf, effectively returning control over them to userspace.
-	 */
 	__vb2_queue_cancel(q);
 
 	dprintk(3, "Streamoff successful\n");
@@ -1509,20 +886,12 @@
 }
 EXPORT_SYMBOL_GPL(vb2_streamoff);
 
-/**
- * __find_plane_by_offset() - find plane associated with the given offset off
- */
 static int __find_plane_by_offset(struct vb2_queue *q, unsigned long off,
 			unsigned int *_buffer, unsigned int *_plane)
 {
 	struct vb2_buffer *vb;
 	unsigned int buffer, plane;
 
-	/*
-	 * Go over all buffers and their planes, comparing the given offset
-	 * with an offset assigned to each plane. If a match is found,
-	 * return its buffer and plane numbers.
-	 */
 	for (buffer = 0; buffer < q->num_buffers; ++buffer) {
 		vb = q->bufs[buffer];
 
@@ -1538,28 +907,10 @@
 	return -EINVAL;
 }
 
-/**
- * vb2_mmap() - map video buffers into application address space
- * @q:		videobuf2 queue
- * @vma:	vma passed to the mmap file operation handler in the driver
- *
- * Should be called from mmap file operation handler of a driver.
- * This function maps one plane of one of the available video buffers to
- * userspace. To map whole video memory allocated on reqbufs, this function
- * has to be called once per each plane per each buffer previously allocated.
- *
- * When the userspace application calls mmap, it passes to it an offset returned
- * to it earlier by the means of vidioc_querybuf handler. That offset acts as
- * a "cookie", which is then used to identify the plane to be mapped.
- * This function finds a plane with a matching offset and a mapping is performed
- * by the means of a provided memory operation.
- *
- * The return values from this function are intended to be directly returned
- * from the mmap handler in driver.
- */
 int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma)
 {
 	unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
+	struct vb2_plane *vb_plane;
 	struct vb2_buffer *vb;
 	unsigned int buffer, plane;
 	int ret;
@@ -1569,9 +920,6 @@
 		return -EINVAL;
 	}
 
-	/*
-	 * Check memory area access mode.
-	 */
 	if (!(vma->vm_flags & VM_SHARED)) {
 		dprintk(1, "Invalid vma flags, VM_SHARED needed\n");
 		return -EINVAL;
@@ -1588,83 +936,34 @@
 		}
 	}
 
-	/*
-	 * Find the plane corresponding to the offset passed by userspace.
-	 */
 	ret = __find_plane_by_offset(q, off, &buffer, &plane);
 	if (ret)
 		return ret;
 
 	vb = q->bufs[buffer];
+	vb_plane = &vb->planes[plane];
 
-	ret = call_memop(q, mmap, vb->planes[plane].mem_priv, vma);
+	ret = q->mem_ops->mmap(vb_plane->mem_priv, vma);
 	if (ret)
 		return ret;
 
+	vb_plane->mapped = 1;
+	vb->num_planes_mapped++;
+
 	dprintk(3, "Buffer %d, plane %d successfully mapped\n", buffer, plane);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(vb2_mmap);
 
-#ifndef CONFIG_MMU
-unsigned long vb2_get_unmapped_area(struct vb2_queue *q,
-				    unsigned long addr,
-				    unsigned long len,
-				    unsigned long pgoff,
-				    unsigned long flags)
-{
-	unsigned long off = pgoff << PAGE_SHIFT;
-	struct vb2_buffer *vb;
-	unsigned int buffer, plane;
-	int ret;
-
-	if (q->memory != V4L2_MEMORY_MMAP) {
-		dprintk(1, "Queue is not currently set up for mmap\n");
-		return -EINVAL;
-	}
-
-	/*
-	 * Find the plane corresponding to the offset passed by userspace.
-	 */
-	ret = __find_plane_by_offset(q, off, &buffer, &plane);
-	if (ret)
-		return ret;
-
-	vb = q->bufs[buffer];
-
-	return (unsigned long)vb2_plane_vaddr(vb, plane);
-}
-EXPORT_SYMBOL_GPL(vb2_get_unmapped_area);
-#endif
-
 static int __vb2_init_fileio(struct vb2_queue *q, int read);
 static int __vb2_cleanup_fileio(struct vb2_queue *q);
 
-/**
- * vb2_poll() - implements poll userspace operation
- * @q:		videobuf2 queue
- * @file:	file argument passed to the poll file operation handler
- * @wait:	wait argument passed to the poll file operation handler
- *
- * This function implements poll file operation handler for a driver.
- * For CAPTURE queues, if a buffer is ready to be dequeued, the userspace will
- * be informed that the file descriptor of a video device is available for
- * reading.
- * For OUTPUT queues, if a buffer is ready to be dequeued, the file descriptor
- * will be reported as available for writing.
- *
- * The return values from this function are intended to be directly returned
- * from poll handler in driver.
- */
 unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
 {
 	unsigned long flags;
 	unsigned int ret;
 	struct vb2_buffer *vb = NULL;
 
-	/*
-	 * Start file I/O emulator only if streaming API has not been used yet.
-	 */
 	if (q->num_buffers == 0 && q->fileio == NULL) {
 		if (!V4L2_TYPE_IS_OUTPUT(q->type) && (q->io_modes & VB2_READ)) {
 			ret = __vb2_init_fileio(q, 1);
@@ -1675,24 +974,15 @@
 			ret = __vb2_init_fileio(q, 0);
 			if (ret)
 				return POLLERR;
-			/*
-			 * Write to OUTPUT queue can be done immediately.
-			 */
 			return POLLOUT | POLLWRNORM;
 		}
 	}
 
-	/*
-	 * There is nothing to wait for if no buffers have already been queued.
-	 */
 	if (list_empty(&q->queued_list))
 		return POLLERR;
 
 	poll_wait(file, &q->done_wq, wait);
 
-	/*
-	 * Take first buffer available for dequeuing.
-	 */
 	spin_lock_irqsave(&q->done_lock, flags);
 	if (!list_empty(&q->done_list))
 		vb = list_first_entry(&q->done_list, struct vb2_buffer,
@@ -1708,17 +998,6 @@
 }
 EXPORT_SYMBOL_GPL(vb2_poll);
 
-/**
- * vb2_queue_init() - initialize a videobuf2 queue
- * @q:		videobuf2 queue; this structure should be allocated in driver
- *
- * The vb2_queue structure should be allocated by the driver. The driver is
- * responsible of clearing it's content and setting initial values for some
- * required entries before calling this function.
- * q->ops, q->mem_ops, q->type and q->io_modes are mandatory. Please refer
- * to the struct vb2_queue description in include/media/videobuf2-core.h
- * for more information.
- */
 int vb2_queue_init(struct vb2_queue *q)
 {
 	BUG_ON(!q);
@@ -1733,7 +1012,6 @@
 	INIT_LIST_HEAD(&q->queued_list);
 	INIT_LIST_HEAD(&q->done_list);
 	spin_lock_init(&q->done_lock);
-	mutex_init(&q->q_lock);
 	init_waitqueue_head(&q->done_wq);
 
 	if (q->buf_struct_size == 0)
@@ -1743,29 +1021,14 @@
 }
 EXPORT_SYMBOL_GPL(vb2_queue_init);
 
-/**
- * vb2_queue_release() - stop streaming, release the queue and free memory
- * @q:		videobuf2 queue
- *
- * This function stops streaming and performs necessary clean ups, including
- * freeing video buffer memory. The driver is responsible for freeing
- * the vb2_queue structure itself.
- */
 void vb2_queue_release(struct vb2_queue *q)
 {
 	__vb2_cleanup_fileio(q);
 	__vb2_queue_cancel(q);
-	__vb2_queue_free(q, q->num_buffers);
+	__vb2_queue_free(q);
 }
 EXPORT_SYMBOL_GPL(vb2_queue_release);
 
-/**
- * struct vb2_fileio_buf - buffer context used by file io emulator
- *
- * vb2 provides a compatibility layer and emulator of file io (read and
- * write) calls on top of streaming API. This structure is used for
- * tracking context related to the buffers.
- */
 struct vb2_fileio_buf {
 	void *vaddr;
 	unsigned int size;
@@ -1773,14 +1036,6 @@
 	unsigned int queued:1;
 };
 
-/**
- * struct vb2_fileio_data - queue context used by file io emulator
- *
- * vb2 provides a compatibility layer and emulator of file io (read and
- * write) calls on top of streaming API. For proper operation it required
- * this structure to save the driver state between each call of the read
- * or write function.
- */
 struct vb2_fileio_data {
 	struct v4l2_requestbuffers req;
 	struct v4l2_buffer b;
@@ -1791,39 +1046,22 @@
 	unsigned int flags;
 };
 
-/**
- * __vb2_init_fileio() - initialize file io emulator
- * @q:		videobuf2 queue
- * @read:	mode selector (1 means read, 0 means write)
- */
 static int __vb2_init_fileio(struct vb2_queue *q, int read)
 {
 	struct vb2_fileio_data *fileio;
 	int i, ret;
 	unsigned int count = 0;
 
-	/*
-	 * Sanity check
-	 */
 	if ((read && !(q->io_modes & VB2_READ)) ||
 	   (!read && !(q->io_modes & VB2_WRITE)))
 		BUG();
 
-	/*
-	 * Check if device supports mapping buffers to kernel virtual space.
-	 */
 	if (!q->mem_ops->vaddr)
 		return -EBUSY;
 
-	/*
-	 * Check if streaming api has not been already activated.
-	 */
 	if (q->streaming || q->num_buffers > 0)
 		return -EBUSY;
 
-	/*
-	 * Start with count 1, driver can increase it in queue_setup()
-	 */
 	count = 1;
 
 	dprintk(3, "setting up file io: mode %s, count %d, flags %08x\n",
@@ -1835,10 +1073,6 @@
 
 	fileio->flags = q->io_flags;
 
-	/*
-	 * Request buffers and use MMAP type to force driver
-	 * to allocate buffers by itself.
-	 */
 	fileio->req.count = count;
 	fileio->req.memory = V4L2_MEMORY_MMAP;
 	fileio->req.type = q->type;
@@ -1846,19 +1080,12 @@
 	if (ret)
 		goto err_kfree;
 
-	/*
-	 * Check if plane_count is correct
-	 * (multiplane buffers are not supported).
-	 */
 	if (q->bufs[0]->num_planes != 1) {
 		fileio->req.count = 0;
 		ret = -EBUSY;
 		goto err_reqbufs;
 	}
 
-	/*
-	 * Get kernel address of each buffer.
-	 */
 	for (i = 0; i < q->num_buffers; i++) {
 		fileio->bufs[i].vaddr = vb2_plane_vaddr(q->bufs[i], 0);
 		if (fileio->bufs[i].vaddr == NULL)
@@ -1866,13 +1093,7 @@
 		fileio->bufs[i].size = vb2_plane_size(q->bufs[i], 0);
 	}
 
-	/*
-	 * Read mode requires pre queuing of all buffers.
-	 */
 	if (read) {
-		/*
-		 * Queue all buffers.
-		 */
 		for (i = 0; i < q->num_buffers; i++) {
 			struct v4l2_buffer *b = &fileio->b;
 			memset(b, 0, sizeof(*b));
@@ -1885,9 +1106,6 @@
 			fileio->bufs[i].queued = 1;
 		}
 
-		/*
-		 * Start streaming.
-		 */
 		ret = vb2_streamon(q, q->type);
 		if (ret)
 			goto err_reqbufs;
@@ -1905,19 +1123,11 @@
 	return ret;
 }
 
-/**
- * __vb2_cleanup_fileio() - free resourced used by file io emulator
- * @q:		videobuf2 queue
- */
 static int __vb2_cleanup_fileio(struct vb2_queue *q)
 {
 	struct vb2_fileio_data *fileio = q->fileio;
 
 	if (fileio) {
-		/*
-		 * Hack fileio context to enable direct calls to vb2 ioctl
-		 * interface.
-		 */
 		q->fileio = NULL;
 
 		vb2_streamoff(q, q->type);
@@ -1929,15 +1139,6 @@
 	return 0;
 }
 
-/**
- * __vb2_perform_fileio() - perform a single file io (read or write) operation
- * @q:		videobuf2 queue
- * @data:	pointed to target userspace buffer
- * @count:	number of bytes to read or write
- * @ppos:	file handle position tracking pointer
- * @nonblock:	mode selector (1 means blocking calls, 0 means nonblocking)
- * @read:	access mode selector (1 means read, 0 means write)
- */
 static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_t count,
 		loff_t *ppos, int nonblock, int read)
 {
@@ -1952,9 +1153,6 @@
 	if (!data)
 		return -EINVAL;
 
-	/*
-	 * Initialize emulator on first call.
-	 */
 	if (!q->fileio) {
 		ret = __vb2_init_fileio(q, read);
 		dprintk(3, "file io: vb2_init_fileio result: %d\n", ret);
@@ -1963,24 +1161,14 @@
 	}
 	fileio = q->fileio;
 
-	/*
-	 * Hack fileio context to enable direct calls to vb2 ioctl interface.
-	 * The pointer will be restored before returning from this function.
-	 */
 	q->fileio = NULL;
 
 	index = fileio->index;
 	buf = &fileio->bufs[index];
 
-	/*
-	 * Check if we need to dequeue the buffer.
-	 */
 	if (buf->queued) {
 		struct vb2_buffer *vb;
 
-		/*
-		 * Call vb2_dqbuf to get buffer back.
-		 */
 		memset(&fileio->b, 0, sizeof(fileio->b));
 		fileio->b.type = q->type;
 		fileio->b.memory = q->memory;
@@ -1991,25 +1179,16 @@
 			goto end;
 		fileio->dq_count += 1;
 
-		/*
-		 * Get number of bytes filled by the driver
-		 */
 		vb = q->bufs[index];
 		buf->size = vb2_get_plane_payload(vb, 0);
 		buf->queued = 0;
 	}
 
-	/*
-	 * Limit count on last few bytes of the buffer.
-	 */
 	if (buf->pos + count > buf->size) {
 		count = buf->size - buf->pos;
 		dprintk(5, "reducing read count: %zd\n", count);
 	}
 
-	/*
-	 * Transfer data to userspace.
-	 */
 	dprintk(3, "file io: copying %zd bytes - buffer %d, offset %u\n",
 		count, index, buf->pos);
 	if (read)
@@ -2022,33 +1201,18 @@
 		goto end;
 	}
 
-	/*
-	 * Update counters.
-	 */
 	buf->pos += count;
 	*ppos += count;
 
-	/*
-	 * Queue next buffer if required.
-	 */
 	if (buf->pos == buf->size ||
 	   (!read && (fileio->flags & VB2_FILEIO_WRITE_IMMEDIATELY))) {
-		/*
-		 * Check if this is the last buffer to read.
-		 */
 		if (read && (fileio->flags & VB2_FILEIO_READ_ONCE) &&
 		    fileio->dq_count == 1) {
 			dprintk(3, "file io: read limit reached\n");
-			/*
-			 * Restore fileio pointer and release the context.
-			 */
 			q->fileio = fileio;
 			return __vb2_cleanup_fileio(q);
 		}
 
-		/*
-		 * Call vb2_qbuf and give buffer to the driver.
-		 */
 		memset(&fileio->b, 0, sizeof(fileio->b));
 		fileio->b.type = q->type;
 		fileio->b.memory = q->memory;
@@ -2059,22 +1223,13 @@
 		if (ret)
 			goto end;
 
-		/*
-		 * Buffer has been queued, update the status
-		 */
 		buf->pos = 0;
 		buf->queued = 1;
 		buf->size = q->bufs[0]->v4l2_planes[0].length;
 		fileio->q_count += 1;
 
-		/*
-		 * Switch to the next buffer
-		 */
 		fileio->index = (index + 1) % q->num_buffers;
 
-		/*
-		 * Start streaming if required.
-		 */
 		if (!read && !q->streaming) {
 			ret = vb2_streamon(q, q->type);
 			if (ret)
@@ -2082,15 +1237,9 @@
 		}
 	}
 
-	/*
-	 * Return proper number of bytes processed.
-	 */
 	if (ret == 0)
 		ret = count;
 end:
-	/*
-	 * Restore the fileio context and block vb2 ioctl interface.
-	 */
 	q->fileio = fileio;
 	return ret;
 }
diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c
index 4b71326..a790a5f 100644
--- a/drivers/media/video/videobuf2-dma-contig.c
+++ b/drivers/media/video/videobuf2-dma-contig.c
@@ -15,7 +15,6 @@
 #include <linux/dma-mapping.h>
 
 #include <media/videobuf2-core.h>
-#include <media/videobuf2-dma-contig.h>
 #include <media/videobuf2-memops.h>
 
 struct vb2_dc_conf {
@@ -25,7 +24,7 @@
 struct vb2_dc_buf {
 	struct vb2_dc_conf		*conf;
 	void				*vaddr;
-	dma_addr_t			dma_addr;
+	dma_addr_t			paddr;
 	unsigned long			size;
 	struct vm_area_struct		*vma;
 	atomic_t			refcount;
@@ -43,7 +42,7 @@
 	if (!buf)
 		return ERR_PTR(-ENOMEM);
 
-	buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->dma_addr,
+	buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->paddr,
 					GFP_KERNEL);
 	if (!buf->vaddr) {
 		dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n",
@@ -70,7 +69,7 @@
 
 	if (atomic_dec_and_test(&buf->refcount)) {
 		dma_free_coherent(buf->conf->dev, buf->size, buf->vaddr,
-				  buf->dma_addr);
+				  buf->paddr);
 		kfree(buf);
 	}
 }
@@ -79,14 +78,14 @@
 {
 	struct vb2_dc_buf *buf = buf_priv;
 
-	return &buf->dma_addr;
+	return &buf->paddr;
 }
 
 static void *vb2_dma_contig_vaddr(void *buf_priv)
 {
 	struct vb2_dc_buf *buf = buf_priv;
 	if (!buf)
-		return NULL;
+		return 0;
 
 	return buf->vaddr;
 }
@@ -107,7 +106,7 @@
 		return -EINVAL;
 	}
 
-	return vb2_mmap_pfn_range(vma, buf->dma_addr, buf->size,
+	return vb2_mmap_pfn_range(vma, buf->paddr, buf->size,
 				  &vb2_common_vm_ops, &buf->handler);
 }
 
@@ -116,14 +115,14 @@
 {
 	struct vb2_dc_buf *buf;
 	struct vm_area_struct *vma;
-	dma_addr_t dma_addr = 0;
+	dma_addr_t paddr = 0;
 	int ret;
 
 	buf = kzalloc(sizeof *buf, GFP_KERNEL);
 	if (!buf)
 		return ERR_PTR(-ENOMEM);
 
-	ret = vb2_get_contig_userptr(vaddr, size, &vma, &dma_addr);
+	ret = vb2_get_contig_userptr(vaddr, size, &vma, &paddr);
 	if (ret) {
 		printk(KERN_ERR "Failed acquiring VMA for vaddr 0x%08lx\n",
 				vaddr);
@@ -132,7 +131,7 @@
 	}
 
 	buf->size = size;
-	buf->dma_addr = dma_addr;
+	buf->paddr = paddr;
 	buf->vma = vma;
 
 	return buf;
diff --git a/drivers/media/video/videobuf2-dma-sg.c b/drivers/media/video/videobuf2-dma-sg.c
index 25c3b36..0b1b9a6 100644
--- a/drivers/media/video/videobuf2-dma-sg.c
+++ b/drivers/media/video/videobuf2-dma-sg.c
@@ -48,10 +48,12 @@
 	buf->sg_desc.size = size;
 	buf->sg_desc.num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
 
-	buf->sg_desc.sglist = vzalloc(buf->sg_desc.num_pages *
+	buf->sg_desc.sglist = vmalloc(buf->sg_desc.num_pages *
 				      sizeof(*buf->sg_desc.sglist));
 	if (!buf->sg_desc.sglist)
 		goto fail_sglist_alloc;
+	memset(buf->sg_desc.sglist, 0, buf->sg_desc.num_pages *
+	       sizeof(*buf->sg_desc.sglist));
 	sg_init_table(buf->sg_desc.sglist, buf->sg_desc.num_pages);
 
 	buf->pages = kzalloc(buf->sg_desc.num_pages * sizeof(struct page *),
@@ -75,6 +77,12 @@
 
 	printk(KERN_DEBUG "%s: Allocated buffer of %d pages\n",
 		__func__, buf->sg_desc.num_pages);
+
+	if (!buf->vaddr)
+		buf->vaddr = vm_map_ram(buf->pages,
+					buf->sg_desc.num_pages,
+					-1,
+					PAGE_KERNEL);
 	return buf;
 
 fail_pages_alloc:
@@ -128,11 +136,13 @@
 	last  = ((vaddr + size - 1) & PAGE_MASK) >> PAGE_SHIFT;
 	buf->sg_desc.num_pages = last - first + 1;
 
-	buf->sg_desc.sglist = vzalloc(
+	buf->sg_desc.sglist = vmalloc(
 		buf->sg_desc.num_pages * sizeof(*buf->sg_desc.sglist));
 	if (!buf->sg_desc.sglist)
 		goto userptr_fail_sglist_alloc;
 
+	memset(buf->sg_desc.sglist, 0,
+		buf->sg_desc.num_pages * sizeof(*buf->sg_desc.sglist));
 	sg_init_table(buf->sg_desc.sglist, buf->sg_desc.num_pages);
 
 	buf->pages = kzalloc(buf->sg_desc.num_pages * sizeof(struct page *),
@@ -140,14 +150,15 @@
 	if (!buf->pages)
 		goto userptr_fail_pages_array_alloc;
 
+	down_read(&current->mm->mmap_sem);
 	num_pages_from_user = get_user_pages(current, current->mm,
 					     vaddr & PAGE_MASK,
 					     buf->sg_desc.num_pages,
 					     write,
-					     1, /* force */
+					     1, 
 					     buf->pages,
 					     NULL);
-
+	up_read(&current->mm->mmap_sem);
 	if (num_pages_from_user != buf->sg_desc.num_pages)
 		goto userptr_fail_get_user_pages;
 
@@ -176,10 +187,6 @@
 	return NULL;
 }
 
-/*
- * @put_userptr: inform the allocator that a USERPTR buffer will no longer
- *		 be used
- */
 static void vb2_dma_sg_put_userptr(void *buf_priv)
 {
 	struct vb2_dma_sg_buf *buf = buf_priv;
@@ -211,7 +218,7 @@
 					-1,
 					PAGE_KERNEL);
 
-	/* add offset in case userptr is not page-aligned */
+	
 	return buf->vaddr + buf->offset;
 }
 
@@ -248,9 +255,6 @@
 	} while (usize > 0);
 
 
-	/*
-	 * Use common vm_area operations to track buffer refcount.
-	 */
 	vma->vm_private_data	= &buf->handler;
 	vma->vm_ops		= &vb2_common_vm_ops;
 
diff --git a/drivers/media/video/videobuf2-memops.c b/drivers/media/video/videobuf2-memops.c
index 504cd4c..76f1fd6 100644
--- a/drivers/media/video/videobuf2-memops.c
+++ b/drivers/media/video/videobuf2-memops.c
@@ -18,21 +18,11 @@
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/file.h>
+#include <linux/slab.h>
 
 #include <media/videobuf2-core.h>
 #include <media/videobuf2-memops.h>
 
-/**
- * vb2_get_vma() - acquire and lock the virtual memory area
- * @vma:	given virtual memory area
- *
- * This function attempts to acquire an area mapped in the userspace for
- * the duration of a hardware operation. The area is "locked" by performing
- * the same set of operation that are done when process calls fork() and
- * memory areas are duplicated.
- *
- * Returns a copy of a virtual memory region on success or NULL.
- */
 struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma)
 {
 	struct vm_area_struct *vma_copy;
@@ -55,44 +45,22 @@
 
 	return vma_copy;
 }
-EXPORT_SYMBOL_GPL(vb2_get_vma);
 
-/**
- * vb2_put_userptr() - release a userspace virtual memory area
- * @vma:	virtual memory region associated with the area to be released
- *
- * This function releases the previously acquired memory area after a hardware
- * operation.
- */
 void vb2_put_vma(struct vm_area_struct *vma)
 {
 	if (!vma)
 		return;
 
-	if (vma->vm_ops && vma->vm_ops->close)
-		vma->vm_ops->close(vma);
-
 	if (vma->vm_file)
 		fput(vma->vm_file);
 
+	if (vma->vm_ops && vma->vm_ops->close)
+		vma->vm_ops->close(vma);
+
 	kfree(vma);
 }
 EXPORT_SYMBOL_GPL(vb2_put_vma);
 
-/**
- * vb2_get_contig_userptr() - lock physically contiguous userspace mapped memory
- * @vaddr:	starting virtual address of the area to be verified
- * @size:	size of the area
- * @res_paddr:	will return physical address for the given vaddr
- * @res_vma:	will return locked copy of struct vm_area for the given area
- *
- * This function will go through memory area of size @size mapped at @vaddr and
- * verify that the underlying physical pages are contiguous. If they are
- * contiguous the virtual memory area is locked and a @res_vma is filled with
- * the copy and @res_pa set to the physical address of the buffer.
- *
- * Returns 0 on success.
- */
 int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size,
 			   struct vm_area_struct **res_vma, dma_addr_t *res_pa)
 {
@@ -101,51 +69,46 @@
 	unsigned long offset, start, end;
 	unsigned long this_pfn, prev_pfn;
 	dma_addr_t pa = 0;
+	int ret = -EFAULT;
 
 	start = vaddr;
 	offset = start & ~PAGE_MASK;
 	end = start + size;
 
+	down_read(&mm->mmap_sem);
 	vma = find_vma(mm, start);
 
 	if (vma == NULL || vma->vm_end < end)
-		return -EFAULT;
+		goto done;
 
 	for (prev_pfn = 0; start < end; start += PAGE_SIZE) {
-		int ret = follow_pfn(vma, start, &this_pfn);
+		ret = follow_pfn(vma, start, &this_pfn);
 		if (ret)
-			return ret;
+			goto done;
 
 		if (prev_pfn == 0)
 			pa = this_pfn << PAGE_SHIFT;
-		else if (this_pfn != prev_pfn + 1)
-			return -EFAULT;
-
+		else if (this_pfn != prev_pfn + 1) {
+			ret = -EFAULT;
+			goto done;
+		}
 		prev_pfn = this_pfn;
 	}
 
-	/*
-	 * Memory is contigous, lock vma and return to the caller
-	 */
 	*res_vma = vb2_get_vma(vma);
-	if (*res_vma == NULL)
-		return -ENOMEM;
-
+	if (*res_vma == NULL) {
+		ret = -ENOMEM;
+		goto done;
+	}
 	*res_pa = pa + offset;
-	return 0;
+	ret = 0;
+
+done:
+	up_read(&mm->mmap_sem);
+	return ret;
 }
 EXPORT_SYMBOL_GPL(vb2_get_contig_userptr);
 
-/**
- * vb2_mmap_pfn_range() - map physical pages to userspace
- * @vma:	virtual memory region for the mapping
- * @paddr:	starting physical address of the memory to be mapped
- * @size:	size of the memory to be mapped
- * @vm_ops:	vm operations to be assigned to the created area
- * @priv:	private data to be associated with the area
- *
- * Returns 0 on success.
- */
 int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr,
 				unsigned long size,
 				const struct vm_operations_struct *vm_ops,
@@ -169,53 +132,35 @@
 
 	vma->vm_ops->open(vma);
 
-	pr_debug("%s: mapped paddr 0x%08lx at 0x%08lx, size %ld\n",
+	printk(KERN_DEBUG "%s: mapped paddr 0x%08lx at 0x%08lx, size %ld\n",
 			__func__, paddr, vma->vm_start, size);
 
 	return 0;
 }
 EXPORT_SYMBOL_GPL(vb2_mmap_pfn_range);
 
-/**
- * vb2_common_vm_open() - increase refcount of the vma
- * @vma:	virtual memory region for the mapping
- *
- * This function adds another user to the provided vma. It expects
- * struct vb2_vmarea_handler pointer in vma->vm_private_data.
- */
 static void vb2_common_vm_open(struct vm_area_struct *vma)
 {
 	struct vb2_vmarea_handler *h = vma->vm_private_data;
 
-	pr_debug("%s: %p, refcount: %d, vma: %08lx-%08lx\n",
+	printk(KERN_DEBUG "%s: %p, refcount: %d, vma: %08lx-%08lx\n",
 	       __func__, h, atomic_read(h->refcount), vma->vm_start,
 	       vma->vm_end);
 
 	atomic_inc(h->refcount);
 }
 
-/**
- * vb2_common_vm_close() - decrease refcount of the vma
- * @vma:	virtual memory region for the mapping
- *
- * This function releases the user from the provided vma. It expects
- * struct vb2_vmarea_handler pointer in vma->vm_private_data.
- */
 static void vb2_common_vm_close(struct vm_area_struct *vma)
 {
 	struct vb2_vmarea_handler *h = vma->vm_private_data;
 
-	pr_debug("%s: %p, refcount: %d, vma: %08lx-%08lx\n",
+	printk(KERN_DEBUG "%s: %p, refcount: %d, vma: %08lx-%08lx\n",
 	       __func__, h, atomic_read(h->refcount), vma->vm_start,
 	       vma->vm_end);
 
 	h->put(h->arg);
 }
 
-/**
- * vb2_common_vm_ops - common vm_ops used for tracking refcount of mmaped
- * video buffers
- */
 const struct vm_operations_struct vb2_common_vm_ops = {
 	.open = vb2_common_vm_open,
 	.close = vb2_common_vm_close,
diff --git a/drivers/media/video/videobuf2-msm-mem.c b/drivers/media/video/videobuf2-msm-mem.c
index 45a0a2c..7878330 100644
--- a/drivers/media/video/videobuf2-msm-mem.c
+++ b/drivers/media/video/videobuf2-msm-mem.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * Based on videobuf-dma-contig.c,
  * (c) 2008 Magnus Damm
@@ -29,8 +29,9 @@
 #include <media/videobuf2-msm-mem.h>
 #include <media/msm_camera.h>
 #include <mach/memory.h>
+#include <mach/msm_subsystem_map.h>
+
 #include <media/videobuf2-core.h>
-#include <mach/iommu_domains.h>
 
 #define MAGIC_PMEM 0x0733ac64
 #define MAGIC_CHECK(is, should)               \
@@ -62,7 +63,7 @@
 		goto alloc_failed;
 	}
 	rc = ion_map_iommu(mem->client, mem->ion_handle,
-			-1, 0, SZ_4K, 0,
+			CAMERA_DOMAIN, GEN_POOL, SZ_4K, 0,
 			(unsigned long *)&phyaddr,
 			(unsigned long *)&len, 0, 0);
 	if (rc < 0) {
@@ -87,7 +88,7 @@
 {
 	int32_t rc = 0;
 #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
-	ion_unmap_iommu(mem->client, mem->ion_handle, -1, 0);
+	ion_unmap_iommu(mem->client, mem->ion_handle, CAMERA_DOMAIN, GEN_POOL);
 	ion_free(mem->client, mem->ion_handle);
 	ion_client_destroy(mem->client);
 #else
@@ -160,22 +161,11 @@
 }
 EXPORT_SYMBOL_GPL(videobuf2_pmem_contig_mmap_get);
 
-/**
- * videobuf_pmem_contig_user_get() - setup user space memory pointer
- * @mem: per-buffer private videobuf-contig-pmem data
- * @vb: video buffer to map
- *
- * This function validates and sets up a pointer to user space memory.
- * Only physically contiguous pfn-mapped memory is accepted.
- *
- * Returns 0 if successful.
- */
 int videobuf2_pmem_contig_user_get(struct videobuf2_contig_pmem *mem,
 					struct videobuf2_msm_offset *offset,
 					enum videobuf2_buffer_type buffer_type,
 					uint32_t addr_offset, int path,
-					struct ion_client *client,
-					int domain_num)
+					struct ion_client *client)
 {
 	unsigned long len;
 	int rc = 0;
@@ -191,7 +181,7 @@
 		pr_err("%s ION import failed\n", __func__);
 		return PTR_ERR(mem->ion_handle);
 	}
-	rc = ion_map_iommu(client, mem->ion_handle, domain_num, 0,
+	rc = ion_map_iommu(client, mem->ion_handle, CAMERA_DOMAIN, GEN_POOL,
 		SZ_4K, 0, (unsigned long *)&mem->phyaddr, &len, 0, 0);
 	if (rc < 0)
 		ion_free(client, mem->ion_handle);
@@ -221,7 +211,7 @@
 EXPORT_SYMBOL_GPL(videobuf2_pmem_contig_user_get);
 
 void videobuf2_pmem_contig_user_put(struct videobuf2_contig_pmem *mem,
-				struct ion_client *client, int domain_num)
+					struct ion_client *client)
 {
 	if (mem->is_userptr) {
 #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
@@ -230,7 +220,7 @@
 		return;
 	}
 		ion_unmap_iommu(client, mem->ion_handle,
-				domain_num, 0);
+				CAMERA_DOMAIN, GEN_POOL);
 		ion_free(client, mem->ion_handle);
 #elif CONFIG_ANDROID_PMEM
 		put_pmem_file(mem->file);
@@ -287,7 +277,7 @@
 	D("mem = 0x%x\n", (u32)mem);
 	BUG_ON(!mem);
 	MAGIC_CHECK(mem->magic, MAGIC_PMEM);
-	/* Try to remap memory */
+	
 	size = vma->vm_end - vma->vm_start;
 	size = (size < mem->size) ? size : mem->size;
 	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
@@ -304,8 +294,8 @@
 	vma->vm_private_data = mem;
 
 	D("mmap %p: %08lx-%08lx (%lx) pgoff %08lx\n",
-		vma, vma->vm_start, vma->vm_end,
-		(long int)mem->size, vma->vm_pgoff);
+		map, vma->vm_start, vma->vm_end,
+		(long int)mem->bsize, vma->vm_pgoff);
 	videobuf2_vm_open(vma);
 	return 0;
 error:
diff --git a/drivers/media/video/videobuf2-vmalloc.c b/drivers/media/video/videobuf2-vmalloc.c
index 6b5ca6c..178ff81 100644
--- a/drivers/media/video/videobuf2-vmalloc.c
+++ b/drivers/media/video/videobuf2-vmalloc.c
@@ -10,10 +10,8 @@
  * the Free Software Foundation.
  */
 
-#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/mm.h>
-#include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 
@@ -22,11 +20,7 @@
 
 struct vb2_vmalloc_buf {
 	void				*vaddr;
-	struct page			**pages;
-	struct vm_area_struct		*vma;
-	int				write;
 	unsigned long			size;
-	unsigned int			n_pages;
 	atomic_t			refcount;
 	struct vb2_vmarea_handler	handler;
 };
@@ -37,7 +31,7 @@
 {
 	struct vb2_vmalloc_buf *buf;
 
-	buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+	buf = kzalloc(sizeof *buf, GFP_KERNEL);
 	if (!buf)
 		return NULL;
 
@@ -48,12 +42,15 @@
 	buf->handler.arg = buf;
 
 	if (!buf->vaddr) {
-		pr_debug("vmalloc of size %ld failed\n", buf->size);
+		printk(KERN_ERR "vmalloc of size %ld failed\n", buf->size);
 		kfree(buf);
 		return NULL;
 	}
 
 	atomic_inc(&buf->refcount);
+	printk(KERN_DEBUG "Allocated vmalloc buffer of size %ld at vaddr=%p\n",
+			buf->size, buf->vaddr);
+
 	return buf;
 }
 
@@ -62,106 +59,21 @@
 	struct vb2_vmalloc_buf *buf = buf_priv;
 
 	if (atomic_dec_and_test(&buf->refcount)) {
+		printk(KERN_DEBUG "%s: Freeing vmalloc mem at vaddr=%p\n",
+			__func__, buf->vaddr);
 		vfree(buf->vaddr);
 		kfree(buf);
 	}
 }
 
-static void *vb2_vmalloc_get_userptr(void *alloc_ctx, unsigned long vaddr,
-				     unsigned long size, int write)
-{
-	struct vb2_vmalloc_buf *buf;
-	unsigned long first, last;
-	int n_pages, offset;
-	struct vm_area_struct *vma;
-	dma_addr_t physp;
-
-	buf = kzalloc(sizeof(*buf), GFP_KERNEL);
-	if (!buf)
-		return NULL;
-
-	buf->write = write;
-	offset = vaddr & ~PAGE_MASK;
-	buf->size = size;
-
-
-	vma = find_vma(current->mm, vaddr);
-	if (vma && (vma->vm_flags & VM_PFNMAP) && (vma->vm_pgoff)) {
-		if (vb2_get_contig_userptr(vaddr, size, &vma, &physp))
-			goto fail_pages_array_alloc;
-		buf->vma = vma;
-		buf->vaddr = ioremap_nocache(physp, size);
-		if (!buf->vaddr)
-			goto fail_pages_array_alloc;
-	} else {
-		first = vaddr >> PAGE_SHIFT;
-		last  = (vaddr + size - 1) >> PAGE_SHIFT;
-		buf->n_pages = last - first + 1;
-		buf->pages = kzalloc(buf->n_pages * sizeof(struct page *),
-				     GFP_KERNEL);
-		if (!buf->pages)
-			goto fail_pages_array_alloc;
-
-		/* current->mm->mmap_sem is taken by videobuf2 core */
-		n_pages = get_user_pages(current, current->mm,
-					 vaddr & PAGE_MASK, buf->n_pages,
-					 write, 1, /* force */
-					 buf->pages, NULL);
-		if (n_pages != buf->n_pages)
-			goto fail_get_user_pages;
-
-		buf->vaddr = vm_map_ram(buf->pages, buf->n_pages, -1,
-					PAGE_KERNEL);
-		if (!buf->vaddr)
-			goto fail_get_user_pages;
-	}
-
-	buf->vaddr += offset;
-	return buf;
-
-fail_get_user_pages:
-	pr_debug("get_user_pages requested/got: %d/%d]\n", n_pages,
-		 buf->n_pages);
-	while (--n_pages >= 0)
-		put_page(buf->pages[n_pages]);
-	kfree(buf->pages);
-
-fail_pages_array_alloc:
-	kfree(buf);
-
-	return NULL;
-}
-
-static void vb2_vmalloc_put_userptr(void *buf_priv)
-{
-	struct vb2_vmalloc_buf *buf = buf_priv;
-	unsigned long vaddr = (unsigned long)buf->vaddr & PAGE_MASK;
-	unsigned int i;
-
-	if (buf->pages) {
-		if (vaddr)
-			vm_unmap_ram((void *)vaddr, buf->n_pages);
-		for (i = 0; i < buf->n_pages; ++i) {
-			if (buf->write)
-				set_page_dirty_lock(buf->pages[i]);
-			put_page(buf->pages[i]);
-		}
-		kfree(buf->pages);
-	} else {
-		if (buf->vma)
-			vb2_put_vma(buf->vma);
-		iounmap(buf->vaddr);
-	}
-	kfree(buf);
-}
-
 static void *vb2_vmalloc_vaddr(void *buf_priv)
 {
 	struct vb2_vmalloc_buf *buf = buf_priv;
 
+	BUG_ON(!buf);
+
 	if (!buf->vaddr) {
-		pr_err("Address of an unallocated plane requested "
-		       "or cannot map user pointer\n");
+		printk(KERN_ERR "Address of an unallocated plane requested\n");
 		return NULL;
 	}
 
@@ -180,24 +92,18 @@
 	int ret;
 
 	if (!buf) {
-		pr_err("No memory to map\n");
+		printk(KERN_ERR "No memory to map\n");
 		return -EINVAL;
 	}
 
 	ret = remap_vmalloc_range(vma, buf->vaddr, 0);
 	if (ret) {
-		pr_err("Remapping vmalloc memory, error: %d\n", ret);
+		printk(KERN_ERR "Remapping vmalloc memory, error: %d\n", ret);
 		return ret;
 	}
 
-	/*
-	 * Make sure that vm_areas for 2 buffers won't be merged together
-	 */
 	vma->vm_flags		|= VM_DONTEXPAND;
 
-	/*
-	 * Use common vm_area operations to track buffer refcount.
-	 */
 	vma->vm_private_data	= &buf->handler;
 	vma->vm_ops		= &vb2_common_vm_ops;
 
@@ -209,8 +115,6 @@
 const struct vb2_mem_ops vb2_vmalloc_memops = {
 	.alloc		= vb2_vmalloc_alloc,
 	.put		= vb2_vmalloc_put,
-	.get_userptr	= vb2_vmalloc_get_userptr,
-	.put_userptr	= vb2_vmalloc_put_userptr,
 	.vaddr		= vb2_vmalloc_vaddr,
 	.mmap		= vb2_vmalloc_mmap,
 	.num_users	= vb2_vmalloc_num_users,
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
index 1efad20..1287645 100644
--- a/drivers/mfd/ab3100-core.c
+++ b/drivers/mfd/ab3100-core.c
@@ -409,8 +409,6 @@
 	u32 fatevent;
 	int err;
 
-	add_interrupt_randomness(irq);
-
 	err = ab3100_get_register_page_interruptible(ab3100, AB3100_EVENTA1,
 				       event_regs, 3);
 	if (err)
@@ -933,9 +931,6 @@
 
 	err = request_threaded_irq(client->irq, NULL, ab3100_irq_handler,
 				IRQF_ONESHOT, "ab3100-core", ab3100);
-	/* This real unpredictable IRQ is of course sampled for entropy */
-	rand_initialize_irq(client->irq);
-
 	if (err)
 		goto exit_no_irq;
 
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index 43a76c4..db662e2 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -202,7 +202,7 @@
 		}
 		local_irq_enable();
 		ezx_pcap_write(pcap, PCAP_REG_MSR, pcap->msr);
-	} while (gpio_get_value(irq_to_gpio(pcap->spi->irq)));
+	} while (gpio_get_value(pdata->gpio));
 }
 
 static void pcap_irq_handler(unsigned int irq, struct irq_desc *desc)
diff --git a/drivers/mfd/pm8921-core.c b/drivers/mfd/pm8921-core.c
index 088c756..6850fab 100644
--- a/drivers/mfd/pm8921-core.c
+++ b/drivers/mfd/pm8921-core.c
@@ -24,7 +24,11 @@
 #include <linux/mfd/pm8xxx/pm8921.h>
 #include <linux/mfd/pm8xxx/core.h>
 #include <linux/mfd/pm8xxx/regulator.h>
+#ifdef CONFIG_MACH_HTC
+#include <linux/leds-pm8xxx-htc.h>
+#else
 #include <linux/leds-pm8xxx.h>
+#endif
 
 #define REG_HWREV		0x002  /* PMIC4 revision */
 #define REG_HWREV_2		0x0E8  /* PMIC4 revision 2 */
diff --git a/drivers/mfd/pm8xxx-batt-alarm.c b/drivers/mfd/pm8xxx-batt-alarm.c
index 88aab98..2eaa4e3 100644
--- a/drivers/mfd/pm8xxx-batt-alarm.c
+++ b/drivers/mfd/pm8xxx-batt-alarm.c
@@ -591,6 +591,53 @@
 }
 EXPORT_SYMBOL(pm8xxx_batt_alarm_unregister_notifier);
 
+#ifdef CONFIG_MACH_HTC
+static void (*notify_batt_lower_alarm_func_ptr)(int);
+static int pm8xxx_batt_alarm_internal_notifier_func(
+		struct notifier_block *nfb, unsigned long value, void *data)
+{
+	unsigned int lower_alarm_state = !!((unsigned int)value & BIT(0));
+	pr_info("value = %lu\n", value);
+	if (notify_batt_lower_alarm_func_ptr)
+		notify_batt_lower_alarm_func_ptr(lower_alarm_state);
+	return 0;
+}
+
+static struct notifier_block htc_gauge_batt_alarm_notifier = {
+	.notifier_call = pm8xxx_batt_alarm_internal_notifier_func,
+};
+
+int pm8xxx_batt_lower_alarm_register_notifier(void (*callback)(int))
+{
+	if (!callback) {
+		pr_warn("no callback function assigned\n");
+		return -ENXIO;
+	}
+	notify_batt_lower_alarm_func_ptr = callback;
+	return pm8xxx_batt_alarm_register_notifier(
+			&htc_gauge_batt_alarm_notifier);
+}
+EXPORT_SYMBOL(pm8xxx_batt_lower_alarm_register_notifier);
+
+int pm8xxx_batt_lower_alarm_enable(int enable)
+{
+	int rc;
+	if (enable)
+		rc = pm8xxx_batt_alarm_enable(PM8XXX_BATT_ALARM_LOWER_COMPARATOR);
+	else
+		rc = pm8xxx_batt_alarm_disable(PM8XXX_BATT_ALARM_LOWER_COMPARATOR);
+	return rc;
+}
+EXPORT_SYMBOL(pm8xxx_batt_lower_alarm_enable);
+
+int pm8xxx_batt_lower_alarm_threshold_set(int threshold_mV)
+{
+	return pm8xxx_batt_alarm_threshold_set(PM8XXX_BATT_ALARM_LOWER_COMPARATOR,
+			threshold_mV);
+}
+EXPORT_SYMBOL(pm8xxx_batt_lower_alarm_threshold_set);
+#endif
+
 static int pm8xxx_batt_alarm_reg_init(struct pm8xxx_batt_alarm_chip *chip)
 {
 	int rc = 0;
diff --git a/drivers/mfd/wm831x-otp.c b/drivers/mfd/wm831x-otp.c
index f742745..b90f3e0 100644
--- a/drivers/mfd/wm831x-otp.c
+++ b/drivers/mfd/wm831x-otp.c
@@ -18,6 +18,7 @@
 #include <linux/bcd.h>
 #include <linux/delay.h>
 #include <linux/mfd/core.h>
+#include <linux/random.h>
 
 #include <linux/mfd/wm831x/core.h>
 #include <linux/mfd/wm831x/otp.h>
@@ -66,6 +67,7 @@
 
 int wm831x_otp_init(struct wm831x *wm831x)
 {
+	char uuid[WM831X_UNIQUE_ID_LEN];
 	int ret;
 
 	ret = device_create_file(wm831x->dev, &dev_attr_unique_id);
@@ -73,6 +75,12 @@
 		dev_err(wm831x->dev, "Unique ID attribute not created: %d\n",
 			ret);
 
+	ret = wm831x_unique_id_read(wm831x, uuid);
+	if (ret == 0)
+		add_device_randomness(uuid, sizeof(uuid));
+	else
+		dev_err(wm831x->dev, "Failed to read UUID: %d\n", ret);
+
 	return ret;
 }
 
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 8f6735d..786395e 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -603,6 +603,14 @@
 	  on the PM8XXX chips. The vibrator is controlled using the
 	  timed output class.
 
+config PMIC8XXX_VIBRATOR_PWM
+	tristate "Qualcomm Vibrator support for PMIC8XXX with PWM function"
+	depends on MFD_PM8XXX && ANDROID_TIMED_OUTPUT
+	help
+	  This option enables device driver support for the vibrator
+	  on the PM8XXX chips. The vibrator is controlled using the
+	  timed output class.
+
 config ANDROID_VIBRATOR
 	bool "Android vibrator support"
 	depends on ANDROID_TIMED_OUTPUT
@@ -681,6 +689,32 @@
 	help
 	  depends on BU52031NVX
 
+config CABLE_DETECT_8XXX
+	boolean "Cable detect driver"
+	default n
+	help
+	  Detect USB, AC, and other accessories.
+
+config CABLE_DETECT_ACCESSORY
+	boolean "Cable accessory detect"
+	default n
+
+config CABLE_DETECT_ACCESSORY_BY_ADC
+	boolean "Cable detect accessory by PMIC ADC"
+	default n
+
+config VP_A1028
+	tristate "A1028 Voice Processor driver"
+	depends on I2C
+	help
+	  A1028 Voice Processor driver implemented by HTC.
+
+config SENSORS_NFC_PN544
+	tristate "PN544 NFC Sensor driver"
+	depends on I2C
+	help
+	  PN544 NFC driver.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 90f1803..59f4fcd 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -64,6 +64,7 @@
 obj-$(CONFIG_HAPTIC_ISA1200)		+= isa1200.o
 obj-$(CONFIG_PMIC8058_PWM) += pmic8058-pwm.o
 obj-$(CONFIG_PMIC8XXX_VIBRATOR) += pm8xxx-vibrator.o
+obj-$(CONFIG_PMIC8XXX_VIBRATOR_PWM) += pm8xxx-vibrator-pwm.o
 obj-$(CONFIG_PMIC8XXX_NFC) += pm8xxx-nfc.o
 obj-$(CONFIG_PMIC8XXX_UPL) += pm8xxx-upl.o
 obj-$(CONFIG_ANDROID_VIBRATOR)	+= android_vibrator.o
@@ -75,3 +76,6 @@
 obj-y += tspdrv/
 obj-$(CONFIG_BU52031NVX) += pm8xxx-cradle.o
 obj-$(CONFIG_SLIMPORT_ANX7808)	+= slimport_anx7808/
+obj-$(CONFIG_CABLE_DETECT_8XXX)	+= cable_detect_8xxx.o
+obj-$(CONFIG_VP_A1028)		+= a1028.o
+obj-$(CONFIG_SENSORS_NFC_PN544)	+= pn544.o
diff --git a/drivers/misc/a1028.c b/drivers/misc/a1028.c
new file mode 100644
index 0000000..07a4092
--- /dev/null
+++ b/drivers/misc/a1028.c
@@ -0,0 +1,1343 @@
+/* drivers/i2c/chips/a1028.c - a1028 voice processor driver
+ *
+ * Copyright (C) 2009 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/slab.h>
+#include <linux/irq.h>
+#include <linux/miscdevice.h>
+#include <linux/gpio.h>
+#include <linux/uaccess.h>
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/workqueue.h>
+#include <linux/freezer.h>
+#include <linux/a1028.h>
+#include <mach/msm_xo.h>
+#define DEBUG			(0)
+#define ENABLE_DIAG_IOCTLS	(1)
+
+#define PARAM_MAX	(sizeof(char) * 6 * 1024)
+
+static struct i2c_client *this_client;
+static struct a1028_platform_data *pdata;
+
+static int execute_cmdmsg(unsigned int);
+
+static struct mutex a1028_lock;
+static int a1028_opened;
+static int a1028_suspended;
+static int control_a1028_clk;
+static int control_a1028_xo_clk;
+static int control_a1028_micsel;
+static int a1028_NS_state = A1028_NS_STATE_AUTO;
+static int a1028_current_config = A1028_PATH_SUSPEND;
+static int a1028_param_ID;
+static char *config_data;
+static int a1028_cmds_len;
+
+struct vp_ctxt {
+	unsigned char *data;
+	unsigned int img_size;
+};
+
+struct vp_ctxt the_vp;
+
+static struct msm_xo_voter *a1028_clock;
+static const char *cid = "A1028";
+static int a1028_xo_clk_enable(int en)
+{
+	int rc = 0;
+	if (a1028_clock != NULL) {
+		if (en)
+			rc = msm_xo_mode_vote(a1028_clock, MSM_XO_MODE_ON);
+		else
+			rc = msm_xo_mode_vote(a1028_clock, MSM_XO_MODE_OFF);
+		if (rc < 0) {
+			pr_err("Configuring MSM_XO_MODE_ON failed"
+						" (%d)\n", rc);
+			goto fail;
+		}
+	} else
+		pr_err("a1028_clock is null\n");
+	return rc;
+fail:
+	msm_xo_put(a1028_clock);
+	return rc;
+}
+
+static void a1028_gpio_set_value(int gpio, int value)
+{
+	if (gpio >  0)
+		gpio_set_value(gpio, value);
+}
+
+static void a1028_pmic_set_value(int gpio, int value)
+{
+}
+
+static int a1028_i2c_read(char *rxData, int length)
+{
+	int rc;
+	struct i2c_msg msgs[] = {
+		{
+			.addr = this_client->addr,
+			.flags = I2C_M_RD,
+			.len = length,
+			.buf = rxData,
+		},
+	};
+
+	rc = i2c_transfer(this_client->adapter, msgs, 1);
+	if (rc < 0) {
+		pr_err("%s: transfer error %d\n", __func__, rc);
+		return rc;
+	}
+
+#if DEBUG
+	{
+		int i = 0;
+		for (i = 0; i < length; i++)
+			pr_info("%s: rx[%d] = %2x\n", \
+				__func__, i, rxData[i]);
+	}
+#endif
+
+	return 0;
+}
+
+static int a1028_i2c_write(char *txData, int length)
+{
+	int rc;
+	struct i2c_msg msg[] = {
+		{
+			.addr = this_client->addr,
+			.flags = 0,
+			.len = length,
+			.buf = txData,
+		},
+	};
+
+	rc = i2c_transfer(this_client->adapter, msg, 1);
+	if (rc < 0) {
+		pr_err("%s: transfer error %d\n", __func__, rc);
+		return rc;
+	}
+
+#if DEBUG
+	{
+		int i = 0;
+		for (i = 0; i < length; i++)
+			pr_info("%s: tx[%d] = %2x\n", \
+				__func__, i, txData[i]);
+	}
+#endif
+
+	return 0;
+}
+
+static int a1028_open(struct inode *inode, struct file *file)
+{
+	int rc = 0;
+	struct vp_ctxt *vp = &the_vp;
+
+	mutex_lock(&a1028_lock);
+
+	if (a1028_opened) {
+		pr_err("%s: busy\n", __func__);
+		rc = -EBUSY;
+		goto done;
+	}
+
+	file->private_data = vp;
+	vp->img_size = 0;
+	a1028_opened = 1;
+done:
+	mutex_unlock(&a1028_lock);
+	return rc;
+}
+
+static int a1028_release(struct inode *inode, struct file *file)
+{
+	mutex_lock(&a1028_lock);
+	a1028_opened = 0;
+	mutex_unlock(&a1028_lock);
+
+	return 0;
+}
+
+static void a1028_i2c_sw_reset(unsigned int reset_cmd)
+{
+	int rc = 0;
+	unsigned char msgbuf[4];
+
+	msgbuf[0] = (reset_cmd >> 24) & 0xFF;
+	msgbuf[1] = (reset_cmd >> 16) & 0xFF;
+	msgbuf[2] = (reset_cmd >> 8) & 0xFF;
+	msgbuf[3] = reset_cmd & 0xFF;
+
+	pr_info("%s: %08x\n", __func__, reset_cmd);
+
+	rc = a1028_i2c_write(msgbuf, 4);
+	if (!rc)
+		msleep(20);
+}
+
+static ssize_t a1028_bootup_init(struct file *file, struct a1028img *img)
+{
+	struct vp_ctxt *vp = file->private_data;
+	int rc, pass = 0;
+	int remaining;
+	int retry = RETRY_CNT;
+	unsigned char *index;
+	char buf[2];
+
+	if (img->img_size > A1028_MAX_FW_SIZE) {
+		pr_err("%s: invalid a1028 image size %d\n", __func__,
+			img->img_size);
+		return -EINVAL;
+	}
+
+	vp->data = kmalloc(img->img_size, GFP_KERNEL);
+	if (!vp->data) {
+		pr_err("%s: out of memory\n", __func__);
+		return -ENOMEM;
+	}
+	vp->img_size = img->img_size;
+	if (copy_from_user(vp->data, img->buf, img->img_size)) {
+		pr_err("%s: copy from user failed\n", __func__);
+		kfree(vp->data);
+		return -EFAULT;
+	}
+
+	while (retry--) {
+		
+		a1028_gpio_set_value(pdata->gpio_a1028_reset, 0);
+
+		
+		if (control_a1028_clk) {
+			a1028_gpio_set_value(pdata->gpio_a1028_clk, 1);
+			mdelay(1);
+		}
+		if (control_a1028_xo_clk) {
+			a1028_xo_clk_enable(1);
+			mdelay(1);
+		}
+		
+		a1028_gpio_set_value(pdata->gpio_a1028_reset, 1);
+
+		msleep(50); 
+
+		
+		buf[0] = A1028_msg_BOOT >> 8;
+		buf[1] = A1028_msg_BOOT & 0xff;
+
+		rc = a1028_i2c_write(buf, 2);
+		if (rc < 0) {
+			pr_err("%s: set boot mode error \
+				(%d retries left)\n", __func__, retry);
+			continue;
+		}
+
+		mdelay(1); 
+		rc = a1028_i2c_read(buf, 1);
+		if (rc < 0) {
+			pr_err("%s: boot mode ack error \
+				(%d retries left)\n", __func__, retry);
+			continue;
+		}
+
+		if (buf[0] != A1028_msg_BOOT_ACK) {
+			pr_err("%s: not a boot-mode ack \
+				(%d retries left)\n", __func__, retry);
+			continue;
+		}
+
+		remaining = vp->img_size / 32;
+		index = vp->data;
+
+		pr_info("%s: starting to load image (%d passes)...\n",
+			__func__,
+			remaining + !!(vp->img_size % 32));
+
+		for (; remaining; remaining--, index += 32) {
+			rc = a1028_i2c_write(index, 32);
+			if (rc < 0)
+				break;
+		}
+
+		if (rc >= 0 && vp->img_size % 32)
+			rc = a1028_i2c_write(index, vp->img_size % 32);
+
+		if (rc < 0) {
+			pr_err("%s: fw load error %d (%d retries left)\n",
+				__func__, rc, retry);
+			continue;
+		}
+
+		msleep(20); 
+
+		pr_info("%s: firmware loaded successfully\n", __func__);
+
+		rc = execute_cmdmsg(A100_msg_Sync);
+		if (rc < 0) {
+			pr_err("%s: sync command error %d \
+				(%d retries left)\n", __func__, rc, retry);
+			continue;
+		}
+
+		pass = 1;
+		break;
+	}
+
+	
+	rc = execute_cmdmsg(A100_msg_Sleep);
+	if (rc < 0) {
+		pr_err("%s: suspend error\n", __func__);
+		goto set_suspend_err;
+	}
+
+	a1028_suspended = 1;
+	a1028_current_config = A1028_PATH_SUSPEND;
+
+	msleep(120);
+	
+	if (control_a1028_clk)
+		a1028_gpio_set_value(pdata->gpio_a1028_clk, 0);
+	if (control_a1028_xo_clk)
+		a1028_xo_clk_enable(0);
+
+set_suspend_err:
+	if (pass && !rc)
+		pr_info("%s: initialized!\n", __func__);
+	else
+		pr_err("%s: initialization failed\n", __func__);
+
+	kfree(vp->data);
+	return rc;
+}
+
+unsigned char phonecall_receiver[] = {
+	0x80, 0x1C, 0x00, 0x01,
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x17, 0x00, 0x00,
+	0x80, 0x18, 0x00, 0x04,
+	0x80, 0x1B, 0x00, 0x0C,
+	0x80, 0x1B, 0x01, 0x0C,
+	0x80, 0x17, 0x00, 0x04,
+	0x80, 0x18, 0x00, 0x00,
+};
+
+unsigned char phonecall_headset[] = {
+	0x80, 0x1C, 0x00, 0x01,
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x03,
+	0x80, 0x26, 0x00, 0x15,
+	0x80, 0x17, 0x00, 0x00,
+	0x80, 0x18, 0x00, 0x04,
+	0x80, 0x1B, 0x00, 0x0D,
+	0x80, 0x17, 0x00, 0x04,
+	0x80, 0x18, 0x00, 0x00,
+};
+
+unsigned char phonecall_TTY_headset[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x03,
+	0x80, 0x26, 0x00, 0x15,
+	0x80, 0x1C, 0x00, 0x00,
+	0x80, 0x1B, 0x00, 0x00,
+	0x80, 0x1B, 0x01, 0x00,
+	0x80, 0x15, 0x00, 0x00,
+};
+
+unsigned char phonecall_speaker[] = {
+	0x80, 0x1C, 0x00, 0x01,
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x02,
+	0x80, 0x17, 0x00, 0x00,
+	0x80, 0x18, 0x00, 0x04,
+	0x80, 0x1B, 0x00, 0x14,
+	0x80, 0x17, 0x00, 0x04,
+	0x80, 0x18, 0x00, 0x00,
+};
+
+unsigned char phonecall_bt[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x03,
+	0x80, 0x26, 0x00, 0x06,
+	0x80, 0x1C, 0x00, 0x00,
+	0x80, 0x1B, 0x00, 0x00,
+	0x80, 0x15, 0x00, 0x00,
+};
+
+unsigned char INT_MIC_recording_receiver[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x26, 0x00, 0x01,
+	0x80, 0x1B, 0x00, 0x0D,
+	0x80, 0x1B, 0x01, 0x0D,
+	0x80, 0x15, 0x00, 0x00,
+	0x80, 0x1C, 0x00, 0x03,
+};
+
+unsigned char INT_MIC_stereo_recording_receiver[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x03,
+	0x80, 0x26, 0x00, 0x07,
+	0x80, 0x1B, 0x00, 0xFA,
+	0x80, 0x15, 0x00, 0x00,
+	0x80, 0x1C, 0x00, 0x03,
+};
+
+unsigned char EXT_MIC_recording[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x03,
+	0x80, 0x26, 0x00, 0x15,
+	0x80, 0x1B, 0x00, 0x0D,
+	0x80, 0x1B, 0x01, 0x00,
+	0x80, 0x15, 0x00, 0x00,
+	0x80, 0x1C, 0x00, 0x03,
+};
+
+unsigned char INT_MIC_recording_speaker[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x26, 0x00, 0x01,
+	0x80, 0x1B, 0x00, 0x0D,
+	0x80, 0x1B, 0x01, 0x0D,
+	0x80, 0x15, 0x00, 0x00,
+	0x80, 0x1C, 0x00, 0x03,
+};
+
+unsigned char INT_MIC_stereo_recording_speaker[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x03,
+	0x80, 0x26, 0x00, 0x07,
+	0x80, 0x1B, 0x00, 0xFA,
+	0x80, 0x15, 0x00, 0x00,
+	0x80, 0x1C, 0x00, 0x03,
+};
+
+unsigned char BACK_MIC_recording[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x26, 0x00, 0x15,
+	0x80, 0x1B, 0x00, 0x0D,
+	0x80, 0x15, 0x00, 0x00,
+	0x80, 0x1C, 0x00, 0x03,
+};
+
+unsigned char vr_no_ns_receiver[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x1C, 0x00, 0x00,
+	0x80, 0x1B, 0x00, 0x0C,
+	0x80, 0x1B, 0x01, 0x0C,
+	0x80, 0x15, 0x00, 0x00,
+};
+
+unsigned char vr_no_ns_headset[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x03,
+	0x80, 0x26, 0x00, 0x15,
+	0x80, 0x1C, 0x00, 0x00,
+	0x80, 0x1B, 0x00, 0x12,
+	0x80, 0x15, 0x00, 0x00,
+};
+
+unsigned char vr_no_ns_speaker[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x02,
+	0x80, 0x1C, 0x00, 0x00,
+	0x80, 0x1B, 0x00, 0x0C,
+	0x80, 0x15, 0x00, 0x00,
+};
+
+unsigned char vr_no_ns_bt[] = {
+	0x80, 0x26, 0x00, 0x06,
+	0x80, 0x1C, 0x00, 0x00,
+	0x80, 0x1B, 0x00, 0x00,
+	0x80, 0x15, 0x00, 0x00,
+};
+
+unsigned char vr_ns_receiver[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x1C, 0x00, 0x01,
+	0x80, 0x17, 0x00, 0x1A,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x17, 0x00, 0x04,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x17, 0x00, 0x00,
+	0x80, 0x18, 0x00, 0x04,
+	0x80, 0x1B, 0x00, 0x0C,
+	0x80, 0x1B, 0x01, 0x0C,
+	0x80, 0x15, 0x00, 0x00,
+};
+
+unsigned char vr_ns_headset[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x03,
+	0x80, 0x26, 0x00, 0x15,
+	0x80, 0x1C, 0x00, 0x01,
+	0x80, 0x17, 0x00, 0x00,
+	0x80, 0x18, 0x00, 0x02,
+	0x80, 0x17, 0x00, 0x1A,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x17, 0x00, 0x04,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x1B, 0x00, 0x12,
+	0x80, 0x15, 0x00, 0x00,
+};
+
+unsigned char vr_ns_speaker[] = {
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x02,
+	0x80, 0x1C, 0x00, 0x01,
+	0x80, 0x17, 0x00, 0x00,
+	0x80, 0x18, 0x00, 0x04,
+	0x80, 0x17, 0x00, 0x04,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x17, 0x00, 0x1A,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x1B, 0x00, 0x0C,
+	0x80, 0x15, 0x00, 0x00,
+};
+
+unsigned char vr_ns_bt[] = {
+	0x80, 0x26, 0x00, 0x06,
+	0x80, 0x1C, 0x00, 0x01,
+	0x80, 0x17, 0x00, 0x00,
+	0x80, 0x18, 0x00, 0x02,
+	0x80, 0x17, 0x00, 0x04,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x17, 0x00, 0x1A,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x1B, 0x00, 0x00,
+	0x80, 0x15, 0x00, 0x00,
+};
+
+unsigned char suspend_mode[] = {
+	0x80, 0x10, 0x00, 0x01
+};
+
+unsigned char mfg_loopback[] = {
+	0x80, 0x1C, 0x00, 0x00,
+	0x80, 0x17, 0x00, 0x02,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x17, 0x00, 0x00,
+	0x80, 0x18, 0x00, 0x04,
+	0x80, 0x1B, 0x00, 0x00,
+	0x80, 0x1B, 0x01, 0x00,
+	0x80, 0x17, 0x00, 0x04,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x17, 0x00, 0x0E,
+	0x80, 0x18, 0x00, 0x00,
+	0x80, 0x17, 0x00, 0x15,
+	0x80, 0x18, 0x00, 0x01,
+};
+
+static ssize_t chk_wakeup_a1028(void)
+{
+	int rc = 0, retry = 3;
+
+	if (a1028_suspended == 1) {
+		
+		if (control_a1028_clk) {
+			a1028_gpio_set_value(pdata->gpio_a1028_clk, 1);
+			mdelay(1);
+		}
+		if (control_a1028_xo_clk) {
+			a1028_xo_clk_enable(1);
+			mdelay(1);
+		}
+
+		a1028_gpio_set_value(pdata->gpio_a1028_wakeup, 0);
+		msleep(120);
+
+		do {
+			rc = execute_cmdmsg(A100_msg_Sync);
+		} while ((rc < 0) && --retry);
+
+		a1028_gpio_set_value(pdata->gpio_a1028_wakeup, 1);
+		if (rc < 0) {
+			pr_err("%s: failed (%d)\n", __func__, rc);
+			goto wakeup_sync_err;
+		}
+
+		a1028_suspended = 0;
+	}
+wakeup_sync_err:
+	return rc;
+}
+
+int a1028_filter_vp_cmd(int cmd, int mode)
+{
+	int msg = (cmd >> 16) & 0xFFFF;
+	int filtered_cmd = cmd;
+
+	if (a1028_NS_state == A1028_NS_STATE_AUTO)
+		return cmd;
+
+	switch (msg) {
+	case A100_msg_Bypass:
+		if (a1028_NS_state == A1028_NS_STATE_OFF)
+			filtered_cmd = A1028_msg_VP_OFF;
+		else
+			filtered_cmd = A1028_msg_VP_ON;
+		break;
+	case A100_msg_SetAlgorithmParmID:
+		a1028_param_ID = cmd & 0xFFFF;
+		break;
+	case A100_msg_SetAlgorithmParm:
+		if (a1028_param_ID == Mic_Config) {
+			if (a1028_NS_state == A1028_NS_STATE_CT)
+				filtered_cmd = (msg << 16);
+			else if (a1028_NS_state == A1028_NS_STATE_FT)
+				filtered_cmd = (msg << 16) | 0x0002;
+		}
+		break;
+	default:
+		if (mode == A1028_CONFIG_VP)
+			filtered_cmd = -1;
+		break;
+	}
+
+	pr_info("%s: %x filtered = %x, a1028_NS_state %d, mode %d\n",\
+		__func__, cmd, filtered_cmd, a1028_NS_state, mode);
+
+	return filtered_cmd;
+}
+int build_cmds(char *cmds, int newid)
+{
+	int i = 0;
+	int offset = 0;
+	for (i = 0; i < a1028_cmds_len; i += 6)
+		if (config_data[i] == newid) {
+			cmds[offset++] = config_data[i + 2];
+			cmds[offset++] = config_data[i + 3];
+			cmds[offset++] = config_data[i + 4];
+			cmds[offset++] = config_data[i + 5];
+		}
+	if (offset > 128) {
+		pr_err("Wrong i2c commands\n");
+		return 0;
+	}
+	return offset;
+}
+int a1028_set_config(int newid, int mode)
+{
+	int rc = 0, size = 0;
+	int number_of_cmd_sets, rd_retry_cnt;
+	unsigned int sw_reset = 0;
+	unsigned char *i2c_cmds;
+	unsigned char *index = 0;
+	unsigned char ack_buf[A1028_CMD_FIFO_DEPTH * 4];
+	unsigned char rdbuf[4];
+	unsigned char custom_cmds[128] = {0};
+
+	if ((a1028_suspended) && (newid == A1028_PATH_SUSPEND))
+		return rc;
+
+	rc = chk_wakeup_a1028();
+	if (rc < 0)
+		return rc;
+
+	sw_reset = ((A100_msg_Reset << 16) | RESET_IMMEDIATE);
+
+	switch (newid) {
+	case A1028_PATH_INCALL_RECEIVER:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = phonecall_receiver;
+		size = sizeof(phonecall_receiver);
+		break;
+	case A1028_PATH_INCALL_HEADSET:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 1);
+		i2c_cmds = phonecall_headset;
+		size = sizeof(phonecall_headset);
+		break;
+	case A1028_PATH_INCALL_SPEAKER:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = phonecall_speaker;
+		size = sizeof(phonecall_speaker);
+		break;
+	case A1028_PATH_INCALL_BT:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = phonecall_bt;
+		size = sizeof(phonecall_bt);
+		break;
+	case A1028_PATH_VR_NO_NS_RECEIVER:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = vr_no_ns_receiver;
+		size = sizeof(vr_no_ns_receiver);
+		break;
+	case A1028_PATH_VR_NO_NS_HEADSET:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 1);
+		i2c_cmds = vr_no_ns_headset;
+		size = sizeof(vr_no_ns_headset);
+		break;
+	case A1028_PATH_VR_NO_NS_SPEAKER:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = vr_no_ns_speaker;
+		size = sizeof(vr_no_ns_speaker);
+		break;
+	case A1028_PATH_VR_NO_NS_BT:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = vr_no_ns_bt;
+		size = sizeof(vr_no_ns_bt);
+		break;
+	case A1028_PATH_VR_NS_RECEIVER:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = vr_ns_receiver;
+		size = sizeof(vr_ns_receiver);
+		break;
+	case A1028_PATH_VR_NS_HEADSET:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 1);
+		i2c_cmds = vr_ns_headset;
+		size = sizeof(vr_ns_headset);
+		break;
+	case A1028_PATH_VR_NS_SPEAKER:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = vr_ns_speaker;
+		size = sizeof(vr_ns_speaker);
+		break;
+	case A1028_PATH_VR_NS_BT:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = vr_ns_bt;
+		size = sizeof(vr_ns_bt);
+		break;
+	case A1028_PATH_RECORD_RECEIVER:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = INT_MIC_recording_receiver;
+		size = sizeof(INT_MIC_recording_receiver);
+		break;
+	case A1028_PATH_RECORD_HEADSET:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 1);
+		i2c_cmds = EXT_MIC_recording;
+		size = sizeof(EXT_MIC_recording);
+		break;
+	case A1028_PATH_RECORD_SPEAKER:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = INT_MIC_recording_speaker;
+		size = sizeof(INT_MIC_recording_speaker);
+		break;
+	case A1028_PATH_RECORD_BT:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = phonecall_bt;
+		size = sizeof(phonecall_bt);
+		break;
+	case A1028_PATH_SUSPEND:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = (unsigned char *)suspend_mode;
+		size = sizeof(suspend_mode);
+		break;
+	case A1028_PATH_CAMCORDER:
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+		i2c_cmds = BACK_MIC_recording;
+		size = sizeof(BACK_MIC_recording);
+		break;
+	case A1028_PATH_MFG_LOOPBACK:
+		a1028_pmic_set_value(pdata->gpio_a1028_micswitch, 0);
+		i2c_cmds = mfg_loopback;
+		size = sizeof(mfg_loopback);
+		break;
+	default:
+		pr_err("%s: invalid cmd %d\n", __func__, newid);
+		rc = -1;
+		goto input_err;
+		break;
+	}
+
+	a1028_current_config = newid;
+
+	if (a1028_cmds_len > 0) {
+		int cmd_size = 0;
+		cmd_size = build_cmds(custom_cmds, newid);
+		if (cmd_size > 0)
+			i2c_cmds = custom_cmds;
+		size = cmd_size;
+		pr_info("use customize command\n");
+	}
+
+	pr_info("%s: change to mode %d\n", __func__, newid);
+
+	pr_info("%s: block write start (size = %d)\n", __func__, size);
+
+#if DEBUG
+	{
+		int i = 0;
+		for (i = 1; i <= size; i++) {
+			pr_info("%x ", *(i2c_cmds + i - 1));
+			if (!(i % 4))
+				pr_info("\n");
+		}
+	}
+#endif
+
+	rc = a1028_i2c_write(i2c_cmds, size);
+	if (rc < 0) {
+		pr_err("A1028 CMD block write error!\n");
+		a1028_i2c_sw_reset(sw_reset);
+		return rc;
+	}
+	pr_info("%s: block write end\n", __func__);
+
+	
+	if (*i2c_cmds == 0x80 && *(i2c_cmds + 1) == 0x10
+		&& *(i2c_cmds + 2) == 0x00 && *(i2c_cmds + 3) == 0x01) {
+		a1028_suspended = 1;
+		
+		msleep(120);
+		if (control_a1028_clk)
+			a1028_gpio_set_value(pdata->gpio_a1028_clk, 0);
+		if (control_a1028_xo_clk)
+			a1028_xo_clk_enable(0);
+		return rc;
+	}
+
+	memset(ack_buf, 0, sizeof(ack_buf));
+	msleep(20);
+	pr_info("%s: CMD ACK block read start\n", __func__);
+	rc = a1028_i2c_read(ack_buf, size);
+	if (rc < 0) {
+		pr_err("%s: CMD ACK block read error\n", __func__);
+		a1028_i2c_sw_reset(sw_reset);
+		return rc;
+	} else {
+		pr_info("%s: CMD ACK block read end\n", __func__);
+#if DEBUG
+	{
+		int i = 0;
+		for (i = 1; i <= size; i++) {
+			pr_info("%x ", ack_buf[i-1]);
+			if (!(i % 4))
+				pr_info("\n");
+		}
+	}
+#endif
+		index = ack_buf;
+		number_of_cmd_sets = size / 4;
+		do {
+			if (*index == 0x00) {
+				rd_retry_cnt = POLLING_RETRY_CNT;
+rd_retry:
+				if (rd_retry_cnt--) {
+					memset(rdbuf, 0, sizeof(rdbuf));
+					rc = a1028_i2c_read(rdbuf, 4);
+					if (rc < 0)
+						return rc;
+#if DEBUG
+				{
+					int i = 0;
+					for (i = 0; i < sizeof(rdbuf); i++)
+						pr_info("0x%x\n", rdbuf[i]);
+					pr_info("-----------------\n");
+				}
+#endif
+					if (rdbuf[0] == 0x00) {
+						msleep(20);
+						goto rd_retry;
+					}
+				} else {
+					pr_err("%s: CMD ACK Not Ready\n",
+						__func__);
+					return -EBUSY;
+				}
+			} else if (*index == 0xff) { 
+				return -ENOEXEC;
+			} else if (*index == 0x80) {
+				index += 4;
+			}
+		} while (--number_of_cmd_sets);
+	}
+input_err:
+	return rc;
+}
+
+int execute_cmdmsg(unsigned int msg)
+{
+	int rc = 0;
+	int retries, pass = 0;
+	unsigned char msgbuf[4];
+	unsigned char chkbuf[4];
+	unsigned int sw_reset = 0;
+
+	sw_reset = ((A100_msg_Reset << 16) | RESET_IMMEDIATE);
+
+	msgbuf[0] = (msg >> 24) & 0xFF;
+	msgbuf[1] = (msg >> 16) & 0xFF;
+	msgbuf[2] = (msg >> 8) & 0xFF;
+	msgbuf[3] = msg & 0xFF;
+
+	memcpy(chkbuf, msgbuf, 4);
+
+	rc = a1028_i2c_write(msgbuf, 4);
+	if (rc < 0) {
+		pr_err("%s: error %d\n", __func__, rc);
+		a1028_i2c_sw_reset(sw_reset);
+		return rc;
+	}
+
+	
+	if (msg == A100_msg_Sleep)
+		return rc;
+
+	retries = POLLING_RETRY_CNT;
+	while (retries--) {
+		rc = 0;
+
+		msleep(20); 
+		memset(msgbuf, 0, sizeof(msgbuf));
+		rc = a1028_i2c_read(msgbuf, 4);
+		if (rc < 0) {
+			pr_err("%s: ack-read error %d (%d retries)\n",\
+				__func__, rc, retries);
+			continue;
+		}
+
+		if (msgbuf[0] == 0x80  && msgbuf[1] == chkbuf[1]) {
+			pass = 1;
+			break;
+		} else if (msgbuf[0] == 0xff && msgbuf[1] == 0xff) {
+			pr_err("%s: illegal cmd %08x\n", __func__, msg);
+			rc = -EINVAL;
+			break;
+		} else if (msgbuf[0] == 0x00 && msgbuf[1] == 0x00) {
+			pr_info("%s: not ready (%d retries)\n", __func__,
+				retries);
+			rc = -EBUSY;
+		} else {
+			pr_info("%s: cmd/ack mismatch: (%d retries left)\n",
+				__func__,
+				retries);
+#if DEBUG
+		pr_info("%s: msgbuf[0] = %x\n", __func__, msgbuf[0]);
+		pr_info("%s: msgbuf[1] = %x\n", __func__, msgbuf[1]);
+		pr_info("%s: msgbuf[2] = %x\n", __func__, msgbuf[2]);
+		pr_info("%s: msgbuf[3] = %x\n", __func__, msgbuf[3]);
+#endif
+			rc = -EBUSY;
+		}
+	}
+
+	if (!pass) {
+		pr_err("%s: failed execute cmd %08x (%d)\n", __func__,
+			msg, rc);
+		a1028_i2c_sw_reset(sw_reset);
+	}
+	return rc;
+}
+
+#if ENABLE_DIAG_IOCTLS
+static int a1028_set_mic_state(char miccase)
+{
+	int rc = 0;
+	unsigned int cmd_msg = 0;
+
+	switch (miccase) {
+	case 1: 
+		cmd_msg = 0x80260007;
+		break;
+	case 2: 
+		cmd_msg = 0x80260015;
+		break;
+	case 3: 
+		cmd_msg = 0x80260001;
+		break;
+	case 4: 
+		cmd_msg = 0x80260006;
+		break;
+	default:
+		pr_info("%s: invalid input %d\n", __func__, miccase);
+		rc = -EINVAL;
+		break;
+	}
+	rc = execute_cmdmsg(cmd_msg);
+	return rc;
+}
+
+static int exe_cmd_in_file(unsigned char *incmd)
+{
+	int rc = 0;
+	int i = 0;
+	unsigned int cmd_msg = 0;
+	unsigned char tmp = 0;
+
+	for (i = 0; i < 4; i++) {
+		tmp = *(incmd + i);
+		cmd_msg |= (unsigned int)tmp;
+		if (i != 3)
+			cmd_msg = cmd_msg << 8;
+	}
+	rc = execute_cmdmsg(cmd_msg);
+	if (rc < 0)
+		pr_err("%s: cmd %08x error %d\n", __func__, cmd_msg, rc);
+	return rc;
+}
+#endif 
+
+static long
+a1028_ioctl(struct file *file, unsigned int cmd,
+			unsigned long arg)
+{
+	void __user *argp = (void __user *)arg;
+	struct a1028img img;
+	struct A1028_config_data cfg;
+	int rc = 0;
+#if ENABLE_DIAG_IOCTLS
+	char msg[4];
+	int mic_cases = 0;
+	int mic_sel = 0;
+#endif
+	int pathid = 0;
+	int ns_state;
+
+	switch (cmd) {
+	case A1028_BOOTUP_INIT:
+		img.buf = 0;
+		img.img_size = 0;
+		if (copy_from_user(&img, argp, sizeof(img)))
+			return -EFAULT;
+		rc = a1028_bootup_init(file, &img);
+		break;
+	case A1028_SET_CONFIG:
+		if (copy_from_user(&pathid, argp, sizeof(pathid)))
+			return -EFAULT;
+		if (pathid < 0 || pathid >= A1028_PATH_MAX)
+			return -EINVAL;
+		rc = a1028_set_config(pathid, A1028_CONFIG_FULL);
+		if (rc < 0)
+			pr_err("%s: A1028_SET_CONFIG (%d) error %d!\n",
+				__func__, pathid, rc);
+		break;
+	case A1028_SET_NS_STATE:
+		if (copy_from_user(&ns_state, argp, sizeof(ns_state)))
+			return -EFAULT;
+		pr_info("%s: set noise suppression %d\n",\
+			__func__, ns_state);
+		if (ns_state < 0 || ns_state >= A1028_NS_NUM_STATES)
+			return -EINVAL;
+		a1028_NS_state = ns_state;
+		if (!a1028_suspended)
+			a1028_set_config(a1028_current_config,
+					A1028_CONFIG_VP);
+		break;
+	case A1028_SET_PARAM:
+		a1028_cmds_len = 0;
+		cfg.cmd_data = 0;
+		if (copy_from_user(&cfg, argp, sizeof(cfg))) {
+			pr_err("%s: copy from user failed.\n", __func__);
+			return -EFAULT;
+		}
+
+		if (cfg.data_len <= 0 || cfg.data_len > PARAM_MAX) {
+				pr_err("%s: invalid data length %d\n", \
+				__func__, cfg.data_len);
+				return -EINVAL;
+		}
+
+		if (cfg.cmd_data == NULL) {
+			pr_err("%s: invalid data\n", __func__);
+			return -EINVAL;
+		}
+
+		if (config_data == NULL)
+			config_data = kmalloc(cfg.data_len, GFP_KERNEL);
+		if (!config_data) {
+			pr_err("%s: out of memory\n", __func__);
+			return -ENOMEM;
+		}
+		if (copy_from_user(config_data, cfg.cmd_data, cfg.data_len)) {
+			pr_err("%s: copy data from user failed.\n",\
+				__func__);
+			kfree(config_data);
+			config_data = NULL;
+			return -EFAULT;
+		}
+		a1028_cmds_len = cfg.data_len;
+		pr_info("%s: update a1028 i2c commands success.\n",\
+			__func__);
+		rc = 0;
+		break;
+#if ENABLE_DIAG_IOCTLS
+	case A1028_SET_MIC_ONOFF:
+		rc = chk_wakeup_a1028();
+		if (rc < 0)
+			return rc;
+		if (copy_from_user(&mic_cases, argp, sizeof(mic_cases)))
+			return -EFAULT;
+		rc = a1028_set_mic_state(mic_cases);
+		if (rc < 0)
+			pr_err("%s: A1028_SET_MIC_ONOFF %d error %d!\n",
+				__func__, mic_cases, rc);
+		break;
+	case A1028_SET_MICSEL_ONOFF:
+		rc = chk_wakeup_a1028();
+		if (rc < 0)
+			return rc;
+		if (copy_from_user(&mic_sel, argp, sizeof(mic_sel)))
+			return -EFAULT;
+		if (control_a1028_micsel)
+			a1028_gpio_set_value(pdata->gpio_a1028_micsel, \
+				!!mic_sel);
+		rc = 0;
+		break;
+	case A1028_READ_DATA:
+		rc = chk_wakeup_a1028();
+		if (rc < 0)
+			return rc;
+		rc = a1028_i2c_read(msg, 4);
+		if (copy_to_user(argp, &msg, 4))
+			return -EFAULT;
+		break;
+	case A1028_WRITE_MSG:
+		rc = chk_wakeup_a1028();
+		if (rc < 0)
+			return rc;
+		if (copy_from_user(msg, argp, sizeof(msg)))
+			return -EFAULT;
+		rc = a1028_i2c_write(msg, 4);
+		break;
+	case A1028_SYNC_CMD:
+		rc = chk_wakeup_a1028();
+		if (rc < 0)
+			return rc;
+		msg[0] = 0x80;
+		msg[1] = 0x00;
+		msg[2] = 0x00;
+		msg[3] = 0x00;
+		rc = a1028_i2c_write(msg, 4);
+		break;
+	case A1028_SET_CMD_FILE:
+		rc = chk_wakeup_a1028();
+		if (rc < 0)
+			return rc;
+		if (copy_from_user(msg, argp, sizeof(msg)))
+			return -EFAULT;
+		rc = exe_cmd_in_file(msg);
+		break;
+#endif 
+	default:
+		pr_err("%s: invalid command %d\n", __func__, _IOC_NR(cmd));
+		rc = -EINVAL;
+		break;
+	}
+
+	return rc;
+}
+
+static const struct file_operations a1028_fops = {
+	.owner = THIS_MODULE,
+	.open = a1028_open,
+	.release = a1028_release,
+	.unlocked_ioctl = a1028_ioctl,
+};
+
+static struct miscdevice a1028_device = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "audience_a1028",
+	.fops = &a1028_fops,
+};
+
+static int a1028_probe(
+	struct i2c_client *client, const struct i2c_device_id *id)
+{
+	int rc = 0;
+	control_a1028_xo_clk = 0;
+	pdata = client->dev.platform_data;
+
+	if (pdata == NULL) {
+		pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+		if (pdata == NULL) {
+			rc = -ENOMEM;
+			pr_err("%s: platform data is NULL\n", __func__);
+			goto err_alloc_data_failed;
+		}
+	}
+
+	this_client = client;
+#ifdef CONFIG_ARCH_MSM8960
+	a1028_clock = msm_xo_get(MSM_XO_TCXO_D1, cid);
+	if (IS_ERR(a1028_clock)) {
+		control_a1028_xo_clk = 0;
+		msm_xo_put(a1028_clock);
+	} else {
+		control_a1028_xo_clk = 1;
+		pr_info("use tcxo_d1 clk");
+	}
+	control_a1028_clk = 0;
+	control_a1028_micsel = 0;
+#else
+	rc = gpio_request(pdata->gpio_a1028_clk, "a1028");
+	if (rc < 0) {
+		control_a1028_clk = 0;
+		goto chk_gpio_micsel;
+	}
+	control_a1028_clk = 1;
+
+	rc = gpio_direction_output(pdata->gpio_a1028_clk, 1);
+	if (rc < 0) {
+		pr_err("%s: request clk gpio direction failed\n", __func__);
+		goto err_free_gpio_clk;
+	}
+
+chk_gpio_micsel:
+	rc = gpio_request(pdata->gpio_a1028_micsel, "a1028");
+	if (rc < 0) {
+		pr_info("%s: gpio request mic_sel pin failed\n", __func__);
+		control_a1028_micsel = 0;
+	} else {
+		rc = gpio_direction_output(pdata->gpio_a1028_micsel, 1);
+		if (rc < 0) {
+			pr_err("%s: request mic_sel gpio direction \
+				failed\n", __func__);
+			goto err_free_gpio_micsel;
+		}
+	}
+#endif
+
+	rc = gpio_request(pdata->gpio_a1028_wakeup, "a1028");
+	if (rc < 0) {
+		pr_err("%s: gpio request wakeup pin failed\n", __func__);
+		goto err_free_gpio;
+	}
+
+	rc = gpio_direction_output(pdata->gpio_a1028_wakeup, 1);
+	if (rc < 0) {
+		pr_err("%s: request wakeup gpio direction failed\n",\
+			__func__);
+		goto err_free_gpio;
+	}
+
+	rc = gpio_request(pdata->gpio_a1028_reset, "a1028");
+	if (rc < 0) {
+		pr_err("%s: gpio request reset pin failed\n", __func__);
+		goto err_free_gpio;
+	}
+
+	rc = gpio_direction_output(pdata->gpio_a1028_reset, 1);
+	if (rc < 0) {
+		pr_err("%s: request reset gpio direction failed\n",\
+			__func__);
+		goto err_free_gpio_all;
+	}
+
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		pr_err("%s: i2c check functionality error\n", __func__);
+		rc = -ENODEV;
+		goto err_free_gpio_all;
+	}
+
+	if (control_a1028_clk)
+		a1028_gpio_set_value(pdata->gpio_a1028_clk, 1);
+	if (control_a1028_micsel)
+		a1028_gpio_set_value(pdata->gpio_a1028_micsel, 0);
+	a1028_gpio_set_value(pdata->gpio_a1028_wakeup, 1);
+	a1028_gpio_set_value(pdata->gpio_a1028_reset, 1);
+
+	rc = misc_register(&a1028_device);
+	if (rc) {
+		pr_err("%s: a1028_device register failed\n", __func__);
+		goto err_free_gpio_all;
+	}
+	pr_info("%s ok", __func__);
+	return 0;
+
+err_free_gpio_all:
+	gpio_free(pdata->gpio_a1028_reset);
+err_free_gpio:
+	gpio_free(pdata->gpio_a1028_wakeup);
+#ifndef CONFIG_ARCH_MSM8960
+err_free_gpio_micsel:
+	gpio_free(pdata->gpio_a1028_micsel);
+err_free_gpio_clk:
+	gpio_free(pdata->gpio_a1028_clk);
+#endif
+err_alloc_data_failed:
+	return rc;
+}
+
+static int a1028_remove(struct i2c_client *client)
+{
+	struct a1028_platform_data *p1028data = i2c_get_clientdata(client);
+	kfree(p1028data);
+
+	return 0;
+}
+
+static int a1028_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+	return 0;
+}
+
+static int a1028_resume(struct i2c_client *client)
+{
+	return 0;
+}
+
+static const struct i2c_device_id a1028_id[] = {
+	{ "audience_a1028", 0 },
+	{ }
+};
+
+static struct i2c_driver a1028_driver = {
+	.probe = a1028_probe,
+	.remove = a1028_remove,
+	.suspend = a1028_suspend,
+	.resume	= a1028_resume,
+	.id_table = a1028_id,
+	.driver = {
+		.name = "audience_a1028",
+	},
+};
+
+static int __init a1028_init(void)
+{
+	pr_info("%s\n", __func__);
+	mutex_init(&a1028_lock);
+
+	return i2c_add_driver(&a1028_driver);
+}
+
+static void __exit a1028_exit(void)
+{
+	i2c_del_driver(&a1028_driver);
+}
+
+module_init(a1028_init);
+module_exit(a1028_exit);
+
+MODULE_DESCRIPTION("A1028 voice processor driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/misc/akm8975.c b/drivers/misc/akm8975.c
index 830d289..0cf0cb3 100644
--- a/drivers/misc/akm8975.c
+++ b/drivers/misc/akm8975.c
@@ -1,7 +1,6 @@
-/* drivers/misc/akm8975.c - akm8975 compass driver
+/* drivers/i2c/chips/akm8975.c - akm8975 compass driver
  *
- * Copyright (C) 2007-2008 HTC Corporation.
- * Author: Hou-Kun Chen <houkun.chen@gmail.com>
+ * Copyright (C) 2008-2009 HTC Corporation.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -11,13 +10,6 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- */
-
-/*
- * Revised by AKM 2009/04/02
- * Revised by Motorola 2010/05/27
- *
  */
 
 #include <linux/interrupt.h>
@@ -33,129 +25,340 @@
 #include <linux/freezer.h>
 #include <linux/akm8975.h>
 #include <linux/earlysuspend.h>
+#include <linux/export.h>
+#include <linux/module.h>
 
-#define AK8975DRV_CALL_DBG 0
-#if AK8975DRV_CALL_DBG
-#define FUNCDBG(msg)	pr_err("%s:%s\n", __func__, msg);
-#else
-#define FUNCDBG(msg)
-#endif
+#define DEBUG 0
+#define MAX_FAILURE_COUNT 3
+/*#define AKM_EARLY_SUSPEND 1*/
 
-#define AK8975DRV_DATA_DBG 0
-#define MAX_FAILURE_COUNT 10
+#define D(x...) printk(KERN_DEBUG "[COMP][AKM8975] " x)
+#define I(x...) printk(KERN_INFO "[COMP][AKM8975] " x)
+#define E(x...) printk(KERN_ERR "[COMP][AKM8975 ERROR] " x)
+#define DIF(x...) {\
+		if (debug_flag) \
+			printk(KERN_DEBUG "[COMP][AKM8975 DEBUG] " x); }
+#define DIF_FATAL_ERR(x...) {\
+		if (debug_flag_fatal_err) \
+			printk(KERN_DEBUG "[COMP][AKM8975 DEBUG FATAL ERR] "\
+			 x); }
+
+#define DEVICE_ACCESSORY_ATTR(_name, _mode, _show, _store) \
+struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
+
+static struct i2c_client *this_client;
 
 struct akm8975_data {
-	struct i2c_client *this_client;
-	struct akm8975_platform_data *pdata;
 	struct input_dev *input_dev;
 	struct work_struct work;
-	struct mutex flags_lock;
-#ifdef CONFIG_HAS_EARLYSUSPEND
-	struct early_suspend early_suspend;
-#endif
+	struct early_suspend early_suspend_akm;
+	struct class *htc_ecompass_class;
+	struct device *ecompass_dev;
 };
 
-/*
-* Because misc devices can not carry a pointer from driver register to
-* open, we keep this global. This limits the driver to a single instance.
-*/
-struct akm8975_data *akmd_data;
-
+/* Addresses to scan -- protected by sense_data_mutex */
+static char sense_data[RBUFF_SIZE_8975 + 1];
+static struct mutex sense_data_mutex;
+#define AKM8975_RETRY_COUNT 10
+static DECLARE_WAIT_QUEUE_HEAD(data_ready_wq);
 static DECLARE_WAIT_QUEUE_HEAD(open_wq);
 
+static atomic_t data_ready;
+static atomic_t open_count;
 static atomic_t open_flag;
+static atomic_t reserve_open_flag;
 
-static short m_flag;
-static short a_flag;
-static short t_flag;
-static short mv_flag;
+static atomic_t m_flag;
+static atomic_t a_flag;
+static atomic_t t_flag;
+static atomic_t mv_flag;
+
+static int failure_count;
 
 static short akmd_delay;
 
-static ssize_t akm8975_show(struct device *dev, struct device_attribute *attr,
-				 char *buf)
-{
-	struct i2c_client *client = to_i2c_client(dev);
-	return sprintf(buf, "%u\n", i2c_smbus_read_byte_data(client,
-							     AK8975_REG_CNTL));
-}
-static ssize_t akm8975_store(struct device *dev, struct device_attribute *attr,
-			    const char *buf, size_t count)
-{
-	struct i2c_client *client = to_i2c_client(dev);
-	unsigned long val;
-	strict_strtoul(buf, 10, &val);
-	if (val > 0xff)
-		return -EINVAL;
-	i2c_smbus_write_byte_data(client, AK8975_REG_CNTL, val);
-	return count;
-}
-static DEVICE_ATTR(akm_ms1, S_IWUSR | S_IRUGO, akm8975_show, akm8975_store);
+static int debug_flag;
+static int debug_flag_fatal_err;
+static int fatal_err_pr_count;
 
-static int akm8975_i2c_rxdata(struct akm8975_data *akm, char *buf, int length)
+static atomic_t suspend_flag = ATOMIC_INIT(0);
+static atomic_t PhoneOn_flag = ATOMIC_INIT(0);
+static struct akm8975_platform_data *pdata;
+
+static int disable_flag;
+static int reserve_a_flag;
+
+static int AKI2C_RxData(char *rxData, int length)
 {
+	uint8_t loop_i;
 	struct i2c_msg msgs[] = {
 		{
-			.addr = akm->this_client->addr,
-			.flags = 0,
-			.len = 1,
-			.buf = buf,
-		},
+		 .addr = this_client->addr,
+		 .flags = 0,
+		 .len = 1,
+		 .buf = rxData,
+		 },
 		{
-			.addr = akm->this_client->addr,
-			.flags = I2C_M_RD,
-			.len = length,
-			.buf = buf,
-		},
+		 .addr = this_client->addr,
+		 .flags = I2C_M_RD,
+		 .len = length,
+		 .buf = rxData,
+		 },
 	};
 
-	FUNCDBG("called");
+	/*D("%s:\n", __func__);*/
 
-	if (i2c_transfer(akm->this_client->adapter, msgs, 2) < 0) {
-		pr_err("akm8975_i2c_rxdata: transfer error\n");
-		return EIO;
-	} else
-		return 0;
-}
+	for (loop_i = 0; loop_i < AKM8975_RETRY_COUNT; loop_i++) {
+		if (i2c_transfer(this_client->adapter, msgs, 2) > 0)
+			break;
 
-static int akm8975_i2c_txdata(struct akm8975_data *akm, char *buf, int length)
-{
-	struct i2c_msg msgs[] = {
-		{
-			.addr = akm->this_client->addr,
-			.flags = 0,
-			.len = length,
-			.buf = buf,
-		},
-	};
+		mdelay(10);
+	}
 
-	FUNCDBG("called");
+	/*D("%s msgs[1]: addr = 0x%x, flags = 0x%x, "
+		"len = 0x%x,  buf(0, 1, 2, 3, 4, 5, 6, 7) = (0x%x, 0x%x"
+		", 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
+		__func__, msgs[1].addr, msgs[1].flags,
+		msgs[1].len, msgs[1].buf[0], msgs[1].buf[1],
+		msgs[1].buf[2], msgs[1].buf[3], msgs[1].buf[4], msgs[1].buf[5]
+		, msgs[1].buf[6], msgs[1].buf[7]);*/
 
-	if (i2c_transfer(akm->this_client->adapter, msgs, 1) < 0) {
-		pr_err("akm8975_i2c_txdata: transfer error\n");
+	if (loop_i >= AKM8975_RETRY_COUNT) {
+		E("%s retry over %d\n",
+			__func__, AKM8975_RETRY_COUNT);
 		return -EIO;
-	} else
-		return 0;
+	}
+	return 0;
 }
 
-static void akm8975_ecs_report_value(struct akm8975_data *akm, short *rbuf)
+static int AKI2C_TxData(char *txData, int length)
 {
-	struct akm8975_data *data = i2c_get_clientdata(akm->this_client);
+	uint8_t loop_i;
+	struct i2c_msg msg[] = {
+		{
+		 .addr = this_client->addr,
+		 .flags = 0,
+		 .len = length,
+		 .buf = txData,
+		 },
+	};
 
-	FUNCDBG("called");
+	for (loop_i = 0; loop_i < AKM8975_RETRY_COUNT; loop_i++) {
+		if (i2c_transfer(this_client->adapter, msg, 1) > 0)
+			break;
 
-#if AK8975DRV_DATA_DBG
-	pr_info("akm8975_ecs_report_value: yaw = %d, pitch = %d, roll = %d\n",
-				 rbuf[0], rbuf[1], rbuf[2]);
-	pr_info("tmp = %d, m_stat= %d, g_stat=%d\n", rbuf[3], rbuf[4], rbuf[5]);
-	pr_info("Acceleration:	 x = %d LSB, y = %d LSB, z = %d LSB\n",
-				 rbuf[6], rbuf[7], rbuf[8]);
-	pr_info("Magnetic:	 x = %d LSB, y = %d LSB, z = %d LSB\n\n",
-				 rbuf[9], rbuf[10], rbuf[11]);
+		mdelay(10);
+	}
+
+	/*D("%s msg: addr = 0x%x, flags = 0x%x, "
+		"len = 0x%x,  buf(0, 1, 2, 3, 4) = (0x%x, 0x%x"
+		", 0x%x, 0x%x, 0x%x)\n",
+		__func__, msg[0].addr, msg[0].flags,
+		msg[0].len, msg[0].buf[0], msg[0].buf[1],
+		msg[0].buf[2], msg[0].buf[3], msg[0].buf[4]);*/
+
+	if (loop_i >= AKM8975_RETRY_COUNT) {
+		E("%s retry over %d\n",
+			__func__, AKM8975_RETRY_COUNT);
+		return -EIO;
+	}
+	return 0;
+}
+
+static int AKECS_StartMeasure(void)
+{
+	char buffer[2];
+	atomic_set(&data_ready, 0);
+
+	/* Set measure mode */
+	buffer[0] = AK8975_REG_CNTL;
+	buffer[1] = AK8975_CNTL_SNG_MEASURE;
+
+	/* Set data */
+	return AKI2C_TxData(buffer, 2);
+}
+
+static int AKECS_PowerDown(void)
+{
+	char buffer[2];
+	int ret;
+
+	/*D("%s:\n", __func__);*/
+
+	/* Set powerdown mode */
+	buffer[0] = AK8975_REG_CNTL;
+	buffer[1] = AK8975_CNTL_POWER_DOWN;
+	/* Set data */
+	ret = AKI2C_TxData(buffer, 2);
+	if (ret < 0)
+		return ret;
+
+	/* Dummy read for clearing INT pin */
+	buffer[0] = AK8975_REG_ST1;
+	/* Read data */
+	ret = AKI2C_RxData(buffer, 1);
+	if (ret < 0)
+		return ret;
+	return ret;
+}
+
+static int AKECS_StartFuseRead(void)
+{
+	char buffer[2];
+
+	/*D("%s:\n", __func__);*/
+
+	/* Set measure mode */
+	buffer[0] = AK8975_REG_CNTL;
+	buffer[1] = AK8975_CNTL_FUSE_ACCESS;
+	/* Set data */
+	return AKI2C_TxData(buffer, 2);
+}
+
+static int AKECS_GetData(void)
+{
+	char buffer[RBUFF_SIZE_8975 + 1];
+	int ret;
+
+	memset(buffer, 0, RBUFF_SIZE_8975);
+	buffer[0] = AK8975_REG_ST1;
+	ret = AKI2C_RxData(buffer, RBUFF_SIZE_8975);
+	if (ret < 0)
+		return ret;
+
+	mutex_lock(&sense_data_mutex);
+	memcpy(sense_data, buffer, sizeof(buffer));
+	atomic_set(&data_ready, 1);
+	wake_up(&data_ready_wq);
+	mutex_unlock(&sense_data_mutex);
+
+	DIF("%s: GET_DATA, sense_data(0, 1, 2, 3, 4, 5, 6, 7) = "
+		"(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n",
+		__func__, sense_data[0], sense_data[1], sense_data[2]
+		, sense_data[3], sense_data[4], sense_data[5], sense_data[6]
+		, sense_data[7]);
+
+	DIF_FATAL_ERR("%s: GET_DATA, sense_data(0, 1, 2, 3, 4,"
+		" 5, 6, 7) = (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, "
+		"0x%x, 0x%x, 0x%x\n",
+		__func__, sense_data[0], sense_data[1],
+		sense_data[2], sense_data[3], sense_data[4],
+		sense_data[5], sense_data[6], sense_data[7]);
+
+	return 0;
+}
+
+static int AKECS_SetMode(char mode)
+{
+	int ret;
+
+	switch (mode) {
+	case AK8975_CNTL_SNG_MEASURE:
+		ret = AKECS_StartMeasure();
+		break;
+	case AK8975_CNTL_FUSE_ACCESS:
+		ret = AKECS_StartFuseRead();
+		break;
+	case AK8975_CNTL_POWER_DOWN:
+		ret = AKECS_PowerDown();
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	/* wait at least 300us after changing mode */
+	mdelay(1);
+	return ret;
+}
+
+static int AKECS_TransRBuff(char *rbuf, int size)
+{
+	int err = -1;
+	err = wait_event_interruptible_timeout(data_ready_wq,
+					 atomic_read(&data_ready), 1000);
+	if (err == -ERESTARTSYS) {
+		I("%s interrupted by a signal.\n", __func__);
+		return -1;
+	} else if (err == 0)
+		E("%s data timeout.\n", __func__);
+
+	if (!atomic_read(&data_ready)) {
+		if (!atomic_read(&suspend_flag)) {
+			D("%s: DATA\n", __func__);
+			failure_count++;
+			if (failure_count >= MAX_FAILURE_COUNT) {
+				E("%s: successive %d failure.\n",
+				       __func__, failure_count);
+				debug_flag_fatal_err = 1;
+				atomic_set(&open_flag, -1);
+				wake_up(&open_wq);
+				failure_count = 0;
+			}
+		}
+		return -1;
+	}
+
+	mutex_lock(&sense_data_mutex);
+	memcpy(&rbuf[0], &sense_data[0], size);
+	atomic_set(&data_ready, 0);
+	mutex_unlock(&sense_data_mutex);
+
+	failure_count = 0;
+	return 0;
+}
+
+
+static void AKECS_Report_Value(short *rbuf)
+{
+	struct akm8975_data *data = i2c_get_clientdata(this_client);
+#if DEBUG
+	D("AKECS_Report_Value: yaw = %d, pitch = %d, roll = %d"
+		"\n", rbuf[0], rbuf[1], rbuf[2]);
+	D("                    tmp = %d, m_stat= %d, g_stat=%d"
+		"\n", rbuf[3], rbuf[4], rbuf[5]);
+	D("          G_Sensor:   x = %d LSB, y = %d LSB, z = "
+		"%d LSB\n", rbuf[6], rbuf[7], rbuf[8]);
+	D("          Compass:   x = %d LSB, y = %d LSB, z = %d"
+		" LSB\n", rbuf[9], rbuf[10], rbuf[11]);
 #endif
-	mutex_lock(&akm->flags_lock);
+	DIF(
+		"AKECS_Report_Value: yaw = %d, pitch = %d, roll = %d"
+		"\n", rbuf[0], rbuf[1], rbuf[2]);
+	DIF(
+	"          G_Sensor:   x = %d LSB, y = %d LSB, z = "
+		"%d LSB\n", rbuf[6], rbuf[7], rbuf[8]);
+	DIF(
+	"          Compass:   x = %d LSB, y = %d LSB, z = %d"
+		" LSB\n", rbuf[9], rbuf[10], rbuf[11]);
+
+	DIF("(m, a, t, mv) = (0x%x, 0x%x, 0x%x, 0x%x)\n",
+		atomic_read(&m_flag), atomic_read(&a_flag),
+		atomic_read(&t_flag), atomic_read(&mv_flag));
+
+	if (fatal_err_pr_count < 10) {
+		DIF_FATAL_ERR(
+			"AKECS_Report_Value: yaw = %d, pitch = %d,"
+			" roll = %d\n", rbuf[0], rbuf[1], rbuf[2]);
+		DIF_FATAL_ERR(
+		"          G_Sensor:   x = %d LSB, y = %d LSB, z = "
+			"%d LSB\n", rbuf[6], rbuf[7], rbuf[8]);
+		DIF_FATAL_ERR(
+		"          Compass:   x = %d LSB, y = %d LSB, z = %d"
+			" LSB\n", rbuf[9], rbuf[10], rbuf[11]);
+
+		DIF_FATAL_ERR("(m, a, t, mv) = (0x%x, 0x%x, 0x%x,"
+			" 0x%x)\n",
+			atomic_read(&m_flag), atomic_read(&a_flag),
+			atomic_read(&t_flag), atomic_read(&mv_flag));
+
+		fatal_err_pr_count++;
+	} else {
+		fatal_err_pr_count = 0;
+		debug_flag_fatal_err = 0;
+	}
+
 	/* Report magnetic sensor information */
-	if (m_flag) {
+	if (atomic_read(&m_flag)) {
 		input_report_abs(data->input_dev, ABS_RX, rbuf[0]);
 		input_report_abs(data->input_dev, ABS_RY, rbuf[1]);
 		input_report_abs(data->input_dev, ABS_RZ, rbuf[2]);
@@ -163,7 +366,7 @@
 	}
 
 	/* Report acceleration sensor information */
-	if (a_flag) {
+	if (atomic_read(&a_flag)) {
 		input_report_abs(data->input_dev, ABS_X, rbuf[6]);
 		input_report_abs(data->input_dev, ABS_Y, rbuf[7]);
 		input_report_abs(data->input_dev, ABS_Z, rbuf[8]);
@@ -171,69 +374,96 @@
 	}
 
 	/* Report temperature information */
-	if (t_flag)
+	if (atomic_read(&t_flag))
 		input_report_abs(data->input_dev, ABS_THROTTLE, rbuf[3]);
 
-	if (mv_flag) {
+	if (atomic_read(&mv_flag)) {
 		input_report_abs(data->input_dev, ABS_HAT0X, rbuf[9]);
 		input_report_abs(data->input_dev, ABS_HAT0Y, rbuf[10]);
 		input_report_abs(data->input_dev, ABS_BRAKE, rbuf[11]);
 	}
-	mutex_unlock(&akm->flags_lock);
 
 	input_sync(data->input_dev);
 }
 
-static void akm8975_ecs_close_done(struct akm8975_data *akm)
+static int AKECS_GetOpenStatus(void)
 {
-	FUNCDBG("called");
-	mutex_lock(&akm->flags_lock);
-	m_flag = 1;
-	a_flag = 1;
-	t_flag = 1;
-	mv_flag = 1;
-	mutex_unlock(&akm->flags_lock);
+	D("%s:\n", __func__);
+	wait_event_interruptible(open_wq, (atomic_read(&open_flag) != 0));
+	/*D("%s: After wait_event_interruptible\n", __func__);*/
+	return atomic_read(&open_flag);
+}
+
+static int AKECS_GetCloseStatus(void)
+{
+	D("%s:\n", __func__);
+	wait_event_interruptible(open_wq, (atomic_read(&open_flag) <= 0));
+	return atomic_read(&open_flag);
+}
+
+static void AKECS_CloseDone(void)
+{
+	I("%s:\n", __func__);
+	atomic_set(&m_flag, 0);
+	atomic_set(&a_flag, 0);
+	atomic_set(&t_flag, 0);
+	atomic_set(&mv_flag, 0);
 }
 
 static int akm_aot_open(struct inode *inode, struct file *file)
 {
 	int ret = -1;
+	struct akm8975_data *data = i2c_get_clientdata(this_client);
 
-	FUNCDBG("called");
-	if (atomic_cmpxchg(&open_flag, 0, 1) == 0) {
+	printk(KERN_INFO "[COMP] Compass enable\n");
+
+	DIF("%s: open_count = %d, open_flag = %d\n", __func__,
+		atomic_read(&open_count), atomic_read(&open_flag));
+
+	DIF_FATAL_ERR("%s: open_count = %d, open_flag = %d\n", __func__,
+		atomic_read(&open_count), atomic_read(&open_flag));
+
+	if (atomic_cmpxchg(&open_count, 0, 1) == 0) {
+		atomic_set(&open_flag, 1);
+		input_report_abs(data->input_dev, ABS_RUDDER, -1);
+		atomic_set(&reserve_open_flag, 1);
 		wake_up(&open_wq);
 		ret = 0;
 	}
-
-	ret = nonseekable_open(inode, file);
-	if (ret)
-		return ret;
-
-	file->private_data = akmd_data;
-
 	return ret;
 }
 
 static int akm_aot_release(struct inode *inode, struct file *file)
 {
-	FUNCDBG("called");
+	printk(KERN_INFO "[COMP] Compass disable\n");
+
+	debug_flag_fatal_err = 0;
+	fatal_err_pr_count = 0;
+
+	atomic_set(&reserve_open_flag, 0);
 	atomic_set(&open_flag, 0);
+	atomic_set(&open_count, 0);
 	wake_up(&open_wq);
 	return 0;
 }
 
-static int akm_aot_ioctl(struct inode *inode, struct file *file,
+static long
+akm_aot_ioctl(/*struct inode *inode,*/ struct file *file,
 	      unsigned int cmd, unsigned long arg)
 {
-	void __user *argp = (void __user *) arg;
-	short flag;
-	struct akm8975_data *akm = file->private_data;
+	void __user *argp = (void __user *)arg;
+	short flag = 0;
+	int ret = -1;
 
-	FUNCDBG("called");
+	ret = copy_from_user(&flag, argp, sizeof(flag));
+	if (ret)
+		return -EFAULT;
+	DIF("%s: cmd = 0x%x, flag = %d\n", __func__, cmd, flag);
 
 	switch (cmd) {
 	case ECS_IOCTL_APP_SET_MFLAG:
 	case ECS_IOCTL_APP_SET_AFLAG:
+	case ECS_IOCTL_APP_SET_TFLAG:
 	case ECS_IOCTL_APP_SET_MVFLAG:
 		if (copy_from_user(&flag, argp, sizeof(flag)))
 			return -EFAULT;
@@ -248,25 +478,34 @@
 		break;
 	}
 
-	mutex_lock(&akm->flags_lock);
 	switch (cmd) {
 	case ECS_IOCTL_APP_SET_MFLAG:
-	  m_flag = flag;
+		atomic_set(&m_flag, flag);
 		break;
 	case ECS_IOCTL_APP_GET_MFLAG:
-		flag = m_flag;
+		flag = atomic_read(&m_flag);
 		break;
 	case ECS_IOCTL_APP_SET_AFLAG:
-		a_flag = flag;
+		reserve_a_flag = flag;
+		if (disable_flag != 1)
+			atomic_set(&a_flag, flag);
+		else
+			atomic_set(&a_flag, 0);
 		break;
 	case ECS_IOCTL_APP_GET_AFLAG:
-		flag = a_flag;
+		flag = atomic_read(&a_flag);
+		break;
+	case ECS_IOCTL_APP_SET_TFLAG:
+		atomic_set(&t_flag, flag);
+		break;
+	case ECS_IOCTL_APP_GET_TFLAG:
+		flag = atomic_read(&t_flag);
 		break;
 	case ECS_IOCTL_APP_SET_MVFLAG:
-		mv_flag = flag;
+		atomic_set(&mv_flag, flag);
 		break;
 	case ECS_IOCTL_APP_GET_MVFLAG:
-		flag = mv_flag;
+		flag = atomic_read(&mv_flag);
 		break;
 	case ECS_IOCTL_APP_SET_DELAY:
 		akmd_delay = flag;
@@ -277,11 +516,11 @@
 	default:
 		return -ENOTTY;
 	}
-	mutex_unlock(&akm->flags_lock);
 
 	switch (cmd) {
 	case ECS_IOCTL_APP_GET_MFLAG:
 	case ECS_IOCTL_APP_GET_AFLAG:
+	case ECS_IOCTL_APP_GET_TFLAG:
 	case ECS_IOCTL_APP_GET_MVFLAG:
 	case ECS_IOCTL_APP_GET_DELAY:
 		if (copy_to_user(argp, &flag, sizeof(flag)))
@@ -296,95 +535,120 @@
 
 static int akmd_open(struct inode *inode, struct file *file)
 {
-	int err = 0;
-
-	FUNCDBG("called");
-	err = nonseekable_open(inode, file);
-	if (err)
-		return err;
-
-	file->private_data = akmd_data;
-	return 0;
+	I("%s:\n", __func__);
+	return nonseekable_open(inode, file);
 }
 
 static int akmd_release(struct inode *inode, struct file *file)
 {
-	struct akm8975_data *akm = file->private_data;
-
-	FUNCDBG("called");
-	akm8975_ecs_close_done(akm);
+	I("%s:\n", __func__);
+	AKECS_CloseDone();
 	return 0;
 }
 
-static int akmd_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-		      unsigned long arg)
+static long
+akmd_ioctl(/*struct inode *inode,*/ struct file *file, unsigned int cmd,
+	   unsigned long arg)
 {
-	void __user *argp = (void __user *) arg;
 
-	char rwbuf[16];
-	int ret = -1;
-	int status;
-	short value[12];
-	short delay;
-	struct akm8975_data *akm = file->private_data;
+	void __user *argp = (void __user *)arg;
 
-	FUNCDBG("called");
+	char msg[RBUFF_SIZE_8975 + 1] = "", rwbuf[RBUFF_SIZE_8975 + 1] = "";
+	int ret = -1, status;
+	short mode = 0, value[12], delay;
+	short layouts[4][3][3];
+	int i, j, k;
+
+	DIF("%s: cmd = 0x%x\n", __func__, cmd);
+	/*D("%s: cmd = 0x%x\n", __func__, cmd);*/
+	/*D("%s: ECS_IOCTL_GETDATA = 0x%x\n",
+		__func__, ECS_IOCTL_GETDATA);*/
 
 	switch (cmd) {
-	case ECS_IOCTL_READ:
 	case ECS_IOCTL_WRITE:
+	case ECS_IOCTL_READ:
 		if (copy_from_user(&rwbuf, argp, sizeof(rwbuf)))
 			return -EFAULT;
 		break;
-
+	case ECS_IOCTL_SET_MODE:
+		/*D("%s: ECS_IOCTL_SET_MODE\n",
+			__func__);*/
+		if (copy_from_user(&mode, argp, sizeof(mode)))
+			return -EFAULT;
+		/*D("%s: ECS_IOCTL_SET_MODE success!\n",
+			__func__);*/
+		break;
 	case ECS_IOCTL_SET_YPR:
 		if (copy_from_user(&value, argp, sizeof(value)))
 			return -EFAULT;
 		break;
-
 	default:
 		break;
 	}
 
 	switch (cmd) {
-	case ECS_IOCTL_READ:
-		if (rwbuf[0] < 1)
-			return -EINVAL;
-
-		ret = akm8975_i2c_rxdata(akm, &rwbuf[1], rwbuf[0]);
-		if (ret < 0)
-			return ret;
-		break;
-
 	case ECS_IOCTL_WRITE:
 		if (rwbuf[0] < 2)
 			return -EINVAL;
-
-		ret = akm8975_i2c_txdata(akm, &rwbuf[1], rwbuf[0]);
+		ret = AKI2C_TxData(&rwbuf[1], rwbuf[0]);
 		if (ret < 0)
 			return ret;
 		break;
-	case ECS_IOCTL_SET_YPR:
-		akm8975_ecs_report_value(akm, value);
+	case ECS_IOCTL_READ:
+		if (rwbuf[0] < 1)
+			return -EINVAL;
+		ret = AKI2C_RxData(&rwbuf[1], rwbuf[0]);
+		if (ret < 0)
+			return ret;
 		break;
-
+	case ECS_IOCTL_SET_MODE:
+		/*D("%s: ECS_IOCTL_SET_MODE2\n",
+			__func__);*/
+		ret = AKECS_SetMode((char)mode);
+		if (ret < 0)
+			return ret;
+		/*D("%s: ECS_IOCTL_SET_MODE2 success\n",
+			__func__);*/
+		break;
+	case ECS_IOCTL_GETDATA:
+		/*D("%s: ECS_IOCTL_GETDATA\n", __func__);*/
+		DIF_FATAL_ERR("%s: calling AKECS_TransRBuff\n", __func__);
+		ret = AKECS_TransRBuff(msg, RBUFF_SIZE_8975);
+		if (ret < 0)
+			return ret;
+		/*D("%s: ECS_IOCTL_GETDATA: success\n",
+			__func__);*/
+		break;
+	case ECS_IOCTL_SET_YPR:
+		AKECS_Report_Value(value);
+		break;
+	case ECS_IOCTL_GET_COMP_FLAG:
+		status = atomic_read(&m_flag);
+		status |= atomic_read(&mv_flag);
+		DIF("%s: ECS_IOCTL_GET_COMP_FLAG, status = %d\n",
+			__func__, status);
+		break;
 	case ECS_IOCTL_GET_OPEN_STATUS:
-		wait_event_interruptible(open_wq,
-					 (atomic_read(&open_flag) != 0));
-		status = atomic_read(&open_flag);
+		status = AKECS_GetOpenStatus();
 		break;
 	case ECS_IOCTL_GET_CLOSE_STATUS:
-		wait_event_interruptible(open_wq,
-					 (atomic_read(&open_flag) == 0));
-		status = atomic_read(&open_flag);
+		status = AKECS_GetCloseStatus();
 		break;
-
 	case ECS_IOCTL_GET_DELAY:
 		delay = akmd_delay;
 		break;
-
+	case ECS_IOCTL_GET_MATRIX:
+		for (i = 0; i < 4; i++)
+			for (j = 0; j < 3; j++)
+				for (k = 0; k < 3; k++) {
+					/*D("%s: "
+						"pdata->layouts[%d][%d][%d]"
+						" = %d\n",
+				__func__, i, j, k, pdata->layouts[i][j][k]);*/
+				layouts[i][j][k] = pdata->layouts[i][j][k];
+				}
+		break;
 	default:
-		FUNCDBG("Unknown cmd\n");
 		return -ENOTTY;
 	}
 
@@ -393,6 +657,16 @@
 		if (copy_to_user(argp, &rwbuf, sizeof(rwbuf)))
 			return -EFAULT;
 		break;
+	case ECS_IOCTL_GETDATA:
+		msg[8] = debug_flag;/*
+		DIF("msg(0, 1, 2, 3, 4, 5, 6, 7, 8) = (0x%x, 0x%x, 0x%x, 0x%x,"
+		  " 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
+			msg[0], msg[1],	msg[2], msg[3], msg[4], msg[5], msg[6],
+			msg[7],	msg[8]);*/
+		if (copy_to_user(argp, &msg, sizeof(msg)))
+			return -EFAULT;
+		break;
+	case ECS_IOCTL_GET_COMP_FLAG:
 	case ECS_IOCTL_GET_OPEN_STATUS:
 	case ECS_IOCTL_GET_CLOSE_STATUS:
 		if (copy_to_user(argp, &status, sizeof(status)))
@@ -402,331 +676,479 @@
 		if (copy_to_user(argp, &delay, sizeof(delay)))
 			return -EFAULT;
 		break;
+	case ECS_IOCTL_GET_MATRIX:
+		if (copy_to_user(argp, layouts, sizeof(layouts)))
+			return -EFAULT;
+		break;
 	default:
 		break;
 	}
-
 	return 0;
 }
 
-/* needed to clear the int. pin */
 static void akm_work_func(struct work_struct *work)
 {
-	struct akm8975_data *akm =
-	    container_of(work, struct akm8975_data, work);
-
-	FUNCDBG("called");
-	enable_irq(akm->this_client->irq);
+	if (AKECS_GetData() < 0)
+		E("%s: Get data failed\n", __func__);
+	enable_irq(this_client->irq);
 }
 
 static irqreturn_t akm8975_interrupt(int irq, void *dev_id)
 {
-	struct akm8975_data *akm = dev_id;
-	FUNCDBG("called");
+	struct akm8975_data *data = dev_id;
 
-	disable_irq_nosync(akm->this_client->irq);
-	schedule_work(&akm->work);
+	DIF_FATAL_ERR("%s\n", __func__);
+
+	disable_irq_nosync(this_client->irq);
+	schedule_work(&data->work);
 	return IRQ_HANDLED;
 }
 
-static int akm8975_power_off(struct akm8975_data *akm)
-{
-#if AK8975DRV_CALL_DBG
-	pr_info("%s\n", __func__);
-#endif
-	if (akm->pdata->power_off)
-		akm->pdata->power_off();
-
-	return 0;
-}
-
-static int akm8975_power_on(struct akm8975_data *akm)
-{
-	int err;
-
-#if AK8975DRV_CALL_DBG
-	pr_info("%s\n", __func__);
-#endif
-	if (akm->pdata->power_on) {
-		err = akm->pdata->power_on();
-		if (err < 0)
-			return err;
-	}
-	return 0;
-}
-
-static int akm8975_suspend(struct i2c_client *client, pm_message_t mesg)
-{
-	struct akm8975_data *akm = i2c_get_clientdata(client);
-
-#if AK8975DRV_CALL_DBG
-	pr_info("%s\n", __func__);
-#endif
-	/* TO DO: might need more work after power mgmt
-	   is enabled */
-	return akm8975_power_off(akm);
-}
-
-static int akm8975_resume(struct i2c_client *client)
-{
-	struct akm8975_data *akm = i2c_get_clientdata(client);
-
-#if AK8975DRV_CALL_DBG
-	pr_info("%s\n", __func__);
-#endif
-	/* TO DO: might need more work after power mgmt
-	   is enabled */
-	return akm8975_power_on(akm);
-}
-
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#ifdef AKM_EARLY_SUSPEND
 static void akm8975_early_suspend(struct early_suspend *handler)
 {
-	struct akm8975_data *akm;
-	akm = container_of(handler, struct akm8975_data, early_suspend);
+	DIF("%s", __func__);
 
-#if AK8975DRV_CALL_DBG
-	pr_info("%s\n", __func__);
-#endif
-	akm8975_suspend(akm->this_client, PMSG_SUSPEND);
+	if (!atomic_read(&PhoneOn_flag)) {
+		atomic_set(&suspend_flag, 1);
+		atomic_set(&reserve_open_flag, atomic_read(&open_flag));
+		atomic_set(&open_flag, 0);
+		wake_up(&open_wq);
+		disable_irq(this_client->irq);
+	} else
+		D("AKM8975 akm8975_early_suspend: PhoneOn_flag is set\n");
 }
 
 static void akm8975_early_resume(struct early_suspend *handler)
 {
-	struct akm8975_data *akm;
-	akm = container_of(handler, struct akm8975_data, early_suspend);
+	DIF("%s", __func__);
 
-#if AK8975DRV_CALL_DBG
-	pr_info("%s\n", __func__);
-#endif
-	akm8975_resume(akm->this_client);
+	if (atomic_read(&suspend_flag)) {
+		enable_irq(this_client->irq);
+		atomic_set(&suspend_flag, 0);
+		atomic_set(&open_flag, atomic_read(&reserve_open_flag));
+		wake_up(&open_wq);
+	} else
+		D("AKM8975 akm8975_early_resume: PhoneOn_flag is set\n");
 }
-#endif
 
+#else /* AKM_EARLY_SUSPEND */
 
-static int akm8975_init_client(struct i2c_client *client)
+static int akm8975_suspend(struct i2c_client *client, pm_message_t mesg)
 {
-	struct akm8975_data *data;
-	int ret;
+	DIF("%s", __func__);
 
-	data = i2c_get_clientdata(client);
+	DIF_FATAL_ERR("%s", __func__);
 
-	ret = request_irq(client->irq, akm8975_interrupt, IRQF_TRIGGER_RISING,
-				"akm8975", data);
-
-	if (ret < 0) {
-		pr_err("akm8975_init_client: request irq failed\n");
-		goto err;
-	}
-
-	init_waitqueue_head(&open_wq);
-
-	mutex_lock(&data->flags_lock);
-	m_flag = 1;
-	a_flag = 1;
-	t_flag = 1;
-	mv_flag = 1;
-	mutex_unlock(&data->flags_lock);
+	atomic_set(&suspend_flag, 1);
+	atomic_set(&reserve_open_flag, atomic_read(&open_flag));
+	atomic_set(&open_flag, 0);
+	wake_up(&open_wq);
+	disable_irq(this_client->irq);
 
 	return 0;
-err:
-  return ret;
 }
 
+static int akm8975_resume(struct i2c_client *client)
+{
+	enable_irq(this_client->irq);
+	atomic_set(&suspend_flag, 0);
+	atomic_set(&open_flag, atomic_read(&reserve_open_flag));
+	wake_up(&open_wq);
+
+	D("%s: (m, a, t, mv) = (0x%x, 0x%x, 0x%x, 0x%x)\n",
+		__func__, atomic_read(&m_flag), atomic_read(&a_flag),
+		atomic_read(&t_flag), atomic_read(&mv_flag));
+
+	return 0;
+}
+#endif /* AKM_EARLY_SUSPEND */
+
 static const struct file_operations akmd_fops = {
 	.owner = THIS_MODULE,
 	.open = akmd_open,
 	.release = akmd_release,
-	.ioctl = akmd_ioctl,
+	/*(.ioctl = akmd_ioctl,*/
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = akmd_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = akmd_ioctl,
+#endif
 };
 
 static const struct file_operations akm_aot_fops = {
 	.owner = THIS_MODULE,
 	.open = akm_aot_open,
 	.release = akm_aot_release,
-	.ioctl = akm_aot_ioctl,
+	/*.ioctl = akm_aot_ioctl,*/
+#if HAVE_COMPAT_IOCTL
+	.compat_ioctl = akm_aot_ioctl,
+#endif
+#if HAVE_UNLOCKED_IOCTL
+	.unlocked_ioctl = akm_aot_ioctl,
+#endif
+
 };
 
+
 static struct miscdevice akm_aot_device = {
 	.minor = MISC_DYNAMIC_MINOR,
 	.name = "akm8975_aot",
 	.fops = &akm_aot_fops,
 };
 
+
 static struct miscdevice akmd_device = {
 	.minor = MISC_DYNAMIC_MINOR,
-	.name = "akm8975_dev",
+	.name = "akm8975_daemon",
 	.fops = &akmd_fops,
 };
 
-int akm8975_probe(struct i2c_client *client,
-		  const struct i2c_device_id *devid)
+static ssize_t akm_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
 {
-	struct akm8975_data *akm;
-	int err;
-	FUNCDBG("called");
+	char *s = buf;
+	s += sprintf(s, "%d\n", atomic_read(&PhoneOn_flag));
+	return s - buf;
+}
 
-	if (client->dev.platform_data == NULL) {
-		dev_err(&client->dev, "platform data is NULL. exiting.\n");
-		err = -ENODEV;
-		goto exit_platform_data_null;
+static ssize_t akm_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	if (count == (strlen("enable") + 1) &&
+	   strncmp(buf, "enable", strlen("enable")) == 0) {
+		atomic_set(&PhoneOn_flag, 1);
+		D("AKM8975 akm_store: PhoneOn_flag=%d\n",
+			atomic_read(&PhoneOn_flag));
+		return count;
+	}
+	if (count == (strlen("disable") + 1) &&
+	   strncmp(buf, "disable", strlen("disable")) == 0) {
+		atomic_set(&PhoneOn_flag, 0);
+		D("AKM8975 akm_store: PhoneOn_flag=%d\n",
+			atomic_read(&PhoneOn_flag));
+		return count;
+	}
+	E("akm_store: invalid argument\n");
+	return -EINVAL;
+}
+
+static DEVICE_ACCESSORY_ATTR(PhoneOnOffFlag, 0664, \
+	akm_show, akm_store);
+
+static ssize_t debug_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+	short lm_flag = -1;
+	short la_flag = -1;
+	short lt_flag = -1;
+	short lmv_flag = -1;
+	short ldelay_flag = -1;
+
+	lm_flag = atomic_read(&m_flag);
+	la_flag = atomic_read(&a_flag);
+	lt_flag = atomic_read(&t_flag);
+	lmv_flag = atomic_read(&mv_flag);
+	ldelay_flag = akmd_delay;
+
+	s += sprintf(s, "(m, a, t, mv, delay, debug_flag, "
+		"debug_flag_fatal_err) = (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x,"
+		" 0x%x)\n", lm_flag, la_flag, lt_flag, lmv_flag, ldelay_flag,
+		debug_flag, debug_flag_fatal_err);
+
+	return s - buf;
+}
+
+static ssize_t debug_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	debug_flag = -1;
+	sscanf(buf, "%d", &debug_flag);
+
+	D("%s: debug_flag = %d\n", __func__, debug_flag);
+
+	return count;
+}
+
+static DEVICE_ACCESSORY_ATTR(debug_en, 0664, \
+	debug_show, debug_store);
+
+static ssize_t disable_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
+{
+	char *s = buf;
+
+	s += sprintf(s, "disable_flag = 0x%x\n", disable_flag);
+
+	return s - buf;
+}
+
+static ssize_t disable_store(struct device *dev,
+				   struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	disable_flag = -1;
+	sscanf(buf, "%d", &disable_flag);
+
+	D("%s: disable_flag = %d\n", __func__, disable_flag);
+
+	if (disable_flag == 1)
+		atomic_set(&a_flag, 0);
+	else
+		atomic_set(&a_flag, reserve_a_flag);
+
+	return count;
+}
+
+static DEVICE_ACCESSORY_ATTR(disable_en, 0664, \
+	disable_show, disable_store);
+
+
+int akm8975_registerAttr(struct akm8975_data *akm)
+{
+	int ret;
+
+	akm->htc_ecompass_class = class_create(THIS_MODULE, "htc_ecompass");
+	if (IS_ERR(akm->htc_ecompass_class)) {
+		ret = PTR_ERR(akm->htc_ecompass_class);
+		akm->htc_ecompass_class = NULL;
+		goto err_create_class;
 	}
 
+	akm->ecompass_dev = device_create(akm->htc_ecompass_class,
+				NULL, 0, "%s", "ecompass");
+	if (unlikely(IS_ERR(akm->ecompass_dev))) {
+		ret = PTR_ERR(akm->ecompass_dev);
+		akm->ecompass_dev = NULL;
+		goto err_create_ecompass_device;
+	}
+
+	/* register the attributes */
+	ret = device_create_file(akm->ecompass_dev, &dev_attr_PhoneOnOffFlag);
+	if (ret)
+		goto err_create_ecompass_device_file;
+
+	/* register the attributes */
+	ret = device_create_file(akm->ecompass_dev, &dev_attr_debug_en);
+	if (ret)
+		goto err_create_ecompass_debug_device_file;
+
+	/* register the attributes */
+	ret = device_create_file(akm->ecompass_dev, &dev_attr_disable_en);
+	if (ret)
+		goto err_create_ecompass_disable_device_file;
+
+	return 0;
+
+err_create_ecompass_disable_device_file:
+err_create_ecompass_debug_device_file:
+err_create_ecompass_device_file:
+	device_unregister(akm->ecompass_dev);
+err_create_ecompass_device:
+	class_destroy(akm->htc_ecompass_class);
+err_create_class:
+
+	return ret;
+}
+
+
+int akm8975_probe(struct i2c_client *client, const struct i2c_device_id *id)
+{
+	struct akm8975_data *akm;
+	int err = 0;
+	char msg[RBUFF_SIZE_8975 + 1];
+	unsigned int irq_type;
+
+	/*int i = 0;*/
+
+	memset(msg, 0, RBUFF_SIZE_8975 + 1);
+
+	I("%s:\n", __func__);
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		dev_err(&client->dev, "platform data is NULL. exiting.\n");
 		err = -ENODEV;
 		goto exit_check_functionality_failed;
 	}
 
 	akm = kzalloc(sizeof(struct akm8975_data), GFP_KERNEL);
 	if (!akm) {
-		dev_err(&client->dev,
-			"failed to allocate memory for module data\n");
 		err = -ENOMEM;
 		goto exit_alloc_data_failed;
 	}
 
-	akm->pdata = client->dev.platform_data;
-
-	mutex_init(&akm->flags_lock);
 	INIT_WORK(&akm->work, akm_work_func);
 	i2c_set_clientdata(client, akm);
 
-	err = akm8975_power_on(akm);
-	if (err < 0)
-		goto exit_power_on_failed;
+	mutex_init(&sense_data_mutex);
 
-	akm8975_init_client(client);
-	akm->this_client = client;
-	akmd_data = akm;
+	pdata = client->dev.platform_data;
+	if (pdata == NULL) {
+		E("%s: platform data is NULL\n", __func__);
+		goto exit_platform_data_null;
+	}
+	this_client = client;
+
+	err = AKECS_PowerDown();
+	if (err < 0) {
+		E("%s: set power down mode error\n", __func__);
+		goto exit_set_mode_failed;
+	}
 
 	akm->input_dev = input_allocate_device();
+
 	if (!akm->input_dev) {
 		err = -ENOMEM;
-		dev_err(&akm->this_client->dev,
-			"input device allocate failed\n");
+		E("%s: Failed to allocate input device\n", __func__);
 		goto exit_input_dev_alloc_failed;
 	}
 
 	set_bit(EV_ABS, akm->input_dev->evbit);
-
 	/* yaw */
-	input_set_abs_params(akm->input_dev, ABS_RX, 0, 23040, 0, 0);
+	input_set_abs_params(akm->input_dev, ABS_RX, 0, 360, 0, 0);
 	/* pitch */
-	input_set_abs_params(akm->input_dev, ABS_RY, -11520, 11520, 0, 0);
+	input_set_abs_params(akm->input_dev, ABS_RY, -180, 180, 0, 0);
 	/* roll */
-	input_set_abs_params(akm->input_dev, ABS_RZ, -5760, 5760, 0, 0);
+	input_set_abs_params(akm->input_dev, ABS_RZ, -90, 90, 0, 0);
 	/* x-axis acceleration */
-	input_set_abs_params(akm->input_dev, ABS_X, -5760, 5760, 0, 0);
+	input_set_abs_params(akm->input_dev, ABS_X, -1872, 1872, 0, 0);
 	/* y-axis acceleration */
-	input_set_abs_params(akm->input_dev, ABS_Y, -5760, 5760, 0, 0);
+	input_set_abs_params(akm->input_dev, ABS_Y, -1872, 1872, 0, 0);
 	/* z-axis acceleration */
-	input_set_abs_params(akm->input_dev, ABS_Z, -5760, 5760, 0, 0);
+	input_set_abs_params(akm->input_dev, ABS_Z, -1872, 1872, 0, 0);
 	/* temparature */
 	input_set_abs_params(akm->input_dev, ABS_THROTTLE, -30, 85, 0, 0);
 	/* status of magnetic sensor */
-	input_set_abs_params(akm->input_dev, ABS_RUDDER, 0, 3, 0, 0);
+	input_set_abs_params(akm->input_dev, ABS_RUDDER, -32768, 3, 0, 0);
 	/* status of acceleration sensor */
-	input_set_abs_params(akm->input_dev, ABS_WHEEL, 0, 3, 0, 0);
+	input_set_abs_params(akm->input_dev, ABS_WHEEL, -32768, 3, 0, 0);
+	/* step count */
+	input_set_abs_params(akm->input_dev, ABS_GAS, 0, 65535, 0, 0);
 	/* x-axis of raw magnetic vector */
-	input_set_abs_params(akm->input_dev, ABS_HAT0X, -20480, 20479, 0, 0);
+	input_set_abs_params(akm->input_dev, ABS_HAT0X, -2048, 2032, 0, 0);
 	/* y-axis of raw magnetic vector */
-	input_set_abs_params(akm->input_dev, ABS_HAT0Y, -20480, 20479, 0, 0);
+	input_set_abs_params(akm->input_dev, ABS_HAT0Y, -2048, 2032, 0, 0);
 	/* z-axis of raw magnetic vector */
-	input_set_abs_params(akm->input_dev, ABS_BRAKE, -20480, 20479, 0, 0);
+	input_set_abs_params(akm->input_dev, ABS_BRAKE, -2048, 2032, 0, 0);
 
 	akm->input_dev->name = "compass";
 
 	err = input_register_device(akm->input_dev);
+
 	if (err) {
-		pr_err("akm8975_probe: Unable to register input device: %s\n",
-					 akm->input_dev->name);
+		E("%s: Unable to register input device: %s\n", __func__,
+			akm->input_dev->name);
 		goto exit_input_register_device_failed;
 	}
 
 	err = misc_register(&akmd_device);
 	if (err) {
-		pr_err("akm8975_probe: akmd_device register failed\n");
+		E("%s: akmd_device register failed\n", __func__);
 		goto exit_misc_device_register_failed;
 	}
 
 	err = misc_register(&akm_aot_device);
 	if (err) {
-		pr_err("akm8975_probe: akm_aot_device register failed\n");
+		E("%s: akm_aot_device register failed\n", __func__);
 		goto exit_misc_device_register_failed;
 	}
 
-	err = device_create_file(&client->dev, &dev_attr_akm_ms1);
+	init_waitqueue_head(&data_ready_wq);
+	init_waitqueue_head(&open_wq);
 
-#ifdef CONFIG_HAS_EARLYSUSPEND
-	akm->early_suspend.suspend = akm8975_early_suspend;
-	akm->early_suspend.resume = akm8975_early_resume;
-	register_early_suspend(&akm->early_suspend);
+	/* As default, report all information */
+	atomic_set(&m_flag, 0);
+	atomic_set(&a_flag, 0);
+	atomic_set(&t_flag, 0);
+	atomic_set(&mv_flag, 0);
+
+	debug_flag = 0;
+	debug_flag_fatal_err = 0;
+	fatal_err_pr_count = 0;
+
+#ifdef AKM_EARLY_SUSPEND
+	akm->early_suspend_akm.suspend = akm8975_early_suspend;
+	akm->early_suspend_akm.resume = akm8975_early_resume;
+	register_early_suspend(&akm->early_suspend_akm);
 #endif
+	err = akm8975_registerAttr(akm);
+	if (err) {
+		E("%s: akm8975_registerAttr failed\n", __func__);
+		goto exit_registerAttr_failed;
+	}
+
+	disable_flag = 0;
+	reserve_a_flag = 0;
+
+	irq_type = (pdata->irq_trigger) ? IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH;
+
+	err = request_irq(client->irq, akm8975_interrupt, irq_type,
+			  "akm8975", akm);
+	if (err < 0) {
+		E("%s: request irq failed\n", __func__);
+		goto exit_irq_request_failed;
+	}
+
 	return 0;
 
+exit_irq_request_failed:
+exit_registerAttr_failed:
 exit_misc_device_register_failed:
 exit_input_register_device_failed:
 	input_free_device(akm->input_dev);
 exit_input_dev_alloc_failed:
-	akm8975_power_off(akm);
-exit_power_on_failed:
+	free_irq(client->irq, akm);
+exit_set_mode_failed:
+exit_platform_data_null:
 	kfree(akm);
 exit_alloc_data_failed:
 exit_check_functionality_failed:
-exit_platform_data_null:
 	return err;
+
 }
 
-static int __devexit akm8975_remove(struct i2c_client *client)
+static int akm8975_remove(struct i2c_client *client)
 {
 	struct akm8975_data *akm = i2c_get_clientdata(client);
-	FUNCDBG("called");
-	free_irq(client->irq, NULL);
+	free_irq(client->irq, akm);
 	input_unregister_device(akm->input_dev);
-	misc_deregister(&akmd_device);
-	misc_deregister(&akm_aot_device);
-	akm8975_power_off(akm);
 	kfree(akm);
 	return 0;
 }
-
 static const struct i2c_device_id akm8975_id[] = {
-	{ "akm8975", 0 },
+	{ AKM8975_I2C_NAME, 0 },
 	{ }
 };
 
-MODULE_DEVICE_TABLE(i2c, akm8975_id);
-
 static struct i2c_driver akm8975_driver = {
-	.probe = akm8975_probe,
-	.remove = akm8975_remove,
-#ifndef CONFIG_HAS_EARLYSUSPEND
-	.resume = akm8975_resume,
+	.probe 	= akm8975_probe,
+	.remove 	= akm8975_remove,
+	.id_table	= akm8975_id,
+
+#ifndef AKM_EARLY_SUSPEND
 	.suspend = akm8975_suspend,
+	.resume = akm8975_resume,
 #endif
-	.id_table = akm8975_id,
 	.driver = {
-		.name = "akm8975",
-	},
+		   .name = AKM8975_I2C_NAME,
+		   },
 };
 
 static int __init akm8975_init(void)
 {
-	pr_info("AK8975 compass driver: init\n");
-	FUNCDBG("AK8975 compass driver: init\n");
+	I("AKM8975 compass driver: init\n");
 	return i2c_add_driver(&akm8975_driver);
 }
 
 static void __exit akm8975_exit(void)
 {
-	FUNCDBG("AK8975 compass driver: exit\n");
 	i2c_del_driver(&akm8975_driver);
 }
 
 module_init(akm8975_init);
 module_exit(akm8975_exit);
 
-MODULE_AUTHOR("Hou-Kun Chen <hk_chen@htc.com>");
-MODULE_DESCRIPTION("AK8975 compass driver");
+MODULE_DESCRIPTION("AKM8975 compass driver");
 MODULE_LICENSE("GPL");
diff --git a/drivers/misc/cable_detect_8xxx.c b/drivers/misc/cable_detect_8xxx.c
new file mode 100644
index 0000000..209eb6e
--- /dev/null
+++ b/drivers/misc/cable_detect_8xxx.c
@@ -0,0 +1,1105 @@
+/* drivers/misc/cable_detect.c - cable detect driver
+ *
+ * Copyright (C) 2009 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/mfd/pmic8058.h>
+#include <linux/pmic8058-xoadc.h>
+#include <linux/platform_device.h>
+#include <linux/gpio.h>
+#include <mach/board.h>
+
+#ifdef CONFIG_RESET_BY_CABLE_IN
+#include <mach/board_htc.h>
+#endif
+
+#include <mach/cable_detect.h>
+#include <mach/mpp.h>
+#include <linux/switch.h>
+
+#ifdef CONFIG_HTC_HEADSET_MGR
+#include <mach/htc_headset_mgr.h>
+#ifdef CONFIG_HTC_HEADSET_MISC
+#include <mach/htc_headset_misc.h>
+#endif
+#endif
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+#include "../video/msm/sii9234/TPI.h"
+#endif
+
+#include "linux/mfd/pm8xxx/pm8921-charger-htc.h"
+
+static int vbus;
+
+static struct switch_dev dock_switch = {
+	.name = "dock",
+};
+
+struct cable_detect_info {
+	spinlock_t lock;
+
+	int vbus_mpp_gpio;
+	int vbus_mpp_irq;
+
+	
+	int ad_en_active_state;
+	int ad_en_gpio;
+	int ad_en_irq;
+
+	enum usb_connect_type connect_type;
+	
+	int usb_id_pin_gpio;
+	__u8 detect_type;
+	__u8 accessory_type;
+	int idpin_irq;
+	u8 mfg_usb_carkit_enable;
+	u8 mhl_reset_gpio;
+	bool mhl_version_ctrl_flag;
+	struct workqueue_struct *cable_detect_wq;
+	struct delayed_work cable_detect_work;
+	struct delayed_work vbus_detect_work;
+	struct wake_lock vbus_wlock;
+	struct wake_lock cable_detect_wlock;
+	void (*usb_uart_switch)(int);
+	void (*usb_dpdn_switch)(int);
+	struct usb_id_mpp_config_data *mpp_data;
+	void (*config_usb_id_gpios)(bool enable);
+	void (*mhl_1v2_power)(bool enable);
+	int (*is_wireless_charger)(void);
+	u8 cable_redetect;
+	int64_t (*get_adc_cb)(void);
+
+	int ac_9v_gpio;
+	void (*configure_ac_9v_gpio) (int);
+	u8 mhl_internal_3v3;
+
+	int  audio_dock_lock;
+	int notify_init;
+} the_cable_info;
+
+
+#ifdef CONFIG_CABLE_DETECT_ACCESSORY
+static int cable_detect_get_adc(void);
+static int second_detect(struct cable_detect_info *pInfo);
+static void usb_id_detect_init(struct cable_detect_info *info);
+#endif
+
+static DEFINE_MUTEX(cable_notify_sem);
+static void send_cable_connect_notify(int cable_type)
+{
+	static struct t_cable_status_notifier *notifier;
+	struct cable_detect_info *pInfo = &the_cable_info;
+
+	mutex_lock(&cable_notify_sem);
+	CABLE_DEBUG("%s: cable_type = %d\n", __func__, cable_type);
+
+	if (cable_type == CONNECT_TYPE_UNKNOWN)
+		cable_type = CONNECT_TYPE_USB;
+
+	if (pInfo->ac_9v_gpio && (cable_type == CONNECT_TYPE_USB
+				|| cable_type == CONNECT_TYPE_AC
+				|| cable_type == CONNECT_TYPE_MHL_AC)) {
+		if (pInfo->configure_ac_9v_gpio)
+			pInfo->configure_ac_9v_gpio(1);
+
+		mdelay(5);
+		if (gpio_get_value(pInfo->ac_9v_gpio)) {
+			CABLE_INFO("%s detect 9v charger\n", __func__);
+			cable_type = CONNECT_TYPE_9V_AC;
+		}
+
+		if (pInfo->configure_ac_9v_gpio)
+			pInfo->configure_ac_9v_gpio(0);
+	}
+
+	if (cable_type > 0 && pInfo->accessory_type == DOCK_STATE_DMB) {
+		CABLE_INFO("%s: DMB presents. Disabling charge.\n", __func__);
+		cable_type = CONNECT_TYPE_CLEAR;
+	}
+
+	list_for_each_entry(notifier,
+		&g_lh_calbe_detect_notifier_list,
+		cable_notifier_link) {
+			if (notifier->func != NULL) {
+				CABLE_INFO("Send to: %s, type %d\n",
+						notifier->name, cable_type);
+				
+				
+				notifier->func(cable_type);
+			}
+		}
+	mutex_unlock(&cable_notify_sem);
+}
+
+int cable_detect_register_notifier(struct t_cable_status_notifier *notifier)
+{
+	if (!notifier || !notifier->name || !notifier->func)
+		return -EINVAL;
+
+	mutex_lock(&cable_notify_sem);
+	list_add(&notifier->cable_notifier_link,
+		&g_lh_calbe_detect_notifier_list);
+	if(the_cable_info.notify_init == 1)
+		notifier->func(cable_get_connect_type());
+	mutex_unlock(&cable_notify_sem);
+	return 0;
+}
+
+#if (defined(CONFIG_USB_OTG) && defined(CONFIG_USB_OTG_HOST))
+static DEFINE_MUTEX(usb_host_notify_sem);
+static void send_usb_host_connect_notify(int cable_in)
+{
+	struct t_usb_host_status_notifier *notifier;
+
+	mutex_lock(&usb_host_notify_sem);
+	list_for_each_entry(notifier,
+		&g_lh_usb_host_detect_notifier_list,
+		usb_host_notifier_link) {
+		if (notifier->func != NULL) {
+			CABLE_INFO("[HostNotify] Send to: %s: %d\n",
+					notifier->name, cable_in);
+			
+			
+			notifier->func(cable_in);
+		}
+	}
+	mutex_unlock(&usb_host_notify_sem);
+}
+
+int usb_host_detect_register_notifier(struct t_usb_host_status_notifier *notifier)
+{
+	if (!notifier || !notifier->name || !notifier->func)
+		return -EINVAL;
+
+	mutex_lock(&usb_host_notify_sem);
+	list_add(&notifier->usb_host_notifier_link,
+			&g_lh_usb_host_detect_notifier_list);
+	mutex_unlock(&usb_host_notify_sem);
+	return 0;
+}
+#endif
+
+static void check_vbus_in(struct work_struct *w)
+{
+	int vbus_in;
+	int level;
+	struct cable_detect_info *pInfo = container_of(
+			w, struct cable_detect_info, vbus_detect_work.work);
+
+	level = pm8921_is_pwr_src_plugged_in();
+	vbus_in = level;
+	CABLE_INFO("%s: vbus = %d, vbus_in = %d\n", __func__, vbus, vbus_in);
+
+#ifdef CONFIG_RESET_BY_CABLE_IN
+	reset_dflipflop();
+#endif
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	if (pInfo->cable_redetect) {
+		CABLE_INFO("mhl re-detect\n");
+		disable_irq_nosync(pInfo->idpin_irq);
+		queue_delayed_work(pInfo->cable_detect_wq,
+			&pInfo->cable_detect_work, ADC_DELAY);
+	}
+#endif
+
+	if (pInfo->notify_init == 0 && vbus_in == 0 && vbus == 0)
+		send_cable_connect_notify(CONNECT_TYPE_NONE);
+	if (pInfo->notify_init == 0 && vbus == vbus_in)
+                msm_otg_set_vbus_state(vbus_in);
+
+	pInfo->notify_init = 1;
+
+	if (vbus != vbus_in) {
+		vbus = vbus_in;
+
+		if(pInfo->accessory_type == DOCK_STATE_MHL) {
+			CABLE_INFO("%s: usb_uart switch, MHL cable , Do nothing\n", __func__);
+		} else {
+			if (pInfo->usb_uart_switch)
+				pInfo->usb_uart_switch(!vbus);
+		}
+
+		msm_otg_set_vbus_state(vbus_in);
+
+		if (pInfo->ad_en_gpio) {
+			if (vbus) {
+				if (pInfo->ad_en_irq)
+					CABLE_INFO("%s: Enable ad_en_irq ++\n", __func__);
+					enable_irq(pInfo->ad_en_irq);
+			} else {
+					CABLE_INFO("%s: Disable ad_en_irq --\n", __func__);
+					disable_irq_nosync(pInfo->ad_en_irq);
+			}
+		}
+	}
+	wake_unlock(&pInfo->vbus_wlock);
+}
+
+#ifdef CONFIG_CABLE_DETECT_ACCESSORY
+void release_audio_dock_lock(void)
+{
+	int value;
+	struct cable_detect_info *pInfo = &the_cable_info;
+	if(pInfo->audio_dock_lock != 1) {
+		CABLE_INFO("audio_dock_removal fucntion should not be called when audio_dock_lock != 1\n");
+		return;
+	}
+	CABLE_INFO("unlock audio dock lock\n");
+
+	pInfo->audio_dock_lock = 0;
+	
+	value = gpio_get_value(pInfo->usb_id_pin_gpio);
+	irq_set_irq_type(pInfo->idpin_irq, value ? IRQF_TRIGGER_HIGH: IRQF_TRIGGER_LOW);	
+	enable_irq(pInfo->idpin_irq);
+}
+EXPORT_SYMBOL(release_audio_dock_lock);
+
+static int cable_detect_get_type(struct cable_detect_info *pInfo)
+{
+	int id_pin, adc, type;
+	static int prev_type, stable_count;
+
+	if (stable_count >= ADC_RETRY)
+		stable_count = 0;
+
+	id_pin = gpio_get_value_cansleep(pInfo->usb_id_pin_gpio);
+	if (id_pin == 0 || pInfo->cable_redetect) {
+		CABLE_INFO("%s: id pin low\n", __func__);
+
+
+		adc = cable_detect_get_adc();
+
+		if (adc > -100 && adc < 100)
+			type = second_detect(pInfo);
+		else {
+			if (adc > 150 && adc < 220)
+				type = DOCK_STATE_CAR;
+			else if (adc > 370 && adc < 440)
+				type = DOCK_STATE_USB_HEADSET;
+			else if (adc > 440 && adc < 550)
+				type = DOCK_STATE_DMB;
+			else if (adc > 550 && adc < 900)
+				type = DOCK_STATE_DESK;
+			else
+				type = DOCK_STATE_UNDEFINED;
+		}
+	} else {
+		CABLE_INFO("%s: id pin high\n", __func__);
+		type = DOCK_STATE_UNDOCKED;
+	}
+
+	if (prev_type == type)
+		stable_count++;
+	else
+		stable_count = 0;
+
+	CABLE_INFO("%s prev_type %d, type %d, stable_count %d\n",
+				__func__, prev_type, type, stable_count);
+
+	prev_type = type;
+	return (stable_count >= ADC_RETRY) ? type : -2;
+}
+
+static void cable_detect_handler(struct work_struct *w)
+{
+	struct cable_detect_info *pInfo = container_of(
+			w, struct cable_detect_info, cable_detect_work.work);
+	int value;
+	int accessory_type;
+
+	if (pInfo == NULL)
+		return;
+	if(pInfo->audio_dock_lock == 1) {
+		CABLE_INFO("audio dock lock! skip cable_detect_handler\n");
+		return;
+	}
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	if (pInfo->mhl_reset_gpio != 0)
+		gpio_set_value_cansleep(pInfo->mhl_reset_gpio, 0); 
+#endif
+	if (pInfo->detect_type == CABLE_TYPE_PMIC_ADC) {
+		accessory_type = cable_detect_get_type(pInfo);
+		if (accessory_type == -2) {
+			queue_delayed_work(pInfo->cable_detect_wq,
+				&pInfo->cable_detect_work, ADC_DELAY);
+			return;
+		}
+	} else
+		accessory_type = DOCK_STATE_UNDOCKED;
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	if (pInfo->mhl_reset_gpio != 0)
+		gpio_set_value_cansleep(pInfo->mhl_reset_gpio, 1); 
+	CABLE_INFO("[MHL] Enter D3 mode\n");
+	
+	if (accessory_type != DOCK_STATE_MHL)
+		D2ToD3();
+#endif
+
+	if (pInfo->accessory_type == DOCK_STATE_AUDIO_DOCK &&
+		accessory_type != DOCK_STATE_UNDEFINED &&
+		accessory_type != DOCK_STATE_UNDOCKED) {
+		CABLE_INFO("bad accessory state. from audio dock to state %d\n",accessory_type);
+		switch_set_state(&dock_switch, DOCK_STATE_UNDOCKED);
+#ifdef CONFIG_HTC_HEADSET_MGR
+		headset_ext_detect(USB_NO_HEADSET);
+#endif
+		pInfo->accessory_type = DOCK_STATE_UNDOCKED;
+	}
+
+	switch (accessory_type) {
+	case DOCK_STATE_DESK:
+		CABLE_INFO("cradle inserted\n");
+		switch_set_state(&dock_switch, DOCK_STATE_DESK);
+		pInfo->accessory_type = DOCK_STATE_DESK;
+		break;
+	case DOCK_STATE_CAR:
+		CABLE_INFO("Car kit inserted\n");
+		switch_set_state(&dock_switch, DOCK_STATE_CAR);
+		pInfo->accessory_type = DOCK_STATE_CAR;
+		break;
+	case DOCK_STATE_USB_HEADSET:
+		CABLE_INFO("USB headset inserted\n");
+		pInfo->accessory_type = DOCK_STATE_USB_HEADSET;
+		if (pInfo->usb_dpdn_switch)
+			pInfo->usb_dpdn_switch(PATH_USB_AUD);
+#ifdef CONFIG_HTC_HEADSET_MGR
+		headset_ext_detect(USB_AUDIO_OUT);
+#endif
+		break;
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	case DOCK_STATE_MHL:
+		CABLE_INFO("MHL inserted\n");
+		switch_set_state(&dock_switch, DOCK_STATE_MHL);
+		pInfo->accessory_type = DOCK_STATE_MHL;
+#ifdef CONFIG_INTERNAL_CHARGING_SUPPORT
+		if (!pInfo->mhl_internal_3v3 && !vbus)
+			send_cable_connect_notify(CONNECT_TYPE_INTERNAL);
+
+#endif
+		sii9234_mhl_device_wakeup();
+		break;
+#endif
+#if (defined(CONFIG_USB_OTG) && defined(CONFIG_USB_OTG_HOST))
+	case DOCK_STATE_USB_HOST:
+		CABLE_INFO("USB Host inserted\n");
+		send_usb_host_connect_notify(1);
+		pInfo->accessory_type = DOCK_STATE_USB_HOST;
+		switch_set_state(&dock_switch, DOCK_STATE_USB_HOST);
+		break;
+#endif
+	case DOCK_STATE_DMB:
+		CABLE_INFO("DMB inserted\n");
+		send_cable_connect_notify(CONNECT_TYPE_CLEAR);
+		switch_set_state(&dock_switch, DOCK_STATE_DMB);
+		pInfo->accessory_type = DOCK_STATE_DMB;
+		break;
+	case DOCK_STATE_AUDIO_DOCK:
+		CABLE_INFO("Audio Dock inserted\n");
+		switch_set_state(&dock_switch, DOCK_STATE_DESK);
+		pInfo->accessory_type = DOCK_STATE_AUDIO_DOCK;
+#if 0
+#ifdef CONFIG_HTC_HEADSET_MGR
+		cable_type_value = usb_get_connect_type();
+		if (cable_type_value == CONNECT_TYPE_UNKNOWN ||
+			cable_type_value == CONNECT_TYPE_USB ||
+			cable_type_value == CONNECT_TYPE_AC) {
+			CABLE_INFO("notify auido driver in cable_detect_handler, cable type %d\n",cable_type_value);
+			pInfo->audio_dock_lock = 1;
+			headset_ext_detect(USB_AUDIO_OUT);
+			return;	
+		}
+#endif
+#endif
+		break;
+	case DOCK_STATE_UNDEFINED:
+	case DOCK_STATE_UNDOCKED:
+		switch (pInfo->accessory_type) {
+		case DOCK_STATE_DESK:
+			CABLE_INFO("cradle removed\n");
+			switch_set_state(&dock_switch, DOCK_STATE_UNDOCKED);
+			pInfo->accessory_type = DOCK_STATE_UNDOCKED;
+			break;
+		case DOCK_STATE_CAR:
+			CABLE_INFO("Car kit removed\n");
+			switch_set_state(&dock_switch, DOCK_STATE_UNDOCKED);
+			pInfo->accessory_type = DOCK_STATE_UNDOCKED;
+			break;
+		case DOCK_STATE_USB_HEADSET:
+			CABLE_INFO("USB headset removed\n");
+#ifdef CONFIG_HTC_HEADSET_MGR
+			headset_ext_detect(USB_NO_HEADSET);
+#endif
+			if (pInfo->usb_dpdn_switch)
+				pInfo->usb_dpdn_switch(PATH_USB);
+			pInfo->accessory_type = DOCK_STATE_UNDOCKED;
+			break;
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+		case DOCK_STATE_MHL:
+			CABLE_INFO("MHL removed\n");
+			switch_set_state(&dock_switch, DOCK_STATE_UNDOCKED);
+			sii9234_disableIRQ();
+			break;
+#endif
+#if (defined(CONFIG_USB_OTG) && defined(CONFIG_USB_OTG_HOST))
+		case DOCK_STATE_USB_HOST:
+			CABLE_INFO("USB host cable removed\n");
+			pInfo->accessory_type = DOCK_STATE_UNDOCKED;
+			send_usb_host_connect_notify(0);
+			switch_set_state(&dock_switch, DOCK_STATE_UNDOCKED);
+			break;
+#endif
+		case DOCK_STATE_DMB:
+			CABLE_INFO("DMB removed\n");
+			switch_set_state(&dock_switch, DOCK_STATE_UNDOCKED);
+			pInfo->accessory_type = DOCK_STATE_UNDOCKED;
+			break;
+		case DOCK_STATE_AUDIO_DOCK:
+			CABLE_INFO("Audio Dock removed\n");
+			switch_set_state(&dock_switch, DOCK_STATE_UNDOCKED);
+#ifdef CONFIG_HTC_HEADSET_MGR
+			headset_ext_detect(USB_NO_HEADSET);
+#endif
+			pInfo->accessory_type = DOCK_STATE_UNDOCKED;
+			break;
+		}
+	default :
+		break;
+	}
+
+	value = gpio_get_value_cansleep(pInfo->usb_id_pin_gpio);
+	CABLE_INFO("%s ID pin %d, type %d\n", __func__,
+				value, pInfo->accessory_type);
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+	if (pInfo->accessory_type == DOCK_STATE_MHL)
+		return;
+#endif
+	if (pInfo->accessory_type == DOCK_STATE_UNDOCKED)
+		irq_set_irq_type(pInfo->idpin_irq,
+			value ? IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH);
+	else
+		irq_set_irq_type(pInfo->idpin_irq, IRQF_TRIGGER_HIGH);
+
+	enable_irq(pInfo->idpin_irq);
+#if 0
+	wake_unlock(&pInfo->cable_detect_wlock);
+#endif
+}
+
+void set_mfg_usb_carkit_enable(int enable)
+{
+	the_cable_info.mfg_usb_carkit_enable = enable;
+}
+
+int cable_get_accessory_type(void)
+{
+	return the_cable_info.accessory_type;
+}
+
+static int cable_detect_get_adc(void)
+{
+	struct cable_detect_info *pInfo = &the_cable_info;
+
+	return pInfo->get_adc_cb();
+}
+
+int cable_get_usb_id_level(void)
+{
+	struct cable_detect_info *pInfo = &the_cable_info;
+
+	if (pInfo->usb_id_pin_gpio)
+		return gpio_get_value(pInfo->usb_id_pin_gpio);
+	else {
+		printk(KERN_INFO "usb id is not defined\n");
+		return 1;
+	}
+}
+
+static int second_detect(struct cable_detect_info *pInfo)
+{
+	uint32_t adc_value = 0xffffffff;
+	int type;
+
+	if (pInfo->config_usb_id_gpios)
+		pInfo->config_usb_id_gpios(1);
+
+	adc_value = cable_detect_get_adc();
+	CABLE_INFO("[2nd] accessory adc = %d\n", adc_value);
+
+	if ((pInfo->mhl_version_ctrl_flag) || (adc_value >= 776 && adc_value <= 1020))
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+		type = DOCK_STATE_MHL;
+#else
+		type = DOCK_STATE_UNDEFINED;
+#endif
+	else if(adc_value >= 1021 && adc_value <= 1224)
+		type = DOCK_STATE_AUDIO_DOCK;
+	else
+#if (defined(CONFIG_USB_OTG) && defined(CONFIG_USB_OTG_HOST))
+		type = DOCK_STATE_USB_HOST;
+#else
+		type = DOCK_STATE_UNDEFINED;
+#endif
+
+	if (pInfo->config_usb_id_gpios)
+		pInfo->config_usb_id_gpios(0);
+
+	return type;
+}
+
+static int get_usb_id_adc(char *buffer, struct kernel_param *kp)
+{
+	unsigned length = 0;
+	int adc;
+
+	adc = cable_detect_get_adc();
+
+	length += sprintf(buffer, "%d\n", adc);
+
+	return length;
+}
+module_param_call(usb_id_adc, NULL, get_usb_id_adc, NULL, 0664);
+
+static ssize_t dock_status_show(struct device *dev,
+	struct device_attribute *attr, char *buf)
+{
+	struct cable_detect_info *pInfo = &the_cable_info;
+
+	if (pInfo->accessory_type == DOCK_STATE_DESK || pInfo->accessory_type == DOCK_STATE_AUDIO_DOCK)
+		return sprintf(buf, "online\n");
+	else if (pInfo->accessory_type == 3) 
+		return sprintf(buf, "online\n");
+	else
+		return sprintf(buf, "offline\n");
+}
+static DEVICE_ATTR(status, S_IRUGO | S_IWUSR, dock_status_show, NULL);
+
+static irqreturn_t usbid_interrupt(int irq, void *data)
+{
+	struct cable_detect_info *pInfo = (struct cable_detect_info *)data;
+
+	disable_irq_nosync(pInfo->idpin_irq);
+
+	CABLE_INFO("usb: id interrupt\n");
+	pInfo->cable_redetect = 0;
+	queue_delayed_work(pInfo->cable_detect_wq,
+		&pInfo->cable_detect_work, ADC_DELAY);
+	wake_lock_timeout(&pInfo->cable_detect_wlock, HZ*2);
+	return IRQ_HANDLED;
+}
+
+static void usb_id_detect_init(struct cable_detect_info *pInfo)
+{
+	int ret;
+	CABLE_INFO("%s: id pin %d\n", __func__,
+		pInfo->usb_id_pin_gpio);
+
+	if (pInfo->usb_id_pin_gpio == 0)
+		return;
+	ret = gpio_request(pInfo->usb_id_pin_gpio, "USBID_GPIO");
+	if (ret) {
+		CABLE_ERR("%s: request id gpio failed\n", __func__);
+		return;
+	}
+
+	if (pInfo->config_usb_id_gpios)
+		pInfo->config_usb_id_gpios(0);
+
+	if (pInfo->idpin_irq == 0)
+		pInfo->idpin_irq = gpio_to_irq(pInfo->usb_id_pin_gpio);
+
+	set_irq_flags(pInfo->idpin_irq, IRQF_VALID | IRQF_NOAUTOEN);
+	ret = request_any_context_irq(pInfo->idpin_irq, usbid_interrupt,
+				IRQF_TRIGGER_LOW, "idpin_irq", pInfo);
+	if (ret < 0) {
+		CABLE_ERR("%s: request_irq failed\n", __func__);
+		return;
+	}
+
+	ret = enable_irq_wake(pInfo->idpin_irq);
+	if (ret < 0) {
+		CABLE_ERR("%s: set_irq_wake failed\n", __func__);
+		goto err;
+	}
+
+	enable_irq(pInfo->idpin_irq);
+	return;
+err:
+	free_irq(pInfo->idpin_irq, 0);
+}
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+static void mhl_status_notifier_func(bool isMHL, int charging_type)
+{
+	struct cable_detect_info *pInfo = &the_cable_info;
+	int id_pin = gpio_get_value_cansleep(pInfo->usb_id_pin_gpio);
+	static uint8_t mhl_connected;
+
+	CABLE_INFO("%s: isMHL %d, charging type %d, id_pin %d\n",
+				__func__, isMHL, charging_type, id_pin);
+	if (pInfo->accessory_type != DOCK_STATE_MHL) {
+		CABLE_INFO("%s: accessory is not MHL, type %d\n",
+					__func__, pInfo->accessory_type);
+		return;
+	}
+
+#ifdef CONFIG_HTC_HEADSET_MISC
+	headset_mhl_audio_jack_enable(isMHL);
+#endif
+
+	if (!isMHL) {
+		CABLE_INFO("MHL removed\n");
+		sii9234_disableIRQ();
+
+		if (pInfo->usb_dpdn_switch)
+			pInfo->usb_dpdn_switch(PATH_USB);
+
+		if (pInfo->mhl_1v2_power)
+			pInfo->mhl_1v2_power(0);
+#ifdef CONFIG_INTERNAL_CHARGING_SUPPORT
+		send_cable_connect_notify(CONNECT_TYPE_CLEAR);
+#endif
+#ifdef MHL_REDETECT
+		if (mhl_connected == 0) {
+			CABLE_INFO("MHL re-detect\n");
+			set_irq_type(pInfo->idpin_irq,
+				id_pin ? IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH);
+			pInfo->cable_redetect = 1;
+		}
+#endif
+		mhl_connected = 0;
+
+		pInfo->accessory_type = DOCK_STATE_UNDOCKED;
+		sii9234_disableIRQ();
+		enable_irq(pInfo->idpin_irq);
+		return;
+	} else {
+		mhl_connected = 1;
+		set_irq_type(pInfo->idpin_irq,
+			id_pin ? IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH);
+#ifdef CONFIG_INTERNAL_CHARGING_SUPPORT
+			if (charging_type == CONNECT_TYPE_INTERNAL)
+				charging_type = CONNECT_TYPE_NONE;
+			send_cable_connect_notify(charging_type);
+#else
+			send_cable_connect_notify(charging_type);
+#endif
+#if 0
+#ifdef CONFIG_INTERNAL_CHARGING_SUPPORT
+		else if (vbus)
+			send_cable_connect_notify(CONNECT_TYPE_USB);
+#endif
+#endif
+	}
+}
+
+static struct t_mhl_status_notifier mhl_status_notifier = {
+	.name = "mhl_detect",
+	.func = mhl_status_notifier_func,
+};
+#endif 
+#endif 
+
+
+static ssize_t vbus_status_show(struct device *dev,
+	struct device_attribute *attr, char *buf)
+{
+	int level, vbus_in;
+
+	level = pm8921_is_usb_chg_plugged_in();
+	vbus_in = level;
+	CABLE_INFO("%s: vbus state = %d\n", __func__, vbus_in);
+	return sprintf(buf, "%d\n", vbus_in);
+}
+static DEVICE_ATTR(vbus, S_IRUGO | S_IWUSR, vbus_status_show, NULL);
+
+#ifdef CONFIG_CABLE_DETECT_ACCESSORY
+static ssize_t adc_status_show(struct device *dev,
+	struct device_attribute *attr, char *buf)
+{
+	int adc;
+
+	adc = cable_detect_get_adc();
+	CABLE_INFO("%s: ADC = %d\n", __func__, adc);
+	return sprintf(buf, "%d\n", adc);
+}
+static DEVICE_ATTR(adc, S_IRUGO | S_IWUSR, adc_status_show, NULL);
+
+static ssize_t dmb_wakeup_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	struct cable_detect_info *pInfo = &the_cable_info;
+	uint32_t wakeup;
+
+	if (pInfo->accessory_type != DOCK_STATE_DMB) {
+		CABLE_INFO("%s: DMB not exist. Do nothing.\n", __func__);
+		return count;
+	}
+
+	sscanf(buf, "%d", &wakeup);
+	CABLE_DEBUG("%s: wakeup = %d\n", __func__, wakeup);
+	if (!!wakeup) {
+		disable_irq_nosync(pInfo->idpin_irq);
+
+		gpio_direction_output(pInfo->usb_id_pin_gpio, 0);
+		msleep(1);
+		gpio_direction_output(pInfo->usb_id_pin_gpio, 1);
+		msleep(10);
+		gpio_direction_output(pInfo->usb_id_pin_gpio, 0);
+		msleep(1);
+
+		gpio_direction_input(pInfo->usb_id_pin_gpio);
+		enable_irq(pInfo->idpin_irq);
+	}
+	CABLE_INFO("%s(parent:%s): request DMB wakeup done.\n",
+			current->comm, current->parent->comm);
+
+	return count;
+}
+
+static DEVICE_ATTR(dmb_wakeup, S_IRUGO | S_IWUSR, NULL, dmb_wakeup_store);
+static ssize_t unlock_audio_dock_lock_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	uint32_t unlock;
+
+	sscanf(buf, "%d", &unlock);
+	CABLE_DEBUG("%s: unlock = %d\n", __func__, unlock);
+	if (!!unlock)
+		release_audio_dock_lock();
+
+	return count;
+}
+
+static DEVICE_ATTR(unlock_audio_dock_lock, S_IRUGO | S_IWUSR, NULL, unlock_audio_dock_lock_store);
+
+#endif
+
+int cable_get_connect_type(void)
+{
+	struct cable_detect_info *pInfo = &the_cable_info;
+
+	return pInfo->connect_type;
+}
+
+static irqreturn_t ad_en_irq_handler(int irq, void *data)
+{
+	unsigned long flags;
+	struct cable_detect_info *pInfo = &the_cable_info;
+
+	disable_irq_nosync(pInfo->ad_en_irq);
+	CABLE_INFO("%s: Disable ad_en_irq --\n", __func__);
+	spin_lock_irqsave(&pInfo->lock, flags);
+	queue_delayed_work(pInfo->cable_detect_wq,
+			&pInfo->vbus_detect_work, HZ/10);
+	spin_unlock_irqrestore(&pInfo->lock, flags);
+#if 1
+	wake_lock_timeout(&pInfo->vbus_wlock, HZ*2);
+#endif
+
+	return IRQ_HANDLED;
+}
+
+static int cd_pmic_request_irq(unsigned int gpio, unsigned int *irq,
+			       irq_handler_t handler, unsigned long flags,
+			       const char *name, unsigned int wake)
+{
+	int ret = 0;
+
+	ret = gpio_request(gpio, name);
+	if (ret < 0)
+		return ret;
+
+	ret = gpio_direction_input(gpio);
+	if (ret < 0) {
+		gpio_free(gpio);
+		return ret;
+	}
+
+	if (!(*irq)) {
+		ret = gpio_to_irq(gpio);
+		if (ret < 0) {
+			gpio_free(gpio);
+			return ret;
+		}
+		*irq = (unsigned int) ret;
+	}
+
+	ret = request_any_context_irq(*irq, handler, flags, name, NULL);
+	if (ret < 0) {
+		gpio_free(gpio);
+		return ret;
+	}
+
+	ret = irq_set_irq_wake(*irq, wake);
+	if (ret < 0) {
+		free_irq(*irq, 0);
+		gpio_free(gpio);
+		return ret;
+	}
+
+	return 1;
+}
+
+static int cable_detect_probe(struct platform_device *pdev)
+{
+	int ret;
+	struct cable_detect_platform_data *pdata = pdev->dev.platform_data;
+	struct cable_detect_info *pInfo = &the_cable_info;
+
+	spin_lock_init(&the_cable_info.lock);
+
+	if (pdata) {
+		pInfo->vbus_mpp_gpio = pdata->vbus_mpp_gpio;
+		pInfo->vbus_mpp_irq = pdata->vbus_mpp_irq;
+		pInfo->ad_en_active_state = pdata->ad_en_active_state;
+		pInfo->ad_en_gpio = pdata->ad_en_gpio;
+		pInfo->ad_en_irq = pdata->ad_en_irq;
+		pInfo->usb_uart_switch = pdata->usb_uart_switch;
+		pInfo->usb_dpdn_switch = pdata->usb_dpdn_switch;
+		if (pInfo->usb_dpdn_switch)
+			pInfo->usb_dpdn_switch(PATH_USB);
+		pInfo->ac_9v_gpio = pdata->ac_9v_gpio;
+		pInfo->configure_ac_9v_gpio = pdata->configure_ac_9v_gpio;
+		pInfo->mhl_internal_3v3 = pdata->mhl_internal_3v3;
+
+#ifdef CONFIG_CABLE_DETECT_ACCESSORY
+		pInfo->detect_type = pdata->detect_type;
+		pInfo->usb_id_pin_gpio = pdata->usb_id_pin_gpio;
+		pInfo->mhl_reset_gpio = pdata->mhl_reset_gpio;
+		pInfo->mpp_data = &pdata->mpp_data;
+		pInfo->config_usb_id_gpios = pdata->config_usb_id_gpios;
+		pInfo->mhl_version_ctrl_flag = pdata->mhl_version_ctrl_flag;
+		pInfo->mhl_1v2_power = pdata->mhl_1v2_power;
+		pInfo->get_adc_cb = pdata->get_adc_cb;
+
+#endif
+
+		if (pdata->is_wireless_charger)
+			pInfo->is_wireless_charger = pdata->is_wireless_charger;
+#ifdef CONFIG_CABLE_DETECT_ACCESSORY
+		INIT_DELAYED_WORK(&pInfo->cable_detect_work, cable_detect_handler);
+#endif
+		INIT_DELAYED_WORK(&pInfo->vbus_detect_work, check_vbus_in);
+
+		pInfo->cable_detect_wq = create_singlethread_workqueue("cable_detect");
+		if (pInfo->cable_detect_wq == 0) {
+			CABLE_ERR("usb: fail to create workqueue\n");
+			return -ENOMEM;
+		}
+
+		if (pdata->vbus_mpp_config)
+			pdata->vbus_mpp_config();
+
+		wake_lock_init(&pInfo->vbus_wlock,
+			WAKE_LOCK_SUSPEND, "vbus_lock");
+
+		wake_lock_init(&pInfo->cable_detect_wlock,
+			WAKE_LOCK_SUSPEND, "cable_detect_lock");
+
+		if (pdata->ad_en_gpio) {
+			ret = cd_pmic_request_irq(pdata->ad_en_gpio,
+					&pdata->ad_en_irq, ad_en_irq_handler,
+					pdata->ad_en_active_state ?
+					IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING,
+					"ad_en_irq", 1);
+			if (ret < 0) {
+				printk("Failed to request PMIC AD_EN IRQ (0x%X)", ret);
+			} else
+				disable_irq(pdata->ad_en_irq);
+		}
+	}
+	if (switch_dev_register(&dock_switch) < 0) {
+		CABLE_ERR("fail to register dock switch!\n");
+		return 0;
+	}
+
+	ret = device_create_file(dock_switch.dev, &dev_attr_vbus);
+	if (ret != 0)
+		CABLE_ERR("dev_attr_vbus failed\n");
+
+#ifdef CONFIG_CABLE_DETECT_ACCESSORY
+	ret = device_create_file(dock_switch.dev, &dev_attr_status);
+	if (ret != 0)
+		CABLE_ERR("dev_attr_status failed\n");
+
+	ret = device_create_file(dock_switch.dev, &dev_attr_adc);
+	if (ret != 0)
+		CABLE_ERR("dev_attr_adc failed\n");
+
+	ret = device_create_file(dock_switch.dev, &dev_attr_dmb_wakeup);
+	if (ret != 0)
+		CABLE_ERR("dev_attr_dmb_wakeup failed\n");
+
+	ret = device_create_file(dock_switch.dev, &dev_attr_unlock_audio_dock_lock);
+	if (ret != 0)
+		CABLE_ERR("dev_attr_unlock_audio_dock_lock failed\n");
+
+	usb_id_detect_init(pInfo);
+#endif
+
+	return 0;
+}
+
+#ifdef CONFIG_KDDI_ADAPTER
+#define VBUS_DEBOUNCE_TIME	500
+#define MSPERIOD(end, start)  ktime_to_ms(ktime_sub(end, start))
+#endif
+irqreturn_t cable_detection_vbus_irq_handler(void)
+{
+	unsigned long flags;
+#ifdef CONFIG_KDDI_ADAPTER
+	static int previous_vbus = -1,current_vbus = -1;
+	static int firstdrop = 0;
+	static ktime_t end_ktime;
+	static ktime_t cable_remove_ktime;
+	s64 diff = 0;
+#endif
+	struct cable_detect_info *pInfo = &the_cable_info;
+
+	CABLE_INFO("%s\n", __func__);
+#ifdef CONFIG_KDDI_ADAPTER
+	if (previous_vbus  == -1)
+		previous_vbus = current_vbus = pm8921_is_pwr_src_plugged_in();
+	else {
+		current_vbus = pm8921_is_pwr_src_plugged_in();
+		if(previous_vbus == 1 && current_vbus  == 0) { 
+			cable_remove_ktime = ktime_get();
+			firstdrop  = 1;
+		} else if (previous_vbus == 0 && current_vbus  == 1 && firstdrop == 1) { 
+			end_ktime = ktime_get();
+			diff = MSPERIOD(end_ktime, cable_remove_ktime);
+			printk("=============diff %lld\n",diff);
+			if (diff < VBUS_DEBOUNCE_TIME) {
+				spin_lock_irqsave(&pInfo->lock, flags);
+				__cancel_delayed_work(&pInfo->vbus_detect_work); 
+				spin_unlock_irqrestore(&pInfo->lock, flags);
+				previous_vbus = current_vbus;
+				printk("==========cancel pending\n");
+				return IRQ_HANDLED;
+			}
+		}
+		previous_vbus = current_vbus;
+	}
+	CABLE_INFO("%s go\n", __func__);
+#endif
+
+	spin_lock_irqsave(&pInfo->lock, flags);
+#ifdef CONFIG_KDDI_ADAPTER
+	queue_delayed_work(pInfo->cable_detect_wq,
+			&pInfo->vbus_detect_work, HZ / 2);
+#else
+	queue_delayed_work(pInfo->cable_detect_wq,
+			&pInfo->vbus_detect_work, HZ/10);
+#endif
+	spin_unlock_irqrestore(&pInfo->lock, flags);
+#if 1
+	wake_lock_timeout(&pInfo->vbus_wlock, HZ*2);
+#endif
+
+	CABLE_INFO("%s --\n", __func__);
+	return IRQ_HANDLED;
+}
+EXPORT_SYMBOL(cable_detection_vbus_irq_handler);
+
+struct platform_driver cable_detect_driver = {
+	.probe = cable_detect_probe,
+	
+	.driver = {
+		.name	= "cable_detect",
+		.owner = THIS_MODULE,
+	},
+};
+
+static void usb_status_notifier_func(int cable_type)
+{
+	struct cable_detect_info*pInfo = &the_cable_info;
+
+	CABLE_INFO("%s: cable_type = %d\n", __func__, cable_type);
+
+	
+	if(pInfo->audio_dock_lock == 0 && (cable_type == CONNECT_TYPE_USB || cable_type == CONNECT_TYPE_AC || cable_type == CONNECT_TYPE_MHL_AC))
+		if(pInfo->accessory_type == DOCK_STATE_AUDIO_DOCK) {
+#ifdef CONFIG_HTC_HEADSET_MGR
+			CABLE_INFO("notify auido driver in usb_status_notifier_func\n");
+			pInfo->audio_dock_lock = 1;
+			
+			cancel_delayed_work_sync(&pInfo->cable_detect_work);
+			if (pInfo->accessory_type == DOCK_STATE_AUDIO_DOCK)
+				headset_ext_detect(USB_AUDIO_OUT);
+			else {
+				CABLE_INFO("latest accessory type is %d, stop to notify audio dock\n",pInfo->accessory_type);
+				pInfo->audio_dock_lock = 0;
+			}
+#endif
+		}
+
+	if (cable_type > CONNECT_TYPE_NONE) {
+		if (pInfo->ad_en_gpio) {
+			if (gpio_get_value(pInfo->ad_en_gpio) ==
+							pInfo->ad_en_active_state)
+				cable_type = CONNECT_TYPE_WIRELESS;
+		} else if (pInfo->is_wireless_charger) {
+			if (pInfo->is_wireless_charger())
+				cable_type = CONNECT_TYPE_WIRELESS;
+		}
+	}
+
+#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
+#ifdef CONFIG_INTERNAL_CHARGING_SUPPORT
+	if (!pInfo->mhl_internal_3v3 &&
+			pInfo->accessory_type == DOCK_STATE_MHL) {
+		CABLE_INFO("%s: MHL detected. Do nothing\n", __func__);
+		return;
+	}
+#endif
+#endif
+	pInfo->connect_type = cable_type;
+	send_cable_connect_notify(cable_type);
+
+}
+
+static struct t_usb_status_notifier usb_status_notifier = {
+	.name = "cable_detect",
+	.func = usb_status_notifier_func,
+};
+
+static int __init cable_detect_init(void)
+{
+	vbus = 0;
+	the_cable_info.connect_type = CONNECT_TYPE_NONE;
+	htc_usb_register_notifier(&usb_status_notifier);
+#if (defined(CONFIG_CABLE_DETECT_ACCESSORY) && defined(CONFIG_FB_MSM_HDMI_MHL_SII9234))
+		mhl_detect_register_notifier(&mhl_status_notifier);
+#endif
+	return platform_driver_register(&cable_detect_driver);
+
+}
+
+static void __exit cable_detect_exit(void)
+{
+	platform_driver_unregister(&cable_detect_driver);
+}
+
+MODULE_DESCRIPTION("CABLE_DETECT");
+MODULE_LICENSE("GPL");
+
+module_init(cable_detect_init);
+module_exit(cable_detect_exit);
diff --git a/drivers/misc/pm8xxx-vibrator-pwm.c b/drivers/misc/pm8xxx-vibrator-pwm.c
new file mode 100644
index 0000000..ce12bc9
--- /dev/null
+++ b/drivers/misc/pm8xxx-vibrator-pwm.c
@@ -0,0 +1,413 @@
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/mfd/pm8xxx/core.h>
+#include <linux/mfd/pm8xxx/pm8xxx-vibrator-pwm.h>
+#include <linux/pwm.h>
+#include "../staging/android/timed_output.h"
+#include <linux/gpio.h>
+
+#define VIB_PWM_DBG(fmt, ...) \
+		({ if (0) printk(KERN_DEBUG "[VIB_PWM]" fmt, ##__VA_ARGS__); })
+#define VIB_PWM_INFO(fmt, ...) \
+		printk(KERN_INFO "[VIB_PWM]" fmt, ##__VA_ARGS__)
+#define VIB_PWM_ERR(fmt, ...) \
+		printk(KERN_ERR "[VIB_PWM][ERR]" fmt, ##__VA_ARGS__)
+
+struct pm8xxx_vib_pwm {
+	struct hrtimer vib_timer;
+	struct timed_output_dev timed_dev;
+	struct pwm_device 		*pwm_vib;
+	spinlock_t lock;
+	struct work_struct work;
+	struct device *dev;
+	const struct pm8xxx_vibrator_pwm_platform_data *pdata;
+	int state;
+	int vdd_gpio;
+	int ena_gpio;
+	int pwm_gpio;
+	int (*set_vdd_power)(int en);
+};
+static int duty_us, period_us;
+static int switch_state = 1;
+static int pm8xxx_vib_set_on(struct pm8xxx_vib_pwm *vib)
+{
+	int rc = 0;
+
+	VIB_PWM_INFO("%s \n",__func__);
+
+
+		if (switch_state == 0){
+			VIB_PWM_INFO("%s vibrator is disable by switch\n",__func__);
+			return 0;
+		}
+		if (vib->vdd_gpio)
+			rc = gpio_direction_output(vib->vdd_gpio, ENABLE_AMP);
+		else if (vib->set_vdd_power != NULL)
+			rc= vib->set_vdd_power(ENABLE_AMP);
+		if (rc < 0) {
+			VIB_PWM_ERR("%s enable amp fail",__func__);
+			return -EINVAL;
+		}
+		rc = gpio_direction_output(vib->ena_gpio, ENABLE_AMP);
+		if (rc < 0) {
+			VIB_PWM_ERR("%s enable amp fail",__func__);
+			return -EINVAL;
+		}
+		if (vib->pwm_gpio) {
+
+			rc = gpio_direction_output(vib->pwm_gpio, 1);
+			if (rc < 0) {
+				VIB_PWM_ERR("%s enable pwm fail",__func__);
+				return -EINVAL;
+			}
+		} else {
+
+			rc = pwm_config(vib->pwm_vib, duty_us, period_us);
+			if (rc < 0) {
+				VIB_PWM_ERR("%s pwm config fail",__func__);
+				return -EINVAL;
+			}
+			rc = pwm_enable(vib->pwm_vib);
+			if (rc < 0) {
+				VIB_PWM_ERR("%s pwm enable fail",__func__);
+				return -EINVAL;
+			}
+		}
+	return rc;
+}
+
+static int pm8xxx_vib_set_off(struct pm8xxx_vib_pwm *vib)
+{
+	int rc = 0;
+	VIB_PWM_INFO("%s \n",__func__);
+
+		if (vib->pwm_gpio) {
+
+			rc = gpio_direction_output(vib->pwm_gpio, 0);
+			if (rc < 0) {
+				VIB_PWM_ERR("%s enable pwm fail",__func__);
+				return -EINVAL;
+			}
+		} else {
+
+			rc = pwm_config(vib->pwm_vib, period_us/2, period_us);
+			if (rc < 0) {
+				VIB_PWM_ERR("%s pwm config fail",__func__);
+				return -EINVAL;
+			}
+			rc = pwm_enable(vib->pwm_vib);
+			if (rc < 0) {
+				VIB_PWM_ERR("%s pwm enable fail",__func__);
+				return -EINVAL;
+			}
+		}
+		rc = gpio_direction_output(vib->ena_gpio, DISABLE_AMP);
+		if (rc < 0) {
+			VIB_PWM_ERR("%s disable amp fail",__func__);
+			return -EINVAL;
+		}
+		if (vib->vdd_gpio)
+			rc = gpio_direction_output(vib->vdd_gpio, DISABLE_AMP);
+		else if (vib->set_vdd_power!= NULL)
+			rc = vib->set_vdd_power(DISABLE_AMP);
+		if (rc < 0) {
+			VIB_PWM_ERR("%s disable amp fail",__func__);
+			return -EINVAL;
+		}
+		if (!vib->pwm_gpio)
+			pwm_disable(vib->pwm_vib);
+	return rc;
+}
+
+static void pm8xxx_vib_enable(struct timed_output_dev *dev, int value)
+{
+	struct pm8xxx_vib_pwm *vib = container_of(dev, struct pm8xxx_vib_pwm,
+					 timed_dev);
+	VIB_PWM_INFO("%s vibrate period: %d msec\n",__func__,value);
+
+retry:
+
+	if (hrtimer_try_to_cancel(&vib->vib_timer) < 0) {
+		cpu_relax();
+		goto retry;
+	}
+
+	if (value == 0)
+		pm8xxx_vib_set_off(vib);
+	else {
+		value = (value > vib->pdata->max_timeout_ms ?
+				 vib->pdata->max_timeout_ms : value);
+                pm8xxx_vib_set_on(vib);
+		hrtimer_start(&vib->vib_timer,
+			      ktime_set(value / 1000, (value % 1000) * 1000000),
+			      HRTIMER_MODE_REL);
+	}
+}
+
+static void pm8xxx_vib_update(struct work_struct *work)
+{
+	struct pm8xxx_vib_pwm *vib = container_of(work, struct pm8xxx_vib_pwm,
+					 work);
+	pm8xxx_vib_set_off(vib);
+}
+
+static int pm8xxx_vib_get_time(struct timed_output_dev *dev)
+{
+	struct pm8xxx_vib_pwm *vib = container_of(dev, struct pm8xxx_vib_pwm,
+							 timed_dev);
+	if (hrtimer_active(&vib->vib_timer)) {
+		ktime_t r = hrtimer_get_remaining(&vib->vib_timer);
+		return (int)ktime_to_us(r);
+	} else
+		return 0;
+}
+
+static enum hrtimer_restart pm8xxx_vib_timer_func(struct hrtimer *timer)
+{
+	int rc;
+	struct pm8xxx_vib_pwm *vib = container_of(timer, struct pm8xxx_vib_pwm,
+							 vib_timer);
+	VIB_PWM_INFO("%s \n",__func__);
+
+	rc = gpio_direction_output(vib->ena_gpio, DISABLE_AMP);
+	if (rc < 0) {
+		VIB_PWM_ERR("%s disable amp fail",__func__);
+	}
+	schedule_work(&vib->work);
+
+	return HRTIMER_NORESTART;
+}
+
+static ssize_t duty_show(struct device *dev, struct device_attribute *attr,
+		char *buf)
+{
+	return sprintf(buf, "duty_us:%d , duty_period:%d\n", duty_us,period_us);
+}
+
+static ssize_t duty_store(
+		struct device *dev, struct device_attribute *attr,
+		const char *buf, size_t size)
+{
+	int duty, duty_period;
+
+
+	duty = -1;
+	duty_period = -1;
+	sscanf(buf, "%d %d", &duty, &duty_period);
+	VIB_PWM_INFO("%s dutys input: duty:%d, duty_period:%d\n",__func__,duty,duty_period);
+	if (duty > duty_period || duty < 0){
+		VIB_PWM_INFO("%s dutys input fail, duty must between 0 and duty_period\n",__func__);
+		return -EINVAL;
+	}
+	if (duty_period > 62 || duty_period < 50){
+		VIB_PWM_INFO("%s dutys input fail, duty_period must between 50 to 62\n",__func__);
+		return -EINVAL;
+	}
+	duty_us = duty;
+	period_us = duty_period;
+	return size;
+}
+
+static DEVICE_ATTR(dutys, S_IRUGO | S_IWUSR, duty_show, duty_store);
+
+static ssize_t switch_show(struct device *dev, struct device_attribute *attr,
+		char *buf)
+{
+	return sprintf(buf, "switch status:%d \n", switch_state);
+}
+
+static ssize_t switch_store(
+		struct device *dev, struct device_attribute *attr,
+		const char *buf, size_t size)
+{
+	int switch_status;
+	switch_status = -1;
+	sscanf(buf, "%d ",&switch_status);
+	VIB_PWM_INFO("%s: %d\n",__func__,switch_status);
+	switch_state = switch_status;
+	return size;
+}
+
+static DEVICE_ATTR(function_switch, S_IRUGO | S_IWUSR, switch_show, switch_store);
+
+
+
+#ifdef CONFIG_PM
+static int pm8xxx_vib_suspend(struct device *dev)
+{
+	struct pm8xxx_vib_pwm *vib = dev_get_drvdata(dev);
+	VIB_PWM_INFO("%s \n",__func__);
+	hrtimer_cancel(&vib->vib_timer);
+	cancel_work_sync(&vib->work);
+	
+	pm8xxx_vib_set_off(vib);
+	if (vib->vdd_gpio)
+		gpio_direction_output(vib->vdd_gpio, DISABLE_VDD);
+	else if (vib->set_vdd_power != NULL)
+		vib->set_vdd_power(DISABLE_VDD);
+	return 0;
+}
+static int pm8xxx_vib_resume(struct device *dev)
+{
+	struct pm8xxx_vib_pwm *vib = dev_get_drvdata(dev);
+	VIB_PWM_INFO("%s \n",__func__);
+	if (vib->vdd_gpio)
+		gpio_direction_output(vib->vdd_gpio, ENABLE_VDD);
+	else if (vib->set_vdd_power != NULL)
+		vib->set_vdd_power(ENABLE_VDD);
+	return 0;
+}
+static const struct dev_pm_ops pm8xxx_vib_pm_ops = {
+	.suspend = pm8xxx_vib_suspend,
+	.resume = pm8xxx_vib_resume,
+};
+#endif
+
+static int __devinit pm8xxx_vib_probe(struct platform_device *pdev)
+
+{
+	const struct pm8xxx_vibrator_pwm_platform_data *pdata =
+						pdev->dev.platform_data;
+	struct pm8xxx_vib_pwm *vib;
+	int rc;
+	VIB_PWM_INFO("%s+\n", __func__);
+
+	if (!pdata)
+		return -EINVAL;
+	if (pdata->duty_us > pdata->PERIOD_US  ||
+			 pdata->duty_us < 0)
+		return -EINVAL;
+	vib = kzalloc(sizeof(*vib), GFP_KERNEL);
+	if (!vib)
+		return -ENOMEM;
+	vib->pdata	= pdata;
+	vib->vdd_gpio	= pdata->vdd_gpio;
+	vib->ena_gpio	= pdata->ena_gpio;
+	vib->pwm_gpio	= pdata->pwm_gpio;
+	vib->set_vdd_power = pdata->set_vdd_power;
+	vib->dev	= &pdev->dev;
+	spin_lock_init(&vib->lock);
+	INIT_WORK(&vib->work, pm8xxx_vib_update);
+	hrtimer_init(&vib->vib_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+	vib->vib_timer.function = pm8xxx_vib_timer_func;
+	vib->timed_dev.name = "vibrator";
+	vib->timed_dev.get_time = pm8xxx_vib_get_time;
+	vib->timed_dev.enable = pm8xxx_vib_enable;
+	if (vib->pdata->bank) {
+		vib->pwm_vib = pwm_request(vib->pdata->bank, vib->timed_dev.name);
+		if (vib->pwm_vib < 0){
+			rc = -ENOMEM;
+			VIB_PWM_ERR("%s, pwm_request fail\n", __func__);
+			goto err_pwm_request;
+		}
+	}
+	rc = gpio_request(vib->ena_gpio, "TI_AMP_ena");
+	if (rc) {
+		rc = -ENOMEM;
+		VIB_PWM_ERR("%s, gpio_request ena fail\n", __func__);
+		goto err_ena_gpio_request;
+	}
+	if (vib->vdd_gpio) {
+		rc= gpio_request(vib->vdd_gpio, "TI_AMP_vdd");
+		if(rc) {
+			rc = -ENOMEM;
+			VIB_PWM_ERR("%s, gpio_request vdd fail\n", __func__);
+			goto err_vdd_gpio_request;
+		}
+	}
+	if (vib->pwm_gpio) {
+		rc= gpio_request(vib->pwm_gpio, "VIB_PWM");
+		if(rc) {
+			rc = -ENOMEM;
+			VIB_PWM_ERR("%s, gpio_request pwm fail\n", __func__);
+			goto err_pwm_gpio_request;
+		}
+	}
+	rc = timed_output_dev_register(&vib->timed_dev);
+	if (rc < 0)
+		goto err_read_vib;
+	rc = device_create_file(vib->timed_dev.dev, &dev_attr_dutys);
+	if (rc < 0) {
+		VIB_PWM_ERR("%s, create duty sysfs fail: dutys\n", __func__);
+	}
+	rc = device_create_file(vib->timed_dev.dev, &dev_attr_function_switch);
+	if (rc < 0) {
+		VIB_PWM_ERR("%s, create duty sysfs fail: function_switch\n", __func__);
+	}
+
+	platform_set_drvdata(pdev, vib);
+	duty_us= vib->pdata->duty_us;
+	period_us=vib->pdata->PERIOD_US;
+	VIB_PWM_INFO("%s-\n", __func__);
+	return 0;
+err_pwm_gpio_request:
+	if (vib->pwm_gpio)
+		gpio_free(vib->pwm_gpio);
+err_vdd_gpio_request:
+	if (vib->vdd_gpio)
+		gpio_free(vib->vdd_gpio);
+err_ena_gpio_request:
+	gpio_free(vib->ena_gpio);
+err_pwm_request:
+	pwm_free(vib->pwm_vib);
+err_read_vib:
+	kfree(vib);
+	return rc;
+}
+
+static int __devexit pm8xxx_vib_remove(struct platform_device *pdev)
+{
+	struct pm8xxx_vib_pwm *vib = platform_get_drvdata(pdev);
+
+	cancel_work_sync(&vib->work);
+	hrtimer_cancel(&vib->vib_timer);
+	timed_output_dev_unregister(&vib->timed_dev);
+	platform_set_drvdata(pdev, NULL);
+	kfree(vib);
+
+	return 0;
+}
+
+static struct platform_driver pm8xxx_vib_driver = {
+	.probe		= pm8xxx_vib_probe,
+	.remove		= __devexit_p(pm8xxx_vib_remove),
+	.driver		= {
+		.name	= PM8XXX_VIBRATOR_PWM_DEV_NAME,
+		.owner	= THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm	= &pm8xxx_vib_pm_ops,
+#endif
+	},
+};
+static int __init pm8xxx_vib_init(void)
+{
+	return platform_driver_register(&pm8xxx_vib_driver);
+}
+module_init(pm8xxx_vib_init);
+
+static void __exit pm8xxx_vib_exit(void)
+{
+	platform_driver_unregister(&pm8xxx_vib_driver);
+}
+module_exit(pm8xxx_vib_exit);
+
+MODULE_ALIAS("platform:" PM8XXX_VIBRATOR_PWM_DEV_NAME);
+MODULE_DESCRIPTION("pm8xxx vibrator pwm driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/misc/pn544.c b/drivers/misc/pn544.c
new file mode 100644
index 0000000..851cad7
--- /dev/null
+++ b/drivers/misc/pn544.c
@@ -0,0 +1,793 @@
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/list.h>
+#include <linux/i2c.h>
+#include <linux/irq.h>
+#include <linux/jiffies.h>
+#include <linux/uaccess.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <linux/gpio.h>
+#include <linux/miscdevice.h>
+#include <linux/spinlock.h>
+#include <linux/wakelock.h>
+#include <linux/pn544.h>
+#include <mach/board_htc.h>
+
+int is_debug = 0;
+
+#define DBUF(buff,count) \
+	if (is_debug) \
+		for (i = 0; i < count; i++) \
+			printk(KERN_DEBUG "[NFC] %s : [%d] = 0x%x\n", \
+				__func__, i, buff[i]);
+
+#define D(x...)	\
+	if (is_debug)	\
+		printk(KERN_DEBUG "[NFC] " x)
+#define I(x...) printk(KERN_INFO "[NFC] " x)
+#define E(x...) printk(KERN_ERR "[NFC] [Err] " x)
+
+#define MAX_BUFFER_SIZE	512
+#define PN544_RESET_CMD 	0
+#define PN544_DOWNLOAD_CMD	1
+
+#define I2C_RETRY_COUNT 10
+
+struct pn544_dev	{
+	struct class		*pn544_class;
+	struct device		*pn_dev;
+	wait_queue_head_t	read_wq;
+	struct mutex		read_mutex;
+	struct wake_lock io_wake_lock;
+	struct i2c_client	*client;
+	struct miscdevice	pn544_device;
+	unsigned int		irq_gpio;
+	bool			irq_enabled;
+	spinlock_t		irq_enabled_lock;
+	unsigned int 		ven_gpio;
+	unsigned int		ven_value;
+	unsigned int 		firm_gpio;
+	void (*gpio_init) (void);
+	unsigned int 		ven_enable;
+	int boot_mode;
+};
+
+struct pn544_dev *pn_info;
+int ignoreI2C = 0;
+
+static int pn544_RxData(uint8_t *rxData, int length)
+{
+	uint8_t loop_i;
+	struct pn544_dev *pni = pn_info;
+
+	struct i2c_msg msg[] = {
+		{
+		 .addr = pni->client->addr,
+		 .flags = I2C_M_RD,
+		 .len = length,
+		 .buf = rxData,
+		 },
+	};
+
+	D("%s: [addr=%x flag=%x len=%x]\n", __func__,
+		msg[0].addr, msg[0].flags, msg[0].len);
+
+	if (ignoreI2C) {
+		I("ignore pn544_RxData %d\n", ignoreI2C);
+		return 0;
+	}
+
+	rxData[0] = 0;
+
+	for (loop_i = 0; loop_i < I2C_RETRY_COUNT; loop_i++) {
+		D("%s: retry %d ........\n", __func__, loop_i);
+		if (i2c_transfer(pni->client->adapter, msg, 1) > 0)
+			break;
+
+		mdelay(10);
+	}
+
+	if (loop_i >= I2C_RETRY_COUNT) {
+		E("%s Error: retry over %d\n", __func__,
+			I2C_RETRY_COUNT);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int pn544_TxData(uint8_t *txData, int length)
+{
+	uint8_t loop_i;
+	struct pn544_dev *pni = pn_info;
+	struct i2c_msg msg[] = {
+		{
+		 .addr = pni->client->addr,
+		 .flags = 0,
+		 .len = length,
+		 .buf = txData,
+		 },
+	};
+
+	D("%s: [addr=%x flag=%x len=%x]\n", __func__,
+		msg[0].addr, msg[0].flags, msg[0].len);
+
+	if (ignoreI2C) {
+		I("ignore pn544_TxData %d\n", ignoreI2C);
+		return 0;
+	}
+
+	for (loop_i = 0; loop_i < I2C_RETRY_COUNT; loop_i++) {
+		D("%s: retry %d ........\n", __func__, loop_i);
+		if (i2c_transfer(pni->client->adapter, msg, 1) > 0)
+			break;
+
+		msleep(10);
+	}
+
+	if (loop_i >= I2C_RETRY_COUNT) {
+		E("%s:  Error: retry over %d\n",
+			__func__, I2C_RETRY_COUNT);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static void pn544_disable_irq(struct pn544_dev *pn544_dev)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&pn544_dev->irq_enabled_lock, flags);
+	if (pn544_dev->irq_enabled) {
+		disable_irq_nosync(pn544_dev->client->irq);
+		pn544_dev->irq_enabled = false;
+	}
+	spin_unlock_irqrestore(&pn544_dev->irq_enabled_lock, flags);
+}
+
+static irqreturn_t pn544_dev_irq_handler(int irq, void *dev_id)
+{
+	struct pn544_dev *pn544_dev = dev_id;
+
+	pn544_disable_irq(pn544_dev);
+
+	
+	wake_up(&pn544_dev->read_wq);
+
+	return IRQ_HANDLED;
+}
+
+static void pn544_Enable(void)
+{
+	struct pn544_dev *pni = pn_info;
+	unsigned int set_value = pni->ven_enable;
+	I("%s: gpio=%d set_value=%d\n", __func__, pni->ven_gpio, set_value);
+
+	gpio_set_value(pni->ven_gpio, set_value);
+	pni->ven_value = 1;
+}
+
+static void pn544_Disable(void)
+{
+	struct pn544_dev *pni = pn_info;
+	unsigned int set_value = !pni->ven_enable;
+	I("%s: gpio=%d set_value=%d\n", __func__, pni->ven_gpio, set_value);
+
+	gpio_set_value(pni->ven_gpio, set_value);
+	pni->ven_value = 0;
+}
+
+
+static int pn544_isEn(void)
+{
+	struct pn544_dev *pni = pn_info;
+	
+	return pni->ven_value;
+}
+uint8_t read_buffer[MAX_BUFFER_SIZE];
+
+static ssize_t pn544_dev_read(struct file *filp, char __user *buf,
+		size_t count, loff_t *offset)
+{
+	struct pn544_dev *pni = pn_info;
+	int ret;
+	int val;
+	int i;
+	i = 0;
+
+	D("%s: start count = %u\n", __func__, count);
+
+	if (count > MAX_BUFFER_SIZE) {
+		E("%s : count =%d> MAX_BUFFER_SIZE\n", __func__, count);
+		count = MAX_BUFFER_SIZE;
+	}
+
+	val = gpio_get_value(pni->irq_gpio);
+
+	D("%s: reading %zu bytes, irq_gpio = %d\n",
+		__func__, count, val);
+
+	mutex_lock(&pni->read_mutex);
+
+	if (!gpio_get_value(pni->irq_gpio)) {
+		if (filp->f_flags & O_NONBLOCK) {
+			I("%s : f_flags & O_NONBLOCK read again\n", __func__);
+			ret = -EAGAIN;
+			goto fail;
+		}
+
+		pni->irq_enabled = true;
+		enable_irq(pni->client->irq);
+		D("%s: waiting read-event INT, because "
+			"irq_gpio = 0\n", __func__);
+		ret = wait_event_interruptible(pni->read_wq,
+				gpio_get_value(pni->irq_gpio));
+
+		pn544_disable_irq(pni);
+
+		D("%s : wait_event_interruptible done\n", __func__);
+
+		if (ret) {
+			I("pn544_dev_read wait_event_interruptible breaked ret=%d\n", ret);
+			goto fail;
+		}
+
+	}
+
+    wake_lock_timeout(&pni ->io_wake_lock, IO_WAKE_LOCK_TIMEOUT);
+	
+	memset(read_buffer, 0, MAX_BUFFER_SIZE);
+	ret = pn544_RxData(read_buffer, count);
+	mutex_unlock(&pni->read_mutex);
+
+	if (ret < 0) {
+		E("%s: i2c_master_recv returned %d\n", __func__, ret);
+		return ret;
+	}
+	if (ret > count) {
+		E("%s: received too many bytes from i2c (%d)\n",
+			__func__, ret);
+		return -EIO;
+	}
+
+	DBUF(read_buffer, count);
+
+	if (copy_to_user(buf, read_buffer, count)) {
+		E("%s : failed to copy to user space\n", __func__);
+		return -EFAULT;
+	}
+
+	D("%s done count = %u\n", __func__, count);
+	return count;
+
+fail:
+	mutex_unlock(&pni->read_mutex);
+	return ret;
+}
+
+static ssize_t pn544_dev_write(struct file *filp, const char __user *buf,
+		size_t count, loff_t *offset)
+{
+	struct pn544_dev *pni = pn_info;
+	char buffer[MAX_BUFFER_SIZE];
+	int ret;
+	int i;
+	i = 0;
+
+	D("%s: start count = %u\n", __func__, count);
+	wake_lock_timeout(&pni ->io_wake_lock, IO_WAKE_LOCK_TIMEOUT);
+
+	if (count > MAX_BUFFER_SIZE) {
+		E("%s : count =%d> MAX_BUFFER_SIZE\n", __func__, count);
+		count = MAX_BUFFER_SIZE;
+	}
+
+	D("%s : writing %zu bytes\n", __func__, count);
+
+	if (copy_from_user(buffer, buf, count)) {
+		E("%s : failed to copy from user space\n", __func__);
+		return -EFAULT;
+	}
+
+	DBUF(buffer, count);
+
+	
+	ret = pn544_TxData(buffer, count);
+	if (ret < 0) {
+		E("%s : i2c_master_send returned %d\n", __func__, ret);
+		ret = -EIO;
+	} else {
+		D("%s done count = %u\n", __func__, count);
+		return count;
+	}
+
+	return ret;
+}
+
+static int pn544_dev_open(struct inode *inode, struct file *filp)
+{
+	struct pn544_dev *pn544_dev = container_of(filp->private_data,
+						struct pn544_dev,
+						pn544_device);
+
+	filp->private_data = pn544_dev;
+	I("%s : major=%d, minor=%d\n", \
+		__func__, imajor(inode), iminor(inode));
+
+	return 0;
+}
+
+static long pn544_dev_ioctl(struct file *filp,
+		unsigned int cmd, unsigned long arg)
+{
+	struct pn544_dev *pni = pn_info;
+	uint8_t buffer[] = {0x05, 0xF9, 0x04, 0x00, 0xC3, 0xE5};
+
+	switch (cmd) {
+	case PN544_SET_PWR:
+		if (arg == 3) {
+			
+			I("%s Software reset\n", __func__);
+			if (pn544_TxData(buffer, 6) < 0)
+				E("%s, SW-Reset TxData error!\n", __func__);
+		} else if (arg == 2) {
+			I("%s power on with firmware\n", __func__);
+			pn544_Enable();
+			gpio_set_value(pni->firm_gpio, 1);
+			msleep(50);
+			pn544_Disable();
+			msleep(50);
+			pn544_Enable();
+			msleep(50);
+		} else if (arg == 1) {
+			
+			I("%s power on (delay50)\n", __func__);
+			gpio_set_value(pni->firm_gpio, 0);
+			pn544_Enable();
+			msleep(50);
+		} else  if (arg == 0) {
+			
+			I("%s power off (delay50)\n", __func__);
+			gpio_set_value(pni->firm_gpio, 0);
+			pn544_Disable();
+			msleep(50);
+		} else {
+			E("%s bad arg %lu\n", __func__, arg);
+			goto fail;
+		}
+		break;
+	default:
+		E("%s bad ioctl %u\n", __func__, cmd);
+		goto fail;
+	}
+
+	return 0;
+fail:
+	return -EINVAL;
+}
+
+static const struct file_operations pn544_dev_fops = {
+	.owner	= THIS_MODULE,
+	.llseek	= no_llseek,
+	.read	= pn544_dev_read,
+	.write	= pn544_dev_write,
+	.open	= pn544_dev_open,
+	.unlocked_ioctl  = pn544_dev_ioctl,
+};
+
+static ssize_t pn_temp1_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	int val = -1;
+	struct pn544_dev *pni = pn_info;
+	uint8_t buffer[MAX_BUFFER_SIZE];
+	int i = 0;
+
+	I("%s:\n", __func__);
+	val = gpio_get_value(pni->irq_gpio);
+
+	memset(buffer, 0, MAX_BUFFER_SIZE);
+#if 1
+	if (val == 1) {
+		ret = pn544_RxData(buffer, 33);
+		if (ret < 0) {
+			E("%s, i2c Rx error!\n", __func__);
+		} else {
+			for (i = 0; i < 10; i++)
+			I("%s : [%d] = 0x%x\n", __func__, i, buffer[i]);
+		}
+	} else {
+		E("%s, data not ready\n", __func__);
+	}
+#else
+	if (val != 1)
+		E("%s, ####### data not ready -> force to read!#########\n", __func__);
+
+	ret = pn544_RxData(buffer, 33);
+	if (ret < 0) {
+		E("%s, i2c Rx error!\n", __func__);
+	} else {
+		for (i = 0; i < 10; i++)
+		D("%s : [%d] = 0x%x\n", __func__, i, buffer[i]);
+	}
+#endif
+
+	ret = sprintf(buf, "GPIO INT = %d "
+		"Rx:ret=%d [0x%x, 0x%x, 0x%x, 0x%x]\n", val, ret, buffer[0], buffer[1],
+		buffer[2], buffer[3]);
+
+	return ret;
+}
+
+
+#define i2cw_size (20)
+static ssize_t pn_temp1_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	int code = -1;
+	int ret = -1;
+	struct pn544_dev *pni = pn_info;
+	uint8_t buffer[] = {0x05, 0xF9, 0x04, 0x00, 0xC3, 0xE5};
+	
+	uint8_t i2cw[i2cw_size];
+	uint32_t scan_data = 0;
+	int i2cw_len = 0;
+	int i = 0;
+	char *ptr;
+
+	sscanf(buf, "%d", &code);
+
+	I("%s: irq = %d,  ven_gpio = %d,  firm_gpio = %d +\n", __func__, \
+		gpio_get_value(pni->irq_gpio), pn544_isEn(), \
+		gpio_get_value(pni->firm_gpio));
+	I("%s: store value = %d\n", __func__, code);
+
+	switch (code) {
+	case 1:
+			I("%s: case 1\n", __func__);
+			ret = pn544_TxData(buffer, 6);
+			if (ret < 0)
+				E("%s, i2c Tx error!\n", __func__);
+			break;
+	case 2:
+			I("%s: case 2 %d\n", __func__, pni->ven_gpio);
+			pn544_Disable();
+			break;
+	case 3:
+			I("%s: case 3 %d\n", __func__, pni->ven_gpio);
+			pn544_Enable();
+			break;
+	case 4:
+			I("%s: case 4 %d\n", __func__, pni->firm_gpio);
+			gpio_set_value(pni->firm_gpio, 0);
+			break;
+	case 5:
+			I("%s: case 5 %d\n", __func__, pni->firm_gpio);
+			gpio_set_value(pni->firm_gpio, 1);
+			break;
+	case 6:
+			memset(i2cw, 0, i2cw_size);
+			sscanf(buf, "%d %d", &code, &i2cw_len);
+			I("%s: case 6 i2cw_len=%u\n", __func__, i2cw_len);
+
+			ptr = strpbrk(buf, " ");	
+			if (ptr != NULL) {
+				for (i = 0 ; i <= i2cw_len ; i++) {
+					sscanf(ptr, "%x", &scan_data);
+					i2cw[i] = (uint8_t)scan_data;
+					I("%s: i2cw[%d]=%x\n", \
+						__func__, i, i2cw[i]);
+					ptr = strpbrk(++ptr, " ");
+					if (ptr == NULL)
+						break;
+				}
+
+				ret = pn544_TxData(i2cw, i2cw_len+1);
+				
+
+				if (ret < 0)
+					E("%s, i2c Tx error!\n", __func__);
+			} else {
+				I("%s: skip no data found\n", __func__);
+			}
+			break;
+	case 7:
+			I("%s: case 7 disable i2c\n", __func__);
+			ignoreI2C = 1;
+			break;
+	case 8:
+			I("%s: case 8 enable i2c\n", __func__);
+			ignoreI2C = 0;
+			break;
+	default:
+			E("%s: case default\n", __func__);
+			break;
+	}
+
+	I("%s: irq = %d,  ven_gpio = %d,  firm_gpio = %d -\n", __func__, \
+		gpio_get_value(pni->irq_gpio), pn544_isEn(), gpio_get_value(pni->firm_gpio));
+	return count;
+}
+
+static DEVICE_ATTR(pn_temp1, 0664, pn_temp1_show, pn_temp1_store);
+
+
+static ssize_t debug_enable_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
+{
+	int ret = 0;
+	I("debug_enable_show\n");
+
+	ret = sprintf(buf, "is_debug=%d\n", is_debug);
+	return ret;
+}
+
+static ssize_t debug_enable_store(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	sscanf(buf, "%d", &is_debug);
+	return count;
+}
+
+static DEVICE_ATTR(debug_enable, 0664, debug_enable_show, debug_enable_store);
+
+static int pn544_probe(struct i2c_client *client,
+		const struct i2c_device_id *id)
+{
+	int ret;
+	struct pn544_i2c_platform_data *platform_data;
+	struct pn544_dev *pni;
+
+	I("%s:\n", __func__);
+
+	platform_data = client->dev.platform_data;
+
+	if (platform_data == NULL) {
+		E("%s : nfc probe fail because platform_data \
+			is NULL\n", __func__);
+		return  -ENODEV;
+	}
+
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		E("%s : need I2C_FUNC_I2C\n", __func__);
+		return  -ENODEV;
+	}
+
+	
+	ret = gpio_request(platform_data->irq_gpio, "nfc_int");
+	if (ret) {
+		E("%s : request gpio%d fail\n",
+			__func__, platform_data->irq_gpio);
+		ret = -ENODEV;
+		goto err_exit;
+	}
+
+	
+	ret = gpio_request(platform_data->ven_gpio, "nfc_en");
+	if (ret) {
+		E("%s : request gpio %d fail\n",
+			__func__, platform_data->ven_gpio);
+		ret = -ENODEV;
+		goto err_request_gpio_ven;
+	}
+	
+
+	ret = gpio_request(platform_data->firm_gpio, "nfc_firm");
+	if (ret) {
+		E("%s : request gpio %d fail\n",
+			__func__, platform_data->firm_gpio);
+		ret = -ENODEV;
+		goto err_request_gpio_firm;
+	}
+
+	pni = kzalloc(sizeof(struct pn544_dev), GFP_KERNEL);
+	if (pni == NULL) {
+		dev_err(&client->dev, \
+				"pn544_probe : failed to allocate \
+				memory for module data\n");
+		ret = -ENOMEM;
+		goto err_exit;
+	}
+
+	pn_info = pni;
+
+	if (platform_data->gpio_init != NULL) {
+		I("%s: gpio_init\n", __func__);
+		platform_data->gpio_init();
+	}
+
+	pni->irq_gpio = platform_data->irq_gpio;
+	pni->ven_gpio  = platform_data->ven_gpio;
+	pni->firm_gpio  = platform_data->firm_gpio;
+	pni->client   = client;
+	pni->gpio_init = platform_data->gpio_init;
+	pni->ven_enable = !platform_data->ven_isinvert;
+	pni->boot_mode = board_mfg_mode();
+
+	
+
+	
+	init_waitqueue_head(&pni->read_wq);
+	mutex_init(&pni->read_mutex);
+	spin_lock_init(&pni->irq_enabled_lock);
+
+	I("%s: init io_wake_lock\n", __func__);
+	wake_lock_init(&pni->io_wake_lock, WAKE_LOCK_SUSPEND, PN544_I2C_NAME);
+
+	pni->pn544_device.minor = MISC_DYNAMIC_MINOR;
+	pni->pn544_device.name = "pn544";
+	pni->pn544_device.fops = &pn544_dev_fops;
+
+#if 1
+	ret = misc_register(&pni->pn544_device);
+#else
+	ret = 0;
+#endif
+	if (ret) {
+		E("%s : misc_register failed\n", __FILE__);
+		goto err_misc_register;
+	}
+
+
+	I("%s : requesting IRQ %d\n", __func__, client->irq);
+	pni->irq_enabled = true;
+	ret = request_irq(client->irq, pn544_dev_irq_handler,
+			  IRQF_TRIGGER_HIGH, client->name, pni);
+	if (ret) {
+		dev_err(&client->dev, "pn544_probe : request_irq failed\n");
+		goto err_request_irq_failed;
+	}
+	pn544_disable_irq(pni);
+	i2c_set_clientdata(client, pni);
+
+	pni->pn544_class = class_create(THIS_MODULE, "NFC_sensor");
+	if (IS_ERR(pni->pn544_class)) {
+		ret = PTR_ERR(pni->pn544_class);
+		pni->pn544_class = NULL;
+		E("%s : class_create failed\n", __func__);
+		goto err_create_class;
+	}
+
+	pni->pn_dev = device_create(pni->pn544_class, NULL, 0, "%s", "pn544");
+	if (unlikely(IS_ERR(pni->pn_dev))) {
+		ret = PTR_ERR(pni->pn_dev);
+		pni->pn_dev = NULL;
+		E("%s : device_create failed\n", __func__);
+		goto err_create_pn_device;
+	}
+
+	
+	ret = device_create_file(pni->pn_dev, &dev_attr_pn_temp1);
+	if (ret) {
+		E("%s : device_create_file dev_attr_pn_temp1 failed\n", __func__);
+		goto err_create_pn_file;
+	}
+
+	ret = device_create_file(pni->pn_dev, &dev_attr_debug_enable);
+	if (ret) {
+		E("pn544_probe device_create_file dev_attr_debug_enable failed\n");
+		goto err_create_pn_file;
+	}
+
+	
+	if (pni->boot_mode != 5) {
+		I("%s: disable NFC by default (bootmode = %d)\n", __func__, pni->boot_mode);
+		pn544_Disable();
+	}
+
+	I("%s: Probe success!\n", __func__);
+	return 0;
+
+err_create_pn_file:
+	device_unregister(pni->pn_dev);
+err_create_pn_device:
+	class_destroy(pni->pn544_class);
+err_create_class:
+err_request_irq_failed:
+	misc_deregister(&pni->pn544_device);
+err_misc_register:
+	mutex_destroy(&pni->read_mutex);
+	wake_lock_destroy(&pni->io_wake_lock);
+	kfree(pni);
+	pn_info = NULL;
+	gpio_free(platform_data->firm_gpio);
+err_request_gpio_firm:
+	gpio_free(platform_data->ven_gpio);
+err_request_gpio_ven:
+	gpio_free(platform_data->irq_gpio);
+err_exit:
+	E("%s: prob fail\n", __func__);
+	return ret;
+}
+
+static int pn544_remove(struct i2c_client *client)
+{
+	struct pn544_dev *pn544_dev;
+	I("%s:\n", __func__);
+
+	pn544_dev = i2c_get_clientdata(client);
+	free_irq(client->irq, pn544_dev);
+	misc_deregister(&pn544_dev->pn544_device);
+	mutex_destroy(&pn544_dev->read_mutex);
+	wake_lock_destroy(&pn544_dev->io_wake_lock);
+	gpio_free(pn544_dev->irq_gpio);
+	gpio_free(pn544_dev->ven_gpio);
+	gpio_free(pn544_dev->firm_gpio);
+	kfree(pn544_dev);
+	pn_info = NULL;
+
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int pn544_suspend(struct i2c_client *client, pm_message_t state)
+{
+	struct pn544_dev *pni = pn_info;
+
+	if (pni->ven_value) {
+		pni->irq_enabled = true;
+		enable_irq(pni->client->irq);
+		irq_set_irq_wake(pni->client->irq, 1);
+	}
+	return 0;
+}
+
+static int pn544_resume(struct i2c_client *client)
+{
+	struct pn544_dev *pni = pn_info;
+
+	if (pni->ven_value) {
+		pn544_disable_irq(pni);
+		irq_set_irq_wake(pni->client->irq, 0);
+	}
+	return 0;
+}
+#endif
+
+static const struct i2c_device_id pn544_id[] = {
+	{ "pn544", 0 },
+	{ }
+};
+
+static struct i2c_driver pn544_driver = {
+	.id_table	= pn544_id,
+	.probe		= pn544_probe,
+	.remove		= pn544_remove,
+	.driver		= {
+		.owner	= THIS_MODULE,
+		.name	= "pn544",
+	},
+#if CONFIG_PM
+	.suspend	= pn544_suspend,
+	.resume		= pn544_resume,
+#endif
+};
+
+
+static int __init pn544_dev_init(void)
+{
+	I("%s: Loading pn544 driver\n", __func__);
+	return i2c_add_driver(&pn544_driver);
+}
+module_init(pn544_dev_init);
+
+static void __exit pn544_dev_exit(void)
+{
+	I("%s: Unloading pn544 driver\n", __func__);
+	i2c_del_driver(&pn544_driver);
+}
+module_exit(pn544_dev_exit);
+
+MODULE_AUTHOR("Sylvain Fonteneau");
+MODULE_DESCRIPTION("NFC PN544 driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index c874be0..3258467 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2056,10 +2056,11 @@
 	struct mmc_card *card = md->queue.card;
 
 #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME
+	mmc_claim_host(card->host);
 	if (mmc_bus_needs_resume(card->host)) {
 		mmc_resume_bus(card->host);
-		mmc_blk_set_blksize(md, card);
 	}
+	mmc_release_host(card->host);
 #endif
 
 	if (req && !mq->mqrq_prev->req) {
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c
index 2c14be7..f13e38d 100644
--- a/drivers/mmc/core/cd-gpio.c
+++ b/drivers/mmc/core/cd-gpio.c
@@ -73,6 +73,9 @@
 {
 	struct mmc_cd_gpio *cd = host->hotplug.handler_priv;
 
+	if (!cd)
+		return;
+
 	free_irq(host->hotplug.irq, host);
 	gpio_free(cd->gpio);
 	kfree(cd);
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 1c4697d..d61271f 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1971,7 +1971,7 @@
 		ret = request_threaded_irq(mmc_slot(host).card_detect_irq,
 					   NULL,
 					   omap_hsmmc_detect,
-					   IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+					   IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
 					   mmc_hostname(mmc), host);
 		if (ret) {
 			dev_dbg(mmc_dev(host->mmc),
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index b34b069..017da11 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -157,6 +157,7 @@
 static const struct sdhci_pci_fixes sdhci_cafe = {
 	.quirks		= SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
 			  SDHCI_QUIRK_NO_BUSY_IRQ |
+			  SDHCI_QUIRK_BROKEN_CARD_DETECTION |
 			  SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
 };
 
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 04796af..f2c5815 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -128,7 +128,7 @@
 
 config MTD_OF_PARTS
 	tristate "OpenFirmware partitioning information support"
-	default Y
+	default y
 	depends on OF
 	help
 	  This provides a partition parsing function which derives
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index a4a80b7..7d7000d 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -271,7 +271,6 @@
 	dev->mtd.flags = MTD_CAP_RAM;
 	dev->mtd._erase = block2mtd_erase;
 	dev->mtd._write = block2mtd_write;
-	dev->mtd._writev = mtd_writev;
 	dev->mtd._sync = block2mtd_sync;
 	dev->mtd._read = block2mtd_read;
 	dev->mtd.priv = dev;
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index 2a96e1a..6d22755 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -102,7 +102,7 @@
 static int cafe_device_ready(struct mtd_info *mtd)
 {
 	struct cafe_priv *cafe = mtd->priv;
-	int result = !!(cafe_readl(cafe, NAND_STATUS) | 0x40000000);
+	int result = !!(cafe_readl(cafe, NAND_STATUS) & 0x40000000);
 	uint32_t irqs = cafe_readl(cafe, NAND_IRQ);
 
 	cafe_writel(cafe, irqs, NAND_IRQ);
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index cc0678a..6f87c74 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1219,12 +1219,6 @@
 	if (nfc_is_v21() && mtd->writesize == 4096)
 		this->ecc.layout = &nandv2_hw_eccoob_4k;
 
-	/* second phase scan */
-	if (nand_scan_tail(mtd)) {
-		err = -ENXIO;
-		goto escan;
-	}
-
 	if (this->ecc.mode == NAND_ECC_HW) {
 		if (nfc_is_v1())
 			this->ecc.strength = 1;
@@ -1232,6 +1226,12 @@
 			this->ecc.strength = (host->eccsize == 4) ? 4 : 8;
 	}
 
+	/* second phase scan */
+	if (nand_scan_tail(mtd)) {
+		err = -ENXIO;
+		goto escan;
+	}
+
 	/* Register the partitions */
 	mtd_device_parse_register(mtd, part_probes, NULL, pdata->parts,
 				  pdata->nr_parts);
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 20a112f..30d1319 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -324,6 +324,7 @@
 
 		buf += mtd->oobsize + mtd->writesize;
 		len -= mtd->writesize;
+		offs += mtd->writesize;
 	}
 	return 0;
 }
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 261f478..c606b6a 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -28,7 +28,7 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/vmalloc.h>
-#include <asm/div64.h>
+#include <linux/math64.h>
 #include <linux/slab.h>
 #include <linux/errno.h>
 #include <linux/string.h>
@@ -547,12 +547,6 @@
 	return kstrdup(buf, GFP_KERNEL);
 }
 
-static uint64_t divide(uint64_t n, uint32_t d)
-{
-	do_div(n, d);
-	return n;
-}
-
 /*
  * Initialize the nandsim structure.
  *
@@ -581,7 +575,7 @@
 	ns->geom.oobsz    = mtd->oobsize;
 	ns->geom.secsz    = mtd->erasesize;
 	ns->geom.pgszoob  = ns->geom.pgsz + ns->geom.oobsz;
-	ns->geom.pgnum    = divide(ns->geom.totsz, ns->geom.pgsz);
+	ns->geom.pgnum    = div_u64(ns->geom.totsz, ns->geom.pgsz);
 	ns->geom.totszoob = ns->geom.totsz + (uint64_t)ns->geom.pgnum * ns->geom.oobsz;
 	ns->geom.secshift = ffs(ns->geom.secsz) - 1;
 	ns->geom.pgshift  = chip->page_shift;
@@ -924,7 +918,7 @@
 
 	if (!rptwear)
 		return 0;
-	wear_eb_count = divide(mtd->size, mtd->erasesize);
+	wear_eb_count = div_u64(mtd->size, mtd->erasesize);
 	mem = wear_eb_count * sizeof(unsigned long);
 	if (mem / sizeof(unsigned long) != wear_eb_count) {
 		NS_ERR("Too many erase blocks for wear reporting\n");
diff --git a/drivers/net/bonding/bond_debugfs.c b/drivers/net/bonding/bond_debugfs.c
index 3680aa2..2cf084e 100644
--- a/drivers/net/bonding/bond_debugfs.c
+++ b/drivers/net/bonding/bond_debugfs.c
@@ -6,7 +6,7 @@
 #include "bonding.h"
 #include "bond_alb.h"
 
-#ifdef CONFIG_DEBUG_FS
+#if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_NET_NS)
 
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index bc13b3d..318a62a 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -76,6 +76,7 @@
 #include <net/route.h>
 #include <net/net_namespace.h>
 #include <net/netns/generic.h>
+#include <net/pkt_sched.h>
 #include "bonding.h"
 #include "bond_3ad.h"
 #include "bond_alb.h"
@@ -381,8 +382,6 @@
 	return next;
 }
 
-#define bond_queue_mapping(skb) (*(u16 *)((skb)->cb))
-
 /**
  * bond_dev_queue_xmit - Prepare skb for xmit.
  *
@@ -395,7 +394,9 @@
 {
 	skb->dev = slave_dev;
 
-	skb->queue_mapping = bond_queue_mapping(skb);
+	BUILD_BUG_ON(sizeof(skb->queue_mapping) !=
+		     sizeof(qdisc_skb_cb(skb)->bond_queue_mapping));
+	skb->queue_mapping = qdisc_skb_cb(skb)->bond_queue_mapping;
 
 	if (unlikely(netpoll_tx_running(slave_dev)))
 		bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb);
@@ -3217,6 +3218,12 @@
 	switch (event) {
 	case NETDEV_CHANGENAME:
 		return bond_event_changename(event_bond);
+	case NETDEV_UNREGISTER:
+		bond_remove_proc_entry(event_bond);
+		break;
+	case NETDEV_REGISTER:
+		bond_create_proc_entry(event_bond);
+		break;
 	default:
 		break;
 	}
@@ -4162,7 +4169,7 @@
 	/*
 	 * Save the original txq to restore before passing to the driver
 	 */
-	bond_queue_mapping(skb) = skb->queue_mapping;
+	qdisc_skb_cb(skb)->bond_queue_mapping = skb->queue_mapping;
 
 	if (unlikely(txq >= dev->real_num_tx_queues)) {
 		do {
@@ -4401,8 +4408,6 @@
 
 	bond_work_cancel_all(bond);
 
-	bond_remove_proc_entry(bond);
-
 	bond_debug_unregister(bond);
 
 	__hw_addr_flush(&bond->mc_list);
@@ -4804,7 +4809,6 @@
 
 	bond_set_lockdep_class(bond_dev);
 
-	bond_create_proc_entry(bond);
 	list_add_tail(&bond->bond_list, &bn->dev_list);
 
 	bond_prepare_sysfs_group(bond);
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
index 8a3054b..5de74e7 100644
--- a/drivers/net/caif/caif_serial.c
+++ b/drivers/net/caif/caif_serial.c
@@ -325,6 +325,9 @@
 
 	sprintf(name, "cf%s", tty->name);
 	dev = alloc_netdev(sizeof(*ser), name, caifdev_setup);
+	if (!dev)
+		return -ENOMEM;
+
 	ser = netdev_priv(dev);
 	ser->tty = tty_kref_get(tty);
 	ser->dev = dev;
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 536bda0..86cd532 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -590,8 +590,8 @@
 	priv->write_reg(priv, &priv->regs->control,
 			CONTROL_ENABLE_AR);
 
-	if (priv->can.ctrlmode & (CAN_CTRLMODE_LISTENONLY &
-					CAN_CTRLMODE_LOOPBACK)) {
+	if ((priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) &&
+	    (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)) {
 		/* loopback + silent mode : useful for hot self-test */
 		priv->write_reg(priv, &priv->regs->control, CONTROL_EIE |
 				CONTROL_SIE | CONTROL_IE | CONTROL_TEST);
@@ -686,7 +686,7 @@
  *
  * We iterate from priv->tx_echo to priv->tx_next and check if the
  * packet has been transmitted, echo it back to the CAN framework.
- * If we discover a not yet transmitted package, stop looking for more.
+ * If we discover a not yet transmitted packet, stop looking for more.
  */
 static void c_can_do_tx(struct net_device *dev)
 {
@@ -698,7 +698,7 @@
 	for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) {
 		msg_obj_no = get_tx_echo_msg_obj(priv);
 		val = c_can_read_reg32(priv, &priv->regs->txrqst1);
-		if (!(val & (1 << msg_obj_no))) {
+		if (!(val & (1 << (msg_obj_no - 1)))) {
 			can_get_echo_skb(dev,
 					msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
 			stats->tx_bytes += priv->read_reg(priv,
@@ -706,6 +706,8 @@
 					& IF_MCONT_DLC_MASK;
 			stats->tx_packets++;
 			c_can_inval_msg_object(dev, 0, msg_obj_no);
+		} else {
+			break;
 		}
 	}
 
@@ -950,7 +952,7 @@
 	struct net_device *dev = napi->dev;
 	struct c_can_priv *priv = netdev_priv(dev);
 
-	irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
+	irqstatus = priv->irqstatus;
 	if (!irqstatus)
 		goto end;
 
@@ -1028,12 +1030,11 @@
 
 static irqreturn_t c_can_isr(int irq, void *dev_id)
 {
-	u16 irqstatus;
 	struct net_device *dev = (struct net_device *)dev_id;
 	struct c_can_priv *priv = netdev_priv(dev);
 
-	irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
-	if (!irqstatus)
+	priv->irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
+	if (!priv->irqstatus)
 		return IRQ_NONE;
 
 	/* disable all interrupts and schedule the NAPI */
@@ -1063,10 +1064,11 @@
 		goto exit_irq_fail;
 	}
 
+	napi_enable(&priv->napi);
+
 	/* start the c_can controller */
 	c_can_start(dev);
 
-	napi_enable(&priv->napi);
 	netif_start_queue(dev);
 
 	return 0;
diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
index 9b7fbef..5f32d34 100644
--- a/drivers/net/can/c_can/c_can.h
+++ b/drivers/net/can/c_can/c_can.h
@@ -76,6 +76,7 @@
 	unsigned int tx_next;
 	unsigned int tx_echo;
 	void *priv;		/* for board-specific data */
+	u16 irqstatus;
 };
 
 struct net_device *alloc_c_can_dev(void);
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 1efb083..00baa7e 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -933,12 +933,12 @@
 	u32 clock_freq = 0;
 
 	if (pdev->dev.of_node) {
-		const u32 *clock_freq_p;
+		const __be32 *clock_freq_p;
 
 		clock_freq_p = of_get_property(pdev->dev.of_node,
 						"clock-frequency", NULL);
 		if (clock_freq_p)
-			clock_freq = *clock_freq_p;
+			clock_freq = be32_to_cpup(clock_freq_p);
 	}
 
 	if (!clock_freq) {
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
index 442d91a..bab0158 100644
--- a/drivers/net/dummy.c
+++ b/drivers/net/dummy.c
@@ -187,8 +187,10 @@
 	rtnl_lock();
 	err = __rtnl_link_register(&dummy_link_ops);
 
-	for (i = 0; i < numdummies && !err; i++)
+	for (i = 0; i < numdummies && !err; i++) {
 		err = dummy_init_one();
+		cond_resched();
+	}
 	if (err < 0)
 		__rtnl_link_unregister(&dummy_link_ops);
 	rtnl_unlock();
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 1ef0c92..65fe632 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -267,7 +267,6 @@
 				dev_warn(&pdev->dev, "stop mac failed\n");
 		atl1c_set_aspm(hw, false);
 		netif_carrier_off(netdev);
-		netif_stop_queue(netdev);
 		atl1c_phy_reset(hw);
 		atl1c_phy_init(&adapter->hw);
 	} else {
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index 8297e28..b8ade57 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -5372,7 +5372,7 @@
 			int k, last;
 
 			if (skb == NULL) {
-				j++;
+				j = NEXT_TX_BD(j);
 				continue;
 			}
 
@@ -5384,8 +5384,8 @@
 			tx_buf->skb = NULL;
 
 			last = tx_buf->nr_frags;
-			j++;
-			for (k = 0; k < last; k++, j++) {
+			j = NEXT_TX_BD(j);
+			for (k = 0; k < last; k++, j = NEXT_TX_BD(j)) {
 				tx_buf = &txr->tx_buf_ring[TX_RING_IDX(j)];
 				dma_unmap_page(&bp->pdev->dev,
 					dma_unmap_addr(tx_buf, mapping),
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 2c9ee55..75d35ec 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -744,21 +744,6 @@
 
 #define ETH_RX_ERROR_FALGS		ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG
 
-#define BNX2X_IP_CSUM_ERR(cqe) \
-			(!((cqe)->fast_path_cqe.status_flags & \
-			   ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG) && \
-			 ((cqe)->fast_path_cqe.type_error_flags & \
-			  ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG))
-
-#define BNX2X_L4_CSUM_ERR(cqe) \
-			(!((cqe)->fast_path_cqe.status_flags & \
-			   ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG) && \
-			 ((cqe)->fast_path_cqe.type_error_flags & \
-			  ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG))
-
-#define BNX2X_RX_CSUM_OK(cqe) \
-			(!(BNX2X_L4_CSUM_ERR(cqe) || BNX2X_IP_CSUM_ERR(cqe)))
-
 #define BNX2X_PRS_FLAG_OVERETH_IPV4(flags) \
 				(((le16_to_cpu(flags) & \
 				   PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) >> \
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 4b05481..41bb34f 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -191,7 +191,7 @@
 
 		if ((netif_tx_queue_stopped(txq)) &&
 		    (bp->state == BNX2X_STATE_OPEN) &&
-		    (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 3))
+		    (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4))
 			netif_tx_wake_queue(txq);
 
 		__netif_tx_unlock(txq);
@@ -568,6 +568,25 @@
 	fp->eth_q_stats.rx_skb_alloc_failed++;
 }
 
+static void bnx2x_csum_validate(struct sk_buff *skb, union eth_rx_cqe *cqe,
+				struct bnx2x_fastpath *fp)
+{
+	/* Do nothing if no IP/L4 csum validation was done */
+
+	if (cqe->fast_path_cqe.status_flags &
+	    (ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG |
+	     ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG))
+		return;
+
+	/* If both IP/L4 validation were done, check if an error was found. */
+
+	if (cqe->fast_path_cqe.type_error_flags &
+	    (ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG |
+	     ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG))
+		fp->eth_q_stats.hw_csum_err++;
+	else
+		skb->ip_summed = CHECKSUM_UNNECESSARY;
+}
 
 int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
 {
@@ -757,13 +776,9 @@
 
 		skb_checksum_none_assert(skb);
 
-		if (bp->dev->features & NETIF_F_RXCSUM) {
+		if (bp->dev->features & NETIF_F_RXCSUM)
+			bnx2x_csum_validate(skb, cqe, fp);
 
-			if (likely(BNX2X_RX_CSUM_OK(cqe)))
-				skb->ip_summed = CHECKSUM_UNNECESSARY;
-			else
-				fp->eth_q_stats.hw_csum_err++;
-		}
 
 		skb_record_rx_queue(skb, fp->rx_queue);
 
@@ -2334,8 +2349,6 @@
 /* we split the first BD into headers and data BDs
  * to ease the pain of our fellow microcode engineers
  * we use one mapping for both BDs
- * So far this has only been observed to happen
- * in Other Operating Systems(TM)
  */
 static noinline u16 bnx2x_tx_split(struct bnx2x *bp,
 				   struct bnx2x_fp_txdata *txdata,
@@ -2987,7 +3000,7 @@
 
 	txdata->tx_bd_prod += nbd;
 
-	if (unlikely(bnx2x_tx_avail(bp, txdata) < MAX_SKB_FRAGS + 3)) {
+	if (unlikely(bnx2x_tx_avail(bp, txdata) < MAX_SKB_FRAGS + 4)) {
 		netif_tx_stop_queue(txq);
 
 		/* paired memory barrier is in bnx2x_tx_int(), we have to keep
@@ -2996,7 +3009,7 @@
 		smp_mb();
 
 		fp->eth_q_stats.driver_xoff++;
-		if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 3)
+		if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4)
 			netif_tx_wake_queue(txq);
 	}
 	txdata->tx_pkt++;
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index ceeab8e..689d2a1 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -298,6 +298,7 @@
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57795)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5719)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5720)},
+	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57762)},
 	{PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)},
 	{PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)},
 	{PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)},
@@ -8948,8 +8949,7 @@
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
 	    tg3_flag(tp, 57765_PLUS)) {
 		val = tr32(TG3_RDMA_RSRVCTRL_REG);
-		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
-		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
+		if (tp->pci_chip_rev_id == CHIPREV_ID_5719_A0) {
 			val &= ~(TG3_RDMA_RSRVCTRL_TXMRGN_MASK |
 				 TG3_RDMA_RSRVCTRL_FIFO_LWM_MASK |
 				 TG3_RDMA_RSRVCTRL_FIFO_HWM_MASK);
@@ -12255,10 +12255,12 @@
 {
 	struct tg3 *tp = netdev_priv(dev);
 
-	if (!tp->hw_stats)
-		return &tp->net_stats_prev;
-
 	spin_lock_bh(&tp->lock);
+	if (!tp->hw_stats) {
+		spin_unlock_bh(&tp->lock);
+		return &tp->net_stats_prev;
+	}
+
 	tg3_get_nstats(tp, stats);
 	spin_unlock_bh(&tp->lock);
 
@@ -14248,7 +14250,8 @@
 		}
 	}
 
-	if (tg3_flag(tp, 5755_PLUS))
+	if (tg3_flag(tp, 5755_PLUS) ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
 		tg3_flag_set(tp, SHORT_DMA_BUG);
 
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 528a886..1bbf6b3 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -731,6 +731,8 @@
 
 	copied = make_tx_wrbs(adapter, txq, skb, wrb_cnt, dummy_wrb);
 	if (copied) {
+		int gso_segs = skb_shinfo(skb)->gso_segs;
+
 		/* record the sent skb in the sent_skb table */
 		BUG_ON(txo->sent_skb_list[start]);
 		txo->sent_skb_list[start] = skb;
@@ -748,8 +750,7 @@
 
 		be_txq_notify(adapter, txq->id, wrb_cnt);
 
-		be_tx_stats_update(txo, wrb_cnt, copied,
-				skb_shinfo(skb)->gso_segs, stopped);
+		be_tx_stats_update(txo, wrb_cnt, copied, gso_segs, stopped);
 	} else {
 		txq->head = start;
 		dev_kfree_skb_any(skb);
diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c
index 7b34d8c..fc87e89 100644
--- a/drivers/net/ethernet/freescale/fec_mpc52xx.c
+++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c
@@ -437,7 +437,7 @@
 		length = status & BCOM_FEC_RX_BD_LEN_MASK;
 		skb_put(rskb, length - 4);	/* length without CRC32 */
 		rskb->protocol = eth_type_trans(rskb, dev);
-		if (!skb_defer_rx_timestamp(skb))
+		if (!skb_defer_rx_timestamp(rskb))
 			netif_rx(rskb);
 
 		spin_lock(&priv->lock);
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index e7bed53..24381e1 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -2065,10 +2065,9 @@
 			return NETDEV_TX_OK;
 		}
 
-		/* Steal sock reference for processing TX time stamps */
-		swap(skb_new->sk, skb->sk);
-		swap(skb_new->destructor, skb->destructor);
-		kfree_skb(skb);
+		if (skb->sk)
+			skb_set_owner_w(skb_new, skb->sk);
+		consume_skb(skb);
 		skb = skb_new;
 	}
 
diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c
index b3fdc69..c098b24 100644
--- a/drivers/net/ethernet/intel/e1000e/82571.c
+++ b/drivers/net/ethernet/intel/e1000e/82571.c
@@ -1553,6 +1553,9 @@
 	ctrl = er32(CTRL);
 	status = er32(STATUS);
 	rxcw = er32(RXCW);
+	/* SYNCH bit and IV bit are sticky */
+	udelay(10);
+	rxcw = er32(RXCW);
 
 	if ((rxcw & E1000_RXCW_SYNCH) && !(rxcw & E1000_RXCW_IV)) {
 
@@ -1579,10 +1582,8 @@
 			 * auto-negotiation in the TXCW register and disable
 			 * forced link in the Device Control register in an
 			 * attempt to auto-negotiate with our link partner.
-			 * If the partner code word is null, stop forcing
-			 * and restart auto negotiation.
 			 */
-			if ((rxcw & E1000_RXCW_C) || !(rxcw & E1000_RXCW_CW))  {
+			if (rxcw & E1000_RXCW_C) {
 				/* Enable autoneg, and unforce link up */
 				ew32(TXCW, mac->txcw);
 				ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
@@ -2061,8 +2062,9 @@
 				  | FLAG_HAS_SMART_POWER_DOWN
 				  | FLAG_HAS_AMT
 				  | FLAG_HAS_CTRLEXT_ON_LOAD,
-	.flags2			  = FLAG2_CHECK_PHY_HANG
+	.flags2			= FLAG2_CHECK_PHY_HANG
 				  | FLAG2_DISABLE_ASPM_L0S
+				  | FLAG2_DISABLE_ASPM_L1
 				  | FLAG2_NO_DISABLE_RX,
 	.pba			= 32,
 	.max_hw_frame_size	= DEFAULT_JUMBO,
diff --git a/drivers/net/ethernet/intel/e1000e/defines.h b/drivers/net/ethernet/intel/e1000e/defines.h
index 3a50259..eb84fe7 100644
--- a/drivers/net/ethernet/intel/e1000e/defines.h
+++ b/drivers/net/ethernet/intel/e1000e/defines.h
@@ -101,6 +101,7 @@
 #define E1000_RXD_ERR_SEQ       0x04    /* Sequence Error */
 #define E1000_RXD_ERR_CXE       0x10    /* Carrier Extension Error */
 #define E1000_RXD_ERR_TCPE      0x20    /* TCP/UDP Checksum Error */
+#define E1000_RXD_ERR_IPE       0x40    /* IP Checksum Error */
 #define E1000_RXD_ERR_RXE       0x80    /* Rx Data Error */
 #define E1000_RXD_SPC_VLAN_MASK 0x0FFF  /* VLAN ID is in lower 12 bits */
 
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
index db35dd5..e48f2d2 100644
--- a/drivers/net/ethernet/intel/e1000e/ethtool.c
+++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
@@ -258,7 +258,8 @@
 	 * When SoL/IDER sessions are active, autoneg/speed/duplex
 	 * cannot be changed
 	 */
-	if (hw->phy.ops.check_reset_block(hw)) {
+	if (hw->phy.ops.check_reset_block &&
+	    hw->phy.ops.check_reset_block(hw)) {
 		e_err("Cannot change link characteristics when SoL/IDER is "
 		      "active.\n");
 		return -EINVAL;
@@ -1604,7 +1605,8 @@
 	 * PHY loopback cannot be performed if SoL/IDER
 	 * sessions are active
 	 */
-	if (hw->phy.ops.check_reset_block(hw)) {
+	if (hw->phy.ops.check_reset_block &&
+	    hw->phy.ops.check_reset_block(hw)) {
 		e_err("Cannot do PHY loopback test when SoL/IDER is active.\n");
 		*data = 0;
 		goto out;
diff --git a/drivers/net/ethernet/intel/e1000e/mac.c b/drivers/net/ethernet/intel/e1000e/mac.c
index decad98..efecb50 100644
--- a/drivers/net/ethernet/intel/e1000e/mac.c
+++ b/drivers/net/ethernet/intel/e1000e/mac.c
@@ -709,7 +709,7 @@
 	 * In the case of the phy reset being blocked, we already have a link.
 	 * We do not need to set it up again.
 	 */
-	if (hw->phy.ops.check_reset_block(hw))
+	if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw))
 		return 0;
 
 	/*
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 9520a6a..5621d5b 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -495,7 +495,7 @@
  * @sk_buff: socket buffer with received data
  **/
 static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err,
-			      __le16 csum, struct sk_buff *skb)
+			      struct sk_buff *skb)
 {
 	u16 status = (u16)status_err;
 	u8 errors = (u8)(status_err >> 24);
@@ -510,8 +510,8 @@
 	if (status & E1000_RXD_STAT_IXSM)
 		return;
 
-	/* TCP/UDP checksum error bit is set */
-	if (errors & E1000_RXD_ERR_TCPE) {
+	/* TCP/UDP checksum error bit or IP checksum error bit is set */
+	if (errors & (E1000_RXD_ERR_TCPE | E1000_RXD_ERR_IPE)) {
 		/* let the stack verify checksum errors */
 		adapter->hw_csum_err++;
 		return;
@@ -522,19 +522,7 @@
 		return;
 
 	/* It must be a TCP or UDP packet with a valid checksum */
-	if (status & E1000_RXD_STAT_TCPCS) {
-		/* TCP checksum is good */
-		skb->ip_summed = CHECKSUM_UNNECESSARY;
-	} else {
-		/*
-		 * IP fragment with UDP payload
-		 * Hardware complements the payload checksum, so we undo it
-		 * and then put the value in host order for further stack use.
-		 */
-		__sum16 sum = (__force __sum16)swab16((__force u16)csum);
-		skb->csum = csum_unfold(~sum);
-		skb->ip_summed = CHECKSUM_COMPLETE;
-	}
+	skb->ip_summed = CHECKSUM_UNNECESSARY;
 	adapter->hw_csum_good++;
 }
 
@@ -978,8 +966,7 @@
 		skb_put(skb, length);
 
 		/* Receive Checksum Offload */
-		e1000_rx_checksum(adapter, staterr,
-				  rx_desc->wb.lower.hi_dword.csum_ip.csum, skb);
+		e1000_rx_checksum(adapter, staterr, skb);
 
 		e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb);
 
@@ -1360,8 +1347,7 @@
 		total_rx_bytes += skb->len;
 		total_rx_packets++;
 
-		e1000_rx_checksum(adapter, staterr,
-				  rx_desc->wb.lower.hi_dword.csum_ip.csum, skb);
+		e1000_rx_checksum(adapter, staterr, skb);
 
 		e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb);
 
@@ -1531,9 +1517,8 @@
 			}
 		}
 
-		/* Receive Checksum Offload XXX recompute due to CRC strip? */
-		e1000_rx_checksum(adapter, staterr,
-				  rx_desc->wb.lower.hi_dword.csum_ip.csum, skb);
+		/* Receive Checksum Offload */
+		e1000_rx_checksum(adapter, staterr, skb);
 
 		e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb);
 
@@ -3120,19 +3105,10 @@
 
 	/* Enable Receive Checksum Offload for TCP and UDP */
 	rxcsum = er32(RXCSUM);
-	if (adapter->netdev->features & NETIF_F_RXCSUM) {
+	if (adapter->netdev->features & NETIF_F_RXCSUM)
 		rxcsum |= E1000_RXCSUM_TUOFL;
-
-		/*
-		 * IPv4 payload checksum for UDP fragments must be
-		 * used in conjunction with packet-split.
-		 */
-		if (adapter->rx_ps_pages)
-			rxcsum |= E1000_RXCSUM_IPPCSE;
-	} else {
+	else
 		rxcsum &= ~E1000_RXCSUM_TUOFL;
-		/* no need to clear IPPCSE as it defaults to 0 */
-	}
 	ew32(RXCSUM, rxcsum);
 
 	if (adapter->hw.mac.type == e1000_pch2lan) {
@@ -5260,22 +5236,10 @@
 	int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN;
 
 	/* Jumbo frame support */
-	if (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) {
-		if (!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) {
-			e_err("Jumbo Frames not supported.\n");
-			return -EINVAL;
-		}
-
-		/*
-		 * IP payload checksum (enabled with jumbos/packet-split when
-		 * Rx checksum is enabled) and generation of RSS hash is
-		 * mutually exclusive in the hardware.
-		 */
-		if ((netdev->features & NETIF_F_RXCSUM) &&
-		    (netdev->features & NETIF_F_RXHASH)) {
-			e_err("Jumbo frames cannot be enabled when both receive checksum offload and receive hashing are enabled.  Disable one of the receive offload features before enabling jumbos.\n");
-			return -EINVAL;
-		}
+	if ((max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) &&
+	    !(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) {
+		e_err("Jumbo Frames not supported.\n");
+		return -EINVAL;
 	}
 
 	/* Supported frame sizes */
@@ -5293,14 +5257,6 @@
 		return -EINVAL;
 	}
 
-	/* 82573 Errata 17 */
-	if (((adapter->hw.mac.type == e1000_82573) ||
-	     (adapter->hw.mac.type == e1000_82574)) &&
-	    (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN)) {
-		adapter->flags2 |= FLAG2_DISABLE_ASPM_L1;
-		e1000e_disable_aspm(adapter->pdev, PCIE_LINK_STATE_L1);
-	}
-
 	while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
 		usleep_range(1000, 2000);
 	/* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */
@@ -6057,17 +6013,6 @@
 			 NETIF_F_RXALL)))
 		return 0;
 
-	/*
-	 * IP payload checksum (enabled with jumbos/packet-split when Rx
-	 * checksum is enabled) and generation of RSS hash is mutually
-	 * exclusive in the hardware.
-	 */
-	if (adapter->rx_ps_pages &&
-	    (features & NETIF_F_RXCSUM) && (features & NETIF_F_RXHASH)) {
-		e_err("Enabling both receive checksum offload and receive hashing is not possible with jumbo frames.  Disable jumbos or enable only one of the receive offload features.\n");
-		return -EINVAL;
-	}
-
 	if (changed & NETIF_F_RXFCS) {
 		if (features & NETIF_F_RXFCS) {
 			adapter->flags2 &= ~FLAG2_CRC_STRIPPING;
@@ -6264,7 +6209,7 @@
 		adapter->hw.phy.ms_type = e1000_ms_hw_default;
 	}
 
-	if (hw->phy.ops.check_reset_block(hw))
+	if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw))
 		e_info("PHY reset is blocked due to SOL/IDER session.\n");
 
 	/* Set initial default active device features */
@@ -6431,7 +6376,7 @@
 	if (!(adapter->flags & FLAG_HAS_AMT))
 		e1000e_release_hw_control(adapter);
 err_eeprom:
-	if (!hw->phy.ops.check_reset_block(hw))
+	if (hw->phy.ops.check_reset_block && !hw->phy.ops.check_reset_block(hw))
 		e1000_phy_hw_reset(&adapter->hw);
 err_hw_init:
 	kfree(adapter->tx_ring);
diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
index 35b4557..c4befb3 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -2121,9 +2121,11 @@
 	s32 ret_val;
 	u32 ctrl;
 
-	ret_val = phy->ops.check_reset_block(hw);
-	if (ret_val)
-		return 0;
+	if (phy->ops.check_reset_block) {
+		ret_val = phy->ops.check_reset_block(hw);
+		if (ret_val)
+			return 0;
+	}
 
 	ret_val = phy->ops.acquire(hw);
 	if (ret_val)
diff --git a/drivers/net/ethernet/intel/igbvf/ethtool.c b/drivers/net/ethernet/intel/igbvf/ethtool.c
index 8ce6706..90eef07 100644
--- a/drivers/net/ethernet/intel/igbvf/ethtool.c
+++ b/drivers/net/ethernet/intel/igbvf/ethtool.c
@@ -357,21 +357,28 @@
 	struct igbvf_adapter *adapter = netdev_priv(netdev);
 	struct e1000_hw *hw = &adapter->hw;
 
-	if ((ec->rx_coalesce_usecs > IGBVF_MAX_ITR_USECS) ||
-	    ((ec->rx_coalesce_usecs > 3) &&
-	     (ec->rx_coalesce_usecs < IGBVF_MIN_ITR_USECS)) ||
-	    (ec->rx_coalesce_usecs == 2))
-		return -EINVAL;
-
-	/* convert to rate of irq's per second */
-	if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3) {
-		adapter->current_itr = IGBVF_START_ITR;
-		adapter->requested_itr = ec->rx_coalesce_usecs;
-	} else {
+	if ((ec->rx_coalesce_usecs >= IGBVF_MIN_ITR_USECS) &&
+	     (ec->rx_coalesce_usecs <= IGBVF_MAX_ITR_USECS)) {
 		adapter->current_itr = ec->rx_coalesce_usecs << 2;
 		adapter->requested_itr = 1000000000 /
 					(adapter->current_itr * 256);
-	}
+	} else if ((ec->rx_coalesce_usecs == 3) ||
+		   (ec->rx_coalesce_usecs == 2)) {
+		adapter->current_itr = IGBVF_START_ITR;
+		adapter->requested_itr = ec->rx_coalesce_usecs;
+	} else if (ec->rx_coalesce_usecs == 0) {
+		/*
+		 * The user's desire is to turn off interrupt throttling
+		 * altogether, but due to HW limitations, we can't do that.
+		 * Instead we set a very small value in EITR, which would
+		 * allow ~967k interrupts per second, but allow the adapter's
+		 * internal clocking to still function properly.
+		 */
+		adapter->current_itr = 4;
+		adapter->requested_itr = 1000000000 /
+					(adapter->current_itr * 256);
+	} else
+		return -EINVAL;
 
 	writel(adapter->current_itr,
 	       hw->hw_addr + adapter->rx_ring->itr_register);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 81b1555..f8f85ec 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -189,7 +189,7 @@
 	__IXGBE_HANG_CHECK_ARMED,
 	__IXGBE_RX_RSC_ENABLED,
 	__IXGBE_RX_CSUM_UDP_ZERO_ERR,
-	__IXGBE_RX_FCOE_BUFSZ,
+	__IXGBE_RX_FCOE,
 };
 
 #define check_for_tx_hang(ring) \
@@ -283,7 +283,7 @@
 #if defined(IXGBE_FCOE) && (PAGE_SIZE < 8192)
 static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring)
 {
-	return test_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state) ? 1 : 0;
+	return test_bit(__IXGBE_RX_FCOE, &ring->state) ? 1 : 0;
 }
 #else
 #define ixgbe_rx_pg_order(_ring) 0
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index ed1b47d..a269d11 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -628,7 +628,7 @@
 			f = &adapter->ring_feature[RING_F_FCOE];
 			if ((rxr_idx >= f->mask) &&
 			    (rxr_idx < f->mask + f->indices))
-				set_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state);
+				set_bit(__IXGBE_RX_FCOE, &ring->state);
 		}
 
 #endif /* IXGBE_FCOE */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 467948e..a66c215 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1036,17 +1036,17 @@
 #ifdef IXGBE_FCOE
 /**
  * ixgbe_rx_is_fcoe - check the rx desc for incoming pkt type
- * @adapter: address of board private structure
+ * @ring: structure containing ring specific data
  * @rx_desc: advanced rx descriptor
  *
  * Returns : true if it is FCoE pkt
  */
-static inline bool ixgbe_rx_is_fcoe(struct ixgbe_adapter *adapter,
+static inline bool ixgbe_rx_is_fcoe(struct ixgbe_ring *ring,
 				    union ixgbe_adv_rx_desc *rx_desc)
 {
 	__le16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info;
 
-	return (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) &&
+	return test_bit(__IXGBE_RX_FCOE, &ring->state) &&
 	       ((pkt_info & cpu_to_le16(IXGBE_RXDADV_PKTTYPE_ETQF_MASK)) ==
 		(cpu_to_le16(IXGBE_ETQF_FILTER_FCOE <<
 			     IXGBE_RXDADV_PKTTYPE_ETQF_SHIFT)));
@@ -1519,6 +1519,12 @@
 		skb->truesize -= ixgbe_rx_bufsz(rx_ring);
 	}
 
+#ifdef IXGBE_FCOE
+	/* do not attempt to pad FCoE Frames as this will disrupt DDP */
+	if (ixgbe_rx_is_fcoe(rx_ring, rx_desc))
+		return false;
+
+#endif
 	/* if skb_pad returns an error the skb was freed */
 	if (unlikely(skb->len < 60)) {
 		int pad_len = 60 - skb->len;
@@ -1745,7 +1751,7 @@
 
 #ifdef IXGBE_FCOE
 		/* if ddp, not passing to ULD unless for FCP_RSP or error */
-		if (ixgbe_rx_is_fcoe(adapter, rx_desc)) {
+		if (ixgbe_rx_is_fcoe(rx_ring, rx_desc)) {
 			ddp_bytes = ixgbe_fcoe_ddp(adapter, rx_desc, skb);
 			if (!ddp_bytes) {
 				dev_kfree_skb_any(skb);
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 487a6c8..589753f 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -4381,10 +4381,12 @@
 	struct sky2_port *sky2 = netdev_priv(dev);
 	netdev_features_t changed = dev->features ^ features;
 
-	if (changed & NETIF_F_RXCSUM) {
-		bool on = features & NETIF_F_RXCSUM;
-		sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR),
-			     on ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM);
+	if ((changed & NETIF_F_RXCSUM) &&
+	    !(sky2->hw->flags & SKY2_HW_NEW_LE)) {
+		sky2_write32(sky2->hw,
+			     Q_ADDR(rxqaddr[sky2->port], Q_CSR),
+			     (features & NETIF_F_RXCSUM)
+			     ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM);
 	}
 
 	if (changed & NETIF_F_RXHASH)
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 6dfc26d..0c5edc1 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -936,16 +936,16 @@
 			/* Update stats */
 			ndev->stats.tx_packets++;
 			ndev->stats.tx_bytes += skb->len;
-
-			/* Free buffer */
-			dev_kfree_skb_irq(skb);
 		}
+		dev_kfree_skb_irq(skb);
 
 		txcidx = readl(LPC_ENET_TXCONSUMEINDEX(pldat->net_base));
 	}
 
-	if (netif_queue_stopped(ndev))
-		netif_wake_queue(ndev);
+	if (pldat->num_used_tx_buffs <= ENET_TX_DESC/2) {
+		if (netif_queue_stopped(ndev))
+			netif_wake_queue(ndev);
+	}
 }
 
 static int __lpc_handle_recv(struct net_device *ndev, int budget)
@@ -1310,6 +1310,7 @@
 	.ndo_set_rx_mode	= lpc_eth_set_multicast_list,
 	.ndo_do_ioctl		= lpc_eth_ioctl,
 	.ndo_set_mac_address	= lpc_set_mac_address,
+	.ndo_change_mtu		= eth_change_mtu,
 };
 
 static int lpc_eth_drv_probe(struct platform_device *pdev)
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index ce6b44d..a73bbe7 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5000,7 +5000,6 @@
 {
 	rtl8169_tx_clear_range(tp, tp->dirty_tx, NUM_TX_DESC);
 	tp->cur_tx = tp->dirty_tx = 0;
-	netdev_reset_queue(tp->dev);
 }
 
 static void rtl_reset_work(struct rtl8169_private *tp)
@@ -5155,8 +5154,6 @@
 
 	txd->opts2 = cpu_to_le32(opts[1]);
 
-	netdev_sent_queue(dev, skb->len);
-
 	skb_tx_timestamp(skb);
 
 	wmb();
@@ -5253,16 +5250,9 @@
 	rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING);
 }
 
-struct rtl_txc {
-	int packets;
-	int bytes;
-};
-
 static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
 {
-	struct rtl8169_stats *tx_stats = &tp->tx_stats;
 	unsigned int dirty_tx, tx_left;
-	struct rtl_txc txc = { 0, 0 };
 
 	dirty_tx = tp->dirty_tx;
 	smp_rmb();
@@ -5281,24 +5271,17 @@
 		rtl8169_unmap_tx_skb(&tp->pci_dev->dev, tx_skb,
 				     tp->TxDescArray + entry);
 		if (status & LastFrag) {
-			struct sk_buff *skb = tx_skb->skb;
-
-			txc.packets++;
-			txc.bytes += skb->len;
-			dev_kfree_skb(skb);
+			u64_stats_update_begin(&tp->tx_stats.syncp);
+			tp->tx_stats.packets++;
+			tp->tx_stats.bytes += tx_skb->skb->len;
+			u64_stats_update_end(&tp->tx_stats.syncp);
+			dev_kfree_skb(tx_skb->skb);
 			tx_skb->skb = NULL;
 		}
 		dirty_tx++;
 		tx_left--;
 	}
 
-	u64_stats_update_begin(&tx_stats->syncp);
-	tx_stats->packets += txc.packets;
-	tx_stats->bytes += txc.bytes;
-	u64_stats_update_end(&tx_stats->syncp);
-
-	netdev_completed_queue(dev, txc.packets, txc.bytes);
-
 	if (tp->dirty_tx != dirty_tx) {
 		tp->dirty_tx = dirty_tx;
 		/* Sync with rtl8169_start_xmit:
@@ -5966,6 +5949,8 @@
 
 	cancel_work_sync(&tp->wk.work);
 
+	netif_napi_del(&tp->napi);
+
 	unregister_netdev(dev);
 
 	rtl_release_firmware(tp);
@@ -6288,6 +6273,7 @@
 	return rc;
 
 err_out_msi_4:
+	netif_napi_del(&tp->napi);
 	rtl_disable_msi(pdev, tp);
 	iounmap(ioaddr);
 err_out_free_res_3:
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 48d56da..9bdfaba 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1158,6 +1158,7 @@
 		priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion);
 		wmb();
 		priv->hw->desc->set_tx_owner(desc);
+		wmb();
 	}
 
 	/* Interrupt on completition only for the latest segment */
@@ -1173,6 +1174,7 @@
 
 	/* To avoid raise condition */
 	priv->hw->desc->set_tx_owner(first);
+	wmb();
 
 	priv->cur_tx++;
 
@@ -1236,6 +1238,7 @@
 		}
 		wmb();
 		priv->hw->desc->set_rx_owner(p + entry);
+		wmb();
 	}
 }
 
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index c99b3b0..8489d09 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -3598,7 +3598,6 @@
 static void niu_tx_work(struct niu *np, struct tx_ring_info *rp)
 {
 	struct netdev_queue *txq;
-	unsigned int tx_bytes;
 	u16 pkt_cnt, tmp;
 	int cons, index;
 	u64 cs;
@@ -3621,18 +3620,12 @@
 	netif_printk(np, tx_done, KERN_DEBUG, np->dev,
 		     "%s() pkt_cnt[%u] cons[%d]\n", __func__, pkt_cnt, cons);
 
-	tx_bytes = 0;
-	tmp = pkt_cnt;
-	while (tmp--) {
-		tx_bytes += rp->tx_buffs[cons].skb->len;
+	while (pkt_cnt--)
 		cons = release_tx_packet(np, rp, cons);
-	}
 
 	rp->cons = cons;
 	smp_mb();
 
-	netdev_tx_completed_queue(txq, pkt_cnt, tx_bytes);
-
 out:
 	if (unlikely(netif_tx_queue_stopped(txq) &&
 		     (niu_tx_avail(rp) > NIU_TX_WAKEUP_THRESH(rp)))) {
@@ -4333,7 +4326,6 @@
 			struct tx_ring_info *rp = &np->tx_rings[i];
 
 			niu_free_tx_ring_info(np, rp);
-			netdev_tx_reset_queue(netdev_get_tx_queue(np->dev, i));
 		}
 		kfree(np->tx_rings);
 		np->tx_rings = NULL;
@@ -6739,8 +6731,6 @@
 		prod = NEXT_TX(rp, prod);
 	}
 
-	netdev_tx_sent_queue(txq, skb->len);
-
 	if (prod < rp->prod)
 		rp->wrap_bit ^= TX_RING_KICK_WRAP;
 	rp->prod = prod;
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index cb8fd50..c1d602d 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -528,9 +528,10 @@
 		}
 		base = (unsigned long)from->iov_base + offset1;
 		size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT;
+		if (i + size > MAX_SKB_FRAGS)
+			return -EMSGSIZE;
 		num_pages = get_user_pages_fast(base, size, 0, &page[i]);
-		if ((num_pages != size) ||
-		    (num_pages > MAX_SKB_FRAGS - skb_shinfo(skb)->nr_frags))
+		if (num_pages != size)
 			/* put_page is in skb free */
 			return -EFAULT;
 		skb->data_len += len;
@@ -647,7 +648,7 @@
 	int err;
 	struct virtio_net_hdr vnet_hdr = { 0 };
 	int vnet_hdr_len = 0;
-	int copylen;
+	int copylen = 0;
 	bool zerocopy = false;
 
 	if (q->flags & IFF_VNET_HDR) {
@@ -676,15 +677,31 @@
 	if (unlikely(len < ETH_HLEN))
 		goto err;
 
+	err = -EMSGSIZE;
+	if (unlikely(count > UIO_MAXIOV))
+		goto err;
+
 	if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY))
 		zerocopy = true;
 
 	if (zerocopy) {
+		/* Userspace may produce vectors with count greater than
+		 * MAX_SKB_FRAGS, so we need to linearize parts of the skb
+		 * to let the rest of data to be fit in the frags.
+		 */
+		if (count > MAX_SKB_FRAGS) {
+			copylen = iov_length(iv, count - MAX_SKB_FRAGS);
+			if (copylen < vnet_hdr_len)
+				copylen = 0;
+			else
+				copylen -= vnet_hdr_len;
+		}
 		/* There are 256 bytes to be copied in skb, so there is enough
 		 * room for skb expand head in case it is used.
 		 * The rest buffer is mapped from userspace.
 		 */
-		copylen = vnet_hdr.hdr_len;
+		if (copylen < vnet_hdr.hdr_len)
+			copylen = vnet_hdr.hdr_len;
 		if (!copylen)
 			copylen = GOODCOPY_LEN;
 	} else
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 2391dae6..279d860 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -185,7 +185,6 @@
 	netif_tx_lock_bh(tun->dev);
 	netif_carrier_off(tun->dev);
 	tun->tfile = NULL;
-	tun->socket.file = NULL;
 	netif_tx_unlock_bh(tun->dev);
 
 	/* Drop read queue */
@@ -358,6 +357,8 @@
 {
 	struct tun_struct *tun = netdev_priv(dev);
 
+	BUG_ON(!test_bit(SOCK_EXTERNALLY_ALLOCATED, &tun->socket.flags));
+
 	sk_release_kernel(tun->socket.sk);
 }
 
@@ -1115,6 +1116,7 @@
 		tun->flags = flags;
 		tun->txflt.count = 0;
 		tun->vnet_hdr_sz = sizeof(struct virtio_net_hdr);
+		set_bit(SOCK_EXTERNALLY_ALLOCATED, &tun->socket.flags);
 
 		err = -ENOMEM;
 		sk = sk_alloc(&init_net, AF_UNSPEC, GFP_KERNEL, &tun_proto);
@@ -1258,10 +1260,12 @@
 	}
 #endif
 
-	if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89)
+	if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89) {
 		if (copy_from_user(&ifr, argp, ifreq_len))
 			return -EFAULT;
-
+	} else {
+		memset(&ifr, 0, sizeof(ifr));
+	}
 	if (cmd == TUNGETFEATURES) {
 		/* Currently this just means: "what IFF flags are valid?".
 		 * This is needed because we never checked for invalid flags on
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 42b5151..609fcc3 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -35,6 +35,7 @@
 #include <linux/crc32.h>
 #include <linux/usb/usbnet.h>
 #include <linux/slab.h>
+#include <linux/if_vlan.h>
 
 #define DRIVER_VERSION "22-Dec-2011"
 #define DRIVER_NAME "asix"
@@ -321,7 +322,7 @@
 			return 0;
 		}
 
-		if ((size > dev->net->mtu + ETH_HLEN) ||
+		if ((size > dev->net->mtu + ETH_HLEN + VLAN_HLEN) ||
 		    (size + offset > skb->len)) {
 			netdev_err(dev->net, "asix_rx_fixup() Bad RX Length %d\n",
 				   size);
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index dd78c4c..5cba415 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -59,6 +59,7 @@
 #define USB_PRODUCT_IPHONE_3G   0x1292
 #define USB_PRODUCT_IPHONE_3GS  0x1294
 #define USB_PRODUCT_IPHONE_4	0x1297
+#define USB_PRODUCT_IPAD 0x129a
 #define USB_PRODUCT_IPHONE_4_VZW 0x129c
 #define USB_PRODUCT_IPHONE_4S	0x12a0
 
@@ -101,6 +102,10 @@
 		IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
 		IPHETH_USBINTF_PROTO) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(
+		USB_VENDOR_APPLE, USB_PRODUCT_IPAD,
+		IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
+		IPHETH_USBINTF_PROTO) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(
 		USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW,
 		IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
 		IPHETH_USBINTF_PROTO) },
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index df2a2cf35..7a6ccd6 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -1302,7 +1302,7 @@
         int retv;
         int length = 0; /* shut up GCC */
 
-        urb = usb_alloc_urb(0, GFP_NOIO);
+	urb = usb_alloc_urb(0, GFP_ATOMIC);
         if (!urb)
                 return -ENOMEM;
 
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index d316503b..c2ae426 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -197,6 +197,10 @@
 static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on)
 {
 	struct usbnet *dev = usb_get_intfdata(intf);
+
+	/* can be called while disconnecting */
+	if (!dev)
+		return 0;
 	return qmi_wwan_manage_power(dev, on);
 }
 
@@ -257,29 +261,6 @@
 	return rv;
 }
 
-/* Gobi devices uses identical class/protocol codes for all interfaces regardless
- * of function. Some of these are CDC ACM like and have the exact same endpoints
- * we are looking for. This leaves two possible strategies for identifying the
- * correct interface:
- *   a) hardcoding interface number, or
- *   b) use the fact that the wwan interface is the only one lacking additional
- *      (CDC functional) descriptors
- *
- * Let's see if we can get away with the generic b) solution.
- */
-static int qmi_wwan_bind_gobi(struct usbnet *dev, struct usb_interface *intf)
-{
-	int rv = -EINVAL;
-
-	/* ignore any interface with additional descriptors */
-	if (intf->cur_altsetting->extralen)
-		goto err;
-
-	rv = qmi_wwan_bind_shared(dev, intf);
-err:
-	return rv;
-}
-
 static void qmi_wwan_unbind_shared(struct usbnet *dev, struct usb_interface *intf)
 {
 	struct usb_driver *subdriver = (void *)dev->data[0];
@@ -347,19 +328,37 @@
 	.manage_power	= qmi_wwan_manage_power,
 };
 
-static const struct driver_info	qmi_wwan_gobi = {
-	.description	= "Qualcomm Gobi wwan/QMI device",
+static const struct driver_info	qmi_wwan_force_int0 = {
+	.description	= "Qualcomm WWAN/QMI device",
 	.flags		= FLAG_WWAN,
-	.bind		= qmi_wwan_bind_gobi,
+	.bind		= qmi_wwan_bind_shared,
 	.unbind		= qmi_wwan_unbind_shared,
 	.manage_power	= qmi_wwan_manage_power,
+	.data		= BIT(0), /* interface whitelist bitmap */
 };
 
-/* ZTE suck at making USB descriptors */
-static const struct driver_info	qmi_wwan_force_int4 = {
-	.description	= "Qualcomm Gobi wwan/QMI device",
+static const struct driver_info	qmi_wwan_force_int1 = {
+	.description	= "Qualcomm WWAN/QMI device",
 	.flags		= FLAG_WWAN,
-	.bind		= qmi_wwan_bind_gobi,
+	.bind		= qmi_wwan_bind_shared,
+	.unbind		= qmi_wwan_unbind_shared,
+	.manage_power	= qmi_wwan_manage_power,
+	.data		= BIT(1), /* interface whitelist bitmap */
+};
+
+static const struct driver_info	qmi_wwan_force_int3 = {
+	.description	= "Qualcomm WWAN/QMI device",
+	.flags		= FLAG_WWAN,
+	.bind		= qmi_wwan_bind_shared,
+	.unbind		= qmi_wwan_unbind_shared,
+	.manage_power	= qmi_wwan_manage_power,
+	.data		= BIT(3), /* interface whitelist bitmap */
+};
+
+static const struct driver_info	qmi_wwan_force_int4 = {
+	.description	= "Qualcomm WWAN/QMI device",
+	.flags		= FLAG_WWAN,
+	.bind		= qmi_wwan_bind_shared,
 	.unbind		= qmi_wwan_unbind_shared,
 	.manage_power	= qmi_wwan_manage_power,
 	.data		= BIT(4), /* interface whitelist bitmap */
@@ -381,16 +380,23 @@
 static const struct driver_info	qmi_wwan_sierra = {
 	.description	= "Sierra Wireless wwan/QMI device",
 	.flags		= FLAG_WWAN,
-	.bind		= qmi_wwan_bind_gobi,
+	.bind		= qmi_wwan_bind_shared,
 	.unbind		= qmi_wwan_unbind_shared,
 	.manage_power	= qmi_wwan_manage_power,
 	.data		= BIT(8) | BIT(19), /* interface whitelist bitmap */
 };
 
 #define HUAWEI_VENDOR_ID	0x12D1
+
+/* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */
+#define QMI_GOBI1K_DEVICE(vend, prod) \
+	USB_DEVICE(vend, prod), \
+	.driver_info = (unsigned long)&qmi_wwan_force_int3
+
+/* Gobi 2000 and Gobi 3000 QMI/wwan interface number is 0 according to qcserial */
 #define QMI_GOBI_DEVICE(vend, prod) \
 	USB_DEVICE(vend, prod), \
-	.driver_info = (unsigned long)&qmi_wwan_gobi
+	.driver_info = (unsigned long)&qmi_wwan_force_int0
 
 static const struct usb_device_id products[] = {
 	{	/* Huawei E392, E398 and possibly others sharing both device id and more... */
@@ -430,6 +436,15 @@
 		.bInterfaceProtocol = 0xff,
 		.driver_info        = (unsigned long)&qmi_wwan_force_int4,
 	},
+	{	/* ZTE (Vodafone) K3520-Z */
+		.match_flags	    = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
+		.idVendor           = 0x19d2,
+		.idProduct          = 0x0055,
+		.bInterfaceClass    = 0xff,
+		.bInterfaceSubClass = 0xff,
+		.bInterfaceProtocol = 0xff,
+		.driver_info        = (unsigned long)&qmi_wwan_force_int1,
+	},
 	{	/* ZTE (Vodafone) K3565-Z */
 		.match_flags	    = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
 		.idVendor           = 0x19d2,
@@ -475,20 +490,24 @@
 		.bInterfaceProtocol = 0xff,
 		.driver_info        = (unsigned long)&qmi_wwan_sierra,
 	},
-	{QMI_GOBI_DEVICE(0x05c6, 0x9212)},	/* Acer Gobi Modem Device */
-	{QMI_GOBI_DEVICE(0x03f0, 0x1f1d)},	/* HP un2400 Gobi Modem Device */
-	{QMI_GOBI_DEVICE(0x03f0, 0x371d)},	/* HP un2430 Mobile Broadband Module */
-	{QMI_GOBI_DEVICE(0x04da, 0x250d)},	/* Panasonic Gobi Modem device */
-	{QMI_GOBI_DEVICE(0x413c, 0x8172)},	/* Dell Gobi Modem device */
-	{QMI_GOBI_DEVICE(0x1410, 0xa001)},	/* Novatel Gobi Modem device */
-	{QMI_GOBI_DEVICE(0x0b05, 0x1776)},	/* Asus Gobi Modem device */
-	{QMI_GOBI_DEVICE(0x19d2, 0xfff3)},	/* ONDA Gobi Modem device */
-	{QMI_GOBI_DEVICE(0x05c6, 0x9001)},	/* Generic Gobi Modem device */
-	{QMI_GOBI_DEVICE(0x05c6, 0x9002)},	/* Generic Gobi Modem device */
-	{QMI_GOBI_DEVICE(0x05c6, 0x9202)},	/* Generic Gobi Modem device */
-	{QMI_GOBI_DEVICE(0x05c6, 0x9203)},	/* Generic Gobi Modem device */
-	{QMI_GOBI_DEVICE(0x05c6, 0x9222)},	/* Generic Gobi Modem device */
-	{QMI_GOBI_DEVICE(0x05c6, 0x9009)},	/* Generic Gobi Modem device */
+
+	/* Gobi 1000 devices */
+	{QMI_GOBI1K_DEVICE(0x05c6, 0x9212)},	/* Acer Gobi Modem Device */
+	{QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)},	/* HP un2400 Gobi Modem Device */
+	{QMI_GOBI1K_DEVICE(0x03f0, 0x371d)},	/* HP un2430 Mobile Broadband Module */
+	{QMI_GOBI1K_DEVICE(0x04da, 0x250d)},	/* Panasonic Gobi Modem device */
+	{QMI_GOBI1K_DEVICE(0x413c, 0x8172)},	/* Dell Gobi Modem device */
+	{QMI_GOBI1K_DEVICE(0x1410, 0xa001)},	/* Novatel Gobi Modem device */
+	{QMI_GOBI1K_DEVICE(0x0b05, 0x1776)},	/* Asus Gobi Modem device */
+	{QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)},	/* ONDA Gobi Modem device */
+	{QMI_GOBI1K_DEVICE(0x05c6, 0x9001)},	/* Generic Gobi Modem device */
+	{QMI_GOBI1K_DEVICE(0x05c6, 0x9002)},	/* Generic Gobi Modem device */
+	{QMI_GOBI1K_DEVICE(0x05c6, 0x9202)},	/* Generic Gobi Modem device */
+	{QMI_GOBI1K_DEVICE(0x05c6, 0x9203)},	/* Generic Gobi Modem device */
+	{QMI_GOBI1K_DEVICE(0x05c6, 0x9222)},	/* Generic Gobi Modem device */
+	{QMI_GOBI1K_DEVICE(0x05c6, 0x9009)},	/* Generic Gobi Modem device */
+
+	/* Gobi 2000 and 3000 devices */
 	{QMI_GOBI_DEVICE(0x413c, 0x8186)},	/* Dell Gobi 2000 Modem device (N0218, VU936) */
 	{QMI_GOBI_DEVICE(0x05c6, 0x920b)},	/* Generic Gobi 2000 Modem device */
 	{QMI_GOBI_DEVICE(0x05c6, 0x9225)},	/* Sony Gobi 2000 Modem device (N0279, VU730) */
diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
index b59cf20..cc9776c 100644
--- a/drivers/net/usb/sierra_net.c
+++ b/drivers/net/usb/sierra_net.c
@@ -946,7 +946,7 @@
 }
 
 static const u8 sierra_net_ifnum_list[] = { 7, 10, 11 };
-static const struct sierra_net_info_data sierra_net_info_data_68A3 = {
+static const struct sierra_net_info_data sierra_net_info_data_direct_ip = {
 	.rx_urb_size = 8 * 1024,
 	.whitelist = {
 		.infolen = ARRAY_SIZE(sierra_net_ifnum_list),
@@ -954,7 +954,7 @@
 	}
 };
 
-static const struct driver_info sierra_net_info_68A3 = {
+static const struct driver_info sierra_net_info_direct_ip = {
 	.description = "Sierra Wireless USB-to-WWAN Modem",
 	.flags = FLAG_WWAN | FLAG_SEND_ZLP,
 	.bind = sierra_net_bind,
@@ -962,12 +962,18 @@
 	.status = sierra_net_status,
 	.rx_fixup = sierra_net_rx_fixup,
 	.tx_fixup = sierra_net_tx_fixup,
-	.data = (unsigned long)&sierra_net_info_data_68A3,
+	.data = (unsigned long)&sierra_net_info_data_direct_ip,
 };
 
 static const struct usb_device_id products[] = {
 	{USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */
-	.driver_info = (unsigned long) &sierra_net_info_68A3},
+	.driver_info = (unsigned long) &sierra_net_info_direct_ip},
+	{USB_DEVICE(0x0F3D, 0x68A3), /* AT&T Direct IP modem */
+	.driver_info = (unsigned long) &sierra_net_info_direct_ip},
+	{USB_DEVICE(0x1199, 0x68AA), /* Sierra Wireless Direct IP LTE modem */
+	.driver_info = (unsigned long) &sierra_net_info_direct_ip},
+	{USB_DEVICE(0x0F3D, 0x68AA), /* AT&T Direct IP LTE modem */
+	.driver_info = (unsigned long) &sierra_net_info_direct_ip},
 
 	{}, /* last item */
 };
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index c54b7d37..420d69b 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -143,6 +143,7 @@
 	u32 keymax;
 	DECLARE_BITMAP(keymap, ATH_KEYMAX);
 	DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX);
+	DECLARE_BITMAP(ccmp_keymap, ATH_KEYMAX);
 	enum ath_crypt_caps crypt_caps;
 
 	unsigned int clockrate;
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 8c84049..4bfb44a 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -213,6 +213,7 @@
 	enum ath9k_key_type keytype;
 	u8 keyix;
 	u8 retries;
+	u8 rtscts_rate;
 };
 
 struct ath_buf_state {
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 2b8f61c..abbd6ef 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1496,6 +1496,7 @@
 			priv->num_sta_assoc_vif++ : priv->num_sta_assoc_vif--;
 
 		if (priv->ah->opmode == NL80211_IFTYPE_STATION) {
+			ath9k_htc_choose_set_bssid(priv);
 			if (bss_conf->assoc && (priv->num_sta_assoc_vif == 1))
 				ath9k_htc_start_ani(priv);
 			else if (priv->num_sta_assoc_vif == 0)
@@ -1503,13 +1504,11 @@
 		}
 	}
 
-	if (changed & BSS_CHANGED_BSSID) {
+	if (changed & BSS_CHANGED_IBSS) {
 		if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) {
 			common->curaid = bss_conf->aid;
 			memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
 			ath9k_htc_set_bssid(priv);
-		} else if (priv->ah->opmode == NL80211_IFTYPE_STATION) {
-			ath9k_htc_choose_set_bssid(priv);
 		}
 	}
 
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 4f96a69..4166323 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -569,7 +569,7 @@
 
 	if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_AUTO) {
 		if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI ||
-		    ((AR_SREV_9160(ah) || AR_SREV_9280(ah)) &&
+		    ((AR_SREV_9160(ah) || AR_SREV_9280(ah) || AR_SREV_9287(ah)) &&
 		     !ah->is_pciexpress)) {
 			ah->config.serialize_regmode =
 				SER_REG_MODE_ON;
@@ -687,6 +687,7 @@
 	case AR9300_DEVID_AR9340:
 	case AR9300_DEVID_AR9580:
 	case AR9300_DEVID_AR9462:
+	case AR9485_DEVID_AR1111:
 		break;
 	default:
 		if (common->bus_ops->ath_bus_type == ATH_USB)
@@ -731,13 +732,25 @@
 
 u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah)
 {
+	struct ath_common *common = ath9k_hw_common(ah);
+	int i = 0;
+
 	REG_CLR_BIT(ah, PLL3, PLL3_DO_MEAS_MASK);
 	udelay(100);
 	REG_SET_BIT(ah, PLL3, PLL3_DO_MEAS_MASK);
 
-	while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0)
+	while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0) {
+
 		udelay(100);
 
+		if (WARN_ON_ONCE(i >= 100)) {
+			ath_err(common, "PLL4 meaurement not done\n");
+			break;
+		}
+
+		i++;
+	}
+
 	return (REG_READ(ah, PLL3) & SQSUM_DVC_MASK) >> 3;
 }
 EXPORT_SYMBOL(ar9003_get_pll_sqsum_dvc);
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index e88f182..f8e1fbb 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -48,6 +48,7 @@
 #define AR9300_DEVID_AR9580	0x0033
 #define AR9300_DEVID_AR9462	0x0034
 #define AR9300_DEVID_AR9330	0x0035
+#define AR9485_DEVID_AR1111	0x0037
 
 #define AR5416_AR9100_DEVID	0x000b
 
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 798ea57..d5dabcb 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -960,6 +960,15 @@
 					    hw_pll_work.work);
 	u32 pll_sqsum;
 
+	/*
+	 * ensure that the PLL WAR is executed only
+	 * after the STA is associated (or) if the
+	 * beaconing had started in interfaces that
+	 * uses beacons.
+	 */
+	if (!(sc->sc_flags & SC_OP_BEACONS))
+		return;
+
 	if (AR_SREV_9485(sc->sc_ah)) {
 
 		ath9k_ps_wakeup(sc);
@@ -1419,15 +1428,6 @@
 		}
 	}
 
-	if ((ah->opmode == NL80211_IFTYPE_ADHOC) ||
-	    ((vif->type == NL80211_IFTYPE_ADHOC) &&
-	     sc->nvifs > 0)) {
-		ath_err(common, "Cannot create ADHOC interface when other"
-			" interfaces already exist.\n");
-		ret = -EINVAL;
-		goto out;
-	}
-
 	ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type);
 
 	sc->nvifs++;
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 5e66310..074000e 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -35,6 +35,7 @@
 	{ PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E  AR9485 */
 	{ PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E  AR9580 */
 	{ PCI_VDEVICE(ATHEROS, 0x0034) }, /* PCI-E  AR9462 */
+	{ PCI_VDEVICE(ATHEROS, 0x0037) }, /* PCI-E  AR1111/AR9485 */
 	{ 0 }
 };
 
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 1c4583c..a2f7ae8 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -695,9 +695,9 @@
 			__skb_unlink(skb, &rx_edma->rx_fifo);
 			list_add_tail(&bf->list, &sc->rx.rxbuf);
 			ath_rx_edma_buf_link(sc, qtype);
-		} else {
-			bf = NULL;
 		}
+
+		bf = NULL;
 	}
 
 	*dest = bf;
@@ -821,7 +821,8 @@
 	 * descriptor does contain a valid key index. This has been observed
 	 * mostly with CCMP encryption.
 	 */
-	if (rx_stats->rs_keyix == ATH9K_RXKEYIX_INVALID)
+	if (rx_stats->rs_keyix == ATH9K_RXKEYIX_INVALID ||
+	    !test_bit(rx_stats->rs_keyix, common->ccmp_keymap))
 		rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS;
 
 	if (!rx_stats->rs_datalen)
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 23eaa1b..4d57139 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -64,7 +64,8 @@
 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
 					   struct ath_txq *txq,
 					   struct ath_atx_tid *tid,
-					   struct sk_buff *skb);
+					   struct sk_buff *skb,
+					   bool dequeue);
 
 enum {
 	MCS_HT20,
@@ -811,7 +812,7 @@
 		fi = get_frame_info(skb);
 		bf = fi->bf;
 		if (!fi->bf)
-			bf = ath_tx_setup_buffer(sc, txq, tid, skb);
+			bf = ath_tx_setup_buffer(sc, txq, tid, skb, true);
 
 		if (!bf)
 			continue;
@@ -937,6 +938,7 @@
 	struct ieee80211_tx_rate *rates;
 	const struct ieee80211_rate *rate;
 	struct ieee80211_hdr *hdr;
+	struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
 	int i;
 	u8 rix = 0;
 
@@ -947,18 +949,7 @@
 
 	/* set dur_update_en for l-sig computation except for PS-Poll frames */
 	info->dur_update = !ieee80211_is_pspoll(hdr->frame_control);
-
-	/*
-	 * We check if Short Preamble is needed for the CTS rate by
-	 * checking the BSS's global flag.
-	 * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used.
-	 */
-	rate = ieee80211_get_rts_cts_rate(sc->hw, tx_info);
-	info->rtscts_rate = rate->hw_value;
-
-	if (tx_info->control.vif &&
-	    tx_info->control.vif->bss_conf.use_short_preamble)
-		info->rtscts_rate |= rate->hw_value_short;
+	info->rtscts_rate = fi->rtscts_rate;
 
 	for (i = 0; i < 4; i++) {
 		bool is_40, is_sgi, is_sp;
@@ -1000,13 +991,13 @@
 		}
 
 		/* legacy rates */
+		rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx];
 		if ((tx_info->band == IEEE80211_BAND_2GHZ) &&
 		    !(rate->flags & IEEE80211_RATE_ERP_G))
 			phy = WLAN_RC_PHY_CCK;
 		else
 			phy = WLAN_RC_PHY_OFDM;
 
-		rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx];
 		info->rates[i].Rate = rate->hw_value;
 		if (rate->hw_value_short) {
 			if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
@@ -1726,7 +1717,7 @@
 		return;
 	}
 
-	bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
+	bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false);
 	if (!bf)
 		return;
 
@@ -1753,7 +1744,7 @@
 
 	bf = fi->bf;
 	if (!bf)
-		bf = ath_tx_setup_buffer(sc, txq, tid, skb);
+		bf = ath_tx_setup_buffer(sc, txq, tid, skb, false);
 
 	if (!bf)
 		return;
@@ -1775,10 +1766,22 @@
 	struct ieee80211_sta *sta = tx_info->control.sta;
 	struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+	const struct ieee80211_rate *rate;
 	struct ath_frame_info *fi = get_frame_info(skb);
 	struct ath_node *an = NULL;
 	enum ath9k_key_type keytype;
+	bool short_preamble = false;
 
+	/*
+	 * We check if Short Preamble is needed for the CTS rate by
+	 * checking the BSS's global flag.
+	 * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used.
+	 */
+	if (tx_info->control.vif &&
+	    tx_info->control.vif->bss_conf.use_short_preamble)
+		short_preamble = true;
+
+	rate = ieee80211_get_rts_cts_rate(hw, tx_info);
 	keytype = ath9k_cmn_get_hw_crypto_keytype(skb);
 
 	if (sta)
@@ -1793,6 +1796,9 @@
 		fi->keyix = ATH9K_TXKEYIX_INVALID;
 	fi->keytype = keytype;
 	fi->framelen = framelen;
+	fi->rtscts_rate = rate->hw_value;
+	if (short_preamble)
+		fi->rtscts_rate |= rate->hw_value_short;
 }
 
 u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate)
@@ -1814,7 +1820,8 @@
 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
 					   struct ath_txq *txq,
 					   struct ath_atx_tid *tid,
-					   struct sk_buff *skb)
+					   struct sk_buff *skb,
+					   bool dequeue)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_frame_info *fi = get_frame_info(skb);
@@ -1863,6 +1870,8 @@
 	return bf;
 
 error:
+	if (dequeue)
+		__skb_unlink(skb, &tid->buf_q);
 	dev_kfree_skb_any(skb);
 	return NULL;
 }
@@ -1893,7 +1902,7 @@
 		 */
 		ath_tx_send_ampdu(sc, tid, skb, txctl);
 	} else {
-		bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
+		bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false);
 		if (!bf)
 			return;
 
diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c
index 0e81904..5c54aa4 100644
--- a/drivers/net/wireless/ath/key.c
+++ b/drivers/net/wireless/ath/key.c
@@ -556,6 +556,9 @@
 		return -EIO;
 
 	set_bit(idx, common->keymap);
+	if (key->cipher == WLAN_CIPHER_SUITE_CCMP)
+		set_bit(idx, common->ccmp_keymap);
+
 	if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
 		set_bit(idx + 64, common->keymap);
 		set_bit(idx, common->tkip_keymap);
@@ -582,6 +585,7 @@
 		return;
 
 	clear_bit(key->hw_key_idx, common->keymap);
+	clear_bit(key->hw_key_idx, common->ccmp_keymap);
 	if (key->cipher != WLAN_CIPHER_SUITE_TKIP)
 		return;
 
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index df7e16d..a98db30 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -1571,8 +1571,6 @@
 	const char *filename;
 	int err;
 
-	/* do dummy read */
-	ssb_read32(dev->dev, SSB_TMSHIGH);
 	if (!fw->ucode) {
 		if (rev == 2)
 			filename = "ucode2";
diff --git a/drivers/net/wireless/ipw2x00/ipw.h b/drivers/net/wireless/ipw2x00/ipw.h
new file mode 100644
index 0000000..4007bf5
--- /dev/null
+++ b/drivers/net/wireless/ipw2x00/ipw.h
@@ -0,0 +1,23 @@
+/*
+ * Intel Pro/Wireless 2100, 2200BG, 2915ABG network connection driver
+ *
+ * Copyright 2012 Stanislav Yakovlev <stas.yakovlev@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __IPW_H__
+#define __IPW_H__
+
+#include <linux/ieee80211.h>
+
+static const u32 ipw_cipher_suites[] = {
+	WLAN_CIPHER_SUITE_WEP40,
+	WLAN_CIPHER_SUITE_WEP104,
+	WLAN_CIPHER_SUITE_TKIP,
+	WLAN_CIPHER_SUITE_CCMP,
+};
+
+#endif
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index f0551f8..7c8e8b1 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -166,6 +166,7 @@
 #include <net/lib80211.h>
 
 #include "ipw2100.h"
+#include "ipw.h"
 
 #define IPW2100_VERSION "git-1.2.2"
 
@@ -1946,6 +1947,9 @@
 		wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = bg_band;
 	}
 
+	wdev->wiphy->cipher_suites = ipw_cipher_suites;
+	wdev->wiphy->n_cipher_suites = ARRAY_SIZE(ipw_cipher_suites);
+
 	set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev);
 	if (wiphy_register(wdev->wiphy)) {
 		ipw2100_down(priv);
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 1779db3..3a6b991 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -34,6 +34,7 @@
 #include <linux/slab.h>
 #include <net/cfg80211-wext.h>
 #include "ipw2200.h"
+#include "ipw.h"
 
 
 #ifndef KBUILD_EXTMOD
@@ -11544,6 +11545,9 @@
 		wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = a_band;
 	}
 
+	wdev->wiphy->cipher_suites = ipw_cipher_suites;
+	wdev->wiphy->n_cipher_suites = ARRAY_SIZE(ipw_cipher_suites);
+
 	set_wiphy_dev(wdev->wiphy, &priv->pci_dev->dev);
 
 	/* With that information in place, we can now register the wiphy... */
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index c46275a..9aa4807 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -3405,7 +3405,7 @@
 		return 0;
 	}
 
-	if (il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) {
+	if (il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_INVALID) {
 		IL_WARN("Removing wrong key %d 0x%x\n", keyconf->keyidx,
 			key_flags);
 		spin_unlock_irqrestore(&il->sta_lock, flags);
@@ -3420,7 +3420,7 @@
 	memset(&il->stations[sta_id].sta.key, 0, sizeof(struct il4965_keyinfo));
 	il->stations[sta_id].sta.key.key_flags =
 	    STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID;
-	il->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET;
+	il->stations[sta_id].sta.key.key_offset = keyconf->hw_key_idx;
 	il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
 	il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
 
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index eaf24945..4bc2711 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -4767,14 +4767,12 @@
 		return;
 
 	/* monitor and check for other stuck queues */
-	if (il_is_any_associated(il)) {
-		for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) {
-			/* skip as we already checked the command queue */
-			if (cnt == il->cmd_queue)
-				continue;
-			if (il_check_stuck_queue(il, cnt))
-				return;
-		}
+	for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) {
+		/* skip as we already checked the command queue */
+		if (cnt == il->cmd_queue)
+			continue;
+		if (il_check_stuck_queue(il, cnt))
+			return;
 	}
 
 	mod_timer(&il->watchdog,
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
index ea10862..4da050f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
@@ -183,7 +183,7 @@
 	.chain_noise_scale = 1000,
 	.wd_timeout = IWL_DEF_WD_TIMEOUT,
 	.max_event_log_size = 512,
-	.shadow_reg_enable = true,
+	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
 	.hd_v2 = true,
 };
 
@@ -202,7 +202,7 @@
 	.chain_noise_scale = 1000,
 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
 	.max_event_log_size = 512,
-	.shadow_reg_enable = true,
+	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
 	.hd_v2 = true,
 };
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index f0c9150..c0cfa4e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -49,17 +49,20 @@
 #define IWL6000_UCODE_API_MAX 6
 #define IWL6050_UCODE_API_MAX 5
 #define IWL6000G2_UCODE_API_MAX 6
+#define IWL6035_UCODE_API_MAX 6
 
 /* Oldest version we won't warn about */
 #define IWL6000_UCODE_API_OK 4
 #define IWL6000G2_UCODE_API_OK 5
 #define IWL6050_UCODE_API_OK 5
 #define IWL6000G2B_UCODE_API_OK 6
+#define IWL6035_UCODE_API_OK 6
 
 /* Lowest firmware API version supported */
 #define IWL6000_UCODE_API_MIN 4
 #define IWL6050_UCODE_API_MIN 4
-#define IWL6000G2_UCODE_API_MIN 4
+#define IWL6000G2_UCODE_API_MIN 5
+#define IWL6035_UCODE_API_MIN 6
 
 #define IWL6000_FW_PRE "iwlwifi-6000-"
 #define IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE __stringify(api) ".ucode"
@@ -282,7 +285,7 @@
 	.chain_noise_scale = 1000,
 	.wd_timeout = IWL_DEF_WD_TIMEOUT,
 	.max_event_log_size = 512,
-	.shadow_reg_enable = true,
+	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
 };
 
 static const struct iwl_base_params iwl6050_base_params = {
@@ -299,7 +302,7 @@
 	.chain_noise_scale = 1500,
 	.wd_timeout = IWL_DEF_WD_TIMEOUT,
 	.max_event_log_size = 1024,
-	.shadow_reg_enable = true,
+	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
 };
 
 static const struct iwl_base_params iwl6000_g2_base_params = {
@@ -316,7 +319,7 @@
 	.chain_noise_scale = 1000,
 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
 	.max_event_log_size = 512,
-	.shadow_reg_enable = true,
+	.shadow_reg_enable = false, /* TODO: fix bugs using this feature */
 };
 
 static const struct iwl_ht_params iwl6000_ht_params = {
@@ -425,9 +428,25 @@
 	IWL_DEVICE_6030,
 };
 
+#define IWL_DEVICE_6035						\
+	.fw_name_pre = IWL6030_FW_PRE,				\
+	.ucode_api_max = IWL6035_UCODE_API_MAX,			\
+	.ucode_api_ok = IWL6035_UCODE_API_OK,			\
+	.ucode_api_min = IWL6035_UCODE_API_MIN,			\
+	.max_inst_size = IWL60_RTC_INST_SIZE,			\
+	.max_data_size = IWL60_RTC_DATA_SIZE,			\
+	.eeprom_ver = EEPROM_6030_EEPROM_VERSION,		\
+	.eeprom_calib_ver = EEPROM_6030_TX_POWER_VERSION,	\
+	.lib = &iwl6030_lib,					\
+	.base_params = &iwl6000_g2_base_params,			\
+	.bt_params = &iwl6000_bt_params,			\
+	.need_temp_offset_calib = true,				\
+	.led_mode = IWL_LED_RF_STATE,				\
+	.adv_pm = true
+
 const struct iwl_cfg iwl6035_2agn_cfg = {
 	.name = "Intel(R) Centrino(R) Advanced-N 6235 AGN",
-	IWL_DEVICE_6030,
+	IWL_DEVICE_6035,
 	.ht_params = &iwl6000_ht_params,
 };
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 7e590b3..7db5d45 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -709,11 +709,14 @@
  */
 static bool rs_use_green(struct ieee80211_sta *sta)
 {
-	struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
-	struct iwl_rxon_context *ctx = sta_priv->ctx;
-
-	return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) &&
-		!(ctx->ht.non_gf_sta_present);
+	/*
+	 * There's a bug somewhere in this code that causes the
+	 * scaling to get stuck because GF+SGI can't be combined
+	 * in SISO rates. Until we find that bug, disable GF, it
+	 * has only limited benefit and we still interoperate with
+	 * GF APs since we can always receive GF transmissions.
+	 */
+	return false;
 }
 
 /**
@@ -884,6 +887,7 @@
 	if ((priv->bt_traffic_load != priv->last_bt_traffic_load) ||
 	    (priv->bt_full_concurrent != full_concurrent)) {
 		priv->bt_full_concurrent = full_concurrent;
+		priv->last_bt_traffic_load = priv->bt_traffic_load;
 
 		/* Update uCode's rate table. */
 		tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index c417560..8be535f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -191,6 +191,7 @@
 	mimo_ps_mode = (sta_ht_inf->cap & IEEE80211_HT_CAP_SM_PS) >> 2;
 
 	IWL_DEBUG_INFO(priv, "STA %pM SM PS mode: %s\n",
+			sta->addr,
 			(mimo_ps_mode == WLAN_HT_CAP_SM_PS_STATIC) ?
 			"static" :
 			(mimo_ps_mode == WLAN_HT_CAP_SM_PS_DYNAMIC) ?
@@ -1222,7 +1223,7 @@
 		key_flags |= STA_KEY_MULTICAST_MSK;
 
 	sta_cmd.key.key_flags = key_flags;
-	sta_cmd.key.key_offset = WEP_INVALID_OFFSET;
+	sta_cmd.key.key_offset = keyconf->hw_key_idx;
 	sta_cmd.sta.modify_mask = STA_MODIFY_KEY_MASK;
 	sta_cmd.mode = STA_CONTROL_MODIFY_MSK;
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index 23cea42..79dddc4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -513,28 +513,28 @@
  * iwl_get_max_txpower_avg - get the highest tx power from all chains.
  *     find the highest tx power from all chains for the channel
  */
-static s8 iwl_get_max_txpower_avg(const struct iwl_cfg *cfg,
+static s8 iwl_get_max_txpower_avg(struct iwl_priv *priv,
 		struct iwl_eeprom_enhanced_txpwr *enhanced_txpower,
 		int element, s8 *max_txpower_in_half_dbm)
 {
 	s8 max_txpower_avg = 0; /* (dBm) */
 
 	/* Take the highest tx power from any valid chains */
-	if ((cfg->valid_tx_ant & ANT_A) &&
+	if ((hw_params(priv).valid_tx_ant & ANT_A) &&
 	    (enhanced_txpower[element].chain_a_max > max_txpower_avg))
 		max_txpower_avg = enhanced_txpower[element].chain_a_max;
-	if ((cfg->valid_tx_ant & ANT_B) &&
+	if ((hw_params(priv).valid_tx_ant & ANT_B) &&
 	    (enhanced_txpower[element].chain_b_max > max_txpower_avg))
 		max_txpower_avg = enhanced_txpower[element].chain_b_max;
-	if ((cfg->valid_tx_ant & ANT_C) &&
+	if ((hw_params(priv).valid_tx_ant & ANT_C) &&
 	    (enhanced_txpower[element].chain_c_max > max_txpower_avg))
 		max_txpower_avg = enhanced_txpower[element].chain_c_max;
-	if (((cfg->valid_tx_ant == ANT_AB) |
-	    (cfg->valid_tx_ant == ANT_BC) |
-	    (cfg->valid_tx_ant == ANT_AC)) &&
+	if (((hw_params(priv).valid_tx_ant == ANT_AB) |
+	    (hw_params(priv).valid_tx_ant == ANT_BC) |
+	    (hw_params(priv).valid_tx_ant == ANT_AC)) &&
 	    (enhanced_txpower[element].mimo2_max > max_txpower_avg))
 		max_txpower_avg =  enhanced_txpower[element].mimo2_max;
-	if ((cfg->valid_tx_ant == ANT_ABC) &&
+	if ((hw_params(priv).valid_tx_ant == ANT_ABC) &&
 	    (enhanced_txpower[element].mimo3_max > max_txpower_avg))
 		max_txpower_avg = enhanced_txpower[element].mimo3_max;
 
@@ -637,7 +637,7 @@
 				 ((txp->delta_20_in_40 & 0xf0) >> 4),
 				 (txp->delta_20_in_40 & 0x0f));
 
-		max_txp_avg = iwl_get_max_txpower_avg(cfg(priv), txp_array, idx,
+		max_txp_avg = iwl_get_max_txpower_avg(priv, txp_array, idx,
 						      &max_txp_avg_halfdbm);
 
 		/*
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
index c24a713..e0e6c67 100644
--- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
+++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
@@ -196,6 +196,7 @@
 			    WIPHY_FLAG_DISABLE_BEACON_HINTS |
 			    WIPHY_FLAG_IBSS_RSN;
 
+#ifdef CONFIG_PM_SLEEP
 	if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len &&
 	    trans(priv)->ops->wowlan_suspend &&
 	    device_can_wakeup(trans(priv)->dev)) {
@@ -214,6 +215,7 @@
 		hw->wiphy->wowlan.pattern_max_len =
 					IWLAGN_WOWLAN_MAX_PATTERN_LEN;
 	}
+#endif
 
 	if (iwlagn_mod_params.power_save)
 		hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
@@ -243,6 +245,7 @@
 	ret = ieee80211_register_hw(priv->hw);
 	if (ret) {
 		IWL_ERR(priv, "Failed to register hw (error %d)\n", ret);
+		iwl_leds_exit(priv);
 		return ret;
 	}
 	priv->mac80211_registered = 1;
@@ -785,6 +788,18 @@
 	switch (op) {
 	case ADD:
 		ret = iwlagn_mac_sta_add(hw, vif, sta);
+		if (ret)
+			break;
+		/*
+		 * Clear the in-progress flag, the AP station entry was added
+		 * but we'll initialize LQ only when we've associated (which
+		 * would also clear the in-progress flag). This is necessary
+		 * in case we never initialize LQ because association fails.
+		 */
+		spin_lock_bh(&priv->sta_lock);
+		priv->stations[iwl_sta_id(sta)].used &=
+			~IWL_STA_UCODE_INPROGRESS;
+		spin_unlock_bh(&priv->sta_lock);
 		break;
 	case REMOVE:
 		ret = iwlagn_mac_sta_remove(hw, vif, sta);
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h
index 3b10692..dfd5466 100644
--- a/drivers/net/wireless/iwlwifi/iwl-prph.h
+++ b/drivers/net/wireless/iwlwifi/iwl-prph.h
@@ -224,6 +224,7 @@
 #define SCD_TXFACT		(SCD_BASE + 0x10)
 #define SCD_ACTIVE		(SCD_BASE + 0x14)
 #define SCD_QUEUECHAIN_SEL	(SCD_BASE + 0xe8)
+#define SCD_CHAINEXT_EN		(SCD_BASE + 0x244)
 #define SCD_AGGR_SEL		(SCD_BASE + 0x248)
 #define SCD_INTERRUPT_MASK	(SCD_BASE + 0x108)
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
index 1c2fe87..3b844b7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
@@ -342,7 +342,7 @@
 				 enum iwl_rxon_context_id ctx,
 				 int sta_id, int tid, int frame_limit, u16 ssn);
 void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
-	int index, enum dma_data_direction dma_dir);
+			 enum dma_data_direction dma_dir);
 int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
 			 struct sk_buff_head *skbs);
 int iwl_queue_space(const struct iwl_queue *q);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
index e92972f..d7964b1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
@@ -237,32 +237,38 @@
 	for (i = 1; i < num_tbs; i++)
 		dma_unmap_single(trans->dev, iwl_tfd_tb_get_addr(tfd, i),
 				iwl_tfd_tb_get_len(tfd, i), dma_dir);
+
+	tfd->num_tbs = 0;
 }
 
 /**
  * iwlagn_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr]
  * @trans - transport private data
  * @txq - tx queue
- * @index - the index of the TFD to be freed
- *@dma_dir - the direction of the DMA mapping
+ * @dma_dir - the direction of the DMA mapping
  *
  * Does NOT advance any TFD circular buffer read/write indexes
  * Does NOT free the TFD itself (which is within circular buffer)
  */
 void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
-	int index, enum dma_data_direction dma_dir)
+			 enum dma_data_direction dma_dir)
 {
 	struct iwl_tfd *tfd_tmp = txq->tfds;
 
+	/* rd_ptr is bounded by n_bd and idx is bounded by n_window */
+	int rd_ptr = txq->q.read_ptr;
+	int idx = get_cmd_index(&txq->q, rd_ptr);
+
 	lockdep_assert_held(&txq->lock);
 
-	iwlagn_unmap_tfd(trans, &txq->meta[index], &tfd_tmp[index], dma_dir);
+	/* We have only q->n_window txq->entries, but we use q->n_bd tfds */
+	iwlagn_unmap_tfd(trans, &txq->meta[idx], &tfd_tmp[rd_ptr], dma_dir);
 
 	/* free SKB */
 	if (txq->skbs) {
 		struct sk_buff *skb;
 
-		skb = txq->skbs[index];
+		skb = txq->skbs[idx];
 
 		/* Can be called from irqs-disabled context
 		 * If skb is not NULL, it means that the whole queue is being
@@ -270,7 +276,7 @@
 		 */
 		if (skb) {
 			iwl_op_mode_free_skb(trans->op_mode, skb);
-			txq->skbs[index] = NULL;
+			txq->skbs[idx] = NULL;
 		}
 	}
 }
@@ -1100,7 +1106,7 @@
 
 		iwlagn_txq_inval_byte_cnt_tbl(trans, txq);
 
-		iwlagn_txq_free_tfd(trans, txq, txq->q.read_ptr, DMA_TO_DEVICE);
+		iwlagn_txq_free_tfd(trans, txq, DMA_TO_DEVICE);
 		freed++;
 	}
 	return freed;
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 4d7b30d..8741048 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -430,9 +430,7 @@
 
 	spin_lock_bh(&txq->lock);
 	while (q->write_ptr != q->read_ptr) {
-		/* The read_ptr needs to bound by q->n_window */
-		iwlagn_txq_free_tfd(trans, txq, get_cmd_index(q, q->read_ptr),
-				    dma_dir);
+		iwlagn_txq_free_tfd(trans, txq, dma_dir);
 		q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd);
 	}
 	spin_unlock_bh(&txq->lock);
@@ -1128,6 +1126,11 @@
 	iwl_write_prph(trans, SCD_DRAM_BASE_ADDR,
 		       trans_pcie->scd_bc_tbls.dma >> 10);
 
+	/* The chain extension of the SCD doesn't work well. This feature is
+	 * enabled by default by the HW, so we need to disable it manually.
+	 */
+	iwl_write_prph(trans, SCD_CHAINEXT_EN, 0);
+
 	/* Enable DMA channel */
 	for (chan = 0; chan < FH_TCSR_CHNL_NUM ; chan++)
 		iwl_write_direct32(trans, FH_TCSR_CHNL_TX_CONFIG_REG(chan),
@@ -1997,6 +2000,7 @@
 	return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
 }
 
+#ifdef CONFIG_IWLWIFI_DEBUG
 static ssize_t iwl_dbgfs_log_event_read(struct file *file,
 					 char __user *user_buf,
 					 size_t count, loff_t *ppos)
@@ -2034,6 +2038,7 @@
 
 	return count;
 }
+#endif
 
 static ssize_t iwl_dbgfs_interrupt_read(struct file *file,
 					char __user *user_buf,
@@ -2161,7 +2166,9 @@
 	return ret;
 }
 
+#ifdef CONFIG_IWLWIFI_DEBUG
 DEBUGFS_READ_WRITE_FILE_OPS(log_event);
+#endif
 DEBUGFS_READ_WRITE_FILE_OPS(interrupt);
 DEBUGFS_READ_FILE_OPS(fh_reg);
 DEBUGFS_READ_FILE_OPS(rx_queue);
@@ -2177,7 +2184,9 @@
 {
 	DEBUGFS_ADD_FILE(rx_queue, dir, S_IRUSR);
 	DEBUGFS_ADD_FILE(tx_queue, dir, S_IRUSR);
+#ifdef CONFIG_IWLWIFI_DEBUG
 	DEBUGFS_ADD_FILE(log_event, dir, S_IWUSR | S_IRUSR);
+#endif
 	DEBUGFS_ADD_FILE(interrupt, dir, S_IWUSR | S_IRUSR);
 	DEBUGFS_ADD_FILE(csr, dir, S_IWUSR);
 	DEBUGFS_ADD_FILE(fh_reg, dir, S_IRUSR);
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c
index 9c44088..900ee12 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c
@@ -256,7 +256,8 @@
 	else
 		last_seq = priv->rx_seq[tid];
 
-	if (last_seq >= new_node->start_win)
+	if (last_seq != MWIFIEX_DEF_11N_RX_SEQ_NUM &&
+	    last_seq >= new_node->start_win)
 		new_node->start_win = last_seq + 1;
 
 	new_node->win_size = win_size;
@@ -596,5 +597,5 @@
 	spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
 
 	INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr);
-	memset(priv->rx_seq, 0, sizeof(priv->rx_seq));
+	mwifiex_reset_11n_rx_seq_num(priv);
 }
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.h b/drivers/net/wireless/mwifiex/11n_rxreorder.h
index f1bffeb..6c9815a 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.h
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.h
@@ -37,6 +37,13 @@
 
 #define ADDBA_RSP_STATUS_ACCEPT 0
 
+#define MWIFIEX_DEF_11N_RX_SEQ_NUM	0xffff
+
+static inline void mwifiex_reset_11n_rx_seq_num(struct mwifiex_private *priv)
+{
+	memset(priv->rx_seq, 0xff, sizeof(priv->rx_seq));
+}
+
 int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *,
 			       u16 seqNum,
 			       u16 tid, u8 *ta,
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 6505038..03560a8 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -544,9 +544,9 @@
 
 	/*
 	 * Bit 0 in tx_htinfo indicates that current Tx rate is 11n rate. Valid
-	 * MCS index values for us are 0 to 7.
+	 * MCS index values for us are 0 to 15.
 	 */
-	if ((priv->tx_htinfo & BIT(0)) && (priv->tx_rate < 8)) {
+	if ((priv->tx_htinfo & BIT(0)) && (priv->tx_rate < 16)) {
 		sinfo->txrate.mcs = priv->tx_rate;
 		sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS;
 		/* 40MHz rate */
@@ -1214,11 +1214,11 @@
 	void *mdev_priv;
 
 	if (!priv)
-		return NULL;
+		return ERR_PTR(-EFAULT);
 
 	adapter = priv->adapter;
 	if (!adapter)
-		return NULL;
+		return ERR_PTR(-EFAULT);
 
 	switch (type) {
 	case NL80211_IFTYPE_UNSPECIFIED:
@@ -1227,7 +1227,7 @@
 		if (priv->bss_mode) {
 			wiphy_err(wiphy, "cannot create multiple"
 					" station/adhoc interfaces\n");
-			return NULL;
+			return ERR_PTR(-EINVAL);
 		}
 
 		if (type == NL80211_IFTYPE_UNSPECIFIED)
@@ -1244,14 +1244,15 @@
 		break;
 	default:
 		wiphy_err(wiphy, "type not supported\n");
-		return NULL;
+		return ERR_PTR(-EINVAL);
 	}
 
 	dev = alloc_netdev_mq(sizeof(struct mwifiex_private *), name,
 			      ether_setup, 1);
 	if (!dev) {
 		wiphy_err(wiphy, "no memory available for netdevice\n");
-		goto error;
+		priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
+		return ERR_PTR(-ENOMEM);
 	}
 
 	dev_net_set(dev, wiphy_net(wiphy));
@@ -1276,7 +1277,9 @@
 	/* Register network device */
 	if (register_netdevice(dev)) {
 		wiphy_err(wiphy, "cannot register virtual network device\n");
-		goto error;
+		free_netdev(dev);
+		priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
+		return ERR_PTR(-EFAULT);
 	}
 
 	sema_init(&priv->async_sem, 1);
@@ -1288,12 +1291,6 @@
 	mwifiex_dev_debugfs_init(priv);
 #endif
 	return dev;
-error:
-	if (dev && (dev->reg_state == NETREG_UNREGISTERED))
-		free_netdev(dev);
-	priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
-
-	return NULL;
 }
 EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf);
 
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 5a7316c..3e6abf0 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -404,6 +404,8 @@
 		priv->add_ba_param.tx_win_size = MWIFIEX_AMPDU_DEF_TXWINSIZE;
 		priv->add_ba_param.rx_win_size = MWIFIEX_AMPDU_DEF_RXWINSIZE;
 
+		mwifiex_reset_11n_rx_seq_num(priv);
+
 		atomic_set(&priv->wmm.tx_pkts_queued, 0);
 		atomic_set(&priv->wmm.highest_queued_prio, HIGH_PRIO_TID);
 	}
@@ -1209,6 +1211,7 @@
 
 	if (!ptr->is_11n_enabled ||
 	    mwifiex_is_ba_stream_setup(priv, ptr, tid) ||
+	    priv->wps.session_enable ||
 	    ((priv->sec_info.wpa_enabled ||
 	      priv->sec_info.wpa2_enabled) &&
 	     !priv->wpa_is_gtk_set)) {
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 001735f..7e1a492 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -922,6 +922,7 @@
 	{ USB_DEVICE(0x1482, 0x3c09) },
 	/* AirTies */
 	{ USB_DEVICE(0x1eda, 0x2012) },
+	{ USB_DEVICE(0x1eda, 0x2210) },
 	{ USB_DEVICE(0x1eda, 0x2310) },
 	/* Allwin */
 	{ USB_DEVICE(0x8516, 0x2070) },
@@ -970,6 +971,7 @@
 	{ USB_DEVICE(0x0411, 0x015d) },
 	{ USB_DEVICE(0x0411, 0x016f) },
 	{ USB_DEVICE(0x0411, 0x01a2) },
+	{ USB_DEVICE(0x0411, 0x01ee) },
 	/* Corega */
 	{ USB_DEVICE(0x07aa, 0x002f) },
 	{ USB_DEVICE(0x07aa, 0x003c) },
@@ -991,6 +993,7 @@
 	/* DVICO */
 	{ USB_DEVICE(0x0fe9, 0xb307) },
 	/* Edimax */
+	{ USB_DEVICE(0x7392, 0x4085) },
 	{ USB_DEVICE(0x7392, 0x7711) },
 	{ USB_DEVICE(0x7392, 0x7717) },
 	{ USB_DEVICE(0x7392, 0x7718) },
@@ -1066,6 +1069,7 @@
 	/* Philips */
 	{ USB_DEVICE(0x0471, 0x200f) },
 	/* Planex */
+	{ USB_DEVICE(0x2019, 0x5201) },
 	{ USB_DEVICE(0x2019, 0xab25) },
 	{ USB_DEVICE(0x2019, 0xed06) },
 	/* Quanta */
@@ -1134,6 +1138,12 @@
 #ifdef CONFIG_RT2800USB_RT33XX
 	/* Belkin */
 	{ USB_DEVICE(0x050d, 0x945b) },
+	/* D-Link */
+	{ USB_DEVICE(0x2001, 0x3c17) },
+	/* Panasonic */
+	{ USB_DEVICE(0x083a, 0xb511) },
+	/* Philips */
+	{ USB_DEVICE(0x0471, 0x20dd) },
 	/* Ralink */
 	{ USB_DEVICE(0x148f, 0x3370) },
 	{ USB_DEVICE(0x148f, 0x8070) },
@@ -1145,6 +1155,8 @@
 	{ USB_DEVICE(0x8516, 0x3572) },
 	/* Askey */
 	{ USB_DEVICE(0x1690, 0x0744) },
+	{ USB_DEVICE(0x1690, 0x0761) },
+	{ USB_DEVICE(0x1690, 0x0764) },
 	/* Cisco */
 	{ USB_DEVICE(0x167b, 0x4001) },
 	/* EnGenius */
@@ -1159,20 +1171,25 @@
 	/* Sitecom */
 	{ USB_DEVICE(0x0df6, 0x0041) },
 	{ USB_DEVICE(0x0df6, 0x0062) },
+	{ USB_DEVICE(0x0df6, 0x0065) },
+	{ USB_DEVICE(0x0df6, 0x0066) },
+	{ USB_DEVICE(0x0df6, 0x0068) },
 	/* Toshiba */
 	{ USB_DEVICE(0x0930, 0x0a07) },
 	/* Zinwell */
 	{ USB_DEVICE(0x5a57, 0x0284) },
 #endif
 #ifdef CONFIG_RT2800USB_RT53XX
-	/* Alpha */
-	{ USB_DEVICE(0x2001, 0x3c15) },
-	{ USB_DEVICE(0x2001, 0x3c19) },
 	/* Arcadyan */
 	{ USB_DEVICE(0x043e, 0x7a12) },
 	/* Azurewave */
 	{ USB_DEVICE(0x13d3, 0x3329) },
 	{ USB_DEVICE(0x13d3, 0x3365) },
+	/* D-Link */
+	{ USB_DEVICE(0x2001, 0x3c15) },
+	{ USB_DEVICE(0x2001, 0x3c19) },
+	{ USB_DEVICE(0x2001, 0x3c1c) },
+	{ USB_DEVICE(0x2001, 0x3c1d) },
 	/* LG innotek */
 	{ USB_DEVICE(0x043e, 0x7a22) },
 	/* Panasonic */
@@ -1223,13 +1240,8 @@
 	/* D-Link */
 	{ USB_DEVICE(0x07d1, 0x3c0b) },
 	{ USB_DEVICE(0x07d1, 0x3c17) },
-	{ USB_DEVICE(0x2001, 0x3c17) },
-	/* Edimax */
-	{ USB_DEVICE(0x7392, 0x4085) },
 	/* Encore */
 	{ USB_DEVICE(0x203d, 0x14a1) },
-	/* Fujitsu Stylistic 550 */
-	{ USB_DEVICE(0x1690, 0x0761) },
 	/* Gemtek */
 	{ USB_DEVICE(0x15a9, 0x0010) },
 	/* Gigabyte */
@@ -1250,7 +1262,6 @@
 	{ USB_DEVICE(0x05a6, 0x0101) },
 	{ USB_DEVICE(0x1d4d, 0x0010) },
 	/* Planex */
-	{ USB_DEVICE(0x2019, 0x5201) },
 	{ USB_DEVICE(0x2019, 0xab24) },
 	/* Qcom */
 	{ USB_DEVICE(0x18e8, 0x6259) },
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 471f87c..c264dfa 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -396,8 +396,7 @@
 	 * for hardware which doesn't support hardware
 	 * sequence counting.
 	 */
-	spinlock_t seqlock;
-	u16 seqno;
+	atomic_t seqno;
 };
 
 static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif)
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 2df2eb6..a8885f0 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -277,7 +277,6 @@
 	else
 		rt2x00dev->intf_sta_count++;
 
-	spin_lock_init(&intf->seqlock);
 	mutex_init(&intf->beacon_skb_mutex);
 	intf->beacon = entry;
 
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 9b1b2b7..50f92d5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -207,6 +207,7 @@
 	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
+	u16 seqno;
 
 	if (!(tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ))
 		return;
@@ -227,15 +228,13 @@
 	 * sequence counting per-frame, since those will override the
 	 * sequence counter given by mac80211.
 	 */
-	spin_lock(&intf->seqlock);
-
 	if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
-		intf->seqno += 0x10;
+		seqno = atomic_add_return(0x10, &intf->seqno);
+	else
+		seqno = atomic_read(&intf->seqno);
+
 	hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
-	hdr->seq_ctrl |= cpu_to_le16(intf->seqno);
-
-	spin_unlock(&intf->seqlock);
-
+	hdr->seq_ctrl |= cpu_to_le16(seqno);
 }
 
 static void rt2x00queue_create_tx_descriptor_plcp(struct rt2x00_dev *rt2x00dev,
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 66094eb..507085f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -436,8 +436,8 @@
 	case QID_RX:
 		if (!rt2x00queue_full(queue))
 			rt2x00queue_for_each_entry(queue,
-						   Q_INDEX_DONE,
 						   Q_INDEX,
+						   Q_INDEX_DONE,
 						   NULL,
 						   rt2x00usb_kick_rx_entry);
 		break;
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index e0c6d11..0f4bf8c 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2243,8 +2243,7 @@
 
 static void rt61pci_wakeup(struct rt2x00_dev *rt2x00dev)
 {
-	struct ieee80211_conf conf = { .flags = 0 };
-	struct rt2x00lib_conf libconf = { .conf = &conf };
+	struct rt2x00lib_conf libconf = { .conf = &rt2x00dev->hw->conf };
 
 	rt61pci_config(rt2x00dev, &libconf, IEEE80211_CONF_CHANGE_PS);
 }
diff --git a/drivers/net/wireless/rtl818x/rtl8187/leds.c b/drivers/net/wireless/rtl818x/rtl8187/leds.c
index 2e0de2f..c2d5b49 100644
--- a/drivers/net/wireless/rtl818x/rtl8187/leds.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/leds.c
@@ -117,7 +117,7 @@
 			radio_on = true;
 		} else if (radio_on) {
 			radio_on = false;
-			cancel_delayed_work_sync(&priv->led_on);
+			cancel_delayed_work(&priv->led_on);
 			ieee80211_queue_delayed_work(hw, &priv->led_off, 0);
 		}
 	} else if (radio_on) {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 82c85286..5bd4085 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -301,9 +301,11 @@
 	{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
 	{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
 	{RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
+	{RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/
 	{RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
 	{RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
 	{RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/
+	{RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/
 	/* HP - Lite-On ,8188CUS Slim Combo */
 	{RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)},
 	{RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */
@@ -345,6 +347,7 @@
 	{RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/
 	{RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/
 	{RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
+	{RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/
 	{RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/
 	{RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/
 	{RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
index 28fc5fb..46f7917 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
@@ -3344,21 +3344,21 @@
 	switch (rtlhal->macphymode) {
 	case DUALMAC_SINGLEPHY:
 		rtlphy->rf_type = RF_2T2R;
-		rtlhal->version |= CHIP_92D_SINGLEPHY;
+		rtlhal->version |= RF_TYPE_2T2R;
 		rtlhal->bandset = BAND_ON_BOTH;
 		rtlhal->current_bandtype = BAND_ON_2_4G;
 		break;
 
 	case SINGLEMAC_SINGLEPHY:
 		rtlphy->rf_type = RF_2T2R;
-		rtlhal->version |= CHIP_92D_SINGLEPHY;
+		rtlhal->version |= RF_TYPE_2T2R;
 		rtlhal->bandset = BAND_ON_BOTH;
 		rtlhal->current_bandtype = BAND_ON_2_4G;
 		break;
 
 	case DUALMAC_DUALPHY:
 		rtlphy->rf_type = RF_1T1R;
-		rtlhal->version &= (~CHIP_92D_SINGLEPHY);
+		rtlhal->version &= RF_TYPE_1T1R;
 		/* Now we let MAC0 run on 5G band. */
 		if (rtlhal->interfaceindex == 0) {
 			rtlhal->bandset = BAND_ON_5G;
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index a6049d7..aa970fc 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -131,15 +131,19 @@
 	u8 request;
 	u16 wvalue;
 	u16 index;
-	__le32 *data = &rtlpriv->usb_data[rtlpriv->usb_data_index];
+	__le32 *data;
+	unsigned long flags;
 
+	spin_lock_irqsave(&rtlpriv->locks.usb_lock, flags);
+	if (++rtlpriv->usb_data_index >= RTL_USB_MAX_RX_COUNT)
+		rtlpriv->usb_data_index = 0;
+	data = &rtlpriv->usb_data[rtlpriv->usb_data_index];
+	spin_unlock_irqrestore(&rtlpriv->locks.usb_lock, flags);
 	request = REALTEK_USB_VENQT_CMD_REQ;
 	index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */
 
 	wvalue = (u16)addr;
 	_usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len);
-	if (++rtlpriv->usb_data_index >= RTL_USB_MAX_RX_COUNT)
-		rtlpriv->usb_data_index = 0;
 	return le32_to_cpu(*data);
 }
 
@@ -951,6 +955,10 @@
 				    GFP_KERNEL);
 	if (!rtlpriv->usb_data)
 		return -ENOMEM;
+
+	/* this spin lock must be initialized early */
+	spin_lock_init(&rtlpriv->locks.usb_lock);
+
 	rtlpriv->usb_data_index = 0;
 	init_completion(&rtlpriv->firmware_loading_complete);
 	SET_IEEE80211_DEV(hw, &intf->dev);
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 28ebc69..717d3ba 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -1555,6 +1555,7 @@
 	spinlock_t rf_ps_lock;
 	spinlock_t rf_lock;
 	spinlock_t waitq_lock;
+	spinlock_t usb_lock;
 
 	/*Dual mac*/
 	spinlock_t cck_and_rw_pagea_lock;
diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c
index 1b851f6..e2750a1 100644
--- a/drivers/net/wireless/wl1251/sdio.c
+++ b/drivers/net/wireless/wl1251/sdio.c
@@ -260,6 +260,7 @@
 	}
 
 	if (wl->irq) {
+		irq_set_status_flags(wl->irq, IRQ_NOAUTOEN);
 		ret = request_irq(wl->irq, wl1251_line_irq, 0, "wl1251", wl);
 		if (ret < 0) {
 			wl1251_error("request_irq() failed: %d", ret);
@@ -267,7 +268,6 @@
 		}
 
 		irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);
-		disable_irq(wl->irq);
 
 		wl1251_sdio_ops.enable_irq = wl1251_enable_line_irq;
 		wl1251_sdio_ops.disable_irq = wl1251_disable_line_irq;
diff --git a/drivers/net/wireless/wl1251/spi.c b/drivers/net/wireless/wl1251/spi.c
index 6248c35..87f6305 100644
--- a/drivers/net/wireless/wl1251/spi.c
+++ b/drivers/net/wireless/wl1251/spi.c
@@ -281,6 +281,7 @@
 
 	wl->use_eeprom = pdata->use_eeprom;
 
+	irq_set_status_flags(wl->irq, IRQ_NOAUTOEN);
 	ret = request_irq(wl->irq, wl1251_irq, 0, DRIVER_NAME, wl);
 	if (ret < 0) {
 		wl1251_error("request_irq() failed: %d", ret);
@@ -289,8 +290,6 @@
 
 	irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);
 
-	disable_irq(wl->irq);
-
 	ret = wl1251_init_ieee80211(wl);
 	if (ret)
 		goto out_irq;
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 0ebbb19..796afbf 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1935,14 +1935,14 @@
 
 	dev_dbg(&dev->dev, "%s\n", dev->nodename);
 
-	unregister_netdev(info->netdev);
-
 	xennet_disconnect_backend(info);
 
-	del_timer_sync(&info->rx_refill_timer);
-
 	xennet_sysfs_delif(info->netdev);
 
+	unregister_netdev(info->netdev);
+
+	del_timer_sync(&info->rx_refill_timer);
+
 	free_percpu(info->stats);
 
 	free_netdev(info->netdev);
diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c
index da14432..efc4b7f 100644
--- a/drivers/oprofile/oprofile_perf.c
+++ b/drivers/oprofile/oprofile_perf.c
@@ -25,7 +25,7 @@
 static DEFINE_MUTEX(oprofile_perf_mutex);
 
 static struct op_counter_config *counter_config;
-static struct perf_event **perf_events[nr_cpumask_bits];
+static struct perf_event **perf_events[NR_CPUS];
 static int num_counters;
 
 /*
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 9a18a97..9c1d37b 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -725,6 +725,18 @@
 
 	pci_pm_set_unknown_state(pci_dev);
 
+	/*
+	 * Some BIOSes from ASUS have a bug: If a USB EHCI host controller's
+	 * PCI COMMAND register isn't 0, the BIOS assumes that the controller
+	 * hasn't been quiesced and tries to turn it off.  If the controller
+	 * is already in D3, this can hang or cause memory corruption.
+	 *
+	 * Since the value of the COMMAND register doesn't matter once the
+	 * device has been suspended, we can safely set it to 0 here.
+	 */
+	if (pci_dev->class == PCI_CLASS_SERIAL_USB_EHCI)
+		pci_write_config_word(pci_dev, PCI_COMMAND, 0);
+
 	return 0;
 }
 
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 77aadde..556cbb4 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1467,14 +1467,9 @@
 	 */
 	if (!asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS, 0, 0, NULL))
 		asus->dsts_id = ASUS_WMI_METHODID_DSTS;
-	else if (!asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS2, 0, 0, NULL))
+	else
 		asus->dsts_id = ASUS_WMI_METHODID_DSTS2;
 
-	if (!asus->dsts_id) {
-		pr_err("Can't find DSTS");
-		return -ENODEV;
-	}
-
 	/* CWAP allow to define the behavior of the Fn+F2 key,
 	 * this method doesn't seems to be present on Eee PCs */
 	if (asus->driver->quirks->wapf >= 0)
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 0ffdb3c..9af4257 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -72,6 +72,7 @@
 #include <linux/string.h>
 #include <linux/tick.h>
 #include <linux/timer.h>
+#include <linux/dmi.h>
 #include <drm/i915_drm.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
@@ -1485,6 +1486,24 @@
 
 MODULE_DEVICE_TABLE(pci, ips_id_table);
 
+static int ips_blacklist_callback(const struct dmi_system_id *id)
+{
+	pr_info("Blacklisted intel_ips for %s\n", id->ident);
+	return 1;
+}
+
+static const struct dmi_system_id ips_blacklist[] = {
+	{
+		.callback = ips_blacklist_callback,
+		.ident = "HP ProBook",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook"),
+		},
+	},
+	{ }	/* terminating entry */
+};
+
 static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
 	u64 platform_info;
@@ -1494,6 +1513,9 @@
 	u16 htshi, trc, trc_required_mask;
 	u8 tse;
 
+	if (dmi_check_system(ips_blacklist))
+		return -ENODEV;
+
 	ips = kzalloc(sizeof(struct ips_driver), GFP_KERNEL);
 	if (!ips)
 		return -ENOMEM;
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index f84b527..bee4e19 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -54,8 +54,13 @@
 obj-$(CONFIG_BATTERY_BQ27541)	+= bq27541_fuelgauger.o
 obj-$(CONFIG_SMB137B_CHARGER)   += smb137b.o
 obj-$(CONFIG_PM8XXX_CCADC)	+= pm8xxx-ccadc.o
+ifeq ($(CONFIG_HTC_BATT_8960),y)
+obj-$(CONFIG_PM8921_BMS)	+= pm8921-bms-htc.o
+obj-$(CONFIG_PM8921_CHARGER)	+= pm8921-charger-htc.o
+else
 obj-$(CONFIG_PM8921_BMS)	+= pm8921-bms.o
 obj-$(CONFIG_PM8921_CHARGER)	+= pm8921-charger.o
+endif
 obj-$(CONFIG_LTC4088_CHARGER)	+= ltc4088-charger.o
 obj-$(CONFIG_CHARGER_SMB347)	+= smb347-charger.o
 obj-$(CONFIG_BATTERY_BCL)	+= battery_current_limit.o
diff --git a/drivers/power/pm8921-bms-htc.c b/drivers/power/pm8921-bms-htc.c
new file mode 100644
index 0000000..65b6400
--- /dev/null
+++ b/drivers/power/pm8921-bms-htc.c
@@ -0,0 +1,2896 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#define pr_fmt(fmt)	"[BATT][BMS] " fmt
+#define pr_fmt_debug(fmt)    "[BATT][BMS]%s: " fmt, __func__
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/platform_device.h>
+#include <linux/errno.h>
+#include <linux/mfd/pm8xxx/pm8921-bms-htc.h>
+#include <linux/mfd/pm8xxx/pm8921-charger-htc.h>
+#include <linux/mfd/pm8xxx/core.h>
+#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
+#include <linux/mfd/pm8xxx/ccadc.h>
+#include <linux/interrupt.h>
+#include <linux/bitops.h>
+#include <linux/debugfs.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/mutex.h>
+#include <mach/board_htc.h>
+
+#ifdef CONFIG_HTC_BATT_8960
+#include "mach/htc_battery_cell.h"
+#endif
+
+#if defined(pr_debug)
+#undef pr_debug
+#endif
+#define pr_debug(fmt, ...) do { \
+		if (flag_enable_bms_chg_log) \
+			printk(KERN_INFO pr_fmt_debug(fmt), ##__VA_ARGS__); \
+	} while (0)
+static bool flag_enable_bms_chg_log;
+
+#define BMS_CONTROL		0x224
+#define BMS_S1_DELAY	0x225
+#define BMS_OUTPUT0		0x230
+#define BMS_OUTPUT1		0x231
+#define BMS_TOLERANCES		0x232
+#define BMS_TEST1		0x237
+
+#define ADC_ARB_SECP_CNTRL	0x190
+#define ADC_ARB_SECP_AMUX_CNTRL	0x191
+#define ADC_ARB_SECP_ANA_PARAM	0x192
+#define ADC_ARB_SECP_DIG_PARAM	0x193
+#define ADC_ARB_SECP_RSV	0x194
+#define ADC_ARB_SECP_DATA1	0x195
+#define ADC_ARB_SECP_DATA0	0x196
+
+#define ADC_ARB_BMS_CNTRL	0x18D
+#define AMUX_TRIM_2			0x322
+#define TEST_PROGRAM_REV	0x339
+
+#define OCV_UPDATE_STORAGE	0x105
+#define OCV_UPDATE_STORAGE_USE_MASK	0x0F
+
+enum pmic_bms_interrupts {
+	PM8921_BMS_SBI_WRITE_OK,
+	PM8921_BMS_CC_THR,
+	PM8921_BMS_VSENSE_THR,
+	PM8921_BMS_VSENSE_FOR_R,
+	PM8921_BMS_OCV_FOR_R,
+	PM8921_BMS_GOOD_OCV,
+	PM8921_BMS_VSENSE_AVG,
+	PM_BMS_MAX_INTS,
+};
+
+struct pm8921_soc_params {
+	uint16_t	last_good_ocv_raw;
+	int		cc;
+
+	int		last_good_ocv_uv;
+};
+
+struct pm8921_rbatt_params {
+	uint16_t	ocv_for_rbatt_raw;
+	uint16_t	vsense_for_rbatt_raw;
+	uint16_t	vbatt_for_rbatt_raw;
+
+	int		ocv_for_rbatt_uv;
+	int		vsense_for_rbatt_uv;
+	int		vbatt_for_rbatt_uv;
+};
+
+struct pm8921_bms_chip {
+	struct device		*dev;
+	struct dentry		*dent;
+	unsigned int		r_sense;
+	unsigned int		i_test;
+	unsigned int		v_failure;
+	unsigned int		fcc;
+	struct single_row_lut	*fcc_temp_lut;
+	struct single_row_lut	*fcc_sf_lut;
+	struct pc_temp_ocv_lut	*pc_temp_ocv_lut;
+	struct sf_lut		*pc_sf_lut;
+	struct sf_lut		*rbatt_sf_lut;
+	int			delta_rbatt_mohm;
+	struct work_struct	calib_hkadc_work;
+	unsigned int		revision;
+	unsigned int		xoadc_v0625_usb_present;
+	unsigned int		xoadc_v0625_usb_absent;
+	unsigned int		xoadc_v0625;
+	unsigned int		xoadc_v125;
+	unsigned int		batt_temp_channel;
+	unsigned int		vbat_channel;
+	unsigned int		ref625mv_channel;
+	unsigned int		ref1p25v_channel;
+	unsigned int		batt_id_channel;
+	unsigned int		pmic_bms_irq[PM_BMS_MAX_INTS];
+	DECLARE_BITMAP(enabled_irqs, PM_BMS_MAX_INTS);
+	struct mutex		bms_output_lock;
+	spinlock_t		bms_100_lock;
+	struct single_row_lut	*adjusted_fcc_temp_lut;
+	unsigned int		charging_began;
+	int					start_percent;
+	int					end_percent;
+
+	uint16_t		ocv_reading_at_100;
+	int			cc_reading_at_100;
+	int			max_voltage_uv;
+	int			batt_temp_suspend;
+	int			soc_rbatt_suspend;
+	int			default_rbatt_mohm;
+	unsigned int	rconn_mohm;
+	int			amux_2_trim_delta;
+	uint16_t		prev_last_good_ocv_raw;
+	int			usb_chg_plugged_ready;
+};
+
+static struct pm8921_bms_chip *the_chip;
+
+struct pm8921_bms_debug {
+	int rbatt;
+	int rbatt_sf;
+	int voltage_unusable_uv;
+	int pc_unusable;
+	int rc_pc;
+	int scalefactor;
+	int batt_temp;
+	int soc_rbatt;
+};
+static struct pm8921_bms_debug bms_dbg;
+
+#define DEFAULT_RBATT_MOHMS		128
+#define DEFAULT_OCV_MICROVOLTS		3900000
+#define DEFAULT_CHARGE_CYCLES		0
+
+static int last_usb_cal_delta_uv = 1800;
+module_param(last_usb_cal_delta_uv, int, 0644);
+
+static int last_chargecycles = DEFAULT_CHARGE_CYCLES;
+static int last_charge_increase;
+module_param(last_chargecycles, int, 0644);
+module_param(last_charge_increase, int, 0644);
+
+static int last_rbatt = -EINVAL;
+static int last_ocv_uv = -EINVAL;
+static int last_soc = -EINVAL;
+static int last_real_fcc_mah = -EINVAL;
+static int last_real_fcc_batt_temp = -EINVAL;
+
+static int bms_ops_set(const char *val, const struct kernel_param *kp)
+{
+	if (*(int *)kp->arg == -EINVAL)
+		return param_set_int(val, kp);
+	else
+		return 0;
+}
+
+static struct kernel_param_ops bms_param_ops = {
+	.set = bms_ops_set,
+	.get = param_get_int,
+};
+
+module_param_cb(last_rbatt, &bms_param_ops, &last_rbatt, 0644);
+module_param_cb(last_ocv_uv, &bms_param_ops, &last_ocv_uv, 0644);
+module_param_cb(last_soc, &bms_param_ops, &last_soc, 0644);
+
+static int bms_fake_battery = -EINVAL;
+module_param(bms_fake_battery, int, 0644);
+
+static int bms_start_percent;
+static int bms_start_ocv_uv;
+static int bms_start_cc_uah;
+static int bms_end_percent;
+static int bms_end_ocv_uv;
+static int bms_end_cc_uah;
+static int bms_discharge_percent;
+static int is_ocv_update_start;
+
+static int bms_ro_ops_set(const char *val, const struct kernel_param *kp)
+{
+	return -EINVAL;
+}
+
+static struct kernel_param_ops bms_ro_param_ops = {
+	.set = bms_ro_ops_set,
+	.get = param_get_int,
+};
+module_param_cb(bms_start_percent, &bms_ro_param_ops, &bms_start_percent, 0644);
+module_param_cb(bms_start_ocv_uv, &bms_ro_param_ops, &bms_start_ocv_uv, 0644);
+module_param_cb(bms_start_cc_uah, &bms_ro_param_ops, &bms_start_cc_uah, 0644);
+
+module_param_cb(bms_end_percent, &bms_ro_param_ops, &bms_end_percent, 0644);
+module_param_cb(bms_end_ocv_uv, &bms_ro_param_ops, &bms_end_ocv_uv, 0644);
+module_param_cb(bms_end_cc_uah, &bms_ro_param_ops, &bms_end_cc_uah, 0644);
+
+static int dump_cc_uah(void);
+
+static int interpolate_fcc(struct pm8921_bms_chip *chip, int batt_temp);
+static void readjust_fcc_table(void)
+{
+	struct single_row_lut *temp, *old;
+	int i, fcc, ratio;
+
+	if (!the_chip->fcc_temp_lut) {
+		pr_err("The static fcc lut table is NULL\n");
+		return;
+	}
+
+	temp = kzalloc(sizeof(struct single_row_lut), GFP_KERNEL);
+	if (!temp) {
+		pr_err("Cannot allocate memory for adjusted fcc table\n");
+		return;
+	}
+
+	fcc = interpolate_fcc(the_chip, last_real_fcc_batt_temp);
+
+	temp->cols = the_chip->fcc_temp_lut->cols;
+	for (i = 0; i < the_chip->fcc_temp_lut->cols; i++) {
+		temp->x[i] = the_chip->fcc_temp_lut->x[i];
+		ratio = div_u64(the_chip->fcc_temp_lut->y[i] * 1000, fcc);
+		temp->y[i] =  (ratio * last_real_fcc_mah);
+		temp->y[i] /= 1000;
+		pr_debug("temp=%d, staticfcc=%d, adjfcc=%d, ratio=%d\n",
+				temp->x[i], the_chip->fcc_temp_lut->y[i],
+				temp->y[i], ratio);
+	}
+
+	old = the_chip->adjusted_fcc_temp_lut;
+	the_chip->adjusted_fcc_temp_lut = temp;
+	kfree(old);
+}
+
+static int bms_last_real_fcc_set(const char *val,
+				const struct kernel_param *kp)
+{
+	int rc = 0;
+
+	if (last_real_fcc_mah == -EINVAL)
+		rc = param_set_int(val, kp);
+	if (rc) {
+		pr_err("Failed to set last_real_fcc_mah rc=%d\n", rc);
+		return rc;
+	}
+	if (last_real_fcc_batt_temp != -EINVAL)
+		readjust_fcc_table();
+	return rc;
+}
+static struct kernel_param_ops bms_last_real_fcc_param_ops = {
+	.set = bms_last_real_fcc_set,
+	.get = param_get_int,
+};
+module_param_cb(last_real_fcc_mah, &bms_last_real_fcc_param_ops,
+					&last_real_fcc_mah, 0644);
+
+static int bms_last_real_fcc_batt_temp_set(const char *val,
+				const struct kernel_param *kp)
+{
+	int rc = 0;
+
+	if (last_real_fcc_batt_temp == -EINVAL)
+		rc = param_set_int(val, kp);
+	if (rc) {
+		pr_err("Failed to set last_real_fcc_batt_temp rc=%d\n", rc);
+		return rc;
+	}
+	if (last_real_fcc_mah != -EINVAL)
+		readjust_fcc_table();
+	return rc;
+}
+
+static struct kernel_param_ops bms_last_real_fcc_batt_temp_param_ops = {
+	.set = bms_last_real_fcc_batt_temp_set,
+	.get = param_get_int,
+};
+module_param_cb(last_real_fcc_batt_temp, &bms_last_real_fcc_batt_temp_param_ops,
+					&last_real_fcc_batt_temp, 0644);
+
+static int pm_bms_get_rt_status(struct pm8921_bms_chip *chip, int irq_id)
+{
+	return pm8xxx_read_irq_stat(chip->dev->parent,
+					chip->pmic_bms_irq[irq_id]);
+}
+
+static void pm8921_bms_enable_irq(struct pm8921_bms_chip *chip, int interrupt)
+{
+	if (!__test_and_set_bit(interrupt, chip->enabled_irqs)) {
+		dev_dbg(chip->dev, "%s %d\n", __func__,
+						chip->pmic_bms_irq[interrupt]);
+		enable_irq(chip->pmic_bms_irq[interrupt]);
+	}
+}
+
+static void pm8921_bms_disable_irq(struct pm8921_bms_chip *chip, int interrupt)
+{
+	if (__test_and_clear_bit(interrupt, chip->enabled_irqs)) {
+		pr_debug("%d\n", chip->pmic_bms_irq[interrupt]);
+		disable_irq_nosync(chip->pmic_bms_irq[interrupt]);
+	}
+}
+
+static int pm_bms_masked_write(struct pm8921_bms_chip *chip, u16 addr,
+							u8 mask, u8 val)
+{
+	int rc;
+	u8 reg;
+
+	rc = pm8xxx_readb(chip->dev->parent, addr, &reg);
+	if (rc) {
+		pr_err("read failed addr = %03X, rc = %d\n", addr, rc);
+		return rc;
+	}
+	reg &= ~mask;
+	reg |= val & mask;
+	rc = pm8xxx_writeb(chip->dev->parent, addr, reg);
+	if (rc) {
+		pr_err("write failed addr = %03X, rc = %d\n", addr, rc);
+		return rc;
+	}
+	return 0;
+}
+
+static int usb_chg_plugged_in(void)
+{
+#if 0
+	union power_supply_propval ret = {0,};
+	static struct power_supply *psy;
+	if (psy == NULL) {
+		psy = power_supply_get_by_name("usb");
+		if (psy == NULL)
+			return 0;
+	}
+
+	if (psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &ret))
+		return 0;
+	return ret.intval;
+#endif
+	int rc = pm8921_is_usb_chg_plugged_in();
+	if (rc < 0) {
+		return 0;
+	}
+	the_chip->usb_chg_plugged_ready = 1;
+	return rc;
+}
+
+#define HOLD_OREG_DATA		BIT(1)
+static int pm_bms_lock_output_data(struct pm8921_bms_chip *chip)
+{
+	int rc;
+
+	rc = pm_bms_masked_write(chip, BMS_CONTROL, HOLD_OREG_DATA,
+					HOLD_OREG_DATA);
+	if (rc) {
+		pr_err("couldnt lock bms output rc = %d\n", rc);
+		return rc;
+	}
+	return 0;
+}
+
+static int pm_bms_unlock_output_data(struct pm8921_bms_chip *chip)
+{
+	int rc;
+
+	rc = pm_bms_masked_write(chip, BMS_CONTROL, HOLD_OREG_DATA, 0);
+	if (rc) {
+		pr_err("fail to unlock BMS_CONTROL rc = %d\n", rc);
+		return rc;
+	}
+	return 0;
+}
+
+#define SELECT_OUTPUT_DATA	0x1C
+#define SELECT_OUTPUT_TYPE_SHIFT	2
+#define OCV_FOR_RBATT		0x0
+#define VSENSE_FOR_RBATT	0x1
+#define VBATT_FOR_RBATT		0x2
+#define CC_MSB			0x3
+#define CC_LSB			0x4
+#define LAST_GOOD_OCV_VALUE	0x5
+#define VSENSE_AVG		0x6
+#define VBATT_AVG		0x7
+
+static int pm_bms_read_output_data(struct pm8921_bms_chip *chip, int type,
+						int16_t *result)
+{
+	int rc;
+	u8 reg;
+
+	if (!result) {
+		pr_err("result pointer null\n");
+		return -EINVAL;
+	}
+	*result = 0;
+	if (type < OCV_FOR_RBATT || type > VBATT_AVG) {
+		pr_err("invalid type %d asked to read\n", type);
+		return -EINVAL;
+	}
+
+	rc = pm_bms_masked_write(chip, BMS_CONTROL, SELECT_OUTPUT_DATA,
+					type << SELECT_OUTPUT_TYPE_SHIFT);
+	if (rc) {
+		pr_err("fail to select %d type in BMS_CONTROL rc = %d\n",
+						type, rc);
+		return rc;
+	}
+
+	rc = pm8xxx_readb(chip->dev->parent, BMS_OUTPUT0, &reg);
+	if (rc) {
+		pr_err("fail to read BMS_OUTPUT0 for type %d rc = %d\n",
+			type, rc);
+		return rc;
+	}
+	*result = reg;
+	rc = pm8xxx_readb(chip->dev->parent, BMS_OUTPUT1, &reg);
+	if (rc) {
+		pr_err("fail to read BMS_OUTPUT1 for type %d rc = %d\n",
+			type, rc);
+		return rc;
+	}
+	*result |= reg << 8;
+	pr_debug("type %d result %x", type, *result);
+	return 0;
+}
+
+#define V_PER_BIT_MUL_FACTOR	97656
+#define V_PER_BIT_DIV_FACTOR	1000
+#define XOADC_INTRINSIC_OFFSET	0x6000
+static int xoadc_reading_to_microvolt(unsigned int a)
+{
+	if (a <= XOADC_INTRINSIC_OFFSET)
+		return 0;
+
+	return (a - XOADC_INTRINSIC_OFFSET)
+			* V_PER_BIT_MUL_FACTOR / V_PER_BIT_DIV_FACTOR;
+}
+
+#define XOADC_CALIB_UV		625000
+#define VBATT_MUL_FACTOR	3
+static int adjust_xo_vbatt_reading(struct pm8921_bms_chip *chip,
+					int usb_chg, unsigned int uv)
+{
+	s64 numerator, denominator;
+	int local_delta;
+
+	if (uv == 0)
+		return 0;
+
+	
+	if (chip->xoadc_v0625 == 0 || chip->xoadc_v125 == 0) {
+		pr_debug("No cal yet return %d\n", VBATT_MUL_FACTOR * uv);
+		return VBATT_MUL_FACTOR * uv;
+	}
+
+	if (usb_chg)
+		local_delta = last_usb_cal_delta_uv;
+	else
+		local_delta = 0;
+
+	pr_debug("using delta = %d\n", local_delta);
+	numerator = ((s64)uv - chip->xoadc_v0625 - local_delta)
+							* XOADC_CALIB_UV;
+	denominator =  (s64)chip->xoadc_v125 - chip->xoadc_v0625 - local_delta;
+	if (denominator == 0)
+		return uv * VBATT_MUL_FACTOR;
+	return (XOADC_CALIB_UV + local_delta + div_s64(numerator, denominator))
+						* VBATT_MUL_FACTOR;
+}
+
+#define CC_RESOLUTION_N_V1	1085069
+#define CC_RESOLUTION_D_V1	100000
+#define CC_RESOLUTION_N_V2	868056
+#define CC_RESOLUTION_D_V2	10000
+
+static s64 cc_to_microvolt_v1(s64 cc)
+{
+	return div_s64(cc * CC_RESOLUTION_N_V1, CC_RESOLUTION_D_V1);
+}
+
+static s64 cc_to_microvolt_v2(s64 cc)
+{
+	return div_s64(cc * CC_RESOLUTION_N_V2, CC_RESOLUTION_D_V2);
+}
+
+static s64 cc_to_microvolt(struct pm8921_bms_chip *chip, s64 cc)
+{
+	return (chip->revision < PM8XXX_REVISION_8921_2p0) ?
+				cc_to_microvolt_v1((s64)cc) :
+				cc_to_microvolt_v2((s64)cc);
+}
+
+#define CC_READING_TICKS	56
+#define SLEEP_CLK_HZ		32764
+#define SECONDS_PER_HOUR	3600
+static s64 ccmicrovolt_to_nvh(s64 cc_uv)
+{
+	return div_s64(cc_uv * CC_READING_TICKS * 1000,
+			SLEEP_CLK_HZ * SECONDS_PER_HOUR);
+}
+
+static int read_cc(struct pm8921_bms_chip *chip, int *result)
+{
+	int rc;
+	uint16_t msw, lsw;
+
+	rc = pm_bms_read_output_data(chip, CC_LSB, &lsw);
+	if (rc) {
+		pr_err("fail to read CC_LSB rc = %d\n", rc);
+		return rc;
+	}
+	rc = pm_bms_read_output_data(chip, CC_MSB, &msw);
+	if (rc) {
+		pr_err("fail to read CC_MSB rc = %d\n", rc);
+		return rc;
+	}
+	*result = msw << 16 | lsw;
+	pr_debug("msw = %04x lsw = %04x cc = %d\n", msw, lsw, *result);
+	return 0;
+}
+
+static int adjust_xo_vbatt_reading_for_mbg(struct pm8921_bms_chip *chip,
+						int result)
+{
+	int64_t numerator;
+	int64_t denominator;
+
+	if (chip->amux_2_trim_delta == 0)
+		return result;
+
+	numerator = (s64)result * 1000000;
+	denominator = (1000000 + (410 * (s64)chip->amux_2_trim_delta));
+	return div_s64(numerator, denominator);
+}
+
+static int convert_vbatt_raw_to_uv(struct pm8921_bms_chip *chip,
+					int usb_chg,
+					uint16_t reading, int *result)
+{
+	*result = xoadc_reading_to_microvolt(reading);
+	pr_debug("raw = %04x vbatt = %u\n", reading, *result);
+	*result = adjust_xo_vbatt_reading(chip, usb_chg, *result);
+	pr_debug("after adj vbatt = %u\n", *result);
+	*result = adjust_xo_vbatt_reading_for_mbg(chip, *result);
+	pr_debug("after mbg adj vbatt = %u\n", *result);
+	return 0;
+}
+
+static int convert_vsense_to_uv(struct pm8921_bms_chip *chip,
+					int16_t reading, int *result)
+{
+	*result = pm8xxx_ccadc_reading_to_microvolt(chip->revision, reading);
+	pr_debug("raw = %04x vsense = %d\n", reading, *result);
+	*result = pm8xxx_cc_adjust_for_gain(*result);
+	pr_debug("after adj vsense = %d\n", *result);
+	return 0;
+}
+
+static int read_vsense_avg(struct pm8921_bms_chip *chip, int *result)
+{
+	int rc;
+	int16_t reading;
+
+	rc = pm_bms_read_output_data(chip, VSENSE_AVG, &reading);
+	if (rc) {
+		pr_err("fail to read VSENSE_AVG rc = %d\n", rc);
+		return rc;
+	}
+
+	convert_vsense_to_uv(chip, reading, result);
+	return 0;
+}
+
+static int linear_interpolate(int y0, int x0, int y1, int x1, int x)
+{
+	if (y0 == y1 || x == x0)
+		return y0;
+	if (x1 == x0 || x == x1)
+		return y1;
+
+	return y0 + ((y1 - y0) * (x - x0) / (x1 - x0));
+}
+
+static int interpolate_single_lut(struct single_row_lut *lut, int x)
+{
+	int i, result;
+
+	if (x < lut->x[0]) {
+		pr_debug("x %d less than known range return y = %d lut = %pS\n",
+							x, lut->y[0], lut);
+		return lut->y[0];
+	}
+	if (x > lut->x[lut->cols - 1]) {
+		pr_debug("x %d more than known range return y = %d lut = %pS\n",
+						x, lut->y[lut->cols - 1], lut);
+		return lut->y[lut->cols - 1];
+	}
+
+	for (i = 0; i < lut->cols; i++)
+		if (x <= lut->x[i])
+			break;
+	if (x == lut->x[i]) {
+		result = lut->y[i];
+	} else {
+		result = linear_interpolate(
+			lut->y[i - 1],
+			lut->x[i - 1],
+			lut->y[i],
+			lut->x[i],
+			x);
+	}
+	return result;
+}
+
+static int interpolate_fcc(struct pm8921_bms_chip *chip, int batt_temp)
+{
+	
+	batt_temp = batt_temp/10;
+	return interpolate_single_lut(chip->fcc_temp_lut, batt_temp);
+}
+
+static int interpolate_fcc_adjusted(struct pm8921_bms_chip *chip, int batt_temp)
+{
+	
+	batt_temp = batt_temp/10;
+	return interpolate_single_lut(chip->adjusted_fcc_temp_lut, batt_temp);
+}
+
+static int interpolate_scalingfactor_fcc(struct pm8921_bms_chip *chip,
+								int cycles)
+{
+	if (chip->fcc_sf_lut)
+		return interpolate_single_lut(chip->fcc_sf_lut, cycles);
+	else
+		return 100;
+}
+
+static int interpolate_scalingfactor(struct pm8921_bms_chip *chip,
+				struct sf_lut *sf_lut,
+				int row_entry, int pc)
+{
+	int i, scalefactorrow1, scalefactorrow2, scalefactor;
+	int rows, cols;
+	int row1 = 0;
+	int row2 = 0;
+
+	if (!sf_lut)
+		return 100;
+
+	rows = sf_lut->rows;
+	cols = sf_lut->cols;
+	if (pc > sf_lut->percent[0]) {
+		pr_debug("pc %d greater than known pc ranges for sfd\n", pc);
+		row1 = 0;
+		row2 = 0;
+	}
+	if (pc < sf_lut->percent[rows - 1]) {
+		pr_debug("pc %d less than known pc ranges for sf", pc);
+		row1 = rows - 1;
+		row2 = rows - 1;
+	}
+	for (i = 0; i < rows; i++) {
+		if (pc == sf_lut->percent[i]) {
+			row1 = i;
+			row2 = i;
+			break;
+		}
+		if (pc > sf_lut->percent[i]) {
+			row1 = i - 1;
+			row2 = i;
+			break;
+		}
+	}
+
+	if (row_entry < sf_lut->row_entries[0])
+		row_entry = sf_lut->row_entries[0];
+	if (row_entry > sf_lut->row_entries[cols - 1])
+		row_entry = sf_lut->row_entries[cols - 1];
+
+	for (i = 0; i < cols; i++)
+		if (row_entry <= sf_lut->row_entries[i])
+			break;
+	if (row_entry == sf_lut->row_entries[i]) {
+		scalefactor = linear_interpolate(
+				sf_lut->sf[row1][i],
+				sf_lut->percent[row1],
+				sf_lut->sf[row2][i],
+				sf_lut->percent[row2],
+				pc);
+		return scalefactor;
+	}
+
+	scalefactorrow1 = linear_interpolate(
+				sf_lut->sf[row1][i - 1],
+				sf_lut->row_entries[i - 1],
+				sf_lut->sf[row1][i],
+				sf_lut->row_entries[i],
+				row_entry);
+
+	scalefactorrow2 = linear_interpolate(
+				sf_lut->sf[row2][i - 1],
+				sf_lut->row_entries[i - 1],
+				sf_lut->sf[row2][i],
+				sf_lut->row_entries[i],
+				row_entry);
+
+	scalefactor = linear_interpolate(
+				scalefactorrow1,
+				sf_lut->percent[row1],
+				scalefactorrow2,
+				sf_lut->percent[row2],
+				pc);
+
+	return scalefactor;
+}
+
+static int is_between(int left, int right, int value)
+{
+	if (left >= right && left >= value && value >= right)
+		return 1;
+	if (left <= right && left <= value && value <= right)
+		return 1;
+
+	return 0;
+}
+
+static int interpolate_pc(struct pm8921_bms_chip *chip,
+				int batt_temp, int ocv)
+{
+	int i, j, pcj, pcj_minus_one, pc;
+	int rows = chip->pc_temp_ocv_lut->rows;
+	int cols = chip->pc_temp_ocv_lut->cols;
+
+	
+	batt_temp = batt_temp/10;
+
+	if (batt_temp < chip->pc_temp_ocv_lut->temp[0]) {
+		pr_debug("batt_temp %d < known temp range for pc\n", batt_temp);
+		batt_temp = chip->pc_temp_ocv_lut->temp[0];
+	}
+	if (batt_temp > chip->pc_temp_ocv_lut->temp[cols - 1]) {
+		pr_debug("batt_temp %d > known temp range for pc\n", batt_temp);
+		batt_temp = chip->pc_temp_ocv_lut->temp[cols - 1];
+	}
+
+	for (j = 0; j < cols; j++)
+		if (batt_temp <= chip->pc_temp_ocv_lut->temp[j])
+			break;
+	if (batt_temp == chip->pc_temp_ocv_lut->temp[j]) {
+		
+		if (ocv >= chip->pc_temp_ocv_lut->ocv[0][j])
+			return chip->pc_temp_ocv_lut->percent[0];
+		if (ocv <= chip->pc_temp_ocv_lut->ocv[rows - 1][j])
+			return chip->pc_temp_ocv_lut->percent[rows - 1];
+		for (i = 0; i < rows; i++) {
+			if (ocv >= chip->pc_temp_ocv_lut->ocv[i][j]) {
+				if (ocv == chip->pc_temp_ocv_lut->ocv[i][j])
+					return
+					chip->pc_temp_ocv_lut->percent[i];
+				pc = linear_interpolate(
+					chip->pc_temp_ocv_lut->percent[i],
+					chip->pc_temp_ocv_lut->ocv[i][j],
+					chip->pc_temp_ocv_lut->percent[i - 1],
+					chip->pc_temp_ocv_lut->ocv[i - 1][j],
+					ocv);
+				return pc;
+			}
+		}
+	}
+
+	if (ocv >= chip->pc_temp_ocv_lut->ocv[0][j])
+		return chip->pc_temp_ocv_lut->percent[0];
+	if (ocv <= chip->pc_temp_ocv_lut->ocv[rows - 1][j - 1])
+		return chip->pc_temp_ocv_lut->percent[rows - 1];
+
+	pcj_minus_one = 0;
+	pcj = 0;
+	for (i = 0; i < rows-1; i++) {
+		if (pcj == 0
+			&& is_between(chip->pc_temp_ocv_lut->ocv[i][j],
+				chip->pc_temp_ocv_lut->ocv[i+1][j], ocv)) {
+			pcj = linear_interpolate(
+				chip->pc_temp_ocv_lut->percent[i],
+				chip->pc_temp_ocv_lut->ocv[i][j],
+				chip->pc_temp_ocv_lut->percent[i + 1],
+				chip->pc_temp_ocv_lut->ocv[i+1][j],
+				ocv);
+		}
+
+		if (pcj_minus_one == 0
+			&& is_between(chip->pc_temp_ocv_lut->ocv[i][j-1],
+				chip->pc_temp_ocv_lut->ocv[i+1][j-1], ocv)) {
+
+			pcj_minus_one = linear_interpolate(
+				chip->pc_temp_ocv_lut->percent[i],
+				chip->pc_temp_ocv_lut->ocv[i][j-1],
+				chip->pc_temp_ocv_lut->percent[i + 1],
+				chip->pc_temp_ocv_lut->ocv[i+1][j-1],
+				ocv);
+		}
+
+		if (pcj && pcj_minus_one) {
+			pc = linear_interpolate(
+				pcj_minus_one,
+				chip->pc_temp_ocv_lut->temp[j-1],
+				pcj,
+				chip->pc_temp_ocv_lut->temp[j],
+				batt_temp);
+			return pc;
+		}
+	}
+
+	if (pcj)
+		return pcj;
+
+	if (pcj_minus_one)
+		return pcj_minus_one;
+
+	pr_debug("%d ocv wasn't found for temp %d in the LUT returning 100%%",
+							ocv, batt_temp);
+	return 100;
+}
+
+#define BMS_MODE_BIT			BIT(6)
+#define EN_VBAT_BIT				BIT(5)
+#define OVERRIDE_MODE_DELAY_MS	20
+int pm8921_bms_get_simultaneous_battery_voltage_and_current(int *ibat_ua,
+								int *vbat_uv)
+{
+	int16_t vsense_raw;
+	int16_t vbat_raw;
+	int vsense_uv, usb_chg;
+
+	if (the_chip == NULL) {
+		pr_err("Called to early\n");
+		return -EINVAL;
+	}
+
+	mutex_lock(&the_chip->bms_output_lock);
+
+	pm8xxx_writeb(the_chip->dev->parent, BMS_S1_DELAY, 0x00);
+	pm_bms_masked_write(the_chip, BMS_CONTROL,
+			BMS_MODE_BIT | EN_VBAT_BIT, BMS_MODE_BIT | EN_VBAT_BIT);
+
+	msleep(OVERRIDE_MODE_DELAY_MS);
+
+	pm_bms_lock_output_data(the_chip);
+	pm_bms_read_output_data(the_chip, VSENSE_AVG, &vsense_raw);
+	pm_bms_read_output_data(the_chip, VBATT_AVG, &vbat_raw);
+	pm_bms_unlock_output_data(the_chip);
+	pm_bms_masked_write(the_chip, BMS_CONTROL,
+			BMS_MODE_BIT | EN_VBAT_BIT, 0);
+
+	pm8xxx_writeb(the_chip->dev->parent, BMS_S1_DELAY, 0x0B);
+
+	mutex_unlock(&the_chip->bms_output_lock);
+
+	usb_chg = usb_chg_plugged_in();
+	convert_vbatt_raw_to_uv(the_chip, usb_chg, vbat_raw, vbat_uv);
+	convert_vsense_to_uv(the_chip, vsense_raw, &vsense_uv);
+	*ibat_ua = vsense_uv * 1000 / (int)the_chip->r_sense;
+
+	pr_debug("vsense_raw = 0x%x vbat_raw = 0x%x"
+			" ibat_ua = %d vbat_uv = %d\n",
+			(uint16_t)vsense_raw, (uint16_t)vbat_raw,
+			*ibat_ua, *vbat_uv);
+	return 0;
+}
+EXPORT_SYMBOL(pm8921_bms_get_simultaneous_battery_voltage_and_current);
+
+static int read_rbatt_params_raw(struct pm8921_bms_chip *chip,
+				struct pm8921_rbatt_params *raw)
+{
+	int usb_chg;
+
+	mutex_lock(&chip->bms_output_lock);
+	pm_bms_lock_output_data(chip);
+
+	pm_bms_read_output_data(chip,
+			OCV_FOR_RBATT, &raw->ocv_for_rbatt_raw);
+	pm_bms_read_output_data(chip,
+			VBATT_FOR_RBATT, &raw->vbatt_for_rbatt_raw);
+	pm_bms_read_output_data(chip,
+			VSENSE_FOR_RBATT, &raw->vsense_for_rbatt_raw);
+
+	pm_bms_unlock_output_data(chip);
+	mutex_unlock(&chip->bms_output_lock);
+
+	usb_chg = usb_chg_plugged_in();
+	convert_vbatt_raw_to_uv(chip, usb_chg,
+			raw->vbatt_for_rbatt_raw, &raw->vbatt_for_rbatt_uv);
+	convert_vbatt_raw_to_uv(chip, usb_chg,
+			raw->ocv_for_rbatt_raw, &raw->ocv_for_rbatt_uv);
+	convert_vsense_to_uv(chip,
+			raw->vsense_for_rbatt_raw, &raw->vsense_for_rbatt_uv);
+
+	pr_debug("vbatt_for_rbatt_raw = 0x%x, vbatt_for_rbatt= %duV\n",
+			raw->vbatt_for_rbatt_raw, raw->vbatt_for_rbatt_uv);
+	pr_debug("ocv_for_rbatt_raw = 0x%x, ocv_for_rbatt= %duV\n",
+			raw->ocv_for_rbatt_raw, raw->ocv_for_rbatt_uv);
+	pr_debug("vsense_for_rbatt_raw = 0x%x, vsense_for_rbatt= %duV\n",
+			raw->vsense_for_rbatt_raw, raw->vsense_for_rbatt_uv);
+	return 0;
+}
+
+#define MBG_TRANSIENT_ERROR_RAW 51
+static void adjust_pon_ocv_raw(struct pm8921_bms_chip *chip,
+				struct pm8921_soc_params *raw)
+{
+	if (raw->last_good_ocv_raw >= MBG_TRANSIENT_ERROR_RAW)
+		raw->last_good_ocv_raw -= MBG_TRANSIENT_ERROR_RAW;
+}
+
+static int read_soc_params_raw(struct pm8921_bms_chip *chip,
+				struct pm8921_soc_params *raw)
+{
+	int usb_chg, rc;
+	uint16_t	last_good_ocv_raw_ori = 0; 
+	int		last_good_ocv_uv_ori_uv = 0; 
+	u8 ocv_updated_flag = 0;
+
+	rc = pm8xxx_readb(chip->dev->parent, OCV_UPDATE_STORAGE, &ocv_updated_flag);
+	if (rc) {
+		pr_err("%s: failed to read addr = %d, rc=%d\n",
+				__func__, OCV_UPDATE_STORAGE, rc);
+	} else {
+		ocv_updated_flag &= OCV_UPDATE_STORAGE_USE_MASK;
+		pr_debug("%s: OCV_UPDATE_STORAGE = 0x%x\n", __func__, ocv_updated_flag);
+	}
+
+	mutex_lock(&chip->bms_output_lock);
+	pm_bms_lock_output_data(chip);
+
+	pm_bms_read_output_data(chip,
+			LAST_GOOD_OCV_VALUE, &raw->last_good_ocv_raw);
+	read_cc(chip, &raw->cc);
+
+	pm_bms_unlock_output_data(chip);
+	mutex_unlock(&chip->bms_output_lock);
+
+	usb_chg =  usb_chg_plugged_in();
+	pr_debug("%s: usb_chg=%d, usb_chg_plugged_ready=%d,"
+			"prev_last_good_ocv_raw=0x%x, last_good_ocv_raw=0x%x\n",
+			__func__, usb_chg, chip->usb_chg_plugged_ready,
+			chip->prev_last_good_ocv_raw, raw->last_good_ocv_raw);
+	if (chip->prev_last_good_ocv_raw == 0) {
+		if (chip->usb_chg_plugged_ready == 1)
+			chip->prev_last_good_ocv_raw = raw->last_good_ocv_raw;
+		last_good_ocv_raw_ori = raw->last_good_ocv_raw;
+		if (!ocv_updated_flag)
+			adjust_pon_ocv_raw(chip, raw);
+		else
+			pr_info("%s: Skip adjust_pon_ocv_raw due to ocv_updated_flag=0x%x\n",
+					__func__, ocv_updated_flag);
+		convert_vbatt_raw_to_uv(chip, usb_chg,
+			raw->last_good_ocv_raw, &raw->last_good_ocv_uv);
+		convert_vbatt_raw_to_uv(chip, usb_chg,
+			last_good_ocv_raw_ori, &last_good_ocv_uv_ori_uv);
+		last_ocv_uv = raw->last_good_ocv_uv;
+		pr_info("%s: last_good_ocv_raw/ori=0x%x/0x%x, last_good_ocv_uv/ori=%duV/%duV\n",
+				__func__, raw->last_good_ocv_raw, last_good_ocv_raw_ori,
+				raw->last_good_ocv_uv, last_good_ocv_uv_ori_uv);
+	} else if (chip->prev_last_good_ocv_raw != raw->last_good_ocv_raw) {
+		chip->prev_last_good_ocv_raw = raw->last_good_ocv_raw;
+		convert_vbatt_raw_to_uv(chip, usb_chg,
+			raw->last_good_ocv_raw, &raw->last_good_ocv_uv);
+		last_ocv_uv = raw->last_good_ocv_uv;
+		pm_bms_masked_write(chip, OCV_UPDATE_STORAGE,
+							OCV_UPDATE_STORAGE_USE_MASK, 0x1);
+		rc = pm8xxx_readb(chip->dev->parent, OCV_UPDATE_STORAGE, &ocv_updated_flag);
+		if (rc) {
+			pr_err("%s: failed to read addr = %d, rc=%d\n",
+					__func__, OCV_UPDATE_STORAGE, rc);
+		} else {
+			ocv_updated_flag &= OCV_UPDATE_STORAGE_USE_MASK;
+		}
+		pr_info("%s: last_good_ocv_raw/uv=0x%x/%duV, ocv_updated_flag=0x%x\n",
+				__func__, raw->last_good_ocv_raw, raw->last_good_ocv_uv,
+				ocv_updated_flag);
+	} else {
+		raw->last_good_ocv_uv = last_ocv_uv;
+	}
+
+	pr_debug("0p625 = %duV\n", chip->xoadc_v0625);
+	pr_debug("1p25 = %duV\n", chip->xoadc_v125);
+	pr_debug("last_good_ocv_raw= 0x%x, last_good_ocv_uv= %duV\n",
+			raw->last_good_ocv_raw, raw->last_good_ocv_uv);
+	pr_debug("cc_raw= 0x%x\n", raw->cc);
+	return 0;
+}
+
+static int get_rbatt(struct pm8921_bms_chip *chip, int soc_rbatt, int batt_temp)
+{
+	int rbatt, scalefactor;
+
+	rbatt = (last_rbatt < 0) ? chip->default_rbatt_mohm : last_rbatt;
+	pr_debug("rbatt before scaling = %d\n", rbatt);
+	if (chip->rbatt_sf_lut == NULL)  {
+		pr_debug("RBATT = %d\n", rbatt);
+		return rbatt;
+	}
+
+	
+	batt_temp = batt_temp / 10;
+	scalefactor = interpolate_scalingfactor(chip, chip->rbatt_sf_lut,
+							batt_temp, soc_rbatt);
+	bms_dbg.rbatt_sf = scalefactor;
+	bms_dbg.soc_rbatt = soc_rbatt;
+	pr_debug("rbatt sf = %d for batt_temp = %d, soc_rbatt = %d\n",
+				scalefactor, batt_temp, soc_rbatt);
+	rbatt = (rbatt * scalefactor) / 100;
+
+	rbatt += the_chip->rconn_mohm;
+	pr_debug("adding rconn_mohm = %d rbatt = %d\n",
+				the_chip->rconn_mohm, rbatt);
+
+	if (is_between(20, 10, soc_rbatt))
+		rbatt = rbatt
+			+ ((20 - soc_rbatt) * chip->delta_rbatt_mohm) / 10;
+	else
+		if (is_between(10, 0, soc_rbatt))
+			rbatt = rbatt + chip->delta_rbatt_mohm;
+
+	pr_debug("RBATT = %d\n", rbatt);
+	return rbatt;
+}
+
+static int calculate_rbatt_resume(struct pm8921_bms_chip *chip,
+				struct pm8921_rbatt_params *raw)
+{
+	unsigned int  r_batt;
+
+	if (raw->ocv_for_rbatt_uv <= 0
+		|| raw->ocv_for_rbatt_uv <= raw->vbatt_for_rbatt_uv
+		|| raw->vsense_for_rbatt_raw <= 0) {
+		pr_debug("rbatt readings unavailable ocv = %d, vbatt = %d,"
+					"vsen = %d\n",
+					raw->ocv_for_rbatt_uv,
+					raw->vbatt_for_rbatt_uv,
+					raw->vsense_for_rbatt_raw);
+		return -EINVAL;
+	}
+	r_batt = ((raw->ocv_for_rbatt_uv - raw->vbatt_for_rbatt_uv)
+			* chip->r_sense) / raw->vsense_for_rbatt_uv;
+	pr_debug("r_batt = %umilliOhms", r_batt);
+	return r_batt;
+}
+
+static int calculate_fcc_uah(struct pm8921_bms_chip *chip, int batt_temp,
+							int chargecycles)
+{
+	int initfcc, result, scalefactor = 0;
+
+	if (chip->adjusted_fcc_temp_lut == NULL) {
+		initfcc = interpolate_fcc(chip, batt_temp);
+
+		scalefactor = interpolate_scalingfactor_fcc(chip, chargecycles);
+
+		
+		result = (initfcc * scalefactor * 1000) / 100;
+		pr_debug("fcc = %d uAh\n", result);
+		return result;
+	} else {
+		return 1000 * interpolate_fcc_adjusted(chip, batt_temp);
+	}
+}
+
+static int get_battery_uvolts(struct pm8921_bms_chip *chip, int *uvolts)
+{
+	int rc;
+	struct pm8xxx_adc_chan_result result;
+
+	rc = pm8xxx_adc_read(chip->vbat_channel, &result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+					chip->vbat_channel, rc);
+		return rc;
+	}
+	pr_debug("mvolts phy = %lld meas = 0x%llx", result.physical,
+						result.measurement);
+	*uvolts = (int)result.physical;
+	return 0;
+}
+
+static int adc_based_ocv(struct pm8921_bms_chip *chip, int *ocv)
+{
+	int vbatt, rbatt, ibatt_ua, rc;
+
+	rc = get_battery_uvolts(chip, &vbatt);
+	if (rc) {
+		pr_err("failed to read vbatt from adc rc = %d\n", rc);
+		return rc;
+	}
+
+	rc =  pm8921_bms_get_battery_current(&ibatt_ua);
+	if (rc) {
+		pr_err("failed to read batt current rc = %d\n", rc);
+		return rc;
+	}
+
+	rbatt = (last_rbatt < 0) ? chip->default_rbatt_mohm : last_rbatt;
+	*ocv = vbatt + (ibatt_ua * rbatt)/1000;
+	return 0;
+}
+
+static int calculate_pc(struct pm8921_bms_chip *chip, int ocv_uv, int batt_temp,
+							int chargecycles)
+{
+	int pc, scalefactor;
+
+	pc = interpolate_pc(chip, batt_temp, ocv_uv / 1000);
+	pr_debug("pc = %u for ocv = %dmicroVolts batt_temp = %d\n",
+					pc, ocv_uv, batt_temp);
+
+	scalefactor = interpolate_scalingfactor(chip,
+					chip->pc_sf_lut, chargecycles, pc);
+	pr_debug("scalefactor = %u batt_temp = %d\n", scalefactor, batt_temp);
+
+	bms_dbg.scalefactor = scalefactor;
+	
+	pc = (pc * scalefactor) / 100;
+	return pc;
+}
+
+static void calculate_cc_uah(struct pm8921_bms_chip *chip, int cc, int *val)
+{
+	int64_t cc_voltage_uv, cc_nvh, cc_uah;
+
+	cc_voltage_uv = cc;
+	cc_voltage_uv -= chip->cc_reading_at_100;
+	pr_debug("cc = %d. after subtracting %d cc = %lld\n",
+					cc, chip->cc_reading_at_100,
+					cc_voltage_uv);
+	cc_voltage_uv = cc_to_microvolt(chip, cc_voltage_uv);
+	cc_voltage_uv = pm8xxx_cc_adjust_for_gain(cc_voltage_uv);
+	pr_debug("cc_voltage_uv = %lld microvolts\n", cc_voltage_uv);
+	cc_nvh = ccmicrovolt_to_nvh(cc_voltage_uv);
+	pr_debug("cc_nvh = %lld nano_volt_hour\n", cc_nvh);
+	cc_uah = div_s64(cc_nvh, chip->r_sense);
+	*val = cc_uah;
+}
+
+static int calculate_unusable_charge_uah(struct pm8921_bms_chip *chip,
+				int rbatt, int fcc_uah,
+				int batt_temp, int chargecycles)
+{
+	int voltage_unusable_uv, pc_unusable;
+
+	
+	voltage_unusable_uv = (rbatt * chip->i_test)
+						+ (chip->v_failure * 1000);
+	pc_unusable = calculate_pc(chip, voltage_unusable_uv,
+						batt_temp, chargecycles);
+	pr_debug("rbatt = %umilliOhms unusable_v =%d unusable_pc = %d\n",
+			rbatt, voltage_unusable_uv, pc_unusable);
+	bms_dbg.rbatt = rbatt;
+	bms_dbg.voltage_unusable_uv = voltage_unusable_uv;
+	bms_dbg.pc_unusable = pc_unusable;
+	return (fcc_uah * pc_unusable) / 100;
+}
+
+static int calculate_remaining_charge_uah(struct pm8921_bms_chip *chip,
+						struct pm8921_soc_params *raw,
+						int fcc_uah, int batt_temp,
+						int chargecycles)
+{
+	int ocv, pc;
+
+	
+	ocv = 0;
+	if (chip->ocv_reading_at_100 != raw->last_good_ocv_raw) {
+		chip->ocv_reading_at_100 = 0;
+		chip->cc_reading_at_100 = 0;
+		ocv = raw->last_good_ocv_uv;
+	} else {
+		ocv = chip->max_voltage_uv;
+	}
+
+	if (ocv == 0) {
+		ocv = last_ocv_uv;
+		pr_debug("ocv not available using last_ocv_uv=%d\n", ocv);
+	}
+
+	pc = calculate_pc(chip, ocv, batt_temp, chargecycles);
+	bms_dbg.rc_pc = pc;
+	pr_debug("ocv = %d pc = %d\n", ocv, pc);
+	return (fcc_uah * pc) / 100;
+}
+
+static void calculate_soc_params(struct pm8921_bms_chip *chip,
+						struct pm8921_soc_params *raw,
+						int batt_temp, int chargecycles,
+						int *fcc_uah,
+						int *unusable_charge_uah,
+						int *remaining_charge_uah,
+						int *cc_uah,
+						int *rbatt)
+{
+	unsigned long flags;
+	int soc_rbatt;
+
+	*fcc_uah = calculate_fcc_uah(chip, batt_temp, chargecycles);
+	pr_debug("FCC = %uuAh batt_temp = %d, cycles = %d\n",
+					*fcc_uah, batt_temp, chargecycles);
+
+	spin_lock_irqsave(&chip->bms_100_lock, flags);
+	
+	*remaining_charge_uah = calculate_remaining_charge_uah(chip, raw,
+					*fcc_uah, batt_temp, chargecycles);
+	pr_debug("RC = %uuAh\n", *remaining_charge_uah);
+
+	
+	calculate_cc_uah(chip, raw->cc, cc_uah);
+	pr_debug("cc_uah = %duAh raw->cc = %x cc = %lld after subtracting %d\n",
+				*cc_uah, raw->cc,
+				(int64_t)raw->cc - chip->cc_reading_at_100,
+				chip->cc_reading_at_100);
+	spin_unlock_irqrestore(&chip->bms_100_lock, flags);
+
+	soc_rbatt = ((*remaining_charge_uah - *cc_uah) * 100) / *fcc_uah;
+	if (soc_rbatt < 0)
+		soc_rbatt = 0;
+	*rbatt = get_rbatt(chip, soc_rbatt, batt_temp);
+
+	*unusable_charge_uah = calculate_unusable_charge_uah(chip, *rbatt,
+					*fcc_uah, batt_temp, chargecycles);
+	pr_debug("UUC = %uuAh\n", *unusable_charge_uah);
+}
+
+static int calculate_real_fcc_uah(struct pm8921_bms_chip *chip,
+				struct pm8921_soc_params *raw,
+				int batt_temp, int chargecycles,
+				int *ret_fcc_uah)
+{
+	int fcc_uah, unusable_charge_uah;
+	int remaining_charge_uah;
+	int cc_uah;
+	int real_fcc_uah;
+	int rbatt;
+
+	calculate_soc_params(chip, raw, batt_temp, chargecycles,
+						&fcc_uah,
+						&unusable_charge_uah,
+						&remaining_charge_uah,
+						&cc_uah,
+						&rbatt);
+
+	real_fcc_uah = remaining_charge_uah - cc_uah;
+	*ret_fcc_uah = fcc_uah;
+	pr_debug("real_fcc = %d, RC = %d CC = %d fcc = %d\n",
+			real_fcc_uah, remaining_charge_uah, cc_uah, fcc_uah);
+	return real_fcc_uah;
+}
+static int calculate_state_of_charge(struct pm8921_bms_chip *chip,
+					struct pm8921_soc_params *raw,
+					int batt_temp, int chargecycles, int verbol)
+{
+	int remaining_usable_charge_uah, fcc_uah, unusable_charge_uah;
+	int remaining_charge_uah, soc, soc_remainder = 0;
+	int update_userspace = 1;
+	int cc_uah;
+	int rbatt;
+
+	calculate_soc_params(chip, raw, batt_temp, chargecycles,
+						&fcc_uah,
+						&unusable_charge_uah,
+						&remaining_charge_uah,
+						&cc_uah,
+						&rbatt);
+	bms_dbg.batt_temp = batt_temp;
+
+	
+	remaining_usable_charge_uah = remaining_charge_uah
+					- cc_uah
+					- unusable_charge_uah;
+
+	pr_debug("RUC = %duAh\n", remaining_usable_charge_uah);
+	if (fcc_uah - unusable_charge_uah <= 0) {
+		pr_warn("FCC = %duAh, UUC = %duAh forcing soc = 0\n",
+						fcc_uah, unusable_charge_uah);
+		soc = 0;
+	} else {
+		soc = (remaining_usable_charge_uah * 100)
+			/ (fcc_uah - unusable_charge_uah);
+		soc_remainder = (remaining_usable_charge_uah * 100)
+			% (fcc_uah - unusable_charge_uah);
+		
+		if (soc >= 0 && soc_remainder > 0)
+			soc += 1;
+	}
+
+	if (verbol) {
+		pr_info("FCC=%d,UC=%d,RC=%d,CC=%d,RUC=%d,SOC=%d,SOC_R=%d,"
+			       "start_percent=%d,end_percent=%d,"
+			       "rbatt=%d,rbatt_sf=%d,batt_temp=%d,soc_rbatt=%d,last_rbatt=%d,"
+			       "V_unusable_uv=%d,pc_unusable=%d,rc_pc=%d,scalefactor=%d\n",
+				fcc_uah, unusable_charge_uah, remaining_charge_uah,
+				cc_uah, remaining_usable_charge_uah, soc, soc_remainder,
+				the_chip->start_percent, the_chip->end_percent,
+				bms_dbg.rbatt, bms_dbg.rbatt_sf, bms_dbg.batt_temp,
+				bms_dbg.soc_rbatt, last_rbatt, bms_dbg.voltage_unusable_uv,
+				bms_dbg.pc_unusable, bms_dbg.rc_pc, bms_dbg.scalefactor);
+	}
+
+	if (soc > 100)
+		soc = 100;
+	pr_debug("SOC = %u%%\n", soc);
+
+	if (bms_fake_battery != -EINVAL) {
+		pr_debug("Returning Fake SOC = %d%%\n", bms_fake_battery);
+		return bms_fake_battery;
+	}
+
+	if (soc < 0) {
+		pr_err("bad rem_usb_chg = %d rem_chg %d,"
+				"cc_uah %d, unusb_chg %d\n",
+				remaining_usable_charge_uah,
+				remaining_charge_uah,
+				cc_uah, unusable_charge_uah);
+
+		pr_err("for bad rem_usb_chg last_ocv_uv = %d"
+				"chargecycles = %d, batt_temp = %d"
+				"fcc = %d soc =%d\n",
+				last_ocv_uv, chargecycles, batt_temp,
+				fcc_uah, soc);
+		update_userspace = 0;
+		soc = 0;
+	}
+
+	if (last_soc == -EINVAL || soc <= last_soc) {
+		last_soc = update_userspace ? soc : last_soc;
+		return soc;
+	}
+
+	if (the_chip->start_percent != -EINVAL) {
+		last_soc = soc;
+	} else {
+		pr_info("soc = %d reporting last_soc = %d\n", soc, last_soc);
+		soc = last_soc;
+	}
+
+
+	return soc;
+}
+
+#define MIN_DELTA_625_UV	1000
+static void calib_hkadc(struct pm8921_bms_chip *chip)
+{
+	int voltage, rc;
+	struct pm8xxx_adc_chan_result result;
+	int usb_chg;
+	int this_delta;
+
+	rc = pm8xxx_adc_read(the_chip->ref1p25v_channel, &result);
+	if (rc) {
+		pr_err("ADC failed for 1.25volts rc = %d\n", rc);
+		return;
+	}
+	voltage = xoadc_reading_to_microvolt(result.adc_code);
+
+	pr_debug("result 1.25v = 0x%x, voltage = %duV adc_meas = %lld\n",
+				result.adc_code, voltage, result.measurement);
+
+	chip->xoadc_v125 = voltage;
+
+	rc = pm8xxx_adc_read(the_chip->ref625mv_channel, &result);
+	if (rc) {
+		pr_err("ADC failed for 1.25volts rc = %d\n", rc);
+		return;
+	}
+	voltage = xoadc_reading_to_microvolt(result.adc_code);
+
+	usb_chg = usb_chg_plugged_in();
+	pr_debug("result 0.625V = 0x%x, voltage = %duV adc_meas = %lld "
+				"usb_chg = %d\n",
+				result.adc_code, voltage, result.measurement,
+				usb_chg);
+
+	if (usb_chg)
+		chip->xoadc_v0625_usb_present = voltage;
+	else
+		chip->xoadc_v0625_usb_absent = voltage;
+
+	chip->xoadc_v0625 = voltage;
+	if (chip->xoadc_v0625_usb_present && chip->xoadc_v0625_usb_absent) {
+		this_delta = chip->xoadc_v0625_usb_present
+						- chip->xoadc_v0625_usb_absent;
+		pr_debug("this_delta= %duV\n", this_delta);
+		if (this_delta > MIN_DELTA_625_UV)
+			last_usb_cal_delta_uv = this_delta;
+		pr_debug("625V_present= %d, 625V_absent= %d, delta = %duV\n",
+			chip->xoadc_v0625_usb_present,
+			chip->xoadc_v0625_usb_absent,
+			last_usb_cal_delta_uv);
+	}
+}
+
+static void calibrate_hkadc_work(struct work_struct *work)
+{
+	struct pm8921_bms_chip *chip = container_of(work,
+				struct pm8921_bms_chip, calib_hkadc_work);
+
+	calib_hkadc(chip);
+}
+
+void pm8921_bms_calibrate_hkadc(void)
+{
+	schedule_work(&the_chip->calib_hkadc_work);
+}
+
+int pm8921_bms_get_vsense_avg(int *result)
+{
+	int rc = -EINVAL;
+
+	if (the_chip) {
+		mutex_lock(&the_chip->bms_output_lock);
+		pm_bms_lock_output_data(the_chip);
+		rc = read_vsense_avg(the_chip, result);
+		pm_bms_unlock_output_data(the_chip);
+		mutex_unlock(&the_chip->bms_output_lock);
+	} else
+		pr_err("called before initialization\n");
+	return rc;
+}
+EXPORT_SYMBOL(pm8921_bms_get_vsense_avg);
+
+int pm8921_bms_get_battery_current(int *result_ua)
+{
+	int vsense;
+
+	if (!the_chip) {
+		pr_err("called before initialization\n");
+		return -EINVAL;
+	}
+	if (the_chip->r_sense == 0) {
+		pr_err("r_sense is zero\n");
+		return -EINVAL;
+	}
+
+	mutex_lock(&the_chip->bms_output_lock);
+	pm_bms_lock_output_data(the_chip);
+	read_vsense_avg(the_chip, &vsense);
+	pm_bms_unlock_output_data(the_chip);
+	mutex_unlock(&the_chip->bms_output_lock);
+	pr_debug("vsense=%duV\n", vsense);
+	
+	*result_ua = vsense * 1000 / (int)the_chip->r_sense;
+	pr_debug("ibat=%duA\n", *result_ua);
+	return 0;
+}
+EXPORT_SYMBOL(pm8921_bms_get_battery_current);
+
+int pm8921_bms_get_percent_charge(void)
+{
+	int batt_temp, rc;
+	struct pm8xxx_adc_chan_result result;
+	struct pm8921_soc_params raw;
+
+	if (!the_chip) {
+		pr_err("called before initialization\n");
+		return -EINVAL;
+	}
+
+	rc = pm8xxx_adc_read(the_chip->batt_temp_channel, &result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+					the_chip->batt_temp_channel, rc);
+		return rc;
+	}
+	pr_debug("batt_temp phy = %lld meas = 0x%llx", result.physical,
+						result.measurement);
+	batt_temp = (int)result.physical;
+
+	read_soc_params_raw(the_chip, &raw);
+
+	return calculate_state_of_charge(the_chip, &raw,
+					batt_temp, last_chargecycles, 0);
+}
+EXPORT_SYMBOL_GPL(pm8921_bms_get_percent_charge);
+
+int pm8921_bms_get_rbatt(void)
+{
+	int batt_temp, rc;
+	struct pm8xxx_adc_chan_result result;
+	struct pm8921_soc_params raw;
+	int fcc_uah;
+	int unusable_charge_uah;
+	int remaining_charge_uah;
+	int cc_uah;
+	int rbatt;
+
+	if (!the_chip) {
+		pr_err("called before initialization\n");
+		return -EINVAL;
+	}
+
+	rc = pm8xxx_adc_read(the_chip->batt_temp_channel, &result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+					the_chip->batt_temp_channel, rc);
+		return rc;
+	}
+	pr_debug("batt_temp phy = %lld meas = 0x%llx\n", result.physical,
+						result.measurement);
+	batt_temp = (int)result.physical;
+
+	read_soc_params_raw(the_chip, &raw);
+
+	calculate_soc_params(the_chip, &raw, batt_temp, last_chargecycles,
+						&fcc_uah,
+						&unusable_charge_uah,
+						&remaining_charge_uah,
+						&cc_uah,
+						&rbatt);
+	return rbatt;
+}
+EXPORT_SYMBOL_GPL(pm8921_bms_get_rbatt);
+
+int pm8921_bms_get_fcc(void)
+{
+	int batt_temp, rc;
+	struct pm8xxx_adc_chan_result result;
+
+	if (!the_chip) {
+		pr_err("called before initialization\n");
+		return -EINVAL;
+	}
+
+	rc = pm8xxx_adc_read(the_chip->batt_temp_channel, &result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+					the_chip->batt_temp_channel, rc);
+		return rc;
+	}
+	pr_debug("batt_temp phy = %lld meas = 0x%llx", result.physical,
+						result.measurement);
+	batt_temp = (int)result.physical;
+	return calculate_fcc_uah(the_chip, batt_temp, last_chargecycles);
+}
+EXPORT_SYMBOL_GPL(pm8921_bms_get_fcc);
+
+#ifdef CONFIG_HTC_BATT_8960
+int pm8921_bms_get_batt_current(int *result)
+{
+	return pm8921_bms_get_battery_current(result);
+}
+
+int pm8921_bms_get_batt_soc(int *result)
+{
+	int batt_temp, rc;
+	struct pm8xxx_adc_chan_result temp_result;
+	struct pm8921_soc_params raw;
+
+	if (!the_chip) {
+		pr_err("called before initialization\n");
+		return -EINVAL;
+	}
+
+	rc = pm8xxx_adc_read(the_chip->batt_temp_channel, &temp_result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+					the_chip->batt_temp_channel, rc);
+		return rc;
+	}
+	pr_debug("batt_temp phy = %lld meas = 0x%llx", temp_result.physical,
+						temp_result.measurement);
+	batt_temp = (int)temp_result.physical;
+
+	read_soc_params_raw(the_chip, &raw);
+
+	*result = calculate_state_of_charge(the_chip, &raw,
+					batt_temp, last_chargecycles, 1);
+	if (bms_discharge_percent &&
+			((bms_discharge_percent - *result) >= 5)) {
+		pr_info("OCV can be update due to %d - %d >= 5\n",
+				bms_discharge_percent, *result);
+		bms_discharge_percent = 0;
+		pm8921_bms_start_ocv_updates();
+	}
+
+	return 0;
+}
+
+int pm8921_bms_get_batt_cc(int *result)
+{
+	*result = dump_cc_uah();
+
+	return 0;
+}
+#endif 
+
+#define IBAT_TOL_MASK		0x0F
+#define OCV_TOL		0xF0
+#define OCV_TOL_MASK			0xF0
+#define IBAT_TOL_DEFAULT	0x03
+#define IBAT_TOL_NOCHG		0x0F
+#define OCV_TOL_DEFAULT		0x20
+#define OCV_TOL_NO_OCV		0x00
+int pm8921_bms_charging_began(void)
+{
+	int batt_temp, rc = 0;
+	struct pm8xxx_adc_chan_result result;
+	struct pm8921_soc_params raw;
+
+	if (!the_chip) {
+		pr_err("called before initialization\n");
+		return -EINVAL;
+	}
+
+	rc = pm8xxx_adc_read(the_chip->batt_temp_channel, &result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+				the_chip->batt_temp_channel, rc);
+		return rc;
+	}
+	pr_debug("batt_temp phy = %lld meas = 0x%llx\n", result.physical,
+						result.measurement);
+	batt_temp = (int)result.physical;
+
+	read_soc_params_raw(the_chip, &raw);
+
+	the_chip->start_percent = calculate_state_of_charge(the_chip, &raw,
+					batt_temp, last_chargecycles, 0);
+	bms_start_percent = the_chip->start_percent;
+	bms_start_ocv_uv = raw.last_good_ocv_uv;
+	calculate_cc_uah(the_chip, raw.cc, &bms_start_cc_uah);
+	pm_bms_masked_write(the_chip, BMS_TOLERANCES,
+			IBAT_TOL_MASK, IBAT_TOL_DEFAULT);
+	pr_info("start_percent = %d%%\n", the_chip->start_percent);
+	bms_discharge_percent = 0;
+	pm8921_bms_stop_ocv_updates();
+
+	return rc;
+}
+EXPORT_SYMBOL_GPL(pm8921_bms_charging_began);
+
+#define DELTA_FCC_PERCENT	3
+#define MIN_START_PERCENT_FOR_LEARNING	(-30)
+void pm8921_bms_charging_end(int is_battery_full)
+{
+	int batt_temp, rc;
+	struct pm8xxx_adc_chan_result result;
+	struct pm8921_soc_params raw;
+
+	if (the_chip == NULL)
+		return;
+
+	rc = pm8xxx_adc_read(the_chip->batt_temp_channel, &result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+				the_chip->batt_temp_channel, rc);
+		return;
+	}
+	pr_debug("batt_temp phy = %lld meas = 0x%llx\n", result.physical,
+						result.measurement);
+	batt_temp = (int)result.physical;
+
+	read_soc_params_raw(the_chip, &raw);
+
+	calculate_cc_uah(the_chip, raw.cc, &bms_end_cc_uah);
+
+	if (is_battery_full
+		&& the_chip->start_percent <= MIN_START_PERCENT_FOR_LEARNING) {
+		int fcc_uah, new_fcc_uah, delta_fcc_uah;
+
+		new_fcc_uah = calculate_real_fcc_uah(the_chip, &raw,
+						batt_temp, last_chargecycles,
+						&fcc_uah);
+		delta_fcc_uah = new_fcc_uah - fcc_uah;
+		if (delta_fcc_uah < 0)
+			delta_fcc_uah = -delta_fcc_uah;
+
+		if (delta_fcc_uah * 100  > (DELTA_FCC_PERCENT * fcc_uah)) {
+			
+			if (new_fcc_uah > fcc_uah)
+				new_fcc_uah
+				= (fcc_uah +
+						(DELTA_FCC_PERCENT * fcc_uah) / 100);
+			else
+				new_fcc_uah
+				= (fcc_uah -
+						(DELTA_FCC_PERCENT * fcc_uah) / 100);
+			pr_info("delta_fcc=%d > %d percent of fcc=%d"
+					"restring it to %d\n",
+					delta_fcc_uah, DELTA_FCC_PERCENT,
+					fcc_uah, new_fcc_uah);
+		}
+		last_real_fcc_mah = new_fcc_uah/1000;
+		last_real_fcc_batt_temp = batt_temp;
+		readjust_fcc_table();
+		pr_info("learnt fcc = %d batt_temp = %d\n",
+					last_real_fcc_mah, last_real_fcc_batt_temp);
+	}
+
+	
+	if (is_battery_full) {
+		unsigned long flags;
+		spin_lock_irqsave(&the_chip->bms_100_lock, flags);
+		the_chip->ocv_reading_at_100 = raw.last_good_ocv_raw;
+		the_chip->cc_reading_at_100 = raw.cc;
+		spin_unlock_irqrestore(&the_chip->bms_100_lock, flags);
+		pr_debug("EOC ocv_reading = 0x%x cc = %d\n",
+				the_chip->ocv_reading_at_100,
+				the_chip->cc_reading_at_100);
+		pm8921_bms_start_ocv_updates();
+	}
+
+	the_chip->end_percent = calculate_state_of_charge(the_chip, &raw,
+					batt_temp, last_chargecycles, 0);
+
+	bms_end_percent = the_chip->end_percent;
+	if (!is_battery_full)
+		bms_discharge_percent = the_chip->end_percent;
+	else
+		bms_discharge_percent = 0;
+	bms_end_ocv_uv = raw.last_good_ocv_uv;
+
+	if (the_chip->end_percent > the_chip->start_percent) {
+		last_charge_increase +=
+			the_chip->end_percent - the_chip->start_percent;
+		if (last_charge_increase > 100) {
+			last_chargecycles++;
+			last_charge_increase = last_charge_increase % 100;
+		}
+	}
+	pr_info("end_percent = %d%% last_charge_increase = %d"
+			"last_chargecycles = %d\n",
+			the_chip->end_percent,
+			last_charge_increase,
+			last_chargecycles);
+	the_chip->start_percent = -EINVAL;
+	the_chip->end_percent = -EINVAL;
+	pm_bms_masked_write(the_chip, BMS_TOLERANCES,
+				IBAT_TOL_MASK, IBAT_TOL_NOCHG);
+}
+EXPORT_SYMBOL_GPL(pm8921_bms_charging_end);
+
+int pm8921_bms_stop_ocv_updates(void)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	if (!is_ocv_update_start) {
+		pr_info("ocv updates is already stopped");
+		return -EINVAL;
+	}
+	is_ocv_update_start = 0;
+	pr_info("stopping ocv updates, is_ocv_update_start=%d", is_ocv_update_start);
+	return pm_bms_masked_write(the_chip, BMS_TOLERANCES,
+			OCV_TOL_MASK, OCV_TOL_NO_OCV);
+}
+EXPORT_SYMBOL_GPL(pm8921_bms_stop_ocv_updates);
+
+int pm8921_bms_start_ocv_updates(void)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	if (is_ocv_update_start) {
+		pr_info("ocv updates is already started");
+		return -EINVAL;
+	}
+	is_ocv_update_start = 1;
+	pr_info("starting ocv updates, is_ocv_update_start=%d", is_ocv_update_start);
+	return pm_bms_masked_write(the_chip, BMS_TOLERANCES,
+			OCV_TOL_MASK, OCV_TOL_DEFAULT);
+}
+EXPORT_SYMBOL_GPL(pm8921_bms_start_ocv_updates);
+
+static irqreturn_t pm8921_bms_sbi_write_ok_handler(int irq, void *data)
+{
+	pr_debug("irq = %d triggered", irq);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t pm8921_bms_cc_thr_handler(int irq, void *data)
+{
+	pr_debug("irq = %d triggered", irq);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t pm8921_bms_vsense_thr_handler(int irq, void *data)
+{
+	pr_debug("irq = %d triggered", irq);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t pm8921_bms_vsense_for_r_handler(int irq, void *data)
+{
+	pr_debug("irq = %d triggered", irq);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t pm8921_bms_ocv_for_r_handler(int irq, void *data)
+{
+	struct pm8921_bms_chip *chip = data;
+
+	pr_debug("irq = %d triggered", irq);
+	schedule_work(&chip->calib_hkadc_work);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t pm8921_bms_good_ocv_handler(int irq, void *data)
+{
+	struct pm8921_bms_chip *chip = data;
+
+	pr_debug("irq = %d triggered", irq);
+	schedule_work(&chip->calib_hkadc_work);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t pm8921_bms_vsense_avg_handler(int irq, void *data)
+{
+	pr_debug("irq = %d triggered", irq);
+	return IRQ_HANDLED;
+}
+
+struct pm_bms_irq_init_data {
+	unsigned int	irq_id;
+	char		*name;
+	unsigned long	flags;
+	irqreturn_t	(*handler)(int, void *);
+};
+
+#define BMS_IRQ(_id, _flags, _handler) \
+{ \
+	.irq_id		= _id, \
+	.name		= #_id, \
+	.flags		= _flags, \
+	.handler	= _handler, \
+}
+
+struct pm_bms_irq_init_data bms_irq_data[] = {
+	BMS_IRQ(PM8921_BMS_SBI_WRITE_OK, IRQF_TRIGGER_RISING,
+				pm8921_bms_sbi_write_ok_handler),
+	BMS_IRQ(PM8921_BMS_CC_THR, IRQF_TRIGGER_RISING,
+				pm8921_bms_cc_thr_handler),
+	BMS_IRQ(PM8921_BMS_VSENSE_THR, IRQF_TRIGGER_RISING,
+				pm8921_bms_vsense_thr_handler),
+	BMS_IRQ(PM8921_BMS_VSENSE_FOR_R, IRQF_TRIGGER_RISING,
+				pm8921_bms_vsense_for_r_handler),
+	BMS_IRQ(PM8921_BMS_OCV_FOR_R, IRQF_TRIGGER_RISING,
+				pm8921_bms_ocv_for_r_handler),
+	BMS_IRQ(PM8921_BMS_GOOD_OCV, IRQF_TRIGGER_RISING,
+				pm8921_bms_good_ocv_handler),
+	BMS_IRQ(PM8921_BMS_VSENSE_AVG, IRQF_TRIGGER_RISING,
+				pm8921_bms_vsense_avg_handler),
+};
+
+static void free_irqs(struct pm8921_bms_chip *chip)
+{
+	int i;
+
+	for (i = 0; i < PM_BMS_MAX_INTS; i++)
+		if (chip->pmic_bms_irq[i]) {
+			free_irq(chip->pmic_bms_irq[i], NULL);
+			chip->pmic_bms_irq[i] = 0;
+		}
+}
+
+static int __devinit request_irqs(struct pm8921_bms_chip *chip,
+					struct platform_device *pdev)
+{
+	struct resource *res;
+	int ret, i;
+
+	ret = 0;
+	bitmap_fill(chip->enabled_irqs, PM_BMS_MAX_INTS);
+
+	for (i = 0; i < ARRAY_SIZE(bms_irq_data); i++) {
+		res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
+				bms_irq_data[i].name);
+		if (res == NULL) {
+			pr_err("couldn't find %s\n", bms_irq_data[i].name);
+			goto err_out;
+		}
+		ret = request_irq(res->start, bms_irq_data[i].handler,
+			bms_irq_data[i].flags,
+			bms_irq_data[i].name, chip);
+		if (ret < 0) {
+			pr_err("couldn't request %d (%s) %d\n", res->start,
+					bms_irq_data[i].name, ret);
+			goto err_out;
+		}
+		chip->pmic_bms_irq[bms_irq_data[i].irq_id] = res->start;
+		pm8921_bms_disable_irq(chip, bms_irq_data[i].irq_id);
+	}
+	return 0;
+
+err_out:
+	free_irqs(chip);
+	return -EINVAL;
+}
+
+#define EN_BMS_BIT	BIT(7)
+#define EN_PON_HS_BIT	BIT(0)
+static int __devinit pm8921_bms_hw_init(struct pm8921_bms_chip *chip)
+{
+	int rc;
+
+	rc = pm_bms_masked_write(chip, BMS_CONTROL,
+			EN_BMS_BIT | EN_PON_HS_BIT, EN_BMS_BIT | EN_PON_HS_BIT);
+	if (rc) {
+		pr_err("failed to enable pon and bms addr = %d %d",
+				BMS_CONTROL, rc);
+	}
+
+	
+	pm_bms_masked_write(chip, BMS_TOLERANCES,
+				IBAT_TOL_MASK, IBAT_TOL_NOCHG);
+
+	is_ocv_update_start = 1;
+	pm_bms_masked_write(chip, BMS_TOLERANCES,
+				OCV_TOL_MASK, OCV_TOL_DEFAULT);
+	return 0;
+}
+
+static int bms_disabled;
+static int set_disable_bms_param(const char *val, struct kernel_param *kp)
+{
+	u8 data;
+	int rc;
+	struct pm8921_bms_chip *chip = the_chip;
+
+	rc = param_set_int(val, kp);
+
+	if (rc) {
+		pr_err("error setting value %d\n", rc);
+		return rc;
+	}
+
+	if (bms_disabled)
+		data = 0;
+	else
+		data = EN_BMS_BIT | EN_PON_HS_BIT;
+
+	pr_info("set bms_disabled =%d\n", bms_disabled);
+	rc = pm_bms_masked_write(chip, BMS_CONTROL,
+			EN_BMS_BIT | EN_PON_HS_BIT, data);
+	if (rc) {
+		pr_err("failed to enable pon and bms addr = %d %d",
+				BMS_CONTROL, rc);
+	}
+
+	return 0;
+}
+module_param_call(disabled, set_disable_bms_param, param_get_uint,
+					&bms_disabled, 0644);
+
+static void check_initial_ocv(struct pm8921_bms_chip *chip)
+{
+	int ocv_uv, rc;
+	int16_t ocv_raw;
+	int usb_chg;
+
+	ocv_uv = 0;
+	pm_bms_read_output_data(chip, LAST_GOOD_OCV_VALUE, &ocv_raw);
+	usb_chg = usb_chg_plugged_in();
+	rc = convert_vbatt_raw_to_uv(chip, usb_chg, ocv_raw, &ocv_uv);
+	if (rc || ocv_uv == 0) {
+		rc = adc_based_ocv(chip, &ocv_uv);
+		if (rc) {
+			pr_err("failed to read adc based ocv_uv rc = %d\n", rc);
+			ocv_uv = DEFAULT_OCV_MICROVOLTS;
+		}
+		last_ocv_uv = ocv_uv;
+	}
+	pr_debug("ocv_uv = %d last_ocv_uv = %d\n", ocv_uv, last_ocv_uv);
+}
+
+static int64_t read_battery_id(struct pm8921_bms_chip *chip)
+{
+	int rc;
+	struct pm8xxx_adc_chan_result result;
+
+	rc = pm8xxx_adc_read(chip->batt_id_channel, &result);
+	if (rc) {
+		pr_err("error reading batt id channel = %d, rc = %d\n",
+					chip->vbat_channel, rc);
+		return rc;
+	}
+	pr_debug("batt_id phy = %lld meas = 0x%llx\n", result.physical,
+						result.measurement);
+	return result.physical;
+}
+
+#ifdef CONFIG_HTC_BATT_8960
+#define PM8921_BMS_HTC_FAKE_BATT_ID (1)
+static int set_battery_data(struct pm8921_bms_chip *chip)
+{
+	int battery_id_mv, batt_id;
+	struct pm8921_bms_battery_data* bms_battery_data;
+
+	
+	
+	if (pm8xxx_get_revision(chip->dev->parent) < PM8XXX_REVISION_8921_2p0) {
+		batt_id = PM8921_BMS_HTC_FAKE_BATT_ID;
+		htc_battery_cell_set_cur_cell_by_id(batt_id);
+	} else {
+		battery_id_mv = (int)read_battery_id(chip) / 1000;
+		
+		batt_id = htc_battery_cell_find_and_set_id_auto(battery_id_mv);
+	}
+
+	
+	bms_battery_data = htc_battery_cell_get_cur_cell_gauge_cdata();
+
+	if (bms_battery_data) {
+		pr_info("set bms_battery_data (cell_id=%d).\n",
+					batt_id);
+		chip->fcc = bms_battery_data->fcc;
+		chip->fcc_temp_lut = bms_battery_data->fcc_temp_lut;
+		chip->fcc_sf_lut = bms_battery_data->fcc_sf_lut;
+		chip->pc_temp_ocv_lut = bms_battery_data->pc_temp_ocv_lut;
+		chip->pc_sf_lut = bms_battery_data->pc_sf_lut;
+		chip->rbatt_sf_lut = bms_battery_data->rbatt_sf_lut;
+		chip->default_rbatt_mohm
+				= bms_battery_data->default_rbatt_mohm;
+		chip->delta_rbatt_mohm
+				= bms_battery_data->delta_rbatt_mohm;
+	} else {
+		pr_err("bms_battery_data doesn't exist (id=%d)\n",
+					batt_id);
+		chip->fcc = palladium_1500_data.fcc;
+		chip->fcc_temp_lut = palladium_1500_data.fcc_temp_lut;
+		chip->fcc_sf_lut = palladium_1500_data.fcc_sf_lut;
+		chip->pc_temp_ocv_lut = palladium_1500_data.pc_temp_ocv_lut;
+		chip->pc_sf_lut = palladium_1500_data.pc_sf_lut;
+		chip->rbatt_sf_lut = palladium_1500_data.rbatt_sf_lut;
+		chip->default_rbatt_mohm
+				= palladium_1500_data.default_rbatt_mohm;
+		chip->delta_rbatt_mohm
+				= palladium_1500_data.delta_rbatt_mohm;
+	}
+	return 0;
+}
+#else
+#define PALLADIUM_ID_MIN	0x7F40
+#define PALLADIUM_ID_MAX	0x7F5A
+#define DESAY_5200_ID_MIN	0x7F7F
+#define DESAY_5200_ID_MAX	0x802F
+static int set_battery_data(struct pm8921_bms_chip *chip)
+{
+	int64_t battery_id;
+
+	battery_id = read_battery_id(chip);
+
+	if (battery_id < 0) {
+		pr_err("cannot read battery id err = %lld\n", battery_id);
+		return battery_id;
+	}
+
+	if (is_between(PALLADIUM_ID_MIN, PALLADIUM_ID_MAX, battery_id)) {
+		chip->fcc = palladium_1500_data.fcc;
+		chip->fcc_temp_lut = palladium_1500_data.fcc_temp_lut;
+		chip->fcc_sf_lut = palladium_1500_data.fcc_sf_lut;
+		chip->pc_temp_ocv_lut = palladium_1500_data.pc_temp_ocv_lut;
+		chip->pc_sf_lut = palladium_1500_data.pc_sf_lut;
+		chip->rbatt_sf_lut = palladium_1500_data.rbatt_sf_lut;
+		chip->default_rbatt_mohm
+				= palladium_1500_data.default_rbatt_mohm;
+		chip->delta_rbatt_mohm
+				= palladium_1500_data.delta_rbatt_mohm;
+		return 0;
+	} else if (is_between(DESAY_5200_ID_MIN, DESAY_5200_ID_MAX,
+				battery_id)) {
+		chip->fcc = desay_5200_data.fcc;
+		chip->fcc_temp_lut = desay_5200_data.fcc_temp_lut;
+		chip->fcc_sf_lut = desay_5200_data.fcc_sf_lut;
+		chip->pc_temp_ocv_lut = desay_5200_data.pc_temp_ocv_lut;
+		chip->pc_sf_lut = desay_5200_data.pc_sf_lut;
+		chip->rbatt_sf_lut = desay_5200_data.rbatt_sf_lut;
+		chip->default_rbatt_mohm = desay_5200_data.default_rbatt_mohm;
+		chip->delta_rbatt_mohm = desay_5200_data.delta_rbatt_mohm;
+		return 0;
+	} else {
+		pr_warn("invalid battery id, palladium 1500 assumed batt_id %llx\n",
+				battery_id);
+		chip->fcc = palladium_1500_data.fcc;
+		chip->fcc_temp_lut = palladium_1500_data.fcc_temp_lut;
+		chip->fcc_sf_lut = palladium_1500_data.fcc_sf_lut;
+		chip->pc_temp_ocv_lut = palladium_1500_data.pc_temp_ocv_lut;
+		chip->pc_sf_lut = palladium_1500_data.pc_sf_lut;
+		chip->rbatt_sf_lut = palladium_1500_data.rbatt_sf_lut;
+		chip->default_rbatt_mohm
+				= palladium_1500_data.default_rbatt_mohm;
+		chip->delta_rbatt_mohm
+				= palladium_1500_data.delta_rbatt_mohm;
+		return 0;
+	}
+}
+#endif 
+
+enum bms_request_operation {
+	CALC_RBATT,
+	CALC_FCC,
+	CALC_PC,
+	CALC_SOC,
+	CALIB_HKADC,
+	CALIB_CCADC,
+	STOP_OCV,
+	START_OCV,
+	GET_VBAT_VSENSE_SIMULTANEOUS,
+};
+
+static int test_batt_temp = 5;
+static int test_chargecycle = 150;
+static int test_ocv = 3900000;
+enum {
+	TEST_BATT_TEMP,
+	TEST_CHARGE_CYCLE,
+	TEST_OCV,
+};
+static int get_test_param(void *data, u64 * val)
+{
+	switch ((int)data) {
+	case TEST_BATT_TEMP:
+		*val = test_batt_temp;
+		break;
+	case TEST_CHARGE_CYCLE:
+		*val = test_chargecycle;
+		break;
+	case TEST_OCV:
+		*val = test_ocv;
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+static int set_test_param(void *data, u64  val)
+{
+	switch ((int)data) {
+	case TEST_BATT_TEMP:
+		test_batt_temp = (int)val;
+		break;
+	case TEST_CHARGE_CYCLE:
+		test_chargecycle = (int)val;
+		break;
+	case TEST_OCV:
+		test_ocv = (int)val;
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(temp_fops, get_test_param, set_test_param, "%llu\n");
+
+static int get_calc(void *data, u64 * val)
+{
+	int param = (int)data;
+	int ret = 0;
+	int ibat_ua, vbat_uv;
+	struct pm8921_soc_params raw;
+	struct pm8921_rbatt_params rraw;
+
+	read_soc_params_raw(the_chip, &raw);
+	read_rbatt_params_raw(the_chip, &rraw);
+
+	*val = 0;
+
+	
+	switch (param) {
+	case CALC_RBATT:
+		*val = calculate_rbatt_resume(the_chip, &rraw);
+		break;
+	case CALC_FCC:
+		*val = calculate_fcc_uah(the_chip, test_batt_temp,
+							test_chargecycle);
+		break;
+	case CALC_PC:
+		*val = calculate_pc(the_chip, test_ocv, test_batt_temp,
+							test_chargecycle);
+		break;
+	case CALC_SOC:
+		*val = calculate_state_of_charge(the_chip, &raw,
+					test_batt_temp, test_chargecycle, 0);
+		break;
+	case CALIB_HKADC:
+		
+		*val = 0;
+		calib_hkadc(the_chip);
+		break;
+	case CALIB_CCADC:
+		
+		*val = 0;
+		pm8xxx_calib_ccadc();
+		break;
+	case GET_VBAT_VSENSE_SIMULTANEOUS:
+		
+		*val =
+		pm8921_bms_get_simultaneous_battery_voltage_and_current(
+			&ibat_ua,
+			&vbat_uv);
+		break;
+	default:
+		ret = -EINVAL;
+	}
+	return ret;
+}
+
+static int set_calc(void *data, u64 val)
+{
+	int param = (int)data;
+	int ret = 0;
+
+	switch (param) {
+	case STOP_OCV:
+		pm8921_bms_stop_ocv_updates();
+		break;
+	case START_OCV:
+		pm8921_bms_start_ocv_updates();
+		break;
+	default:
+		ret = -EINVAL;
+	}
+	return ret;
+}
+DEFINE_SIMPLE_ATTRIBUTE(calc_fops, get_calc, set_calc, "%llu\n");
+
+static int get_reading(void *data, u64 * val)
+{
+	int param = (int)data;
+	int ret = 0;
+	struct pm8921_soc_params raw;
+	struct pm8921_rbatt_params rraw;
+
+	read_soc_params_raw(the_chip, &raw);
+	read_rbatt_params_raw(the_chip, &rraw);
+
+	*val = 0;
+
+	switch (param) {
+	case CC_MSB:
+	case CC_LSB:
+		*val = raw.cc;
+		break;
+	case LAST_GOOD_OCV_VALUE:
+		*val = raw.last_good_ocv_uv;
+		break;
+	case VBATT_FOR_RBATT:
+		*val = rraw.vbatt_for_rbatt_uv;
+		break;
+	case VSENSE_FOR_RBATT:
+		*val = rraw.vsense_for_rbatt_uv;
+		break;
+	case OCV_FOR_RBATT:
+		*val = rraw.ocv_for_rbatt_uv;
+		break;
+	case VSENSE_AVG:
+		read_vsense_avg(the_chip, (uint *)val);
+		break;
+	default:
+		ret = -EINVAL;
+	}
+	return ret;
+}
+DEFINE_SIMPLE_ATTRIBUTE(reading_fops, get_reading, NULL, "%lld\n");
+
+static int get_rt_status(void *data, u64 * val)
+{
+	int i = (int)data;
+	int ret;
+
+	
+	ret = pm_bms_get_rt_status(the_chip, i);
+	*val = ret;
+	return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(rt_fops, get_rt_status, NULL, "%llu\n");
+
+static int get_reg(void *data, u64 * val)
+{
+	int addr = (int)data;
+	int ret;
+	u8 temp;
+
+	ret = pm8xxx_readb(the_chip->dev->parent, addr, &temp);
+	if (ret) {
+		pr_err("pm8xxx_readb to %x value = %d errored = %d\n",
+			addr, temp, ret);
+		return -EAGAIN;
+	}
+	*val = temp;
+	return 0;
+}
+
+static int set_reg(void *data, u64 val)
+{
+	int addr = (int)data;
+	int ret;
+	u8 temp;
+
+	temp = (u8) val;
+	ret = pm8xxx_writeb(the_chip->dev->parent, addr, temp);
+	if (ret) {
+		pr_err("pm8xxx_writeb to %x value = %d errored = %d\n",
+			addr, temp, ret);
+		return -EAGAIN;
+	}
+	return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(reg_fops, get_reg, set_reg, "0x%02llx\n");
+
+static void dump_all(void)
+{
+	u64 val;
+	
+	get_reg((void *)BMS_CONTROL, &val);
+	pr_info("BMS_CONTROL = 0x%02llx\n", val);
+	get_reg((void *)BMS_OUTPUT0, &val);
+	pr_info("BMS_OUTPUT0 = 0x%02llx\n", val);
+	get_reg((void *)BMS_OUTPUT1, &val);
+	pr_info("BMS_OUTPUT1 = 0x%02llx\n", val);
+	get_reg((void *)BMS_TOLERANCES, &val);
+	pr_info("BMS_TOLERANCES = 0x%02llx\n", val);
+	get_reg((void *)BMS_TEST1, &val);
+	pr_info("BMS_TEST1 = 0x%02llx\n", val);
+	get_reg((void *)OCV_UPDATE_STORAGE, &val);
+	pr_info("OCV_UPDATE_STORAGE = 0x%02llx\n", val);
+
+	
+	get_reading((void *)CC_MSB, &val);
+	pr_info("read_cc = 0x%lld\n", val);
+	get_reading((void *)LAST_GOOD_OCV_VALUE, &val);
+	pr_info("last_good_ocv = 0x%lld\n", val);
+	get_reading((void *)VBATT_FOR_RBATT, &val);
+	pr_info("vbatt_for_rbatt = 0x%lld\n", val);
+	get_reading((void *)VSENSE_FOR_RBATT, &val);
+	pr_info("vsense_for_rbatt = 0x%lld\n", val);
+	get_reading((void *)OCV_FOR_RBATT, &val);
+	pr_info("ocv_for_rbatt = 0x%lld\n", val);
+	get_reading((void *)VSENSE_AVG, &val);
+	pr_info("vsense_avg = 0x%lld\n", val);
+
+	
+	pr_info("BMS irq: %d%d%d%d%d%d%d\n",
+		pm_bms_get_rt_status(the_chip, PM8921_BMS_SBI_WRITE_OK),
+		pm_bms_get_rt_status(the_chip, PM8921_BMS_CC_THR),
+		pm_bms_get_rt_status(the_chip, PM8921_BMS_VSENSE_THR),
+		pm_bms_get_rt_status(the_chip, PM8921_BMS_VSENSE_FOR_R),
+		pm_bms_get_rt_status(the_chip, PM8921_BMS_OCV_FOR_R),
+		pm_bms_get_rt_status(the_chip, PM8921_BMS_GOOD_OCV),
+		pm_bms_get_rt_status(the_chip, PM8921_BMS_VSENSE_AVG));
+
+	pm8xxx_ccadc_dump_all();
+}
+
+inline int pm8921_bms_dump_all(void)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	dump_all();
+	return 0;
+}
+EXPORT_SYMBOL(pm8921_bms_dump_all);
+
+int pm8921_bms_get_attr_text(char *buf, int size)
+{
+	struct pm8921_soc_params raw;
+	struct pm8921_rbatt_params rraw;
+	unsigned long flags;
+	int len = 0;
+	u64 val = 0;
+	int cc_uah, fcc_uah, unusable_charge_uah, remaining_charge_uah;
+	int chargecycles;
+	int soc_rbatt, rbatt;
+	int batt_temp, rc;
+	struct pm8xxx_adc_chan_result result;
+
+	if (!the_chip) {
+		pr_err("driver not initialized\n");
+		return 0;
+	}
+
+	get_reg((void *)BMS_CONTROL, &val);
+	len += scnprintf(buf + len, size - len,
+			"BMS_CONTROL: 0x%02llx;\n", val);
+	get_reg((void *)BMS_OUTPUT0, &val);
+	len += scnprintf(buf + len, size - len,
+			"BMS_OUTPUT0: 0x%02llx;\n", val);
+	get_reg((void *)BMS_OUTPUT1, &val);
+	len += scnprintf(buf + len, size - len,
+			"BMS_OUTPUT1: 0x%02llx;\n", val);
+	get_reg((void *)BMS_TOLERANCES, &val);
+	len += scnprintf(buf + len, size - len,
+			"BMS_TOLERANCES: 0x%02llx;\n", val);
+	get_reg((void *)BMS_TEST1, &val);
+	len += scnprintf(buf + len, size - len,
+			"BMS_TEST1: 0x%02llx;\n", val);
+	get_reg((void *)OCV_UPDATE_STORAGE, &val);
+	len += scnprintf(buf + len, size - len,
+			"OCV_UPDATE_STORAGE: 0x%02llx;\n", val);
+
+	len += scnprintf(buf + len, size - len,
+			"bms_discharge_soc: %d;\n", bms_discharge_percent);
+	len += scnprintf(buf + len, size - len,
+			"is_ocv_update_start: %d;\n", is_ocv_update_start);
+
+	read_soc_params_raw(the_chip, &raw);
+	read_rbatt_params_raw(the_chip, &rraw);
+
+	len += scnprintf(buf + len, size - len,
+			"OCV_FOR_RBATT_RAW: 0x%x;\n", rraw.ocv_for_rbatt_raw);
+	len += scnprintf(buf + len, size - len,
+			"VBATT_FOR_RBATT_RAW: 0x%x;\n", rraw.vbatt_for_rbatt_raw);
+	len += scnprintf(buf + len, size - len,
+			"VSENSE_FOR_RBATT_RAW: 0x%x;\n", rraw.vsense_for_rbatt_raw);
+	len += scnprintf(buf + len, size - len,
+			"LAST_GOOD_OCV_RAW: 0x%x;\n", raw.last_good_ocv_raw);
+	len += scnprintf(buf + len, size - len,
+			"CC_RAW: 0x%x;\n", raw.cc);
+
+	len += scnprintf(buf + len, size - len,
+			"ocv_for_rbatt_uv: %d;\n", rraw.ocv_for_rbatt_uv);
+	len += scnprintf(buf + len, size - len,
+			"vbatt_for_rbatt_uv: %d;\n", rraw.vbatt_for_rbatt_uv);
+	len += scnprintf(buf + len, size - len,
+			"vsense_for_rbatt_uv: %d;\n", rraw.vsense_for_rbatt_uv);
+	len += scnprintf(buf + len, size - len,
+			"last_good_ocv_uv: %d;\n", raw.last_good_ocv_uv);
+
+	rc = pm8xxx_adc_read(the_chip->batt_temp_channel, &result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+				the_chip->batt_temp_channel, rc);
+		return len;
+	}
+	batt_temp = (int)result.physical;
+	chargecycles = last_chargecycles;
+	fcc_uah = calculate_fcc_uah(the_chip, batt_temp, chargecycles);
+	remaining_charge_uah = calculate_remaining_charge_uah(the_chip, &raw,
+					fcc_uah, batt_temp, chargecycles);
+	spin_lock_irqsave(&the_chip->bms_100_lock, flags);
+	calculate_cc_uah(the_chip, raw.cc, &cc_uah);
+	spin_unlock_irqrestore(&the_chip->bms_100_lock, flags);
+	soc_rbatt = ((remaining_charge_uah - cc_uah) * 100) / fcc_uah;
+	if (soc_rbatt < 0)
+		soc_rbatt = 0;
+	rbatt = get_rbatt(the_chip, soc_rbatt, batt_temp);
+	unusable_charge_uah = calculate_unusable_charge_uah(the_chip, rbatt,
+					fcc_uah, batt_temp, chargecycles);
+	len += scnprintf(buf + len, size - len,
+			"rbatt(milliOhms): %d;\n", bms_dbg.rbatt);
+	len += scnprintf(buf + len, size - len,
+			"rbatt_scalefactor: %d;\n", bms_dbg.rbatt_sf);
+	len += scnprintf(buf + len, size - len,
+			"soc_rbatt(%%): %d;\n", bms_dbg.soc_rbatt);
+	len += scnprintf(buf + len, size - len,
+			"last_rbatt(%%): %d;\n", last_rbatt);
+	len += scnprintf(buf + len, size - len,
+			"voltage_unusable_uv(uV): %d;\n", bms_dbg.voltage_unusable_uv);
+	len += scnprintf(buf + len, size - len,
+			"pc_unusable(%%): %d;\n", bms_dbg.pc_unusable);
+	len += scnprintf(buf + len, size - len,
+			"rc_pc(%%): %d;\n", bms_dbg.rc_pc);
+	len += scnprintf(buf + len, size - len,
+			"scalefactor(): %d;\n", bms_dbg.scalefactor);
+	len += scnprintf(buf + len, size - len,
+			"fcc(uAh): %d;\n", fcc_uah);
+	len += scnprintf(buf + len, size - len,
+			"unusable_charge(uAh): %d;\n", unusable_charge_uah);
+	len += scnprintf(buf + len, size - len,
+			"remaining_charge(uAh): %d;\n", remaining_charge_uah);
+	len += scnprintf(buf + len, size - len,
+			"cc(uAh): %d;\n", cc_uah);
+	len += scnprintf(buf + len, size - len,
+			"chargecycles: %d;\n", chargecycles);
+	len += scnprintf(buf + len, size - len,
+			"start_percent: %d;\n", the_chip->start_percent);
+	len += scnprintf(buf + len, size - len,
+			"end_percent: %d;\n", the_chip->end_percent);
+
+	
+	len += pm8xxx_ccadc_get_attr_text(buf + len, size - len);
+
+	return len;
+}
+EXPORT_SYMBOL(pm8921_bms_get_attr_text);
+
+static void create_debugfs_entries(struct pm8921_bms_chip *chip)
+{
+	int i;
+
+	chip->dent = debugfs_create_dir("pm8921-bms", NULL);
+
+	if (IS_ERR(chip->dent)) {
+		pr_err("pmic bms couldnt create debugfs dir\n");
+		return;
+	}
+
+	debugfs_create_file("BMS_CONTROL", 0644, chip->dent,
+			(void *)BMS_CONTROL, &reg_fops);
+	debugfs_create_file("BMS_OUTPUT0", 0644, chip->dent,
+			(void *)BMS_OUTPUT0, &reg_fops);
+	debugfs_create_file("BMS_OUTPUT1", 0644, chip->dent,
+			(void *)BMS_OUTPUT1, &reg_fops);
+	debugfs_create_file("BMS_TEST1", 0644, chip->dent,
+			(void *)BMS_TEST1, &reg_fops);
+
+	debugfs_create_file("test_batt_temp", 0644, chip->dent,
+				(void *)TEST_BATT_TEMP, &temp_fops);
+	debugfs_create_file("test_chargecycle", 0644, chip->dent,
+				(void *)TEST_CHARGE_CYCLE, &temp_fops);
+	debugfs_create_file("test_ocv", 0644, chip->dent,
+				(void *)TEST_OCV, &temp_fops);
+
+	debugfs_create_file("read_cc", 0644, chip->dent,
+				(void *)CC_MSB, &reading_fops);
+	debugfs_create_file("read_last_good_ocv", 0644, chip->dent,
+				(void *)LAST_GOOD_OCV_VALUE, &reading_fops);
+	debugfs_create_file("read_vbatt_for_rbatt", 0644, chip->dent,
+				(void *)VBATT_FOR_RBATT, &reading_fops);
+	debugfs_create_file("read_vsense_for_rbatt", 0644, chip->dent,
+				(void *)VSENSE_FOR_RBATT, &reading_fops);
+	debugfs_create_file("read_ocv_for_rbatt", 0644, chip->dent,
+				(void *)OCV_FOR_RBATT, &reading_fops);
+	debugfs_create_file("read_vsense_avg", 0644, chip->dent,
+				(void *)VSENSE_AVG, &reading_fops);
+
+	debugfs_create_file("show_rbatt", 0644, chip->dent,
+				(void *)CALC_RBATT, &calc_fops);
+	debugfs_create_file("show_fcc", 0644, chip->dent,
+				(void *)CALC_FCC, &calc_fops);
+	debugfs_create_file("show_pc", 0644, chip->dent,
+				(void *)CALC_PC, &calc_fops);
+	debugfs_create_file("show_soc", 0644, chip->dent,
+				(void *)CALC_SOC, &calc_fops);
+	debugfs_create_file("calib_hkadc", 0644, chip->dent,
+				(void *)CALIB_HKADC, &calc_fops);
+	debugfs_create_file("calib_ccadc", 0644, chip->dent,
+				(void *)CALIB_CCADC, &calc_fops);
+	debugfs_create_file("stop_ocv", 0644, chip->dent,
+				(void *)STOP_OCV, &calc_fops);
+	debugfs_create_file("start_ocv", 0644, chip->dent,
+				(void *)START_OCV, &calc_fops);
+
+	debugfs_create_file("simultaneous", 0644, chip->dent,
+			(void *)GET_VBAT_VSENSE_SIMULTANEOUS, &calc_fops);
+
+	for (i = 0; i < ARRAY_SIZE(bms_irq_data); i++) {
+		if (chip->pmic_bms_irq[bms_irq_data[i].irq_id])
+			debugfs_create_file(bms_irq_data[i].name, 0444,
+				chip->dent,
+				(void *)bms_irq_data[i].irq_id,
+				&rt_fops);
+	}
+}
+
+static int dump_cc_uah(void)
+{
+	unsigned long flags;
+	struct pm8921_soc_params raw;
+	int cc_uah;
+
+	if (!the_chip) {
+		pr_err("driver not initialized\n");
+		return 0;
+	}
+	read_soc_params_raw(the_chip, &raw);
+
+	spin_lock_irqsave(&the_chip->bms_100_lock, flags);
+	
+	calculate_cc_uah(the_chip, raw.cc, &cc_uah);
+	pr_info("cc_uah = %duAh, raw->cc = %x,"
+			" cc = %lld after subtracting %d\n",
+				cc_uah, raw.cc,
+				(int64_t)raw.cc - the_chip->cc_reading_at_100,
+				the_chip->cc_reading_at_100);
+	spin_unlock_irqrestore(&the_chip->bms_100_lock, flags);
+	return cc_uah;
+}
+
+int prev_cc_uah = 0;
+static int pm8921_bms_suspend(struct device *dev)
+{
+	u64 val;
+	int rc;
+	struct pm8xxx_adc_chan_result result;
+	struct pm8921_bms_chip *chip = dev_get_drvdata(dev);
+	struct pm8921_soc_params raw;
+	int fcc_uah;
+	int remaining_charge_uah;
+	int cc_uah;
+
+	chip->batt_temp_suspend = 0;
+	rc = pm8xxx_adc_read(chip->batt_temp_channel, &result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+					chip->batt_temp_channel, rc);
+	}
+	chip->batt_temp_suspend = (int)result.physical;
+	read_soc_params_raw(chip, &raw);
+
+	fcc_uah = calculate_fcc_uah(chip,
+			chip->batt_temp_suspend, last_chargecycles);
+	pr_debug("FCC = %uuAh batt_temp = %d, cycles = %d\n",
+			fcc_uah, chip->batt_temp_suspend, last_chargecycles);
+	
+	remaining_charge_uah = calculate_remaining_charge_uah(chip, &raw,
+					fcc_uah, chip->batt_temp_suspend,
+					last_chargecycles);
+	pr_debug("RC = %uuAh\n", remaining_charge_uah);
+
+	
+	calculate_cc_uah(chip, raw.cc, &cc_uah);
+	pr_debug("cc_uah = %duAh raw->cc = %x cc = %lld after subtracting %d\n",
+				cc_uah, raw.cc,
+				(int64_t)raw.cc - chip->cc_reading_at_100,
+				chip->cc_reading_at_100);
+	chip->soc_rbatt_suspend = ((remaining_charge_uah - cc_uah) * 100)
+						/ fcc_uah;
+
+	dump_cc_uah();
+	get_reg((void *)BMS_TOLERANCES, &val);
+	pr_info("BMS_TOLERANCES = 0x%02llx\n", val);
+	return 0;
+}
+
+#define DELTA_RBATT_PERCENT	10
+static int pm8921_bms_resume(struct device *dev)
+{
+	u64 val;
+	struct pm8921_rbatt_params raw;
+	struct pm8921_bms_chip *chip = dev_get_drvdata(dev);
+	int rbatt;
+	int expected_rbatt;
+	int scalefactor;
+	int delta_rbatt;
+
+	read_rbatt_params_raw(chip, &raw);
+	rbatt = calculate_rbatt_resume(chip, &raw);
+
+	if (rbatt < 0)
+		return 0;
+
+	expected_rbatt
+		= (last_rbatt < 0) ? chip->default_rbatt_mohm : last_rbatt;
+
+	if (chip->rbatt_sf_lut) {
+		scalefactor = interpolate_scalingfactor(chip,
+						chip->rbatt_sf_lut,
+						chip->batt_temp_suspend / 10,
+						chip->soc_rbatt_suspend);
+		rbatt = rbatt * 100 / scalefactor;
+	}
+
+	delta_rbatt = expected_rbatt - rbatt;
+	if (delta_rbatt)
+		delta_rbatt = -delta_rbatt;
+	if (delta_rbatt * 100 <= DELTA_RBATT_PERCENT * expected_rbatt)
+		last_rbatt = rbatt;
+
+	dump_cc_uah();
+	get_reg((void *)BMS_TOLERANCES, &val);
+	pr_info("last_rbatt:%d , BMS_TOLERANCES = 0x%02llx\n", last_rbatt, val);
+	return 0;
+}
+
+static const struct dev_pm_ops pm8921_bms_pm_ops = {
+	.suspend	= pm8921_bms_suspend,
+	.resume		= pm8921_bms_resume,
+};
+
+#define REG_SBI_CONFIG		0x04F
+#define PAGE3_ENABLE_MASK	0x6
+#define PROGRAM_REV_MASK	0x0F
+#define PROGRAM_REV		0x9
+static int read_ocv_trim(struct pm8921_bms_chip *chip)
+{
+	int rc;
+	u8 reg, sbi_config;
+
+	rc = pm8xxx_readb(chip->dev->parent, REG_SBI_CONFIG, &sbi_config);
+	if (rc) {
+		pr_err("error = %d reading sbi config reg\n", rc);
+		return rc;
+	}
+
+	reg = sbi_config | PAGE3_ENABLE_MASK;
+	rc = pm8xxx_writeb(chip->dev->parent, REG_SBI_CONFIG, reg);
+	if (rc) {
+		pr_err("error = %d writing sbi config reg\n", rc);
+		return rc;
+	}
+
+	rc = pm8xxx_readb(chip->dev->parent, TEST_PROGRAM_REV, &reg);
+	if (rc)
+		pr_err("Error %d reading %d addr %d\n",
+			rc, reg, TEST_PROGRAM_REV);
+	pr_info("program rev reg is 0x%x\n", reg);
+	reg &= PROGRAM_REV_MASK;
+
+	
+	if (reg >= PROGRAM_REV) {
+		chip->amux_2_trim_delta = 0;
+		goto restore_sbi_config;
+	}
+
+	rc = pm8xxx_readb(chip->dev->parent, AMUX_TRIM_2, &reg);
+	if (rc) {
+		pr_err("error = %d reading trim reg\n", rc);
+		return rc;
+	}
+
+	chip->amux_2_trim_delta = abs(0x49 - reg);
+	pr_info("trim reg=0x%x, trim delta=%d\n", reg, chip->amux_2_trim_delta);
+
+restore_sbi_config:
+	rc = pm8xxx_writeb(chip->dev->parent, REG_SBI_CONFIG, sbi_config);
+	if (rc) {
+		pr_err("error = %d writing sbi config reg\n", rc);
+		return rc;
+	}
+
+	return 0;
+}
+
+static int __devinit pm8921_bms_probe(struct platform_device *pdev)
+{
+	int rc = 0;
+	int vbatt;
+	struct pm8921_bms_chip *chip;
+	const struct pm8921_bms_platform_data *pdata
+				= pdev->dev.platform_data;
+#ifdef CONFIG_HTC_BATT_8960
+	const struct pm8921_charger_batt_param *chg_batt_param;
+#endif
+
+	pr_info("%s\n", __func__);
+
+	if (!pdata) {
+		pr_err("missing platform data\n");
+		return -EINVAL;
+	}
+
+	chip = kzalloc(sizeof(struct pm8921_bms_chip), GFP_KERNEL);
+	if (!chip) {
+		pr_err("Cannot allocate pm_bms_chip\n");
+		return -ENOMEM;
+	}
+	mutex_init(&chip->bms_output_lock);
+	spin_lock_init(&chip->bms_100_lock);
+	chip->dev = &pdev->dev;
+	chip->r_sense = pdata->r_sense;
+	chip->i_test = pdata->i_test;
+	chip->v_failure = pdata->v_failure;
+	chip->rconn_mohm = pdata->rconn_mohm;
+	chip->start_percent = -EINVAL;
+	chip->end_percent = -EINVAL;
+
+	chip->batt_temp_channel = pdata->bms_cdata.batt_temp_channel;
+	chip->vbat_channel = pdata->bms_cdata.vbat_channel;
+	chip->ref625mv_channel = pdata->bms_cdata.ref625mv_channel;
+	chip->ref1p25v_channel = pdata->bms_cdata.ref1p25v_channel;
+	chip->batt_id_channel = pdata->bms_cdata.batt_id_channel;
+	chip->revision = pm8xxx_get_revision(chip->dev->parent);
+	INIT_WORK(&chip->calib_hkadc_work, calibrate_hkadc_work);
+
+	rc = set_battery_data(chip);
+	if (rc) {
+		pr_err("%s bad battery data %d\n", __func__, rc);
+		goto free_chip;
+	}
+#ifdef CONFIG_HTC_BATT_8960
+	
+	chg_batt_param = htc_battery_cell_get_cur_cell_charger_cdata();
+	if (!chg_batt_param) {
+		chip->max_voltage_uv = pdata->max_voltage_uv;
+	} else {
+		chip->max_voltage_uv = chg_batt_param->max_voltage * 1000;
+	}
+#else
+	chip->max_voltage_uv = pdata->max_voltage_uv;
+#endif 
+
+	if (chip->pc_temp_ocv_lut == NULL) {
+		pr_err("temp ocv lut table is NULL\n");
+		rc = -EINVAL;
+		goto free_chip;
+	}
+
+	
+	if (chip->default_rbatt_mohm <= 0)
+		chip->default_rbatt_mohm = DEFAULT_RBATT_MOHMS;
+
+
+	rc = request_irqs(chip, pdev);
+	if (rc) {
+		pr_err("couldn't register interrupts rc = %d\n", rc);
+		goto free_chip;
+	}
+
+	rc = pm8921_bms_hw_init(chip);
+	if (rc) {
+		pr_err("couldn't init hardware rc = %d\n", rc);
+		goto free_irqs;
+	}
+
+	platform_set_drvdata(pdev, chip);
+	the_chip = chip;
+	create_debugfs_entries(chip);
+
+	rc = read_ocv_trim(chip);
+	if (rc) {
+		pr_err("couldn't adjust ocv_trim rc= %d\n", rc);
+		goto free_irqs;
+	}
+	check_initial_ocv(chip);
+
+	
+	schedule_work(&chip->calib_hkadc_work);
+	
+	pm8921_bms_enable_irq(chip, PM8921_BMS_GOOD_OCV);
+	pm8921_bms_enable_irq(chip, PM8921_BMS_OCV_FOR_R);
+
+	get_battery_uvolts(chip, &vbatt);
+	pr_info("OK battery_capacity_at_boot=%d volt = %d ocv = %d\n",
+				pm8921_bms_get_percent_charge(),
+				vbatt, last_ocv_uv);
+	pr_info("r_sense=%u,i_test=%u,v_failure=%u\n", chip->r_sense, chip->i_test, chip->v_failure);
+	return 0;
+
+free_irqs:
+	free_irqs(chip);
+free_chip:
+	kfree(chip);
+	return rc;
+}
+
+static int __devexit pm8921_bms_remove(struct platform_device *pdev)
+{
+	struct pm8921_bms_chip *chip = platform_get_drvdata(pdev);
+
+	free_irqs(chip);
+	kfree(chip->adjusted_fcc_temp_lut);
+	platform_set_drvdata(pdev, NULL);
+	the_chip = NULL;
+	kfree(chip);
+	return 0;
+}
+
+static struct platform_driver pm8921_bms_driver = {
+	.probe	= pm8921_bms_probe,
+	.remove	= __devexit_p(pm8921_bms_remove),
+	.driver	= {
+		.name	= PM8921_BMS_DEV_NAME,
+		.owner	= THIS_MODULE,
+		.pm = &pm8921_bms_pm_ops,
+	},
+};
+
+static int __init pm8921_bms_init(void)
+{
+	flag_enable_bms_chg_log =
+		(get_kernel_flag() & KERNEL_FLAG_ENABLE_BMS_CHARGER_LOG) ? 1 : 0;
+	return platform_driver_register(&pm8921_bms_driver);
+}
+
+static void __exit pm8921_bms_exit(void)
+{
+	platform_driver_unregister(&pm8921_bms_driver);
+}
+
+late_initcall(pm8921_bms_init);
+module_exit(pm8921_bms_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("PMIC8921 bms driver");
+MODULE_VERSION("1.0");
+MODULE_ALIAS("platform:" PM8921_BMS_DEV_NAME);
diff --git a/drivers/power/pm8921-charger-htc.c b/drivers/power/pm8921-charger-htc.c
new file mode 100644
index 0000000..aebb958
--- /dev/null
+++ b/drivers/power/pm8921-charger-htc.c
@@ -0,0 +1,5323 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#define pr_fmt(fmt)	"[BATT][CHG] " fmt
+#define pr_fmt_debug(fmt)    "[BATT][CHG]%s: " fmt, __func__
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/platform_device.h>
+#include <linux/errno.h>
+#include <linux/mfd/pm8xxx/pm8921-charger-htc.h>
+#include <linux/mfd/pm8xxx/pm8921-bms-htc.h>
+#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
+#include <linux/mfd/pm8xxx/ccadc.h>
+#include <linux/mfd/pm8xxx/core.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/bitops.h>
+#include <linux/workqueue.h>
+#include <linux/debugfs.h>
+#include <linux/slab.h>
+#include <linux/gpio.h>
+
+#include <mach/msm_xo.h>
+#ifdef CONFIG_USB_MSM_OTG_72K
+#include <mach/msm_hsusb.h>
+#else
+#include <linux/usb/msm_hsusb.h>
+#endif
+#include <mach/board_htc.h>
+
+#include <mach/htc_gauge.h>
+#include <mach/htc_charger.h>
+#include <mach/htc_battery_cell.h>
+
+#include <mach/cable_detect.h>
+#include <linux/i2c/smb349.h>
+
+static int extchg_temp_condition_old;
+
+struct delayed_work ext_charger_vbat_low_task;
+struct delayed_work ext_charger_chgdone_task;
+struct delayed_work ext_charger_temp_task;
+struct workqueue_struct *ext_charger_wq;
+
+#if defined(pr_debug)
+#undef pr_debug
+#endif
+#define pr_debug(fmt, ...) do { \
+		if (flag_enable_BMS_Charger_log) \
+			printk(KERN_INFO pr_fmt_debug(fmt), ##__VA_ARGS__); \
+	} while (0)
+
+static bool flag_enable_BMS_Charger_log;
+
+#define CHG_BUCK_CLOCK_CTRL	0x14
+
+#define PBL_ACCESS1		0x04
+#define PBL_ACCESS2		0x05
+#define SYS_CONFIG_1		0x06
+#define SYS_CONFIG_2		0x07
+#define CHG_CNTRL		0x204
+#define CHG_IBAT_MAX		0x205
+#define CHG_TEST		0x206
+#define CHG_BUCK_CTRL_TEST1	0x207
+#define CHG_BUCK_CTRL_TEST2	0x208
+#define CHG_BUCK_CTRL_TEST3	0x209
+#define COMPARATOR_OVERRIDE	0x20A
+#define PSI_TXRX_SAMPLE_DATA_0	0x20B
+#define PSI_TXRX_SAMPLE_DATA_1	0x20C
+#define PSI_TXRX_SAMPLE_DATA_2	0x20D
+#define PSI_TXRX_SAMPLE_DATA_3	0x20E
+#define PSI_CONFIG_STATUS	0x20F
+#define CHG_IBAT_SAFE		0x210
+#define CHG_ITRICKLE		0x211
+#define CHG_CNTRL_2		0x212
+#define CHG_VBAT_DET		0x213
+#define CHG_VTRICKLE		0x214
+#define CHG_ITERM		0x215
+#define CHG_CNTRL_3		0x216
+#define CHG_VIN_MIN		0x217
+#define CHG_TWDOG		0x218
+#define CHG_TTRKL_MAX		0x219
+#define CHG_TEMP_THRESH		0x21A
+#define CHG_TCHG_MAX		0x21B
+#define USB_OVP_CONTROL		0x21C
+#define DC_OVP_CONTROL		0x21D
+#define USB_OVP_TEST		0x21E
+#define DC_OVP_TEST		0x21F
+#define CHG_VDD_MAX		0x220
+#define CHG_VDD_SAFE		0x221
+#define CHG_VBAT_BOOT_THRESH	0x222
+#define USB_OVP_TRIM		0x355
+#define BUCK_CONTROL_TRIM1	0x356
+#define BUCK_CONTROL_TRIM2	0x357
+#define BUCK_CONTROL_TRIM3	0x358
+#define BUCK_CONTROL_TRIM4	0x359
+#define CHG_DEFAULTS_TRIM	0x35A
+#define CHG_ITRIM		0x35B
+#define CHG_TTRIM		0x35C
+#define CHG_COMP_OVR		0x20A
+
+#define EOC_CHECK_PERIOD_MS	10000
+#define UNPLUG_CHECK_WAIT_PERIOD_MS 200
+
+#define USB_MA_2	(2)
+#define USB_MA_500	(500)
+#define USB_MA_900	(900)
+#define USB_MA_1100	(1100)
+
+#define SAFETY_TIME_MAX_LIMIT		510
+#define SAFETY_TIME_8HR_TWICE		480
+
+enum chg_fsm_state {
+	FSM_STATE_OFF_0 = 0,
+	FSM_STATE_BATFETDET_START_12 = 12,
+	FSM_STATE_BATFETDET_END_16 = 16,
+	FSM_STATE_ON_CHG_HIGHI_1 = 1,
+	FSM_STATE_ATC_2A = 2,
+	FSM_STATE_ATC_2B = 18,
+	FSM_STATE_ON_BAT_3 = 3,
+	FSM_STATE_ATC_FAIL_4 = 4 ,
+	FSM_STATE_DELAY_5 = 5,
+	FSM_STATE_ON_CHG_AND_BAT_6 = 6,
+	FSM_STATE_FAST_CHG_7 = 7,
+	FSM_STATE_TRKL_CHG_8 = 8,
+	FSM_STATE_CHG_FAIL_9 = 9,
+	FSM_STATE_EOC_10 = 10,
+	FSM_STATE_ON_CHG_VREGOK_11 = 11,
+	FSM_STATE_ATC_PAUSE_13 = 13,
+	FSM_STATE_FAST_CHG_PAUSE_14 = 14,
+	FSM_STATE_TRKL_CHG_PAUSE_15 = 15,
+	FSM_STATE_START_BOOT = 20,
+	FSM_STATE_FLCB_VREGOK = 21,
+	FSM_STATE_FLCB = 22,
+};
+
+struct fsm_state_to_batt_status {
+	enum chg_fsm_state	fsm_state;
+	int			batt_state;
+};
+
+static struct fsm_state_to_batt_status map[] = {
+	{FSM_STATE_OFF_0, POWER_SUPPLY_STATUS_UNKNOWN},
+	{FSM_STATE_BATFETDET_START_12, POWER_SUPPLY_STATUS_UNKNOWN},
+	{FSM_STATE_BATFETDET_END_16, POWER_SUPPLY_STATUS_UNKNOWN},
+	{FSM_STATE_ON_CHG_HIGHI_1, POWER_SUPPLY_STATUS_FULL},
+	{FSM_STATE_ATC_2A, POWER_SUPPLY_STATUS_CHARGING},
+	{FSM_STATE_ATC_2B, POWER_SUPPLY_STATUS_CHARGING},
+	{FSM_STATE_ON_BAT_3, POWER_SUPPLY_STATUS_DISCHARGING},
+	{FSM_STATE_ATC_FAIL_4, POWER_SUPPLY_STATUS_DISCHARGING},
+	{FSM_STATE_DELAY_5, POWER_SUPPLY_STATUS_UNKNOWN },
+	{FSM_STATE_ON_CHG_AND_BAT_6, POWER_SUPPLY_STATUS_CHARGING},
+	{FSM_STATE_FAST_CHG_7, POWER_SUPPLY_STATUS_CHARGING},
+	{FSM_STATE_TRKL_CHG_8, POWER_SUPPLY_STATUS_CHARGING},
+	{FSM_STATE_CHG_FAIL_9, POWER_SUPPLY_STATUS_DISCHARGING},
+	{FSM_STATE_EOC_10, POWER_SUPPLY_STATUS_FULL},
+	{FSM_STATE_ON_CHG_VREGOK_11, POWER_SUPPLY_STATUS_NOT_CHARGING},
+	{FSM_STATE_ATC_PAUSE_13, POWER_SUPPLY_STATUS_NOT_CHARGING},
+	{FSM_STATE_FAST_CHG_PAUSE_14, POWER_SUPPLY_STATUS_NOT_CHARGING},
+	{FSM_STATE_TRKL_CHG_PAUSE_15, POWER_SUPPLY_STATUS_NOT_CHARGING},
+	{FSM_STATE_START_BOOT, POWER_SUPPLY_STATUS_NOT_CHARGING},
+	{FSM_STATE_FLCB_VREGOK, POWER_SUPPLY_STATUS_NOT_CHARGING},
+	{FSM_STATE_FLCB, POWER_SUPPLY_STATUS_NOT_CHARGING},
+};
+
+enum chg_regulation_loop {
+	VDD_LOOP = BIT(3),
+	BAT_CURRENT_LOOP = BIT(2),
+	INPUT_CURRENT_LOOP = BIT(1),
+	INPUT_VOLTAGE_LOOP = BIT(0),
+	CHG_ALL_LOOPS = VDD_LOOP | BAT_CURRENT_LOOP
+			| INPUT_CURRENT_LOOP | INPUT_VOLTAGE_LOOP,
+};
+
+enum pmic_chg_interrupts {
+	USBIN_VALID_IRQ = 0,
+	USBIN_OV_IRQ,
+	BATT_INSERTED_IRQ,
+	VBATDET_LOW_IRQ,
+	USBIN_UV_IRQ,
+	VBAT_OV_IRQ,
+	CHGWDOG_IRQ,
+	VCP_IRQ,
+	ATCDONE_IRQ,
+	ATCFAIL_IRQ,
+	CHGDONE_IRQ,
+	CHGFAIL_IRQ,
+	CHGSTATE_IRQ,
+	LOOP_CHANGE_IRQ,
+	FASTCHG_IRQ,
+	TRKLCHG_IRQ,
+	BATT_REMOVED_IRQ,
+	BATTTEMP_HOT_IRQ,
+	CHGHOT_IRQ,
+	BATTTEMP_COLD_IRQ,
+	CHG_GONE_IRQ,
+	BAT_TEMP_OK_IRQ,
+	COARSE_DET_LOW_IRQ,
+	VDD_LOOP_IRQ,
+	VREG_OV_IRQ,
+	VBATDET_IRQ,
+	BATFET_IRQ,
+	PSI_IRQ,
+	DCIN_VALID_IRQ,
+	DCIN_OV_IRQ,
+	DCIN_UV_IRQ,
+	PM_CHG_MAX_INTS,
+};
+
+struct bms_notify {
+	int			is_battery_full;
+	int			is_charging;
+	struct	work_struct	work;
+};
+
+struct pm8921_chg_chip {
+	struct device			*dev;
+	unsigned int			usb_present;
+	unsigned int			dc_present;
+	unsigned int			usb_charger_current;
+	unsigned int			max_bat_chg_current;
+	unsigned int			pmic_chg_irq[PM_CHG_MAX_INTS];
+	unsigned int			safety_time;
+	unsigned int			ttrkl_time;
+	unsigned int			update_time;
+	unsigned int			max_voltage_mv;
+	unsigned int			min_voltage_mv;
+	int						cool_temp_dc;
+	int						warm_temp_dc;
+	unsigned int			temp_check_period;
+	unsigned int			cool_bat_chg_current;
+	unsigned int			warm_bat_chg_current;
+	unsigned int			cool_bat_voltage;
+	unsigned int			warm_bat_voltage;
+	unsigned int			is_bat_cool;
+	unsigned int			is_bat_warm;
+	unsigned int			resume_voltage_delta;
+	unsigned int			term_current;
+	unsigned int			vbat_channel;
+	unsigned int			batt_temp_channel;
+	unsigned int			batt_id_channel;
+	struct dentry			*dent;
+	struct bms_notify		bms_notify;
+	struct ext_chg_pm8921		*ext;		
+	struct ext_usb_chg_pm8921	*ext_usb;	
+	bool				keep_btm_on_suspend;
+	bool				ext_charging;
+	bool				ext_charge_done;
+	bool				ext_usb_charging;	
+	bool				ext_usb_charge_done;	
+	bool				dc_unplug_check;
+	DECLARE_BITMAP(enabled_irqs, PM_CHG_MAX_INTS);
+	struct work_struct		battery_id_valid_work;
+	int64_t				batt_id_min;
+	int64_t				batt_id_max;
+	int				trkl_voltage;
+	int				weak_voltage;
+	int				trkl_current;
+	int				weak_current;
+	int				vin_min;
+	unsigned int			*thermal_mitigation;
+	int				thermal_levels;
+	int				mbat_in_gpio;
+	int				is_embeded_batt;
+	struct delayed_work		update_heartbeat_work;
+	struct delayed_work		eoc_work;
+	struct delayed_work		recharge_check_work;
+	struct work_struct		unplug_ovp_fet_open_work;
+	struct delayed_work		unplug_check_work;
+	struct delayed_work		vin_collapse_check_work;
+	struct wake_lock		unplug_ovp_fet_open_wake_lock;
+	struct wake_lock		eoc_wake_lock;
+	struct wake_lock		recharge_check_wake_lock;
+	enum pm8921_chg_cold_thr	cold_thr;
+	enum pm8921_chg_hot_thr		hot_thr;
+	u8				active_path;
+};
+
+static bool test_power_monitor = 0;
+static bool flag_keep_charge_on;
+static bool flag_pa_recharge;
+static bool flag_disable_wakelock;
+static bool is_batt_full = false;
+static bool is_ac_safety_timeout = false;
+static bool is_ac_safety_timeout_twice = false; 
+static bool is_cable_remove = false;
+
+static int usbin_ov_irq_state = 0;
+static int usbin_uv_irq_state = 0;
+static int ovp = 0;
+static int uvp = 0;
+
+enum htc_power_source_type pwr_src;
+static unsigned int chg_limit_current; 
+static unsigned int usb_max_current;
+static int usb_target_ma;
+static int charging_disabled; 
+static int auto_enable;
+static int thermal_mitigation;
+static int usb_ovp_disable;
+static int bat_temp_ok_prev = -1;
+static int eoc_count; 
+
+static struct pm8921_chg_chip *the_chip;
+
+static struct pm8xxx_adc_arb_btm_param btm_config;
+
+static int get_reg(void *data, u64 *val);
+static int get_reg_loop(void *data, u64 * val);
+static void dump_reg(void);
+static void dump_all(int more);
+static void update_ovp_uvp_state(int ov, int v, int uv);
+static irqreturn_t usbin_ov_irq_handler(int irq, void *data);
+
+static int pm_chg_masked_write(struct pm8921_chg_chip *chip, u16 addr,
+							u8 mask, u8 val)
+{
+	int rc;
+	u8 reg;
+
+	rc = pm8xxx_readb(chip->dev->parent, addr, &reg);
+	if (rc) {
+		pr_err("pm8xxx_readb failed: addr=%03X, rc=%d\n", addr, rc);
+		return rc;
+	}
+	reg &= ~mask;
+	reg |= val & mask;
+	rc = pm8xxx_writeb(chip->dev->parent, addr, reg);
+	if (rc) {
+		pr_err("pm8xxx_writeb failed: addr=%03X, rc=%d\n", addr, rc);
+		return rc;
+	}
+	return 0;
+}
+
+static int pm_chg_get_rt_status(struct pm8921_chg_chip *chip, int irq_id)
+{
+	return pm8xxx_read_irq_stat(chip->dev->parent,
+					chip->pmic_chg_irq[irq_id]);
+}
+
+static int is_usb_chg_plugged_in(struct pm8921_chg_chip *chip)
+{
+	return pm_chg_get_rt_status(chip, USBIN_VALID_IRQ);
+}
+
+static int is_dc_chg_plugged_in(struct pm8921_chg_chip *chip)
+{
+	return pm_chg_get_rt_status(chip, DCIN_VALID_IRQ);
+}
+
+#define CAPTURE_FSM_STATE_CMD	0xC2
+#define READ_BANK_7		0x70
+#define READ_BANK_4		0x40
+static int pm_chg_get_fsm_state(struct pm8921_chg_chip *chip)
+{
+	u8 temp;
+	int err, ret = 0;
+
+	temp = CAPTURE_FSM_STATE_CMD;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return err;
+	}
+
+	temp = READ_BANK_7;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return err;
+	}
+
+	err = pm8xxx_readb(chip->dev->parent, CHG_TEST, &temp);
+	if (err) {
+		pr_err("pm8xxx_readb fail: addr=%03X, rc=%d\n", CHG_TEST, err);
+		return err;
+	}
+	
+	ret = temp & 0xF;
+
+	temp = READ_BANK_4;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return err;
+	}
+
+	err = pm8xxx_readb(chip->dev->parent, CHG_TEST, &temp);
+	if (err) {
+		pr_err("pm8xxx_readb fail: addr=%03X, rc=%d\n", CHG_TEST, err);
+		return err;
+	}
+	
+	ret |= (temp & 0x1) << 4;
+	return  ret;
+}
+
+#define READ_BANK_6		0x60
+static int pm_chg_get_regulation_loop(struct pm8921_chg_chip *chip)
+{
+	u8 temp;
+	int err;
+
+	temp = READ_BANK_6;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return err;
+	}
+
+	err = pm8xxx_readb(chip->dev->parent, CHG_TEST, &temp);
+	if (err) {
+		pr_err("pm8xxx_readb fail: addr=%03X, rc=%d\n", CHG_TEST, err);
+		return err;
+	}
+
+	
+	return temp & CHG_ALL_LOOPS;
+}
+
+#define CHG_USB_SUSPEND_BIT  BIT(2)
+static int pm_chg_usb_suspend_enable(struct pm8921_chg_chip *chip, int enable)
+{
+	return pm_chg_masked_write(chip, CHG_CNTRL_3, CHG_USB_SUSPEND_BIT,
+			enable ? CHG_USB_SUSPEND_BIT : 0);
+}
+
+#define CHG_EN_BIT	BIT(7)
+static int pm_chg_auto_enable(struct pm8921_chg_chip *chip, int enable)
+{
+	return pm_chg_masked_write(chip, CHG_CNTRL_3, CHG_EN_BIT,
+				enable ? CHG_EN_BIT : 0);
+}
+
+#define CHG_FAILED_CLEAR	BIT(0)
+#define ATC_FAILED_CLEAR	BIT(1)
+static int pm_chg_failed_clear(struct pm8921_chg_chip *chip, int clear)
+{
+	int rc;
+
+	rc = pm_chg_masked_write(chip, CHG_CNTRL_3, ATC_FAILED_CLEAR,
+				clear ? ATC_FAILED_CLEAR : 0);
+	rc |= pm_chg_masked_write(chip, CHG_CNTRL_3, CHG_FAILED_CLEAR,
+				clear ? CHG_FAILED_CLEAR : 0);
+	return rc;
+}
+
+#define CHG_CHARGE_DIS_BIT	BIT(1)
+static int pm_chg_charge_dis(struct pm8921_chg_chip *chip, int disable)
+{
+	return pm_chg_masked_write(chip, CHG_CNTRL, CHG_CHARGE_DIS_BIT,
+				disable ? CHG_CHARGE_DIS_BIT : 0);
+}
+
+static DEFINE_SPINLOCK(pwrsrc_lock);
+#define PWRSRC_DISABLED_BIT_KDRV	(1)
+#define PWRSRC_DISABLED_BIT_USER	(1<<1)
+static int pwrsrc_disabled; 
+static int pm_chg_disable_pwrsrc(struct pm8921_chg_chip *chip,
+		int disable, int reason)
+{
+	int rc;
+	unsigned long flags;
+
+	spin_lock_irqsave(&pwrsrc_lock, flags);
+	if (disable)
+		pwrsrc_disabled |= reason;	
+	else
+		pwrsrc_disabled &= ~reason;	
+	rc = pm_chg_charge_dis(chip, pwrsrc_disabled);
+	if (rc)
+		pr_err("Failed rc=%d\n", rc);
+	spin_unlock_irqrestore(&pwrsrc_lock, flags);
+
+	return rc;
+}
+
+static DEFINE_SPINLOCK(charger_lock);
+static int batt_charging_disabled; 
+#define BATT_CHG_DISABLED_BIT_EOC	(1)
+#define BATT_CHG_DISABLED_BIT_KDRV	(1<<1)
+#define BATT_CHG_DISABLED_BIT_USR1	(1<<2)
+#define BATT_CHG_DISABLED_BIT_USR2	(1<<3)
+#define BATT_CHG_DISABLED_BIT_BAT	(1<<4)
+static int pm_chg_disable_auto_enable(struct pm8921_chg_chip *chip,
+		int disable, int reason)
+{
+	int rc;
+	unsigned long flags;
+
+	spin_lock_irqsave(&charger_lock, flags);
+	if (disable)
+		batt_charging_disabled |= reason;	
+	else
+		batt_charging_disabled &= ~reason;	
+	rc = pm_chg_auto_enable(the_chip, !batt_charging_disabled);
+	if (rc)
+		pr_err("Failed rc=%d\n", rc);
+	spin_unlock_irqrestore(&charger_lock, flags);
+
+	return rc;
+}
+
+#define PM8921_CHG_V_MIN_MV	3240
+#define PM8921_CHG_V_STEP_MV	20
+#define PM8921_CHG_V_STEP_10MV_OFFSET_BIT	BIT(7)
+#define PM8921_CHG_VDDMAX_MAX	4500
+#define PM8921_CHG_VDDMAX_MIN	3400
+#define PM8921_CHG_V_MASK	0x7F
+static int __pm_chg_vddmax_set(struct pm8921_chg_chip *chip, int voltage)
+{
+	int remainder;
+	u8 temp = 0;
+
+	if (voltage < PM8921_CHG_VDDMAX_MIN
+			|| voltage > PM8921_CHG_VDDMAX_MAX) {
+		pr_err("bad mV=%d asked to set\n", voltage);
+		return -EINVAL;
+	}
+
+	temp = (voltage - PM8921_CHG_V_MIN_MV) / PM8921_CHG_V_STEP_MV;
+
+	remainder = voltage % 20;
+	if (remainder >= 10) {
+		temp |= PM8921_CHG_V_STEP_10MV_OFFSET_BIT;
+	}
+
+	pr_debug("voltage=%d setting %02x\n", voltage, temp);
+	return pm8xxx_writeb(chip->dev->parent, CHG_VDD_MAX, temp);
+}
+
+static int pm_chg_vddmax_get(struct pm8921_chg_chip *chip, int *voltage)
+{
+	u8 temp;
+	int rc;
+
+	rc = pm8xxx_readb(chip->dev->parent, CHG_VDD_MAX, &temp);
+	if (rc) {
+		pr_err("rc = %d while reading vdd max\n", rc);
+		*voltage = 0;
+		return rc;
+	}
+	*voltage = (int)(temp & PM8921_CHG_V_MASK) * PM8921_CHG_V_STEP_MV
+							+ PM8921_CHG_V_MIN_MV;
+	if (temp & PM8921_CHG_V_STEP_10MV_OFFSET_BIT)
+		*voltage =  *voltage + 10;
+	return 0;
+}
+
+static int pm_chg_vddmax_set(struct pm8921_chg_chip *chip, int voltage)
+{
+	int current_mv, ret, steps, i;
+	bool increase;
+
+	ret = 0;
+
+	if (voltage < PM8921_CHG_VDDMAX_MIN
+		|| voltage > PM8921_CHG_VDDMAX_MAX) {
+		pr_err("bad mV=%d asked to set\n", voltage);
+		return -EINVAL;
+	}
+
+	ret = pm_chg_vddmax_get(chip, &current_mv);
+	if (ret) {
+		pr_err("Failed to read vddmax rc=%d\n", ret);
+		return -EINVAL;
+	}
+	if (current_mv == voltage)
+		return 0;
+
+	
+	if (is_usb_chg_plugged_in(chip)) {
+		if (current_mv < voltage) {
+			steps = (voltage - current_mv) / PM8921_CHG_V_STEP_MV;
+			increase = true;
+		} else {
+			steps = (current_mv - voltage) / PM8921_CHG_V_STEP_MV;
+			increase = false;
+		}
+		for (i = 0; i < steps; i++) {
+			if (increase)
+				current_mv += PM8921_CHG_V_STEP_MV;
+			else
+				current_mv -= PM8921_CHG_V_STEP_MV;
+			ret |= __pm_chg_vddmax_set(chip, current_mv);
+		}
+	}
+	ret |= __pm_chg_vddmax_set(chip, voltage);
+	return ret;
+}
+
+#define PM8921_CHG_VDDSAFE_MIN	3400
+#define PM8921_CHG_VDDSAFE_MAX	4500
+static int pm_chg_vddsafe_set(struct pm8921_chg_chip *chip, int voltage)
+{
+	u8 temp;
+
+	if (voltage < PM8921_CHG_VDDSAFE_MIN
+			|| voltage > PM8921_CHG_VDDSAFE_MAX) {
+		pr_err("bad mV=%d asked to set\n", voltage);
+		return -EINVAL;
+	}
+	temp = (voltage - PM8921_CHG_V_MIN_MV) / PM8921_CHG_V_STEP_MV;
+	pr_debug("voltage=%d setting %02x\n", voltage, temp);
+	return pm_chg_masked_write(chip, CHG_VDD_SAFE, PM8921_CHG_V_MASK, temp);
+}
+
+#define PM8921_CHG_VBATDET_MIN	3240
+#define PM8921_CHG_VBATDET_MAX	5780
+static int pm_chg_vbatdet_set(struct pm8921_chg_chip *chip, int voltage)
+{
+	u8 temp;
+
+	if (voltage < PM8921_CHG_VBATDET_MIN
+			|| voltage > PM8921_CHG_VBATDET_MAX) {
+		pr_err("bad mV=%d asked to set\n", voltage);
+		return -EINVAL;
+	}
+	temp = (voltage - PM8921_CHG_V_MIN_MV) / PM8921_CHG_V_STEP_MV;
+	pr_debug("voltage=%d setting %02x\n", voltage, temp);
+	return pm_chg_masked_write(chip, CHG_VBAT_DET, PM8921_CHG_V_MASK, temp);
+}
+
+#define PM8921_CHG_VINMIN_MIN_MV	3800
+#define PM8921_CHG_VINMIN_STEP_MV	100
+#define PM8921_CHG_VINMIN_USABLE_MAX	6500
+#define PM8921_CHG_VINMIN_USABLE_MIN	4300
+#define PM8921_CHG_VINMIN_MASK		0x1F
+static int pm_chg_vinmin_set(struct pm8921_chg_chip *chip, int voltage)
+{
+	u8 temp;
+
+	if (voltage < PM8921_CHG_VINMIN_USABLE_MIN
+			|| voltage > PM8921_CHG_VINMIN_USABLE_MAX) {
+		pr_err("bad mV=%d asked to set\n", voltage);
+		return -EINVAL;
+	}
+	temp = (voltage - PM8921_CHG_VINMIN_MIN_MV) / PM8921_CHG_VINMIN_STEP_MV;
+	pr_debug("voltage=%d setting %02x\n", voltage, temp);
+	return pm_chg_masked_write(chip, CHG_VIN_MIN, PM8921_CHG_VINMIN_MASK,
+									temp);
+}
+
+static int pm_chg_vinmin_get(struct pm8921_chg_chip *chip)
+{
+	u8 temp;
+	int rc, voltage_mv;
+
+	rc = pm8xxx_readb(chip->dev->parent, CHG_VIN_MIN, &temp);
+	temp &= PM8921_CHG_VINMIN_MASK;
+
+	voltage_mv = PM8921_CHG_VINMIN_MIN_MV +
+			(int)temp * PM8921_CHG_VINMIN_STEP_MV;
+
+	return voltage_mv;
+}
+
+#define PM8921_CHG_IBATMAX_MIN	325
+#define PM8921_CHG_IBATMAX_MAX	2000
+#define PM8921_CHG_I_MIN_MA	225
+#define PM8921_CHG_I_STEP_MA	50
+#define PM8921_CHG_I_MASK	0x3F
+static int pm_chg_ibatmax_set(struct pm8921_chg_chip *chip, int chg_current)
+{
+	u8 temp;
+
+	if (chg_current < PM8921_CHG_I_MIN_MA
+			|| chg_current > PM8921_CHG_IBATMAX_MAX) {
+		pr_err("bad mA=%d asked to set\n", chg_current);
+		return -EINVAL;
+	}
+	temp = (chg_current - PM8921_CHG_I_MIN_MA) / PM8921_CHG_I_STEP_MA;
+	return pm_chg_masked_write(chip, CHG_IBAT_MAX, PM8921_CHG_I_MASK, temp);
+}
+
+#define PM8921_CHG_IBATSAFE_MIN	225
+#define PM8921_CHG_IBATSAFE_MAX	3375
+static int pm_chg_ibatsafe_set(struct pm8921_chg_chip *chip, int chg_current)
+{
+	u8 temp;
+
+	if (chg_current < PM8921_CHG_IBATSAFE_MIN
+			|| chg_current > PM8921_CHG_IBATSAFE_MAX) {
+		pr_err("bad mA=%d asked to set\n", chg_current);
+		return -EINVAL;
+	}
+	temp = (chg_current - PM8921_CHG_I_MIN_MA) / PM8921_CHG_I_STEP_MA;
+	return pm_chg_masked_write(chip, CHG_IBAT_SAFE,
+						PM8921_CHG_I_MASK, temp);
+}
+
+#define PM8921_CHG_ITERM_MIN_MA		50
+#define PM8921_CHG_ITERM_MAX_MA		200
+#define PM8921_CHG_ITERM_STEP_MA	10
+#define PM8921_CHG_ITERM_MASK		0xF
+static int pm_chg_iterm_set(struct pm8921_chg_chip *chip, int chg_current)
+{
+	u8 temp;
+
+	if (chg_current < PM8921_CHG_ITERM_MIN_MA
+			|| chg_current > PM8921_CHG_ITERM_MAX_MA) {
+		pr_err("bad mA=%d asked to set\n", chg_current);
+		return -EINVAL;
+	}
+
+	temp = (chg_current - PM8921_CHG_ITERM_MIN_MA)
+				/ PM8921_CHG_ITERM_STEP_MA;
+	return pm_chg_masked_write(chip, CHG_ITERM, PM8921_CHG_ITERM_MASK,
+					 temp);
+}
+
+static int pm_chg_iterm_get(struct pm8921_chg_chip *chip, int *chg_current)
+{
+	u8 temp;
+	int rc;
+
+	rc = pm8xxx_readb(chip->dev->parent, CHG_ITERM, &temp);
+	if (rc) {
+		pr_err("err=%d reading CHG_ITEM\n", rc);
+		*chg_current = 0;
+		return rc;
+	}
+	temp &= PM8921_CHG_ITERM_MASK;
+	*chg_current = (int)temp * PM8921_CHG_ITERM_STEP_MA
+					+ PM8921_CHG_ITERM_MIN_MA;
+	return 0;
+}
+
+struct usb_ma_limit_entry {
+	int usb_ma;
+};
+
+static struct usb_ma_limit_entry usb_ma_table[] = {
+	{100},
+	{500},
+	{700},
+	{850},
+	{900},
+	{1100},
+	{1300},
+	{1500},
+};
+
+#define PM8921_CHG_IUSB_MASK 0x1C
+#define PM8921_CHG_IUSB_MAX  7
+#define PM8921_CHG_IUSB_MIN  0
+static int pm_chg_iusbmax_set(struct pm8921_chg_chip *chip, int reg_val)
+{
+	u8 temp;
+
+	if (reg_val < PM8921_CHG_IUSB_MIN || reg_val > PM8921_CHG_IUSB_MAX) {
+		pr_err("bad mA=%d asked to set\n", reg_val);
+		return -EINVAL;
+	}
+	temp = reg_val << 2;
+	return pm_chg_masked_write(chip, PBL_ACCESS2, PM8921_CHG_IUSB_MASK,
+					 temp);
+}
+
+static int pm_chg_iusbmax_get(struct pm8921_chg_chip *chip, int *mA)
+{
+	u8 temp;
+	int rc;
+
+	*mA = 0;
+	rc = pm8xxx_readb(chip->dev->parent, PBL_ACCESS2, &temp);
+	if (rc) {
+		pr_err("err=%d reading PBL_ACCESS2\n", rc);
+		return rc;
+	}
+	temp &= PM8921_CHG_IUSB_MASK;
+	temp = temp >> 2;
+	*mA = usb_ma_table[temp].usb_ma;
+	return rc;
+}
+
+#define PM8921_CHG_WD_MASK 0x1F
+static int pm_chg_disable_wd(struct pm8921_chg_chip *chip)
+{
+	
+	return pm_chg_masked_write(chip, CHG_TWDOG, PM8921_CHG_WD_MASK, 0);
+}
+
+#define PM8921_CHG_TCHG_MASK	0x7F
+#define PM8921_CHG_TCHG_MIN	4
+#define PM8921_CHG_TCHG_MAX	512
+#define PM8921_CHG_TCHG_STEP	4
+static int pm_chg_tchg_max_set(struct pm8921_chg_chip *chip, int minutes)
+{
+	u8 temp;
+
+	if (minutes < PM8921_CHG_TCHG_MIN || minutes > PM8921_CHG_TCHG_MAX) {
+		pr_err("bad max minutes =%d asked to set\n", minutes);
+		return -EINVAL;
+	}
+
+	temp = (minutes - 1)/PM8921_CHG_TCHG_STEP;
+	return pm_chg_masked_write(chip, CHG_TCHG_MAX, PM8921_CHG_TCHG_MASK,
+					 temp);
+}
+
+#define PM8921_CHG_TTRKL_MASK	0x1F
+#define PM8921_CHG_TTRKL_MIN	1
+#define PM8921_CHG_TTRKL_MAX	64
+static int pm_chg_ttrkl_max_set(struct pm8921_chg_chip *chip, int minutes)
+{
+	u8 temp;
+
+	if (minutes < PM8921_CHG_TTRKL_MIN || minutes > PM8921_CHG_TTRKL_MAX) {
+		pr_err("bad max minutes =%d asked to set\n", minutes);
+		return -EINVAL;
+	}
+
+	temp = minutes - 1;
+	return pm_chg_masked_write(chip, CHG_TTRKL_MAX, PM8921_CHG_TTRKL_MASK,
+					 temp);
+}
+
+#define PM8921_CHG_VTRKL_MIN_MV		2050
+#define PM8921_CHG_VTRKL_MAX_MV		2800
+#define PM8921_CHG_VTRKL_STEP_MV	50
+#define PM8921_CHG_VTRKL_SHIFT		4
+#define PM8921_CHG_VTRKL_MASK		0xF0
+static int pm_chg_vtrkl_low_set(struct pm8921_chg_chip *chip, int millivolts)
+{
+	u8 temp;
+
+	if (millivolts < PM8921_CHG_VTRKL_MIN_MV
+			|| millivolts > PM8921_CHG_VTRKL_MAX_MV) {
+		pr_err("bad voltage = %dmV asked to set\n", millivolts);
+		return -EINVAL;
+	}
+
+	temp = (millivolts - PM8921_CHG_VTRKL_MIN_MV)/PM8921_CHG_VTRKL_STEP_MV;
+	temp = temp << PM8921_CHG_VTRKL_SHIFT;
+	return pm_chg_masked_write(chip, CHG_VTRICKLE, PM8921_CHG_VTRKL_MASK,
+					 temp);
+}
+
+#define PM8921_CHG_VWEAK_MIN_MV		2100
+#define PM8921_CHG_VWEAK_MAX_MV		3600
+#define PM8921_CHG_VWEAK_STEP_MV	100
+#define PM8921_CHG_VWEAK_MASK		0x0F
+static int pm_chg_vweak_set(struct pm8921_chg_chip *chip, int millivolts)
+{
+	u8 temp;
+
+	if (millivolts < PM8921_CHG_VWEAK_MIN_MV
+			|| millivolts > PM8921_CHG_VWEAK_MAX_MV) {
+		pr_err("bad voltage = %dmV asked to set\n", millivolts);
+		return -EINVAL;
+	}
+
+	temp = (millivolts - PM8921_CHG_VWEAK_MIN_MV)/PM8921_CHG_VWEAK_STEP_MV;
+	return pm_chg_masked_write(chip, CHG_VTRICKLE, PM8921_CHG_VWEAK_MASK,
+					 temp);
+}
+
+#define PM8921_CHG_ITRKL_MIN_MA		50
+#define PM8921_CHG_ITRKL_MAX_MA		200
+#define PM8921_CHG_ITRKL_MASK		0x0F
+#define PM8921_CHG_ITRKL_STEP_MA	10
+static int pm_chg_itrkl_set(struct pm8921_chg_chip *chip, int milliamps)
+{
+	u8 temp;
+
+	if (milliamps < PM8921_CHG_ITRKL_MIN_MA
+		|| milliamps > PM8921_CHG_ITRKL_MAX_MA) {
+		pr_err("bad current = %dmA asked to set\n", milliamps);
+		return -EINVAL;
+	}
+
+	temp = (milliamps - PM8921_CHG_ITRKL_MIN_MA)/PM8921_CHG_ITRKL_STEP_MA;
+
+	return pm_chg_masked_write(chip, CHG_ITRICKLE, PM8921_CHG_ITRKL_MASK,
+					 temp);
+}
+
+#define PM8921_CHG_IWEAK_MIN_MA		325
+#define PM8921_CHG_IWEAK_MAX_MA		525
+#define PM8921_CHG_IWEAK_SHIFT		7
+#define PM8921_CHG_IWEAK_MASK		0x80
+static int pm_chg_iweak_set(struct pm8921_chg_chip *chip, int milliamps)
+{
+	u8 temp;
+
+	if (milliamps < PM8921_CHG_IWEAK_MIN_MA
+		|| milliamps > PM8921_CHG_IWEAK_MAX_MA) {
+		pr_err("bad current = %dmA asked to set\n", milliamps);
+		return -EINVAL;
+	}
+
+	if (milliamps < PM8921_CHG_IWEAK_MAX_MA)
+		temp = 0;
+	else
+		temp = 1;
+
+	temp = temp << PM8921_CHG_IWEAK_SHIFT;
+	return pm_chg_masked_write(chip, CHG_ITRICKLE, PM8921_CHG_IWEAK_MASK,
+					 temp);
+}
+
+#define PM8921_CHG_BATT_TEMP_THR_COLD	BIT(1)
+#define PM8921_CHG_BATT_TEMP_THR_COLD_SHIFT	1
+static int pm_chg_batt_cold_temp_config(struct pm8921_chg_chip *chip,
+					enum pm8921_chg_cold_thr cold_thr)
+{
+	u8 temp;
+
+	temp = cold_thr << PM8921_CHG_BATT_TEMP_THR_COLD_SHIFT;
+	temp = temp & PM8921_CHG_BATT_TEMP_THR_COLD;
+	return pm_chg_masked_write(chip, CHG_CNTRL_2,
+					PM8921_CHG_BATT_TEMP_THR_COLD,
+					 temp);
+}
+
+#define PM8921_CHG_BATT_TEMP_THR_HOT		BIT(0)
+#define PM8921_CHG_BATT_TEMP_THR_HOT_SHIFT	0
+static int pm_chg_batt_hot_temp_config(struct pm8921_chg_chip *chip,
+					enum pm8921_chg_hot_thr hot_thr)
+{
+	u8 temp;
+
+	temp = hot_thr << PM8921_CHG_BATT_TEMP_THR_HOT_SHIFT;
+	temp = temp & PM8921_CHG_BATT_TEMP_THR_HOT;
+	return pm_chg_masked_write(chip, CHG_CNTRL_2,
+					PM8921_CHG_BATT_TEMP_THR_HOT,
+					 temp);
+}
+
+static void disable_input_voltage_regulation(struct pm8921_chg_chip *chip)
+{
+	u8 temp;
+
+	pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, 0x70);
+	pm8xxx_readb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, &temp);
+	
+	temp |= 0x81;
+	pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, temp);
+}
+
+static void enable_input_voltage_regulation(struct pm8921_chg_chip *chip)
+{
+	u8 temp;
+
+	pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, 0x70);
+	pm8xxx_readb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, &temp);
+	
+	temp &= 0xFE;
+	
+	temp |= 0x80;
+	pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, temp);
+}
+
+static int64_t read_battery_id(struct pm8921_chg_chip *chip)
+{
+	int rc;
+	struct pm8xxx_adc_chan_result result;
+
+	rc = pm8xxx_adc_read(chip->batt_id_channel, &result);
+	if (rc) {
+		pr_err("error reading batt id channel = %d, rc = %d\n",
+					chip->vbat_channel, rc);
+		return rc;
+	}
+	pr_debug("batt_id phy = %lld meas = 0x%llx\n", result.physical,
+						result.measurement);
+	return result.physical;
+}
+
+static int is_battery_valid(struct pm8921_chg_chip *chip)
+{
+	int64_t rc;
+
+	if (chip->batt_id_min == 0 && chip->batt_id_max == 0)
+		return 1;
+
+	rc = read_battery_id(chip);
+	if (rc < 0) {
+		pr_err("error reading batt id channel = %d, rc = %lld\n",
+					chip->vbat_channel, rc);
+		
+		return 1;
+	}
+
+	if (rc < chip->batt_id_min || rc > chip->batt_id_max) {
+		pr_err("batt_id phy =%lld is not valid\n", rc);
+		return 0;
+	}
+	return 1;
+}
+
+static void check_battery_valid(struct pm8921_chg_chip *chip)
+{
+	if (is_battery_valid(chip) == 0) {
+		pr_err("batt_id not valid, disbling charging\n");
+		pm_chg_disable_auto_enable(chip, 1, BATT_CHG_DISABLED_BIT_BAT);
+	} else {
+		pm_chg_disable_auto_enable(chip, 0, BATT_CHG_DISABLED_BIT_BAT);
+	}
+}
+
+static void battery_id_valid(struct work_struct *work)
+{
+	struct pm8921_chg_chip *chip = container_of(work,
+				struct pm8921_chg_chip, battery_id_valid_work);
+
+	check_battery_valid(chip);
+}
+
+static void pm8921_chg_enable_irq(struct pm8921_chg_chip *chip, int interrupt)
+{
+	if (!__test_and_set_bit(interrupt, chip->enabled_irqs)) {
+		dev_dbg(chip->dev, "%d\n", chip->pmic_chg_irq[interrupt]);
+		enable_irq(chip->pmic_chg_irq[interrupt]);
+	}
+}
+
+static void pm8921_chg_disable_irq(struct pm8921_chg_chip *chip, int interrupt)
+{
+	if (__test_and_clear_bit(interrupt, chip->enabled_irqs)) {
+		dev_dbg(chip->dev, "%d\n", chip->pmic_chg_irq[interrupt]);
+		disable_irq_nosync(chip->pmic_chg_irq[interrupt]);
+	}
+}
+
+void pm8921_chg_enable_usbin_valid_irq(void)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return;
+	}
+	pm8921_chg_enable_irq(the_chip, USBIN_VALID_IRQ);
+}
+EXPORT_SYMBOL(pm8921_chg_enable_usbin_valid_irq);
+
+void pm8921_chg_disable_usbin_valid_irq(void)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return;
+	}
+	pm8921_chg_disable_irq(the_chip, USBIN_VALID_IRQ);
+}
+EXPORT_SYMBOL(pm8921_chg_disable_usbin_valid_irq);
+
+static int pm8921_chg_is_enabled(struct pm8921_chg_chip *chip, int interrupt)
+{
+	return test_bit(interrupt, chip->enabled_irqs);
+}
+
+static bool is_using_ext_charger(struct pm8921_chg_chip *chip)
+{
+	if (chip->ext_usb)
+		return true;
+
+	if (chip->ext)
+		return true;
+
+
+	return false;
+}
+
+static bool is_ext_charging(struct pm8921_chg_chip *chip)
+{
+	
+	if ((chip->ext == NULL) && (chip->ext_usb == NULL))
+		return false;
+
+	if (chip->ext_charging || chip->ext_usb_charging)
+		return true;
+
+	return false;
+}
+
+static bool is_ext_trickle_charging(struct pm8921_chg_chip *chip)
+{
+	if (chip->ext == NULL)
+		return false;
+
+	if (chip->ext->is_trickle(chip->ext->ctx))
+		return true;
+
+	return false;
+}
+
+static int is_battery_charging(int fsm_state)
+{
+	if (is_ext_charging(the_chip))
+		return 1;
+
+	switch (fsm_state) {
+	case FSM_STATE_ATC_2A:
+	case FSM_STATE_ATC_2B:
+	case FSM_STATE_ON_CHG_AND_BAT_6:
+	case FSM_STATE_FAST_CHG_7:
+	case FSM_STATE_TRKL_CHG_8:
+		return 1;
+	}
+	return 0;
+}
+
+static void bms_notify(struct work_struct *work)
+{
+	struct bms_notify *n = container_of(work, struct bms_notify, work);
+
+	if (n->is_charging) {
+		pm8921_bms_charging_began();
+	} else {
+		pm8921_bms_charging_end(n->is_battery_full);
+		n->is_battery_full = 0;
+	}
+}
+
+static void bms_notify_check(struct pm8921_chg_chip *chip)
+{
+	int fsm_state, new_is_charging;
+
+	fsm_state = pm_chg_get_fsm_state(chip);
+	new_is_charging = is_battery_charging(fsm_state);
+
+	if (chip->bms_notify.is_charging ^ new_is_charging) {
+		chip->bms_notify.is_charging = new_is_charging;
+		schedule_work(&(chip->bms_notify.work));
+	}
+}
+
+static int get_prop_battery_uvolts(struct pm8921_chg_chip *chip)
+{
+	int rc;
+	struct pm8xxx_adc_chan_result result;
+
+	rc = pm8xxx_adc_read(chip->vbat_channel, &result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+					chip->vbat_channel, rc);
+		return rc;
+	}
+	pr_debug("mvolts phy = %lld meas = 0x%llx\n", result.physical,
+						result.measurement);
+	return (int)result.physical;
+}
+
+static unsigned int voltage_based_capacity(struct pm8921_chg_chip *chip)
+{
+	unsigned int current_voltage_uv = get_prop_battery_uvolts(chip);
+	unsigned int current_voltage_mv = current_voltage_uv / 1000;
+	unsigned int low_voltage = chip->min_voltage_mv;
+	unsigned int high_voltage = chip->max_voltage_mv;
+
+	if (current_voltage_mv <= low_voltage)
+		return 0;
+	else if (current_voltage_mv >= high_voltage)
+		return 100;
+	else
+		return (current_voltage_mv - low_voltage) * 100
+		    / (high_voltage - low_voltage);
+}
+
+static int get_prop_batt_capacity(struct pm8921_chg_chip *chip)
+{
+	int percent_soc = pm8921_bms_get_percent_charge();
+
+	if (percent_soc == -ENXIO)
+		percent_soc = voltage_based_capacity(chip);
+
+	if (percent_soc <= 10)
+		pr_warn("low battery charge = %d%%\n", percent_soc);
+
+	
+	if (test_power_monitor) {
+		pr_info("soc=%d report 77(test_power_monitor)\n",
+				percent_soc);
+		percent_soc = 77;
+	}
+	if (percent_soc < 0) {
+		pr_warn("soc=%d is out of range!\n", percent_soc);
+		percent_soc = 0;
+	} else if (100 < percent_soc) {
+		pr_warn("soc=%d is out of range!\n", percent_soc);
+		percent_soc = 100;
+	}
+
+	return percent_soc;
+}
+
+static int get_prop_batt_current(struct pm8921_chg_chip *chip)
+{
+	int result_ua, rc;
+
+	rc = pm8921_bms_get_battery_current(&result_ua);
+	if (rc == -ENXIO)
+		rc = pm8xxx_ccadc_get_battery_current(&result_ua);
+
+	if (rc) {
+		pr_err("unable to get batt current rc = %d\n", rc);
+		return rc;
+	} else {
+		return result_ua;
+	}
+}
+
+static int get_prop_batt_fcc(struct pm8921_chg_chip *chip)
+{
+	int rc;
+
+	rc = pm8921_bms_get_fcc();
+	if (rc < 0)
+		pr_err("unable to get batt fcc rc = %d\n", rc);
+	return rc;
+}
+
+static int get_prop_batt_health(struct pm8921_chg_chip *chip)
+{
+	int temp;
+
+	
+	if (test_power_monitor) {
+		pr_info("report HEALTH_GOOD(test_power_monitor)\n");
+		return POWER_SUPPLY_HEALTH_GOOD;
+	}
+
+	temp = pm_chg_get_rt_status(chip, BATTTEMP_HOT_IRQ);
+	if (temp){
+		pr_debug("ABHI bat overheat\n");
+		return POWER_SUPPLY_HEALTH_OVERHEAT;
+	}
+
+	temp = pm_chg_get_rt_status(chip, BATTTEMP_COLD_IRQ);
+	if (temp){
+		pr_debug("ABHI bat overcold\n");
+		return POWER_SUPPLY_HEALTH_COLD;
+	}
+
+	return POWER_SUPPLY_HEALTH_GOOD;
+}
+
+static int get_prop_batt_present(struct pm8921_chg_chip *chip)
+{
+	
+	if (test_power_monitor) {
+		pr_info("report batt present (test_power_monitor)\n");
+		return 1;
+	}
+	return pm_chg_get_rt_status(chip, BATT_INSERTED_IRQ);
+}
+
+static int get_prop_charge_type(struct pm8921_chg_chip *chip)
+{
+	int temp;
+
+	if (!get_prop_batt_present(chip))
+		return POWER_SUPPLY_CHARGE_TYPE_NONE;
+
+	if (is_ext_trickle_charging(chip))
+		return POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
+
+	if (is_ext_charging(chip))
+		return POWER_SUPPLY_CHARGE_TYPE_FAST;
+
+	temp = pm_chg_get_rt_status(chip, TRKLCHG_IRQ);
+	if (temp){
+		pr_debug("ABHI %s trickle chg\n", __func__);
+		return POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
+	}
+
+	temp = pm_chg_get_rt_status(chip, FASTCHG_IRQ);
+	if (temp){
+		pr_debug("ABHI %s fast chg\n", __func__);
+		return POWER_SUPPLY_CHARGE_TYPE_FAST;
+	}
+
+	return POWER_SUPPLY_CHARGE_TYPE_NONE;
+}
+
+static int get_prop_batt_status(struct pm8921_chg_chip *chip)
+{
+	int batt_state = POWER_SUPPLY_STATUS_DISCHARGING;
+	int fsm_state = pm_chg_get_fsm_state(chip);
+	int i;
+
+	if (chip->ext_usb) {
+		if (chip->ext_usb_charge_done)
+			return POWER_SUPPLY_STATUS_FULL;
+		if (chip->ext_usb_charging)
+			return POWER_SUPPLY_STATUS_CHARGING;
+	}
+	if (chip->ext) {
+		if (chip->ext_charge_done)
+			return POWER_SUPPLY_STATUS_FULL;
+		if (chip->ext_charging)
+			return POWER_SUPPLY_STATUS_CHARGING;
+	}
+
+	for (i = 0; i < ARRAY_SIZE(map); i++)
+		if (map[i].fsm_state == fsm_state)
+			batt_state = map[i].batt_state;
+
+	if (fsm_state == FSM_STATE_ON_CHG_HIGHI_1) {
+		if (!pm_chg_get_rt_status(chip, BATT_INSERTED_IRQ)
+			|| !pm_chg_get_rt_status(chip, BAT_TEMP_OK_IRQ)
+			|| pm_chg_get_rt_status(chip, CHGHOT_IRQ)
+			|| pm_chg_get_rt_status(chip, VBATDET_LOW_IRQ))
+
+			batt_state = POWER_SUPPLY_STATUS_NOT_CHARGING;
+	}
+	pr_debug("ABHI %d\n",batt_state);
+	return batt_state;
+}
+
+static int get_prop_batt_temp(struct pm8921_chg_chip *chip)
+{
+	int rc;
+	struct pm8xxx_adc_chan_result result;
+
+	rc = pm8xxx_adc_read(chip->batt_temp_channel, &result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+					chip->vbat_channel, rc);
+		return rc;
+	}
+	pr_debug("batt_temp phy = %lld meas = 0x%llx\n", result.physical,
+						result.measurement);
+
+	
+	if (test_power_monitor) {
+		pr_info("temp=%d report 25 C(test_power_monitor)\n",
+				(int)result.physical);
+		return 250;
+	}
+
+	pr_debug("ABHI %d deci Deg Cel\n", (int)result.physical);
+	return (int)result.physical;
+}
+
+int pm8921_get_batt_voltage(int *result)
+{
+	int rc;
+	struct pm8xxx_adc_chan_result ch_result;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	rc = pm8xxx_adc_read(the_chip->vbat_channel, &ch_result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+					the_chip->vbat_channel, rc);
+		return rc;
+	}
+	*result = ((int)ch_result.physical) / 1000;
+	pr_debug("batt_voltage phy = %lld meas = 0x%llx\n", ch_result.physical,
+						ch_result.measurement);
+	return rc;
+}
+
+int pm8921_get_batt_temperature(int *result)
+{
+	int rc;
+	struct pm8xxx_adc_chan_result ch_result;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	rc = pm8xxx_adc_read(the_chip->batt_temp_channel, &ch_result);
+	if (rc) {
+		pr_err("error reading adc channel = %d, rc = %d\n",
+					the_chip->batt_temp_channel, rc);
+		return rc;
+	}
+	*result = (int)ch_result.physical;
+	if ((*result >= 680) &&
+			(flag_keep_charge_on || flag_pa_recharge))
+		*result = 650;
+	pr_debug("batt_temp phy = %lld meas = 0x%llx\n", ch_result.physical,
+						ch_result.measurement);
+	return rc;
+}
+
+#define PM8921_CHARGER_HTC_FAKE_BATT_ID (1)
+int pm8921_get_batt_id(int *result)
+{
+	int rc = 0;
+	struct pm8xxx_adc_chan_result ch_result;
+	int id_raw_mv;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	
+	if (pm8xxx_get_revision(the_chip->dev->parent) < PM8XXX_REVISION_8921_2p0) {
+		*result = PM8921_CHARGER_HTC_FAKE_BATT_ID;
+	} else {
+		rc = pm8xxx_adc_read(the_chip->batt_id_channel, &ch_result);
+		if (rc) {
+			pr_err("error reading adc channel = %d, rc = %d\n",
+					the_chip->batt_id_channel, rc);
+			return rc;
+		}
+		pr_debug("batt_id phy = %lld meas = 0x%llx\n", ch_result.physical,
+						ch_result.measurement);
+		id_raw_mv = ((int)ch_result.physical) / 1000;
+		
+		*result = htc_battery_cell_find_and_set_id_auto(id_raw_mv);
+	}
+	return rc;
+}
+
+int pm8921_is_batt_temperature_fault(int *result)
+{
+	int is_cold, is_warm;
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	is_cold = pm_chg_get_rt_status(the_chip, BATTTEMP_COLD_IRQ);
+	is_warm = pm8xxx_adc_btm_is_warm();
+
+	pr_debug("is_cold=%d,is_warm=%d\n", is_cold, is_warm);
+	if (is_cold || is_warm)
+		*result = 1;
+	else
+		*result = 0;
+	return 0;
+}
+
+int pm8921_is_batt_temp_fault_disable_chg(int *result)
+{
+	int is_cold, is_hot;
+	int is_warm, is_vbatdet_low;
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	if(the_chip->ext_usb)
+	{
+		if(the_chip->ext_usb->ichg->is_batt_temp_fault_disable_chg)
+			the_chip->ext_usb->ichg->is_batt_temp_fault_disable_chg(result);
+		return 0;
+	}
+
+
+	is_cold = pm_chg_get_rt_status(the_chip, BATTTEMP_COLD_IRQ);
+	is_hot = pm_chg_get_rt_status(the_chip, BATTTEMP_HOT_IRQ);
+	is_warm = pm8xxx_adc_btm_is_warm();
+	is_vbatdet_low = pm_chg_get_rt_status(the_chip, VBATDET_LOW_IRQ);
+
+	pr_debug("is_cold=%d, is_hot=%d, is_warm=%d, is_vbatdet_low=%d\n",
+			is_cold, is_hot, is_warm, is_vbatdet_low);
+	if ((is_cold || (is_hot && is_warm) || (is_warm && !is_vbatdet_low)) &&
+			!flag_keep_charge_on && !flag_pa_recharge)
+		*result = 1;
+	else
+		*result = 0;
+	return 0;
+}
+
+int pm8921_is_batt_full(int *result)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	*result = is_batt_full;
+	return 0;
+}
+int pm8921_gauge_get_attr_text(char *buf, int size)
+{
+	int len = 0;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	len += scnprintf(buf + len, size - len,
+			"SOC(%%): %d;\n"
+			"EOC(bool): %d;\n"
+			"OVP(bool): %d;\n"
+			"UVP(bool): %d;\n"
+			"VBAT(uV): %d;\n"
+			"IBAT(uA): %d;\n"
+			"ID_RAW(uV): %d;\n"
+			"BATT_TEMP(deci-celsius): %d;\n"
+			"is_bat_warm(bool): %d\n"
+			"is_bat_cool(bool): %d\n"
+			"BTM_WARM_IRQ: %d\n"
+			"BTM_COOL_IRQ: %d\n"
+			"BATT_PRESENT(bool): %d;\n"
+			"FCC(uAh): %d;\n"
+			"usb_target_ma(mA): %d;\n",
+			pm8921_bms_get_percent_charge(),
+			is_batt_full,
+			ovp,
+			uvp,
+			get_prop_battery_uvolts(the_chip),
+			get_prop_batt_current(the_chip),
+			(int)read_battery_id(the_chip),
+			get_prop_batt_temp(the_chip),
+			the_chip->is_bat_warm,
+			the_chip->is_bat_cool,
+			pm8xxx_adc_btm_is_warm(),
+			pm8xxx_adc_btm_is_cool(),
+			get_prop_batt_present(the_chip),
+			pm8921_bms_get_fcc(),
+			usb_target_ma
+			);
+
+	len += pm8921_bms_get_attr_text(buf + len, size - len);
+
+	return len;
+}
+int pm8921_pwrsrc_enable(bool enable)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	if(the_chip->ext_usb)
+	{
+		if(the_chip->ext_usb->ichg->set_pwrsrc_enable)
+			return the_chip->ext_usb->ichg->set_pwrsrc_enable(enable);
+	}
+
+	return pm_chg_disable_pwrsrc(the_chip, !enable, PWRSRC_DISABLED_BIT_KDRV);
+}
+EXPORT_SYMBOL(pm8921_pwrsrc_enable);
+
+int pm8921_get_charging_source(int *result)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	if(the_chip->ext_usb)
+	{
+		if(the_chip->ext_usb->ichg->get_charging_source)
+			the_chip->ext_usb->ichg->get_charging_source(result);
+		return 0;
+	}
+
+	*result = pwr_src;
+
+
+	return 0;
+}
+
+int pm8921_get_charging_enabled(int *result)
+{
+	int fsm_state;
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	if(the_chip->ext_usb)
+	{
+		if(the_chip->ext_usb->ichg->get_charging_enabled)
+			return the_chip->ext_usb->ichg->get_charging_enabled(result);
+	}
+
+	fsm_state = pm_chg_get_fsm_state(the_chip);
+	if (is_battery_charging(fsm_state))
+		return pm8921_get_charging_source(result);
+	else
+		*result = HTC_PWR_SOURCE_TYPE_BATT;
+	return 0;
+}
+
+int pm8921_is_charger_ovp(int* result)
+{
+	int ov, uv, v;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	ov = pm_chg_get_rt_status(the_chip, USBIN_OV_IRQ);
+	v = pm_chg_get_rt_status(the_chip, USBIN_VALID_IRQ);
+	uv = pm_chg_get_rt_status(the_chip, USBIN_UV_IRQ);
+	pr_info("usbin_ov_irq_state:%d -> %d [%d,%d,%d]\n",
+					usbin_ov_irq_state, ov, ov, v, uv);
+	usbin_ov_irq_state = ov;
+	update_ovp_uvp_state(ov, v, uv);
+	*result = ovp;
+
+	if(the_chip->ext_usb)
+	{
+		if(the_chip->ext_usb->ichg->is_ovp)
+			the_chip->ext_usb->ichg->is_ovp(result);
+	}
+
+	return 0;
+}
+
+int pm8921_charger_get_attr_text_with_ext_charger(char *buf, int size)
+{
+	int rc;
+	int len = 0;
+	struct pm8xxx_adc_chan_result result;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	len += scnprintf(buf + len, size - len,
+			"FSM: %d;\n"
+			"ATCDONE_IRQ: %d;\n"
+			"ATCFAIL_IRQ: %d;\n"
+			"BATFET_IRQ: %d;\n"
+			"BATTTEMP_COLD_IRQ: %d;\n"
+			"BATTTEMP_HOT_IRQ: %d;\n"
+			"BATT_INSERTED_IRQ: %d;\n"
+			"BATT_REMOVED_IRQ: %d;\n"
+			"BAT_TEMP_OK_IRQ: %d;\n"
+			"DCIN_UV_IRQ: %d;\n"
+			"DCIN_VALID_IRQ: %d;\n"
+			"LOOP_CHANGE_IRQ: %d;\n"
+			"TRKLCHG_IRQ: %d;\n"
+			"USBIN_OV_IRQ: %d;\n"
+			"USBIN_UV_IRQ: %d;\n"
+			"USBIN_VALID_IRQ: %d;\n"
+			"VBATDET_IRQ: %d;\n"
+			"VBATDET_LOW_IRQ: %d;\n"
+			"VBAT_OV_IRQ: %d;\n"
+			"VCP_IRQ: %d;\n"
+			"VDD_LOOP_IRQ: %d;\n"
+			"VREG_OV_IRQ: %d;\n"
+			"REGULATION_LOOP: 0x%02x\n",
+			pm_chg_get_fsm_state(the_chip),
+			pm_chg_get_rt_status(the_chip, ATCDONE_IRQ),
+			pm_chg_get_rt_status(the_chip, ATCFAIL_IRQ),
+			pm_chg_get_rt_status(the_chip, BATFET_IRQ),
+			pm_chg_get_rt_status(the_chip, BATTTEMP_COLD_IRQ),
+			pm_chg_get_rt_status(the_chip, BATTTEMP_HOT_IRQ),
+			pm_chg_get_rt_status(the_chip, BATT_INSERTED_IRQ),
+			pm_chg_get_rt_status(the_chip, BATT_REMOVED_IRQ),
+			pm_chg_get_rt_status(the_chip, BAT_TEMP_OK_IRQ),
+			pm_chg_get_rt_status(the_chip, DCIN_UV_IRQ),
+			pm_chg_get_rt_status(the_chip, DCIN_VALID_IRQ),
+			pm_chg_get_rt_status(the_chip, LOOP_CHANGE_IRQ),
+			pm_chg_get_rt_status(the_chip, TRKLCHG_IRQ),
+			pm_chg_get_rt_status(the_chip, USBIN_OV_IRQ),
+			pm_chg_get_rt_status(the_chip, USBIN_UV_IRQ),
+			pm_chg_get_rt_status(the_chip, USBIN_VALID_IRQ),
+			pm_chg_get_rt_status(the_chip, VBATDET_IRQ),
+			pm_chg_get_rt_status(the_chip, VBATDET_LOW_IRQ),
+			pm_chg_get_rt_status(the_chip, VBAT_OV_IRQ),
+			pm_chg_get_rt_status(the_chip, VCP_IRQ),
+			pm_chg_get_rt_status(the_chip, VDD_LOOP_IRQ),
+			pm_chg_get_rt_status(the_chip, VREG_OV_IRQ),
+			pm_chg_get_regulation_loop(the_chip)
+			);
+
+	rc = pm8xxx_adc_read(CHANNEL_USBIN, &result);
+	if (rc) {
+		pr_err("error reading i_chg channel = %d, rc = %d\n",
+					CHANNEL_USBIN, rc);
+	}
+
+	len += scnprintf(buf + len, size - len,
+			"USBIN(uV): %d;\n", (int)result.physical);
+
+	pr_info("USBIN(uV): %d;\n", (int)result.physical);
+
+	if(the_chip->ext_usb)
+	{
+		if(the_chip->ext_usb->ichg->get_attr_text)
+			len += the_chip->ext_usb->ichg->get_attr_text(buf+len, size);
+	}
+
+	return len;
+}
+
+
+int pm8921_charger_get_attr_text(char *buf, int size)
+{
+	int rc;
+	struct pm8xxx_adc_chan_result result;
+	int len = 0;
+	u64 val = 0;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	len += scnprintf(buf + len, size - len,
+			"FSM: %d;\n"
+			"ATCDONE_IRQ: %d;\n"
+			"ATCFAIL_IRQ: %d;\n"
+			"BATFET_IRQ: %d;\n"
+			"BATTTEMP_COLD_IRQ: %d;\n"
+			"BATTTEMP_HOT_IRQ: %d;\n"
+			"BATT_INSERTED_IRQ: %d;\n"
+			"BATT_REMOVED_IRQ: %d;\n"
+			"BAT_TEMP_OK_IRQ: %d;\n"
+			"CHGDONE_IRQ: %d;\n"
+			"CHGFAIL_IRQ: %d;\n"
+			"CHGHOT_IRQ: %d;\n"
+			"CHGSTATE_IRQ: %d;\n"
+			"CHGWDOG_IRQ: %d;\n"
+			"CHG_GONE_IRQ: %d;\n"
+			"COARSE_DET_LOW_IRQ: %d;\n"
+			"DCIN_OV_IRQ: %d;\n"
+			"DCIN_UV_IRQ: %d;\n"
+			"DCIN_VALID_IRQ: %d;\n"
+			"USBIN_OV_IRQ: %d;\n"
+			"USBIN_UV_IRQ: %d;\n"
+			"USBIN_VALID_IRQ: %d;\n"
+			"FASTCHG_IRQ: %d;\n"
+			"LOOP_CHANGE_IRQ: %d;\n"
+			"TRKLCHG_IRQ: %d;\n"
+			"VBATDET_IRQ: %d;\n"
+			"VBATDET_LOW_IRQ: %d;\n"
+			"VBAT_OV_IRQ: %d;\n"
+			"VCP_IRQ: %d;\n"
+			"VDD_LOOP_IRQ: %d;\n"
+			"VREG_OV_IRQ: %d;\n"
+			"REGULATION_LOOP: 0x%02x\n",
+			pm_chg_get_fsm_state(the_chip),
+			pm_chg_get_rt_status(the_chip, ATCDONE_IRQ),
+			pm_chg_get_rt_status(the_chip, ATCFAIL_IRQ),
+			pm_chg_get_rt_status(the_chip, BATFET_IRQ),
+			pm_chg_get_rt_status(the_chip, BATTTEMP_COLD_IRQ),
+			pm_chg_get_rt_status(the_chip, BATTTEMP_HOT_IRQ),
+			pm_chg_get_rt_status(the_chip, BATT_INSERTED_IRQ),
+			pm_chg_get_rt_status(the_chip, BATT_REMOVED_IRQ),
+			pm_chg_get_rt_status(the_chip, BAT_TEMP_OK_IRQ),
+			pm_chg_get_rt_status(the_chip, CHGDONE_IRQ),
+			pm_chg_get_rt_status(the_chip, CHGFAIL_IRQ),
+			pm_chg_get_rt_status(the_chip, CHGHOT_IRQ),
+			pm_chg_get_rt_status(the_chip, CHGSTATE_IRQ),
+			pm_chg_get_rt_status(the_chip, CHGWDOG_IRQ),
+			pm_chg_get_rt_status(the_chip, CHG_GONE_IRQ),
+			pm_chg_get_rt_status(the_chip, COARSE_DET_LOW_IRQ),
+			pm_chg_get_rt_status(the_chip, DCIN_OV_IRQ),
+			pm_chg_get_rt_status(the_chip, DCIN_UV_IRQ),
+			pm_chg_get_rt_status(the_chip, DCIN_VALID_IRQ),
+			pm_chg_get_rt_status(the_chip, USBIN_OV_IRQ),
+			pm_chg_get_rt_status(the_chip, USBIN_UV_IRQ),
+			pm_chg_get_rt_status(the_chip, USBIN_VALID_IRQ),
+			pm_chg_get_rt_status(the_chip, FASTCHG_IRQ),
+			pm_chg_get_rt_status(the_chip, LOOP_CHANGE_IRQ),
+			pm_chg_get_rt_status(the_chip, TRKLCHG_IRQ),
+			pm_chg_get_rt_status(the_chip, VBATDET_IRQ),
+			pm_chg_get_rt_status(the_chip, VBATDET_LOW_IRQ),
+			pm_chg_get_rt_status(the_chip, VBAT_OV_IRQ),
+			pm_chg_get_rt_status(the_chip, VCP_IRQ),
+			pm_chg_get_rt_status(the_chip, VDD_LOOP_IRQ),
+			pm_chg_get_rt_status(the_chip, VREG_OV_IRQ),
+			pm_chg_get_regulation_loop(the_chip)
+			);
+
+	rc = pm8xxx_adc_read(CHANNEL_USBIN, &result);
+	if (rc) {
+		pr_err("error reading i_chg channel = %d, rc = %d\n",
+					CHANNEL_USBIN, rc);
+	}
+
+	len += scnprintf(buf + len, size - len,
+			"USBIN(uV): %d;\n", (int)result.physical);
+
+	rc = pm8xxx_adc_read(CHANNEL_VPH_PWR, &result);
+	if (rc) {
+		pr_err("error reading vph_pwr channel = %d, rc = %d\n",
+					CHANNEL_VPH_PWR, rc);
+	}
+	len += scnprintf(buf + len, size - len,
+			"VPH_PWR(uV): %d;\n", (int)result.physical);
+
+	len += scnprintf(buf + len, size - len,
+			"AC_SAFETY_TIMEOUT(bool): %d;\n", (int)is_ac_safety_timeout);
+
+	len += scnprintf(buf + len, size - len,
+			"AC_SAFETY_TIMEOUT2(bool): %d;\n", (int)is_ac_safety_timeout_twice);
+
+	len += scnprintf(buf + len, size - len,
+			"mitigation_level(int): %d;\n", thermal_mitigation);
+
+	len += scnprintf(buf + len, size - len,
+			"eoc_count(int): %d;\n", eoc_count);
+
+	get_reg((void *)CHG_CNTRL, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_CNTRL: 0x%llx;\n", val);
+	get_reg((void *)CHG_CNTRL_2, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_CNTRL_2: 0x%llx;\n", val);
+	get_reg((void *)CHG_CNTRL_3, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_CNTRL_3: 0x%llx;\n", val);
+	get_reg((void *)PBL_ACCESS1, &val);
+	len += scnprintf(buf + len, size - len,
+			"PBL_ACCESS1: 0x%llx;\n", val);
+	get_reg((void *)PBL_ACCESS2, &val);
+	len += scnprintf(buf + len, size - len,
+			"PBL_ACCESS2: 0x%llx;\n", val);
+	get_reg((void *)SYS_CONFIG_1, &val);
+	len += scnprintf(buf + len, size - len,
+			"SYS_CONFIG_1: 0x%llx;\n", val);
+	get_reg((void *)SYS_CONFIG_2, &val);
+	len += scnprintf(buf + len, size - len,
+			"SYS_CONFIG_2: 0x%llx;\n", val);
+	get_reg((void *)CHG_IBAT_MAX, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_IBAT_MAX: 0x%llx;\n", val);
+	get_reg((void *)CHG_IBAT_SAFE, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_IBAT_SAFE: 0x%llx;\n", val);
+	get_reg((void *)CHG_VDD_MAX, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_VDD_MAX: 0x%llx;\n", val);
+	get_reg((void *)CHG_VDD_SAFE, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_VDD_SAFE: 0x%llx;\n", val);
+	get_reg((void *)CHG_VBAT_DET, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_VBAT_DET: 0x%llx;\n", val);
+	get_reg((void *)CHG_VIN_MIN, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_VIN_MIN: 0x%llx;\n", val);
+	get_reg((void *)CHG_VTRICKLE, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_VTRICKLE: 0x%llx;\n", val);
+	get_reg((void *)CHG_ITRICKLE, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_ITRICKLE: 0x%llx;\n", val);
+	get_reg((void *)CHG_ITERM, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_ITERM: 0x%llx;\n", val);
+	get_reg((void *)CHG_TCHG_MAX, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_TCHG_MAX: 0x%llx;\n", val);
+	get_reg((void *)CHG_TWDOG, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_TWDOG: 0x%llx;\n", val);
+	get_reg((void *)CHG_TEMP_THRESH, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_TEMP_THRESH: 0x%llx;\n", val);
+	get_reg((void *)CHG_COMP_OVR, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_COMP_OVR: 0x%llx;\n", val);
+	get_reg((void *)CHG_BUCK_CTRL_TEST1, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_BUCK_CTRL_TEST1: 0x%llx;\n", val);
+	get_reg((void *)CHG_BUCK_CTRL_TEST2, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_BUCK_CTRL_TEST2: 0x%llx;\n", val);
+	get_reg((void *)CHG_BUCK_CTRL_TEST3, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_BUCK_CTRL_TEST3: 0x%llx;\n", val);
+	get_reg((void *)CHG_TEST, &val);
+	len += scnprintf(buf + len, size - len,
+			"CHG_TEST: 0x%llx;\n", val);
+	get_reg((void *)USB_OVP_CONTROL, &val);
+	len += scnprintf(buf + len, size - len,
+			"USB_OVP_CONTROL: 0x%llx;\n", val);
+	get_reg((void *)USB_OVP_TEST, &val);
+	len += scnprintf(buf + len, size - len,
+			"USB_OVP_TEST: 0x%llx;\n", val);
+	get_reg((void *)DC_OVP_CONTROL, &val);
+	len += scnprintf(buf + len, size - len,
+			"DC_OVP_CONTROL: 0x%llx;\n", val);
+	get_reg((void *)DC_OVP_TEST, &val);
+	len += scnprintf(buf + len, size - len,
+			"DC_OVP_TEST: 0x%llx;\n", val);
+
+	return len;
+}
+
+static void (*notify_vbus_state_func_ptr)(int);
+static int usb_chg_current;
+static DEFINE_SPINLOCK(vbus_lock);
+
+int pm8921_charger_register_vbus_sn(void (*callback)(int))
+{
+	pr_debug("%p\n", callback);
+	notify_vbus_state_func_ptr = callback;
+	return 0;
+}
+EXPORT_SYMBOL_GPL(pm8921_charger_register_vbus_sn);
+
+void pm8921_charger_unregister_vbus_sn(void (*callback)(int))
+{
+	pr_debug("%p\n", callback);
+	notify_vbus_state_func_ptr = NULL;
+}
+EXPORT_SYMBOL_GPL(pm8921_charger_unregister_vbus_sn);
+
+static void notify_usb_of_the_plugin_event(int plugin)
+{
+	plugin = !!plugin;
+	if (notify_vbus_state_func_ptr) {
+		pr_debug("notifying plugin\n");
+		(*notify_vbus_state_func_ptr) (plugin);
+	} else {
+		pr_debug("unable to notify plugin\n");
+	}
+}
+
+static void __pm8921_charger_vbus_draw(unsigned int mA)
+{
+	int i, rc;
+
+	if (mA > 0 && mA <= 2) {
+		usb_chg_current = 0;
+		rc = pm_chg_iusbmax_set(the_chip, 0);
+		if (rc)
+			pr_err("unable to set iusb to %d rc = %d\n", 0, rc);
+		rc = pm_chg_usb_suspend_enable(the_chip, 1);
+		if (rc)
+			pr_err("fail to set suspend bit rc=%d\n", rc);
+	} else {
+		rc = pm_chg_usb_suspend_enable(the_chip, 0);
+		if (rc)
+			pr_err("fail to reset suspend bit rc=%d\n", rc);
+		for (i = ARRAY_SIZE(usb_ma_table) - 1; i >= 0; i--) {
+			if (usb_ma_table[i].usb_ma <= mA)
+				break;
+		}
+		if (i < 0)
+			i = 0;
+		rc = pm_chg_iusbmax_set(the_chip, i);
+		if (rc)
+			pr_err("unable to set iusb to %d rc = %d\n", i, rc);
+	}
+}
+
+#define USB_WALL_THRESHOLD_MA	(1500)
+static void _pm8921_charger_vbus_draw(unsigned int mA)
+{
+	unsigned long flags;
+
+	if (usb_max_current && mA > usb_max_current) {
+		pr_warn("restricting usb current to %d instead of %d\n",
+					usb_max_current, mA);
+		mA = usb_max_current;
+	}
+	if (usb_target_ma == 0 && mA > USB_WALL_THRESHOLD_MA)
+		usb_target_ma = mA;
+
+	spin_lock_irqsave(&vbus_lock, flags);
+	if (the_chip) {
+		if (mA > USB_WALL_THRESHOLD_MA)
+			__pm8921_charger_vbus_draw(USB_WALL_THRESHOLD_MA);
+		else
+			__pm8921_charger_vbus_draw(mA);
+	} else {
+		if (mA > USB_WALL_THRESHOLD_MA)
+			usb_chg_current = USB_WALL_THRESHOLD_MA;
+		else
+			usb_chg_current = mA;
+	}
+	spin_unlock_irqrestore(&vbus_lock, flags);
+}
+
+static void handle_usb_present_change(struct pm8921_chg_chip *chip,
+				int usb_present)
+{
+	int rc = 0;
+
+	if (pm_chg_failed_clear(chip, 1))
+		pr_err("Failed to write CHG_FAILED_CLEAR bit\n");
+	if (chip->usb_present ^ usb_present) {
+		pr_info("vbus present change: %d -> %d\n",
+		chip->usb_present, usb_present);
+		chip->usb_present = usb_present;
+
+		if (usb_present) {
+			is_cable_remove = false;
+		} else {
+			rc = pm_chg_disable_auto_enable(chip, 0, BATT_CHG_DISABLED_BIT_EOC);
+			if (rc)
+				pr_err("Failed to set auto_enable rc=%d\n", rc);
+
+			is_batt_full = false;
+			eoc_count = 0;
+			is_ac_safety_timeout = is_ac_safety_timeout_twice = false;
+			is_cable_remove = true;
+
+			pr_info("Set vbatdet=%d after cable out\n",
+					PM8921_CHG_VBATDET_MAX);
+			rc = pm_chg_vbatdet_set(chip, PM8921_CHG_VBATDET_MAX);
+			if (rc)
+				pr_err("Failed to set vbatdet=%d rc=%d\n",
+						PM8921_CHG_VBATDET_MAX, rc);
+		}
+		usbin_ov_irq_handler(chip->pmic_chg_irq[USBIN_OV_IRQ], chip);
+	}
+
+	if (usb_present) {
+			schedule_delayed_work(&chip->unplug_check_work,
+				round_jiffies_relative(msecs_to_jiffies
+					(UNPLUG_CHECK_WAIT_PERIOD_MS)));
+			pm8921_chg_enable_irq(chip, CHG_GONE_IRQ);
+	} else {
+			
+			usb_target_ma = 0;
+			pm8921_chg_disable_irq(chip, CHG_GONE_IRQ);
+	}
+	enable_input_voltage_regulation(chip);
+
+	bms_notify_check(chip);
+}
+
+static u32 htc_fake_charger_for_testing(enum htc_power_source_type src)
+{
+	
+	enum htc_power_source_type new_src = HTC_PWR_SOURCE_TYPE_AC;
+
+	if((src > HTC_PWR_SOURCE_TYPE_9VAC) || (src == HTC_PWR_SOURCE_TYPE_BATT))
+		return src;
+
+	pr_info("%s(%d -> %d)\n", __func__, src , new_src);
+	return new_src;
+}
+
+
+int pm8921_set_pwrsrc_and_charger_enable(enum htc_power_source_type src,
+		bool chg_enable, bool pwrsrc_enable)
+{
+	int mA = 0;
+	int rc = 0;
+
+	pr_info("src=%d, chg_enable=%d, pwrsrc_enable=%d\n",
+				src, chg_enable, pwrsrc_enable);
+
+	if (get_kernel_flag() & KERNEL_FLAG_ENABLE_FAST_CHARGE)
+		src = htc_fake_charger_for_testing(src);
+
+
+	pwr_src = src;
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	if(the_chip->ext_usb)
+	{
+		if(the_chip->ext_usb->ichg->set_pwrsrc_and_charger_enable)
+			rc = the_chip->ext_usb->ichg->set_pwrsrc_and_charger_enable(src, chg_enable, pwrsrc_enable);
+
+		if(chg_enable)
+		{
+			if (!flag_disable_wakelock)
+				wake_lock(&the_chip->eoc_wake_lock);
+
+			schedule_delayed_work(&the_chip->eoc_work,
+			      round_jiffies_relative(msecs_to_jiffies
+					(EOC_CHECK_PERIOD_MS)));
+
+			pr_info("schedule_delayed_work(&the_chip->eoc_wora)k\n");
+
+		}
+		return rc;
+	}
+
+	
+	pm_chg_disable_pwrsrc(the_chip, !pwrsrc_enable, PWRSRC_DISABLED_BIT_KDRV);
+
+	
+	pm_chg_disable_auto_enable(the_chip, !chg_enable,
+								BATT_CHG_DISABLED_BIT_KDRV);
+
+	
+	switch (src) {
+	case HTC_PWR_SOURCE_TYPE_BATT:
+		mA = USB_MA_2;
+		break;
+	case HTC_PWR_SOURCE_TYPE_WIRELESS:
+		if (pm8921_is_dc_chg_plugged_in()) {
+			pr_info("Wireless charger is from DC_IN\n");
+			mA = USB_MA_1100;
+		} else
+			mA = USB_MA_500;
+		break;
+	case HTC_PWR_SOURCE_TYPE_USB:
+		mA = USB_MA_500;
+		break;
+	case HTC_PWR_SOURCE_TYPE_AC:
+	case HTC_PWR_SOURCE_TYPE_9VAC:
+	case HTC_PWR_SOURCE_TYPE_MHL_AC:
+		mA = USB_MA_1100;
+		break;
+	default:
+		mA = USB_MA_2;
+		break;
+	}
+	_pm8921_charger_vbus_draw(mA);
+	if (HTC_PWR_SOURCE_TYPE_BATT == src)
+		handle_usb_present_change(the_chip, 0);
+	else
+		handle_usb_present_change(the_chip, 1);
+
+	return rc;
+}
+EXPORT_SYMBOL(pm8921_set_pwrsrc_and_charger_enable);
+
+void pm8921_charger_vbus_draw(unsigned int mA)
+{
+	unsigned long flags;
+
+	pr_info("Enter charge=%d (deprecated api)\n", mA);
+	return;
+
+	if (usb_max_current && mA > usb_max_current) {
+		pr_warn("restricting usb current to %d instead of %d\n",
+					usb_max_current, mA);
+		mA = usb_max_current;
+	}
+	if (usb_target_ma == 0 && mA > USB_WALL_THRESHOLD_MA)
+		usb_target_ma = mA;
+
+	spin_lock_irqsave(&vbus_lock, flags);
+	if (the_chip) {
+		if (mA > USB_WALL_THRESHOLD_MA)
+			__pm8921_charger_vbus_draw(USB_WALL_THRESHOLD_MA);
+		else
+			__pm8921_charger_vbus_draw(mA);
+	} else {
+		if (mA > USB_WALL_THRESHOLD_MA)
+			usb_chg_current = USB_WALL_THRESHOLD_MA;
+		else
+			usb_chg_current = mA;
+	}
+	spin_unlock_irqrestore(&vbus_lock, flags);
+}
+EXPORT_SYMBOL_GPL(pm8921_charger_vbus_draw);
+
+int pm8921_charger_enable(bool enable)
+{
+	int rc = 0;
+
+	
+	if(the_chip->ext_usb)
+	{
+		if(the_chip->ext_usb->ichg->set_charger_enable)
+		{
+			rc = the_chip->ext_usb->ichg->set_charger_enable(enable);
+			return rc;
+		}
+	}
+
+	if (the_chip) {
+		enable = !!enable;
+		rc = pm_chg_disable_auto_enable(the_chip, !enable, BATT_CHG_DISABLED_BIT_KDRV);
+	} else {
+		pr_err("called before init\n");
+		rc = -EINVAL;
+	}
+
+
+
+	return rc;
+}
+EXPORT_SYMBOL(pm8921_charger_enable);
+
+int pm8921_is_usb_chg_plugged_in(void)
+{
+	if (!the_chip) {
+		pr_warn("%s: warn: called before init\n", __func__);
+		return -EINVAL;
+	}
+	return is_usb_chg_plugged_in(the_chip);
+}
+EXPORT_SYMBOL(pm8921_is_usb_chg_plugged_in);
+
+int pm8921_is_dc_chg_plugged_in(void)
+{
+	if (!the_chip) {
+		pr_warn("%s: warn: called before init\n", __func__);
+		return -EINVAL;
+	}
+	return is_dc_chg_plugged_in(the_chip);
+}
+EXPORT_SYMBOL(pm8921_is_dc_chg_plugged_in);
+
+int pm8921_is_pwr_src_plugged_in(void)
+{
+	int usb_in, dc_in;
+
+	usb_in = pm8921_is_usb_chg_plugged_in();
+	dc_in = pm8921_is_dc_chg_plugged_in();
+	pr_info("%s: usb_in=%d, dc_in=%d\n", __func__, usb_in, dc_in);
+	if (usb_in ^ dc_in)
+		return 1;
+	else if (usb_in & dc_in)
+		pr_warn("%s: Abnormal interrupt due to usb_in & dc_in"
+				" is existed together\n", __func__);
+	return 0;
+}
+EXPORT_SYMBOL(pm8921_is_pwr_src_plugged_in);
+
+int pm8921_is_battery_present(void)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	return get_prop_batt_present(the_chip);
+}
+EXPORT_SYMBOL(pm8921_is_battery_present);
+
+int pm8921_disable_input_current_limit(bool disable)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	if (disable) {
+		pr_warn("Disabling input current limit!\n");
+
+		return pm8xxx_writeb(the_chip->dev->parent,
+			 CHG_BUCK_CTRL_TEST3, 0xF2);
+	}
+	return 0;
+}
+EXPORT_SYMBOL(pm8921_disable_input_current_limit);
+
+int pm8921_set_max_battery_charge_current(int ma)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	return pm_chg_ibatmax_set(the_chip, ma);
+}
+EXPORT_SYMBOL(pm8921_set_max_battery_charge_current);
+
+int pm8921_disable_source_current(bool disable)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	if (disable)
+		pr_warn("current drawn from chg=0, battery provides current\n");
+	return pm_chg_disable_pwrsrc(the_chip, disable, PWRSRC_DISABLED_BIT_KDRV);
+}
+EXPORT_SYMBOL(pm8921_disable_source_current);
+
+int pm8921_regulate_input_voltage(int voltage)
+{
+	int rc;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	rc = pm_chg_vinmin_set(the_chip, voltage);
+
+	if (rc == 0)
+		the_chip->vin_min = voltage;
+
+	return rc;
+}
+
+#define USB_OV_THRESHOLD_MASK  0x60
+#define USB_OV_THRESHOLD_SHIFT  5
+int pm8921_usb_ovp_set_threshold(enum pm8921_usb_ov_threshold ov)
+{
+	u8 temp;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	if (ov > PM_USB_OV_7V) {
+		pr_err("limiting to over voltage threshold to 7volts\n");
+		ov = PM_USB_OV_7V;
+	}
+
+	temp = USB_OV_THRESHOLD_MASK & (ov << USB_OV_THRESHOLD_SHIFT);
+
+	return pm_chg_masked_write(the_chip, USB_OVP_CONTROL,
+				USB_OV_THRESHOLD_MASK, temp);
+}
+EXPORT_SYMBOL(pm8921_usb_ovp_set_threshold);
+
+#define USB_DEBOUNCE_TIME_MASK	0x06
+#define USB_DEBOUNCE_TIME_SHIFT 1
+int pm8921_usb_ovp_set_hystersis(enum pm8921_usb_debounce_time ms)
+{
+	u8 temp;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	if (ms > PM_USB_DEBOUNCE_80P5MS) {
+		pr_err("limiting debounce to 80.5ms\n");
+		ms = PM_USB_DEBOUNCE_80P5MS;
+	}
+
+	temp = USB_DEBOUNCE_TIME_MASK & (ms << USB_DEBOUNCE_TIME_SHIFT);
+
+	return pm_chg_masked_write(the_chip, USB_OVP_CONTROL,
+				USB_DEBOUNCE_TIME_MASK, temp);
+}
+EXPORT_SYMBOL(pm8921_usb_ovp_set_hystersis);
+
+#define USB_OVP_DISABLE_MASK	0x80
+int pm8921_usb_ovp_disable(int disable)
+{
+	u8 temp = 0;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	if (disable)
+		temp = USB_OVP_DISABLE_MASK;
+
+	return pm_chg_masked_write(the_chip, USB_OVP_CONTROL,
+				USB_OVP_DISABLE_MASK, temp);
+}
+
+bool pm8921_is_battery_charging(int *source)
+{
+	int fsm_state, is_charging, dc_present, usb_present;
+
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	fsm_state = pm_chg_get_fsm_state(the_chip);
+	is_charging = is_battery_charging(fsm_state);
+	if (is_charging == 0) {
+		*source = PM8921_CHG_SRC_NONE;
+		return is_charging;
+	}
+
+	if (source == NULL)
+		return is_charging;
+
+	
+	dc_present = is_dc_chg_plugged_in(the_chip);
+	usb_present = is_usb_chg_plugged_in(the_chip);
+
+	if (dc_present && !usb_present)
+		*source = PM8921_CHG_SRC_DC;
+
+	if (usb_present && !dc_present)
+		*source = PM8921_CHG_SRC_USB;
+
+	if (usb_present && dc_present)
+		*source = PM8921_CHG_SRC_DC;
+
+	return is_charging;
+}
+EXPORT_SYMBOL(pm8921_is_battery_charging);
+
+int pm8921_set_usb_power_supply_type(enum power_supply_type type)
+{
+#if 1  
+	return 0;
+#else
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	if (type < POWER_SUPPLY_TYPE_USB)
+		return -EINVAL;
+
+	the_chip->usb_psy.type = type;
+	power_supply_changed(&the_chip->usb_psy);
+	power_supply_changed(&the_chip->dc_psy);
+	return 0;
+#endif
+}
+EXPORT_SYMBOL_GPL(pm8921_set_usb_power_supply_type);
+
+int pm8921_batt_temperature(void)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	return get_prop_batt_temp(the_chip);
+}
+
+static int is_ac_online(void)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	return is_usb_chg_plugged_in(the_chip) &&
+				(pwr_src == HTC_PWR_SOURCE_TYPE_AC ||
+							pwr_src == HTC_PWR_SOURCE_TYPE_9VAC ||
+							pwr_src == HTC_PWR_SOURCE_TYPE_MHL_AC);
+}
+
+static void handle_usb_insertion_removal(struct pm8921_chg_chip *chip)
+{
+	int usb_present, rc = 0;
+	int vbat_programmed = chip->max_voltage_mv;
+
+	if (pm_chg_failed_clear(chip, 1))
+		pr_err("Failed to write CHG_FAILED_CLEAR bit\n");
+	usb_present = is_usb_chg_plugged_in(chip);
+	if (chip->usb_present ^ usb_present) {
+		pr_info("vbus present change: %d -> %d\n",
+		chip->usb_present, usb_present);
+		notify_usb_of_the_plugin_event(usb_present);
+		chip->usb_present = usb_present;
+
+		if (usb_present) {
+			htc_charger_event_notify(HTC_CHARGER_EVENT_VBUS_IN);
+			is_cable_remove = false;
+			schedule_delayed_work(&chip->unplug_check_work,
+				round_jiffies_relative(msecs_to_jiffies
+					(UNPLUG_CHECK_WAIT_PERIOD_MS)));
+		} else {
+			
+			usb_target_ma = 0;
+			pm_chg_disable_auto_enable(chip, 0, BATT_CHG_DISABLED_BIT_EOC);
+			is_batt_full = false;
+			is_ac_safety_timeout = false;
+			htc_charger_event_notify(HTC_CHARGER_EVENT_VBUS_OUT);
+			is_cable_remove = true;
+
+			rc = pm_chg_vddmax_get(chip, &vbat_programmed);
+			if (rc)
+				pr_err("couldnt read vddmax rc = %d\n", rc);
+			pr_info("Set vbatdet=%d after cable out\n",
+					vbat_programmed);
+			rc = pm_chg_vbatdet_set(chip, vbat_programmed);
+			if (rc)
+				pr_err("Failed to set vbatdet=%d rc=%d\n",
+					chip->max_voltage_mv, rc);
+		}
+	}
+	bms_notify_check(chip);
+}
+
+static void handle_stop_ext_usb_chg(struct pm8921_chg_chip *chip)
+{
+	if (chip->ext_usb == NULL) {
+		pr_debug("ext_usb charger not registered.\n");
+		return;
+	}
+
+	if (!chip->ext_usb_charging) {
+		pr_debug("ext_usb charger already not charging.\n");
+		return;
+	}
+
+	if(chip->ext_usb)
+	{
+		if(chip->ext_usb->stop_charging)
+		{
+			chip->ext_usb->stop_charging(chip->ext_usb->ctx);
+			chip->ext_usb_charging = false;
+			chip->ext_usb_charge_done = false;
+		}
+		return;
+	}
+
+}
+
+static void handle_start_ext_usb_chg(struct pm8921_chg_chip *chip)
+{
+	int usb_present;
+	int batt_present;
+	int batt_temp_ok;
+	int vbat_ov;
+	unsigned long delay =
+		round_jiffies_relative(msecs_to_jiffies(EOC_CHECK_PERIOD_MS));
+
+	if (chip->ext_usb == NULL) {
+		pr_debug("ext_usb charger not registered.\n");
+		return;
+	}
+
+	if (chip->ext_usb_charging) {
+		pr_debug("ext_usb charger already charging.\n");
+		return;
+	}
+
+	if(chip->ext_usb)
+	{
+		if(chip->ext_usb->start_charging)
+		{
+			chip->ext_usb->start_charging(chip->ext_usb->ctx);
+			chip->ext_usb_charging = true;
+			chip->ext_usb_charge_done = false;
+
+			
+			if (!flag_disable_wakelock)
+				wake_lock(&chip->eoc_wake_lock);
+			schedule_delayed_work(&chip->eoc_work, delay);
+		}
+		return;
+	}
+
+	usb_present = is_usb_chg_plugged_in(chip);
+	batt_present = pm_chg_get_rt_status(chip, BATT_INSERTED_IRQ);
+	batt_temp_ok = pm_chg_get_rt_status(chip, BAT_TEMP_OK_IRQ);
+	vbat_ov = pm_chg_get_rt_status(chip, VBAT_OV_IRQ);
+
+	if (!usb_present) {
+		pr_warn("%s. usb not present.\n", __func__);
+		return;
+	}
+
+	if (!batt_present) {
+		pr_warn("%s. battery not present.\n", __func__);
+		return;
+	}
+	if (!batt_temp_ok) {
+		pr_warn("%s. battery temperature not ok.\n", __func__);
+		return;
+	}
+	if (vbat_ov) {
+		pr_warn("%s. battery over voltage.\n", __func__);
+		return;
+	}
+
+	chip->ext_usb->start_charging(chip->ext_usb->ctx);
+	chip->ext_usb_charging = true;
+	chip->ext_usb_charge_done = false;
+	
+	schedule_delayed_work(&chip->eoc_work, delay);
+	if (!flag_disable_wakelock)
+		wake_lock(&chip->eoc_wake_lock);
+}
+
+static void handle_stop_ext_chg(struct pm8921_chg_chip *chip)
+{
+	if (chip->ext == NULL) {
+		pr_debug("external charger not registered.\n");
+		return;
+	}
+
+	if (!chip->ext_charging) {
+		pr_debug("already not charging.\n");
+		return;
+	}
+
+	chip->ext->stop_charging(chip->ext->ctx);
+	chip->ext_charging = false;
+	chip->ext_charge_done = false;
+}
+
+static void handle_start_ext_chg(struct pm8921_chg_chip *chip)
+{
+	int dc_present;
+	int batt_present;
+	int batt_temp_ok;
+	int vbat_ov;
+	int batfet;
+	unsigned long delay =
+		round_jiffies_relative(msecs_to_jiffies(EOC_CHECK_PERIOD_MS));
+
+	if (chip->ext == NULL) {
+		pr_debug("external charger not registered.\n");
+		return;
+	}
+
+	if (chip->ext_charging) {
+		pr_debug("already charging.\n");
+		return;
+	}
+
+	dc_present = is_dc_chg_plugged_in(chip);
+	batt_present = pm_chg_get_rt_status(chip, BATT_INSERTED_IRQ);
+	batt_temp_ok = pm_chg_get_rt_status(chip, BAT_TEMP_OK_IRQ);
+	vbat_ov = pm_chg_get_rt_status(chip, VBAT_OV_IRQ);
+	batfet = pm_chg_get_rt_status(chip, BATFET_IRQ);
+
+	if (!dc_present) {
+		pr_warn("%s. dc not present.\n", __func__);
+		return;
+	}
+	if (!batt_present) {
+		pr_warn("%s. battery not present.\n", __func__);
+		return;
+	}
+	if (!batt_temp_ok) {
+		pr_warn("%s. battery temperature not ok.\n", __func__);
+		return;
+	}
+	if (vbat_ov) {
+		pr_warn("%s. battery over voltage.\n", __func__);
+		return;
+	}
+	if (!batfet) {
+		pr_warn("%s. battery FET not closed.\n", __func__);
+		return;
+	}
+
+	chip->ext->start_charging(chip->ext->ctx);
+	chip->ext_charging = true;
+	chip->ext_charge_done = false;
+	
+	schedule_delayed_work(&chip->eoc_work, delay);
+	if (!flag_disable_wakelock)
+		wake_lock(&chip->eoc_wake_lock);
+}
+
+static void handle_dc_removal_insertion(struct pm8921_chg_chip *chip)
+{
+	int dc_present;
+
+	dc_present = is_dc_chg_plugged_in(chip);
+	if (chip->dc_present ^ dc_present) {
+		chip->dc_present = dc_present;
+		
+	}
+	bms_notify_check(chip);
+}
+
+static int pm_chg_turn_off_ovp_fet(struct pm8921_chg_chip *chip, u16 ovptestreg)
+{
+	u8 temp;
+	int err = 0;
+	err = pm8xxx_writeb(chip->dev->parent, ovptestreg, 0x30);
+	if (err) {
+		pr_err("Error %d writing 0x%2x to addr 0x%2x\n",
+				err, 0x30, ovptestreg);
+		return err;
+	}
+	err = pm8xxx_readb(chip->dev->parent, ovptestreg, &temp);
+	if (err) {
+		pr_err("Error %d reading addr 0x%x\n", err, ovptestreg);
+		return err;
+	}
+	
+	temp |= 0x81;
+	err = pm8xxx_writeb(chip->dev->parent, ovptestreg, temp);
+	if (err) {
+		pr_err("Error %d writing 0x%2x to addr 0x%2x\n",
+				err, temp, ovptestreg);
+		return err;
+	}
+	return 0;
+}
+
+static int pm_chg_turn_on_ovp_fet(struct pm8921_chg_chip *chip, u16 ovptestreg)
+{
+	u8 temp;
+	int err = 0;
+
+	err = pm8xxx_writeb(chip->dev->parent, ovptestreg, 0x30);
+	if (err) {
+		pr_err("Error %d writing 0x%2x to addr 0x%2x\n",
+				err, 0x30, ovptestreg);
+		return err;
+	}
+	err = pm8xxx_readb(chip->dev->parent, ovptestreg, &temp);
+	if (err) {
+		pr_err("Error %d reading addr 0x%x\n", err, ovptestreg);
+		return err;
+	}
+	
+	temp &= 0xFE;
+	temp |= 0x80;
+	err = pm8xxx_writeb(chip->dev->parent, ovptestreg, temp);
+	if (err) {
+		pr_err("Error %d writing 0x%2x to addr 0x%2x\n",
+				err, temp, ovptestreg);
+		return err;
+	}
+
+	return 0;
+}
+
+static void turn_off_ovp_fet(struct pm8921_chg_chip *chip, u16 ovptestreg)
+{
+	int i, rc;
+	for (i = 0; i < 5; i++) {
+		rc = pm_chg_turn_off_ovp_fet(chip, ovptestreg);
+		if (!rc)
+			break;
+	}
+	if (i > 0)
+		pr_info("%s: retry = %d\n", __func__, i);
+	return;
+}
+
+static void turn_on_ovp_fet(struct pm8921_chg_chip *chip, u16 ovptestreg)
+{
+	int i, rc;
+	for (i = 0; i < 5; i++) {
+		rc = pm_chg_turn_on_ovp_fet(chip, ovptestreg);
+		if (!rc)
+			break;
+	}
+	if (i > 0)
+		pr_info("%s: retry = %d\n", __func__, i);
+	return;
+}
+
+static int param_open_ovp_counter = 10;
+module_param(param_open_ovp_counter, int, 0644);
+
+#define USB_ACTIVE_BIT BIT(5)
+#define DC_ACTIVE_BIT BIT(6)
+static int is_active_chg_plugged_in(struct pm8921_chg_chip *chip,
+						u8 active_chg_mask)
+{
+	if (active_chg_mask & USB_ACTIVE_BIT)
+		return pm_chg_get_rt_status(chip, USBIN_VALID_IRQ);
+	else if (active_chg_mask & DC_ACTIVE_BIT)
+		return pm_chg_get_rt_status(chip, DCIN_VALID_IRQ);
+	else
+		return 0;
+}
+
+#define WRITE_BANK_4		0xC0
+#define OVP_DEBOUNCE_TIME 0x06
+static void unplug_ovp_fet_open_worker(struct work_struct *work)
+{
+	struct pm8921_chg_chip *chip = container_of(work,
+				struct pm8921_chg_chip,
+				unplug_ovp_fet_open_work);
+	int chg_gone = 0, active_chg_plugged_in = 0, count = 0;
+	u8 active_mask = 0;
+	u16 ovpreg, ovptestreg;
+
+	wake_lock(&chip->unplug_ovp_fet_open_wake_lock);
+	pr_info("%s:Start\n", __func__);
+	if (is_usb_chg_plugged_in(chip) &&
+		(chip->active_path & USB_ACTIVE_BIT)) {
+		ovpreg = USB_OVP_CONTROL;
+		ovptestreg = USB_OVP_TEST;
+		active_mask = USB_ACTIVE_BIT;
+	} else if (is_dc_chg_plugged_in(chip) &&
+		(chip->active_path & DC_ACTIVE_BIT)) {
+		ovpreg = DC_OVP_CONTROL;
+		ovptestreg = DC_OVP_TEST;
+		active_mask = DC_ACTIVE_BIT;
+	} else {
+		goto finish_due_to_no_cable;
+	}
+
+	while (count++ < param_open_ovp_counter) {
+		pm_chg_masked_write(chip, ovpreg, OVP_DEBOUNCE_TIME, 0x0);
+		usleep(10);
+		active_chg_plugged_in = is_active_chg_plugged_in(chip, active_mask);
+		chg_gone = pm_chg_get_rt_status(chip, CHG_GONE_IRQ);
+		pr_debug("OVP FET count=%d chg_gone=%d, active_valid=%d\n",
+					count, chg_gone, active_chg_plugged_in);
+		
+		if (chg_gone == 1 && active_chg_plugged_in == 1) {
+			pr_debug("since chg_gone = 1 disabling ovp_fet for 20 msecs\n");
+			turn_off_ovp_fet(chip, ovptestreg);
+
+			msleep(20);
+
+			turn_on_ovp_fet(chip, ovptestreg);
+		} else {
+			
+			break;
+		}
+	}
+	pm_chg_masked_write(chip, ovpreg, OVP_DEBOUNCE_TIME, 0x2);
+finish_due_to_no_cable:
+	pr_info("%s:Exiting,count=%d,chg_gone=%d,active_valid=%d\n",
+				__func__, count, chg_gone, active_chg_plugged_in);
+	wake_unlock(&chip->unplug_ovp_fet_open_wake_lock);
+	return;
+}
+
+static int find_usb_ma_value(int value)
+{
+	int i;
+
+	for (i = ARRAY_SIZE(usb_ma_table) - 1; i >= 0; i--) {
+		if (value >= usb_ma_table[i].usb_ma)
+			break;
+	}
+
+	return i;
+}
+
+static void decrease_usb_ma_value(int *value)
+{
+	int i;
+
+	if (value) {
+		i = find_usb_ma_value(*value);
+		if (i > 0)
+			i--;
+		*value = usb_ma_table[i].usb_ma;
+	}
+}
+
+static void increase_usb_ma_value(int *value)
+{
+	int i;
+
+	if (value) {
+		i = find_usb_ma_value(*value);
+
+		if (i < (ARRAY_SIZE(usb_ma_table) - 1))
+			i++;
+		*value = usb_ma_table[i].usb_ma;
+	}
+}
+
+static void vin_collapse_check_worker(struct work_struct *work)
+{
+	struct delayed_work *dwork = to_delayed_work(work);
+	struct pm8921_chg_chip *chip = container_of(dwork,
+			struct pm8921_chg_chip, vin_collapse_check_work);
+
+	
+	if (is_usb_chg_plugged_in(chip) &&
+		usb_target_ma > USB_WALL_THRESHOLD_MA) {
+		
+		decrease_usb_ma_value(&usb_target_ma);
+		
+		__pm8921_charger_vbus_draw(USB_WALL_THRESHOLD_MA);
+		pr_debug("usb_now=%d, usb_target = %d\n",
+				USB_WALL_THRESHOLD_MA, usb_target_ma);
+	} else {
+		cable_detection_vbus_irq_handler();
+	}
+}
+
+#define VIN_MIN_COLLAPSE_CHECK_MS	50
+static irqreturn_t usbin_valid_irq_handler(int irq, void *data)
+{
+	pr_info("%s: usb_target_ma=%d\n", __func__, usb_target_ma);
+	if (usb_target_ma) {
+		schedule_delayed_work(&the_chip->vin_collapse_check_work,
+				      round_jiffies_relative(msecs_to_jiffies
+						(VIN_MIN_COLLAPSE_CHECK_MS)));
+	} else {
+		
+		cable_detection_vbus_irq_handler();
+	}
+
+	if (0)
+		handle_usb_insertion_removal(data);
+	return IRQ_HANDLED;
+}
+
+static void update_ovp_uvp_state(int ov, int v, int uv)
+{
+	if ( ov && !v && !uv) {
+		if (!ovp) {
+			ovp = 1;
+			pr_info("OVP: 0 -> 1, USB_Valid: %d\n", v);
+			htc_charger_event_notify(HTC_CHARGER_EVENT_OVP);
+		}
+	} else if ( !ov && !v && uv) {
+		if (!uvp) {
+			uvp = 1;
+			pr_info("UVP: 0 -> 1, USB_Valid: %d\n", v);
+		}
+	} else {
+		if (ovp) {
+			ovp = 0;
+			pr_info("OVP: 1 -> 0, USB_Valid: %d\n", v);
+			htc_charger_event_notify(HTC_CHARGER_EVENT_OVP_RESOLVE);
+		}
+		if (uvp) {
+			uvp = 0;
+			pr_info("UVP: 1 -> 0, USB_Valid: %d\n", v);
+		}
+	}
+}
+
+static irqreturn_t usbin_ov_irq_handler(int irq, void *data)
+{
+	int ov, uv, v;
+	ov = pm_chg_get_rt_status(the_chip, USBIN_OV_IRQ);
+	v = pm_chg_get_rt_status(the_chip, USBIN_VALID_IRQ);
+	uv = pm_chg_get_rt_status(the_chip, USBIN_UV_IRQ);
+	pr_debug("%d -> %d [%d,%d,%d]\n",
+					usbin_ov_irq_state, ov, ov, v, uv);
+	usbin_ov_irq_state = ov;
+	update_ovp_uvp_state(ov, v, uv);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t batt_inserted_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+	int status;
+
+	status = pm_chg_get_rt_status(chip, BATT_INSERTED_IRQ);
+	schedule_work(&chip->battery_id_valid_work);
+	handle_start_ext_chg(chip);
+	handle_start_ext_usb_chg(chip);
+	pr_debug("battery present=%d", status);
+	
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t vbatdet_low_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+	int high_transition, rc = 0;
+
+
+	high_transition = pm_chg_get_rt_status(chip, VBATDET_LOW_IRQ);
+
+	if(chip->ext_usb)
+	{
+		if (high_transition)
+		{
+			queue_delayed_work(ext_charger_wq, &ext_charger_vbat_low_task, 0);
+		}
+
+		pr_info("%s, high_transition:%d\n", __func__, high_transition);
+		return IRQ_HANDLED;
+	}
+
+	if (high_transition) {
+		handle_start_ext_usb_chg(chip);
+		
+		pr_info("%s: Set vbatdet=%d before recharge is started\n",
+				__func__, PM8921_CHG_VBATDET_MAX);
+		rc = pm_chg_vbatdet_set(chip, PM8921_CHG_VBATDET_MAX);
+		if (rc)
+			pr_err("Failed to set vbatdet=%d rc=%d\n",
+					PM8921_CHG_VBATDET_MAX, rc);
+		
+		pm_chg_disable_auto_enable(chip, 0, BATT_CHG_DISABLED_BIT_EOC);
+		pr_info("batt fell below resume voltage %s\n",
+			batt_charging_disabled ? "" : "charger enabled (recharging)");
+	} else {
+		pr_info("vbatdet_low = %d, fsm_state=%d\n", high_transition,
+			pm_chg_get_fsm_state(data));
+	}
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t usbin_uv_irq_handler(int irq, void *data)
+{
+	int ov, uv, v;
+	ov = pm_chg_get_rt_status(the_chip, USBIN_OV_IRQ);
+	v = pm_chg_get_rt_status(the_chip, USBIN_VALID_IRQ);
+	uv = pm_chg_get_rt_status(the_chip, USBIN_UV_IRQ);
+	pr_debug("%d -> %d [%d,%d,%d]\n",
+					usbin_uv_irq_state, uv, ov, v, uv);
+	usbin_uv_irq_state = uv;
+	update_ovp_uvp_state(ov, v, uv);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t vbat_ov_irq_handler(int irq, void *data)
+{
+	pr_debug("fsm_state=%d\n", pm_chg_get_fsm_state(data));
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t chgwdog_irq_handler(int irq, void *data)
+{
+	pr_debug("fsm_state=%d\n", pm_chg_get_fsm_state(data));
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t vcp_irq_handler(int irq, void *data)
+{
+	pr_debug("state_changed_to=%d\n", pm_chg_get_fsm_state(data));
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t atcdone_irq_handler(int irq, void *data)
+{
+	pr_debug("fsm_state=%d\n", pm_chg_get_fsm_state(data));
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t atcfail_irq_handler(int irq, void *data)
+{
+	pr_debug("fsm_state=%d\n", pm_chg_get_fsm_state(data));
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t chgdone_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+
+	pr_debug("state_changed_to=%d\n", pm_chg_get_fsm_state(data));
+
+
+	if(chip->ext_usb)
+	{
+		queue_delayed_work(ext_charger_wq, &ext_charger_chgdone_task, 0);
+		return IRQ_HANDLED;
+	}
+
+	handle_stop_ext_usb_chg(chip);
+	handle_stop_ext_chg(chip);
+
+
+	bms_notify_check(chip);
+	htc_gauge_event_notify(HTC_GAUGE_EVENT_EOC);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t chgfail_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+	int ret;
+
+	if (!is_ac_online() || flag_keep_charge_on || flag_pa_recharge) {
+		pr_info("%s: write CHG_FAILED_CLEAR bit\n", __func__);
+		ret = pm_chg_failed_clear(chip, 1);
+		if (ret)
+			pr_err("Failed to write CHG_FAILED_CLEAR bit\n");
+	} else {
+		if ((chip->safety_time > SAFETY_TIME_MAX_LIMIT) &&
+				!is_ac_safety_timeout_twice) {
+			is_ac_safety_timeout_twice = true;
+			pr_info("%s: write CHG_FAILED_CLEAR bit "
+					"due to safety time is twice\n", __func__);
+			ret = pm_chg_failed_clear(chip, 1);
+			if (ret)
+				pr_err("Failed to write CHG_FAILED_CLEAR bit\n");
+		} else {
+			is_ac_safety_timeout = true;
+			pr_err("%s: batt_present=%d, batt_temp_ok=%d, state_changed_to=%d\n",
+					__func__, get_prop_batt_present(chip),
+					pm_chg_get_rt_status(chip, BAT_TEMP_OK_IRQ),
+					pm_chg_get_fsm_state(data));
+		}
+	}
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t chgstate_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+
+	pr_debug("state_changed_to=%d\n", pm_chg_get_fsm_state(data));
+	bms_notify_check(chip);
+
+	return IRQ_HANDLED;
+}
+
+static int param_vin_disable_counter = 5;
+module_param(param_vin_disable_counter, int, 0644);
+
+static void attempt_reverse_boost_fix(struct pm8921_chg_chip *chip,
+							int count, int usb_ma)
+{
+	if (usb_ma)
+		__pm8921_charger_vbus_draw(500);
+	pr_debug(" count = %d iusb=500mA\n", count);
+	disable_input_voltage_regulation(chip);
+	pr_debug(" count = %d disable_input_regulation\n", count);
+
+	msleep(20);
+
+	pr_debug(" count = %d end sleep 20ms chg_gone=%d, usb_valid = %d\n",
+								count,
+								pm_chg_get_rt_status(chip, CHG_GONE_IRQ),
+								is_usb_chg_plugged_in(chip));
+	pr_debug(" count = %d restoring input regulation and usb_ma = %d\n",
+								count, usb_ma);
+	enable_input_voltage_regulation(chip);
+	if (usb_ma)
+		__pm8921_charger_vbus_draw(usb_ma);
+}
+
+#define VIN_ACTIVE_BIT BIT(0)
+#define UNPLUG_WRKARND_RESTORE_WAIT_PERIOD_US 200
+#define VIN_MIN_INCREASE_MV 100
+#define CONSECUTIVE_TRIAL_COUNT_MAX	(20)
+static void unplug_check_worker(struct work_struct *work)
+{
+	struct delayed_work *dwork = to_delayed_work(work);
+	struct pm8921_chg_chip *chip = container_of(dwork,
+				struct pm8921_chg_chip, unplug_check_work);
+	u8 reg_loop, active_path;
+	int rc, ibat, active_chg_plugged_in, usb_ma;
+	int chg_gone = 0;
+	static int rb_trial_count = 0;
+	static int ovp_trial_count = 0;
+
+	reg_loop = 0;
+	rc = pm8xxx_readb(chip->dev->parent, PBL_ACCESS1, &active_path);
+	if (rc) {
+		pr_err("Failed to read PBL_ACCESS1 rc=%d\n", rc);
+		return;
+	}
+	chip->active_path = active_path;
+
+	active_chg_plugged_in = is_active_chg_plugged_in(chip, active_path);
+	pr_debug("active_path = 0x%x, active_chg_plugged_in = %d\n",
+			active_path, active_chg_plugged_in);
+	if (active_path & USB_ACTIVE_BIT) {
+		pr_debug("USB charger active\n");
+
+		pm_chg_iusbmax_get(chip, &usb_ma);
+		#if 0
+		if (usb_ma == 500 && !usb_target_ma) {
+			pr_info("Stopping Unplug Check Worker USB == 500mA\n");
+			rb_trial_count = ovp_trial_count = 0;
+			disable_input_voltage_regulation(chip);
+			return;
+		}
+		#endif
+
+		if (usb_ma <= 100) {
+			pr_info(
+				"Unenumerated or suspended usb_ma = %d skip\n",
+				usb_ma);
+			goto check_again_later;
+		}
+	} else if (active_path & DC_ACTIVE_BIT) {
+		pr_debug("DC charger active\n");
+		if (!chip->dc_unplug_check)
+			return;
+	} else {
+		
+		if (!(is_usb_chg_plugged_in(chip))
+				&& !(is_dc_chg_plugged_in(chip))) {
+			pr_info("Stopping Unplug Check - chargers are removed"
+				"reg_loop = %d, fsm = %d ibat = %d "
+				"(rb_trial_count=%d ovp_trial_count=%d)\n",
+				pm_chg_get_regulation_loop(chip),
+				pm_chg_get_fsm_state(chip),
+				get_prop_batt_current(chip),
+				rb_trial_count,
+				ovp_trial_count
+				);
+			rb_trial_count = ovp_trial_count = 0;
+		}
+		return;
+	}
+
+	if (active_path & USB_ACTIVE_BIT) {
+		reg_loop = pm_chg_get_regulation_loop(chip);
+		pr_debug("reg_loop=0x%x usb_ma = %d\n", reg_loop, usb_ma);
+		if ((reg_loop & VIN_ACTIVE_BIT) &&
+			(usb_ma > USB_WALL_THRESHOLD_MA)) {
+			decrease_usb_ma_value(&usb_ma);
+			usb_target_ma = usb_ma;
+			
+			__pm8921_charger_vbus_draw(usb_ma);
+			pr_debug("usb_now=%d, usb_target = %d\n",
+				usb_ma, usb_target_ma);
+		}
+	}
+
+	reg_loop = pm_chg_get_regulation_loop(chip);
+#if 0
+	pr_debug("reg_loop=0x%x usb_ma = %d\n", reg_loop, usb_ma);
+#endif
+
+	ibat = get_prop_batt_current(chip);
+	if (reg_loop & VIN_ACTIVE_BIT) {
+
+		pr_debug("ibat = %d fsm = %d reg_loop = 0x%x\n",
+				ibat, pm_chg_get_fsm_state(chip), reg_loop);
+		if (ibat > 0) {
+			int count = 0;
+			while (count++ < param_vin_disable_counter
+					&& active_chg_plugged_in == 1) {
+				if (active_path & USB_ACTIVE_BIT)
+					attempt_reverse_boost_fix(chip,
+								count, usb_ma);
+				else
+					attempt_reverse_boost_fix(chip,
+								count, 0);
+				active_chg_plugged_in
+					= is_active_chg_plugged_in(chip,
+						active_path);
+				pr_debug("active_chg_plugged_in = %d\n",
+						active_chg_plugged_in);
+				if(!active_chg_plugged_in)
+					pr_info("%s: cable out by vin disable, count:%d\n",
+							__func__, count);
+			}
+			rb_trial_count++;
+			if (rb_trial_count > CONSECUTIVE_TRIAL_COUNT_MAX) {
+				pr_info("too much rb_trial_count=%d\n", rb_trial_count);
+				rb_trial_count = 0;
+			}
+		}
+	}
+
+	active_chg_plugged_in = is_active_chg_plugged_in(chip, active_path);
+	pr_debug("active_path = 0x%x, active_chg = %d\n",
+			active_path, active_chg_plugged_in);
+	chg_gone = pm_chg_get_rt_status(chip, CHG_GONE_IRQ);
+
+	if (chg_gone == 1 && active_chg_plugged_in == 1) {
+		pr_debug("chg_gone=%d, active_chg_plugged_in = %d\n",
+					chg_gone, active_chg_plugged_in);
+		ovp_trial_count++;
+		if (ovp_trial_count > CONSECUTIVE_TRIAL_COUNT_MAX) {
+			pr_info("too much ovp_trial_count=%d\n", ovp_trial_count);
+			ovp_trial_count = 0;
+		}
+		schedule_work(&chip->unplug_ovp_fet_open_work);
+	}
+
+	if (!(reg_loop & VIN_ACTIVE_BIT) && (active_path & USB_ACTIVE_BIT) &&
+			(usb_target_ma > USB_WALL_THRESHOLD_MA)) {
+		
+		if (usb_ma < usb_target_ma) {
+			increase_usb_ma_value(&usb_ma);
+			__pm8921_charger_vbus_draw(usb_ma);
+			pr_debug("usb_now=%d, usb_target = %d\n",
+					usb_ma, usb_target_ma);
+		} else {
+			usb_target_ma = usb_ma;
+		}
+	}
+
+check_again_later:
+	
+	schedule_delayed_work(&chip->unplug_check_work,
+		      round_jiffies_relative(msecs_to_jiffies
+				(UNPLUG_CHECK_WAIT_PERIOD_MS)));
+}
+
+static irqreturn_t loop_change_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+
+	pr_info("fsm_state=%d reg_loop=0x%x\n",
+		pm_chg_get_fsm_state(data),
+		pm_chg_get_regulation_loop(data));
+
+	schedule_delayed_work(&chip->unplug_check_work,
+		round_jiffies_relative(msecs_to_jiffies(0)));
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t fastchg_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+	int high_transition;
+
+	high_transition = pm_chg_get_rt_status(chip, FASTCHG_IRQ);
+	if (high_transition && !delayed_work_pending(&chip->eoc_work)) {
+		if (!flag_disable_wakelock)
+			wake_lock(&chip->eoc_wake_lock);
+		schedule_delayed_work(&chip->eoc_work,
+				      round_jiffies_relative(msecs_to_jiffies
+							(EOC_CHECK_PERIOD_MS)));
+	}
+	bms_notify_check(chip);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t trklchg_irq_handler(int irq, void *data)
+{
+	
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t batt_removed_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+	int status;
+
+	status = pm_chg_get_rt_status(chip, BATT_REMOVED_IRQ);
+	if (chip->is_embeded_batt) {
+		pr_info("%s: Skip it due to embeded battery, present=%d\n",
+					__func__, !status);
+		return IRQ_HANDLED;
+	}
+	if (chip->mbat_in_gpio
+			&& (gpio_get_value(chip->mbat_in_gpio) == 0)) {
+		pr_info("%s: Battery is still existed, present=%d\n",
+					__func__, !status);
+		return IRQ_HANDLED;
+	}
+	pr_info("%s: battery present=%d FSM=%d", __func__, !status,
+					 pm_chg_get_fsm_state(data));
+	handle_stop_ext_usb_chg(chip);
+	handle_stop_ext_chg(chip);
+	
+	if (status)
+		htc_gauge_event_notify(HTC_GAUGE_EVENT_BATT_REMOVED);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t batttemp_hot_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+	pr_info("Battery hot\n");
+
+	pr_debug("Batt hot fsm_state=%d\n", pm_chg_get_fsm_state(data));
+
+	handle_stop_ext_chg(chip);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t chghot_irq_handler(int irq, void *data)
+{
+	pr_debug("Chg hot fsm_state=%d\n", pm_chg_get_fsm_state(data));
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t batttemp_cold_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+	pr_info("Battery cold\n");
+
+	pr_debug("Batt cold fsm_state=%d\n", pm_chg_get_fsm_state(data));
+
+	handle_stop_ext_chg(chip);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t chg_gone_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+	u8 reg;
+	int rc, chg_gone, usb_chg_plugged_in, dc_chg_plugged_in;
+
+	usb_chg_plugged_in = is_usb_chg_plugged_in(chip);
+	dc_chg_plugged_in = is_dc_chg_plugged_in(chip);
+	chg_gone = pm_chg_get_rt_status(chip, CHG_GONE_IRQ);
+
+	pr_info("chg_gone=%d, usb_valid=%d, dc_valid=%d, fsm=%d\n",
+			chg_gone, usb_chg_plugged_in, dc_chg_plugged_in,
+			pm_chg_get_fsm_state(data));
+	rc = pm8xxx_readb(chip->dev->parent, CHG_CNTRL_3, &reg);
+	if (rc)
+		pr_err("Failed to read CHG_CNTRL_3 rc=%d\n", rc);
+
+	if (reg & CHG_USB_SUSPEND_BIT)
+		return IRQ_HANDLED;
+	schedule_work(&chip->unplug_ovp_fet_open_work);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t bat_temp_ok_irq_handler(int irq, void *data)
+{
+	int bat_temp_ok;
+	struct pm8921_chg_chip *chip = data;
+
+	
+	if(the_chip->ext_usb)
+	{
+		pr_info("%s\n", __func__);
+		queue_delayed_work(ext_charger_wq, &ext_charger_temp_task, HZ/200);
+		return IRQ_HANDLED;
+	}
+
+	bat_temp_ok = pm_chg_get_rt_status(chip, BAT_TEMP_OK_IRQ);
+	if (bat_temp_ok_prev == bat_temp_ok) {
+		pr_info("batt_temp_ok=%d same as previous one so skip it this time\n",
+				 bat_temp_ok);
+		return IRQ_HANDLED;
+	} else {
+		pr_info("batt_temp_ok=%d, bat_temp_ok_prev=%d, FSM=%d\n",
+				 bat_temp_ok, bat_temp_ok_prev, pm_chg_get_fsm_state(data));
+		bat_temp_ok_prev = bat_temp_ok;
+	}
+
+	if (bat_temp_ok) {
+		handle_start_ext_chg(chip);
+	} else {
+		handle_stop_ext_chg(chip);
+	}
+
+	bms_notify_check(chip);
+
+	htc_gauge_event_notify(HTC_GAUGE_EVENT_TEMP_ZONE_CHANGE);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t coarse_det_low_irq_handler(int irq, void *data)
+{
+	pr_debug("fsm_state=%d\n", pm_chg_get_fsm_state(data));
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t vdd_loop_irq_handler(int irq, void *data)
+{
+	pr_debug("fsm_state=%d\n", pm_chg_get_fsm_state(data));
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t vreg_ov_irq_handler(int irq, void *data)
+{
+	pr_debug("fsm_state=%d\n", pm_chg_get_fsm_state(data));
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t vbatdet_irq_handler(int irq, void *data)
+{
+	pr_debug("fsm_state=%d\n", pm_chg_get_fsm_state(data));
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t batfet_irq_handler(int irq, void *data)
+{
+	pr_debug("vreg ov\n");
+	
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t dcin_valid_irq_handler(int irq, void *data)
+{
+#if 1
+	pr_info("%s\n", __func__);
+	cable_detection_vbus_irq_handler();
+#else
+	struct pm8921_chg_chip *chip = data;
+
+	pm8921_disable_source_current(true); 
+
+	handle_dc_removal_insertion(chip);
+	handle_start_ext_chg(chip);
+#endif
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t dcin_ov_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+
+	pm8921_disable_source_current(false); 
+
+	handle_dc_removal_insertion(chip);
+	handle_stop_ext_chg(chip);
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t dcin_uv_irq_handler(int irq, void *data)
+{
+	struct pm8921_chg_chip *chip = data;
+
+	pm8921_disable_source_current(false); 
+	handle_stop_ext_chg(chip);
+
+	return IRQ_HANDLED;
+}
+
+static void dump_irq_rt_status(void)
+{
+	pr_info("[irq1] %d%d%d%d %d%d%d%d %d%d%d%d %d%d%d\n",
+		
+		pm_chg_get_rt_status(the_chip, USBIN_VALID_IRQ),
+		pm_chg_get_rt_status(the_chip, USBIN_OV_IRQ),
+		pm_chg_get_rt_status(the_chip, USBIN_UV_IRQ),
+		pm_chg_get_rt_status(the_chip, VBAT_OV_IRQ),
+		
+		pm_chg_get_rt_status(the_chip, BATT_INSERTED_IRQ),
+		pm_chg_get_rt_status(the_chip, BATT_REMOVED_IRQ),
+		pm_chg_get_rt_status(the_chip, VBATDET_LOW_IRQ),
+		pm_chg_get_rt_status(the_chip, VBATDET_IRQ),
+		
+		pm_chg_get_rt_status(the_chip, ATCDONE_IRQ),
+		pm_chg_get_rt_status(the_chip, ATCFAIL_IRQ),
+		pm_chg_get_rt_status(the_chip, CHGDONE_IRQ),
+		pm_chg_get_rt_status(the_chip, CHGFAIL_IRQ),
+		
+		pm_chg_get_rt_status(the_chip, FASTCHG_IRQ),
+		pm_chg_get_rt_status(the_chip, TRKLCHG_IRQ),
+		pm_chg_get_rt_status(the_chip, VCP_IRQ));
+	pr_info("[irq2] %d%d%d%d %d%d%d%d %d%d%d%d %d%d%d\n",
+		
+		pm_chg_get_rt_status(the_chip, BATTTEMP_HOT_IRQ),
+		pm_chg_get_rt_status(the_chip, BATTTEMP_COLD_IRQ),
+		pm_chg_get_rt_status(the_chip, BAT_TEMP_OK_IRQ),
+		pm_chg_get_rt_status(the_chip, BATFET_IRQ),
+		
+		pm_chg_get_rt_status(the_chip, CHGHOT_IRQ),
+		pm_chg_get_rt_status(the_chip, CHG_GONE_IRQ),
+		pm_chg_get_rt_status(the_chip, CHGSTATE_IRQ),
+		pm_chg_get_rt_status(the_chip, CHGWDOG_IRQ),
+		
+		pm_chg_get_rt_status(the_chip, VDD_LOOP_IRQ),
+		pm_chg_get_rt_status(the_chip, VREG_OV_IRQ),
+		pm_chg_get_rt_status(the_chip, COARSE_DET_LOW_IRQ),
+		pm_chg_get_rt_status(the_chip, LOOP_CHANGE_IRQ),
+		
+		
+		pm_chg_get_rt_status(the_chip, DCIN_VALID_IRQ),
+		pm_chg_get_rt_status(the_chip, DCIN_OV_IRQ),
+		pm_chg_get_rt_status(the_chip, DCIN_UV_IRQ));
+}
+
+static void dump_reg(void)
+{
+	u64 val;
+
+	get_reg((void *)CHG_CNTRL, &val);
+	pr_info("CHG_CNTRL = 0x%llx\n", val);
+	get_reg((void *)CHG_CNTRL_2, &val);
+	pr_info("CHG_CNTRL_2 = 0x%llx\n", val);
+	get_reg((void *)CHG_CNTRL_3, &val);
+	pr_info("CHG_CNTRL_3 = 0x%llx\n", val);
+	get_reg((void *)PBL_ACCESS1, &val);
+	pr_info("PBL_ACCESS1 = 0x%llx\n", val);
+	get_reg((void *)PBL_ACCESS2, &val);
+	pr_info("PBL_ACCESS2 = 0x%llx\n", val);
+	get_reg((void *)SYS_CONFIG_1, &val);
+	pr_info("SYS_CONFIG_1 = 0x%llx\n", val);
+	get_reg((void *)SYS_CONFIG_2, &val);
+	pr_info("SYS_CONFIG_2 = 0x%llx\n", val);
+	get_reg((void *)CHG_IBAT_SAFE, &val);
+	pr_info("CHG_IBAT_SAFE = 0x%llx\n", val);
+	get_reg((void *)CHG_IBAT_MAX, &val);
+	pr_info("CHG_IBAT_MAX = 0x%llx\n", val);
+	get_reg((void *)CHG_VBAT_DET, &val);
+	pr_info("CHG_VBAT_DET = 0x%llx\n", val);
+	get_reg((void *)CHG_VDD_SAFE, &val);
+	pr_info("CHG_VDD_SAFE = 0x%llx\n", val);
+	get_reg((void *)CHG_VDD_MAX, &val);
+	pr_info("CHG_VDD_MAX = 0x%llx\n", val);
+	get_reg((void *)CHG_VIN_MIN, &val);
+	pr_info("CHG_VIN_MIN = 0x%llx\n", val);
+	get_reg((void *)CHG_VTRICKLE, &val);
+	pr_info("CHG_VTRICKLE = 0x%llx\n", val);
+	get_reg((void *)CHG_ITRICKLE, &val);
+	pr_info("CHG_ITRICKLE = 0x%llx\n", val);
+	get_reg((void *)CHG_ITERM, &val);
+	pr_info("CHG_ITERM = 0x%llx\n", val);
+	get_reg((void *)CHG_TCHG_MAX, &val);
+	pr_info("CHG_TCHG_MAX = 0x%llx\n", val);
+	get_reg((void *)CHG_TWDOG, &val);
+	pr_info("CHG_TWDOG = 0x%llx\n", val);
+	get_reg((void *)CHG_TEMP_THRESH, &val);
+	pr_info("CHG_TEMP_THRESH = 0x%llx\n", val);
+	get_reg((void *)CHG_COMP_OVR, &val);
+	pr_info("CHG_COMP_OVR = 0x%llx\n", val);
+	get_reg((void *)CHG_BUCK_CTRL_TEST1, &val);
+	pr_info("CHG_BUCK_CTRL_TEST1 = 0x%llx\n", val);
+	get_reg((void *)CHG_BUCK_CTRL_TEST2, &val);
+	pr_info("CHG_BUCK_CTRL_TEST2 = 0x%llx\n", val);
+	get_reg((void *)CHG_BUCK_CTRL_TEST3, &val);
+	pr_info("CHG_BUCK_CTRL_TEST3 = 0x%llx\n", val);
+	get_reg((void *)CHG_TEST, &val);
+	pr_info("CHG_TEST = 0x%llx\n", val);
+	get_reg((void *)USB_OVP_CONTROL, &val);
+	pr_info("USB_OVP_CONTROL = 0x%llx\n", val);
+	get_reg((void *)USB_OVP_TEST, &val);
+	pr_info("USB_OVP_TEST = 0x%llx\n", val);
+	get_reg((void *)DC_OVP_CONTROL, &val);
+	pr_info("DC_OVP_CONTROL = 0x%llx\n", val);
+	get_reg((void *)DC_OVP_TEST, &val);
+	pr_info("DC_OVP_TEST = 0x%llx\n", val);
+
+	get_reg_loop((void *)NULL, &val);
+	pr_info("REGULATION_LOOP_CONTROL = 0x%llx\n", val);
+}
+
+static void dump_all(int more)
+{
+	int rc;
+	struct pm8xxx_adc_chan_result result;
+	int vbat_mv, ibat_ma, tbat_deg, soc, id_mv, iusb_ma;
+	int fcc, health, present, charger_type, status;
+	int fsm, ac_online, usb_online, dc_online;
+	int ichg = 0, vph_pwr = 0, usbin = 0;
+	int temp_fault = 0, vbatdet_low = 0;
+	vbat_mv = get_prop_battery_uvolts(the_chip)/1000;
+	soc = get_prop_batt_capacity(the_chip);
+	ibat_ma = get_prop_batt_current(the_chip)/1000;
+	fcc = get_prop_batt_fcc(the_chip);
+	id_mv = (int)read_battery_id(the_chip)/1000;
+	health = get_prop_batt_health(the_chip);
+	present = get_prop_batt_present(the_chip);
+	charger_type = get_prop_charge_type(the_chip);
+	status = get_prop_batt_status(the_chip);
+	tbat_deg = get_prop_batt_temp(the_chip)/10;
+	if (tbat_deg >= 68)
+		pr_warn("battery temperature=%d >= 68\n", tbat_deg);
+
+	fsm = pm_chg_get_fsm_state(the_chip);
+	ac_online = is_ac_online();
+	usb_online = is_usb_chg_plugged_in(the_chip);
+	dc_online = is_dc_chg_plugged_in(the_chip);
+	pm8921_is_batt_temperature_fault(&temp_fault);
+	pm_chg_iusbmax_get(the_chip, &iusb_ma);
+
+	rc = pm8xxx_adc_read(CHANNEL_ICHG, &result);
+	if (rc) {
+		pr_err("error reading i_chg channel = %d, rc = %d\n",
+					CHANNEL_ICHG, rc);
+	}
+	ichg = (int)result.physical;
+
+	rc = pm8xxx_adc_read(CHANNEL_VPH_PWR, &result);
+	if (rc) {
+		pr_err("error reading vph_pwr channel = %d, rc = %d\n",
+					CHANNEL_VPH_PWR, rc);
+	}
+	vph_pwr = (int)result.physical;
+
+	rc = pm8xxx_adc_read(CHANNEL_USBIN, &result);
+	if (rc) {
+		pr_err("error reading i_chg channel = %d, rc = %d\n",
+					CHANNEL_USBIN, rc);
+	}
+	usbin = (int)result.physical;
+	vbatdet_low = pm_chg_get_rt_status(the_chip, VBATDET_LOW_IRQ);
+
+	pr_info("V=%d mV, I=%d mA, T=%d C, SoC=%d%%, FCC=%d, id=%d mV,"
+			" H=%d, P=%d, CHG=%d, S=%d, FSM=%d, AC=%d, USB=%d, DC=%d,"
+			" iusb_ma=%d, usb_target_ma=%d, OVP=%d, UVP=%d, TM=%d, eoc_count=%d,"
+			" vbatdet_low=%d, is_ac_ST=%d, batfet_dis=0x%x, pwrsrc_dis=0x%x,"
+			" is_full=%d, temp_fault=%d, is_bat_warm/cool=%d/%d,"
+			" btm_warm/cool=%d/%d, ichg=%d uA, vph_pwr=%d uV, usbin=%d uV,"
+			" flag=%d%d%d%d\n",
+			vbat_mv, ibat_ma, tbat_deg, soc, fcc, id_mv,
+			health, present, charger_type, status, fsm,
+			ac_online, usb_online, dc_online,
+			iusb_ma, usb_target_ma, ovp, uvp, thermal_mitigation, eoc_count,
+			vbatdet_low, is_ac_safety_timeout, batt_charging_disabled,
+			pwrsrc_disabled, is_batt_full,
+			temp_fault, the_chip->is_bat_warm, the_chip->is_bat_cool,
+			pm8xxx_adc_btm_is_warm(), pm8xxx_adc_btm_is_cool(),
+			ichg, vph_pwr, usbin, test_power_monitor, flag_keep_charge_on,
+			flag_pa_recharge, flag_disable_wakelock);
+	
+	if (more || (fsm == FSM_STATE_OFF_0) || (ibat_ma < -1000) ||
+			(tbat_deg == 80) || (4000 < usbin && (!usb_online)) ||
+			(2000 < ibat_ma) || is_cable_remove ||
+			(0 < ibat_ma && fsm == FSM_STATE_FAST_CHG_7) ||
+			(!is_batt_full && usb_online && fsm != FSM_STATE_FAST_CHG_7)) {
+		dump_irq_rt_status();
+		dump_reg();
+		pm8921_bms_dump_all();
+		is_cable_remove = false;
+	}
+}
+
+inline int pm8921_dump_all(void)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	dump_all(0);
+
+	if(the_chip->ext_usb)
+	{
+		if(the_chip->ext_usb->ichg->dump_all)
+			the_chip->ext_usb->ichg->dump_all();
+	}
+
+	return 0;
+}
+
+static void update_heartbeat(struct work_struct *work)
+{
+	struct delayed_work *dwork = to_delayed_work(work);
+	struct pm8921_chg_chip *chip = container_of(dwork,
+				struct pm8921_chg_chip, update_heartbeat_work);
+
+	pm_chg_failed_clear(chip, 1);
+	
+	schedule_delayed_work(&chip->update_heartbeat_work,
+			      round_jiffies_relative(msecs_to_jiffies
+						     (chip->update_time)));
+	dump_all(0);
+}
+
+static void recharge_check_worker(struct work_struct *work)
+{
+	struct delayed_work *dwork = to_delayed_work(work);
+	struct pm8921_chg_chip *chip = container_of(dwork,
+				struct pm8921_chg_chip, recharge_check_work);
+	int fast_chg;
+
+	fast_chg = pm_chg_get_rt_status(chip, FASTCHG_IRQ);
+	if (!fast_chg) {
+		pr_info("check vbatdet_low_irq rt status\n");
+		vbatdet_low_irq_handler(chip->pmic_chg_irq[VBATDET_LOW_IRQ], chip);
+	}
+	wake_unlock(&chip->recharge_check_wake_lock);
+}
+
+enum {
+	CHG_IN_PROGRESS,
+	CHG_NOT_IN_PROGRESS,
+	CHG_FINISHED,
+};
+#define VBAT_TOLERANCE_MV	70
+#define CHG_DISABLE_MSLEEP	100
+static int is_charging_finished(struct pm8921_chg_chip *chip)
+{
+	int vbat_meas_uv, vbat_meas_mv, vbat_programmed, vbatdet_low;
+	int ichg_meas_ma, iterm_programmed;
+	int regulation_loop, fast_chg, vcp;
+	int rc;
+	int ext_in_charging;
+
+	static int last_vbat_programmed = -EINVAL;
+
+	if (!is_using_ext_charger(chip)) {
+		
+		fast_chg = pm_chg_get_rt_status(chip, FASTCHG_IRQ);
+		pr_debug("fast_chg = %d\n", fast_chg);
+		if (fast_chg == 0)
+			return CHG_NOT_IN_PROGRESS;
+
+		vcp = pm_chg_get_rt_status(chip, VCP_IRQ);
+		pr_debug("vcp = %d\n", vcp);
+		if (vcp == 1)
+			return CHG_IN_PROGRESS;
+
+		vbatdet_low = pm_chg_get_rt_status(chip, VBATDET_LOW_IRQ);
+		pr_debug("vbatdet_low = %d (htc skip this check)\n", vbatdet_low);
+
+		
+		rc = pm_chg_get_rt_status(chip, BAT_TEMP_OK_IRQ);
+		pr_debug("batt_temp_ok = %d\n", rc);
+		if (rc == 0)
+			return CHG_IN_PROGRESS;
+
+		
+		vbat_meas_uv = get_prop_battery_uvolts(chip);
+		if (vbat_meas_uv < 0)
+			return CHG_IN_PROGRESS;
+		vbat_meas_mv = vbat_meas_uv / 1000;
+
+		rc = pm_chg_vddmax_get(chip, &vbat_programmed);
+		if (rc) {
+			pr_err("couldnt read vddmax rc = %d\n", rc);
+			return CHG_IN_PROGRESS;
+		}
+		pr_debug("vddmax = %d vbat_meas_mv=%d\n",
+			 vbat_programmed, vbat_meas_mv);
+		if (vbat_meas_mv < vbat_programmed - VBAT_TOLERANCE_MV)
+			return CHG_IN_PROGRESS;
+
+		if (last_vbat_programmed == -EINVAL)
+			last_vbat_programmed = vbat_programmed;
+		if (last_vbat_programmed !=  vbat_programmed) {
+			
+			pr_debug("vddmax = %d last_vdd_max=%d\n",
+				 vbat_programmed, last_vbat_programmed);
+			last_vbat_programmed = vbat_programmed;
+			return CHG_IN_PROGRESS;
+		}
+
+		regulation_loop = pm_chg_get_regulation_loop(chip);
+		if (regulation_loop < 0) {
+			pr_err("couldnt read the regulation loop err=%d\n",
+				regulation_loop);
+			return CHG_IN_PROGRESS;
+		}
+		pr_debug("regulation_loop=%d\n", regulation_loop);
+
+		if (regulation_loop != 0 && regulation_loop != VDD_LOOP)
+			return CHG_IN_PROGRESS;
+	} 
+	else if(chip->ext_usb)
+	{
+
+		if(chip->ext_usb->ichg->get_charging_enabled)
+			chip->ext_usb->ichg->get_charging_enabled(&ext_in_charging);
+
+		if(!ext_in_charging)
+			return CHG_NOT_IN_PROGRESS;
+
+
+		
+		rc = pm_chg_get_rt_status(chip, BAT_TEMP_OK_IRQ);
+		pr_debug("batt_temp_ok = %d\n", rc);
+		if (rc == 0)
+			return CHG_IN_PROGRESS;
+
+		
+		vbat_meas_uv = get_prop_battery_uvolts(chip);
+		if (vbat_meas_uv < 0)
+			return CHG_IN_PROGRESS;
+		vbat_meas_mv = vbat_meas_uv / 1000;
+
+		rc = pm_chg_vddmax_get(chip, &vbat_programmed);
+		if (rc) {
+			pr_err("couldnt read vddmax rc = %d\n", rc);
+			return CHG_IN_PROGRESS;
+		}
+
+		pr_debug("vddmax = %d vbat_meas_mv=%d\n",
+			 vbat_programmed, vbat_meas_mv);
+		if (vbat_meas_mv < vbat_programmed - VBAT_TOLERANCE_MV)
+			return CHG_IN_PROGRESS;
+
+		if (last_vbat_programmed == -EINVAL)
+			last_vbat_programmed = vbat_programmed;
+		if (last_vbat_programmed !=  vbat_programmed) {
+			
+			pr_debug("vddmax = %d last_vdd_max=%d\n",
+				 vbat_programmed, last_vbat_programmed);
+			last_vbat_programmed = vbat_programmed;
+			return CHG_IN_PROGRESS;
+		}
+
+		
+		rc = pm_chg_iterm_get(chip, &iterm_programmed);
+
+		if (rc) {
+			pr_err("couldnt read iterm rc = %d\n", rc);
+			return CHG_IN_PROGRESS;
+		}
+
+		ichg_meas_ma = (get_prop_batt_current(chip)) / 1000;
+		pr_debug("iterm_programmed = %d ichg_meas_ma=%d\n",
+					iterm_programmed, ichg_meas_ma);
+		if (ichg_meas_ma > 0)
+			return CHG_IN_PROGRESS;
+
+		if (ichg_meas_ma * -1 > iterm_programmed)
+			return CHG_IN_PROGRESS;
+
+		return CHG_FINISHED;
+
+	}
+	else
+	{
+		
+	}
+
+
+	
+	rc = pm_chg_iterm_get(chip, &iterm_programmed);
+	if (rc) {
+		pr_err("couldnt read iterm rc = %d\n", rc);
+		return CHG_IN_PROGRESS;
+	}
+
+	ichg_meas_ma = (get_prop_batt_current(chip)) / 1000;
+	pr_debug("iterm_programmed = %d ichg_meas_ma=%d\n",
+				iterm_programmed, ichg_meas_ma);
+	if (ichg_meas_ma > 0)
+		return CHG_IN_PROGRESS;
+
+	if (ichg_meas_ma * -1 > iterm_programmed)
+		return CHG_IN_PROGRESS;
+
+	return CHG_FINISHED;
+}
+
+int pm_chg_program_vbatdet(struct pm8921_chg_chip *chip)
+{
+	int rc;
+	int vbat_programmed;
+
+	rc = pm_chg_vddmax_get(chip, &vbat_programmed);
+	if (rc) {
+		pr_err("couldnt read vddmax rc = %d\n", rc);
+		if (chip->is_bat_warm)
+			vbat_programmed = chip->warm_bat_voltage;
+		else if (chip->is_bat_cool)
+			vbat_programmed = chip->cool_bat_voltage;
+		else
+			vbat_programmed = chip->max_voltage_mv;
+	}
+	pr_info("program vbatdet=%d under %s condition\n",
+			vbat_programmed - chip->resume_voltage_delta,
+			(chip->is_bat_warm|chip->is_bat_cool) ? "warm/cool" : "normal");
+	rc = pm_chg_vbatdet_set(chip,
+				vbat_programmed - chip->resume_voltage_delta);
+	if (rc)
+		pr_err("Failed to set vbatdet=%d rc=%d\n",
+				vbat_programmed - chip->resume_voltage_delta, rc);
+
+	return rc;
+}
+
+#define CONSECUTIVE_COUNT	3
+#define EOC_STOP_CHG_COUNT	(CONSECUTIVE_COUNT + 180)
+#define CLEAR_FULL_STATE_BY_LEVEL_THR		90
+static void eoc_worker(struct work_struct *work)
+{
+	struct delayed_work *dwork = to_delayed_work(work);
+	struct pm8921_chg_chip *chip = container_of(dwork,
+				struct pm8921_chg_chip, eoc_work);
+	int end, soc = 0;
+
+	if (!is_ac_safety_timeout)
+		pm_chg_failed_clear(chip, 1);
+	end = is_charging_finished(chip);
+
+	if (end == CHG_NOT_IN_PROGRESS) {
+		
+		pr_info("%s: End due to fast_chg=%d\n",
+				__func__, pm_chg_get_rt_status(chip, FASTCHG_IRQ));
+		is_batt_full = false;
+		eoc_count = 0;
+		is_ac_safety_timeout_twice = false;
+		if (!flag_disable_wakelock)
+			wake_unlock(&chip->eoc_wake_lock);
+		return;
+	}
+
+	if (CONSECUTIVE_COUNT <= eoc_count)
+		end = CHG_FINISHED;
+
+	if (end == CHG_FINISHED) {
+		eoc_count++;
+	} else {
+		eoc_count = 0;
+	}
+
+	if (EOC_STOP_CHG_COUNT == eoc_count) {
+		eoc_count = 0;
+		is_ac_safety_timeout_twice = false;
+		pm_chg_program_vbatdet(chip);
+		pm_chg_disable_auto_enable(chip, 1, BATT_CHG_DISABLED_BIT_EOC);
+
+		if (is_ext_charging(chip))
+			chip->ext_charge_done = true;
+
+		if (chip->is_bat_warm || chip->is_bat_cool) {
+			pr_info("exit EXT-EOC-CHARGING phase at %s condition.\n",
+								(chip->is_bat_warm) ? "warm" : "cool");
+			is_batt_full = false;
+		} else {
+			pr_info("EXT-EOC-CHARGING phase done\n");
+		}
+		pr_info("vbatdet_low_irq=%d\n",
+						pm_chg_get_rt_status(chip, VBATDET_LOW_IRQ));
+		
+		chgdone_irq_handler(chip->pmic_chg_irq[CHGDONE_IRQ], chip);
+		
+		schedule_delayed_work(&chip->recharge_check_work,
+			      round_jiffies_relative(msecs_to_jiffies
+						     (EOC_CHECK_PERIOD_MS)));
+		wake_lock(&chip->recharge_check_wake_lock);
+
+		if (!flag_disable_wakelock)
+			wake_unlock(&chip->eoc_wake_lock);
+		return;
+	} else if (CONSECUTIVE_COUNT == eoc_count) {
+		if (chip->is_bat_warm || chip->is_bat_cool) {
+			pr_info("meet %s EOC condition.\n",
+								(chip->is_bat_warm) ? "warm" : "cool");
+			pm_chg_program_vbatdet(chip);
+			pm_chg_disable_auto_enable(chip, 1, BATT_CHG_DISABLED_BIT_EOC);
+			is_batt_full = false;
+			
+			chgdone_irq_handler(chip->pmic_chg_irq[CHGDONE_IRQ], chip);
+			if (!flag_disable_wakelock)
+				wake_unlock(&chip->eoc_wake_lock);
+		} else {
+			pr_info("EXT-EOC-CHARGING phase start\n");
+			is_batt_full = true;
+			pm8921_bms_charging_end(1);
+			htc_gauge_event_notify(HTC_GAUGE_EVENT_EOC);
+		}
+	}
+
+	if (is_batt_full) {
+		soc = get_prop_batt_capacity(chip);
+		if (soc < CLEAR_FULL_STATE_BY_LEVEL_THR) {
+			is_batt_full = false;
+			eoc_count = 0;
+			pr_info("%s: Clear is_batt_full & eoc_count due to"
+						" Overloading happened, soc=%d\n",
+						__func__, soc);
+			htc_gauge_event_notify(HTC_GAUGE_EVENT_EOC);
+		}
+	}
+
+	pr_debug("EOC count = %d\n", eoc_count);
+	schedule_delayed_work(&chip->eoc_work,
+		      round_jiffies_relative(msecs_to_jiffies
+					     (EOC_CHECK_PERIOD_MS)));
+
+}
+
+static void btm_configure_work(struct work_struct *work)
+{
+	int rc;
+
+	rc = pm8xxx_adc_btm_configure(&btm_config);
+	if (rc)
+		pr_err("failed to configure btm rc=%d", rc);
+}
+
+DECLARE_WORK(btm_config_work, btm_configure_work);
+
+static DEFINE_SPINLOCK(set_current_lock);
+static void set_appropriate_battery_current(struct pm8921_chg_chip *chip)
+{
+	unsigned int chg_current = chip->max_bat_chg_current;
+	unsigned long flags;
+
+	spin_lock_irqsave(&set_current_lock, flags);
+	if (chip->is_bat_cool)
+		chg_current = min(chg_current, chip->cool_bat_chg_current);
+
+	if (chip->is_bat_warm)
+		chg_current = min(chg_current, chip->warm_bat_chg_current);
+
+	if (thermal_mitigation != 0 && chip->thermal_mitigation)
+		chg_current = min(chg_current,
+				chip->thermal_mitigation[thermal_mitigation]);
+
+	if (chg_limit_current != 0)
+		chg_current = min(chg_current, chg_limit_current);
+
+	pm_chg_ibatmax_set(the_chip, chg_current);
+	spin_unlock_irqrestore(&set_current_lock, flags);
+}
+
+int pm8921_limit_charge_enable(bool enable)
+{
+	pr_info("limit_charge=%d\n", enable);
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	if (enable)
+		chg_limit_current = PM8921_CHG_I_MIN_MA;
+	else
+		chg_limit_current = 0;
+
+	set_appropriate_battery_current(the_chip);
+	return 0;
+}
+
+#define TEMP_HYSTERISIS_DECIDEGC 20
+static void battery_cool(bool enter)
+{
+	pr_info("%s:enter=%d\n", __func__, enter);
+	if (enter == the_chip->is_bat_cool)
+		return;
+	the_chip->is_bat_cool = enter;
+	if (enter) {
+		btm_config.low_thr_temp =
+			the_chip->cool_temp_dc + TEMP_HYSTERISIS_DECIDEGC;
+		set_appropriate_battery_current(the_chip);
+		pm_chg_vddmax_set(the_chip, the_chip->cool_bat_voltage);
+		pm_chg_vbatdet_set(the_chip,
+			the_chip->cool_bat_voltage
+			- the_chip->resume_voltage_delta);
+		htc_gauge_event_notify(HTC_GAUGE_EVENT_TEMP_ZONE_CHANGE);
+	} else {
+		btm_config.low_thr_temp = the_chip->cool_temp_dc;
+		set_appropriate_battery_current(the_chip);
+		pm_chg_vddmax_set(the_chip, the_chip->max_voltage_mv);
+		pm_chg_vbatdet_set(the_chip, PM8921_CHG_VBATDET_MAX);
+		htc_gauge_event_notify(HTC_GAUGE_EVENT_TEMP_ZONE_CHANGE);
+	}
+
+	
+	if(the_chip->ext_usb)
+	{
+		queue_delayed_work(ext_charger_wq, &ext_charger_temp_task, HZ/200);
+	}
+
+	schedule_work(&btm_config_work);
+}
+
+static void battery_warm(bool enter)
+{
+	pr_info("%s:enter=%d\n", __func__, enter);
+	if (enter == the_chip->is_bat_warm)
+		return;
+	the_chip->is_bat_warm = enter;
+	if (enter) {
+		btm_config.high_thr_temp =
+			the_chip->warm_temp_dc - TEMP_HYSTERISIS_DECIDEGC;
+		set_appropriate_battery_current(the_chip);
+		pm_chg_vddmax_set(the_chip, the_chip->warm_bat_voltage);
+		pm_chg_vbatdet_set(the_chip,
+			the_chip->warm_bat_voltage
+			- the_chip->resume_voltage_delta);
+		htc_gauge_event_notify(HTC_GAUGE_EVENT_TEMP_ZONE_CHANGE);
+	} else {
+		btm_config.high_thr_temp = the_chip->warm_temp_dc;
+		set_appropriate_battery_current(the_chip);
+		pm_chg_vddmax_set(the_chip, the_chip->max_voltage_mv);
+		pm_chg_vbatdet_set(the_chip, PM8921_CHG_VBATDET_MAX);
+		htc_gauge_event_notify(HTC_GAUGE_EVENT_TEMP_ZONE_CHANGE);
+	}
+
+	
+	if(the_chip->ext_usb)
+	{
+		queue_delayed_work(ext_charger_wq, &ext_charger_temp_task, HZ/200);
+	}
+
+	schedule_work(&btm_config_work);
+}
+
+static int configure_btm(struct pm8921_chg_chip *chip)
+{
+	int rc;
+
+	if (chip->warm_temp_dc != INT_MIN)
+		btm_config.btm_warm_fn = battery_warm;
+	else
+		btm_config.btm_warm_fn = NULL;
+
+	if (chip->cool_temp_dc != INT_MIN)
+		btm_config.btm_cool_fn = battery_cool;
+	else
+		btm_config.btm_cool_fn = NULL;
+
+	btm_config.low_thr_temp = chip->cool_temp_dc;
+	btm_config.high_thr_temp = chip->warm_temp_dc;
+	btm_config.interval = chip->temp_check_period;
+	rc = pm8xxx_adc_btm_configure(&btm_config);
+	if (rc)
+		pr_err("failed to configure btm rc = %d\n", rc);
+	rc = pm8xxx_adc_btm_start();
+	if (rc)
+		pr_err("failed to start btm rc = %d\n", rc);
+
+	return rc;
+}
+
+int register_external_dc_charger(struct ext_chg_pm8921 *ext)
+{
+	if (the_chip == NULL) {
+		pr_err("called too early\n");
+		return -EINVAL;
+	}
+	
+	the_chip->ext = ext;
+	the_chip->ext_charging = false;
+
+	if (is_dc_chg_plugged_in(the_chip))
+		pm8921_disable_source_current(true); 
+
+	handle_start_ext_chg(the_chip);
+
+	return 0;
+}
+EXPORT_SYMBOL(register_external_dc_charger);
+
+void unregister_external_dc_charger(struct ext_chg_pm8921 *ext)
+{
+	if (the_chip == NULL) {
+		pr_err("called too early\n");
+		return;
+	}
+	handle_stop_ext_chg(the_chip);
+	the_chip->ext = NULL;
+}
+EXPORT_SYMBOL(unregister_external_dc_charger);
+
+static int set_usb_ovp_disable_param(const char *val, struct kernel_param *kp)
+{
+	int ret;
+
+	ret = param_set_int(val, kp);
+	if (ret) {
+		pr_err("set_usb_ovp_disable_param: error setting value %d\n", ret);
+		return ret;
+	}
+	pr_info("set_usb_ovp_disable_param: usb_ovp_disable=%d\n", usb_ovp_disable);
+	pm8921_usb_ovp_disable(usb_ovp_disable);
+	return 0;
+}
+module_param_call(ovp_disable, set_usb_ovp_disable_param, param_get_uint,
+					&usb_ovp_disable, 0644);
+
+static int set_disable_status_param(const char *val, struct kernel_param *kp)
+{
+	int ret;
+	struct pm8921_chg_chip *chip = the_chip;
+
+	ret = param_set_int(val, kp);
+	if (ret) {
+		pr_err("error setting value %d\n", ret);
+		return ret;
+	}
+	pr_info("factory set disable param to %d\n", charging_disabled);
+	if (chip) {
+		pm_chg_disable_auto_enable(chip, charging_disabled, BATT_CHG_DISABLED_BIT_USR1);
+		pm_chg_disable_pwrsrc(chip, charging_disabled, PWRSRC_DISABLED_BIT_USER);
+	}
+	return 0;
+}
+module_param_call(disabled, set_disable_status_param, param_get_uint,
+					&charging_disabled, 0644);
+
+static int set_auto_enable_param(const char *val, struct kernel_param *kp)
+{
+	int ret;
+	struct pm8921_chg_chip *chip = the_chip;
+
+	ret = param_set_int(val, kp);
+	if (ret) {
+		pr_err("error setting value %d\n", ret);
+		return ret;
+	}
+	pr_info("factory set auto enable param to %d\n", auto_enable);
+	if (chip)
+		pm_chg_disable_auto_enable(chip, !auto_enable, BATT_CHG_DISABLED_BIT_USR2);
+
+	return 0;
+}
+module_param_call(auto_enable, set_auto_enable_param, param_get_uint,
+					&auto_enable, 0644);
+
+static int set_therm_mitigation_level(const char *val, struct kernel_param *kp)
+{
+	int ret;
+	struct pm8921_chg_chip *chip = the_chip;
+
+	ret = param_set_int(val, kp);
+	if (ret) {
+		pr_err("error setting value %d\n", ret);
+		return ret;
+	}
+
+	if (!chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+
+	if (!chip->thermal_mitigation) {
+		pr_err("no thermal mitigation\n");
+		return -EINVAL;
+	}
+
+	if (thermal_mitigation < 0
+		|| thermal_mitigation >= chip->thermal_levels) {
+		pr_err("out of bound level selected\n");
+		return -EINVAL;
+	}
+
+	pr_info("set mitigation level(%d) current=%d\n",
+			thermal_mitigation, chip->thermal_mitigation[thermal_mitigation]);
+	set_appropriate_battery_current(chip);
+	return ret;
+}
+module_param_call(thermal_mitigation, set_therm_mitigation_level,
+					param_get_uint,
+					&thermal_mitigation, 0644);
+
+static int set_usb_max_current(const char *val, struct kernel_param *kp)
+{
+	int ret, mA;
+	struct pm8921_chg_chip *chip = the_chip;
+
+	ret = param_set_int(val, kp);
+	if (ret) {
+		pr_err("error setting value %d\n", ret);
+		return ret;
+	}
+	if (chip) {
+		pr_warn("setting current max to %d\n", usb_max_current);
+		pm_chg_iusbmax_get(chip, &mA);
+		if (mA > usb_max_current)
+			pm8921_charger_vbus_draw(usb_max_current);
+		return 0;
+	}
+	return -EINVAL;
+}
+module_param_call(usb_max_current, set_usb_max_current, param_get_uint,
+					&usb_max_current, 0644);
+
+static void free_irqs(struct pm8921_chg_chip *chip)
+{
+	int i;
+
+	for (i = 0; i < PM_CHG_MAX_INTS; i++)
+		if (chip->pmic_chg_irq[i]) {
+			free_irq(chip->pmic_chg_irq[i], chip);
+			chip->pmic_chg_irq[i] = 0;
+		}
+}
+
+static void __devinit determine_initial_state(struct pm8921_chg_chip *chip)
+{
+	unsigned long flags;
+	int fsm_state;
+	int usb_present;
+
+	chip->dc_present = !!is_dc_chg_plugged_in(chip);
+	usb_present = !!is_usb_chg_plugged_in(chip);
+	usbin_ov_irq_state = pm_chg_get_rt_status(the_chip, USBIN_OV_IRQ);
+	usbin_uv_irq_state = pm_chg_get_rt_status(the_chip, USBIN_UV_IRQ);
+	if ( usbin_ov_irq_state && !usb_present && !usbin_uv_irq_state) {
+		if (!ovp) {
+			ovp = 1;
+			pr_info("init OVP: 0 -> 1\n");
+		}
+	} else if ( !usbin_ov_irq_state && !usb_present && usbin_uv_irq_state) {
+		if (!uvp) {
+			uvp = 1;
+			pr_info("init UVP: 0 -> 1\n");
+		}
+	}
+	bat_temp_ok_prev = pm_chg_get_rt_status(chip, BAT_TEMP_OK_IRQ);
+
+	pm8921_chg_enable_irq(chip, DCIN_VALID_IRQ);
+	pm8921_chg_enable_irq(chip, USBIN_VALID_IRQ);
+	pm8921_chg_enable_irq(chip, BATT_REMOVED_IRQ);
+	pm8921_chg_enable_irq(chip, BATT_INSERTED_IRQ);
+	
+	
+	pm8921_chg_enable_irq(chip, DCIN_OV_IRQ);
+	pm8921_chg_enable_irq(chip, DCIN_UV_IRQ);
+	pm8921_chg_enable_irq(chip, CHGFAIL_IRQ);
+	pm8921_chg_enable_irq(chip, FASTCHG_IRQ);
+	pm8921_chg_enable_irq(chip, VBATDET_LOW_IRQ);
+	pm8921_chg_enable_irq(chip, BATTTEMP_HOT_IRQ);
+	pm8921_chg_enable_irq(chip, BATTTEMP_COLD_IRQ);
+	pm8921_chg_enable_irq(chip, BAT_TEMP_OK_IRQ);
+
+	spin_lock_irqsave(&vbus_lock, flags);
+	
+	cable_detection_vbus_irq_handler();
+	fastchg_irq_handler(chip->pmic_chg_irq[FASTCHG_IRQ], chip);
+#if 0
+	if (usb_chg_current) {
+		
+		handle_usb_insertion_removal(chip);
+		fastchg_irq_handler(chip->pmic_chg_irq[FASTCHG_IRQ], chip);
+	}
+#endif
+	spin_unlock_irqrestore(&vbus_lock, flags);
+
+	fsm_state = pm_chg_get_fsm_state(chip);
+	if (is_battery_charging(fsm_state)) {
+		chip->bms_notify.is_charging = 1;
+		pm8921_bms_charging_began();
+	}
+
+	check_battery_valid(chip);
+
+	pr_debug("usb = %d, dc = %d  batt = %d state=%d\n",
+			usb_present,
+			chip->dc_present,
+			get_prop_batt_present(chip),
+			fsm_state);
+}
+
+struct pm_chg_irq_init_data {
+	unsigned int	irq_id;
+	char		*name;
+	unsigned long	flags;
+	irqreturn_t	(*handler)(int, void *);
+};
+
+#define CHG_IRQ(_id, _flags, _handler) \
+{ \
+	.irq_id		= _id, \
+	.name		= #_id, \
+	.flags		= _flags, \
+	.handler	= _handler, \
+}
+struct pm_chg_irq_init_data chg_irq_data[] = {
+	CHG_IRQ(USBIN_VALID_IRQ, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+						usbin_valid_irq_handler),
+	CHG_IRQ(USBIN_OV_IRQ, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+						usbin_ov_irq_handler),
+	CHG_IRQ(BATT_INSERTED_IRQ, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+						batt_inserted_irq_handler),
+	CHG_IRQ(VBATDET_LOW_IRQ, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+						vbatdet_low_irq_handler),
+	CHG_IRQ(USBIN_UV_IRQ, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+						usbin_uv_irq_handler),
+	CHG_IRQ(VBAT_OV_IRQ, IRQF_TRIGGER_RISING, vbat_ov_irq_handler),
+	CHG_IRQ(CHGWDOG_IRQ, IRQF_TRIGGER_RISING, chgwdog_irq_handler),
+	CHG_IRQ(VCP_IRQ, IRQF_TRIGGER_RISING, vcp_irq_handler),
+	CHG_IRQ(ATCDONE_IRQ, IRQF_TRIGGER_RISING, atcdone_irq_handler),
+	CHG_IRQ(ATCFAIL_IRQ, IRQF_TRIGGER_RISING, atcfail_irq_handler),
+	CHG_IRQ(CHGDONE_IRQ, IRQF_TRIGGER_RISING, chgdone_irq_handler),
+	CHG_IRQ(CHGFAIL_IRQ, IRQF_TRIGGER_RISING, chgfail_irq_handler),
+	CHG_IRQ(CHGSTATE_IRQ, IRQF_TRIGGER_RISING, chgstate_irq_handler),
+	CHG_IRQ(LOOP_CHANGE_IRQ, IRQF_TRIGGER_RISING, loop_change_irq_handler),
+	CHG_IRQ(FASTCHG_IRQ, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+						fastchg_irq_handler),
+	CHG_IRQ(TRKLCHG_IRQ, IRQF_TRIGGER_RISING, trklchg_irq_handler),
+	CHG_IRQ(BATT_REMOVED_IRQ, IRQF_TRIGGER_RISING,
+						batt_removed_irq_handler),
+	CHG_IRQ(BATTTEMP_HOT_IRQ, IRQF_TRIGGER_RISING,
+						batttemp_hot_irq_handler),
+	CHG_IRQ(CHGHOT_IRQ, IRQF_TRIGGER_RISING, chghot_irq_handler),
+	CHG_IRQ(BATTTEMP_COLD_IRQ, IRQF_TRIGGER_RISING,
+						batttemp_cold_irq_handler),
+	CHG_IRQ(CHG_GONE_IRQ, IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING , chg_gone_irq_handler),
+	CHG_IRQ(BAT_TEMP_OK_IRQ, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+						bat_temp_ok_irq_handler),
+	CHG_IRQ(COARSE_DET_LOW_IRQ, IRQF_TRIGGER_RISING,
+						coarse_det_low_irq_handler),
+	CHG_IRQ(VDD_LOOP_IRQ, IRQF_TRIGGER_RISING, vdd_loop_irq_handler),
+	CHG_IRQ(VREG_OV_IRQ, IRQF_TRIGGER_RISING, vreg_ov_irq_handler),
+	CHG_IRQ(VBATDET_IRQ, IRQF_TRIGGER_RISING, vbatdet_irq_handler),
+	CHG_IRQ(BATFET_IRQ, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+						batfet_irq_handler),
+	CHG_IRQ(DCIN_VALID_IRQ, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+						dcin_valid_irq_handler),
+	CHG_IRQ(DCIN_OV_IRQ, IRQF_TRIGGER_RISING, dcin_ov_irq_handler),
+	CHG_IRQ(DCIN_UV_IRQ, IRQF_TRIGGER_RISING, dcin_uv_irq_handler),
+};
+
+static int __devinit request_irqs(struct pm8921_chg_chip *chip,
+					struct platform_device *pdev)
+{
+	struct resource *res;
+	int ret, i;
+
+	ret = 0;
+	bitmap_fill(chip->enabled_irqs, PM_CHG_MAX_INTS);
+
+	for (i = 0; i < ARRAY_SIZE(chg_irq_data); i++) {
+		res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
+				chg_irq_data[i].name);
+		if (res == NULL) {
+			pr_err("couldn't find %s\n", chg_irq_data[i].name);
+			goto err_out;
+		}
+		chip->pmic_chg_irq[chg_irq_data[i].irq_id] = res->start;
+		ret = request_irq(res->start, chg_irq_data[i].handler,
+			chg_irq_data[i].flags,
+			chg_irq_data[i].name, chip);
+		if (ret < 0) {
+			pr_err("couldn't request %d (%s) %d\n", res->start,
+					chg_irq_data[i].name, ret);
+			chip->pmic_chg_irq[chg_irq_data[i].irq_id] = 0;
+			goto err_out;
+		}
+		pm8921_chg_disable_irq(chip, chg_irq_data[i].irq_id);
+	}
+	return 0;
+
+err_out:
+	free_irqs(chip);
+	return -EINVAL;
+}
+
+static void pm8921_chg_force_19p2mhz_clk(struct pm8921_chg_chip *chip)
+{
+	int err;
+	u8 temp;
+
+	temp  = 0xD1;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return;
+	}
+
+	temp  = 0xD3;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return;
+	}
+
+	temp  = 0xD1;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return;
+	}
+
+	temp  = 0xD5;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return;
+	}
+
+	udelay(183);
+
+	temp  = 0xD1;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return;
+	}
+
+	temp  = 0xD0;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return;
+	}
+	udelay(32);
+
+	temp  = 0xD1;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return;
+	}
+
+	temp  = 0xD3;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return;
+	}
+}
+
+static void pm8921_chg_set_hw_clk_switching(struct pm8921_chg_chip *chip)
+{
+	int err;
+	u8 temp;
+
+	temp  = 0xD1;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return;
+	}
+
+	temp  = 0xD0;
+	err = pm8xxx_writeb(chip->dev->parent, CHG_TEST, temp);
+	if (err) {
+		pr_err("Error %d writing %d to addr %d\n", err, temp, CHG_TEST);
+		return;
+	}
+}
+
+#define ENUM_TIMER_STOP_BIT	BIT(1)
+#define BOOT_DONE_BIT		BIT(6)
+#define CHG_BATFET_ON_BIT	BIT(3)
+#define CHG_VCP_EN		BIT(0)
+#define CHG_BAT_TEMP_DIS_BIT	BIT(2)
+#define SAFE_CURRENT_MA		1500
+#define VREF_BATT_THERM_FORCE_ON	BIT(7)
+static int __devinit pm8921_chg_hw_init(struct pm8921_chg_chip *chip)
+{
+	int rc;
+	unsigned long flags;
+
+	
+	pm8921_chg_force_19p2mhz_clk(chip);
+
+	rc = pm_chg_masked_write(chip, SYS_CONFIG_2,
+					BOOT_DONE_BIT, BOOT_DONE_BIT);
+	if (rc) {
+		pr_err("Failed to set BOOT_DONE_BIT rc=%d\n", rc);
+		return rc;
+	}
+
+	rc = pm_chg_vddsafe_set(chip, chip->max_voltage_mv);
+	if (rc) {
+		pr_err("Failed to set safe voltage to %d rc=%d\n",
+						chip->max_voltage_mv, rc);
+		return rc;
+	}
+
+	pr_info("Init: Set vbatdet=%d\n", PM8921_CHG_VBATDET_MAX);
+	rc = pm_chg_vbatdet_set(chip, PM8921_CHG_VBATDET_MAX);
+	if (rc) {
+		pr_err("Failed to set vbatdet comprator voltage to %d rc=%d\n",
+			chip->max_voltage_mv, rc);
+		return rc;
+	}
+
+	rc = pm_chg_vddmax_set(chip, chip->max_voltage_mv);
+	if (rc) {
+		pr_err("Failed to set max voltage to %d rc=%d\n",
+						chip->max_voltage_mv, rc);
+		return rc;
+	}
+	rc = pm_chg_ibatsafe_set(chip, SAFE_CURRENT_MA);
+	if (rc) {
+		pr_err("Failed to set max voltage to %d rc=%d\n",
+						SAFE_CURRENT_MA, rc);
+		return rc;
+	}
+
+	rc = pm_chg_ibatmax_set(chip, chip->max_bat_chg_current);
+	if (rc) {
+		pr_err("Failed to set max current to 400 rc=%d\n", rc);
+		return rc;
+	}
+
+	rc = pm_chg_iterm_set(chip, chip->term_current);
+	if (rc) {
+		pr_err("Failed to set term current to %d rc=%d\n",
+						chip->term_current, rc);
+		return rc;
+	}
+
+	
+	rc = pm_chg_masked_write(chip, PBL_ACCESS2, ENUM_TIMER_STOP_BIT,
+			ENUM_TIMER_STOP_BIT);
+	if (rc) {
+		pr_err("Failed to set enum timer stop rc=%d\n", rc);
+		return rc;
+	}
+
+	if (chip->safety_time != 0) {
+		if (chip->safety_time > SAFETY_TIME_MAX_LIMIT) {
+			rc = pm_chg_tchg_max_set(chip, SAFETY_TIME_8HR_TWICE);
+		} else {
+			rc = pm_chg_tchg_max_set(chip, chip->safety_time);
+		}
+		if (rc) {
+			pr_err("Failed to set max time to %d minutes rc=%d\n",
+							chip->safety_time, rc);
+			return rc;
+		}
+	}
+
+	if (chip->ttrkl_time != 0) {
+		rc = pm_chg_ttrkl_max_set(chip, chip->ttrkl_time);
+		if (rc) {
+			pr_err("Failed to set trkl time to %d minutes rc=%d\n",
+							chip->ttrkl_time, rc);
+			return rc;
+		}
+	}
+
+	if (chip->vin_min != 0) {
+		rc = pm_chg_vinmin_set(chip, chip->vin_min);
+		if (rc) {
+			pr_err("Failed to set vin min to %d mV rc=%d\n",
+							chip->vin_min, rc);
+			return rc;
+		}
+	} else
+		chip->vin_min = pm_chg_vinmin_get(chip);
+
+	rc = pm_chg_disable_wd(chip);
+	if (rc) {
+		pr_err("Failed to disable wd rc=%d\n", rc);
+		return rc;
+	}
+
+	if (flag_keep_charge_on || flag_pa_recharge)
+		rc = pm_chg_masked_write(chip, CHG_CNTRL_2,
+					CHG_BAT_TEMP_DIS_BIT,
+					CHG_BAT_TEMP_DIS_BIT); 
+	else
+		rc = pm_chg_masked_write(chip, CHG_CNTRL_2,
+					CHG_BAT_TEMP_DIS_BIT, 0); 
+	if (rc) {
+		pr_err("Failed to enable/disable temp control chg rc=%d\n", rc);
+		return rc;
+	}
+
+	
+	rc = pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CLOCK_CTRL, 0x15);
+	if (rc) {
+		pr_err("Failed to switch buck clk rc=%d\n", rc);
+		return rc;
+	}
+
+	if (chip->trkl_voltage != 0) {
+		rc = pm_chg_vtrkl_low_set(chip, chip->trkl_voltage);
+		if (rc) {
+			pr_err("Failed to set trkl voltage to %dmv  rc=%d\n",
+							chip->trkl_voltage, rc);
+			return rc;
+		}
+	}
+
+	if (chip->weak_voltage != 0) {
+		rc = pm_chg_vweak_set(chip, chip->weak_voltage);
+		if (rc) {
+			pr_err("Failed to set weak voltage to %dmv  rc=%d\n",
+							chip->weak_voltage, rc);
+			return rc;
+		}
+	}
+
+	if (chip->trkl_current != 0) {
+		rc = pm_chg_itrkl_set(chip, chip->trkl_current);
+		if (rc) {
+			pr_err("Failed to set trkl current to %dmA  rc=%d\n",
+							chip->trkl_voltage, rc);
+			return rc;
+		}
+	}
+
+	if (chip->weak_current != 0) {
+		rc = pm_chg_iweak_set(chip, chip->weak_current);
+		if (rc) {
+			pr_err("Failed to set weak current to %dmA  rc=%d\n",
+							chip->weak_current, rc);
+			return rc;
+		}
+	}
+
+	rc = pm_chg_batt_cold_temp_config(chip, chip->cold_thr);
+	if (rc) {
+		pr_err("Failed to set cold config %d  rc=%d\n",
+						chip->cold_thr, rc);
+	}
+
+	rc = pm_chg_batt_hot_temp_config(chip, chip->hot_thr);
+	if (rc) {
+		pr_err("Failed to set hot config %d  rc=%d\n",
+						chip->hot_thr, rc);
+	}
+
+	
+	if (pm8xxx_get_revision(chip->dev->parent) < PM8XXX_REVISION_8921_2p0) {
+		pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CTRL_TEST2, 0xF1);
+		pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, 0xCE);
+		pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, 0xD8);
+
+		
+		pm8xxx_writeb(chip->dev->parent, PSI_TXRX_SAMPLE_DATA_0, 0xFF);
+		pm8xxx_writeb(chip->dev->parent, PSI_TXRX_SAMPLE_DATA_1, 0xFF);
+		pm8xxx_writeb(chip->dev->parent, PSI_TXRX_SAMPLE_DATA_2, 0xFF);
+		pm8xxx_writeb(chip->dev->parent, PSI_TXRX_SAMPLE_DATA_3, 0xFF);
+		pm8xxx_writeb(chip->dev->parent, PSI_CONFIG_STATUS, 0x0D);
+		udelay(100);
+		pm8xxx_writeb(chip->dev->parent, PSI_CONFIG_STATUS, 0x0C);
+	}
+
+	
+	if (pm8xxx_get_revision(chip->dev->parent) == PM8XXX_REVISION_8921_3p0)
+		pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, 0xAC);
+
+	pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, 0xD9);
+
+	
+	pm8xxx_writeb(chip->dev->parent, CHG_BUCK_CTRL_TEST3, 0x91);
+
+	rc = pm_chg_masked_write(chip, CHG_CNTRL, VREF_BATT_THERM_FORCE_ON,
+						VREF_BATT_THERM_FORCE_ON);
+	if (rc)
+		pr_err("Failed to Force Vref therm rc=%d\n", rc);
+
+	spin_lock_irqsave(&pwrsrc_lock, flags);
+	rc = pm_chg_charge_dis(chip, charging_disabled);
+	spin_unlock_irqrestore(&pwrsrc_lock, flags);
+	if (rc) {
+		pr_err("Failed to disable CHG_CHARGE_DIS bit rc=%d\n", rc);
+		return rc;
+	}
+
+	spin_lock_irqsave(&charger_lock, flags);
+	rc = pm_chg_auto_enable(chip, !batt_charging_disabled);
+	spin_unlock_irqrestore(&charger_lock, flags);
+	if (rc) {
+		pr_err("Failed to enable charging rc=%d\n", rc);
+		return rc;
+	}
+
+	return 0;
+}
+
+static int get_rt_status(void *data, u64 *val)
+{
+	int i = (int)data;
+	int ret;
+
+	
+	ret = pm_chg_get_rt_status(the_chip, i);
+	*val = ret;
+	return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(rt_fops, get_rt_status, NULL, "%llu\n");
+
+static int get_fsm_status(void *data, u64 *val)
+{
+	u8 temp;
+
+	temp = pm_chg_get_fsm_state(the_chip);
+	*val = temp;
+	return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(fsm_fops, get_fsm_status, NULL, "%llu\n");
+
+static int get_reg_loop(void *data, u64 *val)
+{
+	u8 temp;
+
+	if (!the_chip) {
+		pr_err("%s called before init\n", __func__);
+		return -EINVAL;
+	}
+	temp = pm_chg_get_regulation_loop(the_chip);
+	*val = temp;
+	return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(reg_loop_fops, get_reg_loop, NULL, "0x%02llx\n");
+
+static int get_reg(void *data, u64 *val)
+{
+	int addr = (int)data;
+	int ret;
+	u8 temp;
+
+	ret = pm8xxx_readb(the_chip->dev->parent, addr, &temp);
+	if (ret) {
+		pr_err("pm8xxx_readb to %x value =%d errored = %d\n",
+			addr, temp, ret);
+		return -EAGAIN;
+	}
+	*val = temp;
+	return 0;
+}
+
+static int set_reg(void *data, u64 val)
+{
+	int addr = (int)data;
+	int ret;
+	u8 temp;
+
+	temp = (u8) val;
+	ret = pm8xxx_writeb(the_chip->dev->parent, addr, temp);
+	if (ret) {
+		pr_err("pm8xxx_writeb to %x value =%d errored = %d\n",
+			addr, temp, ret);
+		return -EAGAIN;
+	}
+	return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(reg_fops, get_reg, set_reg, "0x%02llx\n");
+
+enum {
+	BAT_WARM_ZONE,
+	BAT_COOL_ZONE,
+};
+static int get_warm_cool(void *data, u64 * val)
+{
+	if (!the_chip) {
+		pr_err("%s called before init\n", __func__);
+		return -EINVAL;
+	}
+	if ((int)data == BAT_WARM_ZONE)
+		*val = the_chip->is_bat_warm;
+	if ((int)data == BAT_COOL_ZONE)
+		*val = the_chip->is_bat_cool;
+	return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(warm_cool_fops, get_warm_cool, NULL, "0x%lld\n");
+
+static void create_debugfs_entries(struct pm8921_chg_chip *chip)
+{
+	int i;
+
+	chip->dent = debugfs_create_dir("pm8921_chg", NULL);
+
+	if (IS_ERR(chip->dent)) {
+		pr_err("pmic charger couldnt create debugfs dir\n");
+		return;
+	}
+
+	debugfs_create_file("CHG_CNTRL", 0644, chip->dent,
+			    (void *)CHG_CNTRL, &reg_fops);
+	debugfs_create_file("CHG_CNTRL_2", 0644, chip->dent,
+			    (void *)CHG_CNTRL_2, &reg_fops);
+	debugfs_create_file("CHG_CNTRL_3", 0644, chip->dent,
+			    (void *)CHG_CNTRL_3, &reg_fops);
+	debugfs_create_file("PBL_ACCESS1", 0644, chip->dent,
+			    (void *)PBL_ACCESS1, &reg_fops);
+	debugfs_create_file("PBL_ACCESS2", 0644, chip->dent,
+			    (void *)PBL_ACCESS2, &reg_fops);
+	debugfs_create_file("SYS_CONFIG_1", 0644, chip->dent,
+			    (void *)SYS_CONFIG_1, &reg_fops);
+	debugfs_create_file("SYS_CONFIG_2", 0644, chip->dent,
+			    (void *)SYS_CONFIG_2, &reg_fops);
+	debugfs_create_file("CHG_VDD_MAX", 0644, chip->dent,
+			    (void *)CHG_VDD_MAX, &reg_fops);
+	debugfs_create_file("CHG_VDD_SAFE", 0644, chip->dent,
+			    (void *)CHG_VDD_SAFE, &reg_fops);
+	debugfs_create_file("CHG_VBAT_DET", 0644, chip->dent,
+			    (void *)CHG_VBAT_DET, &reg_fops);
+	debugfs_create_file("CHG_IBAT_MAX", 0644, chip->dent,
+			    (void *)CHG_IBAT_MAX, &reg_fops);
+	debugfs_create_file("CHG_IBAT_SAFE", 0644, chip->dent,
+			    (void *)CHG_IBAT_SAFE, &reg_fops);
+	debugfs_create_file("CHG_VIN_MIN", 0644, chip->dent,
+			    (void *)CHG_VIN_MIN, &reg_fops);
+	debugfs_create_file("CHG_VTRICKLE", 0644, chip->dent,
+			    (void *)CHG_VTRICKLE, &reg_fops);
+	debugfs_create_file("CHG_ITRICKLE", 0644, chip->dent,
+			    (void *)CHG_ITRICKLE, &reg_fops);
+	debugfs_create_file("CHG_ITERM", 0644, chip->dent,
+			    (void *)CHG_ITERM, &reg_fops);
+	debugfs_create_file("CHG_TCHG_MAX", 0644, chip->dent,
+			    (void *)CHG_TCHG_MAX, &reg_fops);
+	debugfs_create_file("CHG_TWDOG", 0644, chip->dent,
+			    (void *)CHG_TWDOG, &reg_fops);
+	debugfs_create_file("CHG_TEMP_THRESH", 0644, chip->dent,
+			    (void *)CHG_TEMP_THRESH, &reg_fops);
+	debugfs_create_file("CHG_COMP_OVR", 0644, chip->dent,
+			    (void *)CHG_COMP_OVR, &reg_fops);
+	debugfs_create_file("CHG_BUCK_CTRL_TEST1", 0644, chip->dent,
+			    (void *)CHG_BUCK_CTRL_TEST1, &reg_fops);
+	debugfs_create_file("CHG_BUCK_CTRL_TEST2", 0644, chip->dent,
+			    (void *)CHG_BUCK_CTRL_TEST2, &reg_fops);
+	debugfs_create_file("CHG_BUCK_CTRL_TEST3", 0644, chip->dent,
+			    (void *)CHG_BUCK_CTRL_TEST3, &reg_fops);
+	debugfs_create_file("CHG_TEST", 0644, chip->dent,
+			    (void *)CHG_TEST, &reg_fops);
+	debugfs_create_file("USB_OVP_CONTROL", 0644, chip->dent,
+			    (void *)USB_OVP_CONTROL, &reg_fops);
+
+	debugfs_create_file("FSM_STATE", 0644, chip->dent, NULL,
+			    &fsm_fops);
+
+	debugfs_create_file("REGULATION_LOOP_CONTROL", 0644, chip->dent, NULL,
+			    &reg_loop_fops);
+
+	debugfs_create_file("BAT_WARM_ZONE", 0644, chip->dent,
+				(void *)BAT_WARM_ZONE, &warm_cool_fops);
+	debugfs_create_file("BAT_COOL_ZONE", 0644, chip->dent,
+				(void *)BAT_COOL_ZONE, &warm_cool_fops);
+
+	for (i = 0; i < ARRAY_SIZE(chg_irq_data); i++) {
+		if (chip->pmic_chg_irq[chg_irq_data[i].irq_id])
+			debugfs_create_file(chg_irq_data[i].name, 0444,
+				chip->dent,
+				(void *)chg_irq_data[i].irq_id,
+				&rt_fops);
+	}
+}
+
+static void pm_chg_reset_warm_cool_state(struct pm8921_chg_chip *chip)
+{
+	pr_debug("chip->is_bat_warm=%d, chip->is_bat_cool=%d\n",
+						chip->is_bat_warm, chip->is_bat_cool);
+
+	if (chip->is_bat_cool)
+			battery_cool(0);
+	if (chip->is_bat_warm)
+			battery_warm(0);
+}
+
+static int pm8921_charger_suspend_noirq(struct device *dev)
+{
+	int rc;
+	struct pm8921_chg_chip *chip = dev_get_drvdata(dev);
+
+	rc = pm_chg_masked_write(chip, CHG_CNTRL, VREF_BATT_THERM_FORCE_ON, 0);
+	if (rc)
+		pr_err("Failed to Force Vref therm off rc=%d\n", rc);
+	pm8921_chg_set_hw_clk_switching(chip);
+	return 0;
+}
+
+static int pm8921_charger_resume_noirq(struct device *dev)
+{
+	int rc;
+	struct pm8921_chg_chip *chip = dev_get_drvdata(dev);
+
+	pm8921_chg_force_19p2mhz_clk(chip);
+
+	rc = pm_chg_masked_write(chip, CHG_CNTRL, VREF_BATT_THERM_FORCE_ON,
+						VREF_BATT_THERM_FORCE_ON);
+	if (rc)
+		pr_err("Failed to Force Vref therm on rc=%d\n", rc);
+	return 0;
+}
+
+static int pm8921_charger_resume(struct device *dev)
+{
+	int rc;
+	struct pm8921_chg_chip *chip = dev_get_drvdata(dev);
+
+	if (!(chip->cool_temp_dc == INT_MIN && chip->warm_temp_dc == INT_MIN)
+		&& !(chip->keep_btm_on_suspend)) {
+		rc = pm8xxx_adc_btm_configure(&btm_config);
+		if (rc)
+			pr_err("couldn't reconfigure btm rc=%d\n", rc);
+
+		pm_chg_reset_warm_cool_state(chip);
+
+		rc = pm8xxx_adc_btm_start();
+		if (rc)
+			pr_err("couldn't restart btm rc=%d\n", rc);
+	}
+	if (pm8921_chg_is_enabled(chip, LOOP_CHANGE_IRQ)) {
+		disable_irq_wake(chip->pmic_chg_irq[LOOP_CHANGE_IRQ]);
+		pm8921_chg_disable_irq(chip, LOOP_CHANGE_IRQ);
+	}
+	return 0;
+}
+
+static int pm8921_charger_suspend(struct device *dev)
+{
+	int rc;
+	struct pm8921_chg_chip *chip = dev_get_drvdata(dev);
+
+	if (!(chip->cool_temp_dc == INT_MIN && chip->warm_temp_dc == INT_MIN)
+		&& !(chip->keep_btm_on_suspend)) {
+		rc = pm8xxx_adc_btm_end();
+		if (rc)
+			pr_err("Failed to disable BTM on suspend rc=%d\n", rc);
+	}
+	if (is_usb_chg_plugged_in(chip)) {
+		pm8921_chg_enable_irq(chip, LOOP_CHANGE_IRQ);
+		enable_irq_wake(chip->pmic_chg_irq[LOOP_CHANGE_IRQ]);
+	}
+	return 0;
+}
+
+static const struct dev_pm_ops pm8921_charger_pm_ops = {
+	.suspend	= pm8921_charger_suspend,
+	.suspend_noirq  = pm8921_charger_suspend_noirq,
+	.resume_noirq   = pm8921_charger_resume_noirq,
+	.resume		= pm8921_charger_resume,
+};
+
+static void ext_charger_vbat_low_handler(struct work_struct *w)
+{
+	int result;
+
+	pm8921_get_batt_voltage(&result);
+
+	pr_info("%s, vol:%d\n", __func__, result);
+
+	
+
+	if(!(the_chip->ext_usb->ichg->event_notify))
+	{
+		pr_err("%s event_notify api error!\n", __func__);
+		return;
+	}
+
+	the_chip->ext_usb->ichg->event_notify(HTC_EXTCHG_EVENT_TYPE_EOC_START_CHARGE);
+
+	
+	if (!flag_disable_wakelock)
+		wake_lock(&the_chip->eoc_wake_lock);
+	schedule_delayed_work(&the_chip->eoc_work,
+		round_jiffies_relative(msecs_to_jiffies
+					     (EOC_CHECK_PERIOD_MS)));
+
+	return;
+}
+
+
+static void ext_charger_chgdone_handler(struct work_struct *w)
+{
+	int result;
+
+	pm8921_get_batt_voltage(&result);
+
+	pr_info("%s, vol:%d\n", __func__, result);
+
+	if(!(the_chip->ext_usb->ichg->event_notify))
+	{
+		pr_err("%s event_notify api error!\n", __func__);
+		return;
+	}
+
+	
+	the_chip->ext_usb->ichg->event_notify(HTC_EXTCHG_EVENT_TYPE_EOC_STOP_CHARGE);
+
+	return;
+}
+
+
+static void ext_charger_temp_handler(struct work_struct *w)
+{
+	int new_temp;
+	int hot_irq;
+	int cold_irq;
+
+	cold_irq = pm_chg_get_rt_status(the_chip, BATTTEMP_COLD_IRQ);
+	hot_irq = pm_chg_get_rt_status(the_chip, BATTTEMP_HOT_IRQ);
+
+	pr_info("%s, cold_irq:%d, hot_irq:%d, is_bat_warm:%d, is_bat_cool:%d,\n",
+		__func__, cold_irq, hot_irq, the_chip->is_bat_warm, the_chip->is_bat_cool);
+
+
+	if(!(the_chip->ext_usb->ichg->event_notify))
+	{
+		pr_err("%s event_notify api error!\n", __func__);
+		return;
+	}
+
+	
+	if(the_chip->is_bat_warm)
+	{
+		if(hot_irq)
+			new_temp = HTC_EXTCHG_EVENT_TYPE_TEMP_HOT;
+		else
+			new_temp = HTC_EXTCHG_EVENT_TYPE_TEMP_WARM;
+	}
+	else if(the_chip->is_bat_cool)
+	{
+		if(cold_irq)
+			new_temp = HTC_EXTCHG_EVENT_TYPE_TEMP_COLD;
+		else
+			new_temp = HTC_EXTCHG_EVENT_TYPE_TEMP_COOL;
+	}
+	else
+		new_temp = HTC_EXTCHG_EVENT_TYPE_TEMP_NORMAL;
+
+
+	
+	if(extchg_temp_condition_old == new_temp)
+		return;
+
+	
+	the_chip->ext_usb->ichg->event_notify(new_temp);
+
+	extchg_temp_condition_old = new_temp;
+
+}
+
+static int __devinit pm8921_charger_probe(struct platform_device *pdev)
+{
+	int rc = 0;
+	struct pm8921_chg_chip *chip;
+	const struct pm8921_charger_platform_data *pdata
+				= pdev->dev.platform_data;
+	const struct pm8921_charger_batt_param *chg_batt_param;
+
+
+	if (!pdata) {
+		pr_err("missing platform data\n");
+		return -EINVAL;
+	}
+
+	chip = kzalloc(sizeof(struct pm8921_chg_chip),
+					GFP_KERNEL);
+	if (!chip) {
+		pr_err("Cannot allocate pm_chg_chip\n");
+		return -ENOMEM;
+	}
+
+	chip->dev = &pdev->dev;
+	chip->safety_time = pdata->safety_time;
+	chip->ttrkl_time = pdata->ttrkl_time;
+	chip->update_time = pdata->update_time;
+	
+	chg_batt_param = htc_battery_cell_get_cur_cell_charger_cdata();
+	if (!chg_batt_param) {
+		chip->max_voltage_mv = pdata->max_voltage;
+		chip->cool_bat_voltage = pdata->cool_bat_voltage;
+		chip->warm_bat_voltage = pdata->warm_bat_voltage;
+	} else {
+		chip->max_voltage_mv = chg_batt_param->max_voltage;
+		chip->cool_bat_voltage = chg_batt_param->cool_bat_voltage;
+		chip->warm_bat_voltage = chg_batt_param->warm_bat_voltage;
+	}
+	pr_info("%s: max_vbat=%u, cool_vbat=%u, warm_vbat=%u\n",
+			__func__, chip->max_voltage_mv, chip->cool_bat_voltage,
+			chip->warm_bat_voltage);
+	chip->min_voltage_mv = pdata->min_voltage;
+	chip->resume_voltage_delta = pdata->resume_voltage_delta;
+	chip->term_current = pdata->term_current;
+	chip->vbat_channel = pdata->charger_cdata.vbat_channel;
+	chip->batt_temp_channel = pdata->charger_cdata.batt_temp_channel;
+	chip->batt_id_channel = pdata->charger_cdata.batt_id_channel;
+	chip->batt_id_min = pdata->batt_id_min;
+	chip->batt_id_max = pdata->batt_id_max;
+	if (pdata->cool_temp != INT_MIN)
+		chip->cool_temp_dc = pdata->cool_temp * 10;
+	else
+		chip->cool_temp_dc = INT_MIN;
+
+	if (pdata->warm_temp != INT_MIN)
+		chip->warm_temp_dc = pdata->warm_temp * 10;
+	else
+		chip->warm_temp_dc = INT_MIN;
+
+	chip->temp_check_period = pdata->temp_check_period;
+	chip->dc_unplug_check = pdata->dc_unplug_check;
+	chip->max_bat_chg_current = pdata->max_bat_chg_current;
+	chip->cool_bat_chg_current = pdata->cool_bat_chg_current;
+	chip->warm_bat_chg_current = pdata->warm_bat_chg_current;
+	chip->keep_btm_on_suspend = pdata->keep_btm_on_suspend;
+	chip->trkl_voltage = pdata->trkl_voltage;
+	chip->weak_voltage = pdata->weak_voltage;
+	chip->trkl_current = pdata->trkl_current;
+	chip->weak_current = pdata->weak_current;
+	chip->vin_min = pdata->vin_min;
+	chip->thermal_mitigation = pdata->thermal_mitigation;
+	chip->thermal_levels = pdata->thermal_levels;
+	chip->mbat_in_gpio = pdata->mbat_in_gpio;
+	chip->is_embeded_batt = pdata->is_embeded_batt;
+
+	chip->cold_thr = pdata->cold_thr;
+	chip->hot_thr = pdata->hot_thr;
+
+	chip->ext_usb = pdata->ext_usb;
+
+	rc = pm8921_chg_hw_init(chip);
+	if (rc) {
+		pr_err("couldn't init hardware rc=%d\n", rc);
+		goto free_chip;
+	}
+
+	platform_set_drvdata(pdev, chip);
+	the_chip = chip;
+
+	wake_lock_init(&chip->eoc_wake_lock, WAKE_LOCK_SUSPEND, "pm8921_eoc");
+	wake_lock_init(&chip->recharge_check_wake_lock, WAKE_LOCK_SUSPEND,
+												"pm8921_recharge_check");
+	wake_lock_init(&chip->unplug_ovp_fet_open_wake_lock,
+			WAKE_LOCK_SUSPEND, "pm8921_unplug_ovp_fet_open_wake_lock");
+	INIT_DELAYED_WORK(&chip->eoc_work, eoc_worker);
+	INIT_DELAYED_WORK(&chip->recharge_check_work, recharge_check_worker);
+	INIT_DELAYED_WORK(&chip->vin_collapse_check_work,
+						vin_collapse_check_worker);
+	INIT_WORK(&chip->unplug_ovp_fet_open_work,
+					unplug_ovp_fet_open_worker);
+	INIT_DELAYED_WORK(&chip->unplug_check_work, unplug_check_worker);
+
+	INIT_DELAYED_WORK(&ext_charger_vbat_low_task, ext_charger_vbat_low_handler);
+	INIT_DELAYED_WORK(&ext_charger_chgdone_task, ext_charger_chgdone_handler);
+	INIT_DELAYED_WORK(&ext_charger_temp_task, ext_charger_temp_handler);
+
+	ext_charger_wq = create_singlethread_workqueue("ext_charger_wq");
+
+	if (!ext_charger_wq) {
+		pr_err("Failed to create ext_charger_wq workqueue.");
+		goto free_chip;
+	}
+
+	rc = request_irqs(chip, pdev);
+	if (rc) {
+		pr_err("couldn't register interrupts rc=%d\n", rc);
+		goto free_chip;
+	}
+
+	enable_irq_wake(chip->pmic_chg_irq[USBIN_VALID_IRQ]);
+	enable_irq_wake(chip->pmic_chg_irq[DCIN_VALID_IRQ]);
+	enable_irq_wake(chip->pmic_chg_irq[VBATDET_LOW_IRQ]);
+	enable_irq_wake(chip->pmic_chg_irq[FASTCHG_IRQ]);
+	enable_irq_wake(chip->pmic_chg_irq[BATT_REMOVED_IRQ]);
+	if (!(chip->cool_temp_dc == INT_MIN && chip->warm_temp_dc == INT_MIN) &&
+		!flag_keep_charge_on && !flag_pa_recharge) {
+		rc = configure_btm(chip);
+		if (rc) {
+			pr_err("couldn't register with btm rc=%d\n", rc);
+			goto free_irq;
+		}
+	}
+
+	create_debugfs_entries(chip);
+
+	INIT_WORK(&chip->bms_notify.work, bms_notify);
+	INIT_WORK(&chip->battery_id_valid_work, battery_id_valid);
+
+	
+	determine_initial_state(chip);
+
+	if (0) {
+		INIT_DELAYED_WORK(&chip->update_heartbeat_work,
+							update_heartbeat);
+		schedule_delayed_work(&chip->update_heartbeat_work,
+				      round_jiffies_relative(msecs_to_jiffies
+							(chip->update_time)));
+	}
+	htc_charger_event_notify(HTC_CHARGER_EVENT_READY);
+	htc_gauge_event_notify(HTC_GAUGE_EVENT_READY);
+	if (ovp)
+		htc_charger_event_notify(HTC_CHARGER_EVENT_OVP);
+
+	return 0;
+
+free_irq:
+	free_irqs(chip);
+free_chip:
+	kfree(chip);
+	return rc;
+}
+
+static int __devexit pm8921_charger_remove(struct platform_device *pdev)
+{
+	struct pm8921_chg_chip *chip = platform_get_drvdata(pdev);
+
+	free_irqs(chip);
+	platform_set_drvdata(pdev, NULL);
+	the_chip = NULL;
+	kfree(chip);
+	return 0;
+}
+
+static struct platform_driver pm8921_charger_driver = {
+	.probe	= pm8921_charger_probe,
+	.remove	= __devexit_p(pm8921_charger_remove),
+	.driver	= {
+		.name	= PM8921_CHARGER_DEV_NAME,
+		.owner	= THIS_MODULE,
+		.pm = &pm8921_charger_pm_ops,
+	},
+};
+
+static int __init pm8921_charger_init(void)
+{
+	test_power_monitor =
+		(get_kernel_flag() & KERNEL_FLAG_TEST_PWR_SUPPLY) ? 1 : 0;
+	flag_keep_charge_on =
+		(get_kernel_flag() & KERNEL_FLAG_KEEP_CHARG_ON) ? 1 : 0;
+	flag_pa_recharge =
+		(get_kernel_flag() & KERNEL_FLAG_PA_RECHARG_TEST) ? 1 : 0;
+	flag_disable_wakelock =
+		(get_kernel_flag() & KERNEL_FLAG_DISABLE_WAKELOCK) ? 1 : 0;
+	flag_enable_BMS_Charger_log =
+               (get_kernel_flag() & KERNEL_FLAG_ENABLE_BMS_CHARGER_LOG) ? 1 : 0;
+	return platform_driver_register(&pm8921_charger_driver);
+}
+
+static void __exit pm8921_charger_exit(void)
+{
+	platform_driver_unregister(&pm8921_charger_driver);
+}
+
+late_initcall(pm8921_charger_init);
+module_exit(pm8921_charger_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("PMIC8921 charger/battery driver");
+MODULE_VERSION("1.0");
+MODULE_ALIAS("platform:" PM8921_CHARGER_DEV_NAME);
diff --git a/drivers/power/pm8xxx-ccadc.c b/drivers/power/pm8xxx-ccadc.c
index c53bcd2..810ae54 100644
--- a/drivers/power/pm8xxx-ccadc.c
+++ b/drivers/power/pm8xxx-ccadc.c
@@ -688,6 +688,79 @@
 }
 DEFINE_SIMPLE_ATTRIBUTE(calc_fops, get_calc, NULL, "%lld\n");
 
+#ifdef CONFIG_MACH_HTC
+void dump_all(void)
+{
+	u64 val;
+	get_reg((void *)CCADC_ANA_PARAM, &val);
+	pr_info("CCADC_ANA_PARAM = 0x%02llx\n", val);
+	get_reg((void *)CCADC_DIG_PARAM, &val);
+	pr_info("CCADC_DIG_PARAM = 0x%02llx\n", val);
+	get_reg((void *)CCADC_RSV, &val);
+	pr_info("CCADC_RSV = 0x%02llx\n", val);
+	get_reg((void *)CCADC_DATA0, &val);
+	pr_info("CCADC_DATA0 = 0x%02llx\n", val);
+	get_reg((void *)CCADC_DATA1, &val);
+	pr_info("CCADC_DATA1 = 0x%02llx\n", val);
+	get_reg((void *)CCADC_OFFSET_TRIM1, &val);
+	pr_info("CCADC_OFFSET_TRIM1 = 0x%02llx\n", val);
+	get_reg((void *)CCADC_OFFSET_TRIM0, &val);
+	pr_info("CCADC_OFFSET_TRIM0 = 0x%02llx\n", val);
+	get_reg((void *)CCADC_FULLSCALE_TRIM1, &val);
+	pr_info("CCADC_FULLSCALE_TRIM1 = 0x%02llx\n", val);
+	get_reg((void *)CCADC_FULLSCALE_TRIM0, &val);
+	pr_info("CCADC_FULLSCALE_TRIM0 = 0x%02llx\n", val);
+}
+
+inline int pm8xxx_ccadc_dump_all(void)
+{
+	if (!the_chip) {
+		pr_err("called before init\n");
+		return -EINVAL;
+	}
+	dump_all();
+	return 0;
+}
+EXPORT_SYMBOL(pm8xxx_ccadc_dump_all);
+
+int pm8xxx_ccadc_get_attr_text(char *buf, int size)
+{
+	int len = 0;
+	u64 val = 0;
+
+	get_reg((void *)CCADC_ANA_PARAM, &val);
+	len += scnprintf(buf + len, size - len,
+			"CCADC_ANA_PARAM: 0x%02llx;\n", val);
+	get_reg((void *)CCADC_DIG_PARAM, &val);
+	len += scnprintf(buf + len, size - len,
+			"CCADC_DIG_PARAM: 0x%02llx;\n", val);
+	get_reg((void *)CCADC_RSV, &val);
+	len += scnprintf(buf + len, size - len,
+			"CCADC_RSV: 0x%02llx;\n", val);
+	get_reg((void *)CCADC_DATA0, &val);
+	len += scnprintf(buf + len, size - len,
+			"CCADC_DATA0: 0x%02llx;\n", val);
+	get_reg((void *)CCADC_DATA1, &val);
+	len += scnprintf(buf + len, size - len,
+			"CCADC_DATA1: 0x%02llx;\n", val);
+	get_reg((void *)CCADC_OFFSET_TRIM1, &val);
+	len += scnprintf(buf + len, size - len,
+			"CCADC_OFFSET_TRIM1: 0x%02llx;\n", val);
+	get_reg((void *)CCADC_OFFSET_TRIM0, &val);
+	len += scnprintf(buf + len, size - len,
+			"CCADC_OFFSET_TRIM0: 0x%02llx;\n", val);
+	get_reg((void *)CCADC_FULLSCALE_TRIM1, &val);
+	len += scnprintf(buf + len, size - len,
+			"CCADC_FULLSCALE_TRIM1: 0x%02llx;\n", val);
+	get_reg((void *)CCADC_FULLSCALE_TRIM0, &val);
+	len += scnprintf(buf + len, size - len,
+			"CCADC_FULLSCALE_TRIM0: 0x%02llx;\n", val);
+
+	return len;
+}
+EXPORT_SYMBOL(pm8xxx_ccadc_get_attr_text);
+#endif
+
 static void create_debugfs_entries(struct pm8xxx_ccadc_chip *chip)
 {
 	chip->dent = debugfs_create_dir("pm8xxx-ccadc", NULL);
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 57cde45..41450ee 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3393,6 +3393,8 @@
 	unset_regulator_supplies(rdev);
 
 scrub:
+	if (rdev->supply)
+		regulator_put(rdev->supply);
 	kfree(rdev->constraints);
 	device_unregister(&rdev->dev);
 	/* device core frees rdev */
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index 24d880e..f8d818a 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -4,9 +4,11 @@
 config REMOTEPROC
 	tristate
 	depends on EXPERIMENTAL
+	select FW_CONFIG
 
 config OMAP_REMOTEPROC
 	tristate "OMAP remoteproc support"
+	depends on EXPERIMENTAL
 	depends on ARCH_OMAP4
 	depends on OMAP_IOMMU
 	select REMOTEPROC
diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c
index 69425c4..de138e3 100644
--- a/drivers/remoteproc/omap_remoteproc.c
+++ b/drivers/remoteproc/omap_remoteproc.c
@@ -182,7 +182,7 @@
 
 	ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
 	if (ret) {
-		dev_err(pdev->dev.parent, "dma_set_coherent_mask: %d\n", ret);
+		dev_err(&pdev->dev, "dma_set_coherent_mask: %d\n", ret);
 		return ret;
 	}
 
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index e756a0d..7591b97 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -247,7 +247,7 @@
 		}
 
 		if (offset + filesz > len) {
-			dev_err(dev, "truncated fw: need 0x%x avail 0x%x\n",
+			dev_err(dev, "truncated fw: need 0x%x avail 0x%zx\n",
 					offset + filesz, len);
 			ret = -EINVAL;
 			break;
@@ -934,7 +934,7 @@
 		unmapped = iommu_unmap(rproc->domain, entry->da, entry->len);
 		if (unmapped != entry->len) {
 			/* nothing much to do besides complaining */
-			dev_err(dev, "failed to unmap %u/%u\n", entry->len,
+			dev_err(dev, "failed to unmap %u/%zu\n", entry->len,
 								unmapped);
 		}
 
@@ -1020,7 +1020,7 @@
 
 	ehdr = (struct elf32_hdr *)fw->data;
 
-	dev_info(dev, "Booting fw image %s, size %d\n", name, fw->size);
+	dev_info(dev, "Booting fw image %s, size %zd\n", name, fw->size);
 
 	/*
 	 * if enabling an IOMMU isn't relevant for this rproc, this is
@@ -1041,8 +1041,10 @@
 
 	/* look for the resource table */
 	table = rproc_find_rsc_table(rproc, fw->data, fw->size, &tablesz);
-	if (!table)
+	if (!table) {
+		ret = -EINVAL;
 		goto clean_up;
+	}
 
 	/* handle fw resources which are required to boot rproc */
 	ret = rproc_handle_boot_rsc(rproc, table, tablesz);
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 75506ec..f56c8ba 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -188,6 +188,26 @@
 					rpdev->id.name);
 }
 
+/**
+ * __ept_release() - deallocate an rpmsg endpoint
+ * @kref: the ept's reference count
+ *
+ * This function deallocates an ept, and is invoked when its @kref refcount
+ * drops to zero.
+ *
+ * Never invoke this function directly!
+ */
+static void __ept_release(struct kref *kref)
+{
+	struct rpmsg_endpoint *ept = container_of(kref, struct rpmsg_endpoint,
+						  refcount);
+	/*
+	 * At this point no one holds a reference to ept anymore,
+	 * so we can directly free it
+	 */
+	kfree(ept);
+}
+
 /* for more info, see below documentation of rpmsg_create_ept() */
 static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp,
 		struct rpmsg_channel *rpdev, rpmsg_rx_cb_t cb,
@@ -206,6 +226,9 @@
 		return NULL;
 	}
 
+	kref_init(&ept->refcount);
+	mutex_init(&ept->cb_lock);
+
 	ept->rpdev = rpdev;
 	ept->cb = cb;
 	ept->priv = priv;
@@ -238,7 +261,7 @@
 	idr_remove(&vrp->endpoints, request);
 free_ept:
 	mutex_unlock(&vrp->endpoints_lock);
-	kfree(ept);
+	kref_put(&ept->refcount, __ept_release);
 	return NULL;
 }
 
@@ -302,11 +325,17 @@
 static void
 __rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept)
 {
+	/* make sure new inbound messages can't find this ept anymore */
 	mutex_lock(&vrp->endpoints_lock);
 	idr_remove(&vrp->endpoints, ept->addr);
 	mutex_unlock(&vrp->endpoints_lock);
 
-	kfree(ept);
+	/* make sure in-flight inbound messages won't invoke cb anymore */
+	mutex_lock(&ept->cb_lock);
+	ept->cb = NULL;
+	mutex_unlock(&ept->cb_lock);
+
+	kref_put(&ept->refcount, __ept_release);
 }
 
 /**
@@ -790,12 +819,28 @@
 
 	/* use the dst addr to fetch the callback of the appropriate user */
 	mutex_lock(&vrp->endpoints_lock);
+
 	ept = idr_find(&vrp->endpoints, msg->dst);
+
+	/* let's make sure no one deallocates ept while we use it */
+	if (ept)
+		kref_get(&ept->refcount);
+
 	mutex_unlock(&vrp->endpoints_lock);
 
-	if (ept && ept->cb)
-		ept->cb(ept->rpdev, msg->data, msg->len, ept->priv, msg->src);
-	else
+	if (ept) {
+		/* make sure ept->cb doesn't go away while we use it */
+		mutex_lock(&ept->cb_lock);
+
+		if (ept->cb)
+			ept->cb(ept->rpdev, msg->data, msg->len, ept->priv,
+				msg->src);
+
+		mutex_unlock(&ept->cb_lock);
+
+		/* farewell, ept, we don't need you anymore */
+		kref_put(&ept->refcount, __ept_release);
+	} else
 		dev_warn(dev, "msg received with no recepient\n");
 
 	/* publish the real size of the buffer */
@@ -1040,7 +1085,7 @@
 
 	return ret;
 }
-module_init(rpmsg_init);
+subsys_initcall(rpmsg_init);
 
 static void __exit rpmsg_fini(void)
 {
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c
index 4bcf9ca..b11a2ec 100644
--- a/drivers/rtc/rtc-ab8500.c
+++ b/drivers/rtc/rtc-ab8500.c
@@ -422,7 +422,7 @@
 	}
 
 	err = request_threaded_irq(irq, NULL, rtc_alarm_handler,
-		IRQF_NO_SUSPEND, "ab8500-rtc", rtc);
+		IRQF_NO_SUSPEND | IRQF_ONESHOT, "ab8500-rtc", rtc);
 	if (err < 0) {
 		rtc_device_unregister(rtc);
 		return err;
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c
index 5e1d64e..e3e50d6 100644
--- a/drivers/rtc/rtc-mxc.c
+++ b/drivers/rtc/rtc-mxc.c
@@ -202,10 +202,11 @@
 	struct platform_device *pdev = dev_id;
 	struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
 	void __iomem *ioaddr = pdata->ioaddr;
+	unsigned long flags;
 	u32 status;
 	u32 events = 0;
 
-	spin_lock_irq(&pdata->rtc->irq_lock);
+	spin_lock_irqsave(&pdata->rtc->irq_lock, flags);
 	status = readw(ioaddr + RTC_RTCISR) & readw(ioaddr + RTC_RTCIENR);
 	/* clear interrupt sources */
 	writew(status, ioaddr + RTC_RTCISR);
@@ -224,7 +225,7 @@
 		events |= (RTC_PF | RTC_IRQF);
 
 	rtc_update_irq(pdata->rtc, 1, events);
-	spin_unlock_irq(&pdata->rtc->irq_lock);
+	spin_unlock_irqrestore(&pdata->rtc->irq_lock, flags);
 
 	return IRQ_HANDLED;
 }
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index e38da0d..235b0ef 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -457,12 +457,12 @@
 	clk_disable(config->clk);
 	clk_put(config->clk);
 	iounmap(config->ioaddr);
-	kfree(config);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (res)
 		release_mem_region(res->start, resource_size(res));
 	platform_set_drvdata(pdev, NULL);
 	rtc_device_unregister(config->rtc);
+	kfree(config);
 
 	return 0;
 }
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c
index 3b6e6a6..41c06fe 100644
--- a/drivers/rtc/rtc-wm831x.c
+++ b/drivers/rtc/rtc-wm831x.c
@@ -24,7 +24,7 @@
 #include <linux/mfd/wm831x/core.h>
 #include <linux/delay.h>
 #include <linux/platform_device.h>
-
+#include <linux/random.h>
 
 /*
  * R16416 (0x4020) - RTC Write Counter
@@ -96,6 +96,26 @@
 	unsigned int alarm_enabled:1;
 };
 
+static void wm831x_rtc_add_randomness(struct wm831x *wm831x)
+{
+	int ret;
+	u16 reg;
+
+	/*
+	 * The write counter contains a pseudo-random number which is
+	 * regenerated every time we set the RTC so it should be a
+	 * useful per-system source of entropy.
+	 */
+	ret = wm831x_reg_read(wm831x, WM831X_RTC_WRITE_COUNTER);
+	if (ret >= 0) {
+		reg = ret;
+		add_device_randomness(&reg, sizeof(reg));
+	} else {
+		dev_warn(wm831x->dev, "Failed to read RTC write counter: %d\n",
+			 ret);
+	}
+}
+
 /*
  * Read current time and date in RTC
  */
@@ -431,6 +451,8 @@
 			alm_irq, ret);
 	}
 
+	wm831x_rtc_add_randomness(wm831x);
+
 	return 0;
 
 err:
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index f859216..951b6cf 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1818,6 +1818,8 @@
 	QETH_CARD_TEXT(card, 4, "frvaddr4");
 
 	netdev = __vlan_find_dev_deep(card->dev, vid);
+	if (!netdev)
+		return;
 	in_dev = in_dev_get(netdev);
 	if (!in_dev)
 		return;
@@ -1846,6 +1848,8 @@
 	QETH_CARD_TEXT(card, 4, "frvaddr6");
 
 	netdev = __vlan_find_dev_deep(card->dev, vid);
+	if (!netdev)
+		return;
 	in6_dev = in6_dev_get(netdev);
 	if (!in6_dev)
 		return;
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
index 532d212..393e7ce 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -201,7 +201,7 @@
 
 		if (SAS_STATUS_BUF_SIZE >= sizeof(*resp)) {
 			resp->frame_len = le16_to_cpu(*(__le16 *)(r+6));
-			memcpy(&resp->ending_fis[0], r+16, 24);
+			memcpy(&resp->ending_fis[0], r+16, ATA_RESP_FIS_SIZE);
 			ts->buf_valid_size = sizeof(*resp);
 		}
 	}
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index a3a056a..b48c24f 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -290,6 +290,7 @@
 	struct Scsi_Host *shost = dev_to_shost(dev);
 	struct device *parent = dev->parent;
 	struct request_queue *q;
+	void *queuedata;
 
 	scsi_proc_hostdir_rm(shost->hostt);
 
@@ -299,9 +300,9 @@
 		destroy_workqueue(shost->work_q);
 	q = shost->uspace_req_q;
 	if (q) {
-		kfree(q->queuedata);
-		q->queuedata = NULL;
-		scsi_free_queue(q);
+		queuedata = q->queuedata;
+		blk_cleanup_queue(q);
+		kfree(queuedata);
 	}
 
 	scsi_destroy_command_freelist(shost);
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 5137db5..bc6cf88 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -476,7 +476,7 @@
 	if (!orom)
 		orom = isci_request_oprom(pdev);
 
-	for (i = 0; orom && i < ARRAY_SIZE(orom->ctrl); i++) {
+	for (i = 0; orom && i < num_controllers(pdev); i++) {
 		if (sci_oem_parameters_validate(&orom->ctrl[i],
 						orom->hdr.version)) {
 			dev_warn(&pdev->dev,
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 441d88a..d109cc3 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -139,12 +139,12 @@
 	if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD ||
 	    ((stat->stat == SAM_STAT_CHECK_CONDITION &&
 	      dev->sata_dev.command_set == ATAPI_COMMAND_SET))) {
-		ata_tf_from_fis(resp->ending_fis, &dev->sata_dev.tf);
+		memcpy(dev->sata_dev.fis, resp->ending_fis, ATA_RESP_FIS_SIZE);
 
 		if (!link->sactive) {
-			qc->err_mask |= ac_err_mask(dev->sata_dev.tf.command);
+			qc->err_mask |= ac_err_mask(dev->sata_dev.fis[2]);
 		} else {
-			link->eh_info.err_mask |= ac_err_mask(dev->sata_dev.tf.command);
+			link->eh_info.err_mask |= ac_err_mask(dev->sata_dev.fis[2]);
 			if (unlikely(link->eh_info.err_mask))
 				qc->flags |= ATA_QCFLAG_FAILED;
 		}
@@ -161,8 +161,8 @@
 				qc->flags |= ATA_QCFLAG_FAILED;
 			}
 
-			dev->sata_dev.tf.feature = 0x04; /* status err */
-			dev->sata_dev.tf.command = ATA_ERR;
+			dev->sata_dev.fis[3] = 0x04; /* status err */
+			dev->sata_dev.fis[2] = ATA_ERR;
 		}
 	}
 
@@ -269,7 +269,7 @@
 {
 	struct domain_device *dev = qc->ap->private_data;
 
-	memcpy(&qc->result_tf, &dev->sata_dev.tf, sizeof(qc->result_tf));
+	ata_tf_from_fis(dev->sata_dev.fis, &qc->result_tf);
 	return true;
 }
 
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index caa0525..101b28e 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -868,7 +868,7 @@
 }
 
 /* See if this phy is part of a wide port */
-static int sas_ex_join_wide_port(struct domain_device *parent, int phy_id)
+static bool sas_ex_join_wide_port(struct domain_device *parent, int phy_id)
 {
 	struct ex_phy *phy = &parent->ex_dev.ex_phy[phy_id];
 	int i;
@@ -884,11 +884,11 @@
 			sas_port_add_phy(ephy->port, phy->phy);
 			phy->port = ephy->port;
 			phy->phy_state = PHY_DEVICE_DISCOVERED;
-			return 0;
+			return true;
 		}
 	}
 
-	return -ENODEV;
+	return false;
 }
 
 static struct domain_device *sas_ex_discover_expander(
@@ -1030,8 +1030,7 @@
 		return res;
 	}
 
-	res = sas_ex_join_wide_port(dev, phy_id);
-	if (!res) {
+	if (sas_ex_join_wide_port(dev, phy_id)) {
 		SAS_DPRINTK("Attaching ex phy%d to wide port %016llx\n",
 			    phy_id, SAS_ADDR(ex_phy->attached_sas_addr));
 		return res;
@@ -1077,8 +1076,7 @@
 			if (SAS_ADDR(ex->ex_phy[i].attached_sas_addr) ==
 			    SAS_ADDR(child->sas_addr)) {
 				ex->ex_phy[i].phy_state= PHY_DEVICE_DISCOVERED;
-				res = sas_ex_join_wide_port(dev, i);
-				if (!res)
+				if (sas_ex_join_wide_port(dev, i))
 					SAS_DPRINTK("Attaching ex phy%d to wide port %016llx\n",
 						    i, SAS_ADDR(ex->ex_phy[i].attached_sas_addr));
 
@@ -1943,32 +1941,20 @@
 {
 	struct ex_phy *ex_phy = &dev->ex_dev.ex_phy[phy_id];
 	struct domain_device *child;
-	bool found = false;
-	int res, i;
+	int res;
 
 	SAS_DPRINTK("ex %016llx phy%d new device attached\n",
 		    SAS_ADDR(dev->sas_addr), phy_id);
 	res = sas_ex_phy_discover(dev, phy_id);
 	if (res)
-		goto out;
-	/* to support the wide port inserted */
-	for (i = 0; i < dev->ex_dev.num_phys; i++) {
-		struct ex_phy *ex_phy_temp = &dev->ex_dev.ex_phy[i];
-		if (i == phy_id)
-			continue;
-		if (SAS_ADDR(ex_phy_temp->attached_sas_addr) ==
-		    SAS_ADDR(ex_phy->attached_sas_addr)) {
-			found = true;
-			break;
-		}
-	}
-	if (found) {
-		sas_ex_join_wide_port(dev, phy_id);
+		return res;
+
+	if (sas_ex_join_wide_port(dev, phy_id))
 		return 0;
-	}
+
 	res = sas_ex_discover_devices(dev, phy_id);
-	if (!res)
-		goto out;
+	if (res)
+		return res;
 	list_for_each_entry(child, &dev->ex_dev.children, siblings) {
 		if (SAS_ADDR(child->sas_addr) ==
 		    SAS_ADDR(ex_phy->attached_sas_addr)) {
@@ -1978,7 +1964,6 @@
 			break;
 		}
 	}
-out:
 	return res;
 }
 
@@ -2109,9 +2094,7 @@
 	struct domain_device *dev = NULL;
 
 	res = sas_find_bcast_dev(port_dev, &dev);
-	if (res)
-		goto out;
-	if (dev) {
+	while (res == 0 && dev) {
 		struct expander_device *ex = &dev->ex_dev;
 		int i = 0, phy_id;
 
@@ -2123,8 +2106,10 @@
 			res = sas_rediscover(dev, phy_id);
 			i = phy_id + 1;
 		} while (i < ex->num_phys);
+
+		dev = NULL;
+		res = sas_find_bcast_dev(port_dev, &dev);
 	}
-out:
 	return res;
 }
 
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 8a59a77..3f03342 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1785,7 +1785,7 @@
 static inline u8
 _base_get_msix_index(struct MPT2SAS_ADAPTER *ioc)
 {
-	return ioc->cpu_msix_table[smp_processor_id()];
+	return ioc->cpu_msix_table[raw_smp_processor_id()];
 }
 
 /**
@@ -3343,7 +3343,7 @@
 	}
 
 	pfacts = &ioc->pfacts[port];
-	memset(pfacts, 0, sizeof(Mpi2PortFactsReply_t));
+	memset(pfacts, 0, sizeof(struct mpt2sas_port_facts));
 	pfacts->PortNumber = mpi_reply.PortNumber;
 	pfacts->VP_ID = mpi_reply.VP_ID;
 	pfacts->VF_ID = mpi_reply.VF_ID;
@@ -3385,7 +3385,7 @@
 	}
 
 	facts = &ioc->facts;
-	memset(facts, 0, sizeof(Mpi2IOCFactsReply_t));
+	memset(facts, 0, sizeof(struct mpt2sas_facts));
 	facts->MsgVersion = le16_to_cpu(mpi_reply.MsgVersion);
 	facts->HeaderVersion = le16_to_cpu(mpi_reply.HeaderVersion);
 	facts->VP_ID = mpi_reply.VP_ID;
@@ -4262,7 +4262,7 @@
 		goto out_free_resources;
 
 	ioc->pfacts = kcalloc(ioc->facts.NumberOfPorts,
-	    sizeof(Mpi2PortFactsReply_t), GFP_KERNEL);
+	    sizeof(struct mpt2sas_port_facts), GFP_KERNEL);
 	if (!ioc->pfacts) {
 		r = -ENOMEM;
 		goto out_free_resources;
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 386f0c5..cc8dc8c 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1687,6 +1687,20 @@
 	 * requests are started.
 	 */
 	scsi_run_host_queues(shost);
+
+	/*
+	 * if eh is active and host_eh_scheduled is pending we need to re-run
+	 * recovery.  we do this check after scsi_run_host_queues() to allow
+	 * everything pent up since the last eh run a chance to make forward
+	 * progress before we sync again.  Either we'll immediately re-run
+	 * recovery or scsi_device_unbusy() will wake us again when these
+	 * pending commands complete.
+	 */
+	spin_lock_irqsave(shost->host_lock, flags);
+	if (shost->host_eh_scheduled)
+		if (scsi_host_set_state(shost, SHOST_RECOVERY))
+			WARN_ON(scsi_host_set_state(shost, SHOST_CANCEL_RECOVERY));
+	spin_unlock_irqrestore(shost->host_lock, flags);
 }
 
 /**
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 5dfd749..1929146 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -406,10 +406,6 @@
 	LIST_HEAD(starved_list);
 	unsigned long flags;
 
-	/* if the device is dead, sdev will be NULL, so no queue to run */
-	if (!sdev)
-		return;
-
 	shost = sdev->host;
 	if (scsi_target(sdev)->single_lun)
 		scsi_single_lun_run(sdev);
@@ -483,15 +479,26 @@
  */
 static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd)
 {
+	struct scsi_device *sdev = cmd->device;
 	struct request *req = cmd->request;
 	unsigned long flags;
 
+	/*
+	 * We need to hold a reference on the device to avoid the queue being
+	 * killed after the unlock and before scsi_run_queue is invoked which
+	 * may happen because scsi_unprep_request() puts the command which
+	 * releases its reference on the device.
+	 */
+	get_device(&sdev->sdev_gendev);
+
 	spin_lock_irqsave(q->queue_lock, flags);
 	scsi_unprep_request(req);
 	blk_requeue_request(q, req);
 	spin_unlock_irqrestore(q->queue_lock, flags);
 
 	scsi_run_queue(q);
+
+	put_device(&sdev->sdev_gendev);
 }
 
 void scsi_next_command(struct scsi_cmnd *cmd)
@@ -1370,24 +1377,27 @@
  * may be changed after request stacking drivers call the function,
  * regardless of taking lock or not.
  *
- * When scsi can't dispatch I/Os anymore and needs to kill I/Os
- * (e.g. !sdev), scsi needs to return 'not busy'.
- * Otherwise, request stacking drivers may hold requests forever.
+ * When scsi can't dispatch I/Os anymore and needs to kill I/Os scsi
+ * needs to return 'not busy'. Otherwise, request stacking drivers
+ * may hold requests forever.
  */
 static int scsi_lld_busy(struct request_queue *q)
 {
 	struct scsi_device *sdev = q->queuedata;
 	struct Scsi_Host *shost;
-	struct scsi_target *starget;
 
-	if (!sdev)
+	if (blk_queue_dead(q))
 		return 0;
 
 	shost = sdev->host;
-	starget = scsi_target(sdev);
 
-	if (scsi_host_in_recovery(shost) || scsi_host_is_busy(shost) ||
-	    scsi_target_is_busy(starget) || scsi_device_is_busy(sdev))
+	/*
+	 * Ignore host/starget busy state.
+	 * Since block layer does not have a concept of fairness across
+	 * multiple queues, congestion of host/starget needs to be handled
+	 * in SCSI layer.
+	 */
+	if (scsi_host_in_recovery(shost) || scsi_device_is_busy(sdev))
 		return 1;
 
 	return 0;
@@ -1487,12 +1497,6 @@
 	struct scsi_cmnd *cmd;
 	struct request *req;
 
-	if (!sdev) {
-		while ((req = blk_peek_request(q)) != NULL)
-			scsi_kill_request(req, q);
-		return;
-	}
-
 	if(!get_device(&sdev->sdev_gendev))
 		/* We must be tearing the block queue down already */
 		return;
@@ -1694,20 +1698,6 @@
 	return q;
 }
 
-void scsi_free_queue(struct request_queue *q)
-{
-	unsigned long flags;
-
-	WARN_ON(q->queuedata);
-
-	/* cause scsi_request_fn() to kill all non-finished requests */
-	spin_lock_irqsave(q->queue_lock, flags);
-	q->request_fn(q);
-	spin_unlock_irqrestore(q->queue_lock, flags);
-
-	blk_cleanup_queue(q);
-}
-
 /*
  * Function:    scsi_block_requests()
  *
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index be4fa6d..fd9f57f 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -84,7 +84,6 @@
 extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
 extern void scsi_run_host_queues(struct Scsi_Host *shost);
 extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
-extern void scsi_free_queue(struct request_queue *q);
 extern int scsi_init_queue(void);
 extern void scsi_exit_queue(void);
 struct request_queue;
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 01b0374..8906557 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1714,6 +1714,9 @@
 {
 	struct scsi_device *sdev;
 	shost_for_each_device(sdev, shost) {
+		/* target removed before the device could be added */
+		if (sdev->sdev_state == SDEV_DEL)
+			continue;
 		if (!scsi_host_scan_allowed(shost) ||
 		    scsi_sysfs_add_sdev(sdev) != 0)
 			__scsi_remove_device(sdev);
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 04c2a27..bb7c482 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -971,11 +971,8 @@
 		sdev->host->hostt->slave_destroy(sdev);
 	transport_destroy_device(dev);
 
-	/* cause the request function to reject all I/O requests */
-	sdev->request_queue->queuedata = NULL;
-
 	/* Freeing the queue signals to block that we're done */
-	scsi_free_queue(sdev->request_queue);
+	blk_cleanup_queue(sdev->request_queue);
 	put_device(dev);
 }
 
@@ -1000,7 +997,6 @@
 	struct scsi_device *sdev;
 
 	spin_lock_irqsave(shost->host_lock, flags);
-	starget->reap_ref++;
  restart:
 	list_for_each_entry(sdev, &shost->__devices, siblings) {
 		if (sdev->channel != starget->channel ||
@@ -1014,14 +1010,6 @@
 		goto restart;
 	}
 	spin_unlock_irqrestore(shost->host_lock, flags);
-	scsi_target_reap(starget);
-}
-
-static int __remove_child (struct device * dev, void * data)
-{
-	if (scsi_is_target_device(dev))
-		__scsi_remove_target(to_scsi_target(dev));
-	return 0;
 }
 
 /**
@@ -1034,14 +1022,34 @@
  */
 void scsi_remove_target(struct device *dev)
 {
-	if (scsi_is_target_device(dev)) {
-		__scsi_remove_target(to_scsi_target(dev));
-		return;
-	}
+	struct Scsi_Host *shost = dev_to_shost(dev->parent);
+	struct scsi_target *starget, *found;
+	unsigned long flags;
 
-	get_device(dev);
-	device_for_each_child(dev, NULL, __remove_child);
-	put_device(dev);
+ restart:
+	found = NULL;
+	spin_lock_irqsave(shost->host_lock, flags);
+	list_for_each_entry(starget, &shost->__targets, siblings) {
+		if (starget->state == STARGET_DEL)
+			continue;
+		if (starget->dev.parent == dev || &starget->dev == dev) {
+			found = starget;
+			found->reap_ref++;
+			break;
+		}
+	}
+	spin_unlock_irqrestore(shost->host_lock, flags);
+
+	if (found) {
+		__scsi_remove_target(found);
+		scsi_target_reap(found);
+		/* in the case where @dev has multiple starget children,
+		 * continue removing.
+		 *
+		 * FIXME: does such a case exist?
+		 */
+		goto restart;
+	}
 }
 EXPORT_SYMBOL(scsi_remove_target);
 
diff --git a/drivers/scsi/scsi_wait_scan.c b/drivers/scsi/scsi_wait_scan.c
index 74708fc..ae78148 100644
--- a/drivers/scsi/scsi_wait_scan.c
+++ b/drivers/scsi/scsi_wait_scan.c
@@ -12,7 +12,7 @@
 
 #include <linux/module.h>
 #include <linux/device.h>
-#include <scsi/scsi_scan.h>
+#include "scsi_priv.h"
 
 static int __init wait_scan_init(void)
 {
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 5ba5c2a..a239382 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1898,6 +1898,8 @@
 {
 	if (sdp->host->max_cmd_len < 16)
 		return 0;
+	if (sdp->try_rc_10_first)
+		return 0;
 	if (sdp->scsi_level > SCSI_SPC_2)
 		return 1;
 	if (scsi_device_protection(sdp))
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index 5f748c0..6a62934 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -933,7 +933,7 @@
 
 static void fsl_spi_cs_control(struct spi_device *spi, bool on)
 {
-	struct device *dev = spi->dev.parent;
+	struct device *dev = spi->dev.parent->parent;
 	struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(dev->platform_data);
 	u16 cs = spi->chip_select;
 	int gpio = pinfo->gpios[cs];
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 400ae21..469eb28 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -489,6 +489,11 @@
 	pl022->cur_transfer = NULL;
 	pl022->cur_chip = NULL;
 	spi_finalize_current_message(pl022->master);
+
+	/* disable the SPI/SSP operation */
+	writew((readw(SSP_CR1(pl022->virtbase)) &
+		(~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase));
+
 }
 
 /**
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 3d8f662..3a2575b 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1439,6 +1439,73 @@
 }
 EXPORT_SYMBOL_GPL(spi_write_then_read);
 
+/**
+ * spi_write_and_read - SPI synchronous write and read in full duplex
+ * @spi: device with which data will be exchanged
+ * @txbuf: data to be written (need not be dma-safe)
+ * @rxbuf: buffer into which data will be read (need not be dma-safe)
+ * @size: size of transmission, in bytes
+ * Context: can sleep
+ * (Modify from spi_write_then_read)
+ *
+ * This performs a full duplex MicroWire style transaction with the
+ * device, sending txbuf and reading rxbuf at same time. The return value
+ * is zero for success, else a negative errno status code.
+ * This call may only be used from a context that may sleep.
+ *
+ * Parameters to this routine are always copied using a small buffer;
+ * portable code should never use this for more than 32 bytes.
+ * Performance-sensitive or bulk transfer code should instead use
+ * spi_{async,sync}() calls with dma-safe buffers.
+ */
+int spi_write_and_read(struct spi_device *spi,
+		u8 *txbuf, u8 *rxbuf, unsigned size)
+{
+	static DEFINE_MUTEX(lock);
+
+	int			status;
+	struct spi_message	message;
+	struct spi_transfer	x;
+	u8			*local_buf;
+
+	if (2*size > SPI_BUFSIZ) {
+		pr_err("%s size %d is over %d\n", __func__, size, SPI_BUFSIZ);
+		return -EINVAL;
+	}
+
+	spi_message_init(&message);
+	memset(&x, 0, sizeof x);
+	if (size) {
+		x.len = size;
+		spi_message_add_tail(&x, &message);
+	}
+
+	if (!mutex_trylock(&lock)) {
+		local_buf = kmalloc(SPI_BUFSIZ, GFP_KERNEL);
+		if (!local_buf) {
+			pr_err("%s out of memory\n", __func__);
+			return -ENOMEM;
+		}
+	} else
+		local_buf = buf;
+
+	memcpy(local_buf, txbuf, size);
+	x.tx_buf = local_buf;
+	x.rx_buf = local_buf + size;
+
+	status = spi_sync(spi, &message);
+	if (status == 0)
+		memcpy(rxbuf, x.rx_buf, size);
+
+	if (x.tx_buf == buf)
+		mutex_unlock(&lock);
+	else
+		kfree(local_buf);
+
+	return status;
+}
+EXPORT_SYMBOL_GPL(spi_write_and_read);
+
 /*-------------------------------------------------------------------------*/
 
 static int __init spi_init(void)
diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig
index 43d17c2..30e6597 100644
--- a/drivers/staging/android/Kconfig
+++ b/drivers/staging/android/Kconfig
@@ -38,6 +38,61 @@
 	select ANDROID_PERSISTENT_RAM
 	default n
 
+config ANDROID_RAM_CONSOLE_ENABLE_VERBOSE
+	bool "Enable verbose console messages on Android RAM console"
+	default y
+	depends on ANDROID_RAM_CONSOLE
+
+menuconfig ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+	bool "Android RAM Console Enable error correction"
+	default n
+	depends on ANDROID_RAM_CONSOLE
+	depends on !ANDROID_RAM_CONSOLE_EARLY_INIT
+	select REED_SOLOMON
+	select REED_SOLOMON_ENC8
+	select REED_SOLOMON_DEC8
+
+if ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+
+config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_DATA_SIZE
+	int "Android RAM Console Data data size"
+	default 128
+	help
+	  Must be a power of 2.
+
+config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_ECC_SIZE
+	int "Android RAM Console ECC size"
+	default 16
+
+config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE
+	int "Android RAM Console Symbol size"
+	default 8
+
+config ANDROID_RAM_CONSOLE_ERROR_CORRECTION_POLYNOMIAL
+	hex "Android RAM Console Polynomial"
+	default 0x19 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 4)
+	default 0x29 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 5)
+	default 0x61 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 6)
+	default 0x89 if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 7)
+	default 0x11d if (ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE = 8)
+
+endif # ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+
+config ANDROID_RAM_CONSOLE_EARLY_INIT
+	bool "Start Android RAM console early"
+	default n
+	depends on ANDROID_RAM_CONSOLE
+
+config ANDROID_RAM_CONSOLE_EARLY_ADDR
+	hex "Android RAM console virtual address"
+	default 0
+	depends on ANDROID_RAM_CONSOLE_EARLY_INIT
+
+config ANDROID_RAM_CONSOLE_EARLY_SIZE
+	hex "Android RAM console buffer size"
+	default 0
+	depends on ANDROID_RAM_CONSOLE_EARLY_INIT
+
 config PERSISTENT_TRACER
 	bool "Persistent function tracer"
 	depends on HAVE_FUNCTION_TRACER
diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile
index 8769e32..23524c0 100644
--- a/drivers/staging/android/Makefile
+++ b/drivers/staging/android/Makefile
@@ -4,7 +4,11 @@
 obj-$(CONFIG_ASHMEM)			+= ashmem.o
 obj-$(CONFIG_ANDROID_LOGGER)		+= logger.o
 obj-$(CONFIG_ANDROID_PERSISTENT_RAM)	+= persistent_ram.o
+ifeq ($(CONFIG_MACH_HTC),y)
+obj-$(CONFIG_ANDROID_RAM_CONSOLE)	+= ram_console_htc.o
+else
 obj-$(CONFIG_ANDROID_RAM_CONSOLE)	+= ram_console.o
+endif
 obj-$(CONFIG_ANDROID_TIMED_OUTPUT)	+= timed_output.o
 obj-$(CONFIG_ANDROID_TIMED_GPIO)	+= timed_gpio.o
 obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER)	+= lowmemorykiller.o
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index b89799a..92ce45f 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -18,6 +18,7 @@
 #include <asm/cacheflush.h>
 #include <linux/fdtable.h>
 #include <linux/file.h>
+#include <linux/freezer.h>
 #include <linux/fs.h>
 #include <linux/list.h>
 #include <linux/miscdevice.h>
@@ -2290,13 +2291,13 @@
 			if (!binder_has_proc_work(proc, thread))
 				ret = -EAGAIN;
 		} else
-			ret = wait_event_interruptible_exclusive(proc->wait, binder_has_proc_work(proc, thread));
+			ret = wait_event_freezable_exclusive(proc->wait, binder_has_proc_work(proc, thread));
 	} else {
 		if (non_block) {
 			if (!binder_has_thread_work(thread))
 				ret = -EAGAIN;
 		} else
-			ret = wait_event_interruptible(thread->wait, binder_has_thread_work(thread));
+			ret = wait_event_freezable(thread->wait, binder_has_thread_work(thread));
 	}
 
 	binder_lock(__func__);
diff --git a/drivers/staging/android/persistent_ram.c b/drivers/staging/android/persistent_ram.c
index 35cc95b..07b1679 100644
--- a/drivers/staging/android/persistent_ram.c
+++ b/drivers/staging/android/persistent_ram.c
@@ -79,23 +79,6 @@
 	} while (atomic_cmpxchg(&prz->buffer->size, old, new) != old);
 }
 
-/* increase the size counter, retuning an error if it hits the max size */
-static inline ssize_t buffer_size_add_clamp(struct persistent_ram_zone *prz,
-	size_t a)
-{
-	size_t old;
-	size_t new;
-
-	do {
-		old = atomic_read(&prz->buffer->size);
-		new = old + a;
-		if (new > prz->buffer_size)
-			return -ENOMEM;
-	} while (atomic_cmpxchg(&prz->buffer->size, old, new) != old);
-
-	return 0;
-}
-
 static void notrace persistent_ram_encode_rs8(struct persistent_ram_zone *prz,
 	uint8_t *data, size_t len, uint8_t *ecc)
 {
@@ -304,7 +287,7 @@
 		c = prz->buffer_size;
 	}
 
-	buffer_size_add_clamp(prz, c);
+	buffer_size_add(prz, c);
 
 	start = buffer_start_add(prz, c);
 
diff --git a/drivers/staging/android/ram_console_htc.c b/drivers/staging/android/ram_console_htc.c
new file mode 100644
index 0000000..53b64fb
--- /dev/null
+++ b/drivers/staging/android/ram_console_htc.c
@@ -0,0 +1,498 @@
+/* drivers/android/ram_console.c
+ *
+ * Copyright (C) 2007-2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/console.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/proc_fs.h>
+#include <linux/string.h>
+#include <linux/uaccess.h>
+#include <linux/io.h>
+#include <linux/platform_data/ram_console.h>
+
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+#include <linux/rslib.h>
+#endif
+
+struct ram_console_buffer {
+	uint32_t    sig;
+	uint32_t    start;
+	uint32_t    size;
+	uint8_t     data[0];
+};
+
+#define RAM_CONSOLE_SIG (0x43474244)
+
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
+static char __initdata
+	ram_console_old_log_init_buffer[CONFIG_ANDROID_RAM_CONSOLE_EARLY_SIZE];
+#endif
+static char *ram_console_old_log;
+static size_t ram_console_old_log_size;
+
+static struct ram_console_buffer *ram_console_buffer;
+static size_t ram_console_buffer_size;
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+static char *ram_console_par_buffer;
+static struct rs_control *ram_console_rs_decoder;
+static int ram_console_corrected_bytes;
+static int ram_console_bad_blocks;
+#define ECC_BLOCK_SIZE CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_DATA_SIZE
+#define ECC_SIZE CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_ECC_SIZE
+#define ECC_SYMSIZE CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_SYMBOL_SIZE
+#define ECC_POLY CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION_POLYNOMIAL
+#endif
+
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+static void ram_console_encode_rs8(uint8_t *data, size_t len, uint8_t *ecc)
+{
+	int i;
+	uint16_t par[ECC_SIZE];
+
+	memset(par, 0, sizeof(par));
+	encode_rs8(ram_console_rs_decoder, data, len, par, 0);
+	for (i = 0; i < ECC_SIZE; i++)
+		ecc[i] = par[i];
+}
+
+static int ram_console_decode_rs8(void *data, size_t len, uint8_t *ecc)
+{
+	int i;
+	uint16_t par[ECC_SIZE];
+	for (i = 0; i < ECC_SIZE; i++)
+		par[i] = ecc[i];
+	return decode_rs8(ram_console_rs_decoder, data, par, len,
+				NULL, 0, NULL, 0, NULL);
+}
+#endif
+
+static void ram_console_update(const char *s, unsigned int count)
+{
+	struct ram_console_buffer *buffer = ram_console_buffer;
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+	uint8_t *buffer_end = buffer->data + ram_console_buffer_size;
+	uint8_t *block;
+	uint8_t *par;
+	int size = ECC_BLOCK_SIZE;
+#endif
+	memcpy(buffer->data + buffer->start, s, count);
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+	block = buffer->data + (buffer->start & ~(ECC_BLOCK_SIZE - 1));
+	par = ram_console_par_buffer +
+	      (buffer->start / ECC_BLOCK_SIZE) * ECC_SIZE;
+	do {
+		if (block + ECC_BLOCK_SIZE > buffer_end)
+			size = buffer_end - block;
+		ram_console_encode_rs8(block, size, par);
+		block += ECC_BLOCK_SIZE;
+		par += ECC_SIZE;
+	} while (block < buffer->data + buffer->start + count);
+#endif
+}
+
+static void ram_console_update_header(void)
+{
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+	struct ram_console_buffer *buffer = ram_console_buffer;
+	uint8_t *par;
+	par = ram_console_par_buffer +
+	      DIV_ROUND_UP(ram_console_buffer_size, ECC_BLOCK_SIZE) * ECC_SIZE;
+	ram_console_encode_rs8((uint8_t *)buffer, sizeof(*buffer), par);
+#endif
+}
+
+static void
+ram_console_write(struct console *console, const char *s, unsigned int count)
+{
+	int rem;
+	struct ram_console_buffer *buffer = ram_console_buffer;
+
+	if (count > ram_console_buffer_size) {
+		s += count - ram_console_buffer_size;
+		count = ram_console_buffer_size;
+	}
+	rem = ram_console_buffer_size - buffer->start;
+	if (rem < count) {
+		ram_console_update(s, rem);
+		s += rem;
+		count -= rem;
+		buffer->start = 0;
+		buffer->size = ram_console_buffer_size;
+	}
+	ram_console_update(s, count);
+
+	buffer->start += count;
+	if (buffer->size < ram_console_buffer_size)
+		buffer->size += count;
+	ram_console_update_header();
+}
+
+static struct console ram_console = {
+	.name	= "ram",
+	.write	= ram_console_write,
+	.flags	= CON_PRINTBUFFER | CON_ENABLED | CON_ANYTIME,
+	.index	= -1,
+};
+
+void ram_console_enable_console(int enabled)
+{
+	if (enabled)
+		ram_console.flags |= CON_ENABLED;
+	else
+		ram_console.flags &= ~CON_ENABLED;
+}
+
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_APPEND_PMIC_STATUS_BITS
+static unsigned int atoi(const char *name)
+{
+	unsigned int val = 0;
+
+	for (;; name++) {
+		switch (*name) {
+		case '0' ... '9':
+			val = 10*val+(*name-'0');
+			break;
+		default:
+			return val;
+		}
+	}
+}
+static unsigned int last_off_event = 0;
+static int __init pmic_last_off_event(char *opt)
+{
+	if (!opt || !*opt || *opt == '\0')
+		return 1;
+	pr_debug("[K] ram_console: last_off_event=%s", opt);
+	last_off_event = atoi(opt);
+	return 1;
+}
+__setup("reset_status=", pmic_last_off_event);
+
+static unsigned int start_on_event = 0;
+static int __init pmic_start_on_event(char *opt)
+{
+	if (!opt || !*opt || *opt == '\0')
+		return 1;
+	pr_debug("[K] ram_console: start_on_event=%s", opt);
+	start_on_event = atoi(opt);
+	return 1;
+}
+__setup("poweron_status=", pmic_start_on_event);
+#endif
+
+static void __devinit
+ram_console_save_old(struct ram_console_buffer *buffer, const char *bootinfo,
+	char *dest)
+{
+	size_t old_log_size = buffer->size;
+	size_t bootinfo_size = 0;
+	size_t total_size = old_log_size;
+	char *ptr;
+	const char *bootinfo_label = "Boot info:\n";
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_APPEND_PMIC_STATUS_BITS
+#define PMIC_STATUS_MAX 100
+	char pmic_status_buffer[PMIC_STATUS_MAX];
+	size_t pmic_status_buffer_len;
+#endif
+
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+	uint8_t *block;
+	uint8_t *par;
+	char strbuf[80];
+	int strbuf_len = 0;
+
+	block = buffer->data;
+	par = ram_console_par_buffer;
+	while (block < buffer->data + buffer->size) {
+		int numerr;
+		int size = ECC_BLOCK_SIZE;
+		if (block + size > buffer->data + ram_console_buffer_size)
+			size = buffer->data + ram_console_buffer_size - block;
+		numerr = ram_console_decode_rs8(block, size, par);
+		if (numerr > 0) {
+#if 0
+			printk(KERN_INFO "[K] ram_console: error in block %p, %d\n",
+			       block, numerr);
+#endif
+			ram_console_corrected_bytes += numerr;
+		} else if (numerr < 0) {
+#if 0
+			printk(KERN_INFO "[K] ram_console: uncorrectable error in "
+			       "block %p\n", block);
+#endif
+			ram_console_bad_blocks++;
+		}
+		block += ECC_BLOCK_SIZE;
+		par += ECC_SIZE;
+	}
+	if (ram_console_corrected_bytes || ram_console_bad_blocks)
+		strbuf_len = snprintf(strbuf, sizeof(strbuf),
+			"\n%d Corrected bytes, %d unrecoverable blocks\n",
+			ram_console_corrected_bytes, ram_console_bad_blocks);
+	else
+		strbuf_len = snprintf(strbuf, sizeof(strbuf),
+				      "\nNo errors detected\n");
+	if (strbuf_len >= sizeof(strbuf))
+		strbuf_len = sizeof(strbuf) - 1;
+	total_size += strbuf_len;
+#endif
+
+	if (bootinfo)
+		bootinfo_size = strlen(bootinfo) + strlen(bootinfo_label);
+	total_size += bootinfo_size;
+
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_APPEND_PMIC_STATUS_BITS
+	pmic_status_buffer_len =
+		snprintf(pmic_status_buffer, sizeof(pmic_status_buffer),
+			"\n[QCT] PMIC status: start_on_event=0x%x, last_off_event=0x%x\n",
+			start_on_event, last_off_event);
+	pmic_status_buffer_len =
+		min(pmic_status_buffer_len, sizeof(pmic_status_buffer) - 1);
+	total_size += pmic_status_buffer_len;
+#endif
+
+	if (dest == NULL) {
+		dest = kmalloc(total_size, GFP_KERNEL);
+		if (dest == NULL) {
+			printk(KERN_ERR
+			       "[K] ram_console: failed to allocate buffer\n");
+			return;
+		}
+	}
+
+	ram_console_old_log = dest;
+	ram_console_old_log_size = total_size;
+	memcpy(ram_console_old_log,
+	       &buffer->data[buffer->start], buffer->size - buffer->start);
+	memcpy(ram_console_old_log + buffer->size - buffer->start,
+	       &buffer->data[0], buffer->start);
+	ptr = ram_console_old_log + old_log_size;
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+	memcpy(ptr, strbuf, strbuf_len);
+	ptr += strbuf_len;
+#endif
+	if (bootinfo) {
+		memcpy(ptr, bootinfo_label, strlen(bootinfo_label));
+		ptr += strlen(bootinfo_label);
+		memcpy(ptr, bootinfo, bootinfo_size);
+		ptr += bootinfo_size;
+	}
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_APPEND_PMIC_STATUS_BITS
+	memcpy(ptr,
+		   pmic_status_buffer, pmic_status_buffer_len);
+	ptr += pmic_status_buffer_len;
+#endif
+}
+
+static int __devinit ram_console_init(struct ram_console_buffer *buffer,
+				   size_t buffer_size, const char *bootinfo,
+				   char *old_buf)
+{
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+	int numerr;
+	uint8_t *par;
+#endif
+	ram_console_buffer = buffer;
+	ram_console_buffer_size =
+		buffer_size - sizeof(struct ram_console_buffer);
+
+	if (ram_console_buffer_size > buffer_size) {
+		pr_err("[K] ram_console: buffer %p, invalid size %zu, "
+		       "datasize %zu\n", buffer, buffer_size,
+		       ram_console_buffer_size);
+		return 0;
+	}
+
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
+	ram_console_buffer_size -= (DIV_ROUND_UP(ram_console_buffer_size,
+						ECC_BLOCK_SIZE) + 1) * ECC_SIZE;
+
+	if (ram_console_buffer_size > buffer_size) {
+		pr_err("[K] ram_console: buffer %p, invalid size %zu, "
+		       "non-ecc datasize %zu\n",
+		       buffer, buffer_size, ram_console_buffer_size);
+		return 0;
+	}
+
+	ram_console_par_buffer = buffer->data + ram_console_buffer_size;
+
+
+	ram_console_rs_decoder = init_rs(ECC_SYMSIZE, ECC_POLY, 0, 1, ECC_SIZE);
+	if (ram_console_rs_decoder == NULL) {
+		printk(KERN_INFO "[K] ram_console: init_rs failed\n");
+		return 0;
+	}
+
+	ram_console_corrected_bytes = 0;
+	ram_console_bad_blocks = 0;
+
+	par = ram_console_par_buffer +
+	      DIV_ROUND_UP(ram_console_buffer_size, ECC_BLOCK_SIZE) * ECC_SIZE;
+
+	numerr = ram_console_decode_rs8(buffer, sizeof(*buffer), par);
+	if (numerr > 0) {
+		printk(KERN_INFO "[K] ram_console: error in header, %d\n", numerr);
+		ram_console_corrected_bytes += numerr;
+	} else if (numerr < 0) {
+		printk(KERN_INFO
+		       "[K] ram_console: uncorrectable error in header\n");
+		ram_console_bad_blocks++;
+	}
+#endif
+
+	if (buffer->sig == RAM_CONSOLE_SIG) {
+		if (buffer->size > ram_console_buffer_size
+		    || buffer->start > buffer->size)
+			printk(KERN_INFO "[K] ram_console: found existing invalid "
+			       "buffer, size %d, start %d\n",
+			       buffer->size, buffer->start);
+		else {
+			printk(KERN_INFO "[K] ram_console: found existing buffer, "
+			       "size %d, start %d\n",
+			       buffer->size, buffer->start);
+			ram_console_save_old(buffer, bootinfo, old_buf);
+		}
+	} else {
+		printk(KERN_INFO "[K] ram_console: no valid data in buffer "
+		       "(sig = 0x%08x)\n", buffer->sig);
+	}
+
+	buffer->sig = RAM_CONSOLE_SIG;
+	buffer->start = 0;
+	buffer->size = 0;
+
+	register_console(&ram_console);
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_ENABLE_VERBOSE
+	console_verbose();
+#endif
+	return 0;
+}
+
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
+static int __init ram_console_early_init(void)
+{
+	return ram_console_init((struct ram_console_buffer *)
+		CONFIG_ANDROID_RAM_CONSOLE_EARLY_ADDR,
+		CONFIG_ANDROID_RAM_CONSOLE_EARLY_SIZE,
+		NULL,
+		ram_console_old_log_init_buffer);
+}
+#else
+static int __devinit ram_console_driver_probe(struct platform_device *pdev)
+{
+	struct resource *res = pdev->resource;
+	size_t start;
+	size_t buffer_size;
+	void *buffer;
+	const char *bootinfo = NULL;
+	struct ram_console_platform_data *pdata = pdev->dev.platform_data;
+
+	if (res == NULL || pdev->num_resources != 1 ||
+	    !(res->flags & IORESOURCE_MEM)) {
+		printk(KERN_ERR "[K] ram_console: invalid resource, %p %d flags "
+		       "%lx\n", res, pdev->num_resources, res ? res->flags : 0);
+		return -ENXIO;
+	}
+	buffer_size = res->end - res->start + 1;
+	start = res->start;
+	printk(KERN_INFO "[K] ram_console: got buffer at %zx, size %zx\n",
+	       start, buffer_size);
+	buffer = ioremap(res->start, buffer_size);
+	if (buffer == NULL) {
+		printk(KERN_ERR "[K] ram_console: failed to map memory\n");
+		return -ENOMEM;
+	}
+
+	if (pdata)
+		bootinfo = pdata->bootinfo;
+
+	return ram_console_init(buffer, buffer_size, bootinfo, NULL);
+}
+
+static struct platform_driver ram_console_driver = {
+	.probe = ram_console_driver_probe,
+	.driver		= {
+		.name	= "ram_console",
+	},
+};
+
+static int __init ram_console_module_init(void)
+{
+	int err;
+	err = platform_driver_register(&ram_console_driver);
+	return err;
+}
+#endif
+
+static ssize_t ram_console_read_old(struct file *file, char __user *buf,
+				    size_t len, loff_t *offset)
+{
+	loff_t pos = *offset;
+	ssize_t count;
+
+	if (pos >= ram_console_old_log_size)
+		return 0;
+
+	count = min(len, (size_t)(ram_console_old_log_size - pos));
+	if (copy_to_user(buf, ram_console_old_log + pos, count))
+		return -EFAULT;
+
+	*offset += count;
+	return count;
+}
+
+static const struct file_operations ram_console_file_ops = {
+	.owner = THIS_MODULE,
+	.read = ram_console_read_old,
+};
+
+static int __init ram_console_late_init(void)
+{
+	struct proc_dir_entry *entry;
+
+	if (ram_console_old_log == NULL)
+		return 0;
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
+	ram_console_old_log = kmalloc(ram_console_old_log_size, GFP_KERNEL);
+	if (ram_console_old_log == NULL) {
+		printk(KERN_ERR
+		       "[K] ram_console: failed to allocate buffer for old log\n");
+		ram_console_old_log_size = 0;
+		return 0;
+	}
+	memcpy(ram_console_old_log,
+	       ram_console_old_log_init_buffer, ram_console_old_log_size);
+#endif
+	entry = create_proc_entry("last_kmsg", S_IFREG | S_IRUGO, NULL);
+	if (!entry) {
+		printk(KERN_ERR "[K] ram_console: failed to create proc entry\n");
+		kfree(ram_console_old_log);
+		ram_console_old_log = NULL;
+		return 0;
+	}
+
+	entry->proc_fops = &ram_console_file_ops;
+	entry->size = ram_console_old_log_size;
+	return 0;
+}
+
+#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
+console_initcall(ram_console_early_init);
+#else
+postcore_initcall(ram_console_module_init);
+#endif
+late_initcall(ram_console_late_init);
+
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 9bcf87a..a796964 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -280,7 +280,7 @@
 	if (ret == 0) {
 		if (!try_module_get(dev->driver->module)) {
 			comedi_device_detach(dev);
-			return -ENOSYS;
+			ret = -ENOSYS;
 		}
 	}
 
diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c
index 97e8d3d..7322c16 100644
--- a/drivers/staging/iio/adc/ad7606_core.c
+++ b/drivers/staging/iio/adc/ad7606_core.c
@@ -235,6 +235,7 @@
 		.indexed = 1,				\
 		.channel = num,				\
 		.address = num,				\
+		.info_mask = IIO_CHAN_INFO_SCALE_SHARED_BIT, \
 		.scan_index = num,			\
 		.scan_type = IIO_ST('s', 16, 16, 0),	\
 	}
diff --git a/drivers/staging/prima/CORE/BAP/inc/bapApi.h b/drivers/staging/prima/CORE/BAP/inc/bapApi.h
index 570be8f..7de6ca2 100644
--- a/drivers/staging/prima/CORE/BAP/inc/bapApi.h
+++ b/drivers/staging/prima/CORE/BAP/inc/bapApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/inc/btampHCI.h b/drivers/staging/prima/CORE/BAP/inc/btampHCI.h
index d506417..c7d3e97 100644
--- a/drivers/staging/prima/CORE/BAP/inc/btampHCI.h
+++ b/drivers/staging/prima/CORE/BAP/inc/btampHCI.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapApiData.c b/drivers/staging/prima/CORE/BAP/src/bapApiData.c
index 5c35b4b..0875e31 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapApiData.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapApiData.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapApiDebug.c b/drivers/staging/prima/CORE/BAP/src/bapApiDebug.c
index 00ffcfa..5a334e3 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapApiDebug.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapApiDebug.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapApiExt.c b/drivers/staging/prima/CORE/BAP/src/bapApiExt.c
index 5b9ba26..0a1bcab 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapApiExt.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapApiExt.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapApiExt.h b/drivers/staging/prima/CORE/BAP/src/bapApiExt.h
index 7b714df..df18071 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapApiExt.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapApiExt.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapApiHCBB.c b/drivers/staging/prima/CORE/BAP/src/bapApiHCBB.c
index dd21a59..c0c777c 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapApiHCBB.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapApiHCBB.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapApiInfo.c b/drivers/staging/prima/CORE/BAP/src/bapApiInfo.c
index c622999..4e43c84 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapApiInfo.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapApiInfo.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapApiLinkCntl.c b/drivers/staging/prima/CORE/BAP/src/bapApiLinkCntl.c
index 94876c4..e52a33d 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapApiLinkCntl.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapApiLinkCntl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapApiLinkSupervision.c b/drivers/staging/prima/CORE/BAP/src/bapApiLinkSupervision.c
index b51b3b6..e446e12 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapApiLinkSupervision.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapApiLinkSupervision.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapApiStatus.c b/drivers/staging/prima/CORE/BAP/src/bapApiStatus.c
index 75e3012..26a3e5d 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapApiStatus.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapApiStatus.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapApiTimer.c b/drivers/staging/prima/CORE/BAP/src/bapApiTimer.c
index 681800a..621507f 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapApiTimer.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapApiTimer.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapApiTimer.h b/drivers/staging/prima/CORE/BAP/src/bapApiTimer.h
index 233de09..1d86dab 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapApiTimer.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapApiTimer.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapInternal.h b/drivers/staging/prima/CORE/BAP/src/bapInternal.h
index ad752b5..7cfdc03 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapInternal.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapInternal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapModule.c b/drivers/staging/prima/CORE/BAP/src/bapModule.c
index 1e78de6..3acdec2 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapModule.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapModule.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xAuthFsm.c b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xAuthFsm.c
index 968c4f0..9c89829 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xAuthFsm.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xAuthFsm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xAuthFsm.h b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xAuthFsm.h
index 518daf9..f47d207 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xAuthFsm.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xAuthFsm.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xFsm.h b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xFsm.h
index 70a6fdd..422c7ff 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xFsm.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xFsm.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xPrf.c b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xPrf.c
index e319d76..ffcf863 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xPrf.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xPrf.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xPrf.h b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xPrf.h
index a36de33..e83ce38 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xPrf.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xPrf.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xSuppRsnFsm.c b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xSuppRsnFsm.c
index 215e453..7a8a4cb 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xSuppRsnFsm.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xSuppRsnFsm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xSuppRsnFsm.h b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xSuppRsnFsm.h
index e95a8d9..6c46a84 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsn8021xSuppRsnFsm.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsn8021xSuppRsnFsm.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnAsfPacket.c b/drivers/staging/prima/CORE/BAP/src/bapRsnAsfPacket.c
index c8037ad..b45925e 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnAsfPacket.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnAsfPacket.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnAsfPacket.h b/drivers/staging/prima/CORE/BAP/src/bapRsnAsfPacket.h
index 8f6dec6..e8a933d 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnAsfPacket.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnAsfPacket.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnErrors.h b/drivers/staging/prima/CORE/BAP/src/bapRsnErrors.h
index 7919859..1da6d59 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnErrors.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnErrors.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmAesKeyWrap.c b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmAesKeyWrap.c
index ec05ed4..fa97b88 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmAesKeyWrap.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmAesKeyWrap.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmAesKeyWrap.h b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmAesKeyWrap.h
index 226d20a..428c1a3 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmAesKeyWrap.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmAesKeyWrap.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmEapol.c b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmEapol.c
index 3112ecf..6d12fdc 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmEapol.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmEapol.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmEapol.h b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmEapol.h
index fef99fe..24fed8e 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmEapol.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmEapol.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmReplayCtr.c b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmReplayCtr.c
index 332d1bb..db919a6 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmReplayCtr.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmReplayCtr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmReplayCtr.h b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmReplayCtr.h
index 956e904..33c9f06 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmReplayCtr.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmReplayCtr.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmServices.h b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmServices.h
index 03d777d..023cf57 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnSsmServices.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnSsmServices.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnTxRx.c b/drivers/staging/prima/CORE/BAP/src/bapRsnTxRx.c
index d0cad2d..f13a65f 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnTxRx.c
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnTxRx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/bapRsnTxRx.h b/drivers/staging/prima/CORE/BAP/src/bapRsnTxRx.h
index 1829a1b..d460268 100644
--- a/drivers/staging/prima/CORE/BAP/src/bapRsnTxRx.h
+++ b/drivers/staging/prima/CORE/BAP/src/bapRsnTxRx.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/btampFsm.c b/drivers/staging/prima/CORE/BAP/src/btampFsm.c
index 4819fe9..0842fc2 100644
--- a/drivers/staging/prima/CORE/BAP/src/btampFsm.c
+++ b/drivers/staging/prima/CORE/BAP/src/btampFsm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/btampFsm.h b/drivers/staging/prima/CORE/BAP/src/btampFsm.h
index 71a85fe..d03c511 100644
--- a/drivers/staging/prima/CORE/BAP/src/btampFsm.h
+++ b/drivers/staging/prima/CORE/BAP/src/btampFsm.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/btampFsm_ext.h b/drivers/staging/prima/CORE/BAP/src/btampFsm_ext.h
index 0a586b5..4570825 100644
--- a/drivers/staging/prima/CORE/BAP/src/btampFsm_ext.h
+++ b/drivers/staging/prima/CORE/BAP/src/btampFsm_ext.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/btampHCI.c b/drivers/staging/prima/CORE/BAP/src/btampHCI.c
index 093e22f..a16f926 100644
--- a/drivers/staging/prima/CORE/BAP/src/btampHCI.c
+++ b/drivers/staging/prima/CORE/BAP/src/btampHCI.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/BAP/src/fsmDefs.h b/drivers/staging/prima/CORE/BAP/src/fsmDefs.h
index 3c5cc53..182fbee 100644
--- a/drivers/staging/prima/CORE/BAP/src/fsmDefs.h
+++ b/drivers/staging/prima/CORE/BAP/src/fsmDefs.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/DXE/inc/wlan_qct_dxe.h b/drivers/staging/prima/CORE/DXE/inc/wlan_qct_dxe.h
index 12d50a2..80665b8 100644
--- a/drivers/staging/prima/CORE/DXE/inc/wlan_qct_dxe.h
+++ b/drivers/staging/prima/CORE/DXE/inc/wlan_qct_dxe.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -392,31 +392,6 @@
    void *pDXEContext
 );
 
-/*==========================================================================
-  @  Function Name 
-    WLANDXE_ChannelDebug
-
-  @  Description 
-    Display DXE Channel debugging information
-    User may request to display DXE channel snapshot
-    Or if host driver detects any abnormal stcuk may display
-
-  @  Parameters
-    displaySnapshot : Dispaly DXE snapshot option
-    enableStallDetect : Enable stall detect feature
-                        This feature will take effect to data performance
-                        Not integrate till fully verification
-
-  @  Return
-    NONE
-
-===========================================================================*/
-void WLANDXE_ChannelDebug
-(
-   wpt_boolean    displaySnapshot,
-   wpt_boolean    enableStallDetect   
-);
-
 #ifdef WLANDXE_TEST_CHANNEL_ENABLE
 /*==========================================================================
   @  Function Name 
diff --git a/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe.c b/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe.c
index 9476015..9a7a584 100644
--- a/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe.c
+++ b/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -77,9 +77,6 @@
 #define T_WLANDXE_TX_INT_ENABLE_FCOUNT     1
 #define T_WLANDXE_MEMDUMP_BYTE_PER_LINE    16
 #define T_WLANDXE_MAX_RX_PACKET_WAIT       6000
-#define T_WLANDXE_PERIODIC_HEALTH_M_TIME   1500
-#define T_WLANDXE_MAX_HW_ACCESS_WAIT       2000
-#define WLANDXE_MAX_REAPED_RX_FRAMES       512
 
 /* This is temporary fot the compile
  * WDI will release official version
@@ -91,6 +88,7 @@
   *-------------------------------------------------------------------------*/
 /* This is temp, someone have to allocate for me, and must be part of global context */
 static WLANDXE_CtrlBlkType    *tempDxeCtrlBlk                = NULL;
+#ifdef WLAN_DEBUG
 static char                   *channelType[WDTS_CHANNEL_MAX] =
    {
       "TX_LOW_PRI",
@@ -103,7 +101,7 @@
       "H2H_TEST_RX"
 #endif /* WLANDXE_TEST_CHANNEL_ENABLE */
    };
-static  wpt_packet               *rx_reaped_buf[WLANDXE_MAX_REAPED_RX_FRAMES];
+#endif
 
 /*-------------------------------------------------------------------------
   *  External Function Proto Type
@@ -119,15 +117,10 @@
    WLANDXE_DescCtrlBlkType  *currentCtrlBlock
 );
 
-static wpt_status dxeNotifySmsm
-(
-  wpt_boolean kickDxe,
-  wpt_boolean ringEmpty
-);
-
 /*-------------------------------------------------------------------------
   *  Local Function
   *-------------------------------------------------------------------------*/
+#ifdef WLANDXE_DEBUG_CH_INFO_DUMP
 /*==========================================================================
   @  Function Name 
       dxeChannelMonitor
@@ -150,43 +143,28 @@
 {
    wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
 
-   if((NULL == monitorDescription) || (NULL == channelEntry))
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-               "INVALID Input ARG");
-      return eWLAN_PAL_STATUS_E_INVAL;
-   }
-
-   if(channelEntry->channelType > WDTS_CHANNEL_RX_HIGH_PRI)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-               "INVALID Channel type");
-      return eWLAN_PAL_STATUS_E_INVAL;
-   }
-
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "=== %s Channel Number %d, Channel Type %s",
             monitorDescription, channelEntry->assignedDMAChannel, channelType[channelEntry->channelType]);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL, 
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW, 
             "numDesc %d, numFreeDesc %d, numResvDesc %d",
                    channelEntry->numDesc, channelEntry->numFreeDesc, channelEntry->numRsvdDesc);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "headCB 0x%x, next 0x%x,  DESC 0x%x",
                    channelEntry->headCtrlBlk, channelEntry->headCtrlBlk->nextCtrlBlk, channelEntry->headCtrlBlk->linkedDescPhyAddr);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "tailCB 0x%x, next 0x%x,  DESC 0x%x",
                    channelEntry->tailCtrlBlk, channelEntry->tailCtrlBlk->nextCtrlBlk, channelEntry->tailCtrlBlk->linkedDescPhyAddr);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "headCB Order %d, tailCB Order %d",
             channelEntry->headCtrlBlk->ctrlBlkOrder, channelEntry->tailCtrlBlk->ctrlBlkOrder);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "numFragmentCurrentChain %d, numTotalFrame %d ===",
             channelEntry->numFragmentCurrentChain,    channelEntry->numTotalFrame);
 
    return status;
 }
 
-#ifdef WLANDXE_DEBUG_MEMORY_DUMP
 /*==========================================================================
   @  Function Name 
       dxeMemoryDump
@@ -212,12 +190,6 @@
    wpt_uint32                numBytes    = 0;
    wpt_uint32                idx;
 
-   if((NULL == dumpPointer) ||
-      (NULL == dumpTarget))
-   {
-      return status;
-   }
-
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
@@ -242,7 +214,6 @@
 
    return status;
 }
-#endif /* WLANDXE_DEBUG_MEMORY_DUMP */
 
 /*==========================================================================
   @  Function Name 
@@ -268,24 +239,24 @@
    wpt_status                status      = eWLAN_PAL_STATUS_SUCCESS;
 
 
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "Descriptor Dump for channel %s, %d / %d fragment",
                    channelType[channelEntry->channelType],
                    fragmentOrder + 1,
                    channelEntry->numFragmentCurrentChain);
 
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "CTRL WORD 0x%x, TransferSize %d",
                    WLANDXE_U32_SWAP_ENDIAN(targetDesc->descCtrl.ctrl),
             WLANDXE_U32_SWAP_ENDIAN(targetDesc->xfrSize));
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "SRC ADD 0x%x, DST ADD 0x%x, NEXT DESC 0x%x",
                    WLANDXE_U32_SWAP_ENDIAN(targetDesc->dxedesc.dxe_short_desc.srcMemAddrL),
                    WLANDXE_U32_SWAP_ENDIAN(targetDesc->dxedesc.dxe_short_desc.dstMemAddrL),
                    WLANDXE_U32_SWAP_ENDIAN(targetDesc->dxedesc.dxe_short_desc.phyNextL));
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
 
    return status;
@@ -314,507 +285,39 @@
    wpt_status                status      = eWLAN_PAL_STATUS_SUCCESS;
    wpt_uint32                regValue    = 0;
 
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Channel register dump for %s, base address 0x%x", 
                    channelType[channelEntry->channelType],
                    dumpTarget,
                    channelEntry->channelRegister.chDXEBaseAddr);
    regValue = 0;
    wpalReadRegister(channelEntry->channelRegister.chDXECtrlRegAddr, &regValue);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "Control Register 0x%x", regValue);
 
    regValue = 0;
    wpalReadRegister(channelEntry->channelRegister.chDXEStatusRegAddr, &regValue);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "Status Register 0x%x", regValue);
    regValue = 0;
 
    wpalReadRegister(channelEntry->channelRegister.chDXESadrlRegAddr, &regValue);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "Source Address Register 0x%x", regValue);
    regValue = 0;
 
    wpalReadRegister(channelEntry->channelRegister.chDXEDadrlRegAddr, &regValue);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "Destination Address Register 0x%x", regValue);
    regValue = 0;
 
    wpalReadRegister(channelEntry->channelRegister.chDXELstDesclRegAddr, &regValue);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-            "Last Descriptor Address Register 0x%x", regValue);
-
-   wpalReadRegister(channelEntry->channelRegister.chDXEDesclRegAddr, &regValue);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-            "Next Descriptor Address Register 0x%x", regValue);
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "Descriptor Address Register 0x%x", regValue);
 
    return status;
 }
-
-/*==========================================================================
-  @  Function Name 
-      dxeChannelAllDescDump
-
-  @  Description 
-      Dump all DXE descriptors within assigned channe;
-
-  @  Parameters
-      WLANDXE_ChannelCBType   *channelEntry
-
-  @  Return
-      NONE
-
-===========================================================================*/
-void dxeChannelAllDescDump
-(
-   WLANDXE_ChannelCBType   *channelEntry,
-   WDTS_ChannelType         channel
-)
-{
-   wpt_uint32               channelLoop;
-   WLANDXE_DescCtrlBlkType *targetCtrlBlk;
-   wpt_uint32               previousCtrlValue = 0;
-
-   targetCtrlBlk = channelEntry->headCtrlBlk;
-
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-            "%s %d descriptor chains, head desc ctrl 0x%x",
-            channelType[channelEntry->channelType],
-            channelEntry->numDesc,
-            targetCtrlBlk->linkedDesc->descCtrl.ctrl);
-   previousCtrlValue = targetCtrlBlk->linkedDesc->descCtrl.ctrl;
-
-   if((WDTS_CHANNEL_RX_LOW_PRI == channel) ||
-      (WDTS_CHANNEL_RX_HIGH_PRI == channel))
-   {
-      for(channelLoop = 0; channelLoop < channelEntry->numDesc; channelLoop++)
-      {
-         if(previousCtrlValue != targetCtrlBlk->linkedDesc->descCtrl.ctrl)
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                     "%5d : 0x%x", targetCtrlBlk->ctrlBlkOrder,
-                     targetCtrlBlk->linkedDesc->descCtrl.ctrl);
-         }
-         previousCtrlValue = targetCtrlBlk->linkedDesc->descCtrl.ctrl;
-         targetCtrlBlk = (WLANDXE_DescCtrlBlkType *)targetCtrlBlk->nextCtrlBlk;
-      }
-   }
-   else
-   {
-      for(channelLoop = 0; channelLoop < channelEntry->numDesc; channelLoop++)
-      {
-         if(targetCtrlBlk->linkedDesc->descCtrl.ctrl & WLANDXE_DESC_CTRL_VALID)
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                     "%5d : 0x%x", targetCtrlBlk->ctrlBlkOrder,
-                     targetCtrlBlk->linkedDesc->descCtrl.ctrl);
-         }
-         targetCtrlBlk = (WLANDXE_DescCtrlBlkType *)targetCtrlBlk->nextCtrlBlk;
-      }
-   }
-   return;
-}
-
-/*==========================================================================
-  @  Function Name 
-      dxeTxThreadChannelDebugHandler
-
-  @  Description 
-      Dump TX channel information
-
-  @  Parameters
-      Wwpt_msg               *msgPtr
-
-  @  Return
-      NONE
-
-===========================================================================*/
-void dxeTxThreadChannelDebugHandler
-(
-    wpt_msg               *msgPtr
-)
-{
-   wpt_uint8                channelLoop;
-
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-            "%s Enter", __FUNCTION__);
-
-   /* Whatever RIVA power condition try to wakeup RIVA through SMSM
-    * This will not simply wakeup RIVA
-    * Just incase TX not wanted stuck, Trigger TX again */
-   dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_FALSE);
-   for(channelLoop = 0; channelLoop < WDTS_CHANNEL_RX_LOW_PRI; channelLoop++)
-   {
-      dxeChannelMonitor("******** Get Descriptor Snapshot ",
-                        &tempDxeCtrlBlk->dxeChannel[channelLoop]);
-      dxeDescriptorDump(&tempDxeCtrlBlk->dxeChannel[channelLoop],
-                        tempDxeCtrlBlk->dxeChannel[channelLoop].tailCtrlBlk->linkedDesc,
-                        0);
-      dxeChannelRegisterDump(&tempDxeCtrlBlk->dxeChannel[channelLoop],
-                             "Abnormal successive empty interrupt");
-      dxeChannelAllDescDump(&tempDxeCtrlBlk->dxeChannel[channelLoop], channelLoop);
-   }
-
-   wpalMemoryFree(msgPtr);
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-            "%s Exit", __FUNCTION__);
-   return;
-}
-
-/*==========================================================================
-  @  Function Name 
-      dxeRxThreadChannelDebugHandler
-
-  @  Description 
-      Dump RX channel information
-
-  @  Parameters
-      Wwpt_msg               *msgPtr
-
-  @  Return
-      NONE
-
-===========================================================================*/
-void dxeRxThreadChannelDebugHandler
-(
-    wpt_msg               *msgPtr
-)
-{
-   wpt_status               status = eWLAN_PAL_STATUS_SUCCESS;
-   wpt_uint8                channelLoop;
-
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-            "%s Enter", __FUNCTION__);
-
-   /* Whatever RIVA power condition try to wakeup RIVA through SMSM
-    * This will not simply wakeup RIVA
-    * Just incase TX not wanted stuck, Trigger TX again */
-   dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_FALSE);
-   for(channelLoop = WDTS_CHANNEL_RX_LOW_PRI; channelLoop < WDTS_CHANNEL_MAX; channelLoop++)
-   {
-      dxeChannelMonitor("******** Get Descriptor Snapshot ",
-                        &tempDxeCtrlBlk->dxeChannel[channelLoop]);
-      dxeDescriptorDump(&tempDxeCtrlBlk->dxeChannel[channelLoop],
-                        tempDxeCtrlBlk->dxeChannel[channelLoop].headCtrlBlk->linkedDesc,
-                        0);
-      dxeChannelRegisterDump(&tempDxeCtrlBlk->dxeChannel[channelLoop],
-                             "Abnormal successive empty interrupt");
-      dxeChannelAllDescDump(&tempDxeCtrlBlk->dxeChannel[channelLoop], channelLoop);
-   }
-
-   /* Now serialise the message through Tx thread also to make sure
-    * no register access when RIVA is in powersave */
-   /*Use the same message pointer just change the call back function */
-   msgPtr->callback = dxeTxThreadChannelDebugHandler;
-   status = wpalPostTxMsg(WDI_GET_PAL_CTX(),
-                          msgPtr);
-   if ( eWLAN_PAL_STATUS_SUCCESS != status )
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "Tx thread Set power state req serialize fail status=%d",
-               status, 0, 0);
-   }
-
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-            "%s Exit", __FUNCTION__);
-   return;
-}
-
-/*==========================================================================
-  @  Function Name 
-      dxeRXHealthMonitor
-
-  @  Description 
-      Monitoring RX channel healthy stataus
-      If detect any problem, try to recover
-
-  @  Parameters
-      healthMonitorMsg    MSG pointer.
-                          will have low resource TX channel context
-
-  @  Return
-      NONE
-
-===========================================================================*/
-void dxeRXHealthMonitor
-(
-   wpt_msg         *healthMonitorMsg
-)
-{
-   WLANDXE_ChannelCBType    *channelCtrlBlk;
-   WLANDXE_ChannelCBType    *testCHCtrlBlk;
-   wpt_uint32                regValue;
-   wpt_uint32                chStatusReg, chControlReg, chDescReg, chLDescReg;
-   wpt_uint32                hwWakeLoop, chLoop;
-
-   if(NULL == healthMonitorMsg)
-   {
-      return;
-   }
-
-   /* Make wake up HW */
-   dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
-   dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
-
-   for(hwWakeLoop = 0; hwWakeLoop < T_WLANDXE_MAX_HW_ACCESS_WAIT; hwWakeLoop++)
-   {
-      wpalReadRegister(WLANDXE_BMU_AVAILABLE_BD_PDU, &regValue);
-      if(0 != regValue)
-      {
-         break;
-      }
-   }
-
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-            "Scheduled RX, num free BD/PDU %d, loop Count %d",
-            regValue, hwWakeLoop, 0);
-
-   for(chLoop = WDTS_CHANNEL_RX_LOW_PRI; chLoop < WDTS_CHANNEL_MAX; chLoop++)
-   {
-      testCHCtrlBlk = &tempDxeCtrlBlk->dxeChannel[chLoop];
-      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXECtrlRegAddr, &chControlReg);
-      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXEStatusRegAddr, &chStatusReg);
-      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXEDesclRegAddr, &chDescReg);
-      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXELstDesclRegAddr, &chLDescReg);
-
-      wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
-                channelType[chLoop],
-                chControlReg, chStatusReg, chDescReg, chLDescReg,
-                testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
-                testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
-                testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
-                testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
-
-      if((chControlReg & WLANDXE_DESC_CTRL_VALID) && 
-         (chLDescReg != testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr))
-      {
-         wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                   "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, "
-                   "HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
-                   channelType[chLoop],
-                   chControlReg, chStatusReg, chDescReg, chLDescReg,
-                   testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
-                   testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
-                   testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
-                   testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "%11s : RX CH EN Descriptor Async, resync it", channelType[chLoop], 0, 0);
-         wpalWriteRegister(testCHCtrlBlk->channelRegister.chDXELstDesclRegAddr,
-                           testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr);
-      }
-      else if(!(chControlReg & WLANDXE_DESC_CTRL_VALID) && 
-               (chDescReg != testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr))
-      {
-         wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                   "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, "
-                   "HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
-                   channelType[chLoop],
-                   chControlReg, chStatusReg, chDescReg, chLDescReg,
-                   testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
-                   testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
-                   testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
-                   testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "%11s : RX CH DIS Descriptor Async, resync it", channelType[chLoop], 0, 0);
-         wpalWriteRegister(testCHCtrlBlk->channelRegister.chDXEDesclRegAddr,
-                           testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr);
-      }
-   }
-
-   channelCtrlBlk = (WLANDXE_ChannelCBType *)healthMonitorMsg->pContext;
-   if(channelCtrlBlk->hitLowResource)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "%11s : Still Low Resource, kick DXE TX and restart timer",
-               channelType[channelCtrlBlk->channelType], 0, 0);
-      /* Still Low Resource, Kick DXE again and start timer again */
-      wpalTimerStart(&channelCtrlBlk->healthMonitorTimer,
-                     T_WLANDXE_PERIODIC_HEALTH_M_TIME);
-   }
-   else
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "%11s : Out from Low resource condition, do nothing",
-               channelType[channelCtrlBlk->channelType], 0, 0);
-      /* Recovered from low resource condition
-       * Not need to do anything */
-   }
-
-   return;
-}
-
-/*==========================================================================
-  @  Function Name 
-      dxeTXHealthMonitor
-
-  @  Description 
-      Monitoring TX channel healthy stataus
-      If detect any problem, try to recover
-
-  @  Parameters
-      healthMonitorMsg    MSG pointer.
-                          will have low resource TX channel context
-
-  @  Return
-      NONE
-
-===========================================================================*/
-void dxeTXHealthMonitor
-(
-   wpt_msg         *healthMonitorMsg
-)
-{
-   WLANDXE_ChannelCBType    *channelCtrlBlk;
-   WLANDXE_ChannelCBType    *testCHCtrlBlk;
-   wpt_uint32                regValue;
-   wpt_uint32                chStatusReg, chControlReg, chDescReg, chLDescReg;
-   wpt_uint32                hwWakeLoop, chLoop;
-   wpt_status                status  = eWLAN_PAL_STATUS_SUCCESS;
-
-   if(NULL == healthMonitorMsg)
-   {
-      return;
-   }
-
-   /* First of all kick TX channel
-    * This will fix if there is any problem with SMSM state */
-   dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
-   dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
-
-   /* Wait till RIVA up */
-   for(hwWakeLoop = 0; hwWakeLoop < T_WLANDXE_MAX_HW_ACCESS_WAIT; hwWakeLoop++)
-   {
-      wpalReadRegister(WLANDXE_BMU_AVAILABLE_BD_PDU, &regValue);
-      if(0 != regValue)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "num free BD/PDU %d, loop Count %d",
-                  regValue, hwWakeLoop, 0);
-         break;
-      }
-   }
-
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-            "Scheduled TX, num free BD/PDU %d, loop Count %d",
-            regValue, hwWakeLoop, 0);
-
-   for(chLoop = 0; chLoop < WDTS_CHANNEL_RX_LOW_PRI; chLoop++)
-   {
-      testCHCtrlBlk = &tempDxeCtrlBlk->dxeChannel[chLoop];
-      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXECtrlRegAddr, &chControlReg);
-      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXEStatusRegAddr, &chStatusReg);
-      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXEDesclRegAddr, &chDescReg);
-      wpalReadRegister(testCHCtrlBlk->channelRegister.chDXELstDesclRegAddr, &chLDescReg);
-
-      wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-                "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
-                channelType[chLoop],
-                chControlReg, chStatusReg, chDescReg, chLDescReg,
-                testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
-                testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
-                testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
-                testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
-
-      if((chControlReg & WLANDXE_DESC_CTRL_VALID) && 
-         (chLDescReg != testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr))
-      {
-         wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                   "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, "
-                   "HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
-                   channelType[chLoop],
-                   chControlReg, chStatusReg, chDescReg, chLDescReg,
-                   testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
-                   testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
-                   testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
-                   testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "%11s : TX CH EN Descriptor Async, resync it", channelType[chLoop], 0, 0);
-         wpalWriteRegister(testCHCtrlBlk->channelRegister.chDXELstDesclRegAddr,
-                           testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr);
-      }
-      else if(!(chControlReg & WLANDXE_DESC_CTRL_VALID) && 
-               (chDescReg != testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr))
-      {
-         wpalTrace(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                   "%11s : CCR 0x%x, CSR 0x%x, CDR 0x%x, CLDR 0x%x, "
-                   "HCBO %d, HCBDP 0x%x, HCBDC 0x%x, TCBO %d,TCBDP 0x%x, TCBDC 0x%x",
-                   channelType[chLoop],
-                   chControlReg, chStatusReg, chDescReg, chLDescReg,
-                   testCHCtrlBlk->headCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->headCtrlBlk->linkedDescPhyAddr,
-                   testCHCtrlBlk->headCtrlBlk->linkedDesc->descCtrl.ctrl,
-                   testCHCtrlBlk->tailCtrlBlk->ctrlBlkOrder, testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr,
-                   testCHCtrlBlk->tailCtrlBlk->linkedDesc->descCtrl.ctrl);
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "%11s : TX CH DIS Descriptor Async, resync it", channelType[chLoop], 0, 0);
-         wpalWriteRegister(testCHCtrlBlk->channelRegister.chDXEDesclRegAddr,
-                           testCHCtrlBlk->tailCtrlBlk->linkedDescPhyAddr);
-      }
-   }
-
-   /* TX channel test done, test RX channels */
-   channelCtrlBlk = (WLANDXE_ChannelCBType *)healthMonitorMsg->pContext;
-   channelCtrlBlk->healthMonitorMsg->callback = dxeRXHealthMonitor;
-   status = wpalPostRxMsg(WDI_GET_PAL_CTX(),
-                          channelCtrlBlk->healthMonitorMsg);
-   if (eWLAN_PAL_STATUS_SUCCESS != status)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "TX Low resource Kick DXE MSG Serialize fail",
-               status, 0, 0);
-   }
-
-   return;
-}
-
-/*==========================================================================
-  @  Function Name 
-      dxeHealthMonitorTimeout
-
-  @  Description 
-      Health Monitor timer started when TX channel low resource condition
-      And if reciovered from low resource condition, timer would not fired
-      Timer fired means during certain time, TX CH could not be recovered
-
-  @  Parameters
-      channelCtxt   Low resource condition happen Channel context
-
-  @  Return
-      NONE
-
-===========================================================================*/
-void dxeHealthMonitorTimeout
-(
-   void         *channelCtxt
-)
-{
-   WLANDXE_ChannelCBType    *channelCtrlBlk;
-   wpt_status                status  = eWLAN_PAL_STATUS_SUCCESS;
-
-   if(NULL == channelCtxt)
-   {
-      return;
-   }
-
-   /* Timeout Fired, DXE TX should kick on TX thread
-    * Serailize to TX Thread */
-   channelCtrlBlk = (WLANDXE_ChannelCBType *)channelCtxt;
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
-            "%11s : Health Monitor timer expired",
-            channelType[channelCtrlBlk->channelType], 0, 0);
-
-   channelCtrlBlk->healthMonitorMsg->callback = dxeTXHealthMonitor;
-   status = wpalPostTxMsg(WDI_GET_PAL_CTX(),
-                          channelCtrlBlk->healthMonitorMsg);
-   if (eWLAN_PAL_STATUS_SUCCESS != status)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "TX Low resource Kick DXE MSG Serialize fail",
-               status, 0, 0);
-   }
-
-   return;
-}
+#endif /* WLANDXE_DEBUG_CH_INFO_DUMP */
 
 /*==========================================================================
   @  Function Name 
@@ -848,14 +351,17 @@
    WLANDXE_DescCtrlBlkType  *prevCtrlBlk = NULL;
    WLANDXE_DescCtrlBlkType  *nextCtrlBlk = NULL;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Sanity check */
    if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeCtrlBlkAlloc Channel Entry is not valid");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -865,9 +371,11 @@
       currentCtrlBlk = (WLANDXE_DescCtrlBlkType *)wpalMemoryAllocate(sizeof(WLANDXE_DescCtrlBlkType));
       if(NULL == currentCtrlBlk)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeCtrlBlkOpen MemAlloc Fail for channel %d",
                   channelEntry->channelType);
+#endif
          freeCtrlBlk = channelEntry->headCtrlBlk;
          for(fIdx = 0; fIdx < idx; fIdx++)
          {
@@ -915,9 +423,11 @@
       }
       else
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeCtrlBlkOpen Invalid Ctrl Blk location %d",
                   channelEntry->channelType);
+#endif
          wpalMemoryFree(currentCtrlBlk);
          return eWLAN_PAL_STATUS_E_FAULT;
       }
@@ -926,7 +436,9 @@
       channelEntry->numFreeDesc++;
    }
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,"%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -966,14 +478,17 @@
    WLANDXE_DescCtrlBlkType  *currDescCtrlBlk = testTXChannelCB->headCtrlBlk;
 #endif /* WLANDXE_TEST_CHANNEL_ENABLE*/
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Sanity Check */
    if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeDescLinkAlloc Channel Entry is not valid");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -986,8 +501,10 @@
                             &physAddress);
    if(NULL == channelEntry->descriptorAllocation)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeDescLinkAlloc Descriptor Alloc Fail");
+#endif
       return eWLAN_PAL_STATUS_E_RESOURCES;
    }
    currentDesc = channelEntry->descriptorAllocation;
@@ -1000,8 +517,10 @@
 #ifndef WLANDXE_TEST_CHANNEL_ENABLE
       // descriptors were allocated in a chunk -- use the current one
       memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
                "Allocated Descriptor VA 0x%x, PA 0x%x", currentDesc, physAddress);
+#endif
 #else
       if(WDTS_CHANNEL_H2H_TEST_RX != channelEntry->channelType)
       {
@@ -1021,15 +540,19 @@
 #ifndef WLANDXE_TEST_CHANNEL_ENABLE
       currentDesc = (WLANDXE_DescType *)wpalAcpuDdrDxeDescMemoryAllocate(&physAddress);
       memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
                "Allocated Descriptor VA 0x%x, PA 0x%x", currentDesc, physAddress);
+#endif
 #else
       if(WDTS_CHANNEL_H2H_TEST_RX != channelEntry->channelType)
       {
          currentDesc = (WLANDXE_DescType *)wpalAcpuDdrDxeDescMemoryAllocate(&physAddress);
          memset((wpt_uint8 *)currentDesc, 0, sizeof(WLANDXE_DescType));
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
                   "Allocated Descriptor VA 0x%x, PA 0x%x", currentDesc, physAddress);
+#endif
       }
       else
       {
@@ -1041,9 +564,11 @@
 #endif /* FEATURE_R33D */
       if(NULL == currentDesc)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeDescLinkAlloc MemAlloc Fail for channel %d",
                   channelEntry->channelType);
+#endif
          return eWLAN_PAL_STATUS_E_FAULT;
       }
 
@@ -1111,9 +636,11 @@
                                               currentCtrlBlk);
          if( !WLAN_PAL_IS_STATUS_SUCCESS(status) )
          {
+#ifdef WLAN_DEBUG
             HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                      "dxeDescLinkAlloc RX Buffer Alloc Fail for channel %d",
                      channelEntry->channelType);
+#endif
             return status;
          }
          --channelEntry->numFreeDesc;
@@ -1130,9 +657,10 @@
 #endif
 #endif
    }
-
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -1157,9 +685,10 @@
    wpt_uint32                 idx;
    WLANDXE_ChannelCBType     *channelEntry = NULL;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
    {
       channelEntry = &dxeCtrlBlk->dxeChannel[idx];
@@ -1179,19 +708,25 @@
       {
          interruptPath |= (1 << (channelEntry->assignedDMAChannel + 16));
       }
+#ifdef WLAN_DEBUG
       else
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "H2H TEST RX???? %d", channelEntry->channelType);
       }
+#endif
    }
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
             "Interrupt Path Must be 0x%x", interruptPath);
+#endif
    dxeCtrlBlk->interruptPath = interruptPath;
    wpalWriteRegister(WLANDXE_CCU_DXE_INT_SELECT, interruptPath);
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -1218,9 +753,10 @@
    wpt_status                 status = eWLAN_PAL_STATUS_SUCCESS;
    wpt_uint32                 registerData = 0;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* START This core init is not needed for the integrated system */
    /* Reset First */
    registerData = WLANDXE_DMA_CSR_RESET_MASK;
@@ -1241,8 +777,10 @@
    /* END This core init is not needed for the integrated system */
 
    dxeSetInterruptPath(dxeCtrlBlk);
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -1283,22 +821,28 @@
    WLANDXE_DescType         *currentDesc = NULL;
    WLANDXE_DescCtrlBlkType  *currentCtrlBlk = NULL;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
+#endif
 
    /* Sanity Check */
    if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelInitProgram Channel Entry is not valid");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    /* Program Source address and destination adderss */
    if(!channelEntry->channelConfig.useShortDescFmt)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelInitProgram Long Descriptor not support yet");
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
 
@@ -1308,8 +852,10 @@
                                    channelEntry->headCtrlBlk->linkedDescPhyAddr);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelInitProgram Write DESC Address register fail");
+#endif
       return status;
    }
 
@@ -1322,8 +868,10 @@
                                       channelEntry->channelConfig.refWQ);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeChannelInitProgram Write TX DAddress register fail");
+#endif
          return status;
       }
    }
@@ -1343,8 +891,10 @@
                                       channelEntry->channelConfig.refWQ);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeChannelInitProgram Write RX SAddress WQ register fail");
+#endif
          return status;
       }
 
@@ -1353,8 +903,10 @@
                                       WLANDXE_U32_SWAP_ENDIAN(channelEntry->DescBottomLoc->dxedesc.dxe_short_desc.phyNextL));
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeChannelInitProgram Write RX DAddress register fail");
+#endif
          return status;
       }
 
@@ -1363,8 +915,10 @@
                              channelEntry->extraConfig.chan_mask);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeChannelInitProgram Write RX Control register fail");
+#endif
          return status;
       }
    }
@@ -1376,14 +930,18 @@
                                       WLANDXE_U32_SWAP_ENDIAN(channelEntry->DescBottomLoc->dxedesc.dxe_short_desc.phyNextL));
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeChannelInitProgram Write RX DAddress register fail");
+#endif
          return status;
       }
    }
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -1415,9 +973,10 @@
    wpt_uint32                regValue   = 0;
    wpt_uint32                intMaskVal = 0;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    channelEntry->extraConfig.chEnabled    = eWLAN_PAL_TRUE;
    channelEntry->extraConfig.chConfigured = eWLAN_PAL_TRUE;
 
@@ -1427,8 +986,10 @@
                                   &regValue);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelStart Read Channel Enable register fail");
+#endif
       return status;
    }
 
@@ -1437,8 +998,10 @@
                                   &intMaskVal);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelStart Read INT_MASK register fail");
+#endif
       return status;         
    }
    intMaskVal |= channelEntry->extraConfig.intMask;
@@ -1446,13 +1009,17 @@
                                    intMaskVal);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelStart Write INT_MASK register fail");
+#endif
       return status;         
    }
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -1482,14 +1049,17 @@
    wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
    wpt_uint32                intMaskVal = 0;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Sanity */
    if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelStop Invalid arg input");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL; 
    }
 
@@ -1498,8 +1068,10 @@
                                   &intMaskVal);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelStop Read INT_MASK register fail");
+#endif
       return status;         
    }
    intMaskVal ^= channelEntry->extraConfig.intMask;
@@ -1507,16 +1079,20 @@
                                    intMaskVal);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelStop Write INT_MASK register fail");
+#endif
       return status;         
    }
 
    channelEntry->extraConfig.chEnabled    = eWLAN_PAL_FALSE;
 
    /* Stop Channel ??? */
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -1553,14 +1129,17 @@
    WLANDXE_DescType         *currentDescriptor = NULL;
    WLANDXE_DescType         *nextDescriptor    = NULL;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Sanity */
    if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelStop Invalid arg input");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL; 
    }
 
@@ -1623,8 +1202,10 @@
    }
 #endif
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -1655,73 +1236,43 @@
 {
    wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
+#endif
 
    /* Read Channel Status Register to know why INT Happen */
    status = wpalReadRegister(channelEntry->channelRegister.chDXEStatusRegAddr,
                                   chStat);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelCleanInt Read CH STAT register fail");
+#endif
       return eWLAN_PAL_STATUS_E_FAULT;         
    }
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Channel INT Clean, Status 0x%x",
             channelType[channelEntry->channelType], *chStat);
-
+#endif
    /* Clean up all the INT within this channel */
    status = wpalWriteRegister(WLANDXE_INT_CLR_ADDRESS,
                                    (1 << channelEntry->assignedDMAChannel));
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeChannelCleanInt Write CH Clean register fail");
+#endif
       return eWLAN_PAL_STATUS_E_FAULT;         
    }
 
-   /* Clean up Error INT Bit */
-   if(WLANDXE_CH_STAT_INT_ERR_MASK & *chStat)
-   {
-      status = wpalWriteRegister(WLANDXE_INT_ERR_CLR_ADDRESS,
-                                      (1 << channelEntry->assignedDMAChannel));
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeChannelCleanInt Read CH STAT register fail");
-         return eWLAN_PAL_STATUS_E_FAULT;         
-      }
-   }
-
-   /* Clean up DONE INT Bit */
-   if(WLANDXE_CH_STAT_INT_DONE_MASK & *chStat)
-   {
-      status = wpalWriteRegister(WLANDXE_INT_DONE_CLR_ADDRESS,
-                                      (1 << channelEntry->assignedDMAChannel));
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeChannelCleanInt Read CH STAT register fail");
-         return eWLAN_PAL_STATUS_E_FAULT;         
-      }
-   }
-
-   /* Clean up ED INT Bit */
-   if(WLANDXE_CH_STAT_INT_ED_MASK & *chStat)
-   {
-      status = wpalWriteRegister(WLANDXE_INT_ED_CLR_ADDRESS,
-                                      (1 << channelEntry->assignedDMAChannel));
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeChannelCleanInt Read CH STAT register fail");
-         return eWLAN_PAL_STATUS_E_FAULT;         
-      }
-   }
-
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -1757,8 +1308,10 @@
    /* Simple Sanity */
    if((NULL == freePacket) || (NULL == usrData))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
                "Get Free RX Buffer fail, Critical Error");
+#endif
       HDXE_ASSERT(0);
       return;
    }
@@ -1767,15 +1320,18 @@
 
    if(WLANDXE_CTXT_COOKIE != dxeCtxt->dxeCookie)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
                "DXE Context data corrupted, Critical Error");
+#endif
       HDXE_ASSERT(0);
       return;
    }
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
             "DXE RX packet available, post MSG to RX Thread");
-
+#endif
    dxeCtxt->freeRXPacket = freePacket;
 
    /* Serialize RX Packet Available message upon RX thread */
@@ -1786,8 +1342,10 @@
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
       HDXE_ASSERT(eWLAN_PAL_STATUS_SUCCESS == status);
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
                "dxeRXPacketAvailableCB serialize fail");
+#endif
    }
 
    return;
@@ -1836,6 +1394,19 @@
    void                     *physAddress            = NULL;
 #endif /* FEATURE_R33D */
 
+#ifdef WLAN_DEBUG
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+#endif
+   /* Sanity Check */
+   if((NULL == dxeCtxt) || (NULL == channelEntry) || (NULL == currentCtrlBlock))
+   {
+#ifdef WLAN_DEBUG
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeChannelInitProgram Channel Entry is not valid");
+#endif
+      return eWLAN_PAL_STATUS_E_INVAL;
+   }
 
    currentDesc            = currentCtrlBlock->linkedDesc;
 
@@ -1863,6 +1434,10 @@
    
    if(NULL == currentPalPacketBuffer)
    {
+#ifdef WLAN_DEBUG
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+               "!!! RX PAL Packet Alloc Fail, packet will be queued when the callback is invoked !!!");
+#endif
       return eWLAN_PAL_STATUS_E_RESOURCES;
    }
 
@@ -1877,13 +1452,17 @@
                                            &virtualAddressPCIe);
    HDXE_ASSERT(0 != physicalAddressPCIe);
    HDXE_ASSERT(0 != virtualAddressPCIe);
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
             "RX Shadow Memory Va 0x%x, Pa 0x%x",
             virtualAddressPCIe, physicalAddressPCIe);
+#endif
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeRXFrameBufferAlloc Shadow Mem Alloc fail");
+#endif
       return status;
    }
    currentCtrlBlock->shadowBufferVa = virtualAddressPCIe;
@@ -1893,8 +1472,10 @@
    status = wpalLockPacketForTransfer(currentPalPacketBuffer);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeRXFrameBufferAlloc unable to lock packet");
+#endif
       return status;
    }
 
@@ -1902,8 +1483,10 @@
    status = wpalIteratorInit(&iterator, currentPalPacketBuffer);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeRXFrameBufferAlloc iterator init fail");
+#endif
       return status;
    }
    status = wpalIteratorNext(&iterator,
@@ -1912,8 +1495,10 @@
                              &allocatedSize);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeRXFrameBufferAlloc iterator Get Next pointer fail");
+#endif
       return status;
    }
    currentPalPacketBuffer->pBDPhys = physAddress;
@@ -1924,6 +1509,10 @@
    currentDesc->dxedesc.dxe_short_desc.dstMemAddrL =
                                        WLANDXE_U32_SWAP_ENDIAN((wpt_uint32)currentPalPacketBuffer->pBDPhys);
 
+#ifdef WLAN_DEBUG
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -1965,8 +1554,10 @@
 
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "dxeRXFrameRefillRing, out of RX buffer pool, break here");
+#endif
          break;
       }
 
@@ -1998,114 +1589,6 @@
 }
 
 /*==========================================================================
-  @  Function Name
-      dxeRXFrameRouteUpperLayer
-
-  @  Description 
-      Test DXE descriptors and if any RX frame pending within RING,
-      Route to upper layer
-
-  @  Parameters
-      WLANDXE_CtrlBlkType     *dxeCtrlBlk,
-                               DXE host driver main control block
-      WLANDXE_ChannelCBType   *channelEntry
-                               Channel specific control block
-  @  Return
-      -1 Any error happen
-      0  No frame pulled from RX RING
-      int number of RX frames pulled from RX ring
-
-===========================================================================*/
-static wpt_int32 dxeRXFrameRouteUpperLayer
-(
-   WLANDXE_CtrlBlkType     *dxeCtxt,
-   WLANDXE_ChannelCBType   *channelEntry
-)
-{
-   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
-   WLANDXE_DescCtrlBlkType  *currentCtrlBlk = NULL;
-   WLANDXE_DescType         *currentDesc    = NULL;
-   wpt_uint32                descCtrl, frameCount = 0, i;
-
-   currentCtrlBlk = channelEntry->headCtrlBlk;
-   currentDesc    = currentCtrlBlk->linkedDesc;
-
-   /* Descriptoe should be SWAPPED ???? */
-   descCtrl = currentDesc->descCtrl.ctrl;
-
-   /* Get frames while VALID bit is not set (DMA complete) and a data 
-    * associated with it */
-   while(!(WLANDXE_U32_SWAP_ENDIAN(descCtrl) & WLANDXE_DESC_CTRL_VALID) &&
-         (eWLAN_PAL_STATUS_SUCCESS == wpalIsPacketLocked(currentCtrlBlk->xfrFrame)) &&
-         (currentCtrlBlk->xfrFrame->pInternalData != NULL) &&
-         (frameCount < WLANDXE_MAX_REAPED_RX_FRAMES) )
-   {
-      channelEntry->numTotalFrame++;
-      channelEntry->numFreeDesc++;
-#ifdef FEATURE_R33D
-      /* Transfer Size should be */
-      currentDesc->xfrSize = WLANDXE_U32_SWAP_ENDIAN(WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE);
-      status = wpalPrepareRxFrame(&currentCtrlBlk->xfrFrame,
-                                       (wpt_uint32)currentCtrlBlk->xfrFrame->pBDPhys,
-                                       currentCtrlBlk->shadowBufferVa,
-                                       WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE);
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeRXFrameReady Prepare RX Frame fail");
-         return -1;
-      }
-      status = wpalFreeRxFrame(currentCtrlBlk->shadowBufferVa);
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeRXFrameReady Free Shadow RX Frame fail");
-         return -1;
-      }
-
-#else /* FEATURE_R33D */
-      status = wpalUnlockPacket(currentCtrlBlk->xfrFrame);
-      if (eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeRXFrameReady unable to unlock packet");
-         return -1;
-      }
-#endif /* FEATURE_R33D */
-      /* This Descriptor is valid, so linked Control block is also valid
-       * Linked Control block has pre allocated packet buffer
-       * So, just let upper layer knows preallocated frame pointer will be OK */
-      /* Reap Rx frames */ 
-      rx_reaped_buf[frameCount] = currentCtrlBlk->xfrFrame;
-      frameCount++;
-      currentCtrlBlk->xfrFrame = NULL;
-
-      /* Now try to refill the ring with empty Rx buffers to keep DXE busy */
-      dxeRXFrameRefillRing(dxeCtxt,channelEntry);
-
-      /* Test next contorl block
-       * if valid, this control block also has new RX frame must be handled */
-      currentCtrlBlk = (WLANDXE_DescCtrlBlkType *)currentCtrlBlk->nextCtrlBlk;
-      currentDesc    = currentCtrlBlk->linkedDesc;
-      descCtrl       = currentDesc->descCtrl.ctrl;
-   }
-
-   /* Update head control block
-    * current control block's valid bit was 0
-    * next trial first control block must be current control block */
-   channelEntry->headCtrlBlk = currentCtrlBlk;
-
-   /* Deliver all the reaped RX frames to upper layers */
-   i = 0;
-   while(i < frameCount) {
-      dxeCtxt->rxReadyCB(dxeCtxt->clientCtxt, rx_reaped_buf[i], channelEntry->channelType);
-      i++;
-   }
-
-   return frameCount;
-}
-
-/*==========================================================================
   @  Function Name 
       dxeRXFrameReady
 
@@ -2134,119 +1617,107 @@
    WLANDXE_DescCtrlBlkType  *currentCtrlBlk = NULL;
    WLANDXE_DescType         *currentDesc    = NULL;
    wpt_uint32                descCtrl;
-   wpt_int32                 frameCount = 0;
+   wpt_uint32                frameCount = 0;
 
-   wpt_uint32                descLoop;
-   wpt_uint32                invalidatedFound = 0;
-
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Sanity Check */
    if((NULL == dxeCtxt) || (NULL == channelEntry))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeRXFrameReady Channel Entry is not valid");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
-   frameCount = dxeRXFrameRouteUpperLayer(dxeCtxt, channelEntry);
+   currentCtrlBlk = channelEntry->headCtrlBlk;
+   currentDesc    = currentCtrlBlk->linkedDesc;
 
-   if(0 > frameCount)
+   /* Descriptoe should be SWAPPED ???? */
+   descCtrl = currentDesc->descCtrl.ctrl;
+
+   /* Get frames while VALID bit is not set (DMA complete) and a data 
+    * associated with it */
+   while(!(WLANDXE_U32_SWAP_ENDIAN(descCtrl) & WLANDXE_DESC_CTRL_VALID) &&
+         (eWLAN_PAL_STATUS_SUCCESS == wpalIsPacketLocked(currentCtrlBlk->xfrFrame)))
+   {
+      channelEntry->numTotalFrame++;
+      channelEntry->numFreeDesc++;
+#ifdef FEATURE_R33D
+      /* Transfer Size should be */
+      currentDesc->xfrSize = WLANDXE_U32_SWAP_ENDIAN(WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE);
+      status = wpalPrepareRxFrame(&currentCtrlBlk->xfrFrame,
+                                       (wpt_uint32)currentCtrlBlk->xfrFrame->pBDPhys,
+                                       currentCtrlBlk->shadowBufferVa,
+                                       WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "dxeRXFrameReady RX frame route fail");
+                  "dxeRXFrameReady Prepare RX Frame fail");
+#endif
+         return status;
+      }
+      status = wpalFreeRxFrame(currentCtrlBlk->shadowBufferVa);
+      if(eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+#ifdef WLAN_DEBUG
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXFrameReady Free Shadow RX Frame fail");
+#endif
+         return status;
+      }
+
+#else /* FEATURE_R33D */
+      status = wpalUnlockPacket(currentCtrlBlk->xfrFrame);
+      if (eWLAN_PAL_STATUS_SUCCESS != status)
+      {
+#ifdef WLAN_DEBUG
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXFrameReady unable to unlock packet");
+#endif
+         return status;
+      }
+#endif /* FEATURE_R33D */
+      if(NULL == dxeCtxt->rxReadyCB)
+      {
+#ifdef WLAN_DEBUG
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                  "dxeRXFrameReady rxReadyCB function is not registered");
+#endif
          return eWLAN_PAL_STATUS_E_INVAL;
       }
+      /* This Descriptor is valid, so linked Control block is also valid
+       * Linked Control block has pre allocated packet buffer
+       * So, just let upper layer knows preallocated frame pointer will be OK */
+      frameCount++;
+      dxeCtxt->rxReadyCB(dxeCtxt->clientCtxt,
+                         currentCtrlBlk->xfrFrame,
+                         channelEntry->channelType);
 
-  if((0 == frameCount) &&
-      ((WLANDXE_POWER_STATE_BMPS == dxeCtxt->hostPowerState) ||
-       (WLANDXE_POWER_STATE_FULL == dxeCtxt->hostPowerState)))
-   {
-      currentCtrlBlk = channelEntry->headCtrlBlk;
+      /* Now try to refill the ring with empty Rx buffers to keep DXE busy */
+      dxeRXFrameRefillRing(dxeCtxt,channelEntry);
+
+      /* Test next contorl block
+       * if valid, this control block also has new RX frame must be handled */
+      currentCtrlBlk = (WLANDXE_DescCtrlBlkType *)currentCtrlBlk->nextCtrlBlk;
       currentDesc    = currentCtrlBlk->linkedDesc;
       descCtrl       = currentDesc->descCtrl.ctrl;
-
-      if(WLANDXE_POWER_STATE_BMPS != dxeCtxt->hostPowerState)
-      {
-          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-                   "RX ISR called but no frame handled PWS %d, channel %s",
-                   (int)dxeCtxt->hostPowerState,
-                   channelType[channelEntry->channelType]);
-      }
-
-      /* Current interupt empty and previous interrupt also empty
-       * detected successive empty interrupt
-       * or first interrupt empty, this should not happen */
-      if(0 == channelEntry->numFragmentCurrentChain)
-      {
-         dxeChannelMonitor("RX Ready", channelEntry);
-         dxeDescriptorDump(channelEntry, channelEntry->headCtrlBlk->linkedDesc, 0);
-         dxeChannelRegisterDump(channelEntry, "RX successive empty interrupt");
-         dxeChannelAllDescDump(channelEntry, channelEntry->channelType);
-
-         /* Abnormal interrupt detected, try to find not validated descriptor */
-         for(descLoop = 0; descLoop < channelEntry->numDesc; descLoop++)
-         {
-            if(!(WLANDXE_U32_SWAP_ENDIAN(descCtrl) & WLANDXE_DESC_CTRL_VALID))
-            {
-               HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                        "Found Invalidated Descriptor %d", (int)descLoop);
-               if(eWLAN_PAL_STATUS_SUCCESS == wpalIsPacketLocked(currentCtrlBlk->xfrFrame))
-               {
-                  HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                           "Packet locked, Resync Host and HW");
-                  channelEntry->headCtrlBlk = currentCtrlBlk;
-                  invalidatedFound = 1;
-                  break;
-               }
-               else
-               {
-                  HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                           "Packet Not Locked, cannot transfer frame");
-               }
-            }
-            currentCtrlBlk = (WLANDXE_DescCtrlBlkType *)currentCtrlBlk->nextCtrlBlk;
-            currentDesc    = currentCtrlBlk->linkedDesc;
-            descCtrl       = currentDesc->descCtrl.ctrl;
-         }
-
-         /* Invalidated descriptor found, and that is not head descriptor
-          * This means HW/SW descriptor miss match happen, and we may recover with just resync
-          * Try re-sync here */
-         if((invalidatedFound) && (0 != descLoop))
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                     "Found New Sync location with HW, handle frames from there");
-            frameCount = dxeRXFrameRouteUpperLayer(dxeCtxt, channelEntry);
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                     "re-sync routed %d frames to upper layer", (int)frameCount);
-            channelEntry->numFragmentCurrentChain = frameCount;
-         }
-         /* Successive Empty interrupt
-          * But this case, first descriptor also invalidated, then it means head descriptor 
-          * is linked with already handled RX frame, then could not unlock RX frame
-          * This is just Out of RX buffer pool, not need to anything here */
-         else if((invalidatedFound) && (0 == descLoop))
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                     "Out of RX Low resource, and INT came in, do nothing till get RX resource");
-         }
-         /* Critical error, reload driver */
-         else
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                     "Could not found invalidated descriptor");
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                     "RX successive empty interrupt, Could not find invalidated DESC reload driver");
-            dxeCtxt->driverReloadInProcessing = eWLAN_PAL_TRUE;
-            wpalWlanReload();
-         }
-      }
    }
+
    channelEntry->numFragmentCurrentChain = frameCount;
+   /* Update head control block
+    * current control block's valid bit was 0
+    * next trial first control block must be current control block */
+   channelEntry->headCtrlBlk = currentCtrlBlk;
+
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -2274,8 +1745,9 @@
 
    if(kickDxe)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED, "Kick off DXE");
-
+#endif
      if(tempDxeCtrlBlk->lastKickOffDxe == 0)
      {
        setSt |= WPAL_SMSM_WLAN_TX_ENABLE; 
@@ -2291,24 +1763,30 @@
        HDXE_ASSERT(0);
      }
    }
+#ifdef WLAN_DEBUG
    else
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED, "no need to kick off DXE");
    }
-
+#endif
    if(ringEmpty)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED, "SMSM Tx Ring Empty");
+#endif
      clrSt |= WPAL_SMSM_WLAN_TX_RINGS_EMPTY; 
    }
    else
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED, "SMSM Tx Ring Not Empty");
+#endif
      setSt |= WPAL_SMSM_WLAN_TX_RINGS_EMPTY; 
    }
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_HIGH, "C%x S%x", clrSt, setSt);
-
+#endif
    wpalNotifySmsm(clrSt, setSt);
 
    return eWLAN_PAL_STATUS_SUCCESS;
@@ -2399,39 +1877,43 @@
    wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
    wpt_uint32                intSrc     = 0;
    WLANDXE_ChannelCBType    *channelCb  = NULL;
-   wpt_uint32                chHighStat = 0;
-   wpt_uint32                chLowStat  = 0;
+   wpt_uint32                chHighStat;
+   wpt_uint32                chLowStat;
 
-   dxeCtxt = (WLANDXE_CtrlBlkType *)(msgContent->pContext);
-
-   if(eWLAN_PAL_TRUE == dxeCtxt->driverReloadInProcessing)
+#ifdef WLAN_DEBUG
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+#endif
+   /* Sanity Check */
+   if(NULL == rxReadyMsg)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "RX Ready WLAN Driver re-loading in progress");
+               "dxeRXEventHandler Channel Entry is not valid");
+#endif
       return;
    }
 
-   /* Now try to refill the ring with empty Rx buffers to keep DXE busy */
-   dxeRXFrameRefillRing(dxeCtxt, &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI]);
-   dxeRXFrameRefillRing(dxeCtxt, &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI]);
-
    dxeCtxt = (WLANDXE_CtrlBlkType *)(msgContent->pContext);
       
    if((!dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI].extraConfig.chEnabled) ||
       (!dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI].extraConfig.chEnabled))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
          "DXE already stopped in RX event handler. Just return");
+#endif
       return;
    }
 
    if((WLANDXE_POWER_STATE_IMPS == dxeCtxt->hostPowerState) ||
       (WLANDXE_POWER_STATE_DOWN == dxeCtxt->hostPowerState))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
          "%s Riva is in %d, Just Pull frames without any register touch ",
            __FUNCTION__, dxeCtxt->hostPowerState);
-
+#endif
       /* Not to touch any register, just pull frame directly from chain ring
        * First high priority */
       channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI];
@@ -2439,8 +1921,10 @@
                                channelCb);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeRXEventHandler Pull from RX high channel fail");        
+#endif
       }
 
        /* Second low priority */
@@ -2449,8 +1933,10 @@
                                channelCb);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeRXEventHandler Pull from RX low channel fail");        
+#endif
       }
 
       /* Interrupt will not enabled at here, it will be enabled at PS mode change */
@@ -2465,12 +1951,16 @@
                              &intSrc);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeRXEventHandler Read INT_SRC register fail");
+#endif
       return;         
    }
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
             "RX Event Handler INT Source 0x%x", intSrc);
+#endif
 
 #ifndef WLANDXE_TEST_CHANNEL_ENABLE
    /* Test High Priority Channel interrupt is enabled or not */
@@ -2480,16 +1970,18 @@
       status = dxeChannelCleanInt(channelCb, &chHighStat);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeRXEventHandler INT Clean up fail");
+#endif
          return;         
       }
+
       if(WLANDXE_CH_STAT_INT_ERR_MASK & chHighStat)
       {
          /* Error Happen during transaction, Handle it */
       }
-      else if((WLANDXE_CH_STAT_INT_DONE_MASK & chHighStat) ||
-              (WLANDXE_CH_STAT_INT_ED_MASK & chHighStat))
+      else if(WLANDXE_CH_STAT_INT_DONE_MASK & chHighStat)
       {
          /* Handle RX Ready for high priority channel */
          status = dxeRXFrameReady(dxeCtxt,
@@ -2500,18 +1992,10 @@
          status = dxeRXFrameReady(dxeCtxt,
                                   channelCb);
       }
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
                "RX HIGH CH EVNT STAT 0x%x, %d frames handled", chHighStat, channelCb->numFragmentCurrentChain);
-      /* Update the Rx DONE histogram */
-      channelCb->rxDoneHistogram = (channelCb->rxDoneHistogram << 1);
-      if(WLANDXE_CH_STAT_INT_DONE_MASK & chHighStat)
-      {
-         channelCb->rxDoneHistogram |= 1;
-      }
-      else
-      {
-         channelCb->rxDoneHistogram &= ~1;
-      }
+#endif
    }
 #else
    /* Test H2H Test interrupt is enabled or not */
@@ -2521,8 +2005,10 @@
       status = dxeChannelCleanInt(channelCb, &chStat);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeRXEventHandler INT Clean up fail");
+#endif
          return;         
       }
 
@@ -2541,9 +2027,11 @@
       if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
       {
          channelCb->rxDoneHistogram |= 1;
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
             "DXE Channel Number %d, Rx DONE Histogram 0x%016llx",
             channelCb->assignedDMAChannel, channelCb->rxDoneHistogram);
+#endif
       }
       else
       {
@@ -2553,14 +2041,16 @@
 #endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 
    /* Test Low Priority Channel interrupt is enabled or not */
-       channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI];
+   channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI];
    if(intSrc & (1 << channelCb->assignedDMAChannel))
    {
       status = dxeChannelCleanInt(channelCb, &chLowStat);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeRXEventHandler INT Clean up fail");
+#endif
          return;         
       }
 
@@ -2573,25 +2063,34 @@
          /* Handle RX Ready for low priority channel */
          status = dxeRXFrameReady(dxeCtxt,
                                   channelCb);
-       }
+      }
 
       /* Update the Rx DONE histogram */
       channelCb->rxDoneHistogram = (channelCb->rxDoneHistogram << 1);
       if(WLANDXE_CH_STAT_INT_DONE_MASK & chLowStat)
       {
          channelCb->rxDoneHistogram |= 1;
+#ifdef WLAN_DEBUG
+         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
+            "DXE Channel Number %d, Rx DONE Histogram 0x%016llx",
+            channelCb->assignedDMAChannel, channelCb->rxDoneHistogram);
+#endif
       }
       else
       {
          channelCb->rxDoneHistogram &= ~1;
       }
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
                "RX LOW CH EVNT STAT 0x%x, %d frames handled", chLowStat, channelCb->numFragmentCurrentChain);
+#endif
    }
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeRXEventHandler Handle Frame Ready Fail");
+#endif
       return;         
    }
 
@@ -2600,8 +2099,10 @@
    status = wpalEnableInterrupt(DXE_INTERRUPT_RX_READY);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeRXEventHandler Enable RX Ready interrupt fail");
+#endif
       return;         
    }
 
@@ -2612,17 +2113,20 @@
    }
    if(!(WLANDXE_CH_STAT_INT_ED_MASK & chHighStat))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
                "dxeRXEventHandler RX High, Not yet ED, re-enable CH");
+#endif
       wpalWriteRegister(dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI].channelRegister.chDXECtrlRegAddr,
                         dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI].extraConfig.chan_mask);
    }
+#ifdef WLAN_DEBUG
    else
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
                "dxeRXEventHandler RX High, CH STAT = ED_MASK, will RIVA PC");
    }
-
+#endif
    /* Prepare Control Register EN Channel */
    if(!(dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI].extraConfig.chan_mask & WLANDXE_CH_CTRL_EN_MASK))
    {
@@ -2630,11 +2134,14 @@
    }
    if(!(WLANDXE_CH_STAT_INT_ED_MASK & chLowStat))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
                "dxeRXEventHandler RX Low, Not yet ED, re-enable CH");
+#endif
       wpalWriteRegister(dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI].channelRegister.chDXECtrlRegAddr,
                         dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_LOW_PRI].extraConfig.chan_mask);
    }
+#ifdef WLAN_DEBUG
    else
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
@@ -2643,6 +2150,7 @@
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return;
 }
 
@@ -2674,14 +2182,17 @@
    wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
    WLANDXE_ChannelCBType    *channelCb  = NULL;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Sanity Check */
    if(NULL == rxPktAvailMsg)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeRXPacketAvailableEventHandler Context is not valid");
+#endif
       return;
    }
 
@@ -2689,9 +2200,10 @@
 
    do
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "dxeRXPacketAvailableEventHandler, start refilling ring");
-
+#endif
       channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_RX_HIGH_PRI];
       status = dxeRXFrameRefillRing(dxeCtxt,channelCb);
    
@@ -2747,22 +2259,41 @@
    wpt_uint32                regValue;
 #endif /* FEATURE_R33D */
 
+#ifdef WLAN_DEBUG
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Enter", __FUNCTION__);
+#endif
+   /* Sanity Check */
+   if(NULL == hostCtxt)
+   {
+#ifdef WLAN_DEBUG
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
+               "dxeRXFrameReadyISR input is not valid");
+#endif
+      return;
+   }
 
 #ifdef FEATURE_R33D
    status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
                                   &regValue);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXCompISR Read INT_SRC_RAW fail");
+#endif
       return;
    }
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
             "INT_SRC_RAW 0x%x", regValue);
+#endif
    if(0 == regValue)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "This is not DXE Interrupt, Reject it 0x%x", regValue);
+#endif
       return;
    }
 #endif /* FEATURE_R33D */
@@ -2773,8 +2304,10 @@
    status = wpalDisableInterrupt(DXE_INTERRUPT_RX_READY);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeRXFrameReadyISR Disable RX ready interrupt fail");
+#endif
       return;         
    }
 
@@ -2785,10 +2318,16 @@
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
       HDXE_ASSERT(eWLAN_PAL_STATUS_SUCCESS == status);
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
                "dxeRXFrameReadyISR interrupt serialize fail");
+#endif
    }
 
+#ifdef WLAN_DEBUG
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
+            "%s Exit", __FUNCTION__);
+#endif
    return;
 }
 
@@ -2830,9 +2369,10 @@
    wpt_iterator                iterator;
 #endif /* FEATURE_R33D */
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    if(WLANDXE_POWER_STATE_BMPS == tempDxeCtrlBlk->hostPowerState)
    {
       tempDxeCtrlBlk->rivaPowerState = WLANDXE_RIVA_POWER_STATE_BMPS_UNKNOWN;
@@ -2852,8 +2392,10 @@
    status = wpalLockPacketForTransfer(palPacket);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXPushFrame unable to lock packet");
+#endif
       return status;
    }
 
@@ -2861,8 +2403,10 @@
 #endif /* FEATURE_R33D */
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXPushFrame iterator init fail");
+#endif
       return status;
    }
 
@@ -2901,14 +2445,18 @@
       if((NULL == sourcePhysicalAddress) ||
          (0    == xferSize))
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
                   "dxeTXPushFrame end of current frame");
+#endif
          break;
       }
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeTXPushFrame Get next frame fail");
+#endif
          return status;
       }
 #endif /* FEATURE_R33D */
@@ -2954,18 +2502,21 @@
       currentCtrlBlk = currentCtrlBlk->nextCtrlBlk;
    }
    channelEntry->numTotalFrame++;
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "NUM TX FRAG %d, Total Frame %d",
             channelEntry->numFragmentCurrentChain, channelEntry->numTotalFrame);
-
+#endif
    /* Program Channel control register
     * Set as end of packet
     * Enable interrupt also for first code lock down
     * performace optimization, this will be revisited */
    if(NULL == LastDesc)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXPushFrame NULL Last Descriptor, broken chain");
+#endif
       return eWLAN_PAL_STATUS_E_FAULT;
    }
    LastDesc->descCtrl.ctrl  = channelEntry->extraConfig.cw_ctrl_write_eop_int;
@@ -2980,10 +2531,12 @@
       /* Update channel head as next avaliable linked slot */
       channelEntry->headCtrlBlk = currentCtrlBlk;
       tempDxeCtrlBlk->ringNotEmpty = eWLAN_PAL_TRUE;
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW, "SMSM_ret LO=%d HI=%d", tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].numRsvdDesc,
                tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI].numRsvdDesc );
+#endif
       dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
-      return status;
+	  return status;
    }
 
    /* If DXE use external descriptor, registers are not needed to be programmed
@@ -3004,16 +2557,20 @@
                                       channelEntry->extraConfig.chan_mask);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeTXPushFrame Write Channel Ctrl Register fail");
+#endif
          return status;
       }
 
       /* Update channel head as next avaliable linked slot */
       channelEntry->headCtrlBlk = currentCtrlBlk;
 
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
                "%s Exit", __FUNCTION__);
+#endif
       return status;
    }
 
@@ -3029,8 +2586,10 @@
                                       channelEntry->channelConfig.refWQ);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeTXPushFrame Program dest address register fail");
+#endif
          return status;
       }
       /* If descriptor format is SHORT */
@@ -3040,16 +2599,20 @@
                                          0);
          if(eWLAN_PAL_STATUS_SUCCESS != status)
          {
+#ifdef WLAN_DEBUG
             HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                      "dxeTXPushFrame Program dest address register fail");
+#endif
             return status;
          }
       }
+#ifdef WLAN_DEBUG
       else
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeTXPushFrame LONG Descriptor Format!!!");
       }
+#endif
    }
 #ifdef WLANDXE_TEST_CHANNEL_ENABLE
    else if(WDTS_CHANNEL_H2H_TEST_TX  == channelEntry->channelType)
@@ -3059,8 +2622,10 @@
                                       WLANDXE_U32_SWAP_ENDIAN(firstDesc->dxedesc.dxe_short_desc.dstMemAddrL));
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeTXPushFrame Program dest address register fail");
+#endif
          return status;
       }
       /* If descriptor format is SHORT */
@@ -3070,16 +2635,20 @@
                                          0);
          if(eWLAN_PAL_STATUS_SUCCESS != status)
          {
+#ifdef WLAN_DEBUG
             HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                      "dxeTXPushFrame Program dest address register fail");
+#endif
             return status;
          }
       }
+#ifdef WLAN_DEBUG
       else
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeTXPushFrame LONG Descriptor Format!!!");
       }
+#endif
    }
 #endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 
@@ -3090,8 +2659,10 @@
                                    WLANDXE_U32_SWAP_ENDIAN(firstDesc->dxedesc.dxe_short_desc.srcMemAddrL));
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXPushFrame Program src address register fail");
+#endif
       return status;
    }
    /* If descriptor format is SHORT */
@@ -3101,24 +2672,29 @@
                                       0);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeTXPushFrame Program dest address register fail");
+#endif
          return status;
       }
    }
+#ifdef WLAN_DEBUG
    else
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXPushFrame LONG Descriptor Format!!!");
    }
-
+#endif
    /* Linked list Descriptor pointer */
    status = wpalWriteRegister(channelEntry->channelRegister.chDXEDesclRegAddr,
                                    channelEntry->headCtrlBlk->linkedDescPhyAddr);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXPushFrame Write DESC Address register fail");
+#endif
       return status;
    }
    /* If descriptor format is SHORT */
@@ -3128,25 +2704,30 @@
                                       0);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeTXPushFrame Program dest address register fail");
+#endif
          return status;
       }
    }
+#ifdef WLAN_DEBUG
    else
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXPushFrame LONG Descriptor Format!!!");
    }
-
+#endif
    /* Transfer Size */
    xferSize = WLANDXE_U32_SWAP_ENDIAN(firstDesc->xfrSize);
    status = wpalWriteRegister(channelEntry->channelRegister.chDXESzRegAddr,
                                    xferSize);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXPushFrame Write DESC Address register fail");
+#endif
       return status;
    }
 
@@ -3156,16 +2737,20 @@
                                    channelEntry->extraConfig.chan_mask);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXPushFrame Write Channel Ctrl Register fail");
+#endif
       return status;
    }
 
    /* Update channel head as next avaliable linked slot */
    channelEntry->headCtrlBlk = currentCtrlBlk;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -3197,22 +2782,28 @@
    wpt_uint32                descCtrlValue  = 0;
    unsigned int             *lowThreshold   = NULL;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
+#endif
 
    /* Sanity */
    if((NULL == hostCtxt) || (NULL == channelEntry))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXCompFrame Invalid ARG");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    if(NULL == hostCtxt->txCompCB)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXCompFrame TXCompCB is not registered");
-      return eWLAN_PAL_STATUS_SUCCESS;
+#endif
+      return eWLAN_PAL_STATUS_E_EMPTY;
    }
 
    wpalMutexAcquire(&channelEntry->dxeChannelLock);
@@ -3223,7 +2814,7 @@
    if( currentCtrlBlk == channelEntry->headCtrlBlk )
    {
       wpalMutexRelease(&channelEntry->dxeChannelLock);
-      return eWLAN_PAL_STATUS_SUCCESS;
+      return eWLAN_PAL_STATUS_E_EMPTY;
    }
 
    /*  */
@@ -3234,8 +2825,10 @@
       if((descCtrlValue & WLANDXE_DESC_CTRL_VALID))
       {
          /* caught up with head, bail out */
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
                   "dxeTXCompFrame caught up with head - next DESC has VALID set");
+#endif
          break;
       }
 
@@ -3253,8 +2846,10 @@
          status = wpalUnlockPacket(currentCtrlBlk->xfrFrame);
          if (eWLAN_PAL_STATUS_SUCCESS != status)
          {
+#ifdef WLAN_DEBUG
             HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                      "dxeRXFrameReady unable to unlock packet");
+#endif
             wpalMutexRelease(&channelEntry->dxeChannelLock);
             return status;
          }
@@ -3274,8 +2869,10 @@
        * in theory, COMP CB must be called already ??? */
       if(currentCtrlBlk == channelEntry->headCtrlBlk)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
                   "dxeTXCompFrame caught up with head ptr");
+#endif
          break;
       }
       /* VALID Bit check ???? */
@@ -3298,19 +2895,22 @@
          *lowThreshold = WLANDXE_TX_LOW_RES_THRESHOLD;
       }
 
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "DXE TX %d channel recovered from low resource", channelEntry->channelType);
+#endif
       hostCtxt->lowResourceCB(hostCtxt->clientCtxt,
                               channelEntry->channelType,
                               eWLAN_PAL_TRUE);
       channelEntry->hitLowResource = eWLAN_PAL_FALSE;
-      wpalTimerStop(&channelEntry->healthMonitorTimer);
    }
 
    wpalMutexRelease(&channelEntry->dxeChannelLock);
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -3343,87 +2943,51 @@
    wpt_uint32                chStat     = 0;
    WLANDXE_ChannelCBType    *channelCb  = NULL;
 
-   wpt_uint8                 bEnableISR = 0;
-   static wpt_uint8          successiveIntWithIMPS = 0;
+   wpt_uint8                 bEnableISR = 0; 
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    dxeCtxt = (WLANDXE_CtrlBlkType *)(msgContent->pContext);
-   dxeCtxt->ucTxMsgCnt = 0;
-   
-   if(eWLAN_PAL_TRUE == dxeCtxt->driverReloadInProcessing)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "wlan: TX COMP WLAN Driver re-loading in progress");
-      return;
-   }
-
    /* Return from here if the RIVA is in IMPS, to avoid register access */
    if(WLANDXE_POWER_STATE_IMPS == dxeCtxt->hostPowerState)
    {
-      successiveIntWithIMPS++;
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "dxeTXEventHandler IMPS TX COMP INT successiveIntWithIMPS %d", successiveIntWithIMPS);
-      status = dxeTXCompFrame(dxeCtxt, &dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI]);
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeTXEventHandler IMPS HC COMP interrupt fail");
-      }
-	  
-      status = dxeTXCompFrame(dxeCtxt, &dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI]);
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "dxeTXEventHandler IMPS LC COMP interrupt fail");
-      }
-
-      if(((dxeCtxt->txCompletedFrames) &&
-         (eWLAN_PAL_FALSE == dxeCtxt->txIntEnable)) &&
-         (successiveIntWithIMPS == 1))
-      {
-         dxeCtxt->txIntEnable =  eWLAN_PAL_TRUE; 
-         wpalEnableInterrupt(DXE_INTERRUPT_TX_COMPLE);
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "TX COMP INT Enabled, remain TX frame count on ring %d",
-                  dxeCtxt->txCompletedFrames);
-         /*Kicking the DXE after the TX Complete interrupt was enabled - to avoid 
-           the posibility of a race*/
-         dxePsComplete(dxeCtxt, eWLAN_PAL_TRUE);
-      }
-      else
-      {
-         dxeCtxt->txIntEnable =  eWLAN_PAL_FALSE;
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "TX COMP INT NOT Enabled, RIVA still wake up? remain TX frame count on ring %d, successiveIntWithIMPS %d",
-                  dxeCtxt->txCompletedFrames, successiveIntWithIMPS);
-      }
+#ifdef WLAN_DEBUG
+      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
+         "%s Riva is in %d, return from here ", __FUNCTION__, dxeCtxt->hostPowerState);
+#endif
       return;
    }
 
-   successiveIntWithIMPS = 0;
    if((!dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI].extraConfig.chEnabled) ||
       (!dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].extraConfig.chEnabled))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
          "DXE already stopped in TX event handler. Just return");
+#endif
       return;
    }
 
+   dxeCtxt->ucTxMsgCnt = 0;   
+   
    /* Disable device interrupt */
    /* Read whole interrupt mask register and exclusive only this channel int */
    status = wpalReadRegister(WLANDXE_INT_SRC_RAW_ADDRESS,
                                   &intSrc);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXCompleteEventHandler Read INT_DONE_SRC register fail");
+#endif
       return;         
    }
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_MED,
             "TX Event Handler INT Source 0x%x", intSrc);
-
+#endif
    /* Test High Priority Channel is the INT source or not */
    channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI];
    if(intSrc & (1 << channelCb->assignedDMAChannel))
@@ -3431,15 +2995,19 @@
       status = dxeChannelCleanInt(channelCb, &chStat);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeTXEventHandler INT Clean up fail");
+#endif
          return;         
       }
 
       if(WLANDXE_CH_STAT_INT_ERR_MASK & chStat)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
                  "dxeTXEventHandler TX HI status=%x", chStat);
+#endif
          HDXE_ASSERT(0);
       }
       else if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
@@ -3447,21 +3015,19 @@
          /* Handle TX complete for high priority channel */
          status = dxeTXCompFrame(dxeCtxt,
                                  channelCb);
-         bEnableISR = 1;
       }
       else if(WLANDXE_CH_STAT_INT_ED_MASK & chStat)
       {
          /* Handle TX complete for high priority channel */
          status = dxeTXCompFrame(dxeCtxt,
                                  channelCb);
-         bEnableISR = 1;
       }
+#ifdef WLAN_DEBUG
       else
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "dxeTXEventHandler TX HI status=%x", chStat);
       }
-
       if(WLANDXE_CH_STAT_MASKED_MASK & chStat)
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_HIGH,
@@ -3470,6 +3036,7 @@
 
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_HIGH,
                "TX HIGH STAT 0x%x RESRVD %d", chStat, channelCb->numRsvdDesc);
+#endif
    }
 
    /* Test Low Priority Channel interrupt is enabled or not */
@@ -3479,15 +3046,19 @@
       status = dxeChannelCleanInt(channelCb, &chStat);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeTXEventHandler INT Clean up fail");
+#endif
          return;         
       }
 
       if(WLANDXE_CH_STAT_INT_ERR_MASK & chStat)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
                  "dxeTXEventHandler TX LO status=%x", chStat);
+#endif
          HDXE_ASSERT(0);
       }
       else if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
@@ -3495,15 +3066,14 @@
          /* Handle TX complete for low priority channel */
          status = dxeTXCompFrame(dxeCtxt,
                                  channelCb);
-         bEnableISR = 1;
       }
       else if(WLANDXE_CH_STAT_INT_ED_MASK & chStat)
       {
          /* Handle TX complete for low priority channel */
          status = dxeTXCompFrame(dxeCtxt,
                                  channelCb);
-         bEnableISR = 1;
       }
+#ifdef WLAN_DEBUG
       else
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -3517,6 +3087,7 @@
       }
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
                "TX LOW STAT 0x%x RESRVD %d", chStat, channelCb->numRsvdDesc);
+#endif
    }
 
 
@@ -3529,15 +3100,19 @@
                                      &chStat);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeChannelCleanInt Read CH STAT register fail");
+#endif
          return;         
       }
 
       if(WLANDXE_CH_STAT_INT_ERR_MASK & chStat)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
                   "WLANDXE_CH_STAT_INT_ERR_MASK occurred");
+#endif
          HDXE_ASSERT(0);
       }
       else if(WLANDXE_CH_STAT_INT_DONE_MASK & chStat)
@@ -3547,16 +3122,20 @@
                                  channelCb);
          if(eWLAN_PAL_STATUS_SUCCESS != status)
          {
+#ifdef WLAN_DEBUG
             HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                      "dxeTXEventHandler INT Clean up fail");
+#endif
             return;         
          }
       }
+#ifdef WLAN_DEBUG
       else
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "unexpected channel state %d", chStat);
       }
+#endif
    }
 #endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 
@@ -3565,17 +3144,21 @@
    {
       dxeCtxt->txIntEnable =  eWLAN_PAL_TRUE; 
       wpalEnableInterrupt(DXE_INTERRUPT_TX_COMPLE);
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "TX COMP INT Enabled, remain TX frame count on ring %d",
                dxeCtxt->txCompletedFrames);
+#endif
    }
 
    /*Kicking the DXE after the TX Complete interrupt was enabled - to avoid 
      the posibility of a race*/
    dxePsComplete(dxeCtxt, eWLAN_PAL_TRUE);
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return;
 }
 
@@ -3604,9 +3187,10 @@
    wpt_status                status     = eWLAN_PAL_STATUS_SUCCESS;
    WLANDXE_ChannelCBType    *channelCb  = NULL;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-  
+#endif
    /* Test High Priority Channel is the INT source or not */
    channelCb = &dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI];
 
@@ -3625,172 +3209,26 @@
    {
       dxeCtxt->txIntEnable =  eWLAN_PAL_TRUE; 
       wpalEnableInterrupt(DXE_INTERRUPT_TX_COMPLE);
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "%s %s : %d, %s : %d", __FUNCTION__,
                channelType[dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI].channelType],
                dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_HIGH_PRI].numRsvdDesc,
                channelType[dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].channelType],
                dxeCtxt->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].numRsvdDesc);
+#endif
    }
    
    /*Kicking the DXE after the TX Complete interrupt was enabled - to avoid 
      the posibility of a race*/
    dxePsComplete(dxeCtxt, eWLAN_PAL_FALSE);
    
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return;
 }
-
-/*==========================================================================
-  @  Function Name 
-      dxeTXReSyncDesc
-
-  @  Description 
-      When STA comeout from IMPS, check DXE TX next transfer candidate descriptor
-      And HW programmed descriptor.
-      If any async happen between HW/SW TX stall will happen
-
-  @  Parameters
-      void    *msgPtr
-               Message pointer to sync with TX thread
-
-  @  Return
-      NONE
-===========================================================================*/
-void dxeTXReSyncDesc
-(
-   wpt_msg                  *msgPtr
-)
-{
-   wpt_msg                  *msgContent = (wpt_msg *)msgPtr;
-   WLANDXE_CtrlBlkType      *pDxeCtrlBlk;
-   wpt_uint32                nextDescReg;
-   WLANDXE_ChannelCBType    *channelEntry;
-   WLANDXE_DescCtrlBlkType  *validCtrlBlk;
-   wpt_uint32                descLoop;
-   wpt_uint32                channelLoop;
-
-   if(NULL == msgContent)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "dxeTXReSyncDesc Invalid Control Block");
-      return;  
-   }
-
-   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-            "dxeTXReSyncDesc Try to re-sync TX channel if any problem");
-   pDxeCtrlBlk = (WLANDXE_CtrlBlkType *)(msgContent->pContext);
-
-   for(channelLoop = WDTS_CHANNEL_TX_LOW_PRI; channelLoop < WDTS_CHANNEL_RX_LOW_PRI; channelLoop++)
-   {
-      channelEntry = &pDxeCtrlBlk->dxeChannel[channelLoop];
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-               "%11s : Try to detect TX descriptor async", channelType[channelEntry->channelType]);
-      wpalReadRegister(channelEntry->channelRegister.chDXEDesclRegAddr,
-                       &nextDescReg);
-      /* Async detect without TX pending frame */
-      if(channelEntry->tailCtrlBlk == channelEntry->headCtrlBlk)
-      {
-         if(nextDescReg != channelEntry->tailCtrlBlk->linkedDescPhyAddr)
-         {
-            HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                     "TX Async no Pending frame");
-            dxeChannelMonitor("!!! TX Async no Pending frame !!!", channelEntry);
-            dxeChannelRegisterDump(channelEntry, "!!! TX Async no Pending frame !!!");
-            wpalWriteRegister(channelEntry->channelRegister.chDXEDesclRegAddr,
-                              channelEntry->tailCtrlBlk->linkedDescPhyAddr);
-         }
-      }
-      /* Async detect with some TX pending frames
-       * next descriptor register should sync with first valid descriptor */
-      else
-      {
-         validCtrlBlk = channelEntry->tailCtrlBlk;
-         for(descLoop = 0; descLoop < channelEntry->numDesc; descLoop++)
-         {
-            if(validCtrlBlk->linkedDesc->descCtrl.ctrl & WLANDXE_DESC_CTRL_VALID)
-            {
-               if(nextDescReg != validCtrlBlk->linkedDescPhyAddr)
-               {
-                  HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                           "TX Async");
-                  dxeChannelMonitor("!!! TX Async !!!", channelEntry);
-                  dxeChannelRegisterDump(channelEntry, "!!! TX Async !!!");
-                  wpalWriteRegister(channelEntry->channelRegister.chDXEDesclRegAddr,
-                                    validCtrlBlk->linkedDescPhyAddr);
-               }
-               break;
-            }
-            validCtrlBlk = (WLANDXE_DescCtrlBlkType *)validCtrlBlk->nextCtrlBlk;
-            if(validCtrlBlk == channelEntry->headCtrlBlk->nextCtrlBlk)
-            {
-               /* Finished to test till head control blcok, but could not find valid descriptor
-                * from head to tail all descriptors are invalidated
-                * host point of view head descriptor is next TX candidate
-                * So, next descriptor control have to be programmed with head descriptor
-                * check */
-               if(nextDescReg != channelEntry->headCtrlBlk->linkedDescPhyAddr)
-               {
-                  HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                           "TX Async with not completed transfered frames, next descriptior must be head");
-                  dxeChannelMonitor("!!! TX Async !!!", channelEntry);
-                  dxeChannelRegisterDump(channelEntry, "!!! TX Async !!!");
-                  wpalWriteRegister(channelEntry->channelRegister.chDXEDesclRegAddr,
-                                    validCtrlBlk->linkedDescPhyAddr);
-               }
-               break;
-            }
-         }
-      }
-   }
-
-   /* HW/SW descriptor resync is done.
-    * Next if there are any valid descriptor in chain, Push to HW again */
-   for(channelLoop = WDTS_CHANNEL_TX_LOW_PRI; channelLoop < WDTS_CHANNEL_RX_LOW_PRI; channelLoop++)
-   {
-      channelEntry = &pDxeCtrlBlk->dxeChannel[channelLoop];
-      if(channelEntry->tailCtrlBlk == channelEntry->headCtrlBlk)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-                  "%11s : No TX Pending frame",
-                  channelType[channelEntry->channelType]);
-         /* No Pending frame, Do nothing */
-      }
-      else
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                  "%11s : TX Pending frame, process it",
-                  channelType[channelEntry->channelType]);
-         validCtrlBlk = channelEntry->tailCtrlBlk;
-         for(descLoop = 0; descLoop < channelEntry->numDesc; descLoop++)
-         {
-            if(validCtrlBlk->linkedDesc->descCtrl.ctrl & WLANDXE_DESC_CTRL_VALID)
-            {
-               HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                        "%11s : when exit IMPS found valid descriptor",
-                        channelType[channelEntry->channelType]);
-
-               /* Found valid descriptor, kick DXE */
-               wpalWriteRegister(channelEntry->channelRegister.chDXECtrlRegAddr,
-                                 channelEntry->extraConfig.chan_mask);
-               break;
-            }
-            validCtrlBlk = (WLANDXE_DescCtrlBlkType *)validCtrlBlk->nextCtrlBlk;
-            if(validCtrlBlk == channelEntry->headCtrlBlk->nextCtrlBlk)
-            {
-               /* Finished to test till head control blcok, but could not find valid descriptor
-                * from head to tail all descriptors are invalidated */
-               break;
-            }
-         }
-      }
-   }
-
-   wpalMemoryFree(msgPtr);
-   return;
-}
-
 /*==========================================================================
   @  Function Name 
       dxeTXISR
@@ -3819,25 +3257,30 @@
    wpt_uint32                regValue;
 #endif /* FEATURE_R33D */
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Return from here if the RIVA is in IMPS, to avoid register access */
-   if(WLANDXE_POWER_STATE_DOWN == dxeCtxt->hostPowerState)
+   if((WLANDXE_POWER_STATE_IMPS == dxeCtxt->hostPowerState) ||
+      (WLANDXE_POWER_STATE_DOWN == dxeCtxt->hostPowerState))
    {
-      dxeCtxt->txIntEnable = eWLAN_PAL_FALSE;
       /* Disable interrupt at here,
          IMPS or IMPS Pending state should not access RIVA register */
       status = wpalDisableInterrupt(DXE_INTERRUPT_TX_COMPLE);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "dxeRXFrameReadyISR Disable RX ready interrupt fail");
+#endif
          return;         
       }
       dxeCtxt->txIntDisabledByIMPS = eWLAN_PAL_TRUE;
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
          "%s Riva is in %d, return from here ", __FUNCTION__, dxeCtxt->hostPowerState);
+#endif
       return;
    }
 
@@ -3846,16 +3289,22 @@
                                   &regValue);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXCompISR Read INT_SRC_RAW fail");
+#endif
       return;
    }
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "INT_SRC_RAW 0x%x", regValue);
+#endif
    if(0 == regValue)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "This is not DXE Interrupt, Reject it");
+#endif
       return;
    }
 #endif /* FEATURE_R33D */
@@ -3864,8 +3313,10 @@
    status = wpalDisableInterrupt(DXE_INTERRUPT_TX_COMPLE);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXCompISR Disable TX complete interrupt fail");
+#endif
       return;         
    }
    dxeCtxt->txIntEnable = eWLAN_PAL_FALSE;
@@ -3873,8 +3324,10 @@
 
    if( dxeCtxt->ucTxMsgCnt )
    {
+#ifdef WLAN_DEBUG
     HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "Avoiding serializing TX Complete event");
+#endif
     return;
    }
    
@@ -3884,6 +3337,7 @@
    HDXE_ASSERT(NULL != dxeCtxt->txIsrMsg);
    status = wpalPostTxMsg(WDI_GET_PAL_CTX(),
                           dxeCtxt->txIsrMsg);
+#ifdef WLAN_DEBUG
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
@@ -3892,6 +3346,7 @@
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return;
 }
 
@@ -3928,15 +3383,18 @@
    WLANDXE_DescCtrlBlkType   *nextDescCB = NULL;
 #endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* This is temporary allocation */
    tempDxeCtrlBlk = (WLANDXE_CtrlBlkType *)wpalMemoryAllocate(sizeof(WLANDXE_CtrlBlkType));
    if(NULL == tempDxeCtrlBlk)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Open Control Block Alloc Fail");
+#endif
       return NULL;  
    }
    wpalMemoryZero(tempDxeCtrlBlk, sizeof(WLANDXE_CtrlBlkType));
@@ -3944,16 +3402,20 @@
    status = dxeCommonDefaultConfig(tempDxeCtrlBlk);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Open Common Configuration Fail");
+#endif
       WLANDXE_Close(tempDxeCtrlBlk);
       return NULL;         
    }
 
    for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "WLANDXE_Open Channel %s Open Start", channelType[idx]);
+#endif
       currentChannel = &tempDxeCtrlBlk->dxeChannel[idx];
       if(idx == WDTS_CHANNEL_TX_LOW_PRI)
       {
@@ -3987,8 +3449,10 @@
                                        currentChannel);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "WLANDXE_Open Channel Basic Configuration Fail for channel %d", idx);
+#endif
          WLANDXE_Close(tempDxeCtrlBlk);
          return NULL;         
       }
@@ -3997,54 +3461,38 @@
       status = dxeCtrlBlkAlloc(tempDxeCtrlBlk, currentChannel);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "WLANDXE_Open Alloc DXE Control Block Fail for channel %d", idx);
-
+#endif
          WLANDXE_Close(tempDxeCtrlBlk);
          return NULL;         
       }
       status = wpalMutexInit(&currentChannel->dxeChannelLock); 
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "WLANDXE_Open Lock Init Fail for channel %d", idx);
+#endif
          WLANDXE_Close(tempDxeCtrlBlk);
          return NULL;
       }
 
-      status = wpalTimerInit(&currentChannel->healthMonitorTimer,
-                    dxeHealthMonitorTimeout,
-                    (void *)currentChannel);
-      if(eWLAN_PAL_STATUS_SUCCESS != status)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "WLANDXE_Open Health Monitor timer init fail %d", idx);
-         WLANDXE_Close(tempDxeCtrlBlk);
-         return NULL;
-      }
-
-      currentChannel->healthMonitorMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
-      if(NULL == currentChannel->healthMonitorMsg)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-                  "WLANDXE_Open Health Monitor MSG Alloc fail %d", idx);
-         WLANDXE_Close(tempDxeCtrlBlk);
-         return NULL;
-      }
-      wpalMemoryZero(currentChannel->healthMonitorMsg, sizeof(wpt_msg));
-      currentChannel->healthMonitorMsg->callback = dxeTXHealthMonitor;
-      currentChannel->healthMonitorMsg->pContext = (void *)currentChannel;
-
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "WLANDXE_Open Channel %s Open Success", channelType[idx]);
+#endif
    }
 
    /* Allocate and Init RX READY ISR Serialize Buffer */
    tempDxeCtrlBlk->rxIsrMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
    if(NULL == tempDxeCtrlBlk->rxIsrMsg)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Open Alloc RX ISR Fail");
+#endif
       WLANDXE_Close(tempDxeCtrlBlk);
       return NULL;
    }
@@ -4056,8 +3504,10 @@
    tempDxeCtrlBlk->txIsrMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
    if(NULL == tempDxeCtrlBlk->txIsrMsg)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Open Alloc TX ISR Fail");
+#endif
       WLANDXE_Close(tempDxeCtrlBlk);
       return NULL;
    }
@@ -4069,8 +3519,10 @@
    tempDxeCtrlBlk->rxPktAvailMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
    if(NULL == tempDxeCtrlBlk->rxPktAvailMsg)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Open Alloc RX Packet Available Message Fail");
+#endif
       WLANDXE_Close(tempDxeCtrlBlk);
       return NULL;
    }
@@ -4082,7 +3534,6 @@
    tempDxeCtrlBlk->dxeCookie    = WLANDXE_CTXT_COOKIE;
    tempDxeCtrlBlk->rxIntDisabledByIMPS = eWLAN_PAL_FALSE;
    tempDxeCtrlBlk->txIntDisabledByIMPS = eWLAN_PAL_FALSE;
-   tempDxeCtrlBlk->driverReloadInProcessing = eWLAN_PAL_FALSE;
 
    /* Initialize SMSM state
     * Init State is
@@ -4092,8 +3543,10 @@
                                   WPAL_SMSM_WLAN_TX_RINGS_EMPTY);
    if(0 != smsmInitState)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "SMSM Channel init fail %d", smsmInitState);
+#endif
       for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
       {
          dxeChannelClose(tempDxeCtrlBlk, &tempDxeCtrlBlk->dxeChannel[idx]);
@@ -4104,10 +3557,12 @@
       return NULL;
    }
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
             "WLANDXE_Open Success");
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return (void *)tempDxeCtrlBlk;
 }
 
@@ -4140,42 +3595,53 @@
    wpt_status                 status  = eWLAN_PAL_STATUS_SUCCESS;
    WLANDXE_CtrlBlkType       *dxeCtxt;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Sanity */
    if(NULL == pDXEContext)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_ClientRegistration Invalid DXE CB");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
    if(NULL == rxFrameReadyCB)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_ClientRegistration Invalid RX READY CB");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
    if(NULL == txCompleteCB)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_ClientRegistration Invalid txCompleteCB");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
    if(NULL == lowResourceCB)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_ClientRegistration Invalid lowResourceCB");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
    if(NULL == userContext)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_ClientRegistration Invalid userContext");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
@@ -4187,8 +3653,10 @@
    dxeCtxt->lowResourceCB = lowResourceCB;
    dxeCtxt->clientCtxt    = userContext;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -4215,14 +3683,17 @@
    wpt_uint32                 idx;
    WLANDXE_CtrlBlkType       *dxeCtxt = NULL;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Sanity */
    if(NULL == pDXEContext)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Start Invalid DXE CB");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
    dxeCtxt = (WLANDXE_CtrlBlkType *)pDXEContext;
@@ -4233,24 +3704,29 @@
    status = dxeEngineCoreStart(dxeCtxt);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Start DXE HW init Fail");
+#endif
       return status;         
    }
 
    /* Individual Channel Start */
    for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "WLANDXE_Start Channel %s Start", channelType[idx]);
-
+#endif
       /* Allocate DXE descriptor will be shared by Host driver and DXE engine */
       /* Make connection between DXE descriptor and DXE control block */
       status = dxeDescAllocAndLink(tempDxeCtrlBlk, &dxeCtxt->dxeChannel[idx]);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "WLANDXE_Start Alloc DXE Descriptor Fail for channel %d", idx);
+#endif
          return status;         
       }
 
@@ -4259,8 +3735,10 @@
                                      &dxeCtxt->dxeChannel[idx]);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "WLANDXE_Start %d Program DMA channel Fail", idx);
+#endif
          return status;         
       }
 
@@ -4270,12 +3748,16 @@
                                &dxeCtxt->dxeChannel[idx]);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "WLANDXE_Start %d Channel Start Fail", idx);
+#endif
          return status;         
       }
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
                "WLANDXE_Start Channel %s Start Success", channelType[idx]);
+#endif
    }
 
    /* Register ISR to OS */
@@ -4285,8 +3767,10 @@
                                        dxeCtxt);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Start TX comp interrupt registration Fail");
+#endif
       return status;         
    }
 
@@ -4296,8 +3780,10 @@
                                        dxeCtxt);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Start RX Ready interrupt registration Fail");
+#endif
       return status;         
    }
 
@@ -4306,13 +3792,17 @@
    status = wpalEnableInterrupt(DXE_INTERRUPT_RX_READY);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeTXCompleteEventHandler Enable TX complete interrupt fail");
+#endif
       return status;         
    }
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -4343,28 +3833,35 @@
    WLANDXE_CtrlBlkType       *dxeCtxt        = NULL;
    unsigned int              *lowThreshold   = NULL;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Sanity */
    if(NULL == pDXEContext)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Start Invalid DXE CB");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
    if(NULL == pPacket)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Start Invalid pPacket");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
    if((WDTS_CHANNEL_MAX < channel) || (WDTS_CHANNEL_MAX == channel))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Start Invalid channel");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
@@ -4414,8 +3911,10 @@
    status = dxeTXPushFrame(currentChannel, pPacket);
    if(eWLAN_PAL_STATUS_SUCCESS != status)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_TxFrame TX Push Frame fail");
+#endif
       wpalMutexRelease(&currentChannel->dxeChannelLock);
       return status;
    }
@@ -4427,20 +3926,13 @@
                              channel,
                              eWLAN_PAL_FALSE);
       currentChannel->hitLowResource = eWLAN_PAL_TRUE;
-
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "%11s : Low Resource currentChannel->numRsvdDesc %d",
-               channelType[currentChannel->channelType],
-               currentChannel->numRsvdDesc);
-      dxeNotifySmsm(eWLAN_PAL_FALSE, eWLAN_PAL_TRUE);
-      dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_FALSE);
-      wpalTimerStart(&currentChannel->healthMonitorTimer,
-                     T_WLANDXE_PERIODIC_HEALTH_M_TIME);
    }
    wpalMutexRelease(&currentChannel->dxeChannelLock);
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -4473,8 +3965,10 @@
   /* Sanity Check */
   if( NULL == pContext )
   {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_CompleteTX invalid param");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
   }
 
@@ -4493,8 +3987,6 @@
                              WDTS_CHANNEL_TX_LOW_PRI,
                              eWLAN_PAL_FALSE);
       inLowRes = channelCb->hitLowResource = eWLAN_PAL_TRUE;
-      wpalTimerStart(&channelCb->healthMonitorTimer,
-                     T_WLANDXE_PERIODIC_HEALTH_M_TIME);
     }
   }
 
@@ -4533,8 +4025,6 @@
                              WDTS_CHANNEL_TX_LOW_PRI,
                              eWLAN_PAL_FALSE);
         channelCb->hitLowResource = eWLAN_PAL_TRUE;
-        wpalTimerStart(&channelCb->healthMonitorTimer,
-                       T_WLANDXE_PERIODIC_HEALTH_M_TIME);
       }
     }
   }
@@ -4566,14 +4056,17 @@
    wpt_uint32                 idx;
    WLANDXE_CtrlBlkType       *dxeCtxt = NULL;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Sanity */
    if(NULL == pDXEContext)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Stop Invalid DXE CB");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
@@ -4583,8 +4076,10 @@
       status = dxeChannelStop(dxeCtxt, &dxeCtxt->dxeChannel[idx]);
       if(eWLAN_PAL_STATUS_SUCCESS != status)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "WLANDXE_Stop Channel %d Stop Fail", idx);
+#endif
          return status;
       }
    }
@@ -4593,8 +4088,10 @@
    wpalUnRegisterInterrupt(DXE_INTERRUPT_TX_COMPLE);
    wpalUnRegisterInterrupt(DXE_INTERRUPT_RX_READY);
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -4630,14 +4127,17 @@
    WLANDXE_DescCtrlBlkType   *nextDescCB = NULL;
 #endif /* WLANDXE_TEST_CHANNEL_ENABLE */
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Sanity */
    if(NULL == pDXEContext)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WLANDXE_Stop Invalid DXE CB");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;   
    }
 
@@ -4645,11 +4145,6 @@
    for(idx = 0; idx < WDTS_CHANNEL_MAX; idx++)
    {
       wpalMutexDelete(&dxeCtxt->dxeChannel[idx].dxeChannelLock);
-      wpalTimerDelete(&dxeCtxt->dxeChannel[idx].healthMonitorTimer);
-      if(NULL != dxeCtxt->dxeChannel[idx].healthMonitorMsg)
-      {
-         wpalMemoryFree(dxeCtxt->dxeChannel[idx].healthMonitorMsg);
-      }
       dxeChannelClose(dxeCtxt, &dxeCtxt->dxeChannel[idx]);
 #ifdef WLANDXE_TEST_CHANNEL_ENABLE
       channel    = &dxeCtxt->dxeChannel[idx];
@@ -4682,8 +4177,10 @@
 
    wpalMemoryFree(pDXEContext);
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -4707,6 +4204,7 @@
 {
    wpt_status               status = eWLAN_PAL_STATUS_SUCCESS;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
 
@@ -4714,6 +4212,7 @@
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return status;
 }
 
@@ -4742,8 +4241,10 @@
    wpt_status                status = eWLAN_PAL_STATUS_E_FAILURE;
    WLANDXE_PowerStateType    reqPowerState;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
+#endif
 
    dxeCtxt = (WLANDXE_CtrlBlkType *)(msgContent->pContext);
    reqPowerState = (WLANDXE_PowerStateType)msgContent->val;
@@ -4798,8 +4299,10 @@
    }
    /* Free MSG buffer */
    wpalMemoryFree(msgPtr);
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
    return;
 }
 
@@ -4826,15 +4329,17 @@
 {
    wpt_status               status = eWLAN_PAL_STATUS_SUCCESS;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    /* Now serialise the message through Tx thread also to make sure
     * no register access when RIVA is in powersave */
    /*Use the same message pointer just change the call back function */
    msgPtr->callback = dxeTxThreadSetPowerStateEventHandler;
    status = wpalPostTxMsg(WDI_GET_PAL_CTX(),
                        msgPtr);
+#ifdef WLAN_DEBUG
    if ( eWLAN_PAL_STATUS_SUCCESS != status )
    {
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -4844,6 +4349,7 @@
 
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
+#endif
 }
 
 /*==========================================================================
@@ -4870,43 +4376,29 @@
    wpt_status               status = eWLAN_PAL_STATUS_SUCCESS;
    WLANDXE_CtrlBlkType     *pDxeCtrlBlk;
    WLANDXE_PowerStateType   hostPowerState;
-   wpt_msg                 *rxCompMsg;
-   wpt_msg                 *txDescReSyncMsg;
+   wpt_msg                  *rxCompMsg;
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
+#endif
    if(NULL == pDXEContext)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "NULL pDXEContext passed by caller", 0, 0, 0);
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
    pDxeCtrlBlk = (WLANDXE_CtrlBlkType *)pDXEContext;
 
+#ifdef WLAN_DEBUG
+   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
+            "Set DXE Power state %d", powerState);
+#endif
    switch(powerState)
    {
       case WDTS_POWER_STATE_FULL:
-         if(WLANDXE_POWER_STATE_IMPS == pDxeCtrlBlk->hostPowerState)
-         {
-            txDescReSyncMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
-            if(NULL == txDescReSyncMsg)
-            {
-               HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                        "WLANDXE_SetPowerState, TX Resync MSG MEM alloc Fail");
-            }
-            else
-            {
-               txDescReSyncMsg->callback = dxeTXReSyncDesc;
-               txDescReSyncMsg->pContext = pDxeCtrlBlk;
-               status = wpalPostTxMsg(WDI_GET_PAL_CTX(),
-                                      txDescReSyncMsg);
-               if(eWLAN_PAL_STATUS_SUCCESS != status)
-               {
-                  HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                           "WLANDXE_SetPowerState, Post TX re-sync MSG fail");
-               }
-            }
-         }
          hostPowerState = WLANDXE_POWER_STATE_FULL;
          break;
       case WDTS_POWER_STATE_BMPS:
@@ -4942,8 +4434,10 @@
       rxCompMsg          = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
       if(NULL == rxCompMsg)
       {
+#ifdef WLAN_DEBUG
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "WLANDXE_SetPowerState, MSG MEM alloc Fail");
+#endif
          return eWLAN_PAL_STATUS_E_RESOURCES;
       }
 
@@ -4956,12 +4450,14 @@
       rxCompMsg->ptr      = cBack;
       status = wpalPostRxMsg(WDI_GET_PAL_CTX(),
                           rxCompMsg);
+#ifdef WLAN_DEBUG
       if ( eWLAN_PAL_STATUS_SUCCESS != status )
       {
          HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "Rx thread Set power state req serialize fail status=%d",
                   status, 0, 0);
       }
+#endif
    }
    else
    {
@@ -4981,21 +4477,24 @@
                status = wpalEnableInterrupt(DXE_INTERRUPT_RX_READY);
                if(eWLAN_PAL_STATUS_SUCCESS != status)
                {
+#ifdef WLAN_DEBUG
                   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                            "%s Enable RX ready interrupt fail", __FUNCTION__);
+#endif
                   return status;
                }
             }
             if(eWLAN_PAL_TRUE == pDxeCtrlBlk->txIntDisabledByIMPS)
             {
                pDxeCtrlBlk->txIntDisabledByIMPS = eWLAN_PAL_FALSE;
-               pDxeCtrlBlk->txIntEnable =  eWLAN_PAL_TRUE;
                /* Enable RX interrupt at here, if new PS is not IMPS */
                status = wpalEnableInterrupt(DXE_INTERRUPT_TX_COMPLE);
                if(eWLAN_PAL_STATUS_SUCCESS != status)
                {
+#ifdef WLAN_DEBUG
                   HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                            "%s Enable TX comp interrupt fail", __FUNCTION__);
+#endif
                   return status;
                }
             }
@@ -5014,9 +4513,10 @@
       }
    }
 
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Exit", __FUNCTION__);
-
+#endif
    return status;
 }
 
@@ -5038,92 +4538,19 @@
    void *pDXEContext
 )
 {
+#ifdef WLAN_DEBUG
    HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
             "%s Enter", __FUNCTION__);
-
+#endif
    if(NULL == pDXEContext)
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "NULL parameter passed by caller", 0, 0, 0);
+#endif
       return (0);
    }
 
    return 
       ((WLANDXE_CtrlBlkType *)pDXEContext)->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].numFreeDesc;
 }
-
-/*==========================================================================
-  @  Function Name 
-    WLANDXE_ChannelDebug
-
-  @  Description 
-    Display DXE Channel debugging information
-    User may request to display DXE channel snapshot
-    Or if host driver detects any abnormal stcuk may display
-
-  @  Parameters
-    displaySnapshot : Dispaly DXE snapshot option
-    enableStallDetect : Enable stall detect feature
-                        This feature will take effect to data performance
-                        Not integrate till fully verification
-
-  @  Return
-    NONE
-
-===========================================================================*/
-void WLANDXE_ChannelDebug
-(
-   wpt_boolean    displaySnapshot,
-   wpt_boolean    enableStallDetect   
-)
-{
-   wpt_msg                  *channelDebugMsg;
-   wpt_uint32                regValue;
-   wpt_status                status = eWLAN_PAL_STATUS_SUCCESS;
-
-   /* Debug Type 1, Display current snapshot */
-   if(displaySnapshot)
-   {
-      /* Whatever RIVA power condition try to wakeup RIVA through SMSM
-       * This will not simply wakeup RIVA
-       * Just incase TX not wanted stuck, Trigger TX again */
-      dxeNotifySmsm(eWLAN_PAL_TRUE, eWLAN_PAL_TRUE);
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-               "Host power state %d, RIVA power state %d",
-                tempDxeCtrlBlk->hostPowerState, tempDxeCtrlBlk->rivaPowerState);
-      /* Get free BD count */
-      wpalReadRegister(WLANDXE_BMU_AVAILABLE_BD_PDU, &regValue);
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_FATAL,
-               "TX Pending frames count %d, Current available BD %d",
-                tempDxeCtrlBlk->txCompletedFrames, (int)regValue);
-
-      channelDebugMsg = (wpt_msg *)wpalMemoryAllocate(sizeof(wpt_msg));
-      if(NULL == channelDebugMsg)
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "WLANDXE_ChannelDebug, MSG MEM alloc Fail");
-         return ;
-      }
-
-      channelDebugMsg->callback = dxeRxThreadChannelDebugHandler;
-      status = wpalPostRxMsg(WDI_GET_PAL_CTX(), channelDebugMsg);
-      if ( eWLAN_PAL_STATUS_SUCCESS != status )
-      {
-         HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                  "Tx thread Set power state req serialize fail status=%d",
-                  status, 0, 0);
-      }
-   }
-
-   /* Debug Type 2, toggling stall detect enable/disable */
-   if(enableStallDetect)
-   {
-      HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "DXE TX Stall detect",
-               0, 0, 0);
-      /* Start Stall detect timer and detect stall */
-      wpalTimerStart(&tempDxeCtrlBlk->dxeChannel[WDTS_CHANNEL_TX_LOW_PRI].healthMonitorTimer,
-                     T_WLANDXE_PERIODIC_HEALTH_M_TIME);
-   }
-   return;
-}
diff --git a/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe_cfg_i.c b/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe_cfg_i.c
index f132532..e09e846 100644
--- a/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe_cfg_i.c
+++ b/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe_cfg_i.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -176,7 +176,7 @@
    WLANDXE_CHANNEL_HANDLE_CIRCULA,
 
    /* Number of Descriptor, NOT CLEAR YET !!! */
-   512,
+   256,
 
    /* MAX num RX Buffer, NOT CLEAR YET !!! */
    1,
@@ -394,8 +394,10 @@
    /* Sanity Check */
    if((NULL == dxeCtrlBlk) || (NULL == channelEntry))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "dxeLinkDescAndCtrlBlk Channel Entry is not valid");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -410,8 +412,10 @@
 
    if((NULL == mappedChannel) || (WDTS_CHANNEL_MAX == idx))
    {
+#ifdef WLAN_DEBUG
       HDXE_MSG(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "%s Failed to map channel", __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
diff --git a/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe_i.h b/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe_i.h
index d614ad2..aebb686 100644
--- a/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe_i.h
+++ b/drivers/staging/prima/CORE/DXE/src/wlan_qct_dxe_i.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -63,7 +63,6 @@
  * -------------------------------------------------------------------------*/
 #include "wlan_qct_dxe.h"
 #include "wlan_qct_pal_trace.h"
-#include "wlan_qct_pal_timer.h"
 #include "vos_trace.h"
 /*----------------------------------------------------------------------------
  * Preprocessor Definitions and Constants
@@ -71,34 +70,22 @@
 #define WLANDXE_CTXT_COOKIE              0xC00CC111
 
 
-/* From here WCNSS DXE register information
+/* From here RIVA DXE register information
  * This is temporary definition location to make compile and unit test
  * If official msmreg.h integrated, this part will be eliminated */
 /* Start with base address */
 
-#define WLANDXE_BMU_AVAILABLE_BD_PDU     0x03080084
-
-#ifdef WCN_PRONTO
-#define WLANDXE_CCU_DXE_INT_SELECT       0xfb2050dc
-#define WLANDXE_CCU_DXE_INT_SELECT_STAT  0xfb2050e0
-#define WLANDXE_CCU_ASIC_INT_ENABLE      0xfb2050e4
-#else
 #define WLANDXE_CCU_DXE_INT_SELECT       0x03200b10
 #define WLANDXE_CCU_DXE_INT_SELECT_STAT  0x03200b14
 #define WLANDXE_CCU_ASIC_INT_ENABLE      0x03200b18
-#endif
 
 #ifdef PAL_OS_TYPE_BMP
-#define WLANDXE_WCNSS_BASE_ADDRESS        0xCDD00000
+#define WLANDXE_RIVA_BASE_ADDRESS        0xCDD00000
 #else
-#ifdef WCN_PRONTO
-#define WLANDXE_WCNSS_BASE_ADDRESS        0xfb000000
-#else
-#define WLANDXE_WCNSS_BASE_ADDRESS        0x03000000
-#endif
+#define WLANDXE_RIVA_BASE_ADDRESS        0x03000000
 #endif /* PAL_OS_TYPE_BMP */
 
-#define WLANDXE_REGISTER_BASE_ADDRESS    WLANDXE_WCNSS_BASE_ADDRESS + 0x202000
+#define WLANDXE_REGISTER_BASE_ADDRESS    WLANDXE_RIVA_BASE_ADDRESS + 0x202000
 
 /* Common over the channels register addresses */
 #define WALNDEX_DMA_CSR_ADDRESS          WLANDXE_REGISTER_BASE_ADDRESS + 0x00
@@ -358,7 +345,7 @@
 #define WLANDXE_CH_STAT_INT_ED_MASK     0x00002000
 
 #define WLANDXE_CH_STAT_MASKED_MASK     0x00000008
-/* Till here WCNSS DXE register information
+/* Till here RIVA DXE register information
  * This is temporary definition location to make compile and unit test
  * If official msmreg.h integrated, this part will be eliminated */
 
@@ -581,8 +568,6 @@
    WLANDXE_ChannelExConfigType     extraConfig;
    WLANDXE_DMAChannelType          assignedDMAChannel;
    wpt_uint64                      rxDoneHistogram;
-   wpt_timer                       healthMonitorTimer;
-   wpt_msg                        *healthMonitorMsg;
 } WLANDXE_ChannelCBType;
 
 typedef struct
@@ -620,7 +605,6 @@
    wpt_uint32                      dxeCookie;
    wpt_packet                     *freeRXPacket;
    wpt_boolean                     rxPalPacketUnavailable;
-   wpt_boolean                     driverReloadInProcessing;
 } WLANDXE_CtrlBlkType;
 
 /*==========================================================================
diff --git a/drivers/staging/prima/CORE/HDD/inc/bap_hdd_main.h b/drivers/staging/prima/CORE/HDD/inc/bap_hdd_main.h
index bdd8664..fe0a707 100644
--- a/drivers/staging/prima/CORE/HDD/inc/bap_hdd_main.h
+++ b/drivers/staging/prima/CORE/HDD/inc/bap_hdd_main.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/bap_hdd_misc.h b/drivers/staging/prima/CORE/HDD/inc/bap_hdd_misc.h
index 822b603..8a92bde 100644
--- a/drivers/staging/prima/CORE/HDD/inc/bap_hdd_misc.h
+++ b/drivers/staging/prima/CORE/HDD/inc/bap_hdd_misc.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/qc_sap_ioctl.h b/drivers/staging/prima/CORE/HDD/inc/qc_sap_ioctl.h
index 3f6c2b6..1bb8b65 100644
--- a/drivers/staging/prima/CORE/HDD/inc/qc_sap_ioctl.h
+++ b/drivers/staging/prima/CORE/HDD/inc/qc_sap_ioctl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -231,7 +231,6 @@
 
 #define QCSAP_IOCTL_MODIFY_ACL          (SIOCIWFIRSTPRIV+18)
 #define QCSAP_IOCTL_GET_CHANNEL_LIST    (SIOCIWFIRSTPRIV+19)
-#define QCSAP_IOCTL_SET_TX_POWER        (SIOCIWFIRSTPRIV+20) 
 
 #define MAX_VAR_ARGS         7
 #define QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_assoc.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_assoc.h
index f3945f6..0c40084 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_assoc.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_assoc.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,11 +39,8 @@
    eConnectionState_IbssDisconnected,
 
    /** Participating in an IBSS network with partner stations also present*/
-   eConnectionState_IbssConnected,
+   eConnectionState_IbssConnected
 
-   /** Disconnecting in an Infrastructure network.*/
-   eConnectionState_Disconnecting
-	
 }eConnectionState;
 /**This structure stores the connection information */
 typedef struct connection_info_s
@@ -101,7 +98,7 @@
 
 extern v_VOID_t hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType );
 
-inline v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddCtx, 
+extern v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddCtx, 
         eMib_dot11DesiredBssType *pConnectedBssType );
 
 int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType );
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg.h
index 2ca113c..8efaaf8 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -260,21 +260,12 @@
     eHDD_DOT11_MODE_11g_ONLY,
     eHDD_DOT11_MODE_11n_ONLY,
     eHDD_DOT11_MODE_11b_ONLY,
-#ifdef WLAN_FEATURE_11AC
-    eHDD_DOT11_MODE_11ac_ONLY,
-    eHDD_DOT11_MODE_11ac,
-#endif
 }eHddDot11Mode;
 
 #define CFG_DOT11_MODE_NAME                    "gDot11Mode"
 #define CFG_DOT11_MODE_MIN                     eHDD_DOT11_MODE_AUTO
-#ifdef WLAN_FEATURE_11AC
-#define CFG_DOT11_MODE_MAX                     eHDD_DOT11_MODE_11ac
-#define CFG_DOT11_MODE_DEFAULT                 eHDD_DOT11_MODE_11ac
-#else
 #define CFG_DOT11_MODE_MAX                     eHDD_DOT11_MODE_11b_ONLY
 #define CFG_DOT11_MODE_DEFAULT                 eHDD_DOT11_MODE_11n
-#endif
 
 #define CFG_CHANNEL_BONDING_MODE_24GHZ_NAME    "gChannelBondingMode24GHz"
 #define CFG_CHANNEL_BONDING_MODE_MIN           WNI_CFG_CHANNEL_BONDING_MODE_STAMIN 
@@ -329,7 +320,7 @@
 #define CFG_SCAN_RESULT_AGE_TIME_CPS_DEFAULT   ( 600 )
 
 #define CFG_RSSI_CATEGORY_GAP_NAME             "gRssiCatGap"
-#define CFG_RSSI_CATEGORY_GAP_MIN              ( 5 )  
+#define CFG_RSSI_CATEGORY_GAP_MIN              ( 10 )  
 #define CFG_RSSI_CATEGORY_GAP_MAX              ( 100 )  
 #define CFG_RSSI_CATEGORY_GAP_DEFAULT          ( 30 )
 
@@ -384,11 +375,6 @@
 #define CFG_AP_COUNTRY_CODE_MAX                "USI"
 #define CFG_AP_COUNTRY_CODE_DEFAULT            "FFF"
 
-#define CFG_AP_ENABLE_RANDOM_BSSID_NAME            "gEnableApRandomBssid"
-#define CFG_AP_ENABLE_RANDOM_BSSID_MIN             ( 0 )
-#define CFG_AP_ENABLE_RANDOM_BSSID_MAX             ( 1 )
-#define CFG_AP_ENABLE_RANDOM_BSSID_DEFAULT         ( 0 )
-
 #define CFG_AP_ENABLE_PROTECTION_MODE_NAME            "gEnableApProt"
 #define CFG_AP_ENABLE_PROTECTION_MODE_MIN             ( 0 )
 #define CFG_AP_ENABLE_PROTECTION_MODE_MAX             ( 1 )
@@ -665,14 +651,7 @@
 #define CFG_CCX_FEATURE_ENABLED_DEFAULT                     (0) //disabled
 #endif // FEATURE_WLAN_CCX
 
-#ifdef FEATURE_WLAN_LFR
-#define CFG_LFR_FEATURE_ENABLED_NAME                       "FastRoamEnabled"
-#define CFG_LFR_FEATURE_ENABLED_MIN                         (0)
-#define CFG_LFR_FEATURE_ENABLED_MAX                         (1)
-#define CFG_LFR_FEATURE_ENABLED_DEFAULT                     (0) //disabled
-#endif // FEATURE_WLAN_LFR
-
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
 #define CFG_FT_RSSI_FILTER_PERIOD_NAME                     "FTRssiFilterPeriod"
 #define CFG_FT_RSSI_FILTER_PERIOD_MIN                      WNI_CFG_FT_RSSI_FILTER_PERIOD_STAMIN
 #define CFG_FT_RSSI_FILTER_PERIOD_MAX                      WNI_CFG_FT_RSSI_FILTER_PERIOD_STAMAX
@@ -688,18 +667,7 @@
 #define CFG_FAST_TRANSITION_ENABLED_NAME_MIN                (0)
 #define CFG_FAST_TRANSITION_ENABLED_NAME_MAX                (1)
 #define CFG_FAST_TRANSITION_ENABLED_NAME_DEFAULT            (0) //disabled
-
-/* This parameter is used to decide whether to Roam or not.
- * AP1 is the currently associated AP and AP2 is chosen for roaming.
- * The Roaming will happen only if AP2 has better Signal Quality and it has a RSSI better than AP1
- * in terms of RoamRssiDiff,and RoamRssiDiff is the number of units (typically measured in dB) AP2
- * is better than AP1. 
- * This check is not done if the value is Zero */
-#define CFG_ROAM_RSSI_DIFF_NAME                             "RoamRssiDiff"
-#define CFG_ROAM_RSSI_DIFF_MIN                              (0)
-#define CFG_ROAM_RSSI_DIFF_MAX                              (125)
-#define CFG_ROAM_RSSI_DIFF_DEFAULT                          (0)
-#endif /* (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) */
+#endif
 
 #define CFG_QOS_WMM_PKT_CLASSIFY_BASIS_NAME                "PktClassificationBasis" // DSCP or 802.1Q
 #define CFG_QOS_WMM_PKT_CLASSIFY_BASIS_MIN                  (0)
@@ -888,71 +856,6 @@
 #define CFG_BTC_A2DP_DHCP_PROTECTION_MAX                     ( 0xFF )
 #define CFG_BTC_A2DP_DHCP_PROTECTION_DEFAULT                 ( 7 )
 
-#define CFG_BTC_STATIC_LEN_INQ_BT_NAME       "btcStaticLenInqBt"
-#define CFG_BTC_STATIC_LEN_INQ_BT_MIN        ( 5000 )
-#define CFG_BTC_STATIC_LEN_INQ_BT_MAX        ( 500000 )
-#define CFG_BTC_STATIC_LEN_INQ_BT_DEFAULT    ( 120000 )
-
-#define CFG_BTC_STATIC_LEN_PAGE_BT_NAME      "btcStaticLenPageBt"
-#define CFG_BTC_STATIC_LEN_PAGE_BT_MIN       ( 5000 )
-#define CFG_BTC_STATIC_LEN_PAGE_BT_MAX       ( 500000 )
-#define CFG_BTC_STATIC_LEN_PAGE_BT_DEFAULT   ( 10000 )
-
-#define CFG_BTC_STATIC_LEN_CONN_BT_NAME      "btcStaticLenConnBt"
-#define CFG_BTC_STATIC_LEN_CONN_BT_MIN       ( 5000 )
-#define CFG_BTC_STATIC_LEN_CONN_BT_MAX       ( 500000 )
-#define CFG_BTC_STATIC_LEN_CONN_BT_DEFAULT   ( 10000 )
-
-#define CFG_BTC_STATIC_LEN_LE_BT_NAME        "btcStaticLenLeBt"
-#define CFG_BTC_STATIC_LEN_LE_BT_MIN         ( 5000 )
-#define CFG_BTC_STATIC_LEN_LE_BT_MAX         ( 500000 )
-#define CFG_BTC_STATIC_LEN_LE_BT_DEFAULT     ( 10000 )
-  
-#define CFG_BTC_STATIC_LEN_INQ_WLAN_NAME     "btcStaticLenInqWlan"
-#define CFG_BTC_STATIC_LEN_INQ_WLAN_MIN      ( 0 )
-#define CFG_BTC_STATIC_LEN_INQ_WLAN_MAX      ( 500000 )
-#define CFG_BTC_STATIC_LEN_INQ_WLAN_DEFAULT  ( 30000 )
-
-#define CFG_BTC_STATIC_LEN_PAGE_WLAN_NAME    "btcStaticLenPageWlan"
-#define CFG_BTC_STATIC_LEN_PAGE_WLAN_MIN     ( 0 )
-#define CFG_BTC_STATIC_LEN_PAGE_WLAN_MAX     ( 500000 )
-#define CFG_BTC_STATIC_LEN_PAGE_WLAN_DEFAULT ( 0 )
-
-#define CFG_BTC_STATIC_LEN_CONN_WLAN_NAME    "btcStaticLenConnWlan"
-#define CFG_BTC_STATIC_LEN_CONN_WLAN_MIN     ( 0 )
-#define CFG_BTC_STATIC_LEN_CONN_WLAN_MAX     ( 500000 )
-#define CFG_BTC_STATIC_LEN_CONN_WLAN_DEFAULT ( 0 )
-
-#define CFG_BTC_STATIC_LEN_LE_WLAN_NAME      "btcStaticLenLeWlan"
-#define CFG_BTC_STATIC_LEN_LE_WLAN_MIN       ( 0 )
-#define CFG_BTC_STATIC_LEN_LE_WLAN_MAX       ( 500000 )
-#define CFG_BTC_STATIC_LEN_LE_WLAN_DEFAULT   ( 0 )
-
-#define CFG_BTC_DYN_MAX_LEN_BT_NAME          "btcDynMaxLenBt"
-#define CFG_BTC_DYN_MAX_LEN_BT_MIN           ( 25000 )
-#define CFG_BTC_DYN_MAX_LEN_BT_MAX           ( 500000 )
-#define CFG_BTC_DYN_MAX_LEN_BT_DEFAULT       ( 250000 )
-
-#define CFG_BTC_DYN_MAX_LEN_WLAN_NAME        "btcDynMaxLenWlan"
-#define CFG_BTC_DYN_MAX_LEN_WLAN_MIN         ( 15000 )
-#define CFG_BTC_DYN_MAX_LEN_WLAN_MAX         ( 500000 )
-#define CFG_BTC_DYN_MAX_LEN_WLAN_DEFAULT     ( 45000 )
-
-#define CFG_BTC_MAX_SCO_BLOCK_PERC_NAME      "btcMaxScoBlockPerc"
-#define CFG_BTC_MAX_SCO_BLOCK_PERC_MIN       ( 0 )
-#define CFG_BTC_MAX_SCO_BLOCK_PERC_MAX       ( 100 )
-#define CFG_BTC_MAX_SCO_BLOCK_PERC_DEFAULT   ( 1 )
-
-#define CFG_BTC_DHCP_PROT_ON_A2DP_NAME       "btcDhcpProtOnA2dp"
-#define CFG_BTC_DHCP_PROT_ON_A2DP_MIN        ( 0 )
-#define CFG_BTC_DHCP_PROT_ON_A2DP_MAX        ( 1 )
-#define CFG_BTC_DHCP_PROT_ON_A2DP_DEFAULT    ( 1 )
-
-#define CFG_BTC_DHCP_PROT_ON_SCO_NAME        "btcDhcpProtOnSco"
-#define CFG_BTC_DHCP_PROT_ON_SCO_MIN         ( 0 )
-#define CFG_BTC_DHCP_PROT_ON_SCO_MAX         ( 1 )
-#define CFG_BTC_DHCP_PROT_ON_SCO_DEFAULT     ( 0 )
-
 #if defined WLAN_FEATURE_VOWIFI_11R
 #define CFG_FT_ENABLE_NAME                              "gFtEnabled"
 #define CFG_FT_ENABLE_MIN                               (0)
@@ -1007,7 +910,7 @@
 #define CFG_NEIGHBOR_LOOKUP_RSSI_THRESHOLD_DEFAULT   (120)
 
 #define CFG_NEIGHBOR_SCAN_CHAN_LIST_NAME                      "gNeighborScanChannelList"
-#define CFG_NEIGHBOR_SCAN_CHAN_LIST_DEFAULT                   ""
+#define CFG_NEIGHBOR_SCAN_CHAN_LIST_DEFAULT                   "1,6"
 
 #define CFG_NEIGHBOR_SCAN_MIN_CHAN_TIME_NAME                  "gNeighborScanChannelMinTime"
 #define CFG_NEIGHBOR_SCAN_MIN_CHAN_TIME_MIN                   (10)   
@@ -1123,34 +1026,12 @@
 #define CFG_ENABLE_DFS_CHNL_SCAN_MAX               ( 1 )
 #define CFG_ENABLE_DFS_CHNL_SCAN_DEFAULT           ( 1 )
 
-#define CFG_ENABLE_IGNORE_CHAN165                   "gIgnore_Chan165"
-#define CFG_ENABLE_IGNORE_CHAN165_MIN               ( 0 )
-#define CFG_ENABLE_IGNORE_CHAN165_MAX               ( 1 )
-#define CFG_ENABLE_IGNORE_CHAN165_DEFAULT           ( 0 )
-
 typedef enum
 {
     eHDD_LINK_SPEED_REPORT_ACTUAL = 0,
     eHDD_LINK_SPEED_REPORT_MAX = 1,
     eHDD_LINK_SPEED_REPORT_MAX_SCALED = 2,
 }eHddLinkSpeedReportType;
-#ifdef WLAN_FEATURE_11AC
-#define CFG_VHT_CHANNEL_WIDTH                "gVhtChannelWidth"
-#define CFG_VHT_CHANNEL_WIDTH_MIN            ( 0 )
-#define CFG_VHT_CHANNEL_WIDTH_MAX            ( 2 )
-#define CFG_VHT_CHANNEL_WIDTH_DEFAULT        ( 2 )
-
-#define CFG_VHT_ENABLE_RX_MCS_8_9               "gVhtRxMCS"
-#define CFG_VHT_ENABLE_RX_MCS_8_9_MIN           ( 0 )
-#define CFG_VHT_ENABLE_RX_MCS_8_9_MAX           ( 2 )
-#define CFG_VHT_ENABLE_RX_MCS_8_9_DEFAULT       ( 0 )
-
-#define CFG_VHT_ENABLE_TX_MCS_8_9               "gVhtTxMCS"
-#define CFG_VHT_ENABLE_TX_MCS_8_9_MIN           ( 0 )
-#define CFG_VHT_ENABLE_TX_MCS_8_9_MAX           ( 2 )
-#define CFG_VHT_ENABLE_TX_MCS_8_9_DEFAULT       ( 0 )
-
-#endif
 
 #define CFG_REPORT_MAX_LINK_SPEED                  "gReportMaxLinkSpeed"
 #define CFG_REPORT_MAX_LINK_SPEED_MIN              ( eHDD_LINK_SPEED_REPORT_ACTUAL )
@@ -1247,40 +1128,6 @@
 #define CFG_ENABLE_DYNAMIC_DTIM_MAX        ( 5 )
 #define CFG_ENABLE_DYNAMIC_DTIM_DEFAULT    ( 0 )
 
-/*
- * Enable First Scan 2G Only
- * Options
- * 0 - Disable First Scan 2G Option
- * 1 - Enable First Scan 2G Option
- */
-#define CFG_ENABLE_FIRST_SCAN_2G_ONLY_NAME            "gEnableFirstScan2GOnly"
-#define CFG_ENABLE_FIRST_SCAN_2G_ONLY_MIN        ( 0 )
-#define CFG_ENABLE_FIRST_SCAN_2G_ONLY_MAX        ( 1 )
-#define CFG_ENABLE_FIRST_SCAN_2G_ONLY_DEFAULT    ( 0 )
-
-/*
- * Skip DFS Channel in case of P2P Search
- * Options
- * 0 - Don't Skip DFS Channel in case of P2P Search
- * 1 - Skip DFS Channel in case of P2P Search
- */
-#define CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_NAME       "gSkipDfsChannelInP2pSearch"
-#define CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_MIN        ( 0 )
-#define CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_MAX        ( 1 )
-#define CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_DEFAULT    ( 0 )
-
-/*
- * Ignore Dynamic Dtim in case of P2P
- * Options
- * 0 - Consider Dynamic Dtim incase of P2P
- * 1 - Ignore Dynamic Dtim incase of P2P
- */
-#define CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_NAME       "gIgnoreDynamicDtimInP2pMode"
-#define CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_MIN        ( 0 )
-#define CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_MAX        ( 1 )
-#define CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_DEFAULT    ( 0 )
-
-
 #define CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_NAME  "gEnableAutomaticTxPowerControl"
 #define CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_MIN        ( 0 )
 #define CFG_ENABLE_AUTOMATIC_TX_POWER_CONTROL_MAX        ( 1 )
@@ -1301,16 +1148,6 @@
 #define CFG_ENABLE_MCC_ENABLED_DEFAULT          ( 0 ) 
 
 /*
- * Allow GO in MCC mode to accept different beacon interval than STA's.
- * Added for Wi-Fi Cert. 5.1.12
- * Default: Disable
- */
-#define CFG_ALLOW_MCC_GO_DIFF_BI_NAME           "gAllowMCCGODiffBI"
-#define CFG_ALLOW_MCC_GO_DIFF_BI_MIN            ( 0 )
-#define CFG_ALLOW_MCC_GO_DIFF_BI_MAX            ( 1 )
-#define CFG_ALLOW_MCC_GO_DIFF_BI_DEFAULT        ( 0 ) 
-
-/*
  * Enable/Disable Thermal Mitigation feature
  * Default: Disable
  */
@@ -1328,15 +1165,6 @@
 #define CFG_ENABLE_MODULATED_DTIM_MAX        ( 5 )
 #define CFG_ENABLE_MODULATED_DTIM_DEFAULT    ( 0 )
 
-/*
- * Enable/Disable Multicast MAC Address List feature
- * Default: Disable
- */
-#define CFG_MC_ADDR_LIST_ENABLE_NAME          "gMCAddrListEnable"
-#define CFG_MC_ADDR_LIST_ENABLE_MIN           ( 0 )
-#define CFG_MC_ADDR_LIST_ENABLE_MAX           ( 1 )
-#define CFG_MC_ADDR_LIST_ENABLE_DEFAULT       ( 0 )
-
 /*--------------------------------------------------------------------------- 
   Type declarations
   -------------------------------------------------------------------------*/ 
@@ -1378,19 +1206,6 @@
    v_U8_t        btcExecutionMode;
    v_U8_t        btcConsBtSlotsToBlockDuringDhcp;
    v_U8_t        btcA2DPBtSubIntervalsDuringDhcp;
-   v_U32_t       btcStaticLenInqBt;
-   v_U32_t       btcStaticLenPageBt;
-   v_U32_t       btcStaticLenConnBt;
-   v_U32_t       btcStaticLenLeBt;
-   v_U32_t       btcStaticLenInqWlan;
-   v_U32_t       btcStaticLenPageWlan;
-   v_U32_t       btcStaticLenConnWlan;
-   v_U32_t       btcStaticLenLeWlan;
-   v_U32_t       btcDynMaxLenBt;
-   v_U32_t       btcDynMaxLenWlan;
-   v_U32_t       btcMaxScoBlockPerc;
-   v_U32_t       btcDhcpProtOnA2dp;
-   v_U32_t       btcDhcpProtOnSco;
    v_U32_t       nImpsModSleepTime;
    v_U32_t       nImpsMaxSleepTime;
    v_U32_t       nImpsMinSleepTime;
@@ -1425,7 +1240,6 @@
 
 #ifdef WLAN_SOFTAP_FEATURE
    v_BOOL_t      apUapsdEnabled;
-   v_BOOL_t      apRandomBssidEnabled;
    v_BOOL_t      apProtEnabled;
    v_U16_t       apProtection;
    v_BOOL_t      apOBSSProtEnabled;
@@ -1509,17 +1323,13 @@
    v_U32_t                      InfraUapsdBeSuspIntv;
    v_U32_t                      InfraUapsdBkSrvIntv;
    v_U32_t                      InfraUapsdBkSuspIntv;
-#ifdef FEATURE_WLAN_LFR
-   v_BOOL_t                     isFastRoamIniFeatureEnabled;
-#endif
 #ifdef FEATURE_WLAN_CCX
    v_U32_t                      InfraInactivityInterval;
    v_BOOL_t                     isCcxIniFeatureEnabled;
 #endif
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
    v_U8_t                       FTRssiFilterPeriod;
    v_BOOL_t                     isFastTransitionEnabled;
-   v_U8_t                       RoamRssiDiff;
 #endif
 
    hdd_wmm_classification_t     PktClassificationBasis; // DSCP or 802.1Q
@@ -1613,7 +1423,6 @@
    v_S31_t                     linkSpeedRssiHigh;
    v_S31_t                     linkSpeedRssiLow;
    v_U8_t                      enableMCC;
-   v_U8_t                      allowMCCGODiffBI;
 #ifdef WLAN_FEATURE_P2P
    v_BOOL_t                    isP2pDeviceAddrAdministrated;
 #endif
@@ -1621,17 +1430,7 @@
 #ifdef WLAN_FEATURE_PACKET_FILTERING
    v_BOOL_t                    isMcAddrListFilter;
 #endif
-#ifdef WLAN_FEATURE_11AC
-   v_U8_t                      vhtChannelWidth;
-   v_U8_t                      vhtRxMCS;
-   v_U8_t                      vhtTxMCS;
-#endif
    v_U8_t                      enableModulatedDTIM;
-   v_U32_t                     fEnableMCAddrList;
-   v_BOOL_t                    enableFirstScan2GOnly;
-   v_BOOL_t                    skipDfsChnlInP2pSearch;
-   v_BOOL_t                    ignoreDynamicDtimInP2pMode;
-   v_U8_t                      ignore_chan165;
 } hdd_config_t;
 /*--------------------------------------------------------------------------- 
   Function declarations and documenation
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg80211.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg80211.h
index eb7d44c..597111b 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg80211.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_cfg80211.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -73,13 +73,6 @@
 struct cfg80211_bss* wlan_hdd_cfg80211_update_bss_db( hdd_adapter_t *pAdapter,
                                       tCsrRoamInfo *pRoamInfo
                                       );
-
-#ifdef FEATURE_WLAN_LFR
-int wlan_hdd_cfg80211_pmksa_candidate_notify(
-                    hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo,
-                    int index, bool preauth );
-#endif
-
 #ifdef FEATURE_WLAN_WAPI
 void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter,
               u8 key_index, const u8 *mac_addr, u8 *key , int key_Len);
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_dev_pwr.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_dev_pwr.h
index a936bb6..27f55ef 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_dev_pwr.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_dev_pwr.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_dp_utils.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_dp_utils.h
index 83b49d1..33d9418 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_dp_utils.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_dp_utils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_ether.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_ether.h
index a8f9e45..ef83bda 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_ether.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_ether.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_ftm.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_ftm.h
index 1185f8b..7f0cff0 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_ftm.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_ftm.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_host_offload.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_host_offload.h
index 9bc4477..de0f3f7 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_host_offload.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_host_offload.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_hostapd.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_hostapd.h
index 2141ebb..00525a2 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_hostapd.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_hostapd.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_includes.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_includes.h
index 7d5b0df..07155e3 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_includes.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_includes.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_keep_alive.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_keep_alive.h
index d23cce3..910a46f 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_keep_alive.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_keep_alive.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -49,7 +49,6 @@
     v_U8_t  hostIpv4Addr[4]; 
     v_U8_t  destIpv4Addr[4];
     v_U8_t  destMacAddr [6];
-    v_U8_t  bssIdx;
 } tKeepAliveRequest, *tpKeepAliveRequest;
 
 #endif // __WLAN_HDD_KEEP_ALIVE_H__
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_main.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_main.h
index b369397..4c427e1 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_main.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_main.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -50,9 +50,6 @@
 #include <wlan_hdd_wmm.h>
 #include <wlan_hdd_cfg.h>
 #include <linux/spinlock.h>
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-#include <linux/wakelock.h>
-#endif
 #ifdef ANI_MANF_DIAG
 #include <wlan_hdd_ftm.h>
 #endif
@@ -135,11 +132,6 @@
 #define WLAN_HDD_PUBLIC_ACTION_FRAME 4
 #define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
 #define WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET 30
-#define WLAN_HDD_P2P_SOCIAL_CHANNELS 3
-
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-#define HDD_WAKE_LOCK_DURATION 50
-#endif
 
 typedef struct hdd_tx_rx_stats_s
 {
@@ -460,7 +452,7 @@
 
    v_BOOL_t bSendDisconnect;
 
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
    int     ft_carrier_on;
 #endif
 };
@@ -574,7 +566,7 @@
    v_U32_t waitScanResult;
 
 #ifdef WLAN_FEATURE_P2P
-  v_BOOL_t flushP2pScanResults;
+   v_BOOL_t p2pSearch;
 #endif
 
    /* Additional IE for scan */
@@ -885,22 +877,6 @@
 #ifdef WLAN_FEATURE_PACKET_FILTERING
    t_multicast_add_list mc_addr_list;
 #endif
-
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-   struct wake_lock rx_wake_lock;
-#endif
-
-   /* 
-    * Framework initiated driver restarting 
-    *    hdd_reload_timer   : Restart retry timer
-    *    isRestartInProgress: Restart in progress
-    *    hdd_restart_retries: Restart retries
-    *
-    */
-   vos_timer_t hdd_restart_timer;
-   atomic_t isRestartInProgress;
-   u_int8_t hdd_restart_retries;
-   
 };
 
 
@@ -972,6 +948,4 @@
 VOS_STATUS hdd_disable_bmps_imps(hdd_context_t *pHddCtx, tANI_U8 session_type);
 
 eHalStatus hdd_smeCloseSessionCallback(void *pContext);
-VOS_STATUS wlan_hdd_restart_driver(hdd_context_t *pHddCtx);
-void hdd_exchange_version_and_caps(hdd_context_t *pHddCtx);
 #endif    // end #if !defined( WLAN_HDD_MAIN_H )
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_mib.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_mib.h
index 85f198f..0cb3dbe 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_mib.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_mib.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_oemdata.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_oemdata.h
index 76ca895..e6815d6 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_oemdata.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_oemdata.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_p2p.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_p2p.h
index f4d8cc3..f9086fe 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_p2p.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_p2p.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -37,8 +37,6 @@
 #define WAIT_REM_CHAN_READY     1000
 #define WAIT_CHANGE_CHANNEL_FOR_OFFCHANNEL_TX 3000
 
-#define ACTION_FRAME_DEFAULT_WAIT 200
-
 #define WLAN_HDD_GET_TYPE_FRM_FC(__fc__)         (((__fc__) & 0x0F) >> 2)
 #define WLAN_HDD_GET_SUBTYPE_FRM_FC(__fc__)      (((__fc__) & 0xF0) >> 4)
 #define WLAN_HDD_80211_FRM_DA_OFFSET             4
@@ -94,7 +92,6 @@
 
 void hdd_remainChanReadyHandler( hdd_adapter_t *pAdapter );
 void hdd_sendActionCnf( hdd_adapter_t *pAdapter, tANI_BOOLEAN actionSendSuccess );
-int wlan_hdd_check_remain_on_channel(hdd_adapter_t *pAdapter);
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
 int wlan_hdd_action( struct wiphy *wiphy, struct net_device *dev,
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_packet_filtering.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_packet_filtering.h
index d052ac6..d42c091 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_packet_filtering.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_packet_filtering.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -87,7 +87,6 @@
     v_U8_t            filterId;
     v_U8_t            numParams;
     struct PacketFilterParamsCfg paramsData [HDD_MAX_CMP_PER_PACKET_FILTER];
-    v_U8_t            bssIdx;
 }tPacketFilterCfg, *tpPacketFilterCfg;
 
 #endif
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_power.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_power.h
index df654b0..82b5008 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_power.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_power.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h
index 7a32214..4f566d9 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_tx_rx.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_tx_rx.h
index 669e216..d8bf1cd 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_tx_rx.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_tx_rx.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_version.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_version.h
index 368ab9a..dca987f 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_version.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_version.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wext.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wext.h
index 579cefe..2e0a7ac 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wext.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wext.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -386,8 +386,6 @@
 
 VOS_STATUS wlan_hdd_get_classAstats(hdd_adapter_t *pAdapter);
 
-VOS_STATUS wlan_hdd_get_station_stats(hdd_adapter_t *pAdapter);
-
 VOS_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, v_S7_t *rssi_value);
 
 #endif // __WEXT_IW_H__
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wmm.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wmm.h
index f84fe65..7c27ff7 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wmm.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wmm.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wowl.h b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wowl.h
index 2376e10..8a4ed15 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wowl.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_hdd_wowl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/inc/wlan_qct_driver.h b/drivers/staging/prima/CORE/HDD/inc/wlan_qct_driver.h
index 18b00d4..aaca28f 100644
--- a/drivers/staging/prima/CORE/HDD/inc/wlan_qct_driver.h
+++ b/drivers/staging/prima/CORE/HDD/inc/wlan_qct_driver.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/src/bap_hdd_main.c b/drivers/staging/prima/CORE/HDD/src/bap_hdd_main.c
index 6352be6..fa398bf 100644
--- a/drivers/staging/prima/CORE/HDD/src/bap_hdd_main.c
+++ b/drivers/staging/prima/CORE/HDD/src/bap_hdd_main.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -3605,6 +3605,7 @@
 } // BslProcessACLDataTx()
 
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
 static inline void *hci_get_drvdata(struct hci_dev *hdev)
 {
     return hdev->driver_data;
@@ -3614,6 +3615,7 @@
 {
     hdev->driver_data = data;
 }
+#endif
 
 /*---------------------------------------------------------------------------
  *   Function definitions
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c
index 62fcbc0..7f3e39c 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_assoc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -99,10 +99,9 @@
 #define BEACON_FRAME_IES_OFFSET 12
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
-extern void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set, v_U8_t sessionId);
+extern void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set);
 #endif
 
-void hdd_ResetCountryCodeAfterDisAssoc(hdd_adapter_t *pAdapter);
 
 static inline v_VOID_t hdd_connSetConnectionState( hdd_station_ctx_t *pHddStaCtx, eConnectionState connState )
 {         
@@ -369,12 +368,12 @@
 
     // We need to send the IEs to the supplicant.
     buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
+    vos_mem_zero(buff, IW_CUSTOM_MAX); 
     if (buff == NULL) 
     {
         hddLog(LOGE, "%s: kmalloc unable to allocate memory", __func__); 
         return;
     }
-    vos_mem_zero(buff, IW_CUSTOM_MAX); 
 
     // Sme needs to send the RIC IEs first 
     str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX);
@@ -655,8 +654,7 @@
     netif_tx_disable(dev);
     netif_carrier_off(dev);
     
-    INIT_COMPLETION(pAdapter->disconnect_comp_var);
-    hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting );
+    hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected );
     /* If only STA mode is on */
     if((pHddCtx->concurrency_mode <= 1) && (pHddCtx->no_of_sessions[WLAN_HDD_INFRA_STATION] <=1))
     {
@@ -680,7 +678,7 @@
             /* To avoid wpa_supplicant sending "HANGED" CMD to ICS UI */
             if( eCSR_ROAM_LOSTLINK == roamStatus )
             {
-                cfg80211_disconnected(dev, pRoamInfo->reasonCode, NULL, 0, GFP_KERNEL);
+                cfg80211_disconnected(dev, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, NULL, 0, GFP_KERNEL);
             }
             else
             {
@@ -690,11 +688,7 @@
             //If the Device Mode is Station
             // and the P2P Client is Connected
             //Enable BMPS
-
-            // In case of JB, as Change-Iface may or maynot be called for p2p0
-            // Enable BMPS/IMPS in case P2P_CLIENT disconnected   
-            if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
-                (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) &&
+            if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
                 (vos_concurrent_sessions_running()))
             {
                //Enable BMPS only of other Session is P2P Client
@@ -709,7 +703,8 @@
                    {
                        //Only P2P Client is there Enable Bmps back
                        if((0 == pHddCtx->no_of_sessions[VOS_STA_SAP_MODE]) &&
-                          (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE]))
+                          (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE]) &&
+                          (1 == pHddCtx->no_of_sessions[VOS_P2P_CLIENT_MODE]))
                        {
                            hdd_enable_bmps_imps(pHddCtx);
                        }
@@ -912,38 +907,26 @@
    return( vosStatus );
 }
 
-#if  defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#ifdef FEATURE_WLAN_CCX
 static void hdd_SendReAssocEvent(struct net_device *dev, hdd_adapter_t *pAdapter,
     tCsrRoamInfo *pCsrRoamInfo, v_U8_t *reqRsnIe, tANI_U32 reqRsnLength)
 {
     unsigned int len = 0;
     u8 *pFTAssocRsp = NULL;
-    v_U8_t *rspRsnIe = kmalloc(IW_GENERIC_IE_MAX, GFP_KERNEL);
+    v_U8_t rspRsnIe[IW_GENERIC_IE_MAX];
     tANI_U32 rspRsnLength = 0;
     struct ieee80211_channel *chan;
 
-    if (!rspRsnIe)
-    {
-        hddLog(LOGE, "%s: Unable to allocate RSN IE", __func__);
-        return;
-    }
-
     if (pCsrRoamInfo == NULL)
-    {
-        hddLog(LOGE, "%s: Invalid CSR roam info", __func__);
-        goto done;
-    }
+        return;
 
     if (pCsrRoamInfo->nAssocRspLength == 0)
-    {
-        hddLog(LOGE, "%s: Invalid assoc response length", __func__);
-        goto done;
-    }
+        return;
 
     pFTAssocRsp = (u8 *)(pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength +
                     pCsrRoamInfo->nAssocReqLength);
     if (pFTAssocRsp == NULL)
-        goto done;
+        return;
 
     //pFTAssocRsp needs to point to the IEs
     pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET;
@@ -954,16 +937,13 @@
     // Send the Assoc Resp, the supplicant needs this for initial Auth.
     len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET;
     rspRsnLength = len;
+    memset(rspRsnIe, 0, IW_GENERIC_IE_MAX);
     memcpy(rspRsnIe, pFTAssocRsp, len);
-    memset(rspRsnIe + len, 0, IW_GENERIC_IE_MAX - len);
 
     chan = ieee80211_get_channel(pAdapter->wdev.wiphy, (int) pCsrRoamInfo->pBssDesc->channelId);
     cfg80211_roamed(dev,chan,pCsrRoamInfo->bssid,
                     reqRsnIe, reqRsnLength,
                     rspRsnIe, rspRsnLength,GFP_KERNEL);
-
-done:
-    kfree(rspRsnIe);
 }
 #endif /* FEATURE_WLAN_CCX */
 
@@ -975,7 +955,7 @@
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
     hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
     VOS_STATUS vosStatus;
-#if  defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#ifdef FEATURE_WLAN_CCX
     int ft_carrier_on = FALSE;
 #endif
     int status;
@@ -1011,7 +991,7 @@
            kernel. we have registered net device notifier for device change notification. With this we will come to 
            know that the device is getting activated properly.
            */
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
         if (pHddStaCtx->ft_carrier_on == FALSE)
         {
 #endif
@@ -1034,11 +1014,11 @@
 
             // Disable Linkup Event Servicing - no more service required from the net device notifier call
             pAdapter->isLinkUpSvcNeeded = FALSE;
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
         }
         else { 
             pHddStaCtx->ft_carrier_on = FALSE;
-#if  defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#ifdef FEATURE_WLAN_CCX
             ft_carrier_on = TRUE;
 #endif /* FEATURE_WLAN_CCX */
         }
@@ -1075,7 +1055,7 @@
                     pAdapter->sessionId,
                     &rspRsnLength,
                     rspRsnIe);
-#if  defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#ifdef FEATURE_WLAN_CCX
             if(ft_carrier_on)
                     hdd_SendReAssocEvent(dev, pAdapter, pRoamInfo, reqRsnIe, reqRsnLength);
             else
@@ -1134,14 +1114,12 @@
     }  
     else 
     {
+        char country_code[3] = SME_INVALID_COUNTRY_CODE;
+        eHalStatus status = eHAL_STATUS_SUCCESS;
         hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
 
         hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
-        pr_info("wlan: connection failed with %02x:%02x:%02x:%02x:%02x:%02x"
-                " reason:%d and Status:%d\n", pWextState->req_bssId[0],
-                pWextState->req_bssId[1], pWextState->req_bssId[2],
-                pWextState->req_bssId[3], pWextState->req_bssId[4],
-                pWextState->req_bssId[5], roamResult, roamStatus);
+        pr_info("wlan: connection failed\n");
 
         /*Handle all failure conditions*/
         hdd_connSetConnectionState( pHddStaCtx, eConnectionState_NotConnected);
@@ -1153,11 +1131,7 @@
         //If the Device Mode is Station
         // and the P2P Client is Connected
         //Enable BMPS
-
-        // In case of JB, as Change-Iface may or maynot be called for p2p0
-        // Enable BMPS/IMPS in case P2P_CLIENT disconnected   
-        if(((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
-            (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) &&
+        if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
             (vos_concurrent_sessions_running()))
         {
            //Enable BMPS only of other Session is P2P Client
@@ -1172,7 +1146,8 @@
                {
                    //Only P2P Client is there Enable Bmps back
                    if((0 == pHddCtx->no_of_sessions[VOS_STA_SAP_MODE]) &&
-                      (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE]))
+                      (0 == pHddCtx->no_of_sessions[VOS_P2P_GO_MODE]) &&
+                      (1 == pHddCtx->no_of_sessions[VOS_P2P_CLIENT_MODE]))
                    {
                        hdd_enable_bmps_imps(pHddCtx);
                    }
@@ -1198,17 +1173,22 @@
         }
 #endif 
 
-        /*Clear the roam profile*/
-        hdd_clearRoamProfileIe( pAdapter );
-
         netif_tx_disable(dev);
         netif_carrier_off(dev);
-        
-        if (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode)
+
+        /* Association failed; Reset the country code information
+         * so that it re-initialize the valid channel list*/
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                "%s: Association failed and resetting the country code"
+                "to default \n",__func__);
+
+        status = (int)sme_ChangeCountryCode(pHddCtx->hHal, NULL, 
+                                            &country_code[0], pAdapter,
+                                            pHddCtx->pvosContext);
+        if( 0 != status )
         {
-            /* Association failed; Reset the country code information
-             * so that it re-initialize the valid channel list*/
-            hdd_ResetCountryCodeAfterDisAssoc(pAdapter);
+            VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                    "%s: SME Change Country code to default failed \n",__func__);
         }
     }
 
@@ -1565,7 +1545,6 @@
     hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext;
     hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
     hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-    VOS_STATUS status = VOS_STATUS_SUCCESS;
 
     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
             "CSR Callback: status= %d result= %d roamID=%ld", 
@@ -1589,7 +1568,7 @@
             }
             break;
             
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
             /* We did pre-auth,then we attempted a 11r or ccx reassoc.
              * reassoc failed due to failure, timeout, reject from ap
              * in any case tell the OS, our carrier is off and mark 
@@ -1617,30 +1596,10 @@
             // Where in we will not mark the link down
             // Also we want to stop tx at this point when we will be
             // doing disassoc at this time. This saves 30-60 msec
-            // after reassoc.
+            // after reassoc. We see old traffic from old connection on new channel
             {
                 struct net_device *dev = pAdapter->dev;
                 netif_tx_disable(dev);
-                /*
-        		 * Deregister for this STA with TL with the objective to flush
-        		 * all the packets for this STA from wmm_tx_queue. If not done here,
-        		 * we would run into a race condition (CR390567) wherein TX
-        		 * thread would schedule packets from wmm_tx_queue AFTER peer STA has
-        		 * been deleted. And, these packets get assigned with a STA idx of
-        		 * self-sta (since the peer STA has been deleted) and get transmitted
-        		 * on the new channel before the reassoc request. Since there will be
-        		 * no ACK on the new channel, each packet gets retransmitted which
-        		 * takes several seconds before the transmission of reassoc request.
-        		 * This leads to reassoc-timeout and roam failure.
-    		     */
-                status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] );
-                if ( !VOS_IS_STATUS_SUCCESS(status ) )
-                {
-                    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
-                            FL("hdd_roamDeregisterSTA() failed to for staID %d.  Status= %d [0x%x]"),
-                            pHddStaCtx->conn_info.staId[0], status, status );
-                    halStatus = eHAL_STATUS_FAILURE;
-                }		
             }
             pHddStaCtx->ft_carrier_on = TRUE;
             break;
@@ -1649,20 +1608,20 @@
         case eCSR_ROAM_SHOULD_ROAM:
            // Dont need to do anything
             {
+                VOS_STATUS  status = VOS_STATUS_SUCCESS;
                 struct net_device *dev = pAdapter->dev;
                 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
                 // notify apps that we can't pass traffic anymore
                 netif_tx_disable(dev);
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
                 if (pHddStaCtx->ft_carrier_on == FALSE)
                 {
 #endif
                     netif_carrier_off(dev);
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
                 }
 #endif
 
-#if  !(defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR))
                 //We should clear all sta register with TL, for now, only one.
                 status = hdd_roamDeregisterSTA( pAdapter, pHddStaCtx->conn_info.staId [0] );
                 if ( !VOS_IS_STATUS_SUCCESS(status ) )
@@ -1670,9 +1629,9 @@
                     VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
                         FL("hdd_roamDeregisterSTA() failed to for staID %d.  Status= %d [0x%x]"),
                                         pHddStaCtx->conn_info.staId[0], status, status );
-                    halStatus = eHAL_STATUS_FAILURE;
+                    status = eHAL_STATUS_FAILURE;
                 }
-#endif
+
                 // Clear saved connection information in HDD
                 hdd_connRemoveConnectInfo( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) );
             }
@@ -1680,7 +1639,10 @@
         case eCSR_ROAM_LOSTLINK:
         case eCSR_ROAM_DISASSOCIATED:
             {
+                char country_code[3] = SME_INVALID_COUNTRY_CODE;
+                eHalStatus status = eHAL_STATUS_SUCCESS;
                 hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
+
                 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                         "****eCSR_ROAM_DISASSOCIATED****");
                 halStatus = hdd_DisConnectHandler( pAdapter, pRoamInfo, roamId, roamStatus, roamResult );
@@ -1697,16 +1659,23 @@
                     {
                         /*Filter applied during suspend mode*/
                         /*Clear it here*/
-                        wlan_hdd_set_mc_addr_list(pHddCtx, FALSE, pAdapter->sessionId);
+                        wlan_hdd_set_mc_addr_list(pHddCtx, FALSE);
                     }
                 }
 #endif
 
-                if (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode)
+                VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+                        "%s: Disconnected from the AP and "
+                        "resetting the country code to default\n",__func__);
+                /*reset the country code of previous connection*/
+                status = (int)sme_ChangeCountryCode(pHddCtx->hHal, NULL,
+                        &country_code[0], pAdapter,
+                        pHddCtx->pvosContext
+                        );
+                if( 0 != status )
                 {
-                    /* Disconnected from current AP. Reset the country code information
-                     * so that it re-initialize the valid channel list*/
-                    hdd_ResetCountryCodeAfterDisAssoc(pAdapter);
+                    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                            "%s: SME Change Country code to default failed \n",__func__);
                 }
             }
             break;
@@ -1763,15 +1732,6 @@
             hdd_SendFTEvent(pAdapter);
             break;
 #endif
-#ifdef FEATURE_WLAN_LFR
-        case eCSR_ROAM_PMK_NOTIFY:
-           if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType) 
-           {
-               /* Notify the supplicant of a new candidate */
-               halStatus = wlan_hdd_cfg80211_pmksa_candidate_notify(pAdapter, pRoamInfo, 1, false);
-           }
-           break;
-#endif
 
 #ifdef WLAN_FEATURE_P2P
         case eCSR_ROAM_INDICATE_MGMT_FRAME:
@@ -2814,62 +2774,3 @@
     EXIT();
     return 0;
 }
-
-
-/**---------------------------------------------------------------------------
-
-  \brief hdd_ResetCountryCodeAfterDisAssoc -
-  This function reset the country code to default
-  \param  - pAdapter - Pointer to HDD adaptor
-  \return - nothing
-
-  --------------------------------------------------------------------------*/
-void hdd_ResetCountryCodeAfterDisAssoc(hdd_adapter_t *pAdapter)
-{
-    hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
-    tSmeConfigParams smeConfig;
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE;
-    tANI_U8 currentCountryCode[3] = SME_INVALID_COUNTRY_CODE;
-
-    sme_GetConfigParam(pHddCtx->hHal, &smeConfig);
-
-    VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-            "%s: 11d is %s\n",__func__,
-            smeConfig.csrConfig.Is11dSupportEnabled ? "Enabled" : "Disabled");
-    /* Reset country code only when 11d is enabled
-    */
-    if (smeConfig.csrConfig.Is11dSupportEnabled)
-    {
-        sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, &defaultCountryCode[0]);
-        sme_GetCurrentCountryCode(pHddCtx->hHal, &currentCountryCode[0]);
-
-        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-                "%s: Default country code: %c%c%c, Current Country code: %c%c%c \n",
-                __func__,
-                defaultCountryCode[0], defaultCountryCode[1], defaultCountryCode[2],
-                currentCountryCode[0], currentCountryCode[1], currentCountryCode[2]);
-        /* Reset country code only when there is a mismatch
-         * between current country code and default country code
-         */
-        if ((defaultCountryCode[0] != currentCountryCode[0]) ||
-                (defaultCountryCode[1] != currentCountryCode[1]) ||
-                (defaultCountryCode[2] != currentCountryCode[2]))
-        {
-            VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
-                    "%s: Disconnected from the AP/Assoc failed and "
-                    "resetting the country code to default\n",__func__);
-            /*reset the country code of previous connection*/
-            status = (int)sme_ChangeCountryCode(pHddCtx->hHal, NULL,
-                    &defaultCountryCode[0], pAdapter,
-                    pHddCtx->pvosContext
-                    );
-            if( 0 != status )
-            {
-                VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-                        "%s: failed to Reset the Country Code\n",__func__);
-            }
-        }
-    }
-}
-
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg.c
index 23708b3..3fdaac4 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -457,13 +457,6 @@
                         VAR_FLAGS_OPTIONAL,
                         (void *)CFG_AP_COUNTRY_CODE_DEFAULT ),
 
-   REG_VARIABLE( CFG_AP_ENABLE_RANDOM_BSSID_NAME, WLAN_PARAM_Integer,
-                        hdd_config_t, apRandomBssidEnabled,
-                        VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                        CFG_AP_ENABLE_RANDOM_BSSID_DEFAULT,
-                        CFG_AP_ENABLE_RANDOM_BSSID_MIN,
-                        CFG_AP_ENABLE_RANDOM_BSSID_MAX ),
-
    REG_VARIABLE( CFG_AP_ENABLE_PROTECTION_MODE_NAME, WLAN_PARAM_Integer,
                         hdd_config_t, apProtEnabled, 
                         VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
@@ -803,17 +796,7 @@
                  CFG_CCX_FEATURE_ENABLED_MAX),
 #endif // FEATURE_WLAN_CCX
 
-#ifdef FEATURE_WLAN_LFR
-   // flag to turn ON/OFF Legacy Fast Roaming
-   REG_VARIABLE( CFG_LFR_FEATURE_ENABLED_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t, isFastRoamIniFeatureEnabled, 
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
-                 CFG_LFR_FEATURE_ENABLED_DEFAULT, 
-                 CFG_LFR_FEATURE_ENABLED_MIN, 
-                 CFG_LFR_FEATURE_ENABLED_MAX),
-#endif // FEATURE_WLAN_LFR
-
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
    REG_VARIABLE( CFG_FT_RSSI_FILTER_PERIOD_NAME, WLAN_PARAM_Integer,
                  hdd_config_t, FTRssiFilterPeriod,
                  VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
@@ -829,15 +812,6 @@
                  CFG_FAST_TRANSITION_ENABLED_NAME_DEFAULT, 
                  CFG_FAST_TRANSITION_ENABLED_NAME_MIN, 
                  CFG_FAST_TRANSITION_ENABLED_NAME_MAX),
-
-   /* Variable to specify the delta/difference between the RSSI of current AP 
-    * and roamable AP while roaming */
-   REG_VARIABLE( CFG_ROAM_RSSI_DIFF_NAME, WLAN_PARAM_Integer,
-                 hdd_config_t, RoamRssiDiff, 
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
-                 CFG_ROAM_RSSI_DIFF_DEFAULT, 
-                 CFG_ROAM_RSSI_DIFF_MIN, 
-                 CFG_ROAM_RSSI_DIFF_MAX),
 #endif
 
    REG_VARIABLE( CFG_QOS_WMM_PKT_CLASSIFY_BASIS_NAME , WLAN_PARAM_Integer,
@@ -1062,97 +1036,6 @@
                  CFG_BTC_A2DP_DHCP_PROTECTION_MIN,
                  CFG_BTC_A2DP_DHCP_PROTECTION_MAX ),
 
-   REG_VARIABLE( CFG_BTC_STATIC_LEN_INQ_BT_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcStaticLenInqBt,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_STATIC_LEN_INQ_BT_DEFAULT,
-                 CFG_BTC_STATIC_LEN_INQ_BT_MIN,
-                 CFG_BTC_STATIC_LEN_INQ_BT_MAX ),
-
-   REG_VARIABLE( CFG_BTC_STATIC_LEN_PAGE_BT_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcStaticLenPageBt,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_STATIC_LEN_PAGE_BT_DEFAULT,
-                 CFG_BTC_STATIC_LEN_PAGE_BT_MIN,
-                 CFG_BTC_STATIC_LEN_PAGE_BT_MAX ),
-
-   REG_VARIABLE( CFG_BTC_STATIC_LEN_CONN_BT_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcStaticLenConnBt,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_STATIC_LEN_CONN_BT_DEFAULT,
-                 CFG_BTC_STATIC_LEN_CONN_BT_MIN,
-                 CFG_BTC_STATIC_LEN_CONN_BT_MAX ),
-
-   REG_VARIABLE( CFG_BTC_STATIC_LEN_LE_BT_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcStaticLenLeBt,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_STATIC_LEN_LE_BT_DEFAULT,
-                 CFG_BTC_STATIC_LEN_LE_BT_MIN,
-                 CFG_BTC_STATIC_LEN_LE_BT_MAX ),
-
-   REG_VARIABLE( CFG_BTC_STATIC_LEN_INQ_WLAN_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcStaticLenInqWlan,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_STATIC_LEN_INQ_WLAN_DEFAULT,
-                 CFG_BTC_STATIC_LEN_INQ_WLAN_MIN,
-                 CFG_BTC_STATIC_LEN_INQ_WLAN_MAX ),
-
-   REG_VARIABLE( CFG_BTC_STATIC_LEN_PAGE_WLAN_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcStaticLenPageWlan,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_STATIC_LEN_PAGE_WLAN_DEFAULT,
-                 CFG_BTC_STATIC_LEN_PAGE_WLAN_MIN,
-                 CFG_BTC_STATIC_LEN_PAGE_WLAN_MAX ),
-
-   REG_VARIABLE( CFG_BTC_STATIC_LEN_CONN_WLAN_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcStaticLenConnWlan,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_STATIC_LEN_CONN_WLAN_DEFAULT,
-                 CFG_BTC_STATIC_LEN_CONN_WLAN_MIN,
-                 CFG_BTC_STATIC_LEN_CONN_WLAN_MAX ),
-
-   REG_VARIABLE( CFG_BTC_STATIC_LEN_LE_WLAN_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcStaticLenLeWlan,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_STATIC_LEN_LE_WLAN_DEFAULT,
-                 CFG_BTC_STATIC_LEN_LE_WLAN_MIN,
-                 CFG_BTC_STATIC_LEN_LE_WLAN_MAX ),
-
-   REG_VARIABLE( CFG_BTC_DYN_MAX_LEN_BT_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcDynMaxLenBt,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_DYN_MAX_LEN_BT_DEFAULT,
-                 CFG_BTC_DYN_MAX_LEN_BT_MIN,
-                 CFG_BTC_DYN_MAX_LEN_BT_MAX ),
-
-   REG_VARIABLE( CFG_BTC_DYN_MAX_LEN_WLAN_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcDynMaxLenWlan,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_DYN_MAX_LEN_WLAN_DEFAULT,
-                 CFG_BTC_DYN_MAX_LEN_WLAN_MIN,
-                 CFG_BTC_DYN_MAX_LEN_WLAN_MAX ),
-
-   REG_VARIABLE( CFG_BTC_MAX_SCO_BLOCK_PERC_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcMaxScoBlockPerc,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_MAX_SCO_BLOCK_PERC_DEFAULT,
-                 CFG_BTC_MAX_SCO_BLOCK_PERC_MIN,
-                 CFG_BTC_MAX_SCO_BLOCK_PERC_MAX ),
-
-   REG_VARIABLE( CFG_BTC_DHCP_PROT_ON_A2DP_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcDhcpProtOnA2dp,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_DHCP_PROT_ON_A2DP_DEFAULT,
-                 CFG_BTC_DHCP_PROT_ON_A2DP_MIN,
-                 CFG_BTC_DHCP_PROT_ON_A2DP_MAX ),
-
-   REG_VARIABLE( CFG_BTC_DHCP_PROT_ON_SCO_NAME , WLAN_PARAM_Integer,
-                 hdd_config_t, btcDhcpProtOnSco,
-                 VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-                 CFG_BTC_DHCP_PROT_ON_SCO_DEFAULT,
-                 CFG_BTC_DHCP_PROT_ON_SCO_MIN,
-                 CFG_BTC_DHCP_PROT_ON_SCO_MAX ),
-
 #ifdef WLAN_SOFTAP_FEATURE
    REG_VARIABLE( CFG_AP_LISTEN_MODE_NAME , WLAN_PARAM_Integer,
                  hdd_config_t, nEnableListenMode, 
@@ -1541,13 +1424,6 @@
              CFG_ENABLE_MCC_ENABLED_MIN, 
              CFG_ENABLE_MCC_ENABLED_MAX ),
 
-REG_VARIABLE( CFG_ALLOW_MCC_GO_DIFF_BI_NAME, WLAN_PARAM_Integer, 
-             hdd_config_t, allowMCCGODiffBI,
-             VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
-             CFG_ALLOW_MCC_GO_DIFF_BI_DEFAULT, 
-             CFG_ALLOW_MCC_GO_DIFF_BI_MIN, 
-             CFG_ALLOW_MCC_GO_DIFF_BI_MAX ),             
-
  REG_VARIABLE( CFG_THERMAL_MIGRATION_ENABLE_NAME, WLAN_PARAM_Integer,
               hdd_config_t, thermalMitigationEnable, 
               VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
@@ -1570,64 +1446,6 @@
               CFG_ENABLE_MODULATED_DTIM_MIN, 
               CFG_ENABLE_MODULATED_DTIM_MAX ),
 
- REG_VARIABLE( CFG_MC_ADDR_LIST_ENABLE_NAME, WLAN_PARAM_Integer,
-              hdd_config_t, fEnableMCAddrList,
-              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-              CFG_MC_ADDR_LIST_ENABLE_DEFAULT,
-              CFG_MC_ADDR_LIST_ENABLE_MIN,
-              CFG_MC_ADDR_LIST_ENABLE_MAX ),
-
-#ifdef WLAN_FEATURE_11AC              
-REG_VARIABLE( CFG_VHT_CHANNEL_WIDTH, WLAN_PARAM_Integer,
-              hdd_config_t, vhtChannelWidth, 
-              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
-              CFG_VHT_CHANNEL_WIDTH_DEFAULT, 
-              CFG_VHT_CHANNEL_WIDTH_MIN, 
-              CFG_VHT_CHANNEL_WIDTH_MAX),
-
-REG_VARIABLE( CFG_VHT_ENABLE_RX_MCS_8_9, WLAN_PARAM_Integer,
-              hdd_config_t, vhtRxMCS, 
-              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
-              CFG_VHT_ENABLE_RX_MCS_8_9_DEFAULT, 
-              CFG_VHT_ENABLE_RX_MCS_8_9_MIN, 
-              CFG_VHT_ENABLE_RX_MCS_8_9_MAX),
-
-REG_VARIABLE( CFG_VHT_ENABLE_TX_MCS_8_9, WLAN_PARAM_Integer,
-              hdd_config_t, vhtTxMCS, 
-              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, 
-              CFG_VHT_ENABLE_TX_MCS_8_9_DEFAULT, 
-              CFG_VHT_ENABLE_TX_MCS_8_9_MIN, 
-              CFG_VHT_ENABLE_TX_MCS_8_9_MAX),
-#endif
-
-REG_VARIABLE( CFG_ENABLE_FIRST_SCAN_2G_ONLY_NAME, WLAN_PARAM_Integer,
-              hdd_config_t, enableFirstScan2GOnly, 
-              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
-              CFG_ENABLE_FIRST_SCAN_2G_ONLY_DEFAULT, 
-              CFG_ENABLE_FIRST_SCAN_2G_ONLY_MIN, 
-              CFG_ENABLE_FIRST_SCAN_2G_ONLY_MAX ),
-
-REG_VARIABLE( CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_NAME, WLAN_PARAM_Integer,
-              hdd_config_t, skipDfsChnlInP2pSearch, 
-              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
-              CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_DEFAULT, 
-              CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_MIN, 
-              CFG_ENABLE_SKIP_DFS_IN_P2P_SEARCH_MAX ),
-
-REG_VARIABLE( CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_NAME, WLAN_PARAM_Integer,
-              hdd_config_t, ignoreDynamicDtimInP2pMode, 
-              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
-              CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_DEFAULT, 
-              CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_MIN, 
-              CFG_IGNORE_DYNAMIC_DTIM_IN_P2P_MODE_MAX ),
-
-
- REG_VARIABLE( CFG_ENABLE_IGNORE_CHAN165, WLAN_PARAM_Integer,
-              hdd_config_t, ignore_chan165, 
-              VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, 
-              CFG_ENABLE_IGNORE_CHAN165_DEFAULT, 
-              CFG_ENABLE_IGNORE_CHAN165_MIN, 
-              CFG_ENABLE_IGNORE_CHAN165_MAX ),              
 };
 
 /*
@@ -1734,8 +1552,7 @@
    char *buffer, *line,*pTemp;
    size_t size;
    char *name, *value;
-   /* cfgIniTable is static to avoid excess stack usage */
-   static tCfgIniEntry cfgIniTable[MAX_CFG_INI_ITEMS];
+   tCfgIniEntry cfgIniTable[MAX_CFG_INI_ITEMS];
    VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
 
    memset(cfgIniTable, 0, sizeof(cfgIniTable));
@@ -1913,12 +1730,6 @@
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [FastTransitionEnabled] Value = [%lu] ",pHddCtx->cfg_ini->isFastTransitionEnabled);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gTxPowerCap] Value = [%lu] dBm ",pHddCtx->cfg_ini->nTxPowerCap);
 #endif 
-#ifdef FEATURE_WLAN_LFR
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [FastRoamEnabled] Value = [%lu] ",pHddCtx->cfg_ini->isFastRoamIniFeatureEnabled);
-#endif 
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [RoamRssiDiff] Value = [%lu] ",pHddCtx->cfg_ini->RoamRssiDiff);
-#endif
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraDirAcVo] Value = [%u] ",pHddCtx->cfg_ini->InfraDirAcVo);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraNomMsduSizeAcVo] Value = [0x%x] ",pHddCtx->cfg_ini->InfraNomMsduSizeAcVo);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [InfraMeanDataRateAcVo] Value = [0x%lx] ",pHddCtx->cfg_ini->InfraMeanDataRateAcVo);
@@ -1991,13 +1802,6 @@
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gEnableDFSChnlScan] Value = [%u] ",pHddCtx->cfg_ini->enableDFSChnlScan);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gReportMaxLinkSpeed] Value = [%u] ",pHddCtx->cfg_ini->reportMaxLinkSpeed);
   VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [thermalMitigationEnable] Value = [%u] ",pHddCtx->cfg_ini->thermalMitigationEnable);
-#ifdef WLAN_FEATURE_11AC
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gVhtChannelWidth] value = [%u]\n",pHddCtx->cfg_ini->vhtChannelWidth);
-#endif
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [enableFirstScan2GOnly] Value = [%u] ",pHddCtx->cfg_ini->enableFirstScan2GOnly);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [skipDfsChnlInP2pSearch] Value = [%u] ",pHddCtx->cfg_ini->skipDfsChnlInP2pSearch);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [ignoreDynamicDtimInP2pMode] Value = [%u] ",pHddCtx->cfg_ini->ignoreDynamicDtimInP2pMode);
-  VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, "Name = [gIgnore_Chan165] Value = [%u] ",pHddCtx->cfg_ini->ignore_chan165);
 }
 
 
@@ -2380,12 +2184,6 @@
          return eCSR_DOT11_MODE_11n_ONLY;
       case (eHDD_DOT11_MODE_11b_ONLY):
          return eCSR_DOT11_MODE_11b_ONLY;
-#ifdef WLAN_FEATURE_11AC
-      case (eHDD_DOT11_MODE_11ac_ONLY):
-         return eCSR_DOT11_MODE_11ac_ONLY;
-      case (eHDD_DOT11_MODE_11ac):
-         return eCSR_DOT11_MODE_11ac;
-#endif
       case (eHDD_DOT11_MODE_AUTO):
          return eCSR_DOT11_MODE_AUTO;
    }
@@ -2400,22 +2198,10 @@
    sme_BtcGetConfig(pHddCtx->hHal, &btcParams);
 
    btcParams.btcExecutionMode = pConfig->btcExecutionMode;
-   btcParams.btcConsBtSlotsToBlockDuringDhcp = pConfig->btcConsBtSlotsToBlockDuringDhcp;
-   btcParams.btcA2DPBtSubIntervalsDuringDhcp = pConfig->btcA2DPBtSubIntervalsDuringDhcp;
 
-   btcParams.btcStaticLenInqBt = pConfig->btcStaticLenInqBt;
-   btcParams.btcStaticLenPageBt = pConfig->btcStaticLenPageBt;
-   btcParams.btcStaticLenConnBt = pConfig->btcStaticLenConnBt;
-   btcParams.btcStaticLenLeBt = pConfig->btcStaticLenLeBt;
-   btcParams.btcStaticLenInqWlan = pConfig->btcStaticLenInqWlan;
-   btcParams.btcStaticLenPageWlan = pConfig->btcStaticLenPageWlan;
-   btcParams.btcStaticLenConnWlan = pConfig->btcStaticLenConnWlan;
-   btcParams.btcStaticLenLeWlan = pConfig->btcStaticLenLeWlan;
-   btcParams.btcDynMaxLenBt = pConfig->btcDynMaxLenBt;
-   btcParams.btcDynMaxLenWlan = pConfig->btcDynMaxLenWlan;
-   btcParams.btcMaxScoBlockPerc = pConfig->btcMaxScoBlockPerc;
-   btcParams.btcDhcpProtOnA2dp = pConfig->btcDhcpProtOnA2dp;
-   btcParams.btcDhcpProtOnSco = pConfig->btcDhcpProtOnSco;
+   btcParams.btcConsBtSlotsToBlockDuringDhcp = pConfig->btcConsBtSlotsToBlockDuringDhcp;
+
+   btcParams.btcA2DPBtSubIntervalsDuringDhcp = pConfig->btcA2DPBtSubIntervalsDuringDhcp;
 
    sme_BtcSetConfig(pHddCtx->hHal, &btcParams);
 }
@@ -2701,7 +2487,7 @@
       hddLog(LOGE, "Could not pass on WNI_CFG_RSSI_FILTER_PERIOD to CCM\n");
    }
 
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
    if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_FT_RSSI_FILTER_PERIOD, pConfig->FTRssiFilterPeriod,
          NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
    {
@@ -2943,61 +2729,6 @@
       hddLog(LOGE, "Could not pass on WNI_CFG_SHORT_GI_40MHZ to CCM\n");
    }
 
-
-     if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_ENABLE_MC_ADDR_LIST, pConfig->fEnableMCAddrList, 
-        NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
-     {
-        fStatus = FALSE;
-        hddLog(LOGE, "Could not pass on WNI_CFG_ENABLE_MC_ADDR_LIST to CCM\n");
-     }
-
-#ifdef WLAN_FEATURE_11AC
-   /* Based on cfg.ini, update the Basic MCS set, RX/TX MCS map in the cfg.dat */
-   /* valid values are 0(MCS0-7), 1(MCS0-8), 2(MCS0-9) */
-   /* we update only the least significant 2 bits in the corresponding fields */
-   if( (pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) ||
-       (pConfig->dot11Mode == eHDD_DOT11_MODE_11ac_ONLY) ||
-       (pConfig->dot11Mode == eHDD_DOT11_MODE_11ac) )
-   {
-       {
-           tANI_U32 temp = 0;
-
-           ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_VHT_BASIC_MCS_SET, &temp);
-           temp = (temp & 0xFFFC) | pConfig->vhtRxMCS; 
-
-           if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_VHT_BASIC_MCS_SET, 
-                           temp, NULL, eANI_BOOLEAN_FALSE)
-               ==eHAL_STATUS_FAILURE)
-           {
-               fStatus = FALSE;
-               hddLog(LOGE, "Could not pass on WNI_CFG_VHT_BASIC_MCS_SET to CCM\n");
-           }
-
-           ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_VHT_RX_MCS_MAP, &temp);
-           temp = (temp & 0xFFFC) | pConfig->vhtRxMCS; 
-
-           if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_VHT_RX_MCS_MAP, 
-                           temp, NULL, eANI_BOOLEAN_FALSE)
-               ==eHAL_STATUS_FAILURE)
-           {
-              fStatus = FALSE;
-              hddLog(LOGE, "Could not pass on WNI_CFG_VHT_RX_MCS_MAP to CCM\n");
-           }
-
-           ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_VHT_TX_MCS_MAP, &temp);
-           temp = (temp & 0xFFFC) | pConfig->vhtTxMCS; 
-
-           if(ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_VHT_TX_MCS_MAP, 
-                           temp, NULL, eANI_BOOLEAN_FALSE)
-               ==eHAL_STATUS_FAILURE)
-           {
-               fStatus = FALSE;
-               hddLog(LOGE, "Could not pass on WNI_CFG_VHT_TX_MCS_MAP to CCM\n");
-           }
-       }
-   }
-#endif
-
    return fStatus;
 }
 
@@ -3068,9 +2799,7 @@
 #endif
    //Remaining config params not obtained from registry
    // On RF EVB beacon using channel 1.
-#ifdef WLAN_FEATURE_11AC
-    smeConfig.csrConfig.nVhtChannelWidth = pConfig->vhtChannelWidth;
-#endif
+   
    smeConfig.csrConfig.AdHocChannel5G            = 44; 
    smeConfig.csrConfig.ProprietaryRatesEnabled   = 0;  
    smeConfig.csrConfig.HeartbeatThresh50         = 40; 
@@ -3082,9 +2811,7 @@
    smeConfig.csrConfig.nTxPowerCap = pConfig->nTxPowerCap;
    smeConfig.csrConfig.fEnableBypass11d          = pConfig->enableBypass11d;
    smeConfig.csrConfig.fEnableDFSChnlScan        = pConfig->enableDFSChnlScan;
-   smeConfig.csrConfig.fIgnore_chan165           = pConfig->ignore_chan165;
-   smeConfig.csrConfig.fFirstScanOnly2GChnl      = pConfig->enableFirstScan2GOnly;
-
+   
    //FIXME 11d config is hardcoded
 #ifdef WLAN_SOFTAP_FEATURE
    if ( VOS_STA_SAP_MODE != hdd_get_conparam()){
@@ -3113,15 +2840,11 @@
 #ifdef WLAN_FEATURE_VOWIFI_11R   
    smeConfig.csrConfig.csr11rConfig.IsFTResourceReqSupported = pConfig->fFTResourceReqSupported;
 #endif
-#ifdef FEATURE_WLAN_LFR
-   smeConfig.csrConfig.isFastRoamIniFeatureEnabled = pConfig->isFastRoamIniFeatureEnabled;
-#endif
 #ifdef FEATURE_WLAN_CCX
    smeConfig.csrConfig.isCcxIniFeatureEnabled = pConfig->isCcxIniFeatureEnabled;
 #endif
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
    smeConfig.csrConfig.isFastTransitionEnabled = pConfig->isFastTransitionEnabled;
-   smeConfig.csrConfig.RoamRssiDiff = pConfig->RoamRssiDiff;
 #endif
 
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
@@ -3143,7 +2866,6 @@
 
    //Enable/Disable MCC 
    smeConfig.csrConfig.fEnableMCCMode = pConfig->enableMCC;
-   smeConfig.csrConfig.fAllowMCCGODiffBI = pConfig->allowMCCGODiffBI;
 
    halStatus = sme_UpdateConfig( pHddCtx->hHal, &smeConfig);    
    if ( !HAL_STATUS_SUCCESS( halStatus ) )
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c
index 1506749..0d698ad 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -410,7 +410,6 @@
  */
 int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand)
 {
-    ENTER();
     switch(eBand)
     {
         case eCSR_BAND_24:
@@ -418,11 +417,7 @@
             wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
             break;
         case eCSR_BAND_5G:
-#ifdef WLAN_FEATURE_P2P
-            wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_p2p_2_4_GHZ;
-#else
             wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
-#endif
             wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ;
             break;
         case eCSR_BAND_ALL:
@@ -443,8 +438,6 @@
                                hdd_config_t *pCfg
                                )
 {
-    ENTER();
-
     /* Now bind the underlying wlan device with wiphy */
     set_wiphy_dev(wiphy, dev);
 
@@ -544,8 +537,6 @@
     /* Register for all P2P action, public action etc frames */
     v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4);
 
-    ENTER();
-
    /* Right now we are registering these frame when driver is getting
       initialized. Once we will move to 2.6.37 kernel, in which we have
       frame register ops, we will move this code as a part of that */
@@ -584,8 +575,6 @@
     /* Register for all P2P action, public action etc frames */
     v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4);
 
-    ENTER();
-
    /* Right now we are registering these frame when driver is getting
       initialized. Once we will move to 2.6.37 kernel, in which we have
       frame register ops, we will move this code as a part of that */
@@ -688,7 +677,6 @@
     beacon_data_t *old = NULL;
     int head_len,tail_len;
 
-    ENTER();
     if (params->head && !params->head_len)
         return -EINVAL;
 
@@ -778,7 +766,7 @@
         if(elem_len > left)
         {
             hddLog(VOS_TRACE_LEVEL_FATAL,
-                    FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
+                    "****Invalid IEs eid = %d elem_len=%d left=%d*****\n",
                                                     eid,elem_len,left);
             return NULL;
         }
@@ -895,7 +883,6 @@
     v_U8_t *pIe = NULL;
     v_U8_t addIE[1] = {0};
     beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon;
-    int ret = 0;
 
     genie = vos_mem_malloc(MAX_GENIE_LEN);
 
@@ -917,8 +904,7 @@
         else 
         {
             hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too big***\n");
-            ret = -EINVAL;
-            goto done;
+            return -EINVAL;
         }
         total_ielen = ielen;
     }
@@ -934,8 +920,7 @@
         }
         else {
            hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie + P2p Ie + Wfd Ie Length is too big***\n");
-           ret = -EINVAL;
-           goto done;
+           return -EINVAL;
         }
         total_ielen += ielen; 
     }
@@ -955,8 +940,7 @@
         {
             hddLog( VOS_TRACE_LEVEL_ERROR, 
                     "**Wps Ie+ P2pIE Length is too big***\n");
-            ret = -EINVAL;
-            goto done;
+            return -EINVAL;
         }
         total_ielen += ielen;
     }
@@ -968,8 +952,7 @@
     {
         hddLog(LOGE,
                "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM");
-        ret = -EINVAL;
-        goto done;
+        return -EINVAL;
     }
 
     if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
@@ -980,8 +963,7 @@
     {
         hddLog(LOGE,
             "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM");
-        ret = -EINVAL;
-        goto done;
+        return -EINVAL;
     }
 
     // Added for ProResp IE
@@ -1021,8 +1003,7 @@
             {
                  hddLog(LOGE,
                        "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM");
-                 ret = -EINVAL;
-                 goto done;
+                 return -EINVAL;
             }
             rem_probe_resp_ie_len += probe_rsp_ie_len[0];
         }
@@ -1037,8 +1018,7 @@
             {
                  hddLog(LOGE,
                        "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM");
-                 ret = -EINVAL;
-                 goto done;
+                 return -EINVAL;
             }
             rem_probe_resp_ie_len += probe_rsp_ie_len[1];
         }
@@ -1053,8 +1033,7 @@
             {
                  hddLog(LOGE,
                        "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM");
-                 ret = -EINVAL;
-                 goto done;
+                 return -EINVAL;
             }
             rem_probe_resp_ie_len += probe_rsp_ie_len[2];
         }
@@ -1089,8 +1068,7 @@
         {
            hddLog(LOGE,
              "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM");
-           ret = -EINVAL;
-           goto done;
+           return -EINVAL;
         }
     }
     else
@@ -1113,8 +1091,7 @@
        {
             hddLog(LOGE,
                   "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM");
-            ret = -EINVAL;
-            goto done;
+            return -EINVAL;
        }
 
        if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
@@ -1125,8 +1102,7 @@
        {
           hddLog(LOGE,
             "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM");
-          ret = -EINVAL;
-          goto done;
+          return -EINVAL;
        }
     }
     else
@@ -1144,7 +1120,6 @@
         }
     }
 
-done:
     vos_mem_free(genie);
     return 0;
 }
@@ -1244,38 +1219,32 @@
                                       pConfig->dtim_period);
 
 
-    if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP)
-    {
-        pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len,
+    pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, 
                                        WLAN_EID_COUNTRY);
-        if(pIe)
+    if(pIe)
+    { 
+        tANI_BOOLEAN restartNeeded;
+        tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
+
+        pConfig->ieee80211d = 1;
+        vos_mem_copy(pConfig->countryCode, &pIe[2], 3);
+        sme_setRegInfo(hHal, pConfig->countryCode);
+        sme_ResetCountryCodeInformation(hHal, &restartNeeded);
+        /*
+         * If auto channel is configured i.e. channel is 0,
+         * so skip channel validation.
+        */
+        if( AUTO_CHANNEL_SELECT != pConfig->channel )
         {
-            tANI_BOOLEAN restartNeeded;
-            tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
-            pConfig->ieee80211d = 1;
-            vos_mem_copy(pConfig->countryCode, &pIe[2], 3);
-            sme_setRegInfo(hHal, pConfig->countryCode);
-            sme_ResetCountryCodeInformation(hHal, &restartNeeded);
-            /*
-             * If auto channel is configured i.e. channel is 0,
-             * so skip channel validation.
-             */
-            if( AUTO_CHANNEL_SELECT != pConfig->channel )
+            if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel))
             {
-                if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel))
-                {
-                    hddLog(VOS_TRACE_LEVEL_ERROR,
-                            "%s: Invalid Channel [%d] \n", __func__, pConfig->channel);
-                    return -EINVAL;
-                }
+                hddLog(VOS_TRACE_LEVEL_ERROR,
+                         "%s: Invalid Channel [%d] \n", __func__, pConfig->channel);
+                return -EINVAL;
             }
         }
-        else
-        {
-            pConfig->ieee80211d = 0;
-        }
     }
-    else
+    else 
     {
         pConfig->ieee80211d = 0;
     }
@@ -1300,7 +1269,7 @@
         }
         else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0)
         {
-             hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2));
+             hddLog( VOS_TRACE_LEVEL_ERROR, "** WPS IE(len %d) ***\n", (pIe[1]+2));
              /* Check 15 bit of WPS IE as it contain information for wps state
               * WPS state
               */
@@ -1477,15 +1446,6 @@
     }
     wlan_hdd_set_sapHwmode(pHostapdAdapter);
 
-#ifdef WLAN_FEATURE_11AC
-    if(((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_AUTO) || 
-       ((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_11ac) ||
-       ((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_11ac_ONLY) )
-    {
-        pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac;
-    }
-#endif
-
     // ht_capab is not what the name conveys,this is used for protection bitmap
     pConfig->ht_capab =
                  (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection;
@@ -1535,7 +1495,7 @@
         return -EINVAL;
     }
 
-    hddLog(LOG1, 
+    hddLog(LOGE, 
            FL("Waiting for Scan to complete(auto mode) and BSS to start"));
 
     status = vos_wait_single_event(&pHostapdState->vosEvent, 10000);
@@ -1666,29 +1626,9 @@
 #endif
 {
     hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t  *pHddCtx    = NULL;
-    hdd_scaninfo_t *pScanInfo  = NULL;
-    hdd_adapter_t  *staAdapter = NULL;
+    hdd_context_t *pHddCtx;
     VOS_STATUS status = 0;
 
-    staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION);
-
-    if (!staAdapter)
-    {
-        staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT);
-    }
-    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s:LOGP in Progress. Ignore!!!", __func__);
-        return -EAGAIN;
-    }
-
-    if (staAdapter != NULL)
-    {
-        pScanInfo =  &staAdapter->scan_info;
-    }
-
     ENTER();
 
     if (NULL == pAdapter)
@@ -1708,23 +1648,6 @@
     hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
                               __func__,pAdapter->device_mode);
 
-    if ((pScanInfo != NULL) && pScanInfo->mScanPending)
-    {
-        INIT_COMPLETION(staAdapter->abortscan_event_var);
-        hdd_abort_mac_scan(staAdapter->pHddCtx);
-        status = wait_for_completion_interruptible_timeout(
-                           &staAdapter->abortscan_event_var,
-                           msecs_to_jiffies(WLAN_WAIT_TIME_ABORTSCAN));
-        if (!status)
-        {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
-                         "%s: Timeout occured while waiting for abortscan" ,
-                         __FUNCTION__);
-            VOS_ASSERT(pScanInfo->mScanPending);
-            return 0;
-        }
-    }
-
     if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
 #ifdef WLAN_FEATURE_P2P
      || (pAdapter->device_mode == WLAN_HDD_P2P_GO)
@@ -1808,11 +1731,6 @@
 
     hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%d\n", pAdapter->device_mode);
 
-    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
-        return -EAGAIN;
-    }
     if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) 
 #ifdef WLAN_FEATURE_P2P
       || (pAdapter->device_mode == WLAN_HDD_P2P_GO)
@@ -1855,11 +1773,6 @@
 
     hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
                                 __func__, pAdapter->device_mode);
-    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
-        return -EAGAIN;
-    }
 
     if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) 
 #ifdef WLAN_FEATURE_P2P
@@ -1997,14 +1910,8 @@
                 hddLog(VOS_TRACE_LEVEL_INFO,
                    "%s: setting interface Type to INFRASTRUCTURE", __func__);
                 pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
-#ifdef WLAN_FEATURE_11AC
-                if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO)
-                {
-                    pConfig->dot11Mode = eHDD_DOT11_MODE_11ac;
-                }
-#endif
-                pRoamProfile->phyMode = 
-                hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
+                pRoamProfile->phyMode =
+                   hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
                 wdev->iftype = type;
 #ifdef WLAN_FEATURE_P2P
                 pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ?
@@ -2040,41 +1947,6 @@
 #else
                 pAdapter->device_mode = WLAN_HDD_SOFTAP;
 #endif
-
-                //Disable BMPS and IMPS if enabled
-                //before starting Go
-                if(WLAN_HDD_P2P_GO == pAdapter->device_mode)
-                {
-                    if(VOS_STATUS_E_FAILURE == 
-                       hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO))
-                    {
-                       //Fail to Exit BMPS
-                       VOS_ASSERT(0);
-                    }
-                }
-
-                if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) &&
-                    (pConfig->apRandomBssidEnabled))
-                {
-                    /* To meet Android requirements create a randomized
-                       MAC address of the form 02:1A:11:Fx:xx:xx */
-                    get_random_bytes(&ndev->dev_addr[3], 3);
-                    ndev->dev_addr[0] = 0x02;
-                    ndev->dev_addr[1] = 0x1A;
-                    ndev->dev_addr[2] = 0x11;
-                    ndev->dev_addr[3] |= 0xF0;
-                    memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr,
-                           VOS_MAC_ADDR_SIZE);
-                    pr_info("wlan: Generated HotSpot BSSID "
-                            "%02x:%02x:%02x:%02x:%02x:%02x\n",
-                            ndev->dev_addr[0],
-                            ndev->dev_addr[1],
-                            ndev->dev_addr[2],
-                            ndev->dev_addr[3],
-                            ndev->dev_addr[4],
-                            ndev->dev_addr[5]);
-                }
-
                 hdd_set_ap_ops( pAdapter->dev );
 
                 status = hdd_init_ap_mode(pAdapter);
@@ -2121,8 +1993,6 @@
            case NL80211_IFTYPE_P2P_CLIENT:
 #endif
            case NL80211_IFTYPE_ADHOC:
-                hdd_stop_adapter( pHddCtx, pAdapter );
-                hdd_deinit_adapter( pHddCtx, pAdapter );
                 wdev->iftype = type;
 #ifdef WLAN_FEATURE_P2P
                 pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ?
@@ -2130,15 +2000,13 @@
 #endif
                 hdd_set_conparam(0);
                 pHddCtx->change_iface = type;
+                hdd_stop_adapter( pHddCtx, pAdapter );
+                hdd_deinit_adapter( pHddCtx, pAdapter );
                 memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx));
                 hdd_set_station_ops( pAdapter->dev );
                 status = hdd_init_station_mode( pAdapter );
                 if( VOS_STATUS_SUCCESS != status )
                     return -EOPNOTSUPP;
-                /* In case of JB, for P2P-GO, only change interface will be called,
-                 * This is the right place to enable back bmps_imps()
-                 */
-                hdd_enable_bmps_imps(pHddCtx);
                 goto done;
             case NL80211_IFTYPE_AP:
 #ifdef WLAN_FEATURE_P2P
@@ -2216,8 +2084,6 @@
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
     v_MACADDR_t STAMacAddress;
 
-    ENTER();
-
     if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -2244,7 +2110,6 @@
         }
     }
     
-    EXIT();
     return status;
 }
 
@@ -2848,7 +2713,6 @@
         }
     }
 #endif
-    EXIT();
     return status;
 }
 
@@ -2984,11 +2848,6 @@
     hddLog(VOS_TRACE_LEVEL_INFO, 
                 "%s: device_mode = %d  freq = %d \n",__func__, 
                             pAdapter->device_mode, chan->center_freq);
-    if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
-        return -EAGAIN;
-    }
 
     /* 
      * Do freq to chan conversion
@@ -3191,29 +3050,17 @@
     struct cfg80211_bss *bss_status = NULL;
     size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length;
     int rssi = 0;
-#ifdef WLAN_OPEN_SOURCE
     struct timespec ts;
-#endif
 
     ENTER();
 
-    if (!mgmt)
-        return NULL;
-
     memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN);
 
-#ifdef WLAN_OPEN_SOURCE
     /* Android does not want the timestamp from the frame.
        Instead it wants a monotonic increasing value */
     get_monotonic_boottime(&ts);
     mgmt->u.probe_resp.timestamp =
-         ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000);
-#else
-    /* keep old behavior for non-open source (for now) */
-    memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp,
-            sizeof (bss_desc->timeStamp));
-
-#endif
+       ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000);
 
     mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval;
     mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo;
@@ -3375,75 +3222,6 @@
     return 0; 
 }
 
-void
-hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel)
-{
-    VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, 
-           "%X:%X:%X:%X:%X:%X\n",
-           macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4],
-           macAddr[5]);
-} /****** end hddPrintMacAddr() ******/
-
-void
-hddPrintPmkId(tCsrBssid pmkId, tANI_U8 logLevel)
-{
-    VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, 
-           "%X:%X:%X:%X:%X:%X:%X:%X:%X:%X:%X:%X:%X:%X:%X:%X\n",
-           pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4],
-           pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9],
-           pmkId[10], pmkId[11], pmkId[12], pmkId[13], pmkId[14],
-           pmkId[15]);
-} /****** end hddPrintPmkId() ******/
-
-//hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel);
-//hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL);
-
-//void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size);
-//sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16);
-
-#define dump_bssid(bssid) \
-    { \
-        hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \
-        hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\
-        hddLog(VOS_TRACE_LEVEL_INFO, "\n"); \
-    }
-
-#define dump_pmkid(pMac, pmkid) \
-    { \
-        hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \
-        hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\
-        hddLog(VOS_TRACE_LEVEL_INFO, "\n"); \
-    }
-
-#ifdef FEATURE_WLAN_LFR
-/*
- * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify
- * This function is used to notify the supplicant of a new PMKSA candidate.
- */
-int wlan_hdd_cfg80211_pmksa_candidate_notify(
-                    hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, 
-                    int index, bool preauth )
-{
-#ifdef FEATURE_WLAN_OKC
-    struct net_device *dev = pAdapter->dev;
-
-    ENTER();
-    hddLog(VOS_TRACE_LEVEL_INFO, "%s is going to notify supplicant of:", __func__);
-
-    if( NULL == pRoamInfo )
-    {
-        hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL\n", __func__);
-        return -EINVAL;
-    }
-
-    dump_bssid(pRoamInfo->bssid);
-    cfg80211_pmksa_candidate_notify(dev, index,
-                                    pRoamInfo->bssid, preauth, GFP_KERNEL);
-#endif  /* FEATURE_WLAN_OKC */
-    return 0; 
-}
-#endif //FEATURE_WLAN_LFR
-
 /*
  * FUNCTION: hdd_cfg80211_scan_done_callback
  * scanning callback function, called after finishing scan
@@ -3473,13 +3251,13 @@
     if (!ret)
     {
        VOS_ASSERT(pScanInfo->mScanPending);
-       goto allow_suspend;
+       return 0;
     }
 
     if(pScanInfo->mScanPending != VOS_TRUE)
     {
         VOS_ASSERT(pScanInfo->mScanPending);
-        goto allow_suspend;
+        return 0;
     }
 
     /* Check the scanId */
@@ -3491,6 +3269,9 @@
                 (int) scanId);
     }
 
+    /* Scan is no longer pending */
+    pScanInfo->mScanPending = VOS_FALSE;
+
     ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, 
                                         pAdapter);
 
@@ -3530,8 +3311,7 @@
     if (!req)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL\n");
-        pScanInfo->mScanPending = VOS_FALSE;
-        goto allow_suspend;
+        return 0;
     }
 
     /*
@@ -3541,30 +3321,24 @@
     req->n_channels = 0;
     req->ie = 0;
 
-    complete(&pAdapter->abortscan_event_var);
-    pAdapter->request = NULL;
-    /* Scan is no longer pending */
-    pScanInfo->mScanPending = VOS_FALSE;
-
     /*
      * cfg80211_scan_done informing NL80211 about completion
      * of scanning
      */
     cfg80211_scan_done(req, false);
+    complete(&pAdapter->abortscan_event_var);
+    pAdapter->request = NULL;
+
 #ifdef WLAN_FEATURE_P2P
     /* Flush out scan result after p2p_serach is done */
-    if(pScanInfo->flushP2pScanResults)
+    if(pScanInfo->p2pSearch )
     {
         tANI_U8 sessionId = pAdapter->sessionId;
-        sme_ScanFlushP2PResult(WLAN_HDD_GET_HAL_CTX(pAdapter), sessionId);
-        pScanInfo->flushP2pScanResults = 0;
+        sme_ScanFlushResult(WLAN_HDD_GET_HAL_CTX(pAdapter), sessionId);
+        pScanInfo->p2pSearch = 0;
     }
 #endif
 
-allow_suspend:
-    /* release the wake lock at the end of the scan*/
-    hdd_allow_suspend();
-
     EXIT();
     return 0;
 }
@@ -3625,22 +3399,6 @@
         return -EAGAIN;
     }
 
-    if ((WLAN_HDD_GET_CTX(pAdapter))->isLoadUnloadInProgress)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
-                  "%s:Unloading/Loading in Progress. Ignore!!!", __func__);
-        return -EAGAIN;
-    }
-    //Don't Allow Scan and return busy if Remain On 
-    //Channel and action frame is pending
-    //Otherwise Cancel Remain On Channel and allow Scan
-    //If no action frame pending
-    if(0 != wlan_hdd_check_remain_on_channel(pAdapter))
-    {
-        hddLog(VOS_TRACE_LEVEL_INFO, "%s: Remain On Channel Pending", __func__);
-        return -EBUSY;
-    }
-
     if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock))
     {
         VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR,
@@ -3667,7 +3425,7 @@
          * Becasue of this, driver is assuming that this is not wildcard scan and so
          * is not aging out the scan results.
          */
-        if (request->ssids && '\0' == request->ssids->ssid[0])
+        if ('\0' == request->ssids->ssid[0])
         {
             request->n_ssids = 0;
         }
@@ -3778,38 +3536,21 @@
                                                        request->ie_len);
             if (pP2pIe != NULL)
             {
-                /* no_cck will be set during p2p find to disable 11b rates */
-                if(TRUE == request->no_cck)
+                if ( (request->n_ssids == 1) && 
+                     (request->ssids[0].ssid_len == P2P_WILDCARD_SSID_LEN) &&
+                     !memcmp(request->ssids[0].ssid, P2P_WILDCARD_SSID,
+                             P2P_WILDCARD_SSID_LEN ))
                 {
                     tANI_U8 sessionId = pAdapter->sessionId;
                     hddLog(VOS_TRACE_LEVEL_INFO,
                            "%s: This is a P2P Search", __func__);
                     scanRequest.p2pSearch = 1;
+                    pScanInfo->p2pSearch = 1;
 
-                    /* Flush the scan results only for P2P search.
-                       P2P search happens on 3 social channels (1, 6, 11) */
-                    if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS )
-                    {
-                         pScanInfo->flushP2pScanResults = 1;
-                         sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                    /* set requestType to P2P Discovery */
+                    scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY;
+                    sme_ScanFlushResult( WLAN_HDD_GET_HAL_CTX(pAdapter),
                                           sessionId );
-                         /* set requestType to P2P Discovery */
-                         scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY;
-                    }
-
-                    /*
-                       Skip Dfs Channel in case of P2P Search
-                       if it is set in ini file
-                    */
-                    if(cfg_param->skipDfsChnlInP2pSearch)
-                    {
-                       scanRequest.skipDfsChnlInP2pSearch = 1;
-                    }
-                    else
-                    {
-                       scanRequest.skipDfsChnlInP2pSearch = 0;
-                    }
-
                 }
             }
 #endif
@@ -3818,16 +3559,6 @@
 
     INIT_COMPLETION(pScanInfo->scan_req_completion_event);
 
-    /* acquire the wakelock to avoid the apps suspend during the scan. To 
-     * address the following issues.
-     * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in 
-     * BMPS/IMPS this result in android trying to suspend aggressively and backing off 
-     * for long time, this result in apps running at full power for long time.
-     * 2) Connected scenario: If we allow the suspend during the scan, RIVA will 
-     * be stuck in full power because of resume BMPS
-     */
-    hdd_prevent_suspend();
-
     status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
                               pAdapter->sessionId, &scanRequest, &scanId,
                               &hdd_cfg80211_scan_done_callback, dev );
@@ -3837,14 +3568,7 @@
         hddLog(VOS_TRACE_LEVEL_ERROR,
                 "%s: sme_ScanRequest returned error %d", __func__, status);
         complete(&pScanInfo->scan_req_completion_event);
-        if(eHAL_STATUS_RESOURCES == status)
-        {
-                hddLog(VOS_TRACE_LEVEL_INFO, "%s: HO is in progress.So defer the scan by informing busy",__func__);
-                status = -EBUSY;
-        } else {
-                status = -EIO;
-        }
-        hdd_allow_suspend();
+        status = -EIO;
         goto free_mem;
     }
 
@@ -3873,7 +3597,7 @@
  * This function is used to start the association process 
  */
 int wlan_hdd_cfg80211_connect_start( hdd_adapter_t  *pAdapter, 
-        const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel)
+        const u8 *ssid, size_t ssid_len, const u8 *bssid)
 {
     int status = 0;
     hdd_wext_state_t *pWextState;
@@ -3896,14 +3620,9 @@
 
     if (pRoamProfile) 
     {
-        int ret = 0;
-        hdd_station_ctx_t *pHddStaCtx;
-        pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-        hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType );
-
-        if((eMib_dot11DesiredBssType_independent == connectedBssType) ||
-           (eConnectionState_Associated == pHddStaCtx->conn_info.connState) ||
-           (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState))
+        if (hdd_connGetConnectedBssType(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
+            &connectedBssType ) || ( eMib_dot11DesiredBssType_independent == 
+              connectedBssType))
         {
             /* Issue disconnect to CSR */
             INIT_COMPLETION(pAdapter->disconnect_comp_var);
@@ -3912,23 +3631,9 @@
                             pAdapter->sessionId,
                             eCSR_DISCONNECT_REASON_UNSPECIFIED ) )
             {
-                ret = wait_for_completion_interruptible_timeout(
-                             &pAdapter->disconnect_comp_var,
-                             msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
-                if (0 == ret)
-                {
-                    VOS_ASSERT(0);
-                }
-            }
-        }
-        else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState)
-        {
-            ret = wait_for_completion_interruptible_timeout(
-                         &pAdapter->disconnect_comp_var,
-                         msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
-            if (0 == ret)
-            {
-                VOS_ASSERT(0);
+                wait_for_completion_interruptible_timeout(
+                        &pAdapter->disconnect_comp_var,
+                        msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
             }
         }
 
@@ -4024,16 +3729,10 @@
 #endif /* FEATURE_WLAN_WAPI */
         pRoamProfile->csrPersona = pAdapter->device_mode;
 
-        if( operatingChannel )
-        {
-           pRoamProfile->ChannelInfo.ChannelList = &operatingChannel;
-           pRoamProfile->ChannelInfo.numOfChannels = 1;
-        }
-
         status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), 
                             pAdapter->sessionId, pRoamProfile, &roamId);
 
-        pRoamProfile->ChannelInfo.ChannelList = NULL;
+        pRoamProfile->ChannelInfo.ChannelList = NULL; 
         pRoamProfile->ChannelInfo.numOfChannels = 0;
     }
     else
@@ -4623,18 +4322,8 @@
         }
     }
 
-    if ( req->channel )
-    {
-        status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid,
-                                                  req->ssid_len, req->bssid,
-                                                  req->channel->hw_value);
-    }
-    else
-    {
-        status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid,
-                                                  req->ssid_len, req->bssid,
-                                                  0);
-    }
+    status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, 
+                                                req->ssid_len, req->bssid);
 
     if (0 > status)
     {
@@ -4927,7 +4616,7 @@
 
     /* Issue connect start */
     status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, 
-            params->ssid_len, params->bssid, 0);
+            params->ssid_len, params->bssid);
 
     if (0 > status)
     {
@@ -5185,8 +4874,6 @@
     hdd_adapter_t *pAdapter;
     hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
 
-    ENTER();
-
     if (NULL == pHddCtx)
     {
         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
@@ -5211,7 +4898,6 @@
     wlan_hdd_get_classAstats(pAdapter);
     *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr;
 
-    EXIT();
     return 0;
 }
 
@@ -5241,8 +4927,6 @@
     tANI_U8  rateFlag = 1;
     tANI_U8  i, j, rssidx;
 
-    ENTER();
-
     if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) ||
             (0 == ssidlen))
     {
@@ -5262,7 +4946,7 @@
     wlan_hdd_get_rssi(pAdapter, &sinfo->signal);
     sinfo->filled |= STATION_INFO_SIGNAL;
 
-    wlan_hdd_get_station_stats(pAdapter);
+    wlan_hdd_get_classAstats(pAdapter);
     rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags;
 
     //convert to the UI units of 100kbps
@@ -5319,7 +5003,7 @@
         ccmCfgGetStr(hHal, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, &ORLeng);
         for (i = 0; i < ORLeng; i++)
         {
-            for (j = 0; j < (sizeof(supported_data_rate) / sizeof(supported_data_rate[0])); j ++)
+            for (j = 0; j < sizeof(supported_data_rate); j ++)
             {
                 /* Validate Rate Set */
                 if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F))
@@ -5336,7 +5020,7 @@
         ccmCfgGetStr(hHal, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedRates, &ERLeng);
         for (i = 0; i < ERLeng; i++)
         {
-            for (j = 0; j < (sizeof(supported_data_rate) / sizeof(supported_data_rate[0])); j ++)
+            for (j = 0; j < sizeof(supported_data_rate); j ++)
             {
                 if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F))
                 {
@@ -5366,7 +5050,7 @@
 
             for (i = 0; i < MCSLeng; i++)
             {
-                for (j = 0; j < (sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0])); j++)
+                for (j = 0; j < sizeof(supported_mcs_rate); j++)
                 {
                     if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i])
                     {
@@ -5458,31 +5142,7 @@
     }
     sinfo->filled |= STATION_INFO_TX_BITRATE;
 
-    sinfo->tx_packets =
-       pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] +
-       pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] +
-       pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] +
-       pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3];
-
-    sinfo->tx_retries =
-       pAdapter->hdd_stats.summary_stat.retry_cnt[0] +
-       pAdapter->hdd_stats.summary_stat.retry_cnt[1] +
-       pAdapter->hdd_stats.summary_stat.retry_cnt[2] +
-       pAdapter->hdd_stats.summary_stat.retry_cnt[3];
-
-    sinfo->tx_failed =
-       pAdapter->hdd_stats.summary_stat.fail_cnt[0] +
-       pAdapter->hdd_stats.summary_stat.fail_cnt[1] +
-       pAdapter->hdd_stats.summary_stat.fail_cnt[2] +
-       pAdapter->hdd_stats.summary_stat.fail_cnt[3];
-
-    sinfo->filled |=
-       STATION_INFO_TX_PACKETS |
-       STATION_INFO_TX_RETRIES |
-       STATION_INFO_TX_FAILED;
-
-       EXIT();
-       return 0;
+    return 0;
 }
 
 static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy,
@@ -5491,8 +5151,6 @@
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     VOS_STATUS vos_status;
 
-    ENTER();
-
     if (NULL == pAdapter)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL\n", __func__);
@@ -5511,7 +5169,6 @@
      **/
     vos_status =  wlan_hdd_enter_bmps(pAdapter, !mode);
 
-    EXIT();
     if (VOS_STATUS_E_FAILURE == vos_status)
     {
         return -EINVAL;
@@ -5525,7 +5182,6 @@
                          struct net_device *netdev,
                          u8 key_index)
 {
-    ENTER();
     return 0;
 }
 #endif //LINUX_VERSION_CODE 
@@ -5535,14 +5191,12 @@
                    struct net_device *dev,
                    struct ieee80211_txq_params *params)
 {
-    ENTER();
     return 0;
 }
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
 static int wlan_hdd_set_txq_params(struct wiphy *wiphy,
                    struct ieee80211_txq_params *params)
 {
-    ENTER();
     return 0;
 }
 #endif //LINUX_VERSION_CODE
@@ -5552,7 +5206,6 @@
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
 
-    ENTER();
     if ( NULL == pAdapter || NULL == pAdapter->pHddCtx)
     {
         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Invalid Adapter or HDD Context " ,__func__);
@@ -5618,14 +5271,13 @@
           struct net_device *dev, u8 *mac, struct station_parameters *params)
 {
     // TODO: Implement this later.
-    ENTER();
     return 0;
 }
 
 
 #ifdef FEATURE_WLAN_LFR
 static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev,
-            struct cfg80211_pmksa *pmksa)
+				struct cfg80211_pmksa *pmksa)
 {
 #define MAX_PMKSAIDS_IN_CACHE 8
     static tPmkidCacheInfo PMKIDCache[MAX_PMKSAIDS_IN_CACHE]; // HDD Local cache
@@ -5636,8 +5288,6 @@
     eHalStatus result; 
     tANI_U8  BSSIDMatched = 0;
    
-    ENTER();
-
     // Validate pAdapter  
     if ( NULL == pAdapter || NULL == pAdapter->pHddCtx)
     {
@@ -5682,9 +5332,6 @@
         }
     }
 
-    /* Check we compared all entries,if then take the first slot now */
-    if(j == MAX_PMKSAIDS_IN_CACHE) i=0;
-
     if (!BSSIDMatched)
     { 
         // Now, we DON'T have a BSSID match, so take a new entry in the cache.  
@@ -5717,16 +5364,14 @@
 
 
 static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
-            struct cfg80211_pmksa *pmksa)
+				struct cfg80211_pmksa *pmksa)
 {
-    ENTER();
     // TODO: Implement this later.
     return 0;
 }
 
 static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev)
 {
-    ENTER();
     // TODO: Implement this later.
     return 0;
 }
@@ -5776,12 +5421,7 @@
      .get_station = wlan_hdd_cfg80211_get_station,
      .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt,
      .del_station  = wlan_hdd_cfg80211_del_station,
-     .add_station  = wlan_hdd_cfg80211_add_station,
-#ifdef FEATURE_WLAN_LFR
-     .set_pmksa = wlan_hdd_cfg80211_set_pmksa,
-     .del_pmksa = wlan_hdd_cfg80211_del_pmksa,
-     .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa,
-#endif
+     .add_station  = wlan_hdd_cfg80211_add_station
 };
 
 #endif // CONFIG_CFG80211
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_dev_pwr.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_dev_pwr.c
index ab1b423..da53ff3d 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_dev_pwr.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_dev_pwr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_dp_utils.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_dp_utils.c
index f5b3117..c7ee744 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_dp_utils.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_dp_utils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_early_suspend.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_early_suspend.c
index 9262a83..76934dc 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_early_suspend.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_early_suspend.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -40,6 +40,7 @@
 #include <linux/pm.h>
 #include <linux/wait.h>
 #include <linux/earlysuspend.h>
+#include <linux/wcnss_wlan.h>
 #include <wlan_hdd_includes.h>
 #include <wlan_qct_driver.h>
 #include <linux/wakelock.h>
@@ -80,7 +81,6 @@
 #include "bap_hdd_misc.h"
 #endif
 
-#include <linux/wcnss_wlan.h>
 #include <linux/inetdevice.h>
 #include <wlan_hdd_cfg.h>
 /**-----------------------------------------------------------------------------
@@ -118,7 +118,7 @@
 #endif
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
-extern void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set, v_U8_t sessionId);
+extern void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set);
 #endif
 
 //Callback invoked by PMC to report status of standby request
@@ -675,22 +675,12 @@
 
            hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Enabled \n", __func__);
 
-           if(pHddCtx->dynamic_mcbc_filter.enableCfg)
+           if((HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST ==
+                   pHddCtx->cfg_ini->mcastBcastFilterSetting )
+                    || (HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST_BROADCAST ==
+                    pHddCtx->cfg_ini->mcastBcastFilterSetting))
            {
-               if((HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST == 
-              pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting) ||
-              (HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST_BROADCAST == 
-              pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting))
-               {
-                   offLoadRequest.enableOrDisable = 
-                           SIR_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE;
-               }
-           }
-           else if((HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST ==
-              pHddCtx->cfg_ini->mcastBcastFilterSetting ) || 
-              (HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST_BROADCAST ==
-              pHddCtx->cfg_ini->mcastBcastFilterSetting))
-           {
+               //MCAST filter is set by hdd_conf_mcastbcast_filter fn call
                offLoadRequest.enableOrDisable = 
                        SIR_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE;
            }
@@ -708,8 +698,7 @@
                   offLoadRequest.params.hostIpv4Addr[3]);
 
           if (eHAL_STATUS_SUCCESS != 
-                    sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), 
-                                       pAdapter->sessionId, &offLoadRequest))
+                    sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter) , &offLoadRequest))
           {
               hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed to enable HostOffload "
                       "feature\n", __func__);
@@ -729,8 +718,7 @@
        offLoadRequest.enableOrDisable = SIR_OFFLOAD_DISABLE;
        offLoadRequest.offloadType =  SIR_IPV4_ARP_REPLY_OFFLOAD;
 
-       if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, 
-                                                     &offLoadRequest))
+       if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), &offLoadRequest))
        {
             hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to disable host "
                              "offload feature\n", __func__);
@@ -776,13 +764,12 @@
        pHddCtx->hdd_mcastbcast_filter_set = TRUE;
 }
 
-#ifdef CONFIG_HAS_EARLYSUSPEND
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
 static void hdd_conf_suspend_ind(hdd_context_t* pHddCtx,
                                  hdd_adapter_t *pAdapter)
 {
     eHalStatus halStatus = eHAL_STATUS_FAILURE;
-    VOS_STATUS vstatus = VOS_STATUS_E_FAILURE;
+    VOS_STATUS vstatus;
     tpSirWlanSuspendParam wlanSuspendParam =
       vos_mem_malloc(sizeof(tSirWlanSuspendParam));
 
@@ -805,87 +792,25 @@
             vstatus = hdd_conf_hostarpoffload(pHddCtx, TRUE);
             if (!VOS_IS_STATUS_SUCCESS(vstatus))
             {
-                if(pHddCtx->dynamic_mcbc_filter.enableCfg)
-                {
-                  wlanSuspendParam->configuredMcstBcstFilterSetting = 
-                          pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting;
-                  pHddCtx->dynamic_mcbc_filter.enableSuspend = TRUE;
-                }
-                else
-                {
-                  wlanSuspendParam->configuredMcstBcstFilterSetting = 
-                             pHddCtx->cfg_ini->mcastBcastFilterSetting;
-                }
                 hddLog(VOS_TRACE_LEVEL_INFO,
                        "%s:Failed to enable ARPOFFLOAD Feature %d\n",
                        __func__, vstatus);
             }
-            else
-            {
-                if(pHddCtx->dynamic_mcbc_filter.enableCfg)
-                {
-                    if((HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST_BROADCAST == 
-                         pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting))
-                   {
-                       wlanSuspendParam->configuredMcstBcstFilterSetting = 
-                                     HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST;
-                   }
-                   else if((HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST == 
-                         pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting))
-                   {
-                       wlanSuspendParam->configuredMcstBcstFilterSetting = 
-                                             HDD_MCASTBCASTFILTER_FILTER_NONE;
-                   }
-                   else
-                   {
-                       wlanSuspendParam->configuredMcstBcstFilterSetting = 
-                          pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting;
-                   }
+        }
 
-                   pHddCtx->dynamic_mcbc_filter.enableSuspend = TRUE;
-                   pHddCtx->dynamic_mcbc_filter.mcBcFilterSuspend = 
-                        wlanSuspendParam->configuredMcstBcstFilterSetting;
-                }
-                else
-                {
-                    if (HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST_BROADCAST == 
-                        pHddCtx->cfg_ini->mcastBcastFilterSetting)
-                    {
-                        wlanSuspendParam->configuredMcstBcstFilterSetting = 
-                                     HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST;
-                    }
-                    else if(HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST == 
-                            pHddCtx->cfg_ini->mcastBcastFilterSetting)
-                    {
-                        wlanSuspendParam->configuredMcstBcstFilterSetting = 
-                                             HDD_MCASTBCASTFILTER_FILTER_NONE;
-                    }
-                    else
-                    {
-                        wlanSuspendParam->configuredMcstBcstFilterSetting = 
-                                 pHddCtx->cfg_ini->mcastBcastFilterSetting;
-                    }
-
-                    pHddCtx->dynamic_mcbc_filter.enableSuspend = FALSE;
-                }
-            }
+        if(pHddCtx->dynamic_mcbc_filter.enableCfg)
+        {
+            wlanSuspendParam->configuredMcstBcstFilterSetting = 
+                         pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting;
+            pHddCtx->dynamic_mcbc_filter.enableSuspend = TRUE;
+            pHddCtx->dynamic_mcbc_filter.mcBcFilterSuspend = 
+                         wlanSuspendParam->configuredMcstBcstFilterSetting;
         }
         else
         {
-            if(pHddCtx->dynamic_mcbc_filter.enableCfg)
-            {
-                wlanSuspendParam->configuredMcstBcstFilterSetting = 
-                      pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting;
-                pHddCtx->dynamic_mcbc_filter.enableSuspend = TRUE;
-                pHddCtx->dynamic_mcbc_filter.mcBcFilterSuspend = 
-                        wlanSuspendParam->configuredMcstBcstFilterSetting;
-            }
-            else
-            {
-                pHddCtx->dynamic_mcbc_filter.enableSuspend = FALSE;
-                wlanSuspendParam->configuredMcstBcstFilterSetting = 
-                             pHddCtx->cfg_ini->mcastBcastFilterSetting;
-            }
+            pHddCtx->dynamic_mcbc_filter.enableSuspend = FALSE;
+            wlanSuspendParam->configuredMcstBcstFilterSetting = 
+                                    pHddCtx->cfg_ini->mcastBcastFilterSetting;
         }
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
@@ -899,7 +824,7 @@
                     (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
            {
               /*set the filter*/
-              wlan_hdd_set_mc_addr_list(pHddCtx, TRUE, pAdapter->sessionId);
+              wlan_hdd_set_mc_addr_list(pHddCtx, TRUE);
            }
         }
 #endif
@@ -912,7 +837,7 @@
     }
 }
 
-static void hdd_conf_resume_ind(hdd_context_t* pHddCtx, v_U8_t sessionId)
+static void hdd_conf_resume_ind(hdd_context_t* pHddCtx)
 {
     VOS_STATUS vstatus;
     tpSirWlanResumeParam wlanResumeParam =
@@ -957,13 +882,14 @@
        {
           /*Filter applied during suspend mode*/
           /*Clear it here*/
-          wlan_hdd_set_mc_addr_list(pHddCtx, FALSE, sessionId);
+          wlan_hdd_set_mc_addr_list(pHddCtx, FALSE);
        }
     }
 #endif
 }
 #endif
 
+#ifdef CONFIG_HAS_EARLYSUSPEND
 //Suspend routine registered with Android OS
 void hdd_suspend_wlan(struct early_suspend *wlan_suspend)
 {
@@ -1057,13 +983,8 @@
        }
 #endif
 
-   //Apply Dynamic Dtim For P2P
-   //Only if ignoreDynamicDtimInP2pMode is not set in ini
    if((pHddCtx->cfg_ini->enableDynamicDTIM ||
-       pHddCtx->cfg_ini->enableModulatedDTIM) &&
-       ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
-        ((WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) &&
-         !(pHddCtx->cfg_ini->ignoreDynamicDtimInP2pMode))) &&
+       pHddCtx->cfg_ini->enableModulatedDTIM) && 
        (eANI_BOOLEAN_TRUE == pAdapter->higherDtimTransition) &&
       (eConnectionState_Associated == 
          (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) &&
@@ -1344,7 +1265,7 @@
 
          if(pHddCtx->hdd_mcastbcast_filter_set == TRUE) {
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
-           hdd_conf_resume_ind(pHddCtx, pAdapter->sessionId);
+           hdd_conf_resume_ind(pHddCtx);
 #else
                   hdd_conf_mcastbcast_filter(pHddCtx, FALSE);
                               pHddCtx->hdd_mcastbcast_filter_set = FALSE;
@@ -2164,9 +2085,6 @@
       goto err_vosclose;
    }
 
-   /* Exchange capability info between Host and FW and also get versioning info from FW */
-   hdd_exchange_version_and_caps(pHddCtx);
-
    vosStatus = hdd_post_voss_start_config( pHddCtx );
    if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
    {
@@ -2217,13 +2135,11 @@
       hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddRegisterPmOps failed",__func__);
       goto err_bap_stop;
    }
-#ifdef CONFIG_HAS_EARLYSUSPEND
    // Register suspend/resume callbacks
    if(pHddCtx->cfg_ini->nEnableSuspend)
    {
       register_wlan_suspend();
    }
-#endif
    /* Allow the phone to go to sleep */
    hdd_allow_suspend();
    /* register for riva power on lock */
@@ -2236,20 +2152,11 @@
    goto success;
 
 err_unregister_pmops:
-#ifdef CONFIG_HAS_EARLYSUSPEND
-   /* unregister suspend/resume callbacks */
-   if (pHddCtx->cfg_ini->nEnableSuspend)
-      unregister_wlan_suspend();
-#endif
    hddDeregisterPmOps(pHddCtx);
 
 err_bap_stop:
-#ifdef CONFIG_HAS_EARLYSUSPEND
-   hdd_unregister_mcast_bcast_filter(pHddCtx);
-#endif
-   hdd_close_all_adapters(pHddCtx);
 #ifdef WLAN_BTAMP_FEATURE
-   WLANBAP_Stop(pVosContext);
+  WLANBAP_Stop(pVosContext);
 #endif
 
 #ifdef WLAN_BTAMP_FEATURE
@@ -2265,11 +2172,17 @@
    vos_sched_close(pVosContext);
    if (pHddCtx)
    {
+#ifdef CONFIG_HAS_EARLYSUSPEND
+       /* unregister suspend/resume callbacks */
+       if (pHddCtx->cfg_ini->nEnableSuspend)
+           unregister_wlan_suspend();
+#endif
        /* Unregister the Net Device Notifier */
        unregister_netdevice_notifier(&hdd_netdev_notifier);
        /* Clean up HDD Nlink Service */
        send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0);
        nl_srv_exit();
+       hdd_close_all_adapters(pHddCtx);
        /* Free up dynamically allocated members inside HDD Adapter */
        kfree(pHddCtx->cfg_ini);
        pHddCtx->cfg_ini= NULL;
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_ftm.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_ftm.c
index d7e8f14..f3122db 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_ftm.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_ftm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -2607,9 +2607,6 @@
 
     ENTER();
 
-    //Delay to fix NV write failure on JB
-    vos_busy_wait(10000); //10ms
-
     if (!pRequestBuf) {
 
         hddLog(VOS_TRACE_LEVEL_ERROR,"%s: request buffer is null\n",__func__);
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_hostapd.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_hostapd.c
index 441e939..99e209d 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -203,7 +203,7 @@
        goto exit;
     }
 
-    if ((!ifr) || (!ifr->ifr_data))
+    if ((!ifr) && (!ifr->ifr_data))
     {
         ret = -EINVAL;
         goto exit;
@@ -574,7 +574,7 @@
             vos_status = hdd_softap_GetStaId(pHostapdAdapter, &pSapEvent->sapevt.sapStationDisassocCompleteEvent.staMac, &staId);
             if (!VOS_IS_STATUS_SUCCESS(vos_status))
             {
-                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, FL("ERROR: HDD Failed to find sta id!!"));
+                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD Failed to find sta id!!\n"));
                 return VOS_STATUS_E_FAILURE;
             }
             hdd_softap_DeregisterSTA(pHostapdAdapter, staId);
@@ -1057,43 +1057,6 @@
     return 0;
 }
 
-int
-static iw_softap_set_tx_power(struct net_device *dev,
-                        struct iw_request_info *info,
-                        union iwreq_data *wrqu, char *extra)
-{
-    hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
-    tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
-    int cmd_len = wrqu->data.length;
-    int *value = (int *) kmalloc(cmd_len+1, GFP_KERNEL);
-    int set_value;
-    tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
-    tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
-
-    if(value == NULL)
-        return -ENOMEM;
-
-    if(copy_from_user((char *) value, (char*)(wrqu->data.pointer), cmd_len)) {
-        hddLog(VOS_TRACE_LEVEL_FATAL, "%s -- copy_from_user --data pointer failed! bailing",
-                __FUNCTION__);
-        kfree(value);
-        return -EFAULT;
-    }
-
-    set_value = value[0];
-    kfree(value);
-
-    if( sme_SetMaxTxPower(hHal, bssid, selfMac, set_value) !=
-            eHAL_STATUS_SUCCESS )
-    {
-        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed",
-                __func__);
-        return -EIO;
-    }
-
-    return 0;
-}
-
 #define IS_BROADCAST_MAC(x) (((x[0] & x[1] & x[2] & x[3] & x[4] & x[5]) == 0xff) ? 1 : 0)
 
 int
@@ -2387,7 +2350,7 @@
 
    if (!VOS_IS_STATUS_SUCCESS(status ))
    {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, FL("ERROR: HDD Failed to find sta id!!"));
+      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD Failed to find sta id!!\n"));
       link_speed = 0;
    }
    else
@@ -2567,13 +2530,7 @@
         IW_PRIV_TYPE_BYTE | sizeof(tChannelListInfo),
         "getChannelList" },
 
-    /* handlers for main ioctl */
-    {   QCSAP_IOCTL_SET_TX_POWER,
-        IW_PRIV_TYPE_INT| IW_PRIV_SIZE_FIXED | 1,
-        0,
-        "" },
 };
-
 static const iw_handler hostapd_private[] = {
    [QCSAP_IOCTL_SETPARAM - SIOCIWFIRSTPRIV] = iw_softap_setparam,  //set priv ioctl
    [QCSAP_IOCTL_GETPARAM - SIOCIWFIRSTPRIV] = iw_softap_getparam,  //get priv ioctl   
@@ -2593,8 +2550,7 @@
    [QCSAP_IOCTL_SET_CHANNEL_RANGE - SIOCIWFIRSTPRIV] = iw_softap_set_channel_range,
    [QCSAP_IOCTL_MODIFY_ACL - SIOCIWFIRSTPRIV]   = iw_softap_modify_acl,
    [QCSAP_IOCTL_GET_CHANNEL_LIST - SIOCIWFIRSTPRIV]   = iw_softap_get_channel_list,
-   [QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED - SIOCIWFIRSTPRIV]     = iw_get_softap_linkspeed,
-   [QCSAP_IOCTL_SET_TX_POWER - SIOCIWFIRSTPRIV]   = iw_softap_set_tx_power,
+   [QCSAP_IOCTL_PRIV_GET_SOFTAP_LINK_SPEED - SIOCIWFIRSTPRIV]     = iw_get_softap_linkspeed
 };
 const struct iw_handler_def hostapd_handler_def = {
    .num_standard     = sizeof(hostapd_handler) / sizeof(hostapd_handler[0]),
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_main.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_main.c
index 6cd9623..16ba4ba 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_main.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_main.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -119,6 +119,9 @@
 #include "wlan_qct_pal_trace.h"
 #endif /* FEATURE_WLAN_INTEGRATED_SOC */
 #include "qwlan_version.h"
+#ifdef CONFIG_HTC_WIFI_NVS
+#include <mach/htc_wifi_nvs.h>
+#endif
 
 #ifdef MODULE
 #define WLAN_MODULE_NAME  module_name(THIS_MODULE)
@@ -141,29 +144,14 @@
 /* the Android framework expects this param even though we don't use it */
 #define BUF_LEN 20
 static char fwpath[BUF_LEN];
-#ifndef MODULE
-static int wlan_hdd_inited = 0;
-#endif
+module_param_string(fwpath, fwpath, BUF_LEN,
+                    S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
-/*
- * The rate at which the driver sends RESTART event to supplicant
- * once the function 'vos_wlanRestart()' is called
- *
- */
-#define WLAN_HDD_RESTART_RETRY_DELAY_MS 5000  /* 5 second */
-#define WLAN_HDD_RESTART_RETRY_MAX_CNT  5     /* 5 retries */
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
 static struct wake_lock wlan_wake_lock;
-#endif
 /* set when SSR is needed after unload */
 static v_U8_t      isSsrRequired;
 
 //internal function declaration
-static VOS_STATUS wlan_hdd_framework_restart(hdd_context_t *pHddCtx);
-static void wlan_hdd_restart_init(hdd_context_t *pHddCtx);
-static void wlan_hdd_restart_deinit(hdd_context_t *pHddCtx);
-void wlan_hdd_restart_timer_cb(v_PVOID_t usrDataForCallback);
-
 v_U16_t hdd_select_queue(struct net_device *dev,
     struct sk_buff *skb);
 
@@ -188,7 +176,7 @@
 
    //Make sure that this callback corresponds to our device.
    if((strncmp( dev->name, "wlan", 4 )) && 
-      (strncmp( dev->name, "p2p", 3))
+      (strncmp( dev->name, "p2p-wlan", 8))
      )
       return NOTIFY_DONE;
 
@@ -222,8 +210,11 @@
         break;
 
    case NETDEV_CHANGE:
-        if(TRUE == pAdapter->isLinkUpSvcNeeded)
-           complete(&pAdapter->linkup_event_var);
+        if(VOS_STA_MODE == hdd_get_conparam()) 
+        {
+            if(TRUE == pAdapter->isLinkUpSvcNeeded)
+               complete(&pAdapter->linkup_event_var);
+           }
         break;
 
    case NETDEV_GOING_DOWN:
@@ -291,17 +282,9 @@
 void hdd_unregister_mcast_bcast_filter(hdd_context_t *pHddCtx);
 void hdd_register_mcast_bcast_filter(hdd_context_t *pHddCtx);
 #endif
+#ifdef WLAN_SOFTAP_FEATURE
 //variable to hold the insmod parameters
 static int con_mode = 0;
-#ifndef MODULE
-/* current con_mode - used only for statically linked driver
- * con_mode is changed by userspace to indicate a mode change which will
- * result in calling the module exit and init functions. The module
- * exit function will clean up based on the value of con_mode prior to it
- * being changed by userspace. So curr_con_mode records the current con_mode 
- * for exit when con_mode becomes the next mode for init
- */
-static int curr_con_mode = 0;
 #endif
 
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
@@ -320,6 +303,7 @@
   --------------------------------------------------------------------------*/
 static void hdd_wdi_trace_enable(wpt_moduleid moduleId, v_U32_t bitmask)
 {
+#ifdef WLAN_DEBUG
    wpt_tracelevel level;
 
    /* if the bitmask is the default value, then a bitmask was not
@@ -332,7 +316,6 @@
 
    /* a mask was specified.  start by disabling all logging */
    wpalTraceSetLevel(moduleId, eWLAN_PAL_TRACE_LEVEL_NONE, 0);
-
    /* now cycle through the bitmask until all "set" bits are serviced */
    level = eWLAN_PAL_TRACE_LEVEL_FATAL;
    while (0 != bitmask)
@@ -344,6 +327,7 @@
       level++;
       bitmask >>= 1;
    }
+#endif
 }
 #endif /* FEATURE_WLAN_INTEGRATED_SOC */
 
@@ -362,7 +346,7 @@
       goto exit; 
    }
 
-   if ((!ifr) || (!ifr->ifr_data))
+   if ((!ifr) && (!ifr->ifr_data))
    {
        ret = -EINVAL;
        goto exit; 
@@ -394,7 +378,7 @@
        hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
 
        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
-                  "%s: Received %s cmd from Wi-Fi GUI***", __func__, command);
+                   "***Received %s cmd from Wi-Fi GUI***", command);
 
        if (strncmp(command, "P2P_DEV_ADDR", 12) == 0 )
        {
@@ -406,7 +390,7 @@
                ret = -EFAULT;
            }
        }
-       else if(strncmp(priv_data.buf, "SETBAND", 7) == 0)
+       if(strncmp(priv_data.buf, "SETBAND", 7) == 0)
        {
            tANI_U8 *ptr = (tANI_U8*)priv_data.buf ;
            int ret = 0 ;
@@ -415,31 +399,12 @@
    
            /* First 8 bytes will have "SETBAND " and 
             * 9 byte will have band setting value */
-           VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+           VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                     "%s: SetBandCommand Info  comm %s UL %d, TL %d", __FUNCTION__, priv_data.buf, priv_data.used_len, priv_data.total_len);
         
            /* Change band request received */
            ret = hdd_setBand_helper(dev, ptr);   
        } 
-       else if ( strncasecmp(command, "COUNTRY", 7) == 0 )
-       {
-           char *country_code;
-
-           country_code = command + 8;
-           ret = (int)sme_ChangeCountryCode(pHddCtx->hHal, NULL, country_code,
-                    pAdapter, pHddCtx->pvosContext);
-           if( 0 != ret )
-           {
-               VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                       "%s: SME Change Country code fail ret=%d\n",__func__, ret);
-
-           }
-       }
-       else {
-           hddLog( VOS_TRACE_LEVEL_WARN, "%s: Unsupported GUI command %s",
-                   __func__, command);
-       }
-
    }
 exit:
    if (command)
@@ -810,7 +775,7 @@
 {
    hdd_context_t *pHddCtx = (hdd_context_t*)callbackContext;
 
-   hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"HDD full Power callback status = %d", status);
+   hddLog(VOS_TRACE_LEVEL_ERROR,"HDD full Power callback status = %d", status);
    if(&pHddCtx->full_pwr_comp_var)
    {
       complete(&pHddCtx->full_pwr_comp_var);
@@ -2660,9 +2625,6 @@
 
    ENTER();
 
-   // Unloading, restart logic is no more required.
-   wlan_hdd_restart_deinit(pHddCtx);
-
 #ifdef CONFIG_CFG80211
 #ifdef WLAN_SOFTAP_FEATURE
    if (VOS_STA_SAP_MODE != hdd_get_conparam())
@@ -2905,11 +2867,7 @@
          "%s: Failed to close VOSS Scheduler",__func__);
       VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
    }
-
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-   /* Destroy the wake lock */
-   wake_lock_destroy(&pHddCtx->rx_wake_lock);
-#endif
+   
 
    //Close VOSS
    //This frees pMac(HAL) context. There should not be any call that requires pMac access after this.
@@ -2988,10 +2946,27 @@
   --------------------------------------------------------------------------*/
 static VOS_STATUS hdd_update_config_from_nv(hdd_context_t* pHddCtx)
 {
-#ifndef FEATURE_WLAN_INTEGRATED_SOC
-   eHalStatus halStatus;
-#endif
+#ifdef CONFIG_HTC_WIFI_NVS
+   int len;
+   char buf[30];
+   v_U8_t macAddr[VOS_MAC_ADDR_SIZE];
 
+   len = htc_get_wifi_calibration(buf, 30);
+   sscanf(buf, "macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
+          (unsigned *) &macAddr[0],
+          (unsigned *) &macAddr[1],
+          (unsigned *) &macAddr[2],
+          (unsigned *) &macAddr[3],
+          (unsigned *) &macAddr[4],
+          (unsigned *) &macAddr[5]);
+
+   // only sets the first persona
+   vos_mem_copy((v_U8_t *)&pHddCtx->cfg_ini->intfMacAddr[0].bytes[0],
+                macAddr,
+                VOS_MAC_ADDR_SIZE);
+
+   return VOS_STATUS_SUCCESS;
+#else
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
    v_BOOL_t itemIsValid = VOS_FALSE;
    VOS_STATUS status;
@@ -3050,10 +3025,8 @@
       hddLog(VOS_TRACE_LEVEL_ERROR, "NV ITEM, MAC Not valid");
       return VOS_STATUS_E_FAILURE;
    }
-#endif /* FEATURE_WLAN_INTEGRATED_SOC */
-
-#ifndef FEATURE_WLAN_INTEGRATED_SOC
-#if 1 /* need to fix for concurrency */
+#else
+   eHalStatus halStatus;
    // Set the MAC Address
    // Currently this is used by HAL to add self sta. Remove this once self sta is added as part of session open.
    halStatus = ccmCfgSetStr( pHddCtx->hHal, WNI_CFG_STA_ID,
@@ -3067,10 +3040,9 @@
           "HALStatus is %08d [x%08x]",__func__, halStatus, halStatus );
       return VOS_STATUS_E_FAILURE;
    }
-#endif
-#endif
-
+#endif /* FEATURE_WLAN_INTEGRATED_SOC */
    return VOS_STATUS_SUCCESS;
+#endif /* CONFIG_HTC_WIFI_NVS */
 }
 
 /**---------------------------------------------------------------------------
@@ -3152,145 +3124,12 @@
 /* wake lock APIs for HDD */
 void hdd_prevent_suspend(void)
 {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
     wake_lock(&wlan_wake_lock);
-#else
-    wcnss_prevent_suspend();
-#endif
 }
 
 void hdd_allow_suspend(void)
 {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
     wake_unlock(&wlan_wake_lock);
-#else
-    wcnss_allow_suspend();
-#endif
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief hdd_exchange_version_and_caps() - HDD function to exchange version and capability
-                                                                 information between Host and Riva
-
-  This function gets reported version of FW
-  It also finds the version of Riva headers used to compile the host
-  It compares the above two and prints a warning if they are different
-  It gets the SW and HW version string
-  Finally, it exchanges capabilities between host and Riva i.e. host and riva exchange a msg
-  indicating the features they support through a bitmap
-
-  \param  - pHddCtx - Pointer to HDD context
-
-  \return -  void
-
-  --------------------------------------------------------------------------*/
-
-void hdd_exchange_version_and_caps(hdd_context_t *pHddCtx)
-{
-
-   tSirVersionType versionCompiled;
-   tSirVersionType versionReported;
-   tSirVersionString versionString;
-   tANI_U8 fwFeatCapsMsgSupported = 0;
-   VOS_STATUS vstatus;
-
-   /* retrieve and display WCNSS version information */
-   do {
-
-      vstatus = sme_GetWcnssWlanCompiledVersion(pHddCtx->hHal,
-                                                &versionCompiled);
-      if (!VOS_IS_STATUS_SUCCESS(vstatus))
-      {
-         hddLog(VOS_TRACE_LEVEL_FATAL,
-                "%s: unable to retrieve WCNSS WLAN compiled version",
-                __FUNCTION__);
-         break;
-      }
-
-      vstatus = sme_GetWcnssWlanReportedVersion(pHddCtx->hHal,
-                                                &versionReported);
-      if (!VOS_IS_STATUS_SUCCESS(vstatus))
-      {
-         hddLog(VOS_TRACE_LEVEL_FATAL,
-                "%s: unable to retrieve WCNSS WLAN reported version",
-                __FUNCTION__);
-         break;
-      }
-
-      if ((versionCompiled.major != versionReported.major) ||
-          (versionCompiled.minor != versionReported.minor) ||
-          (versionCompiled.version != versionReported.version) ||
-          (versionCompiled.revision != versionReported.revision))
-      {
-         pr_err("%s: WCNSS WLAN Version %u.%u.%u.%u, "
-                "Host expected %u.%u.%u.%u\n",
-                WLAN_MODULE_NAME,
-                (int)versionReported.major,
-                (int)versionReported.minor,
-                (int)versionReported.version,
-                (int)versionReported.revision,
-                (int)versionCompiled.major,
-                (int)versionCompiled.minor,
-                (int)versionCompiled.version,
-                (int)versionCompiled.revision);
-      }
-      else
-      {
-         pr_info("%s: WCNSS WLAN version %u.%u.%u.%u\n",
-                 WLAN_MODULE_NAME,
-                 (int)versionReported.major,
-                 (int)versionReported.minor,
-                 (int)versionReported.version,
-                 (int)versionReported.revision);
-      }
-
-      vstatus = sme_GetWcnssSoftwareVersion(pHddCtx->hHal,
-                                            versionString,
-                                            sizeof(versionString));
-      if (!VOS_IS_STATUS_SUCCESS(vstatus))
-      {
-         hddLog(VOS_TRACE_LEVEL_FATAL,
-                "%s: unable to retrieve WCNSS software version string",
-                __FUNCTION__);
-         break;
-      }
-
-      pr_info("%s: WCNSS software version %s\n",
-              WLAN_MODULE_NAME, versionString);
-
-      vstatus = sme_GetWcnssHardwareVersion(pHddCtx->hHal,
-                                            versionString,
-                                            sizeof(versionString));
-      if (!VOS_IS_STATUS_SUCCESS(vstatus))
-      {
-         hddLog(VOS_TRACE_LEVEL_FATAL,
-                "%s: unable to retrieve WCNSS hardware version string",
-                __FUNCTION__);
-         break;
-      }
-
-      pr_info("%s: WCNSS hardware version %s\n",
-              WLAN_MODULE_NAME, versionString);
-
-      /* 1.Check if FW version is greater than 0.1.1.0. Only then send host-FW capability exchange message 
-         2.Host-FW capability exchange message  is only present on riva 1.1 so 
-            send the message only if it the riva is 1.1
-            minor numbers for different riva branches:
-                0 -> (1.0)Mainline Build
-                1 -> (1.1)Mainline Build
-                2->(1.04) Stability Build
-       */
-      if (((versionReported.major>0) || (versionReported.minor>1) || 
-         ((versionReported.minor>=1) && (versionReported.version>=1)))
-         && ((versionReported.major == 1) && (versionReported.minor >= 1)))
-         fwFeatCapsMsgSupported = 1;
- 
-      if (fwFeatCapsMsgSupported)
-         sme_featureCapsExchange(pHddCtx->hHal);
-
-   } while (0);
-
 }
 
 /**---------------------------------------------------------------------------
@@ -3524,17 +3363,6 @@
       goto err_vosclose;
    }
 
-#ifdef FEATURE_WLAN_INTEGRATED_SOC
-      /* Vos preStart is calling */
-      /* vos preStart which does cfg download should be called before set sme config which accesses/sets some cfgs */
-      status = vos_preStart( pHddCtx->pvosContext );
-      if ( !VOS_IS_STATUS_SUCCESS( status ) )
-      {
-         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_preStart failed",__func__);
-         goto err_vosclose;
-      }
-#endif
-
    // Set the SME configuration parameters...
    status = hdd_set_sme_config( pHddCtx );
 
@@ -3553,6 +3381,16 @@
    }
 
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* Vos preStart is calling */
+   status = vos_preStart( pHddCtx->pvosContext );
+   if ( !VOS_IS_STATUS_SUCCESS( status ) )
+   {
+      hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_preStart failed",__func__);
+      goto err_vosclose;
+   }
+#endif
+
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
    /* In the integrated architecture we update the configuration from
       the INI file and from NV before vOSS has been started so that
       the final contents are available to send down to the cCPU   */
@@ -3648,8 +3486,107 @@
       goto err_vosclose;
    }
 
-   /* Exchange capability info between Host and FW and also get versioning info from FW */
-   hdd_exchange_version_and_caps(pHddCtx);
+#ifdef FEATURE_WLAN_INTEGRATED_SOC
+   /* retrieve and display WCNSS version information */
+   do {
+      tSirVersionType versionCompiled;
+      tSirVersionType versionReported;
+      tSirVersionString versionString;
+      tANI_U8 fwFeatCapsMsgSupported = 0;
+      VOS_STATUS vstatus;
+
+      vstatus = sme_GetWcnssWlanCompiledVersion(pHddCtx->hHal,
+                                                &versionCompiled);
+      if (!VOS_IS_STATUS_SUCCESS(vstatus))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: unable to retrieve WCNSS WLAN compiled version",
+                __FUNCTION__);
+         break;
+      }
+
+      vstatus = sme_GetWcnssWlanReportedVersion(pHddCtx->hHal,
+                                                &versionReported);
+      if (!VOS_IS_STATUS_SUCCESS(vstatus))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: unable to retrieve WCNSS WLAN reported version",
+                __FUNCTION__);
+         break;
+      }
+
+      if ((versionCompiled.major != versionReported.major) ||
+          (versionCompiled.minor != versionReported.minor) ||
+          (versionCompiled.version != versionReported.version) ||
+          (versionCompiled.revision != versionReported.revision))
+      {
+         pr_err("%s: WCNSS WLAN Version %u.%u.%u.%u, "
+                "Host expected %u.%u.%u.%u\n",
+                WLAN_MODULE_NAME,
+                (int)versionReported.major,
+                (int)versionReported.minor,
+                (int)versionReported.version,
+                (int)versionReported.revision,
+                (int)versionCompiled.major,
+                (int)versionCompiled.minor,
+                (int)versionCompiled.version,
+                (int)versionCompiled.revision);
+      }
+      else
+      {
+         pr_info("%s: WCNSS WLAN version %u.%u.%u.%u\n",
+                 WLAN_MODULE_NAME,
+                 (int)versionReported.major,
+                 (int)versionReported.minor,
+                 (int)versionReported.version,
+                 (int)versionReported.revision);
+      }
+
+      vstatus = sme_GetWcnssSoftwareVersion(pHddCtx->hHal,
+                                            versionString,
+                                            sizeof(versionString));
+      if (!VOS_IS_STATUS_SUCCESS(vstatus))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: unable to retrieve WCNSS software version string",
+                __FUNCTION__);
+         break;
+      }
+
+      pr_info("%s: WCNSS software version %s\n",
+              WLAN_MODULE_NAME, versionString);
+
+      vstatus = sme_GetWcnssHardwareVersion(pHddCtx->hHal,
+                                            versionString,
+                                            sizeof(versionString));
+      if (!VOS_IS_STATUS_SUCCESS(vstatus))
+      {
+         hddLog(VOS_TRACE_LEVEL_FATAL,
+                "%s: unable to retrieve WCNSS hardware version string",
+                __FUNCTION__);
+         break;
+      }
+
+      pr_info("%s: WCNSS hardware version %s\n",
+              WLAN_MODULE_NAME, versionString);
+
+      /* 1.Check if FW version is greater than 0.1.1.0. Only then send host-FW capability exchange message 
+              2.Host-FW capability exchange message  is only present on riva 1.1 so 
+                send the message only if it the riva is 1.1
+                minor numbers for different riva branches:
+                0 -> (1.0)Mainline Build
+                1 -> (1.1)Mainline Build
+                2->(1.04) Stability Build
+         */
+      if (((versionReported.major>0) || (versionReported.minor>1) || 
+         ((versionReported.minor>=1) && (versionReported.version>=1)))
+         && ((versionReported.major == 1) && (versionReported.minor == 1)))
+         fwFeatCapsMsgSupported = 1;
+      if (fwFeatCapsMsgSupported)
+         sme_featureCapsExchange(pHddCtx->hHal);
+   } while (0);
+
+#endif // FEATURE_WLAN_INTEGRATED_SOC
 
    status = hdd_post_voss_start_config( pHddCtx );
    if ( !VOS_IS_STATUS_SUCCESS( status ) )
@@ -3853,21 +3790,11 @@
 
    pHddCtx->isLoadUnloadInProgress = FALSE;
 
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-   /* Initialize the wake lcok */
-   wake_lock_init(&pHddCtx->rx_wake_lock,
-           WAKE_LOCK_SUSPEND,
-           "qcom_rx_wakelock");
-#endif
-
    vos_event_init(&pAdapter->scan_info.scan_finished_event);
    pAdapter->scan_info.scan_pending_option = WEXT_SCAN_PENDING_GIVEUP;
 
    vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, FALSE);
    hdd_allow_suspend();
-   
-   // Initialize the restart logic
-   wlan_hdd_restart_init(pHddCtx);
   
    goto success;
 
@@ -3964,17 +3891,17 @@
 
 /**---------------------------------------------------------------------------
 
-  \brief hdd_driver_init() - Core Driver Init Function
+  \brief hdd_module_init() - Init Function
 
-   This is the driver entry point - called in different timeline depending
-   on whether the driver is statically or dynamically linked
+   This is the driver entry point (invoked when module is loaded using insmod)
 
   \param  - None
 
   \return - 0 for success, non zero for failure
 
   --------------------------------------------------------------------------*/
-static int hdd_driver_init( void)
+
+static int __init hdd_module_init ( void)
 {
    VOS_STATUS status;
    v_CONTEXT_t pVosContext = NULL;
@@ -3987,9 +3914,7 @@
 
    ENTER();
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
    wake_lock_init(&wlan_wake_lock, WAKE_LOCK_SUSPEND, "wlan");
-#endif
 
    pr_info("%s: loading driver v%s\n", WLAN_MODULE_NAME,
            QWLAN_VERSIONSTR TIMER_MANAGER_STR MEMORY_DEBUG_STR);
@@ -4119,11 +4044,12 @@
    }
 #endif // ANI_BUS_TYPE_SDIO
 
-#ifndef MODULE
-      /* For statically linked driver, call hdd_set_conparam to update curr_con_mode
-       */
-      hdd_set_conparam((v_UINT_t)con_mode);
-#endif
+#if defined(FEATURE_WLAN_INTEGRATED_SOC) && defined(ANI_MANF_DIAG)
+      if(5 == con_mode)
+      {
+         hdd_set_conparam(VOS_FTM_MODE);
+      }
+#endif /* FEATURE_WLAN_INTEGRATED_SOC && ANI_MANF_DIAG */
 
       // Call our main init function
       if(hdd_wlan_startup(dev)) {
@@ -4166,9 +4092,7 @@
       vos_mem_exit();
 #endif
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
       wake_lock_destroy(&wlan_wake_lock);
-#endif
       pr_err("%s: driver load failure\n", WLAN_MODULE_NAME);
    }
    else
@@ -4185,44 +4109,19 @@
    return ret_status;
 }
 
-/**---------------------------------------------------------------------------
-
-  \brief hdd_module_init() - Init Function
-
-   This is the driver entry point (invoked when module is loaded using insmod)
-
-  \param  - None
-
-  \return - 0 for success, non zero for failure
-
-  --------------------------------------------------------------------------*/
-#ifdef MODULE
-static int __init hdd_module_init ( void)
-{
-   return hdd_driver_init();
-}
-#else /* #ifdef MODULE */
-static int __init hdd_module_init ( void)
-{
-   /* Driver initialization is delayed to fwpath_changed_handler */
-   return 0;
-}
-#endif /* #ifdef MODULE */
-
 
 /**---------------------------------------------------------------------------
 
-  \brief hdd_driver_exit() - Exit function
+  \brief hdd_module_exit() - Exit function
 
-  This is the driver exit point (invoked when module is unloaded using rmmod
-  or con_mode was changed by userspace)
+  This is the driver exit point (invoked when module is unloaded using rmmod)
 
   \param  - None
 
   \return - None
 
   --------------------------------------------------------------------------*/
-static void hdd_driver_exit(void)
+static void __exit hdd_module_exit(void)
 {
    hdd_context_t *pHddCtx = NULL;
    v_CONTEXT_t pVosContext = NULL;
@@ -4274,99 +4173,11 @@
 #endif
 
 done:
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
    wake_lock_destroy(&wlan_wake_lock);
-#endif
    pr_info("%s: driver unloaded\n", WLAN_MODULE_NAME);
 }
 
-/**---------------------------------------------------------------------------
-
-  \brief hdd_module_exit() - Exit function
-
-  This is the driver exit point (invoked when module is unloaded using rmmod)
-
-  \param  - None
-
-  \return - None
-
-  --------------------------------------------------------------------------*/
-static void __exit hdd_module_exit(void)
-{
-   hdd_driver_exit();
-}
-
-#ifdef MODULE
-static int fwpath_changed_handler(const char *kmessage,
-                                 struct kernel_param *kp)
-{
-   /* nothing to do when driver is DLKM */
-   return 0;
-}
-
-static int con_mode_handler(const char *kmessage,
-                                 struct kernel_param *kp)
-{
-   return 0;
-}
-#else /* #ifdef MODULE */
-/**---------------------------------------------------------------------------
-
-  \brief fwpath_changed_handler() - Handler Function
-
-   This is the driver entry point 
-   - delayed driver initialization when driver is statically linked
-   - invoked when module parameter fwpath is modified from userpspace to signal 
-    initializing the WLAN driver
-
-  \return - 0 for success, non zero for failure
-
-  --------------------------------------------------------------------------*/
-static int fwpath_changed_handler(const char *kmessage,
-                                 struct kernel_param *kp)
-{
-   int ret_status;
-
-   if (!wlan_hdd_inited) {
-      ret_status = hdd_driver_init();
-      wlan_hdd_inited = ret_status ? 0 : 1;
-      return ret_status;
-   }
-
-   hdd_driver_exit();
-   
-   msleep(200);
-   
-   ret_status = hdd_driver_init();
-   wlan_hdd_inited = ret_status ? 0 : 1;
-   return ret_status;
-}
-
-/**---------------------------------------------------------------------------
-
-  \brief con_mode_handler() -
-
-  Handler function for module param con_mode when it is changed by userspace
-  Dynamically linked - do nothing
-  Statically linked - exit and init driver, as in rmmod and insmod
-
-  \param  - 
-
-  \return - 
-
-  --------------------------------------------------------------------------*/
-static int con_mode_handler(const char *kmessage,
-                                 struct kernel_param *kp)
-{
-   int ret = param_set_int(kmessage, kp);
-
-   if (ret)
-       return ret;
-
-   return fwpath_changed_handler(kmessage, kp);
-}
-#endif /* #ifdef MODULE */
-
+#if defined(WLAN_SOFTAP_FEATURE) || defined(ANI_MANF_DIAG)
 /**---------------------------------------------------------------------------
 
   \brief hdd_get_conparam() -
@@ -4380,18 +4191,12 @@
   --------------------------------------------------------------------------*/
 tVOS_CON_MODE hdd_get_conparam ( void )
 {
-#ifdef MODULE
     return (tVOS_CON_MODE)con_mode;
-#else
-    return (tVOS_CON_MODE)curr_con_mode;
-#endif
+
 }
 void hdd_set_conparam ( v_UINT_t newParam )
 {
   con_mode = newParam;
-#ifndef MODULE
-  curr_con_mode = con_mode;
-#endif
 }
 /**---------------------------------------------------------------------------
 
@@ -4486,6 +4291,7 @@
     WLANSAP_SetCounterMeasure(pVosContext, (v_BOOL_t)enable);
 }
 
+#endif /* WLAN_SOFTAP_FEATURE */
 /**---------------------------------------------------------------------------
  *
  *   \brief hdd_get__concurrency_mode() -
@@ -4595,189 +4401,6 @@
     __func__,pHddCtx->concurrency_mode,mode,pHddCtx->no_of_sessions[mode]);
 }
 
-/**---------------------------------------------------------------------------
- *
- *   \brief wlan_hdd_restart_init
- *
- *   This function initalizes restart timer/flag. An internal function.
- *
- *   \param  - pHddCtx
- *
- *   \return - None
- *             
- * --------------------------------------------------------------------------*/
-
-static void wlan_hdd_restart_init(hdd_context_t *pHddCtx)
-{
-   /* Initialize */
-   pHddCtx->hdd_restart_retries = 0;
-   atomic_set(&pHddCtx->isRestartInProgress, 0);
-   vos_timer_init(&pHddCtx->hdd_restart_timer, 
-                     VOS_TIMER_TYPE_SW, 
-                     wlan_hdd_restart_timer_cb,
-                     pHddCtx);
-}
-/**---------------------------------------------------------------------------
- *
- *   \brief wlan_hdd_restart_deinit
- *
- *   This function cleans up the resources used. An internal function.
- *
- *   \param  - pHddCtx
- *
- *   \return - None
- *             
- * --------------------------------------------------------------------------*/
-
-static void wlan_hdd_restart_deinit(hdd_context_t* pHddCtx)
-{
- 
-   VOS_STATUS vos_status;
-   /* Block any further calls */
-   atomic_set(&pHddCtx->isRestartInProgress, 1);
-   /* Cleanup */
-   vos_status = vos_timer_stop( &pHddCtx->hdd_restart_timer );
-   if (!VOS_IS_STATUS_SUCCESS(vos_status))
-          hddLog(LOGE, FL("Failed to stop HDD restart timer\n"));
-   vos_status = vos_timer_destroy(&pHddCtx->hdd_restart_timer);
-   if (!VOS_IS_STATUS_SUCCESS(vos_status))
-          hddLog(LOGE, FL("Failed to destroy HDD restart timer\n"));
-
-}
-
-/**---------------------------------------------------------------------------
- *
- *   \brief wlan_hdd_framework_restart
- *
- *   This function uses a cfg80211 API to start a framework initiated WLAN
- *   driver module unload/load.
- *
- *   Also this API keep retrying (WLAN_HDD_RESTART_RETRY_MAX_CNT).
- *
- *
- *   \param  - pHddCtx
- *
- *   \return - VOS_STATUS_SUCCESS: Success
- *             VOS_STATUS_E_EMPTY: Adapter is Empty
- *             VOS_STATUS_E_NOMEM: No memory
-
- * --------------------------------------------------------------------------*/
-
-static VOS_STATUS wlan_hdd_framework_restart(hdd_context_t *pHddCtx) 
-{
-   VOS_STATUS status = VOS_STATUS_SUCCESS;
-   hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
-   int len = (sizeof (struct ieee80211_mgmt));
-   struct ieee80211_mgmt *mgmt = NULL; 
-   
-   /* Prepare the DEAUTH managment frame with reason code */
-   mgmt =  kzalloc(len, GFP_KERNEL);
-   if(mgmt == NULL) 
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, 
-            "%s: memory allocatoin failed (%d bytes)", __func__, len);
-      return VOS_STATUS_E_NOMEM;
-   }
-   mgmt->u.deauth.reason_code = WLAN_REASON_DISASSOC_LOW_ACK;
-
-   /* Iterate over all adapters/devices */
-   status =  hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
-   do 
-   {
-      if( (status == VOS_STATUS_SUCCESS) && 
-                           pAdapterNode  && 
-                           pAdapterNode->pAdapter)
-      {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, 
-               "restarting the driver(intf:\'%s\' mode:%d :try %d)",
-               pAdapterNode->pAdapter->dev->name,
-               pAdapterNode->pAdapter->device_mode,
-               pHddCtx->hdd_restart_retries + 1);
-         /* 
-          * CFG80211 event to restart the driver
-          * 
-          * 'cfg80211_send_unprot_deauth' sends a 
-          * NL80211_CMD_UNPROT_DEAUTHENTICATE event to supplicant at any state 
-          * of SME(Linux Kernel) state machine.
-          *
-          * Reason code WLAN_REASON_DISASSOC_LOW_ACK is currently used to restart
-          * the driver.
-          *
-          */
-         
-         cfg80211_send_unprot_deauth(pAdapterNode->pAdapter->dev, (u_int8_t*)mgmt, len );  
-      }
-      status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
-      pAdapterNode = pNext;
-   } while((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status));
-
-
-   /* Free the allocated management frame */
-   kfree(mgmt);
-
-   /* Retry until we unload or reach max count */
-   if(++pHddCtx->hdd_restart_retries < WLAN_HDD_RESTART_RETRY_MAX_CNT) 
-      vos_timer_start(&pHddCtx->hdd_restart_timer, WLAN_HDD_RESTART_RETRY_DELAY_MS);
-
-   return status;
-
-}
-/**---------------------------------------------------------------------------
- *
- *   \brief wlan_hdd_restart_timer_cb
- *
- *   Restart timer callback. An internal function.
- *
- *   \param  - User data:
- *
- *   \return - None
- *             
- * --------------------------------------------------------------------------*/
-
-void wlan_hdd_restart_timer_cb(v_PVOID_t usrDataForCallback)
-{
-   hdd_context_t *pHddCtx = usrDataForCallback;
-   wlan_hdd_framework_restart(pHddCtx);
-   return;
-
-}
-
-
-/**---------------------------------------------------------------------------
- *
- *   \brief wlan_hdd_restart_driver
- *
- *   This function sends an event to supplicant to restart the WLAN driver. 
- *   
- *   This function is called from vos_wlanRestart.
- *
- *   \param  - pHddCtx
- *
- *   \return - VOS_STATUS_SUCCESS: Success
- *             VOS_STATUS_E_EMPTY: Adapter is Empty
- *             VOS_STATUS_E_ALREADY: Request already in progress
-
- * --------------------------------------------------------------------------*/
-VOS_STATUS wlan_hdd_restart_driver(hdd_context_t *pHddCtx) 
-{
-   VOS_STATUS status = VOS_STATUS_SUCCESS;
-
-   /* A tight check to make sure reentrancy */
-   if(atomic_xchg(&pHddCtx->isRestartInProgress, 1))
-   {
-      VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, 
-            "%s: WLAN restart is already in progress", __func__);
-
-      return VOS_STATUS_E_ALREADY;
-   }
-
-   /* Restart API */
-   status = wlan_hdd_framework_restart(pHddCtx);
-   
-   return status;
-}
-
-
 //Register the module init/exit functions
 module_init(hdd_module_init);
 module_exit(hdd_module_exit);
@@ -4786,8 +4409,6 @@
 MODULE_AUTHOR("Qualcomm Atheros, Inc.");
 MODULE_DESCRIPTION("WLAN HOST DEVICE DRIVER");
 
-module_param_call(con_mode, con_mode_handler, param_get_int, &con_mode,
-                    S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-
-module_param_call(fwpath, fwpath_changed_handler, param_get_string, fwpath,
-                    S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+#if defined(WLAN_SOFTAP_FEATURE) || defined(ANI_MANF_DIAG)
+module_param(con_mode, int, 0);
+#endif
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_mib.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_mib.c
index 94bcc82..f6dbab2 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_mib.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_mib.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_oemdata.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_oemdata.c
index 9643cba..6243662 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_oemdata.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_oemdata.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_p2p.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_p2p.c
index 4187531..3ed5a2f 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_p2p.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_p2p.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -118,18 +118,29 @@
     return eHAL_STATUS_SUCCESS;
 }
 
-static void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter)
+static int wlan_hdd_request_remain_on_channel( struct wiphy *wiphy,
+                                   struct net_device *dev,
+                                   struct ieee80211_channel *chan,
+                                   enum nl80211_channel_type channel_type,
+                                   unsigned int duration, u64 *cookie,
+                                   rem_on_channel_request_type_t request_type )
 {
+    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    hdd_remain_on_chan_ctx_t *pRemainChanCtx;
     hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
     int status = 0;
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
+                                 __func__,pAdapter->device_mode);
 
-    if(cfgState->remain_on_chan_ctx != NULL)
+    hddLog( LOG1,
+        "chan(hw_val)0x%x chan(centerfreq) %d chan type 0x%x, duration %d",
+        chan->hw_value, chan->center_freq, channel_type, duration );
+
+    if( cfgState->remain_on_chan_ctx != NULL)
     {
-        hddLog( LOG1, "Cancel Existing Remain on Channel");
-
-        /* Wait till remain on channel ready indication before issuing cancel 
-         * remain on channel request, otherwise if remain on channel not 
-         * received and if the driver issues cancel remain on channel then lim 
+        /* Wait till remain on channel ready indication before issuing cancel
+         * remain on channel request, otherwise if remain on channel not
+         * received and if the driver issues cancel remain on channel then lim
          * will be in unknown state.
          */
         status = wait_for_completion_interruptible_timeout(&pAdapter->rem_on_chan_ready_event,
@@ -142,7 +153,7 @@
         }
 
         INIT_COMPLETION(pAdapter->cancel_rem_on_chan_var);
-        
+
         /* Issue abort remain on chan request to sme.
          * The remain on channel callback will make sure the remain_on_chan
          * expired event is sent.
@@ -163,63 +174,9 @@
                                      (WLAN_HDD_GET_CTX(pAdapter))->pvosContext);
         }
 
-        status = wait_for_completion_interruptible_timeout(&pAdapter->cancel_rem_on_chan_var,
+        wait_for_completion_interruptible_timeout(&pAdapter->cancel_rem_on_chan_var,
                msecs_to_jiffies(WAIT_CANCEL_REM_CHAN));
-
-        if (!status)
-        {
-            hddLog( LOGE, 
-                    "%s: timeout waiting for cancel remain on channel ready indication",
-                    __func__);
-        }
     }
-}
-
-int wlan_hdd_check_remain_on_channel(hdd_adapter_t *pAdapter)
-{
-   int status = 0;
-   hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
-
-   if(WLAN_HDD_P2P_GO != pAdapter->device_mode)
-   {
-     //Cancel Existing Remain On Channel
-     //If no action frame is pending
-     if( cfgState->remain_on_chan_ctx != NULL)
-     {
-        //Check whether Action Frame is pending or not
-        if( cfgState->buf == NULL)
-        {
-           wlan_hdd_cancel_existing_remain_on_channel(pAdapter);
-        }
-        else
-        {
-           hddLog( LOG1, "Cannot Cancel Existing Remain on Channel");
-           status = -EBUSY;
-        }
-     }
-   }
-   return status;
-}
-
-static int wlan_hdd_request_remain_on_channel( struct wiphy *wiphy,
-                                   struct net_device *dev,
-                                   struct ieee80211_channel *chan,
-                                   enum nl80211_channel_type channel_type,
-                                   unsigned int duration, u64 *cookie,
-                                   rem_on_channel_request_type_t request_type )
-{
-    hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_remain_on_chan_ctx_t *pRemainChanCtx;
-    hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
-    hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
-                                 __func__,pAdapter->device_mode);
-
-    hddLog( LOG1,
-        "chan(hw_val)0x%x chan(centerfreq) %d chan type 0x%x, duration %d",
-        chan->hw_value, chan->center_freq, channel_type, duration );
-
-    //Cancel existing remain On Channel if any
-    wlan_hdd_cancel_existing_remain_on_channel(pAdapter);
 
     /* When P2P-GO and if we are trying to unload the driver then
      * wlan driver is keep on receiving the remain on channel command
@@ -232,12 +189,6 @@
         return -EBUSY;
     }
 
-    if (((hdd_context_t*)pAdapter->pHddCtx)->isLogpInProgress)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s:LOGP in Progress. Ignore!!!", __func__);
-        return -EAGAIN;
-    }
     pRemainChanCtx = vos_mem_malloc( sizeof(hdd_remain_on_chan_ctx_t) );
     if( NULL == pRemainChanCtx )
     {
@@ -267,7 +218,7 @@
          ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
        )
     {
-        tANI_U8 sessionId = pAdapter->sessionId;
+        tANI_U8 sessionId = pAdapter->sessionId; 
         //call sme API to start remain on channel.
         sme_RemainOnChannel(
                        WLAN_HDD_GET_HAL_CTX(pAdapter), sessionId,
@@ -365,12 +316,6 @@
 
     hddLog( LOG1, "Cancel remain on channel req");
 
-    if (((hdd_context_t*)pAdapter->pHddCtx)->isLogpInProgress)
-    {
-        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s:LOGP in Progress. Ignore!!!", __func__);
-        return -EAGAIN;
-    }
     /* FIXME cancel currently running remain on chan.
      * Need to check cookie and cancel accordingly
      */
@@ -462,11 +407,6 @@
     noack = dont_wait_for_ack;
 #endif
 
-    //If the wait is coming as 0 with off channel set
-    //then set the wait to 200 ms
-    if (offchan && !wait)
-        wait = ACTION_FRAME_DEFAULT_WAIT;
-
     hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
                             __func__,pAdapter->device_mode);
 
@@ -489,21 +429,23 @@
             else if ((subType == SIR_MAC_MGMT_DISASSOC) ||
                     (subType == SIR_MAC_MGMT_DEAUTH))
             {
-                /* During EAP failure or P2P Group Remove supplicant
-                 * is sending del_station command to driver. From
-                 * del_station function, Driver will send deauth frame to
-                 * p2p client. No need to send disassoc frame from here.
-                 * so Drop the frame here and send tx indication back to
-                 * supplicant.
+                /* Deauth/Disassoc received from supplicant, If we simply 
+                 * transmit the frame over air, driver doesn't come to know 
+                 * about the deauth/disassoc. Because of this reason the 
+                 * supplicant and driver will be out of sync.
+                 * Drop the frame here and initiate the disassoc procedure 
+                 * from driver, the core stack will take care of sending
+                 * disassoc frame and indicating corresponding events to supplicant.
                  */
                 tANI_U8 dstMac[ETH_ALEN] = {0};
                 memcpy(&dstMac, &buf[WLAN_HDD_80211_FRM_DA_OFFSET], ETH_ALEN);
-                hddLog(VOS_TRACE_LEVEL_INFO,
+                hddLog(VOS_TRACE_LEVEL_INFO, 
                         "%s: Deauth/Disassoc received for STA:"
-                        "%02x:%02x:%02x:%02x:%02x:%02x",
-                        __func__,
-                        dstMac[0], dstMac[1], dstMac[2],
+                        "%02x:%02x:%02x:%02x:%02x:%02x", 
+                        __func__, 
+                        dstMac[0], dstMac[1], dstMac[2], 
                         dstMac[3], dstMac[4], dstMac[5]);
+                hdd_softap_sta_disassoc(pAdapter, (v_U8_t *)&dstMac);
                 goto err_rem_channel;
             }
         }
@@ -613,8 +555,9 @@
          ( WLAN_HDD_P2P_DEVICE == pAdapter->device_mode )
        )
     {
-        tANI_U8 sessionId = pAdapter->sessionId;
-        if ((type == SIR_MAC_MGMT_FRAME) &&
+        tANI_U8 sessionId = pAdapter->sessionId;         
+        
+        if ((type == SIR_MAC_MGMT_FRAME) && 
                 (subType == SIR_MAC_MGMT_ACTION) &&
                 (buf[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET] == WLAN_HDD_PUBLIC_ACTION_FRAME))
         {
@@ -985,21 +928,11 @@
 
     if(hdd_get_adapter(pHddCtx, wlan_hdd_get_session_type(type)) != NULL)
     {
-       hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Interface type %d already exists. Two"
+	  hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Interface type %d already exists. Two"
                      "interfaces of same type are not supported currently.",__func__, type);
-       return NULL;
+	  return NULL;
     }
 
-    if (pHddCtx->isLogpInProgress)
-    {
-       VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s:LOGP in Progress. Ignore!!!", __func__);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
-       return NULL;
-#else
-       return -EAGAIN;
-#endif
-    }
     if ( pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated )
     {
         if( (NL80211_IFTYPE_P2P_GO == type) || 
@@ -1047,12 +980,6 @@
 
      hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
             __func__,pVirtAdapter->device_mode);
-     if (pHddCtx->isLogpInProgress)
-     {
-         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "%s:LOGP in Progress. Ignore!!!", __func__);
-         return -EAGAIN;
-     }
 
      wlan_hdd_release_intf_addr( pHddCtx,
                                  pVirtAdapter->macAddressCurrent.bytes );
@@ -1073,9 +1000,7 @@
     int needed_headroom = 0;
     int flag = HDD_RX_FLAG_IV_STRIPPED | HDD_RX_FLAG_DECRYPTED |
                HDD_RX_FLAG_MMIC_STRIPPED;
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-    hdd_context_t* pHddCtx = (hdd_context_t*)(pMonAdapter->pHddCtx);
-#endif
+
     hddLog( LOG1, FL("Indicate Frame over Monitor Intf"));
 
     VOS_ASSERT( (pbFrames != NULL) );
@@ -1118,9 +1043,6 @@
      skb->dev = pMonAdapter->dev;
      skb->protocol = eth_type_trans( skb, skb->dev );
      skb->ip_summed = CHECKSUM_UNNECESSARY;
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-     wake_lock_timeout(&pHddCtx->rx_wake_lock, HDD_WAKE_LOCK_DURATION);
-#endif
      rxstat = netif_rx_ni(skb);
      if( NET_RX_SUCCESS == rxstat )
      {
@@ -1281,9 +1203,6 @@
     struct ieee80211_radiotap_header *rthdr;
     unsigned char *pos;
     struct sk_buff *skb = cfgState->skb;
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-    hdd_context_t *pHddCtx = (hdd_context_t*)(pAdapter->pHddCtx);
-#endif
 
     /* 2 Byte for TX flags and 1 Byte for Retry count */
     u32 rtHdrLen = sizeof(*rthdr) + 3;
@@ -1343,9 +1262,6 @@
     skb->pkt_type  = PACKET_OTHERHOST;
     skb->protocol  = htons(ETH_P_802_2);
     memset( skb->cb, 0, sizeof( skb->cb ) );
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-    wake_lock_timeout(&pHddCtx->rx_wake_lock, HDD_WAKE_LOCK_DURATION);
-#endif
     if (in_interrupt())
         netif_rx( skb );
     else
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_scan.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_scan.c
index 220b2fa..ed13968 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_scan.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_scan.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -332,11 +332,7 @@
 
    if (ie_length > 0)
    {
-       /* dot11BeaconIEs is a large struct, so we make it static to
-          avoid stack overflow.  This API is only invoked via ioctl,
-          so it is serialized by the kernel rtnl_lock and hence does
-          not need to be reentrant */
-       static tDot11fBeaconIEs dot11BeaconIEs;
+       tDot11fBeaconIEs dot11BeaconIEs;
        tDot11fIESSID *pDot11SSID;
        tDot11fIESuppRates *pDot11SuppRates;
        tDot11fIEExtSuppRates *pDot11ExtSuppRates;
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_softap_tx_rx.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
index 579b414..4ba1d4a 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1220,9 +1220,6 @@
 
          skb->protocol = eth_type_trans(skb, skb->dev);
          skb->ip_summed = CHECKSUM_UNNECESSARY;
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-         wake_lock_timeout(&pHddCtx->rx_wake_lock, HDD_WAKE_LOCK_DURATION);
-#endif
          rxstat = netif_rx_ni(skb);
          if (NET_RX_SUCCESS == rxstat)
          {
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_tx_rx.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_tx_rx.c
index 09869fb..27e4984 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_tx_rx.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_tx_rx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -543,14 +543,7 @@
 #endif // HDD_WMM_DEBUG
 
    spin_lock(&pAdapter->wmm_tx_queue[ac].lock);
-   /*For every increment of 10 pkts in the queue, we inform TL about pending pkts.
-    * We check for +1 in the logic,to take care of Zero count which 
-    * occurs very frequently in low traffic cases */
-   if((pAdapter->wmm_tx_queue[ac].count + 1) % 10 == 0)
-   {
-           VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s:Queue is Filling up.Inform TL again about pending packets", __FUNCTION__);
-           WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, pHddStaCtx->conn_info.staId[0], ac );
-   }
+
    //If we have already reached the max queue size, disable the TX queue
    if ( pAdapter->wmm_tx_queue[ac].count == pAdapter->wmm_tx_queue[ac].max_size)
    {
@@ -656,9 +649,6 @@
    //disabled either because of disassociation or low resource scenarios. In
    //case of disassociation it is ok to ignore this. But if associated, we have
    //do possible recovery here
-
-   //testing underlying data path stall
-   sme_transportDebug(0, 1);
 } 
 
 
@@ -847,7 +837,7 @@
    pAdapter = hdd_get_adapter(pHddCtx,WLAN_HDD_INFRA_STATION);
    if(pAdapter == NULL)
    {
-      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: HDD adapter context is Null", __FUNCTION__);
+      VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: HDD adapter context is Null", __FUNCTION__);
    }
    else
    {
@@ -1340,9 +1330,6 @@
       ++pAdapter->hdd_stats.hddTxRxStats.rxPackets;
       ++pAdapter->stats.rx_packets;
       pAdapter->stats.rx_bytes += skb->len;
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
-      wake_lock_timeout(&pHddCtx->rx_wake_lock, HDD_WAKE_LOCK_DURATION);
-#endif
       rxstat = netif_rx_ni(skb);
       if (NET_RX_SUCCESS == rxstat)
       {
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c
index da36bd7..9fe4629 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wext.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -185,9 +185,6 @@
 #define WE_GET_CFG           3
 #define WE_GET_WMM_STATUS    4
 #define WE_GET_CHANNEL_LIST  5
-#ifdef WLAN_FEATURE_11AC
-#define WE_GET_RSSI          6
-#endif
 
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_SET_NONE_GET_NONE   (SIOCIWFIRSTPRIV + 6)
@@ -196,8 +193,6 @@
 #define WE_STOP_AP           3
 #define WE_ENABLE_AMP        4
 #define WE_DISABLE_AMP       5
-#define WE_ENABLE_DXE_STALL_DETECT 6
-#define WE_DISPLAY_DXE_SNAP_SHOT   7
 
 /* Private ioctls and their sub-ioctls */
 #define WLAN_PRIV_SET_VAR_INT_GET_NONE   (SIOCIWFIRSTPRIV + 7)
@@ -280,13 +275,6 @@
 #define WLAN_STATS_RX_RATE            14
 #define WLAN_STATS_TX_RATE            15
 
-#define WLAN_STATS_RX_UC_BYTE_CNT     16
-#define WLAN_STATS_RX_MC_BYTE_CNT     17
-#define WLAN_STATS_RX_BC_BYTE_CNT     18
-#define WLAN_STATS_TX_UC_BYTE_CNT     19
-#define WLAN_STATS_TX_MC_BYTE_CNT     20
-#define WLAN_STATS_TX_BC_BYTE_CNT     21
-
 #define FILL_TLV(__p, __type, __size, __val, __tlen) \
 {\
     if ((__tlen + __size + 2) < WE_MAX_STR_LEN) \
@@ -315,9 +303,8 @@
 #define WLAN_HDD_UI_SET_BAND_VALUE_OFFSET         8
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
-int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest, 
-                           v_U8_t sessionId);
-void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set, v_U8_t sessionId);
+int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest);
+void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set);
 #endif
 
 #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
@@ -822,7 +809,7 @@
         if(elem_len > left)
         {
             hddLog(VOS_TRACE_LEVEL_FATAL,
-                   FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
+                   "****Invalid IEs eid = %d elem_len=%d left=%d*****\n",
                     eid,elem_len,left);
             return NULL;
         }
@@ -1988,123 +1975,6 @@
    return VOS_STATUS_SUCCESS;
 }
 
-static void hdd_get_station_statisticsCB(void *pStats, void *pContext)
-{
-   struct statsContext *pStatsContext;
-   tCsrSummaryStatsInfo      *pSummaryStats;
-   tCsrGlobalClassAStatsInfo *pClassAStats;
-   hdd_adapter_t *pAdapter;
-
-   if (ioctl_debug)
-   {
-      pr_info("%s: pStats [%p] pContext [%p]\n",
-              __FUNCTION__, pStats, pContext);
-   }
-
-   if ((NULL == pStats) || (NULL == pContext))
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,
-             "%s: Bad param, pStats [%p] pContext [%p]",
-             __FUNCTION__, pStats, pContext);
-      return;
-   }
-
-   /* there is a race condition that exists between this callback function
-      and the caller since the caller could time out either before or
-      while this code is executing.  we'll assume the timeout hasn't
-      occurred, but we'll verify that right before we save our work */
-
-   pSummaryStats = (tCsrSummaryStatsInfo *)pStats;
-   pClassAStats  = (tCsrGlobalClassAStatsInfo *)( pSummaryStats + 1 );
-   pStatsContext = pContext;
-   pAdapter      = pStatsContext->pAdapter;
-   if ((NULL == pAdapter) || (STATS_CONTEXT_MAGIC != pStatsContext->magic))
-   {
-      /* the caller presumably timed out so there is nothing we can do */
-      hddLog(VOS_TRACE_LEVEL_WARN,
-             "%s: Invalid context, pAdapter [%p] magic [%08x]",
-             __FUNCTION__, pAdapter, pStatsContext->magic);
-      if (ioctl_debug)
-      {
-         pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n",
-                 __FUNCTION__, pAdapter, pStatsContext->magic);
-      }
-      return;
-   }
-
-   /* the race is on.  caller could have timed out immediately after
-      we verified the magic, but if so, caller will wait a short time
-      for us to copy over the stats. do so as a struct copy */
-   pAdapter->hdd_stats.summary_stat = *pSummaryStats;
-   pAdapter->hdd_stats.ClassA_stat = *pClassAStats;
-
-   /* and notify the caller */
-   complete(&pStatsContext->completion);
-}
-
-VOS_STATUS  wlan_hdd_get_station_stats(hdd_adapter_t *pAdapter)
-{
-   hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
-   eHalStatus hstatus;
-   long lrc;
-   struct statsContext context;
-
-   if (NULL == pAdapter)
-   {
-       hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Padapter is NULL", __func__);
-       return VOS_STATUS_SUCCESS;
-   }
-
-   /* we are connected
-   prepare our callback context */
-   init_completion(&context.completion);
-   context.pAdapter = pAdapter;
-   context.magic = STATS_CONTEXT_MAGIC;
-
-   /* query only for Summary & Class A statistics */
-   hstatus = sme_GetStatistics(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                               eCSR_HDD,
-                               SME_SUMMARY_STATS |
-                               SME_GLOBAL_CLASSA_STATS,
-                               hdd_get_station_statisticsCB,
-                               0, // not periodic
-                               FALSE, //non-cached results
-                               pHddStaCtx->conn_info.staId[0],
-                               &context);
-   if (eHAL_STATUS_SUCCESS != hstatus)
-   {
-      hddLog(VOS_TRACE_LEVEL_ERROR,
-             "%s: Unable to retrieve statistics",
-             __FUNCTION__);
-      /* we'll return with cached values */
-   }
-   else
-   {
-      /* request was sent -- wait for the response */
-      lrc = wait_for_completion_interruptible_timeout(&context.completion,
-                                    msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
-      /* either we have a response or we timed out
-         either way, first invalidate our magic */
-      context.magic = 0;
-      if (lrc <= 0)
-      {
-         hddLog(VOS_TRACE_LEVEL_ERROR,
-                "%s: SME %s while retrieving statistics",
-                __FUNCTION__, (0 == lrc) ? "timeout" : "interrupt");
-         /* there is a race condition such that the callback
-            function could be executing at the same time we are. of
-            primary concern is if the callback function had already
-            verified the "magic" but hasn't yet set the completion
-            variable.  Since the completion variable is on our
-            stack, we'll delay just a bit to make sure the data is
-            still valid if that is the case */
-         msleep(50);
-      }
-   }
-   return VOS_STATUS_SUCCESS;
-}
-
-
 /*
  * Support for the LINKSPEED private command
  * Per the WiFi framework the response must be of the form
@@ -2430,8 +2300,7 @@
        pr_info("%s: req [%s] len [%d]\n", __FUNCTION__, cmd, cmd_len);
     }
 
-    hddLog(VOS_TRACE_LEVEL_INFO_MED,
-           "%s: ***Received %s cmd from Wi-Fi GUI***", __func__, cmd);
+    hddLog(VOS_TRACE_LEVEL_INFO_MED, "***Received %s cmd from Wi-Fi GUI***", cmd);
 
     if (pHddCtx->isLogpInProgress) {
        if (ioctl_debug)
@@ -2599,14 +2468,6 @@
         /*TODO: rxfilter-remove*/
     }
 #ifdef FEATURE_WLAN_SCAN_PNO
-    else if( strncasecmp(cmd, "pnosetup", 8) == 0 ) {
-        hddLog( VOS_TRACE_LEVEL_INFO, "pnosetup");
-        /*TODO: support pnosetup*/
-    }
-    else if( strncasecmp(cmd, "pnoforce", 8) == 0 ) {
-        hddLog( VOS_TRACE_LEVEL_INFO, "pnoforce");
-        /*TODO: support pnoforce*/
-    }
     else if( strncasecmp(cmd, "pno",3) == 0 ) {
 
         hddLog( VOS_TRACE_LEVEL_INFO, "pno\n");
@@ -2659,8 +2520,7 @@
         }
     }
     else {
-        hddLog( VOS_TRACE_LEVEL_WARN, "%s: Unsupported GUI command %s",
-                __func__, cmd);
+        hddLog( VOS_TRACE_LEVEL_WARN, "Unsupported GUI command %s", cmd);
     }
 done:
     /* many of the commands write information back into the command
@@ -3739,7 +3599,9 @@
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
         case WE_GET_WDI_DBG:
         {
+#ifdef WLAN_DEBUG
            wpalTraceDisplay();
+#endif
            *value = 0;
            break;
         }
@@ -3786,7 +3648,9 @@
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
         case WE_SET_WDI_DBG:
         {
+#ifdef WLAN_DEBUG
             wpalTraceSetLevel( value[1], value[2], value[3]);
+#endif
             break;
         }
 #endif // FEATURE_WLAN_INTEGRATED_SOC
@@ -3929,17 +3793,7 @@
             wrqu->data.length = strlen(extra)+1;
             break;
         }
-#ifdef WLAN_FEATURE_11AC
-        case WE_GET_RSSI:
-        {
-            v_S7_t s7Rssi = 0;
-            wlan_hdd_get_rssi(pAdapter, &s7Rssi);
-            snprintf(extra, WE_MAX_STR_LEN, "rssi=%d",s7Rssi);
-            wrqu->data.length = strlen(extra)+1;
-            break;
-        }
-#endif
-           
+
         case WE_GET_WMM_STATUS:
         {
             snprintf(extra, WE_MAX_STR_LEN,
@@ -3965,7 +3819,6 @@
                     pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessAllowed?"YES":"NO",
                     pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcTspecInfo.ts_info.direction);
 
-
             wrqu->data.length = strlen(extra)+1;
             break;
         }
@@ -4106,17 +3959,6 @@
         }
 #endif
 
-        case WE_ENABLE_DXE_STALL_DETECT:
-        {
-            sme_transportDebug(VOS_FALSE, VOS_TRUE);
-            break;
-        }
-        case WE_DISPLAY_DXE_SNAP_SHOT:
-        {
-            sme_transportDebug(VOS_TRUE, VOS_FALSE);
-            break;
-        }
-
         default:
         {
             hddLog(LOGE, "%s: unknown ioctl %d", __FUNCTION__, sub_cmd);
@@ -4671,91 +4513,25 @@
 }
 #endif
 
-static int iw_set_dynamic_mcbc_filter(struct net_device *dev, 
-        struct iw_request_info *info,
+static int iw_set_dynamic_mcbc_filter(struct net_device *dev, struct iw_request_info *info,
         union iwreq_data *wrqu, char *extra)
-{   
+{
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     tpMcBcFilterCfg pRequest = (tpMcBcFilterCfg)wrqu->data.pointer;
     hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
-    tpSirWlanSetRxpFilters wlanRxpFilterParam;
-    VOS_STATUS vstatus = VOS_STATUS_E_FAILURE;
 
-    hddLog(VOS_TRACE_LEVEL_INFO_HIGH, 
-           "%s: Set MC BC Filter Config request: %d suspend %d",
-           __FUNCTION__, pRequest->mcastBcastFilterSetting,
-           pHddCtx->hdd_wlan_suspended);
+    hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
+           "%s: Set MC BC Filter Config request: %d",
+           __FUNCTION__, pRequest->mcastBcastFilterSetting);
 
-    wlanRxpFilterParam = vos_mem_malloc(sizeof(tSirWlanSetRxpFilters));
-    if(NULL == wlanRxpFilterParam)
-    {
-        hddLog(VOS_TRACE_LEVEL_FATAL,
-           "%s: vos_mem_alloc failed ", __func__);
-        return -EINVAL;
-    }
-
-    pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting = 
-                               pRequest->mcastBcastFilterSetting; 
-    pHddCtx->dynamic_mcbc_filter.enableCfg = TRUE; 
-
-    if(pHddCtx->hdd_wlan_suspended)
-    {
-      wlanRxpFilterParam->configuredMcstBcstFilterSetting = 
+    pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting =
                                pRequest->mcastBcastFilterSetting;
-      wlanRxpFilterParam->setMcstBcstFilter = TRUE;
-
-      if((pHddCtx->cfg_ini->fhostArpOffload) && 
-         (eConnectionState_Associated == 
-         (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
-      {
-        vstatus = hdd_conf_hostarpoffload(pHddCtx, TRUE);
-        if (!VOS_IS_STATUS_SUCCESS(vstatus))
-        {
-          hddLog(VOS_TRACE_LEVEL_INFO, 
-                 "%s:Failed to enable ARPOFFLOAD Feature %d\n",
-                 __func__, vstatus);
-        }
-        else
-        {
-          if (HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST_BROADCAST == 
-              pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting)
-          {
-            wlanRxpFilterParam->configuredMcstBcstFilterSetting = 
-                       HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST;
-          }
-          else if(HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST == 
-                  pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting)
-          {
-            wlanRxpFilterParam->configuredMcstBcstFilterSetting = 
-                           HDD_MCASTBCASTFILTER_FILTER_NONE;
-          }
-        }
-      }
-
-      hddLog(VOS_TRACE_LEVEL_INFO, "%s:MC/BC changed Req %d Set %d En %d",
-             __func__,
-             pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting,
-             wlanRxpFilterParam->configuredMcstBcstFilterSetting,
-             wlanRxpFilterParam->setMcstBcstFilter);
-
-      if (eHAL_STATUS_SUCCESS != sme_ConfigureRxpFilter(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                                   wlanRxpFilterParam))
-      {
-        hddLog(VOS_TRACE_LEVEL_ERROR, 
-               "%s: Failure to execute set HW MC/BC Filter request\n",
-               __func__);
-        return -EINVAL;
-      }
-
-      pHddCtx->dynamic_mcbc_filter.mcBcFilterSuspend = 
-                         wlanRxpFilterParam->configuredMcstBcstFilterSetting;
-    }
+    pHddCtx->dynamic_mcbc_filter.enableCfg = TRUE;
 
     return 0;
 }
 
-static int iw_clear_dynamic_mcbc_filter(struct net_device *dev, 
-        struct iw_request_info *info,
+static int iw_clear_dynamic_mcbc_filter(struct net_device *dev, struct iw_request_info *info,
         union iwreq_data *wrqu, char *extra)
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
@@ -4822,8 +4598,7 @@
        exactly the same.  Otherwise, each piece of information would have to be
        copied individually. */
     memcpy(&offloadRequest, pRequest, wrqu->data.length);
-    if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                        pAdapter->sessionId, &offloadRequest))
+    if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), &offloadRequest))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute host offload request\n",
                __func__);
@@ -4886,8 +4661,7 @@
 
        hddLog(VOS_TRACE_LEVEL_ERROR, "set Keep: TP before SME %d\n", keepaliveRequest.timePeriod);
 
-    if (eHAL_STATUS_SUCCESS != sme_SetKeepAlive(WLAN_HDD_GET_HAL_CTX(pAdapter), 
-                                        pAdapter->sessionId, &keepaliveRequest))
+    if (eHAL_STATUS_SUCCESS != sme_SetKeepAlive(WLAN_HDD_GET_HAL_CTX(pAdapter), &keepaliveRequest))
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Keep Alive\n",
                __func__);
@@ -4898,8 +4672,7 @@
 }
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
-int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest, 
-                            tANI_U8 sessionId)
+int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest)
 {
     tSirRcvPktFilterCfgType    packetFilterSetReq;
     tSirRcvFltPktClearParam    packetFilterClrReq;
@@ -4963,7 +4736,7 @@
                         pRequest->paramsData[i].dataMask[4], pRequest->paramsData[i].dataMask[5]);
             }
 
-            if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal, &packetFilterSetReq, sessionId))
+            if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx, &packetFilterSetReq))
             {
                 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Set Filter\n",
                         __func__);
@@ -4977,7 +4750,7 @@
             hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Clear Packet Filter Request for Id: %d\n",
                     __FUNCTION__, pRequest->filterId);
             packetFilterClrReq.filterId = pRequest->filterId;
-            if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter(pHddCtx->hHal, &packetFilterClrReq, sessionId))
+            if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter(pHddCtx, &packetFilterClrReq))
             {
                 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Clear Filter\n",
                         __func__);
@@ -4993,7 +4766,7 @@
     return 0;
 }
 
-void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set, v_U8_t sessionId)
+void wlan_hdd_set_mc_addr_list(hdd_context_t *pHddCtx, v_U8_t set)
 {
     v_U8_t filterAction = 0; 
     tPacketFilterCfg request = {0}; 
@@ -5028,7 +4801,7 @@
                     request.paramsData[0].compareData[4], 
                     request.paramsData[0].compareData[5]);
         }
-        wlan_hdd_set_filter(pHddCtx, &request, sessionId);
+        wlan_hdd_set_filter(pHddCtx, &request);
     }
     pHddCtx->mc_addr_list.isFilterApplied = set ? TRUE : FALSE;
 }
@@ -5038,7 +4811,7 @@
 {   
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     tpPacketFilterCfg pRequest = (tpPacketFilterCfg)wrqu->data.pointer;
-    return wlan_hdd_set_filter(WLAN_HDD_GET_CTX(pAdapter), pRequest, pAdapter->sessionId);
+    return wlan_hdd_set_filter(WLAN_HDD_GET_CTX(pAdapter), pRequest);
 }
 #endif
 static int iw_get_statistics(struct net_device *dev,
@@ -5164,9 +4937,9 @@
               (char*) &(pStats->rx_error_cnt),
               tlen);
 
-    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BYTE_CNT, 
-              (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]),
-              (char*) &(dStats->tx_uc_byte_cnt[0]), 
+    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BYTE_CNT,
+              (tANI_U8) sizeof (pStats->tx_byte_cnt),
+              (char*) &(pStats->tx_byte_cnt),
               tlen);
 
     FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BYTE_CNT,
@@ -5185,31 +4958,6 @@
               (char*) &(aStats->tx_rate),
               tlen);
 
-    FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_UC_BYTE_CNT, 
-              (tANI_U8) sizeof (dStats->rx_uc_byte_cnt[0]), 
-              (char*) &(dStats->rx_uc_byte_cnt[0]), 
-              tlen);
-    FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_MC_BYTE_CNT, 
-              (tANI_U8) sizeof (dStats->rx_mc_byte_cnt), 
-              (char*) &(dStats->rx_mc_byte_cnt), 
-              tlen);
-    FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BC_BYTE_CNT, 
-              (tANI_U8) sizeof (dStats->rx_bc_byte_cnt), 
-              (char*) &(dStats->rx_bc_byte_cnt), 
-              tlen);
-    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_UC_BYTE_CNT, 
-              (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]), 
-              (char*) &(dStats->tx_uc_byte_cnt[0]), 
-              tlen);
-    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_MC_BYTE_CNT, 
-              (tANI_U8) sizeof (dStats->tx_mc_byte_cnt), 
-              (char*) &(dStats->tx_mc_byte_cnt), 
-              tlen);
-    FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BC_BYTE_CNT, 
-              (tANI_U8) sizeof (dStats->tx_bc_byte_cnt), 
-              (char*) &(dStats->tx_bc_byte_cnt), 
-              tlen);
-
     wrqu->data.length = tlen;
 
   }
@@ -5257,11 +5005,7 @@
                       union iwreq_data *wrqu, char *extra, int nOffset)
 {
   hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
-  /* pnoRequest is a large struct, so we make it static to avoid stack
-     overflow.  This API is only invoked via ioctl, so it is
-     serialized by the kernel rtnl_lock and hence does not need to be
-     reentrant */
-  static tSirPNOScanReq pnoRequest;
+  tSirPNOScanReq pnoRequest;
   char *ptr;
   v_U8_t i,j, ucParams, ucMode;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
@@ -5780,16 +5524,7 @@
     }
 
     uTotalSize -= nOffset;
-    VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, 
-              "Power request parameter %d Total size", 
-              uTotalSize);
     ptr += nOffset;
-    /* This is added for dynamic Tele LI enable (0xF1) /disable (0xF0)*/
-    if(!(uTotalSize - nOffset) && 
-       (powerRequest.uListenInterval != SIR_NOCHANGE_POWER_VALUE))
-    {
-        uTotalSize = 0;
-    }
 
   }/*Go for as long as we have a valid string*/
 
@@ -6103,12 +5838,6 @@
         0,
         IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
         "getConfig" },
-#ifdef WLAN_FEATURE_11AC
-    {   WE_GET_RSSI,
-        0,
-        IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
-        "getRSSI" },
-#endif
     {   WE_GET_WMM_STATUS,
         0,
         IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
@@ -6146,14 +5875,6 @@
         0,
         0,
         "disableAMP" },
-    {   WE_ENABLE_DXE_STALL_DETECT,
-        0,
-        0,
-        "dxeStallDetect" },
-    {   WE_DISPLAY_DXE_SNAP_SHOT,
-        0,
-        0,
-        "dxeSnapshot" },
 
     /* handlers for main ioctl */
     {   WLAN_PRIV_SET_VAR_INT_GET_NONE,
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wmm.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wmm.c
index faaf4c0..c8da218 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wmm.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wmm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1889,7 +1889,7 @@
 
    pAdapter->hddWmmStatus.wmmAcStatus[acType].wmmAcAccessNeeded = VOS_TRUE;
 
-   pQosContext = kmalloc(sizeof(*pQosContext), GFP_ATOMIC);
+   pQosContext = kmalloc(sizeof(*pQosContext), GFP_KERNEL);
    if (NULL == pQosContext)
    {
       // no memory for QoS context.  Nothing we can do but let data flow
diff --git a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wowl.c b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wowl.c
index f581d99..fa41a23 100644
--- a/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wowl.c
+++ b/drivers/staging/prima/CORE/HDD/src/wlan_hdd_wowl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/inc/aniCompiler.h b/drivers/staging/prima/CORE/MAC/inc/aniCompiler.h
index a1c4288..91b6b1e90 100644
--- a/drivers/staging/prima/CORE/MAC/inc/aniCompiler.h
+++ b/drivers/staging/prima/CORE/MAC/inc/aniCompiler.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/inc/aniDbgTest.h b/drivers/staging/prima/CORE/MAC/inc/aniDbgTest.h
index 2949acd..e80b1b9 100644
--- a/drivers/staging/prima/CORE/MAC/inc/aniDbgTest.h
+++ b/drivers/staging/prima/CORE/MAC/inc/aniDbgTest.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/inc/aniGlobal.h b/drivers/staging/prima/CORE/MAC/inc/aniGlobal.h
index 85a2c73..656c90a 100644
--- a/drivers/staging/prima/CORE/MAC/inc/aniGlobal.h
+++ b/drivers/staging/prima/CORE/MAC/inc/aniGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -548,9 +548,9 @@
     tANI_U8    fScanDisabled;
     //Can be set to invalid channel. If it is invalid, HAL
     //should move to previous valid channel or stay in the
-    //current channel. CB state goes along with channel to resume to
-    tANI_U16    gResumeChannel;
-    ePhyChanBondState    gResumePhyCbState;
+    //current channel.
+    tANI_U16   gResumeChannel;
+    //TODO - Add CB state here.
 #endif // GEN4_SCAN
 
     // Change channel generic scheme
@@ -583,7 +583,7 @@
     tANI_U32           propRateAdjustPeriod;
     tANI_U32           scanStartTime;    // used to measure scan time
 
-    //tANI_U8            gLimBssid[6];
+    tANI_U8            gLimBssid[6];
     tANI_U8            gLimMyMacAddr[6];
     tANI_U8            ackPolicy;
 
@@ -708,7 +708,7 @@
 
     // Place holder for Join request that we're
     // currently attempting
-    //tLimMlmJoinReq       *gpLimMlmJoinReq;
+    tLimMlmJoinReq       *gpLimMlmJoinReq;
 
     // Reason code to determine the channel change context while sending 
     // WDA_CHNL_SWITCH_REQ message to HAL       
@@ -741,6 +741,27 @@
     //////////////////////////////////////////     ASSOC RELATED END ///////////////////////////////////////////
 
 
+    // 11h Spectrum Management Related Flag
+    tANI_U32           gLim11hEnable;
+    tLimSpecMgmtInfo   gLimSpecMgmt;
+    // CB Primary/Secondary Channel Switch Info
+    tLimChannelSwitchInfo  gLimChannelSwitch;
+
+
+    // Channel Bonding mode, as configured by SME
+    tANI_U8 gCbMode;
+
+    //
+    // Identifies the runtime OPERATIONAL state of Channel
+    // Bonding. This info is encoded as a bitmap, as
+    // configured via gCbMode.
+    //
+    //  b7  b6  b5  b4  b3  b2  b1  b0
+    // --------------------------------
+    // | X | X | X | AU|CS|U/D| O | A |
+    // --------------------------------
+    //
+    tANI_U8 gCbState;
 
     //
     // For DEBUG purposes
@@ -751,6 +772,24 @@
     // Holds the desired tSirScanType, as requested by SME
     tSirScanType gLimScanOverrideSaved;
 
+    // Override with this Phy CB state always
+    //ePhyChanBondState gLimPhyCBState;
+
+    // When operating with -
+    // a) Channel Bonding mode (as configured by SME) AND
+    // b) CB State protection turned ON
+    // this object will save the CB state as desired by SME
+    //
+    // This object mimics the bitmap encoding of the
+    // gCbState object, as follows:
+    //
+    //  b7  b6  b5  b4  b3  b2  b1  b0
+    // --------------------------------
+    // | X | X | X | AU|CS|U/D| O | A |
+    // --------------------------------
+    //
+    tANI_U8 gCbStateProtected;
+
     //
     // CB State protection, operated upon as follows:
     // 1 - CB is enabled in the hardware ONLY WHEN a Titan
@@ -787,6 +826,10 @@
 
     tANI_U8 gHTGreenfield;
 
+    //0-20Mhz
+    //1-40Mhz
+    tANI_U8 gHTSupportedChannelWidthSet;
+
     tANI_U8 gHTShortGI40Mhz;
     tANI_U8 gHTShortGI20Mhz;
 
@@ -847,6 +890,15 @@
     tANI_U8 gHTRifsMode;
    // OBss Mode . set when we have Non HT STA is associated or with in overlap bss
     tANI_U8  gHTObssMode;
+    //
+    // Recommended Tx Width Set
+    // 0 - use 20 MHz channel (control channel)
+    // 1 - use channel width enabled under Supported Channel Width Set
+    //
+    tANI_U8 gHTRecommendedTxWidthSet;
+
+    // Identifies the 40 MHz extension channel
+    tSirMacHTSecondaryChannelOffset gHTSecondaryChannelOffset;
 
     // Identifies the current Operating Mode
     tSirMacHTOperatingMode gHTOperMode;
@@ -908,12 +960,6 @@
     vos_list_t  gLimMgmtFrameRegistratinQueue;
     tANI_U32    actionFrameSessionId;
 #endif
-    tSirBackgroundScanMode gLimBackgroundScanMode;
-#ifdef WLAN_FEATURE_11AC
-    tANI_U8    vhtCapabilityPresentInBeacon;
-    tANI_U8    apCenterChan;
-    tANI_U8    apChanWidth;
-#endif
 } tAniSirLim, *tpAniSirLim;
 
 #ifdef WLAN_FEATURE_P2P
diff --git a/drivers/staging/prima/CORE/MAC/inc/aniParam.h b/drivers/staging/prima/CORE/MAC/inc/aniParam.h
index 44b7a32..b9a361d 100644
--- a/drivers/staging/prima/CORE/MAC/inc/aniParam.h
+++ b/drivers/staging/prima/CORE/MAC/inc/aniParam.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/inc/aniSystemDefs.h b/drivers/staging/prima/CORE/MAC/inc/aniSystemDefs.h
index f585893..f8b1f9f 100644
--- a/drivers/staging/prima/CORE/MAC/inc/aniSystemDefs.h
+++ b/drivers/staging/prima/CORE/MAC/inc/aniSystemDefs.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/inc/logDump.h b/drivers/staging/prima/CORE/MAC/inc/logDump.h
index b17fb66..4af9cdd 100644
--- a/drivers/staging/prima/CORE/MAC/inc/logDump.h
+++ b/drivers/staging/prima/CORE/MAC/inc/logDump.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/inc/macInitApi.h b/drivers/staging/prima/CORE/MAC/inc/macInitApi.h
index 8fe0d1c..91d0c32 100644
--- a/drivers/staging/prima/CORE/MAC/inc/macInitApi.h
+++ b/drivers/staging/prima/CORE/MAC/inc/macInitApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/inc/macTrace.h b/drivers/staging/prima/CORE/MAC/inc/macTrace.h
index 6ccbd3e..6de267c 100644
--- a/drivers/staging/prima/CORE/MAC/inc/macTrace.h
+++ b/drivers/staging/prima/CORE/MAC/inc/macTrace.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/inc/qwlan_version.h b/drivers/staging/prima/CORE/MAC/inc/qwlan_version.h
index e9337c3..7391d8d 100644
--- a/drivers/staging/prima/CORE/MAC/inc/qwlan_version.h
+++ b/drivers/staging/prima/CORE/MAC/inc/qwlan_version.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -23,7 +23,7 @@
 #define QWLAN_VERSION_H
 /*===========================================================================
 
-FILE:
+FILE: 
    qwlan_version.h
 
 BRIEF DESCRIPTION:
@@ -37,10 +37,11 @@
 ===========================================================================*/
 
 #define QWLAN_VERSION_MAJOR            3
-#define QWLAN_VERSION_MINOR            2
-#define QWLAN_VERSION_PATCH            1
-#define QWLAN_VERSION_EXTRA            "h"
-#define QWLAN_VERSION_BUILD            11
-#define QWLAN_VERSIONSTR               "3.2.1.11h"
+#define QWLAN_VERSION_MINOR            1
+#define QWLAN_VERSION_PATCH            7
+#define QWLAN_VERSION_EXTRA            ""
+#define QWLAN_VERSION_BUILD            16
+
+#define QWLAN_VERSIONSTR               "3.1.7.16"
 
 #endif /* QWLAN_VERSION_H */
diff --git a/drivers/staging/prima/CORE/MAC/inc/sirApi.h b/drivers/staging/prima/CORE/MAC/inc/sirApi.h
index 191c342..564ea5f 100644
--- a/drivers/staging/prima/CORE/MAC/inc/sirApi.h
+++ b/drivers/staging/prima/CORE/MAC/inc/sirApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -36,7 +36,6 @@
 #include "sirTypes.h"
 #include "sirMacProtDef.h"
 #include "aniSystemDefs.h"
-#include "sirParams.h"
 
 #ifdef FEATURE_WLAN_CCX
 #include "ccxGlobal.h"
@@ -324,6 +323,22 @@
     eSIR_DONOT_USE_RESULT_CODE = SIR_MAX_ENUM_SIZE    
 } tSirResultCodes;
 
+//
+// Enumerated constants to identify
+// 1) the operating state of Channel Bonding
+// 2) the secondary CB channel to be used
+//
+typedef enum eAniCBSecondaryMode
+{
+    eANI_CB_SECONDARY_NONE,
+    eANI_CB_SECONDARY_DOWN,
+    eANI_CB_SECONDARY_UP,
+    eANI_DONOT_USE_SECONDARY_MODE = SIR_MAX_ENUM_SIZE
+} tAniCBSecondaryMode;
+
+
+
+
 /* each station added has a rate mode which specifies the sta attributes */
 typedef enum eStaRateMode {
     eSTA_TAURUS = 0,
@@ -333,9 +348,6 @@
     eSTA_11bg,
     eSTA_11a,
     eSTA_11n,
-#ifdef WLAN_FEATURE_11AC
-    eSTA_11ac,
-#endif
     eSTA_INVALID_RATE_MODE
 } tStaRateMode, *tpStaRateMode;
 
@@ -384,18 +396,6 @@
      */
     tANI_U16 rxHighestDataRate;
 
-#ifdef WLAN_FEATURE_11AC
-   /*Indicates the Maximum MCS that can be received for each number
-        of spacial streams */
-    tANI_U16 vhtRxMCSMap;
-   /*Indicate the highest VHT data rate that the STA is able to receive*/
-    tANI_U16 vhtRxHighestDataRate;
-   /*Indicates the Maximum MCS that can be transmitted	for each number
-        of spacial streams */
-    tANI_U16 vhtTxMCSMap;
-   /*Indicate the highest VHT data rate that the STA is able to transmit*/
-    tANI_U16 vhtTxHighestDataRate;
-#endif
 } tSirSupportedRates, *tpSirSupportedRates;
 
 
@@ -446,6 +446,47 @@
 #endif
 
 //
+// A bit-encoding, identifying the new TITAN capabilities
+// and state information. The capabilities being exposed
+// are -
+// Concatenation
+// Compression
+//FIXME_CBMODE: need to seperate out HT and TITAN CB mode fields.
+// Channel Bonding - Only this filed is used for HT also. 
+// Reverse FCS
+//
+// The bitfield encoding is as follows -
+//
+//  b7  b6   b5   b4   b3   b2   b1   b0
+// --------------------------------------
+// | X | X |CB/O|CB/O|CB/A|RFCS| CP | CC |
+// --------------------------------------
+// where,
+// CC   - Concatenation: 1 - ON, 0 - OFF
+// CP   - Compression: 1 - ON, 0 - OFF
+// RFCS - Reverse FCS Support: 1 - ON, 0 - OFF
+// CB/A - Channel Bonding "Admin" state: 1 - ON, 0 - OFF
+// CB/O - Channel Bonding "Oper" state:
+//        00 - CB Oper state OFF
+//        01 - CB Secondary channel DOWN
+//        10 - CB Secondary channel UP
+//        11 - Reserved
+// X    - Don't care
+//
+// This enumerated data type is used for IPC between the
+// LIM and SME (WSM/HDD) for the following northbound
+// interfaces -
+// LIM -> WSM
+// tSirNeighborBssInfo,
+// tSirSmeAssocInd,
+// tSirSmeReassocInd
+//
+// LIM -> HDD/Roaming
+// tSirBssDescription
+//
+typedef tANI_U8 tAniTitanHtCapabilityInfo;
+
+//
 // Identifies the neighbor BSS' that was(were) detected
 // by an STA and reported to the AP
 //
@@ -462,6 +503,45 @@
 
 } tAniTitanCBNeighborInfo, *tpAniTitanCBNeighborInfo;
 
+//
+// MACRO's to extract info from tAniTitanHtCapabilityInfo
+//
+#define SME_GET_CONCAT_STATE(titanHtCaps) \
+        (titanHtCaps & 0x01)
+#define SME_SET_CONCAT_STATE(titanHtCaps,state) \
+        (((state) == eHAL_CLEAR)? \
+          ((titanHtCaps) = (titanHtCaps) & (0x3E)): \
+          ((titanHtCaps) = (titanHtCaps) | (0x01)))
+
+#define SME_GET_COMPRESSION_STATE(titanHtCaps) \
+        ((titanHtCaps & 0x02) >> 1)
+#define SME_SET_COMPRESSION_STATE(titanHtCaps,state) \
+        (((state) == eHAL_CLEAR)? \
+          ((titanHtCaps) = (titanHtCaps) & (0x3D)): \
+          ((titanHtCaps) = (titanHtCaps) | (0x02)))
+
+#define SME_GET_RFCS_STATE(titanHtCaps) \
+        ((titanHtCaps & 0x04) >> 2)
+#define SME_SET_RFCS_STATE(titanHtCaps,state) \
+        (((state) == eHAL_CLEAR)? \
+          ((titanHtCaps) = (titanHtCaps) & (0x3B)): \
+          ((titanHtCaps) = (titanHtCaps) | (0x04)))
+
+#define SME_GET_CB_ADMIN_STATE(titanHtCaps) \
+        ((titanHtCaps & 0x08) >> 3)
+#define SME_SET_CB_ADMIN_STATE(titanHtCaps,state) \
+        (((state) == eHAL_CLEAR)? \
+          ((titanHtCaps) = (titanHtCaps) & (0x37)): \
+          ((titanHtCaps) = (titanHtCaps) | (0x08)))
+
+// NOTE - The value returned by this MACRO, SME_GET_CB_OPER_STATE,
+// can be used along with the enumerated type,
+// tAniCBSecondaryMode, to identify the Admin/Oper state of CB
+#define SME_GET_CB_OPER_STATE(titanHtCaps) \
+        ((titanHtCaps & 0x30) >> 4)
+#define SME_SET_CB_OPER_STATE(titanHtCaps,state) \
+        ((titanHtCaps) = (tANI_U8)(((titanHtCaps) & (0x0F)) | ((state) << 4)))
+
 /// Generic type for sending a response message
 /// with result code to host software
 typedef struct sSirSmeRsp
@@ -565,9 +645,6 @@
     eSIR_11B_NW_TYPE,
     eSIR_11G_NW_TYPE,
     eSIR_11N_NW_TYPE,
-#ifdef WLAN_FEATURE_11AC
-    eSIR_11AC_NW_TYPE,
-#endif
     eSIR_DONOT_USE_NW_TYPE = SIR_MAX_ENUM_SIZE
 } tSirNwType;
 
@@ -621,7 +698,7 @@
     tSirBssType             bssType;
     tSirMacSSid             ssId;
     tANI_U8                 channelId;
-    ePhyChanBondState       cbMode;
+    tAniCBSecondaryMode     cbMode;
 #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
     tSirAlternateRadioList  alternateRadioList;
     tANI_S8                 powerLevel;
@@ -679,6 +756,12 @@
     //used only in scan case.
     tANI_U8              channelIdSelf;
     tANI_U8              sSirBssDescriptionRsvd[3];
+    //
+    // FIXME - This structure is not packed!
+    // Thus, the fields should be aligned at DWORD boundaries
+    // Elsewhere, titanHtCaps is of type tAniTitanHtCapabilityInfo
+    //
+    tANI_U32             titanHtCaps;
     tANI_TIMESTAMP nReceivedTime;     //base on a tick count. It is a time stamp, not a relative time.
 #if defined WLAN_FEATURE_VOWIFI
     tANI_U32       parentTSF;
@@ -695,12 +778,8 @@
     // Please keep the structure 4 bytes aligned above the ieFields
 
     tANI_U8              fProbeRsp; //whether it is from a probe rsp
-    tANI_U8              reservedPadding1;
-    tANI_U8              reservedPadding2;
-    tANI_U8              reservedPadding3;
     tANI_U32             WscIeLen;
     tANI_U8              WscIeProbeRsp[WSCIE_PROBE_RSP_LEN];
-    tANI_U8              reservedPadding4;
 
     tANI_U32             ieFields[1];
 } tSirBssDescription, *tpSirBssDescription;
@@ -786,6 +865,7 @@
 {
     tSirMacAddr             bssId;
     tANI_U8                 channelId;
+    tAniTitanHtCapabilityInfo titanHtCaps;
     tAniBool                wniIndicator;
     tSirBssType             bssType;
     tANI_U8                 sinr;
@@ -941,16 +1021,14 @@
 typedef enum eSirBackgroundScanMode
 {
     eSIR_AGGRESSIVE_BACKGROUND_SCAN = 0,
-    eSIR_NORMAL_BACKGROUND_SCAN = 1,
-    eSIR_ROAMING_SCAN = 2,
+    eSIR_NORMAL_BACKGROUND_SCAN = 1
 } tSirBackgroundScanMode;
 
 /// Two types of traffic check
 typedef enum eSirLinkTrafficCheck
 {
     eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN = 0,
-    eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN = 1,
-    eSIR_CHECK_ROAMING_SCAN = 2,
+    eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN = 1
 } tSirLinkTrafficCheck;
 
 #define SIR_BG_SCAN_RETURN_CACHED_RESULTS              0x0
@@ -1038,7 +1116,6 @@
  
 #ifdef WLAN_FEATURE_P2P
     tANI_BOOLEAN         p2pSearch;
-    tANI_BOOLEAN         skipDfsChnlInP2pSearch;
 #endif
     tANI_U16             uIEFieldLen;
     tANI_U16             uIEFieldOffset;
@@ -1185,14 +1262,13 @@
 {
     tANI_U16            messageType;            // eWNI_SME_JOIN_REQ
     tANI_U16            length;
-    tANI_U8             sessionId;
+    tANI_U8             sessionId;              
     tANI_U16            transactionId;  
     tSirMacSSid         ssId;
     tSirMacAddr         selfMacAddr;            // self Mac address
     tSirBssType         bsstype;                // add new type for BT -AMP STA and AP Modules
     tANI_U8             dot11mode;              // to support BT-AMP     
-    tVOS_CON_MODE       staPersona;             //Persona
-    ePhyChanBondState   cbMode;                 // Pass CB mode value in Join.
+    tVOS_CON_MODE       staPersona;        //Persona
 
     /*This contains the UAPSD Flag for all 4 AC
      * B0: AC_VO UAPSD FLAG
@@ -1234,12 +1310,9 @@
     tCCXTspecInfo       ccxTspecInfo;
 #endif
     
-#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
     tAniBool            isFastTransitionEnabled;
 #endif
-#ifdef FEATURE_WLAN_LFR
-    tAniBool            isFastRoamIniFeatureEnabled;
-#endif
     
 #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
     tAniBool            bpIndicator;
@@ -1351,6 +1424,7 @@
     tANI_U16                  capabilityInfo; // STA capability
     tSirNwType           nwType;            // Indicates 11a/b/g
 #endif
+    tAniTitanHtCapabilityInfo titanHtCaps;
     // powerCap & supportedChannels are present only when
     // spectrumMgtIndicator flag is set
     tAniBool                spectrumMgtIndicator;
@@ -1399,8 +1473,7 @@
     tSirMacAddr         selfMacAddr;            // self Mac address
     tSirBssType         bsstype;                // add new type for BT -AMP STA and AP Modules
     tANI_U8             dot11mode;              // to support BT-AMP     
-    tVOS_CON_MODE       staPersona;             //Persona
-    ePhyChanBondState   cbMode;                 // CBMode value to be passed with reassoc req
+    tVOS_CON_MODE       staPersona;        //Persona
 
     /*This contains the UAPSD Flag for all 4 AC
      * B0: AC_VO UAPSD FLAG
@@ -1440,12 +1513,9 @@
     tAniBool            isCCXconnection;
     tCCXTspecInfo       ccxTspecInfo;
 #endif
-#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
     tAniBool            isFastTransitionEnabled;
 #endif
-#ifdef FEATURE_WLAN_LFR
-    tAniBool            isFastRoamIniFeatureEnabled;
-#endif
 
 #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
     tAniBool             bpIndicator;
@@ -1508,6 +1578,7 @@
     tANI_U16             capabilityInfo; // STA capability
     tSirNwType           nwType;            // Indicates 11a/b/g
 #endif
+    tAniTitanHtCapabilityInfo titanHtCaps;
     // powerCap & supportedChannels are present only when
     // spectrumMgtIndicator flag is set
     tAniBool                spectrumMgtIndicator;
@@ -1940,7 +2011,6 @@
 #ifdef WLAN_SOFTAP_FEATURE
     tANI_U16            staId;
 #endif
-    tANI_U32            reasonCode;
 } tSirSmeDisassocInd, *tpSirSmeDisassocInd;
 
 /// Definition for Disassociation confirm
@@ -2003,7 +2073,6 @@
 #ifdef WLAN_SOFTAP_FEATURE
     tANI_U16            staId;
 #endif
-    tANI_U32            reasonCode;
 } tSirSmeDeauthInd, *tpSirSmeDeauthInd;
 
 /// Definition for Deauthentication confirm
@@ -2082,7 +2151,7 @@
     // In a non-CB environment, with 11H enabled,
     // this field will be ignored
     //
-    ePhyChanBondState    cbMode;
+    tAniCBSecondaryMode cbMode;
 
     // dtimFactor indicates the number of DTIM
     // Beacon before LIM switches channel
@@ -2945,7 +3014,7 @@
     tSirDeltsReqInfo        rsp;
 } tSirDeltsRsp, *tpSirDeltsRsp;
 
-#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
 
 #define SIR_QOS_NUM_TSPEC_MAX 2
 #define SIR_QOS_NUM_AC_MAX 4
@@ -3748,7 +3817,6 @@
 #ifdef WLAN_NS_OFFLOAD
     tSirNsOffloadReq nsOffloadInfo;
 #endif //WLAN_NS_OFFLOAD
-    tANI_U8 bssIdx;
 } tSirHostOffloadReq, *tpSirHostOffloadReq;
 
 /* Packet Types. */
@@ -3767,7 +3835,7 @@
     tSirIpv4Addr    hostIpv4Addr; 
     tSirIpv4Addr    destIpv4Addr;
     tSirMacAddr     destMacAddr;
-    v_U8_t          bssIdx;
+
 } tSirKeepAliveReq, *tpSirKeepAliveReq;
 
 typedef struct sSirSmeAddStaSelfReq
@@ -4070,8 +4138,6 @@
   tANI_U32                        numFieldParams;
   tANI_U32                        coalesceTime;
   tSirRcvPktFilterFieldParams     paramsData[SIR_MAX_NUM_TESTS_PER_FILTER];
-  tSirMacAddr                     selfMacAddr;
-  tSirMacAddr                     bssId; //Bssid of the connected AP
 }tSirRcvPktFilterCfgType, *tpSirRcvPktFilterCfgType;
 
 //
@@ -4100,8 +4166,6 @@
 {
   tANI_U32   status;  /* only valid for response message */
   tANI_U8    filterId;
-  tSirMacAddr selfMacAddr;
-  tSirMacAddr bssId;
 }tSirRcvFltPktClearParam, *tpSirRcvFltPktClearParam;
 
 //
@@ -4111,8 +4175,6 @@
 {
   tANI_U32       ulMulticastAddrCnt;
   tSirMacAddr    multicastAddr[SIR_MAX_NUM_MULTICAST_ADDRESS];
-  tSirMacAddr    selfMacAddr;
-  tSirMacAddr    bssId;
 } tSirRcvFltMcAddrList, *tpSirRcvFltMcAddrList;
 #endif // WLAN_FEATURE_PACKET_FILTERING
 
diff --git a/drivers/staging/prima/CORE/MAC/inc/sirMacPropExts.h b/drivers/staging/prima/CORE/MAC/inc/sirMacPropExts.h
index dab6064..c368e17 100644
--- a/drivers/staging/prima/CORE/MAC/inc/sirMacPropExts.h
+++ b/drivers/staging/prima/CORE/MAC/inc/sirMacPropExts.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -118,23 +118,12 @@
 #define IS_DOT11_MODE_HT(dot11Mode) \
         (((dot11Mode == WNI_CFG_DOT11_MODE_11N) || \
           (dot11Mode ==  WNI_CFG_DOT11_MODE_11N_ONLY) || \
-          (dot11Mode ==  WNI_CFG_DOT11_MODE_11AC) || \
-          (dot11Mode ==  WNI_CFG_DOT11_MODE_11AC_ONLY) || \
           (dot11Mode ==  WNI_CFG_DOT11_MODE_TAURUS) || \
           (dot11Mode ==  WNI_CFG_DOT11_MODE_ALL)) ? TRUE: FALSE)
 #else
 #define IS_DOT11_MODE_HT(dot11Mode) \
         (((dot11Mode == WNI_CFG_DOT11_MODE_11N) || \
           (dot11Mode ==  WNI_CFG_DOT11_MODE_TAURUS) || \
-          (dot11Mode ==  WNI_CFG_DOT11_MODE_11AC) || \
-          (dot11Mode ==  WNI_CFG_DOT11_MODE_ALL)) ? TRUE: FALSE)
-#endif
-
-#ifdef WLAN_FEATURE_11AC
-#define IS_DOT11_MODE_VHT(dot11Mode) \
-        (((dot11Mode == WNI_CFG_DOT11_MODE_11AC) || \
-          (dot11Mode ==  WNI_CFG_DOT11_MODE_11AC_ONLY) || \
-          (dot11Mode ==  WNI_CFG_DOT11_MODE_TAURUS) || \
           (dot11Mode ==  WNI_CFG_DOT11_MODE_ALL)) ? TRUE: FALSE)
 #endif
         /*
@@ -235,6 +224,53 @@
 #define GET_COMPRESSION_STATE(cpBitmap,tcid) \
         ((cpBitmap) & (tcid))
 
+// Get/Set state of Channel Bonding
+//
+// The CB bitfield encoding is -
+//
+//     b7    b6   b5  b4  b3  b2  b1  b0
+// --------------------------------------
+// |CCA_CB |CCA |ICE | AU|CS|U/D| O | A |
+// --------------------------------------
+//
+#define GET_CB_ADMIN_STATE(cbState)    (cbState & 0x01)
+#define GET_CB_OPER_STATE(cbState)     ((cbState & 0x02) >> 1)
+#define GET_CB_SEC_CHANNEL(cbState)    ((cbState & 0x04) >> 2)
+#define GET_CB_CS_IN_PROGRESS(cbState) ((cbState & 0x08) >> 3)
+#define GET_CB_CS_AUTO_UPDATE(cbState) ((cbState & 0x10) >> 4)
+#define GET_CB_ICE_STATE(cbState)      ((cbState & 0x20) >> 5)
+#define GET_CB_CCA_MODE(cbState)       ((cbState & 0x40) >> 6)
+#define GET_CB_CCA_CB_STATE(cbState)   ((cbState & 0x80) >> 7)
+
+#define SET_CB_STATE_DISABLE(cbState) \
+        ((cbState) = (0x00))
+#define SET_CB_STATE_ENABLE(cbState) \
+        ((cbState) = (0x03))
+#define SET_CB_AU_ENABLE(cbState) \
+        ((cbState) = ((cbState) | 0x10))
+#define SET_CB_AU_DISABLE(cbState) \
+        ((cbState) = ((cbState) & 0xEF))
+#define SET_CB_OPER_STATE(cbState,state) \
+        (((state) == eHAL_CLEAR)? \
+          ((cbState) = (cbState) & (0xfD)): \
+          ((cbState) = (cbState) | (0x02)))
+#define SET_CB_SEC_CHANNEL(cbState,state) \
+        (((state) == eHAL_CLEAR)? \
+          ((cbState) = (cbState) & (0xfB)): \
+          ((cbState) = (cbState) | (0x04)))
+#define SET_CB_ICE_DISABLE(cbState) \
+        ((cbState) = ((cbState) & 0xDF))
+#define SET_CB_ICE_ENABLE(cbState) \
+        ((cbState) = ((cbState) | 0x20))
+#define SET_CB_CCA_MODE_TWENTY(cbState) \
+        ((cbState) = ((cbState) & 0xBF))
+#define SET_CB_CCA_MODE_FOURTY(cbState) \
+        ((cbState) = ((cbState) | 0x40))
+#define SET_CB_CCA_CB_DISABLE(cbState) \
+        ((cbState) = ((cbState) & 0x7F))
+#define SET_CB_CCA_CB_ENABLE(cbState) \
+        ((cbState) = ((cbState) | 0x80))
+
 // Get/Set the state of Reverse FCS
 #define GET_RFCS_OPER_STATE(revFcsState) (revFcsState & 0x01)
 #define GET_RFCS_PATTERN_ID(revFcsState) ((revFcsState & 0x0E) >> 1)
diff --git a/drivers/staging/prima/CORE/MAC/inc/sirMacProtDef.h b/drivers/staging/prima/CORE/MAC/inc/sirMacProtDef.h
index cd7b19a..7f2f1d5 100644
--- a/drivers/staging/prima/CORE/MAC/inc/sirMacProtDef.h
+++ b/drivers/staging/prima/CORE/MAC/inc/sirMacProtDef.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -367,11 +367,6 @@
 #define SIR_MAC_HT_INFO_EID_MIN    0
 #define SIR_MAC_HT_INFO_EID_MAX    255
 
-#ifdef WLAN_FEATURE_11AC
-#define SIR_MAC_VHT_CAPABILITIES_EID   191
-#define SIR_MAC_VHT_OPERATION_EID      192
-#define SIR_MAC_VHT_EXT_BSS_LOAD_EID   193
-#endif
 #define SIR_MAC_MAX_SUPPORTED_MCS_SET    16
 
 /// Workaround IE to change beacon length when it is 4*n+1
@@ -472,7 +467,7 @@
 
 
 // Length of Channel Switch related message
-#define SIR_SME_CHANNEL_SWITCH_SIZE        (sizeof(tANI_U8) + 2 *sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(ePhyChanBondState))
+#define SIR_SME_CHANNEL_SWITCH_SIZE        (sizeof(tANI_U8) + 2 *sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tAniCBSecondaryMode))
 #define SIR_CHANNEL_SWITCH_IE_SIZE         EID_LEN(SIR_MAC_CHNL_SWITCH_ANN_EID_MIN)
 
 //Measurement Request/Report messages
@@ -1575,14 +1570,17 @@
 } tSirMacHTMIMOPowerSaveState;
 
 
+typedef enum eSirMacHTSecondaryChannelOffset
+{
+    eHT_SECONDARY_CHANNEL_OFFSET_NONE = 0,
+    eHT_SECONDARY_CHANNEL_OFFSET_UP = 1,
+    eHT_SECONDARY_CHANNEL_OFFSET_DOWN = 3
+} tSirMacHTSecondaryChannelOffset;
+
 typedef enum eSirMacHTChannelWidth
 {
     eHT_CHANNEL_WIDTH_20MHZ = 0,
-    eHT_CHANNEL_WIDTH_40MHZ = 1,
-#ifdef WLAN_FEATURE_11AC
-    eHT_CHANNEL_WIDTH_80MHZ = 2,
-#endif
-    eHT_MAX_CHANNEL_WIDTH
+    eHT_CHANNEL_WIDTH_40MHZ = 1
 } tSirMacHTChannelWidth;
 
 //Packet struct for HT capability
diff --git a/drivers/staging/prima/CORE/MAC/inc/sirTypes.h b/drivers/staging/prima/CORE/MAC/inc/sirTypes.h
index 897733e..467dcc7 100644
--- a/drivers/staging/prima/CORE/MAC/inc/sirTypes.h
+++ b/drivers/staging/prima/CORE/MAC/inc/sirTypes.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/inc/wniApi.h b/drivers/staging/prima/CORE/MAC/inc/wniApi.h
index 9ef410d..3ecae20 100644
--- a/drivers/staging/prima/CORE/MAC/inc/wniApi.h
+++ b/drivers/staging/prima/CORE/MAC/inc/wniApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -327,8 +327,7 @@
 #ifdef WLAN_WAKEUP_EVENTS
     eWNI_SME_WAKE_REASON_IND,
 #endif // WLAN_WAKEUP_EVENTS
-    eWNI_SME_EXCLUDE_UNENCRYPTED,
-    eWNI_SME_RSSI_IND, //RSSI indication from TL to be serialized on MC thread
+
     eWNI_SME_MSG_TYPES_END
 };
 
diff --git a/drivers/staging/prima/CORE/MAC/inc/wniCfgAp.h b/drivers/staging/prima/CORE/MAC/inc/wniCfgAp.h
index e6573d2..dc9f1e7 100644
--- a/drivers/staging/prima/CORE/MAC/inc/wniCfgAp.h
+++ b/drivers/staging/prima/CORE/MAC/inc/wniCfgAp.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -211,129 +211,96 @@
 #define WNI_CFG_BASIC_MCS_SET    166
 #define WNI_CFG_CURRENT_MCS_SET    167
 #define WNI_CFG_GREENFIELD_CAPABILITY    168
-#define WNI_CFG_VHT_MAX_MPDU_LENGTH    169
-#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET    170
-#define WNI_CFG_VHT_LDPC_CODING_CAP    171
-#define WNI_CFG_VHT_SHORT_GI_80MHZ    172
-#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ    173
-#define WNI_CFG_VHT_TXSTBC    174
-#define WNI_CFG_VHT_RXSTBC    175
-#define WNI_CFG_VHT_SU_BEAMFORMER_CAP    176
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP    177
-#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED    178
-#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS    179
-#define WNI_CFG_VHT_MU_BEAMFORMER_CAP    180
-#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP    181
-#define WNI_CFG_VHT_TXOP_PS    182
-#define WNI_CFG_VHT_HTC_VHTC_CAP    183
-#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT    184
-#define WNI_CFG_VHT_LINK_ADAPTATION_CAP    185
-#define WNI_CFG_VHT_RX_ANT_PATTERN    186
-#define WNI_CFG_VHT_TX_ANT_PATTERN    187
-#define WNI_CFG_VHT_RX_MCS_MAP    188
-#define WNI_CFG_VHT_TX_MCS_MAP    189
-#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE    190
-#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE    191
-#define WNI_CFG_VHT_CHANNEL_WIDTH    192
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1    193
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2    194
-#define WNI_CFG_VHT_BASIC_MCS_SET    195
-#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT    196
-#define WNI_CFG_VHT_SS_UNDER_UTIL    197
-#define WNI_CFG_VHT_40MHZ_UTILIZATION    198
-#define WNI_CFG_VHT_80MHZ_UTILIZATION    199
-#define WNI_CFG_VHT_160MHZ_UTILIZATION    200
-#define WNI_CFG_MAX_AMSDU_LENGTH    201
-#define WNI_CFG_MPDU_DENSITY    202
-#define WNI_CFG_MAX_RX_AMPDU_FACTOR    203
-#define WNI_CFG_SHORT_GI_20MHZ    204
-#define WNI_CFG_SHORT_GI_40MHZ    205
-#define WNI_CFG_RIFS_ENABLED    206
-#define WNI_CFG_MAX_PS_POLL    207
-#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE    208
-#define WNI_CFG_RSSI_FILTER_PERIOD    209
-#define WNI_CFG_FT_RSSI_FILTER_PERIOD    210
-#define WNI_CFG_MIN_RSSI_THRESHOLD    211
-#define WNI_CFG_NTH_BEACON_FILTER    212
-#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE    213
-#define WNI_CFG_SCAN_IN_POWERSAVE    214
-#define WNI_CFG_IGNORE_DTIM    215
-#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE    216
-#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE    217
-#define WNI_CFG_WOWLAN_DEAUTH_ENABLE    218
-#define WNI_CFG_WOWLAN_DISASSOC_ENABLE    219
-#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON    220
-#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD    221
-#define WNI_CFG_BA_TIMEOUT    222
-#define WNI_CFG_BA_THRESHOLD_HIGH    223
-#define WNI_CFG_MAX_BA_BUFFERS    224
-#define WNI_CFG_MAX_BA_SESSIONS    225
-#define WNI_CFG_BA_AUTO_SETUP    226
-#define WNI_CFG_ADDBA_REQ_DECLINE    227
-#define WNI_CFG_BG_SCAN_CHANNEL_LIST    228
-#define WNI_CFG_MAX_MEDIUM_TIME    229
-#define WNI_CFG_MAX_MPDUS_IN_AMPDU    230
-#define WNI_CFG_IBSS_AUTO_BSSID    231
-#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG    232
-#define WNI_CFG_PROBE_REQ_ADDNIE_DATA    233
-#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG    234
-#define WNI_CFG_PROBE_RSP_ADDNIE_DATA1    235
-#define WNI_CFG_PROBE_RSP_ADDNIE_DATA2    236
-#define WNI_CFG_PROBE_RSP_ADDNIE_DATA3    237
-#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG    238
-#define WNI_CFG_ASSOC_RSP_ADDNIE_DATA    239
-#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG    240
-#define WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA    241
-#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG    242
-#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA    243
-#define WNI_CFG_WPS_ENABLE    244
-#define WNI_CFG_WPS_STATE    245
-#define WNI_CFG_WPS_PROBE_REQ_FLAG    246
-#define WNI_CFG_WPS_VERSION    247
-#define WNI_CFG_WPS_REQUEST_TYPE    248
-#define WNI_CFG_WPS_CFG_METHOD    249
-#define WNI_CFG_WPS_UUID    250
-#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY    251
-#define WNI_CFG_WPS_PIMARY_DEVICE_OUI    252
-#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY    253
-#define WNI_CFG_WPS_ASSOCIATION_STATE    254
-#define WNI_CFG_WPS_CONFIGURATION_ERROR    255
-#define WNI_CFG_WPS_DEVICE_PASSWORD_ID    256
-#define WNI_CFG_WPS_ASSOC_METHOD    257
-#define WNI_CFG_LOW_GAIN_OVERRIDE    258
-#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE    259
-#define WNI_CFG_RPE_POLLING_THRESHOLD    260
-#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG    261
-#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG    262
-#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG    263
-#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG    264
-#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS    265
-#define WNI_CFG_SINGLE_TID_RC    266
-#define WNI_CFG_RRM_ENABLED    267
-#define WNI_CFG_RRM_OPERATING_CHAN_MAX    268
-#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX    269
-#define WNI_CFG_TX_PWR_CTRL_ENABLE    270
-#define WNI_CFG_MCAST_BCAST_FILTER_SETTING    271
-#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK    272
-#define WNI_CFG_DYNAMIC_PS_POLL_VALUE    273
-#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT    274
-#define WNI_CFG_TELE_BCN_WAKEUP_EN    275
-#define WNI_CFG_TELE_BCN_TRANS_LI    276
-#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS    277
-#define WNI_CFG_TELE_BCN_MAX_LI    278
-#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS    279
-#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS    280
-#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD    281
-#define WNI_CFG_ASSOC_STA_LIMIT    282
-#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL    283
-#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL    284
-#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND    285
-#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD    286
-#define WNI_CFG_ENABLE_CLOSE_LOOP    287
-#define WNI_CFG_ENABLE_LTE_COEX    288
-#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT    289
-#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT    290
-#define WNI_CFG_ENABLE_MC_ADDR_LIST    291
+#define WNI_CFG_MAX_AMSDU_LENGTH    169
+#define WNI_CFG_MPDU_DENSITY    170
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR    171
+#define WNI_CFG_SHORT_GI_20MHZ    172
+#define WNI_CFG_SHORT_GI_40MHZ    173
+#define WNI_CFG_RIFS_ENABLED    174
+#define WNI_CFG_MAX_PS_POLL    175
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE    176
+#define WNI_CFG_RSSI_FILTER_PERIOD    177
+#define WNI_CFG_FT_RSSI_FILTER_PERIOD    178
+#define WNI_CFG_MIN_RSSI_THRESHOLD    179
+#define WNI_CFG_NTH_BEACON_FILTER    180
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE    181
+#define WNI_CFG_SCAN_IN_POWERSAVE    182
+#define WNI_CFG_IGNORE_DTIM    183
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE    184
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE    185
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE    186
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE    187
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON    188
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD    189
+#define WNI_CFG_BA_TIMEOUT    190
+#define WNI_CFG_BA_THRESHOLD_HIGH    191
+#define WNI_CFG_MAX_BA_BUFFERS    192
+#define WNI_CFG_MAX_BA_SESSIONS    193
+#define WNI_CFG_BA_AUTO_SETUP    194
+#define WNI_CFG_ADDBA_REQ_DECLINE    195
+#define WNI_CFG_BG_SCAN_CHANNEL_LIST    196
+#define WNI_CFG_MAX_MEDIUM_TIME    197
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU    198
+#define WNI_CFG_IBSS_AUTO_BSSID    199
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG    200
+#define WNI_CFG_PROBE_REQ_ADDNIE_DATA    201
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG    202
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA1    203
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA2    204
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA3    205
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG    206
+#define WNI_CFG_ASSOC_RSP_ADDNIE_DATA    207
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG    208
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA    209
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG    210
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA    211
+#define WNI_CFG_WPS_ENABLE    212
+#define WNI_CFG_WPS_STATE    213
+#define WNI_CFG_WPS_PROBE_REQ_FLAG    214
+#define WNI_CFG_WPS_VERSION    215
+#define WNI_CFG_WPS_REQUEST_TYPE    216
+#define WNI_CFG_WPS_CFG_METHOD    217
+#define WNI_CFG_WPS_UUID    218
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY    219
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI    220
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY    221
+#define WNI_CFG_WPS_ASSOCIATION_STATE    222
+#define WNI_CFG_WPS_CONFIGURATION_ERROR    223
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID    224
+#define WNI_CFG_WPS_ASSOC_METHOD    225
+#define WNI_CFG_LOW_GAIN_OVERRIDE    226
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE    227
+#define WNI_CFG_RPE_POLLING_THRESHOLD    228
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG    229
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG    230
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG    231
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG    232
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS    233
+#define WNI_CFG_SINGLE_TID_RC    234
+#define WNI_CFG_RRM_ENABLED    235
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX    236
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX    237
+#define WNI_CFG_TX_PWR_CTRL_ENABLE    238
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING    239
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK    240
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE    241
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT    242
+#define WNI_CFG_TELE_BCN_WAKEUP_EN    243
+#define WNI_CFG_TELE_BCN_TRANS_LI    244
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS    245
+#define WNI_CFG_TELE_BCN_MAX_LI    246
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS    247
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS    248
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD    249
+#define WNI_CFG_ASSOC_STA_LIMIT    250
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL    251
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL    252
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND    253
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD    254
+#define WNI_CFG_ENABLE_CLOSE_LOOP    255
+#define WNI_CFG_ENABLE_LTE_COEX    256
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT    257
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT    258
 
 /*
  * String parameter lengths 
@@ -615,11 +582,11 @@
 #define WNI_CFG_PHY_MODE_NONE    3
 
 #define WNI_CFG_DOT11_MODE_STAMIN    0
-#define WNI_CFG_DOT11_MODE_STAMAX    11
+#define WNI_CFG_DOT11_MODE_STAMAX    9
 #define WNI_CFG_DOT11_MODE_STADEF    0
 
 #define WNI_CFG_DOT11_MODE_APMIN    0
-#define WNI_CFG_DOT11_MODE_APMAX    11
+#define WNI_CFG_DOT11_MODE_APMAX    9
 #define WNI_CFG_DOT11_MODE_APDEF    0
 
 #define WNI_CFG_DOT11_MODE_ALL    0
@@ -632,8 +599,6 @@
 #define WNI_CFG_DOT11_MODE_TAURUS    7
 #define WNI_CFG_DOT11_MODE_11G_ONLY    8
 #define WNI_CFG_DOT11_MODE_11N_ONLY    9
-#define WNI_CFG_DOT11_MODE_11AC    10
-#define WNI_CFG_DOT11_MODE_11AC_ONLY    11
 
 #define WNI_CFG_LISTEN_INTERVAL_STAMIN    0
 #define WNI_CFG_LISTEN_INTERVAL_STAMAX    65535
@@ -1029,11 +994,11 @@
 
 #define WNI_CFG_LOG_LEVEL_STAMIN    0
 #define WNI_CFG_LOG_LEVEL_STAMAX    7
-#define WNI_CFG_LOG_LEVEL_STADEF    4
+#define WNI_CFG_LOG_LEVEL_STADEF    3
 
 #define WNI_CFG_LOG_LEVEL_APMIN    0
 #define WNI_CFG_LOG_LEVEL_APMAX    7
-#define WNI_CFG_LOG_LEVEL_APDEF    4
+#define WNI_CFG_LOG_LEVEL_APDEF    3
 
 #define WNI_CFG_OLBC_DETECT_TIMEOUT_STAMIN    1000
 #define WNI_CFG_OLBC_DETECT_TIMEOUT_STAMAX    30000
@@ -1292,11 +1257,11 @@
 #define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_APDEF    60
 
 #define WNI_CFG_CHANNEL_BONDING_MODE_STAMIN    0
-#define WNI_CFG_CHANNEL_BONDING_MODE_STAMAX    10
+#define WNI_CFG_CHANNEL_BONDING_MODE_STAMAX    4
 #define WNI_CFG_CHANNEL_BONDING_MODE_STADEF    0
 
 #define WNI_CFG_CHANNEL_BONDING_MODE_APMIN    0
-#define WNI_CFG_CHANNEL_BONDING_MODE_APMAX    10
+#define WNI_CFG_CHANNEL_BONDING_MODE_APMAX    4
 #define WNI_CFG_CHANNEL_BONDING_MODE_APDEF    0
 
 #define WNI_CFG_CHANNEL_BONDING_MODE_DISABLE    0
@@ -1306,23 +1271,16 @@
 #define WNI_CFG_CHANNEL_BONDING_MODE_INTELLIGENT    4
 
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMIN    0
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMAX    10
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMAX    2
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STADEF    0
 
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_APMIN    0
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_APMAX    10
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_APMAX    2
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_APDEF    0
 
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_NONE    0
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_LOWER    1
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_HIGHER    2
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_LOW_40MHZ_CENTERED    3
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_CENTERED_40MHZ_CENTERED    4
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_HIGH_40MHZ_CENTERED    5
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_LOW_40MHZ_LOW    6
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_HIGH_40MHZ_LOW    7
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_LOW_40MHZ_HIGH    8
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_HIGH_40MHZ_HIGH    9
 
 #define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMIN    0
 #define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMAX    255
@@ -1533,267 +1491,6 @@
 #define WNI_CFG_GREENFIELD_CAPABILITY_ENABLE    1
 #define WNI_CFG_GREENFIELD_CAPABILITY_DISABLE    0
 
-#define WNI_CFG_VHT_MAX_MPDU_LENGTH_STAMIN    0
-#define WNI_CFG_VHT_MAX_MPDU_LENGTH_STAMAX    2
-#define WNI_CFG_VHT_MAX_MPDU_LENGTH_STADEF    0
-
-#define WNI_CFG_VHT_MAX_MPDU_LENGTH_APMIN    0
-#define WNI_CFG_VHT_MAX_MPDU_LENGTH_APMAX    2
-#define WNI_CFG_VHT_MAX_MPDU_LENGTH_APDEF    0
-
-#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STAMIN    0
-#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STAMAX    0
-#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STADEF    0
-
-#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_APMIN    0
-#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_APMAX    0
-#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_APDEF    0
-
-#define WNI_CFG_VHT_LDPC_CODING_CAP_STAMIN    0
-#define WNI_CFG_VHT_LDPC_CODING_CAP_STAMAX    1
-#define WNI_CFG_VHT_LDPC_CODING_CAP_STADEF    0
-
-#define WNI_CFG_VHT_LDPC_CODING_CAP_APMIN    0
-#define WNI_CFG_VHT_LDPC_CODING_CAP_APMAX    1
-#define WNI_CFG_VHT_LDPC_CODING_CAP_APDEF    0
-
-#define WNI_CFG_VHT_SHORT_GI_80MHZ_STAMIN    0
-#define WNI_CFG_VHT_SHORT_GI_80MHZ_STAMAX    1
-#define WNI_CFG_VHT_SHORT_GI_80MHZ_STADEF    1
-
-#define WNI_CFG_VHT_SHORT_GI_80MHZ_APMIN    0
-#define WNI_CFG_VHT_SHORT_GI_80MHZ_APMAX    1
-#define WNI_CFG_VHT_SHORT_GI_80MHZ_APDEF    1
-
-#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STAMIN    0
-#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STAMAX    1
-#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STADEF    0
-
-#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_APMIN    0
-#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_APMAX    1
-#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_APDEF    0
-
-#define WNI_CFG_VHT_TXSTBC_STAMIN    0
-#define WNI_CFG_VHT_TXSTBC_STAMAX    1
-#define WNI_CFG_VHT_TXSTBC_STADEF    0
-
-#define WNI_CFG_VHT_TXSTBC_APMIN    0
-#define WNI_CFG_VHT_TXSTBC_APMAX    1
-#define WNI_CFG_VHT_TXSTBC_APDEF    0
-
-#define WNI_CFG_VHT_RXSTBC_STAMIN    0
-#define WNI_CFG_VHT_RXSTBC_STAMAX    1
-#define WNI_CFG_VHT_RXSTBC_STADEF    1
-
-#define WNI_CFG_VHT_RXSTBC_APMIN    0
-#define WNI_CFG_VHT_RXSTBC_APMAX    1
-#define WNI_CFG_VHT_RXSTBC_APDEF    1
-
-#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_STAMIN    0
-#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_STAMAX    1
-#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_STADEF    0
-
-#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_APMIN    0
-#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_APMAX    1
-#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_APDEF    0
-
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STAMIN    0
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STAMAX    1
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STADEF    1
-
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_APMIN    0
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_APMAX    1
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_APDEF    1
-
-#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STAMIN    0
-#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STAMAX    1
-#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STADEF    0
-
-#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_APMIN    0
-#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_APMAX    1
-#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_APDEF    0
-
-#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STAMIN    0
-#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STAMAX    1
-#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STADEF    1
-
-#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_APMIN    0
-#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_APMAX    1
-#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_APDEF    1
-
-#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_STAMIN    0
-#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_STAMAX    1
-#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_STADEF    0
-
-#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_APMIN    0
-#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_APMAX    1
-#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_APDEF    0
-
-#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STAMIN    0
-#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STAMAX    1
-#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STADEF    0
-
-#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_APMIN    0
-#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_APMAX    1
-#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_APDEF    0
-
-#define WNI_CFG_VHT_TXOP_PS_STAMIN    0
-#define WNI_CFG_VHT_TXOP_PS_STAMAX    1
-#define WNI_CFG_VHT_TXOP_PS_STADEF    0
-
-#define WNI_CFG_VHT_TXOP_PS_APMIN    0
-#define WNI_CFG_VHT_TXOP_PS_APMAX    1
-#define WNI_CFG_VHT_TXOP_PS_APDEF    0
-
-#define WNI_CFG_VHT_HTC_VHTC_CAP_STAMIN    0
-#define WNI_CFG_VHT_HTC_VHTC_CAP_STAMAX    1
-#define WNI_CFG_VHT_HTC_VHTC_CAP_STADEF    0
-
-#define WNI_CFG_VHT_HTC_VHTC_CAP_APMIN    0
-#define WNI_CFG_VHT_HTC_VHTC_CAP_APMAX    1
-#define WNI_CFG_VHT_HTC_VHTC_CAP_APDEF    0
-
-#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STAMIN    0
-#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STAMAX    7
-#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STADEF    3
-
-#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_APMIN    0
-#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_APMAX    7
-#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_APDEF    3
-
-#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_STAMIN    0
-#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_STAMAX    3
-#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_STADEF    0
-
-#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_APMIN    0
-#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_APMAX    3
-#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_APDEF    0
-
-#define WNI_CFG_VHT_RX_ANT_PATTERN_STAMIN    0
-#define WNI_CFG_VHT_RX_ANT_PATTERN_STAMAX    1
-#define WNI_CFG_VHT_RX_ANT_PATTERN_STADEF    1
-
-#define WNI_CFG_VHT_RX_ANT_PATTERN_APMIN    0
-#define WNI_CFG_VHT_RX_ANT_PATTERN_APMAX    1
-#define WNI_CFG_VHT_RX_ANT_PATTERN_APDEF    1
-
-#define WNI_CFG_VHT_TX_ANT_PATTERN_STAMIN    0
-#define WNI_CFG_VHT_TX_ANT_PATTERN_STAMAX    1
-#define WNI_CFG_VHT_TX_ANT_PATTERN_STADEF    1
-
-#define WNI_CFG_VHT_TX_ANT_PATTERN_APMIN    0
-#define WNI_CFG_VHT_TX_ANT_PATTERN_APMAX    1
-#define WNI_CFG_VHT_TX_ANT_PATTERN_APDEF    1
-
-#define WNI_CFG_VHT_RX_MCS_MAP_STAMIN    0
-#define WNI_CFG_VHT_RX_MCS_MAP_STAMAX    65535
-#define WNI_CFG_VHT_RX_MCS_MAP_STADEF    65534
-
-#define WNI_CFG_VHT_RX_MCS_MAP_APMIN    0
-#define WNI_CFG_VHT_RX_MCS_MAP_APMAX    65535
-#define WNI_CFG_VHT_RX_MCS_MAP_APDEF    65534
-
-#define WNI_CFG_VHT_TX_MCS_MAP_STAMIN    0
-#define WNI_CFG_VHT_TX_MCS_MAP_STAMAX    65535
-#define WNI_CFG_VHT_TX_MCS_MAP_STADEF    65534
-
-#define WNI_CFG_VHT_TX_MCS_MAP_APMIN    0
-#define WNI_CFG_VHT_TX_MCS_MAP_APMAX    65535
-#define WNI_CFG_VHT_TX_MCS_MAP_APDEF    65534
-
-#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STAMIN    1
-#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STAMAX    434
-#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STADEF    434
-
-#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_APMIN    1
-#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_APMAX    434
-#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_APDEF    434
-
-#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STAMIN    1
-#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STAMAX    434
-#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STADEF    434
-
-#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_APMIN    1
-#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_APMAX    434
-#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_APDEF    434
-
-#define WNI_CFG_VHT_CHANNEL_WIDTH_STAMIN    0
-#define WNI_CFG_VHT_CHANNEL_WIDTH_STAMAX    3
-#define WNI_CFG_VHT_CHANNEL_WIDTH_STADEF    0
-
-#define WNI_CFG_VHT_CHANNEL_WIDTH_APMIN    0
-#define WNI_CFG_VHT_CHANNEL_WIDTH_APMAX    3
-#define WNI_CFG_VHT_CHANNEL_WIDTH_APDEF    0
-
-#define WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ    0
-#define WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ    1
-#define WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ    2
-#define WNI_CFG_VHT_CHANNEL_WIDTH_80_PLUS_80MHZ    3
-
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STAMIN    0
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STAMAX    256
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STADEF    0
-
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_APMIN    0
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_APMAX    256
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_APDEF    0
-
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STAMIN    0
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STAMAX    0
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STADEF    0
-
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_APMIN    0
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_APMAX    0
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_APDEF    0
-
-#define WNI_CFG_VHT_BASIC_MCS_SET_STAMIN    0
-#define WNI_CFG_VHT_BASIC_MCS_SET_STAMAX    3
-#define WNI_CFG_VHT_BASIC_MCS_SET_STADEF    0
-
-#define WNI_CFG_VHT_BASIC_MCS_SET_APMIN    0
-#define WNI_CFG_VHT_BASIC_MCS_SET_APMAX    3
-#define WNI_CFG_VHT_BASIC_MCS_SET_APDEF    0
-
-#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STAMIN    0
-#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STAMAX    4
-#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STADEF    0
-
-#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_APMIN    0
-#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_APMAX    4
-#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_APDEF    0
-
-#define WNI_CFG_VHT_SS_UNDER_UTIL_STAMIN    0
-#define WNI_CFG_VHT_SS_UNDER_UTIL_STAMAX    0
-#define WNI_CFG_VHT_SS_UNDER_UTIL_STADEF    0
-
-#define WNI_CFG_VHT_SS_UNDER_UTIL_APMIN    0
-#define WNI_CFG_VHT_SS_UNDER_UTIL_APMAX    0
-#define WNI_CFG_VHT_SS_UNDER_UTIL_APDEF    0
-
-#define WNI_CFG_VHT_40MHZ_UTILIZATION_STAMIN    0
-#define WNI_CFG_VHT_40MHZ_UTILIZATION_STAMAX    0
-#define WNI_CFG_VHT_40MHZ_UTILIZATION_STADEF    0
-
-#define WNI_CFG_VHT_40MHZ_UTILIZATION_APMIN    0
-#define WNI_CFG_VHT_40MHZ_UTILIZATION_APMAX    0
-#define WNI_CFG_VHT_40MHZ_UTILIZATION_APDEF    0
-
-#define WNI_CFG_VHT_80MHZ_UTILIZATION_STAMIN    0
-#define WNI_CFG_VHT_80MHZ_UTILIZATION_STAMAX    0
-#define WNI_CFG_VHT_80MHZ_UTILIZATION_STADEF    0
-
-#define WNI_CFG_VHT_80MHZ_UTILIZATION_APMIN    0
-#define WNI_CFG_VHT_80MHZ_UTILIZATION_APMAX    0
-#define WNI_CFG_VHT_80MHZ_UTILIZATION_APDEF    0
-
-#define WNI_CFG_VHT_160MHZ_UTILIZATION_STAMIN    0
-#define WNI_CFG_VHT_160MHZ_UTILIZATION_STAMAX    0
-#define WNI_CFG_VHT_160MHZ_UTILIZATION_STADEF    0
-
-#define WNI_CFG_VHT_160MHZ_UTILIZATION_APMIN    0
-#define WNI_CFG_VHT_160MHZ_UTILIZATION_APMAX    0
-#define WNI_CFG_VHT_160MHZ_UTILIZATION_APDEF    0
-
 #define WNI_CFG_MAX_AMSDU_LENGTH_STAMIN    0
 #define WNI_CFG_MAX_AMSDU_LENGTH_STAMAX    1
 #define WNI_CFG_MAX_AMSDU_LENGTH_STADEF    0
@@ -2400,20 +2097,12 @@
 #define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_APMAX    255
 #define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_APDEF    20
 
-#define WNI_CFG_ENABLE_MC_ADDR_LIST_STAMIN    0
-#define WNI_CFG_ENABLE_MC_ADDR_LIST_STAMAX    1
-#define WNI_CFG_ENABLE_MC_ADDR_LIST_STADEF    0
-
-#define WNI_CFG_ENABLE_MC_ADDR_LIST_APMIN    0
-#define WNI_CFG_ENABLE_MC_ADDR_LIST_APMAX    1
-#define WNI_CFG_ENABLE_MC_ADDR_LIST_APDEF    0
-
-#define CFG_PARAM_MAX_NUM         292
-#define CFG_AP_IBUF_MAX_SIZE      231
+#define CFG_PARAM_MAX_NUM         259
+#define CFG_AP_IBUF_MAX_SIZE      198
 #define CFG_AP_SBUF_MAX_SIZE      3422
-#define CFG_STA_IBUF_MAX_SIZE     226
+#define CFG_STA_IBUF_MAX_SIZE     193
 #define CFG_STA_SBUF_MAX_SIZE     3388
-#define CFG_SEM_MAX_NUM           19
+#define CFG_SEM_MAX_NUM           12
 
 #define CFG_STA_MAGIC_DWORD     0xbeefbeef
 
diff --git a/drivers/staging/prima/CORE/MAC/inc/wniCfgSta.h b/drivers/staging/prima/CORE/MAC/inc/wniCfgSta.h
index 682bd93..bbabd41 100644
--- a/drivers/staging/prima/CORE/MAC/inc/wniCfgSta.h
+++ b/drivers/staging/prima/CORE/MAC/inc/wniCfgSta.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -205,129 +205,96 @@
 #define WNI_CFG_BASIC_MCS_SET    166
 #define WNI_CFG_CURRENT_MCS_SET    167
 #define WNI_CFG_GREENFIELD_CAPABILITY    168
-#define WNI_CFG_VHT_MAX_MPDU_LENGTH    169
-#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET    170
-#define WNI_CFG_VHT_LDPC_CODING_CAP    171
-#define WNI_CFG_VHT_SHORT_GI_80MHZ    172
-#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ    173
-#define WNI_CFG_VHT_TXSTBC    174
-#define WNI_CFG_VHT_RXSTBC    175
-#define WNI_CFG_VHT_SU_BEAMFORMER_CAP    176
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP    177
-#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED    178
-#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS    179
-#define WNI_CFG_VHT_MU_BEAMFORMER_CAP    180
-#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP    181
-#define WNI_CFG_VHT_TXOP_PS    182
-#define WNI_CFG_VHT_HTC_VHTC_CAP    183
-#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT    184
-#define WNI_CFG_VHT_LINK_ADAPTATION_CAP    185
-#define WNI_CFG_VHT_RX_ANT_PATTERN    186
-#define WNI_CFG_VHT_TX_ANT_PATTERN    187
-#define WNI_CFG_VHT_RX_MCS_MAP    188
-#define WNI_CFG_VHT_TX_MCS_MAP    189
-#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE    190
-#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE    191
-#define WNI_CFG_VHT_CHANNEL_WIDTH    192
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1    193
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2    194
-#define WNI_CFG_VHT_BASIC_MCS_SET    195
-#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT    196
-#define WNI_CFG_VHT_SS_UNDER_UTIL    197
-#define WNI_CFG_VHT_40MHZ_UTILIZATION    198
-#define WNI_CFG_VHT_80MHZ_UTILIZATION    199
-#define WNI_CFG_VHT_160MHZ_UTILIZATION    200
-#define WNI_CFG_MAX_AMSDU_LENGTH    201
-#define WNI_CFG_MPDU_DENSITY    202
-#define WNI_CFG_MAX_RX_AMPDU_FACTOR    203
-#define WNI_CFG_SHORT_GI_20MHZ    204
-#define WNI_CFG_SHORT_GI_40MHZ    205
-#define WNI_CFG_RIFS_ENABLED    206
-#define WNI_CFG_MAX_PS_POLL    207
-#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE    208
-#define WNI_CFG_RSSI_FILTER_PERIOD    209
-#define WNI_CFG_FT_RSSI_FILTER_PERIOD    210
-#define WNI_CFG_MIN_RSSI_THRESHOLD    211
-#define WNI_CFG_NTH_BEACON_FILTER    212
-#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE    213
-#define WNI_CFG_SCAN_IN_POWERSAVE    214
-#define WNI_CFG_IGNORE_DTIM    215
-#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE    216
-#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE    217
-#define WNI_CFG_WOWLAN_DEAUTH_ENABLE    218
-#define WNI_CFG_WOWLAN_DISASSOC_ENABLE    219
-#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON    220
-#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD    221
-#define WNI_CFG_BA_TIMEOUT    222
-#define WNI_CFG_BA_THRESHOLD_HIGH    223
-#define WNI_CFG_MAX_BA_BUFFERS    224
-#define WNI_CFG_MAX_BA_SESSIONS    225
-#define WNI_CFG_BA_AUTO_SETUP    226
-#define WNI_CFG_ADDBA_REQ_DECLINE    227
-#define WNI_CFG_BG_SCAN_CHANNEL_LIST    228
-#define WNI_CFG_MAX_MEDIUM_TIME    229
-#define WNI_CFG_MAX_MPDUS_IN_AMPDU    230
-#define WNI_CFG_IBSS_AUTO_BSSID    231
-#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG    232
-#define WNI_CFG_PROBE_REQ_ADDNIE_DATA    233
-#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG    234
-#define WNI_CFG_PROBE_RSP_ADDNIE_DATA1    235
-#define WNI_CFG_PROBE_RSP_ADDNIE_DATA2    236
-#define WNI_CFG_PROBE_RSP_ADDNIE_DATA3    237
-#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG    238
-#define WNI_CFG_ASSOC_RSP_ADDNIE_DATA    239
-#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG    240
-#define WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA    241
-#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG    242
-#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA    243
-#define WNI_CFG_WPS_ENABLE    244
-#define WNI_CFG_WPS_STATE    245
-#define WNI_CFG_WPS_PROBE_REQ_FLAG    246
-#define WNI_CFG_WPS_VERSION    247
-#define WNI_CFG_WPS_REQUEST_TYPE    248
-#define WNI_CFG_WPS_CFG_METHOD    249
-#define WNI_CFG_WPS_UUID    250
-#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY    251
-#define WNI_CFG_WPS_PIMARY_DEVICE_OUI    252
-#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY    253
-#define WNI_CFG_WPS_ASSOCIATION_STATE    254
-#define WNI_CFG_WPS_CONFIGURATION_ERROR    255
-#define WNI_CFG_WPS_DEVICE_PASSWORD_ID    256
-#define WNI_CFG_WPS_ASSOC_METHOD    257
-#define WNI_CFG_LOW_GAIN_OVERRIDE    258
-#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE    259
-#define WNI_CFG_RPE_POLLING_THRESHOLD    260
-#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG    261
-#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG    262
-#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG    263
-#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG    264
-#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS    265
-#define WNI_CFG_SINGLE_TID_RC    266
-#define WNI_CFG_RRM_ENABLED    267
-#define WNI_CFG_RRM_OPERATING_CHAN_MAX    268
-#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX    269
-#define WNI_CFG_TX_PWR_CTRL_ENABLE    270
-#define WNI_CFG_MCAST_BCAST_FILTER_SETTING    271
-#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK    272
-#define WNI_CFG_DYNAMIC_PS_POLL_VALUE    273
-#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT    274
-#define WNI_CFG_TELE_BCN_WAKEUP_EN    275
-#define WNI_CFG_TELE_BCN_TRANS_LI    276
-#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS    277
-#define WNI_CFG_TELE_BCN_MAX_LI    278
-#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS    279
-#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS    280
-#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD    281
-#define WNI_CFG_ASSOC_STA_LIMIT    282
-#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL    283
-#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL    284
-#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND    285
-#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD    286
-#define WNI_CFG_ENABLE_CLOSE_LOOP    287
-#define WNI_CFG_ENABLE_LTE_COEX    288
-#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT    289
-#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT    290
-#define WNI_CFG_ENABLE_MC_ADDR_LIST    291
+#define WNI_CFG_MAX_AMSDU_LENGTH    169
+#define WNI_CFG_MPDU_DENSITY    170
+#define WNI_CFG_MAX_RX_AMPDU_FACTOR    171
+#define WNI_CFG_SHORT_GI_20MHZ    172
+#define WNI_CFG_SHORT_GI_40MHZ    173
+#define WNI_CFG_RIFS_ENABLED    174
+#define WNI_CFG_MAX_PS_POLL    175
+#define WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE    176
+#define WNI_CFG_RSSI_FILTER_PERIOD    177
+#define WNI_CFG_FT_RSSI_FILTER_PERIOD    178
+#define WNI_CFG_MIN_RSSI_THRESHOLD    179
+#define WNI_CFG_NTH_BEACON_FILTER    180
+#define WNI_CFG_BROADCAST_FRAME_FILTER_ENABLE    181
+#define WNI_CFG_SCAN_IN_POWERSAVE    182
+#define WNI_CFG_IGNORE_DTIM    183
+#define WNI_CFG_WOWLAN_UCAST_PATTERN_FILTER_ENABLE    184
+#define WNI_CFG_WOWLAN_CHANNEL_SWITCH_ENABLE    185
+#define WNI_CFG_WOWLAN_DEAUTH_ENABLE    186
+#define WNI_CFG_WOWLAN_DISASSOC_ENABLE    187
+#define WNI_CFG_WOWLAN_MAX_MISSED_BEACON    188
+#define WNI_CFG_WOWLAN_MAX_SLEEP_PERIOD    189
+#define WNI_CFG_BA_TIMEOUT    190
+#define WNI_CFG_BA_THRESHOLD_HIGH    191
+#define WNI_CFG_MAX_BA_BUFFERS    192
+#define WNI_CFG_MAX_BA_SESSIONS    193
+#define WNI_CFG_BA_AUTO_SETUP    194
+#define WNI_CFG_ADDBA_REQ_DECLINE    195
+#define WNI_CFG_BG_SCAN_CHANNEL_LIST    196
+#define WNI_CFG_MAX_MEDIUM_TIME    197
+#define WNI_CFG_MAX_MPDUS_IN_AMPDU    198
+#define WNI_CFG_IBSS_AUTO_BSSID    199
+#define WNI_CFG_PROBE_REQ_ADDNIE_FLAG    200
+#define WNI_CFG_PROBE_REQ_ADDNIE_DATA    201
+#define WNI_CFG_PROBE_RSP_ADDNIE_FLAG    202
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA1    203
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA2    204
+#define WNI_CFG_PROBE_RSP_ADDNIE_DATA3    205
+#define WNI_CFG_ASSOC_RSP_ADDNIE_FLAG    206
+#define WNI_CFG_ASSOC_RSP_ADDNIE_DATA    207
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_FLAG    208
+#define WNI_CFG_PROBE_REQ_ADDNP2PIE_DATA    209
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG    210
+#define WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA    211
+#define WNI_CFG_WPS_ENABLE    212
+#define WNI_CFG_WPS_STATE    213
+#define WNI_CFG_WPS_PROBE_REQ_FLAG    214
+#define WNI_CFG_WPS_VERSION    215
+#define WNI_CFG_WPS_REQUEST_TYPE    216
+#define WNI_CFG_WPS_CFG_METHOD    217
+#define WNI_CFG_WPS_UUID    218
+#define WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY    219
+#define WNI_CFG_WPS_PIMARY_DEVICE_OUI    220
+#define WNI_CFG_WPS_DEVICE_SUB_CATEGORY    221
+#define WNI_CFG_WPS_ASSOCIATION_STATE    222
+#define WNI_CFG_WPS_CONFIGURATION_ERROR    223
+#define WNI_CFG_WPS_DEVICE_PASSWORD_ID    224
+#define WNI_CFG_WPS_ASSOC_METHOD    225
+#define WNI_CFG_LOW_GAIN_OVERRIDE    226
+#define WNI_CFG_ENABLE_PHY_AGC_LISTEN_MODE    227
+#define WNI_CFG_RPE_POLLING_THRESHOLD    228
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG    229
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG    230
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG    231
+#define WNI_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG    232
+#define WNI_CFG_NO_OF_ONCHIP_REORDER_SESSIONS    233
+#define WNI_CFG_SINGLE_TID_RC    234
+#define WNI_CFG_RRM_ENABLED    235
+#define WNI_CFG_RRM_OPERATING_CHAN_MAX    236
+#define WNI_CFG_RRM_NON_OPERATING_CHAN_MAX    237
+#define WNI_CFG_TX_PWR_CTRL_ENABLE    238
+#define WNI_CFG_MCAST_BCAST_FILTER_SETTING    239
+#define WNI_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK    240
+#define WNI_CFG_DYNAMIC_PS_POLL_VALUE    241
+#define WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT    242
+#define WNI_CFG_TELE_BCN_WAKEUP_EN    243
+#define WNI_CFG_TELE_BCN_TRANS_LI    244
+#define WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS    245
+#define WNI_CFG_TELE_BCN_MAX_LI    246
+#define WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS    247
+#define WNI_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS    248
+#define WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD    249
+#define WNI_CFG_ASSOC_STA_LIMIT    250
+#define WNI_CFG_SAP_CHANNEL_SELECT_START_CHANNEL    251
+#define WNI_CFG_SAP_CHANNEL_SELECT_END_CHANNEL    252
+#define WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND    253
+#define WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD    254
+#define WNI_CFG_ENABLE_CLOSE_LOOP    255
+#define WNI_CFG_ENABLE_LTE_COEX    256
+#define WNI_CFG_AP_KEEP_ALIVE_TIMEOUT    257
+#define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT    258
 
 /*
  * String parameter lengths 
@@ -520,7 +487,7 @@
 #define WNI_CFG_PHY_MODE_NONE    3
 
 #define WNI_CFG_DOT11_MODE_STAMIN    0
-#define WNI_CFG_DOT11_MODE_STAMAX    11
+#define WNI_CFG_DOT11_MODE_STAMAX    9
 #define WNI_CFG_DOT11_MODE_STADEF    0
 
 #define WNI_CFG_DOT11_MODE_ALL    0
@@ -533,8 +500,6 @@
 #define WNI_CFG_DOT11_MODE_TAURUS    7
 #define WNI_CFG_DOT11_MODE_11G_ONLY    8
 #define WNI_CFG_DOT11_MODE_11N_ONLY    9
-#define WNI_CFG_DOT11_MODE_11AC    10
-#define WNI_CFG_DOT11_MODE_11AC_ONLY    11
 
 #define WNI_CFG_LISTEN_INTERVAL_STAMIN    0
 #define WNI_CFG_LISTEN_INTERVAL_STAMAX    65535
@@ -762,7 +727,7 @@
 
 #define WNI_CFG_LOG_LEVEL_STAMIN    0
 #define WNI_CFG_LOG_LEVEL_STAMAX    7
-#define WNI_CFG_LOG_LEVEL_STADEF    4
+#define WNI_CFG_LOG_LEVEL_STADEF    3
 
 #define WNI_CFG_OLBC_DETECT_TIMEOUT_STAMIN    1000
 #define WNI_CFG_OLBC_DETECT_TIMEOUT_STAMAX    30000
@@ -925,7 +890,7 @@
 #define WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE_STADEF    60
 
 #define WNI_CFG_CHANNEL_BONDING_MODE_STAMIN    0
-#define WNI_CFG_CHANNEL_BONDING_MODE_STAMAX    10
+#define WNI_CFG_CHANNEL_BONDING_MODE_STAMAX    4
 #define WNI_CFG_CHANNEL_BONDING_MODE_STADEF    0
 
 #define WNI_CFG_CHANNEL_BONDING_MODE_DISABLE    0
@@ -935,19 +900,12 @@
 #define WNI_CFG_CHANNEL_BONDING_MODE_INTELLIGENT    4
 
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMIN    0
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMAX    10
+#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STAMAX    2
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_STADEF    0
 
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_NONE    0
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_LOWER    1
 #define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_HIGHER    2
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_LOW_40MHZ_CENTERED    3
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_CENTERED_40MHZ_CENTERED    4
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_HIGH_40MHZ_CENTERED    5
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_LOW_40MHZ_LOW    6
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_HIGH_40MHZ_LOW    7
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_LOW_40MHZ_HIGH    8
-#define WNI_CFG_CB_SECONDARY_CHANNEL_STATE_11AC_20MHZ_HIGH_40MHZ_HIGH    9
 
 #define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMIN    0
 #define WNI_CFG_DYNAMIC_THRESHOLD_ZERO_STAMAX    255
@@ -1086,139 +1044,6 @@
 #define WNI_CFG_GREENFIELD_CAPABILITY_ENABLE    1
 #define WNI_CFG_GREENFIELD_CAPABILITY_DISABLE    0
 
-#define WNI_CFG_VHT_MAX_MPDU_LENGTH_STAMIN    0
-#define WNI_CFG_VHT_MAX_MPDU_LENGTH_STAMAX    2
-#define WNI_CFG_VHT_MAX_MPDU_LENGTH_STADEF    0
-
-#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STAMIN    0
-#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STAMAX    0
-#define WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET_STADEF    0
-
-#define WNI_CFG_VHT_LDPC_CODING_CAP_STAMIN    0
-#define WNI_CFG_VHT_LDPC_CODING_CAP_STAMAX    1
-#define WNI_CFG_VHT_LDPC_CODING_CAP_STADEF    0
-
-#define WNI_CFG_VHT_SHORT_GI_80MHZ_STAMIN    0
-#define WNI_CFG_VHT_SHORT_GI_80MHZ_STAMAX    1
-#define WNI_CFG_VHT_SHORT_GI_80MHZ_STADEF    1
-
-#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STAMIN    0
-#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STAMAX    1
-#define WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ_STADEF    0
-
-#define WNI_CFG_VHT_TXSTBC_STAMIN    0
-#define WNI_CFG_VHT_TXSTBC_STAMAX    1
-#define WNI_CFG_VHT_TXSTBC_STADEF    0
-
-#define WNI_CFG_VHT_RXSTBC_STAMIN    0
-#define WNI_CFG_VHT_RXSTBC_STAMAX    1
-#define WNI_CFG_VHT_RXSTBC_STADEF    1
-
-#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_STAMIN    0
-#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_STAMAX    1
-#define WNI_CFG_VHT_SU_BEAMFORMER_CAP_STADEF    0
-
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STAMIN    0
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STAMAX    1
-#define WNI_CFG_VHT_SU_BEAMFORMEE_CAP_STADEF    1
-
-#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STAMIN    0
-#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STAMAX    1
-#define WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED_STADEF    0
-
-#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STAMIN    0
-#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STAMAX    1
-#define WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS_STADEF    1
-
-#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_STAMIN    0
-#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_STAMAX    1
-#define WNI_CFG_VHT_MU_BEAMFORMER_CAP_STADEF    0
-
-#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STAMIN    0
-#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STAMAX    1
-#define WNI_CFG_VHT_MU_BEAMFORMEE_CAP_STADEF    0
-
-#define WNI_CFG_VHT_TXOP_PS_STAMIN    0
-#define WNI_CFG_VHT_TXOP_PS_STAMAX    1
-#define WNI_CFG_VHT_TXOP_PS_STADEF    0
-
-#define WNI_CFG_VHT_HTC_VHTC_CAP_STAMIN    0
-#define WNI_CFG_VHT_HTC_VHTC_CAP_STAMAX    1
-#define WNI_CFG_VHT_HTC_VHTC_CAP_STADEF    0
-
-#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STAMIN    0
-#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STAMAX    7
-#define WNI_CFG_VHT_AMPDU_LEN_EXPONENT_STADEF    3
-
-#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_STAMIN    0
-#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_STAMAX    3
-#define WNI_CFG_VHT_LINK_ADAPTATION_CAP_STADEF    0
-
-#define WNI_CFG_VHT_RX_ANT_PATTERN_STAMIN    0
-#define WNI_CFG_VHT_RX_ANT_PATTERN_STAMAX    1
-#define WNI_CFG_VHT_RX_ANT_PATTERN_STADEF    1
-
-#define WNI_CFG_VHT_TX_ANT_PATTERN_STAMIN    0
-#define WNI_CFG_VHT_TX_ANT_PATTERN_STAMAX    1
-#define WNI_CFG_VHT_TX_ANT_PATTERN_STADEF    1
-
-#define WNI_CFG_VHT_RX_MCS_MAP_STAMIN    0
-#define WNI_CFG_VHT_RX_MCS_MAP_STAMAX    65535
-#define WNI_CFG_VHT_RX_MCS_MAP_STADEF    65534
-
-#define WNI_CFG_VHT_TX_MCS_MAP_STAMIN    0
-#define WNI_CFG_VHT_TX_MCS_MAP_STAMAX    65535
-#define WNI_CFG_VHT_TX_MCS_MAP_STADEF    65534
-
-#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STAMIN    1
-#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STAMAX    434
-#define WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_STADEF    434
-
-#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STAMIN    1
-#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STAMAX    434
-#define WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_STADEF    434
-
-#define WNI_CFG_VHT_CHANNEL_WIDTH_STAMIN    0
-#define WNI_CFG_VHT_CHANNEL_WIDTH_STAMAX    3
-#define WNI_CFG_VHT_CHANNEL_WIDTH_STADEF    0
-
-#define WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ    0
-#define WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ    1
-#define WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ    2
-#define WNI_CFG_VHT_CHANNEL_WIDTH_80_PLUS_80MHZ    3
-
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STAMIN    0
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STAMAX    256
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1_STADEF    0
-
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STAMIN    0
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STAMAX    0
-#define WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2_STADEF    0
-
-#define WNI_CFG_VHT_BASIC_MCS_SET_STAMIN    0
-#define WNI_CFG_VHT_BASIC_MCS_SET_STAMAX    3
-#define WNI_CFG_VHT_BASIC_MCS_SET_STADEF    0
-
-#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STAMIN    0
-#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STAMAX    4
-#define WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT_STADEF    0
-
-#define WNI_CFG_VHT_SS_UNDER_UTIL_STAMIN    0
-#define WNI_CFG_VHT_SS_UNDER_UTIL_STAMAX    0
-#define WNI_CFG_VHT_SS_UNDER_UTIL_STADEF    0
-
-#define WNI_CFG_VHT_40MHZ_UTILIZATION_STAMIN    0
-#define WNI_CFG_VHT_40MHZ_UTILIZATION_STAMAX    0
-#define WNI_CFG_VHT_40MHZ_UTILIZATION_STADEF    0
-
-#define WNI_CFG_VHT_80MHZ_UTILIZATION_STAMIN    0
-#define WNI_CFG_VHT_80MHZ_UTILIZATION_STAMAX    0
-#define WNI_CFG_VHT_80MHZ_UTILIZATION_STADEF    0
-
-#define WNI_CFG_VHT_160MHZ_UTILIZATION_STAMIN    0
-#define WNI_CFG_VHT_160MHZ_UTILIZATION_STAMAX    0
-#define WNI_CFG_VHT_160MHZ_UTILIZATION_STADEF    0
-
 #define WNI_CFG_MAX_AMSDU_LENGTH_STAMIN    0
 #define WNI_CFG_MAX_AMSDU_LENGTH_STAMAX    1
 #define WNI_CFG_MAX_AMSDU_LENGTH_STADEF    0
@@ -1561,14 +1386,10 @@
 #define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STAMAX    255
 #define WNI_CFG_GO_KEEP_ALIVE_TIMEOUT_STADEF    20
 
-#define WNI_CFG_ENABLE_MC_ADDR_LIST_STAMIN    0
-#define WNI_CFG_ENABLE_MC_ADDR_LIST_STAMAX    1
-#define WNI_CFG_ENABLE_MC_ADDR_LIST_STADEF    0
-
-#define CFG_PARAM_MAX_NUM        292
-#define CFG_STA_IBUF_MAX_SIZE    226
+#define CFG_PARAM_MAX_NUM        259
+#define CFG_STA_IBUF_MAX_SIZE    193
 #define CFG_STA_SBUF_MAX_SIZE    3388
-#define CFG_SEM_MAX_NUM          19
+#define CFG_SEM_MAX_NUM          12
 
 #define CFG_STA_MAGIC_DWORD    0xbeefbeef
 
diff --git a/drivers/staging/prima/CORE/MAC/inc/wniStat.h b/drivers/staging/prima/CORE/MAC/inc/wniStat.h
index 1bae538..2a6b4bb 100644
--- a/drivers/staging/prima/CORE/MAC/inc/wniStat.h
+++ b/drivers/staging/prima/CORE/MAC/inc/wniStat.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/cfg/cfgApi.c b/drivers/staging/prima/CORE/MAC/src/cfg/cfgApi.c
index 81740ef..a20d0ec 100644
--- a/drivers/staging/prima/CORE/MAC/src/cfg/cfgApi.c
+++ b/drivers/staging/prima/CORE/MAC/src/cfg/cfgApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -187,6 +187,15 @@
         PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);)
         retVal = eSIR_CFG_INVALID_ID;
     }
+#if 0
+    else if (((control & CFG_CTL_RESTART) && !Restarting(pMac)) ||
+             ((control & CFG_CTL_RELOAD) && !Reloading(pMac)))
+    {
+        cfgLog(pMac, LOGE, FL("Change requires a restart/reload cfg id %d state %d\n"),
+               cfgId, pMac->lim.gLimSmeState);
+        retVal = eSIR_CFG_INVALID_ID;
+    }
+#endif
     else if ((pMac->cfg.gCfgIBufMin[index] > value) ||
              (pMac->cfg.gCfgIBufMax[index] < value))
     {
@@ -948,10 +957,20 @@
     if(sessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
         return eSIR_SUCCESS;
 
+
+    
     // Short slot time bit
     if (systemRole == eLIM_AP_ROLE)
     {
-        pCapInfo->shortSlotTime = sessionEntry->shortSlotTimeSupported;
+        if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &val)
+                       != eSIR_SUCCESS)
+        {
+            cfgLog(pMac, LOGP,
+                   FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
+            return eSIR_FAILURE;
+        }
+        if (val)
+            pCapInfo->shortSlotTime = 1;
     }
     else
     {
@@ -970,8 +989,16 @@
          */
         if (val)
         {
-            pCapInfo->shortSlotTime = sessionEntry->shortSlotTimeSupported;
-        }
+            if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &val)
+                           != eSIR_SUCCESS)
+            {
+                cfgLog(pMac, LOGP,
+                       FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
+                return eSIR_FAILURE;
+            }
+            if (val)
+            pCapInfo->shortSlotTime = 1;
+    }
     }
 
     // Spectrum Management bit
@@ -1147,7 +1174,7 @@
     mmhMsg.bodyval = (tANI_U32)cfgId;
     mmhMsg.bodyptr = NULL;
 
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 
     if ((ntfMask & CFG_CTL_NTF_SCH) != 0)
         schPostMessage(pMac, &mmhMsg);
diff --git a/drivers/staging/prima/CORE/MAC/src/cfg/cfgDebug.c b/drivers/staging/prima/CORE/MAC/src/cfg/cfgDebug.c
index 053768c..6e37c73 100644
--- a/drivers/staging/prima/CORE/MAC/src/cfg/cfgDebug.c
+++ b/drivers/staging/prima/CORE/MAC/src/cfg/cfgDebug.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/cfg/cfgDebug.h b/drivers/staging/prima/CORE/MAC/src/cfg/cfgDebug.h
index 2046ffa..49d0533 100644
--- a/drivers/staging/prima/CORE/MAC/src/cfg/cfgDebug.h
+++ b/drivers/staging/prima/CORE/MAC/src/cfg/cfgDebug.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/cfg/cfgDef.h b/drivers/staging/prima/CORE/MAC/src/cfg/cfgDef.h
index b3d689d..b942f3f 100644
--- a/drivers/staging/prima/CORE/MAC/src/cfg/cfgDef.h
+++ b/drivers/staging/prima/CORE/MAC/src/cfg/cfgDef.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/cfg/cfgParamName.c b/drivers/staging/prima/CORE/MAC/src/cfg/cfgParamName.c
index 7b3d5a3..4704c2b 100644
--- a/drivers/staging/prima/CORE/MAC/src/cfg/cfgParamName.c
+++ b/drivers/staging/prima/CORE/MAC/src/cfg/cfgParamName.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -202,38 +202,6 @@
     (unsigned char *)"BASIC_MCS_SET",
     (unsigned char *)"CURRENT_MCS_SET",
     (unsigned char *)"GREENFIELD_CAPABILITY",
-    (unsigned char *)"VHT_MAX_MPDU_LENGTH",
-    (unsigned char *)"VHT_SUPPORTED_CHAN_WIDTH_SET",
-    (unsigned char *)"VHT_LDPC_CODING_CAP",
-    (unsigned char *)"VHT_SHORT_GI_80MHZ",
-    (unsigned char *)"VHT_SHORT_GI_160_AND_80_PLUS_80MHZ",
-    (unsigned char *)"VHT_TXSTBC",
-    (unsigned char *)"VHT_RXSTBC",
-    (unsigned char *)"VHT_SU_BEAMFORMER_CAP",
-    (unsigned char *)"VHT_SU_BEAMFORMEE_CAP",
-    (unsigned char *)"VHT_CSN_BEAMFORMEE_ANT_SUPPORTED",
-    (unsigned char *)"VHT_NUM_SOUNDING_DIMENSIONS",
-    (unsigned char *)"VHT_MU_BEAMFORMER_CAP",
-    (unsigned char *)"VHT_MU_BEAMFORMEE_CAP",
-    (unsigned char *)"VHT_TXOP_PS",
-    (unsigned char *)"VHT_HTC_VHTC_CAP",
-    (unsigned char *)"VHT_AMPDU_LEN_EXPONENT",
-    (unsigned char *)"VHT_LINK_ADAPTATION_CAP",
-    (unsigned char *)"VHT_RX_ANT_PATTERN",
-    (unsigned char *)"VHT_TX_ANT_PATTERN",
-    (unsigned char *)"VHT_RX_MCS_MAP",
-    (unsigned char *)"VHT_TX_MCS_MAP",
-    (unsigned char *)"VHT_RX_HIGHEST_SUPPORTED_DATA_RATE",
-    (unsigned char *)"VHT_TX_HIGHEST_SUPPORTED_DATA_RATE",
-    (unsigned char *)"VHT_CHANNEL_WIDTH",
-    (unsigned char *)"VHT_CHANNEL_CENTER_FREQ_SEGMENT1",
-    (unsigned char *)"VHT_CHANNEL_CENTER_FREQ_SEGMENT2",
-    (unsigned char *)"VHT_BASIC_MCS_SET",
-    (unsigned char *)"VHT_MU_MIMO_CAP_STA_COUNT",
-    (unsigned char *)"VHT_SS_UNDER_UTIL",
-    (unsigned char *)"VHT_40MHZ_UTILIZATION",
-    (unsigned char *)"VHT_80MHZ_UTILIZATION",
-    (unsigned char *)"VHT_160MHZ_UTILIZATION",
     (unsigned char *)"MAX_AMSDU_LENGTH",
     (unsigned char *)"MPDU_DENSITY",
     (unsigned char *)"MAX_RX_AMPDU_FACTOR",
@@ -324,7 +292,6 @@
     (unsigned char *)"ENABLE_LTE_COEX",
     (unsigned char *)"AP_KEEP_ALIVE_TIMEOUT",
     (unsigned char *)"GO_KEEP_ALIVE_TIMEOUT",
-    (unsigned char *)"ENABLE_MC_ADDR_LIST",
 };
 
 
diff --git a/drivers/staging/prima/CORE/MAC/src/cfg/cfgPriv.h b/drivers/staging/prima/CORE/MAC/src/cfg/cfgPriv.h
index 5bed155..b8f3be7 100644
--- a/drivers/staging/prima/CORE/MAC/src/cfg/cfgPriv.h
+++ b/drivers/staging/prima/CORE/MAC/src/cfg/cfgPriv.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/cfg/cfgProcMsg.c b/drivers/staging/prima/CORE/MAC/src/cfg/cfgProcMsg.c
index c72367a..a93bfe1 100644
--- a/drivers/staging/prima/CORE/MAC/src/cfg/cfgProcMsg.c
+++ b/drivers/staging/prima/CORE/MAC/src/cfg/cfgProcMsg.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -415,7 +415,7 @@
     mmhMsg.bodyptr = NULL;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     if (wdaPostCtrlMsg(pMac, &mmhMsg) != eSIR_SUCCESS)
     {
         PELOGE(cfgLog(pMac, LOGE, FL("WDAPostMsgApi failed!\n"));)
@@ -581,7 +581,7 @@
     if (!pMac->cfg.gCfgStatus)
     {
         cfgId = (tANI_U16)sirReadU32N((tANI_U8*)pParam);
-        PELOGE(cfgLog(pMac, LOGE, FL("CFG not ready, param %d"), cfgId);)
+        PELOGE(cfgLog(pMac, LOGE, FL("CFG not ready, param %d\n"), cfgId);)
 #if defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
         sirStoreU32N((tANI_U8 *) &(pMac->cfg.gParamList[WNI_CFG_SET_CNF_RES]),
                      WNI_CFG_NOT_READY);
@@ -707,7 +707,7 @@
             }
             else
             {
-                PELOGW(cfgLog( pMac, LOG2, "  CFGID %d no rsp\n", cfgId);)
+                PELOGW(cfgLog( pMac, LOGW, "  CFGID %d no rsp\n", cfgId);)
             }
 
             if (valueLenRoundedUp4 > length)
diff --git a/drivers/staging/prima/CORE/MAC/src/cfg/cfgSendMsg.c b/drivers/staging/prima/CORE/MAC/src/cfg/cfgSendMsg.c
index 72f9c01..469d464 100644
--- a/drivers/staging/prima/CORE/MAC/src/cfg/cfgSendMsg.c
+++ b/drivers/staging/prima/CORE/MAC/src/cfg/cfgSendMsg.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -139,7 +139,7 @@
     }
 
     // Ship it
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     SysProcessMmhMsg(pMac, &mmhMsg);
 
 } /*** end cfgSendHostMsg() ***/
diff --git a/drivers/staging/prima/CORE/MAC/src/cfg/cfgUtil/cfg.txt b/drivers/staging/prima/CORE/MAC/src/cfg/cfgUtil/cfg.txt
index 5b1d4bd..36bf2c5 100644
--- a/drivers/staging/prima/CORE/MAC/src/cfg/cfgUtil/cfg.txt
+++ b/drivers/staging/prima/CORE/MAC/src/cfg/cfgUtil/cfg.txt
@@ -1,4 +1,4 @@
-* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
 *
 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
 *
@@ -604,10 +604,10 @@
 WNI_CFG_DOT11_MODE     I     4     9
 V    RW    NP RESTART
 LIM
-0    11    0
+0    9    0
 V    RW    NP RESTART
 LIM
-0    11    0
+0    9    0
 
 #ENUM  ALL           0
 #ENUM  11A           1
@@ -619,8 +619,6 @@
 #ENUM  TAURUS        7
 #ENUM  11G_ONLY      8
 #ENUM  11N_ONLY      9
-#ENUM  11AC          10
-#ENUM  11AC_ONLY     11
 
 
 
@@ -1468,10 +1466,10 @@
 WNI_CFG_LOG_LEVEL    I    4    12
 V   RW    NP
 NONE
-0   7   4
+0   7   3
 V   RW    NP
 NONE
-0   7   4
+0   7   3
 
 *
 * OLBC detection timeout
@@ -2246,10 +2244,10 @@
 WNI_CFG_CHANNEL_BONDING_MODE    I    4    12
 V    RW    NP    RESTART
 LIM
-0    10     0
+0    4     0
 V    RW    NP    RESTART
 LIM
-0    10     0
+0    4     0
 
 #ENUM DISABLE          0
 #ENUM ENABLE           1
@@ -2265,35 +2263,21 @@
 *  lower frequency). 
 *
 *  0 - There is no secondary channel. The channel is 20Mhz
-*  1 - LOWER:  Secondary channel 40MHZ is located below the primary channel
-*  2 - CENTERED:Secondary channel and primary located at centered
-*  3 - HIGHER: Secondary channel 40 MHZ is located above the primary channel
-*  4 - 80MHZ_LOW_CENTERED : 20/40MHZ offset LOW 40/80MHZ offset CENTERED
-*  5 - 80MHZ_CENTERED_CENTERED : 20/40MHZ offset CENTERED 40/80MHZ offset CENTERED
-*  6 - 80MHZ_HIGH_CENTERED : 20/40MHZ offset HIGH 40/80MHZ offset CENTERED
-*  7 - 80MHZ_LOW_LOW: 20/40MHZ offset LOW 40/80MHZ offset LOW
-*  8 - 80MHZ_HIGH_LOW: 20/40MHZ offset HIGH 40/80MHZ offset LOW
-*  9 - 80MHZ_LOW_HIGH: 20/40MHZ offset LOW 40/80MHZ offset HIGH
-*  10 - 80MHZ_HIGH_HIGH: 20/40MHZ offset HIGH 40/80MHZ offset HIGH
+*  1 - LOWER:  Secondary channel is located below the primary channel
+*  2 - HIGHER: Secondary channel is located above the primary channel   
 *
 WNI_CFG_CB_SECONDARY_CHANNEL_STATE    I    4    12
 V    RW    NP
 NONE
-0    10     0
+0    2     0
 V    RW    NP
 NONE
-0    10     0
+0    2     0
 
 #ENUM NONE             0
 #ENUM LOWER            1
 #ENUM HIGHER           2
-#ENUM 11AC_20MHZ_LOW_40MHZ_CENTERED       3
-#ENUM 11AC_20MHZ_CENTERED_40MHZ_CENTERED  4
-#ENUM 11AC_20MHZ_HIGH_40MHZ_CENTERED      5
-#ENUM 11AC_20MHZ_LOW_40MHZ_LOW            6
-#ENUM 11AC_20MHZ_HIGH_40MHZ_LOW           7
-#ENUM 11AC_20MHZ_LOW_40MHZ_HIGH           8
-#ENUM 11AC_20MHZ_HIGH_40MHZ_HIGH          9
+
 
 *************************************
 * Feature:   Dynamic Retry Rates
@@ -2709,385 +2693,6 @@
 #ENUM ENABLE    1
 #ENUM DISABLE   0
 
-*
-* Maximum AMPDU Length
-* By default set to zero for 3895 octets
-*
-WNI_CFG_VHT_MAX_MPDU_LENGTH  I    4    19
-V    RW    NP    
-LIM
-0    2    0
-V    RW    NP    
-LIM
-0    2    0
-
-*
-* Supported Channel Width Set
-* By default set to zero for 
-* STAs does not support either 160 or 80+80MHz
-*
-WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET  I    4    19
-V    RW    NP    
-LIM
-0    0    0
-V    RW    NP    
-LIM
-0    0    0
-
-*
-* LDPC Coding Capability
-* Riva/Pronto supports, default set to 1
-*
-WNI_CFG_VHT_LDPC_CODING_CAP  I    4    19
-V    RW    NP    
-LIM
-0    1    0
-V    RW    NP    
-LIM
-0    1    0
-
-*
-* Short GI for 80MHz
-* Riva/Pronto supports, default set to 1
-*
-WNI_CFG_VHT_SHORT_GI_80MHZ  I    4    19
-V    RW    NP    
-LIM
-0    1    1
-V    RW    NP    
-LIM
-0    1    1
-
-*
-* Short GI for 160MHz and 80+80MHz
-* Riva/Pronto does not supports, default set to 0
-*
-WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ  I    4    19
-V    RW    NP    
-LIM
-0    1    0
-V    RW    NP    
-LIM
-0    1    0
-
-*
-* Support for Transmission of 2x1 STBC
-* Riva/Pronto does not supports, default set to 0
-*
-WNI_CFG_VHT_TXSTBC  I    4    19
-V    RW    NP    
-LIM
-0    1    0
-V    RW    NP    
-LIM
-0    1    0
-
-*
-* Support for Reception of PPDUs using STBC
-* Riva/Pronto supports, default set to 1
-*
-WNI_CFG_VHT_RXSTBC  I    4    19
-V    RW    NP    
-LIM
-0    1    1
-V    RW    NP    
-LIM
-0    1    1
-
-*
-* Support for Operating as SU Beamformer
-* Riva/Pronto does not supports, default set to 0
-*
-WNI_CFG_VHT_SU_BEAMFORMER_CAP  I    4    19
-V    RW    NP    
-LIM
-0    1    0
-V    RW    NP    
-LIM
-0    1    0
-
-*
-* Support for Operating as SU Beamformee
-* Riva does not support, But Pronto supports, default set to 0
-*
-WNI_CFG_VHT_SU_BEAMFORMEE_CAP  I    4    19
-V    RW    NP    
-LIM
-0    1    1
-V    RW    NP    
-LIM
-0    1    1
-
-*
-* Compressed Steering Number of Beamformer Antennas Supported
-* Riva/Pronto does not support, default set to 0
-*
-WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED  I    4    19
-V    RW    NP    
-LIM
-0    1    0
-V    RW    NP    
-LIM
-0    1    0
-
-*
-* Number of Sounding Dimensions indicates Number
-* of antennas used by the beamformer when sending beamformed transmissions
-* Riva/Pronto does not support beamformer, default set to 0
-*
-WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS  I    4    19
-V    RW    NP    
-LIM
-0    1    1
-V    RW    NP    
-LIM
-0    1    1
-
-*
-* MU Beamformer Capable
-* Riva/Pronto does not support, default set to 0
-*
-WNI_CFG_VHT_MU_BEAMFORMER_CAP  I    4    19
-V    RW    NP    
-LIM
-0    1    0
-V    RW    NP    
-LIM
-0    1    0
-
-*
-* MU Beamformee Capable
-* Riva does not support but pronto supports, default set to 0
-*
-WNI_CFG_VHT_MU_BEAMFORMEE_CAP  I    4    19
-V    RW    NP    
-LIM
-0    1    0
-V    RW    NP    
-LIM
-0    1    0
-
-*
-* VHT TXOP PS
-* Riva does not support but pronto supports, default set to 0
-*
-WNI_CFG_VHT_TXOP_PS  I    4    19
-V    RW    NP    
-LIM
-0    1    0
-V    RW    NP    
-LIM
-0    1    0
-
-*
-* +HTC-VHT Capable
-* Riva does not support but pronto supports, default set to 0
-*
-WNI_CFG_VHT_HTC_VHTC_CAP  I    4    19
-V    RW    NP    
-LIM
-0    1    0
-V    RW    NP    
-LIM
-0    1    0
-
-*
-* Maximum AMPDU Length exponent range 0-7
-* 2^(13+Max AMPDU Length)-1, default set to 0
-*
-WNI_CFG_VHT_AMPDU_LEN_EXPONENT  I    4    19
-V    RW    NP    
-LIM
-0    7    3
-V    RW    NP    
-LIM
-0    7    3
-
-*
-* VHT Link Adaptation Capable
-* Riva does not support but pronto supports, default set to 0
-*
-WNI_CFG_VHT_LINK_ADAPTATION_CAP  I    4    19
-V    RW    NP    
-LIM
-0    3    0
-V    RW    NP    
-LIM
-0    3    0
-
-*
-* VHT Rx Antenna Pattern Consistency
-*
-WNI_CFG_VHT_RX_ANT_PATTERN  I    4    19
-V    RW    NP    
-LIM
-0    1    1
-V    RW    NP    
-LIM
-0    1    1
-
-*
-* VHT Tx Antenna Pattern Consistency
-*
-WNI_CFG_VHT_TX_ANT_PATTERN  I    4    19
-V    RW    NP    
-LIM
-0    1    1
-V    RW    NP    
-LIM
-0    1    1
-
-*
-* RxMCS Map is 16 bits, The 2bit Max MCS for n SS field.
-* Indicates the maximum MCS that can be received for each
-* number of spacial streams. Riva supports MCS 0-9
-*
-WNI_CFG_VHT_RX_MCS_MAP  I    4    19
-V    RW    NP    
-LIM
-0    0xFFFF    0xFFFE
-V    RW    NP    
-LIM
-0    0xFFFF    0xFFFE
-
-* TxMCS Map is 16 bits, The 2bit Max MCS for n SS field.
-* Indicates the maximum MCS that can be transmitted for each
-* number of spacial streams.
-*
-WNI_CFG_VHT_TX_MCS_MAP  I    4    19
-V    RW    NP    
-LIM
-0    0xFFFF    0xFFFE
-V    RW    NP    
-LIM
-0    0xFFFF    0xFFFE
-
-*
-* Rx Highest supported data rate.
-*
-WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE  I    4    19
-V    RW    NP    
-LIM
-1    434   434
-V    RW    NP    
-LIM
-1    434   434
-
-*
-* Tx Highest supported data rate.
-*
-WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE  I    4    19
-V    RW    NP    
-LIM
-1    434    434
-V    RW    NP    
-LIM
-1    434    434
-
-*
-* VHT Operation Information
-* Channel Width set to zero for 20/40MHz.
-* set to 1 for 80MHz. 2->160Mhz, 3->80+80MHz
-*
-WNI_CFG_VHT_CHANNEL_WIDTH  I    4    19
-V    RW    NP    
-LIM
-0    3    0
-V    RW    NP    
-LIM
-0    3    0
-
-#ENUM 20_40MHZ       0
-#ENUM 80MHZ          1
-#ENUM 160MHZ         2
-#ENUM 80_PLUS_80MHZ  3
-*
-* Channel center freq Seg1 
-*
-WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1  I    4    19
-V    RW    NP    
-LIM
-0    256   0 
-V    RW    NP    
-LIM
-0    256   0
-
-*
-* Channel center freq Seg2 for 80+80 Mhz
-*
-WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2  I    4    19
-V    RW    NP    
-LIM
-0    0     0 
-V    RW    NP    
-LIM
-0    0     0
-
-*
-* Basic MCS Set
-*
-WNI_CFG_VHT_BASIC_MCS_SET  I    4    19
-V    RW    NP    
-LIM
-0    3     0 
-V    RW    NP    
-LIM
-0    3     0
-
-*
-* MU-MIMO Capable STA Count
-*
-WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT  I    4    19
-V    RW    NP    
-LIM
-0     4    0 
-V    RW    NP    
-LIM
-0     4     0
-
-*
-* Spatial Stream Under-Utilization
-*
-WNI_CFG_VHT_SS_UNDER_UTIL  I    4    19
-V    RW    NP    
-LIM
-0     0    0 
-V    RW    NP    
-LIM
-0     0     0
-
-*
-* Forty MHZ Utilization
-*
-WNI_CFG_VHT_40MHZ_UTILIZATION  I    4    19
-V    RW    NP    
-LIM
-0     0    0 
-V    RW    NP    
-LIM
-0     0     0
-
-*
-* Eighty MHz Utilization
-*
-WNI_CFG_VHT_80MHZ_UTILIZATION  I    4    19
-V    RW    NP    
-LIM
-0     0    0 
-V    RW    NP    
-LIM
-0     0     0
-
-*
-* Hundred Sixty MHz Utilization
-*
-WNI_CFG_VHT_160MHZ_UTILIZATION  I    4    19
-V    RW    NP    
-LIM
-0     0    0 
-V    RW    NP    
-LIM
-0     0     0
 
 *
 * Maximum AMSDU length
@@ -4394,16 +3999,3 @@
 V    RW    NP
 HAL
 1    255    20
-
-*
-* MC Addr List power control will be enabled if value is set to 1
-* 
-*
-*
-WNI_CFG_ENABLE_MC_ADDR_LIST  I   4   0
-V    RW    NP
-HAL
-0    1     0
-V    RW    NP
-HAL
-0    1     0
diff --git a/drivers/staging/prima/CORE/MAC/src/cfg/polFile.h b/drivers/staging/prima/CORE/MAC/src/cfg/polFile.h
index 7800b87..68e673c 100644
--- a/drivers/staging/prima/CORE/MAC/src/cfg/polFile.h
+++ b/drivers/staging/prima/CORE/MAC/src/cfg/polFile.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/dph/dphHashTable.c b/drivers/staging/prima/CORE/MAC/src/dph/dphHashTable.c
index f6bc4ff..73791f6 100644
--- a/drivers/staging/prima/CORE/MAC/src/dph/dphHashTable.c
+++ b/drivers/staging/prima/CORE/MAC/src/dph/dphHashTable.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/dph/dphHashTable.h b/drivers/staging/prima/CORE/MAC/src/dph/dphHashTable.h
index b671112..af40d3b 100644
--- a/drivers/staging/prima/CORE/MAC/src/dph/dphHashTable.h
+++ b/drivers/staging/prima/CORE/MAC/src/dph/dphHashTable.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/include/cfgApi.h b/drivers/staging/prima/CORE/MAC/src/include/cfgApi.h
index f277e07..7820782 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/cfgApi.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/cfgApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/include/cfgGlobal.h b/drivers/staging/prima/CORE/MAC/src/include/cfgGlobal.h
index 7824d8c..9956dc4 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/cfgGlobal.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/cfgGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/include/dot11f.h b/drivers/staging/prima/CORE/MAC/src/include/dot11f.h
index d04fa7d..7fe0dc4 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/dot11f.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/dot11f.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -35,7 +35,7 @@
   *
   *
   * This file was automatically generated by 'framesc'
-  * Fri Aug 17 13:25:06 2012 from the following file(s):
+  * Tue May 15 13:12:01 2012 from the following file(s):
   *
   * dot11f.frms
   * 
@@ -5005,113 +5005,6 @@
 #ifdef __cplusplus
 }; /* End extern "C". */
 #endif /* C++ */
-// EID 191 (0xbf)
-typedef struct sDot11fIEVHTCaps {
-    tANI_U8      present;
-    tANI_U32       maxMPDULen: 2;
-    tANI_U32 supportedChannelWidthSet: 2;
-    tANI_U32    ldpcCodingCap: 1;
-    tANI_U32     shortGI80MHz: 1;
-    tANI_U32 shortGI160and80plus80MHz: 1;
-    tANI_U32           txSTBC: 1;
-    tANI_U32           rxSTBC: 3;
-    tANI_U32  suBeamFormerCap: 1;
-    tANI_U32  suBeamformeeCap: 1;
-    tANI_U32 csnofBeamformerAntSup: 3;
-    tANI_U32   numSoundingDim: 3;
-    tANI_U32  muBeamformerCap: 1;
-    tANI_U32  muBeamformeeCap: 1;
-    tANI_U32        vhtTXOPPS: 1;
-    tANI_U32        htcVHTCap: 1;
-    tANI_U32   maxAMPDULenExp: 3;
-    tANI_U32  vhtLinkAdaptCap: 2;
-    tANI_U32     rxAntPattern: 1;
-    tANI_U32     txAntPattern: 1;
-    tANI_U32        reserved1: 2;
-    tANI_U16     rxMCSMap;
-    tANI_U16 rxHighSupDataRate: 13;
-    tANI_U16        reserved2: 3;
-    tANI_U16     txMCSMap;
-    tANI_U16    txSupDataRate: 13;
-    tANI_U16        reserved3: 3;
-} tDot11fIEVHTCaps;
-
-#define DOT11F_EID_VHTCAPS ( 191 )
-
-// N.B. These #defines do *not* include the EID & length
-#define DOT11F_IE_VHTCAPS_MIN_LEN ( 12 )
-
-#define DOT11F_IE_VHTCAPS_MAX_LEN ( 12 )
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* C++ */
-tANI_U32 dot11fUnpackIeVHTCaps(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEVHTCaps*);
-
-tANI_U32 dot11fPackIeVHTCaps(tpAniSirGlobal, tDot11fIEVHTCaps*, tANI_U8*, tANI_U32, tANI_U32*);
-
-tANI_U32 dot11fGetPackedIEVHTCaps(tpAniSirGlobal, tDot11fIEVHTCaps*, tANI_U32*);
-
-#ifdef __cplusplus
-}; /* End extern "C". */
-#endif /* C++ */
-// EID 193 (0xc1)
-typedef struct sDot11fIEVHTExtBssLoad {
-    tANI_U8      present;
-    tANI_U8      muMIMOCapStaCount;
-    tANI_U8      ssUnderUtil;
-    tANI_U8      FortyMHzUtil;
-    tANI_U8      EightyMHzUtil;
-    tANI_U8      OneSixtyMHzUtil;
-} tDot11fIEVHTExtBssLoad;
-
-#define DOT11F_EID_VHTEXTBSSLOAD ( 193 )
-
-// N.B. These #defines do *not* include the EID & length
-#define DOT11F_IE_VHTEXTBSSLOAD_MIN_LEN ( 5 )
-
-#define DOT11F_IE_VHTEXTBSSLOAD_MAX_LEN ( 5 )
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* C++ */
-tANI_U32 dot11fUnpackIeVHTExtBssLoad(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEVHTExtBssLoad*);
-
-tANI_U32 dot11fPackIeVHTExtBssLoad(tpAniSirGlobal, tDot11fIEVHTExtBssLoad*, tANI_U8*, tANI_U32, tANI_U32*);
-
-tANI_U32 dot11fGetPackedIEVHTExtBssLoad(tpAniSirGlobal, tDot11fIEVHTExtBssLoad*, tANI_U32*);
-
-#ifdef __cplusplus
-}; /* End extern "C". */
-#endif /* C++ */
-// EID 192 (0xc0)
-typedef struct sDot11fIEVHTOperation {
-    tANI_U8      present;
-    tANI_U8      chanWidth;
-    tANI_U8      chanCenterFreqSeg1;
-    tANI_U8      chanCenterFreqSeg2;
-    tANI_U16     basicMCSSet;
-} tDot11fIEVHTOperation;
-
-#define DOT11F_EID_VHTOPERATION ( 192 )
-
-// N.B. These #defines do *not* include the EID & length
-#define DOT11F_IE_VHTOPERATION_MIN_LEN ( 5 )
-
-#define DOT11F_IE_VHTOPERATION_MAX_LEN ( 5 )
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* C++ */
-tANI_U32 dot11fUnpackIeVHTOperation(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEVHTOperation*);
-
-tANI_U32 dot11fPackIeVHTOperation(tpAniSirGlobal, tDot11fIEVHTOperation*, tANI_U8*, tANI_U32, tANI_U32*);
-
-tANI_U32 dot11fGetPackedIEVHTOperation(tpAniSirGlobal, tDot11fIEVHTOperation*, tANI_U32*);
-
-#ifdef __cplusplus
-}; /* End extern "C". */
-#endif /* C++ */
 // EID 68 (0x44)
 typedef struct sDot11fIEWAPI {
     tANI_U8      present;
@@ -5198,32 +5091,6 @@
 #ifdef __cplusplus
 }; /* End extern "C". */
 #endif /* C++ */
-// EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x0a}
-typedef struct sDot11fIEWFDIEOpaque {
-    tANI_U8      present;
-    tANI_U8      num_data;
-    tANI_U8      data[249];
-} tDot11fIEWFDIEOpaque;
-
-#define DOT11F_EID_WFDIEOPAQUE ( 221 )
-
-// N.B. These #defines do *not* include the EID & length
-#define DOT11F_IE_WFDIEOPAQUE_MIN_LEN ( 6 )
-
-#define DOT11F_IE_WFDIEOPAQUE_MAX_LEN ( 253 )
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* C++ */
-tANI_U32 dot11fUnpackIeWFDIEOpaque(tpAniSirGlobal, tANI_U8*,tANI_U8, tDot11fIEWFDIEOpaque*);
-
-tANI_U32 dot11fPackIeWFDIEOpaque(tpAniSirGlobal, tDot11fIEWFDIEOpaque*, tANI_U8*, tANI_U32, tANI_U32*);
-
-tANI_U32 dot11fGetPackedIEWFDIEOpaque(tpAniSirGlobal, tDot11fIEWFDIEOpaque*, tANI_U32*);
-
-#ifdef __cplusplus
-}; /* End extern "C". */
-#endif /* C++ */
 // EID 221 (0xdd) {OUI 0x00, 0x50, 0xf2, 0x02, 0x05}
 typedef struct sDot11fIEWMMCaps {
     tANI_U8      present;
@@ -5869,8 +5736,6 @@
     tDot11fIECCXRadMgmtCap  CCXRadMgmtCap;
     tDot11fIECCXVersion     CCXVersion;
     tDot11fIEP2PIEOpaque    P2PIEOpaque;
-    tDot11fIEWFDIEOpaque    WFDIEOpaque;
-    tDot11fIEVHTCaps        VHTCaps;
 } tDot11fAssocRequest;
 
 #define DOT11F_ASSOCREQUEST ( 5 )
@@ -5914,8 +5779,6 @@
     tDot11fIEAirgo          Airgo;
     tDot11fIEWscAssocRes    WscAssocRes;
     tDot11fIEP2PAssocRes    P2PAssocRes;
-    tDot11fIEVHTCaps        VHTCaps;
-    tDot11fIEVHTOperation   VHTOperation;
 } tDot11fAssocResponse;
 
 #define DOT11F_ASSOCRESPONSE ( 6 )
@@ -6000,9 +5863,6 @@
     tDot11fIEAirgo            Airgo;
     tDot11fIEWscBeacon        WscBeacon;
     tDot11fIEP2PBeacon        P2PBeacon;
-    tDot11fIEVHTCaps          VHTCaps;
-    tDot11fIEVHTOperation     VHTOperation;
-    tDot11fIEVHTExtBssLoad    VHTExtBssLoad;
 } tDot11fBeacon;
 
 #define DOT11F_BEACON ( 8 )
@@ -6070,9 +5930,6 @@
     tDot11fIECCXTrafStrmMet   CCXTrafStrmMet;
     tDot11fIECCXTxmitPower    CCXTxmitPower;
     tDot11fIEP2PBeacon        P2PBeacon;
-    tDot11fIEVHTCaps          VHTCaps;
-    tDot11fIEVHTOperation     VHTOperation;
-    tDot11fIEVHTExtBssLoad    VHTExtBssLoad;
 } tDot11fBeacon2;
 
 #define DOT11F_BEACON2 ( 10 )
@@ -6128,9 +5985,6 @@
     tDot11fIEAirgo             Airgo;
     tDot11fIEWscBeaconProbeRes WscBeaconProbeRes;
     tDot11fIEP2PBeaconProbeRes P2PBeaconProbeRes;
-    tDot11fIEVHTCaps           VHTCaps;
-    tDot11fIEVHTOperation      VHTOperation;
-    tDot11fIEVHTExtBssLoad     VHTExtBssLoad;
 } tDot11fBeaconIEs;
 
 #define DOT11F_BEACONIES ( 11 )
@@ -6644,7 +6498,6 @@
     tDot11fIEWscProbeReq   WscProbeReq;
     tDot11fIEWFATPC        WFATPC;
     tDot11fIEP2PProbeReq   P2PProbeReq;
-    tDot11fIEVHTCaps       VHTCaps;
 } tDot11fProbeRequest;
 
 #define DOT11F_PROBEREQUEST ( 34 )
@@ -6700,9 +6553,6 @@
     tDot11fIEAirgo            Airgo;
     tDot11fIEWscProbeRes      WscProbeRes;
     tDot11fIEP2PProbeRes      P2PProbeRes;
-    tDot11fIEVHTCaps          VHTCaps;
-    tDot11fIEVHTOperation     VHTOperation;
-    tDot11fIEVHTExtBssLoad    VHTExtBssLoad;
 } tDot11fProbeResponse;
 
 #define DOT11F_PROBERESPONSE ( 35 )
@@ -6840,8 +6690,6 @@
     tDot11fIEWMMTSPEC           WMMTSPEC[4];
     tDot11fIECCXTrafStrmRateSet CCXTrafStrmRateSet;
     tDot11fIEP2PIEOpaque        P2PIEOpaque;
-    tDot11fIEWFDIEOpaque        WFDIEOpaque;
-    tDot11fIEVHTCaps            VHTCaps;
 } tDot11fReAssocRequest;
 
 #define DOT11F_REASSOCREQUEST ( 40 )
@@ -6886,8 +6734,6 @@
     tDot11fIEAirgo              Airgo;
     tDot11fIEWscReassocRes      WscReassocRes;
     tDot11fIEP2PAssocRes        P2PAssocRes;
-    tDot11fIEVHTCaps            VHTCaps;
-    tDot11fIEVHTOperation       VHTOperation;
 } tDot11fReAssocResponse;
 
 #define DOT11F_REASSOCRESPONSE ( 41 )
diff --git a/drivers/staging/prima/CORE/MAC/src/include/dphGlobal.h b/drivers/staging/prima/CORE/MAC/src/include/dphGlobal.h
index 01a4ab4..56e5ed9 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/dphGlobal.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/dphGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -21,638 +21,352 @@
 
 /*
  *
-
  * Airgo Networks, Inc proprietary. All rights reserved.
  * Author:      Sandesh Goel
-
  * Date:        02/25/02
-
  * History:-
-
  * Date            Modified by    Modification Information
-
  * --------------------------------------------------------------------
-
  *
-
  */
 
-
 #ifndef __DPH_GLOBAL_H__
-
 #define __DPH_GLOBAL_H__
 
-
 #include "limGlobal.h"
-
 //#include "parserApi.h"
-
 #include "sirMacProtDef.h"
-
 #include "sirMacPropExts.h"
-
 #include "sirApi.h"
 
-
 /// Following determines whether statistics are maintained or not
-
 #define DPH_STATS
 
-
 /// traffic category not allowed
-
 #define DPH_TID_NOTALLOWED           0xFF
 
-
 /// Periodicity of invocation of rate adaptation (in ms)
-
 #define DPH_RATE_ADAPTATION_PERIOD     20
 
-
 // Rate indices
-
 #define DPH_PHY_RATE_1_INDEX     0
-
 #define DPH_PHY_RATE_2_INDEX     1
-
 #define DPH_PHY_RATE_5_5_INDEX   2
-
 #define DPH_PHY_RATE_11_INDEX    3
-
 #define DPH_PHY_RATE_6_INDEX     4
-
 #define DPH_PHY_RATE_9_INDEX     5
-
 #define DPH_PHY_RATE_12_INDEX    6
-
 #define DPH_PHY_RATE_18_INDEX    7
-
 #define DPH_PHY_RATE_24_INDEX    8
-
 #define DPH_PHY_RATE_36_INDEX    9
-
 #define DPH_PHY_RATE_48_INDEX   10
-
 #define DPH_PHY_RATE_54_INDEX   11
-
 #define DPH_PHY_RATE_72_INDEX   12
-
 #define DPH_PHY_RATE_96_INDEX   13
-
 #define DPH_PHY_RATE_108_INDEX  14
-
 #define DPH_PHY_RATE_144_INDEX  15
-
 #define DPH_PHY_RATE_MAX_INDEX  16
 
-
 /// Maximum time to wait for a management packet to go out (ms)
-
 #define DPH_MAX_MGMT_WAIT_TIME  10000
 
-
 /// Step size for the wait time histogram (ms)
-
 #define DPH_WAIT_HIST_STEP 20
 
-
 /// Number of entries in wait time histogram
-
 #define DPH_WAIT_HIST_SIZE  100
 
-
 /// TCID for Management & Keep Alive Mgmt frames
-
 #define DPH_MGMT_TCID                      4
-
 #define DPH_KEEPALIVE_PROBE_RESPONSE_TCID  0
 
-
 /// STAID for Management frames
-
 #define DPH_USE_MGMT_STAID  -1
 
-
 // Keep Alive frames
-
 #define DPH_NON_KEEPALIVE_FRAME  0
-
 #define DPH_KEEPALIVE_FRAME      1
 
-
 /// Mask for subtype, type, protocol version, order and wep fields in the mac frame control
-
 #define DPH_FC_BD_FILL_MASK  0xFFCC
 
-
 /// Enable/Disable Txop generation in TFP for HCF mode
-
 #define DPH_ENABLE_HCF_TXOP_GEN_AT_TFP   0x00
-
 #define DPH_DISABLE_HCF_TXOP_GEN_AT_TFP  0x02
 
-
 /// Enable/Disable Txop generation in TFP for EDCF mode
-
 #define DPH_ENABLE_EDCF_TXOP_GEN_AT_TFP   0x00
-
 #define DPH_DISABLE_EDCF_TXOP_GEN_AT_TFP  0x01
 
-
 #define DPH_DUMP_ALL_STA_ID     -1
-
 #define DPH_DUMP_RX_BD           0
-
 #define DPH_DUMP_TX_BD           1
-
 #define DPH_DUMP_TX_MGMT_BD      2
 
-
 //DPH Hash Index for BSS(STA's Peer) on station.
-
 #define DPH_STA_HASH_INDEX_PEER   1
 
-
 typedef struct sDphRateBasedCtr
-
 {
-
     tANI_U32 hi;
-
     tANI_U32 lo;
-
 } tDphRateBasedCtr;
 
-
 typedef struct sDphPhyRates
-
 {
-
     tANI_U8 dataRateX2;
-
     tANI_U8 ackRateX2;
-
     tANI_U8 rtsRateX2;
-
 } tDphPhyRates;
 
-
 typedef struct sDphIFSValues
-
 {
-
     tANI_U8 sifs;
-
     tANI_U8 pifs;
-
     tANI_U8 difs;
-
     tANI_U8 preamble;
-
 } tDphIFSValues;
 
-
 typedef struct sDphQosParams
-
 {
-
     tANI_U8                   addtsPresent;
-
     tSirAddtsReqInfo       addts;
-
     tSirMacQosCapabilityStaIE capability;
-
 } tDphQosParams;
 
-
 /// Queue attribute structure
-
 typedef struct sDphQueueAttr
-
 {
-
     tANI_U16     valid : 1;
-
     tANI_U16     seqNum : 12;
-
     tANI_U16     ackPolicy : 2;
-
     tANI_U16     rsvd : 1;
-
 } tDphQueueAttr, *tpDphQueueAttr;
 
-
 #if defined( FEATURE_WLAN_INTEGRATED_SOC )
-
 typedef struct sCfgTrafficClass {
-
     //Use Block ACK on this STA/TID
-
     // Fields used to store the default TC parameters for this TSPEC.
-
     // They will be used when the TSPEC is deleted.
-
     tANI_U8 fDisableTx:1;
-
     tANI_U8 fDisableRx:1;
-
     tANI_U8 fUseBATx:1;
-
     tANI_U8 fUseBARx:1;
 
-
     // 1: expect to see frames with compressed BA coming from this peer MAC
-
     tANI_U8 fRxCompBA:1;
-
     tANI_U8 fTxCompBA:1;
 
-
     // immediate ACK or delayed ACK for frames from this peer MAC
-
     tANI_U8 fRxBApolicy:1;
 
-
     // immediate ACK or delayed ACK for frames to this peer MAC
-
     tANI_U8 fTxBApolicy:1;
 
-
     //Initiator or recipient
-
     tANI_U8 role;
 
-
     //Max # of MSDU received from this STA, negotiated at ADDBA
-
     // used for maintaining block ack state info
-
     tANI_U16 rxBufSize;
 
-
     //Max # of MSDU send to this STA, negotiated at ADDBA
-
     tANI_U16 txBufSize;
 
-
     //BA timeout negotiated at ADDBA. Unit: TU
-
     tANI_U16 tuTxBAWaitTimeout; //Time for Tx to wait for BA. 0 means no timeout
 
-
     tANI_U16 tuRxBAWaitTimeout; //Time for Rx to wait for explicit/implicit BAR. 0 means no timeout
 
-
 } tCfgTrafficClass;
-
 #endif /* EATURE_WLAN_INTEGRATED_SOC */
 
-
 /// STA state node
-
 typedef struct sDphHashNode
-
 {
 
-
     //BYTE 0
-
     // HASH ENTRY FIELDS NOT NEEDED IN HAL.
-
     /// This STA valid or not
-
     tANI_U8   valid : 1;
-
     tANI_U8   encPolicy : 3;
-
     tANI_U8   defaultKey : 1;
-
     tANI_U8   defaultKeyId : 2;
-
     tANI_U8   qosMode : 1;
 
-
     //BYTE 1
-
     tANI_U8   erpEnabled : 1;
-
     tANI_U8   added : 1; // This has been added to the dph hash table
-
     tANI_U8   linkTestOn : 1;
-
     tANI_U8   shortPreambleEnabled : 1;
-
     tANI_U8   shortSlotTimeEnabled : 1;
-
     tANI_U8   stopTx:1;
-
     tANI_U8   wmeEnabled: 1; // set if both ap and sta are wme capable
-
     tANI_U8   lleEnabled: 1; // set if both ap and sta are 11e capable
 
-
     //BYTE 2
-
     tANI_U8   wsmEnabled: 1; // set if both ap and sta are wsm capable
-
     tANI_U8   versionPresent:1; // station gave version info
-
     tANI_U8   burstEnableForce:1; // allow bursting regardless of qosMode
-
     tANI_U8   staAuthenticated:1;    
-
     /// Whether the peer is ANI or not
-
     tANI_U8  aniPeer:1;
-
     tANI_U8   titanPeer:1;                // flag to indicate if its a titan peer    
-
     tANI_U8  fAniCount:1;
-
 #if (WNI_POLARIS_FW_PRODUCT == AP)
-
     tANI_U8   hcfEnabled : 1;
-
 #else
-
     tANI_U8   rsvd:1;
-
 #endif
 
-
     /// Fragmentation size
-
     tANI_U16   fragSize;
 
-
     /// LIM state
-
     tLimMlmStaContext mlmStaContext;
 
-
     /// Number of Tim to wait if the STA doesn't respond / fetch data
-
     tANI_U8  timWaitCount;
 
-
     /// Number of Successfull MPDU's being sent
-
     tANI_U32    curTxMpduCnt;
 
 
-
-
     /// number of consecutive TIMs sent without response
-
     tANI_U8  numTimSent;
 
-
     // qos parameter info
-
     tDphQosParams  qos;
 
-
     // station version info - valid only if versionPresent is set
-
     tSirMacPropVersion version;
-
     // station proprietary capability
-
     tANI_U16                propCapability;
 
-
 #ifdef PLM_WDS
-
     tANI_U8  wdsIndex;
-
     tANI_U8  wdsPeerBeaconSeen;
-
 #endif
 
-
    //Taurus capabilities
-
    tANI_U16 baPolicyFlag;                 //BA Policy for each TID. 
 
-
     /*
-
     * All the legacy and airgo supported rates.
-
     */
-
     tSirSupportedRates supportedRates;
 
-
     tANI_U8 htGreenfield:1;
-
     tANI_U8 htShortGI40Mhz:1;
-
     tANI_U8 htShortGI20Mhz:1;
-
     // DSSS/CCK at 40 MHz: Enabled 1 or Disabled
-
     tANI_U8 htDsssCckRate40MHzSupport:1;
-
     // L-SIG TXOP Protection used only if peer support available
-
     tANI_U8 htLsigTXOPProtection:1;
-
     // A-MPDU Density
-
     // 000 - No restriction
-
     // 001 - 1/8 usec
-
     // 010 - 1/4 usec
-
     // 011 - 1/2 usec
-
     // 100 - 1 usec
-
     // 101 - 2 usec
-
     // 110 - 4 usec
-
     // 111 - 8 usec
-
     //
-
     tANI_U8 htAMpduDensity:3;
 
 
-
-
     //Set to 0 for 3839 octets
-
     //Set to 1 for 7935 octets
-
     tANI_U8 htMaxAmsduLength;
 
 
-
-
     // MIMO Power Save
-
     tSirMacHTMIMOPowerSaveState htMIMOPSState;
 
-
     //
 
-
     // Maximum Rx A-MPDU factor
-
     tANI_U8 htMaxRxAMpduFactor:2;
-
     //
-
     // Recommended Tx Width Set
-
     // 0 - use 20 MHz channel (control channel)
-
     // 1 - use 40 Mhz channel
-
     //
-
     tANI_U8 htSupportedChannelWidthSet:1;
-    tANI_U8 htSecondaryChannelOffset:2;
-    tANI_U8 rsvd1:3;
-
+    tANI_U8 rsvd1:5;
 
     ///////////////////////////////////////////////////////////////////////
-
     // DPH HASH ENTRY FIELDS NEEDED IN HAL ONLY
-
     ///////////////////////////////////////////////////////////////////////
-
     tANI_U8 dpuSig:4;                       // DPU signiture
-
     tANI_U8 staSig:4;                       // STA signature
-
     tANI_U8 staType;
 
-
     tANI_U16 bssId;                          // BSSID
-
     tANI_U16 assocId;                       // Association ID
 
 
-
-
     //This is the real sta index generated by HAL
-
     tANI_U16 staIndex;
-
     tANI_U8    staAddr[6];
-
     /*The DPU signatures will be sent eventually to TL to help it determine the 
-
       association to which a packet belongs to*/
-
     /*Unicast DPU signature*/
-
     tANI_U8     ucUcastSig;
 
-
     /*Broadcast DPU signature*/
-
     tANI_U8     ucBcastSig;
 
-
     //
-
     // PE needs this info on a per-STA, per-TID basis
-
     // At any point in time, when this data is sampled,
-
     // it gives a measure of:
-
     // a) All the active bA sessions
-
     // b) And the BA configuration itself
-
     //
-
     tCfgTrafficClass tcCfg[STACFG_MAX_TC];
 
-
     // Block Ack state
-
     // This is used between PE and HAL only.
-
     // can be set to one of the values from the following enum
-
     /*typedef enum eLimBAState
-
     {
-
         eLIM_BA_STATE_IDLE, // we are not waiting for anything from HAL.
-
         eLIM_BA_STATE_WT_ADD_RSP, //We are waiting for Add rsponse from HAL.
-
         eLIM_BA_STATE_WT_DEL_RSP //  We are waiting for Del response from HAL.
-
     } tLimBAState; */
 
 
-
-
     //BA state bitmap 2 bits per tid
-
     // BA state for tid i  = (baState >> tid*2) & 0x3
-
     tANI_U32 baState;
 
-#ifdef WLAN_FEATURE_11AC
-    tANI_U8  vhtSupportedChannelWidthSet;
-#endif
-
     /* When a station with already an existing dph entry tries to 
-
      * associate again, the old dph entry will be zeroed out except 
-
      * for the next pointer. The next pointer must be defined at the  
-
      * end of the structure.
-
      */
-
     struct sDphHashNode  *next;
 
-
 } tDphHashNode, *tpDphHashNode;
 
-
 #include "dphHashTable.h"
 
-
 // -------------------------------------------------------------------
 
-
 // get protection overrides from config variable
-
 // bit0: force cts to self protection for tx to Airgo peers
-
 // bit1: force cts to self protection for tx to non Airgo peers
-
 #define DPH_PROT_OVERRIDE_NONANI_PEER_GET(cfgval)    ((cfgval) & 1)
-
 #define DPH_PROT_OVERRIDE_ANI_PEER_GET(cfgval) (((cfgval) & 2) >> 1)
 
-
 typedef struct sAniSirDph
-
 {
-
     /// The hash table object
-
     dphHashTableClass dphHashTable;
-
 } tAniSirDph, *tpAniSirDph;
 
-
 #endif
 
 
-
-
diff --git a/drivers/staging/prima/CORE/MAC/src/include/parserApi.h b/drivers/staging/prima/CORE/MAC/src/include/parserApi.h
index 6716251..ac63e09 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/parserApi.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/parserApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -124,12 +124,6 @@
     tANI_U8                   mdiePresent;
 #endif
 
-#ifdef WLAN_FEATURE_11AC
-    tDot11fIEVHTCaps          VHTCaps;
-    tDot11fIEVHTOperation     VHTOperation;
-    tDot11fIEVHTExtBssLoad    VHTExtBssLoad;
-#endif
-
 } tSirProbeRespBeacon, *tpSirProbeRespBeacon;
 
 // probe Request structure
@@ -145,10 +139,6 @@
     tANI_U8                   extendedRatesPresent;
     tANI_U8                   wscIePresent;
     tANI_U8                   p2pIePresent;
-#ifdef WLAN_FEATURE_11AC
-    tDot11fIEVHTCaps          VHTCaps;
-#endif
-
 
 } tSirProbeReq, *tpSirProbeReq;
 
@@ -201,9 +191,6 @@
     tANI_U32                  assocReqFrameLength;
     tANI_U8*                  assocReqFrame;
 #endif
-#ifdef WLAN_FEATURE_11AC
-    tDot11fIEVHTCaps          VHTCaps;
-#endif
 } tSirAssocReq, *tpSirAssocReq;
 
 
@@ -251,10 +238,6 @@
     tANI_U8                   tspecPresent;
     tANI_U8                   tsmPresent;
 #endif    
-#ifdef WLAN_FEATURE_11AC
-    tDot11fIEVHTCaps          VHTCaps;
-    tDot11fIEVHTOperation     VHTOperation;
-#endif
 } tSirAssocRsp, *tpSirAssocRsp;
 
 tANI_U8
@@ -440,14 +423,12 @@
 /// Populate a tDot11fIEChanSwitchAnn
 void
 PopulateDot11fChanSwitchAnn(tpAniSirGlobal          pMac,
-                            tDot11fIEChanSwitchAnn *pDot11f,
-                            tpPESession psessionEntry);
+                            tDot11fIEChanSwitchAnn *pDot11f);
 
 /// Populate a tDot11fIEChanSwitchAnn
 void
 PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal          pMac,
-                             tDot11fIEExtChanSwitchAnn *pDot11f,
-                             tpPESession psessionEntry);
+                             tDot11fIEExtChanSwitchAnn *pDot11f);
 
 /// Populate a tDot11fIECountry
 tSirRetStatus
@@ -517,8 +498,7 @@
 
 tSirRetStatus
 PopulateDot11fHTCaps(tpAniSirGlobal           pMac,
-                           tpPESession      psessionEntry,
-                           tDot11fIEHTCaps *pDot11f);
+                             tDot11fIEHTCaps *pDot11f);
 
 #ifdef WLAN_SOFTAP_FEATURE
 tSirRetStatus
@@ -863,15 +843,3 @@
                            tpSirRSNie pRsnIe,
                            tANI_U8 EID);
 #endif
-
-#ifdef WLAN_FEATURE_11AC
-tSirRetStatus
-PopulateDot11fVHTCaps(tpAniSirGlobal  pMac, tDot11fIEVHTCaps *pDot11f);
-
-tSirRetStatus
-PopulateDot11fVHTOperation(tpAniSirGlobal  pMac, tDot11fIEVHTOperation  *pDot11f);
-
-tSirRetStatus
-PopulateDot11fVHTExtBssLoad(tpAniSirGlobal  pMac, tDot11fIEVHTExtBssLoad   *pDot11f);
-
-#endif
diff --git a/drivers/staging/prima/CORE/MAC/src/include/phyGlobal.h b/drivers/staging/prima/CORE/MAC/src/include/phyGlobal.h
index 27cad41..60dafcf 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/phyGlobal.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/phyGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/include/sirCommon.h b/drivers/staging/prima/CORE/MAC/src/include/sirCommon.h
index 7ff6279..cc8737f 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/sirCommon.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/sirCommon.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/include/sirDebug.h b/drivers/staging/prima/CORE/MAC/src/include/sirDebug.h
index 93ea8f8..e1680d3 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/sirDebug.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/sirDebug.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -126,7 +126,4 @@
 #define FL(x)    "%s: %d: "\
                  x, __FUNCTION__, __LINE__
 
-#define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
-#define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
-
 #endif
diff --git a/drivers/staging/prima/CORE/MAC/src/include/sirParams.h b/drivers/staging/prima/CORE/MAC/src/include/sirParams.h
index badcc3e..d26b9a9 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/sirParams.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/sirParams.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -49,34 +49,13 @@
 #if defined( FEATURE_WLAN_INTEGRATED_SOC )
 typedef enum
 {
-    PHY_SINGLE_CHANNEL_CENTERED     = 0,        // 20MHz IF bandwidth centered on IF carrier
-    PHY_DOUBLE_CHANNEL_LOW_PRIMARY  = 1,        // 40MHz IF bandwidth with lower 20MHz supporting the primary channel
-    PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3,        // 40MHz IF bandwidth with higher 20MHz supporting the primary channel
-#ifdef WLAN_FEATURE_11AC    
-    PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED = 4, //20/40MHZ offset LOW 40/80MHZ offset CENTERED
-    PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED = 5, //20/40MHZ offset CENTERED 40/80MHZ offset CENTERED
-    PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED = 6, //20/40MHZ offset HIGH 40/80MHZ offset CENTERED
-    PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW = 7,//20/40MHZ offset LOW 40/80MHZ offset LOW
-    PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW = 8, //20/40MHZ offset HIGH 40/80MHZ offset LOW
-    PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH = 9, //20/40MHZ offset LOW 40/80MHZ offset HIGH
-    PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH = 10,//20/40MHZ offset-HIGH 40/80MHZ offset HIGH
-#endif
-    PHY_CHANNEL_BONDING_STATE_MAX   = 11
+    PHY_SINGLE_CHANNEL_CENTERED = 0,        // 20MHz IF bandwidth centered on IF carrier
+    PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1,     // 40MHz IF bandwidth with lower 20MHz supporting the primary channel
+    //not allowed PHY_DOUBLE_CHANNEL_CENTERED = 2,        // 40MHz IF bandwidth centered on IF carrier
+    PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3     // 40MHz IF bandwidth with higher 20MHz supporting the primary channel
 }ePhyChanBondState;
 #endif /* FEATURE_WLAN_INTEGRATED_SOC */
 
-#define SIR_MIN(a,b)   (((a) < (b)) ? (a) : (b))
-#define SIR_MAX(a,b)   (((a) > (b)) ? (a) : (b))
-
-typedef enum {
-   MCC	   = 0,
-   P2P	   = 1,
-   DOT11AC = 2,
-   SLM_SESSIONIZATION = 3,
-   DOT11AC_OPMODE = 4,
-   MAX_FEATURE_SUPPORTED = 128,
-} placeHolderInCapBitmap;
-
 typedef enum eSriLinkState {
     eSIR_LINK_IDLE_STATE        = 0,
     eSIR_LINK_PREASSOC_STATE    = 1,
@@ -538,10 +517,6 @@
 
 #define SIR_HAL_SET_TM_LEVEL_REQ           SIR_HAL_ITC_MSG_TYPES_BEGIN + 187
 
-#ifdef WLAN_FEATURE_11AC
-#define SIR_HAL_UPDATE_OP_MODE             SIR_HAL_ITC_MSG_TYPES_BEGIN + 188
-#endif
-
 #define SIR_HAL_MSG_TYPES_END              SIR_HAL_ITC_MSG_TYPES_BEGIN + 0xFF
 // CFG message types
 #define SIR_CFG_MSG_TYPES_BEGIN        (SIR_CFG_MODULE_ID << 8)
@@ -553,10 +528,10 @@
 // LIM message types
 #define SIR_LIM_MSG_TYPES_BEGIN        (SIR_LIM_MODULE_ID << 8)
 #define SIR_LIM_ITC_MSG_TYPES_BEGIN    SIR_LIM_MSG_TYPES_BEGIN+0xB0
-
 // Messages to/from HAL
-// Removed as part of moving HAL down to FW
-
+#define SIR_LIM_RESUME_ACTIVITY_NTF        SIR_LIM_ITC_MSG_TYPES_BEGIN
+#define SIR_LIM_SUSPEND_ACTIVITY_REQ       SIR_LIM_ITC_MSG_TYPES_BEGIN + 1
+#define SIR_HAL_SUSPEND_ACTIVITY_RSP       SIR_LIM_ITC_MSG_TYPES_BEGIN + 2
 // Message from ISR upon TFP retry interrupt
 #define SIR_LIM_RETRY_INTERRUPT_MSG        SIR_LIM_ITC_MSG_TYPES_BEGIN + 3
 // Message from BB Transport
diff --git a/drivers/staging/prima/CORE/MAC/src/include/sirWrapper.h b/drivers/staging/prima/CORE/MAC/src/include/sirWrapper.h
index 4517733..fb03d3e 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/sirWrapper.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/sirWrapper.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -20,7 +20,7 @@
  */
 
 /*
- * Airgo Networks, Inc proprietary. All rights reserved.
+ * Qualcomm Networks, Inc proprietary. All rights reserved.
  * This file sirWrapper.h contains the common definitions used by all
  * Firmware modules.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/include/sysGlobal.h b/drivers/staging/prima/CORE/MAC/src/include/sysGlobal.h
index d69e3ac..24ffaa6 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/sysGlobal.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/sysGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/include/utilsApi.h b/drivers/staging/prima/CORE/MAC/src/include/utilsApi.h
index 3cece2d..f8b71dd 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/utilsApi.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/utilsApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/include/utilsGlobal.h b/drivers/staging/prima/CORE/MAC/src/include/utilsGlobal.h
index 1e93d2a..3006082 100644
--- a/drivers/staging/prima/CORE/MAC/src/include/utilsGlobal.h
+++ b/drivers/staging/prima/CORE/MAC/src/include/utilsGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/limAdmitControl.h b/drivers/staging/prima/CORE/MAC/src/pe/include/limAdmitControl.h
index 2de2866..158a94a 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/limAdmitControl.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/limAdmitControl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -92,7 +92,7 @@
 tSirRetStatus limAdmitControlInit(tpAniSirGlobal pMac);
 
 tSirRetStatus limSendHalMsgAddTs(tpAniSirGlobal pMac, tANI_U16 staIdx, tANI_U8 tspecIdx, tSirMacTspecIE tspecIE, tANI_U8 sessionId);
-tSirRetStatus limSendHalMsgDelTs(tpAniSirGlobal pMac,  tANI_U16 staIdx,  tANI_U8 tspecIdx,  tSirDeltsReqInfo delts, tANI_U8 sessionId);
+tSirRetStatus limSendHalMsgDelTs(tpAniSirGlobal pMac,  tANI_U16 staIdx,  tANI_U8 tspecIdx,  tSirDeltsReqInfo delts);
 void limProcessHalAddTsRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg);
 
 #endif
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/limApi.h b/drivers/staging/prima/CORE/MAC/src/pe/include/limApi.h
index ef3ffba..e0f2a4d 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/limApi.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/limApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,7 @@
  */
 #ifndef __LIM_API_H
 #define __LIM_API_H
+
 #include "wniApi.h"
 #include "sirApi.h"
 #include "aniGlobal.h"
@@ -50,12 +51,17 @@
 #include "wlan_qct_wdi_ds.h"
 #endif
 #include "wlan_qct_wda.h"
+
 #define LIM_POL_SYS_SCAN_MODE      0
 #define LIM_POL_SYS_LEARN_MODE     1
 
+
 /* Macro to count heartbeat */
+
 #define limResetHBPktCount(psessionEntry)   (psessionEntry->LimRxedBeaconCntDuringHB = 0)
 
+
+
 /* Useful macros for fetching various states in pMac->lim */
 /* gLimSystemRole */
 #define GET_LIM_SYSTEM_ROLE(psessionEntry)      (psessionEntry->limSystemRole)
@@ -74,7 +80,9 @@
 /* gLimQuietState */
 #define GET_LIM_QUIET_STATE(pMac)               (pMac->lim.gLimSpecMgmt.quietState)
 #define SET_LIM_QUIET_STATE(pMac, state)        (pMac->lim.gLimSpecMgmt.quietState = state)
+
 #define LIM_IS_CONNECTION_ACTIVE(psessionEntry)  (psessionEntry->LimRxedBeaconCntDuringHB)
+
 /*pMac->lim.gLimProcessDefdMsgs*/
 #define GET_LIM_PROCESS_DEFD_MESGS(pMac) (pMac->lim.gLimProcessDefdMsgs)
 #define SET_LIM_PROCESS_DEFD_MESGS(pMac, val) (pMac->lim.gLimProcessDefdMsgs = val)
@@ -86,6 +94,7 @@
 #define LIM_SET_RADAR_DETECTED(pMac, val)   (pMac->lim.gLimSpecMgmt.fRadarDetCurOperChan = val)
 #define LIM_MIN_BCN_PR_LENGTH  12
 #define LIM_BCN_PR_CAPABILITY_OFFSET 10
+
 typedef enum eMgmtFrmDropReason
 {
     eMGMT_DROP_NO_DROP,
@@ -97,8 +106,11 @@
 }tMgmtFrmDropReason;
 
 
+
+
 /// During TD ring clean up at HDD in RTAI, will call this call back
 extern void limPostTdDummyPktCallbak(void* pMacGlobals, unsigned int* pBd);
+
 /**
  * Function to initialize LIM state machines.
  * This called upon LIM thread creation.
@@ -113,32 +125,47 @@
  * Function to Initialize radar interrupts.
  */
 void limRadarInit(tpAniSirGlobal pMac);
+
 tSirRetStatus peStart(tpAniSirGlobal pMac);
 void peStop(tpAniSirGlobal pMac);
 tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
 tSirRetStatus peProcessMsg(tpAniSirGlobal pMac, tSirMsgQ* limMsg);
 void limDumpInit(tpAniSirGlobal pMac);
+
 /**
  * Function to cleanup LIM state.
  * This called upon reset/persona change etc
  */
 extern void limCleanup(tpAniSirGlobal);
+
 /// Function to post messages to LIM thread
 extern tANI_U32  limPostMsgApi(tpAniSirGlobal, tSirMsgQ *);
+
 /**
  * Function to fetch messages posted LIM thread
  */
 extern void limProcessMessageQueue(tpAniSirGlobal);
+
 /**
  * Function to process messages posted to LIM thread
  * and dispatch to various sub modules within LIM module.
  */
 extern void limMessageProcessor(tpAniSirGlobal, tpSirMsgQ);
 extern void limProcessMessages(tpAniSirGlobal, tpSirMsgQ); // DT test alt deferred 2
+
+/**
+ * Function to check the LIM state if system can be put in
+ * Learn Mode.
+ * This is called by SCH upon receiving SCH_START_LEARN_MODE
+ * message from LIM.
+ */
+extern tSirRetStatus limCheckStateForLearnMode(tpAniSirGlobal);
+
 /**
  * Function to check the LIM state if system is in Scan/Learn state.
  */
 extern tANI_U8 limIsSystemInScanState(tpAniSirGlobal);
+
 #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
 /**
  * Function to setup Polaris into Learn mode.
@@ -146,11 +173,14 @@
  * message from LIM.
  */
 extern void limSetLearnMode(tpAniSirGlobal);
+
 /**
  * Function to re-enable Learn mode measurements
  */
 extern void limReEnableLearnMode(tpAniSirGlobal);
+
 #endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+
 /**
  * Function to handle IBSS coalescing.
  * Beacon Processing module to call this.
@@ -158,23 +188,32 @@
 extern tSirRetStatus limHandleIBSScoalescing(tpAniSirGlobal,
                                               tpSchBeaconStruct,
                                               tANI_U8 *,tpPESession);
+
 /// Function used by other Sirius modules to read global SME state
  static inline tLimSmeStates
 limGetSmeState(tpAniSirGlobal pMac) { return pMac->lim.gLimSmeState; }
+
 /// Function used by other Sirius modules to read global system role
  static inline tLimSystemRole
 limGetSystemRole(tpPESession psessionEntry) { return psessionEntry->limSystemRole; }
+
 //limGetAID(tpPESession psessionEntry) { return psessionEntry->limAID; }
+
 extern void limReceivedHBHandler(tpAniSirGlobal, tANI_U8, tpPESession);
 //extern void limResetHBPktCount(tpPESession);
+
 extern void limCheckAndQuietBSS(tpAniSirGlobal);
+
 /// Function to send WDS info to WSM if needed
 extern void limProcessWdsInfo(tpAniSirGlobal, tSirPropIEStruct);
+
 /// Function to initialize WDS info params
 extern void limInitWdsInfoParams(tpAniSirGlobal);
+
 /// Function that triggers STA context deletion
 extern void limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry);
 
+
 /// Function that checks for change in AP's capabilties on STA
 extern void limDetectChangeInApCapabilities(tpAniSirGlobal,
                                              tpSirProbeRespBeacon,tpPESession);
@@ -182,46 +221,62 @@
                                                             tpSirProbeRespBeacon pBeacon, 
                                                             tpUpdateBeaconParams pBeaconParams,tpPESession);
 
+
 /// creates an addts request action frame and sends it out to staid
 extern void limSendAddtsReq (tpAniSirGlobal pMac, tANI_U16 staid, tANI_U8 tsid, tANI_U8 userPrio, tANI_U8 wme);
 /// creates a delts request action frame and sends it out to staid
 extern void limSendDeltsReq (tpAniSirGlobal pMac, tANI_U16 staid, tANI_U8 tsid, tANI_U8 userPrio, tANI_U8 wme);
 /// creates a SM Power State Mode update request action frame and sends it out to staid
 extern void limPostStartLearnModeMsgToSch(tpAniSirGlobal pMac);
-#ifdef WLAN_FEATURE_11AC
-extern ePhyChanBondState limGet11ACPhyCBState(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 htSecondaryChannelOffset );
-#endif
+
+extern ePhyChanBondState limGetPhyCBState( tpAniSirGlobal pMac );
+tSirMacHTSecondaryChannelOffset    limGetHTCBState(tAniCBSecondaryMode aniCBMode);
+tAniCBSecondaryMode     limGetAniCBState( tSirMacHTSecondaryChannelOffset htCBMode) ;
+
+
+
+
+
 tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac);
+
 #if 0 /* Currently, this function is not used but keep it around for when we do need it */
 tSirRetStatus limUpdateGlobalChannelBonding(tpAniSirGlobal pMac, tHalBitVal cbBit);
 #endif /* 0 */
 
+
 #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
 extern void setupQuietBss( tpAniSirGlobal pMac, tANI_U32 learnInterval );
 extern tANI_BOOLEAN limUpdateQuietIEInBeacons( tpAniSirGlobal pMac );
 #endif
+
 #ifdef ANI_AP_SDK
 extern void limConvertScanDuration(tpAniSirGlobal pMac);
 #endif /* ANI_AP_SDK */
+
 #if (WNI_POLARIS_FW_PRODUCT == AP)
 tSirRetStatus limProcessCcaMonitorModeChangeNotification(tpAniSirGlobal pMac, tANI_U32 ccaCbMode);
 #endif /* WNI_POLARIS_FW_PRODUCT == AP */
+
 void limHandleLowRssiInd(tpAniSirGlobal pMac);
 void limHandleBmpsStatusInd(tpAniSirGlobal pMac);
 void limHandleMissedBeaconInd(tpAniSirGlobal pMac);
 tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType);
 void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
+
+
 /* ----------------------------------------------------------------------- */
 // These used to be in DPH
 extern void limSetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId);
 extern void limGetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId);
 extern void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac);
 extern tSirRetStatus limCheckRxSeqNumber(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo);
+
 #define limGetQosMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->limQosEnabled
 #define limGetWmeMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->limWmeEnabled
 #define limGetWsmMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->limWsmEnabled
 #define limGet11dMode(psessionEntry, pVal) *(pVal) = (psessionEntry)->lim11dEnabled
 #define limGetAckPolicy(pMac, pVal)         *(pVal) = pMac->lim.ackPolicy
+
 /* ----------------------------------------------------------------------- */
 static inline void limGetPhyMode(tpAniSirGlobal pMac, tANI_U32 *phyMode, tpPESession psessionEntry)
 {
@@ -246,7 +301,9 @@
   \return  tANI_U32 - TX_SUCCESS for success.
   
   --------------------------------------------------------------------------*/
+
 tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
+
 /** -------------------------------------------------------------
 \fn peFreeMsg
 \brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
@@ -258,5 +315,7 @@
 \return none
 -----------------------------------------------------------------*/
 v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg);
+
 /************************************************************/
 #endif /* __LIM_API_H */
+
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/limFT.h b/drivers/staging/prima/CORE/MAC/src/pe/include/limFT.h
index f065b8d..45dbaa4 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/limFT.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/limFT.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/limFTDefs.h b/drivers/staging/prima/CORE/MAC/src/pe/include/limFTDefs.h
index 867bc49..b069bc1 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/limFTDefs.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/limFTDefs.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -54,8 +54,6 @@
 {
    tANI_U16    messageType;      // eWNI_SME_FT_PRE_AUTH_REQ
    tANI_U16    length;
-   tANI_BOOLEAN bPreAuthRspProcessed; /* Track if response is processed for this request
-                                         We expect only one response per request. */
    tANI_U8     preAuthchannelNum;
    tSirMacAddr currbssId;        // BSSID currently associated to suspend the link
    tSirMacAddr preAuthbssId;     // BSSID to preauth to
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/limGlobal.h b/drivers/staging/prima/CORE/MAC/src/pe/include/limGlobal.h
index 89d8116..7971318 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/limGlobal.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/limGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -363,7 +363,6 @@
 
 #ifdef WLAN_FEATURE_P2P
     tANI_BOOLEAN   p2pSearch;
-    tANI_BOOLEAN   skipDfsChnlInP2pSearch;
 #endif
     tANI_U16           uIEFieldLen;
     tANI_U16           uIEFieldOffset;
@@ -460,9 +459,6 @@
     tANI_U8                 schClean:1;
     // 802.11n HT Capability in Station: Enabled 1 or DIsabled 0
     tANI_U8                 htCapability:1;
-#ifdef WLAN_FEATURE_11AC
-    tANI_U8                 vhtCapability:1;
-#endif
 } tLimMlmStaContext, *tpLimMlmStaContext;
 
 // Structure definition to hold deferred messages queue parameters
@@ -640,7 +636,7 @@
 {
     tLimChannelSwitchState   state;
     tANI_U8                  primaryChannel;
-    ePhyChanBondState        secondarySubBand;
+    tAniCBSecondaryMode      secondarySubBand;
     tANI_U32                 switchCount;
     tANI_U32                 switchTimeoutValue;
     tANI_U8                  switchMode;
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/limSession.h b/drivers/staging/prima/CORE/MAC/src/pe/include/limSession.h
index f0058ec..8412849 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/limSession.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/limSession.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -97,16 +97,7 @@
     void                    *pLimMlmReassocReq;      //handle to MLM reassoc Req
     tANI_U16                channelChangeReasonCode;
     tANI_U8                 dot11mode;
-    tANI_U8                 htCapability;
-    /* Supported Channel Width Set: 0-20MHz 1 - 40MHz */
-    tANI_U8                 htSupportedChannelWidthSet;
-    /* Recommended Tx Width Set
-     * 0 - use 20 MHz channel (control channel)
-     * 1 - use channel width enabled under Supported Channel Width Set
-     */
-    tANI_U8                 htRecommendedTxWidthSet;
-    /* Identifies the 40 MHz extension channel */
-    ePhyChanBondState       htSecondaryChannelOffset;
+    tANI_U8                 htCapabality;
     tSirRFBand              limRFBand;
     tANI_U8                 limIbssActive;          //TO SUPPORT CONCURRENCY
 
@@ -116,19 +107,17 @@
     tANI_U8                 limCurrentBssQosCaps;
     tANI_U16                limCurrentBssPropCap;
     tANI_U8                 limSentCapsChangeNtf;
+    tANI_U32                limCurrentTitanHtCaps;
     tANI_U16                limAID;
 
     /* Parameters  For Reassociation */
     tSirMacAddr             limReAssocbssId;
     tSirMacChanNum          limReassocChannelId;
-    /* CB paramaters required/duplicated for Reassoc since re-assoc mantains its own params in lim */
-    tANI_U8                 reAssocHtSupportedChannelWidthSet;
-    tANI_U8                 reAssocHtRecommendedTxWidthSet;
-    ePhyChanBondState       reAssocHtSecondaryChannelOffset;
     tSirMacSSid             limReassocSSID;
     tANI_U16                limReassocBssCaps;
     tANI_U8                 limReassocBssQosCaps;
     tANI_U16                limReassocBssPropCap;
+    tANI_U32                limReassocTitanHtCaps;
 
     // Assoc or ReAssoc Response Data/Frame
     void                   *limAssocResponseData;
@@ -268,12 +257,9 @@
     tAniBool            isCCXconnection;
     tCcxPEContext       ccxContext;
 #endif
-#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
     tAniBool            isFastTransitionEnabled;
 #endif
-#ifdef FEATURE_WLAN_LFR
-    tAniBool            isFastRoamIniFeatureEnabled;
-#endif
 #ifdef WLAN_FEATURE_P2P
     tSirNoAParam p2pNoA;
     tSirP2PNoaAttr p2pGoPsUpdate;
@@ -299,22 +285,12 @@
     tANI_U8  gLimEdcaParamSetCount;
 
     tBeaconParams beaconParams;
-#ifdef WLAN_FEATURE_11AC
-    tANI_U8 vhtCapability;
-    tANI_U8 vhtTxChannelWidthSet;
-#endif
+
     tANI_U8            spectrumMgtEnabled;
-    /* *********************11H related*****************************/
-    //tANI_U32           gLim11hEnable;
-    tLimSpecMgmtInfo   gLimSpecMgmt;
-    // CB Primary/Secondary Channel Switch Info
-    tLimChannelSwitchInfo  gLimChannelSwitch;
-    /* *********************End 11H related*****************************/
 
     /*Flag to Track Status/Indicate HBFailure on this session */
     tANI_BOOLEAN LimHBFailureStatus;
     tANI_U32           gLimPhyMode;
-
 }tPESession, *tpPESession;
 
 #define LIM_MAX_ACTIVE_SESSIONS 4
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/limTrace.h b/drivers/staging/prima/CORE/MAC/src/pe/include/limTrace.h
index 981510e..f0c2a1b 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/limTrace.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/limTrace.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -107,7 +107,6 @@
 
 
 #define MTRACE(p) p
-#define NO_SESSION 0xFF
 
 #else
 #define MTRACE(p) {  }
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/pmmApi.h b/drivers/staging/prima/CORE/MAC/src/pe/include/pmmApi.h
index c495f39..8ca992c 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/pmmApi.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/pmmApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/pmmGlobal.h b/drivers/staging/prima/CORE/MAC/src/pe/include/pmmGlobal.h
index b49743e..e98a344 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/pmmGlobal.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/pmmGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/rrmApi.h b/drivers/staging/prima/CORE/MAC/src/pe/include/rrmApi.h
index f341b66..1855ed5 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/rrmApi.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/rrmApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/rrmGlobal.h b/drivers/staging/prima/CORE/MAC/src/pe/include/rrmGlobal.h
index 00270e4..5e240b2 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/rrmGlobal.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/rrmGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/schApi.h b/drivers/staging/prima/CORE/MAC/src/pe/include/schApi.h
index a3fd17a..9d76898 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/schApi.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/schApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/schGlobal.h b/drivers/staging/prima/CORE/MAC/src/pe/include/schGlobal.h
index 1848b61..176ce65 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/schGlobal.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/schGlobal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/include/wmmApsd.h b/drivers/staging/prima/CORE/MAC/src/pe/include/wmmApsd.h
index 5410d74..f133104 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/include/wmmApsd.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/include/wmmApsd.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limAIDmgmt.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limAIDmgmt.c
index c1e1a4e..7e78eb6 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limAIDmgmt.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limAIDmgmt.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limAdmitControl.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limAdmitControl.c
index 0f8413c..d14e56a 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limAdmitControl.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limAdmitControl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1099,7 +1099,7 @@
      * WDA_ADD_TS_RSP from HAL.
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, sessionId, msg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
 
     if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
     {
@@ -1126,8 +1126,7 @@
   tpAniSirGlobal pMac,
   tANI_U16       staIdx,
   tANI_U8         tspecIdx,
-  tSirDeltsReqInfo delts,
-  tANI_U8        sessionId)
+  tSirDeltsReqInfo delts)
 {
   tSirMsgQ msg;
   tpDelTsParams pDelTsParam;
@@ -1148,7 +1147,7 @@
   pDelTsParam->tspecIdx = tspecIdx;
 
   PELOGW(limLog(pMac, LOGW, FL("calling wdaPostCtrlMsg()\n"));)
-  MTRACE(macTraceMsgTx(pMac, sessionId, msg.type));
+  MTRACE(macTraceMsgTx(pMac, 0, msg.type));
 
   if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
   {
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limApi.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limApi.c
index 9a0fd9d..72c369c 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limApi.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -235,7 +235,7 @@
     pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
 
     /// MLM State visible across all Sirius modules
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_IDLE_STATE));
     pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
 
     /// Previous MLM State
@@ -248,15 +248,15 @@
 
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
     /**
-     * Initialize state to eLIM_SME_OFFLINE_STATE
+     * Initialize state to eLIM_MLM_OFFLINE_STATE
      */
-    pMac->lim.gLimSmeState     = eLIM_SME_OFFLINE_STATE;
+    pMac->lim.gLimSmeState     = eLIM_MLM_OFFLINE_STATE;
 #else
     /**
      * Initialize state to suspended state and wait for
      * HAL to send LIM_RESUME_ACTIVITY_NTF message.
      */
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
     pMac->lim.gLimSmeState     = eLIM_SME_SUSPEND_STATE;
 #endif /* FEATURE_WLAN_INTEGRATED_SOC */
 
@@ -275,6 +275,7 @@
     pMac->lim.gLimPhyMode = 0; 
     pMac->lim.scanStartTime = 0;    // used to measure scan time
 
+    palZeroMemory(pMac->hHdd, pMac->lim.gLimBssid, sizeof(pMac->lim.gLimBssid));
     palZeroMemory(pMac->hHdd, pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr));
     pMac->lim.ackPolicy = 0;
 
@@ -324,11 +325,20 @@
     palZeroMemory(pMac->hHdd, &pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo));
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
 
-#if 0
     // 11h Spectrum Management Related Flag
+    //pMac->lim.gLim11hEnable = 0;
+    pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
     LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
     pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
-#endif
+
+    // 11h Quiet Element Related Flag
+    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+    // A count-down value, used on the AP, to send out the
+    // Quiet BSS IE in that many Beacon's
+    pMac->lim.gLimSpecMgmt.quietCount = 0;
+    pMac->lim.gLimSpecMgmt.fQuietEnabled = eANI_BOOLEAN_FALSE;
+    pMac->lim.gLimSpecMgmt.fRadarIntrConfigured = eANI_BOOLEAN_FALSE;
+
     // WMM Related Flag
     pMac->lim.gUapsdEnable = 0;
     pMac->lim.gUapsdPerAcBitmask = 0;
@@ -366,7 +376,7 @@
     // Place holder for current authentication request
     // being handled
     pMac->lim.gpLimMlmAuthReq = NULL;
-    //pMac->lim.gpLimMlmJoinReq = NULL;
+    pMac->lim.gpLimMlmJoinReq = NULL;
 
     /// MAC level Pre-authentication related globals
     pMac->lim.gLimPreAuthChannelNumber = 0;
@@ -389,20 +399,32 @@
     palZeroMemory(pMac->hHdd, pMac->lim.protStaOverlapCache, sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE);
     palZeroMemory(pMac->hHdd, pMac->lim.protStaCache, sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE);
 
+    // Initialize Assoc/ReAssoc Response Data/Frame
+    //pMac->lim.gLimAssocResponseData = NULL;
+
 }
 
 
 static void __limInitTitanVars(tpAniSirGlobal pMac)
 {
-#if 0
+    pMac->lim.gCbMode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+    SET_CB_STATE_DISABLE( pMac->lim.gCbState );
     palZeroMemory(pMac->hHdd, &pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo));
+
     pMac->lim.gLimChannelSwitch.state               = eLIM_CHANNEL_SWITCH_IDLE;
-    pMac->lim.gLimChannelSwitch.secondarySubBand    = PHY_SINGLE_CHANNEL_CENTERED;
-#endif
+    pMac->lim.gLimChannelSwitch.secondarySubBand    = eANI_CB_SECONDARY_NONE;
+
     // Debug workaround for BEACON's
     // State change triggered by "dump 222"
     pMac->lim.gLimScanOverride = 1;
     pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
+
+
+    // Caches the CB State as desired by SME
+    SET_CB_STATE_DISABLE( pMac->lim.gCbStateProtected );
+
+    // TODO - This needs to be read off of a CFG variable
+
     pMac->lim.gLimTitanStaCount = 0;
     pMac->lim.gLimBlockNonTitanSta = 0;
 }
@@ -410,7 +432,9 @@
 static void __limInitHTVars(tpAniSirGlobal pMac)
 {
     pMac->lim.htCapabilityPresentInBeacon = 0;
+    pMac->lim.htCapability = 0;
     pMac->lim.gHTGreenfield = 0;
+    pMac->lim.gHTSupportedChannelWidthSet = 0;
     pMac->lim.gHTShortGI40Mhz = 0;
     pMac->lim.gHTShortGI20Mhz = 0;
     pMac->lim.gHTMaxAmsduLength = 0;
@@ -424,6 +448,8 @@
     pMac->lim.gHTMaxRxAMpduFactor = 0;
     pMac->lim.gHTServiceIntervalGranularity = 0;
     pMac->lim.gHTControlledAccessOnly = 0;
+    pMac->lim.gHTRecommendedTxWidthSet = 0;
+    pMac->lim.gHTSecondaryChannelOffset = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
     pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
     pMac->lim.gHTPCOActive = 0;
 
@@ -437,7 +463,7 @@
 #if defined( FEATURE_WLAN_INTEGRATED_SOC )
 static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
 {
-   tANI_U32 val1, val2, val3;
+   tANI_U32 val1, val2, val3, len;
    tANI_U16 val16;
    tANI_U8 val8;
    tSirMacHTCapabilityInfo   *pHTCapabilityInfo;
@@ -446,10 +472,14 @@
    tSirMacHTParametersInfo   *pAmpduParamInfo;
 
    /* Read all the CFGs here that were updated before peStart is called */
-   /* All these CFG READS/WRITES are only allowed in init, at start when there is no session 
-    * and they will be used throughout when there is no session
-    */
 
+   /* WNI_CFG_CHANNEL_BONDING_MODE */
+
+   handleCBCFGChange( pMac, WNI_CFG_CHANNEL_BONDING_MODE );
+         
+   //for Secondary channel, change setupCBMode function OR the caller of that
+   //function during Join (STA) or Start BSS(AP/IBSS) Now update the HT Capability
+   //CFG based on Channel Bonding CFG
    if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS) 
    {
       PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
@@ -485,6 +515,7 @@
    pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
    pHTInfoField1->recommendedTxWidthSet = 
      (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
+   pMac->lim.gHTRecommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
    if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1) 
       != eSIR_SUCCESS)
    {
@@ -571,6 +602,16 @@
       return eSIR_FAILURE;
    }
 
+   /* WNI_CFG_BSSID - this one is not updated in limHandleCFGparamUpdate do we
+      want to update this? */
+   len = 6;
+   if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, pMac->lim.gLimBssid, &len) != 
+       eSIR_SUCCESS)
+   {
+      limLog(pMac, LOGP, FL("cfg get bssid failed\n"));
+      return eSIR_FAILURE;
+   }
+
    /* WNI_CFG_MAX_PS_POLL */
 
    /* Allocate and fill in power save configuration. */
@@ -608,7 +649,8 @@
 
    /* This was initially done after resume notification from HAL. Now, DAL is
       started before PE so this can be done here */
-   handleHTCapabilityandHTInfo(pMac, NULL);
+   handleCBCFGChange( pMac, ANI_IGNORE_CFG_ID );
+   handleHTCapabilityandHTInfo(pMac);
 
    return eSIR_SUCCESS;
 }
@@ -629,7 +671,7 @@
    {
       pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
 
-      MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
+      MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
       // By default do not return after first scan match
       pMac->lim.gLimReturnAfterFirstMatch = 0;
@@ -868,13 +910,11 @@
         pMac->lim.gpLimMlmAuthReq = NULL;
     }
 
-#if 0
     if (pMac->lim.gpLimMlmJoinReq != NULL)
     {
         palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmJoinReq);
         pMac->lim.gpLimMlmJoinReq = NULL;
     }
-#endif
 
     #if 0
     if (pMac->lim.gpLimReassocReq != NULL)
@@ -1054,7 +1094,13 @@
 
     if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
         return eSIR_SUCCESS;
-    
+
+    palFreeMemory(pMac->hHdd, pMac->lim.limTimers.gpLimCnfWaitTimer);
+    pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
+    palFreeMemory(pMac->hHdd, pMac->lim.gpLimAIDpool);
+    pMac->lim.gpLimAIDpool = NULL;
+
+   
     for(i =0; i < pMac->lim.maxBssId; i++)
     {
         if(pMac->lim.gpSession[i].valid == TRUE)
@@ -1062,11 +1108,7 @@
             peDeleteSession(pMac,&pMac->lim.gpSession[i]);
         }
     }
-    palFreeMemory(pMac->hHdd, pMac->lim.limTimers.gpLimCnfWaitTimer);
-    pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
-    palFreeMemory(pMac->hHdd, pMac->lim.gpLimAIDpool);
-    pMac->lim.gpLimAIDpool = NULL;
-    
+
     palFreeMemory(pMac->hHdd, pMac->lim.gpSession);
     pMac->lim.gpSession = NULL;
     /*
@@ -1397,9 +1439,9 @@
     {
     PELOG1(limLog( pMac, LOG1,
        FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d  Sizes:FC%d Mgmt%d\n"),
-       pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
+       pRxBd, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
 
-    MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION, 
+    MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, 0, 
                         LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,  
                         (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
     }
@@ -1457,6 +1499,49 @@
 
 
 /**
+ * limCheckStateForLearnMode()
+ *
+ *FUNCTION:
+ * This function is called by SCH to verify if LIM is in a state
+ * to put system into Learn mode
+ *
+ *LOGIC:
+ * NA
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ *
+ * @param  pMac - Pointer to Global MAC structure
+ * @return eSIR_SUCCESS - LIM is in a state to put system
+ *                        into Learn Mode
+ *         eSIR_FAILURE - LIM is NOT in a state to put system
+ *                        into Learn Mode
+ */
+
+tSirRetStatus
+limCheckStateForLearnMode(tpAniSirGlobal pMac)
+{
+    switch (pMac->lim.gLimSmeState)
+    {
+        case eLIM_SME_OFFLINE_STATE:
+        case eLIM_SME_IDLE_STATE:
+        case eLIM_SME_JOIN_FAILURE_STATE:
+        case eLIM_SME_NORMAL_STATE:
+        case eLIM_SME_LINK_EST_STATE:
+            // LIM is in a state to put system into Learn mode
+            return eSIR_SUCCESS;
+
+        default:
+            // LIM is NOT in a state to put system into Learn mode
+            return eSIR_FAILURE;
+    }
+} /*** end limCheckStateForLearnMode() ***/
+
+
+
+/**
  * limIsSystemInScanState()
  *
  *FUNCTION:
@@ -1656,7 +1741,7 @@
     pMac->lim.gLimMeasParams.shortDurationCount++;
     limDeactivateAndChangeTimer(pMac, eLIM_LEARN_DURATION_TIMER);
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_LEARN_DURATION_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_LEARN_DURATION_TIMER));
     if (tx_timer_activate(&pMac->lim.gLimMeasParams.learnDurationTimer)
                                            != TX_SUCCESS)
     {
@@ -1704,7 +1789,7 @@
 
     if (pMac->lim.gLimSpecMgmt.fQuietEnabled)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_QUIET_BSS_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
 #ifdef GEN6_TODO
         /* revisit this piece of code to assign the appropriate sessionId below
          * priority - HIGH
@@ -1723,7 +1808,7 @@
     else
     {
         limDeactivateAndChangeTimer(pMac, eLIM_LEARN_INTERVAL_TIMER);
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_LEARN_INTERVAL_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_LEARN_INTERVAL_TIMER));
 #ifdef GEN6_TODO
         /* revisit this piece of code to assign the appropriate sessionId below
         */
@@ -1878,7 +1963,7 @@
                 mmhMsg.type = eWNI_SME_WDS_INFO_IND;
                 mmhMsg.bodyptr = pSirSmeWdsInfoInd;
                 mmhMsg.bodyval = 0;
-                MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+                MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
                 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
                 pMac->lim.gLimNumWdsInfoInd++;
             }
@@ -2145,28 +2230,13 @@
 {
 
     tSirSmeApNewCaps   apNewCaps;
-    tANI_U32           nShortSlot;
-    tANI_U32 val = 0;
-    tANI_U32 phyMode;
-
-    // Check Admin mode first. If it is disabled just return
-    if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
-                   != eSIR_SUCCESS)
-    {
-        limLog(pMac, LOGP,
-               FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed\n"));
-        return eSIR_FAILURE;
-    }
-    if (val == false)
-        return eSIR_SUCCESS;
-
-    // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
-    limGetPhyMode(pMac, &phyMode, psessionEntry);
-    if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
-        return eSIR_SUCCESS;
-
+    tANI_U32                cShortSlot, nShortSlot;
+ 
     apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
 
+    if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &cShortSlot) != eSIR_SUCCESS)
+        limLog(pMac, LOGP, FL("unable to get short slot time\n"));
+
     //  Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
     // when erp is present, apply short slot always unless, prot=on  && shortSlot=off
     // if no erp present, use short slot based on current ap caps
@@ -2188,14 +2258,16 @@
     */
     nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
 
-    if (nShortSlot != psessionEntry->shortSlotTimeSupported)
+    if (nShortSlot != cShortSlot)
     {
         // Short slot time capability of AP has changed. Adopt to it.
         PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d\n"),  nShortSlot);)
         ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
-        psessionEntry->shortSlotTimeSupported = nShortSlot;
         pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
         pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
+
+        if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, nShortSlot) != eSIR_SUCCESS)
+            PELOGE(limLog(pMac, LOGE,  FL("could not update short slot time at CFG\n"));)
     }
     return eSIR_SUCCESS;
 }
@@ -2378,7 +2450,7 @@
     msg.type = WDA_INIT_RADAR_IND;
     msg.bodyptr = NULL;
     msg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
     status = wdaPostCtrlMsg(pMac, &msg);
     if (status != eHAL_STATUS_SUCCESS)
     {
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.c
index 3c6633f..c4a850f 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -603,13 +603,13 @@
     tSirRetStatus       retCode = eSIR_SUCCESS;
 
 
-    PELOG2(limLog( pMac, LOG2, FL("**Initiate cleanup"));)
+    PELOGE(limLog( pMac, LOGE, FL("**Initiate cleanup\n"));)
 
     limAbortBackgroundScan( pMac );
 
     if (pMac->lim.gLimAddtsSent)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_ADDTS_RSP_TIMER));
         tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
     }
 
@@ -654,9 +654,9 @@
 
     if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
         psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
         /* Deactivating probe after heart beat timer */
         limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
         limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
@@ -843,23 +843,8 @@
         smetransactionId = psessionEntry->transactionId;
 
         psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
-        //if it is a reassoc failure to join new AP
-        if(mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE)
-        {
-            if(mlmStaContext.resultCode != eSIR_SME_SUCCESS )
-            {
-                peDeleteSession(pMac, psessionEntry);
-                psessionEntry = NULL;
-            } 
-
-            limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
-                               mlmStaContext.resultCode, mlmStaContext.protStatusCode, psessionEntry,
-                               smesessionId, smetransactionId);
-        }
-        else
-        {
         palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
         psessionEntry->pLimJoinReq = NULL;
 
@@ -871,7 +856,6 @@
         
         limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, mlmStaContext.resultCode, mlmStaContext.protStatusCode,
                                  psessionEntry, smesessionId, smetransactionId);
-        }
         
     } 
 
@@ -1066,7 +1050,7 @@
     if(SIR_BAND_5_GHZ == rfBand)
     {
         //we are HT. if we are 11A, then protection is not required.
-        if(true == psessionEntry->htCapability)
+        if(true == psessionEntry->htCapabality)
         {
             //we are HT and 11A station is leaving.
             //protection consideration required.
@@ -1109,7 +1093,7 @@
         erpEnabled = pStaDs->erpEnabled;
         //we are HT or 11G and 11B station is getting deleted.
         if (((phyMode == WNI_CFG_PHY_MODE_11G) ||
-              psessionEntry->htCapability) &&
+              psessionEntry->htCapabality) &&
               (erpEnabled == eHAL_CLEAR))
         {
             PELOG1(limLog(pMac, LOG1, FL("(%d) A legacy STA is disassociated. Addr is "),
@@ -1140,7 +1124,7 @@
             }
         }
         //(non-11B station is leaving) or (we are not 11G or HT AP)
-        else if(psessionEntry->htCapability)
+        else if(psessionEntry->htCapabality)
         { //we are HT AP and non-11B station is leaving.
 
             //11g station is leaving            
@@ -1176,7 +1160,7 @@
     }
 
     //LSIG TXOP not supporting staiton leaving. applies to 2.4 as well as 5 GHZ.
-    if((true == psessionEntry->htCapability) &&
+    if((true == psessionEntry->htCapabality) &&
         (true == pStaDs->mlmStaContext.htCapability))
     {
         //HT non-GF leaving
@@ -1334,7 +1318,7 @@
              }
           }
        }
-       else
+       else 
 #endif
        {
            if (pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta> 0)
@@ -1370,7 +1354,9 @@
          {
             pBeaconParams->fShortSlotTime = true;
             pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
-            psessionEntry->shortSlotTimeSupported = true;
+
+            if (cfgSetInt(pMac,  WNI_CFG_SHORT_SLOT_TIME,  true) != eSIR_SUCCESS)
+                PELOGE(limLog(pMac, LOGE,  FL("could not update short slot time at CFG\n"));)
          }
       }
       else 
@@ -1387,35 +1373,15 @@
             {
                pBeaconParams->fShortSlotTime = true;
                pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
-               psessionEntry->shortSlotTimeSupported = true;
-            }
+
+               if (cfgSetInt(pMac,  WNI_CFG_SHORT_SLOT_TIME,  true) != eSIR_SUCCESS)
+                     PELOGE(limLog(pMac, LOGE,  FL("could not update short slot time at CFG\n"));)
+             }
           }
        }
    }
 }
 
-void
-limPostReassocFailure(tpAniSirGlobal pMac,
-                      tSirResultCodes resultCode,
-                      tANI_U16 protStatusCode,tpPESession psessionEntry)
-{
-    tLimMlmReassocCnf   mlmReassocCnf;
-
-    psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
-
-    // 'Change' timer for future activations
-    limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
-
-    mlmReassocCnf.resultCode = resultCode;
-    mlmReassocCnf.protStatusCode = protStatusCode;
-    /* Update PE session Id */
-    mlmReassocCnf.sessionId = psessionEntry->peSessionId;
-    limPostSmeMessage(pMac,
-                      LIM_MLM_REASSOC_CNF,
-                      (tANI_U32 *) &mlmReassocCnf);
-} /*** end limPostReassocFailure() ***/
-
 /**
  * limRestorePreReassocState()
  *
@@ -1443,11 +1409,12 @@
                           tSirResultCodes resultCode,
                           tANI_U16 protStatusCode,tpPESession psessionEntry)
 {
-    tANI_U8             chanNum, secChanOffset;
+    tANI_U8                  chanNum;
     tLimMlmReassocCnf   mlmReassocCnf;
 
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_LINK_ESTABLISHED_STATE));
     psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_LINK_ESTABLISHED_STATE));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_LINK_ESTABLISHED_STATE));
 
     // 'Change' timer for future activations
     limDeactivateAndChangeTimer(pMac, eLIM_REASSOC_FAIL_TIMER);
@@ -1468,9 +1435,8 @@
 
    /*  To support BT-AMP */
    chanNum = psessionEntry->currentOperChannel;
-   secChanOffset = psessionEntry->htSecondaryChannelOffset;
 
-    limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+    limSetChannel(pMac, psessionEntry->limCurrentTitanHtCaps, chanNum, psessionEntry->maxTxPower, psessionEntry->peSessionId);
 
     /** @ToDo : Need to Integrate the STOP the DataTransfer to the AP from 11H code */
 
@@ -1514,71 +1480,7 @@
     return eANI_BOOLEAN_FALSE;
 } /*** end limIsReassocInProgress() ***/
 
-#ifdef WLAN_FEATURE_11AC
-tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac,
-                                  tpSirSupportedRates pRates,
-                                  tDot11fIEVHTCaps *pPeerVHTCaps,
-                                  tpPESession psessionEntry)
-{
-    tANI_U32 val;
 
-    if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
-    {
-        if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_MCS_MAP,&val) != 
-            eSIR_SUCCESS )
-        {
-            PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX MCS MAP\n"));)
-            goto error;
-        }
-        pRates->vhtRxMCSMap = (tANI_U16)val;
-    
-        if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_MCS_MAP,&val ) != 
-            eSIR_SUCCESS )
-        {
-            PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT TX MCS MAP\n"));)
-            goto error;
-        }
-        pRates->vhtTxMCSMap = (tANI_U16)val;
-
-        if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,&val ) != 
-            eSIR_SUCCESS )
-        {
-            PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP\n"));)
-            goto error;
-        }
-        pRates->vhtRxHighestDataRate = (tANI_U16)val;
-    
-        if ( wlan_cfgGetInt( pMac,WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,&val ) != 
-            eSIR_SUCCESS )
-        {
-            PELOGE(limLog(pMac, LOGE, FL("could not retrieve VHT RX Supported data rate MAP\n"));)
-            goto error;
-        }
-        pRates->vhtTxHighestDataRate = (tANI_U16)val;
-
-        if( pPeerVHTCaps != NULL)
-        {
-            pRates->vhtTxHighestDataRate = SIR_MIN(pRates->vhtTxHighestDataRate, pPeerVHTCaps->txSupDataRate);
-            pRates->vhtRxHighestDataRate = SIR_MIN(pRates->vhtRxHighestDataRate, pPeerVHTCaps->rxHighSupDataRate);
-
-            // Aquire PEER MCS map if we exceed.
-            // We compare/update only the last 2 bits of the map as we support only single BSS.
-            // Firmware takes care of this comparison
-            pRates->vhtRxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
-            pRates->vhtRxMCSMap |= (pPeerVHTCaps->rxMCSMap & 0x3); // Updating the last 2 bits in the bitmap
-
-            // Firmware takes care of this comparison
-            pRates->vhtTxMCSMap &= ~(0x3); // Clearing the last 2 bits in the bitmap
-            pRates->vhtTxMCSMap |= (pPeerVHTCaps->txMCSMap & 0x3); // Updating the last 2 bits in the bitmap
-        }
-    }
-    return eSIR_SUCCESS;
-error:
-
-    return eSIR_FAILURE;
-
-}
-#endif
 
 /**
  * limPopulateOwnRateSet
@@ -1603,23 +1505,13 @@
  * @return eSIR_SUCCESS or eSIR_FAILURE
  *
  */
-#ifdef WLAN_FEATURE_11AC
-tSirRetStatus
-limPopulateOwnRateSet(tpAniSirGlobal pMac,
-                      tpSirSupportedRates pRates,
-                      tANI_U8* pSupportedMCSSet,
-                      tANI_U8 basicOnly,
-                      tpPESession psessionEntry,
-                      tDot11fIEVHTCaps *pVHTCaps)
-#else
+
 tSirRetStatus
 limPopulateOwnRateSet(tpAniSirGlobal pMac,
                       tpSirSupportedRates pRates,
                       tANI_U8* pSupportedMCSSet,
                       tANI_U8 basicOnly,
                       tpPESession psessionEntry)
-#endif
-
 {
     tSirMacRateSet          tempRateSet;
     tSirMacRateSet          tempRateSet2;
@@ -1767,9 +1659,8 @@
             PELOGW(limLog(pMac, LOG2,FL("%x ") , pRates->supportedMCSSet[i]);)
     }
 
-#ifdef WLAN_FEATURE_11AC
-    limPopulateVhtMcsSet(pMac, pRates , pVHTCaps,psessionEntry);
-#endif
+
+
 
     return eSIR_SUCCESS;
 
@@ -1778,6 +1669,8 @@
     return eSIR_FAILURE;
 } /*** limPopulateOwnRateSet() ***/
 
+
+
 /**
  * limPopulateMatchingRateSet
  * FUNCTION:
@@ -1807,18 +1700,7 @@
  *
  * @return:  eSIR_SUCCESS or eSIR_FAILURE
  */
-#ifdef WLAN_FEATURE_11AC
-tSirRetStatus
-limPopulateMatchingRateSet(tpAniSirGlobal pMac,
-                           tpDphHashNode pStaDs,
-                           tSirMacRateSet *pOperRateSet,
-                           tSirMacRateSet *pExtRateSet,
-                           tANI_U8* pSupportedMCSSet,
-                           tSirMacPropRateSet *pAniLegRateSet,
-                           tpPESession  psessionEntry,
-                           tDot11fIEVHTCaps *pVHTCaps)
 
-#else
 tSirRetStatus
 limPopulateMatchingRateSet(tpAniSirGlobal pMac,
                            tpDphHashNode pStaDs,
@@ -1827,7 +1709,6 @@
                            tANI_U8* pSupportedMCSSet,
                            tSirMacPropRateSet *pAniLegRateSet,
                            tpPESession  psessionEntry)
-#endif
 {
    tSirMacRateSet          tempRateSet;
    tSirMacRateSet          tempRateSet2;
@@ -2048,9 +1929,6 @@
         }
     }
 
-#ifdef WLAN_FEATURE_11AC
-    limPopulateVhtMcsSet(pMac, &pStaDs->supportedRates, pVHTCaps, psessionEntry);
-#endif
     /**
       * Set the erpEnabled bit iff the phy is in G mode and at least
       * one A rate is supported
@@ -2163,20 +2041,9 @@
     //Update HT Capability
 
     if ((limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||(limGetSystemRole(psessionEntry) == eLIM_BT_AMP_AP_ROLE) || (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE))
-    {
         pAddStaParams->htCapable = pStaDs->mlmStaContext.htCapability;
-#ifdef WLAN_FEATURE_11AC
-        pAddStaParams->vhtCapable = pStaDs->mlmStaContext.vhtCapability;
-#endif
-    }
     else
-    {
-        pAddStaParams->htCapable = psessionEntry->htCapability;
-#ifdef WLAN_FEATURE_11AC
-        pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
-#endif
-
-    }
+          pAddStaParams->htCapable = psessionEntry->htCapabality;
 
     pAddStaParams->greenFieldCapable = pStaDs->htGreenfield;
     pAddStaParams->maxAmpduDensity= pStaDs->htAMpduDensity;
@@ -2188,18 +2055,6 @@
     pAddStaParams->maxAmsduSize = pStaDs->htMaxAmsduLength;
     pAddStaParams->txChannelWidthSet = pStaDs->htSupportedChannelWidthSet;
     pAddStaParams->mimoPS = pStaDs->htMIMOPSState;
-
-#ifdef WLAN_FEATURE_11AC
-    if(pAddStaParams->vhtCapable)
-    {
-        pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
-
-        /* TODO. Need to discuss this. Overwriting here.
-         * Stick to SAP's configuration for HT supported Channel width */
-        pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
-    }
-#endif
-
     /* Update PE session ID*/
     pAddStaParams->sessionId = psessionEntry->peSessionId;
 
@@ -2240,23 +2095,22 @@
         pAddStaParams->uAPSD |= pAddStaParams->uAPSD << 4;
 
         pAddStaParams->maxSPLen = pStaDs->qos.capability.qosInfo.maxSpLen;
-        limLog( pMac, LOG1, FL( "uAPSD = 0x%x, maxSpLen = %d" ),
+        limLog( pMac, LOGE, FL( "uAPSD = 0x%x, maxSpLen = %d" ),
             pAddStaParams->uAPSD, pAddStaParams->maxSPLen);
     }
 #endif
   //we need to defer the message until we get the response back from HAL.
     if (pAddStaParams->respReqd)
         SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-
-    msgQ.type = WDA_ADD_STA_REQ;
+  msgQ.type = WDA_ADD_STA_REQ;
 
     msgQ.reserved = 0;
     msgQ.bodyptr = pAddStaParams;
     msgQ.bodyval = 0;
 
-    limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d\n" ),
+    limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_STA_REQ for assocId %d\n" ),
             pStaDs->assocId);
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode)
@@ -2349,13 +2203,13 @@
         //when limDelSta is called from processSmeAssocCnf then mlmState is already set properly.
         if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs))
         {
-            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
             SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, eLIM_MLM_WT_DEL_STA_RSP_STATE);
         }
         if ( (eLIM_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) || 
              (eLIM_BT_AMP_STA_ROLE == GET_LIM_SYSTEM_ROLE(psessionEntry)) )
         {
-            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_STA_RSP_STATE));
+            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_STA_RSP_STATE));
 
             psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; 
     
@@ -2374,9 +2228,9 @@
     msgQ.bodyptr = pDelStaParams;
     msgQ.bodyval = 0;
 
-    limLog( pMac, LOG1, FL( "Sending SIR_HAL_DELETE_STA_REQ for STAID: %X and AssocID: %d" ),
+    limLog( pMac, LOGE, FL( "Sending SIR_HAL_DELETE_STA_REQ for STAID: %X and AssocID: %d\n" ),
     pDelStaParams->staIdx, pDelStaParams->assocId);
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode)
     {
@@ -2422,7 +2276,7 @@
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
     limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ), pAddStaParams->assocId);
 #endif
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
     psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
@@ -2508,15 +2362,11 @@
     pAddStaParams->updateSta = updateSta;
 
     pAddStaParams->shortPreambleSupported = psessionEntry->beaconParams.fShortPreamble;
-
-#ifdef WLAN_FEATURE_11AC
-    limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry,NULL);
-#else
     limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
-#endif
-    if( psessionEntry->htCapability)
+
+    if( psessionEntry->htCapabality)
     {
-        pAddStaParams->htCapable = psessionEntry->htCapability;
+        pAddStaParams->htCapable = psessionEntry->htCapabality;
 #ifdef DISABLE_GF_FOR_INTEROP
         /*
          * To resolve the interop problem with Broadcom AP, 
@@ -2560,10 +2410,7 @@
         pAddStaParams->fShortGI40Mhz     = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ);
 #endif
     }
-#ifdef WLAN_FEATURE_11AC
-    pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
-    pAddStaParams->vhtTxChannelWidthSet = pMac->lim.apChanWidth;
-#endif
+
     if(wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
        limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n"));
     pAddStaParams->listenInterval = (tANI_U16)listenInterval;
@@ -2589,7 +2436,7 @@
 
     limLog( pMac, LOGW, FL( "Sending SIR_HAL_ADD_STA_REQ... (aid %d)" ),
           pAddStaParams->assocId);
-  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
@@ -2845,7 +2692,7 @@
         if ( pBPR->HTInfo.present )
             limUpdateStaRunTimeHTInfo( pMac, &pBPR->HTInfo, psessionEntry);
         psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_JOINED_STATE));
 
 #if (WNI_POLARIS_FW_PRODUCT == AP)
         // In case of BP, we need to adopt to all rates
@@ -2968,7 +2815,7 @@
     else
         pDelBssParams->bssIdx          = bssIdx;
     psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_WT_DEL_BSS_RSP_STATE));
 
     pDelBssParams->status= eHAL_STATUS_SUCCESS;
     pDelBssParams->respReqd = 1;
@@ -2983,7 +2830,7 @@
     msgQ.bodyptr = pDelBssParams;
     msgQ.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
@@ -3087,7 +2934,7 @@
 
     pAddBssParams->nwType = bssDescription->nwType;
     
-    pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;
+    pAddBssParams->shortSlotTimeSupported = (tANI_U8)pAssocRsp->capabilityInfo.shortSlotTime;    
     pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;    
     pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
     pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
@@ -3119,7 +2966,7 @@
             else
             {
                 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
-                pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
+                pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
             }
             pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
             pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
@@ -3129,22 +2976,6 @@
 
     pAddBssParams->currentOperChannel = bssDescription->channelId;
 
-#ifdef WLAN_FEATURE_11AC
-    if (psessionEntry->vhtCapability && ( pAssocRsp->VHTCaps.present ))
-    {
-        pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present;
-        pAddBssParams->vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; 
-        pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac, 
-                                           pAddBssParams->currentOperChannel,
-                                           pAddBssParams->currentExtChannel );
-    }
-    else 
-    {
-        pAddBssParams->vhtCapable = 0;
-    }
-#endif
-
-
     // Populate the STA-related parameters here
     // Note that the STA here refers to the AP
     {
@@ -3186,14 +3017,6 @@
                 (chanWidthSupp) )
             {
                 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pAssocRsp->HTInfo.recommendedTxWidthSet;
-                
-#ifdef WLAN_FEATURE_11AC
-                if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
-                {
-                    pAddBssParams->staContext.vhtCapable = 1;
-                    pAddBssParams->staContext.vhtTxChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; //pMac->lim.apChanWidth;
-                }
-#endif
             }
             else
             {
@@ -3272,7 +3095,7 @@
         psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
     else
         psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
     //we need to defer the message until we get the response back from HAL.
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
@@ -3284,7 +3107,7 @@
     msgQ.bodyval = 0;
 
     limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode) 
@@ -3313,17 +3136,10 @@
     tpAddBssParams pAddBssParams = NULL;
     tANI_U32 retCode;
     tANI_U8 i;
-    tSchBeaconStruct *pBeaconStruct;
+    tSchBeaconStruct beaconStruct;
     tANI_U8 chanWidthSupp = 0;
     tpSirBssDescription bssDescription = &psessionEntry->pLimJoinReq->bssDescription;
 
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
-    {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory during ADD_BSS\n") );
-        return eSIR_MEM_ALLOC_FAILED;
-    }
-
 
     // Package SIR_HAL_ADD_BSS_REQ message parameters
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
@@ -3342,10 +3158,10 @@
     limExtractApCapabilities( pMac,
                             (tANI_U8 *) bssDescription->ieFields,
                             limGetIElenFromBssDescription( bssDescription ),
-                            pBeaconStruct );
+                            &beaconStruct );
 
     if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
-        limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
+        limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
         palCopyMemory( pMac->hHdd,  pAddBssParams->bssId,bssDescription->bssId,
                    sizeof( tSirMacAddr ));
 
@@ -3364,77 +3180,62 @@
 
     pAddBssParams->beaconInterval = bssDescription->beaconInterval;
     
-    pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
+    pAddBssParams->dtimPeriod = beaconStruct.tim.dtimPeriod;
     pAddBssParams->updateBss = updateEntry;
 
 
-    pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
-    pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
-    pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
-    pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
+    pAddBssParams->cfParamSet.cfpCount = beaconStruct.cfParamSet.cfpCount;
+    pAddBssParams->cfParamSet.cfpPeriod = beaconStruct.cfParamSet.cfpPeriod;
+    pAddBssParams->cfParamSet.cfpMaxDuration = beaconStruct.cfParamSet.cfpMaxDuration;
+    pAddBssParams->cfParamSet.cfpDurRemaining = beaconStruct.cfParamSet.cfpDurRemaining;
 
 
-    pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
+    pAddBssParams->rateSet.numRates = beaconStruct.supportedRates.numRates;
     palCopyMemory( pMac->hHdd,  pAddBssParams->rateSet.rate,
-                   pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
+                   beaconStruct.supportedRates.rate, beaconStruct.supportedRates.numRates );
 
     pAddBssParams->nwType = bssDescription->nwType;
     
-    pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime; 
+    pAddBssParams->shortSlotTimeSupported = (tANI_U8)beaconStruct.capabilityInfo.shortSlotTime; 
     pAddBssParams->llaCoexist = (tANI_U8) psessionEntry->beaconParams.llaCoexist;
     pAddBssParams->llbCoexist = (tANI_U8) psessionEntry->beaconParams.llbCoexist;
     pAddBssParams->llgCoexist = (tANI_U8) psessionEntry->beaconParams.llgCoexist;
     pAddBssParams->ht20Coexist = (tANI_U8) psessionEntry->beaconParams.ht20Coexist; 
 
     // Use the advertised capabilities from the received beacon/PR
-    if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
+    if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( beaconStruct.HTCaps.present ))
     {
-        pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
+        pAddBssParams->htCapable = beaconStruct.HTCaps.present;
 
-        if ( pBeaconStruct->HTInfo.present )
+        if ( beaconStruct.HTInfo.present )
         {
-            pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
-            pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
+            pAddBssParams->htOperMode = (tSirMacHTOperatingMode)beaconStruct.HTInfo.opMode;
+            pAddBssParams->dualCTSProtection = ( tANI_U8 ) beaconStruct.HTInfo.dualCTSProtection;
 
 #ifdef WLAN_SOFTAP_FEATURE
             chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
 #else 
             chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
 #endif
-            if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
+            if( (beaconStruct.HTCaps.supportedChannelWidthSet) &&
                 (chanWidthSupp) )
             {
-                pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
-                pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
+                pAddBssParams->txChannelWidthSet = ( tANI_U8 ) beaconStruct.HTInfo.recommendedTxWidthSet;
+                pAddBssParams->currentExtChannel = beaconStruct.HTInfo.secondaryChannelOffset;
             }
             else
             {
                 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
-                pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
+                pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
             }
-            pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
-            pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
-            pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
+            pAddBssParams->llnNonGFCoexist = (tANI_U8)beaconStruct.HTInfo.nonGFDevicesPresent;
+            pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)beaconStruct.HTInfo.lsigTXOPProtectionFullSupport;
+            pAddBssParams->fRIFSMode = beaconStruct.HTInfo.rifsMode;
         }
     }
 
     pAddBssParams->currentOperChannel = bssDescription->channelId;
 
-#ifdef WLAN_FEATURE_11AC
-    if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
-    {
-        pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
-        pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth; 
-        pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac, 
-                                           pAddBssParams->currentOperChannel,
-                                           pAddBssParams->currentExtChannel );
-    }
-    else 
-    {
-        pAddBssParams->vhtCapable = 0;
-    }
-#endif
-
     // Populate the STA-related parameters here
     // Note that the STA here refers to the AP
     {
@@ -3448,59 +3249,47 @@
         pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
         pAddBssParams->staContext.uAPSD = 0;
         pAddBssParams->staContext.maxSPLen = 0;
-        pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
+        pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)beaconStruct.capabilityInfo.shortPreamble;
         pAddBssParams->staContext.updateSta = updateEntry;
 
-        if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
+        if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && ( beaconStruct.HTCaps.present ))
         {
             pAddBssParams->staContext.us32MaxAmpduDuration = 0;
             pAddBssParams->staContext.htCapable = 1;
-            pAddBssParams->staContext.greenFieldCapable  = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
-            pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
-            if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
+            pAddBssParams->staContext.greenFieldCapable  = ( tANI_U8 ) beaconStruct.HTCaps.greenField;
+            pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) beaconStruct.HTCaps.lsigTXOPProtection;
+            if( (beaconStruct.HTCaps.supportedChannelWidthSet) &&
                 (chanWidthSupp) )
             {
-                pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
-          #ifdef WLAN_FEATURE_11AC
-                if (psessionEntry->vhtCapability && ( pBeaconStruct->VHTCaps.present ))
-                {
-                    pAddBssParams->staContext.vhtCapable = 1;
-                    pAddBssParams->staContext.vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth; 
-                }
-          #endif
+                pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )beaconStruct.HTInfo.recommendedTxWidthSet;
             }
             else
             {
                 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
             }                                                           
-            pAddBssParams->staContext.mimoPS             = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
-            pAddBssParams->staContext.delBASupport       = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
-            pAddBssParams->staContext.maxAmsduSize       = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
-            pAddBssParams->staContext.maxAmpduDensity    =             pBeaconStruct->HTCaps.mpduDensity;
-            pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
-            pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
-            pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
-            pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
+            pAddBssParams->staContext.mimoPS             = (tSirMacHTMIMOPowerSaveState)beaconStruct.HTCaps.mimoPowerSave;
+            pAddBssParams->staContext.delBASupport       = ( tANI_U8 ) beaconStruct.HTCaps.delayedBA;
+            pAddBssParams->staContext.maxAmsduSize       = ( tANI_U8 ) beaconStruct.HTCaps.maximalAMSDUsize;
+            pAddBssParams->staContext.maxAmpduDensity    =             beaconStruct.HTCaps.mpduDensity;
+            pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)beaconStruct.HTCaps.dsssCckMode40MHz;
+            pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)beaconStruct.HTCaps.shortGI20MHz;
+            pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)beaconStruct.HTCaps.shortGI40MHz;
+            pAddBssParams->staContext.maxAmpduSize= beaconStruct.HTCaps.maxRxAMPDUFactor;
             
-            if( pBeaconStruct->HTInfo.present )
-                pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
+            if( beaconStruct.HTInfo.present )
+                pAddBssParams->staContext.rifsMode = beaconStruct.HTInfo.rifsMode;
         }
 
-        if ((psessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
-                (psessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
+        if ((psessionEntry->limWmeEnabled && beaconStruct.wmeEdcaPresent) ||
+                (psessionEntry->limQosEnabled && beaconStruct.edcaPresent))
             pAddBssParams->staContext.wmmEnabled = 1;
         else 
             pAddBssParams->staContext.wmmEnabled = 0;
 
         //Update the rates
-#ifdef WLAN_FEATURE_11AC
+        
         limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates, 
-                                        pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry,
-                                        &pBeaconStruct->VHTCaps);
-#else
-        limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates, 
-                                        pBeaconStruct->HTCaps.supportedMCSSet, false,psessionEntry);
-#endif
+                                                    beaconStruct.HTCaps.supportedMCSSet, false,psessionEntry);
         limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,psessionEntry);
 
     }
@@ -3541,7 +3330,7 @@
     //pMac->lim.gLimMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
     psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE;
     
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
     //we need to defer the message until we get the response back from HAL.
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
@@ -3553,7 +3342,7 @@
     msgQ.bodyval = 0;
 
     limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode) 
@@ -3566,14 +3355,10 @@
 
     }
     else
-    {
-        palFreeMemory(pMac->hHdd, pBeaconStruct);    
         return retCode;
-    }
 
  returnFailure:
     // Clean-up will be done by the caller...
-    palFreeMemory(pMac->hHdd, pBeaconStruct);
     return retCode;
 }
 
@@ -3663,7 +3448,7 @@
             else
             {
                 pAddBssParams->txChannelWidthSet = (tANI_U8)pAssocRsp->HTCaps.supportedChannelWidthSet;
-                pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
+                pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
             }
             pAddBssParams->llnNonGFCoexist = (tANI_U8)pAssocRsp->HTInfo.nonGFDevicesPresent;
             pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pAssocRsp->HTInfo.lsigTXOPProtectionFullSupport;
@@ -3760,7 +3545,7 @@
         psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE;
     else
         psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
     //we need to defer the message until we get the response back from HAL.
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
@@ -3772,7 +3557,7 @@
     msgQ.bodyval = 0;
 
     limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     retCode = halPostMsgApi( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode) 
@@ -3833,7 +3618,7 @@
     if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
     {
         psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
     }
 
     limSendDelStaCnf(pMac, staDsAddr, staDsAssocId, mlmStaContext, statusCode,psessionEntry);
@@ -3857,10 +3642,6 @@
                 return eSTA_11bg;
             case WNI_CFG_DOT11_MODE_11N:
                 return eSTA_11n;
-#ifdef WLAN_FEATURE_11AC
-            case WNI_CFG_DOT11_MODE_11AC:
-                return eSTA_11ac;
-#endif
             case WNI_CFG_DOT11_MODE_ALL:
             default:
                 return eSTA_11n;           
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.h
index af6dfa9..a46f7ab 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -59,42 +59,18 @@
                                      tANI_U8 , tAniAuthType,
                                      tANI_U16, tANI_U8, tSirResultCodes, tpPESession);
 
-#ifdef WLAN_FEATURE_11AC
-tSirRetStatus limPopulateOwnRateSet(tpAniSirGlobal pMac,
-                                         tpSirSupportedRates pRates,
-                                         tANI_U8* pSupportedMCSSet,
-                                         tANI_U8 basicOnly,
-                                         tpPESession psessionEntry,
-                                         tDot11fIEVHTCaps *pVHTCaps);
-
-#else
 tSirRetStatus limPopulateOwnRateSet(tpAniSirGlobal pMac,
                                                                 tpSirSupportedRates pRates,
                                                                 tANI_U8* pSupportedMCSSet,
                                                                 tANI_U8 basicOnly,
                                                                 tpPESession psessionEntry);
-#endif
 
-#ifdef WLAN_FEATURE_11AC
-tSirRetStatus
-limPopulateMatchingRateSet(tpAniSirGlobal pMac,
-                           tpDphHashNode pStaDs,
-                           tSirMacRateSet *pOperRateSet,
-                           tSirMacRateSet *pExtRateSet,
-                           tANI_U8* pSupportedMCSSet,
-                           tSirMacPropRateSet *pAniLegRateSet,
-                           tpPESession  psessionEntry,
-                           tDot11fIEVHTCaps *pVHTCaps);
-#else
 tSirRetStatus   limPopulateMatchingRateSet(tpAniSirGlobal,
                                            tpDphHashNode,
                                            tSirMacRateSet *,
                                            tSirMacRateSet *,
                                            tANI_U8* pSupportedMCSSet,
                                            tSirMacPropRateSet *, tpPESession);
-
-
-#endif
 tSirRetStatus   limAddSta(tpAniSirGlobal, tpDphHashNode,tpPESession);
 tSirRetStatus   limDelBss(tpAniSirGlobal, tpDphHashNode, tANI_U16, tpPESession);
 tSirRetStatus   limDelSta(tpAniSirGlobal, tpDphHashNode, tANI_BOOLEAN, tpPESession);
@@ -110,9 +86,6 @@
 void            limRestorePreReassocState(tpAniSirGlobal,
                                           tSirResultCodes,
                                           tANI_U16,tpPESession); 
-void            limPostReassocFailure(tpAniSirGlobal,
-                                      tSirResultCodes,
-                                      tANI_U16,tpPESession);
 eAniBoolean     limIsReassocInProgress(tpAniSirGlobal,tpPESession);
 void
 limSendDelStaCnf(tpAniSirGlobal pMac, tSirMacAddr staDsAddr,
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limDebug.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limDebug.c
index 817771d..bece3ae 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limDebug.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limDebug.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limDebug.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limDebug.h
index d6b49f8..9715fb6 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limDebug.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limDebug.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limFT.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limFT.c
index 8c3d349..37cf607 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limFT.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limFT.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -266,15 +266,13 @@
     if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum) 
     {
         // Need to suspend link only if the channels are different
-        PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
-               " channel (session %p)\n", __FUNCTION__, psessionEntry);)
-        limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler, 
+        limSuspendLink(pMac, eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN, FTPreAuthSuspendLinkHandler, 
                        (tANI_U32 *)psessionEntry); 
     }
     else 
     {
-        PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
-               " channel (session %p)\n", __FUNCTION__, psessionEntry);)
+        PELOGE(limLog( pMac, LOGE, "%s: Performing pre-auth on same channel\n", 
+            __FUNCTION__);)
         // We are in the same channel. Perform pre-auth
         limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
     }
@@ -308,9 +306,7 @@
     pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
 
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
-    PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
-           " (old session %p)\n", 
-           pMac->ft.ftPEContext.psavedsessionEntry);)
+    PELOGE(limLog( pMac, LOGE, "Entered wait auth2 state for FT\n");)
 #endif
 
 
@@ -320,7 +316,7 @@
         // receive Auth2.
         authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
     }
-#if defined FEATURE_WLAN_CCX || defined FEATURE_WLAN_LFR
+#if defined FEATURE_WLAN_CCX
     else
     {
         // Will need to make isCCXconnection a enum may be for further
@@ -366,20 +362,13 @@
     tpAddBssParams pAddBssParams = NULL;
     tANI_U8 i;
     tANI_U8 chanWidthSupp = 0;
-    tSchBeaconStruct *pBeaconStruct;
+    tSchBeaconStruct beaconStruct;
 
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
-    {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating ADD_BSS\n") );
-        return eSIR_MEM_ALLOC_FAILED;
-    }
 
     // Package SIR_HAL_ADD_BSS_REQ message parameters
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
         (void **) &pAddBssParams, sizeof( tAddBssParams )))
     {
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
         limLog( pMac, LOGP,
                 FL( "Unable to PAL allocate memory for creating ADD_BSS\n" ));
         return (eSIR_MEM_ALLOC_FAILED);
@@ -390,10 +379,10 @@
 
     limExtractApCapabilities( pMac,
         (tANI_U8 *) bssDescription->ieFields,
-        limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
+        limGetIElenFromBssDescription( bssDescription ), &beaconStruct );
 
     if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
-        limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
+        limDecideStaProtectionOnAssoc(pMac, &beaconStruct, pftSessionEntry);
 
     palCopyMemory( pMac->hHdd, pAddBssParams->bssId, bssDescription->bssId,
         sizeof( tSirMacAddr ));
@@ -407,57 +396,57 @@
 
     pAddBssParams->beaconInterval = bssDescription->beaconInterval;
     
-    pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
+    pAddBssParams->dtimPeriod = beaconStruct.tim.dtimPeriod;
     pAddBssParams->updateBss = updateEntry;
 
 
-    pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
-    pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
-    pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
-    pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
+    pAddBssParams->cfParamSet.cfpCount = beaconStruct.cfParamSet.cfpCount;
+    pAddBssParams->cfParamSet.cfpPeriod = beaconStruct.cfParamSet.cfpPeriod;
+    pAddBssParams->cfParamSet.cfpMaxDuration = beaconStruct.cfParamSet.cfpMaxDuration;
+    pAddBssParams->cfParamSet.cfpDurRemaining = beaconStruct.cfParamSet.cfpDurRemaining;
 
 
-    pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
+    pAddBssParams->rateSet.numRates = beaconStruct.supportedRates.numRates;
     palCopyMemory( pMac->hHdd,  pAddBssParams->rateSet.rate,
-                   pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
+                   beaconStruct.supportedRates.rate, beaconStruct.supportedRates.numRates );
 
     pAddBssParams->nwType = bssDescription->nwType;
     
-    pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime; 
+    pAddBssParams->shortSlotTimeSupported = (tANI_U8)beaconStruct.capabilityInfo.shortSlotTime; 
     pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
     pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
     pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
     pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
 
     // Use the advertised capabilities from the received beacon/PR
-    if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
+    if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( beaconStruct.HTCaps.present ))
     {
-        pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
+        pAddBssParams->htCapable = beaconStruct.HTCaps.present;
 
-        if ( pBeaconStruct->HTInfo.present )
+        if ( beaconStruct.HTInfo.present )
         {
-            pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
-            pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
+            pAddBssParams->htOperMode = (tSirMacHTOperatingMode)beaconStruct.HTInfo.opMode;
+            pAddBssParams->dualCTSProtection = ( tANI_U8 ) beaconStruct.HTInfo.dualCTSProtection;
 
 #ifdef WLAN_SOFTAP_FEATURE
             chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
 #else 
             chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
 #endif
-            if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
+            if( (beaconStruct.HTCaps.supportedChannelWidthSet) &&
                 (chanWidthSupp) )
             {
-                pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
-                pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
+                pAddBssParams->txChannelWidthSet = ( tANI_U8 ) beaconStruct.HTInfo.recommendedTxWidthSet;
+                pAddBssParams->currentExtChannel = beaconStruct.HTInfo.secondaryChannelOffset;
             }
             else
             {
                 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
-                pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
+                pAddBssParams->currentExtChannel = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
             }
-            pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
-            pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
-            pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
+            pAddBssParams->llnNonGFCoexist = (tANI_U8)beaconStruct.HTInfo.nonGFDevicesPresent;
+            pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)beaconStruct.HTInfo.lsigTXOPProtectionFullSupport;
+            pAddBssParams->fRIFSMode = beaconStruct.HTInfo.rifsMode;
         }
     }
 
@@ -482,53 +471,48 @@
         pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
         pAddBssParams->staContext.uAPSD = 0;
         pAddBssParams->staContext.maxSPLen = 0;
-        pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
+        pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)beaconStruct.capabilityInfo.shortPreamble;
         pAddBssParams->staContext.updateSta = updateEntry;
         pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
 
-        if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
+        if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( beaconStruct.HTCaps.present ))
         {
             pAddBssParams->staContext.us32MaxAmpduDuration = 0;
             pAddBssParams->staContext.htCapable = 1;
-            pAddBssParams->staContext.greenFieldCapable  = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
-            pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
-            if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
+            pAddBssParams->staContext.greenFieldCapable  = ( tANI_U8 ) beaconStruct.HTCaps.greenField;
+            pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) beaconStruct.HTCaps.lsigTXOPProtection;
+            if( (beaconStruct.HTCaps.supportedChannelWidthSet) &&
                 (chanWidthSupp) )
             {
-                pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
+                pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )beaconStruct.HTInfo.recommendedTxWidthSet;
             }
             else
             {
                 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
             }                                                           
-            pAddBssParams->staContext.mimoPS             = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
-            pAddBssParams->staContext.delBASupport       = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
-            pAddBssParams->staContext.maxAmsduSize       = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
-            pAddBssParams->staContext.maxAmpduDensity    =             pBeaconStruct->HTCaps.mpduDensity;
-            pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
-            pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
-            pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
-            pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
+            pAddBssParams->staContext.mimoPS             = (tSirMacHTMIMOPowerSaveState)beaconStruct.HTCaps.mimoPowerSave;
+            pAddBssParams->staContext.delBASupport       = ( tANI_U8 ) beaconStruct.HTCaps.delayedBA;
+            pAddBssParams->staContext.maxAmsduSize       = ( tANI_U8 ) beaconStruct.HTCaps.maximalAMSDUsize;
+            pAddBssParams->staContext.maxAmpduDensity    =             beaconStruct.HTCaps.mpduDensity;
+            pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)beaconStruct.HTCaps.dsssCckMode40MHz;
+            pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)beaconStruct.HTCaps.shortGI20MHz;
+            pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)beaconStruct.HTCaps.shortGI40MHz;
+            pAddBssParams->staContext.maxAmpduSize= beaconStruct.HTCaps.maxRxAMPDUFactor;
             
-            if( pBeaconStruct->HTInfo.present )
-                pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
+            if( beaconStruct.HTInfo.present )
+                pAddBssParams->staContext.rifsMode = beaconStruct.HTInfo.rifsMode;
         }
 
-        if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
-                (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
+        if ((pftSessionEntry->limWmeEnabled && beaconStruct.wmeEdcaPresent) ||
+                (pftSessionEntry->limQosEnabled && beaconStruct.edcaPresent))
             pAddBssParams->staContext.wmmEnabled = 1;
         else 
             pAddBssParams->staContext.wmmEnabled = 0;
 
         //Update the rates
-#ifdef WLAN_FEATURE_11AC
-        limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates, 
-                             pBeaconStruct->HTCaps.supportedMCSSet, 
-                             false,pftSessionEntry,&pBeaconStruct->VHTCaps);
-#else
+        
         limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates, 
                                                     beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
-#endif
         limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
 
     }
@@ -565,7 +549,6 @@
     limLog( pMac, LOGE, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
 #endif
 
-    palFreeMemory(pMac->hHdd, pBeaconStruct);
     return 0;
 }
 
@@ -583,25 +566,16 @@
     tANI_U8          sessionId;
     tPowerdBm        localPowerConstraint;
     tPowerdBm        regMax;
-    tSchBeaconStruct *pBeaconStruct;
-
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
-    {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating limFillFTSession\n") );
-        return NULL;
-    }
-
+    tSchBeaconStruct beaconStruct;
 
     if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
         &sessionId, pMac->lim.maxStation)) == NULL)
     {
         limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP\n"));
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
         return NULL;
     }
         
-#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX
     limPrintMacAddr(pMac, pbssDescription->bssId, LOGE);
 #endif
 
@@ -609,7 +583,7 @@
     pftSessionEntry->peSessionId = sessionId;
 
     pftSessionEntry->dot11mode = psessionEntry->dot11mode;
-    pftSessionEntry->htCapability = psessionEntry->htCapability;
+    pftSessionEntry->htCapabality = psessionEntry->htCapabality;
 
     pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
     pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
@@ -624,26 +598,26 @@
     limExtractApCapabilities( pMac,
                             (tANI_U8 *) pbssDescription->ieFields,
                             limGetIElenFromBssDescription( pbssDescription ),
-                            pBeaconStruct );
+                            &beaconStruct );
 
-    pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
+    pftSessionEntry->rateSet.numRates = beaconStruct.supportedRates.numRates;
     palCopyMemory( pMac->hHdd,  pftSessionEntry->rateSet.rate,
-        pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
+        beaconStruct.supportedRates.rate, beaconStruct.supportedRates.numRates );
 
-    pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
+    pftSessionEntry->extRateSet.numRates = beaconStruct.extendedRates.numRates;
     palCopyMemory(pMac->hHdd, pftSessionEntry->extRateSet.rate, 
-        pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
+        beaconStruct.extendedRates.rate, pftSessionEntry->extRateSet.numRates);
 
 
-    pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
-    palCopyMemory( pMac->hHdd, pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
+    pftSessionEntry->ssId.length = beaconStruct.ssId.length;
+    palCopyMemory( pMac->hHdd, pftSessionEntry->ssId.ssId, beaconStruct.ssId.ssId,
         pftSessionEntry->ssId.length);
 
 
     // Self Mac
     sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
     sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
-#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX
     limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOGE);
 #endif
 
@@ -675,6 +649,11 @@
                        
     pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
     pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
+            
+    pftSessionEntry->limCurrentTitanHtCaps=
+                    pbssDescription->titanHtCaps;
+    pftSessionEntry->limReassocTitanHtCaps=
+        pftSessionEntry->limCurrentTitanHtCaps;
 
     regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel ); 
     localPowerConstraint = regMax;
@@ -705,11 +684,10 @@
     pftSessionEntry->encryptType = psessionEntry->encryptType;
 
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
-    PELOGE(limLog(pMac,LOGE,"%s:created session (%p) with id = %d\n", 
-       __FUNCTION__, pftSessionEntry, pftSessionEntry->peSessionId);)
+    PELOGE(limLog( pMac, LOGE, "%s: Created session with the id = %d\n", 
+       __FUNCTION__, pftSessionEntry->peSessionId);)
 #endif
 
-    palFreeMemory(pMac->hHdd, pBeaconStruct);
     return pftSessionEntry;
 }
 
@@ -731,13 +709,9 @@
 #ifdef FEATURE_WLAN_CCX
         pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
 #endif
-#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
         pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
 #endif
-
-#ifdef FEATURE_WLAN_LFR
-        pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled; 
-#endif
         limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry, 
             pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
         pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
@@ -1104,7 +1078,7 @@
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
     limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
 #endif
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if( eSIR_SUCCESS != retCode) 
@@ -1293,7 +1267,7 @@
      * WDA_AGGR_QOS_RSP from HAL.
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
 
     if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
     {
@@ -1435,9 +1409,6 @@
 #ifdef FEATURE_WLAN_CCX
            || (pMac->lim.gpSession[sessionId].isCCXconnection)
 #endif
-#ifdef FEATURE_WLAN_LFR
-           || (pMac->lim.gpSession[sessionId].isFastRoamIniFeatureEnabled)
-#endif
            )&& 
             pMac->lim.gpSession[sessionId].isFastTransitionEnabled))
         {
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
index d980ded..e98aeae 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -325,16 +325,10 @@
     tLimIbssPeerNode *pPeer,
     tpPESession       psessionEntry)
 {
-#ifdef WLAN_FEATURE_11AC
-    limPopulateMatchingRateSet(pMac, pStaDs, &pPeer->supportedRates,
-                               &pPeer->extendedRates, pPeer->supportedMCSSet,
-                               &pStaDs->mlmStaContext.propRateSet,psessionEntry,NULL);
-#else
     // Populate supported rateset
     limPopulateMatchingRateSet(pMac, pStaDs, &pPeer->supportedRates,
                                &pPeer->extendedRates, pPeer->supportedMCSSet,
                                &pStaDs->mlmStaContext.propRateSet,psessionEntry);
-#endif
 
     pStaDs->mlmStaContext.capabilityInfo = pPeer->capabilityInfo;
 } /*** end ibss_sta_info_update() ***/
@@ -556,10 +550,20 @@
      * so that the IBSS doesnt blindly start with short slot = 1. If IBSS start is part of coalescing then it will adapt
      * to peer's short slot using code below.
      */
-    /* If cfg is already set to current peer's capability then no need to set it again */
-    if (psessionEntry->shortSlotTimeSupported != pBeacon->capabilityInfo.shortSlotTime)
+    if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &cfg)
+                   != eSIR_SUCCESS)
     {
-        psessionEntry->shortSlotTimeSupported = pBeacon->capabilityInfo.shortSlotTime;
+        limLog(pMac, LOGP, FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
+        return;
+    }
+    /* If cfg is already set to current peer's capability then no need to set it again */
+    if (cfg != pBeacon->capabilityInfo.shortSlotTime)
+    {
+        if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, pBeacon->capabilityInfo.shortSlotTime) != eSIR_SUCCESS)
+        {
+            limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
+            return;
+        }
     }
     palCopyMemory( pMac->hHdd,
        (tANI_U8 *) &psessionEntry->pLimStartBssReq->operationalRateSet,
@@ -611,10 +615,10 @@
     mlmStartReq.bssType             = eSIR_IBSS_MODE;
     mlmStartReq.beaconPeriod        = pBeacon->beaconInterval;
     mlmStartReq.nwType              = psessionEntry->pLimStartBssReq->nwType; //psessionEntry->nwType is also OK????
-    mlmStartReq.htCapable           = psessionEntry->htCapability;
+    mlmStartReq.htCapable           = psessionEntry->htCapabality;
     mlmStartReq.htOperMode          = pMac->lim.gHTOperMode;
     mlmStartReq.dualCTSProtection   = pMac->lim.gHTDualCTSProtection;
-    mlmStartReq.txChannelWidthSet   = psessionEntry->htRecommendedTxWidthSet;
+    mlmStartReq.txChannelWidthSet   = pMac->lim.gHTRecommendedTxWidthSet;
 
     #if 0
     if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &cfg) != eSIR_SUCCESS)
@@ -1002,7 +1006,7 @@
         limGetPhyMode(pMac, &phyMode, psessionEntry);
 
         //We are 11G or 11n. Check if we need protection from 11b Stations.
-        if ((phyMode == WNI_CFG_PHY_MODE_11G) || (psessionEntry->htCapability))
+        if ((phyMode == WNI_CFG_PHY_MODE_11G) || (pMac->lim.htCapability))
         {
             /* As we found in the past, it is possible that a 11n STA sends
              * Beacon with HT IE but not ERP IE.  So the absense of ERP IE
@@ -1311,14 +1315,18 @@
     limIbssDelete(pMac,psessionEntry);
     psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
     psessionEntry->limSystemRole = eLIM_STA_ROLE;
 
     /* Change the short slot operating mode to Default (which is 1 for now) so that when IBSS starts next time with Libra
      * as originator, it picks up the default. This enables us to remove hard coding of short slot = 1 from limApplyConfiguration 
      */
-    psessionEntry->shortSlotTimeSupported = WNI_CFG_SHORT_SLOT_TIME_STADEF;
+    if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, WNI_CFG_SHORT_SLOT_TIME_STADEF) != eSIR_SUCCESS)
+    {
+        limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
+        return;
+    }
 
     end:
     if(pDelBss != NULL)
@@ -1473,7 +1481,7 @@
         psessionEntry->limIbssActive = true;
         limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_IBSS_ACTIVE, NULL, 0, psessionEntry->smeSessionId);
         limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
         if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
             limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
     }
@@ -1628,7 +1636,7 @@
         limGetPhyMode(pMac, &phyMode, psessionEntry);
         erpEnabled = pStaDs->erpEnabled;
         //we are HT or 11G and 11B station is getting deleted.
-        if ( ((phyMode == WNI_CFG_PHY_MODE_11G) || psessionEntry->htCapability)
+        if ( ((phyMode == WNI_CFG_PHY_MODE_11G) || pMac->lim.htCapability) 
               && (erpEnabled == eHAL_CLEAR))
         {
             PELOGE(limLog(pMac, LOGE, FL("(%d) A legacy STA is disassociated. Addr is "),
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.h
index b10a5ca..4b3a39f 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limIbssPeerMgmt.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
index 22128c0..f9c103b 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -172,19 +172,11 @@
             case HAL_DEL_STA_REASON_CODE_KEEP_ALIVE:
             case HAL_DEL_STA_REASON_CODE_TIM_BASED:
                 PELOGE(limLog(pMac, LOGE, FL(" Deleting station: staId = %d, reasonCode = %d\n"), pMsg->staId, pMsg->reasonCode);)
-#endif
-                if((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) ||
-                   (eLIM_AP_ROLE == psessionEntry->limSystemRole))
-                {
-                    pStaDs = dphGetHashEntry(pMac, pMsg->assocId, &psessionEntry->dph.dphHashTable);
-                }
-                else
-                {
-                    pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
-                }
+#endif        
+                pStaDs = dphGetHashEntry(pMac, pMsg->assocId, &psessionEntry->dph.dphHashTable);
                 if (! pStaDs)
                 {
-                   PELOGE(limLog(pMac, LOGE, FL("Skip STA deletion (invalid STA) limSystemRole=%d\n"),psessionEntry->limSystemRole);)
+                   PELOGW(limLog(pMac, LOGW, FL("Skip STA deletion (invalid STA)\n"));)
                    palFreeMemory(pMac->hHdd, pMsg);
                    return;
                 }
@@ -194,7 +186,7 @@
                 */
                 if (pStaDs->staIndex != pMsg->staId)
                 {
-                    PELOGE(limLog(pMac, LOGE, FL("staid mismatch: %d vs %d \n"), pStaDs->staIndex, pMsg->staId);)
+                    PELOGW(limLog(pMac, LOGW, FL("staid mismatch: %d vs %d \n"), pStaDs->staIndex, pMsg->staId);)
                     palFreeMemory(pMac->hHdd, pMsg);
                     return;
                 }
@@ -210,7 +202,7 @@
                 {
                     //TearDownLink with AP
                     tLimMlmDeauthInd  mlmDeauthInd;
-                    PELOGW(limLog(pMac, LOGW, FL("lim Delete Station Context (staId: %d, assocId: %d) \n"),
+                    PELOG1(limLog(pMac, LOG1, FL("lim Delete Station Context (staId: %d, assocId: %d) \n"),
                                   pMsg->staId, pMsg->assocId);)
 
                     pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
@@ -306,12 +298,12 @@
     pLen = pBuf;
     pBuf += sizeof(tANI_U16);
     msgLength += sizeof(tANI_U16);
-
+    
     //sessionId
-    *pBuf = psessionEntry->smeSessionId;
+    *pBuf = psessionEntry->peSessionId;
     pBuf++;
     msgLength++;
-
+  
     //transactionId
     limCopyU16((tANI_U8*)pBuf, psessionEntry->transactionId);
     pBuf += sizeof(tANI_U16);
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limLogDump.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limLogDump.c
index 06f14ef..8271119 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limLogDump.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limLogDump.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -83,7 +83,7 @@
 #endif
 
 
-char *dumpLim( tpAniSirGlobal pMac, char *p, tANI_U32 sessionId)
+char *dumpLim( tpAniSirGlobal pMac, char *p )
 {
   #ifdef FIXME_GEN6
   //iterate through the sessionTable and dump sta entries for each session.
@@ -91,13 +91,6 @@
 
   tANI_U16 i, j;
 
-  tpPESession psessionEntry = peFindSessionBySessionId(pMac, sessionId);
-
-  if (psessionEntry == NULL)
-  {
-    p += log_sprintf( pMac, p, "Invalid sessionId: %d \n ", sessionId);
-    return p;
-  }
 
   p += log_sprintf( pMac,p, "\n ----- LIM Debug Information ----- \n");
   p += log_sprintf( pMac,p, "LIM Role  = (%d) %s\n",
@@ -106,8 +99,11 @@
                   pMac->lim.gLimSmeState, limSmeStateStr(pMac->lim.gLimSmeState));
   p += log_sprintf( pMac,p, "MLM State = (%d) %s",
                   pMac->lim.gLimMlmState, limMlmStateStr(pMac->lim.gLimMlmState));
-  p += log_sprintf( pMac,p, "802.11n session HT Capability: %s\n",
-                  (psessionEntry->htCapability == 1) ? "Enabled" : "Disabled");
+
+  p += log_sprintf( pMac,p, "CHANNEL BONDING Mode (%1d) and State (X|X|X|AU|CS|U/D|O|A) (0x%1x)\n",
+                  pMac->lim.gCbMode, pMac->lim.gCbState);
+  p += log_sprintf( pMac,p, "802.11n HT Capability: %s\n",
+                  (pMac->lim.htCapability == 1) ? "Enabled" : "Disabled");
   p += log_sprintf( pMac,p, "gLimProcessDefdMsgs: %s\n",
                   (pMac->lim.gLimProcessDefdMsgs == 1) ? "Enabled" : "Disabled");
 
@@ -135,6 +131,10 @@
 
       p += log_sprintf( pMac,p, "Num of Hash Miss Event ignored             = %d\n",
                       pMac->lim.gLimNumHashMissIgnored);
+
+
+
+
   }
 
   p += log_sprintf( pMac,p, "Num of RxCleanup Count                     = %d\n",
@@ -152,6 +152,11 @@
   p += log_sprintf( pMac,p, "No. of Beacons Rxed During HB Interval     = %d\n",
                   pMac->lim.gLimRxedBeaconCntDuringHB);
   p += log_sprintf( pMac,p, "Self Operating Mode                              = %s\n", limDot11ModeStr(pMac, (tANI_U8)pMac->lim.gLimDot11Mode));
+
+
+
+
+
   p += log_sprintf( pMac,p, "\n");
 
   if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
@@ -344,13 +349,16 @@
             p += log_sprintf( pMac,p, "\n");
         }
     }
+
+
 #endif
     p += log_sprintf( pMac, p, "HT operating Mode = %d, llbCoexist = %d, llgCoexist = %d, ht20Coexist = %d, nonGfPresent = %d, RifsMode = %d, lsigTxop = %d\n",
                       pMac->lim.gHTOperMode, pMac->lim.llbCoexist, pMac->lim.llgCoexist,
                       pMac->lim.ht20MhzCoexist, pMac->lim.gHTNonGFDevicesPresent,
                       pMac->lim.gHTRifsMode, pMac->lim.gHTLSigTXOPFullSupport);
+
     p += log_sprintf(pMac, p, "2nd Channel offset = %d\n",
-                  psessionEntry->hHTSecondaryChannelOffset);
+                  pMac->lim.gHTSecondaryChannelOffset);
 #endif
     return p;
 }
@@ -370,7 +378,7 @@
     tSirMsgQ mesg = { (tANI_U16) SIR_LIM_BEACON_GEN_IND, (tANI_U16) 0, (tANI_U32) 0 };
     
     pMac->lim.gLimSmeState = eLIM_SME_NORMAL_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
     pMac->lim.gLimSystemRole = eLIM_AP_ROLE;
     
     p += log_sprintf( pMac, p,
@@ -538,7 +546,7 @@
     tSirMsgQ  msg;
     tSirSmeStartBssReq  *pStartBssReq;
     unsigned char *pBuf;
-    ePhyChanBondState  cbMode;
+    tAniCBSecondaryMode  cbMode;
     tSirNwType  nwType;
 
     p += log_sprintf( pMac,p, "sendSmeStartBssReq: Preparing eWNI_SME_START_BSS_REQ message\n");
@@ -584,9 +592,9 @@
     pBuf++;
 
     // Filling in CB mode
-    cbMode = PHY_SINGLE_CHANNEL_CENTERED;
-    palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(ePhyChanBondState) );
-    pBuf += sizeof(ePhyChanBondState);
+    cbMode = eANI_CB_SECONDARY_NONE;
+    palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(tAniCBSecondaryMode) );
+    pBuf += sizeof(tAniCBSecondaryMode);
 
     // Filling in RSN IE Length to zero
     palZeroMemory( pMac->hHdd, pBuf, sizeof(tANI_U16) );    //tSirRSNie->length
@@ -758,7 +766,7 @@
             p += log_sprintf( pMac,p, "bssType: (%d) %s \n", psessionEntry->bssType, limBssTypeStr(psessionEntry->bssType));
             p += log_sprintf( pMac,p, "operMode: %d \n", psessionEntry->operMode);
             p += log_sprintf( pMac,p, "dot11mode: %d \n", psessionEntry->dot11mode);
-            p += log_sprintf( pMac,p, "htCapability: %d \n", psessionEntry->htCapability);
+            p += log_sprintf( pMac,p, "htCapabality: %d \n", psessionEntry->htCapabality);
             p += log_sprintf( pMac,p, "limRFBand: %d \n", psessionEntry->limRFBand);
             p += log_sprintf( pMac,p, "limIbssActive: %d \n", psessionEntry->limIbssActive);
             p += log_sprintf( pMac,p, "limCurrentAuthType: %d \n", psessionEntry->limCurrentAuthType);
@@ -774,6 +782,7 @@
             p += log_sprintf( pMac,p, "limReassocBssCaps: %d \n", psessionEntry->limReassocBssCaps);
             p += log_sprintf( pMac,p, "limReassocBssQosCaps: %d \n", psessionEntry->limReassocBssQosCaps);
             p += log_sprintf( pMac,p, "limReassocBssPropCap: %d \n", psessionEntry->limReassocBssPropCap);
+            p += log_sprintf( pMac,p, "limReassocTitanHtCaps: %d \n", psessionEntry->limReassocTitanHtCaps);
             p += log_sprintf( pMac,p, "********************************************\n");
         }
     }
@@ -1490,37 +1499,30 @@
 static char* dump_lim_update_cb_Mode(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
 {
     tANI_U32 localPwrConstraint;
-    tpPESession psessionEntry = peFindSessionBySessionId(pMac, arg1);
-
-    if (psessionEntry == NULL)
-    {
-      p += log_sprintf( pMac, p, "Invalid sessionId: %d \n ", arg1);
-      return p;
-    }
-
-    if ( !psessionEntry->htCapability )
+    tpPESession psessionEntry = &pMac->lim.gpSession[0];  //TBD-RAJESH HOW TO GET sessionEntry?????
+    
+    if ( !pMac->lim.htCapability )
     {
         p += log_sprintf( pMac,p, "Error: Dot11 mode is non-HT, can not change the CB mode.\n");
         return p;
     }
-
-    psessionEntry->htSupportedChannelWidthSet = arg2?1:0;
-    psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
-    psessionEntry->htSecondaryChannelOffset = arg2;
+    
+    pMac->lim.gHTSecondaryChannelOffset = arg1;
+    setupCBState(pMac,  limGetAniCBState(pMac->lim.gHTSecondaryChannelOffset));
 
     if(eSIR_SUCCESS != cfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE,  
-                                    arg2 ? WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE))
+                                    arg1 ? WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE))
         p += log_sprintf(pMac,p, "cfgSetInt failed for WNI_CFG_CHANNEL_BONDING_MODE\n");
-
+    
     wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint);
-
-    limSendSwitchChnlParams(pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset,
+        
+    limSendSwitchChnlParams(pMac, psessionEntry->currentOperChannel, pMac->lim.gHTSecondaryChannelOffset,
                                                                   (tPowerdBm) localPwrConstraint, psessionEntry->peSessionId);
     if ( (limGetSystemRole(psessionEntry) == eLIM_AP_ROLE) ||
           (limGetSystemRole(psessionEntry) == eLIM_STA_IN_IBSS_ROLE))
            schSetFixedBeaconFields(pMac,psessionEntry);
     return p;
-
+    
 }
 
 static char* dump_lim_abort_scan(tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
@@ -1710,7 +1712,6 @@
 static char *
 dump_lim_dot11h_stats( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
 {
-#if 0
     unsigned int i;
     (void) arg1; (void) arg2; (void) arg3; (void) arg4;
 
@@ -1779,7 +1780,6 @@
     }
     p += log_sprintf(pMac, p, "\n");
     
-#endif
     return p;
 }
 
@@ -1806,7 +1806,7 @@
 dump_lim_enable_quietIE( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
 {
     (void) arg2; (void) arg3; (void) arg4;
-#if 0
+
     if (arg1)
     {
         pMac->lim.gLimSpecMgmt.fQuietEnabled = eANI_BOOLEAN_TRUE;
@@ -1817,7 +1817,6 @@
         pMac->lim.gLimSpecMgmt.fQuietEnabled = eANI_BOOLEAN_FALSE;
         p += log_sprintf(pMac, p, "QuietIE disabled\n");
     }
-#endif
 
     return p;
 }
@@ -1859,8 +1858,8 @@
 static char *
 dump_lim_info( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
 {
-    (void) arg2; (void) arg3; (void) arg4;
-    p = dumpLim( pMac, p, arg1);
+    (void) arg1; (void) arg2; (void) arg3; (void) arg4;
+    p = dumpLim( pMac, p );
     return p;
 }
 
@@ -1913,22 +1912,14 @@
 dump_lim_send_rrm_action( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
 {
     tpPESession psessionEntry;
-    tSirMacRadioMeasureReport *pRRMReport =
-            vos_mem_malloc(4*sizeof(tSirMacRadioMeasureReport));
+    tSirMacRadioMeasureReport pRRMReport[4];
     tANI_U8 num = (tANI_U8)(arg4 > 4 ? 4 : arg4);
     tANI_U8 i;
 
-    if (!pRRMReport)
-    {
-        p += log_sprintf(pMac, p,
-                         "Unable to allocate memory to process command\n");
-        goto done;
-    }
-
     if((psessionEntry = peFindSessionBySessionId(pMac,(tANI_U8)arg2) )== NULL)
     {
         p += log_sprintf( pMac,p,"Session does not exist for given session Id  \n");
-        goto done;
+        return p;
     }
     switch (arg3)
     {
@@ -2008,9 +1999,6 @@
          default:
               break;
     }
-
-done:
-    vos_mem_free(pRRMReport);
     return p;    
 }
 
@@ -2151,37 +2139,22 @@
       case 2:
       case 3:
          {
-            tDot11fRadioMeasurementRequest *frm =
-                    vos_mem_malloc(sizeof(tDot11fRadioMeasurementRequest));
-            if (!frm)
-            {
-                p += log_sprintf(pMac, p,
-                            "Unable to allocate memory to process command\n");
-                break;
-            }
-            if( (status = dot11fUnpackRadioMeasurementRequest( pMac, &pBody[arg2][0], size[arg2], frm )) != 0 )
+            tDot11fRadioMeasurementRequest frm;
+            if( (status = dot11fUnpackRadioMeasurementRequest( pMac, &pBody[arg2][0], size[arg2], &frm )) != 0 )
                p += log_sprintf( pMac, p, "failed to unpack.....status = %x\n", status);
             else
-               rrmProcessRadioMeasurementRequest( pMac, psessionEntry->bssId, frm, psessionEntry );
-            vos_mem_free(frm);
+               rrmProcessRadioMeasurementRequest( pMac, psessionEntry->bssId, &frm, psessionEntry );
          }
          break;
       case 4:
          {
-            tDot11fNeighborReportResponse *frm =
-                    vos_mem_malloc(sizeof(tDot11fNeighborReportResponse));
-            if (!frm)
-            {
-                p += log_sprintf(pMac, p,
-                            "Unable to allocate memory to process command\n");
-                break;
-            }
+            tDot11fNeighborReportResponse frm;
             pBody[arg2][2] = (tANI_U8)arg3; //Dialog Token
-            if( (status = dot11fUnpackNeighborReportResponse( pMac, &pBody[arg2][0], size[arg2], frm )) != 0 )
+            if( (status = dot11fUnpackNeighborReportResponse( pMac, &pBody[arg2][0], size[arg2], &frm )) != 0 )
                p += log_sprintf( pMac, p, "failed to unpack.....status = %x\n", status);
             else
-               rrmProcessNeighborReportResponse( pMac, frm, psessionEntry );
-            vos_mem_free(frm);
+               rrmProcessNeighborReportResponse( pMac, &frm, psessionEntry );
+
          }
          break;
       case 5:
@@ -2332,61 +2305,10 @@
     return p;    
 }
 #endif
-static char *
-dump_lim_channel_switch_announcement( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
-{
-    tpPESession psessionEntry;
-    tANI_U8 nMode = arg2;
-    tANI_U8 nNewChannel = arg3;
-    tANI_U8 nCount = arg4;
-  tANI_U8 peer[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
 
-    if((psessionEntry = peFindSessionBySessionId(pMac,(tANI_U8)arg1) )== NULL)
-    {
-        p += log_sprintf( pMac,
-            p,"Session does not exist usage: 363 <0> sessionid channel \n");
-        printk("Session Not found!!!!\n");
-        return p;
-    }
-
-    limSendChannelSwitchMgmtFrame( pMac, peer, nMode, nNewChannel, nCount, psessionEntry );
-
-    psessionEntry->gLimChannelSwitch.switchCount = nCount;
-    psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
-    psessionEntry->gLimChannelSwitch.switchMode = nMode;
-    psessionEntry->gLimChannelSwitch.primaryChannel = nNewChannel;
-
-    schSetFixedBeaconFields(pMac, psessionEntry);
-    limSendBeaconInd(pMac, psessionEntry); 
-
-  return p;
-}
-
-static char *
-dump_lim_cancel_channel_switch_announcement( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p)
-{
-    tpPESession psessionEntry;
-
-    if((psessionEntry = peFindSessionBySessionId(pMac,(tANI_U8)arg1) )== NULL)
-    {
-        p += log_sprintf( pMac,
-            p,"Session does not exist usage: 363 <0> sessionid channel \n");
-        printk("Session Not found!!!!\n");
-        return p;
-    }
-    psessionEntry->gLimChannelSwitch.switchCount = 0;
-    psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
-    psessionEntry->gLimChannelSwitch.switchMode = 0;
-    psessionEntry->gLimChannelSwitch.primaryChannel = 0;
-
-    schSetFixedBeaconFields(pMac, psessionEntry);
-    limSendBeaconInd(pMac, psessionEntry); 
-
-  return p;
-}
 static tDumpFuncEntry limMenuDumpTable[] = {
     {0,     "PE (300-499)",                                          NULL},
-    {300,   "LIM: Dump state(s)/statistics <session id>",            dump_lim_info},
+    {300,   "LIM: Dump state(s)/statistics",                         dump_lim_info},
     {301,   "PE.LIM: dump TSPEC Table",                              dump_lim_tspec_table},
     {302,   "PE.LIM: dump specified TSPEC entry (id)",               dump_lim_tspec_entry},
     {303,   "PE.LIM: dump EDCA params",                              dump_lim_edca_params},
@@ -2425,7 +2347,7 @@
     {346,   "PE:LIM: Set the Dot11 Mode",                            dump_lim_set_dot11_mode},
     {347,   "PE:Enable or Disable Protection",                       dump_lim_set_protection_control},
     {348,   "PE:LIM: Send SM Power Mode Action frame",               dump_lim_send_SM_Power_Mode},
-    {349,   "PE: LIM: Change CB Mode <session id> <sec chnl offset>",dump_lim_update_cb_Mode},
+    {349,   "PE: LIM: Change CB Mode",                               dump_lim_update_cb_Mode},
     {350,   "PE: LIM: abort scan",                                   dump_lim_abort_scan},
     {351,   "PE: LIM: Start stop BG scan",                           dump_lim_start_stop_bg_scan},
     {352,   "PE: LIM: PE statistics <scanmask>",                     dump_lim_get_pe_statistics},
@@ -2448,8 +2370,6 @@
 #ifdef WLAN_FEATURE_VOWIFI_11R
     {363,   "PE.LIM: trigger pre auth/reassoc event",                dump_lim_ft_event},
 #endif
-    {364,   "PE.LIM: Send a channel switch announcement",            dump_lim_channel_switch_announcement},
-    {365,   "PE.LIM: Cancel channel switch announcement",            dump_lim_cancel_channel_switch_announcement},
 
 };
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limP2P.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limP2P.c
index f863c4b..cda69bb 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limP2P.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limP2P.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -60,8 +60,8 @@
 #define   BSSID_OFFSET           16
 #define   ADDR2_OFFSET           10
 #define   ACTION_OFFSET          24
-#define   LIM_MIN_REM_TIME_FOR_TX_ACTION_FRAME                     50
-#define   LIM_MIN_REM_TIME_EXT_FOR_TX_ACTION_FRAME                 60
+#define   LIM_MIN_REM_TIME_FOR_TX_ACTION_FRAME                     30
+#define   LIM_MIN_REM_TIME_EXT_FOR_TX_ACTION_FRAME                 40
 
 
 
@@ -137,7 +137,7 @@
                 /* get the duration from the request */
                 val = SYS_MS_TO_TICKS(MsgBuff->duration);
 
-                limLog( pMac, LOG2, "Start listen duration = %d", val);
+                limLog( pMac, LOGE, "Start listen duration = %d", val);
                 if (tx_timer_change(
                         &pMac->lim.limTimers.gLimRemainOnChannelTimer, val, 0)
                                           != TX_SUCCESS)
@@ -325,7 +325,7 @@
       /* get the duration from the request */
     val = SYS_MS_TO_TICKS(MsgRemainonChannel->duration);
 
-    limLog( pMac, LOG2, "Start listen duration = %d", val);
+    limLog( pMac, LOGE, "Start listen duration = %d", val);
     if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
                                                 val, 0) != TX_SUCCESS)
     {
@@ -582,7 +582,7 @@
             pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time();
             pMac->lim.gTotalScanDuration = LIM_MIN_REM_TIME_EXT_FOR_TX_ACTION_FRAME;
 
-            chanWaitTime = SYS_MS_TO_TICKS(LIM_MIN_REM_TIME_EXT_FOR_TX_ACTION_FRAME);
+            chanWaitTime = SYS_MS_TO_TICKS(40);
             vStatus = tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
 
             if (VOS_STATUS_SUCCESS != vStatus)
@@ -623,15 +623,15 @@
 }
 
 
-void limSetHtCaps(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 *pIeStartPtr,tANI_U32 nBytes)
+void limSetHtCaps(tpAniSirGlobal pMac,tANI_U8 *pIeStartPtr,tANI_U32 nBytes)
 {
     v_U8_t              *pIe=NULL;
     tDot11fIEHTCaps     dot11HtCap;
 
-    PopulateDot11fHTCaps(pMac, psessionEntry, &dot11HtCap);
+    PopulateDot11fHTCaps(pMac,&dot11HtCap);
     pIe = limGetIEPtr(pMac,pIeStartPtr, nBytes,
                                        DOT11F_EID_HTCAPS,ONE_BYTE);
-   limLog( pMac, LOG2, FL("pIe 0x%x dot11HtCap.supportedMCSSet[0]=0x%x"),
+   limLog( pMac, LOGE, FL("pIe 0x%x dot11HtCap.supportedMCSSet[0]=0x%x"),
         (tANI_U32)pIe,dot11HtCap.supportedMCSSet[0]);
     if(pIe)
     {
@@ -851,7 +851,7 @@
 
         if (SIR_MAC_MGMT_PROBE_RSP == pFc->subType)
         {
-            limSetHtCaps( pMac, psessionEntry, (tANI_U8*)pMbMsg->data + PROBE_RSP_IE_OFFSET,
+            limSetHtCaps( pMac,(tANI_U8*)pMbMsg->data + PROBE_RSP_IE_OFFSET,
                            nBytes);
         }
         
@@ -968,7 +968,7 @@
         else
         {
              pMac->lim.actionFrameSessionId = pMbMsg->sessionId;
-             limLog( pMac, LOG2, FL("lim.actionFrameSessionId = %lu\n" ), 
+             limLog( pMac, LOGE, FL("lim.actionFrameSessionId = %lu\n" ), 
                      pMac->lim.actionFrameSessionId);
 
         }
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessActionFrame.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessActionFrame.c
index 59c3c48..e013f6d 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessActionFrame.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessActionFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -57,7 +57,6 @@
 #if defined WLAN_FEATURE_VOWIFI
 #include "rrmApi.h"
 #endif
-#include "limSessionUtils.h"
 
 #if defined FEATURE_WLAN_CCX
 #include "ccxApi.h"
@@ -89,21 +88,12 @@
 void limStopTxAndSwitchChannel(tpAniSirGlobal pMac, tANI_U8 sessionId)
 {
     tANI_U8 isFullPowerRequested = 0;
-    tpPESession psessionEntry;
-
-    psessionEntry = peFindSessionBySessionId( pMac , sessionId );
-
-    if( NULL == psessionEntry )
-    {
-      limLog(pMac, LOGE, FL("Session %d  not active\n "), sessionId);
-      return;
-    }
 
     PELOG1(limLog(pMac, LOG1, FL("Channel switch Mode == %d\n"), 
-                       psessionEntry->gLimChannelSwitch.switchMode);)
+                       pMac->lim.gLimChannelSwitch.switchMode);)
 
-    if (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT ||
-        psessionEntry->gLimChannelSwitch.switchCount <= SIR_CHANSW_TX_STOP_MAX_COUNT)
+    if (pMac->lim.gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT ||
+        pMac->lim.gLimChannelSwitch.switchCount <= SIR_CHANSW_TX_STOP_MAX_COUNT)
     {
         /* Freeze the transmission */
         limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
@@ -122,12 +112,11 @@
         limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
     }
 
-    pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId;
     /* change the channel immediatly only if the channel switch count is 0 and the 
      * device is not in powersave 
      * If the device is in powersave channel switch should happen only after the
      * device comes out of the powersave */
-    if (psessionEntry->gLimChannelSwitch.switchCount == 0) 
+    if (pMac->lim.gLimChannelSwitch.switchCount == 0) 
     {
         if(limIsSystemInActiveState(pMac))
         {
@@ -142,8 +131,10 @@
         }
         return;
     }
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_CHANNEL_SWITCH_TIMER));
 
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_CHANNEL_SWITCH_TIMER));
+
+    pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId;
 
     if (tx_timer_activate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != TX_SUCCESS)
     {
@@ -165,54 +156,31 @@
 tSirRetStatus limStartChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
 {
     PELOG1(limLog(pMac, LOG1, FL("Starting the channel switch\n"));)
-    
-    /*If channel switch is already running and it is on a different session, just return*/  
-    /*This need to be removed for MCC */
-    if( limIsChanSwitchRunning (pMac) &&
-        psessionEntry->gLimSpecMgmt.dot11hChanSwState != eLIM_11H_CHANSW_RUNNING )
-    {
-       limLog(pMac, LOGW, FL("Ignoring channel switch on session %d\n"), psessionEntry->peSessionId);
-       return eSIR_SUCCESS;
-    }
-     
     /* Deactivate and change reconfigure the timeout value */
-    //limDeactivateAndChangeTimer(pMac, eLIM_CHANNEL_SWITCH_TIMER);
-    if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
-    {
-        limLog(pMac, LOGP, FL("tx_timer_deactivate failed!\n"));
-        return eSIR_FAILURE;
-    }
-
-    if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
-                psessionEntry->gLimChannelSwitch.switchTimeoutValue,
-                            0) != TX_SUCCESS)
-    {
-        limLog(pMac, LOGP, FL("tx_timer_change failed \n"));
-        return eSIR_FAILURE;
-    }
+    limDeactivateAndChangeTimer(pMac, eLIM_CHANNEL_SWITCH_TIMER);
 
     /* Follow the channel switch, forget about the previous quiet. */
     //If quiet is running, chance is there to resume tx on its timeout.
     //so stop timer for a safer side.
-    if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
+    if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_TIMER));
         if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
         {
             limLog(pMac, LOGP, FL("tx_timer_deactivate failed\n"));
             return eSIR_FAILURE;
         }
     }
-    else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
+    else if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
         if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
         {
             limLog(pMac, LOGP, FL("tx_timer_deactivate failed\n"));
             return eSIR_FAILURE;
         }
     }
-    psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
 
     /* Prepare for 11h channel switch */
     limPrepareFor11hChannelSwitch(pMac, psessionEntry);
@@ -308,26 +276,37 @@
 
         beaconPeriod = (tANI_U16) val;
 
-        psessionEntry->gLimChannelSwitch.primaryChannel = pChannelSwitchFrame->ChanSwitchAnn.newChannel;
-        psessionEntry->gLimChannelSwitch.switchCount = pChannelSwitchFrame->ChanSwitchAnn.switchCount;
-        psessionEntry->gLimChannelSwitch.switchTimeoutValue = SYS_MS_TO_TICKS(beaconPeriod) *
-                                                         psessionEntry->gLimChannelSwitch.switchCount;
-        psessionEntry->gLimChannelSwitch.switchMode = pChannelSwitchFrame->ChanSwitchAnn.switchMode;
+        pMac->lim.gLimChannelSwitch.primaryChannel = pChannelSwitchFrame->ChanSwitchAnn.newChannel;
+        pMac->lim.gLimChannelSwitch.switchCount = pChannelSwitchFrame->ChanSwitchAnn.switchCount;
+        pMac->lim.gLimChannelSwitch.switchTimeoutValue = SYS_MS_TO_TICKS(beaconPeriod) *
+                                                         pMac->lim.gLimChannelSwitch.switchCount;
+        pMac->lim.gLimChannelSwitch.switchMode = pChannelSwitchFrame->ChanSwitchAnn.switchMode;
 
        PELOG3(limLog(pMac, LOG3, FL("Rcv Chnl Swtch Frame: Timeout in %d ticks\n"),
-                             psessionEntry->gLimChannelSwitch.switchTimeoutValue);)
+                             pMac->lim.gLimChannelSwitch.switchTimeoutValue);)
 
         /* Only primary channel switch element is present */
-        psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
-        psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
+        pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
+        pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_NONE;
 
-        if (psessionEntry->htSupportedChannelWidthSet)
+        if(GET_CB_ADMIN_STATE(pMac->lim.gCbState))
         {
-            if ((pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
-                (pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
+            switch(pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset)
             {
-                psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
-                psessionEntry->gLimChannelSwitch.secondarySubBand = pChannelSwitchFrame->ExtChanSwitchAnn.secondaryChannelOffset;
+                case eHT_SECONDARY_CHANNEL_OFFSET_UP:
+                    pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+                    pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_UP;
+                    break;
+
+                case eHT_SECONDARY_CHANNEL_OFFSET_DOWN:
+                    pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+                    pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_DOWN;
+                    break;
+
+                case eHT_SECONDARY_CHANNEL_OFFSET_NONE:
+                default:
+                    /* Nothing to be done here */
+                    break;
             }
         }
 
@@ -800,7 +779,7 @@
     else
     {
       //send message to HAL to delete TS
-      if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, delts, psessionEntry->peSessionId))
+      if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, delts))
       {
         limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request\n"),
                          tsinfo->traffic.userPrio);
@@ -1725,7 +1704,7 @@
 __limProcessNeighborReport( tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo ,tpPESession psessionEntry )
 {
      tpSirMacMgmtHdr               pHdr;
-     tDot11fNeighborReportResponse *pFrm;
+     tDot11fNeighborReportResponse frm;
      tANI_U32                      frameLen, nStatus;
      tANI_U8                       *pBody;
 
@@ -1733,28 +1712,19 @@
      pBody = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
      frameLen = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
 
-     if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                 (void **)&pFrm, sizeof(tDot11fNeighborReportResponse)))
-     {
-         limLog(pMac, LOGE, FL("Unable to PAL allocate memory in __limProcessNeighborReport\n") );
-         return;
-     }
-
      if( psessionEntry == NULL )
      {
-          palFreeMemory(pMac->hHdd, pFrm);
           return;
      }
 
      /**Unpack the received frame */
-     nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen,pFrm );
+     nStatus = dot11fUnpackNeighborReportResponse( pMac, pBody, frameLen, &frm );
 
      if( DOT11F_FAILED( nStatus )) {
           limLog( pMac, LOGE, FL( "Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):\n"),
                     nStatus, frameLen );
           PELOG2(sirDumpBuf( pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frameLen );)
-          palFreeMemory(pMac->hHdd, pFrm);
-          return;
+               return;
      }else if ( DOT11F_WARNED( nStatus ) ) {
           limLog(pMac, LOGW, FL( "There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):\n"),
                     nStatus, frameLen );
@@ -1762,9 +1732,8 @@
      }
 
      //Call rrm function to handle the request.
-     rrmProcessNeighborReportResponse( pMac, pFrm, psessionEntry ); 
-     
-     palFreeMemory(pMac->hHdd, pFrm);
+     rrmProcessNeighborReportResponse( pMac, &frm, psessionEntry ); 
+
 }
 
 #endif
@@ -2077,7 +2046,7 @@
    tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd);
    tpSirMacVendorSpecificPublicActionFrameHdr pActionHdr = (tpSirMacVendorSpecificPublicActionFrameHdr) pBody;
 
-   limLog( pMac, LOG1, "Received a Action frame -- no session");
+   limLog( pMac, LOGE, "Received a Action frame -- no session");
 
    switch ( pActionHdr->category )
    {
@@ -2114,7 +2083,7 @@
          }
          break;
       default:
-         PELOGE(limLog(pMac, LOG1, FL("Unhandled action frame without session -- %x \n"), pActionHdr->category);)
+         PELOGE(limLog(pMac, LOGE, FL("Unhandled action frame without session -- %x \n"), pActionHdr->category);)
             break;
 
    }
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c
index 566746c..6ee945d 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAssocReqFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -211,29 +211,15 @@
         // Received Re/Assoc Req frame from a BC/MC address
         // Log error and ignore it
         if (subType == LIM_ASSOC)
-			limLog(pMac, LOGW, FL("received Assoc frame from a BC/MC address "MAC_ADDRESS_STR),
-                   MAC_ADDR_ARRAY(pHdr->sa));
+            limLog(pMac, LOG1, FL("received Assoc frame from a BC/MC address\n"));
         else
-            limLog(pMac, LOGW, FL("received ReAssoc frame from a BC/MC address "MAC_ADDRESS_STR),
-                   MAC_ADDR_ARRAY(pHdr->sa));
+            limLog(pMac, LOG1, FL("received ReAssoc frame from a BC/MC address\n"));
+        limPrintMacAddr(pMac, pHdr->sa, LOG1);
         return;
     }
-    limLog(pMac, LOGW, FL("Received AssocReq Frame: "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));
-
+    limLog(pMac, LOG2, FL("Received AssocReq Frame: "));
     sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, (tANI_U8 *) pBody, framelen);
 
-    if( palEqualMemory( pMac->hHdd,  (tANI_U8* ) pHdr->sa, (tANI_U8 *) pHdr->da, 
-                        (tANI_U8) (sizeof(tSirMacAddr))))
-    {
-        limSendAssocRspMgmtFrame(pMac,
-                    eSIR_MAC_UNSPEC_FAILURE_STATUS,
-                    1,
-                    pHdr->sa,
-                    subType, 0,psessionEntry);
-        limLog(pMac, LOGE, FL("Rejected Assoc Req frame Since same mac as SAP/GO\n"));
-        return ;
-    }
-
 #ifdef WLAN_SOFTAP_FEATURE
     // If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON
     if ((psessionEntry->bTkipCntrMeasActive) && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
@@ -306,17 +292,16 @@
                         pHdr->sa,
                         subType, 0,psessionEntry);
 
-        limLog(pMac, LOGW, FL("local caps 0x%x received 0x%x\n"), localCapabilities, pAssocReq->capabilityInfo);
+        limLog(pMac, LOG1, FL("local caps 0x%x received 0x%x\n"), localCapabilities, pAssocReq->capabilityInfo);
 
         // Log error
         if (subType == LIM_ASSOC)
-            limLog(pMac, LOGW,
-               FL("received Assoc req with unsupported capabilities "MAC_ADDRESS_STR),
-                  MAC_ADDR_ARRAY(pHdr->sa));
+            limLog(pMac, LOG1,
+               FL("received Assoc req with unsupported capabilities from\n"));
         else
-            limLog(pMac, LOGW,
-                   FL("received ReAssoc req with unsupported capabilities "MAC_ADDRESS_STR),
-                   MAC_ADDR_ARRAY(pHdr->sa));
+            limLog(pMac, LOG1,
+               FL("received ReAssoc req with unsupported capabilities from\n"));
+        limPrintMacAddr(pMac, pHdr->sa, LOG1);
         goto error;
     }
 
@@ -616,7 +601,7 @@
 
     // Check for 802.11n HT caps compatibility; are HT Capabilities
     // turned on in lim?
-    if ( psessionEntry->htCapability )
+    if ( psessionEntry->htCapabality )
     {
         // There are; are they turned on in the STA?
         if ( pAssocReq->HTCaps.present )
@@ -841,13 +826,12 @@
 
             // Log error
             if (subType == LIM_ASSOC)
-                limLog(pMac, LOGW,
-                       FL("received Assoc req from STA that does not have pre-auth context "MAC_ADDRESS_STR),
-                       MAC_ADDR_ARRAY(pHdr->sa));
+                limLog(pMac, LOG1,
+                       FL("received Assoc req from STA that does not have pre-auth context, MAC addr is: \n"));
             else
-                limLog(pMac, LOGW,
-                       FL("received ReAssoc req from STA that does not have pre-auth context "
-                       MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));
+                limLog(pMac, LOG1,
+                       FL("received ReAssoc req from STA that does not have pre-auth context, MAC addr is: \n"));
+            limPrintMacAddr(pMac, pHdr->sa, LOG1);
             goto error;
         }
 
@@ -886,7 +870,6 @@
             }
             limPrintMacAddr(pMac, pHdr->sa, LOG1);
             limPrintMlmState(pMac, LOG1, (tLimMlmStates) pStaDs->mlmStaContext.mlmState);
-
             goto error;
         } // if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)
 
@@ -974,11 +957,10 @@
      * STA is Associated !
      */
     if (subType == LIM_ASSOC)
-        limLog(pMac, LOGW, FL("received Assoc req successful "MAC_ADDRESS_STR),
-               MAC_ADDR_ARRAY(pHdr->sa));
+        limLog(pMac, LOG1, FL("received Assoc req successful from "));
     else
-        limLog(pMac, LOGW, FL("received ReAssoc req successful"MAC_ADDRESS_STR),
-               MAC_ADDR_ARRAY(pHdr->sa));
+        limLog(pMac, LOG1, FL("received ReAssoc req successful from "));
+    limPrintMacAddr(pMac, pHdr->sa, LOG1);
 
     /**
      * Assign unused/least recently used AID from perStaDs.
@@ -1030,9 +1012,6 @@
     psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq;
 
     pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present;
-#ifdef WLAN_FEATURE_11AC
-    pStaDs->mlmStaContext.vhtCapability = pAssocReq->VHTCaps.present;
-#endif
     pStaDs->qos.addtsPresent = (pAssocReq->addtsPresent==0) ? false : true;
     pStaDs->qos.addts        = pAssocReq->addtsReq;
     pStaDs->qos.capability   = pAssocReq->qosCapability;
@@ -1088,30 +1067,10 @@
         pStaDs->htShortGI20Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI20MHz;
         pStaDs->htShortGI40Mhz = (tANI_U8)pAssocReq->HTCaps.shortGI40MHz;
         pStaDs->htSupportedChannelWidthSet = (tANI_U8)pAssocReq->HTCaps.supportedChannelWidthSet;
-        /* peer just follows AP; so when we are softAP/GO, we just store our session entry's secondary channel offset here in peer INFRA STA
-         * However, if peer's 40MHz channel width support is disabled then secondary channel will be zero
-         */
-        pStaDs->htSecondaryChannelOffset = (pStaDs->htSupportedChannelWidthSet)?psessionEntry->htSecondaryChannelOffset:0;
-#ifdef WLAN_FEATURE_11AC
-        if (pAssocReq->VHTCaps.present)
-        {
-            pStaDs->vhtSupportedChannelWidthSet = (tANI_U8)pAssocReq->VHTCaps.supportedChannelWidthSet; 
-        }
-#endif
         pStaDs->baPolicyFlag = 0xFF;
     }
 
 
-#ifdef WLAN_FEATURE_11AC
-if (limPopulateMatchingRateSet(pMac,
-                               pStaDs,
-                               &(pAssocReq->supportedRates),
-                               &(pAssocReq->extendedRates),
-                               pAssocReq->HTCaps.supportedMCSSet,
-                               &(pAssocReq->propIEinfo.propRates),
-                               psessionEntry , &pAssocReq->VHTCaps) 
-                               != eSIR_SUCCESS)
-#else
 
     if (limPopulateMatchingRateSet(pMac,
                                    pStaDs,
@@ -1119,7 +1078,6 @@
                                    &(pAssocReq->extendedRates),
                                    pAssocReq->HTCaps.supportedMCSSet,
                                    &(pAssocReq->propIEinfo.propRates), psessionEntry) != eSIR_SUCCESS)
-#endif
     {
         // Could not update hash table entry at DPH with rateset
         limLog(pMac, LOGE,
@@ -1304,11 +1262,8 @@
         }
     }
 
-    /* If it is not duplicate Assoc request then only make to Null */
-    if ((pStaDs != NULL) &&
-          (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE))
+    if(pStaDs!= NULL)
         psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
-
     return;
 
 } /*** end limProcessAssocReqFrame() ***/
@@ -1441,6 +1396,10 @@
                            pAssocReq->rsn.length);
         }
 
+        //FIXME: we need to have the cb information seprated between HT and Titan later. 
+        if(pAssocReq->HTCaps.present)
+            limGetHtCbAdminState(pMac, pAssocReq->HTCaps, &pMlmAssocInd->titanHtCaps);
+
         // Fill in 802.11h related info
         if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
         {
@@ -1595,6 +1554,9 @@
             palCopyMemory( pMac->hHdd, &pMlmReassocInd->rsnIE.rsnIEdata[2], pAssocReq->rsn.info, pAssocReq->rsn.length);
         }
 
+        if(pAssocReq->HTCaps.present)
+              limGetHtCbAdminState(pMac, pAssocReq->HTCaps,  &pMlmReassocInd->titanHtCaps );
+
         // 802.11h support
         if (pAssocReq->powerCapabilityPresent && pAssocReq->supportedChannelsPresent)
         {
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c
index c78edd3..4b6c449 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAssocRspFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -128,8 +128,6 @@
                    pStaDs->htMaxRxAMpduFactor = pAssocRsp->HTCaps.maxRxAMPDUFactor;
                    limFillRxHighestSupportedRate(pMac, &rxHighestRate, pAssocRsp->HTCaps.supportedMCSSet);
                    pStaDs->supportedRates.rxHighestDataRate = rxHighestRate;
-                   /* This is for AP as peer STA and we are INFRA STA. We will put APs offset in dph node which is peer STA */
-                   pStaDs->htSecondaryChannelOffset = (tANI_U8)pAssocRsp->HTInfo.secondaryChannelOffset;
 
                    //FIXME_AMPDU
                    // In the future, may need to check for "assoc.HTCaps.delayedBA"
@@ -137,19 +135,8 @@
                    pStaDs->baPolicyFlag = 0xFF;
            }
        }
-
-#ifdef WLAN_FEATURE_11AC
-       if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
-       {
-           pStaDs->mlmStaContext.vhtCapability = pAssocRsp->VHTCaps.present;
-       }
-       if (limPopulateOwnRateSet(pMac, &pStaDs->supportedRates, 
-                                pAssocRsp->HTCaps.supportedMCSSet,
-                                false,psessionEntry , &pAssocRsp->VHTCaps) != eSIR_SUCCESS) 
-#else
-       if (limPopulateOwnRateSet(pMac, &pStaDs->supportedRates, pAssocRsp->HTCaps.supportedMCSSet, false,psessionEntry) != eSIR_SUCCESS) 
-#endif
-       {
+    
+       if (limPopulateOwnRateSet(pMac, &pStaDs->supportedRates, pAssocRsp->HTCaps.supportedMCSSet, false,psessionEntry) != eSIR_SUCCESS) {
            limLog(pMac, LOGP, FL("could not get rateset and extended rate set\n"));
            return;
        }
@@ -244,13 +231,10 @@
     palCopyMemory( pMac->hHdd, psessionEntry->bssId,
                   psessionEntry->limReAssocbssId, sizeof(tSirMacAddr));
     psessionEntry->currentOperChannel = psessionEntry->limReassocChannelId;
-    psessionEntry->htSecondaryChannelOffset = psessionEntry->reAssocHtSupportedChannelWidthSet;
-    psessionEntry->htRecommendedTxWidthSet = psessionEntry->reAssocHtRecommendedTxWidthSet;
-    psessionEntry->htSecondaryChannelOffset = psessionEntry->reAssocHtSecondaryChannelOffset;
     psessionEntry->limCurrentBssCaps   = psessionEntry->limReassocBssCaps;
     psessionEntry->limCurrentBssQosCaps = psessionEntry->limReassocBssQosCaps;
     psessionEntry->limCurrentBssPropCap = psessionEntry->limReassocBssPropCap;
-
+    psessionEntry->limCurrentTitanHtCaps = psessionEntry->limReassocTitanHtCaps;
     palCopyMemory( pMac->hHdd, (tANI_U8 *) &psessionEntry->ssId,
                   (tANI_U8 *) &psessionEntry->limReassocSSID,
                   psessionEntry->limReassocSSID.length+1);
@@ -259,7 +243,7 @@
     psessionEntry->limAID = pAssocRsp->aid & 0x3FFF;
     /** Set the State Back to ReAssoc Rsp*/
     psessionEntry->limMlmState = eLIM_MLM_WT_REASSOC_RSP_STATE; 
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
     
 }
@@ -298,8 +282,8 @@
     tpSirAssocRsp         pAssocRsp;
     tLimMlmAssocCnf       mlmAssocCnf;
     
-#ifdef ANI_PRODUCT_TYPE_CLIENT
-    tSchBeaconStruct *pBeaconStruct;
+    #ifdef ANI_PRODUCT_TYPE_CLIENT
+    tSchBeaconStruct beaconStruct;
 #endif
 
     //Initialize status code to success.
@@ -310,13 +294,6 @@
     /* Update PE session Id*/
     mlmAssocCnf.sessionId = psessionEntry->peSessionId;
 
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
-    {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limProcessAssocRspFrame\n") );
-        return;
-    }
-
    
     if (psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE )
     {
@@ -326,7 +303,6 @@
                FL("received Re/Assoc response frame on role %d \n"),
                psessionEntry->limSystemRole);
 
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
         return;
     }
 
@@ -338,7 +314,7 @@
          (psessionEntry->limMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE)) ||
         ((subType == LIM_REASSOC) &&
          ((psessionEntry->limMlmState != eLIM_MLM_WT_REASSOC_RSP_STATE) 
-#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
          && (psessionEntry->limMlmState != eLIM_MLM_WT_FT_REASSOC_RSP_STATE)
 #endif
          )))
@@ -356,7 +332,7 @@
                FL("received Re/Assoc rsp frame in unexpected state\n"));
             limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
         }
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
+
         return;
     }
 #if 0
@@ -365,7 +341,6 @@
     {
         /// Could not get BSSID from CFG. Log error.
         limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
         return;
     }
 #endif //TO SUPPORT BT-AMP
@@ -382,10 +357,10 @@
              */
 
             // Log error
-            PELOGW(limLog(pMac, LOGW,
-                   FL("received AssocRsp frame from unexpected peer "MAC_ADDRESS_STR),
-                   MAC_ADDR_ARRAY(pHdr->sa));)
-            palFreeMemory(pMac->hHdd, pBeaconStruct);
+            PELOG1(limLog(pMac, LOG1,
+                   FL("received AssocRsp frame from unexpected peer "));
+            limPrintMacAddr(pMac, pHdr->sa, LOG1);)
+
             return;
         }
     }
@@ -400,10 +375,9 @@
              */
 
             // Log error
-            PELOGW(limLog(pMac, LOGW,
-                   FL("received ReassocRsp frame from unexpected peer "MAC_ADDRESS_STR),
-                   MAC_ADDR_ARRAY(pHdr->sa));)
-            palFreeMemory(pMac->hHdd, pBeaconStruct);
+            PELOG1(limLog(pMac, LOG1,
+               FL("received ReassocRsp frame from unexpected peer "));)
+            PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
             return;
         }
@@ -411,8 +385,6 @@
 
    if ( palAllocateMemory(pMac->hHdd, (void **)&pAssocRsp, sizeof(*pAssocRsp)) != eHAL_STATUS_SUCCESS) {
         limLog(pMac, LOGP, FL("Pal Allocate Memory failed in AssocRsp\n"));
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
-
         return;
     }
    
@@ -426,10 +398,9 @@
         if (palFreeMemory(pMac->hHdd, pAssocRsp) != eHAL_STATUS_SUCCESS) 
         {
             limLog(pMac, LOGP, FL("PalFree Memory failed \n"));
+            return;
         }
         PELOGE(limLog(pMac, LOGE, FL("Parse error Assoc resp subtype %d, length=%d\n"), frameLen,subType);)
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
-
         return;
     }
 
@@ -525,8 +496,6 @@
         limLog(pMac, LOGE,
                FL("received Re/AssocRsp frame with IBSS capability\n"));
         palFreeMemory(pMac->hHdd, pAssocRsp);
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
-
         return;
     }
 
@@ -537,8 +506,6 @@
          * from CFG. Log error.
          */         
         palFreeMemory(pMac->hHdd, pAssocRsp);
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
-
         limLog(pMac, LOGP, FL("could not retrieve Capabilities value\n"));
         return;
     }
@@ -646,7 +613,7 @@
             goto assocReject;
         }
 
-#if defined(WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if defined(WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
         if (psessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE)
         {
 #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
@@ -660,7 +627,6 @@
             psessionEntry->limAID = pAssocRsp->aid & 0x3FFF;
 
             limAddFTStaSelf(pMac, (pAssocRsp->aid & 0x3FFF), psessionEntry);
-            palFreeMemory(pMac->hHdd, pBeaconStruct);
 
             return;
         }
@@ -683,14 +649,11 @@
             if (limCleanupRxPath(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
                 goto assocReject;
         }
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
-
         return;
     }
 
     // Log success
-    PELOGE(limLog(pMac, LOGE, FL("Successfully Associated with BSS "MAC_ADDRESS_STR),
-           MAC_ADDR_ARRAY(pHdr->sa));)
+    PELOG1(limLog(pMac, LOG1, FL("Successfully Associated with BSS\n"));)
 #ifdef FEATURE_WLAN_CCX
     if(psessionEntry->ccxContext.tsm.tsmInfo.state)
     {
@@ -720,8 +683,6 @@
         limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF,
                               (tANI_U32 *) &mlmAssocCnf);
         palFreeMemory(pMac->hHdd, pAssocRsp); 
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
-
         return;
     }
    
@@ -736,13 +697,13 @@
     limExtractApCapabilities( pMac,
                             (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
                             limGetIElenFromBssDescription( &psessionEntry->pLimJoinReq->bssDescription ),
-                            pBeaconStruct );
+                            &beaconStruct );
 
     if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
-        limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
+        limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
     
-    if(pBeaconStruct->erpPresent) {
-        if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
+    if(beaconStruct.erpPresent) {
+        if (beaconStruct.erpIEInfo.barkerPreambleMode)
             psessionEntry->beaconParams.fShortPreamble = false;
         else
             psessionEntry->beaconParams.fShortPreamble = true;
@@ -750,11 +711,10 @@
 
 
      //Update the BSS Entry, this entry was added during preassoc.
-    if( eSIR_SUCCESS == limStaSendAddBss( pMac, pAssocRsp,  pBeaconStruct,
+    if( eSIR_SUCCESS == limStaSendAddBss( pMac, pAssocRsp,  &beaconStruct,
                    &psessionEntry->pLimJoinReq->bssDescription, true, psessionEntry))  
     {
         palFreeMemory(pMac->hHdd, pAssocRsp);   
-        palFreeMemory(pMac->hHdd, pBeaconStruct);
         return;
     }
     else
@@ -788,15 +748,17 @@
 #endif
        ) {
         PELOGE(limLog(pMac, LOGE,  FL("Assoc Rejected by the peer. Reason: %d\n"), mlmAssocCnf.resultCode);)
-        psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
         if (psessionEntry->pLimMlmJoinReq)
         {
             palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq);
             psessionEntry->pLimMlmJoinReq = NULL;
         }
-
+        if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId, 
+             psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+            PELOGE(limLog(pMac, LOGE,  FL("Failed to set the LinkState\n"));)
         if (subType == LIM_ASSOC)
         {
            limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF, (tANI_U32 *) &mlmAssocCnf);
@@ -817,7 +779,7 @@
     /* notify TL that association is failed so that TL can flush the cached frame  */
     WLANTL_AssocFailed (psessionEntry->staId);
 
-    palFreeMemory(pMac->hHdd, pBeaconStruct);
+
     palFreeMemory(pMac->hHdd, pAssocRsp);      
     return;
 } /*** end limProcessAssocRspFrame() ***/
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAuthFrame.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAuthFrame.c
index 066b114..08fd818 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAuthFrame.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessAuthFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -192,7 +192,7 @@
 
     pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
 
-    //PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8*)pBd, ((tpHalBufDesc) pBd)->mpduDataOffset + frameLen);)
+    PELOG3(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG3, (tANI_U8*)pBd, ((tpHalBufDesc) pBd)->mpduDataOffset + frameLen);)
 
 
    
@@ -240,9 +240,10 @@
                                  pHdr->sa,
                                  LIM_NO_WEP_IN_FC,psessionEntry);
             // Log error
-            PELOGE(limLog(pMac, LOGE,
-                   FL("received Authentication frame with wep bit set on role=%d "MAC_ADDRESS_STR),
-                   psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pHdr->sa) );)
+            PELOG1(limLog(pMac, LOG1,
+                   FL("received Authentication frame with wep bit set on role=%d from "),
+                   psessionEntry->limSystemRole );
+            limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
             return;
         }
@@ -304,10 +305,9 @@
                                      LIM_NO_WEP_IN_FC,psessionEntry);
 
                 // Log error
-                PELOGE(limLog(pMac, LOGE,
-                       FL("received Authentication frame from peer that has "
-                       "no preauth context with WEP bit set "MAC_ADDRESS_STR),
-                       MAC_ADDR_ARRAY(pHdr->sa));)
+                PELOG1(limLog(pMac, LOG1,
+                       FL("received Authentication frame from peer that has no preauth context with WEP bit set. Addr "));)
+                PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                 return;
             }
@@ -342,9 +342,10 @@
                                          LIM_NO_WEP_IN_FC,psessionEntry);
 
                     // Log error
-                    PELOGE(limLog(pMac, LOGE,
-                           FL("received Authentication frame from peer that is in state %d "
-                           MAC_ADDRESS_STR), pAuthNode->mlmState, MAC_ADDR_ARRAY(pHdr->sa));)
+                    PELOG1(limLog(pMac, LOG1,
+                           FL("received Authentication frame from peer that is in state %d. Addr "),
+                           pAuthNode->mlmState);)
+                   PELOG1( limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                     return;
                 }
@@ -376,9 +377,9 @@
                                          LIM_NO_WEP_IN_FC,psessionEntry);
 
                     // Log error
-                    PELOGE(limLog(pMac, LOGE,
-                           FL("received Auth frame3 from peer that has NULL key map entry "
-                           MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));)
+                    PELOG1(limLog(pMac, LOG1,
+                           FL("received Auth frame3 from peer that has NULL key map entry, Addr "));)
+                   PELOG1( limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                     return;
                 } // if (!pKeyMapEntry->wepOn)
@@ -392,7 +393,7 @@
                     if (decryptResult == LIM_DECRYPT_ICV_FAIL)
                     {
                         /// ICV failure
-                        PELOGW(limLog(pMac, LOGW, FL("=====> decryptResult == LIM_DECRYPT_ICV_FAIL ..."));)
+                        PELOGW(limLog(pMac, LOGW, FL("=====> decryptResult == LIM_DECRYPT_ICV_FAIL ...\n"));)
                         limDeletePreAuthNode(pMac,
                                              pHdr->sa);
                         authFrame.authAlgoNumber = eSIR_SHARED_KEY;
@@ -407,9 +408,9 @@
                                             LIM_NO_WEP_IN_FC,psessionEntry);
 
                         // Log error
-                        PELOGE(limLog(pMac, LOGE,
-                               FL("received Authentication frame from peer that failed decryption, Addr "
-                               MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));)
+                        PELOG1(limLog(pMac, LOG1,
+                               FL("received Authentication frame from peer that failed decryption, Addr "));)
+                        PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                         return;
                     }
@@ -486,9 +487,9 @@
                                             LIM_NO_WEP_IN_FC,psessionEntry);
 
                         // Log error
-                        PELOGE(limLog(pMac, LOGE,
-                               FL("received Authentication frame from peer that failed decryption: "
-                               MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));)
+                        PELOG1(limLog(pMac, LOG1,
+                               FL("received Authentication frame from peer that failed decryption, Addr "));)
+                        PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                         return;
                     }
@@ -519,9 +520,9 @@
                                  LIM_NO_WEP_IN_FC,psessionEntry);
 
             // Log error
-            PELOGE(limLog(pMac, LOGE,
-                   FL("received Authentication frame3 from peer that while privacy option is turned OFF "
-                   MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));)
+            PELOG1(limLog(pMac, LOG1,
+                   FL("received Authentication frame3 from peer that while privacy option is turned OFF, Addr "));)
+            PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
             return;
         } // else if (wlan_cfgGetInt(CFG_PRIVACY_OPTION_IMPLEMENTED))
@@ -537,7 +538,7 @@
 
     pRxAuthFrameBody = &rxAuthFrame;
 
-   PELOGW(limLog(pMac, LOGW,
+   PELOG2(limLog(pMac, LOG2,
            FL("Received Auth frame with type=%d seqnum=%d, status=%d (%d)\n"),
            (tANI_U32) pRxAuthFrameBody->authAlgoNumber,
            (tANI_U32) pRxAuthFrameBody->authTransactionSeqNumber,
@@ -665,7 +666,7 @@
                 switch (pRxAuthFrameBody->authAlgoNumber)
                 {
                     case eSIR_OPEN_SYSTEM:
-                        PELOGW(limLog(pMac, LOGW, FL("=======> eSIR_OPEN_SYSTEM  ...\n"));)
+                        PELOG1(limLog(pMac, LOG1, FL("=======> eSIR_OPEN_SYSTEM  ...\n"));)
                         /// Create entry for this STA in pre-auth list
                         pAuthNode = limAcquireFreePreAuthNode(pMac, &pMac->lim.gLimPreAuthTimerTable);
                         if (pAuthNode == NULL)
@@ -725,7 +726,7 @@
                         break;
 
                     case eSIR_SHARED_KEY:
-                        PELOGW(limLog(pMac, LOGW, FL("=======> eSIR_SHARED_KEY  ...\n"));)
+                        PELOG1(limLog(pMac, LOG1, FL("=======> eSIR_SHARED_KEY  ...\n"));)
 #ifdef WLAN_SOFTAP_FEATURE
                         if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
                         {
@@ -767,10 +768,10 @@
                                                 LIM_NO_WEP_IN_FC,psessionEntry);
 
                             // Log error
-                            PELOGE(limLog(pMac, LOGE,
-                                   FL("received Auth frame for unsupported auth algorithm %d "
-                                   MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber, 
-                                   MAC_ADDR_ARRAY(pHdr->sa));)
+                            PELOG1(limLog(pMac, LOG1,
+                                   FL("received Auth frame for unsupported auth algorithm %d from "),
+                                   pRxAuthFrameBody->authAlgoNumber);)
+                            PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                             return;
                         }
@@ -902,10 +903,10 @@
                                             LIM_NO_WEP_IN_FC,psessionEntry);
 
                         // Log error
-                       PELOGE( limLog(pMac, LOGE,
-                               FL("received Auth frame for unsupported auth algorithm %d "
-                               MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber, 
-                               MAC_ADDR_ARRAY(pHdr->sa));)
+                       PELOG1( limLog(pMac, LOG1,
+                               FL("received Auth frame for unsupported auth algorithm %d from "),
+                               pRxAuthFrameBody->authAlgoNumber);)
+                        PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                         return;
                 } // end switch(pRxAuthFrameBody->authAlgoNumber)
@@ -929,10 +930,10 @@
                                      LIM_NO_WEP_IN_FC,psessionEntry);
 
                 // Log error
-                PELOGE(limLog(pMac, LOGE,
-                       FL("received Authentication frame for unsupported auth algorithm %d "
-                       MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber, 
-                       MAC_ADDR_ARRAY(pHdr->sa));)
+                PELOG1(limLog(pMac, LOG1,
+                       FL("received Authentication frame for unsupported auth algorithm %d from "),
+                       pRxAuthFrameBody->authAlgoNumber);)
+                PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
                 return;
             } //end if (limIsAuthAlgoSupported(pRxAuthFrameBody->authAlgoNumber))
             break;
@@ -967,9 +968,9 @@
                  */
 
                 // Log error
-                PELOGW(limLog(pMac, LOGW,
-                       FL("received Auth frame2 from unexpected peer "MAC_ADDRESS_STR),
-                       MAC_ADDR_ARRAY(pHdr->sa));)
+                PELOG1(limLog(pMac, LOG1,
+                       FL("received Auth frame2 from unexpected peer "));)
+                PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                 break;
             }
@@ -1002,10 +1003,10 @@
                  */
 
                 // Log error
-                PELOGW(limLog(pMac, LOGW,
-                       FL("received Auth frame2 for unexpected auth algo number %d "
-                       MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber, 
-                       MAC_ADDR_ARRAY(pHdr->sa));)
+                PELOG1(limLog(pMac, LOG1,
+                       FL("received Auth frame2 for unexpected auth algo number %d from "),
+                       pRxAuthFrameBody->authAlgoNumber);)
+               PELOG1( limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                 break;
             }
@@ -1075,10 +1076,10 @@
                          */
 
                         // Log error
-                       PELOGE( limLog(pMac, LOGE,
-                               FL("received Auth frame from peer for unsupported auth algo %d "
-                               MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber, 
-                               MAC_ADDR_ARRAY(pHdr->sa));)
+                       PELOG1( limLog(pMac, LOG1,
+                               FL("received Auth frame from peer for unsupported auth algo %d, Addr "),
+                               pRxAuthFrameBody->authAlgoNumber);)
+                        PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                         authFrame.authAlgoNumber =
                         pRxAuthFrameBody->authAlgoNumber;
@@ -1099,7 +1100,7 @@
                             SIR_MAC_CHALLENGE_TEXT_EID)
                         {
                             // Log error
-                            PELOGE(limLog(pMac, LOGE,
+                            PELOG1(limLog(pMac, LOG1,
                                    FL("received Auth frame with invalid challenge text IE\n"));)
 
                             return;
@@ -1133,9 +1134,9 @@
                                                      LIM_NO_WEP_IN_FC,psessionEntry);
 
                                 // Log error
-                                PELOGE(limLog(pMac, LOGE,
-                                       FL("received Auth frame from peer when key mapping key is NULL"
-                                       MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pHdr->sa));)
+                                PELOG1(limLog(pMac, LOG1,
+                                       FL("received Auth frame from peer when key mapping key is NULL, addr "));)
+                                PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                                 limRestoreFromAuthState(pMac, eSIR_SME_NO_KEY_MAPPING_KEY_FOR_PEER,
                                                               eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
@@ -1161,7 +1162,7 @@
                                                     encrAuthFrame,key_length);
 
                                 psessionEntry->limMlmState = eLIM_MLM_WT_AUTH_FRAME4_STATE;
-                                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+                                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
                                 limSendAuthMgmtFrame(pMac,
                                                      (tpSirMacAuthFrameBody) encrAuthFrame,
@@ -1242,7 +1243,7 @@
 
                                 psessionEntry->limMlmState =
                                 eLIM_MLM_WT_AUTH_FRAME4_STATE;
-                                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+                                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
                                 limSendAuthMgmtFrame(pMac,
                                                      (tpSirMacAuthFrameBody) encrAuthFrame,
@@ -1262,10 +1263,10 @@
                  */
 
                 // Log error
-                PELOGE(limLog(pMac, LOGE,
-                       FL("received Auth frame from peer with failure code %d "
-                       MAC_ADDRESS_STR), pRxAuthFrameBody->authStatusCode, 
-                       MAC_ADDR_ARRAY(pHdr->sa));)
+                PELOG1(limLog(pMac, LOG1,
+                       FL("received Auth frame from peer with failure code %d addr "),
+                       pRxAuthFrameBody->authStatusCode);)
+                PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                 limRestoreFromAuthState(pMac, eSIR_SME_AUTH_REFUSED,
                                               pRxAuthFrameBody->authStatusCode,psessionEntry);
@@ -1294,10 +1295,10 @@
                                      LIM_NO_WEP_IN_FC,psessionEntry);
 
                 // Log error
-                PELOGE(limLog(pMac, LOGE,
-                       FL("received Auth frame3 from peer with auth algo number %d "
-                       MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber, 
-                       MAC_ADDR_ARRAY(pHdr->sa));)
+                PELOG1(limLog(pMac, LOG1,
+                       FL("received Auth frame3 from peer with auth algo number %d Addr "),
+                       pRxAuthFrameBody->authAlgoNumber);)
+                PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                 return;
             }
@@ -1324,9 +1325,9 @@
                                          LIM_NO_WEP_IN_FC,psessionEntry);
 
                     // Log error
-                    PELOGE(limLog(pMac, LOGE,
-                           FL("received Auth frame3 from peer with no WEP bit set "MAC_ADDRESS_STR),
-                           MAC_ADDR_ARRAY(pHdr->sa));)
+                    PELOG1(limLog(pMac, LOG1,
+                           FL("received Auth frame3 from peer with no WEP bit set, addr "));)
+                    PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                     return;
                 }
@@ -1353,9 +1354,9 @@
                                          LIM_NO_WEP_IN_FC,psessionEntry);
 
                     // Log error
-                    PELOGE(limLog(pMac, LOGW,
-                           FL("received AuthFrame3 from peer that has no preauth context "
-                           MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));)
+                    PELOG1(limLog(pMac, LOG1,
+                           FL("received AuthFrame3 from peer that has no preauth context. Addr "));)
+                    PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                     return;
                 }
@@ -1399,10 +1400,10 @@
                      */
 
                     // Log error
-                    PELOGE(limLog(pMac, LOGE,
-                           FL("received Auth frame3 from peer with status code %d "
-                           MAC_ADDRESS_STR), pRxAuthFrameBody->authStatusCode, 
-                           MAC_ADDR_ARRAY(pHdr->sa));)
+                    PELOG1(limLog(pMac, LOG1,
+                           FL("received Auth frame3 from peer with status code %d, addr "),
+                           pRxAuthFrameBody->authStatusCode);)
+                    PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                     return;
                 }
@@ -1474,9 +1475,9 @@
                                          LIM_NO_WEP_IN_FC,psessionEntry);
 
                     // Log error
-                   PELOGE( limLog(pMac, LOGW,
-                           FL("Challenge failure for peer "MAC_ADDRESS_STR), 
-						   MAC_ADDR_ARRAY(pHdr->sa));)
+                   PELOG1( limLog(pMac, LOG1,
+                           FL("Challenge failure for peer "));)
+                    PELOG1(limPrintMacAddr(pMac, pHdr->sa, LOG1);)
                     return;
                 }
             } // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE || ...
@@ -1511,10 +1512,11 @@
                  */
 
                 // Log error
-                PELOGE(limLog(pMac, LOGE,
-                       FL("received Auth frame4 from peer with invalid auth algo %d "
-                       MAC_ADDRESS_STR), pRxAuthFrameBody->authAlgoNumber, 
-                       MAC_ADDR_ARRAY(pHdr->sa));)
+                PELOG1(limLog(pMac, LOG1,
+                       FL("received Auth frame4 from peer with invalid auth algo %d, addr "),
+                       pRxAuthFrameBody->authAlgoNumber);)
+                PELOG1(limPrintMacAddr(pMac, pHdr->sa,
+                                LOG1);)
 
                 return;
             }
@@ -1530,9 +1532,9 @@
                  */
 
                 // Log error
-                PELOGE(limLog(pMac, LOGW,
-                       FL("received Auth frame4 from unexpected peer "
-                       MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));)
+                PELOG1(limLog(pMac, LOG1,
+                       FL("received Auth frame4 from unexpected peer "));
+                limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                 break;
             }
@@ -1546,10 +1548,10 @@
                  * Wait until Authentication Failure Timeout.
                  */
 
-                PELOGE(limLog(pMac, LOGE,
-                       FL("received Authentication frame from peer with invalid auth seq number %d "
-                       MAC_ADDRESS_STR), pRxAuthFrameBody->authTransactionSeqNumber, 
-                       MAC_ADDR_ARRAY(pHdr->sa));)
+                PELOG1(limLog(pMac, LOG1,
+                       FL("received Authentication frame from peer with invalid auth seq number %d, addr "),
+                       pRxAuthFrameBody->authTransactionSeqNumber);
+                limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                 break;
             }
@@ -1596,8 +1598,8 @@
                  */
 
                 // Log error
-                PELOGE(limLog(pMac, LOGE, FL("Authentication failure from peer "
-                       MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa));)
+                PELOG1(limLog(pMac, LOG1, FL("Authentication failure from peer "));
+                limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
                 limRestoreFromAuthState(pMac, eSIR_SME_AUTH_REFUSED,
                                               pRxAuthFrameBody->authStatusCode,psessionEntry);
@@ -1609,10 +1611,10 @@
             /// Invalid Authentication Frame received. Ignore it.
 
             // Log error
-            PELOGE(limLog(pMac, LOGE,
-                   FL("received Auth frame from peer with invalid auth seq number %d "
-                   MAC_ADDRESS_STR), pRxAuthFrameBody->authTransactionSeqNumber, 
-                   MAC_ADDR_ARRAY(pHdr->sa));)
+            PELOG1(limLog(pMac, LOG1,
+                   FL("received Auth frame from peer with invalid auth seq number %d, addr "),
+                   pRxAuthFrameBody->authTransactionSeqNumber);
+            limPrintMacAddr(pMac, pHdr->sa, LOG1);)
 
             break;
     } // end switch (pRxAuthFrameBody->authTransactionSeqNumber)
@@ -1670,10 +1672,6 @@
 #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
     limPrintMacAddr(pMac, pHdr->bssId, LOGE);
     limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
-    limLog(pMac,LOG2,FL("seqControl 0x%X\n"), 
-            ((pHdr->seqControl.seqNumHi << 8) | 
-            (pHdr->seqControl.seqNumLo << 4) |
-            (pHdr->seqControl.fragNum)));
 #endif
 
     // Check that its the same bssId we have for preAuth
@@ -1685,40 +1683,6 @@
         return eSIR_FAILURE;
     }
 
-    if (eANI_BOOLEAN_TRUE ==
-        pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed)
-    {
-        /*
-         * This is likely a duplicate for the same pre-auth request.
-         * PE/LIM already posted a response to SME. Hence, drop it.
-         * TBD: 
-         * 1) How did we even receive multiple auth responses?
-         * 2) Do we need to delete pre-auth session? Suppose we
-         * previously received an auth resp with failure which
-         * would not have created the session and forwarded to SME.
-         * And, we subsequently received an auth resp with success
-         * which would have created the session. This will now be
-         * dropped without being forwarded to SME! However, it is
-         * very unlikely to receive auth responses from the same
-         * AP with different reason codes.
-         * NOTE: return eSIR_SUCCESS so that the packet is dropped
-         * as this was indeed a response from the BSSID we tried to 
-         * pre-auth.
-         */
-        PELOGE(limLog(pMac,LOGE,"Auth rsp already posted to SME"
-               " (session %p, FT session %p)\n", psessionEntry,
-               pMac->ft.ftPEContext.pftSessionEntry););
-        return eSIR_SUCCESS;
-    }
-    else
-    {
-        PELOGE(limLog(pMac,LOGE,"Auth rsp not yet posted to SME"
-               " (session %p, FT session %p)\n", psessionEntry,
-               pMac->ft.ftPEContext.pftSessionEntry););
-        pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed =
-            eANI_BOOLEAN_TRUE;
-    }
-
 #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
     limLog(pMac, LOGE, FL("Pre-Auth response received from neighbor"));
     limLog(pMac, LOGE, FL("Pre-Auth done state"));
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
index cb3263d..e797901 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessBeaconFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -75,7 +75,7 @@
 limProcessBeaconFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
 {
     tpSirMacMgmtHdr      pHdr;
-    tSchBeaconStruct    *pBeacon;
+    tSchBeaconStruct     beacon;
 
     pMac->lim.gLimNumBeaconsRcvd++;
 
@@ -93,7 +93,6 @@
     if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS)
         return;
 
-
     /**
      * Expect Beacon only when
      * 1. STA is in Scan mode waiting for Beacon/Probe response or
@@ -106,16 +105,9 @@
         (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE) ||
         (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE))
     {
-        if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                    (void **)&pBeacon, sizeof(tSchBeaconStruct)))
-        {
-            limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limProcessBeaconFrame\n") );
-            return;
-        }
-
         // Parse received Beacon
         if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo,
-                                         pBeacon) != eSIR_SUCCESS)
+                                         &beacon) != eSIR_SUCCESS)
         {
             // Received wrongly formatted/invalid Beacon.
             // Ignore it and move on.
@@ -123,13 +115,12 @@
                    FL("Received invalid Beacon in state %X\n"),
                    psessionEntry->limMlmState);
             limPrintMlmState(pMac, LOGW,  psessionEntry->limMlmState);
-            palFreeMemory(pMac->hHdd, pBeacon);
             return;
         }
 
 
-        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, pBeacon->timeStamp[0]);)
-        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, pBeacon->timeStamp[1]);)
+        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, beacon.timeStamp[0]);)
+        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, beacon.timeStamp[1]);)
 
 
         if ((pMac->lim.gLimMlmState  == eLIM_MLM_WT_PROBE_RESP_STATE) ||
@@ -141,7 +132,7 @@
                || !pMac->lim.gpLimMlmScanReq->p2pSearch )
 #endif
             {
-                limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, 
+                limCheckAndAddBssDescription(pMac, &beacon, pRxPacketInfo, 
                        ((pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE) ? eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE), 
                        eANI_BOOLEAN_FALSE);
             }
@@ -154,10 +145,10 @@
              * uncommented. Also when we tested enabling this, there is a crash as soon as the station
              * comes up which needs to be fixed*/
             //if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE)
-              //  limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_TRUE);
-            limCollectMeasurementData(pMac, pRxPacketInfo, pBeacon);
+              //  limCheckAndAddBssDescription(pMac, &beacon, pRxPacketInfo, eANI_BOOLEAN_TRUE);
+            limCollectMeasurementData(pMac, pRxPacketInfo, &beacon);
            PELOG3(limLog(pMac, LOG3, FL("Parsed WDS info in Beacon frames: wdsLength=%d\n"),
-               pBeacon->propIEinfo.wdsLength);)
+               beacon.propIEinfo.wdsLength);)
 #endif
         }
         else
@@ -180,9 +171,8 @@
                }
              
              // STA in WT_JOIN_BEACON_STATE (IBSS)
-            limCheckAndAnnounceJoinSuccess(pMac, pBeacon, pHdr,psessionEntry);
+            limCheckAndAnnounceJoinSuccess(pMac, &beacon, pHdr,psessionEntry);
         } // if (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE)
-        palFreeMemory(pMac->hHdd, pBeacon);
     } // if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || ...
     else
     {
@@ -231,7 +221,7 @@
 limProcessBeaconFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
 {
     tpSirMacMgmtHdr      pHdr;
-    tSchBeaconStruct    *pBeacon;
+    tSchBeaconStruct     beacon;
 
     pMac->lim.gLimNumBeaconsRcvd++;
     pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
@@ -243,7 +233,6 @@
     if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS)
         return;
 
-
     /**
      * No session has been established. Expect Beacon only when
      * 1. STA is in Scan mode waiting for Beacon/Probe response or
@@ -253,19 +242,11 @@
         (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) ||
         (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE))
     {
-        if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                    (void **)&pBeacon, sizeof(tSchBeaconStruct)))
-        {
-            limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limProcessBeaconFrameNoSession\n") );
-            return;
-        }
-
-        if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo, pBeacon) != eSIR_SUCCESS)
+        if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo, &beacon) != eSIR_SUCCESS)
         {
             // Received wrongly formatted/invalid Beacon. Ignore and move on. 
             limLog(pMac, LOGW, FL("Received invalid Beacon in global MLM state %X\n"), pMac->lim.gLimMlmState);
             limPrintMlmState(pMac, LOGW,  pMac->lim.gLimMlmState);
-            palFreeMemory(pMac->hHdd, pBeacon);
             return;
         }
 
@@ -278,7 +259,7 @@
                || !pMac->lim.gpLimMlmScanReq->p2pSearch )
 #endif
             {
-                limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE);
+                limCheckAndAddBssDescription(pMac, &beacon, pRxPacketInfo, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE);
             }
         }
         else if (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE)
@@ -289,13 +270,12 @@
              * uncommented. Also when we tested enabling this, there is a crash as soon as the station
              * comes up which needs to be fixed*/
             //if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE)
-              //  limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_TRUE);
-            limCollectMeasurementData(pMac, pRxPacketInfo, pBeacon);
+              //  limCheckAndAddBssDescription(pMac, &beacon, pRxPacketInfo, eANI_BOOLEAN_TRUE);
+            limCollectMeasurementData(pMac, pRxPacketInfo, &beacon);
             limLog(pMac, LOG3, FL("Parsed WDS info in Beacon frames: wdsLength=%d\n"),
-               pBeacon->propIEinfo.wdsLength);
+               beacon.propIEinfo.wdsLength);
 #endif
         }  // end of eLIM_MLM_LEARN_STATE)       
-        palFreeMemory(pMac->hHdd, pBeacon);
     } // end of (eLIM_MLM_WT_PROBE_RESP_STATE) || (eLIM_MLM_PASSIVE_SCAN_STATE)
     else
     {
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c
index 32f2e6a..726da44 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessCfgUpdates.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -129,6 +129,101 @@
 
 } /*** end limSetDefaultKeyIdAndKeys() ***/
 
+
+/**
+ * handleCBCFGChange()
+ *
+ *FUNCTION:
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * If this API is invoked with
+ *   cfgId == ANI_IGNORE_CFG_ID
+ * Then,
+ *   this routine will traverse thru' ALL the
+ *   related CFG's that are statically setup
+ * Else,
+ *   only update this "1" CFG identified by cfgId
+ *
+ *NOTE:
+ *
+ * @param  pMac  - Pointer to Global MAC structure
+ * @param  cfgId - ID of CFG parameter that got updated
+ * @return None
+ */
+void handleCBCFGChange( tpAniSirGlobal pMac, tANI_U32 cfgId )
+{
+tANI_U32 cfg, val, i = 0;
+tANI_U32 defaultCfgList[] = { 
+  WNI_CFG_CHANNEL_BONDING_MODE,
+  ANI_IGNORE_CFG_ID };
+
+  do
+  {
+    //
+    // Determine if we have to use our own default CFG list
+    // OR should we use the argument passed to us
+    //
+    if( ANI_IGNORE_CFG_ID == cfgId )
+      cfg = defaultCfgList[i]; // "n" iterations reqd
+    else
+      cfg = cfgId; // Just "1" iteration reqd
+
+    switch( cfg )
+    {
+      case WNI_CFG_CHANNEL_BONDING_MODE:
+        if( eSIR_SUCCESS != wlan_cfgGetInt( pMac,
+              WNI_CFG_CHANNEL_BONDING_MODE,
+              &val ))
+        {
+          limLog( pMac, LOGW,
+              FL("Unable to retrieve CHANNEL BONDING Mode from CFG. Defaulting to DISABLE\n"));
+          pMac->lim.gCbMode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+        }
+        else
+          pMac->lim.gCbMode = (tANI_U8) val;
+
+        // Now, set the CHANNEL BONDING state apropriately
+        switch( pMac->lim.gCbMode )
+        {
+          // Always OFF
+          case WNI_CFG_CHANNEL_BONDING_MODE_DISABLE:
+            SET_CB_STATE_DISABLE( pMac->lim.gCbState );
+            break;
+
+          // Always ON
+          case WNI_CFG_CHANNEL_BONDING_MODE_ENABLE:
+            SET_CB_STATE_ENABLE( pMac->lim.gCbState );
+            break;
+
+          default:
+            SET_CB_STATE_ENABLE( pMac->lim.gCbState );
+            break;
+        }
+        break;
+
+      default:
+          break;
+    }
+
+    // DEBUG LOG the TITAN CFG's
+    limLog( pMac, LOG1,
+        FL("The TITAN related global CFG's are: "
+          "cbMode - %1d cbState - %1d\n"),
+        pMac->lim.gCbMode, pMac->lim.gCbState);
+
+    // If only "1" CFG needs an update, then return
+    if( ANI_IGNORE_CFG_ID == cfgId )
+      i++;
+    else
+      break;
+
+  } while( ANI_IGNORE_CFG_ID != defaultCfgList[i] ); // End-Of-List?
+}
+
 /** -------------------------------------------------------------
 \fn limSetCfgProtection
 \brief sets lim global cfg cache from the config.
@@ -276,8 +371,10 @@
 {
     tANI_U32 val1, val2;
     tANI_U16 val16;
+    tANI_U8 val8;
     tSirMacHTCapabilityInfo   *pHTCapabilityInfo;
     tSirMacHTParametersInfo *pAmpduParamInfo;
+    tSirMacHTInfoField1         *pHTInfoField1;
 
     PELOG3(limLog(pMac, LOG3, FL("Handling CFG parameter id %X update\n"), cfgId);)
     switch (cfgId)
@@ -339,7 +436,7 @@
                    (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)))
             {
                 // Reactivate Background scan timer
-                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
+                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
                 if (tx_timer_activate(
                       &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
                 {
@@ -376,7 +473,7 @@
                 pMac->lim.limTimers.gLimPreAuthClnupTimer.sessionId = sessionId;
 #endif
                 // Reactivate pre-auth cleanup timer
-                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_PRE_AUTH_CLEANUP_TIMER));
+                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PRE_AUTH_CLEANUP_TIMER));
                 if (tx_timer_activate(&pMac->lim.limTimers.gLimPreAuthClnupTimer)
                                                        != TX_SUCCESS)
                 {
@@ -402,6 +499,44 @@
 
             break;
 
+    case WNI_CFG_CHANNEL_BONDING_MODE:
+         handleCBCFGChange( pMac, cfgId );
+         //for Secondary channel, change setupCBMode function OR the caller of that function during Join (STA) or Start BSS(AP/IBSS)
+         //Now update the HT Capability CFG based on Channel Bonding CFG
+         if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS) 
+            {
+                PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
+                break;
+            }
+        if (wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS) 
+            {
+                PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG\n"));)
+                break;
+            }
+        val16 = ( tANI_U16 ) val1;
+        pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
+
+        //channel bonding mode could be set to anything from 0 to 4(Titan had these modes)
+        //But for Taurus we have only two modes: enable(>0) or disable(=0)
+        pHTCapabilityInfo->supportedChannelWidthSet = val2 ? WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
+        if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS)
+            PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
+
+         if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS) 
+            {
+                PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG\n"));)
+                break;
+            }
+        val8 = ( tANI_U8 ) val1;
+        pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
+        pHTInfoField1->recommendedTxWidthSet = (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
+        pMac->lim.gHTRecommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
+        if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1) != eSIR_SUCCESS)
+            PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field\n"));)
+
+        break;
+
+
     case WNI_CFG_TRIG_STA_BK_SCAN:
         if(limUpdateTriggerStaBkScanFlag(pMac) != eSIR_SUCCESS)
         {
@@ -568,17 +703,9 @@
         } 
         else 
         {
-            tANI_U16 sessionId;
             pMac->sys.gSysEnableLinkMonitorMode = 1;
-            for(sessionId = 0; sessionId < pMac->lim.maxBssId; sessionId++)
-            {
-                if( (pMac->lim.gpSession[sessionId].valid )&& 
-                    (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[sessionId].limMlmState) &&
-                    ( pMac->pmm.gPmmState != ePMM_STATE_BMPS_SLEEP))
-                {
-                    limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[sessionId]);
-                }
-            }
+            //limReactivateTimer( pMac, eLIM_HEART_BEAT_TIMER );
+            //limReactivateHeartBeatTimer(pMac, psessionEntry);
             PELOGE(limLog(pMac, LOGE, "Reactivating heartbeat link monitoring\n");)
         }        
     case WNI_CFG_MAX_PS_POLL:
@@ -692,14 +819,15 @@
 
     limUpdateConfig(pMac,psessionEntry);
 
-    if (phyMode == WNI_CFG_PHY_MODE_11A)
+    if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &val)
+            != eSIR_SUCCESS)
     {
-        // 11a mode always uses short slot
-        // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
-        psessionEntry->shortSlotTimeSupported = true;
+        limLog(pMac, LOGP, FL("cfg get WNI_CFG_SHORT_SLOT_TIME failed\n"));
+        return;
     }
-    else if (phyMode == WNI_CFG_PHY_MODE_11G)
+    if (phyMode == WNI_CFG_PHY_MODE_11G)
     {
+
         if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
            (psessionEntry->pePersona == VOS_P2P_GO_MODE))
         {
@@ -714,12 +842,22 @@
         else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
             // Reassociating with AP.
             val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
-        psessionEntry->shortSlotTimeSupported = val;
+
+ 
+        if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, val) != eSIR_SUCCESS)
+        {
+            limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
+            return;
+        }
     }
-    else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
+    else
     {
-        // Will reach here in 11b case
-        psessionEntry->shortSlotTimeSupported = false;
+        // Reset short slot time at CFG
+        if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, 0) != eSIR_SUCCESS)
+        {
+            limLog(pMac, LOGP, FL("could not update short slot time at CFG\n"));
+            return;
+    }
     }
     //apply protection related config.
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c
index 1a440b4..1147e90 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessDeauthFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -110,7 +110,7 @@
 
     PELOGE(limLog(pMac, LOGE,
         FL("received Deauth frame (mlm state = %s) with reason code %d from "),
-        limMlmStateStr(psessionEntry->limMlmState), reasonCode);
+        limMlmStateStr(pMac->lim.gLimMlmState), reasonCode);
     limPrintMacAddr(pMac, pHdr->sa, LOGE);)
       
     if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE )||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
@@ -190,8 +190,6 @@
     if (limIsReassocInProgress(pMac,psessionEntry)) {
         if (!IS_REASSOC_BSSID(pMac,pHdr->sa,psessionEntry)) {
             PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from unknown/different AP while ReAssoc. Ignore \n"));)
-            limPrintMacAddr(pMac, pHdr->sa, LOGE);
-            limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
             return;
         }
 
@@ -199,9 +197,7 @@
          *  Drop ReAssoc and Restore the Previous context( current connected AP).
          */
         if (!IS_CURRENT_BSSID(pMac, pHdr->sa,psessionEntry)) {
-            PELOGE(limLog(pMac, LOGE, FL("received DeAuth from the New AP to which ReAssoc is sent \n"));)
-            limPrintMacAddr(pMac, pHdr->sa, LOGE);
-            limPrintMacAddr(pMac, psessionEntry->bssId, LOGE);
+            PELOGE(limLog(pMac, LOGW, FL("received DeAuth from the New AP to which ReAssoc is sent \n"));)
             limRestorePreReassocState(pMac,
                                   eSIR_SME_REASSOC_REFUSED, reasonCode,psessionEntry);
             return;
@@ -263,7 +259,7 @@
                         mlmDeauthInd.reasonCode = reasonCode;
 
                         psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
                         
                         limPostSmeMessage(pMac,
@@ -294,7 +290,7 @@
 
                         psessionEntry->limMlmState =
                                    psessionEntry->limPrevMlmState;
-                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, psessionEntry->limMlmState));
 
                         // Deactive Association response timeout
                         limDeactivateAndChangeTimer(
@@ -324,10 +320,9 @@
                         break;
 
                     case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
-                        PELOGE(limLog(pMac, LOGE,
+                        PELOG1(limLog(pMac, LOG1,
                            FL("received Deauth frame in FT state %X with reasonCode=%d from "),
                            psessionEntry->limMlmState, reasonCode);)
-                        limPrintMacAddr(pMac, pHdr->sa, LOGE);
                         break;
 
                     default:
@@ -421,11 +416,10 @@
     mlmDeauthInd.deauthTrigger = eLIM_PEER_ENTITY_DEAUTH;
 
 
-    /* 
-     * If we're in the middle of ReAssoc and received deauth from 
+    /* If we're in the middle of ReAssoc and received deauth from 
      * the ReAssoc AP, then notify SME by sending REASSOC_RSP with 
-     * failure result code. SME will post the disconnect to the
-     * supplicant and the latter would start a fresh assoc.
+     * failure result code. By design, SME will then issue "Disassoc"  
+     * and cleanup will happen at that time. 
      */
     if (limIsReassocInProgress(pMac,psessionEntry)) {
         /**
@@ -442,14 +436,7 @@
         }
 
         PELOGE(limLog(pMac, LOGE, FL("Rcv Deauth from ReAssoc AP. Issue REASSOC_CNF. \n"));)
-       /*
-        * TODO: Instead of overloading eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE
-        * it would have been good to define/use a different failure type.
-        * Using eSIR_SME_FT_REASSOC_FAILURE does not seem to clean-up
-        * properly and we end up seeing "transmit queue timeout".
-        */
-       limPostReassocFailure(pMac, eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE,
-               eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
+        limRestorePreReassocState(pMac, eSIR_SME_REASSOC_REFUSED, reasonCode,psessionEntry);
         return;
     }
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c
index 656edc3..1e138a9 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessDisassocFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -109,9 +109,10 @@
     // Get reasonCode from Disassociation frame body
     reasonCode = sirReadU16(pBody);
 
-    PELOG2(limLog(pMac, LOG2,
-        FL("Received Disassoc frame (mlm state %d sme state %d), with reason code %d from "MAC_ADDRESS_STR), 
-        psessionEntry->limMlmState, psessionEntry->limSmeState, reasonCode, MAC_ADDR_ARRAY(pHdr->sa));)
+    PELOGE(limLog(pMac, LOGE,
+        FL("Received Disassoc frame (mlm state %d sme state %d), with reason code %d from \n"), 
+        psessionEntry->limMlmState, psessionEntry->limSmeState, reasonCode);)
+    limPrintMacAddr(pMac, pHdr->sa, LOGE);
 
     /**
    * Extract 'associated' context for STA, if any.
@@ -205,7 +206,7 @@
             case eSIR_MAC_DISASSOC_LEAVING_BSS_REASON:
                 // Valid reasonCode in received Disassociation frame
                 // as long as we're not about to channel switch
-                if(psessionEntry->gLimChannelSwitch.state != eLIM_CHANNEL_SWITCH_IDLE)
+                if(pMac->lim.gLimChannelSwitch.state != eLIM_CHANNEL_SWITCH_IDLE)
                 {
                     limLog(pMac, LOGW,
                         FL("Ignoring disassoc frame due to upcoming "
@@ -240,9 +241,9 @@
 
     // Disassociation from peer MAC entity
 
-   PELOGE(limLog(pMac, LOGE,
-           FL("Received Disassoc frame from sta with assocId=%d with reasonCode=%d. Peer MAC is "MAC_ADDRESS_STR),
-           pStaDs->assocId, reasonCode, MAC_ADDR_ARRAY(pHdr->sa));)
+   PELOG3(limLog(pMac, LOG3,
+           FL("Received Disassoc frame from sta with assocId=%d, with reasonCode=%d\n"),
+           pStaDs->assocId, reasonCode);)
 
     if ((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
         (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE))
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessLmmMessages.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessLmmMessages.c
index 0ec72ee..27c95ce 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessLmmMessages.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessLmmMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -674,7 +674,7 @@
         pMac->lim.gLimSmeState = eLIM_SME_LINK_EST_WT_SCAN_STATE;
     else
         return;
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
     /* The commented piece of code here is to handle the Measurement Request from WSM as Scan
      * request in the LIM in Linux Station. Currently, the station uses Measurement request to 
@@ -686,7 +686,7 @@
     {
         pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
         pMac->lim.gLimMlmState     = eLIM_MLM_LEARN_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
         pMac->lim.gLimSystemInScanLearnMode = eANI_BOOLEAN_TRUE;
     }
 #if 0
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
index 5f9e531..45b55e7 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMessageQueue.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -98,7 +98,8 @@
 
 
 /* this function should not changed */
-  if(pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
+  if((pMac->lim.gLimSmeState == eLIM_SME_SUSPEND_STATE) &&
+      (limMsg->type != SIR_LIM_RESUME_ACTIVITY_NTF))
   {
       // Defer processsing this message
       if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
@@ -125,6 +126,7 @@
         (limMsg->type != WDA_SET_BSSKEY_RSP)&&
         (limMsg->type != WDA_SET_STAKEY_RSP)&&
         (limMsg->type != WDA_SET_STA_BCASTKEY_RSP) &&
+        (limMsg->type != SIR_LIM_RESUME_ACTIVITY_NTF)&&
         (limMsg->type != eWNI_SME_START_REQ) &&
         (limMsg->type != WDA_AGGR_QOS_RSP) &&
         (limMsg->type != WDA_REMOVE_BSSKEY_RSP) &&
@@ -302,11 +304,11 @@
 #endif
     if(retCode == TX_SUCCESS)
         {
-            MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
+            MTRACE(macTraceMsgRx(pMac, 0, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
         }
     else
         {
-            MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
+            MTRACE(macTraceMsgRx(pMac, 0, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
         }
 
 
@@ -715,7 +717,7 @@
     fcOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pRxPacketInfo);
     fc = pHdr->fc;
 
-    limLog( pMac, LOG4, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d\n"),
+    limLog( pMac, LOG1, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d\n"),
             fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
    
 
@@ -1176,8 +1178,6 @@
 #endif
     if(pMac->gDriverType == eDRIVER_TYPE_MFG)
     {
-        palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
-        limMsg->bodyptr = NULL;
         return;
     }
 #ifdef WLAN_DEBUG    
@@ -1189,15 +1189,61 @@
       limMsgStr(limMsg->type), limSmeStateStr(pMac->lim.gLimSmeState),
       limMlmStateStr(pMac->lim.gLimMlmState));)
 
-    MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
+    MTRACE(macTraceMsgRx(pMac, 0, LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
 
     switch (limMsg->type)
     {
+#if defined(ANI_DVT_DEBUG)
+        case SIR_LIM_SUSPEND_ACTIVITY_REQ:
+            // This message is from HAL notifying LIM
+            // to suspend activity. (PTT needs)
+            // Disable TFP & RHP
+            //halSetStaTxEnable(pMac, 1, eHAL_CLEAR);
+            //halStopDataTraffic(pMac);
+            //halSetRxEnable(pMac, eHAL_CLEAR);
+
+            pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
+            pMac->lim.gLimSmeState     = eLIM_SME_SUSPEND_STATE;
+         MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+            // Post message back to HAL
+            msgQ.type = WDA_SUSPEND_ACTIVITY_RSP;
+            MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+            wdaPostCtrlMsg(pMac, &msgQ);
+            break;
+#endif
 
         case SIR_LIM_UPDATE_BEACON:
             limUpdateBeacon(pMac);
             break;
 
+        case SIR_LIM_RESUME_ACTIVITY_NTF:
+            // This message is from HAL notifying LIM
+            // to resume activity.
+            if (pMac->lim.gLimSmeState == eLIM_SME_SUSPEND_STATE)
+            {
+                limLog(pMac, LOGE,
+                   FL("Received RESUME_NTF in State %s on Role %d\n"),
+                   limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSystemRole);
+                pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
+             MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+                 handleCBCFGChange( pMac, ANI_IGNORE_CFG_ID );
+                 handleHTCapabilityandHTInfo(pMac);
+                 //initialize the TSPEC admission control table.
+                 limAdmitControlInit(pMac);
+                 limRegisterHalIndCallBack(pMac);
+            }
+            else
+            {
+                limLog(pMac, LOGE,
+                   FL("Received RESUME_NTF in inval State %X on Role %d\n"),
+                   pMac->lim.gLimSmeState, pMac->lim.gLimSystemRole);
+                limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
+            }
+
+            break;
+
         case SIR_CFG_PARAM_UPDATE_IND:
             /// CFG parameter updated
             if (limIsSystemInScanState(pMac))
@@ -1409,6 +1455,28 @@
 
         case eWNI_PMC_SMPS_STATE_IND :
         {
+#ifdef SUPPORT_eWNI_PMC_SMPS_STATE_IND
+            tSirMbMsg *pMBMsg;
+            tSirMacHTMIMOPowerSaveState mimoPSstate;
+            /** Is System processing any SMPS Indication*/
+            if (!limIsSystemInSetMimopsState(pMac))
+            {
+                pMBMsg = (tSirMbMsg *)limMsg->bodyptr;
+                palCopyMemory(pMac->hHdd, &mimoPSstate, pMBMsg->data, sizeof(tSirMacHTMIMOPowerSaveState));
+                limSMPowerSaveStateInd(pMac, mimoPSstate);
+            }
+            else
+            {
+                if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
+                {
+                    PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
+                        limMsg->type, pMac->lim.gLimSmeState,  pMac->lim.gLimPrevSmeState,
+                        pMac->lim.gLimSystemRole,  pMac->lim.gLimMlmState,  pMac->lim.gLimPrevMlmState);)
+                    limLogSessionStates(pMac);
+                    limPrintMsgName(pMac, LOGE, limMsg->type);
+                }
+            }
+#endif
             if(limMsg->bodyptr){
             palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
             limMsg->bodyptr = NULL;
@@ -1478,10 +1546,7 @@
          * function used in timeout case(i.e SIR_LIM_CHANNEL_SWITCH_TIMEOUT) 
          * for switching the channel*/
         case eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER:
-            if ( !tx_timer_running(&pMac->lim.limTimers.gLimChannelSwitchTimer) )
-            {  
-                limProcessChannelSwitchTimeout(pMac);
-            }
+            limProcessChannelSwitchTimeout(pMac);
             palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
             limMsg->bodyptr = NULL;
             break;
@@ -2044,8 +2109,8 @@
     }
 
     /* limInsystemInscanState() refers the psessionEntry,  how to get session Entry????*/
-    if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) /*||
-                (LIM_IS_RADAR_DETECTED(pMac))*/) && fDeferMsg)
+    if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) ||
+                (LIM_IS_RADAR_DETECTED(pMac))) && fDeferMsg)
     {
         // System is in DFS (Learn) mode or awaiting addts response
         // or if radar is detected, Defer processsing this message
@@ -2086,7 +2151,7 @@
 }
 
 void
-handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry)
+handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac)
 {
     tSirMacHTCapabilityInfo macHTCapabilityInfo;
     tSirMacHTParametersInfo macHTParametersInfo;
@@ -2095,7 +2160,13 @@
     tSirMacHTInfoField3 macHTInfoField3;
     tANI_U32  cfgValue;
     tANI_U8 *ptr;
+    tpPESession psessionEntry = &pMac->lim.gpSession[0];//TBD-RAJESH HOW TO GET sessionEntry?????
 
+    pMac->lim.htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);  
+
+
+
+    // Get HT Capabilities
     if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != eSIR_SUCCESS)
     {
         limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value\n"));
@@ -2109,6 +2180,7 @@
     pMac->lim.gHTMaxAmsduLength = (tANI_U8)macHTCapabilityInfo.maximalAMSDUsize;
     pMac->lim.gHTShortGI20Mhz = (tANI_U8)macHTCapabilityInfo.shortGI20MHz;
     pMac->lim.gHTShortGI40Mhz = (tANI_U8)macHTCapabilityInfo.shortGI40MHz;
+    pMac->lim.gHTSupportedChannelWidthSet = (tANI_U8)macHTCapabilityInfo.supportedChannelWidthSet;
     pMac->lim.gHTPSMPSupport = (tANI_U8)macHTCapabilityInfo.psmp;
     pMac->lim.gHTDsssCckRate40MHzSupport = (tANI_U8)macHTCapabilityInfo.dsssCckMode40MHz;
 
@@ -2133,6 +2205,8 @@
     pMac->lim.gHTServiceIntervalGranularity = (tANI_U8)macHTInfoField1.serviceIntervalGranularity;
     pMac->lim.gHTControlledAccessOnly = (tANI_U8)macHTInfoField1.controlledAccessOnly;
     pMac->lim.gHTRifsMode = (tANI_U8)macHTInfoField1.rifsMode;
+    pMac->lim.gHTRecommendedTxWidthSet = (tANI_U8)macHTInfoField1.recommendedTxWidthSet;
+    pMac->lim.gHTSecondaryChannelOffset = (tSirMacHTSecondaryChannelOffset)macHTInfoField1.secondaryChannelOffset;
 
     if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != eSIR_SUCCESS)
     {
@@ -2152,20 +2226,10 @@
     *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
     pMac->lim.gHTPCOActive = (tANI_U8)macHTInfoField3.pcoActive;
     pMac->lim.gHTPCOPhase = (tANI_U8)macHTInfoField3.pcoPhase;
+    psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
     pMac->lim.gHTSecondaryBeacon = (tANI_U8)macHTInfoField3.secondaryBeacon;
     pMac->lim.gHTDualCTSProtection = (tANI_U8)macHTInfoField3.dualCTSProtection;
     pMac->lim.gHTSTBCBasicMCS = (tANI_U8)macHTInfoField3.basicSTBCMCS;
-
-    /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
-     * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
-     * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
-     * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
-     */
-    if (psessionEntry != NULL)
-    {
-        psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);  
-        psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
-    }
 }
 
 void limLogSessionStates(tpAniSirGlobal pMac)
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
index 2b0f05a..3d40e9b 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -87,9 +87,28 @@
 
 static void limProcessMlmRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
 void 
-limSetChannel(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 secChannelOffset, tPowerdBm maxTxPower, tANI_U8 peSessionId);
+limSetChannel(tpAniSirGlobal pMac, tANI_U32 titanHtcap, tANI_U8 channel, tPowerdBm maxTxPower, tANI_U8 peSessionId);
+
+
+/*
+ * determine the secondary channel state for hal
+ */
+static ePhyChanBondState
+mlm_get_ext_chnl(
+    tpAniSirGlobal      pMac,
+    tAniCBSecondaryMode chnl)
+{
+    if (chnl == eANI_CB_SECONDARY_UP)
+        return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
+    if (chnl == eANI_CB_SECONDARY_DOWN)
+        return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
+    return PHY_SINGLE_CHANNEL_CENTERED;
+
+}
+
+
 #define IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac)    (pMac->lim.gpLimMlmScanReq->backgroundScanMode == eSIR_AGGRESSIVE_BACKGROUND_SCAN)
-#define IS_MLM_SCAN_REQ_BACKGROUND_SCAN_NORMAL(pMac)        (pMac->lim.gpLimMlmScanReq->backgroundScanMode == eSIR_NORMAL_BACKGROUND_SCAN)
+
 
 /**
  * limProcessMlmReqMessages()
@@ -188,28 +207,16 @@
 
 #ifdef ANI_PRODUCT_TYPE_CLIENT         
        if ( IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac) )
-       {
            checkTraffic = eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN;
-       }
-       else if (IS_MLM_SCAN_REQ_BACKGROUND_SCAN_NORMAL(pMac))
-       {
-           checkTraffic = eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN;
-       }
        else 
-           checkTraffic = eSIR_CHECK_ROAMING_SCAN;
+           checkTraffic = eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN;
 #else
             /* Currently checking the traffic before scan for Linux station. This is because MLM
              * scan request is not filled as scan is received via Measurement req in Linux. This
              * should be made as common code for Windows/Linux station once the scan requests are
              * enabled in Linux
              * TODO */
-       if ( IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac) ||
-            IS_MLM_SCAN_REQ_BACKGROUND_SCAN_NORMAL(pMac))
-       {
             checkTraffic = eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN;
-       }
-       else
-            checkTraffic = eSIR_CHECK_ROAMING_SCAN;
 #endif
 
     PELOG1(limLog(pMac, LOG1, FL("Calling limSendHalInitScanReq\n"));)
@@ -351,7 +358,7 @@
     pMac->lim.gpchangeChannelData = cbdata;
 
     limSendSwitchChnlParams(pMac, newChannel,
-        PHY_SINGLE_CHANNEL_CENTERED,
+        eHT_SECONDARY_CHANNEL_OFFSET_NONE,
         psessionEntry->maxTxPower, psessionEntry->peSessionId);
 
     return;
@@ -450,7 +457,7 @@
             pMac->lim.limTimers.gLimMinChannelTimer.sessionId = sessionId;
 #endif            
             
-            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_MIN_CHANNEL_TIMER));
+            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_MIN_CHANNEL_TIMER));
 
             if (tx_timer_activate(&pMac->lim.limTimers.gLimMinChannelTimer) != TX_SUCCESS)
             {
@@ -498,7 +505,7 @@
         PELOG2(limLog(pMac, LOG2, FL("START PASSIVE Scan chan %d\n"), channelNum);)
 
         /// Passive Scanning. Activate maxChannelTimer
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_MAX_CHANNEL_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_MAX_CHANNEL_TIMER));
         if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
                                       != TX_SUCCESS)
         {
@@ -524,8 +531,6 @@
                 tANI_U32 val1 = 0;
 
                 val = SYS_MS_TO_TICKS(val);
-                //TODO: consider sessions.
-#if 0
 #ifdef ANI_PRODUCT_TYPE_CLIENT
                 // If a background was triggered via Quiet BSS,
                 // then we need to adjust the MIN and MAX channel
@@ -543,10 +548,9 @@
                     val1 = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
                 }
 #endif
-#endif
                 //Pick the longer stay time
                 val = (val > val1) ? val : val1;
-                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_MAX_CHANNEL_TIMER));
+                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_MAX_CHANNEL_TIMER));
                 if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
                                 val, 0) != TX_SUCCESS)
                 {
@@ -716,32 +720,61 @@
     {
         pInitScanParam->notifyBss = TRUE;
         pInitScanParam->notifyHost = FALSE;
-        if (eSIR_CHECK_ROAMING_SCAN == trafficCheck)
+        pInitScanParam->scanMode = eHAL_SYS_MODE_LEARN;
+
+#if defined(ANI_AP_CLIENT_SDK) 
+        if (GET_LIM_SYSTEM_ROLE(pMac) == eLIM_STA_ROLE)
         {
-           pInitScanParam->scanMode = eHAL_SYS_MODE_ROAM_SCAN;
+            pInitScanParam->frameType = SIR_MAC_DATA_NULL;
+            // We need to inform the AP only when we are
+            // in the LINK_ESTABLISHED state
+            if( eLIM_SME_LINK_EST_WT_SCAN_STATE != pMac->lim.gLimSmeState )
+            {
+                pInitScanParam->notifyBss = FALSE;
+                // FIXME - Handle this one carefully
+                pInitScanParam->notifyHost = FALSE;
+            }
+            __limCreateInitScanRawFrame(pMac, pInitScanParam);
+            pInitScanParam->checkLinkTraffic = trafficCheck;
         }
         else
+#endif
         {
-           pInitScanParam->scanMode = eHAL_SYS_MODE_LEARN;
+            pInitScanParam->frameType = SIR_MAC_CTRL_CTS;
+            __limCreateInitScanRawFrame(pMac, pInitScanParam);
+            pInitScanParam->checkLinkTraffic = trafficCheck;
         }
 
-        pInitScanParam->frameType = SIR_MAC_CTRL_CTS;
-        __limCreateInitScanRawFrame(pMac, pInitScanParam);
-        pInitScanParam->checkLinkTraffic = trafficCheck;
+#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
+        /* Currently using the AP's scanDuration values for Linux station also. This should
+         * be revisited if this needs to changed depending on AP or Station */
+        {
+            if (pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity &&
+                    (pMac->lim.gLimMeasParams.shortDurationCount ==
+                     pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity))
+            {
+#ifdef ANI_AP_SDK
+                pInitScanParam->scanDuration = (tANI_U16)pMac->lim.gLimScanDurationConvert.longChannelScanDuration_tick;
+#else
+                pInitScanParam->scanDuration = (tANI_U16)pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration;
+#endif /* ANI_AP_SDK */
+            }
+            else
+            {
+#ifdef ANI_AP_SDK
+                pInitScanParam->scanDuration = pMac->lim.gLimScanDurationConvert.shortChannelScanDuration_tick;
+#else
+                pInitScanParam->scanDuration = (tANI_U16)pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration;
+#endif /* ANI_AP_SDK */
+            }
+        }
+#endif       //#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
     }
     else
     {
         if(nextState == eLIM_HAL_SUSPEND_LINK_WAIT_STATE)
         {
-           if (eSIR_CHECK_ROAMING_SCAN == trafficCheck)
-           {
-              pInitScanParam->scanMode = eHAL_SYS_MODE_ROAM_SUSPEND_LINK;
-           }
-           else
-           {
-              pInitScanParam->scanMode = eHAL_SYS_MODE_SUSPEND_LINK;
-           }
-           
+            pInitScanParam->scanMode = eHAL_SYS_MODE_SUSPEND_LINK;
         }
         else
         {
@@ -762,7 +795,7 @@
 
     pMac->lim.gLimHalScanState = nextState;
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
 
     rc = wdaPostCtrlMsg(pMac, &msg);
     if (rc == eSIR_SUCCESS) {
@@ -843,8 +876,8 @@
         pMac->lim.gLimHalScanState = nextState;
         SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
 
-        MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
-        limLog(pMac, LOG1, FL("Channel %d\n"), channelNum);
+        MTRACE(macTraceMsgTx(pMac, 0, msg.type));
+        PELOGW(limLog(pMac, LOGW, FL("Channel %d\n"), channelNum);)
 
             rc = wdaPostCtrlMsg(pMac, &msg);
         if (rc == eSIR_SUCCESS) {
@@ -916,7 +949,7 @@
 
         pMac->lim.gLimHalScanState = nextState;
         SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-        MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
+        MTRACE(macTraceMsgTx(pMac, 0, msg.type));
 
         rc = wdaPostCtrlMsg(pMac, &msg);
         if (rc == eSIR_SUCCESS) {
@@ -1009,9 +1042,9 @@
     msg.type = WDA_FINISH_SCAN_REQ;
     msg.bodyptr = pFinishScanParam;
     msg.bodyval = 0;
-    
-    peGetResumeChannel(pMac, &pFinishScanParam->currentOperChannel, &pFinishScanParam->cbState);
-
+    pFinishScanParam->currentOperChannel = peGetResumeChannel(pMac);
+    //TODO: Fix CB State. Get it from session. similar to getChannel. 
+    pFinishScanParam->cbState = limGetPhyCBState( pMac );
     palZeroMemory( pMac->hHdd, (tANI_U8 *)&pFinishScanParam->macMgmtHdr, sizeof(tSirMacMgmtHdr));
 
     if (nextState == eLIM_HAL_FINISH_LEARN_WAIT_STATE)
@@ -1021,7 +1054,6 @@
         pFinishScanParam->notifyBss = FALSE;
         pFinishScanParam->notifyHost = FALSE;
         pFinishScanParam->frameType = 0;
-
         pFinishScanParam->frameLength = 0;
         pMac->lim.gLimHalScanState = nextState;
     }
@@ -1047,7 +1079,7 @@
     }
 
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
 
     rc = wdaPostCtrlMsg(pMac, &msg);
     if (rc == eSIR_SUCCESS) {
@@ -1205,17 +1237,14 @@
     limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
 
     /* Re-activate Heartbeat timers for connected sessions as scan 
-     * is done if the DUT is in active mode
-     * AND it is not a ROAMING ("background") scan */
-    if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
+     * is done if the DUT is in active mode*/
+    if((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
        (ePMM_STATE_READY == pMac->pmm.gPmmState))
-        && (pMac->lim.gLimBackgroundScanMode != eSIR_ROAMING_SCAN ))
     {
       for(i=0;i<pMac->lim.maxBssId;i++)
       {
-        if((peFindSessionBySessionId(pMac,i) != NULL) &&
-           (pMac->lim.gpSession[i].valid == TRUE) && 
-           (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
+        if((pMac->lim.gpSession[i].valid == TRUE) && 
+          (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
         {
           limReactivateHeartBeatTimer(pMac, peFindSessionBySessionId(pMac,i));
         }  
@@ -1269,7 +1298,7 @@
     msg.bodyval = 0;
 
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
 
     rc = wdaPostCtrlMsg(pMac, &msg);
     if(rc == eSIR_SUCCESS)
@@ -1448,20 +1477,11 @@
 
 #endif
     }
-#ifdef WLAN_FEATURE_11AC
-    if (psessionEntry->vhtCapability)
-    {
-        pSta->vhtCapable = VOS_TRUE;
-    }
-#endif
-#ifdef WLAN_FEATURE_11AC
-    limPopulateOwnRateSet(pMac, &pSta->supportedRates, NULL, false,psessionEntry,NULL);
-#else
+
     limPopulateOwnRateSet(pMac, &pSta->supportedRates, NULL, false,psessionEntry);
-#endif
     limFillSupportedRatesInfo(pMac, NULL, &pSta->supportedRates,psessionEntry);
     
-    limLog( pMac, LOG1, FL( "GF: %d, ChnlWidth: %d, MimoPS: %d, lsigTXOP: %d, dsssCCK: %d, SGI20: %d, SGI40%d") ,
+    limLog( pMac, LOGE, FL( "GF: %d, ChnlWidth: %d, MimoPS: %d, lsigTXOP: %d, dsssCCK: %d, SGI20: %d, SGI40%d\n") ,
                                           pSta->greenFieldCapable, pSta->txChannelWidthSet, pSta->mimoPS, pSta->lsigTxopProtection, 
                                           pSta->fDsssCckMode40Mhz,pSta->fShortGI20Mhz, pSta->fShortGI40Mhz);
 
@@ -1495,6 +1515,10 @@
     tpAddBssParams pAddBssParams = NULL;
     tANI_U32 retCode;
 
+#ifdef WLAN_SOFTAP_FEATURE
+    tANI_U32 val = 0;
+#endif
+    
     // Package WDA_ADD_BSS_REQ message parameters
 
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
@@ -1531,9 +1555,16 @@
     }
 
 #ifdef WLAN_SOFTAP_FEATURE  
-    pAddBssParams->shortSlotTimeSupported = psessionEntry->shortSlotTimeSupported;
+    if( wlan_cfgGetInt ( pMac, WNI_CFG_SHORT_SLOT_TIME, &val ) != eSIR_SUCCESS)
+    {
+        limLog ( pMac, LOGP, FL(" Error : unable to fetch the WNI_CFG_SHORT_SLOT_TIME\n"));
+        palFreeMemory(pMac->hHdd,(void *)pAddBssParams);
+        return eSIR_SME_HAL_SEND_MESSAGE_FAIL;
+    }
+    pAddBssParams->shortSlotTimeSupported = (tANI_U8)val;
 #endif
 
+
     pAddBssParams->beaconInterval               = pMlmStartReq->beaconPeriod;
     pAddBssParams->dtimPeriod                   = pMlmStartReq->dtimPeriod;
     pAddBssParams->cfParamSet.cfpCount          = pMlmStartReq->cfParamSet.cfpCount;
@@ -1548,16 +1579,12 @@
     pAddBssParams->nwType = pMlmStartReq->nwType;
 
     pAddBssParams->htCapable            = pMlmStartReq->htCapable;
-#ifdef WLAN_FEATURE_11AC
-    pAddBssParams->vhtCapable           = psessionEntry->vhtCapability;
-    pAddBssParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet; 
-#endif
     pAddBssParams->htOperMode           = pMlmStartReq->htOperMode;
     pAddBssParams->dualCTSProtection    = pMlmStartReq->dualCTSProtection;
     pAddBssParams->txChannelWidthSet    = pMlmStartReq->txChannelWidthSet;
 
     pAddBssParams->currentOperChannel   = pMlmStartReq->channelNumber;
-    pAddBssParams->currentExtChannel    = pMlmStartReq->cbMode;
+    pAddBssParams->currentExtChannel    = mlm_get_ext_chnl(pMac, pMlmStartReq->cbMode);
 
     /* Update PE sessionId*/
     pAddBssParams->sessionId            = pMlmStartReq->sessionId; 
@@ -1569,7 +1596,7 @@
     pAddBssParams->ssId.length = pMlmStartReq->ssId.length;
 #ifdef WLAN_SOFTAP_FEATURE
     pAddBssParams->bHiddenSSIDEn = pMlmStartReq->ssidHidden;
-    limLog( pMac, LOG1, FL( "TRYING TO HIDE SSID %d" ),pAddBssParams->bHiddenSSIDEn);
+    limLog( pMac, LOGE, FL( "TRYING TO HIDE SSID %d\n" ),pAddBssParams->bHiddenSSIDEn);
     // CR309183. Disable Proxy Probe Rsp.  Host handles Probe Requests.  Until FW fixed. 
     pAddBssParams->bProxyProbeRespEn = 0;
     pAddBssParams->obssProtEnabled = pMlmStartReq->obssProtEnabled;
@@ -1586,7 +1613,7 @@
 
     // Set a new state for MLME
     psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
     pAddBssParams->halPersona=psessionEntry->pePersona; //pass on the session persona to hal
 
@@ -1605,7 +1632,7 @@
     msgQ.reserved   = 0;
     msgQ.bodyptr    = pAddBssParams;
     msgQ.bodyval    = 0;
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     limLog( pMac, LOGW, FL( "Sending WDA_ADD_BSS_REQ...\n" ));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
@@ -1845,13 +1872,6 @@
     {
         PELOGE(limLog(pMac, LOGE,
                FL("Sending START_SCAN from LIM while one req is pending\n"));)
-        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf);
-        /*Send back a failure*/        
-        mlmScanCnf.resultCode = eSIR_SME_SCAN_FAILED;
-        mlmScanCnf.scanResultLength = 0;
-        limPostSmeMessage(pMac,
-                         LIM_MLM_SCAN_CNF,
-                    (tANI_U32 *) &mlmScanCnf);
         return;
     }
 
@@ -1871,7 +1891,7 @@
             pMac->lim.gLimMlmState = eLIM_MLM_WT_PROBE_RESP_STATE;
         else // eSIR_PASSIVE_SCAN
             pMac->lim.gLimMlmState = eLIM_MLM_PASSIVE_SCAN_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
         pMac->lim.gLimSystemInScanLearnMode = 1;
 
@@ -1925,7 +1945,7 @@
 
         pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
 
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
         //Now request for link suspension
         limSuspendLink(pMac, eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN, limSetOemDataReqMode, NULL);
@@ -1988,7 +2008,7 @@
 static void
 limProcessMlmPostJoinSuspendLink(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *ctx)
 {
-    tANI_U8             chanNum, secChanOffset;
+    tANI_U8             chanNum;
     tLimMlmJoinCnf      mlmJoinCnf;
     tpPESession         psessionEntry = (tpPESession)ctx;
     tSirLinkState       linkState;
@@ -2000,7 +2020,7 @@
     }
     psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
     psessionEntry->limMlmState = eLIM_MLM_WT_JOIN_BEACON_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
     limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
 
@@ -2016,8 +2036,7 @@
     {
         limLog(pMac, LOGE, FL("limSetLinkState to eSIR_LINK_PREASSOC_STATE Failed!!\n"));
         mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
-        psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
         goto error;
     }
 
@@ -2025,11 +2044,11 @@
     // chanNum = pMac->lim.gpLimMlmJoinReq->bssDescription.channelId;
     
     chanNum = psessionEntry->currentOperChannel;
-    secChanOffset = psessionEntry->htSecondaryChannelOffset;
     //store the channel switch sessionEntry in the lim global var
     psessionEntry->channelChangeReasonCode = LIM_SWITCH_CHANNEL_JOIN;
 
-    limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId); 
+    limSetChannel(pMac, psessionEntry->pLimMlmJoinReq->bssDescription.titanHtCaps,
+                        chanNum, psessionEntry->maxTxPower, psessionEntry->peSessionId); 
 
     return;
 error:
@@ -2135,7 +2154,7 @@
         limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
         
         limLog(pMac, LOGE, FL("Unexpected Join request for role %d state %X\n"),
-               psessionEntry->limSystemRole, psessionEntry->limMlmState);
+               psessionEntry->limSystemRole, pMac->lim.gLimMlmState);
     }
 
 error: 
@@ -2303,7 +2322,7 @@
 
         psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
         psessionEntry->limMlmState = eLIM_MLM_WT_AUTH_FRAME2_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
         /// Prepare & send Authentication frame
         authFrameBody.authAlgoNumber =
@@ -2319,7 +2338,7 @@
         pMac->lim.limTimers.gLimAuthFailureTimer.sessionId = sessionId;
  
         // Activate Auth failure timer
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_AUTH_FAIL_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_AUTH_FAIL_TIMER));
         if (tx_timer_activate(&pMac->lim.limTimers.gLimAuthFailureTimer)
                                        != TX_SUCCESS)
         {
@@ -2398,7 +2417,6 @@
     if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmAssocReq->sessionId) )== NULL) 
     {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
-        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmAssocReq);
         return;
     }
 
@@ -2422,7 +2440,7 @@
 
         psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
         psessionEntry->limMlmState = eLIM_MLM_WT_ASSOC_RSP_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
  
         /// Prepare and send Association request frame
         limSendAssocReqMgmtFrame(pMac, pMlmAssocReq,psessionEntry);
@@ -2440,7 +2458,7 @@
             PELOGE(limLog(pMac, LOGE,  FL("Failed to set the LinkState\n"));)
     }
         /// Start association failure timer
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ASSOC_FAIL_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_ASSOC_FAIL_TIMER));
         if (tx_timer_activate(&pMac->lim.limTimers.gLimAssocFailureTimer)
                                               != TX_SUCCESS)
         {
@@ -2511,7 +2529,7 @@
 static void
 limProcessMlmReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
-    tANI_U8                       chanNum, secChannelOffset;
+    tANI_U8                       chanNum;
     struct tLimPreAuthNode  *pAuthNode;
     tLimMlmReassocReq       *pMlmReassocReq;
     tLimMlmReassocCnf       mlmReassocCnf;
@@ -2528,7 +2546,6 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pMlmReassocReq->sessionId)) == NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("Session Does not exist for given sessionId\n"));)
-        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
         return;
     }
     
@@ -2565,7 +2582,7 @@
 
         psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
         psessionEntry->limMlmState    = eLIM_MLM_WT_REASSOC_RSP_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
 #if 0
         // Update BSSID at CFG database
@@ -2587,7 +2604,7 @@
          */
 
         chanNum = psessionEntry->limReassocChannelId;
-        secChannelOffset = psessionEntry->reAssocHtSecondaryChannelOffset;
+
 
         /* To Support BT-AMP .. read channel number from psessionEntry*/
         //chanNum = psessionEntry->currentOperChannel;
@@ -2600,8 +2617,8 @@
         //psessionEntry->pLimReAssocReq = (void *)pMlmReassocReq;
         psessionEntry->channelChangeReasonCode = LIM_SWITCH_CHANNEL_REASSOC;
 
-        /** Switch channel to the new Operating channel for Reassoc*/
-        limSetChannel(pMac, chanNum, secChannelOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+        /** Switch channell to the new Operating channel for Reassoc*/
+        limSetChannel(pMac, psessionEntry->limReassocTitanHtCaps, chanNum, psessionEntry->maxTxPower, psessionEntry->peSessionId);
 
         return;
     }
@@ -2751,7 +2768,7 @@
     pStaDs->mlmStaContext.cleanupTrigger = pMlmDisassocReq->disassocTrigger;
 
     /// Send Disassociate frame to peer entity
-    if (sendDisassocFrame && (pMlmDisassocReq->reasonCode != eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON))
+    if (sendDisassocFrame)
     {
     limSendDisassocMgmtFrame(pMac,
                              pMlmDisassocReq->reasonCode,
@@ -2762,6 +2779,13 @@
        sendDisassocFrame = 1;    
     }
 
+    if (psessionEntry->limSystemRole == eLIM_AP_ROLE) 
+    {
+       //SAP mode delay DEL STA for 300ms such that disassoc can be delivered at TIM
+       //100 ms for normal TIM and 300 ms for dynamic TIM
+       vos_sleep(300); 
+    }
+
     /// Receive path cleanup with dummy packet
     if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs,psessionEntry))
         {
@@ -2775,36 +2799,12 @@
 #ifdef FEATURE_WLAN_CCX
           (psessionEntry->isCCXconnection ) || 
 #endif
-#ifdef FEATURE_WLAN_LFR
-          (psessionEntry->isFastRoamIniFeatureEnabled ) ||
-#endif
           (psessionEntry->is11Rconnection )) &&
           (pMlmDisassocReq->reasonCode != eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON))
     {
-          PELOGE(limLog(pMac, LOGE, FL("FT Preauth Session (%p,%d) Cleanup\n"),
-                 psessionEntry, psessionEntry->peSessionId);)
+          PELOGE(limLog(pMac, LOGE, FL("FT Preauth Session Cleanup \n"));)
           limFTCleanup(pMac);
     }
-    else 
-    {
-          PELOGE(limLog(pMac, LOGE, FL("No FT Preauth Session Cleanup in role %d"
-#ifdef FEATURE_WLAN_CCX
-                 " isCCX %d"
-#endif
-#ifdef FEATURE_WLAN_LFR
-                 " isLFR %d"
-#endif
-                 " is11r %d reason %d\n"),
-                 psessionEntry->limSystemRole, 
-#ifdef FEATURE_WLAN_CCX
-                 psessionEntry->isCCXconnection,
-#endif
-#ifdef FEATURE_WLAN_LFR
-                 psessionEntry->isFastRoamIniFeatureEnabled,
-#endif
-                 psessionEntry->is11Rconnection,
-                 pMlmDisassocReq->reasonCode);)
-    }
 #endif
 
     /// Free up buffer allocated for mlmDisassocReq
@@ -2875,8 +2875,7 @@
         return;
     }
 
-    if( (psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
-        isLimSessionOffChannel(pMac, pMlmDisassocReq->sessionId) )
+    if( isLimSessionOffChannel(pMac, pMlmDisassocReq->sessionId) )
     {
       //suspend link
       limSuspendLink(pMac, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN, 
@@ -2918,7 +2917,6 @@
     {
     
         PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId\n"));)
-        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDeauthReq);
         return;
     }
     #if 0
@@ -2981,7 +2979,7 @@
                         /// Prepare and Send LIM_MLM_DEAUTH_CNF
                         mlmDeauthCnf.resultCode = eSIR_SME_SUCCESS;
                         psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+                        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
                         goto end;
                     }
                     else
@@ -3011,7 +3009,6 @@
             break;
 
         case eLIM_STA_IN_IBSS_ROLE:
-            palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDeauthReq);
 
             return;
 
@@ -3090,6 +3087,14 @@
     limSendDeauthMgmtFrame(pMac, pMlmDeauthReq->reasonCode,
                            pMlmDeauthReq->peerMacAddr,psessionEntry);
 
+    if( (psessionEntry->limSystemRole == eLIM_AP_ROLE))
+    {
+      // Delay DEL STA for 300ms such that unicast deauth is 
+      // delivered at TIM(100 for normal or 300ms for dynamic) 
+      // to power save stations after setting PVB
+      vos_sleep(300);
+    }
+
     /// Receive path cleanup with dummy packet
     limCleanupRxPath(pMac, pStaDs,psessionEntry);
 
@@ -3160,8 +3165,7 @@
         return;
     }
 
-    if( (psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
-        isLimSessionOffChannel(pMac, pMlmDeauthReq->sessionId) )
+    if( isLimSessionOffChannel(pMac, pMlmDeauthReq->sessionId) )
     {
       //suspend link
       limSuspendLink(pMac, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN, 
@@ -3318,23 +3322,15 @@
   }
 
     if ((pMlmSetKeysReq->numKeys == 0) && (pMlmSetKeysReq->edType != eSIR_ED_NONE)) {
-        //
-        // Broadcast/Multicast Keys (for WEP!!) are NOT sent
-        // via this interface!!
-        //
-        // This indicates to HAL that the WEP Keys need to be
-        // extracted from the CFG and applied to hardware
-        defaultKeyId = 0xff;
-    }else if(pMlmSetKeysReq->key[0].keyId && 
-             ((pMlmSetKeysReq->edType == eSIR_ED_WEP40) || 
-              (pMlmSetKeysReq->edType == eSIR_ED_WEP104))){
-        /* If the Key Id is non zero and encryption mode is WEP, 
-         * the key index is coming from the upper layers so that key only 
-         * need to be used as the default tx key, This is being used only 
-         * in case of WEP mode in HAL */
-        defaultKeyId = pMlmSetKeysReq->key[0].keyId;
-    }else
-        defaultKeyId = 0;
+    //
+    // Broadcast/Multicast Keys (for WEP!!) are NOT sent
+    // via this interface!!
+    //
+    // This indicates to HAL that the WEP Keys need to be
+    // extracted from the CFG and applied to hardware
+    defaultKeyId = 0xff;
+      }else
+    defaultKeyId = 0;
 
     limLog( pMac, LOG1,
       FL( "Trying to set keys for STA Index [%d], using defaultKeyId [%d]\n" ),
@@ -3344,7 +3340,7 @@
     if(limIsAddrBC( pMlmSetKeysReq->peerMacAddr )) {
   psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
   psessionEntry->limMlmState = eLIM_MLM_WT_SET_BSS_KEY_STATE;
-  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
         limLog( pMac, LOG1, FL("Trying to set Group Keys...%d \n"), 
             psessionEntry->peSessionId);
 
@@ -3405,7 +3401,6 @@
     {
         PELOGE(limLog(pMac, LOGE,
                     FL("session does not exist for given sessionId\n"));)
-        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
         return;
     }
 
@@ -3458,7 +3453,7 @@
     if(limIsAddrBC( pMlmRemoveKeyReq->peerMacAddr )) //Second condition for IBSS or AP role.
     {
         psessionEntry->limMlmState = eLIM_MLM_WT_REMOVE_BSS_KEY_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));    
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));    
         // Package WDA_REMOVE_BSSKEY_REQ message parameters
         limSendRemoveBssKeyReq( pMac,pMlmRemoveKeyReq,psessionEntry);
         return;
@@ -3496,7 +3491,7 @@
 
 
     psessionEntry->limMlmState = eLIM_MLM_WT_REMOVE_STA_KEY_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
     // Package WDA_REMOVE_STAKEY_REQ message parameters
     limSendRemoveStaKeyReq( pMac,pMlmRemoveKeyReq,staIdx,psessionEntry);
@@ -3504,7 +3499,6 @@
  
 end:
     limPostSmeRemoveKeyCnf( pMac,
-      psessionEntry,
       pMlmRemoveKeyReq,
       &mlmRemoveKeyCnf );
 
@@ -3746,7 +3740,7 @@
          * in states other than wait_scan.
          * Log error.
          */
-        limLog(pMac, LOG1,
+        limLog(pMac, LOGW,
            FL("received unexpected Periodic scan timeout in state %X\n"),
            pMac->lim.gLimMlmState);
     }
@@ -3808,7 +3802,7 @@
         mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
 
         psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
         if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId, 
             psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
             PELOGE(limLog(pMac, LOGE,  FL("Failed to set the LinkState\n"));)
@@ -4066,8 +4060,13 @@
             PELOGE(limLog(pMac, LOGE,  FL("(Re)Assoc Failure Timeout occurred.\n"));)
 
             psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
-
+            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, psessionEntry->limMlmState));
+            
+            //Set the RXP mode to IDLE, so it starts filtering the frames.
+            if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId, 
+                psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+                PELOGE(limLog(pMac, LOGE,  FL("Failed to set the LinkState\n"));)
+         
             // 'Change' timer for future activations
             limDeactivateAndChangeTimer(pMac, eLIM_ASSOC_FAIL_TIMER);
 
@@ -4114,7 +4113,7 @@
              * Set BSSID to currently associated AP address.
              */
             psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
             limRestorePreReassocState(pMac, 
                 eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry);
@@ -4149,7 +4148,7 @@
 
     /// Restore previous MLM state
     pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
     limRestorePreScanState(pMac);
 
     // Free up pMac->lim.gLimMlmScanReq
@@ -4196,7 +4195,6 @@
   {
       PELOGE(limLog(pMac, LOGE,
                FL("session does not exist for given sessionId\n"));)
-      palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
       return;
   }
   
@@ -4247,7 +4245,7 @@
 
     // Restore MLME state
     psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
   }
 
@@ -4289,7 +4287,6 @@
     {
         PELOGE(limLog(pMac, LOGE,
                   FL("session does not exist for given session ID\n"));)
-        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
         return;
     }
   
@@ -4351,7 +4348,6 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDelBAReq->sessionId))== NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));)
-        palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
         return;
     }
 
@@ -4520,93 +4516,49 @@
 return eSIR_SUCCESS;
 }
 
-#ifdef WLAN_FEATURE_11AC
-ePhyChanBondState limGet11ACPhyCBState(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 htSecondaryChannelOffset )
-{
-    ePhyChanBondState cbState = PHY_SINGLE_CHANNEL_CENTERED;
-
-    if(!pMac->lim.apChanWidth)
-    {
-        return htSecondaryChannelOffset;
-    }
-
-    if ( (htSecondaryChannelOffset 
-                 == PHY_DOUBLE_CHANNEL_LOW_PRIMARY)
-       )
-    {
-        if ((channel + 2 ) == pMac->lim.apCenterChan )
-            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED;
-        else if ((channel + 6 ) == pMac->lim.apCenterChan )
-            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
-        else if ((channel - 2 ) == pMac->lim.apCenterChan )
-            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
-        else 
-            limLog (pMac, LOGP, 
-                       FL("Invalid Channel Number = %d Center Chan = %d \n"), 
-                                 channel, pMac->lim.apCenterChan);
-    }
-    if ( (htSecondaryChannelOffset 
-                 == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)
-       )
-    {
-        if ((channel - 2 ) == pMac->lim.apCenterChan )
-            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED;
-        else if ((channel + 2 ) == pMac->lim.apCenterChan )
-            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
-        else if ((channel - 6 ) == pMac->lim.apCenterChan )
-            cbState =  PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
-        else 
-           limLog (pMac, LOGP, 
-                         FL("Invalid Channel Number = %d Center Chan = %d \n"),
-                                            channel, pMac->lim.apCenterChan);
-    }
-    return cbState;
-}
-
-#endif
-
 void 
-limSetChannel(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 secChannelOffset, tPowerdBm maxTxPower, tANI_U8 peSessionId)
+limSetChannel(tpAniSirGlobal pMac, tANI_U32 titanHtcap, tANI_U8 channel, tPowerdBm maxTxPower, tANI_U8 peSessionId)
 {
 #if !defined WLAN_FEATURE_VOWIFI
     tANI_U32 localPwrConstraint;
 #endif
-    tpPESession peSession;
 
-    peSession = peFindSessionBySessionId (pMac, peSessionId);
-
-    if ( NULL == peSession)
-    {
-       limLog (pMac, LOGP, FL("Invalid PE session = %d\n"), peSessionId);
-       return;
+    // Setup the CB State appropriately, prior to
+    // issuing a dphChannelChange(). This is done
+    // so that if CB is enabled, the CB Secondary
+    // Channel is setup correctly
+    
+     /* if local CB admin state is off or join req CB admin state is off, don't bother with CB channel setup */
+    PELOG1(limLog(pMac, LOG1, FL("Before : gCbState = 0x%x, gCbmode = %x\n"), pMac->lim.gCbState, pMac->lim.gCbMode);)
+    if(GET_CB_ADMIN_STATE(pMac->lim.gCbState) &&
+                    SME_GET_CB_ADMIN_STATE(titanHtcap)) {
+        PELOG1(limLog(pMac, LOG1, FL("station doing channel bonding\n"));)
+        setupCBState( pMac, (tAniCBSecondaryMode)SME_GET_CB_OPER_STATE(titanHtcap));
+    }else {
+        PELOG1(limLog(pMac, LOG1, FL("station not doing channel bonding\n"));)
+        setupCBState(pMac, eANI_CB_SECONDARY_NONE);
     }
+
+    PELOG1(limLog(pMac, LOG1, FL("After :gCbState = 0x%x, gCbmode = %x\n"), pMac->lim.gCbState, pMac->lim.gCbMode);)
+
+    #if 0
+    if (wlan_cfgSetInt(pMac, WNI_CFG_CURRENT_CHANNEL, channel) != eSIR_SUCCESS) {
+           limLog(pMac, LOGP, FL("could not set CURRENT_CHANNEL at CFG\n"));
+           return;
+    }
+    #endif // TO SUPPORT BT-AMP
+
 #if defined WLAN_FEATURE_VOWIFI  
-#ifdef WLAN_FEATURE_11AC
-    if ( peSession->vhtCapability )
-    {
-        limSendSwitchChnlParams( pMac, channel, limGet11ACPhyCBState( pMac,channel,secChannelOffset ), maxTxPower, peSessionId);
-    }
-    else
-#endif
-    {
-        limSendSwitchChnlParams( pMac, channel, secChannelOffset, maxTxPower, peSessionId);
-    }
+    limSendSwitchChnlParams( pMac, channel, limGetPhyCBState( pMac ), maxTxPower, peSessionId);
 #else
     if (wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
            limLog(pMac, LOGP, FL("could not read WNI_CFG_LOCAL_POWER_CONSTRAINT from CFG\n"));
            return;
     }
     // Send WDA_CHNL_SWITCH_IND to HAL
-#ifdef WLAN_FEATURE_11AC
-    if ( peSession->vhtCapability && pMac->lim.vhtCapabilityPresentInBeacon)
-    {
-        limSendSwitchChnlParams( pMac, channel, limGet11ACPhyCBState( pMac,channel,secChannelOffset ), maxTxPower, peSessionId);
-    }
-    else
+    limSendSwitchChnlParams( pMac, channel, limGetPhyCBState( pMac ), (tPowerdBm)localPwrConstraint, peSessionId);
 #endif
-    {
-        limSendSwitchChnlParams( pMac, channel, secChannelOffset, (tPowerdBm)localPwrConstraint, peSessionId);
-    }
-#endif
-
+   
  }
+
+
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
index 892e7a4..d8c22a6 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmRspMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -50,17 +50,14 @@
 #include "limSendMessages.h"
 #include "limIbssPeerMgmt.h"
 #include "limSession.h"
-#include "limSessionUtils.h"
 #if defined WLAN_FEATURE_VOWIFI
 #include "rrmApi.h"
 #endif
 #if defined WLAN_FEATURE_VOWIFI_11R
 #include <limFT.h>
 #endif
-#include "wlan_qct_wda.h"
 
 static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
-static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession);
 void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *);
 #ifdef FEATURE_OEM_DATA_SUPPORT
 void limProcessMlmOemDataReqCnf(tpAniSirGlobal, tANI_U32 *);
@@ -212,7 +209,7 @@
         //case eLIM_SME_LINK_EST_WT_SCAN_STATE:  //TO SUPPORT BT-AMP
         //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:   //TO SUPPORT BT-AMP
             pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
             pMac->lim.gLimSystemInScanLearnMode = 0;
             break;
         default:
@@ -381,7 +378,7 @@
          * Beacon file register.
          */
         psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
         if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
         {
              limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***\n"));
@@ -463,8 +460,9 @@
     /// Process Join confirm from MLM
     if (resultCode ==  eSIR_SME_SUCCESS)
     {
-            PELOG1(limLog(pMac, LOG1, FL("*** Joined ESS ***"));)
+            PELOG1(limLog(pMac, LOG1, FL("*** Joined ESS ***\n"));)
             //Setup hardware upfront
+           PELOGE(limLog(pMac, LOGE, FL("*** Starting to add BSS***\n"));)  //remove me
            //Done: 7-27-2009. JIM_FIX_ME   sessionize the following function
             if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
                 return;
@@ -474,7 +472,7 @@
     {
         /// Join failure
         psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
         /// Send Join response to Host
         limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
     }
@@ -609,10 +607,12 @@
             {
                 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred.\n"));)
                 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
                 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
-
+                MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+                if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
+                    psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
+                   PELOGE(limLog(pMac, LOGE,  FL("Failed to set the LinkState.\n"));)
 #if defined(ANI_AP_CLIENT_SDK)
                 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
                 {
@@ -639,7 +639,7 @@
                  * Send Pre-auth failure response to host
                  */
                 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
-                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
                 limSendSmeAuthRsp(
                             pMac,
                             ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
@@ -706,10 +706,9 @@
 
             pMlmAssocReq->capabilityInfo = caps;
            PELOG3(limLog(pMac, LOG3,
-               FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x\n"),
+               FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x\n"),
                caps,
-               ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
-               ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
+               ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy);)
 
            /* If telescopic beaconing is enabled, set listen interval to
               WNI_CFG_TELE_BCN_MAX_LI */
@@ -748,7 +747,7 @@
             pMlmAssocReq->sessionId = psessionEntry->peSessionId;
             psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
             psessionEntry->limSmeState     = eLIM_SME_WT_ASSOC_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
             limPostMlmMessage(pMac,
                               LIM_MLM_ASSOC_REQ,
                               (tANI_U32 *) pMlmAssocReq);
@@ -760,7 +759,7 @@
              * Send Pre-auth response to host
              */
             psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
             limSendSmeAuthRsp(
                         pMac,
                         ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
@@ -824,7 +823,7 @@
         // Association failure
         PELOG1(limLog(pMac, LOG1, FL("*** Association failure ***\n"));)
         psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 #if defined(ANI_AP_CLIENT_SDK)
         if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
         {
@@ -849,7 +848,7 @@
         // Successful Association
         PELOG1(limLog(pMac, LOG1, FL("*** Associated with BSS ***\n"));)
         psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
         /**
          * Need to send Join response with
          * Association success to Host.
@@ -919,7 +918,7 @@
         PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***\n"));)
 
         psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
         /**
         * Need to send Reassoc response with
@@ -934,7 +933,7 @@
         *   but we still have the link with the Older AP
         */
         psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
         /**
         * Need to send Reassoc response with
@@ -946,12 +945,15 @@
     }else {
         // Reassociation failure
         psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
         /**
          * Need to send Reassoc response with
          * Association failure to Host.
          */
-        limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
+        limSendSmeJoinReassocRsp(
+                           pMac, eWNI_SME_REASSOC_RSP,
+                           pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
+                           psessionEntry->smeSessionId,psessionEntry->transactionId);
     }
 } /*** end limProcessMlmReassocCnf() ***/
 
@@ -1025,7 +1027,7 @@
     msgQ.type = eWNI_SME_REASSOC_IND;
     msgQ.bodyptr = pSirSmeReassocInd;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
     limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1089,7 +1091,7 @@
     msgQ.type = eWNI_SME_AUTH_IND;
     msgQ.bodyptr = pSirSmeAuthInd;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
     limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1138,6 +1140,7 @@
                                 pAssocInd->addIE.length);
 
     // Copy the new TITAN capabilities
+    pSirSmeAssocInd->titanHtCaps = pAssocInd->titanHtCaps;
     pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
     if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
     {
@@ -1237,7 +1240,7 @@
 #ifdef WLAN_SOFTAP_FEATURE
    pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
 #endif
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
     limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1313,7 +1316,7 @@
         case eLIM_STA_ROLE:
         case eLIM_BT_AMP_STA_ROLE:
         psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
             break;
         default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
                 PELOG1(limLog(pMac, LOG1,
@@ -1399,7 +1402,7 @@
                 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
             else
                 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
             // Send Promiscuous mode response to host
             limSendSmePromiscuousModeRsp(pMac);
         }
@@ -1409,7 +1412,7 @@
                 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
             else
                 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
             limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
                                   resultCode,
                                   pMlmDisassocCnf->disassocTrigger,
@@ -1462,7 +1465,7 @@
         case eLIM_STA_ROLE:
         case eLIM_BT_AMP_STA_ROLE:
             psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
 
         default: // eLIM_AP_ROLE
             {
@@ -1558,7 +1561,7 @@
         }
         else
             psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
         if (pMac->lim.gLimRspReqd)
             pMac->lim.gLimRspReqd = false;
@@ -1648,7 +1651,7 @@
             if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
             {
                 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
-                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+                MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
 #if defined(ANI_AP_CLIENT_SDK)
                 // Whenever there is a disassoc notification, make sure the bssId is cleared so that
@@ -1711,13 +1714,13 @@
 limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
     // Prepare and send SME_SETCONTEXT_RSP message
-    tLimMlmSetKeysCnf   *pMlmSetKeysCnf;
+    tLimMlmSetKeysCnf  *pMlmSetKeysCnf;
     tpPESession        psessionEntry;
 
     if(pMsgBuf == NULL)
     {
-        PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
-        return;
+           PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+           return;
     }
     pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
     if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
@@ -1760,13 +1763,13 @@
 limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
     // Prepare and send SME_REMOVECONTEXT_RSP message
-    tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
+    tLimMlmRemoveKeyCnf  *pMlmRemoveKeyCnf;
     tpPESession          psessionEntry;
 
     if(pMsgBuf == NULL)
     {
-        PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
-        return;
+           PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
+           return;
     }
     pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
     if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
@@ -1778,7 +1781,7 @@
         FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d\n"),
         pMlmRemoveKeyCnf->resultCode );
     limSendSmeRemoveKeyRsp(pMac,
-                           pMlmRemoveKeyCnf->peerMacAddr,
+                            pMlmRemoveKeyCnf->peerMacAddr,
                             (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
                             psessionEntry->smeSessionId,psessionEntry->transactionId);
 } /*** end limProcessMlmRemoveKeyCnf() ***/
@@ -1832,8 +1835,6 @@
             pStaDs->mlmStaContext.protStatusCode = protStatusCode;
             //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
             limCleanupRxPath(pMac, pStaDs, psessionEntry);
-            palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
-            psessionEntry->pLimJoinReq = NULL;
             return;
         }
     }
@@ -1857,68 +1858,6 @@
 } /*** end limHandleSmeJoinResult() ***/
 
 /**
- * limHandleSmeReaasocResult()
- *
- *FUNCTION:
- * This function is called to process reassoc failures
- * upon receiving REASSOC_CNF with a failure code or
- * MLM_REASSOC_CNF with a success code in case of STA role 
- *
- *LOGIC:
- *
- *ASSUMPTIONS:
- *
- *NOTE:
- *
- * @param  pMac         Pointer to Global MAC structure
- * @param  resultCode   Failure code to be sent
- *
- *
- * @return None
- */
-static void
-limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
-{
-    tpDphHashNode pStaDs = NULL;
-    tANI_U8         smesessionId;
-    tANI_U16        smetransactionId;
-
-    if(psessionEntry == NULL)
-    {
-        PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL \n"));)
-        return;
-    }
-    smesessionId = psessionEntry->smeSessionId;
-    smetransactionId = psessionEntry->transactionId;
-    /* When associations is failed , delete the session created  and pass NULL  to  limsendsmeJoinReassocRsp() */
-    if(resultCode != eSIR_SME_SUCCESS)
-    {
-          pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
-          if (pStaDs != NULL)
-          {
-            pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
-            pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
-            pStaDs->mlmStaContext.resultCode = resultCode;
-            pStaDs->mlmStaContext.protStatusCode = protStatusCode;
-            limCleanupRxPath(pMac, pStaDs, psessionEntry);
-            return;
-        }
-    }
-
-    //Delete teh session if REASSOC failure occurred.
-    if(resultCode != eSIR_SME_SUCCESS)
-    {
-        if(NULL != psessionEntry)
-        {
-            peDeleteSession(pMac,psessionEntry);
-            psessionEntry = NULL;
-        }
-    }
-    limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
-                                                smesessionId,  smetransactionId);
-} /*** end limHandleSmeReassocResult() ***/
-
-/**
   * limProcessMlmAddStaRsp()
  *
  *FUNCTION:
@@ -1942,6 +1881,13 @@
     //in the case of nested request the new request initiated from the response will take care of resetting
     //the deffered flag.
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+#ifdef ANI_PRODUCT_TYPE_AP
+    if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+    {
+        limProcessApMlmAddStaRsp(pMac, limMsgQ);
+        return;
+    }
+#endif
     if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
 #ifdef WLAN_SOFTAP_FEATURE
     || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
@@ -1992,7 +1938,7 @@
             FL( "Unable to get the DPH Hash Entry for AID - %d\n" ),
             DPH_STA_HASH_INDEX_PEER);
         psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
         /*
         * Storing the self StaIndex(Generated by HAL) in session context,
         * instead of storing it in DPH Hash entry for Self STA.
@@ -2002,7 +1948,7 @@
         psessionEntry->staId = pAddStaParams->staIdx;
         //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
         limReactivateHeartBeatTimer(pMac, psessionEntry);
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_KEEPALIVE_TIMER));
 
         //assign the sessionId to the timer Object
         pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
@@ -2045,6 +1991,13 @@
    //     return;
   //  }
   SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+ #ifdef ANI_PRODUCT_TYPE_AP
+    if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+    {
+        limProcessApMlmDelBssRsp(pMac, limMsgQ);
+        return;
+    }
+#endif
 
     if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)  ||
          (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
@@ -2098,10 +2051,6 @@
     else
     {
         limLog( pMac, LOGP, FL( "DEL BSS failed!\n" ) );
-        if( NULL != pDelBssParams )
-        {
-            palFreeMemory( pMac->hHdd, (void *) pDelBssParams );
-    	}
         return;
     }
    end:
@@ -2127,6 +2076,58 @@
     return;
 }
 
+
+#ifdef ANI_PRODUCT_TYPE_AP
+void limProcessApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
+{
+    tSirResultCodes rc = eSIR_SME_SUCCESS;
+    tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
+    if (pDelBss == NULL)
+    {
+        PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!\n"));)
+        rc = eSIR_SME_REFUSED;
+        goto end;
+    }
+    if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pMac->lim.gLimMlmState)
+    {
+            limLog( pMac, LOGE,
+                        FL( "Received unexpected WDA_DEL_BSS_RSP in state %X\n" ), pMac->lim.gLimMlmState);
+            rc = eSIR_SME_REFUSED;
+           goto end;
+    }
+    if (pDelBss->status != eHAL_STATUS_SUCCESS)
+    {
+        limLog(pMac, LOGP, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
+               pDelBss->status, pDelBss->bssIdx);
+        rc = eSIR_SME_STOP_BSS_FAILURE;
+        goto end;
+    }
+    //Not used for station or softap.
+    rc = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE);
+    if( rc != eSIR_SUCCESS )
+        goto end;
+    /** Softmac may send all the buffered packets right after resuming the transmission hence
+     * to occupy the medium during non channel occupancy period. So resume the transmission after
+     * HAL gives back the response.
+     */
+    if (LIM_IS_RADAR_DETECTED(pMac))
+    {
+         limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
+         LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
+    }
+    dphHashTableClassInit(pMac);
+    limDeletePreAuthList(pMac);
+    //Is it ok to put LIM into IDLE state.
+    pMac->lim.gLimMlmState->limMlmState = eLIM_MLM_IDLE_STATE;
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
+    end:
+    limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc);
+    if(pDelBss != NULL)
+        palFreeMemory( pMac->hHdd, (void *) pDelBss );
+}
+#endif
+/* This code is same as limProcessApMlmDelBssRsp used for BT-AMP  */
 void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
 {
     tSirResultCodes rc = eSIR_SME_SUCCESS;
@@ -2137,8 +2138,6 @@
     if(psessionEntry == NULL)
     {
         limLog(pMac, LOGE,FL("Session entry passed is NULL\n"));
-        if(pDelBss != NULL)
-            palFreeMemory( pMac->hHdd, (void *) pDelBss );
         return;
     }
 
@@ -2151,11 +2150,11 @@
     pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
     if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
     {
-            limLog( pMac, LOGE,
+        limLog(pMac, LOGE,
                FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
                psessionEntry->limMlmState);
-            rc = eSIR_SME_REFUSED;
-           goto end;
+        rc = eSIR_SME_REFUSED;
+        goto end;
     }
     if (pDelBss->status != eHAL_STATUS_SUCCESS)
     {
@@ -2175,13 +2174,11 @@
      * to occupy the medium during non channel occupancy period. So resume the transmission after
      * HAL gives back the response.
      */
-#if 0 //TODO: How to handle this per session
     if (LIM_IS_RADAR_DETECTED(pMac))
     {
          limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
          LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
     }
-#endif
     dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
     limDeletePreAuthList(pMac);
 #ifdef WLAN_SOFTAP_FEATURE
@@ -2209,11 +2206,16 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteStaParams->sessionId))==NULL)
     {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
-        if(pDeleteStaParams != NULL)
-            palFreeMemory( pMac->hHdd, (void *) pDeleteStaParams );
         return;
     }
 
+#ifdef ANI_PRODUCT_TYPE_AP
+    if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
+    {
+        limProcessApMlmDelStaRsp(pMac, limMsgQ);
+        return;
+    }
+#endif
     if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
 #ifdef WLAN_SOFTAP_FEATURE
       || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
@@ -2228,6 +2230,89 @@
 #endif
 }
 
+#ifdef ANI_PRODUCT_TYPE_AP
+void limProcessApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
+{
+    tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
+    tpDphHashNode pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId);
+    tSirResultCodes statusCode = eSIR_SME_SUCCESS;
+    if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
+    {
+           limLog( pMac, LOGW,
+                      FL( "AP received the DEL_STA_RSP for assocID: %X.\n"), pDelStaParams->assocId);
+        if(pStaDs == NULL)
+        {
+             limLog( pMac, LOGE,
+                  FL( "DPH Entry for STA %X missing.\n"), pDelStaParams->assocId);
+             statusCode = eSIR_SME_REFUSED;
+             goto end;
+        }
+         if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
+            ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
+        {
+            limLog( pMac, LOGE,
+              FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d \n" ),
+               limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
+            statusCode = eSIR_SME_REFUSED;
+           goto end;
+        }
+
+        PELOG1(limLog( pMac, LOG1,
+            FL("Deleted STA AssocID %d staId %d MAC "),
+            pStaDs->assocId, pStaDs->staIndex);
+        limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+       if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
+       {
+            if( 0 != limMsgQ->bodyptr )
+            {
+              palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
+            }
+            if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
+            {
+                PELOGE(limLog(pMac, LOGE,
+                       FL("could not Add STA with assocId=%d\n"),
+                       pStaDs->assocId);)
+              // delete the TS if it has already been added.
+               // send the response with error status.
+                if(pStaDs->qos.addtsPresent)
+                {
+                  tpLimTspecInfo pTspecInfo;
+                  if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
+                            &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
+                  {
+                    limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
+                                                            NULL, &pTspecInfo->idx);
+                  }
+                }
+                limRejectAssociation(pMac,
+                         pStaDs->staAddr,
+                         pStaDs->mlmStaContext.subType,
+                         true, pStaDs->mlmStaContext.authType,
+                         pStaDs->assocId, true,
+                         (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS);
+            }
+            return;
+        }
+   }
+    else
+    {
+        limLog( pMac, LOGW,
+             FL( "DEL STA failed!\n" ));
+        statusCode = eSIR_SME_REFUSED;
+    }
+    end:
+    if( 0 != limMsgQ->bodyptr )
+    {
+      palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
+    }
+    if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
+    {
+       limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
+    }
+      return;
+}
+#endif
+/* This is the copy of  limProcessApMlmDelStaRsp used for BT-AMP Support  */
 void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
 {
     tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
@@ -2366,6 +2451,95 @@
     return;
 }
 
+#ifdef ANI_PRODUCT_TYPE_AP
+void limProcessApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
+{
+    tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
+    tpDphHashNode pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId);
+    if(pStaDs == NULL)
+    {
+        //TODO: any response to be sent out here ?
+        limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing.\n"), pAddStaParams->assocId);
+        goto end;
+    }
+    //
+    // TODO & FIXME_GEN4
+    // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
+    //
+    //TODO: any check for pMac->lim.gLimMlmState ?
+    if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
+    {
+        //TODO: any response to be sent out here ?
+        limLog( pMac, LOGE,
+                FL( "Received unexpected WDA_ADD_STA_RSP in state %X\n" ),
+                pStaDs->mlmStaContext.mlmState);
+        goto end;
+    }
+    if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
+    {
+        PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d\n"),pAddStaParams->status);)
+        limRejectAssociation(pMac, pStaDs->staAddr,
+                 pStaDs->mlmStaContext.subType,
+                 true, pStaDs->mlmStaContext.authType,
+                 pStaDs->assocId, true,
+                 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS);
+        goto end;
+    }
+    pStaDs->bssId = pAddStaParams->bssIdx;
+    pStaDs->staIndex = pAddStaParams->staIdx;
+    pStaDs->ucUcastSig    = pAddStaParams->ucUcastSig;
+    pStaDs->ucBcastSig    = pAddStaParams->ucBcastSig;
+    if(pStaDs->qos.addtsPresent)
+    {
+        //need to send halMsg_AddTs to HAL.
+        tpLimTspecInfo pTspecInfo;
+        if(eSIR_SUCCESS ==
+           limTspecFindByAssocId(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec,
+                                 &pMac->lim.tspecInfo[0], &pTspecInfo))
+        {
+            if(eSIR_SUCCESS != limSendHalMsgAddTs(pMac, pStaDs->staIndex, pTspecInfo->idx, pStaDs->qos.addts.tspec))
+            {
+                // delete the TS that has already been added.
+                // send the response with error status.
+                limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo, NULL, &pTspecInfo->idx);
+                PELOGE(limLog(pMac, LOGE,
+                 FL("limSendHalMsgAddTs failed for STA with assocId=%d\n"),
+                 pStaDs->assocId);)
+                limRejectAssociation(pMac,
+                   pStaDs->staAddr, pStaDs->mlmStaContext.subType,
+                   true, pStaDs->mlmStaContext.authType,
+                   pStaDs->assocId, false,
+                   (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS);
+                if( 0 != limMsgQ->bodyptr )
+                {
+                    palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+                }
+                limDelSta(pMac, pStaDs, true,psessionEntry);
+                return;
+            }
+        }
+    }
+    //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
+    pStaDs->valid = 1;
+    pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
+    PELOG1(limLog( pMac, LOG1,
+            FL("STA AssocID %d staId %d MAC "),
+            pStaDs->assocId,
+            pStaDs->staIndex);
+    limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
+    // Send Re/Association Response with
+    // status code to requesting STA.
+    limSendAssocRspMgmtFrame(pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
+                             pStaDs->mlmStaContext.subType, pStaDs,psessionEntry);
+end:
+    if( 0 != limMsgQ->bodyptr )
+    {
+        palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
+    }
+    return;
+}
+#endif
+/* This is the copy of  limProcessApMlmAddStaRsp function .... used for BT-AMP AP Support */
 void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
 {
     tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
@@ -2476,8 +2650,6 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
-        if( NULL != pAddBssParams )
-            palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
         return;
     }
     /* Update PE session Id*/
@@ -2490,7 +2662,7 @@
             goto end;
         // Set MLME state
         psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId,  psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
         if( eSIR_IBSS_MODE == pAddBssParams->bssType )
         {
             /** IBSS is 'active' when we receive
@@ -2501,7 +2673,7 @@
             psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
             limResetHBPktCount( psessionEntry );
             limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
-            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
+            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
             if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
                 limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
         }
@@ -2525,13 +2697,6 @@
         // Create timers used by LIM
         if (!pMac->lim.gLimTimersCreated)
             limCreateTimers(pMac);
-
-        // Start OLBC timer
-        if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
-        {
-            limLog(pMac, LOGE, FL("tx_timer_activate failed\n"));
-        }
-
         /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
         if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
             limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n"));
@@ -2600,7 +2765,7 @@
             goto end;
         // Set MLME state
         psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
         /** IBSS is 'active' when we receive
          * Beacon frames from other STAs that are part of same IBSS.
          * Mark internal state as inactive until then.
@@ -2609,7 +2774,7 @@
         limResetHBPktCount( psessionEntry );
         /* Timer related functions are not modified for BT-AMP : To be Done */
         limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
         if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
             limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
         psessionEntry->bssIdx     = (tANI_U8) pAddBssParams->bssIdx;
@@ -2727,14 +2892,14 @@
             // SUNIT_FIX_ME:  Set BOTH? Assume not. Please verify here and below.
             //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
             psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
+            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, eLIM_MLM_JOINED_STATE));
             pMlmAuthReq->sessionId = psessionEntry->peSessionId;
             psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
             psessionEntry->limSmeState     = eLIM_SME_WT_AUTH_STATE;
             // remember staId in case of assoc timeout/failure handling
             psessionEntry->staId = pAddBssParams->staContext.staIdx;
 
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
             limPostMlmMessage(pMac,
                               LIM_MLM_AUTH_REQ,
                               (tANI_U32 *) pMlmAuthReq);
@@ -2744,7 +2909,7 @@
 joinFailure:
     {
         psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, psessionEntry->limSmeState));
 
         /// Send Join response to Host
         limHandleSmeJoinResult(pMac,  eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
@@ -2800,7 +2965,7 @@
     // start reassoc timer.
     pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
     /// Start reassociation failure timer
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_REASSOC_FAIL_TIMER));
     if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
                                                != TX_SUCCESS)
     {
@@ -2876,22 +3041,18 @@
     pAddStaParams->updateSta = FALSE;
 
     pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
-#ifdef WLAN_FEATURE_11AC
-    limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
-#else
     limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
-#endif
 
-    if( psessionEntry->htCapability)
+    if( psessionEntry->htCapabality)
     {
-        pAddStaParams->htCapable = psessionEntry->htCapability;
+        pAddStaParams->htCapable = psessionEntry->htCapabality;
 #ifdef DISABLE_GF_FOR_INTEROP
         /*
          * To resolve the interop problem with Broadcom AP,
          * where TQ STA could not pass traffic with GF enabled,
          * TQ STA will do Greenfield only with TQ AP, for
          * everybody else it will be turned off.
-         */
+        */
         if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
         {
             limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
@@ -3014,7 +3175,7 @@
     }
     if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
     {
-#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX)
         if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
         {
 #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
@@ -3029,7 +3190,7 @@
 
          // Set MLME state
         psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
         psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session  started for self or for  peer oct6th
         // Now, send WDA_ADD_STA_REQ
         limLog( pMac, LOGW, FL( "On STA: ADD_BSS was successful\n" ));
@@ -3141,8 +3302,6 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
     {
         limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" ));
-            if( NULL != pAddBssParams )
-                palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
         return;
     }
     /* update PE session Id*/
@@ -3213,14 +3372,14 @@
  */
 void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
 {
-    tANI_U8           respReqd = 1;
+    tANI_U8 respReqd = 1;
     tLimMlmSetKeysCnf mlmSetKeysCnf;
     tANI_U8  sessionId = 0;
     tpPESession  psessionEntry;
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
     palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
    //BTAMP
-    if( NULL == limMsgQ->bodyptr )
+    if(NULL == limMsgQ->bodyptr)
     {
         PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));)
         return;
@@ -3229,13 +3388,12 @@
     if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
-        palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
         return;
     }
     if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
     {
         // Mesg received from HAL in Invalid state!
-        limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState );
+        limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, pMac->lim.gLimMlmState );
         // There's not much that MLME can do at this stage...
         respReqd = 0;
     }
@@ -3244,8 +3402,9 @@
 
     palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
     // Restore MLME state
+    //pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
     psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
     if( respReqd )
     {
         tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
@@ -3254,27 +3413,27 @@
         {
             palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
 #ifdef ANI_PRODUCT_TYPE_AP
-            mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
+      mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
 #endif
             // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
-            palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
+            palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
             pMac->lim.gpLimMlmSetKeysReq = NULL;
         }
         mlmSetKeysCnf.sessionId = sessionId;
-        limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
+        limPostSmeMessage( pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf );
     }
 }
 void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
 {
     tANI_U8 respReqd = 1;
     tLimMlmSetKeysCnf mlmSetKeysCnf;
-    tANI_U16          resultCode;
-    tANI_U8           sessionId = 0;
+    tANI_U16 resultCode;
+    tANI_U8  sessionId =0;
     tpPESession  psessionEntry;
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
     palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
    //BTAMP
-    if( NULL == limMsgQ->bodyptr )
+    if(NULL == limMsgQ->bodyptr)
     {
         PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null\n"));)
         return;
@@ -3283,7 +3442,6 @@
     if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
-        palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
         return;
     }
     if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
@@ -3291,10 +3449,10 @@
     else
         resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
 
-    //
-    // TODO & FIXME_GEN4
-    // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
-    //
+  //
+  // TODO & FIXME_GEN4
+  // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
+  //
   // Validate SME/LIM state - Read the above "ASSUMPTIONS"
   //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
   //{
@@ -3303,7 +3461,7 @@
         eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
     {
         // Mesg received from HAL in Invalid state!
-        limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState );
+        limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, pMac->lim.gLimMlmState );
         // There's not much that MLME can do at this stage...
         respReqd = 0;
     }
@@ -3312,9 +3470,10 @@
 
     palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
     // Restore MLME state
+    //pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
     psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
     if( respReqd )
     {
         tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
@@ -3325,13 +3484,13 @@
         {
             palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
 #ifdef ANI_PRODUCT_TYPE_AP
-            mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
+      mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
 #endif
             // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
-            palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
+            palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
             pMac->lim.gpLimMlmSetKeysReq = NULL;
         }
-        limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
+        limPostSmeMessage( pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf );
     }
 }
 /**
@@ -3352,77 +3511,54 @@
  */
 void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
 {
-    tANI_U8 respReqd = 1;
-    tLimMlmRemoveKeyCnf mlmRemoveCnf;
-    tANI_U16             resultCode;
-    tANI_U8              sessionId = 0;
-    tpPESession  psessionEntry;
-    SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
-    palZeroMemory( pMac->hHdd, (void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ));
-
-    if( NULL == limMsgQ->bodyptr )
+tLimMlmRemoveKeyCnf mlmRemoveCnf;
+tANI_U16 resultCode;
+tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
+  SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
+  palZeroMemory( pMac->hHdd,
+      (void *) &mlmRemoveCnf,
+      sizeof( tLimMlmRemoveKeyCnf ));
+  // Validate MLME state
+    if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != pMac->lim.gLimMlmState &&
+        eLIM_MLM_WT_REMOVE_STA_KEY_STATE != pMac->lim.gLimMlmState )
     {
-        PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));)
-        return;
-    }
-
-    if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
-        sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
-    else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
-        sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
-
-    if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
-    {
-        PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
-        return;
-    }
-
-    if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
-      resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
-    else
-      resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
-
-    // Validate MLME state
-    if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
-        eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
-    {
-        // Mesg received from HAL in Invalid state!
-        limLog(pMac, LOGW,
-            FL("Received unexpected [Mesg Id - %d] in state %X\n"),
+      // Mesg received from HAL in Invalid state!
+      limLog( pMac, LOGW,
+          FL( "Received unexpected [Mesg Id - %d] in state %X\n" ),
           limMsgQ->type,
-          psessionEntry->limMlmState );
-          respReqd = 0;
+          pMac->lim.gLimMlmState );
+          return; //ignore the response.
     }
-    else
-        mlmRemoveCnf.resultCode = resultCode;
 
-    //
-    // TODO & FIXME_GEN4
-    // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
-    //
+  if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == pMac->lim.gLimMlmState )
+    resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
+  else
+    resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
+  //
+  // TODO & FIXME_GEN4
+  // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
+  //
 
+  if( 0 != limMsgQ->bodyptr )
     palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
-
-    // Restore MLME state
-    psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
-
-    if( respReqd )
-    {
-        tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
-        mlmRemoveCnf.sessionId = sessionId;
-
+  // Restore MLME state
+  pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
+  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
     // Prepare and Send LIM_MLM_REMOVEKEY_CNF
-        if( NULL != lpLimMlmRemoveKeyReq )
+    if( NULL != lpLimMlmRemoveKeyReq )
     {
-            palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmRemoveCnf.peerMacAddr, (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
-                      sizeof( tSirMacAddr ));
-        // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
-        palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmRemoveKeyReq);
-        pMac->lim.gpLimMlmRemoveKeyReq = NULL;
-    }
-        limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
-    }
+      palCopyMemory( pMac->hHdd,
+          (tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
+          (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
+          sizeof( tSirMacAddr ));
+      mlmRemoveCnf.resultCode = resultCode;
+      // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
+      palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmRemoveKeyReq);
+      pMac->lim.gpLimMlmRemoveKeyReq = NULL;
+     }
+     limPostSmeMessage( pMac,
+        LIM_MLM_REMOVEKEY_CNF,
+        (tANI_U32 *) &mlmRemoveCnf );
 }
 
 #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
@@ -3653,7 +3789,7 @@
         goto end;
     }
     /// Start reassociation failure timer
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_REASSOC_FAIL_TIMER));
     if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
                                                != TX_SUCCESS)
     {
@@ -3771,12 +3907,12 @@
            psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
 
     // Sending mgmt frame is a blocking call activate Join failure timer now
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_JOIN_FAIL_TIMER));
     if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
     {
         limLog(pMac, LOGP, FL("could not activate Join failure timer\n"));
         psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-         MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
+         MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
         //memory is freed up below.
         psessionEntry->pLimMlmJoinReq = NULL;
         goto error;
@@ -3990,29 +4126,7 @@
             }
             else
             {
-               //Skip Dfs Channel in case of P2P Search
-               //If skipDfsChnlInP2pSearch is set in ini
-               if( ( pMac->lim.gpLimMlmScanReq != NULL ) &&
-                   pMac->lim.gpLimMlmScanReq->p2pSearch &&
-                   pMac->lim.gpLimMlmScanReq->skipDfsChnlInP2pSearch )
-               {
-                  int flag = 0;
-                  while(!flag)
-                  {
-                     pMac->lim.gLimCurrentScanChannelId++;
-                     if( (pMac->lim.gLimCurrentScanChannelId >
-                   (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))||
-                        (limActiveScanAllowed(pMac, limGetCurrentScanChannel(pMac))))
-                     {
-                       flag=1; //Bail out from here
-                     }
-                  }
-               }
-               else
-               {
-                  pMac->lim.gLimCurrentScanChannelId++;
-               }
-
+               pMac->lim.gLimCurrentScanChannelId++;
                limContinueChannelScan(pMac);
             }
             break;
@@ -4050,69 +4164,10 @@
     }
     return;
 }
-/**
- *  limStopTxAndSwitch()
- *
- *FUNCTION:
- * Start channel switch on all sessions that is in channel switch state.
- *
- * @param pMac                   - pointer to global adapter context
- *
- * @return None
- *
- */
-static void
-limStopTxAndSwitch (tpAniSirGlobal pMac)
-{
-    tANI_U8 i;
-
-    for(i =0; i < pMac->lim.maxBssId; i++)
-    {
-        if(pMac->lim.gpSession[i].valid && 
-            pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
-        {
-            limStopTxAndSwitchChannel(pMac, i);
-        }
-    }
-    return; 
-}
-/**
- * limStartQuietOnSession()
- *
- *FUNCTION:
- * This function is called to start quiet timer after finish scan if there is  
- *      qeuieting on any session.
- *
- *LOGIC:
- *
- *ASSUMPTIONS:
- * NA
- *
- *NOTE:
- * NA
- *
- * @param  pMac    - Pointer to Global MAC structure
- *
- * @return None
- */
-static void
-limStartQuietOnSession (tpAniSirGlobal pMac)
-{
-    tANI_U8 i;
-
-    for(i =0; i < pMac->lim.maxBssId; i++)
-    {
-        if(pMac->lim.gpSession[i].valid && 
-            pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
-        {
-            limStartQuietTimer(pMac, i);
-        }
-    }
-    return;
-}
 void limProcessFinishScanRsp(tpAniSirGlobal pMac,  void *body)
 {
     tpFinishScanParams      pFinishScanParam;
+    tANI_U8                 dummySessionId = 0;
     eHalStatus              status;
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
     pFinishScanParam = (tpFinishScanParams) body;
@@ -4123,21 +4178,21 @@
         case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
             pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
             limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
-            if (limIsChanSwitchRunning(pMac))
+            if (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
             {
                 /** Right time to stop tx and start the timer for channel switch */
                 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
                  * be any associated session id
                 */
-                limStopTxAndSwitch(pMac);
+                limStopTxAndSwitchChannel(pMac, dummySessionId);
             }
-            else if (limIsQuietBegin(pMac))
+            else if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
             {
                 /** Start the quieting */
                 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
                  * be any associated session id
                 */
-                limStartQuietOnSession(pMac);
+                limStartQuietTimer(pMac, dummySessionId);
             }
 #ifdef ANI_PRODUCT_TYPE_AP
             /* For handling the measurement request from WSM as scan request in LIM*/
@@ -4279,7 +4334,6 @@
   if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
   {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
-        palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
         return;
   }
   // First, extract the DPH entry
@@ -4298,7 +4352,7 @@
     PELOGE(limLog( pMac, LOGE,
         FL( "Received unexpected ADDBA CNF when STA BA state is %d\n" ),
         curBaState );)
-      palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
+    palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
     return;
   }
   // Restore STA BA state
@@ -4377,7 +4431,6 @@
     if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
    {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
-        palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
         return;
    }
     // First, extract the DPH entry
@@ -4386,7 +4439,6 @@
     {
         limLog( pMac, LOGE,
             FL( "STA context not found - ignoring DELBA CNF from HAL\n" ));
-        palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
         return;
     }
     if(NULL == pMlmDelBACnf)
@@ -4402,7 +4454,6 @@
         limLog( pMac, LOGE,
         FL( "Received unexpected DELBA CNF when STA BA state is %d\n" ),
         curBaState );
-        palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
         return;
     }
     // Restore STA BA state
@@ -4437,7 +4488,6 @@
     if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
     {
         PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
-        palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
         return;
     }
     // First, extract the DPH entry
@@ -4596,7 +4646,7 @@
     /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
     /** Set the MlmState to IDLE*/
     psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
    /* Update PE session Id*/
     mlmReassocCnf.sessionId = psessionEntry->peSessionId;
     switch (psessionEntry->limMlmState) {
@@ -4677,13 +4727,13 @@
             mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
             /** Set the SME State back to WT_Reassoc State*/
             psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
             limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
             if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
                 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
             {
                psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-               MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+               MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
             }
             limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
         }
@@ -4695,7 +4745,7 @@
             mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
             goto Error;
     }
-    return;
+return;
 Error:
     limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
 }
@@ -4774,8 +4824,7 @@
     tLimMlmReassocCnf           mlmReassocCnf;
     /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
     /** Set the MlmState to IDLE*/
-    psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+    pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
     switch (psessionEntry->limSmeState) {
 #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
         case eLIM_SME_WT_REASSOC_STATE : {
@@ -4783,16 +4832,7 @@
             tpDphHashNode   pStaDs;
             tSirRetStatus       retStatus = eSIR_SUCCESS;
 #ifdef ANI_PRODUCT_TYPE_CLIENT
-            tSchBeaconStruct *pBeaconStruct;
-            if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                        (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
-            {
-                limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limHandleAddBssInReAssocContext\n") );
-                mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
-                mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
-                goto Error;
-            }
-
+            tSchBeaconStruct beaconStruct;
 #endif
             // Get the AP entry from DPH hash table
             pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
@@ -4801,7 +4841,6 @@
                 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash\n"));)
                 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
                 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
-                palFreeMemory(pMac->hHdd, pBeaconStruct);
                 goto Error;
             }
             /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
@@ -4814,19 +4853,17 @@
             limExtractApCapabilities( pMac,
                   (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
                   limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
-                    pBeaconStruct );
+                    &beaconStruct );
             if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
-                limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
-
-            if(pBeaconStruct->erpPresent) 
-            {
-                if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
+                limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
+                if(beaconStruct.erpPresent) {
+                if (beaconStruct.erpIEInfo.barkerPreambleMode)
                     psessionEntry->beaconParams.fShortPreamble = 0;
                 else
                     psessionEntry->beaconParams.fShortPreamble = 1;
             }
 
-            if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
+            if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
                                                     &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry))  {
                 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
                 retStatus = eSIR_FAILURE;
@@ -4843,12 +4880,10 @@
                 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
                 palFreeMemory(pMac->hHdd, assocRsp);
                 pMac->lim.gLimAssocResponseData = NULL;
-                palFreeMemory(pMac->hHdd, pBeaconStruct);
                 goto Error;
             }
             palFreeMemory(pMac->hHdd, assocRsp);
             psessionEntry->limAssocResponseData = NULL;
-            palFreeMemory(pMac->hHdd, pBeaconStruct);
         }
         break;
         case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: {     /** Case wherein the DisAssoc / Deauth
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c
index d1c22e4..3e319d0 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessProbeReqFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -549,7 +549,7 @@
                         pSirSmeProbeReq->sessionId = psessionEntry->smeSessionId;
                         palCopyMemory( pMac->hHdd, pSirSmeProbeReq->peerMacAddr, pHdr->sa, sizeof(tSirMacAddr));
                         pSirSmeProbeReq->devicePasswdId = probeReq.probeReqWscIeInfo.DevicePasswordID.id;
-                        MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+                        MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
                        if (limSysProcessMmhMsgApi(pMac, &msgQ,  ePROT) != eSIR_SUCCESS){
                             PELOG3(limLog(pMac, LOG3, FL("couldnt send the probe req to wsm "));)
                         }
@@ -864,7 +864,7 @@
     palCopyMemory( pMac->hHdd, pSirSmeProbeReqInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
     palCopyMemory( pMac->hHdd, pSirSmeProbeReqInd->WPSPBCProbeReq.peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
 
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIELen = (tANI_U16)ProbeReqIELen;
     palCopyMemory( pMac->hHdd, pSirSmeProbeReqInd->WPSPBCProbeReq.probeReqIE, pProbeReqIE, ProbeReqIELen);
     
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c
index fdd976a..6df50de 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessProbeRspFrame.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -85,23 +85,16 @@
     tANI_U32                frameLen = 0;
     tSirMacAddr             currentBssId;
     tpSirMacMgmtHdr         pHdr;
-    tSirProbeRespBeacon    *pProbeRsp;
+    tSirProbeRespBeacon     probeRsp;
     tANI_U8 qosEnabled =    false;
     tANI_U8 wmeEnabled =    false;
 
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pProbeRsp, sizeof(tSirProbeRespBeacon)))
-    {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limProcessProbeRspFrame\n") );
-        return;
-    }
-
-    pProbeRsp->ssId.length              = 0;
-    pProbeRsp->wpa.length               = 0;
-    pProbeRsp->propIEinfo.apName.length = 0;
+    probeRsp.ssId.length              = 0;
+    probeRsp.wpa.length               = 0;
+    probeRsp.propIEinfo.apName.length = 0;
 #if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
-    pProbeRsp->propIEinfo.aniIndicator  = 0;
-    pProbeRsp->propIEinfo.wdsLength     = 0;
+    probeRsp.propIEinfo.aniIndicator  = 0;
+    probeRsp.propIEinfo.wdsLength     = 0;
 #endif
 
 
@@ -114,10 +107,7 @@
     limPrintMacAddr(pMac, pHdr->sa, LOG2);)
 
    if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS)
-   {
-       palFreeMemory(pMac->hHdd, pProbeRsp);    
-       return;
-   }
+        return;
 
 
     /**
@@ -150,19 +140,18 @@
         // Get pointer to Probe Response frame body
         pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
 
-        if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, pProbeRsp)
+        if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, &probeRsp)
                           ==eSIR_FAILURE)
         {
             PELOG1(limLog(pMac, LOG1,
                FL("PArse error ProbeResponse, length=%d\n"),
                frameLen);)
-            palFreeMemory(pMac->hHdd, pProbeRsp);
             return;
         }
                                                                             //To Support BT-AMP                    
         if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) ||    //mlm state check should be global - 18th oct
             (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE))
-            limCheckAndAddBssDescription(pMac, pProbeRsp, pRxPacketInfo, 
+            limCheckAndAddBssDescription(pMac, &probeRsp, pRxPacketInfo, 
                ((pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE) ? eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE), eANI_BOOLEAN_TRUE);
         else if (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE)           //mlm state check should be global - 18th oct
         {
@@ -172,11 +161,11 @@
              * uncommented. Also when we tested enabling this, there is a crash as soon as the station
              * comes up which needs to be fixed*/
             //if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE)
-              //  limCheckAndAddBssDescription(pMac, pProbeRsp, pRxPacketInfo, eANI_BOOLEAN_TRUE);
-            limCollectMeasurementData(pMac, pRxPacketInfo, pProbeRsp);
+              //  limCheckAndAddBssDescription(pMac, &probeRsp, pRxPacketInfo, eANI_BOOLEAN_TRUE);
+            limCollectMeasurementData(pMac, pRxPacketInfo, &probeRsp);
            PELOG3(limLog(pMac, LOG3,
                FL("Parsed WDS info in ProbeRsp frames: wdsLength=%d\n"),
-               pProbeRsp->propIEinfo.wdsLength);)
+               probeRsp.propIEinfo.wdsLength);)
 #endif
         }
         else if (psessionEntry->limMlmState ==
@@ -204,7 +193,7 @@
             }
 
             // STA in WT_JOIN_BEACON_STATE
-            limCheckAndAnnounceJoinSuccess(pMac, pProbeRsp, pHdr, psessionEntry);
+            limCheckAndAnnounceJoinSuccess(pMac, &probeRsp, pHdr,psessionEntry);
         }
         else if(psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
         {
@@ -227,43 +216,40 @@
             sirCopyMacAddr(currentBssId,psessionEntry->bssId);
 
             if ( !palEqualMemory( pMac->hHdd,currentBssId, pHdr->bssId, sizeof(tSirMacAddr)) )
-            {
-                palFreeMemory(pMac->hHdd, pProbeRsp);    
                 return;
-            }
 
             if (!LIM_IS_CONNECTION_ACTIVE(psessionEntry))
             {
                 limLog(pMac, LOGW,
                     FL("Received Probe Resp from AP. So it is alive!!\n"));
 
-                if (pProbeRsp->HTInfo.present)
-                    limReceivedHBHandler(pMac, (tANI_U8)pProbeRsp->HTInfo.primaryChannel, psessionEntry);
+                if (probeRsp.HTInfo.present)
+                    limReceivedHBHandler(pMac, (tANI_U8)probeRsp.HTInfo.primaryChannel, psessionEntry);
                 else
-                    limReceivedHBHandler(pMac, (tANI_U8)pProbeRsp->channelNumber, psessionEntry);
+                    limReceivedHBHandler(pMac, (tANI_U8)probeRsp.channelNumber, psessionEntry);
             }
 
 #if defined ANI_PRODUCT_TYPE_CLIENT || defined (ANI_AP_CLIENT_SDK)
             
             if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
             {
-                if (pProbeRsp->quietIEPresent)
+                if (probeRsp.quietIEPresent)
                 {
-                    limUpdateQuietIEFromBeacon(pMac, &(pProbeRsp->quietIE), psessionEntry);
+                    limUpdateQuietIEFromBeacon(pMac, &(probeRsp.quietIE), psessionEntry);
                 }
-                else if ((psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
-                     (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
+                else if ((pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
+                     (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
                 {
                     PELOG1(limLog(pMac, LOG1, FL("Received a probe rsp without Quiet IE\n"));)
                     limCancelDot11hQuiet(pMac, psessionEntry);
                 }
 
-                if (pProbeRsp->channelSwitchPresent ||
-                    pProbeRsp->propIEinfo.propChannelSwitchPresent)
+                if (probeRsp.channelSwitchPresent ||
+                    probeRsp.propIEinfo.propChannelSwitchPresent)
                 {
-                    limUpdateChannelSwitch(pMac, pProbeRsp, psessionEntry);
+                    limUpdateChannelSwitch(pMac, &probeRsp, psessionEntry);
                 }
-                else if (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+                else if (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
                 {
                     limCancelDot11hChannelSwitch(pMac, psessionEntry);
                 }
@@ -285,13 +271,13 @@
             limGetWmeMode(psessionEntry, &wmeEnabled);
            PELOG2(limLog(pMac, LOG2,
                     FL("wmeEdcaPresent: %d wmeEnabled: %d, edcaPresent: %d, qosEnabled: %d,  edcaParams.qosInfo.count: %d schObject.gLimEdcaParamSetCount: %d\n"),
-                          pProbeRsp->wmeEdcaPresent, wmeEnabled, pProbeRsp->edcaPresent, qosEnabled,
-                          pProbeRsp->edcaParams.qosInfo.count, psessionEntry->gLimEdcaParamSetCount);)
-            if (((pProbeRsp->wmeEdcaPresent && wmeEnabled) ||
-                (pProbeRsp->edcaPresent && qosEnabled)) &&
-                (pProbeRsp->edcaParams.qosInfo.count != psessionEntry->gLimEdcaParamSetCount))
+                          probeRsp.wmeEdcaPresent, wmeEnabled, probeRsp.edcaPresent, qosEnabled,
+                          probeRsp.edcaParams.qosInfo.count, psessionEntry->gLimEdcaParamSetCount);)
+            if (((probeRsp.wmeEdcaPresent && wmeEnabled) ||
+                (probeRsp.edcaPresent && qosEnabled)) &&
+                (probeRsp.edcaParams.qosInfo.count != psessionEntry->gLimEdcaParamSetCount))
             {
-                if (schBeaconEdcaProcess(pMac, &pProbeRsp->edcaParams, psessionEntry) != eSIR_SUCCESS)
+                if (schBeaconEdcaProcess(pMac, &probeRsp.edcaParams, psessionEntry) != eSIR_SUCCESS)
                     PELOGE(limLog(pMac, LOGE, FL("EDCA parameter processing error\n"));)
                 else if (pStaDs != NULL)
                 {
@@ -310,10 +296,9 @@
         }
         else if ((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) &&
                  (psessionEntry->limMlmState == eLIM_MLM_BSS_STARTED_STATE))
-                limHandleIBSScoalescing(pMac, pProbeRsp, pRxPacketInfo,psessionEntry);
+                limHandleIBSScoalescing(pMac, &probeRsp, pRxPacketInfo,psessionEntry);
     } // if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || ...
 
-    palFreeMemory(pMac->hHdd, pProbeRsp);
     // Ignore Probe Response frame in all other states
     return;
 } /*** end limProcessProbeRspFrame() ***/
@@ -325,21 +310,14 @@
     tANI_U8                 *pBody;
     tANI_U32                frameLen = 0;
     tpSirMacMgmtHdr         pHdr;
-    tSirProbeRespBeacon    *pProbeRsp;
+    tSirProbeRespBeacon     probeRsp;
 
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pProbeRsp, sizeof(tSirProbeRespBeacon)))
-    {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limProcessProbeRspFrameNoSession\n") );
-        return;
-    }
-
-    pProbeRsp->ssId.length              = 0;
-    pProbeRsp->wpa.length               = 0;
-    pProbeRsp->propIEinfo.apName.length = 0;
+    probeRsp.ssId.length              = 0;
+    probeRsp.wpa.length               = 0;
+    probeRsp.propIEinfo.apName.length = 0;
 #if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
-    pProbeRsp->propIEinfo.aniIndicator  = 0;
-    pProbeRsp->propIEinfo.wdsLength     = 0;
+    probeRsp.propIEinfo.aniIndicator  = 0;
+    probeRsp.propIEinfo.wdsLength     = 0;
 #endif
 
 
@@ -352,10 +330,7 @@
     limPrintMacAddr(pMac, pHdr->sa, LOG2);
 
     if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS)
-    {
-        palFreeMemory(pMac->hHdd, pProbeRsp);
         return;
-    }
 
     /*  Since there is no psessionEntry, PE cannot be in the following states:
      *   - eLIM_MLM_WT_JOIN_BEACON_STATE
@@ -375,16 +350,15 @@
         // Get pointer to Probe Response frame body
         pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
 
-        if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, pProbeRsp) == eSIR_FAILURE)
+        if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, &probeRsp) == eSIR_FAILURE)
         {
             limLog(pMac, LOG1, FL("Parse error ProbeResponse, length=%d\n"), frameLen);
-            palFreeMemory(pMac->hHdd, pProbeRsp);
             return;
         }
 
         if( (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) ||
              (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) )
-            limCheckAndAddBssDescription(pMac, pProbeRsp, pRxPacketInfo, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
+            limCheckAndAddBssDescription(pMac, &probeRsp, pRxPacketInfo, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
         else if (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE)
         {
 #if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
@@ -393,14 +367,13 @@
              * uncommented. Also when we tested enabling this, there is a crash as soon as the station
              * comes up which needs to be fixed*/
             //if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE)
-              //  limCheckAndAddBssDescription(pMac, pProbeRsp, pRxPacketInfo, eANI_BOOLEAN_TRUE);
-            limCollectMeasurementData(pMac, pRxPacketInfo, pProbeRsp);
+              //  limCheckAndAddBssDescription(pMac, &probeRsp, pRxPacketInfo, eANI_BOOLEAN_TRUE);
+            limCollectMeasurementData(pMac, pRxPacketInfo, &probeRsp);
             limLog(pMac, LOG3,
                FL("Parsed WDS info in ProbeRsp frames: wdsLength=%d\n"),
-               pProbeRsp->propIEinfo.wdsLength);
+               probeRsp.propIEinfo.wdsLength);
 #endif
         }
     } 
-    palFreeMemory(pMac->hHdd, pProbeRsp);
     return;
 } /*** end limProcessProbeRspFrameNew() ***/
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
index 6118a33..a70dc09 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -124,7 +124,7 @@
     if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
     {
         limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
-     MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
+     MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
         if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
             limLog(pMac, LOGP, FL("could not activate background scan timer\n"));
         pMac->lim.gLimBackgroundScanStarted   = true;
@@ -316,9 +316,7 @@
 {
     /** fRadarDetCurOperChan will be set only if we detect radar in current
      * operating channel and System Role == AP ROLE */
-    //TODO: Need to take care radar detection.
-    //if (LIM_IS_RADAR_DETECTED(pMac))
-    if( 0 )
+    if (LIM_IS_RADAR_DETECTED(pMac))
     {
         if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
         {
@@ -367,7 +365,7 @@
     {
         pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
         
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
         
         /// By default do not return after first scan match
         pMac->lim.gLimReturnAfterFirstMatch = 0;
@@ -435,7 +433,7 @@
     }
 #endif
     PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL\n"));)
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
 
     if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
     {
@@ -445,62 +443,7 @@
     return eANI_BOOLEAN_FALSE;
 }
 
-#ifdef WLAN_FEATURE_11AC
 
-tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
-{
-    if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
-    {
-        switch(secondaryChanOffset)
-        {
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
-                return primarychanNum;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
-               return primarychanNum + 2;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
-               return primarychanNum - 2;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
-               return primarychanNum + 6;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
-               return primarychanNum + 2;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
-               return primarychanNum - 2;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
-               return primarychanNum - 6;
-            default :
-               return eSIR_CFG_INVALID_ID;
-        }
-    }
-    else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
-    {
-        switch(secondaryChanOffset)
-        {
-            case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
-                return primarychanNum + 2;
-            case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
-                return primarychanNum - 2;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
-                return primarychanNum;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
-               return primarychanNum + 2;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
-               return primarychanNum - 2;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
-               return primarychanNum + 2;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
-               return primarychanNum - 2;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
-               return primarychanNum + 2;
-            case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
-               return primarychanNum - 2;
-            default :
-               return eSIR_CFG_INVALID_ID;
-        }
-    }
-    return primarychanNum;
-}
-
-#endif
 /**
  * __limHandleSmeStartBssRequest()
  *
@@ -530,6 +473,7 @@
     tpSirSmeStartBssReq     pSmeStartBssReq;                //Local variable for Start BSS Req.. Added For BT-AMP Support 
     tSirResultCodes         retCode = eSIR_SME_SUCCESS;
     tANI_U32                autoGenBssId = FALSE;           //Flag Used in case of IBSS to Auto generate BSSID.
+    tSirMacHTChannelWidth   txWidthSet;
     tANI_U8                 sessionId;
     tpPESession             psessionEntry = NULL;
     tANI_U8                 smesessionId;
@@ -626,7 +570,7 @@
 
         /*Store Persona */
         psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
-        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
+        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,FL("PE PERSONA=%d\n"),
             psessionEntry->pePersona);
 
         /*Update the phymode*/
@@ -637,12 +581,8 @@
         /* Store the dot 11 mode in to the session Table*/
 
         psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
-        psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
-#ifdef WLAN_FEATURE_11AC
-        psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
-        VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
-            FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
-#endif
+        psessionEntry->htCapabality = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
+
         palCopyMemory(pMac->hHdd, (void*)&psessionEntry->rateSet,
             (void*)&pSmeStartBssReq->operationalRateSet,
             sizeof(tSirMacRateSet));
@@ -727,73 +667,41 @@
         if (pSmeStartBssReq->channelId)
         {
             channelNumber = pSmeStartBssReq->channelId;
-            psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
-            psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
-            psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
-            VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
-                      FL("cbMode %u"), pSmeStartBssReq->cbMode);
-#ifdef WLAN_FEATURE_11AC
-            if(psessionEntry->vhtCapability)
-            {
-                tANI_U32 centerChan;
-                tANI_U32 chanWidth;
+            /*Update cbMode received from sme with LIM's updated cbMode*/
+            pSmeStartBssReq->cbMode = (tAniCBSecondaryMode)pMac->lim.gCbMode;
 
-                if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
-                          &chanWidth) != eSIR_SUCCESS)
-                {
-                    limLog(pMac, LOGP,
-                      FL("Unable to retrieve Channel Width from CFG\n"));
-                }
-
-                if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ || chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
-                {
-                    if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
-                                                                     != eSIR_SUCCESS)
-                    {
-                        limLog(pMac, LOGP, FL("could not set  WNI_CFG_CHANNEL_BONDING_MODE at CFG\n"));
-                        retCode = eSIR_LOGP_EXCEPTION;
-                         goto free;
-                    }
-                }
-                if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
-                {
-                    if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
-                                                                     != eSIR_SUCCESS)
-                    {
-                        limLog(pMac, LOGP, FL("could not set  WNI_CFG_CHANNEL_BONDING_MODE at CFG\n"));
-                        retCode = eSIR_LOGP_EXCEPTION;
-                         goto free;
-                    }
-
-                    centerChan = limGetCenterChannel(pMac,channelNumber,pSmeStartBssReq->cbMode,WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
-                    if(centerChan != eSIR_CFG_INVALID_ID)
-                    {
-                        limLog(pMac, LOGW, FL("***Center Channel for 80MHZ channel width = %ld\n"),centerChan);
-                        if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1, centerChan)
-                                                                     != eSIR_SUCCESS)
-                        {
-                            limLog(pMac, LOGP, FL("could not set  WNI_CFG_CHANNEL_BONDING_MODE at CFG\n"));
-                            retCode = eSIR_LOGP_EXCEPTION;
-                            goto free;
-                        }
-                    }
-                }
-
-                /* All the translation is done by now for gVhtChannelWidth from .ini file to 
-                 * the actual values as defined in spec. So, grabing the spec value which is 
-                 * updated in .dat file by the above logic */
-                if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
-                                   &chanWidth) != eSIR_SUCCESS)
-                {
-                    limLog(pMac, LOGP,
-                      FL("Unable to retrieve Channel Width from CFG\n"));
-                }
-
-                psessionEntry->vhtTxChannelWidthSet = chanWidth;
-            }
-            psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
+            setupCBState( pMac, pSmeStartBssReq->cbMode );
+            pMac->lim.gHTSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
+#ifdef WLAN_SOFTAP_FEATURE
+            txWidthSet = (tSirMacHTChannelWidth)limGetHTCapability(pMac, eHT_RECOMMENDED_TX_WIDTH_SET, psessionEntry);
+#else
+            txWidthSet = (tSirMacHTChannelWidth)limGetHTCapability(pMac, eHT_RECOMMENDED_TX_WIDTH_SET);
 #endif
+
+            /*
+                * If there is a mismatch in secondaryChannelOffset being passed in the START_BSS request and
+                * ChannelBonding CFG, then MAC will override the 'ChannelBonding' CFG with what is being passed
+                * in StartBss Request.
+                * HAL RA and PHY will go out of sync, if both these values are not consistent and will result in TXP Errors
+                * when HAL RA tries to use 40Mhz rates when CB is turned off in PHY.
+                */
+            if(((pMac->lim.gHTSecondaryChannelOffset == eHT_SECONDARY_CHANNEL_OFFSET_NONE) &&
+                    (txWidthSet == eHT_CHANNEL_WIDTH_40MHZ)) ||
+                    ((pMac->lim.gHTSecondaryChannelOffset != eHT_SECONDARY_CHANNEL_OFFSET_NONE) &&
+                    (txWidthSet == eHT_CHANNEL_WIDTH_20MHZ)))
+                {
+                   PELOGW(limLog(pMac, LOGW, FL("secondaryChannelOffset and txWidthSet don't match, resetting txWidthSet CFG\n"));)
+                    txWidthSet = (txWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ;
+                    if (cfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, txWidthSet)
+                                        != eSIR_SUCCESS)
+                    {
+                        limLog(pMac, LOGP, FL("could not set  WNI_CFG_CHANNEL_BONDING_MODE at CFG\n"));
+                        retCode = eSIR_LOGP_EXCEPTION;
+                        goto free;
+                    }
+                }
         }
+
         else
         {
             PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ\n"));)
@@ -811,10 +719,18 @@
 
 #ifdef FIXME_GEN6   //following code may not be required. limInitMlm is now being invoked during peStart
         /// Initialize MLM state machine
+#ifdef ANI_PRODUCT_TYPE_AP
+            /* The Role is not set yet. Currently assuming the AddBss in Linux will be called by AP only.
+             * This should be handled when IBSS functionality is implemented in the Linux
+             * TODO */
+            pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
+            MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+#else
         limInitMlm(pMac);
 #endif
+#endif
 
-        psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
+        psessionEntry->htCapabality = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
 
 #ifdef WLAN_SOFTAP_FEATURE
             /* keep the RSN/WPA IE information in PE Session Entry
@@ -944,13 +860,16 @@
                       
         // Now populate the 11n related parameters
         pMlmStartReq->nwType    = psessionEntry->nwType;
-        pMlmStartReq->htCapable = psessionEntry->htCapability;
+        pMlmStartReq->htCapable = psessionEntry->htCapabality;
         //
         // FIXME_GEN4 - Determine the appropriate defaults...
         //
         pMlmStartReq->htOperMode        = pMac->lim.gHTOperMode;
         pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
-        pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
+        pMlmStartReq->txChannelWidthSet = pMac->lim.gHTRecommendedTxWidthSet;
+
+        //Update the global LIM parameter, which is used to populate HT Info IEs in beacons/probe responses.
+        pMac->lim.gHTSecondaryChannelOffset = limGetHTCBState(pMlmStartReq->cbMode);
 
         /* sep26 review */
         psessionEntry->limRFBand = limGetRFBand(channelNumber);
@@ -971,9 +890,18 @@
                 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED \n"));
         }
 
+#ifdef ANI_PRODUCT_TYPE_AP
+        PELOGE(limLog(pMac, LOGE, FL("Dot 11h is %s\n"), pMac->lim.gLim11hEnable?"Enabled":"Disabled");)
+        if (pMac->lim.gLim11hEnable)
+        { 
+           PELOG2(limLog(pMac, LOG2, FL("Cb state = %d, SecChanOffset = %d\n"),
+                   pMac->lim.gCbState, pMac->lim.gHTSecondaryChannelOffset);)
+            limRadarInit(pMac);
+        }
+#endif
         psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
         psessionEntry ->limSmeState     =  eLIM_SME_WT_START_BSS_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
+     MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
         limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
         return;
@@ -1096,7 +1024,7 @@
 #endif //FEATURE_WLAN_DIAG_SUPPORT
     
     pScanReq = (tpSirSmeScanReq) pMsgBuf;   
-    PELOG1(limLog(pMac, LOG1, FL("SME SCAN REQ numChan %d min %d max %d IELen %d first %d fresh %d unique %d type %d mode %d rsp %d\n"),
+    PELOG1(limLog(pMac, LOG1, FL("SME SCAN REQ numChan %d min %d max %d IELen %d first %d fresh %d unique %d type %d rsp %d\n"),
            pScanReq->channelList.numChannels,
            pScanReq->minChannelTime,
            pScanReq->maxChannelTime,
@@ -1104,9 +1032,7 @@
            pScanReq->returnAfterFirstMatch,
            pScanReq->returnFreshResults,
            pScanReq->returnUniqueResults,
-           pScanReq->scanType,
-           pScanReq->backgroundScanMode,
-           pMac->lim.gLimRspReqd ? 1 : 0);)
+           pScanReq->scanType, pMac->lim.gLimRspReqd ? 1 : 0);)
         
     /*copy the Self MAC address from SmeReq to the globalplace , used for sending probe req.discussed on code review sep18*/
     sirCopyMacAddr(pMac->lim.gSelfMacAddr,  pScanReq->selfMacAddr);
@@ -1166,7 +1092,7 @@
          pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
         
         pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
         if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
         {
@@ -1178,22 +1104,17 @@
         pMac->lim.gLim50Band11dScanDone     = 0;
         pMac->lim.gLimReturnAfterFirstMatch =
                                     pScanReq->returnAfterFirstMatch;
-        pMac->lim.gLimBackgroundScanMode =
-                                    pScanReq->backgroundScanMode;
 
         pMac->lim.gLimReturnUniqueResults   =
               ((pScanReq->returnUniqueResults) > 0 ? true : false);
         /* De-activate Heartbeat timers for connected sessions while
-         * scan is in progress if the system is in Active mode *
-         * AND it is not a ROAMING ("background") scan */
-        if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
+         * scan is in progress if the system is in Active mode */
+        if((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
            (ePMM_STATE_READY == pMac->pmm.gPmmState))
-            && (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ))
         {
           for(i=0;i<pMac->lim.maxBssId;i++)
           {
-            if((peFindSessionBySessionId(pMac,i) != NULL) &&
-               (pMac->lim.gpSession[i].valid == TRUE) &&
+            if((pMac->lim.gpSession[i].valid == TRUE) &&
                (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
             {
                limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
@@ -1293,7 +1214,6 @@
         pMlmScanReq->dot11mode = pScanReq->dot11mode;
 #ifdef WLAN_FEATURE_P2P
         pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
-        pMlmScanReq->skipDfsChnlInP2pSearch = pScanReq->skipDfsChnlInP2pSearch;
 #endif
 
         //Store the smeSessionID and transaction ID for later use.
@@ -1394,6 +1314,7 @@
  * @param  *pMsgBuf  A pointer to the SME message buffer
  * @return None
  */
+
 static void
 __limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
@@ -1446,6 +1367,9 @@
         }
         (void) palZeroMemory(pMac->hHdd, (void *) pSmeJoinReq, nSize);
  
+#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
+        handleHTCapabilityandHTInfo(pMac);
+#endif
         if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
                 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
         {
@@ -1505,8 +1429,7 @@
                 goto end;
             }
         }   
-        handleHTCapabilityandHTInfo(pMac, psessionEntry);
-
+        
         /* Store Session related parameters */
         /* Store PE session Id in session Table */
         psessionEntry->peSessionId = sessionId;
@@ -1534,25 +1457,18 @@
 
         psessionEntry->dot11mode  = pSmeJoinReq->dot11mode;
         psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
-#ifdef WLAN_FEATURE_11AC
-        psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
-        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
-            "***__limProcessSmeJoinReq: vhtCapability=%d****\n",psessionEntry->vhtCapability);
-#endif
 
         /*Phy mode*/
         psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
 
         /* Copy The channel Id to the session Table */
         psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
-        psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
-        psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
-        psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
+
 
         /*Store Persona */
         psessionEntry->pePersona = pSmeJoinReq->staPersona;
         VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
-                  FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona, pSmeJoinReq->cbMode);
+                  FL("PE PERSONA=%d"), psessionEntry->pePersona);
         
         /* Copy the SSID from smejoinreq to session entry  */  
         psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
@@ -1571,13 +1487,10 @@
 #ifdef FEATURE_WLAN_CCX
             psessionEntry->isCCXconnection = pSmeJoinReq->isCCXconnection;
 #endif
-#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
             psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
 #endif
             
-#ifdef FEATURE_WLAN_LFR
-            psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
-#endif
             if(psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
             {
                 psessionEntry->limSystemRole = eLIM_STA_ROLE;
@@ -1666,6 +1579,10 @@
 
         pMac->lim.gLimCurrentBssCaps =
             pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].capabilityInfo;
+
+        pMac->lim.gLimCurrentTitanHtCaps =
+             pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].titanHtCaps;
+
         palCopyMemory( pMac->hHdd,
          (tANI_U8 *) &pMac->lim.gLimCurrentSSID,
          (tANI_U8 *) &pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].ssId,
@@ -1678,19 +1595,30 @@
            (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
            psessionEntry->pLimJoinReq->bssDescription.length + 2);
 
-        psessionEntry->limCurrentBssCaps =
-           psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
+#if 0
 
-        regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel ); 
-        localPowerConstraint = regMax;
-        limExtractApCapability( pMac,
-           (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
-           limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
-           &psessionEntry->limCurrentBssQosCaps,
-           &psessionEntry->limCurrentBssPropCap,
-           &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH  make gLimCurrentBssUapsd this session specific
-           , &localPowerConstraint
-           ); 
+        pMac->lim.gLimCurrentChannelId =
+           psessionEntry->pLimJoinReq->bssDescription.channelId;
+#endif //oct 9th review remove globals
+
+        
+        psessionEntry->limCurrentBssCaps =
+               psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
+        
+
+        psessionEntry->limCurrentTitanHtCaps=
+                psessionEntry->pLimJoinReq->bssDescription.titanHtCaps;
+
+            regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel ); 
+            localPowerConstraint = regMax;
+            limExtractApCapability( pMac,
+               (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
+               limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
+               &psessionEntry->limCurrentBssQosCaps,
+               &psessionEntry->limCurrentBssPropCap,
+               &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH  make gLimCurrentBssUapsd this session specific
+               , &localPowerConstraint
+               ); 
 #ifdef FEATURE_WLAN_CCX
             psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
 #else
@@ -1726,9 +1654,9 @@
         //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
         pMac->lim.gLimIbssCoalescingHappened = false;
 
-            psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
-            psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
-            MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+        psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
+        psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
         PELOG1(limLog(pMac, LOG1, FL("SME JoinReq: SSID %d.%c%c%c%c%c%c\n"),
                psessionEntry->ssId.length,
@@ -1809,6 +1737,152 @@
 }
 #endif
 
+
+#if 0
+/**
+ * __limProcessSmeAuthReq()
+ *
+ *FUNCTION:
+ * This function is called to process SME_AUTH_REQ message
+ * from HDD or upper layer application.
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param  pMac      Pointer to Global MAC structure
+ * @param  *pMsgBuf  A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limProcessSmeAuthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+
+    tAniAuthType       authMode;
+    tLimMlmAuthReq     *pMlmAuthReq;
+    tpSirSmeAuthReq    pSirSmeAuthReq;
+    tSirResultCodes    retCode = eSIR_SME_SUCCESS;
+    tpPESession        psessionEntry;
+    tANI_U8            sessionId;
+
+    
+    if(pMsgBuf == NULL)
+    {
+        limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+           return;
+    }
+
+    pSirSmeAuthReq = (tpSirSmeAuthReq) pMsgBuf;
+
+    if((psessionEntry = peFindSessionByBssid(pMac,pSirSmeAuthReq->bssId,&sessionId))== NULL)
+    {
+        limLog(pMac, LOGE,FL("Session Does not exist for given BssId\n"));
+        return;
+    }
+
+    if (!limIsSmeAuthReqValid(pSirSmeAuthReq))
+    {
+        limLog(pMac, LOGW,
+               FL("received invalid SME_AUTH_REQ message\n"));
+
+        /// Send AUTH failure response to host
+        retCode = eSIR_SME_INVALID_PARAMETERS;
+        goto end;
+    }
+
+    PELOG1(limLog(pMac, LOG1,
+           FL("RECEIVED AUTH_REQ\n"));)
+
+    /**
+     * Expect Auth request for STA in link established state
+     * or STA in IBSS mode in normal state.
+     */
+
+    if ((psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
+        (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) ||
+        ((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) &&
+         (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
+    {
+        if (pSirSmeAuthReq->authType == eSIR_AUTO_SWITCH)
+            authMode = eSIR_SHARED_KEY; // Try Shared Key first
+        else
+            authMode = pSirSmeAuthReq->authType;
+
+        // Trigger MAC based Authentication
+        if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAuthReq, sizeof(tLimMlmAuthReq)))
+        {
+            // Log error
+            limLog(pMac, LOGP,
+                   FL("call to palAllocateMemory failed for mlmAuthReq\n"));
+            return;
+        }
+
+        pMac->lim.gLimPreAuthType = pSirSmeAuthReq->authType;
+
+        psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
+        psessionEntry->limSmeState     = eLIM_SME_WT_PRE_AUTH_STATE;
+     MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+
+        // Store channel specified in auth request.
+        // This will be programmed later by MLM.
+        pMac->lim.gLimPreAuthChannelNumber =
+                                    (tSirMacChanNum)
+                                    pSirSmeAuthReq->channelNumber;
+
+        palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
+                      (tANI_U8 *) &pSirSmeAuthReq->peerMacAddr,
+                      sizeof(tSirMacAddr));
+
+        palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmAuthReq->peerMacAddr,
+                      (tANI_U8 *) &pSirSmeAuthReq->peerMacAddr,
+                      sizeof(tSirMacAddr));
+
+        pMlmAuthReq->authType = authMode;
+        
+        /* Update PE session  Id */
+        pMlmAuthReq->sessionId = sessionId;
+
+        if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
+                      (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
+                            != eSIR_SUCCESS)
+        {
+            /**
+             * Could not get AuthFailureTimeout value from CFG.
+             * Log error.
+             */
+            limLog(pMac, LOGP,
+                   FL("could not retrieve AuthFailureTimeout value\n"));
+        }
+
+        limPostMlmMessage(pMac, LIM_MLM_AUTH_REQ, (tANI_U32 *) pMlmAuthReq);
+        return;
+    }
+    else
+    {
+        /// Should not have received eWNI_SME_AUTH_REQ
+        // Log the event
+        limLog(pMac, LOGE,
+               FL("received unexpected SME_AUTH_REQ in state %X\n"),psessionEntry->limSmeState);
+        limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
+
+        /// Send AUTH failure response to host
+        retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
+        goto end;
+    }
+
+end:
+    limSendSmeAuthRsp(pMac, retCode,
+                      pSirSmeAuthReq->peerMacAddr,
+                      pSirSmeAuthReq->authType,
+                      eSIR_MAC_UNSPEC_FAILURE_STATUS );
+
+} /*** end __limProcessSmeAuthReq() ***/
+#endif
+
+
 /**
  * __limProcessSmeReassocReq()
  *
@@ -1841,13 +1915,12 @@
     tANI_U16           transactionId; 
     tPowerdBm            localPowerConstraint = 0, regMax = 0;
     tANI_U32           teleBcnEn = 0;
-    tANI_U16            nSize;
 
 
     PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ\n"));)
     
-    nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
-    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pReassocReq, nSize ))
+
+    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pReassocReq, __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf)))
     {
         // Log error
         limLog(pMac, LOGP,
@@ -1856,7 +1929,8 @@
         retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
         goto end;
     }
-    (void) palZeroMemory(pMac->hHdd, (void *) pReassocReq, nSize);
+    
+
     if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
                           (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
         (!limIsSmeJoinReqValid(pMac,
@@ -1894,7 +1968,7 @@
 
     if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
     {
-#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX)
         if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
         {
             // May be from 11r FT pre-auth. So lets check it before we bail out
@@ -1927,6 +2001,30 @@
         goto end;
     }
 
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+    limCopyNeighborInfoToCfg(pMac,
+        psessionEntry->pLimReAssocReq->neighborBssList.bssList[0],
+        psessionEntry);
+
+    palCopyMemory( pMac->hHdd,
+             pMac->lim.gLimReassocBssId,
+             psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].bssId,
+             sizeof(tSirMacAddr));
+
+    pMac->lim.gLimReassocChannelId =
+         psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].channelId;
+
+    pMac->lim.gLimReassocBssCaps =
+    psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].capabilityInfo;
+
+    pMac->lim.gLimReassocTitanHtCaps = 
+        psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].titanHtCaps;
+
+    palCopyMemory( pMac->hHdd,
+    (tANI_U8 *) &pMac->lim.gLimReassocSSID,
+    (tANI_U8 *) &psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].ssId,
+    psessionEntry->pLimReAssocReq->neighborBssList.bssList[0].ssId.length+1);
+#else
     palCopyMemory( pMac->hHdd,
              psessionEntry->limReAssocbssId,
              psessionEntry->pLimReAssocReq->bssDescription.bssId,
@@ -1935,15 +2033,12 @@
     psessionEntry->limReassocChannelId =
          psessionEntry->pLimReAssocReq->bssDescription.channelId;
 
-    psessionEntry->reAssocHtSupportedChannelWidthSet =
-         (psessionEntry->pLimReAssocReq->cbMode)?1:0;
-    psessionEntry->reAssocHtRecommendedTxWidthSet =
-         psessionEntry->reAssocHtSupportedChannelWidthSet;
-    psessionEntry->reAssocHtSecondaryChannelOffset =
-         psessionEntry->pLimReAssocReq->cbMode;
-
     psessionEntry->limReassocBssCaps =
                 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
+
+    psessionEntry->limReassocTitanHtCaps =
+            psessionEntry->pLimReAssocReq->bssDescription.titanHtCaps;
+    
     regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel ); 
     localPowerConstraint = regMax;
     limExtractApCapability( pMac,
@@ -1988,6 +2083,8 @@
         limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x\n"), pMac->lim.gUapsdPerAcBitmask);
     }
 
+#endif
+
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq, sizeof(tLimMlmReassocReq)))
     {
         // Log error
@@ -2075,7 +2172,7 @@
     psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
     psessionEntry->limSmeState    = eLIM_SME_WT_REASSOC_STATE;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
     limPostMlmMessage(pMac,
                       LIM_MLM_REASSOC_REQ,
@@ -2172,7 +2269,7 @@
     }
 
 
-    PELOGE(limLog(pMac, LOGE,   FL("received DISASSOC_REQ message. Reason: %d global SmeState: %d\n"), 
+    PELOGE(limLog(pMac, LOGE,   FL("received DISASSOC_REQ message. Reason: %d SmeState: %d\n"), 
                                                         smeDisassocReq.reasonCode, pMac->lim.gLimSmeState);)
 
 
@@ -2204,7 +2301,7 @@
                 case eLIM_SME_LINK_EST_STATE:
                     psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
                     psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
-                    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+                      MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
                     break;
 
                 case eLIM_SME_WT_DEAUTH_STATE:
@@ -2214,7 +2311,7 @@
                      * its been set when PE entered WT_DEAUTH_STATE. 
                      */                  
                     psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
-                    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+                    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
                     limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DEAUTH_STATE. \n"));
                     break;
 
@@ -2448,8 +2545,6 @@
             limPrintMacAddr(pMac, smeDisassocCnf.peerMacAddr, LOGW);)
             return;
         }
-        /* Delete FT session if there exists one */
-        limFTCleanup(pMac);
         limCleanupRxPath(pMac, pStaDs, psessionEntry);
     }
 
@@ -2542,7 +2637,7 @@
                 case eLIM_SME_IDLE_STATE:
                     psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
                     psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
-              MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
+              MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
                     // Send Deauthentication request to MLM below
 
@@ -2971,6 +3066,178 @@
     palFreeMemory( pMac->hHdd, pRemoveKeyReq);
 } /*** end __limProcessSmeRemoveKeyReq() ***/
 
+
+
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+/**
+ * __limHandleSmeSwitchChlRequest()
+ *
+ *FUNCTION:
+ *  This function is called to process the following SME messages
+ *  received from HDD or WSM:
+ *      - eWNI_SME_SWITCH_CHL_REQ
+ *      - eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ
+ *      - eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ
+ *
+ *ASSUMPTIONS:
+ *
+ *  eWNI_SME_SWITCH_CHL_REQ is issued only when 11h is enabled,
+ *  and WSM wishes to switch its primary channel. AP shall
+ *  populate the 802.11h channel switch IE in its Beacons/Probe Rsp.
+ *
+ *  eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ is issued only when 11h is enabled,
+ *  and WSM wishes to switch both its primary channel and secondary channel.
+ *  (In the case of if 11h is disabled, and WSM wants to change both
+ *  primary & secondary channel, then WSM should issue a restart-BSS). AP
+ *  shall populate the 802.11h channel switch IE in its Beacons/Probe Rsp.
+ *
+ *  eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ is issued when WSM wishes to
+ *  switch/disable only its secondary channel. This can occur when 11h
+ *  is enabled or disabled. AP shall populate the airgo proprietary
+ *  channel switch IE in its Beacons/Probe Rsp.
+ *
+ *NOTE:
+ *
+ * @param  pMac      Pointer to Global MAC structure
+ * @param  *pMsgBuf  A pointer to the SME message buffer
+ * @return None
+ */
+
+static void
+__limHandleSmeSwitchChlRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
+{
+    tpSirSmeSwitchChannelReq   pSmeMsg;
+    eHalStatus                 status;
+
+#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
+    limDiagEventReport(pMac, WLAN_PE_DIAG_SWITCH_CHL_REQ_EVENT, NULL, 0, 0);
+#endif //FEATURE_WLAN_DIAG_SUPPORT
+    
+    if(pMsgBuf == NULL)
+    {
+        limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
+           return;
+    }
+
+    if (pMac->lim.gLimSmeState != eLIM_SME_NORMAL_STATE ||
+            pMac->lim.gLimSystemRole != eLIM_AP_ROLE ||
+            pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+    {
+        PELOGE(limLog(pMac, LOGE, "Rcvd Switch Chl Req in wrong state\n");)
+        limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_CHANNEL_SWITCH_FAIL);
+        return;
+    }
+                
+    status = palAllocateMemory( pMac->hHdd, (void **)&pSmeMsg, sizeof(tSirSmeSwitchChannelReq));
+    if( eHAL_STATUS_SUCCESS != status)
+    {
+        PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed, status = %d\n"), status);)
+        return;
+    }
+
+    if (!limIsSmeSwitchChannelReqValid(pMac, (tANI_U8 *)pMsgBuf, pSmeMsg))
+    {
+        limLog(pMac, LOGE,
+            FL("invalid sme message received\n"));
+        palFreeMemory( pMac->hHdd, pSmeMsg);
+        limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_INVALID_PARAMETERS);
+        return;
+    }
+
+
+    /* If we're already doing channel switching and we're in the
+     * middle of counting down, then reject this channel switch msg.
+     */
+    if (pMac->lim.gLimChannelSwitch.state != eLIM_CHANNEL_SWITCH_IDLE)
+    {
+        limLog(pMac, LOGE,
+            FL("channel switching is already in progress.\n"));
+        palFreeMemory( pMac->hHdd, pSmeMsg);
+        limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_CHANNEL_SWITCH_DISABLED);
+        return;
+    }
+
+    PELOG1(limLog(pMac, LOG1, FL("rcvd eWNI_SME_SWITCH_CHL_REQ, message type = %d\n"), pSmeMsg->messageType);)
+    switch(pSmeMsg->messageType)
+    {
+        case eWNI_SME_SWITCH_CHL_REQ:
+            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
+            break;
+
+        case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
+
+            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+            break;
+
+        case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
+            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_SECONDARY_ONLY;
+            break;
+
+        default:
+            PELOGE(limLog(pMac, LOGE, FL("unknown message\n"));)
+            palFreeMemory( pMac->hHdd, pSmeMsg);
+            limSendSmeRsp(pMac, eWNI_SME_SWITCH_CHL_RSP, eSIR_SME_INVALID_PARAMETERS);
+            return;
+    }
+
+    pMac->lim.gLimChannelSwitch.primaryChannel = pSmeMsg->channelId;
+    pMac->lim.gLimChannelSwitch.secondarySubBand = pSmeMsg->cbMode;
+    pMac->lim.gLimChannelSwitch.switchCount = computeChannelSwitchCount(pMac, pSmeMsg->dtimFactor);
+    if (LIM_IS_RADAR_DETECTED(pMac))
+    {
+        /** Measurement timers not running */
+        pMac->lim.gLimChannelSwitch.switchMode = eSIR_CHANSW_MODE_SILENT;
+    }
+    else
+    {
+        /** Stop measurement timers till channel switch */
+        limStopMeasTimers(pMac);
+        pMac->lim.gLimChannelSwitch.switchMode = eSIR_CHANSW_MODE_NORMAL;
+    }
+
+    PELOG1(limLog(pMac, LOG1, FL("state %d, primary %d, subband %d, count %d \n"),
+           pMac->lim.gLimChannelSwitch.state,
+           pMac->lim.gLimChannelSwitch.primaryChannel,
+           pMac->lim.gLimChannelSwitch.secondarySubBand,
+           pMac->lim.gLimChannelSwitch.switchCount);)
+    palFreeMemory( pMac->hHdd, pSmeMsg);
+    
+    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
+    pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
+    
+    return;
+} /*** end __limHandleSmeSwitchChlRequest() ***/
+
+
+/**--------------------------------------------------------------
+\fn     __limProcessSmeSwitchChlReq
+
+\brief  Wrapper for the function __limHandleSmeSwitchChlRequest
+        This message will be defered until softmac come out of
+        scan mode.
+\param  pMac
+\param  pMsg
+
+\return TRUE - If we consumed the buffer
+        FALSE - If have defered the message.
+ ---------------------------------------------------------------*/
+static tANI_BOOLEAN
+__limProcessSmeSwitchChlReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
+{
+    if (__limIsDeferedMsgForLearn(pMac, pMsg))
+    {
+        /**
+                * If message defered, buffer is not consumed yet.
+                * So return false
+                */
+        return eANI_BOOLEAN_FALSE;
+    }
+    __limHandleSmeSwitchChlRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
+    return eANI_BOOLEAN_TRUE;
+}
+#endif
+
+
 void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
 {
     tSirMsgQ         mmhMsg;
@@ -3021,7 +3288,7 @@
     mmhMsg.bodyval = 0;
   
     pMac->lim.gLimRspReqd = false;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 }
 
@@ -3340,7 +3607,7 @@
     prevState = psessionEntry->limSmeState;
 
     psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
 
     /* Update SME session Id and Transaction Id */
     psessionEntry->smeSessionId = smesessionId;
@@ -3368,7 +3635,7 @@
         PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d\n"), psessionEntry->bssIdx);)
         psessionEntry->limSmeState= prevState;
 
-        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
+        MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
    
         limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
     }
@@ -4017,7 +4284,7 @@
         limLog(pMac, LOGP, FL("AddtsRsp timer change failed!\n"));
         return;
     }
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_ADDTS_RSP_TIMER));
     
     //add the sessionId to the timer object
     pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
@@ -4200,7 +4467,6 @@
     if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
     {
         limLog(pMac, LOGE, FL("session does not exist for given bssId\n"));
-        palFreeMemory( pMac, pMsgBuf );
         return;
     }
 
@@ -4242,11 +4508,10 @@
     msgQ.reserved = 0;
     msgQ.bodyptr = pMsgBuf;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
         limLog(pMac, LOGP, "Unable to forward request\n");
-        palFreeMemory( pMac, pMsgBuf );
         return;
     }
 
@@ -4291,7 +4556,7 @@
     msgQ.reserved = 0;
     msgQ.bodyptr = pMsgBuf;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
         palFreeMemory( pMac, pMsgBuf );
@@ -4627,7 +4892,7 @@
    msg.bodyval = 0;
 
    PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL\n"));)
-      MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
+      MTRACE(macTraceMsgTx(pMac, 0, msg.type));
 
    if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
    {
@@ -4677,7 +4942,7 @@
    msg.bodyval = 0;
 
    PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL\n"));)
-      MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
+      MTRACE(macTraceMsgTx(pMac, 0, msg.type));
 
    if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
    {
@@ -4713,8 +4978,9 @@
     tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
     tANI_BOOLEAN match = VOS_FALSE;
     PELOG1(limLog(pMac, LOG1, 
-           FL("registerFrame %d, frameType %d, matchLen %d\n"), 
-            pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
+           FL("%s: registerFrame %d, frameType %d, matchLen %d\n", 
+           __func__, pSmeReq->registerFrame, pSmeReq->frameType, 
+       pSmeReq->matchLen)));
 
     /* First check whether entry exists already*/
 
@@ -4816,7 +5082,7 @@
     tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
     tANI_U32 *pMsgBuf = pMsg->bodyptr;
 
-    PELOG1(limLog(pMac, LOG1, FL("LIM Received SME Message %s(%d) Global LimSmeState:%s(%d) Global LimMlmState: %s(%d)\n"),
+    PELOG1(limLog(pMac, LOG1, FL("LIM Received SME Message %s(%d) LimSmeState:%s(%d) LimMlmState: %s(%d)\n"),
          limMsgStr(pMsg->type), pMsg->type,
          limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
          limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.c
index 4d81882..cfd824f 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,7 @@
  * --------------------------------------------------------------------
  *
  */
+
 #include "aniGlobal.h"
 #ifdef ANI_PRODUCT_TYPE_AP
 #include "wniCfgAp.h"
@@ -54,6 +55,7 @@
 #include "limSerDesUtils.h"
 #include "limTrace.h"
 #include "limSession.h"
+
 #define LIM_GET_NOISE_MAX_TRY 5
 #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
 /**
@@ -80,9 +82,11 @@
 limGetCurrentLearnChannel(tpAniSirGlobal pMac)
 {
     tANI_U8 *pChanNum = pMac->lim.gpLimMeasReq->channelList.channelNumber;
+
     return (*(pChanNum + pMac->lim.gLimMeasParams.nextLearnChannelId));
 } /*** end limGetCurrentLearnChannel() ***/
 #endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
+
 /**
  * limExtractApCapability()
  *
@@ -103,92 +107,73 @@
  * @param   qosCap    Bits are set according to capabilities
  * @return  0 - If AP does not assert HCF capability & 1 - otherwise
  */
+
 void
 limExtractApCapability(tpAniSirGlobal pMac, tANI_U8 *pIE, tANI_U16 ieLen,
                        tANI_U8 *qosCap, tANI_U16 *propCap, tANI_U8 *uapsd, 
                        tPowerdBm *localConstraint
                        )
 {
-    tSirProbeRespBeacon *pBeaconStruct;
+    tSirProbeRespBeacon beaconStruct;
 #if !defined WLAN_FEATURE_VOWIFI
     tANI_U32            localPowerConstraints = 0;
 #endif
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pBeaconStruct, sizeof(tSirProbeRespBeacon)))
-    {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limExtractApCapability\n") );
-        return;
-    }
 
-    palZeroMemory( pMac->hHdd, (tANI_U8 *) pBeaconStruct, sizeof(tSirProbeRespBeacon));
+    palZeroMemory( pMac->hHdd, (tANI_U8 *) &beaconStruct, sizeof(beaconStruct));
+
     *qosCap = 0;
     *propCap = 0;
     *uapsd = 0;
+
     PELOG3(limLog( pMac, LOG3,
         FL("In limExtractApCapability: The IE's being received are:\n"));
     sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG3, pIE, ieLen );)
-    if (sirParseBeaconIE(pMac, pBeaconStruct, pIE, (tANI_U32)ieLen) == eSIR_SUCCESS)
+    if (sirParseBeaconIE(pMac, &beaconStruct, pIE, (tANI_U32)ieLen) == eSIR_SUCCESS)
     {
 #if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
-        if (pBeaconStruct->propIEinfo.hcfEnabled)
+        if (beaconStruct.propIEinfo.hcfEnabled)
             LIM_BSS_CAPS_SET(HCF, *qosCap);
 #endif
-        if (pBeaconStruct->wmeInfoPresent || pBeaconStruct->wmeEdcaPresent)
+        if (beaconStruct.wmeInfoPresent || beaconStruct.wmeEdcaPresent)
             LIM_BSS_CAPS_SET(WME, *qosCap);
-        if (LIM_BSS_CAPS_GET(WME, *qosCap) && pBeaconStruct->wsmCapablePresent)
+        if (LIM_BSS_CAPS_GET(WME, *qosCap) && beaconStruct.wsmCapablePresent)
             LIM_BSS_CAPS_SET(WSM, *qosCap);
-        if (pBeaconStruct->propIEinfo.aniIndicator &&
-            pBeaconStruct->propIEinfo.capabilityPresent)
-            *propCap = pBeaconStruct->propIEinfo.capability;
-        if (pBeaconStruct->HTCaps.present)
+        if (beaconStruct.propIEinfo.aniIndicator &&
+            beaconStruct.propIEinfo.capabilityPresent)
+            *propCap = beaconStruct.propIEinfo.capability;
+        if (beaconStruct.HTCaps.present)
             pMac->lim.htCapabilityPresentInBeacon = 1;
         else
             pMac->lim.htCapabilityPresentInBeacon = 0;
 
-#ifdef WLAN_FEATURE_11AC
-        VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
-            "***beacon.VHTCaps.present*****=%d\n",pBeaconStruct->VHTCaps.present);
-
-        if ( pBeaconStruct->VHTCaps.present && pBeaconStruct->VHTOperation.present)
-        {
-            pMac->lim.vhtCapabilityPresentInBeacon = 1;
-            pMac->lim.apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
-            pMac->lim.apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
-        }
-        else
-        {
-            pMac->lim.vhtCapabilityPresentInBeacon = 0;
-        }
-#endif
         // Extract the UAPSD flag from WMM Parameter element
-        if (pBeaconStruct->wmeEdcaPresent)
-            *uapsd = pBeaconStruct->edcaParams.qosInfo.uapsd;
+        if (beaconStruct.wmeEdcaPresent)
+            *uapsd = beaconStruct.edcaParams.qosInfo.uapsd;
+
 #if defined FEATURE_WLAN_CCX
         /* If there is Power Constraint Element specifically,
          * adapt to it. Hence there is else condition check
          * for this if statement.
          */
-        if ( pBeaconStruct->ccxTxPwr.present)
+        if ( beaconStruct.ccxTxPwr.present)
         {
-            *localConstraint = pBeaconStruct->ccxTxPwr.power_limit;
+            *localConstraint = beaconStruct.ccxTxPwr.power_limit;
         }
 #endif
-        if (pBeaconStruct->powerConstraintPresent)
-#if 0
-        //Remove this check. This function is expected to return localPowerConsraints
-        //and it should just do that. Check for 11h enabled or not can be done at the caller
+
+        if (beaconStruct.powerConstraintPresent && ( pMac->lim.gLim11hEnable
 #if defined WLAN_FEATURE_VOWIFI
-          && ( pMac->lim.gLim11hEnable
-           || pMac->rrm.rrmPEContext.rrmEnable
+                 || pMac->rrm.rrmPEContext.rrmEnable
 #endif
-#endif
+                 ))
         {
 #if defined WLAN_FEATURE_VOWIFI 
-           *localConstraint -= pBeaconStruct->localPowerConstraint.localPowerConstraints;
+           *localConstraint -= beaconStruct.localPowerConstraint.localPowerConstraints;
 #else
-           localPowerConstraints = (tANI_U32)pBeaconStruct->localPowerConstraint.localPowerConstraints;
+           localPowerConstraints = (tANI_U32)beaconStruct.localPowerConstraint.localPowerConstraints;
 #endif
         }
+
 #if !defined WLAN_FEATURE_VOWIFI
         if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, localPowerConstraints) != eSIR_SUCCESS)
         {
@@ -196,10 +181,12 @@
         }
 #endif
     }
-    palFreeMemory(pMac->hHdd, pBeaconStruct);
+
     return;
 } /****** end limExtractApCapability() ******/
 
+
+
 #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
 /**
  * limQuietBss()
@@ -223,14 +210,18 @@
  * @param   duration  Specifies quiet duration in millisec
  * @return  None
  */
+
 void
 limQuietBss(tpAniSirGlobal pMac, tANI_U32 duration)
 {
+
     // Temporarily not quieting BSS
     (void) pMac; (void) duration;
     return;
 } /****** end limQuietBss() ******/
 
+
+
 /**
  * limIsMatrixNodePresent()
  *
@@ -249,13 +240,16 @@
  * @param   pMac  - Pointer to Global MAC structure
  * @return  pNode - Pointer to Matrix node if found. Else NULL
  */
+
 static tpLimMeasMatrixNode
 limIsMatrixNodePresent(tpAniSirGlobal pMac)
 {
     tANI_U8   i, chanNum = limGetCurrentLearnChannel(pMac);
     tpLimMeasMatrixNode pNode = pMac->lim.gpLimMeasData->pMeasMatrixInfo;
+
     if (!pNode)
         return NULL;
+
     for (i = 0; i < pMac->lim.gpLimMeasReq->channelList.numChannels; i++)
     {
         if (pNode->matrix.channelNumber == chanNum)
@@ -270,9 +264,12 @@
                 break;
         }
     }
+
     return NULL;
 } /****** end limIsMatrixNodePresent() ******/
 
+
+
 /**
  * limGetMatrixNode()
  *
@@ -292,11 +289,13 @@
  * @param   pMac      Pointer to Global MAC structure
  * @return  None
  */
+
 static tpLimMeasMatrixNode
 limGetMatrixNode(tpAniSirGlobal pMac)
 {
     tpLimMeasMatrixNode       pNewMatrix;
     eHalStatus          status;
+
     pNewMatrix = limIsMatrixNodePresent(pMac);
     if (!pNewMatrix)
     {
@@ -311,6 +310,7 @@
                FL("palAllocateMemory failed for new measMatrix Node\n"));
             return NULL;
         }
+
         status = palZeroMemory( pMac->hHdd, (void *)pNewMatrix, sizeof(*pNewMatrix));
         if (status != eHAL_STATUS_SUCCESS)
         {
@@ -324,15 +324,20 @@
         pNewMatrix->matrix.channelNumber =
                                    limGetCurrentLearnChannel(pMac);
         pNewMatrix->avgRssi              = 0;
+
        PELOG3(limLog(pMac, LOG3, FL("Adding new Matrix info:channel#=%d\n"),
                pNewMatrix->matrix.channelNumber);)
+
         pNewMatrix->next = pMac->lim.gpLimMeasData->pMeasMatrixInfo;
         pMac->lim.gpLimMeasData->pMeasMatrixInfo = pNewMatrix;
         pMac->lim.gpLimMeasData->numMatrixNodes++;
     }
+
     return pNewMatrix;
 } /****** end limGetMatrixNode() ******/
 
+
+
 /**
  * limComputeAvg()
  *
@@ -353,6 +358,7 @@
  * @param   newVal    New averaged value
  * @return  None
  */
+
 tANI_U32
 limComputeAvg(tpAniSirGlobal pMac, tANI_U32 oldVal, tANI_U32 newVal)
 {
@@ -361,6 +367,8 @@
                       pMac->lim.gLimMeasParams.rssiAlpha));
 } /****** end limComputeAvg() ******/
 
+
+
 /**
  * limCollectRSSI()
  *
@@ -379,11 +387,13 @@
  * @param   pMac      Pointer to Global MAC structure
  * @return  None
  */
+
 void
 limCollectRSSI(tpAniSirGlobal pMac)
 {
     tpLimMeasMatrixNode  pNewMatrix = limGetMatrixNode(pMac);
     tANI_U32 i, noise;
+
     for (i = 0; i < LIM_GET_NOISE_MAX_TRY; i++)
         if ((noise = halGetNoise(pMac)) != HAL_NOISE_INVALID)
         {
@@ -394,14 +404,17 @@
         }
 } /****** end limCollectRSSI() ******/
 
+
 /**----------------------------------------------------------------------------
 \fn        limGetNeighbourBssNode
+
 \brief    returns neighbour bss node if it is already present in the list.
 \param pMac
 \param bssid - Bssid of new beacon or data packet.
 \param pSsId - Pointer to SSID of new packet.
 \param nwType - 11b/g/a
 \param chanId - Channel in which we received the packet.
+
 \return tpLimNeighborBssWdsNode or NULL
 -------------------------------------------------------------------------------*/
 static tpLimNeighborBssWdsNode
@@ -409,6 +422,7 @@
                                             tSirNwType nwType, tpAniSSID pSsId, tANI_U8 type)
 {
     tpLimNeighborBssWdsNode pNode = pMac->lim.gpLimMeasData->pNeighborWdsInfo;
+
     while (pNode)
     {
         //Do we need to check for ssId also ?
@@ -434,14 +448,17 @@
 #endif
                 return pNode;
         }
+
         if (!pNode->next)
             break;
         else
             pNode = pNode->next;
     }
+
     return NULL;
 }
 
+
 /**
  * limCollectMeasurementData()
  *
@@ -462,6 +479,7 @@
  * @param  pBeacon  - Pointer to parsed BSS info
  * @return None
  */
+
 void
 limCollectMeasurementData(tpAniSirGlobal pMac,
                           tANI_U32 *pRxPacketInfo, tpSchBeaconStruct pBeacon)
@@ -478,8 +496,10 @@
     tpLimMeasMatrixNode     pNewMatrix;
     eHalStatus status;
     tpSirMacMgmtHdr       pHdr;
+
    PELOG3(limLog(pMac, LOG3, FL("Collecting measurement data for RadioId %d\n"),
            pMac->sys.gSirRadioId);)
+
     tANI_U32 ignore = 0;
     limGetBssidFromBD(pMac, (tpHalBufDesc) pRxPacketInfo, bssIdRcv, &ignore);
     if (palEqualMemory( pMac->hHdd, bssIdRcv, pMac->lim.gLimBssid, sizeof(tSirMacAddr)))
@@ -489,6 +509,7 @@
     }
     pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
     fc = pHdr->fc;
+
     if (fc.type == SIR_MAC_DATA_FRAME)
     {
         PELOG2(limLog(pMac, LOG2, FL("Received DATA packet\n"));)
@@ -503,6 +524,7 @@
         chanId = limGetChannelFromBeacon(pMac, pBeacon);
         ieLen = pBeacon->wpa.length + pBeacon->propIEinfo.wdsLength;
     }
+
     if (chanId == 0)
     {
       /* If the channel Id is not retrieved from Beacon, extract the channel from BD */
@@ -514,24 +536,30 @@
            chanId = pMac->lim.gLimCurrentScanChannelId;
       }
     }
+
     /*
      * Now always returns nwType as 11G for data packets - FIXIT
      */
     nwType = limGetNwType(pMac, chanId, fc.type, pBeacon);
+
     pNewMatrix = limGetMatrixNode(pMac);
     /** LOGP would result in freeing all dynamicall allocated memories. So
       *  return from here if limGetMatrixNode returns NULL
       */
     if (!pNewMatrix)
         return;
+
     pNewMatrix->matrix.aggrRssi += WDA_GET_RX_RSSI_DB(pRxPacketInfo);
     pNewMatrix->matrix.totalPackets++;
+
     // Find if this neighbor is already 'learned'
     // If found, update its information.
     pNode = limGetNeighbourBssNode(pMac, bssIdRcv, chanId, nwType, &ssId, fc.type);
+
     if (!pNode)
     {
         realLen = sizeof(tSirNeighborBssWdsInfo);
+
         /** Newly discovered neighbor. Inform WSM of this
           * and add this BSS info at the beginning
           * Need to limit the number newly discovered BSS added
@@ -542,12 +570,14 @@
                  sizeof(tSirMeasMatrixInfo)));
        PELOG2(limLog(pMac, LOG2, FL("Current BSS length %d, Real length %d\n"),
                 pMac->lim.gpLimMeasData->totalBssSize, realLen);)
+
         /** Check if we have enough room for adding a new node.
           */
         if (pMac->lim.gpLimMeasData->totalBssSize + realLen < len)
         {
             pMac->lim.gpLimMeasData->numBssWds++;
             pMac->lim.gpLimMeasData->totalBssSize += realLen;
+
             PELOG2(limPrintMacAddr(pMac, bssIdRcv, LOG2);)
         }
         else
@@ -555,17 +585,20 @@
             PELOG2(limLog(pMac, LOG2, FL("Dropping the measurement packets: No memory!\n"));)
             return;
     }
+
         /** Allocate max memory required even if the packet is of type DATA,
           * So that next time we receive a beacon, won't run out of memory to
           * update the information.
           */
         allocLen = sizeof(tLimNeighborBssWdsNode) + 4 + ieLen;
         status = palAllocateMemory( pMac->hHdd, (void **)&pNode, allocLen);
+
     if (status != eHAL_STATUS_SUCCESS)
     {
             limLog(pMac, LOGP, FL("palAllocateMemory failed for new NeighborBssWds Node\n"));
         return;
     }
+
         status = palZeroMemory(pMac->hHdd, pNode, allocLen);
         if (status != eHAL_STATUS_SUCCESS)
         {
@@ -576,11 +609,13 @@
         pMac->lim.gpLimMeasData->pNeighborWdsInfo = pNode;
         found = eANI_BOOLEAN_FALSE;
     }
+
     pNode->info.neighborBssInfo.rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
     pNode->info.neighborBssInfo.aggrRssi += pNode->info.neighborBssInfo.rssi;
     if (fc.type == SIR_MAC_DATA_FRAME)
         pNode->info.neighborBssInfo.dataCount++;
     pNode->info.neighborBssInfo.totalPackets++;
+
     /** If node not found or previous learn was not from a beacon/probe rsp
       * then learn again.
       */
@@ -595,10 +630,12 @@
         // Data frame received from other BSS.
         // Collect as much information as possible
             pNode->info.neighborBssInfo.wniIndicator = (tAniBool) 0;
+
         if (fc.toDS || fc.fromDS)
                 pNode->info.neighborBssInfo.bssType = eSIR_INFRASTRUCTURE_MODE;
         else
                 pNode->info.neighborBssInfo.bssType = eSIR_IBSS_MODE;
+
             pNode->info.neighborBssInfo.load.numStas = 0;
             pNode->info.neighborBssInfo.load.channelUtilization = 0;
             pNode->info.neighborBssInfo.ssId.length = 0;
@@ -608,6 +645,19 @@
     }
     else
     {
+        //FIXME_CBMODE: need to seperate out TITAN and HT cb modes.
+        if(pBeacon->HTCaps.present)
+        {
+            limGetHtCbAdminState(pMac, pBeacon->HTCaps, 
+                        &pNode->info.neighborBssInfo.titanHtCaps);
+        
+            if( pBeacon->HTInfo.present)
+            {
+                    limGetHtCbOpState(pMac, pBeacon->HTInfo, 
+                            &pNode->info.neighborBssInfo.titanHtCaps);
+            }
+        }
+
         // This must be either Beacon frame or
         // Probe Response. Copy all relevant information.
             pNode->info.neighborBssInfo.wniIndicator = (tAniBool) pBeacon->propIEinfo.aniIndicator;
@@ -620,6 +670,7 @@
             pNode->info.neighborBssInfo.apName.length = pBeacon->propIEinfo.apName.length;
             palCopyMemory( pMac->hHdd, (tANI_U8 *) pNode->info.neighborBssInfo.apName.name,
                     pBeacon->propIEinfo.apName.name, pBeacon->propIEinfo.apName.length);
+
             pNode->info.neighborBssInfo.rsnIE.length = 0;
             // Add WPA2 information. Before that make sure that memory is available
             if (pBeacon->rsnPresent && (pBeacon->rsn.length < SIR_MAC_MAX_IE_LENGTH))
@@ -629,10 +680,12 @@
                 pNode->info.neighborBssInfo.rsnIE.rsnIEdata[1] = pBeacon->rsn.length;
                 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pNode->info.neighborBssInfo.rsnIE.rsnIEdata[2],
                         pBeacon->rsn.info, pBeacon->rsn.length);
+
                PELOG2(limLog(pMac, LOG2, FL("NeighborBss RSN IE, type=%x, length=%x\n"), 
                         pNode->info.neighborBssInfo.rsnIE.rsnIEdata[0],
                         pNode->info.neighborBssInfo.rsnIE.rsnIEdata[1]);)
             }
+
             // Add WPA information. Before that make sure that memory is available
             if (pBeacon->wpaPresent && ((pBeacon->rsn.length + pBeacon->wpa.length) < (SIR_MAC_MAX_IE_LENGTH-2)))
             {
@@ -640,9 +693,11 @@
                     SIR_MAC_WPA_EID;
                 pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length + 1] =
                     pBeacon->wpa.length;
+
                 palCopyMemory( pMac->hHdd,
                         (tANI_U8 *) &pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length + 2],
                         pBeacon->wpa.info, pBeacon->wpa.length);
+
                PELOG2(limLog(pMac, LOG2, FL("NeighborBss WPA IE, type=%x, length=%x\n"),
                         pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length],
                         pNode->info.neighborBssInfo.rsnIE.rsnIEdata[pNode->info.neighborBssInfo.rsnIE.length + 1]);)
@@ -652,23 +707,28 @@
             palCopyMemory( pMac->hHdd, (tANI_U8 *) pNode->info.wdsInfo.wdsBytes,
                       pBeacon->propIEinfo.wdsData,
                       pBeacon->propIEinfo.wdsLength);
+
             pNode->info.neighborBssInfo.capabilityInfo = *((tANI_U16*)&pBeacon->capabilityInfo);
+
 #if 0
             if (pBeacon->HTCaps.present)
                 palCopyMemory( pMac->hHdd, (tANI_U8 *)&pNode->info.neighborBssInfo.HTCaps,
                         (tANI_U8 *)&pBeacon->HTCaps, HT_CAPABILITY_IE_SIZE);
         else
                 pNode->info.neighborBssInfo.HTCaps.present = 0;
+
             if (pBeacon->HTInfo.present)
                 palCopyMemory( pMac->hHdd, (tANI_U8 *)&pNode->info.neighborBssInfo.HTInfo,
                         (tANI_U8 *)&pBeacon->HTInfo, HT_INFO_IE_SIZE);
         else
                 pNode->info.neighborBssInfo.HTInfo.present = 0;
 #endif
+
             if (pBeacon->suppRatesPresent && (pBeacon->supportedRates.numRates <= 
                                               SIR_MAC_RATESET_EID_MAX))
             {
                 pNode->info.neighborBssInfo.operationalRateSet.numRates = pBeacon->supportedRates.numRates;
+
                PELOG4(limLog(pMac, LOG4, FL("Supported Rates (%d) : "),
                         pNode->info.neighborBssInfo.operationalRateSet.numRates);)
                 for (i=0; i<pBeacon->supportedRates.numRates; i++)
@@ -678,10 +738,12 @@
                 }
                 PELOG4(limLog(pMac, LOG4, FL("\n"));)
             }
+
             if (pBeacon->extendedRatesPresent && (pBeacon->extendedRates.numRates <= 
                                                   SIR_MAC_RATESET_EID_MAX))
             {
                 pNode->info.neighborBssInfo.extendedRateSet.numRates = pBeacon->extendedRates.numRates;
+
                PELOG4(limLog(pMac, LOG4, FL("Extended Rates (%d) : "),
                         pNode->info.neighborBssInfo.extendedRateSet.numRates);)
                 for (i=0; i<pBeacon->extendedRates.numRates; i++)
@@ -708,6 +770,7 @@
         }
     }
 } /****** end limCollectMeasurementData() ******/
+
 /**
  * limCleanupMatrixNodes()
  *
@@ -726,6 +789,7 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
+
 static void
 limCleanupMatrixNodes(tpAniSirGlobal pMac)
 {
@@ -733,21 +797,26 @@
     {
         tpLimMeasMatrixNode pNode = pMac->lim.gpLimMeasData->pMeasMatrixInfo;
         tpLimMeasMatrixNode pNext;
+
       while (pNode)
       {
             pNext = pNode->next;
             palFreeMemory( pMac->hHdd, pNode);
+
             if (pNext)
                 pNode = pNext;
             else
               break;
           }
       }
+
     pMac->lim.gpLimMeasData->numMatrixNodes = 0;
          PELOG2(limLog(pMac, LOG2,
            FL("Cleaned up channel matrix nodes\n"));)
+
     pMac->lim.gpLimMeasData->pMeasMatrixInfo = NULL;
 } /****** end limCleanupMatrixNodes() ******/
+
 /**
  * limCleanupNeighborBssNodes()
  *
@@ -766,6 +835,7 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
+
 static void
 limCleanupNeighborBssNodes(tpAniSirGlobal pMac)
 {
@@ -779,19 +849,23 @@
             pNext = pNode->next;
             pMac->lim.gpLimMeasData->numBssWds--;
             palFreeMemory( pMac->hHdd, pNode);
+
             if (pNext)
                 pNode = pNext;
             else
                 break;
         }
     }
+
    PELOG2(limLog(pMac, LOG2,
            FL("Cleaned up neighbor nodes\n"));)
+
     pMac->lim.gpLimMeasData->numBssWds        = 0;
     pMac->lim.gpLimMeasData->totalBssSize     = 0;
     pMac->lim.gpLimMeasData->pNeighborWdsInfo = NULL;
 } /****** end limCleanupNeighborBssNodes() ******/
 
+
 /**
  * limSendSmeMeasurementInd()
  *
@@ -808,27 +882,32 @@
  * @param  pMac - Pointer to Global MAC structure
  * @return None
  */
+
 void
 limSendSmeMeasurementInd(tpAniSirGlobal pMac)
 {
     tANI_U8          *pMeasInd;
     tANI_U16         len = 0;
     tSirMsgQ    mmhMsg;
+
 #ifdef GEN6_TODO
     //fetch the sessionEntry based on the sessionId
     //priority - MEDIUM
     tpPESession sessionEntry;
+
     if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.gLimMeasParams.measurementIndTimer.sessionId))== NULL) 
     {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
         return;
     }
 #endif
+
     if (!pMac->sys.gSysEnableLearnMode ||
         (pMac->lim.gpLimMeasReq == NULL))
     {
         return;
     }
+
     len = sizeof(tSirSmeMeasurementInd) +
           (pMac->lim.gpLimMeasReq->channelList.numChannels *
            sizeof(tSirMeasMatrixInfo)) +
@@ -842,28 +921,37 @@
                pMac->lim.gpLimMeasData->numBssWds,
                pMac->lim.gpLimMeasData->totalBssSize);
     }
+
     PELOG2(limLog(pMac, LOG2, FL("*****  Measurement IND size %d\n"), len);)
+
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMeasInd, len))
     {
         /// Buffer not available. Log error
         limLog(pMac, LOGP,
                FL("call to palAllocateMemory failed for eWNI_SME_MEAS_IND\n"));
+
         return;
     }
+
    PELOG3(limLog(pMac, LOG3,
        FL("Sending eWNI_SME_MEAS_IND on Radio %d, requested len=%d\n"),
        pMac->sys.gSirRadioId, len);)
+
     limMeasurementIndSerDes(pMac, pMeasInd);
+
     mmhMsg.type = eWNI_SME_MEASUREMENT_IND;
     mmhMsg.bodyptr = pMeasInd;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
+
     // Cleanup neighbor information
     limCleanupNeighborBssNodes(pMac);
     limCleanupMatrixNodes(pMac);
 } /*** end limSendSmeMeasurementInd() ***/
 
+
+
 /**
  * limCleanupMeasData()
  *
@@ -884,40 +972,51 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
+
 void
 limCleanupMeasData(tpAniSirGlobal pMac)
 {
     if (pMac->lim.gpLimMeasReq)
         palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasReq);
+
     pMac->lim.gpLimMeasReq = NULL;
+
     if (!pMac->lim.gpLimMeasData)
         return;
+
     if (pMac->lim.gpLimMeasData->pMeasMatrixInfo)
     {
         // Retain current channel's data and flush remaining
         tpLimMeasMatrixNode pMatrix =
                         (pMac->lim.gpLimMeasData->pMeasMatrixInfo)->next;
         tpLimMeasMatrixNode pNext;
+
         while (pMatrix)
         {
             pNext = pMatrix->next;
             palFreeMemory( pMac->hHdd, pMatrix);
+
             if (pNext)
                 pMatrix = pNext;
             else
                 break;
         }
+
         pMac->lim.gpLimMeasData->pMeasMatrixInfo->next = NULL;
     }
+
     pMac->lim.gpLimMeasData->numMatrixNodes = 0;
    PELOG2(limLog(pMac, LOG2,
            FL("Cleaned up measurement metrics nodes\n"));)
+
     // Cleanup neighbor information
     limCleanupNeighborBssNodes(pMac);
 } /****** end limCleanupMeasData() ******/
+
 /**---------------------------------------------------------
 \fn     limStopMeasTimers
 \brief  Stops all measurement related timers.
+
 \param  pMac
 \return None
  ----------------------------------------------------------*/
@@ -926,6 +1025,7 @@
 {
     if (pMac->lim.gpLimMeasReq == NULL)
         return;
+
     if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled)
     {
         if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.measurementIndTimer) != TX_SUCCESS)
@@ -934,25 +1034,28 @@
         }
     }
     pMac->lim.gLimMeasParams.isMeasIndTimerActive = 0;
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_LEARN_INTERVAL_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_LEARN_INTERVAL_TIMER));
     if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
     {
         PELOGE(limLog(pMac, LOGE, FL("Cannot stop learn interval timer\n"));)
     }
+
     if (pMac->lim.gLimSpecMgmt.fQuietEnabled)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_LEARN_DURATION_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_LEARN_DURATION_TIMER));
         if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
         {
             PELOGE(limLog(pMac, LOGE, FL("Cannot stop learn duration timer\n"));)
         }
     }
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_LEARN_DURATION_TIMER));
+
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_LEARN_DURATION_TIMER));
     if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
     {
         PELOGE(limLog(pMac, LOGE, FL("Cannot stop learn duration timer\n"));)
     }
 }
+
 /**
  * limDeleteMeasTimers()
  *
@@ -970,6 +1073,7 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
+
 void
 limDeleteMeasTimers(tpAniSirGlobal pMac)
 {
@@ -979,6 +1083,8 @@
     tx_timer_delete(&pMac->lim.gLimMeasParams.learnDurationTimer);
 } /*** end limDeleteMeasTimers() ***/
 
+
+
 /**
  * limCleanupMeasResources()
  *
@@ -999,24 +1105,30 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
+
 void
 limCleanupMeasResources(tpAniSirGlobal pMac)
 {
    PELOG1( limLog(pMac, LOG1,
            FL("Cleaning up Learn mode Measurement resources\n"));)
+
     if (pMac->lim.gpLimMeasReq == NULL)
         return;
+
     limDeleteMeasTimers(pMac);
+
     if (pMac->lim.gpLimMeasData)
     {
         limCleanupMeasData(pMac);
         if (pMac->lim.gpLimMeasData->pMeasMatrixInfo)
             palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasData->pMeasMatrixInfo);
+
         palFreeMemory( pMac->hHdd, pMac->lim.gpLimMeasData);
         pMac->lim.gpLimMeasData = NULL;
     }
 } /****** end limCleanupMeasResources() ******/
 
+
 /**
  * limDeleteCurrentBssWdsNode()
  *
@@ -1040,6 +1152,7 @@
 {
     tANI_U32                 cfg = sizeof(tSirMacAddr);
     tSirMacAddr         currentBssId;
+
 #if 0
     if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
                                 eSIR_SUCCESS)
@@ -1049,8 +1162,10 @@
     }
 #endif //TO SUPPORT BT-AMP
     sirCopyMacAddr(currentBssId,sessionEntry->bssId);
+
     if (!pMac->lim.gpLimMeasData)
         return;
+
     if (pMac->lim.gpLimMeasData->pNeighborWdsInfo)
     {
         tpLimNeighborBssWdsNode pNode =
@@ -1068,16 +1183,20 @@
                 break;
             }
             pPrev = pNode;
+
             if (pNode->next)
                 pNode = pNode->next;
             else
                 break;
         }
+
         if (!pMac->lim.gpLimMeasData->numBssWds)
             pMac->lim.gpLimMeasData->pNeighborWdsInfo = NULL;
     }
 } /****** end limDeleteCurrentBssWdsNode() ******/
 
+
+
 /**
  * limRestorePreLearnState()
  *
@@ -1096,23 +1215,61 @@
  * @param  pMac      Pointer to Global MAC structure
  * @return None
  */
+
 void
 limRestorePreLearnState(tpAniSirGlobal pMac)
 {
    PELOG4(limLog(pMac, LOG4,
            FL("Restoring from Learn mode on RadioId %d\n"),
            pMac->sys.gSirRadioId);)
+
     pMac->lim.gLimSystemInScanLearnMode = 0;
+
     // Go back to previous state.
     pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
     pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
-    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
+
    PELOG4(limLog(pMac, LOG4,
            FL("Restored from Learn mode on RadioId %d\n"),
            pMac->sys.gSirRadioId);)
 } /****** end limRestorePreLearnState() ******/
+
 #endif //#if (defined(ANI_PRODUCT_TYPE_AP) || (ANI_PRODUCT_TYPE_AP_SDK))
+
+/**
+ * limGetPhyCBState
+ *
+ *FUNCTION:
+ * Based on the current state of LIM, this routine determines
+ * the correct PHY enumeration "ePhyChanBondState" to use
+ *
+ *LOGIC:
+ * Is it possible to have a common enumeration?
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param  pMac - Pointer to Global MAC structure
+ * @return The corresponding PHY enumeration ePhyChanBondState
+ */
+ePhyChanBondState limGetPhyCBState( tpAniSirGlobal pMac )
+{
+    ePhyChanBondState cbState = PHY_SINGLE_CHANNEL_CENTERED;
+
+    if( GET_CB_OPER_STATE( pMac->lim.gCbState ))
+    {
+      if( GET_CB_SEC_CHANNEL( pMac->lim.gCbState ))
+        cbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
+      else
+        cbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
+    }
+  return cbState;
+}
+
+
 /**
  * limGetHTCBState
  *
@@ -1127,34 +1284,45 @@
  * @param  pMac - Pointer to Global MAC structure
  * @return The corresponding HT enumeration
  */
-ePhyChanBondState  limGetHTCBState(ePhyChanBondState aniCBMode) 
+
+tSirMacHTSecondaryChannelOffset    limGetHTCBState(tAniCBSecondaryMode aniCBMode) 
 {
-    switch ( aniCBMode )
-    {
-#ifdef WLAN_FEATURE_11AC
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
-#endif
-        case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
-        return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
-#ifdef WLAN_FEATURE_11AC
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
-#endif
-        case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
-        return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
-#ifdef WLAN_FEATURE_11AC
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
-           return PHY_SINGLE_CHANNEL_CENTERED;
-#endif
-        default :
-           return PHY_SINGLE_CHANNEL_CENTERED;
-     }
+    if(aniCBMode == eANI_CB_SECONDARY_DOWN)
+        return eHT_SECONDARY_CHANNEL_OFFSET_DOWN;
+    else if(aniCBMode == eANI_CB_SECONDARY_UP)
+        return eHT_SECONDARY_CHANNEL_OFFSET_UP;
+    else
+        return eHT_SECONDARY_CHANNEL_OFFSET_NONE;
 }
 
- /*
+
+/**
+ * limGetAniCBState
+ *
+ *FUNCTION:
+ * This routing provides the translation of HT Enum to Airgo enum for determining 
+ * secondary channel offset.
+ * Airgo Enum is required for backward compatibility purposes.
+ *
+ *
+ *NOTE:
+ *
+ * @param  pMac - Pointer to Global MAC structure
+ * @return The corresponding ANI enumeration
+ */
+
+tAniCBSecondaryMode     limGetAniCBState( tSirMacHTSecondaryChannelOffset htCBMode) 
+{
+    if(eHT_SECONDARY_CHANNEL_OFFSET_DOWN == htCBMode)
+        return eANI_CB_SECONDARY_DOWN;
+    else if(eHT_SECONDARY_CHANNEL_OFFSET_UP == htCBMode)
+        return eANI_CB_SECONDARY_UP;
+    else
+        return eANI_CB_SECONDARY_NONE;
+}
+
+
+/**
  * limGetStaPeerType
  *
  *FUNCTION:
@@ -1179,6 +1347,7 @@
     tpPESession   psessionEntry)
 {
 tStaRateMode staPeerType = eSTA_11b;
+
   // Determine the peer-STA type
   if( pStaDs->aniPeer )
   {
@@ -1189,16 +1358,118 @@
     else
         staPeerType = eSTA_POLARIS;
   }
-#ifdef WLAN_FEATURE_11AC
-  else if(pStaDs->mlmStaContext.vhtCapability)
-      staPeerType = eSTA_11ac;
-#endif
   else if(pStaDs->mlmStaContext.htCapability)
         staPeerType = eSTA_11n;
   else if(pStaDs->erpEnabled)
         staPeerType = eSTA_11bg;
   else if(psessionEntry->limRFBand == SIR_BAND_5_GHZ)
         staPeerType = eSTA_11a;
+
   return staPeerType;
 }
 
+/**
+ * setupCBState()
+ *
+ *FUNCTION:
+ * This function is called during eWNI_SME_START_BSS_REQ.
+ * Based on the configured Channel Bonding mode, the
+ * appropriate Channel Bonding state is setup in the global
+ * LIM object - gCbState. This will then be subsequently used
+ * in the proprietary IE field
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ *
+ *NOTE:
+ *
+ * @param  pMac   Pointer to Global MAC structure
+ * @param  cbMode The CB mode as set by SME (WSM)
+ * @return None
+ */
+void setupCBState( tpAniSirGlobal pMac,
+    tAniCBSecondaryMode cbMode )
+{
+
+  switch( cbMode )
+  {
+    case eANI_CB_SECONDARY_DOWN:
+      SET_CB_OPER_STATE( pMac->lim.gCbState, eHAL_SET );
+      SET_CB_SEC_CHANNEL( pMac->lim.gCbState, eHAL_CLEAR );
+      if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_LOWER) != eSIR_SUCCESS)
+          limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
+      // AU state is set via CFG
+      break;
+
+    case eANI_CB_SECONDARY_UP:
+      SET_CB_OPER_STATE( pMac->lim.gCbState, eHAL_SET );
+      SET_CB_SEC_CHANNEL( pMac->lim.gCbState, eHAL_SET );
+      if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_HIGHER) != eSIR_SUCCESS)
+          limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
+      // AU state is set via CFG
+      break;
+
+    case eANI_CB_SECONDARY_NONE:
+      if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_NONE) != eSIR_SUCCESS)
+          limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
+
+    default:
+      SET_CB_OPER_STATE( pMac->lim.gCbState, eHAL_CLEAR );
+      break;
+  }
+
+
+
+  limLog( pMac, LOG2,
+      FL("New CB State: 0x%1x for Mode %d\n"),
+      pMac->lim.gCbState,
+      cbMode );
+}
+
+/**
+ * limGetCurrentCBSecChannel()
+ *
+ *FUNCTION:
+ * This function is called to determine the current
+ * "secondary" channel when Channel Bonding is enabled
+ *
+ *PARAMS:
+ *
+ *LOGIC:
+ *
+ *ASSUMPTIONS:
+ * NA
+ *
+ *NOTE:
+ * NA
+ *
+ * @param  pMac      Pointer to Global MAC structure
+ * @return Channel number
+ */
+tANI_U8 limGetCurrentCBSecChannel( tpAniSirGlobal pMac,tpPESession psessionEntry)
+{
+tANI_U8 chanNum;
+
+  //
+  // FIXME - This is a HACK!!
+  // Need to have a clean way of determining the current
+  // CB secondary channel!!
+  //
+  chanNum = psessionEntry->currentOperChannel;
+  if( GET_CB_OPER_STATE( pMac->lim.gCbState ))
+  {
+    if( GET_CB_SEC_CHANNEL( pMac->lim.gCbState ))
+      chanNum += 4;
+    else
+      chanNum -= 4;
+  }
+
+  limLog( pMac, LOG4,
+      FL("Returning CB Sec Channel %1d\n"),
+      chanNum );
+
+  return chanNum;
+}
+
+
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.h
index 274294b..17f2da2 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limPropExtsUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -63,11 +63,11 @@
 // Determine if a newly discovered BSS is TITAN-compatible
 void handleNonTitanBss( tpAniSirGlobal, tSirNeighborBssWdsInfo );
 #endif
+ePhyChanBondState limGetPhyCBState( tpAniSirGlobal );
 tStaRateMode limGetStaPeerType( tpAniSirGlobal, tpDphHashNode ,tpPESession);
-#ifdef WLAN_FEATURE_11AC
-ePhyChanBondState  limGetHTCBState(ePhyChanBondState aniCBMode) ;
-#endif
+void setupCBState( tpAniSirGlobal, tAniCBSecondaryMode );
 
+tANI_U8 limGetCurrentCBSecChannel( tpAniSirGlobal,tpPESession );
 
 #endif /* __LIM_PROP_EXTS_UTILS_H */
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limRoamingAlgo.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limRoamingAlgo.c
index 94b7d7f..a77140a 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limRoamingAlgo.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limRoamingAlgo.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limScanResultUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limScanResultUtils.c
index b73977e..2af11d5 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limScanResultUtils.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limScanResultUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -75,7 +75,7 @@
             */
         
         limDeactivateAndChangeTimer(pMac,eLIM_MIN_CHANNEL_TIMER);
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_MAX_CHANNEL_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_MAX_CHANNEL_TIMER));
         if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer)
                                           == TX_TIMER_ERROR)
         {
@@ -196,6 +196,33 @@
    }
 
     pBssDescr->channelIdSelf = rxChannel;
+    pBssDescr->titanHtCaps = 0;
+
+    //FIXME_CBMODE : need to seperate out TITAN and HT CB mode.
+    //HT neighbor with channel bonding
+    if( pBPR->HTCaps.present  )
+    {
+        tAniTitanHtCapabilityInfo titanHtCaps = 0;
+        limGetHtCbAdminState(pMac, pBPR->HTCaps, &titanHtCaps);
+        if( pBPR->HTInfo.present &&
+          pBPR->HTInfo.secondaryChannelOffset )
+        {
+
+            limGetHtCbOpState( pMac,
+                pBPR->HTInfo,
+                &titanHtCaps );
+        }
+        pBssDescr->titanHtCaps = (tANI_U32) titanHtCaps;
+    }
+
+    // Is this is a TITAN neighbor?
+    else if( pBPR->propIEinfo.aniIndicator &&
+        pBPR->propIEinfo.titanPresent )
+    {
+    tAniTitanHtCapabilityInfo titanHtCaps = 0;
+      pBssDescr->titanHtCaps = (tANI_U32) titanHtCaps;
+    }
+
     //set the network type in bss description
     channelNum = pBssDescr->channelId;
     pBssDescr->nwType = limGetNwType(pMac, channelNum, SIR_MAC_MGMT_FRAME, pBPR);
@@ -341,7 +368,6 @@
     tANI_U32              frameLen, ieLen = 0;
     tANI_U8               rxChannelInBeacon = 0;
     eHalStatus            status;
-    tANI_U8               dontUpdateAll = 0;
 
 #ifdef WLAN_FEATURE_P2P
     tSirMacAddr bssid = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
@@ -417,23 +443,10 @@
           /* This means that we are in 2.4GHz mode */
           if(WDA_GET_RX_CH(pRxPacketInfo) != rxChannelInBeacon)
           {
-             /* BCAST Frame, if CH do not match, Drop */
-             if(WDA_IS_RX_BCAST(pRxPacketInfo))
-             {
-                limLog(pMac, LOG3, FL("Beacon/Probe Rsp dropped. Channel in BD %d. "
-                                      "Channel in beacon" " %d\n"), 
-                       WDA_GET_RX_CH(pRxPacketInfo),limGetChannelFromBeacon(pMac, pBPR));
-                return;
-             }
-             /* Unit cast frame, Probe RSP, do not drop */
-             else
-             {
-                dontUpdateAll = 1;
-                limLog(pMac, LOG3, FL("SSID %s, CH in ProbeRsp %d, CH in BD %d, miss-match, Do Not Drop"), 
-                                       pBPR->ssId.ssId,
-                                       rxChannelInBeacon,
-                                       limGetChannelFromBeacon(pMac, pBPR));
-             }
+             limLog(pMac, LOG3, FL("Beacon/Probe Rsp dropped. Channel in BD %d. "
+                                   "Channel in beacon" " %d\n"), 
+                    WDA_GET_RX_CH(pRxPacketInfo),limGetChannelFromBeacon(pMac, pBPR));
+             return;
           }
        }
     }
@@ -477,11 +490,11 @@
     //If it is not scanning, only save unique results
     if (pMac->lim.gLimReturnUniqueResults || (!fScanning))
     {
-        status = limLookupNaddHashEntry(pMac, pBssDescr, LIM_HASH_UPDATE, dontUpdateAll);
+        status = limLookupNaddHashEntry(pMac, pBssDescr, LIM_HASH_UPDATE);
     }
     else
     {
-        status = limLookupNaddHashEntry(pMac, pBssDescr, LIM_HASH_ADD, dontUpdateAll);
+        status = limLookupNaddHashEntry(pMac, pBssDescr, LIM_HASH_ADD);
     }
 
     if(fScanning)
@@ -634,8 +647,7 @@
 
 eHalStatus
 limLookupNaddHashEntry(tpAniSirGlobal pMac,
-                       tLimScanResultNode *pBssDescr, tANI_U8 action,
-                       tANI_U8 dontUpdateAll)
+                       tLimScanResultNode *pBssDescr, tANI_U8 action)
 {
     tANI_U8                  index, ssidLen = 0;
     tANI_U8                found = false;
@@ -643,7 +655,6 @@
     tSirMacCapabilityInfo *pSirCap, *pSirCapTemp;
     int idx, len;
     tANI_U8 *pbIe;
-    tANI_S8  rssi = 0;
 
     index = limScanHashFunction(pBssDescr->bssDescription.bssId);
     ptemp = pMac->lim.gLimCachedScanHashTable[index];
@@ -660,8 +671,6 @@
             (palEqualMemory( pMac->hHdd,(tANI_U8 *) pBssDescr->bssDescription.bssId,
                       (tANI_U8 *) ptemp->bssDescription.bssId,
                       sizeof(tSirMacAddr))) &&   //matching BSSID
-            (pBssDescr->bssDescription.channelId ==
-                                      ptemp->bssDescription.channelId) &&
             palEqualMemory( pMac->hHdd,((tANI_U8 *) &pBssDescr->bssDescription.ieFields + 1),
                            ((tANI_U8 *) &ptemp->bssDescription.ieFields + 1),
                            (tANI_U8) (ssidLen + 1)) &&
@@ -676,11 +685,6 @@
             // Found the same BSS description
             if (action == LIM_HASH_UPDATE)
             {
-                if(dontUpdateAll)
-                {
-                   rssi = ptemp->bssDescription.rssi;
-                }
-
                 if(pBssDescr->bssDescription.fProbeRsp != ptemp->bssDescription.fProbeRsp)
                 {
                     //We get a different, save the old frame WSC IE if it is there
@@ -734,12 +738,6 @@
         }
     }
 
-    //for now, only rssi, we can add more if needed
-    if ((action == LIM_HASH_UPDATE) && dontUpdateAll)
-    {
-        pBssDescr->bssDescription.rssi = rssi;
-    }
-
     // Add this BSS description at same index
     if (pprev == pMac->lim.gLimCachedScanHashTable[index])
     {
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limScanResultUtils.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limScanResultUtils.h
index 5dc2171..0913ea6 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limScanResultUtils.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limScanResultUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,7 +39,7 @@
 tANI_U8 limScanHashFunction(tSirMacAddr);
 void    limInitHashTable(tpAniSirGlobal);
 eHalStatus    
-   limLookupNaddHashEntry(tpAniSirGlobal, tLimScanResultNode *, tANI_U8, tANI_U8);
+   limLookupNaddHashEntry(tpAniSirGlobal, tLimScanResultNode *, tANI_U8);
 void    limDeleteHashEntry(tLimScanResultNode *);
 void    limDeleteCachedScanResults(tpAniSirGlobal);
 void    limRestorePreScanState(tpAniSirGlobal);
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSecurityUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSecurityUtils.c
index 994fcf2..d1c774f 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSecurityUtils.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSecurityUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -375,7 +375,7 @@
 limReleasePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthNode pAuthNode)
 {
     pAuthNode->fFree = 1;
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_PRE_AUTH_CLEANUP_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_PRE_AUTH_CLEANUP_TIMER));
     tx_timer_deactivate(&pAuthNode->timer);                
     pMac->lim.gLimNumPreAuthContexts--;
 } /*** end limReleasePreAuthNode() ***/
@@ -642,7 +642,7 @@
 
     sessionEntry->limMlmState = sessionEntry->limPrevMlmState;
     
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, sessionEntry->peSessionId, sessionEntry->limMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
 
     // 'Change' timer for future activations
@@ -1000,7 +1000,6 @@
  * A utility API to send MLM_REMOVEKEY_CNF to SME
  */
 void limPostSmeRemoveKeyCnf( tpAniSirGlobal pMac,
-    tpPESession psessionEntry,
     tLimMlmRemoveKeyReq *pMlmRemoveKeyReq,
     tLimMlmRemoveKeyCnf *mlmRemoveKeyCnf)
 {
@@ -1013,8 +1012,8 @@
   palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmRemoveKeyReq );
   pMac->lim.gpLimMlmRemoveKeyReq = NULL;
 
-  psessionEntry->limMlmState = psessionEntry->limPrevMlmState; //Restore the state.
-  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+  pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState; //Restore the state.
+  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
   limPostSmeMessage( pMac,
       LIM_MLM_REMOVEKEY_CNF,
@@ -1082,7 +1081,7 @@
   // Update the WDA_SET_BSSKEY_REQ parameters
   pSetBssKeyParams->bssIdx = psessionEntry->bssIdx;
   pSetBssKeyParams->encType = pMlmSetKeysReq->edType;
-
+  pSetBssKeyParams->numKeys = pMlmSetKeysReq->numKeys;
 
   if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
   {
@@ -1094,27 +1093,10 @@
   /* Update PE session Id*/
   pSetBssKeyParams->sessionId = psessionEntry ->peSessionId;
 
-  if(pMlmSetKeysReq->key[0].keyId && 
-     ((pMlmSetKeysReq->edType == eSIR_ED_WEP40) || 
-      (pMlmSetKeysReq->edType == eSIR_ED_WEP104))
-    )
-  {
-    /* IF the key id is non-zero and encryption type is WEP, Send all the 4 
-     * keys to HAL with filling the key at right index in pSetBssKeyParams->key. */
-    pSetBssKeyParams->numKeys = SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
-    palCopyMemory( pMac->hHdd,
-      (tANI_U8 *) &pSetBssKeyParams->key[pMlmSetKeysReq->key[0].keyId],
-      (tANI_U8 *) &pMlmSetKeysReq->key[0], sizeof(pMlmSetKeysReq->key[0]));
-
-  }
-  else
-  {
-    pSetBssKeyParams->numKeys = pMlmSetKeysReq->numKeys;
-    palCopyMemory( pMac->hHdd,
+  palCopyMemory( pMac->hHdd,
       (tANI_U8 *) &pSetBssKeyParams->key,
       (tANI_U8 *) &pMlmSetKeysReq->key,
       sizeof( tSirKeys ) * pMlmSetKeysReq->numKeys );
-  }
 
   SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
   msgQ.type = WDA_SET_BSSKEY_REQ;
@@ -1129,7 +1111,7 @@
 
   limLog( pMac, LOGW,
       FL( "Sending WDA_SET_BSSKEY_REQ...\n" ));
-  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
   {
     limLog( pMac, LOGE,
@@ -1226,7 +1208,7 @@
       sessionEntry->limMlmState = eLIM_MLM_WT_SET_STA_KEY_STATE;
       msgQ.type = WDA_SET_STAKEY_REQ;
   }
-  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, sessionEntry->peSessionId, sessionEntry->limMlmState));
+  MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
   /**
    * In the Case of WEP_DYNAMIC, ED_TKIP and ED_CCMP
@@ -1250,14 +1232,12 @@
 #endif
           pSetStaKeyParams->wepType = eSIR_WEP_STATIC;
           sessionEntry->limMlmState = eLIM_MLM_WT_SET_STA_KEY_STATE;
-          MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, sessionEntry->peSessionId, sessionEntry->limMlmState));
+          MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
       }else {
-          /*This case the keys are coming from upper layer so need to fill the 
-          * key at the default wep key index and send to the HAL */
+          pSetStaKeyParams->wepType = eSIR_WEP_DYNAMIC;
           palCopyMemory( pMac->hHdd,
-                             (tANI_U8 *) &pSetStaKeyParams->key[defWEPIdx],
-                             (tANI_U8 *) &pMlmSetKeysReq->key[0], sizeof( pMlmSetKeysReq->key[0] ));
-          pMlmSetKeysReq->numKeys = SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
+                         (tANI_U8 *) &pSetStaKeyParams->key,
+                         (tANI_U8 *) &pMlmSetKeysReq->key[0], sizeof( tSirKeys ));
       }
       break;
   case eSIR_ED_TKIP:
@@ -1285,7 +1265,7 @@
   msgQ.bodyval = 0;
 
   limLog( pMac, LOG1, FL( "Sending WDA_SET_STAKEY_REQ...\n" ));
-  MTRACE(macTraceMsgTx(pMac, sessionEntry->peSessionId, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) {
       limLog( pMac, LOGE, FL("Posting SET_STAKEY to HAL failed, reason=%X\n"), retCode );
       // Respond to SME with LIM_MLM_SETKEYS_CNF
@@ -1365,7 +1345,7 @@
 
   limLog( pMac, LOGW,
       FL( "Sending WDA_REMOVE_BSSKEY_REQ...\n" ));
-  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
   {
@@ -1381,7 +1361,6 @@
 
 end:
   limPostSmeRemoveKeyCnf( pMac,
-      psessionEntry,
       pMlmRemoveKeyReq,
       &mlmRemoveKeysCnf );
 
@@ -1411,7 +1390,7 @@
 void limSendRemoveStaKeyReq( tpAniSirGlobal pMac,
     tLimMlmRemoveKeyReq *pMlmRemoveKeyReq,
     tANI_U16 staIdx ,
-    tpPESession psessionEntry)
+    tpPESession sessionEntry)
 {
 tSirMsgQ           msgQ;
 tpRemoveStaKeyParams  pRemoveStaKeyParams = NULL;
@@ -1451,7 +1430,7 @@
   pRemoveStaKeyParams->unicast = pMlmRemoveKeyReq->unicast;
 
   /* Update PE session ID*/
-  pRemoveStaKeyParams->sessionId = psessionEntry->peSessionId;
+  pRemoveStaKeyParams->sessionId = sessionEntry->peSessionId;
 
   SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
   
@@ -1467,7 +1446,7 @@
 
   limLog( pMac, LOGW,
       FL( "Sending WDA_REMOVE_STAKEY_REQ...\n" ));
-  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
   {
     limLog( pMac, LOGE,
@@ -1482,7 +1461,6 @@
 
 end:
   limPostSmeRemoveKeyCnf( pMac,
-      psessionEntry,
       pMlmRemoveKeyReq,
       &mlmRemoveKeyCnf );
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSecurityUtils.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSecurityUtils.h
index d7a4238..2479f14 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSecurityUtils.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSecurityUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -68,7 +68,7 @@
 
 void limSendRemoveBssKeyReq(tpAniSirGlobal pMac, tLimMlmRemoveKeyReq * pMlmRemoveKeyReq,tpPESession);
 void limSendRemoveStaKeyReq(tpAniSirGlobal pMac, tLimMlmRemoveKeyReq * pMlmRemoveKeyReq, tANI_U16 staIdx,tpPESession);
-void limPostSmeRemoveKeyCnf(tpAniSirGlobal pMac, tpPESession psessionEntry, tLimMlmRemoveKeyReq * pMlmRemoveKeyReq, tLimMlmRemoveKeyCnf * mlmRemoveKeyCnf);
+void limPostSmeRemoveKeyCnf(tpAniSirGlobal pMac, tLimMlmRemoveKeyReq * pMlmRemoveKeyReq, tLimMlmRemoveKeyCnf * mlmRemoveKeyCnf);
 
 #define  PTAPS  0xedb88320
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendManagementFrames.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendManagementFrames.c
index 907ad62..dfe0ac0 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendManagementFrames.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendManagementFrames.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -240,16 +240,7 @@
     {
         p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen);
     }
-    /* Don't include 11b rate only when device is doing P2P Search */
-    if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) && 
-        ( p2pIe != NULL ) && 
-    /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */
-        ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) &&
-              pMac->lim.gpLimMlmScanReq->p2pSearch ) || 
-          ( ( psessionEntry != NULL ) && 
-            ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) )
-         )
-      )
+    if( p2pIe != NULL)
     {
         /* In the below API pass channel number > 14, do that it fills only
          * 11a rates in supported rates */
@@ -281,36 +272,21 @@
        PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 );
     }
 #endif
+    pMac->lim.htCapability = IS_DOT11_MODE_HT(dot11mode);
 
     if (psessionEntry != NULL ) {
-       psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode);
+       psessionEntry->htCapabality = IS_DOT11_MODE_HT(dot11mode);
        //Include HT Capability IE
-       if (psessionEntry->htCapability)
+       if (psessionEntry->htCapabality)
        {
-           PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps );
+           PopulateDot11fHTCaps( pMac, &pr.HTCaps );
        }
-    } else { //psessionEntry == NULL
-           if (IS_DOT11_MODE_HT(dot11mode))
+    } else {
+           if (pMac->lim.htCapability)
            {
-               PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps );
+               PopulateDot11fHTCaps( pMac, &pr.HTCaps );
            }
     }
-#ifdef WLAN_FEATURE_11AC
-    if (psessionEntry != NULL ) {
-       psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode);
-       //Include HT Capability IE
-       if (psessionEntry->vhtCapability)
-       {
-          PopulateDot11fVHTCaps( pMac, &pr.VHTCaps );
-       }
-    }  else {
-       if (IS_DOT11_MODE_VHT(dot11mode))
-       {
-          PopulateDot11fVHTCaps( pMac, &pr.VHTCaps );
-       }
-    }
-#endif
-
 
     // That's it-- now we pack it.  First, how much space are we going to
     // need?
@@ -481,7 +457,7 @@
                          tpPESession psessionEntry,
                          tANI_U8        probeReqP2pIe)
 {
-    tDot11fProbeResponse *pFrm;
+    tDot11fProbeResponse frm;
     tSirRetStatus        nSirStatus;
     tANI_U32             cfg, nPayload, nBytes, nStatus;
     tpSirMacMgmtHdr      pMacHdr;
@@ -515,16 +491,9 @@
         return;
     }
     
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pFrm, sizeof(tDot11fProbeResponse)))
-    {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limSendProbeRspMgmtFrame\n") );
-        return;
-    }
-
     // Fill out 'frm', after which we'll just hand the struct off to
     // 'dot11fPackProbeResponse'.
-    palZeroMemory( pMac->hHdd, ( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
 
     // Timestamp to be updated by TFP, below.
 
@@ -532,29 +501,29 @@
 #ifdef WLAN_SOFTAP_FEATURE
     if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
     {
-        pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval;        
+        frm.BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval;        
     }
     else
     {
 #endif
     CFG_LIM_GET_INT_NO_STATUS( nSirStatus, pMac,
                                WNI_CFG_BEACON_INTERVAL, cfg );
-    pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg;
+    frm.BeaconInterval.interval = ( tANI_U16 ) cfg;
 #ifdef WLAN_SOFTAP_FEATURE
     }
 #endif
 
 
-    PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry );
-    PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID );
+    PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry );
+    PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &frm.SSID );
     PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
-                             &pFrm->SuppRates,psessionEntry);
+                             &frm.SuppRates,psessionEntry);
 
-    PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry);
-    PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry );
+    PopulateDot11fDSParams( pMac, &frm.DSParams, psessionEntry->currentOperChannel, psessionEntry);
+    PopulateDot11fIBSSParams( pMac, &frm.IBSSParams, psessionEntry );
 
 #ifdef ANI_PRODUCT_TYPE_AP
-    PopulateDot11fCFParams( pMac, &pFrm->Capabilities, &pFrm->CFParams );
+    PopulateDot11fCFParams( pMac, &frm.Capabilities, &frm.CFParams );
 #endif // AP Image
 
 #ifdef WLAN_SOFTAP_FEATURE
@@ -562,7 +531,7 @@
     {
         if(psessionEntry->wps_state != SAP_WPS_DISABLED)
         {
-            PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry);
+            PopulateDot11fProbeResWPSIEs(pMac, &frm.WscProbeRes, psessionEntry);
         }
     }
     else
@@ -575,32 +544,32 @@
     
     if (wpsApEnable)
     {
-        PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes);
+        PopulateDot11fWscInProbeRes(pMac, &frm.WscProbeRes);
     }
 
     if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN)
     {
-        PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes);
+        PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &frm.WscProbeRes);
         pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS;
     }
 
     if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END)
     {
-        DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes);
+        DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &frm.WscProbeRes);
         pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP;
     }
 #ifdef WLAN_SOFTAP_FEATURE
     }
 #endif
 
-    PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry);
-    PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry);
+    PopulateDot11fCountry( pMac, &frm.Country, psessionEntry);
+    PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry);
 
 #ifdef ANI_PRODUCT_TYPE_AP
-    if( pSessionEntry->lim11hEnable )
+    if( pMac->lim.gLim11hEnable )
     {
-        PopulateDot11fPowerConstraints( pMac, &pFrm->PowerConstraints );
-        PopulateDot11fTPCReport( pMac, &pFrm->TPCReport, psessionEntry);
+        PopulateDot11fPowerConstraints( pMac, &frm.PowerConstraints );
+        PopulateDot11fTPCReport( pMac, &frm.TPCReport, psessionEntry);
 
         // If .11h isenabled & channel switching is not already started and
         // we're in either PRIMARY_ONLY or PRIMARY_AND_SECONDARY state, then
@@ -611,63 +580,53 @@
                pMac->lim.gLimChannelSwitch.state ==
                eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY ) )
         {
-            PopulateDot11fChanSwitchAnn( pMac, &pFrm->ChanSwitchAnn, psessionEntry );
-            PopulateDot11fExtChanSwitchAnn(pMac, &pFrm->ExtChanSwitchAnn, psessionEntry );
+            PopulateDot11fChanSwitchAnn( pMac, &frm.ChanSwitchAnn );
+            PopulateDot11fExtChanSwitchAnn(pMac, &frm.ExtChanSwitchAnn);
         }
     }
 #endif
 
     if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B)
-        PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry);
+        PopulateDot11fERPInfo( pMac, &frm.ERPInfo, psessionEntry);
 
 
     // N.B. In earlier implementations, the RSN IE would be placed in
     // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined.
     PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
-                                &pFrm->ExtSuppRates, psessionEntry );
+                                &frm.ExtSuppRates, psessionEntry );
 
     //Populate HT IEs, when operating in 11n or Taurus modes.
-    if ( psessionEntry->htCapability )
+    if ( psessionEntry->htCapabality )
     {
-        PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
+        PopulateDot11fHTCaps( pMac, &frm.HTCaps );
 #ifdef WLAN_SOFTAP_FEATURE
-        PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry );
+        PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry );
 #else
-        PopulateDot11fHTInfo( pMac, &pFrm->HTInfo );
+        PopulateDot11fHTInfo( pMac, &frm.HTInfo );
 #endif
     }
-#ifdef WLAN_FEATURE_11AC
-    if(psessionEntry->vhtCapability)
-    {
-        limLog( pMac, LOGW, FL("Populate VHT IE in Probe Response\n"));
-        PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps );
-        PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation );
-        // we do not support multi users yet
-        //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad );
-    }
-#endif
 
     if ( psessionEntry->pLimStartBssReq ) 
     {
       PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
-          &pFrm->WPA );
+          &frm.WPA );
       PopulateDot11fRSN( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
-          &pFrm->RSN );
+          &frm.RSN );
     }
 
-    PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry );
+    PopulateDot11fWMM( pMac, &frm.WMMInfoAp, &frm.WMMParams, &frm.WMMCaps, psessionEntry );
 
 #if defined(FEATURE_WLAN_WAPI)
     if( psessionEntry->pLimStartBssReq ) 
     {
       PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
-          &pFrm->WAPI );
+          &frm.WAPI );
     }
 
 #endif // defined(FEATURE_WLAN_WAPI)
 
 
-    nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload );
+    nStatus = dot11fGetPackedProbeResponseSize( pMac, &frm, &nPayload );
     if ( DOT11F_FAILED( nStatus ) )
     {
         limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
@@ -702,7 +661,6 @@
                            &addnIEPresent) != eSIR_SUCCESS)
         {
             limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_FLAG"));
-            palFreeMemory(pMac->hHdd, pFrm);
             return;
         }
     }
@@ -714,7 +672,6 @@
         {
             PELOGE(limLog(pMac, LOGE,
                  FL("Unable to allocate memory to store addn IE"));)
-            palFreeMemory(pMac->hHdd, pFrm);
             return;
         }
         
@@ -724,7 +681,6 @@
         {
             limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 length"));
             palFreeMemory(pMac->hHdd, addIE);
-            palFreeMemory(pMac->hHdd, pFrm);
             return;
         }
         if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len &&
@@ -737,7 +693,6 @@
                 limLog(pMac, LOGP,
                      FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String"));
                 palFreeMemory(pMac->hHdd, addIE);
-                palFreeMemory(pMac->hHdd, pFrm);
                 return;
             }
         }
@@ -748,7 +703,6 @@
         {
             limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 length"));
             palFreeMemory(pMac->hHdd, addIE);
-            palFreeMemory(pMac->hHdd, pFrm);
             return;
         }
         if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len &&
@@ -761,7 +715,6 @@
                 limLog(pMac, LOGP,
                      FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String"));
                 palFreeMemory(pMac->hHdd, addIE);
-                palFreeMemory(pMac->hHdd, pFrm);
                 return;
             }
         }
@@ -772,7 +725,6 @@
         {
             limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 length"));
             palFreeMemory(pMac->hHdd, addIE);
-            palFreeMemory(pMac->hHdd, pFrm);
             return;
         }
         if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len &&
@@ -786,7 +738,6 @@
                 limLog(pMac, LOGP,
                      FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String"));
                 palFreeMemory(pMac->hHdd, addIE);
-                palFreeMemory(pMac->hHdd, pFrm);
                 return;
             }
         }
@@ -798,7 +749,6 @@
             limLog(pMac, LOGP,
                  FL("Unable to get final Additional IE for Probe Req"));
             palFreeMemory(pMac->hHdd, addIE);
-                palFreeMemory(pMac->hHdd, pFrm);
             return;
         }
         nBytes = nBytes + totalAddnIeLen;
@@ -832,7 +782,6 @@
         {
             palFreeMemory(pMac->hHdd, addIE);
         }
-        palFreeMemory(pMac->hHdd, pFrm);
         return;
     }
 
@@ -853,7 +802,6 @@
         {
             palFreeMemory(pMac->hHdd, addIE);
         }
-        palFreeMemory(pMac->hHdd, pFrm);
         return;
     }
 
@@ -862,7 +810,7 @@
     sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
 
     // That done, pack the Probe Response:
-    nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr),
+    nStatus = dot11fPackProbeResponse( pMac, &frm, pFrame + sizeof(tSirMacMgmtHdr),
                                        nPayload, &nPayload );
     if ( DOT11F_FAILED( nStatus ) )
     {
@@ -873,7 +821,6 @@
         {
             palFreeMemory(pMac->hHdd, addIE);
         }
-        palFreeMemory(pMac->hHdd, pFrm);
         return;                 // allocated!
     }
     else if ( DOT11F_WARNED( nStatus ) )
@@ -907,7 +854,6 @@
             {
                 palFreeMemory(pMac->hHdd, addIE);
             }
-            palFreeMemory(pMac->hHdd, pFrm);
             return;
         }
     }
@@ -951,10 +897,6 @@
         palFreeMemory(pMac->hHdd, addIE);
     }
 
-    palFreeMemory(pMac->hHdd, pFrm);
-    return;
-
-
 } // End limSendProbeRspMgmtFrame.
 
 void
@@ -1310,10 +1252,10 @@
         } // End if on Airgo peer.
 
         if ( pSta->mlmStaContext.htCapability  && 
-             psessionEntry->htCapability )
+             pMac->lim.htCapability )
         {
-            PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
-            PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry);
+            PopulateDot11fHTCaps( pMac, &frm.HTCaps );
+            PopulateDot11fHTInfo( pMac, &frm.HTInfo );
         }
     } // End if on non-NULL 'pSta'.
 
@@ -1582,26 +1524,15 @@
         } // End if on Airgo peer.
 
         if ( pSta->mlmStaContext.htCapability  && 
-             psessionEntry->htCapability )
+             psessionEntry->htCapabality )
         {
-            PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
+            PopulateDot11fHTCaps( pMac, &frm.HTCaps );
 #ifdef WLAN_SOFTAP_FEATURE
             PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry );
 #else
             PopulateDot11fHTInfo( pMac, &frm.HTInfo );
 #endif
         }
-
-#ifdef WLAN_FEATURE_11AC
-        if( pSta->mlmStaContext.vhtCapability && 
-            psessionEntry->vhtCapability )
-        {
-            limLog( pMac, LOGW, FL("Populate VHT IEs in Assoc Response\n"));
-            PopulateDot11fVHTCaps( pMac, &frm.VHTCaps );
-            PopulateDot11fVHTOperation( pMac, &frm.VHTOperation);
-        }
-#endif
-
     } // End if on non-NULL 'pSta'.
 
 
@@ -2250,7 +2181,7 @@
                          tLimMlmAssocReq *pMlmAssocReq,
                          tpPESession psessionEntry)
 {
-    tDot11fAssocRequest *pFrm;
+    tDot11fAssocRequest frm;
     tANI_U16            caps;
     tANI_U8            *pFrame;
     tSirRetStatus       nSirStatus;
@@ -2285,15 +2216,7 @@
     nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length; 
     pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata;
 
-    if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, 
-                                                (void **)&pFrm, sizeof(tDot11fAssocRequest)))
-    {
-        limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limSendAssocReqMgmtFrame\n") );
-        return;
-    }
-
-
-    palZeroMemory( pMac->hHdd, ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
 
     caps = pMlmAssocReq->capabilityInfo;
     if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) )
@@ -2308,12 +2231,12 @@
     if ( psessionEntry->encryptType == eSIR_ED_WPI)
         ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
 #endif
-    swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities );
+    swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
 
-    pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval;
-    PopulateDot11fSSID2( pMac, &pFrm->SSID );
+    frm.ListenInterval.interval = pMlmAssocReq->listenInterval;
+    PopulateDot11fSSID2( pMac, &frm.SSID );
     PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
-            &pFrm->SuppRates,psessionEntry);
+            &frm.SuppRates,psessionEntry);
 
     fQosEnabled = ( psessionEntry->limQosEnabled) &&
         SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps );
@@ -2333,9 +2256,9 @@
 #if defined WLAN_FEATURE_VOWIFI
         PowerCapsPopulated = TRUE;
 
-        PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry);
+        PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_ASSOC,psessionEntry);
 #endif
-        PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry);
+        PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_ASSOC,psessionEntry);
 
     }
 
@@ -2346,23 +2269,23 @@
         if (PowerCapsPopulated == FALSE) 
         {
             PowerCapsPopulated = TRUE;
-            PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry);
+            PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_ASSOC, psessionEntry);
         }
     }
 #endif
 
     if ( fQosEnabled &&
             ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap)))
-        PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation );
+        PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
 
     PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
-            &pFrm->ExtSuppRates, psessionEntry );
+            &frm.ExtSuppRates, psessionEntry );
 
 #if defined WLAN_FEATURE_VOWIFI
     if( pMac->rrm.rrmPEContext.rrmEnable &&
             SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
     {
-        PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry );       
+        PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );       
     }
 #endif
     // The join request *should* contain zero or one of the WPA and RSN
@@ -2392,12 +2315,12 @@
     if ( NULL == wpsIe )
     {
         PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
-                &pFrm->RSNOpaque );
+                &frm.RSNOpaque );
         PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
-                &pFrm->WPAOpaque );
+                &frm.WPAOpaque );
 #if defined(FEATURE_WLAN_WAPI)
         PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
-                &pFrm->WAPIOpaque );
+                &frm.WAPIOpaque );
 #endif // defined(FEATURE_WLAN_WAPI)
     }
 
@@ -2406,22 +2329,22 @@
     {
         if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) )
         {
-            PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation );
+            PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
         }
 
         if ( fWsmEnabled &&
                 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap )))
         {
-            PopulateDot11fWMMCaps( &pFrm->WMMCaps );
+            PopulateDot11fWMMCaps( &frm.WMMCaps );
         }
     }
 
     //Populate HT IEs, when operating in 11n or Taurus modes AND
     //when AP is also operating in 11n mode.
-    if ( psessionEntry->htCapability &&
+    if ( psessionEntry->htCapabality &&
             pMac->lim.htCapabilityPresentInBeacon)
     {
-        PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
+        PopulateDot11fHTCaps( pMac, &frm.HTCaps );
 #ifdef DISABLE_GF_FOR_INTEROP
 
         /*
@@ -2434,36 +2357,27 @@
         if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
         {
                 limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP, Turning off Greenfield"));
-            pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
+            frm.HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
         }
 #endif
 
     }
-#ifdef WLAN_FEATURE_11AC
-    if ( psessionEntry->vhtCapability &&
-        pMac->lim.vhtCapabilityPresentInBeacon)
-    {
-        limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request"));
-        PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps );
-    }
-#endif
-
 
 #if defined WLAN_FEATURE_VOWIFI_11R
     if (psessionEntry->pLimJoinReq->is11Rconnection)
     {
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
-        limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"), 
+        limLog( pMac, LOGE, FL("mdie = %02x %02x %02x\n"), 
                 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0],
                 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1],
                 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]);
 #endif
-        PopulateMDIE( pMac, &pFrm->MobilityDomain, psessionEntry->pLimJoinReq->bssDescription.mdie); 
+        PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimJoinReq->bssDescription.mdie); 
     }
     else 
     {
         // No 11r IEs dont send any MDIE
-        limLog( pMac, LOG1, FL("mdie not present")); 
+        limLog( pMac, LOGE, FL("mdie not present\n")); 
     }
 #endif
 
@@ -2471,12 +2385,12 @@
     // For CCX Associations fill the CCX IEs
     if (psessionEntry->isCCXconnection)
     {
-        PopulateDot11fCCXRadMgmtCap(&pFrm->CCXRadMgmtCap);
-        PopulateDot11fCCXVersion(&pFrm->CCXVersion);
+        PopulateDot11fCCXRadMgmtCap(&frm.CCXRadMgmtCap);
+        PopulateDot11fCCXVersion(&frm.CCXVersion);
     }
 #endif
 
-    nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload );
+    nStatus = dot11fGetPackedAssocRequestSize( pMac, &frm, &nPayload );
     if ( DOT11F_FAILED( nStatus ) )
     {
         limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
@@ -2503,7 +2417,7 @@
                     "sociation Request.\n"), nBytes );
 
         psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
 
         /* Update PE session id*/
@@ -2517,7 +2431,6 @@
         limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF,
                 ( tANI_U32* ) &mlmAssocCnf);
 
-        palFreeMemory(pMac->hHdd, pFrm);
         return;
     }
 
@@ -2533,13 +2446,12 @@
                     "tor for an Association Request (%d).\n"),
                 nSirStatus );
         palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
-        palFreeMemory(pMac->hHdd, pFrm);
         return;
     }
 
 
     // That done, pack the Probe Request:
-    nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame +
+    nStatus = dot11fPackAssocRequest( pMac, &frm, pFrame +
             sizeof(tSirMacMgmtHdr),
             nPayload, &nPayload );
     if ( DOT11F_FAILED( nStatus ) )
@@ -2549,7 +2461,6 @@
                 nStatus );
         palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
                 ( void* ) pFrame, ( void* ) pPacket );
-        palFreeMemory(pMac->hHdd, pFrm);
         return;
     }
     else if ( DOT11F_WARNED( nStatus ) )
@@ -2609,18 +2520,17 @@
         limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!\n"),
                 halstatus );
         //Pkt will be freed up by the callback
-        palFreeMemory(pMac->hHdd, pFrm);
         return;
     }
 
     // Free up buffer allocated for mlmAssocReq
     palFreeMemory( pMac->hHdd, ( tANI_U8* ) pMlmAssocReq );
-    palFreeMemory(pMac->hHdd, pFrm);
-    return;
+
 } // End limSendAssocReqMgmtFrame
 
 
-#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
 /*------------------------------------------------------------------------------------
  *
  * Send Reassoc Req with FTIEs.
@@ -2646,7 +2556,7 @@
     tANI_U8               *pBody;
     tANI_U16              nAddIELen; 
     tANI_U8               *pAddIE;
-#if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#ifdef FEATURE_WLAN_CCX
     tANI_U8               *wpsIe = NULL;
 #endif
     tANI_U8               txFlag = 0;
@@ -2757,7 +2667,7 @@
     // for rsnie and fties. Instead we just add
     // the rsnie and fties at the end of the pack routine for 11r.
     // This should ideally! be fixed.
-#if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#ifdef FEATURE_WLAN_CCX
     //
     // The join request *should* contain zero or one of the WPA and RSN
     // IEs.  The payload send along with the request is a
@@ -2793,24 +2703,20 @@
                     &frm.WPAOpaque );
         }
 
-#ifdef FEATURE_WLAN_CCX
         if(psessionEntry->pLimReAssocReq->cckmIE.length)
         {
             PopulateDot11fCCXCckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ),
                     &frm.CCXCckmOpaque );
         }
-#endif //FEATURE_WLAN_CCX
     }
 
-#ifdef FEATURE_WLAN_CCX
     // For CCX Associations fill the CCX IEs
     if (psessionEntry->isCCXconnection)
     {
         PopulateDot11fCCXRadMgmtCap(&frm.CCXRadMgmtCap);
         PopulateDot11fCCXVersion(&frm.CCXVersion);
     }
-#endif //FEATURE_WLAN_CCX 
-#endif //FEATURE_WLAN_CCX || FEATURE_WLAN_LFR
+#endif
 
     // include WME EDCA IE as well
     if ( fWmeEnabled )
@@ -2852,10 +2758,10 @@
 #endif    
     }
 
-    if ( psessionEntry->htCapability &&
+    if ( psessionEntry->htCapabality &&
             pMac->lim.htCapabilityPresentInBeacon)
     {
-        PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
+        PopulateDot11fHTCaps( pMac, &frm.HTCaps );
     }
 
     nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
@@ -2894,7 +2800,7 @@
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
         limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
                     "sociation Request.\n"), nBytes );
         goto end;
@@ -2903,7 +2809,7 @@
     // Paranoia:
     palZeroMemory( pMac->hHdd, pFrame, nBytes + ft_ies_length);
 
-#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX
     limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
 #endif
     // Next, we fill out the buffer descriptor:
@@ -3180,19 +3086,11 @@
         }
     }
 
-    if ( psessionEntry->htCapability &&
+    if ( psessionEntry->htCapabality &&
           pMac->lim.htCapabilityPresentInBeacon)
     {
-        PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
+        PopulateDot11fHTCaps( pMac, &frm.HTCaps );
     }
-#ifdef WLAN_FEATURE_11AC
-    if ( psessionEntry->vhtCapability &&
-             pMac->lim.vhtCapabilityPresentInBeacon)
-    {
-        limLog( pMac, LOGW, FL("Populate VHT IEs in Re-Assoc Request\n"));
-        PopulateDot11fVHTCaps( pMac, &frm.VHTCaps );
-    }
-#endif
 
     nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
     if ( DOT11F_FAILED( nStatus ) )
@@ -3218,7 +3116,7 @@
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
-        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
+        MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
         limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
                                "sociation Request.\n"), nBytes );
         goto end;
@@ -3578,10 +3476,6 @@
        || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
          ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
 #endif
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
-       || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) 
-           && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)))
-#endif
          )
     {
         txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
@@ -4271,7 +4165,7 @@
 #endif  //ANI_SUPPORT_11H
 
 
-#if 1//def ANI_PRODUCT_TYPE_AP
+#ifdef ANI_PRODUCT_TYPE_AP
 /**
  * \brief Send a Channel Switch Announcement
  *
@@ -4294,19 +4188,17 @@
 tSirRetStatus
 limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac,
                               tSirMacAddr    peer,
-                              tANI_U8        nMode,
-                              tANI_U8        nNewChannel,
-                              tANI_U8        nCount,
-                              tpPESession    psessionEntry )
+                              tANI_U8             nMode,
+                              tANI_U8             nNewChannel,
+                              tANI_U8             nCount)
 {
     tDot11fChannelSwitch frm;
     tANI_U8                  *pFrame;
     tSirRetStatus        nSirStatus;
     tpSirMacMgmtHdr      pMacHdr;
-    tANI_U32                  nBytes, nPayload, nStatus;//, nCfg;
+    tANI_U32                  nBytes, nPayload, nStatus, nCfg;
     void               *pPacket;
     eHalStatus          halstatus;
-    tANI_U8 txFlag = 0;
     
     palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
 
@@ -4348,12 +4240,7 @@
 
     // Next, we fill out the buffer descriptor:
     nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
-                                SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
-    pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
-    palCopyMemory( pMac->hHdd,
-                   (tANI_U8 *) pMacHdr->bssId,
-                   (tANI_U8 *) psessionEntry->bssId,
-                   sizeof( tSirMacAddr ));
+                                SIR_MAC_MGMT_ACTION, peer);
     if ( eSIR_SUCCESS != nSirStatus )
     {
         limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
@@ -4363,7 +4250,6 @@
         return eSIR_FAILURE;    // just allocated...
     }
 
-#if 0
     pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
 
     nCfg = 6;
@@ -4376,7 +4262,7 @@
         palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
         return eSIR_FAILURE;    // just allocated...
     }
-#endif
+
     nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame +
                                        sizeof(tSirMacMgmtHdr),
                                        nPayload, &nPayload );
@@ -4393,20 +4279,11 @@
                                "hannel Switch (0x%08x).\n") );
     }
 
-    if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
-#ifdef WLAN_FEATURE_P2P
-       || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
-         ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
-#endif
-         )
-    {
-        txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
-    }
     halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
                             HAL_TXRX_FRM_802_11_MGMT,
                             ANI_TXDIR_TODS,
                             7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
-                            limTxComplete, pFrame, txFlag );
+                            limTxComplete, pFrame, 0 );
     if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
     {
         limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
@@ -5372,6 +5249,7 @@
                        )
 {
    tSirRetStatus statusCode = eSIR_SUCCESS;
+   tDot11fRadioMeasurementReport frm;
    tANI_U8                      *pFrame;
    tpSirMacMgmtHdr          pMacHdr;
    tANI_U32                      nBytes, nPayload, nStatus;
@@ -5380,47 +5258,39 @@
    tANI_U8             i;
    tANI_U8             txFlag = 0;
 
-   tDot11fRadioMeasurementReport *frm =
-         vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport));
-   if (!frm) {
-      limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport\n") );
-      return eSIR_FAILURE;
-   }
-
    if ( psessionEntry == NULL )
    {
       limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Beacon Report action frame\n") );
-      vos_mem_free(frm);
       return eSIR_FAILURE;
    }
-   palZeroMemory( pMac->hHdd, ( tANI_U8* )frm, sizeof( *frm ) );
+   palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
 
-   frm->Category.category = SIR_MAC_ACTION_RRM;
-   frm->Action.action     = SIR_MAC_RRM_RADIO_MEASURE_RPT;
-   frm->DialogToken.token = dialog_token;
+   frm.Category.category = SIR_MAC_ACTION_RRM;
+   frm.Action.action     = SIR_MAC_RRM_RADIO_MEASURE_RPT;
+   frm.DialogToken.token = dialog_token;
 
-   frm->num_MeasurementReport = (num_report > RADIO_REPORTS_MAX_IN_A_FRAME ) ? RADIO_REPORTS_MAX_IN_A_FRAME  : num_report;
+   frm.num_MeasurementReport = (num_report > RADIO_REPORTS_MAX_IN_A_FRAME ) ? RADIO_REPORTS_MAX_IN_A_FRAME  : num_report;
 
-   for( i = 0 ; i < frm->num_MeasurementReport ; i++ )
+   for( i = 0 ; i < frm.num_MeasurementReport ; i++ )
    {
-      frm->MeasurementReport[i].type = pRRMReport[i].type;
-      frm->MeasurementReport[i].token = pRRMReport[i].token;
-      frm->MeasurementReport[i].late = 0; //IEEE 802.11k section 7.3.22. (always zero in rrm)
+      frm.MeasurementReport[i].type = pRRMReport[i].type;
+      frm.MeasurementReport[i].token = pRRMReport[i].token;
+      frm.MeasurementReport[i].late = 0; //IEEE 802.11k section 7.3.22. (always zero in rrm)
       switch( pRRMReport[i].type )
       {
          case SIR_MAC_RRM_BEACON_TYPE:
-            PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport );
-            frm->MeasurementReport[i].incapable = pRRMReport[i].incapable;
-            frm->MeasurementReport[i].refused = pRRMReport[i].refused;
-            frm->MeasurementReport[i].present = 1;
+            PopulateDot11fBeaconReport( pMac, &frm.MeasurementReport[i], &pRRMReport[i].report.beaconReport );
+            frm.MeasurementReport[i].incapable = pRRMReport[i].incapable;
+            frm.MeasurementReport[i].refused = pRRMReport[i].refused;
+            frm.MeasurementReport[i].present = 1;
             break;
          default:
-            frm->MeasurementReport[i].present = 1;
+            frm.MeasurementReport[i].present = 1;
             break;
       }
    }
 
-   nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload );
+   nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, &frm, &nPayload );
    if ( DOT11F_FAILED( nStatus ) )
    {
       limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
@@ -5428,7 +5298,6 @@
             nStatus );
       // We'll fall back on the worst case scenario:
       nPayload = sizeof( tDot11fLinkMeasurementReport );
-      vos_mem_free(frm);
       return eSIR_FAILURE;
    }
    else if ( DOT11F_WARNED( nStatus ) )
@@ -5445,7 +5314,6 @@
    {
       limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Radio Measure "
                "Report.\n"), nBytes );
-      vos_mem_free(frm);
       return eSIR_FAILURE;
    }
 
@@ -5468,7 +5336,7 @@
 
    // Now, we're ready to "pack" the frames
    nStatus = dot11fPackRadioMeasurementReport( pMac,
-         frm,
+         &frm,
          pFrame + sizeof( tSirMacMgmtHdr ),
          nPayload,
          &nPayload );
@@ -5516,17 +5384,14 @@
       PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]\n" ), halstatus );)
          statusCode = eSIR_FAILURE;
       //Pkt will be freed up by the callback
-      vos_mem_free(frm);
       return statusCode;
    }
-   else {
-      vos_mem_free(frm);
+   else
       return eSIR_SUCCESS;
-   }
 
 returnAfterError:
-   vos_mem_free(frm);
    palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
+
    return statusCode;
 } // End limSendBeaconReportActionFrame.
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendMessages.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendMessages.c
index 8596da6..3b95f1d 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendMessages.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -31,12 +31,14 @@
  * --------------------------------------------------------------------------
  *
  */
+
 #include "limSendMessages.h"
 #include "cfgApi.h"
 #include "limTrace.h"
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
 #include "vos_diag_core_log.h"
 #endif //FEATURE_WLAN_DIAG_SUPPORT 
+
 /* When beacon filtering is enabled, firmware will
  * analyze the selected beacons received during BMPS,
  * and monitor any changes in the IEs as listed below.
@@ -63,6 +65,7 @@
 #endif
 };
 
+
 /**
  * limSendCFParams()
  *
@@ -84,33 +87,41 @@
  *
  * @return success if message send is ok, else false.
  */
+
 tSirRetStatus limSendCFParams(tpAniSirGlobal pMac, tANI_U8 bssIdx, tANI_U8 cfpCount, tANI_U8 cfpPeriod)
 {
     tpUpdateCFParams pCFParams = NULL;
     tSirRetStatus   retCode = eSIR_SUCCESS;
     tSirMsgQ msgQ;
 
+
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pCFParams,
           sizeof( tUpdateCFParams )))
       {
         limLog( pMac, LOGP,
             FL( "Unable to PAL allocate memory during Update CF Params\n" ));
+
         retCode = eSIR_MEM_ALLOC_FAILED;
         goto returnFailure;
       }
+
     palZeroMemory( pMac->hHdd, (tANI_U8 *) pCFParams, sizeof(tUpdateCFParams));
+
     pCFParams->cfpCount = cfpCount;
     pCFParams->cfpPeriod = cfpPeriod;
     pCFParams->bssIdx     = bssIdx;
 
+
     msgQ.type = WDA_UPDATE_CF_IND;
     msgQ.reserved = 0;
     msgQ.bodyptr = pCFParams;
     msgQ.bodyval = 0;
+
     limLog( pMac, LOG3,
                 FL( "Sending WDA_UPDATE_CF_IND..." ));
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
+
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pCFParams);
@@ -118,10 +129,13 @@
                     FL("Posting  WDA_UPDATE_CF_IND to WDA failed, reason=%X\n"),
                     retCode );
     }
+
 returnFailure:
     return retCode;
 }
 
+
+
 /**
  * limSendBeaconParams()
  *
@@ -143,6 +157,7 @@
  *
  * @return success if message send is ok, else false.
  */
+
 tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac, 
                                   tpUpdateBeaconParams pUpdatedBcnParams,
                                   tpPESession  psessionEntry )
@@ -151,22 +166,27 @@
     tSirRetStatus   retCode = eSIR_SUCCESS;
     tSirMsgQ msgQ;
 
+
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pBcnParams, sizeof(*pBcnParams)))
     {
         limLog( pMac, LOGP,
             FL( "Unable to PAL allocate memory during Update Beacon Params\n" ));
+
         return eSIR_MEM_ALLOC_FAILED;
     }
+
     palCopyMemory( pMac->hHdd, (tANI_U8 *) pBcnParams,  pUpdatedBcnParams, sizeof(*pBcnParams));
+
     msgQ.type = WDA_UPDATE_BEACON_IND;
     msgQ.reserved = 0;
     msgQ.bodyptr = pBcnParams;
     msgQ.bodyval = 0;
+
     PELOG3(limLog( pMac, LOG3,
                 FL( "Sending WDA_UPDATE_BEACON_IND, paramChangeBitmap in hex = %x" ),
                     pUpdatedBcnParams->paramChangeBitmap);)
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pBcnParams);
@@ -177,9 +197,11 @@
 #ifdef WLAN_SOFTAP_FEATURE
     limSendBeaconInd(pMac, psessionEntry);
 #endif
+
     return retCode;
 }
 
+
 /**
  * limSendSwitchChnlParams()
  *
@@ -201,38 +223,46 @@
  *
  * @return success if message send is ok, else false.
  */
+
 #if !defined WLAN_FEATURE_VOWIFI  
 tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
                                       tANI_U8 chnlNumber,
-                                      ePhyChanBondState secondaryChnlOffset,
+                                      tSirMacHTSecondaryChannelOffset secondaryChnlOffset,
                                       tANI_U8 localPwrConstraint, tANI_U8 peSessionId)
 #else
 tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
                                       tANI_U8 chnlNumber,
-                                      ePhyChanBondState secondaryChnlOffset,
+                                      tSirMacHTSecondaryChannelOffset secondaryChnlOffset,
                                       tPowerdBm maxTxPower, tANI_U8 peSessionId)
+
 #endif
 {
     tpSwitchChannelParams pChnlParams = NULL;
     tSirRetStatus   retCode = eSIR_SUCCESS;
     tSirMsgQ msgQ;
     tpPESession pSessionEntry;
+
     if((pSessionEntry = peFindSessionBySessionId(pMac , peSessionId)) == NULL)
     {
        limLog( pMac, LOGP,
              FL( "Unable to get Session for session Id %d\n" ), peSessionId);
        return eSIR_FAILURE;
+
     }
+
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pChnlParams,
           sizeof( tSwitchChannelParams )))
       {
           limLog( pMac, LOGP,
             FL( "Unable to PAL allocate memory during Switch Channel Params\n" ));
+
         retCode = eSIR_MEM_ALLOC_FAILED;
         goto returnFailure;
       }
+
     palZeroMemory( pMac->hHdd, (tANI_U8 *) pChnlParams, sizeof(tSwitchChannelParams));
+
     pChnlParams->secondaryChannelOffset = secondaryChnlOffset;
     pChnlParams->channelNumber= chnlNumber;
 #if defined WLAN_FEATURE_VOWIFI  
@@ -241,16 +271,19 @@
 #else
     pChnlParams->localPowerConstraint = localPwrConstraint;
 #endif
+
     palCopyMemory( pMac->hHdd, pChnlParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
     pChnlParams->peSessionId = peSessionId;
     
     //we need to defer the message until we get the response back from WDA.
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
+
     msgQ.type = WDA_CHNL_SWITCH_REQ;
     msgQ.reserved = 0;
     msgQ.bodyptr = pChnlParams;
     msgQ.bodyval = 0;
-#if defined WLAN_FEATURE_VOWIFI  
+
+#if !defined WLAN_FEATURE_VOWIFI  
     PELOG3(limLog( pMac, LOG3,
         FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, maxTxPower - %d"),
         pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->maxTxPower);)
@@ -259,7 +292,7 @@
         FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, LocalPowerConstraint - %d"),
         pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->localPowerConstraint);)
 #endif
-    MTRACE(macTraceMsgTx(pMac, peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pChnlParams);
@@ -267,10 +300,12 @@
                     FL("Posting  WDA_CHNL_SWITCH_REQ to WDA failed, reason=%X\n"),
                     retCode );
     }
+
 returnFailure:
     return retCode;
 }
 
+
 /**
  * limSendEdcaParams()
  *
@@ -292,30 +327,36 @@
  *
  * @return success if message send is ok, else false.
  */
+
 tSirRetStatus limSendEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *pUpdatedEdcaParams, tANI_U16 bssIdx, tANI_BOOLEAN highPerformance)
 {
     tEdcaParams *pEdcaParams = NULL;
     tSirRetStatus   retCode = eSIR_SUCCESS;
     tSirMsgQ msgQ;
+
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pEdcaParams,
           sizeof(tEdcaParams)))
     {
         limLog( pMac, LOGP,
             FL( "Unable to PAL allocate memory during Update EDCA Params\n" ));
+
         retCode = eSIR_MEM_ALLOC_FAILED;
         return retCode;
     }
+
     pEdcaParams->bssIdx = bssIdx;
     pEdcaParams->acbe = pUpdatedEdcaParams[EDCA_AC_BE];
     pEdcaParams->acbk = pUpdatedEdcaParams[EDCA_AC_BK];
     pEdcaParams->acvi = pUpdatedEdcaParams[EDCA_AC_VI];
     pEdcaParams->acvo = pUpdatedEdcaParams[EDCA_AC_VO];
     pEdcaParams->highPerformance = highPerformance;
+
     msgQ.type = WDA_UPDATE_EDCA_PROFILE_IND;
     msgQ.reserved = 0;
     msgQ.bodyptr = pEdcaParams;
     msgQ.bodyval = 0;
+
     {
         tANI_U8 i;
         PELOG1(limLog( pMac, LOG1,FL("Sending WDA_UPDATE_EDCA_PROFILE_IND with EDCA Parameters:" ));)
@@ -326,7 +367,7 @@
                    pUpdatedEdcaParams[i].cw.min, pUpdatedEdcaParams[i].cw.max, pUpdatedEdcaParams[i].txoplimit);)
         }
     }
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pEdcaParams);
@@ -334,9 +375,11 @@
                     FL("Posting  WDA_UPDATE_EDCA_PROFILE_IND to WDA failed, reason=%X\n"),
                     retCode );
     }
+
     return retCode;
 }
 
+
 /**
  * limSetActiveEdcaParams()
  *
@@ -361,11 +404,13 @@
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
     vos_log_qos_edca_pkt_type *log_ptr = NULL;
 #endif //FEATURE_WLAN_DIAG_SUPPORT 
+
     // Initialize gLimEdcaParamsActive[] to be same as localEdcaParams
     psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE] = plocalEdcaParams[EDCA_AC_BE];
     psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK] = plocalEdcaParams[EDCA_AC_BK];
     psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI] = plocalEdcaParams[EDCA_AC_VI];
     psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO] = plocalEdcaParams[EDCA_AC_VO];
+
     /* An AC requires downgrade if the ACM bit is set, and the AC has not
      * yet been admitted in uplink or bi-directions.
      * If an AC requires downgrade, it will downgrade to the next beset AC
@@ -385,6 +430,7 @@
     {
         acAdmitted = ( (pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] & (1 << ac)) >> ac );
         limLog(pMac, LOG1, FL("For AC[%d]: acm=%d,  acAdmit=%d \n"), ac, plocalEdcaParams[ac].aci.acm, acAdmitted);
+
         if ( (plocalEdcaParams[ac].aci.acm == 1) && (acAdmitted == 0) )
         {
             limLog(pMac, LOG1, FL("We need to downgrade AC %d!! "), ac);
@@ -429,6 +475,7 @@
     return;
  }
 
+
 /** ---------------------------------------------------------
 \fn      limSetLinkState
 \brief   LIM sends a message to WDA to set the link state
@@ -442,16 +489,20 @@
 {
     tSirMsgQ msg;
     tSirRetStatus retCode;
+
     msg.type = WDA_SET_LINK_STATE;
     msg.bodyval = (tANI_U32) state;
     msg.bodyptr = NULL;
+
     MTRACE(macTraceMsgTx(pMac, 0, msg.type));
     retCode = wdaPostCtrlMsg(pMac, &msg);
     if (retCode != eSIR_SUCCESS)
         limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
+
     return retCode;
 }
 #endif //0
+
 tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId, 
                               tSirMacAddr selfMacAddr, tpSetLinkStateCallback callback, 
                               void *callbackArg) 
@@ -459,6 +510,7 @@
     tSirMsgQ msgQ;
     tSirRetStatus retCode;
     tpLinkStateParams pLinkStateParams = NULL;
+
     // Allocate memory.
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pLinkStateParams,
@@ -466,24 +518,29 @@
     {
         limLog( pMac, LOGP,
         FL( "Unable to PAL allocate memory while sending Set Link State\n" ));
+
         retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
         return retCode;
     }
+
     palZeroMemory( pMac->hHdd, (tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams));
+
     pLinkStateParams->state        = state;
     pLinkStateParams->callback     = callback;
     pLinkStateParams->callbackArg  = callbackArg;
      
+
     /* Copy Mac address */
     sirCopyMacAddr(pLinkStateParams->bssid,bssId);
     sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
 
+
     msgQ.type = WDA_SET_LINK_STATE;
     msgQ.reserved = 0;
     msgQ.bodyptr = pLinkStateParams;
     msgQ.bodyval = 0;
     
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
     if (retCode != eSIR_SUCCESS)
@@ -491,8 +548,10 @@
         palFreeMemory(pMac, (void*)pLinkStateParams);
         limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
     }
+
     return retCode;
 }
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
 extern tSirRetStatus limSetLinkStateFT(tpAniSirGlobal pMac, tSirLinkState 
 state,tSirMacAddr bssId, tSirMacAddr selfMacAddr, int ft, tpPESession psessionEntry)
@@ -500,6 +559,7 @@
     tSirMsgQ msgQ;
     tSirRetStatus retCode;
     tpLinkStateParams pLinkStateParams = NULL;
+
     // Allocate memory.
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pLinkStateParams,
@@ -507,23 +567,28 @@
     {
         limLog( pMac, LOGP,
         FL( "Unable to PAL allocate memory while sending Set Link State\n" ));
+
         retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
         return retCode;
     }
+
     palZeroMemory( pMac->hHdd, (tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams));
+
     pLinkStateParams->state = state;
+
     /* Copy Mac address */
     sirCopyMacAddr(pLinkStateParams->bssid,bssId);
     sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
     pLinkStateParams->ft = 1;
     pLinkStateParams->session = psessionEntry;
 
+
     msgQ.type = WDA_SET_LINK_STATE;
     msgQ.reserved = 0;
     msgQ.bodyptr = pLinkStateParams;
     msgQ.bodyval = 0;
     
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 
     retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
     if (retCode != eSIR_SUCCESS)
@@ -531,10 +596,13 @@
         palFreeMemory(pMac, (void*)pLinkStateParams);
         limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
     }
+
     return retCode;
 }
 #endif
 
+
+
 /** ---------------------------------------------------------
 \fn      limSendSetTxPowerReq
 \brief   LIM sends a WDA_SET_TX_POWER_REQ message to WDA 
@@ -546,14 +614,18 @@
 {
     tSirRetStatus  retCode = eSIR_SUCCESS;
     tSirMsgQ       msgQ;
+
     if (NULL == pTxPowerReq)
         return retCode;
+
     msgQ.type = WDA_SET_TX_POWER_REQ;
     msgQ.reserved = 0;
     msgQ.bodyptr = pTxPowerReq;
     msgQ.bodyval = 0;
+
     PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_SET_TX_POWER_REQ to WDA"));)
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         limLog( pMac, LOGP, FL("Posting WDA_SET_TX_POWER_REQ to WDA failed, reason=%X"), retCode );
@@ -565,6 +637,7 @@
     }
     return retCode;
 }
+
 /** ---------------------------------------------------------
 \fn      limSendGetTxPowerReq
 \brief   LIM sends a WDA_GET_TX_POWER_REQ message to WDA
@@ -576,14 +649,18 @@
 {
     tSirRetStatus  retCode = eSIR_SUCCESS;
     tSirMsgQ       msgQ;
+
     if (NULL == pTxPowerReq)
         return retCode;
+
     msgQ.type = WDA_GET_TX_POWER_REQ;
     msgQ.reserved = 0;
     msgQ.bodyptr = pTxPowerReq;
     msgQ.bodyval = 0;
+
     PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_GET_TX_POWER_REQ to WDA"));)
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         limLog( pMac, LOGP, FL("Posting WDA_GET_TX_POWER_REQ to WDA failed, reason=%X"), retCode );
@@ -595,6 +672,7 @@
     }
     return retCode;
 }
+
 /** ---------------------------------------------------------
 \fn      limSendBeaconFilterInfo
 \brief   LIM sends beacon filtering info to WDA
@@ -612,6 +690,7 @@
     tpBeaconFilterIe   pIe;
     tpPESession psessionEntry = &pMac->lim.gpSession[0];  //TBD-RAJESH get the sessionEntry from the caller
 
+
     msgSize = sizeof(tBeaconFilterMsg) + sizeof(beaconFilterTable);
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
           (void **) &pBeaconFilterMsg, msgSize) )
@@ -621,14 +700,18 @@
         return retCode;
     }
     palZeroMemory( pMac->hHdd, (tANI_U8 *) pBeaconFilterMsg, msgSize);
+
     // Fill in capability Info and mask
     //TBD-RAJESH get the BSS capability from session.
     //Don't send this message if no active Infra session is found.
     pBeaconFilterMsg->capabilityInfo = psessionEntry->limCurrentBssCaps;
     pBeaconFilterMsg->capabilityMask = CAPABILITY_FILTER_MASK;
+
     pBeaconFilterMsg->beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
+
     // Fill in number of IEs in beaconFilterTable
     pBeaconFilterMsg->ieNum = (tANI_U16) (sizeof(beaconFilterTable) / sizeof(tBeaconFilterIe));
+
     //Fill message with info contained in the beaconFilterTable
     ptr = (tANI_U8 *)pBeaconFilterMsg + sizeof(tBeaconFilterMsg);
     for(i=0; i < (pBeaconFilterMsg->ieNum); i++)
@@ -642,12 +725,14 @@
         pIe->byte.ref =  beaconFilterTable[i].byte.ref; 
         ptr += sizeof(tBeaconFilterIe);
     }
+
     msgQ.type = WDA_BEACON_FILTER_IND;
     msgQ.reserved = 0;
     msgQ.bodyptr = pBeaconFilterMsg;
     msgQ.bodyval = 0;
+
     limLog( pMac, LOG3, FL( "Sending WDA_BEACON_FILTER_IND..." ));
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pBeaconFilterMsg);
@@ -656,5 +741,7 @@
             retCode );
         return retCode;
     }
+
     return retCode;
 }
+
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendMessages.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendMessages.h
index 4b402f5..3871659 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendMessages.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendMessages.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -34,22 +34,26 @@
 #ifndef __LIM_SEND_MESSAGES_H
 #define __LIM_SEND_MESSAGES_H
 
+
+
 #include "aniGlobal.h"
 #include "limTypes.h"
 #include "halMsgApi.h"
 #include "sirParams.h"    
+
 tSirRetStatus limSendCFParams(tpAniSirGlobal pMac, tANI_U8 bssIdx, tANI_U8 cfpCount, tANI_U8 cfpPeriod);
 tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac, 
                                   tpUpdateBeaconParams pUpdatedBcnParams,
                                   tpPESession  psessionEntry );
+
 //tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac, tpUpdateBeaconParams pUpdatedBcnParams);
 #if defined WLAN_FEATURE_VOWIFI  
 tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac, tANI_U8 chnlNumber, 
-                                      ePhyChanBondState secondaryChnlOffset, 
+                                      tSirMacHTSecondaryChannelOffset secondaryChnlOffset, 
                                       tPowerdBm maxTxPower,tANI_U8 peSessionId);
 #else
 tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac, tANI_U8 chnlNumber, 
-                                      ePhyChanBondState secondaryChnlOffset, 
+                                      tSirMacHTSecondaryChannelOffset secondaryChnlOffset, 
                                       tANI_U8 localPwrConstraint,tANI_U8 peSessionId);
 #endif
 tSirRetStatus limSendEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *pUpdatedEdcaParams, tANI_U16 bssIdx, tANI_BOOLEAN highPerformance);
@@ -62,7 +66,9 @@
 #endif
 tSirRetStatus limSendSetTxPowerReq(tpAniSirGlobal pMac, tpSirSetTxPowerReq pTxPowerReq);
 tSirRetStatus limSendGetTxPowerReq(tpAniSirGlobal pMac, tpSirGetTxPowerReq pTxPowerReq);
+
 void limSetActiveEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *plocalEdcaParams, tpPESession psessionEntry);
+
 #define CAPABILITY_FILTER_MASK  0x73CF
 #define ERP_FILTER_MASK         0xF8
 #define EDCA_FILTER_MASK        0xF0
@@ -72,6 +78,8 @@
 #define HT_BYTE5_FILTER_MASK    0xFD
 #define DS_PARAM_CHANNEL_MASK   0x0
 
+
 tSirRetStatus limSendBeaconFilterInfo(tpAniSirGlobal pMac);
 
+
 #endif
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
index f2e1330..d55360a 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -123,7 +123,7 @@
     mmhMsg.type = msgType;
     mmhMsg.bodyptr = pSirSmeRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
    {
@@ -201,7 +201,7 @@
     mmhMsg.type = pSirSmeJoinRsp->messageType;
     mmhMsg.bodyptr = pSirSmeJoinRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 }
 
@@ -377,7 +377,7 @@
                 palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames + psessionEntry->bcnLen + psessionEntry->assocReqLen + psessionEntry->assocRspLen, psessionEntry->ricData, pSirSmeJoinRsp->parsedRicRspLen);
                 palFreeMemory(pMac->hHdd, psessionEntry->ricData);
                 psessionEntry->ricData = NULL;
-                PELOG1(limLog(pMac, LOG1, FL("RicLength=%d\n"), pSirSmeJoinRsp->parsedRicRspLen);)
+                PELOG1(limLog(pMac, LOG1, FL("RicLength=%d\n"), psessionEntry->parsedRicRspLen);)
             }
 #endif
 #ifdef FEATURE_WLAN_CCX            
@@ -411,20 +411,7 @@
     {
         if( psessionEntry && psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE )
         {
-            
-#ifdef WLAN_FEATURE_11AC
-            if (psessionEntry->vhtCapability)
-            {
-                ePhyChanBondState htSecondaryChannelOffset;
-               /*Get 11ac cbState from 11n cbState*/
-                 htSecondaryChannelOffset = limGet11ACPhyCBState(pMac, 
-                                    psessionEntry->currentOperChannel,
-                                    psessionEntry->htSecondaryChannelOffset);
-                peSetResumeChannel( pMac, psessionEntry->currentOperChannel, htSecondaryChannelOffset);
-            }
-            else 
-#endif
-               peSetResumeChannel( pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset);
+            peSetResumeChannel( pMac, psessionEntry->currentOperChannel, 0);
         }
         else
         {
@@ -584,7 +571,7 @@
     mmhMsg.type = msgType;
     mmhMsg.bodyptr = pSirSmeRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
@@ -698,7 +685,7 @@
 #endif
                 mmhMsg.bodyptr = pSirSmeScanRsp;
                 mmhMsg.bodyval = 0;
-                MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+                MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
                 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
                 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, allocLength))
                 {
@@ -768,7 +755,7 @@
         mmhMsg.type = eWNI_SME_SCAN_RSP;
         mmhMsg.bodyptr = pSirSmeScanRsp;
         mmhMsg.bodyval = 0;
-        MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+        MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
         limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
         PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
     }
@@ -837,7 +824,7 @@
     mmhMsg.bodyptr = pSirSmeScanRsp;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1009,7 +996,7 @@
     mmhMsg.bodyptr = pMsg;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 }
@@ -1150,7 +1137,6 @@
             /* Update SME session Id and Transaction Id */
             pSirSmeDisassocInd->sessionId = smesessionId;
             pSirSmeDisassocInd->transactionId = smetransactionId;
-            pSirSmeDisassocInd->reasonCode = reasonCode;
 #endif
             pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
 
@@ -1195,10 +1181,7 @@
     if( IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
     {
         //Resume on the first active session channel.
-        tANI_U8 resumeChannel;
-        ePhyChanBondState resumePhyCbState;
-        peGetActiveSessionChannel( pMac, &resumeChannel, &resumePhyCbState );
-        peSetResumeChannel( pMac, resumeChannel, resumePhyCbState );
+        peSetResumeChannel( pMac, peGetActiveSessionChannel( pMac ), 0);
 
         limResumeLink( pMac, limSendSmeDisassocDeauthNtfPostResume, 
                                               (tANI_U32*) pMsg );
@@ -1266,7 +1249,6 @@
     pSirSmeDisassocInd->sessionId     =  psessionEntry->smeSessionId;
     pSirSmeDisassocInd->transactionId =  psessionEntry->transactionId;
     pSirSmeDisassocInd->statusCode    =  pStaDs->mlmStaContext.disassocReason;
-    pSirSmeDisassocInd->reasonCode    =  pStaDs->mlmStaContext.disassocReason;
     
     palCopyMemory( pMac->hHdd, pSirSmeDisassocInd->bssId , psessionEntry->bssId , sizeof(tSirMacAddr));
  
@@ -1284,7 +1266,7 @@
     mmhMsg.bodyptr = pSirSmeDisassocInd;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason); 
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1345,7 +1327,6 @@
     palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
     //peerMacAddr
     palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
-    pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
 #else
 
     //sessionId
@@ -1381,7 +1362,7 @@
     mmhMsg.bodyptr = pSirSmeDeauthInd;
     mmhMsg.bodyval = 0;
 
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -1500,7 +1481,6 @@
 #else
             pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
             pSirSmeDeauthInd->length      = sizeof(tSirSmeDeauthInd);
-            pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
 #endif
 
             // sessionId
@@ -1544,10 +1524,7 @@
     if( IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
     {
         //Resume on the first active session channel.
-        tANI_U8 resumeChannel;
-        ePhyChanBondState resumePhyCbState;
-        peGetActiveSessionChannel( pMac, &resumeChannel, &resumePhyCbState );
-        peSetResumeChannel( pMac, resumeChannel, resumePhyCbState );
+        peSetResumeChannel( pMac, peGetActiveSessionChannel( pMac ), 0);
 
         limResumeLink( pMac, limSendSmeDisassocDeauthNtfPostResume, 
                                               (tANI_U32*) pMsg );
@@ -1702,7 +1679,7 @@
     }
 
 
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
     {
         palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
@@ -1786,7 +1763,7 @@
     mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
     mmhMsg.bodyptr = pSirSmeSetContextRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
@@ -1869,7 +1846,7 @@
     mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
     mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 } /*** end limSendSmeSetContextRsp() ***/
 
@@ -2010,7 +1987,7 @@
     msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
     msgQ.bodyptr = pNewBssInd;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
 } /*** end limSendSmeNeighborBssInd() ***/
 
@@ -2054,7 +2031,7 @@
     mmhMsg.type = eWNI_SME_ADDTS_RSP;
     mmhMsg.bodyptr = rsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -2089,7 +2066,7 @@
     mmhMsg.type = eWNI_SME_ADDTS_IND;
     mmhMsg.bodyptr = rsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 }
 
@@ -2134,7 +2111,7 @@
     mmhMsg.type = eWNI_SME_DELTS_RSP;
     mmhMsg.bodyptr = rsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -2174,7 +2151,7 @@
     mmhMsg.type = eWNI_SME_DELTS_IND;
     mmhMsg.bodyptr = rsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -2237,7 +2214,7 @@
 
     mmhMsg.bodyptr = stats;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);                                                  
 
     return;
@@ -2296,7 +2273,7 @@
 
     mmhMsg.bodyptr = stats;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);                                                  
 
     return;
@@ -2345,7 +2322,7 @@
     mmhMsg.type    = msgType;
 //    mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
     mmhMsg.bodyptr = pNewPeerInd;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
     
 }
@@ -2391,7 +2368,7 @@
     mmhMsg.bodyval = 0;
   
     PELOG1(limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. \n"));)        
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -2457,7 +2434,7 @@
     mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
     mmhMsg.bodyptr = aggrQosRsp;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2482,7 +2459,7 @@
     mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
     mmhMsg.bodyptr = NULL;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2506,7 +2483,7 @@
     mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
     mmhMsg.bodyptr = NULL;
     mmhMsg.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
@@ -2535,7 +2512,7 @@
     PELOG1(limLog(pMac, LOG1, FL("msgType %s peerMacAddr %02x-%02x-%02x-%02x-%02x-%02x"
                 "sme session id %d\n"),"eWNI_SME_MAX_ASSOC_EXCEEDED", peerMacAddr[0], peerMacAddr[1],
                 peerMacAddr[2], peerMacAddr[3], peerMacAddr[4], peerMacAddr[5], smesessionId);)
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
     limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
     return;
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.h
index b777e38..8554d9b 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSendSmeRspMessages.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSerDesUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSerDesUtils.c
index fae8bb3..b663bea 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSerDesUtils.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSerDesUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -103,7 +103,7 @@
 limGetBssDescription( tpAniSirGlobal pMac, tSirBssDescription *pBssDescription,
                      tANI_S16 rLen, tANI_S16 *lenUsed, tANI_U8 *pBuf)
 {
-    tANI_S16 len = 0;
+    tANI_U16 len = 0;
 
     pBssDescription->length = limGetU16(pBuf);
     pBuf += sizeof(tANI_U16);
@@ -187,6 +187,14 @@
     if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
         return eSIR_FAILURE;
 
+    // Extract the TITAN capability info
+    // NOTE - titanHtCaps is now DWORD aligned
+    pBssDescription->titanHtCaps = limGetU32( pBuf );
+    pBuf += sizeof(tANI_U32);
+    len  -= sizeof(tANI_U32);
+    if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
+        return eSIR_FAILURE;
+
     //pass the timestamp
     pBssDescription->nReceivedTime = limGetU32( pBuf );
     pBuf += sizeof(tANI_TIMESTAMP);
@@ -219,7 +227,7 @@
     pBssDescription->mdie[2] = *pBuf++;
     len --;
 #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
-    PELOGE(limLog(pMac, LOG1, FL("mdie=%02x %02x %02x\n"), 
+    PELOGE(limLog(pMac, LOGE, FL("mdie=%02x %02x %02x\n"), 
         pBssDescription->mdie[0],
         pBssDescription->mdie[1],
         pBssDescription->mdie[2]);)
@@ -240,57 +248,30 @@
     if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
         return eSIR_FAILURE;
 #endif
-    pBssDescription->fProbeRsp = *pBuf++;
-    len  -= sizeof(tANI_U8);
-    if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
-        return eSIR_FAILURE;
-
-    /* 3 reserved bytes for padding */
-    pBuf += (3 * sizeof(tANI_U8));
-    len  -= 3;
-
-    pBssDescription->WscIeLen = limGetU32( pBuf );
-    pBuf += sizeof(tANI_U32);
-    len  -= sizeof(tANI_U32);
-    if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
-        return eSIR_FAILURE;
     
-    if (WSCIE_PROBE_RSP_LEN < len)
+    if (pBssDescription->WscIeLen)
     {
-        /* Do not copy with WscIeLen
-         * if WscIeLen is not set properly, memory overwrite happen
-         * Ended up with memory corruption and crash
-         * Copy with Fixed size */
         palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->WscIeProbeRsp,
                        pBuf,
-                       WSCIE_PROBE_RSP_LEN);
-
+                       pBssDescription->WscIeLen);
     }
-    else
-    {
-        limLog(pMac, LOGE,
-                     FL("remaining bytes len %d is less than WSCIE_PROBE_RSP_LEN\n"),
-                     pBssDescription->WscIeLen);
-        return eSIR_FAILURE;
-    }
+    
+    pBuf += (sizeof(pBssDescription->WscIeProbeRsp) + 
+             sizeof(pBssDescription->WscIeLen) + 
+             sizeof(pBssDescription->fProbeRsp) + 
+             sizeof(tANI_U32));
+    
+    len -= (sizeof(pBssDescription->WscIeProbeRsp) + 
+             sizeof(pBssDescription->WscIeLen) + 
+             sizeof(pBssDescription->fProbeRsp) + 
+             sizeof(tANI_U32));
 
-    /* 1 reserved byte padding */
-    pBuf += (WSCIE_PROBE_RSP_LEN + 1);
-    len -= (WSCIE_PROBE_RSP_LEN + 1);
-
-    if (len > 0)
+    if (len)
     {
         palCopyMemory( pMac->hHdd, (tANI_U8 *) pBssDescription->ieFields,
                        pBuf,
                        len);
     }
-    else if (len < 0)
-    {
-        limLog(pMac, LOGE, 
-                     FL("remaining length is negative. len = %d, actual length = %d\n"), 
-                     len, pBssDescription->length);
-        return eSIR_FAILURE;
-    }    
 
     return eSIR_SUCCESS;
 } /*** end limGetBssDescription() ***/
@@ -612,13 +593,17 @@
     pBuf       += sizeof(tSirMacAddr);
     bssInfoLen += sizeof(tSirMacAddr);
    PELOG3(limLog(pMac, LOG3,
-       FL("Copying new NeighborWds node:channel is %d, wniIndicator is %d, bssType is %d, bssId is "),
-       pBssInfo->channelId, pBssInfo->wniIndicator, pBssInfo->bssType);
+       FL("Copying new NeighborWds node:channel is %d, TITAN HT Caps are %1d, wniIndicator is %d, bssType is %d, bssId is "),
+       pBssInfo->channelId, pBssInfo->titanHtCaps, pBssInfo->wniIndicator,
+       pBssInfo->bssType);
     limPrintMacAddr(pMac, pBssInfo->bssId, LOG3);)
 
     *pBuf++ = pBssInfo->channelId;
     bssInfoLen++;
 
+    *pBuf++ = pBssInfo->titanHtCaps;
+    bssInfoLen++;
+
     limCopyU32(pBuf, pBssInfo->wniIndicator);
     pBuf       += sizeof(tANI_U32);
     bssInfoLen += sizeof(tANI_U32);
@@ -1381,7 +1366,7 @@
     len--;
 
     // Extract CB secondary channel info
-    pStartBssReq->cbMode = (ePhyChanBondState)limGetU32( pBuf );
+    pStartBssReq->cbMode = (tAniCBSecondaryMode)limGetU32( pBuf );
     pBuf += sizeof( tANI_U32 );
     len -= sizeof( tANI_U32 );
 
@@ -1804,12 +1789,6 @@
     if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
         return eSIR_FAILURE;
 
-    // Extract cbMode
-    pJoinReq->cbMode = *pBuf++;
-    len--;
-    if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
-        return eSIR_FAILURE;
-
     // Extract uapsdPerAcBitmask
     pJoinReq->uapsdPerAcBitmask = *pBuf++;
     len--;
@@ -1985,7 +1964,7 @@
         return eSIR_FAILURE;
 #endif
     
-#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
     //isFastTransitionEnabled;
     pJoinReq->isFastTransitionEnabled = (tAniBool)limGetU32(pBuf);
     pBuf += sizeof(tAniBool);
@@ -1994,15 +1973,7 @@
         return eSIR_FAILURE;    
 #endif
 
-#ifdef FEATURE_WLAN_LFR
-    //isFastRoamIniFeatureEnabled;
-    pJoinReq->isFastRoamIniFeatureEnabled = (tAniBool)limGetU32(pBuf);
-    pBuf += sizeof(tAniBool);
-    len -= sizeof(tAniBool);
-    if (limCheckRemainingLength(pMac, len) == eSIR_FAILURE)
-        return eSIR_FAILURE;    
-#endif
-
+    
 #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
     // Extract BP Indicator
     pJoinReq->bpIndicator = (tAniBool) limGetU32(pBuf);
@@ -2049,7 +2020,7 @@
     pJoinReq->powerCap.minTxPower = *pBuf++;
     pJoinReq->powerCap.maxTxPower = *pBuf++;
     len -=2;
-    limLog(pMac, LOG1, FL("Power Caps: Min power = %d, Max power = %d\n"), pJoinReq->powerCap.minTxPower, pJoinReq->powerCap.maxTxPower);
+    limLog(pMac, LOGE, FL("Power Caps: Min power = %d, Max power = %d\n"), pJoinReq->powerCap.minTxPower, pJoinReq->powerCap.maxTxPower);
 
     pJoinReq->supportedChannels.numChnl = *pBuf++;
     len--;
@@ -2214,6 +2185,11 @@
 
 #endif
 
+    // Copy the new TITAN capabilities
+    *pBuf = pAssocInd->titanHtCaps;
+    pBuf++;
+    mLen++;
+
     limCopyU32(pBuf, pAssocInd->spectrumMgtIndicator);
     pBuf += sizeof(tAniBool);
     mLen += sizeof(tAniBool);
@@ -2782,6 +2758,11 @@
     mLen += sizeof(tANI_U32);
 #endif
 
+    // Copy the new TITAN capabilities
+    *pBuf = pReassocInd->titanHtCaps;
+    pBuf++;
+    mLen++;
+
     limCopyU32(pBuf, pReassocInd->spectrumMgtIndicator);
     pBuf += sizeof(tAniBool);
     mLen += sizeof(tAniBool);
@@ -3436,7 +3417,7 @@
         pMac->lim.htCapabilityPresentInBeacon = 1;
     else
         pMac->lim.htCapabilityPresentInBeacon = 0;
-    if (neighborBssInfo.localPowerConstraints && pSessionEntry->lim11hEnable)
+    if (neighborBssInfo.localPowerConstraints && pMac->lim.gLim11hEnable)
     {
         localPowerConstraints = neighborBssInfo.localPowerConstraints;
     }
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSerDesUtils.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSerDesUtils.h
index a660b23..6de920b 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSerDesUtils.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSerDesUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSession.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSession.c
index a4c5c2a..e3d665f 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSession.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSession.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -144,19 +144,12 @@
             pMac->lim.gpSession[i].isCCXconnection = FALSE;
 #endif
 
-#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
             pMac->lim.gpSession[i].isFastTransitionEnabled = FALSE;
 #endif
-#ifdef FEATURE_WLAN_LFR
-            pMac->lim.gpSession[i].isFastRoamIniFeatureEnabled = FALSE;
-#endif
             *sessionId = i;
 
-            pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode
-            /* Initialize CB mode variables when session is created */
-            pMac->lim.gpSession[i].htSupportedChannelWidthSet = 0;
-            pMac->lim.gpSession[i].htRecommendedTxWidthSet = 0;
-            pMac->lim.gpSession[i].htSecondaryChannelOffset = 0;
+            pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode 
             return(&pMac->lim.gpSession[i]);
         }
     }
@@ -266,7 +259,7 @@
        }
     }
 
-    limLog(pMac, LOG4, FL("Session lookup fails for StaId: %d\n "), staid);
+    limLog(pMac, LOG4, FL("Session lookup fails for StaId: \n "));
     return(NULL);
 }
 
@@ -284,24 +277,9 @@
 void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
 {
     tANI_U16 i = 0;
-    tANI_U16 n;
-    TX_TIMER *timer_ptr;
 
     limLog(pMac, LOGW, FL("Trying to delete a session %d.\n "), psessionEntry->peSessionId);
 
-    for (n = 0; n < pMac->lim.maxStation; n++)
-    {
-        timer_ptr = &pMac->lim.limTimers.gpLimCnfWaitTimer[n];
-
-        if(psessionEntry->peSessionId == timer_ptr->sessionId)
-        {
-            if(VOS_TRUE == tx_timer_running(timer_ptr))
-            {
-                tx_timer_deactivate(timer_ptr);
-            }
-        }
-    }
-    
     if(psessionEntry->pLimStartBssReq != NULL)
     {
         palFreeMemory( pMac->hHdd, psessionEntry->pLimStartBssReq );
@@ -423,9 +401,7 @@
          }
       }
    }   
-
-   limLog(pMac, LOG1, FL("Session lookup fails for Peer StaId: \n "));
-   limPrintMacAddr(pMac, sa, LOG1);
+   
    return NULL;
 }
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSessionUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSessionUtils.c
index e193ed9..a07d0c9 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSessionUtils.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSessionUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -20,9 +20,11 @@
  */
 
 /**=========================================================================
-
+  
   \file  limSessionUtils.c
+  
   \brief implementation for lim Session Utility  APIs
+
   \author Sunit Bhatia
   
   Copyright 2008 (c) Qualcomm, Incorporated.  All Rights Reserved.
@@ -38,63 +40,8 @@
 #include "limSessionUtils.h"
 #include "limUtils.h"
 
-/*--------------------------------------------------------------------------
-  \brief peGetVhtCapable() - Returns the Vht capable from a valid session.
-
-  This function itrates the session Table and returns the VHT capable from first valid session
-   if no sessions are valid/present  it returns FALSE
-    
-  \param pMac                   - pointer to global adapter context
-  \return                           - channel to scan from valid session else zero.
-  
-  \sa
-  
-  --------------------------------------------------------------------------*/
-tANI_U8 peGetVhtCapable(tpAniSirGlobal pMac)
-
-{
-#ifdef WLAN_FEATURE_11AC
-    tANI_U8 i;
-    //assumption here is that all the sessions will be on the same channel.
-    //This function will not work, once we have multiple channel support.
-    for(i =0; i < pMac->lim.maxBssId; i++)
-    {
-        if(pMac->lim.gpSession[i].valid)
-        {
-            return(pMac->lim.gpSession[i].vhtCapability);  
-        }
-    }
-#endif
-    return FALSE;
-}
-/*--------------------------------------------------------------------------
-  \brief peGetCurrentChannel() - Returns the  channel number for scanning, 
-                                from a valid session.
-   This function itrates the session Table and returns the channel number 
-   from first valid session if no sessions are valid/present  it returns zero
-
-  \param pMac                   - pointer to global adapter context
-  \return                       - channel to scan from valid session else zero.
-  \sa
-  --------------------------------------------------------------------------*/
-tANI_U8 peGetCurrentChannel(tpAniSirGlobal pMac)
-{
-    tANI_U8 i;
-    //assumption here is that all the sessions will be on the same channel.
-    //This function will not work, once we have multiple channel support.
-    for(i =0; i < pMac->lim.maxBssId; i++)
-    {
-        if(pMac->lim.gpSession[i].valid)
-        {
-            return(pMac->lim.gpSession[i].currentOperChannel);
-        }
-    }
-    return(HAL_INVALID_CHANNEL_ID);
-}
-
 
 /*--------------------------------------------------------------------------
-
   \brief peValidateJoinReq() - validates the Join request .
 
   This function is called to validate the Join Request for a BT-AMP station. If start BSS session is present
@@ -232,7 +179,7 @@
           //Skip the sessionId that is to be joined.
           continue;
         }
-        //if another ession is valid and it is on different channel
+        //if snother ession is valid and it is on different channel
         //it is an off channel operation.
         if( (pMac->lim.gpSession[i].valid) && 
             (pMac->lim.gpSession[i].currentOperChannel != 
@@ -246,156 +193,22 @@
 
 }
 
-/*--------------------------------------------------------------------------
-  \brief peGetActiveSessionChannel() - Gets the operating channel of first  
-                                    valid session. Returns 0 if there is no
-									valid session.
-
-  \param pMac                   - pointer to global adapter context
-  
-  \return tANI_U8               - operating channel.
-  
-  \sa
-  --------------------------------------------------------------------------*/
-void
-peGetActiveSessionChannel (tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
+tANI_U8
+peGetActiveSessionChannel (tpAniSirGlobal pMac)
 {
     tANI_U8 i;
 
-    // Initialize the pointers passed to INVALID values in case we don't find a valid session
-    *resumeChannel = 0;
-    *resumePhyCbState = 0;
     for(i =0; i < pMac->lim.maxBssId; i++)
     {
+        //if snother ession is valid and it is on different channel
+        //it is an off channel operation.
         if(pMac->lim.gpSession[i].valid)
         {
-            *resumeChannel = pMac->lim.gpSession[i].currentOperChannel;
-            *resumePhyCbState = pMac->lim.gpSession[i].htSecondaryChannelOffset;
-            
-#ifdef WLAN_FEATURE_11AC
-            if ((pMac->lim.gpSession[i].vhtCapability))
-            {
-               /*Get 11ac cbState from 11n cbState*/
-                *resumePhyCbState = limGet11ACPhyCBState(pMac, 
-                                    pMac->lim.gpSession[i].currentOperChannel,
-                                    pMac->lim.gpSession[i].htSecondaryChannelOffset);
-            }
-#endif
+            return pMac->lim.gpSession[i].currentOperChannel;
         }
     }
-    return;
-}
 
-/*--------------------------------------------------------------------------
-  \brief limIsChanSwitchRunning() - Check if channel switch is running on any  
-                                    valid session.
-
-  \param pMac                   - pointer to global adapter context
-  
-  \return tANI_U8               - 1 - if chann switching running.
-                                  0 - if chann switching is not running. 
-  
-  \sa
-  --------------------------------------------------------------------------*/
-tANI_U8
-limIsChanSwitchRunning (tpAniSirGlobal pMac)
-{
-    tANI_U8 i;
-
-    for(i =0; i < pMac->lim.maxBssId; i++)
-    {
-        if(pMac->lim.gpSession[i].valid && 
-            pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
-        {
-            return 1;
-        }
-    }
     return 0;
-}
-/*--------------------------------------------------------------------------
-  \brief limIsInQuietDuration() - Check if channel quieting is running on any  
-                                    valid session.
 
-  \param pMac                   - pointer to global adapter context
-  
-  \return tANI_U8               - 1 - if chann quiet running.
-                                  0 - if chann quiet is not running. 
-  
-  \sa
-  --------------------------------------------------------------------------*/
-tANI_U8
-limIsInQuietDuration (tpAniSirGlobal pMac)
-{
-    tANI_U8 i;
-
-    for(i =0; i < pMac->lim.maxBssId; i++)
-    {
-        if(pMac->lim.gpSession[i].valid && 
-            pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
-        {
-            return 1;
-        }
-    }
-    return 0;
-}
-/*--------------------------------------------------------------------------
-  \brief limIsQuietBegin() - Check if channel quieting is begining on any  
-                                    valid session.
-
-  \param pMac                   - pointer to global adapter context
-  
-  \return tANI_U8               - 1 - if chann quiet running.
-                                  0 - if chann quiet is not running. 
-  
-  \sa
-  --------------------------------------------------------------------------*/
-tANI_U8
-limIsQuietBegin (tpAniSirGlobal pMac)
-{
-    tANI_U8 i;
-
-    for(i =0; i < pMac->lim.maxBssId; i++)
-    {
-        if(pMac->lim.gpSession[i].valid && 
-            pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
-        {
-            return 1;
-        }
-    }
-    return 0;
 }
 
-/*--------------------------------------------------------------------------
-  \brief limIsInMCC() - Check if Device is in MCC.
-
-  \param pMac                   - pointer to global adapter context
-  
-  \return tANI_U8               - TRUE - if in MCC.
-                                  FALSE - NOT in MCC. 
-  
-  \sa
-  --------------------------------------------------------------------------*/
-tANI_U8
-limIsInMCC (tpAniSirGlobal pMac)
-{
-    tANI_U8 i;
-    tANI_U8 chan = 0;
-
-    for(i = 0; i < pMac->lim.maxBssId; i++)
-    {
-        //if another session is valid and it is on different channel
-        //it is an off channel operation.
-        if( (pMac->lim.gpSession[i].valid) )
-        { 
-            if( chan == 0 )
-            {
-                chan = pMac->lim.gpSession[i].currentOperChannel;
-            } 
-            else if( chan != pMac->lim.gpSession[i].currentOperChannel)
-            {
-                return TRUE; 
-            }        
-        }
-    }
-    return FALSE;
-}
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSessionUtils.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSessionUtils.h
index df72a90..4127827 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSessionUtils.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSessionUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -58,20 +58,6 @@
 /*------------------------------------------------------------------------- 
   Function declarations and documenation
   ------------------------------------------------------------------------*/
-/*--------------------------------------------------------------------------
-  
-          \brief peGetVhtCapable() - Returns the Vht capable from a valid session.
- 
-          This function itrates the session Table and returns the VHT capable from first valid session
-          if no sessions are valid/present  it returns FALSE
-
-         \param pMac	                - pointer to global adapter context
-          \return                        - channel to scan from valid session else zero.
-          
-          \sa
-           
- --------------------------------------------------------------------------*/
-   tANI_U8 peGetVhtCapable(tpAniSirGlobal pMac);
 
 
 /*--------------------------------------------------------------------------
@@ -144,68 +130,7 @@
 isLimSessionOffChannel(tpAniSirGlobal pMac, tANI_U8 sessionId);
 /* --------------------------------------------------------------------------*/
 
-/*--------------------------------------------------------------------------
-  \brief peGetActiveSessionChannel() - Gets the first valid sessions primary and secondary
-                                        channel. If not found returns invalid channel ID (=0)
-  \param pMac              - pointer to global adapter context
-  \param resumeChannel     - Primary channel of the first valid session. This is an output argument.
-  \return resumePhyCbState - Secondary channel of the first valid session. This is an output argument.
---------------------------------------------------------------------------*/
-void
-peGetActiveSessionChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState);
-
-/*--------------------------------------------------------------------------
-  \brief limIsChanSwitchRunning() - Check if channel switch is running on any  
-                                    valid session.
-
-  \param pMac                   - pointer to global adapter context
-  
-  \return tANI_U8               - 1 - if chann switching running.
-                                  0 - if chann switching is not running. 
-  
-  \sa
-  --------------------------------------------------------------------------*/
 tANI_U8
-limIsChanSwitchRunning (tpAniSirGlobal pMac);
-
-/*--------------------------------------------------------------------------
-  \brief limIsInQuietDuration() - Check if channel quieting is running on any  
-                                    valid session.
-
-  \param pMac                   - pointer to global adapter context
-  
-  \return tANI_U8               - 1 - if chann quiet running.
-                                  0 - if chann quiet is not running. 
-  
-  \sa
-  --------------------------------------------------------------------------*/
-tANI_U8
-limIsInQuietDuration (tpAniSirGlobal pMac);
-
-/*--------------------------------------------------------------------------
-  \brief limIsQuietBegin() - Check if channel quieting is begining on any  
-                                    valid session.
-
-  \param pMac                   - pointer to global adapter context
-  
-  \return tANI_U8               - 1 - if chann quiet running.
-                                  0 - if chann quiet is not running. 
-  
-  \sa
-  --------------------------------------------------------------------------*/
-tANI_U8
-limIsQuietBegin (tpAniSirGlobal pMac);
-/*--------------------------------------------------------------------------
-  \brief limIsInMCC() - Check if Device is in MCC.
-
-  \param pMac                   - pointer to global adapter context
-  
-  \return tANI_U8               - TRUE - if in MCC.
-                                  FALSE - NOT in MCC. 
-  
-  \sa
-  --------------------------------------------------------------------------*/
-tANI_U8
-limIsInMCC (tpAniSirGlobal pMac);
+peGetActiveSessionChannel( tpAniSirGlobal pMac );
 #endif //#if !defined( __LIM_SESSION_UTILS_H )
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.c
index 1c7d2cb..f0a687e 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -705,7 +705,7 @@
             // Reject START_BSS_REQ
             limLog(pMac, LOGW,
                FL("Invalid operational rates in eWNI_SME_START_BSS_REQ\n"));
-            sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
+            sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGW,
                        pStartBssReq->operationalRateSet.rate,
                        pStartBssReq->operationalRateSet.numRates);
 
@@ -723,7 +723,7 @@
             // Reject START_BSS_REQ
             limLog(pMac, LOGW,
                FL("Invalid operational rates in eWNI_SME_START_BSS_REQ\n"));
-            sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
+            sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGW,
                        pStartBssReq->operationalRateSet.rate,
                        pStartBssReq->operationalRateSet.numRates);
 
@@ -740,7 +740,7 @@
             // Reject START_BSS_REQ
             limLog(pMac, LOGW,
                FL("Invalid operational rates in eWNI_SME_START_BSS_REQ\n"));
-            sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
+            sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGW,
                        pStartBssReq->operationalRateSet.rate,
                        pStartBssReq->operationalRateSet.numRates);
 
@@ -836,22 +836,6 @@
         goto end;
     }
 
-    /*
-       Reject Join Req if the Self Mac Address and 
-       the Ap's Mac Address is same
-    */
-    if( palEqualMemory( pMac->hHdd, (tANI_U8* ) pJoinReq->selfMacAddr, 
-                       (tANI_U8 *) pJoinReq->bssDescription.bssId, 
-                       (tANI_U8) (sizeof(tSirMacAddr))))
-    {
-        // Log the event
-        limLog(pMac, LOGE,
-               FL("received SME_JOIN_REQ with Self Mac and BSSID Same\n"));
-
-        valid = false;
-        goto end;
-    }
-
 end:
     return valid;
 } /*** end limIsSmeJoinReqValid() ***/
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.h
index 7cfebd6..91edf54 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limSmeReqUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limStaHashApi.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limStaHashApi.c
index 017a9af..27a4078 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limStaHashApi.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limStaHashApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limStaHashApi.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limStaHashApi.h
index 03a5495..9b9a6be 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limStaHashApi.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limStaHashApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.c
index 842beba..fd0b2a5 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -604,7 +604,7 @@
                 SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT,
                 cfgValue,
                 cfgValue,
-                TX_NO_ACTIVATE) != TX_SUCCESS)
+                TX_AUTO_ACTIVATE) != TX_SUCCESS)
         {
             // Cannot create update OLBC cache timer
             // Log error
@@ -895,7 +895,7 @@
 {
     tANI_U32    val=0, val1=0;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, timerId));
 
     switch (timerId)
     {
@@ -920,7 +920,6 @@
                        FL("Unable to deactivate min channel timer\n"));
             }
 
-#if 0
             // If a background was triggered via Quiet BSS,
             // then we need to adjust the MIN and MAX channel
             // timer's accordingly to the Quiet duration that
@@ -934,7 +933,6 @@
             }
             else
             {
-#endif
                 if(pMac->lim.gpLimMlmScanReq)
                 {
                     val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
@@ -945,9 +943,7 @@
                     //No need to change min timer. This is not a scan
                     break;
                 }
-#if 0
             }
-#endif
 
             if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
                                 val, 0) != TX_SUCCESS)
@@ -997,7 +993,6 @@
             // was specified
             if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
             {
-#if 0
 
                 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
                     pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
@@ -1008,7 +1003,6 @@
                 }
                 else
                 {
-#endif
                     if(pMac->lim.gpLimMlmScanReq)
                     {
                         val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
@@ -1019,9 +1013,7 @@
                         //No need to change max timer. This is not a scan
                         break;
                     }
-#if 0
                 }
-#endif
             }
 #endif
 #if defined(ANI_PRODUCT_TYPE_AP)
@@ -1423,7 +1415,6 @@
             break;
 
 #endif
-#if 0
         case eLIM_CHANNEL_SWITCH_TIMER:
             if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
             {
@@ -1439,7 +1430,6 @@
                 return;
             }
             break;
-#endif
 
         case eLIM_LEARN_DURATION_TIMER:
 #ifdef ANI_PRODUCT_TYPE_AP
@@ -1494,7 +1484,6 @@
 #endif
             break;
 
-#if 0
         case eLIM_QUIET_BSS_TIMER:
             if (TX_SUCCESS !=
             tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
@@ -1530,7 +1519,7 @@
                     FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
             }
             break;
-#endif
+
 
 #ifdef WLAN_SOFTAP_FEATURE
 #if 0
@@ -1646,7 +1635,7 @@
 {
     tANI_U32    val, val1;
 
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
 
     if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) != TX_SUCCESS)
         limLog(pMac, LOGP, FL("Fail to deactivate HeartBeatTimer \n"));
@@ -1690,7 +1679,7 @@
     PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"), psessionEntry->LimRxedBeaconCntDuringHB);)
 
     limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
 
     //only start the hearbeat-timer if the timeout value is non-zero
     if(pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs > 0) {
@@ -1861,7 +1850,7 @@
 limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
 {
     tANI_U32    val;
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, timerId));
 
     switch (timerId)
     {
@@ -2006,7 +1995,7 @@
 
 void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
 {
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_CNF_WAIT_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_CNF_WAIT_TIMER));
     pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = psessionEntry->peSessionId;
     if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
                 != TX_SUCCESS)
@@ -2038,7 +2027,7 @@
 
 void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
 {
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_AUTH_RESP_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_AUTH_RESP_TIMER));
     if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS)
     {
         /// Could not activate auth rsp timer.
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.h
index 176d857..1719977 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limTimerUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limTrace.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limTrace.c
index b15f7ce..8e13a02 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limTrace.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limTrace.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limTypes.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limTypes.h
index 388e7d7..217bcbe 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limTypes.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limTypes.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -178,7 +178,7 @@
     tANI_U8               dtimPeriod;
     tSirMacCfParamSet     cfParamSet;
     tSirMacChanNum        channelNumber;
-    ePhyChanBondState     cbMode;
+    tAniCBSecondaryMode   cbMode;
     tANI_U16              atimWindow;
     tSirMacRateSet        rateSet;
     tANI_U8               sessionId; //Added For BT-AMP Support   
@@ -248,6 +248,8 @@
     tSirRSNie            rsnIE;
     tSirAddie            addIE; // additional IE recevied from the peer, which possibly includes WSC IE and/or P2P IE.
     tSirMacCapabilityInfo capabilityInfo;
+    tAniTitanHtCapabilityInfo titanHtCaps;
+
     tAniBool                spectrumMgtIndicator;
     tSirMacPowerCapInfo     powerCap;
     tSirSupChnl             supportedChannels;
@@ -302,6 +304,8 @@
     tSirRSNie            rsnIE;
     tSirAddie            addIE; // additional IE recevied from the peer, which can be WSC IE and/or P2P IE.
     tSirMacCapabilityInfo capabilityInfo;
+    tAniTitanHtCapabilityInfo titanHtCaps;
+
     tAniBool                spectrumMgtIndicator;
     tSirMacPowerCapInfo     powerCap;
     tSirSupChnl             supportedChannels;
@@ -647,8 +651,11 @@
 
 void limGetRandomBssid(tpAniSirGlobal pMac ,tANI_U8 *data);
 
+// Function to handle CB CFG parameter updates
+void handleCBCFGChange( tpAniSirGlobal pMac, tANI_U32 cfgId );
+
 // Function to handle HT and HT IE CFG parameter intializations
-void handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry);
+void handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac);
 
 // Function to handle CFG parameter updates
 void limHandleCFGparamUpdate(tpAniSirGlobal, tANI_U32);
@@ -672,6 +679,7 @@
 // Function to cleanup LMM state machine
 void limCleanupLmm(tpAniSirGlobal);
 
+
 // Management frame handling functions
 void limProcessBeaconFrame(tpAniSirGlobal, tANI_U8 *,tpPESession);
 void limProcessBeaconFrameNoSession(tpAniSirGlobal, tANI_U8 *);
@@ -730,8 +738,8 @@
 void limContinueChannelScan(tpAniSirGlobal);
 tSirResultCodes limMlmAddBss(tpAniSirGlobal, tLimMlmStartReq *,tpPESession psessionEntry);
 
-#if 1 //(WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
-tSirRetStatus limSendChannelSwitchMgmtFrame(tpAniSirGlobal, tSirMacAddr, tANI_U8, tANI_U8, tANI_U8, tpPESession);
+#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
+tSirRetStatus limSendChannelSwitchMgmtFrame(tpAniSirGlobal, tSirMacAddr, tANI_U8, tANI_U8, tANI_U8);
 #endif
 
 #if defined WLAN_FEATURE_VOWIFI
@@ -785,7 +793,7 @@
 void limSetScanMode(tpAniSirGlobal pMac);
 
 /// Function that Switches the Channel and sets the CB Mode 
-void limSetChannel(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 secChannelOffset, tPowerdBm maxTxPower, tANI_U8 peSessionId);
+void limSetChannel(tpAniSirGlobal pMac, tANI_U32 titanHtcap, tANI_U8 channel, tPowerdBm maxTxPower, tANI_U8 peSessionId);
 
 /// Function that completes channel scan
 void limCompleteMlmScan(tpAniSirGlobal, tSirResultCodes);
@@ -811,6 +819,11 @@
 void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQt,tpPESession psessionEntry);
 void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
 void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession);
+#ifdef ANI_PRODUCT_TYPE_AP
+void limProcessApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
+void limProcessApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
+void limProcessApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ );
+#endif
 void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
 void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry);
 void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.c
index e245722..de4cfe7 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -216,6 +216,8 @@
 char *
 limMlmStateStr(tLimMlmStates state)
 {
+
+#ifdef FIXME_GEN6
     switch (state)
     {
         case eLIM_MLM_OFFLINE_STATE:
@@ -277,6 +279,8 @@
         default:
             return "INVALID MLM state\n";
     }
+#endif
+return "";
 }
 
 void
@@ -541,6 +545,10 @@
         case eWNI_SME_DELTS_IND:
             return "eWNI_SME_DELTS_IND\n";
 
+        case SIR_LIM_RESUME_ACTIVITY_NTF:
+            return "SIR_LIM_RESUME_ACTIVITY_NTF\n";
+        case SIR_LIM_SUSPEND_ACTIVITY_REQ:
+            return "SIR_LIM_SUSPEND_ACTIVITY_REQ\n";
         case WDA_SUSPEND_ACTIVITY_RSP:
             return "WDA_SUSPEND_ACTIVITY_RSP\n";
         case SIR_LIM_RETRY_INTERRUPT_MSG:
@@ -569,10 +577,22 @@
             return "SIR_LIM_REASSOC_FAIL_TIMEOUT\n";
         case SIR_LIM_HEART_BEAT_TIMEOUT:
             return "SIR_LIM_HEART_BEAT_TIMEOUT\n";
+#ifdef ANI_PRODUCT_TYPE_AP
+        case SIR_LIM_PREAUTH_CLNUP_TIMEOUT:
+            return "SIR_LIM_PREAUTH_CLNUP_TIMEOUT\n";
+#endif
         case SIR_LIM_ADDTS_RSP_TIMEOUT:
             return "SIR_LIM_ADDTS_RSP_TIMEOUT\n";
         case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
             return "SIR_LIM_CHANNEL_SCAN_TIMEOUT\n";
+#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
+        case SIR_LIM_MEASUREMENT_IND_TIMEOUT:
+            return "SIR_LIM_MEASUREMENT_IND_TIMEOUT\n";
+        case SIR_LIM_LEARN_INTERVAL_TIMEOUT:
+            return "SIR_LIM_LEARN_INTERVAL_TIMEOUT\n";
+        case SIR_LIM_LEARN_DURATION_TIMEOUT:
+            return "SIR_LIM_LEARN_DURATION_TIMEOUT\n";
+#endif
         case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
             return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT\n";
         case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
@@ -881,7 +901,7 @@
 void
 limInitMlm(tpAniSirGlobal pMac)
 {
-    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
+    MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
 
     /// Initialize scan result hash table
     limReInitScanResults(pMac); //sep26th review
@@ -1344,7 +1364,7 @@
     **/
     if (pMac->lim.gLimDeferredMsgQ.size > 0)
     {
-        PELOGW(limLog(pMac, LOGW, FL("%d Deferred messages (type 0x%x, scan %d, global sme %d, global mlme %d, addts %d)\n"),
+        PELOGW(limLog(pMac, LOGW, FL("%d Deferred messages (type 0x%x, scan %d, sme %d, mlme %d, addts %d)\n"),
                pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
                limIsSystemInScanState(pMac),
                pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
@@ -1453,7 +1473,7 @@
            pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
            msg->type);)
 
-   PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d\n"),
+   PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, sme %d, mlme %d, addts %d\n"),
            limIsSystemInScanState(pMac),
            pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
            pMac->lim.gLimAddtsSent);)
@@ -1597,10 +1617,7 @@
     tpPESession       psessionEntry = limIsApSessionActive(pMac);
 
     if (psessionEntry == NULL)
-    {
-        PELOGE(limLog(pMac, LOGE, FL(" Session not found\n"));)
         return;
-    }
     
     beaconParams.paramChangeBitmap = 0;
     /*
@@ -1626,7 +1643,7 @@
     else
     {
 
-        if (!psessionEntry->gLimOlbcParams.numSta)
+        if (!psessionEntry->gLimOverlap11gParams.numSta)
         {
             if (psessionEntry->gLimOlbcParams.protectionEnabled)
             {
@@ -1887,7 +1904,7 @@
     {
         //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
         //HT20 case is common between both the bands and handled down as common code.
-        if(true == psessionEntry->htCapability)
+        if(true == psessionEntry->htCapabality)
         {
             //we are 11N and 11A station is joining.        
             //protection from 11A required.            
@@ -1904,7 +1921,7 @@
 
         //We are 11G. Check if we need protection from 11b Stations.
         if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
-              (false == psessionEntry->htCapability))
+              (false == psessionEntry->htCapabality))
         {
 
             if (pStaDs->erpEnabled== eHAL_CLEAR)
@@ -1917,7 +1934,7 @@
         }
 
         //HT station.
-        if (true == psessionEntry->htCapability)
+        if (true == psessionEntry->htCapabality)
         {
             //check if we need protection from 11b station
             if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
@@ -1942,7 +1959,7 @@
     }
 
     //we are HT and HT station is joining. This code is common for both the bands.
-    if((true == psessionEntry->htCapability) &&
+    if((true == psessionEntry->htCapabality) &&
         (true == pStaDs->mlmStaContext.htCapability))
     {
         if(!pStaDs->htGreenfield)
@@ -2133,21 +2150,18 @@
     tpDphHashNode    pStaDs;
     tANI_U32 phyMode;
     tANI_U32 val;
+    tANI_U32 cShortSlot;
     tANI_U16 i;
 
     // check whether to enable protection or not
     pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
     limGetPhyMode(pMac, &phyMode, psessionEntry);
 
-    /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
-     * be always 1 and in 11b case, it should be always 0
-     */
     if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
     {
-        /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
-         * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
-         * it in limDecideShortSlot
-         */
+        if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, &cShortSlot) != eSIR_SUCCESS)
+            limLog(pMac, LOGP, FL("unable to get short slot time\n"));
+
         if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
         {
             PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
@@ -2226,28 +2240,27 @@
             wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
 
 #ifdef WLAN_SOFTAP_FEATURE
-            /* Here we check if we are AP role and short slot enabled (both admin and oper modes) but we have atleast one STA connected with
-             * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
-             */
             if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) && 
-                 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
+                 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && cShortSlot))
             {
                 // enable long slot time
                 pBeaconParams->fShortSlotTime = false;
                 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
                 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time.\n"));)
-                psessionEntry->shortSlotTimeSupported = false;
+                if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, false) != eSIR_SUCCESS)
+                    PELOGE(limLog(pMac, LOGE,   FL("could not update short slot time at CFG\n"));)
             }
             else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
 #endif            
             {
-                if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
+                if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && cShortSlot)
                 {
                     // enable long slot time
                     pBeaconParams->fShortSlotTime = false;
                     pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
                     PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time.\n"));)
-                    psessionEntry->shortSlotTimeSupported = false;
+                    if (cfgSetInt(pMac, WNI_CFG_SHORT_SLOT_TIME, false) != eSIR_SUCCESS)
+                        PELOGE(limLog(pMac, LOGE,   FL("could not update short slot time at CFG\n"));)
                  }
             }
         }
@@ -2407,7 +2420,7 @@
             }
         }
         //following code block is only for HT station.
-        if((psessionEntry->htCapability) &&
+        if((psessionEntry->htCapabality) &&
               (pBeaconStruct->HTInfo.present))
         {
             tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
@@ -2450,7 +2463,7 @@
     }
 
     //protection related factors other than HT operating mode. Applies to 2.4 GHZ as well as 5 GHZ.
-    if((psessionEntry->htCapability) &&
+    if((psessionEntry->htCapabality) &&
           (pBeaconStruct->HTInfo.present))
     {
         tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
@@ -2485,7 +2498,7 @@
     if(SIR_BAND_5_GHZ == rfBand)
     {
         //we are HT capable.
-        if((true == psessionEntry->htCapability) &&
+        if((true == psessionEntry->htCapabality) &&
             (pBeaconStruct->HTInfo.present))
         {
             //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.        
@@ -2535,7 +2548,7 @@
          }
 
         //following code block is only for HT station.
-        if((psessionEntry->htCapability) &&
+        if((psessionEntry->htCapabality) &&
               (pBeaconStruct->HTInfo.present))
         {
           
@@ -2579,7 +2592,7 @@
     }
 
     //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
-    if((psessionEntry->htCapability) &&
+    if((psessionEntry->htCapabality) &&
           (pBeaconStruct->HTInfo.present))
     {
         tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;    
@@ -2641,7 +2654,7 @@
 {
     tpPESession psessionEntry = NULL;
 #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
-    tANI_U8    channel; // This is received and stored from channelSwitch Action frame
+    tANI_U8    channel = pMac->lim.gLimChannelSwitch.primaryChannel;   // This is received and stored from channelSwitch Action frame
    
     if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL) 
     {
@@ -2654,7 +2667,6 @@
         PELOGW(limLog(pMac, LOGW, "Channel switch can be done only in STA role, Current Role = %d\n", psessionEntry->limSystemRole);)
         return;
     }
-    channel = psessionEntry->gLimChannelSwitch.primaryChannel;
     /*
      *  This potentially can create issues if the function tries to set
      * channel while device is in power-save, hence putting an extra check
@@ -2667,10 +2679,10 @@
     }
          
     // Restore Channel Switch parameters to default
-    psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
+    pMac->lim.gLimChannelSwitch.switchTimeoutValue = 0;
 
     /* Channel-switch timeout has occurred. reset the state */
-    psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
+    pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
     
     /* Check if the AP is switching to a channel that we support.
      * Else, just don't bother to switch. Indicate HDD to look for a 
@@ -2694,28 +2706,28 @@
                         eSIR_MAC_UNSPEC_FAILURE_REASON);
         return;
     }
-    switch(psessionEntry->gLimChannelSwitch.state)
+    switch(pMac->lim.gLimChannelSwitch.state)
     {
         case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
             PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_ONLY \n"));)
-            limSwitchPrimaryChannel(pMac, psessionEntry->gLimChannelSwitch.primaryChannel,psessionEntry);
-            psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
+            limSwitchPrimaryChannel(pMac, pMac->lim.gLimChannelSwitch.primaryChannel,psessionEntry);
+            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
             break;
 
         case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
             PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY \n"));)
-            limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
+            limSwitchPrimarySecondaryChannel(pMac,
                                              psessionEntry->currentOperChannel,
-                                             psessionEntry->gLimChannelSwitch.secondarySubBand);
-            psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
+                                             pMac->lim.gLimChannelSwitch.secondarySubBand);
+            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
             break;
 
         case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
             PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY\n"));)
-            limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
-                                             psessionEntry->gLimChannelSwitch.primaryChannel,
-                                             psessionEntry->gLimChannelSwitch.secondarySubBand);
-            psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
+            limSwitchPrimarySecondaryChannel(pMac,
+                                             pMac->lim.gLimChannelSwitch.primaryChannel,
+                                             pMac->lim.gLimChannelSwitch.secondarySubBand);
+            pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
             break;
 
         case eLIM_CHANNEL_SWITCH_IDLE:
@@ -2728,7 +2740,7 @@
             return;  /* Please note, this is 'return' and not 'break' */
     }
 #endif
-}
+    }
 
 /**
  * limUpdateChannelSwitch()
@@ -2748,11 +2760,18 @@
 {
 
     tANI_U16                         beaconPeriod;
+    tANI_U32                         val;
     tChannelSwitchPropIEStruct       *pPropChnlSwitch;
     tDot11fIEChanSwitchAnn           *pChnlSwitch;
 
  
-    beaconPeriod = psessionEntry->beaconParams.beaconInterval;
+
+    if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &val) != eSIR_SUCCESS)
+    {
+        limLog(pMac, LOGP, FL("Could not retrieve Beacon interval\n"));
+        return;
+    }
+    beaconPeriod = (tANI_U16) val;
 
     /* STA either received proprietary channel switch IE or 802.11h
      * standard channel switch IE.
@@ -2763,42 +2782,53 @@
 
         /* Add logic to determine which change this is:  */
         /*      primary, secondary, both.  For now assume both. */
-        psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
-        psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
-        psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
-        psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
-        psessionEntry->gLimChannelSwitch.switchTimeoutValue =
+        pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+        pMac->lim.gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
+        pMac->lim.gLimChannelSwitch.secondarySubBand = (tAniCBSecondaryMode)pPropChnlSwitch->subBand;
+        pMac->lim.gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
+        pMac->lim.gLimChannelSwitch.switchTimeoutValue =
                  SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
-        psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
+        pMac->lim.gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
     }
     else
     {
        pChnlSwitch = &(pBeacon->channelSwitchIE);
-       psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
-       psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
-       psessionEntry->gLimChannelSwitch.switchTimeoutValue =
+       pMac->lim.gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
+       pMac->lim.gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
+       pMac->lim.gLimChannelSwitch.switchTimeoutValue =
                  SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
-       psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode; 
+       pMac->lim.gLimChannelSwitch.switchMode = pChnlSwitch->switchMode; 
 
         /* Only primary channel switch element is present */
-        psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
-        psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
+        pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
+        pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_NONE;
 
         /* Do not bother to look and operate on extended channel switch element
          * if our own channel-bonding state is not enabled
          */
-        if (psessionEntry->htSupportedChannelWidthSet)
+        if(GET_CB_ADMIN_STATE(pMac->lim.gCbState))
         {
             if (pBeacon->extChannelSwitchPresent)
             {
-                if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) || 
-                    (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
+                switch(pBeacon->extChannelSwitchIE.secondaryChannelOffset)
                 {
-                    psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
-                    psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
+                    case eHT_SECONDARY_CHANNEL_OFFSET_UP:
+                        pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+                        pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_UP;
+                        break;
+
+                    case eHT_SECONDARY_CHANNEL_OFFSET_DOWN:
+                        pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
+                        pMac->lim.gLimChannelSwitch.secondarySubBand = eANI_CB_SECONDARY_DOWN;
+                        break;
+
+                    case eHT_SECONDARY_CHANNEL_OFFSET_NONE:
+                    default:
+                        /* Nothing to be done here as of now!! */
+                        break;
                 }
-            }
-        }
+           }
+       }
     }
 
     if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
@@ -2807,12 +2837,11 @@
     }
 
     limLog(pMac, LOGW,
-        FL("session %d primary chl %d, subband %d, count  %d (%d ticks) \n"),
-        psessionEntry->peSessionId,
-        psessionEntry->gLimChannelSwitch.primaryChannel,
-        psessionEntry->gLimChannelSwitch.secondarySubBand,
-        psessionEntry->gLimChannelSwitch.switchCount,
-        psessionEntry->gLimChannelSwitch.switchTimeoutValue);
+        FL("primary chl %d, subband %d, count  %d (%d ticks) \n"),
+        pMac->lim.gLimChannelSwitch.primaryChannel,
+        pMac->lim.gLimChannelSwitch.secondarySubBand,
+        pMac->lim.gLimChannelSwitch.switchCount,
+        pMac->lim.gLimChannelSwitch.switchTimeoutValue);
     return;
 }
 
@@ -2841,7 +2870,7 @@
         return;
         
     PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE\n"));)
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_CHANNEL_SWITCH_TIMER));
 
     if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
     {
@@ -2871,17 +2900,17 @@
     if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
         return;
 
-    if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) 
+    if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) 
     {
-         MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
+         MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_TIMER));
         if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
         {
             PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed\n"));)
         }
     }
-    else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
+    else if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
         if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
         {
             PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed\n"));)
@@ -2890,14 +2919,14 @@
          * If the channel switch is already running in silent mode, dont resume the
          * transmission. Channel switch timer when timeout, transmission will be resumed.
          */
-        if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
-                (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
+        if(!((pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
+                (pMac->lim.gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
         {
             limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
-            limRestorePreQuietState(pMac, psessionEntry);
+            limRestorePreQuietState(pMac);
         }
     }
-    psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
 #endif
 }
 
@@ -2932,40 +2961,25 @@
  */
 void limProcessQuietTimeout(tpAniSirGlobal pMac)
 {
+#ifdef GEN6_TODO
     //fetch the sessionEntry based on the sessionId
     //priority - MEDIUM
-    tpPESession psessionEntry;
+    tpPESession sessionEntry;
 
-    if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL) 
+    if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL) 
     {
-        limLog(pMac, LOGE,FL("Session Does not exist for given sessionID\n"));
+        limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
         return;
     }
+#endif
 
-  PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), psessionEntry->gLimSpecMgmt.quietState);)
-  switch( psessionEntry->gLimSpecMgmt.quietState )
+  PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), pMac->lim.gLimSpecMgmt.quietState);)
+  switch( pMac->lim.gLimSpecMgmt.quietState )
   {
     case eLIM_QUIET_BEGIN:
       // Time to Stop data traffic for quietDuration
-      //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
-      if (TX_SUCCESS !=
-      tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
-      {
-          limLog( pMac, LOGE,
-            FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway...\n"));
-      }
-
-      // gLimQuietDuration appears to be in units of ticks
-      // Use it as is
-      if (TX_SUCCESS !=
-          tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
-            psessionEntry->gLimSpecMgmt.quietDuration,
-            0))
-      {
-          limLog( pMac, LOGE,
-            FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway...\n"));
-      }
-      MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_QUIET_BSS_TIMER));
+      limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
+      MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_QUIET_BSS_TIMER));
 #ifdef GEN6_TODO
         /* revisit this piece of code to assign the appropriate sessionId below
          * priority - HIGH
@@ -2981,7 +2995,7 @@
       else
       {
         // Transition to eLIM_QUIET_RUNNING
-        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
+        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
 
         /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
         /* print message, otherwise, stop data traffic and stay quiet */
@@ -2999,7 +3013,7 @@
 
            limLog( pMac, LOG2,
                 FL("Quiet BSS: STA shutting down for %d ticks\n"),
-                psessionEntry->gLimSpecMgmt.quietDuration );
+                pMac->lim.gLimSpecMgmt.quietDuration );
         }
       }
       break;
@@ -3055,57 +3069,57 @@
  */
 void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
 {
-    tpPESession psessionEntry;
+    tpPESession sessionEntry;
 
-    if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL) 
+    if((sessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL) 
     {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
         return;
     }
 
-  PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), psessionEntry->gLimSpecMgmt.quietState);)
-  if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
+  PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), pMac->lim.gLimSpecMgmt.quietState);)
+  if (eLIM_AP_ROLE == sessionEntry->limSystemRole)
   {
 #ifdef ANI_PRODUCT_TYPE_AP
     if (!pMac->sys.gSysEnableLearnMode)
     {
-        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_END;
+        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
         return;
     }
 
-    if( eLIM_QUIET_INIT == psessionEntry->gLimSpecMgmt.quietState )
+    if( eLIM_QUIET_INIT == pMac->lim.gLimSpecMgmt.quietState )
     {
         //QuietCount = 0 is reserved
-        psessionEntry->gLimSpecMgmt.quietCount  = 2;
+        pMac->lim.gLimSpecMgmt.quietCount  = 2;
         // In ms.
-        psessionEntry->gLimSpecMgmt.quietDuration = 
+        pMac->lim.gLimSpecMgmt.quietDuration = 
         pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration;
         // TU is in multiples of 1024 (2^10) us.
-        psessionEntry->gLimSpecMgmt.quietDuration_TU = 
-            SYS_MS_TO_TU(psessionEntry->gLimSpecMgmt.quietDuration); 
+        pMac->lim.gLimSpecMgmt.quietDuration_TU = 
+            SYS_MS_TO_TU(pMac->lim.gLimSpecMgmt.quietDuration); 
         // Transition to eLIM_QUIET_BEGIN
         limLog( pMac, LOG2, FL("Quiet BSS state = eLIM_QUIET_BEGIN\n"));
-        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN;
+        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN;
     }
 #endif
   }
   else
   {
     // eLIM_STA_ROLE
-    switch( psessionEntry->gLimSpecMgmt.quietState )
+    switch( pMac->lim.gLimSpecMgmt.quietState )
     {
       case eLIM_QUIET_RUNNING:
         // Transition to eLIM_QUIET_INIT
-        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
 
         if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
         {
           // Resume data traffic only if channel switch is not running in silent mode.
-          if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
-                  (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
+          if (!((pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
+                  (pMac->lim.gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
           {
               limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
-              limRestorePreQuietState(pMac, psessionEntry);
+              limRestorePreQuietState(pMac);
           }
       
           /* Reset status flag */
@@ -3133,8 +3147,8 @@
         PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING\n"));)
         /* If the quiet period has ended, then resume the frame transmission */
         limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
-        limRestorePreQuietState(pMac, psessionEntry);
-        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+        limRestorePreQuietState(pMac);
+        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
         break;
 
       default:
@@ -3236,8 +3250,8 @@
         return;
     
    PELOG1(limLog(pMac, LOG1, FL("Quiet state = %d, Quiet Count = %d\n"),
-        psessionEntry->gLimSpecMgmt.quietState, pQuietIE->count);)
-    if (!psessionEntry->lim11hEnable)
+        pMac->lim.gLimSpecMgmt.quietState, pQuietIE->count);)
+    if (!pMac->lim.gLim11hEnable)
         return;
     // The (Titan) AP is requesting this (Titan) STA to
     // honor this Quiet IE REQ and shut-off Tx/Rx. If we're
@@ -3259,26 +3273,26 @@
         beaconPeriod = (tANI_U16) val;
 
      /* (qd * 2^10)/1000 */
-    psessionEntry->gLimSpecMgmt.quietDuration_TU = pQuietIE->duration;
+    pMac->lim.gLimSpecMgmt.quietDuration_TU = pQuietIE->duration;
     // The STA needs to shut-off Tx/Rx "for" this interval (in milliSeconds)
     /* Need to convert from TU to system TICKS */
-    psessionEntry->gLimSpecMgmt.quietDuration = SYS_MS_TO_TICKS(
-                           SYS_TU_TO_MS(psessionEntry->gLimSpecMgmt.quietDuration_TU));
+    pMac->lim.gLimSpecMgmt.quietDuration = SYS_MS_TO_TICKS(
+                           SYS_TU_TO_MS(pMac->lim.gLimSpecMgmt.quietDuration_TU));
 
-    if (psessionEntry->gLimSpecMgmt.quietDuration_TU == 0)
+    if (pMac->lim.gLimSpecMgmt.quietDuration_TU == 0)
     {
         PELOG1(limLog(pMac, LOG1, FL("Zero duration in quiet IE\n"));)
         return;
     }
     
     // The STA needs to shut-off Tx/Rx "after" this interval
-    psessionEntry->gLimSpecMgmt.quietTimeoutValue =
+    pMac->lim.gLimSpecMgmt.quietTimeoutValue =
               (beaconPeriod * pQuietIE->count) + pQuietIE->offset;
 
     limLog( pMac, LOG2,
         FL( "STA shut-off will begin in %d milliseconds & last for %d ticks\n"),
-        psessionEntry->gLimSpecMgmt.quietTimeoutValue,
-        psessionEntry->gLimSpecMgmt.quietDuration );
+        pMac->lim.gLimSpecMgmt.quietTimeoutValue,
+        pMac->lim.gLimSpecMgmt.quietDuration );
 
     /* Disable, Stop background scan if enabled and running */
     limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
@@ -3300,7 +3314,7 @@
         }
         else
         {
-            limRestorePreQuietState(pMac, psessionEntry);
+            limRestorePreQuietState(pMac);
         }
     }
     else
@@ -3311,7 +3325,7 @@
     }
     
     // Transition to eLIM_QUIET_BEGIN
-    psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN;
+    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN;
 #endif
 }
 
@@ -3340,29 +3354,17 @@
     // First, de-activate Timer, if its already active
     limCancelDot11hQuiet(pMac, psessionEntry);
     
-    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
-    if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
-    {
-        limLog( pMac, LOGE,
-            FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
-    }
-
-    // Set the NEW timeout value, in ticks
-    if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
-                      SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
-    {
-        limLog( pMac, LOGE,
-            FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
-    }
+    limDeactivateAndChangeTimer(pMac, eLIM_QUIET_TIMER);
+    MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_QUIET_TIMER));
     
     pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
     if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
     {
         limLog( pMac, LOGE,
             FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!\n"));
-        limRestorePreQuietState(pMac, psessionEntry);
+        limRestorePreQuietState(pMac);
 
-        psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+        pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
         return;
     }
 #endif
@@ -3472,6 +3474,59 @@
     schEdcaProfileUpdate(pMac, psessionEntry);
 }
 
+/** -------------------------------------------------------------
+\fn limGetHtCbAdminState
+\brief provides CB Admin state
+\param     tpAniSirGlobal    pMac
+\param     tDot11fIEHTCaps htCaps,
+\param     tANI_U8 *titanHtCaps 
+\return     none
+  -------------------------------------------------------------*/
+void limGetHtCbAdminState( tpAniSirGlobal pMac,
+        tDot11fIEHTCaps htCaps,
+        tANI_U8 *titanHtCaps )
+{
+    // Extract secondary channel info wrt Channel Bonding
+    if(htCaps.supportedChannelWidthSet)
+        SME_SET_CB_ADMIN_STATE( *titanHtCaps, eHAL_SET );    
+    else
+        SME_SET_CB_ADMIN_STATE( *titanHtCaps, eHAL_CLEAR);
+    
+
+  // And the final TITAN HT capabilities bitmap is...
+  limLog( pMac, LOG2,
+      FL("TITAN HT capabilities in BSS Description = %1d\n"),
+        *titanHtCaps);
+}
+/** -------------------------------------------------------------
+\fn limGetHtCbOpState
+\brief provides CB operational state
+\param     tpAniSirGlobal    pMac
+\param     tDot11fIEHTInfo htInfo,
+\param     tANI_U8 *titanHtCaps
+\return     none
+  -------------------------------------------------------------*/
+void limGetHtCbOpState( tpAniSirGlobal pMac,
+        tDot11fIEHTInfo htInfo,
+        tANI_U8 *titanHtCaps )
+{
+    // Extract secondary channel info wrt Channel Bonding
+    if(htInfo.secondaryChannelOffset)
+    {
+      if(PHY_DOUBLE_CHANNEL_LOW_PRIMARY == htInfo.secondaryChannelOffset)
+          SME_SET_CB_OPER_STATE( *titanHtCaps,
+            eANI_CB_SECONDARY_UP );
+      else if(PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == htInfo.secondaryChannelOffset)
+          SME_SET_CB_OPER_STATE( *titanHtCaps,
+            eANI_CB_SECONDARY_DOWN );
+    }
+
+  // And the final TITAN HT capabilities bitmap is...
+  limLog( pMac, LOG2,
+      FL("TITAN HT capabilities in BSS Description = %1d\n"),
+        *titanHtCaps);
+}
+
 /**
  * limSwitchChannelCback()
  *
@@ -3492,6 +3547,9 @@
    tSirMsgQ    mmhMsg = {0};
    tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
 
+   PELOG1(limLog(pMac, LOG1,FL("Sending message %s with reasonCode %s\n"),
+                    limMsgStr(msgType), limResultCodeStr(resultCode));)
+
    psessionEntry->currentOperChannel = psessionEntry->currentReqChannel; 
    
    /* We need to restore pre-channelSwitch state on the STA */
@@ -3510,14 +3568,14 @@
   
    pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
    pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
-   pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
+   pSirSmeSwitchChInd->newChannelId = pMac->lim.gLimChannelSwitch.primaryChannel;
    pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
    //BSS ID
    palCopyMemory( pMac->hHdd, pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
    mmhMsg.bodyptr = pSirSmeSwitchChInd;
    mmhMsg.bodyval = 0;
    
-   MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
    
 #if defined( FEATURE_WLAN_INTEGRATED_SOC )
    SysProcessMmhMsg(pMac, &mmhMsg);
@@ -3559,7 +3617,7 @@
     pMac->lim.gpchangeChannelData = NULL;
 
 #if defined WLAN_FEATURE_VOWIFI  
-    limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
+    limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE,
                                                    psessionEntry->maxTxPower, psessionEntry->peSessionId);
 #else
     if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
@@ -3567,7 +3625,7 @@
         limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg\n" ));
         return;
     }
-    limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
+    limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE,
                                                    (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
 #endif
     return;
@@ -3592,12 +3650,13 @@
  *                       - eANI_CB_SECONDARY_DOWN
  * @return NONE
  */
-void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
+void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel, tAniCBSecondaryMode subband)
 {
 #if !defined WLAN_FEATURE_VOWIFI  
     tANI_U32 localPwrConstraint;
 #endif
 
+    tpPESession psessionEntry =  &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
 #if !defined WLAN_FEATURE_VOWIFI  
     if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
         limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg\n" ));
@@ -3605,36 +3664,95 @@
     }
 #endif
 
-#if defined WLAN_FEATURE_VOWIFI  
-                limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
-#else
-                limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
-#endif
+    switch(subband)
+    {
+        case eANI_CB_SECONDARY_NONE:
+            PELOGW(limLog(pMac, LOGW, FL("Disable CB SECONDARY\n"));)
+            /* If CB was on, turn it off, otherwise, do nothing */
+            if(GET_CB_OPER_STATE(pMac->lim.gCbState))
+            {
+                /* Turn off CB in HW and SW.  SW and HW cbstate must match!  Otherwise, will hit ASSERT case */
+                SET_CB_OPER_STATE(pMac->lim.gCbState, eHAL_CLEAR);
+                /* Clean up station entry if we're not STA */
+            }
+            if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_NONE) != eSIR_SUCCESS)
+                limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
 
-    // Store the new primary and secondary channel in session entries if different
-    if (psessionEntry->currentOperChannel != newChannel)
+#if defined WLAN_FEATURE_VOWIFI  
+            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+#else
+            //Send Message to HAL to update the channel
+            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
+#endif
+            break;
+
+        case eANI_CB_SECONDARY_UP:
+            PELOGW(limLog(pMac, LOGW, FL("Switch CB SECONDARY to UP.\n"));)
+            SET_CB_SEC_CHANNEL(pMac->lim.gCbState, eHAL_SET);
+            if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_HIGHER) != eSIR_SUCCESS)
+                limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
+
+            /* If CB was off, turn it on, otherwise, do nothing */
+            if(!GET_CB_OPER_STATE(pMac->lim.gCbState))
+            {
+                /* Turn on CB in HW and SW.  SW and HW cbstate must match!  Otherwise, will hit ASSERT case */
+                SET_CB_OPER_STATE(pMac->lim.gCbState, eHAL_SET);
+            }
+            //Send Message to HAL to update the channel
+            //enums for secondary channel offset for Titan and 11n are different
+#if defined WLAN_FEATURE_VOWIFI  
+            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_UP, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+#else
+            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_UP, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
+#endif
+            break;
+
+        case eANI_CB_SECONDARY_DOWN:
+            PELOGW(limLog(pMac, LOGW, FL("Switch CB SECONDARY to LOWER.\n"));)
+            SET_CB_SEC_CHANNEL(pMac->lim.gCbState, eHAL_CLEAR);
+            if (cfgSetInt(pMac, WNI_CFG_CB_SECONDARY_CHANNEL_STATE, WNI_CFG_CB_SECONDARY_CHANNEL_STATE_LOWER) != eSIR_SUCCESS)
+                limLog(pMac, LOGP, FL("cfgSetInt WNI_CFG_CB_SECONDARY_CHANNEL_STATE failed \n"));
+            /* If CB was off, turn it on, otherwise, do nothing */
+            if(!GET_CB_OPER_STATE(pMac->lim.gCbState))
+            {
+                /* Turn on CB in HW and SW.  SW and HW cbstate must match!  Otherwise, will hit ASSERT case */
+                SET_CB_OPER_STATE(pMac->lim.gCbState, eHAL_SET);
+                /* Update station entry if we're not STA */
+            }
+            //Send Message to HAL to update the channel
+            //enums for secondary channel offset for Titan and 11n are different
+#if defined WLAN_FEATURE_VOWIFI  
+            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_NONE, psessionEntry->maxTxPower, psessionEntry->peSessionId);
+#else
+            limSendSwitchChnlParams(pMac, newChannel, eHT_SECONDARY_CHANNEL_OFFSET_DOWN, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
+#endif
+            break;
+
+        case eANI_DONOT_USE_SECONDARY_MODE:
+            break;
+    }
+
+
+    // We should only be changing primary and secondary channels on the fly
+    // if this is 11h enabled.
+    if (
+#if 0
+        pMac->lim.gLim11hEnable &&
+#endif
+        psessionEntry->currentOperChannel != newChannel)
     {
         limLog(pMac, LOGW,
             FL("switch old chnl %d --> new chnl %d \n"),
             psessionEntry->currentOperChannel, newChannel);
+
+        #if 0
+
+        if (cfgSetInt(pMac, WNI_CFG_CURRENT_CHANNEL, newChannel) != eSIR_SUCCESS)
+            limLog(pMac, LOGP, FL("set CURRENT_CHANNEL at CFG fail.\n"));
+        #endif // TO SUPPORT BT-AMP
+
         psessionEntry->currentOperChannel = newChannel;
     }
-    if (psessionEntry->htSecondaryChannelOffset != subband)
-    {
-        limLog(pMac, LOGW,
-            FL("switch old sec chnl %d --> new sec chnl %d \n"),
-            psessionEntry->htSecondaryChannelOffset, subband);
-        psessionEntry->htSecondaryChannelOffset = subband;
-        if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
-        {
-            psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
-        }
-        else
-        {
-            psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
-        }
-        psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
-    }
 
     return;
 }
@@ -3735,7 +3853,7 @@
     if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
         return bScanTriggered;
     
-    if( !psessionEntry->lim11hEnable )
+    if( !pMac->lim.gLim11hEnable )
     {
         tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
         tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
@@ -3923,7 +4041,7 @@
       break;
 
     case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
-      retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
+      retVal = (tANI_U8) macHTCapabilityInfo.supportedChannelWidthSet;
       break;
 
     case eHT_ADVANCED_CODING:
@@ -3971,11 +4089,11 @@
       break;
 
     case eHT_RECOMMENDED_TX_WIDTH_SET:
-      retVal = psessionEntry->htRecommendedTxWidthSet;
+      retVal = pMac->lim.gHTRecommendedTxWidthSet;
       break;
 
     case eHT_EXTENSION_CHANNEL_OFFSET:
-      retVal = psessionEntry->htSecondaryChannelOffset;
+      retVal = pMac->lim.gHTSecondaryChannelOffset;
       break;
 
     case eHT_OP_MODE:
@@ -4014,6 +4132,20 @@
   return retVal;
 }
 
+#if 0
+void limSetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId)
+{
+    palCopyMemory( pMac->hHdd, pMac->lim.gLimBssid, bssId, sizeof(tSirMacAddr));
+    return;
+}
+
+void limGetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId)
+{
+    palCopyMemory( pMac->hHdd, bssId, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
+    return;
+}
+
+#endif
 void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
 {
     palCopyMemory( pMac->hHdd, mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
@@ -4051,8 +4183,7 @@
         else
         {
             //normal protection config check
-            if (( psessionEntry != NULL ) && (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
-                (!psessionEntry->cfgProtection.fromlla))
+            if(!pMac->lim.cfgProtection.fromlla)
             {
                 // protection disabled.
                 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled\n"));)
@@ -4065,7 +4196,7 @@
         //If we are AP and HT capable, we need to set the HT OP mode
         //appropriately.
         if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
-              (true == psessionEntry->htCapability))
+              (true == psessionEntry->htCapabality))
         {
             if(overlap)
             {
@@ -4085,7 +4216,6 @@
                 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
                 {
                     pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
-                    psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
                     limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
                     limEnableHtOBSSProtection(pMac,  true, overlap, pBeaconParams,psessionEntry);         
                     
@@ -4114,7 +4244,7 @@
                 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
 
                 //We need to take care of HT OP mode iff we are HT AP.
-                if(psessionEntry->htCapability)
+                if(psessionEntry->htCapabality)
                 {
                    // no HT op mode change if any of the overlap protection enabled.
                     if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
@@ -4153,19 +4283,16 @@
 
                 {
                         pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
-                        psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
                         limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
                 }
                 else if(psessionEntry->gLimHt20Params.protectionEnabled)
                 {
                         pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
-                        psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
                         limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
                 }
                 else
                 {
                         pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
-                        psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
                         limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
                 }
             }
@@ -4248,7 +4375,7 @@
             {
                 psessionEntry->gLimOlbcParams.protectionEnabled = true;
                 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled\n"));)
-                if(true == psessionEntry->htCapability)
+                if(true == psessionEntry->htCapabality)
                 {
                     if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
                             (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
@@ -4267,7 +4394,7 @@
             {
                 psessionEntry->gLim11bParams.protectionEnabled = true;
                 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled\n"));)
-                if(true == psessionEntry->htCapability)
+                if(true == psessionEntry->htCapabality)
                 {
                     if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
                     {
@@ -4278,10 +4405,10 @@
                 }
             }
         }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
-                (true == psessionEntry->htCapability))
+                (true == psessionEntry->htCapabality))
 #else
             if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)|| (eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)) &&
-                    (true == psessionEntry->htCapability))
+                    (true == psessionEntry->htCapabality))
 #endif
             {
                 if(overlap)
@@ -4333,7 +4460,7 @@
                 psessionEntry->gLimOlbcParams.protectionEnabled = false;
 
                 //We need to take care of HT OP mode if we are HT AP.
-                if(psessionEntry->htCapability)
+                if(psessionEntry->htCapabality)
                 {
                     // no HT op mode change if any of the overlap protection enabled.
                     if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
@@ -4411,7 +4538,7 @@
                 psessionEntry->gLimOlbcParams.protectionEnabled = false;
 
                     //We need to take care of HT OP mode iff we are HT AP.
-                    if(psessionEntry->htCapability)
+                    if(psessionEntry->htCapabality)
                     {
                         // no HT op mode change if any of the overlap protection enabled.
                         if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
@@ -4496,7 +4623,7 @@
 limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
     tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
 {
-    if(!psessionEntry->htCapability)
+    if(!psessionEntry->htCapabality)
         return eSIR_SUCCESS; // protection from 11g is only for HT stations.
 
     //overlapping protection configuration check.
@@ -4796,7 +4923,7 @@
 {
 
 
-    if(!psessionEntry->htCapability)
+    if(!psessionEntry->htCapabality)
         return eSIR_SUCCESS; // this protection  is only for HT stations.
 
     //overlapping protection configuration check.
@@ -4888,7 +5015,7 @@
 limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
     tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
 {
-    if(!psessionEntry->htCapability)
+    if(!psessionEntry->htCapabality)
         return eSIR_SUCCESS; // this protection  is only for HT stations.
 
         //overlapping protection configuration check.
@@ -5116,7 +5243,7 @@
 limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
     tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
 {
-    if(!psessionEntry->htCapability)
+    if(!psessionEntry->htCapabality)
         return eSIR_SUCCESS; // this protection  is only for HT stations.
 
         //overlapping protection configuration check.
@@ -5199,7 +5326,7 @@
 limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
     tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
 {
-    if(!psessionEntry->htCapability)
+    if(!psessionEntry->htCapabality)
         return eSIR_SUCCESS; // this protection  is only for HT stations.
 
         //overlapping protection configuration check.
@@ -5284,7 +5411,7 @@
 limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
     tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
 {
-    if(!psessionEntry->htCapability)
+    if(!psessionEntry->htCapabality)
         return eSIR_SUCCESS; // this protection  is only for HT stations.
 
 
@@ -5476,7 +5603,7 @@
         if(VOS_IS_STATUS_SUCCESS(vosStatus))
         {
             mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
-            MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, NO_SESSION, mHdr->fc.subType);)
+            MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, 0, mHdr->fc.subType);)
 
         }   
     }
@@ -5514,7 +5641,7 @@
                                   tANI_U8          bssIdx,
                                   tpPESession      psessionEntry)
 {
-    ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
+    tSirMacHTSecondaryChannelOffset secondaryChnlOffset = eHT_SECONDARY_CHANNEL_OFFSET_NONE;
 #if !defined WLAN_FEATURE_VOWIFI  
     tANI_U32 localPwrConstraint;
 #endif
@@ -5534,13 +5661,20 @@
     }
 #endif
 
-    if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
-         psessionEntry->htRecommendedTxWidthSet  != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
+    if ( pMac->lim.gHTSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
+         pMac->lim.gHTRecommendedTxWidthSet  != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
     {
-        psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
-        psessionEntry->htRecommendedTxWidthSet  = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
-        if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
-            secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
+        pMac->lim.gHTSecondaryChannelOffset = ( tSirMacHTSecondaryChannelOffset ) pHTInfo->secondaryChannelOffset;
+        pMac->lim.gHTRecommendedTxWidthSet  = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
+        //Also update the Proprietary(Titan) CB mode settings, as this setting is used during 
+        //background scanning to set the original channel and CB mode as part of finish scan.
+        setupCBState( pMac,  limGetAniCBState(pMac->lim.gHTSecondaryChannelOffset));
+
+        // If the Channel Width is 20Mhz, set the channel offset to
+        // NONE.  If the Channel Width is 40Mhz, set the channel offset
+        // to what ever is present in beacon.
+        if ( eHT_CHANNEL_WIDTH_40MHZ == pMac->lim.gHTRecommendedTxWidthSet )
+            secondaryChnlOffset = (tSirMacHTSecondaryChannelOffset)pHTInfo->secondaryChannelOffset;
 
         // Notify HAL
         limLog( pMac, LOGW,  FL( "Channel Information in HT IE change"
@@ -5548,10 +5682,7 @@
         limLog( pMac, LOGW,  FL( "Primary Channel: %d, Secondary Chan"
                                  "nel Offset: %d, Channel Width: %d\n" ),
                 pHTInfo->primaryChannel, secondaryChnlOffset,
-                psessionEntry->htRecommendedTxWidthSet );
-        psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
-        pMac->lim.gpchangeChannelCallback = NULL;
-        pMac->lim.gpchangeChannelData = NULL;
+                pMac->lim.gHTRecommendedTxWidthSet );
 
 #if defined WLAN_FEATURE_VOWIFI  
         limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
@@ -5625,9 +5756,15 @@
 void limUpdateStaRunTimeHTInfo( tpAniSirGlobal  pMac,
                                 tDot11fIEHTInfo *pHTInfo , tpPESession psessionEntry)
 {
-    if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
+    if ( pMac->lim.gHTSecondaryChannelOffset != ( tANI_U8)pHTInfo->secondaryChannelOffset)
     {
-        psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
+        pMac->lim.gHTSecondaryChannelOffset = ( tSirMacHTSecondaryChannelOffset )pHTInfo->secondaryChannelOffset;
+        // Send change notification to HAL
+    }
+
+    if ( pMac->lim.gHTRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
+    {
+        pMac->lim.gHTRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
         // Send change notification to HAL
     }
 
@@ -5869,7 +6006,7 @@
            psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
       {
         //send message to HAL to delete TS
-        if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, pDeltsReq->req, psessionEntry->peSessionId))
+        if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, pDeltsReq->req))
         {
           limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request\n"),
                            tsinfo->traffic.userPrio);
@@ -5904,7 +6041,7 @@
     msg.bodyptr = pHalCB;
     msg.bodyval = 0;
     
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msg.type));
     if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
     {
         palFreeMemory(pMac->hHdd, pHalCB);
@@ -5953,7 +6090,7 @@
     }
        
     //if we are not HT capable we don't need to handle BA timeout indication from HAL.
-    if( (baCandidateCnt  > pMac->lim.maxStation) || !psessionEntry->htCapability )
+    if( (baCandidateCnt  > pMac->lim.maxStation) || !psessionEntry->htCapabality )
     {
         palFreeMemory(pMac->hHdd, limMsg->bodyptr);
         return;
@@ -6063,7 +6200,6 @@
 if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
     {
          limLog(pMac, LOGE,FL("session does not exist for given BssId\n"));
-         palFreeMemory(pMac->hHdd, (void *)(limMsg->bodyptr));
          return;
     }
 
@@ -6534,7 +6670,7 @@
   //defer any other message until we get response back.
   SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
 
-  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -6627,7 +6763,7 @@
   limLog( pMac, LOGW,
       FL( "Sending SIR_HAL_DELBA_IND..." ));
 
-  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT 
     limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
 #endif //FEATURE_WLAN_DIAG_SUPPORT
@@ -6707,7 +6843,7 @@
 
     limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
 
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     retCode = wdaPostCtrlMsg( pMac, &msgQ );
     if (eSIR_SUCCESS != retCode)
     {
@@ -6959,7 +7095,7 @@
     msgQ.reserved = 0;
     msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
 
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
     {
         palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg);
@@ -7009,7 +7145,7 @@
         return retCode;
     
     /* Channel switch should be ready for the next time */
-    psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
+    pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
 
     /* Restore the frame transmission, all the time. */
     limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
@@ -7031,7 +7167,7 @@
 
         if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
         {
-            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
+            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
             if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
             {
                 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
@@ -7044,7 +7180,7 @@
     /* Enable heartbeat timer */
     if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
         if(limActivateHearBeatTimer(pMac) != TX_SUCCESS)
         {
             limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
@@ -7063,7 +7199,7 @@
 \param pMac
 \return NONE
 ---------------------------------------------*/
-tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
+tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac)
 {
 
     tSirRetStatus retCode = eSIR_SUCCESS;
@@ -7074,10 +7210,10 @@
              return retCode;
  
     /* Quiet should be ready for the next time */
-    psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
+    pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
 
     /* Restore the frame transmission, all the time. */
-    if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
+    if (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
         limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
 
 
@@ -7095,7 +7231,7 @@
 
         if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
         {
-            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
+            MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_BACKGROUND_SCAN_TIMER));
             if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
             {
                 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
@@ -7108,7 +7244,7 @@
     /* Enable heartbeat timer */
     if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
     {
-        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_HEART_BEAT_TIMER));
+        MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
         if(limActivateHearBeatTimer(pMac) != TX_SUCCESS)
         {
             limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
@@ -7147,7 +7283,7 @@
         return;
      
     /* Flag to indicate 11h channel switch in progress */
-    psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
+    pMac->lim.gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
 
     /* Disable, Stop background scan if enabled and running */
     limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
@@ -7409,7 +7545,6 @@
     if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
     {
         limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
-        palFreeMemory(pMac, pAddStaParams);
         return;
     }
     if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
@@ -7605,7 +7740,6 @@
    {
       /// Buffer not available. Log error
       limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP\n"));
-      palFreeMemory( pMac->hHdd, (tANI_U8 *)pAddStaSelfParams);
       return;
    }
 
@@ -7622,7 +7756,7 @@
    mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
    mmhMsg.bodyptr = pRsp;
    mmhMsg.bodyval = 0;
-   MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
    limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 
 }
@@ -7641,7 +7775,6 @@
    {
       /// Buffer not available. Log error
       limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP\n"));
-      palFreeMemory( pMac->hHdd, (tANI_U8 *)pDelStaSelfParams);
       return;
    }
 
@@ -7658,7 +7791,7 @@
    mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
    mmhMsg.bodyptr = pRsp;
    mmhMsg.bodyval = 0;
-   MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
    limSysProcessMmhMsgApi(pMac, &mmhMsg,  ePROT);
 
 }
@@ -7702,7 +7835,7 @@
         if(elem_len > left)
         {
             limLog(pMac, LOGE,
-                    FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
+                    "****Invalid IEs eid = %d elem_len=%d left=%d*****\n",
                                                     eid,elem_len,left);
             return NULL;
         }
@@ -7855,20 +7988,19 @@
     return 0;
         
 }
-
-void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
+void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, tANI_U8 cbState)
 {
 
    pMac->lim.gResumeChannel = channel;
-   pMac->lim.gResumePhyCbState = phyCbState;
-}
+   //TODO : Save Cb State also.
 
+}
 /*--------------------------------------------------------------------------
   
   \brief peGetResumeChannel() - Returns the  channel number for scanning, from a valid session.
 
-  This function returns the channel to resume to during link resume. channel id of 0 means HAL will
-  resume to previous channel before link suspend
+  This function itrates the session Table and returns the channel number from first valid session
+   if no sessions are valid/present  it returns zero
     
   \param pMac                   - pointer to global adapter context
   \return                           - channel to scan from valid session else zero.
@@ -7876,27 +8008,27 @@
   \sa
   
   --------------------------------------------------------------------------*/
-void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
+
+tANI_U8 peGetResumeChannel(tpAniSirGlobal pMac)
+
 {
 
     //Rationale - this could be the suspend/resume for assoc and it is essential that
     //the new BSS is active for some time. Other BSS was anyway suspended.
     //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
     //there will be trouble. But since it is sent on current channel, it will be missed by peer
-    //and hence should be ok. Need to discuss this further
-    if( !limIsInMCC(pMac) )    
+    //and hence shpuld be ok. Need to discuss this further
+    if( !IS_MCC_SUPPORTED )    
     {
         //Get current active session channel
-        peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
+        return peGetActiveSessionChannel(pMac);
     }
     else
     {
-        *resumeChannel = pMac->lim.gResumeChannel;
-        *resumePhyCbState = pMac->lim.gResumePhyCbState;
+        return pMac->lim.gResumeChannel;
     }
-    return;
-}
 
+}
 
 #endif
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.h b/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.h
index 3f1687d..1aa6355 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limUtils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -193,8 +193,10 @@
 
 void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId);
 void limUpdateQuietIEFromBeacon(tpAniSirGlobal, tDot11fIEQuiet *, tpPESession);
+void limGetHtCbAdminState(tpAniSirGlobal pMac, tDot11fIEHTCaps htCaps, tANI_U8 * titanHtCaps);
+void limGetHtCbOpState(tpAniSirGlobal pMac, tDot11fIEHTInfo htInfo, tANI_U8 * titanHtCaps);
 void limSwitchPrimaryChannel(tpAniSirGlobal, tANI_U8,tpPESession);
-void limSwitchPrimarySecondaryChannel(tpAniSirGlobal, tpPESession, tANI_U8, ePhyChanBondState);
+void limSwitchPrimarySecondaryChannel(tpAniSirGlobal, tANI_U8, tAniCBSecondaryMode);
 tAniBool limTriggerBackgroundScanDuringQuietBss(tpAniSirGlobal);
 void limUpdateStaRunTimeHTSwtichChnlParams(tpAniSirGlobal pMac, tDot11fIEHTInfo *pRcvdHTInfo, tANI_U8 bssIdx);
 void limUpdateStaRunTimeHTCapability(tpAniSirGlobal pMac, tDot11fIEHTCaps *pHTCaps);
@@ -204,7 +206,7 @@
 tAniBool limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel);
 void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode);
 tSirRetStatus limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry);
-tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry);
+tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac);
 
 void limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry);
 void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status, 
@@ -462,13 +464,13 @@
 void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode);
 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
 
-void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState cbState);
+void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, tANI_U8 cbState);
 /*--------------------------------------------------------------------------
   
   \brief peGetResumeChannel() - Returns the  channel number for scanning, from a valid session.
 
-  This function returns the channel to resume to during link resume. channel id of 0 means HAL will
-  resume to previous channel before link suspend
+  This function itrates the session Table and returns the channel number from first valid session
+   if no sessions are valid it returns 0
     
   \param pMac                   - pointer to global adapter context
   \return                            - channel to scan from valid session else zero.
@@ -476,6 +478,7 @@
   \sa
   
   --------------------------------------------------------------------------*/
-void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState);
+tANI_U8 peGetResumeChannel(tpAniSirGlobal pMac);
+
 
 #endif /* __LIM_UTILS_H */
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmAP.c b/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmAP.c
index 3008627..8117d24 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmAP.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmAP.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmApi.c b/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmApi.c
index 43627d6..88f11ec 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmApi.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -230,7 +230,7 @@
     //If response is failure, then send the response back to PMC and reset its state.
     if(rspStatus == eHAL_STATUS_SUCCESS)
     {
-        PELOG2(pmmLog(pMac, LOG2,
+        PELOGW(pmmLog(pMac, LOGW,
             FL("pmmBmps: Received successful response from HAL to enter BMPS_POWER_SAVE \n"));)
 
         pMac->pmm.gPmmState = ePMM_STATE_BMPS_SLEEP;
@@ -246,7 +246,7 @@
             /* Disable heartbeat timer as well */
             if(pMac->lim.limTimers.gLimHeartBeatTimer.pMac)
             {
-                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_HEART_BEAT_TIMER));
+                MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
                 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
             }
         }
@@ -428,8 +428,8 @@
     if ( ((pMac->pmm.gPmmState != ePMM_STATE_READY) &&
          (pMac->pmm.gPmmState != ePMM_STATE_BMPS_WAKEUP)) ||
          limIsSystemInScanState(pMac) ||
-         limIsChanSwitchRunning(pMac) ||
-         limIsInQuietDuration(pMac) )
+         (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) ||
+         (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
     {
         PELOGE(pmmLog(pMac, LOGE, 
             FL("pmmBmps: BMPS Request received in invalid state PMM=%d, SME=%d, rejecting the initpwrsave request\n"), 
@@ -524,7 +524,6 @@
     tSirRetStatus  retStatus = eSIR_SUCCESS;
     tpExitBmpsParams  pExitBmpsParams;
     tSirMsgQ msgQ;
-    tpPESession psessionEntry;
     tANI_U8  currentOperatingChannel = limGetCurrentOperatingChannel(pMac);
 
     if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pExitBmpsParams, sizeof(*pExitBmpsParams)) )
@@ -534,12 +533,6 @@
         return retStatus;
     }
 
-    if((psessionEntry = peGetValidPowerSaveSession(pMac)) == NULL )
-    {
-        retStatus = eSIR_FAILURE;
-        return retStatus;
-    }
-
     palZeroMemory( pMac->hHdd, (tANI_U8 *)pExitBmpsParams, sizeof(*pExitBmpsParams));
     msgQ.type = WDA_EXIT_BMPS_REQ;
     msgQ.reserved = 0;
@@ -557,13 +550,11 @@
              limIsconnectedOnDFSChannel(currentOperatingChannel))))
         pExitBmpsParams->sendDataNull = 1;
 
-    pExitBmpsParams->bssIdx = psessionEntry->bssIdx;
-   
     /* we need to defer any incoming messages until we
      * get a WDA_EXIT_BMPS_RSP from HAL.
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     retStatus = wdaPostCtrlMsg( pMac, &msgQ);
     if( eSIR_SUCCESS != retStatus )
     {
@@ -639,7 +630,7 @@
     pBmpsParams->bRssiFilterEnable = bRssiFilterEnable;
 
 
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
     // If there is a CCX assoc or 11r assoc we need to pick up the rssiFilterPeriod from the
     // FT config value.
     for(i =0; i < pMac->lim.maxBssId; i++)
@@ -680,7 +671,7 @@
     msgQ.bodyptr = pBmpsParams;
     msgQ.bodyval = 0;
 
-    PELOG2(pmmLog( pMac, LOG2,
+    PELOGW(pmmLog( pMac, LOGW,
         FL( "pmmBmps: Sending WDA_ENTER_BMPS_REQ" ));)
 
     /* we need to defer any incoming messages until we get a
@@ -688,7 +679,7 @@
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
 
-    MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         palFreeMemory(pMac->hHdd, pBmpsParams);
@@ -733,7 +724,7 @@
     if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE  )
     {
         pmmLog(pMac, LOGE,
-            FL("pmmCfg: Power Save Configuration received in invalid global sme state %d"),
+            FL("pmmCfg: Power Save Configuration received in invalid state %d"),
             pMac->lim.gLimSmeState);
         retCode = eSIR_SME_INVALID_STATE;
         goto returnFailure;
@@ -794,7 +785,7 @@
     msgQ.bodyval = 0;
 
     PELOG1(pmmLog( pMac, LOG1, FL( "pmmBmps: Sending WDA_PWR_SAVE_CFG to HAL"));)
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
     {
         pmmLog( pMac, LOGP,
@@ -911,15 +902,7 @@
     pMac->sys.gSysEnableScanMode = true;
 
     // send response to PMC
-   if(IS_SLM_SESSIONIZATION_SUPPORTED_BY_FW )
-   {
-       limSendSmeRsp(pMac, eWNI_PMC_EXIT_BMPS_RSP, retStatus, 
-                  psessionEntry->smeSessionId, psessionEntry->transactionId);
-   }
-   else
-   {
-       limSendSmeRsp(pMac, eWNI_PMC_EXIT_BMPS_RSP, retStatus, 0, 0);
-   }
+    limSendSmeRsp(pMac, eWNI_PMC_EXIT_BMPS_RSP, retStatus, 0, 0);
 
     if ( pMac->pmm.gPmmExitBmpsReasonCode == eSME_MISSED_BEACON_IND_RCVD)
     {
@@ -1510,11 +1493,11 @@
          ((pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE) &&
           (pMac->lim.gLimSmeState != eLIM_SME_JOIN_FAILURE_STATE)) ||
          (pMac->lim.gLimMlmState != eLIM_MLM_IDLE_STATE) ||
-         limIsChanSwitchRunning (pMac) ||
-         limIsInQuietDuration (pMac) )
+         (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) ||
+         (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
     {
         PELOGE(pmmLog(pMac, LOGE, 
-              FL("pmmImps: PMM State = %d, Global MLM State = %d, Global SME State = %d, rejecting the sleep mode request\n"),
+              FL("pmmImps: PMM State = %d, MLM State = %d, SME State = %d, rejecting the sleep mode request\n"),
               pMac->pmm.gPmmState, pMac->lim.gLimMlmState, pMac->lim.gLimSmeState);)
 
         resultCode = eSIR_SME_INVALID_PMM_STATE;
@@ -1596,7 +1579,7 @@
         //if success, change the state to IMPS sleep mode
         pMac->pmm.gPmmState = ePMM_STATE_IMPS_SLEEP;
 
-        PELOG2(pmmLog(pMac, LOG2,
+        PELOGW(pmmLog(pMac, LOGW,
             FL("pmmImps: Received successful WDA_ENTER_IMPS_RSP from HAL\n"));)
 
         //update power save statistics
@@ -1742,7 +1725,7 @@
     case eHAL_STATUS_SUCCESS:
         {
             resultCode = eSIR_SME_SUCCESS;
-            PELOG2(pmmLog(pMac, LOG2, 
+            PELOGW(pmmLog(pMac, LOGW, 
                           FL("pmmImps: Received WDA_EXIT_IMPS_RSP with Successful response from HAL\n"));)
         }
         break;
@@ -1800,7 +1783,7 @@
          limIsSystemInScanState(pMac) )
     {
         PELOGE(pmmLog(pMac, LOGE,
-            FL("pmmUapsd: PMM State = %d, Global MLM State = %d, Global SME State = %d, rejecting the sleep mode request\n"),
+            FL("pmmUapsd: PMM State = %d, MLM State = %d, SME State = %d, rejecting the sleep mode request\n"),
             pMac->pmm.gPmmState, pMac->lim.gLimMlmState, pMac->lim.gLimSmeState);)
 
         resultCode = eSIR_SME_INVALID_PMM_STATE;
@@ -1846,16 +1829,11 @@
     tpUapsdParams    pUapsdRspMsg;
     tSirResultCodes  retStatus = eSIR_SME_SUCCESS;
 
-    tANI_U8 PowersavesessionId;
-    tpPESession psessionEntry;
-
     /* we need to process all the deferred messages enqueued since
      * the initiating the SIR_HAL_ENTER_UAPSD_REQ.
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
 
-    /* Copy the power save sessionId to the local variable */
-    PowersavesessionId = pMac->pmm.sessionId;
 
     if (NULL == limMsg->bodyptr)
     {
@@ -1865,12 +1843,6 @@
 
     pUapsdRspMsg = (tpUapsdParams)(limMsg->bodyptr);
 
-    if((psessionEntry = peFindSessionBySessionId(pMac,PowersavesessionId))==NULL)
-    {
-        limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
-        return;
-    }
-
     if(pMac->pmm.gPmmState != ePMM_STATE_UAPSD_WT_SLEEP_RSP)
     {
         PELOGE(pmmLog(pMac, LOGE,
@@ -1894,16 +1866,7 @@
         retStatus = eSIR_SME_UAPSD_REQ_FAILED;
     }
 
-    if(IS_SLM_SESSIONIZATION_SUPPORTED_BY_FW)
-    {
-        limSendSmeRsp(pMac, eWNI_PMC_ENTER_UAPSD_RSP, retStatus, 
-                        psessionEntry->smeSessionId, psessionEntry->transactionId);
-    }
-    else
-    {
-        limSendSmeRsp(pMac, eWNI_PMC_ENTER_UAPSD_RSP, retStatus, 0, 0);
-    }
-
+    limSendSmeRsp(pMac, eWNI_PMC_ENTER_UAPSD_RSP, retStatus, 0, 0);    
     return;
 }
 
@@ -1963,7 +1926,7 @@
     PELOGE(pmmLog(pMac, LOGE,
         FL("pmmUapsd: Waking up from UAPSD mode failed, Ret Code: %d, Next State: %d\n"),
         retStatus, pMac->pmm.gPmmState);)
-    limSendSmeRsp(pMac, eWNI_PMC_EXIT_UAPSD_RSP, resultCode, 0, 0);
+    limSendSmeRsp(pMac, eWNI_PMC_EXIT_IMPS_RSP, resultCode, 0, 0);
 }
 
 
@@ -1985,8 +1948,6 @@
 void pmmExitUapsdResponseHandler(tpAniSirGlobal pMac, eHalStatus rspStatus)
 {
     tSirResultCodes resultCode = eSIR_SME_SUCCESS;
-    tANI_U8 PowersavesessionId;
-    tpPESession psessionEntry;
 
     /* we need to process all the deferred messages enqueued since
      * the initiating the SIR_HAL_EXIT_UAPSD_REQ.
@@ -2002,13 +1963,6 @@
         return;
     }
 
-    PowersavesessionId = pMac->pmm.sessionId;
-    if((psessionEntry = peFindSessionBySessionId(pMac,PowersavesessionId))==NULL)
-    {
-        limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
-        return;
-    }
-
     switch(rspStatus)
     {
         case eHAL_STATUS_SUCCESS:
@@ -2024,16 +1978,7 @@
     }
 
     pMac->pmm.gPmmState = ePMM_STATE_BMPS_SLEEP;
-
-    if(IS_SLM_SESSIONIZATION_SUPPORTED_BY_FW)
-    {
-        limSendSmeRsp(pMac, eWNI_PMC_EXIT_UAPSD_RSP, resultCode, psessionEntry->smeSessionId,
-                      psessionEntry->transactionId);
-    }
-    else
-    {
-        limSendSmeRsp(pMac, eWNI_PMC_EXIT_UAPSD_RSP, resultCode, 0, 0);
-    }
+    limSendSmeRsp(pMac, eWNI_PMC_EXIT_UAPSD_RSP, resultCode, 0, 0);
     return;
 }
 
@@ -2463,12 +2408,12 @@
     if (SIR_PM_SLEEP_MODE == mode)
     {
         msgQ.type = WDA_ENTER_IMPS_REQ;
-        PELOG2(pmmLog (pMac, LOG2, FL("Sending WDA_ENTER_IMPS_REQ to HAL\n"));)
+        PELOGW(pmmLog (pMac, LOGW, FL("Sending WDA_ENTER_IMPS_REQ to HAL\n"));)
     }
     else
     {
         msgQ.type = WDA_EXIT_IMPS_REQ;
-        PELOG2(pmmLog (pMac, LOG2, FL("Sending WDA_EXIT_IMPS_REQ to HAL\n"));)
+        PELOGW(pmmLog (pMac, LOGW, FL("Sending WDA_EXIT_IMPS_REQ to HAL\n"));)
     }
 
     msgQ.reserved = 0;
@@ -2479,7 +2424,7 @@
      * WDA_ENTER_IMPS_REQ or WDA_EXIT_IMPS_RSP from HAL.
      */
     SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     retStatus = wdaPostCtrlMsg(pMac, &msgQ);
     if ( eSIR_SUCCESS != retStatus )
     {
@@ -2511,7 +2456,6 @@
     tANI_U8  uapsdDeliveryMask = 0;
     tANI_U8  uapsdTriggerMask = 0;
     tSirMsgQ msgQ;
-    tpPESession pSessionEntry;
 
     if (SIR_PM_SLEEP_MODE == mode)
     {
@@ -2521,13 +2465,6 @@
             retStatus = eSIR_MEM_ALLOC_FAILED;
             return retStatus;
         }
-
-        if((pSessionEntry = peGetValidPowerSaveSession(pMac)) == NULL )
-        {
-            PELOGW(pmmLog(pMac, LOGW, FL("pmmUapsd :palAllocateMemory() failed\n"));)
-            retStatus = eSIR_FAILURE;
-            return retStatus;
-        }
         palZeroMemory( pMac->hHdd, (tANI_U8 *)pUapsdParams, sizeof(tUapsdParams));
         msgQ.type = WDA_ENTER_UAPSD_REQ;
         msgQ.bodyptr = pUapsdParams;
@@ -2543,8 +2480,6 @@
         pUapsdParams->beTriggerEnabled = LIM_UAPSD_GET(ACBE, uapsdTriggerMask);
         pUapsdParams->viTriggerEnabled = LIM_UAPSD_GET(ACVI, uapsdTriggerMask);
         pUapsdParams->voTriggerEnabled = LIM_UAPSD_GET(ACVO, uapsdTriggerMask);
-        pUapsdParams->bssIdx = pSessionEntry->bssIdx;
-
         PELOGE(pmmLog(pMac, LOGE, 
                       FL("UAPSD Mask:  static = 0x%x, DeliveryEnabled = 0x%x, TriggerEnabled = 0x%x \n"),
             pMac->lim.gUapsdPerAcBitmask,
@@ -2579,7 +2514,7 @@
 
     msgQ.reserved = 0;
     msgQ.bodyval = 0;
-    MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
+    MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
     retStatus = wdaPostCtrlMsg(pMac, &msgQ);
     if ( eSIR_SUCCESS != retStatus )
     {
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmDebug.c b/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmDebug.c
index ef4da26..5169eb5 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmDebug.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmDebug.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmDebug.h b/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmDebug.h
index 5924664..1f9be6a 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmDebug.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/pmm/pmmDebug.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/rrm/rrmApi.c b/drivers/staging/prima/CORE/MAC/src/pe/rrm/rrmApi.c
index eca163f..6363f17 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/rrm/rrmApi.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/rrm/rrmApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -163,7 +163,7 @@
 
    PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_SET_MAX_TX_POWER_REQ to HAL"));)
 
-      MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
+      MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
    if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
    {
       limLog( pMac, LOGP, FL("Posting WDA_SET_MAX_TX_POWER_REQ to HAL failed, reason=%X"), retCode );
@@ -380,7 +380,7 @@
    //Send request to SME.
    mmhMsg.type    = pSmeNeighborRpt->messageType;
    mmhMsg.bodyptr = pSmeNeighborRpt;
-   MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
    status = limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 
    return status;
@@ -607,7 +607,7 @@
    //Send request to SME.
    mmhMsg.type    = eWNI_SME_BEACON_REPORT_REQ_IND;
    mmhMsg.bodyptr = pSmeBcnReportReq;
-   MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, mmhMsg.type));
+   MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
    return limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
 }
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/sch/schApi.c b/drivers/staging/prima/CORE/MAC/src/pe/sch/schApi.c
index b9e19ec..8d90e5e 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/sch/schApi.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/sch/schApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -341,7 +341,7 @@
     psessionEntry->bcnLen = size;
   }
 
-  MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
+  MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
   if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
   {
     schLog( pMac, LOGE,
@@ -512,7 +512,7 @@
         }
         else
         {
-            schLog( pMac,LOG1, FL("limSendProbeRspTemplateToHal: Probe response template msg posted to HAL of bytes %d"),nBytes );
+            schLog( pMac,LOGE, FL("limSendProbeRspTemplateToHal: Probe response template msg posted to HAL of bytes %d \n"),nBytes );
         }
     }
 
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c b/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c
index 857922a..23b85c3 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconGen.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -189,12 +189,12 @@
     tpSirMacMgmtHdr mac;
     tANI_U16        offset;
     tANI_U8        *ptr;
-    tDot11fBeacon1 *pBcn1;
-    tDot11fBeacon2 *pBcn2;
+    tDot11fBeacon1  bcn1;
+    tDot11fBeacon2  bcn2;
     tANI_U32        i, nStatus, nBytes;
     tANI_U32        wpsApEnable=0, tmp;
 #ifdef WLAN_SOFTAP_FEATURE
-    tDot11fIEWscProbeRes      *pWscProbeRes;
+    tDot11fIEWscProbeRes      WscProbeRes;
 #ifdef WLAN_FEATURE_P2P
     tANI_U8  *pExtraIe = NULL;
     tANI_U32 extraIeLen =0;
@@ -204,32 +204,6 @@
 #endif
 #endif
 
-    status = palAllocateMemory(pMac->hHdd, (void **)&pBcn1, sizeof(tDot11fBeacon1));
-    if(status != eSIR_SUCCESS)
-    {
-        schLog(pMac, LOGE, FL("Failed to allocate memory\n") );
-        return eSIR_FAILURE;
-    }
-
-    status = palAllocateMemory(pMac->hHdd, (void **)&pBcn2, sizeof(tDot11fBeacon2));
-    if(status != eSIR_SUCCESS)
-    {
-        schLog(pMac, LOGE, FL("Failed to allocate memory\n") );
-        palFreeMemory(pMac->hHdd, pBcn1);
-        return eSIR_FAILURE;
-    }
-
-#ifdef WLAN_SOFTAP_FEATURE
-    status = palAllocateMemory(pMac->hHdd, (void **)&pWscProbeRes, sizeof(tDot11fIEWscProbeRes));
-    if(status != eSIR_SUCCESS)
-    {
-        schLog(pMac, LOGE, FL("Failed to allocate memory\n") );
-        palFreeMemory(pMac->hHdd, pBcn1);
-        palFreeMemory(pMac->hHdd, pBcn2);
-        return eSIR_FAILURE;
-    }
-#endif
-
     PELOG1(schLog(pMac, LOG1, FL("Setting fixed beacon fields\n"));)
 
     /*
@@ -261,25 +235,24 @@
      * Now set the beacon body
      */
 
-    palZeroMemory( pMac->hHdd, ( tANI_U8*) pBcn1, sizeof( tDot11fBeacon1 ) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8*) &bcn1, sizeof( bcn1 ) );
 
     // Skip over the timestamp (it'll be updated later).
 
-    pBcn1->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval;
-    PopulateDot11fCapabilities( pMac, &pBcn1->Capabilities, psessionEntry );
+    bcn1.BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval;
+    PopulateDot11fCapabilities( pMac, &bcn1.Capabilities, psessionEntry );
     if (psessionEntry->ssidHidden)
     {
-       pBcn1->SSID.present = 1; //rest of the fileds are 0 for hidden ssid
+       bcn1.SSID.present = 1; //rest of the fileds are 0 for hidden ssid
     }
     else
     {
-       PopulateDot11fSSID( pMac, &psessionEntry->ssId, &pBcn1->SSID );
+       PopulateDot11fSSID( pMac, &psessionEntry->ssId, &bcn1.SSID );
     }
 
-
-    PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &pBcn1->SuppRates,psessionEntry);
-    PopulateDot11fDSParams( pMac, &pBcn1->DSParams, psessionEntry->currentOperChannel, psessionEntry);
-    PopulateDot11fIBSSParams( pMac, &pBcn1->IBSSParams,psessionEntry);
+    PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &bcn1.SuppRates,psessionEntry);
+    PopulateDot11fDSParams( pMac, &bcn1.DSParams, psessionEntry->currentOperChannel, psessionEntry);
+    PopulateDot11fIBSSParams( pMac, &bcn1.IBSSParams,psessionEntry);
 
     offset = sizeof( tAniBeaconStruct );
     ptr    = pMac->sch.schObject.gSchBeaconFrameBegin + offset;
@@ -295,23 +268,18 @@
         palZeroMemory( pMac->hHdd, ( tANI_U8* )&(psessionEntry->probeRespFrame), sizeof(psessionEntry->probeRespFrame));
 
         /* Can be efficiently updated whenever new IE added  in Probe response in future */
-        limUpdateProbeRspTemplateIeBitmapBeacon1(pMac,pBcn1,&psessionEntry->DefProbeRspIeBitmap[0],
+        limUpdateProbeRspTemplateIeBitmapBeacon1(pMac,&bcn1,&psessionEntry->DefProbeRspIeBitmap[0],
                                                 &psessionEntry->probeRespFrame);
     }
 #endif
 
-    nStatus = dot11fPackBeacon1( pMac, pBcn1, ptr,
+    nStatus = dot11fPackBeacon1( pMac, &bcn1, ptr,
                                  SCH_MAX_BEACON_SIZE - offset,
                                  &nBytes );
     if ( DOT11F_FAILED( nStatus ) )
     {
       schLog( pMac, LOGE, FL("Failed to packed a tDot11fBeacon1 (0x%0"
                              "8x.).\n"), nStatus );
-      palFreeMemory(pMac->hHdd, pBcn1);
-      palFreeMemory(pMac->hHdd, pBcn2);
-#ifdef WLAN_SOFTAP_FEATURE
-      palFreeMemory(pMac->hHdd, pWscProbeRes);
-#endif
       return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( nStatus ) )
@@ -320,7 +288,7 @@
                              "t11fBeacon1 (0x%08x.).\n"), nStatus );
     }
     /*changed  to correct beacon corruption */
-    palZeroMemory( pMac->hHdd, ( tANI_U8*) pBcn2, sizeof( tDot11fBeacon2 ) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8*) &bcn2, sizeof( bcn2 ) );
     pMac->sch.schObject.gSchBeaconOffsetBegin = offset + ( tANI_U16 )nBytes;
     schLog( pMac, LOG1, FL("Initialized beacon begin, offset %d\n"), offset );
 
@@ -329,22 +297,22 @@
      */
 
     
-    PopulateDot11fCountry( pMac, &pBcn2->Country, psessionEntry);
-    if(pBcn1->Capabilities.qos)
+    PopulateDot11fCountry( pMac, &bcn2.Country, psessionEntry);
+    if(bcn1.Capabilities.qos)
     {
-        PopulateDot11fEDCAParamSet( pMac, &pBcn2->EDCAParamSet, psessionEntry);
+        PopulateDot11fEDCAParamSet( pMac, &bcn2.EDCAParamSet, psessionEntry);
     }
 
-    if(psessionEntry->lim11hEnable)
+    if(pMac->lim.gLim11hEnable)
     {
-      PopulateDot11fPowerConstraints( pMac, &pBcn2->PowerConstraints );
-      PopulateDot11fTPCReport( pMac, &pBcn2->TPCReport, psessionEntry);
+      PopulateDot11fPowerConstraints( pMac, &bcn2.PowerConstraints );
+      PopulateDot11fTPCReport( pMac, &bcn2.TPCReport, psessionEntry);
     }
 
 #ifdef ANI_PRODUCT_TYPE_AP
-    if( psessionEntry->lim11hEnable && (eLIM_QUIET_RUNNING == psessionEntry->gLimSpecMgmt.quietState))
+    if( pMac->lim.gLim11hEnable && (eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState))
     {
-      PopulateDot11fQuiet( pMac, &pBcn2->Quiet );
+      PopulateDot11fQuiet( pMac, &bcn2.Quiet );
     }
 
     /* If 11h is enabled, and AP is in the state of changing either the
@@ -353,60 +321,50 @@
      * populate the 802.11h channel switch IE in its Beacons and Probe
      * Responses.
      */
-    if ( (psessionEntry->lim11hEnable) &&
-         (psessionEntry->gLimChannelSwitch.switchCount != 0) &&
-         (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING))
+    if ( (pMac->lim.gLim11hEnable) &&
+         (pMac->lim.gLimChannelSwitch.switchCount != 0) &&
+         (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING))
 
     {
-      PopulateDot11fChanSwitchAnn( pMac, &pBcn2->ChanSwitchAnn,psessionEntry );
-      PopulateDot11fExtChanSwitchAnn(pMac, &pBcn2->ExtChanSwitchAnn,psessionEntry);
+      PopulateDot11fChanSwitchAnn( pMac, &bcn2.ChanSwitchAnn );
+      PopulateDot11fExtChanSwitchAnn(pMac, &bcn2.ExtChanSwitchAnn);
     }
 #endif
 
     if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B)
-        PopulateDot11fERPInfo( pMac, &pBcn2->ERPInfo, psessionEntry );
+        PopulateDot11fERPInfo( pMac, &bcn2.ERPInfo, psessionEntry );
 
-    if(psessionEntry->htCapability)
+    if(psessionEntry->htCapabality)
     {
-        PopulateDot11fHTCaps( pMac,psessionEntry, &pBcn2->HTCaps );
+        PopulateDot11fHTCaps( pMac, &bcn2.HTCaps );
 #ifdef WLAN_SOFTAP_FEATURE
-        PopulateDot11fHTInfo( pMac, &pBcn2->HTInfo, psessionEntry );
+        PopulateDot11fHTInfo( pMac, &bcn2.HTInfo, psessionEntry );
 #else
-        PopulateDot11fHTInfo( pMac, &pBcn2->HTInfo );
+        PopulateDot11fHTInfo( pMac, &bcn2.HTInfo );
 #endif
     }
-#ifdef WLAN_FEATURE_11AC
-    if(psessionEntry->vhtCapability)
-    {        
-        limLog( pMac, LOGW, FL("Populate VHT IEs in Beacon\n"));
-        PopulateDot11fVHTCaps( pMac, &pBcn2->VHTCaps );
-        PopulateDot11fVHTOperation( pMac, &pBcn2->VHTOperation);
-        // we do not support multi users yet
-        //PopulateDot11fVHTExtBssLoad( pMac, &bcn2.VHTExtBssLoad);
-    }
-#endif
 
     PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
-                                &pBcn2->ExtSuppRates, psessionEntry );
+                                &bcn2.ExtSuppRates, psessionEntry );
  
     if( psessionEntry->pLimStartBssReq != NULL )
     {
           PopulateDot11fWPA( pMac, &psessionEntry->pLimStartBssReq->rsnIE,
-                       &pBcn2->WPA );
+                       &bcn2.WPA );
           PopulateDot11fRSN( pMac, &psessionEntry->pLimStartBssReq->rsnIE,
-                       &pBcn2->RSN );
+                       &bcn2.RSN );
     }
 
     if(psessionEntry->limWmeEnabled)
     {
-        PopulateDot11fWMM( pMac, &pBcn2->WMMInfoAp, &pBcn2->WMMParams, &pBcn2->WMMCaps, psessionEntry);
+        PopulateDot11fWMM( pMac, &bcn2.WMMInfoAp, &bcn2.WMMParams, &bcn2.WMMCaps, psessionEntry);
     }
 #ifdef WLAN_SOFTAP_FEATURE
     if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
     {
         if(psessionEntry->wps_state != SAP_WPS_DISABLED)
         {
-            PopulateDot11fBeaconWPSIEs( pMac, &pBcn2->WscBeacon, psessionEntry);            
+            PopulateDot11fBeaconWPSIEs( pMac, &bcn2.WscBeacon, psessionEntry);            
         }
     }
     else
@@ -419,18 +377,18 @@
     
     if (wpsApEnable)
     {
-        PopulateDot11fWsc(pMac, &pBcn2->WscBeacon);
+        PopulateDot11fWsc(pMac, &bcn2.WscBeacon);
     }
 
     if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_BEGIN)
     {
-        PopulateDot11fWscRegistrarInfo(pMac, &pBcn2->WscBeacon);
+        PopulateDot11fWscRegistrarInfo(pMac, &bcn2.WscBeacon);
         pMac->lim.wscIeInfo.wscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS;
     }
 
     if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END)
     {
-        DePopulateDot11fWscRegistrarInfo(pMac, &pBcn2->WscBeacon);
+        DePopulateDot11fWscRegistrarInfo(pMac, &bcn2.WscBeacon);
         pMac->lim.wscIeInfo.wscEnrollmentState = eLIM_WSC_ENROLL_NOOP;
     }
 #ifdef WLAN_SOFTAP_FEATURE    
@@ -442,7 +400,7 @@
         && (psessionEntry->proxyProbeRspEn))
     {
         /* Can be efficiently updated whenever new IE added  in Probe response in future */
-        limUpdateProbeRspTemplateIeBitmapBeacon2(pMac,pBcn2,&psessionEntry->DefProbeRspIeBitmap[0],
+        limUpdateProbeRspTemplateIeBitmapBeacon2(pMac,&bcn2,&psessionEntry->DefProbeRspIeBitmap[0],
                                                 &psessionEntry->probeRespFrame);
 
         /* update probe response WPS IE instead of beacon WPS IE
@@ -451,37 +409,32 @@
         {
             if(psessionEntry->APWPSIEs.SirWPSProbeRspIE.FieldPresent)
             {
-                PopulateDot11fProbeResWPSIEs(pMac, pWscProbeRes, psessionEntry);
+                PopulateDot11fProbeResWPSIEs(pMac, &WscProbeRes, psessionEntry);
             }
             else
             {
-                pWscProbeRes->present = 0;
+                WscProbeRes.present = 0;
             }
-            if(pWscProbeRes->present)
+            if(WscProbeRes.present)
             {
                 SetProbeRspIeBitmap(&psessionEntry->DefProbeRspIeBitmap[0],SIR_MAC_WPA_EID);
                 palCopyMemory(pMac->hHdd,
                             (void *)&psessionEntry->probeRespFrame.WscProbeRes,
-                            (void *)pWscProbeRes,
-                            sizeof(tDot11fIEWscProbeRes));
+                            (void *)&WscProbeRes,
+                            sizeof(WscProbeRes));
             }
         }
 
     }
 #endif
 
-    nStatus = dot11fPackBeacon2( pMac, pBcn2,
+    nStatus = dot11fPackBeacon2( pMac, &bcn2,
                                  pMac->sch.schObject.gSchBeaconFrameEnd,
                                  SCH_MAX_BEACON_SIZE, &nBytes );
     if ( DOT11F_FAILED( nStatus ) )
     {
       schLog( pMac, LOGE, FL("Failed to packed a tDot11fBeacon2 (0x%0"
                              "8x.).\n"), nStatus );
-      palFreeMemory(pMac->hHdd, pBcn1);
-      palFreeMemory(pMac->hHdd, pBcn2);
-#ifdef WLAN_SOFTAP_FEATURE
-      palFreeMemory(pMac->hHdd, pWscProbeRes);
-#endif
       return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( nStatus ) )
@@ -525,11 +478,7 @@
             pMac->sch.schObject.gSchBeaconOffsetEnd );
 
     pMac->sch.schObject.fBeaconChanged = 1;
-    palFreeMemory(pMac->hHdd, pBcn1);
-    palFreeMemory(pMac->hHdd, pBcn2);
-#ifdef WLAN_SOFTAP_FEATURE
-    palFreeMemory(pMac->hHdd, pWscProbeRes);
-#endif
+
     return eSIR_SUCCESS;
 }
 
@@ -679,30 +628,6 @@
                             sizeof(beacon2->HTInfo));
     }
 
-#ifdef WLAN_FEATURE_11AC
-    if(beacon2->VHTCaps.present)
-    {
-        SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_VHT_CAPABILITIES_EID);
-        palCopyMemory(pMac->hHdd,(void *)&prb_rsp->VHTCaps,
-                            (void *)&beacon2->VHTCaps,
-                            sizeof(beacon2->VHTCaps));
-    }
-    if(beacon2->VHTOperation.present)
-    {
-        SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_VHT_OPERATION_EID);
-        palCopyMemory(pMac->hHdd,(void *)&prb_rsp->VHTOperation,
-                            (void *)&beacon2->VHTOperation,
-                            sizeof(beacon2->VHTOperation));
-    }
-    if(beacon2->VHTExtBssLoad.present)
-    {
-        SetProbeRspIeBitmap(DefProbeRspIeBitmap,SIR_MAC_VHT_EXT_BSS_LOAD_EID);
-        palCopyMemory(pMac->hHdd,(void *)&prb_rsp->VHTExtBssLoad,
-                            (void *)&beacon2->VHTExtBssLoad,
-                            sizeof(beacon2->VHTExtBssLoad));
-    }
-#endif
-
     //WMM IE
     if(beacon2->WMMParams.present)
     {
@@ -1032,12 +957,12 @@
                     limSwitchPrimaryChannel(pMac, pMac->lim.gLimChannelSwitch.primaryChannel);
                     break;
                 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
-                    limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
+                    limSwitchPrimarySecondaryChannel(pMac,
                                              psessionEntry->currentOperChannel,
                                              pMac->lim.gLimChannelSwitch.secondarySubBand);
                     break;
                 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
-                    limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
+                    limSwitchPrimarySecondaryChannel(pMac,
                                              pMac->lim.gLimChannelSwitch.primaryChannel,
                                              pMac->lim.gLimChannelSwitch.secondarySubBand);
                     break;
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconProcess.c b/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconProcess.c
index 3997d95..abcfd62 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconProcess.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/sch/schBeaconProcess.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -85,7 +85,7 @@
 
     if(SIR_BAND_5_GHZ == rfBand)
     {
-        if (psessionEntry->htCapability)
+        if (psessionEntry->htCapabality)
         {
             if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
             {
@@ -122,7 +122,7 @@
     {
         //We are 11G AP.
         if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
-              (false == psessionEntry->htCapability))
+              (false == psessionEntry->htCapabality))
         {
             if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)        
             {
@@ -149,7 +149,7 @@
             }
         }        
         // handling the case when HT AP has overlapping legacy BSS.
-        else if(psessionEntry->htCapability)
+        else if(psessionEntry->htCapabality)
         {             
             if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
             {
@@ -396,8 +396,8 @@
 
 
 
-        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[0]);)
-        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[1]);)
+        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, pBeacon->timeStamp[0]);)
+        MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, pBeacon->timeStamp[1]);)
 
         /* Read beacon interval session Entry */
         bi = psessionEntry->beaconParams.beaconInterval;
@@ -472,7 +472,7 @@
             sendProbeReq = TRUE;
     }
 
-    if ( psessionEntry->htCapability && pBeacon->HTInfo.present )
+    if ( pMac->lim.htCapability && pBeacon->HTInfo.present )
     {
         limUpdateStaRunTimeHTSwitchChnlParams( pMac, &pBeacon->HTInfo, bssIdx,psessionEntry);
     }
@@ -485,8 +485,8 @@
         {
             limUpdateQuietIEFromBeacon(pMac, &(pBeacon->quietIE), psessionEntry);
         }
-        else if ((psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
-             (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
+        else if ((pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
+             (pMac->lim.gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
         {
             PELOG1(limLog(pMac, LOG1, FL("Received a beacon without Quiet IE\n"));)
             limCancelDot11hQuiet(pMac, psessionEntry);
@@ -498,7 +498,7 @@
         {
             limUpdateChannelSwitch(pMac, pBeacon, psessionEntry);
         }
-        else if (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
+        else if (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
         {
             limCancelDot11hChannelSwitch(pMac, psessionEntry);
         }   
@@ -520,7 +520,7 @@
              {
                 limLog( pMac, LOG1, "RegMax = %d, lpc = %d, MaxTx = %d", regMax, localConstraint, maxTxPower );
                 limLog( pMac, LOG1, "Local power constraint change..updating new maxTx power to HAL");
-                if( limSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
+                if( limSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eHAL_STATUS_SUCCESS )
                    psessionEntry->maxTxPower = maxTxPower;
              }
            }
@@ -569,6 +569,9 @@
             psessionEntry->bssId, psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
             psessionEntry->dot11mode, 0, NULL);
 
+   PELOG2(schLog(pMac, LOG2, "Received Beacon's SeqNum=%d\n",
+           (pMh->seqControl.seqNumHi << 4) | (pMh->seqControl.seqNumLo));)
+
     if(beaconParams.paramChangeBitmap)
     {
         PELOGW(schLog(pMac, LOGW, FL("Beacon for session[%d] got changed. \n"), psessionEntry->peSessionId);)
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/sch/schDebug.c b/drivers/staging/prima/CORE/MAC/src/pe/sch/schDebug.c
index ae59a43..c6b3473 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/sch/schDebug.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/sch/schDebug.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/sch/schDebug.h b/drivers/staging/prima/CORE/MAC/src/pe/sch/schDebug.h
index f08ab1d..6cd523e 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/sch/schDebug.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/sch/schDebug.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/sch/schMessage.c b/drivers/staging/prima/CORE/MAC/src/pe/sch/schMessage.c
index fae82ab..58bb1b0 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/sch/schMessage.c
+++ b/drivers/staging/prima/CORE/MAC/src/pe/sch/schMessage.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -162,7 +162,7 @@
             {
                 palGetPacketDataPtr( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, pSchMsg->bodyptr, (void **) &(pBD) );
             }
-#else
+#else 
             pBD = (tANI_U32 *) pSchMsg->bodyptr;
 #endif
 
@@ -285,7 +285,7 @@
                            pSchMsg->bodyval);
             }
             break;
-
+            
         default:
             schLog(pMac, LOGE, FL("Unknown message in schMsgQ type %d\n"),
                    pSchMsg->type);
@@ -458,44 +458,6 @@
     return eSIR_SUCCESS;
 }
 
-static void broadcastWMMOfConcurrentSTASession(tpAniSirGlobal pMac, tpPESession psessionEntry)
-{
-    tANI_U8         i,j;
-    tpPESession     pConcurrentStaSessionEntry;
-
-    for (i =0;i < pMac->lim.maxBssId;i++)
-    {
-        /* Find another INFRA STA AP session on same operating channel. The session entry passed to this API is for GO/SoftAP session that is getting added currently */
-        if ( (pMac->lim.gpSession[i].valid == TRUE ) &&
-             (pMac->lim.gpSession[i].peSessionId != psessionEntry->peSessionId) &&
-             (pMac->lim.gpSession[i].currentOperChannel == psessionEntry->currentOperChannel) &&
-             (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE)
-           )
-        {
-            pConcurrentStaSessionEntry = &(pMac->lim.gpSession[i]);
-            for (j=0; j<MAX_NUM_AC; j++)
-            {
-                psessionEntry->gLimEdcaParamsBC[j].aci.acm = pConcurrentStaSessionEntry->gLimEdcaParams[j].aci.acm;
-                psessionEntry->gLimEdcaParamsBC[j].aci.aifsn = pConcurrentStaSessionEntry->gLimEdcaParams[j].aci.aifsn;
-                psessionEntry->gLimEdcaParamsBC[j].cw.min =  pConcurrentStaSessionEntry->gLimEdcaParams[j].cw.min;
-                psessionEntry->gLimEdcaParamsBC[j].cw.max =  pConcurrentStaSessionEntry->gLimEdcaParams[j].cw.max;
-                psessionEntry->gLimEdcaParamsBC[j].txoplimit=  pConcurrentStaSessionEntry->gLimEdcaParams[j].txoplimit;
-
-               PELOG1(schLog(pMac, LOG1, "QoSUpdateBCast changed again due to concurrent INFRA STA session: AC :%d: AIFSN: %d, ACM %d, CWmin %d, CWmax %d, TxOp %d\n",
-                        j,
-                        psessionEntry->gLimEdcaParamsBC[j].aci.aifsn,
-                        psessionEntry->gLimEdcaParamsBC[j].aci.acm,
-                        psessionEntry->gLimEdcaParamsBC[j].cw.min,
-                        psessionEntry->gLimEdcaParamsBC[j].cw.max,
-                        psessionEntry->gLimEdcaParamsBC[j].txoplimit);)
-
-            }
-            /* Once atleast one concurrent session on same channel is found and WMM broadcast params for current SoftAP/GO session updated, return*/
-            break;
-        }
-    }
-}
-
 void
 schQosUpdateBroadcast(tpAniSirGlobal pMac, tpPESession psessionEntry)
 {
@@ -550,9 +512,6 @@
 
     }
 
-    /* If there exists a concurrent STA-AP session, use its WMM params to broadcast in beacons. WFA Wifi Direct test plan 6.1.14 requirement */
-    broadcastWMMOfConcurrentSTASession(pMac, psessionEntry);
-
     if (schSetFixedBeaconFields(pMac,psessionEntry) != eSIR_SUCCESS)
         PELOGE(schLog(pMac, LOGE, "Unable to set beacon fields!\n");)
 }
diff --git a/drivers/staging/prima/CORE/MAC/src/pe/sch/schSysParams.h b/drivers/staging/prima/CORE/MAC/src/pe/sch/schSysParams.h
index f577d73..18da485 100644
--- a/drivers/staging/prima/CORE/MAC/src/pe/sch/schSysParams.h
+++ b/drivers/staging/prima/CORE/MAC/src/pe/sch/schSysParams.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SAP/inc/sapApi.h b/drivers/staging/prima/CORE/SAP/inc/sapApi.h
index 6b7bd29..47b1dbd 100644
--- a/drivers/staging/prima/CORE/SAP/inc/sapApi.h
+++ b/drivers/staging/prima/CORE/SAP/inc/sapApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -148,10 +148,7 @@
     eSAP_DOT11_MODE_11g_ONLY = 0x0080,
     eSAP_DOT11_MODE_11n_ONLY = 0x0100,
     eSAP_DOT11_MODE_11b_ONLY = 0x0400,
-#ifdef WLAN_FEATURE_11AC
-    eSAP_DOT11_MODE_11ac     = 0x1000,
-    eSAP_DOT11_MODE_11ac_ONLY = 0x2000
-#endif
+
 } eSapPhyMode;
 
 typedef enum {
diff --git a/drivers/staging/prima/CORE/SAP/src/sapApiLinkCntl.c b/drivers/staging/prima/CORE/SAP/src/sapApiLinkCntl.c
index cb19212..e57d493 100644
--- a/drivers/staging/prima/CORE/SAP/src/sapApiLinkCntl.c
+++ b/drivers/staging/prima/CORE/SAP/src/sapApiLinkCntl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SAP/src/sapChSelect.c b/drivers/staging/prima/CORE/SAP/src/sapChSelect.c
index 9d4a012..33c109d 100644
--- a/drivers/staging/prima/CORE/SAP/src/sapChSelect.c
+++ b/drivers/staging/prima/CORE/SAP/src/sapChSelect.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SAP/src/sapChSelect.h b/drivers/staging/prima/CORE/SAP/src/sapChSelect.h
index 0721d39..af0ad75 100644
--- a/drivers/staging/prima/CORE/SAP/src/sapChSelect.h
+++ b/drivers/staging/prima/CORE/SAP/src/sapChSelect.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SAP/src/sapFsm.c b/drivers/staging/prima/CORE/SAP/src/sapFsm.c
index 9c9fa21..9f0aecf 100644
--- a/drivers/staging/prima/CORE/SAP/src/sapFsm.c
+++ b/drivers/staging/prima/CORE/SAP/src/sapFsm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -498,7 +498,7 @@
     switch (sapHddevent)
     {
         case eSAP_STA_ASSOC_IND:
-            //  TODO - Indicate the assoc request indication to OS
+            VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, "TODO: Indicate the assoc request indication to OS\n");
             sapApAppEvent.sapHddEventCode = eSAP_STA_ASSOC_IND;
 
             vos_mem_copy( &sapApAppEvent.sapevt.sapAssocIndication.staMac, pCsrRoamInfo->peerMac,sizeof(tSirMacAddr));
diff --git a/drivers/staging/prima/CORE/SAP/src/sapFsm_ext.h b/drivers/staging/prima/CORE/SAP/src/sapFsm_ext.h
index 6f2603b..ca0b9f3 100644
--- a/drivers/staging/prima/CORE/SAP/src/sapFsm_ext.h
+++ b/drivers/staging/prima/CORE/SAP/src/sapFsm_ext.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SAP/src/sapInternal.h b/drivers/staging/prima/CORE/SAP/src/sapInternal.h
index f4068ad..a148656 100644
--- a/drivers/staging/prima/CORE/SAP/src/sapInternal.h
+++ b/drivers/staging/prima/CORE/SAP/src/sapInternal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SAP/src/sapModule.c b/drivers/staging/prima/CORE/SAP/src/sapModule.c
index 686722a..59a55e6 100644
--- a/drivers/staging/prima/CORE/SAP/src/sapModule.c
+++ b/drivers/staging/prima/CORE/SAP/src/sapModule.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -497,9 +497,11 @@
     }
     else
     {
-        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_FATAL, 
+        VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, 
                "WLANSAP_pmcFullPwrReqCB: PMC failed to put the chip in Full power\n");
 
+        //ASSERT
+        VOS_ASSERT(0);
     }
 
 }// WLANSAP_pmcFullPwrReqCB
diff --git a/drivers/staging/prima/CORE/SME/inc/btcApi.h b/drivers/staging/prima/CORE/SME/inc/btcApi.h
index 44fa1f7..9cd2466 100644
--- a/drivers/staging/prima/CORE/SME/inc/btcApi.h
+++ b/drivers/staging/prima/CORE/SME/inc/btcApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -110,21 +110,6 @@
 #define BT_MAX_NUM_EVENT_ACL_DEFERRED  4  //We may need to defer these many BT events for ACL
 #define BT_MAX_NUM_EVENT_SCO_DEFERRED  4  //We may need to defer these many BT events for SYNC
 
-/** Default values for the BTC tunables parameters
-*/
-#define BTC_STATIC_BT_LEN_INQ_DEF     (120000)  // 120 msec
-#define BTC_STATIC_BT_LEN_PAGE_DEF     (10000)  // 10 msec (don't care)
-#define BTC_STATIC_BT_LEN_CONN_DEF     (10000)  // 10 msec (don't care)
-#define BTC_STATIC_BT_LEN_LE_DEF       (10000)  // 10 msec (don't care)
-#define BTC_STATIC_WLAN_LEN_INQ_DEF    (30000)  // 30 msec
-#define BTC_STATIC_WLAN_LEN_PAGE_DEF       (0)  // 0 msec (BT takes all)
-#define BTC_STATIC_WLAN_LEN_CONN_DEF       (0)  // 0 msec (BT takes all)
-#define BTC_STATIC_WLAN_LEN_LE_DEF         (0)  // 0 msec (BT takes all)
-#define BTC_DYNAMIC_BT_LEN_MAX_DEF    (250000)  // 250 msec
-#define BTC_DYNAMIC_WLAN_LEN_MAX_DEF   (45000)  // 45 msec
-#define BTC_SCO_BLOCK_PERC_DEF             (1)  // 1 percent
-#define BTC_DHCP_ON_A2DP_DEF               (1)  // ON
-#define BTC_DHCP_ON_SCO_DEF                (0)  // OFF
 
 /** Enumeration of all the different kinds of BT events
 */
@@ -258,19 +243,6 @@
    v_U8_t       btcBtIntervalMode1;
    v_U8_t       btcWlanIntervalMode1;
 
-   v_U32_t      btcStaticLenInqBt;
-   v_U32_t      btcStaticLenPageBt;
-   v_U32_t      btcStaticLenConnBt;
-   v_U32_t      btcStaticLenLeBt;
-   v_U32_t      btcStaticLenInqWlan;
-   v_U32_t      btcStaticLenPageWlan;
-   v_U32_t      btcStaticLenConnWlan;
-   v_U32_t      btcStaticLenLeWlan;
-   v_U32_t      btcDynMaxLenBt;
-   v_U32_t      btcDynMaxLenWlan;
-   v_U32_t      btcMaxScoBlockPerc;
-   v_U32_t      btcDhcpProtOnA2dp;
-   v_U32_t      btcDhcpProtOnSco;
 } tSmeBtcConfig, *tpSmeBtcConfig;
 
 
diff --git a/drivers/staging/prima/CORE/SME/inc/ccmApi.h b/drivers/staging/prima/CORE/SME/inc/ccmApi.h
index ef08028..5195459 100644
--- a/drivers/staging/prima/CORE/SME/inc/ccmApi.h
+++ b/drivers/staging/prima/CORE/SME/inc/ccmApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/csrApi.h b/drivers/staging/prima/CORE/SME/inc/csrApi.h
index d7644c8..f1bd2bd 100644
--- a/drivers/staging/prima/CORE/SME/inc/csrApi.h
+++ b/drivers/staging/prima/CORE/SME/inc/csrApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -128,13 +128,9 @@
     eCSR_DOT11_MODE_TAURUS_ONLY = 0x0200,
     eCSR_DOT11_MODE_11b_ONLY = 0x0400,
     eCSR_DOT11_MODE_11a_ONLY = 0x0800,
-#ifdef WLAN_FEATURE_11AC
-    eCSR_DOT11_MODE_11ac     = 0x1000,
-    eCSR_DOT11_MODE_11ac_ONLY = 0x2000,
-#endif
     //This is for WIFI test. It is same as eWNIAPI_MAC_PROTOCOL_ALL except when it starts IBSS in 11B of 2.4GHz
     //It is for CSR internal use
-    eCSR_DOT11_MODE_AUTO = 0x4000,
+    eCSR_DOT11_MODE_AUTO = 0x1000,
 
     eCSR_NUM_PHY_MODE = 16,     //specify the number of maximum bits for phyMode
 }eCsrPhyMode;
@@ -248,7 +244,6 @@
     eCsrRequestType requestType;    //11d scan or full scan
 #ifdef WLAN_FEATURE_P2P
     tANI_BOOLEAN p2pSearch;
-    tANI_BOOLEAN skipDfsChnlInP2pSearch;
 #endif
 }tCsrScanRequest;
 
@@ -415,9 +410,6 @@
     //this mean error happens before association_start or roaming_start is called.
     eCSR_ROAM_SESSION_OPENED,
     eCSR_ROAM_FT_REASSOC_FAILED,
-#ifdef FEATURE_WLAN_LFR
-    eCSR_ROAM_PMK_NOTIFY,
-#endif
 }eRoamCmdStatus;
 
 
@@ -633,8 +625,6 @@
 #define CSR_CB_CHANNEL_GAP 4
 #define CSR_CB_CENTER_CHANNEL_OFFSET    2
 #define CSR_MAX_24GHz_CHANNEL_NUMBER ( SIR_11B_CHANNEL_END )
-#define CSR_MIN_5GHz_CHANNEL_NUMBER  ( SIR_11A_CHANNEL_BEGIN )
-#define CSR_MAX_5GHz_CHANNEL_NUMBER  ( SIR_11A_CHANNEL_END )
 
 // WEP keysize (in bits)...
 typedef enum  
@@ -846,7 +836,6 @@
     tCsrEncryptionList mcEncryptionInfo;
     eCsrCBChoice CBMode; //up, down or auto
     tANI_U8 operationChannel;
-    tANI_U16   beaconInterval;
     tCsrKeys Keys;
     // meaningless on connect. It's an OUT param from CSR's point of view
     // During assoc response carries the ACM bit-mask i.e. what
@@ -893,8 +882,8 @@
 typedef struct tagCsrConfigParam
 {
     tANI_U32 FragmentationThreshold;
-    tANI_U32 channelBondingMode24GHz;   // keep this tANI_U32. This gets converted to ePhyChannelBondState
-    tANI_U32 channelBondingMode5GHz;    // in csrChangeDefaultConfigParam using convertCBIniValueToPhyCBState
+    tANI_U32 channelBondingMode24GHz;
+    tANI_U32 channelBondingMode5GHz;
     eCsrPhyMode phyMode;
     eCsrBand eBand;
     tANI_U32 RTSThreshold;
@@ -922,8 +911,7 @@
     tANI_U32 nRoamingTime;  //In seconds, CSR will try this long before gives up. 0 means no roaming
     tANI_U8 bCatRssiOffset;     //to set the RSSI difference for each category
     tANI_U8 fEnableMCCMode; //to set MCC Enable/Disable mode
-    tANI_U8 fAllowMCCGODiffBI; //to allow MCC GO different B.I than STA's. NOTE: make sure if RIVA firmware can handle this combination before enabling this
-                               //at the moment, this flag is provided only to pass Wi-Fi Cert. 5.1.12
+
     tCsr11dinfo  Csr11dinfo;
     //Whether to limit the channels to the ones set in Csr11dInfo. If true, the opertaional
     //channels are limited to the default channel list. It is an "AND" operation between the 
@@ -963,13 +951,9 @@
 #ifdef FEATURE_WLAN_CCX
     tANI_U8   isCcxIniFeatureEnabled;
 #endif
-#ifdef FEATURE_WLAN_LFR
-    tANI_U8   isFastRoamIniFeatureEnabled;
-#endif
 
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
     tANI_U8   isFastTransitionEnabled;
-    tANI_U8   RoamRssiDiff;
 #endif
 
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
@@ -999,16 +983,6 @@
 
     //To enable/disable scanning 2.4Ghz channels twice on a single scan request from HDD
     tANI_BOOLEAN fScanTwice;
-#ifdef WLAN_FEATURE_11AC
-    tANI_U32  nVhtChannelWidth;
-#endif
-
-    /*
-    * To enable/disable scanning only 2.4Ghz channels on first scan
-    */
-    tANI_BOOLEAN fFirstScanOnly2GChnl;
-
-    tANI_BOOLEAN fIgnore_chan165;
 
 }tCsrConfigParam;   
 
diff --git a/drivers/staging/prima/CORE/SME/inc/csrInternal.h b/drivers/staging/prima/CORE/SME/inc/csrInternal.h
index 2e3596c..880be47 100644
--- a/drivers/staging/prima/CORE/SME/inc/csrInternal.h
+++ b/drivers/staging/prima/CORE/SME/inc/csrInternal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -59,7 +59,7 @@
 #define CSR_SCAN_RETURN_AFTER_5_BAND_11d_FOUND      ( 0x80 )
 #define CSR_SCAN_RETURN_AFTER_24_BAND_11d_FOUND     ( 0x40 )
 #define CSR_SCAN_RETURN_AFTER_EITHER_BAND_11d_FOUND ( CSR_SCAN_RETURN_AFTER_5_BAND_11d_FOUND | CSR_SCAN_RETURN_AFTER_24_BAND_11d_FOUND )
-#define CSR_NUM_RSSI_CAT        15
+#define CSR_NUM_RSSI_CAT        5
 #define CSR_MAX_STATISTICS_REQ        10
 
 //Support for multiple session
@@ -76,11 +76,6 @@
      NULL \
 )
 
-//Support for "Fast roaming" (i.e., CCX, LFR, or 802.11r.)
-#define CSR_BG_SCAN_OCCUPIED_CHANNEL_LIST_LEN 15  
-#define CSR_BG_SCAN_VALID_CHANNEL_LIST_CHUNK_SIZE 3
-#define CSR_BG_SCAN_CHANNEL_LIST_LEN (CSR_BG_SCAN_OCCUPIED_CHANNEL_LIST_LEN + CSR_BG_SCAN_VALID_CHANNEL_LIST_CHUNK_SIZE)
-
 
 
 typedef enum
@@ -94,16 +89,10 @@
     eCSR_CFG_DOT11_MODE_11N,   
     eCSR_CFG_DOT11_MODE_POLARIS,    
     eCSR_CFG_DOT11_MODE_TITAN,    
-#ifdef WLAN_FEATURE_11AC
-    eCSR_CFG_DOT11_MODE_11AC,
-#endif
 #ifdef WLAN_SOFTAP_FEATURE
     eCSR_CFG_DOT11_MODE_11G_ONLY,    
     eCSR_CFG_DOT11_MODE_11N_ONLY,   
 #endif 
-#ifdef WLAN_FEATURE_11AC
-    eCSR_CFG_DOT11_MODE_11AC_ONLY,
-#endif 
     //This value can never set to CFG. It is for CSR's internal use
     eCSR_CFG_DOT11_MODE_AUTO,
 }eCsrCfgDot11Mode;  //Used to determine what to set to the WNI_CFG_DOT11_MODE
@@ -168,7 +157,6 @@
     eCsrSmeIssuedFTReassoc,
     eCsrForcedDisassocSta,
     eCsrForcedDeauthSta,
-    eCsrPerformPreauth,
     
 }eCsrRoamReason;
 
@@ -319,7 +307,7 @@
     tANI_U32 uJoinTimeOut;
     tSirMacCapabilityInfo BssCap;
     tANI_BOOLEAN f11hSupport;
-    ePhyChanBondState cbMode;
+    tAniCBSecondaryMode cbMode;
 }tBssConfigParam;
 
 
@@ -328,7 +316,7 @@
     tSirMacSSid         ssId;
     tCsrBssid           bssid;    //this is the BSSID for the party we want to join (only use for IBSS or WDS)
     tSirNwType          sirNwType;
-    ePhyChanBondState   cbMode;
+    tAniCBSecondaryMode cbMode;
     tSirMacRateSet      operationalRateSet;
     tSirMacRateSet      extendedRateSet;
     tANI_U8             operationChn;
@@ -499,7 +487,6 @@
     tANI_BOOLEAN shortSlotTime;
     tANI_BOOLEAN ProprietaryRatesEnabled;
     tANI_BOOLEAN  fenableMCCMode;
-    tANI_BOOLEAN  fAllowMCCGODiffBI;
     tANI_U16 TxRate;
     tANI_U8 AdHocChannel24;
     tANI_U8 AdHocChannel5G;
@@ -553,17 +540,12 @@
     tCsr11rConfig csr11rConfig;
 #endif
 
-#ifdef FEATURE_WLAN_LFR
-    tANI_U8   isFastRoamIniFeatureEnabled;
-#endif
-
 #ifdef FEATURE_WLAN_CCX
     tANI_U8   isCcxIniFeatureEnabled;
 #endif
 
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
     tANI_U8   isFastTransitionEnabled;
-    tANI_U8   RoamRssiDiff;
 #endif
 
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
@@ -575,13 +557,12 @@
     tANI_BOOLEAN addTSWhenACMIsOff;
 
     tANI_BOOLEAN fValidateList;
+#ifndef BMPS_WORKAROUND_NOT_NEEDED
     tANI_BOOLEAN doBMPSWorkaround;
+#endif
 
     //To enable/disable scanning 2.4Ghz channels twice on a single scan request from HDD
     tANI_BOOLEAN fScanTwice;
-#ifdef WLAN_FEATURE_11AC
-    tANI_U32  nVhtChannelWidth;
-#endif
 
 }tCsrConfig;
 
@@ -678,19 +659,11 @@
     * (apprx 1.3 sec) */
     tANI_BOOLEAN fEnableDFSChnlScan;
 
-    /*
-    * To enable/disable scanning only 2.4Ghz channels on first scan
-    */
-    tANI_BOOLEAN fFirstScanOnly2GChnl;
-
     tANI_BOOLEAN fDropScanCmd; //true means we don't accept scan commands
 
 #ifdef WLAN_AP_STA_CONCURRENCY
     tDblLinkList scanCmdPendingList;
 #endif    
-    tCsrChannel occupiedChannels;   //This includes all channels on which candidate APs are found
-    
-    tANI_BOOLEAN fIgnore_chan165;
 }tCsrScanStruct;
 
 
@@ -882,15 +855,9 @@
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING    
     tCsrNeighborRoamControlInfo neighborRoamInfo;
 #endif
-#ifdef FEATURE_WLAN_LFR
-    tANI_U8   isFastRoamIniFeatureEnabled;
-#endif
 #ifdef FEATURE_WLAN_CCX
     tANI_U8   isCcxIniFeatureEnabled;
 #endif
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
-    tANI_U8   RoamRssiDiff;
-#endif
 }tCsrRoamStruct;
 
 
@@ -934,19 +901,10 @@
         ((eCSR_DOT11_MODE_11a == (pMac)->roam.configParam.phyMode) ||\
         (eCSR_DOT11_MODE_11a_ONLY == (pMac)->roam.configParam.phyMode))
         
-#ifdef WLAN_FEATURE_11AC
-#define CSR_IS_PHY_MODE_DUAL_BAND(phyMode) \
-        ((eCSR_DOT11_MODE_abg & (phyMode)) || (eCSR_DOT11_MODE_11n & (phyMode)) || \
-        (eCSR_DOT11_MODE_11ac & (phyMode)) || \
-        (eCSR_DOT11_MODE_TAURUS & (phyMode)) || \
-        (eCSR_DOT11_MODE_AUTO & (phyMode)))
-#else
 #define CSR_IS_PHY_MODE_DUAL_BAND(phyMode) \
         ((eCSR_DOT11_MODE_abg & (phyMode)) || (eCSR_DOT11_MODE_11n & (phyMode)) || \
         (eCSR_DOT11_MODE_TAURUS & (phyMode)) || \
         (eCSR_DOT11_MODE_AUTO & (phyMode)))
-#endif
-
 
 // this function returns TRUE if the NIC is operating exclusively in the 2.4 GHz band, meaning
 // it is NOT operating in the 5.0 GHz band.
@@ -982,7 +940,7 @@
         (CSR_IS_OPEARTING_DUAL_BAND((pMac)) || CSR_IS_RADIO_BG_ONLY((pMac)) || CSR_IS_24_BAND_ONLY((pMac)))
 
 #define CSR_IS_CHANNEL_5GHZ(chnNum) \
-        (((chnNum) >= CSR_MIN_5GHz_CHANNEL_NUMBER) && ((chnNum) <= CSR_MAX_5GHz_CHANNEL_NUMBER))
+        ((chnNum) > CSR_MAX_24GHz_CHANNEL_NUMBER)
 
 #define CSR_IS_CHANNEL_24GHZ(chnNum) \
         (((chnNum) > 0) && ((chnNum) <= CSR_MAX_24GHz_CHANNEL_NUMBER))
@@ -1044,14 +1002,15 @@
 tANI_BOOLEAN csrIsAllSessionDisconnected( tpAniSirGlobal pMac );
 tANI_BOOLEAN csrIsInfraConnected( tpAniSirGlobal pMac );
 tANI_BOOLEAN csrIsConcurrentInfraConnected( tpAniSirGlobal pMac );
+#ifndef BMPS_WORKAROUND_NOT_NEEDED
 tANI_BOOLEAN csrIsConcurrentSessionRunning( tpAniSirGlobal pMac );
 tANI_BOOLEAN csrIsInfraApStarted( tpAniSirGlobal pMac );
+#endif
 tANI_BOOLEAN csrIsIBSSStarted( tpAniSirGlobal pMac );
 tANI_BOOLEAN csrIsBTAMPStarted( tpAniSirGlobal pMac );
 tANI_BOOLEAN csrIsBTAMP( tpAniSirGlobal pMac, tANI_U32 sessionId );
 eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId );
-tANI_BOOLEAN csrIsValidMcConcurrentSession(tpAniSirGlobal pMac, tANI_U32 sessionId,
-                                                  tSirBssDescription *pBssDesc);
+tANI_BOOLEAN csrIsValidMcConcurrentSession(tpAniSirGlobal pMac, tANI_U32 sessionId);
 #ifdef WLAN_SOFTAP_FEATURE
 tANI_BOOLEAN csrIsConnStateConnectedInfraAp( tpAniSirGlobal pMac, tANI_U32 sessionId );
 #endif
@@ -1222,13 +1181,7 @@
 tANI_BOOLEAN csrRoamIsCCXAssoc(tpAniSirGlobal pMac);
 #endif
 
+#ifndef BMPS_WORKAROUND_NOT_NEEDED
 void csrDisconnectAllActiveSessions(tpAniSirGlobal pMac);
-
-#ifdef FEATURE_WLAN_LFR
-//Returns whether "Legacy Fast Roaming" is enabled...or not
-tANI_BOOLEAN csrRoamIsFastRoamEnabled(tpAniSirGlobal pMac);
-tANI_BOOLEAN csrIsChannelPresentInList( tANI_U8 *pChannelList, int  numChannels, tANI_U8   channel );
-VOS_STATUS csrAddToChannelListFront( tANI_U8 *pChannelList, int  numChannels, tANI_U8   channel );
-tANI_BOOLEAN csrNeighborRoamIsSsidCandidateMatch( tpAniSirGlobal pMac, tDot11fBeaconIEs *pIes);
 #endif
 
diff --git a/drivers/staging/prima/CORE/SME/inc/csrLinkList.h b/drivers/staging/prima/CORE/SME/inc/csrLinkList.h
index bc88449..569ca14 100644
--- a/drivers/staging/prima/CORE/SME/inc/csrLinkList.h
+++ b/drivers/staging/prima/CORE/SME/inc/csrLinkList.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/csrNeighborRoam.h b/drivers/staging/prima/CORE/SME/inc/csrNeighborRoam.h
index 8659fe7..b5f535b 100644
--- a/drivers/staging/prima/CORE/SME/inc/csrNeighborRoam.h
+++ b/drivers/staging/prima/CORE/SME/inc/csrNeighborRoam.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -85,9 +85,9 @@
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
 #define CSR_NEIGHBOR_ROAM_REPORT_QUERY_TIMEOUT  1000    //in milliseconds
-#define CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER   10     //in milliseconds
+#define CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER   5     //in milliseconds
 #define MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS       10 //Max number of MAC addresses with which the pre-auth was failed
-#define MAX_BSS_IN_NEIGHBOR_RPT                 15
+#define MAX_BSS_IN_NEIGHBOR_RPT                 4
 #define CSR_NEIGHBOR_ROAM_MAX_NUM_PREAUTH_RETRIES 3
 
 /* Black listed APs. List of MAC Addresses with which the Preauthentication was failed. */
@@ -127,15 +127,6 @@
  * NEIGHBOR_LOOKUP_THRESHOLD_INCREMENT_CONSTANT) */
 #define NEIGHBOR_LOOKUP_THRESHOLD_INCREMENT_CONSTANT    5
 #define LOOKUP_THRESHOLD_INCREMENT_MULTIPLIER_MAX       4
-/* 
- * For every scan that results in no candidates, double the scan periodicity 
- * (initialized to NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MIN) until we hit 
- * NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MAX (60s). Subsequently, scan every 
- * 60s if we continue to find no candidates. Once a candidate is found, 
- * the periodicity is reset back to NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MIN.
- */
-#define NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MIN (1000)
-#define NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MAX (60000)
 
 /* Complete control information for neighbor roam algorithm */
 typedef struct sCsrNeighborRoamControlInfo
@@ -150,6 +141,7 @@
     tCsrTimerInfo               neighborScanTimerInfo;
     tCsrNeighborRoamChannelInfo roamChannelInfo;
     tANI_U8                     currentNeighborLookupThreshold;
+    tANI_U8                     currentLookupIncrementMultiplier;
     tANI_BOOLEAN                scanRspPending;
     tANI_TIMESTAMP              scanRequestTimeStamp;
     tDblLinkList                roamableAPList;    // List of current FT candidates
@@ -164,7 +156,6 @@
     tANI_BOOLEAN                isVOAdmitted;
     tANI_U32                    MinQBssLoadRequired;
 #endif
-    tANI_U16                    currentScanResultsRefreshPeriod;
 } tCsrNeighborRoamControlInfo, *tpCsrNeighborRoamControlInfo;
 
 
@@ -180,7 +171,7 @@
 VOS_STATUS csrNeighborRoamTransitionToPreauthDone(tpAniSirGlobal pMac);
 eHalStatus csrNeighborRoamPrepareScanProfileFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter);
 void csrNeighborRoamGetHandoffAPInfo(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo pHandoffNode);
-eHalStatus csrNeighborRoamPreauthRspHandler(tpAniSirGlobal pMac, VOS_STATUS vosStatus);
+void csrNeighborRoamPreauthRspHandler(tpAniSirGlobal pMac, VOS_STATUS vosStatus);
 #ifdef WLAN_FEATURE_VOWIFI_11R
 tANI_BOOLEAN csrNeighborRoamIs11rAssoc(tpAniSirGlobal pMac);
 #endif
diff --git a/drivers/staging/prima/CORE/SME/inc/csrSupport.h b/drivers/staging/prima/CORE/SME/inc/csrSupport.h
index e4fa512..d7257e7 100644
--- a/drivers/staging/prima/CORE/SME/inc/csrSupport.h
+++ b/drivers/staging/prima/CORE/SME/inc/csrSupport.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -799,15 +799,6 @@
                       tCsrRoamModifyProfileFields *pModProfileFields,
                       tANI_U32 *pRoamId, v_BOOL_t fForce);
 
-eHalStatus
-csrIsconcurrentsessionValid(tpAniSirGlobal pMac,tANI_U32 cursessionId,
-                                 tVOS_CON_MODE currBssPersona);
-
-//BeaconInterval valiadation for MCC support
-eHalStatus csrValidateBeaconInterval(tpAniSirGlobal pMac, tANI_U8 channelId, 
-                                     tANI_U16 *beaconInterval, tANI_U32 cursessionId,
-                                     tVOS_CON_MODE currBssPersona);
-
 #ifdef WLAN_FEATURE_VOWIFI_11R
 tANI_BOOLEAN csrIsProfile11r( tCsrRoamProfile *pProfile );
 tANI_BOOLEAN csrIsAuthType11r( eCsrAuthType AuthType );
diff --git a/drivers/staging/prima/CORE/SME/inc/oemDataApi.h b/drivers/staging/prima/CORE/SME/inc/oemDataApi.h
index aeb01ce..0c665db 100644
--- a/drivers/staging/prima/CORE/SME/inc/oemDataApi.h
+++ b/drivers/staging/prima/CORE/SME/inc/oemDataApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/oemDataInternal.h b/drivers/staging/prima/CORE/SME/inc/oemDataInternal.h
index f7b9cc8..82c9197 100644
--- a/drivers/staging/prima/CORE/SME/inc/oemDataInternal.h
+++ b/drivers/staging/prima/CORE/SME/inc/oemDataInternal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/p2p_Api.h b/drivers/staging/prima/CORE/SME/inc/p2p_Api.h
index ffe7755..47449bc 100644
--- a/drivers/staging/prima/CORE/SME/inc/p2p_Api.h
+++ b/drivers/staging/prima/CORE/SME/inc/p2p_Api.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/pmc.h b/drivers/staging/prima/CORE/SME/inc/pmc.h
index 033a6a6..e2e3c7f 100644
--- a/drivers/staging/prima/CORE/SME/inc/pmc.h
+++ b/drivers/staging/prima/CORE/SME/inc/pmc.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/pmcApi.h b/drivers/staging/prima/CORE/SME/inc/pmcApi.h
index 185cc3c..05a7fff 100644
--- a/drivers/staging/prima/CORE/SME/inc/pmcApi.h
+++ b/drivers/staging/prima/CORE/SME/inc/pmcApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -420,8 +420,7 @@
 extern eHalStatus pmcExitWowl (tHalHandle hHal);
 
 
-extern eHalStatus pmcSetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest,
-                                          tANI_U8 *bssId);
+extern eHalStatus pmcSetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest);
 
 /* ---------------------------------------------------------------------------
     \fn pmcSetKeepAlive
@@ -432,7 +431,7 @@
             eHAL_STATUS_FAILURE  Cannot set the keepalive.
             eHAL_STATUS_SUCCESS  Request accepted. 
   ---------------------------------------------------------------------------*/
-extern eHalStatus pmcSetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest, tANI_U8 *bssId);
+extern eHalStatus pmcSetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest);
 
 extern tANI_BOOLEAN pmcValidateConnectState( tHalHandle hHal );
 
diff --git a/drivers/staging/prima/CORE/SME/inc/smeInside.h b/drivers/staging/prima/CORE/SME/inc/smeInside.h
index 1c2b361..27ad4d0 100644
--- a/drivers/staging/prima/CORE/SME/inc/smeInside.h
+++ b/drivers/staging/prima/CORE/SME/inc/smeInside.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -190,7 +190,7 @@
             eHAL_STATUS_FAILURE  Cannot set the offload.
             eHAL_STATUS_SUCCESS  Request accepted. 
   ---------------------------------------------------------------------------*/
-eHalStatus pmcSetNSOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest, tANI_U8 *bssId);
+eHalStatus pmcSetNSOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest);
 #endif //WLAN_NS_OFFLOAD
 
 #ifdef FEATURE_WLAN_SCAN_PNO
diff --git a/drivers/staging/prima/CORE/SME/inc/smeInternal.h b/drivers/staging/prima/CORE/SME/inc/smeInternal.h
index fe54444..2494651 100644
--- a/drivers/staging/prima/CORE/SME/inc/smeInternal.h
+++ b/drivers/staging/prima/CORE/SME/inc/smeInternal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/smeQosInternal.h b/drivers/staging/prima/CORE/SME/inc/smeQosInternal.h
index 54276c4..f318af1 100644
--- a/drivers/staging/prima/CORE/SME/inc/smeQosInternal.h
+++ b/drivers/staging/prima/CORE/SME/inc/smeQosInternal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/smeRrmInternal.h b/drivers/staging/prima/CORE/SME/inc/smeRrmInternal.h
index 21398b8..072a5e0 100644
--- a/drivers/staging/prima/CORE/SME/inc/smeRrmInternal.h
+++ b/drivers/staging/prima/CORE/SME/inc/smeRrmInternal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/sme_Api.h b/drivers/staging/prima/CORE/SME/inc/sme_Api.h
index 2d908d7..9eef901 100644
--- a/drivers/staging/prima/CORE/SME/inc/sme_Api.h
+++ b/drivers/staging/prima/CORE/SME/inc/sme_Api.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -84,18 +84,14 @@
 #if defined WLAN_FEATURE_VOWIFI
    tRrmConfigParam  rrmConfig;
 #endif
-#if defined FEATURE_WLAN_LFR
-    tANI_U8   isFastRoamIniFeatureEnabled;
-#endif
 #if defined FEATURE_WLAN_CCX
     tANI_U8   isCcxIniFeatureEnabled;
 #endif
 #if defined WLAN_FEATURE_P2P_INTERNAL
    tP2PConfigParam  p2pConfig;
 #endif
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
     tANI_U8   isFastTransitionEnabled;
-    tANI_U8   RoamRssiDiff;
 #endif
 } tSmeConfigParams, *tpSmeConfigParams;
 
@@ -422,7 +418,7 @@
     \return eHalStatus     
   ---------------------------------------------------------------------------*/
 eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId);
-eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId);
+
 
 /* ---------------------------------------------------------------------------
     \fn sme_ScanResultGetFirst
@@ -1640,8 +1636,7 @@
     \param  pRequest -  Pointer to the offload request.
     \return eHalStatus
    ---------------------------------------------------------------------------*/
-eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
-                                    tpSirHostOffloadReq pRequest);
+eHalStatus sme_SetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest);
 
 /* ---------------------------------------------------------------------------
     \fn sme_SetKeepAlive
@@ -1650,8 +1645,7 @@
     \param  pRequest -  Pointer to the Keep Alive request.
     \return eHalStatus
   ---------------------------------------------------------------------------*/
-eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
-                                  tpSirKeepAliveReq pRequest);
+eHalStatus sme_SetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest);
 
 
 /* ---------------------------------------------------------------------------
@@ -1940,8 +1934,7 @@
     \param  pRcvPktFilterCfg - Receive Packet Filter parameter
     \return eHalStatus   
   ---------------------------------------------------------------------------*/
-eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
-                                           tANI_U8 sessionId);
+eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg);
 
 /* ---------------------------------------------------------------------------
     \fn sme_GetFilterMatchCount
@@ -1963,8 +1956,7 @@
     \return eHalStatus   
   ---------------------------------------------------------------------------*/
 eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal,
-                                        tpSirRcvFltPktClearParam pRcvFltPktClearParam,
-                                        tANI_U8  sessionId);
+                                        tpSirRcvFltPktClearParam pRcvFltPktClearParam);
 #endif // WLAN_FEATURE_PACKET_FILTERING
 /* ---------------------------------------------------------------------------
 
@@ -2126,46 +2118,4 @@
 ---------------------------------------------------------------------------*/
 void sme_featureCapsExchange(tHalHandle hHal);
 
-/*---------------------------------------------------------------------------
-
-  \brief sme_GetDefaultCountryCodeFrmNv() - SME interface to get the default 
-         country code
-  Host and FW.
-
-  \param  hHal - HAL handle for device
-  \param  pCountry - pointer to country code
-
-  \return Sucess or failure
-
-  ---------------------------------------------------------------------------*/
-eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry);
-
-/*---------------------------------------------------------------------------
-
-  \brief sme_GetCurrentCountryCode() - SME interface to get the current operating
-          country code.
-
-  \param  hHal - HAL handle for device
-  \param  pCountry - pointer to country code
-
-  \return Success or failure
-
-  ---------------------------------------------------------------------------*/
-eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry);
-
-/* ---------------------------------------------------------------------------
-    \fn sme_transportDebug
-    \brief  Dynamically monitoring Transport channels
-            Private IOCTL will querry transport channel status if driver loaded
-    \param  displaySnapshot Dispaly transport cahnnel snapshot option
-    \param  toggleStallDetect Enable stall detect feature
-                              This feature will take effect to data performance
-                              Not integrate till fully verification
-    \- return NONE
-    -------------------------------------------------------------------------*/
-void sme_transportDebug
-(
-   v_BOOL_t  displaySnapshot,
-   v_BOOL_t  toggleStallDetect
-);
 #endif //#if !defined( __SME_API_H )
diff --git a/drivers/staging/prima/CORE/SME/inc/sme_FTApi.h b/drivers/staging/prima/CORE/SME/inc/sme_FTApi.h
index 314069b..30465c6 100644
--- a/drivers/staging/prima/CORE/SME/inc/sme_FTApi.h
+++ b/drivers/staging/prima/CORE/SME/inc/sme_FTApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/sme_QosApi.h b/drivers/staging/prima/CORE/SME/inc/sme_QosApi.h
index f7b8dba..d6614fd 100644
--- a/drivers/staging/prima/CORE/SME/inc/sme_QosApi.h
+++ b/drivers/staging/prima/CORE/SME/inc/sme_QosApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/sme_RrmApi.h b/drivers/staging/prima/CORE/SME/inc/sme_RrmApi.h
index 530e83e..9b105b2 100644
--- a/drivers/staging/prima/CORE/SME/inc/sme_RrmApi.h
+++ b/drivers/staging/prima/CORE/SME/inc/sme_RrmApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/smsDebug.h b/drivers/staging/prima/CORE/SME/inc/smsDebug.h
index d2984e1..9d91493 100644
--- a/drivers/staging/prima/CORE/SME/inc/smsDebug.h
+++ b/drivers/staging/prima/CORE/SME/inc/smsDebug.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/inc/wlan_ps_wow_diag.h b/drivers/staging/prima/CORE/SME/inc/wlan_ps_wow_diag.h
index 8195fc0..0291923 100644
--- a/drivers/staging/prima/CORE/SME/inc/wlan_ps_wow_diag.h
+++ b/drivers/staging/prima/CORE/SME/inc/wlan_ps_wow_diag.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/src/QoS/sme_Qos.c b/drivers/staging/prima/CORE/SME/src/QoS/sme_Qos.c
index aebbba3..7729594 100644
--- a/drivers/staging/prima/CORE/SME/src/QoS/sme_Qos.c
+++ b/drivers/staging/prima/CORE/SME/src/QoS/sme_Qos.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1093,7 +1093,7 @@
       case SME_QOS_CSR_PREAUTH_SUCCESS_IND:
          status = sme_QosProcessPreauthSuccessInd(pMac, sessionId, pEvent_info);
          break;
-#if defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#ifdef FEATURE_WLAN_CCX
       case SME_QOS_CSR_SET_KEY_SUCCESS_IND:
          status = sme_QosProcessSetKeySuccessInd(pMac, sessionId, pEvent_info);
          break;
@@ -2955,7 +2955,7 @@
    return status;
 }
 
-#if defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#ifdef FEATURE_WLAN_CCX
 /* This is a dummy function now. But the purpose of me adding this was to 
  * delay the TSPEC processing till SET_KEY completes. This function can be 
  * used to do any SME_QOS processing after the SET_KEY. As of now, it is 
@@ -2965,12 +2965,10 @@
 eHalStatus sme_QosProcessSetKeySuccessInd(tpAniSirGlobal pMac, v_U8_t sessionId, void * pEvent_info)
 {
     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, 
-            "########### Set Key Complete #############");
+            "########### CCX Set Key Complete #############");
     return eHAL_STATUS_SUCCESS;
 }
-#endif
 
-#ifdef FEATURE_WLAN_CCX
 /*--------------------------------------------------------------------------
   \brief sme_QosCCXSaveTspecResponse() - This function saves the TSPEC
          parameters that came along in the TSPEC IE in the reassoc response
@@ -7173,14 +7171,14 @@
       break;
    default:
       status = eHAL_STATUS_SUCCESS;
-      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
                 "%s: %d: nothing to process in PMC state %d",
                 __FUNCTION__, __LINE__,
                 pmcState);
    }
    if(!HAL_STATUS_SUCCESS(status))
    {
-      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
                 "%s: %d: ignoring Device(PMC) state change to %d",
                 __FUNCTION__, __LINE__,
                 pmcState);
@@ -7206,7 +7204,7 @@
    pEntry = csrLLPeekHead( &sme_QosCb.flow_list, VOS_FALSE );
    if(!pEntry)
    {
-      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, 
+      VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
                 "%s: %d: Flow List empty, can't search",
                 __FUNCTION__, __LINE__);
       return eHAL_STATUS_FAILURE;
diff --git a/drivers/staging/prima/CORE/SME/src/btc/btcApi.c b/drivers/staging/prima/CORE/SME/src/btc/btcApi.c
index d92e03c..36d1fbe 100644
--- a/drivers/staging/prima/CORE/SME/src/btc/btcApi.c
+++ b/drivers/staging/prima/CORE/SME/src/btc/btcApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -70,21 +70,6 @@
    pMac->btc.btcConfig.btcBtIntervalMode1 = BTC_BT_INTERVAL_MODE1_DEFAULT;
    pMac->btc.btcConfig.btcWlanIntervalMode1 = BTC_WLAN_INTERVAL_MODE1_DEFAULT;
    pMac->btc.btcConfig.btcActionOnPmFail = BTC_START_NEXT;
-
-   pMac->btc.btcConfig.btcStaticLenInqBt = BTC_STATIC_BT_LEN_INQ_DEF;
-   pMac->btc.btcConfig.btcStaticLenPageBt = BTC_STATIC_BT_LEN_PAGE_DEF;
-   pMac->btc.btcConfig.btcStaticLenConnBt = BTC_STATIC_BT_LEN_CONN_DEF;
-   pMac->btc.btcConfig.btcStaticLenLeBt = BTC_STATIC_BT_LEN_LE_DEF;
-   pMac->btc.btcConfig.btcStaticLenInqWlan = BTC_STATIC_WLAN_LEN_INQ_DEF;
-   pMac->btc.btcConfig.btcStaticLenPageWlan = BTC_STATIC_WLAN_LEN_PAGE_DEF;
-   pMac->btc.btcConfig.btcStaticLenConnWlan = BTC_STATIC_WLAN_LEN_CONN_DEF;
-   pMac->btc.btcConfig.btcStaticLenLeWlan = BTC_STATIC_WLAN_LEN_LE_DEF;
-   pMac->btc.btcConfig.btcDynMaxLenBt = BTC_DYNAMIC_BT_LEN_MAX_DEF;
-   pMac->btc.btcConfig.btcDynMaxLenWlan = BTC_DYNAMIC_WLAN_LEN_MAX_DEF;
-   pMac->btc.btcConfig.btcMaxScoBlockPerc = BTC_SCO_BLOCK_PERC_DEF;
-   pMac->btc.btcConfig.btcDhcpProtOnA2dp = BTC_DHCP_ON_A2DP_DEF;
-   pMac->btc.btcConfig.btcDhcpProtOnSco = BTC_DHCP_ON_SCO_DEF;
-
    pMac->btc.btcReady = VOS_FALSE;
    pMac->btc.btcEventState = 0;
    pMac->btc.btcHBActive = VOS_TRUE;
diff --git a/drivers/staging/prima/CORE/SME/src/ccm/ccmApi.c b/drivers/staging/prima/CORE/SME/src/ccm/ccmApi.c
index 46a2c20..ac50aff 100644
--- a/drivers/staging/prima/CORE/SME/src/ccm/ccmApi.c
+++ b/drivers/staging/prima/CORE/SME/src/ccm/ccmApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -342,7 +342,7 @@
     if (pal_in_interrupt())
     {
 #ifdef CCM_DEBUG2
-        smsLog(pMac, LOG1, FL("WNI_CFG_%s (%d 0x%x), in_interrupt()=TRUE"), gCfgParamName[cfgId], (int)cfgId, (int)cfgId);
+        smsLog(pMac, LOGE, FL("WNI_CFG_%s (%d 0x%x), in_interrupt()=TRUE\n"), gCfgParamName[cfgId], (int)cfgId, (int)cfgId);
 #endif
         status = cfgSetSub(pMac, hHdd, cfgId, type, length, ccmPtr, ccmValue, callback, toBeSaved, NULL, &req);
     }
@@ -351,7 +351,7 @@
         void *sem ;
 
 #ifdef CCM_DEBUG2
-        smsLog(pMac, LOG1, FL("WNI_CFG_%s (%d 0x%x), in_interrupt()=FALSE"), gCfgParamName[cfgId], (int)cfgId, (int)cfgId);
+        smsLog(pMac, LOGE, FL("WNI_CFG_%s (%d 0x%x), in_interrupt()=FALSE\n"), gCfgParamName[cfgId], (int)cfgId, (int)cfgId);
 #endif
         pal_local_bh_disable() ;
 
@@ -377,12 +377,12 @@
         if ((status == eHAL_STATUS_SUCCESS) && (sem != NULL))
         {
 #ifdef CCM_DEBUG
-            smsLog(pMac, LOG1, FL("ccmWaitForCompletion(%p)"), req->done);
+            smsLog(pMac, LOGW, FL("ccmWaitForCompletion(%p)\n"), req->done);
 #endif
             ccmWaitForCompletion(hHdd, sem);
 
 #ifdef CCM_DEBUG
-            smsLog(pMac, LOG1, FL("free(%p)"), req->done);
+            smsLog(pMac, LOGW, FL("free(%p)\n"), req->done);
 #endif
             palSemaphoreFree( hHdd, sem ) ;
         }
diff --git a/drivers/staging/prima/CORE/SME/src/ccm/ccmLogDump.c b/drivers/staging/prima/CORE/SME/src/ccm/ccmLogDump.c
index 3d08f8c..975bf68 100644
--- a/drivers/staging/prima/CORE/SME/src/ccm/ccmLogDump.c
+++ b/drivers/staging/prima/CORE/SME/src/ccm/ccmLogDump.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c b/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c
index 268fbfb..55af851 100644
--- a/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c
+++ b/drivers/staging/prima/CORE/SME/src/csr/csrApiRoam.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -21,7 +21,7 @@
 
 /** ------------------------------------------------------------------------- * 
     ------------------------------------------------------------------------- *  
-  
+
   
     \file csrApiRoam.c
   
@@ -31,27 +31,36 @@
   
  
    ========================================================================== */
+
 /*===========================================================================
+
                       EDIT HISTORY FOR FILE
 
+
   This section contains comments describing changes made to the module.
   Notice that changes are listed in reverse chronological order.
 
+
+
   when            who                 what, where, why
 ----------       ---                --------------------------------------------------------
 06/03/10     js                     Added support to hostapd driven 
  *                                  deauth/disassoc/mic failure
+
 ===========================================================================*/
+
 #include "aniGlobal.h" //for tpAniSirGlobal
 #include "wlan_qct_wda.h"
+
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
 #include "halMsgApi.h" //for HAL_STA_INVALID_IDX.
 #endif
+
 #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
 #include "halPhyApi.h"
 #include "halInternal.h"
 #endif
-#include "limUtils.h"
+
 #include "palApi.h"
 #include "csrInsideApi.h"
 #include "smsDebug.h"
@@ -64,12 +73,15 @@
 #include "csrApi.h"
 #include "pmc.h"
 #include "vos_nvitem.h"
+
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
 #include "csrNeighborRoam.h"
 #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
+
 #ifdef FEATURE_WLAN_CCX
 #include "csrCcx.h"
 #endif /* FEATURE_WLAN_CCX */
+
 #define CSR_NUM_IBSS_START_CHANNELS_50      4
 #define CSR_NUM_IBSS_START_CHANNELS_24      3
 #define CSR_DEF_IBSS_START_CHANNEL_50       36
@@ -81,6 +93,7 @@
   OBIWAN recommends [8 10]% : pick 9% 
 ---------------------------------------------------------------------------*/
 #define CSR_VCC_UL_MAC_LOSS_THRESHOLD 9
+
 /*---------------------------------------------------------------------------
   OBIWAN recommends -85dBm 
 ---------------------------------------------------------------------------*/
@@ -89,43 +102,51 @@
 #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS 2000 //ms
 #define CSR_MIN_TL_STAT_QUERY_PERIOD       500 //ms
 #define CSR_DIAG_LOG_STAT_PERIOD           3000 //ms
+
 //We use constatnt 4 here
 //This macro returns true when higher AC parameter is bigger than lower AC for a difference
 //The bigger the number, the less chance of TX
 //It must put lower AC as the first parameter.
 #define SME_DETECT_AC_WEIGHT_DIFF(loAC, hiAC)   (v_BOOL_t)(((hiAC) > (loAC)) ? (((hiAC)-(loAC)) > 4) : 0)
+
 //Flag to send/do not send disassoc frame over the air
 #define CSR_DONT_SEND_DISASSOC_OVER_THE_AIR 1
-#define RSSI_HACK_BMPS (-40)
-#define MAX_CB_VALUE_IN_INI (2)
 
+#define RSSI_HACK_BMPS (-40)
 /*-------------------------------------------------------------------------- 
   Static Type declarations
   ------------------------------------------------------------------------*/
 static tChannelListWithPower csrRoamPowerTableFromEeprom[WNI_CFG_VALID_CHANNEL_LIST_LEN];
 static tChannelListWithPower csrRoamPowerTableFromEeprom40MHz[WNI_CFG_VALID_CHANNEL_LIST_LEN];
 static tCsrRoamSession       csrRoamRoamSession[CSR_ROAM_SESSION_MAX];
+
 /*-------------------------------------------------------------------------- 
   Type declarations
   ------------------------------------------------------------------------*/
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
 int diagAuthTypeFromCSRType(eCsrAuthType authType)
 {
     int n = AUTH_OPEN;
+
     switch(authType)
     {
     case eCSR_AUTH_TYPE_SHARED_KEY:
         n = AUTH_SHARED;
         break;
+
     case eCSR_AUTH_TYPE_WPA:
         n = AUTH_WPA_EAP;
         break;
+
     case eCSR_AUTH_TYPE_WPA_PSK:
         n = AUTH_WPA_PSK;
         break;
+
     case eCSR_AUTH_TYPE_RSN:
         n = AUTH_WPA2_EAP;
         break;
+
     case eCSR_AUTH_TYPE_RSN_PSK:
         n = AUTH_WPA2_PSK;
         break;
@@ -133,34 +154,43 @@
     case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE:
         n = AUTH_WAPI_CERT;
         break;
+
     case eCSR_AUTH_TYPE_WAPI_WAI_PSK:
         n = AUTH_WAPI_PSK;
         break;
 #endif /* FEATURE_WLAN_WAPI */
+
     default:
         break;
     }
+
     return (n);
 }
+
 int diagEncTypeFromCSRType(eCsrEncryptionType encType)
 {
     int n = ENC_MODE_OPEN;
+
     switch(encType)
     {
     case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
     case eCSR_ENCRYPT_TYPE_WEP40:
         n = ENC_MODE_WEP40;
         break;
+
     case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
     case eCSR_ENCRYPT_TYPE_WEP104:
         n = ENC_MODE_WEP104;
         break;
+
     case eCSR_ENCRYPT_TYPE_TKIP:
         n = ENC_MODE_TKIP;
         break;
+
     case eCSR_ENCRYPT_TYPE_AES:
         n = ENC_MODE_AES;
         break;
+
 #ifdef FEATURE_WLAN_WAPI
     case eCSR_ENCRYPT_TYPE_WPI:
         n = ENC_MODE_SMS4;
@@ -169,11 +199,15 @@
     default:
         break;
     }
+
     return (n);
 }
+
 #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
 static const tANI_U8 csrStartIbssChannels50[ CSR_NUM_IBSS_START_CHANNELS_50 ] = { 36, 40,  44,  48}; 
 static const tANI_U8 csrStartIbssChannels24[ CSR_NUM_IBSS_START_CHANNELS_24 ] = { 1, 6, 11 };
+
 static void initConfigParam(tpAniSirGlobal pMac);
 static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand,
                                        eCsrRoamCompleteResult Result, void *Context );
@@ -182,8 +216,8 @@
                                     tANI_BOOLEAN *pfSameIbss );
 static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirSmeNewBssInfo *pNewBss );
 static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
-                                     tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes);
-static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes);
+                                     tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes);
+static tAniCBSecondaryMode csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes);
 eHalStatus csrInitGetChannels(tpAniSirGlobal pMac);
 static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result );
 eHalStatus csrRoamOpen(tpAniSirGlobal pMac);
@@ -215,6 +249,7 @@
                                     tCsrRoamProfile *pProfile );
 void csrRoamStatisticsTimerHandler(void *pv);
 void csrRoamStatsGlobalClassDTimerHandler(void *pv);
+
 static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid);
 VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, 
                                             v_U8_t  rssiNotification, 
@@ -226,12 +261,15 @@
     pStaEntry is no longer invalid upon the return of this function.
 */
 static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry);
+
 #ifdef WLAN_SOFTAP_FEATURE
 static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile,tANI_U8 operationChn, eCsrBand *pBand );
 #else
 static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, eCsrPhyMode phyModeIn, tANI_U8 operationChn, eCsrBand *pBand );
 #endif
 static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc);
+
+
 tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac,
                                                      tDblLinkList *pStaList,
                                                      tCsrStatsClientReqInfo *pStaEntry);
@@ -240,7 +278,7 @@
                                                  tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId);
 void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, 
                              tCsrStatsCallback callback, tANI_U8 staId, void *pContext);
-void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats);
+void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE tlStats);
 void csrRoamTlStatsTimerHandler(void *pv);
 void csrRoamPeStatsTimerHandler(void *pv);
 tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask);
@@ -259,9 +297,10 @@
 void csrRoamJoinRetryTimerHandler(void *pv);
 #endif
 extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
+
 extern void btampEstablishLogLinkHdlr(void* pMsg);
+
 static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp);
-void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand);
 
 //Initialize global variables
 static void csrRoamInitGlobals(tpAniSirGlobal pMac)
@@ -275,6 +314,7 @@
     return;
 }
 
+
 static void csrRoamDeInitGlobals(tpAniSirGlobal pMac)
 {
     if(pMac)
@@ -285,11 +325,13 @@
     }
     return;
 }
+
 eHalStatus csrOpen(tpAniSirGlobal pMac)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     static uNvTables nvTables;
     VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
     v_REGDOMAIN_t regId;
     tANI_U32 i;
     
@@ -297,6 +339,7 @@
     {
         /* Initialize CSR Roam Globals */
         csrRoamInitGlobals(pMac);
+
         for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
            csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i);
 
@@ -312,6 +355,7 @@
            break;
         if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.roamCmdPendingList)))
            break;
+
         vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
         if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
         {
@@ -327,20 +371,25 @@
             pMac->scan.countryCodeDefault[1] = 'S';
             pMac->scan.countryCodeDefault[2] = 'I';
             //status = eHAL_STATUS_SUCCESS;
-        }        
+        }
         smsLog( pMac, LOGE, FL(" country Code from nvRam %s\n"), pMac->scan.countryCodeDefault );
+
         csrGetRegulatoryDomainForCountry(pMac, pMac->scan.countryCodeDefault, &regId);
+
         WDA_SetRegDomain(pMac, regId);
         pMac->scan.domainIdDefault = regId;
         pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault;
+
         status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, 
                          pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN);
         status = csrInitGetChannels( pMac );
+
     }while(0);
     
     return (status);
 }
 
+
 #ifdef WLAN_SOFTAP_FEATURE
 eHalStatus csrSetRegInfo(tHalHandle hHal,  tANI_U8 *apCntryCode)
 {
@@ -348,30 +397,37 @@
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     v_REGDOMAIN_t regId;
     v_U8_t        cntryCodeLength;
+
     if(NULL == apCntryCode)
     {
        smsLog( pMac, LOGW, FL(" Invalid country Code Pointer\n") );
        return eHAL_STATUS_FAILURE;
     }
+
     smsLog( pMac, LOGW, FL(" country Code %s\n"), apCntryCode );
+
     /* To get correct Regulatory domain from NV table 
      * 2 character Country code should be used
      * 3rd charater is optional for indoor/outdoor setting */
     cntryCodeLength = strlen(apCntryCode);
+
     status = csrGetRegulatoryDomainForCountry(pMac, apCntryCode, &regId);
     if (status != eHAL_STATUS_SUCCESS)
     {
         smsLog( pMac, LOGE, FL("  fail to get regId for country Code %s\n"), apCntryCode );
         return status;
     }
+
     status = WDA_SetRegDomain(hHal, regId);
     if (status != eHAL_STATUS_SUCCESS)
     {
         smsLog( pMac, LOGE, FL("  fail to get regId for country Code %s\n"), apCntryCode );
         return status;
     }
+
     pMac->scan.domainIdDefault = regId;
     pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault;
+
     /* Clear CC field */
     palFillMemory( pMac->hHdd,
                    pMac->scan.countryCodeDefault,
@@ -380,6 +436,7 @@
     /* Copy 2 or 3 bytes country code */
     palCopyMemory( pMac->hHdd, pMac->scan.countryCodeDefault, 
                 apCntryCode, cntryCodeLength );
+
     /* If 2 bytes country code, 3rd byte must be filled with space */
     if((WNI_CFG_COUNTRY_CODE_LEN - 1) == cntryCodeLength)
     {
@@ -388,18 +445,23 @@
                       1,
                       0x20 );
     }
+
     status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, 
                                pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN);
     status = csrInitGetChannels( pMac );
+
     return status;
 }
+
 eHalStatus csrSetChannels(tHalHandle hHal,  tCsrConfigParam *pParam  )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     tANI_U8   index = 0;
+
     palCopyMemory( pMac->hHdd, pParam->Csr11dinfo.countryCode, 
                    pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN );
+
     for ( index = 0; index < pMac->scan.base20MHzChannels.numChannels ; index++)
     {
         pParam->Csr11dinfo.Channels.channelList[index] = pMac->scan.base20MHzChannels.channelList[ index ];
@@ -412,6 +474,7 @@
     return status;
 }
 #endif
+
 eHalStatus csrClose(tpAniSirGlobal pMac)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -422,10 +485,13 @@
     csrLLClose(&pMac->roam.statsClientReqList);
     csrLLClose(&pMac->roam.peStatsReqList);
     csrLLClose(&pMac->roam.roamCmdPendingList);
+
     /* DeInit Globals */
     csrRoamDeInitGlobals(pMac);
+
     return (status);
 } 
+
 eHalStatus csrStart(tpAniSirGlobal pMac)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -459,12 +525,15 @@
            break;
         }
     }while(0);
+
 #if defined(ANI_LOGDUMP)
     csrDumpInit(pMac);
 #endif //#if defined(ANI_LOGDUMP)
+
     return (status);
 }
 
+
 eHalStatus csrStop(tpAniSirGlobal pMac)
 {
     tANI_U32 sessionId;
@@ -474,18 +543,22 @@
     {
         csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL);
     }
+
     csrScanDisable(pMac);
     pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE;
     pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
+
     csrLLPurge( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE );
     
 #if   defined WLAN_FEATURE_NEIGHBOR_ROAMING
     csrNeighborRoamClose(pMac);
 #endif
     csrScanFlushResult(pMac); //Do we want to do this?
+
     // deregister from PMC since we register during csrStart()
     // (ignore status since there is nothing we can do if it fails)
     (void) pmcDeregisterPowerSaveCheck(pMac, csrCheckPSReady);
+
     //Reset the domain back to the deault
     pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault;
     csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE);
@@ -499,44 +572,49 @@
     return (eHAL_STATUS_SUCCESS);
 }
 
+
 eHalStatus csrReady(tpAniSirGlobal pMac)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
+
     csrScanGetSupportedChannels( pMac );
     //WNI_CFG_VALID_CHANNEL_LIST should be set by this time
     //use it to init the background scan list
     csrInitBGScanChannelList(pMac);
     /* HDD issues the init scan */
     csrScanStartResultAgingTimer(pMac);
+
     //Store the AC weights in TL for later use
     WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights);
+
     status = csrInitChannelList( pMac );
     if ( ! HAL_STATUS_SUCCESS( status ) )
     {
        smsLog( pMac, LOGE, "csrInitChannelList failed during csrReady with status=%d\n",
                status );
     }
+
     return (status);
 }
+
 void csrSetDefaultDot11Mode( tpAniSirGlobal pMac )
 {
     v_U32_t wniDot11mode = 0;
+
     wniDot11mode = csrTranslateToWNICfgDot11Mode(pMac,pMac->roam.configParam.uCfgDot11Mode);
     ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, wniDot11mode, NULL, eANI_BOOLEAN_FALSE);
 }
+
 void csrSetGlobalCfgs( tpAniSirGlobal pMac )
 {
-
     ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE);
     ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE);
     ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED,
                         ((pMac->roam.configParam.Is11hSupportEnabled) ? pMac->roam.configParam.Is11dSupportEnabled : pMac->roam.configParam.Is11dSupportEnabled), 
                         NULL, eANI_BOOLEAN_FALSE);
     ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE);
-    /* For now we will just use the 5GHz CB mode ini parameter to decide whether CB supported or not in Probes when there is no session
-     * Once session is established we will use the session related params stored in PE session for CB mode
-     */
-    ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, !!(pMac->roam.configParam.channelBondingMode5GHz), NULL, eANI_BOOLEAN_FALSE);
+    //Enable channel bonding at init; for 2.4 Ghz we will update this CFG at start BSS or join 
+    ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, WNI_CFG_CHANNEL_BONDING_MODE_ENABLE, NULL, eANI_BOOLEAN_FALSE);
     ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->roam.configParam.HeartbeatThresh24, NULL, eANI_BOOLEAN_FALSE);
     
     //Update the operating mode to configured value during initialization,
@@ -544,11 +622,13 @@
     csrSetDefaultDot11Mode( pMac );    
 }
 
+
 eHalStatus csrRoamOpen(tpAniSirGlobal pMac)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tANI_U32 i;
     tCsrRoamSession *pSession;
+
     do
     {
         for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
@@ -557,6 +637,7 @@
             pSession->roamingTimerInfo.pMac = pMac;
             pSession->roamingTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
         }
+
         pMac->roam.WaitForKeyTimerInfo.pMac = pMac;
         pMac->roam.WaitForKeyTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
         status = palTimerAlloc(pMac->hHdd, &pMac->roam.hTimerWaitForKey, csrRoamWaitForKeyTimeOutHandler, 
@@ -566,6 +647,7 @@
         smsLog(pMac, LOGE, FL("cannot allocate memory for WaitForKey time out timer\n"));
         break;
       }
+
       status = palTimerAlloc(pMac->hHdd, &pMac->roam.tlStatsReqInfo.hTlStatsTimer, csrRoamTlStatsTimerHandler, pMac);
       if(!HAL_STATUS_SUCCESS(status))
       {
@@ -573,38 +655,49 @@
          return eHAL_STATUS_FAILURE;
       }
     }while (0);
+
     return (status);
 }
 
+
 eHalStatus csrRoamClose(tpAniSirGlobal pMac)
 {
     tANI_U32 sessionId;
+
     for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
     {
         csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL);
     }
+
     palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey);
     palTimerFree(pMac->hHdd, pMac->roam.hTimerWaitForKey);
+
     palTimerStop(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer);
     palTimerFree(pMac->hHdd, pMac->roam.tlStatsReqInfo.hTlStatsTimer);
+
     return (eHAL_STATUS_SUCCESS);
 }
 
+
 eHalStatus csrRoamStart(tpAniSirGlobal pMac)
 {
     (void)pMac;
+
     return (eHAL_STATUS_SUCCESS);
 }
 
+
 void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
    csrRoamStopRoamingTimer(pMac, sessionId);
    /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/
    csrRoamDeregStatisticsReq(pMac);
 }
+
 eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState)
 {
     eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+
     if( pState )
     {
         status = eHAL_STATUS_SUCCESS;
@@ -613,17 +706,13 @@
     return (status);
 }
 
+
+
 eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile)
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
     tANI_U32 size = 0;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
     
     if(pProfile)
     {
@@ -666,8 +755,10 @@
                     pProfile->MDID.mobilityDomain = 0;
                 }
 #endif
+
 #ifdef FEATURE_WLAN_CCX
                 pProfile->isCCXAssoc = pSession->connectedProfile.isCCXAssoc;
+
                 if (csrIsAuthTypeCCX(pSession->connectedProfile.AuthType))
                 {
                     palCopyMemory( pMac->hHdd, pProfile->ccxCckmInfo.krk, 
@@ -685,6 +776,8 @@
     return (status);
 }
 
+
+
 eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile)
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
@@ -696,8 +789,10 @@
             status = csrRoamCopyConnectProfile(pMac, sessionId, pProfile);
         }
     }
+
     return (status);
 }
+
 eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -711,9 +806,11 @@
     return (status);
 }
 
+
 static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
+
     if( pConnectedInfo->pbFrames )
     {
         palFreeMemory( pMac->hHdd, pConnectedInfo->pbFrames );
@@ -729,56 +826,59 @@
 #ifdef FEATURE_WLAN_CCX
     pConnectedInfo->nTspecIeLength = 0;
 #endif    
+
+
     return ( status );
 }
 
+
     
                 
-                
-void csrReleaseCommandPreauth(tpAniSirGlobal pMac, tSmeCmd *pCommand)
-{
-    csrReinitPreauthCmd(pMac, pCommand);
-    csrReleaseCommand( pMac, pCommand );
-}
-                
 void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand)
 {
     csrReinitRoamCmd(pMac, pCommand);
     csrReleaseCommand( pMac, pCommand );
 }
 
+
 void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand)
 {
     csrReinitScanCmd(pMac, pCommand);
     csrReleaseCommand( pMac, pCommand );
 }
 
+
 void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand)
 {
     csrReinitWmStatusChangeCmd(pMac, pCommand);
     csrReleaseCommand( pMac, pCommand );
 }
 
+
 void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand)
 {
     palZeroMemory(pMac->hHdd, &pCommand->u.setKeyCmd, sizeof(tSetKeyCmd));
 }
 
+
 void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand)
 {
     palZeroMemory(pMac->hHdd, &pCommand->u.removeKeyCmd, sizeof(tRemoveKeyCmd));
 }
 
+
 void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand)
 {
     csrReinitSetKeyCmd(pMac, pCommand);
     csrReleaseCommand( pMac, pCommand );
 }
+
 void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand)
 {
     csrReinitRemoveKeyCmd(pMac, pCommand);
     csrReleaseCommand( pMac, pCommand );
 }
+
 void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
 {
 
@@ -797,6 +897,7 @@
             }
             csrReleaseCommandScan( pMac, pCommand );
             break;
+
         case eSmeCommandRoam:
             csrReleaseCommandRoam( pMac, pCommand );
             break;
@@ -821,17 +922,21 @@
     }
 }
 
+
+
 void csrRoamSubstateChange( tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, tANI_U32 sessionId)
 {
     smsLog( pMac, LOG1, "   CSR RoamSubstate: [ %d <== %d ]\n", NewSubstate, pMac->roam.curSubState[sessionId]);
 
+
     if(pMac->roam.curSubState[sessionId] == NewSubstate)
     {
        return;
-    }
+                }
     pMac->roam.curSubState[sessionId] = NewSubstate;
 }
 
+
 eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId)
 {
     eCsrRoamState PreviousState;
@@ -853,9 +958,11 @@
     return( PreviousState );
 }
 
+
 void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_U8 catOffset)
 {
     int i;
+
     if(catOffset)
     {
         pMac->roam.configParam.bCatRssiOffset = catOffset;
@@ -866,13 +973,14 @@
     }
 }
 
+
 static void initConfigParam(tpAniSirGlobal pMac)
 {
     int i;
+
     pMac->roam.configParam.agingCount = CSR_AGING_COUNT;
     pMac->roam.configParam.channelBondingMode24GHz = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
     pMac->roam.configParam.channelBondingMode5GHz = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
-
     pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_TAURUS;
     pMac->roam.configParam.eBand = eCSR_BAND_ALL;
     pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
@@ -901,19 +1009,23 @@
     pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME;
     pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE;
     pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE;
+
     pMac->roam.configParam.fEnforceCountryCodeMatch = eANI_BOOLEAN_FALSE;
     pMac->roam.configParam.fEnforceDefaultDomain = eANI_BOOLEAN_FALSE;
     pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME;
     pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME;
     pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME;
     pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME;
+
     pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default
     pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER;
     pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD;
     pMac->roam.configParam.statsReqPeriodicityInPS = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS;
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
     pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0;
 #endif
+
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
     pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3;
     pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = 120;
@@ -927,25 +1039,26 @@
     pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[2] = 11;
     pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = 20000; //20 seconds
 #endif
-#ifdef WLAN_FEATURE_11AC
-     pMac->roam.configParam.nVhtChannelWidth = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1;
-#endif
 
     pMac->roam.configParam.addTSWhenACMIsOff = 0;
     pMac->roam.configParam.fScanTwice = eANI_BOOLEAN_FALSE;
-
+#ifndef BMPS_WORKAROUND_NOT_NEEDED
     pMac->roam.configParam.doBMPSWorkaround = 0;
+#endif
 
 }
+
 eCsrBand csrGetCurrentBand(tHalHandle hHal)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     return pMac->roam.configParam.bandCapability;
 }
+
 eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     eHalStatus status = eHAL_STATUS_SUCCESS;
+    
     if (CSR_IS_PHY_MODE_A_ONLY(pMac) &&
             (eBand == eCSR_BAND_24))
     {
@@ -956,6 +1069,7 @@
             pMac->roam.configParam.uCfgDot11Mode, eBand);
         return eHAL_STATUS_INVALID_PARAMETER;
     }
+
     if ((CSR_IS_PHY_MODE_B_ONLY(pMac) ||
                 CSR_IS_PHY_MODE_G_ONLY(pMac)) &&
             (eBand == eCSR_BAND_5G))
@@ -967,6 +1081,7 @@
             pMac->roam.configParam.uCfgDot11Mode, eBand);
         return eHAL_STATUS_INVALID_PARAMETER;
     }
+
     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
             "Band changed to %u (0 - ALL, 1 - 2.4 GHZ, 2 - 5GHZ)\n", eBand);
     pMac->roam.configParam.eBand = eBand; 
@@ -977,118 +1092,6 @@
         csrInitChannelList( hHal );
     return status;
 }
-/* The funcns csrConvertCBIniValueToPhyCBState and csrConvertPhyCBStateToIniValue have been
- * introduced to convert the ini value to the ENUM used in csr and MAC for CB state
- * Ideally we should have kept the ini value and enum value same and representing the same
- * cb values as in 11n standard i.e. 
- * Set to 1 (SCA) if the secondary channel is above the primary channel 
- * Set to 3 (SCB) if the secondary channel is below the primary channel 
- * Set to 0 (SCN) if no secondary channel is present 
- * However, since our driver is already distributed we will keep the ini definition as it is which is:
- * 0 - secondary none
- * 1 - secondary LOW
- * 2 - secondary HIGH
- * and convert to enum value used within the driver in csrChangeDefaultConfigParam using this funcn
- * The enum values are as follows:
- * PHY_SINGLE_CHANNEL_CENTERED          = 0
- * PHY_DOUBLE_CHANNEL_LOW_PRIMARY   = 1
- * PHY_DOUBLE_CHANNEL_HIGH_PRIMARY  = 3
- */
-ePhyChanBondState csrConvertCBIniValueToPhyCBState(v_U32_t cbIniValue)
-{
-
-   ePhyChanBondState phyCbState;
-   switch (cbIniValue) {
-      // secondary none
-      case 0:
-        phyCbState = PHY_SINGLE_CHANNEL_CENTERED;
-        break;
-      // secondary LOW
-      case 1:
-        phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
-        break;
-      // secondary HIGH
-      case 2:
-        phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
-        break;
-#ifdef WLAN_FEATURE_11AC
-      case 3:
-        phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; 
-        break;
-      case 4:
-        phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED;
-        break;
-      case 5:
-        phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED;
-        break; 
-      case 6:
-        phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
-        break;
-      case 7:
-        phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
-        break; 
-      case 8:
-        phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
-        break;
-      case 9:
-        phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
-        break; 
-#endif 
-      default:
-        // If an invalid value is passed, disable CHANNEL BONDING
-        phyCbState = PHY_SINGLE_CHANNEL_CENTERED;
-        break;
-   }
-   return phyCbState;
-}
-
-v_U32_t csrConvertPhyCBStateToIniValue(ePhyChanBondState phyCbState)
-{
-
-   v_U32_t cbIniValue;
-   switch (phyCbState) {
-      // secondary none
-      case PHY_SINGLE_CHANNEL_CENTERED:
-        cbIniValue = 0;
-        break;
-      // secondary LOW
-      case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
-        cbIniValue = 1;
-        break;
-      // secondary HIGH
-      case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
-        cbIniValue = 2;
-        break;
-#ifdef WLAN_FEATURE_11AC
-      case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
-        cbIniValue = 3;
-        break;
-      case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
-        cbIniValue = 4;
-        break;
-      case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
-        cbIniValue = 5;
-        break;
-      case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
-        cbIniValue = 6;
-        break;
-      case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
-        cbIniValue = 7;
-        break;
-      case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
-        cbIniValue = 8;
-        break;
-      case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
-        cbIniValue = 9;
-        break;
-#endif
-      default:
-        // return some invalid value
-        cbIniValue = 10;
-        break;
-   }
-   return cbIniValue;
-}
 
 eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam)
 {
@@ -1104,22 +1107,8 @@
         pMac->roam.configParam.Is11hSupportEnabled = pParam->Is11hSupportEnabled;
 
         pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode;
-        pMac->roam.configParam.fAllowMCCGODiffBI = pParam->fAllowMCCGODiffBI;
-        
-        /* channelBondingMode5GHz plays a dual role right now
-         * INFRA STA will use this non zero value as CB enabled and SOFTAP will use this non-zero value to determine the secondary channel offset
-         * This is how channelBondingMode5GHz works now and this is kept intact to avoid any cfg.ini change
-         */
-        if (pParam->channelBondingMode24GHz > MAX_CB_VALUE_IN_INI)
-        {
-            smsLog( pMac, LOGW, "Invalid CB value from ini in 2.4GHz band %d, CB DISABLED\n", pParam->channelBondingMode24GHz); 
-        }
-        pMac->roam.configParam.channelBondingMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode24GHz);
-        if (pParam->channelBondingMode5GHz > MAX_CB_VALUE_IN_INI)
-        {
-            smsLog( pMac, LOGW, "Invalid CB value from ini in 5GHz band %d, CB DISABLED\n", pParam->channelBondingMode5GHz); 
-        }
-        pMac->roam.configParam.channelBondingMode5GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode5GHz);
+        pMac->roam.configParam.channelBondingMode24GHz = pParam->channelBondingMode24GHz;
+        pMac->roam.configParam.channelBondingMode5GHz = pParam->channelBondingMode5GHz;
         pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold;
         pMac->roam.configParam.phyMode = pParam->phyMode;
         pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime;
@@ -1132,6 +1121,7 @@
         pMac->roam.configParam.bandCapability = pParam->bandCapability;
         pMac->roam.configParam.cbChoice = pParam->cbChoice;
         pMac->roam.configParam.bgScanInterval = pParam->bgScanInterval;
+
         //if HDD passed down non zero values then only update,
         //otherwise keep using the defaults
         if(pParam->nActiveMaxChnTime)
@@ -1155,6 +1145,7 @@
         {
             //Change the unit from second to microsecond
             tANI_U32 impsSleepTime = pParam->impsSleepTime * PAL_TIMER_TO_SEC_UNIT;
+
             if(CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN <= impsSleepTime)
             {
                 pMac->roam.configParam.impsSleepTime = impsSleepTime;
@@ -1182,14 +1173,17 @@
         {
             pMac->roam.configParam.agingCount = pParam->nScanResultAgeCount;
         }
+
         if(pParam->scanAgeTimeNCNPS)
         {
             pMac->roam.configParam.scanAgeTimeNCNPS = pParam->scanAgeTimeNCNPS;  
         }
+
         if(pParam->scanAgeTimeNCPS)
         {
             pMac->roam.configParam.scanAgeTimeNCPS = pParam->scanAgeTimeNCPS;   
         }
+
         if(pParam->scanAgeTimeCNPS)
         {
             pMac->roam.configParam.scanAgeTimeCNPS = pParam->scanAgeTimeCNPS;   
@@ -1205,13 +1199,16 @@
         pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority;
         pMac->roam.configParam.fEnforceCountryCodeMatch = pParam->fEnforceCountryCodeMatch;
         pMac->roam.configParam.fEnforceDefaultDomain = pParam->fEnforceDefaultDomain;
+
         pMac->roam.configParam.vccRssiThreshold = pParam->vccRssiThreshold;
         pMac->roam.configParam.vccUlMacLossThreshold = pParam->vccUlMacLossThreshold;
+
         pMac->roam.configParam.IsIdleScanEnabled = pParam->IsIdleScanEnabled;
         pMac->roam.configParam.statsReqPeriodicity = pParam->statsReqPeriodicity;
         pMac->roam.configParam.statsReqPeriodicityInPS = pParam->statsReqPeriodicityInPS;
         //Assign this before calling CsrInit11dInfo
         pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap;
+
         if( csrIs11dSupported( pMac ) )
         {
             status = CsrInit11dInfo(pMac, &pParam->Csr11dinfo);
@@ -1233,19 +1230,18 @@
         palCopyMemory( pMac->hHdd, &pMac->roam.configParam.csr11rConfig, &pParam->csr11rConfig, sizeof(tCsr11rConfigParams) );
         smsLog( pMac, LOG1, "IsFTResourceReqSupp = %d\n", pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported); 
 #endif
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
         pMac->roam.configParam.isFastTransitionEnabled = pParam->isFastTransitionEnabled;
-        pMac->roam.configParam.RoamRssiDiff = pParam->RoamRssiDiff;
-#endif
-#ifdef FEATURE_WLAN_LFR 
-        pMac->roam.configParam.isFastRoamIniFeatureEnabled = pParam->isFastRoamIniFeatureEnabled;
 #endif
 
 #ifdef FEATURE_WLAN_CCX 
         pMac->roam.configParam.isCcxIniFeatureEnabled = pParam->isCcxIniFeatureEnabled;
 #endif
+
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
         palCopyMemory( pMac->hHdd, &pMac->roam.configParam.neighborRoamConfig, &pParam->neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) );
+
         smsLog( pMac, LOG1, "nNeighborScanTimerPerioid = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod);
         smsLog( pMac, LOG1, "nNeighborReassocRssiThreshold = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold);  
         smsLog( pMac, LOG1, "nNeighborLookupRssiThreshold = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold);  
@@ -1253,9 +1249,11 @@
         smsLog( pMac, LOG1, "nNeighborScanMaxChanTime = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime);
         smsLog( pMac, LOG1, "nMaxNeighborRetries = %d\n", pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries); 
         smsLog( pMac, LOG1, "nNeighborResultsRefreshPeriod = %d\n", pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod); 
+
         {
            int i;
            smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d\n"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); 
+
            for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++)
            {
               smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] );
@@ -1263,32 +1261,31 @@
            smsLog( pMac, LOG1, "\n");
         }
 #endif
+
         pMac->roam.configParam.addTSWhenACMIsOff = pParam->addTSWhenACMIsOff;
         pMac->scan.fValidateList = pParam->fValidateList;
         pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d;
         pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan;
         pMac->roam.configParam.fScanTwice = pParam->fScanTwice;
-        pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl;
         /* This parameter is not available in cfg and not passed from upper layers. Instead it is initialized here
          * This paramtere is used in concurrency to determine if there are concurrent active sessions.
          * Is used as a temporary fix to disconnect all active sessions when BMPS enabled so the active session if Infra STA
          * will automatically connect back and resume BMPS since resume BMPS is not working when moving from concurrent to
          * single session
          */
-        pMac->roam.configParam.doBMPSWorkaround = 0;
-
-#ifdef WLAN_FEATURE_11AC
-        pMac->roam.configParam.nVhtChannelWidth = pParam->nVhtChannelWidth;
+#ifndef BMPS_WORKAROUND_NOT_NEEDED
+       pMac->roam.configParam.doBMPSWorkaround = 0;
 #endif
-        pMac->scan.fIgnore_chan165 = pParam->fIgnore_chan165;
     }
     
     return status;
 }
 
+
 eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam)
 {
     eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
+
     if(pParam)
     {
         pParam->WMMSupportMode = pMac->roam.configParam.WMMSupportMode;
@@ -1297,8 +1294,8 @@
         pParam->Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabled;
         pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal;
         pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled;
-        pParam->channelBondingMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode24GHz);
-        pParam->channelBondingMode5GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode5GHz);
+        pParam->channelBondingMode24GHz = pMac->roam.configParam.channelBondingMode24GHz;
+        pParam->channelBondingMode5GHz = pMac->roam.configParam.channelBondingMode5GHz;
         pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold;
         pParam->phyMode = pMac->roam.configParam.phyMode;
         pParam->shortSlotTime = pMac->roam.configParam.shortSlotTime;
@@ -1311,10 +1308,12 @@
         pParam->bandCapability = pMac->roam.configParam.bandCapability;
         pParam->cbChoice = pMac->roam.configParam.cbChoice;
         pParam->bgScanInterval = pMac->roam.configParam.bgScanInterval;
+
         pParam->nActiveMaxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
         pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime;
         pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime;
         pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime;
+
         //Change the unit from microsecond to second
         pParam->impsSleepTime = pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_SEC_UNIT;
         pParam->eBand = pMac->roam.configParam.eBand;
@@ -1331,38 +1330,38 @@
         pParam->fEnforceDefaultDomain = pMac->roam.configParam.fEnforceDefaultDomain;        
         pParam->vccRssiThreshold = pMac->roam.configParam.vccRssiThreshold;
         pParam->vccUlMacLossThreshold = pMac->roam.configParam.vccUlMacLossThreshold;
+
         pParam->IsIdleScanEnabled = pMac->roam.configParam.IsIdleScanEnabled;
         pParam->nTxPowerCap = pMac->roam.configParam.nTxPowerCap;
         pParam->statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity;
         pParam->statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS;
+
         pParam->addTSWhenACMIsOff = pMac->roam.configParam.addTSWhenACMIsOff;
         pParam->fValidateList = pMac->roam.configParam.fValidateList;
         pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d;
         pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan;
-        pParam->fIgnore_chan165= pMac->scan.fIgnore_chan165;
         pParam->fScanTwice = pMac->roam.configParam.fScanTwice;
-        pParam->fFirstScanOnly2GChnl = pMac->scan.fFirstScanOnly2GChnl;
 
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
         palCopyMemory( pMac->hHdd, &pParam->neighborRoamConfig, &pMac->roam.configParam.neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams) );
 #endif
-#ifdef WLAN_FEATURE_11AC
-        pParam->nVhtChannelWidth = pMac->roam.configParam.nVhtChannelWidth;
-#endif
 
         csrSetChannels(pMac, pParam);
 
         status = eHAL_STATUS_SUCCESS;
     }
+
     return (status);
 }
 
+
 eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded)
 {
     eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     tANI_BOOLEAN fRestartNeeded = eANI_BOOLEAN_FALSE;
     eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO;
+
     do
     {
         if(eCSR_BAND_24 == eBand)
@@ -1462,8 +1461,10 @@
                 newPhyMode = eCSR_DOT11_MODE_AUTO;
             }
         }
+
         //Done validating
         status = eHAL_STATUS_SUCCESS;
+
         //Now we need to check whether a restart is needed.
         if(eBand != pMac->roam.configParam.eBand)
         {
@@ -1475,7 +1476,9 @@
             fRestartNeeded = eANI_BOOLEAN_TRUE;
             break;
         }
+
     }while(0);
+
     if(HAL_STATUS_SUCCESS(status))
     {
         pMac->roam.configParam.eBand = eBand;
@@ -1485,13 +1488,16 @@
             *pfRestartNeeded = fRestartNeeded;
         }
     }
+
     return (status);
 }
     
+
 void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList )
 {
     tANI_U8 Index;
     tANI_U8 cChannels;
+
     // for dual band NICs, don't need to trim the channel list....
     if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) )
     {
@@ -1508,6 +1514,7 @@
                     cChannels++;
                 }
             }
+
             // Cleanup the rest of channels.   Note we only need to clean up the channels if we had
             // to trim the list.  Calling palZeroMemory() with a 0 size is going to throw asserts on 
             // the debug builds so let's be a bit smarter about that.  Zero out the reset of the channels
@@ -1535,6 +1542,7 @@
                     cChannels++;
                 }
             }
+
             // Cleanup the rest of channels.   Note we only need to clean up the channels if we had
             // to trim the list.  Calling palZeroMemory() with a 0 size is going to throw asserts on 
             // the debug builds so let's be a bit smarter about that.  Zero out the reset of the channels
@@ -1551,7 +1559,9 @@
             pChannelList->numChannels = cChannels;
         }
     }
+
 }
+
 #ifdef WLAN_SOFTAP_FEATURE
 #define INFRA_AP_DEFAULT_CHANNEL 6
 eHalStatus csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum)
@@ -1568,6 +1578,7 @@
     return status;
 }
 #endif
+
 eHalStatus csrInitGetChannels(tpAniSirGlobal pMac)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -1575,7 +1586,7 @@
     VOS_STATUS vosStatus;
     tANI_U8 Index = 0;
     tANI_U8 num40MHzChannelsFound = 0;
-    
+
     
     //TODO: this interface changed to include the 40MHz channel list
     // this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation
@@ -1617,13 +1628,16 @@
         }
         pMac->scan.base40MHzChannels.numChannels = num40MHzChannelsFound;
     }
+
     return (status);  
 }
 
+
 eHalStatus csrInitChannelList( tHalHandle hHal )
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     eHalStatus status = eHAL_STATUS_SUCCESS;
+
     csrPruneChannelListForMode(pMac, &pMac->scan.baseChannels);
     csrPruneChannelListForMode(pMac, &pMac->scan.base20MHzChannels);
     // Apply the base channel list, power info, and set the Country code...
@@ -1631,16 +1645,20 @@
  
     return (status);
 }
+
+
 eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, 
                                  tCsrUpdateConfigParam *pUpdateConfigParam)
 {
    eHalStatus status = eHAL_STATUS_FAILURE;
    tCsr11dinfo *ps11dinfo = NULL;
+
    ps11dinfo = &pUpdateConfigParam->Csr11dinfo;
    status = CsrInit11dInfo(pMac, ps11dinfo);
    return status;
 }
 
+
 static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo)
 {
   eHalStatus status = eHAL_STATUS_FAILURE;
@@ -1654,6 +1672,7 @@
   {
      return (status);
   }
+
   if ( ps11dinfo->Channels.numChannels && ( WNI_CFG_VALID_CHANNEL_LIST_LEN >= ps11dinfo->Channels.numChannels ) ) 
   {
     pMac->scan.base20MHzChannels.numChannels = ps11dinfo->Channels.numChannels;
@@ -1666,10 +1685,12 @@
      //No change
      return (eHAL_STATUS_SUCCESS);
   }
+
   //legacy maintenance
   status = palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, 
                          ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN);
   if(!HAL_STATUS_SUCCESS(status)) return (status);
+
   //Tush: at csropen get this initialized with default, during csr reset if this 
   // already set with some value no need initilaize with default again
   if(0 == pMac->scan.countryCodeCurrent[0])
@@ -1678,11 +1699,13 @@
                          ps11dinfo->countryCode, WNI_CFG_COUNTRY_CODE_LEN);
      if(!HAL_STATUS_SUCCESS(status)) return (status);
   }
+
   // need to add the max power channel list
   if(HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN)))
   {
       palZeroMemory(pMac->hHdd, pChanInfo, sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN);
       pChanInfoStart = pChanInfo;
+
       for(index = 0; index < ps11dinfo->Channels.numChannels; index++)
       {
         pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel;
@@ -1697,6 +1720,7 @@
       }
       palFreeMemory(pMac->hHdd, pChanInfoStart);
   }
+
   //Only apply them to CFG when not in STOP state. Otherwise they will be applied later
   if( HAL_STATUS_SUCCESS(status) )
   {
@@ -1715,8 +1739,10 @@
     }
 
   }
+
   return (status);
 }
+
 /* Initialize the Channel + Power List in the local cache and in the CFG */
 eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo)
 {
@@ -1773,6 +1799,7 @@
     {
         pNextEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
         pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+
         // Remove the previous command if..
         // - the new roam command is for the same RoamReason...
         // - the new roam command is a NewProfileList.
@@ -1814,6 +1841,7 @@
     }
     csrLLClose(&localList);
 }
+
 eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, 
                                tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2)
 {
@@ -1822,6 +1850,7 @@
     WLAN_VOS_DIAG_EVENT_DEF(connectionStatus, vos_event_wlan_status_payload_type);
 #endif
     tCsrRoamSession *pSession;
+
     if( CSR_IS_SESSION_VALID( pMac, sessionId) )
     {
         pSession = CSR_GET_SESSION( pMac, sessionId );
@@ -1832,23 +1861,11 @@
        VOS_ASSERT(0);
        return eHAL_STATUS_FAILURE;
     }
+
     if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && pRoamInfo)
     {
         smsLog(pMac, LOGW, " Assoc complete result = %d statusCode = %d reasonCode = %d\n", u2, pRoamInfo->statusCode, pRoamInfo->reasonCode);
     }
-    if ((u1 == eCSR_ROAM_FT_REASSOC_FAILED) && (pSession->bRefAssocStartCnt)) {
-        /*
-         * Decrement bRefAssocStartCnt for FT reassoc failure.
-         * Reason: For FT reassoc failures, we first call 
-         * csrRoamCallCallback before notifying a failed roam 
-         * completion through csrRoamComplete. The latter in 
-         * turn calls csrRoamProcessResults which tries to 
-         * once again call csrRoamCallCallback if bRefAssocStartCnt
-         * is non-zero. Since this is redundant for FT reassoc 
-         * failure, decrement bRefAssocStartCnt.
-         */
-        pSession->bRefAssocStartCnt--;
-    }
 
     if ( (pSession == NULL) ||
         (eANI_BOOLEAN_FALSE == pSession->sessionActive) )
@@ -1887,6 +1904,7 @@
           connectionStatus.rssi = pRoamInfo->pBssDesc->rssi * (-1);
           connectionStatus.channel = pRoamInfo->pBssDesc->channelId;
        }
+
        connectionStatus.qosCapability = pRoamInfo->u.pConnectedProfile->qosConnection;
        connectionStatus.authType = (v_U8_t)diagAuthTypeFromCSRType(pRoamInfo->u.pConnectedProfile->AuthType);
        connectionStatus.encryptionType = (v_U8_t)diagEncTypeFromCSRType(pRoamInfo->u.pConnectedProfile->EncryptionType);
@@ -1894,34 +1912,40 @@
        connectionStatus.reason = eCSR_REASON_UNSPECIFIED;
        WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
     }
+
     if((eCSR_ROAM_MIC_ERROR_IND == u1) || (eCSR_ROAM_RESULT_MIC_FAILURE == u2))
     {
        connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
        connectionStatus.reason = eCSR_REASON_MIC_ERROR;
        WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
     }
+
     if(eCSR_ROAM_RESULT_FORCED == u2)
     {
        connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
        connectionStatus.reason = eCSR_REASON_USER_REQUESTED;
        WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
     }
+
     if(eCSR_ROAM_RESULT_DISASSOC_IND == u2)
     {
        connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
        connectionStatus.reason = eCSR_REASON_DISASSOC;
        WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
     }
+
     if(eCSR_ROAM_RESULT_DEAUTH_IND == u2)
     {
        connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT;
        connectionStatus.reason = eCSR_REASON_DEAUTH;
        WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS);
     }
+
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
     
     return (status);
 }
+
 // Returns whether handoff is currently in progress or not
 tANI_BOOLEAN csrRoamIsHandoffInProgress(tpAniSirGlobal pMac)
 {
@@ -1930,7 +1954,9 @@
 #else
     return eANI_BOOLEAN_FALSE;
 #endif
+
 }
+
 eHalStatus csrRoamIssueDisassociate( tpAniSirGlobal pMac, tANI_U32 sessionId,
                                      eCsrRoamSubState NewSubstate, tANI_BOOLEAN fMICFailure )
 {   
@@ -1938,12 +1964,6 @@
     tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
     tANI_U16 reasonCode;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
     
     //Restore AC weight in case we change it 
     if ( csrIsConnStateConnectedInfra( pMac, sessionId ) )
@@ -1964,23 +1984,26 @@
     {
         reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
     }    
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
     if ( (csrRoamIsHandoffInProgress(pMac)) && 
          (NewSubstate != eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF))
     {
         tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
         palCopyMemory(pMac->hHdd, &bssId, pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, sizeof(tSirMacAddr));
+
     } else 
 #endif
     if(pSession->pConnectBssDesc)
     {
         palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid));
     }
-    
+
     
     smsLog( pMac, LOGE, "CSR Attempting to Disassociate Bssid= %02x-%02x-%02x-%02x-%02x-%02x subState = %d\n", 
                   bssId[ 0 ], bssId[ 1 ], bssId[ 2 ],
                   bssId[ 3 ], bssId[ 4 ], bssId[ 5 ], NewSubstate );    
+
     csrRoamSubstateChange( pMac, NewSubstate, sessionId);
 
     status = csrSendMBDisassocReqMsg( pMac, sessionId, bssId, reasonCode );    
@@ -1988,6 +2011,7 @@
     if(HAL_STATUS_SUCCESS(status)) 
     {
         csrRoamLinkDown(pMac, sessionId);
+
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
         //no need to tell QoS that we are disassociating, it will be taken care off in assoc req for HO
         if(eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF != NewSubstate)
@@ -1997,10 +2021,14 @@
         }
 #endif
      }
+
     return (status);
 }
+
 #ifdef WLAN_SOFTAP_FEATURE
 
+
+
 /* ---------------------------------------------------------------------------
     \fn csrRoamIssueDisassociateStaCmd
     \brief csr function that HDD calls to disassociate a associated station
@@ -2043,6 +2071,7 @@
 }
 
 
+
 /* ---------------------------------------------------------------------------
     \fn csrRoamIssueDeauthSta
     \brief csr function that HDD calls to delete a associated station
@@ -2083,6 +2112,9 @@
 
     return status;
 }
+
+
+
 eHalStatus
 csrRoamIssueTkipCounterMeasures( tpAniSirGlobal pMac, tANI_U32 sessionId,
                                     tANI_BOOLEAN bEnable )
@@ -2090,11 +2122,13 @@
     eHalStatus status = eHAL_STATUS_FAILURE;
     tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
     if (!pSession)
     {
         smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:CSR Session not found\n");
         return (status);
     }
+
     if (pSession->pConnectBssDesc)
     {
         palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid));
@@ -2104,12 +2138,15 @@
         smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:Connected BSS Description in CSR Session not found\n");
         return (status);
     }
+
     smsLog( pMac, LOG2, "CSR issuing tkip counter measures for Bssid = %02x-%02x-%02x-%02x-%02x-%02x, Enable = %d\n", 
                   bssId[ 0 ], bssId[ 1 ], bssId[ 2 ],
                   bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] , bEnable);
+
     status = csrSendMBTkipCounterMeasuresReqMsg( pMac, sessionId, bEnable, bssId );
     return (status);
 }
+
 eHalStatus
 csrRoamGetAssociatedStas( tpAniSirGlobal pMac, tANI_U32 sessionId,
                             VOS_MODULE_ID modId,  void *pUsrContext,
@@ -2118,11 +2155,13 @@
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
     if (!pSession)
     {
         smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:CSR Session not found\n");
         return (status);
     }
+
     if(pSession->pConnectBssDesc)
     {
         palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) );
@@ -2132,12 +2171,15 @@
         smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:Connected BSS Description in CSR Session not found\n");
         return (status);
     }
+
     smsLog( pMac, LOG2, "CSR getting associated stations for Bssid = %02x-%02x-%02x-%02x-%02x-%02x\n",
                   bssId[ 0 ], bssId[ 1 ], bssId[ 2 ],
                   bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] );
+
     status = csrSendMBGetAssociatedStasReqMsg( pMac, sessionId, modId, bssId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
     return (status);
 }
+
 eHalStatus
 csrRoamGetWpsSessionOverlap( tpAniSirGlobal pMac, tANI_U32 sessionId,
                              void *pUsrContext, void *pfnSapEventCallback, v_MACADDR_t pRemoveMac )
@@ -2151,6 +2193,7 @@
         smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:CSR Session not found\n");
         return (status);
     }
+
     if(pSession->pConnectBssDesc)
     {
         palCopyMemory( pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid) );
@@ -2160,6 +2203,7 @@
         smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:Connected BSS Description in CSR Session not found\n");
         return (status);
     }
+
     smsLog( pMac, LOG2, "CSR getting WPS Session Overlap for Bssid = %02x-%02x-%02x-%02x-%02x-%02x\n",
                   bssId[ 0 ], bssId[ 1 ], bssId[ 2 ],
                   bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] );
@@ -2168,26 +2212,24 @@
             
     return (status);
 }
+
 #endif
+
 eHalStatus csrRoamIssueDeauth( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate )
 {   
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if (!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
     
     if(pSession->pConnectBssDesc)
     {
         palCopyMemory(pMac->hHdd, &bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid));
     }
+
     smsLog( pMac, LOG2, "CSR Attempting to Deauth Bssid= %02x-%02x-%02x-%02x-%02x-%02x\n", 
                   bssId[ 0 ], bssId[ 1 ], bssId[ 2 ],
                   bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] );    
+
     csrRoamSubstateChange( pMac, NewSubstate, sessionId);
     
     status = csrSendMBDeauthReqMsg( pMac, sessionId, bssId, eSIR_MAC_DISASSOC_LEAVING_BSS_REASON );    
@@ -2195,17 +2237,13 @@
     return (status);
 }
 
+
+
 eHalStatus csrRoamSaveConnectedBssDesc( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDesc )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     tANI_U32 size;
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
     
     // If no BSS description was found in this connection (happens with start IBSS), then 
     // nix the BSS description that we keep around for the connected BSS) and get out...
@@ -2237,16 +2275,18 @@
     return (status);
 }
 
+
 eHalStatus csrRoamPrepareBssConfig(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, 
                                     tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig,
                                     tDot11fBeaconIEs *pIes)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     eCsrCfgDot11Mode cfgDot11Mode;
+
 #if defined(VOSS_ENABLED)
     VOS_ASSERT( pIes != NULL );
 #endif
-
+    
     do
     {
         palCopyMemory(pMac->hHdd, &pBssConfig->BssCap, &pBssDesc->capabilityInfo, sizeof(tSirMacCapabilityInfo));
@@ -2297,6 +2337,7 @@
                 pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
             }
         }
+
         //Qos
         if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) &&
                 (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos))
@@ -2316,9 +2357,11 @@
             case eCSR_AUTH_TYPE_OPEN_SYSTEM:
                 pBssConfig->authType = eSIR_OPEN_SYSTEM;
                 break;
+
             case eCSR_AUTH_TYPE_SHARED_KEY:
                 pBssConfig->authType = eSIR_SHARED_KEY;
                 break;
+
             case eCSR_AUTH_TYPE_AUTOSWITCH:
                 pBssConfig->authType = eSIR_AUTO_SWITCH;
                 break;
@@ -2367,9 +2410,11 @@
         //validate CB
         pBssConfig->cbMode = csrGetCBModeFromIes(pMac, pBssDesc->channelId, pIes);
     }while(0);
+
     return (status);
 }
 
+
 static eHalStatus csrRoamPrepareBssConfigFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, 
                                                      tBssConfigParam *pBssConfig, tSirBssDescription *pBssDesc)
 {
@@ -2388,6 +2433,7 @@
         //SSID must present
         return eHAL_STATUS_FAILURE;
     }
+
     //Settomg up the capabilities
     if( csrIsBssTypeIBSS(pProfile->BSSType) )
     {
@@ -2401,21 +2447,25 @@
     {
         pBssConfig->BssCap.privacy = 1;
     }
+
     pBssConfig->eBand = pMac->roam.configParam.eBand;
     //phymode
     if(pProfile->ChannelInfo.ChannelList)
     {
        operationChannel = pProfile->ChannelInfo.ChannelList[0];
     }
+
 #ifdef WLAN_SOFTAP_FEATURE
     pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, operationChannel, 
                                         &pBssConfig->eBand);
 #else
+
     pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, (eCsrPhyMode)pProfile->phyMode, operationChannel, 
                                         &pBssConfig->eBand);
 #endif
     //QOS
     //Is this correct to always set to this //***
+
     if ( pBssConfig->BssCap.ess == 1 ) 
     {
 #ifdef WLAN_SOFTAP_FEATURE
@@ -2433,6 +2483,7 @@
     } else {
              qAPisEnabled = TRUE;
     }
+
     if (( eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode && qAPisEnabled) ||
           (( eCSR_CFG_DOT11_MODE_11N == pBssConfig->uCfgDot11Mode && qAPisEnabled) ||
              ( eCSR_CFG_DOT11_MODE_TAURUS == pBssConfig->uCfgDot11Mode ) ) //For 11n, need QoS
@@ -2453,9 +2504,11 @@
         case eCSR_AUTH_TYPE_OPEN_SYSTEM:
             pBssConfig->authType = eSIR_OPEN_SYSTEM;
             break;
+
         case eCSR_AUTH_TYPE_SHARED_KEY:
             pBssConfig->authType = eSIR_SHARED_KEY;
             break;
+
         case eCSR_AUTH_TYPE_AUTOSWITCH:
             pBssConfig->authType = eSIR_AUTO_SWITCH;
             break;
@@ -2483,9 +2536,10 @@
     }
     //Join timeout
     pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT;
-
+    
     return (status);
 }
+
 static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc)
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
@@ -2498,6 +2552,7 @@
          //err msg
          VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
                    "csrRoamGetQosInfoFromBss() failed\n");
+
          break;
       }
       //check if the AP is QAP & it supports APSD
@@ -2506,11 +2561,14 @@
          return eHAL_STATUS_SUCCESS;
       }
    } while (0);
+
    return status;
 }
 
+
 void csrSetCfgPrivacy( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy )
 {
+
     // !! Note:  the only difference between this function and the csrSetCfgPrivacyFromProfile() is the 
     // setting of the privacy CFG based on the advertised privacy setting from the AP for WPA associations. 
     // See !!Note: below in this function...
@@ -2555,6 +2613,7 @@
                         
             // Set the Wep default key ID.
             WepDefaultKeyId = pProfile->Keys.defaultIndex;
+
             // Wep key size if 5 bytes (40 bits).
             WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5;            
             
@@ -2598,6 +2657,7 @@
             {
                 Key3Length = 0;
             }      
+
             break;
         
         case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
@@ -2678,6 +2738,7 @@
             Key3Length = 0;        
           
             break;     
+
         default:
             PrivacyEnabled = 0;
             RsnEnabled = 0;
@@ -2694,6 +2755,7 @@
     ccmCfgSetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId, NULL, eANI_BOOLEAN_FALSE);
 }
 
+
 static void csrSetCfgSsid( tpAniSirGlobal pMac, tSirMacSSid *pSSID )
 {
     tANI_U32 len = 0;
@@ -2704,46 +2766,58 @@
     ccmCfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *)pSSID->ssId, len, NULL, eANI_BOOLEAN_FALSE);
 }
 
+
 eHalStatus csrSetQosToCfg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrMediaAccessType qosType )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tANI_U32 QoSEnabled;
     tANI_U32 WmeEnabled;
+
     // set the CFG enable/disable variables based on the qosType being configured...
     switch( qosType )
     {
+
         case eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p:
             QoSEnabled = FALSE;
             WmeEnabled = TRUE;
             break;
+
         case eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP:
             QoSEnabled = FALSE;
             WmeEnabled = TRUE;
             break;
+
         case eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify:
             QoSEnabled = FALSE;
             WmeEnabled = TRUE;
             break;
+
         case eCSR_MEDIUM_ACCESS_11e_eDCF:
             QoSEnabled = TRUE;
             WmeEnabled = FALSE;
             break;
+
         case eCSR_MEDIUM_ACCESS_11e_HCF:
             QoSEnabled = TRUE;
             WmeEnabled = FALSE;
             break;
+
         default:
         case eCSR_MEDIUM_ACCESS_DCF:
             QoSEnabled = FALSE;
             WmeEnabled = FALSE;
             break;
+
     }
     //save the WMM setting for later use
     pMac->roam.roamSession[sessionId].fWMMConnection = (tANI_BOOLEAN)WmeEnabled;
+
     status = ccmCfgSetInt(pMac, WNI_CFG_QOS_ENABLED, QoSEnabled, NULL, eANI_BOOLEAN_FALSE);
     status = ccmCfgSetInt(pMac, WNI_CFG_WME_ENABLED, WmeEnabled, NULL, eANI_BOOLEAN_FALSE);
+
     return (status);
 }
+
 static eHalStatus csrGetRateSet( tpAniSirGlobal pMac,  tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tSirBssDescription *pBssDesc,
                            tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet)
 {
@@ -2751,8 +2825,10 @@
     int i;
     eCsrCfgDot11Mode cfgDot11Mode;
     tANI_U8 *pDstRate;
+
     palZeroMemory(pMac->hHdd, pOpRateSet, sizeof(tSirMacRateSet));
     palZeroMemory(pMac->hHdd, pExRateSet, sizeof(tSirMacRateSet));
+
 #if defined(VOSS_ENABLED)
     VOS_ASSERT( pIes != NULL );
 #endif
@@ -2760,12 +2836,14 @@
     if( NULL != pIes )
     {
         csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes );
+
         // Originally, we thought that for 11a networks, the 11a rates are always
         // in the Operational Rate set & for 11b and 11g networks, the 11b rates
         // appear in the Operational Rate set.  Consequently, in either case, we
         // would blindly put the rates we support into our Operational Rate set
         // (including the basic rates, which we have already verified are
         // supported earlier in the roaming decision).
+
         // However, it turns out that this is not always the case.  Some AP's
         // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set,
         // too.  Now, we're a little more careful:
@@ -2781,6 +2859,7 @@
                 }
             }
         }
+
         if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || 
              eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode ||
              eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode ||
@@ -2826,18 +2905,22 @@
     tANI_U32 PropRatesEnable = 0;
     tANI_U8 MCSRateIdxSet[ SIZE_OF_SUPPORTED_MCS_SET ];
     tANI_U32 MCSRateLength = 0;
+
 #if defined(VOSS_ENABLED)
     VOS_ASSERT( pIes != NULL );
 #endif
+
     if( NULL != pIes )
     {
         csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes );
+
         // Originally, we thought that for 11a networks, the 11a rates are always
         // in the Operational Rate set & for 11b and 11g networks, the 11b rates
         // appear in the Operational Rate set.  Consequently, in either case, we
         // would blindly put the rates we support into our Operational Rate set
         // (including the basic rates, which we have already verified are
         // supported earlier in the roaming decision).
+
         // However, it turns out that this is not always the case.  Some AP's
         // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set,
         // too.  Now, we're a little more careful:
@@ -2854,6 +2937,7 @@
                 }
             }
         }
+
         if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || 
              eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode ||
              eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode ||
@@ -2876,6 +2960,7 @@
                 }
             }
         }
+
         // Enable proprietary MAC features if peer node is Airgo node and STA
         // user wants to use them
         if( pIes->Airgo.present && pMac->roam.configParam.ProprietaryRatesEnabled )
@@ -2886,6 +2971,7 @@
         {
             PropRatesEnable = 0;
         }
+
         // For ANI network companions, we need to populate the proprietary rate
         // set with any proprietary rates we found in the beacon, only if user
         // allows them...
@@ -2903,6 +2989,7 @@
             // No proprietary modes...
             ProprietaryOperationalRatesLength = 0;
         }
+
         /* Get MCS Rate */
         pDstRate = MCSRateIdxSet;
         if ( pIes->HTCaps.present )
@@ -2916,6 +3003,7 @@
               }
            }
         }
+
         // Set the operational rate set CFG variables...
         ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, 
                         OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE);
@@ -2934,6 +3022,7 @@
     }
 }
 
+
 static void csrSetCfgRateSetFromProfile( tpAniSirGlobal pMac,
                                          tCsrRoamProfile *pProfile  )
 {
@@ -2947,6 +3036,7 @@
                                                    SIR_MAC_RATE_36,
                                                    SIR_MAC_RATE_48,
                                                        SIR_MAC_RATE_54  } } };
+
     tSirMacRateSetIE DefaultSupportedRates11b = {  SIR_MAC_RATESET_EID, 
                                                    { 4, 
                                                      { SIR_MAC_RATE_1, 
@@ -2969,10 +3059,12 @@
     tANI_U32 ProprietaryOperationalRatesLength = 0;
     tANI_U32 PropRatesEnable = 0;
     tANI_U8 operationChannel = 0; 
+
     if(pProfile->ChannelInfo.ChannelList)
     {
        operationChannel = pProfile->ChannelInfo.ChannelList[0];
     }
+
 #ifdef WLAN_SOFTAP_FEATURE
     cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand );
 #else
@@ -2994,6 +3086,7 @@
                          
         // Nothing in the Extended rate set.
         ExtendedOperationalRatesLength = 0;
+
         // populate proprietary rates if user allows them
         if ( pMac->roam.configParam.ProprietaryRatesEnabled ) 
         {
@@ -3055,6 +3148,7 @@
             ProprietaryOperationalRatesLength = 0;         
         }    
     }  
+
     // set this to 1 if prop. rates need to be advertised in to the IBSS beacon and user wants to use them
     if ( ProprietaryOperationalRatesLength && pMac->roam.configParam.ProprietaryRatesEnabled ) 
     {
@@ -3074,11 +3168,12 @@
                     ProprietaryOperationalRates, 
                     ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE);
     ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE);
+
 }
+
 void csrRoamCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
     tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
     tANI_U32 sessionId;
     tSmeCmd *pCommand = NULL;
@@ -3097,6 +3192,7 @@
     }
 }
 
+
 //This function is very dump. It is here because PE still need WNI_CFG_PHY_MODE
 tANI_U32 csrRoamGetPhyModeFromDot11Mode(eCsrCfgDot11Mode dot11Mode, eCsrBand band)
 {
@@ -3109,30 +3205,11 @@
         if(eCSR_BAND_24 == band)
             return (WNI_CFG_PHY_MODE_11G);
     }
+
     return (WNI_CFG_PHY_MODE_11A);
 }
-        
-        
-#ifdef WLAN_FEATURE_11AC
-ePhyChanBondState csrGetHTCBStateFromVHTCBState(ePhyChanBondState aniCBMode)
-{
-    switch ( aniCBMode )
-    {
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
-            return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
-            return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
-        case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
-	    default :
-            return PHY_SINGLE_CHANNEL_CENTERED;
-    }
-}
-#endif
 
+        
 //pIes may be NULL
 eHalStatus csrRoamSetBssConfigCfg(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
                           tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig,
@@ -3170,6 +3247,7 @@
     csrSetCfgPrivacy(pMac, pProfile, (tANI_BOOLEAN)pBssConfig->BssCap.privacy );
     //short slot time
     ccmCfgSetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, pBssConfig->uShortSlotTime, NULL, eANI_BOOLEAN_FALSE);
+
 #ifdef WLAN_SOFTAP_FEATURE
     //11d
     ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED,
@@ -3181,7 +3259,6 @@
     */
     ccmCfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, pBssConfig->uPowerLimit, NULL, eANI_BOOLEAN_FALSE);
     //CB
-
     if(CSR_IS_INFRA_AP(pProfile) || CSR_IS_WDS_AP(pProfile))
     {
         channel = pProfile->operationChannel;
@@ -3201,22 +3278,10 @@
         }
         else
         {
-           cfgCb = pBssConfig->cbMode;
+           //cfgCb = pBssConfig->cbMode;
+           cfgCb = pMac->roam.configParam.channelBondingMode5GHz;
         }
     }
-#ifdef WLAN_FEATURE_11AC
-    if(cfgCb > 2 )
-    {
-	if(!WDA_getFwWlanFeatCaps(DOT11AC)) {
-            cfgCb = csrGetHTCBStateFromVHTCBState(cfgCb);
-	}
-	else 
-	{
-            ccmCfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,  pMac->roam.configParam.nVhtChannelWidth, NULL, eANI_BOOLEAN_FALSE);
-	}
-    }
-    else
-#endif
     ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, cfgCb, NULL, eANI_BOOLEAN_FALSE);
     //Rate
     //Fixed Rate
@@ -3233,22 +3298,19 @@
     csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId );
 
     ccmCfgSetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, pBssConfig->uJoinTimeOut, (tCcmCfgSetCallback)csrRoamCcmCfgSetCallback, eANI_BOOLEAN_FALSE);
+
     return (status);
 }
 
+
+
 eHalStatus csrRoamStopNetwork( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
                                tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes)
 {
     eHalStatus status;
     tBssConfigParam *pBssConfig;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-    
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
+
     status = palAllocateMemory(pMac->hHdd, (void **)&pBssConfig, sizeof(tBssConfigParam)); 
     if(HAL_STATUS_SUCCESS(status))
     {
@@ -3257,8 +3319,6 @@
         if(HAL_STATUS_SUCCESS(status))
         {
             pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode;
-            /* This will allow to pass cbMode during join req */
-            pSession->bssParams.cbMode= pBssConfig->cbMode;
             //For IBSS, we need to prepare some more information
             if( csrIsBssTypeIBSS(pProfile->BSSType) || CSR_IS_WDS( pProfile )
 #ifdef WLAN_SOFTAP_FEATURE
@@ -3266,7 +3326,7 @@
 #endif
             )
             {
-                csrRoamPrepareBssParams(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes);
+                csrRoamPrepareBssParams(pMac, sessionId, pProfile, pBssDesc, pIes);
             }
             // If we are in an IBSS, then stop the IBSS...
             ////Not worry about WDS connection for now
@@ -3321,6 +3381,7 @@
     return (status);
 }
 
+
 eCsrJoinState csrRoamJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, 
                            tCsrScanResultInfo *pScanResult, tCsrRoamProfile *pProfile )
 {
@@ -3330,12 +3391,6 @@
     tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)( pScanResult->pvIes ); //This may be NULL
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return (eCsrStopRoaming);
-    }
-    
     if( CSR_IS_WDS_STA( pProfile ) )
     {
         status = csrRoamStartWds( pMac, sessionId, pProfile, pBssDesc );
@@ -3376,13 +3431,13 @@
                 else
                 {
                     tBssConfigParam bssConfig;
+
                     //The key changes
                     palZeroMemory(pMac->hHdd, &bssConfig, sizeof(bssConfig));
                     status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, &bssConfig, pIesLocal);
                     if(HAL_STATUS_SUCCESS(status))
                     {
                         pSession->bssParams.uCfgDot11Mode = bssConfig.uCfgDot11Mode;
-                        pSession->bssParams.cbMode = bssConfig.cbMode;
                         //Reapply the config including Keys so reassoc is happening.
                         status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, pBssDesc, &bssConfig, pIesLocal);
                         if(!HAL_STATUS_SUCCESS(status))
@@ -3432,19 +3487,23 @@
             palFreeMemory(pMac->hHdd, pIesLocal);
         }
     }
+
     return( eRoamState );
 }
 
+
 eHalStatus csrRoamShouldRoam(tpAniSirGlobal pMac, tANI_U32 sessionId, 
                              tSirBssDescription *pBssDesc, tANI_U32 roamId)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tCsrRoamInfo roamInfo;
+
     palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
     roamInfo.pBssDesc = pBssDesc;
     status = csrRoamCallCallback(pMac, sessionId, &roamInfo, roamId, eCSR_ROAM_SHOULD_ROAM, eCSR_ROAM_RESULT_NONE);
     return (status);
 }
+
 //In case no matching BSS is found, use whatever default we can find
 static void csrRoamAssignDefaultParam( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
@@ -3491,12 +3550,6 @@
     tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile;
     tANI_U8  concurrentChannel = 0;
     
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return (eCsrStopRoaming);
-    }
-    
     do  
     {
         // Check for Cardbus eject condition, before trying to Roam to any BSS
@@ -3536,15 +3589,16 @@
                 while(pCommand->u.roamCmd.pRoamBssEntry)
                 {
                     pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link);
+
                     /*If concurrency enabled take the concurrent connected channel first. */
                     /* Valid multichannel concurrent sessions exempted */
-                    if (vos_concurrent_sessions_running() && 
-                        !csrIsValidMcConcurrentSession(pMac, sessionId, &pScanResult->Result.BssDescriptor))
+                    if (vos_concurrent_sessions_running() && !csrIsValidMcConcurrentSession(pMac, sessionId))
                     {
                         concurrentChannel = 
                             csrGetConcurrentOperationChannel(pMac);
                         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
                                 " csr Concurrent Channel = %d", __FUNCTION__, concurrentChannel);
+
                         if ((concurrentChannel) && 
                                 (concurrentChannel == 
                                  pScanResult->Result.BssDescriptor.channelId))
@@ -3556,6 +3610,7 @@
                                     FL("Concurrent channel match =%d"),
                                     concurrentChannel);
                             concurrentChannel = 0; 
+
                         }
                     }
 
@@ -3605,6 +3660,7 @@
             if(pScanResult)
             {
                 tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes;
+
                 if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pScanResult->Result.BssDescriptor, &pIesLocal))) )
                 {
                     smsLog(pMac, LOGE, FL(" cannot parse IEs\n"));
@@ -3620,10 +3676,12 @@
                     CSR_IS_UAPSD_BSS(pIesLocal) )
                 {
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
+
                     acm_mask = sme_QosGetACMMask(pMac, &pScanResult->Result.BssDescriptor, 
                          pIesLocal);
                     pCommand->u.roamCmd.roamProfile.uapsd_mask &= ~(acm_mask);
 #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
+
                 }
                 else
                 {
@@ -3643,12 +3701,14 @@
             csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
                                  eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE );
         }
+
         if ( NULL == pCommand->u.roamCmd.pRoamBssEntry ) 
         {
             // If this is a start IBSS profile, then we need to start the IBSS.
             if ( CSR_IS_START_IBSS(pProfile) ) 
             {
                 tANI_BOOLEAN fSameIbss = eANI_BOOLEAN_FALSE;
+
                 // Attempt to start this IBSS...
                 csrRoamAssignDefaultParam( pMac, pCommand );
                 status = csrRoamStartIbss( pMac, sessionId, pProfile, &fSameIbss );
@@ -3726,6 +3786,7 @@
         }
         
     } while( 0 );
+
     if( (eCsrStopRoaming == eRoamState) && (CSR_IS_INFRASTRUCTURE( pProfile )) )
     {
         //Need to indicate association_completion if association_start has been done
@@ -3742,12 +3803,14 @@
     return( eRoamState );
 }
 
+
 static eHalStatus csrRoam( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     eCsrJoinState RoamState;
     tANI_U32 sessionId = pCommand->sessionId;
     
+    smsLog(pMac, LOG2, FL("is called\n"));
     //***if( hddIsRadioStateOn( pAdapter ) )
     {
         // Attept to join a Bss...
@@ -3757,6 +3820,7 @@
         if (( eCsrStopRoaming == RoamState ) || ( eCsrStopRoamingDueToConcurrency == RoamState))
         {
             tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE;
+
             // and if connected in Infrastructure mode...
             if ( csrIsConnStateInfra(pMac, sessionId) ) 
             {
@@ -3820,6 +3884,7 @@
     
     return status;
 }
+
 eHalStatus csrProcessFTReassocRoamCommand ( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
     tANI_U32 sessionId;
@@ -3827,15 +3892,10 @@
     tCsrScanResult *pScanResult = NULL;
     tSirBssDescription *pBssDesc = NULL;
     eHalStatus status = eHAL_STATUS_SUCCESS;
+
     sessionId = pCommand->sessionId;
     pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming)
     {
         //the roaming is cancelled. Simply complete the command
@@ -3843,6 +3903,7 @@
         csrRoamComplete(pMac, eCsrNothingToJoin, NULL); 
         return eHAL_STATUS_FAILURE;
     }
+
     if (pCommand->u.roamCmd.pRoamBssEntry)
     {
         pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link);
@@ -3855,23 +3916,19 @@
         csrRoamComplete(pMac, eCsrNothingToJoin, NULL); 
         return eHAL_STATUS_FAILURE;
     }
+
     status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, 
         (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile);
     return status;
 }
 
+
 eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tCsrRoamInfo roamInfo;
     tANI_U32 sessionId = pCommand->sessionId;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
     
     switch ( pCommand->u.roamCmd.roamReason )
     {
@@ -3879,6 +3936,7 @@
         csrFreeRoamProfile(pMac, sessionId);
         status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE );
         break;
+
      case eCsrSmeIssuedDisassocForHandoff:
         //Not to free pMac->roam.pCurRoamProfile (via csrFreeRoamProfile) because it is needed after disconnect
 #if 0 // TODO : Confirm this change
@@ -3888,19 +3946,23 @@
 #endif
 
         break;
+
     case eCsrForcedDisassocMICFailure:
         csrFreeRoamProfile(pMac, sessionId);
         status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, TRUE );
         break;
+
     case eCsrForcedDeauth:
         csrFreeRoamProfile(pMac, sessionId);
         status = csrRoamProcessDisassocDeauth( pMac, pCommand, FALSE, FALSE );
         break;
+
     case eCsrHddIssuedReassocToSameAP:
     case eCsrSmeIssuedReassocToSameAP:
     {
         tDot11fBeaconIEs *pIes = NULL;
 
+
         if( pSession->pConnectBssDesc )
         {
             status = csrGetParsedBssDescriptionIEs(pMac, pSession->pConnectBssDesc, &pIes);
@@ -3913,6 +3975,7 @@
                 roamInfo.reasonCode = eCsrRoamReasonStaCapabilityChanged;
                 csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE);
                 pSession->roamingReason = eCsrReassocRoaming;
+
                 roamInfo.pBssDesc = pSession->pConnectBssDesc;
                 roamInfo.pProfile = &pCommand->u.roamCmd.roamProfile;
                 pSession->bRefAssocStartCnt++;
@@ -3928,16 +3991,17 @@
         }
         break;
     }
+
     case eCsrCapsChange:
         smsLog(pMac, LOGE, FL("received eCsrCapsChange \n"));
         csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId );
         status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE); 
         break;
+
     case eCsrSmeIssuedFTReassoc:
         smsLog(pMac, LOGE, FL("received FT Reassoc Req \n"));
         status = csrProcessFTReassocRoamCommand(pMac, pCommand);
         break;
-
     case eCsrStopBss:
        csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId);
        status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ );
@@ -3956,14 +4020,6 @@
        status = csrSendMBDeauthReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, 
                      pCommand->u.roamCmd.reason);
        break;
-#if 1
-       /*Varun*/
-    case eCsrPerformPreauth:
-        smsLog(pMac, LOGE, FL("Attempting FT PreAuth Req \n"));
-        status = csrRoamIssueFTPreauthReq(pMac, sessionId, 
-                pCommand->u.roamCmd.pLastRoamBss);
-       break;
-#endif
 
     default:
         csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId );
@@ -3986,16 +4042,10 @@
         status = csrRoam( pMac, pCommand );
         break;
     }
+
     return (status);
 }
 
-void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) 
-{
-    pCommand->u.roamCmd.pLastRoamBss = NULL;
-    pCommand->u.roamCmd.pRoamBssEntry = NULL;
-    //Because u.roamCmd is union and share with scanCmd and StatusChange
-    palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd));
-}
 
 void csrReinitRoamCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) 
 {
@@ -4015,20 +4065,25 @@
     palZeroMemory(pMac->hHdd, &pCommand->u.roamCmd, sizeof(tRoamCmd));
 }
 
+
 void csrReinitWmStatusChangeCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand)
 {
     palZeroMemory(pMac->hHdd, &pCommand->u.wmStatusChangeCmd, sizeof(tWmStatusChangeCmd));
 }
+
 void csrRoamComplete( tpAniSirGlobal pMac, eCsrRoamCompleteResult Result, void *Context )
 {
     tListElem *pEntry;
     tSmeCmd *pCommand;
     tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE;
+
     smsLog( pMac, LOG2, "roamQ: Roam Completion ...\n" );
+
     pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
     if ( pEntry )
     {
         pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+
         // If the head of the queue is Active and it is a ROAM command, remove
         // and put this on the Free queue.
         if ( eSmeCommandRoam == pCommand->command )
@@ -4063,38 +4118,35 @@
     {
         smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ...\n" );
     }
+
     if( fReleaseCommand )
     {
         smeProcessPendingQueue( pMac );
     }
 }
 
+
 void csrResetPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId )
 {
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return;
-    }
+
     palZeroMemory( pMac->hHdd, &(pSession->PmkidCandidateInfo[0]), sizeof(tPmkidCandidateInfo) * CSR_MAX_PMKID_ALLOWED );
     pSession->NumPmkidCandidate = 0;
 }
+
 #ifdef FEATURE_WLAN_WAPI
 void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId )
 {
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return;
-    }
     palZeroMemory( pMac->hHdd, &(pSession->BkidCandidateInfo[0]), sizeof(tBkidCandidateInfo) * CSR_MAX_BKID_ALLOWED );
     pSession->NumBkidCandidate = 0;
 }
 #endif /* FEATURE_WLAN_WAPI */
+
 extern tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ];
 
+
+
 static eHalStatus csrRoamSaveSecurityRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrAuthType authType, 
                                          tSirBssDescription *pSirBssDesc,
                                          tDot11fBeaconIEs *pIes)
@@ -4103,12 +4155,6 @@
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     tDot11fBeaconIEs *pIesLocal = pIes;
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     if((eCSR_AUTH_TYPE_WPA == authType) ||
         (eCSR_AUTH_TYPE_WPA_PSK == authType) ||
         (eCSR_AUTH_TYPE_RSN == authType) ||
@@ -4125,6 +4171,7 @@
 #endif /* FEATURE_WLAN_WAPI */
         )
     {
+
         if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
         {
             smsLog(pMac, LOGE, FL(" cannot parse IEs\n"));
@@ -4133,6 +4180,7 @@
         {
             tANI_U32 nIeLen;
             tANI_U8 *pIeBuf;
+
             if((eCSR_AUTH_TYPE_RSN == authType) ||
 #if defined WLAN_FEATURE_VOWIFI_11R
                 (eCSR_AUTH_TYPE_FT_RSN == authType) ||
@@ -4253,6 +4301,7 @@
     }
                       palCopyMemory(pMac->hHdd, pIeBuf, &pIesLocal->WAPI.unicast_cipher_suite_count, 2);
                       pIeBuf += 2;
+
                       if( pIesLocal->WAPI.unicast_cipher_suite_count )
                       {
                          //copy pwise_cipher_suites
@@ -4271,6 +4320,7 @@
                       }
                       pSession->nWapiRspIeLength = nIeLen + 2; 
                    }
+
                 }
           }
 #endif /* FEATURE_WLAN_WAPI */
@@ -4281,14 +4331,18 @@
         }
     }
     }
+
     return (status);
 }
 
+
+
 static void csrCheckAndUpdateACWeight( tpAniSirGlobal pMac, tDot11fBeaconIEs *pIEs )
 {
     v_U8_t bACWeights[WLANTL_MAX_AC];
     v_U8_t paramBk, paramBe, paramVi, paramVo;
     v_BOOL_t fWeightChange = VOS_FALSE;
+
     //Compare two ACs' EDCA parameters, from low to high (BK, BE, VI, VO)
     //The "formula" is, if lower AC's AIFSN+CWMin is bigger than a fixed amount
     //of the higher AC one, make the higher AC has the same weight as the lower AC.
@@ -4342,6 +4396,7 @@
         }
     }
 }
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
 //Returns whether the current association is a 11r assoc or not
 tANI_BOOLEAN csrRoamIs11rAssoc(tpAniSirGlobal pMac)
@@ -4353,6 +4408,7 @@
 #endif
 }
 #endif
+
 #ifdef FEATURE_WLAN_CCX
 //Returns whether the current association is a CCX assoc or not
 tANI_BOOLEAN csrRoamIsCCXAssoc(tpAniSirGlobal pMac)
@@ -4364,14 +4420,6 @@
 #endif
 }
 #endif
-#ifdef FEATURE_WLAN_LFR
-//Returns whether "Legacy Fast Roaming" is currently enabled...or not
-tANI_BOOLEAN csrRoamIsFastRoamEnabled(tpAniSirGlobal pMac)
-{
-    return (pMac->roam.configParam.isFastRoamIniFeatureEnabled &&
-            (!csrIsConcurrentSessionRunning(pMac)));
-}
-#endif
 
 //Return true means the command can be release, else not
 static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand,
@@ -4397,13 +4445,9 @@
     tSirSmeStartBssRsp  *pSmeStartBssRsp = NULL;
 #endif
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eANI_BOOLEAN_FALSE;
-    }
 
     smsLog( pMac, LOG1, FL("Processing ROAM results...\n"));
+
     switch( Result )
     {
         case eCsrJoinSuccess:
@@ -4431,6 +4475,7 @@
                 palFreeMemory(pMac->hHdd, pSession->pWpaRsnRspIE);
                 pSession->pWpaRsnRspIE = NULL;
             }
+
 #ifdef FEATURE_WLAN_WAPI
             if(pSession->pWapiRspIE)
             {
@@ -4456,6 +4501,7 @@
             {
                 pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;
             }
+
             //Use the last connected bssdesc for reassoc-ing to the same AP.
             //NOTE: What to do when reassoc to a different AP???
             if( (eCsrHddIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) ||
@@ -4484,7 +4530,9 @@
             }
             if( pSirBssDesc )
             {
+
                 roamInfo.staId = HAL_STA_INVALID_IDX;
+
                 csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes);
                     //Save WPA/RSN IE
                 csrRoamSaveSecurityRspIE(pMac, sessionId, pProfile->negotiatedAuthType, pSirBssDesc, pIes);
@@ -4497,6 +4545,7 @@
                 // Moving even save profile above so that below mentioned conditon is also met.
                 // JEZ100225: Moved to after saving the profile. Fix needed in main/latest
                 csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId );
+
                 // Make sure the Set Context is issued before link indication to NDIS.  After link indication is 
                 // made to NDIS, frames could start flowing.  If we have not set context with LIM, the frames
                 // will be dropped for the security context may not be set properly. 
@@ -4528,9 +4577,11 @@
                 {
                     //Need to wait for supplicant authtication
                     roamInfo.fAuthRequired = eANI_BOOLEAN_TRUE;
+
                     //Set the subestate to WaitForKey in case authentiation is needed
                     csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId );
 
+
                     if(pProfile->bWPSAssociation)
                     {
                         key_timeout_interval = CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD;
@@ -4553,10 +4604,12 @@
                 
                 assocInfo.pBssDesc = pSirBssDesc; //could be NULL
                 assocInfo.pProfile = pProfile;
+
                 if(Context)
                 {
                     tSirSmeJoinRsp *pJoinRsp = (tSirSmeJoinRsp *)Context;
                     tANI_U32 len;
+
                     csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo );
                     len = pJoinRsp->assocReqLength + pJoinRsp->assocRspLength + pJoinRsp->beaconLength;
 #ifdef WLAN_FEATURE_VOWIFI_11R
@@ -4621,6 +4674,8 @@
                 // copying the frames 
                 sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, ind_qos, &assocInfo);
 #endif
+
+
                 roamInfo.pBssDesc = pSirBssDesc;
                 roamInfo.statusCode = pSession->joinFailStatusCode.statusCode;
                 roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
@@ -4628,6 +4683,7 @@
                 acm_mask = sme_QosGetACMMask(pMac, pSirBssDesc, NULL);
 #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
                 pSession->connectedProfile.acm_mask = acm_mask;
+
 #ifdef FEATURE_WLAN_UAPSD_FW_TRG_FRAMES
                 //start UAPSD if uapsd_mask is not 0 because HDD will configure for trigger frame
                 //It may be better to let QoS do this????
@@ -4638,18 +4694,22 @@
                     pmcStartUapsd( pMac, NULL, NULL );
                 }
 #endif
+
                 roamInfo.u.pConnectedProfile = &pSession->connectedProfile;
                 if( pSession->bRefAssocStartCnt > 0 )
                 {
                     pSession->bRefAssocStartCnt--;
-                    if(!IS_SLM_SESSIONIZATION_SUPPORTED_BY_FW && ( csrIsConcurrentSessionRunning( pMac )))
+#ifndef BMPS_WORKAROUND_NOT_NEEDED
+                    if(  csrIsConcurrentSessionRunning( pMac ) )
                     {
                        pMac->roam.configParam.doBMPSWorkaround = 1;
                     }
+#endif
                     csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED);
                 }
                 
                 csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_NONE, eANI_BOOLEAN_TRUE);
+
                 // reset the PMKID candidate list
                 csrResetPMKIDCandidateList( pMac, sessionId );
                 //Update TL's AC weight base on the current EDCA parameters
@@ -4670,6 +4730,7 @@
             {
                 smsLog(pMac, LOGW, "  Roam command doesn't have a BSS desc\n");
             }
+
             csrScanCancelIdleScan(pMac);
             //Not to signal link up because keys are yet to be set.
             //The linkup function will overwrite the sub-state that we need to keep at this point.
@@ -4677,6 +4738,7 @@
             {
                 csrRoamLinkUp(pMac, pSession->connectedProfile.bssid);
             }
+
             //Check if BMPS is required and start the BMPS retry timer.  Timer period is large
             //enough to let security and DHCP handshake succeed before entry into BMPS
             if (pmcShouldBmpsTimerRun(pMac))
@@ -4688,8 +4750,10 @@
                 }
                 smsLog(pMac, LOG2, FL("BMPS Retry Timer already running or started"));
             }
+
             break;
 
+
         case eCsrStartBssSuccess:
             // on the StartBss Response, LIM is returning the Bss Description that we
             // are beaconing.  Add this Bss Description to our scan results and
@@ -4750,6 +4814,7 @@
                 }
                 //We are doen with the IEs so free it
                 palFreeMemory(pMac->hHdd, pIes);
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
                 {
                     vos_log_ibss_pkt_type *pIbssLog;
@@ -4783,6 +4848,7 @@
 #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
                 //Only set context for non-WDS_STA. We don't even need it for WDS_AP. But since the encryption
                 //is WPA2-PSK so it won't matter.
+
 #ifdef WLAN_SOFTAP_FEATURE
                 if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && !CSR_IS_INFRA_AP( pSession->pCurRoamProfile ))
                 {
@@ -4852,12 +4918,12 @@
 #ifdef WLAN_SOFTAP_FEATURE
                 roamInfo.staId = (tANI_U8)pSmeStartBssRsp->staId;
 #endif
-                if(!IS_SLM_SESSIONIZATION_SUPPORTED_BY_FW &&
-                   ( csrIsConcurrentSessionRunning( pMac )))
+#ifndef BMPS_WORKAROUND_NOT_NEEDED
+                if(  csrIsConcurrentSessionRunning( pMac ) )
                 {
                    pMac->roam.configParam.doBMPSWorkaround = 1;
                 }
-
+#endif
                 csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult );
             }
     
@@ -4881,11 +4947,14 @@
                 csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
                                         eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_STOPPED );
             }
+
             break;
+
         case eCsrStartBssFailure:
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
             {
                 vos_log_ibss_pkt_type *pIbssLog;
+
                 WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
                 if(pIbssLog)
                 {
@@ -4894,6 +4963,7 @@
                 }
             }
 #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
+
             roamStatus = eCSR_ROAM_IBSS_IND;
             roamResult = eCSR_ROAM_RESULT_IBSS_STARTED;
             if( CSR_IS_WDS( pProfile ) )
@@ -4922,6 +4992,7 @@
             csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult );
             csrSetDefaultDot11Mode( pMac );
             break;
+
         case eCsrSilentlyStopRoaming:
             // We are here because we try to start the same IBSS
             //No message to PE
@@ -4939,7 +5010,9 @@
             //HDD may be mistakenly mark to disconnected state.
             csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, 
                                         eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_NONE );
+
             break;
+
         case eCsrSilentlyStopRoamingSaveState:
             //We are here because we try to connect to the same AP
             //No message to PE
@@ -4954,6 +5027,7 @@
             {
                 palCopyMemory(pMac->hHdd, &roamInfo.bssid, &roamInfo.pBssDesc->bssId, sizeof(tCsrBssid));
             }
+
             roamInfo.statusCode = pSession->joinFailStatusCode.statusCode;
             roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
             roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength;
@@ -4970,6 +5044,7 @@
                                         eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED);
             csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_ASSOCIATED, eANI_BOOLEAN_TRUE);
             break;
+
         case eCsrReassocFailure:
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
             sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_REASSOC_FAILURE, NULL);
@@ -4988,14 +5063,13 @@
                                     eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED);
             //Need to issue stop_bss
             break;
+
         case eCsrJoinFailure:
         case eCsrNothingToJoin:
         case eCsrJoinFailureDueToConcurrency:
         default:
         {
             smsLog(pMac, LOGW, FL("receives no association indication\n"));
-            smsLog(pMac, LOG1, FL("Assoc ref count %d\n"), 
-                   pSession->bRefAssocStartCnt);
             if( CSR_IS_INFRASTRUCTURE( &pSession->connectedProfile ) || 
                 CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, sessionId ) )
             {
@@ -5011,7 +5085,6 @@
                 // If this transition is because of an 802.11 OID, then we transition
                 // back to INIT state so we sit waiting for more OIDs to be issued and
                 // we don't start the IDLE timer.
-                case eCsrSmeIssuedFTReassoc:
                 case eCsrSmeIssuedAssocToSimilarAP:
                 case eCsrHddIssued:
                     csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId );
@@ -5019,15 +5092,19 @@
                     roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss;
                     roamInfo.statusCode = pSession->joinFailStatusCode.statusCode;
                     roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode;
+
                     /* Defeaturize this later if needed */
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
                     /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */
                     if (csrRoamIsHandoffInProgress(pMac))
                     {
+                        csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED);
                         /* Should indicate neighbor roam algorithm about the connect failure here */
                         csrNeighborRoamIndicateConnect(pMac, (tANI_U8)sessionId, VOS_STATUS_E_FAILURE);
                     }
+                    else
 #endif
+                    {
                         if(pSession->bRefAssocStartCnt > 0)
                         {
                             pSession->bRefAssocStartCnt--;
@@ -5044,6 +5121,7 @@
                                                 eCSR_ROAM_RESULT_FAILURE);
                             }
                         }
+                    }
                     smsLog(pMac, LOG1, FL("  roam(reason %d) failed\n"), pCommand->u.roamCmd.roamReason);
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
                     sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL);
@@ -5059,6 +5137,7 @@
                     }
 #endif
                     break;
+
                 case eCsrHddIssuedReassocToSameAP:
                 case eCsrSmeIssuedReassocToSameAP:
                     csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId);
@@ -5153,18 +5232,23 @@
                     csrScanHandleFailedLostlink3(pMac, sessionId);
                     break;
             }
+
             break;
         }
     }
+
     return ( fReleaseCommand );
 }
 
+
 eHalStatus csrRoamRegisterCallback(tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
+
     return (status);
 }
 
+
 eHalStatus csrRoamCopyProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pDstProfile, tCsrRoamProfile *pSrcProfile)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -5227,6 +5311,7 @@
             palCopyMemory(pMac->hHdd, pDstProfile->pWAPIReqIE, pSrcProfile->pWAPIReqIE, pSrcProfile->nWAPIReqIELength);
         }
 #endif /* FEATURE_WLAN_WAPI */
+
         if(pSrcProfile->nAddIEScanLength)
         {
             status = palAllocateMemory(pMac->hHdd,
@@ -5239,6 +5324,7 @@
             palCopyMemory(pMac->hHdd, pDstProfile->pAddIEScan, pSrcProfile->pAddIEScan,
                 pSrcProfile->nAddIEScanLength);
         }
+
         if(pSrcProfile->nAddIEAssocLength)
         {
             status = palAllocateMemory(pMac->hHdd,
@@ -5251,6 +5337,7 @@
             palCopyMemory(pMac->hHdd, pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc,
                 pSrcProfile->nAddIEAssocLength);
         }
+
         if(pSrcProfile->ChannelInfo.ChannelList)
         {
             status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels);
@@ -5261,6 +5348,7 @@
             pDstProfile->ChannelInfo.numOfChannels = pSrcProfile->ChannelInfo.numOfChannels;
             palCopyMemory(pMac->hHdd, pDstProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.ChannelList, pSrcProfile->ChannelInfo.numOfChannels);
         }
+
         pDstProfile->AuthType = pSrcProfile->AuthType;
         pDstProfile->EncryptionType = pSrcProfile->EncryptionType;
         pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType;
@@ -5284,6 +5372,7 @@
         /*Save the WPS info*/
         pDstProfile->bWPSAssociation = pSrcProfile->bWPSAssociation;
         pDstProfile->uapsd_mask = pSrcProfile->uapsd_mask;
+
         pDstProfile->beaconInterval = pSrcProfile->beaconInterval;
 #ifdef WLAN_SOFTAP_FEATURE
         pDstProfile->privacy           = pSrcProfile->privacy;
@@ -5298,7 +5387,9 @@
         pDstProfile->wps_state         = pSrcProfile->wps_state;
         pDstProfile->ieee80211d        = pSrcProfile->ieee80211d;
 #endif
+
         palCopyMemory(pMac->hHdd, &pDstProfile->Keys, &pSrcProfile->Keys, sizeof(pDstProfile->Keys));
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
         if (pSrcProfile->MDID.mdiePresent)
         {
@@ -5306,6 +5397,7 @@
             pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain;
         }
 #endif
+
     }while(0);
     
     if(!HAL_STATUS_SUCCESS(status))
@@ -5316,6 +5408,7 @@
     
     return (status);
 }
+
 eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -5345,6 +5438,7 @@
             pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->ssidHidden;
             palCopyMemory(pMac->hHdd, &pDstProfile->SSIDs.SSIDList[0].SSID, &pSrcProfile->SSID, sizeof(tSirMacSSid));
         }
+
         status = palAllocateMemory(pMac->hHdd, (void **)&pDstProfile->ChannelInfo.ChannelList, 1);
         if(!HAL_STATUS_SUCCESS(status))
         {
@@ -5352,6 +5446,7 @@
         }
         pDstProfile->ChannelInfo.numOfChannels = 1;
         pDstProfile->ChannelInfo.ChannelList[0] = pSrcProfile->operationChannel;
+
         pDstProfile->AuthType.numEntries = 1;
         pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType;
         pDstProfile->negotiatedAuthType = pSrcProfile->AuthType;
@@ -5383,6 +5478,7 @@
     return (status);
 }
 
+
 eHalStatus csrRoamIssueConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
                                 tScanResultHandle hBSSList, 
                                 eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate,
@@ -5433,9 +5529,11 @@
         //We need to free the BssList when the command is done
         pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_TRUE;
         pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE;
+
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
                   FL("CSR PERSONA=%d"),
                   pCommand->u.roamCmd.roamProfile.csrPersona);
+
         status = csrQueueSmeCommand(pMac, pCommand, fImediate);
         if( !HAL_STATUS_SUCCESS( status ) )
         {
@@ -5446,6 +5544,7 @@
     
     return (status);
 }
+
 eHalStatus csrRoamIssueReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
                                tCsrRoamModifyProfileFields *pMmodProfileFields,
                                eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate)
@@ -5465,18 +5564,22 @@
         csrScanAbortMacScanNotForConnect(pMac);
         if(pProfile)
         {
+
            //This is likely trying to reassoc to different profile
            pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE;
            //make a copy of the profile
            status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile);
            pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE;
+
         }
         else
         {
             status = csrRoamCopyConnectedProfile(pMac, sessionId, &pCommand->u.roamCmd.roamProfile);
             //how to update WPA/WPA2 info in roamProfile??
             pCommand->u.roamCmd.roamProfile.uapsd_mask = pMmodProfileFields->uapsd_mask;
+
         }
+
         if(HAL_STATUS_SUCCESS(status))
         {
            pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE;
@@ -5490,6 +5593,7 @@
         pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; 
         pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE;
         pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE;
+
         status = csrQueueSmeCommand(pMac, pCommand, fImediate);
         if( !HAL_STATUS_SUCCESS( status ) )
     {
@@ -5498,76 +5602,10 @@
             csrReleaseCommandRoam( pMac, pCommand );
     }
     }
+
     return (status);
 }
 
-eHalStatus csrRoamEnqueuePreauth(tpAniSirGlobal pMac, tANI_U32 sessionId, tpSirBssDescription pBssDescription,
-                                eCsrRoamReason reason, tANI_BOOLEAN fImmediate)
-//                               , eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate)
-{
-    eHalStatus status = eHAL_STATUS_SUCCESS;
-    tSmeCmd *pCommand;
-    
-    pCommand = csrGetCommandBuffer(pMac);
-    if(NULL == pCommand)
-    {
-        smsLog( pMac, LOGE, FL(" fail to get command buffer\n") );
-        status = eHAL_STATUS_RESOURCES;
-    }
-    else
-    {
-        if(pBssDescription)
-        {
-            //copy over the parameters we need later
-            pCommand->command = eSmeCommandRoam;
-            pCommand->sessionId = (tANI_U8)sessionId;
-            pCommand->u.roamCmd.roamReason = reason;
-            //this is the important parameter
-            //in this case we are using this field for the "next" BSS 
-            pCommand->u.roamCmd.pLastRoamBss = pBssDescription;
-            status = csrQueueSmeCommand(pMac, pCommand, fImmediate);
-            if( !HAL_STATUS_SUCCESS( status ) )
-            {
-                smsLog( pMac, LOGE, FL(" fail to enqueue preauth command, status = %d\n"), status );
-                csrReleaseCommandPreauth( pMac, pCommand );
-            }
-        }
-        else
-        {
-           //Return failure
-           status = eHAL_STATUS_RESOURCES;
-        }
-    }
-    return (status);
-}
-
-eHalStatus csrRoamDequeuePreauth(tpAniSirGlobal pMac)
-{
-    tListElem *pEntry;
-    tSmeCmd *pCommand;
-    pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
-    if ( pEntry )
-    {
-        pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
-        if ( (eSmeCommandRoam == pCommand->command) && 
-                (eCsrPerformPreauth == pCommand->u.roamCmd.roamReason))
-        {             
-            smsLog( pMac, LOGE, FL("DQ-Command = %d, Reason = %d \n"), 
-                    pCommand->command, pCommand->u.roamCmd.roamReason);
-            if (csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK )) {
-                csrReleaseCommandPreauth( pMac, pCommand );
-            }
-        } else  {
-            smsLog( pMac, LOGE, FL("Command = %d, Reason = %d \n"), 
-                    pCommand->command, pCommand->u.roamCmd.roamReason);
-        }
-    }
-    else {
-        smsLog( pMac, LOGE, FL("pEntry NULL for eWNI_SME_FT_PRE_AUTH_RSP\n"));
-    }
-    smeProcessPendingQueue( pMac );
-    return eHAL_STATUS_SUCCESS;
-}
 
 eHalStatus csrRoamConnectWithBSSList(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
                                      tScanResultHandle hBssListIn, tANI_U32 *pRoamId)
@@ -5575,6 +5613,7 @@
     eHalStatus status = eHAL_STATUS_FAILURE;
     tScanResultHandle hBSSList;
     tANI_U32 roamId = 0;
+
     status = csrScanCopyResultList(pMac, hBssListIn, &hBSSList);
     if(HAL_STATUS_SUCCESS(status))
     {
@@ -5591,9 +5630,11 @@
             csrScanResultPurge(pMac, hBSSList);
         }
     }
+
     return (status);
 }
 
+
 eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
                           tScanResultHandle hBssListIn, tANI_U32 *pRoamId)
 {
@@ -5603,13 +5644,16 @@
     tANI_U32 roamId = 0;
     tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_FALSE;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
     if (NULL == pProfile)
     {
         smsLog(pMac, LOGP, FL("No profile specified"));
         return eHAL_STATUS_FAILURE;
     }
+
     smsLog(pMac, LOG1, FL("called  BSSType = %d authtype = %d  encryType = %d\n"),
                 pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]);
+
     if( CSR_IS_WDS( pProfile ) && 
         !HAL_STATUS_SUCCESS( status = csrIsBTAMPAllowed( pMac, pProfile->operationChannel ) ) )
     {
@@ -5620,12 +5664,14 @@
     csrScanCancelIdleScan(pMac);
     //Only abort the scan if it is not used for other roam/connect purpose
     csrScanAbortMacScan(pMac);
+
 #ifdef WLAN_SOFTAP_FEATURE
     if (!vos_concurrent_sessions_running() && (VOS_STA_SAP_MODE == pProfile->csrPersona))//In case of AP mode we do not want idle mode scan
     {
         csrScanDisable(pMac);
     }
 #endif
+
     csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued);
     //Check whether ssid changes
     if(csrIsConnStateConnected(pMac, sessionId))
@@ -5686,6 +5732,7 @@
                 {
                     pScanFilter->bWPSAssociation = 0;
                 }
+
                 do
                 {
                     if( (pProfile && CSR_IS_WDS_AP( pProfile ) )
@@ -5701,12 +5748,14 @@
                         {
                             fCallCallback = eANI_BOOLEAN_TRUE;
                         }
+
                         break;
                     }
                     status = csrScanGetResult(pMac, pScanFilter, &hBSSList);
-                    smsLog(pMac, LOG1, "************ csrScanGetResult Status ********* %d\n", status);
+                    smsLog(pMac, LOGE, "************ csrScanGetResult Status ********* %d\n", status);
                     if(HAL_STATUS_SUCCESS(status))
                     {
+
                         status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, 
                                                     roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
                         if(!HAL_STATUS_SUCCESS(status))
@@ -5761,6 +5810,7 @@
    
     return (status);
 }                         
+
 eHalStatus csrRoamReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
                           tCsrRoamModifyProfileFields modProfileFields,
                           tANI_U32 *pRoamId)
@@ -5769,17 +5819,20 @@
    tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_TRUE;
    tANI_U32 roamId = 0;
    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
    if (NULL == pProfile)
    {
       smsLog(pMac, LOGP, FL("No profile specified"));
       return eHAL_STATUS_FAILURE;
    }
+
    smsLog(pMac, LOG1, FL("called  BSSType = %d authtype = %d  encryType = %d\n"), pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]);
    csrRoamCancelRoaming(pMac, sessionId);
    csrScanRemoveFreshScanCommand(pMac, sessionId);
    csrScanCancelIdleScan(pMac);
    csrScanAbortMacScanNotForConnect(pMac);
    csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssuedReassocToSameAP);
+
    if(csrIsConnStateConnected(pMac, sessionId))
    {
       if(pProfile)
@@ -5810,6 +5863,7 @@
    {
       smsLog(pMac, LOG1, FL("Not connected! No need to reassoc\n"));
    }
+
    if(!fCallCallback)
    {
       roamId = GET_NEXT_ROAM_ID(&pMac->roam);
@@ -5818,16 +5872,20 @@
          *pRoamId = roamId;
       }
 
+
       status = csrRoamIssueReassoc(pMac, sessionId, pProfile, &modProfileFields, 
                                    eCsrHddIssuedReassocToSameAP, roamId, eANI_BOOLEAN_FALSE);
+
    }
    else
    {
       status = csrRoamCallCallback(pMac, sessionId, NULL, roamId, 
                                    eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE);
    }
+
    return status;
 }
+
 eHalStatus csrRoamJoinLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
@@ -5837,12 +5895,6 @@
     tCsrRoamProfile *pProfile = NULL;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     do
     {
         if(pSession->pCurRoamProfile)
@@ -5909,11 +5961,14 @@
         csrReleaseProfile(pMac, pProfile);
         palFreeMemory(pMac->hHdd, pProfile);
     }
+
     return (status);
 }
+
 eHalStatus csrRoamReconnect(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
+
     if(csrIsConnStateConnected(pMac, sessionId))
     {
         status = csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
@@ -5922,12 +5977,15 @@
             status = csrRoamJoinLastProfile(pMac, sessionId);
         }
     }
+
     return (status);
 }
 
+
 eHalStatus csrRoamConnectToLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
+
     smsLog(pMac, LOGW, FL("is called\n"));
     csrRoamCancelRoaming(pMac, sessionId);
     csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued);
@@ -5935,9 +5993,11 @@
     {
         status = csrRoamJoinLastProfile(pMac, sessionId);
     }
+
     return (status);
 }
 
+
 eHalStatus csrRoamProcessDisassocDeauth( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fDisassoc, tANI_BOOLEAN fMICFailure )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -6017,23 +6077,28 @@
     return (status);
 }
 
+
 /* This is been removed from latest code base */
 /*
 static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
     eHalStatus status;
     tANI_U32 sessionId = pCommand->sessionId;
+
     csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING );
     status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ );
+
     return ( status );
 }
 */
 
+
 eHalStatus csrRoamIssueDisassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tSmeCmd *pCommand;
         tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_FALSE;
+
     do
     {
         smsLog( pMac, LOGE, FL("  reason = %d\n"), reason );
@@ -6057,23 +6122,29 @@
         case eCSR_DISCONNECT_REASON_MIC_ERROR:
             pCommand->u.roamCmd.roamReason = eCsrForcedDisassocMICFailure;
             break;
+
         case eCSR_DISCONNECT_REASON_DEAUTH:
             pCommand->u.roamCmd.roamReason = eCsrForcedDeauth;
             break;
+
         case eCSR_DISCONNECT_REASON_HANDOFF:
             fHighPriority = eANI_BOOLEAN_TRUE;
             pCommand->u.roamCmd.roamReason = eCsrSmeIssuedDisassocForHandoff;
             break;
+
         case eCSR_DISCONNECT_REASON_UNSPECIFIED:
         case eCSR_DISCONNECT_REASON_DISASSOC:
             pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc;
             break;
+
         case eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE:
             pCommand->u.roamCmd.roamReason = eCsrSmeIssuedIbssJoinFailure;
             break;
+
         case eCSR_DISCONNECT_REASON_IBSS_LEAVE:
             pCommand->u.roamCmd.roamReason = eCsrForcedIbssLeave;
             break;
+
         default:
             break;
         }
@@ -6084,13 +6155,16 @@
             csrReleaseCommandRoam( pMac, pCommand );
         }
     } while( 0 );
+
     return( status );
 }
 
+
 eHalStatus csrRoamIssueStopBssCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN fHighPriority )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tSmeCmd *pCommand;
+
     pCommand = csrGetCommandBuffer( pMac );
     if ( NULL != pCommand ) 
     {
@@ -6115,20 +6189,15 @@
         smsLog( pMac, LOGE, FL(" fail to get command buffer\n") );
         status = eHAL_STATUS_RESOURCES;
     }
+
     return ( status );
 }
 
+
 eHalStatus csrRoamDisconnectInternal(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
 #ifdef FEATURE_WLAN_BTAMP_UT_RF
     //Stop te retry
     pSession->maxRetryCount = 0;
@@ -6144,19 +6213,15 @@
         smsLog(pMac, LOG2, FL("called\n"));
         status = csrRoamIssueDisassociateCmd(pMac, sessionId, reason);
     }
+
     return (status);
 }
 
+
 eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason)
 {
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     csrRoamCancelRoaming(pMac, sessionId);
     pSession->ibss_join_pending = FALSE;
     csrRoamStopIbssJoinTimer(pMac, sessionId);
@@ -6165,6 +6230,7 @@
     return (csrRoamDisconnectInternal(pMac, sessionId, reason));
 }
 
+
 eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
                                           tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes)
 {
@@ -6173,12 +6239,6 @@
     tANI_U8 index;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     tCsrRoamConnectedProfile *pConnectProfile = &pSession->connectedProfile;
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
     
     palZeroMemory(pMac->hHdd, &pSession->connectedProfile, sizeof(tCsrRoamConnectedProfile));
     pConnectProfile->AuthType = pProfile->negotiatedAuthType;
@@ -6191,8 +6251,6 @@
     pConnectProfile->BSSType = pProfile->BSSType;
     pConnectProfile->modifyProfileFields.uapsd_mask = pProfile->uapsd_mask;
     pConnectProfile->operationChannel = pSirBssDesc->channelId;
-    pConnectProfile->beaconInterval = pSirBssDesc->beaconInterval;
-
     palCopyMemory(pMac->hHdd, &pConnectProfile->Keys, &pProfile->Keys, sizeof(tCsrKeys));
     //Save bssid
     csrGetBssIdBssDesc(pMac, pSirBssDesc, &pConnectProfile->bssid);
@@ -6204,15 +6262,7 @@
     }
 #endif
 #ifdef FEATURE_WLAN_CCX
-    if ((csrIsProfileCCX(pProfile) || 
-         ((pIesTemp->CCXVersion.present) 
-          && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) 
-              || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) 
-              || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) 
-              || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) 
-              || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) 
-        && (!(csrIsProfile11r( pProfile ))) 
-        && (pMac->roam.configParam.isCcxIniFeatureEnabled))
+    if ((csrIsProfileCCX(pProfile) || ((pIesTemp->CCXVersion.present) && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA)))) && (!(csrIsProfile11r( pProfile ))) && (pMac->roam.configParam.isCcxIniFeatureEnabled))
     {
         pConnectProfile->isCCXAssoc = 1;
     }
@@ -6233,6 +6283,7 @@
         
         //Save the bss desc
         status = csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc);
+
            if( CSR_IS_QOS_BSS(pIesTemp) )
            {
               pConnectProfile->qap = TRUE;
@@ -6241,6 +6292,7 @@
            {
               pConnectProfile->qap = FALSE;
            }
+
         if ( NULL == pIes )
         {
             //Free memory if it allocated locally
@@ -6269,16 +6321,20 @@
     return (status);
 }
 
+
+
 static void csrRoamJoinRspProcessor( tpAniSirGlobal pMac, tSirSmeJoinRsp *pSmeJoinRsp )
 {
    tListElem *pEntry = NULL;
    tSmeCmd *pCommand = NULL;
+
    //The head of the active list is the request we sent
    pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
    if(pEntry)
    {
        pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
    }
+
    if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) 
    {
             if(pCommand && eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason)
@@ -6293,12 +6349,6 @@
    {
         tANI_U32 roamId = 0;
         tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId );
-        if(!pSession)
-        {
-            smsLog(pMac, LOGE, FL("  session %d not found "), pSmeJoinRsp->sessionId);
-            return;
-        }
-        
         
         //The head of the active list is the request we sent
         //Try to get back the same profile and roam again
@@ -6306,6 +6356,7 @@
         {
             roamId = pCommand->u.roamCmd.roamId;
         }
+
         pSession->joinFailStatusCode.statusCode = pSmeJoinRsp->statusCode;
         pSession->joinFailStatusCode.reasonCode = pSmeJoinRsp->protStatusCode;
         smsLog( pMac, LOGW, "SmeJoinReq failed with statusCode= 0x%08lX [%d]\n", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode );
@@ -6342,26 +6393,32 @@
     } /*else: ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) */
 }
 
+
 eHalStatus csrRoamIssueJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, 
                              tDot11fBeaconIEs *pIes,
                              tCsrRoamProfile *pProfile, tANI_U32 roamId )
 {
     eHalStatus status;
+
     smsLog( pMac, LOG1, "Attempting to Join Bssid= %02x-%02x-%02x-%02x-%02x-%02x\n", 
                   pSirBssDesc->bssId[ 0 ],pSirBssDesc->bssId[ 1 ],pSirBssDesc->bssId[ 2 ],
                   pSirBssDesc->bssId[ 3 ],pSirBssDesc->bssId[ 4 ],pSirBssDesc->bssId[ 5 ] );
     
     // Set the roaming substate to 'join attempt'...
     csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId);
+
     // attempt to Join this BSS...
     status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes );
+
     return (status);
 }
 
+
 static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, 
                               tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile)
 {
     csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId);
+
     // Set the roaming substate to 'join attempt'...
     csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_REASSOC_REQ, sessionId );
 
@@ -6371,6 +6428,8 @@
     return csrSendSmeReassocReqMsg( pMac, sessionId, pSirBssDesc, pIes, pProfile );
 }
 
+
+
 void csrRoamReissueRoamCommand(tpAniSirGlobal pMac)
 {
     tListElem *pEntry;
@@ -6387,13 +6446,6 @@
         {
             sessionId = pCommand->sessionId;
             pSession = CSR_GET_SESSION( pMac, sessionId );
-
-            if(!pSession)
-            {
-                smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                return;
-            }
-            
             if( pCommand->u.roamCmd.fStopWds )
             {
                 palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
@@ -6417,6 +6469,7 @@
  
 #endif                  
 
+
                 if( !HAL_STATUS_SUCCESS( csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ) ) )
                 {
                     smsLog(pMac, LOGE, " Failed to reissue stop_bss command for WDS after disassociated\n");
@@ -6440,11 +6493,13 @@
     }
 }
 
+
 tANI_BOOLEAN csrIsRoamCommandWaitingForSession(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
     tListElem *pEntry;
     tSmeCmd *pCommand = NULL;
+
     //alwasy lock active list before locking pending list
     csrLLLock( &pMac->sme.smeCmdActiveList );
     pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK);
@@ -6473,13 +6528,16 @@
         csrLLUnlock(&pMac->sme.smeCmdPendingList);
     }
     csrLLUnlock( &pMac->sme.smeCmdActiveList );
+
     return (fRet);
 }
 
+
 tANI_BOOLEAN csrIsRoamCommandWaiting(tpAniSirGlobal pMac)
 {
     tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
     tANI_U32 i;
+
     for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
     {
         if( CSR_IS_SESSION_VALID( pMac, i ) && ( fRet = csrIsRoamCommandWaitingForSession( pMac, i ) ) )
@@ -6487,12 +6545,15 @@
             break;
         }
     }
+
     return ( fRet );
 }
 
+
 tANI_BOOLEAN csrIsCommandWaiting(tpAniSirGlobal pMac)
 {
     tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
+
     //alwasy lock active list before locking pending list
     csrLLLock( &pMac->sme.smeCmdActiveList );
     fRet = csrLLIsListEmpty(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK);
@@ -6501,14 +6562,17 @@
         fRet = csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK);
     }
     csrLLUnlock( &pMac->sme.smeCmdActiveList );
+
     return (fRet);
 }
 
+
 tANI_BOOLEAN csrIsScanForRoamCommandActive( tpAniSirGlobal pMac )
 {
     tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
     tListElem *pEntry;
     tCsrCmd *pCommand;
+
     //alwasy lock active list before locking pending list
     csrLLLock( &pMac->sme.smeCmdActiveList );
     pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK);
@@ -6524,8 +6588,10 @@
         }
     }
     csrLLUnlock( &pMac->sme.smeCmdActiveList );
+
     return (fRet);
 }
+
 eHalStatus csrRoamIssueReassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -6533,6 +6599,7 @@
     tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_TRUE;
     tANI_BOOLEAN fRemoveCmd = FALSE;
     tListElem *pEntry; 
+
     // Delete the old assoc command. All is setup for reassoc to be serialized
     pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
     if ( pEntry )
@@ -6561,11 +6628,13 @@
             }
         }
     }
+
     if(NULL == pCommand)
     {
         smsLog( pMac, LOGE, FL(" fail to get command buffer as expected based on previous connect roam command\n") );
         return eHAL_STATUS_RESOURCES;
     }
+
     do 
     {
         //Change the substate in case it is wait-for-key
@@ -6577,6 +6646,7 @@
         pCommand->command = eSmeCommandRoam;
         pCommand->sessionId = (tANI_U8)sessionId;
         pCommand->u.roamCmd.roamReason = eCsrSmeIssuedFTReassoc;
+
         status = csrQueueSmeCommand(pMac, pCommand, fHighPriority);
         if( !HAL_STATUS_SUCCESS( status ) )
         {
@@ -6585,6 +6655,7 @@
         }
     } while( 0 );
 
+
     return( status );
 }
 static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result )
@@ -6595,6 +6666,7 @@
     tSmeCmd *pCommand = NULL;
     tANI_U32 sessionId;
     tCsrRoamSession *pSession;
+
     if(NULL == pEntry)
     {
         smsLog(pMac, LOGW, "   CFG_CNF with active list empty\n");
@@ -6603,13 +6675,6 @@
     pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
     sessionId = pCommand->sessionId;
     pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return;
-    }
-    
     if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming)
     {
         //the roaming is cancelled. Simply complete the command
@@ -6658,6 +6723,7 @@
                 if ( csrIsInfraBssDesc( pBssDesc ) )
                 {
                     tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes;
+
                     if(pIesLocal || (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) )
                     {
                     // ..and currently in an Infrastructure connection....
@@ -6704,6 +6770,7 @@
                         }
                         else
 #endif
+
 #ifdef FEATURE_WLAN_CCX
                         if (csrRoamIsHandoffInProgress(pMac) && 
                                                 csrRoamIsCCXAssoc(pMac))
@@ -6713,15 +6780,6 @@
                         }
                         else
 #endif
-#ifdef FEATURE_WLAN_LFR
-                        if (csrRoamIsHandoffInProgress(pMac) && 
-                                                csrRoamIsFastRoamEnabled(pMac))
-                        {
-                            // Now serialize the reassoc command.
-                            status = csrRoamIssueReassociateCmd(pMac, sessionId);
-                        }
-                        else
-#endif
                         // else we are not connected and attempting to Join.  Issue the
                         // Join request.
                         {
@@ -6772,6 +6830,7 @@
     }//we have active entry
 }
 
+
 static void csrRoamRoamingStateAuthRspProcessor( tpAniSirGlobal pMac, tSirSmeAuthRsp *pSmeAuthRsp )
 {
     //No one is sending eWNI_SME_AUTH_REQ to PE.
@@ -6782,6 +6841,7 @@
         // Successfully authenticated with a new Bss.  Attempt to stop the current Bss and
         // join the new one...
         /***pBssDesc = profGetRoamingBssDesc( pAdapter, &pHddProfile );
+
         roamStopNetwork( pAdapter, &pBssDesc->SirBssDescription );***/
     }
     else {
@@ -6792,6 +6852,7 @@
     }
 }
 
+
 static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSmeJoinRsp pSmeJoinRsp )
 {
     eCsrRoamCompleteResult result;
@@ -6803,6 +6864,7 @@
     {
         smsLog( pMac, LOGW, "CSR SmeReassocReq Successful\n" );
         result = eCsrReassocSuccess;
+
         /* Defeaturize this part later if needed */
 #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
         /* Since the neighbor roam algorithm uses reassoc req for handoff instead of join, 
@@ -6835,18 +6897,6 @@
                         vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
                         csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId,
                                         &roamInfo, roamId, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS);
-                        /*
-                         * Since the above callback sends a disconnect
-                         * to HDD, we should clean-up our state 
-                         * machine as well to be in sync with the upper
-                         * layers. There is no need to send a disassoc 
-                         * since: 1) we will never reassoc to the current 
-                         * AP in LFR, and 2) there is no need to issue a 
-                         * disassoc to the AP with which we were trying 
-                         * to reassoc.
-                         */
-                        csrRoamComplete( pMac, eCsrJoinFailure, NULL );
-                        return;
                 }
         }
 #endif
@@ -6862,11 +6912,14 @@
     }
 }
 
+
 static void csrRoamRoamingStateStopBssRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSmeRsp)
 {
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
     {
         vos_log_ibss_pkt_type *pIbssLog;
+
         WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
         if(pIbssLog)
         {
@@ -6879,6 +6932,7 @@
         }
     }
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
     pMac->roam.roamSession[pSmeRsp->sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
     if(CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, pSmeRsp->sessionId))
     {
@@ -6890,6 +6944,7 @@
     }
 }
 
+
 void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeRsp )
 {
     tSirResultCodes statusCode;
@@ -6906,7 +6961,6 @@
 #endif
     tANI_U32 sessionId;
     tCsrRoamSession *pSession;
-
     tSirSmeDisassocRsp SmeDisassocRsp;
 
     csrSerDesUnpackDiassocRsp((tANI_U8 *)pSmeRsp, &SmeDisassocRsp);
@@ -6919,14 +6973,8 @@
     {
         pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
     }
-    pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return;
-    }
-    
+    pSession = CSR_GET_SESSION( pMac, sessionId );
     if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, sessionId ) )
     {
         csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
@@ -6941,6 +6989,7 @@
         } 
         csrRoamComplete( pMac, eCsrNothingToJoin, NULL );
     }
+
     else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId ) )
     {
        smsLog( pMac, LOGE, "CSR SmeDisassocReq due to HO\n" );
@@ -6949,11 +6998,11 @@
         if ( pEntry )
         {
             pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
+
             // If the head of the queue is Active and it is a ROAM command, remove
             // and put this on the Free queue.
             if ( eSmeCommandRoam == pCommand->command )
             {
-
                 //we need to process the result first before removing it from active list because state changes 
                 //still happening insides roamQProcessRoamResults so no other roam command should be issued
                 fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK );
@@ -6962,6 +7011,7 @@
                     csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile);
                     pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE;
                 }
+
                 if( fRemoveCmd )
                 {
                     csrReleaseCommandRoam( pMac, pCommand );
@@ -6981,12 +7031,13 @@
         {
             smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ...\n" );
         }
+
         //notify HDD for handoff, providing the BSSID too
         roamInfo.reasonCode = eCsrRoamReasonBetterAP;
 
         palCopyMemory(pMac->hHdd, roamInfo.bssid, pMac->roam.neighborRoamInfo.csrNeighborRoamProfile.BSSIDs.bssid, sizeof(tSirMacAddr));
 
-            csrRoamCallCallback(pMac,sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE);
+        csrRoamCallCallback(pMac,sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE);
 
         status = palAllocateMemory(pMac->hHdd, (void **)&pScanFilter, sizeof(tCsrScanResultFilter));
         if(HAL_STATUS_SUCCESS(status))
@@ -7036,12 +7087,12 @@
         }
         if( pScanFilter )
         {
-
             csrFreeScanFilter(pMac, pScanFilter);
             palFreeMemory( pMac->hHdd, pScanFilter );
         }
-#endif
 
+
+#endif
     } //else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac ) )
     else if ( CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, sessionId ) )
     {
@@ -7070,11 +7121,14 @@
         //We are not done yet. Get the data and continue roaming
         csrRoamReissueRoamCommand(pMac);
     }
+
 }
 
+
 static void csrRoamRoamingStateDeauthRspProcessor( tpAniSirGlobal pMac, tSirSmeDeauthRsp *pSmeRsp )
 {
     tSirResultCodes statusCode;
+
     //No one is sending eWNI_SME_DEAUTH_REQ to PE.
     smsLog(pMac, LOGW, FL("is no-op\n"));
     statusCode = csrGetDeAuthRspStatusCode( pSmeRsp );
@@ -7099,6 +7153,7 @@
     }
 }
 
+
 static void csrRoamRoamingStateStartBssRspProcessor( tpAniSirGlobal pMac, tSirSmeStartBssRsp *pSmeStartBssRsp )
 {
     eCsrRoamCompleteResult result;
@@ -7121,6 +7176,7 @@
 #endif
 }
 
+
 /*
   We need to be careful on whether to cast pMsgBuf (pSmeRsp) to other type of strucutres.
   It depends on how the message is constructed. If the message is sent by limSendSmeRsp,
@@ -7135,7 +7191,9 @@
     tCsrRoamInfo roamInfo;
         // TODO Session Id need to be acquired in this function
         tANI_U32 sessionId = 0;
+
     pSmeRsp = (tSirSmeRsp *)pMsgBuf;
+
     smsLog( pMac, LOG2, "Message %d[0x%04X] received in substate %d\n",
                 pSmeRsp->messageType, pSmeRsp->messageType,
                 pMac->roam.curSubState[pSmeRsp->sessionId] );
@@ -7213,7 +7271,9 @@
             {
                 csrRoamingStateConfigCnfProcessor( pMac, ((tCsrCfgSetRsp *)pSmeRsp)->respStatus );
             }
+
             break;
+
         //In case CSR issues STOP_BSS, we need to tell HDD about peer departed becasue PE is removing them
         case eWNI_SME_IBSS_PEER_DEPARTED_IND:
             pIbssPeerInd = (tSmeIbssPeerInd*)pSmeRsp;
@@ -7227,6 +7287,7 @@
                                 eCSR_ROAM_CONNECT_STATUS_UPDATE, 
                                 eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED);
             break;
+
         default:
             smsLog( pMac, LOG1, "Unexpected message type = %d[0x%X] received in substate %d\n",
                       pSmeRsp->messageType, pSmeRsp->messageType,
@@ -7241,13 +7302,15 @@
     }
 }
 
+
 void csrRoamJoinedStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf )
 {
     tSirSmeRsp *pSirMsg = (tSirSmeRsp *)pMsgBuf;
+
     switch (pSirMsg->messageType) 
     {
        case eWNI_SME_GET_STATISTICS_RSP:
-          smsLog( pMac, LOG2, FL("Stats rsp from PE\n"));
+          smsLog( pMac, LOGW, FL("Stats rsp from PE\n"));
           csrRoamStatsRspProcessor( pMac, pSirMsg );
           break;
 #ifdef WLAN_SOFTAP_FEATURE
@@ -7259,29 +7322,31 @@
             tCsrRoamInfo *pRoamInfo = NULL;
             tANI_U32 sessionId;
             eHalStatus status;
+
             smsLog( pMac, LOG1, FL("ASSOCIATION confirmation can be given to upper layer \n"));
+
             palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
             pRoamInfo = &roamInfo;
+
             pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf;
             status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pUpperLayerAssocCnf->bssId, &sessionId );
             pSession = CSR_GET_SESSION(pMac, sessionId);
 
-            if(!pSession)
-            {
-                smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                return;
-            }
-            
             pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success 
             pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile;
+
             pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid;
             pRoamInfo->rsnIELen = (tANI_U8)pUpperLayerAssocCnf->rsnIE.length;
             pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata;
+
             pRoamInfo->addIELen = (tANI_U8)pUpperLayerAssocCnf->addIE.length;
             pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata;           
+
             palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pUpperLayerAssocCnf->peerMacAddr, sizeof(tSirMacAddr));
             palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pUpperLayerAssocCnf->bssId, sizeof(tCsrBssid));
+
             pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta;
+
             if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) )
             {
                 pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED;
@@ -7295,15 +7360,19 @@
                 status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta
             }
 
+
         }
         break;
 #endif
+
        default:
           csrRoamCheckForLinkStatusChange( pMac, pSirMsg );
           break;
     }
+
 }
 
+
 eHalStatus csrRoamIssueSetContextReq( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrEncryptionType EncryptType, 
                                      tSirBssDescription *pBssDescription,
                                 tSirMacAddr *bssId, tANI_BOOLEAN addKey,
@@ -7327,6 +7396,7 @@
            addKey )     
     {
         tCsrRoamSetKey setKey;
+
         setKey.encType = EncryptType;
         setKey.keyDirection = aniKeyDirection;    //Tx, Rx or Tx-and-Rx
         palCopyMemory( pMac->hHdd, &setKey.peerMac, bssId, sizeof(tCsrBssid) );   
@@ -7339,9 +7409,11 @@
         }
         status = csrRoamIssueSetKeyCommand( pMac, sessionId, &setKey, 0 );
     }
+
     return (status);
 }
 
+
 static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, 
                                              tCsrRoamSetKey *pSetKey, tANI_U32 roamId )
 {
@@ -7443,7 +7515,6 @@
             break;
         }
 #endif /* FEATURE_WLAN_CCX */
-
 #ifdef WLAN_FEATURE_11W
         //Check for 11w BIP
         else if ( eCSR_ENCRYPT_TYPE_AES_CMAC == pSetKey->encType )
@@ -7474,6 +7545,7 @@
             smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
         }
     } while (0);
+
     // Free the command if there has been a failure, or it is a 
     // "local" operation like the set CCX CCKM KRK key.
     if( (!HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand )) 
@@ -7484,15 +7556,18 @@
     {
         csrReleaseCommandSetKey( pMac, pCommand );
     }
+
     return( status );
 }
 
+
 eHalStatus csrRoamIssueRemoveKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId,
                                          tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId )
 {
     eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
     tSmeCmd *pCommand = NULL;
     tANI_BOOLEAN fImediate = eANI_BOOLEAN_TRUE;
+
     do
     {
         if( !csrIsSetKeyAllowed(pMac, sessionId) ) 
@@ -7519,6 +7594,7 @@
             //in this case, put it to the end of the Q incase there is a set key pending.
             fImediate = eANI_BOOLEAN_FALSE;
         }
+
         smsLog( pMac, LOGE, FL("keyType=%d, keyId=%d, PeerMac=%02x, %02x, %02x, %02x, %02x, %02x\n"),       
             pRemoveKey->encType, pRemoveKey->keyId,
             pCommand->u.removeKeyCmd.peerMac[0],
@@ -7527,6 +7603,7 @@
             pCommand->u.removeKeyCmd.peerMac[3], 
             pCommand->u.removeKeyCmd.peerMac[4],
             pCommand->u.removeKeyCmd.peerMac[5]);
+
         status = csrQueueSmeCommand(pMac, pCommand, fImediate);
         if( !HAL_STATUS_SUCCESS( status ) )
         {
@@ -7534,13 +7611,16 @@
             break;
         }
     } while (0);
+
     if( !HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand ) )
     {
         csrReleaseCommandRemoveKey( pMac, pCommand );
     }
+
     return (status );
 }
 
+
 eHalStatus csrRoamProcessSetKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
     eHalStatus status;
@@ -7548,9 +7628,11 @@
     tAniEdType edType = csrTranslateEncryptTypeToEdType( pCommand->u.setKeyCmd.encType );
     tANI_BOOLEAN fUnicast = ( pCommand->u.setKeyCmd.peerMac[0] == 0xFF ) ? eANI_BOOLEAN_FALSE : eANI_BOOLEAN_TRUE;
     tANI_U32 sessionId = pCommand->sessionId;
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type);
+
     if(eCSR_ENCRYPT_TYPE_NONE != edType)
     {
         palZeroMemory(pMac->hHdd, &setKeyEvent, sizeof(vos_event_wlan_security_payload_type));
@@ -7570,6 +7652,7 @@
         if(CSR_IS_ENC_TYPE_STATIC(edType))
         {
             tANI_U32 defKeyId;
+
             //It has to be static WEP here
             if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, &defKeyId)))
             {
@@ -7584,6 +7667,7 @@
         WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY);
     }
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
     if( csrIsSetKeyAllowed(pMac, sessionId) )
     {
         status = csrSendMBSetContextReqMsg( pMac, sessionId, 
@@ -7603,6 +7687,7 @@
     {
         smsLog( pMac, LOGE, FL("  error status %d\n"), status );
         csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.setKeyCmd.roamId, eCSR_ROAM_SET_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE);
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
         if(eCSR_ENCRYPT_TYPE_NONE != edType)
         {
@@ -7618,10 +7703,13 @@
             WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY);
         }
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
     }
+
     return ( status );
 }
 
+
 eHalStatus csrRoamProcessRemoveKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
     eHalStatus status;
@@ -7629,9 +7717,11 @@
     tANI_U16 wMsgLen = sizeof(tSirSmeRemoveKeyReq);
     tANI_U8 *p;
     tANI_U32 sessionId = pCommand->sessionId;
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type);
+
     palZeroMemory(pMac->hHdd, &removeKeyEvent, sizeof(vos_event_wlan_security_payload_type));
     removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_REQ;
     removeKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType);
@@ -7641,6 +7731,7 @@
     removeKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType);
     WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY);
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
     if( csrIsSetKeyAllowed(pMac, sessionId) )
     {
         status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, wMsgLen );
@@ -7656,6 +7747,7 @@
         palZeroMemory(pMac->hHdd, pMsg, wMsgLen);
         pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REMOVEKEY_REQ);
                 pMsg->length = pal_cpu_to_be16(wMsgLen);
+
         pMsg->sessionId = (tANI_U8)sessionId;
         pMsg->transactionId = 0;
         p = (tANI_U8 *)pMsg + sizeof(pMsg->messageType) + sizeof(pMsg->length) +
@@ -7684,21 +7776,28 @@
         *p = pCommand->u.removeKeyCmd.keyId;
         p++;
         *p = (pCommand->u.removeKeyCmd.peerMac[0] == 0xFF ) ? 0 : 1;
+
         status = palSendMBMessage(pMac->hHdd, pMsg);
     }
+
     if( !HAL_STATUS_SUCCESS( status ) )
     {
         smsLog( pMac, LOGE, FL(" error status \n"), status );
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
         removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP;
         removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE;;
         WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY);
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
         csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.removeKeyCmd.roamId, eCSR_ROAM_REMOVE_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE);
     }
+
     return ( status );
 }
 
+
+
 eHalStatus csrRoamSetKey( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId )
 {
     eHalStatus status;
@@ -7711,9 +7810,11 @@
     {
         status = csrRoamIssueSetKeyCommand( pMac, sessionId, pSetKey, roamId );
     }
+
     return ( status );
 }
 
+
 /*
    Prepare a filter base on a profile for parsing the scan results.
    Upon successful return, caller MUST call csrFreeScanFilter on 
@@ -7782,12 +7883,14 @@
                  {
                          smsLog(pMac, LOG1, FL("process a channel (%d) that is invalid\n"), pProfile->ChannelInfo.ChannelList[index]);
                  }
+
             }
             }
             else
             {
                 break;
             }
+
         }
         else 
         {
@@ -7820,8 +7923,10 @@
              }
         }
 #endif /* FEATURE_WLAN_WAPI */
+
         /*Save the WPS info*/
         pScanFilter->bWPSAssociation = pProfile->bWPSAssociation;
+
         if( pProfile->countryCode[0] )
         {
             //This causes the matching function to use countryCode as one of the criteria.
@@ -7846,11 +7951,13 @@
     return(status);
 }
 
+
 tANI_BOOLEAN csrRoamIssueWmStatusChange( tpAniSirGlobal pMac, tANI_U32 sessionId,
                                          eCsrRoamWmStatusChangeTypes Type, tSirSmeRsp *pSmeRsp )
 {
     tANI_BOOLEAN fCommandQueued = eANI_BOOLEAN_FALSE;
     tSmeCmd *pCommand;
+
     do
     {
         // Validate the type is ok...
@@ -7890,12 +7997,16 @@
             csrReleaseCommandWmStatusChange( pMac, pCommand );
         }
 
+
         /* AP has issued Dissac/Deauth, Set the operating mode value to configured value */
         csrSetDefaultDot11Mode( pMac );
+
     } while( 0 );
+
     return( fCommandQueued );
 }
 
+
 static void csrUpdateRssi(tpAniSirGlobal pMac, void* pMsg)
 {
     v_S7_t  rssi = 0;
@@ -7928,27 +8039,6 @@
     }
     return;
 }
-static void csrRoamRssiIndHdlr(tpAniSirGlobal pMac, void* pMsg)
-{
-    WLANTL_TlIndicationReq *pTlRssiInd = (WLANTL_TlIndicationReq*)pMsg;
-    if(pTlRssiInd)
-    {
-        if(NULL != pTlRssiInd->tlCallback)
-        {
-            ((WLANTL_RSSICrossThresholdCBType)(pTlRssiInd->tlCallback))
-            (pTlRssiInd->pAdapter, pTlRssiInd->rssiNotification, pTlRssiInd->pUserCtxt);
-        }
-        else
-        {
-            smsLog( pMac, LOGE, FL("pTlRssiInd->tlCallback is NULL\n"));                
-        }
-    }
-    else
-    {
-        smsLog( pMac, LOGE, FL("pTlRssiInd is NULL\n"));    
-    }
-    return;
-}
 
 void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg )
 {
@@ -7969,6 +8059,7 @@
     tCsrRoamSession *pSession = NULL;
     tpSirSmeSwitchChannelInd pSwitchChnInd;
     tSmeMaxAssocInd *pSmeMaxAssocInd;
+
 #if defined ANI_PRODUCT_TYPE_AP
     pSirMsg->messageType = pal_be16_to_cpu(pSirMsg->messageType);
     pSirMsg->length = pal_be16_to_cpu(pSirMsg->length);
@@ -7978,7 +8069,9 @@
     pSirMsg->length = (pSirMsg->length);
     pSirMsg->statusCode = (pSirMsg->statusCode);
 #endif
+
     palZeroMemory(pMac->hHdd, &roamInfo, sizeof(roamInfo));
+
     switch( pSirMsg->messageType ) 
     {
         case eWNI_SME_ASSOC_IND:
@@ -7991,12 +8084,6 @@
                 {
                     pSession = CSR_GET_SESSION(pMac, sessionId);
 
-                    if(!pSession)
-                    {
-                        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                        return;
-                    }
-
                 pRoamInfo = &roamInfo;
 
                 // Required for indicating the frames to upper layer
@@ -8014,6 +8101,7 @@
                 
                 pRoamInfo->addIELen = (tANI_U8)pAssocInd->addIE.length;
                 pRoamInfo->paddIE =  pAssocInd->addIE.addIEdata;
+
                     palCopyMemory(pMac->hHdd, pRoamInfo->peerMac, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
                     palCopyMemory(pMac->hHdd, &pRoamInfo->bssid, pAssocInd->bssId, sizeof(tCsrBssid));
 #ifdef WLAN_SOFTAP_FEATURE
@@ -8046,6 +8134,7 @@
                     
                     /* send a message to CSR itself just to avoid the EAPOL frames going
                      * OTA before association response */
+
                     if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile))
                 {
                     status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId);
@@ -8061,8 +8150,10 @@
                 }
             }
             break;
+
         case eWNI_SME_DISASSOC_IND:
             smsLog( pMac, LOGE, FL("DISASSOCIATION Indication from MAC\n"));
+
             // Check if AP dis-associated us because of MIC failure. If so,
             // then we need to take action immediately and not wait till the
             // the WmStatusChange requests is pushed and processed
@@ -8086,24 +8177,13 @@
                     csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac);
                 }
 #endif
-#ifdef FEATURE_WLAN_LFR
-                if (csrRoamIsFastRoamEnabled(pMac) && (csrNeighborRoamStatePreauthDone(pMac)))
-                {
-                    csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac);
-                }
-#endif
                 pSession = CSR_GET_SESSION( pMac, sessionId );
 
-                if(!pSession)
-                {
-                    smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                    return;
-                }
-
                 if ( csrIsConnStateInfra( pMac, sessionId ) )
                 {
                     pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
                 }
+
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
                 sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL);
 #endif
@@ -8128,6 +8208,7 @@
 #endif                
             }
             break;
+
         case eWNI_SME_DEAUTH_IND:
             smsLog( pMac, LOG1, FL("DEAUTHENTICATION Indication from MAC\n"));
             pDeauthInd = (tpSirSmeDeauthInd)pSirMsg;
@@ -8150,24 +8231,13 @@
                     csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac);
                 }
 #endif
-#ifdef FEATURE_WLAN_LFR
-                if (csrRoamIsFastRoamEnabled(pMac) && (csrNeighborRoamStatePreauthDone(pMac)))
-                {
-                    csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac);
-                }
-#endif
                 pSession = CSR_GET_SESSION( pMac, sessionId );
 
-                if(!pSession)
-                {
-                    smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                    return;
-                }
-
                 if ( csrIsConnStateInfra( pMac, sessionId ) )
                 {
                     pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED;
                 }
+
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
                 sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL);
 #endif
@@ -8202,11 +8272,6 @@
             if( HAL_STATUS_SUCCESS( status ) )
             {
                 pSession = CSR_GET_SESSION( pMac, sessionId );
-                if(!pSession)
-                {
-                    smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                    return;
-                }
                 pSession->connectedProfile.operationChannel = (tANI_U8)pSwitchChnInd->newChannelId;
                 if(pSession->pConnectBssDesc)
                 {
@@ -8224,11 +8289,7 @@
                 if( CSR_IS_SESSION_VALID(pMac, sessionId) )
                 {                    
                     pSession = CSR_GET_SESSION(pMac, sessionId);
-                    if(!pSession)
-                    {
-                        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                        return;
-                    }
+
                     if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) )
                     {
                         pRoamInfo = &roamInfo;
@@ -8252,11 +8313,7 @@
                 if( CSR_IS_SESSION_VALID(pMac, sessionId) )
                 {                    
                     pSession = CSR_GET_SESSION(pMac, sessionId);
-                    if(!pSession)
-                    {
-                        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                        return;
-                    }
+
                     if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) )
                     {
                         pRoamInfo = &roamInfo;
@@ -8270,19 +8327,16 @@
             }
 #endif
             break;
+
         case eWNI_SME_MIC_FAILURE_IND:
             {
                 tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd)pSirMsg;
                 tCsrRoamInfo roamInfo, *pRoamInfo = NULL;
                 eCsrRoamResult result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST;
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
                 {
                     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-                    if(!pSession)
-                    {
-                        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                        return;
-                    }
                     WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type);
                     palZeroMemory(pMac->hHdd, &secEvent, sizeof(vos_event_wlan_security_payload_type));
                     secEvent.eventId = WLAN_SECURITY_EVENT_MIC_ERROR;
@@ -8296,6 +8350,7 @@
                     WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY);
                 }
 #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR
+
                 status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pMicInd->bssId, &sessionId );
                 if( HAL_STATUS_SUCCESS( status ) )
                 {
@@ -8314,11 +8369,13 @@
                 }
             }
             break;
+
 #ifdef WLAN_SOFTAP_FEATURE
         case eWNI_SME_WPS_PBC_PROBE_REQ_IND:
             {
                 tpSirSmeProbeReqInd pProbeReqInd = (tpSirSmeProbeReqInd)pSirMsg;
                 tCsrRoamInfo roamInfo;
+
                 smsLog( pMac, LOG1, FL("WPS PBC Probe request Indication from SME\n"));
            
                 status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pProbeReqInd->bssId, &sessionId );
@@ -8333,6 +8390,7 @@
             break;        
 #endif
             
+
         case eWNI_SME_WM_STATUS_CHANGE_NTF:
             pStatusChangeMsg = (tSirSmeWmStatusChangeNtf *)pSirMsg;
             switch( pStatusChangeMsg->statusChangeCode ) 
@@ -8342,11 +8400,6 @@
                     if( CSR_SESSION_ID_INVALID != sessionId )
                     {
                         pSession = CSR_GET_SESSION( pMac, sessionId );
-                        if(!pSession)
-                        {
-                            smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                            return;
-                        }
                         pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED;
                         if(pSession->pConnectBssDesc)
                         {
@@ -8362,37 +8415,31 @@
                         roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE;
                     }
                     break;
+
                 case eSIR_SME_IBSS_INACTIVE:
                     sessionId = csrFindIbssSession( pMac );
                     if( CSR_SESSION_ID_INVALID != sessionId )
                     {
                         pSession = CSR_GET_SESSION( pMac, sessionId );
-                        if(!pSession)
-                        {
-                            smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                            return;
-                        }
                         pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED;
                         result = eCSR_ROAM_RESULT_IBSS_INACTIVE;
                         roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE;
                     }
                     break;
+
                 case eSIR_SME_JOINED_NEW_BSS:    // IBSS coalescing.
                     sessionId = csrFindIbssSession( pMac );
                     if( CSR_SESSION_ID_INVALID != sessionId )
                     {
                         pSession = CSR_GET_SESSION( pMac, sessionId );
-                        if(!pSession)
-                        {
-                            smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                            return;
-                        }
                         // update the connection state information
                         pNewBss = &pStatusChangeMsg->statusChangeInfo.newBssInfo;
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
                         {
                             vos_log_ibss_pkt_type *pIbssLog;
                             tANI_U32 bi;
+
                             WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
                             if(pIbssLog)
                             {
@@ -8415,6 +8462,7 @@
                             }
                         }
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
                         csrRoamUpdateConnectedProfileFromNewBss( pMac, sessionId, pNewBss );
                         csrRoamIssueSetContextReq( pMac, sessionId, pSession->connectedProfile.EncryptionType, 
                                                     pSession->pConnectBssDesc,
@@ -8440,6 +8488,7 @@
                     }
                     smsLog(pMac, LOGW, "CSR:  eSIR_SME_JOINED_NEW_BSS received from PE\n");
                     break;
+
                 // detection by LIM that the capabilities of the associated AP have changed.
                 case eSIR_SME_AP_CAPS_CHANGED:
                     pApNewCaps = &pStatusChangeMsg->statusChangeInfo.apNewCaps;
@@ -8457,17 +8506,21 @@
                     roamStatus = eCSR_ROAM_FAILED;
                     result = eCSR_ROAM_RESULT_NONE;
                     break;
+
             }  // end switch on statusChangeCode
             if(eCSR_ROAM_RESULT_NONE != result)
             {
                 csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, roamStatus, result);
             }
             break;
+
         case eWNI_SME_IBSS_NEW_PEER_IND:
             pIbssPeerInd = (tSmeIbssPeerInd *)pSirMsg;
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
             {
                 vos_log_ibss_pkt_type *pIbssLog;
+
                 WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
                 if(pIbssLog)
                 {
@@ -8477,16 +8530,11 @@
                 }
             }
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
             sessionId = csrFindIbssSession( pMac );
             if( CSR_SESSION_ID_INVALID != sessionId )
             {
                 pSession = CSR_GET_SESSION( pMac, sessionId );
-
-                if(!pSession)
-                {
-                    smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                    return;
-                }
             // Issue the set Context request to LIM to establish the Unicast STA context for the new peer...
                 if(pSession->pConnectBssDesc)
                 {
@@ -8561,11 +8609,13 @@
                 }
             }
             break;
+
         case eWNI_SME_IBSS_PEER_DEPARTED_IND:
             pIbssPeerInd = (tSmeIbssPeerInd*)pSirMsg;
             sessionId = csrFindIbssSession( pMac );
             if( CSR_SESSION_ID_INVALID != sessionId )
             {
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
                 {
                     vos_log_ibss_pkt_type *pIbssLog;
@@ -8582,6 +8632,7 @@
                     }
                 }
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
                 smsLog(pMac, LOGW, "CSR: Peer departed notification from LIM\n");
                 roamInfo.staId = (tANI_U8)pIbssPeerInd->staId;
                 roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig;
@@ -8591,6 +8642,7 @@
                         eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED);
             }
             break;
+
         case eWNI_SME_SETCONTEXT_RSP:
             {
                 tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *)pSirMsg;
@@ -8605,12 +8657,6 @@
                     {                
                         sessionId = pCommand->sessionId;        
                         pSession = CSR_GET_SESSION( pMac, sessionId );
-
-                        if(!pSession)
-                        {
-                            smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                            return;
-                        }
        
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
                         if(eCSR_ENCRYPT_TYPE_NONE != pSession->connectedProfile.EncryptionType)
@@ -8655,17 +8701,17 @@
                         if( eSIR_SME_SUCCESS == pRsp->statusCode )
                         {
                             palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) );
-                                //Make sure we install the GTK before indicating to HDD as authenticated
-                                //This is to prevent broadcast packets go out after PTK and before GTK.
-                                if( palEqualMemory( pMac->hHdd, &Broadcastaddr, pRsp->peerMacAddr, 
-                                           sizeof(tSirMacAddr) ) )
-                                {
-                                    result = eCSR_ROAM_RESULT_AUTHENTICATED;
-                                }
-                                else
-                                {
-                                    result = eCSR_ROAM_RESULT_NONE;
-                                }
+                            //Make sure we install the GTK before indicating to HDD as authenticated
+                            //This is to prevent broadcast packets go out after PTK and before GTK.
+                            if( palEqualMemory( pMac->hHdd, &Broadcastaddr, pRsp->peerMacAddr, 
+                                        sizeof(tSirMacAddr) ) )
+                            {
+                                result = eCSR_ROAM_RESULT_AUTHENTICATED;
+                            }
+                            else
+                            {
+                            result = eCSR_ROAM_RESULT_NONE;
+                            }
                             pRoamInfo = &roamInfo;
                         }
                         else
@@ -8677,9 +8723,11 @@
                         }
                         csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, 
                                             eCSR_ROAM_SET_KEY_COMPLETE, result);
+
                         // Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS
                         // can go ahead and initiate the TSPEC if any are pending
                         sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_SET_KEY_SUCCESS_IND, NULL);
+
 #ifdef FEATURE_WLAN_CCX
                         //Send Adjacent AP repot to new AP.
                         if (result == eCSR_ROAM_RESULT_AUTHENTICATED &&
@@ -8692,6 +8740,7 @@
                             pSession->isPrevApInfoValid = FALSE;
                         }
 #endif
+
                         if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) )
                         {
                             csrReleaseCommandSetKey( pMac, pCommand );
@@ -8706,9 +8755,11 @@
                 {
                     smsLog( pMac, LOGE, "CSR: SetKey Completion called but NO commands are ACTIVE ...\n" );
                 }
+
                 smeProcessPendingQueue( pMac );
             }
             break;
+
         case eWNI_SME_REMOVEKEY_RSP:
             {
                 tSirSmeRemoveKeyRsp *pRsp = (tSirSmeRemoveKeyRsp *)pSirMsg;
@@ -8724,11 +8775,6 @@
                         sessionId = pCommand->sessionId;
                         pSession = CSR_GET_SESSION( pMac, sessionId );
 
-                        if(!pSession)
-                        {
-                            smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-                            return;
-                        }
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
                         {
                             WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type);
@@ -8748,6 +8794,7 @@
                             WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY);
                         }
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
                         if( eSIR_SME_SUCCESS == pRsp->statusCode )
                         {
                             palCopyMemory( pMac, &roamInfo.peerMac, &pRsp->peerMacAddr, sizeof(tCsrBssid) );
@@ -8774,23 +8821,28 @@
                 {
                     smsLog( pMac, LOGW, "CSR: SetKey Completion called but NO commands are ACTIVE ...\n" );
                 }
+
                 smeProcessPendingQueue( pMac );
             }
             break;
+
         case eWNI_SME_GET_STATISTICS_RSP:
-            smsLog( pMac, LOG2, FL("Stats rsp from PE\n"));
+            smsLog( pMac, LOGW, FL("Stats rsp from PE\n"));
             csrRoamStatsRspProcessor( pMac, pSirMsg );
             break;
+
         case eWNI_SME_GET_RSSI_REQ:
-            smsLog( pMac, LOG2, FL("GetRssiReq from self\n"));
+            smsLog( pMac, LOGW, FL("GetRssiReq from self\n"));
             csrUpdateRssi( pMac, pSirMsg );
             break;
 
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
         case eWNI_SME_FT_PRE_AUTH_RSP:
             csrRoamFTPreAuthRspProcessor( pMac, (tpSirFTPreAuthRsp)pSirMsg );
             break;
 #endif
+
         case eWNI_SME_MAX_ASSOC_EXCEEDED:
             pSmeMaxAssocInd = (tSmeMaxAssocInd*)pSirMsg;
             smsLog( pMac, LOG1, FL("send indication that max assoc have been reached and the new peer cannot be accepted\n"));          
@@ -8805,16 +8857,15 @@
             smsLog( pMac, LOG1, FL("Establish logical link req from HCI serialized through MC thread\n"));
             btampEstablishLogLinkHdlr( pSirMsg );
             break;
-        case eWNI_SME_RSSI_IND:
-            smsLog( pMac, LOG1, FL("RSSI indication from TL serialized through MC thread\n"));
-            csrRoamRssiIndHdlr( pMac, pSirMsg );
-        break;
 
         default:
             break;
+
     }  // end switch on message type
+
 }
 
+
 void csrCallRoamingCompletionCallback(tpAniSirGlobal pMac, tCsrRoamSession *pSession, 
                                       tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, eCsrRoamResult roamResult)
 {
@@ -8841,14 +8892,17 @@
 eHalStatus csrRoamStartRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamingReason roamingReason)
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
+
     if(CSR_IS_LOSTLINK_ROAMING(roamingReason) && 
         (eANI_BOOLEAN_FALSE == pMac->roam.roamSession[sessionId].fCancelRoaming))
     {
         status = csrScanRequestLostLink1( pMac, sessionId );
     }
+
     return(status);
 }
 
+
 //return a boolean to indicate whether roaming completed or continue.
 tANI_BOOLEAN csrRoamCompleteRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, 
                                     tANI_BOOLEAN fForce, eCsrRoamResult roamResult)
@@ -8857,6 +8911,7 @@
     tANI_TIMESTAMP roamTime = (tANI_TIMESTAMP)(pMac->roam.configParam.nRoamingTime * PAL_TICKS_PER_SECOND);
     tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
     //Check whether time is up
     if(pSession->fCancelRoaming || fForce || 
        ((curTime - pSession->roamingStartTime) > roamTime) ||
@@ -8903,19 +8958,15 @@
             fCompleted = eANI_BOOLEAN_FALSE;
         }
     }
+
     return(fCompleted);
 }
 
+
 void csrRoamCancelRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return;
-    }
-    
     if(CSR_IS_ROAMING(pSession))
     {
         smsLog(pMac, LOGW, "   Cancelling roaming\n");
@@ -8937,18 +8988,13 @@
     }
 }
 
+
 void csrRoamRoamingTimerHandler(void *pv)
 {
     tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
     tpAniSirGlobal pMac = pInfo->pMac;
     tANI_U32 sessionId = pInfo->sessionId;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return;
-    }
     
     if(eANI_BOOLEAN_FALSE == pSession->fCancelRoaming) 
     {
@@ -8960,16 +9006,11 @@
     }
 }
 
+
 eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval)
 {
     eHalStatus status;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
     
     smsLog(pMac, LOG1, " csrScanStartRoamingTimer \n ");
     pSession->roamingTimerInfo.sessionId = (tANI_U8)sessionId;
@@ -8978,15 +9019,18 @@
     return (status);
 }
 
+
 eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerRoaming));
 }
 
+
 void csrRoamWaitForKeyTimeOutHandler(void *pv)
 {
     tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
     tpAniSirGlobal pMac = pInfo->pMac;
+
     if( CSR_IS_WAIT_FOR_KEY( pMac, pInfo->sessionId ) )
     {
         smsLog(pMac, LOGW, " SME pre-auth state timeout. \n ");
@@ -8996,6 +9040,7 @@
     
 }
 
+
 eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval)
 {
     eHalStatus status;
@@ -9006,11 +9051,13 @@
     return (status);
 }
 
+
 eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac)
 {
     return (palTimerStop(pMac->hHdd, pMac->roam.hTimerWaitForKey));
 }
 
+
 void csrRoamIbssJoinTimerHandler(void *pv)
 {
     tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
@@ -9018,29 +9065,19 @@
     eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE;
     tANI_U32 sessionId = pInfo->sessionId;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return;
-    }
     
     pSession->ibss_join_pending = FALSE;
     // JEZ100225:  As of main/latest "tip", we are no longer doing this. Check on this.
     //csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED);
     // Send an IBSS stop request to PE
     csrRoamDisconnectInternal(pMac, sessionId, reason);
+
 }
+
 eHalStatus csrRoamStartIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval)
 {
     eHalStatus status;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
     
     smsLog(pMac, LOG1, " csrRoamStartIbssJoinTimer \n ");
     pSession->ibssJoinTimerInfo.sessionId = (tANI_U8)sessionId;
@@ -9048,10 +9085,12 @@
     
     return (status);
 }
+
 eHalStatus csrRoamStopIbssJoinTimer(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     return (palTimerStop(pMac->hHdd, pMac->roam.roamSession[sessionId].hTimerIbssJoining));
 }
+
 void csrRoamCompletion(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, 
                         eCsrRoamResult roamResult, tANI_BOOLEAN fSuccess)
 {
@@ -9065,6 +9104,7 @@
         VOS_ASSERT( sessionId == pCommand->sessionId );
 #endif
     }
+
     if(eCSR_ROAM_ROAMING_COMPLETION == roamStatus)
     {
         //if success, force roaming completion
@@ -9078,6 +9118,7 @@
     }
 }
 
+
 eHalStatus csrRoamLostLink( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 type, tSirSmeRsp *pSirMsg)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -9089,26 +9130,24 @@
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     //Only need to roam for infra station. In this case P2P client will roam as well
     tANI_BOOLEAN fToRoam = CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile);
+
     pSession->fCancelRoaming = eANI_BOOLEAN_FALSE;
     if ( eWNI_SME_DISASSOC_IND == type )
     {
         result = eCSR_ROAM_RESULT_DISASSOC_IND;
         pDisassocIndMsg = (tSirSmeDisassocInd *)pSirMsg;
         pSession->roamingStatusCode = pDisassocIndMsg->statusCode;
-        pSession->joinFailStatusCode.reasonCode = pDisassocIndMsg->reasonCode;
     }
     else if ( eWNI_SME_DEAUTH_IND == type )
     {
         result = eCSR_ROAM_RESULT_DEAUTH_IND;
         pDeauthIndMsg = (tSirSmeDeauthInd *)pSirMsg;
         pSession->roamingStatusCode = pDeauthIndMsg->statusCode;
-        pSession->joinFailStatusCode.reasonCode = pDeauthIndMsg->reasonCode;
     }
     else
     {
         smsLog(pMac, LOGW, FL("gets an unknown type (%d)\n"), type);
         result = eCSR_ROAM_RESULT_NONE;
-        pSession->joinFailStatusCode.reasonCode = 1;
     }
     
     // call profile lost link routine here
@@ -9127,6 +9166,7 @@
     {
         status = csrSendMBDeauthCnfMsg(pMac, pDeauthIndMsg);
     }
+
     if(!HAL_STATUS_SUCCESS(status))
     {
        //If fail to send confirmation to PE, not to trigger roaming
@@ -9140,22 +9180,21 @@
 #ifdef WLAN_SOFTAP_FEATURE
     if( eWNI_SME_DISASSOC_IND == type)
     {
-            //staMacAddr
-            palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, sizeof(tSirMacAddr));
-            roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId;
-        }
+        //staMacAddr
+        palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, sizeof(tSirMacAddr));
+        roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId;
+    }
     else if( eWNI_SME_DEAUTH_IND == type )
     {
-            //staMacAddr
-            palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, sizeof(tSirMacAddr));
-            roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId;
-        }
+        //staMacAddr
+        palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, sizeof(tSirMacAddr));
+        roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId;
+    }
 #endif
     smsLog(pMac, LOGW, FL("roamInfo.staId (%d)\n"), roamInfo.staId);
+    csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result);
     if(fToRoam)
     {
-        //Tell HDD about the lost link
-        csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result);
         //Only remove the connected BSS in infrastructure mode
         csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile);
         //Not to do anying for lostlink with WDS
@@ -9177,7 +9216,7 @@
                 {
                    roamInfo.reasonCode = eCsrRoamReasonSmeIssuedForLostLink;
                 }
-                    pRoamInfo = &roamInfo;
+                pRoamInfo = &roamInfo;
                 pSession->roamingReason = ( eWNI_SME_DEAUTH_IND == type ) ? 
                         eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc;
                 pSession->roamingStartTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
@@ -9195,6 +9234,7 @@
             fToRoam = eANI_BOOLEAN_FALSE;
         }
     }
+
     if(!fToRoam)
     {
        if( eWNI_SME_DISASSOC_IND == type)
@@ -9209,7 +9249,6 @@
             palCopyMemory(pMac->hHdd, roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, sizeof(tSirMacAddr));
             roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId;
         }
-        //Tell HDD about the lost link
         csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result);
        
         /*No need to start idle scan in case of IBSS/SAP 
@@ -9223,20 +9262,15 @@
     return (status);
 }
 
+
 eHalStatus csrRoamLostLinkAfterhandoffFailure( tpAniSirGlobal pMac,tANI_U32 sessionId)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tListElem *pEntry = NULL;
     tSmeCmd *pCommand = NULL;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     pSession->fCancelRoaming =  eANI_BOOLEAN_FALSE;
+
     //Only remove the connected BSS in infrastructure mode
     csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile);
     if(pMac->roam.configParam.nRoamingTime)
@@ -9260,6 +9294,7 @@
                  }
              }
           }
+
           smsLog( pMac, LOGW, "Lost link roaming started ...\n");
        }
     }
@@ -9271,10 +9306,12 @@
     
     return (status);
 }
+
 void csrRoamWmStatusChangeComplete( tpAniSirGlobal pMac )
 {
     tListElem *pEntry;
     tSmeCmd *pCommand;
+
     pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
     if ( pEntry )
     {
@@ -9302,31 +9339,29 @@
     {
         smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but NO commands are ACTIVE ...\n" );
     }
+
     smeProcessPendingQueue( pMac );
 }
 
+
 void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
     tSirSmeRsp *pSirSmeMsg;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pCommand->sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), pCommand->sessionId);
-        return;
-    }
-    
     switch ( pCommand->u.wmStatusChangeCmd.Type )
     {
         case eCsrDisassociated:
             pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg;
             status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DISASSOC_IND, pSirSmeMsg);
             break;
+
         case eCsrDeauthenticated:
             pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg;
             status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DEAUTH_IND, pSirSmeMsg);
             break;
+
         default:
             smsLog(pMac, LOGW, FL("gets an unknown command %d\n"), pCommand->u.wmStatusChangeCmd.Type);
             break;
@@ -9340,11 +9375,13 @@
             smsLog(pMac, LOGE, FL("  failed to issue stopBSS command\n"));
         }
     }
+
     // Lost Link just triggers a roaming sequence.  We can complte the Lost Link
     // command here since there is nothing else to do.
     csrRoamWmStatusChangeComplete( pMac );
 }
 
+
 //This function returns band and mode information.
 //The only tricky part is that if phyMode is set to 11abg, this function may return eCSR_CFG_DOT11_MODE_11B
 //instead of eCSR_CFG_DOT11_MODE_11G if everything is set to auto-pick.
@@ -9356,6 +9393,7 @@
                                                      tANI_U8 operationChn, eCsrBand *pBand )
 #endif
 {
+
 #ifdef WLAN_SOFTAP_FEATURE
     eCsrPhyMode phyModeIn = (eCsrPhyMode)pProfile->phyMode;
     eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pProfile, phyModeIn, 
@@ -9376,6 +9414,7 @@
     if( (eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) ||
         (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode) ||
         (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) )
+
 #endif
     {
         switch( pMac->roam.configParam.uCfgDot11Mode )
@@ -9476,23 +9515,21 @@
      smsLog(pMac, LOGE, FL("  Switching to Dot11B mode \n"));
      cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
    }
+
     return( cfgDot11Mode );
 }
 
+
 eHalStatus csrRoamIssueStopBss( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate )
 {
     eHalStatus status;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
     
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
     {
         vos_log_ibss_pkt_type *pIbssLog;
+
         WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
         if(pIbssLog)
         {
@@ -9501,6 +9538,7 @@
         }
     }
 #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR
+
     pSession->ibss_join_pending = FALSE;
     csrRoamStopIbssJoinTimer(pMac, sessionId );
     // Set the roaming substate to 'stop Bss request'...
@@ -9512,6 +9550,7 @@
     return (status);
 }
 
+
 //pNumChan is a caller allocated space with the sizeof pChannels
 eHalStatus csrGetCfgValidChannels(tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U32 *pNumChan)
 {
@@ -9521,6 +9560,7 @@
                   pNumChan));
 }
 
+
 tANI_BOOLEAN csrRoamIsChannelValid( tpAniSirGlobal pMac, tANI_U8 channel )
 {
     tANI_BOOLEAN fValid = FALSE;
@@ -9542,10 +9582,12 @@
     return fValid;
 }
 
+
 tANI_BOOLEAN csrRoamIsValid40MhzChannel(tpAniSirGlobal pMac, tANI_U8 channel)
 {
     tANI_BOOLEAN fValid = eANI_BOOLEAN_FALSE;
     tANI_U8 i;
+
     for(i = 0; i < pMac->scan.base40MHzChannels.numChannels; i++)
     {
         if(channel == pMac->scan.base40MHzChannels.channelList[i])
@@ -9554,15 +9596,18 @@
             break;
         }
     }
+
     return (fValid);
 }
 
+
 //This function check and validate whether the NIC can do CB (40MHz)
- static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes)
+static tAniCBSecondaryMode csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes)
 {
-    ePhyChanBondState eRet = PHY_SINGLE_CHANNEL_CENTERED;
+    tAniCBSecondaryMode eRet = eANI_CB_SECONDARY_NONE;
     tANI_U8 centerChn;
     tANI_U32 ChannelBondingMode;
+
     if(CSR_IS_CHANNEL_24GHZ(primaryChn))
     {
         ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz;
@@ -9578,44 +9623,39 @@
         {
             if(pIes->HTInfo.present)
             {
-                /* This is called during INFRA STA/CLIENT and should use the merged value of 
-                 * supported channel width and recommended tx width as per standard
-                 */
-                smsLog(pMac, LOG1, "scws %u rtws %u sco %u\n",
-                    pIes->HTCaps.supportedChannelWidthSet,
-                    pIes->HTInfo.recommendedTxWidthSet,
-                    pIes->HTInfo.secondaryChannelOffset);
-
-                if (pIes->HTInfo.recommendedTxWidthSet == eHT_CHANNEL_WIDTH_40MHZ)
-                    eRet = (ePhyChanBondState)pIes->HTInfo.secondaryChannelOffset;
-                else
-                    eRet = PHY_SINGLE_CHANNEL_CENTERED;
-                switch (eRet) {
-                    case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
-                        centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET;
-                        break;
-                    case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
-                        centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET;
-                        break;
-                    case PHY_SINGLE_CHANNEL_CENTERED:
-                    default:
-                        centerChn = primaryChn;
-                        break;
-                }
-                if((PHY_SINGLE_CHANNEL_CENTERED != eRet) && !csrRoamIsValid40MhzChannel(pMac, centerChn))
+                if(PHY_DOUBLE_CHANNEL_LOW_PRIMARY == pIes->HTInfo.secondaryChannelOffset)
                 {
-                    smsLog(pMac, LOGE, "  Invalid center channel (%d), disable 40MHz mode\n", centerChn);
-                    //eRet = PHY_SINGLE_CHANNEL_CENTERED;
+                    eRet = eANI_CB_SECONDARY_UP;
+                    centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET;
+                }
+                else if(PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == pIes->HTInfo.secondaryChannelOffset)
+                {
+                    eRet = eANI_CB_SECONDARY_DOWN;
+                    centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET;
+                }
+                else
+                {
+                    //PHY_SINGLE_CHANNEL_CENTERED
+                    centerChn = primaryChn;
+                    eRet = eANI_CB_SECONDARY_NONE;
+                }
+                if((eANI_CB_SECONDARY_NONE != eRet) && !csrRoamIsValid40MhzChannel(pMac, centerChn))
+                {
+                    smsLog(pMac, LOGW, "  Invalid center channel (%d), disable 40MHz mode\n", centerChn);
+                    eRet = eANI_CB_SECONDARY_NONE;
                 }
             }
         }
     }
+
     return eRet;
 }
+
 tANI_BOOLEAN csrIsEncryptionInList( tpAniSirGlobal pMac, tCsrEncryptionList *pCipherList, eCsrEncryptionType encryptionType )
 {
     tANI_BOOLEAN fFound = FALSE;
     tANI_U32 idx;
+
     for( idx = 0; idx < pCipherList->numEntries; idx++ )
     {
         if( pCipherList->encryptionType[idx] == encryptionType )
@@ -9624,12 +9664,15 @@
             break;
         }
     }
+
     return fFound;
 }
+
 tANI_BOOLEAN csrIsAuthInList( tpAniSirGlobal pMac, tCsrAuthList *pAuthList, eCsrAuthType authType )
 {
     tANI_BOOLEAN fFound = FALSE;
     tANI_U32 idx;
+
     for( idx = 0; idx < pAuthList->numEntries; idx++ )
     {
         if( pAuthList->authType[idx] == authType )
@@ -9638,8 +9681,10 @@
             break;
         }
     }
+
     return fFound;
 }
+
 tANI_BOOLEAN csrIsSameProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1, tCsrRoamProfile *pProfile2)
 {
     tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE;
@@ -9700,10 +9745,12 @@
     return (fCheck);
 }
 
+
 tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2)
 {
     tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE;
     int i;
+
     do
     {
         //Only check for static WEP
@@ -9729,11 +9776,14 @@
             fCheck = eANI_BOOLEAN_TRUE;
         }
     }while(0);
+
     return (fCheck);
 }
 
+
 //IBSS
 
+
 tANI_U8 csrRoamGetIbssStartChannelNumber50( tpAniSirGlobal pMac )
 {
     tANI_U8 channel = 0;     
@@ -9763,6 +9813,7 @@
                 }
             }
         }
+
         // this is rare, but if it does happen, we find anyone in 11a bandwidth and return the first 11a channel found!
         if (!fFound)    
         {
@@ -9780,6 +9831,7 @@
     return( channel );    
 }
 
+
 tANI_U8 csrRoamGetIbssStartChannelNumber24( tpAniSirGlobal pMac )
 {
     tANI_U8 channel = 1;
@@ -9815,6 +9867,7 @@
     return( channel );    
 }
 
+
 static void csrRoamGetBssStartParms( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, 
                                       tCsrRoamStartBssParams *pParam )
 {
@@ -9848,17 +9901,21 @@
         VOS_ASSERT(0);
     }
 #endif
+
     switch( cfgDot11Mode )
     {
         case eCSR_CFG_DOT11_MODE_11G:
             nwType = eSIR_11G_NW_TYPE;
             break;
+
         case eCSR_CFG_DOT11_MODE_11B:
             nwType = eSIR_11B_NW_TYPE;
             break;   
+
         case eCSR_CFG_DOT11_MODE_11A:
             nwType = eSIR_11A_NW_TYPE;
             break;
+
         default:
         case eCSR_CFG_DOT11_MODE_11N:
         case eCSR_CFG_DOT11_MODE_TAURUS:
@@ -9924,6 +9981,7 @@
             pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK;
             pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK;
             pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK;
+
             if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) 
             {
                 channel = csrRoamGetIbssStartChannelNumber24( pMac );
@@ -9934,6 +9992,7 @@
             }
             
             break;     
+
         case eSIR_11G_NW_TYPE:
 #ifdef WLAN_FEATURE_P2P
             /* For P2P Client and P2P GO, disable 11b rates */ 
@@ -9956,12 +10015,14 @@
 #endif            
             {
             pParam->operationalRateSet.numRates = 4;
+
             pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK;
             pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK;
             pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK;
             pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK;
                
             pParam->extendedRateSet.numRates = 8;
+
                         pParam->extendedRateSet.rate[0] = SIR_MAC_RATE_6;
             pParam->extendedRateSet.rate[1] = SIR_MAC_RATE_9;
             pParam->extendedRateSet.rate[2] = SIR_MAC_RATE_12;
@@ -9987,6 +10048,7 @@
     pParam->sirNwType = nwType;
 }
 
+
 static void csrRoamGetBssStartParmsFromBssDesc( tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, 
                                                  tDot11fBeaconIEs *pIes, tCsrRoamStartBssParams *pParam )
 {
@@ -9994,7 +10056,7 @@
     if( pParam )
     {
         pParam->sirNwType = pBssDesc->nwType;
-        pParam->cbMode = PHY_SINGLE_CHANNEL_CENTERED;
+        pParam->cbMode = eANI_CB_SECONDARY_NONE;
         pParam->operationChn = pBssDesc->channelId;
         palCopyMemory( pMac->hHdd, &pParam->bssid, pBssDesc->bssId, sizeof(tCsrBssid) );
     
@@ -10018,6 +10080,7 @@
                 palCopyMemory(pMac->hHdd, pParam->ssId.ssId, pIes->SSID.ssid, pParam->ssId.length);
             }
             pParam->cbMode = csrGetCBModeFromIes(pMac, pParam->operationChn, pIes);
+
         }
         else
         {
@@ -10027,6 +10090,7 @@
     }
 }
 
+
 static void csrRoamDetermineMaxRateForAdHoc( tpAniSirGlobal pMac, tSirMacRateSet *pSirRateSet )
 {
     tANI_U8 MaxRate = 0;
@@ -10046,6 +10110,7 @@
     return;
 }
 
+
 //this function finds a valid secondary channel for channel bonding with "channel".
 //Param: channel -- primary channel, caller must validate it
 //       cbChoice -- CB directory
@@ -10053,6 +10118,7 @@
 static tANI_U8 csrRoamGetSecondaryChannel(tpAniSirGlobal pMac, tANI_U8 channel, eCsrCBChoice cbChoice)
 {
     tANI_U8 chnUp = 0, chnDown = 0, chnRet = 0;
+
     switch (cbChoice)
     {
     case eCSR_CB_OFF:
@@ -10074,6 +10140,7 @@
         chnDown = channel - CSR_CB_CHANNEL_GAP;
         break;
     }
+
     //if CB_UP or auto, try channel up first
     if(chnUp && CSR_IS_SAME_BAND_CHANNELS(chnUp, channel) && csrRoamIsChannelValid(pMac, chnUp))
     {
@@ -10092,21 +10159,26 @@
             chnRet = chnDown;
         }
     }
+
     return chnRet;
 }
 
+
 eHalStatus csrRoamIssueStartBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamStartBssParams *pParam, 
                                  tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc, tANI_U32 roamId )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     eCsrBand eBand;
+
     // Set the roaming substate to 'Start BSS attempt'...
     csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId );
+
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
     //Need to figure out whether we need to log WDS???
     if( CSR_IS_IBSS( pProfile ) )
     {
         vos_log_ibss_pkt_type *pIbssLog;
+
         WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C);
         if(pIbssLog)
         {
@@ -10138,6 +10210,7 @@
     pParam->nRSNIELength = (tANI_U16)pProfile->nRSNReqIELength;
     pParam->pRSNIE = pProfile->pRSNReqIE;
 
+
 #ifdef WLAN_SOFTAP_FEATURE
     pParam->privacy           = pProfile->privacy;
     pParam->fwdWPSPBCProbeReq = pProfile->fwdWPSPBCProbeReq;   
@@ -10153,12 +10226,14 @@
             pParam->operationChn = INFRA_AP_DEFAULT_CHANNEL;                   
         }  
     }
+
     pParam->protEnabled     = pProfile->protEnabled;
     pParam->obssProtEnabled = pProfile->obssProtEnabled;
     pParam->ht_protection   = pProfile->cfg_protection;
     pParam->wps_state       = pProfile->wps_state;
 #endif
     
+
 #ifdef WLAN_SOFTAP_FEATURE
     pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, pParam->operationChn /* pProfile->operationChannel*/, 
                                         &eBand);
@@ -10169,23 +10244,19 @@
     pParam->bssPersona = pProfile->csrPersona;
     // When starting an IBSS, start on the channel from the Profile.
     status = csrSendMBStartBssReqMsg( pMac, sessionId, pProfile->BSSType, pParam, pBssDesc );
+
     return (status);
 }
 
+
 static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
-                                     tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes)
+                                     tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes)
 {
     tANI_U8 Channel, SecondChn;
-    ePhyChanBondState cbMode = PHY_SINGLE_CHANNEL_CENTERED;
+    tAniCBSecondaryMode cbMode = eANI_CB_SECONDARY_NONE;
     eCsrCBChoice cbChoice;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return;
-    }
-    
     if( pBssDesc )
     {
         csrRoamGetBssStartParmsFromBssDesc( pMac, pBssDesc, pIes, &pSession->bssParams );
@@ -10200,6 +10271,7 @@
     else
     {
         csrRoamGetBssStartParms(pMac, pProfile, &pSession->bssParams);
+
         //Use the first SSID
         if(pProfile->SSIDs.numOfSSIDs)
         {
@@ -10221,6 +10293,7 @@
         }
     }
     Channel = pSession->bssParams.operationChn;
+
     //Set operating channel in pProfile which will be used 
     //in csrRoamSetBssConfigCfg() to determine channel bonding
     //mode and will be configured in CFG later 
@@ -10234,20 +10307,6 @@
     {
   
         csrRoamDetermineMaxRateForAdHoc( pMac, &pSession->bssParams.operationalRateSet );
-        if (CSR_IS_INFRA_AP(pProfile))
-        {
-            if(CSR_IS_CHANNEL_24GHZ(Channel))
-            {
-                cbMode = pMac->roam.configParam.channelBondingMode24GHz;
-            }
-            else
-            {
-                cbMode = pMac->roam.configParam.channelBondingMode5GHz;
-            }
-            smsLog(pMac, LOG1, "##softap cbMode %d\n", cbMode);
-            pBssConfig->cbMode = cbMode;
-            pSession->bssParams.cbMode = cbMode;
-        }
 
         if( CSR_IS_START_IBSS( pProfile ) )
         {
@@ -10272,6 +10331,7 @@
             }
             else {
                 tANI_U32 ChannelBondingMode;
+
                 if(CSR_IS_CHANNEL_24GHZ(Channel))
                 {
                     ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz;
@@ -10280,34 +10340,38 @@
                 {
                     ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz;
                 }
+
                 //now we have a valid channel
                 if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode)
                 {
                     //let's pick a secondard channel
                     SecondChn = csrRoamGetSecondaryChannel(pMac, Channel, cbChoice);
+
                     if(SecondChn > Channel)
                     {
-                        cbMode = PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
+                        cbMode = eANI_CB_SECONDARY_UP;
                     }
                     else if(SecondChn && SecondChn < Channel)
                     {
-                        cbMode = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
+                        cbMode =eANI_CB_SECONDARY_DOWN;
                     }
                     else
                     {
-                        cbMode = PHY_SINGLE_CHANNEL_CENTERED;
+                        cbMode = eANI_CB_SECONDARY_NONE;
                     }
                     pSession->bssParams.cbMode = cbMode;
                 }
                 else
                 {
-                    pSession->bssParams.cbMode = PHY_SINGLE_CHANNEL_CENTERED;
+                    pSession->bssParams.cbMode = eANI_CB_SECONDARY_NONE;
                 }
             }
         }
     }
 }
 
+
+
 static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, 
                                     tANI_BOOLEAN *pfSameIbss )
 {
@@ -10348,7 +10412,7 @@
                 //save dotMode
                 pMac->roam.roamSession[sessionId].bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode;
                 //Prepare some more parameters for this IBSS
-                csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, pBssConfig, NULL);
+                csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, NULL);
                 status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, pBssConfig, NULL);
             }
             
@@ -10363,17 +10427,12 @@
     return( status );
 }
 
+
 static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, 
                                                      tSirSmeNewBssInfo *pNewBss )
 {
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return;
-    }
-    
     if( pNewBss )
     {
         // Set the operating channel.
@@ -10382,15 +10441,18 @@
         palCopyMemory( pMac->hHdd, &pSession->connectedProfile.bssid, 
                       &(pNewBss->bssId), sizeof( tCsrBssid ) );    
     }
+
     return;
 }
 
+
 #ifdef FEATURE_WLAN_WAPI
 eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
                                  tANI_U32 numItems )
 {
    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
    tCsrRoamSession *pSession;
+
    if(!CSR_IS_SESSION_VALID( pMac, sessionId ))
    {
        smsLog(pMac, LOGE, FL("  Invalid session ID\n"));
@@ -10409,18 +10471,22 @@
                            sizeof(tBkidCacheInfo) * numItems );
        }
    }
+
    return (status);
 }
+
 eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum,
                                 tBkidCacheInfo *pBkidCache)
 {
    eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
    tCsrRoamSession *pSession;
+
    if(!CSR_IS_SESSION_VALID( pMac, sessionId ))
    {
        smsLog(pMac, LOGE, FL("  Invalid session ID\n"));
        return status;
    }
+
    pSession = CSR_GET_SESSION( pMac, sessionId );
    if(pNum && pBkidCache)
    {
@@ -10443,25 +10509,24 @@
            status = eHAL_STATUS_SUCCESS;
        }
    }
+
    return (status);
+
 }
+
 tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
    return (pMac->roam.roamSession[sessionId].NumBkidCache);
+
 }
 #endif /* FEATURE_WLAN_WAPI */
+
 eHalStatus csrRoamSetPMKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId,
                                  tPmkidCacheInfo *pPMKIDCache, tANI_U32 numItems )
 {
     eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-    
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
+
     smsLog(pMac, LOGW, "csrRoamSetPMKIDCache called, numItems = %d\n", numItems);
     if(numItems <= CSR_MAX_PMKID_ALLOWED)
     {
@@ -10480,6 +10545,7 @@
             WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY);
         }
 #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR
+
         status = eHAL_STATUS_SUCCESS;
         //numItems may be 0 to clear the cache
         pSession->NumPmkidCache = (tANI_U16)numItems;
@@ -10489,25 +10555,22 @@
                             sizeof(tPmkidCacheInfo) * numItems );
         }
     }
+
     return (status);
 }
 
+
 tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     return (pMac->roam.roamSession[sessionId].NumPmkidCache);
 }
 
+
 eHalStatus csrRoamGetPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache)
 {
     eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     if(pNum && pPmkidCache)
     {
         if(pSession->NumPmkidCache == 0)
@@ -10529,21 +10592,17 @@
             status = eHAL_STATUS_SUCCESS;
         }
     }
+
     return (status);
 }
 
+
 eHalStatus csrRoamGetWpaRsnReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf)
 {
     eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
     tANI_U32 len;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-    
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
+
     if(pLen)
     {
         len = *pLen;
@@ -10556,21 +10615,17 @@
             }
         }
     }
+
     return (status);
 }
 
+
 eHalStatus csrRoamGetWpaRsnRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf)
 {
     eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
     tANI_U32 len;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     if(pLen)
     {
         len = *pLen;
@@ -10583,21 +10638,16 @@
             }
         }
     }
+
     return (status);
 }
+
 #ifdef FEATURE_WLAN_WAPI
 eHalStatus csrRoamGetWapiReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf)
 {
     eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
     tANI_U32 len;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     if(pLen)
     {
         len = *pLen;
@@ -10610,20 +10660,16 @@
             }
         }
     }
+
     return (status);
 }
+
 eHalStatus csrRoamGetWapiRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf)
 {
     eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
     tANI_U32 len;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     if(pLen)
     {
         len = *pLen;
@@ -10636,28 +10682,26 @@
             }
         }
     }
+
     return (status);
 }
 #endif /* FEATURE_WLAN_WAPI */
+
 eRoamCmdStatus csrGetRoamCompleteStatus(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     eRoamCmdStatus retStatus = eCSR_ROAM_CONNECT_COMPLETION;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return (retStatus);
-    }
-    
     if(CSR_IS_ROAMING(pSession))
     {
         retStatus = eCSR_ROAM_ROAMING_COMPLETION;
         pSession->fRoaming = eANI_BOOLEAN_FALSE;
     }
+
     return (retStatus);
 }
 
+
 //This function remove the connected BSS from te cached scan result
 eHalStatus csrRoamRemoveConnectedBssFromScanCache(tpAniSirGlobal pMac,
                                                   tCsrRoamConnectedProfile *pConnProfile)
@@ -10668,6 +10712,7 @@
     tCsrScanResult *pResult;
         tDot11fBeaconIEs *pIes;
     tANI_BOOLEAN fMatch;
+
     if(!(csrIsMacAddressZero(pMac, &pConnProfile->bssid) ||
             csrIsMacAddressBroadcast(pMac, &pConnProfile->bssid)))
     {
@@ -10701,6 +10746,7 @@
             pScanFilter->bWPSAssociation = eANI_BOOLEAN_FALSE;
             pScanFilter->countryCode[0] = 0;
             pScanFilter->phyMode = eCSR_DOT11_MODE_TAURUS;
+
             csrLLLock(&pMac->scan.scanResultList);
             pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK );
             while( pEntry ) 
@@ -10738,11 +10784,15 @@
     return (status);
 }
 
+
+
 //BT-AMP
+
 eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tANI_U32 sessionId;
+
     for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
     {
         if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
@@ -10767,21 +10817,17 @@
             }
         }
     }
+
     return ( status );
 }
 
+
 static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     tBssConfigParam bssConfig;
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     if ( csrIsConnStateIbss( pMac, sessionId ) ) 
     { 
         status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING );
@@ -10817,8 +10863,9 @@
                 palZeroMemory(pMac->hHdd, pSession->pCurRoamProfile, sizeof(tCsrRoamProfile));
                 csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile);
             }
+
             //Prepare some more parameters for this WDS
-            csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, &bssConfig, NULL);
+            csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, NULL);
             status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, NULL, &bssConfig, NULL);
         }
     }
@@ -10826,8 +10873,10 @@
     return( status );
 }
 
+
 ////////////////////Mail box
 
+
 //pBuf is caller allocated memory point to &(tSirSmeJoinReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length;
 //or &(tSirSmeReassocReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length;
 static void csrPrepareJoinReassocReqBuffer( tpAniSirGlobal pMac, 
@@ -10840,13 +10889,16 @@
     tANI_BOOLEAN found = FALSE;
     tANI_U32 size = 0;
         tANI_U16 i;
+
     // plug in neighborhood occupancy info (i.e. BSSes on primary or secondary channels)
     *pBuf++ = (tANI_U8)FALSE;  //tAniTitanCBNeighborInfo->cbBssFoundPri
     *pBuf++ = (tANI_U8)FALSE;  //tAniTitanCBNeighborInfo->cbBssFoundSecDown
     *pBuf++ = (tANI_U8)FALSE;  //tAniTitanCBNeighborInfo->cbBssFoundSecUp
+
     // 802.11h
     //We can do this because it is in HOST CPU order for now.
     pAP_capabilityInfo = (tSirMacCapabilityInfo *)&pBssDescription->capabilityInfo;
+
         //tell the target AP my 11H capability only if both AP and STA support 11H and the channel being used is 11a
         if ( csrIs11hSupported( pMac ) && pAP_capabilityInfo->spectrumMgt && eSIR_11A_NW_TYPE == pBssDescription->nwType )   
         {  
@@ -10860,11 +10912,13 @@
     pBuf += sizeof(tAniBool);
     *pBuf++ = MIN_STA_PWR_CAP_DBM; // it is for pMsg->powerCap.minTxPower = 0;
         found = csrSearchChannelListForTxPower(pMac, pBssDescription, &channelGroup);
+
     // This is required for 11k test VoWiFi Ent: Test 2.
     // We need the power capabilities for Assoc Req. 
     // This macro is provided by the halPhyCfg.h. We pick our
     // max and min capability by the halPhy provided macros
     *pBuf++ = MAX_STA_PWR_CAP_DBM;
+
     size = sizeof(pMac->roam.validChannelList);
     if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &size)))
     { 
@@ -10880,6 +10934,7 @@
         smsLog(pMac, LOGE, FL("can not find any valid channel\n"));
         *pBuf++ = 0;  //tSirSupChnl->numChnl
     }                                                                                                                     
+
     //Check whether it is ok to enter UAPSD
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
     if( btcIsReadyForUapsd(pMac) )
@@ -10895,12 +10950,15 @@
     }
 #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
   
+
     // move the entire BssDescription into the join request.
     palCopyMemory( pMac->hHdd, pBuf, pBssDescription, 
                     pBssDescription->length + sizeof( pBssDescription->length ) );
+
     pBuf += pBssDescription->length + sizeof( pBssDescription->length );   // update to new location
 }
 
+
 /* 
   * The communication between HDD and LIM is thru mailbox (MB).
   * Both sides will access the data structure "tSirSmeJoinReq".
@@ -10922,12 +10980,6 @@
     tANI_U32 dwTmp;
     tANI_U8 wpaRsnIE[DOT11F_IE_RSN_MAX_LEN];    //RSN MAX is bigger than WPA MAX
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     do {
         pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS;
         pSession->joinFailStatusCode.reasonCode = 0;
@@ -10942,19 +10994,23 @@
         msgLen = sizeof( tSirSmeJoinReq ) - sizeof( *pBssDescription ) + 
             pBssDescription->length + sizeof( pBssDescription->length ) +
             sizeof( tCsrWpaIe ) + sizeof( tCsrWpaAuthIe ) + sizeof( tANI_U16 ); // add in the size of the WPA IE that we may build.
+
         status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
         if ( !HAL_STATUS_SUCCESS(status) ) break;
         palZeroMemory(pMac->hHdd, pMsg, msgLen);
         pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_JOIN_REQ);
         pMsg->length = pal_cpu_to_be16(msgLen);
         pBuf = &pMsg->sessionId;
+
         // sessionId
         *pBuf = (tANI_U8)sessionId;
         pBuf++;
+
         // transactionId
         *pBuf = 0;
         *( pBuf + 1 ) = 0;
         pBuf += sizeof(tANI_U16);
+
         // ssId
         if( pIes->SSID.present && pIes->SSID.num_ssid )
         {
@@ -10969,6 +11025,7 @@
             *pBuf = 0;
             pBuf++;
         }
+
         // selfMacAddr
         palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) );
         pBuf += sizeof(tSirMacAddr);
@@ -10980,24 +11037,23 @@
         // dot11mode
         *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode );
         pBuf++;
+
         //Persona
         *pBuf = (tANI_U8)pProfile->csrPersona;
         pBuf++;
-        //CBMode
-        *pBuf = (tANI_U8)pSession->bssParams.cbMode;
-        pBuf++;
 
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                  FL("CSR PERSONA=%d CSR CbMode %d"), pProfile->csrPersona, pSession->bssParams.cbMode);
-
+                  FL("CSR PERSONA=%d"), pProfile->csrPersona);
+        
         // uapsdPerAcBitmask
         *pBuf = pProfile->uapsd_mask;
         pBuf++;
 
-    
+
     
 #if (WNI_POLARIS_FW_PACKAGE == ADVANCED)        
 #endif /*(WNI_POLARIS_FW_PACKAGE == ADVANCED)*/
+
         status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet);
         if (HAL_STATUS_SUCCESS(status) ) 
         {
@@ -11019,6 +11075,7 @@
             *pBuf++ = 0;
             *pBuf++ = 0;
         }
+
         // rsnIE
         if ( csrIsProfileWpa( pProfile ) )
         {
@@ -11040,6 +11097,7 @@
                     (tCsrWapiIe *)( wpaRsnIE ) );
         }
 #endif /* FEATURE_WLAN_WAPI */
+
         else
         {
             ieLen = 0;
@@ -11117,6 +11175,7 @@
             *(pBuf + 1) = 0;
             pBuf += 2;
         }
+
 #ifdef FEATURE_WLAN_CCX
         // Never include the cckmIE in an Join Request
         //length is two bytes
@@ -11124,10 +11183,12 @@
         *(pBuf + 1) = 0;
         pBuf += 2;
 #endif 
+
         // addIEScan
         if(pProfile->nAddIEScanLength && pProfile->pAddIEScan)
         {
             ieLen = pProfile->nAddIEScanLength;
+
             if(ieLen > pSession->nAddIEScanLength)
             {
                 if(pSession->pAddIEScan && pSession->nAddIEScanLength)
@@ -11159,10 +11220,12 @@
             *(pBuf + 1) = 0;
             pBuf += 2;
         }
+
         // addIEAssoc
         if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc)
         {
             ieLen = pProfile->nAddIEAssocLength;
+
             if(ieLen > pSession->nAddIEAssocLength)
             {
                 if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength)
@@ -11194,12 +11257,15 @@
             *(pBuf + 1) = 0;
             pBuf += 2;
         }
+
         dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) );
         palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) );
         pBuf += sizeof(tANI_U32);        
+
         dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) );
         palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) );
         pBuf += sizeof(tANI_U32);        
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
         if (csrIsProfile11r( pProfile ) )
         {
@@ -11216,6 +11282,7 @@
             pBuf += sizeof(tAniBool);        
         }
 #endif
+
 #ifdef FEATURE_WLAN_CCX
         /* A profile can not be both CCX and 11R. But an 802.11R AP
          * may be advertising support for CCX as well. So if we are 
@@ -11223,15 +11290,7 @@
          * If we are associating explictly 11R only then we will get
          * 11R.
          */
-        if ((csrIsProfileCCX(pProfile) || 
-             ((pIes->CCXVersion.present) 
-              && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) 
-                  || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) 
-                  || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) 
-                  || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) 
-                  || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) 
-            && (!(csrIsProfile11r( pProfile ))) 
-            && (pMac->roam.configParam.isCcxIniFeatureEnabled))
+        if ((csrIsProfileCCX(pProfile) || ((pIes->CCXVersion.present) && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA)))) && (!(csrIsProfile11r( pProfile ))) && (pMac->roam.configParam.isCcxIniFeatureEnabled))
         {
             // isCCXconnection;
             dwTmp = pal_cpu_to_be32(TRUE); 
@@ -11254,13 +11313,10 @@
             pBuf += sizeof(tCCXTspecInfo);
         }
 #endif
-#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
         // Fill in isFastTransitionEnabled
-        if (pMac->roam.configParam.isFastTransitionEnabled
-#ifdef FEATURE_WLAN_LFR
-        || csrRoamIsFastRoamEnabled(pMac)
-#endif
-        )
+        if (pMac->roam.configParam.isFastTransitionEnabled)
         {
             dwTmp = pal_cpu_to_be32(TRUE); 
             palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
@@ -11273,24 +11329,11 @@
             pBuf += sizeof(tAniBool);        
         }
 #endif
-#ifdef FEATURE_WLAN_LFR
-        if(csrRoamIsFastRoamEnabled(pMac))
-        {
-            //legacy fast roaming enabled
-            dwTmp = pal_cpu_to_be32(TRUE); 
-            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
-            pBuf += sizeof(tAniBool);        
-        }
-        else
-        {
-            dwTmp = pal_cpu_to_be32(FALSE); 
-            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
-            pBuf += sizeof(tAniBool);        
-        }
-#endif
+
         //BssDesc
         csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, 
                 (tANI_U8)pProfile->uapsd_mask);
+
         status = palSendMBMessage(pMac->hHdd, pMsg );    
         if(!HAL_STATUS_SUCCESS(status)) 
         {
@@ -11307,6 +11350,7 @@
     return( status );
 }
 
+
 eHalStatus csrSendSmeReassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, 
                                     tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile )
 {
@@ -11321,18 +11365,13 @@
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     tANI_U8 wpaRsnIE[DOT11F_IE_RSN_MAX_LEN];    //RSN MAX is bigger than WPA MAX
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     /* To satisfy klockworks */
     if (pBssDescription == NULL)
     {
         smsLog(pMac, LOGE, FL(" pBssDescription is NULL\n"));
         return eHAL_STATUS_FAILURE;
     }
+
     do {
         // There are a number of variable length fields to consider.  First, the tSirSmeJoinReq
         // includes a single bssDescription.   bssDescription includes a single tANI_U32 for the 
@@ -11379,20 +11418,19 @@
         // dot11mode
         *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode );
         pBuf++;
+
         //Persona
         *pBuf = (tANI_U8)pProfile->csrPersona;
         pBuf++;
-        //CBMode
-        *pBuf = (tANI_U8)pSession->bssParams.cbMode;
-        pBuf++;
 
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-            FL("CSR PERSONA=%d CSR CBMode=%u\n"), pProfile->csrPersona, pSession->bssParams.cbMode);
-
+        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, FL("CSR PERSONA=%d\n"), pProfile->csrPersona);
+        
         // uapsdPerAcBitmask
         *pBuf = pProfile->uapsd_mask;
         pBuf++;
 
+
+
         status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, 
                         pBssDescription, pIes, &OpRateSet, &ExRateSet);
         if (HAL_STATUS_SUCCESS(status) ) 
@@ -11419,6 +11457,7 @@
             *pBuf++ = 0;
             *pBuf++ = 0;
         }
+
                 // rsnIE
         if ( csrIsProfileWpa( pProfile ) )
                 {
@@ -11452,6 +11491,7 @@
                  smsLog(pMac, LOGE, FL(" WPA RSN IE length :%d is more than DOT11F_IE_RSN_MAX_LEN, resetting to %d\n"), ieLen, DOT11F_IE_RSN_MAX_LEN);
                  ieLen = DOT11F_IE_RSN_MAX_LEN;
              }
+
             //Check whether we need to allocate more memory
             if(ieLen > pSession->nWpaRsnReqIeLength)
             {
@@ -11484,6 +11524,7 @@
             *(pBuf + 1) = 0;
             pBuf += 2;
                 }
+
 #ifdef FEATURE_WLAN_CCX
         // cckmIE
         if( csrIsProfileCCX( pProfile ) )
@@ -11520,10 +11561,12 @@
             pBuf += 2;
         }
 #endif /* FEATURE_WLAN_CCX */
+
         // addIEScan
         if(pProfile->nAddIEScanLength && pProfile->pAddIEScan)
         {
             ieLen = pProfile->nAddIEScanLength;
+
             if(ieLen > pSession->nAddIEScanLength)
             {
                 if(pSession->pAddIEScan && pSession->nAddIEScanLength)
@@ -11555,10 +11598,12 @@
             *(pBuf + 1) = 0;
             pBuf += 2;
         }
+
         // addIEAssoc
         if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc)
         {
             ieLen = pProfile->nAddIEAssocLength;
+
             if(ieLen > pSession->nAddIEAssocLength)
             {
                 if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength)
@@ -11590,6 +11635,7 @@
             *(pBuf + 1) = 0;
             pBuf += 2;
         }
+
         //Unmask any AC in reassoc that is ACM-set
         uapsd_mask = (v_U8_t)pProfile->uapsd_mask;
         if( uapsd_mask && ( NULL != pBssDescription ) )
@@ -11614,45 +11660,33 @@
         dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) );
         palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tANI_U32) );
         pBuf += sizeof(tANI_U32);        
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
         // is11Rconnection;
         dwTmp = csrIsProfile11r( pProfile )?  pal_cpu_to_be32(TRUE) : 0; 
         palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
         pBuf += sizeof(tAniBool);        
+
 #ifdef FEATURE_WLAN_CCX
         //isCCXconnection;
         //CCKM profile, ccxversion ie present, not 11r and ini file has CCX enabled
-        dwTmp = ( ((csrIsProfileCCX(pProfile) || 
-                  ((pIes->CCXVersion.present) 
-                   && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) 
-                       || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA)
-                       || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK)
-                       || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN)
-                       || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) 
-                 && (!(csrIsProfile11r( pProfile ))) 
-                 && (pMac->roam.configParam.isCcxIniFeatureEnabled)) 
-                ? pal_cpu_to_be32(TRUE) : 0);
+        dwTmp = ((csrIsProfileCCX(pProfile) || ((pIes->CCXVersion.present) && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA)))) && (!(csrIsProfile11r( pProfile ))) && (pMac->roam.configParam.isCcxIniFeatureEnabled)) ? pal_cpu_to_be32(TRUE) : 0;
         palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
         pBuf += sizeof(tAniBool);        
 #endif // FEATURE_WLAN_CCX
 #endif // WLAN_FEATURE_VOWIFI_11R
+
 #ifdef FEATURE_WLAN_CCX
-        if ((csrIsProfileCCX(pProfile) || 
-             ((pIes->CCXVersion.present) 
-              && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) 
-                  || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA)
-                  || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK)
-                  || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN)
-                  || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) 
-            && (!(csrIsProfile11r( pProfile ))) 
-            && (pMac->roam.configParam.isCcxIniFeatureEnabled))
+        if ((csrIsProfileCCX(pProfile) || ((pIes->CCXVersion.present) && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA)))) && (!(csrIsProfile11r( pProfile ))) && (pMac->roam.configParam.isCcxIniFeatureEnabled))
         {
            tCCXTspecInfo ccxTspec;
+
            // CCX Tspec information
            palZeroMemory(pMac->hHdd, &ccxTspec, sizeof(tCCXTspecInfo));
            ccxTspec.numTspecs = sme_QosCCxRetrieveTspecInfo(pMac, sessionId, (tTspecInfo *) &ccxTspec.tspec[0]);
            *pBuf = ccxTspec.numTspecs;
            pBuf += sizeof(tANI_U8);
+
            // Copy the TSPEC information only if present
            if (ccxTspec.numTspecs) {
                palCopyMemory(pMac->hHdd, pBuf, (void*)&ccxTspec.tspec[0], (ccxTspec.numTspecs*sizeof(tTspecInfo)));
@@ -11671,13 +11705,10 @@
             }
         }
 #endif // FEATURE_WLAN_CCX
-#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
+
+#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX
         // Fill in isFastTransitionEnabled
-        if (pMac->roam.configParam.isFastTransitionEnabled
-#ifdef FEATURE_WLAN_LFR
-         || csrRoamIsFastRoamEnabled(pMac)
-#endif
-         )
+        if (pMac->roam.configParam.isFastTransitionEnabled)
         {
             dwTmp = pal_cpu_to_be32(TRUE); 
             palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
@@ -11690,21 +11721,7 @@
             pBuf += sizeof(tAniBool);        
         }
 #endif
-#ifdef FEATURE_WLAN_LFR
-        if(csrRoamIsFastRoamEnabled(pMac))
-        {
-            //legacy fast roaming enabled
-            dwTmp = pal_cpu_to_be32(TRUE); 
-            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
-            pBuf += sizeof(tAniBool);        
-        }
-        else
-        {
-            dwTmp = pal_cpu_to_be32(FALSE); 
-            palCopyMemory( pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool) );
-            pBuf += sizeof(tAniBool);        
-        }
-#endif
+
         csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, uapsd_mask);
         
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
@@ -11713,9 +11730,12 @@
 #endif
         status = palSendMBMessage( pMac->hHdd, pMsg );
     } while( 0 );
+
     return( status );
+
 }
 
+
 //
 eHalStatus csrSendMBDisassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode )
 {
@@ -11728,12 +11748,14 @@
     if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
         return eHAL_STATUS_FAILURE;
 #endif
+
     do {
         status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocReq ));
         if ( !HAL_STATUS_SUCCESS(status) ) break;
         palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeDisassocReq ));
         pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_REQ);
         pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocReq ));
+
         pBuf = &pMsg->sessionId;
         // sessionId
         *pBuf++ = (tANI_U8)sessionId;
@@ -11750,6 +11772,7 @@
             // Set the bssid address before sending the message to LIM
             status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pSession->selfMacAddr, sizeof( tSirMacAddr ) );
             pBuf = pBuf + sizeof ( tSirMacAddr );
+
             // Set the peer MAC address before sending the message to LIM
             status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) ); //perMacAddr is passed as bssId for softAP
             pBuf = pBuf + sizeof ( tSirMacAddr );
@@ -11760,6 +11783,7 @@
             // Set the peer MAC address before sending the message to LIM
             status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr ) );
             pBuf = pBuf + sizeof ( tSirMacAddr );
+
             status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->bssId ) );
             pBuf = pBuf + sizeof ( tSirMacAddr );
 #ifdef WLAN_SOFTAP_FEATURE
@@ -11770,6 +11794,7 @@
             palFreeMemory(pMac->hHdd, pMsg);
             break;
         }
+
         // reasonCode
         wTmp = pal_cpu_to_be16(reasonCode);
         status = palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof(tANI_U16) );
@@ -11779,6 +11804,7 @@
             break;
         }
         pBuf += sizeof(tANI_U16);
+
         /* The state will be DISASSOC_HANDOFF only when we are doing handoff. 
                     Here we should not send the disassoc over the air to the AP */
         if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId)
@@ -11791,15 +11817,19 @@
         }
         pBuf += sizeof(tANI_U8);
         status = palSendMBMessage( pMac->hHdd, pMsg );
+
     } while( 0 );
+
     return( status );
 }
+
 #ifdef WLAN_SOFTAP_FEATURE
 eHalStatus csrSendMBTkipCounterMeasuresReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN bEnable, tSirMacAddr bssId )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tSirSmeTkipCntrMeasReq *pMsg;
     tANI_U8 *pBuf;
+
     do
     {
         status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeTkipCntrMeasReq ));
@@ -11807,6 +11837,7 @@
         palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeTkipCntrMeasReq ));
         pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_TKIP_CNTR_MEAS_REQ);
         pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeTkipCntrMeasReq ));
+
         pBuf = &pMsg->sessionId;
         // sessionId
         *pBuf++ = (tANI_U8)sessionId;
@@ -11824,10 +11855,14 @@
             palFreeMemory(pMac->hHdd, pMsg);
             break;
         }
+
         status = palSendMBMessage( pMac->hHdd, pMsg );
+
     } while( 0 );
+
     return( status );
 }
+
 eHalStatus
 csrSendMBGetAssociatedStasReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId,
                                     VOS_MODULE_ID modId, tSirMacAddr bssId,
@@ -11838,38 +11873,49 @@
     tSirSmeGetAssocSTAsReq *pMsg;
     tANI_U8 *pBuf = NULL, *wTmpBuf = NULL;
     tANI_U32 dwTmp;
+
     do
     {
         status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeGetAssocSTAsReq ) );
         if (!HAL_STATUS_SUCCESS(status)) break;
         palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetAssocSTAsReq ) );
         pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_ASSOC_STAS_REQ);
+
         pBuf = (tANI_U8 *)&pMsg->bssId;
         wTmpBuf = pBuf;
+
         // bssId
         palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) );
         pBuf += sizeof(tSirMacAddr);
+
         // modId 
         dwTmp = pal_cpu_to_be16((tANI_U16)modId);
         palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U16));
         pBuf += sizeof(tANI_U16);
+
         // pUsrContext
         dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext);
         palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
         pBuf += sizeof(tANI_U32);
+
         // pfnSapEventCallback
         dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback);
         palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
         pBuf += sizeof(tANI_U32);
+
         // pAssocStasBuf
         dwTmp = pal_cpu_to_be32((tANI_U32)pAssocStasBuf);
         palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
         pBuf += sizeof(tANI_U32);
+
         pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)));//msg_header + msg
+
         status = palSendMBMessage( pMac->hHdd, pMsg );
     } while( 0 );
+
     return( status );
         }
+
 eHalStatus
 csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId,
                             tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac)
@@ -11878,34 +11924,45 @@
     tSirSmeGetWPSPBCSessionsReq *pMsg;
     tANI_U8 *pBuf = NULL, *wTmpBuf = NULL;
     tANI_U32 dwTmp;
+
     do
         {
         status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirSmeGetWPSPBCSessionsReq) );
         if (!HAL_STATUS_SUCCESS(status)) break;
         palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirSmeGetWPSPBCSessionsReq ) );
         pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_WPSPBC_SESSION_REQ);
+
         pBuf = (tANI_U8 *)&pMsg->pUsrContext;
         wTmpBuf = pBuf;
+
         // pUsrContext
         dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext);
         palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
         pBuf += sizeof(tANI_U32);
+
         // pSapEventCallback
         dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback);
         palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
         pBuf += sizeof(tANI_U32);
+
         // bssId
         palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr) );
         pBuf += sizeof(tSirMacAddr);
+
         // MAC Address of STA in WPS session
         palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, pRemoveMac.bytes, sizeof(v_MACADDR_t));
         pBuf += sizeof(v_MACADDR_t);
+
         pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)));//msg_header + msg
+
         status = palSendMBMessage( pMac->hHdd, pMsg );
+
     } while( 0 );
+
     return( status );
 }
 #endif
+
 eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -11915,6 +11972,7 @@
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
         return eHAL_STATUS_FAILURE;
+
     do {
         status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthReq ));
         if ( !HAL_STATUS_SUCCESS(status) ) break;
@@ -11929,6 +11987,7 @@
         *pBuf = 0;
         *(pBuf + 1 ) = 0;
         pBuf += sizeof(tANI_U16);
+
         if ((pSession->pCurRoamProfile != NULL)  && (
 #ifdef WLAN_SOFTAP_FEATURE
              (CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || 
@@ -11943,6 +12002,7 @@
             // Set the BSSID before sending the message to LIM
             status = palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->peerMacAddr ) );
             pBuf =  pBuf + sizeof(tSirMacAddr);
+
         }
         if(!HAL_STATUS_SUCCESS(status))
         {
@@ -11965,14 +12025,18 @@
             break;
         }
         status = palSendMBMessage( pMac->hHdd, pMsg );
+
     } while( 0 );
+
     return( status );
 }
 
+
 eHalStatus csrSendMBDisassocCnfMsg( tpAniSirGlobal pMac, tpSirSmeDisassocInd pDisassocInd )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tSirSmeDisassocCnf *pMsg;
+
     do {
         status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDisassocCnf ));
         if ( !HAL_STATUS_SUCCESS(status) ) break;
@@ -11994,15 +12058,20 @@
             break;
         }
 //To test reconn ends
+
         status = palSendMBMessage( pMac->hHdd, pMsg );
+
     } while( 0 );
+
     return( status );
 }
 
+
 eHalStatus csrSendMBDeauthCnfMsg( tpAniSirGlobal pMac, tpSirSmeDeauthInd pDeauthInd )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tSirSmeDeauthCnf *pMsg;
+
     do {
         status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeDeauthCnf ));
         if ( !HAL_STATUS_SUCCESS(status) ) break;
@@ -12022,10 +12091,14 @@
             palFreeMemory(pMac->hHdd, pMsg);
             break;
         }
+
         status = palSendMBMessage( pMac->hHdd, pMsg );
+
     } while( 0 );
+
     return( status );
 }
+
 eHalStatus csrSendAssocCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus Halstatus )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
@@ -12033,12 +12106,14 @@
     tANI_U8 *pBuf;
     tSirResultCodes statusCode;
     tANI_U16 wTmp;
+
     do {
         status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocCnf ));
         if ( !HAL_STATUS_SUCCESS(status) ) break;
         palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocCnf ));
                 pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ASSOC_CNF);
                 pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocCnf ));
+
         pBuf = (tANI_U8 *)&pMsg->statusCode;
         if(HAL_STATUS_SUCCESS(Halstatus))
             statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS);
@@ -12061,15 +12136,19 @@
         pBuf += sizeof (tSirMacAddr);
         // alternateChannelId
         *pBuf = 11;
+
         status = palSendMBMessage( pMac->hHdd, pMsg );
         if(!HAL_STATUS_SUCCESS(status))
         {
             //pMsg is freed by palSendMBMessage
             break;
         }
+
     } while( 0 );
+
     return( status );
 }
+
 #ifdef WLAN_SOFTAP_FEATURE
 eHalStatus csrSendAssocIndToUpperLayerCnfMsg(   tpAniSirGlobal pMac, 
                                                 tpSirSmeAssocInd pAssocInd, 
@@ -12082,11 +12161,11 @@
     tANI_U8 *pBuf;
     tSirResultCodes statusCode;
     tANI_U16 wTmp;
+
     do {
         status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf ));
         if ( !HAL_STATUS_SUCCESS(status) ) break;
         palZeroMemory(pMac->hHdd, pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf ));
-
         pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPPER_LAYER_ASSOC_CNF);
         pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocIndToUpperLayerCnf ));
 
@@ -12115,28 +12194,37 @@
         // alternateChannelId
         *pBuf = 11;
         pBuf += sizeof (tANI_U8);
+
         // Instead of copying roam Info, we just copy only WmmEnabled , RsnIE information
         //Wmm
         *pBuf = pAssocInd->wmmEnabledSta;
         pBuf += sizeof (tANI_U8);
+
         //RSN IE
         status = palCopyMemory(pMac->hHdd, (tSirRSNie *)pBuf, &pAssocInd->rsnIE, sizeof(tSirRSNie));
         pBuf += sizeof (tSirRSNie);
+
         //Additional IE
         status = palCopyMemory(pMac->hHdd, (void *)pBuf, &pAssocInd->addIE, sizeof(tSirAddie));
         pBuf += sizeof (tSirAddie);
+
         //reassocReq
         *pBuf = pAssocInd->reassocReq;
         pBuf += sizeof (tANI_U8);
+
         msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF;
         msgQ.bodyptr = pMsg;
         msgQ.bodyval = 0;
+
         SysProcessMmhMsg(pMac, &msgQ);
+
     } while( 0 );
+
     return( status );
 }
 #endif
 
+
 eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId ,
             tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, 
             tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection,
@@ -12151,8 +12239,11 @@
     tANI_U8 *pBuf;
     tANI_U8 *p;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
     do {
+
         if( ( 1 != numKeys ) && ( 0 != numKeys ) ) break;
+
         // all of these fields appear in every SET_CONTEXT message.  Below we'll add in the size for each 
         // key set. Since we only support upto one key, we always allocate memory for 1 key
         msgLen  = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) +
@@ -12165,6 +12256,7 @@
         palZeroMemory(pMac->hHdd, pMsg, msgLen);
                 pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SETCONTEXT_REQ);
                 pMsg->length = pal_cpu_to_be16(msgLen);
+
         //sessionId
         pBuf = &pMsg->sessionId;
         *pBuf = (tANI_U8)sessionId;
@@ -12186,25 +12278,31 @@
         pBuf += sizeof(tSirMacAddr);
 
         p = pBuf;
+
                 // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field
                 // in the tSirKeyMaterial keyMaterial; field).
                 //
                 // !!NOTE:  This keyMaterial.length contains the length of a MAX size key, though the keyLength can be 
                 // shorter than this max size.  Is LIM interpreting this ok ?
                 p = pal_set_U16( p, pal_cpu_to_be16((tANI_U16)( sizeof( pMsg->keyMaterial.numKeys ) + ( numKeys * sizeof( pMsg->keyMaterial.key ) ) )) );
+
                 // set pMsg->keyMaterial.edType
         tmpEdType = (tAniEdType)pal_cpu_to_be32(edType);
         palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType) );
         p += sizeof( pMsg->keyMaterial.edType );
+
         // set the pMsg->keyMaterial.numKeys field
         *p = numKeys;
         p += sizeof( pMsg->keyMaterial.numKeys );   
+
         // set pSirKey->keyId = keyId;
         *p = keyId;
         p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId );
+
         // set pSirKey->unicast = (tANI_U8)fUnicast;
         *p = (tANI_U8)fUnicast;
         p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast );
+
                 // set pSirKey->keyDirection = aniKeyDirection;
         tmpDirection = (tAniKeyDirection)pal_cpu_to_be32(aniKeyDirection);
         palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection) );
@@ -12212,27 +12310,35 @@
         //    pSirKey->keyRsc = ;;
         palCopyMemory( pMac->hHdd, p, pKeyRsc, CSR_MAX_RSC_LEN );
         p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc );
+
                 // set pSirKey->paeRole
                 *p = paeRole;   // 0 is Supplicant
                 p++;
+
                 // set pSirKey->keyLength = keyLength;
                 p = pal_set_U16( p, pal_cpu_to_be16(keyLength) );
+
         if ( keyLength && pKey ) 
         {   
             palCopyMemory( pMac->hHdd, p, pKey, keyLength ); 
             if(keyLength == 16)
             {
-                smsLog(pMac, LOG1, "  SME Set keyIdx (%d) encType(%d) key = %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n",
+                smsLog(pMac, LOGE, "  SME Set keyIdx (%d) encType(%d) key = %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n",
                 keyId, edType, pKey[0], pKey[1], pKey[2], pKey[3], pKey[4],
                 pKey[5], pKey[6], pKey[7], pKey[8],
                 pKey[9], pKey[10], pKey[11], pKey[12], pKey[13], pKey[14], pKey[15]);
             }
         }
+
         status = palSendMBMessage(pMac->hHdd, pMsg);
+
     } while( 0 );
+
     return( status );
 }
 
+
+
 eHalStatus csrSendMBStartBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamBssType bssType, 
                                     tCsrRoamStartBssParams *pParam, tSirBssDescription *pBssDesc )
 {
@@ -12243,28 +12349,26 @@
     tANI_U16 msgLen, wTmp;
     tANI_U32 dwTmp;
     tSirNwType nwType;
-    ePhyChanBondState cbMode;
+    tAniCBSecondaryMode cbMode;
 #ifdef WLAN_SOFTAP_FEATURE
     tANI_U32 authType;
 #endif
-    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
+    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     do {
         pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS;
         pSession->joinFailStatusCode.reasonCode = 0;
         msgLen = sizeof(tSirSmeStartBssReq);
         status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
         if ( !HAL_STATUS_SUCCESS(status) ) break;
+
         palZeroMemory(pMac->hHdd, pMsg, msgLen);
         pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_START_BSS_REQ);
+
         pBuf = &pMsg->sessionId;
+
         wTmpBuf = pBuf;
+
         //sessionId
         *pBuf = (tANI_U8)sessionId;
         pBuf++;
@@ -12272,6 +12376,7 @@
         *pBuf = 0;
         *(pBuf + 1) = 0;
         pBuf += sizeof(tANI_U16);
+
         // bssid 
         palCopyMemory( pMac->hHdd, pBuf, pParam->bssid, sizeof(tSirMacAddr) );
         pBuf += sizeof(tSirMacAddr);
@@ -12293,22 +12398,6 @@
         {
             wTmp = pal_cpu_to_be16( WNI_CFG_BEACON_INTERVAL_STADEF );
         }
-        if(csrIsconcurrentsessionValid (pMac, sessionId, 
-                                   pParam->bssPersona) 
-                                   == eHAL_STATUS_SUCCESS )
-        {    
-           csrValidateBeaconInterval(pMac, pParam->operationChn, &wTmp, sessionId,
-                                      pParam->bssPersona);
-           //Update the beacon Interval 
-           pParam->beaconInterval = wTmp;
-        }
-        else
-        {
-            smsLog( pMac,LOGE, FL("****Start BSS failed persona already exists***\n"));
-            status = eHAL_STATUS_FAILURE;
-            return status;
-        }
-
         palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); 
         pBuf += sizeof(tANI_U16);
         // dot11mode
@@ -12332,13 +12421,14 @@
             *pBuf = 0;
             pBuf++;        
         }
+
         // set the channel Id
         *pBuf = pParam->operationChn;
         pBuf++;
         //What should we really do for the cbmode.
-        cbMode = (ePhyChanBondState)pal_cpu_to_be32(pParam->cbMode);
-        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(ePhyChanBondState) );
-        pBuf += sizeof(ePhyChanBondState);
+        cbMode = (tAniCBSecondaryMode)pal_cpu_to_be32(pParam->cbMode);
+        palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&cbMode, sizeof(tAniCBSecondaryMode) );
+        pBuf += sizeof(tAniCBSecondaryMode);
 
 #ifdef WLAN_SOFTAP_FEATURE
         // Set privacy
@@ -12348,39 +12438,47 @@
         //Set Uapsd 
         *pBuf = pParam->ApUapsdEnable;
         pBuf++;
+
         //Set SSID hidden
         *pBuf = pParam->ssidHidden;
         pBuf++;
+
         *pBuf = (tANI_U8)pParam->fwdWPSPBCProbeReq;
         pBuf++;
         
         //Ht protection Enable/Disable
         *pBuf = (tANI_U8)pParam->protEnabled;
         pBuf++;
+
         //Enable Beacons to Receive for OBSS protection Enable/Disable
         *pBuf = (tANI_U8)pParam->obssProtEnabled;
         pBuf++;
+
         //set cfg related to protection
         wTmp = pal_cpu_to_be16( pParam->ht_protection );
         palCopyMemory( pMac->hHdd, pBuf, &wTmp, sizeof( tANI_U16 ) ); 
         pBuf += sizeof(tANI_U16);
+
         // Set Auth type
         authType = pal_cpu_to_be32(pParam->authType);
         palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&authType, sizeof(tANI_U32));
         pBuf += sizeof(tANI_U32);
+
         // Set DTIM
         dwTmp = pal_cpu_to_be32(pParam->dtimPeriod);
         palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32));
         pBuf += sizeof(tANI_U32);
+
         // Set wps_state
         *pBuf = pParam->wps_state;
         pBuf++;
+
 #endif
         //Persona
         *pBuf = (tANI_U8)pParam->bssPersona;
         pBuf++;
         
-        
+
         
         // set RSN IE 
         if( pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata) )
@@ -12401,8 +12499,10 @@
         nwType = (tSirNwType)pal_cpu_to_be32(pParam->sirNwType);
         palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *)&nwType, sizeof(tSirNwType) );
         pBuf += sizeof(tSirNwType);
+
         *pBuf = pParam->operationalRateSet.numRates; //tSirMacRateSet->numRates
         pBuf++;
+
         palCopyMemory( pMac->hHdd, pBuf, pParam->operationalRateSet.rate, pParam->operationalRateSet.numRates );
         pBuf += pParam->operationalRateSet.numRates ;
         *pBuf++ = pParam->extendedRateSet.numRates;
@@ -12411,14 +12511,18 @@
             palCopyMemory( pMac->hHdd, pBuf, pParam->extendedRateSet.rate, pParam->extendedRateSet.numRates );
             pBuf += pParam->extendedRateSet.numRates;
         }
+
         msgLen = (tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)); //msg_header + msg
         pMsg->length = pal_cpu_to_be16(msgLen);
         
         status = palSendMBMessage(pMac->hHdd, pMsg);
+
     } while( 0 );
+
   return( status );
 }
 
+
 eHalStatus csrSendMBStopBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId )
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
@@ -12427,12 +12531,6 @@
     tANI_U8 *pBuf;
     tANI_U16 msgLen;
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-    
     do {
         status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq));
         if ( !HAL_STATUS_SUCCESS(status) ) break;
@@ -12461,6 +12559,7 @@
        pBuf += sizeof(tSirMacAddr);
        msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr);
        pMsg->length =  pal_cpu_to_be16(msgLen);
+
        status =  palSendMBMessage( pMac->hHdd, pMsg );
 #if 0            
         status = palAllocateMemory(pMac, (void **)&pMsg, sizeof(tSirSmeStopBssReq));
@@ -12485,16 +12584,20 @@
                 status = palSendMBMessage( pMac->hHdd, pMsg );
 #endif                
         } while( 0 );
+
     return( status );
 }
 
+
 eHalStatus csrReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, 
                       tCsrRoamModifyProfileFields *pModProfileFields,
                       tANI_U32 *pRoamId, v_BOOL_t fForce)
 {
+
    eHalStatus status = eHAL_STATUS_FAILURE;
    tANI_U32 roamId = 0;
    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
    if((csrIsConnStateConnected(pMac, sessionId)) &&
       (fForce || (!palEqualMemory(pMac->hHdd, &pModProfileFields, 
                        &pSession->connectedProfile.modifyProfileFields, 
@@ -12506,27 +12609,34 @@
          *pRoamId = roamId;
       }
 
+
       status = csrRoamIssueReassoc(pMac, sessionId, NULL, pModProfileFields, 
                                    eCsrSmeIssuedReassocToSameAP, roamId, 
                                    eANI_BOOLEAN_FALSE);
+
    }
+
    return status;
 }
+
 static eHalStatus csrRoamSessionOpened(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tCsrRoamInfo roamInfo;
+
     palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo));
     status = csrRoamCallCallback(pMac, sessionId, &roamInfo, 0,
                             eCSR_ROAM_SESSION_OPENED, eCSR_ROAM_RESULT_NONE);
     return (status);
 }
+
 eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg)
 {
    eHalStatus                         status = eHAL_STATUS_SUCCESS;
    tListElem                          *pEntry = NULL;
    tSmeCmd                            *pCommand = NULL;
    tSirSmeAddStaSelfRsp               *pRsp;
+
    do
    {
       if(pMsg == NULL)
@@ -12535,6 +12645,7 @@
          status = eHAL_STATUS_FAILURE;
          break;
       }
+
       pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
       if(pEntry)
       {
@@ -12544,7 +12655,9 @@
             pRsp = (tSirSmeAddStaSelfRsp*)pMsg;
             smsLog( pMac, LOG1, "Add Sta rsp status = %d\n", pRsp->status );
             //Nothing to be done. May be indicate the self sta addition success by calling session callback (TODO).
+
             csrRoamSessionOpened(pMac, pCommand->sessionId);
+
             //Remove this command out of the active list
             if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK))
             {
@@ -12569,24 +12682,34 @@
          break;
       }
    } while(0);
+
    return status;
+
 }
+
 eHalStatus csrSendMBAddSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr )
 {
    tSirSmeAddStaSelfReq *pMsg;
    tANI_U16 msgLen;
    eHalStatus status = eHAL_STATUS_FAILURE;
+
    do {
+
       msgLen  = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+
          sizeof( tSirBssType )*/;
+
       status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
       if ( !HAL_STATUS_SUCCESS(status) ) break;
+
       palZeroMemory(pMac->hHdd, pMsg, msgLen);
+
       pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ADD_STA_SELF_REQ);
       pMsg->mesgLen = pal_cpu_to_be16(msgLen);
+
       // self station address
       palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) );
-        smsLog( pMac, LOG1, FL("selfMac=%02x, %02x, %02x, %02x, %02x, %02x"),       
+
+        smsLog( pMac, LOGE, FL("selfMac=%02x, %02x, %02x, %02x, %02x, %02x\n"),       
             pMsg->selfMacAddr[0],
             pMsg->selfMacAddr[1],
             pMsg->selfMacAddr[2],
@@ -12594,13 +12717,17 @@
             pMsg->selfMacAddr[4],
             pMsg->selfMacAddr[5]);
       status = palSendMBMessage(pMac->hHdd, pMsg);
+
    } while( 0 );
+
    return( status );
 }
+
 eHalStatus csrIssueAddStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr sessionMacAddr)
 {
    eHalStatus status = eHAL_STATUS_SUCCESS;
    tSmeCmd *pCommand;
+
    pCommand = csrGetCommandBuffer(pMac);
    if(NULL == pCommand)
    {
@@ -12611,6 +12738,7 @@
       pCommand->command = eSmeCommandAddStaSession;
       pCommand->sessionId = (tANI_U8)sessionId;
       palCopyMemory( pMac->hHdd, pCommand->u.addStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) );
+
       status = csrQueueSmeCommand(pMac, pCommand, TRUE);
       if( !HAL_STATUS_SUCCESS( status ) )
       {
@@ -12618,19 +12746,23 @@
          smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
       }
    }
+
    return (status);
 }
+
 eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
    return csrSendMBAddSelfStaReqMsg( pMac, 
          pCommand->u.addStaSessionCmd.selfMacAddr );
 }
+
 eHalStatus csrRoamOpenSession( tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext,
                           tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tANI_U32 i;
     tCsrRoamSession *pSession;
+
     *pbSessionId = CSR_SESSION_ID_INVALID;
     for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
     {
@@ -12644,6 +12776,7 @@
             pSession->pContext = pContext;
             palCopyMemory( pMac->hHdd, &pSession->selfMacAddr, pSelfMacAddr, sizeof(tCsrBssid) );
             *pbSessionId = (tANI_U8)i;
+
             status = palTimerAlloc(pMac->hHdd, &pSession->hTimerRoaming, csrRoamRoamingTimerHandler, 
                                     &pSession->roamingTimerInfo);
             if(!HAL_STATUS_SUCCESS(status))
@@ -12662,6 +12795,7 @@
 #endif
             pSession->ibssJoinTimerInfo.pMac = pMac;
             pSession->ibssJoinTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+
             status = palTimerAlloc(pMac->hHdd, &pSession->hTimerIbssJoining, csrRoamIbssJoinTimerHandler, 
                                     &pSession->ibssJoinTimerInfo);
             if(!HAL_STATUS_SUCCESS(status))
@@ -12678,14 +12812,17 @@
         //No session is available
         status = eHAL_STATUS_RESOURCES;
     }
+
     return ( status );
 }
+
 eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg)
 {
    eHalStatus                         status = eHAL_STATUS_SUCCESS;
    tListElem                          *pEntry = NULL;
    tSmeCmd                            *pCommand = NULL;
    tSirSmeDelStaSelfRsp               *pRsp;
+
    do
    {
       if(pMsg == NULL)
@@ -12694,6 +12831,7 @@
          status = eHAL_STATUS_FAILURE;
          break;
       }
+
       pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
       if(pEntry)
       {
@@ -12701,10 +12839,13 @@
          if(eSmeCommandDelStaSession == pCommand->command)
          {
             tANI_U8 sessionId = pCommand->sessionId;
+
             pRsp = (tSirSmeDelStaSelfRsp*)pMsg;
             smsLog( pMac, LOG1, "Del Sta rsp status = %d\n", pRsp->status );
+
             //This session is done.
             csrCleanupSession(pMac, sessionId);
+
             if(pCommand->u.delStaSessionCmd.callback)
             {
                  
@@ -12749,28 +12890,40 @@
          break;
       }
    } while(0);
+
    return status;
+
 }
+
 eHalStatus csrSendMBDelSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr )
 {
    tSirSmeDelStaSelfReq *pMsg;
    tANI_U16 msgLen;
    eHalStatus status = eHAL_STATUS_FAILURE;
+
    do {
+
       msgLen  = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+
          sizeof( tSirBssType )*/;
+
       status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
       if ( !HAL_STATUS_SUCCESS(status) ) break;
    
       palZeroMemory(pMac->hHdd, pMsg, msgLen);
+
       pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_STA_SELF_REQ);
       pMsg->mesgLen = pal_cpu_to_be16(msgLen);
+
       // self station address
       palCopyMemory( pMac->hHdd, (tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, sizeof(tSirMacAddr) );
+
       status = palSendMBMessage(pMac->hHdd, pMsg);
+
    } while( 0 );
+
    return( status );
 }
+
 eHalStatus csrIssueDelStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId,
                                        tSirMacAddr sessionMacAddr,
                                        csrRoamSessionCloseCallback callback,
@@ -12778,6 +12931,7 @@
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
    tSmeCmd *pCommand;
+
    pCommand = csrGetCommandBuffer(pMac);
    if(NULL == pCommand)
    {
@@ -12790,6 +12944,7 @@
       pCommand->u.delStaSessionCmd.callback = callback;
       pCommand->u.delStaSessionCmd.pContext = pContext;
       palCopyMemory( pMac->hHdd, pCommand->u.delStaSessionCmd.selfMacAddr, sessionMacAddr, sizeof( tSirMacAddr ) );
+
       status = csrQueueSmeCommand(pMac, pCommand, TRUE);
       if( !HAL_STATUS_SUCCESS( status ) )
       {
@@ -12797,13 +12952,16 @@
          smsLog( pMac, LOGE, FL(" fail to send message status = %d\n"), status );
       }
    }
+
    return (status);
 }
+
 eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
    return csrSendMBDelSelfStaReqMsg( pMac, 
          pCommand->u.delStaSessionCmd.selfMacAddr );
 }
+
 static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     tDblLinkList *pList = &pMac->roam.roamCmdPendingList;
@@ -12817,6 +12975,7 @@
         smsLog(pMac, LOGE, FL(" failed to open list"));
         return;
     }
+
     csrLLLock(pList);
     pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
     while(pEntry != NULL)
@@ -12842,11 +13001,13 @@
     csrLLClose(&localList);
 }
 
+
 void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
     {
         tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
         csrRoamStop(pMac, sessionId);
         csrFreeConnectBssDesc(pMac, sessionId);
         csrRoamFreeConnectProfile( pMac, &pSession->connectedProfile );
@@ -12862,12 +13023,14 @@
     }
 }
 
+
 eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId,
                                 tANI_BOOLEAN fSync, 
                                 csrRoamSessionCloseCallback callback,
                                 void *pContext )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
+
     if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
     {
         tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
@@ -12887,19 +13050,15 @@
     {
         status = eHAL_STATUS_INVALID_PARAMETER;
     }
+
     return ( status );
 }
 
+
 static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId )
 {
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return;
-    }
-    
     pSession->sessionActive = eANI_BOOLEAN_FALSE;
     pSession->sessionId = CSR_SESSION_ID_INVALID;
     pSession->callback = NULL;
@@ -12939,24 +13098,29 @@
     }
     pSession->nWapiRspIeLength = 0;
 #endif /* FEATURE_WLAN_WAPI */
+
     if(pSession->pAddIEScan)
     {
         palFreeMemory(pMac->hHdd, pSession->pAddIEScan);
         pSession->pAddIEScan = NULL;
     }
     pSession->nAddIEScanLength = 0;
+
     if(pSession->pAddIEAssoc)
     {
         palFreeMemory(pMac->hHdd, pSession->pAddIEAssoc);
         pSession->pAddIEAssoc = NULL;
 }
     pSession->nAddIEAssocLength = 0;
+
 }
 
+
 eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId )
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
     tANI_U32 i;
+
     for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
     {
         if( CSR_IS_SESSION_VALID( pMac, i ) )
@@ -12970,15 +13134,18 @@
             }
         }
     }
+
     return( status );
 }
 
+
 //This function assumes that we only support one IBSS session. We cannot use BSSID to identify 
 //session because for IBSS, the bssid changes.
 static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac )
 {
     tANI_U32 i, nRet = CSR_SESSION_ID_INVALID;
     tCsrRoamSession *pSession;
+
     for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
     {
         if( CSR_IS_SESSION_VALID( pMac, i ) )
@@ -12992,50 +13159,55 @@
             }
         }
     }
+
     return (nRet);
 }
+
 static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid)
 {
    /* Update the current BSS info in ho control block based on connected 
       profile info from pmac global structure                              */
    
+
    smsLog(pMac, LOGW, " csrRoamLinkUp: WLAN link UP with AP= %02x-%02x-%02x-%02x-%02x-%02x\n", 
           bssid[ 0 ], bssid[ 1 ], bssid[ 2 ],
           bssid[ 3 ], bssid[ 4 ], bssid[ 5 ] );
+
    /* Check for user misconfig of RSSI trigger threshold                  */
    pMac->roam.configParam.vccRssiThreshold =
       ( 0 == pMac->roam.configParam.vccRssiThreshold ) ? 
       CSR_VCC_RSSI_THRESHOLD : pMac->roam.configParam.vccRssiThreshold;
    pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND;
+
     /* Check for user misconfig of UL MAC Loss trigger threshold           */
    pMac->roam.configParam.vccUlMacLossThreshold =
       ( 0 == pMac->roam.configParam.vccUlMacLossThreshold ) ? 
       CSR_VCC_UL_MAC_LOSS_THRESHOLD : pMac->roam.configParam.vccUlMacLossThreshold;
+
 #if   defined WLAN_FEATURE_NEIGHBOR_ROAMING
     {
         tANI_U32 sessionId = 0;
+
         /* Indicate the neighbor roal algorithm about the connect indication */
         csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssid, &sessionId);
         csrNeighborRoamIndicateConnect(pMac, sessionId, VOS_STATUS_SUCCESS);
     }
 #endif
+
 }
 
+
 static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return;
-    }
-    
    //Only to handle the case for Handover on infra link
    if( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType )
    {
       return;
    }
+
+
    /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/
    csrRoamDeregStatisticsReq(pMac);
    pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND;
@@ -13043,22 +13215,23 @@
    /* Indicate the neighbor roal algorithm about the disconnect indication */
    csrNeighborRoamIndicateDisconnect(pMac, sessionId);
 #endif
-   
-    if(!IS_SLM_SESSIONIZATION_SUPPORTED_BY_FW && 
-        csrIsInfraApStarted( pMac ) &&  
-        pMac->roam.configParam.doBMPSWorkaround)
+
+#ifndef BMPS_WORKAROUND_NOT_NEEDED
+   if(csrIsInfraApStarted( pMac ) &&  pMac->roam.configParam.doBMPSWorkaround)
    {
        pMac->roam.configParam.doBMPSWorkaround = 0;
    }
+#endif
+   
 }
 
+
 void csrRoamTlStatsTimerHandler(void *pv)
 {
    tpAniSirGlobal pMac = PMAC_STRUCT( pv );
    eHalStatus status;
-   pMac->roam.tlStatsReqInfo.timerRunning = FALSE;
 
-   smsLog(pMac, LOG1, FL(" TL stat timer is no-op. It needs to support multiple stations"));
+   pMac->roam.tlStatsReqInfo.timerRunning = FALSE;
 
 #if 0
    // TODO Persession .???
@@ -13089,6 +13262,7 @@
       }
    }
 }
+
 void csrRoamPeStatsTimerHandler(void *pv)
 {
    tCsrPeStatsReqInfo *pPeStatsReqListEntry = (tCsrPeStatsReqInfo *)pv;
@@ -13096,6 +13270,7 @@
    tpAniSirGlobal pMac = pPeStatsReqListEntry->pMac;
    VOS_STATUS vosStatus;
    tPmcPowerState powerState;
+
    pPeStatsReqListEntry->timerRunning = FALSE;
    if( pPeStatsReqListEntry->timerStopFailed == TRUE )
    {
@@ -13155,15 +13330,18 @@
             smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:cannot start hPeStatsTimer timer\n"));
             return;
          }
+
          pPeStatsReqListEntry->timerRunning = TRUE;
 
       }
 
    }
 }
+
 void csrRoamStatsClientTimerHandler(void *pv)
 {
    tCsrStatsClientReqInfo *pStaEntry = (tCsrStatsClientReqInfo *)pv;
+
    if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pStaEntry->timer))
    {
 #if 0
@@ -13174,6 +13352,7 @@
        if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) 
        {
           smsLog(pStaEntry->pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer\n"));
+
        }
 #endif       
    }
@@ -13186,6 +13365,7 @@
 
 
 
+
 eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId)
 {
    tAniGetPEStatsReq *pMsg;
@@ -13201,13 +13381,17 @@
    pMsg->msgLen = (tANI_U16)sizeof(tAniGetPEStatsReq);
    pMsg->staId = staId;
    pMsg->statsMask = statsMask;
+
    status = palSendMBMessage(pMac->hHdd, pMsg );    
+
    if(!HAL_STATUS_SUCCESS(status))
    {
       smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to send down the stats req \n");
    }
+
    return status;
 }
+
 void csrRoamStatsRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg)
 {
    tAniGetPEStatsRsp *pSmeStatsRsp;
@@ -13222,19 +13406,23 @@
    v_PVOID_t  pvosGCtx;
    v_S7_t     rssi = 0;
    tANI_U32   *pRssi = NULL;
+
    pSmeStatsRsp = (tAniGetPEStatsRsp *)pSirMsg;
    if(pSmeStatsRsp->rc)
    {
       smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:stats rsp from PE shows failure\n"));
       goto post_update;
    }
+
    tempMask = pSmeStatsRsp->statsMask;
    pStats = ((tANI_U8 *)&pSmeStatsRsp->statsMask) + sizeof(pSmeStatsRsp->statsMask);
+
    /* subtract all statistics from this length, and after processing the entire 
     * 'stat' part of the message, if the length is not zero, then rssi is piggy packed 
     * in this 'stats' message.
     */
    length = pSmeStatsRsp->msgLen - sizeof(tAniGetPEStatsRsp);
+
    //new stats info from PE, fill up the stats strucutres in PMAC
    while(tempMask)
    {
@@ -13243,7 +13431,7 @@
          switch(counter)
          {
          case eCsrSummaryStats:
-            smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:summary stats\n"));
+            smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:summary stats\n"));
             status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.summaryStatsInfo, 
                                    pStats, sizeof(tCsrSummaryStatsInfo));
             if(!HAL_STATUS_SUCCESS(status))
@@ -13253,8 +13441,9 @@
             pStats += sizeof(tCsrSummaryStatsInfo);
             length -= sizeof(tCsrSummaryStatsInfo);
             break;
+
          case eCsrGlobalClassAStats:
-            smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassA stats\n"));
+            smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:ClassA stats\n"));
             status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classAStatsInfo, 
                                    pStats, sizeof(tCsrGlobalClassAStatsInfo));
             if(!HAL_STATUS_SUCCESS(status))
@@ -13264,8 +13453,9 @@
             pStats += sizeof(tCsrGlobalClassAStatsInfo);
             length -= sizeof(tCsrGlobalClassAStatsInfo);
             break;
+
          case eCsrGlobalClassBStats:
-            smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassB stats\n"));
+            smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:ClassB stats\n"));
             status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classBStatsInfo, 
                                    pStats, sizeof(tCsrGlobalClassBStatsInfo));
             if(!HAL_STATUS_SUCCESS(status))
@@ -13275,8 +13465,9 @@
             pStats += sizeof(tCsrGlobalClassBStatsInfo);
             length -= sizeof(tCsrGlobalClassBStatsInfo);
             break;
+
          case eCsrGlobalClassCStats:
-            smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassC stats\n"));
+            smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:ClassC stats\n"));
             status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.classCStatsInfo, 
                                    pStats, sizeof(tCsrGlobalClassCStatsInfo));
             if(!HAL_STATUS_SUCCESS(status))
@@ -13286,8 +13477,9 @@
             pStats += sizeof(tCsrGlobalClassCStatsInfo);
             length -= sizeof(tCsrGlobalClassCStatsInfo);
             break;
+
          case eCsrPerStaStats:
-            smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:PerSta stats\n"));
+            smsLog( pMac, LOG1, FL("csrRoamStatsRspProcessor:PerSta stats\n"));
             if( CSR_MAX_STA > pSmeStatsRsp->staId )
             {
                status = palCopyMemory(pMac->hHdd, (tANI_U8 *)&pMac->roam.perStaStatsInfo[pSmeStatsRsp->staId], 
@@ -13306,11 +13498,14 @@
             pStats += sizeof(tCsrPerStaStatsInfo);
             length -= sizeof(tCsrPerStaStatsInfo);
             break;
+
          default:
             smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:unknown stats type\n"));
             break;
+
          }
       }
+
       tempMask >>=1;
       counter++;
    }
@@ -13326,6 +13521,7 @@
        rssi = RSSI_HACK_BMPS;
    }
    WDA_UpdateRssiBmps(pvosGCtx, pSmeStatsRsp->staId, rssi);
+
 post_update:   
    //make sure to update the pe stats req list 
    pEntry = csrRoamFindInPeStatsReqList(pMac, pSmeStatsRsp->statsMask);
@@ -13339,7 +13535,9 @@
    pEntry = csrRoamCheckClientReqList(pMac, pSmeStatsRsp->statsMask);
    if(pEntry)
    {
+
       pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link );
+
       if(pTempStaEntry->timerExpired)
       {
          //send up the stats report
@@ -13348,89 +13546,115 @@
          //also remove from the client list
          csrRoamRemoveStatListEntry(pMac, pEntry);
          pTempStaEntry = NULL;
+
       }
    }
+
 }
+
 tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32  statsMask)
 {
    tListElem *pEntry = NULL;
    tCsrPeStatsReqInfo *pTempStaEntry = NULL;
+
    pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK );
+
    if(!pEntry)
    {
       //list empty
-      smsLog(pMac, LOG2, "csrRoamFindInPeStatsReqList: List empty, no request to PE\n");
+      smsLog(pMac, LOGW, "csrRoamFindInPeStatsReqList: List empty, no request to PE\n");
       return NULL;
    }
+
    while( pEntry )
    {
       pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link );
+
       if(pTempStaEntry->statsMask == statsMask)
       {
-         smsLog(pMac, LOG3, "csrRoamFindInPeStatsReqList: match found\n");
+         smsLog(pMac, LOGW, "csrRoamFindInPeStatsReqList: match found\n");
          break;
       }
+
       pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK );
    }
+
    return pEntry;
 }
 
+
 tListElem * csrRoamChecknUpdateClientReqList(tpAniSirGlobal pMac, tCsrStatsClientReqInfo *pStaEntry,
                                              tANI_BOOLEAN update)
 {
    tListElem *pEntry;
    tCsrStatsClientReqInfo *pTempStaEntry;
+
    pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK );
+
    if(!pEntry)
    {
       //list empty
-      smsLog(pMac, LOG2, "csrRoamChecknUpdateClientReqList: List empty, no request from "
+      smsLog(pMac, LOGW, "csrRoamChecknUpdateClientReqList: List empty, no request from "
              "upper layer client(s)\n");
       return NULL;
    }
+
    while( pEntry )
    {
       pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link );
+
       if((pTempStaEntry->requesterId == pStaEntry->requesterId) && 
          (pTempStaEntry->statsMask == pStaEntry->statsMask))
       {
-         smsLog(pMac, LOG3, "csrRoamChecknUpdateClientReqList: match found\n");
+         smsLog(pMac, LOGW, "csrRoamChecknUpdateClientReqList: match found\n");
          if(update)
          {
-            pTempStaEntry->periodicity = pStaEntry->periodicity;
-            pTempStaEntry->callback = pStaEntry->callback;
-            pTempStaEntry->pContext = pStaEntry->pContext;
+         pTempStaEntry->periodicity = pStaEntry->periodicity;
+         pTempStaEntry->callback = pStaEntry->callback;
+         pTempStaEntry->pContext = pStaEntry->pContext;
          }
          break;
       }
+
       pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK );
    }
+
    return pEntry;
 }
+
 tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask)
 {
    tListElem *pEntry;
    tCsrStatsClientReqInfo *pTempStaEntry;
+
    pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK );
+
    if(!pEntry)
    {
       //list empty
-      smsLog(pMac, LOG2, "csrRoamCheckClientReqList: List empty, no request from "
+      smsLog(pMac, LOGW, "csrRoamCheckClientReqList: List empty, no request from "
              "upper layer client(s)\n");
       return NULL;
    }
+
    while( pEntry )
    {
       pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link );
+
       if((pTempStaEntry->statsMask & ~(1 << eCsrGlobalClassDStats))  == statsMask)
       {
-         smsLog(pMac, LOG3, "csrRoamCheckClientReqList: match found\n");
+         smsLog(pMac, LOGW, "csrRoamCheckClientReqList: match found\n");
+
          break;
       }
+
       pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK );
    }
+
    return pEntry;
 }
+
+
 eHalStatus csrRoamRegisterLinkQualityIndCallback(tpAniSirGlobal pMac,
                                                  csrRoamLinkQualityIndCallback   callback,  
                                                  void                           *pContext)
@@ -13444,25 +13668,32 @@
    else
    {
      smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being registered");
+
      /* do we need to invoke the callback to notify client of initial value ??  */
    }
    return eHAL_STATUS_SUCCESS;
 }
+
 void csrRoamVccTrigger(tpAniSirGlobal pMac)
 {
    eCsrRoamLinkQualityInd newVccLinkQuality;
    tANI_U32 ul_mac_loss = 0;
    tANI_U32 ul_mac_loss_trigger_threshold;
+
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
    /*-------------------------------------------------------------------------
      Link quality is currently binary based on OBIWAN recommended triggers
+
      Check for a change in link quality and notify client if necessary
    -------------------------------------------------------------------------*/
    ul_mac_loss_trigger_threshold = 
       pMac->roam.configParam.vccUlMacLossThreshold;
+
    VOS_ASSERT( ul_mac_loss_trigger_threshold != 0 );
+
    smsLog(pMac, LOGW, "csrRoamVccTrigger: UL_MAC_LOSS_THRESHOLD is %d\n", 
           ul_mac_loss_trigger_threshold );
+
    if(ul_mac_loss_trigger_threshold < ul_mac_loss)
    {
       smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is POOR \n");
@@ -13473,8 +13704,10 @@
       smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is GOOD\n");
       newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND;
    }
+
    smsLog(pMac, LOGW, "csrRoamVccTrigger: link qual : *** UL_MAC_LOSS %d *** ",
           ul_mac_loss);
+
    if(newVccLinkQuality != pMac->roam.vccLinkQuality)
    {
       smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality changed: trigger necessary\n");
@@ -13489,9 +13722,12 @@
          //event: EVENT_WLAN_VCC
       }
    }
+
    pMac->roam.vccLinkQuality = newVccLinkQuality;
 
+
 }
+
 VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, 
                                             v_U8_t  rssiNotification, 
                                             void * context)
@@ -13503,6 +13739,7 @@
    VOS_STATUS status = VOS_STATUS_SUCCESS;
    /*-------------------------------------------------------------------------
      Link quality is currently binary based on OBIWAN recommended triggers
+
      Check for a change in link quality and notify client if necessary
    -------------------------------------------------------------------------*/
    smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: RSSI trigger threshold is %d\n", 
@@ -13512,6 +13749,7 @@
       smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: ignoring the indication as we are not connected\n");
       return VOS_STATUS_SUCCESS;
    }
+
    if(WLANTL_HO_THRESHOLD_DOWN == rssiNotification)
    {
       smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is POOR\n");
@@ -13527,9 +13765,11 @@
       smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: unknown rssi notification %d\n", rssiNotification);
       //Set to this so the code below won't do anything
       newVccLinkQuality = pMac->roam.vccLinkQuality;    
+
       VOS_ASSERT(0);
    }
 
+
    if(newVccLinkQuality != pMac->roam.vccLinkQuality)
    {
       smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality changed: trigger necessary\n");
@@ -13537,21 +13777,28 @@
       {
          smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality indication %d\n",
                 newVccLinkQuality);
+
         /* we now invoke the callback once to notify client of initial value   */
         pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, 
                                                 pMac->roam.linkQualityIndInfo.context );
          //event: EVENT_WLAN_VCC
       }
    }
+
    pMac->roam.vccLinkQuality = newVccLinkQuality;
+
    return status;
 }
+
+
 tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac,
                                                      tDblLinkList *pStaList,
                                                      tCsrStatsClientReqInfo *pStaEntry)
 {
    tCsrStatsClientReqInfo *pNewStaEntry = NULL;
+
    eHalStatus  status;
+
    //if same entity requested for same set of stats with different periodicity & 
    // callback update it
    if(NULL == csrRoamChecknUpdateClientReqList(pMac, pStaEntry, TRUE))
@@ -13565,6 +13812,7 @@
          return NULL;
       }
    
+
       pNewStaEntry->callback = pStaEntry->callback;
       pNewStaEntry->pContext = pStaEntry->pContext;
       pNewStaEntry->periodicity = pStaEntry->periodicity;
@@ -13580,12 +13828,15 @@
    return pNewStaEntry;
 }
 
+
 tCsrPeStatsReqInfo * csrRoamInsertEntryIntoPeStatsReqList( tpAniSirGlobal pMac,
                                                            tDblLinkList *pStaList,
                                                            tCsrPeStatsReqInfo *pStaEntry)
 {
    tCsrPeStatsReqInfo *pNewStaEntry = NULL;
+
    eHalStatus  status;
+
    status = palAllocateMemory(pMac->hHdd, (void **)&pNewStaEntry, sizeof(tCsrPeStatsReqInfo));
    if (!HAL_STATUS_SUCCESS(status))
    {
@@ -13594,6 +13845,7 @@
       return NULL;
    }
    
+
    pNewStaEntry->hPeStatsTimer = pStaEntry->hPeStatsTimer;
    pNewStaEntry->numClient = pStaEntry->numClient;
    pNewStaEntry->periodicity = pStaEntry->periodicity;
@@ -13604,8 +13856,11 @@
    pNewStaEntry->rspPending = pStaEntry->rspPending;
    
    csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK  );
+
    return pNewStaEntry;
 }
+
+
 eHalStatus csrGetRssi(tpAniSirGlobal pMac, 
                             tCsrRssiCallback callback, 
                             tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext)
@@ -13622,6 +13877,7 @@
       smsLog(pMac, LOGE, " csrGetRssi: failed to allocate mem for req \n");
       return status;
    }
+
    csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId);
 
    pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_RSSI_REQ);
@@ -13631,9 +13887,11 @@
    pMsg->rssiCallback = callback;
    pMsg->pDevContext = pContext;
    pMsg->pVosContext = pVosContext;
+
    msg.type = eWNI_SME_GET_RSSI_REQ;
    msg.bodyptr = pMsg;
    msg.reserved = 0;
+
    if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
    {
        smsLog(pMac, LOGE, " csrGetRssi failed to post msg to self \n");   
@@ -13643,6 +13901,7 @@
    smsLog(pMac, LOG2, FL("returned"));      
    return status;
 }
+
 eHalStatus csrGetStatistics(tpAniSirGlobal pMac, eCsrStatsRequesterType requesterId, 
                             tANI_U32 statsMask, 
                             tCsrStatsCallback callback, 
@@ -13657,19 +13916,20 @@
    eHalStatus status = eHAL_STATUS_SUCCESS;
    tANI_BOOLEAN insertInClientList = FALSE;
    VOS_STATUS vosStatus;
-   WLANTL_TRANSFER_STA_TYPE *pTlStats;
 
    if( csrIsAllSessionDisconnected(pMac) )
    {
       //smsLog(pMac, LOGW, "csrGetStatistics: wrong state curState(%d) not connected\n", pMac->roam.curState);
       return eHAL_STATUS_FAILURE;
    }
+
    if((!statsMask) && (!callback))
    {
       //msg
       smsLog(pMac, LOGW, "csrGetStatistics: statsMask & callback empty in the request\n");
       return eHAL_STATUS_FAILURE;
    }
+
    //for the search list method for deregister
    staEntry.requesterId = requesterId;
    staEntry.statsMask = statsMask;
@@ -13715,12 +13975,14 @@
             pMac->roam.tlStatsReqInfo.timerRunning = FALSE;
          }
          vos_timer_stop( &pStaEntry->timer );
+
          // Destroy the vos timer...      
          vosStatus = vos_timer_destroy( &pStaEntry->timer );
          if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
          {
             smsLog(pMac, LOGE, FL("csrGetStatistics:failed to destroy Client req timer\n"));
          }
+
          csrRoamRemoveStatListEntry(pMac, pEntry);
          pStaEntry = NULL;
          return eHAL_STATUS_SUCCESS;
@@ -13744,6 +14006,7 @@
       staEntry.timerExpired = FALSE;
    
    
+
       //if periodic report requested with non cached result from PE/TL
       if(periodicity)
       {
@@ -13793,27 +14056,19 @@
                
                if(!pMac->roam.tlStatsReqInfo.timerRunning)
                {
-                  pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE));
-                  if(NULL != pTlStats)
+#if 0
+                                   // TODO Session Specific info connectedInfo
+                  //req TL for class D stats
+                  if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId))
                   {
-                     //req TL for class D stats
-                     if(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId))
-                     {
-                        smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL\n"));
-                     }
-                     else
-                     {
-                        //save in SME
-                        csrRoamSaveStatsFromTl(pMac, pTlStats);
-                     }
-                     vos_mem_free(pTlStats);
-                     pTlStats = NULL;
+                     smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL\n"));
                   }
                   else
                   {
-                     smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat"));
+                     //save in SME
+                     csrRoamSaveStatsFromTl(pMac, tlStats);
                   }
-
+#endif
                   if(pMac->roam.tlStatsReqInfo.periodicity)
                   {
                      //start timer
@@ -13848,29 +14103,23 @@
             //right away
             staEntry.timerExpired = TRUE;
             insertInClientList = TRUE;
+
          }
          if(statsMask & (1 << eCsrGlobalClassDStats))
          {
-            pTlStats = (WLANTL_TRANSFER_STA_TYPE *)vos_mem_malloc(sizeof(WLANTL_TRANSFER_STA_TYPE));
-            if(NULL != pTlStats)
+#if 0
+                         // TODO : Per Session info connectedInfo
+            //req TL for class D stats
+            if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId))
             {
-               //req TL for class D stats
-               if(!VOS_IS_STATUS_SUCCESS(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId)))
-               {
-                  smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL\n"));
-               }
-               else
-               {
-                  //save in SME
-                  csrRoamSaveStatsFromTl(pMac, pTlStats);
-               }
-               vos_mem_free(pTlStats);
-               pTlStats = NULL;
+               smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL\n"));
             }
             else
             {
-               smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat"));
+               //save in SME
+               csrRoamSaveStatsFromTl(pMac, tlStats);
             }
+#endif
 
          }
          //if looking for stats from TL only 
@@ -13879,7 +14128,9 @@
             //return the stats
             csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext);
          }
+
       }
+
       if(insertInClientList)
       {
          pStaEntry = csrRoamInsertEntryIntoList(pMac, &pMac->roam.statsClientReqList, &staEntry); 
@@ -13889,7 +14140,6 @@
             smsLog(pMac, LOGW, "csrGetStatistics: Failed to insert req in statsClientReqList\n");
             return eHAL_STATUS_FAILURE;
          }
-         pStaEntry->periodicity = periodicity;
          //Init & start timer if needed
          if(periodicity)
          {
@@ -13906,12 +14156,16 @@
                smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer\n"));
                return eHAL_STATUS_FAILURE;
             }
+
          }
+
       }
+
    }
    return eHAL_STATUS_SUCCESS;
 }
 
+
 tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32  statsMask, 
                                                 tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId)
 {
@@ -13937,6 +14191,7 @@
       {
          pTempStaEntry->periodicity = periodicity;
       }
+
       pTempStaEntry->numClient++;
          found = TRUE;
    }
@@ -13958,6 +14213,7 @@
          return NULL;
       }
    }
+
    pmcQueryPowerState(pMac, &powerState, NULL, NULL);
    if(ePMC_FULL_POWER == powerState)
    {
@@ -14001,9 +14257,11 @@
                smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot init hPeStatsTimer timer\n"));
                return NULL;
             }
+
          }
          //start timer
          smsLog(pMac, LOG1, "csrRoamCheckPeStatsReqList:peStatsTimer period %d\n", pTempStaEntry->periodicity);
+
          vosStatus = vos_timer_start( &pTempStaEntry->hPeStatsTimer, pTempStaEntry->periodicity );
          if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) 
          {
@@ -14013,10 +14271,12 @@
          pTempStaEntry->timerRunning = TRUE;
       }
    }
+
    *pFound = found;
    return pTempStaEntry;
 }
 
+
 /*
     pStaEntry is no longer invalid upon the return of this function.
 */
@@ -14027,9 +14287,10 @@
         if(csrLLRemoveEntry(&pMac->roam.statsClientReqList, pEntry, LL_ACCESS_LOCK))
         {
             palFreeMemory(pMac->hHdd, GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ));
-            }
         }
     }
+}
+
 
 void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry)
 {
@@ -14037,15 +14298,18 @@
    tCsrPeStatsReqInfo *pTempStaEntry;
    VOS_STATUS vosStatus;
    pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK );
+
    if(!pEntry)
    {
       //list empty
       smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: List empty, no stats req for PE\n");
       return;
    }
+
    while( pEntry )
    {
       pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link );
+
       if( pTempStaEntry && pTempStaEntry->statsMask == pPeStaEntry->statsMask)
       {
          smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: match found\n");
@@ -14074,7 +14338,7 @@
                // memory for the PE stat entry in the timer CB.
                pTempStaEntry->timerStopFailed = TRUE;
             }
-         } 
+         }
 
          if(csrLLRemoveEntry(&pMac->roam.peStatsReqList, pEntry, LL_ACCESS_LOCK))
          {
@@ -14090,33 +14354,35 @@
          pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK );
       }
    }
+
    return;
 }
 
 
-void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats)
+void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE tlStats)
 {
 
-   pMac->roam.classDStatsInfo.num_rx_bytes_crc_ok = pTlStats->rxBcntCRCok;
-   pMac->roam.classDStatsInfo.rx_bc_byte_cnt = pTlStats->rxBCBcnt;
-   pMac->roam.classDStatsInfo.rx_bc_frm_cnt = pTlStats->rxBCFcnt;
-   pMac->roam.classDStatsInfo.rx_byte_cnt = pTlStats->rxBcnt;
-   pMac->roam.classDStatsInfo.rx_mc_byte_cnt = pTlStats->rxMCBcnt;
-   pMac->roam.classDStatsInfo.rx_mc_frm_cnt = pTlStats->rxMCFcnt;
-   pMac->roam.classDStatsInfo.rx_rate = pTlStats->rxRate;
+   pMac->roam.classDStatsInfo.num_rx_bytes_crc_ok = tlStats.rxBcntCRCok;
+   pMac->roam.classDStatsInfo.rx_bc_byte_cnt = tlStats.rxBCBcnt;
+   pMac->roam.classDStatsInfo.rx_bc_frm_cnt = tlStats.rxBCFcnt;
+   pMac->roam.classDStatsInfo.rx_byte_cnt = tlStats.rxBcnt;
+   pMac->roam.classDStatsInfo.rx_mc_byte_cnt = tlStats.rxMCBcnt;
+   pMac->roam.classDStatsInfo.rx_mc_frm_cnt = tlStats.rxMCFcnt;
+   pMac->roam.classDStatsInfo.rx_rate = tlStats.rxRate;
    //?? need per AC
-   pMac->roam.classDStatsInfo.rx_uc_byte_cnt[0] = pTlStats->rxUCBcnt;
-   pMac->roam.classDStatsInfo.rx_uc_frm_cnt = pTlStats->rxUCFcnt;
-   pMac->roam.classDStatsInfo.tx_bc_byte_cnt = pTlStats->txBCBcnt;
-   pMac->roam.classDStatsInfo.tx_bc_frm_cnt = pTlStats->txBCFcnt;
-   pMac->roam.classDStatsInfo.tx_mc_byte_cnt = pTlStats->txMCBcnt;
-   pMac->roam.classDStatsInfo.tx_mc_frm_cnt = pTlStats->txMCFcnt;
+   pMac->roam.classDStatsInfo.rx_uc_byte_cnt[0] = tlStats.rxUCBcnt;
+   pMac->roam.classDStatsInfo.rx_uc_frm_cnt = tlStats.rxUCFcnt;
+   pMac->roam.classDStatsInfo.tx_bc_byte_cnt = tlStats.txBCBcnt;
+   pMac->roam.classDStatsInfo.tx_bc_frm_cnt = tlStats.txBCFcnt;
+   pMac->roam.classDStatsInfo.tx_mc_byte_cnt = tlStats.txMCBcnt;
+   pMac->roam.classDStatsInfo.tx_mc_frm_cnt = tlStats.txMCFcnt;
    //?? need per AC
-   pMac->roam.classDStatsInfo.tx_uc_byte_cnt[0] = pTlStats->txUCBcnt;
-   pMac->roam.classDStatsInfo.tx_uc_frm_cnt = pTlStats->txUCFcnt;
+   pMac->roam.classDStatsInfo.tx_uc_byte_cnt[0] = tlStats.txUCBcnt;
+   pMac->roam.classDStatsInfo.tx_uc_frm_cnt = tlStats.txUCFcnt;
 
 }
 
+
 void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, 
                              tCsrStatsCallback callback, tANI_U8 staId, void *pContext)
 {
@@ -14125,6 +14391,7 @@
    tANI_U32 tempMask = 0;
    tANI_U8 counter = 0;
    eHalStatus status = eHAL_STATUS_FAILURE;
+
    if(!callback)
    {
       smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report callback NULL\n"));
@@ -14135,8 +14402,11 @@
       smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report statsMask is 0\n"));
       return;
    }
+
    pStats = stats;
+
    tempMask = statsMask;
+
    while(tempMask)
    {
       if(tempMask & 1)
@@ -14145,7 +14415,7 @@
          switch(counter)
          {
          case eCsrSummaryStats:
-            smsLog( pMac, LOG2, FL("csrRoamReportStatistics:summary stats\n"));
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:summary stats\n"));
             status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.summaryStatsInfo, 
                                    sizeof(tCsrSummaryStatsInfo));
             if(!HAL_STATUS_SUCCESS(status))
@@ -14154,8 +14424,9 @@
             }
             pStats += sizeof(tCsrSummaryStatsInfo);
             break;
+
          case eCsrGlobalClassAStats:
-            smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassA stats\n"));
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassA stats\n"));
             status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classAStatsInfo, 
                                    sizeof(tCsrGlobalClassAStatsInfo));
             if(!HAL_STATUS_SUCCESS(status))
@@ -14163,9 +14434,11 @@
                smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassA stats\n"));
             }
             pStats += sizeof(tCsrGlobalClassAStatsInfo);
+
             break;
+
          case eCsrGlobalClassBStats:
-            smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassB stats\n"));
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassB stats\n"));
             status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classBStatsInfo, 
                                    sizeof(tCsrGlobalClassBStatsInfo));
             if(!HAL_STATUS_SUCCESS(status))
@@ -14173,9 +14446,11 @@
                smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassB stats\n"));
             }
             pStats += sizeof(tCsrGlobalClassBStatsInfo);
+
             break;
+
          case eCsrGlobalClassCStats:
-            smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassC stats\n"));
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassC stats\n"));
             status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classCStatsInfo, 
                                    sizeof(tCsrGlobalClassCStatsInfo));
             if(!HAL_STATUS_SUCCESS(status))
@@ -14183,9 +14458,11 @@
                smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassC stats\n"));
             }
             pStats += sizeof(tCsrGlobalClassCStatsInfo);
+
             break;
+
          case eCsrGlobalClassDStats:
-            smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassD stats\n"));
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:ClassD stats\n"));
             status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.classDStatsInfo, 
                                    sizeof(tCsrGlobalClassDStatsInfo));
             if(!HAL_STATUS_SUCCESS(status))
@@ -14193,9 +14470,11 @@
                smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy ClassD stats\n"));
             }
             pStats += sizeof(tCsrGlobalClassDStatsInfo);
+
             break;
+
          case eCsrPerStaStats:
-            smsLog( pMac, LOG2, FL("csrRoamReportStatistics:PerSta stats\n"));
+            smsLog( pMac, LOG1, FL("csrRoamReportStatistics:PerSta stats\n"));
             status = palCopyMemory(pMac->hHdd, pStats, (tANI_U8 *)&pMac->roam.perStaStatsInfo[staId], 
                                    sizeof(tCsrPerStaStatsInfo));
             if(!HAL_STATUS_SUCCESS(status))
@@ -14203,18 +14482,26 @@
                smsLog( pMac, LOG1, FL("csrRoamReportStatistics:failed to copy PerSta stats\n"));
             }
             pStats += sizeof(tCsrPerStaStatsInfo);
+
             break;
+
          default:
             smsLog( pMac, LOG1, FL("csrRoamReportStatistics:unknown stats type\n"));
             break;
+
          }
       }
+
       tempMask >>=1;
       counter++;
    }
+
    callback(stats, pContext );
+
 }
 
+
+
 eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac)
 {
    tListElem *pEntry = NULL;
@@ -14223,6 +14510,7 @@
    eHalStatus status = eHAL_STATUS_SUCCESS;
    VOS_STATUS vosStatus;
    pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK );
+
    if(!pEntry)
    {
       //list empty
@@ -14230,6 +14518,7 @@
              "upper layer client(s)\n");
       return status;
    }
+
    while( pEntry )
    {
       if(pPrevEntry)
@@ -14240,16 +14529,19 @@
                                  pTempStaEntry->staId, pTempStaEntry->pContext);
          csrRoamRemoveStatListEntry(pMac, pPrevEntry);
       }
+
       pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link );
+
       if (pTempStaEntry->pPeStaEntry)  //pPeStaEntry can be NULL
       {
-         pTempStaEntry->pPeStaEntry->numClient--;
-         //check if we need to delete the entry from peStatsReqList too
-         if(!pTempStaEntry->pPeStaEntry->numClient)
-         {
-            csrRoamRemoveEntryFromPeStatsReqList(pMac, pTempStaEntry->pPeStaEntry);
-         }
+      pTempStaEntry->pPeStaEntry->numClient--;
+      //check if we need to delete the entry from peStatsReqList too
+      if(!pTempStaEntry->pPeStaEntry->numClient)
+      {
+         csrRoamRemoveEntryFromPeStatsReqList(pMac, pTempStaEntry->pPeStaEntry);
       }
+      }
+
       //check if we need to stop the tl stats timer too 
       pMac->roam.tlStatsReqInfo.numClient--;
       if(!pMac->roam.tlStatsReqInfo.numClient)
@@ -14266,21 +14558,24 @@
          pMac->roam.tlStatsReqInfo.periodicity = 0;
          pMac->roam.tlStatsReqInfo.timerRunning = FALSE;
       }
+
       if (pTempStaEntry->periodicity)
       {
           //While creating StaEntry in csrGetStatistics,
           //Initializing and starting timer only when periodicity is set. 
           //So Stop and Destroy timer only when periodicity is set.
           
-          vos_timer_stop( &pTempStaEntry->timer );
-          // Destroy the vos timer...      
-          vosStatus = vos_timer_destroy( &pTempStaEntry->timer );
-          if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
-          {
-              smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:failed to destroy Client req timer\n"));
-          }
+
+      vos_timer_stop( &pTempStaEntry->timer );
+
+      // Destroy the vos timer...      
+      vosStatus = vos_timer_destroy( &pTempStaEntry->timer );
+      if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) )
+      {
+         smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:failed to destroy Client req timer\n"));
       }
-      
+      }
+
       
       pPrevEntry = pEntry;
       pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK );
@@ -14294,10 +14589,12 @@
                                  pTempStaEntry->staId, pTempStaEntry->pContext);
       csrRoamRemoveStatListEntry(pMac, pPrevEntry);
    }
+
    return status;
    
 }
 
+
 eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, 
                                    tRequestFullPowerReason *pReason,
                                    tANI_BOOLEAN *pfNeedPower )
@@ -14308,6 +14605,7 @@
     eHalStatus status = eHAL_STATUS_SUCCESS;
         // TODO : Session info unavailable
         tANI_U32 sessionId = 0;
+
     if( pfNeedPower )
     {
         *pfNeedPower = eANI_BOOLEAN_FALSE;
@@ -14317,8 +14615,10 @@
         {
                 return eHAL_STATUS_SUCCESS;
         }
+
     //Check PMC state first
     pmcState = pmcGetPmcState( pMac );
+
     switch( pmcState )
     {
     case REQUEST_IMPS:
@@ -14334,6 +14634,7 @@
                 //Internal process, no need for full power
                 fNeedFullPower = eANI_BOOLEAN_FALSE;
                 break;
+
             default:
                 //Other scans are real scan, ask for power
                 fNeedFullPower = eANI_BOOLEAN_TRUE;
@@ -14346,6 +14647,7 @@
             fNeedFullPower = eANI_BOOLEAN_TRUE;
         }
         break;
+
     case REQUEST_BMPS:
     case BMPS:
     case REQUEST_START_UAPSD:
@@ -14358,6 +14660,7 @@
             tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList;
             tCsrScanResult *pScanResult;
             tListElem *pEntry;
+
             switch ( pCommand->u.roamCmd.roamReason )
             {
             case eCsrForcedDisassoc:
@@ -14371,9 +14674,11 @@
             case eCsrSmeIssuedReassocToSameAP:
                 fNeedFullPower = eANI_BOOLEAN_TRUE;
                 break;
+
             case eCsrCapsChange:
                 fNeedFullPower = eANI_BOOLEAN_TRUE;
                 break;
+
             default:
                 //Check whether the profile is already connected. If so, no need for full power
                 //Note: IBSS is ignored for now because we don't support powersave in IBSS
@@ -14422,6 +14727,7 @@
             reason = eSME_LINK_DISCONNECTED_BY_OTHER;
         }
         break;
+
     case REQUEST_STOP_UAPSD:
     case REQUEST_EXIT_WOWL:
         if( eSmeCommandRoam == pCommand->command )
@@ -14438,6 +14744,7 @@
             }
                 }
         break;
+
     case STOPPED:
     case REQUEST_STANDBY:
     case STANDBY:
@@ -14446,12 +14753,15 @@
         smsLog( pMac, LOGE, FL( "  cannot process because PMC is in stopped/standby state %d\n" ), pmcState );
         status = eHAL_STATUS_FAILURE;
         break;
+
     case FULL_POWER:
     case REQUEST_FULL_POWER:
     default:
         //No need to ask for full power. This has to be FULL_POWER state
         break;
+
     } //switch
+
     if( pReason )
     {
         *pReason = reason;
@@ -14460,32 +14770,41 @@
     {
         *pfNeedPower = fNeedFullPower;
     }
+
     return ( status );
 }
 
+
 static eHalStatus csrRequestFullPower( tpAniSirGlobal pMac, tSmeCmd *pCommand )
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE;
     tRequestFullPowerReason reason = eSME_REASON_OTHER;
+
     status = csrIsFullPowerNeeded( pMac, pCommand, &reason, &fNeedFullPower );
+
     if( fNeedFullPower && HAL_STATUS_SUCCESS( status ) )
     {
         status = pmcRequestFullPower(pMac, csrFullPowerCallback, pMac, reason);
     }
+
     return ( status );
 }
 
+
 tSmeCmd *csrGetCommandBuffer( tpAniSirGlobal pMac )
 {
     tSmeCmd *pCmd = smeGetCommandBuffer( pMac );
+
     if( pCmd )
     {
         pMac->roam.sPendingCommands++;
     }
+
     return ( pCmd );
 }
 
+
 void csrReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand)
 {
    if (pMac->roam.sPendingCommands > 0)
@@ -14502,10 +14821,12 @@
    }
 }
 
+
 //Return SUCCESS is the command is queued, failed
 eHalStatus csrQueueSmeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fHighPriority )
 {
     eHalStatus status;
+
     if( (eSmeCommandScan == pCommand->command) && pMac->scan.fDropScanCmd )
     {
         smsLog(pMac, LOGW, FL(" drop scan (scan reason %d) command"),
@@ -14519,6 +14840,7 @@
     if( HAL_STATUS_SUCCESS( status ) )
     {
         tANI_BOOLEAN fNoCmdPending;
+
         //make sure roamCmdPendingList is not empty first
         fNoCmdPending = csrLLIsListEmpty( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_FALSE );
         if( fNoCmdPending )
@@ -14557,8 +14879,11 @@
         //release the command.
         smsLog( pMac, LOGE, FL( "  cannot queue command %d\n" ), pCommand->command );
     }
+
     return ( status );
+
 }
+
 #ifdef WLAN_SOFTAP_FEATURE
 eHalStatus csrRoamUpdateAPWPSIE( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirAPWPSIEs* pAPWPSIES )
 {
@@ -14573,6 +14898,7 @@
         return eHAL_STATUS_FAILURE;
     }
 
+
     do
     {
         status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPSIEsReq) );
@@ -14582,42 +14908,55 @@
 
         pBuf = (tANI_U8 *)&pMsg->transactionId;
         wTmpBuf = pBuf;
+
         // transactionId
         *pBuf = 0;
         *( pBuf + 1 ) = 0;
         pBuf += sizeof(tANI_U16);
+
         // bssId
         palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) );
         pBuf += sizeof(tSirMacAddr);
+
         //sessionId
         *pBuf++ = (tANI_U8)sessionId;
+
         // APWPSIEs
         palCopyMemory( pMac->hHdd, (tSirAPWPSIEs *)pBuf, pAPWPSIES, sizeof(tSirAPWPSIEs));
         pBuf += sizeof(tSirAPWPSIEs);
+
         pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32) + (pBuf - wTmpBuf))); //msg_header + msg
+
         status = palSendMBMessage(pMac->hHdd, pMsg);
+
     } while( 0 );
+
     return ( status );
 }
+
 eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirRSNie * pAPSirRSNie)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tSirUpdateAPWPARSNIEsReq *pMsg;
     tANI_U8 *pBuf = NULL, *wTmpBuf = NULL;
+
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
     if (NULL == pSession)
     {
         smsLog( pMac, LOGE, FL( "  Session does not exist for session id %d" ), sessionId);
         return eHAL_STATUS_FAILURE;
     }
+
     do
     {
         status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, sizeof(tSirUpdateAPWPARSNIEsReq) );
         if (!HAL_STATUS_SUCCESS(status)) break;
         palZeroMemory( pMac->hHdd, pMsg, sizeof( tSirUpdateAPWPARSNIEsReq ) );
         pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SET_APWPARSNIEs_REQ);
+
         pBuf = (tANI_U8 *)&pMsg->transactionId;
         wTmpBuf = pBuf;
+
         // transactionId
         *pBuf = 0;
         *( pBuf + 1 ) = 0;
@@ -14626,17 +14965,23 @@
         // bssId
         palCopyMemory( pMac->hHdd, (tSirMacAddr *)pBuf, &pSession->selfMacAddr, sizeof(tSirMacAddr) );
         pBuf += sizeof(tSirMacAddr);
+
         // sessionId
         *pBuf++ = (tANI_U8)sessionId;
     
         // APWPARSNIEs
         palCopyMemory( pMac->hHdd, (tSirRSNie *)pBuf, pAPSirRSNie, sizeof(tSirRSNie));
         pBuf += sizeof(tSirRSNie);
+
         pMsg->length = pal_cpu_to_be16((tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf))); //msg_header + msg
+
     status = palSendMBMessage(pMac->hHdd, pMsg);
+
     } while( 0 );
+
     return ( status );
 }
+
 #endif //#ifdef WLAN_SOFTAP_FEATURE
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
@@ -14647,6 +14992,7 @@
     tpSirFTPreAuthReq pftPreAuthReq;
     tANI_U16 auth_req_len = 0;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
+
     auth_req_len = sizeof(tSirFTPreAuthReq);
     pftPreAuthReq = (tpSirFTPreAuthReq)vos_mem_malloc(auth_req_len);
     if (pftPreAuthReq == NULL)
@@ -14654,8 +15000,10 @@
         smsLog(pMac, LOGE, FL("Memory allocation for FT Preauth request failed"));
         return eHAL_STATUS_RESOURCES;
     }
+
     // Save the SME Session ID here. We need it while processing the preauth response
     pMac->ft.ftSmeContext.smeSessionId = sessionId;
+
     vos_mem_zero(pftPreAuthReq, auth_req_len);
 
     pftPreAuthReq->pbssDescription = (tpSirBssDescription)vos_mem_malloc(
@@ -14665,9 +15013,12 @@
 
     pftPreAuthReq->preAuthchannelNum = pBssDescription->channelId;
 
+
     palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->currbssId, (void *)pSession->connectedProfile.bssid, sizeof(tSirMacAddr));
+
     palCopyMemory(pMac->hHdd, (void *)&pftPreAuthReq->preAuthbssId, (void *)pBssDescription->bssId, sizeof(tSirMacAddr));  
 
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
     if (csrRoamIs11rAssoc(pMac))
     {
@@ -14680,11 +15031,15 @@
     {
         pftPreAuthReq->ft_ies_length = 0; 
     }
-    vos_mem_copy(pftPreAuthReq->pbssDescription, pBssDescription,
-                 sizeof(pBssDescription->length) + pBssDescription->length);
-    pftPreAuthReq->length = pal_cpu_to_be16(auth_req_len); 
+
+    vos_mem_copy(pftPreAuthReq->pbssDescription, pBssDescription, pBssDescription->length);
+
+    pftPreAuthReq->length = pal_cpu_to_be16(sizeof(tSirFTPreAuthReq) + sizeof(pBssDescription->length) +
+                                                    pBssDescription->length); 
+
     return palSendMBMessage(pMac->hHdd, pftPreAuthReq);
 }
+
 /*--------------------------------------------------------------------------
  * This will receive and process the FT Pre Auth Rsp from the current 
  * associated ap. 
@@ -14696,31 +15051,26 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     eHalStatus  status = eHAL_STATUS_SUCCESS;
-#ifdef FEATURE_WLAN_LFR
-    tCsrRoamInfo roamInfo;
-#endif
 
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
     smsLog( pMac, LOGE, FL("Preauth response status code %d"), pFTPreAuthRsp->status); 
 #endif
-#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
-    status = csrNeighborRoamPreauthRspHandler(pMac, (VOS_STATUS)pFTPreAuthRsp->status);
-    if (status != eHAL_STATUS_SUCCESS) {
-        /*
-         * Bail out if pre-auth was not even processed.
-         */
-        smsLog(pMac, LOGW, FL("Preauth was not processed: %d"), status);
-        return;
-    }
+
+#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING    
+    csrNeighborRoamPreauthRspHandler(pMac, (VOS_STATUS)pFTPreAuthRsp->status);
 #endif
+
     /* The below function calls/timers should be invoked only if the pre-auth is successful */
     if (VOS_STATUS_SUCCESS != (VOS_STATUS)pFTPreAuthRsp->status)
         return;
+
     // Implies a success
     pMac->ft.ftSmeContext.FTState = eFT_AUTH_COMPLETE;
+
     // Indicate SME QoS module the completion of Preauth success. This will trigger the creation of RIC IEs
     pMac->ft.ftSmeContext.psavedFTPreAuthRsp = pFTPreAuthRsp;
     sme_QosCsrEventInd(pMac, pMac->ft.ftSmeContext.smeSessionId, SME_QOS_CSR_PREAUTH_SUCCESS_IND, NULL);
+
     /* Start the pre-auth reassoc interval timer with a period of 400ms. When this expires, 
      * actual transition from the current to handoff AP is triggered */
     status = palTimerStart(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer,
@@ -14731,6 +15081,7 @@
         smsLog(pMac, LOGE, FL("Preauth reassoc interval timer start failed to start with status %d\n"), status);
         return;
     }
+
     // Save the received response
     palCopyMemory(pMac->hHdd, (void *)&pMac->ft.ftSmeContext.preAuthbssId, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid));
     if (csrRoamIs11rAssoc(pMac))
@@ -14738,17 +15089,7 @@
                         eCSR_ROAM_FT_RESPONSE, eCSR_ROAM_RESULT_NONE);
 
     // Currently we dont do anything special for CCX connection.
-#ifdef FEATURE_WLAN_LFR
-    // If Legacy Fast Roaming is enabled, signal the supplicant  
-    // So he can send us a PMK-ID for this candidate AP.
-    if (csrRoamIsFastRoamEnabled(pMac))
-    {
-        // Save the bssid from the received response 
-        palCopyMemory(pMac->hHdd, (void *)&roamInfo.bssid, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid));
-        csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_PMK_NOTIFY, 0);
-    }
-
-#endif
+    
 
     // Done with it, init it.
     pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL;
@@ -14775,6 +15116,7 @@
         }
     }
 }
+
 eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval)
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
@@ -14800,6 +15142,7 @@
     
     return (status);
 }
+
 eHalStatus csrRoamStopJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     smsLog(pMac, LOGE, " csrRoamStopJoinRetryTimer \n ");
@@ -14838,34 +15181,3 @@
    }
 }
 
-eHalStatus csrGetDefaultCountryCodeFrmNv(tpAniSirGlobal pMac, tANI_U8 *pCountry)
-{
-   static uNvTables nvTables;
-   eHalStatus status = eHAL_STATUS_SUCCESS;
-   VOS_STATUS vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
-
-   /* read the country code from NV and use it */
-   if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
-   {
-      palCopyMemory( pMac->hHdd, pCountry,
-            nvTables.defaultCountryTable.countryCode,
-            WNI_CFG_COUNTRY_CODE_LEN );
-      return status;
-   }
-   else
-   {
-      palCopyMemory( pMac->hHdd, pCountry,
-            "XXX",
-            WNI_CFG_COUNTRY_CODE_LEN );
-      status = eHAL_STATUS_FAILURE;
-      return status;
-   }
-}
-
-eHalStatus csrGetCurrentCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry)
-{
-   palCopyMemory( pMac->hHdd, pCountry,
-         pMac->scan.countryCode11d,
-         WNI_CFG_COUNTRY_CODE_LEN );
-   return eHAL_STATUS_SUCCESS;
-}
diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c b/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c
index 4c07a7c..7892396 100644
--- a/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c
+++ b/drivers/staging/prima/CORE/SME/src/csr/csrApiScan.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -84,8 +84,6 @@
 #define CSR_SCAN_MAX_SCORE_VAL 0xFF
 #define CSR_SCAN_MIN_SCORE_VAL 0x0
 #define CSR_SCAN_HANDOFF_DELTA 10
-#define MAX_ACTIVE_SCAN_FOR_ONE_CHANNEL 140
-#define MIN_ACTIVE_SCAN_FOR_ONE_CHANNEL 120
 #define CSR_SCAN_OVERALL_SCORE( rssi ) \
   ( rssi < CSR_SCAN_MAX_SCORE_VAL )\
    ? (CSR_SCAN_MAX_SCORE_VAL-rssi) : CSR_SCAN_MIN_SCORE_VAL
@@ -104,7 +102,6 @@
 #ifdef WLAN_AP_STA_CONCURRENCY
 static void csrStaApConcTimerHandler(void *);
 #endif
-tANI_BOOLEAN csrIsSupportedChannel(tpAniSirGlobal pMac, tANI_U8 channelId);
 eHalStatus csrScanChannels( tpAniSirGlobal pMac, tSmeCmd *pCommand );
 void csrSetCfgValidChannelList( tpAniSirGlobal pMac, tANI_U8 *pChannelList, tANI_U8 NumChannels );
 void csrSaveTxPowerToCfg( tpAniSirGlobal pMac, tDblLinkList *pList, tANI_U32 cfgId );
@@ -122,9 +119,6 @@
 tANI_BOOLEAN csrRoamIsValidChannel( tpAniSirGlobal pMac, tANI_U8 channel );
 void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList );
 
-#define CSR_IS_SOCIAL_CHANNEL(channel) (((channel) == 1) || ((channel) == 6) || ((channel) == 11) )
-
-
 //pResult is invalid calling this function.
 void csrFreeScanResultEntry( tpAniSirGlobal pMac, tCsrScanResult *pResult )
 {
@@ -498,49 +492,12 @@
 }
 #endif
 
-/* ---------------------------------------------------------------------------
-    \fn csrScan2GOnyRequest
-    \brief This function will update the scan request with only 
-           2.4GHz valid cahnnel list.
-    \param pMac
-    \param pScanCmd
-    \param pScanRequest
-    \return None
-  -------------------------------------------------------------------------------*/
-static void csrScan2GOnyRequest(tpAniSirGlobal pMac,tSmeCmd *pScanCmd, 
-                                tCsrScanRequest *pScanRequest)
-{
-    tANI_U8 index, channelId, channelListSize = 0;
-    tANI_U8 channelList2G[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
-    static tANI_U8 validchannelList[CSR_MAX_2_4_GHZ_SUPPORTED_CHANNELS] = {0};
-
-    VOS_ASSERT(pScanCmd && pScanRequest);
-
-    if (pScanCmd->u.scanCmd.scanID ||
-       (eCSR_SCAN_REQUEST_FULL_SCAN != pScanRequest->requestType))
-           return;
-
-    //Contsruct valid Supported 2.4 GHz Channel List
-    for( index = 0; index < ARRAY_SIZE(channelList2G); index++ )
-    {
-        channelId = channelList2G[index];
-        if ( csrIsSupportedChannel( pMac, channelId ) )
-        {
-            validchannelList[channelListSize++] = channelId;
-        }
-    }
-
-    pScanRequest->ChannelInfo.numOfChannels = channelListSize;
-    pScanRequest->ChannelInfo.ChannelList = validchannelList;
-}
-
 eHalStatus csrScanRequest(tpAniSirGlobal pMac, tANI_U16 sessionId, 
               tCsrScanRequest *pScanRequest, tANI_U32 *pScanRequestID, 
               csrScanCompleteCallback callback, void *pContext)
 {
     eHalStatus status = eHAL_STATUS_FAILURE;
     tSmeCmd *pScanCmd = NULL;
-	eCsrConnectState ConnectState;
     
     do
     {
@@ -599,20 +556,6 @@
                         pScanRequest->minChnTime = pMac->roam.configParam.nPassiveMinChnTime;
                     }
                 }
-                 /*For Standalone wlan : channel time will remain the same.
-                                  For BTC with A2DP up: Channel time = Channel time * 2 , if station is not already associated.
-                                  This has been done to provide a larger scan window for faster connection during btc.Else Scan is seen
-                                  to take a long time.
-                                  For BTC with A2DP up: Channel time will not be doubled, if station is already associated.
-                               */
-                status = csrRoamGetConnectState(pMac,sessionId,&ConnectState);
-                if(pMac->btc.fA2DPUp && 
-                   (eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED != ConnectState) &&
-                   (eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED != ConnectState))
-                {
-                    pScanRequest->maxChnTime = pScanRequest->maxChnTime << 1;
-                    pScanRequest->minChnTime = pScanRequest->minChnTime << 1;
-                }  
                 //Need to make the following atomic
                 pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
                 
@@ -680,7 +623,6 @@
                             scanReq.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
                             scanReq.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
                         }
-
                         status = csrScanCopyRequest(pMac, &p11dScanCmd->u.scanCmd.u.scanRequest, &scanReq);
                         //Free the channel list
                         palFreeMemory( pMac->hHdd, pChnInfo->ChannelList );
@@ -710,15 +652,6 @@
                         break;
                     }
                 }
-
-                //Scan only 2G Channels if set in ini file
-                //This is mainly to reduce the First Scan duration
-                //Once we turn on Wifi
-                if(pMac->scan.fFirstScanOnly2GChnl)
-                {
-                    csrScan2GOnyRequest(pMac, pScanCmd, pScanRequest);
-                }
-
                 status = csrScanCopyRequest(pMac, &pScanCmd->u.scanCmd.u.scanRequest, pScanRequest);
                 if(HAL_STATUS_SUCCESS(status))
                 {
@@ -829,12 +762,6 @@
     tCsrRoamProfile *pProfile = NULL;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-
     do
     {
         smsLog(pMac, LOG1, " csrIssueRoamAfterLostlinkScan called\n");
@@ -903,7 +830,7 @@
 }
 
 
-eHalStatus csrScanGetScanChnInfo(tpAniSirGlobal pMac, void *callback, void *pContext)
+eHalStatus csrScanGetScanChnInfo(tpAniSirGlobal pMac)
 {
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tSmeCmd *pScanCmd;
@@ -915,8 +842,8 @@
         {
             pScanCmd->command = eSmeCommandScan;
             palZeroMemory(pMac->hHdd, &pScanCmd->u.scanCmd, sizeof(tScanCmd));
-            pScanCmd->u.scanCmd.callback = callback;
-            pScanCmd->u.scanCmd.pContext = pContext;
+            pScanCmd->u.scanCmd.callback = NULL;
+            pScanCmd->u.scanCmd.pContext = NULL;
             pScanCmd->u.scanCmd.reason = eCsrScanGetScanChnInfo;
             //Need to make the following atomic
             pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
@@ -944,12 +871,6 @@
     eHalStatus status = eHAL_STATUS_FAILURE;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-
     smsLog(pMac, LOGW, "  Lostlink scan 1 failed\n");
     if(pSession->fCancelRoaming)
     {
@@ -995,12 +916,6 @@
     eHalStatus status = eHAL_STATUS_FAILURE;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-
     smsLog(pMac, LOGW, "  Lostlink scan 2 failed\n");
     if(pSession->fCancelRoaming)
     {
@@ -1055,12 +970,6 @@
     tCsrScanResultInfo *pScanResult = NULL;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-
     smsLog(pMac, LOGW, FL(" called\n"));
     do
     {
@@ -1215,12 +1124,6 @@
     tSmeCmd *pCommand = NULL;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-
     smsLog(pMac, LOGW, FL(" called\n"));
     do
     {
@@ -1454,12 +1357,6 @@
     tCsrRoamProfile *pProfile = pCommand->u.scanCmd.pToRoamProfile;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-
 #if defined(WLAN_DEBUG)
     if(pCommand->u.scanCmd.u.scanRequest.SSIDs.numOfSSIDs == 1)
     {
@@ -1513,13 +1410,6 @@
                                     eCSR_ROAM_ASSOCIATION_COMPLETION,
                                     eCSR_ROAM_RESULT_FAILURE);
             }
-            else
-            {
-                csrRoamCallCallback(pMac, sessionId, NULL,
-                                    pCommand->u.scanCmd.roamId,
-                                    eCSR_ROAM_ASSOCIATION_FAILURE,
-                                    eCSR_ROAM_RESULT_FAILURE);
-            }
 #ifdef FEATURE_WLAN_BTAMP_UT_RF
             //In case of WDS station, let it retry.
             if( CSR_IS_WDS_STA(pProfile) )
@@ -1717,35 +1607,6 @@
 }
 
 
-#ifdef FEATURE_WLAN_LFR 
-//Add the channel to the occupiedChannels array
-static void csrScanAddToOccupiedChannels(
-        tpAniSirGlobal pMac, 
-        tCsrScanResult *pResult, 
-        tCsrChannel *pOccupiedChannels, 
-        tDot11fBeaconIEs *pIes)
-{
-    eHalStatus status;
-    tANI_U8   channel;
-    tANI_U8 numOccupiedChannels = pOccupiedChannels->numChannels;
-    tANI_U8 *pOccupiedChannelList = pOccupiedChannels->channelList;
-
-    channel = pResult->Result.BssDescriptor.channelId;
-
-    if (!csrIsChannelPresentInList(pOccupiedChannelList, numOccupiedChannels, channel)
-        && csrNeighborRoamIsSsidCandidateMatch(pMac, pIes)) 
-    {
-        status = csrAddToChannelListFront(pOccupiedChannelList, numOccupiedChannels, channel); 
-        if(HAL_STATUS_SUCCESS(status))
-        { 
-            pOccupiedChannels->numChannels++;
-            if (pOccupiedChannels->numChannels > CSR_BG_SCAN_OCCUPIED_CHANNEL_LIST_LEN) 
-                pOccupiedChannels->numChannels = CSR_BG_SCAN_OCCUPIED_CHANNEL_LIST_LEN; 
-        } 
-    }
-}
-#endif
-
 //Put the BSS into the scan result list
 //pIes can not be NULL
 static void csrScanAddResult(tpAniSirGlobal pMac, tCsrScanResult *pResult, tDot11fBeaconIEs *pIes)
@@ -1753,9 +1614,6 @@
     pResult->preferValue = csrGetBssPreferValue(pMac, (int)pResult->Result.BssDescriptor.rssi);
     pResult->capValue = csrGetBssCapValue(pMac, &pResult->Result.BssDescriptor, pIes);
     csrLLInsertTail( &pMac->scan.scanResultList, &pResult->Link, LL_ACCESS_LOCK );
-#ifdef FEATURE_WLAN_LFR 
-    csrScanAddToOccupiedChannels(pMac, pResult, &pMac->scan.occupiedChannels, pIes);
-#endif
 }
 
 
@@ -1934,71 +1792,12 @@
     return (status);
 }
 
-/*
- * NOTE: This routine is being added to make
- * sure that scan results are not being flushed
- * while roaming. If the scan results are flushed,
- * we are unable to recover from
- * csrRoamRoamingStateDisassocRspProcessor.
- * If it is needed to remove this routine,
- * first ensure that we recover gracefully from 
- * csrRoamRoamingStateDisassocRspProcessor if 
- * csrScanGetResult returns with a failure because 
- * of not being able to find the roaming BSS.
- */
-tANI_U8 csrScanFlushDenied(tpAniSirGlobal pMac)
-{
-    switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
-        case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
-        case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
-        case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
-        case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
-            return (pMac->roam.neighborRoamInfo.neighborRoamState);
-        default:
-            return 0;
-    }
-}
 
 eHalStatus csrScanFlushResult(tpAniSirGlobal pMac)
 {
-    tANI_U8 isFlushDenied = csrScanFlushDenied(pMac);
-    if (isFlushDenied) {
-        smsLog(pMac, LOGW, "%s: scan flush denied in roam state %d",
-                __func__, isFlushDenied);
-        return eHAL_STATUS_FAILURE;
-    }
     return ( csrLLScanPurgeResult(pMac, &pMac->scan.scanResultList) );
 }
 
-eHalStatus csrScanFlushP2PResult(tpAniSirGlobal pMac)
-{
-        eHalStatus status = eHAL_STATUS_SUCCESS;
-        tListElem *pEntry,*pFreeElem;
-        tCsrScanResult *pBssDesc;
-        tDblLinkList *pList = &pMac->scan.scanResultList;
-
-        csrLLLock(pList);
-
-        pEntry = csrLLPeekHead( pList, LL_ACCESS_NOLOCK );
-        while( pEntry != NULL)
-        {
-                pBssDesc = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
-                if( vos_mem_compare( pBssDesc->Result.ssId.ssId, "DIRECT-", 7) )
-                {
-                        pFreeElem = pEntry;
-                        pEntry = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
-                        csrLLRemoveEntry(pList, pFreeElem, LL_ACCESS_NOLOCK);
-                        csrFreeScanResultEntry( pMac, pBssDesc );
-                        continue;
-                }
-                pEntry = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
-        }
-
-        csrLLUnlock(pList);
-
-        return (status);
-}
-
 /**
  * csrCheck11dChannel
  *
@@ -2311,12 +2110,6 @@
     eHalStatus status = eHAL_STATUS_FAILURE;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-
     smsLog(pMac, LOGW, "csrAddPMKIDCandidateList called pMac->scan.NumPmkidCandidate = %d\n", pSession->NumPmkidCandidate);
     if( pIes )
     {
@@ -2418,12 +2211,6 @@
     eHalStatus status = eHAL_STATUS_FAILURE;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-
     smsLog(pMac, LOGW, "csrAddBKIDCandidateList called pMac->scan.NumBkidCandidate = %d\n", pSession->NumBkidCandidate);
     if( pIes )
     {
@@ -2526,7 +2313,7 @@
     {
         pBssDescription = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
 
-        smsLog( pMac, LOG2, "...Bssid= %02x-%02x-%02x-%02x-%02x-%02x chan= %d, rssi = -%d\n",
+        smsLog( pMac, LOGW, "...Bssid= %02x-%02x-%02x-%02x-%02x-%02x chan= %d, rssi = -%d\n",
                       pBssDescription->Result.BssDescriptor.bssId[ 0 ], pBssDescription->Result.BssDescriptor.bssId[ 1 ],
                       pBssDescription->Result.BssDescriptor.bssId[ 2 ], pBssDescription->Result.BssDescriptor.bssId[ 3 ],
                       pBssDescription->Result.BssDescriptor.bssId[ 4 ], pBssDescription->Result.BssDescriptor.bssId[ 5 ],
@@ -2734,7 +2521,7 @@
  * Save the channelList into the ultimate storage as the final stage of channel 
  * Input: pCountryInfo -- the country code (e.g. "USI"), channel list, and power limit are all stored inside this data structure
  */
-eHalStatus csrSaveToChannelPower2G_5G( tpAniSirGlobal pMac, tANI_U32 tableSize, tSirMacChanInfo *channelTable )
+void csrSaveToChannelPower2G_5G( tpAniSirGlobal pMac, tANI_U32 tableSize, tSirMacChanInfo *channelTable )
 {
     tANI_U32 i = tableSize / sizeof( tSirMacChanInfo );
     tSirMacChanInfo *pChannelInfo;
@@ -2755,27 +2542,16 @@
             pChannelSet->numChannels = pChannelInfo->numChannels;
 
             // Now set the inter-channel offset based on the frequency band the channel set lies in
-            if( (CSR_IS_CHANNEL_24GHZ(pChannelSet->firstChannel)) &&
-                    ((pChannelSet->firstChannel + (pChannelSet->numChannels - 1)) <= CSR_MAX_24GHz_CHANNEL_NUMBER) )
-
+            if( CSR_IS_CHANNEL_24GHZ(pChannelSet->firstChannel) )
             {
                 pChannelSet->interChannelOffset = 1;
                 f2GHzInfoFound = TRUE;
             }
-            else if ( (CSR_IS_CHANNEL_5GHZ(pChannelSet->firstChannel)) &&
-                ((pChannelSet->firstChannel + ((pChannelSet->numChannels - 1) * 4)) <= CSR_MAX_5GHz_CHANNEL_NUMBER) )
+            else
             {
                 pChannelSet->interChannelOffset = 4;
                 f2GHzInfoFound = FALSE;
             }
-            else
-            {
-                smsLog( pMac, LOGW, FL("Invalid Channel %d Present in Country IE"),
-                        pChannelSet->firstChannel);
-                palFreeMemory(pMac->hHdd, pChannelSet);
-                return eHAL_STATUS_FAILURE;
-            }
-
             pChannelSet->txPower = CSR_ROAM_MIN( pChannelInfo->maxTxPower, pMac->roam.configParam.nTxPowerCap );
 
             if( f2GHzInfoFound )
@@ -2824,7 +2600,7 @@
         pChannelInfo++;                // move to next entry
     }
 
-    return eHAL_STATUS_SUCCESS;
+    return;
 }
 
 
@@ -2849,35 +2625,29 @@
         tempNumChannels = CSR_MIN(pChannelList->numChannels, WNI_CFG_VALID_CHANNEL_LIST_LEN);
         /* If user doesn't want to scan the DFS channels lets trim them from 
         the valid channel list*/
-        for(i = 0; i< tempNumChannels; i++)
+        if(FALSE == pMac->scan.fEnableDFSChnlScan)
         {
-             if(FALSE == pMac->scan.fEnableDFSChnlScan)
-             {
+            for(i = 0; i< tempNumChannels; i++)
+            {
                  channelEnabledType = 
                      vos_nv_getChannelEnabledState(pChannelList->channelList[i]);
-             }
-             else
-             {
-                channelEnabledType = NV_CHANNEL_ENABLE;
-             }
-             if( NV_CHANNEL_ENABLE ==  channelEnabledType)
-             {
-                // Ignore the channel 165 for the country INDONESIA 
-                if ( vos_mem_compare(countryCode, "ID", VOS_COUNTRY_CODE_LEN ) 
-                      && ( pChannelList->channelList[i] == 165 )
-                      && ( pMac->scan.fIgnore_chan165 == VOS_TRUE ))
+                 if( NV_CHANNEL_ENABLE ==  channelEnabledType)
                  {
-                     continue;
-                 }
-                 else
-                 {
-                     ChannelList.channelList[numChannels] = pChannelList->channelList[i];
+                     ChannelList.channelList[numChannels] =
+                         pChannelList->channelList[i];
                      numChannels++;
                  }
-             }
+            }
+            ChannelList.numChannels = numChannels;
         }
-        ChannelList.numChannels = numChannels;   
-   
+        else
+        {
+            ChannelList.numChannels = tempNumChannels;
+             vos_mem_copy(ChannelList.channelList,
+                          pChannelList->channelList,
+                          ChannelList.numChannels);
+        }
+
         csrSetCfgValidChannelList(pMac, ChannelList.channelList, ChannelList.numChannels);
         // extend scan capability
         csrSetCfgScanControlList(pMac, countryCode, &ChannelList);     //  build a scan list based on the channel list : channel# + active/passive scan
@@ -3491,16 +3261,11 @@
                 }
             }
         }
-        smsLog(pMac, LOG3, FL("  %d sets each one is %d\n"), pIesLocal->Country.num_triplets, sizeof(tSirMacChanInfo));
+        smsLog(pMac, LOGE, FL("  %d sets each one is %d\n"), pIesLocal->Country.num_triplets, sizeof(tSirMacChanInfo));
         // save the channel/power information from the Channel IE.
         //sizeof(tSirMacChanInfo) has to be 3
-        if (eHAL_STATUS_SUCCESS != csrSaveToChannelPower2G_5G( pMac, pIesLocal->Country.num_triplets * sizeof(tSirMacChanInfo),
-                    (tSirMacChanInfo *)(&pIesLocal->Country.triplets[0]) ))
-        {
-            fRet = eANI_BOOLEAN_FALSE;
-            return fRet;
-        }
-
+        csrSaveToChannelPower2G_5G( pMac, pIesLocal->Country.num_triplets * sizeof(tSirMacChanInfo), 
+                                        (tSirMacChanInfo *)(&pIesLocal->Country.triplets[0]) );
         // set the indicator of the channel where the country IE was found...
         pMac->scan.channelOf11dInfo = pSirBssDesc->channelId;
         // Populate both band channel lists based on what we found in the country information...
@@ -4017,8 +3782,7 @@
     if(pCap1->ess == pCap2->ess)
     {
         if (pCap1->ess && 
-                csrIsMacAddressEqual( pMac, (tCsrBssid *)pSirBssDesc1->bssId, (tCsrBssid *)pSirBssDesc2->bssId)&&
-                (pSirBssDesc1->channelId == pSirBssDesc2->channelId))
+                csrIsMacAddressEqual( pMac, (tCsrBssid *)pSirBssDesc1->bssId, (tCsrBssid *)pSirBssDesc2->bssId))
         {
             fMatch = TRUE;
             // Check for SSID match, if exists
@@ -4124,12 +3888,6 @@
         case eCSR_DOT11_MODE_11n_ONLY:
             fAllowed = (tANI_BOOLEAN)((eCSR_DOT11_MODE_11n == phyMode) || (eCSR_DOT11_MODE_TAURUS == phyMode));
             break;
-
-#ifdef WLAN_FEATURE_11AC
-         case eCSR_DOT11_MODE_11ac_ONLY:
-             fAllowed = (tANI_BOOLEAN)((eCSR_DOT11_MODE_11ac == phyMode) || (eCSR_DOT11_MODE_TAURUS == phyMode));
-             break;
-#endif
         case eCSR_DOT11_MODE_11b_ONLY:
             fAllowed = (tANI_BOOLEAN)(eCSR_DOT11_MODE_11b == phyMode);
             break;
@@ -4137,9 +3895,6 @@
             fAllowed = (tANI_BOOLEAN)(eCSR_DOT11_MODE_11a == phyMode);
             break;
         case eCSR_DOT11_MODE_11n:
-#ifdef WLAN_FEATURE_11AC
-        case eCSR_DOT11_MODE_11ac:
-#endif
         case eCSR_DOT11_MODE_TAURUS:
         default:
             fAllowed = eANI_BOOLEAN_TRUE;
@@ -4401,15 +4156,7 @@
                     if( csrScanIsWildCardScan( pMac, pCommand ) && (!pCommand->u.scanCmd.u.scanRequest.p2pSearch) )
                     {
                         //Get the list of channels scanned
-                       if( pCommand->u.scanCmd.reason != eCsrScanUserRequest)
-                       {
-                           csrScanGetScanChnInfo(pMac, NULL, NULL);
-                       }
-                       else
-                       {
-                           csrScanGetScanChnInfo(pMac, pCommand->u.scanCmd.callback, pCommand->u.scanCmd.pContext);
-                           pCommand->u.scanCmd.callback = NULL;
-                       }
+                        csrScanGetScanChnInfo(pMac);
                     }
                 }
                 break;
@@ -4546,7 +4293,7 @@
                                                       pSession->pConnectBssDesc, NULL))
               )
             {
-                smsLog(pMac, LOG2, "Aging out BSS %02X-%02X-%02X-%02X-%02X-%02X Channel %d\n",
+                smsLog(pMac, LOGW, "Aging out BSS %02X-%02X-%02X-%02X-%02X-%02X Channel %d\n",
                                           pResult->Result.BssDescriptor.bssId[0],
                                           pResult->Result.BssDescriptor.bssId[1],
                                           pResult->Result.BssDescriptor.bssId[2],
@@ -4594,15 +4341,12 @@
             pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link );
             if(pResult->Result.BssDescriptor.channelId == pChnInfo->channelId)
             {
+                pResult->AgingCount--;
                 if(pResult->AgingCount <= 0)
                 {
                     smsLog(pMac, LOGW, " age out due to ref count");
                     csrScanAgeOutBss(pMac, pResult);
                 }
-                else
-                {
-                    pResult->AgingCount--;
-                }
             }
             pEntry = tmpEntry;
         }
@@ -4773,14 +4517,8 @@
             }
 #ifdef WLAN_FEATURE_P2P
             pMsg->p2pSearch = pScanReq->p2pSearch;
-            pMsg->skipDfsChnlInP2pSearch = pScanReq->skipDfsChnlInP2pSearch;
 #endif
 
-            if (pScanReq->requestType == eCSR_SCAN_HO_BG_SCAN) 
-            {
-                pMsg->backgroundScanMode = eSIR_ROAMING_SCAN;
-            } 
-
         }while(0);
         if(HAL_STATUS_SUCCESS(status))
         {
@@ -5223,15 +4961,7 @@
                         pMac->roam.numValidChannels = len;
                         for ( index = 0; index < pSrcReq->ChannelInfo.numOfChannels ; index++ )
                         {
-                            /* Allow scan on valid channels only.
-                             * If it is p2p scan and valid channel list doesnt contain 
-                             * social channels, enforce scan on social channels because
-                             * that is the only way to find p2p peers.
-                             * This can happen only if band is set to 5Ghz mode.
-                             */
-                            if((csrRoamIsValidChannel(pMac, pSrcReq->ChannelInfo.ChannelList[index])) || 
-                               ((eCSR_SCAN_P2P_DISCOVERY == pSrcReq->requestType) && 
-                                CSR_IS_SOCIAL_CHANNEL(pSrcReq->ChannelInfo.ChannelList[index])))
+                            if(csrRoamIsValidChannel(pMac, pSrcReq->ChannelInfo.ChannelList[index]))
                             {
                                 pDstReq->ChannelInfo.ChannelList[new_index] =
                                     pSrcReq->ChannelInfo.ChannelList[index];
@@ -5273,7 +5003,6 @@
             }//Allocate memory for SSID List
 #ifdef WLAN_FEATURE_P2P
             pDstReq->p2pSearch = pSrcReq->p2pSearch;
-            pDstReq->skipDfsChnlInP2pSearch = pSrcReq->skipDfsChnlInP2pSearch;
 #endif
 
         }
@@ -5323,7 +5052,7 @@
         pCommand->u.scanCmd.callback(pMac, pCommand->u.scanCmd.pContext, pCommand->u.scanCmd.scanID, scanStatus); 
 //        sme_AcquireGlobalLock( &pMac->sme );
     } else {
-        smsLog( pMac, LOG2, "%s:%d - Callback NULL!!!\n", __FUNCTION__, __LINE__);
+        smsLog( pMac, LOGW, "%s:%d - Callback NULL!!!\n", __FUNCTION__, __LINE__);
     }
 }
 
@@ -5683,7 +5412,7 @@
     //Do not trigger IMPS in case of concurrency
     if (vos_concurrent_sessions_running() && csrIsAnySessionInConnectState(pMac))
     {
-        smsLog( pMac, LOG1, FL("Cannot request IMPS because Concurrent Sessions Running\n") );
+        smsLog( pMac, LOGW, FL("Cannot request IMPS because Concurrent Sessions Running\n") );
         return (status);
     }
 
@@ -5692,10 +5421,10 @@
         *pTimeInterval = 0;
     }
 
-    smsLog(pMac, LOG3, FL("called\n"));
+    smsLog(pMac, LOGW, FL("called\n"));
     if( smeCommandPending( pMac ) )
     {
-        smsLog( pMac, LOG1, FL("  Cannot request IMPS because command pending\n") );
+        smsLog( pMac, LOGW, FL("  Cannot request IMPS because command pending\n") );
         //Not to enter IMPS because more work to do
         if(pTimeInterval)
         {
@@ -5983,12 +5712,6 @@
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-
     smsLog(pMac, LOGW, "  pMac->scan.NumPmkidCandidate = %d\n ", pSession->NumPmkidCandidate);
     csrResetPMKIDCandidateList(pMac, sessionId);
     if(csrIsConnStateConnected(pMac, sessionId) && pSession->pCurRoamProfile)
@@ -6042,12 +5765,6 @@
     eHalStatus status = eHAL_STATUS_SUCCESS;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return eHAL_STATUS_FAILURE;
-    }
-
     smsLog(pMac, LOGW, "  pMac->scan.NumBkidCandidate = %d\n ", pSession->NumBkidCandidate);
     csrResetBKIDCandidateList(pMac, sessionId);
     if(csrIsConnStateConnected(pMac, sessionId) && pSession->pCurRoamProfile)
@@ -6128,50 +5845,17 @@
                 break;
             pScanCmd->u.scanCmd.roamId = roamId;
             pScanCmd->command = eSmeCommandScan;
-            pScanCmd->sessionId = (tANI_U8)sessionId;
+            pScanCmd->sessionId = (tANI_U8)sessionId; 
             pScanCmd->u.scanCmd.callback = NULL;
             pScanCmd->u.scanCmd.pContext = NULL;
             pScanCmd->u.scanCmd.reason = eCsrScanForSsid;
             pScanCmd->u.scanCmd.scanID = pMac->scan.nextScanID++; //let it wrap around
             palZeroMemory(pMac->hHdd, &pScanCmd->u.scanCmd.u.scanRequest, sizeof(tCsrScanRequest));
             pScanCmd->u.scanCmd.u.scanRequest.scanType = eSIR_ACTIVE_SCAN;
+            pScanCmd->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
+            pScanCmd->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
             pScanCmd->u.scanCmd.u.scanRequest.BSSType = pProfile->BSSType;
-            // To avoid 11b rate in probe request Set p2pSearch flag as 1 for P2P Client Mode
-            if(VOS_P2P_CLIENT_MODE == pProfile->csrPersona)
-            {
-                pScanCmd->u.scanCmd.u.scanRequest.p2pSearch = 1;
-            }
-            if(pProfile->pAddIEScan)
-            {
-                status = palAllocateMemory(pMac->hHdd,
-                                (void **)&pScanCmd->u.scanCmd.u.scanRequest.pIEField,
-                                pProfile->nAddIEScanLength);
-                palZeroMemory(pMac->hHdd, pScanCmd->u.scanCmd.u.scanRequest.pIEField, pProfile->nAddIEScanLength);
-                if(HAL_STATUS_SUCCESS(status))
-                {
-                    palCopyMemory(pMac->hHdd, pScanCmd->u.scanCmd.u.scanRequest.pIEField, pProfile->pAddIEScan, pProfile->nAddIEScanLength);
-                    pScanCmd->u.scanCmd.u.scanRequest.uIEFieldLen = pProfile->nAddIEScanLength;
-                }
-                else
-                {
-                    smsLog(pMac, LOGE, "No memory for scanning IE fields\n");
-                }
-            } //Allocate memory for IE field
-            else
-            {
-                pScanCmd->u.scanCmd.u.scanRequest.uIEFieldLen = 0;
-            }
-            /* For one channel be good enpugh time to receive beacon atleast */
-            if(  1 == pProfile->ChannelInfo.numOfChannels )
-            {
-                 pScanCmd->u.scanCmd.u.scanRequest.maxChnTime = MAX_ACTIVE_SCAN_FOR_ONE_CHANNEL;
-                 pScanCmd->u.scanCmd.u.scanRequest.minChnTime = MIN_ACTIVE_SCAN_FOR_ONE_CHANNEL;
-            }
-            else
-            {
-                 pScanCmd->u.scanCmd.u.scanRequest.maxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
-                 pScanCmd->u.scanCmd.u.scanRequest.minChnTime = pMac->roam.configParam.nActiveMinChnTime;
-            }
+            pScanCmd->u.scanCmd.u.scanRequest.uIEFieldLen = 0;
             if(pProfile->BSSIDs.numOfBSSIDs == 1)
             {
                 palCopyMemory(pMac->hHdd, pScanCmd->u.scanCmd.u.scanRequest.bssid, pProfile->BSSIDs.bssid, sizeof(tCsrBssid));
@@ -6832,3 +6516,5 @@
 }
 
 
+
+
diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrCmdProcess.c b/drivers/staging/prima/CORE/SME/src/csr/csrCmdProcess.c
index 5bd7808..cd99696 100644
--- a/drivers/staging/prima/CORE/SME/src/csr/csrCmdProcess.c
+++ b/drivers/staging/prima/CORE/SME/src/csr/csrCmdProcess.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrInsideApi.h b/drivers/staging/prima/CORE/SME/src/csr/csrInsideApi.h
index 12e0ea1..3eb4c9a 100644
--- a/drivers/staging/prima/CORE/SME/src/csr/csrInsideApi.h
+++ b/drivers/staging/prima/CORE/SME/src/csr/csrInsideApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -51,9 +51,7 @@
 
 #define CSR_MAX_NUM_SUPPORTED_CHANNELS 55
 
-#define CSR_MAX_2_4_GHZ_SUPPORTED_CHANNELS 14
-
-#define CSR_MAX_BSS_SUPPORT            150
+#define CSR_MAX_BSS_SUPPORT            100
 
 //This number minus 1 means the number of times a channel is scanned before a BSS is remvoed from
 //cache scan result
@@ -370,7 +368,7 @@
 #ifdef FEATURE_WLAN_WAPI
 void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId );
 #endif /* FEATURE_WLAN_WAPI */
-eHalStatus csrSaveToChannelPower2G_5G( tpAniSirGlobal pMac, tANI_U32 tableSize, tSirMacChanInfo *channelTable );
+void csrSaveToChannelPower2G_5G( tpAniSirGlobal pMac, tANI_U32 tableSize, tSirMacChanInfo *channelTable );
 //Get the list of the base channels to scan for passively 11d info
 eHalStatus csrScanGetSupportedChannels( tpAniSirGlobal pMac );
 //To check whether a country code matches the one in the IE
@@ -447,7 +445,7 @@
     \return eHalStatus     
   -------------------------------------------------------------------------------*/
 eHalStatus csrScanFlushResult(tpAniSirGlobal);
-eHalStatus csrScanFlushP2PResult(tpAniSirGlobal);
+
 /* ---------------------------------------------------------------------------
     \fn csrScanBGScanGetParam
     \brief Returns the current background scan settings.
@@ -918,14 +916,5 @@
 #ifdef FEATURE_WLAN_CCX
 void csrCcxSendAdjacentApRepMsg(tpAniSirGlobal pMac, tCsrRoamSession *pSession);
 #endif
-
-eHalStatus csrGetDefaultCountryCodeFrmNv(tpAniSirGlobal pMac, tANI_U8 *pCountry);
-eHalStatus csrGetCurrentCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry);
-
-
-eHalStatus csrRoamEnqueuePreauth(tpAniSirGlobal pMac, tANI_U32 sessionId, tpSirBssDescription pBssDescription,
-                                eCsrRoamReason reason, tANI_BOOLEAN fImmediate);
-eHalStatus csrRoamDequeuePreauth(tpAniSirGlobal pMac);
-
 #endif
 
diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrLinkList.c b/drivers/staging/prima/CORE/SME/src/csr/csrLinkList.c
index 74d940f4..a2b08e8 100644
--- a/drivers/staging/prima/CORE/SME/src/csr/csrLinkList.c
+++ b/drivers/staging/prima/CORE/SME/src/csr/csrLinkList.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrLogDump.c b/drivers/staging/prima/CORE/SME/src/csr/csrLogDump.c
index aeb2b0b..26fb3eb 100644
--- a/drivers/staging/prima/CORE/SME/src/csr/csrLogDump.c
+++ b/drivers/staging/prima/CORE/SME/src/csr/csrLogDump.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrNeighborRoam.c b/drivers/staging/prima/CORE/SME/src/csr/csrNeighborRoam.c
index ffdd411..ed6d9cd 100644
--- a/drivers/staging/prima/CORE/SME/src/csr/csrNeighborRoam.c
+++ b/drivers/staging/prima/CORE/SME/src/csr/csrNeighborRoam.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -75,11 +75,6 @@
 #define NEIGHBOR_ROAM_DEBUG(x...)
 #endif
 
-static void csrNeighborRoamResetChannelInfo(tpCsrNeighborRoamChannelInfo rChInfo);
-static void csrNeighborRoamResetCfgListChanScanControlInfo(tpAniSirGlobal pMac);
-static void csrNeighborRoamResetPreauthControlInfo(tpAniSirGlobal pMac);
-static void csrNeighborRoamDeregAllRssiIndication(tpAniSirGlobal pMac);
-
 VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
                                                                                v_PVOID_t pUserCtxt);
 VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
@@ -97,7 +92,7 @@
 {\
     pMac->roam.neighborRoamInfo.prevNeighborRoamState = pMac->roam.neighborRoamInfo.neighborRoamState;\
     pMac->roam.neighborRoamInfo.neighborRoamState = newState;\
-    smsLog(pMac, LOG1, FL("Neighbor Roam Transition from state %d ==> %d"), pMac->roam.neighborRoamInfo.prevNeighborRoamState, newState);\
+    smsLog(pMac, LOGE, FL("Neighbor Roam Transition from state %d ==> %d"), pMac->roam.neighborRoamInfo.prevNeighborRoamState, newState);\
 }
 
 /* ---------------------------------------------------------------------------
@@ -209,7 +204,7 @@
 {
     tpCsrNeighborRoamBSSInfo pResult = NULL;
 
-    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Emptying the BSS list. Current count = %d\n"), csrLLCount(pList));
+    NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Emptying the BSS list. Current count = %d\n"), csrLLCount(pList));
 
     /* Pick up the head, remove and free the node till the list becomes empty */
     while ((pResult = csrNeighborRoamGetRoamableAPListNextEntry(pMac, pList, NULL)) != NULL)
@@ -264,7 +259,6 @@
     
     NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering UP event neighbor lookup callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1));
     /* Deregister reassoc callback. Ignore return status */
-    /*Varun TODO*/
     vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1),
                                                         WLANTL_HO_THRESHOLD_DOWN, 
                                                         csrNeighborRoamNeighborLookupUPCallback,
@@ -310,21 +304,6 @@
     }
     else
 #endif
-#ifdef FEATURE_WLAN_LFR
-    if (csrRoamIsFastRoamEnabled(pMac))
-    {
-        if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
-        {
-            csrNeighborRoamIssuePreauthReq(pMac);
-        }
-        else
-        {
-            smsLog(pMac, LOGE, FL("LFR Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
-            VOS_ASSERT(0);
-        }
-    }
-    else
-#endif
     {
         if (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN == pNeighborRoamInfo->neighborRoamState)
         {
@@ -339,140 +318,6 @@
     return VOS_STATUS_SUCCESS;
 }
 
-/*CleanUP Routines*/
-static void csrNeighborRoamResetChannelInfo(tpCsrNeighborRoamChannelInfo rChInfo)
-{
-        if ((rChInfo->IAPPNeighborListReceived == FALSE) &&
-                        (rChInfo->currentChannelListInfo.numOfChannels))
-    {
-                rChInfo->currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
-                rChInfo->currentChannelListInfo.numOfChannels = 0;
-
-                if (rChInfo->currentChannelListInfo.ChannelList)
-                        vos_mem_free(rChInfo->currentChannelListInfo.ChannelList);
-    
-                rChInfo->currentChannelListInfo.ChannelList = NULL;
-                rChInfo->chanListScanInProgress = eANI_BOOLEAN_FALSE;
-    }
-    else 
-    {
-                rChInfo->currentChanIndex = 0;
-                rChInfo->chanListScanInProgress = eANI_BOOLEAN_TRUE;
-        }
-    }
-
-static void csrNeighborRoamResetCfgListChanScanControlInfo(tpAniSirGlobal pMac)
-{
-        tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
-
-        /* Stop neighbor scan timer */
-    palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
-
-        /* Stop neighbor scan results refresh timer */
-        palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
-
-        /* Abort any ongoing scan */
-    if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
-    {
-                csrScanAbortMacScan(pMac);
-        }
-        pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
-
-        /* Reset roam channel list information */
-        csrNeighborRoamResetChannelInfo(&pNeighborRoamInfo->roamChannelInfo);
-    }
-
-static void csrNeighborRoamResetPreauthControlInfo(tpAniSirGlobal pMac)
-{
-        tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
-    
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
-        pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
-        pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimerInfo.pMac = pMac;
-        pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimerInfo.sessionId = 
-                CSR_SESSION_ID_INVALID;
-        /* Purge pre-auth fail list */
-        csrNeighborRoamPurgePreauthFailedList(pMac);
-#endif
-
-        pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE;
-        pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
-#ifdef WLAN_FEATURE_VOWIFI_11R
-    /* Do not free up the preauth done list here */
-    pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
-    pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
-    pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
-    vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
-    palTimerStop(pMac->hHdd, pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimer);
-#endif    
-}
-
-static void csrNeighborRoamDeregAllRssiIndication(tpAniSirGlobal pMac)
-{
-    tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
-    VOS_STATUS                    vosStatus = VOS_STATUS_SUCCESS;
-
-        NEIGHBOR_ROAM_DEBUG(pMac, LOG2, 
-                        FL("Deregister neighbor lookup UP callback with TL. RSSI = %d"), 
-                        pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1));
-
-        /* Deregister reassoc callback. Ignore return status */
-        vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, 
-                        (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1),
-                        WLANTL_HO_THRESHOLD_UP, 
-                        csrNeighborRoamNeighborLookupUPCallback,
-                        VOS_MODULE_ID_SME);
-    
-        if(!VOS_IS_STATUS_SUCCESS(vosStatus))
-        {
-                smsLog(pMac, LOGW, 
-                                FL("Couldn't deregister csrNeighborRoamNeighborLookupUPCallback "
-                                        "with TL: Status = %d\n"), vosStatus);
-        }
-
-        NEIGHBOR_ROAM_DEBUG(pMac, LOG2, 
-                        FL("Deregistering reassoc DOWN callback with TL. RSSI = %d"), 
-                        pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
-
-    /* Deregister reassoc callback. Ignore return status */
-        vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, 
-                        (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
-                                                        WLANTL_HO_THRESHOLD_DOWN, 
-                                                        csrNeighborRoamReassocIndCallback,
-                                                        VOS_MODULE_ID_SME);
-                        
-    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
-    {
-                smsLog(pMac, LOGW, 
-                                FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with "
-                                        "TL: Status = %d\n"), vosStatus);
-    }
-
-        NEIGHBOR_ROAM_DEBUG(pMac, LOG2, 
-                        FL("Deregistering neighborLookup DOWN callback with TL. RSSI = %d"), 
-                        pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
-
-    /* Deregister neighbor lookup callback. Ignore return status */
-        vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, 
-                        (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
-                                                        WLANTL_HO_THRESHOLD_DOWN, 
-                                                        csrNeighborRoamNeighborLookupDOWNCallback,
-                                                        VOS_MODULE_ID_SME);
-                        
-    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
-    {
-                smsLog(pMac, LOGW, 
-                                FL(" Couldn't deregister csrNeighborRoamNeighborLookupDOWNCallback "
-                                        "with TL: Status = %d\n"), vosStatus);
-    }
-
-        /* Reset thresholds only after deregistering DOWN event from TL */
-        pNeighborRoamInfo->currentNeighborLookupThreshold = 
-                pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
-        pNeighborRoamInfo->currentScanResultsRefreshPeriod = 
-            NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MIN;
-}
-                        
 /* ---------------------------------------------------------------------------
 
     \fn csrNeighborRoamResetConnectedStateControlInfo
@@ -487,14 +332,40 @@
 
 ---------------------------------------------------------------------------*/
 void csrNeighborRoamResetConnectedStateControlInfo(tpAniSirGlobal pMac)
-    {
+{
     tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
 
-    csrNeighborRoamResetChannelInfo(&pNeighborRoamInfo->roamChannelInfo);
-    csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
+    /* Do not reset the currentNeighborLookup Threshold here. The threshold and multiplier will be set before calling this API */
+    if ((pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == FALSE) &&
+        (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels))
+    {
+        pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
+        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
+
+        if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
+            vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
     
- /* We dont need to run this timer any more. */
-    palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);    
+        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
+        pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
+    }
+    else 
+    {
+        pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
+        pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
+    }
+
+    csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
+
+    palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
+
+    /* Abort any ongoing BG scans */
+    if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
+        csrScanAbortMacScan(pMac);
+
+    pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
+    
+    /* We dont need to run this timer any more. */
+    palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
     /* Do not free up the preauth done list here */
@@ -507,26 +378,6 @@
     palTimerStop(pMac->hHdd, pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimer);
 #endif
 
-    }
-    
-void csrNeighborRoamResetReportScanStateControlInfo(tpAniSirGlobal pMac)
-{
-    tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
-    pNeighborRoamInfo->csrSessionId            =   CSR_SESSION_ID_INVALID;
-    vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
-    pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
-    pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
-#ifdef FEATURE_WLAN_CCX
-    pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE;
-    pNeighborRoamInfo->isVOAdmitted = eANI_BOOLEAN_FALSE;
-    pNeighborRoamInfo->MinQBssLoadRequired = 0;
-#endif
-
-    /* Stop scan refresh timer */
-    palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
-     /* Purge roamable AP list */
-       csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList); 
-    return;
 }
 
 /* ---------------------------------------------------------------------------
@@ -544,14 +395,74 @@
 ---------------------------------------------------------------------------*/
 void csrNeighborRoamResetInitStateControlInfo(tpAniSirGlobal pMac)
 {
+    tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+    VOS_STATUS                    vosStatus = VOS_STATUS_SUCCESS;
+
     csrNeighborRoamResetConnectedStateControlInfo(pMac);
 
     /* In addition to the above resets, we should clear off the curAPBssId/Session ID in the timers */
-    csrNeighborRoamResetReportScanStateControlInfo(pMac);
+    pNeighborRoamInfo->csrSessionId            =   CSR_SESSION_ID_INVALID;
+    vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
+    pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
+    pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
+    pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
+    pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimerInfo.pMac = pMac;
+    pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
+    csrNeighborRoamPurgePreauthFailedList(pMac);
+#endif
+#ifdef FEATURE_WLAN_CCX
+    pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE;
+    pNeighborRoamInfo->isVOAdmitted = eANI_BOOLEAN_FALSE;
+    pNeighborRoamInfo->MinQBssLoadRequired = 0;
+#endif
+    
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
+    /* Deregister reassoc callback. Ignore return status */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
+                                                        WLANTL_HO_THRESHOLD_DOWN, 
+                                                        csrNeighborRoamReassocIndCallback,
+                                                        VOS_MODULE_ID_SME);
+                        
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        //err msg
+        smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d\n"), vosStatus);
+    }
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event neighborLookup callback with TL. RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
+    /* Deregister neighbor lookup callback. Ignore return status */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
+                                                        WLANTL_HO_THRESHOLD_DOWN, 
+                                                        csrNeighborRoamNeighborLookupDOWNCallback,
+                                                        VOS_MODULE_ID_SME);
+                        
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        //err msg
+        smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d\n"), vosStatus);
+    }
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering UP event neighbor lookup callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1));
+    /* Deregister reassoc callback. Ignore return status */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1),
+                                                        WLANTL_HO_THRESHOLD_UP, 
+                                                        csrNeighborRoamNeighborLookupUPCallback,
+                                                        VOS_MODULE_ID_SME);
+                        
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        //err msg
+        smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d\n"), vosStatus);
+    }
+    
+    /* Reset currentNeighborLookupThreshold only after deregistering DOWN event from TL */
+    pNeighborRoamInfo->currentLookupIncrementMultiplier = 0;
+    pNeighborRoamInfo->currentNeighborLookupThreshold = pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
+
+    return;
 }
 
-
-
 #ifdef WLAN_FEATURE_VOWIFI_11R
 /* ---------------------------------------------------------------------------
 
@@ -725,8 +636,7 @@
     }
     else
     {
-        status = csrRoamEnqueuePreauth(pMac, pNeighborRoamInfo->csrSessionId, pNeighborBssNode->pBssDescription,
-                eCsrPerformPreauth, eANI_BOOLEAN_TRUE);
+        status = csrRoamIssueFTPreauthReq(pMac, pNeighborRoamInfo->csrSessionId, pNeighborBssNode->pBssDescription); 
         if (eHAL_STATUS_SUCCESS != status)
         {
             smsLog(pMac, LOGE, FL("Send Preauth request to PE failed with status %d\n"), status);
@@ -741,7 +651,7 @@
     
     /* Transition the state to preauthenticating */
     CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING)
-#if 0    
+    
     /* Start the preauth rsp timer */
     status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimer, 
                    CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER * pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT,
@@ -751,7 +661,7 @@
         smsLog(pMac, LOGE, FL("Preauth response wait timer start failed with status %d\n"), status);
         return status;
     }
-#endif
+
     
     return status;
 }
@@ -770,48 +680,30 @@
     \param  pMac - The handle returned by macOpen.
             vosStatus - VOS_STATUS_SUCCESS/FAILURE/TIMEOUT status from PE
 
-    \return eHAL_STATUS_SUCCESS on success (i.e. pre-auth processed),
-            eHAL_STATUS_FAILURE otherwise
+    \return VOID
 
 ---------------------------------------------------------------------------*/
-eHalStatus csrNeighborRoamPreauthRspHandler(tpAniSirGlobal pMac, VOS_STATUS vosStatus)
+void csrNeighborRoamPreauthRspHandler(tpAniSirGlobal pMac, VOS_STATUS vosStatus)
 {
     tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
     eHalStatus  status = eHAL_STATUS_SUCCESS;
-    eHalStatus  preauthProcessed = eHAL_STATUS_SUCCESS;
     tpCsrNeighborRoamBSSInfo pPreauthRspNode = NULL;
-    
-    if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->FTRoamInfo.preauthRspPending)
-    {
-
-            /* This can happen when we disconnect immediately
-             * after sending a pre-auth request. During processing
-             * of the disconnect command, we would have reset
-             * preauthRspPending and transitioned to INIT state.
-             */
-            NEIGHBOR_ROAM_DEBUG(pMac, LOGW, 
-                                FL("Unexpected pre-auth response in state %d\n"), 
-                                pNeighborRoamInfo->neighborRoamState);
-            preauthProcessed = eHAL_STATUS_FAILURE;
-            goto DEQ_PREAUTH;
-    }    
 
     // We can receive it in these 2 states.
+    VOS_ASSERT((pNeighborRoamInfo->neighborRoamState == eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING) ||
+        (pNeighborRoamInfo->neighborRoamState == eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN));
+
     if ((pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING) &&
         (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN))
     {
-        NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Preauth response received in state %d\n"), 
-                            pNeighborRoamInfo->neighborRoamState);
-        preauthProcessed = eHAL_STATUS_FAILURE;
-        goto DEQ_PREAUTH;
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Preauth response received in state %\n"), 
+            pNeighborRoamInfo->neighborRoamState);
     }
 
     if (VOS_STATUS_E_TIMEOUT != vosStatus)
     {
-#if 0
         /* This means we got the response from PE. Hence stop the timer */
         status = palTimerStop(pMac->hHdd, pNeighborRoamInfo->FTRoamInfo.preAuthRspWaitTimer);
-#endif
         pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE;
     }
 
@@ -861,7 +753,7 @@
 
         /* Issue preauth request for the same/next entry */
         if (eHAL_STATUS_SUCCESS == csrNeighborRoamIssuePreauthReq(pMac))
-        goto DEQ_PREAUTH; 
+            return;
 
         CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
 
@@ -872,12 +764,9 @@
         if (eHAL_STATUS_SUCCESS != status)
         {
             smsLog(pMac, LOGE, FL("Neighbor results refresh timer start failed with status %d\n"), status);
+            return;
         }
     }
-
-DEQ_PREAUTH:
-    csrRoamDequeuePreauth(pMac);
-    return preauthProcessed;
 }
 #endif  /* WLAN_FEATURE_NEIGHBOR_ROAMING */
 
@@ -961,37 +850,6 @@
     return eHAL_STATUS_SUCCESS;
 }
 
-tANI_U32 csrGetCurrentAPRssi(tpAniSirGlobal pMac, tScanResultHandle *pScanResultList)
-{
-        tCsrScanResultInfo *pScanResult;
-        tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
-        tANI_U32 CurrAPRssi = -125; /* We are setting this as default value to make sure we return this value,
-                                       when we do not see this AP in the scan result for some reason.However,it is 
-                                       less likely that we are associated to an AP and do not see it in the scan list*/
-
-        while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList)))
-        {
-
-                if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId,
-                                                pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr)))
-                {
-                        /* We got a match with the currently associated AP.
-                         * Capture the RSSI value and complete the while loop.
-                         * The while loop is completed in order to make the current entry go back to NULL,
-                         * and in the next while loop, it properly starts searching from the head of the list.
-                         * TODO: Can also try setting the current entry directly to NULL as soon as we find the new AP*/
-
-                         CurrAPRssi = (int)pScanResult->BssDescriptor.rssi * (-1) ;
-
-                } else {
-                        continue;
-                }
-        }
-
-        return CurrAPRssi;
-
-}
-
 /* ---------------------------------------------------------------------------
 
     \fn csrNeighborRoamProcessScanResults
@@ -1011,16 +869,6 @@
     tCsrScanResultInfo *pScanResult;
     tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
     tpCsrNeighborRoamBSSInfo    pBssInfo;
-    tANI_U32 CurrAPRssi;
-    tANI_U8 RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff;
-
-    /***************************************************************
-     * Find out the Current AP RSSI and keep it handy to check if
-     * it is better than the RSSI of the AP which we are
-     * going to roam.If so, we are going to continue with the
-     * current AP.
-     ***************************************************************/
-    CurrAPRssi = csrGetCurrentAPRssi(pMac, pScanResultList);
 
     /* Expecting the scan result already to be in the sorted order based on the RSSI */
     /* Based on the previous state we need to check whether the list should be sorted again taking neighbor score into consideration */
@@ -1031,63 +879,29 @@
 
     while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList)))
     {
-        NEIGHBOR_ROAM_DEBUG(pMac, LOGE, 
-            FL("Scan result: BSSID %02x:%02x:%02x:%02x:%02x:%02x (Rssi %d)"), 
-            pScanResult->BssDescriptor.bssId[0],
-            pScanResult->BssDescriptor.bssId[1],
-            pScanResult->BssDescriptor.bssId[2],
-            pScanResult->BssDescriptor.bssId[3],
-            pScanResult->BssDescriptor.bssId[4],
-            pScanResult->BssDescriptor.bssId[5],
-            abs(pScanResult->BssDescriptor.rssi));
+        NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Scan result: BSSID : %02x:%02x:%02x:%02x:%02x:%02x"), 
+                        pScanResult->BssDescriptor.bssId[0],
+                        pScanResult->BssDescriptor.bssId[1],
+                        pScanResult->BssDescriptor.bssId[2],
+                        pScanResult->BssDescriptor.bssId[3],
+                        pScanResult->BssDescriptor.bssId[4],
+                        pScanResult->BssDescriptor.bssId[5]);
 
-       if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId, 
+        if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId, 
                        pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr)))
         {
-            /* currently associated AP. Do not have this in the roamable AP list */
+            //currently associated AP. Do not have this in the roamable AP list
             continue;
         }
 
-       /*
-        * If RSSI is lower than the lookup threshold, then continue.
-        */
-       if (abs(pScanResult->BssDescriptor.rssi) >
-           pNeighborRoamInfo->currentNeighborLookupThreshold)
-       {
-           VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-               "%s: [INFOLOG] new ap rssi (%d) lower than lookup threshold (%d)\n",
-               __func__, (int)pScanResult->BssDescriptor.rssi * (-1),
-               (int)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
-           continue;
-       }
-
-       /* This condition is to ensure to roam to an AP with better RSSI. if the value of RoamRssiDiff is Zero, this feature
-        * is disabled and we continue to roam without any check*/
-       if(RoamRssiDiff > 0)
-       {
-               if (abs(CurrAPRssi) < abs(pScanResult->BssDescriptor.rssi))
-               {
-                       /*Do not roam to an AP with worse RSSI than the current*/
-                       VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                                 "%s: [INFOLOG]Current AP rssi=%d new ap rssi worse=%d\n", __func__,
-                                 CurrAPRssi,
-                                 (int)pScanResult->BssDescriptor.rssi * (-1) );
-                       continue;
-               } else {
-                       /*Do not roam to an AP which is having better RSSI than the current AP, but still less than the
-                        * margin that is provided by user from the ini file (RoamRssiDiff)*/
-                       if (abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) < RoamRssiDiff)
-                       {
-                          continue;
-                       }
-                       else {
-                                 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
-                                            "%s: [INFOLOG]Current AP rssi=%d new ap rssi better=%d\n", __func__,
-                                            CurrAPRssi,
-                                            (int)pScanResult->BssDescriptor.rssi * (-1) );
-                       }
-               }
-       }
+        if (abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold) < abs(pScanResult->BssDescriptor.rssi))
+        {
+            VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
+                  "%s: [INFOLOG]Current reassoc threshold %d new ap rssi worse=%d\n", __func__,
+                      (int)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
+                      (int)pScanResult->BssDescriptor.rssi * (-1) );
+            continue;
+        }        
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
         if (pNeighborRoamInfo->is11rAssoc)
@@ -1148,19 +962,6 @@
         }
 #endif /* FEATURE_WLAN_CCX */
 
-#ifdef FEATURE_WLAN_LFR
-        // If we are supporting legacy roaming, and 
-        // if the candidate is on the "pre-auth failed" list, ignore it. 
-        if (csrRoamIsFastRoamEnabled(pMac))
-        {
-            if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
-            {
-                smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
-                continue;
-            }
-        }
-#endif /* FEATURE_WLAN_LFR */
-
         /* If the received timestamp in BSS description is earlier than the scan request timestamp, skip 
          * this result */
         if (pNeighborRoamInfo->scanRequestTimeStamp >= pScanResult->BssDescriptor.nReceivedTime)
@@ -1209,10 +1010,10 @@
                 there are no valid APs in the scan result for roaming. This means 
                 out AP is the best and no other AP is around. No point in scanning 
                 again and again. Performing the following here.
-                1. Remain in eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN.
-                2. Stop the neighbor scan timer.
-                3. Start neighbor scan results refresh timer.
-                4. Update currentScanResultsRefreshPeriod for next iteration.
+                1. Deregister the pre-auth callback from TL
+                2. Stop the neighbor scan timer
+                3. Re-register the neighbor lookup callback with increased pre-auth threshold
+                4. Transition the state to CONNECTED state
 
     \param  pMac - The handle returned by macOpen.
 
@@ -1221,47 +1022,47 @@
 ---------------------------------------------------------------------------*/
 static VOS_STATUS csrNeighborRoamHandleEmptyScanResult(tpAniSirGlobal pMac)
 {
+    VOS_STATUS  vosStatus = VOS_STATUS_SUCCESS;
     tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
     eHalStatus  status = eHAL_STATUS_SUCCESS;
 
-    /* Stop neighbor scan timer */
+    /* Stop the neighbor scan timer now */
     status = palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
-    if (eHAL_STATUS_SUCCESS != status) 
+    if (eHAL_STATUS_SUCCESS != status)
     {
         smsLog(pMac, LOGW, FL(" palTimerStop failed with status %d\n"), status);
     }
 
+    /* Increase the neighbor lookup threshold by a constant factor or 1 */
+    if ((pNeighborRoamInfo->currentNeighborLookupThreshold+3) < pNeighborRoamInfo->cfgParams.neighborReassocThreshold)
+    {
+        pNeighborRoamInfo->currentNeighborLookupThreshold += 3;
+    }
+
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
     /* Clear off the old neighbor report details */
     vos_mem_zero(&pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
 #endif
 
-    /* Start neighbor scan results refresh timer */
-    if (eHAL_STATUS_SUCCESS != 
-            palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer, 
-            pNeighborRoamInfo->currentScanResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT, 
-            eANI_BOOLEAN_FALSE)) 
-    {
-        smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start (%d)"), status);
-        vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
-        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
-        return VOS_STATUS_E_FAILURE;
-    }
-    smsLog(pMac, LOG1, FL("Neighbor results refresh timer started (%ld ms)"), 
-            (pNeighborRoamInfo->currentScanResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT));
+    /* Reset all the necessary variables before transitioning to the CONNECTED state */
+    csrNeighborRoamResetConnectedStateControlInfo(pMac);
 
-    /* Update currentScanResultsRefreshPeriod to be used for next iteration */
-    if ( (2*pNeighborRoamInfo->currentScanResultsRefreshPeriod) >
-            NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MAX ) 
+    /* Transition to CONNECTED state */
+    CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
+    /* Re-register Neighbor Lookup threshold callback with TL */
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event neighbor lookup callback with TL for RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1)); 
+    vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
+                                    WLANTL_HO_THRESHOLD_DOWN, 
+                                    csrNeighborRoamNeighborLookupDOWNCallback, 
+                                    VOS_MODULE_ID_SME, pMac);
+    
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
     {
-        pNeighborRoamInfo->currentScanResultsRefreshPeriod = 
-            NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MAX;
-    } else {
-        /* Double the refresh period every time we fail to find candidates */
-        pNeighborRoamInfo->currentScanResultsRefreshPeriod *= 2;
+       //err msg
+       smsLog(pMac, LOGW, FL(" Couldn't re-register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d\n"), status);
     }
-
-    return VOS_STATUS_SUCCESS;
+    return vosStatus;
 }
 
 /* ---------------------------------------------------------------------------
@@ -1326,7 +1127,7 @@
         NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel list scan completed. Current chan index = %d"), currentChanIndex);
         VOS_ASSERT(pNeighborRoamInfo->roamChannelInfo.currentChanIndex == 0);
 
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
         /* If the state is REPORT_SCAN, then this must be the scan after the REPORT_QUERY state. So, we 
            should use the BSSID filter made out of neighbor reports */
         if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
@@ -1361,13 +1162,6 @@
             case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
                 if (tempVal)
                 {
-                    /*
-                     * Since there are non-zero candidates found
-                     * after the scan, reset the refresh period
-                     * to minimum.
-                     */
-                    pNeighborRoamInfo->currentScanResultsRefreshPeriod = 
-                        NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MIN;
 #ifdef WLAN_FEATURE_VOWIFI_11R
                     /* If this is a non-11r association, then we can register the reassoc callback here as we have some 
                                         APs in the roamable AP list */
@@ -1388,16 +1182,6 @@
                     }
                     else
 #endif
-#ifdef FEATURE_WLAN_LFR
-                    /* If LFR is enabled, then we can register the reassoc callback here as we have some 
-                                        APs in the roamable AP list */
-                    if (csrRoamIsFastRoamEnabled(pMac))
-                    {
-                        /* Valid APs are found after scan. Now we can initiate pre-authentication */
-                        CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
-                    }
-                    else
-#endif
                     {
                        
                         NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Completed scanning of CFG CHAN LIST in non-11r association. Registering reassoc callback"));
@@ -1789,70 +1573,6 @@
 
 /* ---------------------------------------------------------------------------
 
-    \fn csrNeighborRoamMergeChannelLists 
-
-    \brief  This function is used to merge two channel list.
-            NB: If called with outputNumOfChannels == 0, this routines
-                simply copies the input channel list to the output channel list.
-
-    \param  pMac - The handle returned by macOpen.
-    \param  pInputChannelList - The addtional channels to merge in to the "merged" channels list.
-    \param  inputNumOfChannels - The number of additional channels.
-    \param  pOutputChannelList - The place to put the "merged" channel list.
-    \param  outputNumOfChannels - The original number of channels in the "merged" channels list.
-    \param  pMergedOutputNumOfChannels - The final number of channels in the "merged" channel list.
-
-    \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
-
----------------------------------------------------------------------------*/
-VOS_STATUS csrNeighborRoamMergeChannelLists( 
-        tpAniSirGlobal pMac, 
-        tANI_U8   *pInputChannelList, 
-        int inputNumOfChannels,
-        tANI_U8   *pOutputChannelList,
-        int outputNumOfChannels,
-        int *pMergedOutputNumOfChannels 
-        )
-{
-    int i = 0;
-    int j = 0;
-    int numChannels = outputNumOfChannels;
-
-    // Check for NULL pointer
-    if (!pInputChannelList) return eHAL_STATUS_E_NULL_VALUE;
-
-    // Check for NULL pointer
-    if (!pOutputChannelList) return eHAL_STATUS_E_NULL_VALUE;
-
-    // Add the "new" channels in the input list to the end of the output list.
-    for (i = 0; i < inputNumOfChannels; i++)
-    {
-        for (j = 0; j < outputNumOfChannels; j++)
-        {
-            if (pInputChannelList[i] == pOutputChannelList[j])
-                break;
-        }
-        if (j == outputNumOfChannels)
-        {
-            if (pInputChannelList[i])
-            {
-                VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
-                        "%s: [INFOLOG] Adding extra %d to Neighbor channel list\n", __func__, 
-                        pInputChannelList[i]); 
-                pOutputChannelList[numChannels] = pInputChannelList[i]; 
-                numChannels++; 
-            }
-        }
-    }
-
-    // Return final number of channels
-    *pMergedOutputNumOfChannels = numChannels; 
-
-    return eHAL_STATUS_SUCCESS;
-}
-
-/* ---------------------------------------------------------------------------
-
     \fn csrNeighborRoamCreateChanListFromNeighborReport
 
     \brief  This function is invoked when neighbor report is received for the 
@@ -1869,11 +1589,8 @@
 {
     tpRrmNeighborReportDesc pNeighborBssDesc;
     tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
-    tANI_U8         numChannels = 0, i = 0;
+    tANI_U8         numChannels = 0, i = 0, j=0;
     tANI_U8         channelList[MAX_BSS_IN_NEIGHBOR_RPT];
-#if 0
-    eHalStatus  status = eHAL_STATUS_SUCCESS;
-#endif
 
     /* This should always start from 0 whenever we create a channel list out of neighbor AP list */
     pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
@@ -1907,11 +1624,25 @@
         {
             if (pNeighborBssDesc->pNeighborBssDescription->channel)
             {
+                // Make sure to add only if its the same band
+                if ((pNeighborRoamInfo->currAPoperationChannel <= (RF_CHAN_14+1)) &&
+                    (pNeighborBssDesc->pNeighborBssDescription->channel <= (RF_CHAN_14+1)))
+                {
                         VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
                                 "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
                                 pNeighborBssDesc->pNeighborBssDescription->channel);
                         channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
                         numChannels++;
+                }
+                else if ((pNeighborRoamInfo->currAPoperationChannel >= RF_CHAN_128) &&
+                    (pNeighborBssDesc->pNeighborBssDescription->channel >= RF_CHAN_128))
+                {
+                        VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                                "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
+                                pNeighborBssDesc->pNeighborBssDescription->channel);
+                        channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
+                        numChannels++;
+                }
             }
         }
             
@@ -1920,18 +1651,43 @@
 
     if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
     {
-#if 0
         // Before we free the existing channel list for a safety net make sure
         // we have a union of the IAPP and the already existing list. 
-        status = csrNeighborRoamMergeChannelLists( 
-                pMac, 
-                pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList, 
-                pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels, 
-                channelList, 
-                numChannels, 
-                &numChannels );
-#endif
-
+        for (i = 0; i < pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels; i++)
+        {
+            for (j = 0; j < numChannels; j++)
+            {
+                if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i] == channelList[j])
+                    break;
+            }
+            if (j == numChannels)
+            {
+                if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i])
+                {
+                    // Make sure to add only if its the same band
+                    if ((pNeighborRoamInfo->currAPoperationChannel <= (RF_CHAN_14+1)) &&
+                        (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i] <= (RF_CHAN_14+1)))
+                    {
+                            VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                                    "%s: [INFOLOG] Adding extra %d to Neighbor channel list\n", __func__,
+                            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i]);
+                            channelList[numChannels] = 
+                            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i];
+                            numChannels++;
+                    }
+                    if ((pNeighborRoamInfo->currAPoperationChannel >= RF_CHAN_128) &&
+                         (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i] >= RF_CHAN_128))
+                    {
+                            VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, 
+                                    "%s: [INFOLOG] Adding extra %d to Neighbor channel list\n", __func__,
+                                pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i]);
+                            channelList[numChannels] = 
+                                pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i];
+                            numChannels++;
+                    }
+                }
+            }
+        }
         vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
     }
 
@@ -2060,109 +1816,6 @@
 #endif /* WLAN_FEATURE_VOWIFI_11R */
 
 
-#ifdef FEATURE_WLAN_LFR 
-tANI_BOOLEAN csrNeighborRoamIsSsidCandidateMatch( 
-        tpAniSirGlobal pMac, 
-        tDot11fBeaconIEs *pIes)
-{
-    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
-    tANI_U8 sessionId   = (tANI_U8)pNeighborRoamInfo->csrSessionId;
-    tCsrRoamConnectedProfile *pCurProfile;
-    tANI_BOOLEAN fMatch = FALSE;
-
-    if( !(pMac->roam.roamSession
-            && CSR_IS_SESSION_VALID(pMac, sessionId)))
-        return TRUE;  // Treat missing information as a match for everything. 
-
-    pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
-
-    if( !pCurProfile)
-        return TRUE;  // Treat missing information as a match for everything. 
-
-    if( pIes )
-    {
-        if(pIes->SSID.present)
-        {
-            fMatch = csrIsSsidMatch( pMac, (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length, 
-                    pIes->SSID.ssid, pIes->SSID.num_ssid, 
-                    eANI_BOOLEAN_TRUE ); // Treat a missing SSID as a non-match.
-            // Return the result of the match operation
-            return fMatch;  
-        } else
-            return FALSE;  // Treat a missing SSID as a non-match.
-    } else
-        return FALSE;  // Again, treat missing SSID information as a non-match. 
-}
-
-/* ---------------------------------------------------------------------------
-
-    \fn csrNeighborRoamReorderChannelList
-
-    \brief  This function is used to reorder the channel list used for the background
-            scan. It uses the information learned from previous scans to re-order the
-            scan channel list to "favor" the "occupied channels".  The actual algorithm
-            is to scan the current set of "occupied channels" first, for every BG scan,
-            followed by a "chunk" of the remaining list of "valid channels". 
-
-    \param  pMac - The handle returned by macOpen.
-    \param  pInputChannelList - The default channels list.
-    \param  numOfChannels - The number of channels in the default channels list.
-    \param  pOutputChannelList - The place to put the "re-ordered" channel list.
-    \param  pOutputNumOfChannels - The number of channels in the "re-ordered" channel list.
-
-    \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
-
----------------------------------------------------------------------------*/
-VOS_STATUS csrNeighborRoamReorderChannelList( 
-        tpAniSirGlobal pMac, 
-        tANI_U8   *pInputChannelList, 
-        int numOfChannels,
-        tANI_U8   *pOutputChannelList,
-        int *pOutputNumOfChannels 
-        )
-{
-    int i = 0;
-    int j = 0;
-    static int index = 0;
-    int outputNumOfChannels  = 0; // Clear the output number of channels
-    tANI_U8 numOccupiedChannels = pMac->scan.occupiedChannels.numChannels;
-    tANI_U8 *pOccupiedChannelList = pMac->scan.occupiedChannels.channelList;
-
-
-    // Copy over the "occupied channels" at the FRONT of pOutputChannelList.
-    for (i = 0; i < numOccupiedChannels; i++)
-    {
-        if (pOccupiedChannelList[i] != 0) 
-        {
-            pOutputChannelList[i] = pOccupiedChannelList[i]; 
-            outputNumOfChannels++;
-        }
-    }
-
-    // Copy over one "chunk" of channels from the "rest of the channels"...append them to the END of pOutputChannelList.
-    for (j = 0; j < CSR_BG_SCAN_VALID_CHANNEL_LIST_CHUNK_SIZE; j++)
-    {
-        if (!csrIsChannelPresentInList(pOccupiedChannelList, numOccupiedChannels, pInputChannelList[(j+index)%numOfChannels]))
-        {
-            pOutputChannelList[i] = pInputChannelList[(j+index)%numOfChannels]; 
-            i++;
-            outputNumOfChannels++;
-        }
-    }
-
-    //Let's update the index...at which we start retrieving the next chunk
-    index = (index + CSR_BG_SCAN_VALID_CHANNEL_LIST_CHUNK_SIZE) % numOfChannels; 
-
-    //VOS_ASSERT(numOfChannels == i);
-    smsLog(pMac, LOGE, FL("numOfChannels in the default channels list=%d. Number in the final list=%d."), numOfChannels, i);
-
-    // Return the number of channels
-    *pOutputNumOfChannels = outputNumOfChannels; 
-
-    return eHAL_STATUS_SUCCESS;
-}
-#endif /* FEATURE_WLAN_LFR */
-
 /* ---------------------------------------------------------------------------
 
     \fn csrNeighborRoamTransitToCFGChanScan
@@ -2183,12 +1836,12 @@
     eHalStatus  status  = eHAL_STATUS_SUCCESS;
     int i = 0;
     int numOfChannels = 0;
-    tANI_U8   channelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
+    tANI_U8   channelList[MAX_BSS_IN_NEIGHBOR_RPT];
 
-    if ( 
+    if (
 #ifdef FEATURE_WLAN_CCX
         ((pNeighborRoamInfo->isCCXAssoc) && 
-                    (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == eANI_BOOLEAN_FALSE)) ||
+        (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == eANI_BOOLEAN_FALSE)) ||
         (pNeighborRoamInfo->isCCXAssoc == eANI_BOOLEAN_FALSE) || 
 #endif // CCX
         pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels == 0)
@@ -2205,59 +1858,37 @@
             vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
             pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
         }
-        VOS_ASSERT( pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList == NULL);
-
-        // Now obtain the contents for "channelList" (the "default valid channel list") from EITHER
-        // the gNeighborScanChannelList in "cfg.ini", OR the actual "valid channel list" information formed by CSR.
-        if (0 != pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels)
+        // Find the right subset of the cfg list based on the current band we are on.
+        for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
         {
-            // Copy the "default valid channel list" (channelList) from the gNeighborScanChannelList in "cfg.ini".
-            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, "Using the channel list from cfg.ini");
-            status = csrNeighborRoamMergeChannelLists( 
-                    pMac, 
-                    pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, 
-                    pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels, 
-                    channelList, 
-                    0, //NB: If 0, simply copy the input channel list to the output list.
-                    &numOfChannels );
-        } 
-        else
+            if (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i])
             {
-            /* Get current list of valid channels. */
-            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, "Switching to master list of valid channels");
-            numOfChannels = sizeof(pMac->roam.validChannelList);
-            if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, (tANI_U32 *) &numOfChannels)))
-            {
-                // Copy the "default valid channel list" (channelList) from the actual "valid channel list" information formed by CSR
-                status = csrNeighborRoamMergeChannelLists( 
-                        pMac, 
-                        (tANI_U8 *)pMac->roam.validChannelList, 
-                        numOfChannels,   // The number of channels in the validChannelList 
-                        channelList, 
-                        0, //NB: If 0, simply copy the input channel list to the output list.
-                        &numOfChannels );  // The final number of channels in the output list. Will be numOfChannels
-            }
-            else
-            { 
-                smsLog(pMac, LOGE, FL("Could not get valid channel list, TL event ignored")); 
-                return VOS_STATUS_E_FAILURE;
+                // Make sure to add only if its the same band
+                if ((pNeighborRoamInfo->currAPoperationChannel <= (RF_CHAN_14+1)) &&
+                    (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i] <= (RF_CHAN_14+1)))
+                {
+                        VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                                "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
+                                pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
+                        channelList[numOfChannels] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
+                        numOfChannels++;
+                }
+                if ((pNeighborRoamInfo->currAPoperationChannel >= RF_CHAN_128) &&
+                    (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i] >= RF_CHAN_128))
+                {
+                        VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, 
+                                "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
+                                pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
+                        channelList[numOfChannels] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
+                        numOfChannels++;
+                }
             }
         }
 
-        /* At this point, channelList contains our best inputs on the "valid channel list" */
-
-        /* Allocate for the maximum number that might be used */
-        smsLog(pMac, LOGE, FL("%d channels in the default list. Add %d occupied channels. %d is the MAX scan channel list."), 
-                numOfChannels, 
-                CSR_BG_SCAN_OCCUPIED_CHANNEL_LIST_LEN, 
-                numOfChannels+CSR_BG_SCAN_OCCUPIED_CHANNEL_LIST_LEN );
         pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = numOfChannels;
-        VOS_ASSERT( pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList == NULL);
+        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; 
         if (numOfChannels)
-        {
-            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = 
-                vos_mem_malloc(numOfChannels+CSR_BG_SCAN_OCCUPIED_CHANNEL_LIST_LEN );
-        }
+            pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = vos_mem_malloc(numOfChannels);
     
         if (NULL == pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
         {
@@ -2265,28 +1896,13 @@
             return VOS_STATUS_E_RESOURCES;
         }
     
-#ifdef FEATURE_WLAN_LFR
         /* Since this is a legacy case, copy the channel list from CFG here */
-    
-        status = csrNeighborRoamReorderChannelList( pMac, 
-                channelList, 
-                numOfChannels, 
-                pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList, 
-                &numOfChannels );
-        if (eHAL_STATUS_SUCCESS != status)
-#endif
-        {
-            /* Re-ordering failed. */
-            smsLog(pMac, LOGE, FL("Cannot re-order scan channel list. (status = %d) Going to use default scan channel list."), status);
         vos_mem_copy(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList, 
                                 channelList, numOfChannels * sizeof(tANI_U8));
-        } 
 
-        /* Adjust for the actual number that are used */
-        pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = numOfChannels;
         for (i = 0; i < pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels; i++)
         {
-            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, "Channel List from CFG (or scan caching) = %d\n", 
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, "Channel List from CFG = %d\n", 
                 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i]);
         }
     }
@@ -2312,8 +1928,6 @@
     
     pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
     pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
-    /* We are about to start a fresh scan cycle, purge results from the past */
-    csrScanFlushResult(pMac);
     
     /* Transition to CFG_CHAN_LIST_SCAN_STATE */
     CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN)
@@ -2338,15 +1952,58 @@
 {
     tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
     VOS_STATUS  vosStatus;
-    csrNeighborRoamDeregAllRssiIndication(pMac);
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering UP event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1));
+    /* Deregister the UP event now */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1),
+                                    WLANTL_HO_THRESHOLD_UP, 
+                                    csrNeighborRoamNeighborLookupUPCallback, 
+                                    VOS_MODULE_ID_SME);
+
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+       //err msg
+       smsLog(pMac, LOGW, FL(" Couldn't Deregister csrNeighborRoamNeighborLookupCallback UP event from TL: Status = %d\n"), vosStatus);
+    }
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
+    /* Deregister the UP event now */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
+                                    WLANTL_HO_THRESHOLD_DOWN, 
+                                    csrNeighborRoamNeighborLookupDOWNCallback, 
+                                    VOS_MODULE_ID_SME);
+
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+       //err msg
+       smsLog(pMac, LOGW, FL(" Couldn't Deregister csrNeighborRoamNeighborLookupCallback UP event from TL: Status = %d\n"), vosStatus);
+    }
+
+    NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
+    /* Deregister reassoc callback. */
+    vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
+                                                        WLANTL_HO_THRESHOLD_DOWN, 
+                                                        csrNeighborRoamReassocIndCallback,
+                                                        VOS_MODULE_ID_SME);
+                        
+    if(!VOS_IS_STATUS_SUCCESS(vosStatus))
+    {
+        //err msg
+        smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d\n"), vosStatus);
+    }
+
+
+    /* RSSI got better than the CFG neighbor lookup threshold. Reset the threshold to older value and set the increment multiplier to 0 */
+    pNeighborRoamInfo->currentLookupIncrementMultiplier = 0;
+
+    pNeighborRoamInfo->currentNeighborLookupThreshold = pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
+    
+    /* Reset all the neighbor roam info control variables. Free all the allocated memory. It is like we are just associated now */
+    csrNeighborRoamResetConnectedStateControlInfo(pMac);
 
     /* Recheck whether the below check is needed. */
     if (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
         CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
-
-    /* Reset all the neighbor roam info control variables. Free all the allocated memory. It is like we are just associated now */
-    csrNeighborRoamResetConnectedStateControlInfo(pMac);
-
     
     NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
     /* Register Neighbor Lookup threshold callback with TL for DOWN event now */
@@ -2542,9 +2199,7 @@
 {
     tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
 
-    smsLog(pMac, LOGE, FL("Disconnect indication on session %d in state %d (sub-state %d)"), 
-           sessionId, pNeighborRoamInfo->neighborRoamState,
-           pMac->roam.curSubState[sessionId]);
+    smsLog(pMac, LOGE, FL("Disconnect indication received with session id %d in state %d"), sessionId, pNeighborRoamInfo->neighborRoamState);
  
 #ifdef FEATURE_WLAN_CCX
     {
@@ -2572,47 +2227,17 @@
             // state.
             palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
             palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
-            if (!CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId )) {
-                /*
-                 * Disconnect indication during Disassoc Handoff sub-state
-                 * is received when we are trying to disconnect with the old
-                 * AP during roam. BUT, if receive a disconnect indication 
-                 * outside of Disassoc Handoff sub-state, then it means that 
-                 * this is a genuine disconnect and we need to clean up.
-                 * Otherwise, we will be stuck in reassoc state which will
-                 * in-turn block scans (see csrIsScanAllowed).
-                 */
-                CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT);
-            }
             break;
 
         case eCSR_NEIGHBOR_ROAM_STATE_INIT:
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Ignoring disconnect event in INIT state"));
             csrNeighborRoamResetInitStateControlInfo(pMac);
-            csrNeighborRoamDeregAllRssiIndication(pMac);
             break; 
 
-        case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
-            CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT);
-            csrNeighborRoamResetCfgListChanScanControlInfo(pMac);
-            csrNeighborRoamDeregAllRssiIndication(pMac);
-            break;
-
-        case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
-            /* Stop pre-auth to reassoc interval timer */
-            palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
-        case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
-        case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
-            CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
-            csrNeighborRoamResetPreauthControlInfo(pMac);
-            csrNeighborRoamResetReportScanStateControlInfo(pMac);
-            csrNeighborRoamDeregAllRssiIndication(pMac);
-            break;
-
         default:
             NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Received disconnect event in state %d"), pNeighborRoamInfo->neighborRoamState);
             NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Transitioning to INIT state"));
             CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
-            break;
     }
     return eHAL_STATUS_SUCCESS;
 }
@@ -2636,13 +2261,12 @@
 {
     tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
     eHalStatus  status = eHAL_STATUS_SUCCESS;
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
     VOS_STATUS  vstatus;
-
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
     int  init_ft_flag = FALSE;
 #endif
 
-    smsLog(pMac, LOG2, FL("Connect indication received with session id %d in state %d"), sessionId, pNeighborRoamInfo->neighborRoamState);
+    smsLog(pMac, LOGE, FL("Connect indication received with session id %d in state %d"), sessionId, pNeighborRoamInfo->neighborRoamState);
 
     switch (pNeighborRoamInfo->neighborRoamState)
     {
@@ -2667,7 +2291,7 @@
             pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
             pNeighborRoamInfo->neighborScanTimerInfo.sessionId = sessionId;
             
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
             /* Now we can clear the preauthDone that was saved as we are connected afresh */
             csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
 #endif
@@ -2682,7 +2306,7 @@
             }
             else
                 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
-            NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("11rAssoc is = %d"), pNeighborRoamInfo->is11rAssoc);
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11rAssoc is = %d"), pNeighborRoamInfo->is11rAssoc);
 #endif
 
 #ifdef FEATURE_WLAN_CCX
@@ -2695,20 +2319,13 @@
             }
             else
                 pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE;
-            NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("isCCXAssoc is = %d ft = %d"),
-                                pNeighborRoamInfo->isCCXAssoc, init_ft_flag);
+            NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("isCCXAssoc is = %d"), pNeighborRoamInfo->isCCXAssoc);
+            VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, 
+                        "ccx=%d ft=%d\n", pNeighborRoamInfo->isCCXAssoc, init_ft_flag);
                             
 #endif
 
-#ifdef FEATURE_WLAN_LFR
-            // If "Legacy Fast Roaming" is enabled 
-            if (csrRoamIsFastRoamEnabled(pMac))
-            {
-                init_ft_flag = TRUE;
-            }
-#endif
-
-#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
+#if  defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX)
             if ( init_ft_flag == TRUE )
             {
                 /* Initialize all the data structures needed for the 11r FT Preauth */
@@ -2887,8 +2504,7 @@
 
     vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
     pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
-    pNeighborRoamInfo->currentScanResultsRefreshPeriod = 
-        NEIGHBOR_SCAN_RESULTS_REFRESH_PERIOD_MIN;
+    pNeighborRoamInfo->currentLookupIncrementMultiplier = 0;
     pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
 
     pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
@@ -3176,15 +2792,6 @@
     }
     else
 #endif
-#ifdef FEATURE_WLAN_LFR
-    if (csrRoamIsFastRoamEnabled(pMac))
-    {
-        /* Always the BSS info in the head is the handoff candidate */
-        pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
-        NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
-    }
-    else
-#endif
     {
         pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
         NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->roamableAPList));
diff --git a/drivers/staging/prima/CORE/SME/src/csr/csrUtil.c b/drivers/staging/prima/CORE/SME/src/csr/csrUtil.c
index f996187..8866572 100644
--- a/drivers/staging/prima/CORE/SME/src/csr/csrUtil.c
+++ b/drivers/staging/prima/CORE/SME/src/csr/csrUtil.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -44,8 +44,6 @@
 #include "csrInsideApi.h"
 #include "smsDebug.h"
 #include "smeQosInternal.h"
-#include "wlan_qct_wda.h"
-
 #ifdef FEATURE_WLAN_CCX
 #include "vos_utils.h"
 #include "csrCcx.h"
@@ -1168,6 +1166,7 @@
 
 extern const tRfChannelProps rfChannels[NUM_RF_CHANNELS];
 
+
 ////////////////////////////////////////////////////////////////////////
 
 /**
@@ -1375,19 +1374,6 @@
         csrIsConnStateDisconnectedWds( pMac, sessionId ) );
 }
 
-tANI_BOOLEAN csrIsConnStateAp( tpAniSirGlobal pMac,  tANI_U32 sessionId )
-{
-    tCsrRoamSession *pSession;
-    pSession = CSR_GET_SESSION(pMac, sessionId);
-    if (!pSession)
-        return eANI_BOOLEAN_FALSE;
-    if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) )
-    {
-        return eANI_BOOLEAN_TRUE;
-    }
-    return eANI_BOOLEAN_FALSE;
-}
-
 tANI_BOOLEAN csrIsAnySessionInConnectState( tpAniSirGlobal pMac )
 {
     tANI_U32 i;
@@ -1395,10 +1381,8 @@
 
     for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
     {
-        if( CSR_IS_SESSION_VALID( pMac, i ) &&
-            ( csrIsConnStateInfra( pMac, i )
-            || csrIsConnStateIbss( pMac, i )
-            || csrIsConnStateAp( pMac, i) ) )
+        if( CSR_IS_SESSION_VALID( pMac, i ) && 
+            ( csrIsConnStateInfra( pMac, i ) || csrIsConnStateIbss( pMac, i ) ) )
         {
             fRc = eANI_BOOLEAN_TRUE;
             break;
@@ -1566,6 +1550,7 @@
     return ( fRc );
 }
 
+#ifndef BMPS_WORKAROUND_NOT_NEEDED
 tANI_BOOLEAN csrIsConcurrentSessionRunning( tpAniSirGlobal pMac )
 {
     tANI_U32 sessionId, noOfCocurrentSession = 0;
@@ -1613,6 +1598,7 @@
     return ( fRc );
 
 }
+#endif
 
 tANI_BOOLEAN csrIsBTAMP( tpAniSirGlobal pMac, tANI_U32 sessionId )
 {
@@ -1625,24 +1611,23 @@
     return (eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED == pMac->roam.roamSession[sessionId].connectState);
 }
 
-tANI_BOOLEAN csrIsValidMcConcurrentSession(tpAniSirGlobal pMac, tANI_U32 sessionId,
-                                                  tSirBssDescription *pBssDesc)
+tANI_BOOLEAN csrIsValidMcConcurrentSession(tpAniSirGlobal pMac, tANI_U32 sessionId)
 {
     tCsrRoamSession *pSession = NULL;
     tANI_U8 Index = 0, ConnId = 0;
-    eAniBoolean status = eANI_BOOLEAN_FALSE;
-
     tVOS_CON_MODE Mode[CSR_ROAM_SESSION_MAX];
 
     //Check for MCC support
     if (!pMac->roam.configParam.fenableMCCMode)
     {
-        return status;
+        return eANI_BOOLEAN_FALSE;
     }
 
+    for( Index = 0; Index < CSR_ROAM_SESSION_MAX; Index++ ) 
+        Mode[Index] = VOS_MAX_NO_OF_MODE;
+ 
     for( Index = 0; Index < CSR_ROAM_SESSION_MAX; Index++ )
     {
-        Mode[Index] = VOS_MAX_NO_OF_MODE;
         if( CSR_IS_SESSION_VALID( pMac, Index ) )
         {
             pSession = CSR_GET_SESSION( pMac, Index );
@@ -1661,8 +1646,7 @@
         switch (Mode[Index+1])
         {
             case VOS_P2P_CLIENT_MODE :
-                status = eANI_BOOLEAN_TRUE;
-                break;
+              return eANI_BOOLEAN_TRUE;
             case VOS_MAX_NO_OF_MODE :
             default :
                  break;
@@ -1673,44 +1657,14 @@
         switch (Mode[Index +1])
         {
             case VOS_STA_MODE :
-                status = eANI_BOOLEAN_TRUE;
-                break;
-
+                return eANI_BOOLEAN_TRUE;
             case VOS_MAX_NO_OF_MODE :
             default :
                 break;
          }
     }
 
-    //Validate BeaconInterval
-    if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
-    {
-        pSession = CSR_GET_SESSION( pMac, sessionId );
-        if (NULL != pSession->pCurRoamProfile)
-        {
-            if(csrIsconcurrentsessionValid (pMac, sessionId, 
-                                       pSession->pCurRoamProfile->csrPersona) 
-                                       == eHAL_STATUS_SUCCESS )
-            {
-                if(csrValidateBeaconInterval( pMac, pBssDesc->channelId, 
-                               &pBssDesc->beaconInterval, sessionId, 
-                               pSession->pCurRoamProfile->csrPersona) 
-                               != eHAL_STATUS_SUCCESS)
-                {
-                    status = eANI_BOOLEAN_FALSE;
-                }
-                else
-                {
-                    status = eANI_BOOLEAN_TRUE;
-                }
-            }
-            else
-            {
-                status = eANI_BOOLEAN_FALSE;
-            }
-         }
-     }
-    return status;
+    return eANI_BOOLEAN_FALSE;
 }
 
 static tSirMacCapabilityInfo csrGetBssCapabilities( tSirBssDescription *pSirBssDesc )
@@ -2081,18 +2035,11 @@
             break;
 
         case eSIR_11N_NW_TYPE:
-            phyMode = eCSR_DOT11_MODE_11n;
-            break;
-#ifdef WLAN_FEATURE_11AC
-        case eSIR_11AC_NW_TYPE:
-        default:
-            phyMode = eCSR_DOT11_MODE_11ac;
-#else
         default:
             phyMode = eCSR_DOT11_MODE_11n;
-#endif
             break;
     }
+
     return( phyMode );
 }
 
@@ -2144,15 +2091,6 @@
        ret = WNI_CFG_DOT11_MODE_11N_ONLY;
        break;
 #endif
-
-#ifdef WLAN_FEATURE_11AC
-     case eCSR_CFG_DOT11_MODE_11AC_ONLY:
-        ret = WNI_CFG_DOT11_MODE_11AC_ONLY;
-        break;
-     case eCSR_CFG_DOT11_MODE_11AC:
-        ret = WNI_CFG_DOT11_MODE_11AC;
-       break;
-#endif
     default:
         smsLog(pMac, LOGW, FL("doesn't expect %d as csrDo11Mode\n"), csrDot11Mode);
         if(eCSR_BAND_24 == pMac->roam.configParam.eBand)
@@ -2193,13 +2131,6 @@
         {
             phyMode = eCSR_DOT11_MODE_11n;
         }
-
-#ifdef WLAN_FEATURE_11AC
-        if ( pIes->VHTCaps.present && (eCSR_DOT11_MODE_TAURUS != phyMode))
-        {
-             phyMode = eCSR_DOT11_MODE_11ac;
-        }
-#endif
         *pPhyMode = phyMode;
     }
 
@@ -2309,19 +2240,9 @@
                 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
                 break;
             case eCSR_DOT11_MODE_11n:
-#ifdef WLAN_FEATURE_11AC
-            case eCSR_DOT11_MODE_11ac:
-#endif
-                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-                break;
-
             case eCSR_DOT11_MODE_TAURUS:
             default:
-#ifdef WLAN_FEATURE_11AC
-                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
-#else
                 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-#endif
                 break;
             }
             break;
@@ -2331,44 +2252,9 @@
             {
                 fMatch = TRUE;
                 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-
-            }
-
-            break;
-#ifdef WLAN_FEATURE_11AC
-        case eCSR_DOT11_MODE_11ac:
-            fMatch = TRUE;
-            switch(bssPhyMode)
-            {
-            case eCSR_DOT11_MODE_11g:
-                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
-                break;
-            case eCSR_DOT11_MODE_11b:
-                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
-                break;
-            case eCSR_DOT11_MODE_11a:
-                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
-                break;
-            case eCSR_DOT11_MODE_11n:
-                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-                break;
-            case eCSR_DOT11_MODE_11ac:
-            case eCSR_DOT11_MODE_TAURUS:
-            default:
-                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
-                break;
             }
             break;
 
-        case eCSR_DOT11_MODE_11ac_ONLY:
-            if((eCSR_DOT11_MODE_11ac == bssPhyMode) || (eCSR_DOT11_MODE_TAURUS == bssPhyMode))
-            {
-                fMatch = TRUE;
-                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
-            }
-            break;
-#endif
-
         case eCSR_DOT11_MODE_TAURUS:
         default:
             fMatch = TRUE;
@@ -2386,32 +2272,20 @@
             case eCSR_DOT11_MODE_11n:
                 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
                 break;
-#ifdef WLAN_FEATURE_11AC
-            case eCSR_DOT11_MODE_11ac:
-                cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
-                break;
-#endif
             case eCSR_DOT11_MODE_TAURUS:
             default:
                 cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
                 break;
             }
             break;
+
     }
 
     if ( fMatch && pCfgDot11ModeToUse )
     {
-#ifdef WLAN_FEATURE_11AC
-        if(cfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC && !WDA_getFwWlanFeatCaps(DOT11AC))
-        {
-            *pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
-        }
-        else
-#endif
-        {
-            *pCfgDot11ModeToUse = cfgDot11Mode;
-        }
+        *pCfgDot11ModeToUse = cfgDot11Mode;
     }
+
     return( fMatch );
 }
 
@@ -2446,13 +2320,7 @@
                 }
                 else
                 {
-
-#ifdef WLAN_FEATURE_11AC
-                    phyMode = eCSR_DOT11_MODE_11ac;
-#else
                     phyMode = eCSR_DOT11_MODE_11n;
-#endif
-
                 }
             }
             else
@@ -2506,9 +2374,6 @@
                  */
                 if( (!CSR_IS_11n_ALLOWED( pProfile->negotiatedUCEncryptionType )) &&
                     ((eCSR_CFG_DOT11_MODE_11N == cfgDot11ModeToUse) ||
-#ifdef WLAN_FEATURE_11AC
-                     (eCSR_CFG_DOT11_MODE_11AC == cfgDot11ModeToUse) ||
-#endif
                      (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11ModeToUse)) )
                 {
                     //We cannot do 11n here
@@ -2535,16 +2400,6 @@
     eCsrCfgDot11Mode cfgDot11ModeToUse;
     eCsrBand eBand = pMac->roam.configParam.eBand;
 
-
-#ifdef WLAN_FEATURE_11AC
-    if ( (0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode)
-       ||(eCSR_DOT11_MODE_11ac & phyMode))
-    {
-        cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC;
-    }
-    else
-#endif
-
     if ( (0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode))
     {
         cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
@@ -2685,218 +2540,6 @@
     return( fRSNProfile );
 }
 
-eHalStatus
-csrIsconcurrentsessionValid(tpAniSirGlobal pMac,tANI_U32 cursessionId,
-                                 tVOS_CON_MODE currBssPersona)
-{
-    tANI_U32 sessionId = 0;
-
-    for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
-    {
-        if (cursessionId != sessionId )
-        {
-            if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
-            {
-                continue;
-            }
-
-            switch (currBssPersona)
-            {
-                case VOS_STA_MODE:
-                    if(pMac->roam.roamSession[sessionId].pCurRoamProfile &&
-                      (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona 
-                                      == VOS_STA_MODE)) //check for P2P client mode
-                    {
-                        smsLog(pMac, LOGE, FL(" ****STA mode already exists ****\n"));
-                        return eHAL_STATUS_FAILURE;
-                    }
-                    break;
-
-                case VOS_STA_SAP_MODE:
-                    if(pMac->roam.roamSession[sessionId].bssParams.bssPersona
-                                      == VOS_STA_SAP_MODE)
-                    {
-                        smsLog(pMac, LOGE, FL(" ****SoftAP mode already exists ****\n"));
-                        return eHAL_STATUS_FAILURE;
-                    }
-                    
-                    else if(pMac->roam.roamSession[sessionId].bssParams.bssPersona
-                                      == VOS_P2P_GO_MODE)
-                    {
-                        smsLog(pMac, LOGE, FL(" ****Cannot start Multiple Beaconing Role ****\n"));
-                        return eHAL_STATUS_FAILURE;
-                    }
-                    break;
-
-                case VOS_P2P_CLIENT_MODE:
-                    if(pMac->roam.roamSession[sessionId].pCurRoamProfile &&
-                      (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona 
-                                                  == VOS_P2P_CLIENT_MODE)) //check for P2P client mode
-                    {
-                        smsLog(pMac, LOGE, FL(" ****CLIENT mode already exists ****\n"));
-                        return eHAL_STATUS_FAILURE;
-                    }
-                    break;
-
-                case VOS_P2P_GO_MODE:
-                    if(pMac->roam.roamSession[sessionId].bssParams.bssPersona
-                                      == VOS_P2P_GO_MODE)
-                    {
-                        smsLog(pMac, LOGE, FL(" ****P2P GO mode already exists ****\n"));
-                        return eHAL_STATUS_FAILURE;
-                    }
-                    else if(pMac->roam.roamSession[sessionId].bssParams.bssPersona
-                                      == VOS_STA_SAP_MODE)
-                    {
-                        smsLog(pMac, LOGE, FL(" ****Cannot start Multiple Beaconing Role ****\n"));
-                        return eHAL_STATUS_FAILURE;
-                    }
-                    break;
-
-                default :
-                    smsLog(pMac, LOGE, FL("***Persona not handled = %d*****\n"),currBssPersona);
-                    break;
-            }
-        }
-    }
-    return eHAL_STATUS_SUCCESS;
-
-}
-
-eHalStatus csrValidateBeaconInterval(tpAniSirGlobal pMac, tANI_U8 channelId, 
-                                     tANI_U16 *beaconInterval, tANI_U32 cursessionId,
-                                     tVOS_CON_MODE currBssPersona)
-{
-    tANI_U32 sessionId = 0;
-
-    //If MCC is not supported just break and return SUCCESS
-    if ( !IS_MCC_SUPPORTED && !pMac->roam.configParam.fenableMCCMode){
-        return eHAL_STATUS_FAILURE;
-    }
-
-    for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
-    {
-        if (cursessionId != sessionId )
-        {
-            if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
-            {
-                continue;
-            }
-
-            switch (currBssPersona)
-            {
-                case VOS_STA_MODE:
-                    if(pMac->roam.roamSession[sessionId].pCurRoamProfile &&
-                      (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona 
-                                      == VOS_P2P_CLIENT_MODE)) //check for P2P client mode
-                    {
-                        smsLog(pMac, LOG1, FL(" Beacon Interval Validation not required for STA/CLIENT\n"));
-                    }
-                    //IF SAP has started and STA wants to connect on different channel MCC should
-                    //MCC should not be enabled so making it false to enforce on same channel
-                    else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona
-                                      == VOS_STA_SAP_MODE)
-                    {
-                        if (pMac->roam.roamSession[sessionId].bssParams.operationChn 
-                                                        != channelId )
-                        {
-                            smsLog(pMac, LOGE, FL("***MCC is not enabled for SAP +STA****\n"));
-                            return eHAL_STATUS_FAILURE;
-                        }
-                    }
-                    else if(pMac->roam.roamSession[sessionId].bssParams.bssPersona
-                                      == VOS_P2P_GO_MODE) //Check for P2P go scenario
-                    {
-                        /* if GO in MCC support different beacon interval, return success */
-                        if ( pMac->roam.configParam.fAllowMCCGODiffBI == TRUE)
-                            return eHAL_STATUS_SUCCESS;
-                        
-                        if ((pMac->roam.roamSession[sessionId].bssParams.operationChn 
-                                != channelId ) &&
-                            (pMac->roam.roamSession[sessionId].bssParams.beaconInterval 
-                                != *beaconInterval))
-                        {
-                            smsLog(pMac, LOGE, FL("BeaconInteval is different cannot connect to prefered AP...\n"));
-                            return eHAL_STATUS_FAILURE;
-                        }
-                    }
-                    break;
-
-                case VOS_P2P_CLIENT_MODE:
-                    if(pMac->roam.roamSession[sessionId].pCurRoamProfile &&
-                      (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona 
-                                                                == VOS_STA_MODE)) //check for P2P client mode
-                    {
-                        smsLog(pMac, LOG1, FL(" Ignore Beacon Interval Validation...\n"));
-                    }
-                    //IF SAP has started and STA wants to connect on different channel MCC should
-                    //MCC should not be enabled so making it false to enforce on same channel
-                    else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona
-                                      == VOS_STA_SAP_MODE)
-                    {
-                        if (pMac->roam.roamSession[sessionId].bssParams.operationChn 
-                                                        != channelId )
-                        {
-                            smsLog(pMac, LOGE, FL("***MCC is not enabled for SAP + CLIENT****\n"));
-                            return eHAL_STATUS_FAILURE;
-                        }
-                    }
-                    else if(pMac->roam.roamSession[sessionId].bssParams.bssPersona
-                                    == VOS_P2P_GO_MODE) //Check for P2P go scenario
-                    {
-                        if ((pMac->roam.roamSession[sessionId].bssParams.operationChn 
-                                != channelId ) &&
-                            (pMac->roam.roamSession[sessionId].bssParams.beaconInterval 
-                                != *beaconInterval))
-                        {
-                            smsLog(pMac, LOGE, FL("BeaconInteval is different cannot connect to P2P_GO network ...\n"));
-                            return eHAL_STATUS_FAILURE;
-                        }
-                    }
-                    break;
-
-                case VOS_P2P_GO_MODE :
-                    if(pMac->roam.roamSession[sessionId].pCurRoamProfile  && 
-                      ((pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona 
-                            == VOS_P2P_CLIENT_MODE)
-                     || (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona 
-                            == VOS_STA_MODE))) //check for P2P_client scenario
-                    {
-                        if ((pMac->roam.roamSession[sessionId].connectedProfile.operationChannel 
-                               == 0 )&&
-                           (pMac->roam.roamSession[sessionId].connectedProfile.beaconInterval
-                               == 0))
-                        {
-                            continue;
-                        }
-
-                            
-                        if (csrIsConnStateConnectedInfra(pMac, sessionId) &&
-                           (pMac->roam.roamSession[sessionId].connectedProfile.operationChannel 
-                                != channelId ) &&
-                           (pMac->roam.roamSession[sessionId].connectedProfile.beaconInterval 
-                                != *beaconInterval))
-                        {
-                            /*
-                             * Updated beaconInterval should be used only when we are starting a new BSS 
-                             * not incase of client or STA case
-                             */
-                            *beaconInterval = 
-                                pMac->roam.roamSession[sessionId].connectedProfile.beaconInterval;
-                            return eHAL_STATUS_SUCCESS;
-                         }
-                    }
-                    break;
-
-                default :
-                    smsLog(pMac, LOG1, FL(" Persona not supported : %d\n"),currBssPersona);
-                    return eHAL_STATUS_FAILURE;
-            }
-        }
-    }
-
-    return eHAL_STATUS_SUCCESS;
-}
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
 /* Function to return TRUE if the authtype is 11r */
@@ -3488,12 +3131,6 @@
     tANI_U32 Index;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return FALSE;
-    }
-
     do
     {
         for( Index=0; Index < pSession->NumPmkidCache; Index++ )
@@ -3537,8 +3174,6 @@
     tANI_U8 PMKId[CSR_RSN_PMKID_SIZE];
     tDot11fBeaconIEs *pIesLocal = pIes;
 
-    smsLog(pMac, LOGW, "%s called...", __FUNCTION__);
-
     do
     {
         if ( !csrIsProfileRSN( pProfile ) ) break;
@@ -3746,12 +3381,6 @@
     tANI_U32 Index;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
-    if(!pSession)
-    {
-        smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-        return FALSE;
-    }
-
     do
     {
         for( Index=0; Index < pSession->NumBkidCache; Index++ )
@@ -4229,18 +3858,8 @@
     do
     {
         if ( !csrIsProfileRSN( pProfile ) ) break;
-#ifdef FEATURE_WLAN_LFR
-        if (csrRoamIsFastRoamEnabled(pMac))
-        {
-            // If "Legacy Fast Roaming" is enabled ALWAYS rebuild the RSN IE from 
-            // scratch. So it contains the current PMK-IDs
-            cbRsnIe = csrConstructRSNIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pRsnIe);
-        }
-        else 
-#endif
         if(pProfile->nRSNReqIELength && pProfile->pRSNReqIE)
         {
-            // If you have one started away, re-use it. 
             if(SIR_MAC_WPA_IE_MAX_LENGTH >= pProfile->nRSNReqIELength)
             {
                 cbRsnIe = (tANI_U8)pProfile->nRSNReqIELength;
@@ -5780,22 +5399,6 @@
     case eCSR_DOT11_MODE_AUTO:
         cfgDot11Mode = eCSR_CFG_DOT11_MODE_AUTO;
         break;
-
-#ifdef WLAN_FEATURE_11AC
-    case eCSR_DOT11_MODE_11ac:
-	if (!WDA_getFwWlanFeatCaps(DOT11AC))
-	{
-		cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
-	}
-	else
-	{
-		cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
-	}
-        break;
-    case eCSR_DOT11_MODE_11ac_ONLY:
-        cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC_ONLY;
-        break;
-#endif
     default:
         //No need to assign anything here
         break;
@@ -5894,35 +5497,31 @@
             smsLog(pMac, LOGE, FL("  No IEs\n"));
             break;
         }
-        if( pMac->roam.configParam.fEnforceDefaultDomain ||
-            pMac->roam.configParam.fEnforceCountryCodeMatch )
+        //Make sure this country is recognizable
+        if( pIes->Country.present )
         {
-            //Make sure this country is recognizable
-            if( pIes->Country.present )
+            status = csrGetRegulatoryDomainForCountry( pMac, pIes->Country.country, &domainId );
+            if( !HAL_STATUS_SUCCESS( status ) )
             {
-                status = csrGetRegulatoryDomainForCountry( pMac, pIes->Country.country, &domainId );
-                if( !HAL_STATUS_SUCCESS( status ) )
-                {
-                    fRet = eANI_BOOLEAN_FALSE;
-                    break;
-                }
+                fRet = eANI_BOOLEAN_FALSE;
+                break;
             }
-            //check whether it is needed to enforce to the default regulatory domain first
-            if( pMac->roam.configParam.fEnforceDefaultDomain )
+        }
+        //check whether it is needed to enforce to the default regulatory domain first
+        if( pMac->roam.configParam.fEnforceDefaultDomain )
+        {
+            if( domainId != pMac->scan.domainIdCurrent )
             {
-                if( domainId != pMac->scan.domainIdCurrent )
-                {
-                    fRet = eANI_BOOLEAN_FALSE;
-                    break;
-                }
+                fRet = eANI_BOOLEAN_FALSE;
+                break;
             }
-            if( pMac->roam.configParam.fEnforceCountryCodeMatch )
-            {
+        }
+        if( pMac->roam.configParam.fEnforceCountryCodeMatch )
+        {
             if( domainId >= REGDOMAIN_COUNT )
-                {
-                    fRet = eANI_BOOLEAN_FALSE;
-                    break;
-                }
+            {
+                fRet = eANI_BOOLEAN_FALSE;
+                break;
             }
         }
         if( pCountry )
@@ -6215,7 +5814,7 @@
     * The current work-around is to process setcontext_rsp and removekey_rsp no matter what the 
     * state is.
     */
-    smsLog( pMac, LOG2, FL(" is not what it intends to. Must be revisit or removed\n") );
+    smsLog( pMac, LOGE, FL(" is not what it intends to. Must be revisit or removed\n") );
     if( (NULL == pSession) || 
         ( csrIsConnStateDisconnected( pMac, sessionId ) && 
         (pSession->pCurRoamProfile != NULL) &&
@@ -6247,6 +5846,7 @@
    return (0);
 }
 
+#ifndef BMPS_WORKAROUND_NOT_NEEDED
 /* Disconnect all active sessions by sending disassoc. This is mainly used to disconnect the remaining session when we 
  * transition from concurrent sessions to a single session. The use case is Infra STA and wifi direct multiple sessions are up and 
  * P2P session is removed. The Infra STA session remains and should resume BMPS if BMPS is enabled by default. However, there
@@ -6266,50 +5866,4 @@
         }
     }
 }
-
-#ifdef FEATURE_WLAN_LFR
-tANI_BOOLEAN csrIsChannelPresentInList( 
-        tANI_U8 *pChannelList,
-        int  numChannels,
-        tANI_U8   channel 
-        )
-{
-    int i = 0;
-
-    // Check for NULL pointer
-    if (!pChannelList) return FALSE;
-
-    // Look for the channel in the list
-    for (i = 0; i < numChannels; i++)
-    {
-        if (pChannelList[i] == channel) 
-            return TRUE;
-    }
-
-    return FALSE;
-}
-
-VOS_STATUS csrAddToChannelListFront( 
-        tANI_U8 *pChannelList,
-        int  numChannels,
-        tANI_U8   channel 
-        )
-{
-    int i = 0;
-
-    // Check for NULL pointer
-    if (!pChannelList) return eHAL_STATUS_E_NULL_VALUE;
-
-    // Make room for the addition.  (Start moving from the back.)
-    for (i = numChannels; i > 0; i--)
-    {
-        pChannelList[i] = pChannelList[i-1]; 
-    }
-
-    // Now add the NEW channel...at the front
-    pChannelList[0] = channel; 
-
-    return eHAL_STATUS_SUCCESS;
-}
 #endif
-
diff --git a/drivers/staging/prima/CORE/SME/src/oemData/oemDataApi.c b/drivers/staging/prima/CORE/SME/src/oemData/oemDataApi.c
index 38b4ffa..1020373 100644
--- a/drivers/staging/prima/CORE/SME/src/oemData/oemDataApi.c
+++ b/drivers/staging/prima/CORE/SME/src/oemData/oemDataApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/src/p2p/p2p_Api.c b/drivers/staging/prima/CORE/SME/src/p2p/p2p_Api.c
index 8b45b1d..c0948d1 100644
--- a/drivers/staging/prima/CORE/SME/src/p2p/p2p_Api.c
+++ b/drivers/staging/prima/CORE/SME/src/p2p/p2p_Api.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -59,13 +59,6 @@
     tSirRemainOnChnReq* pMsg;
     tANI_U16 len;
     tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, p2pRemainonChn->sessionId );
-
-    if(!pSession)
-    {
-       smsLog(pMac, LOGE, FL("  session %d not found "), p2pRemainonChn->sessionId);
-       return eHAL_STATUS_FAILURE;
-    }
-
 #ifdef WLAN_FEATURE_P2P_INTERNAL
     tANI_U8 P2PsessionId = getP2PSessionIdFromSMESessionId(pMac, p2pRemainonChn->sessionId);
     tp2pContext *p2pContext = &pMac->p2pContext[P2PsessionId];
diff --git a/drivers/staging/prima/CORE/SME/src/pmc/pmc.c b/drivers/staging/prima/CORE/SME/src/pmc/pmc.c
index bcc0749..6f3cbfd 100644
--- a/drivers/staging/prima/CORE/SME/src/pmc/pmc.c
+++ b/drivers/staging/prima/CORE/SME/src/pmc/pmc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -40,7 +40,6 @@
 #include "sme_Api.h"
 #include "smsDebug.h"
 #include "pmc.h"
-#include "wlan_qct_wda.h"
 #include "wlan_ps_wow_diag.h"
 #include <vos_power.h>
 #include "csrInsideApi.h"
@@ -201,7 +200,7 @@
         return eHAL_STATUS_FAILURE;
     }
 
-    smsLog(pMac, LOG1, "PMC: Enter full power done: Cancel XO Core ON vote\n");
+    smsLog(pMac, LOGW, "PMC: Enter full power done: Cancel XO Core ON vote\n");
     if (vos_chipVoteXOCore(NULL, NULL, NULL, VOS_FALSE) != VOS_STATUS_SUCCESS)
     {
         smsLog(pMac, LOGE, "Could not cancel XO Core ON vote. Not returning failure. "
@@ -406,7 +405,7 @@
         return eHAL_STATUS_FAILURE;
      }
 
-    smsLog(pMac, LOG2, FL("eWNI_PMC_ENTER_IMPS_REQ sent to PE\n"));
+    smsLog(pMac, LOGW, FL("eWNI_PMC_ENTER_IMPS_REQ sent to PE\n"));
 
     return eHAL_STATUS_SUCCESS;
 }
@@ -1014,7 +1013,7 @@
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
     VOS_STATUS vosStatus;
 
-    smsLog(pMac, LOG2, FL("BMPS Traffic timer expired"));
+    smsLog(pMac, LOGW, FL("BMPS Traffic timer expired"));
 
     /* If timer expires and we are in a state other than Full Power State then something is wrong. */
     if (pMac->pmc.pmcState != FULL_POWER)
@@ -1026,7 +1025,7 @@
     /* Untill DHCP is not completed remain in power active */
     if(pMac->pmc.remainInPowerActiveTillDHCP)
     {
-        smsLog(pMac, LOG2, FL("BMPS Traffic Timer expired before DHCP completion ignore enter BMPS\n"));
+        smsLog(pMac, LOGE, FL("BMPS Traffic Timer expired before DHCP completion ignore enter BMPS\n"));
         pMac->pmc.remainInPowerActiveThreshold++;
         if( pMac->pmc.remainInPowerActiveThreshold >= DHCP_REMAIN_POWER_ACTIVE_THRESHOLD)
         {
@@ -2174,7 +2173,7 @@
                 if ( HAL_STATUS_SUCCESS( status ) )
                 {
                     pMac->pmc.pmcState = REQUEST_FULL_POWER;
-                    smsLog(pMac, LOG2, FL("eWNI_PMC_EXIT_IMPS_REQ sent to PE\n"));
+                    smsLog(pMac, LOGW, FL("eWNI_PMC_EXIT_IMPS_REQ sent to PE\n"));
                     fRemoveCmd = eANI_BOOLEAN_FALSE;
                 }
                 else
@@ -2195,7 +2194,7 @@
                 {
                     /* Change PMC state */
                     pMac->pmc.pmcState = REQUEST_BMPS;
-                    smsLog(pMac, LOG2, "PMC: Enter BMPS req done: Force XO Core ON\n");
+                    smsLog(pMac, LOGW, "PMC: Enter BMPS req done: Force XO Core ON\n");
                     vstatus = vos_chipVoteXOCore(NULL, NULL, NULL, VOS_TRUE);
                     if ( !VOS_IS_STATUS_SUCCESS(vstatus) )
                     {
@@ -2249,7 +2248,7 @@
                 {
                     pMac->pmc.pmcState = REQUEST_FULL_POWER;
                     fRemoveCmd = eANI_BOOLEAN_FALSE;
-                    smsLog(pMac, LOG2, FL("eWNI_PMC_EXIT_BMPS_REQ sent to PE\n"));
+                    smsLog(pMac, LOGW, FL("eWNI_PMC_EXIT_BMPS_REQ sent to PE\n"));
 
                 }
                 else
@@ -2505,19 +2504,17 @@
       return eHAL_STATUS_PMC_NOT_NOW;
    }
 
-    if(!IS_SLM_SESSIONIZATION_SUPPORTED_BY_FW)
-    {
-        smsLog(pMac, LOG1, FL("doBMPSWorkaround %u\n"), pMac->roam.configParam.doBMPSWorkaround);
-        if (pMac->roam.configParam.doBMPSWorkaround)
-        {
-            pMac->roam.configParam.doBMPSWorkaround = 0;
-            smsLog(pMac, LOG1, FL("reset doBMPSWorkaround to disabled %u\n"), pMac->roam.configParam.doBMPSWorkaround);
-            csrDisconnectAllActiveSessions(pMac);
-            smsLog(pMac, LOGE, "PMC: doBMPSWorkaround was enabled. First Disconnect all sessions. pmcState %d\n", pMac->pmc.pmcState);
-            return eHAL_STATUS_FAILURE;
-        }
-     }
-
+#ifndef BMPS_WORKAROUND_NOT_NEEDED
+   smsLog(pMac, LOG1, FL("doBMPSWorkaround %u\n"), pMac->roam.configParam.doBMPSWorkaround);
+   if (pMac->roam.configParam.doBMPSWorkaround)
+   {
+      pMac->roam.configParam.doBMPSWorkaround = 0;
+      smsLog(pMac, LOG1, FL("reset doBMPSWorkaround to disabled %u\n"), pMac->roam.configParam.doBMPSWorkaround);
+      csrDisconnectAllActiveSessions(pMac);
+      smsLog(pMac, LOGE, "PMC: doBMPSWorkaround was enabled. First Disconnect all sessions. pmcState %d\n", pMac->pmc.pmcState);
+      return eHAL_STATUS_FAILURE;
+   }
+#endif
    return ( eHAL_STATUS_SUCCESS );
 }
 
@@ -2536,15 +2533,6 @@
         return eANI_BOOLEAN_FALSE;
     }
 
-    if ((vos_concurrent_sessions_running()) &&
-        ((csrIsConcurrentInfraConnected( pMac ) ||
-        (vos_get_concurrency_mode()& VOS_SAP) ||
-        (vos_get_concurrency_mode()& VOS_P2P_GO))))
-    {
-        smsLog(pMac, LOG1, FL("Multiple Sessions/GO/SAP sessions . BMPS should not be started"));
-        return eANI_BOOLEAN_FALSE;
-    }
-
     /* Check if there is an Infra session. BMPS is possible only if there is
      * an Infra session */
     if (!csrIsInfraConnected(pMac))
diff --git a/drivers/staging/prima/CORE/SME/src/pmc/pmcApi.c b/drivers/staging/prima/CORE/SME/src/pmc/pmcApi.c
index ec5c705..ac4a73e 100644
--- a/drivers/staging/prima/CORE/SME/src/pmc/pmcApi.c
+++ b/drivers/staging/prima/CORE/SME/src/pmc/pmcApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1254,7 +1254,7 @@
     {
         pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 
-        smsLog(pMac, LOG2, FL("process message = %d\n"), pMsg->messageType);
+        smsLog(pMac, LOG1, FL("process message = %d\n"), pMsg->messageType);
 
     /* Process each different type of message. */
     switch (pMsg->messageType)
@@ -1262,7 +1262,7 @@
 
     /* We got a response to our IMPS request.  */
     case eWNI_PMC_ENTER_IMPS_RSP:
-        smsLog(pMac, LOG2, FL("Rcvd eWNI_PMC_ENTER_IMPS_RSP with status = %d\n"), pMsg->statusCode);
+        smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_IMPS_RSP with status = %d\n"), pMsg->statusCode);
             if( (eSmeCommandEnterImps != pCommand->command) && (eSmeCommandEnterStandby != pCommand->command) )
             {
                 smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_IMPS_RSP without request\n"));
@@ -1312,7 +1312,7 @@
 
     /* We got a response to our wake from IMPS request. */
     case eWNI_PMC_EXIT_IMPS_RSP:
-            smsLog(pMac, LOG2, FL("Rcvd eWNI_PMC_EXIT_IMPS_RSP with status = %d\n"), pMsg->statusCode);
+            smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_IMPS_RSP with status = %d\n"), pMsg->statusCode);
             if( eSmeCommandExitImps != pCommand->command )
             {
                 smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_IMPS_RSP without request\n"));
@@ -1337,7 +1337,7 @@
 
     /* We got a response to our BMPS request.  */
     case eWNI_PMC_ENTER_BMPS_RSP:
-            smsLog(pMac, LOG2, FL("Rcvd eWNI_PMC_ENTER_BMPS_RSP with status = %d\n"), pMsg->statusCode);
+            smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_BMPS_RSP with status = %d\n"), pMsg->statusCode);
             if( eSmeCommandEnterBmps != pCommand->command )
             {
                 smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_BMPS_RSP without request\n"));
@@ -1374,7 +1374,7 @@
 
     /* We got a response to our wake from BMPS request. */
     case eWNI_PMC_EXIT_BMPS_RSP:
-            smsLog(pMac, LOG2, FL("Rcvd eWNI_PMC_EXIT_BMPS_RSP with status = %d\n"), pMsg->statusCode);
+            smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_BMPS_RSP with status = %d\n"), pMsg->statusCode);
             if( eSmeCommandExitBmps != pCommand->command )
             {
                 smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_BMPS_RSP without request\n"));
@@ -1399,7 +1399,7 @@
 
         /* We got a response to our Start UAPSD request.  */
         case eWNI_PMC_ENTER_UAPSD_RSP:
-            smsLog(pMac, LOG2, FL("Rcvd eWNI_PMC_ENTER_UAPSD_RSP with status = %d\n"), pMsg->statusCode);
+            smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_UAPSD_RSP with status = %d\n"), pMsg->statusCode);
             if( eSmeCommandEnterUapsd != pCommand->command )
         {
                 smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_ENTER_UAPSD_RSP without request\n"));
@@ -1434,7 +1434,7 @@
 
       /* We got a response to our Stop UAPSD request.  */
       case eWNI_PMC_EXIT_UAPSD_RSP:
-         smsLog(pMac, LOG2, FL("Rcvd eWNI_PMC_EXIT_UAPSD_RSP with status = %d\n"), pMsg->statusCode);
+         smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_UAPSD_RSP with status = %d\n"), pMsg->statusCode);
             if( eSmeCommandExitUapsd != pCommand->command )
             {
                 smsLog(pMac, LOGW, FL("Rcvd eWNI_PMC_EXIT_UAPSD_RSP without request\n"));
@@ -1624,10 +1624,8 @@
       smsLog(pMac, LOGW, "PMC: BT-AMP exists. BMPS cannot be entered\n");
       return eANI_BOOLEAN_FALSE;
    }
-   if ((vos_concurrent_sessions_running()) &&
-       (csrIsConcurrentInfraConnected( pMac ) ||
-       (vos_get_concurrency_mode()& VOS_SAP) ||
-       (vos_get_concurrency_mode()& VOS_P2P_GO)))
+   if ((vos_concurrent_sessions_running()) && 
+        csrIsConcurrentInfraConnected( pMac ))
    {
       smsLog(pMac, LOGW, "PMC: Multiple active sessions exists. BMPS cannot be entered\n");
       return eANI_BOOLEAN_FALSE;
@@ -2428,21 +2426,10 @@
             eHAL_STATUS_FAILURE  Cannot set the offload.
             eHAL_STATUS_SUCCESS  Request accepted. 
   ---------------------------------------------------------------------------*/
-eHalStatus pmcSetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest, tANI_U8 *bssId)
+eHalStatus pmcSetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest)
 {
     tpSirHostOffloadReq pRequestBuf;
     vos_msg_t msg;
-    tpPESession     psessionEntry;
-    tANI_U8   sessionId;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-
-    if((psessionEntry = peFindSessionByBssid( pMac, bssId,&sessionId)) == NULL )
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find"
-        "the psessionEntry for bssid : 0x%x:0x%x:0x%x:0x%x:0x%x:0x%x", 
-        __FUNCTION__,bssId[5],bssId[4],bssId[3],bssId[2],bssId[1],bssId[0]);
-        return eHAL_STATUS_FAILURE;
-    }
 
     VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: IP address = %d.%d.%d.%d", __FUNCTION__,
         pRequest->params.hostIpv4Addr[0], pRequest->params.hostIpv4Addr[1],
@@ -2456,8 +2443,6 @@
     }
     vos_mem_copy(pRequestBuf, pRequest, sizeof(tSirHostOffloadReq));
 
-    pRequestBuf->bssIdx = psessionEntry->bssIdx;
-
     msg.type = WDA_SET_HOST_OFFLOAD;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
@@ -2480,20 +2465,10 @@
             eHAL_STATUS_FAILURE  Cannot set the keepalive.
             eHAL_STATUS_SUCCESS  Request accepted. 
   ---------------------------------------------------------------------------*/
-eHalStatus pmcSetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest, tANI_U8 *bssId)
+eHalStatus pmcSetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest)
 {
     tpSirKeepAliveReq pRequestBuf;
     vos_msg_t msg;
-    tpPESession     psessionEntry;
-    tANI_U8   sessionId;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    if((psessionEntry = peFindSessionByBssid( pMac, bssId,&sessionId)) == NULL )
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find"
-        "the psessionEntry for bssid : 0x%x:0x%x:0x%x:0x%x:0x%x:0x%x", 
-        __FUNCTION__,bssId[5],bssId[4],bssId[3],bssId[2],bssId[1],bssId[0]);
-        return eHAL_STATUS_FAILURE;
-    }
 
     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_LOW, "%s: "
                   "WDA_SET_KEEP_ALIVE message", __FUNCTION__);
@@ -2507,9 +2482,7 @@
         return eHAL_STATUS_FAILED_ALLOC;
     }
     vos_mem_copy(pRequestBuf, pRequest, sizeof(tSirKeepAliveReq));
-
-    pRequestBuf->bssIdx = psessionEntry->bssIdx;
-
+    
     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_LOW, "buff TP %d "
               "input TP %d ", pRequestBuf->timePeriod, pRequest->timePeriod);
 
@@ -2540,21 +2513,11 @@
             eHAL_STATUS_FAILURE  Cannot set the offload.
             eHAL_STATUS_SUCCESS  Request accepted. 
   ---------------------------------------------------------------------------*/
-eHalStatus pmcSetNSOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest, tANI_U8 *bssId)
+eHalStatus pmcSetNSOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest)
 {
     tpSirHostOffloadReq pRequestBuf;
     vos_msg_t msg;
     int i;
-    tpPESession     psessionEntry;
-    tANI_U8   sessionId;
-    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    if((psessionEntry = peFindSessionByBssid( pMac, bssId,&sessionId)) == NULL )
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find"
-        "the psessionEntry for bssid : 0x%x:0x%x:0x%x:0x%x:0x%x:0x%x", 
-        __FUNCTION__,bssId[5],bssId[4],bssId[3],bssId[2],bssId[1],bssId[0]);
-        return eHAL_STATUS_FAILURE;
-    }
 
     pRequestBuf = vos_mem_malloc(sizeof(tSirHostOffloadReq));
     if (NULL == pRequestBuf)
@@ -2564,8 +2527,6 @@
     }
     vos_mem_copy(pRequestBuf, pRequest, sizeof(tSirHostOffloadReq));
 
-    pRequestBuf->bssIdx = psessionEntry->bssIdx;
-
     msg.type = WDA_SET_NS_OFFLOAD;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
@@ -2776,7 +2737,7 @@
     
     if (IS_DOT11_MODE_HT(dot11mode))
     {
-       PopulateDot11fHTCaps( pMac, NULL, &pr.HTCaps );
+       PopulateDot11fHTCaps( pMac, &pr.HTCaps );
     }
     
     // That's it-- now we pack it.  First, how much space are we going to
diff --git a/drivers/staging/prima/CORE/SME/src/pmc/pmcLogDump.c b/drivers/staging/prima/CORE/SME/src/pmc/pmcLogDump.c
index bb8a077..463ea21 100644
--- a/drivers/staging/prima/CORE/SME/src/pmc/pmcLogDump.c
+++ b/drivers/staging/prima/CORE/SME/src/pmc/pmcLogDump.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/src/rrm/sme_rrm.c b/drivers/staging/prima/CORE/SME/src/rrm/sme_rrm.c
index 7d18bb6..7e9d91c 100644
--- a/drivers/staging/prima/CORE/SME/src/rrm/sme_rrm.c
+++ b/drivers/staging/prima/CORE/SME/src/rrm/sme_rrm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SME/src/sme_common/sme_Api.c b/drivers/staging/prima/CORE/SME/src/sme_common/sme_Api.c
index e6b3cf0..1ca6438 100644
--- a/drivers/staging/prima/CORE/SME/src/sme_common/sme_Api.c
+++ b/drivers/staging/prima/CORE/SME/src/sme_common/sme_Api.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -101,10 +101,6 @@
 
 eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
 
-#ifdef FEATURE_WLAN_LFR
-tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
-#endif
-
 //Internal SME APIs
 eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
 {
@@ -1877,29 +1873,7 @@
 
    return status;
 }
-#ifdef FEATURE_WLAN_LFR
-tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
-{
-#if 0
-        switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
-                case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
-                case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
-                case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
-                case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
-                        return eANI_BOOLEAN_FALSE;
-                default:
-                        return eANI_BOOLEAN_TRUE;
-        }
-#else
-        /*
-         * TODO: always return TRUE for now until
-         * we figure out why we could be stuck in
-         * one of the roaming states forever.
-         */
-        return eANI_BOOLEAN_TRUE;
-#endif
-}
-#endif
+
 /* ---------------------------------------------------------------------------
     \fn sme_ScanRequest
     \brief a wrapper function to Request a 11d or full scan from CSR.
@@ -1926,17 +1900,8 @@
             if ( HAL_STATUS_SUCCESS( status ) )
             {
                 {
-#ifdef FEATURE_WLAN_LFR
-                    if(csrIsScanAllowed(pMac)) {
-#endif
-                            status = csrScanRequest( hHal, sessionId, pscanReq,
-                                                     pScanRequestID, callback, pContext );
-#ifdef FEATURE_WLAN_LFR
-                    } else {
-                            /*HandOff is in progress. So schedule this scan later*/
-                            status = eHAL_STATUS_RESOURCES;
-                    }
-#endif
+                    status = csrScanRequest( hHal, sessionId, pscanReq,
+                                     pScanRequestID, callback, pContext );
                 }
                   
                 sme_ReleaseGlobalLock( &pMac->sme );
@@ -1997,20 +1962,6 @@
    return (status);
 }
 
-eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
-{
-        eHalStatus status = eHAL_STATUS_FAILURE;
-        tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-
-        status = sme_AcquireGlobalLock( &pMac->sme );
-        if ( HAL_STATUS_SUCCESS( status ) )
-        {
-                status = csrScanFlushP2PResult( hHal );
-                sme_ReleaseGlobalLock( &pMac->sme );
-        }
-
-        return (status);
-}
 
 /* ---------------------------------------------------------------------------
     \fn sme_ScanResultGetFirst
@@ -3621,12 +3572,6 @@
 
       pSession = CSR_GET_SESSION(pMac, sessionId);
 
-      if(!pSession)
-      {
-         smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-         return eHAL_STATUS_FAILURE;
-      }
-
       if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
       {
          if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
@@ -5090,31 +5035,22 @@
     \param  pRequest -  Pointer to the offload request.
     \return eHalStatus
   ---------------------------------------------------------------------------*/
-eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId, 
-                                    tpSirHostOffloadReq pRequest)
+eHalStatus sme_SetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    eHalStatus status = eHAL_STATUS_FAILURE;
-    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-    if(pSession == NULL )
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-           "Unable to find the csrSession", __FUNCTION__);
-        return status;
-    }
+    eHalStatus status;
 
     if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
     {
 #ifdef WLAN_NS_OFFLOAD
         if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
         {
-            status = pmcSetNSOffload( hHal, pRequest ,pSession->connectedProfile.bssid);
+            status = pmcSetNSOffload( hHal, pRequest );
         }
         else
 #endif //WLAN_NS_OFFLOAD
         {
-            status = pmcSetHostOffload (hHal, pRequest, pSession->connectedProfile.bssid);
+            status = pmcSetHostOffload (hHal, pRequest);
         }
         sme_ReleaseGlobalLock( &pMac->sme );
     }
@@ -5173,26 +5109,18 @@
     \param  pRequest -  Pointer to the Keep Alive request.
     \return eHalStatus
   ---------------------------------------------------------------------------*/
-eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId, 
-                                 tpSirKeepAliveReq pRequest)
+eHalStatus sme_SetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     eHalStatus status;
-    tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
 
     VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
            "setting Keep alive in SME TP %d", __FUNCTION__,pRequest->timePeriod);
 
-    if(pSession == NULL )
-    {
-		VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
-           " Session not Found", __FUNCTION__);
-        return eHAL_STATUS_FAILURE;
-    }
 
     if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
     {
-        status = pmcSetKeepAlive (hHal, pRequest, pSession->connectedProfile.bssid);
+        status = pmcSetKeepAlive (hHal, pRequest);
         sme_ReleaseGlobalLock( &pMac->sme );
     }
 
@@ -5329,12 +5257,6 @@
         tSirRegisterMgmtFrame *pMsg;
         tANI_U16 len;
         tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-        if(!pSession)
-        {
-            smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-            return eHAL_STATUS_FAILURE;
-        }
         
         if( !pSession->sessionActive )
         {
@@ -5386,12 +5308,6 @@
         tSirRegisterMgmtFrame *pMsg;
         tANI_U16 len;
         tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-        if(!pSession)
-        {
-            smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-            return eHAL_STATUS_FAILURE;
-        }
         
         if( !pSession->sessionActive ) 
         {
@@ -6069,34 +5985,12 @@
 {
     tpSirRcvFltMcAddrList   pRequestBuf;
     vos_msg_t               msg;
-    tpAniSirGlobal          pMac = PMAC_STRUCT(hHal);
-    tANI_U8                 sessionId = 0;
-    tCsrRoamSession         *pSession = NULL;
 
     VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
                "ulMulticastAddrCnt=%d, multicastAddr[0]=%d", __FUNCTION__,
                pMulticastAddrs->ulMulticastAddrCnt,
                pMulticastAddrs->multicastAddr[0]);
-
-    /*
-     *Find the connected Infra / P2P_client connected session
-     */
-     for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
-     {
-         if( CSR_IS_SESSION_VALID( pMac, sessionId ) && 
-           ( csrIsConnStateInfra( pMac, sessionId )) )
-         {
-            pSession = CSR_GET_SESSION( pMac, sessionId );
-         }
-     }
-
-    if(pSession == NULL )
-    {
-        VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
-            "the right session", __FUNCTION__);
-        return eHAL_STATUS_FAILURE;
-    }
-    
+  
     pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
     if (NULL == pRequestBuf)
     {
@@ -6106,10 +6000,6 @@
     }
     vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
 
-    vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
-    vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid, 
-                 sizeof(tSirMacAddr));
-
     msg.type = WDA_8023_MULTICAST_LIST_REQ;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
@@ -6124,14 +6014,12 @@
     return eHAL_STATUS_SUCCESS;
 }
 
-eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg, 
-                                           tANI_U8 sessionId)
+eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg)
 {
     tpSirRcvPktFilterCfgType    pRequestBuf;
     v_SINT_t                allocSize;
     vos_msg_t               msg;
-    tpAniSirGlobal          pMac = PMAC_STRUCT(hHal);
-    tCsrRoamSession         *pSession = CSR_GET_SESSION( pMac, sessionId );
+    /*tpAniSirGlobal          pMac = PMAC_STRUCT(hHal);*/
     v_U8_t   idx=0;
 
     VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
@@ -6142,7 +6030,7 @@
                       ((pRcvPktFilterCfg->numFieldParams - 1) * 
                       sizeof(tSirRcvPktFilterFieldParams));
     pRequestBuf = vos_mem_malloc(allocSize);
-    if ((NULL == pRequestBuf) || (NULL == pSession))
+    if (NULL == pRequestBuf)
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
             "allocate memory for Receive Filter Set Filter request", __FUNCTION__);
@@ -6150,10 +6038,6 @@
     }
     vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
 
-    vos_mem_copy( pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
-    vos_mem_copy( pRequestBuf->bssId, pSession->connectedProfile.bssid, 
-                          sizeof(tSirMacAddr));
-
     msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
@@ -6230,19 +6114,16 @@
     return (status);
 }
 
-eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam, 
-                                             tANI_U8 sessionId)
+eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam)
 {
     tpSirRcvFltPktClearParam pRequestBuf;
     vos_msg_t               msg;
-    tpAniSirGlobal          pMac = PMAC_STRUCT(hHal);
-    tCsrRoamSession         *pSession = CSR_GET_SESSION( pMac, sessionId );
 
     VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __FUNCTION__,
                pRcvFltPktClearParam->filterId);
   
     pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
-    if ((NULL == pRequestBuf) || (NULL == pSession))
+    if (NULL == pRequestBuf)
     {
         VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
             "%s: Not able to allocate memory for Receive Filter "
@@ -6251,10 +6132,6 @@
     }
     vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
 
-    vos_mem_copy( pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
-    vos_mem_copy( pRequestBuf->bssId, pSession->connectedProfile.bssid, 
-                          sizeof(tSirMacAddr));
-
     msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
     msg.reserved = 0;
     msg.bodyptr = pRequestBuf;
@@ -6524,12 +6401,6 @@
     {
         tpSirUpdateParams pMsg;
         tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
-
-        if(!pSession)
-        {
-            smsLog(pMac, LOGE, FL("  session %d not found "), sessionId);
-            return eHAL_STATUS_FAILURE;
-        }
         
         if( !pSession->sessionActive ) 
             VOS_ASSERT(0);
@@ -6614,57 +6485,3 @@
     v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
     WDA_featureCapsExchange(vosContext);
 }
-
-
-/* ---------------------------------------------------------------------------
-
-    \fn sme_GetDefaultCountryCode
-
-    \brief Get the default country code from NV
-
-    \param  hHal
-    \param  pCountry
-    \- return eHalStatus
-
-  -------------------------------------------------------------------------------*/
-eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
-}
-
-/* ---------------------------------------------------------------------------
-
-    \fn sme_GetCurrentCountryCode
-
-    \brief Get the current country code
-
-    \param  hHal
-    \param  pCountry
-    \- return eHalStatus
-
-  -------------------------------------------------------------------------------*/
-eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
-{
-    tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
-    return csrGetCurrentCountryCode(pMac, pCountry);
-}
-
-/* ---------------------------------------------------------------------------
-    \fn sme_transportDebug
-    \brief  Dynamically monitoring Transport channels
-            Private IOCTL will querry transport channel status if driver loaded
-    \param  displaySnapshot Dispaly transport cahnnel snapshot option
-    \param  toggleStallDetect Enable stall detect feature
-                              This feature will take effect to data performance
-                              Not integrate till fully verification
-    \- return NONE
-    -------------------------------------------------------------------------*/
-void sme_transportDebug
-(
-   v_BOOL_t  displaySnapshot,
-   v_BOOL_t  toggleStallDetect
-)
-{
-   WDA_TransportChannelDebug(displaySnapshot, toggleStallDetect);
-}
diff --git a/drivers/staging/prima/CORE/SME/src/sme_common/sme_FTApi.c b/drivers/staging/prima/CORE/SME/src/sme_common/sme_FTApi.c
index 61194eb..ce76b7e 100644
--- a/drivers/staging/prima/CORE/SME/src/sme_common/sme_FTApi.c
+++ b/drivers/staging/prima/CORE/SME/src/sme_common/sme_FTApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -325,7 +325,7 @@
         palCopyMemory( pMac->hHdd, p, pFTKeyInfo->Key, pFTKeyInfo->keyLength ); 
         if(pFTKeyInfo->keyLength == 16)
         {
-            smsLog(pMac, LOG1, "  SME Set keyIdx (%d) encType(%d) key = %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n",
+            smsLog(pMac, LOGE, "  SME Set keyIdx (%d) encType(%d) key = %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n",
             pFTKeyInfo->keyId, edType, pFTKeyInfo->Key[0], pFTKeyInfo->Key[1], pFTKeyInfo->Key[2], pFTKeyInfo->Key[3], pFTKeyInfo->Key[4],
             pFTKeyInfo->Key[5], pFTKeyInfo->Key[6], pFTKeyInfo->Key[7], pFTKeyInfo->Key[8],
             pFTKeyInfo->Key[9], pFTKeyInfo->Key[10], pFTKeyInfo->Key[11], pFTKeyInfo->Key[12], pFTKeyInfo->Key[13], pFTKeyInfo->Key[14], pFTKeyInfo->Key[15]);
@@ -356,7 +356,7 @@
     }
 
 #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
-    smsLog( pMac, LOG1, "sme_FTUpdateKey is received in state %d", 
+    smsLog( pMac, LOGE, "sme_FTUpdateKey is received in state %d\n", 
         pMac->ft.ftSmeContext.FTState);
 #endif
 
diff --git a/drivers/staging/prima/CORE/SVC/external/wlan_nlink_common.h b/drivers/staging/prima/CORE/SVC/external/wlan_nlink_common.h
index d5ac745..89c0745c 100644
--- a/drivers/staging/prima/CORE/SVC/external/wlan_nlink_common.h
+++ b/drivers/staging/prima/CORE/SVC/external/wlan_nlink_common.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SVC/inc/wlan_btc_svc.h b/drivers/staging/prima/CORE/SVC/inc/wlan_btc_svc.h
index 73f0543..620cb22 100644
--- a/drivers/staging/prima/CORE/SVC/inc/wlan_btc_svc.h
+++ b/drivers/staging/prima/CORE/SVC/inc/wlan_btc_svc.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SVC/inc/wlan_nlink_srv.h b/drivers/staging/prima/CORE/SVC/inc/wlan_nlink_srv.h
index bc121f4..788ffb3 100644
--- a/drivers/staging/prima/CORE/SVC/inc/wlan_nlink_srv.h
+++ b/drivers/staging/prima/CORE/SVC/inc/wlan_nlink_srv.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SVC/inc/wlan_ptt_sock_svc.h b/drivers/staging/prima/CORE/SVC/inc/wlan_ptt_sock_svc.h
index 9daa5fb..cca58d5 100644
--- a/drivers/staging/prima/CORE/SVC/inc/wlan_ptt_sock_svc.h
+++ b/drivers/staging/prima/CORE/SVC/inc/wlan_ptt_sock_svc.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SVC/src/btc/wlan_btc_svc.c b/drivers/staging/prima/CORE/SVC/src/btc/wlan_btc_svc.c
index 54a654a..6643fab 100644
--- a/drivers/staging/prima/CORE/SVC/src/btc/wlan_btc_svc.c
+++ b/drivers/staging/prima/CORE/SVC/src/btc/wlan_btc_svc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SVC/src/nlink/wlan_nlink_srv.c b/drivers/staging/prima/CORE/SVC/src/nlink/wlan_nlink_srv.c
index 31144f5..b2951f2 100644
--- a/drivers/staging/prima/CORE/SVC/src/nlink/wlan_nlink_srv.c
+++ b/drivers/staging/prima/CORE/SVC/src/nlink/wlan_nlink_srv.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SVC/src/ptt/wlan_ptt_sock_svc.c b/drivers/staging/prima/CORE/SVC/src/ptt/wlan_ptt_sock_svc.c
index eaa45e5..a63d473 100644
--- a/drivers/staging/prima/CORE/SVC/src/ptt/wlan_ptt_sock_svc.c
+++ b/drivers/staging/prima/CORE/SVC/src/ptt/wlan_ptt_sock_svc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/common/inc/wlan_qct_sys.h b/drivers/staging/prima/CORE/SYS/common/inc/wlan_qct_sys.h
index ef22994..b5800d9 100644
--- a/drivers/staging/prima/CORE/SYS/common/inc/wlan_qct_sys.h
+++ b/drivers/staging/prima/CORE/SYS/common/inc/wlan_qct_sys.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/common/src/wlan_qct_sys.c b/drivers/staging/prima/CORE/SYS/common/src/wlan_qct_sys.c
index b4084f9..9479442 100644
--- a/drivers/staging/prima/CORE/SYS/common/src/wlan_qct_sys.c
+++ b/drivers/staging/prima/CORE/SYS/common/src/wlan_qct_sys.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palApi.h b/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palApi.h
index ce24278..f3e4edf 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palApi.h
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palPipes.h b/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palPipes.h
index 8278ba7..363d9b2 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palPipes.h
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palPipes.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palTimer.h b/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palTimer.h
index 8cf0cf1..984684e 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palTimer.h
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/pal/inc/palTimer.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/pal/src/palApiComm.c b/drivers/staging/prima/CORE/SYS/legacy/src/pal/src/palApiComm.c
index c3fc9f6..1a21e3a 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/pal/src/palApiComm.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/pal/src/palApiComm.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/pal/src/palTimer.c b/drivers/staging/prima/CORE/SYS/legacy/src/pal/src/palTimer.c
index bb1b170..72bb084 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/pal/src/palTimer.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/pal/src/palTimer.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/platform/inc/VossWrapper.h b/drivers/staging/prima/CORE/SYS/legacy/src/platform/inc/VossWrapper.h
index 92711f0..b5ef51a 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/platform/inc/VossWrapper.h
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/platform/inc/VossWrapper.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/platform/src/VossWrapper.c b/drivers/staging/prima/CORE/SYS/legacy/src/platform/src/VossWrapper.c
index 7ff7f62..25a6d44 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/platform/src/VossWrapper.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/platform/src/VossWrapper.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -483,7 +483,7 @@
    vStatus = vos_timer_stop( &timer_ptr->vosTimer );
    if (VOS_STATUS_SUCCESS != vStatus)
    {
-      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO_HIGH, 
+      VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN, 
                 "Unable to stop timer %s; status =%d\n", 
                 TIMER_NAME, vStatus);
    }
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysDebug.h b/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysDebug.h
index 161d563..6ac7143 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysDebug.h
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysDebug.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysDef.h b/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysDef.h
index 01b5435..fdb9c08 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysDef.h
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysDef.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysEntryFunc.h b/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysEntryFunc.h
index d7836d8..aed10ec 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysEntryFunc.h
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysEntryFunc.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysStartup.h b/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysStartup.h
index 366daff..1f1558f 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysStartup.h
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/system/inc/sysStartup.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/system/src/macInitApi.c b/drivers/staging/prima/CORE/SYS/legacy/src/system/src/macInitApi.c
index dfd29ed..6946036 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/system/src/macInitApi.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/system/src/macInitApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/system/src/sysEntryFunc.c b/drivers/staging/prima/CORE/SYS/legacy/src/system/src/sysEntryFunc.c
index 9efa339..7e215e2 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/system/src/sysEntryFunc.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/system/src/sysEntryFunc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -174,9 +174,9 @@
         goto fail;
     }
 
-    PELOG3(sysLog(pMac, LOG3, FL("Rx Mgmt Frame Subtype: %d\n"), subType);
-    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOG3, (tANI_U8 *)WDA_GET_RX_MAC_HEADER(pBd), WDA_GET_RX_MPDU_LEN(pBd));
-    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOG3, WDA_GET_RX_MPDU_DATA(pBd), WDA_GET_RX_PAYLOAD_LEN(pBd));)
+    PELOGW(sysLog(pMac, LOGW, FL("Rx Mgmt Frame Subtype: %d\n"), subType);
+    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOGW, (tANI_U8 *)WDA_GET_RX_MAC_HEADER(pBd), WDA_GET_RX_MPDU_LEN(pBd));
+    sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOGW, WDA_GET_RX_MPDU_DATA(pBd), WDA_GET_RX_PAYLOAD_LEN(pBd));)
 
     pMac->sys.gSysFrameCount[type][subType]++;
 
@@ -186,7 +186,7 @@
             if( (dropReason = limIsPktCandidateForDrop(pMac, pBd, subType)) != eMGMT_DROP_NO_DROP)
             {
                 PELOG1(sysLog(pMac, LOG1, FL("Mgmt Frame %d being dropped, reason: %d\n"), subType, dropReason);)
-                MTRACE(macTrace(pMac,   TRACE_CODE_RX_MGMT_DROP, NO_SESSION, dropReason);)
+                MTRACE(macTrace(pMac,   TRACE_CODE_RX_MGMT_DROP, 0, dropReason);)
                 goto fail;
             }
             //Post the message to PE Queue
@@ -214,10 +214,10 @@
 #endif
     else
     {
-        PELOG3(sysLog(pMac, LOG3, "BBT received Invalid type %d subType %d "
+        PELOGE(sysLog(pMac, LOGE, "BBT received Invalid type %d subType %d "
                    "LIM state %X. BD dump is:\n",
                    type, subType, limGetSmeState(pMac));
-        sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOG3,
+        sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOGE,
                        (tANI_U8 *) pBd, WLANHAL_RX_BD_HEADER_SIZE);)
 
         goto fail;
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/system/src/sysWinStartup.c b/drivers/staging/prima/CORE/SYS/legacy/src/system/src/sysWinStartup.c
index 95c8af5..dcd14b8 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/system/src/sysWinStartup.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/system/src/sysWinStartup.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/utils/inc/dot11fdefs.h b/drivers/staging/prima/CORE/SYS/legacy/src/utils/inc/dot11fdefs.h
index 427ab75..845c967 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/utils/inc/dot11fdefs.h
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/utils/inc/dot11fdefs.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/utils/inc/utilsParser.h b/drivers/staging/prima/CORE/SYS/legacy/src/utils/inc/utilsParser.h
index c72197f..c9c29d61 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/utils/inc/utilsParser.h
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/utils/inc/utilsParser.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -67,9 +67,6 @@
 #ifdef WLAN_FEATURE_P2P
 tSirRetStatus ConvertP2POpaque      (tpAniSirGlobal, tSirAddie*,                 tDot11fIEP2PIEOpaque*);
 #endif
-#ifdef WLAN_FEATURE_WFD
-tSirRetStatus ConvertWFDOpaque      (tpAniSirGlobal, tSirAddie*,                 tDot11fIEWFDIEOpaque*);
-#endif
 
 
 #endif
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/dot11f.c b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/dot11f.c
index 70c129e..9d18626 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/dot11f.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/dot11f.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,7 +33,7 @@
   *
   *
   * This file was automatically generated by 'framesc'
-  * Fri Aug 17 13:25:06 2012 from the following file(s):
+  * Tue May 15 13:12:01 2012 from the following file(s):
   *
   * dot11f.frms
   * 
@@ -4528,112 +4528,10 @@
 #define SigIeTPCRequest ( 0x006c )
 
 
-tANI_U32 dot11fUnpackIeVHTCaps(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEVHTCaps *pDst)
-{
-    tANI_U32 status = DOT11F_PARSE_SUCCESS;
-    tANI_U32 tmp60__;
-    tANI_U16 tmp61__;
-    tANI_U16 tmp62__;
-    (void) pBuf; (void)ielen; /* Shutup the compiler */
-    if (pDst->present) status = DOT11F_DUPLICATE_IE;
-    pDst->present = 1;
-    framesntohl(pCtx, &tmp60__, pBuf, 0);
-    pBuf += 4;
-    ielen -= 4;
-    pDst->maxMPDULen = tmp60__ >> 0 & 0x3;
-    pDst->supportedChannelWidthSet = tmp60__ >> 2 & 0x3;
-    pDst->ldpcCodingCap = tmp60__ >> 4 & 0x1;
-    pDst->shortGI80MHz = tmp60__ >> 5 & 0x1;
-    pDst->shortGI160and80plus80MHz = tmp60__ >> 6 & 0x1;
-    pDst->txSTBC = tmp60__ >> 7 & 0x1;
-    pDst->rxSTBC = tmp60__ >> 8 & 0x7;
-    pDst->suBeamFormerCap = tmp60__ >> 11 & 0x1;
-    pDst->suBeamformeeCap = tmp60__ >> 12 & 0x1;
-    pDst->csnofBeamformerAntSup = tmp60__ >> 13 & 0x7;
-    pDst->numSoundingDim = tmp60__ >> 16 & 0x7;
-    pDst->muBeamformerCap = tmp60__ >> 19 & 0x1;
-    pDst->muBeamformeeCap = tmp60__ >> 20 & 0x1;
-    pDst->vhtTXOPPS = tmp60__ >> 21 & 0x1;
-    pDst->htcVHTCap = tmp60__ >> 22 & 0x1;
-    pDst->maxAMPDULenExp = tmp60__ >> 23 & 0x7;
-    pDst->vhtLinkAdaptCap = tmp60__ >> 26 & 0x3;
-    pDst->rxAntPattern = tmp60__ >> 28 & 0x1;
-    pDst->txAntPattern = tmp60__ >> 29 & 0x1;
-    pDst->reserved1 = tmp60__ >> 30 & 0x3;
-    framesntohs(pCtx, &pDst->rxMCSMap, pBuf, 0);
-    pBuf += 2;
-    ielen -= (tANI_U8)2;
-    framesntohs(pCtx, &tmp61__, pBuf, 0);
-    pBuf += 2;
-    ielen -= 2;
-    pDst->rxHighSupDataRate = tmp61__ >> 0 & 0x1fff;
-    pDst->reserved2 = tmp61__ >> 13 & 0x7;
-    framesntohs(pCtx, &pDst->txMCSMap, pBuf, 0);
-    pBuf += 2;
-    ielen -= (tANI_U8)2;
-    framesntohs(pCtx, &tmp62__, pBuf, 0);
-    pDst->txSupDataRate = tmp62__ >> 0 & 0x1fff;
-    pDst->reserved3 = tmp62__ >> 13 & 0x7;
-    (void)pCtx;
-    return status;
-} /* End dot11fUnpackIeVHTCaps. */
-
-#define SigIeVHTCaps ( 0x006d )
-
-
-tANI_U32 dot11fUnpackIeVHTExtBssLoad(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEVHTExtBssLoad *pDst)
-{
-    tANI_U32 status = DOT11F_PARSE_SUCCESS;
-    (void) pBuf; (void)ielen; /* Shutup the compiler */
-    if (pDst->present) status = DOT11F_DUPLICATE_IE;
-    pDst->present = 1;
-    pDst->muMIMOCapStaCount = *pBuf;
-    pBuf += 1;
-    ielen -= (tANI_U8)1;
-    pDst->ssUnderUtil = *pBuf;
-    pBuf += 1;
-    ielen -= (tANI_U8)1;
-    pDst->FortyMHzUtil = *pBuf;
-    pBuf += 1;
-    ielen -= (tANI_U8)1;
-    pDst->EightyMHzUtil = *pBuf;
-    pBuf += 1;
-    ielen -= (tANI_U8)1;
-    pDst->OneSixtyMHzUtil = *pBuf;
-    (void)pCtx;
-    return status;
-} /* End dot11fUnpackIeVHTExtBssLoad. */
-
-#define SigIeVHTExtBssLoad ( 0x006e )
-
-
-tANI_U32 dot11fUnpackIeVHTOperation(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEVHTOperation *pDst)
-{
-    tANI_U32 status = DOT11F_PARSE_SUCCESS;
-    (void) pBuf; (void)ielen; /* Shutup the compiler */
-    if (pDst->present) status = DOT11F_DUPLICATE_IE;
-    pDst->present = 1;
-    pDst->chanWidth = *pBuf;
-    pBuf += 1;
-    ielen -= (tANI_U8)1;
-    pDst->chanCenterFreqSeg1 = *pBuf;
-    pBuf += 1;
-    ielen -= (tANI_U8)1;
-    pDst->chanCenterFreqSeg2 = *pBuf;
-    pBuf += 1;
-    ielen -= (tANI_U8)1;
-    framesntohs(pCtx, &pDst->basicMCSSet, pBuf, 0);
-    (void)pCtx;
-    return status;
-} /* End dot11fUnpackIeVHTOperation. */
-
-#define SigIeVHTOperation ( 0x006f )
-
-
 tANI_U32 dot11fUnpackIeWAPI(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWAPI *pDst)
 {
     tANI_U32 status = DOT11F_PARSE_SUCCESS;
-    tANI_U16 tmp63__;
+    tANI_U16 tmp60__;
     (void) pBuf; (void)ielen; /* Shutup the compiler */
     if (pDst->present) status = DOT11F_DUPLICATE_IE;
     pDst->present = 1;
@@ -4670,11 +4568,11 @@
     DOT11F_MEMCPY(pCtx, pDst->multicast_cipher_suite, pBuf, 4);
     pBuf += 4;
     ielen -= (tANI_U8)4;
-    framesntohs(pCtx, &tmp63__, pBuf, 0);
+    framesntohs(pCtx, &tmp60__, pBuf, 0);
     pBuf += 2;
     ielen -= 2;
-    pDst->preauth = tmp63__ >> 0 & 0x1;
-    pDst->reserved = tmp63__ >> 1 & 0x7fff;
+    pDst->preauth = tmp60__ >> 0 & 0x1;
+    pDst->reserved = tmp60__ >> 1 & 0x7fff;
     if ( ! ielen )
     {
         pDst->bkid_count = 0U;
@@ -4696,7 +4594,7 @@
     return status;
 } /* End dot11fUnpackIeWAPI. */
 
-#define SigIeWAPI ( 0x0070 )
+#define SigIeWAPI ( 0x006d )
 
 
 tANI_U32 dot11fUnpackIeWAPIOpaque(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWAPIOpaque *pDst)
@@ -4716,7 +4614,7 @@
     return status;
 } /* End dot11fUnpackIeWAPIOpaque. */
 
-#define SigIeWAPIOpaque ( 0x0071 )
+#define SigIeWAPIOpaque ( 0x006e )
 
 
 tANI_U32 dot11fUnpackIeWFATPC(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWFATPC *pDst)
@@ -4733,33 +4631,13 @@
     return status;
 } /* End dot11fUnpackIeWFATPC. */
 
-#define SigIeWFATPC ( 0x0072 )
-
-
-tANI_U32 dot11fUnpackIeWFDIEOpaque(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWFDIEOpaque *pDst)
-{
-    tANI_U32 status = DOT11F_PARSE_SUCCESS;
-    (void) pBuf; (void)ielen; /* Shutup the compiler */
-    if (pDst->present) status = DOT11F_DUPLICATE_IE;
-    pDst->present = 1;
-    pDst->num_data = (tANI_U8)( ielen );
-    if (ielen > 249){
-        pDst->present = 0;
-        return DOT11F_SKIPPED_BAD_IE;
-    }
-
-    DOT11F_MEMCPY(pCtx, pDst->data, pBuf, ( ielen ) );
-    (void)pCtx;
-    return status;
-} /* End dot11fUnpackIeWFDIEOpaque. */
-
-#define SigIeWFDIEOpaque ( 0x0073 )
+#define SigIeWFATPC ( 0x006f )
 
 
 tANI_U32 dot11fUnpackIeWMMCaps(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMCaps *pDst)
 {
     tANI_U32 status = DOT11F_PARSE_SUCCESS;
-    tANI_U8 tmp64__;
+    tANI_U8 tmp61__;
     (void) pBuf; (void)ielen; /* Shutup the compiler */
     if (pDst->present) status = DOT11F_DUPLICATE_IE;
     pDst->present = 1;
@@ -4771,76 +4649,76 @@
             pDst->present = 0;
             return ( status | DOT11F_BAD_FIXED_VALUE );
     }
-    tmp64__ = *pBuf;
-    pDst->reserved = tmp64__ >> 0 & 0xf;
-    pDst->qack = tmp64__ >> 4 & 0x1;
-    pDst->queue_request = tmp64__ >> 5 & 0x1;
-    pDst->txop_request = tmp64__ >> 6 & 0x1;
-    pDst->more_ack = tmp64__ >> 7 & 0x1;
+    tmp61__ = *pBuf;
+    pDst->reserved = tmp61__ >> 0 & 0xf;
+    pDst->qack = tmp61__ >> 4 & 0x1;
+    pDst->queue_request = tmp61__ >> 5 & 0x1;
+    pDst->txop_request = tmp61__ >> 6 & 0x1;
+    pDst->more_ack = tmp61__ >> 7 & 0x1;
     (void)pCtx;
     return status;
 } /* End dot11fUnpackIeWMMCaps. */
 
-#define SigIeWMMCaps ( 0x0074 )
+#define SigIeWMMCaps ( 0x0070 )
 
 
 tANI_U32 dot11fUnpackIeWMMInfoAp(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMInfoAp *pDst)
 {
     tANI_U32 status = DOT11F_PARSE_SUCCESS;
-    tANI_U8 tmp65__;
+    tANI_U8 tmp62__;
     (void) pBuf; (void)ielen; /* Shutup the compiler */
     if (pDst->present) status = DOT11F_DUPLICATE_IE;
     pDst->present = 1;
     pDst->version = *pBuf;
     pBuf += 1;
     ielen -= (tANI_U8)1;
-    tmp65__ = *pBuf;
-    pDst->param_set_count = tmp65__ >> 0 & 0xf;
-    pDst->reserved = tmp65__ >> 4 & 0x7;
-    pDst->uapsd = tmp65__ >> 7 & 0x1;
+    tmp62__ = *pBuf;
+    pDst->param_set_count = tmp62__ >> 0 & 0xf;
+    pDst->reserved = tmp62__ >> 4 & 0x7;
+    pDst->uapsd = tmp62__ >> 7 & 0x1;
     (void)pCtx;
     return status;
 } /* End dot11fUnpackIeWMMInfoAp. */
 
-#define SigIeWMMInfoAp ( 0x0075 )
+#define SigIeWMMInfoAp ( 0x0071 )
 
 
 tANI_U32 dot11fUnpackIeWMMInfoStation(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMInfoStation *pDst)
 {
     tANI_U32 status = DOT11F_PARSE_SUCCESS;
-    tANI_U8 tmp66__;
+    tANI_U8 tmp63__;
     (void) pBuf; (void)ielen; /* Shutup the compiler */
     if (pDst->present) status = DOT11F_DUPLICATE_IE;
     pDst->present = 1;
     pDst->version = *pBuf;
     pBuf += 1;
     ielen -= (tANI_U8)1;
-    tmp66__ = *pBuf;
-    pDst->acvo_uapsd = tmp66__ >> 0 & 0x1;
-    pDst->acvi_uapsd = tmp66__ >> 1 & 0x1;
-    pDst->acbk_uapsd = tmp66__ >> 2 & 0x1;
-    pDst->acbe_uapsd = tmp66__ >> 3 & 0x1;
-    pDst->reserved1 = tmp66__ >> 4 & 0x1;
-    pDst->max_sp_length = tmp66__ >> 5 & 0x3;
-    pDst->reserved2 = tmp66__ >> 7 & 0x1;
+    tmp63__ = *pBuf;
+    pDst->acvo_uapsd = tmp63__ >> 0 & 0x1;
+    pDst->acvi_uapsd = tmp63__ >> 1 & 0x1;
+    pDst->acbk_uapsd = tmp63__ >> 2 & 0x1;
+    pDst->acbe_uapsd = tmp63__ >> 3 & 0x1;
+    pDst->reserved1 = tmp63__ >> 4 & 0x1;
+    pDst->max_sp_length = tmp63__ >> 5 & 0x3;
+    pDst->reserved2 = tmp63__ >> 7 & 0x1;
     (void)pCtx;
     return status;
 } /* End dot11fUnpackIeWMMInfoStation. */
 
-#define SigIeWMMInfoStation ( 0x0076 )
+#define SigIeWMMInfoStation ( 0x0072 )
 
 
 tANI_U32 dot11fUnpackIeWMMParams(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWMMParams *pDst)
 {
     tANI_U32 status = DOT11F_PARSE_SUCCESS;
+    tANI_U8 tmp64__;
+    tANI_U8 tmp65__;
+    tANI_U8 tmp66__;
     tANI_U8 tmp67__;
     tANI_U8 tmp68__;
     tANI_U8 tmp69__;
     tANI_U8 tmp70__;
     tANI_U8 tmp71__;
-    tANI_U8 tmp72__;
-    tANI_U8 tmp73__;
-    tANI_U8 tmp74__;
     (void) pBuf; (void)ielen; /* Shutup the compiler */
     if (pDst->present) status = DOT11F_DUPLICATE_IE;
     pDst->present = 1;
@@ -4858,69 +4736,69 @@
     pDst->reserved2 = *pBuf;
     pBuf += 1;
     ielen -= (tANI_U8)1;
-    tmp67__ = *pBuf;
+    tmp64__ = *pBuf;
     pBuf += 1;
     ielen -= 1;
-    pDst->acbe_aifsn = tmp67__ >> 0 & 0xf;
-    pDst->acbe_acm = tmp67__ >> 4 & 0x1;
-    pDst->acbe_aci = tmp67__ >> 5 & 0x3;
-    pDst->unused1 = tmp67__ >> 7 & 0x1;
-    tmp68__ = *pBuf;
+    pDst->acbe_aifsn = tmp64__ >> 0 & 0xf;
+    pDst->acbe_acm = tmp64__ >> 4 & 0x1;
+    pDst->acbe_aci = tmp64__ >> 5 & 0x3;
+    pDst->unused1 = tmp64__ >> 7 & 0x1;
+    tmp65__ = *pBuf;
     pBuf += 1;
     ielen -= 1;
-    pDst->acbe_acwmin = tmp68__ >> 0 & 0xf;
-    pDst->acbe_acwmax = tmp68__ >> 4 & 0xf;
+    pDst->acbe_acwmin = tmp65__ >> 0 & 0xf;
+    pDst->acbe_acwmax = tmp65__ >> 4 & 0xf;
     framesntohs(pCtx, &pDst->acbe_txoplimit, pBuf, 0);
     pBuf += 2;
     ielen -= (tANI_U8)2;
-    tmp69__ = *pBuf;
+    tmp66__ = *pBuf;
     pBuf += 1;
     ielen -= 1;
-    pDst->acbk_aifsn = tmp69__ >> 0 & 0xf;
-    pDst->acbk_acm = tmp69__ >> 4 & 0x1;
-    pDst->acbk_aci = tmp69__ >> 5 & 0x3;
-    pDst->unused2 = tmp69__ >> 7 & 0x1;
-    tmp70__ = *pBuf;
+    pDst->acbk_aifsn = tmp66__ >> 0 & 0xf;
+    pDst->acbk_acm = tmp66__ >> 4 & 0x1;
+    pDst->acbk_aci = tmp66__ >> 5 & 0x3;
+    pDst->unused2 = tmp66__ >> 7 & 0x1;
+    tmp67__ = *pBuf;
     pBuf += 1;
     ielen -= 1;
-    pDst->acbk_acwmin = tmp70__ >> 0 & 0xf;
-    pDst->acbk_acwmax = tmp70__ >> 4 & 0xf;
+    pDst->acbk_acwmin = tmp67__ >> 0 & 0xf;
+    pDst->acbk_acwmax = tmp67__ >> 4 & 0xf;
     framesntohs(pCtx, &pDst->acbk_txoplimit, pBuf, 0);
     pBuf += 2;
     ielen -= (tANI_U8)2;
-    tmp71__ = *pBuf;
+    tmp68__ = *pBuf;
     pBuf += 1;
     ielen -= 1;
-    pDst->acvi_aifsn = tmp71__ >> 0 & 0xf;
-    pDst->acvi_acm = tmp71__ >> 4 & 0x1;
-    pDst->acvi_aci = tmp71__ >> 5 & 0x3;
-    pDst->unused3 = tmp71__ >> 7 & 0x1;
-    tmp72__ = *pBuf;
+    pDst->acvi_aifsn = tmp68__ >> 0 & 0xf;
+    pDst->acvi_acm = tmp68__ >> 4 & 0x1;
+    pDst->acvi_aci = tmp68__ >> 5 & 0x3;
+    pDst->unused3 = tmp68__ >> 7 & 0x1;
+    tmp69__ = *pBuf;
     pBuf += 1;
     ielen -= 1;
-    pDst->acvi_acwmin = tmp72__ >> 0 & 0xf;
-    pDst->acvi_acwmax = tmp72__ >> 4 & 0xf;
+    pDst->acvi_acwmin = tmp69__ >> 0 & 0xf;
+    pDst->acvi_acwmax = tmp69__ >> 4 & 0xf;
     framesntohs(pCtx, &pDst->acvi_txoplimit, pBuf, 0);
     pBuf += 2;
     ielen -= (tANI_U8)2;
-    tmp73__ = *pBuf;
+    tmp70__ = *pBuf;
     pBuf += 1;
     ielen -= 1;
-    pDst->acvo_aifsn = tmp73__ >> 0 & 0xf;
-    pDst->acvo_acm = tmp73__ >> 4 & 0x1;
-    pDst->acvo_aci = tmp73__ >> 5 & 0x3;
-    pDst->unused4 = tmp73__ >> 7 & 0x1;
-    tmp74__ = *pBuf;
+    pDst->acvo_aifsn = tmp70__ >> 0 & 0xf;
+    pDst->acvo_acm = tmp70__ >> 4 & 0x1;
+    pDst->acvo_aci = tmp70__ >> 5 & 0x3;
+    pDst->unused4 = tmp70__ >> 7 & 0x1;
+    tmp71__ = *pBuf;
     pBuf += 1;
     ielen -= 1;
-    pDst->acvo_acwmin = tmp74__ >> 0 & 0xf;
-    pDst->acvo_acwmax = tmp74__ >> 4 & 0xf;
+    pDst->acvo_acwmin = tmp71__ >> 0 & 0xf;
+    pDst->acvo_acwmax = tmp71__ >> 4 & 0xf;
     framesntohs(pCtx, &pDst->acvo_txoplimit, pBuf, 0);
     (void)pCtx;
     return status;
 } /* End dot11fUnpackIeWMMParams. */
 
-#define SigIeWMMParams ( 0x0077 )
+#define SigIeWMMParams ( 0x0073 )
 
 
 tANI_U32 dot11fUnpackIeWPA(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWPA *pDst)
@@ -5002,7 +4880,7 @@
     return status;
 } /* End dot11fUnpackIeWPA. */
 
-#define SigIeWPA ( 0x0078 )
+#define SigIeWPA ( 0x0074 )
 
 
 tANI_U32 dot11fUnpackIeWPAOpaque(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWPAOpaque *pDst)
@@ -5022,7 +4900,7 @@
     return status;
 } /* End dot11fUnpackIeWPAOpaque. */
 
-#define SigIeWPAOpaque ( 0x0079 )
+#define SigIeWPAOpaque ( 0x0075 )
 
 
     static const tTLVDefn TLVS_WSC[ ] = {
@@ -5060,7 +4938,7 @@
     return status;
 } /* End dot11fUnpackIeWSC. */
 
-#define SigIeWSC ( 0x007a )
+#define SigIeWSC ( 0x0076 )
 
 
     static const tTLVDefn TLVS_WscAssocReq[ ] = {
@@ -5079,7 +4957,7 @@
     return status;
 } /* End dot11fUnpackIeWscAssocReq. */
 
-#define SigIeWscAssocReq ( 0x007b )
+#define SigIeWscAssocReq ( 0x0077 )
 
 
     static const tTLVDefn TLVS_WscAssocRes[ ] = {
@@ -5098,7 +4976,7 @@
     return status;
 } /* End dot11fUnpackIeWscAssocRes. */
 
-#define SigIeWscAssocRes ( 0x007c )
+#define SigIeWscAssocRes ( 0x0078 )
 
 
     static const tTLVDefn TLVS_WscBeacon[ ] = {
@@ -5123,7 +5001,7 @@
     return status;
 } /* End dot11fUnpackIeWscBeacon. */
 
-#define SigIeWscBeacon ( 0x007d )
+#define SigIeWscBeacon ( 0x0079 )
 
 
     static const tTLVDefn TLVS_WscBeaconProbeRes[ ] = {
@@ -5156,7 +5034,7 @@
     return status;
 } /* End dot11fUnpackIeWscBeaconProbeRes. */
 
-#define SigIeWscBeaconProbeRes ( 0x007e )
+#define SigIeWscBeaconProbeRes ( 0x007a )
 
 
 tANI_U32 dot11fUnpackIeWscIEOpaque(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U8 ielen, tDot11fIEWscIEOpaque *pDst)
@@ -5176,7 +5054,7 @@
     return status;
 } /* End dot11fUnpackIeWscIEOpaque. */
 
-#define SigIeWscIEOpaque ( 0x007f )
+#define SigIeWscIEOpaque ( 0x007b )
 
 
     static const tTLVDefn TLVS_WscProbeReq[ ] = {
@@ -5207,7 +5085,7 @@
     return status;
 } /* End dot11fUnpackIeWscProbeReq. */
 
-#define SigIeWscProbeReq ( 0x0080 )
+#define SigIeWscProbeReq ( 0x007c )
 
 
     static const tTLVDefn TLVS_WscProbeRes[ ] = {
@@ -5240,7 +5118,7 @@
     return status;
 } /* End dot11fUnpackIeWscProbeRes. */
 
-#define SigIeWscProbeRes ( 0x0081 )
+#define SigIeWscProbeRes ( 0x007d )
 
 
     static const tTLVDefn TLVS_WscReassocRes[ ] = {
@@ -5259,7 +5137,7 @@
     return status;
 } /* End dot11fUnpackIeWscReassocRes. */
 
-#define SigIeWscReassocRes ( 0x0082 )
+#define SigIeWscReassocRes ( 0x007e )
 
 
     static const tFFDefn FFS_AddBAReq[] = {
@@ -5914,8 +5792,6 @@
         {offsetof(tDot11fAssocRequest, CCXRadMgmtCap), offsetof(tDot11fIECCXRadMgmtCap, present), 0, "CCXRadMgmtCap" , 0, 8, 8, SigIeCCXRadMgmtCap, {0, 64, 150, 1, 0}, 4, DOT11F_EID_CCXRADMGMTCAP, 0, },
         {offsetof(tDot11fAssocRequest, CCXVersion), offsetof(tDot11fIECCXVersion, present), 0, "CCXVersion" , 0, 7, 7, SigIeCCXVersion, {0, 64, 150, 3, 0}, 4, DOT11F_EID_CCXVERSION, 0, },
         {offsetof(tDot11fAssocRequest, P2PIEOpaque), offsetof(tDot11fIEP2PIEOpaque, present), 0, "P2PIEOpaque" , 0, 8, 255, SigIeP2PIEOpaque, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PIEOPAQUE, 0, },
-        {offsetof(tDot11fAssocRequest, WFDIEOpaque), offsetof(tDot11fIEWFDIEOpaque, present), 0, "WFDIEOpaque" , 0, 8, 255, SigIeWFDIEOpaque, {80, 111, 154, 10, 0}, 4, DOT11F_EID_WFDIEOPAQUE, 0, },
-        {offsetof(tDot11fAssocRequest, VHTCaps), offsetof(tDot11fIEVHTCaps, present), 0, "VHTCaps" , 0, 14, 14, SigIeVHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTCAPS, 0, },
     {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
 
 tANI_U32 dot11fUnpackAssocRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAssocRequest *pFrm)
@@ -6432,50 +6308,6 @@
             FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->P2PIEOpaque.num_data);
             FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->P2PIEOpaque.data, pFrm->P2PIEOpaque.num_data);
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WFDIEOpaque:\n"));
-        if (!pFrm->WFDIEOpaque.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WFDIEOpaque.num_data);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->WFDIEOpaque.data, pFrm->WFDIEOpaque.num_data);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
     }
 #   endif // DOT11F_DUMP_FRAMES
     return status;
@@ -6511,8 +6343,6 @@
         {offsetof(tDot11fAssocResponse, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
         {offsetof(tDot11fAssocResponse, WscAssocRes), offsetof(tDot11fIEWscAssocRes, present), 0, "WscAssocRes" , 0, 6, 37, SigIeWscAssocRes, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCASSOCRES, 0, },
         {offsetof(tDot11fAssocResponse, P2PAssocRes), offsetof(tDot11fIEP2PAssocRes, present), 0, "P2PAssocRes" , 0, 6, 17, SigIeP2PAssocRes, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PASSOCRES, 0, },
-        {offsetof(tDot11fAssocResponse, VHTCaps), offsetof(tDot11fIEVHTCaps, present), 0, "VHTCaps" , 0, 14, 14, SigIeVHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTCAPS, 0, },
-        {offsetof(tDot11fAssocResponse, VHTOperation), offsetof(tDot11fIEVHTOperation, present), 0, "VHTOperation" , 0, 7, 7, SigIeVHTOperation, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTOPERATION, 0, },
     {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
 
 tANI_U32 dot11fUnpackAssocResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fAssocResponse *pFrm)
@@ -7514,52 +7344,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityInterval, 2);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
     }
 #   endif // DOT11F_DUMP_FRAMES
     return status;
@@ -8008,9 +7792,6 @@
         {offsetof(tDot11fBeacon, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
         {offsetof(tDot11fBeacon, WscBeacon), offsetof(tDot11fIEWscBeacon, present), 0, "WscBeacon" , 0, 6, 84, SigIeWscBeacon, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCBEACON, 0, },
         {offsetof(tDot11fBeacon, P2PBeacon), offsetof(tDot11fIEP2PBeacon, present), 0, "P2PBeacon" , 0, 6, 61, SigIeP2PBeacon, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PBEACON, 0, },
-        {offsetof(tDot11fBeacon, VHTCaps), offsetof(tDot11fIEVHTCaps, present), 0, "VHTCaps" , 0, 14, 14, SigIeVHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTCAPS, 0, },
-        {offsetof(tDot11fBeacon, VHTOperation), offsetof(tDot11fIEVHTOperation, present), 0, "VHTOperation" , 0, 7, 7, SigIeVHTOperation, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTOPERATION, 0, },
-        {offsetof(tDot11fBeacon, VHTExtBssLoad), offsetof(tDot11fIEVHTExtBssLoad, present), 0, "VHTExtBssLoad" , 0, 7, 7, SigIeVHTExtBssLoad, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTEXTBSSLOAD, 0, },
     {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
 
 tANI_U32 dot11fUnpackBeacon(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fBeacon *pFrm)
@@ -8957,65 +8738,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->P2PBeacon.NoticeOfAbsence.NoADesc, pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("VHTExtBssLoad:\n"));
-        if (!pFrm->VHTExtBssLoad.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTExtBssLoad.muMIMOCapStaCount, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTExtBssLoad.ssUnderUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTExtBssLoad.FortyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTExtBssLoad.EightyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTExtBssLoad.OneSixtyMHzUtil, 1);
-        }
     }
 #   endif // DOT11F_DUMP_FRAMES
     return status;
@@ -9145,9 +8867,6 @@
         {offsetof(tDot11fBeacon2, CCXTrafStrmMet), offsetof(tDot11fIECCXTrafStrmMet, present), 0, "CCXTrafStrmMet" , 0, 10, 10, SigIeCCXTrafStrmMet, {0, 64, 150, 7, 0}, 4, DOT11F_EID_CCXTRAFSTRMMET, 0, },
         {offsetof(tDot11fBeacon2, CCXTxmitPower), offsetof(tDot11fIECCXTxmitPower, present), 0, "CCXTxmitPower" , 0, 8, 8, SigIeCCXTxmitPower, {0, 64, 150, 0, 0}, 4, DOT11F_EID_CCXTXMITPOWER, 0, },
         {offsetof(tDot11fBeacon2, P2PBeacon), offsetof(tDot11fIEP2PBeacon, present), 0, "P2PBeacon" , 0, 6, 61, SigIeP2PBeacon, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PBEACON, 0, },
-        {offsetof(tDot11fBeacon2, VHTCaps), offsetof(tDot11fIEVHTCaps, present), 0, "VHTCaps" , 0, 14, 14, SigIeVHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTCAPS, 0, },
-        {offsetof(tDot11fBeacon2, VHTOperation), offsetof(tDot11fIEVHTOperation, present), 0, "VHTOperation" , 0, 7, 7, SigIeVHTOperation, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTOPERATION, 0, },
-        {offsetof(tDot11fBeacon2, VHTExtBssLoad), offsetof(tDot11fIEVHTExtBssLoad, present), 0, "VHTExtBssLoad" , 0, 7, 7, SigIeVHTExtBssLoad, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTEXTBSSLOAD, 0, },
     {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
 
 tANI_U32 dot11fUnpackBeacon2(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fBeacon2 *pFrm)
@@ -9950,65 +9669,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->P2PBeacon.NoticeOfAbsence.NoADesc, pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("VHTExtBssLoad:\n"));
-        if (!pFrm->VHTExtBssLoad.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTExtBssLoad.muMIMOCapStaCount, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTExtBssLoad.ssUnderUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTExtBssLoad.FortyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTExtBssLoad.EightyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTExtBssLoad.OneSixtyMHzUtil, 1);
-        }
     }
 #   endif // DOT11F_DUMP_FRAMES
     return status;
@@ -10058,9 +9718,6 @@
         {offsetof(tDot11fBeaconIEs, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
         {offsetof(tDot11fBeaconIEs, WscBeaconProbeRes), offsetof(tDot11fIEWscBeaconProbeRes, present), 0, "WscBeaconProbeRes" , 0, 6, 319, SigIeWscBeaconProbeRes, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCBEACONPROBERES, 0, },
         {offsetof(tDot11fBeaconIEs, P2PBeaconProbeRes), offsetof(tDot11fIEP2PBeaconProbeRes, present), 0, "P2PBeaconProbeRes" , 0, 6, 1150, SigIeP2PBeaconProbeRes, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PBEACONPROBERES, 0, },
-        {offsetof(tDot11fBeaconIEs, VHTCaps), offsetof(tDot11fIEVHTCaps, present), 0, "VHTCaps" , 0, 14, 14, SigIeVHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTCAPS, 0, },
-        {offsetof(tDot11fBeaconIEs, VHTOperation), offsetof(tDot11fIEVHTOperation, present), 0, "VHTOperation" , 0, 7, 7, SigIeVHTOperation, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTOPERATION, 0, },
-        {offsetof(tDot11fBeaconIEs, VHTExtBssLoad), offsetof(tDot11fIEVHTExtBssLoad, present), 0, "VHTExtBssLoad" , 0, 7, 7, SigIeVHTExtBssLoad, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTEXTBSSLOAD, 0, },
     {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
 
 tANI_U32 dot11fUnpackBeaconIEs(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fBeaconIEs *pFrm)
@@ -11115,65 +10772,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->P2PBeaconProbeRes.P2PGroupInfo.P2PClientInfoDesc, pFrm->P2PBeaconProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("VHTExtBssLoad:\n"));
-        if (!pFrm->VHTExtBssLoad.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTExtBssLoad.muMIMOCapStaCount, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTExtBssLoad.ssUnderUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTExtBssLoad.FortyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTExtBssLoad.EightyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTExtBssLoad.OneSixtyMHzUtil, 1);
-        }
     }
 #   endif // DOT11F_DUMP_FRAMES
     return status;
@@ -12939,7 +12537,6 @@
         {offsetof(tDot11fProbeRequest, WscProbeReq), offsetof(tDot11fIEWscProbeReq, present), 0, "WscProbeReq" , 0, 6, 286, SigIeWscProbeReq, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCPROBEREQ, 0, },
         {offsetof(tDot11fProbeRequest, WFATPC), offsetof(tDot11fIEWFATPC, present), 0, "WFATPC" , 0, 9, 9, SigIeWFATPC, {0, 80, 242, 8, 0}, 5, DOT11F_EID_WFATPC, 0, },
         {offsetof(tDot11fProbeRequest, P2PProbeReq), offsetof(tDot11fIEP2PProbeReq, present), 0, "P2PProbeReq" , 0, 6, 43, SigIeP2PProbeReq, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PPROBEREQ, 0, },
-        {offsetof(tDot11fProbeRequest, VHTCaps), offsetof(tDot11fIEVHTCaps, present), 0, "VHTCaps" , 0, 14, 14, SigIeVHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTCAPS, 0, },
     {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
 
 tANI_U32 dot11fUnpackProbeRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fProbeRequest *pFrm)
@@ -13310,40 +12907,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.OperatingChannel.channel, 1);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
     }
 #   endif // DOT11F_DUMP_FRAMES
     return status;
@@ -13393,9 +12956,6 @@
         {offsetof(tDot11fProbeResponse, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
         {offsetof(tDot11fProbeResponse, WscProbeRes), offsetof(tDot11fIEWscProbeRes, present), 0, "WscProbeRes" , 0, 6, 319, SigIeWscProbeRes, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCPROBERES, 0, },
         {offsetof(tDot11fProbeResponse, P2PProbeRes), offsetof(tDot11fIEP2PProbeRes, present), 0, "P2PProbeRes" , 0, 6, 1141, SigIeP2PProbeRes, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PPROBERES, 0, },
-        {offsetof(tDot11fProbeResponse, VHTCaps), offsetof(tDot11fIEVHTCaps, present), 0, "VHTCaps" , 0, 14, 14, SigIeVHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTCAPS, 0, },
-        {offsetof(tDot11fProbeResponse, VHTOperation), offsetof(tDot11fIEVHTOperation, present), 0, "VHTOperation" , 0, 7, 7, SigIeVHTOperation, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTOPERATION, 0, },
-        {offsetof(tDot11fProbeResponse, VHTExtBssLoad), offsetof(tDot11fIEVHTExtBssLoad, present), 0, "VHTExtBssLoad" , 0, 7, 7, SigIeVHTExtBssLoad, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTEXTBSSLOAD, 0, },
     {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
 
 tANI_U32 dot11fUnpackProbeResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fProbeResponse *pFrm)
@@ -14427,65 +13987,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->P2PProbeRes.P2PGroupInfo.P2PClientInfoDesc, pFrm->P2PProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("VHTExtBssLoad:\n"));
-        if (!pFrm->VHTExtBssLoad.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTExtBssLoad.muMIMOCapStaCount, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTExtBssLoad.ssUnderUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTExtBssLoad.FortyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTExtBssLoad.EightyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTExtBssLoad.OneSixtyMHzUtil, 1);
-        }
     }
 #   endif // DOT11F_DUMP_FRAMES
     return status;
@@ -14858,8 +14359,6 @@
         {offsetof(tDot11fReAssocRequest, WMMTSPEC), offsetof(tDot11fIEWMMTSPEC, present), offsetof(tDot11fReAssocRequest, num_WMMTSPEC), "WMMTSPEC" , 4, 63, 63, SigIeWMMTSPEC, {0, 80, 242, 2, 2}, 5, DOT11F_EID_WMMTSPEC, 0, },
         {offsetof(tDot11fReAssocRequest, CCXTrafStrmRateSet), offsetof(tDot11fIECCXTrafStrmRateSet, present), 0, "CCXTrafStrmRateSet" , 0, 7, 15, SigIeCCXTrafStrmRateSet, {0, 64, 150, 8, 0}, 4, DOT11F_EID_CCXTRAFSTRMRATESET, 0, },
         {offsetof(tDot11fReAssocRequest, P2PIEOpaque), offsetof(tDot11fIEP2PIEOpaque, present), 0, "P2PIEOpaque" , 0, 8, 255, SigIeP2PIEOpaque, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PIEOPAQUE, 0, },
-        {offsetof(tDot11fReAssocRequest, WFDIEOpaque), offsetof(tDot11fIEWFDIEOpaque, present), 0, "WFDIEOpaque" , 0, 8, 255, SigIeWFDIEOpaque, {80, 111, 154, 10, 0}, 4, DOT11F_EID_WFDIEOPAQUE, 0, },
-        {offsetof(tDot11fReAssocRequest, VHTCaps), offsetof(tDot11fIEVHTCaps, present), 0, "VHTCaps" , 0, 14, 14, SigIeVHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTCAPS, 0, },
     {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
 
 tANI_U32 dot11fUnpackReAssocRequest(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fReAssocRequest *pFrm)
@@ -15751,50 +15250,6 @@
             FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->P2PIEOpaque.num_data);
             FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->P2PIEOpaque.data, pFrm->P2PIEOpaque.num_data);
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WFDIEOpaque:\n"));
-        if (!pFrm->WFDIEOpaque.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WFDIEOpaque.num_data);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->WFDIEOpaque.data, pFrm->WFDIEOpaque.num_data);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
     }
 #   endif // DOT11F_DUMP_FRAMES
     return status;
@@ -15831,8 +15286,6 @@
         {offsetof(tDot11fReAssocResponse, Airgo), offsetof(tDot11fIEAirgo, present), 0, "Airgo" , 0, 5, 232, SigIeAirgo, {0, 10, 245, 0, 0}, 3, DOT11F_EID_AIRGO, 0, },
         {offsetof(tDot11fReAssocResponse, WscReassocRes), offsetof(tDot11fIEWscReassocRes, present), 0, "WscReassocRes" , 0, 6, 37, SigIeWscReassocRes, {0, 80, 242, 4, 0}, 4, DOT11F_EID_WSCREASSOCRES, 0, },
         {offsetof(tDot11fReAssocResponse, P2PAssocRes), offsetof(tDot11fIEP2PAssocRes, present), 0, "P2PAssocRes" , 0, 6, 17, SigIeP2PAssocRes, {80, 111, 154, 9, 0}, 4, DOT11F_EID_P2PASSOCRES, 0, },
-        {offsetof(tDot11fReAssocResponse, VHTCaps), offsetof(tDot11fIEVHTCaps, present), 0, "VHTCaps" , 0, 14, 14, SigIeVHTCaps, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTCAPS, 0, },
-        {offsetof(tDot11fReAssocResponse, VHTOperation), offsetof(tDot11fIEVHTOperation, present), 0, "VHTOperation" , 0, 7, 7, SigIeVHTOperation, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTOPERATION, 0, },
     {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },    };
 
 tANI_U32 dot11fUnpackReAssocResponse(tpAniSirGlobal pCtx, tANI_U8 *pBuf, tANI_U32 nBuf, tDot11fReAssocResponse *pFrm)
@@ -16841,52 +16294,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityInterval, 2);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
     }
 #   endif // DOT11F_DUMP_FRAMES
     return status;
@@ -17848,15 +17255,6 @@
                 case SigIeTPCRequest:
                         status |= dot11fUnpackIeTPCRequest(pCtx, pBufRemaining, len, ( tDot11fIETPCRequest* )(pFrm + pIe->offset + sizeof(tDot11fIETPCRequest)*countOffset) );
                             break;
-                case SigIeVHTCaps:
-                        status |= dot11fUnpackIeVHTCaps(pCtx, pBufRemaining, len, ( tDot11fIEVHTCaps* )(pFrm + pIe->offset + sizeof(tDot11fIEVHTCaps)*countOffset) );
-                            break;
-                case SigIeVHTExtBssLoad:
-                        status |= dot11fUnpackIeVHTExtBssLoad(pCtx, pBufRemaining, len, ( tDot11fIEVHTExtBssLoad* )(pFrm + pIe->offset + sizeof(tDot11fIEVHTExtBssLoad)*countOffset) );
-                            break;
-                case SigIeVHTOperation:
-                        status |= dot11fUnpackIeVHTOperation(pCtx, pBufRemaining, len, ( tDot11fIEVHTOperation* )(pFrm + pIe->offset + sizeof(tDot11fIEVHTOperation)*countOffset) );
-                            break;
                 case SigIeWAPI:
                         status |= dot11fUnpackIeWAPI(pCtx, pBufRemaining, len, ( tDot11fIEWAPI* )(pFrm + pIe->offset + sizeof(tDot11fIEWAPI)*countOffset) );
                             break;
@@ -17866,9 +17264,6 @@
                 case SigIeWFATPC:
                         status |= dot11fUnpackIeWFATPC(pCtx, pBufRemaining, len, ( tDot11fIEWFATPC* )(pFrm + pIe->offset + sizeof(tDot11fIEWFATPC)*countOffset) );
                             break;
-                case SigIeWFDIEOpaque:
-                        status |= dot11fUnpackIeWFDIEOpaque(pCtx, pBufRemaining, len, ( tDot11fIEWFDIEOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIEWFDIEOpaque)*countOffset) );
-                            break;
                 case SigIeWMMCaps:
                         status |= dot11fUnpackIeWMMCaps(pCtx, pBufRemaining, len, ( tDot11fIEWMMCaps* )(pFrm + pIe->offset + sizeof(tDot11fIEWMMCaps)*countOffset) );
                             break;
@@ -19922,21 +19317,6 @@
                             byteCount = 0;
                             pIePresent = ( (tDot11fIETPCRequest* )(pFrm + pIe->offset + offset * i  ))->present;
                             break;
-                case SigIeVHTCaps:
-                            offset = sizeof(tDot11fIEVHTCaps);
-                            byteCount = 12;
-                            pIePresent = ( (tDot11fIEVHTCaps* )(pFrm + pIe->offset + offset * i  ))->present;
-                            break;
-                case SigIeVHTExtBssLoad:
-                            offset = sizeof(tDot11fIEVHTExtBssLoad);
-                            byteCount = 5;
-                            pIePresent = ( (tDot11fIEVHTExtBssLoad* )(pFrm + pIe->offset + offset * i  ))->present;
-                            break;
-                case SigIeVHTOperation:
-                            offset = sizeof(tDot11fIEVHTOperation);
-                            byteCount = 5;
-                            pIePresent = ( (tDot11fIEVHTOperation* )(pFrm + pIe->offset + offset * i  ))->present;
-                            break;
                 case SigIeWAPI:
                             offset = sizeof(tDot11fIEWAPI);
                             status |= dot11fGetPackedIEWAPI(pCtx, ( tDot11fIEWAPI* )(pFrm + pIe->offset + offset * i ), pnNeeded);
@@ -19951,11 +19331,6 @@
                             byteCount = 2;
                             pIePresent = ( (tDot11fIEWFATPC* )(pFrm + pIe->offset + offset * i  ))->present;
                             break;
-                case SigIeWFDIEOpaque:
-                            offset = sizeof(tDot11fIEWFDIEOpaque);
-                            byteCount = ((tDot11fIEWFDIEOpaque* )(pFrm + pIe->offset + sizeof(tDot11fIEWFDIEOpaque) * i ))->num_data;
-                            pIePresent = ( (tDot11fIEWFDIEOpaque* )(pFrm + pIe->offset + offset * i  ))->present;
-                            break;
                 case SigIeWMMCaps:
                             offset = sizeof(tDot11fIEWMMCaps);
                             byteCount = 2;
@@ -20274,13 +19649,13 @@
                                    tDot11fFfAddBAParameterSet *pSrc,
                                    tANI_U8 *pBuf)
 {
-    tANI_U16 tmp75__;
-    tmp75__ = 0U;
-    tmp75__ |= ( pSrc->amsduSupported << 0 );
-    tmp75__ |= ( pSrc->policy << 1 );
-    tmp75__ |= ( pSrc->tid << 2 );
-    tmp75__ |= ( pSrc->bufferSize << 6 );
-    frameshtons(pCtx, pBuf, tmp75__, 0);
+    tANI_U16 tmp72__;
+    tmp72__ = 0U;
+    tmp72__ |= ( pSrc->amsduSupported << 0 );
+    tmp72__ |= ( pSrc->policy << 1 );
+    tmp72__ |= ( pSrc->tid << 2 );
+    tmp72__ |= ( pSrc->bufferSize << 6 );
+    frameshtons(pCtx, pBuf, tmp72__, 0);
     (void)pCtx;
 } /* End dot11fPackFfAddBAParameterSet. */
 
@@ -20304,11 +19679,11 @@
                                            tDot11fFfBAStartingSequenceControl *pSrc,
                                            tANI_U8 *pBuf)
 {
-    tANI_U16 tmp76__;
-    tmp76__ = 0U;
-    tmp76__ |= ( pSrc->fragNumber << 0 );
-    tmp76__ |= ( pSrc->ssn << 4 );
-    frameshtons(pCtx, pBuf, tmp76__, 0);
+    tANI_U16 tmp73__;
+    tmp73__ = 0U;
+    tmp73__ |= ( pSrc->fragNumber << 0 );
+    tmp73__ |= ( pSrc->ssn << 4 );
+    frameshtons(pCtx, pBuf, tmp73__, 0);
     (void)pCtx;
 } /* End dot11fPackFfBAStartingSequenceControl. */
 
@@ -20332,25 +19707,25 @@
                               tDot11fFfCapabilities *pSrc,
                               tANI_U8 *pBuf)
 {
-    tANI_U16 tmp77__;
-    tmp77__ = 0U;
-    tmp77__ |= ( pSrc->ess << 0 );
-    tmp77__ |= ( pSrc->ibss << 1 );
-    tmp77__ |= ( pSrc->cfPollable << 2 );
-    tmp77__ |= ( pSrc->cfPollReq << 3 );
-    tmp77__ |= ( pSrc->privacy << 4 );
-    tmp77__ |= ( pSrc->shortPreamble << 5 );
-    tmp77__ |= ( pSrc->pbcc << 6 );
-    tmp77__ |= ( pSrc->channelAgility << 7 );
-    tmp77__ |= ( pSrc->spectrumMgt << 8 );
-    tmp77__ |= ( pSrc->qos << 9 );
-    tmp77__ |= ( pSrc->shortSlotTime << 10 );
-    tmp77__ |= ( pSrc->apsd << 11 );
-    tmp77__ |= ( pSrc->rrm << 12 );
-    tmp77__ |= ( pSrc->dsssOfdm << 13 );
-    tmp77__ |= ( pSrc->delayedBA << 14 );
-    tmp77__ |= ( pSrc->immediateBA << 15 );
-    frameshtons(pCtx, pBuf, tmp77__, 0);
+    tANI_U16 tmp74__;
+    tmp74__ = 0U;
+    tmp74__ |= ( pSrc->ess << 0 );
+    tmp74__ |= ( pSrc->ibss << 1 );
+    tmp74__ |= ( pSrc->cfPollable << 2 );
+    tmp74__ |= ( pSrc->cfPollReq << 3 );
+    tmp74__ |= ( pSrc->privacy << 4 );
+    tmp74__ |= ( pSrc->shortPreamble << 5 );
+    tmp74__ |= ( pSrc->pbcc << 6 );
+    tmp74__ |= ( pSrc->channelAgility << 7 );
+    tmp74__ |= ( pSrc->spectrumMgt << 8 );
+    tmp74__ |= ( pSrc->qos << 9 );
+    tmp74__ |= ( pSrc->shortSlotTime << 10 );
+    tmp74__ |= ( pSrc->apsd << 11 );
+    tmp74__ |= ( pSrc->rrm << 12 );
+    tmp74__ |= ( pSrc->dsssOfdm << 13 );
+    tmp74__ |= ( pSrc->delayedBA << 14 );
+    tmp74__ |= ( pSrc->immediateBA << 15 );
+    frameshtons(pCtx, pBuf, tmp74__, 0);
     (void)pCtx;
 } /* End dot11fPackFfCapabilities. */
 
@@ -20374,12 +19749,12 @@
                                    tDot11fFfDelBAParameterSet *pSrc,
                                    tANI_U8 *pBuf)
 {
-    tANI_U16 tmp78__;
-    tmp78__ = 0U;
-    tmp78__ |= ( pSrc->reserved << 0 );
-    tmp78__ |= ( pSrc->initiator << 11 );
-    tmp78__ |= ( pSrc->tid << 12 );
-    frameshtons(pCtx, pBuf, tmp78__, 0);
+    tANI_U16 tmp75__;
+    tmp75__ = 0U;
+    tmp75__ |= ( pSrc->reserved << 0 );
+    tmp75__ |= ( pSrc->initiator << 11 );
+    tmp75__ |= ( pSrc->tid << 12 );
+    frameshtons(pCtx, pBuf, tmp75__, 0);
     (void)pCtx;
 } /* End dot11fPackFfDelBAParameterSet. */
 
@@ -20475,12 +19850,12 @@
                                 tDot11fFfSMPowerModeSet *pSrc,
                                 tANI_U8 *pBuf)
 {
-    tANI_U8 tmp79__;
-    tmp79__ = 0U;
-    tmp79__ |= ( pSrc->PowerSave_En << 0 );
-    tmp79__ |= ( pSrc->Mode << 1 );
-    tmp79__ |= ( pSrc->reserved << 2 );
-    *pBuf = tmp79__;
+    tANI_U8 tmp76__;
+    tmp76__ = 0U;
+    tmp76__ |= ( pSrc->PowerSave_En << 0 );
+    tmp76__ |= ( pSrc->Mode << 1 );
+    tmp76__ |= ( pSrc->reserved << 2 );
+    *pBuf = tmp76__;
     (void)pCtx;
 } /* End dot11fPackFfSMPowerModeSet. */
 
@@ -20520,19 +19895,19 @@
                         tDot11fFfTSInfo *pSrc,
                         tANI_U8 *pBuf)
 {
-    tANI_U32 tmp80__;
-    tmp80__ = 0U;
-    tmp80__ |= ( pSrc->traffic_type << 0 );
-    tmp80__ |= ( pSrc->tsid << 1 );
-    tmp80__ |= ( pSrc->direction << 5 );
-    tmp80__ |= ( pSrc->access_policy << 7 );
-    tmp80__ |= ( pSrc->aggregation << 9 );
-    tmp80__ |= ( pSrc->psb << 10 );
-    tmp80__ |= ( pSrc->user_priority << 11 );
-    tmp80__ |= ( pSrc->tsinfo_ack_pol << 14 );
-    tmp80__ |= ( pSrc->schedule << 16 );
-    tmp80__ |= ( pSrc->unused << 17 );
-    frameshtonl(pCtx, pBuf, tmp80__, 0);
+    tANI_U32 tmp77__;
+    tmp77__ = 0U;
+    tmp77__ |= ( pSrc->traffic_type << 0 );
+    tmp77__ |= ( pSrc->tsid << 1 );
+    tmp77__ |= ( pSrc->direction << 5 );
+    tmp77__ |= ( pSrc->access_policy << 7 );
+    tmp77__ |= ( pSrc->aggregation << 9 );
+    tmp77__ |= ( pSrc->psb << 10 );
+    tmp77__ |= ( pSrc->user_priority << 11 );
+    tmp77__ |= ( pSrc->tsinfo_ack_pol << 14 );
+    tmp77__ |= ( pSrc->schedule << 16 );
+    tmp77__ |= ( pSrc->unused << 17 );
+    frameshtonl(pCtx, pBuf, tmp77__, 0);
     (void)pCtx;
 } /* End dot11fPackFfTSInfo. */
 
@@ -20629,7 +20004,7 @@
     tANI_U8* pTlvLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp81__;
+    tANI_U8 tmp78__;
     nNeeded += 3;
     if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
     while ( pSrc->present )
@@ -20638,10 +20013,10 @@
         pBuf += 1; *pnConsumed += 1;
         pTlvLen = pBuf;
         pBuf += 1; *pnConsumed += 1;
-        tmp81__ = 0U;
-        tmp81__ |= ( pSrc->minor << 0 );
-        tmp81__ |= ( pSrc->major << 4 );
-        *pBuf = tmp81__;
+        tmp78__ = 0U;
+        tmp78__ |= ( pSrc->minor << 0 );
+        tmp78__ |= ( pSrc->major << 4 );
+        *pBuf = tmp78__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
@@ -21850,7 +21225,7 @@
     tANI_U8* pTlvLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp82__;
+    tANI_U8 tmp79__;
     nNeeded += 5;
     if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
     while ( pSrc->present )
@@ -21859,10 +21234,10 @@
         pBuf += 2; *pnConsumed += 2;
         pTlvLen = pBuf;
         pBuf += 2; *pnConsumed += 2;
-        tmp82__ = 0U;
-        tmp82__ |= ( pSrc->minor << 0 );
-        tmp82__ |= ( pSrc->major << 4 );
-        *pBuf = tmp82__;
+        tmp79__ = 0U;
+        tmp79__ |= ( pSrc->minor << 0 );
+        tmp79__ |= ( pSrc->major << 4 );
+        *pBuf = tmp79__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
@@ -22068,7 +21443,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U16 tmp83__;
+    tANI_U16 tmp80__;
     nNeeded  +=  (pSrc->num_key + 11);
     while ( pSrc->present )
     {
@@ -22077,10 +21452,10 @@
         ++pBuf; ++(*pnConsumed);
         pIeLen = pBuf;
         ++pBuf; ++(*pnConsumed);
-        tmp83__ = 0U;
-        tmp83__ |= ( pSrc->keyId << 0 );
-        tmp83__ |= ( pSrc->reserved << 2 );
-        frameshtons(pCtx, pBuf, tmp83__, 0);
+        tmp80__ = 0U;
+        tmp80__ |= ( pSrc->keyId << 0 );
+        tmp80__ |= ( pSrc->reserved << 2 );
+        frameshtons(pCtx, pBuf, tmp80__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
@@ -22337,14 +21712,14 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp81__;
+    tANI_U8 tmp82__;
+    tANI_U8 tmp83__;
     tANI_U8 tmp84__;
     tANI_U8 tmp85__;
     tANI_U8 tmp86__;
     tANI_U8 tmp87__;
     tANI_U8 tmp88__;
-    tANI_U8 tmp89__;
-    tANI_U8 tmp90__;
-    tANI_U8 tmp91__;
     nNeeded  += 18;
     while ( pSrc->present )
     {
@@ -22359,76 +21734,76 @@
         *pBuf = pSrc->reserved;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp84__ = 0U;
-        tmp84__ |= ( pSrc->acbe_aifsn << 0 );
-        tmp84__ |= ( pSrc->acbe_acm << 4 );
-        tmp84__ |= ( pSrc->acbe_aci << 5 );
-        tmp84__ |= ( pSrc->unused1 << 7 );
-        *pBuf = tmp84__;
+        tmp81__ = 0U;
+        tmp81__ |= ( pSrc->acbe_aifsn << 0 );
+        tmp81__ |= ( pSrc->acbe_acm << 4 );
+        tmp81__ |= ( pSrc->acbe_aci << 5 );
+        tmp81__ |= ( pSrc->unused1 << 7 );
+        *pBuf = tmp81__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp85__ = 0U;
-        tmp85__ |= ( pSrc->acbe_min << 0 );
-        tmp85__ |= ( pSrc->acbe_max << 4 );
-        *pBuf = tmp85__;
+        tmp82__ = 0U;
+        tmp82__ |= ( pSrc->acbe_min << 0 );
+        tmp82__ |= ( pSrc->acbe_max << 4 );
+        *pBuf = tmp82__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
         frameshtons(pCtx, pBuf, pSrc->acbe_txoplimit, 0);
         *pnConsumed += 2;
         pBuf += 2;
-        tmp86__ = 0U;
-        tmp86__ |= ( pSrc->acbk_aifsn << 0 );
-        tmp86__ |= ( pSrc->acbk_acm << 4 );
-        tmp86__ |= ( pSrc->acbk_aci << 5 );
-        tmp86__ |= ( pSrc->unused2 << 7 );
-        *pBuf = tmp86__;
+        tmp83__ = 0U;
+        tmp83__ |= ( pSrc->acbk_aifsn << 0 );
+        tmp83__ |= ( pSrc->acbk_acm << 4 );
+        tmp83__ |= ( pSrc->acbk_aci << 5 );
+        tmp83__ |= ( pSrc->unused2 << 7 );
+        *pBuf = tmp83__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp87__ = 0U;
-        tmp87__ |= ( pSrc->acbk_min << 0 );
-        tmp87__ |= ( pSrc->acbk_max << 4 );
-        *pBuf = tmp87__;
+        tmp84__ = 0U;
+        tmp84__ |= ( pSrc->acbk_min << 0 );
+        tmp84__ |= ( pSrc->acbk_max << 4 );
+        *pBuf = tmp84__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
         frameshtons(pCtx, pBuf, pSrc->acbk_txoplimit, 0);
         *pnConsumed += 2;
         pBuf += 2;
-        tmp88__ = 0U;
-        tmp88__ |= ( pSrc->acvi_aifsn << 0 );
-        tmp88__ |= ( pSrc->acvi_acm << 4 );
-        tmp88__ |= ( pSrc->acvi_aci << 5 );
-        tmp88__ |= ( pSrc->unused3 << 7 );
-        *pBuf = tmp88__;
+        tmp85__ = 0U;
+        tmp85__ |= ( pSrc->acvi_aifsn << 0 );
+        tmp85__ |= ( pSrc->acvi_acm << 4 );
+        tmp85__ |= ( pSrc->acvi_aci << 5 );
+        tmp85__ |= ( pSrc->unused3 << 7 );
+        *pBuf = tmp85__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp89__ = 0U;
-        tmp89__ |= ( pSrc->acvi_min << 0 );
-        tmp89__ |= ( pSrc->acvi_max << 4 );
-        *pBuf = tmp89__;
+        tmp86__ = 0U;
+        tmp86__ |= ( pSrc->acvi_min << 0 );
+        tmp86__ |= ( pSrc->acvi_max << 4 );
+        *pBuf = tmp86__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
         frameshtons(pCtx, pBuf, pSrc->acvi_txoplimit, 0);
         *pnConsumed += 2;
         pBuf += 2;
-        tmp90__ = 0U;
-        tmp90__ |= ( pSrc->acvo_aifsn << 0 );
-        tmp90__ |= ( pSrc->acvo_acm << 4 );
-        tmp90__ |= ( pSrc->acvo_aci << 5 );
-        tmp90__ |= ( pSrc->unused4 << 7 );
-        *pBuf = tmp90__;
+        tmp87__ = 0U;
+        tmp87__ |= ( pSrc->acvo_aifsn << 0 );
+        tmp87__ |= ( pSrc->acvo_acm << 4 );
+        tmp87__ |= ( pSrc->acvo_aci << 5 );
+        tmp87__ |= ( pSrc->unused4 << 7 );
+        *pBuf = tmp87__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp91__ = 0U;
-        tmp91__ |= ( pSrc->acvo_min << 0 );
-        tmp91__ |= ( pSrc->acvo_max << 4 );
-        *pBuf = tmp91__;
+        tmp88__ = 0U;
+        tmp88__ |= ( pSrc->acvo_min << 0 );
+        tmp88__ |= ( pSrc->acvo_max << 4 );
+        *pBuf = tmp88__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
@@ -22616,7 +21991,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U16 tmp92__;
+    tANI_U16 tmp89__;
     nNeeded  += 6;
     while ( pSrc->present )
     {
@@ -22631,10 +22006,10 @@
         frameshtons(pCtx, pBuf, pSrc->baPolicy, 0);
         *pnConsumed += 2;
         pBuf += 2;
-        tmp92__ = 0U;
-        tmp92__ |= ( pSrc->baBufferSize << 0 );
-        tmp92__ |= ( pSrc->rsvd << 12 );
-        frameshtons(pCtx, pBuf, tmp92__, 0);
+        tmp89__ = 0U;
+        tmp89__ |= ( pSrc->baBufferSize << 0 );
+        tmp89__ |= ( pSrc->rsvd << 12 );
+        frameshtons(pCtx, pBuf, tmp89__, 0);
         *pnConsumed += 2;
         // fieldsEndFlag  = 1 
         nBuf -=  2 ;
@@ -23053,11 +22428,11 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp90__;
+    tANI_U8 tmp91__;
+    tANI_U8 tmp92__;
     tANI_U8 tmp93__;
     tANI_U8 tmp94__;
-    tANI_U8 tmp95__;
-    tANI_U8 tmp96__;
-    tANI_U8 tmp97__;
     nNeeded  += 5;
     while ( pSrc->present )
     {
@@ -23066,58 +22441,58 @@
         ++pBuf; ++(*pnConsumed);
         pIeLen = pBuf;
         ++pBuf; ++(*pnConsumed);
+        tmp90__ = 0U;
+        tmp90__ |= ( pSrc->LinkMeasurement << 0 );
+        tmp90__ |= ( pSrc->NeighborRpt << 1 );
+        tmp90__ |= ( pSrc->parallel << 2 );
+        tmp90__ |= ( pSrc->repeated << 3 );
+        tmp90__ |= ( pSrc->BeaconPassive << 4 );
+        tmp90__ |= ( pSrc->BeaconActive << 5 );
+        tmp90__ |= ( pSrc->BeaconTable << 6 );
+        tmp90__ |= ( pSrc->BeaconRepCond << 7 );
+        *pBuf = tmp90__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp91__ = 0U;
+        tmp91__ |= ( pSrc->FrameMeasurement << 0 );
+        tmp91__ |= ( pSrc->ChannelLoad << 1 );
+        tmp91__ |= ( pSrc->NoiseHistogram << 2 );
+        tmp91__ |= ( pSrc->statistics << 3 );
+        tmp91__ |= ( pSrc->LCIMeasurement << 4 );
+        tmp91__ |= ( pSrc->LCIAzimuth << 5 );
+        tmp91__ |= ( pSrc->TCMCapability << 6 );
+        tmp91__ |= ( pSrc->triggeredTCM << 7 );
+        *pBuf = tmp91__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
+        tmp92__ = 0U;
+        tmp92__ |= ( pSrc->APChanReport << 0 );
+        tmp92__ |= ( pSrc->RRMMIBEnabled << 1 );
+        tmp92__ |= ( pSrc->operatingChanMax << 2 );
+        tmp92__ |= ( pSrc->nonOperatinChanMax << 5 );
+        *pBuf = tmp92__;
+        *pnConsumed += 1;
+        pBuf += 1;
+        nBuf -=  1 ;
         tmp93__ = 0U;
-        tmp93__ |= ( pSrc->LinkMeasurement << 0 );
-        tmp93__ |= ( pSrc->NeighborRpt << 1 );
-        tmp93__ |= ( pSrc->parallel << 2 );
-        tmp93__ |= ( pSrc->repeated << 3 );
-        tmp93__ |= ( pSrc->BeaconPassive << 4 );
-        tmp93__ |= ( pSrc->BeaconActive << 5 );
-        tmp93__ |= ( pSrc->BeaconTable << 6 );
-        tmp93__ |= ( pSrc->BeaconRepCond << 7 );
+        tmp93__ |= ( pSrc->MeasurementPilot << 0 );
+        tmp93__ |= ( pSrc->MeasurementPilotEnabled << 3 );
+        tmp93__ |= ( pSrc->NeighborTSFOffset << 4 );
+        tmp93__ |= ( pSrc->RCPIMeasurement << 5 );
+        tmp93__ |= ( pSrc->RSNIMeasurement << 6 );
+        tmp93__ |= ( pSrc->BssAvgAccessDelay << 7 );
         *pBuf = tmp93__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
         tmp94__ = 0U;
-        tmp94__ |= ( pSrc->FrameMeasurement << 0 );
-        tmp94__ |= ( pSrc->ChannelLoad << 1 );
-        tmp94__ |= ( pSrc->NoiseHistogram << 2 );
-        tmp94__ |= ( pSrc->statistics << 3 );
-        tmp94__ |= ( pSrc->LCIMeasurement << 4 );
-        tmp94__ |= ( pSrc->LCIAzimuth << 5 );
-        tmp94__ |= ( pSrc->TCMCapability << 6 );
-        tmp94__ |= ( pSrc->triggeredTCM << 7 );
+        tmp94__ |= ( pSrc->BSSAvailAdmission << 0 );
+        tmp94__ |= ( pSrc->AntennaInformation << 1 );
+        tmp94__ |= ( pSrc->reserved << 2 );
         *pBuf = tmp94__;
         *pnConsumed += 1;
-        pBuf += 1;
-        nBuf -=  1 ;
-        tmp95__ = 0U;
-        tmp95__ |= ( pSrc->APChanReport << 0 );
-        tmp95__ |= ( pSrc->RRMMIBEnabled << 1 );
-        tmp95__ |= ( pSrc->operatingChanMax << 2 );
-        tmp95__ |= ( pSrc->nonOperatinChanMax << 5 );
-        *pBuf = tmp95__;
-        *pnConsumed += 1;
-        pBuf += 1;
-        nBuf -=  1 ;
-        tmp96__ = 0U;
-        tmp96__ |= ( pSrc->MeasurementPilot << 0 );
-        tmp96__ |= ( pSrc->MeasurementPilotEnabled << 3 );
-        tmp96__ |= ( pSrc->NeighborTSFOffset << 4 );
-        tmp96__ |= ( pSrc->RCPIMeasurement << 5 );
-        tmp96__ |= ( pSrc->RSNIMeasurement << 6 );
-        tmp96__ |= ( pSrc->BssAvgAccessDelay << 7 );
-        *pBuf = tmp96__;
-        *pnConsumed += 1;
-        pBuf += 1;
-        nBuf -=  1 ;
-        tmp97__ = 0U;
-        tmp97__ |= ( pSrc->BSSAvailAdmission << 0 );
-        tmp97__ |= ( pSrc->AntennaInformation << 1 );
-        tmp97__ |= ( pSrc->reserved << 2 );
-        *pBuf = tmp97__;
-        *pnConsumed += 1;
         // fieldsEndFlag  = 1 
         nBuf -=  1 ;
         break;
@@ -23199,7 +22574,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U16 tmp98__;
+    tANI_U16 tmp95__;
     nNeeded  += 14;
     while ( pSrc->present )
     {
@@ -23208,12 +22583,12 @@
         ++pBuf; ++(*pnConsumed);
         pIeLen = pBuf;
         ++pBuf; ++(*pnConsumed);
-        tmp98__ = 0U;
-        tmp98__ |= ( pSrc->aggregation << 0 );
-        tmp98__ |= ( pSrc->tsid << 1 );
-        tmp98__ |= ( pSrc->direction << 5 );
-        tmp98__ |= ( pSrc->reserved << 7 );
-        frameshtons(pCtx, pBuf, tmp98__, 0);
+        tmp95__ = 0U;
+        tmp95__ |= ( pSrc->aggregation << 0 );
+        tmp95__ |= ( pSrc->tsid << 1 );
+        tmp95__ |= ( pSrc->direction << 5 );
+        tmp95__ |= ( pSrc->reserved << 7 );
+        frameshtons(pCtx, pBuf, tmp95__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
@@ -23413,9 +22788,9 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U16 tmp99__;
-    tANI_U8 tmp100__;
-    tANI_U16 tmp101__;
+    tANI_U16 tmp96__;
+    tANI_U8 tmp97__;
+    tANI_U16 tmp98__;
     nNeeded  += 55;
     while ( pSrc->present )
     {
@@ -23424,30 +22799,30 @@
         ++pBuf; ++(*pnConsumed);
         pIeLen = pBuf;
         ++pBuf; ++(*pnConsumed);
-        tmp99__ = 0U;
-        tmp99__ |= ( pSrc->traffic_type << 0 );
-        tmp99__ |= ( pSrc->tsid << 1 );
-        tmp99__ |= ( pSrc->direction << 5 );
-        tmp99__ |= ( pSrc->access_policy << 7 );
-        tmp99__ |= ( pSrc->aggregation << 9 );
-        tmp99__ |= ( pSrc->psb << 10 );
-        tmp99__ |= ( pSrc->user_priority << 11 );
-        tmp99__ |= ( pSrc->tsinfo_ack_pol << 14 );
-        frameshtons(pCtx, pBuf, tmp99__, 0);
+        tmp96__ = 0U;
+        tmp96__ |= ( pSrc->traffic_type << 0 );
+        tmp96__ |= ( pSrc->tsid << 1 );
+        tmp96__ |= ( pSrc->direction << 5 );
+        tmp96__ |= ( pSrc->access_policy << 7 );
+        tmp96__ |= ( pSrc->aggregation << 9 );
+        tmp96__ |= ( pSrc->psb << 10 );
+        tmp96__ |= ( pSrc->user_priority << 11 );
+        tmp96__ |= ( pSrc->tsinfo_ack_pol << 14 );
+        frameshtons(pCtx, pBuf, tmp96__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
-        tmp100__ = 0U;
-        tmp100__ |= ( pSrc->schedule << 0 );
-        tmp100__ |= ( pSrc->unused << 1 );
-        *pBuf = tmp100__;
+        tmp97__ = 0U;
+        tmp97__ |= ( pSrc->schedule << 0 );
+        tmp97__ |= ( pSrc->unused << 1 );
+        *pBuf = tmp97__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp101__ = 0U;
-        tmp101__ |= ( pSrc->size << 0 );
-        tmp101__ |= ( pSrc->fixed << 15 );
-        frameshtons(pCtx, pBuf, tmp101__, 0);
+        tmp98__ = 0U;
+        tmp98__ |= ( pSrc->size << 0 );
+        tmp98__ |= ( pSrc->fixed << 15 );
+        frameshtons(pCtx, pBuf, tmp98__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
@@ -23512,7 +22887,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U16 tmp102__;
+    tANI_U16 tmp99__;
     nNeeded  += 15;
     while ( pSrc->present )
     {
@@ -23534,12 +22909,12 @@
         *pBuf = pSrc->version;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp102__ = 0U;
-        tmp102__ |= ( pSrc->aggregation << 0 );
-        tmp102__ |= ( pSrc->tsid << 1 );
-        tmp102__ |= ( pSrc->direction << 5 );
-        tmp102__ |= ( pSrc->reserved << 7 );
-        frameshtons(pCtx, pBuf, tmp102__, 0);
+        tmp99__ = 0U;
+        tmp99__ |= ( pSrc->aggregation << 0 );
+        tmp99__ |= ( pSrc->tsid << 1 );
+        tmp99__ |= ( pSrc->direction << 5 );
+        tmp99__ |= ( pSrc->reserved << 7 );
+        frameshtons(pCtx, pBuf, tmp99__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
@@ -23778,9 +23153,9 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U16 tmp103__;
-    tANI_U8 tmp104__;
-    tANI_U16 tmp105__;
+    tANI_U16 tmp100__;
+    tANI_U8 tmp101__;
+    tANI_U16 tmp102__;
     nNeeded  += 38;
     while ( pSrc->present )
     {
@@ -23802,30 +23177,30 @@
         *pBuf = pSrc->version;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp103__ = 0U;
-        tmp103__ |= ( pSrc->traffic_type << 0 );
-        tmp103__ |= ( pSrc->tsid << 1 );
-        tmp103__ |= ( pSrc->direction << 5 );
-        tmp103__ |= ( pSrc->access_policy << 7 );
-        tmp103__ |= ( pSrc->aggregation << 9 );
-        tmp103__ |= ( pSrc->psb << 10 );
-        tmp103__ |= ( pSrc->user_priority << 11 );
-        tmp103__ |= ( pSrc->tsinfo_ack_pol << 14 );
-        frameshtons(pCtx, pBuf, tmp103__, 0);
+        tmp100__ = 0U;
+        tmp100__ |= ( pSrc->traffic_type << 0 );
+        tmp100__ |= ( pSrc->tsid << 1 );
+        tmp100__ |= ( pSrc->direction << 5 );
+        tmp100__ |= ( pSrc->access_policy << 7 );
+        tmp100__ |= ( pSrc->aggregation << 9 );
+        tmp100__ |= ( pSrc->psb << 10 );
+        tmp100__ |= ( pSrc->user_priority << 11 );
+        tmp100__ |= ( pSrc->tsinfo_ack_pol << 14 );
+        frameshtons(pCtx, pBuf, tmp100__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
-        tmp104__ = 0U;
-        tmp104__ |= ( pSrc->tsinfo_rsvd << 0 );
-        tmp104__ |= ( pSrc->burst_size_defn << 7 );
-        *pBuf = tmp104__;
+        tmp101__ = 0U;
+        tmp101__ |= ( pSrc->tsinfo_rsvd << 0 );
+        tmp101__ |= ( pSrc->burst_size_defn << 7 );
+        *pBuf = tmp101__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp105__ = 0U;
-        tmp105__ |= ( pSrc->size << 0 );
-        tmp105__ |= ( pSrc->fixed << 15 );
-        frameshtons(pCtx, pBuf, tmp105__, 0);
+        tmp102__ = 0U;
+        tmp102__ |= ( pSrc->size << 0 );
+        tmp102__ |= ( pSrc->fixed << 15 );
+        frameshtons(pCtx, pBuf, tmp102__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
@@ -23970,7 +23345,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp106__;
+    tANI_U8 tmp103__;
     nNeeded  += 2;
     while ( pSrc->present )
     {
@@ -23990,10 +23365,10 @@
         *pBuf = pSrc->mgmt_state;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp106__ = 0U;
-        tmp106__ |= ( pSrc->mbssid_mask << 0 );
-        tmp106__ |= ( pSrc->reserved << 3 );
-        *pBuf = tmp106__;
+        tmp103__ = 0U;
+        tmp103__ |= ( pSrc->mbssid_mask << 0 );
+        tmp103__ |= ( pSrc->reserved << 3 );
+        *pBuf = tmp103__;
         *pnConsumed += 1;
         // fieldsEndFlag  = 1 
         nBuf -=  1 ;
@@ -24353,14 +23728,14 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp104__;
+    tANI_U8 tmp105__;
+    tANI_U8 tmp106__;
     tANI_U8 tmp107__;
     tANI_U8 tmp108__;
     tANI_U8 tmp109__;
     tANI_U8 tmp110__;
     tANI_U8 tmp111__;
-    tANI_U8 tmp112__;
-    tANI_U8 tmp113__;
-    tANI_U8 tmp114__;
     nNeeded  += 18;
     while ( pSrc->present )
     {
@@ -24375,76 +23750,76 @@
         *pBuf = pSrc->reserved;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp107__ = 0U;
-        tmp107__ |= ( pSrc->acbe_aifsn << 0 );
-        tmp107__ |= ( pSrc->acbe_acm << 4 );
-        tmp107__ |= ( pSrc->acbe_aci << 5 );
-        tmp107__ |= ( pSrc->unused1 << 7 );
-        *pBuf = tmp107__;
+        tmp104__ = 0U;
+        tmp104__ |= ( pSrc->acbe_aifsn << 0 );
+        tmp104__ |= ( pSrc->acbe_acm << 4 );
+        tmp104__ |= ( pSrc->acbe_aci << 5 );
+        tmp104__ |= ( pSrc->unused1 << 7 );
+        *pBuf = tmp104__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp108__ = 0U;
-        tmp108__ |= ( pSrc->acbe_acwmin << 0 );
-        tmp108__ |= ( pSrc->acbe_acwmax << 4 );
-        *pBuf = tmp108__;
+        tmp105__ = 0U;
+        tmp105__ |= ( pSrc->acbe_acwmin << 0 );
+        tmp105__ |= ( pSrc->acbe_acwmax << 4 );
+        *pBuf = tmp105__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
         frameshtons(pCtx, pBuf, pSrc->acbe_txoplimit, 0);
         *pnConsumed += 2;
         pBuf += 2;
-        tmp109__ = 0U;
-        tmp109__ |= ( pSrc->acbk_aifsn << 0 );
-        tmp109__ |= ( pSrc->acbk_acm << 4 );
-        tmp109__ |= ( pSrc->acbk_aci << 5 );
-        tmp109__ |= ( pSrc->unused2 << 7 );
-        *pBuf = tmp109__;
+        tmp106__ = 0U;
+        tmp106__ |= ( pSrc->acbk_aifsn << 0 );
+        tmp106__ |= ( pSrc->acbk_acm << 4 );
+        tmp106__ |= ( pSrc->acbk_aci << 5 );
+        tmp106__ |= ( pSrc->unused2 << 7 );
+        *pBuf = tmp106__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp110__ = 0U;
-        tmp110__ |= ( pSrc->acbk_acwmin << 0 );
-        tmp110__ |= ( pSrc->acbk_acwmax << 4 );
-        *pBuf = tmp110__;
+        tmp107__ = 0U;
+        tmp107__ |= ( pSrc->acbk_acwmin << 0 );
+        tmp107__ |= ( pSrc->acbk_acwmax << 4 );
+        *pBuf = tmp107__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
         frameshtons(pCtx, pBuf, pSrc->acbk_txoplimit, 0);
         *pnConsumed += 2;
         pBuf += 2;
-        tmp111__ = 0U;
-        tmp111__ |= ( pSrc->acvi_aifsn << 0 );
-        tmp111__ |= ( pSrc->acvi_acm << 4 );
-        tmp111__ |= ( pSrc->acvi_aci << 5 );
-        tmp111__ |= ( pSrc->unused3 << 7 );
-        *pBuf = tmp111__;
+        tmp108__ = 0U;
+        tmp108__ |= ( pSrc->acvi_aifsn << 0 );
+        tmp108__ |= ( pSrc->acvi_acm << 4 );
+        tmp108__ |= ( pSrc->acvi_aci << 5 );
+        tmp108__ |= ( pSrc->unused3 << 7 );
+        *pBuf = tmp108__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp112__ = 0U;
-        tmp112__ |= ( pSrc->acvi_acwmin << 0 );
-        tmp112__ |= ( pSrc->acvi_acwmax << 4 );
-        *pBuf = tmp112__;
+        tmp109__ = 0U;
+        tmp109__ |= ( pSrc->acvi_acwmin << 0 );
+        tmp109__ |= ( pSrc->acvi_acwmax << 4 );
+        *pBuf = tmp109__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
         frameshtons(pCtx, pBuf, pSrc->acvi_txoplimit, 0);
         *pnConsumed += 2;
         pBuf += 2;
-        tmp113__ = 0U;
-        tmp113__ |= ( pSrc->acvo_aifsn << 0 );
-        tmp113__ |= ( pSrc->acvo_acm << 4 );
-        tmp113__ |= ( pSrc->acvo_aci << 5 );
-        tmp113__ |= ( pSrc->unused4 << 7 );
-        *pBuf = tmp113__;
+        tmp110__ = 0U;
+        tmp110__ |= ( pSrc->acvo_aifsn << 0 );
+        tmp110__ |= ( pSrc->acvo_acm << 4 );
+        tmp110__ |= ( pSrc->acvo_aci << 5 );
+        tmp110__ |= ( pSrc->unused4 << 7 );
+        *pBuf = tmp110__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp114__ = 0U;
-        tmp114__ |= ( pSrc->acvo_acwmin << 0 );
-        tmp114__ |= ( pSrc->acvo_acwmax << 4 );
-        *pBuf = tmp114__;
+        tmp111__ = 0U;
+        tmp111__ |= ( pSrc->acvo_acwmin << 0 );
+        tmp111__ |= ( pSrc->acvo_acwmax << 4 );
+        *pBuf = tmp111__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
@@ -24470,7 +23845,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp115__;
+    tANI_U8 tmp112__;
     nNeeded  += 1;
     while ( pSrc->present )
     {
@@ -24479,12 +23854,12 @@
         ++pBuf; ++(*pnConsumed);
         pIeLen = pBuf;
         ++pBuf; ++(*pnConsumed);
-        tmp115__ = 0U;
-        tmp115__ |= ( pSrc->non_erp_present << 0 );
-        tmp115__ |= ( pSrc->use_prot << 1 );
-        tmp115__ |= ( pSrc->barker_preamble << 2 );
-        tmp115__ |= ( pSrc->unused << 3 );
-        *pBuf = tmp115__;
+        tmp112__ = 0U;
+        tmp112__ |= ( pSrc->non_erp_present << 0 );
+        tmp112__ |= ( pSrc->use_prot << 1 );
+        tmp112__ |= ( pSrc->barker_preamble << 2 );
+        tmp112__ |= ( pSrc->unused << 3 );
+        *pBuf = tmp112__;
         *pnConsumed += 1;
         // fieldsEndFlag  = 1 
         nBuf -=  1 ;
@@ -24681,7 +24056,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U16 tmp116__;
+    tANI_U16 tmp113__;
     tANI_U32 status = DOT11F_PARSE_SUCCESS;
     status = dot11fGetPackedIEFTInfo(pCtx, pSrc, &nNeeded);
     if ( ! DOT11F_SUCCEEDED( status ) ) return status;
@@ -24692,10 +24067,10 @@
         ++pBuf; --nBuf; ++(*pnConsumed);
         pIeLen = pBuf;
         ++pBuf; --nBuf; ++(*pnConsumed);
-        tmp116__ = 0U;
-        tmp116__ |= ( pSrc->reserved << 0 );
-        tmp116__ |= ( pSrc->IECount << 8 );
-        frameshtons(pCtx, pBuf, tmp116__, 0);
+        tmp113__ = 0U;
+        tmp113__ |= ( pSrc->reserved << 0 );
+        tmp113__ |= ( pSrc->IECount << 8 );
+        frameshtons(pCtx, pBuf, tmp113__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
@@ -24767,11 +24142,11 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U16 tmp117__;
+    tANI_U16 tmp114__;
+    tANI_U8 tmp115__;
+    tANI_U16 tmp116__;
+    tANI_U32 tmp117__;
     tANI_U8 tmp118__;
-    tANI_U16 tmp119__;
-    tANI_U32 tmp120__;
-    tANI_U8 tmp121__;
     nNeeded  +=  (pSrc->num_rsvd + 26);
     while ( pSrc->present )
     {
@@ -24780,77 +24155,77 @@
         ++pBuf; ++(*pnConsumed);
         pIeLen = pBuf;
         ++pBuf; ++(*pnConsumed);
-        tmp117__ = 0U;
-        tmp117__ |= ( pSrc->advCodingCap << 0 );
-        tmp117__ |= ( pSrc->supportedChannelWidthSet << 1 );
-        tmp117__ |= ( pSrc->mimoPowerSave << 2 );
-        tmp117__ |= ( pSrc->greenField << 4 );
-        tmp117__ |= ( pSrc->shortGI20MHz << 5 );
-        tmp117__ |= ( pSrc->shortGI40MHz << 6 );
-        tmp117__ |= ( pSrc->txSTBC << 7 );
-        tmp117__ |= ( pSrc->rxSTBC << 8 );
-        tmp117__ |= ( pSrc->delayedBA << 10 );
-        tmp117__ |= ( pSrc->maximalAMSDUsize << 11 );
-        tmp117__ |= ( pSrc->dsssCckMode40MHz << 12 );
-        tmp117__ |= ( pSrc->psmp << 13 );
-        tmp117__ |= ( pSrc->stbcControlFrame << 14 );
-        tmp117__ |= ( pSrc->lsigTXOPProtection << 15 );
-        frameshtons(pCtx, pBuf, tmp117__, 0);
+        tmp114__ = 0U;
+        tmp114__ |= ( pSrc->advCodingCap << 0 );
+        tmp114__ |= ( pSrc->supportedChannelWidthSet << 1 );
+        tmp114__ |= ( pSrc->mimoPowerSave << 2 );
+        tmp114__ |= ( pSrc->greenField << 4 );
+        tmp114__ |= ( pSrc->shortGI20MHz << 5 );
+        tmp114__ |= ( pSrc->shortGI40MHz << 6 );
+        tmp114__ |= ( pSrc->txSTBC << 7 );
+        tmp114__ |= ( pSrc->rxSTBC << 8 );
+        tmp114__ |= ( pSrc->delayedBA << 10 );
+        tmp114__ |= ( pSrc->maximalAMSDUsize << 11 );
+        tmp114__ |= ( pSrc->dsssCckMode40MHz << 12 );
+        tmp114__ |= ( pSrc->psmp << 13 );
+        tmp114__ |= ( pSrc->stbcControlFrame << 14 );
+        tmp114__ |= ( pSrc->lsigTXOPProtection << 15 );
+        frameshtons(pCtx, pBuf, tmp114__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
-        tmp118__ = 0U;
-        tmp118__ |= ( pSrc->maxRxAMPDUFactor << 0 );
-        tmp118__ |= ( pSrc->mpduDensity << 2 );
-        tmp118__ |= ( pSrc->reserved1 << 5 );
-        *pBuf = tmp118__;
+        tmp115__ = 0U;
+        tmp115__ |= ( pSrc->maxRxAMPDUFactor << 0 );
+        tmp115__ |= ( pSrc->mpduDensity << 2 );
+        tmp115__ |= ( pSrc->reserved1 << 5 );
+        *pBuf = tmp115__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
         DOT11F_MEMCPY(pCtx, pBuf, pSrc->supportedMCSSet, 16);
         *pnConsumed += 16;
         pBuf += 16;
-        tmp119__ = 0U;
-        tmp119__ |= ( pSrc->pco << 0 );
-        tmp119__ |= ( pSrc->transitionTime << 1 );
-        tmp119__ |= ( pSrc->reserved2 << 3 );
-        tmp119__ |= ( pSrc->mcsFeedback << 8 );
-        tmp119__ |= ( pSrc->reserved3 << 10 );
-        frameshtons(pCtx, pBuf, tmp119__, 0);
+        tmp116__ = 0U;
+        tmp116__ |= ( pSrc->pco << 0 );
+        tmp116__ |= ( pSrc->transitionTime << 1 );
+        tmp116__ |= ( pSrc->reserved2 << 3 );
+        tmp116__ |= ( pSrc->mcsFeedback << 8 );
+        tmp116__ |= ( pSrc->reserved3 << 10 );
+        frameshtons(pCtx, pBuf, tmp116__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
-        tmp120__ = 0U;
-        tmp120__ |= ( pSrc->txBF << 0 );
-        tmp120__ |= ( pSrc->rxStaggeredSounding << 1 );
-        tmp120__ |= ( pSrc->txStaggeredSounding << 2 );
-        tmp120__ |= ( pSrc->rxZLF << 3 );
-        tmp120__ |= ( pSrc->txZLF << 4 );
-        tmp120__ |= ( pSrc->implicitTxBF << 5 );
-        tmp120__ |= ( pSrc->calibration << 6 );
-        tmp120__ |= ( pSrc->explicitCSITxBF << 8 );
-        tmp120__ |= ( pSrc->explicitUncompressedSteeringMatrix << 9 );
-        tmp120__ |= ( pSrc->explicitBFCSIFeedback << 10 );
-        tmp120__ |= ( pSrc->explicitUncompressedSteeringMatrixFeedback << 13 );
-        tmp120__ |= ( pSrc->explicitCompressedSteeringMatrixFeedback << 16 );
-        tmp120__ |= ( pSrc->csiNumBFAntennae << 19 );
-        tmp120__ |= ( pSrc->uncompressedSteeringMatrixBFAntennae << 21 );
-        tmp120__ |= ( pSrc->compressedSteeringMatrixBFAntennae << 23 );
-        tmp120__ |= ( pSrc->reserved4 << 25 );
-        frameshtonl(pCtx, pBuf, tmp120__, 0);
+        tmp117__ = 0U;
+        tmp117__ |= ( pSrc->txBF << 0 );
+        tmp117__ |= ( pSrc->rxStaggeredSounding << 1 );
+        tmp117__ |= ( pSrc->txStaggeredSounding << 2 );
+        tmp117__ |= ( pSrc->rxZLF << 3 );
+        tmp117__ |= ( pSrc->txZLF << 4 );
+        tmp117__ |= ( pSrc->implicitTxBF << 5 );
+        tmp117__ |= ( pSrc->calibration << 6 );
+        tmp117__ |= ( pSrc->explicitCSITxBF << 8 );
+        tmp117__ |= ( pSrc->explicitUncompressedSteeringMatrix << 9 );
+        tmp117__ |= ( pSrc->explicitBFCSIFeedback << 10 );
+        tmp117__ |= ( pSrc->explicitUncompressedSteeringMatrixFeedback << 13 );
+        tmp117__ |= ( pSrc->explicitCompressedSteeringMatrixFeedback << 16 );
+        tmp117__ |= ( pSrc->csiNumBFAntennae << 19 );
+        tmp117__ |= ( pSrc->uncompressedSteeringMatrixBFAntennae << 21 );
+        tmp117__ |= ( pSrc->compressedSteeringMatrixBFAntennae << 23 );
+        tmp117__ |= ( pSrc->reserved4 << 25 );
+        frameshtonl(pCtx, pBuf, tmp117__, 0);
         *pnConsumed += 4;
         pBuf += 4;
         nBuf -=  4 ;
-        tmp121__ = 0U;
-        tmp121__ |= ( pSrc->antennaSelection << 0 );
-        tmp121__ |= ( pSrc->explicitCSIFeedbackTx << 1 );
-        tmp121__ |= ( pSrc->antennaIndicesFeedbackTx << 2 );
-        tmp121__ |= ( pSrc->explicitCSIFeedback << 3 );
-        tmp121__ |= ( pSrc->antennaIndicesFeedback << 4 );
-        tmp121__ |= ( pSrc->rxAS << 5 );
-        tmp121__ |= ( pSrc->txSoundingPPDUs << 6 );
-        tmp121__ |= ( pSrc->reserved5 << 7 );
-        *pBuf = tmp121__;
+        tmp118__ = 0U;
+        tmp118__ |= ( pSrc->antennaSelection << 0 );
+        tmp118__ |= ( pSrc->explicitCSIFeedbackTx << 1 );
+        tmp118__ |= ( pSrc->antennaIndicesFeedbackTx << 2 );
+        tmp118__ |= ( pSrc->explicitCSIFeedback << 3 );
+        tmp118__ |= ( pSrc->antennaIndicesFeedback << 4 );
+        tmp118__ |= ( pSrc->rxAS << 5 );
+        tmp118__ |= ( pSrc->txSoundingPPDUs << 6 );
+        tmp118__ |= ( pSrc->reserved5 << 7 );
+        *pBuf = tmp118__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
@@ -24876,9 +24251,9 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp122__;
-    tANI_U16 tmp123__;
-    tANI_U16 tmp124__;
+    tANI_U8 tmp119__;
+    tANI_U16 tmp120__;
+    tANI_U16 tmp121__;
     nNeeded  +=  (pSrc->num_rsvd + 22);
     while ( pSrc->present )
     {
@@ -24890,35 +24265,35 @@
         *pBuf = pSrc->primaryChannel;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp122__ = 0U;
-        tmp122__ |= ( pSrc->secondaryChannelOffset << 0 );
-        tmp122__ |= ( pSrc->recommendedTxWidthSet << 2 );
-        tmp122__ |= ( pSrc->rifsMode << 3 );
-        tmp122__ |= ( pSrc->controlledAccessOnly << 4 );
-        tmp122__ |= ( pSrc->serviceIntervalGranularity << 5 );
-        *pBuf = tmp122__;
+        tmp119__ = 0U;
+        tmp119__ |= ( pSrc->secondaryChannelOffset << 0 );
+        tmp119__ |= ( pSrc->recommendedTxWidthSet << 2 );
+        tmp119__ |= ( pSrc->rifsMode << 3 );
+        tmp119__ |= ( pSrc->controlledAccessOnly << 4 );
+        tmp119__ |= ( pSrc->serviceIntervalGranularity << 5 );
+        *pBuf = tmp119__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp123__ = 0U;
-        tmp123__ |= ( pSrc->opMode << 0 );
-        tmp123__ |= ( pSrc->nonGFDevicesPresent << 2 );
-        tmp123__ |= ( pSrc->transmitBurstLimit << 3 );
-        tmp123__ |= ( pSrc->obssNonHTStaPresent << 4 );
-        tmp123__ |= ( pSrc->reserved << 5 );
-        frameshtons(pCtx, pBuf, tmp123__, 0);
+        tmp120__ = 0U;
+        tmp120__ |= ( pSrc->opMode << 0 );
+        tmp120__ |= ( pSrc->nonGFDevicesPresent << 2 );
+        tmp120__ |= ( pSrc->transmitBurstLimit << 3 );
+        tmp120__ |= ( pSrc->obssNonHTStaPresent << 4 );
+        tmp120__ |= ( pSrc->reserved << 5 );
+        frameshtons(pCtx, pBuf, tmp120__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
-        tmp124__ = 0U;
-        tmp124__ |= ( pSrc->basicSTBCMCS << 0 );
-        tmp124__ |= ( pSrc->dualCTSProtection << 7 );
-        tmp124__ |= ( pSrc->secondaryBeacon << 8 );
-        tmp124__ |= ( pSrc->lsigTXOPProtectionFullSupport << 9 );
-        tmp124__ |= ( pSrc->pcoActive << 10 );
-        tmp124__ |= ( pSrc->pcoPhase << 11 );
-        tmp124__ |= ( pSrc->reserved2 << 12 );
-        frameshtons(pCtx, pBuf, tmp124__, 0);
+        tmp121__ = 0U;
+        tmp121__ |= ( pSrc->basicSTBCMCS << 0 );
+        tmp121__ |= ( pSrc->dualCTSProtection << 7 );
+        tmp121__ |= ( pSrc->secondaryBeacon << 8 );
+        tmp121__ |= ( pSrc->lsigTXOPProtectionFullSupport << 9 );
+        tmp121__ |= ( pSrc->pcoActive << 10 );
+        tmp121__ |= ( pSrc->pcoPhase << 11 );
+        tmp121__ |= ( pSrc->reserved2 << 12 );
+        frameshtons(pCtx, pBuf, tmp121__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
@@ -24977,9 +24352,9 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp125__;
-    tANI_U8 tmp126__;
-    tANI_U8 tmp127__;
+    tANI_U8 tmp122__;
+    tANI_U8 tmp123__;
+    tANI_U8 tmp124__;
     tANI_U32 status = DOT11F_PARSE_SUCCESS;
     status = dot11fGetPackedIEMeasurementReport(pCtx, pSrc, &nNeeded);
     if ( ! DOT11F_SUCCEEDED( status ) ) return status;
@@ -24993,12 +24368,12 @@
         *pBuf = pSrc->token;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp125__ = 0U;
-        tmp125__ |= ( pSrc->late << 0 );
-        tmp125__ |= ( pSrc->incapable << 1 );
-        tmp125__ |= ( pSrc->refused << 2 );
-        tmp125__ |= ( pSrc->unused << 3 );
-        *pBuf = tmp125__;
+        tmp122__ = 0U;
+        tmp122__ |= ( pSrc->late << 0 );
+        tmp122__ |= ( pSrc->incapable << 1 );
+        tmp122__ |= ( pSrc->refused << 2 );
+        tmp122__ |= ( pSrc->unused << 3 );
+        *pBuf = tmp122__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
@@ -25018,14 +24393,14 @@
                     frameshtons(pCtx, pBuf, pSrc->report.Basic.meas_duration, 0);
                     *pnConsumed += 2;
                     pBuf += 2;
-                    tmp126__ = 0U;
-                    tmp126__ |= ( pSrc->report.Basic.bss << 0 );
-                    tmp126__ |= ( pSrc->report.Basic.ofdm_preamble << 1 );
-                    tmp126__ |= ( pSrc->report.Basic.unid_signal << 2 );
-                    tmp126__ |= ( pSrc->report.Basic.rader << 3 );
-                    tmp126__ |= ( pSrc->report.Basic.unmeasured << 4 );
-                    tmp126__ |= ( pSrc->report.Basic.unused << 5 );
-                    *pBuf = tmp126__;
+                    tmp123__ = 0U;
+                    tmp123__ |= ( pSrc->report.Basic.bss << 0 );
+                    tmp123__ |= ( pSrc->report.Basic.ofdm_preamble << 1 );
+                    tmp123__ |= ( pSrc->report.Basic.unid_signal << 2 );
+                    tmp123__ |= ( pSrc->report.Basic.rader << 3 );
+                    tmp123__ |= ( pSrc->report.Basic.unmeasured << 4 );
+                    tmp123__ |= ( pSrc->report.Basic.unused << 5 );
+                    *pBuf = tmp123__;
                     *pnConsumed += 1;
                     // fieldsEndFlag  = 1 
                     nBuf -=  1 ;
@@ -25092,10 +24467,10 @@
                     frameshtons(pCtx, pBuf, pSrc->report.Beacon.meas_duration, 0);
                     *pnConsumed += 2;
                     pBuf += 2;
-                    tmp127__ = 0U;
-                    tmp127__ |= ( pSrc->report.Beacon.condensed_PHY << 0 );
-                    tmp127__ |= ( pSrc->report.Beacon.reported_frame_type << 7 );
-                    *pBuf = tmp127__;
+                    tmp124__ = 0U;
+                    tmp124__ |= ( pSrc->report.Beacon.condensed_PHY << 0 );
+                    tmp124__ |= ( pSrc->report.Beacon.reported_frame_type << 7 );
+                    *pBuf = tmp124__;
                     *pnConsumed += 1;
                     pBuf += 1;
                     nBuf -=  1 ;
@@ -25144,7 +24519,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp128__;
+    tANI_U8 tmp125__;
     tANI_U32 status = DOT11F_PARSE_SUCCESS;
     status = dot11fGetPackedIEMeasurementRequest(pCtx, pSrc, &nNeeded);
     if ( ! DOT11F_SUCCEEDED( status ) ) return status;
@@ -25158,14 +24533,14 @@
         *pBuf = pSrc->measurement_token;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp128__ = 0U;
-        tmp128__ |= ( pSrc->parallel << 0 );
-        tmp128__ |= ( pSrc->enable << 1 );
-        tmp128__ |= ( pSrc->request << 2 );
-        tmp128__ |= ( pSrc->report << 3 );
-        tmp128__ |= ( pSrc->durationMandatory << 4 );
-        tmp128__ |= ( pSrc->unused << 5 );
-        *pBuf = tmp128__;
+        tmp125__ = 0U;
+        tmp125__ |= ( pSrc->parallel << 0 );
+        tmp125__ |= ( pSrc->enable << 1 );
+        tmp125__ |= ( pSrc->request << 2 );
+        tmp125__ |= ( pSrc->report << 3 );
+        tmp125__ |= ( pSrc->durationMandatory << 4 );
+        tmp125__ |= ( pSrc->unused << 5 );
+        *pBuf = tmp125__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
@@ -25254,7 +24629,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp129__;
+    tANI_U8 tmp126__;
     nNeeded  += 3;
     while ( pSrc->present )
     {
@@ -25266,11 +24641,11 @@
         frameshtons(pCtx, pBuf, pSrc->MDID, 0);
         *pnConsumed += 2;
         pBuf += 2;
-        tmp129__ = 0U;
-        tmp129__ |= ( pSrc->overDSCap << 0 );
-        tmp129__ |= ( pSrc->resourceReqCap << 1 );
-        tmp129__ |= ( pSrc->reserved << 2 );
-        *pBuf = tmp129__;
+        tmp126__ = 0U;
+        tmp126__ |= ( pSrc->overDSCap << 0 );
+        tmp126__ |= ( pSrc->resourceReqCap << 1 );
+        tmp126__ |= ( pSrc->reserved << 2 );
+        *pBuf = tmp126__;
         *pnConsumed += 1;
         // fieldsEndFlag  = 1 
         nBuf -=  1 ;
@@ -25293,8 +24668,8 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp130__;
-    tANI_U8 tmp131__;
+    tANI_U8 tmp127__;
+    tANI_U8 tmp128__;
     tANI_U32 status = DOT11F_PARSE_SUCCESS;
     status = dot11fGetPackedIENeighborReport(pCtx, pSrc, &nNeeded);
     if ( ! DOT11F_SUCCEEDED( status ) ) return status;
@@ -25308,24 +24683,24 @@
         DOT11F_MEMCPY(pCtx, pBuf, pSrc->bssid, 6);
         *pnConsumed += 6;
         pBuf += 6;
-        tmp130__ = 0U;
-        tmp130__ |= ( pSrc->APReachability << 0 );
-        tmp130__ |= ( pSrc->Security << 2 );
-        tmp130__ |= ( pSrc->KeyScope << 3 );
-        tmp130__ |= ( pSrc->SpecMgmtCap << 4 );
-        tmp130__ |= ( pSrc->QosCap << 5 );
-        tmp130__ |= ( pSrc->apsd << 6 );
-        tmp130__ |= ( pSrc->rrm << 7 );
-        *pBuf = tmp130__;
+        tmp127__ = 0U;
+        tmp127__ |= ( pSrc->APReachability << 0 );
+        tmp127__ |= ( pSrc->Security << 2 );
+        tmp127__ |= ( pSrc->KeyScope << 3 );
+        tmp127__ |= ( pSrc->SpecMgmtCap << 4 );
+        tmp127__ |= ( pSrc->QosCap << 5 );
+        tmp127__ |= ( pSrc->apsd << 6 );
+        tmp127__ |= ( pSrc->rrm << 7 );
+        *pBuf = tmp127__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp131__ = 0U;
-        tmp131__ |= ( pSrc->DelayedBA << 0 );
-        tmp131__ |= ( pSrc->ImmBA << 1 );
-        tmp131__ |= ( pSrc->MobilityDomain << 2 );
-        tmp131__ |= ( pSrc->reserved << 3 );
-        *pBuf = tmp131__;
+        tmp128__ = 0U;
+        tmp128__ |= ( pSrc->DelayedBA << 0 );
+        tmp128__ |= ( pSrc->ImmBA << 1 );
+        tmp128__ |= ( pSrc->MobilityDomain << 2 );
+        tmp128__ |= ( pSrc->reserved << 3 );
+        *pBuf = tmp128__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
@@ -26364,7 +25739,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp132__;
+    tANI_U8 tmp129__;
     nNeeded  += 1;
     while ( pSrc->present )
     {
@@ -26373,13 +25748,13 @@
         ++pBuf; ++(*pnConsumed);
         pIeLen = pBuf;
         ++pBuf; ++(*pnConsumed);
-        tmp132__ = 0U;
-        tmp132__ |= ( pSrc->reserved << 0 );
-        tmp132__ |= ( pSrc->txopreq << 1 );
-        tmp132__ |= ( pSrc->qreq << 2 );
-        tmp132__ |= ( pSrc->qack << 3 );
-        tmp132__ |= ( pSrc->count << 4 );
-        *pBuf = tmp132__;
+        tmp129__ = 0U;
+        tmp129__ |= ( pSrc->reserved << 0 );
+        tmp129__ |= ( pSrc->txopreq << 1 );
+        tmp129__ |= ( pSrc->qreq << 2 );
+        tmp129__ |= ( pSrc->qack << 3 );
+        tmp129__ |= ( pSrc->count << 4 );
+        *pBuf = tmp129__;
         *pnConsumed += 1;
         // fieldsEndFlag  = 1 
         nBuf -=  1 ;
@@ -26402,7 +25777,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp133__;
+    tANI_U8 tmp130__;
     nNeeded  += 1;
     while ( pSrc->present )
     {
@@ -26411,15 +25786,15 @@
         ++pBuf; ++(*pnConsumed);
         pIeLen = pBuf;
         ++pBuf; ++(*pnConsumed);
-        tmp133__ = 0U;
-        tmp133__ |= ( pSrc->more_data_ack << 0 );
-        tmp133__ |= ( pSrc->max_sp_length << 1 );
-        tmp133__ |= ( pSrc->qack << 3 );
-        tmp133__ |= ( pSrc->acbe_uapsd << 4 );
-        tmp133__ |= ( pSrc->acbk_uapsd << 5 );
-        tmp133__ |= ( pSrc->acvi_uapsd << 6 );
-        tmp133__ |= ( pSrc->acvo_uapsd << 7 );
-        *pBuf = tmp133__;
+        tmp130__ = 0U;
+        tmp130__ |= ( pSrc->more_data_ack << 0 );
+        tmp130__ |= ( pSrc->max_sp_length << 1 );
+        tmp130__ |= ( pSrc->qack << 3 );
+        tmp130__ |= ( pSrc->acbe_uapsd << 4 );
+        tmp130__ |= ( pSrc->acbk_uapsd << 5 );
+        tmp130__ |= ( pSrc->acvi_uapsd << 6 );
+        tmp130__ |= ( pSrc->acvo_uapsd << 7 );
+        *pBuf = tmp130__;
         *pnConsumed += 1;
         // fieldsEndFlag  = 1 
         nBuf -=  1 ;
@@ -26537,7 +25912,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U16 tmp134__;
+    tANI_U16 tmp131__;
     tANI_U32 status = DOT11F_PARSE_SUCCESS;
     status = dot11fGetPackedIERSN(pCtx, pSrc, &nNeeded);
     if ( ! DOT11F_SUCCEEDED( status ) ) return status;
@@ -26572,13 +25947,13 @@
         DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->akm_suites ), ( pSrc->akm_suite_count * 4 ));
         *pnConsumed += ( pSrc->akm_suite_count * 4 );
         pBuf += ( pSrc->akm_suite_count * 4 );
-        tmp134__ = 0U;
-        tmp134__ |= ( pSrc->preauth << 0 );
-        tmp134__ |= ( pSrc->no_pwise << 1 );
-        tmp134__ |= ( pSrc->PTKSA_replay_counter << 2 );
-        tmp134__ |= ( pSrc->GTKSA_replay_counter << 4 );
-        tmp134__ |= ( pSrc->reserved << 6 );
-        frameshtons(pCtx, pBuf, tmp134__, 0);
+        tmp131__ = 0U;
+        tmp131__ |= ( pSrc->preauth << 0 );
+        tmp131__ |= ( pSrc->no_pwise << 1 );
+        tmp131__ |= ( pSrc->PTKSA_replay_counter << 2 );
+        tmp131__ |= ( pSrc->GTKSA_replay_counter << 4 );
+        tmp131__ |= ( pSrc->reserved << 6 );
+        frameshtons(pCtx, pBuf, tmp131__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
@@ -26820,162 +26195,6 @@
     return DOT11F_PARSE_SUCCESS;
 } /* End dot11fPackIeTPCRequest. */
 
-tANI_U32 dot11fPackIeVHTCaps(tpAniSirGlobal pCtx,
-                             tDot11fIEVHTCaps *pSrc,
-                             tANI_U8 *pBuf,
-                             tANI_U32 nBuf,
-                             tANI_U32 *pnConsumed)
-{
-    tANI_U8* pIeLen = 0;
-    tANI_U32 nConsumedOnEntry = *pnConsumed;
-    tANI_U32 nNeeded = 0U;
-    tANI_U32 tmp135__;
-    tANI_U16 tmp136__;
-    tANI_U16 tmp137__;
-    nNeeded  += 12;
-    while ( pSrc->present )
-    {
-        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
-        *pBuf = 191;
-        ++pBuf; ++(*pnConsumed);
-        pIeLen = pBuf;
-        ++pBuf; ++(*pnConsumed);
-        tmp135__ = 0U;
-        tmp135__ |= ( pSrc->maxMPDULen << 0 );
-        tmp135__ |= ( pSrc->supportedChannelWidthSet << 2 );
-        tmp135__ |= ( pSrc->ldpcCodingCap << 4 );
-        tmp135__ |= ( pSrc->shortGI80MHz << 5 );
-        tmp135__ |= ( pSrc->shortGI160and80plus80MHz << 6 );
-        tmp135__ |= ( pSrc->txSTBC << 7 );
-        tmp135__ |= ( pSrc->rxSTBC << 8 );
-        tmp135__ |= ( pSrc->suBeamFormerCap << 11 );
-        tmp135__ |= ( pSrc->suBeamformeeCap << 12 );
-        tmp135__ |= ( pSrc->csnofBeamformerAntSup << 13 );
-        tmp135__ |= ( pSrc->numSoundingDim << 16 );
-        tmp135__ |= ( pSrc->muBeamformerCap << 19 );
-        tmp135__ |= ( pSrc->muBeamformeeCap << 20 );
-        tmp135__ |= ( pSrc->vhtTXOPPS << 21 );
-        tmp135__ |= ( pSrc->htcVHTCap << 22 );
-        tmp135__ |= ( pSrc->maxAMPDULenExp << 23 );
-        tmp135__ |= ( pSrc->vhtLinkAdaptCap << 26 );
-        tmp135__ |= ( pSrc->rxAntPattern << 28 );
-        tmp135__ |= ( pSrc->txAntPattern << 29 );
-        tmp135__ |= ( pSrc->reserved1 << 30 );
-        frameshtonl(pCtx, pBuf, tmp135__, 0);
-        *pnConsumed += 4;
-        pBuf += 4;
-        nBuf -=  4 ;
-        frameshtons(pCtx, pBuf, pSrc->rxMCSMap, 0);
-        *pnConsumed += 2;
-        pBuf += 2;
-        tmp136__ = 0U;
-        tmp136__ |= ( pSrc->rxHighSupDataRate << 0 );
-        tmp136__ |= ( pSrc->reserved2 << 13 );
-        frameshtons(pCtx, pBuf, tmp136__, 0);
-        *pnConsumed += 2;
-        pBuf += 2;
-        nBuf -=  2 ;
-        frameshtons(pCtx, pBuf, pSrc->txMCSMap, 0);
-        *pnConsumed += 2;
-        pBuf += 2;
-        tmp137__ = 0U;
-        tmp137__ |= ( pSrc->txSupDataRate << 0 );
-        tmp137__ |= ( pSrc->reserved3 << 13 );
-        frameshtons(pCtx, pBuf, tmp137__, 0);
-        *pnConsumed += 2;
-        // fieldsEndFlag  = 1 
-        nBuf -=  2 ;
-        break;
-    }
-    (void)pCtx;
-    if (pIeLen)
-    {
-        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
-    }
-    return DOT11F_PARSE_SUCCESS;
-} /* End dot11fPackIeVHTCaps. */
-
-tANI_U32 dot11fPackIeVHTExtBssLoad(tpAniSirGlobal pCtx,
-                                   tDot11fIEVHTExtBssLoad *pSrc,
-                                   tANI_U8 *pBuf,
-                                   tANI_U32 nBuf,
-                                   tANI_U32 *pnConsumed)
-{
-    tANI_U8* pIeLen = 0;
-    tANI_U32 nConsumedOnEntry = *pnConsumed;
-    tANI_U32 nNeeded = 0U;
-    nNeeded  += 5;
-    while ( pSrc->present )
-    {
-        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
-        *pBuf = 193;
-        ++pBuf; ++(*pnConsumed);
-        pIeLen = pBuf;
-        ++pBuf; ++(*pnConsumed);
-        *pBuf = pSrc->muMIMOCapStaCount;
-        *pnConsumed += 1;
-        pBuf += 1;
-        *pBuf = pSrc->ssUnderUtil;
-        *pnConsumed += 1;
-        pBuf += 1;
-        *pBuf = pSrc->FortyMHzUtil;
-        *pnConsumed += 1;
-        pBuf += 1;
-        *pBuf = pSrc->EightyMHzUtil;
-        *pnConsumed += 1;
-        pBuf += 1;
-        *pBuf = pSrc->OneSixtyMHzUtil;
-        *pnConsumed += 1;
-        // fieldsEndFlag = 1 
-        break;
-    }
-    (void)pCtx;
-    if (pIeLen)
-    {
-        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
-    }
-    return DOT11F_PARSE_SUCCESS;
-} /* End dot11fPackIeVHTExtBssLoad. */
-
-tANI_U32 dot11fPackIeVHTOperation(tpAniSirGlobal pCtx,
-                                  tDot11fIEVHTOperation *pSrc,
-                                  tANI_U8 *pBuf,
-                                  tANI_U32 nBuf,
-                                  tANI_U32 *pnConsumed)
-{
-    tANI_U8* pIeLen = 0;
-    tANI_U32 nConsumedOnEntry = *pnConsumed;
-    tANI_U32 nNeeded = 0U;
-    nNeeded  += 5;
-    while ( pSrc->present )
-    {
-        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
-        *pBuf = 192;
-        ++pBuf; ++(*pnConsumed);
-        pIeLen = pBuf;
-        ++pBuf; ++(*pnConsumed);
-        *pBuf = pSrc->chanWidth;
-        *pnConsumed += 1;
-        pBuf += 1;
-        *pBuf = pSrc->chanCenterFreqSeg1;
-        *pnConsumed += 1;
-        pBuf += 1;
-        *pBuf = pSrc->chanCenterFreqSeg2;
-        *pnConsumed += 1;
-        pBuf += 1;
-        frameshtons(pCtx, pBuf, pSrc->basicMCSSet, 0);
-        *pnConsumed += 2;
-        // fieldsEndFlag = 1 
-        break;
-    }
-    (void)pCtx;
-    if (pIeLen)
-    {
-        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
-    }
-    return DOT11F_PARSE_SUCCESS;
-} /* End dot11fPackIeVHTOperation. */
-
 tANI_U32 dot11fPackIeWAPI(tpAniSirGlobal pCtx,
                           tDot11fIEWAPI *pSrc,
                           tANI_U8 *pBuf,
@@ -26985,7 +26204,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U16 tmp138__;
+    tANI_U16 tmp132__;
     tANI_U32 status = DOT11F_PARSE_SUCCESS;
     status = dot11fGetPackedIEWAPI(pCtx, pSrc, &nNeeded);
     if ( ! DOT11F_SUCCEEDED( status ) ) return status;
@@ -27014,10 +26233,10 @@
         DOT11F_MEMCPY(pCtx, pBuf, pSrc->multicast_cipher_suite, 4);
         *pnConsumed += 4;
         pBuf += 4;
-        tmp138__ = 0U;
-        tmp138__ |= ( pSrc->preauth << 0 );
-        tmp138__ |= ( pSrc->reserved << 1 );
-        frameshtons(pCtx, pBuf, tmp138__, 0);
+        tmp132__ = 0U;
+        tmp132__ |= ( pSrc->preauth << 0 );
+        tmp132__ |= ( pSrc->reserved << 1 );
+        frameshtons(pCtx, pBuf, tmp132__, 0);
         *pnConsumed += 2;
         pBuf += 2;
         nBuf -=  2 ;
@@ -27113,44 +26332,6 @@
     return DOT11F_PARSE_SUCCESS;
 } /* End dot11fPackIeWFATPC. */
 
-tANI_U32 dot11fPackIeWFDIEOpaque(tpAniSirGlobal pCtx,
-                                 tDot11fIEWFDIEOpaque *pSrc,
-                                 tANI_U8 *pBuf,
-                                 tANI_U32 nBuf,
-                                 tANI_U32 *pnConsumed)
-{
-    tANI_U8* pIeLen = 0;
-    tANI_U32 nConsumedOnEntry = *pnConsumed;
-    tANI_U32 nNeeded = 0U;
-    nNeeded  +=  pSrc->num_data;
-    while ( pSrc->present )
-    {
-        if ( nNeeded > nBuf ) return DOT11F_BUFFER_OVERFLOW;
-        *pBuf = 221;
-        ++pBuf; ++(*pnConsumed);
-        pIeLen = pBuf;
-        ++pBuf; ++(*pnConsumed);
-        *pBuf = 0x50;
-        ++pBuf; ++(*pnConsumed);
-        *pBuf = 0x6f;
-        ++pBuf; ++(*pnConsumed);
-        *pBuf = 0x9a;
-        ++pBuf; ++(*pnConsumed);
-        *pBuf = 0xa;
-        ++pBuf; ++(*pnConsumed);
-        DOT11F_MEMCPY(pCtx, pBuf, &( pSrc->data ), pSrc->num_data);
-        *pnConsumed += pSrc->num_data;
-        // fieldsEndFlag = 1 
-        break;
-    }
-    (void)pCtx;
-    if (pIeLen)
-    {
-        *pIeLen = *pnConsumed - nConsumedOnEntry - 2;
-    }
-    return DOT11F_PARSE_SUCCESS;
-} /* End dot11fPackIeWFDIEOpaque. */
-
 tANI_U32 dot11fPackIeWMMCaps(tpAniSirGlobal pCtx,
                              tDot11fIEWMMCaps *pSrc,
                              tANI_U8 *pBuf,
@@ -27160,7 +26341,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp139__;
+    tANI_U8 tmp133__;
     nNeeded  += 2;
     while ( pSrc->present )
     {
@@ -27182,13 +26363,13 @@
         *pBuf = pSrc->version;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp139__ = 0U;
-        tmp139__ |= ( pSrc->reserved << 0 );
-        tmp139__ |= ( pSrc->qack << 4 );
-        tmp139__ |= ( pSrc->queue_request << 5 );
-        tmp139__ |= ( pSrc->txop_request << 6 );
-        tmp139__ |= ( pSrc->more_ack << 7 );
-        *pBuf = tmp139__;
+        tmp133__ = 0U;
+        tmp133__ |= ( pSrc->reserved << 0 );
+        tmp133__ |= ( pSrc->qack << 4 );
+        tmp133__ |= ( pSrc->queue_request << 5 );
+        tmp133__ |= ( pSrc->txop_request << 6 );
+        tmp133__ |= ( pSrc->more_ack << 7 );
+        *pBuf = tmp133__;
         *pnConsumed += 1;
         // fieldsEndFlag  = 1 
         nBuf -=  1 ;
@@ -27211,7 +26392,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp140__;
+    tANI_U8 tmp134__;
     nNeeded  += 2;
     while ( pSrc->present )
     {
@@ -27233,11 +26414,11 @@
         *pBuf = pSrc->version;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp140__ = 0U;
-        tmp140__ |= ( pSrc->param_set_count << 0 );
-        tmp140__ |= ( pSrc->reserved << 4 );
-        tmp140__ |= ( pSrc->uapsd << 7 );
-        *pBuf = tmp140__;
+        tmp134__ = 0U;
+        tmp134__ |= ( pSrc->param_set_count << 0 );
+        tmp134__ |= ( pSrc->reserved << 4 );
+        tmp134__ |= ( pSrc->uapsd << 7 );
+        *pBuf = tmp134__;
         *pnConsumed += 1;
         // fieldsEndFlag  = 1 
         nBuf -=  1 ;
@@ -27260,7 +26441,7 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
-    tANI_U8 tmp141__;
+    tANI_U8 tmp135__;
     nNeeded  += 2;
     while ( pSrc->present )
     {
@@ -27282,15 +26463,15 @@
         *pBuf = pSrc->version;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp141__ = 0U;
-        tmp141__ |= ( pSrc->acvo_uapsd << 0 );
-        tmp141__ |= ( pSrc->acvi_uapsd << 1 );
-        tmp141__ |= ( pSrc->acbk_uapsd << 2 );
-        tmp141__ |= ( pSrc->acbe_uapsd << 3 );
-        tmp141__ |= ( pSrc->reserved1 << 4 );
-        tmp141__ |= ( pSrc->max_sp_length << 5 );
-        tmp141__ |= ( pSrc->reserved2 << 7 );
-        *pBuf = tmp141__;
+        tmp135__ = 0U;
+        tmp135__ |= ( pSrc->acvo_uapsd << 0 );
+        tmp135__ |= ( pSrc->acvi_uapsd << 1 );
+        tmp135__ |= ( pSrc->acbk_uapsd << 2 );
+        tmp135__ |= ( pSrc->acbe_uapsd << 3 );
+        tmp135__ |= ( pSrc->reserved1 << 4 );
+        tmp135__ |= ( pSrc->max_sp_length << 5 );
+        tmp135__ |= ( pSrc->reserved2 << 7 );
+        *pBuf = tmp135__;
         *pnConsumed += 1;
         // fieldsEndFlag  = 1 
         nBuf -=  1 ;
@@ -27313,14 +26494,14 @@
     tANI_U8* pIeLen = 0;
     tANI_U32 nConsumedOnEntry = *pnConsumed;
     tANI_U32 nNeeded = 0U;
+    tANI_U8 tmp136__;
+    tANI_U8 tmp137__;
+    tANI_U8 tmp138__;
+    tANI_U8 tmp139__;
+    tANI_U8 tmp140__;
+    tANI_U8 tmp141__;
     tANI_U8 tmp142__;
     tANI_U8 tmp143__;
-    tANI_U8 tmp144__;
-    tANI_U8 tmp145__;
-    tANI_U8 tmp146__;
-    tANI_U8 tmp147__;
-    tANI_U8 tmp148__;
-    tANI_U8 tmp149__;
     nNeeded  += 19;
     while ( pSrc->present )
     {
@@ -27348,76 +26529,76 @@
         *pBuf = pSrc->reserved2;
         *pnConsumed += 1;
         pBuf += 1;
-        tmp142__ = 0U;
-        tmp142__ |= ( pSrc->acbe_aifsn << 0 );
-        tmp142__ |= ( pSrc->acbe_acm << 4 );
-        tmp142__ |= ( pSrc->acbe_aci << 5 );
-        tmp142__ |= ( pSrc->unused1 << 7 );
-        *pBuf = tmp142__;
+        tmp136__ = 0U;
+        tmp136__ |= ( pSrc->acbe_aifsn << 0 );
+        tmp136__ |= ( pSrc->acbe_acm << 4 );
+        tmp136__ |= ( pSrc->acbe_aci << 5 );
+        tmp136__ |= ( pSrc->unused1 << 7 );
+        *pBuf = tmp136__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp143__ = 0U;
-        tmp143__ |= ( pSrc->acbe_acwmin << 0 );
-        tmp143__ |= ( pSrc->acbe_acwmax << 4 );
-        *pBuf = tmp143__;
+        tmp137__ = 0U;
+        tmp137__ |= ( pSrc->acbe_acwmin << 0 );
+        tmp137__ |= ( pSrc->acbe_acwmax << 4 );
+        *pBuf = tmp137__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
         frameshtons(pCtx, pBuf, pSrc->acbe_txoplimit, 0);
         *pnConsumed += 2;
         pBuf += 2;
-        tmp144__ = 0U;
-        tmp144__ |= ( pSrc->acbk_aifsn << 0 );
-        tmp144__ |= ( pSrc->acbk_acm << 4 );
-        tmp144__ |= ( pSrc->acbk_aci << 5 );
-        tmp144__ |= ( pSrc->unused2 << 7 );
-        *pBuf = tmp144__;
+        tmp138__ = 0U;
+        tmp138__ |= ( pSrc->acbk_aifsn << 0 );
+        tmp138__ |= ( pSrc->acbk_acm << 4 );
+        tmp138__ |= ( pSrc->acbk_aci << 5 );
+        tmp138__ |= ( pSrc->unused2 << 7 );
+        *pBuf = tmp138__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp145__ = 0U;
-        tmp145__ |= ( pSrc->acbk_acwmin << 0 );
-        tmp145__ |= ( pSrc->acbk_acwmax << 4 );
-        *pBuf = tmp145__;
+        tmp139__ = 0U;
+        tmp139__ |= ( pSrc->acbk_acwmin << 0 );
+        tmp139__ |= ( pSrc->acbk_acwmax << 4 );
+        *pBuf = tmp139__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
         frameshtons(pCtx, pBuf, pSrc->acbk_txoplimit, 0);
         *pnConsumed += 2;
         pBuf += 2;
-        tmp146__ = 0U;
-        tmp146__ |= ( pSrc->acvi_aifsn << 0 );
-        tmp146__ |= ( pSrc->acvi_acm << 4 );
-        tmp146__ |= ( pSrc->acvi_aci << 5 );
-        tmp146__ |= ( pSrc->unused3 << 7 );
-        *pBuf = tmp146__;
+        tmp140__ = 0U;
+        tmp140__ |= ( pSrc->acvi_aifsn << 0 );
+        tmp140__ |= ( pSrc->acvi_acm << 4 );
+        tmp140__ |= ( pSrc->acvi_aci << 5 );
+        tmp140__ |= ( pSrc->unused3 << 7 );
+        *pBuf = tmp140__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp147__ = 0U;
-        tmp147__ |= ( pSrc->acvi_acwmin << 0 );
-        tmp147__ |= ( pSrc->acvi_acwmax << 4 );
-        *pBuf = tmp147__;
+        tmp141__ = 0U;
+        tmp141__ |= ( pSrc->acvi_acwmin << 0 );
+        tmp141__ |= ( pSrc->acvi_acwmax << 4 );
+        *pBuf = tmp141__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
         frameshtons(pCtx, pBuf, pSrc->acvi_txoplimit, 0);
         *pnConsumed += 2;
         pBuf += 2;
-        tmp148__ = 0U;
-        tmp148__ |= ( pSrc->acvo_aifsn << 0 );
-        tmp148__ |= ( pSrc->acvo_acm << 4 );
-        tmp148__ |= ( pSrc->acvo_aci << 5 );
-        tmp148__ |= ( pSrc->unused4 << 7 );
-        *pBuf = tmp148__;
+        tmp142__ = 0U;
+        tmp142__ |= ( pSrc->acvo_aifsn << 0 );
+        tmp142__ |= ( pSrc->acvo_acm << 4 );
+        tmp142__ |= ( pSrc->acvo_aci << 5 );
+        tmp142__ |= ( pSrc->unused4 << 7 );
+        *pBuf = tmp142__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
-        tmp149__ = 0U;
-        tmp149__ |= ( pSrc->acvo_acwmin << 0 );
-        tmp149__ |= ( pSrc->acvo_acwmax << 4 );
-        *pBuf = tmp149__;
+        tmp143__ = 0U;
+        tmp143__ |= ( pSrc->acvo_acwmin << 0 );
+        tmp143__ |= ( pSrc->acvo_acwmax << 4 );
+        *pBuf = tmp143__;
         *pnConsumed += 1;
         pBuf += 1;
         nBuf -=  1 ;
@@ -29002,50 +28183,6 @@
             FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->P2PIEOpaque.num_data);
             FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->P2PIEOpaque.data, pFrm->P2PIEOpaque.num_data);
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("WFDIEOpaque:\n"));
-        if (!pFrm->WFDIEOpaque.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WFDIEOpaque.num_data);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* ) pFrm->WFDIEOpaque.data, pFrm->WFDIEOpaque.num_data);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
         FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), FRFL("to:\n"));
         FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCREQUEST), pBuf, nBuf);
     }
@@ -30052,52 +29189,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityInterval, 2);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
         FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), FRFL("to:\n"));
         FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_ASSOCRESPONSE), pBuf, nBuf);
     }
@@ -31431,65 +30522,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* ) pFrm->P2PBeacon.NoticeOfAbsence.NoADesc, pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("VHTExtBssLoad:\n"));
-        if (!pFrm->VHTExtBssLoad.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTExtBssLoad.muMIMOCapStaCount, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTExtBssLoad.ssUnderUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTExtBssLoad.FortyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTExtBssLoad.EightyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), ( tANI_U8* )&pFrm->VHTExtBssLoad.OneSixtyMHzUtil, 1);
-        }
         FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), FRFL("to:\n"));
         FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON), pBuf, nBuf);
     }
@@ -32376,65 +31408,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* ) pFrm->P2PBeacon.NoticeOfAbsence.NoADesc, pFrm->P2PBeacon.NoticeOfAbsence.num_NoADesc);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("VHTExtBssLoad:\n"));
-        if (!pFrm->VHTExtBssLoad.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTExtBssLoad.muMIMOCapStaCount, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTExtBssLoad.ssUnderUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTExtBssLoad.FortyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTExtBssLoad.EightyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), ( tANI_U8* )&pFrm->VHTExtBssLoad.OneSixtyMHzUtil, 1);
-        }
         FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), FRFL("to:\n"));
         FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACON2), pBuf, nBuf);
     }
@@ -33494,65 +32467,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* ) pFrm->P2PBeaconProbeRes.P2PGroupInfo.P2PClientInfoDesc, pFrm->P2PBeaconProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("VHTExtBssLoad:\n"));
-        if (!pFrm->VHTExtBssLoad.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTExtBssLoad.muMIMOCapStaCount, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTExtBssLoad.ssUnderUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTExtBssLoad.FortyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTExtBssLoad.EightyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), ( tANI_U8* )&pFrm->VHTExtBssLoad.OneSixtyMHzUtil, 1);
-        }
         FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), FRFL("to:\n"));
         FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_BEACONIES), pBuf, nBuf);
     }
@@ -35430,40 +34344,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->P2PProbeReq.OperatingChannel.channel, 1);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
         FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), FRFL("to:\n"));
         FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBEREQUEST), pBuf, nBuf);
     }
@@ -36500,65 +35380,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* ) pFrm->P2PProbeRes.P2PGroupInfo.P2PClientInfoDesc, pFrm->P2PProbeRes.P2PGroupInfo.num_P2PClientInfoDesc);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("VHTExtBssLoad:\n"));
-        if (!pFrm->VHTExtBssLoad.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTExtBssLoad.muMIMOCapStaCount, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTExtBssLoad.ssUnderUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTExtBssLoad.FortyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTExtBssLoad.EightyMHzUtil, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), ( tANI_U8* )&pFrm->VHTExtBssLoad.OneSixtyMHzUtil, 1);
-        }
         FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), FRFL("to:\n"));
         FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_PROBERESPONSE), pBuf, nBuf);
     }
@@ -37744,50 +36565,6 @@
             FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->P2PIEOpaque.num_data);
             FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->P2PIEOpaque.data, pFrm->P2PIEOpaque.num_data);
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("WFDIEOpaque:\n"));
-        if (!pFrm->WFDIEOpaque.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("num_data: %d.\n"), pFrm->WFDIEOpaque.num_data);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* ) pFrm->WFDIEOpaque.data, pFrm->WFDIEOpaque.num_data);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
         FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), FRFL("to:\n"));
         FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCREQUEST), pBuf, nBuf);
     }
@@ -38801,52 +37578,6 @@
                 FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->P2PAssocRes.ExtendedListenTiming.availibilityInterval, 2);
             }
         }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("VHTCaps:\n"));
-        if (!pFrm->VHTCaps.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("maxMPDULen (2): %d\n"), pFrm->VHTCaps.maxMPDULen);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("supportedChannelWidthSet (2): %d\n"), pFrm->VHTCaps.supportedChannelWidthSet);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("ldpcCodingCap (1): %d\n"), pFrm->VHTCaps.ldpcCodingCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortGI80MHz (1): %d\n"), pFrm->VHTCaps.shortGI80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("shortGI160and80plus80MHz (1): %d\n"), pFrm->VHTCaps.shortGI160and80plus80MHz);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txSTBC (1): %d\n"), pFrm->VHTCaps.txSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxSTBC (3): %d\n"), pFrm->VHTCaps.rxSTBC);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("suBeamFormerCap (1): %d\n"), pFrm->VHTCaps.suBeamFormerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("suBeamformeeCap (1): %d\n"), pFrm->VHTCaps.suBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("csnofBeamformerAntSup (3): %d\n"), pFrm->VHTCaps.csnofBeamformerAntSup);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("numSoundingDim (3): %d\n"), pFrm->VHTCaps.numSoundingDim);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("muBeamformerCap (1): %d\n"), pFrm->VHTCaps.muBeamformerCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("muBeamformeeCap (1): %d\n"), pFrm->VHTCaps.muBeamformeeCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("vhtTXOPPS (1): %d\n"), pFrm->VHTCaps.vhtTXOPPS);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("htcVHTCap (1): %d\n"), pFrm->VHTCaps.htcVHTCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("maxAMPDULenExp (3): %d\n"), pFrm->VHTCaps.maxAMPDULenExp);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("vhtLinkAdaptCap (2): %d\n"), pFrm->VHTCaps.vhtLinkAdaptCap);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxAntPattern (1): %d\n"), pFrm->VHTCaps.rxAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txAntPattern (1): %d\n"), pFrm->VHTCaps.txAntPattern);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved1 (2): %d\n"), pFrm->VHTCaps.reserved1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTCaps.rxMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("rxHighSupDataRate (13): %d\n"), pFrm->VHTCaps.rxHighSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved2 (3): %d\n"), pFrm->VHTCaps.reserved2);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTCaps.txMCSMap, 2);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("txSupDataRate (13): %d\n"), pFrm->VHTCaps.txSupDataRate);
-            FRAMES_LOG1(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("reserved3 (3): %d\n"), pFrm->VHTCaps.reserved3);
-        }
-        FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("VHTOperation:\n"));
-        if (!pFrm->VHTOperation.present)
-        {
-            FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("Not present.\n"));
-        }
-        else
-        {
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanWidth, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg1, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.chanCenterFreqSeg2, 1);
-            FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), ( tANI_U8* )&pFrm->VHTOperation.basicMCSSet, 2);
-        }
         FRAMES_LOG0(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), FRFL("to:\n"));
         FRAMES_DUMP(pCtx, FRAMES_SEV_FOR_FRAME(pCtx, DOT11F_REASSOCRESPONSE), pBuf, nBuf);
     }
@@ -39656,15 +38387,6 @@
                     case SigIeTPCRequest:
                         status |= dot11fPackIeTPCRequest(pCtx, ( tDot11fIETPCRequest* )(pSrc + pIe->offset + sizeof(tDot11fIETPCRequest) * i ),  pBufRemaining, nBufRemaining, &len);
                         break;
-                    case SigIeVHTCaps:
-                        status |= dot11fPackIeVHTCaps(pCtx, ( tDot11fIEVHTCaps* )(pSrc + pIe->offset + sizeof(tDot11fIEVHTCaps) * i ),  pBufRemaining, nBufRemaining, &len);
-                        break;
-                    case SigIeVHTExtBssLoad:
-                        status |= dot11fPackIeVHTExtBssLoad(pCtx, ( tDot11fIEVHTExtBssLoad* )(pSrc + pIe->offset + sizeof(tDot11fIEVHTExtBssLoad) * i ),  pBufRemaining, nBufRemaining, &len);
-                        break;
-                    case SigIeVHTOperation:
-                        status |= dot11fPackIeVHTOperation(pCtx, ( tDot11fIEVHTOperation* )(pSrc + pIe->offset + sizeof(tDot11fIEVHTOperation) * i ),  pBufRemaining, nBufRemaining, &len);
-                        break;
                     case SigIeWAPI:
                         status |= dot11fPackIeWAPI(pCtx, ( tDot11fIEWAPI* )(pSrc + pIe->offset + sizeof(tDot11fIEWAPI) * i ),  pBufRemaining, nBufRemaining, &len);
                         break;
@@ -39674,9 +38396,6 @@
                     case SigIeWFATPC:
                         status |= dot11fPackIeWFATPC(pCtx, ( tDot11fIEWFATPC* )(pSrc + pIe->offset + sizeof(tDot11fIEWFATPC) * i ),  pBufRemaining, nBufRemaining, &len);
                         break;
-                    case SigIeWFDIEOpaque:
-                        status |= dot11fPackIeWFDIEOpaque(pCtx, ( tDot11fIEWFDIEOpaque* )(pSrc + pIe->offset + sizeof(tDot11fIEWFDIEOpaque) * i ),  pBufRemaining, nBufRemaining, &len);
-                        break;
                     case SigIeWMMCaps:
                         status |= dot11fPackIeWMMCaps(pCtx, ( tDot11fIEWMMCaps* )(pSrc + pIe->offset + sizeof(tDot11fIEWMMCaps) * i ),  pBufRemaining, nBufRemaining, &len);
                         break;
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/logApi.c b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/logApi.c
index f8031cd..48e9fd3 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/logApi.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/logApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -181,13 +181,13 @@
             return VOS_TRACE_LEVEL_ERROR;
         case LOGW:
             return VOS_TRACE_LEVEL_WARN;
-        case LOG1:
-            return VOS_TRACE_LEVEL_INFO;
-        case LOG2:
-            return VOS_TRACE_LEVEL_INFO_HIGH;
-        case LOG3:
-            return VOS_TRACE_LEVEL_INFO_MED;
         case LOG4:
+            return VOS_TRACE_LEVEL_INFO;
+        case LOG3:
+            return VOS_TRACE_LEVEL_INFO_HIGH;
+        case LOG2:
+            return VOS_TRACE_LEVEL_INFO_MED;
+        case LOG1:
             return VOS_TRACE_LEVEL_INFO_LOW;
         default:
             return VOS_TRACE_LEVEL_INFO_LOW;
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/logDump.c b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/logDump.c
index c18d635..4dcc38e 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/logDump.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/logDump.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -359,7 +359,7 @@
         else
         {
             sysLog( pMac, LOGE, FL("WNI_CFG_%s(%d  0x%x) len=%ld\n"),  gCfgParamName[cfgId], cfgId, cfgId, valueLen );
-            sirDumpBuf(pMac, SIR_WDA_MODULE_ID, LOG1, buf, valueLen) ;
+            sirDumpBuf(pMac, SIR_WDA_MODULE_ID, LOGW, buf, valueLen) ;
         }
     }
 
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/macTrace.c b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/macTrace.c
index 619b1eb..96f4885 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/macTrace.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/macTrace.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -324,6 +324,9 @@
 {
     switch( limMsg )
     {
+         CASE_RETURN_STRING(SIR_LIM_RESUME_ACTIVITY_NTF);
+        CASE_RETURN_STRING(SIR_LIM_SUSPEND_ACTIVITY_REQ );
+        CASE_RETURN_STRING(SIR_HAL_SUSPEND_ACTIVITY_RSP );
         CASE_RETURN_STRING(SIR_LIM_RETRY_INTERRUPT_MSG);
         CASE_RETURN_STRING(SIR_BB_XPORT_MGMT_MSG );
         CASE_RETURN_STRING(SIR_LIM_INV_KEY_INTERRUPT_MSG );
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/parserApi.c b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/parserApi.c
index 033d489..16d2730 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/parserApi.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/parserApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -48,7 +48,7 @@
 
 
 ////////////////////////////////////////////////////////////////////////
-void dot11fLog(tpAniSirGlobal pMac, int loglevel, const char *pString,...)
+void dot11fLog(tpAniSirGlobal pMac, int loglevel, const char *pString,...) 
 {
 #ifdef WLAN_DEBUG
     if( (tANI_U32)loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_DBG_MODULE_ID )] )
@@ -182,7 +182,7 @@
     // The if/then/else statements that follow are here to figure out
     // whether we have the WPA IE, and where it is if we *do* have it.
 
-    //Save the first IE length
+    //Save the first IE length 
     ieLen = pRsnIe->rsnIEdata[ 1 ] + 2;
     idx = 0;
     bytesLeft = pRsnIe->length;
@@ -195,7 +195,7 @@
             return (idx);
         }
         else if ( EID != pRsnIe->rsnIEdata[ idx ] &&
-             // & if no more IE,
+             // & if no more IE, 
              bytesLeft <= (tANI_U16)( ieLen ) )
         {
             dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation.\n"), EID );
@@ -240,7 +240,7 @@
 tSirRetStatus
 PopulateDot11fCapabilities2(tpAniSirGlobal         pMac,
                             tDot11fFfCapabilities *pDot11f,
-                            tpDphHashNode          pSta,
+                            tpDphHashNode          pSta, 
                             tpPESession            psessionEntry)
 {
     tANI_U16           cfg;
@@ -267,24 +267,22 @@
 
 void
 PopulateDot11fChanSwitchAnn(tpAniSirGlobal          pMac,
-                            tDot11fIEChanSwitchAnn *pDot11f,
-                            tpPESession psessionEntry)
+                            tDot11fIEChanSwitchAnn *pDot11f)
 {
-    pDot11f->switchMode = psessionEntry->gLimChannelSwitch.switchMode;
-    pDot11f->newChannel = psessionEntry->gLimChannelSwitch.primaryChannel;
-    pDot11f->switchCount = ( tANI_U8 ) psessionEntry->gLimChannelSwitch.switchCount;
+    pDot11f->switchMode = pMac->lim.gLimChannelSwitch.switchMode;
+    pDot11f->newChannel = pMac->lim.gLimChannelSwitch.primaryChannel;
+    pDot11f->switchCount = ( tANI_U8 ) pMac->lim.gLimChannelSwitch.switchCount;
 
     pDot11f->present = 1;
 } // End PopulateDot11fChanSwitchAnn.
 
 void
 PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal pMac,
-                               tDot11fIEExtChanSwitchAnn *pDot11f,
-                               tpPESession psessionEntry)
+                               tDot11fIEExtChanSwitchAnn *pDot11f)
 {
     //Has to be updated on the cb state basis
-    pDot11f->secondaryChannelOffset =
-             psessionEntry->gLimChannelSwitch.secondarySubBand;
+    pDot11f->secondaryChannelOffset = 
+             limGetHTCBState(pMac->lim.gLimChannelSwitch.secondarySubBand);
 
     pDot11f->present = 1;
 }
@@ -372,7 +370,7 @@
 
 void
 PopulateDot11fEDCAParamSet(tpAniSirGlobal         pMac,
-                           tDot11fIEEDCAParamSet *pDot11f,
+                           tDot11fIEEDCAParamSet *pDot11f, 
                            tpPESession psessionEntry)
 {
 
@@ -449,10 +447,10 @@
         }
 
 
-        if((psessionEntry->gLimNoShortParams.numNonShortPreambleSta)
-                 || !psessionEntry->beaconParams.fShortPreamble){
+        if((psessionEntry->gLimNoShortParams.numNonShortPreambleSta) 
+                 || !psessionEntry->beaconParams.fShortPreamble){ 
                 pDot11f->barker_preamble = 1;
-
+         
         }
         // if protection always flag is set, advertise protection enabled
         // regardless of legacy stations presence
@@ -469,7 +467,7 @@
 
 tSirRetStatus
 PopulateDot11fExtSuppRates(tpAniSirGlobal pMac, tANI_U8 nChannelNum,
-                           tDot11fIEExtSuppRates *pDot11f,
+                           tDot11fIEExtSuppRates *pDot11f, 
                            tpPESession psessionEntry)
 {
     tSirRetStatus nSirStatus;
@@ -485,7 +483,7 @@
         if(psessionEntry != NULL)
         {
             nRates = psessionEntry->extRateSet.numRates;
-            palCopyMemory(pMac->hHdd, rates, psessionEntry->extRateSet.rate,
+            palCopyMemory(pMac->hHdd, rates, psessionEntry->extRateSet.rate, 
                           nRates);
         }
         else
@@ -544,8 +542,7 @@
 
 tSirRetStatus
 PopulateDot11fHTCaps(tpAniSirGlobal           pMac,
-                           tpPESession      psessionEntry,
-                           tDot11fIEHTCaps *pDot11f)
+                             tDot11fIEHTCaps *pDot11f)
 {
     tANI_U32                         nCfgValue, nCfgLen;
     tANI_U8                          nCfgValue8;
@@ -575,8 +572,12 @@
     pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &nCfgValue16;
 #endif
 
+    dot11fLog( pMac, LOG1, FL( "HT Caps: %x\n" ), nCfgValue);
+
+
 #ifdef WLAN_SOFTAP_FEATURE  // this is added for fixing CRs on MDM9K platform - 257951, 259577
     pDot11f->advCodingCap             = uHTCapabilityInfo.htCapInfo.advCodingCap;
+    pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet;
     pDot11f->mimoPowerSave            = uHTCapabilityInfo.htCapInfo.mimoPowerSave;
     pDot11f->greenField               = uHTCapabilityInfo.htCapInfo.greenField;
     pDot11f->shortGI20MHz             = uHTCapabilityInfo.htCapInfo.shortGI20MHz;
@@ -591,6 +592,7 @@
     pDot11f->lsigTXOPProtection       = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection;
 #else
     pDot11f->advCodingCap             = pHTCapabilityInfo->advCodingCap;
+    pDot11f->supportedChannelWidthSet = pHTCapabilityInfo->supportedChannelWidthSet;
     pDot11f->mimoPowerSave            = pHTCapabilityInfo->mimoPowerSave;
     pDot11f->greenField               = pHTCapabilityInfo->greenField;
     pDot11f->shortGI20MHz             = pHTCapabilityInfo->shortGI20MHz;
@@ -605,16 +607,6 @@
     pDot11f->lsigTXOPProtection       = pHTCapabilityInfo->lsigTXOPProtection;
 #endif
 
-    // All sessionized entries will need the check below
-    if (psessionEntry == NULL) // Only in case of NO session
-    {
-        pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet;
-    }
-    else
-    {
-        pDot11f->supportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet;
-    }
-
     /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is
        eHT_CHANNEL_WIDTH_20MHZ */
     if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ)
@@ -622,7 +614,7 @@
        pDot11f->shortGI40MHz = 0;
     }
 
-    dot11fLog(pMac, LOG2, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d\n"),
+    dot11fLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d\n"),
                                             pDot11f->supportedChannelWidthSet, pDot11f->mimoPowerSave,  pDot11f->greenField,
                                             pDot11f->shortGI20MHz, pDot11f->shortGI40MHz, pDot11f->dsssCckMode40MHz);
 
@@ -636,7 +628,7 @@
     pDot11f->mpduDensity      = pHTParametersInfo->mpduDensity;
     pDot11f->reserved1        = pHTParametersInfo->reserved;
 
-    dot11fLog( pMac, LOG2, FL( "AMPDU Param: %x\n" ), nCfgValue);
+    dot11fLog( pMac, LOG1, FL( "AMPDU Param: %x\n" ), nCfgValue);
 
 
     CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
@@ -698,250 +690,7 @@
     return eSIR_SUCCESS;
 
 } // End PopulateDot11fHTCaps.
-#ifdef WLAN_FEATURE_11AC
 
-void limLogVHTCap(tpAniSirGlobal pMac,
-                              tDot11fIEVHTCaps *pDot11f)
-{
-#ifdef DUMP_MGMT_CNTNTS
-    limLog(pMac, LOG1, FL("maxMPDULen (2): %d\n"), pDot11f->maxMPDULen);
-    limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d\n"), pDot11f->supportedChannelWidthSet);
-    limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d\n"), pDot11f->ldpcCodingCap);
-    limLog(pMac, LOG1, FL("shortGI80MHz (1): %d\n"), pDot11f->shortGI80MHz);
-    limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d\n"), pDot11f->shortGI160and80plus80MHz);
-    limLog(pMac, LOG1, FL("txSTBC (1): %d\n"), pDot11f->txSTBC);
-    limLog(pMac, LOG1, FL("rxSTBC (3): %d\n"), pDot11f->rxSTBC);
-    limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d\n"), pDot11f->suBeamFormerCap);
-    limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d\n"), pDot11f->suBeamformeeCap);
-    limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d\n"), pDot11f->csnofBeamformerAntSup);
-    limLog(pMac, LOG1, FL("numSoundingDim (3): %d\n"), pDot11f->numSoundingDim);
-    limLog(pMac, LOG1, FL("muBeamformerCap (1): %d\n"), pDot11f->muBeamformerCap);
-    limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d\n"), pDot11f->muBeamformeeCap);
-    limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d\n"), pDot11f->vhtTXOPPS);
-    limLog(pMac, LOG1, FL("htcVHTCap (1): %d\n"), pDot11f->htcVHTCap);
-    limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d\n"), pDot11f->maxAMPDULenExp);
-    limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d\n"), pDot11f->vhtLinkAdaptCap);
-    limLog(pMac, LOG1, FL("rxAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
-    limLog(pMac, LOG1, FL("txAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
-    limLog(pMac, LOG1, FL("reserved1 (2): %d\n"), pDot11f->reserved1);
-    limLog(pMac, LOG1, FL("rxMCSMap (16): %d\n"), pDot11f->rxMCSMap);
-    limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d\n"), pDot11f->rxHighSupDataRate);
-    limLog(pMac, LOG1, FL("reserve (3): %d\n"), pDot11f->reserved2);
-    limLog(pMac, LOG1, FL("txMCSMap (16): %d\n"), pDot11f->txMCSMap);
-    limLog(pMac, LOG1, FL("txSupDataRate (13): %d\n"), pDot11f->txSupDataRate);
-    limLog(pMac, LOG1, FL("reserv (3): %d\n"), pDot11f->reserved3);
-#endif /* DUMP_MGMT_CNTNTS */
-}
-
-void limLogVHTOperation(tpAniSirGlobal pMac,
-                              tDot11fIEVHTOperation *pDot11f)
-{
-#ifdef DUMP_MGMT_CNTNTS
-    limLog(pMac, LOG1, FL("chanWidth : %d\n"), pDot11f->chanWidth);
-    limLog(pMac, LOG1, FL("chanCenterFreqSeg1: %d\n"), pDot11f->chanCenterFreqSeg1);
-    limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d\n"), pDot11f->chanCenterFreqSeg2);
-    limLog(pMac, LOG1, FL("basicMCSSet: %d\n"), pDot11f->basicMCSSet);
-#endif /* DUMP_MGMT_CNTNTS */
-}
-
-void limLogVHTExtBssLoad(tpAniSirGlobal pMac,
-                              tDot11fIEVHTExtBssLoad *pDot11f)
-{
-#ifdef DUMP_MGMT_CNTNTS
-    limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d\n"), pDot11f->muMIMOCapStaCount);
-    limLog(pMac, LOG1, FL("ssUnderUtil: %d\n"), pDot11f->ssUnderUtil);
-    limLog(pMac, LOG1, FL("FortyMHzUtil: %d\n"), pDot11f->FortyMHzUtil);
-    limLog(pMac, LOG1, FL("EightyMHzUtil: %d\n"), pDot11f->EightyMHzUtil);
-    limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d\n"), pDot11f->OneSixtyMHzUtil);
-#endif /* DUMP_MGMT_CNTNTS */
-}
-
-tSirRetStatus
-PopulateDot11fVHTCaps(tpAniSirGlobal           pMac,
-                           tDot11fIEVHTCaps *pDot11f)
-{
-    tSirRetStatus        nStatus;
-    tANI_U32             nCfgValue=0;
-
-    pDot11f->present = 1;
-
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
-    pDot11f->maxMPDULen =  (nCfgValue & 0x0003);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
-                                                             nCfgValue );
-    pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
-    pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
-    pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
-                                                                nCfgValue );
-    pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
-    pDot11f->txSTBC = (nCfgValue & 0x0001);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
-    pDot11f->rxSTBC = (nCfgValue & 0x0007);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
-    pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
-    pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
-                                                               nCfgValue );
-    pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
-                                                               nCfgValue );
-    pDot11f->numSoundingDim = (nCfgValue & 0x0007);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
-    pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
-    pDot11f->muBeamformeeCap = (nCfgValue & 0x0001);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
-    pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
-    pDot11f->htcVHTCap = (nCfgValue & 0x0001);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
-    pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
-    pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
-    pDot11f->rxAntPattern = nCfgValue;
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
-    pDot11f->txAntPattern = nCfgValue;
-
-    pDot11f->reserved1= 0;
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
-    pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
-                                                                  nCfgValue );
-    pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
-
-    pDot11f->reserved2= 0;
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
-    pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
-                                                                  nCfgValue );
-    pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
-
-    pDot11f->reserved3= 0;
-
-    limLogVHTCap(pMac, pDot11f);
-
-    return eSIR_SUCCESS;
-
-}
-
-tSirRetStatus
-PopulateDot11fVHTOperation(tpAniSirGlobal   pMac,
-                               tDot11fIEVHTOperation  *pDot11f)
-{
-    tSirRetStatus        nStatus;
-    tANI_U32             nCfgValue=0;
-
-    pDot11f->present = 1;
-
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
-    pDot11f->chanWidth = (tANI_U8)nCfgValue;
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
-                                                               nCfgValue );
-    pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
-                                                               nCfgValue );
-    pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
-    pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
-
-    limLogVHTOperation(pMac,pDot11f);
-
-    return eSIR_SUCCESS;
-
-}
-
-tSirRetStatus
-PopulateDot11fVHTExtBssLoad(tpAniSirGlobal      pMac,
-                           tDot11fIEVHTExtBssLoad   *pDot11f)
-{
-    tSirRetStatus    nStatus;
-    tANI_U32         nCfgValue=0;
-
-    pDot11f->present = 1;
-
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
-                                                         nCfgValue );
-    pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
-
-    nCfgValue = 0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
-    pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
-
-    nCfgValue=0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
-    pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
-
-    nCfgValue=0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
-    pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
-
-    nCfgValue=0;
-    CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
-    pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
-
-    limLogVHTExtBssLoad(pMac,pDot11f);
-
-    return eSIR_SUCCESS;
-}
-
-
-#endif
 #ifdef WLAN_SOFTAP_FEATURE
 tSirRetStatus
 PopulateDot11fHTInfo(tpAniSirGlobal   pMac,
@@ -980,7 +729,7 @@
     #if 0
     CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
     #endif // TO SUPPORT BT-AMP
-
+    
     pDot11f->primaryChannel = psessionEntry->currentOperChannel;
 
     CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
@@ -988,19 +737,11 @@
     htInfoField1 = ( tANI_U8 ) nCfgValue;
 
     pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
+    pHTInfoField1->secondaryChannelOffset     = pMac->lim.gHTSecondaryChannelOffset;
+    pHTInfoField1->recommendedTxWidthSet      = pMac->lim.gHTRecommendedTxWidthSet;
     pHTInfoField1->rifsMode                   = psessionEntry->beaconParams.fRIFSMode;
     pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
 
-    if (psessionEntry == NULL)
-    {
-        PELOGE(limLog(pMac, LOG1,
-            FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set\n"));)
-    }
-    else
-    {
-        pHTInfoField1->secondaryChannelOffset     = psessionEntry->htSecondaryChannelOffset;
-        pHTInfoField1->recommendedTxWidthSet      = psessionEntry->htRecommendedTxWidthSet;
-    }
 
 #ifdef WLAN_SOFTAP_FEATURE
     if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
@@ -1187,7 +928,7 @@
         pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
 
     }
-
+    
     pCaps->present    = 1;
 } // End PopulateDot11fPowerCaps.
 
@@ -1224,9 +965,9 @@
 {
     tANI_U32  val = 0;
 
-    if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
+    if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS) 
         PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
-
+   
     pDot11f->more_data_ack = 0;
     pDot11f->max_sp_length = (tANI_U8)val;
     pDot11f->qack    = 0;
@@ -1237,7 +978,7 @@
         pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
         pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
         pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
-    }
+    }   
     pDot11f->present = 1;
 } // End PopulatedDot11fQOSCaps.
 
@@ -1447,7 +1188,7 @@
         if(psessionEntry != NULL)
         {
             nRates = psessionEntry->rateSet.numRates;
-            palCopyMemory(pMac->hHdd, rates, psessionEntry->rateSet.rate,
+            palCopyMemory(pMac->hHdd, rates, psessionEntry->rateSet.rate, 
                           nRates);
         }
         else
@@ -1576,9 +1317,9 @@
         }
     }
 }
-#endif
+#endif 
 
-void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
+void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo, 
                              tpPESession psessionEntry)
 {
     pInfo->version = SIR_MAC_OUI_VERSION_1;
@@ -1615,7 +1356,7 @@
     pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
     pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
 
-    if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
+    if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS) 
         PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
 
     pInfo->max_sp_length = (tANI_U8)val;
@@ -1637,7 +1378,7 @@
     if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
        pParams->qosInfo =
            (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
-    else
+    else 
 #endif
        pParams->qosInfo =
            (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
@@ -1661,7 +1402,7 @@
     if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
         pParams->acvi_aifsn     = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
     else
-#endif
+#endif 
         pParams->acvi_aifsn     = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
 
 
@@ -1850,19 +1591,11 @@
         pProbeReq->wscIePresent = 1;
         memcpy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
     }
-#ifdef WLAN_FEATURE_11AC
-    if ( pr.VHTCaps.present )
-    {
-        palCopyMemory( pMac, &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
-    }
-#endif
-
 
     if ( pr.P2PProbeReq.present )
     {
         pProbeReq->p2pIePresent = 1;
     }
-
     return eSIR_SUCCESS;
 
 } // End sirConvertProbeReqFrame2Struct.
@@ -1873,28 +1606,20 @@
                                           tpSirProbeRespBeacon pProbeResp)
 {
     tANI_U32             status;
-    tDot11fProbeResponse *pr;
+    tDot11fProbeResponse pr;
 
     // Ok, zero-init our [out] parameter,
     palZeroMemory( pMac->hHdd, ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )&pr, sizeof(tDot11fProbeResponse) );
 
-    status = palAllocateMemory(pMac->hHdd, (void **)&pr, sizeof(tDot11fProbeResponse));
-    if(!HAL_STATUS_SUCCESS(status))
-    {
-        limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
-        return eSIR_FAILURE;
-    }
-
-    palZeroMemory( pMac->hHdd, ( tANI_U8* )pr, sizeof(tDot11fProbeResponse) );
-
+    
     // delegate to the framesc-generated code,
-    status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
+    status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, &pr );
     if ( DOT11F_FAILED( status ) )
     {
         limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
-        palFreeMemory(pMac->hHdd, pr);
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
@@ -1907,206 +1632,191 @@
     // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
 
     // Timestamp
-    palCopyMemory( pMac->hHdd, ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp, sizeof(tSirMacTimeStamp) );
+    palCopyMemory( pMac->hHdd, ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr.TimeStamp, sizeof(tSirMacTimeStamp) );
 
     // Beacon Interval
-    pProbeResp->beaconInterval = pr->BeaconInterval.interval;
+    pProbeResp->beaconInterval = pr.BeaconInterval.interval;
 
     // Capabilities
-    pProbeResp->capabilityInfo.ess            = pr->Capabilities.ess;
-    pProbeResp->capabilityInfo.ibss           = pr->Capabilities.ibss;
-    pProbeResp->capabilityInfo.cfPollable     = pr->Capabilities.cfPollable;
-    pProbeResp->capabilityInfo.cfPollReq      = pr->Capabilities.cfPollReq;
-    pProbeResp->capabilityInfo.privacy        = pr->Capabilities.privacy;
-    pProbeResp->capabilityInfo.shortPreamble  = pr->Capabilities.shortPreamble;
-    pProbeResp->capabilityInfo.pbcc           = pr->Capabilities.pbcc;
-    pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
-    pProbeResp->capabilityInfo.spectrumMgt    = pr->Capabilities.spectrumMgt;
-    pProbeResp->capabilityInfo.qos            = pr->Capabilities.qos;
-    pProbeResp->capabilityInfo.shortSlotTime  = pr->Capabilities.shortSlotTime;
-    pProbeResp->capabilityInfo.apsd           = pr->Capabilities.apsd;
-    pProbeResp->capabilityInfo.rrm            = pr->Capabilities.rrm;
-    pProbeResp->capabilityInfo.dsssOfdm       = pr->Capabilities.dsssOfdm;
-    pProbeResp->capabilityInfo.delayedBA       = pr->Capabilities.delayedBA;
-    pProbeResp->capabilityInfo.immediateBA    = pr->Capabilities.immediateBA;
+    pProbeResp->capabilityInfo.ess            = pr.Capabilities.ess;
+    pProbeResp->capabilityInfo.ibss           = pr.Capabilities.ibss;
+    pProbeResp->capabilityInfo.cfPollable     = pr.Capabilities.cfPollable;
+    pProbeResp->capabilityInfo.cfPollReq      = pr.Capabilities.cfPollReq;
+    pProbeResp->capabilityInfo.privacy        = pr.Capabilities.privacy;
+    pProbeResp->capabilityInfo.shortPreamble  = pr.Capabilities.shortPreamble;
+    pProbeResp->capabilityInfo.pbcc           = pr.Capabilities.pbcc;
+    pProbeResp->capabilityInfo.channelAgility = pr.Capabilities.channelAgility;
+    pProbeResp->capabilityInfo.spectrumMgt    = pr.Capabilities.spectrumMgt;
+    pProbeResp->capabilityInfo.qos            = pr.Capabilities.qos;
+    pProbeResp->capabilityInfo.shortSlotTime  = pr.Capabilities.shortSlotTime;
+    pProbeResp->capabilityInfo.apsd           = pr.Capabilities.apsd;
+    pProbeResp->capabilityInfo.rrm            = pr.Capabilities.rrm;
+    pProbeResp->capabilityInfo.dsssOfdm       = pr.Capabilities.dsssOfdm;
+    pProbeResp->capabilityInfo.delayedBA       = pr.Capabilities.delayedBA;
+    pProbeResp->capabilityInfo.immediateBA    = pr.Capabilities.immediateBA;
 
-    if ( ! pr->SSID.present )
+    if ( ! pr.SSID.present )
     {
         PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
     }
     else
     {
         pProbeResp->ssidPresent = 1;
-        ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
+        ConvertSSID( pMac, &pProbeResp->ssId, &pr.SSID );
     }
 
-    if ( ! pr->SuppRates.present )
+    if ( ! pr.SuppRates.present )
     {
         PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
     }
     else
     {
         pProbeResp->suppRatesPresent = 1;
-        ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
+        ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr.SuppRates );
     }
 
-    if ( pr->ExtSuppRates.present )
+    if ( pr.ExtSuppRates.present )
     {
         pProbeResp->extendedRatesPresent = 1;
-        ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
+        ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr.ExtSuppRates );
     }
 
 
-    if ( pr->CFParams.present )
+    if ( pr.CFParams.present )
     {
         pProbeResp->cfPresent = 1;
-        ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
+        ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr.CFParams );
     }
 
-    if ( pr->Country.present )
+    if ( pr.Country.present )
     {
         pProbeResp->countryInfoPresent = 1;
-        ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
+        ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr.Country );
     }
 
-    if ( pr->EDCAParamSet.present )
+    if ( pr.EDCAParamSet.present )
     {
         pProbeResp->edcaPresent = 1;
-        ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
+        ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr.EDCAParamSet );
     }
 
-    if ( pr->ChanSwitchAnn.present )
+    if ( pr.ChanSwitchAnn.present )
     {
         pProbeResp->channelSwitchPresent = 1;
-        palCopyMemory( pMac, &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
+        palCopyMemory( pMac, &pProbeResp->channelSwitchIE, &pr.ChanSwitchAnn,
                        sizeof(tDot11fIEExtChanSwitchAnn) );
     }
 
-       if ( pr->ExtChanSwitchAnn.present )
+       if ( pr.ExtChanSwitchAnn.present )
     {
         pProbeResp->extChannelSwitchPresent = 1;
-        palCopyMemory( pMac, &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
+        palCopyMemory( pMac, &pProbeResp->extChannelSwitchIE, &pr.ExtChanSwitchAnn,
                        sizeof(tDot11fIEExtChanSwitchAnn) );
     }
 
-    if( pr->TPCReport.present)
+    if( pr.TPCReport.present)
     {
         pProbeResp->tpcReportPresent = 1;
-        palCopyMemory(pMac->hHdd, &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
+        palCopyMemory(pMac->hHdd, &pProbeResp->tpcReport, &pr.TPCReport, sizeof(tDot11fIETPCReport));
     }
 
-    if( pr->PowerConstraints.present)
+    if( pr.PowerConstraints.present)
     {
         pProbeResp->powerConstraintPresent = 1;
-        palCopyMemory(pMac->hHdd, &pProbeResp->localPowerConstraint, &pr->PowerConstraints, sizeof(tDot11fIEPowerConstraints));
+        palCopyMemory(pMac->hHdd, &pProbeResp->localPowerConstraint, &pr.PowerConstraints, sizeof(tDot11fIEPowerConstraints));
     }
 
-    if ( pr->Quiet.present )
+    if ( pr.Quiet.present )
     {
         pProbeResp->quietIEPresent = 1;
-        palCopyMemory( pMac, &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
+        palCopyMemory( pMac, &pProbeResp->quietIE, &pr.Quiet, sizeof(tDot11fIEQuiet) );
     }
 
-    if ( pr->HTCaps.present )
+    if ( pr.HTCaps.present )
     {
-        palCopyMemory( pMac, &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
+        palCopyMemory( pMac, &pProbeResp->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
     }
 
-    if ( pr->HTInfo.present )
+    if ( pr.HTInfo.present )
     {
-        palCopyMemory( pMac, &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
+        palCopyMemory( pMac, &pProbeResp->HTInfo, &pr.HTInfo, sizeof( tDot11fIEHTInfo ) );
     }
 
-    if ( pr->DSParams.present )
+    if ( pr.DSParams.present )
     {
         pProbeResp->dsParamsPresent = 1;
-        pProbeResp->channelNumber = pr->DSParams.curr_channel;
+        pProbeResp->channelNumber = pr.DSParams.curr_channel;
     }
-    else if(pr->HTInfo.present)
+    else if(pr.HTInfo.present)
     {
-        pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
+        pProbeResp->channelNumber = pr.HTInfo.primaryChannel;
     }
 
-    if ( pr->RSN.present )
+    if ( pr.RSN.present )
     {
         pProbeResp->rsnPresent = 1;
-        ConvertRSN( pMac, &pProbeResp->rsn, &pr->RSN );
+        ConvertRSN( pMac, &pProbeResp->rsn, &pr.RSN );
     }
 
-    if ( pr->WPA.present )
+    if ( pr.WPA.present )
     {
         pProbeResp->wpaPresent = 1;
-        ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
+        ConvertWPA( pMac, &pProbeResp->wpa, &pr.WPA );
     }
 
-    if ( pr->WMMParams.present )
+    if ( pr.WMMParams.present )
     {
         pProbeResp->wmeEdcaPresent = 1;
-        ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
+        ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr.WMMParams );
         PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
-                                __printWMMParams(pMac, &pr->WMMParams);)
+                                __printWMMParams(pMac, &pr.WMMParams);)
     }
 
-    if ( pr->WMMInfoAp.present )
+    if ( pr.WMMInfoAp.present )
     {
         pProbeResp->wmeInfoPresent = 1;
         PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
     }
 
-    if ( pr->WMMCaps.present )
+    if ( pr.WMMCaps.present )
     {
         pProbeResp->wsmCapablePresent = 1;
     }
 
 
-    if ( pr->ERPInfo.present )
+    if ( pr.ERPInfo.present )
     {
         pProbeResp->erpPresent = 1;
-        ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
+        ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr.ERPInfo );
     }
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
-    if (pr->MobilityDomain.present)
+    if (pr.MobilityDomain.present)
     {
         // MobilityDomain
         pProbeResp->mdiePresent = 1;
-        palCopyMemory( pMac->hHdd, (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID), sizeof(tANI_U16) );
-        pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
+        palCopyMemory( pMac->hHdd, (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr.MobilityDomain.MDID), sizeof(tANI_U16) );
+        pProbeResp->mdie[2] = ((pr.MobilityDomain.overDSCap << 0) | (pr.MobilityDomain.resourceReqCap << 1));
 #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
-        limLog(pMac, LOG2, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
+        limLog(pMac, LOGE, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
                (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
 #endif
     }
 #endif
 
 #if defined FEATURE_WLAN_CCX
-    if (pr->QBSSLoad.present)
+    if (pr.QBSSLoad.present)
     {
-        palCopyMemory(pMac->hHdd, &pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
+        palCopyMemory(pMac->hHdd, &pProbeResp->QBSSLoad, &pr.QBSSLoad, sizeof(tDot11fIEQBSSLoad));
     }
 #endif
 #ifdef WLAN_FEATURE_P2P
-    if (pr->P2PProbeRes.present)
+    if (pr.P2PProbeRes.present)
     {
-       palCopyMemory( pMac, &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
+       palCopyMemory( pMac, &pProbeResp->P2PProbeRes, &pr.P2PProbeRes,
                                                 sizeof(tDot11fIEP2PProbeRes) );
     }
 #endif
-#ifdef WLAN_FEATURE_11AC
-    if ( pr->VHTCaps.present )
-    {
-       palCopyMemory( pMac, &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
-    }
-    if ( pr->VHTOperation.present )
-    {
-        palCopyMemory( pMac, &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
-    }
-    if ( pr->VHTExtBssLoad.present )
-    {
-        palCopyMemory( pMac, &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
-    }
-#endif
-    palFreeMemory(pMac->hHdd, pr);
     return eSIR_SUCCESS;
 
 } // End sirConvertProbeFrame2Struct.
@@ -2117,27 +1827,20 @@
                                tANI_U32            nFrame,
                                tpSirAssocReq  pAssocReq)
 {
-    tDot11fAssocRequest *ar;
+    tDot11fAssocRequest ar;
     tANI_U32                 status;
 
-    status = palAllocateMemory(pMac->hHdd, (void **)&ar, sizeof(tDot11fAssocRequest));
-    if(!HAL_STATUS_SUCCESS(status))
-    {
-        limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
-        return eSIR_FAILURE;
-    }
-        // Zero-init our [out] parameter,
+    // Zero-init our [out] parameter,
     palZeroMemory( pMac->hHdd, ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq) );
-    palZeroMemory( pMac->hHdd, ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )&ar, sizeof( tDot11fAssocRequest ) );
 
     // delegate to the framesc-generated code,
-    status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
+    status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, &ar );
     if ( DOT11F_FAILED( status ) )
     {
         limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):\n"),
                   status, nFrame);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
-        palFreeMemory(pMac->hHdd, ar);
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
@@ -2153,145 +1856,127 @@
     pAssocReq->reassocRequest = 0;
 
     // Capabilities
-    pAssocReq->capabilityInfo.ess            = ar->Capabilities.ess;
-    pAssocReq->capabilityInfo.ibss           = ar->Capabilities.ibss;
-    pAssocReq->capabilityInfo.cfPollable     = ar->Capabilities.cfPollable;
-    pAssocReq->capabilityInfo.cfPollReq      = ar->Capabilities.cfPollReq;
-    pAssocReq->capabilityInfo.privacy        = ar->Capabilities.privacy;
-    pAssocReq->capabilityInfo.shortPreamble  = ar->Capabilities.shortPreamble;
-    pAssocReq->capabilityInfo.pbcc           = ar->Capabilities.pbcc;
-    pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
-    pAssocReq->capabilityInfo.spectrumMgt    = ar->Capabilities.spectrumMgt;
-    pAssocReq->capabilityInfo.qos            = ar->Capabilities.qos;
-    pAssocReq->capabilityInfo.shortSlotTime  = ar->Capabilities.shortSlotTime;
-    pAssocReq->capabilityInfo.apsd           = ar->Capabilities.apsd;
-    pAssocReq->capabilityInfo.rrm            = ar->Capabilities.rrm;
-    pAssocReq->capabilityInfo.dsssOfdm       = ar->Capabilities.dsssOfdm;
-    pAssocReq->capabilityInfo.delayedBA       = ar->Capabilities.delayedBA;
-    pAssocReq->capabilityInfo.immediateBA    = ar->Capabilities.immediateBA;
+    pAssocReq->capabilityInfo.ess            = ar.Capabilities.ess;
+    pAssocReq->capabilityInfo.ibss           = ar.Capabilities.ibss;
+    pAssocReq->capabilityInfo.cfPollable     = ar.Capabilities.cfPollable;
+    pAssocReq->capabilityInfo.cfPollReq      = ar.Capabilities.cfPollReq;
+    pAssocReq->capabilityInfo.privacy        = ar.Capabilities.privacy;
+    pAssocReq->capabilityInfo.shortPreamble  = ar.Capabilities.shortPreamble;
+    pAssocReq->capabilityInfo.pbcc           = ar.Capabilities.pbcc;
+    pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
+    pAssocReq->capabilityInfo.spectrumMgt    = ar.Capabilities.spectrumMgt;
+    pAssocReq->capabilityInfo.qos            = ar.Capabilities.qos;
+    pAssocReq->capabilityInfo.shortSlotTime  = ar.Capabilities.shortSlotTime;
+    pAssocReq->capabilityInfo.apsd           = ar.Capabilities.apsd;
+    pAssocReq->capabilityInfo.rrm            = ar.Capabilities.rrm;
+    pAssocReq->capabilityInfo.dsssOfdm       = ar.Capabilities.dsssOfdm;
+    pAssocReq->capabilityInfo.delayedBA       = ar.Capabilities.delayedBA;
+    pAssocReq->capabilityInfo.immediateBA    = ar.Capabilities.immediateBA;
 
     // Listen Interval
-    pAssocReq->listenInterval = ar->ListenInterval.interval;
+    pAssocReq->listenInterval = ar.ListenInterval.interval;
 
     // SSID
-    if ( ar->SSID.present )
+    if ( ar.SSID.present )
     {
         pAssocReq->ssidPresent = 1;
-        ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
+        ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
     }
 
     // Supported Rates
-    if ( ar->SuppRates.present )
+    if ( ar.SuppRates.present )
     {
         pAssocReq->suppRatesPresent = 1;
-        ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
+        ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
     }
 
     // Extended Supported Rates
-    if ( ar->ExtSuppRates.present )
+    if ( ar.ExtSuppRates.present )
     {
         pAssocReq->extendedRatesPresent = 1;
-        ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
+        ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar.ExtSuppRates );
     }
 
     // QOS Capabilities:
-    if ( ar->QOSCapsStation.present )
+    if ( ar.QOSCapsStation.present )
     {
         pAssocReq->qosCapabilityPresent = 1;
-        ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
+        ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
     }
 
     // WPA
-    if ( ar->WPAOpaque.present )
+    if ( ar.WPAOpaque.present )
     {
         pAssocReq->wpaPresent = 1;
-        ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
+        ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
     }
 
     // RSN
-    if ( ar->RSNOpaque.present )
+    if ( ar.RSNOpaque.present )
     {
         pAssocReq->rsnPresent = 1;
-        ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
+        ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
     }
 
     // WSC IE
-    if (ar->WscIEOpaque.present) 
+    if (ar.WscIEOpaque.present) 
     {
         pAssocReq->addIEPresent = 1;
-        ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
+        ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
     }
-
+    
 
 #ifdef WLAN_FEATURE_P2P
-    if(ar->P2PIEOpaque.present)
+    if(ar.P2PIEOpaque.present)
     {
         pAssocReq->addIEPresent = 1;
-        ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
-    }
-#endif
-#ifdef WLAN_FEATURE_WFD
-    if(ar->WFDIEOpaque.present)
-    {
-        pAssocReq->addIEPresent = 1;
-        ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
+        ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
     }
 #endif
 
     // Power Capabilities
-    if ( ar->PowerCaps.present )
+    if ( ar.PowerCaps.present )
     {
         pAssocReq->powerCapabilityPresent     = 1;
-        ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
+        ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
     }
 
     // Supported Channels
-    if ( ar->SuppChannels.present )
+    if ( ar.SuppChannels.present )
     {
         pAssocReq->supportedChannelsPresent = 1;
-        ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
+        ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
     }
 
-    if ( ar->HTCaps.present )
+    if ( ar.HTCaps.present )
     {
-        palCopyMemory( pMac, &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
+        palCopyMemory( pMac, &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
     }
 
-    if ( ar->WMMInfoStation.present )
+    if ( ar.WMMInfoStation.present )
     {
         pAssocReq->wmeInfoPresent = 1;
 #ifdef WLAN_SOFTAP_FEATURE
-        palCopyMemory( pMac, &pAssocReq->WMMInfoStation, &ar->WMMInfoStation, sizeof( tDot11fIEWMMInfoStation ) );
+        palCopyMemory( pMac, &pAssocReq->WMMInfoStation, &ar.WMMInfoStation, sizeof( tDot11fIEWMMInfoStation ) );
 #endif
 
     }
 
 
-    if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
+    if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
 
     if ( ! pAssocReq->ssidPresent )
     {
         PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
-        palFreeMemory(pMac->hHdd, ar);
         return eSIR_FAILURE;
     }
 
     if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
     {
         PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
-        palFreeMemory(pMac->hHdd, ar);
         return eSIR_FAILURE;
     }
 
-#ifdef WLAN_FEATURE_11AC
-    if ( ar->VHTCaps.present )
-    {
-        palCopyMemory( pMac, &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
-        limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap\n"));
-        limLogVHTCap( pMac, &pAssocReq->VHTCaps);
-    }
-#endif
-    palFreeMemory(pMac->hHdd, ar);
     return eSIR_SUCCESS;
 
 } // End sirConvertAssocReqFrame2Struct.
@@ -2376,7 +2061,7 @@
     {
         pAssocRsp->wmeEdcaPresent = 1;
         ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
-        limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
+        limLog(pMac, LOGE, FL("WMM Parameter Element present in Association Response Frame!\n"));
         __printWMMParams(pMac, &ar.WMMParams);
     }
 
@@ -2398,7 +2083,7 @@
         palCopyMemory( pMac->hHdd, (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID), sizeof(tANI_U16) );
         pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
 #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
-        limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
+        limLog(pMac, LOGE, FL("new mdie=%02x%02x%02x\n"), (unsigned int)pAssocRsp->mdie[0],
                (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
 #endif
     }
@@ -2406,7 +2091,7 @@
     if ( ar.FTInfo.present )
     {
 #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
-        limLog(pMac, LOG1, FL("FT Info present %d %d %d"), ar.FTInfo.R0KH_ID.num_PMK_R0_ID,
+        limLog(pMac, LOGE, FL("FT Info present %d %d %d\n"), ar.FTInfo.R0KH_ID.num_PMK_R0_ID,
                 ar.FTInfo.R0KH_ID.present,
                 ar.FTInfo.R1KH_ID.present);
 #endif
@@ -2425,7 +2110,7 @@
         pAssocRsp->num_RICData = ar.num_RICDataDesc;
         pAssocRsp->ricPresent = TRUE;
     }
-#endif
+#endif    
 
 #ifdef FEATURE_WLAN_CCX
     if (ar.num_WMMTSPEC) {
@@ -2435,28 +2120,13 @@
         }
         pAssocRsp->tspecPresent = TRUE;
     }
-
+   
     if(ar.CCXTrafStrmMet.present)
     {
         pAssocRsp->tsmPresent = 1;
         palCopyMemory(pMac->hHdd,&pAssocRsp->tsmIE.tsid,
                 &ar.CCXTrafStrmMet.tsid,sizeof(tSirMacCCXTSMIE));
-    }
-#endif
-
-#ifdef WLAN_FEATURE_11AC
-    if ( ar.VHTCaps.present )
-    {
-        palCopyMemory( pMac, &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
-        limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
-        limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
-    }
-    if ( ar.VHTOperation.present )
-    {
-        palCopyMemory( pMac, &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
-        limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
-        limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
-    }
+    }    
 #endif
 
     return eSIR_SUCCESS;
@@ -2607,12 +2277,12 @@
     // there is in 'sirConvertAssocReqFrame2Struct'?
 
     // WSC IE
-    if (ar.WscIEOpaque.present)
+    if (ar.WscIEOpaque.present) 
     {
         pAssocReq->addIEPresent = 1;
         ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
     }
-
+    
 #ifdef WLAN_FEATURE_P2P
     if(ar.P2PIEOpaque.present)
     {
@@ -2621,20 +2291,6 @@
     }
 #endif
 
-#ifdef WLAN_FEATURE_WFD
-    if(ar.WFDIEOpaque.present)
-    {
-        pAssocReq->addIEPresent = 1;
-        ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
-    }
-#endif
-
-#ifdef WLAN_FEATURE_11AC
-    if ( ar.VHTCaps.present )
-    {
-        palCopyMemory( pMac, &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
-    }
-#endif
     return eSIR_SUCCESS;
 
 } // End sirConvertReassocReqFrame2Struct.
@@ -2804,7 +2460,7 @@
     {
         pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
     }
-
+    
     if ( pBies->RSN.present )
     {
         pBeaconStruct->rsnPresent = 1;
@@ -2840,26 +2496,8 @@
         ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
     }
 
-#ifdef WLAN_FEATURE_11AC
-    if ( pBies->VHTCaps.present )
-    {
-        pBeaconStruct->VHTCaps.present = 1;
-        palCopyMemory( pMac, &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
-    }
-    if ( pBies->VHTOperation.present )
-    {
-         pBeaconStruct->VHTOperation.present = 1;
-         palCopyMemory( pMac, &pBeaconStruct->VHTOperation, &pBies->VHTOperation, sizeof( tDot11fIEVHTOperation) );
-    }
-    if ( pBies->VHTExtBssLoad.present )
-    {
-         pBeaconStruct->VHTExtBssLoad.present = 1;
-         palCopyMemory( pMac, &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
-    }
-#endif
     palFreeMemory(pMac->hHdd, pBies);
 
-
     return eSIR_SUCCESS;
 
 } // End sirParseBeaconIE.
@@ -2869,7 +2507,7 @@
                              tANI_U8             *pFrame,
                              tpSirProbeRespBeacon pBeaconStruct)
 {
-    tDot11fBeacon  *pBeacon;
+    tDot11fBeacon   beacon;
     tANI_U32        status, nPayload;
     tANI_U8        *pPayload;
     tpSirMacMgmtHdr pHdr;
@@ -2879,30 +2517,21 @@
     nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
     pHdr     = WDA_GET_RX_MAC_HEADER( pFrame );
     mappedRXCh = WDA_GET_RX_CH( pFrame );
-
+    
     // Zero-init our [out] parameter,
     palZeroMemory( pMac->hHdd, ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon) );
-
-    status = palAllocateMemory(pMac->hHdd, (void **)&pBeacon, sizeof(tDot11fBeacon));
-    if(!HAL_STATUS_SUCCESS(status))
-    {
-        limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
-        return eSIR_FAILURE;
-    }
-
-    palZeroMemory( pMac->hHdd, ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon) );
+    palZeroMemory( pMac->hHdd, ( tANI_U8* )&beacon, sizeof(tDot11fBeacon) );
 
     // get the MAC address out of the BD,
     palCopyMemory( pMac->hHdd, pBeaconStruct->bssid, pHdr->sa, 6 );
 
     // delegate to the framesc-generated code,
-    status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
+    status = dot11fUnpackBeacon( pMac, pPayload, nPayload, &beacon );
     if ( DOT11F_FAILED( status ) )
     {
         limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
                   status, nPayload);
         PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
-        palFreeMemory(pMac->hHdd, pBeacon);
         return eSIR_FAILURE;
     }
     else if ( DOT11F_WARNED( status ) )
@@ -2914,210 +2543,204 @@
 
     // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
     // Timestamp
-    palCopyMemory( pMac->hHdd, ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp, sizeof(tSirMacTimeStamp) );
+    palCopyMemory( pMac->hHdd, ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&beacon.TimeStamp, sizeof(tSirMacTimeStamp) );
 
     // Beacon Interval
-    pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
+    pBeaconStruct->beaconInterval = beacon.BeaconInterval.interval;
 
     // Capabilities
-    pBeaconStruct->capabilityInfo.ess            = pBeacon->Capabilities.ess;
-    pBeaconStruct->capabilityInfo.ibss           = pBeacon->Capabilities.ibss;
-    pBeaconStruct->capabilityInfo.cfPollable     = pBeacon->Capabilities.cfPollable;
-    pBeaconStruct->capabilityInfo.cfPollReq      = pBeacon->Capabilities.cfPollReq;
-    pBeaconStruct->capabilityInfo.privacy        = pBeacon->Capabilities.privacy;
-    pBeaconStruct->capabilityInfo.shortPreamble  = pBeacon->Capabilities.shortPreamble;
-    pBeaconStruct->capabilityInfo.pbcc           = pBeacon->Capabilities.pbcc;
-    pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
-    pBeaconStruct->capabilityInfo.spectrumMgt    = pBeacon->Capabilities.spectrumMgt;
-    pBeaconStruct->capabilityInfo.qos            = pBeacon->Capabilities.qos;
-    pBeaconStruct->capabilityInfo.shortSlotTime  = pBeacon->Capabilities.shortSlotTime;
-    pBeaconStruct->capabilityInfo.apsd           = pBeacon->Capabilities.apsd;
-    pBeaconStruct->capabilityInfo.rrm            = pBeacon->Capabilities.rrm;
-    pBeaconStruct->capabilityInfo.dsssOfdm      = pBeacon->Capabilities.dsssOfdm;
-    pBeaconStruct->capabilityInfo.delayedBA     = pBeacon->Capabilities.delayedBA;
-    pBeaconStruct->capabilityInfo.immediateBA    = pBeacon->Capabilities.immediateBA;
-
-    if ( ! pBeacon->SSID.present )
+    pBeaconStruct->capabilityInfo.ess            = beacon.Capabilities.ess;
+    pBeaconStruct->capabilityInfo.ibss           = beacon.Capabilities.ibss;
+    pBeaconStruct->capabilityInfo.cfPollable     = beacon.Capabilities.cfPollable;
+    pBeaconStruct->capabilityInfo.cfPollReq      = beacon.Capabilities.cfPollReq;
+    pBeaconStruct->capabilityInfo.privacy        = beacon.Capabilities.privacy;
+    pBeaconStruct->capabilityInfo.shortPreamble  = beacon.Capabilities.shortPreamble;
+    pBeaconStruct->capabilityInfo.pbcc           = beacon.Capabilities.pbcc;
+    pBeaconStruct->capabilityInfo.channelAgility = beacon.Capabilities.channelAgility;
+    pBeaconStruct->capabilityInfo.spectrumMgt    = beacon.Capabilities.spectrumMgt;
+    pBeaconStruct->capabilityInfo.qos            = beacon.Capabilities.qos;
+    pBeaconStruct->capabilityInfo.shortSlotTime  = beacon.Capabilities.shortSlotTime;
+    pBeaconStruct->capabilityInfo.apsd           = beacon.Capabilities.apsd;
+    pBeaconStruct->capabilityInfo.rrm            = beacon.Capabilities.rrm;
+    pBeaconStruct->capabilityInfo.dsssOfdm      = beacon.Capabilities.dsssOfdm;
+    pBeaconStruct->capabilityInfo.delayedBA     = beacon.Capabilities.delayedBA;
+    pBeaconStruct->capabilityInfo.immediateBA    = beacon.Capabilities.immediateBA;
+ 
+    if ( ! beacon.SSID.present )
     {
         PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
     }
     else
     {
         pBeaconStruct->ssidPresent = 1;
-        ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
+        ConvertSSID( pMac, &pBeaconStruct->ssId, &beacon.SSID );
     }
 
-    if ( ! pBeacon->SuppRates.present )
+    if ( ! beacon.SuppRates.present )
     {
         PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
     }
     else
     {
         pBeaconStruct->suppRatesPresent = 1;
-        ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
+        ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &beacon.SuppRates );
     }
 
-    if ( pBeacon->ExtSuppRates.present )
+    if ( beacon.ExtSuppRates.present )
     {
         pBeaconStruct->extendedRatesPresent = 1;
-        ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
+        ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &beacon.ExtSuppRates );
     }
 
 
-    if ( pBeacon->CFParams.present )
+    if ( beacon.CFParams.present )
     {
         pBeaconStruct->cfPresent = 1;
-        ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
+        ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &beacon.CFParams );
     }
 
-    if ( pBeacon->TIM.present )
+    if ( beacon.TIM.present )
     {
         pBeaconStruct->timPresent = 1;
-        ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
+        ConvertTIM( pMac, &pBeaconStruct->tim, &beacon.TIM );
     }
 
-    if ( pBeacon->Country.present )
+    if ( beacon.Country.present )
     {
         pBeaconStruct->countryInfoPresent = 1;
-        ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
+        ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &beacon.Country );
     }
 
     // QOS Capabilities:
-    if ( pBeacon->QOSCapsAp.present )
+    if ( beacon.QOSCapsAp.present )
     {
         pBeaconStruct->qosCapabilityPresent = 1;
-        ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
+        ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &beacon.QOSCapsAp );
     }
 
-    if ( pBeacon->EDCAParamSet.present )
+    if ( beacon.EDCAParamSet.present )
     {
         pBeaconStruct->edcaPresent = 1;
-        ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
+        ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &beacon.EDCAParamSet );
     }
 
-    if ( pBeacon->ChanSwitchAnn.present )
+    if ( beacon.ChanSwitchAnn.present )
     {
         pBeaconStruct->channelSwitchPresent = 1;
-        palCopyMemory( pMac, &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
+        palCopyMemory( pMac, &pBeaconStruct->channelSwitchIE, &beacon.ChanSwitchAnn,
                                                        sizeof(tDot11fIEChanSwitchAnn) );
     }
 
-    if ( pBeacon->ExtChanSwitchAnn.present )
+    if ( beacon.ExtChanSwitchAnn.present )
     {
         pBeaconStruct->extChannelSwitchPresent = 1;
-        palCopyMemory( pMac, &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
+        palCopyMemory( pMac, &pBeaconStruct->extChannelSwitchIE, &beacon.ExtChanSwitchAnn,
                                                        sizeof(tDot11fIEExtChanSwitchAnn) );
     }
 
-    if( pBeacon->TPCReport.present)
+    if( beacon.TPCReport.present)
     {
         pBeaconStruct->tpcReportPresent = 1;
-        palCopyMemory(pMac->hHdd, &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
+        palCopyMemory(pMac->hHdd, &pBeaconStruct->tpcReport, &beacon.TPCReport,
                                                      sizeof(tDot11fIETPCReport));
     }
 
-    if( pBeacon->PowerConstraints.present)
+    if( beacon.PowerConstraints.present)
     {
         pBeaconStruct->powerConstraintPresent = 1;
-        palCopyMemory(pMac->hHdd, &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
+        palCopyMemory(pMac->hHdd, &pBeaconStruct->localPowerConstraint, &beacon.PowerConstraints,
                                                                sizeof(tDot11fIEPowerConstraints));
     }
-
-    if ( pBeacon->Quiet.present )
+#if defined FEATURE_WLAN_CCX
+    if (beacon.CCXTxmitPower.present)
+    {
+        palCopyMemory(pMac->hHdd, &pBeaconStruct->ccxTxPwr, &beacon.CCXTxmitPower,
+                                                               sizeof(tDot11fIECCXTxmitPower));
+    }
+    if (beacon.QBSSLoad.present)
+    {
+        palCopyMemory(pMac->hHdd, &pBeaconStruct->QBSSLoad, &beacon.QBSSLoad, sizeof(tDot11fIEQBSSLoad));
+    }
+#endif
+    if ( beacon.Quiet.present )
     {
         pBeaconStruct->quietIEPresent = 1;
-        palCopyMemory( pMac, &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
+        palCopyMemory( pMac, &pBeaconStruct->quietIE, &beacon.Quiet, sizeof(tDot11fIEQuiet));
     }
 
-    if ( pBeacon->HTCaps.present )
+    if ( beacon.HTCaps.present )
     {
-        palCopyMemory( pMac, &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
+        palCopyMemory( pMac, &pBeaconStruct->HTCaps, &beacon.HTCaps, sizeof( tDot11fIEHTCaps ) );
     }
 
-    if ( pBeacon->HTInfo.present )
+    if ( beacon.HTInfo.present )
     {
-        palCopyMemory( pMac, &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
+        palCopyMemory( pMac, &pBeaconStruct->HTInfo, &beacon.HTInfo, sizeof( tDot11fIEHTInfo) );
 
     }
 
-    if ( pBeacon->DSParams.present )
+    if ( beacon.DSParams.present )
     {
         pBeaconStruct->dsParamsPresent = 1;
-        pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
+        pBeaconStruct->channelNumber = beacon.DSParams.curr_channel;
     }
-    else if(pBeacon->HTInfo.present)
+    else if(beacon.HTInfo.present)
     {
-        pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
+        pBeaconStruct->channelNumber = beacon.HTInfo.primaryChannel;
     }
     else
     {
         pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
     }
 
-    if ( pBeacon->RSN.present )
+    if ( beacon.RSN.present )
     {
         pBeaconStruct->rsnPresent = 1;
-        ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
+        ConvertRSN( pMac, &pBeaconStruct->rsn, &beacon.RSN );
     }
 
-    if ( pBeacon->WPA.present )
+    if ( beacon.WPA.present )
     {
         pBeaconStruct->wpaPresent = 1;
-        ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
+        ConvertWPA( pMac, &pBeaconStruct->wpa, &beacon.WPA );
     }
 
-    if ( pBeacon->WMMParams.present )
+    if ( beacon.WMMParams.present )
     {
         pBeaconStruct->wmeEdcaPresent = 1;
-        ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
+        ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &beacon.WMMParams );
         PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
-        __printWMMParams(pMac, &pBeacon->WMMParams); )
+        __printWMMParams(pMac, &beacon.WMMParams); )
     }
 
-    if ( pBeacon->WMMInfoAp.present )
+    if ( beacon.WMMInfoAp.present )
     {
         pBeaconStruct->wmeInfoPresent = 1;
         PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
     }
 
-    if ( pBeacon->WMMCaps.present )
+    if ( beacon.WMMCaps.present )
     {
         pBeaconStruct->wsmCapablePresent = 1;
     }
 
-    if ( pBeacon->ERPInfo.present )
+    if ( beacon.ERPInfo.present )
     {
         pBeaconStruct->erpPresent = 1;
-        ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
+        ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &beacon.ERPInfo );
     }
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
-    if (pBeacon->MobilityDomain.present)
+    if (beacon.MobilityDomain.present)
     {
         // MobilityDomain
         pBeaconStruct->mdiePresent = 1;
-        palCopyMemory( pMac->hHdd, (tANI_U8 *)&(pBeaconStruct->mdie[0]), (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
-        pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
+        palCopyMemory( pMac->hHdd, (tANI_U8 *)&(pBeaconStruct->mdie[0]), (tANI_U8 *)&(beacon.MobilityDomain.MDID), sizeof(tANI_U16) );
+        pBeaconStruct->mdie[2] = ((beacon.MobilityDomain.overDSCap << 0) | (beacon.MobilityDomain.resourceReqCap << 1));
 
     }
 #endif
 
-#ifdef WLAN_FEATURE_11AC
-    if ( pBeacon->VHTCaps.present )
-    {
-        palCopyMemory( pMac, &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
-    }
-    if ( pBeacon->VHTOperation.present )
-    {
-        palCopyMemory( pMac, &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation, sizeof( tDot11fIEVHTOperation) );
-    }
-    if ( pBeacon->VHTExtBssLoad.present )
-    {
-        palCopyMemory( pMac, &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
-    }
-#endif
-
-    palFreeMemory(pMac->hHdd, pBeacon);
     return eSIR_SUCCESS;
 
 } // End sirConvertBeaconFrame2Struct.
@@ -4154,12 +3777,12 @@
 #ifdef WLAN_SOFTAP_FEATURE
 tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
 {
-
+ 
    tSirWPSProbeRspIE *pSirWPSProbeRspIE;
 
    pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
-
-
+   
+    
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
     {
         pDot11f->present = 1;
@@ -4175,13 +3798,13 @@
 
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
     {
-
+        
         pDot11f->WPSState.present = 1;
         pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
     }
     else
         pDot11f->WPSState.present = 0;
-
+        
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
     {
         pDot11f->APSetupLocked.present = 1;
@@ -4189,7 +3812,7 @@
     }
     else
         pDot11f->APSetupLocked.present = 0;
-
+        
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
     {
         pDot11f->SelectedRegistrar.present = 1;
@@ -4197,7 +3820,7 @@
     }
     else
          pDot11f->SelectedRegistrar.present = 0;
-
+    
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
     {
         pDot11f->DevicePasswordID.present = 1;
@@ -4205,7 +3828,7 @@
     }
     else
         pDot11f->DevicePasswordID.present = 0;
-
+        
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
     {
         pDot11f->SelectedRegistrarConfigMethods.present = 1;
@@ -4213,7 +3836,7 @@
     }
     else
         pDot11f->SelectedRegistrarConfigMethods.present = 0;
-
+        
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
     {
         pDot11f->ResponseType.present = 1;
@@ -4221,7 +3844,7 @@
     }
     else
         pDot11f->ResponseType.present = 0;
-
+        
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
     {
         pDot11f->UUID_E.present = 1;
@@ -4229,16 +3852,16 @@
     }
     else
         pDot11f->UUID_E.present = 0;
-
+    
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
     {
         pDot11f->Manufacturer.present = 1;
         pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
         palCopyMemory(pMac->hHdd, pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name, pSirWPSProbeRspIE->Manufacture.num_name);
-    }
+    } 
     else
         pDot11f->Manufacturer.present = 0;
-
+        
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
     {
         pDot11f->ModelName.present = 1;
@@ -4247,7 +3870,7 @@
     }
     else
       pDot11f->ModelName.present = 0;
-
+    
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
     {
         pDot11f->ModelNumber.present = 1;
@@ -4256,7 +3879,7 @@
     }
     else
         pDot11f->ModelNumber.present = 0;
-
+    
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
     {
         pDot11f->SerialNumber.present = 1;
@@ -4265,17 +3888,17 @@
     }
     else
         pDot11f->SerialNumber.present = 0;
-
+    
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
     {
         pDot11f->PrimaryDeviceType.present = 1;
-        palCopyMemory(pMac->hHdd, pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI, sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
+        palCopyMemory(pMac->hHdd, pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI, sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI)); 
         pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
         pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
     }
     else
         pDot11f->PrimaryDeviceType.present = 0;
-
+    
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
     {
         pDot11f->DeviceName.present = 1;
@@ -4284,7 +3907,7 @@
     }
     else
         pDot11f->DeviceName.present = 0;
-
+    
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
     {
         pDot11f->ConfigMethods.present = 1;
@@ -4292,16 +3915,16 @@
     }
     else
         pDot11f->ConfigMethods.present = 0;
-
-
+    
+    
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
     {
         pDot11f->RFBands.present = 1;
         pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
     }
     else
-       pDot11f->RFBands.present = 0;
-
+       pDot11f->RFBands.present = 0;      
+       
     return eSIR_SUCCESS;
 }
 tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
@@ -4309,7 +3932,7 @@
    tSirWPSProbeRspIE *pSirWPSProbeRspIE;
 
    pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
-
+   
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
     {
         pDot11f->present = 1;
@@ -4322,26 +3945,26 @@
         pDot11f->present = 0;
         pDot11f->Version.present = 0;
     }
-
+    
     if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
     {
         pDot11f->ResponseType.present = 1;
         pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
     }
     else
-        pDot11f->ResponseType.present = 0;
+        pDot11f->ResponseType.present = 0;    
 
     return eSIR_SUCCESS;
 }
 
 tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
 {
-
+ 
    tSirWPSBeaconIE *pSirWPSBeaconIE;
 
    pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
-
-
+   
+    
     if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
     {
         pDot11f->present = 1;
@@ -4354,16 +3977,16 @@
         pDot11f->present = 0;
         pDot11f->Version.present = 0;
     }
-
+    
     if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
     {
-
+        
         pDot11f->WPSState.present = 1;
         pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
     }
     else
         pDot11f->WPSState.present = 0;
-
+        
     if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
     {
         pDot11f->APSetupLocked.present = 1;
@@ -4371,7 +3994,7 @@
     }
     else
         pDot11f->APSetupLocked.present = 0;
-
+        
     if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
     {
         pDot11f->SelectedRegistrar.present = 1;
@@ -4379,7 +4002,7 @@
     }
     else
          pDot11f->SelectedRegistrar.present = 0;
-
+    
     if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
     {
         pDot11f->DevicePasswordID.present = 1;
@@ -4387,7 +4010,7 @@
     }
     else
         pDot11f->DevicePasswordID.present = 0;
-
+        
     if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
     {
         pDot11f->SelectedRegistrarConfigMethods.present = 1;
@@ -4395,7 +4018,7 @@
     }
     else
         pDot11f->SelectedRegistrarConfigMethods.present = 0;
-
+        
     if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
     {
         pDot11f->UUID_E.present = 1;
@@ -4403,16 +4026,16 @@
     }
     else
         pDot11f->UUID_E.present = 0;
-
-
+    
+       
     if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
     {
         pDot11f->RFBands.present = 1;
         pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
     }
     else
-       pDot11f->RFBands.present = 0;
-
+       pDot11f->RFBands.present = 0;      
+       
     return eSIR_SUCCESS;
 }
 #endif
@@ -4630,18 +4253,18 @@
     return eSIR_SUCCESS;
 }
 
-tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
-                                          tDot11fIEWscAssocRes *pDot11f,
+tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac, 
+                                          tDot11fIEWscAssocRes *pDot11f, 
                                           tpSirAssocReq pRcvdAssocReq)
 {
     tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
     tANI_U8         *wscIe;
-
+    
 
     wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
     if(wscIe != NULL)
     {
-        // retreive WSC IE from given AssocReq
+        // retreive WSC IE from given AssocReq 
         dot11fUnpackIeWscAssocReq( pMac,
                                     wscIe + 2 + 4,  // EID, length, OUI
                                     wscIe[ 1 ] - 4, // length without OUI
@@ -4653,7 +4276,7 @@
         pDot11f->Version.minor = 0x0;
 
         pDot11f->ResponseType.present = 1;
-
+        
         if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
             (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
         {
@@ -4667,7 +4290,7 @@
         // TODO: currently it takes from peers only
         if(parsedWscAssocReq.VendorExtension.present &&
            parsedWscAssocReq.VendorExtension.Version2.present)
-        {
+        {   
             pDot11f->VendorExtension.present = 1;
             pDot11f->VendorExtension.vendorId[0] = 0x00;
             pDot11f->VendorExtension.vendorId[1] = 0x37;
@@ -4681,8 +4304,8 @@
 }
 
 #ifdef WLAN_FEATURE_P2P
-tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
-                                       tDot11fIEP2PAssocRes *pDot11f,
+tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac, 
+                                       tDot11fIEP2PAssocRes *pDot11f, 
                                        tpSirAssocReq pRcvdAssocReq)
 {
     tANI_U8         *p2pIe;
@@ -4738,7 +4361,7 @@
 }
 
 tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession    psessionEntry )
-{
+{  
    tpRRMCaps pRrmCaps;
 
    pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
@@ -4787,7 +4410,7 @@
    // Plugfest fix
    pDot11f->overDSCap =   (mdie[2] & 0x01);
    pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
-
+   
 }
 
 void PopulateFTInfo( tpAniSirGlobal      pMac,
@@ -4800,7 +4423,7 @@
 }
 #endif
 
-void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
+void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp, 
       tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
 {
   tANI_U8 num_supp = 0, num_ext = 0;
@@ -4809,14 +4432,14 @@
   for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
   {
       pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
-  }
+  }  
   for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
   {
      if( num_supp < 8 )
          pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
      else
-         pExt->rates[num_ext++] =  (tANI_U8)_11aRates[j];
-  }
+         pExt->rates[num_ext++] =  (tANI_U8)_11aRates[j]; 
+  }  
 
   if( num_supp )
   {
@@ -4828,5 +4451,5 @@
      pExt->num_rates = num_ext;
      pExt->present = 1;
   }
-}
+} 
 // parserApi.c ends here.
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/utilsApi.c b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/utilsApi.c
index 004827c..a78345d 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/utilsApi.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/utilsApi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/utilsParser.c b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/utilsParser.c
index f63473d..5d9568e 100644
--- a/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/utilsParser.c
+++ b/drivers/staging/prima/CORE/SYS/legacy/src/utils/src/utilsParser.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -168,28 +168,6 @@
 }
 #endif
 
-#ifdef WLAN_FEATURE_WFD
-tSirRetStatus ConvertWFDOpaque( tpAniSirGlobal      pMac,
-                                tSirAddie           *pOld,
-                                tDot11fIEWFDIEOpaque *pNew )
-{
-    // This is awful, I know, but the old code just rammed the IE into
-    // an opaque array.  Note that we need to explicitly add the vendorIE and OUI !
-    tANI_U8 curAddIELen = pOld->length; 
-
-    pOld->length    = curAddIELen + pNew->num_data + 6;
-    pOld->addIEdata[ curAddIELen++ ] = 0xdd;
-    pOld->addIEdata[ curAddIELen++ ] = pNew->num_data + 4;
-    pOld->addIEdata[ curAddIELen++ ] = 0x50;
-    pOld->addIEdata[ curAddIELen++ ] = 0x6f;
-    pOld->addIEdata[ curAddIELen++ ] = 0x9A;
-    pOld->addIEdata[ curAddIELen++ ] = 0x0a;
-    palCopyMemory( pMac->hHdd, pOld->addIEdata + curAddIELen, pNew->data, pNew->num_data );
-
-    return eSIR_SUCCESS;
-}
-#endif
-
 tSirRetStatus ConvertRSN(tpAniSirGlobal  pMac,
                                tSirMacRsnInfo *pOld,
                                tDot11fIERSN      *pNew)
diff --git a/drivers/staging/prima/CORE/TL/inc/tlDebug.h b/drivers/staging/prima/CORE/TL/inc/tlDebug.h
index f77049a..b99646e 100644
--- a/drivers/staging/prima/CORE/TL/inc/tlDebug.h
+++ b/drivers/staging/prima/CORE/TL/inc/tlDebug.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -67,8 +67,8 @@
 #else /* WLAN DEBUG */
 
 #define TLLOGP(x)  x
-#define TLLOGE(x)  x
-#define TLLOGW(x)  x
+#define TLLOGE(x)  {}
+#define TLLOGW(x)  {}
 #define TLLOG1(x)  {}
 #define TLLOG2(x)  {}
 #define TLLOG3(x)  {}
diff --git a/drivers/staging/prima/CORE/TL/inc/wlan_qct_tl.h b/drivers/staging/prima/CORE/TL/inc/wlan_qct_tl.h
index cb661d7..610408c 100644
--- a/drivers/staging/prima/CORE/TL/inc/wlan_qct_tl.h
+++ b/drivers/staging/prima/CORE/TL/inc/wlan_qct_tl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -775,18 +775,6 @@
    v_PVOID_t                       pUserCtxt
 );
 
-typedef struct
-{
-    // Common for all types are requests
-    v_U16_t                         msgType;    // message type is same as the request type
-    v_U16_t                         msgLen;  // length of the entire request
-    v_U8_t                          sessionId; //sme Session Id
-    v_U8_t                          rssiNotification;    
-    v_PVOID_t                       tlCallback;
-    v_PVOID_t                       pAdapter;
-    v_PVOID_t                       pUserCtxt;
-} WLANTL_TlIndicationReq;
-
 /*----------------------------------------------------------------------------
  * Function Declarations and Documentation
  * -------------------------------------------------------------------------*/
@@ -1105,51 +1093,6 @@
 
 /*===========================================================================
 
-  FUNCTION    WLANTL_GetSTAState
-
-  DESCRIPTION
-
-    Returns connectivity state of a particular STA.
-
-  DEPENDENCIES
-
-    A station must have been registered before its state can be retrieved.
-
-
-  PARAMETERS
-
-    IN
-    pvosGCtx:       pointer to the global vos context; a handle to TL's
-                    control block can be extracted from its context
-    ucSTAId:        identifier of the station
-
-    OUT
-    ptlSTAState:    the current state of the connection to the given station
-
-
-  RETURN VALUE
-
-    The result code associated with performing the operation
-
-    VOS_STATUS_E_INVAL:  Input parameters are invalid
-    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer to
-                         TL cb is NULL ; access would cause a page fault
-    VOS_STATUS_E_EXISTS: Station was not registered
-    VOS_STATUS_SUCCESS:  Everything is good :)
-
-  SIDE EFFECTS
-
-============================================================================*/
-VOS_STATUS
-WLANTL_GetSTAState
-(
-  v_PVOID_t             pvosGCtx,
-  v_U8_t                ucSTAId,
-  WLANTL_STAStateType   *ptlSTAState
-);
-
-/*===========================================================================
-
   FUNCTION    WLANTL_STAPktPending
 
   DESCRIPTION 
diff --git a/drivers/staging/prima/CORE/TL/src/wlan_qct_tl.c b/drivers/staging/prima/CORE/TL/src/wlan_qct_tl.c
index 62a1935..7b883a1 100644
--- a/drivers/staging/prima/CORE/TL/src/wlan_qct_tl.c
+++ b/drivers/staging/prima/CORE/TL/src/wlan_qct_tl.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -416,14 +416,11 @@
   pTLCb = VOS_GET_TL_CB(pvosGCtx);
   if (( NULL == pTLCb ) || ( NULL == pTLConfig ) )
   {
-    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                "WLAN TL: Invalid input pointer on WLANTL_Open TL %x Config %x", pTLCb, pTLConfig ));
     return VOS_STATUS_E_FAULT;
   }
 
-  /* Set the default log level to VOS_TRACE_LEVEL_ERROR */
-  vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
-
   smeContext = vos_get_context(VOS_MODULE_ID_SME, pvosGCtx);
   if ( NULL == smeContext )
   {
@@ -1518,97 +1515,6 @@
 
 /*===========================================================================
 
-  FUNCTION    WLANTL_GetSTAState
-
-  DESCRIPTION
-
-    Returns connectivity state of a particular STA.
-
-  DEPENDENCIES
-
-    A station must have been registered before its state can be retrieved.
-
-
-  PARAMETERS
-
-    IN
-    pvosGCtx:       pointer to the global vos context; a handle to TL's
-                    control block can be extracted from its context
-    ucSTAId:        identifier of the station
-
-    OUT
-    ptlSTAState:    the current state of the connection to the given station
-
-
-  RETURN VALUE
-
-    The result code associated with performing the operation
-
-    VOS_STATUS_E_INVAL:  Input parameters are invalid
-    VOS_STATUS_E_FAULT:  Station ID is outside array boundaries or pointer to
-                         TL cb is NULL ; access would cause a page fault
-    VOS_STATUS_E_EXISTS: Station was not registered
-    VOS_STATUS_SUCCESS:  Everything is good :)
-
-  SIDE EFFECTS
-
-============================================================================*/
-VOS_STATUS
-WLANTL_GetSTAState
-(
-  v_PVOID_t             pvosGCtx,
-  v_U8_t                ucSTAId,
-  WLANTL_STAStateType   *ptlSTAState
-)
-{
-  WLANTL_CbType*  pTLCb = NULL;
-  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-  /*------------------------------------------------------------------------
-    Sanity check
-   ------------------------------------------------------------------------*/
-  if ( NULL == ptlSTAState )
-  {
-     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-              "WLAN TL:Invalid parameter sent on WLANTL_GetSTAState"));
-    return VOS_STATUS_E_INVAL;
-  }
-
-  if ( WLANTL_STA_ID_INVALID( ucSTAId ) )
-  {
-    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-             "WLAN TL:Invalid station id requested on WLANTL_GetSTAState"));
-    return VOS_STATUS_E_FAULT;
-  }
-
-  /*------------------------------------------------------------------------
-    Extract TL control block and check existance
-   ------------------------------------------------------------------------*/
-  pTLCb = VOS_GET_TL_CB(pvosGCtx);
-  if ( NULL == pTLCb )
-  {
-    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-         "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_GetSTAState"));
-    return VOS_STATUS_E_FAULT;
-  }
-
-  if ( 0 == pTLCb->atlSTAClients[ucSTAId].ucExists )
-  {
-    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-     "WLAN TL:Station was not previously registered on WLANTL_GetSTAState"));
-    return VOS_STATUS_E_EXISTS;
-  }
-
-  /*------------------------------------------------------------------------
-    Get STA state
-   ------------------------------------------------------------------------*/
-  *ptlSTAState = pTLCb->atlSTAClients[ucSTAId].tlState;
-
-  return VOS_STATUS_SUCCESS;
-}/* WLANTL_GetSTAState */
-
-/*===========================================================================
-
   FUNCTION    WLANTL_STAPktPending
 
   DESCRIPTION
@@ -1699,13 +1605,6 @@
     --------------------------------------------------------------------*/
   pTLCb->ucRegisteredStaId = ucSTAId;
 
-  if( WLANTL_STA_AUTHENTICATED != pTLCb->atlSTAClients[ucSTAId].tlState )
-  {
-    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-      "WLAN TL:Packet pending indication for STA: %d AC: %d State: %d", 
-               ucSTAId, ucAc, pTLCb->atlSTAClients[ucSTAId].tlState);
-  }
-
   /*-----------------------------------------------------------------------
     Enable this AC in the AC mask in order for TL to start servicing it
     Set packet pending flag 
@@ -1738,9 +1637,9 @@
           No error code is sent because TL will resume tx autonomously if
           resources become available or tx gets resumed
           ---------------------------------------------------------------------*/
-        VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+        TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
               "WLAN TL:Request to send but condition not met. Res: %d,Suspend: %d",
-              pTLCb->uResCount, pTLCb->ucTxSuspended );
+              pTLCb->uResCount, pTLCb->ucTxSuspended ));
       }
 #ifdef WLAN_SOFTAP_FEATURE
     }
@@ -2239,6 +2138,8 @@
     {
       *pRssi = pTLCb->atlSTAClients[ucSTAId].rssiAvg;
     }
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                                 "WLAN TL:bmpsRssi %d \n",*pRssi));
   }
   else
   {
@@ -2246,9 +2147,7 @@
   }
 
   TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
-                    "WLAN TL:WLANTL_GetRssi for STA: %d RSSI: %d%s",
-                    ucSTAId, *pRssi,
-                    pTLCb->isBMPS ? " in BMPS" : ""));
+            "WLAN TL:WLANTL_GetRssi for STA: %d RSSI: %d", ucSTAId, *puRssi));
 
   return VOS_STATUS_SUCCESS;
 }/* WLANTL_GetRssi */
@@ -3878,7 +3777,7 @@
           ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VI ) ) || 
           ( uFlowMask & ( 1 << WDA_TXFLOW_AC_VO ) )))
       {
-         TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
              "WLAN TL:Returning from GetFrame: resources = %d",
                  pTLCb->uResCount));
          ucResult = WDA_TLI_MIN_RES_DATA;
@@ -5201,15 +5100,12 @@
           continue;
         }
 
-/* This will be handled within statistics module */
-#ifndef FEATURE_WLAN_INTEGRATED_SOC
 #ifdef WLAN_SOFTAP_FEATURE
     /* RX Statistics Data */
       /* This is RX UC data frame */
       pTLCb->atlSTAClients[ucSTAId].trafficStatistics.rxUCFcnt++;
       pTLCb->atlSTAClients[ucSTAId].trafficStatistics.rxUCBcnt += usPktLen;
 #endif
-#endif /* FEATURE_WLAN_INTEGRATED_SOC */
 
     }/* else data frame*/
 
@@ -5594,7 +5490,6 @@
    v_U8_t               ucTid;
    v_U8_t               extraHeadSpace = 0;
    v_U8_t               ucWDSEnabled = 0;
-   v_U8_t               ucAC, ucACMask, i; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*------------------------------------------------------------------------
@@ -5604,8 +5499,8 @@
   pTLCb = VOS_GET_TL_CB(pvosGCtx);
   if ( NULL == pTLCb )
   {
-   VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-             "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxConn");
+   TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+             "WLAN TL:Invalid TL pointer from pvosGCtx on WLANTL_STATxConn"));
    *pvosDataBuff = NULL;
     return VOS_STATUS_E_FAULT;
   }
@@ -5624,74 +5519,19 @@
        is successfull it will be re-enabled
   -------------------------------------------------------------------*/
 
-
-  //LTI:pTLCb->atlSTAClients[ucSTAId].
-  //LTI:   aucACMask[pTLCb->atlSTAClients[ucSTAId].ucCurrentAC] = 0; 
-
-  /*------------------------------------------------------------------------
-    Fetch packet from HDD
-   ------------------------------------------------------------------------*/
-  if ((WLAN_STA_SOFTAP != pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType) &&
-      (!vos_concurrent_sessions_running()))
-  {
-      ucAC = pTLCb->atlSTAClients[ucSTAId].ucCurrentAC;
-
-  /*-------------------------------------------------------------------
-      Disable AC temporary - if successfull retrieve re-enable
-      The order is justified because of the possible scenario
-       - TL tryes to fetch packet for AC and it returns NULL
-       - TL analyzes the data it has received to see if there are
-       any more pkts available for AC -> if not TL will disable AC
-       - however it is possible that while analyzing results TL got
-       preempted by a pending indication where the mask was again set
-       TL will not check again and as a result when it resumes
-       execution it will disable AC
-       To prevent this the AC will be disabled here and if retrieve
-       is successfull it will be re-enabled
-  -------------------------------------------------------------------*/
-     pTLCb->atlSTAClients[ucSTAId].aucACMask[ucAC] = 0; 
-  }
-  else
-  {
-    //softap case
-    ucAC = pTLCb->uCurServedAC;
-    pTLCb->atlSTAClients[ucSTAId].aucACMask[ucAC] = 0; 
-
-  }
+  pTLCb->atlSTAClients[ucSTAId].
+     aucACMask[pTLCb->atlSTAClients[ucSTAId].ucCurrentAC] = 0; 
 
     /*You make an initial assumption that HDD has no more data and if the 
       assumption was wrong you reset the flags to their original state
      This will prevent from exposing a race condition between checking with HDD 
      for packets and setting the flags to false*/
- //LTI: vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 0);
- //LTI: pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 1;
   vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 0);
-    WLAN_TL_AC_ARRAY_2_MASK( &pTLCb->atlSTAClients[ucSTAId], ucACMask, i); 
-#ifdef WLAN_SOFTAP_FEATURE
-    /*You make an initial assumption that HDD has no more data and if the 
-      assumption was wrong you reset the flags to their original state
-     This will prevent from exposing a race condition between checking with HDD 
-     for packets and setting the flags to false*/
-  if ( 0 == ucACMask )
-  {
   pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 1;
-  }
-  else
-  {
-    vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 1);
-  }
-
-#endif
-
-  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
-            "WLAN TL: WLANTL_STATxConn fetching packet from HDD for AC: %d AC Mask: %d Pkt Pending: %d", 
-             ucAC, ucACMask, pTLCb->atlSTAClients[ucSTAId].ucPktPending);
 
   /*------------------------------------------------------------------------
     Fetch tx packet from HDD
    ------------------------------------------------------------------------*/
-//LTI
-#if 0 
 #ifdef WLAN_SOFTAP_FEATURE
   if (WLAN_STA_SOFTAP != pTLCb->atlSTAClients[ucSTAId].wSTADesc.wSTAType && 
      (!vos_concurrent_sessions_running()))
@@ -5715,16 +5555,10 @@
                                                 &vosDataBuff, &tlMetaInfo );
   }
 #endif
-#endif
-
-  vosStatus = pTLCb->atlSTAClients[ucSTAId].pfnSTAFetchPkt( pvosGCtx, 
-                               &ucSTAId,
-                               ucAC,
-                               &vosDataBuff, &tlMetaInfo );
 
   if (( VOS_STATUS_SUCCESS != vosStatus ) || ( NULL == vosDataBuff ))
   {
-    TLLOG1(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                "WLAN TL:No more data at HDD status %d", vosStatus));
     *pvosDataBuff = NULL;
 
@@ -5737,10 +5571,6 @@
     pTLCb->atlSTAClients[ucSTAId].ucCurrentAC     = WLANTL_AC_VO;
     pTLCb->atlSTAClients[ucSTAId].ucCurrentWeight = 0;
 
-    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-              "WLAN TL: WLANTL_STATxConn no more packets in HDD for AC: %d AC Mask: %d", 
-               ucAC, ucACMask);
-
     return vosStatus;
   }
 
@@ -5748,8 +5578,9 @@
    the no more data assumption*/
   vos_atomic_set_U8( &pTLCb->atlSTAClients[ucSTAId].ucPktPending, 1);
   pTLCb->atlSTAClients[ucSTAId].ucNoMoreData = 0;
-  pTLCb->atlSTAClients[ucSTAId].aucACMask[ucAC] = 1; 
 
+   pTLCb->atlSTAClients[ucSTAId].
+     aucACMask[pTLCb->atlSTAClients[ucSTAId].ucCurrentAC] = 1; 
 #ifdef WLAN_PERF 
   vos_pkt_set_user_data_ptr( vosDataBuff, VOS_PKT_USER_DATA_ID_BAL, 
                              (v_PVOID_t)0);
@@ -5763,7 +5594,7 @@
    ------------------------------------------------------------------------*/
    if ( 0 == tlMetaInfo.ucIsEapol && 0 == tlMetaInfo.ucIsWai )
    {
-     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,
+     TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                 "WLAN TL:Only EAPOL or WAI packets allowed before authentication"));
 
      /* Fail tx for packet */
@@ -6049,10 +5880,6 @@
     return vosStatus;
   }
 
-#ifdef FEATURE_WLAN_INTEGRATED_SOC
-  WLANTL_StatHandleTXFrame(pvosGCtx, ucSTAId, vosDataBuff, NULL, &tlMetaInfo);
-#endif /* FEATURE_WLAN_INTEGRATED_SOC */
-
 #ifdef WLAN_SOFTAP_FEATURE
   /*There are still packets in HDD - set back the pending packets and 
    the no more data assumption*/
@@ -6284,7 +6111,7 @@
 
   /* This code is to send traffic with lower priority AC when we does not 
      get admitted to send it. Today HAL does not downgrade AC so this code 
-     does not get executed.(In other words, HAL doesnt change tid. The if 
+     does not get executed.(In other words, HAL doesnÂ’t change tid. The if 
      statement is always false.)
      NOTE: In the case of LA downgrade occurs in HDD (that was the change 
      Phani made during WMM-AC plugfest). If WM & BMP also took this approach, 
@@ -6512,26 +6339,22 @@
     /* that we get an EAPOL packet in WAPI mode or vice versa? */
     if ( WLANTL_LLC_8021X_TYPE  != usEtherType && WLANTL_LLC_WAI_TYPE  != usEtherType )
     {
-      VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                 "WLAN TL:RX Frame not EAPOL or WAI EtherType %d - dropping", usEtherType );
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:Frame not EAPOL or WAI - dropping"));
       /* Drop packet */
       vos_pkt_return_packet(vosDataBuff);
     }
 #else
     if ( WLANTL_LLC_8021X_TYPE  != usEtherType )
     {
-      VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                 "WLAN TL:RX Frame not EAPOL EtherType %d - dropping", usEtherType);
+      TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
+                 "WLAN TL:Frame not EAPOL - dropping"));
       /* Drop packet */
       vos_pkt_return_packet(vosDataBuff);
     }
 #endif /* FEATURE_WLAN_WAPI */
     else /* Frame is an EAPOL frame or a WAI frame*/  
     {
-
-      VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-                 "WLAN TL:RX Frame  EAPOL EtherType %d - processing", usEtherType);
-
       if (( 0 == WDA_GET_RX_FT_DONE(aucBDHeader) ) &&
          ( 0 != pTLCb->atlSTAClients[ucSTAId].wSTADesc.ucSwFrameRXXlation))
       {
@@ -6555,16 +6378,7 @@
       /*-------------------------------------------------------------------
       Increment receive counter
       -------------------------------------------------------------------*/
-      if ( !WLANTL_TID_INVALID( ucTid) ) 
-      {
-        pTLCb->atlSTAClients[ucSTAId].auRxCount[ucTid]++;
-      }
-      else
-      {
-        TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-               "WLAN TL:Invalid tid  %d (Station ID %d) on %s",
-               ucTid, ucSTAId, __func__));
-      }
+      pTLCb->atlSTAClients[ucSTAId].auRxCount[ucTid]++;
 
       TLLOG2(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
                "WLAN TL:Sending EAPoL frame to station %d AC %d", ucSTAId, ucTid));
@@ -6925,16 +6739,7 @@
     dropped below or delayed in TL's queues
     - will leave it here for now
    ------------------------------------------------------------------------*/
-  if ( !WLANTL_TID_INVALID( ucTid) ) 
-  {
-    pTLCb->atlSTAClients[ucSTAId].auRxCount[ucTid]++;
-  }
-  else
-  {
-    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
-           "WLAN TL:Invalid tid  %d (Station ID %d) on %s",
-           ucTid, ucSTAId, __func__));
-  }
+  pTLCb->atlSTAClients[ucSTAId].auRxCount[ucTid]++;
 
   /*------------------------------------------------------------------------
     Check if AMSDU and send for processing if so
@@ -8885,6 +8690,7 @@
   pTLCb->ucCurrentSTA = WLAN_MAX_STA_COUNT; 
 
   *pucSTAId = pTLCb->ucCurrentSTA;
+  pTLCb->atlSTAClients[*pucSTAId].ucCurrentAC = pTLCb->uCurServedAC;
   return VOS_STATUS_E_FAULT;
 }
 
@@ -9612,10 +9418,7 @@
   if ( ( 0 != ucEmpty ) &&
        ( NULL != ptlSTAClient->vosAMSDUChainRoot ))
   {
-    TLLOGE(VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
-               "WLAN TL:Non NULL vosAMSDUChainRoot (=%x) on WLANTL_CleanSTA," 
-               "suspecting a memory corruption"));
-
+    vos_pkt_return_packet(ptlSTAClient->vosAMSDUChainRoot);
   }
 
   ptlSTAClient->vosAMSDUChain     = NULL;
diff --git a/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_ba.c b/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_ba.c
index 05001fc..f70264f 100644
--- a/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_ba.c
+++ b/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_ba.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -170,7 +170,7 @@
    vosDataBuff = NULL;
 
 
-   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"BA timeout with %d pending frames, curIdx %d", ReorderInfo->pendingFramesCount, ReorderInfo->ucCIndex));
+   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"BA timeout with %d pending frames, curIdx %d", ReorderInfo->pendingFramesCount, ReorderInfo->ucCIndex));
 
    if(ReorderInfo->pendingFramesCount == 0)
    {
@@ -639,7 +639,7 @@
    ------------------------------------------------------------------------*/
   if ( 0 == pTLCb->atlSTAClients[ucSTAId].atlBAReorderInfo[ucTid].ucExists )
   {
-    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
+    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                "WLAN TL:BA session does not exists on WLANTL_BaSessionDel");
     return VOS_STATUS_E_EXISTS;
   }
diff --git a/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_hosupport.c b/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_hosupport.c
index e1b9804..df9e922 100644
--- a/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_hosupport.c
+++ b/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_hosupport.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -270,12 +270,12 @@
    {
       if(VOS_TRUE == tlCtxt->isBMPS)
       {
-         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO," ----> CRegion %d, hRSSI:NA, BMPS, Alpha %d",
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR," ----> CRegion %d, hRSSI:NA, BMPS, Alpha %d",
                       currentHO->regionNumber, currentHO->alpha));
       }
       else
       {
-         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO," ----> CRegion %d, hRSSI %d, Alpha %d",
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR," ----> CRegion %d, hRSSI %d, Alpha %d",
                       currentHO->regionNumber,
                       currentHO->historyRSSI,
                       currentHO->alpha));
@@ -433,7 +433,7 @@
    if(WDA_IS_RX_BCAST(pBDHeader))
    {
       TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is RX BC/MC frame"));
-      if(isBroadcast)
+      if(VOS_FALSE == isBroadcast)
       {
          TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is RX BC frame"));
          statistics->rxBCFcnt++;
@@ -455,11 +455,6 @@
 
    /* TODO caculation is needed, dimension of 500kbps */
    statistics->rxRate = WDA_GET_RX_MAC_RATE_IDX(pBDHeader);
-   
-   TLLOG1(VOS_TRACE (VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
-                  "****Received rate Index = %ld type=%d subtype=%d****\n",
-                  statistics->rxRate,WDA_GET_RX_TYPE(pBDHeader),WDA_GET_RX_SUBTYPE(pBDHeader)));
-
    statistics->rxBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
 
 #ifdef WLANTL_HO_DEBUG_MSG
@@ -486,9 +481,6 @@
    v_U8_t           STAid,
    vos_pkt_t       *dataBuffer,
    v_PVOID_t        pBDHeader
-#ifdef FEATURE_WLAN_INTEGRATED_SOC
-  ,WLANTL_MetaInfoType *txMetaInfo
-#endif /* FEATURE_WLAN_INTEGRATED_SOC */
 )
 {
    WLANTL_CbType            *tlCtxt = VOS_GET_TL_CB(pAdapter);
@@ -511,39 +503,35 @@
    /* TODO : BC/MC/UC have to be determined by MAC address */
    statistics = &tlCtxt->atlSTAClients[STAid].trafficStatistics;
    vos_pkt_get_packet_length(dataBuffer, &packetSize);
-#ifdef FEATURE_WLAN_INTEGRATED_SOC
-   if(txMetaInfo->ucBcast)
-#else
    if(WLANTL_STA_ID_BCAST == STAid)
-#endif /* FEATURE_WLAN_INTEGRATED_SOC */
    {
       TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This TX is BC frame"));
       statistics->txBCFcnt++;
-#ifdef FEATURE_WLAN_INTEGRATED_SOC
-      statistics->txBCBcnt += packetSize;
-#else
       statistics->txBCBcnt += (packetSize - WLANHAL_TX_BD_HEADER_SIZE);
-#endif /* FEATURE_WLAN_INTEGRATED_SOC */
    }
-   else if(txMetaInfo->ucMcast)
+/*
+   if(WLANHAL_TX_BD_GET_UB(pBDHeader))
    {
-      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This TX is MC frame"));
-      statistics->txMCFcnt++;
-#ifdef FEATURE_WLAN_INTEGRATED_SOC
-      statistics->txMCBcnt += packetSize;
-#else
-      statistics->txMCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
-#endif /* FEATURE_WLAN_INTEGRATED_SOC */
+      TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This TX is BC/MC frame"));
+      if(WLANTL_STA_ID_BCAST == STAid)
+      {
+         TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This TX is BC frame"));
+         statistics->txBCFcnt++;
+         statistics->txBCBcnt += (packetSize - WLANHAL_TX_BD_HEADER_SIZE);
+      }
+      else
+      {
+         TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This TX is MC frame"));
+         statistics->txMCFcnt++;
+         statistics->txMCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
+      }
    }
+*/
    else
    {
       TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is TX UC frame"));
       statistics->txUCFcnt++;
-#ifdef FEATURE_WLAN_INTEGRATED_SOC
-      statistics->txUCBcnt += packetSize;
-#else
       statistics->txUCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
-#endif /* FEATURE_WLAN_INTEGRATED_SOC */
    }
 
 #ifdef WLANTL_HO_DEBUG_MSG
@@ -991,7 +979,7 @@
                   usrCtxt = hoSupport->registeredInd[idx].usrCtxt[sIdx];
                   evtType = WLANTL_HO_THRESHOLD_DOWN;
                   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Trigger Event %d, region index %d", hoSupport->registeredInd[idx].triggerEvent[sIdx], idx));
-                  status = WLANTL_HSSerializeTlIndication(pAdapter, evtType, usrCtxt, cbFunction);
+                  status = cbFunction(pAdapter, evtType, usrCtxt);
                }
             }
          }
@@ -1013,7 +1001,7 @@
                   usrCtxt = hoSupport->registeredInd[idx - 1].usrCtxt[sIdx];
                   evtType = WLANTL_HO_THRESHOLD_UP;
                   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Trigger Event %d, region index %d", hoSupport->registeredInd[idx - 1].triggerEvent[sIdx], idx - 1));
-                  status = WLANTL_HSSerializeTlIndication(pAdapter, evtType, usrCtxt, cbFunction);
+                  status = cbFunction(pAdapter, evtType, usrCtxt);
                }
             }
          }
@@ -1094,7 +1082,6 @@
    if(VOS_TRUE == tlCtxt->isBMPS)
    {
       WLANTL_HSGetRSSI(pAdapter, pBDHeader, STAid, &currentAvgRSSI);
-      currentHO->historyRSSI = currentAvgRSSI;
       return status;
    }
 
@@ -1167,9 +1154,7 @@
       return VOS_STATUS_SUCCESS;
    }
 
-#ifndef FEATURE_WLAN_INTEGRATED_SOC
    WLANTL_StatHandleTXFrame(pAdapter, STAid, dataBuffer, bdHeader);
-#endif /* FEATURE_WLAN_INTEGRATED_SOC */
 
    /* Only Voice traffic is handled as real time traffic */
    if(WLANTL_AC_VO == ac)
@@ -1232,7 +1217,7 @@
 
    currentHO = &(tlCtxt->hoSupport.currentHOState);
    hoSupport = &(tlCtxt->hoSupport);
-   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Make Registration Module %d, Event %d, RSSI %d", moduleID, triggerEvent, rssiValue));
+   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Make Registration Module %d, Event %d, RSSI %d", moduleID, triggerEvent, rssiValue));
 
    if((WLANTL_MAX_AVAIL_THRESHOLD < currentHO->numThreshold) ||
       (WLANTL_MAX_AVAIL_THRESHOLD == currentHO->numThreshold))
@@ -1261,12 +1246,12 @@
          {
             for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
             {
-               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Reg CB P 0x%x, registered CB P 0x%x",
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Reg CB P 0x%x, registered CB P 0x%x",
                              crossCBFunction,
                              hoSupport->registeredInd[idx].crossCBFunction[sIdx]));
                if(crossCBFunction == hoSupport->registeredInd[idx].crossCBFunction[sIdx])
                {
-                  TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Same RSSI %d, Same CB 0x%x already registered",
+                  TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Same RSSI %d, Same CB 0x%x already registered",
                                rssiValue, crossCBFunction));
                   WLANTL_HSDebugDisplay(pAdapter);
                   THSRELEASELOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
@@ -1332,16 +1317,16 @@
    currentHO->numThreshold++;
    if((VOS_FALSE == tlCtxt->isBMPS) && (rssiValue > currentHO->historyRSSI))
    {
-      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Added Threshold above current RSSI level, old RN %d", currentHO->regionNumber));
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Added Threshold above current RSSI level, old RN %d", currentHO->regionNumber));
       if(4 > currentHO->regionNumber)
       {
          currentHO->regionNumber++;
       }
       else
       {
-         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Current region number is max %d, cannot increase anymore", currentHO->regionNumber));
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Current region number is max %d, cannot increase anymore", currentHO->regionNumber));
       }
-      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"increase region number without notification %d", currentHO->regionNumber));
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"increase region number without notification %d", currentHO->regionNumber));
    }
    else if(VOS_TRUE == tlCtxt->isBMPS)
    {
@@ -1352,8 +1337,8 @@
             currentHO->regionNumber++;
             if((WLANTL_HO_THRESHOLD_DOWN == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent))
             {
-               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Registered RSSI value larger than Current RSSI, and DOWN event, Send Notification"));
-               WLANTL_HSSerializeTlIndication(pAdapter, WLANTL_HO_THRESHOLD_DOWN, usrCtxt, crossCBFunction);
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Registered RSSI value larger than Current RSSI, and DOWN event, Send Notification"));
+               crossCBFunction(pAdapter, WLANTL_HO_THRESHOLD_DOWN, usrCtxt);
             }
          }
          else if((currentHO->regionNumber < (currentHO->numThreshold - 1)) &&
@@ -1361,7 +1346,7 @@
          {
             if((WLANTL_HO_THRESHOLD_UP == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent))
             {
-               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Registered RSSI value smaller than Current RSSI"));
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Registered RSSI value smaller than Current RSSI"));
             }
          }
       }
@@ -1371,7 +1356,7 @@
          {
             if((WLANTL_HO_THRESHOLD_UP == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent))
             {
-               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Registered RSSI value smaller than Current RSSI"));
+               TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Registered RSSI value smaller than Current RSSI"));
             }
          }
       }
@@ -1381,15 +1366,15 @@
       (rssiValue >= currentHO->historyRSSI) && (0 != currentHO->historyRSSI) &&
       ((WLANTL_HO_THRESHOLD_DOWN == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent)))
    {
-      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Registered RSSI value larger than Current RSSI, and DOWN event, Send Notification"));
-      WLANTL_HSSerializeTlIndication(pAdapter, WLANTL_HO_THRESHOLD_DOWN, usrCtxt, crossCBFunction);
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Registered RSSI value larger than Current RSSI, and DOWN event, Send Notification"));
+      crossCBFunction(pAdapter, WLANTL_HO_THRESHOLD_DOWN, usrCtxt);
    }
    else if((VOS_FALSE == tlCtxt->isBMPS) &&
            (rssiValue < currentHO->historyRSSI) && (0 != currentHO->historyRSSI) &&
            ((WLANTL_HO_THRESHOLD_UP == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent)))
    {
-      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Registered RSSI value smaller than Current RSSI, and UP event, Send Notification"));
-      WLANTL_HSSerializeTlIndication(pAdapter, WLANTL_HO_THRESHOLD_UP, usrCtxt, crossCBFunction);
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Registered RSSI value smaller than Current RSSI, and UP event, Send Notification"));
+      crossCBFunction(pAdapter, WLANTL_HO_THRESHOLD_UP, usrCtxt);
    }
 
    if(VOS_TRUE == tlCtxt->isBMPS)
@@ -1442,7 +1427,7 @@
 
    if(0 == tlCtxt->hoSupport.currentHOState.numThreshold)
    {
-      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Empty list, can not remove"));
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Empty list, can not remove"));
       return VOS_STATUS_E_EMPTY;
    }
 
@@ -1450,14 +1435,14 @@
    currentHO = &(tlCtxt->hoSupport.currentHOState);
    hoSupport = &(tlCtxt->hoSupport);
 
-   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"DEL target RSSI %d, event %d", rssiValue, triggerEvent));
+   TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"DEL target RSSI %d, event %d", rssiValue, triggerEvent));
 
    if((VOS_TRUE == tlCtxt->isBMPS) && (0 < currentHO->regionNumber))
    {
       if(rssiValue >= hoSupport->registeredInd[currentHO->regionNumber - 1].rssiValue)
       {
          bmpsAbove = VOS_TRUE;
-         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Remove Threshold larger than current region"));
+         TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Remove Threshold larger than current region"));
       }
    }
 
@@ -1530,7 +1515,7 @@
 
    if((VOS_FALSE == tlCtxt->isBMPS) && (rssiValue >= currentHO->historyRSSI))
    {
-      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Removed Threshold above current RSSI level, old RN %d", currentHO->regionNumber));
+      TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Removed Threshold above current RSSI level, old RN %d", currentHO->regionNumber));
       if(0 < currentHO->regionNumber)
       {
          currentHO->regionNumber--;
@@ -1812,58 +1797,4 @@
 
    return status;   
 }
-
-/*==========================================================================
-
-   FUNCTION
-
-   DESCRIPTION 
-    
-   PARAMETERS 
-
-   RETURN VALUE
-
-============================================================================*/
-VOS_STATUS WLANTL_HSSerializeTlIndication
-(
-   v_PVOID_t   pAdapter,
-   v_U8_t      rssiNotification,
-   v_PVOID_t   pUserCtxt,
-   WLANTL_RSSICrossThresholdCBType cbFunction
-)
-{
-   VOS_STATUS       status = VOS_STATUS_SUCCESS;
-   vos_msg_t        msg;
-   WLANTL_TlIndicationReq *pMsg;
-
-   pMsg = vos_mem_malloc(sizeof(WLANTL_TlIndicationReq));
-   if ( NULL == pMsg ) 
-   {
-      VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "In %s, failed to allocate mem for req", __FUNCTION__);
-      return VOS_STATUS_E_NOMEM;
-   }
-
-   pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_RSSI_IND);
-   pMsg->msgLen = (tANI_U16)sizeof(WLANTL_TlIndicationReq);
-   pMsg->sessionId = 0;//for now just pass 0
-   pMsg->pAdapter = pAdapter;
-   pMsg->pUserCtxt = pUserCtxt;
-   pMsg->rssiNotification = rssiNotification;
-   pMsg->tlCallback = cbFunction;
-
-
-   msg.type = eWNI_SME_RSSI_IND;
-   msg.bodyptr = pMsg;
-   msg.reserved = 0;
-
-   if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
-   {
-       VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "In %s, failed to post msg to self", __FUNCTION__);
-       vos_mem_free(pMsg);
-       status = VOS_STATUS_E_FAILURE;
-   }
-
-   return status;   
-}
-
-#endif //FEATURE_WLAN_GEN6_ROAMING || WLAN_FEATURE_NEIGHBOR_ROAMING
+#endif //FEATURE_WLAN_GEN6_ROAMING
diff --git a/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_hosupport.h b/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_hosupport.h
index f8fa116..437fec1 100644
--- a/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_hosupport.h
+++ b/drivers/staging/prima/CORE/TL/src/wlan_qct_tl_hosupport.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -258,46 +258,6 @@
    v_PVOID_t                       pAdapter
 );
 
-/*==========================================================================
-
-   FUNCTION
-
-   DESCRIPTION 
-    
-   PARAMETERS 
-
-   RETURN VALUE
-
-============================================================================*/
-VOS_STATUS WLANTL_HSSerializeTlIndication
-(
-   v_PVOID_t   pAdapter,
-   v_U8_t      rssiNotification,
-   v_PVOID_t   pUserCtxt,
-   WLANTL_RSSICrossThresholdCBType cbFunction
-);
-
-/*==========================================================================
-
-   FUNCTION
-
-   DESCRIPTION 
-    
-   PARAMETERS 
-
-   RETURN VALUE
-
-============================================================================*/
-VOS_STATUS WLANTL_StatHandleTXFrame
-(
-   v_PVOID_t        pAdapter,
-   v_U8_t           STAid,
-   vos_pkt_t       *dataBuffer,
-   v_PVOID_t        pBDHeader
-#ifdef FEATURE_WLAN_INTEGRATED_SOC
-  ,WLANTL_MetaInfoType *txMetaInfo
-#endif /* FEATURE_WLAN_INTEGRATED_SOC */
-);
 
 #endif //FEATURE_WLAN_GEN6_ROAMING
 
diff --git a/drivers/staging/prima/CORE/TL/src/wlan_qct_tli.h b/drivers/staging/prima/CORE/TL/src/wlan_qct_tli.h
index 3089d95..4845331 100644
--- a/drivers/staging/prima/CORE/TL/src/wlan_qct_tli.h
+++ b/drivers/staging/prima/CORE/TL/src/wlan_qct_tli.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/TL/src/wlan_qct_tli_ba.h b/drivers/staging/prima/CORE/TL/src/wlan_qct_tli_ba.h
index 6da8d76..bdd6e0d 100644
--- a/drivers/staging/prima/CORE/TL/src/wlan_qct_tli_ba.h
+++ b/drivers/staging/prima/CORE/TL/src/wlan_qct_tli_ba.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/event_defs.h b/drivers/staging/prima/CORE/VOSS/inc/event_defs.h
index 06f21a5..5c16138 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/event_defs.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/event_defs.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/i_vos_diag_core_event.h b/drivers/staging/prima/CORE/VOSS/inc/i_vos_diag_core_event.h
index 5f0d235..0085505 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/i_vos_diag_core_event.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/i_vos_diag_core_event.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/i_vos_diag_core_log.h b/drivers/staging/prima/CORE/VOSS/inc/i_vos_diag_core_log.h
index 4ac2bae..90ac438 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/i_vos_diag_core_log.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/i_vos_diag_core_log.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/i_vos_event.h b/drivers/staging/prima/CORE/VOSS/inc/i_vos_event.h
index fe69219..a51d407 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/i_vos_event.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/i_vos_event.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/i_vos_list.h b/drivers/staging/prima/CORE/VOSS/inc/i_vos_list.h
index 672ebe2..603d323 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/i_vos_list.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/i_vos_list.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/i_vos_lock.h b/drivers/staging/prima/CORE/VOSS/inc/i_vos_lock.h
index b3e5ddb..a596c3c 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/i_vos_lock.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/i_vos_lock.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/i_vos_packet.h b/drivers/staging/prima/CORE/VOSS/inc/i_vos_packet.h
index bca6ac2..68251de 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/i_vos_packet.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/i_vos_packet.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -64,7 +64,7 @@
 
 // the number of Receive vos packets used exclusively for vos packet
 // allocations of type VOS_PKT_TYPE_RX_RAW
-#define VPKT_NUM_RX_RAW_PACKETS (1024)
+#define VPKT_NUM_RX_RAW_PACKETS (  512 )
 
 // the number of Transmit Management vos packets, used exclusively for
 // vos packet allocations of type VOS_PKT_TYPE_TX_802_11_MGMT
diff --git a/drivers/staging/prima/CORE/VOSS/inc/i_vos_timer.h b/drivers/staging/prima/CORE/VOSS/inc/i_vos_timer.h
index be22175..8388bfe 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/i_vos_timer.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/i_vos_timer.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/i_vos_trace.h b/drivers/staging/prima/CORE/VOSS/inc/i_vos_trace.h
index bdd72378..35d7301 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/i_vos_trace.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/i_vos_trace.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/i_vos_types.h b/drivers/staging/prima/CORE/VOSS/inc/i_vos_types.h
index 8d646e2..a039b58 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/i_vos_types.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/i_vos_types.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/log_codes.h b/drivers/staging/prima/CORE/VOSS/inc/log_codes.h
index 0fcce2b..2ee2a58 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/log_codes.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/log_codes.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_api.h b/drivers/staging/prima/CORE/VOSS/inc/vos_api.h
index b451716..df78f32 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_api.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_api.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -286,20 +286,4 @@
 */
 VOS_STATUS vos_wlanReInit(void);
 
-/**
-  @brief vos_wlanRestart() - This API will reload WLAN driver.
-
-  This function is called if driver detects any fatal state which 
-  can be recovered by a WLAN module reload ( Android framwork initiated ).
-  Note that this API will not initiate any RIVA subsystem restart.
-
-  @param
-       NONE
-  @return
-       VOS_STATUS_SUCCESS   - Operation completed successfully.
-       VOS_STATUS_E_FAILURE - Operation failed.
-
-*/
-VOS_STATUS vos_wlanRestart(void);
-
 #endif // if !defined __VOS_NVITEM_H
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_diag_core_event.h b/drivers/staging/prima/CORE/VOSS/inc/vos_diag_core_event.h
index 647cee2..959a264 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_diag_core_event.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_diag_core_event.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_diag_core_log.h b/drivers/staging/prima/CORE/VOSS/inc/vos_diag_core_log.h
index fddfb1e..21435b9 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_diag_core_log.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_diag_core_log.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_event.h b/drivers/staging/prima/CORE/VOSS/inc/vos_event.h
index de4bc23..515cefa 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_event.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_event.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_getBin.h b/drivers/staging/prima/CORE/VOSS/inc/vos_getBin.h
index 4228f30..a9854a2 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_getBin.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_getBin.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_list.h b/drivers/staging/prima/CORE/VOSS/inc/vos_list.h
index 59fcb08..17e3f0a 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_list.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_list.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_lock.h b/drivers/staging/prima/CORE/VOSS/inc/vos_lock.h
index d2d1292..3bfb3e3 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_lock.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_lock.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_memory.h b/drivers/staging/prima/CORE/VOSS/inc/vos_memory.h
index 7e596a5..d599a87 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_memory.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_memory.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_mq.h b/drivers/staging/prima/CORE/VOSS/inc/vos_mq.h
index 6fdc27f..5d997d4 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_mq.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_mq.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_nvitem.h b/drivers/staging/prima/CORE/VOSS/inc/vos_nvitem.h
index a503fd0..74b450c 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_nvitem.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_nvitem.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_pack_align.h b/drivers/staging/prima/CORE/VOSS/inc/vos_pack_align.h
index b746358..1cdceb6 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_pack_align.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_pack_align.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_packet.h b/drivers/staging/prima/CORE/VOSS/inc/vos_packet.h
index f5f4157..205a0fd 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_packet.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_packet.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_power.h b/drivers/staging/prima/CORE/VOSS/inc/vos_power.h
index bc83911..3cb2f2c 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_power.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_power.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_status.h b/drivers/staging/prima/CORE/VOSS/inc/vos_status.h
index 24154aa..4546c0d 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_status.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_status.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_threads.h b/drivers/staging/prima/CORE/VOSS/inc/vos_threads.h
index 617c5f8..e0173f4 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_threads.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_threads.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_timer.h b/drivers/staging/prima/CORE/VOSS/inc/vos_timer.h
index 6785623..bb9c02c 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_timer.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_timer.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_trace.h b/drivers/staging/prima/CORE/VOSS/inc/vos_trace.h
index f1cde91..e68bb50 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_trace.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_trace.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_types.h b/drivers/staging/prima/CORE/VOSS/inc/vos_types.h
index 4bcfc24..9937389 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_types.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_types.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/vos_utils.h b/drivers/staging/prima/CORE/VOSS/inc/vos_utils.h
index 8b64aee..ae10d13 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/vos_utils.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/vos_utils.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/inc/wlan_hdd_misc.h b/drivers/staging/prima/CORE/VOSS/inc/wlan_hdd_misc.h
index a219b09..f17abbc 100644
--- a/drivers/staging/prima/CORE/VOSS/inc/wlan_hdd_misc.h
+++ b/drivers/staging/prima/CORE/VOSS/inc/wlan_hdd_misc.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_api.c b/drivers/staging/prima/CORE/VOSS/src/vos_api.c
index e724f9c..8188bb2 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_api.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_api.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -963,7 +963,18 @@
         VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
          "%s: WDA_stop reporting other error", __func__ );
      }
-     WDA_stopFailed(vosContext);
+     /* if WDA stop failed, call WDA shutdown to cleanup WDA/WDI */
+     vosStatus = WDA_shutdown( vosContext, VOS_TRUE );
+     if (VOS_IS_STATUS_SUCCESS( vosStatus ) )
+     {
+        hdd_set_ssr_required( VOS_TRUE );
+     }
+     else
+     {
+        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
+                               "%s: Failed to shutdown WDA", __func__ );
+        VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
+     }
   }
 #endif
 
@@ -1061,30 +1072,12 @@
   }
 
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
-  if ( TRUE == WDA_needShutdown(vosContext ))
+  vosStatus = WDA_close( vosContext );
+  if (!VOS_IS_STATUS_SUCCESS(vosStatus))
   {
-     /* if WDA stop failed, call WDA shutdown to cleanup WDA/WDI */
-     vosStatus = WDA_shutdown( vosContext, VOS_TRUE );
-     if (VOS_IS_STATUS_SUCCESS( vosStatus ) )
-     {
-        hdd_set_ssr_required( VOS_TRUE );
-     }
-     else
-     {
-        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                               "%s: Failed to shutdown WDA", __func__ );
-        VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
-     }
-  } 
-  else 
-  {
-     vosStatus = WDA_close( vosContext );
-     if (!VOS_IS_STATUS_SUCCESS(vosStatus))
-     {
-        VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
-            "%s: Failed to close WDA", __func__);
-        VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
-     }
+     VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+         "%s: Failed to close WDA", __func__);
+     VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) );
   }
   
   /* Let DXE return packets in WDA_close and then free them here */
@@ -2379,56 +2372,3 @@
    vstatus = vos_watchdog_wlan_re_init();
    return vstatus;
 }
-/**
-  @brief vos_wlanRestart() - This API will reload WLAN driver.
-
-  This function is called if driver detects any fatal state which 
-  can be recovered by a WLAN module reload ( Android framwork initiated ).
-  Note that this API will not initiate any RIVA subsystem restart.
-
-  The function wlan_hdd_restart_driver protects against re-entrant calls.
-
-  @param
-       NONE
-  @return
-       VOS_STATUS_SUCCESS   - Operation completed successfully.
-       VOS_STATUS_E_FAILURE - Operation failed.
-       VOS_STATUS_E_EMPTY   - No configured interface
-       VOS_STATUS_E_ALREADY - Request already in progress
-
-
-*/
-VOS_STATUS vos_wlanRestart(void)
-{
-   VOS_STATUS vstatus;
-   hdd_context_t *pHddCtx = NULL;
-   v_CONTEXT_t pVosContext        = NULL;
-
-   /* Check whether driver load unload is in progress */
-   if(vos_is_load_unload_in_progress( VOS_MODULE_ID_VOSS, NULL)) 
-   {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
-               "%s: Driver load/unload is in progress, retry later.", __func__);
-      return VOS_STATUS_E_AGAIN;
-   }
-
-   /* Get the Global VOSS Context */
-   pVosContext = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL);
-   if(!pVosContext) {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, 
-               "%s: Global VOS context is Null", __func__);
-      return VOS_STATUS_E_FAILURE;
-   }
-    
-   /* Get the HDD context */
-   pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext );
-   if(!pHddCtx) {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, 
-               "%s: HDD context is Null", __func__);
-      return VOS_STATUS_E_FAILURE;
-   }
-
-   /* Reload the driver */
-   vstatus = wlan_hdd_restart_driver(pHddCtx);
-   return vstatus;
-}
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_diag.c b/drivers/staging/prima/CORE/VOSS/src/vos_diag.c
index a4f2813..3cd2bfb 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_diag.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_diag.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_event.c b/drivers/staging/prima/CORE/VOSS/src/vos_event.c
index 662f28b..cb8296d 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_event.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_event.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -422,11 +422,12 @@
    {
       long ret;
       ret =
-         wait_for_completion_timeout(&event->complete,
+         wait_for_completion_interruptible_timeout(&event->complete,
                                                    msecs_to_jiffies(timeout));
       if ( 0 >= ret )
       {
-        return VOS_STATUS_E_TIMEOUT;
+         // 0 means timed out, negative means interrupted
+         return VOS_STATUS_E_TIMEOUT;
       }
    }
    else
@@ -435,8 +436,8 @@
       ret = wait_for_completion_interruptible(&event->complete);
       if ( 0 != ret )
       {
-       	// negative means interrupted
-        return VOS_STATUS_E_TIMEOUT;
+         // negative means interrupted
+         return VOS_STATUS_E_TIMEOUT;
       }
    }
 
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_getBin.c b/drivers/staging/prima/CORE/VOSS/src/vos_getBin.c
index 605c230..557a54a 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_getBin.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_getBin.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -23,9 +23,9 @@
   vos_getBin.c
   \brief
   Description...
-   Copyright (c) 2012 Qualcomm Atheros, Inc.
-   All Rights Reserved.
-   Qualcomm Atheros Confidential and Proprietary.
+               Copyright 2008 (c) Qualcomm, Incorporated.
+               All Rights Reserved.
+               Qualcomm Confidential and Proprietary.
   ==============================================================================*/
 /* $HEADER$ */
 /**-----------------------------------------------------------------------------
@@ -163,12 +163,10 @@
     if (NULL != pVosContext)
     {
        pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
-       if (NULL != pHddCtx)
+
+       for (i=0; i < VOS_MAX_NO_OF_MODE; i++)
        {
-          for (i=0; i < VOS_MAX_NO_OF_MODE; i++)
-          {
-             j += pHddCtx->no_of_sessions[i];
-          }
+          j += pHddCtx->no_of_sessions[i];
        }
     }
 
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_list.c b/drivers/staging/prima/CORE/VOSS/src/vos_list.c
index 51adbab..6696e79 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_list.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_list.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -257,7 +257,7 @@
 
    if ( list_empty( &pList->anchor ) )
    {
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
                 "%s: list empty", __FUNCTION__);
       mutex_unlock(&pList->lock);
       return VOS_STATUS_E_EMPTY;
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_lock.c b/drivers/staging/prima/CORE/VOSS/src/vos_lock.c
index 18678f5..837ef05 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_lock.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_lock.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -200,9 +200,8 @@
          return VOS_STATUS_SUCCESS;
       }
       // Acquire a Lock
-      mutex_lock( &lock->m_lock ); 
-      rc = mutex_is_locked( &lock->m_lock );
-      if (rc == 0) 
+      rc = mutex_lock_interruptible( &lock->m_lock ); 
+      if (rc) 
       {
          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                 "%s: unable to lock mutex (rc = %d)", __FUNCTION__, rc);
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_memory.c b/drivers/staging/prima/CORE/VOSS/src/vos_memory.c
index a01dc91..7080177 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_memory.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_memory.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_mq.c b/drivers/staging/prima/CORE/VOSS/src/vos_mq.c
index d6ffd01..c0dc94e 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_mq.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_mq.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_nvitem.c b/drivers/staging/prima/CORE/VOSS/src/vos_nvitem.c
index 42d6f79..9d247a3 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_nvitem.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_nvitem.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -52,9 +52,6 @@
 #define MAX_COUNTRY_COUNT        300
 //To be removed when NV support is fully functional
 #define VOS_HARD_CODED_MAC    {0, 0x0a, 0xf5, 4, 5, 6}
-
-#define DEFAULT_NV_VALIDITY_BITMAP 0xFFFFFFFF
-
 /*----------------------------------------------------------------------------
  * Type Declarations
  * -------------------------------------------------------------------------*/
@@ -87,260 +84,260 @@
 {
     254,
     {
-        { REGDOMAIN_FCC,     {'U', 'S'}},  //USA - must be the first country code
-        { REGDOMAIN_ETSI,    {'A', 'D'}},  //ANDORRA
-        { REGDOMAIN_ETSI,    {'A', 'E'}},  //UAE
-        { REGDOMAIN_N_AMER_EXC_FCC, {'A', 'F'}},  //AFGHANISTAN
-        { REGDOMAIN_WORLD,   {'A', 'G'}},  //ANTIGUA AND BARBUDA
-        { REGDOMAIN_FCC,     {'A', 'I'}},  //ANGUILLA
-        { REGDOMAIN_NO_5GHZ, {'A', 'L'}},  //ALBANIA
-        { REGDOMAIN_N_AMER_EXC_FCC, {'A', 'M'}},  //ARMENIA
-        { REGDOMAIN_ETSI,    {'A', 'N'}},  //NETHERLANDS ANTILLES
-        { REGDOMAIN_NO_5GHZ, {'A', 'O'}},  //ANGOLA
-        { REGDOMAIN_WORLD,   {'A', 'Q'}},  //ANTARCTICA
-        { REGDOMAIN_WORLD,   {'A', 'R'}},  //ARGENTINA
-        { REGDOMAIN_FCC,     {'A', 'S'}},  //AMERICAN SOMOA
-        { REGDOMAIN_ETSI,    {'A', 'T'}},  //AUSTRIA
-        { REGDOMAIN_APAC,    {'A', 'U'}},  //AUSTRALIA
-        { REGDOMAIN_ETSI,    {'A', 'W'}},  //ARUBA
-        { REGDOMAIN_WORLD,   {'A', 'X'}},  //ALAND ISLANDS
-        { REGDOMAIN_N_AMER_EXC_FCC, {'A', 'Z'}},  //AZERBAIJAN
-        { REGDOMAIN_ETSI,    {'B', 'A'}},  //BOSNIA AND HERZEGOVINA
-        { REGDOMAIN_APAC,    {'B', 'B'}},  //BARBADOS
-        { REGDOMAIN_NO_5GHZ, {'B', 'D'}},  //BANGLADESH
-        { REGDOMAIN_ETSI,    {'B', 'E'}},  //BELGIUM
-        { REGDOMAIN_HI_5GHZ, {'B', 'F'}},  //BURKINA FASO
-        { REGDOMAIN_ETSI,    {'B', 'G'}},  //BULGARIA
-        { REGDOMAIN_APAC,    {'B', 'H'}},  //BAHRAIN
-        { REGDOMAIN_NO_5GHZ, {'B', 'I'}},  //BURUNDI
-        { REGDOMAIN_NO_5GHZ, {'B', 'J'}},  //BENIN
-        { REGDOMAIN_FCC,     {'B', 'M'}},  //BERMUDA
-        { REGDOMAIN_APAC,    {'B', 'N'}},  //BRUNEI DARUSSALAM
-        { REGDOMAIN_HI_5GHZ, {'B', 'O'}},  //BOLIVIA
-        { REGDOMAIN_WORLD,   {'B', 'R'}},  //BRAZIL
-        { REGDOMAIN_APAC,    {'B', 'S'}},  //BAHAMAS
-        { REGDOMAIN_NO_5GHZ, {'B', 'T'}},  //BHUTAN
-        { REGDOMAIN_WORLD,   {'B', 'V'}},  //BOUVET ISLAND
-        { REGDOMAIN_ETSI,    {'B', 'W'}},  //BOTSWANA
-        { REGDOMAIN_ETSI,    {'B', 'Y'}},  //BELARUS
-        { REGDOMAIN_HI_5GHZ, {'B', 'Z'}},  //BELIZE
-        { REGDOMAIN_FCC,     {'C', 'A'}},  //CANADA
-        { REGDOMAIN_WORLD,   {'C', 'C'}},  //COCOS (KEELING) ISLANDS
-        { REGDOMAIN_NO_5GHZ, {'C', 'D'}},  //CONGO, THE DEMOCRATIC REPUBLIC OF THE
-        { REGDOMAIN_NO_5GHZ, {'C', 'F'}},  //CENTRAL AFRICAN REPUBLIC
-        { REGDOMAIN_NO_5GHZ, {'C', 'G'}},  //CONGO
-        { REGDOMAIN_ETSI,    {'C', 'H'}},  //SWITZERLAND
-        { REGDOMAIN_NO_5GHZ, {'C', 'I'}},  //COTE D'IVOIRE
-        { REGDOMAIN_WORLD,   {'C', 'K'}},  //COOK ISLANDS
-        { REGDOMAIN_APAC,    {'C', 'L'}},  //CHILE
-        { REGDOMAIN_NO_5GHZ, {'C', 'M'}},  //CAMEROON
-        { REGDOMAIN_HI_5GHZ, {'C', 'N'}},  //CHINA
-        { REGDOMAIN_APAC,    {'C', 'O'}},  //COLOMBIA
-        { REGDOMAIN_APAC,    {'C', 'R'}},  //COSTA RICA
-        { REGDOMAIN_NO_5GHZ, {'C', 'U'}},  //CUBA
-        { REGDOMAIN_ETSI,    {'C', 'V'}},  //CAPE VERDE
-        { REGDOMAIN_WORLD,   {'C', 'X'}},  //CHRISTMAS ISLAND
-        { REGDOMAIN_ETSI,    {'C', 'Y'}},  //CYPRUS
-        { REGDOMAIN_ETSI,    {'C', 'Z'}},  //CZECH REPUBLIC
-        { REGDOMAIN_ETSI,    {'D', 'E'}},  //GERMANY
-        { REGDOMAIN_NO_5GHZ, {'D', 'J'}},  //DJIBOUTI
-        { REGDOMAIN_ETSI,    {'D', 'K'}},  //DENMARK
-        { REGDOMAIN_WORLD,   {'D', 'M'}},  //DOMINICA
-        { REGDOMAIN_APAC,    {'D', 'O'}},  //DOMINICAN REPUBLIC
-        { REGDOMAIN_NO_5GHZ, {'D', 'Z'}},  //ALGERIA
-        { REGDOMAIN_APAC,    {'E', 'C'}},  //ECUADOR
-        { REGDOMAIN_ETSI,    {'E', 'E'}},  //ESTONIA
-        { REGDOMAIN_N_AMER_EXC_FCC, {'E', 'G'}},  //EGYPT
-        { REGDOMAIN_WORLD,   {'E', 'H'}},  //WESTERN SAHARA
-        { REGDOMAIN_NO_5GHZ, {'E', 'R'}},  //ERITREA
-        { REGDOMAIN_ETSI,    {'E', 'S'}},  //SPAIN
-        { REGDOMAIN_ETSI,    {'E', 'T'}},  //ETHIOPIA
-        { REGDOMAIN_ETSI,    {'E', 'U'}},  //Europe (SSGFI)
-        { REGDOMAIN_ETSI,    {'F', 'I'}},  //FINLAND
-        { REGDOMAIN_NO_5GHZ, {'F', 'J'}},  //FIJI
-        { REGDOMAIN_WORLD,   {'F', 'K'}},  //FALKLAND ISLANDS (MALVINAS)
-        { REGDOMAIN_WORLD,   {'F', 'M'}},  //MICRONESIA, FEDERATED STATES OF
-        { REGDOMAIN_WORLD,   {'F', 'O'}},  //FAROE ISLANDS
-        { REGDOMAIN_ETSI,    {'F', 'R'}},  //FRANCE
-        { REGDOMAIN_NO_5GHZ, {'G', 'A'}},  //GABON
-        { REGDOMAIN_ETSI,    {'G', 'B'}},  //UNITED KINGDOM
-        { REGDOMAIN_WORLD,   {'G', 'D'}},  //GRENADA
-        { REGDOMAIN_ETSI,    {'G', 'E'}},  //GEORGIA
-        { REGDOMAIN_ETSI,    {'G', 'F'}},  //FRENCH GUIANA
-        { REGDOMAIN_WORLD,   {'G', 'G'}},  //GUERNSEY
-        { REGDOMAIN_WORLD,   {'G', 'H'}},  //GHANA
-        { REGDOMAIN_WORLD,   {'G', 'I'}},  //GIBRALTAR
-        { REGDOMAIN_ETSI,    {'G', 'L'}},  //GREENLAND
-        { REGDOMAIN_NO_5GHZ, {'G', 'M'}},  //GAMBIA
-        { REGDOMAIN_NO_5GHZ, {'G', 'N'}},  //GUINEA
-        { REGDOMAIN_ETSI,    {'G', 'P'}},  //GUADELOUPE
-        { REGDOMAIN_NO_5GHZ, {'G', 'Q'}},  //EQUATORIAL GUINEA
-        { REGDOMAIN_ETSI,    {'G', 'R'}},  //GREECE
-        { REGDOMAIN_WORLD,   {'G', 'S'}},  //SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS
-        { REGDOMAIN_APAC,    {'G', 'T'}},  //GUATEMALA
-        { REGDOMAIN_APAC,    {'G', 'U'}},  //GUAM
-        { REGDOMAIN_NO_5GHZ, {'G', 'W'}},  //GUINEA-BISSAU
-        { REGDOMAIN_HI_5GHZ, {'G', 'Y'}},  //GUYANA
-        { REGDOMAIN_WORLD,   {'H', 'K'}},  //HONGKONG
-        { REGDOMAIN_WORLD,   {'H', 'M'}},  //HEARD ISLAND AND MCDONALD ISLANDS
-        { REGDOMAIN_WORLD,   {'H', 'N'}},  //HONDURAS
-        { REGDOMAIN_ETSI,    {'H', 'R'}},  //CROATIA
-        { REGDOMAIN_ETSI,    {'H', 'T'}},  //HAITI
-        { REGDOMAIN_ETSI,    {'H', 'U'}},  //HUNGARY
-        { REGDOMAIN_HI_5GHZ, {'I', 'D'}},  //INDONESIA
-        { REGDOMAIN_ETSI,    {'I', 'E'}},  //IRELAND
-        { REGDOMAIN_NO_5GHZ, {'I', 'L'}},  //ISRAEL
-        { REGDOMAIN_WORLD,   {'I', 'M'}},  //ISLE OF MAN
-        { REGDOMAIN_APAC,    {'I', 'N'}},  //INDIA
-        { REGDOMAIN_WORLD,   {'I', 'O'}},  //BRITISH INDIAN OCEAN TERRITORY
-        { REGDOMAIN_NO_5GHZ, {'I', 'Q'}},  //IRAQ
-        { REGDOMAIN_HI_5GHZ, {'I', 'R'}},  //IRAN, ISLAMIC REPUBLIC OF
-        { REGDOMAIN_ETSI,    {'I', 'S'}},  //ICELAND
-        { REGDOMAIN_ETSI,    {'I', 'T'}},  //ITALY
-        { REGDOMAIN_JAPAN,   {'J', '1'}},  //Japan alternate 1
-        { REGDOMAIN_JAPAN,   {'J', '2'}},  //Japan alternate 2
-        { REGDOMAIN_JAPAN,   {'J', '3'}},  //Japan alternate 3
-        { REGDOMAIN_JAPAN,   {'J', '4'}},  //Japan alternate 4
-        { REGDOMAIN_JAPAN,   {'J', '5'}},  //Japan alternate 5
-        { REGDOMAIN_WORLD,   {'J', 'E'}},  //JERSEY
-        { REGDOMAIN_WORLD,   {'J', 'M'}},  //JAMAICA
-        { REGDOMAIN_WORLD,   {'J', 'O'}},  //JORDAN
-        { REGDOMAIN_JAPAN,   {'J', 'P'}},  //JAPAN
-        { REGDOMAIN_KOREA,   {'K', '1'}},  //Korea alternate 1
-        { REGDOMAIN_KOREA,   {'K', '2'}},  //Korea alternate 2
-        { REGDOMAIN_KOREA,   {'K', '3'}},  //Korea alternate 3
-        { REGDOMAIN_KOREA,   {'K', '4'}},  //Korea alternate 4
-        { REGDOMAIN_HI_5GHZ, {'K', 'E'}},  //KENYA
-        { REGDOMAIN_NO_5GHZ, {'K', 'G'}},  //KYRGYZSTAN
-        { REGDOMAIN_ETSI,    {'K', 'H'}},  //CAMBODIA
-        { REGDOMAIN_WORLD,   {'K', 'I'}},  //KIRIBATI
-        { REGDOMAIN_NO_5GHZ, {'K', 'M'}},  //COMOROS
-        { REGDOMAIN_WORLD,   {'K', 'N'}},  //SAINT KITTS AND NEVIS
-        { REGDOMAIN_WORLD,   {'K', 'P'}},  //KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF
-        { REGDOMAIN_KOREA,   {'K', 'R'}},  //KOREA, REPUBLIC OF
-        { REGDOMAIN_N_AMER_EXC_FCC, {'K', 'W'}},  //KUWAIT
-        { REGDOMAIN_FCC,     {'K', 'Y'}},  //CAYMAN ISLANDS
-        { REGDOMAIN_NO_5GHZ, {'K', 'Z'}},  //KAZAKHSTAN
-        { REGDOMAIN_WORLD,   {'L', 'A'}},  //LAO PEOPLE'S DEMOCRATIC REPUBLIC
-        { REGDOMAIN_HI_5GHZ, {'L', 'B'}},  //LEBANON
-        { REGDOMAIN_WORLD,   {'L', 'C'}},  //SAINT LUCIA
-        { REGDOMAIN_ETSI,    {'L', 'I'}},  //LIECHTENSTEIN
-        { REGDOMAIN_WORLD,   {'L', 'K'}},  //SRI LANKA
-        { REGDOMAIN_WORLD,   {'L', 'R'}},  //LIBERIA
-        { REGDOMAIN_ETSI,    {'L', 'S'}},  //LESOTHO
-        { REGDOMAIN_ETSI,    {'L', 'T'}},  //LITHUANIA
-        { REGDOMAIN_ETSI,    {'L', 'U'}},  //LUXEMBOURG
-        { REGDOMAIN_ETSI,    {'L', 'V'}},  //LATVIA
-        { REGDOMAIN_NO_5GHZ, {'L', 'Y'}},  //LIBYAN ARAB JAMAHIRIYA
-        { REGDOMAIN_NO_5GHZ, {'M', 'A'}},  //MOROCCO
-        { REGDOMAIN_N_AMER_EXC_FCC, {'M', 'C'}},  //MONACO
-        { REGDOMAIN_ETSI,    {'M', 'D'}},  //MOLDOVA, REPUBLIC OF
-        { REGDOMAIN_ETSI,    {'M', 'E'}},  //MONTENEGRO
-        { REGDOMAIN_NO_5GHZ, {'M', 'G'}},  //MADAGASCAR
-        { REGDOMAIN_WORLD,   {'M', 'H'}},  //MARSHALL ISLANDS
-        { REGDOMAIN_ETSI,    {'M', 'K'}},  //MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF
-        { REGDOMAIN_NO_5GHZ, {'M', 'L'}},  //MALI
-        { REGDOMAIN_WORLD,   {'M', 'M'}},  //MYANMAR
-        { REGDOMAIN_NO_5GHZ, {'M', 'N'}},  //MONGOLIA
-        { REGDOMAIN_APAC,    {'M', 'O'}},  //MACAO
-        { REGDOMAIN_FCC,     {'M', 'P'}},  //NORTHERN MARIANA ISLANDS
-        { REGDOMAIN_ETSI,    {'M', 'Q'}},  //MARTINIQUE
-        { REGDOMAIN_ETSI,    {'M', 'R'}},  //MAURITANIA
-        { REGDOMAIN_ETSI,    {'M', 'S'}},  //MONTSERRAT
-        { REGDOMAIN_ETSI,    {'M', 'T'}},  //MALTA
-        { REGDOMAIN_ETSI,    {'M', 'U'}},  //MAURITIUS
-        { REGDOMAIN_APAC,    {'M', 'V'}},  //MALDIVES
-        { REGDOMAIN_HI_5GHZ, {'M', 'W'}},  //MALAWI
-        { REGDOMAIN_APAC,    {'M', 'X'}},  //MEXICO
-        { REGDOMAIN_APAC,    {'M', 'Y'}},  //MALAYSIA
-        { REGDOMAIN_WORLD,   {'M', 'Z'}},  //MOZAMBIQUE
-        { REGDOMAIN_WORLD,   {'N', 'A'}},  //NAMIBIA
-        { REGDOMAIN_NO_5GHZ, {'N', 'C'}},  //NEW CALEDONIA
-        { REGDOMAIN_WORLD,   {'N', 'E'}},  //NIGER
-        { REGDOMAIN_WORLD,   {'N', 'F'}},  //NORFOLD ISLAND
-        { REGDOMAIN_WORLD,   {'N', 'G'}},  //NIGERIA
-        { REGDOMAIN_WORLD,   {'N', 'I'}},  //NICARAGUA
-        { REGDOMAIN_ETSI,    {'N', 'L'}},  //NETHERLANDS
-        { REGDOMAIN_ETSI,    {'N', 'O'}},  //NORWAY
-        { REGDOMAIN_HI_5GHZ, {'N', 'P'}},  //NEPAL
-        { REGDOMAIN_NO_5GHZ, {'N', 'R'}},  //NAURU
-        { REGDOMAIN_WORLD,   {'N', 'U'}},  //NIUE
-        { REGDOMAIN_APAC,    {'N', 'Z'}},  //NEW ZEALAND
-        { REGDOMAIN_WORLD,   {'O', 'M'}},  //OMAN
-        { REGDOMAIN_APAC,    {'P', 'A'}},  //PANAMA
-        { REGDOMAIN_HI_5GHZ, {'P', 'E'}},  //PERU
-        { REGDOMAIN_ETSI,    {'P', 'F'}},  //FRENCH POLYNESIA
-        { REGDOMAIN_APAC,    {'P', 'G'}},  //PAPUA NEW GUINEA
-        { REGDOMAIN_HI_5GHZ, {'P', 'H'}},  //PHILIPPINES
-        { REGDOMAIN_HI_5GHZ, {'P', 'K'}},  //PAKISTAN
-        { REGDOMAIN_ETSI,    {'P', 'L'}},  //POLAND
-        { REGDOMAIN_WORLD,   {'P', 'M'}},  //SAINT PIERRE AND MIQUELON
-        { REGDOMAIN_WORLD,   {'P', 'N'}},  //WORLDPITCAIRN
-        { REGDOMAIN_FCC,     {'P', 'R'}},  //PUERTO RICO
-        { REGDOMAIN_WORLD,   {'P', 'S'}},  //PALESTINIAN TERRITORY, OCCUPIED
-        { REGDOMAIN_ETSI,    {'P', 'T'}},  //PORTUGAL
-        { REGDOMAIN_WORLD,   {'P', 'W'}},  //PALAU
-        { REGDOMAIN_WORLD,   {'P', 'Y'}},  //PARAGUAY
-        { REGDOMAIN_HI_5GHZ, {'Q', 'A'}},  //QATAR
-        { REGDOMAIN_ETSI,    {'R', 'E'}},  //REUNION
-        { REGDOMAIN_ETSI,    {'R', 'O'}},  //ROMANIA
-        { REGDOMAIN_ETSI,    {'R', 'S'}},  //SERBIA
-        { REGDOMAIN_HI_5GHZ, {'R', 'U'}},  //RUSSIA
-        { REGDOMAIN_HI_5GHZ, {'R', 'W'}},  //RWANDA
-        { REGDOMAIN_APAC,    {'S', 'A'}},  //SAUDI ARABIA
-        { REGDOMAIN_NO_5GHZ, {'S', 'B'}},  //SOLOMON ISLANDS
-        { REGDOMAIN_NO_5GHZ, {'S', 'C'}},  //SEYCHELLES
-        { REGDOMAIN_WORLD,   {'S', 'D'}},  //SUDAN
-        { REGDOMAIN_ETSI,    {'S', 'E'}},  //SWEDEN
-        { REGDOMAIN_APAC,    {'S', 'G'}},  //SINGAPORE
-        { REGDOMAIN_WORLD,   {'S', 'H'}},  //SAINT HELENA
-        { REGDOMAIN_ETSI,    {'S', 'I'}},  //SLOVENNIA
-        { REGDOMAIN_WORLD,   {'S', 'J'}},  //SVALBARD AND JAN MAYEN
-        { REGDOMAIN_ETSI,    {'S', 'K'}},  //SLOVAKIA
-        { REGDOMAIN_WORLD,   {'S', 'L'}},  //SIERRA LEONE
-        { REGDOMAIN_ETSI,    {'S', 'M'}},  //SAN MARINO
-        { REGDOMAIN_ETSI,    {'S', 'N'}},  //SENEGAL
-        { REGDOMAIN_NO_5GHZ, {'S', 'O'}},  //SOMALIA
-        { REGDOMAIN_NO_5GHZ, {'S', 'R'}},  //SURINAME
-        { REGDOMAIN_WORLD,   {'S', 'T'}},  //SAO TOME AND PRINCIPE
-        { REGDOMAIN_APAC,    {'S', 'V'}},  //EL SALVADOR
-        { REGDOMAIN_NO_5GHZ, {'S', 'Y'}},  //SYRIAN ARAB REPUBLIC
-        { REGDOMAIN_NO_5GHZ, {'S', 'Z'}},  //SWAZILAND
-        { REGDOMAIN_ETSI,    {'T', 'C'}},  //TURKS AND CAICOS ISLANDS
-        { REGDOMAIN_NO_5GHZ, {'T', 'D'}},  //CHAD
-        { REGDOMAIN_ETSI,    {'T', 'F'}},  //FRENCH SOUTHERN TERRITORIES
-        { REGDOMAIN_NO_5GHZ, {'T', 'G'}},  //TOGO
-        { REGDOMAIN_WORLD,   {'T', 'H'}},  //THAILAND
-        { REGDOMAIN_NO_5GHZ, {'T', 'J'}},  //TAJIKISTAN
-        { REGDOMAIN_WORLD,   {'T', 'K'}},  //TOKELAU
-        { REGDOMAIN_WORLD,   {'T', 'L'}},  //TIMOR-LESTE
-        { REGDOMAIN_NO_5GHZ, {'T', 'M'}},  //TURKMENISTAN
-        { REGDOMAIN_N_AMER_EXC_FCC, {'T', 'N'}},  //TUNISIA
-        { REGDOMAIN_NO_5GHZ, {'T', 'O'}},  //TONGA
-        { REGDOMAIN_N_AMER_EXC_FCC, {'T', 'R'}},  //TURKEY
-        { REGDOMAIN_WORLD,   {'T', 'T'}},  //TRINIDAD AND TOBAGO
-        { REGDOMAIN_NO_5GHZ, {'T', 'V'}},  //TUVALU
-        { REGDOMAIN_WORLD,   {'T', 'W'}},  //TAIWAN, PROVINCE OF CHINA
-        { REGDOMAIN_HI_5GHZ, {'T', 'Z'}},  //TANZANIA, UNITED REPUBLIC OF
-        { REGDOMAIN_NO_5GHZ, {'U', 'A'}},  //UKRAINE
-        { REGDOMAIN_WORLD,   {'U', 'G'}},  //UGANDA
-        { REGDOMAIN_FCC,     {'U', 'M'}},  //UNITED STATES MINOR OUTLYING ISLANDS
-        { REGDOMAIN_WORLD,   {'U', 'Y'}},  //URUGUAY
-        { REGDOMAIN_WORLD,   {'U', 'Z'}},  //UZBEKISTAN
-        { REGDOMAIN_ETSI,    {'V', 'A'}},  //HOLY SEE (VATICAN CITY STATE)
-        { REGDOMAIN_WORLD,   {'V', 'C'}},  //SAINT VINCENT AND THE GRENADINES
-        { REGDOMAIN_HI_5GHZ, {'V', 'E'}},  //VENEZUELA
-        { REGDOMAIN_ETSI,    {'V', 'G'}},  //VIRGIN ISLANDS, BRITISH
-        { REGDOMAIN_FCC,     {'V', 'I'}},  //VIRGIN ISLANDS, US
-        { REGDOMAIN_N_AMER_EXC_FCC, {'V', 'N'}},  //VIET NAM
-        { REGDOMAIN_NO_5GHZ, {'V', 'U'}},  //VANUATU
-        { REGDOMAIN_WORLD,   {'W', 'F'}},  //WALLIS AND FUTUNA
-        { REGDOMAIN_N_AMER_EXC_FCC, {'W', 'S'}},  //SOMOA
-        { REGDOMAIN_NO_5GHZ, {'Y', 'E'}},  //YEMEN
-        { REGDOMAIN_ETSI,    {'Y', 'T'}},  //MAYOTTE
-        { REGDOMAIN_WORLD,   {'Z', 'A'}},  //SOUTH AFRICA
-        { REGDOMAIN_APAC,    {'Z', 'M'}},  //ZAMBIA
-        { REGDOMAIN_NO_5GHZ, {'Z', 'W'}},  //ZIMBABWE
+        { REGDOMAIN_FCC, {'U', 'S'}},       // USA - must be the first country code
+        { REGDOMAIN_WORLD, {'A', 'D'}},     //ANDORRA
+        { REGDOMAIN_WORLD,{'A', 'E'}},   //UAE
+        { REGDOMAIN_WORLD, {'A', 'F'}},     //AFGHANISTAN
+        { REGDOMAIN_NO_5GHZ, {'A', 'G'}},     //ANTIGUA AND BARBUDA
+        { REGDOMAIN_NO_5GHZ, {'A', 'I'}},     //ANGUILLA
+        { REGDOMAIN_WORLD, {'A', 'L'}},     //ALBANIA
+        { REGDOMAIN_NO_5GHZ, {'A', 'M'}},     //ARMENIA
+        { REGDOMAIN_WORLD, { 'A', 'N'}},     //NETHERLANDS ANTILLES
+        { REGDOMAIN_NO_5GHZ, { 'A', 'O'}},     //ANGOLA
+        { REGDOMAIN_WORLD, { 'A', 'Q'}},     //ANTARCTICA
+        { REGDOMAIN_HI_5GHZ,{ 'A', 'R'}},   //ARGENTINA
+        { REGDOMAIN_FCC, { 'A', 'S'}},     //AMERICAN SOMOA
+        { REGDOMAIN_ETSI, { 'A', 'T'}},      //AUSTRIA
+        { REGDOMAIN_APAC, { 'A', 'U'}},      //AUSTRALIA
+        { REGDOMAIN_NO_5GHZ, { 'A', 'W'}},     //ARUBA
+        { REGDOMAIN_WORLD, { 'A', 'X'}},     //ALAND ISLANDS
+        { REGDOMAIN_NO_5GHZ, { 'A', 'Z'}},     //AZERBAIJAN
+        { REGDOMAIN_WORLD, { 'B', 'A'}},     //BOSNIA AND HERZEGOVINA
+        { REGDOMAIN_WORLD, { 'B', 'B'}},     //BARBADOS
+        { REGDOMAIN_WORLD, { 'B', 'D'}},     //BANGLADESH
+        { REGDOMAIN_ETSI,  {'B', 'E'}},      //BELGIUM
+        { REGDOMAIN_WORLD, { 'B', 'F'}},     //BURKINA FASO
+        { REGDOMAIN_HI_5GHZ, {'B', 'G'}},      //BULGARIA
+        { REGDOMAIN_WORLD, { 'B', 'H'}},     //BAHRAIN
+        { REGDOMAIN_WORLD, { 'B', 'I'}},     //BURUNDI
+        { REGDOMAIN_WORLD, { 'B', 'J'}},     //BENIN
+        { REGDOMAIN_ETSI, { 'B', 'M'}},     //BERMUDA
+        { REGDOMAIN_WORLD, { 'B', 'N'}},     //BRUNEI DARUSSALAM
+        { REGDOMAIN_WORLD,{ 'B', 'O'}},   //BOLIVIA
+        { REGDOMAIN_WORLD, {'B', 'R'}},       //BRAZIL
+        { REGDOMAIN_WORLD, { 'B', 'S'}},     //BAHAMAS
+        { REGDOMAIN_WORLD, { 'B', 'T'}},     //BHUTAN
+        { REGDOMAIN_WORLD, { 'B', 'V'}},     //BOUVET ISLAND
+        { REGDOMAIN_WORLD, { 'B', 'W'}},     //BOTSWANA
+        { REGDOMAIN_WORLD, { 'B', 'Y'}},     //BELARUS
+        { REGDOMAIN_WORLD, { 'B', 'Z'}},     //BELIZE
+        { REGDOMAIN_FCC, {'C', 'A'}},       //CANADA
+        { REGDOMAIN_WORLD, { 'C', 'C'}},     //COCOS (KEELING) ISLANDS
+        { REGDOMAIN_WORLD, { 'C', 'D'}},     //CONGO, THE DEMOCRATIC REPUBLIC OF THE
+        { REGDOMAIN_WORLD, { 'C', 'F'}},     //CENTRAL AFRICAN REPUBLIC
+        { REGDOMAIN_WORLD, { 'C', 'G'}},     //CONGO
+        { REGDOMAIN_ETSI, {'C', 'H'}},      //SWITZERLAND
+        { REGDOMAIN_WORLD, { 'C', 'I'}},     //COTE D'IVOIRE
+        { REGDOMAIN_WORLD, { 'C', 'K'}},     //COOK ISLANDS
+        { REGDOMAIN_WORLD, {'C', 'L'}},       //CHILE
+        { REGDOMAIN_WORLD, { 'C', 'M'}},     //CAMEROON
+        { REGDOMAIN_HI_5GHZ, {'C', 'N'}},   //CHINA
+        { REGDOMAIN_WORLD, {'C', 'O'}},       //COLOMBIA
+        { REGDOMAIN_WORLD, {'C', 'R'}},       //COSTA RICA
+        { REGDOMAIN_WORLD, { 'C', 'U'}},     //CUBA
+        { REGDOMAIN_WORLD, { 'C', 'V'}},     //CAPE VERDE
+        { REGDOMAIN_WORLD, { 'C', 'X'}},     //CHRISTMAS ISLAND
+        { REGDOMAIN_WORLD, {'C', 'Y'}},      //CYPRUS
+        { REGDOMAIN_HI_5GHZ, {'C', 'Z'}},      //CZECH REPUBLIC
+        { REGDOMAIN_ETSI, {'D', 'E'}},      //GERMANY
+        { REGDOMAIN_WORLD, { 'D', 'J'}},     //DJIBOUTI
+        { REGDOMAIN_ETSI, {'D', 'K'}},      //DENMARK
+        { REGDOMAIN_WORLD, { 'D', 'M'}},     //DOMINICA
+        { REGDOMAIN_NO_5GHZ,{ 'D', 'O'}},   //DOMINICAN REPUBLIC
+        { REGDOMAIN_WORLD, { 'D', 'Z'}},     //ALGERIA
+        { REGDOMAIN_WORLD,{ 'E', 'C'}},   //ECUADOR
+        { REGDOMAIN_HI_5GHZ, {'E', 'E'}},      //ESTONIA
+        { REGDOMAIN_WORLD, { 'E', 'G'}},     //EGYPT
+        { REGDOMAIN_WORLD, { 'E', 'H'}},     //WESTERN SAHARA
+        { REGDOMAIN_WORLD, { 'E', 'R'}},     //ERITREA
+        { REGDOMAIN_ETSI, {'E', 'S'}},      //SPAIN
+        { REGDOMAIN_WORLD, { 'E', 'T'}},     //ETHIOPIA
+        { REGDOMAIN_WORLD, {'F', 'I'}},      //FINLAND
+        { REGDOMAIN_WORLD, { 'F', 'J'}},     //FIJI
+        { REGDOMAIN_WORLD, { 'F', 'K'}},     //FALKLAND ISLANDS (MALVINAS)
+        { REGDOMAIN_WORLD, { 'F', 'M'}},     //MICRONESIA, FEDERATED STATES OF
+        { REGDOMAIN_WORLD, { 'F', 'O'}},     //FAROE ISLANDS
+        { REGDOMAIN_ETSI, {'F', 'R'}},      //FRANCE
+        { REGDOMAIN_WORLD, { 'G', 'A'}},     //GABON
+        { REGDOMAIN_ETSI, {'G', 'B'}},      //UNITED KINGDOM
+        { REGDOMAIN_WORLD, { 'G', 'D'}},     //GRENADA
+        { REGDOMAIN_HI_5GHZ, { 'G', 'E'}},     //GEORGIA
+        { REGDOMAIN_WORLD, { 'G', 'F'}},     //FRENCH GUIANA
+        { REGDOMAIN_ETSI, {'G', 'G'}},      //GUERNSEY
+        { REGDOMAIN_WORLD, { 'G', 'H'}},     //GHANA
+        { REGDOMAIN_WORLD, {'G', 'I'}},      //GIBRALTAR
+        { REGDOMAIN_WORLD, { 'G', 'L'}},     //GREENLAND
+        { REGDOMAIN_WORLD, { 'G', 'M'}},     //GAMBIA
+        { REGDOMAIN_WORLD, { 'G', 'N'}},     //GUINEA
+        { REGDOMAIN_WORLD, { 'G', 'P'}},     //GUADELOUPE
+        { REGDOMAIN_WORLD, { 'G', 'Q'}},     //EQUATORIAL GUINEA
+        { REGDOMAIN_ETSI, {'G', 'R'}},      //GREECE
+        { REGDOMAIN_WORLD, { 'G', 'S'}},     //SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS
+        { REGDOMAIN_WORLD,{ 'G', 'T'}},   //GUATEMALA
+        { REGDOMAIN_WORLD, { 'G', 'U'}},     //GUAM
+        { REGDOMAIN_WORLD, { 'G', 'W'}},     //GUINEA-BISSAU
+        { REGDOMAIN_WORLD, { 'G', 'Y'}},     //GUYANA
+        { REGDOMAIN_WORLD, {'H', 'K'}},      //HONGKONG
+        { REGDOMAIN_WORLD, { 'H', 'M'}},     //HEARD ISLAND AND MCDONALD ISLANDS
+        { REGDOMAIN_WORLD,{'H', 'N'}},   //HONDURAS
+        { REGDOMAIN_HI_5GHZ, {'H', 'R'}},      //CROATIA
+        { REGDOMAIN_WORLD, { 'H', 'T'}},     //HAITI
+        { REGDOMAIN_HI_5GHZ, {'H', 'U'}},      //HUNGARY
+        { REGDOMAIN_APAC, { 'I', 'D'}},     //INDONESIA
+        { REGDOMAIN_ETSI, {'I', 'E'}},     //IRELAND
+        { REGDOMAIN_WORLD, {'I', 'L'}},        //ISREAL
+        { REGDOMAIN_ETSI, {'I', 'M'}},      //ISLE OF MAN
+        { REGDOMAIN_APAC, {'I', 'N'}},      //INDIA
+        { REGDOMAIN_ETSI, { 'I', 'O'}},     //BRITISH INDIAN OCEAN TERRITORY
+        { REGDOMAIN_WORLD, { 'I', 'Q'}},     //IRAQ
+        { REGDOMAIN_WORLD, { 'I', 'R'}},     //IRAN, ISLAMIC REPUBLIC OF
+        { REGDOMAIN_WORLD, {'I', 'S'}},      //ICELAND
+        { REGDOMAIN_ETSI, {'I', 'T'}},      //ITALY
+        { REGDOMAIN_ETSI, {'J', 'E'}},      //JERSEY
+        { REGDOMAIN_WORLD, { 'J', 'M'}},     //JAMAICA
+        { REGDOMAIN_WORLD, { 'J', 'O'}},     //JORDAN
+        { REGDOMAIN_JAPAN, {'J', 'P'}},     //JAPAN
+        { REGDOMAIN_WORLD, { 'K', 'E'}},     //KENYA
+        { REGDOMAIN_WORLD, { 'K', 'G'}},     //KYRGYZSTAN
+        { REGDOMAIN_WORLD, { 'K', 'H'}},     //CAMBODIA
+        { REGDOMAIN_WORLD, { 'K', 'I'}},     //KIRIBATI
+        { REGDOMAIN_WORLD, { 'K', 'M'}},     //COMOROS
+        { REGDOMAIN_WORLD, { 'K', 'N'}},     //SAINT KITTS AND NEVIS
+        { REGDOMAIN_KOREA, { 'K', 'P'}},     //KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF
+        { REGDOMAIN_KOREA, {'K', 'R'}},     //KOREA, REPUBLIC OF
+        { REGDOMAIN_WORLD, { 'K', 'W'}},     //KUWAIT
+        { REGDOMAIN_WORLD, { 'K', 'Y'}},     //CAYMAN ISLANDS
+        { REGDOMAIN_WORLD, { 'K', 'Z'}},     //KAZAKHSTAN
+        { REGDOMAIN_WORLD, { 'L', 'A'}},     //LAO PEOPLE'S DEMOCRATIC REPUBLIC
+        { REGDOMAIN_WORLD, { 'L', 'B'}},     //LEBANON
+        { REGDOMAIN_WORLD, { 'L', 'C'}},     //SAINT LUCIA
+        { REGDOMAIN_ETSI, {'L', 'I'}},      //LIECHTENSTEIN
+        { REGDOMAIN_WORLD, { 'L', 'K'}},     //SRI LANKA
+        { REGDOMAIN_WORLD, { 'L', 'R'}},     //LIBERIA
+        { REGDOMAIN_WORLD, { 'L', 'S'}},     //LESOTHO
+        { REGDOMAIN_HI_5GHZ, {'L', 'T'}},      //LITHUANIA
+        { REGDOMAIN_ETSI, {'L', 'U'}},      //LUXEMBOURG
+        { REGDOMAIN_HI_5GHZ, {'L', 'V'}},      //LATVIA
+        { REGDOMAIN_WORLD, { 'L', 'Y'}},     //LIBYAN ARAB JAMAHIRIYA
+        { REGDOMAIN_WORLD, { 'M', 'A'}},     //MOROCCO
+        { REGDOMAIN_ETSI, {'M', 'C'}},      //MONACO
+        { REGDOMAIN_WORLD, { 'M', 'D'}},     //MOLDOVA, REPUBLIC OF
+        { REGDOMAIN_WORLD, { 'M', 'E'}},     //MONTENEGRO
+        { REGDOMAIN_WORLD, { 'M', 'G'}},     //MADAGASCAR
+        { REGDOMAIN_WORLD, { 'M', 'H'}},     //MARSHALL ISLANDS
+        { REGDOMAIN_WORLD, { 'M', 'K'}},     //MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF
+        { REGDOMAIN_WORLD, { 'M', 'L'}},     //MALI
+        { REGDOMAIN_WORLD, { 'M', 'M'}},     //MYANMAR
+        { REGDOMAIN_HI_5GHZ, { 'M', 'N'}},     //MONGOLIA
+        { REGDOMAIN_WORLD, { 'M', 'O'}},     //MACAO
+        { REGDOMAIN_WORLD, { 'M', 'P'}},     //NORTHERN MARIANA ISLANDS
+        { REGDOMAIN_WORLD, { 'M', 'Q'}},     //MARTINIQUE
+        { REGDOMAIN_WORLD, { 'M', 'R'}},     //MAURITANIA
+        { REGDOMAIN_WORLD, { 'M', 'S'}},     //MONTSERRAT
+        { REGDOMAIN_WORLD, {'M', 'T'}},      //MALTA
+        { REGDOMAIN_WORLD, { 'M', 'U'}},     //MAURITIUS
+        { REGDOMAIN_WORLD, { 'M', 'V'}},     //MALDIVES
+        { REGDOMAIN_WORLD, { 'M', 'W'}},     //MALAWI
+        { REGDOMAIN_WORLD, {'M', 'X'}},       //MEXICO
+        { REGDOMAIN_HI_5GHZ,{ 'M', 'Y'}},   //MALAYSIA
+        { REGDOMAIN_WORLD, { 'M', 'Z'}},     //MOZAMBIQUE
+        { REGDOMAIN_WORLD, { 'N', 'A'}},     //NAMIBIA
+        { REGDOMAIN_WORLD, { 'N', 'C'}},     //NEW CALEDONIA
+        { REGDOMAIN_WORLD, { 'N', 'E'}},     //NIGER
+        { REGDOMAIN_WORLD, { 'N', 'F'}},     //NORFOLD ISLAND
+        { REGDOMAIN_WORLD, { 'N', 'G'}},     //NIGERIA
+        { REGDOMAIN_WORLD,{ 'N', 'I'}},       //NICARAGUA
+        { REGDOMAIN_ETSI, {'N', 'L'}},      //NETHERLANDS
+        { REGDOMAIN_WORLD, {'N', 'O'}},      //NORWAY
+        { REGDOMAIN_WORLD, { 'N', 'P'}},     //NEPAL
+        { REGDOMAIN_WORLD, { 'N', 'R'}},     //NAURU
+        { REGDOMAIN_WORLD, { 'N', 'U'}},     //NIUE
+        { REGDOMAIN_ETSI, {'N', 'Z'}},      //NEW ZEALAND
+        { REGDOMAIN_WORLD, { 'O', 'M'}},     //OMAN
+        { REGDOMAIN_WORLD, {'P', 'A'}},       //PANAMA
+        { REGDOMAIN_WORLD,{ 'P', 'E'}},   //PERU
+        { REGDOMAIN_WORLD, { 'P', 'F'}},     //FRENCH POLYNESIA
+        { REGDOMAIN_WORLD, { 'P', 'G'}},     //PAPUA NEW GUINEA
+        { REGDOMAIN_WORLD, {'P', 'H'}},      //PHILIPPINES
+        { REGDOMAIN_WORLD, { 'P', 'K'}},     //PAKISTAN
+        { REGDOMAIN_ETSI, {'P', 'L'}},      //POLAND
+        { REGDOMAIN_WORLD, { 'P', 'M'}},     //SAINT PIERRE AND MIQUELON
+        { REGDOMAIN_WORLD, { 'P', 'N'}},     //WORLDPITCAIRN
+        { REGDOMAIN_FCC, {'P', 'R'}},       //PUERTO RICO
+        { REGDOMAIN_WORLD, {'P', 'S'}},        //PALESTINIAN TERRITORY, OCCUPIED
+        { REGDOMAIN_ETSI, {'P', 'T'}},      //PORTUGAL
+        { REGDOMAIN_WORLD, { 'P', 'W'}},     //PALAU
+        { REGDOMAIN_WORLD, { 'P', 'Y'}},     //PARAGUAY
+        { REGDOMAIN_WORLD, { 'Q', 'A'}},     //QATAR
+        { REGDOMAIN_WORLD, { 'R', 'E'}},     //REUNION
+        { REGDOMAIN_HI_5GHZ, {'R', 'O'}},      //ROMANIA
+        { REGDOMAIN_HI_5GHZ, {'R', 'S'}},      //SERBIA
+        { REGDOMAIN_WORLD, {'R', 'U'}},   //RUSSIA
+        { REGDOMAIN_WORLD, { 'R', 'W'}},     //RWANDA
+        { REGDOMAIN_WORLD, {'S', 'A'}},      //SAUDI ARABIA
+        { REGDOMAIN_WORLD, { 'S', 'B'}},     //SOLOMON ISLANDS
+        { REGDOMAIN_ETSI, {'S', 'C'}},      //SEYCHELLES
+        { REGDOMAIN_WORLD, { 'S', 'D'}},     //SUDAN
+        { REGDOMAIN_ETSI, {'S', 'E'}},      //SWEDEN
+        { REGDOMAIN_APAC, {'S', 'G'}},      //SINGAPORE
+        { REGDOMAIN_WORLD, { 'S', 'H'}},     //SAINT HELENA
+        { REGDOMAIN_HI_5GHZ, {'S', 'I'}},      //SLOVENNIA
+        { REGDOMAIN_WORLD, { 'S', 'J'}},     //SVALBARD AND JAN MAYEN
+        { REGDOMAIN_ETSI, {'S', 'K'}},      //SLOVAKIA
+        { REGDOMAIN_WORLD, { 'S', 'L'}},     //SIERRA LEONE
+        { REGDOMAIN_WORLD, { 'S', 'M'}},     //SAN MARINO
+        { REGDOMAIN_WORLD, { 'S', 'N'}},     //SENEGAL
+        { REGDOMAIN_WORLD, { 'S', 'O'}},     //SOMALIA
+        { REGDOMAIN_WORLD, { 'S', 'R'}},     //SURINAME
+        { REGDOMAIN_WORLD, { 'S', 'T'}},     //SAO TOME AND PRINCIPE
+        { REGDOMAIN_WORLD, {'S', 'V'}},       //EL SALVADOR
+        { REGDOMAIN_WORLD, { 'S', 'Y'}},     //SYRIAN ARAB REPUBLIC
+        { REGDOMAIN_WORLD, { 'S', 'Z'}},     //SWAZILAND
+        { REGDOMAIN_WORLD, { 'T', 'C'}},     //TURKS AND CAICOS ISLANDS
+        { REGDOMAIN_WORLD, { 'T', 'D'}},     //CHAD
+        { REGDOMAIN_WORLD, { 'T', 'F'}},     //FRENCH SOUTHERN TERRITORIES
+        { REGDOMAIN_WORLD, { 'T', 'G'}},     //TOGO
+        { REGDOMAIN_WORLD,{ 'T', 'H'}},   //THAILAND
+        { REGDOMAIN_WORLD, { 'T', 'J'}},     //TAJIKISTAN
+        { REGDOMAIN_WORLD, { 'T', 'K'}},     //TOKELAU
+        { REGDOMAIN_WORLD, { 'T', 'L'}},     //TIMOR-LESTE
+        { REGDOMAIN_WORLD, { 'T', 'M'}},     //TURKMENISTAN
+        { REGDOMAIN_WORLD, { 'T', 'N'}},     //TUNISIA
+        { REGDOMAIN_WORLD, { 'T', 'O'}},     //TONGA
+        { REGDOMAIN_WORLD, {'T', 'R'}},      //TURKEY
+        { REGDOMAIN_WORLD, { 'T', 'T'}},     //TRINIDAD AND TOBAGO
+        { REGDOMAIN_WORLD, { 'T', 'V'}},     //TUVALU
+        { REGDOMAIN_HI_5GHZ,{ 'T', 'W'}},   //TAIWAN, PROVINCE OF CHINA
+        { REGDOMAIN_WORLD, { 'T', 'Z'}},     //TANZANIA, UNITED REPUBLIC OF
+        { REGDOMAIN_HI_5GHZ,{ 'U', 'A'}},   //UKRAINE
+        { REGDOMAIN_WORLD, { 'U', 'G'}},     //UGANDA
+        { REGDOMAIN_FCC, {'U', 'M'}},       //UNITED STATES MINOR OUTLYING ISLANDS
+        { REGDOMAIN_WORLD,{ 'U', 'Y'}},   //URUGUAY
+        { REGDOMAIN_HI_5GHZ, { 'U', 'Z'}},     //UZBEKISTAN
+        { REGDOMAIN_ETSI, {'V', 'A'}},      //HOLY SEE (VATICAN CITY STATE)
+        { REGDOMAIN_WORLD, { 'V', 'C'}},     //SAINT VINCENT AND THE GRENADINES
+        { REGDOMAIN_HI_5GHZ,{ 'V', 'E'}},   //VENEZUELA
+        { REGDOMAIN_ETSI, {'V', 'G'}},       //VIRGIN ISLANDS, BRITISH
+        { REGDOMAIN_FCC, {'V', 'I'}},       //VIRGIN ISLANDS, US
+        { REGDOMAIN_WORLD, {'V', 'N'}},      //VIET NAM
+        { REGDOMAIN_WORLD, { 'V', 'U'}},     //VANUATU
+        { REGDOMAIN_WORLD, { 'W', 'F'}},     //WALLIS AND FUTUNA
+        { REGDOMAIN_WORLD, { 'W', 'S'}},     //SOMOA
+        { REGDOMAIN_WORLD, { 'Y', 'E'}},     //YEMEN
+        { REGDOMAIN_WORLD, { 'Y', 'T'}},     //MAYOTTE
+        { REGDOMAIN_WORLD, {'Z', 'A'}},      //SOUTH AFRICA
+        { REGDOMAIN_WORLD, { 'Z', 'M'}},     //ZAMBIA
+        { REGDOMAIN_WORLD, { 'Z', 'W'}},     //ZIMBABWE
+        { REGDOMAIN_KOREA, {'K', '1'}},     //Korea alternate 1
+        { REGDOMAIN_KOREA, {'K', '2'}},     //Korea alternate 2
+        { REGDOMAIN_KOREA, {'K', '3'}},     //Korea alternate 3
+        { REGDOMAIN_KOREA, {'K', '4'}},      //Korea alternate 4
+        { REGDOMAIN_ETSI, {'E', 'U'}},       //Europe (SSGFI)
+        { REGDOMAIN_JAPAN, {'J', '1'}},     //Japan alternate 1
+        { REGDOMAIN_JAPAN, {'J', '2'}},     //Japan alternate 2
+        { REGDOMAIN_JAPAN, {'J', '3'}},     //Japan alternate 3
+        { REGDOMAIN_JAPAN, {'J', '4'}},     //Japan alternate 4
+        { REGDOMAIN_JAPAN, {'J', '5'}}      //Japan alternate 5
     }
 };
 typedef struct nvEFSTable_s
@@ -466,7 +463,6 @@
     VOS_STATUS status = VOS_STATUS_SUCCESS;
     v_CONTEXT_t pVosContext= NULL;
     v_SIZE_t bufSize;
-    v_SIZE_t nvReadBufSize;
     v_BOOL_t itemIsValid = VOS_FALSE;
     
     /*Get the global context */
@@ -474,7 +470,7 @@
     bufSize = sizeof(nvEFSTable_t);
     status = hdd_request_firmware(WLAN_NV_FILE,
                                   ((VosContextType*)(pVosContext))->pHDDContext,
-                                  (v_VOID_t**)&gnvEFSTable, &nvReadBufSize);
+                                  (v_VOID_t**)&gnvEFSTable, &bufSize);
 
     if ( (!VOS_IS_STATUS_SUCCESS( status )) || !gnvEFSTable)
     {
@@ -497,17 +493,8 @@
 
         /*Copying the NV defaults */
         vos_mem_copy(&(pnvEFSTable->halnv),&nvDefaults,sizeof(sHalNv));
-       
-        if ( nvReadBufSize != bufSize)
-        {
-            pnvEFSTable->nvValidityBitmap = DEFAULT_NV_VALIDITY_BITMAP;
-            VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL,
-                      "!!!WARNING: INVALID NV FILE, DRIVER IS USING DEFAULT CAL VALUES %d %d!!!",
-                      nvReadBufSize, bufSize);
-            return (eHAL_STATUS_SUCCESS);
-        }
+        pnvEFSTable->nvValidityBitmap = gnvEFSTable->nvValidityBitmap;
 
-       pnvEFSTable->nvValidityBitmap = gnvEFSTable->nvValidityBitmap;
         /* Copy the valid fields to the NV Global structure */ 
         if (vos_nv_getValidity(VNV_FIELD_IMAGE, &itemIsValid) == 
            VOS_STATUS_SUCCESS)
@@ -1512,34 +1499,7 @@
 #endif
         *num20MHzChannelsFound = (tANI_U8)count;
     }
-
-    if( channels40MHz && num40MHzChannelsFound )
-    {
-        count = 0;
-#ifdef FEATURE_WLAN_INTEGRATED_SOC
-        //center channels for 2.4 Ghz 40 MHz channels
-        for( i = RF_CHAN_BOND_3; i <= RF_CHAN_BOND_11; i++ )
-        {
-            
-            if( regChannels[i].enabled )
-            {
-                channels40MHz[count].chanId = rfChannels[i].channelNum;
-                channels40MHz[count++].pwr  = regChannels[i].pwrLimit;
-            }
-        }
-        //center channels for 5 Ghz 40 MHz channels
-        for( i = RF_CHAN_BOND_38; i <= RF_CHAN_BOND_163; i++ )
-        {
-            
-            if( regChannels[i].enabled )
-            {
-                channels40MHz[count].chanId = rfChannels[i].channelNum;
-                channels40MHz[count++].pwr  = regChannels[i].pwrLimit;
-            }
-        }
-#endif
-        *num40MHzChannelsFound = (tANI_U8)count;
-    }
+    //TODO: 40 MHz
     return (status);
 }
 
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_packet.c b/drivers/staging/prima/CORE/VOSS/src/vos_packet.c
index 211c643..304bd51 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_packet.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_packet.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -166,6 +166,7 @@
    struct vos_pkt_t *pVosPacket;
    v_BOOL_t didOne = VOS_FALSE;
    vos_pkt_get_packet_callback callback;
+   int rc; 
 
    // if there are no packets in the replenish pool then we can't do anything
    if (likely(0 == gpVosPacketContext->rxReplenishListCount))
@@ -175,8 +176,14 @@
 
    // we only replenish if the Rx Raw pool is empty or the Replenish pool
    // reaches a high water mark
-   mutex_lock(&gpVosPacketContext->mlock);
+   rc = mutex_lock_interruptible(&gpVosPacketContext->mlock);
 
+   if (unlikely(0 != rc))
+   {
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
+                "failed to acquire mutex, line [%d] in %s", __LINE__, __FUNCTION__);
+      return;     
+   }
 
    if ((gpVosPacketContext->rxReplenishListCount < VPKT_RX_REPLENISH_THRESHOLD)
        &&
@@ -520,12 +527,10 @@
       return VOS_STATUS_E_INVAL;
    }
 
-   mutex_lock(&gpVosPacketContext->mlock);
    (void) vos_pkti_list_destroy(&gpVosPacketContext->txMgmtFreeList);
    (void) vos_pkti_list_destroy(&gpVosPacketContext->txDataFreeList);
    (void) vos_pkti_list_destroy(&gpVosPacketContext->rxRawFreeList);
    (void) vos_pkti_list_destroy(&gpVosPacketContext->rxReplenishList);
-   mutex_unlock(&gpVosPacketContext->mlock);
 
 #ifdef WLAN_SOFTAP_FEATURE
    gpVosPacketContext->uctxDataFreeListCount = 0;
@@ -623,6 +628,7 @@
    struct list_head *pPktFreeList;
    vos_pkt_low_resource_info *pLowResourceInfo;
    struct vos_pkt_t *pVosPacket;
+   int rc; 
    // Validate the return parameter pointer
    if (unlikely(NULL == ppPacket))
    {
@@ -685,7 +691,7 @@
       return VOS_STATUS_E_ALREADY;
    }
 
-   mutex_lock(&gpVosPacketContext->mlock);
+   rc = mutex_lock_interruptible(&gpVosPacketContext->mlock);
    // are there vos packets on the associated free pool?
    if (unlikely(list_empty(pPktFreeList)))
    {
@@ -696,7 +702,10 @@
          VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                    "VPKT [%d]: Low resource condition and no callback provided",
                    __LINE__);
-         mutex_unlock(&gpVosPacketContext->mlock);
+         if (likely(0 == rc)) 
+         {
+            mutex_unlock(&gpVosPacketContext->mlock);
+         }
 
          return VOS_STATUS_E_FAILURE;
       }
@@ -708,15 +717,20 @@
       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
                 "VPKT [%d]: Low resource condition for packet type %d[%s]",
                 __LINE__, pktType, vos_pkti_packet_type_str(pktType));
-      mutex_unlock(&gpVosPacketContext->mlock);
-
+      if (likely(0 == rc)) 
+      {
+         mutex_unlock(&gpVosPacketContext->mlock);
+      }
       return VOS_STATUS_E_RESOURCES;
    }
 
    // remove the first record from the free pool
    pVosPacket = list_first_entry(pPktFreeList, struct vos_pkt_t, node);
    list_del(&pVosPacket->node);
-   mutex_unlock(&gpVosPacketContext->mlock);
+   if (likely(0 == rc)) 
+   {
+      mutex_unlock(&gpVosPacketContext->mlock);
+   }
 
    // clear out the User Data pointers in the voss packet..
    memset(&pVosPacket->pvUserData, 0, sizeof(pVosPacket->pvUserData));
@@ -1251,6 +1265,7 @@
    vos_pkt_low_resource_info *pLowResourceInfo;
    vos_pkt_get_packet_callback callback;
    v_SIZE_t *pCount;
+   int rc; 
    VOS_PKT_TYPE packetType = VOS_PKT_TYPE_TX_802_3_DATA;
 
    // Validate the input parameter pointer
@@ -1364,10 +1379,12 @@
                    "VPKT [%d]: [%p] Packet returned, type %d[%s]",
                    __LINE__, pPacket, pPacket->packetType,
                    vos_pkti_packet_type_str(pPacket->packetType));
-         mutex_lock(&gpVosPacketContext->mlock);
+         rc = mutex_lock_interruptible(&gpVosPacketContext->mlock);
          list_add_tail(&pPacket->node, pPktFreeList);
-         mutex_unlock(&gpVosPacketContext->mlock);
-        
+         if (likely(0 == rc)) 
+         {
+            mutex_unlock(&gpVosPacketContext->mlock);
+         }
          if (pCount)
          {
             (*pCount)++;
@@ -2869,6 +2886,7 @@
    struct list_head *pList;
    struct list_head *pNode;
    v_SIZE_t count;
+   int rc; 
    if (NULL == vosFreeBuffer)
    {
       return VOS_STATUS_E_INVAL;
@@ -2906,12 +2924,15 @@
    }
 
    count = 0;
-   mutex_lock(&gpVosPacketContext->mlock);
+   rc = mutex_lock_interruptible(&gpVosPacketContext->mlock);
    list_for_each(pNode, pList)
    {
       count++;
    }
-   mutex_unlock(&gpVosPacketContext->mlock);
+   if (likely(0 == rc))
+   {
+      mutex_unlock(&gpVosPacketContext->mlock);
+   }
    *vosFreeBuffer = count;
    return VOS_STATUS_SUCCESS;
 }
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_power.c b/drivers/staging/prima/CORE/VOSS/src/vos_power.c
index 27ae423..f1909e2 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_power.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_power.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_sched.c b/drivers/staging/prima/CORE/VOSS/src/vos_sched.c
index 0b9245f..2b9667a 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_sched.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_sched.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_sched.h b/drivers/staging/prima/CORE/VOSS/src/vos_sched.h
index c3501ab..759bb94 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_sched.h
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_sched.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_threads.c b/drivers/staging/prima/CORE/VOSS/src/vos_threads.c
index cf1dea3..d51fa49 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_threads.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_threads.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_timer.c b/drivers/staging/prima/CORE/VOSS/src/vos_timer.c
index c873f54..00d4b61 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_timer.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_timer.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -720,7 +720,7 @@
    if ( VOS_TIMER_STATE_STOPPED != timer->state )
    {  
       spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH, 
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN, 
                 "%s: Cannot start timer in state = %d ",__func__, timer->state);
       return VOS_STATUS_E_ALREADY;
    }
@@ -805,7 +805,7 @@
    if ( VOS_TIMER_STATE_RUNNING != timer->state )
    {
       spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
-      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH,
+      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN,
                 "%s: Cannot stop timer in state = %d",
                 __func__, timer->state);
       return VOS_STATUS_E_FAULT;
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_trace.c b/drivers/staging/prima/CORE/VOSS/src/vos_trace.c
index 9d6636f..d03bd20 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_trace.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_trace.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -92,29 +92,29 @@
 // the 3 character 'name' of the module for marking the trace logs.
 moduleTraceInfo gVosTraceInfo[ VOS_MODULE_ID_MAX ] =
 {
-   [VOS_MODULE_ID_BAP]        = { VOS_DEFAULT_TRACE_LEVEL, "BAP" },
-   [VOS_MODULE_ID_TL]         = { VOS_DEFAULT_TRACE_LEVEL, "TL " },
+   [VOS_MODULE_ID_BAP]        = { (1<<VOS_TRACE_LEVEL_FATAL), "BAP" },
+   [VOS_MODULE_ID_TL]         = { (1<<VOS_TRACE_LEVEL_FATAL), "TL " },
 #ifndef FEATURE_WLAN_INTEGRATED_SOC
-   [VOS_MODULE_ID_BAL]        = { VOS_DEFAULT_TRACE_LEVEL, "BAL" },
-   [VOS_MODULE_ID_SAL]        = { VOS_DEFAULT_TRACE_LEVEL, "SAL" },
-   [VOS_MODULE_ID_SSC]        = { VOS_DEFAULT_TRACE_LEVEL, "SSC" },
+   [VOS_MODULE_ID_BAL]        = { (1<<VOS_TRACE_LEVEL_FATAL), "BAL" },
+   [VOS_MODULE_ID_SAL]        = { (1<<VOS_TRACE_LEVEL_FATAL), "SAL" },
+   [VOS_MODULE_ID_SSC]        = { (1<<VOS_TRACE_LEVEL_FATAL), "SSC" },
 #endif
 #ifdef FEATURE_WLAN_INTEGRATED_SOC
-   [VOS_MODULE_ID_WDI]        = { VOS_DEFAULT_TRACE_LEVEL, "WDI"},
+   [VOS_MODULE_ID_WDI]        = { (1<<VOS_TRACE_LEVEL_FATAL), "WDI"},
 #endif
-   [VOS_MODULE_ID_HDD]        = { VOS_DEFAULT_TRACE_LEVEL, "HDD" },
-   [VOS_MODULE_ID_SME]        = { VOS_DEFAULT_TRACE_LEVEL, "SME" },
-   [VOS_MODULE_ID_PE]         = { VOS_DEFAULT_TRACE_LEVEL, "PE " },
+   [VOS_MODULE_ID_HDD]        = { (1<<VOS_TRACE_LEVEL_FATAL), "HDD" },
+   [VOS_MODULE_ID_SME]        = { (1<<VOS_TRACE_LEVEL_FATAL), "SME" },
+   [VOS_MODULE_ID_PE]         = { (1<<VOS_TRACE_LEVEL_FATAL), "PE " },
 #ifndef FEATURE_WLAN_INTEGRATED_SOC
-   [VOS_MODULE_ID_HAL]        = { VOS_DEFAULT_TRACE_LEVEL, "HAL" },
+   [VOS_MODULE_ID_HAL]        = { (1<<VOS_TRACE_LEVEL_FATAL), "HAL" },
 #else
-   [VOS_MODULE_ID_WDA]        = { VOS_DEFAULT_TRACE_LEVEL, "WDA" },
+   [VOS_MODULE_ID_WDA]        = { (1<<VOS_TRACE_LEVEL_FATAL), "WDA" },
 #endif
-   [VOS_MODULE_ID_SYS]        = { VOS_DEFAULT_TRACE_LEVEL, "SYS" },
+   [VOS_MODULE_ID_SYS]        = { (1<<VOS_TRACE_LEVEL_FATAL), "SYS" },
    [VOS_MODULE_ID_VOSS]       = { VOS_DEFAULT_TRACE_LEVEL, "VOS" },
 #ifdef WLAN_SOFTAP_FEATURE
-   [VOS_MODULE_ID_SAP]        = { VOS_DEFAULT_TRACE_LEVEL, "SAP" },
-   [VOS_MODULE_ID_HDD_SOFTAP] = { VOS_DEFAULT_TRACE_LEVEL, "HSP" },
+   [VOS_MODULE_ID_SAP]        = { (1<<VOS_TRACE_LEVEL_FATAL), "SAP" },
+   [VOS_MODULE_ID_HDD_SOFTAP] = { (1<<VOS_TRACE_LEVEL_FATAL), "HSP" },
 #endif
 };
 
@@ -259,7 +259,8 @@
       va_start(val, strFormat);
 
       // print the prefix string into the string buffer...
-      n = snprintf(strBuffer, VOS_TRACE_BUFFER_SIZE, "[WLAN][%d:%2s:%3s] ",
+      n = snprintf(strBuffer, VOS_TRACE_BUFFER_SIZE, "[%d:%d:%2s:%3s] ",
+                   smp_processor_id(),
                    in_interrupt() ? 0 : current->pid,
                    (char *) TRACE_LEVEL_STR[ level ],
                    (char *) gVosTraceInfo[ module ].moduleNameStr );
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_types.c b/drivers/staging/prima/CORE/VOSS/src/vos_types.c
index 66cad7a..fe6aa86 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_types.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_types.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/VOSS/src/vos_utils.c b/drivers/staging/prima/CORE/VOSS/src/vos_utils.c
index 4ae4088..d84c937 100644
--- a/drivers/staging/prima/CORE/VOSS/src/vos_utils.c
+++ b/drivers/staging/prima/CORE/VOSS/src/vos_utils.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDA/inc/legacy/halMsgApi.h b/drivers/staging/prima/CORE/WDA/inc/legacy/halMsgApi.h
index 968130a..280d470 100644
--- a/drivers/staging/prima/CORE/WDA/inc/legacy/halMsgApi.h
+++ b/drivers/staging/prima/CORE/WDA/inc/legacy/halMsgApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -302,11 +302,6 @@
     tANI_U8     p2pCapableSta;
 #endif
 
-#ifdef WLAN_FEATURE_11AC
-    tANI_U8    vhtCapable;
-    tANI_U8    vhtTxChannelWidthSet;
-#endif
-
 } tAddStaParams, *tpAddStaParams;
 
 
@@ -510,10 +505,7 @@
 
     //Spectrum Management Capability, 1 - Enabled, 0 - Disabled.
     tANI_U8 bSpectrumMgtEnabled;
-#ifdef WLAN_FEATURE_11AC
-    tANI_U8 vhtCapable;
-    tANI_U8    vhtTxChannelWidthSet;
-#endif
+
 } tAddBssParams, * tpAddBssParams;
 
 typedef struct
@@ -949,7 +941,7 @@
 #ifndef WLAN_FEATURE_VOWIFI    
     tANI_U8 localPowerConstraint;
 #endif /* WLAN_FEATURE_VOWIFI  */
-    ePhyChanBondState secondaryChannelOffset;
+    tSirMacHTSecondaryChannelOffset secondaryChannelOffset;
     tANI_U8 peSessionId;
 #if defined WLAN_FEATURE_VOWIFI
     tPowerdBm txMgmtPower; //HAL fills in the tx power used for mgmt frames in this field.
@@ -1161,7 +1153,6 @@
 {
     tANI_U8     sendDataNull;
     eHalStatus  status;
-    tANI_U8     bssIdx;
 } tExitBmpsParams, *tpExitBmpsParams;
 
 //
@@ -1179,7 +1170,6 @@
     tANI_U8     viTriggerEnabled:1;
     tANI_U8     voTriggerEnabled:1;
     eHalStatus  status;
-    tANI_U8     bssIdx;
 }tUapsdParams, *tpUapsdParams;
 
 //
diff --git a/drivers/staging/prima/CORE/WDA/inc/legacy/halTypes.h b/drivers/staging/prima/CORE/WDA/inc/legacy/halTypes.h
index 1e13272..ad7a02b 100644
--- a/drivers/staging/prima/CORE/WDA/inc/legacy/halTypes.h
+++ b/drivers/staging/prima/CORE/WDA/inc/legacy/halTypes.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -290,9 +290,7 @@
     eHAL_SYS_MODE_LEARN,
     eHAL_SYS_MODE_SCAN,
     eHAL_SYS_MODE_PROMISC,
-    eHAL_SYS_MODE_SUSPEND_LINK,
-    eHAL_SYS_MODE_ROAM_SCAN,
-    eHAL_SYS_MODE_ROAM_SUSPEND_LINK,
+    eHAL_SYS_MODE_SUSPEND_LINK
 } eHalSysMode;
 
 
diff --git a/drivers/staging/prima/CORE/WDA/inc/legacy/palTypes.h b/drivers/staging/prima/CORE/WDA/inc/legacy/palTypes.h
index b24aa47..31a590c 100644
--- a/drivers/staging/prima/CORE/WDA/inc/legacy/palTypes.h
+++ b/drivers/staging/prima/CORE/WDA/inc/legacy/palTypes.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDA/inc/legacy/wlan_qct_hal.h b/drivers/staging/prima/CORE/WDA/inc/legacy/wlan_qct_hal.h
index 56272c7..6117279 100644
--- a/drivers/staging/prima/CORE/WDA/inc/legacy/wlan_qct_hal.h
+++ b/drivers/staging/prima/CORE/WDA/inc/legacy/wlan_qct_hal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda.h b/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda.h
index 23bd6c4..aea1f77 100644
--- a/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda.h
+++ b/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -128,8 +128,6 @@
  * Check the version number and find if MCC feature is supported or not
  */
 #define IS_MCC_SUPPORTED (WDA_IsWcnssWlanReportedVersionGreaterThanOrEqual( 0, 1, 1, 0))
-#define IS_SLM_SESSIONIZATION_SUPPORTED_BY_FW (WDA_getFwWlanFeatCaps(SLM_SESSIONIZATION))
-
 
 /*--------------------------------------------------------------------------
   Definitions for Data path APIs
@@ -421,7 +419,6 @@
    /* set, when BT AMP session is going on */
    v_BOOL_t             wdaAmpSessionOn;
    v_U32_t              VosPacketToFree;
-   v_BOOL_t             needShutdown;
 } tWDA_CbContext ; 
 
 typedef struct
@@ -470,17 +467,6 @@
 VOS_STATUS WDA_shutdown(v_PVOID_t pVosContext, wpt_boolean closeTransport);
 
 /*
- * FUNCTION: WDA_stopFailed
- * WDA stop is failed
- */
-void WDA_stopFailed(v_PVOID_t pVosContext);
-/*
- * FUNCTION: WDA_needShutdown
- * WDA requires a shutdown rather than a close
- */
-v_BOOL_t WDA_needShutdown(v_PVOID_t pVosContext);
-
-/*
  * FUNCTION: WDA_McProcessMsg
  * DAL-AL message processing entry function 
  */ 
@@ -1222,6 +1208,9 @@
 #define WDA_WLAN_RESUME_REQ           SIR_HAL_WLAN_RESUME_REQ
 #define WDA_MSG_TYPES_END    SIR_HAL_MSG_TYPES_END
 
+#define WDA_SUSPEND_ACTIVITY_RSP SIR_HAL_SUSPEND_ACTIVITY_RSP
+
+
 #define WDA_MMH_TXMB_READY_EVT SIR_HAL_MMH_TXMB_READY_EVT     
 #define WDA_MMH_RXMB_DONE_EVT  SIR_HAL_MMH_RXMB_DONE_EVT    
 #define WDA_MMH_MSGQ_NE_EVT    SIR_HAL_MMH_MSGQ_NE_EVT
@@ -2039,27 +2028,4 @@
 ============================================================================*/
 tANI_U8 WDA_getFwWlanFeatCaps(tANI_U8 featEnumValue);
 
-/*==========================================================================
-  FUNCTION   WDA_TransportChannelDebug
-
-  DESCRIPTION 
-    Display Transport Channel debugging information
-    User may request to display DXE channel snapshot
-    Or if host driver detects any abnormal stcuk may display
-
-  PARAMETERS
-    displaySnapshot : Dispaly DXE snapshot option
-    enableStallDetect : Enable stall detect feature
-                        This feature will take effect to data performance
-                        Not integrate till fully verification
-
-  RETURN VALUE
-    NONE
-
-===========================================================================*/
-void WDA_TransportChannelDebug
-(
-   v_BOOL_t   displaySnapshot,
-   v_BOOL_t   toggleStallDetect
-);
 #endif
diff --git a/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda_msg.h b/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda_msg.h
index ae83385..952c217 100644
--- a/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda_msg.h
+++ b/drivers/staging/prima/CORE/WDA/inc/wlan_qct_wda_msg.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDA/src/wlan_nv.c b/drivers/staging/prima/CORE/WDA/src/wlan_nv.c
index 8adf60b..a3b453b 100644
--- a/drivers/staging/prima/CORE/WDA/src/wlan_nv.c
+++ b/drivers/staging/prima/CORE/WDA/src/wlan_nv.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -3796,7 +3796,7 @@
     } // tables
 };
 
-#else
+#else 
 
 #include "palTypes.h"
 #include "wlan_nv.h"
@@ -3890,84 +3890,6 @@
                 {1500},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_120_MBPS,
                 {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_135_MBPS,
                 {1350},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
-#ifdef WLAN_FEATURE_11AC
-                //11AC rates
-               //11A duplicate 80MHz Rates
-                {1700},    // HAL_PHY_RATE_11AC_DUP_6_MBPS,
-                {1700},    // HAL_PHY_RATE_11AC_DUP_9_MBPS,
-                {1700},    // HAL_PHY_RATE_11AC_DUP_12_MBPS,
-                {1650},    // HAL_PHY_RATE_11AC_DUP_18_MBPS,
-                {1600},    // HAL_PHY_RATE_11AC_DUP_24_MBPS,
-                {1550},    // HAL_PHY_RATE_11AC_DUP_36_MBPS,
-                {1550},    // HAL_PHY_RATE_11AC_DUP_48_MBPS,
-                {1500},    // HAL_PHY_RATE_11AC_DUP_54_MBPS,
-
-               //11ac 20MHZ NG, SG
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_6_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_13_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_19_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_26_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_39_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_52_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_58_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_65_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_78_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_7_2_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_14_4_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_21_6_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_28_8_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_43_3_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_57_7_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_65_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_72_2_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_86_6_MBPS,
-
-
-               //11ac 40MHZ NG, SG
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_13_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_27_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_40_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_54_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_81_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_108_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_121_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_135_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_162_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_180_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_15_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_30_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_45_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_60_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_90_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_120_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_135_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_150_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_180_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_200_MBPS,
-
-
-               //11ac 80MHZ NG, SG
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_29_3_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_58_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_87_8_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_117_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_175_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_234_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_263_3_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_292_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_351_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_390_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_32_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_65_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_97_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_130_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_195_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_260_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_292_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_325_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_390_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_433_3_MBPS,
-#endif //WLAN_FEATURE_11AC
                 },  //    RF_SUBBAND_2_4_GHZ
 
                 {
@@ -4035,84 +3957,6 @@
                 {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_120_MBPS,
                 {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_135_MBPS,
                 {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
-#ifdef WLAN_FEATURE_11AC
-                //11AC rates
-               //11A duplicate 80MHz Rates
-                {1700},    // HAL_PHY_RATE_11AC_DUP_6_MBPS,
-                {1700},    // HAL_PHY_RATE_11AC_DUP_9_MBPS,
-                {1700},    // HAL_PHY_RATE_11AC_DUP_12_MBPS,
-                {1650},    // HAL_PHY_RATE_11AC_DUP_18_MBPS,
-                {1600},    // HAL_PHY_RATE_11AC_DUP_24_MBPS,
-                {1550},    // HAL_PHY_RATE_11AC_DUP_36_MBPS,
-                {1550},    // HAL_PHY_RATE_11AC_DUP_48_MBPS,
-                {1500},    // HAL_PHY_RATE_11AC_DUP_54_MBPS,
-
-               //11ac 20MHZ NG, SG
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_6_5_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_13_MBPS,
-                {1350},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_19_5_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_26_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_39_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_52_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_58_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_65_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_78_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_7_2_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_14_4_MBPS,
-                {1350},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_21_6_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_28_8_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_43_3_MBPS,
-                {1200},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_57_7_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_65_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_72_2_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_86_6_MBPS,
-
-
-               //11ac 40MHZ NG, SG
-                {1400},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_13_5_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_27_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_40_5_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_54_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_81_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_108_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_121_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_135_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_162_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_180_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_15_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_30_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_45_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_60_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_90_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_120_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_135_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_150_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_180_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_200_MBPS,
-
-
-               //11ac 80MHZ NG, SG
-                {1300},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_29_3_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_58_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_87_8_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_117_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_175_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_234_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_263_3_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_292_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_351_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_390_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_32_5_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_65_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_97_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_130_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_195_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_260_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_292_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_325_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_390_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_433_3_MBPS,
-#endif //WLAN_FEATURE_11AC
                 },  //    RF_SUBBAND_5_LOW_GHZ
 
                 // 5G Mid
@@ -4181,84 +4025,6 @@
                 {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_120_MBPS,
                 {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_135_MBPS,
                 {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
-#ifdef WLAN_FEATURE_11AC
-                //11AC rates
-               //11A duplicate 80MHz Rates
-                {1700},    // HAL_PHY_RATE_11AC_DUP_6_MBPS,
-                {1700},    // HAL_PHY_RATE_11AC_DUP_9_MBPS,
-                {1700},    // HAL_PHY_RATE_11AC_DUP_12_MBPS,
-                {1650},    // HAL_PHY_RATE_11AC_DUP_18_MBPS,
-                {1600},    // HAL_PHY_RATE_11AC_DUP_24_MBPS,
-                {1550},    // HAL_PHY_RATE_11AC_DUP_36_MBPS,
-                {1550},    // HAL_PHY_RATE_11AC_DUP_48_MBPS,
-                {1500},    // HAL_PHY_RATE_11AC_DUP_54_MBPS,
-
-               //11ac 20MHZ NG, SG
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_6_5_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_13_MBPS,
-                {1350},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_19_5_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_26_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_39_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_52_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_58_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_65_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_78_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_7_2_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_14_4_MBPS,
-                {1350},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_21_6_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_28_8_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_43_3_MBPS,
-                {1200},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_57_7_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_65_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_72_2_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_86_6_MBPS,
-
-
-               //11ac 40MHZ NG, SG
-                {1400},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_13_5_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_27_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_40_5_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_54_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_81_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_108_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_121_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_135_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_162_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_180_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_15_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_30_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_45_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_60_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_90_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_120_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_135_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_150_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_180_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_200_MBPS,
-
-
-               //11ac 80MHZ NG, SG
-                {1300},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_29_3_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_58_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_87_8_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_117_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_175_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_234_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_263_3_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_292_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_351_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_390_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_32_5_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_65_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_97_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_130_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_195_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_260_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_292_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_325_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_390_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_433_3_MBPS,
-#endif //WLAN_FEATURE_11AC
                 },  //    //     RF_SUBBAND_5_MID_GHZ
                 // 5G High
                 {
@@ -4326,84 +4092,6 @@
                 {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_120_MBPS,
                 {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_135_MBPS,
                 {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
-#ifdef WLAN_FEATURE_11AC
-                //11AC rates
-               //11A duplicate 80MHz Rates
-                {1700},    // HAL_PHY_RATE_11AC_DUP_6_MBPS,
-                {1700},    // HAL_PHY_RATE_11AC_DUP_9_MBPS,
-                {1700},    // HAL_PHY_RATE_11AC_DUP_12_MBPS,
-                {1650},    // HAL_PHY_RATE_11AC_DUP_18_MBPS,
-                {1600},    // HAL_PHY_RATE_11AC_DUP_24_MBPS,
-                {1550},    // HAL_PHY_RATE_11AC_DUP_36_MBPS,
-                {1550},    // HAL_PHY_RATE_11AC_DUP_48_MBPS,
-                {1500},    // HAL_PHY_RATE_11AC_DUP_54_MBPS,
-
-               //11ac 20MHZ NG, SG
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_6_5_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_13_MBPS,
-                {1350},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_19_5_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_26_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_39_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_52_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_58_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_65_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_NGI_78_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_7_2_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_14_4_MBPS,
-                {1350},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_21_6_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_28_8_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_43_3_MBPS,
-                {1200},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_57_7_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_65_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_72_2_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_CB_SGI_86_6_MBPS,
-
-
-               //11ac 40MHZ NG, SG
-                {1400},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_13_5_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_27_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_40_5_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_54_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_81_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_108_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_121_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_135_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_162_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_180_MBPS,
-                {1400},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_15_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_30_MBPS,
-                {1250},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_45_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_60_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_90_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_120_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_135_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_150_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_180_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_200_MBPS,
-
-
-               //11ac 80MHZ NG, SG
-                {1300},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_29_3_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_58_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_87_8_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_117_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_175_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_234_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_263_3_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_292_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_351_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_390_MBPS,
-                {1300},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_32_5_MBPS,
-                {1100},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_65_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_97_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_130_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_195_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_260_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_292_5_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_325_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_390_MBPS,
-                {1000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_433_3_MBPS,
-#endif //WLAN_FEATURE_11AC
                 },  //    RF_SUBBAND_5_HIGH_GHZ,
                 // 4.9G
 
@@ -4472,84 +4160,6 @@
                 {1400},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_120_MBPS,
                 {1300},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_135_MBPS,
                 {1200},    // HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
-#ifdef WLAN_FEATURE_11AC
-                //11AC rates
-               //11A duplicate 80MHz Rates
-                {1700},    // HAL_PHY_RATE_11AC_DUP_6_MBPS,
-                {1700},    // HAL_PHY_RATE_11AC_DUP_9_MBPS,
-                {1700},    // HAL_PHY_RATE_11AC_DUP_12_MBPS,
-                {1650},    // HAL_PHY_RATE_11AC_DUP_18_MBPS,
-                {1600},    // HAL_PHY_RATE_11AC_DUP_24_MBPS,
-                {1550},    // HAL_PHY_RATE_11AC_DUP_36_MBPS,
-                {1550},    // HAL_PHY_RATE_11AC_DUP_48_MBPS,
-                {1500},    // HAL_PHY_RATE_11AC_DUP_54_MBPS,
-
-               //11ac 20MHZ NG, SG
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_6_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_13_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_19_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_26_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_39_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_52_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_58_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_65_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_78_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_7_2_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_14_4_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_21_6_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_28_8_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_43_3_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_57_7_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_65_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_72_2_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_86_6_MBPS,
-
-
-               //11ac 40MHZ NG, SG
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_13_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_27_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_40_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_54_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_81_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_108_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_121_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_135_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_162_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_180_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_15_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_30_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_45_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_60_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_90_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_120_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_135_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_150_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_180_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_200_MBPS,
-
-
-               //11ac 80MHZ NG, SG
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_29_3_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_58_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_87_8_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_117_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_175_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_234_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_263_3_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_292_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_351_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_390_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_32_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_65_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_97_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_130_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_195_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_260_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_292_5_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_325_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_390_MBPS,
-                {0000},    // HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_433_3_MBPS,
-#endif //WLAN_FEATURE_11AC
                 },  //    RF_SUBBAND_4_9_GHZ
         },
 
@@ -7742,7 +7352,7 @@
             100,   // RF_CHAN_108
             100,   // RF_CHAN_112
             100,   // RF_CHAN_116
-            100,   // RF_CHAN_120
+            100,   // RF_CHAN_120 
             100,   // RF_CHAN_124
             100,   // RF_CHAN_128
             100,   // RF_CHAN_132
@@ -7754,7 +7364,7 @@
             100,   // RF_CHAN_161
             100,   // RF_CHAN_165
             //CHANNEL BONDED CHANNELS
-            100,   // RF_CHAN_BOND_3
+            100,   // RF_CHAN_BOND_3 
             100,   // RF_CHAN_BOND_4
             100,   // RF_CHAN_BOND_5
             100,   // RF_CHAN_BOND_6
@@ -7771,15 +7381,15 @@
             100,   // RF_CHAN_BOND_38
             100,   // RF_CHAN_BOND_42
             100,   // RF_CHAN_BOND_46
-            100,   // RF_CHAN_BOND_50
+            100,   // RF_CHAN_BOND_50 
             100,   // RF_CHAN_BOND_54
             100,   // RF_CHAN_BOND_58
             100,   // RF_CHAN_BOND_62
             100,   // RF_CHAN_BOND_102
             100,   // RF_CHAN_BOND_106
             100,   // RF_CHAN_BOND_110
-            100,   // RF_CHAN_BOND_114
-            100,   // RF_CHAN_BOND_118
+            100,   // RF_CHAN_BOND_114 
+            100,   // RF_CHAN_BOND_118 
             100,   // RF_CHAN_BOND_122
             100,   // RF_CHAN_BOND_126
             100,   // RF_CHAN_BOND_130
@@ -9080,7 +8690,7 @@
             280,   // RF_CHAN_108
             280,   // RF_CHAN_112
             280,   // RF_CHAN_116
-            280,   // RF_CHAN_120
+            280,   // RF_CHAN_120 
             280,   // RF_CHAN_124
             280,   // RF_CHAN_128
             280,   // RF_CHAN_132
@@ -9092,7 +8702,7 @@
             280,   // RF_CHAN_161
             280,   // RF_CHAN_165
             //CHANNEL BONDED CHANNELS
-            280,   // RF_CHAN_BOND_3
+            280,   // RF_CHAN_BOND_3 
             280,   // RF_CHAN_BOND_4
             280,   // RF_CHAN_BOND_5
             280,   // RF_CHAN_BOND_6
@@ -9109,15 +8719,15 @@
             280,   // RF_CHAN_BOND_38
             280,   // RF_CHAN_BOND_42
             280,   // RF_CHAN_BOND_46
-            280,   // RF_CHAN_BOND_50
+            280,   // RF_CHAN_BOND_50 
             280,   // RF_CHAN_BOND_54
             280,   // RF_CHAN_BOND_58
             280,   // RF_CHAN_BOND_62
             280,   // RF_CHAN_BOND_102
             280,   // RF_CHAN_BOND_106
             280,   // RF_CHAN_BOND_110
-            280,   // RF_CHAN_BOND_114
-            280,   // RF_CHAN_BOND_118
+            280,   // RF_CHAN_BOND_114 
+            280,   // RF_CHAN_BOND_118 
             280,   // RF_CHAN_BOND_122
             280,   // RF_CHAN_BOND_126
             280,   // RF_CHAN_BOND_130
@@ -9133,7 +8743,7 @@
         {
             { 2150 }, // applied to all channels, MODE_802_11B
             { 1850 }, // applied to all channels,MODE_802_11AG
-            { 1750 }  // applied to all channels,MODE_802_11N
+            { 1750 }  // applied to all channels,MODE_802_11N 
         },
 
         //NV_TABLE_OFDM_CMD_PWR_OFFSET
@@ -9149,7 +8759,7 @@
     } // tables
 };
 
-#endif
+#endif 
 #endif
 
 
diff --git a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c
index 0534fa0..d6f871b 100644
--- a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c
+++ b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -20,33 +20,47 @@
  */
 
 /*===========================================================================
+
                        W L A N _ Q C T _ WDA . C
+
   OVERVIEW:
+
   This software unit holds the implementation of the WLAN Transport Layer.
+
   The functions externalized by this module are to be called ONLY by other
   WLAN modules that properly register with the Transport Layer initially.
+
   DEPENDENCIES:
+
   Are listed for each API below.
 
+
   Copyright (c) 2010-2011 QUALCOMM Incorporated.
   All Rights Reserved.
   Qualcomm Confidential and Proprietary
 ===========================================================================*/
+
 /*===========================================================================
+
                       EDIT HISTORY FOR FILE
 
+
   This section contains comments describing changes made to the module.
   Notice that changes are listed in reverse chronological order.
 
+
    $Header$$DateTime$$Author$
 
+
   when        who        what, where, why
 ----------    ---       -------------------------------------------------
 10/05/2011    haparna     Adding support for Keep Alive Feature
 2010-12-30    smiryala     UMAC convergence changes
 2010-08-19    adwivedi    WLAN DAL AL(WDA) layer for Prima
 ===========================================================================*/
+
 #if defined( FEATURE_WLAN_INTEGRATED_SOC )
+
 #include "vos_mq.h" 
 #include "vos_api.h" 
 #include "vos_packet.h" 
@@ -68,27 +82,32 @@
 #include "limUtils.h"
 #include "btcApi.h"
 #include "vos_sched.h"
+
 #ifdef ANI_MANF_DIAG
 #include "pttMsgApi.h"
 #include "wlan_qct_sys.h"
 #endif /* ANI_MANF_DIAG */
+
 /* Used MACRO's */
 /* Get WDA context from vOSS module */
 #define VOS_GET_WDA_CTXT(a)            vos_get_context(VOS_MODULE_ID_WDA, a)
 #define VOS_GET_MAC_CTXT(a)            vos_get_context(VOS_MODULE_ID_PE, a)
 #define OFFSET_OF(structType,fldName)   (&((structType*)0)->fldName)
 #define WDA_BA_TX_FRM_THRESHOLD (5)
+
 #define  CONVERT_WDI2SIR_STATUS(x) \
    ((WDI_STATUS_SUCCESS != (x)) ? eSIR_FAILURE : eSIR_SUCCESS)
 
 #define  IS_WDI_STATUS_FAILURE(status) \
    ((WDI_STATUS_SUCCESS != (status)) && (WDI_STATUS_PENDING != (status)))
+
 #define  CONVERT_WDI2VOS_STATUS(x) \
    ((IS_WDI_STATUS_FAILURE(x)) ? VOS_STATUS_E_FAILURE  : VOS_STATUS_SUCCESS)
 
 /* macro's for acessing TL API/data structures */
-#define WDA_TL_GET_STA_STATE(a, b, c) WLANTL_GetSTAState(a, b, c)
+
 #define WDA_TL_GET_TX_PKTCOUNT(a, b, c, d) WLANTL_GetTxPktCount(a, b, c, d)
+
 #define WDA_GET_BA_TXFLAG(a, b, c)  \
    (((a)->wdaStaInfo[(b)].ucUseBaBitmap) & (1 << (c)))  
 
@@ -97,33 +116,43 @@
 
 #define WDA_CLEAR_BA_TXFLAG(a, b, c)  \
    (((a)->wdaStaInfo[b].ucUseBaBitmap) &= ~(1 << c))
+
 #define WDA_TL_BA_SESSION_ADD(a, b, c, d, e, f, g) \
    WLANTL_BaSessionAdd(a, b, c, d, e, f, g)
+
 /* timer related Macros */
 #define WDA_CREATE_TIMER(a, b, c, d, e, f, g) \
    tx_timer_create(a, b, c, d, e, f, g)
 #define WDA_START_TIMER(a) tx_timer_activate(a)
 #define WDA_STOP_TIMER(a) tx_timer_deactivate(a)
 #define WDA_DESTROY_TIMER(a) tx_timer_delete(a)
-#define WDA_WDI_START_TIMEOUT (WDI_RESPONSE_TIMEOUT + 5000)
+
+#define WDA_WDI_START_TIMEOUT 15000
 
 #define WDA_LAST_POLLED_THRESHOLD(a, curSta, tid) \
    ((a)->wdaStaInfo[curSta].framesTxed[tid] + WDA_BA_TX_FRM_THRESHOLD)
+
 #define WDA_BA_MAX_WINSIZE   (64)
+
 #define WDA_INVALID_KEY_INDEX  0xFF
+
 #define WDA_NUM_PWR_SAVE_CFG       11
+
 #define WDA_TX_COMPLETE_TIME_OUT_VALUE 1000
   
+
 #define WDA_MAX_RETRIES_TILL_RING_EMPTY  1000   /* MAX 10000 msec = 10 seconds wait */
 
 #define WDA_WAIT_MSEC_TILL_RING_EMPTY    10    /* 10 msec wait per cycle */
 /* extern declarations */
 extern void vos_WDAComplete_cback(v_PVOID_t pVosContext);
+
 /* forward declarations */
 void WDA_SendMsg(tWDA_CbContext *pWDA, tANI_U16 msgType, 
                                         void *pBodyptr, tANI_U32 bodyVal) ;
 VOS_STATUS WDA_prepareConfigTLV(v_PVOID_t pVosContext, 
                                 WDI_StartReqParamsType  *wdiStartParams ) ;
+
 VOS_STATUS WDA_wdiCompleteCB(v_PVOID_t pVosContext) ;
 VOS_STATUS WDA_ProcessSetTxPerTrackingReq(tWDA_CbContext *pWDA, tSirTxPerTrackingParam *pTxPerTrackingParams);
 
@@ -141,18 +170,22 @@
 static VOS_STATUS wdaDestroyTimers(tWDA_CbContext *pWDA);
 void WDA_BaCheckActivity(tWDA_CbContext *pWDA) ;
 void WDA_HALDumpCmdCallback(WDI_HALDumpCmdRspParamsType *wdiRspParams, void* pUserData);
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
 VOS_STATUS WDA_ProcessAggrAddTSReq(tWDA_CbContext *pWDA, tAggrAddTsParams *pAggrAddTsReqParams);
 #endif /* WLAN_FEATURE_VOWIFI_11R */
 
+
 void WDA_TimerHandler(v_VOID_t *pWDA, tANI_U32 timerInfo) ;
 void WDA_ProcessTxCompleteTimeOutInd(tWDA_CbContext* pContext) ;
 VOS_STATUS WDA_ResumeDataTx(tWDA_CbContext *pWDA);
+
 #ifdef FEATURE_WLAN_SCAN_PNO
 static VOS_STATUS WDA_ProcessSetPrefNetworkReq(tWDA_CbContext *pWDA, tSirPNOScanReq *pPNOScanReqParams);
 static VOS_STATUS WDA_ProcessSetRssiFilterReq(tWDA_CbContext *pWDA, tSirSetRSSIFilterReq* pRssiFilterParams);
 static VOS_STATUS WDA_ProcessUpdateScanParams(tWDA_CbContext *pWDA, tSirUpdateScanParams *pUpdateScanParams);
 #endif // FEATURE_WLAN_SCAN_PNO
+
 #ifdef WLAN_FEATURE_PACKET_FILTERING
 static VOS_STATUS WDA_Process8023MulticastListReq (
                                        tWDA_CbContext *pWDA,
@@ -171,9 +204,12 @@
                                tSirRcvFltPktClearParam *pRcvFltPktClearParam
                                                          );
 #endif // WLAN_FEATURE_PACKET_FILTERING
+
 VOS_STATUS WDA_ProcessSetPowerParamsReq(tWDA_CbContext *pWDA, tSirSetPowerParamsReq *pPowerParams);
+
 static VOS_STATUS WDA_ProcessTxControlInd(tWDA_CbContext *pWDA,
                                           tpTxControlParams pTxCtrlParam);
+
 VOS_STATUS WDA_GetWepKeysFromCfg( tWDA_CbContext *pWDA, 
                                                       v_U8_t *pDefaultKeyId,
                                                       v_U8_t *pNumKeys,
@@ -196,6 +232,7 @@
    tWDA_CbContext *wdaContext;
    VOS_STATUS status;
    WDI_DeviceCapabilityType wdiDevCapability = {0} ;
+
    /* Allocate WDA context */
    status = vos_alloc_context(pVosContext, VOS_MODULE_ID_WDA, 
                            (v_VOID_t **)&wdaContext, sizeof(tWDA_CbContext)) ;
@@ -203,6 +240,7 @@
    {
       return VOS_STATUS_E_NOMEM;
    }
+
    /*__asm int 3;*/
    vos_mem_zero(wdaContext,sizeof(tWDA_CbContext));
    
@@ -219,6 +257,7 @@
                 "WDI Sync Event init failed - status = %d\n", status);
       status = VOS_STATUS_E_FAILURE;
    }
+
    /* Init Frame transfer event */
    status = vos_event_init(&wdaContext->txFrameEvent);
    if(!VOS_IS_STATUS_SUCCESS(status)) 
@@ -227,6 +266,7 @@
                 "VOS Mgmt Frame Event init failed - status = %d\n", status);
       status = VOS_STATUS_E_FAILURE;
    }
+
    status = vos_event_init(&wdaContext->suspendDataTxEvent);
    if(!VOS_IS_STATUS_SUCCESS(status)) 
    {
@@ -234,6 +274,7 @@
             "VOS suspend data tx Event init failed - status = %d\n", status);
       status = VOS_STATUS_E_FAILURE;
    }
+
    status = vos_event_init(&wdaContext->waitOnWdiIndicationCallBack);
    if(!VOS_IS_STATUS_SUCCESS(status)) 
    {
@@ -241,7 +282,9 @@
             "VOS wait On Wdi Ind Event init failed - status = %d\n", status);
       status = VOS_STATUS_E_FAILURE;
    }
+
    vos_trace_setLevel(VOS_MODULE_ID_WDA,VOS_TRACE_LEVEL_ERROR);
+
    wdaContext->driverMode = pMacParams->driverType;
    if(WDI_STATUS_SUCCESS != WDI_Init(pOSContext, &wdaContext->pWdiContext, 
                                      &wdiDevCapability, pMacParams->driverType))
@@ -255,6 +298,7 @@
       pMacParams->maxStation = wdiDevCapability.ucMaxSTASupported ;
       pMacParams->maxBssId =  wdiDevCapability.ucMaxBSSSupported;
       pMacParams->frameTransRequired = wdiDevCapability.bFrameXtlSupported;
+
       /* update max STA in WDA used for BA */
       wdaContext->wdaMaxSta = pMacParams->maxStation;
       /* store the frameTransRequired flag in wdaContext, to send this to HAL 
@@ -262,9 +306,11 @@
        */
       wdaContext->frameTransRequired = wdiDevCapability.bFrameXtlSupported;
    }
+
    return status;
 }
 
+
 /*
  * FUNCTION: WDA_preStart
  * Trigger DAL-AL to start CFG download 
@@ -273,20 +319,24 @@
 {   
    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
    vos_msg_t wdaMsg = {0} ;
+
    /*
     * trigger CFG download in WDA by sending WDA_CFG_DNLD message
     */ 
    wdaMsg.type = WNI_CFG_DNLD_REQ ; 
    wdaMsg.bodyptr = NULL;
    wdaMsg.bodyval = 0;
+
    /* post the message.. */
    vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &wdaMsg );
    if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
    {
       vosStatus = VOS_STATUS_E_BADMSG;
    }
+
    return( vosStatus );
 }
+
 /*
  * FUNCTION: WDA_wdiStartCallback
  * Once WDI_Start is finished, WDI start callback will be called by WDI
@@ -297,12 +347,14 @@
 {
    tWDA_CbContext *wdaContext;
    VOS_STATUS status;
+
    if (NULL == pVosContext)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
                  "%s: Invoked with invalid pVosContext", __FUNCTION__ );
       return;
    }
+
    wdaContext = VOS_GET_WDA_CTXT(pVosContext);
    if (NULL == wdaContext)
    {
@@ -310,6 +362,7 @@
                  "%s: Invoked with invalid wdaContext", __FUNCTION__ );
       return;
    }
+
    if (WDI_STATUS_SUCCESS != wdiRspParams->wdiStatus)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
@@ -319,6 +372,7 @@
    {
       wdaContext->wdaState = WDA_START_STATE;
    }
+
    /* extract and save version information from the Start Response */
    wdaContext->wcnssWlanCompiledVersion.major =
       wdiRspParams->wlanCompiledVersion.major;
@@ -342,6 +396,7 @@
    wpalMemoryCopy(wdaContext->wcnssHardwareVersionString,
            wdiRspParams->wcnssHardwareVersion,
            sizeof(wdaContext->wcnssHardwareVersionString));
+
    /* Notify WDA_start that WDI_Start has completed */
    status = vos_event_set(&wdaContext->wdaWdiEvent);
    if (VOS_STATUS_SUCCESS != status)
@@ -349,25 +404,30 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
                  "%s: Unable to unblock WDA_start", __FUNCTION__ );
    }
+
    return;
 }
 
+
 /*
  * FUNCTION: WDA_start
  * Prepare TLV configuration and call WDI_Start.
  */
+
 VOS_STATUS WDA_start(v_PVOID_t pVosContext)
 {
    tWDA_CbContext *wdaContext;
    VOS_STATUS status;
    WDI_Status wdiStatus;
    WDI_StartReqParamsType wdiStartParam;
+
    if (NULL == pVosContext)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                  "%s: Invoked with invalid pVosContext", __FUNCTION__ );
       return VOS_STATUS_E_FAILURE;
    }
+
    wdaContext = VOS_GET_WDA_CTXT(pVosContext);
    if (NULL == wdaContext)
    {
@@ -375,6 +435,7 @@
                  "%s: Invoked with invalid wdaContext", __FUNCTION__ );
       return VOS_STATUS_E_FAILURE;
    }
+
    /* Non-FTM mode, WDA status for START must be INIT
     * FTM mode, WDA Status for START can be INIT or STOP */
    if ( (WDA_INIT_STATE != wdaContext->wdaState) &&
@@ -385,11 +446,14 @@
                  __FUNCTION__, wdaContext->wdaState );
       return VOS_STATUS_E_FAILURE;
    }
+
    /* initialize the wdiStartParam.  Note that we can create this on
       the stack since we won't exit until WDI_Start() completes or
       times out */
    vos_mem_set(&wdiStartParam, sizeof(wdiStartParam), 0);
+
    wdiStartParam.wdiDriverType = wdaContext->driverMode;
+
    /* prepare the config TLV for the WDI */
    status = WDA_prepareConfigTLV(pVosContext, &wdiStartParam);
    if ( !VOS_IS_STATUS_SUCCESS(status) )
@@ -398,13 +462,17 @@
                  "%s: Unable to prepare Config TLV", __FUNCTION__ );
       return VOS_STATUS_E_FAILURE;
    }
+
    /* note from here onwards if an error occurs we must
       reclaim the config TLV buffer */
+
    wdiStartParam.wdiLowLevelIndCB = WDA_lowLevelIndCallback;
    wdiStartParam.pIndUserData = (v_PVOID_t *)wdaContext;
    wdiStartParam.wdiReqStatusCB = NULL;
+
    /* initialize the WDA-WDI synchronization event */
    vos_event_reset(&wdaContext->wdaWdiEvent);
+
    /* call WDI start */
    wdiStatus = WDI_Start(&wdiStartParam,
                          (WDI_StartRspCb)WDA_wdiStartCallback,
@@ -416,6 +484,7 @@
       vos_mem_free(wdiStartParam.pConfigBuffer);
       return VOS_STATUS_E_FAILURE;
    }
+
    /* wait for WDI start to invoke our callback */
    status = vos_wait_single_event( &wdaContext->wdaWdiEvent,
                                    WDA_WDI_START_TIMEOUT );
@@ -435,9 +504,12 @@
       vos_mem_free(wdiStartParam.pConfigBuffer);
       return VOS_STATUS_E_FAILURE;
    }
+
    /* WDI_Start() has completed so we can resume our work */
+
    /* we no longer need the config TLV */
    vos_mem_free(wdiStartParam.pConfigBuffer);
+
    /* if we are not in the START state then WDI_Start() failed */
    if (WDA_START_STATE != wdaContext->wdaState)
    {
@@ -445,14 +517,17 @@
                  "%s: WDI_Start() failure detected", __FUNCTION__ );
       return VOS_STATUS_E_FAILURE;
    }
+
    /* FTM mode does not need to monitor BA activity */
    if ( eDRIVER_TYPE_MFG != wdaContext->driverMode )
    {
       status = wdaCreateTimers(wdaContext) ;
    }
+
    return status;
 }
 
+
 /*
  * FUNCTION: WDA_prepareConfigTLV
  * Function to prepare CFG for DAL(WDA)
@@ -470,6 +545,7 @@
    tANI_U32       configParamSize;
    tANI_U32       *configDataValue;
    WDI_WlanVersionType wcnssCompiledApiVersion;
+
    if ((NULL == pMac)||(NULL == wdaContext))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -477,6 +553,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    configParamSize = (sizeof(tHalCfg) * QWLAN_HAL_CFG_MAX_PARAMS) + 
                            WNI_CFG_STA_ID_LEN +
                            WNI_CFG_EDCA_WME_ACBK_LEN +
@@ -484,6 +561,7 @@
                            WNI_CFG_EDCA_WME_ACVI_LEN +
                            WNI_CFG_EDCA_WME_ACVO_LEN +
                            + (QWLAN_HAL_CFG_INTEGER_PARAM * sizeof(tANI_U32));
+
    /* malloc memory for all configs in one shot */ 
    configParam = vos_mem_malloc(configParamSize);
    
@@ -495,9 +573,12 @@
       return VOS_STATUS_E_NOMEM;
    }
    vos_mem_set(configParam, configParamSize, 0);
+
    wdiStartParams->pConfigBuffer = configParam;
+
    tlvStruct = (tHalCfg *)configParam;
    tlvStructStart = (tANI_U8 *)configParam;
+
    /* TODO: Remove Later */
    /* QWLAN_HAL_CFG_STA_ID */
    tlvStruct->type = QWLAN_HAL_CFG_STA_ID;
@@ -513,8 +594,10 @@
    /* calculate the pad bytes to have the CFG in aligned format */
    tlvStruct->padBytes = ALIGNED_WORD_SIZE - 
                               (tlvStruct->length & (ALIGNED_WORD_SIZE - 1));
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                + sizeof(tHalCfg) + tlvStruct->length + tlvStruct->padBytes)) ;
+
    /* QWLAN_HAL_CFG_CURRENT_TX_ANTENNA */
    tlvStruct->type = QWLAN_HAL_CFG_CURRENT_TX_ANTENNA;
    tlvStruct->length = sizeof(tANI_U32);
@@ -526,8 +609,10 @@
                           "Failed to get value for WNI_CFG_CURRENT_TX_ANTENNA");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_CURRENT_RX_ANTENNA */
    tlvStruct->type = QWLAN_HAL_CFG_CURRENT_RX_ANTENNA;
    tlvStruct->length = sizeof(tANI_U32);
@@ -539,8 +624,10 @@
                     "Failed to get value for WNI_CFG_CURRENT_RX_ANTENNA");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_LOW_GAIN_OVERRIDE */
    tlvStruct->type = QWLAN_HAL_CFG_LOW_GAIN_OVERRIDE;
    tlvStruct->length = sizeof(tANI_U32);
@@ -552,6 +639,7 @@
                     "Failed to get value for WNI_CFG_LOW_GAIN_OVERRIDE");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ;
  
@@ -566,8 +654,10 @@
                     "Failed to get value for WNI_CFG_POWER_STATE_PER_CHAIN");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)); 
+
    /* QWLAN_HAL_CFG_CAL_PERIOD */
    tlvStruct->type = QWLAN_HAL_CFG_CAL_PERIOD;
    tlvStruct->length = sizeof(tANI_U32);
@@ -579,8 +669,10 @@
                     "Failed to get value for WNI_CFG_CAL_PERIOD");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length));
+
    /* QWLAN_HAL_CFG_CAL_CONTROL  */
    tlvStruct->type = QWLAN_HAL_CFG_CAL_CONTROL ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -592,8 +684,10 @@
                     "Failed to get value for WNI_CFG_CAL_CONTROL");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length));
+
    /* QWLAN_HAL_CFG_PROXIMITY  */
    tlvStruct->type = QWLAN_HAL_CFG_PROXIMITY ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -605,8 +699,10 @@
                     "Failed to get value for WNI_CFG_PROXIMITY");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                              + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_NETWORK_DENSITY  */
    tlvStruct->type = QWLAN_HAL_CFG_NETWORK_DENSITY ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -618,8 +714,10 @@
                     "Failed to get value for WNI_CFG_NETWORK_DENSITY");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)); 
+
    /* QWLAN_HAL_CFG_MAX_MEDIUM_TIME  */
    tlvStruct->type = QWLAN_HAL_CFG_MAX_MEDIUM_TIME ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -631,8 +729,10 @@
                     "Failed to get value for WNI_CFG_MAX_MEDIUM_TIME");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)); 
+
    /* QWLAN_HAL_CFG_MAX_MPDUS_IN_AMPDU   */
    tlvStruct->type = QWLAN_HAL_CFG_MAX_MPDUS_IN_AMPDU  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -644,8 +744,10 @@
                     "Failed to get value for WNI_CFG_MAX_MPDUS_IN_AMPDU");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ;
+
    /* QWLAN_HAL_CFG_RTS_THRESHOLD   */
    tlvStruct->type = QWLAN_HAL_CFG_RTS_THRESHOLD  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -657,8 +759,10 @@
                     "Failed to get value for WNI_CFG_RTS_THRESHOLD");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length));
+
    /* QWLAN_HAL_CFG_SHORT_RETRY_LIMIT   */
    tlvStruct->type = QWLAN_HAL_CFG_SHORT_RETRY_LIMIT  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -670,8 +774,10 @@
                     "Failed to get value for WNI_CFG_SHORT_RETRY_LIMIT");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_LONG_RETRY_LIMIT   */
    tlvStruct->type = QWLAN_HAL_CFG_LONG_RETRY_LIMIT  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -683,8 +789,10 @@
                     "Failed to get value for WNI_CFG_LONG_RETRY_LIMIT");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ;
+
    /* QWLAN_HAL_CFG_FRAGMENTATION_THRESHOLD   */
    tlvStruct->type = QWLAN_HAL_CFG_FRAGMENTATION_THRESHOLD  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -696,8 +804,10 @@
                     "Failed to get value for WNI_CFG_FRAGMENTATION_THRESHOLD");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ;
+
    /* QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_ZERO   */
    tlvStruct->type = QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_ZERO  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -709,6 +819,7 @@
                     "Failed to get value for WNI_CFG_DYNAMIC_THRESHOLD_ZERO");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length));
  
@@ -723,8 +834,10 @@
                     "Failed to get value for WNI_CFG_DYNAMIC_THRESHOLD_ONE");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)); 
+
    /* QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_TWO   */
    tlvStruct->type = QWLAN_HAL_CFG_DYNAMIC_THRESHOLD_TWO  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -736,6 +849,7 @@
                     "Failed to get value for WNI_CFG_DYNAMIC_THRESHOLD_TWO");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length));
  
@@ -750,6 +864,7 @@
                     "Failed to get value for WNI_CFG_FIXED_RATE");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length));
  
@@ -764,6 +879,7 @@
                     "Failed to get value for WNI_CFG_RETRYRATE_POLICY");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length));
  
@@ -778,8 +894,10 @@
                     "Failed to get value for WNI_CFG_RETRYRATE_SECONDARY");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_RETRYRATE_TERTIARY   */
    tlvStruct->type = QWLAN_HAL_CFG_RETRYRATE_TERTIARY  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -793,6 +911,7 @@
    }
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_FORCE_POLICY_PROTECTION   */
    tlvStruct->type = QWLAN_HAL_CFG_FORCE_POLICY_PROTECTION  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -804,8 +923,10 @@
                     "Failed to get value for WNI_CFG_FORCE_POLICY_PROTECTION");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length); 
+
    /* QWLAN_HAL_CFG_FIXED_RATE_MULTICAST_24GHZ   */
    tlvStruct->type = QWLAN_HAL_CFG_FIXED_RATE_MULTICAST_24GHZ  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -817,8 +938,10 @@
                  "Failed to get value for WNI_CFG_FIXED_RATE_MULTICAST_24GHZ");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length); 
+
    /* QWLAN_HAL_CFG_FIXED_RATE_MULTICAST_5GHZ   */
    tlvStruct->type = QWLAN_HAL_CFG_FIXED_RATE_MULTICAST_5GHZ  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -830,6 +953,7 @@
                  "Failed to get value for WNI_CFG_FIXED_RATE_MULTICAST_5GHZ");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length); 
    
@@ -845,6 +969,7 @@
                     "Failed to get value for WNI_CFG_DEFAULT_RATE_INDEX_24GHZ");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length); 
 #endif
@@ -859,8 +984,10 @@
                     "Failed to get value for WNI_CFG_DEFAULT_RATE_INDEX_5GHZ");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                              + sizeof(tHalCfg) + tlvStruct->length); 
+
    /* QWLAN_HAL_CFG_MAX_BA_SESSIONS   */
    tlvStruct->type = QWLAN_HAL_CFG_MAX_BA_SESSIONS  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -872,6 +999,7 @@
                     "Failed to get value for WNI_CFG_MAX_BA_SESSIONS");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                              + sizeof(tHalCfg) + tlvStruct->length);
  
@@ -886,8 +1014,10 @@
                "Failed to get value for WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                              + sizeof(tHalCfg) + tlvStruct->length); 
+
    /* QWLAN_HAL_CFG_PS_ENABLE_BCN_FILTER   */
    tlvStruct->type = QWLAN_HAL_CFG_PS_ENABLE_BCN_FILTER  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -899,8 +1029,10 @@
                     "Failed to get value for WNI_CFG_PS_ENABLE_BCN_FILTER");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                              + sizeof(tHalCfg) + tlvStruct->length); 
+
    /* QWLAN_HAL_CFG_PS_ENABLE_RSSI_MONITOR   */
    tlvStruct->type = QWLAN_HAL_CFG_PS_ENABLE_RSSI_MONITOR  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -912,8 +1044,10 @@
                     "Failed to get value for WNI_CFG_PS_ENABLE_RSSI_MONITOR");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                               + sizeof(tHalCfg) + tlvStruct->length); 
+
    /* QWLAN_HAL_CFG_NUM_BEACON_PER_RSSI_AVERAGE   */
    tlvStruct->type = QWLAN_HAL_CFG_NUM_BEACON_PER_RSSI_AVERAGE  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -925,6 +1059,7 @@
                 "Failed to get value for WNI_CFG_NUM_BEACON_PER_RSSI_AVERAGE");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                               + sizeof(tHalCfg) + tlvStruct->length);
  
@@ -939,8 +1074,10 @@
                     "Failed to get value for WNI_CFG_STATS_PERIOD");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                                + sizeof(tHalCfg) + tlvStruct->length); 
+
    /* QWLAN_HAL_CFG_CFP_MAX_DURATION   */
    tlvStruct->type = QWLAN_HAL_CFG_CFP_MAX_DURATION  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -952,16 +1089,20 @@
                     "Failed to get value for WNI_CFG_CFP_MAX_DURATION");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /* QWLAN_HAL_CFG_FRAME_TRANS_ENABLED */
    tlvStruct->type = QWLAN_HAL_CFG_FRAME_TRANS_ENABLED  ;
    tlvStruct->length = sizeof(tANI_U32);
    configDataValue = (tANI_U32 *)(tlvStruct + 1);
    vos_mem_copy(configDataValue, &wdaContext->frameTransRequired, 
                                                sizeof(tANI_U32));
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /* QWLAN_HAL_CFG_DTIM_PERIOD */
    tlvStruct->type = QWLAN_HAL_CFG_DTIM_PERIOD  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -973,8 +1114,10 @@
                     "Failed to get value for WNI_CFG_DTIM_PERIOD");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /* QWLAN_HAL_CFG_EDCA_WMM_ACBK */
    tlvStruct->type = QWLAN_HAL_CFG_EDCA_WMM_ACBK  ;
    strLength = WNI_CFG_EDCA_WME_ACBK_LEN;
@@ -990,8 +1133,10 @@
    /* calculate the pad bytes to have the CFG in aligned format */
    tlvStruct->padBytes = ALIGNED_WORD_SIZE - 
                               (tlvStruct->length & (ALIGNED_WORD_SIZE - 1));
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                  + sizeof(tHalCfg) + tlvStruct->length + tlvStruct->padBytes) ; 
+
    /* QWLAN_HAL_CFG_EDCA_WMM_ACBE */
    tlvStruct->type = QWLAN_HAL_CFG_EDCA_WMM_ACBE  ;
    strLength = WNI_CFG_EDCA_WME_ACBE_LEN;
@@ -1007,8 +1152,10 @@
    /* calculate the pad bytes to have the CFG in aligned format */
    tlvStruct->padBytes = ALIGNED_WORD_SIZE - 
                               (tlvStruct->length & (ALIGNED_WORD_SIZE - 1));
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                  + sizeof(tHalCfg) + tlvStruct->length + tlvStruct->padBytes) ; 
+
    /* QWLAN_HAL_CFG_EDCA_WMM_ACVI */
    tlvStruct->type = QWLAN_HAL_CFG_EDCA_WMM_ACVO  ;
    strLength = WNI_CFG_EDCA_WME_ACVI_LEN;
@@ -1024,8 +1171,10 @@
    /* calculate the pad bytes to have the CFG in aligned format */
    tlvStruct->padBytes = ALIGNED_WORD_SIZE - 
                               (tlvStruct->length & (ALIGNED_WORD_SIZE - 1));
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                  + sizeof(tHalCfg) + tlvStruct->length + tlvStruct->padBytes) ; 
+
    /* QWLAN_HAL_CFG_EDCA_WMM_ACVO */
    tlvStruct->type = QWLAN_HAL_CFG_EDCA_WMM_ACVI  ;
    strLength = WNI_CFG_EDCA_WME_ACVO_LEN;
@@ -1041,8 +1190,10 @@
    /* calculate the pad bytes to have the CFG in aligned format */
    tlvStruct->padBytes = ALIGNED_WORD_SIZE - 
                               (tlvStruct->length & (ALIGNED_WORD_SIZE - 1));
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                  + sizeof(tHalCfg) + tlvStruct->length + tlvStruct->padBytes) ; 
+
    /* QWLAN_HAL_CFG_BA_THRESHOLD_HIGH */
    tlvStruct->type = QWLAN_HAL_CFG_BA_THRESHOLD_HIGH  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1054,8 +1205,10 @@
                     "Failed to get value for WNI_CFG_BA_THRESHOLD_HIGH");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /* QWLAN_HAL_CFG_MAX_BA_BUFFERS */
    tlvStruct->type = QWLAN_HAL_CFG_MAX_BA_BUFFERS  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1067,8 +1220,10 @@
                     "Failed to get value for WNI_CFG_MAX_BA_BUFFERS");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /* QWLAN_HAL_CFG_DYNAMIC_PS_POLL_VALUE */
    tlvStruct->type = QWLAN_HAL_CFG_DYNAMIC_PS_POLL_VALUE  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1080,8 +1235,10 @@
                     "Failed to get value for WNI_CFG_DYNAMIC_PS_POLL_VALUE");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /* QWLAN_HAL_CFG_TELE_BCN_TRANS_LI */
    tlvStruct->type = QWLAN_HAL_CFG_TELE_BCN_TRANS_LI  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1095,6 +1252,7 @@
    }
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /* QWLAN_HAL_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS */
    tlvStruct->type = QWLAN_HAL_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1108,6 +1266,7 @@
    }
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /* QWLAN_HAL_CFG_TELE_BCN_MAX_LI */
    tlvStruct->type = QWLAN_HAL_CFG_TELE_BCN_MAX_LI  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1121,6 +1280,7 @@
    }
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /* QWLAN_HAL_CFG_TELE_BCN_MAX_LI_IDLE_BCNS */
    tlvStruct->type = QWLAN_HAL_CFG_TELE_BCN_MAX_LI_IDLE_BCNS  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1134,6 +1294,7 @@
    }
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /* QWLAN_HAL_CFG_TELE_BCN_WAKEUP_EN */
    tlvStruct->type = QWLAN_HAL_CFG_TELE_BCN_WAKEUP_EN  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1147,6 +1308,7 @@
    }
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /* QWLAN_HAL_CFG_INFRA_STA_KEEP_ALIVE_PERIOD */
    tlvStruct->type = QWLAN_HAL_CFG_INFRA_STA_KEEP_ALIVE_PERIOD  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1158,8 +1320,10 @@
                     "Failed to get value for WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
+
    /*QWLAN_HAL_CFG_TX_PWR_CTRL_ENABLE*/
    tlvStruct->type = QWLAN_HAL_CFG_TX_PWR_CTRL_ENABLE  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1171,8 +1335,10 @@
                     "Failed to get value for WNI_CFG_TX_PWR_CTRL_ENABLE");
       goto handle_failure;
    }
+
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ;
+
    /* QWLAN_HAL_CFG_ENABLE_CLOSE_LOOP   */
    tlvStruct->type = QWLAN_HAL_CFG_ENABLE_CLOSE_LOOP  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1184,149 +1350,9 @@
                     "Failed to get value for WNI_CFG_ENABLE_CLOSE_LOOP");
       goto handle_failure;
    }
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-   /* [COEX] strictly speaking, the Coex parameters are not part of the WLAN_CFG_FILE binary, 
-   * but are from the WLAN_INI_FILE file.  However, this is the only parameter download routine
-   * into FW, so the parameters are added here.
-   */
-   /* [COEX] QWLAN_HAL_CFG_BTC_EXECUTION_MODE */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_EXECUTION_MODE  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcExecutionMode; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-   /* [COEX] QWLAN_HAL_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcConsBtSlotsToBlockDuringDhcp; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-   /* [COEX] QWLAN_HAL_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcA2DPBtSubIntervalsDuringDhcp; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-   /* [COEX] QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_BT */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_BT  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcStaticLenInqBt; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
 
-   /* [COEX] QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_BT */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_BT  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcStaticLenPageBt; 
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* [COEX] QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_BT */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_BT  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcStaticLenConnBt; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* [COEX] QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_BT */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_BT  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcStaticLenLeBt; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* [COEX] QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_WLAN */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_WLAN  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcStaticLenInqWlan; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* [COEX] QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_WLAN */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_WLAN  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcStaticLenPageWlan; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* [COEX] QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_WLAN */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_WLAN  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcStaticLenConnWlan; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* [COEX] QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_WLAN */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_WLAN  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcStaticLenLeWlan; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* [COEX] QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_BT */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_BT  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcDynMaxLenBt; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* [COEX] QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_WLAN */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_WLAN  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcDynMaxLenWlan; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* [COEX] QWLAN_HAL_CFG_BTC_MAX_SCO_BLOCK_PERC */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_MAX_SCO_BLOCK_PERC  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcMaxScoBlockPerc; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* [COEX] QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_A2DP */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_A2DP  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcDhcpProtOnA2dp; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* [COEX] QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_SCO */
-   tlvStruct->type = QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_SCO  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   *configDataValue = pMac->btc.btcConfig.btcDhcpProtOnSco; 
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
-   /* QWLAN_HAL_CFG_WCNSS_API_VERSION */
-   tlvStruct->type = QWLAN_HAL_CFG_WCNSS_API_VERSION  ;
-   tlvStruct->length = sizeof(tANI_U32);
-   configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   WDI_GetWcnssCompiledApiVersion(&wcnssCompiledApiVersion);
-   *configDataValue = WLAN_HAL_CONSTRUCT_API_VERSION(wcnssCompiledApiVersion.major,
-                                      wcnssCompiledApiVersion.minor,
-                                      wcnssCompiledApiVersion.version,
-                                      wcnssCompiledApiVersion.revision);
-   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
-                            + sizeof(tHalCfg) + tlvStruct->length) ; 
-
    /* QWLAN_HAL_CFG_AP_KEEPALIVE_TIMEOUT   */
    tlvStruct->type = QWLAN_HAL_CFG_AP_KEEPALIVE_TIMEOUT  ;
    tlvStruct->length = sizeof(tANI_U32);
@@ -1356,25 +1382,53 @@
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
 
-   /* QWLAN_HAL_CFG_ENABLE_MC_ADDR_LIST */
-   tlvStruct->type = QWLAN_HAL_CFG_ENABLE_MC_ADDR_LIST;
+   /* [COEX] strictly speaking, the Coex parameters are not part of the WLAN_CFG_FILE binary, 
+   * but are from the WLAN_INI_FILE file.  However, this is the only parameter download routine
+   * into FW, so the parameters are added here.
+   */
+
+   /* [COEX] QWLAN_HAL_CFG_BTC_EXECUTION_MODE */
+   tlvStruct->type = QWLAN_HAL_CFG_BTC_EXECUTION_MODE  ;
    tlvStruct->length = sizeof(tANI_U32);
    configDataValue = (tANI_U32 *)(tlvStruct + 1);
-   if(wlan_cfgGetInt(pMac, WNI_CFG_ENABLE_MC_ADDR_LIST, configDataValue) 
-                                                      != eSIR_SUCCESS)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                    "Failed to get value for WNI_CFG_ENABLE_MC_ADDR_LIST");
-      goto handle_failure;
-   }
+   *configDataValue = pMac->btc.btcConfig.btcExecutionMode; 
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
 
+   /* [COEX] QWLAN_HAL_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK */
+   tlvStruct->type = QWLAN_HAL_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = pMac->btc.btcConfig.btcConsBtSlotsToBlockDuringDhcp; 
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* [COEX] QWLAN_HAL_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS */
+   tlvStruct->type = QWLAN_HAL_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   *configDataValue = pMac->btc.btcConfig.btcA2DPBtSubIntervalsDuringDhcp; 
+   tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
+                            + sizeof(tHalCfg) + tlvStruct->length) ; 
+
+   /* [COEX] QWLAN_HAL_CFG_WCNSS_API_VERSION */
+   tlvStruct->type = QWLAN_HAL_CFG_WCNSS_API_VERSION  ;
+   tlvStruct->length = sizeof(tANI_U32);
+   configDataValue = (tANI_U32 *)(tlvStruct + 1);
+   WDI_GetWcnssCompiledApiVersion(&wcnssCompiledApiVersion);
+   *configDataValue = WLAN_HAL_CONSTRUCT_API_VERSION(wcnssCompiledApiVersion.major,
+                                      wcnssCompiledApiVersion.minor,
+                                      wcnssCompiledApiVersion.version,
+                                      wcnssCompiledApiVersion.revision);
    tlvStruct = (tHalCfg *)( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length) ; 
 
    wdiStartParams->usConfigBufferLen = (tANI_U8 *)tlvStruct - tlvStructStart ;
+
 #ifdef WLAN_DEBUG
    {
       int i;
+
        VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                     "****** Dumping CFG TLV ***** ");
       for (i=0; (i+7) < wdiStartParams->usConfigBufferLen; i+=8)
@@ -1400,11 +1454,14 @@
                     "**************************** ");
    }
 #endif
+
    return VOS_STATUS_SUCCESS ;
+
 handle_failure:
    vos_mem_free(configParam);
    return VOS_STATUS_E_FAILURE;
 }
+
 /*
  * FUNCTION: WDA_wdiCompleteCB
  * call the voss call back function
@@ -1412,18 +1469,21 @@
 void WDA_stopCallback(WDI_Status status, v_PVOID_t *pVosContext)
 {
    tWDA_CbContext *wdaContext= (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
+
    if (NULL == wdaContext)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                  "%s: Invoked with invalid wdaContext", __FUNCTION__ );
       return ;
    }
+
    /* free the config structure */
    if(wdaContext->wdaWdiApiMsgParam != NULL)
    {
       vos_mem_free(wdaContext->wdaWdiApiMsgParam);
       wdaContext->wdaWdiApiMsgParam = NULL;
    }
+
    if(WDI_STATUS_SUCCESS != status)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -1434,20 +1494,25 @@
    {
       wdaContext->wdaState = WDA_STOP_STATE;
    }
+
    /* Indicate VOSS about the start complete */
    vos_WDAComplete_cback(pVosContext);
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_stop
  * call WDI_stop
  */ 
+
 VOS_STATUS WDA_stop(v_PVOID_t pVosContext, tANI_U8 reason)
 {
    WDI_Status wdiStatus;
    VOS_STATUS status = VOS_STATUS_SUCCESS;
    WDI_StopReqParamsType *wdiStopReq;
    tWDA_CbContext *pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
+
    if (NULL == pWDA)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -1455,6 +1520,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    /* FTM mode stay START_STATE */
    if( (WDA_READY_STATE != pWDA->wdaState) &&
        (WDA_INIT_STATE != pWDA->wdaState) &&
@@ -1462,6 +1528,7 @@
    {
       VOS_ASSERT(0);
    }
+
    wdiStopReq = (WDI_StopReqParamsType *)
                             vos_mem_malloc(sizeof(WDI_StopReqParamsType));
    if(NULL == wdiStopReq)
@@ -1471,8 +1538,10 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiStopReq->wdiStopReason = reason;
    wdiStopReq->wdiReqStatusCB = NULL;
+
    if(NULL != pWDA->wdaWdiApiMsgParam)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -1481,14 +1550,17 @@
       vos_mem_free(wdiStopReq);
       return VOS_STATUS_E_FAILURE;
    }
+
    if ( eDRIVER_TYPE_MFG != pWDA->driverMode )
    {
       wdaDestroyTimers(pWDA);
    }
    pWDA->wdaWdiApiMsgParam = (v_PVOID_t *)wdiStopReq;
+
    /* call WDI stop */
    wdiStatus = WDI_Stop(wdiStopReq,
                            (WDI_StopRspCb)WDA_stopCallback, pVosContext);
+
    if (IS_WDI_STATUS_FAILURE(wdiStatus) )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -1497,8 +1569,10 @@
       pWDA->wdaWdiApiMsgParam = NULL;
       status = VOS_STATUS_E_FAILURE;
    }
+
    return status;
 }
+
 /*
  * FUNCTION: WDA_close
  * call WDI_close and free the WDA context
@@ -1509,24 +1583,29 @@
    WDI_Status wstatus;
    VOS_STATUS vstatus;
    tWDA_CbContext *wdaContext= (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
+
    if (NULL == wdaContext)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                  "%s: Invoked with invalid wdaContext", __FUNCTION__ );
       return VOS_STATUS_E_FAILURE;
    }
+
    if((WDA_INIT_STATE != wdaContext->wdaState) && 
                               (WDA_STOP_STATE != wdaContext->wdaState))
    {
       VOS_ASSERT(0);
    }
+
    /*call WDI close*/
    wstatus = WDI_Close();
    if ( wstatus != WDI_STATUS_SUCCESS )
    {
       status = VOS_STATUS_E_FAILURE;
    }
+
    wdaContext->wdaState = WDA_CLOSE_STATE;
+
    /* Destroy the events */
    vstatus = vos_event_destroy(&wdaContext->wdaWdiEvent);
    if(!VOS_IS_STATUS_SUCCESS(vstatus)) 
@@ -1557,6 +1636,7 @@
                   "VOS Event destroy failed - status = %d\n", status);
       status = VOS_STATUS_E_FAILURE;
    }
+
    /* free WDA context */
    vstatus = vos_free_context(pVosContext, VOS_MODULE_ID_WDA, wdaContext);
    if ( !VOS_IS_STATUS_SUCCESS(vstatus) )
@@ -1567,6 +1647,7 @@
    }
    return status;
 }
+
 /*
  * FUNCTION: WDA_IsWcnssWlanCompiledVersionGreaterThanOrEqual
  * returns 1 if the compiled version is greater than or equal to the input version
@@ -1577,7 +1658,9 @@
     VOS_STATUS status = VOS_STATUS_SUCCESS;
     v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_WDA, NULL);
     tSirVersionType compiledVersion;
+
     status = WDA_GetWcnssWlanCompiledVersion(vosContext, &compiledVersion);
+
     if ((compiledVersion.major > major) || ((compiledVersion.major == major)&& (compiledVersion.minor > minor)) ||
         ((compiledVersion.major == major)&& (compiledVersion.minor == minor) &&(compiledVersion.version > version)) ||
         ((compiledVersion.major == major)&& (compiledVersion.minor == minor) &&(compiledVersion.version == version) &&
@@ -1586,16 +1669,20 @@
     else
         return 0;
 }
+
 /*
  * FUNCTION: WDA_IsWcnssWlanReportedVersionGreaterThanOrEqual
  * returns 1 if the compiled version is greater than or equal to the input version
  */ 
+
 uint8 WDA_IsWcnssWlanReportedVersionGreaterThanOrEqual(uint8 major, uint8 minor, uint8 version, uint8 revision)
 {    
     VOS_STATUS status = VOS_STATUS_SUCCESS;
     v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_WDA, NULL);
     tSirVersionType reportedVersion;
+
     status = WDA_GetWcnssWlanReportedVersion(vosContext, &reportedVersion);
+
     if ((reportedVersion.major > major) || ((reportedVersion.major == major)&& (reportedVersion.minor > minor)) ||
         ((reportedVersion.major == major)&& (reportedVersion.minor == minor) &&(reportedVersion.version > version)) ||
         ((reportedVersion.major == major)&& (reportedVersion.minor == minor) &&(reportedVersion.version == version) &&
@@ -1604,6 +1691,7 @@
     else
         return 0;
 }
+
 /*
  * FUNCTION: WDA_GetWcnssWlanCompiledVersion
  * Returns the version of the WCNSS WLAN API with which the HOST
@@ -1613,8 +1701,10 @@
                                            tSirVersionType *pVersion)
 {
    tWDA_CbContext *pWDA;
+
    VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
              "%s: Entered", __FUNCTION__);
+
    if ((NULL == pvosGCtx) || (NULL == pVersion))
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -1622,6 +1712,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pvosGCtx);
    if (NULL == pWDA )
    {
@@ -1630,9 +1721,11 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    *pVersion = pWDA->wcnssWlanCompiledVersion;
    return VOS_STATUS_SUCCESS;
 }
+
 /*
  * FUNCTION: WDA_GetWcnssWlanReportedVersion
  * Returns the version of the WCNSS WLAN API with which the WCNSS
@@ -1642,8 +1735,10 @@
                                            tSirVersionType *pVersion)
 {
    tWDA_CbContext *pWDA;
+
    VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
              "%s: Entered", __FUNCTION__);
+
    if ((NULL == pvosGCtx) || (NULL == pVersion))
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -1651,6 +1746,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pvosGCtx);
    if (NULL == pWDA )
    {
@@ -1659,9 +1755,11 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    *pVersion = pWDA->wcnssWlanReportedVersion;
    return VOS_STATUS_SUCCESS;
 }
+
 /*
  * FUNCTION: WDA_GetWcnssSoftwareVersion
  * Returns the WCNSS Software version string
@@ -1671,8 +1769,10 @@
                                        tANI_U32 versionBufferSize)
 {
    tWDA_CbContext *pWDA;
+
    VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
              "%s: Entered", __FUNCTION__);
+
    if ((NULL == pvosGCtx) || (NULL == pVersion))
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -1680,6 +1780,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pvosGCtx);
    if (NULL == pWDA )
    {
@@ -1688,9 +1789,11 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    wpalMemoryCopy(pVersion, pWDA->wcnssSoftwareVersionString, versionBufferSize);
    return VOS_STATUS_SUCCESS;
 }
+
 /*
  * FUNCTION: WDA_GetWcnssHardwareVersion
  * Returns the WCNSS Hardware version string
@@ -1700,8 +1803,10 @@
                                        tANI_U32 versionBufferSize)
 {
    tWDA_CbContext *pWDA;
+
    VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
              "%s: Entered", __FUNCTION__);
+
    if ((NULL == pvosGCtx) || (NULL == pVersion))
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -1709,6 +1814,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pvosGCtx);
    if (NULL == pWDA )
    {
@@ -1717,9 +1823,11 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    wpalMemoryCopy(pVersion, pWDA->wcnssHardwareVersionString, versionBufferSize);
    return VOS_STATUS_SUCCESS;
 }
+
 /*
  * FUNCTION: WDA_WniCfgDnld
  * Trigger CFG Download
@@ -1727,13 +1835,17 @@
 VOS_STATUS WDA_WniCfgDnld(tWDA_CbContext *pWDA) 
 {
    tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
+
    VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
+
    v_VOID_t *pFileImage = NULL;
    v_SIZE_t cbFileImageSize = 0;
+
    v_VOID_t *pCfgBinary = NULL;
    v_SIZE_t cbCfgBinarySize = 0;
    
    v_BOOL_t bStatus = VOS_FALSE;
+
    if (NULL == pMac )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -1741,6 +1853,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    /* get the number of bytes in the CFG Binary... */
    vosStatus = vos_get_binary_blob( VOS_BINARY_ID_CONFIG, NULL, 
                                                 &cbFileImageSize );
@@ -1750,13 +1863,16 @@
                  "Error obtaining binary size" );
       goto fail;
    }
+
    // malloc a buffer to read in the Configuration binary file.
    pFileImage = vos_mem_malloc( cbFileImageSize );
+
    if ( NULL == pFileImage )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
               "Unable to allocate memory for the CFG binary [size= %d bytes]",
                  cbFileImageSize );
+
       vosStatus = VOS_STATUS_E_NOMEM;
       goto fail;
    }
@@ -1785,11 +1901,13 @@
       vosStatus = VOS_STATUS_E_FAILURE;
       goto fail;
    }
+
    /*
     * TODO: call the config download function 
     * for now calling the existing cfg download API 
     */
    processCfgDownloadReq(pMac,cbCfgBinarySize,pCfgBinary);
+
    if( pFileImage != NULL )
    {
       vos_mem_free( pFileImage );
@@ -1802,10 +1920,12 @@
    
    return vosStatus;
 }
+
 /* -----------------------------------------------------------------
  * WDI interface 
  * -----------------------------------------------------------------
  */
+
 /*
  * FUNCTION: WDA_suspendDataTxCallback
  * call back function called from TL after suspend Transmission
@@ -1815,8 +1935,10 @@
                                             VOS_STATUS     vosStatus)
 {
    tWDA_CbContext *pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pvosGCtx);
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                       "%s: Entered " ,__FUNCTION__);
+
    if (NULL == pWDA )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -1832,6 +1954,7 @@
    {
       pWDA->txStatus = WDA_TL_TX_SUSPEND_FAILURE;        
    }
+
    /* Trigger the event to bring the WDA TL suspend function to come 
     * out of wait*/
    vosStatus = vos_event_set(&pWDA->suspendDataTxEvent);
@@ -1840,6 +1963,7 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
                       "NEW VOS Event Set failed - status = %d \n", vosStatus);
    }
+
    /* If TL suspended had timedout before this callback was called, resume back 
    * TL.*/
    if (pWDA->txSuspendTimedOut) 
@@ -1849,8 +1973,10 @@
       WDA_ResumeDataTx(pWDA);
       pWDA->txSuspendTimedOut = FALSE;
    }
+
    return VOS_STATUS_SUCCESS;
 }
+
 /*
  * FUNCTION: WDA_suspendDataTx
  * Update TL to suspend the data Transmission
@@ -1863,13 +1989,16 @@
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                       "%s: Entered " ,__FUNCTION__);
+
    pWDA->txStatus = WDA_TL_TX_SUSPEND_FAILURE;
+
    if (pWDA->txSuspendTimedOut) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
          "TL suspend timedout previously, CB not called yet\n");
         return status;
    }
+
    /* Reset the event to be not signalled */
    status = vos_event_reset(&pWDA->suspendDataTxEvent);
    if(!VOS_IS_STATUS_SUCCESS(status))
@@ -1878,6 +2007,7 @@
                             "VOS Event reset failed - status = %d\n",status);
       return VOS_STATUS_E_FAILURE;
    }
+
    /*Indicate TL to suspend transmission for all Sta Id */
    ucSTAId = WLAN_ALL_STA;
    status = WLANTL_SuspendDataTx(pWDA->pVosContext, &ucSTAId,
@@ -1886,6 +2016,7 @@
    {
       return status;
    }
+
    /* Wait for the event to be set by the TL, to get the response of 
     * suspending the TX queues, this event should be set by the Callback 
     * function called by TL*/
@@ -1905,12 +2036,15 @@
    {
       pWDA->txSuspendTimedOut = FALSE;
    }
+
    if(WDA_TL_TX_SUSPEND_SUCCESS == pWDA->txStatus)
    {
       status = VOS_STATUS_SUCCESS;
    }
+
    return status;
 }
+
 /*
  * FUNCTION: WDA_resumeDataTx
  * Update TL to resume the data Transmission
@@ -1926,6 +2060,7 @@
    status = WLANTL_ResumeDataTx(pWDA->pVosContext, &ucSTAId);
    return status;
 }
+
 /*
  * FUNCTION: WDA_InitScanReqCallback
  * Trigger Init SCAN callback
@@ -1936,6 +2071,7 @@
    tWDA_CbContext *pWDA; 
    tInitScanParams *pWDA_ScanParam ;
    VOS_STATUS      status;      
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
    if(NULL == pWdaParams)
@@ -1947,33 +2083,38 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    pWDA_ScanParam = (tInitScanParams *)pWdaParams->wdaMsgParam;
+
    if(NULL == pWDA_ScanParam)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                   "%s: pWDA_ScanParam received NULL", __FUNCTION__);
-      VOS_ASSERT(0);
-	  vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-	  vos_mem_free(pWdaParams);
+      VOS_ASSERT(0) ;
       return ;
    }
+
    if(WDI_STATUS_SUCCESS != wdiStatus)
    {
       status = WDA_ResumeDataTx(pWDA) ;
+
       if(VOS_STATUS_SUCCESS != status)
       {
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                                   "%s error in Resume Tx ", __FUNCTION__ );
       }
    }
+
    /* free WDI command buffer */
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
+
    vos_mem_free(pWdaParams) ;
-   
+
    
    /* assign status to scan params */
    pWDA_ScanParam->status = CONVERT_WDI2SIR_STATUS(wdiStatus) ;
+
    /* send SCAN RSP message back to PE */
    WDA_SendMsg(pWDA, WDA_INIT_SCAN_RSP, (void *)pWDA_ScanParam, 0) ;
+
    return ;
 }
   
@@ -1993,6 +2134,7 @@
    
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiInitScanParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2000,6 +2142,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -2026,6 +2169,7 @@
 #endif
    wdiInitScanParam->wdiReqInfo.wdiScanEntry.activeBSScnt = 
                                      initScanParams->scanEntry.activeBSScnt ;
+
    for (i=0; i < initScanParams->scanEntry.activeBSScnt; i++)
    {
        wdiInitScanParam->wdiReqInfo.wdiScanEntry.bssIdx[i] = 
@@ -2040,41 +2184,52 @@
    } 
    wdiInitScanParam->wdiReqStatusCB = NULL ;
 
+
    /* Store Init Req pointer, as this will be used for response */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = initScanParams;
    pWdaParams->wdaWdiApiMsgParam = wdiInitScanParam;
+
    /* first try to suspend TX */
    status = WDA_SuspendDataTx(pWDA) ;
+
    if(WDI_STATUS_SUCCESS != status)
    {
       goto handleWdiFailure;
    }
+
    /* call DAL API to pass init scan request to DAL */
    status = WDI_InitScanReq(wdiInitScanParam, 
                         WDA_InitScanReqCallback, pWdaParams) ;
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                                "error in WDA Init Scan, Resume Tx " );
       status = WDA_ResumeDataTx(pWDA) ;
+
       VOS_ASSERT(0) ;
   
       goto handleWdiFailure;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
+
 handleWdiFailure:
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                       "Failure in WDI Api, free all the memory " );
    /* free WDI command buffer */
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    /* send Failure to PE */
    initScanParams->status = eSIR_FAILURE ;
    WDA_SendMsg(pWDA, WDA_INIT_SCAN_RSP, (void *)initScanParams, 0) ;
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
 
+
 /*
  * FUNCTION: WDA_StartScanReqCallback
  * send Start SCAN RSP back to PE
@@ -2087,6 +2242,7 @@
    tStartScanParams *pWDA_ScanParam;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2096,33 +2252,38 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    pWDA_ScanParam = (tStartScanParams *)pWdaParams->wdaMsgParam;
+
    if(NULL == pWDA_ScanParam)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                    "%s: pWDA_ScanParam received NULL", __FUNCTION__);
       VOS_ASSERT(0) ;
-	  vos_mem_free(pWdaParams);
       return ;
    }
+
    if(NULL == pWdaParams->wdaWdiApiMsgParam)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                   "%s: wdaWdiApiMsgParam is NULL", __FUNCTION__);
       VOS_ASSERT(0) ;
-	  vos_mem_free(pWdaParams);
       return ;
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
-   
+
    
    /* assign status to scan params */
    pWDA_ScanParam->status = CONVERT_WDI2SIR_STATUS(pScanRsp->wdiStatus) ;
+
    /* send SCAN RSP message back to PE */
    WDA_SendMsg(pWDA, WDA_START_SCAN_RSP, (void *)pWDA_ScanParam, 0) ;
+
    return ;
 }
 
+
+
 /*
  * FUNCTION: WDA_ProcessStartScanReq
  * Trigger start SCAN in WDI
@@ -2135,8 +2296,10 @@
                             (WDI_StartScanReqParamsType *)vos_mem_malloc(
                                           sizeof(WDI_StartScanReqParamsType)) ;
    tWDA_ReqParams *pWdaParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiStartScanParams) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2153,18 +2316,22 @@
       vos_mem_free(wdiStartScanParams);
       return VOS_STATUS_E_NOMEM;
    }
+
    /* Copy init Scan params to WDI structure */
    wdiStartScanParams->ucChannel = startScanParams->scanChannel ;
    wdiStartScanParams->wdiReqStatusCB = NULL ;
 
+
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = startScanParams;
    pWdaParams->wdaWdiApiMsgParam = wdiStartScanParams;
+
    /* call DAL API to pass init scan request to DAL */
    status = WDI_StartScanReq(wdiStartScanParams, 
                               WDA_StartScanReqCallback, pWdaParams) ;
+
    /* failure returned by WDI API */
    if(IS_WDI_STATUS_FAILURE(status))
    {
@@ -2176,8 +2343,10 @@
       startScanParams->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_START_SCAN_RSP, (void *)startScanParams, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_EndScanReqCallback
  * END SCAN callback
@@ -2189,6 +2358,7 @@
    tEndScanParams *endScanParam;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                              "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2198,26 +2368,28 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    endScanParam = (tEndScanParams *)pWdaParams->wdaMsgParam;
+
    if(NULL == endScanParam)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                    "%s: endScanParam received NULL", __FUNCTION__);
       VOS_ASSERT(0) ;
-	  vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-	  vos_mem_free(pWdaParams);
       return ;
    } 
    
    /* Free WDI command buffer */
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    /* assign status to scan params */
    endScanParam->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    /* send response back to PE */
    WDA_SendMsg(pWDA, WDA_END_SCAN_RSP, (void *)endScanParam, 0) ;
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessEndScanReq
  * Trigger END SCAN in WDI
@@ -2230,8 +2402,10 @@
                             (WDI_EndScanReqParamsType *)vos_mem_malloc(
                                           sizeof(WDI_EndScanReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                              "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiEndScanParams) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2248,17 +2422,21 @@
       vos_mem_free(wdiEndScanParams);
       return VOS_STATUS_E_NOMEM;
    }
+
    /* Copy init Scan params to WDI structure */
    wdiEndScanParams->ucChannel = endScanParams->scanChannel ;
    wdiEndScanParams->wdiReqStatusCB = NULL ;
+
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = endScanParams;
    pWdaParams->wdaWdiApiMsgParam = wdiEndScanParams;
+
    /* call DAL API to pass init scan request to DAL */
    status = WDI_EndScanReq(wdiEndScanParams, 
                               WDA_EndScanReqCallback, pWdaParams) ;
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2269,8 +2447,10 @@
       endScanParams->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_END_SCAN_RSP, (void *)endScanParams, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_FinishScanReqCallback
  * Trigger Finish SCAN callback
@@ -2281,8 +2461,10 @@
    tWDA_CbContext *pWDA; 
    tFinishScanParams *finishScanParam; 
    VOS_STATUS      status;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2293,17 +2475,18 @@
    
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    finishScanParam = (tFinishScanParams *)pWdaParams->wdaMsgParam;
+
    if(NULL == finishScanParam)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                   "%s: finishScanParam is NULL", __FUNCTION__);
       VOS_ASSERT(0) ;
-	  vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-	  vos_mem_free(pWdaParams);
       return ;
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    /* 
     * Now Resume TX, if we reached here means, TX is already suspended, we 
     * have to resume it unconditionaly
@@ -2315,10 +2498,13 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                                   "%s error in Resume Tx ", __FUNCTION__ );
    }
+
    finishScanParam->status = CONVERT_WDI2SIR_STATUS(wdiStatus) ;
+
    WDA_SendMsg(pWDA, WDA_FINISH_SCAN_RSP, (void *)finishScanParam, 0) ;
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessFinshScanReq
  * Trigger Finish SCAN in WDI
@@ -2334,6 +2520,7 @@
    tANI_U8 i = 0;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                              "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiFinishScanParams) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2350,10 +2537,12 @@
       vos_mem_free(wdiFinishScanParams);
       return VOS_STATUS_E_NOMEM;
    }
+
    /* Copy init Scan params to WDI structure */
    wdiFinishScanParams->wdiReqInfo.wdiScanMode = finishScanParams->scanMode ;
    vos_mem_copy(wdiFinishScanParams->wdiReqInfo.macBSSID, 
                               finishScanParams->bssid, sizeof(tSirMacAddr)) ;
+
    wdiFinishScanParams->wdiReqInfo.bNotifyBSS = finishScanParams->notifyBss ;
    wdiFinishScanParams->wdiReqInfo.ucFrameType = finishScanParams->frameType ;
    wdiFinishScanParams->wdiReqInfo.ucFrameLength = 
@@ -2363,6 +2552,7 @@
    wdiFinishScanParams->wdiReqInfo.wdiCBState = finishScanParams->cbState ;
    wdiFinishScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt = 
                                      finishScanParams->scanEntry.activeBSScnt ;
+
    for (i = 0; i < finishScanParams->scanEntry.activeBSScnt; i++)
    {
        wdiFinishScanParams->wdiReqInfo.wdiScanEntry.bssIdx[i] = 
@@ -2370,6 +2560,7 @@
    }
    
  
+
    /* if Frame length, copy macMgmtHdr ro WDI structure */ 
    if(0 != wdiFinishScanParams->wdiReqInfo.ucFrameLength)
    {
@@ -2378,15 +2569,17 @@
                                                      sizeof(WDI_MacMgmtHdr)) ;
    } 
    wdiFinishScanParams->wdiReqStatusCB = NULL ;
+
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = finishScanParams;
    pWdaParams->wdaWdiApiMsgParam = wdiFinishScanParams;
+
    /* call DAL API to pass init scan request to DAL */
    status = WDI_FinishScanReq(wdiFinishScanParams, 
                               WDA_FinishScanReqCallback, pWdaParams) ;
-   
+
    
    /* 
     * WDI API returns failure..
@@ -2397,15 +2590,19 @@
                      "Failure in Finish Scan WDI API, free all the memory " );
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
+
       finishScanParams->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_FINISH_SCAN_RSP, (void *)finishScanParams, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*---------------------------------------------------------------------
  * ASSOC API's
  *---------------------------------------------------------------------
  */
+
 /*
  * FUNCTION: WDA_JoinReqCallback
  * Trigger Init SCAN callback
@@ -2415,8 +2612,10 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
    tSwitchChannelParams *joinReqParam;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2426,30 +2625,41 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    joinReqParam = (tSwitchChannelParams *)pWdaParams->wdaMsgParam;
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams) ;
+
    /* reset macBSSID */
    vos_mem_set(pWDA->macBSSID, sizeof(pWDA->macBSSID),0 );
+
    /* reset macSTASelf */
    vos_mem_set(pWDA->macSTASelf, sizeof(pWDA->macSTASelf),0 );
+
    joinReqParam->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    WDA_SendMsg(pWDA, WDA_SWITCH_CHANNEL_RSP, (void *)joinReqParam , 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessJoinReq
  * Trigger Join REQ in WDI
  */ 
+
 VOS_STATUS WDA_ProcessJoinReq(tWDA_CbContext *pWDA, 
                                             tSwitchChannelParams* joinReqParam)
 {
    WDI_Status status = WDI_STATUS_SUCCESS ;
+
    WDI_JoinReqParamsType *wdiJoinReqParam = 
                              (WDI_JoinReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_JoinReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiJoinReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2466,17 +2676,17 @@
       vos_mem_free(wdiJoinReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    /* copy the BSSID for pWDA */
    vos_mem_copy(wdiJoinReqParam->wdiReqInfo.macBSSID, pWDA->macBSSID, 
                                              sizeof(tSirMacAddr)) ;
+
    vos_mem_copy(wdiJoinReqParam->wdiReqInfo.macSTASelf, 
                 pWDA->macSTASelf, sizeof(tSirMacAddr)) ;
+
    wdiJoinReqParam->wdiReqInfo.wdiChannelInfo.ucChannel = 
                                                  joinReqParam->channelNumber ;
-#ifdef WLAN_FEATURE_VOWIFI
-   wdiJoinReqParam->wdiReqInfo.wdiChannelInfo.cMaxTxPower =
-                                          joinReqParam->maxTxPower ;
-#else
+#ifndef WLAN_FEATURE_VOWIFI
    wdiJoinReqParam->wdiReqInfo.wdiChannelInfo.ucLocalPowerConstraint = 
                                           joinReqParam->localPowerConstraint ;
 #endif
@@ -2485,13 +2695,16 @@
    wdiJoinReqParam->wdiReqInfo.linkState = pWDA->linkState;
    
    wdiJoinReqParam->wdiReqStatusCB = NULL ;
+
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = joinReqParam;
    pWdaParams->wdaWdiApiMsgParam = wdiJoinReqParam;
+
    status = WDI_JoinReq(wdiJoinReqParam, 
                                (WDI_JoinRspCb )WDA_JoinReqCallback, pWdaParams) ;
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2501,8 +2714,10 @@
       joinReqParam->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_SWITCH_CHANNEL_RSP, (void *)joinReqParam, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_SwitchChannelReqCallback
  * send Switch channel RSP back to PE
@@ -2513,6 +2728,7 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData ; 
    tWDA_CbContext *pWDA; 
    tSwitchChannelParams *pSwitchChanParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
    if(NULL == pWdaParams)
@@ -2528,13 +2744,18 @@
 #ifdef WLAN_FEATURE_VOWIFI
    pSwitchChanParams->txMgmtPower  =  wdiSwitchChanRsp->ucTxMgmtPower;
 #endif
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    pSwitchChanParams->status = 
                           CONVERT_WDI2SIR_STATUS(wdiSwitchChanRsp->wdiStatus) ;
+
    WDA_SendMsg(pWDA, WDA_SWITCH_CHANNEL_RSP, (void *)pSwitchChanParams , 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessChannelSwitchReq
  * Request to WDI to switch channel REQ params.
@@ -2547,8 +2768,10 @@
                          (WDI_SwitchChReqParamsType *)vos_mem_malloc(
                                          sizeof(WDI_SwitchChReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiSwitchChanParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2565,6 +2788,7 @@
       vos_mem_free(wdiSwitchChanParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiSwitchChanParam->wdiChInfo.ucChannel = pSwitchChanParams->channelNumber;
 #ifndef WLAN_FEATURE_VOWIFI
    wdiSwitchChanParam->wdiChInfo.ucLocalPowerConstraint = 
@@ -2573,11 +2797,13 @@
    wdiSwitchChanParam->wdiChInfo.wdiSecondaryChannelOffset = 
                                      pSwitchChanParams->secondaryChannelOffset;
    wdiSwitchChanParam->wdiReqStatusCB = NULL ;
+
    /* Store req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pSwitchChanParams;
    pWdaParams->wdaWdiApiMsgParam = wdiSwitchChanParam;
+
 #ifdef WLAN_FEATURE_VOWIFI
    wdiSwitchChanParam->wdiChInfo.cMaxTxPower 
                                      = pSwitchChanParams->maxTxPower;
@@ -2591,6 +2817,7 @@
 
    status = WDI_SwitchChReq(wdiSwitchChanParam, 
                      (WDI_SwitchChRspCb)WDA_SwitchChannelReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2600,8 +2827,10 @@
       pSwitchChanParams->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_SWITCH_CHANNEL_RSP, (void *)pSwitchChanParams, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_ConfigBssReqCallback
  * config BSS Req Callback, called by WDI
@@ -2613,6 +2842,7 @@
    tWDA_CbContext *pWDA; 
    tAddBssParams *configBssReqParam;
    tAddStaParams *staConfigBssParam;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
    if(NULL == pWdaParams)
@@ -2625,12 +2855,15 @@
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    configBssReqParam = (tAddBssParams *)pWdaParams->wdaMsgParam;
    staConfigBssParam = &configBssReqParam->staContext ;
+
    configBssReqParam->status = 
                      CONVERT_WDI2SIR_STATUS(wdiConfigBssRsp->wdiStatus);
+
    if(WDI_STATUS_SUCCESS == wdiConfigBssRsp->wdiStatus)
    {
       vos_mem_copy(configBssReqParam->bssId, wdiConfigBssRsp->macBSSID, 
                                                     sizeof(tSirMacAddr));
+
       configBssReqParam->bssIdx = wdiConfigBssRsp->ucBSSIdx;
       configBssReqParam->bcastDpuSignature = wdiConfigBssRsp->ucBcastSig;
       configBssReqParam->mgmtDpuSignature = wdiConfigBssRsp->ucUcastSig;
@@ -2684,13 +2917,18 @@
       }
       
       staConfigBssParam->staIdx = wdiConfigBssRsp->ucSTAIdx;
+
       staConfigBssParam->bssIdx = wdiConfigBssRsp->ucBSSIdx;
+
       staConfigBssParam->ucUcastSig = wdiConfigBssRsp->ucUcastSig;
+
       staConfigBssParam->ucBcastSig = wdiConfigBssRsp->ucBcastSig;
+
       vos_mem_copy(staConfigBssParam->staMac, wdiConfigBssRsp->macSTA,
                                                     sizeof(tSirMacAddr));
       staConfigBssParam->txChannelWidthSet = 
                                configBssReqParam->txChannelWidthSet;
+
       if(staConfigBssParam->staType == STA_ENTRY_PEER && 
                                     staConfigBssParam->htCapable)
       {
@@ -2699,6 +2937,7 @@
          pWDA->wdaStaInfo[staConfigBssParam->staIdx].ucValidStaIndex = 
                                                          WDA_VALID_STA_INDEX ;
       }
+
       if(WDI_DS_SetStaIdxPerBssIdx(pWDA->pWdiContext,
                                    wdiConfigBssRsp->ucBSSIdx,
                                    wdiConfigBssRsp->ucSTAIdx))
@@ -2707,21 +2946,27 @@
                     "%s: fail to set STA idx associated with BSS index", __FUNCTION__);
          VOS_ASSERT(0) ;
       }
+
       if(WDI_DS_AddSTAMemPool(pWDA->pWdiContext, wdiConfigBssRsp->ucSTAIdx))
       {
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                     "%s: add BSS into mempool fail", __FUNCTION__);
          VOS_ASSERT(0) ;
       }
+
 #ifdef WLAN_FEATURE_VOWIFI
       configBssReqParam->txMgmtPower = wdiConfigBssRsp->ucTxMgmtPower;
 #endif
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    WDA_SendMsg(pWDA, WDA_ADD_BSS_RSP, (void *)configBssReqParam , 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_UpdateEdcaParamsForAC
  * Update WDI EDCA params with PE edca params
@@ -2737,6 +2982,7 @@
    wdiEdcaParam->wdiCW.max = macEdcaParam->cw.max;
    wdiEdcaParam->usTXOPLimit = macEdcaParam->txoplimit;
 }
+
 /*
  * FUNCTION: WDA_ProcessConfigBssReq
  * Configure BSS before starting Assoc with AP
@@ -2745,12 +2991,15 @@
                                          tAddBssParams* configBssReqParam)
 {
    WDI_Status status = WDI_STATUS_SUCCESS ;
+
    WDI_ConfigBSSReqParamsType *wdiConfigBssReqParam =
                              (WDI_ConfigBSSReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_ConfigBSSReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiConfigBssReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2767,27 +3016,36 @@
       vos_mem_free(wdiConfigBssReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    vos_mem_set(wdiConfigBssReqParam, sizeof(WDI_ConfigBSSReqParamsType), 0);
+
    WDA_UpdateBSSParams(pWDA, &wdiConfigBssReqParam->wdiReqInfo, 
                        configBssReqParam) ;
+
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = configBssReqParam;
    pWdaParams->wdaWdiApiMsgParam = wdiConfigBssReqParam;
+
    status = WDI_ConfigBSSReq(wdiConfigBssReqParam, 
                         (WDI_ConfigBSSRspCb )WDA_ConfigBssReqCallback, pWdaParams) ;
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                    "Failure in Config BSS WDI API, free all the memory " );
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
+
       configBssReqParam->status = eSIR_FAILURE ;
+
       WDA_SendMsg(pWDA, WDA_ADD_BSS_RSP, (void *)configBssReqParam, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 #ifdef ENABLE_HAL_COMBINED_MESSAGES
 /*
  * FUNCTION: WDA_PostAssocReqCallback
@@ -2805,10 +3063,13 @@
    /*STA Params for self STA*/
    tAddStaParams *selfStaPostAssocParam = 
       &postAssocReqParam->addStaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    postAssocReqParam->status = 
                    CONVERT_WDI2SIR_STATUS(wdiPostAssocRsp->wdiStatus) ;
+
    if(WDI_STATUS_SUCCESS == wdiPostAssocRsp->wdiStatus)
    {
       staPostAssocParam->staIdx = wdiPostAssocRsp->bssParams.ucSTAIdx ;
@@ -2817,14 +3078,18 @@
       staPostAssocParam->ucUcastSig = wdiPostAssocRsp->bssParams.ucUcastSig ;
       staPostAssocParam->ucBcastSig = wdiPostAssocRsp->bssParams.ucBcastSig ;
       staPostAssocParam->bssIdx = wdiPostAssocRsp->bssParams.ucBSSIdx;
+
       selfStaPostAssocParam->staIdx = wdiPostAssocRsp->staParams.ucSTAIdx;
    }
    vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
    pWDA->wdaWdiApiMsgParam = NULL;
    pWDA->wdaMsgParam = NULL;
+
    WDA_SendMsg(pWDA, WDA_POST_ASSOC_RSP, (void *)postAssocReqParam, 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessPostAssocReq
  * Trigger POST ASSOC processing in WDI
@@ -2832,6 +3097,7 @@
 VOS_STATUS WDA_ProcessPostAssocReq(tWDA_CbContext *pWDA, 
                                     tPostAssocParams *postAssocReqParam)
 {
+
    WDI_Status status = WDI_STATUS_SUCCESS ;
    
    WDI_PostAssocReqParamsType *wdiPostAssocReqParam =
@@ -2840,6 +3106,7 @@
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
 
+
    if(NULL == wdiPostAssocReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2856,6 +3123,7 @@
       return VOS_STATUS_E_FAILURE;
    }
 
+
    /* update BSS params into WDI structure */
    WDA_UpdateBSSParams(pWDA, &wdiPostAssocReqParam->wdiBSSParams, 
                        &postAssocReqParam->addBssParams) ;
@@ -2877,12 +3145,16 @@
    WDA_UpdateEdcaParamsForAC(pWDA, 
                         &wdiPostAssocReqParam->wdiBSSParams.wdiVOEDCAParams,
                         &postAssocReqParam->addBssParams.acvo);
+
    /* Store Init Req pointer, as this will be used for response */
    pWDA->wdaMsgParam = (void *)postAssocReqParam ;
+
    /* store Params pass it to WDI */
    pWDA->wdaWdiApiMsgParam = (void *)wdiPostAssocReqParam ;
+
    status = WDI_PostAssocReq(wdiPostAssocReqParam, 
                         (WDI_PostAssocRspCb )WDA_PostAssocReqCallback, pWDA) ;
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2890,12 +3162,16 @@
       vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
       pWDA->wdaWdiApiMsgParam = NULL;
       pWDA->wdaMsgParam = NULL;
+
       postAssocReqParam->status = eSIR_FAILURE ;
+
       WDA_SendMsg(pWDA, WDA_POST_ASSOC_RSP, (void *)postAssocReqParam, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
 #endif
+
 /*
  * FUNCTION: WDA_AddStaReqCallback
  * ADD STA req callback, send RSP back to PE
@@ -2906,8 +3182,10 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
    tAddStaParams *addStaReqParam;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,"%s: pWdaParams is NULL", __FUNCTION__);
@@ -2916,8 +3194,10 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    addStaReqParam = (tAddStaParams *)pWdaParams->wdaMsgParam;
+
    addStaReqParam->status = 
                    CONVERT_WDI2SIR_STATUS(wdiConfigStaRsp->wdiStatus) ;
+
    if(WDI_STATUS_SUCCESS == wdiConfigStaRsp->wdiStatus)
    {
       addStaReqParam->staIdx = wdiConfigStaRsp->ucSTAIdx;
@@ -2943,11 +3223,15 @@
          return ;
       }
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams) ;
+
    WDA_SendMsg(pWDA, WDA_ADD_STA_RSP, (void *)addStaReqParam, 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ConfigStaReq
  * Trigger Config STA processing in WDI
@@ -2955,13 +3239,17 @@
 VOS_STATUS WDA_ProcessAddStaReq(tWDA_CbContext *pWDA, 
                                     tAddStaParams *addStaReqParam)
 {
+
    WDI_Status status = WDI_STATUS_SUCCESS ;
+
    WDI_ConfigSTAReqParamsType *wdiConfigStaReqParam =
                            (WDI_ConfigSTAReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_ConfigSTAReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiConfigStaReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -2978,28 +3266,37 @@
       vos_mem_free(wdiConfigStaReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    vos_mem_set(wdiConfigStaReqParam, sizeof(WDI_ConfigSTAReqParamsType), 0);
+
    /* update STA params into WDI structure */
    WDA_UpdateSTAParams(pWDA, &wdiConfigStaReqParam->wdiReqInfo, 
                        addStaReqParam) ;
+
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = addStaReqParam;
    pWdaParams->wdaWdiApiMsgParam = wdiConfigStaReqParam;
+
    status = WDI_ConfigSTAReq(wdiConfigStaReqParam, 
                         (WDI_ConfigSTARspCb )WDA_AddStaReqCallback, pWdaParams) ;
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                    "Failure in Config STA WDI API, free all the memory " );
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
+
       addStaReqParam->status = eSIR_FAILURE ;
+
       WDA_SendMsg(pWDA, WDA_ADD_STA_RSP, (void *)addStaReqParam, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_DelBSSReqCallback
  * Dens DEL BSS RSP back to PE
@@ -3011,8 +3308,10 @@
    tWDA_CbContext *pWDA; 
    tDeleteBssParams *delBssReqParam;
    tANI_U8  staIdx,tid;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -3022,32 +3321,39 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    delBssReqParam = (tDeleteBssParams *)pWdaParams->wdaMsgParam;
+
    delBssReqParam->status = CONVERT_WDI2SIR_STATUS(wdiDelBssRsp->wdiStatus) ;
+
    if(WDI_STATUS_SUCCESS == wdiDelBssRsp->wdiStatus)
    {
       vos_mem_copy(delBssReqParam->bssid, wdiDelBssRsp->macBSSID, 
                                              sizeof(tSirMacAddr)) ;
    }
+
    if(WDI_DS_GetStaIdxFromBssIdx(pWDA->pWdiContext, delBssReqParam->bssIdx, &staIdx))
    {
      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                  "%s: Get STA index from BSS index Fail", __FUNCTION__);
      VOS_ASSERT(0) ;
    }
+
    if(WDI_DS_DelSTAMemPool(pWDA->pWdiContext, staIdx))
    {
      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                  "%s: DEL STA from MemPool Fail", __FUNCTION__);
      VOS_ASSERT(0) ;
    }
+
    if(WDI_DS_ClearStaIdxPerBssIdx(pWDA->pWdiContext, delBssReqParam->bssIdx, staIdx))
    {
      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                  "%s: Clear STA index form table Fail", __FUNCTION__);
      VOS_ASSERT(0) ;
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    /* reset the the system role*/
    pWDA->wdaGlobalSystemRole = eSYSTEM_UNKNOWN_ROLE;
    
@@ -3065,10 +3371,13 @@
          }
       }
    }
+
    WDA_SendMsg(pWDA, WDA_DELETE_BSS_RSP, (void *)delBssReqParam , 0) ;
+
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessDelBssReq
  * Init DEL BSS req with WDI
@@ -3077,12 +3386,15 @@
                                         tDeleteBssParams *delBssParam)
 {
    WDI_Status status = WDI_STATUS_SUCCESS ;
+
    WDI_DelBSSReqParamsType *wdiDelBssReqParam = 
                              (WDI_DelBSSReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_DelBSSReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiDelBssReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -3099,6 +3411,7 @@
       vos_mem_free(wdiDelBssReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiDelBssReqParam->ucBssIdx = delBssParam->bssIdx;
    wdiDelBssReqParam->wdiReqStatusCB = NULL ;
    
@@ -3107,8 +3420,10 @@
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = delBssParam;
    pWdaParams->wdaWdiApiMsgParam = wdiDelBssReqParam;
+
    status = WDI_DelBSSReq(wdiDelBssReqParam, 
                         (WDI_DelBSSRspCb )WDA_DelBSSReqCallback, pWdaParams) ;
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -3118,8 +3433,10 @@
       delBssParam->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_DELETE_BSS_RSP, (void *)delBssParam, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_DelSTAReqCallback
  * Dens DEL STA RSP back to PE
@@ -3130,8 +3447,10 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
    tDeleteStaParams *delStaReqParam;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -3141,7 +3460,9 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    delStaReqParam = (tDeleteStaParams *)pWdaParams->wdaMsgParam;
+
    delStaReqParam->status = CONVERT_WDI2SIR_STATUS(wdiDelStaRsp->wdiStatus) ;
+
    if(WDI_STATUS_SUCCESS == wdiDelStaRsp->wdiStatus)
    {
       if(WDI_DS_DelSTAMemPool(pWDA->pWdiContext, wdiDelStaRsp->ucSTAIdx))
@@ -3154,14 +3475,17 @@
    }
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    /*Reset the BA information corresponding to this STAIdx */
    pWDA->wdaStaInfo[wdiDelStaRsp->ucSTAIdx].ucValidStaIndex = 
                                                       WDA_INVALID_STA_INDEX;
    pWDA->wdaStaInfo[wdiDelStaRsp->ucSTAIdx].ucUseBaBitmap = 0;
    
    WDA_SendMsg(pWDA, WDA_DELETE_STA_RSP, (void *)delStaReqParam , 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessDelStaReq
  * Init DEL STA req with WDI
@@ -3170,12 +3494,15 @@
                                       tDeleteStaParams *delStaParam)
 {
    WDI_Status status = WDI_STATUS_SUCCESS ;
+
    WDI_DelSTAReqParamsType *wdiDelStaReqParam = 
                              (WDI_DelSTAReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_DelSTAReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiDelStaReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -3192,15 +3519,19 @@
       vos_mem_free(wdiDelStaReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiDelStaReqParam->ucSTAIdx = delStaParam->staIdx ;
    wdiDelStaReqParam->wdiReqStatusCB = NULL ;
+
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = delStaParam;
    pWdaParams->wdaWdiApiMsgParam = wdiDelStaReqParam;
+
    status = WDI_DelSTAReq(wdiDelStaReqParam, 
                         (WDI_DelSTARspCb )WDA_DelSTAReqCallback, pWdaParams) ;
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -3211,8 +3542,10 @@
       delStaParam->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_DELETE_STA_RSP, (void *)delStaParam, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 void WDA_ProcessAddStaSelfRsp(WDI_AddSTASelfRspParamsType* pwdiAddSTASelfRsp, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
@@ -3229,15 +3562,20 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    pAddStaSelfRsp = (tAddStaSelfParams*)pWdaParams->wdaMsgParam;
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams);
+
    pAddStaSelfRsp->status = CONVERT_WDI2SIR_STATUS(pwdiAddSTASelfRsp->wdiStatus);
    vos_mem_copy(pAddStaSelfRsp->selfMacAddr, 
                 pwdiAddSTASelfRsp->macSelfSta, 
                 sizeof(pAddStaSelfRsp->selfMacAddr));
+
    WDA_SendMsg( pWDA, WDA_ADD_STA_SELF_RSP, (void *)pAddStaSelfRsp, 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessAddStaSelfReq
  * 
@@ -3250,6 +3588,7 @@
       (WDI_AddSTASelfReqParamsType *)vos_mem_malloc(
          sizeof(WDI_AddSTASelfReqParamsType)) ;
    tWDA_ReqParams *pWdaParams; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
    if( NULL == wdiAddStaSelfReq )
@@ -3259,7 +3598,9 @@
                                           "%s: Unable to allocate memory " ,__FUNCTION__);
       return( VOS_STATUS_E_NOMEM );
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+
    if( NULL == pWdaParams )
    {
       VOS_ASSERT( 0 );
@@ -3268,13 +3609,16 @@
       vos_mem_free(wdiAddStaSelfReq) ;
       return( VOS_STATUS_E_NOMEM );
    }
+
    wdiAddStaSelfReq->wdiReqStatusCB = NULL;
+
    vos_mem_copy( wdiAddStaSelfReq->wdiAddSTASelfInfo.selfMacAddr, pAddStaSelfReq->selfMacAddr, 6);
    /* Store Init Req pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pAddStaSelfReq;
    pWdaParams->wdaWdiApiMsgParam = wdiAddStaSelfReq; 
+
    wstatus = WDI_AddSTASelfReq( wdiAddStaSelfReq, WDA_ProcessAddStaSelfRsp, pWdaParams);
 
    if(IS_WDI_STATUS_FAILURE(wstatus))
@@ -3288,8 +3632,10 @@
       pAddStaSelfReq->status = eSIR_FAILURE ;
       WDA_SendMsg( pWDA, WDA_ADD_STA_SELF_RSP, (void *)pAddStaSelfReq, 0) ;
    }
+
    return status;
 }
+
 /*
  * FUNCTION: WDA_DelSTASelfRespCallback
  * 
@@ -3300,8 +3646,10 @@
    tWDA_ReqParams        *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext        *pWDA; 
    tDelStaSelfParams     *delStaSelfParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if (NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -3309,8 +3657,10 @@
       VOS_ASSERT(0);
       return;
    }
+
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    delStaSelfParams = (tDelStaSelfParams *)pWdaParams->wdaMsgParam;
+
    delStaSelfParams->status = 
                CONVERT_WDI2SIR_STATUS(wdiDelStaSelfRspParams->wdiStatus) ;
    
@@ -3318,8 +3668,10 @@
    vos_mem_free(pWdaParams) ;
    
    WDA_SendMsg(pWDA, WDA_DEL_STA_SELF_RSP, (void *)delStaSelfParams , 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_DelSTASelfReqCallback
  * 
@@ -3373,6 +3725,7 @@
                 (WDI_DelSTASelfReqParamsType *)vos_mem_malloc(
                               sizeof(WDI_DelSTASelfReqParamsType)) ;
 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
    if( NULL == wdiDelStaSelfReq )
@@ -3392,11 +3745,13 @@
       vos_mem_free(wdiDelStaSelfReq) ;
       return( VOS_STATUS_E_NOMEM );
    }
+
    pWdaParams->pWdaContext = pWDA;
    /* Store param pointer as passed in by caller */
    pWdaParams->wdaMsgParam = pDelStaSelfReqParam;
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiDelStaSelfReq;
+
    vos_mem_copy( wdiDelStaSelfReq->wdiDelStaSelfInfo.selfMacAddr, 
                  pDelStaSelfReqParam->selfMacAddr, sizeof(tSirMacAddr));
    
@@ -3417,9 +3772,12 @@
       pDelStaSelfReqParam->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_DEL_STA_SELF_RSP, (void *)pDelStaSelfReqParam, 0) ;
    }
+
    return status;
 }
 
+
+
 /*
  * FUNCTION: WDA_SendMsg
  * Send Message back to PE
@@ -3430,10 +3788,13 @@
    tSirMsgQ msg = {0} ;
    tANI_U32 status = VOS_STATUS_SUCCESS ;
    tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
+
    msg.type        = msgType;
    msg.bodyval     = bodyVal;
    msg.bodyptr     = pBodyptr;
+
    status = limPostMsgApi(pMac, &msg);
+
    if (VOS_STATUS_SUCCESS != status)
    {
       if(NULL != pBodyptr)
@@ -3444,8 +3805,10 @@
                       "%s: limPostMsgApi is failed " ,__FUNCTION__);
       VOS_ASSERT(0) ;
    }
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_UpdateBSSParams
  * Translated WDA/PE BSS info into WDI BSS info..
@@ -3455,6 +3818,7 @@
                          tAddBssParams *wdaBssParams)
 {
    v_U8_t keyIndex = 0;
+
    /* copy bssReq Params to WDI structure */
    vos_mem_copy(wdiBssParams->macBSSID,
                            wdaBssParams->bssId, sizeof(tSirMacAddr)) ;
@@ -3463,8 +3827,10 @@
    wdiBssParams->wdiBSSType = wdaBssParams->bssType ;
    wdiBssParams->ucOperMode = wdaBssParams->operMode ;
    wdiBssParams->wdiNWType   = wdaBssParams->nwType ;
+
    wdiBssParams->ucShortSlotTimeSupported = 
                                   wdaBssParams->shortSlotTimeSupported ;
+
    wdiBssParams->ucllaCoexist  = wdaBssParams->llaCoexist ;
    wdiBssParams->ucllbCoexist  = wdaBssParams->llbCoexist ;
    wdiBssParams->ucllgCoexist  = wdaBssParams->llgCoexist ;
@@ -3474,9 +3840,12 @@
    wdiBssParams->ucllnNonGFCoexist = wdaBssParams->llnNonGFCoexist ;
    wdiBssParams->ucTXOPProtectionFullSupport =
                            wdaBssParams->fLsigTXOPProtectionFullSupport ;
+
    wdiBssParams->ucRIFSMode = wdaBssParams->fRIFSMode ;
    wdiBssParams->usBeaconInterval = wdaBssParams->beaconInterval ;
+
    wdiBssParams->ucDTIMPeriod = wdaBssParams->dtimPeriod ;
+
    wdiBssParams->ucTXChannelWidthSet = wdaBssParams->txChannelWidthSet ;
    wdiBssParams->ucCurrentOperChannel = wdaBssParams->currentOperChannel ;
    wdiBssParams->ucCurrentExtChannel = wdaBssParams->currentExtChannel ;
@@ -3486,16 +3855,23 @@
    wdiBssParams->wdiSSID.ucLength = wdaBssParams->ssId.length ;
    vos_mem_copy(wdiBssParams->wdiSSID.sSSID,
                  wdaBssParams->ssId.ssId, wdaBssParams->ssId.length) ;
+
    WDA_UpdateSTAParams(pWDA, &wdiBssParams->wdiSTAContext, 
                        &wdaBssParams->staContext) ;
+
    wdiBssParams->wdiAction = wdaBssParams->updateBss;
+
 #ifdef WLAN_FEATURE_VOWIFI
    wdiBssParams->cMaxTxPower = wdaBssParams->maxTxPower;
 #endif
+
    wdiBssParams->ucPersona = wdaBssParams->halPersona;
+
    wdiBssParams->bSpectrumMgtEn = wdaBssParams->bSpectrumMgtEnabled;
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
    wdiBssParams->bExtSetStaKeyParamValid = wdaBssParams->extSetStaKeyParamValid;
+
    if(wdiBssParams->bExtSetStaKeyParamValid)
    {
       /* copy set STA key params to WDI structure */
@@ -3507,6 +3883,7 @@
          wdaBssParams->extSetStaKeyParam.wepType;
       wdiBssParams->wdiExtSetKeyParam.ucDefWEPIdx = 
          wdaBssParams->extSetStaKeyParam.defWEPIdx;
+
       if(wdaBssParams->extSetStaKeyParam.encType != eSIR_ED_NONE)
       {
          if( (wdiBssParams->wdiExtSetKeyParam.wdiWEPType == WDI_WEP_STATIC) && 
@@ -3530,6 +3907,7 @@
                   wdaBssParams->extSetStaKeyParam.key[keyIndex].unicast;
                wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].keyDirection =
                   wdaBssParams->extSetStaKeyParam.key[keyIndex].keyDirection;
+
                vos_mem_copy(wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].keyRsc, 
                             wdaBssParams->extSetStaKeyParam.key[keyIndex].keyRsc, WLAN_MAX_KEY_RSC_LEN);
                wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].paeRole =
@@ -3539,6 +3917,7 @@
                vos_mem_copy(wdiBssParams->wdiExtSetKeyParam.wdiKey[keyIndex].key, 
                             wdaBssParams->extSetStaKeyParam.key[keyIndex].key, SIR_MAC_MAX_KEY_LENGTH);
             }
+
             wdiBssParams->wdiExtSetKeyParam.ucNumKeys = 
                SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
 #else
@@ -3569,13 +3948,10 @@
                     sizeof(wdaBssParams->extSetStaKeyParam) );
    }
 #endif /*WLAN_FEATURE_VOWIFI_11R*/
-#ifdef WLAN_FEATURE_11AC
-   wdiBssParams->ucVhtCapableSta = wdaBssParams->vhtCapable;
-   wdiBssParams->ucVhtTxChannelWidthSet = wdaBssParams->vhtTxChannelWidthSet;
-#endif
 
    return ;
 }
+
 /*
  * FUNCTION: WDA_UpdateSTAParams
  * Translated WDA/PE BSS info into WDI BSS info..
@@ -3609,8 +3985,10 @@
    
    wdiStaParams->ucShortGI40Mhz = wdaStaParams->fShortGI40Mhz;
    wdiStaParams->ucShortGI20Mhz = wdaStaParams->fShortGI20Mhz;
+
    wdiStaParams->wdiSupportedRates.opRateMode = 
                                 wdaStaParams->supportedRates.opRateMode;
+
    for(i = 0;i < WDI_NUM_11B_RATES;i++)
    {
      wdiStaParams->wdiSupportedRates.llbRates[i] = 
@@ -3628,12 +4006,6 @@
    }
    wdiStaParams->wdiSupportedRates.uEnhancedRateBitmap = 
                             wdaStaParams->supportedRates.aniEnhancedRateBitmap;
-#ifdef WLAN_FEATURE_11AC
-   wdiStaParams->wdiSupportedRates.vhtRxMCSMap = wdaStaParams->supportedRates.vhtRxMCSMap;
-   wdiStaParams->wdiSupportedRates.vhtRxHighestDataRate = wdaStaParams->supportedRates.vhtRxHighestDataRate;
-   wdiStaParams->wdiSupportedRates.vhtTxMCSMap = wdaStaParams->supportedRates.vhtTxMCSMap;
-   wdiStaParams->wdiSupportedRates.vhtTxHighestDataRate = wdaStaParams->supportedRates.vhtTxHighestDataRate;
-#endif
    for(i = 0;i <SIR_MAC_MAX_SUPPORTED_MCS_SET;i++)
    {
      wdiStaParams->wdiSupportedRates.aSupportedMCSSet[i] = 
@@ -3657,12 +4029,9 @@
 #ifdef WLAN_FEATURE_P2P
    wdiStaParams->ucP2pCapableSta = wdaStaParams->p2pCapableSta;
 #endif
-#ifdef WLAN_FEATURE_11AC
-   wdiStaParams->ucVhtCapableSta = wdaStaParams->vhtCapable;
-   wdiStaParams->ucVhtTxChannelWidthSet = wdaStaParams->vhtTxChannelWidthSet;
-#endif
    return ;
 }
+
 /*
  * -------------------------------------------------------------------------
  * CFG update to WDI
@@ -3673,7 +4042,7 @@
  * FUNCTION: WDA_ConvertWniCfgIdToHALCfgId
  * Convert the WNI CFG ID to HAL CFG ID
  */ 
-static inline v_U8_t WDA_ConvertWniCfgIdToHALCfgId(v_U32_t wniCfgId)
+static inline v_U8_t WDA_ConvertWniCfgIdToHALCfgId(v_U8_t wniCfgId)
 {
    switch(wniCfgId)
    {
@@ -3782,6 +4151,7 @@
       }
    }
 }
+
 /*
  * FUNCTION: WDA_UpdateCfgCallback
  * 
@@ -3791,8 +4161,10 @@
    tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
    WDI_UpdateCfgReqParamsType *wdiCfgParam = 
                   (WDI_UpdateCfgReqParamsType *)pWDA->wdaWdiCfgApiMsgParam ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    /*
     * currently there is no response message is expected between PE and
     * WDA, Failure return from WDI is a ASSERT condition
@@ -3807,8 +4179,10 @@
    vos_mem_free(wdiCfgParam->pConfigBuffer) ;
    vos_mem_free(pWDA->wdaWdiCfgApiMsgParam) ;
    pWDA->wdaWdiCfgApiMsgParam = NULL;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_UpdateCfg
  * 
@@ -3822,14 +4196,17 @@
    tHalCfg *configData;
    WDI_UpdateCfgReqParamsType *wdiCfgReqParam = NULL ;
    tANI_U8        *configDataValue;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if (NULL == pMac )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                  "%s: Invoked with invalid MAC context ", __FUNCTION__ );
       return VOS_STATUS_E_FAILURE;
    }
+
    if(WDA_START_STATE != pWDA->wdaState)
    {
       return VOS_STATUS_E_FAILURE;
@@ -3845,6 +4222,7 @@
    
    wdiCfgReqParam = (WDI_UpdateCfgReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_UpdateCfgReqParamsType)) ;
+
    if(NULL == wdiCfgReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -3852,8 +4230,10 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiCfgReqParam->pConfigBuffer =  vos_mem_malloc(sizeof(tHalCfg) + 
                                                             sizeof(tANI_U32)) ;
+
    if(NULL == wdiCfgReqParam->pConfigBuffer)
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -3877,6 +4257,7 @@
        vos_mem_free(wdiCfgReqParam);
        return eSIR_FAILURE;
    }
+
    ((tHalCfg *)wdiCfgReqParam->pConfigBuffer)->length = sizeof(tANI_U32);
    configData =((tHalCfg *)wdiCfgReqParam->pConfigBuffer) ;
    configDataValue = ((tANI_U8 *)configData + sizeof(tHalCfg));
@@ -3885,9 +4266,11 @@
    
    /* store Params pass it to WDI */
    pWDA->wdaWdiCfgApiMsgParam = (void *)wdiCfgReqParam ;
+
 #ifdef FEATURE_HAL_SUPPORT_DYNAMIC_UPDATE_CFG
    status = WDI_UpdateCfgReq(wdiCfgReqParam, 
                    (WDI_UpdateCfgRspCb )WDA_UpdateCfgCallback, pWDA) ;
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -3906,6 +4289,7 @@
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
 
+
 VOS_STATUS WDA_GetWepKeysFromCfg( tWDA_CbContext *pWDA, 
                                                       v_U8_t *pDefaultKeyId,
                                                       v_U8_t *pNumKeys,
@@ -3915,12 +4299,14 @@
    v_U32_t val = SIR_MAC_KEY_LENGTH;
    VOS_STATUS status = WDI_STATUS_SUCCESS;
    tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext) ;
+
    if (NULL == pMac )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                  "%s: Invoked with invalid MAC context ", __FUNCTION__ );
       return VOS_STATUS_E_FAILURE;
    }
+
    if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_WEP_DEFAULT_KEYID,
                                                                     &defKeyId ))
    {
@@ -3929,6 +4315,7 @@
    }
    
   *pDefaultKeyId = (v_U8_t)defKeyId;
+
    /* Need to extract ALL of the configured WEP Keys */
    for( i = 0, j = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++ )
    {
@@ -3957,12 +4344,15 @@
          pWdiKeys[j].paeRole = 0;
          /* Determined from wlan_cfgGetStr() above.*/
          pWdiKeys[j].keyLength = (tANI_U16) val;
+
          j++;
          *pNumKeys = (tANI_U8) j;
       }
    }
+
    return status;
 }
+
 /*
  * FUNCTION: WDA_SetBssKeyReqCallback
  * send SET BSS key RSP back to PE
@@ -3972,6 +4362,7 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
    tSetBssKeyParams *setBssKeyParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
    if(NULL == pWdaParams)
@@ -3983,12 +4374,16 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    setBssKeyParams = (tSetBssKeyParams *)pWdaParams->wdaMsgParam;
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
    setBssKeyParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    WDA_SendMsg(pWDA, WDA_SET_BSSKEY_RSP, (void *)setBssKeyParams , 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessSetBssKeyReq
  * Request to WDI for programming the BSS key( key for 
@@ -4002,9 +4397,12 @@
                   (WDI_SetBSSKeyReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_SetBSSKeyReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    v_U8_t keyIndex;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiSetBssKeyParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4021,11 +4419,14 @@
       vos_mem_free(wdiSetBssKeyParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    vos_mem_zero(wdiSetBssKeyParam, sizeof(WDI_SetBSSKeyReqParamsType));
+
    /* copy set BSS params to WDI structure */
    wdiSetBssKeyParam->wdiBSSKeyInfo.ucBssIdx = setBssKeyParams->bssIdx;
    wdiSetBssKeyParam->wdiBSSKeyInfo.wdiEncType = setBssKeyParams->encType;
    wdiSetBssKeyParam->wdiBSSKeyInfo.ucNumKeys = setBssKeyParams->numKeys;
+
    if(setBssKeyParams->encType != eSIR_ED_NONE)
    {
       if( setBssKeyParams->numKeys == 0 && 
@@ -4033,6 +4434,7 @@
                                 setBssKeyParams->encType == eSIR_ED_WEP104))
       {
          tANI_U8 defaultKeyId = 0;
+
          WDA_GetWepKeysFromCfg( pWDA, &defaultKeyId, 
             &wdiSetBssKeyParam->wdiBSSKeyInfo.ucNumKeys,
             wdiSetBssKeyParam->wdiBSSKeyInfo.aKeys );
@@ -4059,14 +4461,17 @@
          }
       }
    }
+
    wdiSetBssKeyParam->wdiBSSKeyInfo.ucSingleTidRc = 
                                       setBssKeyParams->singleTidRc;
    wdiSetBssKeyParam->wdiReqStatusCB = NULL ;
+
    /* Store set key pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = setBssKeyParams;
    pWdaParams->wdaWdiApiMsgParam = wdiSetBssKeyParam;
+
    status = WDI_SetBSSKeyReq(wdiSetBssKeyParam, 
                            (WDI_SetBSSKeyRspCb)WDA_SetBssKeyReqCallback ,pWdaParams);
    
@@ -4079,8 +4484,10 @@
       setBssKeyParams->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_SET_BSSKEY_RSP, (void *)setBssKeyParams, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_RemoveBssKeyReqCallback
  * send SET BSS key RSP back to PE
@@ -4090,8 +4497,10 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
    tRemoveBssKeyParams *removeBssKeyParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4101,13 +4510,17 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    removeBssKeyParams = (tRemoveBssKeyParams *)pWdaParams->wdaMsgParam;
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
    
    removeBssKeyParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    WDA_SendMsg(pWDA, WDA_REMOVE_BSSKEY_RSP, (void *)removeBssKeyParams , 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessRemoveBssKeyReq
  * Request to WDI to remove the BSS key( key for broadcast/multicast 
@@ -4121,8 +4534,10 @@
                   (WDI_RemoveBSSKeyReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_RemoveBSSKeyReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiRemoveBssKeyParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4139,19 +4554,23 @@
       vos_mem_free(wdiRemoveBssKeyParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    /* copy Remove BSS key params to WDI structure*/
    wdiRemoveBssKeyParam->wdiKeyInfo.ucBssIdx = removeBssKeyParams->bssIdx;
    wdiRemoveBssKeyParam->wdiKeyInfo.wdiEncType = removeBssKeyParams->encType;
    wdiRemoveBssKeyParam->wdiKeyInfo.ucKeyId = removeBssKeyParams->keyId;
    wdiRemoveBssKeyParam->wdiKeyInfo.wdiWEPType = removeBssKeyParams->wepType;
    wdiRemoveBssKeyParam->wdiReqStatusCB = NULL ;
+
    /* Store remove key pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = removeBssKeyParams;
    pWdaParams->wdaWdiApiMsgParam = wdiRemoveBssKeyParam;
+
    status = WDI_RemoveBSSKeyReq(wdiRemoveBssKeyParam, 
                      (WDI_RemoveBSSKeyRspCb)WDA_RemoveBssKeyReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4161,8 +4580,10 @@
       removeBssKeyParams->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_REMOVE_BSSKEY_RSP, (void *)removeBssKeyParams, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_SetBssKeyReqCallback
  * send SET BSS key RSP back to PE
@@ -4172,6 +4593,7 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
    tSetStaKeyParams *setStaKeyParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
    if(NULL == pWdaParams)
@@ -4183,12 +4605,17 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    setStaKeyParams = (tSetStaKeyParams *)pWdaParams->wdaMsgParam;
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    setStaKeyParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    WDA_SendMsg(pWDA, WDA_SET_STAKEY_RSP, (void *)setStaKeyParams , 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessSetStaKeyReq
  * Request to WDI for programming the STA key( key for Unicast frames 
@@ -4202,9 +4629,12 @@
                   (WDI_SetSTAKeyReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_SetSTAKeyReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    v_U8_t keyIndex;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiSetStaKeyParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4221,13 +4651,17 @@
       vos_mem_free(wdiSetStaKeyParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    vos_mem_set(wdiSetStaKeyParam, sizeof(WDI_SetSTAKeyReqParamsType), 0);
+
    vos_mem_zero(wdiSetStaKeyParam, sizeof(WDI_SetSTAKeyReqParamsType));
+
    /* copy set STA key params to WDI structure */
    wdiSetStaKeyParam->wdiKeyInfo.ucSTAIdx = setStaKeyParams->staIdx;
    wdiSetStaKeyParam->wdiKeyInfo.wdiEncType = setStaKeyParams->encType;
    wdiSetStaKeyParam->wdiKeyInfo.wdiWEPType = setStaKeyParams->wepType;
    wdiSetStaKeyParam->wdiKeyInfo.ucDefWEPIdx = setStaKeyParams->defWEPIdx;
+
    if(setStaKeyParams->encType != eSIR_ED_NONE)
    {
       if( (wdiSetStaKeyParam->wdiKeyInfo.wdiWEPType == WDI_WEP_STATIC) && 
@@ -4251,6 +4685,7 @@
                                   setStaKeyParams->key[keyIndex].unicast;
             wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyDirection =
                                   setStaKeyParams->key[keyIndex].keyDirection;
+
             vos_mem_copy(wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyRsc, 
                   setStaKeyParams->key[keyIndex].keyRsc, WLAN_MAX_KEY_RSC_LEN);
             wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].paeRole =
@@ -4265,6 +4700,7 @@
                 wdiSetStaKeyParam->wdiKeyInfo.ucDefWEPIdx = keyIndex;
             }
          }
+
          wdiSetStaKeyParam->wdiKeyInfo.ucNumKeys = 
                                           SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
 #else
@@ -4289,13 +4725,16 @@
    }
    wdiSetStaKeyParam->wdiKeyInfo.ucSingleTidRc = setStaKeyParams->singleTidRc;
    wdiSetStaKeyParam->wdiReqStatusCB = NULL ;
+
    /* Store set key pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = setStaKeyParams;
    pWdaParams->wdaWdiApiMsgParam = wdiSetStaKeyParam;
+
    status = WDI_SetSTAKeyReq(wdiSetStaKeyParam, 
                           (WDI_SetSTAKeyRspCb)WDA_SetStaKeyReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4305,8 +4744,10 @@
       setStaKeyParams->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_SET_STAKEY_RSP, (void *)setStaKeyParams, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_SetBcastStaKeyReqCallback
  * send SET Bcast STA key RSP back to PE
@@ -4316,8 +4757,10 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
    tSetStaKeyParams *setStaKeyParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4327,13 +4770,18 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    setStaKeyParams = (tSetStaKeyParams *)pWdaParams->wdaMsgParam;
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    setStaKeyParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    WDA_SendMsg(pWDA, WDA_SET_STA_BCASTKEY_RSP, (void *)setStaKeyParams , 0) ;
+
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessSetBcastStaKeyReq
  * Request to WDI for programming the Bcast STA key( key for Broadcast frames 
@@ -4347,9 +4795,12 @@
                   (WDI_SetSTAKeyReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_SetSTAKeyReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    v_U8_t keyIndex;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiSetStaKeyParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4366,13 +4817,17 @@
       vos_mem_free(wdiSetStaKeyParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    vos_mem_set(wdiSetStaKeyParam, sizeof(WDI_SetSTAKeyReqParamsType), 0);
+
    vos_mem_zero(wdiSetStaKeyParam, sizeof(WDI_SetSTAKeyReqParamsType));
+
    /* copy set STA key params to WDI structure */
    wdiSetStaKeyParam->wdiKeyInfo.ucSTAIdx = setStaKeyParams->staIdx;
    wdiSetStaKeyParam->wdiKeyInfo.wdiEncType = setStaKeyParams->encType;
    wdiSetStaKeyParam->wdiKeyInfo.wdiWEPType = setStaKeyParams->wepType;
    wdiSetStaKeyParam->wdiKeyInfo.ucDefWEPIdx = setStaKeyParams->defWEPIdx;
+
    if(setStaKeyParams->encType != eSIR_ED_NONE)
    {
 #ifdef WLAN_SOFTAP_FEATURE
@@ -4385,6 +4840,7 @@
                                setStaKeyParams->key[keyIndex].unicast;
          wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyDirection =
                                setStaKeyParams->key[keyIndex].keyDirection;
+
          vos_mem_copy(wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].keyRsc, 
                setStaKeyParams->key[keyIndex].keyRsc, WLAN_MAX_KEY_RSC_LEN);
          wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].paeRole =
@@ -4394,6 +4850,7 @@
          vos_mem_copy(wdiSetStaKeyParam->wdiKeyInfo.wdiKey[keyIndex].key, 
                setStaKeyParams->key[keyIndex].key, SIR_MAC_MAX_KEY_LENGTH);
       }
+
       wdiSetStaKeyParam->wdiKeyInfo.ucNumKeys = 
                                        SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
 #else
@@ -4416,13 +4873,16 @@
 #endif
    }
    wdiSetStaKeyParam->wdiKeyInfo.ucSingleTidRc = setStaKeyParams->singleTidRc;
+
    /* Store set key pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = setStaKeyParams;
    pWdaParams->wdaWdiApiMsgParam = wdiSetStaKeyParam;
+
    status = WDI_SetSTABcastKeyReq(wdiSetStaKeyParam, 
                           (WDI_SetSTAKeyRspCb)WDA_SetBcastStaKeyReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4432,8 +4892,10 @@
       setStaKeyParams->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_SET_STA_BCASTKEY_RSP, (void *)setStaKeyParams, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_RemoveStaKeyReqCallback
  * send SET BSS key RSP back to PE
@@ -4443,8 +4905,10 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
    tRemoveStaKeyParams *removeStaKeyParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4454,13 +4918,18 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    removeStaKeyParams = (tRemoveStaKeyParams *)pWdaParams->wdaMsgParam;
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    removeStaKeyParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    WDA_SendMsg(pWDA, WDA_REMOVE_STAKEY_RSP, (void *)removeStaKeyParams , 0) ;
+
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessRemoveStaKeyReq
  * Request to WDI to remove the STA key( key for Unicast frames Encryption)
@@ -4473,8 +4942,10 @@
                   (WDI_RemoveSTAKeyReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_RemoveSTAKeyReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiRemoveStaKeyParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4491,19 +4962,23 @@
       vos_mem_free(wdiRemoveStaKeyParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    /* copy remove STA key params to WDI structure*/
    wdiRemoveStaKeyParam->wdiKeyInfo.ucSTAIdx = removeStaKeyParams->staIdx;
    wdiRemoveStaKeyParam->wdiKeyInfo.wdiEncType = removeStaKeyParams->encType;
    wdiRemoveStaKeyParam->wdiKeyInfo.ucKeyId = removeStaKeyParams->keyId;
    wdiRemoveStaKeyParam->wdiKeyInfo.ucUnicast = removeStaKeyParams->unicast;
    wdiRemoveStaKeyParam->wdiReqStatusCB = NULL ;
+
    /* Store remove key pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = removeStaKeyParams;
    pWdaParams->wdaWdiApiMsgParam = wdiRemoveStaKeyParam;
+
    status = WDI_RemoveSTAKeyReq(wdiRemoveStaKeyParam, 
                      (WDI_RemoveSTAKeyRspCb)WDA_RemoveStaKeyReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4513,17 +4988,21 @@
       removeStaKeyParams->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_REMOVE_STAKEY_RSP, (void *)removeStaKeyParams, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_IsHandleSetLinkStateReq
  * Update the WDA state and return the status to handle this message or not
  */ 
+
 WDA_processSetLinkStateStatus WDA_IsHandleSetLinkStateReq(
                                           tWDA_CbContext *pWDA,
                                           tLinkStateParams *linkStateParams)
 {
    WDA_processSetLinkStateStatus status = WDA_PROCESS_SET_LINK_STATE;
+
    switch(linkStateParams->state)
    {
       case eSIR_LINK_PREASSOC_STATE:
@@ -4535,6 +5014,7 @@
          */
          vos_mem_copy(pWDA->macBSSID,linkStateParams->bssid, 
                                                    sizeof(tSirMacAddr));
+
          vos_mem_copy(pWDA->macSTASelf,linkStateParams->selfMacAddr, 
                                                    sizeof(tSirMacAddr));
          /* UMAC is issuing the setlink state with PREASSOC twice (before set 
@@ -4554,27 +5034,20 @@
          pWDA->linkState = linkStateParams->state;
          status = WDA_IGNORE_SET_LINK_STATE;
          break;
+
       default:
          if(pWDA->wdaState != WDA_READY_STATE)
          {
-            /*If WDA_SET_LINK_STATE is recieved with any other link state apart 
-             *from eSIR_LINK_PREASSOC_STATE and eSIR_LINK_BTAMP_PREASSOC_STATE when 
-             *pWDA->wdaState is in WDA_PRE_ASSOC_STATE(This can happen only in 
-             *error cases) so reset the WDA state to WDA_READY_STATE to avoid 
-             *the ASSERT in WDA_Stop during module unload.*/
-            if (pWDA->wdaState == WDA_PRE_ASSOC_STATE)
-            {
-               pWDA->wdaState = WDA_READY_STATE;
-            }
-            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                        "Set link state called when WDA is not in READY STATE " );
-            status = WDA_IGNORE_SET_LINK_STATE;
+             VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                     "Set link state called when WDA is not in READY STATE " );
+             status = WDA_IGNORE_SET_LINK_STATE;
          }
          break;
    }
    
    return status;
 }
+
 /*
  * FUNCTION: WDA_SetLinkStateCallback
  * call back function for set link state from WDI
@@ -4584,6 +5057,7 @@
    tWDA_CbContext *pWDA;
    tLinkStateParams *linkStateParams;
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
    if(NULL == pWdaParams)
@@ -4593,8 +5067,11 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+
    linkStateParams = (tLinkStateParams *)pWdaParams->wdaMsgParam ;
+
    /*
     * In STA mode start the BA activity check timer after association
     * and in AP mode start BA activity check timer after BSS start */
@@ -4604,7 +5081,9 @@
    {
       WDA_START_TIMER(&pWDA->wdaTimers.baActivityChkTmr);
    }
+
    WDA_SendMsg(pWDA, WDA_SET_LINK_STATE_RSP, (void *)linkStateParams , 0) ;
+
    /* 
     * No respone required for WDA_SET_LINK_STATE so free the request 
     * param here
@@ -4619,6 +5098,7 @@
    }
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessSetLinkState
  * Request to WDI to set the link status.
@@ -4639,12 +5119,12 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s:pMac is NULL", __FUNCTION__);
       VOS_ASSERT(0);
-      vos_mem_free(wdiSetLinkStateParam);
       return VOS_STATUS_E_FAILURE;
    }
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiSetLinkStateParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4661,6 +5141,7 @@
       vos_mem_free(wdiSetLinkStateParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    if(WDA_IGNORE_SET_LINK_STATE == 
                   WDA_IsHandleSetLinkStateReq(pWDA,linkStateParams))
    {
@@ -4670,13 +5151,17 @@
    {
       vos_mem_copy(wdiSetLinkStateParam->wdiLinkInfo.macBSSID, 
                                   linkStateParams->bssid, sizeof(tSirMacAddr));
+
       vos_mem_copy(wdiSetLinkStateParam->wdiLinkInfo.macSelfStaMacAddr, 
                                   linkStateParams->selfMacAddr, sizeof(tSirMacAddr));
+
       wdiSetLinkStateParam->wdiLinkInfo.wdiLinkState = linkStateParams->state;
       wdiSetLinkStateParam->wdiReqStatusCB = NULL ;
+
       pWdaParams->pWdaContext = pWDA;
       /* Store remove key pointer, as this will be used for response */
       pWdaParams->wdaMsgParam = (void *)linkStateParams ;
+
       /* store Params pass it to WDI */
       pWdaParams->wdaWdiApiMsgParam = (void *)wdiSetLinkStateParam ;
       /* Stop Timer only other than GO role and concurrent session */
@@ -4686,22 +5171,27 @@
       {
          WDA_STOP_TIMER(&pWDA->wdaTimers.baActivityChkTmr);
       }
+
       status = WDI_SetLinkStateReq(wdiSetLinkStateParam, 
                         (WDI_SetLinkStateRspCb)WDA_SetLinkStateCallback, pWdaParams);
+
       if(IS_WDI_STATUS_FAILURE(status))
       {
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
              "Failure in set link state Req WDI API, free all the memory " );
       }
    }
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       vos_mem_free(wdiSetLinkStateParam) ;
-      WDA_SendMsg(pWDA, WDA_SET_LINK_STATE_RSP, (void *)linkStateParams, 0);
+      vos_mem_free(linkStateParams);
       vos_mem_free(pWdaParams);
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_GetStatsReqParamsCallback
  * send the response to PE with Stats received from WDI
@@ -4715,6 +5205,7 @@
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    pGetPEStatsRspParams = 
        (tAniGetPEStatsRsp *)vos_mem_malloc(sizeof(tAniGetPEStatsRsp) +
        (wdiGetStatsRsp->usMsgLen - sizeof(WDI_GetStatsRspParamsType)));
@@ -4726,6 +5217,7 @@
       VOS_ASSERT(0);
       return;
    }
+
    vos_mem_set(pGetPEStatsRspParams, wdiGetStatsRsp->usMsgLen, 0);
    pGetPEStatsRspParams->msgType = wdiGetStatsRsp->usMsgType;
    pGetPEStatsRspParams->msgLen = sizeof(tAniGetPEStatsRsp) + 
@@ -4738,15 +5230,18 @@
                       CONVERT_WDI2VOS_STATUS(wdiGetStatsRsp->wdiStatus);
    pGetPEStatsRspParams->staId   = wdiGetStatsRsp->ucSTAIdx;
    pGetPEStatsRspParams->statsMask = wdiGetStatsRsp->uStatsMask;
+
    vos_mem_copy( pGetPEStatsRspParams + 1,
                   wdiGetStatsRsp + 1,
                   wdiGetStatsRsp->usMsgLen - sizeof(WDI_GetStatsRspParamsType));
+
   /* send response to UMAC*/
    WDA_SendMsg(pWDA, WDA_GET_STATISTICS_RSP, pGetPEStatsRspParams , 0) ;
    
    return;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessGetStatsReq
  * Request to WDI to get the statistics
@@ -4757,15 +5252,20 @@
    WDI_Status status = WDI_STATUS_SUCCESS ;
    WDI_GetStatsReqParamsType wdiGetStatsParam;
    tAniGetPEStatsRsp *pGetPEStatsRspParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    wdiGetStatsParam.wdiGetStatsParamsInfo.ucSTAIdx = 
                                           pGetStatsParams->staId;
    wdiGetStatsParam.wdiGetStatsParamsInfo.uStatsMask = 
                                           pGetStatsParams->statsMask;
+
    wdiGetStatsParam.wdiReqStatusCB = NULL ;
+
    status = WDI_GetStatsReq(&wdiGetStatsParam, 
        (WDI_GetStatsRspCb)WDA_GetStatsReqParamsCallback, pWDA);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4777,9 +5277,9 @@
           VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: VOS MEM Alloc Failure", __FUNCTION__); 
           VOS_ASSERT(0);
-		  vos_mem_free(pGetStatsParams);
           return VOS_STATUS_E_NOMEM;
       }
+
       pGetPEStatsRspParams->msgType = WDA_GET_STATISTICS_RSP;
       pGetPEStatsRspParams->msgLen = sizeof(tAniGetPEStatsRsp);
       pGetPEStatsRspParams->staId = pGetStatsParams->staId;
@@ -4787,10 +5287,12 @@
       WDA_SendMsg(pWDA, WDA_GET_STATISTICS_RSP, 
                                  (void *)pGetPEStatsRspParams, 0) ;
    }
+
    /* Free the request message */
    vos_mem_free(pGetStatsParams);
    return CONVERT_WDI2VOS_STATUS(status);
 }
+
 /*
  * FUNCTION: WDA_UpdateEDCAParamCallback
  * call back function for Update EDCA params from WDI
@@ -4802,6 +5304,7 @@
    
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4810,11 +5313,14 @@
       return ;
    }
    pEdcaParams = (tEdcaParams *)pWdaParams->wdaMsgParam ;
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams);
    vos_mem_free(pEdcaParams);
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessUpdateEDCAParamReq
  * Request to WDI to Update the EDCA params.
@@ -4827,14 +5333,15 @@
                      (WDI_UpdateEDCAParamsType *)vos_mem_malloc(
                                              sizeof(WDI_UpdateEDCAParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiEdcaParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: VOS MEM Alloc Failure", __FUNCTION__); 
       VOS_ASSERT(0);
-	  vos_mem_free(pEdcaParams);
       return VOS_STATUS_E_NOMEM;
    }
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
@@ -4844,9 +5351,9 @@
                            "%s: VOS MEM Alloc Failure", __FUNCTION__); 
       VOS_ASSERT(0);
       vos_mem_free(wdiEdcaParam);
-	  vos_mem_free(pEdcaParams);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiEdcaParam->wdiEDCAInfo.ucBssIdx = pEdcaParams->bssIdx;
    wdiEdcaParam->wdiEDCAInfo.ucEDCAParamsValid = pEdcaParams->highPerformance;
    WDA_UpdateEdcaParamsForAC(pWDA, &wdiEdcaParam->wdiEDCAInfo.wdiEdcaBEInfo,
@@ -4858,13 +5365,17 @@
    WDA_UpdateEdcaParamsForAC(pWDA, &wdiEdcaParam->wdiEDCAInfo.wdiEdcaVOInfo,
                                                            &pEdcaParams->acvo);
    wdiEdcaParam->wdiReqStatusCB = NULL ;
+
    pWdaParams->pWdaContext = pWDA;
    /* Store remove key pointer, as this will be used for response */
    pWdaParams->wdaMsgParam = (void *)pEdcaParams ;
+
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiEdcaParam ;
+
    status = WDI_UpdateEDCAParams(wdiEdcaParam, 
                (WDI_UpdateEDCAParamsRspCb)WDA_UpdateEDCAParamCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4873,8 +5384,10 @@
       vos_mem_free(pWdaParams);
       vos_mem_free(pEdcaParams);
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_AddBAReqCallback
  * send ADD BA RSP back to PE
@@ -4885,8 +5398,10 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA;
    tAddBAParams *pAddBAReqParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4896,13 +5411,18 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    pAddBAReqParams = (tAddBAParams *)pWdaParams->wdaMsgParam;
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams);
+
    pAddBAReqParams->status = CONVERT_WDI2SIR_STATUS(pAddBARspParams->wdiStatus) ;
+
    WDA_SendMsg(pWDA, WDA_ADDBA_RSP, (void *)pAddBAReqParams , 0) ;
+
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessAddBAReq
  * Request to WDI to Update the ADDBA REQ params.
@@ -4915,8 +5435,10 @@
                      (WDI_AddBAReqParamsType *)vos_mem_malloc(
                                              sizeof(WDI_AddBAReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiAddBAReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -4933,18 +5455,23 @@
       vos_mem_free(wdiAddBAReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    do
    {
       WDI_AddBAReqinfoType *wdiAddBaInfo = &wdiAddBAReqParam->wdiBAInfoType ;
+
       wdiAddBaInfo->ucSTAIdx = staIdx ;
       wdiAddBaInfo->ucBaSessionID = baSessionID ;
       wdiAddBaInfo->ucWinSize     = WDA_BA_MAX_WINSIZE ;
+
    } while(0) ;
    wdiAddBAReqParam->wdiReqStatusCB = NULL ;
+
    pWdaParams->pWdaContext = pWDA;
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiAddBAReqParam ;
    pWdaParams->wdaMsgParam = pAddBAReqParams;
+
    wstatus = WDI_AddBAReq(wdiAddBAReqParam, 
                           (WDI_AddBARspCb)WDA_AddBAReqCallback, pWdaParams);
 
@@ -4958,8 +5485,11 @@
       pAddBAReqParams->status = eSIR_FAILURE;
       WDA_SendMsg(pWDA, WDA_ADDBA_RSP, (void *)pAddBAReqParams , 0) ;
    }
+
    return status;
+
 }
+
 /*
  * FUNCTION: WDA_AddBASessionReqCallback
  * send ADD BA SESSION RSP back to PE/(or TL)
@@ -4971,6 +5501,7 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
    tAddBAParams *pAddBAReqParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
    if(NULL == pWdaParams)
@@ -4982,17 +5513,19 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    pAddBAReqParams = (tAddBAParams *)pWdaParams->wdaMsgParam;
+
    if( NULL == pAddBAReqParams )
    {
+
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                                           "%s: pAddBAReqParams received NULL " ,__FUNCTION__);
       VOS_ASSERT( 0 );
-	  vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
-	  vos_mem_free(pWdaParams);
       return ;
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams);
+
    /* 
     * if WDA in update TL state, update TL with BA session parama and send
     * another request to HAL(/WDI) (ADD_BA_REQ)
@@ -5010,6 +5543,7 @@
                                         wdiAddBaSession->ucBaBufferSize,
                                         wdiAddBaSession->ucWinSize,
                                         wdiAddBaSession->usBaSSN );
+
       WDA_ProcessAddBAReq(pWDA, status, wdiAddBaSession->usBaSessionID, 
                                       wdiAddBaSession->ucSTAIdx, pAddBAReqParams) ;
    }
@@ -5028,11 +5562,14 @@
       pWDA->wdaMsgParam = NULL;
       WDA_SendMsg(pWDA, WDA_ADDBA_RSP, (void *)pAddBAReqParams , 0) ;
    }
+
    /*Reset the WDA state to READY */
    pWDA->wdaState = WDA_READY_STATE;
+
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessAddBASessionReq
  * Request to WDI to Update the ADDBA REQ params.
@@ -5045,8 +5582,10 @@
                      (WDI_AddBASessionReqParamsType *)vos_mem_malloc(
                           sizeof(WDI_AddBASessionReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiAddBASessionReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5063,6 +5602,7 @@
       vos_mem_free(wdiAddBASessionReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    /*
     * Populate ADD BA parameters and pass these paarmeters to WDI.
     * ADD BA SESSION REQ will update HAL with BA params, WDA, will changes
@@ -5078,12 +5618,15 @@
       wdiBAInfoType->ucSTAIdx = pAddBAReqParams->staIdx;
       vos_mem_copy(wdiBAInfoType->macPeerAddr,
                        pAddBAReqParams->peerMacAddr, sizeof(tSirMacAddr));
+
       wdiBAInfoType->ucBaTID = pAddBAReqParams->baTID;
+
       wdiBAInfoType->ucBaPolicy = pAddBAReqParams->baPolicy;
       wdiBAInfoType->usBaBufferSize = pAddBAReqParams->baBufferSize;
       wdiBAInfoType->usBaTimeout = pAddBAReqParams->baTimeout;
       wdiBAInfoType->usBaSSN = pAddBAReqParams->baSSN;
       wdiBAInfoType->ucBaDirection = pAddBAReqParams->baDirection;
+
       /* check the BA direction and update state accordingly */
       (eBA_RECIPIENT == wdiBAInfoType->ucBaDirection) 
                                  ? (pWDA->wdaState = WDA_BA_UPDATE_TL_STATE)
@@ -5091,13 +5634,16 @@
  
    }while(0) ;
    wdiAddBASessionReqParam->wdiReqStatusCB = NULL ;
+
    pWdaParams->pWdaContext = pWDA;
    /* Store ADD BA pointer, as this will be used for response */
    pWdaParams->wdaMsgParam = (void *)pAddBAReqParams ;
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiAddBASessionReqParam ;
+
    status = WDI_AddBASessionReq(wdiAddBASessionReqParam, 
               (WDI_AddBASessionRspCb)WDA_AddBASessionReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5106,8 +5652,11 @@
       vos_mem_free(pWdaParams->wdaMsgParam);
       vos_mem_free(pWdaParams);
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
+
 }
+
 /*
  * FUNCTION: WDA_DelBANotifyTL
  * send DEL BA IND to TL
@@ -5119,6 +5668,7 @@
    //tSirMsgQ msg;
    vos_msg_t vosMsg;
    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
+
    if(NULL == pDelBAInd) 
    { 
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5126,11 +5676,12 @@
       VOS_ASSERT(0) ; 
       return; 
    } 
+
    pDelBAInd->mesgType = WDA_DELETEBA_IND;
    pDelBAInd->staIdx = (tANI_U8) pDelBAReqParams->staIdx;
    pDelBAInd->baTID = (tANI_U8) pDelBAReqParams->baTID;
    pDelBAInd->mesgLen = sizeof( tDelBAInd );
- 
+
  
    vosMsg.type = WDA_DELETEBA_IND;
    vosMsg.bodyptr = pDelBAInd;
@@ -5140,6 +5691,7 @@
       vosStatus = VOS_STATUS_E_BADMSG;
    }
 }
+
 /*
  * FUNCTION: WDA_DelBAReqCallback
  * send DEL BA RSP back to PE
@@ -5149,8 +5701,10 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
    tDelBAParams *pDelBAReqParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5160,12 +5714,14 @@
    }
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
    pDelBAReqParams = (tDelBAParams *)pWdaParams->wdaMsgParam ;
+
    /* Notify TL about DEL BA in case of recipinet */
    if((VOS_STATUS_SUCCESS == CONVERT_WDI2VOS_STATUS(status)) && 
                              (eBA_RECIPIENT == pDelBAReqParams->baDirection))
    {
       WDA_DelBANotifyTL(pWDA, pDelBAReqParams);
    }
+
    /* 
     * No respone required for WDA_DELBA_IND so just free the request 
     * param here
@@ -5176,6 +5732,7 @@
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessDelBAReq
  * Request to WDI to Update the DELBA REQ params.
@@ -5190,8 +5747,10 @@
    tWDA_ReqParams *pWdaParams ;
    tANI_U16 staIdx = 0;
    tANI_U8 tid = 0;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiDelBAReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5208,23 +5767,29 @@
       vos_mem_free(wdiDelBAReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiDelBAReqParam->wdiBAInfo.ucSTAIdx = pDelBAReqParams->staIdx;
    wdiDelBAReqParam->wdiBAInfo.ucBaTID = pDelBAReqParams->baTID;
    wdiDelBAReqParam->wdiBAInfo.ucBaDirection = pDelBAReqParams->baDirection;
    wdiDelBAReqParam->wdiReqStatusCB = NULL ;
+
    pWdaParams->pWdaContext = pWDA;
    /* Store DEL BA pointer, as this will be used for response */
    pWdaParams->wdaMsgParam = (void *)pDelBAReqParams ;
+
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiDelBAReqParam ;
+
    /* if BA exchange over the air is failed, clear this tid in BaBitmap
     * maintained in WDA, so that WDA can retry for another BA session
     */
    staIdx = pDelBAReqParams->staIdx;
    tid = pDelBAReqParams->baTID;
    WDA_CLEAR_BA_TXFLAG(pWDA, staIdx, tid);
+
    status = WDI_DelBAReq(wdiDelBAReqParam, 
                          (WDI_DelBARspCb)WDA_DelBAReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5233,8 +5798,11 @@
       vos_mem_free(pWdaParams->wdaMsgParam);
       vos_mem_free(pWdaParams);
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
+
 }
+
 /*
  * FUNCTION: WDA_AddTSReqCallback
  * send ADD TS RSP back to PE
@@ -5247,6 +5815,7 @@
    
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5260,10 +5829,14 @@
    vos_mem_free(pWdaParams);
    
    pAddTsReqParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    WDA_SendMsg(pWDA, WDA_ADD_TS_RSP, (void *)pAddTsReqParams , 0) ;
+
    return ;
 }
 
+
+
 /*
  * FUNCTION: WDA_ProcessAddTSReq
  * Request to WDI to Update the ADD TS  REQ params.
@@ -5276,8 +5849,10 @@
                      (WDI_AddTSReqParamsType *)vos_mem_malloc(
                                              sizeof(WDI_AddTSReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiAddTSReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5294,8 +5869,10 @@
       vos_mem_free(wdiAddTSReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiAddTSReqParam->wdiTsInfo.ucSTAIdx = pAddTsReqParams->staIdx;
    wdiAddTSReqParam->wdiTsInfo.ucTspecIdx = pAddTsReqParams->tspecIdx;
+
    //TS IE
    wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.ucType = pAddTsReqParams->tspec.type;
    wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.ucLength = 
@@ -5324,6 +5901,7 @@
                            pAddTsReqParams->tspec.tsinfo.schedule.schedule;
    wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiSchedule.rsvd = 
                            pAddTsReqParams->tspec.tsinfo.schedule.rsvd;
+
    //TS IE
    wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.usNomMsduSz = 
                            pAddTsReqParams->tspec.nomMsduSz;
@@ -5355,6 +5933,7 @@
                            pAddTsReqParams->tspec.surplusBw;
    wdiAddTSReqParam->wdiTsInfo.wdiTspecIE.usMediumTime = 
                            pAddTsReqParams->tspec.mediumTime;
+
    /* TODO: tAddTsParams doesn't have the following fields */
 #if 0 
    wdiAddTSReqParam->wdiTsInfo.ucUapsdFlags = 
@@ -5367,10 +5946,13 @@
    pWdaParams->pWdaContext = pWDA;
    /* Store ADD TS pointer, as this will be used for response */
    pWdaParams->wdaMsgParam = (void *)pAddTsReqParams ;
+
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiAddTSReqParam ;
+
    status = WDI_AddTSReq(wdiAddTSReqParam, 
                    (WDI_AddTsRspCb)WDA_AddTSReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5380,9 +5962,12 @@
       pAddTsReqParams->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_ADD_TS_RSP, (void *)pAddTsReqParams , 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
+
 }
 
+
 /*
  * FUNCTION: WDA_DelTSReqCallback
  * send DEL TS RSP back to PE
@@ -5390,18 +5975,23 @@
 void WDA_DelTSReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams->wdaMsgParam) ;
    vos_mem_free(pWdaParams);
+
    /* 
     * No respone required for WDA_DEL_TS_REQ so just free the request 
     * param here
     */
+
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessDelTSReq
  * Request to WDI to Update the DELTS REQ params.
@@ -5414,8 +6004,10 @@
                      (WDI_DelTSReqParamsType *)vos_mem_malloc(
                                              sizeof(WDI_DelTSReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiDelTSReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5432,18 +6024,23 @@
       vos_mem_free(wdiDelTSReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    vos_mem_copy(wdiDelTSReqParam->wdiDelTSInfo.macBSSID, 
                                   pDelTSReqParams->bssId, sizeof(tSirMacAddr));
    wdiDelTSReqParam->wdiDelTSInfo.ucSTAIdx = pDelTSReqParams->staIdx;
    wdiDelTSReqParam->wdiDelTSInfo.ucTspecIdx = pDelTSReqParams->tspecIdx;
    wdiDelTSReqParam->wdiReqStatusCB = NULL ;
+
    pWdaParams->pWdaContext = pWDA;
    /* Store DEL TS pointer, as this will be used for response */
    pWdaParams->wdaMsgParam = (void *)pDelTSReqParams ;
+
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiDelTSReqParam ;
+
    status = WDI_DelTSReq(wdiDelTSReqParam, 
                        (WDI_DelTsRspCb)WDA_DelTSReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5452,8 +6049,11 @@
       vos_mem_free(pWdaParams->wdaMsgParam);
       vos_mem_free(pWdaParams);
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
+
 }
+
 /*
  * FUNCTION: WDA_UpdateBeaconParamsCallback
  *  Free the memory. No need to send any response to PE in this case
@@ -5461,8 +6061,10 @@
 void WDA_UpdateBeaconParamsCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5477,8 +6079,10 @@
     * No respone required for WDA_UPDATE_BEACON_IND so just free the request 
     * param here
     */
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessUpdateBeaconParams
  * Request to WDI to send  the beacon parameters to HAL to update the Hardware
@@ -5491,8 +6095,10 @@
                      (WDI_UpdateBeaconParamsType *)vos_mem_malloc(
                                              sizeof(WDI_UpdateBeaconParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiUpdateBeaconParams) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5509,6 +6115,7 @@
       vos_mem_free(wdiUpdateBeaconParams);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucBssIdx = 
                            pUpdateBeaconParams->bssIdx;
    wdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfShortPreamble = 
@@ -5538,11 +6145,14 @@
    pWdaParams->pWdaContext = pWDA;
    /* Store UpdateBeacon Req pointer, as this will be used for response */
    pWdaParams->wdaMsgParam = (void *)pUpdateBeaconParams ;
+
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiUpdateBeaconParams ;
+
    status = WDI_UpdateBeaconParamsReq(wdiUpdateBeaconParams, 
                  (WDI_UpdateBeaconParamsRspCb)WDA_UpdateBeaconParamsCallback,
                  pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5551,9 +6161,13 @@
       vos_mem_free(pWdaParams->wdaMsgParam);
       vos_mem_free(pWdaParams);
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
+
 }
+
 #ifdef FEATURE_WLAN_CCX
+
 /*
  * FUNCTION: WDA_TSMStatsReqCallback
  * send TSM Stats RSP back to PE
@@ -5566,6 +6180,7 @@
  
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ Entering: %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5575,6 +6190,7 @@
    }
    pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
    pTsmRspParams = (tTSMStats *)pWdaParams->wdaMsgParam ;
+
    if( NULL == pTsmRspParams )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5582,6 +6198,7 @@
       VOS_ASSERT( 0 );
       return ;
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams);
    
@@ -5595,11 +6212,15 @@
    pTsmRspParams->tsmMetrics.UplinkPktCount = pwdiTSMStatsRspParams->UplinkPktCount;
    pTsmRspParams->tsmMetrics.RoamingCount = pwdiTSMStatsRspParams->RoamingCount;
    pTsmRspParams->tsmMetrics.RoamingDly = pwdiTSMStatsRspParams->RoamingDly;
+
    WDA_SendMsg(pWDA, WDA_TSM_STATS_RSP, (void *)pTsmRspParams , 0) ;
+
    return ;
 }
 
 
+
+
 /*
  * FUNCTION: WDA_ProcessTsmStatsReq
  * Request to WDI to get the TSM Stats params.
@@ -5610,8 +6231,10 @@
    WDI_Status status = WDI_STATUS_SUCCESS ;
    WDI_TSMStatsReqParamsType *wdiTSMReqParam = NULL;
    tWDA_ReqParams *pWdaParams = NULL;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> Entering: %s " ,__FUNCTION__);
+
    if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5619,6 +6242,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    wdiTSMReqParam = (WDI_TSMStatsReqParamsType *)vos_mem_malloc(
                                  sizeof(WDI_TSMStatsReqParamsType));
    if(NULL == wdiTSMReqParam) 
@@ -5628,6 +6252,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -5637,6 +6262,7 @@
       vos_mem_free(wdiTSMReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiTSMReqParam->wdiTsmStatsParamsInfo.ucTid = pTsmStats->tid;
    vos_mem_copy(wdiTSMReqParam->wdiTsmStatsParamsInfo.bssid,
                                            pTsmStats->bssId,
@@ -5646,10 +6272,13 @@
    pWdaParams->pWdaContext = pWDA;
    /* Store TSM Stats pointer, as this will be used for response */
    pWdaParams->wdaMsgParam = (void *)pTsmStats ;
+
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiTSMReqParam ;
+
    status = WDI_TSMStatsReq(wdiTSMReqParam,
                            (WDI_TsmRspCb)WDA_TSMStatsReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5657,6 +6286,7 @@
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
       vos_mem_free(pWdaParams) ;
    }
+
   return CONVERT_WDI2VOS_STATUS(status) ;
 } 
 #endif
@@ -5667,10 +6297,13 @@
 void WDA_SendBeaconParamsCallback(WDI_Status status, void* pUserData)
 {
 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessSendBeacon
  * Request to WDI to send the beacon template to HAL to update the TPE memory and 
@@ -5681,8 +6314,10 @@
 {
    WDI_Status status = WDI_STATUS_SUCCESS ;
    WDI_SendBeaconParamsType wdiSendBeaconReqParam; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    vos_mem_copy(wdiSendBeaconReqParam.wdiSendBeaconParamsInfo.macBSSID, 
                               pSendbeaconParams->bssId, sizeof(tSirMacAddr));
    wdiSendBeaconReqParam.wdiSendBeaconParamsInfo.beaconLength = 
@@ -5695,32 +6330,41 @@
    wdiSendBeaconReqParam.wdiSendBeaconParamsInfo.usP2PIeOffset = 
                               pSendbeaconParams->p2pIeOffset;
 #endif
+
    /* Copy the beacon template to local buffer */
    vos_mem_copy(wdiSendBeaconReqParam.wdiSendBeaconParamsInfo.beacon, 
                  pSendbeaconParams->beacon, pSendbeaconParams->beaconLength);
    wdiSendBeaconReqParam.wdiReqStatusCB = NULL ;
 
+
    status = WDI_SendBeaconParamsReq(&wdiSendBeaconReqParam, 
             (WDI_SendBeaconParamsRspCb)WDA_SendBeaconParamsCallback, pWDA);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
           "Failure in SEND BEACON REQ Params WDI API" );
    }
+
    vos_mem_free(pSendbeaconParams);
    return CONVERT_WDI2VOS_STATUS(status);
+
 }
+
 /*
  * FUNCTION: WDA_UpdateProbeRspParamsCallback
  * No need to send any response to PE in this case
  */ 
 void WDA_UpdateProbeRspParamsCallback(WDI_Status status, void* pUserData)
 {
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessUpdateProbeRspTemplate
  * Request to WDI to send the probe response template to HAL to update the TPE memory and 
@@ -5729,43 +6373,44 @@
 VOS_STATUS WDA_ProcessUpdateProbeRspTemplate(tWDA_CbContext *pWDA, 
                                  tSendProbeRespParams *pSendProbeRspParams)
 {
-   WDI_Status status = WDI_STATUS_SUCCESS;
-   WDI_UpdateProbeRspTemplateParamsType *wdiSendProbeRspParam =
-         vos_mem_malloc(sizeof(WDI_UpdateProbeRspTemplateParamsType));
+   WDI_Status status = WDI_STATUS_SUCCESS ;
+   WDI_UpdateProbeRspTemplateParamsType wdiSendProbeRspParam; 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
 
-   if (!wdiSendProbeRspParam)
-      return CONVERT_WDI2VOS_STATUS(WDI_STATUS_MEM_FAILURE);
-
    /*Copy update probe response parameters*/
-   vos_mem_copy(wdiSendProbeRspParam->wdiProbeRspTemplateInfo.macBSSID,
+   vos_mem_copy(wdiSendProbeRspParam.wdiProbeRspTemplateInfo.macBSSID, 
                               pSendProbeRspParams->bssId, sizeof(tSirMacAddr));
-   wdiSendProbeRspParam->wdiProbeRspTemplateInfo.uProbeRespTemplateLen =
+   wdiSendProbeRspParam.wdiProbeRspTemplateInfo.uProbeRespTemplateLen = 
                               pSendProbeRspParams->probeRespTemplateLen;
+
    /* Copy the Probe Response template to local buffer */
    vos_mem_copy(
-           wdiSendProbeRspParam->wdiProbeRspTemplateInfo.pProbeRespTemplate,
+           wdiSendProbeRspParam.wdiProbeRspTemplateInfo.pProbeRespTemplate,
            pSendProbeRspParams->pProbeRespTemplate, 
            pSendProbeRspParams->probeRespTemplateLen);
    vos_mem_copy(
-     wdiSendProbeRspParam->wdiProbeRspTemplateInfo.uaProxyProbeReqValidIEBmap,
+     wdiSendProbeRspParam.wdiProbeRspTemplateInfo.uaProxyProbeReqValidIEBmap,
      pSendProbeRspParams->ucProxyProbeReqValidIEBmap,
      WDI_PROBE_REQ_BITMAP_IE_LEN);
    
-   wdiSendProbeRspParam->wdiReqStatusCB = NULL ;
+   wdiSendProbeRspParam.wdiReqStatusCB = NULL ;
    
-   status = WDI_UpdateProbeRspTemplateReq(wdiSendProbeRspParam,
+
+   status = WDI_UpdateProbeRspTemplateReq(&wdiSendProbeRspParam, 
      (WDI_UpdateProbeRspTemplateRspCb)WDA_UpdateProbeRspParamsCallback, pWDA);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
           "Failure in SEND Probe RSP Params WDI API" );
    }
+
    vos_mem_free(pSendProbeRspParams);
-   vos_mem_free(wdiSendProbeRspParam);
    return CONVERT_WDI2VOS_STATUS(status);
+
 }
+
 #if defined(WLAN_FEATURE_VOWIFI) || defined(FEATURE_WLAN_CCX)
 /*
  * FUNCTION: WDA_SetMaxTxPowerCallBack
@@ -5787,31 +6432,34 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    pWDA = (tWDA_CbContext *) pWdaParams->pWdaContext;
    pMaxTxPowerParams = (tMaxTxPowerParams *)pWdaParams->wdaMsgParam ;
+
    if( NULL == pMaxTxPowerParams )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                                           "%s: pMaxTxPowerParams received NULL " ,__FUNCTION__);
-      VOS_ASSERT(0);
-	  vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
-	  vos_mem_free(pWdaParams);
+      VOS_ASSERT( 0 );
       return ;
    }
-  
+
   
   /*need to free memory for the pointers used in the 
     WDA Process.Set Max Tx Power Req function*/
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams);
+
    pMaxTxPowerParams->power = pwdiSetMaxTxPowerRsp->ucPower;
-  
+
   
   /* send response to UMAC*/
    WDA_SendMsg(pWDA, WDA_SET_MAX_TX_POWER_RSP, pMaxTxPowerParams , 0) ;
    
    return;
 }
+
 /*
  * FUNCTION: WDA_SetMaxTxPowerCallBack
  * Request to WDI to send set Max Tx Power Request
@@ -5822,8 +6470,10 @@
    WDI_Status status = WDI_STATUS_SUCCESS;
    WDI_SetMaxTxPowerParamsType *wdiSetMaxTxPowerParams = NULL;
    tWDA_ReqParams *pWdaParams = NULL;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if((NULL != pWDA->wdaMsgParam) ||(NULL != pWDA->wdaWdiApiMsgParam))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5831,6 +6481,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    wdiSetMaxTxPowerParams = (WDI_SetMaxTxPowerParamsType *)vos_mem_malloc(
                                  sizeof(WDI_SetMaxTxPowerParamsType));
    if(NULL == wdiSetMaxTxPowerParams) 
@@ -5840,6 +6491,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -5849,22 +6501,30 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    /* Copy.Max.Tx.Power Params to WDI structure */
    vos_mem_copy(wdiSetMaxTxPowerParams->wdiMaxTxPowerInfo.macBSSId,
                  MaxTxPowerParams->bssId, 
                  sizeof(tSirMacAddr));
+
    vos_mem_copy(wdiSetMaxTxPowerParams->wdiMaxTxPowerInfo.macSelfStaMacAddr,
                  MaxTxPowerParams->selfStaMacAddr, 
                  sizeof(tSirMacAddr));
+
    wdiSetMaxTxPowerParams->wdiMaxTxPowerInfo.ucPower = 
                                               MaxTxPowerParams->power;
+
    wdiSetMaxTxPowerParams->wdiReqStatusCB = NULL ;
+
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = (void *)MaxTxPowerParams ;
+
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiSetMaxTxPowerParams ;
+
    status = WDI_SetMaxTxPowerReq(wdiSetMaxTxPowerParams,
                        (WDA_SetMaxTxPowerRspCb)WDA_SetMaxTxPowerCallBack, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5875,8 +6535,11 @@
    return CONVERT_WDI2VOS_STATUS(status);
    
 }
+
 #endif
+
 #ifdef WLAN_FEATURE_P2P
+
 /*
  * FUNCTION: WDA_SetP2PGONOAReqParamsCallback
  *  Free the memory. No need to send any response to PE in this case
@@ -5884,19 +6547,24 @@
 void WDA_SetP2PGONOAReqParamsCallback(WDI_Status status, void* pUserData)
 {
    tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
    pWDA->wdaWdiApiMsgParam = NULL;
    vos_mem_free(pWDA->wdaMsgParam) ;
    pWDA->wdaMsgParam = NULL;
+
    /* 
     * No respone required for SIR_HAL_SET_P2P_GO_NOA_REQ 
     * so just free the request param here
     */
+
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessSetP2PGONOAReq
  * Request to WDI to set the P2P Group Owner Notice of Absence Req 
@@ -5908,8 +6576,10 @@
    WDI_SetP2PGONOAReqParamsType *wdiSetP2PGONOAReqParam = 
                 (WDI_SetP2PGONOAReqParamsType *)vos_mem_malloc(
                                    sizeof(WDI_SetP2PGONOAReqParamsType)) ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiSetP2PGONOAReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5917,6 +6587,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiSetP2PGONOAReqParam->wdiP2PGONOAInfo.ucOpp_ps = 
                                     pP2pPsConfigParams->opp_ps;
    wdiSetP2PGONOAReqParam->wdiP2PGONOAInfo.uCtWindow = 
@@ -5931,6 +6602,7 @@
                                     pP2pPsConfigParams->single_noa_duration;
    wdiSetP2PGONOAReqParam->wdiP2PGONOAInfo.ucPsSelection = 
                                     pP2pPsConfigParams->psSelection;
+
    if((NULL != pWDA->wdaMsgParam) ||
                              (NULL != pWDA->wdaWdiApiMsgParam))
    {
@@ -5940,13 +6612,17 @@
       vos_mem_free(wdiSetP2PGONOAReqParam);
       return VOS_STATUS_E_FAILURE;
    }
+
    wdiSetP2PGONOAReqParam->wdiReqStatusCB = NULL ;
    /* Store msg pointer from PE, as this will be used for response */
    pWDA->wdaMsgParam = (void *)pP2pPsConfigParams ;
+
    /* store Params pass it to WDI */
    pWDA->wdaWdiApiMsgParam = (void *)wdiSetP2PGONOAReqParam ;
+
    status = WDI_SetP2PGONOAReq(wdiSetP2PGONOAReqParam, 
        (WDI_SetP2PGONOAReqParamsRspCb)WDA_SetP2PGONOAReqParamsCallback, pWDA);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -5956,10 +6632,13 @@
       pWDA->wdaWdiApiMsgParam = NULL;
       pWDA->wdaMsgParam = NULL;
    }
+
    return CONVERT_WDI2VOS_STATUS(status);
 
+
 }
 #endif
+
 #ifdef WLAN_FEATURE_VOWIFI_11R
 /*
  * FUNCTION: WDA_AggrAddTSReqCallback
@@ -5971,8 +6650,10 @@
    tAggrAddTsParams *pAggrAddTsReqParams = 
                            (tAggrAddTsParams *)pWDA->wdaMsgParam ;
    int i;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
    pWDA->wdaWdiApiMsgParam = NULL;
    pWDA->wdaMsgParam = NULL;
@@ -5981,9 +6662,12 @@
    {
       pAggrAddTsReqParams->status[i] = CONVERT_WDI2SIR_STATUS(status) ;
    }
+
    WDA_SendMsg(pWDA, WDA_AGGR_QOS_RSP, (void *)pAggrAddTsReqParams , 0) ;
+
    return ;
 }/* WLAN_FEATURE_VOWIFI_11R */
+
 /*
  * FUNCTION: WDA_ProcessAddTSReq
  * Request to WDI to send an update with AGGREGATED ADD TS REQ params.
@@ -5994,6 +6678,7 @@
    WDI_Status status = WDI_STATUS_SUCCESS ;
    int i;
    WDI_AggrAddTSReqParamsType *wdiAggrAddTSReqParam;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
    if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
@@ -6013,14 +6698,17 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiAggrAddTSReqParam->wdiAggrTsInfo.ucSTAIdx = pAggrAddTsReqParams->staIdx;
    wdiAggrAddTSReqParam->wdiAggrTsInfo.ucTspecIdx = 
       pAggrAddTsReqParams->tspecIdx;
+
    for( i = 0; i < WDI_MAX_NO_AC; i++ )
    {
       wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].ucType = pAggrAddTsReqParams->tspec[i].type;
       wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].ucLength = 
                                                    pAggrAddTsReqParams->tspec[i].length;
+
       wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.ackPolicy =
                               pAggrAddTsReqParams->tspec[i].tsinfo.traffic.ackPolicy;
       wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.userPrio =
@@ -6037,8 +6725,10 @@
                               pAggrAddTsReqParams->tspec[i].tsinfo.traffic.tsid;
       wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.trafficType =
                               pAggrAddTsReqParams->tspec[i].tsinfo.traffic.trafficType;
+
       wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiSchedule.schedule = 
                               pAggrAddTsReqParams->tspec[i].tsinfo.schedule.schedule;
+
       wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].usNomMsduSz = 
                               pAggrAddTsReqParams->tspec[i].nomMsduSz;
       wdiAggrAddTSReqParam->wdiAggrTsInfo.wdiTspecIE[i].usMaxMsduSz = 
@@ -6082,10 +6772,13 @@
    
    /* Store ADD TS pointer, as this will be used for response */
    pWDA->wdaMsgParam = (void *)pAggrAddTsReqParams ;
+
    /* store Params pass it to WDI */
    pWDA->wdaWdiApiMsgParam = (void *)wdiAggrAddTSReqParam ;
+
    status = WDI_AggrAddTSReq(wdiAggrAddTSReqParam, 
                              (WDI_AggrAddTsRspCb)WDA_AggrAddTSReqCallback, pWDA);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6095,9 +6788,11 @@
       pWDA->wdaWdiApiMsgParam = NULL;
       pWDA->wdaMsgParam = NULL;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
 #endif
+
 /*
  * FUNCTION: WDA_EnterImpsReqCallback
  * send Enter IMPS RSP back to PE
@@ -6105,11 +6800,15 @@
 void WDA_EnterImpsReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    WDA_SendMsg(pWDA, WDA_ENTER_IMPS_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessEnterImpsReq
  * Request to WDI to Enter IMPS power state.
@@ -6117,19 +6816,23 @@
 VOS_STATUS WDA_ProcessEnterImpsReq(tWDA_CbContext *pWDA)
 {
    WDI_Status status = WDI_STATUS_SUCCESS ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    status = WDI_EnterImpsReq((WDI_EnterImpsRspCb)WDA_EnterImpsReqCallback, pWDA);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
               "Failure in Enter IMPS REQ WDI API, free all the memory " );
       pWDA->wdaWdiApiMsgParam = NULL;
       pWDA->wdaMsgParam = NULL;
-      WDA_SendMsg(pWDA, WDA_ENTER_IMPS_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_ExitImpsReqCallback
  * send Exit IMPS RSP back to PE
@@ -6137,11 +6840,15 @@
 void WDA_ExitImpsReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    WDA_SendMsg(pWDA, WDA_EXIT_IMPS_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessExitImpsReq
  * Request to WDI to Exit IMPS power state.
@@ -6149,19 +6856,23 @@
 VOS_STATUS WDA_ProcessExitImpsReq(tWDA_CbContext *pWDA)
 {
    WDI_Status status = WDI_STATUS_SUCCESS ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    status = WDI_ExitImpsReq((WDI_ExitImpsRspCb)WDA_ExitImpsReqCallback, pWDA);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
               "Failure in Exit IMPS REQ WDI API, free all the memory " );
       pWDA->wdaWdiApiMsgParam = NULL;
       pWDA->wdaMsgParam = NULL;
-      WDA_SendMsg(pWDA, WDA_EXIT_IMPS_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_EnterBmpsReqCallback
  * send Enter BMPS RSP back to PE
@@ -6172,6 +6883,7 @@
    tWDA_CbContext *pWDA;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6179,12 +6891,16 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    WDA_SendMsg(pWDA, WDA_ENTER_BMPS_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessEnterBmpsReq
  * Request to WDI to Enter BMPS power state.
@@ -6195,8 +6911,10 @@
    WDI_Status status = WDI_STATUS_SUCCESS;
    WDI_EnterBmpsReqParamsType *wdiEnterBmpsReqParams;
    tWDA_ReqParams *pWdaParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if ((NULL == pWDA) || (NULL == pEnterBmpsReqParams))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6204,16 +6922,16 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    wdiEnterBmpsReqParams = vos_mem_malloc(sizeof(WDI_EnterBmpsReqParamsType));
    if (NULL == wdiEnterBmpsReqParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: VOS MEM Alloc Failure", __FUNCTION__);
       VOS_ASSERT(0);
-      WDA_SendMsg(pWDA, WDA_ENTER_BMPS_RSP, NULL ,
-         CONVERT_WDI2SIR_STATUS(WDI_STATUS_MEM_FAILURE)) ;
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams));
    if (NULL == pWdaParams)
    {
@@ -6221,50 +6939,43 @@
                            "%s: VOS MEM Alloc Failure", __FUNCTION__);
       VOS_ASSERT(0);
       vos_mem_free(wdiEnterBmpsReqParams);
-      WDA_SendMsg(pWDA, WDA_ENTER_BMPS_RSP, NULL ,
-         CONVERT_WDI2SIR_STATUS(WDI_STATUS_MEM_FAILURE)) ;
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiEnterBmpsReqParams->wdiEnterBmpsInfo.ucBssIdx = pEnterBmpsReqParams->bssIdx;
    wdiEnterBmpsReqParams->wdiEnterBmpsInfo.ucDtimCount = pEnterBmpsReqParams->dtimCount;
    wdiEnterBmpsReqParams->wdiEnterBmpsInfo.ucDtimPeriod = pEnterBmpsReqParams->dtimPeriod;
    wdiEnterBmpsReqParams->wdiEnterBmpsInfo.uTbtt = pEnterBmpsReqParams->tbtt;
+
    // For CCX and 11R Roaming
    wdiEnterBmpsReqParams->wdiEnterBmpsInfo.rssiFilterPeriod = (wpt_uint32)pEnterBmpsReqParams->rssiFilterPeriod;
    wdiEnterBmpsReqParams->wdiEnterBmpsInfo.numBeaconPerRssiAverage = (wpt_uint32)pEnterBmpsReqParams->numBeaconPerRssiAverage;
    wdiEnterBmpsReqParams->wdiEnterBmpsInfo.bRssiFilterEnable = (wpt_uint8)pEnterBmpsReqParams->bRssiFilterEnable;
    wdiEnterBmpsReqParams->wdiReqStatusCB = NULL;
+
    // we are done with the input
    vos_mem_free(pEnterBmpsReqParams);
+
    /* Store param pointer as passed in by caller */
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = wdiEnterBmpsReqParams;
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = NULL;
+
    status = WDI_EnterBmpsReq(wdiEnterBmpsReqParams,
                     (WDI_EnterBmpsRspCb)WDA_EnterBmpsReqCallback, pWdaParams);
+
    if (IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
               "Failure in Enter BMPS REQ WDI API, free all the memory" );
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams);
-      WDA_SendMsg(pWDA, WDA_ENTER_BMPS_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status);
 }
 
-
-static void WDA_SendExitBmpsRsp(tWDA_CbContext *pWDA,
-                         WDI_Status wdiStatus,
-                         tExitBmpsParams *pExitBmpsReqParams)
-{
-   pExitBmpsReqParams->status = CONVERT_WDI2SIR_STATUS(wdiStatus) ;
-
-   WDA_SendMsg(pWDA, WDA_EXIT_BMPS_RSP, (void *)pExitBmpsReqParams , 0) ;
-}
-
-
 /*
  * FUNCTION: WDA_ExitBmpsReqCallback
  * send Exit BMPS RSP back to PE
@@ -6274,8 +6985,10 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
    tWDA_CbContext *pWDA;
    tExitBmpsParams *pExitBmpsReqParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6283,16 +6996,22 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
    pExitBmpsReqParams = (tExitBmpsParams *)pWdaParams->wdaMsgParam ;
 
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
 
+
    pExitBmpsReqParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    WDA_SendMsg(pWDA, WDA_EXIT_BMPS_RSP, (void *)pExitBmpsReqParams , 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessExitBmpsReq
  * Request to WDI to Exit BMPS power state.
@@ -6305,14 +7024,15 @@
       (WDI_ExitBmpsReqParamsType *)vos_mem_malloc(
          sizeof(WDI_ExitBmpsReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiExitBmpsReqParams) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: VOS MEM Alloc Failure", __FUNCTION__); 
       VOS_ASSERT(0);
-      WDA_SendExitBmpsRsp(pWDA, WDI_STATUS_MEM_FAILURE, pExitBmpsReqParams);
       return VOS_STATUS_E_NOMEM;
    }
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
@@ -6324,10 +7044,9 @@
       vos_mem_free(wdiExitBmpsReqParams);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiExitBmpsReqParams->wdiExitBmpsInfo.ucSendDataNull = pExitBmpsReqParams->sendDataNull;
-
-   wdiExitBmpsReqParams->wdiExitBmpsInfo.bssIdx = pExitBmpsReqParams->bssIdx;
-
+      
    wdiExitBmpsReqParams->wdiReqStatusCB = NULL;
       
    /* Store param pointer as passed in by caller */
@@ -6335,8 +7054,10 @@
    pWdaParams->wdaWdiApiMsgParam = wdiExitBmpsReqParams;
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pExitBmpsReqParams;
+
    status = WDI_ExitBmpsReq(wdiExitBmpsReqParams,
                              (WDI_ExitBmpsRspCb)WDA_ExitBmpsReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6344,10 +7065,11 @@
       vos_mem_free(pWdaParams->wdaMsgParam) ;
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
-      WDA_SendExitBmpsRsp(pWDA, status, pExitBmpsReqParams);
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_EnterUapsdReqCallback
  * send Enter UAPSD RSP back to PE
@@ -6357,8 +7079,10 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
    tWDA_CbContext *pWDA;
    tUapsdParams *pEnterUapsdReqParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6366,14 +7090,21 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
+
    pEnterUapsdReqParams = (tUapsdParams *)pWdaParams->wdaMsgParam ;
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    pEnterUapsdReqParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    WDA_SendMsg(pWDA, WDA_ENTER_UAPSD_RSP, (void *)pEnterUapsdReqParams , 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessEnterUapsdReq
  * Request to WDI to Enter UAPSD power state.
@@ -6386,8 +7117,10 @@
       (WDI_EnterUapsdReqParamsType *)vos_mem_malloc(
          sizeof(WDI_EnterUapsdReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiEnterUapsdReqParams) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6404,6 +7137,7 @@
       vos_mem_free(wdiEnterUapsdReqParams);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucBeDeliveryEnabled = 
       pEnterUapsdReqParams->beDeliveryEnabled;
    wdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucBeTriggerEnabled = 
@@ -6420,17 +7154,19 @@
       pEnterUapsdReqParams->voDeliveryEnabled;
    wdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucVoTriggerEnabled = 
       pEnterUapsdReqParams->voTriggerEnabled;
-   wdiEnterUapsdReqParams->wdiEnterUapsdInfo.bssIdx = pEnterUapsdReqParams->bssIdx;
 
    wdiEnterUapsdReqParams->wdiReqStatusCB = NULL; 
 
+
    /* Store param pointer as passed in by caller */
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = wdiEnterUapsdReqParams;
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pEnterUapsdReqParams;
+
    status = WDI_EnterUapsdReq(wdiEnterUapsdReqParams,
                               (WDI_EnterUapsdRspCb)WDA_EnterUapsdReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6439,8 +7175,10 @@
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_ExitUapsdReqCallback
  * send Exit UAPSD RSP back to PE
@@ -6448,11 +7186,15 @@
 void WDA_ExitUapsdReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    WDA_SendMsg(pWDA, WDA_EXIT_UAPSD_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessExitUapsdReq
  * Request to WDI to Exit UAPSD power state.
@@ -6460,9 +7202,12 @@
 VOS_STATUS WDA_ProcessExitUapsdReq(tWDA_CbContext *pWDA)
 {
    WDI_Status status = WDI_STATUS_SUCCESS ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    status = WDI_ExitUapsdReq((WDI_ExitUapsdRspCb)WDA_ExitUapsdReqCallback, pWDA);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6470,9 +7215,11 @@
       pWDA->wdaWdiApiMsgParam = NULL;
       pWDA->wdaMsgParam = NULL;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
 
+
 /*
  * FUNCTION: WDA_SetPwrSaveCfgReqCallback
  * 
@@ -6480,8 +7227,10 @@
 void WDA_SetPwrSaveCfgReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6489,6 +7238,7 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    if( pWdaParams != NULL )
    {
       if( pWdaParams->wdaWdiApiMsgParam != NULL )
@@ -6501,8 +7251,10 @@
       }
       vos_mem_free(pWdaParams) ;
    }
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessSetPwrSaveCfgReq
  * Request to WDI to set the power save params at start.
@@ -6518,23 +7270,24 @@
    tANI_U32       *configDataValue;
    WDI_UpdateCfgReqParamsType *wdiPowerSaveCfg;
    tWDA_ReqParams *pWdaParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if ((NULL == pWDA) || (NULL == pPowerSaveCfg))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: invalid param", __FUNCTION__);
       VOS_ASSERT(0);
-	  vos_mem_free(pPowerSaveCfg);
       return VOS_STATUS_E_FAILURE;
    }
+
    wdiPowerSaveCfg = vos_mem_malloc(sizeof(WDI_UpdateCfgReqParamsType));
    if (NULL == wdiPowerSaveCfg)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: VOS MEM Alloc Failure", __FUNCTION__);
       VOS_ASSERT(0);
-	  vos_mem_free(pPowerSaveCfg);
       return VOS_STATUS_E_NOMEM;
    }
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
@@ -6544,74 +7297,90 @@
                            "%s: VOS MEM Alloc Failure", __FUNCTION__); 
       VOS_ASSERT(0);
       vos_mem_free(wdiPowerSaveCfg);
-	  vos_mem_free(pPowerSaveCfg);
       return VOS_STATUS_E_NOMEM;
    }
+
    configParamSize = (sizeof(tHalCfg) + (sizeof(tANI_U32))) * WDA_NUM_PWR_SAVE_CFG;
    configParam = vos_mem_malloc(configParamSize);
+
    if(NULL == configParam)
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                 "%s: VOS MEM Alloc Failure \n", __FUNCTION__);
-	  VOS_ASSERT(0);
       vos_mem_free(pWdaParams);
       vos_mem_free(wdiPowerSaveCfg);
-	  vos_mem_free(pPowerSaveCfg);
+      VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    vos_mem_set(configParam, configParamSize, 0);
    wdiPowerSaveCfg->pConfigBuffer = configParam;
    tlvStruct = (tHalCfg *)configParam;
    tlvStructStart = (tANI_U8 *)configParam;
+
    /* QWLAN_HAL_CFG_PS_BROADCAST_FRAME_FILTER_ENABLE */
    tlvStruct->type = QWLAN_HAL_CFG_PS_BROADCAST_FRAME_FILTER_ENABLE;
    tlvStruct->length = sizeof(tANI_U32);
    configDataValue = (tANI_U32 *)(tlvStruct + 1);
    *configDataValue = (tANI_U32)pPowerSaveCfg->broadcastFrameFilter;
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_PS_HEART_BEAT_THRESHOLD */
    tlvStruct->type = QWLAN_HAL_CFG_PS_HEART_BEAT_THRESHOLD;
    tlvStruct->length = sizeof(tANI_U32);
    configDataValue = (tANI_U32 *)(tlvStruct + 1);
    *configDataValue = (tANI_U32)pPowerSaveCfg->HeartBeatCount;
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_PS_IGNORE_DTIM */
    tlvStruct->type = QWLAN_HAL_CFG_PS_IGNORE_DTIM;
    tlvStruct->length = sizeof(tANI_U32);
    configDataValue = (tANI_U32 *)(tlvStruct + 1);
    *configDataValue = (tANI_U32)pPowerSaveCfg->ignoreDtim;
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_PS_LISTEN_INTERVAL */
    tlvStruct->type = QWLAN_HAL_CFG_PS_LISTEN_INTERVAL;
    tlvStruct->length = sizeof(tANI_U32);
    configDataValue = (tANI_U32 *)(tlvStruct + 1);
    *configDataValue = (tANI_U32)pPowerSaveCfg->listenInterval;
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_PS_MAX_PS_POLL */
    tlvStruct->type = QWLAN_HAL_CFG_PS_MAX_PS_POLL;
    tlvStruct->length = sizeof(tANI_U32);
    configDataValue = (tANI_U32 *)(tlvStruct + 1);
    *configDataValue = (tANI_U32)pPowerSaveCfg->maxPsPoll;
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_PS_MIN_RSSI_THRESHOLD */
    tlvStruct->type = QWLAN_HAL_CFG_PS_MIN_RSSI_THRESHOLD;
    tlvStruct->length = sizeof(tANI_U32);
    configDataValue = (tANI_U32 *)(tlvStruct + 1);
    *configDataValue = (tANI_U32)pPowerSaveCfg->minRssiThreshold;
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_PS_NTH_BEACON_FILTER */
    tlvStruct->type = QWLAN_HAL_CFG_PS_NTH_BEACON_FILTER;
    tlvStruct->length = sizeof(tANI_U32);
    configDataValue = (tANI_U32 *)(tlvStruct + 1);
    *configDataValue = (tANI_U32)pPowerSaveCfg->nthBeaconFilter;
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_PS_ENABLE_BCN_EARLY_TERM */
    tlvStruct->type = QWLAN_HAL_CFG_PS_ENABLE_BCN_EARLY_TERM;
    tlvStruct->length = sizeof(tANI_U32);
@@ -6619,6 +7388,7 @@
    *configDataValue = (tANI_U32)pPowerSaveCfg->fEnableBeaconEarlyTermination;
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_BCN_EARLY_TERM_WAKEUP_INTERVAL */
    tlvStruct->type = QWLAN_HAL_CFG_BCN_EARLY_TERM_WAKEUP_INTERVAL;
    tlvStruct->length = sizeof(tANI_U32);
@@ -6626,28 +7396,37 @@
    *configDataValue = (tANI_U32)pPowerSaveCfg->bcnEarlyTermWakeInterval;
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_NUM_BEACON_PER_RSSI_AVERAGE */
    tlvStruct->type = QWLAN_HAL_CFG_NUM_BEACON_PER_RSSI_AVERAGE;
    tlvStruct->length = sizeof(tANI_U32);
    configDataValue = (tANI_U32 *)(tlvStruct + 1);
    *configDataValue = (tANI_U32)pPowerSaveCfg->numBeaconPerRssiAverage;
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    /* QWLAN_HAL_CFG_PS_RSSI_FILTER_PERIOD */
    tlvStruct->type = QWLAN_HAL_CFG_PS_RSSI_FILTER_PERIOD;
    tlvStruct->length = sizeof(tANI_U32);
    configDataValue = (tANI_U32 *)(tlvStruct + 1);
    *configDataValue = (tANI_U32)pPowerSaveCfg->rssiFilterPeriod;
+
    tlvStruct = (tHalCfg *)(( (tANI_U8 *) tlvStruct 
                             + sizeof(tHalCfg) + tlvStruct->length)) ; 
+
    wdiPowerSaveCfg->uConfigBufferLen = (tANI_U8 *)tlvStruct - tlvStructStart ;
+
    wdiPowerSaveCfg->wdiReqStatusCB = NULL;
+
    /* store Params pass it to WDI */
    pWdaParams->wdaMsgParam = configParam;
    pWdaParams->wdaWdiApiMsgParam = wdiPowerSaveCfg;
    pWdaParams->pWdaContext = pWDA;
+
    status = WDI_SetPwrSaveCfgReq(wdiPowerSaveCfg, 
                                  (WDI_SetPwrSaveCfgCb)WDA_SetPwrSaveCfgReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6656,9 +7435,12 @@
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams);
    }
+
    vos_mem_free(pPowerSaveCfg);
+
    return CONVERT_WDI2VOS_STATUS(status);
 }
+
 /*
  * FUNCTION: WDA_SetUapsdAcParamsReqCallback
  * 
@@ -6666,13 +7448,17 @@
 void WDA_SetUapsdAcParamsReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData ; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams);
 
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_SetUapsdAcParamsReq
  * Request to WDI to set the UAPSD params for an ac (sta mode).
@@ -6686,8 +7472,10 @@
       (WDI_SetUapsdAcParamsReqParamsType *)vos_mem_malloc(
          sizeof(WDI_SetUapsdAcParamsReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiUapsdParams) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6704,22 +7492,28 @@
       vos_mem_free(wdiUapsdParams);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiUapsdParams->wdiUapsdInfo.ucAc = pUapsdInfo->ac;
    wdiUapsdParams->wdiUapsdInfo.uDelayInterval = pUapsdInfo->delayInterval;
    wdiUapsdParams->wdiUapsdInfo.uSrvInterval = pUapsdInfo->srvInterval;
    wdiUapsdParams->wdiUapsdInfo.ucSTAIdx = pUapsdInfo->staidx;
    wdiUapsdParams->wdiUapsdInfo.uSusInterval = pUapsdInfo->susInterval;
    wdiUapsdParams->wdiUapsdInfo.ucUp = pUapsdInfo->up;
+
    wdiUapsdParams->wdiReqStatusCB = NULL;
+
    pWDA = vos_get_context( VOS_MODULE_ID_WDA, pVosContext );
+
    pWdaParams->pWdaContext = pWDA;
    /* Store param pointer as passed in by caller */
    pWdaParams->wdaMsgParam = pUapsdInfo;
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiUapsdParams;
+
    status = WDI_SetUapsdAcParamsReq(wdiUapsdParams, 
               (WDI_SetUapsdAcParamsCb)WDA_SetUapsdAcParamsReqCallback,
               pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6727,11 +7521,14 @@
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
       vos_mem_free(pWdaParams);
    }
+
    if((WDI_STATUS_SUCCESS == status) || (WDI_STATUS_PENDING == status))
      return VOS_STATUS_SUCCESS;
    else
      return VOS_STATUS_E_FAILURE;
 
+
+
 }
 /* 
  * FUNCTION: WDA_ClearUapsdAcParamsReq 
@@ -6746,6 +7543,7 @@
    /* do nothing */
    return VOS_STATUS_SUCCESS;
 }
+
 /*
  * FUNCTION: WDA_UpdateUapsdParamsReqCallback
  * 
@@ -6753,17 +7551,22 @@
 void WDA_UpdateUapsdParamsReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
    pWDA->wdaWdiApiMsgParam = NULL;
    pWDA->wdaMsgParam = NULL;
 
+
    //print a msg, nothing else to do
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
            "WDA_UpdateUapsdParamsReqCallback invoked " );
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_UpdateUapsdParamsReq
  * Request to WDI to update UAPSD params (in softAP mode) for a station.
@@ -6776,8 +7579,10 @@
    WDI_UpdateUapsdReqParamsType *wdiUpdateUapsdParams = 
       (WDI_UpdateUapsdReqParamsType *)vos_mem_malloc(
          sizeof(WDI_UpdateUapsdReqParamsType)) ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiUpdateUapsdParams) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6785,9 +7590,11 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiUpdateUapsdParams->wdiUpdateUapsdInfo.uMaxSpLen = pUpdateUapsdInfo->maxSpLen;
    wdiUpdateUapsdParams->wdiUpdateUapsdInfo.ucSTAIdx = pUpdateUapsdInfo->staIdx;
    wdiUpdateUapsdParams->wdiUpdateUapsdInfo.ucUapsdACMask = pUpdateUapsdInfo->uapsdACMask;
+
    if((NULL != pWDA->wdaMsgParam) ||
                   (NULL != pWDA->wdaWdiApiMsgParam))
    {
@@ -6797,10 +7604,12 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    /* Store param pointer as passed in by caller */
    pWDA->wdaMsgParam = pUpdateUapsdInfo;
    /* store Params pass it to WDI */
    pWDA->wdaWdiApiMsgParam = (void *)wdiUpdateUapsdParams;
+
    wstatus = WDI_UpdateUapsdParamsReq(wdiUpdateUapsdParams, 
                                       (WDI_UpdateUapsdParamsCb)WDA_UpdateUapsdParamsReqCallback, pWDA);
 
@@ -6814,8 +7623,10 @@
       pWDA->wdaWdiApiMsgParam = NULL;
       pWDA->wdaMsgParam = NULL;
    }
+
    return status;
 }
+
 /*
  * FUNCTION: WDA_ConfigureRxpFilterCallback
  * 
@@ -6823,13 +7634,16 @@
 void WDA_ConfigureRxpFilterCallback(WDI_Status   wdiStatus, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData ; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(WDI_STATUS_SUCCESS != wdiStatus)
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                   "%s: RXP config filter failure \n", __FUNCTION__ );
    }
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6837,11 +7651,13 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams->wdaMsgParam);
    vos_mem_free(pWdaParams);
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessConfigureRxpFilterReq
  * 
@@ -6855,8 +7671,10 @@
       (WDI_ConfigureRxpFilterReqParamsType *)vos_mem_malloc(
          sizeof(WDI_ConfigureRxpFilterReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiRxpFilterParams) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6875,18 +7693,22 @@
       vos_mem_free(pWlanSuspendParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiRxpFilterParams->wdiRxpFilterParam.ucSetMcstBcstFilter = 
              pWlanSuspendParam->setMcstBcstFilter;
    wdiRxpFilterParams->wdiRxpFilterParam.ucSetMcstBcstFilterSetting = 
              pWlanSuspendParam->configuredMcstBcstFilterSetting;
    
    wdiRxpFilterParams->wdiReqStatusCB = NULL;
+
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pWlanSuspendParam;
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiRxpFilterParams;
+
    wstatus = WDI_ConfigureRxpFilterReq(wdiRxpFilterParams, 
                       (WDI_ConfigureRxpFilterCb)WDA_ConfigureRxpFilterCallback,
                       pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(wstatus))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6896,8 +7718,10 @@
       vos_mem_free(pWdaParams->wdaMsgParam);
       vos_mem_free(pWdaParams);
    }
+
    return status;
 }
+
 /*
  * FUNCTION: WDA_WdiIndicationCallback
  * 
@@ -6907,7 +7731,9 @@
 {
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
 }
+
 /*
  * FUNCTION: WDA_ProcessWlanSuspendInd
  * 
@@ -6917,28 +7743,35 @@
 {
    WDI_Status wdiStatus;
    WDI_SuspendParamsType wdiSuspendParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    wdiSuspendParams.wdiSuspendParams.ucConfiguredMcstBcstFilterSetting =
                           pWlanSuspendParam->configuredMcstBcstFilterSetting;
    wdiSuspendParams.wdiReqStatusCB = WDA_WdiIndicationCallback;
    wdiSuspendParams.pUserData = pWDA;
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, "%s: %d" ,__FUNCTION__, pWlanSuspendParam->configuredMcstBcstFilterSetting);
+
    wdiStatus = WDI_HostSuspendInd(&wdiSuspendParams);
    if(WDI_STATUS_PENDING == wdiStatus)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
               "Pending received for %s:%d ",__FUNCTION__,__LINE__ );
+
    }
    else if( WDI_STATUS_SUCCESS_SYNC != wdiStatus )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
               "Failure in %s:%d ",__FUNCTION__,__LINE__ );
    }
+
    vos_mem_free(pWlanSuspendParam);
    return CONVERT_WDI2VOS_STATUS(wdiStatus) ;
 }
 
+
+
 /*
  * FUNCTION: WDA_ProcessWlanResumeCallback
  * 
@@ -6948,6 +7781,7 @@
                         void*        pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
    if(NULL == pWdaParams)
@@ -6957,16 +7791,20 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    if(WDI_STATUS_SUCCESS != resumeRspParams->wdiStatus)
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                   "%s: Process Wlan Resume failure \n", __FUNCTION__ );
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    vos_mem_free(pWdaParams->wdaMsgParam);
    vos_mem_free(pWdaParams);
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessWlanResumeReq
  * 
@@ -6979,8 +7817,10 @@
             (WDI_ResumeParamsType *)vos_mem_malloc(
                                  sizeof(WDI_ResumeParamsType) ) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiResumeParams) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -6997,16 +7837,20 @@
       vos_mem_free(wdiResumeParams);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiResumeParams->wdiResumeParams.ucConfiguredMcstBcstFilterSetting =
                           pWlanResumeParam->configuredMcstBcstFilterSetting;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, "%s: %d" ,__FUNCTION__, pWlanResumeParam->configuredMcstBcstFilterSetting);
    wdiResumeParams->wdiReqStatusCB = NULL;
    pWdaParams->wdaMsgParam = pWlanResumeParam;
    pWdaParams->wdaWdiApiMsgParam = wdiResumeParams;
    pWdaParams->pWdaContext = pWDA;
+
    wdiStatus = WDI_HostResumeReq(wdiResumeParams, 
                       (WDI_HostResumeEventRspCb)WDA_ProcessWlanResumeCallback,
                       pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(wdiStatus))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7016,9 +7860,12 @@
       vos_mem_free(pWdaParams->wdaMsgParam);
       vos_mem_free(pWdaParams);
    }
+
    return CONVERT_WDI2VOS_STATUS(wdiStatus) ;
 }
 
+
+
 /*
  * FUNCTION: WDA_SetBeaconFilterReqCallback
  * 
@@ -7026,8 +7873,10 @@
 void WDA_SetBeaconFilterReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7044,8 +7893,10 @@
     * param here
     */
 
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_SetBeaconFilterReq
  * Request to WDI to send the beacon filtering related information.
@@ -7060,8 +7911,10 @@
             (WDI_BeaconFilterReqParamsType *)vos_mem_malloc(
                                  sizeof(WDI_BeaconFilterReqParamsType) ) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiBeaconFilterInfo) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7078,6 +7931,7 @@
       vos_mem_free(wdiBeaconFilterInfo);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiBeaconFilterInfo->wdiBeaconFilterInfo.usBeaconInterval = 
       pBeaconFilterInfo->beaconInterval;
    wdiBeaconFilterInfo->wdiBeaconFilterInfo.usCapabilityInfo = 
@@ -7085,6 +7939,7 @@
    wdiBeaconFilterInfo->wdiBeaconFilterInfo.usCapabilityMask = 
       pBeaconFilterInfo->capabilityMask;
    wdiBeaconFilterInfo->wdiBeaconFilterInfo.usIeNum = pBeaconFilterInfo->ieNum;
+
    //Fill structure with info contained in the beaconFilterTable
    dstPtr = (tANI_U8 *)wdiBeaconFilterInfo + sizeof(WDI_BeaconFilterInfoType);
    srcPtr = (tANI_U8 *)pBeaconFilterInfo + sizeof(tBeaconFilterMsg);
@@ -7094,6 +7949,7 @@
       filterLength = WDI_BEACON_FILTER_LEN;
    }
    vos_mem_copy(dstPtr, srcPtr, filterLength);
+
    wdiBeaconFilterInfo->wdiReqStatusCB = NULL;
    /* Store param pointer as passed in by caller */
    /* store Params pass it to WDI */
@@ -7101,8 +7957,10 @@
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pBeaconFilterInfo;
 
+
    status = WDI_SetBeaconFilterReq(wdiBeaconFilterInfo, 
                                    (WDI_SetBeaconFilterCb)WDA_SetBeaconFilterReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7111,8 +7969,10 @@
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_RemBeaconFilterReqCallback
  * 
@@ -7120,21 +7980,27 @@
 void WDA_RemBeaconFilterReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
    pWDA->wdaWdiApiMsgParam = NULL;
    pWDA->wdaMsgParam = NULL;
    
+
    //print a msg, nothing else to do
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
               "WDA_RemBeaconFilterReqCallback invoked " );
+
    return ;
 }
+
     // TODO: PE does not have this feature for now implemented,
     // but the support for removing beacon filter exists between
     // HAL and FW. This function can be called whenever PE defines
     // a new message for beacon filter removal
+
 /*
  * FUNCTION: WDA_RemBeaconFilterReq
  * Request to WDI to send the removal of beacon filtering related information.
@@ -7147,8 +8013,10 @@
    WDI_RemBeaconFilterReqParamsType *wdiBeaconFilterInfo = 
       (WDI_RemBeaconFilterReqParamsType *)vos_mem_malloc(
          sizeof(WDI_RemBeaconFilterReqParamsType) + pBeaconFilterInfo->ucIeCount) ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiBeaconFilterInfo) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7156,13 +8024,16 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiBeaconFilterInfo->wdiBeaconFilterInfo.ucIeCount = 
       pBeaconFilterInfo->ucIeCount;
+
    //Fill structure with info contained in the ucRemIeId
    vos_mem_copy(wdiBeaconFilterInfo->wdiBeaconFilterInfo.ucRemIeId, 
                 pBeaconFilterInfo->ucRemIeId,
                 wdiBeaconFilterInfo->wdiBeaconFilterInfo.ucIeCount);
    wdiBeaconFilterInfo->wdiReqStatusCB = NULL;
+
    if((NULL != pWDA->wdaMsgParam) ||
                   (NULL != pWDA->wdaWdiApiMsgParam))
    {
@@ -7177,8 +8048,10 @@
    pWDA->wdaMsgParam = pBeaconFilterInfo;
    /* store Params pass it to WDI */
    pWDA->wdaWdiApiMsgParam = (void *)wdiBeaconFilterInfo;
+
    wstatus = WDI_RemBeaconFilterReq(wdiBeaconFilterInfo, 
                                    (WDI_RemBeaconFilterCb)WDA_RemBeaconFilterReqCallback, pWDA);
+
    if(IS_WDI_STATUS_FAILURE(wstatus))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7189,8 +8062,10 @@
       pWDA->wdaWdiApiMsgParam = NULL;
       pWDA->wdaMsgParam = NULL;
    }
+
    return status;
 }
+
 /*
  * FUNCTION: WDA_SetRSSIThresholdsReqCallback
  * 
@@ -7198,8 +8073,10 @@
 void WDA_SetRSSIThresholdsReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7211,8 +8088,10 @@
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
 
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_SetRSSIThresholdsReq
  * Request to WDI to set the RSSI thresholds (sta mode).
@@ -7227,8 +8106,10 @@
       (WDI_SetRSSIThresholdsReqParamsType *)vos_mem_malloc(
          sizeof(WDI_SetRSSIThresholdsReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiRSSIThresholdsInfo) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7245,27 +8126,36 @@
       vos_mem_free(wdiRSSIThresholdsInfo);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bReserved10 = pBmpsThresholds->bReserved10;
+
    wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.ucRssiThreshold1 = pBmpsThresholds->ucRssiThreshold1;
    wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.ucRssiThreshold2 = pBmpsThresholds->ucRssiThreshold2;
    wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.ucRssiThreshold3 = pBmpsThresholds->ucRssiThreshold3;
+
    wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres1NegNotify = pBmpsThresholds->bRssiThres1NegNotify;
    wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres2NegNotify = pBmpsThresholds->bRssiThres2NegNotify;
    wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres3NegNotify = pBmpsThresholds->bRssiThres3NegNotify;
+
    wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres1PosNotify = pBmpsThresholds->bRssiThres1PosNotify;
    wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres2PosNotify = pBmpsThresholds->bRssiThres2PosNotify;
    wdiRSSIThresholdsInfo->wdiRSSIThresholdsInfo.bRssiThres3PosNotify = pBmpsThresholds->bRssiThres3PosNotify;
+
    wdiRSSIThresholdsInfo->wdiReqStatusCB = NULL;
+
    pVosContext = vos_get_global_context(VOS_MODULE_ID_PE, (void *)pMac);
    pWDA = vos_get_context( VOS_MODULE_ID_WDA, pVosContext );
 
+
    /* Store param pointer as passed in by caller */
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = wdiRSSIThresholdsInfo;
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pBmpsThresholds;
+
    wstatus = WDI_SetRSSIThresholdsReq(wdiRSSIThresholdsInfo, 
                                      (WDI_SetRSSIThresholdsCb)WDA_SetRSSIThresholdsReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(wstatus))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7274,9 +8164,11 @@
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
    }
+
    return status;
 
 }/*WDA_SetRSSIThresholdsReq*/
+
 /*
  * FUNCTION: WDA_HostOffloadReqCallback
  * 
@@ -7287,6 +8179,7 @@
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7302,8 +8195,10 @@
    //print a msg, nothing else to do
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
               "WDA_HostOffloadReqCallback invoked " );
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessHostOffloadReq
  * Request to WDI to set the filter to minimize unnecessary host wakeup due 
@@ -7329,6 +8224,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -7344,8 +8240,6 @@
    wdiHostOffloadInfo->wdiHostOffloadInfo.ucEnableOrDisable = 
       pHostOffloadParams->enableOrDisable;
 
-   wdiHostOffloadInfo->wdiHostOffloadInfo.bssIdx = 
-                                    pHostOffloadParams->bssIdx;
    switch (wdiHostOffloadInfo->wdiHostOffloadInfo.ucOffloadType)
    {
       case SIR_IPV4_ARP_REPLY_OFFLOAD:
@@ -7417,7 +8311,9 @@
          //WDA_VOS_ASSERT(0) ;
       }
    }
+
    wdiHostOffloadInfo->wdiReqStatusCB = NULL;
+
    if((NULL != pWDA->wdaMsgParam) ||
                   (NULL != pWDA->wdaWdiApiMsgParam))
    {
@@ -7427,6 +8323,7 @@
       vos_mem_free(wdiHostOffloadInfo);
       return VOS_STATUS_E_FAILURE;
    }
+
    /* Store param pointer as passed in by caller */
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = wdiHostOffloadInfo;
@@ -7445,9 +8342,11 @@
       vos_mem_free(pWdaParams->wdaMsgParam);
       vos_mem_free(pWdaParams) ;
    }
+
    return status;
 
 }/*WDA_HostOffloadReq*/
+
 /*
  * FUNCTION: WDA_KeepAliveReqCallback
  * 
@@ -7455,18 +8354,23 @@
 void WDA_KeepAliveReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    vos_mem_free(pWDA->wdaWdiApiMsgParam);
    vos_mem_free(pWDA->wdaMsgParam);
    pWDA->wdaWdiApiMsgParam = NULL;
    pWDA->wdaMsgParam = NULL; 
    
+
    //print a msg, nothing else to do
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
               "WDA_KeepAliveReqCallback invoked " );
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessKeepAliveReq
  * Request to WDI to send Keep Alive packets to minimize unnecessary host 
@@ -7480,8 +8384,10 @@
     WDI_KeepAliveReqParamsType *wdiKeepAliveInfo = 
       (WDI_KeepAliveReqParamsType *)vos_mem_malloc(
          sizeof(WDI_KeepAliveReqParamsType)) ;
+
     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
     if(NULL == wdiKeepAliveInfo) 
     {
         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7489,12 +8395,11 @@
         VOS_ASSERT(0);
         return VOS_STATUS_E_NOMEM;
     }
+
     wdiKeepAliveInfo->wdiKeepAliveInfo.ucPacketType = 
       pKeepAliveParams->packetType;
     wdiKeepAliveInfo->wdiKeepAliveInfo.ucTimePeriod = 
       pKeepAliveParams->timePeriod;
-    wdiKeepAliveInfo->wdiKeepAliveInfo.bssIdx = 
-                                pKeepAliveParams->bssIdx;
 
     if(pKeepAliveParams->packetType == SIR_KEEP_ALIVE_UNSOLICIT_ARP_RSP)
     {
@@ -7520,7 +8425,9 @@
                     SIR_MAC_ADDR_LEN,
                     0);
     }
+
     wdiKeepAliveInfo->wdiReqStatusCB = NULL;
+
     if((NULL != pWDA->wdaMsgParam) ||
        (NULL != pWDA->wdaWdiApiMsgParam))
     {
@@ -7530,10 +8437,12 @@
       vos_mem_free(wdiKeepAliveInfo);
       return VOS_STATUS_E_FAILURE;
     }
+
     /* Store param pointer as passed in by caller */
     pWDA->wdaMsgParam = pKeepAliveParams;
     /* store Params pass it to WDI */
     pWDA->wdaWdiApiMsgParam = (void *)wdiKeepAliveInfo;
+
     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,"WDA HIP : %d.%d.%d.%d",
               wdiKeepAliveInfo->wdiKeepAliveInfo.aHostIpv4Addr[0],
               wdiKeepAliveInfo->wdiKeepAliveInfo.aHostIpv4Addr[1],
@@ -7556,8 +8465,10 @@
               "TimePeriod %d PacketType %d", 
               wdiKeepAliveInfo->wdiKeepAliveInfo.ucTimePeriod,
               wdiKeepAliveInfo->wdiKeepAliveInfo.ucPacketType); 
+
     wstatus = WDI_KeepAliveReq(wdiKeepAliveInfo, 
                              (WDI_KeepAliveCb)WDA_KeepAliveReqCallback, pWDA);
+
     if(IS_WDI_STATUS_FAILURE(wstatus))
     {
         VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7568,9 +8479,11 @@
         pWDA->wdaWdiApiMsgParam = NULL;
         pWDA->wdaMsgParam = NULL;
     }
+
     return status;
 
 }/*WDA_KeepAliveReq*/
+
 /*
  * FUNCTION: WDA_WowlAddBcPtrnReqCallback
  * 
@@ -7578,8 +8491,10 @@
 void WDA_WowlAddBcPtrnReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7587,11 +8502,14 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams->wdaMsgParam);
    vos_mem_free(pWdaParams) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessWowlAddBcPtrnReq
  * Request to WDI to add WOWL Bcast pattern
@@ -7605,8 +8523,10 @@
       (WDI_WowlAddBcPtrnReqParamsType *)vos_mem_malloc(
          sizeof(WDI_WowlAddBcPtrnReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiWowlAddBcPtrnInfo) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7623,6 +8543,7 @@
       vos_mem_free(wdiWowlAddBcPtrnInfo);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternId = 
       pWowlAddBcPtrnParams->ucPatternId;
    wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternByteOffset = 
@@ -7631,6 +8552,7 @@
       pWowlAddBcPtrnParams->ucPatternMaskSize;
    wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternSize = 
       pWowlAddBcPtrnParams->ucPatternSize;
+
    if (wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPatternSize <= WDI_WOWL_BCAST_PATTERN_MAX_SIZE)
    {
        vos_mem_copy(wdiWowlAddBcPtrnInfo->wdiWowlAddBcPtrnInfo.ucPattern,
@@ -7658,13 +8580,16 @@
    }
 
    wdiWowlAddBcPtrnInfo->wdiReqStatusCB = NULL;
+
    /* Store param pointer as passed in by caller */
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = wdiWowlAddBcPtrnInfo;
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pWowlAddBcPtrnParams;
+
    wstatus = WDI_WowlAddBcPtrnReq(wdiWowlAddBcPtrnInfo, 
                                  (WDI_WowlAddBcPtrnCb)WDA_WowlAddBcPtrnReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(wstatus))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7674,9 +8599,11 @@
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
    }
+
    return status;
 
 }/*WDA_ProcessWowlAddBcPtrnReq*/
+
 /*
  * FUNCTION: WDA_WowlDelBcPtrnReqCallback
  * 
@@ -7684,8 +8611,10 @@
 void WDA_WowlDelBcPtrnReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7693,11 +8622,14 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams->wdaMsgParam);
    vos_mem_free(pWdaParams) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessWowlDelBcPtrnReq
  * Request to WDI to delete WOWL Bcast pattern
@@ -7711,8 +8643,10 @@
       (WDI_WowlDelBcPtrnReqParamsType *)vos_mem_malloc(
          sizeof(WDI_WowlDelBcPtrnReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiWowlDelBcPtrnInfo) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7729,16 +8663,21 @@
       vos_mem_free(wdiWowlDelBcPtrnInfo);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiWowlDelBcPtrnInfo->wdiWowlDelBcPtrnInfo.ucPatternId = 
       pWowlDelBcPtrnParams->ucPatternId;
+
    wdiWowlDelBcPtrnInfo->wdiReqStatusCB = NULL;
+
    /* Store param pointer as passed in by caller */
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = wdiWowlDelBcPtrnInfo;
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pWowlDelBcPtrnParams;
+
    wstatus = WDI_WowlDelBcPtrnReq(wdiWowlDelBcPtrnInfo, 
                                  (WDI_WowlDelBcPtrnCb)WDA_WowlDelBcPtrnReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(wstatus))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7748,9 +8687,11 @@
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
    }
+
    return status;
 
 }/*WDA_ProcessWowlDelBcPtrnReq*/
+
 /*
  * FUNCTION: WDA_WowlEnterReqCallback
  * 
@@ -7760,8 +8701,10 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
    tWDA_CbContext *pWDA;
    tSirHalWowlEnterParams *pWowlEnterParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7769,16 +8712,22 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
    pWowlEnterParams =  (tSirHalWowlEnterParams *)pWdaParams->wdaMsgParam ;
 
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
 
+
    pWowlEnterParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    WDA_SendMsg(pWDA, WDA_WOWL_ENTER_RSP, (void *)pWowlEnterParams , 0) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessWowlEnterReq
  * Request to WDI to enter WOWL 
@@ -7792,8 +8741,10 @@
       (WDI_WowlEnterReqParamsType *)vos_mem_malloc(
          sizeof(WDI_WowlEnterReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiWowlEnterInfo) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7810,25 +8761,35 @@
       vos_mem_free(wdiWowlEnterInfo);
       return VOS_STATUS_E_NOMEM;
    }
+
    vos_mem_copy(wdiWowlEnterInfo->wdiWowlEnterInfo.magicPtrn,
                 pWowlEnterParams->magicPtrn,
                 sizeof(tSirMacAddr));
+
    wdiWowlEnterInfo->wdiWowlEnterInfo.ucMagicPktEnable = 
       pWowlEnterParams->ucMagicPktEnable;
+
    wdiWowlEnterInfo->wdiWowlEnterInfo.ucPatternFilteringEnable = 
       pWowlEnterParams->ucPatternFilteringEnable;
+
    wdiWowlEnterInfo->wdiWowlEnterInfo.ucUcastPatternFilteringEnable = 
       pWowlEnterParams->ucUcastPatternFilteringEnable;
+
    wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowChnlSwitchRcv = 
       pWowlEnterParams->ucWowChnlSwitchRcv;
+
    wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowDeauthRcv = 
       pWowlEnterParams->ucWowDeauthRcv;
+
    wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowDisassocRcv = 
       pWowlEnterParams->ucWowDisassocRcv;
+
    wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowMaxMissedBeacons = 
       pWowlEnterParams->ucWowMaxMissedBeacons;
+
    wdiWowlEnterInfo->wdiWowlEnterInfo.ucWowMaxSleepUsec = 
       pWowlEnterParams->ucWowMaxSleepUsec;
+
 #ifdef WLAN_WAKEUP_EVENTS
    wdiWowlEnterInfo->wdiWowlEnterInfo.ucWoWEAPIDRequestEnable = 
       pWowlEnterParams->ucWoWEAPIDRequestEnable;
@@ -7847,13 +8808,16 @@
 #endif // WLAN_WAKEUP_EVENTS
 
    wdiWowlEnterInfo->wdiReqStatusCB = NULL;
+
    /* Store param pointer as passed in by caller */
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = wdiWowlEnterInfo;
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pWowlEnterParams;
+
    wstatus = WDI_WowlEnterReq(wdiWowlEnterInfo, 
                              (WDI_WowlEnterReqCb)WDA_WowlEnterReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(wstatus))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7863,9 +8827,11 @@
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
    }
+
    return status;
 
 }/*WDA_ProcessWowlEnterReq*/
+
 /*
  * FUNCTION: WDA_WowlExitReqCallback
  * 
@@ -7873,11 +8839,15 @@
 void WDA_WowlExitReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_CbContext *pWDA = (tWDA_CbContext *)pUserData ; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    WDA_SendMsg(pWDA, WDA_WOWL_EXIT_RSP, NULL , CONVERT_WDI2SIR_STATUS(status)) ;
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessWowlExitReq
  * Request to WDI to add WOWL Bcast pattern
@@ -7889,6 +8859,7 @@
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    wstatus = WDI_WowlExitReq((WDI_WowlExitReqCb)WDA_WowlExitReqCallback, pWDA);
 
    if(IS_WDI_STATUS_FAILURE(wstatus))
@@ -7901,8 +8872,11 @@
       pWDA->wdaWdiApiMsgParam = NULL;
       pWDA->wdaMsgParam = NULL;
    }
+
    return status;
+
 }/*WDA_ProcessWowlExitReq*/
+
 /*
  * FUNCTION: WDA_IsHwFrameTxTranslationCapable
  * Request to WDI to determine whether a given station is capable of 
@@ -7913,6 +8887,7 @@
 {
    return WDI_IsHwFrameTxTranslationCapable(staIdx);
 }
+
 /*
  * FUNCTION: WDA_NvDownloadReqCallback
  * send NV Download RSP back to PE
@@ -7920,16 +8895,22 @@
 void WDA_NvDownloadReqCallback(WDI_NvDownloadRspInfoType *pNvDownloadRspParams, 
                                                             void* pUserData)
 {
+
    tWDA_CbContext *pWDA= ( tWDA_CbContext *)pUserData;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    /*Cleaning */
    vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
    pWDA->wdaWdiApiMsgParam = NULL;
    pWDA->wdaMsgParam = NULL;
+
    vos_WDAComplete_cback(pWDA->pVosContext);
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessNvDownloadReq
  * Read the NV blob to a buffer and send a request to WDI to download the blob to NV memory.
@@ -7942,8 +8923,10 @@
    v_SIZE_t bufferSize = 0;
    WDI_Status status = WDI_STATUS_E_FAILURE;
    WDI_NvDownloadReqParamsType * wdiNvDownloadReqParam =NULL;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == pWDA) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7959,8 +8942,10 @@
    
    /* Get the NV structure base address and size from VOS */
    vos_nv_getNVBuffer(&pNvBuffer,&bufferSize);
+
    wdiNvDownloadReqParam = (WDI_NvDownloadReqParamsType *)vos_mem_malloc(
                                           sizeof(WDI_NvDownloadReqParamsType)) ;
+
    if(NULL == wdiNvDownloadReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7968,14 +8953,19 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    /* Copy Params to wdiNvDownloadReqParam*/
    wdiNvDownloadReqParam->wdiBlobInfo.pBlobAddress = pNvBuffer;
    wdiNvDownloadReqParam->wdiBlobInfo.uBlobSize = bufferSize;
+
    /* store Params pass it to WDI */
    pWDA->wdaWdiApiMsgParam = (void *)wdiNvDownloadReqParam ;
+
    wdiNvDownloadReqParam->wdiReqStatusCB = NULL ;
+
    status = WDI_NvDownloadReq(wdiNvDownloadReqParam, 
                     (WDI_NvDownloadRspCb)WDA_NvDownloadReqCallback,(void *)pWDA);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -7983,7 +8973,9 @@
       vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
       pWDA->wdaWdiApiMsgParam = NULL;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
+
 }
 /*
  * FUNCTION: WDA_FlushAcReqCallback
@@ -7995,6 +8987,7 @@
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tFlushACReq *pFlushACReqParams;
    tFlushACRsp *pFlushACRspParams;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
    if(NULL == pWdaParams)
@@ -8012,7 +9005,6 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: VOS MEM Alloc Failure", __FUNCTION__); 
       VOS_ASSERT(0);
-	  vos_mem_free(pWdaParams);
       return ;
    }
    vos_mem_zero(pFlushACRspParams,sizeof(tFlushACRsp));   
@@ -8021,16 +9013,20 @@
    pFlushACRspParams->ucSTAId = pFlushACReqParams->ucSTAId;
    pFlushACRspParams->ucTid = pFlushACReqParams->ucTid;
    pFlushACRspParams->status = CONVERT_WDI2SIR_STATUS(status) ;
+
    vos_mem_free(pWdaParams->wdaMsgParam) ;
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams);
+
    wdaMsg.type = WDA_TL_FLUSH_AC_RSP ; 
    wdaMsg.bodyptr = (void *)pFlushACRspParams;
    // POST message to TL
    vos_mq_post_message(VOS_MQ_ID_TL, (vos_msg_t *) &wdaMsg);
 
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessFlushAcReq
  * Request to WDI to Update the DELBA REQ params.
@@ -8043,6 +9039,7 @@
                (WDI_FlushAcReqParamsType *)vos_mem_malloc(
                                        sizeof(WDI_FlushAcReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    if(NULL == wdiFlushAcReqParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -8059,19 +9056,24 @@
       vos_mem_free(wdiFlushAcReqParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    wdiFlushAcReqParam->wdiFlushAcInfo.ucSTAId = pFlushAcReqParams->ucSTAId;
    wdiFlushAcReqParam->wdiFlushAcInfo.ucTid = pFlushAcReqParams->ucTid;
    wdiFlushAcReqParam->wdiFlushAcInfo.usMesgLen = pFlushAcReqParams->mesgLen;
    wdiFlushAcReqParam->wdiFlushAcInfo.usMesgType = pFlushAcReqParams->mesgType;
+
    /* Store Flush AC pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pFlushAcReqParams;
    pWdaParams->wdaWdiApiMsgParam = wdiFlushAcReqParam;
+
    status = WDI_FlushAcReq(wdiFlushAcReqParam, 
                            (WDI_FlushAcRspCb)WDA_FlushAcReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -8081,8 +9083,11 @@
       vos_mem_free(pWdaParams) ;
       //TODO: respond to TL with failure
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
+
 }
+
 /*
  * FUNCTION: WDA_BtAmpEventReqCallback
  * 
@@ -8091,10 +9096,11 @@
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA; 
-   WDI_BtAmpEventParamsType *wdiBtAmpEventParam;
+   WDI_BtAmpEventParamsType *wdiBtAmpEventParam; 
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -8109,6 +9115,7 @@
    {
       pWDA->wdaAmpSessionOn = VOS_FALSE;
    }
+
    vos_mem_free(pWdaParams->wdaMsgParam) ;
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
@@ -8116,9 +9123,11 @@
     * No respone required for WDA_SIGNAL_BTAMP_EVENT so just free the request 
     * param here
     */
+
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessBtAmpEventReq
  * Request to WDI to Update with BT AMP events.
@@ -8131,8 +9140,10 @@
             (WDI_BtAmpEventParamsType *)vos_mem_malloc(
                                  sizeof(WDI_BtAmpEventParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiBtAmpEventParam) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -8149,16 +9160,21 @@
       vos_mem_free(wdiBtAmpEventParam);
       return VOS_STATUS_E_NOMEM;
    }
+
    wdiBtAmpEventParam->wdiBtAmpEventInfo.ucBtAmpEventType = 
       pBtAmpEventParams->btAmpEventType;
+
    wdiBtAmpEventParam->wdiReqStatusCB = NULL;
+
    /* Store BT AMP event pointer, as this will be used for response */
    /* store Params pass it to WDI */
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pBtAmpEventParams;
    pWdaParams->wdaWdiApiMsgParam = wdiBtAmpEventParam;
+
    status = WDI_BtAmpEventReq(wdiBtAmpEventParam, 
                               (WDI_BtAmpEventRspCb)WDA_BtAmpEventReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -8167,13 +9183,16 @@
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
    }
+
    if(BTAMP_EVENT_CONNECTION_START == wdiBtAmpEventParam->wdiBtAmpEventInfo.ucBtAmpEventType)
    {
       pWDA->wdaAmpSessionOn = VOS_TRUE;
    }
    return CONVERT_WDI2VOS_STATUS(status) ;
+
 }
 
+
 #ifdef ANI_MANF_DIAG
 /*
  * FUNCTION: WDA_FTMCommandReqCallback
@@ -8184,21 +9203,26 @@
                                void *usrData)
 {
    tWDA_CbContext *pWDA = (tWDA_CbContext *)usrData ;
+
    if((NULL == pWDA) || (NULL == ftmCmdRspData))
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                 "%s, invalid input 0x%x, 0x%x",__FUNCTION__,  pWDA, ftmCmdRspData);
       return;
    }
+
    /* Release Current FTM Command Request */
    vos_mem_free(pWDA->wdaFTMCmdReq);
    pWDA->wdaFTMCmdReq = NULL;
+
 #ifndef WLAN_FTM_STUB
    /* Post FTM Responce to HDD FTM */
    wlan_sys_ftm(ftmCmdRspData);
 #endif /* WLAN_FTM_STUB */
+
    return;
 }
+
 /*
  * FUNCTION: WDA_ProcessFTMCommand
  * Send FTM command to WDI
@@ -8208,6 +9232,7 @@
 {
    WDI_Status             status = WDI_STATUS_SUCCESS;
    WDI_FTMCommandReqType *ftmCMDReq = NULL;
+
    ftmCMDReq = (WDI_FTMCommandReqType *)
                 vos_mem_malloc(sizeof(WDI_FTMCommandReqType));
    if(NULL == ftmCMDReq)
@@ -8216,11 +9241,15 @@
                 "WDA FTM Command buffer alloc fail");
       return VOS_STATUS_E_NOMEM;
    }
+
    ftmCMDReq->bodyLength     = pPTTFtmCmd->msgBodyLength;
    ftmCMDReq->FTMCommandBody = (void *)pPTTFtmCmd;
+
    pWDA->wdaFTMCmdReq        = (void *)ftmCMDReq;
+
    /* Send command to WDI */
    status = WDI_FTMCommandReq(ftmCMDReq, WDA_FTMCommandReqCallback, pWDA);
+
    return status;
 }
 #endif /* ANI_MANF_DIAG */
@@ -8239,6 +9268,7 @@
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWDA) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -8250,6 +9280,7 @@
    /* 
     * Allocate memory for response params sent to PE
     */
+
    pOemDataRspParams = vos_mem_malloc(sizeof(tStartOemDataRsp));
 
    // Check if memory is allocated for OemdataMeasRsp Params.
@@ -8260,30 +9291,37 @@
       VOS_ASSERT(0) ;
       return;
    }
+
    // Free the memory allocated during request.
    vos_mem_free(pWDA->wdaWdiApiMsgParam) ;
    vos_mem_free(pWDA->wdaMsgParam) ;
    pWDA->wdaWdiApiMsgParam = NULL;
    pWDA->wdaMsgParam = NULL;
+
    /* 
     * Now go ahead and copy other stuff for PE in incase of sucess only 
     * Also, here success always means that we have atleast one BSSID.
     */
+
    vos_mem_copy(pOemDataRspParams->oemDataRsp, wdiOemDataRspParams->oemDataRsp, OEM_DATA_RSP_SIZE);
  
    //enable Tx
    status = WDA_ResumeDataTx(pWDA);
+
    if(status != VOS_STATUS_SUCCESS)
    {
       VOS_TRACE(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL, "WDA Resume Data Tx fail");
    }
+
    WDA_SendMsg(pWDA, WDA_START_OEM_DATA_RSP,  (void *)pOemDataRspParams, 0) ;
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessStartOemDataReq
  * Send Start Oem Data Req to WDI
  */
+
 VOS_STATUS WDA_ProcessStartOemDataReq(tWDA_CbContext *pWDA, 
                                  tStartOemDataReq  *pOemDataReqParams)
 {
@@ -8314,10 +9352,11 @@
       vos_mem_free(wdiOemDataReqParams);
       return VOS_STATUS_E_FAILURE;
    }
+
    pWDA->wdaMsgParam          =          (void *)pOemDataReqParams;
    pWDA->wdaWdiApiMsgParam    =          (void *)wdiOemDataReqParams;
 
-   status = WDI_StartOemDataReq(wdiOemDataReqParams, (WDI_oemDataRspCb)WDA_StartOemDataReqCallback, pWDA);
+    status = WDI_StartOemDataReq(wdiOemDataReqParams, (WDI_oemDataRspCb)WDA_StartOemDataReqCallback, pWDA);
 
    if(IS_WDI_STATUS_FAILURE(status))
    {
@@ -8328,9 +9367,12 @@
       pWDA->wdaWdiApiMsgParam = NULL;
       pWDA->wdaMsgParam = NULL;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
+
 }
 #endif /* FEATURE_OEM_DATA_SUPPORT */
+
 /*
  * FUNCTION: WDA_SetTxPerTrackingReqCallback
  * 
@@ -8338,8 +9380,10 @@
 void WDA_SetTxPerTrackingReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -8352,14 +9396,17 @@
    {
       vos_mem_free(pWdaParams->wdaMsgParam);
    }
+
    if(NULL != pWdaParams->wdaWdiApiMsgParam)
    {
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    }
    
    vos_mem_free(pWdaParams);
+
    return ;
 }
+
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
 /*
  * FUNCTION: WDA_HostOffloadReqCallback
@@ -8520,8 +9567,10 @@
       (WDI_SetTxPerTrackingReqParamsType *)vos_mem_malloc(
          sizeof(WDI_SetTxPerTrackingReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == pwdiSetTxPerTrackingReqParams) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -8540,6 +9589,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.ucTxPerTrackingEnable = 
       pTxPerTrackingParams->ucTxPerTrackingEnable;
    pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.ucTxPerTrackingPeriod = 
@@ -8548,15 +9598,19 @@
       pTxPerTrackingParams->ucTxPerTrackingRatio;
    pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.uTxPerTrackingWatermark = 
       pTxPerTrackingParams->uTxPerTrackingWatermark;
+
    pwdiSetTxPerTrackingReqParams->wdiReqStatusCB = NULL;
+
    /* Store param pointer as passed in by caller */
    /* store Params pass it to WDI 
       Ideally, the memory allocated here will be free at WDA_SetTxPerTrackingReqCallback */
    pWdaParams->wdaWdiApiMsgParam = pwdiSetTxPerTrackingReqParams;
    pWdaParams->pWdaContext = pWDA;
    pWdaParams->wdaMsgParam = pTxPerTrackingParams;
+
    wstatus = WDI_SetTxPerTrackingReq(pwdiSetTxPerTrackingReqParams, 
                                     (WDI_SetTxPerTrackingRspCb)WDA_SetTxPerTrackingReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(wstatus))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -8566,9 +9620,11 @@
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       vos_mem_free(pWdaParams) ;
    }
+
    return status;
 
 }/*WDA_ProcessSetTxPerTrackingReq*/
+
 /*
  * FUNCTION: WDA_HALDumpCmdCallback
  * Send the VOS complete . 
@@ -8579,6 +9635,7 @@
    tANI_U8 *buffer = NULL;
    tWDA_CbContext *pWDA = NULL;
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -8589,19 +9646,23 @@
    
    pWDA = pWdaParams->pWdaContext;
    buffer = (tANI_U8 *)pWdaParams->wdaMsgParam;
+
    if(wdiRspParams->usBufferLen > 0)
    {
       /*Copy the Resp data to UMAC supplied buffer*/
       vos_mem_copy(buffer, wdiRspParams->pBuffer, wdiRspParams->usBufferLen);
    }
+
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams);
    
    /* Indicate VOSS about the start complete */
    vos_WDAComplete_cback(pWDA->pVosContext);
+
    return ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessHALDumpCmdReq
  * Send Dump command to WDI
@@ -8616,6 +9677,7 @@
    tWDA_ReqParams *pWdaParams ;
    pVosContextType pVosContext = NULL; 
    VOS_STATUS vStatus;
+
    pVosContext = (pVosContextType)vos_get_global_context(VOS_MODULE_ID_PE,
                                                            (void *)pMac);
    
@@ -8626,6 +9688,7 @@
                            "%s: VOS MEM Alloc Failure", __FUNCTION__); 
       return VOS_STATUS_E_NOMEM;
    }
+
    /* Allocate memory WDI request structure*/
    wdiHALDumpCmdReqParam = (WDI_HALDumpCmdReqParamsType *)
                 vos_mem_malloc(sizeof(WDI_HALDumpCmdReqParamsType));
@@ -8636,14 +9699,18 @@
       vos_mem_free(pWdaParams);
       return WDI_STATUS_E_FAILURE;
    }
+
    wdiHalDumpCmdInfo = &wdiHALDumpCmdReqParam->wdiHALDumpCmdInfoType;
+
    /* Extract the arguments */
    wdiHalDumpCmdInfo->command     = cmd;
    wdiHalDumpCmdInfo->argument1   = arg1;
    wdiHalDumpCmdInfo->argument2   = arg2;
    wdiHalDumpCmdInfo->argument3   = arg3;
    wdiHalDumpCmdInfo->argument4   = arg4;
+
    wdiHALDumpCmdReqParam->wdiReqStatusCB = NULL ;
+
    pWdaParams->pWdaContext = pVosContext->pWDAContext;
    
    /*  Response message will be passed through the buffer */
@@ -8651,9 +9718,12 @@
    
    /* store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)wdiHALDumpCmdReqParam ;
+
    /* Send command to WDI */
    status = WDI_HALDumpCmdReq(wdiHALDumpCmdReqParam, WDA_HALDumpCmdCallback, pWdaParams);
+
    vStatus = vos_wait_single_event( &(pVosContext->wdaCompleteEvent), 1000 );
+
    if ( vStatus != VOS_STATUS_SUCCESS )
    {
       if ( vStatus == VOS_STATUS_E_TIMEOUT )
@@ -8670,6 +9740,7 @@
    }
    return status;
 }
+
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
 /*
  * FUNCTION: WDA_ProcessGTKOffloadgetInfoReq
@@ -8734,6 +9805,7 @@
  * DATA interface with WDI for Mgmt Frames
  * ------------------------------------------------------------------------- 
  */
+
 /*
  * FUNCTION: WDA_TxComplete
  * Callback function for the WDA_TxPacket
@@ -8744,7 +9816,6 @@
    
    tWDA_CbContext *wdaContext= (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
    tpAniSirGlobal pMac = (tpAniSirGlobal)VOS_GET_MAC_CTXT((void *)pVosContext) ;
-   tANI_U32 uUserData; 
 
    if(NULL == wdaContext)
    {
@@ -8755,17 +9826,6 @@
       return VOS_STATUS_E_FAILURE;
    }
 
-    /*Check if frame was timed out or not*/
-    vos_pkt_get_user_data_ptr(  pData, VOS_PKT_USER_DATA_ID_WDA,
-                               (v_PVOID_t)&uUserData);
-
-    if ( WDA_TL_TX_MGMT_TIMED_OUT == uUserData )
-    {
-       /*Discard frame - no further processing is needed*/
-       vos_pkt_return_packet(pData); 
-       return VOS_STATUS_SUCCESS; 
-    }
-
    /*check whether the callback is null or not,made null during WDA_TL_TX_FRAME_TIMEOUT timeout*/
    if( NULL!=wdaContext->pTxCbFunc) 
    {
@@ -8782,6 +9842,7 @@
          //Return from here since we reaching here because the packet already timeout
          return status;
       }
+
    }
 
    /* 
@@ -8797,8 +9858,10 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
                       "NEW VOS Event Set failed - status = %d \n", status);
    }
+
    return status;
 }
+
 /*
  * FUNCTION: WDA_TxPacket
  * Forward TX management frame to WDI
@@ -8820,6 +9883,7 @@
    tANI_U8 eventIdx = 0;
    tBssSystemRole systemRole = eSYSTEM_UNKNOWN_ROLE;
    tpAniSirGlobal pMac;
+
    if((NULL == pWDA)||(NULL == pFrmBuf)) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -8831,6 +9895,7 @@
    
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_HIGH, 
                "Tx Mgmt Frame Subtype: %d alloc(%x)\n", pFc->subType, pFrmBuf);
+
    pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
    if(NULL == pMac)
    {
@@ -8879,6 +9944,7 @@
            return eHAL_STATUS_FAILURE;
        }
    } 
+
    /* Reset the event to be not signalled */
    status = vos_event_reset(&pWDA->txFrameEvent);
    if(!VOS_IS_STATUS_SUCCESS(status))
@@ -8898,8 +9964,10 @@
       }
       return VOS_STATUS_E_FAILURE;
    }
+
    /* Get system role, use the self station if in unknown role or STA role */
    systemRole = wdaGetGlobalSystemRole(pMac);
+
    if (( eSYSTEM_UNKNOWN_ROLE == systemRole ) || 
        (( eSYSTEM_STA_ROLE == systemRole )
 #ifdef FEATURE_WLAN_CCX
@@ -8910,18 +9978,27 @@
        txFlag |= HAL_USE_SELF_STA_REQUESTED_MASK;
    }
 
-   /* Divert Disassoc/Deauth frames thru self station, as by the time unicast
-      disassoc frame reaches the HW, HAL has already deleted the peer station */
-   if ((pFc->type == SIR_MAC_MGMT_FRAME))
+   /* Do not divert Disassoc/Deauth frames through self station because a delay of
+    * 300ms is added beofre trigerring DEL STA so let deuath gets delivered at TIM */
+   if ((pFc->type == SIR_MAC_MGMT_FRAME)) 
    {
-       if ((pFc->subType == SIR_MAC_MGMT_DISASSOC) ||
-               (pFc->subType == SIR_MAC_MGMT_DEAUTH) ||
-               (pFc->subType == SIR_MAC_MGMT_REASSOC_RSP) ||
-               (pFc->subType == SIR_MAC_MGMT_PROBE_REQ))
+       if ((pFc->subType == SIR_MAC_MGMT_DISASSOC) || 
+               (pFc->subType == SIR_MAC_MGMT_DEAUTH) || 
+               (pFc->subType == SIR_MAC_MGMT_REASSOC_RSP) || 
+               (pFc->subType == SIR_MAC_MGMT_PROBE_REQ)) 
        {
+           if( (systemRole == eSYSTEM_AP_ROLE) && ( (pFc->subType == SIR_MAC_MGMT_DEAUTH) ||
+                                                    (pFc->subType == SIR_MAC_MGMT_DISASSOC) ) )
+           {
+              /*Do not request self STA for deauth/disassoc let it go through peer STA and
+               *broadcast STA and get delivered at TIM for power save stations*/
+           }
+           else
+           {
              /*Send Probe request frames on self sta idx*/
              txFlag |= HAL_USE_SELF_STA_REQUESTED_MASK;
-       }
+           }
+       } 
        /* Since we donot want probe responses to be retried, send probe responses
           through the NO_ACK queues */
        if (pFc->subType == SIR_MAC_MGMT_PROBE_RSP) 
@@ -8934,6 +10011,7 @@
           txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
        }
    }
+   
    vos_atomic_set_U32(&pWDA->VosPacketToFree, (v_U32_t)pFrmBuf);/*set VosPacket_freed to pFrmBuf*/
 
    /*Set frame tag to 0 
@@ -8962,6 +10040,7 @@
       } 
       return VOS_STATUS_E_FAILURE;
    }
+
    /* 
     * Wait for the event to be set by the TL, to get the response of TX 
     * complete, this event should be set by the Callback function called by TL 
@@ -8973,25 +10052,17 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, 
                  "%s: Status %d when waiting for TX Frame Event",
                  __FUNCTION__, status);
+
       pWDA->pTxCbFunc = NULL;   /*To stop the limTxComplete being called again  , 
                                 after the packet gets completed(packet freed once)*/
 
-      /* TX MGMT fail with COMP timeout, try to detect DXE stall */
-      WDA_TransportChannelDebug(0, 1);
-
-      /*Tag Frame as timed out for later deletion*/
-      vos_pkt_set_user_data_ptr( (vos_pkt_t *)pFrmBuf, VOS_PKT_USER_DATA_ID_WDA, 
-                       (v_PVOID_t)WDA_TL_TX_MGMT_TIMED_OUT);
-
       /* check whether the packet was freed already,so need not free again when 
       * TL calls the WDA_Txcomplete routine
       */
-      vos_atomic_set_U32(&pWDA->VosPacketToFree, (v_U32_t)WDA_TX_PACKET_FREED);
-      /*if(vos_atomic_set_U32(&pWDA->VosPacketToFree, (v_U32_t)WDA_TX_PACKET_FREED) == (v_U32_t)pFrmBuf) 
+      if(vos_atomic_set_U32(&pWDA->VosPacketToFree, (v_U32_t)WDA_TX_PACKET_FREED) == (v_U32_t)pFrmBuf) 
       {
          pCompFunc(VOS_GET_MAC_CTXT(pWDA->pVosContext), (vos_pkt_t *)pFrmBuf);
-      } */
-
+      }
       if( pAckTxComp )
       {
          pWDA->pAckTxCbFunc = NULL;
@@ -9004,8 +10075,11 @@
       }
       status = VOS_STATUS_E_FAILURE;
    }
+
    return status;
 }
+
+
 /*
  * FUNCTION: WDA_McProcessMsg
  * Trigger DAL-AL to start CFG download 
@@ -9014,6 +10088,7 @@
 {
    VOS_STATUS status = VOS_STATUS_SUCCESS;
    tWDA_CbContext *pWDA = NULL ; 
+
    if(NULL == pMsg) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -9031,15 +10106,16 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s:pWDA is NULL", __FUNCTION__); 
       VOS_ASSERT(0);
-	  vos_mem_free(pMsg->bodyptr);
       return VOS_STATUS_E_FAILURE;
    }
+
    /* Process all the WDA messages.. */
    switch( pMsg->type )
    {
       case WNI_CFG_DNLD_REQ:
       {
          status = WDA_WniCfgDnld(pWDA);
+
          /* call WDA complete event if config download success */
          if( VOS_IS_STATUS_SUCCESS(status) )
          {
@@ -9052,6 +10128,7 @@
          }
          break ;
       }
+
       /* 
        * Init SCAN request from PE, convert it into DAL format 
        * and send it to DAL 
@@ -9106,11 +10183,73 @@
       }
       case WDA_DELETE_BSS_REQ:
       {
+         wpt_uint8  staIdx;
+         wpt_uint8  bssIdx = ((tDeleteBssParams *)pMsg->bodyptr)->bssIdx;
+         wpt_uint8  reservedResourceBySta;
+         wpt_uint16  waitLoop = 0;
+
+         if (WDI_DS_GetStaIdxFromBssIdx(pWDA->pWdiContext, bssIdx, &staIdx))
+         {
+            VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
+                       "%s: Get STA index from BSS index Fail", __FUNCTION__);
+            VOS_ASSERT(0) ;
+         }
+         while (1) 
+         {
+             reservedResourceBySta = WDI_DS_GetReservedResCountPerSTA(pWDA->pWdiContext, WDI_DATA_POOL_ID, staIdx);
+             /* Wait till reserved resource by STA must be none */
+             if (reservedResourceBySta == 0)
+             {
+                 VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                            "STA %d BSS %d TX RING empty %d", staIdx, bssIdx );
+                 break;
+
+             }
+             else
+             {
+                 if(waitLoop > WDA_MAX_RETRIES_TILL_RING_EMPTY)
+                 {
+                     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
+                                "TX Ring could not empty, not normal" );
+                     VOS_ASSERT(0);
+                     break;
+                 }
+                 vos_sleep(WDA_WAIT_MSEC_TILL_RING_EMPTY);
+                 waitLoop++;
+             }
+         }
          WDA_ProcessDelBssReq(pWDA, (tDeleteBssParams *)pMsg->bodyptr) ;
          break ;
       }
       case WDA_DELETE_STA_REQ:
       {
+         tDeleteStaParams *delSta = (tDeleteStaParams *)pMsg->bodyptr;
+         wpt_uint8 reservedResourceBySta;
+         wpt_uint16  waitLoop = 0;
+
+         while (1) 
+         {
+             reservedResourceBySta = WDI_DS_GetReservedResCountPerSTA(pWDA->pWdiContext, WDI_DATA_POOL_ID, delSta->staIdx);
+             /* Wait till reserved resource by STA must be none */
+             if (reservedResourceBySta == 0)
+             {
+                 VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+                            "STA %d TX RING empty %d", delSta->staIdx );
+                 break;
+             }
+             else
+             {
+                 if(waitLoop > WDA_MAX_RETRIES_TILL_RING_EMPTY)
+                 {
+                     VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_FATAL,
+                                "TX Ring could not empty, not normal" );
+                     VOS_ASSERT(0);
+                     break;
+                 }
+                 vos_sleep(WDA_WAIT_MSEC_TILL_RING_EMPTY);
+                 waitLoop++;
+             }
+         }
          WDA_ProcessDelStaReq(pWDA, (tDeleteStaParams *)pMsg->bodyptr) ;
          break ;
       }
@@ -9302,6 +10441,7 @@
          }
          break;
       }
+
       case WDA_REGISTER_PE_CALLBACK :
       {
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_HIGH,
@@ -9382,6 +10522,7 @@
          WDA_ProcessAddStaSelfReq(pWDA, (tAddStaSelfParams *)pMsg->bodyptr);
          break;
       }
+
       case WDA_DEL_STA_SELF_REQ:
       {
          WDA_ProcessDelSTASelfReq(pWDA, (tDelStaSelfParams *)pMsg->bodyptr);
@@ -9470,6 +10611,7 @@
          break;
       }
 #endif /* WLAN_FEATURE_VOWIFI_11R */
+
 #ifdef ANI_MANF_DIAG
       case WDA_FTM_CMD_REQ:
       {
@@ -9477,6 +10619,7 @@
          break ;
       }
 #endif /* ANI_MANF_DIAG */
+
 #ifdef FEATURE_OEM_DATA_SUPPORT
       case WDA_START_OEM_DATA_REQ:
       {
@@ -9484,6 +10627,7 @@
          break;
       }
 #endif /* FEATURE_OEM_DATA_SUPPORT */
+
       /* Tx Complete Time out Indication */
       case WDA_TX_COMPLETE_TIMEOUT_IND:
       {
@@ -9496,6 +10640,7 @@
                         (tSirWlanSuspendParam *)pMsg->bodyptr) ;
          break;
       }
+
       case WDA_WLAN_RESUME_REQ:
       {
          WDA_ProcessWlanResumeReq(pWDA, 
@@ -9526,6 +10671,7 @@
          break;
       }
 #endif // FEATURE_WLAN_SCAN_PNO
+
       case WDA_SET_TX_PER_TRACKING_REQ:
       {
          WDA_ProcessSetTxPerTrackingReq(pWDA, (tSirTxPerTrackingParam *)pMsg->bodyptr);
@@ -9538,16 +10684,19 @@
          WDA_Process8023MulticastListReq(pWDA, (tSirRcvFltMcAddrList *)pMsg->bodyptr);
          break;
       }
+
       case WDA_RECEIVE_FILTER_SET_FILTER_REQ:
       {
          WDA_ProcessReceiveFilterSetFilterReq(pWDA, (tSirRcvPktFilterCfgType *)pMsg->bodyptr);
          break;
       }
+
       case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ:
       {
          WDA_ProcessPacketFilterMatchCountReq(pWDA, (tpSirRcvFltPktMatchRsp)pMsg->bodyptr);
          break;
       }
+
       case WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ:
       {
          WDA_ProcessReceiveFilterClearFilterReq(pWDA, (tSirRcvFltPktClearParam *)pMsg->bodyptr);
@@ -9561,11 +10710,13 @@
          WDA_ProcessTxControlInd(pWDA, (tpTxControlParams)pMsg->bodyptr);
          break;
       }
+
       case WDA_SET_POWER_PARAMS_REQ:
       {
          WDA_ProcessSetPowerParamsReq(pWDA, (tSirSetPowerParamsReq *)pMsg->bodyptr);
          break;
       }
+
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
       case WDA_GTK_OFFLOAD_REQ:
       {
@@ -9599,9 +10750,11 @@
          //WDA_VOS_ASSERT(0) ;
       }
    }
+
    return status ;
 }
 
+
 /*
  * FUNCTION: WDA_LowLevelIndCallback
  * IND API callback from WDI, send Ind to PE
@@ -9613,6 +10766,7 @@
 #if defined WLAN_FEATURE_NEIGHBOR_ROAMING
    tSirRSSINotification rssiNotification;
 #endif
+
    if(NULL == pWDA)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -9627,6 +10781,7 @@
       {
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                      "Received WDI_HAL_RSSI_NOTIFICATION_IND from WDI ");
+
 #if defined WLAN_FEATURE_NEIGHBOR_ROAMING
          rssiNotification.bReserved = 
             wdiLowLevelInd->wdiIndicationData.wdiLowRSSIInfo.bReserved;
@@ -9642,6 +10797,7 @@
             wdiLowLevelInd->wdiIndicationData.wdiLowRSSIInfo.bRssiThres3NegCross;
          rssiNotification.bRssiThres3PosCross = 
             wdiLowLevelInd->wdiIndicationData.wdiLowRSSIInfo.bRssiThres3PosCross;
+
          WLANTL_BMPSRSSIRegionChangedNotification(
             pWDA->pVosContext,
             &rssiNotification);
@@ -9652,6 +10808,7 @@
       {
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                      "Received WDI_MISSED_BEACON_IND from WDI ");
+
          /* send IND to PE */
          WDA_SendMsg(pWDA, WDA_MISSED_BEACON_IND, NULL, 0) ;
          break ;
@@ -9677,6 +10834,7 @@
          }
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                   "Received WDI_MIC_FAILURE_IND from WDI ");
+
          pMicInd->messageType = eWNI_SME_MIC_FAILURE_IND;
          pMicInd->length = sizeof(tSirSmeMicFailureInd);
          vos_mem_copy(pMicInd->bssId,
@@ -9702,6 +10860,7 @@
              wdiLowLevelInd->wdiIndicationData.wdiMICFailureInfo.ucIV1;
          vos_mem_copy(pMicInd->info.TSC,
              wdiLowLevelInd->wdiIndicationData.wdiMICFailureInfo.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
+
          WDA_SendMsg(pWDA, SIR_HAL_MIC_FAILURE_IND, 
                                        (void *)pMicInd , 0) ;
          break ;
@@ -9715,6 +10874,7 @@
       }
       case WDI_DEL_STA_IND:
       {
+
          tpDeleteStaContext  pDelSTACtx = 
             (tpDeleteStaContext)vos_mem_malloc(sizeof(tDeleteStaContext));
          
@@ -9729,17 +10889,21 @@
          vos_mem_copy(pDelSTACtx->addr2,
              wdiLowLevelInd->wdiIndicationData.wdiDeleteSTAIndType.macADDR2,
              sizeof(tSirMacAddr));
+
          vos_mem_copy(pDelSTACtx->bssId,
              wdiLowLevelInd->wdiIndicationData.wdiDeleteSTAIndType.macBSSID,
              sizeof(tSirMacAddr));
+
          pDelSTACtx->assocId    = 
           wdiLowLevelInd->wdiIndicationData.wdiDeleteSTAIndType.usAssocId;
          pDelSTACtx->reasonCode = 
           wdiLowLevelInd->wdiIndicationData.wdiDeleteSTAIndType.wptReasonCode;
          pDelSTACtx->staId      = 
           wdiLowLevelInd->wdiIndicationData.wdiDeleteSTAIndType.ucSTAIdx;
+
          WDA_SendMsg(pWDA, SIR_LIM_DELETE_STA_CONTEXT_IND, 
                                        (void *)pDelSTACtx , 0) ;
+
          break ;
       }
       case WDI_COEX_IND:
@@ -9755,19 +10919,23 @@
          }
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                   "Received WDI_COEX_IND from WDI ");
+
          /* Message Header */
          pSmeCoexInd->mesgType = eWNI_SME_COEX_IND;
          pSmeCoexInd->mesgLen = sizeof(tSirSmeCoexInd);
+
          /* Info from WDI Indication */
          pSmeCoexInd->coexIndType = wdiLowLevelInd->wdiIndicationData.wdiCoexInfo.coexIndType; 
          for (index = 0; index < SIR_COEX_IND_DATA_SIZE; index++)
          {
             pSmeCoexInd->coexIndData[index] = wdiLowLevelInd->wdiIndicationData.wdiCoexInfo.coexIndData[index]; 
          }
+
          /* VOS message wrapper */
          vosMsg.type = eWNI_SME_COEX_IND;
          vosMsg.bodyptr = (void *)pSmeCoexInd;
          vosMsg.bodyval = 0;
+
          /* Send message to SME */
          if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
          {
@@ -9816,8 +10984,10 @@
       {
          tSirP2PNoaAttr   *pP2pNoaAttr = 
             (tSirP2PNoaAttr *)vos_mem_malloc(sizeof(tSirP2PNoaAttr));
+
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                               "Received WDI_P2P_NOA_ATTR_IND from WDI");
+
          if (NULL == pP2pNoaAttr)
          {
             VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -9825,6 +10995,7 @@
                        "WDI_P2P_NOA_ATTR_IND not forwarded");
             break;
          }
+
          pP2pNoaAttr->index            = 
                     wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.ucIndex;
          pP2pNoaAttr->oppPsFlag        = 
@@ -9840,6 +11011,7 @@
                     wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa1Interval;
          pP2pNoaAttr->uNoa1StartTime   = 
                     wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa1StartTime;
+
          pP2pNoaAttr->uNoa2IntervalCnt = 
                     wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.usNoa2IntervalCnt;
          pP2pNoaAttr->uNoa2Duration    = 
@@ -9848,18 +11020,22 @@
                     wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa2Interval;
          pP2pNoaAttr->uNoa2StartTime   = 
                     wdiLowLevelInd->wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa2StartTime;
+
          WDA_SendMsg(pWDA, SIR_HAL_P2P_NOA_ATTR_IND, 
                                        (void *)pP2pNoaAttr , 0) ;
          break;
       }
 #endif
+
 #ifdef FEATURE_WLAN_SCAN_PNO
       case WDI_PREF_NETWORK_FOUND_IND:
       {
          vos_msg_t vosMsg;
          tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)vos_mem_malloc(sizeof(tSirPrefNetworkFoundInd));
+
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                               "Received WDI_PREF_NETWORK_FOUND_IND from WDI");
+
          if (NULL == pPrefNetworkFoundInd)
          {
             VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -9867,6 +11043,7 @@
                        "WDI_PREF_NETWORK_FOUND_IND not forwarded");
             break;
          }
+
          /* Message Header */
          pPrefNetworkFoundInd->mesgType = eWNI_SME_PREF_NETWORK_FOUND_IND;
          pPrefNetworkFoundInd->mesgLen = sizeof(*pPrefNetworkFoundInd);
@@ -9874,21 +11051,27 @@
          /* Info from WDI Indication */ 
          pPrefNetworkFoundInd->ssId.length = 
             wdiLowLevelInd->wdiIndicationData.wdiPrefNetworkFoundInd.ssId.ucLength;
+
          vos_mem_set( pPrefNetworkFoundInd->ssId.ssId, 32, 0);
+
          vos_mem_copy( pPrefNetworkFoundInd->ssId.ssId, 
                   wdiLowLevelInd->wdiIndicationData.wdiPrefNetworkFoundInd.ssId.sSSID, 
                   pPrefNetworkFoundInd->ssId.length);
+
          pPrefNetworkFoundInd ->rssi = wdiLowLevelInd->wdiIndicationData.wdiPrefNetworkFoundInd.rssi; 
+
          /* VOS message wrapper */
          vosMsg.type = eWNI_SME_PREF_NETWORK_FOUND_IND;
          vosMsg.bodyptr = (void *) pPrefNetworkFoundInd;
          vosMsg.bodyval = 0;
+
          /* Send message to SME */
          if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
          {
             /* free the mem and return */
             vos_mem_free((v_VOID_t *) pPrefNetworkFoundInd);
          }
+
          break;
       }
 #endif // FEATURE_WLAN_SCAN_PNO
@@ -9957,6 +11140,7 @@
          vosMsg.type = eWNI_SME_TX_PER_HIT_IND;
          vosMsg.bodyptr = NULL;
          vosMsg.bodyval = 0;
+
          /* Send message to SME */
          if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, (vos_msg_t*)&vosMsg))
          {
@@ -9975,14 +11159,17 @@
    return ;
 }
 
+
 /*
  * BA related processing in WDA.
  */
+
 void WDA_TriggerBaReqCallback(WDI_TriggerBARspParamsType *wdiTriggerBaRsp, 
                                                              void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
    tWDA_CbContext *pWDA;
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -9990,12 +11177,16 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext;
+
    vos_mem_free(pWdaParams->wdaMsgParam) ;
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(WDI_STATUS_SUCCESS == wdiTriggerBaRsp->wdiStatus)
    {
       tANI_U8 i = 0 ;
@@ -10005,7 +11196,9 @@
                            + sizeof(tAddBaCandidate) * (baCandidateCount) ;
       WDI_TriggerBARspCandidateType *wdiBaCandidate = NULL ; 
       tAddBaCandidate *baCandidate = NULL ;
+
       baActivityInd =  (tBaActivityInd *)vos_mem_malloc(allocSize) ;
+
       if(NULL == baActivityInd) 
       { 
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10013,6 +11206,7 @@
          VOS_ASSERT(0) ;
          return; 
       }
+
       vos_mem_copy(baActivityInd->bssId, wdiTriggerBaRsp->macBSSID, 
                                                     sizeof(tSirMacAddr)) ;
       baActivityInd->baCandidateCnt = baCandidateCount ;
@@ -10023,8 +11217,11 @@
       for(i = 0 ; i < baCandidateCount ; i++)
       {
          tANI_U8 tid = 0 ;
+         wdiBaCandidate = (wdiBaCandidate + i) ;
+         baCandidate = (baCandidate + i) ;
          vos_mem_copy(baCandidate->staAddr, wdiBaCandidate->macSTA, 
                                                    sizeof(tSirMacAddr)) ;
+
          for(tid = 0 ; tid < STACFG_MAX_TC; tid++)
          {
              baCandidate->baInfo[tid].fBaEnable = 
@@ -10032,9 +11229,8 @@
              baCandidate->baInfo[tid].startingSeqNum = 
                               wdiBaCandidate->wdiBAInfo[tid].startingSeqNum ;
          }
-         wdiBaCandidate++ ;
-         baCandidate++ ;
       }
+
       WDA_SendMsg(pWDA, SIR_LIM_ADD_BA_IND, (void *)baActivityInd , 0) ;
    }
    else
@@ -10042,8 +11238,11 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                             "BA Trigger RSP with Failure received ");
    }
+
    return ;
+
 }
+
 /*
  * BA Activity check timer handler
  */
@@ -10074,12 +11273,10 @@
    {
       for(tid = 0 ; tid < STACFG_MAX_TC ; tid++)
       {
-         WLANTL_STAStateType tlSTAState ;
          tANI_U32 txPktCount = 0 ;
          tANI_U8 validStaIndex = pWDA->wdaStaInfo[curSta].ucValidStaIndex ;
+
          if((WDA_VALID_STA_INDEX == validStaIndex) &&
-            (VOS_STATUS_SUCCESS == WDA_TL_GET_STA_STATE( pWDA->pVosContext,
-                                                    curSta, &tlSTAState)) &&
             (VOS_STATUS_SUCCESS == WDA_TL_GET_TX_PKTCOUNT( pWDA->pVosContext,
                                                     curSta, tid, &txPktCount)))
          {
@@ -10089,7 +11286,6 @@
                                     pWDA->wdaStaInfo[curSta].framesTxed[tid]);
 #endif
             if(!WDA_GET_BA_TXFLAG(pWDA, curSta, tid) 
-                   && (WLANTL_STA_AUTHENTICATED == tlSTAState)
                    && (txPktCount >= WDA_LAST_POLLED_THRESHOLD(pWDA, 
                                                                curSta, tid)))
             {
@@ -10101,6 +11297,7 @@
             pWDA->wdaStaInfo[curSta].framesTxed[tid] = txPktCount ;
          }
       }
+
       /* fill the entry for all the sta with given TID's */
       if(WDA_ENABLE_BA == newBaCandidate)
       { 
@@ -10111,6 +11308,7 @@
          newBaCandidate = WDA_DISABLE_BA ;
       } 
    }
+
    /* prepare and send message to hal */
    if( 0 < baCandidateCount)
    {
@@ -10118,6 +11316,7 @@
       WDI_TriggerBAReqParamsType *wdiTriggerBaReq;
       tWDA_ReqParams *pWdaParams = 
                (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
+
       if(NULL == pWdaParams) 
       {
          VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10135,6 +11334,7 @@
          vos_mem_free(pWdaParams);
          return; 
       }
+
       do
       {
          WDI_TriggerBAReqinfoType *triggerBaInfo = 
@@ -10149,6 +11349,7 @@
       wdiTriggerBaReq->wdiReqStatusCB = NULL ;
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
       pWdaParams->pWdaContext = pWDA;
       pWdaParams->wdaWdiApiMsgParam = wdiTriggerBaReq ;
       pWdaParams->wdaMsgParam = NULL; 
@@ -10168,6 +11369,7 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO_LOW,
                               "There is no TID for initiating BA");
    }
+
    if( VOS_STATUS_SUCCESS != 
          WDA_STOP_TIMER(&pWDA->wdaTimers.baActivityChkTmr))
    {
@@ -10184,11 +11386,13 @@
    }
    return ;
 }
+
 /*
  * WDA common routine to create timer used by WDA.
  */
 static VOS_STATUS wdaCreateTimers(tWDA_CbContext *pWDA)
 {
+
    VOS_STATUS status = VOS_STATUS_SUCCESS ;
    tANI_U32 val = 0 ;
    tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext);
@@ -10219,11 +11423,14 @@
                                "Unable to create BA activity timer");
       return eSIR_FAILURE ;
    }
+
    val = SYS_MS_TO_TICKS( WDA_TX_COMPLETE_TIME_OUT_VALUE ) ; 
+
    /* Tx Complete Timeout timer */
    status = WDA_CREATE_TIMER(&pWDA->wdaTimers.TxCompleteTimer,
                          "Tx Complete Check timer", WDA_TimerHandler,
                          WDA_TX_COMPLETE_TIMEOUT_IND, val, val, TX_NO_ACTIVATE) ;
+
    if(status != TX_SUCCESS)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10238,14 +11445,17 @@
       } 
       return eSIR_FAILURE ;
    }
+
    return eSIR_SUCCESS ;
 }
+
 /*
  * WDA common routine to destroy timer used by WDA.
  */
 static VOS_STATUS wdaDestroyTimers(tWDA_CbContext *pWDA)
 {
    VOS_STATUS status = VOS_STATUS_SUCCESS ;
+
    status = WDA_DESTROY_TIMER(&pWDA->wdaTimers.TxCompleteTimer);
    if(status != TX_SUCCESS)
    {
@@ -10253,6 +11463,7 @@
                                "Unable to Destroy Tx Complete Timeout timer");
       return eSIR_FAILURE ;
    }
+
    status = WDA_DESTROY_TIMER(&pWDA->wdaTimers.baActivityChkTmr);
    if(status != TX_SUCCESS)
    {
@@ -10263,6 +11474,7 @@
                            
    return eSIR_SUCCESS ;
 }
+
 /*
  * WDA timer handler.
  */
@@ -10270,25 +11482,30 @@
 {
    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
    vos_msg_t wdaMsg = {0} ;
+
    /*
     * trigger CFG download in WDA by sending WDA_CFG_DNLD message
     */ 
    wdaMsg.type = timerInfo ; 
    wdaMsg.bodyptr = NULL;
    wdaMsg.bodyval = 0;
+
    /* post the message.. */
    vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &wdaMsg );
    if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
    {
       vosStatus = VOS_STATUS_E_BADMSG;
    }
+
 }
+
 /*
  * WDA Tx Complete timeout Indication.
  */
 void WDA_ProcessTxCompleteTimeOutInd(tWDA_CbContext* pWDA)
 {
    tpAniSirGlobal pMac = (tpAniSirGlobal )VOS_GET_MAC_CTXT(pWDA->pVosContext) ;
+
    if( pWDA->pAckTxCbFunc )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10301,7 +11518,9 @@
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
             "There is no request pending for TxComplete and wait timer expired\n");
    }
+
 }
+
 /*
  * WDA Set REG Domain to VOS NV
  */
@@ -10315,6 +11534,7 @@
 }
 #endif  /* FEATURE_WLAN_INTEGRATED_SOC */
 
+
 #ifdef FEATURE_WLAN_SCAN_PNO
 /*
  * FUNCTION: WDA_PNOScanReqCallback
@@ -10323,8 +11543,10 @@
 void WDA_PNOScanReqCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
     if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10332,12 +11554,14 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    if( pWdaParams != NULL )
    {
       if( pWdaParams->wdaWdiApiMsgParam != NULL )
       {
          vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       }
+
       if( pWdaParams->wdaMsgParam != NULL)
       {
          vos_mem_free(pWdaParams->wdaMsgParam);
@@ -10348,6 +11572,7 @@
 
    return ;
 }
+
 /*
  * FUNCTION: WDA_UpdateScanParamsCallback
  * 
@@ -10355,8 +11580,10 @@
 void WDA_UpdateScanParamsCallback(WDI_Status status, void* pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
     if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10364,30 +11591,35 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    if( pWdaParams != NULL )
    {
       if( pWdaParams->wdaWdiApiMsgParam != NULL )
       {
          vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       }
+
       if( pWdaParams->wdaMsgParam != NULL)
       {
          vos_mem_free(pWdaParams->wdaMsgParam);
       }
       vos_mem_free(pWdaParams) ;
    }
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_SetPowerParamsCallback
  * 
  */ 
 void WDA_SetPowerParamsCallback(WDI_Status status, void* pUserData)
 {
-   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+   tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData; 
 
      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
     if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10395,20 +11627,24 @@
       VOS_ASSERT(0) ;
       return ;
    }
+
    if( pWdaParams != NULL )
    {
       if( pWdaParams->wdaWdiApiMsgParam != NULL )
       {
          vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
       }
+
       if( pWdaParams->wdaMsgParam != NULL)
       {
          vos_mem_free(pWdaParams->wdaMsgParam);
       }
       vos_mem_free(pWdaParams) ;
    }
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessSetPreferredNetworkList
  * Request to WDI to set Preferred Network List.Offload
@@ -10421,8 +11657,10 @@
       (WDI_PNOScanReqParamsType *)vos_mem_malloc(sizeof(WDI_PNOScanReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
    v_U8_t   i; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == pwdiPNOScanReqInfo) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10430,6 +11668,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -10439,39 +11678,49 @@
       vos_mem_free(pwdiPNOScanReqInfo);
       return VOS_STATUS_E_NOMEM;
    }
+
    //
    // Fill wdiPNOScanReqInfo->wdiPNOScanInfo from pPNOScanReqParams
    //
    pwdiPNOScanReqInfo->wdiPNOScanInfo.bEnable = pPNOScanReqParams->enable;
    pwdiPNOScanReqInfo->wdiPNOScanInfo.wdiModePNO = pPNOScanReqParams->modePNO;
+
    pwdiPNOScanReqInfo->wdiPNOScanInfo.ucNetworksCount = 
       ( pPNOScanReqParams->ucNetworksCount < WDI_PNO_MAX_SUPP_NETWORKS )? 
         pPNOScanReqParams->ucNetworksCount : WDI_PNO_MAX_SUPP_NETWORKS ;
+
    for ( i = 0; i < pwdiPNOScanReqInfo->wdiPNOScanInfo.ucNetworksCount ; i++)
    {
       vos_mem_copy(&pwdiPNOScanReqInfo->wdiPNOScanInfo.aNetworks[i],
                    &pPNOScanReqParams->aNetworks[i],
                    sizeof(pwdiPNOScanReqInfo->wdiPNOScanInfo.aNetworks[i]));
    }
+
    /*Scan timer intervals*/
    vos_mem_copy(&pwdiPNOScanReqInfo->wdiPNOScanInfo.scanTimers,
                 &pPNOScanReqParams->scanTimers,
                 sizeof(pwdiPNOScanReqInfo->wdiPNOScanInfo.scanTimers));
+
    /*Probe template for 2.4GHz band*/
    pwdiPNOScanReqInfo->wdiPNOScanInfo.us24GProbeSize = 
       (pPNOScanReqParams->us24GProbeTemplateLen<WDI_PNO_MAX_PROBE_SIZE)?
       pPNOScanReqParams->us24GProbeTemplateLen:WDI_PNO_MAX_PROBE_SIZE; 
+
    vos_mem_copy( &pwdiPNOScanReqInfo->wdiPNOScanInfo.a24GProbeTemplate,
                 pPNOScanReqParams->p24GProbeTemplate,
                 pwdiPNOScanReqInfo->wdiPNOScanInfo.us24GProbeSize);
+
    /*Probe template for 5GHz band*/
    pwdiPNOScanReqInfo->wdiPNOScanInfo.us5GProbeSize = 
       (pPNOScanReqParams->us5GProbeTemplateLen<WDI_PNO_MAX_PROBE_SIZE)?
       pPNOScanReqParams->us5GProbeTemplateLen:WDI_PNO_MAX_PROBE_SIZE; 
+
    vos_mem_copy( &pwdiPNOScanReqInfo->wdiPNOScanInfo.a5GProbeTemplate,
                 pPNOScanReqParams->p5GProbeTemplate,
                 pwdiPNOScanReqInfo->wdiPNOScanInfo.us5GProbeSize);
+
    pwdiPNOScanReqInfo->wdiReqStatusCB = NULL;
+
    if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10487,8 +11736,10 @@
    pWdaParams->pWdaContext = pWDA;
    /* Store param pointer as passed in by caller */
    pWdaParams->wdaMsgParam = pPNOScanReqParams;
+
    status = WDI_SetPreferredNetworkReq(pwdiPNOScanReqInfo, 
                            (WDI_PNOScanCb)WDA_PNOScanReqCallback, pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10498,8 +11749,10 @@
       pWdaParams->wdaWdiApiMsgParam = NULL;
       pWdaParams->wdaMsgParam = NULL;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_RssiFilterCallback
  * 
@@ -10530,8 +11783,10 @@
    WDI_SetRssiFilterReqParamsType *pwdiSetRssiFilterReqInfo = 
       (WDI_SetRssiFilterReqParamsType *)vos_mem_malloc(sizeof(WDI_SetRssiFilterReqParamsType)) ;
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == pwdiSetRssiFilterReqInfo) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10539,6 +11794,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -10548,8 +11804,10 @@
       vos_mem_free(pwdiSetRssiFilterReqInfo);
       return VOS_STATUS_E_NOMEM;
    }
+
    pwdiSetRssiFilterReqInfo->rssiThreshold = pRssiFilterParams->rssiThreshold;
    pwdiSetRssiFilterReqInfo->wdiReqStatusCB = NULL;
+
    if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10559,14 +11817,17 @@
       vos_mem_free(pWdaParams);
       return VOS_STATUS_E_FAILURE;
    }
+
    /* Store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)pwdiSetRssiFilterReqInfo;
    pWdaParams->pWdaContext = pWDA;
    /* Store param pointer as passed in by caller */
    pWdaParams->wdaMsgParam = pRssiFilterParams;
+
    status = WDI_SetRssiFilterReq( pwdiSetRssiFilterReqInfo, 
                                  (WDI_PNOScanCb)WDA_RssiFilterCallback, 
                                  pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10576,9 +11837,11 @@
       pWdaParams->wdaWdiApiMsgParam = NULL;
       pWdaParams->wdaMsgParam = NULL;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
 
+
 /*
  * FUNCTION: WDA_ProcessUpdateScanParams
  * Request to WDI to update Scan Parameters
@@ -10592,8 +11855,10 @@
          sizeof(WDI_UpdateScanParamsInfoType)) ;
    tWDA_ReqParams *pWdaParams ;
    v_U8_t i; 
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == wdiUpdateScanParamsInfoType) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10601,6 +11866,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if ( NULL == pWdaParams )
    {
@@ -10610,9 +11876,11 @@
       vos_mem_free(wdiUpdateScanParamsInfoType);
       return VOS_STATUS_E_NOMEM;
    }
+
    //
    // Fill wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo from pUpdateScanParams
    //
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
           "Update Scan Parameters b11dEnabled %d b11dResolved %d "
           "ucChannelCount %d usPassiveMinChTime %d usPassiveMaxChTime"
@@ -10628,12 +11896,16 @@
               sizeof(tSirUpdateScanParams),
               sizeof(wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo) ); 
 
+
    wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.b11dEnabled  =
       pUpdateScanParams->b11dEnabled;
+
    wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.b11dResolved =
       pUpdateScanParams->b11dResolved;
+
    wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.cbState = 
       pUpdateScanParams->ucCBState;
+
    wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.usActiveMaxChTime  =
       pUpdateScanParams->usActiveMaxChTime; 
    wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.usActiveMinChTime  = 
@@ -10643,10 +11915,12 @@
    wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.usPassiveMinChTime = 
      pUpdateScanParams->usPassiveMinChTime;
 
+
    wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.ucChannelCount = 
       (pUpdateScanParams->ucChannelCount < WDI_PNO_MAX_NETW_CHANNELS)?
       pUpdateScanParams->ucChannelCount:WDI_PNO_MAX_NETW_CHANNELS;
 
+
    for ( i = 0; i < 
          wdiUpdateScanParamsInfoType->wdiUpdateScanParamsInfo.ucChannelCount ; 
          i++)
@@ -10659,7 +11933,9 @@
          pUpdateScanParams->aChannels[i];
    }
 
+
    wdiUpdateScanParamsInfoType->wdiReqStatusCB = NULL;
+
    if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10669,17 +11945,19 @@
       vos_mem_free(wdiUpdateScanParamsInfoType);
       return VOS_STATUS_E_FAILURE;
    }
+
      /* Store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = wdiUpdateScanParamsInfoType;
    pWdaParams->pWdaContext = pWDA;
    /* Store param pointer as passed in by caller */
    pWdaParams->wdaMsgParam = pUpdateScanParams;
- 
+
  
 
    status = WDI_UpdateScanParamsReq(wdiUpdateScanParamsInfoType, 
                     (WDI_UpdateScanParamsCb)WDA_UpdateScanParamsCallback, 
                     pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10688,9 +11966,11 @@
       vos_mem_free(pWdaParams->wdaMsgParam);
       vos_mem_free(pWdaParams);
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
 #endif // FEATURE_WLAN_SCAN_PNO
+
 #ifdef WLAN_FEATURE_PACKET_FILTERING
 /*
  * FUNCTION: WDA_8023MulticastListReqCallback
@@ -10699,8 +11979,10 @@
 void WDA_8023MulticastListReqCallback(WDI_Status status, void * pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10712,11 +11994,14 @@
    vos_mem_free(pWdaParams->wdaMsgParam) ;
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    //print a msg, nothing else to do
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
               "WDA_8023MulticastListReqCallback invoked " );
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_Process8023MulticastListReq
  * Request to WDI to add 8023 Multicast List
@@ -10728,8 +12013,10 @@
    WDI_RcvFltPktSetMcListReqParamsType *pwdiFltPktSetMcListReqParamsType = NULL;
    tWDA_ReqParams *pWdaParams ;
    tANI_U8         i;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    pwdiFltPktSetMcListReqParamsType = 
       (WDI_RcvFltPktSetMcListReqParamsType *)vos_mem_malloc(
                              sizeof(WDI_RcvFltPktSetMcListReqParamsType)
@@ -10740,6 +12027,7 @@
                            "%s: VOS MEM Alloc Failure", __FUNCTION__); 
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -10748,6 +12036,7 @@
       vos_mem_free(pwdiFltPktSetMcListReqParamsType);
       return VOS_STATUS_E_NOMEM;
    }
+
    if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10757,35 +12046,35 @@
       vos_mem_free(pWdaParams);
       return VOS_STATUS_E_FAILURE;
    }
+
    //
    // Fill pwdiFltPktSetMcListReqParamsType from pRcvFltMcAddrList
    //
    pwdiFltPktSetMcListReqParamsType->mcAddrList.ulMulticastAddrCnt = 
-                                   pRcvFltMcAddrList->ulMulticastAddrCnt;
-
-    vos_mem_copy(pwdiFltPktSetMcListReqParamsType->mcAddrList.selfMacAddr,
-                 pRcvFltMcAddrList->selfMacAddr, sizeof(tSirMacAddr));
-    vos_mem_copy(pwdiFltPktSetMcListReqParamsType->mcAddrList.bssId,
-                 pRcvFltMcAddrList->bssId, sizeof(tSirMacAddr));
-
+                                   pRcvFltMcAddrList->ulMulticastAddrCnt; 
    for( i = 0; i < pRcvFltMcAddrList->ulMulticastAddrCnt; i++ )
    {
       vos_mem_copy(&(pwdiFltPktSetMcListReqParamsType->mcAddrList.multicastAddr[i]),
                    &(pRcvFltMcAddrList->multicastAddr[i]),
                    sizeof(tSirMacAddr));
    }
+
    pwdiFltPktSetMcListReqParamsType->wdiReqStatusCB = NULL;
+
   /* WDA_VOS_ASSERT((NULL == pWDA->wdaMsgParam) && 
                   (NULL == pWDA->wdaWdiApiMsgParam)); */
+
    /* Store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)pwdiFltPktSetMcListReqParamsType;
    pWdaParams->pWdaContext = pWDA;
    /* Store param pointer as passed in by caller */
    pWdaParams->wdaMsgParam = pRcvFltMcAddrList;
+
    status = WDI_8023MulticastListReq(
                         pwdiFltPktSetMcListReqParamsType, 
                         (WDI_8023MulticastListCb)WDA_8023MulticastListReqCallback,
                         pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10794,8 +12083,10 @@
       vos_mem_free(pWdaParams->wdaMsgParam);
       vos_mem_free(pWdaParams);
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_ReceiveFilterSetFilterReqCallback
  * 
@@ -10803,9 +12094,12 @@
 void WDA_ReceiveFilterSetFilterReqCallback(WDI_Status status, void * pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    /*WDA_VOS_ASSERT(NULL != pWdaParams);*/
+
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10817,11 +12111,14 @@
    vos_mem_free(pWdaParams->wdaMsgParam) ;
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    //print a msg, nothing else to do
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
               "WDA_ReceiveFilterSetFilterReqCallback invoked " );
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessReceiveFilterSetFilterReq
  * Request to WDI to set Receive Filters
@@ -10836,8 +12133,10 @@
       (WDI_SetRcvPktFilterReqParamsType *)vos_mem_malloc(allocSize) ;
    tWDA_ReqParams *pWdaParams ;
    tANI_U8         i;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == pwdiSetRcvPktFilterReqParamsType) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10845,6 +12144,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -10854,15 +12154,11 @@
       vos_mem_free(pwdiSetRcvPktFilterReqParamsType);
       return VOS_STATUS_E_NOMEM;
    }
+
    pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.filterId = pRcvPktFilterCfg->filterId;
    pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.filterType = pRcvPktFilterCfg->filterType;   
    pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.numFieldParams = pRcvPktFilterCfg->numFieldParams;
    pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.coalesceTime = pRcvPktFilterCfg->coalesceTime;
-   vos_mem_copy(pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.selfMacAddr,
-                pRcvPktFilterCfg->selfMacAddr, sizeof(wpt_macAddr));
-
-   vos_mem_copy(pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.bssId,
-                      pRcvPktFilterCfg->bssId, sizeof(wpt_macAddr));
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
               "FID %d FT %d NParams %d CT %d",
@@ -10870,23 +12166,27 @@
               pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.filterType,
               pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.numFieldParams, 
               pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.coalesceTime);
+
    for ( i = 0; i < pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.numFieldParams; i++ )
    {
      wpalMemoryCopy(&pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.paramsData[i],
                     &pRcvPktFilterCfg->paramsData[i],
                     sizeof(pwdiSetRcvPktFilterReqParamsType->wdiPktFilterCfg.paramsData[i]));
+
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, 
                  "Proto %d Comp Flag %d \n",
                  pwdiSetRcvPktFilterReqParamsType->
                          wdiPktFilterCfg.paramsData[i].protocolLayer, 
                  pwdiSetRcvPktFilterReqParamsType->
                          wdiPktFilterCfg.paramsData[i].cmpFlag);
+
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, 
                  "Data Offset %d Data Len %d\n",
                  pwdiSetRcvPktFilterReqParamsType->
                          wdiPktFilterCfg.paramsData[i].dataOffset, 
                  pwdiSetRcvPktFilterReqParamsType->
                          wdiPktFilterCfg.paramsData[i].dataLength);
+
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, 
                  "CData: %d:%d:%d:%d:%d:%d\n",
                  pwdiSetRcvPktFilterReqParamsType->
@@ -10901,6 +12201,7 @@
                          wdiPktFilterCfg.paramsData[i].compareData[4], 
                  pwdiSetRcvPktFilterReqParamsType->
                          wdiPktFilterCfg.paramsData[i].compareData[5]);
+
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO, 
                  "MData: %d:%d:%d:%d:%d:%d\n",
                  pwdiSetRcvPktFilterReqParamsType->
@@ -10915,16 +12216,21 @@
                          wdiPktFilterCfg.paramsData[i].dataMask[4], 
                  pwdiSetRcvPktFilterReqParamsType->
                          wdiPktFilterCfg.paramsData[i].dataMask[5]);
+
    }
+
    pwdiSetRcvPktFilterReqParamsType->wdiReqStatusCB = NULL;
+
    /* Store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)pwdiSetRcvPktFilterReqParamsType;
    pWdaParams->pWdaContext = pWDA;
    /* Store param pointer as passed in by caller */
    pWdaParams->wdaMsgParam = pRcvPktFilterCfg;
+
    status = WDI_ReceiveFilterSetFilterReq(pwdiSetRcvPktFilterReqParamsType,
            (WDI_ReceiveFilterSetFilterCb)WDA_ReceiveFilterSetFilterReqCallback,
            pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -10933,8 +12239,10 @@
       vos_mem_free(pWdaParams->wdaMsgParam);
       vos_mem_free(pWdaParams);
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_FilterMatchCountReqCallback
  * 
@@ -10951,27 +12259,20 @@
 
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
    /*WDA_VOS_ASSERT(NULL != pWdaParams);*/
 
-   if(NULL == pRcvFltPktMatchCntRsp)
-   {
-      VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
-                 "%s: pRcvFltPktMatchCntRsp is NULL", __FUNCTION__);
-      VOS_ASSERT(0) ;
-	  vos_mem_free(pWdaParams);
-      return ;
-   }
-   
    if(NULL == pWdaParams)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                  "%s: pWdaParams received NULL", __FUNCTION__);
       VOS_ASSERT(0) ;
-	  vos_mem_free(pRcvFltPktMatchCntRsp);
       return ;
    }
+
    pWDA = (tWDA_CbContext *)pWdaParams->pWdaContext ;
    pRcvFltPktMatchCntReq = (tpSirRcvFltPktMatchRsp)pWdaParams->wdaMsgParam;
+
    // Fill pRcvFltPktMatchCntRsp from pRcvFltPktMatchCntReq
    vos_mem_zero(pRcvFltPktMatchCntRsp,sizeof(tSirRcvFltPktMatchRsp));
 
@@ -10986,6 +12287,7 @@
       pRcvFltPktMatchCntRsp->filterMatchCnt[i].filterId = pRcvFltPktMatchCntReq->filterMatchCnt[i].filterId;
       pRcvFltPktMatchCntRsp->filterMatchCnt[i].matchCnt = pRcvFltPktMatchCntReq->filterMatchCnt[i].matchCnt;
    }
+
    /* VOS message wrapper */
    vosMsg.type = eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP;
    vosMsg.bodyptr = (void *)pRcvFltPktMatchCntRsp;
@@ -11000,6 +12302,7 @@
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
 }
+
 /*
  * FUNCTION: WDA_ProcessPacketFilterMatchCountReq
  * Request to WDI to get PC Filter Match Count
@@ -11010,8 +12313,10 @@
    WDI_RcvFltPktMatchCntReqParamsType *pwdiRcvFltPktMatchCntReqParamsType = 
       (WDI_RcvFltPktMatchCntReqParamsType *)vos_mem_malloc(sizeof(WDI_RcvFltPktMatchCntReqParamsType));
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == pwdiRcvFltPktMatchCntReqParamsType) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -11019,6 +12324,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -11028,6 +12334,7 @@
       vos_mem_free(pwdiRcvFltPktMatchCntReqParamsType);
       return VOS_STATUS_E_NOMEM;
    }
+
    if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -11037,16 +12344,20 @@
       vos_mem_free(pWdaParams);
       return VOS_STATUS_E_FAILURE;
    }
+
    pwdiRcvFltPktMatchCntReqParamsType->wdiReqStatusCB = NULL;
 
+
    /* Store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)pwdiRcvFltPktMatchCntReqParamsType;
    pWdaParams->pWdaContext = pWDA;
    /* Store param pointer as passed in by caller */
    pWdaParams->wdaMsgParam = pRcvFltPktMatchRsp;
+
    status = WDI_FilterMatchCountReq(pwdiRcvFltPktMatchCntReqParamsType, 
                  (WDI_FilterMatchCountCb)WDA_FilterMatchCountReqCallback,
                  pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       /* failure returned by WDI API */
@@ -11057,8 +12368,10 @@
       pRcvFltPktMatchRsp->status = eSIR_FAILURE ;
       WDA_SendMsg(pWDA, WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP, (void *)pRcvFltPktMatchRsp, 0) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
+
 /*
  * FUNCTION: WDA_ReceiveFilterSetFilterReqCallback
  * 
@@ -11066,8 +12379,10 @@
 void WDA_ReceiveFilterClearFilterReqCallback(WDI_Status status, void * pUserData)
 {
    tWDA_ReqParams *pWdaParams = (tWDA_ReqParams *)pUserData;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "<------ %s " ,__FUNCTION__);
+
 /*   WDA_VOS_ASSERT(NULL != pWdaParams); */
    if(NULL == pWdaParams)
    {
@@ -11080,11 +12395,14 @@
    vos_mem_free(pWdaParams->wdaMsgParam) ;
    vos_mem_free(pWdaParams->wdaWdiApiMsgParam);
    vos_mem_free(pWdaParams) ;
+
    //print a msg, nothing else to do
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
               "WDA_ReceiveFilterClearFilterReqCallback invoked " );
+
    return ;
 }
+
 /*
  * FUNCTION: WDA_ProcessReceiveFilterClearFilterReq
  * Request to WDI to clear Receive Filters
@@ -11096,8 +12414,10 @@
    WDI_RcvFltPktClearReqParamsType *pwdiRcvFltPktClearReqParamsType =
       (WDI_RcvFltPktClearReqParamsType *)vos_mem_malloc(sizeof(WDI_RcvFltPktClearReqParamsType));
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == pwdiRcvFltPktClearReqParamsType)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -11105,6 +12425,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -11114,32 +12435,34 @@
       vos_mem_free(pwdiRcvFltPktClearReqParamsType);
       return VOS_STATUS_E_NOMEM;
    }
+
    pwdiRcvFltPktClearReqParamsType->filterClearParam.status = pRcvFltPktClearParam->status;
    pwdiRcvFltPktClearReqParamsType->filterClearParam.filterId = pRcvFltPktClearParam->filterId;
-   vos_mem_copy(pwdiRcvFltPktClearReqParamsType->filterClearParam.selfMacAddr,
-                     pRcvFltPktClearParam->selfMacAddr, sizeof(wpt_macAddr));
-   vos_mem_copy(pwdiRcvFltPktClearReqParamsType->filterClearParam.bssId,
-                         pRcvFltPktClearParam->bssId, sizeof(wpt_macAddr));
 
    pwdiRcvFltPktClearReqParamsType->wdiReqStatusCB = NULL;
+
    /* Store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)pwdiRcvFltPktClearReqParamsType;
    pWdaParams->pWdaContext = pWDA;
    /* Store param pointer as passed in by caller */
    pWdaParams->wdaMsgParam = pRcvFltPktClearParam;
+
    status = WDI_ReceiveFilterClearFilterReq(pwdiRcvFltPktClearReqParamsType,
        (WDI_ReceiveFilterClearFilterCb)WDA_ReceiveFilterClearFilterReqCallback,
        pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
               "Failure in WDA_ProcessReceiveFilterClearFilterReq(), free all the memory " );
       vos_mem_free(pWdaParams->wdaWdiApiMsgParam) ;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
 #endif // WLAN_FEATURE_PACKET_FILTERING
 
+
 /*
  * FUNCTION: WDA_ProcessSetPowerParamsReq
  * Request to WDI to set power params 
@@ -11150,9 +12473,12 @@
    WDI_Status status;
    WDI_SetPowerParamsReqParamsType *pwdiSetPowerParamsReqInfo = 
       (WDI_SetPowerParamsReqParamsType *)vos_mem_malloc(sizeof(WDI_SetPowerParamsReqParamsType)) ;
+
    tWDA_ReqParams *pWdaParams ;
+
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if(NULL == pwdiSetPowerParamsReqInfo) 
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -11160,6 +12486,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_NOMEM;
    }
+
    pWdaParams = (tWDA_ReqParams *)vos_mem_malloc(sizeof(tWDA_ReqParams)) ;
    if(NULL == pWdaParams)
    {
@@ -11169,12 +12496,14 @@
       vos_mem_free(pwdiSetPowerParamsReqInfo);
       return VOS_STATUS_E_NOMEM;
    }
-   
+
    
    pwdiSetPowerParamsReqInfo->wdiSetPowerParamsInfo.uIgnoreDTIM       = 
       pPowerParams->uIgnoreDTIM;
+
    pwdiSetPowerParamsReqInfo->wdiSetPowerParamsInfo.uDTIMPeriod       = 
       pPowerParams->uDTIMPeriod;
+
    pwdiSetPowerParamsReqInfo->wdiSetPowerParamsInfo.uListenInterval   = 
       pPowerParams->uListenInterval;
    pwdiSetPowerParamsReqInfo->wdiSetPowerParamsInfo.uBcastMcastFilter = 
@@ -11183,7 +12512,9 @@
       pPowerParams->uEnableBET;
    pwdiSetPowerParamsReqInfo->wdiSetPowerParamsInfo.uBETInterval      = 
       pPowerParams->uBETInterval; 
+
    pwdiSetPowerParamsReqInfo->wdiReqStatusCB = NULL;
+
    if((NULL != pWDA->wdaMsgParam) || (NULL != pWDA->wdaWdiApiMsgParam))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -11193,14 +12524,17 @@
       vos_mem_free(pWdaParams);
       return VOS_STATUS_E_FAILURE;
    }
+
    /* Store Params pass it to WDI */
    pWdaParams->wdaWdiApiMsgParam = (void *)pwdiSetPowerParamsReqInfo;
    pWdaParams->pWdaContext = pWDA;
    /* Store param pointer as passed in by caller */
    pWdaParams->wdaMsgParam = pPowerParams;
+
    status = WDI_SetPowerParamsReq( pwdiSetPowerParamsReqInfo, 
                                  (WDI_SetPowerParamsCb)WDA_SetPowerParamsCallback, 
                                  pWdaParams);
+
    if(IS_WDI_STATUS_FAILURE(status))
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -11210,6 +12544,7 @@
       pWdaParams->wdaWdiApiMsgParam = NULL;
       pWdaParams->wdaMsgParam = NULL;
    }
+
    return CONVERT_WDI2VOS_STATUS(status) ;
 }
 
@@ -11307,12 +12642,14 @@
    
    VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
                                           "------> %s " ,__FUNCTION__);
+
    if( pTxCtrlParam == NULL )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
                            "%s: Input tpTxControlParams is NULL", __FUNCTION__); 
       return VOS_STATUS_E_FAILURE;
    }
+
    if( pTxCtrlParam->stopTx == eANI_BOOLEAN_TRUE )
    {
       wdaStatus = WDA_SuspendDataTx(pWDA);
@@ -11321,6 +12658,7 @@
    {
       wdaStatus = WDA_ResumeDataTx(pWDA);
    }
+
    return wdaStatus;
 }
 
@@ -11369,6 +12707,7 @@
    //tANI_U8    eventIdx = 0;
    VOS_STATUS status = VOS_STATUS_SUCCESS;
    tWDA_CbContext *pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
+
    if (NULL == pWDA)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -11376,6 +12715,7 @@
       VOS_ASSERT(0);
       return VOS_STATUS_E_FAILURE;
    }
+
    /* FTM mode stay START_STATE */
    if( (WDA_READY_STATE != pWDA->wdaState) &&
          (WDA_INIT_STATE != pWDA->wdaState) &&
@@ -11383,6 +12723,7 @@
    {
       VOS_ASSERT(0);
    }
+
    if(NULL != pWDA->wdaWdiApiMsgParam)
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -11392,13 +12733,16 @@
        * initiated by WLAN driver (WDI timeout) */
       vos_mem_free(pWDA->wdaWdiApiMsgParam);
    }
+
    if ( eDRIVER_TYPE_MFG != pWDA->driverMode )
    {
       wdaDestroyTimers(pWDA);
    }
    pWDA->wdaWdiApiMsgParam = NULL;
+
    /* call WDI shutdown */
    wdiStatus = WDI_Shutdown(closeTransport);
+
    if (IS_WDI_STATUS_FAILURE(wdiStatus) )
    {
       VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR,
@@ -11408,6 +12752,7 @@
    /* WDI stop is synchrnous, shutdown is complete when it returns */
    pWDA->wdaState = WDA_STOP_STATE;
 
+
    /* shutdown should perform the stop & close actions. */
    /* Destroy the event */
    status = vos_event_destroy(&pWDA->txFrameEvent);
@@ -11431,6 +12776,7 @@
                   "VOS Event destroy failed - status = %d\n", status);
       status = VOS_STATUS_E_FAILURE;
    }
+
    /* free WDA context */
    status = vos_free_context(pVosContext,VOS_MODULE_ID_WDA,pWDA);
    if ( !VOS_IS_STATUS_SUCCESS(status) )
@@ -11439,55 +12785,6 @@
                                   "error in WDA close " );
       status = VOS_STATUS_E_FAILURE;
    }
+
    return status;
 }
-/*
- * FUNCTION: WDA_stopFailed
- * WDA stop failed
- */
-
-void WDA_stopFailed(v_PVOID_t pVosContext)
-{
-   tWDA_CbContext *pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
-   pWDA->needShutdown  = TRUE;
-}
-/*
- * FUNCTION: WDA_needShutdown
- * WDA needs a shutdown
- */
-
-v_BOOL_t WDA_needShutdown(v_PVOID_t pVosContext)
-{
-   tWDA_CbContext *pWDA = (tWDA_CbContext *)VOS_GET_WDA_CTXT(pVosContext);
-   return pWDA->needShutdown;   
-}
-
-
-
-/*==========================================================================
-  FUNCTION   WDA_TransportChannelDebug
-
-  DESCRIPTION 
-    Display Transport Channel debugging information
-    User may request to display DXE channel snapshot
-    Or if host driver detects any abnormal stcuk may display
-
-  PARAMETERS
-    displaySnapshot : Dispaly DXE snapshot option
-    enableStallDetect : Enable stall detect feature
-                        This feature will take effect to data performance
-                        Not integrate till fully verification
-
-  RETURN VALUE
-    NONE
-
-===========================================================================*/
-void WDA_TransportChannelDebug
-(
-   v_BOOL_t   displaySnapshot,
-   v_BOOL_t   toggleStallDetect
-)
-{
-   WDI_TransportChannelDebug(displaySnapshot, toggleStallDetect);
-   return;
-}
diff --git a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_debug.c b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_debug.c
index de89f97..13a266e 100644
--- a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_debug.c
+++ b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_debug.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_debug.h b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_debug.h
index 66e367e..0eb74c9 100644
--- a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_debug.h
+++ b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_debug.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_ds.c b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_ds.c
index 034ed2d..9d638cd 100644
--- a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_ds.c
+++ b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_ds.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1357,7 +1357,7 @@
     {
       VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                    "WDA : Pushing a packet to WDI failed.");
-      VOS_ASSERT( wdiStatus != WDI_STATUS_E_NOT_ALLOWED );
+      VOS_ASSERT( 0 );
       //We need to free the packet here
       vos_pkt_get_user_data_ptr(pTxPacket, VOS_PKT_USER_DATA_ID_TL, (void **)&pfnTxComp);
       if(pfnTxComp)
@@ -1412,7 +1412,11 @@
     {
       VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
                    "WDA : Pushing a packet to WDI failed.");
-      VOS_ASSERT( wdiStatus != WDI_STATUS_E_NOT_ALLOWED );
+      /* TODO Wd should return this packet to VOSS. Otherwise
+         UMAC is going in low resource condition.
+         Who needs to do it? DXE, WDI? 
+         */
+      VOS_ASSERT( 0 );
       //We need to free the packet here
       vos_pkt_get_user_data_ptr(pTxPacket, VOS_PKT_USER_DATA_ID_TL, (void **)&pfnTxComp);
       if(pfnTxComp)
diff --git a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_legacy.c b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_legacy.c
index 92ad5f0..eb585c2 100644
--- a/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_legacy.c
+++ b/drivers/staging/prima/CORE/WDA/src/wlan_qct_wda_legacy.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_defs.h b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_defs.h
index f0350d8..f5cdb4b 100644
--- a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_defs.h
+++ b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_defs.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h
index 61168aa..064b52ac 100644
--- a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h
+++ b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -177,17 +177,7 @@
 {
   WDI_SECONDARY_CHANNEL_OFFSET_NONE   = 0,
   WDI_SECONDARY_CHANNEL_OFFSET_UP     = 1,
-  WDI_SECONDARY_CHANNEL_OFFSET_DOWN   = 3,
-#ifdef WLAN_FEATURE_11AC
-  WDI_CHANNEL_20MHZ_LOW_40MHZ_CENTERED = 4, //20/40MHZ offset LOW 40/80MHZ offset CENTERED
-  WDI_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED = 5, //20/40MHZ offset CENTERED 40/80MHZ offset CENTERED
-  WDI_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED = 6, //20/40MHZ offset HIGH 40/80MHZ offset CENTERED
-  WDI_CHANNEL_20MHZ_LOW_40MHZ_LOW = 7,//20/40MHZ offset LOW 40/80MHZ offset LOW
-  WDI_CHANNEL_20MHZ_HIGH_40MHZ_LOW = 8, //20/40MHZ offset HIGH 40/80MHZ offset LOW
-  WDI_CHANNEL_20MHZ_LOW_40MHZ_HIGH = 9, //20/40MHZ offset LOW 40/80MHZ offset HIGH
-  WDI_CHANNEL_20MHZ_HIGH_40MHZ_HIGH = 10,//20/40MHZ offset-HIGH 40/80MHZ offset HIGH
-#endif
-  WDI_SECONDARY_CHANNEL_OFFSET_MAX
+  WDI_SECONDARY_CHANNEL_OFFSET_DOWN   = 3
 }WDI_HTSecondaryChannelOffset;
 
 /*---------------------------------------------------------------------------
@@ -762,10 +752,7 @@
   WDI_SCAN_MODE_LEARN,
   WDI_SCAN_MODE_SCAN,
   WDI_SCAN_MODE_PROMISC,
-  WDI_SCAN_MODE_SUSPEND_LINK,
-  WDI_SCAN_MODE_ROAM_SCAN,
-  WDI_SCAN_MODE_ROAM_SUSPEND_LINK,
-
+  WDI_SCAN_MODE_SUSPEND_LINK
 } WDI_ScanMode;
 
 /*---------------------------------------------------------------------------
@@ -896,17 +883,7 @@
   WDI_PHY_SINGLE_CHANNEL_CENTERED = 0,            
   WDI_PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1,     
   WDI_PHY_DOUBLE_CHANNEL_CENTERED = 2,            
-  WDI_PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3,
-#ifdef WLAN_FEATURE_11AC
-  WDI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED = 4, //20/40MHZ offset LOW 40/80MHZ offset CENTERED
-  WDI_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED = 5, //20/40MHZ offset CENTERED 40/80MHZ offset CENTERED
-  WDI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED = 6, //20/40MHZ offset HIGH 40/80MHZ offset CENTERED
-  WDI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW = 7,//20/40MHZ offset LOW 40/80MHZ offset LOW
-  WDI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW = 8, //20/40MHZ offset HIGH 40/80MHZ offset LOW
-  WDI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH = 9, //20/40MHZ offset LOW 40/80MHZ offset HIGH
-  WDI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH = 10,//20/40MHZ offset-HIGH 40/80MHZ offset HIGH
-#endif
-  WDI_MAX_CB_STATE
+  WDI_PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3     
 } WDI_PhyChanBondState;
 
 /*---------------------------------------------------------------------------
@@ -1174,20 +1151,6 @@
      */
     wpt_uint16         aRxHighestDataRate;
 
-   
-#ifdef WLAN_FEATURE_11AC
-   /*Indicates the Maximum MCS that can be received for each number
-        of spacial streams */
-    wpt_uint16         vhtRxMCSMap;
-  /*Indicate the highest VHT data rate that the STA is able to receive*/
-    wpt_uint16         vhtRxHighestDataRate;
-  /*Indicates the Maximum MCS that can be transmitted  for each number
-       of spacial streams */
-    wpt_uint16         vhtTxMCSMap;
-  /*Indicate the highest VHT data rate that the STA is able to transmit*/
-    wpt_uint16         vhtTxHighestDataRate;
-#endif
-
 } WDI_SupportedRates;
 
 /*-------------------------------------------------------------------------- 
@@ -1300,10 +1263,6 @@
   wpt_uint8                 ucDsssCckMode40Mhz;
 
   wpt_uint8                 ucP2pCapableSta;
-#ifdef WLAN_FEATURE_11AC
-  wpt_uint8                 ucVhtCapableSta;
-  wpt_uint8                 ucVhtTxChannelWidthSet;
-#endif
 }WDI_ConfigStaReqInfoType;
 
 
@@ -1837,11 +1796,6 @@
   WDI_SetSTAKeyReqInfoType  wdiExtSetKeyParam;
 #endif
 
-#ifdef WLAN_FEATURE_11AC
-  wpt_uint8                 ucVhtCapableSta;
-  wpt_uint8                 ucVhtTxChannelWidthSet;
-#endif
-
 }WDI_ConfigBSSReqInfoType;
 
 /*---------------------------------------------------------------------------
@@ -3078,7 +3032,6 @@
 typedef struct
 {
    wpt_uint8     ucSendDataNull;
-   wpt_uint8     bssIdx;
 }WDI_ExitBmpsReqinfoType;
 
 /*---------------------------------------------------------------------------
@@ -3112,7 +3065,6 @@
    wpt_uint8     ucBeTriggerEnabled:1;
    wpt_uint8     ucViTriggerEnabled:1;
    wpt_uint8     ucVoTriggerEnabled:1;
-   wpt_uint8     bssIdx;
 }WDI_EnterUapsdReqinfoType;
 
 /*---------------------------------------------------------------------------
@@ -3297,7 +3249,6 @@
    wpt_uint8 srcIPv6AddrValid : 1;
    wpt_uint8 targetIPv6Addr1Valid : 1;
    wpt_uint8 targetIPv6Addr2Valid : 1;
-   wpt_uint8 bssIdx;
 } WDI_NSOffloadParams;
 #endif //WLAN_NS_OFFLOAD
 
@@ -3305,7 +3256,6 @@
 {
    wpt_uint8 ucOffloadType;
    wpt_uint8 ucEnableOrDisable;
-   wpt_uint8 bssIdx;
    union
    {
        wpt_uint8 aHostIpv4Addr [4];
@@ -3344,7 +3294,6 @@
     wpt_uint8  aHostIpv4Addr[4];
     wpt_uint8  aDestIpv4Addr[4];
     wpt_uint8  aDestMacAddr[6];
-    wpt_uint8  bssIdx;
 } WDI_KeepAliveReqType;
 
 /*---------------------------------------------------------------------------
@@ -3380,7 +3329,6 @@
    wpt_uint8  ucPatternMask[WDI_WOWL_BCAST_PATTERN_MAX_SIZE]; // Pattern mask
    wpt_uint8  ucPatternExt[WDI_WOWL_BCAST_PATTERN_MAX_SIZE]; // Extra pattern
    wpt_uint8  ucPatternMaskExt[WDI_WOWL_BCAST_PATTERN_MAX_SIZE]; // Extra pattern mask
-   wpt_uint8  bssIdx;
 } WDI_WowlAddBcPtrnInfoType;
 
 /*---------------------------------------------------------------------------
@@ -4263,8 +4211,6 @@
   wpt_uint32                      numFieldParams;
   wpt_uint32                      coalesceTime;
   WDI_RcvPktFilterFieldParams     paramsData[1];
-  wpt_macAddr                     selfMacAddr;
-  wpt_macAddr                     bssId;
 }WDI_RcvPktFilterCfgType;
 
 typedef struct 
@@ -4340,8 +4286,6 @@
 {
   wpt_uint32   status;  /* only valid for response message */
   wpt_uint8    filterId;
-  wpt_macAddr  selfMacAddr;
-  wpt_macAddr  bssId;
 }WDI_RcvFltPktClearParam;
 
 typedef struct
@@ -4364,8 +4308,6 @@
 {
   wpt_uint32     ulMulticastAddrCnt;
   wpt_macAddr    multicastAddr[WDI_MAX_NUM_MULTICAST_ADDRESS];
-  wpt_macAddr    selfMacAddr;
-  wpt_macAddr    bssId;
 } WDI_RcvFltMcAddrListType;
 
 typedef struct
@@ -8793,8 +8735,8 @@
  
  @param 
   
-        feat_enum_value: enum value for the feature as in placeHolderInCapBitmap 
-        in wlan_hal_msg.h.
+        feat_enum_value: enum value for the feature as in placeHolderInCapBitmap
+                                    in wlan_hal_msg.h.
 
  @see
  @return 
@@ -8819,26 +8761,6 @@
 
 
 
-
-/**
- @brief WDI_TransportChannelDebug -
-    Display DXE Channel debugging information
-    User may request to display DXE channel snapshot
-    Or if host driver detects any abnormal stcuk may display
-        
- @param  displaySnapshot : Dispaly DXE snapshot option
- @param  enableStallDetect : Enable stall detect feature
-                        This feature will take effect to data performance
-                        Not integrate till fully verification
- @see
- @return none
-*/
-void WDI_TransportChannelDebug
-(
-   wpt_boolean  displaySnapshot,
-   wpt_boolean  toggleStallDetect
-);
-
 #ifdef __cplusplus
  }
 #endif 
diff --git a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_bd.h b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_bd.h
index 4391f3f..8c91bb6 100644
--- a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_bd.h
+++ b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_bd.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -94,32 +94,13 @@
         /** This bit filled by rxp when set indicates if the current tsf is smaller
         than received tsf */
         wpt_uint32 rtsf:1;
-
-#ifdef WCN_PRONTO_CSU
-        /** No valid header found during parsing. Therefore no checksum was validated */
-        wpt_uint32 csuNoValHd:1;
-
-        /** 0 = CSU did not verify TCP/UDP (Transport Layer TL) checksum; 1 = CSU verified TCP/UDP checksum */
-        wpt_uint32 csuVerifiedTLChksum:1;
-
-        /** 0 = CSU did not verify IP checksum; 1 = CSU verified IP checksum */
-        wpt_uint32 csuVerifiedIPChksum:1;
-
-        /** 0 = BD field checksum is not valid; 1 = BD field checksum is valid */
-        wpt_uint32 csuChksumValid:1;
-
-        /** 0 = No TCP/UDP checksum error; 1 = Has TCP/UDP checksum error */
-        wpt_uint32 csuTLChksumError:1;
-
-        /** 0 = No IPv4/IPv6 checksum error; 1 = Has IPv4/IPv6 checksum error */
-        wpt_uint32 csuIPChksumError:1;
-#else /*WCN_PRONTO*/
+    
         /** These two fields are used by SW to carry the Rx Channel number and SCAN bit in RxBD*/
         wpt_uint32 rxChannel:4;
         wpt_uint32 scanLearn:1;
-        wpt_uint32 reserved0:1;
-#endif /*WCN_PRONTO*/
 
+        wpt_uint32 reserved0:1;
+    
         /** LLC Removed
         This bit is only used in Libra rsvd for Virgo1.0/Virgo2.0
         Filled by ADU when it is set LLC is removed from packet */
@@ -186,22 +167,11 @@
         wpt_uint32 rxKeyId:3;
         wpt_uint32 ub:1;
         wpt_uint32 rmf:1;
-        wpt_uint32 umaByPass:1;
-        wpt_uint32 llcr:1;
-
-#ifdef WCN_PRONTO_CSU
-        wpt_uint32 csuIPChksumError:1;
-        wpt_uint32 csuTLChksumError:1;
-        wpt_uint32 csuChksumValid:1;
-        wpt_uint32 csuVerifiedIPChksum:1;
-        wpt_uint32 csuVerifiedTLChksum:1;
-        wpt_uint32 csuNoValHd:1;
-#else /*WCN_PRONTO*/
+        wpt_uint32 reserved1:1;
+        wpt_uint32 llc:1;
         wpt_uint32 reserved0:1;
         wpt_uint32 scanLearn:1;
         wpt_uint32 rxChannel:4;
-#endif /*WCN_PRONTO*/
-
         wpt_uint32 rtsf:1;
         wpt_uint32 bsf:1;
         wpt_uint32 A2HF:1;
@@ -218,24 +188,14 @@
         Used in ADU (for AMSDU deaggregation) */
         wpt_uint32 penultimatePduIdx:16;
     
-#ifdef WCN_PRONTO 
-        wpt_uint32 aduFeedback:7;
-        wpt_uint32 dpuMagicPacket: 1; 
-#else
         wpt_uint32 aduFeedback:8;
-#endif //WCN_PRONTO
     
         /** DPU feedback */
         wpt_uint32 dpuFeedback:8;
         
 #else
         wpt_uint32 dpuFeedback:8;
-#ifdef WCN_PRONTO 
-        wpt_uint32 dpuMagicPacket: 1; 
-        wpt_uint32 aduFeedback:7;
-#else
         wpt_uint32 aduFeedback:8;
-#endif //WCN_PRONTO
         wpt_uint32 penultimatePduIdx:16;
 #endif
     
@@ -294,13 +254,7 @@
         (header and data). Note that the length does not include FCS field. */
         wpt_uint32 mpduLength:16;
     
-#ifdef WCN_PRONTO
-        wpt_uint32 reserved3: 3;
-        wpt_uint32 rxDXEPriorityRouting:1; 
-#else
         wpt_uint32 reserved3:4;
-#endif //WCN_PRONTO
-    
     
         /** Traffic Identifier
         Indicates the traffic class the frame belongs to. For non QoS frames,
@@ -311,13 +265,7 @@
 #else
         wpt_uint32 reserved4:8;
         wpt_uint32 tid:4;
-#ifdef WCN_PRONTO
-        wpt_uint32 rxDXEPriorityRouting:1; 
-        wpt_uint32 reserved3: 3;
-#else
         wpt_uint32 reserved3:4;
-#endif //WCN_PRONTO
-    
         wpt_uint32 mpduLength:16;
 #endif
     
@@ -381,22 +329,9 @@
         wpt_uint32 pmiCmd4to23[5];               /* PMI cmd rcvd from RxP */
     
         /* 0x3c */
-#ifdef WCN_PRONTO
-#ifdef WPT_BIG_BYTE_ENDIAN
-        /** The bits from the PMI command as received from the PHY RX. */
-        wpt_uint32 pmiCmd24to25:16;
-
-        /* 16-bit CSU Checksum value for the fragmented receive frames */
-        wpt_uint32 csuChecksum:16;
-#else
-        wpt_uint32 csuChecksum:16;
-        wpt_uint32 pmiCmd24to25:16;
-#endif
-#else /*WCN_PRONTO*/
         /** The bits from the PMI command as received from the PHY RX. */
         wpt_uint32 pmiCmd24to25;
-#endif /*WCN_PRONTO*/
-
+    
         /* 0x40 */
 #ifdef WPT_BIG_BYTE_ENDIAN
     
@@ -417,23 +352,9 @@
         applied to AMPDU packets. */
         wpt_uint32 reorderSlotIdx:6;
         
-#ifdef WCN_PRONTO
-        wpt_uint32 reserved7: 2;
-        wpt_uint32 outOfOrderForward: 1;
-        wpt_uint32 reorderEnable: 1;
+        wpt_uint32 reserved7:4;
 #else
         wpt_uint32 reserved7:4;
-#endif //WCN_PRONTO
-
-#else
-
-#ifdef WCN_PRONTO
-        wpt_uint32 reorderEnable: 1;
-        wpt_uint32 outOfOrderForward: 1;
-        wpt_uint32 reserved7: 2;
-#else
-        wpt_uint32 reserved7:4;
-#endif //WCN_PRONTO
         wpt_uint32 reorderSlotIdx:6;
         wpt_uint32 reorderFwdIdx:6;
         wpt_uint32 reserved6:12;
@@ -815,65 +736,9 @@
     
         /** DPU signature. Filled by Host in Virgo 1.0 but by ADU in Virgo 2.0 */
         wpt_uint32 dpuSignature:3;
-
-#ifdef WCN_PRONTO        
-        /** Reserved  */
-        wpt_uint32 reserved0:2;
-
-         /** Set to '1' to terminate the current AMPDU session. Added based on the 
-        request for WiFi Display */
-        wpt_uint32 terminateAMPDU:1;
-
-       /** Bssid index to indicate ADU to use which of the 4 default MAC address 
-        to use while 802.3 to 802.11 translation in case search in ADU UMA table 
-        fails. The default MAC address should be appropriately programmed in the 
-        uma_tx_default_wmacaddr_u(_1,_2,_3) and uma_tx_default_wmacaddr_l(_1,_2,_3)
-         registers */
-        wpt_uint32 umaBssidIdx:2;
-
-        /** Set to 1 to enable uma filling the BD when FT is not enabled.
-        Ignored when FT is enabled. */
-        wpt_uint32 umaBDEnable:1;
-
-        /** (Only used by the CSU)
-        0: No action
-        1: Host will indicate TCP/UPD header start location and provide pseudo header value in BD.
-        */
-        wpt_uint32 csuSWMode:1;
-
-        /** Enable/Disable CSU on TX direction.
-        0: Disable Checksum Unit (CSU) for Transmit.
-        1: Enable 
-        */
-        wpt_uint32 csuTXEnable:1;
-
-        /** Enable/Disable Transport layer Checksum in CSU
-        0: Disable TCP UDP checksum generation for TX.
-        1: Enable TCP UDP checksum generation for TX.
-        */
-        wpt_uint32 csuEnableTLCksum:1;
-
-        /** Enable/Disable IP layer Checksum in CSU
-        0: Disable IPv4/IPv6 checksum generation for TX
-        1: Enable  IPv4/IPv6 checksum generation for TX
-        */
-        wpt_uint32 csuEnableIPCksum:1;
-
-        /** Filled by CSU to indicate whether transport layer Checksum is generated by CSU or not
-        0: TCP/UDP checksum is being generated for TX.
-        1: TCP/UDP checksum is NOT being generated for TX.
-         */
-        wpt_uint32 csuTLCksumGenerated:1;
-
-        /** Filled by CSU in error scenario
-        1: No valid header found during parsing. Therefore no checksum was validated.
-        0: Valid header found
-        */
-        wpt_uint32 csuNoValidHeader:1;
-#else /*WCN_PRONTO*/
+    
         wpt_uint32 reserved0:12;
-#endif /*WCN_PRONTO*/
-
+    
         /** Only available in Virgo 2.0 and reserved in Virgo 1.0.
         This bit indicates to DPU that the packet is a robust management frame
         which requires  encryption(this bit is only valid for certain management
@@ -929,20 +794,7 @@
         wpt_uint32 reserved1:1;
         wpt_uint32 ub:1;
         wpt_uint32 rmf:1;
-#ifdef WCN_PRONTO        
-        wpt_uint32 csuNoValidHeader:1;
-        wpt_uint32 csuTLCksumGenerated:1;
-        wpt_uint32 csuEnableIPCksum:1;
-        wpt_uint32 csuEnableTLCksum:1;
-        wpt_uint32 csuTXEnable:1;
-        wpt_uint32 csuSWMode:1;
-        wpt_uint32 umaBDEnable:1;
-        wpt_uint32 umaBssidIdx:2;
-        wpt_uint32 terminateAMPDU:1;
-        wpt_uint32 reserved0:2;
-#else /*WCN_PRONTO*/
         wpt_uint32 reserved0:12;
-#endif /*WCN_PRONTO*/
         wpt_uint32 dpuSignature:3;
         wpt_uint32 dpuRF:8;
 #endif
@@ -1099,24 +951,6 @@
         /* Timestamp filled by DXE. Timestamp for previous transfer */
         wpt_uint32 dxeH2BEndTimestamp;
 
-#ifdef WCN_PRONTO
-#ifdef WPT_BIG_BYTE_ENDIAN
-        /** 10 bit value to indicate the start of TCP UDP frame relative to 
-         * the first IP frame header */
-        wpt_uint32 csuTcpUdpStartOffset:10;
-
-        /** 16 bit pseudo header for TCP UDP used by CSU to generate TCP/UDP 
-         * frame checksum */
-        wpt_uint32 csuPseudoHeaderCksum:16;
-
-        wpt_uint32 reserved7:6;
-#else
-        wpt_uint32 reserved7:6;
-        wpt_uint32 csuPseudoHeaderCksum:16;
-        wpt_uint32 csuTcpUdpStartOffset:10;
-#endif
-#endif /*WCN_PRONTO*/
-
 } WDI_TxBdType;
 
 /*---------------------------------------------------------------------------         
diff --git a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_cfg.h b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_cfg.h
index 3e901e6..252b111 100644
--- a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_cfg.h
+++ b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_cfg.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_dp.h b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_dp.h
index a19fe6e..3e0d851 100644
--- a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_dp.h
+++ b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_dp.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -244,7 +244,7 @@
 
 #define WDI_RX_BD_GET_NE( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->dpuNE)
 
-#define WDI_RX_BD_GET_LLCR( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->llcr)
+#define WDI_RX_BD_GET_LLCR( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->llc)
 
 #define WDI_RX_BD_GET_TIMESTAMP( _pvBDHeader )         (((WDI_RxBdType*)_pvBDHeader)->mclkRxTimestamp)
 
diff --git a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
index 268edd4..763aa1d 100644
--- a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
+++ b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_i.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -654,8 +654,8 @@
 
   WDI_TSM_STATS_RESP                            = 74,
   /* GTK Rekey Offload */
-  WDI_GTK_OFFLOAD_RESP                          = 75, 
-  WDI_GTK_OFFLOAD_GETINFO_RESP                  = 76, 
+  WDI_GTK_OFFLOAD_RESP                    = 75, 
+  WDI_GTK_OFFLOAD_GETINFO_RESP         = 76, 
 
   WDI_SET_TM_LEVEL_RESP                         = 77,
 
diff --git a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_sta.h b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_sta.h
index 604cd41..f0ea7c5 100644
--- a/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_sta.h
+++ b/drivers/staging/prima/CORE/WDI/CP/inc/wlan_qct_wdi_sta.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c b/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c
index 152b101..f1d334f 100644
--- a/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -25,10 +25,10 @@
 
   OVERVIEW:
 
-  This software unit holds the implementation of the WLAN Device Abstraction
+  This software unit holds the implementation of the WLAN Device Abstraction     
   Layer Interface.
 
-  The functions externalized by this module are to be called by any upper
+  The functions externalized by this module are to be called by any upper     
   MAC implementation that wishes to use the WLAN Device.
 
   DEPENDENCIES:
@@ -63,12 +63,12 @@
 /*----------------------------------------------------------------------------
  * Include Files
  * -------------------------------------------------------------------------*/
-#include "wlan_qct_wdi.h"
-#include "wlan_qct_wdi_i.h"
-#include "wlan_qct_wdi_sta.h"
-#include "wlan_qct_wdi_dp.h"
+#include "wlan_qct_wdi.h" 
+#include "wlan_qct_wdi_i.h" 
+#include "wlan_qct_wdi_sta.h" 
+#include "wlan_qct_wdi_dp.h" 
 
-#include "wlan_qct_wdi_cts.h"
+#include "wlan_qct_wdi_cts.h" 
 
 #include "wlan_qct_pal_api.h"
 #include "wlan_qct_pal_type.h"
@@ -78,7 +78,7 @@
 #include "wlan_qct_pal_trace.h"
 #include "wlan_qct_pal_packet.h"
 
-#include "wlan_qct_wdi_dts.h"
+#include "wlan_qct_wdi_dts.h" 
 
 #include "wlan_hal_msg.h"
 
@@ -87,13 +87,10 @@
 #endif /* ANI_MANF_DIAG */
 
 /*===========================================================================
-   WLAN DAL Control Path Internal Data Definitions and Declarations
+   WLAN DAL Control Path Internal Data Definitions and Declarations 
  ===========================================================================*/
 #define WDI_WCTS_ACTION_TIMEOUT       2000 /* in msec a very high upper limit */
 
-#define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
-#define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
-
 
 #ifdef FEATURE_WLAN_SCAN_PNO
 #define WDI_PNO_VERSION_MASK 0x8000
@@ -107,12 +104,12 @@
  * and other two places - wlan_hal_msg.h and halMsg.c (FW file)
  */
 static placeHolderInCapBitmap supportEnabledFeatures[] =
-   {MCC, P2P, DOT11AC, SLM_SESSIONIZATION};
+   {MCC, P2P};
 
-/*--------------------------------------------------------------------------
+/*-------------------------------------------------------------------------- 
    WLAN DAL  State Machine
  --------------------------------------------------------------------------*/
-WPT_STATIC const WDI_MainFsmEntryType wdiMainFSM[WDI_MAX_ST] =
+WPT_STATIC const WDI_MainFsmEntryType wdiMainFSM[WDI_MAX_ST] = 
 {
   /*WDI_INIT_ST*/
   {{
@@ -155,12 +152,12 @@
   }}
 };
 
-/*---------------------------------------------------------------------------
+/*--------------------------------------------------------------------------- 
   DAL Request Processing Array  - the functions in this table will only be
   called when the processing of the specific request is allowed by the
-  Main FSM
+  Main FSM 
  ---------------------------------------------------------------------------*/
-WDI_ReqProcFuncType  pfnReqProcTbl[WDI_MAX_UMAC_IND] =
+WDI_ReqProcFuncType  pfnReqProcTbl[WDI_MAX_UMAC_IND] = 
 {
   /*INIT*/
   WDI_ProcessStartReq,      /* WDI_START_REQ  */
@@ -252,15 +249,15 @@
 #else
   NULL,
 #endif /* ANI_MANF_DIAG */
-
+  
 #ifdef FEATURE_OEM_DATA_SUPPORT
   WDI_ProcessStartOemDataReq,     /*WDI_START_OEM_DATA_REQ*/
 #else
   NULL,
 #endif /*FEATURE_OEM_DATA_SUPPORT*/
   WDI_ProcessHostResumeReq,            /*WDI_HOST_RESUME_REQ*/
-
-  WDI_ProcessKeepAliveReq,       /* WDI_KEEP_ALIVE_REQ */
+  
+  WDI_ProcessKeepAliveReq,       /* WDI_KEEP_ALIVE_REQ */    
 
 #ifdef FEATURE_WLAN_SCAN_PNO
   WDI_ProcessSetPreferredNetworkReq,  /* WDI_SET_PREF_NETWORK_REQ */
@@ -273,23 +270,23 @@
 #endif /* FEATURE_WLAN_SCAN_PNO */
 
   WDI_ProcessSetTxPerTrackingReq,     /* WDI_SET_TX_PER_TRACKING_REQ  */
-
+  
 #ifdef WLAN_FEATURE_PACKET_FILTERING
   /* WDI_8023_MULTICAST_LIST_REQ */
-  WDI_Process8023MulticastListReq,
+  WDI_Process8023MulticastListReq,          
   /* WDI_RECEIVE_FILTER_SET_FILTER_REQ */
-  WDI_ProcessReceiveFilterSetFilterReq,
+  WDI_ProcessReceiveFilterSetFilterReq,     
   /* WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ */
-  WDI_ProcessFilterMatchCountReq,
+  WDI_ProcessFilterMatchCountReq,    
   /* WDI_RECEIVE_FILTER_CLEAR_FILTER_REQ */
-  WDI_ProcessReceiveFilterClearFilterReq,
+  WDI_ProcessReceiveFilterClearFilterReq,   
 #else
   NULL,
   NULL,
   NULL,
   NULL,
 #endif // WLAN_FEATURE_PACKET_FILTERING
-  WDI_ProcessInitScanReq,               /* WDI_INIT_SCAN_CON_REQ */
+  WDI_ProcessInitScanReq,               /* WDI_INIT_SCAN_CON_REQ */ 
   WDI_ProcessHALDumpCmdReq,             /*WDI_HAL_DUMP_CMD_REQ */
   WDI_ProcessShutdownReq,               /* WDI_SHUTDOWN_REQ  */
 
@@ -317,12 +314,12 @@
 };
 
 
-/*---------------------------------------------------------------------------
+/*--------------------------------------------------------------------------- 
   DAL Request Processing Array  - the functions in this table will only be
   called when the processing of the specific request is allowed by the
-  Main FSM
+  Main FSM 
  ---------------------------------------------------------------------------*/
-WDI_RspProcFuncType  pfnRspProcTbl[WDI_MAX_RESP] =
+WDI_RspProcFuncType  pfnRspProcTbl[WDI_MAX_RESP] = 
 {
   /*INIT*/
   WDI_ProcessStartRsp,            /* WDI_START_RESP  */
@@ -365,7 +362,7 @@
   /* BA APIs*/
   WDI_ProcessAddBARsp,             /* WDI_ADD_BA_RESP  */
   WDI_ProcessTriggerBARsp,         /* WDI_TRIGGER_BA_RESP  */
-
+  
   /* IBSS APIs*/
   WDI_ProcessUpdateBeaconParamsRsp, /* WDI_UPD_BCON_PRMS_RSP */
   WDI_ProcessSendBeaconParamsRsp,   /* WDI_SND_BCON_RSP */
@@ -395,7 +392,7 @@
   WDI_ProcessWowlEnterRsp,         /* WDI_WOWL_ENTER_RESP  */
   WDI_ProcessWowlExitRsp,          /* WDI_WOWL_EXIT_RESP  */
   WDI_ProcessConfigureAppsCpuWakeupStateRsp, /* WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_RESP  */
-
+  
 
   WDI_ProcessNvDownloadRsp, /* WDI_NV_DOWNLOAD_RESP*/
 
@@ -427,8 +424,8 @@
   NULL,
 #endif /* ANI_MANF_DIAG */
 
-  WDI_ProcessKeepAliveRsp,       /* WDI_KEEP_ALIVE_RESP  */
-
+  WDI_ProcessKeepAliveRsp,       /* WDI_KEEP_ALIVE_RESP  */  
+  
 #ifdef FEATURE_WLAN_SCAN_PNO
   WDI_ProcessSetPreferredNetworkRsp,     /* WDI_SET_PREF_NETWORK_RESP */
   WDI_ProcessSetRssiFilterRsp,           /* WDI_SET_RSSI_FILTER_RESP */
@@ -440,19 +437,19 @@
 #endif // FEATURE_WLAN_SCAN_PNO
 
   WDI_ProcessSetTxPerTrackingRsp,      /* WDI_SET_TX_PER_TRACKING_RESP  */
-
+  
   /*---------------------------------------------------------------------
     Indications
   ---------------------------------------------------------------------*/
 #ifdef WLAN_FEATURE_PACKET_FILTERING
   /* WDI_8023_MULTICAST_LIST_RESP */
-  WDI_Process8023MulticastListRsp,
+  WDI_Process8023MulticastListRsp,          
   /* WDI_RECEIVE_FILTER_SET_FILTER_RESP */
-  WDI_ProcessReceiveFilterSetFilterRsp,
+  WDI_ProcessReceiveFilterSetFilterRsp,     
   /* WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_RESP */
-  WDI_ProcessFilterMatchCountRsp,
+  WDI_ProcessFilterMatchCountRsp,   
   /* WDI_RECEIVE_FILTER_CLEAR_FILTER_RESP */
-  WDI_ProcessReceiveFilterClearFilterRsp,
+  WDI_ProcessReceiveFilterClearFilterRsp,   
 #else
   NULL,
   NULL,
@@ -462,23 +459,23 @@
 
   WDI_ProcessHALDumpCmdRsp,       /* WDI_HAL_DUMP_CMD_RESP */
   WDI_ProcessShutdownRsp,         /* WDI_SHUTDOWN_RESP */
-
+  
   WDI_ProcessSetPowerParamsRsp,         /*WDI_SET_POWER_PARAMS_RESP*/
 #ifdef FEATURE_WLAN_CCX
   WDI_ProcessTsmStatsRsp,          /* WDI_TSM_STATS_RESP  */
 #else
   NULL,
 #endif
-
+  
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
-  WDI_ProcessGtkOffloadRsp,             /* WDI_GTK_OFFLOAD_RESP  */
-  WDI_ProcessGTKOffloadGetInfoRsp,      /* WDI_GTK_OFFLOAD_GETINFO_RESP  */
+  WDI_ProcessGtkOffloadRsp,           /* WDI_GTK_OFFLOAD_RESP  */
+  WDI_ProcessGTKOffloadGetInfoRsp,    /* WDI_GTK_OFFLOAD_GETINFO_RESP  */
 #else
   NULL,
   NULL,
 #endif // WLAN_FEATURE_GTK_OFFLOAD
-  WDI_ProcessSetTmLevelRsp,             /* WDI_SET_TM_LEVEL_RESP */
-  WDI_ProcessFeatureCapsExchangeRsp,    /* WDI_FEATURE_CAPS_EXCHANGE_RESP */
+  WDI_ProcessSetTmLevelRsp,       /* WDI_SET_TM_LEVEL_RESP */
+  WDI_ProcessFeatureCapsExchangeRsp,     /* WDI_FEATURE_CAPS_EXCHANGE_RESP */  
 
   /*---------------------------------------------------------------------
     Indications
@@ -516,22 +513,22 @@
 };
 
 
-/*---------------------------------------------------------------------------
+/*--------------------------------------------------------------------------- 
   WLAN DAL Global Control Block
  ---------------------------------------------------------------------------*/
-WDI_ControlBlockType  gWDICb;
+WDI_ControlBlockType  gWDICb; 
 static wpt_uint8      gWDIInitialized = eWLAN_PAL_FALSE;
 
-const wpt_uint8 szTransportChName[] = "WLAN_CTRL";
+const wpt_uint8 szTransportChName[] = "WLAN_CTRL"; 
 
 /*Helper routine for retrieving the PAL Context from WDI*/
-WPT_INLINE
+WPT_INLINE 
 void* WDI_GET_PAL_CTX( void )
 {
-  return gWDICb.pPALContext;
+  return gWDICb.pPALContext; 
 }/*WDI_GET_PAL_CTX*/
 
-/*============================================================================
+/*============================================================================ 
   Helper inline converters
  ============================================================================*/
 /*Convert WDI driver type into HAL driver type*/
@@ -577,7 +574,7 @@
 );
 
 /*Convert WDI sec ch offset into HAL sec ch offset type*/
-WPT_STATIC WPT_INLINE ePhyChanBondState
+WPT_STATIC WPT_INLINE tSirMacHTSecondaryChannelOffset
 WDI_2_HAL_SEC_CH_OFFSET
 (
   WDI_HTSecondaryChannelOffset wdiSecChOffset
@@ -639,19 +636,19 @@
   WDI_LinkStateType  wdiLinkState
 );
 
-/*Translate a STA Context from WDI into HAL*/
-WPT_STATIC WPT_INLINE
+/*Translate a STA Context from WDI into HAL*/ 
+WPT_STATIC WPT_INLINE 
 void
 WDI_CopyWDIStaCtxToHALStaCtx
-(
+( 
   tConfigStaParams*          phalConfigSta,
   WDI_ConfigStaReqInfoType*  pwdiConfigSta
 );
-
-/*Translate a Rate set info from WDI into HAL*/
-WPT_STATIC WPT_INLINE void
+ 
+/*Translate a Rate set info from WDI into HAL*/ 
+WPT_STATIC WPT_INLINE void 
 WDI_CopyWDIRateSetToHALRateSet
-(
+( 
   tSirMacRateSet* pHalRateSet,
   WDI_RateSet*    pwdiRateSet
 );
@@ -659,7 +656,7 @@
 /*Translate an EDCA Parameter Record from WDI into HAL*/
 WPT_STATIC WPT_INLINE void
 WDI_CopyWDIEDCAParamsToHALEDCAParams
-(
+( 
   tSirMacEdcaParamRecord* phalEdcaParam,
   WDI_EdcaParamRecord*    pWDIEdcaParam
 );
@@ -680,19 +677,19 @@
   WDI_ConfigBSSReqInfoType* pwdiConfigBSS
 );
 
-/*Extract the request CB function and user data from a request structure
+/*Extract the request CB function and user data from a request structure 
   pointed to by user data */
 WPT_STATIC WPT_INLINE void
 WDI_ExtractRequestCBFromEvent
 (
   WDI_EventInfoType* pEvent,
-  WDI_ReqStatusCb*   ppfnReqCB,
+  WDI_ReqStatusCb*   ppfnReqCB, 
   void**             ppUserData
 );
 
 wpt_uint8
 WDI_FindEmptySession
-(
+( 
   WDI_ControlBlockType*   pWDICtx,
   WDI_BSSSessionType**    ppSession
 );
@@ -706,7 +703,7 @@
 );
 
 WDI_Status WDI_SendNvBlobReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 );
@@ -724,12 +721,13 @@
 
 /**
  @brief WDI_getReqMsgString prints the WDI request message in string.
-
- @param wdiReqMsgId: WDI Message request Id
-
- @see
+  
+ @param wdiReqMsgId: WDI Message request Id 
+  
+ @see 
  @return Result of the function call
 */
+#ifdef WLAN_DEBUG
 static char *WDI_getReqMsgString(wpt_uint16 wdiReqMsgId)
 {
   switch (wdiReqMsgId)
@@ -817,13 +815,12 @@
 }
 
 
-
 /**
  @brief WDI_getRespMsgString prints the WDI resonse message in string.
-
- @param wdiRespMsgId: WDI Message response Id
-
- @see
+  
+ @param wdiRespMsgId: WDI Message response Id 
+  
+ @see 
  @return Result of the function call
 */
 static char *WDI_getRespMsgString(wpt_uint16 wdiRespMsgId)
@@ -913,10 +910,10 @@
 
 /**
  @brief WDI_getHALStatusMsgString prints the HAL status in string.
-
- @param halStatusId: HAL status Id
-
- @see
+  
+ @param halStatusId: HAL status Id 
+  
+ @see 
  @return Result of the function call
 */
 static char *WDI_getHALStatusMsgString(wpt_uint16 halStatusId)
@@ -961,19 +958,20 @@
   }
 }
 
-/*========================================================================
-
+#endif
+/*======================================================================== 
+ 
                              INITIALIZATION APIs
-
+ 
 ==========================================================================*/
 
 /**
  @brief WDI_Init is used to initialize the DAL.
-
+ 
  DAL will allocate all the resources it needs. It will open PAL, it will also
  open both the data and the control transport which in their turn will open
- DXE/SMD or any other drivers that they need.
-
+ DXE/SMD or any other drivers that they need. 
+ 
  @param pOSContext: pointer to the OS context provided by the UMAC
                     will be passed on to PAL on Open
         ppWDIGlobalCtx: output pointer of Global Context
@@ -981,9 +979,9 @@
 
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_Init
-(
+( 
   void*                      pOSContext,
   void**                     ppWDIGlobalCtx,
   WDI_DeviceCapabilityType*  pWdiDevCapability,
@@ -991,9 +989,9 @@
 )
 {
   wpt_uint8               i;
-  wpt_status              wptStatus;
+  wpt_status              wptStatus; 
   WDI_Status              wdiStatus;
-  WCTS_TransportCBsType   wctsCBs;
+  WCTS_TransportCBsType   wctsCBs; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*---------------------------------------------------------------------
@@ -1001,40 +999,44 @@
   ---------------------------------------------------------------------*/
   if (( NULL == ppWDIGlobalCtx ) || ( NULL == pWdiDevCapability ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Invalid input parameters in WDI_Init");
-
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   /*---------------------------------------------------------------------
-    Check to see if the module has already been initialized or not
+    Check to see if the module has already been initialized or not 
   ---------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE != gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
               "WDI module already initialized - return");
-
-    return WDI_STATUS_SUCCESS;
+#endif
+    return WDI_STATUS_SUCCESS; 
   }
 
   /*Module is now initialized - this flag is to ensure the fact that multiple
    init will not happen on WDI
    !! - potential race does exist because read and set are not atomic,
    however an atomic operation would be closely here - reanalyze if necessary*/
-  gWDIInitialized = eWLAN_PAL_TRUE;
+  gWDIInitialized = eWLAN_PAL_TRUE; 
 
   /*Setup the control block */
   WDI_CleanCB(&gWDICb);
-  gWDICb.pOSContext = pOSContext;
+  gWDICb.pOSContext = pOSContext; 
 
   /*Setup the STA Table*/
   wdiStatus = WDI_STATableInit(&gWDICb);
   if ( WDI_STATUS_SUCCESS != wdiStatus )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                "%s: Failure while initializing STA Table, status %d",
                __FUNCTION__, wdiStatus);
+#endif
     goto fail_STATableInit;
   }
 
@@ -1044,9 +1046,11 @@
   wptStatus =  wpalOpen(&gWDICb.pPALContext, pOSContext);
   if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                "%s: Failed to open PAL, status %d",
                __FUNCTION__, wptStatus);
+#endif
     goto fail_wpalOpen;
   }
 
@@ -1055,22 +1059,26 @@
   wptStatus =  wpalMutexInit(&gWDICb.wptMutex);
   if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                "%s: Failed to init mutex, status %d",
                __FUNCTION__, wptStatus);
+#endif
     goto fail_mutex;
   }
 
   /*Initialize the response timer - it will be used to time all messages
     expected as response from device*/
-  wptStatus = wpalTimerInit( &gWDICb.wptResponseTimer,
-                             WDI_ResponseTimerCB,
+  wptStatus = wpalTimerInit( &gWDICb.wptResponseTimer, 
+                             WDI_ResponseTimerCB, 
                              &gWDICb);
   if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
               "%s: Failed to init response timer, status %d",
                __FUNCTION__, wptStatus);
+#endif
     goto fail_timer;
   }
 
@@ -1078,9 +1086,11 @@
   wptStatus = wpal_list_init(&(gWDICb.wptPendingQueue));
   if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
               "%s: Failed to init pending request queue, status %d",
                __FUNCTION__, wptStatus);
+#endif
     goto fail_pend_queue;
   }
 
@@ -1088,9 +1098,11 @@
   wptStatus = wpal_list_init(&(gWDICb.wptPendingAssocSessionIdQueue));
   if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
               "%s: Failed to init assoc session queue, status %d",
                __FUNCTION__, wptStatus);
+#endif
     goto fail_assoc_queue;
   }
 
@@ -1100,9 +1112,11 @@
     wptStatus = wpal_list_init(&(gWDICb.aBSSSessions[i].wptPendingQueue));
     if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
     {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                  "%s: Failed to init BSS %d pending queue, status %d",
                  __FUNCTION__, i, wptStatus);
+#endif
       goto fail_bss_queue;
     }
   }
@@ -1116,75 +1130,85 @@
   wdiStatus = WDI_DP_UtilsInit(&gWDICb);
   if ( WDI_STATUS_SUCCESS != wdiStatus )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                "%s: Failed to initialize the DP Util Module, status %d",
                __FUNCTION__, wdiStatus);
+#endif
     goto fail_dp_util_init;
   }
 
   /* Init Set power state event */
   wptStatus = wpalEventInit(&gWDICb.setPowerStateEvent);
-  if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
+  if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus ) 
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                 "%s: Failed to initialize power state event, status %d",
                 __FUNCTION__, wptStatus);
+#endif
      goto fail_power_event;
   }
 
   /* Init WCTS action event */
   wptStatus = wpalEventInit(&gWDICb.wctsActionEvent);
-  if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
+  if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus ) 
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                 "%s: Failed to initialize WCTS action event, status %d",
                 __FUNCTION__, wptStatus);
+#endif
      goto fail_wcts_event;
   }
 
   /*------------------------------------------------------------------------
-    Open the Transport Services for Control and Data
+    Open the Transport Services for Control and Data 
    ------------------------------------------------------------------------*/
   wctsCBs.wctsNotifyCB      = WDI_NotifyMsgCTSCB;
   wctsCBs.wctsNotifyCBData  = &gWDICb;
-  wctsCBs.wctsRxMsgCB       = WDI_RXMsgCTSCB;
+  wctsCBs.wctsRxMsgCB       = WDI_RXMsgCTSCB; 
   wctsCBs.wctsRxMsgCBData   = &gWDICb;
 
-  gWDICb.bCTOpened          = eWLAN_PAL_FALSE;
+  gWDICb.bCTOpened          = eWLAN_PAL_FALSE; 
   gWDICb.wctsHandle = WCTS_OpenTransport( szTransportChName ,
-                                          WDI_CT_CHANNEL_SIZE,
-                                          &wctsCBs );
+                                          WDI_CT_CHANNEL_SIZE, 
+                                          &wctsCBs ); 
 
   if ( NULL == gWDICb.wctsHandle )
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                 "%s: Failed to open WCTS transport", __FUNCTION__);
+#endif
      goto fail_wcts_open;
   }
 
   gWDICb.driverMode = (tDriverType)driverType;
   /* FTM mode not need to open Transport Driver */
   if(eDRIVER_TYPE_MFG != (tDriverType)driverType)
-  {
+  {  
     /*------------------------------------------------------------------------
      Open the Data Transport
      ------------------------------------------------------------------------*/
     if(eWLAN_PAL_STATUS_SUCCESS != WDTS_openTransport(&gWDICb))
     {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                  "%s: Failed to open the DT Transport", __FUNCTION__);
+#endif
       goto fail_wdts_open;
     }
   }
 
   /*The WDI is initialized - set state to init */
-  gWDICb.uGlobalState = WDI_INIT_ST;
+  gWDICb.uGlobalState = WDI_INIT_ST; 
 
   /*Send the context as a ptr to the global WDI Control Block*/
   *ppWDIGlobalCtx = &gWDICb;
 
   /*Fill in the device capabilities*/
-  pWdiDevCapability->bFrameXtlSupported = eWLAN_PAL_FALSE;
+  pWdiDevCapability->bFrameXtlSupported = eWLAN_PAL_FALSE; 
   pWdiDevCapability->ucMaxSTASupported  = gWDICb.ucMaxStations;
   pWdiDevCapability->ucMaxBSSSupported  = gWDICb.ucMaxBssids;
   return WDI_STATUS_SUCCESS;
@@ -1203,12 +1227,13 @@
      */
 
      eventStatus = wpalEventReset(&gWDICb.wctsActionEvent);
-     if ( eWLAN_PAL_STATUS_SUCCESS != eventStatus )
+#ifdef WLAN_DEBUG
+     if ( eWLAN_PAL_STATUS_SUCCESS != eventStatus ) 
      {
         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                    "%s: Failed to reset WCTS action event", __FUNCTION__);
      }
-
+#endif
      WCTS_CloseTransport(gWDICb.wctsHandle);
 
      /* Wait for WCTS to close the control transport.  If we were able
@@ -1217,13 +1242,15 @@
         the channel to be closed */
      if ( eWLAN_PAL_STATUS_SUCCESS == eventStatus )
      {
-        eventStatus = wpalEventWait(&gWDICb.wctsActionEvent,
+        eventStatus = wpalEventWait(&gWDICb.wctsActionEvent, 
                                     WDI_WCTS_ACTION_TIMEOUT);
+#ifdef WLAN_DEBUG
         if ( eWLAN_PAL_STATUS_SUCCESS != eventStatus )
         {
            WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                       "%s: Failed to wait on WCTS action event", __FUNCTION__);
         }
+#endif
      }
      else
      {
@@ -1257,9 +1284,9 @@
  fail_wpalOpen:
   WDI_STATableClose(&gWDICb);
  fail_STATableInit:
-  gWDIInitialized = eWLAN_PAL_FALSE;
+  gWDIInitialized = eWLAN_PAL_FALSE; 
 
-  return WDI_STATUS_E_FAILURE;
+  return WDI_STATUS_E_FAILURE; 
 
 }/*WDI_Init*/;
 
@@ -1273,23 +1300,23 @@
          If the RIVA sub-system is not yet up and running DAL
          will queue the request for Open and will wait for the
          SMD notification before attempting to send down the
-         message to HAL.
+         message to HAL. 
 
  WDI_Init must have been called.
 
- @param wdiStartParams: the start parameters as specified by
+ @param wdiStartParams: the start parameters as specified by 
                       the Device Interface
-
+  
         wdiStartRspCb: callback for passing back the response of
         the start operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_Start
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_Start
 (
   WDI_StartReqParamsType*  pwdiStartParams,
@@ -1301,23 +1328,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_START_REQ;
-  wdiEventData.pEventData      = pwdiStartParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiStartParams);
-  wdiEventData.pCBfnc          = wdiStartRspCb;
+  wdiEventData.pEventData      = pwdiStartParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiStartParams); 
+  wdiEventData.pCBfnc          = wdiStartRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -1332,24 +1360,24 @@
         in started state.
 
          In state BUSY this request will be queued.
-
-         Request will not be accepted in any other state.
+  
+         Request will not be accepted in any other state. 
 
  WDI_Start must have been called.
 
- @param wdiStopParams: the stop parameters as specified by
+ @param wdiStopParams: the stop parameters as specified by 
                       the Device Interface
-
+  
         wdiStopRspCb: callback for passing back the response of
         the stop operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_Start
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_Stop
 (
   WDI_StopReqParamsType*  pwdiStopParams,
@@ -1362,14 +1390,15 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*Access to the global state must be locked before cleaning */
@@ -1384,16 +1413,14 @@
   /* Free the global variables */
   wpalMemoryFree(gpHostWlanFeatCaps);
   wpalMemoryFree(gpFwWlanFeatCaps);
-  gpHostWlanFeatCaps = NULL;
-  gpFwWlanFeatCaps = NULL;
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_STOP_REQ;
-  wdiEventData.pEventData      = pwdiStopParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiStopParams);
-  wdiEventData.pCBfnc          = wdiStopRspCb;
+  wdiEventData.pEventData      = pwdiStopParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiStopParams); 
+  wdiEventData.pCBfnc          = wdiStopRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_STOP_EVENT, &wdiEventData);
@@ -1403,20 +1430,20 @@
 
 
 /**
- @brief WDI_Close will be called when the upper MAC no longer
+ @brief WDI_Close will be called when the upper MAC no longer 
         needs to interact with DAL. DAL will free its control
         block.
-
-        It is only accepted in state STOPPED.
+  
+        It is only accepted in state STOPPED.  
 
  WDI_Stop must have been called.
 
  @param none
-
+  
  @see WDI_Stop
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_Close
 (
   void
@@ -1429,34 +1456,36 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*Reset WCTS action event prior to posting the WDI_CLOSE_REQ
    (the control transport will be closed by the FSM and we'll want
    to wait until that completes)*/
   eventStatus = wpalEventReset(&gWDICb.wctsActionEvent);
-  if ( eWLAN_PAL_STATUS_SUCCESS != eventStatus )
+#ifdef WLAN_DEBUG
+  if ( eWLAN_PAL_STATUS_SUCCESS != eventStatus ) 
   {
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Failed to reset WCTS action event", __FUNCTION__);
      /* fall through and try to finish closing via the FSM */
   }
-
+#endif
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_CLOSE_REQ;
-  wdiEventData.pEventData      = NULL;
-  wdiEventData.uEventDataSize  = 0;
-  wdiEventData.pCBfnc          = NULL;
+  wdiEventData.pEventData      = NULL; 
+  wdiEventData.uEventDataSize  = 0; 
+  wdiEventData.pCBfnc          = NULL; 
   wdiEventData.pUserData       = NULL;
 
   gWDIInitialized = eWLAN_PAL_FALSE;
@@ -1467,44 +1496,50 @@
     (but only if we were able to reset the event flag*/
   if ( eWLAN_PAL_STATUS_SUCCESS == eventStatus )
   {
-     eventStatus = wpalEventWait(&gWDICb.wctsActionEvent,
+     eventStatus = wpalEventWait(&gWDICb.wctsActionEvent, 
                                  WDI_WCTS_ACTION_TIMEOUT);
+#ifdef WLAN_DEBUG
      if ( eWLAN_PAL_STATUS_SUCCESS != eventStatus )
      {
         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                    "%s: Failed to wait on WCTS action event", __FUNCTION__);
      }
+#endif
   }
 
   /* Destroy the WCTS action event */
   wptStatus = wpalEventDelete(&gWDICb.wctsActionEvent);
+#ifdef WLAN_DEBUG
   if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
   {
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "WDI Close failed to destroy an event");
-     WDI_ASSERT(0);
+     WDI_ASSERT(0); 
   }
+#endif
 
    /* Destroy the Set Power State event */
    wptStatus = wpalEventDelete(&gWDICb.setPowerStateEvent);
+#ifdef WLAN_DEBUG
    if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
    {
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "WDI Close failed to destroy an event");
-
-      WDI_ASSERT(0);
+      WDI_ASSERT(0); 
    }
+#endif
 
   /*------------------------------------------------------------------------
     Closes the Data Path Utility Module
    ------------------------------------------------------------------------*/
+#ifdef WLAN_DEBUG
   if ( WDI_STATUS_SUCCESS != WDI_DP_UtilsExit(&gWDICb))
   {
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
               "WDI Init failed to close the DP Util Module");
-
-    WDI_ASSERT(0);
+    WDI_ASSERT(0); 
   }
+#endif
 
   /*destroy the BSS sessions pending Queue */
   for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
@@ -1517,18 +1552,20 @@
 
   /* destroy the WDI Pending Request Queue*/
   wpal_list_destroy(&(gWDICb.wptPendingQueue));
-
+  
   /*destroy the response timer */
   wptStatus = wpalTimerDelete( &gWDICb.wptResponseTimer);
 
   /*invalidate the main synchro mutex */
   wptStatus = wpalMutexDelete(&gWDICb.wptMutex);
+#ifdef WLAN_DEBUG
   if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
   {
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "Failed to delete mutex %d", wptStatus);
      WDI_ASSERT(0);
   }
+#endif
 
   /*Clear control block.  note that this will clear the "magic"
     which will inhibit all asynchronous callbacks*/
@@ -1571,9 +1608,10 @@
      ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
             "WDI API call before module is initialized - Fail request");
-
+#endif
       return WDI_STATUS_E_NOT_ALLOWED;
    }
 
@@ -1587,41 +1625,40 @@
    /* Shutdown will not be queued, if the state is busy timer will be
     * stopped & this message will be processed.*/
    wptStatus = WDI_PostMainEvent(&gWDICb, WDI_SHUTDOWN_EVENT, &wdiEventData);
+#ifdef WLAN_DEBUG
    if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
    {
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
             "%s: Failed to process shutdown event", __FUNCTION__);
    }
+#endif
    /* Destroy the Set Power State event */
    wptStatus = wpalEventDelete(&gWDICb.setPowerStateEvent);
+#ifdef WLAN_DEBUG
    if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
    {
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
             "WDI Close failed to destroy an event");
-
       WDI_ASSERT(0);
    }
+#endif
    /*------------------------------------------------------------------------
      Closes the Data Path Utility Module
      ------------------------------------------------------------------------*/
+#ifdef WLAN_DEBUG
    if ( WDI_STATUS_SUCCESS != WDI_DP_UtilsExit(&gWDICb))
    {
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
             "WDI Init failed to close the DP Util Module");
-
       WDI_ASSERT(0);
    }
+#endif
    if ( closeTransport )
    {
       /* Close control transport, called from module unload */
       WCTS_CloseTransport(gWDICb.wctsHandle);
    }
-   else
-   {
-      /* Riva is crashed then SMD is already closed so cleaning all
-         the pending messages in the transport queue  */
-      WCTS_ClearPendingQueue(gWDICb.wctsHandle);
-   }
+
    /*destroy the BSS sessions pending Queue */
    for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
    {
@@ -1637,17 +1674,15 @@
 
    /*invalidate the main synchro mutex */
    wptStatus = wpalMutexDelete(&gWDICb.wptMutex);
+#ifdef WLAN_DEBUG
    if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
    {
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
             "%s: Failed to delete mutex %d",  __FUNCTION__, wptStatus);
       WDI_ASSERT(0);
    }
-   /* Free the global variables */
-   wpalMemoryFree(gpHostWlanFeatCaps);
-   wpalMemoryFree(gpFwWlanFeatCaps);
-   gpHostWlanFeatCaps = NULL;
-   gpFwWlanFeatCaps = NULL;
+#endif
+
    /*Clear control block.  note that this will clear the "magic"
      which will inhibit all asynchronous callbacks*/
    WDI_CleanCB(&gWDICb);
@@ -1656,37 +1691,37 @@
 }/*WDI_Shutdown*/
 
 
-/*========================================================================
-
+/*======================================================================== 
+ 
                              SCAN APIs
-
+ 
 ==========================================================================*/
 
 /**
- @brief WDI_InitScanReq will be called when the upper MAC wants
+ @brief WDI_InitScanReq will be called when the upper MAC wants 
         the WLAN Device to get ready for a scan procedure. Upon
         the call of this API the WLAN DAL will pack and send a
         HAL Init Scan request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_Start must have been called.
 
  @param wdiInitScanParams: the init scan parameters as specified
                       by the Device Interface
-
+  
         wdiInitScanRspCb: callback for passing back the response
         of the init scan operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_Start
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_InitScanReq
 (
   WDI_InitScanReqParamsType*  pwdiInitScanParams,
@@ -1698,23 +1733,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_INIT_SCAN_REQ;
-  wdiEventData.pEventData      = pwdiInitScanParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiInitScanParams);
-  wdiEventData.pCBfnc          = wdiInitScanRspCb;
+  wdiEventData.pEventData      = pwdiInitScanParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiInitScanParams); 
+  wdiEventData.pCBfnc          = wdiInitScanRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -1722,31 +1758,31 @@
 }/*WDI_InitScanReq*/
 
 /**
- @brief WDI_StartScanReq will be called when the upper MAC
+ @brief WDI_StartScanReq will be called when the upper MAC 
         wishes to change the Scan channel on the WLAN Device.
         Upon the call of this API the WLAN DAL will pack and
         send a HAL Start Scan request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_InitScanReq must have been called.
 
- @param wdiStartScanParams: the start scan parameters as
+ @param wdiStartScanParams: the start scan parameters as 
                       specified by the Device Interface
-
+  
         wdiStartScanRspCb: callback for passing back the
         response of the start scan operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_InitScanReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_StartScanReq
 (
   WDI_StartScanReqParamsType*  pwdiStartScanParams,
@@ -1758,23 +1794,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_START_SCAN_REQ;
-  wdiEventData.pEventData      = pwdiStartScanParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiStartScanParams);
-  wdiEventData.pCBfnc          = wdiStartScanRspCb;
+  wdiEventData.pEventData      = pwdiStartScanParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiStartScanParams); 
+  wdiEventData.pCBfnc          = wdiStartScanRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -1783,7 +1820,7 @@
 
 
 /**
- @brief WDI_EndScanReq will be called when the upper MAC is
+ @brief WDI_EndScanReq will be called when the upper MAC is 
         wants to end scanning for a particular channel that it
         had set before by calling Scan Start on the WLAN Device.
         Upon the call of this API the WLAN DAL will pack and
@@ -1791,23 +1828,23 @@
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_StartScanReq must have been called.
 
- @param wdiEndScanParams: the end scan parameters as specified
+ @param wdiEndScanParams: the end scan parameters as specified 
                       by the Device Interface
-
+  
         wdiEndScanRspCb: callback for passing back the response
         of the end scan operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_StartScanReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_EndScanReq
 (
   WDI_EndScanReqParamsType* pwdiEndScanParams,
@@ -1819,23 +1856,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_END_SCAN_REQ;
-  wdiEventData.pEventData      = pwdiEndScanParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiEndScanParams);
-  wdiEventData.pCBfnc          = wdiEndScanRspCb;
+  wdiEventData.pEventData      = pwdiEndScanParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiEndScanParams); 
+  wdiEventData.pCBfnc          = wdiEndScanRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -1844,31 +1882,31 @@
 
 
 /**
- @brief WDI_FinishScanReq will be called when the upper MAC has
+ @brief WDI_FinishScanReq will be called when the upper MAC has 
         completed the scan process on the WLAN Device. Upon the
         call of this API the WLAN DAL will pack and send a HAL
         Finish Scan Request request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_InitScanReq must have been called.
 
- @param wdiFinishScanParams: the finish scan  parameters as
+ @param wdiFinishScanParams: the finish scan  parameters as 
                       specified by the Device Interface
-
+  
         wdiFinishScanRspCb: callback for passing back the
         response of the finish scan operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_InitScanReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_FinishScanReq
 (
   WDI_FinishScanReqParamsType* pwdiFinishScanParams,
@@ -1880,60 +1918,61 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_FINISH_SCAN_REQ;
-  wdiEventData.pEventData      = pwdiFinishScanParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiFinishScanParams);
-  wdiEventData.pCBfnc          = wdiFinishScanRspCb;
+  wdiEventData.pEventData      = pwdiFinishScanParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiFinishScanParams); 
+  wdiEventData.pCBfnc          = wdiFinishScanRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 
 }/*WDI_FinishScanReq*/
 
-/*========================================================================
-
+/*======================================================================== 
+ 
                           ASSOCIATION APIs
-
+ 
 ==========================================================================*/
 
 /**
- @brief WDI_JoinReq will be called when the upper MAC is ready
+ @brief WDI_JoinReq will be called when the upper MAC is ready 
         to start an association procedure to a BSS. Upon the
         call of this API the WLAN DAL will pack and send a HAL
         Join request message to the lower RIVA sub-system if
         DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_Start must have been called.
 
- @param wdiJoinParams: the join parameters as specified by
+ @param wdiJoinParams: the join parameters as specified by 
                       the Device Interface
-
+  
         wdiJoinRspCb: callback for passing back the response of
         the join operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_Start
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_JoinReq
 (
   WDI_JoinReqParamsType* pwdiJoinParams,
@@ -1945,23 +1984,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_JOIN_REQ;
-  wdiEventData.pEventData      = pwdiJoinParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiJoinParams);
-  wdiEventData.pCBfnc          = wdiJoinRspCb;
+  wdiEventData.pEventData      = pwdiJoinParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiJoinParams); 
+  wdiEventData.pCBfnc          = wdiJoinRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -1969,7 +2009,7 @@
 }/*WDI_JoinReq*/
 
 /**
- @brief WDI_ConfigBSSReq will be called when the upper MAC
+ @brief WDI_ConfigBSSReq will be called when the upper MAC 
         wishes to configure the newly acquired or in process of
         being acquired BSS to the HW . Upon the call of this API
         the WLAN DAL will pack and send a HAL Config BSS request
@@ -1977,24 +2017,24 @@
         STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_JoinReq must have been called.
 
- @param wdiConfigBSSParams: the config BSS parameters as
+ @param wdiConfigBSSParams: the config BSS parameters as 
                       specified by the Device Interface
-
+  
         wdiConfigBSSRspCb: callback for passing back the
         response of the config BSS operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_JoinReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_ConfigBSSReq
 (
   WDI_ConfigBSSReqParamsType* pwdiConfigBSSParams,
@@ -2006,23 +2046,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_CONFIG_BSS_REQ;
-  wdiEventData.pEventData      = pwdiConfigBSSParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiConfigBSSParams);
-  wdiEventData.pCBfnc          = wdiConfigBSSRspCb;
+  wdiEventData.pEventData      = pwdiConfigBSSParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiConfigBSSParams); 
+  wdiEventData.pCBfnc          = wdiConfigBSSRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2030,30 +2071,30 @@
 }/*WDI_ConfigBSSReq*/
 
 /**
- @brief WDI_DelBSSReq will be called when the upper MAC is
+ @brief WDI_DelBSSReq will be called when the upper MAC is 
         disassociating from the BSS and wishes to notify HW.
         Upon the call of this API the WLAN DAL will pack and
         send a HAL Del BSS request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_ConfigBSSReq or WDI_PostAssocReq must have been called.
 
- @param wdiDelBSSParams: the del BSS parameters as specified by
+ @param wdiDelBSSParams: the del BSS parameters as specified by 
                       the Device Interface
-
+  
         wdiDelBSSRspCb: callback for passing back the response
         of the del bss operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
- @see WDI_ConfigBSSReq, WDI_PostAssocReq
+        callback 
+  
+ @see WDI_ConfigBSSReq, WDI_PostAssocReq 
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_DelBSSReq
 (
   WDI_DelBSSReqParamsType* pwdiDelBSSParams,
@@ -2065,23 +2106,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_DEL_BSS_REQ;
-  wdiEventData.pEventData      = pwdiDelBSSParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiDelBSSParams);
-  wdiEventData.pCBfnc          = wdiDelBSSRspCb;
+  wdiEventData.pEventData      = pwdiDelBSSParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiDelBSSParams); 
+  wdiEventData.pCBfnc          = wdiDelBSSRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2089,31 +2131,31 @@
 }/*WDI_DelBSSReq*/
 
 /**
- @brief WDI_PostAssocReq will be called when the upper MAC has
+ @brief WDI_PostAssocReq will be called when the upper MAC has 
         associated to a BSS and wishes to configure HW for
         associated state. Upon the call of this API the WLAN DAL
         will pack and send a HAL Post Assoc request message to
         the lower RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_JoinReq must have been called.
 
  @param wdiPostAssocReqParams: the assoc parameters as specified
                       by the Device Interface
-
+  
         wdiPostAssocRspCb: callback for passing back the
         response of the post assoc operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_JoinReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_PostAssocReq
 (
   WDI_PostAssocReqParamsType* pwdiPostAssocReqParams,
@@ -2125,23 +2167,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_POST_ASSOC_REQ;
-  wdiEventData.pEventData      = pwdiPostAssocReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiPostAssocReqParams);
-  wdiEventData.pCBfnc          = wdiPostAssocRspCb;
+  wdiEventData.pEventData      = pwdiPostAssocReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiPostAssocReqParams); 
+  wdiEventData.pCBfnc          = wdiPostAssocRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2149,7 +2192,7 @@
 }/*WDI_PostAssocReq*/
 
 /**
- @brief WDI_DelSTAReq will be called when the upper MAC when an
+ @brief WDI_DelSTAReq will be called when the upper MAC when an 
         association with another STA has ended and the station
         must be deleted from HW. Upon the call of this API the
         WLAN DAL will pack and send a HAL Del STA request
@@ -2157,23 +2200,23 @@
         STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param wdiDelSTAParams: the Del STA parameters as specified by
+ @param wdiDelSTAParams: the Del STA parameters as specified by 
                       the Device Interface
-
+  
         wdiDelSTARspCb: callback for passing back the response
         of the del STA operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_DelSTAReq
 (
   WDI_DelSTAReqParamsType* pwdiDelSTAParams,
@@ -2185,33 +2228,34 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_DEL_STA_REQ;
-  wdiEventData.pEventData      = pwdiDelSTAParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiDelSTAParams);
-  wdiEventData.pCBfnc          = wdiDelSTARspCb;
+  wdiEventData.pEventData      = pwdiDelSTAParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiDelSTAParams); 
+  wdiEventData.pCBfnc          = wdiDelSTARspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 
 }/*WDI_DelSTAReq*/
 
-/*========================================================================
-
+/*======================================================================== 
+ 
                              SECURITY APIs
-
+ 
 ==========================================================================*/
 
 /**
@@ -2222,24 +2266,24 @@
         STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param wdiSetBSSKeyParams: the BSS Key set parameters as
+ @param wdiSetBSSKeyParams: the BSS Key set parameters as 
                       specified by the Device Interface
-
+  
         wdiSetBSSKeyRspCb: callback for passing back the
         response of the set BSS Key operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetBSSKeyReq
 (
   WDI_SetBSSKeyReqParamsType* pwdiSetBSSKeyParams,
@@ -2251,23 +2295,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_SET_BSS_KEY_REQ;
-  wdiEventData.pEventData      = pwdiSetBSSKeyParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiSetBSSKeyParams);
-  wdiEventData.pCBfnc          = wdiSetBSSKeyRspCb;
+  wdiEventData.pEventData      = pwdiSetBSSKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSetBSSKeyParams); 
+  wdiEventData.pCBfnc          = wdiSetBSSKeyRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2282,24 +2327,24 @@
         STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_SetBSSKeyReq must have been called.
 
- @param wdiRemoveBSSKeyParams: the remove BSS key parameters as
+ @param wdiRemoveBSSKeyParams: the remove BSS key parameters as 
                       specified by the Device Interface
-
+  
         wdiRemoveBSSKeyRspCb: callback for passing back the
         response of the remove BSS key operation received from
         the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_SetBSSKeyReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_RemoveBSSKeyReq
 (
   WDI_RemoveBSSKeyReqParamsType* pwdiRemoveBSSKeyParams,
@@ -2311,23 +2356,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_RMV_BSS_KEY_REQ;
-  wdiEventData.pEventData      = pwdiRemoveBSSKeyParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiRemoveBSSKeyParams);
-  wdiEventData.pCBfnc          = wdiRemoveBSSKeyRspCb;
+  wdiEventData.pEventData      = pwdiRemoveBSSKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiRemoveBSSKeyParams); 
+  wdiEventData.pCBfnc          = wdiRemoveBSSKeyRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2336,31 +2382,31 @@
 
 
 /**
- @brief WDI_SetSTAKeyReq will be called when the upper MAC is
+ @brief WDI_SetSTAKeyReq will be called when the upper MAC is 
         ready to install a STA(ast) encryption key in HW. Upon
         the call of this API the WLAN DAL will pack and send a
         HAL Set STA Key request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param wdiSetSTAKeyParams: the set STA key parameters as
+ @param wdiSetSTAKeyParams: the set STA key parameters as 
                       specified by the Device Interface
-
+  
         wdiSetSTAKeyRspCb: callback for passing back the
         response of the set STA key operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetSTAKeyReq
 (
   WDI_SetSTAKeyReqParamsType* pwdiSetSTAKeyParams,
@@ -2372,23 +2418,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_SET_STA_KEY_REQ;
-  wdiEventData.pEventData      = pwdiSetSTAKeyParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiSetSTAKeyParams);
-  wdiEventData.pCBfnc          = wdiSetSTAKeyRspCb;
+  wdiEventData.pEventData      = pwdiSetSTAKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSetSTAKeyParams); 
+  wdiEventData.pCBfnc          = wdiSetSTAKeyRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2397,31 +2444,31 @@
 
 
 /**
- @brief WDI_RemoveSTAKeyReq will be called when the upper MAC
+ @brief WDI_RemoveSTAKeyReq will be called when the upper MAC 
         wants to uninstall a previously set STA key in HW. Upon
         the call of this API the WLAN DAL will pack and send a
         HAL Remove STA Key request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_SetSTAKeyReq must have been called.
 
- @param wdiRemoveSTAKeyParams: the remove STA key parameters as
+ @param wdiRemoveSTAKeyParams: the remove STA key parameters as 
                       specified by the Device Interface
-
+  
         wdiRemoveSTAKeyRspCb: callback for passing back the
         response of the remove STA key operation received from
         the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_SetSTAKeyReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_RemoveSTAKeyReq
 (
   WDI_RemoveSTAKeyReqParamsType* pwdiRemoveSTAKeyParams,
@@ -2433,23 +2480,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_RMV_STA_KEY_REQ;
-  wdiEventData.pEventData      = pwdiRemoveSTAKeyParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiRemoveSTAKeyParams);
-  wdiEventData.pCBfnc          = wdiRemoveSTAKeyRspCb;
+  wdiEventData.pEventData      = pwdiRemoveSTAKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiRemoveSTAKeyParams); 
+  wdiEventData.pCBfnc          = wdiRemoveSTAKeyRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2458,31 +2506,31 @@
 
 
 /**
- @brief WDI_SetSTABcastKeyReq will be called when the upper MAC
+ @brief WDI_SetSTABcastKeyReq will be called when the upper MAC 
         wants to install a STA Bcast encryption key on the HW.
         Upon the call of this API the WLAN DAL will pack and
         send a HAL Start request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param pwdiSetSTABcastKeyParams: the BSS Key set parameters as
+ @param pwdiSetSTABcastKeyParams: the BSS Key set parameters as 
                       specified by the Device Interface
-
+  
         wdiSetSTABcastKeyRspCb: callback for passing back the
         response of the set BSS Key operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetSTABcastKeyReq
 (
   WDI_SetSTAKeyReqParamsType* pwdiSetSTABcastKeyParams,
@@ -2495,23 +2543,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_SET_STA_BCAST_KEY_REQ;
-  wdiEventData.pEventData      = pwdiSetSTABcastKeyParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiSetSTABcastKeyParams);
-  wdiEventData.pCBfnc          = wdiSetSTABcastKeyRspCb;
+  wdiEventData.pEventData      = pwdiSetSTABcastKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSetSTABcastKeyParams); 
+  wdiEventData.pCBfnc          = wdiSetSTABcastKeyRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2519,32 +2568,32 @@
 }/*WDI_SetSTABcastKeyReq*/
 
 /**
- @brief WDI_RemoveSTABcastKeyReq will be called when the upper
+ @brief WDI_RemoveSTABcastKeyReq will be called when the upper 
         MAC wants to uninstall a STA Bcast key from HW. Upon the
         call of this API the WLAN DAL will pack and send a HAL
         Remove STA Bcast Key request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_SetSTABcastKeyReq must have been called.
 
- @param pwdiRemoveSTABcastKeyParams: the remove BSS key
+ @param pwdiRemoveSTABcastKeyParams: the remove BSS key 
                       parameters as specified by the Device
                       Interface
-
+  
         wdiRemoveSTABcastKeyRspCb: callback for passing back the
         response of the remove STA Bcast key operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_SetSTABcastKeyReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_RemoveSTABcastKeyReq
 (
   WDI_RemoveSTAKeyReqParamsType* pwdiRemoveSTABcastKeyParams,
@@ -2556,23 +2605,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_RMV_STA_BCAST_KEY_REQ;
-  wdiEventData.pEventData      = pwdiRemoveSTABcastKeyParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiRemoveSTABcastKeyParams);
-  wdiEventData.pCBfnc          = wdiRemoveSTABcastKeyRspCb;
+  wdiEventData.pEventData      = pwdiRemoveSTABcastKeyParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiRemoveSTABcastKeyParams); 
+  wdiEventData.pCBfnc          = wdiRemoveSTABcastKeyRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2580,32 +2630,32 @@
 }/*WDI_RemoveSTABcastKeyReq*/
 
 /**
- @brief WDI_SetMaxTxPowerReq will be called when the upper
+ @brief WDI_SetMaxTxPowerReq will be called when the upper 
         MAC wants to set Max Tx Power to HW. Upon the
         call of this API the WLAN DAL will pack and send a HAL
         Remove STA Bcast Key request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_SetSTABcastKeyReq must have been called.
 
- @param pwdiRemoveSTABcastKeyParams: the remove BSS key
+ @param pwdiRemoveSTABcastKeyParams: the remove BSS key 
                       parameters as specified by the Device
                       Interface
-
+  
         wdiRemoveSTABcastKeyRspCb: callback for passing back the
         response of the remove STA Bcast key operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_SetMaxTxPowerReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetMaxTxPowerReq
 (
   WDI_SetMaxTxPowerParamsType*   pwdiSetMaxTxPowerParams,
@@ -2617,23 +2667,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_SET_MAX_TX_POWER_REQ;
-  wdiEventData.pEventData      = pwdiSetMaxTxPowerParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiSetMaxTxPowerParams);
-  wdiEventData.pCBfnc          = wdiReqStatusCb;
+  wdiEventData.pEventData      = pwdiSetMaxTxPowerParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSetMaxTxPowerParams); 
+  wdiEventData.pCBfnc          = wdiReqStatusCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2650,24 +2701,26 @@
 {
   WDI_EventInfoType wdiEventData;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_TSM_STATS_REQ;
-  wdiEventData.pEventData      = pwdiTsmReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiTsmReqParams);
-  wdiEventData.pCBfnc          = wdiReqStatusCb;
+  wdiEventData.pEventData      = pwdiTsmReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiTsmReqParams); 
+  wdiEventData.pCBfnc          = wdiReqStatusCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2675,10 +2728,10 @@
 }
 #endif
 
-/*========================================================================
-
+/*======================================================================== 
+ 
                             QoS and BA APIs
-
+ 
 ==========================================================================*/
 
 /**
@@ -2691,23 +2744,23 @@
         DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
  @param wdiAddTsReqParams: the add TS parameters as specified by
                       the Device Interface
-
+  
         wdiAddTsRspCb: callback for passing back the response of
         the add TS operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_AddTSReq
 (
   WDI_AddTSReqParamsType* pwdiAddTsReqParams,
@@ -2719,23 +2772,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_ADD_TS_REQ;
-  wdiEventData.pEventData      = pwdiAddTsReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiAddTsReqParams);
-  wdiEventData.pCBfnc          = wdiAddTsRspCb;
+  wdiEventData.pEventData      = pwdiAddTsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiAddTsReqParams); 
+  wdiEventData.pCBfnc          = wdiAddTsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2753,23 +2807,23 @@
         in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_AddTSReq must have been called.
 
  @param wdiDelTsReqParams: the del TS parameters as specified by
                       the Device Interface
-
+  
         wdiDelTsRspCb: callback for passing back the response of
         the del TS operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_AddTSReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_DelTSReq
 (
   WDI_DelTSReqParamsType* pwdiDelTsReqParams,
@@ -2781,23 +2835,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_DEL_TS_REQ;
-  wdiEventData.pEventData      = pwdiDelTsReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiDelTsReqParams);
-  wdiEventData.pCBfnc          = wdiDelTsRspCb;
+  wdiEventData.pEventData      = pwdiDelTsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiDelTsReqParams); 
+  wdiEventData.pCBfnc          = wdiDelTsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2807,7 +2862,7 @@
 
 
 /**
- @brief WDI_UpdateEDCAParams will be called when the upper MAC
+ @brief WDI_UpdateEDCAParams will be called when the upper MAC 
         wishes to update the EDCA parameters used by HW for QoS
         data traffic. Upon the call of this API the WLAN DAL
         will pack and send a HAL Update EDCA Params request
@@ -2815,23 +2870,23 @@
         STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param wdiUpdateEDCAParams: the start parameters as specified
+ @param wdiUpdateEDCAParams: the start parameters as specified 
                       by the Device Interface
-
+  
         wdiUpdateEDCAParamsRspCb: callback for passing back the
         response of the start operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_UpdateEDCAParams
 (
   WDI_UpdateEDCAParamsType*    pwdiUpdateEDCAParams,
@@ -2843,23 +2898,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_UPD_EDCA_PRMS_REQ;
-  wdiEventData.pEventData      = pwdiUpdateEDCAParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateEDCAParams);
-  wdiEventData.pCBfnc          = wdiUpdateEDCAParamsRspCb;
+  wdiEventData.pEventData      = pwdiUpdateEDCAParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateEDCAParams); 
+  wdiEventData.pCBfnc          = wdiUpdateEDCAParamsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2876,23 +2932,23 @@
         in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
  @param wdiAddBAReqParams: the add BA parameters as specified by
                       the Device Interface
-
+  
         wdiAddBARspCb: callback for passing back the response of
         the add BA operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_AddBASessionReq
 (
   WDI_AddBASessionReqParamsType* pwdiAddBASessionReqParams,
@@ -2904,23 +2960,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_ADD_BA_SESSION_REQ;
-  wdiEventData.pEventData      = pwdiAddBASessionReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiAddBASessionReqParams);
-  wdiEventData.pCBfnc          = wdiAddBASessionRspCb;
+  wdiEventData.pEventData      = pwdiAddBASessionReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiAddBASessionReqParams); 
+  wdiEventData.pCBfnc          = wdiAddBASessionRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -2928,30 +2985,30 @@
 }/*WDI_AddBASessionReq*/
 
 /**
- @brief WDI_DelBAReq will be called when the upper MAC wants to
+ @brief WDI_DelBAReq will be called when the upper MAC wants to 
         inform HW that it has deleted a previously created BA
         session. Upon the call of this API the WLAN DAL will
         pack and send a HAL Del BA request message to the lower
         RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_AddBAReq must have been called.
 
  @param wdiDelBAReqParams: the del BA parameters as specified by
                       the Device Interface
-
+  
         wdiDelBARspCb: callback for passing back the response of
         the del BA operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_AddBAReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_DelBAReq
 (
   WDI_DelBAReqParamsType* pwdiDelBAReqParams,
@@ -2963,61 +3020,62 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_DEL_BA_REQ;
-  wdiEventData.pEventData      = pwdiDelBAReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiDelBAReqParams);
-  wdiEventData.pCBfnc          = wdiDelBARspCb;
+  wdiEventData.pEventData      = pwdiDelBAReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiDelBAReqParams); 
+  wdiEventData.pCBfnc          = wdiDelBARspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 
 }/*WDI_DelBAReq*/
 
-/*========================================================================
-
+/*======================================================================== 
+ 
                             Power Save APIs
-
+ 
 ==========================================================================*/
 
 /**
- @brief WDI_SetPwrSaveCfgReq will be called when the upper MAC
+ @brief WDI_SetPwrSaveCfgReq will be called when the upper MAC 
         wants to set the power save related configurations of
         the WLAN Device. Upon the call of this API the WLAN DAL
         will pack and send a HAL Update CFG request message to
         the lower RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_Start must have been called.
 
- @param pwdiPowerSaveCfg: the power save cfg parameters as
+ @param pwdiPowerSaveCfg: the power save cfg parameters as 
                       specified by the Device Interface
-
+  
         wdiSetPwrSaveCfgCb: callback for passing back the
         response of the set power save cfg operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_Start
- @return Result of the function call
-*/
-WDI_Status
+ @return Result of the function call  
+*/ 
+WDI_Status 
 WDI_SetPwrSaveCfgReq
 (
   WDI_UpdateCfgReqParamsType*   pwdiPowerSaveCfg,
@@ -3029,23 +3087,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_UPDATE_CFG_REQ;
-  wdiEventData.pEventData      = pwdiPowerSaveCfg;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiPowerSaveCfg);
-  wdiEventData.pCBfnc          = wdiSetPwrSaveCfgCb;
+  wdiEventData.pEventData      = pwdiPowerSaveCfg; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiPowerSaveCfg); 
+  wdiEventData.pCBfnc          = wdiSetPwrSaveCfgCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -3053,27 +3112,27 @@
 }/*WDI_SetPwrSaveCfgReq*/
 
 /**
- @brief WDI_EnterImpsReq will be called when the upper MAC to
+ @brief WDI_EnterImpsReq will be called when the upper MAC to 
         request the device to get into IMPS power state. Upon
         the call of this API the WLAN DAL will send a HAL Enter
         IMPS request message to the lower RIVA sub-system if DAL
         is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
-
- @param wdiEnterImpsRspCb: callback for passing back the
+  
+ @param wdiEnterImpsRspCb: callback for passing back the 
         response of the Enter IMPS operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_Start
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_EnterImpsReq
 (
    WDI_EnterImpsRspCb  wdiEnterImpsRspCb,
@@ -3084,23 +3143,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_ENTER_IMPS_REQ;
-  wdiEventData.pEventData      = NULL;
-  wdiEventData.uEventDataSize  = 0;
-  wdiEventData.pCBfnc          = wdiEnterImpsRspCb;
+  wdiEventData.pEventData      = NULL; 
+  wdiEventData.uEventDataSize  = 0; 
+  wdiEventData.pCBfnc          = wdiEnterImpsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -3108,27 +3168,27 @@
 }/*WDI_EnterImpsReq*/
 
 /**
- @brief WDI_ExitImpsReq will be called when the upper MAC to
+ @brief WDI_ExitImpsReq will be called when the upper MAC to 
         request the device to get out of IMPS power state. Upon
         the call of this API the WLAN DAL will send a HAL Exit
         IMPS request message to the lower RIVA sub-system if DAL
         is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
+ 
 
-
- @param wdiExitImpsRspCb: callback for passing back the response
+ @param wdiExitImpsRspCb: callback for passing back the response 
         of the Exit IMPS operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_Start
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_ExitImpsReq
 (
    WDI_ExitImpsRspCb  wdiExitImpsRspCb,
@@ -3139,23 +3199,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_EXIT_IMPS_REQ;
-  wdiEventData.pEventData      = NULL;
-  wdiEventData.uEventDataSize  = 0;
-  wdiEventData.pCBfnc          = wdiExitImpsRspCb;
+  wdiEventData.pEventData      = NULL; 
+  wdiEventData.uEventDataSize  = 0; 
+  wdiEventData.pCBfnc          = wdiExitImpsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -3163,31 +3224,31 @@
 }/*WDI_ExitImpsReq*/
 
 /**
- @brief WDI_EnterBmpsReq will be called when the upper MAC to
+ @brief WDI_EnterBmpsReq will be called when the upper MAC to 
         request the device to get into BMPS power state. Upon
         the call of this API the WLAN DAL will pack and send a
         HAL Enter BMPS request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param pwdiEnterBmpsReqParams: the Enter BMPS parameters as
+ @param pwdiEnterBmpsReqParams: the Enter BMPS parameters as 
                       specified by the Device Interface
-
+  
         wdiEnterBmpsRspCb: callback for passing back the
         response of the Enter BMPS operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_EnterBmpsReq
 (
    WDI_EnterBmpsReqParamsType *pwdiEnterBmpsReqParams,
@@ -3199,23 +3260,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_ENTER_BMPS_REQ;
-  wdiEventData.pEventData      = pwdiEnterBmpsReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiEnterBmpsReqParams);
-  wdiEventData.pCBfnc          = wdiEnterBmpsRspCb;
+  wdiEventData.pEventData      = pwdiEnterBmpsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiEnterBmpsReqParams); 
+  wdiEventData.pCBfnc          = wdiEnterBmpsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -3223,30 +3285,30 @@
 }/*WDI_EnterBmpsReq*/
 
 /**
- @brief WDI_ExitBmpsReq will be called when the upper MAC to
+ @brief WDI_ExitBmpsReq will be called when the upper MAC to 
         request the device to get out of BMPS power state. Upon
         the call of this API the WLAN DAL will pack and send a
         HAL Exit BMPS request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param pwdiExitBmpsReqParams: the Exit BMPS parameters as
+ @param pwdiExitBmpsReqParams: the Exit BMPS parameters as 
                       specified by the Device Interface
-
+  
         wdiExitBmpsRspCb: callback for passing back the response
         of the Exit BMPS operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_ExitBmpsReq
 (
    WDI_ExitBmpsReqParamsType *pwdiExitBmpsReqParams,
@@ -3258,23 +3320,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_EXIT_BMPS_REQ;
-  wdiEventData.pEventData      = pwdiExitBmpsReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiExitBmpsReqParams);
-  wdiEventData.pCBfnc          = wdiExitBmpsRspCb;
+  wdiEventData.pEventData      = pwdiExitBmpsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiExitBmpsReqParams); 
+  wdiEventData.pCBfnc          = wdiExitBmpsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -3282,32 +3345,32 @@
 }/*WDI_ExitBmpsReq*/
 
 /**
- @brief WDI_EnterUapsdReq will be called when the upper MAC to
+ @brief WDI_EnterUapsdReq will be called when the upper MAC to 
         request the device to get into UAPSD power state. Upon
         the call of this API the WLAN DAL will pack and send a
         HAL Enter UAPSD request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
  WDI_SetUapsdAcParamsReq must have been called.
-
- @param pwdiEnterUapsdReqParams: the Enter UAPSD parameters as
+  
+ @param pwdiEnterUapsdReqParams: the Enter UAPSD parameters as 
                       specified by the Device Interface
-
+  
         wdiEnterUapsdRspCb: callback for passing back the
         response of the Enter UAPSD operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq, WDI_SetUapsdAcParamsReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_EnterUapsdReq
 (
    WDI_EnterUapsdReqParamsType *pwdiEnterUapsdReqParams,
@@ -3319,23 +3382,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_ENTER_UAPSD_REQ;
-  wdiEventData.pEventData      = pwdiEnterUapsdReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiEnterUapsdReqParams);
-  wdiEventData.pCBfnc          = wdiEnterUapsdRspCb;
+  wdiEventData.pEventData      = pwdiEnterUapsdReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiEnterUapsdReqParams); 
+  wdiEventData.pCBfnc          = wdiEnterUapsdRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -3343,28 +3407,28 @@
 }/*WDI_EnterUapsdReq*/
 
 /**
- @brief WDI_ExitUapsdReq will be called when the upper MAC to
+ @brief WDI_ExitUapsdReq will be called when the upper MAC to 
         request the device to get out of UAPSD power state. Upon
         the call of this API the WLAN DAL will send a HAL Exit
         UAPSD request message to the lower RIVA sub-system if
         DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param wdiExitUapsdRspCb: callback for passing back the
+ @param wdiExitUapsdRspCb: callback for passing back the 
         response of the Exit UAPSD operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_ExitUapsdReq
 (
    WDI_ExitUapsdRspCb  wdiExitUapsdRspCb,
@@ -3375,23 +3439,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_EXIT_UAPSD_REQ;
-  wdiEventData.pEventData      = NULL;
-  wdiEventData.uEventDataSize  = 0;
-  wdiEventData.pCBfnc          = wdiExitUapsdRspCb;
+  wdiEventData.pEventData      = NULL; 
+  wdiEventData.uEventDataSize  = 0; 
+  wdiEventData.pCBfnc          = wdiExitUapsdRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -3399,7 +3464,7 @@
 }/*WDI_ExitUapsdReq*/
 
 /**
- @brief WDI_UpdateUapsdParamsReq will be called when the upper
+ @brief WDI_UpdateUapsdParamsReq will be called when the upper 
         MAC wants to set the UAPSD related configurations
         of an associated STA (while acting as an AP) to the WLAN
         Device. Upon the call of this API the WLAN DAL will pack
@@ -3407,24 +3472,24 @@
         the lower RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_ConfigBSSReq must have been called.
 
- @param pwdiUpdateUapsdReqParams: the UAPSD parameters
+ @param pwdiUpdateUapsdReqParams: the UAPSD parameters 
                       as specified by the Device Interface
-
+  
         wdiUpdateUapsdParamsCb: callback for passing back the
         response of the update UAPSD params operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_ConfigBSSReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_UpdateUapsdParamsReq
 (
    WDI_UpdateUapsdReqParamsType *pwdiUpdateUapsdReqParams,
@@ -3436,23 +3501,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_UPDATE_UAPSD_PARAM_REQ;
-  wdiEventData.pEventData      = pwdiUpdateUapsdReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateUapsdReqParams);;
-  wdiEventData.pCBfnc          = wdiUpdateUapsdParamsCb;
+  wdiEventData.pEventData      = pwdiUpdateUapsdReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateUapsdReqParams);; 
+  wdiEventData.pCBfnc          = wdiUpdateUapsdParamsCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -3460,7 +3526,7 @@
 }/*WDI_UpdateUapsdParamsReq*/
 
 /**
- @brief WDI_SetUapsdAcParamsReq will be called when the upper
+ @brief WDI_SetUapsdAcParamsReq will be called when the upper 
         MAC wants to set the UAPSD related configurations before
         requesting for enter UAPSD power state to the WLAN
         Device. Upon the call of this API the WLAN DAL will pack
@@ -3468,24 +3534,24 @@
         the lower RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
  @param pwdiUapsdInfo: the UAPSD parameters as specified by
                       the Device Interface
-
+  
         wdiSetUapsdAcParamsCb: callback for passing back the
         response of the set UAPSD params operation received from
         the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetUapsdAcParamsReq
 (
   WDI_SetUapsdAcParamsReqParamsType*      pwdiUapsdInfo,
@@ -3497,23 +3563,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_SET_UAPSD_PARAM_REQ;
-  wdiEventData.pEventData      = pwdiUapsdInfo;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiUapsdInfo);
-  wdiEventData.pCBfnc          = wdiSetUapsdAcParamsCb;
+  wdiEventData.pEventData      = pwdiUapsdInfo; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUapsdInfo); 
+  wdiEventData.pCBfnc          = wdiSetUapsdAcParamsCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -3521,30 +3588,30 @@
 }/*WDI_SetUapsdAcParamsReq*/
 
 /**
- @brief WDI_ConfigureRxpFilterReq will be called when the upper
+ @brief WDI_ConfigureRxpFilterReq will be called when the upper 
         MAC wants to set/reset the RXP filters for received pkts
         (MC, BC etc.). Upon the call of this API the WLAN DAL will pack
         and send a HAL configure RXP filter request message to
         the lower RIVA sub-system.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
-
- @param pwdiConfigureRxpFilterReqParams: the RXP
+  
+ @param pwdiConfigureRxpFilterReqParams: the RXP 
                       filter as specified by the Device
                       Interface
-
+  
         wdiConfigureRxpFilterCb: callback for passing back the
         response of the configure RXP filter operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_ConfigureRxpFilterReq
 (
    WDI_ConfigureRxpFilterReqParamsType *pwdiConfigureRxpFilterReqParams,
@@ -3556,23 +3623,24 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_CONFIGURE_RXP_FILTER_REQ;
-   wdiEventData.pEventData      = pwdiConfigureRxpFilterReqParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiConfigureRxpFilterReqParams);
-   wdiEventData.pCBfnc          = wdiConfigureRxpFilterCb;
+   wdiEventData.pEventData      = pwdiConfigureRxpFilterReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiConfigureRxpFilterReqParams); 
+   wdiEventData.pCBfnc          = wdiConfigureRxpFilterCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -3586,23 +3654,23 @@
         lower RIVA sub-system.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
-
- @param pwdiBeaconFilterReqParams: the beacon
+  
+ @param pwdiBeaconFilterReqParams: the beacon 
                       filter as specified by the Device
                       Interface
-
+  
         wdiBeaconFilterCb: callback for passing back the
         response of the set beacon filter operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetBeaconFilterReq
 (
    WDI_BeaconFilterReqParamsType   *pwdiBeaconFilterReqParams,
@@ -3614,23 +3682,24 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_SET_BEACON_FILTER_REQ;
-   wdiEventData.pEventData      = pwdiBeaconFilterReqParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiBeaconFilterReqParams);;
-   wdiEventData.pCBfnc          = wdiBeaconFilterCb;
+   wdiEventData.pEventData      = pwdiBeaconFilterReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiBeaconFilterReqParams);; 
+   wdiEventData.pCBfnc          = wdiBeaconFilterCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -3644,23 +3713,23 @@
         message to the lower RIVA sub-system.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
-
- @param pwdiBeaconFilterReqParams: the beacon
+  
+ @param pwdiBeaconFilterReqParams: the beacon 
                       filter as specified by the Device
                       Interface
-
+  
         wdiBeaconFilterCb: callback for passing back the
         response of the remove beacon filter operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_RemBeaconFilterReq
 (
    WDI_RemBeaconFilterReqParamsType *pwdiBeaconFilterReqParams,
@@ -3672,30 +3741,31 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_REM_BEACON_FILTER_REQ;
-   wdiEventData.pEventData      = pwdiBeaconFilterReqParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiBeaconFilterReqParams);;
-   wdiEventData.pCBfnc          = wdiBeaconFilterCb;
+   wdiEventData.pEventData      = pwdiBeaconFilterReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiBeaconFilterReqParams);; 
+   wdiEventData.pCBfnc          = wdiBeaconFilterCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }/*WDI_RemBeaconFilterReq*/
 
 /**
- @brief WDI_SetRSSIThresholdsReq will be called when the upper
+ @brief WDI_SetRSSIThresholdsReq will be called when the upper 
         MAC wants to set the RSSI thresholds related
         configurations while in power save. Upon the call of
         this API the WLAN DAL will pack and send a HAL Set RSSI
@@ -3703,24 +3773,24 @@
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
  @param pwdiUapsdInfo: the UAPSD parameters as specified by
                       the Device Interface
-
+  
         wdiSetUapsdAcParamsCb: callback for passing back the
         response of the set UAPSD params operation received from
         the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetRSSIThresholdsReq
 (
   WDI_SetRSSIThresholdsReqParamsType*      pwdiRSSIThresholdsParams,
@@ -3732,30 +3802,31 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_SET_RSSI_THRESHOLDS_REQ;
-   wdiEventData.pEventData      = pwdiRSSIThresholdsParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiRSSIThresholdsParams);;
-   wdiEventData.pCBfnc          = wdiSetRSSIThresholdsCb;
+   wdiEventData.pEventData      = pwdiRSSIThresholdsParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiRSSIThresholdsParams);; 
+   wdiEventData.pCBfnc          = wdiSetRSSIThresholdsCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }/* WDI_SetRSSIThresholdsReq*/
 
 /**
- @brief WDI_HostOffloadReq will be called when the upper MAC
+ @brief WDI_HostOffloadReq will be called when the upper MAC 
         wants to set the filter to minimize unnecessary host
         wakeup due to broadcast traffic while in power save.
         Upon the call of this API the WLAN DAL will pack and
@@ -3763,24 +3834,24 @@
         lower RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param pwdiHostOffloadParams: the host offload as specified
+ @param pwdiHostOffloadParams: the host offload as specified 
                       by the Device Interface
-
+  
         wdiHostOffloadCb: callback for passing back the response
         of the host offload operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_HostOffloadReq
 (
   WDI_HostOffloadReqParamsType*      pwdiHostOffloadParams,
@@ -3792,55 +3863,56 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_HOST_OFFLOAD_REQ;
-   wdiEventData.pEventData      = pwdiHostOffloadParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiHostOffloadParams);;
-   wdiEventData.pCBfnc          = wdiHostOffloadCb;
+   wdiEventData.pEventData      = pwdiHostOffloadParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiHostOffloadParams);; 
+   wdiEventData.pCBfnc          = wdiHostOffloadCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }/*WDI_HostOffloadReq*/
 
 /**
- @brief WDI_KeepAliveReq will be called when the upper MAC
-        wants to set the filter to send NULL or unsolicited ARP responses
+ @brief WDI_KeepAliveReq will be called when the upper MAC 
+        wants to set the filter to send NULL or unsolicited ARP responses 
         and minimize unnecessary host wakeups due to while in power save.
         Upon the call of this API the WLAN DAL will pack and
         send a HAL Keep Alive request message to the
         lower RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param pwdiKeepAliveParams: the Keep Alive as specified
+ @param pwdiKeepAliveParams: the Keep Alive as specified 
                       by the Device Interface
-
+  
         wdiKeepAliveCb: callback for passing back the response
         of the Keep Alive operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_KeepAliveReq
 (
   WDI_KeepAliveReqParamsType*        pwdiKeepAliveParams,
@@ -3852,31 +3924,32 @@
     /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
     /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
     ------------------------------------------------------------------------*/
     if ( eWLAN_PAL_FALSE == gWDIInitialized )
     {
+#ifdef WLAN_DEBUG
          WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                     "WDI_KeepAliveReq: WDI API call before module "
                     "is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
     }
 
     /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
     ------------------------------------------------------------------------*/
     wdiEventData.wdiRequest      = WDI_KEEP_ALIVE_REQ;
-    wdiEventData.pEventData      = pwdiKeepAliveParams;
-    wdiEventData.uEventDataSize  = sizeof(*pwdiKeepAliveParams);
-    wdiEventData.pCBfnc          = wdiKeepAliveCb;
+    wdiEventData.pEventData      = pwdiKeepAliveParams; 
+    wdiEventData.uEventDataSize  = sizeof(*pwdiKeepAliveParams); 
+    wdiEventData.pCBfnc          = wdiKeepAliveCb; 
     wdiEventData.pUserData       = pUserData;
 
     return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }/*WDI_KeepAliveReq*/
 
 /**
- @brief WDI_WowlAddBcPtrnReq will be called when the upper MAC
+ @brief WDI_WowlAddBcPtrnReq will be called when the upper MAC 
         wants to set the Wowl Bcast ptrn to minimize unnecessary
         host wakeup due to broadcast traffic while in power
         save. Upon the call of this API the WLAN DAL will pack
@@ -3884,24 +3957,24 @@
         lower RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param pwdiWowlAddBcPtrnParams: the Wowl bcast ptrn as
+ @param pwdiWowlAddBcPtrnParams: the Wowl bcast ptrn as 
                       specified by the Device Interface
-
+  
         wdiWowlAddBcPtrnCb: callback for passing back the
         response of the add Wowl bcast ptrn operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_WowlAddBcPtrnReq
 (
   WDI_WowlAddBcPtrnReqParamsType*    pwdiWowlAddBcPtrnParams,
@@ -3913,54 +3986,55 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_WOWL_ADD_BC_PTRN_REQ;
-   wdiEventData.pEventData      = pwdiWowlAddBcPtrnParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiWowlAddBcPtrnParams);;
-   wdiEventData.pCBfnc          = wdiWowlAddBcPtrnCb;
+   wdiEventData.pEventData      = pwdiWowlAddBcPtrnParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiWowlAddBcPtrnParams);; 
+   wdiEventData.pCBfnc          = wdiWowlAddBcPtrnCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }/*WDI_WowlAddBcPtrnReq*/
 
 /**
- @brief WDI_WowlDelBcPtrnReq will be called when the upper MAC
+ @brief WDI_WowlDelBcPtrnReq will be called when the upper MAC 
         wants to clear the Wowl Bcast ptrn. Upon the call of
         this API the WLAN DAL will pack and send a HAL delete
         Wowl Bcast ptrn request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_WowlAddBcPtrnReq must have been called.
 
- @param pwdiWowlDelBcPtrnParams: the Wowl bcast ptrn as
+ @param pwdiWowlDelBcPtrnParams: the Wowl bcast ptrn as 
                       specified by the Device Interface
-
+  
         wdiWowlDelBcPtrnCb: callback for passing back the
         response of the del Wowl bcast ptrn operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_WowlAddBcPtrnReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_WowlDelBcPtrnReq
 (
   WDI_WowlDelBcPtrnReqParamsType*    pwdiWowlDelBcPtrnParams,
@@ -3972,30 +4046,31 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_WOWL_DEL_BC_PTRN_REQ;
-   wdiEventData.pEventData      = pwdiWowlDelBcPtrnParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiWowlDelBcPtrnParams);;
-   wdiEventData.pCBfnc          = wdiWowlDelBcPtrnCb;
+   wdiEventData.pEventData      = pwdiWowlDelBcPtrnParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiWowlDelBcPtrnParams);; 
+   wdiEventData.pCBfnc          = wdiWowlDelBcPtrnCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }/*WDI_WowlDelBcPtrnReq*/
 
 /**
- @brief WDI_WowlEnterReq will be called when the upper MAC
+ @brief WDI_WowlEnterReq will be called when the upper MAC 
         wants to enter the Wowl state to minimize unnecessary
         host wakeup while in power save. Upon the call of this
         API the WLAN DAL will pack and send a HAL Wowl enter
@@ -4003,24 +4078,24 @@
         in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param pwdiWowlEnterReqParams: the Wowl enter info as
+ @param pwdiWowlEnterReqParams: the Wowl enter info as 
                       specified by the Device Interface
-
+  
         wdiWowlEnterReqCb: callback for passing back the
         response of the enter Wowl operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_WowlEnterReq
 (
   WDI_WowlEnterReqParamsType*    pwdiWowlEnterParams,
@@ -4032,53 +4107,54 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_WOWL_ENTER_REQ;
-   wdiEventData.pEventData      = pwdiWowlEnterParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiWowlEnterParams);;
-   wdiEventData.pCBfnc          = wdiWowlEnterCb;
+   wdiEventData.pEventData      = pwdiWowlEnterParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiWowlEnterParams);; 
+   wdiEventData.pCBfnc          = wdiWowlEnterCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }/*WDI_WowlEnterReq*/
 
 /**
- @brief WDI_WowlExitReq will be called when the upper MAC
+ @brief WDI_WowlExitReq will be called when the upper MAC 
         wants to exit the Wowl state. Upon the call of this API
         the WLAN DAL will pack and send a HAL Wowl exit request
         message to the lower RIVA sub-system if DAL is in state
         STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_WowlEnterReq must have been called.
 
- @param pwdiWowlExitReqParams: the Wowl exit info as
+ @param pwdiWowlExitReqParams: the Wowl exit info as 
                       specified by the Device Interface
-
+  
         wdiWowlExitReqCb: callback for passing back the response
         of the exit Wowl operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_WowlEnterReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_WowlExitReq
 (
   WDI_WowlExitReqCb              wdiWowlExitCb,
@@ -4089,30 +4165,31 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_WOWL_EXIT_REQ;
-   wdiEventData.pEventData      = NULL;
-   wdiEventData.uEventDataSize  = 0;
-   wdiEventData.pCBfnc          = wdiWowlExitCb;
+   wdiEventData.pEventData      = NULL; 
+   wdiEventData.uEventDataSize  = 0; 
+   wdiEventData.pCBfnc          = wdiWowlExitCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }/*WDI_WowlExitReq*/
 
 /**
- @brief WDI_ConfigureAppsCpuWakeupStateReq will be called when
+ @brief WDI_ConfigureAppsCpuWakeupStateReq will be called when 
         the upper MAC wants to dynamically adjusts the listen
         interval based on the WLAN/MSM activity. Upon the call
         of this API the WLAN DAL will pack and send a HAL
@@ -4120,23 +4197,23 @@
         lower RIVA sub-system.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
-
- @param pwdiConfigureAppsCpuWakeupStateReqParams: the
+  
+ @param pwdiConfigureAppsCpuWakeupStateReqParams: the 
                       Apps Cpu Wakeup State as specified by the
                       Device Interface
-
+  
         wdiConfigureAppsCpuWakeupStateCb: callback for passing
         back the response of the configure Apps Cpu Wakeup State
         operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_ConfigureAppsCpuWakeupStateReq
 (
    WDI_ConfigureAppsCpuWakeupStateReqParamsType *pwdiConfigureAppsCpuWakeupStateReqParams,
@@ -4148,52 +4225,53 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ;
-   wdiEventData.pEventData      = pwdiConfigureAppsCpuWakeupStateReqParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiConfigureAppsCpuWakeupStateReqParams);
-   wdiEventData.pCBfnc          = wdiConfigureAppsCpuWakeupStateCb;
+   wdiEventData.pEventData      = pwdiConfigureAppsCpuWakeupStateReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiConfigureAppsCpuWakeupStateReqParams); 
+   wdiEventData.pCBfnc          = wdiConfigureAppsCpuWakeupStateCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }/*WDI_ConfigureAppsCpuWakeupStateReq*/
 /**
- @brief WDI_FlushAcReq will be called when the upper MAC wants
+ @brief WDI_FlushAcReq will be called when the upper MAC wants 
         to to perform a flush operation on a given AC. Upon the
         call of this API the WLAN DAL will pack and send a HAL
         Flush AC request message to the lower RIVA sub-system if
         DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_AddBAReq must have been called.
 
- @param pwdiFlushAcReqParams: the Flush AC parameters as
+ @param pwdiFlushAcReqParams: the Flush AC parameters as 
                       specified by the Device Interface
-
+  
         wdiFlushAcRspCb: callback for passing back the response
         of the Flush AC operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_AddBAReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_FlushAcReq
 (
   WDI_FlushAcReqParamsType* pwdiFlushAcReqParams,
@@ -4205,23 +4283,24 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_FLUSH_AC_REQ;
-   wdiEventData.pEventData      = pwdiFlushAcReqParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiFlushAcReqParams);
-   wdiEventData.pCBfnc          = wdiFlushAcRspCb;
+   wdiEventData.pEventData      = pwdiFlushAcReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiFlushAcReqParams); 
+   wdiEventData.pCBfnc          = wdiFlushAcRspCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4229,7 +4308,7 @@
 }/*WDI_FlushAcReq*/
 
 /**
- @brief WDI_BtAmpEventReq will be called when the upper MAC
+ @brief WDI_BtAmpEventReq will be called when the upper MAC 
         wants to notify the lower mac on a BT AMP event. This is
         to inform BTC-SLM that some BT AMP event occurred. Upon
         the call of this API the WLAN DAL will pack and send a
@@ -4237,22 +4316,22 @@
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
-
- @param wdiBtAmpEventReqParams: the BT AMP event parameters as
+  
+ @param wdiBtAmpEventReqParams: the BT AMP event parameters as 
                       specified by the Device Interface
-
+  
         wdiBtAmpEventRspCb: callback for passing back the
         response of the BT AMP event operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+ 
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_BtAmpEventReq
 (
   WDI_BtAmpEventParamsType* pwdiBtAmpEventReqParams,
@@ -4264,23 +4343,24 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_BTAMP_EVENT_REQ;
-   wdiEventData.pEventData      = pwdiBtAmpEventReqParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiBtAmpEventReqParams);
-   wdiEventData.pCBfnc          = wdiBtAmpEventRspCb;
+   wdiEventData.pEventData      = pwdiBtAmpEventReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiBtAmpEventReqParams); 
+   wdiEventData.pCBfnc          = wdiBtAmpEventRspCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4289,30 +4369,29 @@
 
 #ifdef FEATURE_OEM_DATA_SUPPORT
 /**
- @brief WDI_Start Oem Data Req will be called when the upper MAC
+ @brief WDI_Start Oem Data Req will be called when the upper MAC 
         wants to notify the lower mac on a oem data Req event.Upon
         the call of this API the WLAN DAL will pack and send a
         HAL OEM Data Req event request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
-
-
- @param pwdiOemDataReqParams: the Oem Data Req as
-        specified by the Device Interface
-
+  
+ @param pwdiOemDataReqParams: the Oem Data Req as 
+                      specified by the Device Interface
+  
         wdiStartOemDataRspCb: callback for passing back the
         response of the Oem Data Req received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+ 
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_StartOemDataReq
 (
   WDI_oemDataReqParamsType*         pwdiOemDataReqParams,
@@ -4324,23 +4403,24 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_START_OEM_DATA_REQ;
-   wdiEventData.pEventData      = pwdiOemDataReqParams;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiOemDataReqParams);
-   wdiEventData.pCBfnc          = wdiOemDataRspCb;
+   wdiEventData.pEventData      = pwdiOemDataReqParams; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiOemDataReqParams); 
+   wdiEventData.pCBfnc          = wdiOemDataRspCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4351,36 +4431,36 @@
 #endif
 
 
-/*========================================================================
-
+/*======================================================================== 
+ 
                              CONTROL APIs
-
+ 
 ==========================================================================*/
 /**
- @brief WDI_SwitchChReq will be called when the upper MAC wants
+ @brief WDI_SwitchChReq will be called when the upper MAC wants 
         the WLAN HW to change the current channel of operation.
         Upon the call of this API the WLAN DAL will pack and
         send a HAL Start request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_Start must have been called.
 
- @param wdiSwitchChReqParams: the switch ch parameters as
+ @param wdiSwitchChReqParams: the switch ch parameters as 
                       specified by the Device Interface
-
+  
         wdiSwitchChRspCb: callback for passing back the response
         of the switch ch operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_Start
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SwitchChReq
 (
   WDI_SwitchChReqParamsType* pwdiSwitchChReqParams,
@@ -4392,23 +4472,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_CH_SWITCH_REQ;
-  wdiEventData.pEventData      = pwdiSwitchChReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiSwitchChReqParams);
-  wdiEventData.pCBfnc          = wdiSwitchChRspCb;
+  wdiEventData.pEventData      = pwdiSwitchChReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSwitchChReqParams); 
+  wdiEventData.pCBfnc          = wdiSwitchChRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4417,31 +4498,31 @@
 
 
 /**
- @brief WDI_ConfigSTAReq will be called when the upper MAC
+ @brief WDI_ConfigSTAReq will be called when the upper MAC 
         wishes to add or update a STA in HW. Upon the call of
         this API the WLAN DAL will pack and send a HAL Start
         message request message to the lower RIVA sub-system if
         DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_Start must have been called.
 
- @param wdiConfigSTAReqParams: the config STA parameters as
+ @param wdiConfigSTAReqParams: the config STA parameters as 
                       specified by the Device Interface
-
+  
         wdiConfigSTARspCb: callback for passing back the
         response of the config STA operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_Start
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_ConfigSTAReq
 (
   WDI_ConfigSTAReqParamsType* pwdiConfigSTAReqParams,
@@ -4453,23 +4534,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_CONFIG_STA_REQ;
-  wdiEventData.pEventData      = pwdiConfigSTAReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiConfigSTAReqParams);
-  wdiEventData.pCBfnc          = wdiConfigSTARspCb;
+  wdiEventData.pEventData      = pwdiConfigSTAReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiConfigSTAReqParams); 
+  wdiEventData.pCBfnc          = wdiConfigSTARspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4477,31 +4559,31 @@
 }/*WDI_ConfigSTAReq*/
 
 /**
- @brief WDI_SetLinkStateReq will be called when the upper MAC
+ @brief WDI_SetLinkStateReq will be called when the upper MAC 
         wants to change the state of an ongoing link. Upon the
         call of this API the WLAN DAL will pack and send a HAL
         Start message request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_JoinStartReq must have been called.
 
- @param wdiSetLinkStateReqParams: the set link state parameters
+ @param wdiSetLinkStateReqParams: the set link state parameters 
                       as specified by the Device Interface
-
+  
         wdiSetLinkStateRspCb: callback for passing back the
         response of the set link state operation received from
         the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_JoinStartReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetLinkStateReq
 (
   WDI_SetLinkReqParamsType* pwdiSetLinkStateReqParams,
@@ -4513,23 +4595,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_SET_LINK_ST_REQ;
-  wdiEventData.pEventData      = pwdiSetLinkStateReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiSetLinkStateReqParams);
-  wdiEventData.pCBfnc          = wdiSetLinkStateRspCb;
+  wdiEventData.pEventData      = pwdiSetLinkStateReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSetLinkStateReqParams); 
+  wdiEventData.pCBfnc          = wdiSetLinkStateRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4538,30 +4621,30 @@
 
 
 /**
- @brief WDI_GetStatsReq will be called when the upper MAC wants
+ @brief WDI_GetStatsReq will be called when the upper MAC wants 
         to get statistics (MIB counters) from the device. Upon
         the call of this API the WLAN DAL will pack and send a
         HAL Start request message to the lower RIVA sub-system
         if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_Start must have been called.
 
- @param wdiGetStatsReqParams: the stats parameters to get as
+ @param wdiGetStatsReqParams: the stats parameters to get as 
                       specified by the Device Interface
-
+  
         wdiGetStatsRspCb: callback for passing back the response
         of the get stats operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_Start
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_GetStatsReq
 (
   WDI_GetStatsReqParamsType* pwdiGetStatsReqParams,
@@ -4573,23 +4656,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_GET_STATS_REQ;
-  wdiEventData.pEventData      = pwdiGetStatsReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiGetStatsReqParams);
-  wdiEventData.pCBfnc          = wdiGetStatsRspCb;
+  wdiEventData.pEventData      = pwdiGetStatsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiGetStatsReqParams); 
+  wdiEventData.pCBfnc          = wdiGetStatsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4598,31 +4682,31 @@
 
 
 /**
- @brief WDI_UpdateCfgReq will be called when the upper MAC when
+ @brief WDI_UpdateCfgReq will be called when the upper MAC when 
         it wishes to change the configuration of the WLAN
         Device. Upon the call of this API the WLAN DAL will pack
         and send a HAL Update CFG request message to the lower
         RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_Start must have been called.
 
- @param wdiUpdateCfgReqParams: the update cfg parameters as
+ @param wdiUpdateCfgReqParams: the update cfg parameters as 
                       specified by the Device Interface
-
+  
         wdiUpdateCfgsRspCb: callback for passing back the
         response of the update cfg operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_Start
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_UpdateCfgReq
 (
   WDI_UpdateCfgReqParamsType* pwdiUpdateCfgReqParams,
@@ -4634,23 +4718,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_UPDATE_CFG_REQ;
-  wdiEventData.pEventData      = pwdiUpdateCfgReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateCfgReqParams);
-  wdiEventData.pCBfnc          = wdiUpdateCfgsRspCb;
+  wdiEventData.pEventData      = pwdiUpdateCfgReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateCfgReqParams); 
+  wdiEventData.pCBfnc          = wdiUpdateCfgsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4668,23 +4753,23 @@
         in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
  @param wdiAddBAReqParams: the add BA parameters as specified by
                       the Device Interface
-
+  
         wdiAddBARspCb: callback for passing back the response of
         the add BA operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_AddBAReq
 (
   WDI_AddBAReqParamsType* pwdiAddBAReqParams,
@@ -4696,23 +4781,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_ADD_BA_REQ;
-  wdiEventData.pEventData      = pwdiAddBAReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiAddBAReqParams);
-  wdiEventData.pCBfnc          = wdiAddBARspCb;
+  wdiEventData.pEventData      = pwdiAddBAReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiAddBAReqParams); 
+  wdiEventData.pCBfnc          = wdiAddBARspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4729,23 +4815,23 @@
         in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
  @param wdiAddBAReqParams: the add BA parameters as specified by
                       the Device Interface
-
+  
         wdiAddBARspCb: callback for passing back the response of
         the add BA operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_TriggerBAReq
 (
   WDI_TriggerBAReqParamsType* pwdiTriggerBAReqParams,
@@ -4757,23 +4843,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_TRIGGER_BA_REQ;
-  wdiEventData.pEventData      = pwdiTriggerBAReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiTriggerBAReqParams);
-  wdiEventData.pCBfnc          = wdiTriggerBARspCb;
+  wdiEventData.pEventData      = pwdiTriggerBAReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiTriggerBAReqParams); 
+  wdiEventData.pCBfnc          = wdiTriggerBARspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4781,30 +4868,30 @@
 }/*WDI_AddBAReq*/
 
 /**
- @brief WDI_UpdateBeaconParamsReq will be called when the upper MAC
+ @brief WDI_UpdateBeaconParamsReq will be called when the upper MAC 
         wishes to update any of the Beacon parameters used by HW.
         Upon the call of this API the WLAN DAL will pack and send a HAL Update Beacon Params request
         message to the lower RIVA sub-system if DAL is in state
         STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param wdiUpdateBeaconParams: the Beacon parameters as specified
+ @param wdiUpdateBeaconParams: the Beacon parameters as specified 
                       by the Device Interface
-
+  
         wdiUpdateBeaconParamsRspCb: callback for passing back the
         response of the start operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_UpdateBeaconParamsReq
 (
   WDI_UpdateBeaconParamsType*    pwdiUpdateBeaconParams,
@@ -4816,23 +4903,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_UPD_BCON_PRMS_REQ;
-  wdiEventData.pEventData      = pwdiUpdateBeaconParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateBeaconParams);
-  wdiEventData.pCBfnc          = wdiUpdateBeaconParamsRspCb;
+  wdiEventData.pEventData      = pwdiUpdateBeaconParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateBeaconParams); 
+  wdiEventData.pCBfnc          = wdiUpdateBeaconParamsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4840,30 +4928,30 @@
 }/*WDI_UpdateBeaconParamsReq*/
 
 /**
- @brief WDI_SendBeaconParamsReq will be called when the upper MAC
+ @brief WDI_SendBeaconParamsReq will be called when the upper MAC 
         wishes to update  the Beacon template used by HW.
         Upon the call of this API the WLAN DAL will pack and send a HAL Update Beacon template request
         message to the lower RIVA sub-system if DAL is in state
         STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param wdiSendBeaconParams: the Beacon parameters as specified
+ @param wdiSendBeaconParams: the Beacon parameters as specified 
                       by the Device Interface
-
+  
         wdiSendBeaconParamsRspCb: callback for passing back the
         response of the start operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SendBeaconParamsReq
 (
   WDI_SendBeaconParamsType*    pwdiSendBeaconParams,
@@ -4875,23 +4963,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_SND_BCON_REQ;
-  wdiEventData.pEventData      = pwdiSendBeaconParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiSendBeaconParams);
-  wdiEventData.pCBfnc          = wdiSendBeaconParamsRspCb;
+  wdiEventData.pEventData      = pwdiSendBeaconParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSendBeaconParams); 
+  wdiEventData.pCBfnc          = wdiSendBeaconParamsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4899,7 +4988,7 @@
 }/*WDI_SendBeaconParamsReq*/
 
 /**
- @brief WDI_UpdateProbeRspTemplateReq will be called when the
+ @brief WDI_UpdateProbeRspTemplateReq will be called when the 
         upper MAC wants to update the probe response template to
         be transmitted as Soft AP
          Upon the call of this API the WLAN DAL will
@@ -4907,24 +4996,24 @@
         lower RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
 
- @param pwdiUpdateProbeRspParams: the Update Beacon parameters as
+ @param pwdiUpdateProbeRspParams: the Update Beacon parameters as 
                       specified by the Device Interface
-
+  
         wdiSendBeaconParamsRspCb: callback for passing back the
         response of the Send Beacon Params operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_AddBAReq
  @return Result of the function call
 */
 
-WDI_Status
+WDI_Status 
 WDI_UpdateProbeRspTemplateReq
 (
   WDI_UpdateProbeRspTemplateParamsType*    pwdiUpdateProbeRspParams,
@@ -4936,23 +5025,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_UPD_PROBE_RSP_TEMPLATE_REQ;
-  wdiEventData.pEventData      = pwdiUpdateProbeRspParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateProbeRspParams);
-  wdiEventData.pCBfnc          = wdiUpdateProbeRspParamsRspCb;
+  wdiEventData.pEventData      = pwdiUpdateProbeRspParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateProbeRspParams); 
+  wdiEventData.pCBfnc          = wdiUpdateProbeRspParamsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -4966,17 +5056,17 @@
 
  @param wdiNvDownloadReqParams: the NV Download parameters as specified by
                       the Device Interface
-
+  
         wdiNvDownloadRspCb: callback for passing back the response of
         the NV Download operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_NvDownloadReq
 (
   WDI_NvDownloadReqParamsType* pwdiNvDownloadReqParams,
@@ -4987,23 +5077,24 @@
   WDI_EventInfoType      wdiEventData;
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
-  wdiEventData.wdiRequest      = WDI_NV_DOWNLOAD_REQ;
-  wdiEventData.pEventData      = (void *)pwdiNvDownloadReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiNvDownloadReqParams);
-  wdiEventData.pCBfnc          = wdiNvDownloadRspCb;
+  wdiEventData.wdiRequest      = WDI_NV_DOWNLOAD_REQ;            
+  wdiEventData.pEventData      = (void *)pwdiNvDownloadReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiNvDownloadReqParams); 
+  wdiEventData.pCBfnc          = wdiNvDownloadRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_START_EVENT, &wdiEventData);
@@ -5012,26 +5103,26 @@
 
 #ifdef WLAN_FEATURE_P2P
 /**
- @brief WDI_SetP2PGONOAReq will be called when the
+ @brief WDI_SetP2PGONOAReq will be called when the 
         upper MAC wants to send Notice of Absence
          Upon the call of this API the WLAN DAL will
         pack and send the probe rsp template  message to the
         lower RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
 
- @param pwdiUpdateProbeRspParams: the Update Beacon parameters as
+ @param pwdiUpdateProbeRspParams: the Update Beacon parameters as 
                       specified by the Device Interface
-
+  
         wdiSendBeaconParamsRspCb: callback for passing back the
         response of the Send Beacon Params operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_AddBAReq
  @return Result of the function call
 */
@@ -5047,23 +5138,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_P2P_GO_NOTICE_OF_ABSENCE_REQ;
-  wdiEventData.pEventData      = pwdiP2PGONOAReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiP2PGONOAReqParams);
-  wdiEventData.pCBfnc          = wdiP2PGONOAReqParamsRspCb;
+  wdiEventData.pEventData      = pwdiP2PGONOAReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiP2PGONOAReqParams); 
+  wdiEventData.pCBfnc          = wdiP2PGONOAReqParamsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -5072,19 +5164,19 @@
 #endif
 
 /**
- @brief WDI_AddSTASelfReq will be called when the
+ @brief WDI_AddSTASelfReq will be called when the 
         UMAC wanted to add STA self while opening any new session
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
 
- @param pwdiAddSTASelfParams: the add sta self parameters as
+ @param pwdiAddSTASelfParams: the add sta self parameters as 
                       specified by the Device Interface
-
+  
         pUserData: user data will be passed back with the
-        callback
-
- @see
+        callback 
+  
+ @see 
  @return Result of the function call
 */
 WDI_Status
@@ -5099,23 +5191,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_ADD_STA_SELF_REQ;
-  wdiEventData.pEventData      = pwdiAddSTASelfReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiAddSTASelfReqParams);
-  wdiEventData.pCBfnc          = wdiAddSTASelfReqParamsRspCb;
+  wdiEventData.pEventData      = pwdiAddSTASelfReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiAddSTASelfReqParams); 
+  wdiEventData.pCBfnc          = wdiAddSTASelfReqParamsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -5123,7 +5216,7 @@
 }/*WDI_AddSTASelfReq*/
 
 
-#ifdef WLAN_FEATURE_VOWIFI_11R
+#ifdef WLAN_FEATURE_VOWIFI_11R 
 /**
  @brief WDI_AggrAddTSReq will be called when the upper MAC to inform
         the device of a successful add TSpec negotiation. HW
@@ -5134,23 +5227,23 @@
         DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
  @param wdiAddTsReqParams: the add TS parameters as specified by
                       the Device Interface
-
+  
         wdiAddTsRspCb: callback for passing back the response of
         the add TS operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_AggrAddTSReq
 (
   WDI_AggrAddTSReqParamsType* pwdiAggrAddTsReqParams,
@@ -5162,23 +5255,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_AGGR_ADD_TS_REQ;
-  wdiEventData.pEventData      = pwdiAggrAddTsReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiAggrAddTsReqParams);
-  wdiEventData.pCBfnc          = wdiAggrAddTsRspCb;
+  wdiEventData.pEventData      = pwdiAggrAddTsReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiAggrAddTsReqParams); 
+  wdiEventData.pCBfnc          = wdiAggrAddTsRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -5191,15 +5285,15 @@
 /**
  @brief WDI_FTMCommandReq
         Post FTM Command Event
-
- @param  ftmCommandReq:   FTM Command Body
- @param  ftmCommandRspCb: FTM Response from HAL CB
+ 
+ @param  ftmCommandReq:   FTM Command Body 
+ @param  ftmCommandRspCb: FTM Response from HAL CB 
  @param  pUserData:       Client Data
-
+  
  @see
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_FTMCommandReq
 (
   WDI_FTMCommandReqType *ftmCommandReq,
@@ -5211,14 +5305,15 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
@@ -5232,27 +5327,27 @@
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
-#endif /* ANI_MANF_DIAG */
+#endif /* ANI_MANF_DIAG */ 
 /**
- @brief WDI_HostResumeReq will be called
+ @brief WDI_HostResumeReq will be called 
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
 
  @param pwdiResumeReqParams:  as specified by
                       the Device Interface
-
+  
         wdiResumeReqRspCb: callback for passing back the response of
         the  Resume Req received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
- @see
+        callback 
+  
+ @see 
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_HostResumeReq
 (
   WDI_ResumeParamsType*            pwdiResumeReqParams,
@@ -5264,23 +5359,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_HOST_RESUME_REQ;
-  wdiEventData.pEventData      = pwdiResumeReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiResumeReqParams);
-  wdiEventData.pCBfnc          = wdiResumeReqRspCb;
+  wdiEventData.pEventData      = pwdiResumeReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiResumeReqParams); 
+  wdiEventData.pCBfnc          = wdiResumeReqRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -5288,25 +5384,25 @@
 }/*WDI_HostResumeReq*/
 
 /**
- @brief WDI_DelSTASelfReq will be called
+ @brief WDI_DelSTASelfReq will be called 
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
 
  @param pwdiDelStaSelfReqParams:  as specified by
                       the Device Interface
-
+  
         wdiDelStaSelfRspCb: callback for passing back the response of
         the add TS operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_DelSTASelfReq
 (
   WDI_DelSTASelfReqParamsType*      pwdiDelStaSelfReqParams,
@@ -5318,23 +5414,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_DEL_STA_SELF_REQ;
-  wdiEventData.pEventData      = pwdiDelStaSelfReqParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiDelStaSelfReqParams);
-  wdiEventData.pCBfnc          = wdiDelStaSelfRspCb;
+  wdiEventData.pEventData      = pwdiDelStaSelfReqParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiDelStaSelfReqParams); 
+  wdiEventData.pCBfnc          = wdiDelStaSelfRspCb; 
   wdiEventData.pUserData       = pUserData;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -5342,28 +5439,28 @@
 }/*WDI_AggrAddTSReq*/
 
 /**
- @brief WDI_SetTxPerTrackingReq will be called when the upper MAC
-        wants to set the Tx Per Tracking configurations.
+ @brief WDI_SetTxPerTrackingReq will be called when the upper MAC 
+        wants to set the Tx Per Tracking configurations. 
         Upon the call of this API the WLAN DAL will pack
         and send a HAL Set Tx Per Tracking request message to the
         lower RIVA sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
- @param pwdiSetTxPerTrackingReqParams: the Set Tx PER Tracking configurations as
+ @param pwdiSetTxPerTrackingReqParams: the Set Tx PER Tracking configurations as 
                       specified by the Device Interface
-
+  
         pwdiSetTxPerTrackingRspCb: callback for passing back the
         response of the set Tx PER Tracking configurations operation received
         from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetTxPerTrackingReq
 (
   WDI_SetTxPerTrackingReqParamsType*      pwdiSetTxPerTrackingReqParams,
@@ -5375,23 +5472,24 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_SET_TX_PER_TRACKING_REQ;
-   wdiEventData.pEventData      = pwdiSetTxPerTrackingReqParams;
+   wdiEventData.pEventData      = pwdiSetTxPerTrackingReqParams; 
    wdiEventData.uEventDataSize  = sizeof(*pwdiSetTxPerTrackingReqParams);
-   wdiEventData.pCBfnc          = pwdiSetTxPerTrackingRspCb;
+   wdiEventData.pCBfnc          = pwdiSetTxPerTrackingRspCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -5400,16 +5498,16 @@
 
 /**
  @brief WDI_SetTmLevelReq
-        If HW Thermal condition changed, driver should react based on new
+        If HW Thermal condition changed, driver should react based on new 
         HW thermal condition.
 
  @param pwdiSetTmLevelReq: New thermal condition information
-
+  
         pwdiSetTmLevelRspCb: callback
-
+  
         usrData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @return Result of the function call
 */
 WDI_Status
@@ -5417,48 +5515,49 @@
 (
    WDI_SetTmLevelReqType        *pwdiSetTmLevelReq,
    WDI_SetTmLevelCb              pwdiSetTmLevelRspCb,
-   void                         *usrData
+   void                         *usrData  
 )
 {
    WDI_EventInfoType      wdiEventData;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_SET_TM_LEVEL_REQ;
-   wdiEventData.pEventData      = pwdiSetTmLevelReq;
+   wdiEventData.pEventData      = pwdiSetTmLevelReq; 
    wdiEventData.uEventDataSize  = sizeof(*pwdiSetTmLevelReq);
-   wdiEventData.pCBfnc          = pwdiSetTmLevelRspCb;
+   wdiEventData.pCBfnc          = pwdiSetTmLevelRspCb; 
    wdiEventData.pUserData       = usrData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
 
 /**
- @brief WDI_HostSuspendInd
-
+ @brief WDI_HostSuspendInd 
+  
         Suspend Indication from the upper layer will be sent
         down to HAL
-
+  
  @param WDI_SuspendResumeIndParamsType
-
- @see
-
+ 
+ @see 
+  
  @return Status of the request
 */
-WDI_Status
+WDI_Status 
 WDI_HostSuspendInd
 (
   WDI_SuspendParamsType*    pwdiSuspendIndParams
@@ -5469,23 +5568,24 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Fill in Event data and post to the Main FSM
   ------------------------------------------------------------------------*/
   wdiEventData.wdiRequest      = WDI_HOST_SUSPEND_IND;
-  wdiEventData.pEventData      = pwdiSuspendIndParams;
-  wdiEventData.uEventDataSize  = sizeof(*pwdiSuspendIndParams);
-  wdiEventData.pCBfnc          = NULL;
+  wdiEventData.pEventData      = pwdiSuspendIndParams; 
+  wdiEventData.uEventDataSize  = sizeof(*pwdiSuspendIndParams); 
+  wdiEventData.pCBfnc          = NULL; 
   wdiEventData.pUserData       = NULL;
 
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -5495,11 +5595,11 @@
 /**
  @brief WDI_HALDumpCmdReq
         Post HAL DUMP Command Event
-
- @param  halDumpCmdReqParams:   Hal Dump Command Body
- @param  halDumpCmdRspCb: HAL DUMP Response from HAL CB
+ 
+ @param  halDumpCmdReqParams:   Hal Dump Command Body 
+ @param  halDumpCmdRspCb: HAL DUMP Response from HAL CB 
  @param  pUserData:       Client Data
-
+  
  @see
  @return Result of the function call
 */
@@ -5514,14 +5614,15 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
@@ -5536,36 +5637,36 @@
   return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
 
-/*============================================================================
-
+/*============================================================================ 
+ 
             DAL Control Path Main FSM Function Implementation
-
+ 
  ============================================================================*/
 
 /**
  @brief Main FSM Start function for all states except BUSY
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
          wdiEV:           event posted to the main DAL FSM
          pEventData:      pointer to the event information
-         structure
-
+         structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_PostMainEvent
 (
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_MainEventType      wdiEV,
+  WDI_ControlBlockType*  pWDICtx, 
+  WDI_MainEventType      wdiEV, 
   WDI_EventInfoType*     pEventData
-
+  
 )
 {
-  WDI_Status         wdiStatus;
-  WDI_MainFuncType   pfnWDIMainEvHdlr;
-  WDI_MainStateType  wdiOldState;
+  WDI_Status         wdiStatus; 
+  WDI_MainFuncType   pfnWDIMainEvHdlr; 
+  WDI_MainStateType  wdiOldState; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
@@ -5574,26 +5675,28 @@
   if (( pWDICtx->uGlobalState >= WDI_MAX_ST ) ||
       ( wdiEV >= WDI_MAX_EVENT ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "Invalid state or event in Post Main Ev function ST: %d EV: %d",
                pWDICtx->uGlobalState, wdiEV);
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*Access to the global state must be locked */
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*Fetch event handler for state*/
-  pfnWDIMainEvHdlr = wdiMainFSM[pWDICtx->uGlobalState].pfnMainTbl[wdiEV];
+  pfnWDIMainEvHdlr = wdiMainFSM[pWDICtx->uGlobalState].pfnMainTbl[wdiEV]; 
 
   wdiOldState = pWDICtx->uGlobalState;
 
   /*
-  --Incase of WDI event is WDI_RESPONSE_EVENT and this is called when a
-  response comes from CCPU for the request sent by host:
-  the WDI global state will be in WDI_BUSY_ST already, so do not set it to BUSY again.
+  --Incase of WDI event is WDI_RESPONSE_EVENT and this is called when a 
+  response comes from CCPU for the request sent by host: 
+  the WDI global state will be in WDI_BUSY_ST already, so do not set it to BUSY again. 
   This state will be set to WDI_STARTED_ST in WDI_MainRsp, if it is a expected response.
-  --Incase of WDI event is WDI_RESPONSE_EVENT and it is an indication from the
+  --Incase of WDI event is WDI_RESPONSE_EVENT and it is an indication from the 
   CCPU:
   don't change the state */
   if ( WDI_RESPONSE_EVENT != wdiEV)
@@ -5605,19 +5708,23 @@
   }
   /* If the state function associated with the EV is NULL it means that this
      event is not allowed in this state*/
-  if ( NULL != pfnWDIMainEvHdlr )
+  if ( NULL != pfnWDIMainEvHdlr ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "Posting event %d in state: %d to the Main FSM",
+              "Posting event %d in state: %d to the Main FSM", 
               wdiEV, wdiOldState);
-    wdiStatus = pfnWDIMainEvHdlr( pWDICtx, pEventData);
+#endif
+    wdiStatus = pfnWDIMainEvHdlr( pWDICtx, pEventData); 
   }
   else
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "Unexpected event %d in state: %d",
+              "Unexpected event %d in state: %d", 
               wdiEV, wdiOldState);
-    wdiStatus = WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    wdiStatus = WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /* If a request handles itself well it will end up in a success or in a
@@ -5625,11 +5732,11 @@
      Success - means that the request was processed and the proper state
      transition already occurred or will occur when the resp is received
      - NO other state transition or dequeueing is required
-
+ 
      Pending - means the request could not be processed at this moment in time
      because the FSM was already busy so no state transition or dequeueing
      is necessary anymore
-
+ 
      Success for synchronous case means that the transition may occur and
      processing of pending requests may continue - so it should go through
      and restores the state and continue processing queued requests*/
@@ -5645,66 +5752,69 @@
       WDI_STATE_TRANSITION( pWDICtx, wdiOldState);
     }
     WDI_DequeuePendingReq(pWDICtx);
-
+        
   }
 
   /* we have completed processing the event */
   wpalMutexRelease(&pWDICtx->wptMutex);
 
-  return wdiStatus;
+  return wdiStatus; 
 
 }/*WDI_PostMainEvent*/
 
 
 /*--------------------------------------------------------------------------
-  INIT State Functions
+  INIT State Functions 
 --------------------------------------------------------------------------*/
 /**
  @brief Main FSM Start function for all states except BUSY
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainStart
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
 
   /*--------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "Invalid parameters on Main Start %x %x",
+               "Invalid parameters on Main Start %x %x", 
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*--------------------------------------------------------------------
-     Check if the Control Transport has been opened
+     Check if the Control Transport has been opened 
   ----------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == pWDICtx->bCTOpened )
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                "Control Transport not yet Open - queueing the request");
-
+#endif
      WDI_STATE_TRANSITION( pWDICtx, WDI_INIT_ST);
-     WDI_QueuePendingReq( pWDICtx, pEventData);
+     WDI_QueuePendingReq( pWDICtx, pEventData); 
 
      wpalMutexRelease(&pWDICtx->wptMutex);
      return WDI_STATUS_PENDING;
   }
-
+ 
   wpalMutexRelease(&pWDICtx->wptMutex);
 
   /*Return Success*/
@@ -5715,25 +5825,26 @@
 /**
  @brief Main FSM Response function for state INIT
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainRspInit
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   /*------------------------------------------------------------------------
-    Not expecting a response from the device before it is started
+    Not expecting a response from the device before it is started 
   ------------------------------------------------------------------------*/
-  WDI_ASSERT(0);
-
+#ifdef WLAN_DEBUG
+  WDI_ASSERT(0); 
+#endif
   /*Return Success*/
   return WDI_STATUS_E_NOT_ALLOWED;
 }/* WDI_MainRspInit */
@@ -5741,29 +5852,31 @@
 /**
  @brief Main FSM Close function for all states except BUSY
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainClose
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
 
   /*--------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "Invalid parameters on Main Close %x %x",
+               "Invalid parameters on Main Close %x %x", 
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
@@ -5772,21 +5885,21 @@
 
 }/*WDI_MainClose*/
 /*--------------------------------------------------------------------------
-  STARTED State Functions
+  STARTED State Functions 
 --------------------------------------------------------------------------*/
 /**
  @brief Main FSM Start function for state STARTED
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainStartStarted
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -5795,22 +5908,25 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*--------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "Invalid parameters on Main Start %x %x",
+               "Invalid parameters on Main Start %x %x", 
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
   /*--------------------------------------------------------------------
-     Nothing to do transport was already started
+     Nothing to do transport was already started 
   ----------------------------------------------------------------------*/
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-    "Received start while transport was already started - nothing to do");
-
+    "Received start while transport was already started - nothing to do"); 
+#endif
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*Transition back to started because the post function transitioned us to
@@ -5819,12 +5935,12 @@
 
   /*Check to see if any request is pending*/
   WDI_DequeuePendingReq(pWDICtx);
-
+  
   wpalMutexRelease(&pWDICtx->wptMutex);
 
   /*Tell UMAC Success*/
-  wdiStartRspCb = (WDI_StartRspCb)pEventData->pCBfnc;
-
+  wdiStartRspCb = (WDI_StartRspCb)pEventData->pCBfnc; 
+  
    /*Notify UMAC*/
   wdiStartRspCb( &pWDICtx->wdiCachedStartRspParams, pWDICtx->pRspCBUserData);
 
@@ -5836,37 +5952,40 @@
 /**
  @brief Main FSM Stop function for state STARTED
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainStopStarted
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   /*--------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "Invalid parameters on Main Start %x %x",
+               "Invalid parameters on Main Start %x %x", 
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
   /*State at this point is BUSY - because we enter this state before posting
     an event to the FSM in order to prevent potential race conditions*/
+#ifdef WLAN_DEBUG
 
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
             "Processing stop request in FSM");
-
+#endif
   /*Return Success*/
   return WDI_ProcessRequest( pWDICtx, pEventData );
 
@@ -5874,29 +5993,31 @@
 /**
  @brief Main FSM Request function for state started
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainReqStarted
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
 
   /*--------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "Invalid parameters on Main Req Started %x %x",
+               "Invalid parameters on Main Req Started %x %x", 
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
@@ -5911,31 +6032,33 @@
 /**
  @brief Main FSM Response function for all states except INIT
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
          pEventData:      pointer to the event information structure
-
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
-  WDI_Status  wdiStatus;
+  WDI_Status  wdiStatus; 
   wpt_boolean expectedResponse;
 
   /*--------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "Invalid parameters on Main Response %x %x",
+               "Invalid parameters on Main Response %x %x", 
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
@@ -5972,49 +6095,51 @@
   2. device failure detected while processing response
   3. stop response received*/
   WDI_STATE_TRANSITION( pWDICtx, pWDICtx->ucExpectedStateTransition);
-
+ 
   /*Dequeue request that may have been queued while we were waiting for the
     response */
   if ( expectedResponse )
   {
-     WDI_DequeuePendingReq(pWDICtx);
+     WDI_DequeuePendingReq(pWDICtx); 
   }
 
   wpalMutexRelease(&pWDICtx->wptMutex);
 
   /*Return Success - always */
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 
 }/*WDI_MainRsp*/
 
 /*--------------------------------------------------------------------------
-  STOPPED State Functions
+  STOPPED State Functions 
 --------------------------------------------------------------------------*/
 /**
  @brief Main FSM Stop function for state STOPPED
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainStopStopped
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   /*--------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "Invalid parameters on Main Stop Stopped %x %x",
+               "Invalid parameters on Main Stop Stopped %x %x", 
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
@@ -6023,53 +6148,57 @@
     error situations we put ourselves in the stopped state without the
     UMAC knowing, so when we get a STOP request in this state we still
     process it since we need to clean up the underlying state */
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
             "Processing stop request while stopped in FSM");
-
+#endif
   /*Return Success*/
   return WDI_ProcessRequest( pWDICtx, pEventData );
 
 }/*WDI_MainStopStopped*/
 
 /*--------------------------------------------------------------------------
-  BUSY State Functions
+  BUSY State Functions 
 --------------------------------------------------------------------------*/
 /**
  @brief Main FSM Start function for state BUSY
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainStartBusy
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   /*--------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "Invalid parameters on Main Start in BUSY %x %x",
+               "Invalid parameters on Main Start in BUSY %x %x", 
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
   /*--------------------------------------------------------------------
-     Check if the Control Transport has been opened
+     Check if the Control Transport has been opened 
   ----------------------------------------------------------------------*/
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
            "WDI Busy state - queue start request");
-
+#endif
   /*Queue the start request*/
-  WDI_QueuePendingReq( pWDICtx, pEventData);
+  WDI_QueuePendingReq( pWDICtx, pEventData); 
 
   /*Return Success*/
   return WDI_STATUS_PENDING;
@@ -6078,118 +6207,127 @@
 /**
  @brief Main FSM Stop function for state BUSY
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainStopBusy
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   /*--------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "Invalid parameters on Main Stop in BUSY %x %x",
+               "Invalid parameters on Main Stop in BUSY %x %x", 
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
   /*--------------------------------------------------------------------
-     Check if the Control Transport has been opened
+     Check if the Control Transport has been opened 
   ----------------------------------------------------------------------*/
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
            "WDI Busy state - queue stop request");
-
-  WDI_QueuePendingReq( pWDICtx, pEventData);
+#endif
+  WDI_QueuePendingReq( pWDICtx, pEventData); 
   return WDI_STATUS_PENDING;
-
+  
 }/*WDI_MainStopBusy*/
 
 /**
  @brief Main FSM Request function for state BUSY
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainReqBusy
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   /*--------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "Invalid parameters on Main Request in BUSY %x %x",
+               "Invalid parameters on Main Request in BUSY %x %x", 
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
   /*--------------------------------------------------------------------
-     Check if the Control Transport has been opened
+     Check if the Control Transport has been opened 
   ----------------------------------------------------------------------*/
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
            "WDI Busy state - queue request %d because waiting for response %d",
              pEventData->wdiRequest, pWDICtx->wdiExpectedResponse);
-
-  WDI_QueuePendingReq( pWDICtx, pEventData);
+#endif
+  WDI_QueuePendingReq( pWDICtx, pEventData); 
   return WDI_STATUS_PENDING;
-
+  
 }/*WDI_MainReqBusy*/
 /**
  @brief Main FSM Close function for state BUSY
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_MainCloseBusy
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   /*--------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-               "Invalid parameters on Main Close in BUSY %x %x",
+               "Invalid parameters on Main Close in BUSY %x %x", 
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
   /*--------------------------------------------------------------------
-     Check if the Control Transport has been opened
+     Check if the Control Transport has been opened 
   ----------------------------------------------------------------------*/
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
            "WDI Busy state - queue close request");
-
-  WDI_QueuePendingReq( pWDICtx, pEventData);
+#endif
+  WDI_QueuePendingReq( pWDICtx, pEventData); 
   return WDI_STATUS_PENDING;
-
+  
 }/*WDI_MainCloseBusy*/
 
 /**
@@ -6214,18 +6352,21 @@
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "Invalid parameters on Main Start %x %x",
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
   /*State at this point is BUSY - because we enter this state before posting
     an event to the FSM in order to prevent potential race conditions*/
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
             "Processing shutdown request in FSM");
-
+#endif
   /*Return Success*/
   return WDI_ProcessRequest( pWDICtx, pEventData );
 
@@ -6253,9 +6394,11 @@
   ----------------------------------------------------------------------*/
   if (( NULL ==  pWDICtx ) || ( NULL == pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "Invalid parameters on Main Start %x %x",
                pWDICtx, pEventData);
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
@@ -6264,168 +6407,177 @@
    */
   wpalTimerStop(&gWDICb.wptResponseTimer);
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
             "Processing shutdown request in FSM: Busy state ");
-
+#endif
   return WDI_ProcessRequest( pWDICtx, pEventData );
 
 }/*WDI_MainShutdownBusy*/
 
 
-/*=======================================================================
-
+/*======================================================================= 
+ 
            WLAN DAL Control Path Main Processing Functions
-
+ 
 *=======================================================================*/
 
 /*========================================================================
-          Main DAL Control Path Request Processing API
+          Main DAL Control Path Request Processing API 
 ========================================================================*/
 /**
- @brief Process Start Request function (called when Main FSM
+ @brief Process Start Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessStartReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_StartReqParamsType* pwdiStartParams    = NULL;
   WDI_StartRspCb          wdiStartRspCb      = NULL;
-  wpt_uint8*              pSendBuffer        = NULL;
+  wpt_uint8*              pSendBuffer        = NULL; 
   wpt_uint16              usDataOffset       = 0;
   wpt_uint16              usSendSize         = 0;
 
-  tHalMacStartReqMsg      halStartReq;
-  wpt_uint16              usLen              = 0;
+  tHalMacStartReqMsg      halStartReq; 
+  wpt_uint16              usLen              = 0; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == (pwdiStartParams = (WDI_StartReqParamsType*)pEventData->pEventData)) ||
       ( NULL == (wdiStartRspCb   = (WDI_StartRspCb)pEventData->pCBfnc)))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  usLen = sizeof(halStartReq.startReqParams) +
+  usLen = sizeof(halStartReq.startReqParams) + 
           pwdiStartParams->usConfigBufferLen;
 
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_START_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_START_REQ, 
                         usLen,
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + usLen )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
               "Unable to get send buffer in start req %x %x %x",
                 pEventData, pwdiStartParams, wdiStartRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-----------------------------------------------------------------------
     Fill in the message
   -----------------------------------------------------------------------*/
-  halStartReq.startReqParams.driverType =
-     WDI_2_HAL_DRV_TYPE(pwdiStartParams->wdiDriverType);
+  halStartReq.startReqParams.driverType = 
+     WDI_2_HAL_DRV_TYPE(pwdiStartParams->wdiDriverType); 
 
-  halStartReq.startReqParams.uConfigBufferLen =
-                  pwdiStartParams->usConfigBufferLen;
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halStartReq.startReqParams,
-                  sizeof(halStartReq.startReqParams));
+  halStartReq.startReqParams.uConfigBufferLen = 
+                  pwdiStartParams->usConfigBufferLen; 
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halStartReq.startReqParams, 
+                  sizeof(halStartReq.startReqParams)); 
 
-  usDataOffset  += sizeof(halStartReq.startReqParams);
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  pwdiStartParams->pConfigBuffer,
-                  pwdiStartParams->usConfigBufferLen);
+  usDataOffset  += sizeof(halStartReq.startReqParams); 
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  pwdiStartParams->pConfigBuffer, 
+                  pwdiStartParams->usConfigBufferLen); 
 
   pWDICtx->wdiReqStatusCB     = pwdiStartParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiStartParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiStartParams->pUserData; 
 
   /*Save Low Level Ind CB and associated user data - it will be used further
     on when an indication is coming from the lower MAC*/
   pWDICtx->wdiLowLevelIndCB   = pwdiStartParams->wdiLowLevelIndCB;
-  pWDICtx->pIndUserData       = pwdiStartParams->pIndUserData;
+  pWDICtx->pIndUserData       = pwdiStartParams->pIndUserData; 
 
-  pWDICtx->bFrameTransEnabled = pwdiStartParams->bFrameTransEnabled;
+  pWDICtx->bFrameTransEnabled = pwdiStartParams->bFrameTransEnabled; 
   /*-------------------------------------------------------------------------
-    Send Start Request to HAL
+    Send Start Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiStartRspCb, pEventData->pUserData, WDI_START_RESP);
 
-
+  
 }/*WDI_ProcessStartReq*/
 
 /**
- @brief Process Stop Request function (called when Main FSM
+ @brief Process Stop Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessStopReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_StopReqParamsType* pwdiStopParams      = NULL;
   WDI_StopRspCb          wdiStopRspCb        = NULL;
-  wpt_uint8*             pSendBuffer         = NULL;
+  wpt_uint8*             pSendBuffer         = NULL; 
   wpt_uint16             usDataOffset        = 0;
   wpt_uint16             usSendSize          = 0;
   wpt_status             status;
-  tHalMacStopReqMsg      halStopReq;
+  tHalMacStopReqMsg      halStopReq; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
  /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == (pwdiStopParams = (WDI_StopReqParamsType*)pEventData->pEventData)) ||
       ( NULL == (wdiStopRspCb   = (WDI_StopRspCb)pEventData->pCBfnc)))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_STOP_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_STOP_REQ, 
                         sizeof(halStopReq.stopReqParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halStopReq.stopReqParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in stop req %x %x %x",
                 pEventData, pwdiStopParams, wdiStopRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-----------------------------------------------------------------------
@@ -6434,12 +6586,12 @@
   halStopReq.stopReqParams.reason = WDI_2_HAL_STOP_REASON(
                                           pwdiStopParams->wdiStopReason);
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halStopReq.stopReqParams,
-                  sizeof(halStopReq.stopReqParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halStopReq.stopReqParams, 
+                  sizeof(halStopReq.stopReqParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiStopParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiStopParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiStopParams->pUserData; 
 
   /*! TO DO: stop the data services */
   if ( eDRIVER_TYPE_MFG != pWDICtx->driverMode )
@@ -6452,65 +6604,69 @@
      status = wpalEventReset(&pWDICtx->setPowerStateEvent);
      if (eWLAN_PAL_STATUS_SUCCESS != status)
      {
+#ifdef WLAN_DEBUG
         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "WDI Init failed to reset power state event");
 
-        WDI_ASSERT(0);
+        WDI_ASSERT(0); 
+#endif
         return VOS_STATUS_E_FAILURE;
      }
      /* Stop Transport Driver, DXE */
      WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_DOWN, WDI_SetPowerStateCb);
      /*
-      * Wait for the event to be set once the ACK comes back from DXE
+      * Wait for the event to be set once the ACK comes back from DXE 
       */
-     status = wpalEventWait(&pWDICtx->setPowerStateEvent,
+     status = wpalEventWait(&pWDICtx->setPowerStateEvent, 
                             WDI_SET_POWER_STATE_TIMEOUT);
      if (eWLAN_PAL_STATUS_SUCCESS != status)
      {
+#ifdef WLAN_DEBUG
         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "WDI Init failed to wait on an event");
 
-        WDI_ASSERT(0);
+        WDI_ASSERT(0); 
+#endif
         return VOS_STATUS_E_FAILURE;
       }
   }
 
   /*-------------------------------------------------------------------------
-    Send Stop Request to HAL
+    Send Stop Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiStopRspCb, pEventData->pUserData, WDI_STOP_RESP);
 
 }/*WDI_ProcessStopReq*/
 
 /**
- @brief Process Close Request function (called when Main FSM
+ @brief Process Close Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessCloseReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
-   wpt_status              wptStatus;
+   wpt_status              wptStatus; 
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*Lock control block for cleanup*/
    wpalMutexAcquire(&pWDICtx->wptMutex);
-
+       
    /*Clear all pending request*/
    WDI_ClearPendingRequests(pWDICtx);
 
    /* Close Control transport*/
-   WCTS_CloseTransport(pWDICtx->wctsHandle);
+   WCTS_CloseTransport(pWDICtx->wctsHandle); 
 
    /* Close Data transport*/
    /* FTM mode does not open Data Path */
@@ -6524,72 +6680,75 @@
 
    /*close the PAL */
    wptStatus = wpalClose(pWDICtx->pPALContext);
+#ifdef WLAN_DEBUG
    if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
    {
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "Failed to wpal Close %d", wptStatus);
      WDI_ASSERT(0);
    }
-
+#endif
    /*Transition back to init state*/
    WDI_STATE_TRANSITION( pWDICtx, WDI_INIT_ST);
 
    wpalMutexRelease(&pWDICtx->wptMutex);
 
    /*Make sure the expected state is properly defaulted to Init*/
-   pWDICtx->ucExpectedStateTransition = WDI_INIT_ST;
+   pWDICtx->ucExpectedStateTransition = WDI_INIT_ST; 
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessCloseReq*/
 
 
 /*===========================================================================
-                  SCANING REQUEST PROCESSING API
+                  SCANING REQUEST PROCESSING API 
 ===========================================================================*/
 
 /**
  @brief Process Init Scan Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessInitScanReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_InitScanReqParamsType*  pwdiInitScanParams    = NULL;
   WDI_InitScanRspCb           wdiInitScanRspCb      = NULL;
-  wpt_uint8*                  pSendBuffer           = NULL;
+  wpt_uint8*                  pSendBuffer           = NULL; 
   wpt_uint16                  usDataOffset          = 0;
   wpt_uint16                  usSendSize            = 0;
   wpt_uint8                   i = 0;
 
   tHalInitScanReqMsg          halInitScanReqMsg;
 
-  /*This is temporary fix.
+  /*This is temporary fix. 
    * It shold be removed once host and riva changes are in sync*/
   tHalInitScanConReqMsg       halInitScanConReqMsg;
 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
     -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == (pwdiInitScanParams = (WDI_InitScanReqParamsType*)pEventData->pEventData)) ||
       ( NULL == (wdiInitScanRspCb   = (WDI_InitScanRspCb)pEventData->pCBfnc)))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
         "%s: Invalid parameters", __FUNCTION__);
     WDI_ASSERT(0);
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
 #if 0
@@ -6597,58 +6756,61 @@
   /*-----------------------------------------------------------------------
     Check to see if SCAN is already in progress - if so reject the req
     We only allow one scan at a time
-    ! TO DO: - revisit this constraint
+    ! TO DO: - revisit this constraint 
     -----------------------------------------------------------------------*/
   if ( pWDICtx->bScanInProgress )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
         "Scan is already in progress - subsequent scan is not allowed"
         " until the first scan completes");
-
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
-  pWDICtx->bScanInProgress = eWLAN_PAL_TRUE;
-  pWDICtx->uScanState      = WDI_SCAN_INITIALIZED_ST;
+  pWDICtx->bScanInProgress = eWLAN_PAL_TRUE; 
+  pWDICtx->uScanState      = WDI_SCAN_INITIALIZED_ST; 
 
   wpalMutexRelease(&pWDICtx->wptMutex);
 #endif
 
   if (pwdiInitScanParams->wdiReqInfo.bUseNOA)
   {
-    /*This is temporary fix.
+    /*This is temporary fix. 
      * It shold be removed once host and riva changes are in sync*/
     /*-----------------------------------------------------------------------
       Get message buffer
       -----------------------------------------------------------------------*/
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_INIT_SCAN_CON_REQ,
+    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_INIT_SCAN_CON_REQ, 
             sizeof(halInitScanConReqMsg.initScanParams),
             &pSendBuffer, &usDataOffset, &usSendSize))||
         ( usSendSize < (usDataOffset + sizeof(halInitScanConReqMsg.initScanParams) )))
     {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
           "Unable to get send buffer in init scan req %x %x %x",
           pEventData, pwdiInitScanParams, wdiInitScanRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
     }
 
 
     /*-----------------------------------------------------------------------
       Fill in the message
       -----------------------------------------------------------------------*/
-    halInitScanConReqMsg.initScanParams.scanMode =
+    halInitScanConReqMsg.initScanParams.scanMode = 
       WDI_2_HAL_SCAN_MODE(pwdiInitScanParams->wdiReqInfo.wdiScanMode);
 
     wpalMemoryCopy(halInitScanConReqMsg.initScanParams.bssid,
         pwdiInitScanParams->wdiReqInfo.macBSSID, WDI_MAC_ADDR_LEN);
 
-    halInitScanConReqMsg.initScanParams.notifyBss =
+    halInitScanConReqMsg.initScanParams.notifyBss = 
       pwdiInitScanParams->wdiReqInfo.bNotifyBSS;
-    halInitScanConReqMsg.initScanParams.frameType =
+    halInitScanConReqMsg.initScanParams.frameType = 
       pwdiInitScanParams->wdiReqInfo.ucFrameType;
-    halInitScanConReqMsg.initScanParams.frameLength =
+    halInitScanConReqMsg.initScanParams.frameLength = 
       pwdiInitScanParams->wdiReqInfo.ucFrameLength;
 
     WDI_CopyWDIMgmFrameHdrToHALMgmFrameHdr( &halInitScanConReqMsg.initScanParams.macMgmtHdr,
@@ -6659,118 +6821,122 @@
     halInitScanConReqMsg.initScanParams.scanDuration = pwdiInitScanParams->wdiReqInfo.scanDuration;
 #endif
 
-    halInitScanConReqMsg.initScanParams.scanEntry.activeBSScnt =
+    halInitScanConReqMsg.initScanParams.scanEntry.activeBSScnt = 
       pwdiInitScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt;
 
     for (i=0; i < pwdiInitScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt; i++)
     {
-      halInitScanConReqMsg.initScanParams.scanEntry.bssIdx[i] =
+      halInitScanConReqMsg.initScanParams.scanEntry.bssIdx[i] = 
         pwdiInitScanParams->wdiReqInfo.wdiScanEntry.bssIdx[i];
     }
 
-    wpalMemoryCopy( pSendBuffer+usDataOffset,
-        &halInitScanConReqMsg.initScanParams,
-        sizeof(halInitScanConReqMsg.initScanParams));
+    wpalMemoryCopy( pSendBuffer+usDataOffset, 
+        &halInitScanConReqMsg.initScanParams, 
+        sizeof(halInitScanConReqMsg.initScanParams)); 
   }
   else
   {
     /*-----------------------------------------------------------------------
       Get message buffer
       -----------------------------------------------------------------------*/
-    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_INIT_SCAN_REQ,
+    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_INIT_SCAN_REQ, 
             sizeof(halInitScanReqMsg.initScanParams),
             &pSendBuffer, &usDataOffset, &usSendSize))||
         ( usSendSize < (usDataOffset + sizeof(halInitScanReqMsg.initScanParams) )))
     {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
           "Unable to get send buffer in init scan req %x %x %x",
           pEventData, pwdiInitScanParams, wdiInitScanRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
     }
 
 
     /*-----------------------------------------------------------------------
       Fill in the message
       -----------------------------------------------------------------------*/
-    halInitScanReqMsg.initScanParams.scanMode =
+    halInitScanReqMsg.initScanParams.scanMode = 
       WDI_2_HAL_SCAN_MODE(pwdiInitScanParams->wdiReqInfo.wdiScanMode);
 
     wpalMemoryCopy(halInitScanReqMsg.initScanParams.bssid,
         pwdiInitScanParams->wdiReqInfo.macBSSID, WDI_MAC_ADDR_LEN);
 
-    halInitScanReqMsg.initScanParams.notifyBss =
+    halInitScanReqMsg.initScanParams.notifyBss = 
       pwdiInitScanParams->wdiReqInfo.bNotifyBSS;
-    halInitScanReqMsg.initScanParams.frameType =
+    halInitScanReqMsg.initScanParams.frameType = 
       pwdiInitScanParams->wdiReqInfo.ucFrameType;
-    halInitScanReqMsg.initScanParams.frameLength =
+    halInitScanReqMsg.initScanParams.frameLength = 
       pwdiInitScanParams->wdiReqInfo.ucFrameLength;
 
     WDI_CopyWDIMgmFrameHdrToHALMgmFrameHdr( &halInitScanReqMsg.initScanParams.macMgmtHdr,
         &pwdiInitScanParams->wdiReqInfo.wdiMACMgmtHdr);
 
-    halInitScanReqMsg.initScanParams.scanEntry.activeBSScnt =
+    halInitScanReqMsg.initScanParams.scanEntry.activeBSScnt = 
       pwdiInitScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt;
 
     for (i=0; i < pwdiInitScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt; i++)
     {
-      halInitScanReqMsg.initScanParams.scanEntry.bssIdx[i] =
+      halInitScanReqMsg.initScanParams.scanEntry.bssIdx[i] = 
         pwdiInitScanParams->wdiReqInfo.wdiScanEntry.bssIdx[i];
     }
 
-    wpalMemoryCopy( pSendBuffer+usDataOffset,
-        &halInitScanReqMsg.initScanParams,
-        sizeof(halInitScanReqMsg.initScanParams));
+    wpalMemoryCopy( pSendBuffer+usDataOffset, 
+        &halInitScanReqMsg.initScanParams, 
+        sizeof(halInitScanReqMsg.initScanParams)); 
   }
 
   pWDICtx->wdiReqStatusCB     = pwdiInitScanParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiInitScanParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiInitScanParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Init Scan Request to HAL
+    Send Init Scan Request to HAL 
     -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
       wdiInitScanRspCb, pEventData->pUserData, WDI_INIT_SCAN_RESP);
 
 }/*WDI_ProcessInitScanReq*/
 
 /**
- @brief Process Start Scan Request function (called when Main
+ @brief Process Start Scan Request function (called when Main 
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessStartScanReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_StartScanReqParamsType*  pwdiStartScanParams    = NULL;
   WDI_StartScanRspCb           wdiStartScanRspCb      = NULL;
-  wpt_uint8*                   pSendBuffer            = NULL;
+  wpt_uint8*                   pSendBuffer            = NULL; 
   wpt_uint16                   usDataOffset           = 0;
   wpt_uint16                   usSendSize             = 0;
 
-  tHalStartScanReqMsg          halStartScanReqMsg;
+  tHalStartScanReqMsg          halStartScanReqMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == (pwdiStartScanParams = (WDI_StartScanReqParamsType*)pEventData->pEventData)) ||
       ( NULL == (wdiStartScanRspCb   = (WDI_StartScanRspCb)pEventData->pCBfnc)))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
 #if 0
@@ -6778,21 +6944,21 @@
   /*-----------------------------------------------------------------------
     Check to see if SCAN is already in progress - start scan is only
     allowed when a scan is ongoing and the state of the scan procedure
-    is either init or end
+    is either init or end 
   -----------------------------------------------------------------------*/
-  if (( !pWDICtx->bScanInProgress ) ||
+  if (( !pWDICtx->bScanInProgress ) || 
       (( WDI_SCAN_INITIALIZED_ST != pWDICtx->uScanState ) &&
        ( WDI_SCAN_ENDED_ST != pWDICtx->uScanState )))
   {
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Scan start not allowed in this state %d %d",
                pWDICtx->bScanInProgress, pWDICtx->uScanState);
-
+    
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
-  pWDICtx->uScanState      = WDI_SCAN_STARTED_ST;
+  pWDICtx->uScanState      = WDI_SCAN_STARTED_ST; 
 
   wpalMutexRelease(&pWDICtx->wptMutex);
 #endif
@@ -6800,76 +6966,80 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_START_SCAN_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_START_SCAN_REQ, 
                         sizeof(halStartScanReqMsg.startScanParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halStartScanReqMsg.startScanParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in start scan req %x %x %x",
                 pEventData, pwdiStartScanParams, wdiStartScanRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  halStartScanReqMsg.startScanParams.scanChannel =
+  halStartScanReqMsg.startScanParams.scanChannel = 
                               pwdiStartScanParams->ucChannel;
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halStartScanReqMsg.startScanParams,
-                  sizeof(halStartScanReqMsg.startScanParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halStartScanReqMsg.startScanParams, 
+                  sizeof(halStartScanReqMsg.startScanParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiStartScanParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiStartScanParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiStartScanParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Start Scan Request to HAL
+    Send Start Scan Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiStartScanRspCb, pEventData->pUserData, WDI_START_SCAN_RESP);
 }/*WDI_ProcessStartScanReq*/
 
 
 /**
- @brief Process End Scan Request function (called when Main FSM
+ @brief Process End Scan Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessEndScanReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_EndScanReqParamsType*  pwdiEndScanParams    = NULL;
   WDI_EndScanRspCb           wdiEndScanRspCb      = NULL;
-  wpt_uint8*                 pSendBuffer          = NULL;
+  wpt_uint8*                 pSendBuffer          = NULL; 
   wpt_uint16                 usDataOffset         = 0;
   wpt_uint16                 usSendSize           = 0;
 
-  tHalEndScanReqMsg          halEndScanReqMsg;
+  tHalEndScanReqMsg          halEndScanReqMsg;           
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == (pwdiEndScanParams = (WDI_EndScanReqParamsType*)pEventData->pEventData)) ||
       ( NULL == (wdiEndScanRspCb   = (WDI_EndScanRspCb)pEventData->pCBfnc)))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  /* commenting this check as UMAC is sending END_SCAN_REQ after FINISH_SCAN
-  * sometimes  because of this check the scan request is not being
+  /* commenting this check as UMAC is sending END_SCAN_REQ after FINISH_SCAN 
+  * sometimes  because of this check the scan request is not being 
   * forwarded to HAL and result in hang*/
 #if 0
   wpalMutexAcquire(&pWDICtx->wptMutex);
@@ -6878,18 +7048,18 @@
     allowed when a scan is ongoing and the state of the scan procedure
     is started
   -----------------------------------------------------------------------*/
-  if (( !pWDICtx->bScanInProgress ) ||
+  if (( !pWDICtx->bScanInProgress ) || 
       ( WDI_SCAN_STARTED_ST != pWDICtx->uScanState ))
   {
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "End start not allowed in this state %d %d",
                pWDICtx->bScanInProgress, pWDICtx->uScanState);
-
+    
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
-  pWDICtx->uScanState      = WDI_SCAN_ENDED_ST;
+  pWDICtx->uScanState      = WDI_SCAN_ENDED_ST; 
 
   wpalMutexRelease(&pWDICtx->wptMutex);
 #endif
@@ -6897,79 +7067,83 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_END_SCAN_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_END_SCAN_REQ, 
                         sizeof(halEndScanReqMsg.endScanParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halEndScanReqMsg.endScanParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in start scan req %x %x %x",
                 pEventData, pwdiEndScanParams, wdiEndScanRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   halEndScanReqMsg.endScanParams.scanChannel = pwdiEndScanParams->ucChannel;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halEndScanReqMsg.endScanParams,
-                  sizeof(halEndScanReqMsg.endScanParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halEndScanReqMsg.endScanParams, 
+                  sizeof(halEndScanReqMsg.endScanParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiEndScanParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiEndScanParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiEndScanParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send End Scan Request to HAL
+    Send End Scan Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiEndScanRspCb, pEventData->pUserData, WDI_END_SCAN_RESP);
 }/*WDI_ProcessEndScanReq*/
 
 
 /**
- @brief Process Finish Scan Request function (called when Main
+ @brief Process Finish Scan Request function (called when Main 
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessFinishScanReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_FinishScanReqParamsType*  pwdiFinishScanParams;
   WDI_FinishScanRspCb           wdiFinishScanRspCb;
-  wpt_uint8*                    pSendBuffer          = NULL;
+  wpt_uint8*                    pSendBuffer          = NULL; 
   wpt_uint16                    usDataOffset         = 0;
   wpt_uint16                    usSendSize           = 0;
   wpt_uint8                     i                    = 0;
 
-  tHalFinishScanReqMsg          halFinishScanReqMsg;
+  tHalFinishScanReqMsg          halFinishScanReqMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData) ||
       ( NULL == pEventData->pCBfnc))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiFinishScanParams = (WDI_FinishScanReqParamsType*)pEventData->pEventData;
   wdiFinishScanRspCb   = (WDI_FinishScanRspCb)pEventData->pCBfnc;
-  /* commenting this check as UMAC is sending END_SCAN_REQ after FINISH_SCAN
-  * sometimes  because of this check the scan request is not being
+  /* commenting this check as UMAC is sending END_SCAN_REQ after FINISH_SCAN 
+  * sometimes  because of this check the scan request is not being 
   * forwarded to HAL and result in hang*/
 #if 0
   wpalMutexAcquire(&pWDICtx->wptMutex);
@@ -6985,15 +7159,15 @@
                pWDICtx->bScanInProgress );
 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*-----------------------------------------------------------------------
     It is safe to reset the scan flags here because until the response comes
-    back all subsequent requests will be blocked at BUSY state
+    back all subsequent requests will be blocked at BUSY state 
   -----------------------------------------------------------------------*/
-  pWDICtx->uScanState      = WDI_SCAN_FINISHED_ST;
-  pWDICtx->bScanInProgress = eWLAN_PAL_FALSE;
+  pWDICtx->uScanState      = WDI_SCAN_FINISHED_ST; 
+  pWDICtx->bScanInProgress = eWLAN_PAL_FALSE; 
   wpalMutexRelease(&pWDICtx->wptMutex);
 #endif
 
@@ -7006,79 +7180,81 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_FINISH_SCAN_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_FINISH_SCAN_REQ, 
                         sizeof(halFinishScanReqMsg.finishScanParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halFinishScanReqMsg.finishScanParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in start scan req %x %x %x",
                 pEventData, pwdiFinishScanParams, wdiFinishScanRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  halFinishScanReqMsg.finishScanParams.scanMode =
+  halFinishScanReqMsg.finishScanParams.scanMode = 
     WDI_2_HAL_SCAN_MODE(pwdiFinishScanParams->wdiReqInfo.wdiScanMode);
 
-  halFinishScanReqMsg.finishScanParams.currentOperChannel =
+  halFinishScanReqMsg.finishScanParams.currentOperChannel = 
     pwdiFinishScanParams->wdiReqInfo.ucCurrentOperatingChannel;
 
-  halFinishScanReqMsg.finishScanParams.cbState =
+  halFinishScanReqMsg.finishScanParams.cbState = 
     WDI_2_HAL_CB_STATE(pwdiFinishScanParams->wdiReqInfo.wdiCBState);
 
   wpalMemoryCopy(halFinishScanReqMsg.finishScanParams.bssid,
                  pwdiFinishScanParams->wdiReqInfo.macBSSID, WDI_MAC_ADDR_LEN);
 
-  halFinishScanReqMsg.finishScanParams.notifyBss   =
+  halFinishScanReqMsg.finishScanParams.notifyBss   = 
                               pwdiFinishScanParams->wdiReqInfo.bNotifyBSS ;
-  halFinishScanReqMsg.finishScanParams.frameType   =
+  halFinishScanReqMsg.finishScanParams.frameType   = 
                               pwdiFinishScanParams->wdiReqInfo.ucFrameType ;
-  halFinishScanReqMsg.finishScanParams.frameLength =
+  halFinishScanReqMsg.finishScanParams.frameLength = 
                               pwdiFinishScanParams->wdiReqInfo.ucFrameLength ;
 
-  halFinishScanReqMsg.finishScanParams.scanEntry.activeBSScnt =
+  halFinishScanReqMsg.finishScanParams.scanEntry.activeBSScnt = 
                    pwdiFinishScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt ;
 
   for (i = 0; i < pwdiFinishScanParams->wdiReqInfo.wdiScanEntry.activeBSScnt; i++)
   {
-    halFinishScanReqMsg.finishScanParams.scanEntry.bssIdx[i] =
+    halFinishScanReqMsg.finishScanParams.scanEntry.bssIdx[i] = 
                pwdiFinishScanParams->wdiReqInfo.wdiScanEntry.bssIdx[i] ;
   }
 
   WDI_CopyWDIMgmFrameHdrToHALMgmFrameHdr( &halFinishScanReqMsg.finishScanParams.macMgmtHdr,
                               &pwdiFinishScanParams->wdiReqInfo.wdiMACMgmtHdr);
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halFinishScanReqMsg.finishScanParams,
-                  sizeof(halFinishScanReqMsg.finishScanParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halFinishScanReqMsg.finishScanParams, 
+                  sizeof(halFinishScanReqMsg.finishScanParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiFinishScanParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiFinishScanParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiFinishScanParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Finish Scan Request to HAL
+    Send Finish Scan Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiFinishScanRspCb, pEventData->pUserData, WDI_FINISH_SCAN_RESP);
 }/*WDI_ProcessFinishScanReq*/
 
 
 /*==========================================================================
-                    ASSOCIATION REQUEST API
+                    ASSOCIATION REQUEST API 
 ==========================================================================*/
 /**
- @brief Process BSS Join for a given Session
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ @brief Process BSS Join for a given Session 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessBSSSessionJoinReq
-(
+( 
   WDI_ControlBlockType*   pWDICtx,
   WDI_JoinReqParamsType*  pwdiJoinParams,
   WDI_JoinRspCb           wdiJoinRspCb,
@@ -7086,123 +7262,123 @@
 )
 {
   WDI_BSSSessionType*     pBSSSes             = NULL;
-  wpt_uint8*              pSendBuffer         = NULL;
+  wpt_uint8*              pSendBuffer         = NULL; 
   wpt_uint16              usDataOffset        = 0;
   wpt_uint16              usSendSize          = 0;
-  wpt_uint8               ucCurrentBSSSesIdx  = 0;
+  wpt_uint8               ucCurrentBSSSesIdx  = 0; 
 
-  tHalJoinReqMsg          halJoinReqMsg;
+  tHalJoinReqMsg          halJoinReqMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*------------------------------------------------------------------------
     Check to see if we have any session with this BSSID already stored, we
     should not
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                                   pwdiJoinParams->wdiReqInfo.macBSSID,
-                                  &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                                   pwdiJoinParams->wdiReqInfo.macBSSID, 
+                                  &pBSSSes);  
 
   if ( NULL != pBSSSes )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Association for this BSSID is already in place");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   wpalMutexAcquire(&pWDICtx->wptMutex);
   /*------------------------------------------------------------------------
-    Fetch an empty session block
+    Fetch an empty session block 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindEmptySession( pWDICtx, &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindEmptySession( pWDICtx, &pBSSSes); 
   if ( NULL == pBSSSes )
   {
-
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "DAL has no free sessions - cannot run another join");
-
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_RES_FAILURE;
+    return WDI_STATUS_RES_FAILURE; 
   }
 
   /*Save BSS Session Info*/
-  pBSSSes->bInUse = eWLAN_PAL_TRUE;
-  wpalMemoryCopy( pBSSSes->macBSSID, pwdiJoinParams->wdiReqInfo.macBSSID,
+  pBSSSes->bInUse = eWLAN_PAL_TRUE; 
+  wpalMemoryCopy( pBSSSes->macBSSID, pwdiJoinParams->wdiReqInfo.macBSSID, 
                   WDI_MAC_ADDR_LEN);
 
   /*Transition to state Joining*/
-  pBSSSes->wdiAssocState      = WDI_ASSOC_JOINING_ST;
+  pBSSSes->wdiAssocState      = WDI_ASSOC_JOINING_ST; 
   pWDICtx->ucCurrentBSSSesIdx = ucCurrentBSSSesIdx;
-
+  
   wpalMutexRelease(&pWDICtx->wptMutex);
 
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_JOIN_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_JOIN_REQ, 
                         sizeof(halJoinReqMsg.joinReqParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halJoinReqMsg.joinReqParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in join req %x %x %x",
                 pUserData, pwdiJoinParams, wdiJoinRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wpalMemoryCopy(halJoinReqMsg.joinReqParams.bssId,
-                 pwdiJoinParams->wdiReqInfo.macBSSID, WDI_MAC_ADDR_LEN);
+                 pwdiJoinParams->wdiReqInfo.macBSSID, WDI_MAC_ADDR_LEN); 
 
   wpalMemoryCopy(halJoinReqMsg.joinReqParams.selfStaMacAddr,
-                 pwdiJoinParams->wdiReqInfo.macSTASelf,
-                 WDI_MAC_ADDR_LEN);
+                 pwdiJoinParams->wdiReqInfo.macSTASelf, 
+                 WDI_MAC_ADDR_LEN); 
 
-  halJoinReqMsg.joinReqParams.ucChannel =
+  halJoinReqMsg.joinReqParams.ucChannel = 
     pwdiJoinParams->wdiReqInfo.wdiChannelInfo.ucChannel;
 
   halJoinReqMsg.joinReqParams.linkState = pwdiJoinParams->wdiReqInfo.linkState;
 
-#ifdef WLAN_FEATURE_VOWIFI
-  halJoinReqMsg.joinReqParams.maxTxPower =
-    pwdiJoinParams->wdiReqInfo.wdiChannelInfo.cMaxTxPower;
-#else
-  halJoinReqMsg.joinReqParams.ucLocalPowerConstraint =
+#ifndef WLAN_FEATURE_VOWIFI
+  halJoinReqMsg.joinReqParams.ucLocalPowerConstraint = 
     pwdiJoinParams->wdiReqInfo.wdiChannelInfo.ucLocalPowerConstraint;
 #endif
 
-  halJoinReqMsg.joinReqParams.secondaryChannelOffset =
+  halJoinReqMsg.joinReqParams.secondaryChannelOffset =     
      WDI_2_HAL_SEC_CH_OFFSET(pwdiJoinParams->wdiReqInfo.wdiChannelInfo.
                              wdiSecondaryChannelOffset);
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halJoinReqMsg.joinReqParams,
-                  sizeof(halJoinReqMsg.joinReqParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halJoinReqMsg.joinReqParams, 
+                  sizeof(halJoinReqMsg.joinReqParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiJoinParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiJoinParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiJoinParams->pUserData;  
 
   /*-------------------------------------------------------------------------
-    Send Join Request to HAL
+    Send Join Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiJoinRspCb, pUserData, WDI_JOIN_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiJoinRspCb, pUserData, WDI_JOIN_RESP); 
 
 }/*WDI_ProcessBSSSessionJoinReq*/
 
 /**
- @brief Process Join Request function (called when Main FSM
+ @brief Process Join Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessJoinReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -7213,36 +7389,39 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == (pwdiJoinParams = (WDI_JoinReqParamsType*)pEventData->pEventData)) ||
       ( NULL == (wdiJoinRspCb   = (WDI_JoinRspCb)pEventData->pCBfnc)))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
-
+  
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   if ( eWLAN_PAL_FALSE != pWDICtx->bAssociationInProgress )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
               "Association is currently in progress, queueing new join req");
-
+#endif
     /*Association is in progress - queue current one*/
-    wdiStatus = WDI_QueueNewAssocRequest(pWDICtx, pEventData,
+    wdiStatus = WDI_QueueNewAssocRequest(pWDICtx, pEventData, 
                              pwdiJoinParams->wdiReqInfo.macBSSID);
 
     wpalMutexRelease(&pWDICtx->wptMutex);
 
-    return wdiStatus;
+    return wdiStatus; 
   }
 
   /*Starting a new association */
@@ -7257,90 +7436,92 @@
 
 
 /**
- @brief Process Config BSS Request function (called when Main
+ @brief Process Config BSS Request function (called when Main 
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessConfigBSSReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_ConfigBSSReqParamsType*  pwdiConfigBSSParams;
   WDI_ConfigBSSRspCb           wdiConfigBSSRspCb;
-  wpt_uint8                    ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*          pBSSSes             = NULL;
-  wpt_uint16                   uMsgSize            = 0;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint16                   uMsgSize            = 0; 
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
-  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
 
-  tConfigBssReqMsg             halConfigBssReqMsg;
+  tConfigBssReqMsg             halConfigBssReqMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiConfigBSSParams = (WDI_ConfigBSSReqParamsType*)pEventData->pEventData;
   wdiConfigBSSRspCb   = (WDI_ConfigBSSRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                                 pwdiConfigBSSParams->wdiReqInfo.macBSSID,
-                                 &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                                 pwdiConfigBSSParams->wdiReqInfo.macBSSID, 
+                                 &pBSSSes); 
 
-  if ( NULL == pBSSSes )
+  if ( NULL == pBSSSes ) 
   {
 #ifdef WLAN_FEATURE_VOWIFI_11R
       /*------------------------------------------------------------------------
-        Fetch an empty session block
+        Fetch an empty session block 
       ------------------------------------------------------------------------*/
-      ucCurrentBSSSesIdx = WDI_FindEmptySession( pWDICtx, &pBSSSes);
+      ucCurrentBSSSesIdx = WDI_FindEmptySession( pWDICtx, &pBSSSes); 
       if ( NULL == pBSSSes )
       {
-
+#ifdef WLAN_DEBUG
         WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "DAL has no free sessions - cannot run another join");
-
+#endif
         wpalMutexRelease(&pWDICtx->wptMutex);
-        return WDI_STATUS_RES_FAILURE;
+        return WDI_STATUS_RES_FAILURE; 
       }
-
+    
       /*Save BSS Session Info*/
-      pBSSSes->bInUse = eWLAN_PAL_TRUE;
-      wpalMemoryCopy( pBSSSes->macBSSID, pwdiConfigBSSParams->wdiReqInfo.macBSSID,
+      pBSSSes->bInUse = eWLAN_PAL_TRUE; 
+      wpalMemoryCopy( pBSSSes->macBSSID, pwdiConfigBSSParams->wdiReqInfo.macBSSID, 
                       WDI_MAC_ADDR_LEN);
-
+    
       /*Transition to state Joining*/
-      pBSSSes->wdiAssocState      = WDI_ASSOC_JOINING_ST;
+      pBSSSes->wdiAssocState      = WDI_ASSOC_JOINING_ST; 
       pWDICtx->ucCurrentBSSSesIdx = ucCurrentBSSSesIdx;
 #else
-    /* If the BSS type is IBSS create the session here as there is no Join
+    /* If the BSS type is IBSS create the session here as there is no Join 
      * Request in case of IBSS*/
     if((pwdiConfigBSSParams->wdiReqInfo.wdiBSSType == WDI_IBSS_MODE) ||
        (pwdiConfigBSSParams->wdiReqInfo.wdiBSSType == WDI_INFRA_AP_MODE) ||
@@ -7348,211 +7529,201 @@
        (pwdiConfigBSSParams->wdiReqInfo.wdiBSSType == WDI_BTAMP_STA_MODE))
     {
       /*------------------------------------------------------------------------
-        Fetch an empty session block
+        Fetch an empty session block 
       ------------------------------------------------------------------------*/
-      ucCurrentBSSSesIdx = WDI_FindEmptySession( pWDICtx, &pBSSSes);
+      ucCurrentBSSSesIdx = WDI_FindEmptySession( pWDICtx, &pBSSSes); 
       if ( NULL == pBSSSes )
       {
-
+#ifdef WLAN_DEBUG
         WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "DAL has no free sessions - cannot run another join");
-
+#endif
         wpalMutexRelease(&pWDICtx->wptMutex);
-        return WDI_STATUS_RES_FAILURE;
+        return WDI_STATUS_RES_FAILURE; 
       }
-
+    
       /*Save BSS Session Info*/
-      pBSSSes->bInUse = eWLAN_PAL_TRUE;
-      wpalMemoryCopy( pBSSSes->macBSSID, pwdiConfigBSSParams->wdiReqInfo.macBSSID,
+      pBSSSes->bInUse = eWLAN_PAL_TRUE; 
+      wpalMemoryCopy( pBSSSes->macBSSID, pwdiConfigBSSParams->wdiReqInfo.macBSSID, 
                       WDI_MAC_ADDR_LEN);
-
+    
       /*Transition to state Joining*/
-      pBSSSes->wdiAssocState      = WDI_ASSOC_JOINING_ST;
+      pBSSSes->wdiAssocState      = WDI_ASSOC_JOINING_ST; 
       pWDICtx->ucCurrentBSSSesIdx = ucCurrentBSSSesIdx;
     }
     else
     {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                "%s: Association sequence for this BSS does not yet exist." MAC_ADDRESS_STR "wdiBssType %d",
-                __func__, MAC_ADDR_ARRAY(pwdiConfigBSSParams->wdiReqInfo.macBSSID),
-                pwdiConfigBSSParams->wdiReqInfo.wdiBSSType);
-
+                "Association sequence for this BSS does not yet exist");
+#endif
       /* for IBSS testing */
       wpalMutexRelease(&pWDICtx->wptMutex);
-      return WDI_STATUS_E_NOT_ALLOWED;
+      return WDI_STATUS_E_NOT_ALLOWED; 
     }
 #endif
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. " MAC_ADDRESS_STR " bssIdx %d",
-              __func__, MAC_ADDR_ARRAY(pwdiConfigBSSParams->wdiReqInfo.macBSSID),
-              ucCurrentBSSSesIdx);
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
 
     wpalMutexRelease(&pWDICtx->wptMutex);
 
-    return wdiStatus;
+    return wdiStatus; 
   }
 
   /* Cache the request for response processing */
-  wpalMemoryCopy(&pWDICtx->wdiCachedConfigBssReq,
-                 pwdiConfigBSSParams,
+  wpalMemoryCopy(&pWDICtx->wdiCachedConfigBssReq, 
+                 pwdiConfigBSSParams, 
                  sizeof(pWDICtx->wdiCachedConfigBssReq));
 
   wpalMutexRelease(&pWDICtx->wptMutex);
 
-  /* Allocation of BssReqMsg Memory Based on Firmware Capabilities */
-#ifdef WLAN_FEATURE_11AC
-  if (WDI_getFwWlanFeatCaps(DOT11AC))
-	  uMsgSize = sizeof(halConfigBssReqMsg.uBssParams.configBssParams_V1); // Version - 1 For 11AC
-  else
-#endif
-	  uMsgSize = sizeof(halConfigBssReqMsg.uBssParams.configBssParams); // default Version - 0 Structure
+  uMsgSize = sizeof(halConfigBssReqMsg.configBssParams); 
 
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIG_BSS_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIG_BSS_REQ, 
                     uMsgSize, &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + uMsgSize )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in config bss req %x %x %x",
                 pEventData, pwdiConfigBSSParams, wdiConfigBSSRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*Copy the BSS request */
-#ifdef WLAN_FEATURE_11AC
-  if (WDI_getFwWlanFeatCaps(DOT11AC))
-    WDI_CopyWDIConfigBSSToHALConfigBSS( (tConfigBssParams*)&halConfigBssReqMsg.uBssParams.configBssParams_V1,
-                                        &pwdiConfigBSSParams->wdiReqInfo);
-  else
-#endif
-  WDI_CopyWDIConfigBSSToHALConfigBSS( &halConfigBssReqMsg.uBssParams.configBssParams,
+  WDI_CopyWDIConfigBSSToHALConfigBSS( &halConfigBssReqMsg.configBssParams,
                                       &pwdiConfigBSSParams->wdiReqInfo);
 
   /* Need to fill in the STA Index to invalid, since at this point we have not
      yet received it from HAL */
-  halConfigBssReqMsg.uBssParams.configBssParams.staContext.staIdx = WDI_STA_INVALID_IDX;
+  halConfigBssReqMsg.configBssParams.staContext.staIdx = WDI_STA_INVALID_IDX;
 
   /* Need to fill in the BSS index */
-  halConfigBssReqMsg.uBssParams.configBssParams.staContext.bssIdx = pBSSSes->ucBSSIdx;
-
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halConfigBssReqMsg.uBssParams.configBssParams,
-                  uMsgSize);
+  halConfigBssReqMsg.configBssParams.staContext.bssIdx = pBSSSes->ucBSSIdx;
+  
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halConfigBssReqMsg.configBssParams, 
+                  sizeof(halConfigBssReqMsg.configBssParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiConfigBSSParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiConfigBSSParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiConfigBSSParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Config BSS Request to HAL
+    Send Config BSS Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiConfigBSSRspCb, pEventData->pUserData,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiConfigBSSRspCb, pEventData->pUserData, 
                        WDI_CONFIG_BSS_RESP);
 
 }/*WDI_ProcessConfigBSSReq*/
 
 
 /**
- @brief Process Del BSS Request function (called when Main FSM
+ @brief Process Del BSS Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessDelBSSReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_DelBSSReqParamsType*  pwdiDelBSSParams    = NULL;
   WDI_DelBSSRspCb           wdiDelBSSRspCb      = NULL;
-  wpt_uint8                 ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                 ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*       pBSSSes             = NULL;
-  wpt_uint8*                pSendBuffer         = NULL;
+  wpt_uint8*                pSendBuffer         = NULL; 
   wpt_uint16                usDataOffset        = 0;
   wpt_uint16                usSendSize          = 0;
-  WDI_Status                wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status                wdiStatus           = WDI_STATUS_SUCCESS; 
 
-  tDeleteBssReqMsg          halBssReqMsg;
+  tDeleteBssReqMsg          halBssReqMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == (pwdiDelBSSParams = (WDI_DelBSSReqParamsType*)pEventData->pEventData)) ||
       ( NULL == (wdiDelBSSRspCb   = (WDI_DelBSSRspCb)pEventData->pCBfnc)))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx,
-                                             pwdiDelBSSParams->ucBssIdx,
-                                            &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx, 
+                                             pwdiDelBSSParams->ucBssIdx, 
+                                            &pBSSSes); 
 
-  if ( NULL == pBSSSes )
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-        "%s: BSS does not yet exist. ucBssIdx %d",
-        __func__, pwdiDelBSSParams->ucBssIdx);
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
 
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. ucBssIdx %d",
-              __func__, pwdiDelBSSParams->ucBssIdx);
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
 
     wpalMutexRelease(&pWDICtx->wptMutex);
 
-    return wdiStatus;
+    return wdiStatus; 
   }
 
   /*-----------------------------------------------------------------------
     If we receive a Del BSS request for an association that is already in
     progress, it indicates that the assoc has failed => we no longer have
     an association in progress => we must check for pending associations
-    that were queued and start as soon as the Del BSS response is received
+    that were queued and start as soon as the Del BSS response is received 
   -----------------------------------------------------------------------*/
   if ( ucCurrentBSSSesIdx == pWDICtx->ucCurrentBSSSesIdx )
   {
@@ -7570,150 +7741,156 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_BSS_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_BSS_REQ, 
                         sizeof(halBssReqMsg.deleteBssParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halBssReqMsg.deleteBssParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in start req %x %x %x",
                 pEventData, pwdiDelBSSParams, wdiDelBSSRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*Fill in the message request structure*/
 
   /*BSS Index is saved on config BSS response and Post Assoc Response */
-  halBssReqMsg.deleteBssParams.bssIdx = pBSSSes->ucBSSIdx;
+  halBssReqMsg.deleteBssParams.bssIdx = pBSSSes->ucBSSIdx; 
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halBssReqMsg.deleteBssParams,
-                  sizeof(halBssReqMsg.deleteBssParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halBssReqMsg.deleteBssParams, 
+                  sizeof(halBssReqMsg.deleteBssParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiDelBSSParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiDelBSSParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiDelBSSParams->pUserData; 
 
-
+ 
   /*-------------------------------------------------------------------------
-    Send Del BSS Request to HAL
+    Send Del BSS Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiDelBSSRspCb, pEventData->pUserData, WDI_DEL_BSS_RESP);
 
-
+  
 }/*WDI_ProcessDelBSSReq*/
 
 /**
- @brief Process Post Assoc Request function (called when Main
+ @brief Process Post Assoc Request function (called when Main 
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessPostAssocReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_PostAssocReqParamsType* pwdiPostAssocParams   = NULL;
   WDI_PostAssocRspCb          wdiPostAssocRspCb     = NULL;
-  wpt_uint8                   ucCurrentBSSSesIdx    = 0;
+  wpt_uint8                   ucCurrentBSSSesIdx    = 0; 
   WDI_BSSSessionType*         pBSSSes               = NULL;
-  wpt_uint8*                  pSendBuffer           = NULL;
+  wpt_uint8*                  pSendBuffer           = NULL; 
   wpt_uint16                  usDataOffset          = 0;
   wpt_uint16                  usSendSize            = 0;
   wpt_uint16                  uMsgSize              = 0;
   wpt_uint16                  uOffset               = 0;
-  WDI_Status                  wdiStatus             = WDI_STATUS_SUCCESS;
+  WDI_Status                  wdiStatus             = WDI_STATUS_SUCCESS; 
 
-  tPostAssocReqMsg            halPostAssocReqMsg;
+  tPostAssocReqMsg            halPostAssocReqMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == (pwdiPostAssocParams = (WDI_PostAssocReqParamsType*)pEventData->pEventData)) ||
       ( NULL == (wdiPostAssocRspCb   = (WDI_PostAssocRspCb)pEventData->pCBfnc)))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                              pwdiPostAssocParams->wdiBSSParams.macBSSID,
-                              &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                              pwdiPostAssocParams->wdiBSSParams.macBSSID, 
+                              &pBSSSes); 
 
   if ( NULL == pBSSSes )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "%s: Association sequence for this BSS does not yet exist - "
-              "operation not allowed. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(pwdiPostAssocParams->wdiBSSParams.macBSSID));
-
+              "Association sequence for this BSS does not yet exist - "
+              "operation not allowed");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(pwdiPostAssocParams->wdiBSSParams.macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
 
     wpalMutexRelease(&pWDICtx->wptMutex);
 
-    return wdiStatus;
+    return wdiStatus; 
   }
 
   /*-----------------------------------------------------------------------
     If Post Assoc was not yet received - the current association must
     be in progress
     -----------------------------------------------------------------------*/
-  if (( ucCurrentBSSSesIdx != pWDICtx->ucCurrentBSSSesIdx ) ||
+  if (( ucCurrentBSSSesIdx != pWDICtx->ucCurrentBSSSesIdx ) || 
       ( eWLAN_PAL_FALSE == pWDICtx->bAssociationInProgress ))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Association sequence for this BSS association no longer in "
               "progress - not allowed");
-
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*-----------------------------------------------------------------------
-    Post Assoc Request is only allowed in Joining state
+    Post Assoc Request is only allowed in Joining state 
   -----------------------------------------------------------------------*/
   if ( WDI_ASSOC_JOINING_ST != pBSSSes->wdiAssocState)
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Post Assoc not allowed before JOIN - failing request");
-
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   wpalMutexRelease(&pWDICtx->wptMutex);
@@ -7721,17 +7898,19 @@
   uMsgSize = sizeof(halPostAssocReqMsg.postAssocReqParams.configStaParams) +
              sizeof(halPostAssocReqMsg.postAssocReqParams.configBssParams) ;
   /*-----------------------------------------------------------------------
-    Fill message for tx over the bus
+    Fill message for tx over the bus 
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_POST_ASSOC_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_POST_ASSOC_REQ, 
                         uMsgSize,&pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + uMsgSize )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in start req %x %x %x",
                 pEventData, pwdiPostAssocParams, wdiPostAssocRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*Copy the STA parameters */
@@ -7739,19 +7918,21 @@
                                &pwdiPostAssocParams->wdiSTAParams );
 
   /* Need to fill in the self STA Index */
-  if ( WDI_STATUS_SUCCESS !=
+  if ( WDI_STATUS_SUCCESS != 
        WDI_STATableFindStaidByAddr(pWDICtx,
                                    pwdiPostAssocParams->wdiSTAParams.macSTA,
                                    (wpt_uint8*)&halPostAssocReqMsg.postAssocReqParams.configStaParams.staIdx ))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
   /* Need to fill in the BSS index */
-  halPostAssocReqMsg.postAssocReqParams.configStaParams.bssIdx =
+  halPostAssocReqMsg.postAssocReqParams.configStaParams.bssIdx = 
      pBSSSes->ucBSSIdx;
 
   /*Copy the BSS parameters */
@@ -7759,255 +7940,265 @@
                                       &pwdiPostAssocParams->wdiBSSParams);
 
   /* Need to fill in the STA index of the peer */
-  if ( WDI_STATUS_SUCCESS !=
+  if ( WDI_STATUS_SUCCESS != 
        WDI_STATableFindStaidByAddr(pWDICtx,
                                    pwdiPostAssocParams->wdiBSSParams.wdiSTAContext.macSTA,
-                                   (wpt_uint8*)&halPostAssocReqMsg.postAssocReqParams.configBssParams.staContext.staIdx))
+                                   (wpt_uint8*)&halPostAssocReqMsg.postAssocReqParams.configBssParams.staContext.staIdx)) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
   /* Need to fill in the BSS index */
-  halPostAssocReqMsg.postAssocReqParams.configStaParams.bssIdx =
+  halPostAssocReqMsg.postAssocReqParams.configStaParams.bssIdx = 
      pBSSSes->ucBSSIdx;
 
-
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halPostAssocReqMsg.postAssocReqParams.configStaParams,
-                  sizeof(halPostAssocReqMsg.postAssocReqParams.configStaParams));
+  
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halPostAssocReqMsg.postAssocReqParams.configStaParams, 
+                  sizeof(halPostAssocReqMsg.postAssocReqParams.configStaParams)); 
 
   uOffset = sizeof(halPostAssocReqMsg.postAssocReqParams.configStaParams);
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset + uOffset,
-                  &halPostAssocReqMsg.postAssocReqParams.configBssParams,
-                  sizeof(halPostAssocReqMsg.postAssocReqParams.configBssParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset + uOffset, 
+                  &halPostAssocReqMsg.postAssocReqParams.configBssParams, 
+                  sizeof(halPostAssocReqMsg.postAssocReqParams.configBssParams)); 
 
-
+ 
   pWDICtx->wdiReqStatusCB     = pwdiPostAssocParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiPostAssocParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiPostAssocParams->pUserData; 
 
-
-  wpalMemoryCopy( &pWDICtx->wdiCachedPostAssocReq,
+ 
+  wpalMemoryCopy( &pWDICtx->wdiCachedPostAssocReq, 
                   pwdiPostAssocParams,
-                  sizeof(pWDICtx->wdiCachedPostAssocReq));
+                  sizeof(pWDICtx->wdiCachedPostAssocReq));  
 
   /*-------------------------------------------------------------------------
-    Send Post Assoc Request to HAL
+    Send Post Assoc Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiPostAssocRspCb, pEventData->pUserData, WDI_POST_ASSOC_RESP);
 
-
+  
 }/*WDI_ProcessPostAssocReq*/
 
 /**
- @brief Process Del STA Request function (called when Main FSM
+ @brief Process Del STA Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessDelSTAReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_DelSTAReqParamsType*  pwdiDelSTAParams;
   WDI_DelSTARspCb           wdiDelSTARspCb;
-  wpt_uint8                 ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                 ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*       pBSSSes             = NULL;
-  wpt_uint8*                pSendBuffer         = NULL;
+  wpt_uint8*                pSendBuffer         = NULL; 
   wpt_uint16                usDataOffset        = 0;
   wpt_uint16                usSendSize          = 0;
-  wpt_macAddr               macBSSID;
+  wpt_macAddr               macBSSID; 
   WDI_Status                wdiStatus           = WDI_STATUS_SUCCESS;
 
-  tDeleteStaReqMsg          halDelStaReqMsg;
+  tDeleteStaReqMsg          halDelStaReqMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiDelSTAParams = (WDI_DelSTAReqParamsType*)pEventData->pEventData;
   wdiDelSTARspCb   = (WDI_DelSTARspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
     Find the BSS for which the request is made and identify WDI session
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                                                         pwdiDelSTAParams->ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                                         pwdiDelSTAParams->ucSTAIdx, 
                                                          &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
-  if ( NULL == pBSSSes )
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
   wpalMutexRelease(&pWDICtx->wptMutex);
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_STA_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_STA_REQ, 
                         sizeof(halDelStaReqMsg.delStaParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halDelStaReqMsg.delStaParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in start req %x %x %x",
                 pEventData, pwdiDelSTAParams, wdiDelSTARspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  halDelStaReqMsg.delStaParams.staIdx = pwdiDelSTAParams->ucSTAIdx;
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halDelStaReqMsg.delStaParams,
-                  sizeof(halDelStaReqMsg.delStaParams));
+  halDelStaReqMsg.delStaParams.staIdx = pwdiDelSTAParams->ucSTAIdx; 
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halDelStaReqMsg.delStaParams, 
+                  sizeof(halDelStaReqMsg.delStaParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiDelSTAParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiDelSTAParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiDelSTAParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Del STA Request to HAL
+    Send Del STA Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiDelSTARspCb, pEventData->pUserData, WDI_DEL_STA_RESP);
 
 }/*WDI_ProcessDelSTAReq*/
 
 
 /*==========================================================================
-                 SECURITY REQUEST PROCESSING API
+                 SECURITY REQUEST PROCESSING API 
 ==========================================================================*/
 /**
  @brief Process Set BSS Key Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetBssKeyReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_SetBSSKeyReqParamsType*  pwdiSetBSSKeyParams;
   WDI_SetBSSKeyRspCb           wdiSetBSSKeyRspCb;
-  wpt_uint8                    ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*          pBSSSes             = NULL;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
-  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
   tSetBssKeyReqMsg             halSetBssKeyReqMsg  = {{0}};
   wpt_uint8                    keyIndex            = 0;
 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiSetBSSKeyParams = (WDI_SetBSSKeyReqParamsType*)pEventData->pEventData;
   wdiSetBSSKeyRspCb   = (WDI_SetBSSKeyRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx,
-                           pwdiSetBSSKeyParams->wdiBSSKeyInfo.ucBssIdx,
-                          &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx, 
+                           pwdiSetBSSKeyParams->wdiBSSKeyInfo.ucBssIdx, 
+                          &pBSSSes); 
 
-  if ( NULL == pBSSSes )
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "%s: Association sequence for this BSS does not yet exist. ucBssIdx %d",
-              __func__, pwdiSetBSSKeyParams->wdiBSSKeyInfo.ucBssIdx);
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. ucBssIdx %d",
-              __func__, pwdiSetBSSKeyParams->wdiBSSKeyInfo.ucBssIdx);
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
@@ -8015,145 +8206,149 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_BSS_KEY_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_BSS_KEY_REQ, 
                         sizeof(halSetBssKeyReqMsg.setBssKeyParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halSetBssKeyReqMsg.setBssKeyParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiSetBSSKeyParams, wdiSetBSSKeyRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-----------------------------------------------------------------------
     Copy the Key parameters into the HAL message
   -----------------------------------------------------------------------*/
 
-  halSetBssKeyReqMsg.setBssKeyParams.bssIdx = ucCurrentBSSSesIdx;
+  halSetBssKeyReqMsg.setBssKeyParams.bssIdx = ucCurrentBSSSesIdx; 
 
-  halSetBssKeyReqMsg.setBssKeyParams.encType =
+  halSetBssKeyReqMsg.setBssKeyParams.encType = 
              WDI_2_HAL_ENC_TYPE (pwdiSetBSSKeyParams->wdiBSSKeyInfo.wdiEncType);
 
-  halSetBssKeyReqMsg.setBssKeyParams.numKeys =
+  halSetBssKeyReqMsg.setBssKeyParams.numKeys = 
                                   pwdiSetBSSKeyParams->wdiBSSKeyInfo.ucNumKeys;
 
   for(keyIndex = 0; keyIndex < pwdiSetBSSKeyParams->wdiBSSKeyInfo.ucNumKeys ;
                                                                  keyIndex++)
   {
-    halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyId =
+    halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyId = 
                       pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyId;
     halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].unicast =
                      pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].unicast;
     halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyDirection =
                 pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyDirection;
     wpalMemoryCopy(halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyRsc,
-                     pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyRsc,
+                     pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyRsc, 
                      WDI_MAX_KEY_RSC_LEN);
-    halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].paeRole =
+    halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].paeRole = 
                      pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].paeRole;
-    halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyLength =
+    halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].keyLength = 
                    pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].keyLength;
     wpalMemoryCopy(halSetBssKeyReqMsg.setBssKeyParams.key[keyIndex].key,
-                         pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].key,
+                         pwdiSetBSSKeyParams->wdiBSSKeyInfo.aKeys[keyIndex].key, 
                         WDI_MAX_KEY_LENGTH);
    }
-
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                    &halSetBssKeyReqMsg.setBssKeyParams,
-                    sizeof(halSetBssKeyReqMsg.setBssKeyParams));
+                                                                  
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halSetBssKeyReqMsg.setBssKeyParams, 
+                    sizeof(halSetBssKeyReqMsg.setBssKeyParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiSetBSSKeyParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiSetBSSKeyParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiSetBSSKeyParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Set BSS Key Request to HAL
+    Send Set BSS Key Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiSetBSSKeyRspCb, pEventData->pUserData,
-                       WDI_SET_BSS_KEY_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetBSSKeyRspCb, pEventData->pUserData, 
+                       WDI_SET_BSS_KEY_RESP); 
 
 }/*WDI_ProcessSetBssKeyReq*/
 
 /**
- @brief Process Remove BSS Key Request function (called when Main
+ @brief Process Remove BSS Key Request function (called when Main    
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessRemoveBssKeyReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_RemoveBSSKeyReqParamsType*  pwdiRemoveBSSKeyParams;
   WDI_RemoveBSSKeyRspCb           wdiRemoveBSSKeyRspCb;
-  wpt_uint8                       ucCurrentBSSSesIdx     = 0;
+  wpt_uint8                       ucCurrentBSSSesIdx     = 0; 
   WDI_BSSSessionType*             pBSSSes                = NULL;
-  wpt_uint8*                      pSendBuffer            = NULL;
+  wpt_uint8*                      pSendBuffer            = NULL; 
   wpt_uint16                      usDataOffset           = 0;
   wpt_uint16                      usSendSize             = 0;
-  WDI_Status                      wdiStatus              = WDI_STATUS_SUCCESS;
+  WDI_Status                      wdiStatus              = WDI_STATUS_SUCCESS; 
   tRemoveBssKeyReqMsg             halRemoveBssKeyReqMsg  = {{0}};
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiRemoveBSSKeyParams = (WDI_RemoveBSSKeyReqParamsType*)pEventData->pEventData;
   wdiRemoveBSSKeyRspCb   = (WDI_RemoveBSSKeyRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx,
-                           pwdiRemoveBSSKeyParams->wdiKeyInfo.ucBssIdx,
-                          &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx, 
+                           pwdiRemoveBSSKeyParams->wdiKeyInfo.ucBssIdx, 
+                          &pBSSSes); 
 
-  if ( NULL == pBSSSes )
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "%s: Association sequence for this BSS does not yet exist. ucBssIdx %d",
-              __func__, pwdiRemoveBSSKeyParams->wdiKeyInfo.ucBssIdx);
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. ucBssIdx %d",
-              __func__, pwdiRemoveBSSKeyParams->wdiKeyInfo.ucBssIdx);
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
@@ -8162,58 +8357,60 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RMV_BSS_KEY_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RMV_BSS_KEY_REQ, 
                         sizeof(halRemoveBssKeyReqMsg.removeBssKeyParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halRemoveBssKeyReqMsg.removeBssKeyParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiRemoveBSSKeyParams, wdiRemoveBSSKeyRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
   /*-----------------------------------------------------------------------
     Copy the Key parameters into the HAL message
   -----------------------------------------------------------------------*/
   halRemoveBssKeyReqMsg.removeBssKeyParams.bssIdx = ucCurrentBSSSesIdx;
 
-  halRemoveBssKeyReqMsg.removeBssKeyParams.encType =
+  halRemoveBssKeyReqMsg.removeBssKeyParams.encType = 
       WDI_2_HAL_ENC_TYPE (pwdiRemoveBSSKeyParams->wdiKeyInfo.wdiEncType);
 
   halRemoveBssKeyReqMsg.removeBssKeyParams.keyId = pwdiRemoveBSSKeyParams->wdiKeyInfo.ucKeyId;
 
-  halRemoveBssKeyReqMsg.removeBssKeyParams.wepType =
+  halRemoveBssKeyReqMsg.removeBssKeyParams.wepType = 
       WDI_2_HAL_WEP_TYPE(pwdiRemoveBSSKeyParams->wdiKeyInfo.wdiWEPType);
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                    &halRemoveBssKeyReqMsg.removeBssKeyParams,
-                    sizeof(halRemoveBssKeyReqMsg.removeBssKeyParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halRemoveBssKeyReqMsg.removeBssKeyParams, 
+                    sizeof(halRemoveBssKeyReqMsg.removeBssKeyParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiRemoveBSSKeyParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiRemoveBSSKeyParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiRemoveBSSKeyParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Remove BSS Key Request to HAL
+    Send Remove BSS Key Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiRemoveBSSKeyRspCb, pEventData->pUserData,
-                       WDI_RMV_BSS_KEY_RESP);
+                       WDI_RMV_BSS_KEY_RESP); 
 }/*WDI_ProcessRemoveBssKeyReq*/
 
 /**
- @brief Process Set STA KeyRequest function (called when Main FSM
+ @brief Process Set STA KeyRequest function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetStaKeyReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -8221,74 +8418,78 @@
   WDI_SetSTAKeyReqParamsType*  pwdiSetSTAKeyParams;
   WDI_SetSTAKeyRspCb           wdiSetSTAKeyRspCb;
   WDI_BSSSessionType*          pBSSSes             = NULL;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
-  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
   wpt_macAddr                  macBSSID;
-  wpt_uint8                    ucCurrentBSSSesIdx;
+  wpt_uint8                    ucCurrentBSSSesIdx; 
   tSetStaKeyReqMsg             halSetStaKeyReqMsg  = {{0}};
   wpt_uint8                    keyIndex            = 0;
 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
    pwdiSetSTAKeyParams = (WDI_SetSTAKeyReqParamsType*)pEventData->pEventData;
    wdiSetSTAKeyRspCb   = (WDI_SetSTAKeyRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
     Find the BSS for which the request is made and identify WDI session
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                                  pwdiSetSTAKeyParams->wdiKeyInfo.ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                  pwdiSetSTAKeyParams->wdiKeyInfo.ucSTAIdx, 
                                   &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
-  if ( NULL == pBSSSes )
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
-
+ 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
@@ -8296,24 +8497,26 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_STA_KEY_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_STA_KEY_REQ, 
                         sizeof(halSetStaKeyReqMsg.setStaKeyParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halSetStaKeyReqMsg.setStaKeyParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiSetSTAKeyParams, wdiSetSTAKeyRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
   /*-----------------------------------------------------------------------
     Copy the STA Key parameters into the HAL message
   -----------------------------------------------------------------------*/
-  halSetStaKeyReqMsg.setStaKeyParams.encType =
+  halSetStaKeyReqMsg.setStaKeyParams.encType = 
       WDI_2_HAL_ENC_TYPE (pwdiSetSTAKeyParams->wdiKeyInfo.wdiEncType);
 
-  halSetStaKeyReqMsg.setStaKeyParams.wepType =
+  halSetStaKeyReqMsg.setStaKeyParams.wepType = 
       WDI_2_HAL_WEP_TYPE (pwdiSetSTAKeyParams->wdiKeyInfo.wdiWEPType );
 
   halSetStaKeyReqMsg.setStaKeyParams.staIdx = pwdiSetSTAKeyParams->wdiKeyInfo.ucSTAIdx;
@@ -8326,71 +8529,71 @@
   for(keyIndex = 0; keyIndex < pwdiSetSTAKeyParams->wdiKeyInfo.ucNumKeys ;
                                                                  keyIndex++)
   {
-    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyId =
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyId = 
                       pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyId;
     halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].unicast =
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].unicast;
     halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyDirection =
                 pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyDirection;
     wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyRsc,
-                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyRsc,
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyRsc, 
                      WDI_MAX_KEY_RSC_LEN);
-    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].paeRole =
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].paeRole = 
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].paeRole;
-    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyLength =
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyLength = 
                    pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyLength;
     wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].key,
-                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key,
+                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key, 
                         WDI_MAX_KEY_LENGTH);
    }
 #else
-  halSetStaKeyReqMsg.setStaKeyParams.key.keyId =
+  halSetStaKeyReqMsg.setStaKeyParams.key.keyId = 
                       pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyId;
   halSetStaKeyReqMsg.setStaKeyParams.key.unicast =
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].unicast;
   halSetStaKeyReqMsg.setStaKeyParams.key.keyDirection =
                 pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyDirection;
   wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key.keyRsc,
-                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyRsc,
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyRsc, 
                      WDI_MAX_KEY_RSC_LEN);
-  halSetStaKeyReqMsg.setStaKeyParams.key.paeRole =
+  halSetStaKeyReqMsg.setStaKeyParams.key.paeRole = 
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].paeRole;
-  halSetStaKeyReqMsg.setStaKeyParams.key.keyLength =
+  halSetStaKeyReqMsg.setStaKeyParams.key.keyLength = 
                    pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyLength;
   wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key.key,
-                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].key,
+                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].key, 
                         WDI_MAX_KEY_LENGTH);
 #endif
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                    &halSetStaKeyReqMsg.setStaKeyParams,
-                    sizeof(halSetStaKeyReqMsg.setStaKeyParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halSetStaKeyReqMsg.setStaKeyParams, 
+                    sizeof(halSetStaKeyReqMsg.setStaKeyParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiSetSTAKeyParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiSetSTAKeyParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiSetSTAKeyParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Set STA Key Request to HAL
+    Send Set STA Key Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiSetSTAKeyRspCb, pEventData->pUserData,
-                       WDI_SET_STA_KEY_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetSTAKeyRspCb, pEventData->pUserData, 
+                       WDI_SET_STA_KEY_RESP); 
 
 }/*WDI_ProcessSetSTAKeyReq*/
 
 /**
- @brief Process Remove STA Key Request function (called when
+ @brief Process Remove STA Key Request function (called when 
         Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessRemoveStaKeyReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -8398,72 +8601,76 @@
   WDI_RemoveSTAKeyReqParamsType*  pwdiRemoveSTAKeyParams;
   WDI_RemoveSTAKeyRspCb           wdiRemoveSTAKeyRspCb;
   WDI_BSSSessionType*             pBSSSes                = NULL;
-  wpt_uint8*                      pSendBuffer            = NULL;
+  wpt_uint8*                      pSendBuffer            = NULL; 
   wpt_uint16                      usDataOffset           = 0;
   wpt_uint16                      usSendSize             = 0;
-  WDI_Status                      wdiStatus              = WDI_STATUS_SUCCESS;
+  WDI_Status                      wdiStatus              = WDI_STATUS_SUCCESS; 
   wpt_macAddr                     macBSSID;
   wpt_uint8                       ucCurrentBSSSesIdx;
   tRemoveStaKeyReqMsg             halRemoveStaKeyReqMsg  = {{0}};
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiRemoveSTAKeyParams = (WDI_RemoveSTAKeyReqParamsType*)pEventData->pEventData;
   wdiRemoveSTAKeyRspCb   = (WDI_RemoveSTAKeyRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
     Find the BSS for which the request is made and identify WDI session
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                             pwdiRemoveSTAKeyParams->wdiKeyInfo.ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                             pwdiRemoveSTAKeyParams->wdiKeyInfo.ucSTAIdx, 
                              &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
-  if ( NULL == pBSSSes )
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
-
+ 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
@@ -8472,63 +8679,65 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RMV_STA_KEY_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RMV_STA_KEY_REQ, 
                         sizeof(halRemoveStaKeyReqMsg.removeStaKeyParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halRemoveStaKeyReqMsg.removeStaKeyParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiRemoveSTAKeyParams, wdiRemoveSTAKeyRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-----------------------------------------------------------------------
     Copy the Key parameters into the HAL message
   -----------------------------------------------------------------------*/
 
-  halRemoveStaKeyReqMsg.removeStaKeyParams.staIdx =
+  halRemoveStaKeyReqMsg.removeStaKeyParams.staIdx = 
       pwdiRemoveSTAKeyParams->wdiKeyInfo.ucSTAIdx;
 
-  halRemoveStaKeyReqMsg.removeStaKeyParams.encType =
+  halRemoveStaKeyReqMsg.removeStaKeyParams.encType = 
       WDI_2_HAL_ENC_TYPE (pwdiRemoveSTAKeyParams->wdiKeyInfo.wdiEncType);
 
-  halRemoveStaKeyReqMsg.removeStaKeyParams.keyId =
+  halRemoveStaKeyReqMsg.removeStaKeyParams.keyId = 
       pwdiRemoveSTAKeyParams->wdiKeyInfo.ucKeyId;
 
-  halRemoveStaKeyReqMsg.removeStaKeyParams.unicast =
+  halRemoveStaKeyReqMsg.removeStaKeyParams.unicast = 
       pwdiRemoveSTAKeyParams->wdiKeyInfo.ucUnicast;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                    &halRemoveStaKeyReqMsg.removeStaKeyParams,
-                    sizeof(halRemoveStaKeyReqMsg.removeStaKeyParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halRemoveStaKeyReqMsg.removeStaKeyParams, 
+                    sizeof(halRemoveStaKeyReqMsg.removeStaKeyParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiRemoveSTAKeyParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiRemoveSTAKeyParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiRemoveSTAKeyParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Remove STA Key Request to HAL
+    Send Remove STA Key Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiRemoveSTAKeyRspCb, pEventData->pUserData,
-                       WDI_RMV_STA_KEY_RESP);
+                       WDI_RMV_STA_KEY_RESP); 
 
 }/*WDI_ProcessRemoveSTAKeyReq*/
 
 /**
- @brief Process Set STA KeyRequest function (called when Main FSM
+ @brief Process Set STA KeyRequest function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetStaBcastKeyReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -8536,74 +8745,78 @@
   WDI_SetSTAKeyReqParamsType*  pwdiSetSTAKeyParams;
   WDI_SetSTAKeyRspCb           wdiSetSTAKeyRspCb;
   WDI_BSSSessionType*          pBSSSes             = NULL;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
-  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
   wpt_macAddr                  macBSSID;
-  wpt_uint8                    ucCurrentBSSSesIdx;
+  wpt_uint8                    ucCurrentBSSSesIdx; 
   tSetStaKeyReqMsg             halSetStaKeyReqMsg  = {{0}};
   wpt_uint8                    keyIndex            = 0;
 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
    pwdiSetSTAKeyParams = (WDI_SetSTAKeyReqParamsType*)pEventData->pEventData;
    wdiSetSTAKeyRspCb   = (WDI_SetSTAKeyRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
     Find the BSS for which the request is made and identify WDI session
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                                  pwdiSetSTAKeyParams->wdiKeyInfo.ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                  pwdiSetSTAKeyParams->wdiKeyInfo.ucSTAIdx, 
                                   &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
-  if ( NULL == pBSSSes )
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
-
+ 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
@@ -8611,24 +8824,26 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_STA_KEY_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_STA_KEY_REQ, 
                         sizeof(halSetStaKeyReqMsg.setStaKeyParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halSetStaKeyReqMsg.setStaKeyParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiSetSTAKeyParams, wdiSetSTAKeyRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
   /*-----------------------------------------------------------------------
     Copy the STA Key parameters into the HAL message
   -----------------------------------------------------------------------*/
-  halSetStaKeyReqMsg.setStaKeyParams.encType =
+  halSetStaKeyReqMsg.setStaKeyParams.encType = 
       WDI_2_HAL_ENC_TYPE (pwdiSetSTAKeyParams->wdiKeyInfo.wdiEncType);
 
-  halSetStaKeyReqMsg.setStaKeyParams.wepType =
+  halSetStaKeyReqMsg.setStaKeyParams.wepType = 
       WDI_2_HAL_WEP_TYPE (pwdiSetSTAKeyParams->wdiKeyInfo.wdiWEPType );
 
   halSetStaKeyReqMsg.setStaKeyParams.staIdx = pwdiSetSTAKeyParams->wdiKeyInfo.ucSTAIdx;
@@ -8641,71 +8856,71 @@
   for(keyIndex = 0; keyIndex < pwdiSetSTAKeyParams->wdiKeyInfo.ucNumKeys ;
                                                                  keyIndex++)
   {
-    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyId =
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyId = 
                       pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyId;
     halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].unicast =
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].unicast;
     halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyDirection =
                 pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyDirection;
     wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyRsc,
-                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyRsc,
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyRsc, 
                      WDI_MAX_KEY_RSC_LEN);
-    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].paeRole =
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].paeRole = 
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].paeRole;
-    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyLength =
+    halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].keyLength = 
                    pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].keyLength;
     wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key[keyIndex].key,
-                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key,
+                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[keyIndex].key, 
                         WDI_MAX_KEY_LENGTH);
    }
 #else
-  halSetStaKeyReqMsg.setStaKeyParams.key.keyId =
+  halSetStaKeyReqMsg.setStaKeyParams.key.keyId = 
                       pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyId;
   halSetStaKeyReqMsg.setStaKeyParams.key.unicast =
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].unicast;
   halSetStaKeyReqMsg.setStaKeyParams.key.keyDirection =
                 pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyDirection;
   wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key.keyRsc,
-                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyRsc,
+                     pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyRsc, 
                      WDI_MAX_KEY_RSC_LEN);
-  halSetStaKeyReqMsg.setStaKeyParams.key.paeRole =
+  halSetStaKeyReqMsg.setStaKeyParams.key.paeRole = 
                      pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].paeRole;
-  halSetStaKeyReqMsg.setStaKeyParams.key.keyLength =
+  halSetStaKeyReqMsg.setStaKeyParams.key.keyLength = 
                    pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].keyLength;
   wpalMemoryCopy(halSetStaKeyReqMsg.setStaKeyParams.key.key,
-                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].key,
+                         pwdiSetSTAKeyParams->wdiKeyInfo.wdiKey[0].key, 
                         WDI_MAX_KEY_LENGTH);
 #endif
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                    &halSetStaKeyReqMsg.setStaKeyParams,
-                    sizeof(halSetStaKeyReqMsg.setStaKeyParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halSetStaKeyReqMsg.setStaKeyParams, 
+                    sizeof(halSetStaKeyReqMsg.setStaKeyParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiSetSTAKeyParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiSetSTAKeyParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiSetSTAKeyParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Set STA Key Request to HAL
+    Send Set STA Key Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiSetSTAKeyRspCb, pEventData->pUserData,
-                       WDI_SET_STA_KEY_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetSTAKeyRspCb, pEventData->pUserData, 
+                       WDI_SET_STA_KEY_RESP); 
 
 }/*WDI_ProcessSetSTABcastKeyReq*/
 
 /**
- @brief Process Remove STA Key Request function (called when
+ @brief Process Remove STA Key Request function (called when 
         Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessRemoveStaBcastKeyReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -8713,72 +8928,76 @@
   WDI_RemoveSTAKeyReqParamsType*  pwdiRemoveSTABcastKeyParams;
   WDI_RemoveSTAKeyRspCb           wdiRemoveSTAKeyRspCb;
   WDI_BSSSessionType*             pBSSSes                = NULL;
-  wpt_uint8*                      pSendBuffer            = NULL;
+  wpt_uint8*                      pSendBuffer            = NULL; 
   wpt_uint16                      usDataOffset           = 0;
   wpt_uint16                      usSendSize             = 0;
-  WDI_Status                      wdiStatus              = WDI_STATUS_SUCCESS;
+  WDI_Status                      wdiStatus              = WDI_STATUS_SUCCESS; 
   wpt_macAddr                     macBSSID;
   wpt_uint8                       ucCurrentBSSSesIdx;
   tRemoveStaKeyReqMsg             halRemoveStaBcastKeyReqMsg = {{0}};
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
  if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiRemoveSTABcastKeyParams = (WDI_RemoveSTAKeyReqParamsType*)pEventData->pEventData;
   wdiRemoveSTAKeyRspCb   = (WDI_RemoveSTAKeyRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
     Find the BSS for which the request is made and identify WDI session
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                             pwdiRemoveSTABcastKeyParams->wdiKeyInfo.ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                             pwdiRemoveSTABcastKeyParams->wdiKeyInfo.ucSTAIdx, 
                              &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
-  if ( NULL == pBSSSes )
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
-
+ 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-               __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
@@ -8787,158 +9006,166 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RMV_STA_BCAST_KEY_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RMV_STA_BCAST_KEY_REQ, 
                         sizeof(halRemoveStaBcastKeyReqMsg.removeStaKeyParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halRemoveStaBcastKeyReqMsg.removeStaKeyParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiRemoveSTABcastKeyParams, wdiRemoveSTAKeyRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-----------------------------------------------------------------------
     Copy the Key parameters into the HAL message
   -----------------------------------------------------------------------*/
 
-  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.staIdx =
+  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.staIdx = 
       pwdiRemoveSTABcastKeyParams->wdiKeyInfo.ucSTAIdx;
 
-  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.encType =
+  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.encType = 
       WDI_2_HAL_ENC_TYPE (pwdiRemoveSTABcastKeyParams->wdiKeyInfo.wdiEncType);
 
-  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.keyId =
+  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.keyId = 
       pwdiRemoveSTABcastKeyParams->wdiKeyInfo.ucKeyId;
 
-  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.unicast =
+  halRemoveStaBcastKeyReqMsg.removeStaKeyParams.unicast = 
       pwdiRemoveSTABcastKeyParams->wdiKeyInfo.ucUnicast;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                    &halRemoveStaBcastKeyReqMsg.removeStaKeyParams,
-                    sizeof(halRemoveStaBcastKeyReqMsg.removeStaKeyParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                    &halRemoveStaBcastKeyReqMsg.removeStaKeyParams, 
+                    sizeof(halRemoveStaBcastKeyReqMsg.removeStaKeyParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiRemoveSTABcastKeyParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiRemoveSTABcastKeyParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiRemoveSTABcastKeyParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Remove STA Key Request to HAL
+    Send Remove STA Key Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiRemoveSTAKeyRspCb, pEventData->pUserData,
-                       WDI_RMV_STA_KEY_RESP);
+                       WDI_RMV_STA_KEY_RESP); 
 
 }/*WDI_ProcessRemoveSTABcastKeyReq*/
 
 /*==========================================================================
-                   QOS and BA PROCESSING REQUEST API
+                   QOS and BA PROCESSING REQUEST API 
 ==========================================================================*/
 /**
  @brief Process Add TSpec Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessAddTSpecReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_AddTSReqParamsType*  pwdiAddTSParams;
   WDI_AddTsRspCb           wdiAddTSRspCb;
-  wpt_uint8                ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*      pBSSSes             = NULL;
-  wpt_uint8*               pSendBuffer         = NULL;
+  wpt_uint8*               pSendBuffer         = NULL; 
   wpt_uint16               usDataOffset        = 0;
   wpt_uint16               usSendSize          = 0;
-  WDI_Status               wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status               wdiStatus           = WDI_STATUS_SUCCESS; 
   wpt_macAddr              macBSSID;
   tAddTsParams             halAddTsParams      = {0};
-
+  
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiAddTSParams = (WDI_AddTSReqParamsType*)pEventData->pEventData;
   wdiAddTSRspCb   = (WDI_AddTsRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
     Find the BSS for which the request is made and identify WDI session
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                                        pwdiAddTSParams->wdiTsInfo.ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                        pwdiAddTSParams->wdiTsInfo.ucSTAIdx, 
                                         &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
-  if ( NULL == pBSSSes )
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
-
+ 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
   wpalMutexRelease(&pWDICtx->wptMutex);
   /*-----------------------------------------------------------------------
     Get message buffer
-    ! TO DO : proper conversion into the HAL Message Request Format
+    ! TO DO : proper conversion into the HAL Message Request Format 
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ADD_TS_REQ,
-                                                    sizeof(halAddTsParams),
-                                                    &pSendBuffer, &usDataOffset,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ADD_TS_REQ, 
+                                                    sizeof(halAddTsParams), 
+                                                    &pSendBuffer, &usDataOffset, 
                                                     &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halAddTsParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiAddTSParams, wdiAddTSRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   halAddTsParams.staIdx = pwdiAddTSParams->wdiTsInfo.ucSTAIdx;
@@ -8947,112 +9174,114 @@
   //TSPEC IE
   halAddTsParams.tspec.type = pwdiAddTSParams->wdiTsInfo.wdiTspecIE.ucType;
   halAddTsParams.tspec.length = pwdiAddTSParams->wdiTsInfo.wdiTspecIE.ucLength;
-  halAddTsParams.tspec.nomMsduSz =
+  halAddTsParams.tspec.nomMsduSz = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.usNomMsduSz;
-  halAddTsParams.tspec.maxMsduSz =
+  halAddTsParams.tspec.maxMsduSz = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.usMaxMsduSz;
-  halAddTsParams.tspec.minSvcInterval =
+  halAddTsParams.tspec.minSvcInterval = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMinSvcInterval;
-  halAddTsParams.tspec.maxSvcInterval =
+  halAddTsParams.tspec.maxSvcInterval = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMaxSvcInterval;
-  halAddTsParams.tspec.inactInterval =
+  halAddTsParams.tspec.inactInterval = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uInactInterval;
-  halAddTsParams.tspec.suspendInterval =
+  halAddTsParams.tspec.suspendInterval = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uSuspendInterval;
-  halAddTsParams.tspec.svcStartTime =
+  halAddTsParams.tspec.svcStartTime = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uSvcStartTime;
-  halAddTsParams.tspec.minDataRate =
+  halAddTsParams.tspec.minDataRate = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMinDataRate;
-  halAddTsParams.tspec.meanDataRate =
+  halAddTsParams.tspec.meanDataRate = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMeanDataRate;
-  halAddTsParams.tspec.peakDataRate =
+  halAddTsParams.tspec.peakDataRate = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uPeakDataRate;
-  halAddTsParams.tspec.maxBurstSz =
+  halAddTsParams.tspec.maxBurstSz = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMaxBurstSz;
-  halAddTsParams.tspec.delayBound =
+  halAddTsParams.tspec.delayBound = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uDelayBound;
-  halAddTsParams.tspec.minPhyRate =
+  halAddTsParams.tspec.minPhyRate = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.uMinPhyRate;
-  halAddTsParams.tspec.surplusBw =
+  halAddTsParams.tspec.surplusBw = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.usSurplusBw;
-  halAddTsParams.tspec.mediumTime =
+  halAddTsParams.tspec.mediumTime = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.usMediumTime;
 
   //TSPEC IE : TS INFO : TRAFFIC
-  halAddTsParams.tspec.tsinfo.traffic.ackPolicy =
+  halAddTsParams.tspec.tsinfo.traffic.ackPolicy = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.accessPolicy;
-  halAddTsParams.tspec.tsinfo.traffic.userPrio =
+  halAddTsParams.tspec.tsinfo.traffic.userPrio = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.userPrio;
-  halAddTsParams.tspec.tsinfo.traffic.psb =
+  halAddTsParams.tspec.tsinfo.traffic.psb = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.psb;
-  halAddTsParams.tspec.tsinfo.traffic.aggregation =
+  halAddTsParams.tspec.tsinfo.traffic.aggregation = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.aggregation;
-  halAddTsParams.tspec.tsinfo.traffic.direction =
+  halAddTsParams.tspec.tsinfo.traffic.direction = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.direction;
-  halAddTsParams.tspec.tsinfo.traffic.tsid =
+  halAddTsParams.tspec.tsinfo.traffic.tsid = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.tsid;
-  halAddTsParams.tspec.tsinfo.traffic.trafficType =
+  halAddTsParams.tspec.tsinfo.traffic.trafficType = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiTraffic.trafficType;
 
   //TSPEC IE : TS INFO : SCHEDULE
-  halAddTsParams.tspec.tsinfo.schedule.rsvd =
+  halAddTsParams.tspec.tsinfo.schedule.rsvd = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiSchedule.rsvd;
-  halAddTsParams.tspec.tsinfo.schedule.schedule =
+  halAddTsParams.tspec.tsinfo.schedule.schedule = 
      pwdiAddTSParams->wdiTsInfo.wdiTspecIE.wdiTSinfo.wdiSchedule.schedule;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halAddTsParams,
-                  sizeof(halAddTsParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halAddTsParams, 
+                  sizeof(halAddTsParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiAddTSParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiAddTSParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiAddTSParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Add TS Request to HAL
+    Send Add TS Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiAddTSRspCb, pEventData->pUserData,
-                       WDI_ADD_TS_RESP);
+                       WDI_ADD_TS_RESP); 
 }/*WDI_ProcessAddTSpecReq*/
 
 
 /**
  @brief Process Del TSpec Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessDelTSpecReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_DelTSReqParamsType*      pwdiDelTSParams;
   WDI_DelTsRspCb               wdiDelTSRspCb;
-  wpt_uint8                    ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*          pBSSSes             = NULL;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
-  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiDelTSParams = (WDI_DelTSReqParamsType*)pEventData->pEventData;
@@ -9060,277 +9289,287 @@
 
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                           pwdiDelTSParams->wdiDelTSInfo.macBSSID,
-                          &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                           pwdiDelTSParams->wdiDelTSInfo.macBSSID, 
+                          &pBSSSes); 
 
-  if ( NULL == pBSSSes )
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-            "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-            __func__, MAC_ADDR_ARRAY(pwdiDelTSParams->wdiDelTSInfo.macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(pwdiDelTSParams->wdiDelTSInfo.macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
   wpalMutexRelease(&pWDICtx->wptMutex);
   /*-----------------------------------------------------------------------
     Get message buffer
-    ! TO DO : proper conversion into the HAL Message Request Format
+    ! TO DO : proper conversion into the HAL Message Request Format 
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_TS_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_TS_REQ, 
                         sizeof(pwdiDelTSParams->wdiDelTSInfo),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(pwdiDelTSParams->wdiDelTSInfo) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiDelTSParams, wdiDelTSRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &pwdiDelTSParams->wdiDelTSInfo,
-                  sizeof(pwdiDelTSParams->wdiDelTSInfo));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &pwdiDelTSParams->wdiDelTSInfo, 
+                  sizeof(pwdiDelTSParams->wdiDelTSInfo)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiDelTSParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiDelTSParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiDelTSParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Del TS Request to HAL
+    Send Del TS Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiDelTSRspCb, pEventData->pUserData, WDI_DEL_TS_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiDelTSRspCb, pEventData->pUserData, WDI_DEL_TS_RESP); 
 }/*WDI_ProcessDelTSpecReq*/
 
 /**
  @brief Process Update EDCA Params Request function (called when
         Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateEDCAParamsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_UpdateEDCAParamsType*    pwdiUpdateEDCAParams;
   WDI_UpdateEDCAParamsRspCb    wdiUpdateEDCARspCb;
-  wpt_uint8                    ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*          pBSSSes             = NULL;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset         = 0;
   wpt_uint16                   usSendSize           = 0;
-  WDI_Status                   wdiStatus;
+  WDI_Status                   wdiStatus; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiUpdateEDCAParams = (WDI_UpdateEDCAParamsType*)pEventData->pEventData;
   wdiUpdateEDCARspCb   = (WDI_UpdateEDCAParamsRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx,
-                           pwdiUpdateEDCAParams->wdiEDCAInfo.ucBssIdx,
-                          &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx, 
+                           pwdiUpdateEDCAParams->wdiEDCAInfo.ucBssIdx, 
+                          &pBSSSes); 
 
-  if ( NULL == pBSSSes )
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-            "%s: Association sequence for this BSS does not yet exist. ucBssIdx %d",
-            __func__, pwdiUpdateEDCAParams->wdiEDCAInfo.ucBssIdx);
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. ucBssIdx %d",
-              __func__, pwdiUpdateEDCAParams->wdiEDCAInfo.ucBssIdx);
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
   wpalMutexRelease(&pWDICtx->wptMutex);
   /*-----------------------------------------------------------------------
     Get message buffer
-    ! TO DO : proper conversion into the HAL Message Request Format
+    ! TO DO : proper conversion into the HAL Message Request Format 
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPD_EDCA_PRMS_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPD_EDCA_PRMS_REQ, 
                         sizeof(pwdiUpdateEDCAParams->wdiEDCAInfo),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(pwdiUpdateEDCAParams->wdiEDCAInfo) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiUpdateEDCAParams, wdiUpdateEDCARspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &pwdiUpdateEDCAParams->wdiEDCAInfo,
-                  sizeof(pwdiUpdateEDCAParams->wdiEDCAInfo));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &pwdiUpdateEDCAParams->wdiEDCAInfo, 
+                  sizeof(pwdiUpdateEDCAParams->wdiEDCAInfo)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiUpdateEDCAParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiUpdateEDCAParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiUpdateEDCAParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Update EDCA Params Request to HAL
+    Send Update EDCA Params Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiUpdateEDCARspCb, pEventData->pUserData,
-                       WDI_UPD_EDCA_PRMS_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiUpdateEDCARspCb, pEventData->pUserData, 
+                       WDI_UPD_EDCA_PRMS_RESP); 
 }/*WDI_ProcessUpdateEDCAParamsReq*/
 
 /**
- @brief Process Add BA Request function (called when Main FSM
+ @brief Process Add BA Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessAddBASessionReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_AddBASessionReqParamsType*  pwdiAddBASessionParams;
   WDI_AddBASessionRspCb           wdiAddBASessionRspCb;
-  wpt_uint8                       ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                       ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*             pBSSSes             = NULL;
-  wpt_uint8*                      pSendBuffer         = NULL;
+  wpt_uint8*                      pSendBuffer         = NULL; 
   wpt_uint16                      usDataOffset        = 0;
   wpt_uint16                      usSendSize          = 0;
-  WDI_Status                      wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status                      wdiStatus           = WDI_STATUS_SUCCESS; 
   wpt_macAddr                     macBSSID;
 
   tAddBASessionReqMsg             halAddBASessionReq;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  pwdiAddBASessionParams =
+  pwdiAddBASessionParams = 
                   (WDI_AddBASessionReqParamsType*)pEventData->pEventData;
-  wdiAddBASessionRspCb =
+  wdiAddBASessionRspCb = 
                   (WDI_AddBASessionRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                   pwdiAddBASessionParams->wdiBASessionInfoType.ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                   pwdiAddBASessionParams->wdiBASessionInfoType.ucSTAIdx, 
                    &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
 
-  if ( NULL == pBSSSes )
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-          "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-          __func__, MAC_ADDR_ARRAY(macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-               __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
@@ -9338,18 +9577,20 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                        WDI_ADD_BA_SESSION_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                        WDI_ADD_BA_SESSION_REQ, 
                         sizeof(halAddBASessionReq.addBASessionParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
-      ( usSendSize <
+      ( usSendSize < 
             (usDataOffset + sizeof(halAddBASessionReq.addBASessionParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in Add BA session req %x %x %x",
                 pEventData, pwdiAddBASessionParams, wdiAddBASessionRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   halAddBASessionReq.addBASessionParams.staIdx =
@@ -9370,335 +9611,350 @@
   halAddBASessionReq.addBASessionParams.baDirection =
                   pwdiAddBASessionParams->wdiBASessionInfoType.ucBaDirection;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halAddBASessionReq.addBASessionParams,
-                  sizeof(halAddBASessionReq.addBASessionParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halAddBASessionReq.addBASessionParams, 
+                  sizeof(halAddBASessionReq.addBASessionParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiAddBASessionParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiAddBASessionParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiAddBASessionParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Start Request to HAL
+    Send Start Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiAddBASessionRspCb, pEventData->pUserData,
-                        WDI_ADD_BA_SESSION_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiAddBASessionRspCb, pEventData->pUserData, 
+                        WDI_ADD_BA_SESSION_RESP); 
 }/*WDI_ProcessAddBASessionReq*/
 
 /**
- @brief Process Del BA Request function (called when Main FSM
+ @brief Process Del BA Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessDelBAReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_DelBAReqParamsType*      pwdiDelBAParams;
   WDI_DelBARspCb               wdiDelBARspCb;
-  wpt_uint8                    ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*          pBSSSes             = NULL;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
-  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
   wpt_macAddr                  macBSSID;
   tDelBAParams                 halDelBAparam;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiDelBAParams = (WDI_DelBAReqParamsType*)pEventData->pEventData;
   wdiDelBARspCb   = (WDI_DelBARspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                                     pwdiDelBAParams->wdiBAInfo.ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                     pwdiDelBAParams->wdiBAInfo.ucSTAIdx, 
                                      &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
 
-  if ( NULL == pBSSSes )
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-            "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-            __func__, MAC_ADDR_ARRAY(macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
   wpalMutexRelease(&pWDICtx->wptMutex);
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_BA_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_BA_REQ, 
                         sizeof(halDelBAparam),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halDelBAparam) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer for DEL BA req %x %x %x",
                 pEventData, pwdiDelBAParams, wdiDelBARspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   halDelBAparam.staIdx = pwdiDelBAParams->wdiBAInfo.ucSTAIdx;
   halDelBAparam.baTID = pwdiDelBAParams->wdiBAInfo.ucBaTID;
   halDelBAparam.baDirection = pwdiDelBAParams->wdiBAInfo.ucBaDirection;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halDelBAparam,
-                  sizeof(halDelBAparam));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halDelBAparam, 
+                  sizeof(halDelBAparam)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiDelBAParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiDelBAParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiDelBAParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Start Request to HAL
+    Send Start Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiDelBARspCb, pEventData->pUserData, WDI_DEL_BA_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiDelBARspCb, pEventData->pUserData, WDI_DEL_BA_RESP); 
 }/*WDI_ProcessDelBAReq*/
 
 #ifdef FEATURE_WLAN_CCX
 
 WDI_Status
 WDI_ProcessTSMStatsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_TSMStatsReqParamsType*  pwdiTSMParams;
   WDI_TsmRspCb                wdiTSMRspCb;
-  wpt_uint8                   ucCurrentBSSSesIdx   = 0;
+  wpt_uint8                   ucCurrentBSSSesIdx   = 0; 
   WDI_BSSSessionType*         pBSSSes              = NULL;
-  wpt_uint8*                  pSendBuffer          = NULL;
+  wpt_uint8*                  pSendBuffer          = NULL; 
   wpt_uint16                  usDataOffset         = 0;
   wpt_uint16                  usSendSize           = 0;
-  WDI_Status                  wdiStatus            = WDI_STATUS_SUCCESS;
+  WDI_Status                  wdiStatus            = WDI_STATUS_SUCCESS; 
   tTsmStatsParams             halTsmStatsReqParams = {0};
-
+  
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-       Sanity check
+       Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiTSMParams = (WDI_TSMStatsReqParamsType*)pEventData->pEventData;
   wdiTSMRspCb   = (WDI_TsmRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, pwdiTSMParams->wdiTsmStatsParamsInfo.bssid, &pBSSSes);
-  if ( NULL == pBSSSes )
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, pwdiTSMParams->wdiTsmStatsParamsInfo.bssid, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-            "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-            __func__, MAC_ADDR_ARRAY(pwdiTSMParams->wdiTsmStatsParamsInfo.bssid));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(pwdiTSMParams->wdiTsmStatsParamsInfo.bssid));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
   wpalMutexRelease(&pWDICtx->wptMutex);
   /*-----------------------------------------------------------------------
     Get message buffer
-    ! TO DO : proper conversion into the HAL Message Request Format
+    ! TO DO : proper conversion into the HAL Message Request Format 
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_TSM_STATS_REQ,
-                                                    sizeof(halTsmStatsReqParams),
-                                                    &pSendBuffer, &usDataOffset,                                                     &usSendSize))||
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_TSM_STATS_REQ, 
+                                                    sizeof(halTsmStatsReqParams), 
+                                                    &pSendBuffer, &usDataOffset,
+                                                    &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halTsmStatsReqParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiTSMParams, wdiTSMRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   halTsmStatsReqParams.tsmTID = pwdiTSMParams->wdiTsmStatsParamsInfo.ucTid;
   wpalMemoryCopy(halTsmStatsReqParams.bssId,
                  pwdiTSMParams->wdiTsmStatsParamsInfo.bssid,
                  WDI_MAC_ADDR_LEN);
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halTsmStatsReqParams,
-                  sizeof(halTsmStatsReqParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halTsmStatsReqParams, 
+                  sizeof(halTsmStatsReqParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiTSMParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiTSMParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiTSMParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send TSM Stats Request to HAL
+    Send TSM Stats Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiTSMRspCb, pEventData->pUserData,
-                       WDI_TSM_STATS_RESP);
+                       WDI_TSM_STATS_RESP); 
 }/*WDI_ProcessTSMStatsReq*/
 
 #endif
 
 
 /**
- @brief Process Flush AC Request function (called when Main FSM
+ @brief Process Flush AC Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessFlushAcReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_FlushAcReqParamsType*    pwdiFlushAcParams = NULL;
    WDI_FlushAcRspCb             wdiFlushAcRspCb;
-   wpt_uint8*                   pSendBuffer         = NULL;
+   wpt_uint8*                   pSendBuffer         = NULL; 
    wpt_uint16                   usDataOffset        = 0;
    wpt_uint16                   usSendSize          = 0;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
        ( NULL == pEventData->pCBfnc ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    pwdiFlushAcParams = (WDI_FlushAcReqParamsType*)pEventData->pEventData;
    wdiFlushAcRspCb   = (WDI_FlushAcRspCb)pEventData->pCBfnc;
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_FLUSH_AC_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_FLUSH_AC_REQ, 
                          sizeof(pwdiFlushAcParams->wdiFlushAcInfo),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(pwdiFlushAcParams->wdiFlushAcInfo) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in set bss key req %x %x %x",
                  pEventData, pwdiFlushAcParams, wdiFlushAcRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &pwdiFlushAcParams->wdiFlushAcInfo,
-                   sizeof(pwdiFlushAcParams->wdiFlushAcInfo));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &pwdiFlushAcParams->wdiFlushAcInfo, 
+                   sizeof(pwdiFlushAcParams->wdiFlushAcInfo)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiFlushAcParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiFlushAcParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiFlushAcParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Start Request to HAL
+     Send Start Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiFlushAcRspCb, pEventData->pUserData, WDI_FLUSH_AC_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiFlushAcRspCb, pEventData->pUserData, WDI_FLUSH_AC_RESP); 
 }/*WDI_ProcessFlushAcReq*/
 
 /**
- @brief Process BT AMP event Request function (called when Main
+ @brief Process BT AMP event Request function (called when Main 
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessBtAmpEventReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_BtAmpEventParamsType*    pwdiBtAmpEventParams = NULL;
    WDI_BtAmpEventRspCb          wdiBtAmpEventRspCb;
-   wpt_uint8*                   pSendBuffer         = NULL;
+   wpt_uint8*                   pSendBuffer         = NULL; 
    wpt_uint16                   usDataOffset        = 0;
    wpt_uint16                   usSendSize          = 0;
 
@@ -9706,244 +9962,258 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
        ( NULL == pEventData->pCBfnc ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    pwdiBtAmpEventParams = (WDI_BtAmpEventParamsType*)pEventData->pEventData;
    wdiBtAmpEventRspCb   = (WDI_BtAmpEventRspCb)pEventData->pCBfnc;
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_BTAMP_EVENT_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_BTAMP_EVENT_REQ, 
                          sizeof(haltBtAmpEventMsg.btAmpEventParams),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(haltBtAmpEventMsg.btAmpEventParams) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in BT AMP event req %x %x %x",
                  pEventData, pwdiBtAmpEventParams, wdiBtAmpEventRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   haltBtAmpEventMsg.btAmpEventParams.btAmpEventType =
+   haltBtAmpEventMsg.btAmpEventParams.btAmpEventType = 
       pwdiBtAmpEventParams->wdiBtAmpEventInfo.ucBtAmpEventType;
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &haltBtAmpEventMsg.btAmpEventParams,
-                   sizeof(haltBtAmpEventMsg.btAmpEventParams));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &haltBtAmpEventMsg.btAmpEventParams, 
+                   sizeof(haltBtAmpEventMsg.btAmpEventParams)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiBtAmpEventParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiBtAmpEventParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiBtAmpEventParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Start Request to HAL
+     Send Start Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiBtAmpEventRspCb, pEventData->pUserData, WDI_BTAMP_EVENT_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiBtAmpEventRspCb, pEventData->pUserData, WDI_BTAMP_EVENT_RESP); 
 }/*WDI_ProcessBtAmpEventReq*/
 
 /**
  @brief Process Add STA self Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessAddSTASelfReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_AddSTASelfReqParamsType*          pwdiAddSTASelfReqParams;
   WDI_AddSTASelfParamsRspCb             wdiAddSTASelfReqRspCb;
-  wpt_uint8*                            pSendBuffer         = NULL;
+  wpt_uint8*                            pSendBuffer         = NULL; 
   wpt_uint16                            usDataOffset        = 0;
   wpt_uint16                            usSendSize          = 0;
-  tAddStaSelfParams                     halAddSTASelfParams;
+  tAddStaSelfParams                     halAddSTASelfParams; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData) ||
       ( NULL == pEventData->pCBfnc))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  pwdiAddSTASelfReqParams =
+  pwdiAddSTASelfReqParams = 
     (WDI_AddSTASelfReqParamsType*)pEventData->pEventData;
-  wdiAddSTASelfReqRspCb =
+  wdiAddSTASelfReqRspCb = 
     (WDI_AddSTASelfParamsRspCb)pEventData->pCBfnc;
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                        WDI_ADD_STA_SELF_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                        WDI_ADD_STA_SELF_REQ, 
                         sizeof(tAddStaSelfParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(tAddStaSelfParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in ADD STA SELF REQ %x %x %x",
      pEventData, pwdiAddSTASelfReqParams, wdiAddSTASelfReqRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /* Cache the request for response processing */
-  wpalMemoryCopy(&pWDICtx->wdiCacheAddSTASelfReq, pwdiAddSTASelfReqParams,
+  wpalMemoryCopy(&pWDICtx->wdiCacheAddSTASelfReq, pwdiAddSTASelfReqParams, 
                  sizeof(pWDICtx->wdiCacheAddSTASelfReq));
 
-  wpalMemoryCopy(halAddSTASelfParams.selfMacAddr,
+  wpalMemoryCopy(halAddSTASelfParams.selfMacAddr, 
                    pwdiAddSTASelfReqParams->wdiAddSTASelfInfo.selfMacAddr, 6) ;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset, &halAddSTASelfParams,
-                                         sizeof(tAddStaSelfParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, &halAddSTASelfParams, 
+                                         sizeof(tAddStaSelfParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiAddSTASelfReqParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiAddSTASelfReqParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiAddSTASelfReqParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Update Probe Resp Template Request to HAL
+    Send Update Probe Resp Template Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiAddSTASelfReqRspCb, pEventData->pUserData,
-                       WDI_ADD_STA_SELF_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiAddSTASelfReqRspCb, pEventData->pUserData, 
+                       WDI_ADD_STA_SELF_RESP); 
 }/*WDI_ProcessAddSTASelfReq*/
 
 
 
 /**
- @brief Process Del Sta Self Request function (called when Main
+ @brief Process Del Sta Self Request function (called when Main 
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessDelSTASelfReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_DelSTASelfReqParamsType*      pwdiDelStaSelfReqParams;
   WDI_DelSTASelfRspCb               wdiDelStaSelfRspCb;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
   tDelStaSelfParams            halSetDelSelfSTAParams;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  pwdiDelStaSelfReqParams =
+  pwdiDelStaSelfReqParams = 
                  (WDI_DelSTASelfReqParamsType*)pEventData->pEventData;
   wdiDelStaSelfRspCb      = (WDI_DelSTASelfRspCb)pEventData->pCBfnc;
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_STA_SELF_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_DEL_STA_SELF_REQ, 
                          sizeof(pwdiDelStaSelfReqParams->wdiDelStaSelfInfo),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
-    ( usSendSize <
+    ( usSendSize < 
          (usDataOffset + sizeof(pwdiDelStaSelfReqParams->wdiDelStaSelfInfo) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Del Sta Self req %x %x %x",
                  pEventData, pwdiDelStaSelfReqParams, wdiDelStaSelfRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
   }
 
-  wpalMemoryCopy(halSetDelSelfSTAParams.selfMacAddr,
+  wpalMemoryCopy(halSetDelSelfSTAParams.selfMacAddr, 
                    pwdiDelStaSelfReqParams->wdiDelStaSelfInfo.selfMacAddr, 6) ;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset, &halSetDelSelfSTAParams,
-                                         sizeof(tDelStaSelfParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, &halSetDelSelfSTAParams, 
+                                         sizeof(tDelStaSelfParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiDelStaSelfReqParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiDelStaSelfReqParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiDelStaSelfReqParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-     Send Start Request to HAL
+     Send Start Request to HAL 
    -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiDelStaSelfRspCb, pEventData->pUserData,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiDelStaSelfRspCb, pEventData->pUserData, 
                                                      WDI_DEL_STA_SELF_RESP);
 
 }
 
 #ifdef FEATURE_OEM_DATA_SUPPORT
 /**
- @brief Process Start Oem Data Request function (called when Main
+ @brief Process Start Oem Data Request function (called when Main 
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessStartOemDataReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_oemDataReqParamsType*    pwdiOemDataReqParams = NULL;
   WDI_oemDataRspCb             wdiOemDataRspCb;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
   wpt_uint16                   reqLen;
   tStartOemDataReqParams*      halStartOemDataReqParams;
 
   /*-------------------------------------------------------------------------
-  Sanity check
+  Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiOemDataReqParams = (WDI_oemDataReqParamsType*)pEventData->pEventData;
@@ -9955,16 +10225,18 @@
 
   reqLen = sizeof(tStartOemDataReqParams);
 
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
                          WDI_START_OEM_DATA_REQ, reqLen,
                               &pSendBuffer, &usDataOffset, &usSendSize))||
         (usSendSize < (usDataOffset + reqLen)))
   {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Start Oem Data req %x %x %x",
                  pEventData, pwdiOemDataReqParams, wdiOemDataRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
   }
 
   //copying WDI OEM DATA REQ PARAMS to shared memory
@@ -9974,37 +10246,37 @@
   wpalMemoryCopy(&halStartOemDataReqParams->oemDataReq, &pwdiOemDataReqParams->wdiOemDataReqInfo.oemDataReq, OEM_DATA_REQ_SIZE);
 
   pWDICtx->wdiReqStatusCB     = pwdiOemDataReqParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiOemDataReqParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiOemDataReqParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Start Request to HAL
+    Send Start Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiOemDataRspCb, pEventData->pUserData,
-                                            WDI_START_OEM_DATA_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiOemDataRspCb, pEventData->pUserData, 
+                                            WDI_START_OEM_DATA_RESP); 
 }/*WDI_ProcessStartOemDataReq*/
 #endif
 
 /**
- @brief Process Host Resume Request function (called when Main
+ @brief Process Host Resume Request function (called when Main 
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessHostResumeReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_ResumeParamsType*          pwdiHostResumeParams = NULL;
   WDI_HostResumeEventRspCb       wdiHostResumeRspCb;
-  wpt_uint8*                     pSendBuffer         = NULL;
+  wpt_uint8*                     pSendBuffer         = NULL; 
   wpt_uint16                     usDataOffset        = 0;
   wpt_uint16                     usSendSize          = 0;
   tHalWlanHostResumeReqParam     halResumeReqParams;
@@ -10012,15 +10284,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-  Sanity check
+  Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "%s: Invalid parameters ",__FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
   }
 
    pwdiHostResumeParams = (WDI_ResumeParamsType*)pEventData->pEventData;
@@ -10029,109 +10303,115 @@
   /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
                          WDI_HOST_RESUME_REQ, sizeof(halResumeReqParams),
                               &pSendBuffer, &usDataOffset, &usSendSize))||
         (usSendSize < (usDataOffset + sizeof(halResumeReqParams))))
   {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Start Oem Data req %x %x %x",
                  pEventData, pwdiHostResumeParams, wdiHostResumeRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
   }
 
-  halResumeReqParams.configuredMcstBcstFilterSetting =
+  halResumeReqParams.configuredMcstBcstFilterSetting = 
      pwdiHostResumeParams->wdiResumeParams.ucConfiguredMcstBcstFilterSetting;
-
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halResumeReqParams,
-                  sizeof(halResumeReqParams));
+       
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halResumeReqParams, 
+                  sizeof(halResumeReqParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiHostResumeParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiHostResumeParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiHostResumeParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Start Request to HAL
+    Send Start Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiHostResumeRspCb, pEventData->pUserData,
-                                            WDI_HOST_RESUME_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiHostResumeRspCb, pEventData->pUserData, 
+                                            WDI_HOST_RESUME_RESP); 
 }/*WDI_ProcessHostResumeReq*/
 
 /**
- @brief Process set Tx Per Tracking Parameters Request function (called
+ @brief Process set Tx Per Tracking Parameters Request function (called 
         when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetTxPerTrackingReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_SetTxPerTrackingReqParamsType* pwdiSetTxPerTrackingReqParams = NULL;
    WDI_SetTxPerTrackingRspCb          pwdiSetTxPerTrackingRspCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    tHalTxPerTrackingReqParam     halTxPerTrackingReqParam;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
        ( NULL == pEventData->pCBfnc ))
    {
+#ifdef WLAN_DEBUG
        WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters ",__FUNCTION__);
        WDI_ASSERT(0);
-       return WDI_STATUS_E_FAILURE;
+#endif
+       return WDI_STATUS_E_FAILURE; 
    }
 
    pwdiSetTxPerTrackingReqParams = (WDI_SetTxPerTrackingReqParamsType*)pEventData->pEventData;
    pwdiSetTxPerTrackingRspCb   = (WDI_SetTxPerTrackingRspCb)pEventData->pCBfnc;
-
+   
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_TX_PER_TRACKING_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_TX_PER_TRACKING_REQ, 
                          sizeof(halTxPerTrackingReqParam),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(halTxPerTrackingReqParam) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in set tx per tracking req %x %x %x",
                   pEventData, pwdiSetTxPerTrackingReqParams, pwdiSetTxPerTrackingRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
-
+   
    halTxPerTrackingReqParam.ucTxPerTrackingEnable = pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.ucTxPerTrackingEnable;
    halTxPerTrackingReqParam.ucTxPerTrackingPeriod = pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.ucTxPerTrackingPeriod;
    halTxPerTrackingReqParam.ucTxPerTrackingRatio = pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.ucTxPerTrackingRatio;
    halTxPerTrackingReqParam.uTxPerTrackingWatermark = pwdiSetTxPerTrackingReqParams->wdiTxPerTrackingParam.uTxPerTrackingWatermark;
-
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &halTxPerTrackingReqParam,
-                   sizeof(halTxPerTrackingReqParam));
+      
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &halTxPerTrackingReqParam, 
+                   sizeof(halTxPerTrackingReqParam)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiSetTxPerTrackingReqParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiSetTxPerTrackingReqParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiSetTxPerTrackingReqParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        pwdiSetTxPerTrackingRspCb, pEventData->pUserData, WDI_SET_TX_PER_TRACKING_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        pwdiSetTxPerTrackingRspCb, pEventData->pUserData, WDI_SET_TX_PER_TRACKING_RESP); 
 }/*WDI_ProcessSetTxPerTrackingReq*/
 
 /*=========================================================================
@@ -10140,22 +10420,22 @@
 
 /**
  @brief Process Suspend Indications function (called when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessHostSuspendInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_SuspendParamsType          *pSuspendIndParams;
-  wpt_uint8*                     pSendBuffer         = NULL;
+  wpt_uint8*                     pSendBuffer         = NULL; 
   wpt_uint16                     usDataOffset        = 0;
   wpt_uint16                     usSendSize          = 0;
   WDI_Status                     wdiStatus;
@@ -10163,14 +10443,16 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ))
   {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "%s: Invalid parameters in Suspend ind",__FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
   }
 
   pSuspendIndParams = (WDI_SuspendParamsType *)pEventData->pEventData;
@@ -10178,107 +10460,113 @@
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                         WDI_HOST_SUSPEND_IND,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                         WDI_HOST_SUSPEND_IND, 
                      sizeof(halWlanSuspendIndparams),
                      &pSendBuffer, &usDataOffset, &usSendSize))||
         (usSendSize < (usDataOffset + sizeof(halWlanSuspendIndparams))))
   {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in Suspend Ind ");
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
   }
 
   halWlanSuspendIndparams.configuredMcstBcstFilterSetting =
        pSuspendIndParams->wdiSuspendParams.ucConfiguredMcstBcstFilterSetting;
 
-  halWlanSuspendIndparams.activeSessionCount =
+  halWlanSuspendIndparams.activeSessionCount = 
        WDI_GetActiveSessionsCount(pWDICtx);
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset, &halWlanSuspendIndparams,
-                                         sizeof(tHalWlanHostSuspendIndParam));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, &halWlanSuspendIndparams, 
+                                         sizeof(tHalWlanHostSuspendIndParam)); 
 
   /*-------------------------------------------------------------------------
-    Send Suspend Request to HAL
+    Send Suspend Request to HAL 
   -------------------------------------------------------------------------*/
   pWDICtx->wdiReqStatusCB     = pSuspendIndParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pSuspendIndParams->pUserData;
+  pWDICtx->pReqStatusUserData = pSuspendIndParams->pUserData; 
 
-  wdiStatus = WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize);
+  wdiStatus = WDI_SendIndication( pWDICtx, pSendBuffer, usSendSize); 
   return  ( wdiStatus != WDI_STATUS_SUCCESS )?wdiStatus:WDI_STATUS_SUCCESS_SYNC;
 }/*WDI_ProcessHostSuspendInd*/
 
 /*==========================================================================
-                  MISC CONTROL PROCESSING REQUEST API
+                  MISC CONTROL PROCESSING REQUEST API 
 ==========================================================================*/
 /**
- @brief Process Channel Switch Request function (called when
+ @brief Process Channel Switch Request function (called when 
         Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessChannelSwitchReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_SwitchChReqParamsType*   pwdiSwitchChParams;
   WDI_SwitchChRspCb            wdiSwitchChRspCb;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
   tSwitchChannelReqMsg         halSwitchChannelReq = {{0}};
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiSwitchChParams = (WDI_SwitchChReqParamsType*)pEventData->pEventData;
   wdiSwitchChRspCb   = (WDI_SwitchChRspCb)pEventData->pCBfnc;
   /*-----------------------------------------------------------------------
     Get message buffer
-    ! TO DO : proper conversion into the HAL Message Request Format
+    ! TO DO : proper conversion into the HAL Message Request Format 
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CH_SWITCH_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CH_SWITCH_REQ, 
                         sizeof(halSwitchChannelReq.switchChannelParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halSwitchChannelReq.switchChannelParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in channel switch req %x %x %x",
                 pEventData, pwdiSwitchChParams, wdiSwitchChRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  halSwitchChannelReq.switchChannelParams.channelNumber =
+  halSwitchChannelReq.switchChannelParams.channelNumber = 
                        pwdiSwitchChParams->wdiChInfo.ucChannel;
-#ifndef WLAN_FEATURE_VOWIFI
-  halSwitchChannelReq.switchChannelParams.localPowerConstraint =
+#ifndef WLAN_FEATURE_VOWIFI    
+  halSwitchChannelReq.switchChannelParams.localPowerConstraint = 
                        pwdiSwitchChParams->wdiChInfo.ucLocalPowerConstraint;
 #endif
-  halSwitchChannelReq.switchChannelParams.secondaryChannelOffset =
+  halSwitchChannelReq.switchChannelParams.secondaryChannelOffset = 
                        pwdiSwitchChParams->wdiChInfo.wdiSecondaryChannelOffset;
 
 #ifdef WLAN_FEATURE_VOWIFI
   halSwitchChannelReq.switchChannelParams.maxTxPower
-                            = pwdiSwitchChParams->wdiChInfo.cMaxTxPower;
+                            = pwdiSwitchChParams->wdiChInfo.cMaxTxPower; 
   wpalMemoryCopy(halSwitchChannelReq.switchChannelParams.selfStaMacAddr,
                   pwdiSwitchChParams->wdiChInfo.macSelfStaMacAddr,
                   WDI_MAC_ADDR_LEN);
@@ -10286,274 +10574,275 @@
                   pwdiSwitchChParams->wdiChInfo.macBSSId,
                   WDI_MAC_ADDR_LEN);
 #endif
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halSwitchChannelReq.switchChannelParams,
-                  sizeof(halSwitchChannelReq.switchChannelParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halSwitchChannelReq.switchChannelParams, 
+                  sizeof(halSwitchChannelReq.switchChannelParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiSwitchChParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiSwitchChParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiSwitchChParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Switch Channel Request to HAL
+    Send Switch Channel Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiSwitchChRspCb, pEventData->pUserData, WDI_CH_SWITCH_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSwitchChRspCb, pEventData->pUserData, WDI_CH_SWITCH_RESP); 
 }/*WDI_ProcessChannelSwitchReq*/
 
 /**
- @brief Process Config STA Request function (called when Main FSM
+ @brief Process Config STA Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessConfigStaReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_ConfigSTAReqParamsType*  pwdiConfigSTAParams;
   WDI_ConfigSTARspCb           wdiConfigSTARspCb;
-  wpt_uint8                    ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*          pBSSSes             = NULL;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
-  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
 
-  tConfigStaReqMsg             halConfigStaReqMsg;
-  wpt_uint16                   uMsgSize            = 0;
+  tConfigStaReqMsg             halConfigStaReqMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiConfigSTAParams = (WDI_ConfigSTAReqParamsType*)pEventData->pEventData;
   wdiConfigSTARspCb   = (WDI_ConfigSTARspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                           pwdiConfigSTAParams->wdiReqInfo.macBSSID,
-                          &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                           pwdiConfigSTAParams->wdiReqInfo.macBSSID, 
+                          &pBSSSes); 
 
-  if ( NULL == pBSSSes )
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-          "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-          __func__, MAC_ADDR_ARRAY(pwdiConfigSTAParams->wdiReqInfo.macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(pwdiConfigSTAParams->wdiReqInfo.macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
   wpalMutexRelease(&pWDICtx->wptMutex);
-
-  /* Allocation of StaReqMsg Memory Based on Firmware Capabilities */
-#ifdef WLAN_FEATURE_11AC
-  if (WDI_getFwWlanFeatCaps(DOT11AC))
-	  uMsgSize = sizeof(halConfigStaReqMsg.uStaParams.configStaParams_V1); // Version-1 For 11AC
-  else
-#endif
-	  uMsgSize = sizeof(halConfigStaReqMsg.uStaParams.configStaParams); // Version-0 Default
-
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIG_STA_REQ,
-                        uMsgSize,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIG_STA_REQ, 
+                        sizeof(halConfigStaReqMsg.configStaParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
-      ( usSendSize < (usDataOffset + uMsgSize )))
+      ( usSendSize < (usDataOffset + sizeof(halConfigStaReqMsg.configStaParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in config sta req %x %x %x",
                 pEventData, pwdiConfigSTAParams, wdiConfigSTARspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*Copy the station context*/
-  WDI_CopyWDIStaCtxToHALStaCtx( &halConfigStaReqMsg.uStaParams.configStaParams,
+  WDI_CopyWDIStaCtxToHALStaCtx( &halConfigStaReqMsg.configStaParams,
                                 &pwdiConfigSTAParams->wdiReqInfo);
 
   if(pwdiConfigSTAParams->wdiReqInfo.wdiSTAType == WDI_STA_ENTRY_SELF)
   {
     /* Need to fill in the self STA Index */
-    if ( WDI_STATUS_SUCCESS !=
+    if ( WDI_STATUS_SUCCESS != 
          WDI_STATableFindStaidByAddr(pWDICtx,
                                      pwdiConfigSTAParams->wdiReqInfo.macSTA,
-                                     (wpt_uint8*)&halConfigStaReqMsg.uStaParams.configStaParams.staIdx ))
+                                     (wpt_uint8*)&halConfigStaReqMsg.configStaParams.staIdx ))
     {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "This station does not exist in the WDI Station Table %d");
+#endif
       wpalMutexRelease(&pWDICtx->wptMutex);
-      return WDI_STATUS_E_FAILURE;
+      return WDI_STATUS_E_FAILURE; 
     }
   }
   else
   {
   /* Need to fill in the STA Index to invalid, since at this point we have not
      yet received it from HAL */
-    halConfigStaReqMsg.uStaParams.configStaParams.staIdx = WDI_STA_INVALID_IDX;
+    halConfigStaReqMsg.configStaParams.staIdx = WDI_STA_INVALID_IDX;
   }
 
   /* Need to fill in the BSS index */
-  halConfigStaReqMsg.uStaParams.configStaParams.bssIdx = pBSSSes->ucBSSIdx;
-  
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halConfigStaReqMsg.uStaParams,
-                  uMsgSize);
+  halConfigStaReqMsg.configStaParams.bssIdx = pBSSSes->ucBSSIdx;
+
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halConfigStaReqMsg.configStaParams, 
+                  sizeof(halConfigStaReqMsg.configStaParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiConfigSTAParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiConfigSTAParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiConfigSTAParams->pUserData; 
 
-  wpalMemoryCopy( &pWDICtx->wdiCachedConfigStaReq,
-                  pwdiConfigSTAParams,
+  wpalMemoryCopy( &pWDICtx->wdiCachedConfigStaReq, 
+                  pwdiConfigSTAParams, 
                   sizeof(pWDICtx->wdiCachedConfigStaReq));
 
   /*-------------------------------------------------------------------------
-    Send Config STA Request to HAL
+    Send Config STA Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiConfigSTARspCb, pEventData->pUserData, WDI_CONFIG_STA_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiConfigSTARspCb, pEventData->pUserData, WDI_CONFIG_STA_RESP); 
 }/*WDI_ProcessConfigStaReq*/
 
 
 /**
- @brief Process Set Link State Request function (called when
+ @brief Process Set Link State Request function (called when 
         Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetLinkStateReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_SetLinkReqParamsType*    pwdiSetLinkParams;
   WDI_SetLinkStateRspCb        wdiSetLinkRspCb;
-  wpt_uint8                    ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*          pBSSSes             = NULL;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
   WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
-  tLinkStateParams             halLinkStateReqMsg;
+  tLinkStateParams             halLinkStateReqMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiSetLinkParams = (WDI_SetLinkReqParamsType*)pEventData->pEventData;
   wdiSetLinkRspCb   = (WDI_SetLinkStateRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                           pwdiSetLinkParams->wdiLinkInfo.macBSSID,
-                          &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                           pwdiSetLinkParams->wdiLinkInfo.macBSSID, 
+                          &pBSSSes); 
 
-  if ( NULL == pBSSSes )
+  if ( NULL == pBSSSes ) 
   {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO, 
-     "%s: Set link request received outside association session. macBSSID " MAC_ADDRESS_STR, 
-     __func__, MAC_ADDR_ARRAY(pwdiSetLinkParams->wdiLinkInfo.macBSSID));
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
+              "Set link request received outside association session");
+#endif
   }
   else
   {
     /*------------------------------------------------------------------------
       Check if this BSS is being currently processed or queued,
-      if queued - queue the new request as well
+      if queued - queue the new request as well 
     ------------------------------------------------------------------------*/
     if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
     {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-                "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-                __func__, MAC_ADDR_ARRAY(pwdiSetLinkParams->wdiLinkInfo.macBSSID));
-
-      wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "Association sequence for this BSS exists but currently queued");
+#endif
+      wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
       wpalMutexRelease(&pWDICtx->wptMutex);
-      return wdiStatus;
+      return wdiStatus; 
     }
   }
   /* If the link is set to enter IDLE - the Session allocated for this BSS
      will be deleted on the Set Link State response coming from HAL
    - cache the request for response processing */
-  wpalMemoryCopy(&pWDICtx->wdiCacheSetLinkStReq, pwdiSetLinkParams,
+  wpalMemoryCopy(&pWDICtx->wdiCacheSetLinkStReq, pwdiSetLinkParams, 
                  sizeof(pWDICtx->wdiCacheSetLinkStReq));
 
   wpalMutexRelease(&pWDICtx->wptMutex);
   /*-----------------------------------------------------------------------
     Get message buffer
-    ! TO DO : proper conversion into the HAL Message Request Format
+    ! TO DO : proper conversion into the HAL Message Request Format 
   -----------------------------------------------------------------------*/
-
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_LINK_ST_REQ,
+  
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_LINK_ST_REQ, 
                         sizeof(halLinkStateReqMsg),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halLinkStateReqMsg) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiSetLinkParams, wdiSetLinkRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wpalMemoryCopy(halLinkStateReqMsg.bssid,
@@ -10562,63 +10851,65 @@
   wpalMemoryCopy(halLinkStateReqMsg.selfMacAddr,
                  pwdiSetLinkParams->wdiLinkInfo.macSelfStaMacAddr, WDI_MAC_ADDR_LEN);
 
-  halLinkStateReqMsg.state =
+  halLinkStateReqMsg.state = 
      WDI_2_HAL_LINK_STATE(pwdiSetLinkParams->wdiLinkInfo.wdiLinkState);
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halLinkStateReqMsg,
-                  sizeof(halLinkStateReqMsg));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halLinkStateReqMsg, 
+                  sizeof(halLinkStateReqMsg)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiSetLinkParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiSetLinkParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiSetLinkParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Set Link State Request to HAL
+    Send Set Link State Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiSetLinkRspCb, pEventData->pUserData, WDI_SET_LINK_ST_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetLinkRspCb, pEventData->pUserData, WDI_SET_LINK_ST_RESP); 
 }/*WDI_ProcessSetLinkStateReq*/
 
 
 /**
  @brief Process Get Stats Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessGetStatsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_GetStatsReqParamsType*   pwdiGetStatsParams;
   WDI_GetStatsRspCb            wdiGetStatsRspCb;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
-  wpt_uint8                    ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*          pBSSSes             = NULL;
   wpt_macAddr                  macBSSID;
-  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
   tHalStatsReqMsg              halStatsReqMsg;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData) ||
       ( NULL == pEventData->pCBfnc ) )
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiGetStatsParams = (WDI_GetStatsReqParamsType*)pEventData->pEventData;
@@ -10626,47 +10917,49 @@
 
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                        pwdiGetStatsParams->wdiGetStatsParamsInfo.ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                        pwdiGetStatsParams->wdiGetStatsParamsInfo.ucSTAIdx, 
                         &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
-  if ( NULL == pBSSSes )
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-        "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-        __func__, MAC_ADDR_ARRAY(macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
@@ -10675,49 +10968,51 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_GET_STATS_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_GET_STATS_REQ, 
                         sizeof(halStatsReqMsg.statsReqParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halStatsReqMsg.statsReqParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiGetStatsParams, wdiGetStatsRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  halStatsReqMsg.statsReqParams.staId =
+  halStatsReqMsg.statsReqParams.staId = 
                   pwdiGetStatsParams->wdiGetStatsParamsInfo.ucSTAIdx;
-  halStatsReqMsg.statsReqParams.statsMask =
+  halStatsReqMsg.statsReqParams.statsMask = 
                   pwdiGetStatsParams->wdiGetStatsParamsInfo.uStatsMask;
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halStatsReqMsg.statsReqParams,
-                  sizeof(halStatsReqMsg.statsReqParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halStatsReqMsg.statsReqParams, 
+                  sizeof(halStatsReqMsg.statsReqParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiGetStatsParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiGetStatsParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiGetStatsParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Get STA Request to HAL
+    Send Get STA Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiGetStatsRspCb, pEventData->pUserData, WDI_GET_STATS_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiGetStatsRspCb, pEventData->pUserData, WDI_GET_STATS_RESP); 
 }/*WDI_ProcessGetStatsReq*/
 
 /**
- @brief Process Update Cfg Request function (called when Main
+ @brief Process Update Cfg Request function (called when Main 
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateCfgReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -10725,21 +11020,23 @@
   WDI_UpdateCfgReqParamsType*  pwdiUpdateCfgParams = NULL;
   WDI_UpdateCfgRspCb           wdiUpdateCfgRspCb = NULL;
 
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset         = 0;
   wpt_uint16                   usSendSize          = 0;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiUpdateCfgParams = (WDI_UpdateCfgReqParamsType*)pEventData->pEventData;
@@ -10747,82 +11044,86 @@
 
   /*-----------------------------------------------------------------------
     Get message buffer
-    ! TO DO : proper conversion into the HAL Message Request Format
+    ! TO DO : proper conversion into the HAL Message Request Format 
   -----------------------------------------------------------------------*/
 
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPDATE_CFG_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPDATE_CFG_REQ, 
                         pwdiUpdateCfgParams->uConfigBufferLen + sizeof(wpt_uint32),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset +  pwdiUpdateCfgParams->uConfigBufferLen)))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiUpdateCfgParams, wdiUpdateCfgRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &pwdiUpdateCfgParams->uConfigBufferLen,
-                  sizeof(wpt_uint32));
-  wpalMemoryCopy( pSendBuffer+usDataOffset+sizeof(wpt_uint32),
-                  pwdiUpdateCfgParams->pConfigBuffer,
-                  pwdiUpdateCfgParams->uConfigBufferLen);
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &pwdiUpdateCfgParams->uConfigBufferLen, 
+                  sizeof(wpt_uint32)); 
+  wpalMemoryCopy( pSendBuffer+usDataOffset+sizeof(wpt_uint32), 
+                  pwdiUpdateCfgParams->pConfigBuffer, 
+                  pwdiUpdateCfgParams->uConfigBufferLen); 
 
   pWDICtx->wdiReqStatusCB     = pwdiUpdateCfgParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiUpdateCfgParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiUpdateCfgParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Update Cfg Request to HAL
+    Send Update Cfg Request to HAL 
   -------------------------------------------------------------------------*/
 
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiUpdateCfgRspCb, pEventData->pUserData, WDI_UPDATE_CFG_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiUpdateCfgRspCb, pEventData->pUserData, WDI_UPDATE_CFG_RESP); 
 
 }/*WDI_ProcessUpdateCfgReq*/
 
 
 /**
- @brief Process Add BA Request function (called when Main FSM
+ @brief Process Add BA Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessAddBAReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_AddBAReqParamsType*  pwdiAddBAParams;
   WDI_AddBARspCb           wdiAddBARspCb;
-  wpt_uint8                ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*      pBSSSes             = NULL;
-  wpt_uint8*               pSendBuffer         = NULL;
+  wpt_uint8*               pSendBuffer         = NULL; 
   wpt_uint16               usDataOffset        = 0;
   wpt_uint16               usSendSize          = 0;
-  WDI_Status               wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status               wdiStatus           = WDI_STATUS_SUCCESS; 
   wpt_macAddr              macBSSID;
 
   tAddBAReqMsg             halAddBAReq;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiAddBAParams = (WDI_AddBAReqParamsType*)pEventData->pEventData;
@@ -10830,47 +11131,49 @@
 
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                                  pwdiAddBAParams->wdiBAInfoType.ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                  pwdiAddBAParams->wdiBAInfoType.ucSTAIdx, 
                                   &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
-  if ( NULL == pBSSSes )
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
   {
-      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-            "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-            __func__, MAC_ADDR_ARRAY(macBSSID));
-
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
@@ -10878,135 +11181,141 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ADD_BA_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ADD_BA_REQ, 
                         sizeof(halAddBAReq.addBAParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
-      ( usSendSize <
+      ( usSendSize < 
             (usDataOffset + sizeof(halAddBAReq.addBAParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in Add BA req %x %x %x",
                 pEventData, pwdiAddBAParams, wdiAddBARspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  halAddBAReq.addBAParams.baSessionID =
+  halAddBAReq.addBAParams.baSessionID = 
                              pwdiAddBAParams->wdiBAInfoType.ucBaSessionID;
   halAddBAReq.addBAParams.winSize = pwdiAddBAParams->wdiBAInfoType.ucWinSize;
 #ifdef FEATURE_ON_CHIP_REORDERING
-  halAddBAReq.addBAParams.isReorderingDoneOnChip =
+  halAddBAReq.addBAParams.isReorderingDoneOnChip = 
                        pwdiAddBAParams->wdiBAInfoType.bIsReorderingDoneOnChip;
 #endif
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halAddBAReq.addBAParams,
-                  sizeof(halAddBAReq.addBAParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halAddBAReq.addBAParams, 
+                  sizeof(halAddBAReq.addBAParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiAddBAParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiAddBAParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiAddBAParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Start Request to HAL
+    Send Start Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiAddBARspCb, pEventData->pUserData,
-                        WDI_ADD_BA_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiAddBARspCb, pEventData->pUserData, 
+                        WDI_ADD_BA_RESP); 
 }/*WDI_ProcessAddBAReq*/
 
 
 
 /**
- @brief Process Trigger BA Request function (called when Main FSM
+ @brief Process Trigger BA Request function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessTriggerBAReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_TriggerBAReqParamsType*  pwdiTriggerBAParams;
   WDI_TriggerBARspCb           wdiTriggerBARspCb;
-  wpt_uint8                    ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                    ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*          pBSSSes             = NULL;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
-  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status                   wdiStatus           = WDI_STATUS_SUCCESS; 
   wpt_uint16                   index;
   wpt_macAddr                  macBSSID;
-
+  
   tTriggerBAReqMsg               halTriggerBAReq;
   tTriggerBaReqCandidate*        halTriggerBACandidate;
   WDI_TriggerBAReqCandidateType* wdiTriggerBACandidate;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiTriggerBAParams = (WDI_TriggerBAReqParamsType*)pEventData->pEventData;
   wdiTriggerBARspCb = (WDI_TriggerBARspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                                  pwdiTriggerBAParams->wdiTriggerBAInfoType.ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                  pwdiTriggerBAParams->wdiTriggerBAInfoType.ucSTAIdx, 
                                   &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
-  if ( NULL == pBSSSes )
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-        "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-        __func__, MAC_ADDR_ARRAY(macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
 
@@ -11014,39 +11323,41 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                  WDI_TRIGGER_BA_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                  WDI_TRIGGER_BA_REQ, 
                   sizeof(halTriggerBAReq.triggerBAParams) +
-                  (sizeof(tTriggerBaReqCandidate) *
+                  (sizeof(tTriggerBaReqCandidate) * 
                   pwdiTriggerBAParams->wdiTriggerBAInfoType.usBACandidateCnt),
                   &pSendBuffer, &usDataOffset, &usSendSize))||
-      ( usSendSize <
+      ( usSendSize < 
             (usDataOffset + sizeof(halTriggerBAReq.triggerBAParams)+
-               (sizeof(tTriggerBaReqCandidate) *
+               (sizeof(tTriggerBaReqCandidate) * 
                pwdiTriggerBAParams->wdiTriggerBAInfoType.usBACandidateCnt) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in Trigger BA req %x %x %x",
                 pEventData, pwdiTriggerBAParams, wdiTriggerBARspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  halTriggerBAReq.triggerBAParams.baSessionID =
+  halTriggerBAReq.triggerBAParams.baSessionID = 
                   pwdiTriggerBAParams->wdiTriggerBAInfoType.ucBASessionID;
-  halTriggerBAReq.triggerBAParams.baCandidateCnt =
+  halTriggerBAReq.triggerBAParams.baCandidateCnt = 
                   pwdiTriggerBAParams->wdiTriggerBAInfoType.usBACandidateCnt;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halTriggerBAReq.triggerBAParams,
-                  sizeof(halTriggerBAReq.triggerBAParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halTriggerBAReq.triggerBAParams, 
+                  sizeof(halTriggerBAReq.triggerBAParams)); 
 
-  wdiTriggerBACandidate =
+  wdiTriggerBACandidate = 
     (WDI_TriggerBAReqCandidateType*)(pwdiTriggerBAParams + 1);
   halTriggerBACandidate = (tTriggerBaReqCandidate*)(pSendBuffer+usDataOffset+
                                  sizeof(halTriggerBAReq.triggerBAParams));
-
-  for(index = 0 ; index < halTriggerBAReq.triggerBAParams.baCandidateCnt ;
+  
+  for(index = 0 ; index < halTriggerBAReq.triggerBAParams.baCandidateCnt ; 
                                                                      index++)
   {
     halTriggerBACandidate->staIdx = wdiTriggerBACandidate->ucSTAIdx;
@@ -11056,14 +11367,14 @@
   }
 
   pWDICtx->wdiReqStatusCB     = pwdiTriggerBAParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiTriggerBAParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiTriggerBAParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Start Request to HAL
+    Send Start Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiTriggerBARspCb, pEventData->pUserData,
-                        WDI_TRIGGER_BA_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiTriggerBARspCb, pEventData->pUserData, 
+                        WDI_TRIGGER_BA_RESP); 
 }/*WDI_ProcessTriggerBAReq*/
 
 
@@ -11071,39 +11382,41 @@
 /**
  @brief Process Update Beacon Params  Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateBeaconParamsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_UpdateBeaconParamsType*  pwdiUpdateBeaconParams;
   WDI_UpdateBeaconParamsRspCb  wdiUpdateBeaconParamsRspCb;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
-  tUpdateBeaconParams          halUpdateBeaconParams;
+  tUpdateBeaconParams          halUpdateBeaconParams; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData) ||
       ( NULL == pEventData->pCBfnc))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiUpdateBeaconParams = (WDI_UpdateBeaconParamsType*)pEventData->pEventData;
@@ -11111,16 +11424,18 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPD_BCON_PRMS_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPD_BCON_PRMS_REQ, 
                         sizeof(halUpdateBeaconParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halUpdateBeaconParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiUpdateBeaconParams, wdiUpdateBeaconParamsRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*BSS Index of the BSS*/
@@ -11128,44 +11443,44 @@
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucBssIdx;
   /*shortPreamble mode. HAL should update all the STA rates when it
     receives this message*/
-  halUpdateBeaconParams.fShortPreamble =
+  halUpdateBeaconParams.fShortPreamble = 
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfShortPreamble;
   /* short Slot time.*/
-  halUpdateBeaconParams.fShortSlotTime =
+  halUpdateBeaconParams.fShortSlotTime = 
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfShortSlotTime;
   /* Beacon Interval */
-  halUpdateBeaconParams.beaconInterval =
+  halUpdateBeaconParams.beaconInterval = 
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.usBeaconInterval;
 
   /*Protection related */
-  halUpdateBeaconParams.llaCoexist =
+  halUpdateBeaconParams.llaCoexist = 
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllaCoexist;
-  halUpdateBeaconParams.llbCoexist =
+  halUpdateBeaconParams.llbCoexist = 
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllbCoexist;
-  halUpdateBeaconParams.llgCoexist =
+  halUpdateBeaconParams.llgCoexist = 
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllgCoexist;
-  halUpdateBeaconParams.ht20MhzCoexist  =
+  halUpdateBeaconParams.ht20MhzCoexist  = 
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucHt20MhzCoexist;
-  halUpdateBeaconParams.llnNonGFCoexist =
+  halUpdateBeaconParams.llnNonGFCoexist = 
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucllnNonGFCoexist;
-  halUpdateBeaconParams.fLsigTXOPProtectionFullSupport =
+  halUpdateBeaconParams.fLsigTXOPProtectionFullSupport = 
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfLsigTXOPProtectionFullSupport;
   halUpdateBeaconParams.fRIFSMode =
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.ucfRIFSMode;
-  halUpdateBeaconParams.paramChangeBitmap =
+  halUpdateBeaconParams.paramChangeBitmap = 
     pwdiUpdateBeaconParams->wdiUpdateBeaconParamsInfo.usChangeBitmap;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset, &halUpdateBeaconParams,
-                  sizeof(halUpdateBeaconParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, &halUpdateBeaconParams, 
+                  sizeof(halUpdateBeaconParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiUpdateBeaconParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiUpdateBeaconParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiUpdateBeaconParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Del TS Request to HAL
+    Send Del TS Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiUpdateBeaconParamsRspCb, pEventData->pUserData, WDI_UPD_BCON_PRMS_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiUpdateBeaconParamsRspCb, pEventData->pUserData, WDI_UPD_BCON_PRMS_RESP); 
 }/*WDI_ProcessUpdateBeaconParamsReq*/
 
 
@@ -11173,39 +11488,41 @@
 /**
  @brief Process Send Beacon template  Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSendBeaconParamsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_SendBeaconParamsType*    pwdiSendBeaconParams;
   WDI_SendBeaconParamsRspCb    wdiSendBeaconParamsRspCb;
-  wpt_uint8*                   pSendBuffer         = NULL;
+  wpt_uint8*                   pSendBuffer         = NULL; 
   wpt_uint16                   usDataOffset        = 0;
   wpt_uint16                   usSendSize          = 0;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   tSendBeaconReqMsg            halSendBeaconReq;
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiSendBeaconParams = (WDI_SendBeaconParamsType*)pEventData->pEventData;
@@ -11213,150 +11530,156 @@
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SND_BCON_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SND_BCON_REQ, 
                         sizeof(halSendBeaconReq.sendBeaconParam),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halSendBeaconReq.sendBeaconParam) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in send beacon req %x %x %x",
                 pEventData, pwdiSendBeaconParams, wdiSendBeaconParamsRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wpalMemoryCopy(halSendBeaconReq.sendBeaconParam.bssId,
                   pwdiSendBeaconParams->wdiSendBeaconParamsInfo.macBSSID,
                   WDI_MAC_ADDR_LEN);
-  halSendBeaconReq.sendBeaconParam.beaconLength =
+  halSendBeaconReq.sendBeaconParam.beaconLength = 
                   pwdiSendBeaconParams->wdiSendBeaconParamsInfo.beaconLength;
   wpalMemoryCopy(halSendBeaconReq.sendBeaconParam.beacon,
                   pwdiSendBeaconParams->wdiSendBeaconParamsInfo.beacon,
                   pwdiSendBeaconParams->wdiSendBeaconParamsInfo.beaconLength);
 #ifdef WLAN_SOFTAP_FEATURE
-  halSendBeaconReq.sendBeaconParam.timIeOffset =
+  halSendBeaconReq.sendBeaconParam.timIeOffset = 
                   pwdiSendBeaconParams->wdiSendBeaconParamsInfo.timIeOffset;
 #endif
 #ifdef WLAN_FEATURE_P2P
-  halSendBeaconReq.sendBeaconParam.p2pIeOffset =
+  halSendBeaconReq.sendBeaconParam.p2pIeOffset = 
                   pwdiSendBeaconParams->wdiSendBeaconParamsInfo.usP2PIeOffset;
 #endif
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halSendBeaconReq.sendBeaconParam,
-                  sizeof(halSendBeaconReq.sendBeaconParam));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halSendBeaconReq.sendBeaconParam, 
+                  sizeof(halSendBeaconReq.sendBeaconParam)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiSendBeaconParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiSendBeaconParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiSendBeaconParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Del TS Request to HAL
+    Send Del TS Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiSendBeaconParamsRspCb, pEventData->pUserData, WDI_SND_BCON_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSendBeaconParamsRspCb, pEventData->pUserData, WDI_SND_BCON_RESP); 
 }/*WDI_ProcessSendBeaconParamsReq*/
 
 /**
  @brief Process Update Beacon Params  Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateProbeRspTemplateReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_UpdateProbeRspTemplateParamsType*  pwdiUpdateProbeRespTmplParams;
   WDI_UpdateProbeRspTemplateRspCb        wdiUpdateProbeRespTmplRspCb;
-  wpt_uint8*                             pSendBuffer         = NULL;
+  wpt_uint8*                             pSendBuffer         = NULL; 
   wpt_uint16                             usDataOffset        = 0;
   wpt_uint16                             usSendSize          = 0;
-  tSendProbeRespReqParams                halUpdateProbeRspTmplParams;
+  tSendProbeRespReqParams                halUpdateProbeRspTmplParams; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData) ||
       ( NULL == pEventData->pCBfnc))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  pwdiUpdateProbeRespTmplParams =
+  pwdiUpdateProbeRespTmplParams = 
     (WDI_UpdateProbeRspTemplateParamsType*)pEventData->pEventData;
-  wdiUpdateProbeRespTmplRspCb =
+  wdiUpdateProbeRespTmplRspCb = 
     (WDI_UpdateProbeRspTemplateRspCb)pEventData->pCBfnc;
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPD_PROBE_RSP_TEMPLATE_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPD_PROBE_RSP_TEMPLATE_REQ, 
                         sizeof(halUpdateProbeRspTmplParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halUpdateProbeRspTmplParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
      pEventData, pwdiUpdateProbeRespTmplParams, wdiUpdateProbeRespTmplRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wpalMemoryCopy(halUpdateProbeRspTmplParams.bssId,
-                 pwdiUpdateProbeRespTmplParams->wdiProbeRspTemplateInfo.macBSSID,
+                 pwdiUpdateProbeRespTmplParams->wdiProbeRspTemplateInfo.macBSSID, 
                  WDI_MAC_ADDR_LEN);
 
-  halUpdateProbeRspTmplParams.probeRespTemplateLen =
+  halUpdateProbeRspTmplParams.probeRespTemplateLen = 
     pwdiUpdateProbeRespTmplParams->wdiProbeRspTemplateInfo.uProbeRespTemplateLen;
 
   wpalMemoryCopy(halUpdateProbeRspTmplParams.pProbeRespTemplate,
     pwdiUpdateProbeRespTmplParams->wdiProbeRspTemplateInfo.pProbeRespTemplate,
-                 BEACON_TEMPLATE_SIZE);
+                 BEACON_TEMPLATE_SIZE);     
 
 
   wpalMemoryCopy(halUpdateProbeRspTmplParams.ucProxyProbeReqValidIEBmap,
            pwdiUpdateProbeRespTmplParams->wdiProbeRspTemplateInfo.uaProxyProbeReqValidIEBmap,
                  WDI_PROBE_REQ_BITMAP_IE_LEN);
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halUpdateProbeRspTmplParams,
-                  sizeof(halUpdateProbeRspTmplParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halUpdateProbeRspTmplParams, 
+                  sizeof(halUpdateProbeRspTmplParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiUpdateProbeRespTmplParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiUpdateProbeRespTmplParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiUpdateProbeRespTmplParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Update Probe Resp Template Request to HAL
+    Send Update Probe Resp Template Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiUpdateProbeRespTmplRspCb, pEventData->pUserData,
-                       WDI_UPD_PROBE_RSP_TEMPLATE_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiUpdateProbeRespTmplRspCb, pEventData->pUserData, 
+                       WDI_UPD_PROBE_RSP_TEMPLATE_RESP); 
 }/*WDI_ProcessUpdateProbeRspTemplateReq*/
 
 /**
- @brief Process NV blob download function (called when Main FSM
+ @brief Process NV blob download function (called when Main FSM 
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessNvDownloadReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -11366,31 +11689,33 @@
   WDI_NvDownloadRspCb      wdiNvDownloadRspCb = NULL;
 
   /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check       
    -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
-      ( NULL == (pwdiNvDownloadReqParams =
+      ( NULL == (pwdiNvDownloadReqParams = 
                  (WDI_NvDownloadReqParamsType*)pEventData->pEventData)) ||
-      ( NULL == (wdiNvDownloadRspCb =
+      ( NULL == (wdiNvDownloadRspCb = 
                 (WDI_NvDownloadRspCb)pEventData->pCBfnc)))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
     WDI_ASSERT(0);
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   /*Intialize the Nv Blob Info */
-  pWDICtx->wdiNvBlobInfo.usTotalFragment =
+  pWDICtx->wdiNvBlobInfo.usTotalFragment = 
                 TOTALFRAGMENTS(pwdiNvDownloadReqParams->wdiBlobInfo.uBlobSize);
 
   /*cache the wdi nv request message here if the the first fragment
    * To issue the request to HAL for the next fragment */
   if( 0 == pWDICtx->wdiNvBlobInfo.usCurrentFragment)
   {
-    wpalMemoryCopy(&pWDICtx->wdiCachedNvDownloadReq,
-                 pwdiNvDownloadReqParams,
-                 sizeof(pWDICtx->wdiCachedNvDownloadReq));
+    wpalMemoryCopy(&pWDICtx->wdiCachedNvDownloadReq, 
+                 pwdiNvDownloadReqParams, 
+                 sizeof(pWDICtx->wdiCachedNvDownloadReq)); 
 
     pWDICtx->pfncRspCB = pEventData->pCBfnc;
     pWDICtx->pRspCBUserData = pEventData->pUserData;
@@ -11400,12 +11725,12 @@
 }
 
 /**
- @brief Process Set Max Tx Power Request function (called when Main
+ @brief Process Set Max Tx Power Request function (called when Main    
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
@@ -11417,43 +11742,47 @@
 {
   WDI_SetMaxTxPowerParamsType*      pwdiSetMaxTxPowerParams = NULL;
   WDA_SetMaxTxPowerRspCb            wdiSetMaxTxPowerRspCb;
-  wpt_uint8*                        pSendBuffer         = NULL;
+  wpt_uint8*                        pSendBuffer         = NULL; 
   wpt_uint16                        usDataOffset        = 0;
   wpt_uint16                        usSendSize          = 0;
   tSetMaxTxPwrReq                   halSetMaxTxPower;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
-  pwdiSetMaxTxPowerParams =
+  pwdiSetMaxTxPowerParams = 
     (WDI_SetMaxTxPowerParamsType*)pEventData->pEventData;
-  wdiSetMaxTxPowerRspCb =
+  wdiSetMaxTxPowerRspCb = 
     (WDA_SetMaxTxPowerRspCb)pEventData->pCBfnc;
 
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_MAX_TX_POWER_REQ,
+if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_MAX_TX_POWER_REQ, 
                         sizeof(halSetMaxTxPower.setMaxTxPwrParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
-      ( usSendSize < (usDataOffset + sizeof(halSetMaxTxPower.setMaxTxPwrParams)
+      ( usSendSize < (usDataOffset + sizeof(halSetMaxTxPower.setMaxTxPwrParams) 
 )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Unable to get Set Max Tx Power req %x %x %x",
                 pEventData, pwdiSetMaxTxPowerParams, wdiSetMaxTxPowerRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wpalMemoryCopy(halSetMaxTxPower.setMaxTxPwrParams.bssId,
@@ -11463,23 +11792,23 @@
   wpalMemoryCopy(halSetMaxTxPower.setMaxTxPwrParams.selfStaMacAddr,
                   pwdiSetMaxTxPowerParams->wdiMaxTxPowerInfo.macSelfStaMacAddr,
                   WDI_MAC_ADDR_LEN);
-  halSetMaxTxPower.setMaxTxPwrParams.power =
+  halSetMaxTxPower.setMaxTxPwrParams.power = 
                   pwdiSetMaxTxPowerParams->wdiMaxTxPowerInfo.ucPower;
-
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halSetMaxTxPower.setMaxTxPwrParams,
-                  sizeof(halSetMaxTxPower.setMaxTxPwrParams));
+  
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halSetMaxTxPower.setMaxTxPwrParams, 
+                  sizeof(halSetMaxTxPower.setMaxTxPwrParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiSetMaxTxPowerParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiSetMaxTxPowerParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiSetMaxTxPowerParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Del TS Request to HAL
+    Send Del TS Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiSetMaxTxPowerRspCb, pEventData->pUserData,
-                                                      WDI_SET_MAX_TX_POWER_RESP);
-
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetMaxTxPowerRspCb, pEventData->pUserData, 
+                                                      WDI_SET_MAX_TX_POWER_RESP); 
+  
 }
 
 #ifdef WLAN_FEATURE_P2P
@@ -11487,100 +11816,104 @@
 /**
  @brief Process P2P Notice Of Absence Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessP2PGONOAReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_SetP2PGONOAReqParamsType*          pwdiP2PGONOAReqParams;
   WDI_SetP2PGONOAReqParamsRspCb          wdiP2PGONOAReqRspCb;
-  wpt_uint8*                             pSendBuffer         = NULL;
+  wpt_uint8*                             pSendBuffer         = NULL; 
   wpt_uint16                             usDataOffset        = 0;
   wpt_uint16                             usSendSize          = 0;
-  tSetP2PGONOAParams                     halSetP2PGONOAParams;
+  tSetP2PGONOAParams                     halSetP2PGONOAParams; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData) ||
       ( NULL == pEventData->pCBfnc))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  pwdiP2PGONOAReqParams =
+  pwdiP2PGONOAReqParams = 
     (WDI_SetP2PGONOAReqParamsType*)pEventData->pEventData;
-  wdiP2PGONOAReqRspCb =
+  wdiP2PGONOAReqRspCb = 
     (WDI_SetP2PGONOAReqParamsRspCb)pEventData->pCBfnc;
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                        WDI_P2P_GO_NOTICE_OF_ABSENCE_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                        WDI_P2P_GO_NOTICE_OF_ABSENCE_REQ, 
                         sizeof(halSetP2PGONOAParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halSetP2PGONOAParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set P2P GO NOA REQ %x %x %x",
      pEventData, pwdiP2PGONOAReqParams, wdiP2PGONOAReqRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  halSetP2PGONOAParams.opp_ps =
+  halSetP2PGONOAParams.opp_ps = 
                            pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.ucOpp_ps;
-  halSetP2PGONOAParams.ctWindow =
+  halSetP2PGONOAParams.ctWindow = 
                            pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.uCtWindow;
   halSetP2PGONOAParams.count = pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.ucCount;
-  halSetP2PGONOAParams.duration =
+  halSetP2PGONOAParams.duration = 
                            pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.uDuration;
-  halSetP2PGONOAParams.interval =
+  halSetP2PGONOAParams.interval = 
                            pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.uInterval;
-  halSetP2PGONOAParams.single_noa_duration =
+  halSetP2PGONOAParams.single_noa_duration = 
                  pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.uSingle_noa_duration;
-  halSetP2PGONOAParams.psSelection =
+  halSetP2PGONOAParams.psSelection = 
                    pwdiP2PGONOAReqParams->wdiP2PGONOAInfo.ucPsSelection;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halSetP2PGONOAParams,
-                  sizeof(halSetP2PGONOAParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halSetP2PGONOAParams, 
+                  sizeof(halSetP2PGONOAParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiP2PGONOAReqParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiP2PGONOAReqParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiP2PGONOAReqParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Update Probe Resp Template Request to HAL
+    Send Update Probe Resp Template Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiP2PGONOAReqRspCb, pEventData->pUserData,
-                       WDI_P2P_GO_NOTICE_OF_ABSENCE_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiP2PGONOAReqRspCb, pEventData->pUserData, 
+                       WDI_P2P_GO_NOTICE_OF_ABSENCE_RESP); 
 }/*WDI_ProcessP2PGONOAReq*/
 
 #endif
 
 
 /**
- @brief    Function to handle the ack from DXE once the power
+ @brief    Function to handle the ack from DXE once the power 
            state is set.
- @param    None
-
- @see
- @return void
+ @param    None 
+    
+ @see 
+ @return void 
 */
 void
 WDI_SetPowerStateCb
@@ -11597,92 +11930,100 @@
    {
       //it shouldn't happen, put an error msg
    }
-   /*
-    * Trigger the event to bring the Enter BMPS req function to come
-    * out of wait
+   /* 
+    * Trigger the event to bring the Enter BMPS req function to come 
+    * out of wait 
 */
    if( NULL != pContext )
    {
-      pCB = (WDI_ControlBlockType *)pContext;
+      pCB = (WDI_ControlBlockType *)pContext; 
    }
    else
    {
-      //put an error msg
+      //put an error msg 
       pCB = &gWDICb;
    }
    pCB->dxePhyAddr = dxePhyAddr;
    wptStatus  = wpalEventSet(&pCB->setPowerStateEvent);
+#ifdef WLAN_DEBUG
    if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
    {
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "Failed to set an event");
 
-      WDI_ASSERT(0);
+      WDI_ASSERT(0); 
    }
+#endif
    return;
 }
 
 
 /**
- @brief Process Enter IMPS Request function (called when
+ @brief Process Enter IMPS Request function (called when 
         Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessEnterImpsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
-   wpt_status               wptStatus;
+   wpt_status               wptStatus; 
    WDI_EnterImpsRspCb       wdiEnterImpsRspCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (wdiEnterImpsRspCb   = (WDI_EnterImpsRspCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ENTER_IMPS_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ENTER_IMPS_REQ, 
                                                      0,
                                                      &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Enter IMPS req %x %x",
                  pEventData, wdiEnterImpsRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /* Reset the event to be not signalled */
    wptStatus = wpalEventReset(&pWDICtx->setPowerStateEvent);
-   if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
+   if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus ) 
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "WDI Init failed to reset an event");
 
-      WDI_ASSERT(0);
+      WDI_ASSERT(0); 
+#endif
       return VOS_STATUS_E_FAILURE;
    }
 
@@ -11690,148 +12031,160 @@
    WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_IMPS, WDI_SetPowerStateCb);
 
    /*
-    * Wait for the event to be set once the ACK comes back from DXE
+    * Wait for the event to be set once the ACK comes back from DXE 
     */
-   wptStatus = wpalEventWait(&pWDICtx->setPowerStateEvent,
+   wptStatus = wpalEventWait(&pWDICtx->setPowerStateEvent, 
                              WDI_SET_POWER_STATE_TIMEOUT);
-   if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
+   if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus ) 
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "WDI Init failed to wait on an event");
 
-      WDI_ASSERT(0);
+      WDI_ASSERT(0); 
+#endif
       return VOS_STATUS_E_FAILURE;
    }
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiEnterImpsRspCb, pEventData->pUserData, WDI_ENTER_IMPS_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiEnterImpsRspCb, pEventData->pUserData, WDI_ENTER_IMPS_RESP); 
 }/*WDI_ProcessEnterImpsReq*/
 
 /**
- @brief Process Exit IMPS Request function (called when
+ @brief Process Exit IMPS Request function (called when 
         Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessExitImpsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_ExitImpsRspCb        wdiExitImpsRspCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (wdiExitImpsRspCb   = (WDI_ExitImpsRspCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_EXIT_IMPS_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_EXIT_IMPS_REQ, 
                                                      0,
                                                      &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Exit IMPS req %x %x",
                  pEventData, wdiExitImpsRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiExitImpsRspCb, pEventData->pUserData, WDI_EXIT_IMPS_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiExitImpsRspCb, pEventData->pUserData, WDI_EXIT_IMPS_RESP); 
 }/*WDI_ProcessExitImpsReq*/
 
 /**
- @brief Process Enter BMPS Request function (called when Main
+ @brief Process Enter BMPS Request function (called when Main 
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessEnterBmpsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_EnterBmpsReqParamsType*  pwdiEnterBmpsReqParams = NULL;
    WDI_EnterBmpsRspCb           wdiEnterBmpsRspCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    tHalEnterBmpsReqParams   enterBmpsReq;
-   wpt_status               wptStatus;
+   wpt_status               wptStatus; 
 
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
   -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiEnterBmpsReqParams = (WDI_EnterBmpsReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiEnterBmpsRspCb   = (WDI_EnterBmpsRspCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ENTER_BMPS_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ENTER_BMPS_REQ, 
                          sizeof(enterBmpsReq),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(enterBmpsReq) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Enter BMPS req %x %x %x",
                  pEventData, pwdiEnterBmpsReqParams, wdiEnterBmpsRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /* Reset the event to be not signalled */
    wptStatus = wpalEventReset(&pWDICtx->setPowerStateEvent);
    if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "WDI Init failed to reset an event");
 
-      WDI_ASSERT(0);
+      WDI_ASSERT(0); 
+#endif
       return VOS_STATUS_E_FAILURE;
    }
 
@@ -11839,16 +12192,18 @@
    WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_BMPS, WDI_SetPowerStateCb);
 
 /*
-    * Wait for the event to be set once the ACK comes back from DXE
+    * Wait for the event to be set once the ACK comes back from DXE 
     */
-   wptStatus = wpalEventWait(&pWDICtx->setPowerStateEvent,
+   wptStatus = wpalEventWait(&pWDICtx->setPowerStateEvent, 
                              WDI_SET_POWER_STATE_TIMEOUT);
    if ( eWLAN_PAL_STATUS_SUCCESS != wptStatus )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "WDI Init failed to wait on an event");
 
-      WDI_ASSERT(0);
+      WDI_ASSERT(0); 
+#endif
       return VOS_STATUS_E_FAILURE;
    }
 
@@ -11864,143 +12219,149 @@
    enterBmpsReq.numBeaconPerRssiAverage = pwdiEnterBmpsReqParams->wdiEnterBmpsInfo.numBeaconPerRssiAverage;
    enterBmpsReq.bRssiFilterEnable = pwdiEnterBmpsReqParams->wdiEnterBmpsInfo.bRssiFilterEnable;
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &enterBmpsReq,
-                   sizeof(enterBmpsReq));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &enterBmpsReq, 
+                   sizeof(enterBmpsReq)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiEnterBmpsReqParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiEnterBmpsReqParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiEnterBmpsReqParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiEnterBmpsRspCb, pEventData->pUserData, WDI_ENTER_BMPS_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiEnterBmpsRspCb, pEventData->pUserData, WDI_ENTER_BMPS_RESP); 
 }/*WDI_ProcessEnterBmpsReq*/
 
 /**
  @brief Process Exit BMPS Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessExitBmpsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_ExitBmpsReqParamsType*  pwdiExitBmpsReqParams = NULL;
    WDI_ExitBmpsRspCb           wdiExitBmpsRspCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    tHalExitBmpsReqParams    exitBmpsReq;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiExitBmpsReqParams = (WDI_ExitBmpsReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiExitBmpsRspCb   = (WDI_ExitBmpsRspCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_EXIT_BMPS_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_EXIT_BMPS_REQ, 
                          sizeof(exitBmpsReq),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(exitBmpsReq) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Exit BMPS req %x %x %x",
                  pEventData, pwdiExitBmpsReqParams, wdiExitBmpsRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
    exitBmpsReq.sendDataNull = pwdiExitBmpsReqParams->wdiExitBmpsInfo.ucSendDataNull;
 
-   exitBmpsReq.bssIdx = pwdiExitBmpsReqParams->wdiExitBmpsInfo.bssIdx;
-
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &exitBmpsReq,
-                   sizeof(exitBmpsReq));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &exitBmpsReq, 
+                   sizeof(exitBmpsReq)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiExitBmpsReqParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiExitBmpsReqParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiExitBmpsReqParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiExitBmpsRspCb, pEventData->pUserData, WDI_EXIT_BMPS_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiExitBmpsRspCb, pEventData->pUserData, WDI_EXIT_BMPS_RESP); 
 }/*WDI_ProcessExitBmpsReq*/
 
 /**
- @brief Process Enter UAPSD Request function (called when Main
+ @brief Process Enter UAPSD Request function (called when Main 
         FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessEnterUapsdReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_EnterUapsdReqParamsType*  pwdiEnterUapsdReqParams = NULL;
    WDI_EnterUapsdRspCb           wdiEnterUapsdRspCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    tUapsdReqParams          enterUapsdReq;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiEnterUapsdReqParams = (WDI_EnterUapsdReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiEnterUapsdRspCb   = (WDI_EnterUapsdRspCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ENTER_UAPSD_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_ENTER_UAPSD_REQ, 
                          sizeof(enterUapsdReq),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(enterUapsdReq) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Enter UAPSD req %x %x %x",
                  pEventData, pwdiEnterUapsdReqParams, wdiEnterUapsdRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    enterUapsdReq.beDeliveryEnabled  = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucBeDeliveryEnabled;
@@ -12011,132 +12372,139 @@
    enterUapsdReq.viTriggerEnabled   = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucViTriggerEnabled;
    enterUapsdReq.voDeliveryEnabled  = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucVoDeliveryEnabled;
    enterUapsdReq.voTriggerEnabled   = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.ucVoTriggerEnabled;
-   enterUapsdReq.bssIdx             = pwdiEnterUapsdReqParams->wdiEnterUapsdInfo.bssIdx;
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &enterUapsdReq,
-                   sizeof(enterUapsdReq));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &enterUapsdReq, 
+                   sizeof(enterUapsdReq)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiEnterUapsdReqParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiEnterUapsdReqParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiEnterUapsdReqParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiEnterUapsdRspCb, pEventData->pUserData, WDI_ENTER_UAPSD_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiEnterUapsdRspCb, pEventData->pUserData, WDI_ENTER_UAPSD_RESP); 
 }/*WDI_ProcessEnterUapsdReq*/
 
 /**
- @brief Process Exit UAPSD Request function (called when
+ @brief Process Exit UAPSD Request function (called when 
         Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessExitUapsdReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_ExitUapsdRspCb       wdiExitUapsdRspCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (wdiExitUapsdRspCb   = (WDI_ExitUapsdRspCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_EXIT_UAPSD_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_EXIT_UAPSD_REQ, 
                                                      0,
                                                      &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Exit UAPSD req %x %x",
                  pEventData, wdiExitUapsdRspCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiExitUapsdRspCb, pEventData->pUserData, WDI_EXIT_UAPSD_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiExitUapsdRspCb, pEventData->pUserData, WDI_EXIT_UAPSD_RESP); 
 }/*WDI_ProcessExitUapsdReq*/
 
 /**
- @brief Process Set UAPSD params Request function (called when
+ @brief Process Set UAPSD params Request function (called when 
         Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetUapsdAcParamsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_SetUapsdAcParamsReqParamsType*  pwdiSetUapsdAcParams = NULL;
   WDI_SetUapsdAcParamsCb              wdiSetUapsdAcParamsCb = NULL;
-  wpt_uint8*               pSendBuffer         = NULL;
+  wpt_uint8*               pSendBuffer         = NULL; 
   wpt_uint16               usDataOffset        = 0;
   wpt_uint16               usSendSize          = 0;
   tUapsdInfo               uapsdAcParamsReq;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == (pwdiSetUapsdAcParams = (WDI_SetUapsdAcParamsReqParamsType*)pEventData->pEventData)) ||
       ( NULL == (wdiSetUapsdAcParamsCb   = (WDI_SetUapsdAcParamsCb)pEventData->pCBfnc)))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-----------------------------------------------------------------------
     Get message buffer
-    ! TO DO : proper conversion into the HAL Message Request Format
+    ! TO DO : proper conversion into the HAL Message Request Format 
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_UAPSD_PARAM_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_UAPSD_PARAM_REQ, 
                         sizeof(uapsdAcParamsReq),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(uapsdAcParamsReq) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in Set UAPSD params req %x %x %x",
                 pEventData, pwdiSetUapsdAcParams, wdiSetUapsdAcParamsCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   uapsdAcParamsReq.ac = pwdiSetUapsdAcParams->wdiUapsdInfo.ucAc;
@@ -12146,107 +12514,111 @@
   uapsdAcParamsReq.srvInterval = pwdiSetUapsdAcParams->wdiUapsdInfo.uSrvInterval;
   uapsdAcParamsReq.susInterval = pwdiSetUapsdAcParams->wdiUapsdInfo.uSusInterval;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &uapsdAcParamsReq,
-                  sizeof(uapsdAcParamsReq));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &uapsdAcParamsReq, 
+                  sizeof(uapsdAcParamsReq)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiSetUapsdAcParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiSetUapsdAcParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiSetUapsdAcParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Get STA Request to HAL
+    Send Get STA Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiSetUapsdAcParamsCb, pEventData->pUserData, WDI_SET_UAPSD_PARAM_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiSetUapsdAcParamsCb, pEventData->pUserData, WDI_SET_UAPSD_PARAM_RESP); 
 }/*WDI_ProcessSetUapsdAcParamsReq*/
 
 /**
- @brief Process update UAPSD params Request function (called
+ @brief Process update UAPSD params Request function (called 
         when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateUapsdParamsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_UpdateUapsdReqParamsType*  pwdiUpdateUapsdReqParams = NULL;
    WDI_UpdateUapsdParamsCb        wdiUpdateUapsdParamsCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiUpdateUapsdReqParams = (WDI_UpdateUapsdReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiUpdateUapsdParamsCb   = (WDI_UpdateUapsdParamsCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPDATE_UAPSD_PARAM_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPDATE_UAPSD_PARAM_REQ, 
                          sizeof(pwdiUpdateUapsdReqParams->wdiUpdateUapsdInfo),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(pwdiUpdateUapsdReqParams->wdiUpdateUapsdInfo) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Update UAPSD params req %x %x %x",
                  pEventData, pwdiUpdateUapsdReqParams, wdiUpdateUapsdParamsCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &pwdiUpdateUapsdReqParams->wdiUpdateUapsdInfo,
-                   sizeof(pwdiUpdateUapsdReqParams->wdiUpdateUapsdInfo));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &pwdiUpdateUapsdReqParams->wdiUpdateUapsdInfo, 
+                   sizeof(pwdiUpdateUapsdReqParams->wdiUpdateUapsdInfo)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiUpdateUapsdReqParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiUpdateUapsdReqParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiUpdateUapsdReqParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiUpdateUapsdParamsCb, pEventData->pUserData, WDI_UPDATE_UAPSD_PARAM_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiUpdateUapsdParamsCb, pEventData->pUserData, WDI_UPDATE_UAPSD_PARAM_RESP); 
 }/*WDI_ProcessUpdateUapsdParamsReq*/
 
 /**
- @brief Process Configure RXP filter Request function (called
+ @brief Process Configure RXP filter Request function (called 
         when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessConfigureRxpFilterReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_ConfigureRxpFilterReqParamsType*  pwdiRxpFilterParams = NULL;
   WDI_ConfigureRxpFilterCb              wdiConfigureRxpFilterCb = NULL;
-  wpt_uint8*               pSendBuffer         = NULL;
+  wpt_uint8*               pSendBuffer         = NULL; 
   wpt_uint16               usDataOffset        = 0;
   wpt_uint16               usSendSize          = 0;
   tHalConfigureRxpFilterReqParams     halRxpFilterParams;
@@ -12254,209 +12626,221 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == (pwdiRxpFilterParams = (WDI_ConfigureRxpFilterReqParamsType*)pEventData->pEventData)) ||
       ( NULL == (wdiConfigureRxpFilterCb   = (WDI_ConfigureRxpFilterCb)pEventData->pCBfnc)))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIGURE_RXP_FILTER_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIGURE_RXP_FILTER_REQ, 
                         sizeof(halRxpFilterParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(halRxpFilterParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in Set UAPSD params req %x %x %x",
                 pEventData, pwdiRxpFilterParams, wdiConfigureRxpFilterCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  halRxpFilterParams.setMcstBcstFilterSetting =
+  halRxpFilterParams.setMcstBcstFilterSetting = 
       pwdiRxpFilterParams->wdiRxpFilterParam.ucSetMcstBcstFilterSetting;
-  halRxpFilterParams.setMcstBcstFilter =
+  halRxpFilterParams.setMcstBcstFilter = 
       pwdiRxpFilterParams->wdiRxpFilterParam.ucSetMcstBcstFilter;
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halRxpFilterParams,
-                  sizeof(halRxpFilterParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halRxpFilterParams, 
+                  sizeof(halRxpFilterParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiRxpFilterParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiRxpFilterParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiRxpFilterParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Get STA Request to HAL
+    Send Get STA Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                       wdiConfigureRxpFilterCb, pEventData->pUserData, WDI_CONFIGURE_RXP_FILTER_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                       wdiConfigureRxpFilterCb, pEventData->pUserData, WDI_CONFIGURE_RXP_FILTER_RESP); 
 }/*WDI_ProcessConfigureRxpFilterReq*/
 
 /**
- @brief Process set beacon filter Request function (called
+ @brief Process set beacon filter Request function (called 
         when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetBeaconFilterReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_BeaconFilterReqParamsType*  pwdiBeaconFilterParams = NULL;
    WDI_SetBeaconFilterCb           wdiBeaconFilterCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiBeaconFilterParams = (WDI_BeaconFilterReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiBeaconFilterCb   = (WDI_SetBeaconFilterCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_BEACON_FILTER_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_BEACON_FILTER_REQ, 
                          sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo) + pwdiBeaconFilterParams->wdiBeaconFilterInfo.usIeNum * sizeof(tBeaconFilterIe),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Set beacon filter req %x %x %x",
                  pEventData, pwdiBeaconFilterParams, wdiBeaconFilterCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &pwdiBeaconFilterParams->wdiBeaconFilterInfo,
-                   sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo));
-   wpalMemoryCopy( pSendBuffer+usDataOffset+sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo),
-                   &pwdiBeaconFilterParams->aFilters[0],
-                   pwdiBeaconFilterParams->wdiBeaconFilterInfo.usIeNum * sizeof(tBeaconFilterIe));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &pwdiBeaconFilterParams->wdiBeaconFilterInfo, 
+                   sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo)); 
+   wpalMemoryCopy( pSendBuffer+usDataOffset+sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo), 
+                   &pwdiBeaconFilterParams->aFilters[0], 
+                   pwdiBeaconFilterParams->wdiBeaconFilterInfo.usIeNum * sizeof(tBeaconFilterIe)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiBeaconFilterParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiBeaconFilterParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiBeaconFilterParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiBeaconFilterCb, pEventData->pUserData, WDI_SET_BEACON_FILTER_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiBeaconFilterCb, pEventData->pUserData, WDI_SET_BEACON_FILTER_RESP); 
 }/*WDI_ProcessSetBeaconFilterReq*/
 
 /**
- @brief Process remove beacon filter Request function (called
+ @brief Process remove beacon filter Request function (called 
         when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessRemBeaconFilterReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_RemBeaconFilterReqParamsType*  pwdiBeaconFilterParams = NULL;
    WDI_RemBeaconFilterCb              wdiBeaconFilterCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiBeaconFilterParams = (WDI_RemBeaconFilterReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiBeaconFilterCb   = (WDI_RemBeaconFilterCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_REM_BEACON_FILTER_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_REM_BEACON_FILTER_REQ, 
                          sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in remove beacon filter req %x %x %x",
                   pEventData, pwdiBeaconFilterParams, wdiBeaconFilterCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &pwdiBeaconFilterParams->wdiBeaconFilterInfo,
-                   sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &pwdiBeaconFilterParams->wdiBeaconFilterInfo, 
+                   sizeof(pwdiBeaconFilterParams->wdiBeaconFilterInfo)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiBeaconFilterParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiBeaconFilterParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiBeaconFilterParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiBeaconFilterCb, pEventData->pUserData, WDI_REM_BEACON_FILTER_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiBeaconFilterCb, pEventData->pUserData, WDI_REM_BEACON_FILTER_RESP); 
 }
 
 /**
- @brief Process set RSSI thresholds Request function (called
+ @brief Process set RSSI thresholds Request function (called 
         when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetRSSIThresholdsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_SetRSSIThresholdsReqParamsType*  pwdiRSSIThresholdsParams = NULL;
    WDI_SetRSSIThresholdsCb              wdiRSSIThresholdsCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    tHalRSSIThresholds       rssiThresholdsReq;
@@ -12464,72 +12848,76 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiRSSIThresholdsParams = (WDI_SetRSSIThresholdsReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiRSSIThresholdsCb   = (WDI_SetRSSIThresholdsCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_RSSI_THRESHOLDS_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_RSSI_THRESHOLDS_REQ, 
                          sizeof(rssiThresholdsReq),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(rssiThresholdsReq) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in remove beacon filter req %x %x %x",
                   pEventData, pwdiRSSIThresholdsParams, wdiRSSIThresholdsCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   rssiThresholdsReq.bReserved10 =
+   rssiThresholdsReq.bReserved10 = 
       pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bReserved10;
-   rssiThresholdsReq.bRssiThres1NegNotify =
+   rssiThresholdsReq.bRssiThres1NegNotify = 
       pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres1NegNotify;
-   rssiThresholdsReq.bRssiThres1PosNotify =
+   rssiThresholdsReq.bRssiThres1PosNotify = 
       pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres1PosNotify;
-   rssiThresholdsReq.bRssiThres2NegNotify =
+   rssiThresholdsReq.bRssiThres2NegNotify = 
       pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres2NegNotify;
-   rssiThresholdsReq.bRssiThres2PosNotify =
+   rssiThresholdsReq.bRssiThres2PosNotify = 
       pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres2PosNotify;
-   rssiThresholdsReq.bRssiThres3NegNotify =
+   rssiThresholdsReq.bRssiThres3NegNotify = 
       pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres3NegNotify;
-   rssiThresholdsReq.bRssiThres3PosNotify =
+   rssiThresholdsReq.bRssiThres3PosNotify = 
       pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.bRssiThres3PosNotify;
-   rssiThresholdsReq.ucRssiThreshold1 =
+   rssiThresholdsReq.ucRssiThreshold1 = 
       pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.ucRssiThreshold1;
-   rssiThresholdsReq.ucRssiThreshold2 =
+   rssiThresholdsReq.ucRssiThreshold2 = 
       pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.ucRssiThreshold2;
-   rssiThresholdsReq.ucRssiThreshold3 =
+   rssiThresholdsReq.ucRssiThreshold3 = 
       pwdiRSSIThresholdsParams->wdiRSSIThresholdsInfo.ucRssiThreshold3;
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &rssiThresholdsReq,
-                   sizeof(rssiThresholdsReq));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &rssiThresholdsReq, 
+                   sizeof(rssiThresholdsReq)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiRSSIThresholdsParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiRSSIThresholdsParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiRSSIThresholdsParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Set threshold req to HAL
+     Send Set threshold req to HAL 
    -------------------------------------------------------------------------*/
-   if ((ret_status = WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+   if ((ret_status = WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                         wdiRSSIThresholdsCb, pEventData->pUserData, WDI_SET_RSSI_THRESHOLDS_RESP)) == WDI_STATUS_SUCCESS)
    {
       // When we are in idle state WDI_STARTED_ST and we receive indication for threshold
       // req. Then as a result of processing the threshold cross ind, we trigger
-      // a Set threshold req, then we need to indicate to WDI that it needs to
-      // go to busy state as a result of the indication as we sent a req in the
+      // a Set threshold req, then we need to indicate to WDI that it needs to 
+      // go to busy state as a result of the indication as we sent a req in the 
       // same WDI context.
       // Hence expected state transition is to busy.
       pWDICtx->ucExpectedStateTransition =  WDI_BUSY_ST;
@@ -12539,25 +12927,25 @@
 }
 
 /**
- @brief Process set RSSI thresholds Request function (called
+ @brief Process set RSSI thresholds Request function (called 
         when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessHostOffloadReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_HostOffloadReqParamsType*  pwdiHostOffloadParams = NULL;
    WDI_HostOffloadCb              wdiHostOffloadCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    tHalHostOffloadReq       hostOffloadParams;
@@ -12566,37 +12954,40 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiHostOffloadParams = (WDI_HostOffloadReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiHostOffloadCb   = (WDI_HostOffloadCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_HOST_OFFLOAD_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_HOST_OFFLOAD_REQ, 
                          sizeof(hostOffloadParams)+sizeof(nsOffloadParams),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(hostOffloadParams) + sizeof(nsOffloadParams) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in host offload req %x %x %x",
                   pEventData, pwdiHostOffloadParams, wdiHostOffloadCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    hostOffloadParams.offloadType = pwdiHostOffloadParams->wdiHostOffloadInfo.ucOffloadType;
    hostOffloadParams.enableOrDisable = pwdiHostOffloadParams->wdiHostOffloadInfo.ucEnableOrDisable;
-
    if( HAL_IPV4_ARP_REPLY_OFFLOAD == hostOffloadParams.offloadType )
    {
       // ARP Offload
@@ -12631,96 +13022,95 @@
         nsOffloadParams.srcIPv6AddrValid = pwdiHostOffloadParams->wdiNsOffloadParams.srcIPv6AddrValid;
         nsOffloadParams.targetIPv6Addr1Valid = pwdiHostOffloadParams->wdiNsOffloadParams.targetIPv6Addr1Valid;
         nsOffloadParams.targetIPv6Addr2Valid = pwdiHostOffloadParams->wdiNsOffloadParams.targetIPv6Addr2Valid;
-
-        nsOffloadParams.bssIdx = pwdiHostOffloadParams->wdiNsOffloadParams.bssIdx;
-
 #endif // WLAN_NS_OFFLOAD
    }
 
    // copy hostOffloadParams into pSendBuffer
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &hostOffloadParams,
-                   sizeof(hostOffloadParams));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &hostOffloadParams, 
+                   sizeof(hostOffloadParams)); 
 
 #ifdef WLAN_NS_OFFLOAD
    if( HAL_IPV6_NS_OFFLOAD == hostOffloadParams.offloadType )
    {
        // copy nsOffloadParams into pSendBuffer
-       wpalMemoryCopy( pSendBuffer+usDataOffset+sizeof(hostOffloadParams),
-                       &nsOffloadParams,
-                       sizeof(nsOffloadParams));
+       wpalMemoryCopy( pSendBuffer+usDataOffset+sizeof(hostOffloadParams), 
+                       &nsOffloadParams, 
+                       sizeof(nsOffloadParams)); 
    }
 #endif // WLAN_NS_OFFLOAD
 
    pWDICtx->wdiReqStatusCB     = pwdiHostOffloadParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiHostOffloadParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiHostOffloadParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiHostOffloadCb, pEventData->pUserData, WDI_HOST_OFFLOAD_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiHostOffloadCb, pEventData->pUserData, WDI_HOST_OFFLOAD_RESP); 
 }/*WDI_ProcessHostOffloadReq*/
 
 /**
- @brief Process Keep Alive Request function (called
+ @brief Process Keep Alive Request function (called 
         when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessKeepAliveReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_KeepAliveReqParamsType*  pwdiKeepAliveParams = NULL;
    WDI_KeepAliveCb              wdiKeepAliveCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    tHalKeepAliveReq         keepAliveReq;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiKeepAliveParams = (WDI_KeepAliveReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiKeepAliveCb   = (WDI_KeepAliveCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
                "Invalid parameters in Keep Alive req");
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_KEEP_ALIVE_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_KEEP_ALIVE_REQ, 
                          sizeof(keepAliveReq),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(keepAliveReq) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "Unable to get send buffer in keep alive req %x %x %x",
                   pEventData, pwdiKeepAliveParams, wdiKeepAliveCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    keepAliveReq.packetType = pwdiKeepAliveParams->wdiKeepAliveInfo.ucPacketType;
    keepAliveReq.timePeriod = pwdiKeepAliveParams->wdiKeepAliveInfo.ucTimePeriod;
 
-   keepAliveReq.bssIdx = pwdiKeepAliveParams->wdiKeepAliveInfo.bssIdx;
-
    if(pwdiKeepAliveParams->wdiKeepAliveInfo.ucPacketType == 2)
    {
    wpalMemoryCopy(keepAliveReq.hostIpv4Addr,
@@ -12728,97 +13118,102 @@
                      HAL_IPV4_ADDR_LEN);
    wpalMemoryCopy(keepAliveReq.destIpv4Addr,
                      pwdiKeepAliveParams->wdiKeepAliveInfo.aDestIpv4Addr,
-                     HAL_IPV4_ADDR_LEN);
+                     HAL_IPV4_ADDR_LEN);   
    wpalMemoryCopy(keepAliveReq.destMacAddr,
                      pwdiKeepAliveParams->wdiKeepAliveInfo.aDestMacAddr,
                      HAL_MAC_ADDR_LEN);
    }
+      
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &keepAliveReq, 
+                   sizeof(keepAliveReq)); 
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &keepAliveReq,
-                   sizeof(keepAliveReq));
-
+#ifdef WLAN_DEBUG
    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
                "Process keep alive req %d",sizeof(keepAliveReq));
 
    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
                "Process keep alive req time period %d",keepAliveReq.timePeriod);
-
+#endif
    pWDICtx->wdiReqStatusCB     = pwdiKeepAliveParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiKeepAliveParams->pUserData;
-
+   pWDICtx->pReqStatusUserData = pwdiKeepAliveParams->pUserData; 
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
                   "Sending keep alive req to HAL");
-
+#endif
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiKeepAliveCb, pEventData->pUserData, WDI_KEEP_ALIVE_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiKeepAliveCb, pEventData->pUserData, WDI_KEEP_ALIVE_RESP); 
 }/*WDI_ProcessKeepAliveReq*/
 
 
 /**
- @brief Process Wowl add bc ptrn Request function (called
+ @brief Process Wowl add bc ptrn Request function (called 
         when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessWowlAddBcPtrnReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_WowlAddBcPtrnReqParamsType*  pwdiWowlAddBcPtrnParams = NULL;
    WDI_WowlAddBcPtrnCb              wdiWowlAddBcPtrnCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    tHalWowlAddBcastPtrn     wowlAddBcPtrnReq;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiWowlAddBcPtrnParams = (WDI_WowlAddBcPtrnReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiWowlAddBcPtrnCb   = (WDI_WowlAddBcPtrnCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_ADD_BC_PTRN_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_ADD_BC_PTRN_REQ, 
                          sizeof(wowlAddBcPtrnReq),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(wowlAddBcPtrnReq) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in Wowl add bc ptrn req %x %x %x",
                   pEventData, pwdiWowlAddBcPtrnParams, wdiWowlAddBcPtrnCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wowlAddBcPtrnReq.ucPatternId =
+   wowlAddBcPtrnReq.ucPatternId = 
       pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternId;
-   wowlAddBcPtrnReq.ucPatternByteOffset =
+   wowlAddBcPtrnReq.ucPatternByteOffset = 
       pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternByteOffset;
-   wowlAddBcPtrnReq.ucPatternMaskSize =
+   wowlAddBcPtrnReq.ucPatternMaskSize = 
       pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternMaskSize;
-   wowlAddBcPtrnReq.ucPatternSize =
+   wowlAddBcPtrnReq.ucPatternSize = 
       pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternSize;
 
    if (pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternSize <= HAL_WOWL_BCAST_PATTERN_MAX_SIZE)
@@ -12847,175 +13242,183 @@
                       pwdiWowlAddBcPtrnParams->wdiWowlAddBcPtrnInfo.ucPatternMaskSize - HAL_WOWL_BCAST_PATTERN_MAX_SIZE);
    }
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &wowlAddBcPtrnReq,
-                   sizeof(wowlAddBcPtrnReq));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &wowlAddBcPtrnReq, 
+                   sizeof(wowlAddBcPtrnReq)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiWowlAddBcPtrnParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiWowlAddBcPtrnParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiWowlAddBcPtrnParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiWowlAddBcPtrnCb, pEventData->pUserData, WDI_WOWL_ADD_BC_PTRN_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiWowlAddBcPtrnCb, pEventData->pUserData, WDI_WOWL_ADD_BC_PTRN_RESP); 
 }/*WDI_ProcessWowlAddBcPtrnReq*/
 
 /**
- @brief Process Wowl delete bc ptrn Request function (called
+ @brief Process Wowl delete bc ptrn Request function (called 
         when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessWowlDelBcPtrnReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_WowlDelBcPtrnReqParamsType*  pwdiWowlDelBcPtrnParams = NULL;
    WDI_WowlDelBcPtrnCb              wdiWowlDelBcPtrnCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    tHalWowlDelBcastPtrn     wowlDelBcPtrnReq;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiWowlDelBcPtrnParams = (WDI_WowlDelBcPtrnReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiWowlDelBcPtrnCb   = (WDI_WowlDelBcPtrnCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_DEL_BC_PTRN_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_DEL_BC_PTRN_REQ, 
                          sizeof(wowlDelBcPtrnReq),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(wowlDelBcPtrnReq) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in Wowl del bc ptrn req %x %x %x",
                   pEventData, pwdiWowlDelBcPtrnParams, wdiWowlDelBcPtrnCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wowlDelBcPtrnReq.ucPatternId =
+   wowlDelBcPtrnReq.ucPatternId = 
       pwdiWowlDelBcPtrnParams->wdiWowlDelBcPtrnInfo.ucPatternId;
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &wowlDelBcPtrnReq,
-                   sizeof(wowlDelBcPtrnReq));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &wowlDelBcPtrnReq, 
+                   sizeof(wowlDelBcPtrnReq)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiWowlDelBcPtrnParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiWowlDelBcPtrnParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiWowlDelBcPtrnParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiWowlDelBcPtrnCb, pEventData->pUserData, WDI_WOWL_DEL_BC_PTRN_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiWowlDelBcPtrnCb, pEventData->pUserData, WDI_WOWL_DEL_BC_PTRN_RESP); 
 }/*WDI_ProcessWowlDelBcPtrnReq*/
 
 /**
- @brief Process Wowl enter Request function (called
+ @brief Process Wowl enter Request function (called 
         when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessWowlEnterReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_WowlEnterReqParamsType*  pwdiWowlEnterParams = NULL;
    WDI_WowlEnterReqCb           wdiWowlEnterCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    tHalWowlEnterParams      wowlEnterReq;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiWowlEnterParams = (WDI_WowlEnterReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiWowlEnterCb   = (WDI_WowlEnterReqCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_ENTER_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_ENTER_REQ, 
                          sizeof(wowlEnterReq),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(wowlEnterReq) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in Wowl enter req %x %x %x",
                   pEventData, pwdiWowlEnterParams, wdiWowlEnterCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wowlEnterReq.ucMagicPktEnable =
+   wowlEnterReq.ucMagicPktEnable = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucMagicPktEnable;
-   wowlEnterReq.ucPatternFilteringEnable =
+   wowlEnterReq.ucPatternFilteringEnable = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucPatternFilteringEnable;
-   wowlEnterReq.ucUcastPatternFilteringEnable =
+   wowlEnterReq.ucUcastPatternFilteringEnable = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucUcastPatternFilteringEnable;
-   wowlEnterReq.ucWowChnlSwitchRcv =
+   wowlEnterReq.ucWowChnlSwitchRcv = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowChnlSwitchRcv;
-   wowlEnterReq.ucWowDeauthRcv =
+   wowlEnterReq.ucWowDeauthRcv = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowDeauthRcv;
-   wowlEnterReq.ucWowDisassocRcv =
+   wowlEnterReq.ucWowDisassocRcv = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowDisassocRcv;
-   wowlEnterReq.ucWowMaxMissedBeacons =
+   wowlEnterReq.ucWowMaxMissedBeacons = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowMaxMissedBeacons;
-   wowlEnterReq.ucWowMaxSleepUsec =
+   wowlEnterReq.ucWowMaxSleepUsec = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowMaxSleepUsec;
 
 #ifdef WLAN_WAKEUP_EVENTS
-   wowlEnterReq.ucWoWEAPIDRequestEnable =
+   wowlEnterReq.ucWoWEAPIDRequestEnable = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucWoWEAPIDRequestEnable;
 
    wowlEnterReq.ucWoWEAPOL4WayEnable =
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucWoWEAPOL4WayEnable;
 
-   wowlEnterReq.ucWowNetScanOffloadMatch =
+   wowlEnterReq.ucWowNetScanOffloadMatch = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowNetScanOffloadMatch;
 
-   wowlEnterReq.ucWowGTKRekeyError =
+   wowlEnterReq.ucWowGTKRekeyError = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucWowGTKRekeyError;
 
-   wowlEnterReq.ucWoWBSSConnLoss =
+   wowlEnterReq.ucWoWBSSConnLoss = 
       pwdiWowlEnterParams->wdiWowlEnterInfo.ucWoWBSSConnLoss;
 #endif // WLAN_WAKEUP_EVENTS
 
@@ -13023,342 +13426,356 @@
                   pwdiWowlEnterParams->wdiWowlEnterInfo.magicPtrn,
                   sizeof(tSirMacAddr));
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &wowlEnterReq,
-                   sizeof(wowlEnterReq));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &wowlEnterReq, 
+                   sizeof(wowlEnterReq)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiWowlEnterParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiWowlEnterParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiWowlEnterParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiWowlEnterCb, pEventData->pUserData, WDI_WOWL_ENTER_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiWowlEnterCb, pEventData->pUserData, WDI_WOWL_ENTER_RESP); 
 }/*WDI_ProcessWowlEnterReq*/
 
 /**
  @brief Process Wowl exit Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessWowlExitReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_WowlExitReqCb           wdiWowlExitCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (wdiWowlExitCb   = (WDI_WowlExitReqCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
-     ! TO DO : proper conversion into the HAL Message Request Format
+     ! TO DO : proper conversion into the HAL Message Request Format 
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_EXIT_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_WOWL_EXIT_REQ, 
                                                      0,
                                                      &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Wowl Exit req %x %x",
                  pEventData, wdiWowlExitCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiWowlExitCb, pEventData->pUserData, WDI_WOWL_EXIT_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiWowlExitCb, pEventData->pUserData, WDI_WOWL_EXIT_RESP); 
 }/*WDI_ProcessWowlExitReq*/
 
 /**
  @brief Process Configure Apps Cpu Wakeup State Request function
         (called when Main FSM allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessConfigureAppsCpuWakeupStateReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_ConfigureAppsCpuWakeupStateReqParamsType*  pwdiAppsCpuWakeupStateParams = NULL;
    WDI_ConfigureAppsCpuWakeupStateCb              wdiConfigureAppsCpuWakeupStateCb = NULL;
-   wpt_uint8*               pSendBuffer         = NULL;
+   wpt_uint8*               pSendBuffer         = NULL; 
    wpt_uint16               usDataOffset        = 0;
    wpt_uint16               usSendSize          = 0;
    tHalConfigureAppsCpuWakeupStateReqParams  halCfgAppsCpuWakeupStateReqParams;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiAppsCpuWakeupStateParams = (WDI_ConfigureAppsCpuWakeupStateReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiConfigureAppsCpuWakeupStateCb   = (WDI_ConfigureAppsCpuWakeupStateCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ, 
                          sizeof(halCfgAppsCpuWakeupStateReqParams),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(pwdiAppsCpuWakeupStateParams->bIsAppsAwake) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                "Unable to get send buffer in Apps CPU Wakeup State req %x %x %x",
                  pEventData, pwdiAppsCpuWakeupStateParams, wdiConfigureAppsCpuWakeupStateCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   halCfgAppsCpuWakeupStateReqParams.isAppsCpuAwake =
+   halCfgAppsCpuWakeupStateReqParams.isAppsCpuAwake = 
                            pwdiAppsCpuWakeupStateParams->bIsAppsAwake;
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &halCfgAppsCpuWakeupStateReqParams,
-                   sizeof(halCfgAppsCpuWakeupStateReqParams));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &halCfgAppsCpuWakeupStateReqParams, 
+                   sizeof(halCfgAppsCpuWakeupStateReqParams)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiAppsCpuWakeupStateParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiAppsCpuWakeupStateParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiAppsCpuWakeupStateParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiConfigureAppsCpuWakeupStateCb, pEventData->pUserData,
-                        WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiConfigureAppsCpuWakeupStateCb, pEventData->pUserData, 
+                        WDI_CONFIGURE_APPS_CPU_WAKEUP_STATE_RESP); 
 }/*WDI_ProcessConfigureAppsCpuWakeupStateReq*/
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
 /**
  @brief Process Aggregated Add TSpec Request function (called when Main FSM
         allows it)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessAggrAddTSpecReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_AggrAddTSReqParamsType*  pwdiAggrAddTSParams;
   WDI_AggrAddTsRspCb           wdiAggrAddTSRspCb;
-  wpt_uint8                ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*      pBSSSes             = NULL;
-  wpt_uint8*               pSendBuffer         = NULL;
+  wpt_uint8*               pSendBuffer         = NULL; 
   wpt_uint16               usDataOffset        = 0;
   wpt_uint16               usSendSize          = 0;
-  WDI_Status               wdiStatus           = WDI_STATUS_SUCCESS;
+  WDI_Status               wdiStatus           = WDI_STATUS_SUCCESS; 
   wpt_macAddr              macBSSID;
   tAggrAddTsReq            halAggrAddTsReq;
   int i;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) || ( NULL == pEventData->pEventData ) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
   wpalMemoryFill( &halAggrAddTsReq, sizeof(tAggrAddTsReq), 0 );
   pwdiAggrAddTSParams = (WDI_AggrAddTSReqParamsType*)pEventData->pEventData;
   wdiAggrAddTSRspCb   = (WDI_AggrAddTsRspCb)pEventData->pCBfnc;
   /*-------------------------------------------------------------------------
     Check to see if we are in the middle of an association, if so queue, if
-    not it means it is free to process request
+    not it means it is free to process request 
   -------------------------------------------------------------------------*/
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
     Find the BSS for which the request is made and identify WDI session
   ------------------------------------------------------------------------*/
-  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx,
-                                        pwdiAggrAddTSParams->wdiAggrTsInfo.ucSTAIdx,
+  if ( WDI_STATUS_SUCCESS != WDI_STATableGetStaBSSIDAddr(pWDICtx, 
+                                        pwdiAggrAddTSParams->wdiAggrTsInfo.ucSTAIdx, 
                                         &macBSSID))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
              "This station does not exist in the WDI Station Table %d");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
 
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes);
-  if ( NULL == pBSSSes )
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, macBSSID, &pBSSSes); 
+  if ( NULL == pBSSSes ) 
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-        "%s: Association sequence for this BSS does not yet exist. macBSSID " MAC_ADDRESS_STR,
-        __func__, MAC_ADDR_ARRAY(macBSSID));
-
+              "Association sequence for this BSS does not yet exist");
+#endif
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
-
+ 
   /*------------------------------------------------------------------------
     Check if this BSS is being currently processed or queued,
-    if queued - queue the new request as well
+    if queued - queue the new request as well 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_TRUE == pBSSSes->bAssocReqQueued )
   {
-    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "%s: Association sequence for this BSS exists but currently queued. macBSSID " MAC_ADDRESS_STR,
-              __func__, MAC_ADDR_ARRAY(macBSSID));
-
-    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData);
+#ifdef WLAN_DEBUG
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+              "Association sequence for this BSS exists but currently queued");
+#endif
+    wdiStatus = WDI_QueueAssocRequest( pWDICtx, pBSSSes, pEventData); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return wdiStatus;
+    return wdiStatus; 
   }
 
   wpalMutexRelease(&pWDICtx->wptMutex);
   /*-----------------------------------------------------------------------
     Get message buffer
-    ! TO DO : proper conversion into the HAL Message Request Format
+    ! TO DO : proper conversion into the HAL Message Request Format 
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_AGGR_ADD_TS_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_AGGR_ADD_TS_REQ, 
                         sizeof(tAggrAddTsParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + sizeof(tAggrAddTsParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in set bss key req %x %x %x",
                 pEventData, pwdiAggrAddTSParams, wdiAggrAddTSRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  halAggrAddTsReq.aggrAddTsParam.staIdx =
+  halAggrAddTsReq.aggrAddTsParam.staIdx = 
      pwdiAggrAddTSParams->wdiAggrTsInfo.ucSTAIdx;
-  halAggrAddTsReq.aggrAddTsParam.tspecIdx =
+  halAggrAddTsReq.aggrAddTsParam.tspecIdx = 
      pwdiAggrAddTSParams->wdiAggrTsInfo.ucTspecIdx;
 
   for( i = 0; i < WLAN_HAL_MAX_AC; i++ )
   {
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].type =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].type = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].ucType;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].length =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].length = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].ucLength;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.ackPolicy =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.ackPolicy = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
         ackPolicy;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.accessPolicy =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.accessPolicy = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
         accessPolicy;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.userPrio =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.userPrio = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
         userPrio;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.psb =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.psb = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
         psb;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.aggregation =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.aggregation = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
         aggregation;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.direction =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.direction = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
         direction;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.tsid =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.tsid = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
         trafficType;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.tsid =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.traffic.tsid = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiTraffic.
         trafficType;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.schedule.rsvd =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.schedule.rsvd = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiSchedule.rsvd;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.schedule.schedule =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].tsinfo.schedule.schedule = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].wdiTSinfo.wdiSchedule.schedule;
-
-
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].nomMsduSz =
+        
+                  
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].nomMsduSz = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].usNomMsduSz;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].maxMsduSz =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].maxMsduSz = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].usMaxMsduSz;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].minSvcInterval =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].minSvcInterval = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMinSvcInterval;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].maxSvcInterval =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].maxSvcInterval = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMaxSvcInterval;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].inactInterval =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].inactInterval = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uInactInterval;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].suspendInterval =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].suspendInterval = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uSuspendInterval;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].svcStartTime =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].svcStartTime = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uSvcStartTime;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].minDataRate =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].minDataRate = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMinDataRate;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].meanDataRate =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].meanDataRate = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMeanDataRate;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].peakDataRate =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].peakDataRate = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uPeakDataRate;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].maxBurstSz =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].maxBurstSz = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMaxBurstSz;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].delayBound =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].delayBound = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uDelayBound;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].minPhyRate =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].minPhyRate = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].uMinPhyRate;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].surplusBw =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].surplusBw = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].usSurplusBw;
-     halAggrAddTsReq.aggrAddTsParam.tspec[i].mediumTime =
+     halAggrAddTsReq.aggrAddTsParam.tspec[i].mediumTime = 
         pwdiAggrAddTSParams->wdiAggrTsInfo.wdiTspecIE[i].usMediumTime;
   }
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halAggrAddTsReq,
-                  sizeof(halAggrAddTsReq));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halAggrAddTsReq, 
+                  sizeof(halAggrAddTsReq)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiAggrAddTSParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiAggrAddTSParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiAggrAddTSParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Add TS Request to HAL
+    Send Add TS Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        wdiAggrAddTSRspCb, pEventData->pUserData,
-                       WDI_AGGR_ADD_TS_RESP);
+                       WDI_AGGR_ADD_TS_RESP); 
 }/*WDI_ProcessAggrAddTSpecReq*/
 #endif /* WLAN_FEATURE_VOWIFI_11R */
 
@@ -13385,13 +13802,15 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
      -------------------------------------------------------------------------*/
    if ( NULL == pEventData )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
             "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
+#endif
       return WDI_STATUS_E_FAILURE;
    }
 
@@ -13422,42 +13841,43 @@
    WDI_STATableClose(pWDICtx);
    /*close the PAL */
    wptStatus = wpalClose(pWDICtx->pPALContext);
+#ifdef WLAN_DEBUG
    if ( eWLAN_PAL_STATUS_SUCCESS !=  wptStatus )
    {
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
             "Failed to wpal Close %d", wptStatus);
       WDI_ASSERT(0);
    }
-
+#endif
    /*Transition back to init state*/
    WDI_STATE_TRANSITION( pWDICtx, WDI_INIT_ST);
 
    wpalMutexRelease(&pWDICtx->wptMutex);
 
    /*Make sure the expected state is properly defaulted to Init*/
-   pWDICtx->ucExpectedStateTransition = WDI_INIT_ST;
+   pWDICtx->ucExpectedStateTransition = WDI_INIT_ST; 
 
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessShutdownReq*/
 
 /*========================================================================
-          Main DAL Control Path Response Processing API
+          Main DAL Control Path Response Processing API 
 ========================================================================*/
 
 /**
  @brief Process Start Response function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessStartRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -13472,18 +13892,20 @@
 #endif
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-  wdiStartRspCb = (WDI_StartRspCb)pWDICtx->pfncRspCB;
+  wdiStartRspCb = (WDI_StartRspCb)pWDICtx->pfncRspCB; 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData) ||
       ( NULL == wdiStartRspCb ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
@@ -13492,16 +13914,18 @@
   if ( sizeof(tHalMacStartRspParams) > pEventData->uEventDataSize )
   {
      // not enough data was received
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                  "Invalid response length in Start Resp Expect %x Rcvd %x",
                  sizeof(tHalMacStartRspParams), pEventData->uEventDataSize);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
     Unpack HAL Response Message - the header was already extracted by the
-    main Response Handling procedure
+    main Response Handling procedure 
   -------------------------------------------------------------------------*/
   startRspParams = (tHalMacStartRspParams *) pEventData->pEventData;
 
@@ -13534,17 +13958,18 @@
 
     /*Cache the start response for further use*/
     wpalMemoryCopy( &pWDICtx->wdiCachedStartRspParams ,
-                  &wdiRspParams,
+                  &wdiRspParams, 
                   sizeof(pWDICtx->wdiCachedStartRspParams));
 
   }
   else
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
                "Failed to start device with status %s(%d)",
                WDI_getHALStatusMsgString(startRspParams->status),
                startRspParams->status);
-
+#endif
     /*Set the expected state transition to stopped - because the start has
       failed*/
     pWDICtx->ucExpectedStateTransition =  WDI_STOPPED_ST;
@@ -13553,14 +13978,14 @@
 
      /*Notify UMAC*/
     wdiStartRspCb( &wdiRspParams, pWDICtx->pRspCBUserData);
-
+    
     WDI_DetectedDeviceError(pWDICtx, wdiRspParams.wdiStatus);
 
     /*Although the response is an error - it was processed by our function
     so as far as the caller is concerned this is a succesful reponse processing*/
     return WDI_STATUS_SUCCESS;
   }
-
+  
   wpalMutexRelease(&pWDICtx->wptMutex);
 
   if(eDRIVER_TYPE_MFG == pWDICtx->driverMode)
@@ -13613,23 +14038,23 @@
   /*Notify UMAC*/
   wdiStartRspCb( &wdiRspParams, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessStartRsp*/
 
 
 /**
  @brief Process Stop Response function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessStopRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -13637,21 +14062,23 @@
   WDI_Status          wdiStatus;
   WDI_StopRspCb       wdiStopRspCb = NULL;
 
-  tHalMacStopRspMsg   halMacStopRspMsg;
+  tHalMacStopRspMsg   halMacStopRspMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-  wdiStopRspCb = (WDI_StopRspCb)pWDICtx->pfncRspCB;
+  wdiStopRspCb = (WDI_StopRspCb)pWDICtx->pfncRspCB; 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData) ||
       ( NULL == wdiStopRspCb ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
@@ -13659,41 +14086,44 @@
   -------------------------------------------------------------------------*/
   if ( sizeof(halMacStopRspMsg) < pEventData->uEventDataSize )
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Invalid response length in Stop Resp %x %x",
                 pEventData->uEventDataSize);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
     Unpack HAL Response Message - the header was already extracted by the
-    main Response Handling procedure
+    main Response Handling procedure 
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halMacStopRspMsg.stopRspParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halMacStopRspMsg.stopRspParams,  
+                  pEventData->pEventData, 
                   sizeof(halMacStopRspMsg.stopRspParams));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halMacStopRspMsg.stopRspParams.status);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halMacStopRspMsg.stopRspParams.status); 
 
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*--------------------------------------------------------------------------
-    Check to see if the stop went OK
+    Check to see if the stop went OK 
   --------------------------------------------------------------------------*/
   if ( WDI_STATUS_SUCCESS != wdiStatus  )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
                "Failed to stop the device with status %s (%d)",
                WDI_getHALStatusMsgString(halMacStopRspMsg.stopRspParams.status),
                halMacStopRspMsg.stopRspParams.status);
-
-    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE);
-
+#endif
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+    
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
-
+  
   pWDICtx->ucExpectedStateTransition = WDI_STOPPED_ST;
 
   /*Transition now as WDI may get preempted imediately after it sends
@@ -13707,89 +14137,95 @@
   /*Notify UMAC*/
   wdiStopRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessStopRsp*/
 
 /**
  @brief Process Close Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessCloseRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   /*There is no close response comming from HAL - function just kept for
   simmetry */
+#ifdef WLAN_DEBUG
   WDI_ASSERT(0);
-  return WDI_STATUS_SUCCESS;
+#endif
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessCloseRsp*/
 
 
 /*============================================================================
-                      SCAN RESPONSE PROCESSING API
+                      SCAN RESPONSE PROCESSING API 
 ============================================================================*/
 
 /**
  @brief Process Init Scan Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessInitScanRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_Status            wdiStatus;
   WDI_InitScanRspCb     wdiInitScanRspCb;
-  tHalInitScanRspMsg    halInitScanRspMsg;
+  tHalInitScanRspMsg    halInitScanRspMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiInitScanRspCb = (WDI_InitScanRspCb)pWDICtx->pfncRspCB;
   if( NULL == wdiInitScanRspCb)
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                  "%s: call back function is NULL", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
     Unpack HAL Response Message - the header was already extracted by the
-    main Response Handling procedure
+    main Response Handling procedure 
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halInitScanRspMsg.initScanRspParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halInitScanRspMsg.initScanRspParams, 
+                  pEventData->pEventData, 
                   sizeof(halInitScanRspMsg.initScanRspParams));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halInitScanRspMsg.initScanRspParams.status);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halInitScanRspMsg.initScanRspParams.status); 
 
   if ( pWDICtx->bInBmps )
   {
@@ -13800,71 +14236,76 @@
   /*Notify UMAC*/
   wdiInitScanRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessInitScanRsp*/
 
 
 /**
  @brief Process Start Scan Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessStartScanRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_StartScanRspParamsType   wdiStartScanParams;
   WDI_StartScanRspCb           wdiStartScanRspCb;
-
-  tHalStartScanRspMsg          halStartScanRspMsg;
+  
+  tHalStartScanRspMsg          halStartScanRspMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiStartScanRspCb = (WDI_StartScanRspCb)pWDICtx->pfncRspCB;
   if( NULL == wdiStartScanRspCb)
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                  "%s: call back function is NULL", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halStartScanRspMsg.startScanRspParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halStartScanRspMsg.startScanRspParams, 
+                  pEventData->pEventData, 
                   sizeof(halStartScanRspMsg.startScanRspParams));
 
   wdiStartScanParams.wdiStatus   =   WDI_HAL_2_WDI_STATUS(
                              halStartScanRspMsg.startScanRspParams.status);
 #ifdef WLAN_FEATURE_VOWIFI
-  wdiStartScanParams.ucTxMgmtPower =
+  wdiStartScanParams.ucTxMgmtPower = 
                              halStartScanRspMsg.startScanRspParams.txMgmtPower;
-  wpalMemoryCopy( wdiStartScanParams.aStartTSF,
+  wpalMemoryCopy( wdiStartScanParams.aStartTSF, 
                   halStartScanRspMsg.startScanRspParams.startTSF,
                   2);
-#endif
+#endif 
 
+#ifdef WLAN_DEBUG
   if ( eHAL_STATUS_SUCCESS != halStartScanRspMsg.startScanRspParams.status )
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -13873,28 +14314,28 @@
               halStartScanRspMsg.startScanRspParams.status);
      /* send the status to UMAC, don't return from here*/
   }
-
+#endif
   /*Notify UMAC*/
   wdiStartScanRspCb( &wdiStartScanParams, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 
 }/*WDI_ProcessStartScanRsp*/
 
 
 /**
- @brief Process End Scan Response function (called when a
+ @brief Process End Scan Response function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessEndScanRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -13905,15 +14346,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiEndScanRspCb = (WDI_EndScanRspCb)pWDICtx->pfncRspCB;
@@ -13921,12 +14364,13 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halEndScanRspMsg.endScanRspParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halEndScanRspMsg.endScanRspParams, 
+                  pEventData->pEventData, 
                   sizeof(halEndScanRspMsg.endScanRspParams));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halEndScanRspMsg.endScanRspParams.status);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halEndScanRspMsg.endScanRspParams.status); 
 
+#ifdef WLAN_DEBUG
   if ( eHAL_STATUS_SUCCESS != halEndScanRspMsg.endScanRspParams.status )
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -13935,47 +14379,49 @@
               halEndScanRspMsg.endScanRspParams.status);
      /* send the status to UMAC, don't return from here*/
   }
-
+#endif
   /*Notify UMAC*/
   wdiEndScanRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessEndScanRsp*/
 
 
 /**
- @brief Process Finish Scan Response function (called when a
+ @brief Process Finish Scan Response function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessFinishScanRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
-)
+)  
 {
   WDI_Status            wdiStatus;
   WDI_FinishScanRspCb   wdiFinishScanRspCb;
-
-  tHalFinishScanRspMsg  halFinishScanRspMsg;
+  
+  tHalFinishScanRspMsg  halFinishScanRspMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiFinishScanRspCb = (WDI_FinishScanRspCb)pWDICtx->pfncRspCB;
@@ -13983,16 +14429,16 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( (void *)&halFinishScanRspMsg.finishScanRspParams.status,
-                  pEventData->pEventData,
+  wpalMemoryCopy( (void *)&halFinishScanRspMsg.finishScanRspParams.status, 
+                  pEventData->pEventData, 
                   sizeof(halFinishScanRspMsg.finishScanRspParams.status));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halFinishScanRspMsg.finishScanRspParams.status);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halFinishScanRspMsg.finishScanRspParams.status); 
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO_LOW,
-              "Finish scan response reported status: %d",
+              "Finish scan response reported status: %d", 
               halFinishScanRspMsg.finishScanRspParams.status);
-
   if (( eHAL_STATUS_SUCCESS != halFinishScanRspMsg.finishScanRspParams.status )&&
       ( eHAL_STATUS_NOTIFY_BSS_FAIL  != halFinishScanRspMsg.finishScanRspParams.status ))
   {
@@ -14002,26 +14448,27 @@
               halFinishScanRspMsg.finishScanRspParams.status);
      /* send the status to UMAC, don't return from here*/
   }
+#endif
 
   /*Notify UMAC*/
   wdiFinishScanRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessFinishScanRsp*/
 
 /**
  @brief Process Join Response function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessJoinRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -14029,22 +14476,24 @@
   WDI_Status                    wdiStatus;
   WDI_JoinRspCb                 wdiJoinRspCb;
   WDI_BSSSessionType*           pBSSSes             = NULL;
-
-  tHalJoinRspMsg                halJoinRspMsg;
+  
+  tHalJoinRspMsg                halJoinRspMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) ||
       ( NULL == pWDICtx->pfncRspCB ) ||
       ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiJoinRspCb = (WDI_JoinRspCb)pWDICtx->pfncRspCB;
@@ -14052,51 +14501,52 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halJoinRspMsg.joinRspParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halJoinRspMsg.joinRspParams, 
+                  pEventData->pEventData, 
                   sizeof(halJoinRspMsg.joinRspParams));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halJoinRspMsg.joinRspParams.status);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halJoinRspMsg.joinRspParams.status); 
 
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*-----------------------------------------------------------------------
     Join response can only be received for an existing assoc that
-    is current and in progress
+    is current and in progress 
     -----------------------------------------------------------------------*/
-  if (( !WDI_VALID_SESSION_IDX(pWDICtx->ucCurrentBSSSesIdx )) ||
+  if (( !WDI_VALID_SESSION_IDX(pWDICtx->ucCurrentBSSSesIdx )) || 
       ( eWLAN_PAL_FALSE == pWDICtx->bAssociationInProgress ))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "%s: Association sequence for this BSS does not yet exist (bssIdx %d) or "
-              "association no longer in progress %d - mysterious HAL response",
-              __func__, pWDICtx->ucCurrentBSSSesIdx, pWDICtx->bAssociationInProgress);
-
-    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE);
+              "Association sequence for this BSS does not yet exist or "
+              "association no longer in progress - mysterious HAL response");
+#endif
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   pBSSSes = &pWDICtx->aBSSSessions[pWDICtx->ucCurrentBSSSesIdx];
 
   /*-----------------------------------------------------------------------
-    Join Response is only allowed in init state
+    Join Response is only allowed in init state 
   -----------------------------------------------------------------------*/
   if ( WDI_ASSOC_JOINING_ST != pBSSSes->wdiAssocState)
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Join only allowed in Joining state - failure state is %d "
               "strange HAL response", pBSSSes->wdiAssocState);
-
-    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE);
-
+#endif
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+    
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
 
   /*-----------------------------------------------------------------------
-    If assoc has failed the current session will be deleted
+    If assoc has failed the current session will be deleted 
   -----------------------------------------------------------------------*/
   if ( WDI_STATUS_SUCCESS != wdiStatus )
   {
@@ -14108,13 +14558,13 @@
 
     /*Association no longer in progress - prepare pending assoc for processing*/
     WDI_DequeueAssocRequest(pWDICtx);
-
+  
   }
   else
   {
     /*Transition to state Joining - this may be redundant as we are supposed
       to be in this state already - but just to be safe*/
-    pBSSSes->wdiAssocState = WDI_ASSOC_JOINING_ST;
+    pBSSSes->wdiAssocState = WDI_ASSOC_JOINING_ST; 
   }
 
   wpalMutexRelease(&pWDICtx->wptMutex);
@@ -14122,182 +14572,186 @@
   /*Notify UMAC*/
   wdiJoinRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessJoinRsp*/
 
 
 /**
- @brief Process Config BSS Response function (called when a
+ @brief Process Config BSS Response function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessConfigBSSRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_ConfigBSSRspParamsType    wdiConfigBSSParams;
   WDI_ConfigBSSRspCb            wdiConfigBSSRspCb;
-  wpt_uint8                     ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                     ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*           pBSSSes             = NULL;
 
-  tConfigBssRspMsg              halConfigBssRspMsg;
+  tConfigBssRspMsg              halConfigBssRspMsg; 
   WDI_AddStaParams              wdiBcastAddSTAParam = {0};
   WDI_AddStaParams              wdiAddSTAParam = {0};
-
+  
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiConfigBSSRspCb = (WDI_ConfigBSSRspCb)pWDICtx->pfncRspCB;
 
   /*-------------------------------------------------------------------------
-    Extract response and send it to UMAC
+    Extract response and send it to UMAC 
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halConfigBssRspMsg.configBssRspParams,
-                   pEventData->pEventData,
+  wpalMemoryCopy( &halConfigBssRspMsg.configBssRspParams, 
+                   pEventData->pEventData, 
                    sizeof(halConfigBssRspMsg.configBssRspParams));
 
   wdiConfigBSSParams.wdiStatus = WDI_HAL_2_WDI_STATUS(
                             halConfigBssRspMsg.configBssRspParams.status);
   if(WDI_STATUS_SUCCESS == wdiConfigBSSParams.wdiStatus)
   {
-    wpalMemoryCopy( wdiConfigBSSParams.macBSSID,
+    wpalMemoryCopy( wdiConfigBSSParams.macBSSID, 
                     pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.macBSSID,
                     WDI_MAC_ADDR_LEN);
-
+  
     wdiConfigBSSParams.ucBSSIdx = halConfigBssRspMsg.configBssRspParams.bssIdx;
-
-    wdiConfigBSSParams.ucBcastSig =
+  
+    wdiConfigBSSParams.ucBcastSig = 
        halConfigBssRspMsg.configBssRspParams.bcastDpuSignature;
-
-    wdiConfigBSSParams.ucUcastSig =
+  
+    wdiConfigBSSParams.ucUcastSig = 
        halConfigBssRspMsg.configBssRspParams.ucastDpuSignature;
-
+  
     wdiConfigBSSParams.ucSTAIdx = halConfigBssRspMsg.configBssRspParams.bssStaIdx;
-
+  
   #ifdef WLAN_FEATURE_VOWIFI
-    wdiConfigBSSParams.ucTxMgmtPower =
+    wdiConfigBSSParams.ucTxMgmtPower = 
                                halConfigBssRspMsg.configBssRspParams.txMgmtPower;
   #endif
      wpalMemoryCopy( wdiConfigBSSParams.macSTA,
                      halConfigBssRspMsg.configBssRspParams.staMac,
                      WDI_MAC_ADDR_LEN );
-
+  
     wpalMutexAcquire(&pWDICtx->wptMutex);
     /*------------------------------------------------------------------------
-      Find the BSS for which the request is made
+      Find the BSS for which the request is made 
     ------------------------------------------------------------------------*/
-    ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                                               wdiConfigBSSParams.macBSSID,
-                                              &pBSSSes);
-
+    ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                                               wdiConfigBSSParams.macBSSID, 
+                                              &pBSSSes); 
+  
     /*-----------------------------------------------------------------------
       Config BSS response can only be received for an existing assoc that
-      is current and in progress
+      is current and in progress 
       -----------------------------------------------------------------------*/
     if ( NULL == pBSSSes )
     {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "Association sequence for this BSS does not yet exist "
                 "- mysterious HAL response");
-
-      WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE);
-
+#endif
+      WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+      
       wpalMutexRelease(&pWDICtx->wptMutex);
-      return WDI_STATUS_E_NOT_ALLOWED;
+      return WDI_STATUS_E_NOT_ALLOWED; 
     }
-
+  
     /*Save data for this BSS*/
     pBSSSes->wdiBssType = pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiBSSType;
     pBSSSes->ucBSSIdx = halConfigBssRspMsg.configBssRspParams.bssIdx;
-    pBSSSes->bcastDpuIndex     =
+    pBSSSes->bcastDpuIndex     = 
       halConfigBssRspMsg.configBssRspParams.bcastDpuDescIndx;
-    pBSSSes->bcastDpuSignature =
+    pBSSSes->bcastDpuSignature = 
       halConfigBssRspMsg.configBssRspParams.bcastDpuSignature;
-    pBSSSes->bcastMgmtDpuIndex =
+    pBSSSes->bcastMgmtDpuIndex = 
       halConfigBssRspMsg.configBssRspParams.mgmtDpuDescIndx;
-    pBSSSes->bcastMgmtDpuSignature =
+    pBSSSes->bcastMgmtDpuSignature = 
       halConfigBssRspMsg.configBssRspParams.mgmtDpuSignature;
-    pBSSSes->ucRmfEnabled      =
+    pBSSSes->ucRmfEnabled      = 
       pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.ucRMFEnabled;
     pBSSSes->bcastStaIdx =
        halConfigBssRspMsg.configBssRspParams.bssBcastStaIdx;
-
+  
     /* !TO DO: Shuould we be updating the RMF Capability of self STA here? */
-
+  
     /*-------------------------------------------------------------------------
         Add Peer STA
       -------------------------------------------------------------------------*/
-    wdiAddSTAParam.ucSTAIdx = halConfigBssRspMsg.configBssRspParams.bssStaIdx;
+    wdiAddSTAParam.ucSTAIdx = halConfigBssRspMsg.configBssRspParams.bssStaIdx; 
     wdiAddSTAParam.dpuIndex = halConfigBssRspMsg.configBssRspParams.dpuDescIndx;
     wdiAddSTAParam.dpuSig   = halConfigBssRspMsg.configBssRspParams.ucastDpuSignature;
-
+     
      /*This info can be retrieved from the cached initial request*/
-    wdiAddSTAParam.ucWmmEnabled =
+    wdiAddSTAParam.ucWmmEnabled = 
         pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiSTAContext.ucWMMEnabled;
-    wdiAddSTAParam.ucHTCapable  =
-        pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiSTAContext.ucHTCapable;
-    wdiAddSTAParam.ucStaType    =
-        pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiSTAContext.wdiSTAType;
-
+    wdiAddSTAParam.ucHTCapable  = 
+        pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiSTAContext.ucHTCapable; 
+    wdiAddSTAParam.ucStaType    = 
+        pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiSTAContext.wdiSTAType;  
+  
      /* MAC Address of STA */
-    wpalMemoryCopy(wdiAddSTAParam.staMacAddr,
-                   halConfigBssRspMsg.configBssRspParams.staMac,
+    wpalMemoryCopy(wdiAddSTAParam.staMacAddr, 
+                   halConfigBssRspMsg.configBssRspParams.staMac, 
                    WDI_MAC_ADDR_LEN);
-
-    wpalMemoryCopy(wdiAddSTAParam.macBSSID,
-                   pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiSTAContext.macBSSID ,
-                   WDI_MAC_ADDR_LEN);
-
+  
+    wpalMemoryCopy(wdiAddSTAParam.macBSSID, 
+                   pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.wdiSTAContext.macBSSID , 
+                   WDI_MAC_ADDR_LEN); 
+     
     /*Add BSS specific parameters*/
-    wdiAddSTAParam.bcastMgmtDpuIndex     =
+    wdiAddSTAParam.bcastMgmtDpuIndex     = 
         halConfigBssRspMsg.configBssRspParams.mgmtDpuDescIndx;
-    wdiAddSTAParam.bcastMgmtDpuSignature =
+    wdiAddSTAParam.bcastMgmtDpuSignature = 
         halConfigBssRspMsg.configBssRspParams.mgmtDpuSignature;
-    wdiAddSTAParam.bcastDpuIndex         =
+    wdiAddSTAParam.bcastDpuIndex         = 
         halConfigBssRspMsg.configBssRspParams.bcastDpuDescIndx;
-    wdiAddSTAParam.bcastDpuSignature     =
+    wdiAddSTAParam.bcastDpuSignature     = 
         halConfigBssRspMsg.configBssRspParams.bcastDpuSignature;
-    wdiAddSTAParam.ucRmfEnabled          =
+    wdiAddSTAParam.ucRmfEnabled          =  
         pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.ucRMFEnabled;
-    wdiAddSTAParam.ucBSSIdx =
+    wdiAddSTAParam.ucBSSIdx = 
        halConfigBssRspMsg.configBssRspParams.bssIdx;
-
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                 "Add STA to the table index: %d", wdiAddSTAParam.ucSTAIdx );
-
+#endif
     WDI_STATableAddSta(pWDICtx,&wdiAddSTAParam);
     /*-------------------------------------------------------------------------
         Add Broadcast STA only in AP mode
       -------------------------------------------------------------------------*/
-    if( pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.ucOperMode ==
+    if( pWDICtx->wdiCachedConfigBssReq.wdiReqInfo.ucOperMode == 
         WDI_BSS_OPERATIONAL_MODE_AP )
     {
+#ifdef WLAN_DEBUG
        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                   "Add BCAST STA to table for index: %d",
                   halConfigBssRspMsg.configBssRspParams.bssBcastStaIdx );
-
-       wpalMemoryCopy( &wdiBcastAddSTAParam, &wdiAddSTAParam,
+#endif
+       wpalMemoryCopy( &wdiBcastAddSTAParam, &wdiAddSTAParam, 
                        sizeof(WDI_AddStaParams) );
-
+  
        WDI_AddBcastSTAtoSTATable( pWDICtx, &wdiBcastAddSTAParam,
                                   halConfigBssRspMsg.configBssRspParams.bssBcastStaIdx );
     }
@@ -14305,13 +14759,13 @@
   }
   else
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "Config BSS RSP failed with status : %s(%d)",
                   WDI_getHALStatusMsgString(
-                  halConfigBssRspMsg.configBssRspParams.status),
+                  halConfigBssRspMsg.configBssRspParams.status), 
                   halConfigBssRspMsg.configBssRspParams.status);
-
-
+#endif
     /*Association was failed by HAL - remove session*/
     WDI_DeleteSession(pWDICtx, pBSSSes);
 
@@ -14326,148 +14780,152 @@
   /*Notify UMAC*/
   wdiConfigBSSRspCb( &wdiConfigBSSParams, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessConfigBSSRsp*/
 
 
 /**
  @brief Process Del BSS Response function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessDelBSSRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_DelBSSRspParamsType       wdiDelBSSParams;
   WDI_DelBSSRspCb               wdiDelBSSRspCb;
-  wpt_uint8                     ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                     ucCurrentBSSSesIdx  = 0; 
   WDI_BSSSessionType*           pBSSSes             = NULL;
 
-  tDeleteBssRspMsg              halDelBssRspMsg;
+  tDeleteBssRspMsg              halDelBssRspMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiDelBSSRspCb = (WDI_DelBSSRspCb)pWDICtx->pfncRspCB;
 
   /*-------------------------------------------------------------------------
-    Extract response and send it to UMAC
+    Extract response and send it to UMAC 
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halDelBssRspMsg.deleteBssRspParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halDelBssRspMsg.deleteBssRspParams, 
+                  pEventData->pEventData, 
                   sizeof(halDelBssRspMsg.deleteBssRspParams));
 
 
   wdiDelBSSParams.wdiStatus   =   WDI_HAL_2_WDI_STATUS(
-                                 halDelBssRspMsg.deleteBssRspParams.status);
+                                 halDelBssRspMsg.deleteBssRspParams.status); 
 
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx,
-                             halDelBssRspMsg.deleteBssRspParams.bssIdx,
-                             &pBSSSes);
+  ucCurrentBSSSesIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx, 
+                             halDelBssRspMsg.deleteBssRspParams.bssIdx, 
+                             &pBSSSes); 
 
   /*-----------------------------------------------------------------------
     Del BSS response can only be received for an existing assoc that
-    is current and in progress
+    is current and in progress 
     -----------------------------------------------------------------------*/
   if ( NULL == pBSSSes )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Association sequence for this BSS does not yet exist or "
               "association no longer in progress - mysterious HAL response");
-
-    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE);
-
+#endif
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+    
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*Extract BSSID for the response to UMAC*/
-  wpalMemoryCopy(wdiDelBSSParams.macBSSID,
+  wpalMemoryCopy(wdiDelBSSParams.macBSSID, 
                  pBSSSes->macBSSID, WDI_MAC_ADDR_LEN);
 
   wdiDelBSSParams.ucBssIdx = halDelBssRspMsg.deleteBssRspParams.bssIdx;
 
   /*-----------------------------------------------------------------------
-    The current session will be deleted
+    The current session will be deleted 
   -----------------------------------------------------------------------*/
   WDI_DeleteSession(pWDICtx, pBSSSes);
 
-
   /* Delete the BCAST STA entry from the STA table if SAP/GO session is deleted */
   if(WDI_INFRA_AP_MODE == pBSSSes->wdiBssType)
   {
     (void)WDI_STATableDelSta( pWDICtx, pBSSSes->bcastStaIdx );
   }
-
+  
    /* Delete the STA's in this BSS */
   WDI_STATableBSSDelSta(pWDICtx, halDelBssRspMsg.deleteBssRspParams.bssIdx);
-
+  
   wpalMutexRelease(&pWDICtx->wptMutex);
 
   /*Notify UMAC*/
   wdiDelBSSRspCb( &wdiDelBSSParams, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessDelBSSRsp*/
 
 /**
  @brief Process Post Assoc Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessPostAssocRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_PostAssocRspParamsType    wdiPostAssocParams;
   WDI_PostAssocRspCb            wdiPostAssocRspCb;
-  wpt_uint8                     ucCurrentBSSSesIdx     = 0;
+  wpt_uint8                     ucCurrentBSSSesIdx     = 0; 
   WDI_BSSSessionType*           pBSSSes                = NULL;
-  tPostAssocRspMsg              halPostAssocRspMsg;
+  tPostAssocRspMsg              halPostAssocRspMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiPostAssocRspCb = (WDI_PostAssocRspCb)pWDICtx->pfncRspCB;
@@ -14475,96 +14933,98 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halPostAssocRspMsg.postAssocRspParams,
-                   pEventData->pEventData,
+  wpalMemoryCopy( &halPostAssocRspMsg.postAssocRspParams, 
+                   pEventData->pEventData, 
                    sizeof(halPostAssocRspMsg.postAssocRspParams));
 
   /*Extract the Post Assoc STA Params */
 
-  wdiPostAssocParams.staParams.ucSTAIdx   =
+  wdiPostAssocParams.staParams.ucSTAIdx   = 
     halPostAssocRspMsg.postAssocRspParams.configStaRspParams.staIdx;
-  wdiPostAssocParams.staParams.ucUcastSig =
+  wdiPostAssocParams.staParams.ucUcastSig = 
     halPostAssocRspMsg.postAssocRspParams.configStaRspParams.ucUcastSig;
-  wdiPostAssocParams.staParams.ucBcastSig =
+  wdiPostAssocParams.staParams.ucBcastSig = 
     halPostAssocRspMsg.postAssocRspParams.configStaRspParams.ucBcastSig;
 
- wdiPostAssocParams.wdiStatus =
-    WDI_HAL_2_WDI_STATUS(halPostAssocRspMsg.postAssocRspParams.configStaRspParams.status);
+ wdiPostAssocParams.wdiStatus = 
+    WDI_HAL_2_WDI_STATUS(halPostAssocRspMsg.postAssocRspParams.configStaRspParams.status); 
 
  /*Copy the MAC addresses from the cached storage in the WDI CB as they are not
    included in the response */
-  wpalMemoryCopy( wdiPostAssocParams.staParams.macSTA,
-                  pWDICtx->wdiCachedPostAssocReq.wdiSTAParams.macSTA,
+  wpalMemoryCopy( wdiPostAssocParams.staParams.macSTA, 
+                  pWDICtx->wdiCachedPostAssocReq.wdiSTAParams.macSTA, 
                   WDI_MAC_ADDR_LEN);
 
   /* Extract Post Assoc BSS Params */
 
-  wpalMemoryCopy( wdiPostAssocParams.bssParams.macBSSID,
-                  pWDICtx->wdiCachedPostAssocReq.wdiBSSParams.macBSSID,
-                  WDI_MAC_ADDR_LEN);
+  wpalMemoryCopy( wdiPostAssocParams.bssParams.macBSSID, 
+                  pWDICtx->wdiCachedPostAssocReq.wdiBSSParams.macBSSID, 
+                  WDI_MAC_ADDR_LEN); 
 
   /*Copy the MAC addresses from the cached storage in the WDI CB as they are not
    included in the response */
-  wpalMemoryCopy( wdiPostAssocParams.bssParams.macSTA,
+  wpalMemoryCopy( wdiPostAssocParams.bssParams.macSTA, 
                   pWDICtx->wdiCachedPostAssocReq.wdiBSSParams.wdiSTAContext
                   .macSTA, WDI_MAC_ADDR_LEN);
 
-  wdiPostAssocParams.bssParams.ucBcastSig =
+  wdiPostAssocParams.bssParams.ucBcastSig = 
      halPostAssocRspMsg.postAssocRspParams.configStaRspParams.ucBcastSig;
 
-  wdiPostAssocParams.bssParams.ucUcastSig =
+  wdiPostAssocParams.bssParams.ucUcastSig = 
      halPostAssocRspMsg.postAssocRspParams.configStaRspParams.ucUcastSig;
 
   wdiPostAssocParams.bssParams.ucBSSIdx =
      halPostAssocRspMsg.postAssocRspParams.configBssRspParams.bssIdx;
 
-  wdiPostAssocParams.bssParams.ucSTAIdx =
+  wdiPostAssocParams.bssParams.ucSTAIdx = 
      halPostAssocRspMsg.postAssocRspParams.configBssRspParams.bssStaIdx;
 
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   /*------------------------------------------------------------------------
-    Find the BSS for which the request is made
+    Find the BSS for which the request is made 
   ------------------------------------------------------------------------*/
-  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
+  ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
                                              wdiPostAssocParams.bssParams.
-                                             macBSSID, &pBSSSes);
+                                             macBSSID, &pBSSSes); 
 
   /*-----------------------------------------------------------------------
     Post assoc response can only be received for an existing assoc that
-    is current and in progress
+    is current and in progress 
     -----------------------------------------------------------------------*/
   if (( NULL == pBSSSes ) ||
-      ( ucCurrentBSSSesIdx != pWDICtx->ucCurrentBSSSesIdx ) ||
+      ( ucCurrentBSSSesIdx != pWDICtx->ucCurrentBSSSesIdx ) || 
       ( eWLAN_PAL_FALSE == pWDICtx->bAssociationInProgress ))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Association sequence for this BSS does not yet exist or "
               "association no longer in progress - mysterious HAL response");
-
-    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE);
-
+#endif
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+    
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*-----------------------------------------------------------------------
-    Post Assoc Request is only allowed in Joining state
+    Post Assoc Request is only allowed in Joining state 
   -----------------------------------------------------------------------*/
   if ( WDI_ASSOC_JOINING_ST != pBSSSes->wdiAssocState)
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Post Assoc not allowed before JOIN - failing request "
               "strange HAL response");
-
-    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE);
-
+#endif
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+    
     wpalMutexRelease(&pWDICtx->wptMutex);
-    return WDI_STATUS_E_NOT_ALLOWED;
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
   /*-----------------------------------------------------------------------
-    If assoc has failed the current session will be deleted
+    If assoc has failed the current session will be deleted 
   -----------------------------------------------------------------------*/
   if ( WDI_STATUS_SUCCESS != wdiPostAssocParams.wdiStatus )
   {
@@ -14574,19 +15034,19 @@
   else
   {
     /*Transition to state POST Assoc*/
-    pBSSSes->wdiAssocState = WDI_ASSOC_POST_ST;
+    pBSSSes->wdiAssocState = WDI_ASSOC_POST_ST; 
 
     /*Save DPU Info*/
-    pBSSSes->bcastMgmtDpuIndex     =
+    pBSSSes->bcastMgmtDpuIndex     = 
       halPostAssocRspMsg.postAssocRspParams.configBssRspParams.mgmtDpuDescIndx;
-    pBSSSes->bcastMgmtDpuSignature =
+    pBSSSes->bcastMgmtDpuSignature = 
       halPostAssocRspMsg.postAssocRspParams.configBssRspParams.mgmtDpuSignature;
-    pBSSSes->bcastDpuIndex         =
+    pBSSSes->bcastDpuIndex         = 
       halPostAssocRspMsg.postAssocRspParams.configBssRspParams.bcastDpuDescIndx;
-    pBSSSes->bcastDpuSignature     =
+    pBSSSes->bcastDpuSignature     = 
       halPostAssocRspMsg.postAssocRspParams.configBssRspParams.bcastDpuSignature;
 
-    pBSSSes->ucBSSIdx              =
+    pBSSSes->ucBSSIdx              = 
       halPostAssocRspMsg.postAssocRspParams.configBssRspParams.bssIdx;
   }
 
@@ -14601,22 +15061,22 @@
   /*Notify UMAC*/
   wdiPostAssocRspCb( &wdiPostAssocParams, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessPostAssocRsp*/
 
 /**
- @brief Process Del STA Rsp function (called when a response is
+ @brief Process Del STA Rsp function (called when a response is 
         being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessDelSTARsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -14624,19 +15084,21 @@
   WDI_DelSTARspParamsType   wdiDelSTARsp;
   WDI_DelSTARspCb           wdiDelSTARspCb;
   wpt_uint8                 staType;
-  tDeleteStaRspMsg          halDelStaRspMsg;
+  tDeleteStaRspMsg          halDelStaRspMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiDelSTARspCb = (WDI_DelSTARspCb)pWDICtx->pfncRspCB;
@@ -14645,12 +15107,12 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   wpalMemoryCopy( &halDelStaRspMsg.delStaRspParams,
-                  pEventData->pEventData,
+                  pEventData->pEventData, 
                   sizeof(halDelStaRspMsg.delStaRspParams));
 
   wdiDelSTARsp.ucSTAIdx    = halDelStaRspMsg.delStaRspParams.staId;
-  wdiDelSTARsp.wdiStatus   =
-    WDI_HAL_2_WDI_STATUS(halDelStaRspMsg.delStaRspParams.status);
+  wdiDelSTARsp.wdiStatus   =   
+    WDI_HAL_2_WDI_STATUS(halDelStaRspMsg.delStaRspParams.status); 
 
   WDI_STATableGetStaType(pWDICtx, wdiDelSTARsp.ucSTAIdx, &staType);
 
@@ -14675,8 +15137,6 @@
     pSTATable[wdiDelSTARsp.ucSTAIdx].bcastDpuSignature = WDI_DPU_SELF_STA_DEFAULT_SIG;
     pSTATable[wdiDelSTARsp.ucSTAIdx].bcastMgmtDpuSignature = WDI_DPU_SELF_STA_DEFAULT_SIG;
     pSTATable[wdiDelSTARsp.ucSTAIdx].dpuSig = WDI_DPU_SELF_STA_DEFAULT_SIG;
-
-    pSTATable[wdiDelSTARsp.ucSTAIdx].bssIdx = WDI_BSS_INVALID_IDX;
   }
   else
   {
@@ -14687,27 +15147,27 @@
   /*Notify UMAC*/
   wdiDelSTARspCb( &wdiDelSTARsp, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessDelSTARsp*/
 
 
 /*==========================================================================
-                   Security Response Processing Functions
+                   Security Response Processing Functions 
 ==========================================================================*/
 
 /**
  @brief Process Set BSS Key Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetBssKeyRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -14718,15 +15178,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiSetBSSKeyRspCb = (WDI_SetBSSKeyRspCb)pWDICtx->pfncRspCB;
@@ -14735,8 +15197,9 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
+#ifdef WLAN_DEBUG
   if ( eHAL_STATUS_SUCCESS != halStatus )
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -14745,26 +15208,26 @@
               halStatus);
      /* send the status to UMAC, don't return from here*/
   }
-
+#endif
   /*Notify UMAC*/
   wdiSetBSSKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetBssKeyRsp*/
 
 /**
  @brief Process Remove BSS Key Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessRemoveBssKeyRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -14775,15 +15238,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiRemoveBSSKeyRspCb = (WDI_RemoveBSSKeyRspCb)pWDICtx->pfncRspCB;
@@ -14792,8 +15257,9 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
+#ifdef WLAN_DEBUG
   if ( eHAL_STATUS_SUCCESS != halStatus )
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -14802,27 +15268,27 @@
               halStatus);
      /* send the status to UMAC, don't return from here*/
   }
-
+#endif
   /*Notify UMAC*/
   wdiRemoveBSSKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetBssKeyRsp*/
 
 
 /**
  @brief Process Set STA Key Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetStaKeyRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -14833,15 +15299,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiSetSTAKeyRspCb = (WDI_SetSTAKeyRspCb)pWDICtx->pfncRspCB;
@@ -14850,8 +15318,9 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
+#ifdef WLAN_DEBUG
   if ( eHAL_STATUS_SUCCESS != halStatus )
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -14860,26 +15329,26 @@
               halStatus);
      /* send the status to UMAC, don't return from here*/
   }
-
+#endif
   /*Notify UMAC*/
   wdiSetSTAKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetSTAKeyRsp*/
 
 /**
- @brief Process Remove STA Key Rsp function (called when a
+ @brief Process Remove STA Key Rsp function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessRemoveStaKeyRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -14890,15 +15359,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiRemoveSTAKeyRspCb = (WDI_RemoveSTAKeyRspCb)pWDICtx->pfncRspCB;
@@ -14907,8 +15378,9 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
+#ifdef WLAN_DEBUG
   if ( eHAL_STATUS_SUCCESS != halStatus )
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -14917,26 +15389,26 @@
               halStatus);
      /* send the status to UMAC, don't return from here*/
   }
-
+#endif
   /*Notify UMAC*/
   wdiRemoveSTAKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessRemoveStaKeyRsp*/
 
 /**
- @brief Process Set STA Bcast Key Rsp function (called when a
+ @brief Process Set STA Bcast Key Rsp function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetStaBcastKeyRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -14947,15 +15419,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiSetSTABcastKeyRspCb = (WDI_SetSTAKeyRspCb)pWDICtx->pfncRspCB;
@@ -14963,12 +15437,13 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halStatus,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
                   sizeof(halStatus));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
+#ifdef WLAN_DEBUG
   if ( eHAL_STATUS_SUCCESS != halStatus )
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -14977,26 +15452,26 @@
               halStatus);
      /* send the status to UMAC, don't return from here*/
   }
-
+#endif
   /*Notify UMAC*/
   wdiSetSTABcastKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetSTABcastKeyRsp*/
 
 /**
  @brief Process Remove STA Bcast Key Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessRemoveStaBcastKeyRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15007,15 +15482,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiRemoveSTABcastKeyRspCb = (WDI_RemoveSTAKeyRspCb)pWDICtx->pfncRspCB;
@@ -15023,12 +15500,13 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halStatus,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
                   sizeof(halStatus));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
+#ifdef WLAN_DEBUG
   if ( eHAL_STATUS_SUCCESS != halStatus )
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
@@ -15037,31 +15515,31 @@
               halStatus);
      /* send the status to UMAC, don't return from here*/
   }
-
+#endif
   /*Notify UMAC*/
   wdiRemoveSTABcastKeyRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessRemoveStaBcastKeyRsp*/
 
 
 /*==========================================================================
-                   QoS and BA Response Processing Functions
+                   QoS and BA Response Processing Functions 
 ==========================================================================*/
 
 /**
  @brief Process Add TSpec Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessAddTSpecRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15072,15 +15550,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiAddTsRspCb = (WDI_AddTsRspCb)pWDICtx->pfncRspCB;
@@ -15089,28 +15569,28 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiAddTsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessAddTSpecRsp*/
 
 
 /**
  @brief Process Del TSpec Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessDelTSpecRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15121,15 +15601,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiDelTsRspCb = (WDI_DelTsRspCb)pWDICtx->pfncRspCB;
@@ -15138,27 +15620,27 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiDelTsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessDelTSpecRsp*/
 
 /**
- @brief Process Update EDCA Parameters Rsp function (called when a
+ @brief Process Update EDCA Parameters Rsp function (called when a  
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateEDCAParamsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15169,15 +15651,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiUpdateEDCAParamsRspCb = (WDI_UpdateEDCAParamsRspCb)pWDICtx->pfncRspCB;
@@ -15186,28 +15670,28 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiUpdateEDCAParamsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessUpdateEDCAParamsRsp*/
 
 
 /**
  @brief Process Add BA Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessAddBASessionRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15217,19 +15701,21 @@
   tAddBASessionRspParams        halBASessionRsp;
   WDI_AddBASessionRspParamsType wdiBASessionRsp;
 
-
+  
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiAddBASessionRspCb = (WDI_AddBASessionRspCb)pWDICtx->pfncRspCB;
@@ -15237,8 +15723,8 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halBASessionRsp,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halBASessionRsp, 
+                  pEventData->pEventData, 
                   sizeof(halBASessionRsp));
 
   wdiBASessionRsp.wdiStatus = WDI_HAL_2_WDI_STATUS(halBASessionRsp.status);
@@ -15257,23 +15743,23 @@
   /*Notify UMAC*/
   wdiAddBASessionRspCb( &wdiBASessionRsp, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessAddSessionBARsp*/
 
 
 /**
  @brief Process Del BA Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessDelBARsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15284,15 +15770,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiDelBARspCb = (WDI_DelBARspCb)pWDICtx->pfncRspCB;
@@ -15301,7 +15789,7 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   if ( eHAL_STATUS_SUCCESS == halStatus )
   {
@@ -15311,52 +15799,54 @@
   /*Notify UMAC*/
   wdiDelBARspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessDelBARsp*/
 
 #ifdef FEATURE_WLAN_CCX
 /**
  @brief Process TSM Stats Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessTsmStatsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_TsmRspCb          wdiTsmStatsRspCb;
-  tTsmStatsRspMsg       halTsmStatsRspMsg;
+  tTsmStatsRspMsg       halTsmStatsRspMsg; 
   WDI_TSMStatsRspParamsType  wdiTsmStatsRspParams;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiTsmStatsRspCb = (WDI_TsmRspCb)pWDICtx->pfncRspCB;
 
   /*-------------------------------------------------------------------------
     Unpack HAL Response Message - the header was already extracted by the
-    main Response Handling procedure
+    main Response Handling procedure 
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halTsmStatsRspMsg.tsmStatsRspParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halTsmStatsRspMsg.tsmStatsRspParams, 
+                  pEventData->pEventData, 
                   sizeof(halTsmStatsRspMsg.tsmStatsRspParams));
 
   wdiTsmStatsRspParams.UplinkPktQueueDly = halTsmStatsRspMsg.tsmStatsRspParams.UplinkPktQueueDly;
@@ -15375,7 +15865,7 @@
   /*Notify UMAC*/
   wdiTsmStatsRspCb( &wdiTsmStatsRspParams, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessTsmStatsRsp*/
 
 #endif
@@ -15385,16 +15875,16 @@
 /**
  @brief Process Flush AC Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessFlushAcRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15405,15 +15895,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiFlushAcRspCb = (WDI_FlushAcRspCb)pWDICtx->pfncRspCB;
@@ -15421,31 +15913,31 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halStatus,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
                   sizeof(halStatus));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiFlushAcRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessFlushAcRsp*/
 
 /**
- @brief Process BT AMP event Rsp function (called when a
+ @brief Process BT AMP event Rsp function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessBtAmpEventRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15456,15 +15948,17 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiBtAmpEventRspCb = (WDI_BtAmpEventRspCb)pWDICtx->pfncRspCB;
@@ -15472,32 +15966,32 @@
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
-   wpalMemoryCopy( &halStatus,
-                   pEventData->pEventData,
+   wpalMemoryCopy( &halStatus, 
+                   pEventData->pEventData, 
                    sizeof(halStatus));
 
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiBtAmpEventRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessBtAmpEventRsp*/
 
 
 /**
- @brief Process ADD STA SELF Rsp function (called
+ @brief Process ADD STA SELF Rsp function (called 
         when a response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessAddSTASelfRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15509,36 +16003,38 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  wdiAddSTASelfReqParamsRspCb =
+  wdiAddSTASelfReqParamsRspCb = 
                          (WDI_AddSTASelfParamsRspCb)pWDICtx->pfncRspCB;
 
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halAddStaSelfRsp.addStaSelfRspParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halAddStaSelfRsp.addStaSelfRspParams, 
+                  pEventData->pEventData, 
                   sizeof(halAddStaSelfRsp.addStaSelfRspParams));
 
 
-  wdiAddSTASelfParams.wdiStatus   =
-    WDI_HAL_2_WDI_STATUS(halAddStaSelfRsp.addStaSelfRspParams.status);
+  wdiAddSTASelfParams.wdiStatus   =   
+    WDI_HAL_2_WDI_STATUS(halAddStaSelfRsp.addStaSelfRspParams.status); 
 
-  wdiAddSTASelfParams.ucSTASelfIdx   =
+  wdiAddSTASelfParams.ucSTASelfIdx   = 
     halAddStaSelfRsp.addStaSelfRspParams.selfStaIdx;
-  wdiAddSTASelfParams.dpuIdx =
+  wdiAddSTASelfParams.dpuIdx = 
     halAddStaSelfRsp.addStaSelfRspParams.dpuIdx;
-  wdiAddSTASelfParams.dpuSignature =
+  wdiAddSTASelfParams.dpuSignature = 
     halAddStaSelfRsp.addStaSelfRspParams.dpuSignature;
 
   wpalMemoryCopy(wdiAddSTASelfParams.macSelfSta,
@@ -15557,7 +16053,7 @@
   //all DPU indices are the same for self STA
 
   /*DPU Information*/
-  wdiAddSTAParam.dpuIndex              = wdiAddSTASelfParams.dpuIdx;
+  wdiAddSTAParam.dpuIndex              = wdiAddSTASelfParams.dpuIdx; 
   wdiAddSTAParam.dpuSig                = wdiAddSTASelfParams.dpuSignature;
   wdiAddSTAParam.bcastDpuSignature     = wdiAddSTASelfParams.dpuSignature;
   wdiAddSTAParam.bcastMgmtDpuSignature = wdiAddSTASelfParams.dpuSignature;
@@ -15570,7 +16066,7 @@
   wdiAddSTAParam.ucStaType = WDI_STA_ENTRY_SELF; /* 0 - self */
   wdiAddSTAParam.ucSTAIdx = wdiAddSTASelfParams.ucSTASelfIdx;
 
-  if(halAddStaSelfRsp.addStaSelfRspParams.status
+  if(halAddStaSelfRsp.addStaSelfRspParams.status 
      != eHAL_STATUS_ADD_STA_SELF_IGNORED_REF_COUNT_NOT_ZERO)
   {
      (void)WDI_STATableAddSta(pWDICtx,&wdiAddSTAParam);
@@ -15580,24 +16076,24 @@
   /*Notify UMAC*/
   wdiAddSTASelfReqParamsRspCb( &wdiAddSTASelfParams, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessAddSTASelfRsp*/
 
 
 
 /**
- @brief WDI_ProcessDelSTASelfRsp function (called when a
+ @brief WDI_ProcessDelSTASelfRsp function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessDelSTASelfRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15610,15 +16106,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
     -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
     WDI_ASSERT(0);
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   wdiDelStaSelfRspCb = (WDI_DelSTASelfRspCb)pWDICtx->pfncRspCB;
@@ -15627,27 +16125,29 @@
     Extract response and send it to UMAC
     -------------------------------------------------------------------------*/
 
-  wpalMemoryCopy( &delStaSelfRspParams,
+  wpalMemoryCopy( &delStaSelfRspParams, 
                         (wpt_uint8*)pEventData->pEventData,
                               sizeof(tDelStaSelfRspParams));
 
-  wdiDelStaSelfRspParams.wdiStatus   =
-    WDI_HAL_2_WDI_STATUS(delStaSelfRspParams.status);
+  wdiDelStaSelfRspParams.wdiStatus   =   
+    WDI_HAL_2_WDI_STATUS(delStaSelfRspParams.status); 
 
-  /* delStaSelfRspParams.status is not
+  /* delStaSelfRspParams.status is not 
    eHAL_STATUS_DEL_STA_SELF_IGNORED_REF_COUNT_NOT_ZERO*/
   if( eHAL_STATUS_SUCCESS == delStaSelfRspParams.status )
   {
     WDI_Status wdiStatus;
-    wdiStatus = WDI_STATableFindStaidByAddr(pWDICtx,
+    wdiStatus = WDI_STATableFindStaidByAddr(pWDICtx, 
                                delStaSelfRspParams.selfMacAddr,
                                &ucStaIdx);
     if(WDI_STATUS_E_FAILURE == wdiStatus)
     {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Unable to extract the STA Idx ", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
     }
     WDI_STATableDelSta(pWDICtx, ucStaIdx);
   }
@@ -15660,12 +16160,12 @@
 
 #ifdef FEATURE_OEM_DATA_SUPPORT
 /**
- @brief Start Oem Data Rsp function (called when a
+ @brief Start Oem Data Rsp function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
@@ -15683,15 +16183,17 @@
   tStartOemDataRspParams*    halStartOemDataRspParams;
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiOemDataRspCb = (WDI_oemDataRspCb)pWDICtx->pfncRspCB;
@@ -15710,10 +16212,12 @@
 
   if(NULL == wdiOemDataRspParams)
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
             "Failed to allocate memory in OEM DATA Response %x %x %x ",
                 pWDICtx, pEventData, pEventData->pEventData);
     WDI_ASSERT(0);
+#endif
     return WDI_STATUS_E_FAILURE;
   }
 
@@ -15731,22 +16235,22 @@
 #endif
 
 /*===========================================================================
-           Miscellaneous Control Response Processing API
+           Miscellaneous Control Response Processing API 
 ===========================================================================*/
 
 /**
  @brief Process Channel Switch Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessChannelSwitchRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15757,15 +16261,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiChSwitchRspCb = (WDI_SwitchChRspCb)pWDICtx->pfncRspCB;
@@ -15773,38 +16279,38 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halSwitchChannelRsp,
+  wpalMemoryCopy( &halSwitchChannelRsp, 
                   (wpt_uint8*)pEventData->pEventData,
                   sizeof(halSwitchChannelRsp));
 
-  wdiSwitchChRsp.wdiStatus   =
-               WDI_HAL_2_WDI_STATUS(halSwitchChannelRsp.status);
+  wdiSwitchChRsp.wdiStatus   =  
+               WDI_HAL_2_WDI_STATUS(halSwitchChannelRsp.status); 
   wdiSwitchChRsp.ucChannel = halSwitchChannelRsp.channelNumber;
 
 #ifdef WLAN_FEATURE_VOWIFI
-  wdiSwitchChRsp.ucTxMgmtPower =  halSwitchChannelRsp.txMgmtPower;
+  wdiSwitchChRsp.ucTxMgmtPower =  halSwitchChannelRsp.txMgmtPower; 
 #endif
 
   /*Notify UMAC*/
   wdiChSwitchRspCb( &wdiSwitchChRsp, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessChannelSwitchRsp*/
 
 
 /**
  @brief Process Config STA Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessConfigStaRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15814,21 +16320,23 @@
   WDI_AddStaParams              wdiAddSTAParam;
 
   WDI_BSSSessionType*           pBSSSes             = NULL;
-  wpt_uint8                     ucCurrentBSSSesIdx  = 0;
+  wpt_uint8                     ucCurrentBSSSesIdx  = 0; 
 
-  tConfigStaRspMsg              halConfigStaRsp;
+  tConfigStaRspMsg              halConfigStaRsp; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiConfigSTARspCb = (WDI_ConfigSTARspCb)pWDICtx->pfncRspCB;
@@ -15836,8 +16344,8 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halConfigStaRsp.configStaRspParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halConfigStaRsp.configStaRspParams, 
+                  pEventData->pEventData, 
                   sizeof(halConfigStaRsp.configStaRspParams));
 
 
@@ -15850,11 +16358,11 @@
    /* MAC Address of STA - take from cache as it does not come back in the
    response*/
    wpalMemoryCopy( wdiCfgSTAParams.macSTA,
-          pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macSTA,
+          pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macSTA, 
           WDI_MAC_ADDR_LEN);
-
-  wdiCfgSTAParams.wdiStatus   =
-    WDI_HAL_2_WDI_STATUS(halConfigStaRsp.configStaRspParams.status);
+  
+  wdiCfgSTAParams.wdiStatus   =   
+    WDI_HAL_2_WDI_STATUS(halConfigStaRsp.configStaRspParams.status); 
 
   wdiCfgSTAParams.ucDpuIndex = halConfigStaRsp.configStaRspParams.dpuIndex;
   wdiCfgSTAParams.ucBcastDpuIndex = halConfigStaRsp.configStaRspParams.bcastDpuIndex;
@@ -15865,71 +16373,72 @@
     if ( WDI_ADD_STA == pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.wdiAction )
     {
       /* ADD STA to table */
-      wdiAddSTAParam.ucSTAIdx = halConfigStaRsp.configStaRspParams.staIdx;
+      wdiAddSTAParam.ucSTAIdx = halConfigStaRsp.configStaRspParams.staIdx; 
       wdiAddSTAParam.dpuSig   = halConfigStaRsp.configStaRspParams.ucUcastSig;
       wdiAddSTAParam.dpuIndex = halConfigStaRsp.configStaRspParams.dpuIndex;
-
+       
       /*This info can be retrieved from the cached initial request*/
-      wdiAddSTAParam.ucWmmEnabled =
+      wdiAddSTAParam.ucWmmEnabled = 
         pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.ucWMMEnabled;
-      wdiAddSTAParam.ucHTCapable  =
-        pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.ucHTCapable;
-      wdiAddSTAParam.ucStaType    =
-        pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.wdiSTAType;
-
+      wdiAddSTAParam.ucHTCapable  = 
+        pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.ucHTCapable; 
+      wdiAddSTAParam.ucStaType    = 
+        pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.wdiSTAType;  
+   
       /* MAC Address of STA */
-      wpalMemoryCopy(wdiAddSTAParam.staMacAddr,
-                     pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macSTA,
+      wpalMemoryCopy(wdiAddSTAParam.staMacAddr, 
+                     pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macSTA, 
                      WDI_MAC_ADDR_LEN);
-
-      wpalMemoryCopy(wdiAddSTAParam.macBSSID,
-                     pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macBSSID ,
-                     WDI_MAC_ADDR_LEN);
-
-      ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                    pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macBSSID,
-                    &pBSSSes);
+  
+      wpalMemoryCopy(wdiAddSTAParam.macBSSID, 
+                     pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macBSSID , 
+                     WDI_MAC_ADDR_LEN); 
+  
+      ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                    pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.macBSSID, 
+                    &pBSSSes);  
 
       if ( NULL == pBSSSes )
       {
+#ifdef WLAN_DEBUG
         WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "Association for this BSSID is not in place");
-
         WDI_ASSERT(0);
-        return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+        return WDI_STATUS_E_NOT_ALLOWED; 
       }
 
       /*Add BSS specific parameters*/
-      wdiAddSTAParam.bcastMgmtDpuIndex =
+      wdiAddSTAParam.bcastMgmtDpuIndex = 
          halConfigStaRsp.configStaRspParams.bcastMgmtDpuIdx;
-      wdiAddSTAParam.bcastMgmtDpuSignature =
+      wdiAddSTAParam.bcastMgmtDpuSignature = 
          halConfigStaRsp.configStaRspParams.ucMgmtSig;
-      wdiAddSTAParam.bcastDpuIndex  =
+      wdiAddSTAParam.bcastDpuIndex  = 
          halConfigStaRsp.configStaRspParams.bcastDpuIndex;
-      wdiAddSTAParam.bcastDpuSignature =
+      wdiAddSTAParam.bcastDpuSignature = 
          halConfigStaRsp.configStaRspParams.ucBcastSig;
       wdiAddSTAParam.ucRmfEnabled          = pBSSSes->ucRmfEnabled;
       wdiAddSTAParam.ucBSSIdx              = ucCurrentBSSSesIdx;
-
+      
       WDI_STATableAddSta(pWDICtx,&wdiAddSTAParam);
     }
     if( WDI_UPDATE_STA == pWDICtx->wdiCachedConfigStaReq.wdiReqInfo.wdiAction )
     {
        WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
 
-       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastDpuIndex =
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastDpuIndex = 
           halConfigStaRsp.configStaRspParams.bcastDpuIndex;
-       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastDpuSignature =
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastDpuSignature = 
           halConfigStaRsp.configStaRspParams.ucBcastSig;
-       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastMgmtDpuIndex =
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastMgmtDpuIndex = 
           halConfigStaRsp.configStaRspParams.bcastMgmtDpuIdx;
-       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastMgmtDpuSignature =
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bcastMgmtDpuSignature = 
           halConfigStaRsp.configStaRspParams.ucMgmtSig;
-       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bssIdx =
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].bssIdx = 
           halConfigStaRsp.configStaRspParams.bssIdx;
-       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].dpuIndex =
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].dpuIndex = 
           halConfigStaRsp.configStaRspParams.dpuIndex;
-       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].dpuSig =
+       pSTATable[halConfigStaRsp.configStaRspParams.staIdx].dpuSig = 
           halConfigStaRsp.configStaRspParams.ucUcastSig;
     }
   }
@@ -15937,23 +16446,23 @@
   /*Notify UMAC*/
   wdiConfigSTARspCb( &wdiCfgSTAParams, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessConfigStaRsp*/
 
 
 /**
- @brief Process Set Link State Rsp function (called when a
+ @brief Process Set Link State Rsp function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetLinkStateRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -15963,19 +16472,21 @@
   WDI_SetLinkStateRspCb   wdiSetLinkStateRspCb;
 
   WDI_BSSSessionType*     pBSSSes              = NULL;
-  wpt_uint8               ucCurrentBSSSesIdx   = 0;
+  wpt_uint8               ucCurrentBSSSesIdx   = 0; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiSetLinkStateRspCb = (WDI_SetLinkStateRspCb)pWDICtx->pfncRspCB;
@@ -15985,24 +16496,26 @@
   /*If the link is being transitioned to idle - the BSS is to be deleted
   - this type of ending a session is possible when UMAC has failed an
   - association session during Join*/
-  if ( WDI_LINK_IDLE_STATE ==
+  if ( WDI_LINK_IDLE_STATE == 
        pWDICtx->wdiCacheSetLinkStReq.wdiLinkInfo.wdiLinkState )
   {
     /*------------------------------------------------------------------------
-      Find the BSS for which the request is made
+      Find the BSS for which the request is made 
     ------------------------------------------------------------------------*/
-    ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                        pWDICtx->wdiCacheSetLinkStReq.wdiLinkInfo.macBSSID,
-                        &pBSSSes);
-
+    ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx, 
+                        pWDICtx->wdiCacheSetLinkStReq.wdiLinkInfo.macBSSID, 
+                        &pBSSSes); 
+  
     /*-----------------------------------------------------------------------
       Del BSS response can only be received for an existing assoc that
-      is current and in progress
+      is current and in progress 
       -----------------------------------------------------------------------*/
     if ( NULL == pBSSSes )
     {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                 "Set link response received outside association session");
+#endif
     }
     else
     {
@@ -16013,7 +16526,7 @@
          ( WDI_BTAMP_AP_MODE != pBSSSes->wdiBssType ))
       {
          /*-----------------------------------------------------------------------
-           The current session will be deleted
+           The current session will be deleted 
          -----------------------------------------------------------------------*/
          WDI_DeleteSession(pWDICtx, pBSSSes);
 
@@ -16022,7 +16535,7 @@
            flag as this has ended
          -----------------------------------------------------------------------*/
          if ( ucCurrentBSSSesIdx == pWDICtx->ucCurrentBSSSesIdx )
-         {
+         {  
            /*Association no longer in progress  */
            pWDICtx->bAssociationInProgress = eWLAN_PAL_FALSE;
            /*Association no longer in progress - prepare pending assoc for processing*/
@@ -16033,7 +16546,7 @@
   }
   /* If the link state has been set to POST ASSOC, reset the "association in
      progress" flag */
-  if ( WDI_LINK_POSTASSOC_STATE ==
+  if ( WDI_LINK_POSTASSOC_STATE == 
        pWDICtx->wdiCacheSetLinkStReq.wdiLinkInfo.wdiLinkState )
   {
      pWDICtx->bAssociationInProgress = eWLAN_PAL_FALSE;
@@ -16045,31 +16558,31 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halStatus,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
                   sizeof(halStatus));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiSetLinkStateRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetLinkStateRsp*/
 
 /**
- @brief Process Get Stats Rsp function (called when a response is
+ @brief Process Get Stats Rsp function (called when a response is   
         being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessGetStatsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16077,19 +16590,21 @@
   WDI_GetStatsRspParamsType   *wdiGetStatsRsp;
   WDI_GetStatsRspCb           wdiGetStatsRspCb;
   tHalStatsRspParams*         pHalStatsRspParams;
-
+  
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
@@ -16104,11 +16619,13 @@
 
   if(NULL == wdiGetStatsRsp)
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "Failed to allocate memory in Get Stats Response %x %x %x ",
                  pWDICtx, pEventData, pEventData->pEventData);
     WDI_ASSERT(0);
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   wdiGetStatsRspCb = (WDI_GetStatsRspCb)pWDICtx->pfncRspCB;
@@ -16130,23 +16647,23 @@
 
   wpalMemoryFree(wdiGetStatsRsp);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessGetStatsRsp*/
 
 
 /**
- @brief Process Update Cfg Rsp function (called when a response is
+ @brief Process Update Cfg Rsp function (called when a response is  
         being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateCfgRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16157,15 +16674,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiUpdateCfgRspCb = (WDI_UpdateCfgRspCb)pWDICtx->pfncRspCB;
@@ -16174,12 +16693,12 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiUpdateCfgRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessUpdateCfgRsp*/
 
 
@@ -16187,16 +16706,16 @@
 /**
  @brief Process Add BA Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessAddBARsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16209,15 +16728,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiAddBARspCb = (WDI_AddBARspCb)pWDICtx->pfncRspCB;
@@ -16225,8 +16746,8 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halAddBARsp,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halAddBARsp, 
+                  pEventData->pEventData, 
                   sizeof(halAddBARsp));
 
   wdiAddBARsp.wdiStatus = WDI_HAL_2_WDI_STATUS(halAddBARsp.status);
@@ -16239,22 +16760,22 @@
   /*Notify UMAC*/
   wdiAddBARspCb( &wdiAddBARsp, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessAddSessionBARsp*/
 
 /**
  @brief Process Add BA Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessTriggerBARsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16267,19 +16788,21 @@
   WDI_TriggerBARspCandidateType* wdiTriggerBARspCandidate;
   wpt_uint16                     index;
   wpt_uint16                     TidIndex;
-
+  
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiTriggerBARspCb = (WDI_TriggerBARspCb)pWDICtx->pfncRspCB;
@@ -16289,17 +16812,21 @@
   -------------------------------------------------------------------------*/
   halTriggerBARsp = (tTriggerBARspParams *)pEventData->pEventData;
 
-  wdiTriggerBARsp = wpalMemoryAllocate(sizeof(WDI_TriggerBARspParamsType) +
-                      halTriggerBARsp->baCandidateCnt *
+  wdiTriggerBARsp = wpalMemoryAllocate(sizeof(WDI_TriggerBARspParamsType) + 
+                      halTriggerBARsp->baCandidateCnt * 
                       sizeof(WDI_TriggerBARspCandidateType));
   if(NULL == wdiTriggerBARsp)
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                 "Failed to allocate memory in Trigger BA Response %x %x %x ",
                  pWDICtx, pEventData, pEventData->pEventData);
+#endif
     wpalMemoryFree(halTriggerBARsp);
+#ifdef WLAN_DEBUG
     WDI_ASSERT(0);
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   wdiTriggerBARsp->wdiStatus = WDI_HAL_2_WDI_STATUS(halTriggerBARsp->status);
@@ -16307,7 +16834,7 @@
   if ( WDI_STATUS_SUCCESS == wdiTriggerBARsp->wdiStatus)
   {
     wdiTriggerBARsp->usBaCandidateCnt = halTriggerBARsp->baCandidateCnt;
-    wpalMemoryCopy(wdiTriggerBARsp->macBSSID,
+    wpalMemoryCopy(wdiTriggerBARsp->macBSSID, 
                                  halTriggerBARsp->bssId , WDI_MAC_ADDR_LEN);
 
     wdiTriggerBARspCandidate = (WDI_TriggerBARspCandidateType*)(wdiTriggerBARsp + 1);
@@ -16315,13 +16842,13 @@
 
     for(index = 0; index < wdiTriggerBARsp->usBaCandidateCnt; index++)
     {
-      wpalMemoryCopy(wdiTriggerBARspCandidate->macSTA,
+      wpalMemoryCopy(wdiTriggerBARspCandidate->macSTA, 
                                   halBaCandidate->staAddr, WDI_MAC_ADDR_LEN);
       for(TidIndex = 0; TidIndex < STA_MAX_TC; TidIndex++)
       {
-        wdiTriggerBARspCandidate->wdiBAInfo[TidIndex].fBaEnable =
+        wdiTriggerBARspCandidate->wdiBAInfo[TidIndex].fBaEnable = 
                             halBaCandidate->baInfo[TidIndex].fBaEnable;
-        wdiTriggerBARspCandidate->wdiBAInfo[TidIndex].startingSeqNum =
+        wdiTriggerBARspCandidate->wdiBAInfo[TidIndex].startingSeqNum = 
                             halBaCandidate->baInfo[TidIndex].startingSeqNum;
       }
       wdiTriggerBARspCandidate++;
@@ -16333,22 +16860,22 @@
   wdiTriggerBARspCb( wdiTriggerBARsp, pWDICtx->pRspCBUserData);
 
   wpalMemoryFree(wdiTriggerBARsp);
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessAddSessionBARsp*/
 
 /**
  @brief Process Update Beacon Params Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateBeaconParamsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16359,15 +16886,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiUpdateBeaconParamsRspCb = (WDI_UpdateBeaconParamsRspCb)pWDICtx->pfncRspCB;
@@ -16375,31 +16904,31 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halStatus,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
                   sizeof(halStatus));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiUpdateBeaconParamsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessUpdateBeaconParamsRsp*/
 
 /**
  @brief Process Send Beacon template Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSendBeaconParamsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16410,15 +16939,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiSendBeaconParamsRspCb = (WDI_SendBeaconParamsRspCb)pWDICtx->pfncRspCB;
@@ -16426,32 +16957,32 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halStatus,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
                   sizeof(halStatus));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiSendBeaconParamsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSendBeaconParamsRsp*/
 
-
+  
 /**
- @brief Process Update Probe Resp Template Rsp function (called
+ @brief Process Update Probe Resp Template Rsp function (called 
         when a response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateProbeRspTemplateRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16462,15 +16993,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiUpdProbeRspTemplRspCb = (WDI_UpdateProbeRspTemplateRspCb)pWDICtx->pfncRspCB;
@@ -16478,52 +17011,54 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halStatus,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
                   sizeof(halStatus));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiUpdProbeRspTemplRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessUpdateProbeRspTemplateRsp*/
 
   /**
  @brief Process Set Max Tx Power Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetMaxTxPowerRsp
-(
+( 
   WDI_ControlBlockType*          pWDICtx,
   WDI_EventInfoType*             pEventData
 )
 {
   tSetMaxTxPwrRspMsg             halTxpowerrsp;
-
+  
   WDI_SetMaxTxPowerRspMsg        wdiSetMaxTxPowerRspMsg;
-
+  
   WDA_SetMaxTxPowerRspCb         wdiReqStatusCb;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiReqStatusCb = (WDA_SetMaxTxPowerRspCb)pWDICtx->pfncRspCB;
@@ -16531,42 +17066,44 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halTxpowerrsp.setMaxTxPwrRspParams,
-                           pEventData->pEventData,
-                           sizeof(halTxpowerrsp.setMaxTxPwrRspParams));
+  wpalMemoryCopy( &halTxpowerrsp.setMaxTxPwrRspParams, 
+                           pEventData->pEventData, 
+                           sizeof(halTxpowerrsp.setMaxTxPwrRspParams)); 
 
   if ( eHAL_STATUS_SUCCESS != halTxpowerrsp.setMaxTxPwrRspParams.status )
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Error status returned in Set Max Tx Power Response ");
-     WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     WDI_DetectedDeviceError( pWDICtx, WDI_ERR_BASIC_OP_FAILURE); 
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  wdiSetMaxTxPowerRspMsg.wdiStatus =
+  wdiSetMaxTxPowerRspMsg.wdiStatus = 
          WDI_HAL_2_WDI_STATUS(halTxpowerrsp.setMaxTxPwrRspParams.status);
-  wdiSetMaxTxPowerRspMsg.ucPower  = halTxpowerrsp.setMaxTxPwrRspParams.power;
+  wdiSetMaxTxPowerRspMsg.ucPower  = halTxpowerrsp.setMaxTxPwrRspParams.power; 
 
   /*Notify UMAC*/
   wdiReqStatusCb( &wdiSetMaxTxPowerRspMsg, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }
 
 #ifdef WLAN_FEATURE_P2P
 /**
- @brief Process P2P Group Owner Notice Of Absense Rsp function (called
+ @brief Process P2P Group Owner Notice Of Absense Rsp function (called 
         when a response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessP2PGONOARsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16577,15 +17114,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiP2PGONOAReqParamsRspCb = (WDI_SetP2PGONOAReqParamsRspCb)pWDICtx->pfncRspCB;
@@ -16593,31 +17132,31 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halStatus,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halStatus, 
+                  pEventData->pEventData, 
                   sizeof(halStatus));
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiP2PGONOAReqParamsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessP2PGONOARsp*/
 #endif
 /**
- @brief Process Enter IMPS Rsp function (called when a response
+ @brief Process Enter IMPS Rsp function (called when a response 
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessEnterImpsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16628,15 +17167,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiEnterImpsRspCb = (WDI_EnterImpsRspCb)pWDICtx->pfncRspCB;
@@ -16646,39 +17187,27 @@
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
-  /* If IMPS req failed, riva is not power collapsed Put the DXE in FULL state.
-   * Other module states are taken care by PMC.
-   * TODO: How do we take care of the case where IMPS is success, but riva power collapse fails??
-   */
-  if (wdiStatus != WDI_STATUS_SUCCESS) {
-
-	  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-		 "WDI PRocess Enter IMPS RSP failed With HAL Status Code: %d",halStatus);
-	  /* Call Back is not required as we are putting the DXE in FULL
-	   * and riva is already in full (IMPS RSP Failed)*/
-	  WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_FULL, NULL);
-  }
   /*Notify UMAC*/
   wdiEnterImpsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessEnterImpsRsp*/
 
 /**
- @brief Process Exit IMPS Rsp function (called when a response
+ @brief Process Exit IMPS Rsp function (called when a response 
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessExitImpsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16689,15 +17218,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiExitImpsRspCb = (WDI_ExitImpsRspCb)pWDICtx->pfncRspCB;
@@ -16706,7 +17237,7 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   // notify DTS that we are entering Full power
   WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_FULL, NULL);
@@ -16714,22 +17245,22 @@
   /*Notify UMAC*/
   wdiExitImpsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessExitImpsRsp*/
 
 /**
- @brief Process Enter BMPS Rsp function (called when a response
+ @brief Process Enter BMPS Rsp function (called when a response 
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessEnterBmpsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16740,15 +17271,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiEnterBmpsRspCb = (WDI_EnterBmpsRspCb)pWDICtx->pfncRspCB;
@@ -16757,41 +17290,27 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
-
-  /* If BMPS req failed, riva is not power collapsed put the DXE in FULL state.
-   * Other module states are taken care by PMC.
-   * TODO: How do we take care of the case where BMPS is success, but riva power collapse fails??
-   */
-   if (wdiStatus != WDI_STATUS_SUCCESS) {
-
-	  WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-		 "WDI PRocess Enter BMPS RSP failed With HAL Status Code: %d",halStatus);
-	  /* Call Back is not required as we are putting the DXE in FULL
-	   * and riva is already in FULL (BMPS RSP Failed)*/
-	  WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_FULL, NULL);
-	  pWDICtx->bInBmps = eWLAN_PAL_FALSE;
-   }
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiEnterBmpsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessEnterBmpsRsp*/
 
 /**
- @brief Process Exit BMPS Rsp function (called when a response
+ @brief Process Exit BMPS Rsp function (called when a response 
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessExitBmpsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16802,15 +17321,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiExitBmpsRspCb = (WDI_ExitBmpsRspCb)pWDICtx->pfncRspCB;
@@ -16819,7 +17340,7 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   // notify DTS that we are entering Full power
   WDTS_SetPowerState(pWDICtx, WDTS_POWER_STATE_FULL, NULL);
@@ -16829,22 +17350,22 @@
   /*Notify UMAC*/
   wdiExitBmpsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessExitBmpsRsp*/
 
 /**
  @brief Process Enter UAPSD Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessEnterUapsdRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16855,15 +17376,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiEnterUapsdRspCb = (WDI_EnterUapsdRspCb)pWDICtx->pfncRspCB;
@@ -16872,7 +17395,7 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   if(WDI_STATUS_SUCCESS == wdiStatus)
   {
@@ -16891,22 +17414,22 @@
   /*Notify UMAC*/
   wdiEnterUapsdRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessEnterUapsdRsp*/
 
 /**
- @brief Process Exit UAPSD Rsp function (called when a response
+ @brief Process Exit UAPSD Rsp function (called when a response 
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessExitUapsdRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16917,15 +17440,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiExitUapsdRspCb = (WDI_ExitUapsdRspCb)pWDICtx->pfncRspCB;
@@ -16934,7 +17459,7 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    // Restore back the DPU routing flag in the TxBD, for DPU to push the TxBDs to BTQM
    // directly instead of the FW WQ.
@@ -16948,22 +17473,22 @@
   /*Notify UMAC*/
   wdiExitUapsdRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessExitUapsdRsp*/
 
 /**
- @brief Process set UAPSD params Rsp function (called when a
+ @brief Process set UAPSD params Rsp function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetUapsdAcParamsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -16974,15 +17499,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiSetUapsdAcParamsCb = (WDI_SetUapsdAcParamsCb)pWDICtx->pfncRspCB;
@@ -16991,27 +17518,27 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiSetUapsdAcParamsCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetUapsdAcParamsRsp*/
 
 /**
- @brief Process update UAPSD params Rsp function (called when a
+ @brief Process update UAPSD params Rsp function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateUapsdParamsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17022,15 +17549,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiUpdateUapsdParamsCb = (WDI_UpdateUapsdParamsCb)pWDICtx->pfncRspCB;
@@ -17039,27 +17568,27 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiUpdateUapsdParamsCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessUpdateUapsdParamsRsp*/
 
 /**
  @brief Process Configure RXP filter Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessConfigureRxpFilterRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17070,15 +17599,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiConfigureRxpFilterCb = (WDI_ConfigureRxpFilterCb)pWDICtx->pfncRspCB;
@@ -17087,27 +17618,27 @@
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   wdiConfigureRxpFilterCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessConfigureRxpFilterRsp*/
 
 /**
  @brief Process Set beacon filter Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetBeaconFilterRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17118,15 +17649,17 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiBeaconFilterCb = (WDI_SetBeaconFilterCb)pWDICtx->pfncRspCB;
@@ -17135,27 +17668,27 @@
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiBeaconFilterCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetBeaconFilterRsp*/
 
 /**
  @brief Process remove beacon filter Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessRemBeaconFilterRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17166,15 +17699,17 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiBeaconFilterCb = (WDI_RemBeaconFilterCb)pWDICtx->pfncRspCB;
@@ -17183,27 +17718,27 @@
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiBeaconFilterCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessRemBeaconFilterRsp*/
 
 /**
  @brief Process set RSSI thresholds Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetRSSIThresoldsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17214,15 +17749,17 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiRSSIThresholdsCb = (WDI_SetRSSIThresholdsCb)pWDICtx->pfncRspCB;
@@ -17231,27 +17768,27 @@
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiRSSIThresholdsCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetRSSIThresoldsRsp*/
 
 /**
  @brief Process host offload Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessHostOffloadRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17262,15 +17799,17 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiHostOffloadCb = (WDI_HostOffloadCb)pWDICtx->pfncRspCB;
@@ -17279,27 +17818,27 @@
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiHostOffloadCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessHostOffloadRsp*/
 
 /**
  @brief Process keep alive Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessKeepAliveRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17308,49 +17847,52 @@
    eHalStatus           halStatus;
    WDI_KeepAliveCb      wdiKeepAliveCb;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+#ifdef WLAN_DEBUG
    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
                "Received WDI_ProcessKeepAliveRsp Callback from HAL");
-
+#endif
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wdiKeepAliveCb = (WDI_KeepAliveCb)pWDICtx->pfncRspCB;
-
+   wdiKeepAliveCb = (WDI_KeepAliveCb)pWDICtx->pfncRspCB; 
+   
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiKeepAliveCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessKeepAliveRsp*/
 
 /**
  @brief Process wowl add ptrn Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessWowlAddBcPtrnRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17361,15 +17903,17 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiWowlAddBcPtrnCb = (WDI_WowlAddBcPtrnCb)pWDICtx->pfncRspCB;
@@ -17378,27 +17922,27 @@
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiWowlAddBcPtrnCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessWowlAddBcPtrnRsp*/
 
 /**
- @brief Process wowl delete ptrn Rsp function (called when a
+ @brief Process wowl delete ptrn Rsp function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessWowlDelBcPtrnRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17409,15 +17953,17 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiWowlDelBcPtrnCb = (WDI_WowlDelBcPtrnCb)pWDICtx->pfncRspCB;
@@ -17426,27 +17972,27 @@
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiWowlDelBcPtrnCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessWowlDelBcPtrnRsp*/
 
 /**
- @brief Process wowl enter Rsp function (called when a response
+ @brief Process wowl enter Rsp function (called when a response 
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessWowlEnterRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17457,15 +18003,17 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiWowlEnterCb = (WDI_WowlEnterReqCb)pWDICtx->pfncRspCB;
@@ -17474,27 +18022,27 @@
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiWowlEnterCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessWowlEnterRsp*/
 
 /**
- @brief Process wowl exit Rsp function (called when a response
+ @brief Process wowl exit Rsp function (called when a response 
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessWowlExitRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17505,15 +18053,17 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiWowlExitCb = (WDI_WowlExitReqCb)pWDICtx->pfncRspCB;
@@ -17522,28 +18072,28 @@
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiWowlExitCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessWowlExitRsp*/
 
 /**
- @brief Process Configure Apps CPU wakeup State Rsp function
+ @brief Process Configure Apps CPU wakeup State Rsp function 
         (called when a response is being received over the bus
         from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessConfigureAppsCpuWakeupStateRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17554,15 +18104,17 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiConfigureAppsCpuWakeupStateCb = (WDI_ConfigureAppsCpuWakeupStateCb)pWDICtx->pfncRspCB;
@@ -17571,28 +18123,28 @@
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiConfigureAppsCpuWakeupStateCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessConfigureAppsCpuWakeupStateRsp*/
 
 
 /**
  @brief Process Nv download(called when a response
         is being received over the bus from HAL,will check if the responce is )
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessNvDownloadRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17603,32 +18155,34 @@
   WDI_NvDownloadRspInfoType wdiNvDownloadRsp;
 
   /*-------------------------------------------------------------------------
-   Sanity check
+   Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
     ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
     WDI_ASSERT(0);
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halNvDownloadRsp,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halNvDownloadRsp, 
+                  pEventData->pEventData, 
                   sizeof(halNvDownloadRsp));
 
   wdiNvDownloadRsp.wdiStatus = WDI_HAL_2_WDI_STATUS(halNvDownloadRsp.status);
 
   if((wdiNvDownloadRsp.wdiStatus == WDI_STATUS_SUCCESS) &&
-    (pWDICtx->wdiNvBlobInfo.usCurrentFragment !=
-         pWDICtx->wdiNvBlobInfo.usTotalFragment ))
+    (pWDICtx->wdiNvBlobInfo.usCurrentFragment != 
+         pWDICtx->wdiNvBlobInfo.usTotalFragment )) 
   {
     WDI_NvDownloadReq(&pWDICtx->wdiCachedNvDownloadReq,
-       (WDI_NvDownloadRspCb)pWDICtx->pfncRspCB, pWDICtx->pRspCBUserData);
+       (WDI_NvDownloadRspCb)pWDICtx->pfncRspCB, pWDICtx->pRspCBUserData); 
   }
   else
   {
@@ -17641,22 +18195,22 @@
     wdiNvDownloadRspCb( &wdiNvDownloadRsp, pWDICtx->pRspCBUserData);
   }
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }
 #ifdef WLAN_FEATURE_VOWIFI_11R
 /**
  @brief Process Add TSpec Rsp function (called when a response
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessAggrAddTSpecRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17667,15 +18221,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   wdiAggrAddTsRspCb = (WDI_AddTsRspCb)pWDICtx->pfncRspCB;
@@ -17683,33 +18239,33 @@
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &aggrAddTsRsp,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &aggrAddTsRsp, 
+                  pEventData->pEventData, 
                   sizeof(aggrAddTsRsp));
 
   /* What is the difference between status0 and status1? */
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(aggrAddTsRsp.status0);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(aggrAddTsRsp.status0); 
 
   /*Notify UMAC*/
   wdiAggrAddTsRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessAddTSpecRsp*/
 #endif /* WLAN_FEATURE_VOWIFI_11R */
 
 /**
- @brief WDI_ProcessHostResumeRsp function (called when a
+ @brief WDI_ProcessHostResumeRsp function (called when a 
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessHostResumeRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17720,15 +18276,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
     -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
     WDI_ASSERT(0);
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   wdiHostResumeRspCb = (WDI_HostResumeEventRspCb)pWDICtx->pfncRspCB;
@@ -17737,12 +18295,12 @@
     Extract response and send it to UMAC
     -------------------------------------------------------------------------*/
 
-  wpalMemoryCopy( &hostResumeRspMsg,
+  wpalMemoryCopy( &hostResumeRspMsg, 
       (wpt_uint8*)pEventData->pEventData,
       sizeof(hostResumeRspMsg));
 
-  wdiResumeRspParams.wdiStatus   =
-    WDI_HAL_2_WDI_STATUS(hostResumeRspMsg.status);
+  wdiResumeRspParams.wdiStatus   =   
+    WDI_HAL_2_WDI_STATUS(hostResumeRspMsg.status); 
 
   /*Notify UMAC*/
   wdiHostResumeRspCb(&wdiResumeRspParams, (void*) pWDICtx->pRspCBUserData);
@@ -17751,18 +18309,18 @@
 }
 
 /**
- @brief Process Set Tx PER Rsp function (called when a response
+ @brief Process Set Tx PER Rsp function (called when a response 
         is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetTxPerTrackingRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17773,48 +18331,50 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
-
-  pwdiSetTxPerTrackingRspCb = (WDI_SetTxPerTrackingRspCb)pWDICtx->pfncRspCB;
+  
+  pwdiSetTxPerTrackingRspCb = (WDI_SetTxPerTrackingRspCb)pWDICtx->pfncRspCB; 
 
   /*-------------------------------------------------------------------------
     Extract response and send it to UMAC
   -------------------------------------------------------------------------*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Notify UMAC*/
   pwdiSetTxPerTrackingRspCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetTxPerTrackingRsp*/
 
 /*==========================================================================
                         Indications from HAL
  ==========================================================================*/
 /**
- @brief Process Low RSSI Indication function (called when an
+ @brief Process Low RSSI Indication function (called when an 
         indication of this kind is being received over the bus
         from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessLowRSSIInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17824,26 +18384,28 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
     Extract indication and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( (void *)&halRSSINotificationIndMsg.rssiNotificationParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( (void *)&halRSSINotificationIndMsg.rssiNotificationParams, 
+                  pEventData->pEventData, 
                   sizeof(tHalRSSINotification));
 
   /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType = WDI_RSSI_NOTIFICATION_IND;
+  wdiInd.wdiIndicationType = WDI_RSSI_NOTIFICATION_IND; 
   wdiInd.wdiIndicationData.wdiLowRSSIInfo.bRssiThres1PosCross =
      halRSSINotificationIndMsg.rssiNotificationParams.bRssiThres1PosCross;
   wdiInd.wdiIndicationData.wdiLowRSSIInfo.bRssiThres1NegCross =
@@ -17859,25 +18421,25 @@
 
   /*Notify UMAC*/
   pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
+  
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessLowRSSIInd*/
 
 
 /**
- @brief Process Missed Beacon Indication function (called when
+ @brief Process Missed Beacon Indication function (called when 
         an indication of this kind is being received over the
         bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessMissedBeaconInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17888,15 +18450,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
@@ -17904,32 +18468,32 @@
   -------------------------------------------------------------------------*/
   /*! TO DO: Parameters need to be unpacked according to HAL struct*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType = WDI_MISSED_BEACON_IND;
-
+  wdiInd.wdiIndicationType = WDI_MISSED_BEACON_IND; 
+  
   /*Notify UMAC*/
   pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
+  
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessMissedBeaconInd*/
 
 
 /**
- @brief Process Unk Addr Frame Indication function (called when
+ @brief Process Unk Addr Frame Indication function (called when 
         an indication of this kind is being received over the
         bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUnkAddrFrameInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17940,15 +18504,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
@@ -17956,34 +18522,34 @@
   -------------------------------------------------------------------------*/
   /*! TO DO: Parameters need to be unpacked according to HAL struct*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
   /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType = WDI_UNKNOWN_ADDR2_FRAME_RX_IND;
+  wdiInd.wdiIndicationType = WDI_UNKNOWN_ADDR2_FRAME_RX_IND; 
   /* ! TO DO - fill in from HAL struct:
     wdiInd.wdiIndicationData.wdiUnkAddr2FrmInfo*/
 
   /*Notify UMAC*/
   pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
+  
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessUnkAddrFrameInd*/
 
 
 /**
- @brief Process MIC Failure Indication function (called when an
+ @brief Process MIC Failure Indication function (called when an 
         indication of this kind is being received over the bus
         from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessMicFailureInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -17994,24 +18560,26 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
-
+  
   pHalMicFailureInd = (tpSirMicFailureInd)pEventData->pEventData;
   /*-------------------------------------------------------------------------
     Extract indication and send it to UMAC
   -------------------------------------------------------------------------*/
 
   /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType = WDI_MIC_FAILURE_IND;
+  wdiInd.wdiIndicationType = WDI_MIC_FAILURE_IND; 
   wpalMemoryCopy(wdiInd.wdiIndicationData.wdiMICFailureInfo.bssId,
                  pHalMicFailureInd->bssId, WDI_MAC_ADDR_LEN);
   wpalMemoryCopy(wdiInd.wdiIndicationData.wdiMICFailureInfo.macSrcAddr,
@@ -18020,11 +18588,11 @@
                  pHalMicFailureInd->info.taMacAddr, WDI_MAC_ADDR_LEN);
   wpalMemoryCopy(wdiInd.wdiIndicationData.wdiMICFailureInfo.macDstAddr,
                  pHalMicFailureInd->info.dstMacAddr, WDI_MAC_ADDR_LEN);
-  wdiInd.wdiIndicationData.wdiMICFailureInfo.ucMulticast =
+  wdiInd.wdiIndicationData.wdiMICFailureInfo.ucMulticast = 
                  pHalMicFailureInd->info.multicast;
-  wdiInd.wdiIndicationData.wdiMICFailureInfo.ucIV1 =
+  wdiInd.wdiIndicationData.wdiMICFailureInfo.ucIV1 = 
                  pHalMicFailureInd->info.IV1;
-  wdiInd.wdiIndicationData.wdiMICFailureInfo.keyId=
+  wdiInd.wdiIndicationData.wdiMICFailureInfo.keyId= 
                  pHalMicFailureInd->info.keyId;
   wpalMemoryCopy(wdiInd.wdiIndicationData.wdiMICFailureInfo.TSC,
                  pHalMicFailureInd->info.TSC,WDI_CIPHER_SEQ_CTR_SIZE);
@@ -18032,25 +18600,25 @@
                  pHalMicFailureInd->info.rxMacAddr, WDI_MAC_ADDR_LEN);
   /*Notify UMAC*/
   pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
+  
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessMicFailureInd*/
 
 
 /**
- @brief Process Fatal Failure Indication function (called when
+ @brief Process Fatal Failure Indication function (called when 
         an indication of this kind is being received over the
         bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessFatalErrorInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -18061,15 +18629,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
@@ -18078,35 +18648,36 @@
 
   /*! TO DO: Parameters need to be unpacked according to HAL struct*/
   halStatus = *((eHalStatus*)pEventData->pEventData);
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Fatal failure received from device %d ", halStatus );
-
+#endif
   /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType             = WDI_FATAL_ERROR_IND;
-  wdiInd.wdiIndicationData.usErrorCode = WDI_ERR_DEV_INTERNAL_FAILURE;
+  wdiInd.wdiIndicationType             = WDI_FATAL_ERROR_IND; 
+  wdiInd.wdiIndicationData.usErrorCode = WDI_ERR_DEV_INTERNAL_FAILURE; 
 
   /*Notify UMAC*/
   pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
+  
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessFatalErrorInd*/
 
 /**
- @brief Process Delete STA Indication function (called when
+ @brief Process Delete STA Indication function (called when 
         an indication of this kind is being received over the
         bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessDelSTAInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -18116,15 +18687,17 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
@@ -18132,45 +18705,45 @@
   -------------------------------------------------------------------------*/
 
   /* Parameters need to be unpacked according to HAL struct*/
-  wpalMemoryCopy( &halDelSTACtx,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halDelSTACtx, 
+                  pEventData->pEventData, 
                   sizeof(halDelSTACtx));
 
   /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType             = WDI_DEL_STA_IND;
+  wdiInd.wdiIndicationType             = WDI_DEL_STA_IND; 
 
   wpalMemoryCopy(wdiInd.wdiIndicationData.wdiDeleteSTAIndType.macADDR2,
                  halDelSTACtx.addr2, WDI_MAC_ADDR_LEN);
   wpalMemoryCopy(wdiInd.wdiIndicationData.wdiDeleteSTAIndType.macBSSID,
                  halDelSTACtx.bssId, WDI_MAC_ADDR_LEN);
 
-  wdiInd.wdiIndicationData.wdiDeleteSTAIndType.usAssocId =
+  wdiInd.wdiIndicationData.wdiDeleteSTAIndType.usAssocId = 
     halDelSTACtx.assocId;
-  wdiInd.wdiIndicationData.wdiDeleteSTAIndType.ucSTAIdx  =
+  wdiInd.wdiIndicationData.wdiDeleteSTAIndType.ucSTAIdx  = 
     halDelSTACtx.staId;
-  wdiInd.wdiIndicationData.wdiDeleteSTAIndType.wptReasonCode =
-    halDelSTACtx.reasonCode;
+  wdiInd.wdiIndicationData.wdiDeleteSTAIndType.wptReasonCode = 
+    halDelSTACtx.reasonCode; 
 
   /*Notify UMAC*/
   pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
+  
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessDelSTAInd*/
 
 /**
 *@brief Process Coex Indication function (called when
         an indication of this kind is being received over the
         bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessCoexInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -18181,61 +18754,65 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT( 0 );
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
     Extract indication and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halCoexIndMsg.coexIndParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halCoexIndMsg.coexIndParams, 
+                  pEventData->pEventData, 
                   sizeof(halCoexIndMsg.coexIndParams) );
 
   /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType = WDI_COEX_IND;
-  wdiInd.wdiIndicationData.wdiCoexInfo.coexIndType = halCoexIndMsg.coexIndParams.coexIndType;
+  wdiInd.wdiIndicationType = WDI_COEX_IND; 
+  wdiInd.wdiIndicationData.wdiCoexInfo.coexIndType = halCoexIndMsg.coexIndParams.coexIndType; 
   for (index = 0; index < WDI_COEX_IND_DATA_SIZE; index++)
   {
-    wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[index] = halCoexIndMsg.coexIndParams.coexIndData[index];
+    wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[index] = halCoexIndMsg.coexIndParams.coexIndData[index]; 
   }
 
   // DEBUG
+#ifdef WLAN_DEBUG
   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
               "[COEX WDI] Coex Ind Type (%x) data (%x %x %x %x)",
-              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndType,
-              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[0],
-              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[1],
-              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[2],
-              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[3] );
+              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndType, 
+              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[0], 
+              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[1], 
+              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[2], 
+              wdiInd.wdiIndicationData.wdiCoexInfo.coexIndData[3] ); 
 
+#endif
   /*Notify UMAC*/
   pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
+  
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessCoexInd*/
 
 /**
 *@brief Process Tx Complete Indication function (called when
         an indication of this kind is being received over the
         bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessTxCompleteInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -18250,28 +18827,30 @@
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT( 0 );
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
   /*-------------------------------------------------------------------------
     Extract indication and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( &halTxComplIndMsg.txComplParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( &halTxComplIndMsg.txComplParams, 
+                  pEventData->pEventData, 
                   sizeof(halTxComplIndMsg.txComplParams) );
 
   /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType = WDI_TX_COMPLETE_IND;
-  wdiInd.wdiIndicationData.tx_complete_status
-                               = halTxComplIndMsg.txComplParams.status;
+  wdiInd.wdiIndicationType = WDI_TX_COMPLETE_IND; 
+  wdiInd.wdiIndicationData.tx_complete_status 
+                               = halTxComplIndMsg.txComplParams.status; 
 
   /*Notify UMAC*/
   pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
+  
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessTxCompleteInd*/
 
 #ifdef WLAN_FEATURE_P2P
@@ -18303,9 +18882,11 @@
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT( 0 );
+#endif
      return WDI_STATUS_E_FAILURE;
   }
 
@@ -18318,17 +18899,17 @@
 
   /*Fill in the indication parameters*/
   wdiInd.wdiIndicationType = WDI_P2P_NOA_ATTR_IND;
-
+  
   wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.status
                           = halNoaAttrIndMsg.noaAttrIndParams.status;
-
+  
   wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.ucIndex
                           = halNoaAttrIndMsg.noaAttrIndParams.index;
   wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.ucOppPsFlag
                           = halNoaAttrIndMsg.noaAttrIndParams.oppPsFlag;
   wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.usCtWin
                           = halNoaAttrIndMsg.noaAttrIndParams.ctWin;
-
+  
   wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.usNoa1IntervalCnt
                           = halNoaAttrIndMsg.noaAttrIndParams.uNoa1IntervalCnt;
   wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa1Duration
@@ -18337,7 +18918,7 @@
                              = halNoaAttrIndMsg.noaAttrIndParams.uNoa1Interval;
   wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa1StartTime
                           = halNoaAttrIndMsg.noaAttrIndParams.uNoa1StartTime;
-
+  
   wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.usNoa2IntervalCnt
                           = halNoaAttrIndMsg.noaAttrIndParams.uNoa2IntervalCnt;
   wdiInd.wdiIndicationData.wdiP2pNoaAttrInfo.uslNoa2Duration
@@ -18355,52 +18936,52 @@
 #endif
 
 /**
- @brief Process Tx PER Hit Indication function (called when
+ @brief Process Tx PER Hit Indication function (called when 
         an indication of this kind is being received over the
         bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessTxPerHitInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   WDI_LowLevelIndType  wdiInd;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
+  
   /*-------------------------------------------------------------------------
     Extract indication and send it to UMAC
   -------------------------------------------------------------------------*/
   /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType = WDI_TX_PER_HIT_IND;
-
+  wdiInd.wdiIndicationType = WDI_TX_PER_HIT_IND; 
+  
   /*Notify UMAC*/
   pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessTxPerHitInd*/
 
 #ifdef ANI_MANF_DIAG
 /**
  @brief WDI_ProcessFTMCommandReq
         Process FTM Command, simply route to HAL
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessFTMCommandReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -18410,16 +18991,18 @@
   wpt_uint16              dataOffset;
   wpt_uint16              bufferSize;
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
 
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   ftmCommandReq = (WDI_FTMCommandReqType *)pEventData->pEventData;
@@ -18448,16 +19031,16 @@
 /**
  @brief WDI_ProcessFTMCommandRsp
         Process FTM Command Response from HAL, simply route to HDD FTM
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessFTMCommandRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -18467,44 +19050,46 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   ftmCMDRspCb = (WDI_FTMCommandRspCb)pWDICtx->pfncRspCB;
 
   ftmCMDRspData = (tProcessPttRspParams *)pEventData->pEventData;
 
-  wpalMemoryCopy((void *)pWDICtx->ucFTMCommandRspBuffer,
-                 (void *)&ftmCMDRspData->pttMsgBuffer,
+  wpalMemoryCopy((void *)pWDICtx->ucFTMCommandRspBuffer, 
+                 (void *)&ftmCMDRspData->pttMsgBuffer, 
                  ftmCMDRspData->pttMsgBuffer.msgBodyLength);
 
   /*Notify UMAC*/
   ftmCMDRspCb((void *)pWDICtx->ucFTMCommandRspBuffer, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }
 #endif /* ANI_MANF_DIAG */
 /**
  @brief WDI_ProcessHalDumpCmdReq
         Process hal dump Command, simply route to HAL
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessHALDumpCmdReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -18514,80 +19099,84 @@
   wpt_uint16               usDataOffset        = 0;
   wpt_uint16               usSendSize          = 0;
   tHalDumpCmdReqMsg        halDumpCmdReqMsg;
-  wpt_uint8*               pSendBuffer         = NULL;
+  wpt_uint8*               pSendBuffer         = NULL; 
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData) ||
       ( NULL == pEventData->pCBfnc ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   pwdiHALDumpCmdParams = (WDI_HALDumpCmdReqParamsType*)pEventData->pEventData;
   wdiHALDumpCmdRspCb   = (WDI_HALDumpCmdRspCb)pEventData->pCBfnc;
 
   /* Copying the HAL DUMP Command Information HAL Structure*/
-  halDumpCmdReqMsg.dumpCmdReqParams.argument1 =
+  halDumpCmdReqMsg.dumpCmdReqParams.argument1 = 
                 pwdiHALDumpCmdParams->wdiHALDumpCmdInfoType.command;
-  halDumpCmdReqMsg.dumpCmdReqParams.argument2 =
+  halDumpCmdReqMsg.dumpCmdReqParams.argument2 = 
                 pwdiHALDumpCmdParams->wdiHALDumpCmdInfoType.argument1;
-  halDumpCmdReqMsg.dumpCmdReqParams.argument3 =
+  halDumpCmdReqMsg.dumpCmdReqParams.argument3 = 
                 pwdiHALDumpCmdParams->wdiHALDumpCmdInfoType.argument2;
-  halDumpCmdReqMsg.dumpCmdReqParams.argument4 =
+  halDumpCmdReqMsg.dumpCmdReqParams.argument4 = 
                 pwdiHALDumpCmdParams->wdiHALDumpCmdInfoType.argument3;
-  halDumpCmdReqMsg.dumpCmdReqParams.argument5 =
+  halDumpCmdReqMsg.dumpCmdReqParams.argument5 = 
                 pwdiHALDumpCmdParams->wdiHALDumpCmdInfoType.argument4;
-
+  
   /*-----------------------------------------------------------------------
     Get message buffer
   -----------------------------------------------------------------------*/
-  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_HAL_DUMP_CMD_REQ,
+  if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_HAL_DUMP_CMD_REQ, 
                         sizeof(halDumpCmdReqMsg.dumpCmdReqParams),
                         &pSendBuffer, &usDataOffset, &usSendSize))||
-      ( usSendSize <
+      ( usSendSize < 
             (usDataOffset + sizeof(halDumpCmdReqMsg.dumpCmdReqParams) )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
               "Unable to get send buffer in HAL Dump Command req %x %x %x",
                 pEventData, pwdiHALDumpCmdParams, wdiHALDumpCmdRspCb);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  &halDumpCmdReqMsg.dumpCmdReqParams,
-                  sizeof(halDumpCmdReqMsg.dumpCmdReqParams));
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  &halDumpCmdReqMsg.dumpCmdReqParams, 
+                  sizeof(halDumpCmdReqMsg.dumpCmdReqParams)); 
 
   pWDICtx->wdiReqStatusCB     = pwdiHALDumpCmdParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiHALDumpCmdParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiHALDumpCmdParams->pUserData; 
 
   /*-------------------------------------------------------------------------
-    Send Start Request to HAL
+    Send Start Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiHALDumpCmdRspCb, pEventData->pUserData,
-                        WDI_HAL_DUMP_CMD_RESP);
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiHALDumpCmdRspCb, pEventData->pUserData, 
+                        WDI_HAL_DUMP_CMD_RESP); 
 }
 
 /**
  @brief WDI_ProcessHalDumpCmdRsp
-        Process hal Dump Command Response from HAL, simply route to HDD
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+        Process hal Dump Command Response from HAL, simply route to HDD 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessHALDumpCmdRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -18597,27 +19186,29 @@
   WDI_HALDumpCmdRspParamsType wdiHALDumpCmdRsp;
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
-  wdiHALDumpCmdRspCb = (WDI_HALDumpCmdRspCb)pWDICtx->pfncRspCB;
+  wdiHALDumpCmdRspCb = (WDI_HALDumpCmdRspCb)pWDICtx->pfncRspCB; 
 
   /*Initialize the WDI Response structure */
   wdiHALDumpCmdRsp.usBufferLen = 0;
   wdiHALDumpCmdRsp.pBuffer = NULL;
 
   halDumpCmdRspParams = (tHalDumpCmdRspParams *)pEventData->pEventData;
-
-  wdiHALDumpCmdRsp.wdiStatus   =
-              WDI_HAL_2_WDI_STATUS(halDumpCmdRspParams->status);
+  
+  wdiHALDumpCmdRsp.wdiStatus   = 
+              WDI_HAL_2_WDI_STATUS(halDumpCmdRspParams->status); 
 
   if (( wdiHALDumpCmdRsp.wdiStatus  ==  WDI_STATUS_SUCCESS) &&
       (halDumpCmdRspParams->rspLength != 0))
@@ -18625,11 +19216,11 @@
       /* Copy the response data */
       wdiHALDumpCmdRsp.usBufferLen = halDumpCmdRspParams->rspLength;
       wdiHALDumpCmdRsp.pBuffer = wpalMemoryAllocate(halDumpCmdRspParams->rspLength);
-      wpalMemoryCopy( &halDumpCmdRspParams->rspBuffer,
-                  wdiHALDumpCmdRsp.pBuffer,
+      wpalMemoryCopy( &halDumpCmdRspParams->rspBuffer, 
+                  wdiHALDumpCmdRsp.pBuffer, 
                   sizeof(wdiHALDumpCmdRsp.usBufferLen));
   }
-
+  
   /*Notify UMAC*/
   wdiHALDumpCmdRspCb(&wdiHALDumpCmdRsp, pWDICtx->pRspCBUserData);
 
@@ -18643,50 +19234,54 @@
 
 /*==========================================================================
                      CONTRL TRANSPORT INTERACTION
-
+ 
     Callback function registered with the control transport - for receiving
-    notifications and packets
+    notifications and packets 
 ==========================================================================*/
 /**
- @brief    This callback is invoked by the control transport
+ @brief    This callback is invoked by the control transport 
    when it wishes to send up a notification like the ones
    mentioned above.
-
+ 
  @param
-
-    wctsHandle:       handle to the control transport service
+    
+    wctsHandle:       handle to the control transport service 
     wctsEvent:        the event being notified
-    wctsNotifyCBData: the callback data of the user
-
+    wctsNotifyCBData: the callback data of the user 
+    
  @see  WCTS_OpenTransport
-
- @return None
+  
+ @return None 
 */
-void
+void 
 WDI_NotifyMsgCTSCB
 (
-  WCTS_HandleType        wctsHandle,
+  WCTS_HandleType        wctsHandle, 
   WCTS_NotifyEventType   wctsEvent,
   void*                  wctsNotifyCBData
 )
 {
-  WDI_ControlBlockType*  pWDICtx = (WDI_ControlBlockType*)wctsNotifyCBData;
+  WDI_ControlBlockType*  pWDICtx = (WDI_ControlBlockType*)wctsNotifyCBData; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   if (NULL == pWDICtx )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
     WDI_ASSERT(0);
-    return;
+#endif
+    return; 
   }
 
   if (WDI_CONTROL_BLOCK_MAGIC != pWDICtx->magic)
   {
     /* callback presumably occurred after close */
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid control block", __FUNCTION__);
-    return;
+#endif
+    return; 
   }
 
   if ( WCTS_EVENT_OPEN == wctsEvent )
@@ -18694,22 +19289,22 @@
     /*Flag must be set atomically as it is checked from incoming request
       functions*/
     wpalMutexAcquire(&pWDICtx->wptMutex);
-    pWDICtx->bCTOpened   = eWLAN_PAL_TRUE;
+    pWDICtx->bCTOpened   = eWLAN_PAL_TRUE; 
 
     /*Nothing to do - so try to dequeue any pending request that may have
      occurred while we were trying to establish this*/
     WDI_DequeuePendingReq(pWDICtx);
-    wpalMutexRelease(&pWDICtx->wptMutex);
+    wpalMutexRelease(&pWDICtx->wptMutex);   
   }
-  else if  ( WCTS_EVENT_CLOSE == wctsEvent )
+  else if  ( WCTS_EVENT_CLOSE == wctsEvent ) 
   {
     /*Flag must be set atomically as it is checked from incoming request
       functions*/
     wpalMutexAcquire(&pWDICtx->wptMutex);
-    pWDICtx->bCTOpened   = eWLAN_PAL_FALSE;
+    pWDICtx->bCTOpened   = eWLAN_PAL_FALSE; 
 
     /*No other request will be processed from now on - fail all*/
-    WDI_ClearPendingRequests(pWDICtx);
+    WDI_ClearPendingRequests(pWDICtx); 
     wpalMutexRelease(&pWDICtx->wptMutex);
 
     /*Notify that the Control Channel is closed */
@@ -18720,56 +19315,60 @@
 
 
 /**
- @brief    This callback is invoked by the control transport
+ @brief    This callback is invoked by the control transport 
            when it wishes to send up a packet received over the
            bus.
-
+ 
  @param
-
-    wctsHandle:  handle to the control transport service
+    
+    wctsHandle:  handle to the control transport service 
     pMsg:        the packet
     uLen:        the packet length
-    wctsRxMsgCBData: the callback data of the user
-
+    wctsRxMsgCBData: the callback data of the user 
+    
  @see  WCTS_OpenTransport
-
- @return None
+  
+ @return None 
 */
-void
-WDI_RXMsgCTSCB
+void 
+WDI_RXMsgCTSCB 
 (
-  WCTS_HandleType       wctsHandle,
+  WCTS_HandleType       wctsHandle, 
   void*                 pMsg,
   wpt_uint32            uLen,
   void*                 wctsRxMsgCBData
 )
 {
-  tHalMsgHeader          *pHalMsgHeader;
-  WDI_EventInfoType      wdiEventData;
+  tHalMsgHeader          *pHalMsgHeader; 
+  WDI_EventInfoType      wdiEventData; 
   WDI_ControlBlockType*  pWDICtx = (WDI_ControlBlockType*)wctsRxMsgCBData;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   ------------------------------------------------------------------------*/
-  if ((NULL == pWDICtx ) || ( NULL == pMsg ) ||
+  if ((NULL == pWDICtx ) || ( NULL == pMsg ) || 
       ( uLen < sizeof(tHalMsgHeader)))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
     WDI_ASSERT(0);
-    return;
+#endif
+    return; 
   }
 
   if (WDI_CONTROL_BLOCK_MAGIC != pWDICtx->magic)
   {
     /* callback presumably occurred after close */
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid control block", __FUNCTION__);
-    return;
+#endif
+    return; 
   }
 
-  /*The RX Callback is expected to be serialized in the proper control thread
+  /*The RX Callback is expected to be serialized in the proper control thread 
     context - so no serialization is necessary here
     ! - revisit this assumption */
 
@@ -18777,10 +19376,12 @@
 
   if ( uLen != pHalMsgHeader->msgLen )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "Invalid packet received from HAL - catastrophic failure");
-    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_INVALID_RSP_FMT);
-    return;
+#endif
+    WDI_DetectedDeviceError( pWDICtx, WDI_ERR_INVALID_RSP_FMT); 
+    return; 
   }
 
   wdiEventData.wdiResponse = HAL_2_WDI_RSP_TYPE( pHalMsgHeader->msgType );
@@ -18801,19 +19402,22 @@
   /* Check if we receive a response message which is not expected */
   else if ( wdiEventData.wdiResponse < WDI_HAL_IND_MIN )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                "Received response %s (%d) when expecting %s (%d) - catastrophic failure",
                WDI_getRespMsgString(wdiEventData.wdiResponse),
-               wdiEventData.wdiResponse,
+               wdiEventData.wdiResponse, 
                WDI_getRespMsgString(pWDICtx->wdiExpectedResponse),
                pWDICtx->wdiExpectedResponse);
-    /* WDI_DetectedDeviceError( pWDICtx, WDI_ERR_INVALID_RSP_FMT); */
+
+#endif    /* WDI_DetectedDeviceError( pWDICtx, WDI_ERR_INVALID_RSP_FMT); */
     return;
   }
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
            "Rx smth from HAL: %d", wdiEventData.wdiResponse);
-
+#endif
   /*Post response event to the state machine*/
   WDI_PostMainEvent(pWDICtx, WDI_RESPONSE_EVENT, &wdiEventData);
 
@@ -18821,13 +19425,13 @@
 
 
 /*========================================================================
-         Internal Helper Routines
+         Internal Helper Routines 
 ========================================================================*/
 
 /**
- @brief WDI_CleanCB - internal helper routine used to clean the
+ @brief WDI_CleanCB - internal helper routine used to clean the 
         WDI Main Control Block
-
+ 
  @param pWDICtx - pointer to the control block
 
  @return Result of the function call
@@ -18841,9 +19445,9 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*Clean the WDI Control Block*/
-  wpalMemoryZero( pWDICtx, sizeof(*pWDICtx));
+  wpalMemoryZero( pWDICtx, sizeof(*pWDICtx)); 
 
-  pWDICtx->uGlobalState  = WDI_MAX_ST;
+  pWDICtx->uGlobalState  = WDI_MAX_ST; 
   pWDICtx->ucMaxBssids   = WDI_MAX_SUPPORTED_BSS;
   pWDICtx->ucMaxStations = WDI_MAX_SUPPORTED_STAS;
 
@@ -18854,12 +19458,12 @@
 
 
 /**
- @brief Process request helper function
+ @brief Process request helper function 
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
@@ -18872,34 +19476,38 @@
 {
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-  /*!! Skip sanity check as this is called from the FSM functionss which
+  /*!! Skip sanity check as this is called from the FSM functionss which 
     already checked these pointers*/
 
   if (( pEventData->wdiRequest < WDI_MAX_UMAC_IND ) &&
       ( NULL != pfnReqProcTbl[pEventData->wdiRequest] ))
-  {
+  {  
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
               "Calling request processing function for req %s (%d) %x",
               WDI_getReqMsgString(pEventData->wdiRequest),
               pEventData->wdiRequest, pfnReqProcTbl[pEventData->wdiRequest]);
+#endif
     return pfnReqProcTbl[pEventData->wdiRequest](pWDICtx, pEventData);
   }
   else
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "Operation %d is not yet implemented ",
+              "Operation %d is not yet implemented ", 
                pEventData->wdiRequest);
+#endif
     return WDI_STATUS_E_NOT_IMPLEMENT;
   }
 }/*WDI_ProcessRequest*/
 
 
 /**
- @brief Get message helper function - it allocates memory for a
+ @brief Get message helper function - it allocates memory for a 
         message that is to be sent to HAL accross the bus and
-        prefixes it with a send message header
-
- @param  pWDICtx:         pointer to the WLAN DAL context
+        prefixes it with a send message header 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
          wdiReqType:      type of the request being sent
          uBufferLen:      message buffer len
          pMsgBuffer:      resulting allocated buffer
@@ -18907,70 +19515,64 @@
          can start copying its message data
          puBufferSize:    the resulting buffer size (offset+buff
          len)
-
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_GetMessageBuffer
-(
-  WDI_ControlBlockType*  pWDICtx,
-  WDI_RequestEnumType    wdiReqType,
+( 
+  WDI_ControlBlockType*  pWDICtx, 
+  WDI_RequestEnumType    wdiReqType, 
   wpt_uint16             usBufferLen,
-  wpt_uint8**            pMsgBuffer,
-  wpt_uint16*            pusDataOffset,
+  wpt_uint8**            pMsgBuffer, 
+  wpt_uint16*            pusDataOffset, 
   wpt_uint16*            pusBufferSize
 )
 {
   tHalMsgHeader  halMsgHeader;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-  /*!! No sanity check here as we trust the called - ! check this assumption
+  /*!! No sanity check here as we trust the called - ! check this assumption 
     again*/
 
   /*-------------------------------------------------------------------------
-     Try to allocate message buffer from PAL
+     Try to allocate message buffer from PAL 
   -------------------------------------------------------------------------*/
-  *pusBufferSize = sizeof(halMsgHeader) + usBufferLen;
+  *pusBufferSize = sizeof(halMsgHeader) + usBufferLen; 
   *pMsgBuffer   = (wpt_uint8*)wpalMemoryAllocate(*pusBufferSize);
   if ( NULL ==  *pMsgBuffer )
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "Unable to allocate message buffer for req %s (%d)",
                WDI_getReqMsgString(wdiReqType),
-               wdiReqType);
+               wdiReqType); 
      WDI_ASSERT(0);
-     return WDI_STATUS_MEM_FAILURE;
+#endif
+     return WDI_STATUS_MEM_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
      Fill in the message header
   -------------------------------------------------------------------------*/
-  halMsgHeader.msgType = WDI_2_HAL_REQ_TYPE(wdiReqType);
-  /* Fill msgVersion */
-#ifdef WLAN_FEATURE_11AC
-  if (WDI_getFwWlanFeatCaps(DOT11AC))
-	  halMsgHeader.msgVersion = WLAN_HAL_MSG_VERSION1;
-  else
-#endif
-	  halMsgHeader.msgVersion = WLAN_HAL_MSG_VERSION0;
+  halMsgHeader.msgType = WDI_2_HAL_REQ_TYPE(wdiReqType); 
+  halMsgHeader.msgLen  = sizeof(halMsgHeader) + usBufferLen; 
+  *pusDataOffset       = sizeof(halMsgHeader); 
+  wpalMemoryCopy(*pMsgBuffer, &halMsgHeader, sizeof(halMsgHeader)); 
 
-  halMsgHeader.msgLen  = sizeof(halMsgHeader) + usBufferLen;
-  *pusDataOffset       = sizeof(halMsgHeader);
-  wpalMemoryCopy(*pMsgBuffer, &halMsgHeader, sizeof(halMsgHeader));
-
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }/*WDI_GetMessageBuffer*/
 
 
 /**
- @brief Send message helper function - sends a message over the
+ @brief Send message helper function - sends a message over the 
         bus using the control tranport and saves some info in
-        the CB
-
- @param  pWDICtx:         pointer to the WLAN DAL context
+        the CB 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
          pSendBuffer:     buffer to be sent
-
+  
          usSendSize          size of the buffer to be sent
          pRspCb:            response callback - save in the WDI
          CB
@@ -18978,17 +19580,17 @@
          callback
          wdiExpectedResponse: the code of the response that is
          expected to be rx-ed for this request
-
+  
  @see
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SendMsg
-(
-  WDI_ControlBlockType*  pWDICtx,
-  wpt_uint8*             pSendBuffer,
-  wpt_uint32             usSendSize,
-  void*                  pRspCb,
+( 
+  WDI_ControlBlockType*  pWDICtx,  
+  wpt_uint8*             pSendBuffer, 
+  wpt_uint32             usSendSize, 
+  void*                  pRspCb, 
   void*                  pUserData,
   WDI_ResponseEnumType   wdiExpectedResponse
 )
@@ -18997,11 +19599,11 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*------------------------------------------------------------------------
-    Save needed info in the CB
+    Save needed info in the CB 
   ------------------------------------------------------------------------*/
   pWDICtx->pRspCBUserData      = pUserData;
-  pWDICtx->pfncRspCB           = pRspCb;
-  pWDICtx->wdiExpectedResponse = wdiExpectedResponse;
+  pWDICtx->pfncRspCB           = pRspCb; 
+  pWDICtx->wdiExpectedResponse = wdiExpectedResponse; 
 
    /*-----------------------------------------------------------------------
      Call the CTS to send this message over - free message afterwards
@@ -19010,9 +19612,10 @@
    -----------------------------------------------------------------------*/
    if ( 0 != WCTS_SendMessage( pWDICtx->wctsHandle, (void*)pSendBuffer, usSendSize ))
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                 "Failed to send message over the bus - catastrophic failure");
-
+#endif
      wdiStatus = WDI_STATUS_E_FAILURE;
    }
 
@@ -19020,12 +19623,12 @@
    if ( NULL != pWDICtx->wdiReqStatusCB )
    {
      /*Inform originator whether request went through or not*/
-     WDI_ReqStatusCb callback = pWDICtx->wdiReqStatusCB;
-     void *callbackContext = pWDICtx->pReqStatusUserData;
+     WDI_ReqStatusCb callback = pWDICtx->wdiReqStatusCB; 
+     void *callbackContext = pWDICtx->pReqStatusUserData; 
      pWDICtx->wdiReqStatusCB = NULL;
      pWDICtx->pReqStatusUserData = NULL;
      callback(wdiStatus, callbackContext);
-
+     
      /*For WDI requests which have registered a request callback,
      inform the WDA caller of the same via setting the return value
      (wdiStatus) to WDI_STATUS_PENDING. This makes sure that WDA doesnt
@@ -19053,22 +19656,22 @@
 
 
 /**
- @brief Send indication helper function - sends a message over
+ @brief Send indication helper function - sends a message over 
         the bus using the control transport and saves some info
         in the CB
-
- @param  pWDICtx:         pointer to the WLAN DAL context
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
          pSendBuffer:     buffer to be sent
          usSendSize: size of the buffer to be sent
-
+  
  @see
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SendIndication
-(
-  WDI_ControlBlockType*  pWDICtx,
-  wpt_uint8*             pSendBuffer,
+( 
+  WDI_ControlBlockType*  pWDICtx,  
+  wpt_uint8*             pSendBuffer, 
   wpt_uint32             usSendSize
 )
 {
@@ -19076,48 +19679,50 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
    /*-----------------------------------------------------------------------
-     Call the CTS to send this message over
+     Call the CTS to send this message over 
      Note: CTS is reponsible for freeing the message buffer.
    -----------------------------------------------------------------------*/
-   uStatus = WCTS_SendMessage( pWDICtx->wctsHandle,
+   uStatus = WCTS_SendMessage( pWDICtx->wctsHandle, 
                                (void*)pSendBuffer, usSendSize );
 
    /*Inform Upper MAC about the outcome of the request*/
    if ( NULL != pWDICtx->wdiReqStatusCB )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                 "Send indication status : %d", uStatus);
-
+#endif
       pWDICtx->wdiReqStatusCB( (uStatus != 0 ) ? WDI_STATUS_E_FAILURE:
-                                                 WDI_STATUS_SUCCESS,
-                               pWDICtx->pReqStatusUserData);
+                                                 WDI_STATUS_SUCCESS, 
+                               pWDICtx->pReqStatusUserData); 
    }
 
    /*If sending of the message failed - it is considered catastrophic and
      indicates an error with the device*/
    if ( 0 != uStatus)
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-                "Failed to send indication over the bus - catastrophic failure");
-
+                "Failed to send indication over the bus - catastrophic failure"); 
+#endif
       WDI_DetectedDeviceError( pWDICtx, WDI_ERR_TRANSPORT_FAILURE);
       return WDI_STATUS_E_FAILURE;
    }
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_SendIndication*/
 
 
 /**
- @brief WDI_DetectedDeviceError - called internally by DAL when
-        it has detected a failure in the device
-
- @param  pWDICtx:        pointer to the WLAN DAL context
+ @brief WDI_DetectedDeviceError - called internally by DAL when 
+        it has detected a failure in the device 
+ 
+ @param  pWDICtx:        pointer to the WLAN DAL context 
          usErrorCode:    error code detected by WDI or received
                          from HAL
-
+  
  @see
- @return None
+ @return None 
 */
 void
 WDI_DetectedDeviceError
@@ -19129,10 +19734,11 @@
   WDI_LowLevelIndType  wdiInd;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
             "Device Error detected code: %d - transitioning to stopped state",
             usErrorCode);
-
+#endif
   wpalMutexAcquire(&pWDICtx->wptMutex);
 
   WDI_STATableStop(pWDICtx);
@@ -19144,9 +19750,9 @@
   pWDICtx->ucExpectedStateTransition =  WDI_STOPPED_ST;
 
   /*Transition to stopped to fail all incomming requests from this point on*/
-  WDI_STATE_TRANSITION( pWDICtx, WDI_STOPPED_ST);
+  WDI_STATE_TRANSITION( pWDICtx, WDI_STOPPED_ST); 
 
-  WDI_ClearPendingRequests(pWDICtx);
+  WDI_ClearPendingRequests(pWDICtx); 
 
   /*TO DO: -  there should be an attempt to reset the device here*/
 
@@ -19157,26 +19763,26 @@
   ------------------------------------------------------------------------*/
   if (pWDICtx->wdiLowLevelIndCB)
   {
-     wdiInd.wdiIndicationType             = WDI_FATAL_ERROR_IND;
-     wdiInd.wdiIndicationData.usErrorCode = usErrorCode;
+     wdiInd.wdiIndicationType             = WDI_FATAL_ERROR_IND; 
+     wdiInd.wdiIndicationData.usErrorCode = usErrorCode; 
 
      pWDICtx->wdiLowLevelIndCB( &wdiInd,  pWDICtx->pIndUserData);
   }
 }/*WDI_DetectedDeviceError*/
 
 /**
- @brief    This callback is invoked by the wpt when a timer that
+ @brief    This callback is invoked by the wpt when a timer that 
            we started on send message has expire - this should
            never happen - it means device is stuck and cannot
-           reply - trigger catastrophic failure
- @param
-
+           reply - trigger catastrophic failure 
+ @param 
+    
     pUserData: the callback data of the user (ptr to WDI CB)
-
- @see
- @return None
+    
+ @see 
+ @return None 
 */
-void
+void 
 WDI_ResponseTimerCB
 (
   void *pUserData
@@ -19187,44 +19793,49 @@
 
   if (NULL == pWDICtx )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
     WDI_ASSERT(0);
-    return;
+#endif
+    return; 
   }
 
   if ( WDI_MAX_RESP != pWDICtx->wdiExpectedResponse )
   {
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
             "Timeout occurred while waiting for %s (%d) message from device "
-            " - catastrophic failure",
+            " - catastrophic failure", 
             WDI_getRespMsgString(pWDICtx->wdiExpectedResponse),
             pWDICtx->wdiExpectedResponse);
+#endif
   /* WDI timeout means Riva is not responding or SMD communication to Riva
    * is not happening. The only possible way to recover from this error
    * is to initiate SSR from APPS */
   wpalRivaSubystemRestart();
   }
+#ifdef WLAN_DEBUG
   else
   {
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                 "Timeout occurred but not waiting for any response %d",
+                 "Timeout occurred but not waiting for any response %d", 
                  pWDICtx->wdiExpectedResponse);
   }
-
-  return;
+#endif
+  return; 
 
 }/*WDI_ResponseTimerCB*/
 
 
 /**
- @brief Process response helper function
+ @brief Process response helper function 
 
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
@@ -19237,43 +19848,47 @@
 {
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-  /* Skip sanity check as this is called from the FSM functions which
+  /* Skip sanity check as this is called from the FSM functions which 
     already checked these pointers
     ! - revisit this assumption */
   if (( pEventData->wdiResponse < WDI_MAX_RESP ) &&
       ( NULL != pfnRspProcTbl[pEventData->wdiResponse] ))
-  {
+  {  
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-              "Calling response processing function for resp %s (%d) %x",
+              "Calling response processing function for resp %s (%d) %x", 
               WDI_getRespMsgString(pEventData->wdiResponse),
               pEventData->wdiResponse, pfnRspProcTbl[pEventData->wdiResponse]);
+#endif
     return pfnRspProcTbl[pEventData->wdiResponse](pWDICtx, pEventData);
   }
   else
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "Operation %d is not yet implemented ",
+              "Operation %d is not yet implemented ", 
               pEventData->wdiResponse);
+#endif
     return WDI_STATUS_E_NOT_IMPLEMENT;
   }
 }/*WDI_ProcessResponse*/
 
 
 /*=========================================================================
-                   QUEUE SUPPORT UTILITY FUNCTIONS
+                   QUEUE SUPPORT UTILITY FUNCTIONS 
 =========================================================================*/
 
 /**
- @brief    Utility function used by the DAL Core to help queue a
-           request that cannot be processed right away.
- @param
-
+ @brief    Utility function used by the DAL Core to help queue a 
+           request that cannot be processed right away. 
+ @param 
+    
     pWDICtx: - pointer to the WDI control block
     pEventData: - pointer to the evnt info that needs to be
-    queued
-
- @see
- @return Result of the operation
+    queued 
+    
+ @see 
+ @return Result of the operation  
 */
 WDI_Status
 WDI_QueuePendingReq
@@ -19282,16 +19897,18 @@
   WDI_EventInfoType*     pEventData
 )
 {
-  wpt_list_node*      pNode;
+  wpt_list_node*      pNode; 
   WDI_EventInfoType*  pEventDataQueue = wpalMemoryAllocate(sizeof(*pEventData));
-  void*               pEventInfo = NULL;
+  void*               pEventInfo = NULL; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   if ( NULL ==  pEventDataQueue )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "Cannot allocate memory for queueing");
+              "Cannot allocate memory for queueing"); 
     WDI_ASSERT(0);
+#endif
     return WDI_STATUS_MEM_FAILURE;
   }
 
@@ -19299,54 +19916,56 @@
   pEventDataQueue->pUserData       = pEventData->pUserData;
   pEventDataQueue->uEventDataSize  = pEventData->uEventDataSize;
   pEventDataQueue->wdiRequest      = pEventData->wdiRequest;
-  pEventDataQueue->wdiResponse     = pEventData->wdiResponse;
+  pEventDataQueue->wdiResponse     = pEventData->wdiResponse; 
 
   if( pEventData->uEventDataSize != 0 && pEventData->pEventData != NULL )
   {
      pEventInfo = wpalMemoryAllocate(pEventData->uEventDataSize);
-
+   
      if ( NULL ==  pEventInfo )
      {
+#ifdef WLAN_DEBUG
        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                 "Cannot allocate memory for queueing event data info");
+                 "Cannot allocate memory for queueing event data info"); 
        WDI_ASSERT(0);
+#endif
        wpalMemoryFree(pEventDataQueue);
        return WDI_STATUS_MEM_FAILURE;
      }
-
+   
      wpalMemoryCopy(pEventInfo, pEventData->pEventData, pEventData->uEventDataSize);
 
   }
   pEventDataQueue->pEventData = pEventInfo;
 
   /*Send wpt a pointer to the node (this is the 1st element in the event data)*/
-  pNode = (wpt_list_node*)pEventDataQueue;
+  pNode = (wpt_list_node*)pEventDataQueue; 
 
-  wpal_list_insert_back(&(pWDICtx->wptPendingQueue), pNode);
+  wpal_list_insert_back(&(pWDICtx->wptPendingQueue), pNode); 
 
   return WDI_STATUS_SUCCESS;
 }/*WDI_QueuePendingReq*/
 
 /**
- @brief    Callback function for serializing queued message
+ @brief    Callback function for serializing queued message 
            processing in the control context
- @param
-
-    pMsg - pointer to the message
-
- @see
- @return Result of the operation
+ @param 
+    
+    pMsg - pointer to the message 
+    
+ @see 
+ @return Result of the operation  
 */
-void
+void 
 WDI_PALCtrlMsgCB
 (
  wpt_msg *pMsg
 )
 {
   WDI_EventInfoType*     pEventData = NULL;
-  WDI_ControlBlockType*  pWDICtx    = NULL;
-  WDI_Status             wdiStatus;
-  WDI_ReqStatusCb        pfnReqStatusCB;
+  WDI_ControlBlockType*  pWDICtx    = NULL; 
+  WDI_Status             wdiStatus; 
+  WDI_ReqStatusCb        pfnReqStatusCB; 
   void*                  pUserData;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
@@ -19354,10 +19973,12 @@
       ( NULL == (pEventData = (WDI_EventInfoType*)pMsg->ptr)) ||
       ( NULL == (pWDICtx  = (WDI_ControlBlockType*)pMsg->pContext )))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-              "Invalid message received on serialize ctrl context API");
+              "Invalid message received on serialize ctrl context API"); 
     WDI_ASSERT(0);
-    return;
+#endif
+    return; 
   }
 
   /*Transition back to the state that we had before serialization
@@ -19365,36 +19986,40 @@
   ! TO DO L: possible race condition here if a request comes in between the
    state transition and the post function*/
 
-  WDI_STATE_TRANSITION( pWDICtx, pMsg->val);
+  WDI_STATE_TRANSITION( pWDICtx, pMsg->val); 
 
   /*-----------------------------------------------------------------------
      Check to see what type of event we are serializing
-     - responses are never expected to come through here
+     - responses are never expected to come through here 
   -----------------------------------------------------------------------*/
   switch ( pEventData->wdiRequest )
   {
 
   case WDI_STOP_REQ:
+      
       wdiStatus = WDI_PostMainEvent(&gWDICb, WDI_STOP_EVENT, pEventData);
       break;
 
+
   case WDI_NV_DOWNLOAD_REQ:
       // When WDI State is WDI_STARTED_ST, send WDI request message with event type WDI_REQUEST_EVENT.
       // In this case, because this request is called from response process, we could call WDI_ProcessRequest() directly.
-      if (pWDICtx->uGlobalState == WDI_STARTED_ST)
+      if (pWDICtx->uGlobalState == WDI_STARTED_ST)  
       {
+#ifdef WLAN_DEBUG
         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "%s: WDI_NV_DOWNLOAD_REQ called in WDI_STARTED_ST - send with WDI_REQUEST_EVENT", __FUNCTION__);
+#endif
         wdiStatus = WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, pEventData);
       }
       else
       {
         wdiStatus = WDI_PostMainEvent(&gWDICb, WDI_START_EVENT, pEventData);
       }
-
+      
       break;
 
-  default:
+  default: 
     wdiStatus = WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, pEventData);
     break;
   }/*switch ( pEventData->wdiRequest )*/
@@ -19424,20 +20049,20 @@
   {
      wpalMemoryFree(pMsg);
   }
-
+  
 }/*WDI_PALCtrlMsgCB*/
 
 /**
  @brief    Utility function used by the DAL Core to help dequeue
-           and schedule for execution a pending request
- @param
-
+           and schedule for execution a pending request 
+ @param 
+    
     pWDICtx: - pointer to the WDI control block
     pEventData: - pointer to the evnt info that needs to be
-    queued
-
- @see
- @return Result of the operation
+    queued 
+    
+ @see 
+ @return Result of the operation  
 */
 WDI_Status
 WDI_DequeuePendingReq
@@ -19445,23 +20070,25 @@
   WDI_ControlBlockType*  pWDICtx
 )
 {
-  wpt_list_node*      pNode      = NULL;
+  wpt_list_node*      pNode      = NULL; 
   WDI_EventInfoType*  pEventData;
-  wpt_msg*            palMsg;
+  wpt_msg*            palMsg; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-  wpal_list_remove_front(&(pWDICtx->wptPendingQueue), &pNode);
+  wpal_list_remove_front(&(pWDICtx->wptPendingQueue), &pNode); 
 
   if ( NULL ==  pNode )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "List is empty - return");
+              "List is empty - return"); 
+#endif
     return WDI_STATUS_SUCCESS;
   }
 
   /*The node actually points to the 1st element inside the Event Data struct -
     just cast it back to the struct*/
-  pEventData = (WDI_EventInfoType*)pNode;
+  pEventData = (WDI_EventInfoType*)pNode; 
 
   /*Serialize processing in the control thread
      !TO DO: - check to see if these are all the messages params that need
@@ -19470,21 +20097,23 @@
 
   if ( NULL ==  palMsg )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "WDI_DequeuePendingReq: Cannot allocate memory for palMsg.");
+               "WDI_DequeuePendingReq: Cannot allocate memory for palMsg."); 
     WDI_ASSERT(0);
-    return WDI_STATUS_MEM_FAILURE;
+#endif
+    return WDI_STATUS_MEM_FAILURE; 
   }
-  palMsg->pContext = pWDICtx;
+  palMsg->pContext = pWDICtx; 
   palMsg->callback = WDI_PALCtrlMsgCB;
   palMsg->ptr      = pEventData;
 
   /*Save the global state as we need it on the other side*/
-  palMsg->val      = pWDICtx->uGlobalState;
-
+  palMsg->val      = pWDICtx->uGlobalState; 
+    
   /*Transition back to BUSY as we need to handle a queued request*/
   WDI_STATE_TRANSITION( pWDICtx, WDI_BUSY_ST);
-
+  
   wpalPostCtrlMsg(pWDICtx->pPALContext, palMsg);
 
   return WDI_STATUS_PENDING;
@@ -19492,17 +20121,17 @@
 
 
 /**
- @brief    Utility function used by the DAL Core to help queue
+ @brief    Utility function used by the DAL Core to help queue 
            an association request that cannot be processed right
-           away.- The assoc requests will be queued by BSSID
- @param
-
+           away.- The assoc requests will be queued by BSSID 
+ @param 
+    
     pWDICtx: - pointer to the WDI control block
     pEventData: pointer to the evnt info that needs to be queued
     macBSSID: bssid
-
- @see
- @return Result of the operation
+    
+ @see 
+ @return Result of the operation  
 */
 WDI_Status
 WDI_QueueNewAssocRequest
@@ -19512,58 +20141,62 @@
   wpt_macAddr            macBSSID
 )
 {
-  wpt_uint8 i;
-  WDI_BSSSessionType*     pSession = NULL;
-  wpt_list_node*          pNode;
+  wpt_uint8 i; 
+  WDI_BSSSessionType*     pSession = NULL; 
+  wpt_list_node*          pNode; 
   WDI_EventInfoType*      pEventDataQueue;
-  void*                   pEventInfo;
-  WDI_NextSessionIdType*  pSessionIdElement;
+  void*                   pEventInfo; 
+  WDI_NextSessionIdType*  pSessionIdElement; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+  
 
-
-  /*------------------------------------------------------------------------
-      Search for a session that matches the BSSID
+  /*------------------------------------------------------------------------ 
+      Search for a session that matches the BSSID 
     ------------------------------------------------------------------------*/
   for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
   {
      if ( eWLAN_PAL_FALSE == pWDICtx->aBSSSessions[i].bInUse )
      {
        /*Found an empty session*/
-       pSession = &pWDICtx->aBSSSessions[i];
-       break;
+       pSession = &pWDICtx->aBSSSessions[i]; 
+       break; 
      }
   }
 
   if ( i >=  WDI_MAX_BSS_SESSIONS )
   {
     /*Cannot find any empty sessions*/
-    return WDI_STATUS_E_FAILURE;
+    return WDI_STATUS_E_FAILURE; 
   }
-
+  
   /*------------------------------------------------------------------------
     Fill in the BSSID for this session and set the usage flag
   ------------------------------------------------------------------------*/
   wpalMemoryCopy(pWDICtx->aBSSSessions[i].macBSSID, macBSSID, WDI_MAC_ADDR_LEN);
-  pWDICtx->aBSSSessions[i].bInUse = eWLAN_PAL_TRUE;
+  pWDICtx->aBSSSessions[i].bInUse = eWLAN_PAL_TRUE; 
 
   /*------------------------------------------------------------------------
-    Allocate memory for this and place it in the queue
+    Allocate memory for this and place it in the queue 
   ------------------------------------------------------------------------*/
   pEventDataQueue = (WDI_EventInfoType*)wpalMemoryAllocate(sizeof(WDI_EventInfoType));
   if ( NULL == pEventDataQueue )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "%s: Cannot allocate memory for queue node", __FUNCTION__);
     WDI_ASSERT(0);
+#endif
     return WDI_STATUS_MEM_FAILURE;
   }
 
   pSessionIdElement = (WDI_NextSessionIdType*)wpalMemoryAllocate(sizeof(WDI_NextSessionIdType));
   if ( NULL == pSessionIdElement )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "%s: Cannot allocate memory for session ID", __FUNCTION__);
     WDI_ASSERT(0);
+#endif
     wpalMemoryFree(pEventDataQueue);
     return WDI_STATUS_MEM_FAILURE;
   }
@@ -19571,9 +20204,11 @@
   pEventInfo = wpalMemoryAllocate(pEventData->uEventDataSize);
   if ( NULL == pEventInfo )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "%s: Cannot allocate memory for event data info", __FUNCTION__);
     WDI_ASSERT(0);
+#endif
     wpalMemoryFree(pSessionIdElement);
     wpalMemoryFree(pEventDataQueue);
     return WDI_STATUS_MEM_FAILURE;
@@ -19583,28 +20218,30 @@
   pEventDataQueue->pUserData       = pEventData->pUserData;
   pEventDataQueue->uEventDataSize  = pEventData->uEventDataSize;
   pEventDataQueue->wdiRequest      = pEventData->wdiRequest;
-  pEventDataQueue->wdiResponse     = pEventData->wdiResponse;
+  pEventDataQueue->wdiResponse     = pEventData->wdiResponse; 
 
   wpalMemoryCopy(pEventInfo, pEventData->pEventData, pEventData->uEventDataSize);
   pEventDataQueue->pEventData = pEventInfo;
 
   /*Send wpt a pointer to the node (this is the 1st element in the event data)*/
-  pNode = (wpt_list_node*)pEventDataQueue;
+  pNode = (wpt_list_node*)pEventDataQueue; 
 
   /*This association is currently being queued*/
-  pSession->bAssocReqQueued = eWLAN_PAL_TRUE;
+  pSession->bAssocReqQueued = eWLAN_PAL_TRUE; 
 
-  wpal_list_insert_back(&(pSession->wptPendingQueue), pNode);
+  wpal_list_insert_back(&(pSession->wptPendingQueue), pNode); 
 
   /*We need to maintain a separate list that keeps track of the order in which
   the new assoc requests are being queued such that we can start processing
   them in the order that they had arrived*/
-  pSessionIdElement->ucIndex = i;
-  pNode = (wpt_list_node*)pSessionIdElement;
+  pSessionIdElement->ucIndex = i; 
+  pNode = (wpt_list_node*)pSessionIdElement; 
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
        "Queueing up new assoc session : %d ", pSessionIdElement->ucIndex);
-  wpal_list_insert_back(&pWDICtx->wptPendingAssocSessionIdQueue, pNode);
+#endif
+  wpal_list_insert_back(&pWDICtx->wptPendingAssocSessionIdQueue, pNode); 
 
   /*Return pending as this is what the status of the request is since it has
     been queued*/
@@ -19612,18 +20249,18 @@
 }/*WDI_QueueNewAssocRequest*/
 
 /**
- @brief    Utility function used by the DAL Core to help queue
+ @brief    Utility function used by the DAL Core to help queue 
            an association request that cannot be processed right
-           away.- The assoc requests will be queued by BSSID
- @param
-
+           away.- The assoc requests will be queued by BSSID 
+ @param 
+    
     pWDICtx: - pointer to the WDI control block
     pSession: - session in which to queue
     pEventData: pointer to the event info that needs to be
     queued
-
- @see
- @return Result of the operation
+    
+ @see 
+ @return Result of the operation  
 */
 WDI_Status
 WDI_QueueAssocRequest
@@ -19633,41 +20270,46 @@
   WDI_EventInfoType*     pEventData
 )
 {
-  wpt_list_node*      pNode;
+  wpt_list_node*      pNode; 
   WDI_EventInfoType*  pEventDataQueue;
-  void*               pEventInfo;
+  void*               pEventInfo; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*------------------------------------------------------------------------
+  
+  /*------------------------------------------------------------------------ 
       Sanity check
     ------------------------------------------------------------------------*/
   if (( NULL == pSession ) || ( NULL == pWDICtx ))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
-
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   /*------------------------------------------------------------------------
-    Allocate memory for this and place it in the queue
+    Allocate memory for this and place it in the queue 
   ------------------------------------------------------------------------*/
   pEventDataQueue = (WDI_EventInfoType*)wpalMemoryAllocate(sizeof(WDI_EventInfoType));
   if ( NULL ==  pEventDataQueue )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "%s: Cannot allocate memory for queueing", __FUNCTION__);
+               "%s: Cannot allocate memory for queueing", __FUNCTION__); 
     WDI_ASSERT(0);
+#endif
     return WDI_STATUS_MEM_FAILURE;
   }
 
   pEventInfo = wpalMemoryAllocate(pEventData->uEventDataSize);
   if ( NULL ==  pEventInfo )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "%s: Cannot allocate memory for queueing event data info",
                __FUNCTION__);
     WDI_ASSERT(0);
+#endif
     wpalMemoryFree(pEventDataQueue);
     return WDI_STATUS_MEM_FAILURE;
   }
@@ -19676,18 +20318,18 @@
   pEventDataQueue->pUserData       = pEventData->pUserData;
   pEventDataQueue->uEventDataSize  = pEventData->uEventDataSize;
   pEventDataQueue->wdiRequest      = pEventData->wdiRequest;
-  pEventDataQueue->wdiResponse     = pEventData->wdiResponse;
+  pEventDataQueue->wdiResponse     = pEventData->wdiResponse; 
   pEventDataQueue->pEventData      = pEventInfo;
 
   wpalMemoryCopy(pEventInfo, pEventData->pEventData, pEventData->uEventDataSize);
 
   /*Send wpt a pointer to the node (this is the 1st element in the event data)*/
-  pNode = (wpt_list_node*)pEventDataQueue;
+  pNode = (wpt_list_node*)pEventDataQueue; 
 
   /*This association is currently being queued*/
-  pSession->bAssocReqQueued = eWLAN_PAL_TRUE;
+  pSession->bAssocReqQueued = eWLAN_PAL_TRUE; 
 
-  wpal_list_insert_back(&(pSession->wptPendingQueue), pNode);
+  wpal_list_insert_back(&(pSession->wptPendingQueue), pNode); 
 
   /*The result of this operation is pending because the request has been
     queued and it will be processed at a later moment in time */
@@ -19699,13 +20341,13 @@
            an association request that was pending
            The request will be queued up in front of the main
            pending queue for imediate processing
- @param
-
+ @param 
+    
     pWDICtx: - pointer to the WDI control block
-
-
- @see
- @return Result of the operation
+  
+    
+ @see 
+ @return Result of the operation  
 */
 WDI_Status
 WDI_DequeueAssocRequest
@@ -19713,20 +20355,21 @@
   WDI_ControlBlockType*  pWDICtx
 )
 {
-  wpt_list_node*          pNode = NULL;
-  WDI_NextSessionIdType*  pSessionIdElement;
+  wpt_list_node*          pNode = NULL; 
+  WDI_NextSessionIdType*  pSessionIdElement; 
   WDI_BSSSessionType*     pSession;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-  /*------------------------------------------------------------------------
+  
+  /*------------------------------------------------------------------------ 
       Sanity check
     ------------------------------------------------------------------------*/
   if ( NULL == pWDICtx )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
-
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   /*------------------------------------------------------------------------
@@ -19738,87 +20381,92 @@
     (bc they needed to be processed in order to be placed in this queue)
     => they will be placed at the front of the busy queue
   ------------------------------------------------------------------------*/
-  wpal_list_remove_front(&(pWDICtx->wptPendingAssocSessionIdQueue), &pNode);
+  wpal_list_remove_front(&(pWDICtx->wptPendingAssocSessionIdQueue), &pNode); 
 
   if ( NULL ==  pNode )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
-              "List is empty - return");
+              "List is empty - return"); 
+#endif
     return WDI_STATUS_SUCCESS;
   }
 
   /*The node actually points to the 1st element inside the Session Id struct -
     just cast it back to the struct*/
-  pSessionIdElement = (WDI_NextSessionIdType*)pNode;
+  pSessionIdElement = (WDI_NextSessionIdType*)pNode; 
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
        "Dequeueing new assoc session : %d ", pSessionIdElement->ucIndex);
-
+#endif
   if ( pSessionIdElement->ucIndex < WDI_MAX_BSS_SESSIONS )
   {
       pSession = &pWDICtx->aBSSSessions[pSessionIdElement->ucIndex];
-
+      
       /*Transfer all the pending requests in this assoc queue to
-      the front of the main waiting queue for subsequent execution*/
-      wpal_list_remove_back(&(pSession->wptPendingQueue), &pNode);
+      the front of the main waiting queue for subsequent execution*/      
+      wpal_list_remove_back(&(pSession->wptPendingQueue), &pNode); 
       while ( NULL !=  pNode )
       {
         /*Place it in front of the main pending list*/
-        wpal_list_insert_front( &(pWDICtx->wptPendingQueue), &pNode);
-        wpal_list_remove_back(&(pSession->wptPendingQueue), &pNode);
+        wpal_list_insert_front( &(pWDICtx->wptPendingQueue), &pNode); 
+        wpal_list_remove_back(&(pSession->wptPendingQueue), &pNode); 
       }
       pSession->bAssocReqQueued = eWLAN_PAL_FALSE;
   }
   else
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
-              "Invalid session id queued up for assoc");
+              "Invalid session id queued up for assoc"); 
      WPAL_ASSERT(0);
+#endif
      wpalMemoryFree(pSessionIdElement);
-     return WDI_STATUS_E_FAILURE;
+     return WDI_STATUS_E_FAILURE; 
   }
-
+  
   /*Clean this up as it is no longer needed in order to prevent memory leak*/
   wpalMemoryFree(pSessionIdElement);
   return WDI_STATUS_SUCCESS;
 }/*WDI_DequeueAssocRequest*/
 
 /**
- @brief    Utility function used by the DAL Core to clear any
+ @brief    Utility function used by the DAL Core to clear any 
            pending requests - all req cb will be called with
            failure and the queue will be emptied.
- @param
-
+ @param 
+    
     pWDICtx: - pointer to the WDI control block
-
- @see
- @return Result of the operation
+    
+ @see 
+ @return Result of the operation  
 */
 WDI_Status
 WDI_ClearPendingRequests
-(
+( 
   WDI_ControlBlockType*  pWDICtx
 )
 {
-  wpt_list_node*      pNode = NULL;
+  wpt_list_node*      pNode = NULL; 
   WDI_EventInfoType*  pEventDataQueue = NULL;
-  WDI_ReqStatusCb     pfnReqStatusCB;
+  WDI_ReqStatusCb     pfnReqStatusCB; 
   void*               pUserData;
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-  wpal_list_remove_front(&(pWDICtx->wptPendingQueue), &pNode);
+  wpal_list_remove_front(&(pWDICtx->wptPendingQueue), &pNode); 
 
   /*------------------------------------------------------------------------
     Go through all the requests and fail them - this will only be called
     when device is being stopped or an error was detected - either case the
-    pending requests can no longer be sent down to HAL
+    pending requests can no longer be sent down to HAL 
   ------------------------------------------------------------------------*/
   while( pNode )
   {
       /*The node actually points to the 1st element inside the Event Data struct -
     just cast it back to the struct*/
-    pEventDataQueue = (WDI_EventInfoType*)pNode;
-
+    pEventDataQueue = (WDI_EventInfoType*)pNode; 
+  
     WDI_ExtractRequestCBFromEvent(pEventDataQueue, &pfnReqStatusCB, &pUserData);
     if ( NULL != pfnReqStatusCB )
     {
@@ -19836,26 +20484,26 @@
     {
         break;
     }
-  }
-
+  } 
+ 
   return WDI_STATUS_SUCCESS;
 }/*WDI_ClearPendingRequests*/
 
 /**
- @brief Helper routine used to init the BSS Sessions in the WDI control block
-
-
- @param  pWDICtx:       pointer to the WLAN DAL context
-
+ @brief Helper routine used to init the BSS Sessions in the WDI control block 
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+  
  @see
 */
 void
 WDI_ResetAssocSessions
-(
+( 
   WDI_ControlBlockType*   pWDICtx
 )
 {
-  wpt_uint8 i;
+  wpt_uint8 i; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*-------------------------------------------------------------------------
@@ -19863,7 +20511,7 @@
   -------------------------------------------------------------------------*/
   for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
   {
-    wpalMemoryZero( &pWDICtx->aBSSSessions[i], sizeof(WDI_BSSSessionType) );
+    wpalMemoryZero( &pWDICtx->aBSSSessions[i], sizeof(WDI_BSSSessionType) ); 
     pWDICtx->aBSSSessions[i].wdiAssocState = WDI_ASSOC_INIT_ST;
     pWDICtx->aBSSSessions[i].bcastStaIdx = WDI_STA_INVALID_IDX;
     pWDICtx->aBSSSessions[i].ucBSSIdx = WDI_BSS_INVALID_IDX;
@@ -19871,120 +20519,124 @@
 }/*WDI_ResetAssocSessions*/
 
 /**
- @brief Helper routine used to find a session based on the BSSID
-
-
- @param  pWDICtx:       pointer to the WLAN DAL context
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
          macBSSID:      BSSID of the session
-         pSession:      pointer to the session (if found)
-
+         pSession:      pointer to the session (if found) 
+  
  @see
- @return Index of the session in the array
+ @return Index of the session in the array 
 */
 wpt_uint8
 WDI_FindAssocSession
-(
+( 
   WDI_ControlBlockType*   pWDICtx,
   wpt_macAddr             macBSSID,
   WDI_BSSSessionType**    ppSession
 )
 {
-  wpt_uint8 i;
+  wpt_uint8 i; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if ( NULL == ppSession )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
-     return WDI_MAX_BSS_SESSIONS;
+#endif
+     return WDI_MAX_BSS_SESSIONS; 
   }
 
-  *ppSession = NULL;
+  *ppSession = NULL; 
 
-  /*------------------------------------------------------------------------
-      Search for a session that matches the BSSID
+  /*------------------------------------------------------------------------ 
+      Search for a session that matches the BSSID 
     ------------------------------------------------------------------------*/
   for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
   {
-     if ( eWLAN_PAL_TRUE ==
+     if ( eWLAN_PAL_TRUE == 
           wpalMemoryCompare(pWDICtx->aBSSSessions[i].macBSSID, macBSSID, WDI_MAC_ADDR_LEN) )
      {
        /*Found the session*/
-       *ppSession = &pWDICtx->aBSSSessions[i];
+       *ppSession = &pWDICtx->aBSSSessions[i]; 
        return i;
      }
   }
 
-  return i;
+  return i; 
 }/*WDI_FindAssocSession*/
 
 /**
- @brief Helper routine used to find a session based on the BSSID
-
-
- @param  pWDICtx:   pointer to the WLAN DAL context
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
          ucBSSIdx:  BSS Index of the session
          ppSession: out pointer to the session (if found)
-
+  
  @see
- @return Index of the session in the array
+ @return Index of the session in the array 
 */
 wpt_uint8
 WDI_FindAssocSessionByBSSIdx
-(
+( 
   WDI_ControlBlockType*   pWDICtx,
   wpt_uint16              ucBSSIdx,
   WDI_BSSSessionType**    ppSession
 )
 {
-  wpt_uint8 i;
+  wpt_uint8 i; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if ( NULL == ppSession )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
-     return WDI_MAX_BSS_SESSIONS;
+#endif
+     return WDI_MAX_BSS_SESSIONS; 
   }
 
-  *ppSession = NULL;
+  *ppSession = NULL; 
 
-  /*------------------------------------------------------------------------
-      Search for a session that matches the BSSID
+  /*------------------------------------------------------------------------ 
+      Search for a session that matches the BSSID 
     ------------------------------------------------------------------------*/
   for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
   {
      if ( ucBSSIdx == pWDICtx->aBSSSessions[i].ucBSSIdx )
      {
        /*Found the session*/
-       *ppSession = &pWDICtx->aBSSSessions[i];
+       *ppSession = &pWDICtx->aBSSSessions[i]; 
        return i;
      }
   }
 
-  return i;
+  return i; 
 }/*WDI_FindAssocSessionByBSSIdx*/
 
 /**
- @brief Helper routine used to find a session based on the BSSID
-
-
- @param  pWDICtx:   pointer to the WLAN DAL context
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
          ucBSSIdx:  BSS Index of the session
          ppSession: out pointer to the session (if found)
-
+  
  @see
- @return Index of the session in the array
+ @return Index of the session in the array 
 */
 wpt_uint8
 WDI_FindAssocSessionByIdx
-(
+( 
   WDI_ControlBlockType*   pWDICtx,
   wpt_uint16              usIdx,
   WDI_BSSSessionType**    ppSession
@@ -19993,91 +20645,95 @@
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if ( NULL == ppSession || usIdx >= WDI_MAX_BSS_SESSIONS )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
-     return WDI_MAX_BSS_SESSIONS;
+#endif
+     return WDI_MAX_BSS_SESSIONS; 
   }
 
   /*Found the session*/
-  *ppSession = &pWDICtx->aBSSSessions[usIdx];
+  *ppSession = &pWDICtx->aBSSSessions[usIdx]; 
 
   return usIdx;
-
+  
 }/*WDI_FindAssocSessionByBSSIdx*/
 
 /**
- @brief Helper routine used to find an empty session in the WDI
+ @brief Helper routine used to find an empty session in the WDI 
         CB
-
-
- @param  pWDICtx:       pointer to the WLAN DAL context
-         pSession:      pointer to the session (if found)
-
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+         pSession:      pointer to the session (if found) 
+  
  @see
- @return Index of the session in the array
+ @return Index of the session in the array 
 */
 wpt_uint8
 WDI_FindEmptySession
-(
+( 
   WDI_ControlBlockType*   pWDICtx,
   WDI_BSSSessionType**    ppSession
 )
 {
-  wpt_uint8 i;
+  wpt_uint8 i; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
    /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if ( NULL == ppSession )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
-     return WDI_MAX_BSS_SESSIONS;
+#endif
+     return WDI_MAX_BSS_SESSIONS; 
   }
 
-  *ppSession = NULL;
+  *ppSession = NULL; 
 
-  /*------------------------------------------------------------------------
-      Search for a session that it is not in use
+  /*------------------------------------------------------------------------ 
+      Search for a session that it is not in use 
     ------------------------------------------------------------------------*/
   for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
   {
      if ( ! pWDICtx->aBSSSessions[i].bInUse )
      {
        /*Found a session*/
-       *ppSession = &pWDICtx->aBSSSessions[i];
+       *ppSession = &pWDICtx->aBSSSessions[i]; 
        return i;
      }
   }
 
-  return i;
+  return i; 
 }/*WDI_FindEmptySession*/
 
 
 /**
- @brief Helper routine used to get the total count of active
+ @brief Helper routine used to get the total count of active 
         sessions
-
-
- @param  pWDICtx:       pointer to the WLAN DAL context
-
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+  
  @see
  @return Number of sessions in use
 */
 wpt_uint8
 WDI_GetActiveSessionsCount
-(
+( 
   WDI_ControlBlockType*   pWDICtx
 )
 {
-  wpt_uint8 i, ucCount = 0;
+  wpt_uint8 i, ucCount = 0; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-
-  /*------------------------------------------------------------------------
+  
+  /*------------------------------------------------------------------------ 
       Count all sessions in use
     ------------------------------------------------------------------------*/
   for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
@@ -20088,59 +20744,61 @@
      }
   }
 
-  return ucCount;
+  return ucCount; 
 }/*WDI_GetActiveSessionsCount*/
 
 /**
- @brief Helper routine used to delete session in the WDI
+ @brief Helper routine used to delete session in the WDI 
         CB
-
-
- @param  pWDICtx:       pointer to the WLAN DAL context
-         pSession:      pointer to the session (if found)
-
+  
+ 
+ @param  pWDICtx:       pointer to the WLAN DAL context 
+         pSession:      pointer to the session (if found) 
+  
  @see
- @return Index of the session in the array
+ @return Index of the session in the array 
 */
-void
+void 
 WDI_DeleteSession
-(
+( 
   WDI_ControlBlockType*   pWDICtx,
   WDI_BSSSessionType*     ppSession
 )
 {
    /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if ( NULL == ppSession )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
-     return ;
+#endif
+     return ; 
   }
 
-  /*------------------------------------------------------------------------
-      Reset the entries int session
+  /*------------------------------------------------------------------------ 
+      Reset the entries int session 
     ------------------------------------------------------------------------*/
   wpal_list_destroy(&ppSession->wptPendingQueue);
   wpalMemoryZero(ppSession,  sizeof(*ppSession));
-  ppSession->wdiAssocState = WDI_ASSOC_INIT_ST;
-  ppSession->bInUse        = eWLAN_PAL_FALSE;
+  ppSession->wdiAssocState = WDI_ASSOC_INIT_ST; 
+  ppSession->bInUse        = eWLAN_PAL_FALSE; 
   ppSession->wdiBssType    = WDI_INFRASTRUCTURE_MODE;
   wpal_list_init(&ppSession->wptPendingQueue);
 
 }/*WDI_DeleteSession*/
 
 /**
- @brief    Utility function to add the broadcast STA to the the STA table.
+ @brief    Utility function to add the broadcast STA to the the STA table. 
  The bcast STA ID is assigned by HAL and must be valid.
- @param
-
+ @param 
+    
     WDI_AddStaParams: - pointer to the WDI Add STA params
     usBcastStaIdx: - Broadcast STA index passed by HAL
-
- @see
- @return void
+    
+ @see 
+ @return void 
 */
 void
 WDI_AddBcastSTAtoSTATable
@@ -20159,10 +20817,11 @@
   ---------------------------------------------------------------------*/
   if ( NULL == staParams )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                 "%s: Invalid parameters", __FUNCTION__);
-
-    return;
+#endif
+    return; 
   }
 
   wdiAddSTAParam.bcastDpuIndex = staParams->bcastDpuIndex;
@@ -20180,23 +20839,23 @@
   wdiAddSTAParam.ucStaType = WDI_STA_ENTRY_BCAST;
   wdiAddSTAParam.ucWmmEnabled = staParams->ucWmmEnabled;
   wdiAddSTAParam.ucSTAIdx = usBcastStaIdx;
-
+    
   (void)WDI_STATableAddSta(pWDICtx,&wdiAddSTAParam);
 }
 
 /**
- @brief NV blob will be divided into fragments of size 4kb and
- Sent to HAL
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ @brief NV blob will be divided into fragments of size 4kb and 
+ Sent to HAL 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
  */
 
 WDI_Status WDI_SendNvBlobReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -20212,10 +20871,12 @@
   WDI_NvDownloadRspCb      wdiNvDownloadRspCb;
 
   wdiNvDownloadRspCb = (WDI_NvDownloadRspCb)pEventData->pCBfnc;
+#ifdef WLAN_DEBUG
   WDI_ASSERT(NULL != wdiNvDownloadRspCb);
+#endif
   pwdiNvDownloadReqParams = (WDI_NvDownloadReqParamsType*)pEventData->pEventData;
 
-  /* Sanity Check is done by the caller */
+  /* Sanity Check is done by the caller */ 
   pSrcBuffer =(wpt_uint8 *) pwdiNvDownloadReqParams->wdiBlobInfo.pBlobAddress;
 
   /* Update the current  Fragment Number */
@@ -20227,14 +20888,14 @@
                                      pWDICtx->wdiNvBlobInfo.usCurrentFragment-1;
 
   /*    Divide the NV Image to size of 'FRAGMENT_SIZE' fragments and send it to HAL.
-       If the size of the Image is less than 'FRAGMENT_SIZE' then in one iteration total
+       If the size of the Image is less than 'FRAGMENT_SIZE' then in one iteration total 
        image will be sent to HAL*/
 
-  if(pWDICtx->wdiNvBlobInfo.usTotalFragment
+  if(pWDICtx->wdiNvBlobInfo.usTotalFragment 
                          == pWDICtx->wdiNvBlobInfo.usCurrentFragment)
-  {
+  { 
     /*     Taking care of boundry condition */
-    if( !(usCurrentFragmentSize =
+    if( !(usCurrentFragmentSize = 
                  pwdiNvDownloadReqParams->wdiBlobInfo.uBlobSize%FRAGMENT_SIZE ))
       usCurrentFragmentSize = FRAGMENT_SIZE;
 
@@ -20244,7 +20905,7 @@
 
   }
   else
-  {
+  { 
     usCurrentFragmentSize = FRAGMENT_SIZE;
 
     /*Update the HAL REQ structure */
@@ -20258,18 +20919,20 @@
   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,WDI_NV_DOWNLOAD_REQ,
          sizeof(halNvImgDownloadParam.nvImageReqParams)+ usCurrentFragmentSize,
                     &pSendBuffer, &usDataOffset, &usSendSize))||
-      ( usSendSize <
+      ( usSendSize < 
            (usDataOffset + sizeof(halNvImgDownloadParam.nvImageReqParams) + usCurrentFragmentSize )))
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
          "Unable to get send buffer in NV Download req %x %x ",
          pEventData, pwdiNvDownloadReqParams);
     WDI_ASSERT(0);
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   /* Copying the Hal NV download REQ structure */
-  wpalMemoryCopy(pSendBuffer + usDataOffset ,
+  wpalMemoryCopy(pSendBuffer + usDataOffset , 
     &halNvImgDownloadParam.nvImageReqParams ,sizeof(tHalNvImgDownloadReqParams));
 
   /* Appending the NV image fragment */
@@ -20278,25 +20941,25 @@
                   usCurrentFragmentSize);
 
   pWDICtx->wdiReqStatusCB     = pwdiNvDownloadReqParams->wdiReqStatusCB;
-  pWDICtx->pReqStatusUserData = pwdiNvDownloadReqParams->pUserData;
+  pWDICtx->pReqStatusUserData = pwdiNvDownloadReqParams->pUserData; 
 
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                           wdiNvDownloadRspCb, pEventData->pUserData,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                           wdiNvDownloadRspCb, pEventData->pUserData, 
                            WDI_NV_DOWNLOAD_RESP);
 
 }
-/*============================================================================
-  Helper inline functions for
+/*============================================================================ 
+  Helper inline functions for 
  ============================================================================*/
 /**
- @brief Helper routine used to find a session based on the BSSID
- @param  pContext:   pointer to the WLAN DAL context
- @param  pDPContext:   pointer to the Datapath context
-
+ @brief Helper routine used to find a session based on the BSSID 
+ @param  pContext:   pointer to the WLAN DAL context 
+ @param  pDPContext:   pointer to the Datapath context 
+  
  @see
- @return
+ @return 
 */
-WPT_INLINE void
+WPT_INLINE void 
 WDI_DS_AssignDatapathContext (void *pContext, void *pDPContext)
 {
    WDI_ControlBlockType *pCB = (WDI_ControlBlockType *)pContext;
@@ -20306,56 +20969,56 @@
 }
 
 /**
- @brief Helper routine used to find a session based on the BSSID
-
-
- @param  pContext:   pointer to the WLAN DAL context
-
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pContext:   pointer to the WLAN DAL context 
+  
  @see
  @return pointer to Datapath context
 */
-WPT_INLINE void *
+WPT_INLINE void * 
 WDI_DS_GetDatapathContext (void *pContext)
 {
    WDI_ControlBlockType *pCB = (WDI_ControlBlockType *)pContext;
    return pCB->pDPContext;
 }
 /**
- @brief Helper routine used to find a session based on the BSSID
-
-
- @param  pContext:   pointer to the WLAN DAL context
- @param  pDTDriverContext:   pointer to the Transport Driver context
-
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pContext:   pointer to the WLAN DAL context 
+ @param  pDTDriverContext:   pointer to the Transport Driver context 
+  
  @see
  @return void
 */
-WPT_INLINE void
+WPT_INLINE void  
 WDT_AssignTransportDriverContext (void *pContext, void *pDTDriverContext)
 {
    WDI_ControlBlockType *pCB = (WDI_ControlBlockType *)pContext;
 
    pCB->pDTDriverContext = pDTDriverContext;
-   return;
+   return; 
 }
 
 /**
- @brief Helper routine used to find a session based on the BSSID
-
-
- @param  pWDICtx:   pointer to the WLAN DAL context
-
+ @brief Helper routine used to find a session based on the BSSID 
+  
+ 
+ @param  pWDICtx:   pointer to the WLAN DAL context 
+  
  @see
- @return pointer to datapath context
+ @return pointer to datapath context 
 */
-WPT_INLINE void *
+WPT_INLINE void * 
 WDT_GetTransportDriverContext (void *pContext)
 {
    WDI_ControlBlockType *pCB = (WDI_ControlBlockType *)pContext;
-   return(pCB->pDTDriverContext);
+   return(pCB->pDTDriverContext); 
 }
 
-/*============================================================================
+/*============================================================================ 
   Helper inline converters
  ============================================================================*/
 /*Convert WDI driver type into HAL driver type*/
@@ -20365,7 +21028,7 @@
   eHalStatus halStatus
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch(  halStatus )
   {
@@ -20376,14 +21039,14 @@
   case eHAL_STATUS_FAILURE:
     return WDI_STATUS_E_FAILURE;
   case eHAL_STATUS_FAILED_ALLOC:
-    return WDI_STATUS_MEM_FAILURE;
-   /*The rest of the HAL error codes must be kept hidden from the UMAC as
+    return WDI_STATUS_MEM_FAILURE;    
+   /*The rest of the HAL error codes must be kept hidden from the UMAC as 
      they refer to specific internal modules of our device*/
-  default:
-    return WDI_STATUS_DEV_INTERNAL_FAILURE;
-  }
+  default: 
+    return WDI_STATUS_DEV_INTERNAL_FAILURE; 
+  } 
 
-  return WDI_STATUS_E_FAILURE;
+  return WDI_STATUS_E_FAILURE; 
 }/*WDI_HAL_2_WDI_STATUS*/
 
 /*Convert WDI request type into HAL request type*/
@@ -20393,77 +21056,77 @@
   WDI_RequestEnumType    wdiReqType
 )
 {
-   /*Lightweight function - no sanity checks and no unecessary code to increase
+   /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch(  wdiReqType )
-  {
+  {    
   case WDI_START_REQ:
-    return WLAN_HAL_START_REQ;
+    return WLAN_HAL_START_REQ; 
   case WDI_STOP_REQ:
-    return WLAN_HAL_STOP_REQ;
+    return WLAN_HAL_STOP_REQ; 
   case WDI_INIT_SCAN_REQ:
-    return WLAN_HAL_INIT_SCAN_REQ;
+    return WLAN_HAL_INIT_SCAN_REQ; 
   case WDI_START_SCAN_REQ:
-    return WLAN_HAL_START_SCAN_REQ;
+    return WLAN_HAL_START_SCAN_REQ; 
   case WDI_END_SCAN_REQ:
-    return WLAN_HAL_END_SCAN_REQ;
+    return WLAN_HAL_END_SCAN_REQ; 
   case WDI_FINISH_SCAN_REQ:
-    return WLAN_HAL_FINISH_SCAN_REQ;
+    return WLAN_HAL_FINISH_SCAN_REQ; 
   case WDI_JOIN_REQ:
-    return WLAN_HAL_JOIN_REQ;
+    return WLAN_HAL_JOIN_REQ; 
   case WDI_CONFIG_BSS_REQ:
-    return WLAN_HAL_CONFIG_BSS_REQ;
+    return WLAN_HAL_CONFIG_BSS_REQ; 
   case WDI_DEL_BSS_REQ:
-    return WLAN_HAL_DELETE_BSS_REQ;
+    return WLAN_HAL_DELETE_BSS_REQ; 
   case WDI_POST_ASSOC_REQ:
-    return WLAN_HAL_POST_ASSOC_REQ;
+    return WLAN_HAL_POST_ASSOC_REQ; 
   case WDI_DEL_STA_REQ:
-    return WLAN_HAL_DELETE_STA_REQ;
+    return WLAN_HAL_DELETE_STA_REQ; 
   case WDI_SET_BSS_KEY_REQ:
-    return WLAN_HAL_SET_BSSKEY_REQ;
+    return WLAN_HAL_SET_BSSKEY_REQ; 
   case WDI_RMV_BSS_KEY_REQ:
-    return WLAN_HAL_RMV_BSSKEY_REQ;
+    return WLAN_HAL_RMV_BSSKEY_REQ; 
   case WDI_SET_STA_KEY_REQ:
-    return WLAN_HAL_SET_STAKEY_REQ;
+    return WLAN_HAL_SET_STAKEY_REQ; 
   case WDI_RMV_STA_KEY_REQ:
-    return WLAN_HAL_RMV_STAKEY_REQ;
+    return WLAN_HAL_RMV_STAKEY_REQ; 
   case WDI_SET_STA_BCAST_KEY_REQ:
-    return WLAN_HAL_SET_BCASTKEY_REQ;
+    return WLAN_HAL_SET_BCASTKEY_REQ; 
   case WDI_RMV_STA_BCAST_KEY_REQ:
-    //Some conflict in the old code - check this: return WLAN_HAL_RMV_BCASTKEY_REQ;
+    //Some conflict in the old code - check this: return WLAN_HAL_RMV_BCASTKEY_REQ; 
     return WLAN_HAL_RMV_STAKEY_REQ;
   case WDI_ADD_TS_REQ:
-    return WLAN_HAL_ADD_TS_REQ;
+    return WLAN_HAL_ADD_TS_REQ; 
   case WDI_DEL_TS_REQ:
-    return WLAN_HAL_DEL_TS_REQ;
+    return WLAN_HAL_DEL_TS_REQ; 
   case WDI_UPD_EDCA_PRMS_REQ:
-    return WLAN_HAL_UPD_EDCA_PARAMS_REQ;
+    return WLAN_HAL_UPD_EDCA_PARAMS_REQ; 
   case WDI_ADD_BA_REQ:
-    return WLAN_HAL_ADD_BA_REQ;
+    return WLAN_HAL_ADD_BA_REQ; 
   case WDI_DEL_BA_REQ:
-    return WLAN_HAL_DEL_BA_REQ;
+    return WLAN_HAL_DEL_BA_REQ; 
 #ifdef FEATURE_WLAN_CCX
   case WDI_TSM_STATS_REQ:
-    return WLAN_HAL_TSM_STATS_REQ;
+    return WLAN_HAL_TSM_STATS_REQ; 
 #endif
   case WDI_CH_SWITCH_REQ:
-    return WLAN_HAL_CH_SWITCH_REQ;
+    return WLAN_HAL_CH_SWITCH_REQ; 
   case WDI_CONFIG_STA_REQ:
-    return WLAN_HAL_CONFIG_STA_REQ;
+    return WLAN_HAL_CONFIG_STA_REQ; 
   case WDI_SET_LINK_ST_REQ:
-    return WLAN_HAL_SET_LINK_ST_REQ;
+    return WLAN_HAL_SET_LINK_ST_REQ; 
   case WDI_GET_STATS_REQ:
-    return WLAN_HAL_GET_STATS_REQ;
+    return WLAN_HAL_GET_STATS_REQ; 
   case WDI_UPDATE_CFG_REQ:
-    return WLAN_HAL_UPDATE_CFG_REQ;
+    return WLAN_HAL_UPDATE_CFG_REQ; 
   case WDI_ADD_BA_SESSION_REQ:
     return WLAN_HAL_ADD_BA_SESSION_REQ;
   case WDI_TRIGGER_BA_REQ:
     return WLAN_HAL_TRIGGER_BA_REQ;
   case WDI_UPD_BCON_PRMS_REQ:
-    return WLAN_HAL_UPDATE_BEACON_REQ;
+    return WLAN_HAL_UPDATE_BEACON_REQ; 
   case WDI_SND_BCON_REQ:
-    return WLAN_HAL_SEND_BEACON_REQ;
+    return WLAN_HAL_SEND_BEACON_REQ; 
   case WDI_UPD_PROBE_RSP_TEMPLATE_REQ:
     return WLAN_HAL_UPDATE_PROBE_RSP_TEMPLATE_REQ;
    case WDI_SET_MAX_TX_POWER_REQ:
@@ -20473,25 +21136,25 @@
     return WLAN_HAL_SET_P2P_GONOA_REQ;
 #endif
   case WDI_ENTER_IMPS_REQ:
-    return WLAN_HAL_ENTER_IMPS_REQ;
+    return WLAN_HAL_ENTER_IMPS_REQ; 
   case WDI_EXIT_IMPS_REQ:
-    return WLAN_HAL_EXIT_IMPS_REQ;
+    return WLAN_HAL_EXIT_IMPS_REQ; 
   case WDI_ENTER_BMPS_REQ:
-    return WLAN_HAL_ENTER_BMPS_REQ;
+    return WLAN_HAL_ENTER_BMPS_REQ; 
   case WDI_EXIT_BMPS_REQ:
-    return WLAN_HAL_EXIT_BMPS_REQ;
+    return WLAN_HAL_EXIT_BMPS_REQ; 
   case WDI_ENTER_UAPSD_REQ:
-    return WLAN_HAL_ENTER_UAPSD_REQ;
+    return WLAN_HAL_ENTER_UAPSD_REQ; 
   case WDI_EXIT_UAPSD_REQ:
-    return WLAN_HAL_EXIT_UAPSD_REQ;
+    return WLAN_HAL_EXIT_UAPSD_REQ; 
   case WDI_SET_UAPSD_PARAM_REQ:
-    return WLAN_HAL_SET_UAPSD_AC_PARAMS_REQ;
+    return WLAN_HAL_SET_UAPSD_AC_PARAMS_REQ; 
   case WDI_UPDATE_UAPSD_PARAM_REQ:
-    return WLAN_HAL_UPDATE_UAPSD_PARAM_REQ;
+    return WLAN_HAL_UPDATE_UAPSD_PARAM_REQ; 
   case WDI_CONFIGURE_RXP_FILTER_REQ:
-    return WLAN_HAL_CONFIGURE_RXP_FILTER_REQ;
+    return WLAN_HAL_CONFIGURE_RXP_FILTER_REQ; 
   case WDI_SET_BEACON_FILTER_REQ:
-    return WLAN_HAL_ADD_BCN_FILTER_REQ;
+    return WLAN_HAL_ADD_BCN_FILTER_REQ; 
   case WDI_REM_BEACON_FILTER_REQ:
     return WLAN_HAL_REM_BCN_FILTER_REQ;
   case WDI_SET_RSSI_THRESHOLDS_REQ:
@@ -20551,7 +21214,7 @@
   case WDI_8023_MULTICAST_LIST_REQ:
     return WLAN_HAL_8023_MULTICAST_LIST_REQ;
   case WDI_RECEIVE_FILTER_SET_FILTER_REQ:
-    return WLAN_HAL_SET_PACKET_FILTER_REQ;
+    return WLAN_HAL_SET_PACKET_FILTER_REQ; 
   case WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ:
     return WLAN_HAL_PACKET_FILTER_MATCH_COUNT_REQ;
   case WDI_RECEIVE_FILTER_CLEAR_FILTER_REQ:
@@ -20567,17 +21230,17 @@
 #endif /* WLAN_FEATURE_GTK_OFFLOAD */
 
   case WDI_INIT_SCAN_CON_REQ:
-    return WLAN_HAL_INIT_SCAN_CON_REQ;
+    return WLAN_HAL_INIT_SCAN_CON_REQ; 
   case WDI_SET_POWER_PARAMS_REQ:
-    return WLAN_HAL_SET_POWER_PARAMS_REQ;
+    return WLAN_HAL_SET_POWER_PARAMS_REQ; 
   case WDI_SET_TM_LEVEL_REQ:
-    return WLAN_HAL_SET_THERMAL_MITIGATION_REQ;
+    return WLAN_HAL_SET_THERMAL_MITIGATION_REQ; 
   case WDI_FEATURE_CAPS_EXCHANGE_REQ:
     return WLAN_HAL_FEATURE_CAPS_EXCHANGE_REQ;
   default:
-    return WLAN_HAL_MSG_MAX;
+    return WLAN_HAL_MSG_MAX; 
   }
-
+  
 }/*WDI_2_HAL_REQ_TYPE*/
 
 /*Convert WDI response type into HAL response type*/
@@ -20587,7 +21250,7 @@
   tHalHostMsgType halMsg
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch(  halMsg )
   {
@@ -20689,23 +21352,23 @@
     return WDI_P2P_GO_NOTICE_OF_ABSENCE_RESP;
 #endif
   case WLAN_HAL_ENTER_IMPS_RSP:
-    return WDI_ENTER_IMPS_RESP;
+    return WDI_ENTER_IMPS_RESP; 
   case WLAN_HAL_EXIT_IMPS_RSP:
-    return WDI_EXIT_IMPS_RESP;
+    return WDI_EXIT_IMPS_RESP; 
   case WLAN_HAL_ENTER_BMPS_RSP:
-    return WDI_ENTER_BMPS_RESP;
+    return WDI_ENTER_BMPS_RESP; 
   case WLAN_HAL_EXIT_BMPS_RSP:
-    return WDI_EXIT_BMPS_RESP;
+    return WDI_EXIT_BMPS_RESP; 
   case WLAN_HAL_ENTER_UAPSD_RSP:
-    return WDI_ENTER_UAPSD_RESP;
+    return WDI_ENTER_UAPSD_RESP; 
   case WLAN_HAL_EXIT_UAPSD_RSP:
-    return WDI_EXIT_UAPSD_RESP;
+    return WDI_EXIT_UAPSD_RESP; 
   case WLAN_HAL_SET_UAPSD_AC_PARAMS_RSP:
-    return WDI_SET_UAPSD_PARAM_RESP;
+    return WDI_SET_UAPSD_PARAM_RESP; 
   case WLAN_HAL_UPDATE_UAPSD_PARAM_RSP:
-    return WDI_UPDATE_UAPSD_PARAM_RESP;
+    return WDI_UPDATE_UAPSD_PARAM_RESP; 
   case WLAN_HAL_CONFIGURE_RXP_FILTER_RSP:
-    return WDI_CONFIGURE_RXP_FILTER_RESP;
+    return WDI_CONFIGURE_RXP_FILTER_RESP; 
   case WLAN_HAL_ADD_BCN_FILTER_RSP:
     return WDI_SET_BEACON_FILTER_RESP;
   case WLAN_HAL_REM_BCN_FILTER_RSP:
@@ -20750,7 +21413,7 @@
   case WLAN_HAL_SET_PREF_NETWORK_RSP:
     return WDI_SET_PREF_NETWORK_RESP;
   case WLAN_HAL_SET_RSSI_FILTER_RSP:
-    return WDI_SET_RSSI_FILTER_RESP;
+    return WDI_SET_RSSI_FILTER_RESP; 
   case WLAN_HAL_UPDATE_SCAN_PARAM_RSP:
     return WDI_UPDATE_SCAN_PARAMS_RESP;
   case WLAN_HAL_PREF_NETW_FOUND_IND:
@@ -20794,7 +21457,7 @@
   case WLAN_HAL_FEATURE_CAPS_EXCHANGE_RSP:
       return WDI_FEATURE_CAPS_EXCHANGE_RESP;
   default:
-    return eDRIVER_TYPE_MAX;
+    return eDRIVER_TYPE_MAX; 
   }
 
 }/*HAL_2_WDI_RSP_TYPE*/
@@ -20807,7 +21470,7 @@
   WDI_DriverType wdiDriverType
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch(  wdiDriverType )
   {
@@ -20819,7 +21482,7 @@
     return eDRIVER_TYPE_DVT;
   }
 
-  return eDRIVER_TYPE_MAX;
+  return eDRIVER_TYPE_MAX; 
 }/*WDI_2_HAL_DRV_TYPE*/
 
 
@@ -20830,7 +21493,7 @@
   WDI_StopType wdiDriverType
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch(  wdiDriverType )
   {
@@ -20842,7 +21505,7 @@
     return HAL_STOP_TYPE_RF_KILL;
   }
 
-  return HAL_STOP_TYPE_MAX;
+  return HAL_STOP_TYPE_MAX; 
 }/*WDI_2_HAL_STOP_REASON*/
 
 
@@ -20853,7 +21516,7 @@
   WDI_ScanMode wdiScanMode
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch(  wdiScanMode )
   {
@@ -20864,56 +21527,34 @@
   case WDI_SCAN_MODE_SCAN:
     return eHAL_SYS_MODE_SCAN;
   case WDI_SCAN_MODE_PROMISC:
-    return eHAL_SYS_MODE_PROMISC;
+    return eHAL_SYS_MODE_PROMISC; 
   case WDI_SCAN_MODE_SUSPEND_LINK:
     return eHAL_SYS_MODE_SUSPEND_LINK;
-  case WDI_SCAN_MODE_ROAM_SCAN:
-    return eHAL_SYS_MODE_ROAM_SCAN;
-  case WDI_SCAN_MODE_ROAM_SUSPEND_LINK:
-    return eHAL_SYS_MODE_ROAM_SUSPEND_LINK;
   }
 
-  return eHAL_SYS_MODE_MAX;
+  return eHAL_SYS_MODE_MAX; 
 }/*WDI_2_HAL_SCAN_MODE*/
 
 /*Convert WDI sec ch offset into HAL sec ch offset type*/
-WPT_STATIC WPT_INLINE ePhyChanBondState
+WPT_STATIC WPT_INLINE tSirMacHTSecondaryChannelOffset
 WDI_2_HAL_SEC_CH_OFFSET
 (
   WDI_HTSecondaryChannelOffset wdiSecChOffset
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch(  wdiSecChOffset )
   {
   case WDI_SECONDARY_CHANNEL_OFFSET_NONE:
-    return PHY_SINGLE_CHANNEL_CENTERED;
+    return eHT_SECONDARY_CHANNEL_OFFSET_NONE;
   case WDI_SECONDARY_CHANNEL_OFFSET_UP:
-    return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
+    return eHT_SECONDARY_CHANNEL_OFFSET_UP;
   case WDI_SECONDARY_CHANNEL_OFFSET_DOWN:
-    return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
-#ifdef WLAN_FEATURE_11AC
-  case WDI_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED;
-  case WDI_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED;
-  case WDI_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED;
-  case WDI_CHANNEL_20MHZ_LOW_40MHZ_LOW:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
-  case WDI_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
-  case WDI_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
-  case WDI_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
-     return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
-#endif
-  default:
-      break;
+    return eHT_SECONDARY_CHANNEL_OFFSET_DOWN;
   }
 
-  return PHY_CHANNEL_BONDING_STATE_MAX;
+  return eHT_SECONDARY_CHANNEL_OFFSET_MAX; 
 }/*WDI_2_HAL_SEC_CH_OFFSET*/
 
 /*Convert WDI BSS type into HAL BSS type*/
@@ -20923,7 +21564,7 @@
   WDI_BssType wdiBSSType
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch(  wdiBSSType )
   {
@@ -20936,12 +21577,12 @@
   case WDI_BTAMP_STA_MODE:
     return eSIR_BTAMP_STA_MODE;
   case WDI_BTAMP_AP_MODE:
-    return eSIR_BTAMP_AP_MODE;
+    return eSIR_BTAMP_AP_MODE; 
   case WDI_BSS_AUTO_MODE:
     return eSIR_AUTO_MODE;
   }
 
-  return eSIR_DONOT_USE_BSS_TYPE;
+  return eSIR_DONOT_USE_BSS_TYPE; 
 }/*WDI_2_HAL_BSS_TYPE*/
 
 /*Convert WDI NW type into HAL NW type*/
@@ -20951,7 +21592,7 @@
   WDI_NwType wdiNWType
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch(  wdiNWType )
   {
@@ -20965,7 +21606,7 @@
     return eSIR_11N_NW_TYPE;
   }
 
-  return eSIR_DONOT_USE_NW_TYPE;
+  return eSIR_DONOT_USE_NW_TYPE; 
 }/*WDI_2_HAL_NW_TYPE*/
 
 /*Convert WDI chanel bonding type into HAL cb type*/
@@ -20975,7 +21616,7 @@
   WDI_PhyChanBondState wdiCbState
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch ( wdiCbState )
   {
@@ -20987,27 +21628,8 @@
     return PHY_DOUBLE_CHANNEL_CENTERED;
   case WDI_PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
     return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
-#ifdef WLAN_FEATURE_11AC
-  case WDI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED;
-  case WDI_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED;
-  case WDI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED;
-  case WDI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
-  case WDI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
-  case WDI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
-  case WDI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
-    return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
-#endif
-  case WDI_MAX_CB_STATE:
-  default:
-    break;
   }
-
+  
   return PHY_CHANNEL_BONDING_STATE_MAX;
 }/*WDI_2_HAL_CB_STATE*/
 
@@ -21018,7 +21640,7 @@
   WDI_HTOperatingMode wdiHTOperMode
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch ( wdiHTOperMode )
   {
@@ -21031,7 +21653,7 @@
   case WDI_HT_OP_MODE_MIXED:
     return eSIR_HT_OP_MODE_MIXED;
   }
-
+  
   return eSIR_HT_OP_MODE_MAX;
 }/*WDI_2_HAL_HT_OPER_MODE*/
 
@@ -21042,7 +21664,7 @@
   WDI_HTMIMOPowerSaveState wdiHTOperMode
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch ( wdiHTOperMode )
   {
@@ -21055,7 +21677,7 @@
   case WDI_HT_MIMO_PS_NO_LIMIT:
     return eSIR_HT_MIMO_PS_NO_LIMIT;
   }
-
+  
   return eSIR_HT_MIMO_PS_MAX;
 }/*WDI_2_HAL_MIMO_PS*/
 
@@ -21066,7 +21688,7 @@
   WDI_EncryptType wdiEncType
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch ( wdiEncType )
   {
@@ -21104,7 +21726,7 @@
   WDI_WepType  wdiWEPType
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch ( wdiWEPType )
   {
@@ -21114,7 +21736,7 @@
   case WDI_WEP_DYNAMIC:
     return eSIR_WEP_DYNAMIC;
   }
-
+  
   return eSIR_WEP_MAX;
 }/*WDI_2_HAL_WEP_TYPE*/
 
@@ -21124,7 +21746,7 @@
   WDI_LinkStateType  wdiLinkState
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
   switch ( wdiLinkState )
   {
@@ -21177,35 +21799,27 @@
 
   default:
     return eSIR_LINK_MAX;
-  }
+  }  
 }
 
-/*Translate a STA Context from WDI into HAL*/
-WPT_STATIC WPT_INLINE
+/*Translate a STA Context from WDI into HAL*/ 
+WPT_STATIC WPT_INLINE 
 void
 WDI_CopyWDIStaCtxToHALStaCtx
-(
+( 
   tConfigStaParams*          phalConfigSta,
   WDI_ConfigStaReqInfoType*  pwdiConfigSta
 )
 {
    wpt_uint8 i;
-#ifdef WLAN_FEATURE_11AC
-   /* Get the Version 1 Handler */
-   tConfigStaParams_V1* phalConfigSta_V1 = NULL;
-   if (WDI_getFwWlanFeatCaps(DOT11AC))
-   {
-	   phalConfigSta_V1 = (tConfigStaParams_V1*)phalConfigSta;
-   }
-#endif
-   /*Lightweight function - no sanity checks and no unecessary code to increase
+   /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
 
-  wpalMemoryCopy(phalConfigSta->bssId,
-                  pwdiConfigSta->macBSSID, WDI_MAC_ADDR_LEN);
-
-  wpalMemoryCopy(phalConfigSta->staMac,
-                  pwdiConfigSta->macSTA, WDI_MAC_ADDR_LEN);
+  wpalMemoryCopy(phalConfigSta->bssId, 
+                  pwdiConfigSta->macBSSID, WDI_MAC_ADDR_LEN); 
+  
+  wpalMemoryCopy(phalConfigSta->staMac, 
+                  pwdiConfigSta->macSTA, WDI_MAC_ADDR_LEN); 
 
   phalConfigSta->assocId                 = pwdiConfigSta->usAssocId;
   phalConfigSta->staType                 = pwdiConfigSta->wdiSTAType;
@@ -21230,19 +21844,19 @@
   phalConfigSta->us32MaxAmpduDuration    = pwdiConfigSta->us32MaxAmpduDuratio;
   phalConfigSta->fDsssCckMode40Mhz       = pwdiConfigSta->ucDsssCckMode40Mhz;
   phalConfigSta->encryptType             = pwdiConfigSta->ucEncryptType;
-
+  
   phalConfigSta->mimoPS = WDI_2_HAL_MIMO_PS(pwdiConfigSta->wdiMIMOPS);
 
-  phalConfigSta->supportedRates.opRateMode =
+  phalConfigSta->supportedRates.opRateMode = 
                           pwdiConfigSta->wdiSupportedRates.opRateMode;
   for(i = 0; i < SIR_NUM_11B_RATES; i ++)
   {
-     phalConfigSta->supportedRates.llbRates[i] =
+     phalConfigSta->supportedRates.llbRates[i] = 
                           pwdiConfigSta->wdiSupportedRates.llbRates[i];
   }
   for(i = 0; i < SIR_NUM_11A_RATES; i ++)
   {
-     phalConfigSta->supportedRates.llaRates[i] =
+     phalConfigSta->supportedRates.llaRates[i] = 
                           pwdiConfigSta->wdiSupportedRates.llaRates[i];
   }
   for(i = 0; i < SIR_NUM_POLARIS_RATES; i ++)
@@ -21250,48 +21864,31 @@
      phalConfigSta->supportedRates.aniLegacyRates[i] =
                           pwdiConfigSta->wdiSupportedRates.aLegacyRates[i];
   }
-  phalConfigSta->supportedRates.aniEnhancedRateBitmap =
+  phalConfigSta->supportedRates.aniEnhancedRateBitmap = 
                           pwdiConfigSta->wdiSupportedRates.uEnhancedRateBitmap;
   for(i = 0; i < SIR_MAC_MAX_SUPPORTED_MCS_SET; i ++)
   {
-     phalConfigSta->supportedRates.supportedMCSSet[i] =
+     phalConfigSta->supportedRates.supportedMCSSet[i] = 
                           pwdiConfigSta->wdiSupportedRates.aSupportedMCSSet[i];
   }
   phalConfigSta->supportedRates.rxHighestDataRate =
                           pwdiConfigSta->wdiSupportedRates.aRxHighestDataRate;
 
-#ifdef WLAN_FEATURE_11AC
-  if(phalConfigSta_V1 != NULL)
-  {
-	  phalConfigSta_V1->supportedRates.vhtRxMCSMap = pwdiConfigSta->wdiSupportedRates.vhtRxMCSMap;
-	  phalConfigSta_V1->supportedRates.vhtRxHighestDataRate = pwdiConfigSta->wdiSupportedRates.vhtRxHighestDataRate;
-	  phalConfigSta_V1->supportedRates.vhtTxMCSMap = pwdiConfigSta->wdiSupportedRates.vhtTxMCSMap;
-	  phalConfigSta_V1->supportedRates.vhtTxHighestDataRate = pwdiConfigSta->wdiSupportedRates.vhtTxHighestDataRate;
-  }
-#endif
-
 #ifdef WLAN_FEATURE_P2P
   phalConfigSta->p2pCapableSta = pwdiConfigSta->ucP2pCapableSta ;
 #endif
 
-#ifdef WLAN_FEATURE_11AC
-  if(phalConfigSta_V1 != NULL)
-  {
-	  phalConfigSta_V1->vhtCapable = pwdiConfigSta->ucVhtCapableSta;
-	  phalConfigSta_V1->vhtTxChannelWidthSet = pwdiConfigSta->ucVhtTxChannelWidthSet;
-  }
-#endif
 }/*WDI_CopyWDIStaCtxToHALStaCtx*/;
-
-/*Translate a Rate set info from WDI into HAL*/
-WPT_STATIC WPT_INLINE void
+ 
+/*Translate a Rate set info from WDI into HAL*/ 
+WPT_STATIC WPT_INLINE void 
 WDI_CopyWDIRateSetToHALRateSet
-(
+( 
   tSirMacRateSet* pHalRateSet,
   WDI_RateSet*    pwdiRateSet
 )
 {
-  wpt_uint8 i;
+  wpt_uint8 i; 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
   pHalRateSet->numRates = ( pwdiRateSet->ucNumRates <= SIR_MAC_RATESET_EID_MAX )?
@@ -21301,19 +21898,19 @@
   {
     pHalRateSet->rate[i] = pwdiRateSet->aRates[i];
   }
-
+  
 }/*WDI_CopyWDIRateSetToHALRateSet*/
 
 
 /*Translate an EDCA Parameter Record from WDI into HAL*/
 WPT_STATIC WPT_INLINE void
 WDI_CopyWDIEDCAParamsToHALEDCAParams
-(
+( 
   tSirMacEdcaParamRecord* phalEdcaParam,
   WDI_EdcaParamRecord*    pWDIEdcaParam
 )
 {
-  /*Lightweight function - no sanity checks and no unecessary code to increase
+  /*Lightweight function - no sanity checks and no unecessary code to increase 
     the chances of getting inlined*/
 
   phalEdcaParam->aci.rsvd   = pWDIEdcaParam->wdiACI.rsvd;
@@ -21350,11 +21947,11 @@
   pmacMgmtHdr->durationLo =  pwdiMacMgmtHdr->durationLo;
   pmacMgmtHdr->durationHi =  pwdiMacMgmtHdr->durationHi;
 
-  wpalMemoryCopy(pmacMgmtHdr->da,
+  wpalMemoryCopy(pmacMgmtHdr->da, 
                  pwdiMacMgmtHdr->da, 6);
-  wpalMemoryCopy(pmacMgmtHdr->sa,
+  wpalMemoryCopy(pmacMgmtHdr->sa, 
                  pwdiMacMgmtHdr->sa, 6);
-  wpalMemoryCopy(pmacMgmtHdr->bssId,
+  wpalMemoryCopy(pmacMgmtHdr->bssId, 
                  pwdiMacMgmtHdr->bssId, 6);
 
   pmacMgmtHdr->seqControl.fragNum  =  pwdiMacMgmtHdr->seqControl.fragNum;
@@ -21374,13 +21971,6 @@
 {
 
   wpt_uint8 keyIndex = 0;
-#ifdef WLAN_FEATURE_11AC
-  /* Get the Version 1 Handler */
-  tConfigBssParams_V1* phalConfigBSS_V1 = NULL;
-  if (WDI_getFwWlanFeatCaps(DOT11AC))
-	  phalConfigBSS_V1 = (tConfigBssParams_V1*)phalConfigBSS;
-#endif
-
   wpalMemoryCopy( phalConfigBSS->bssId,
                   pwdiConfigBSS->macBSSID,
                   WDI_MAC_ADDR_LEN);
@@ -21396,14 +21986,14 @@
   phalConfigBSS->operMode = pwdiConfigBSS->ucOperMode;
   phalConfigBSS->nwType   = WDI_2_HAL_NW_TYPE(pwdiConfigBSS->wdiNWType);
 
-  phalConfigBSS->shortSlotTimeSupported =
+  phalConfigBSS->shortSlotTimeSupported = 
      pwdiConfigBSS->ucShortSlotTimeSupported;
   phalConfigBSS->llaCoexist         = pwdiConfigBSS->ucllaCoexist;
   phalConfigBSS->llbCoexist         = pwdiConfigBSS->ucllbCoexist;
   phalConfigBSS->llgCoexist         = pwdiConfigBSS->ucllgCoexist;
   phalConfigBSS->ht20Coexist        = pwdiConfigBSS->ucHT20Coexist;
   phalConfigBSS->llnNonGFCoexist    = pwdiConfigBSS->ucllnNonGFCoexist;
-  phalConfigBSS->fLsigTXOPProtectionFullSupport =
+  phalConfigBSS->fLsigTXOPProtectionFullSupport = 
     pwdiConfigBSS->ucTXOPProtectionFullSupport;
   phalConfigBSS->fRIFSMode          = pwdiConfigBSS->ucRIFSMode;
   phalConfigBSS->beaconInterval     = pwdiConfigBSS->usBeaconInterval;
@@ -21416,8 +22006,8 @@
   phalConfigBSS->obssProtEnabled    = pwdiConfigBSS->ucObssProtEnabled;
   phalConfigBSS->rmfEnabled         = pwdiConfigBSS->ucRMFEnabled;
 
-  phalConfigBSS->htOperMode =
-    WDI_2_HAL_HT_OPER_MODE(pwdiConfigBSS->wdiHTOperMod);
+  phalConfigBSS->htOperMode = 
+    WDI_2_HAL_HT_OPER_MODE(pwdiConfigBSS->wdiHTOperMod); 
 
   phalConfigBSS->dualCTSProtection        = pwdiConfigBSS->ucDualCTSProtection;
   phalConfigBSS->ucMaxProbeRespRetryLimit = pwdiConfigBSS->ucMaxProbeRespRetryLimit;
@@ -21430,16 +22020,16 @@
 
   /*! Used 32 as magic number because that is how the ssid is declared inside the
    hal header - hal needs a macro for it */
-  phalConfigBSS->ssId.length =
+  phalConfigBSS->ssId.length = 
     (pwdiConfigBSS->wdiSSID.ucLength <= 32)?
     pwdiConfigBSS->wdiSSID.ucLength : 32;
   wpalMemoryCopy(phalConfigBSS->ssId.ssId,
-                 pwdiConfigBSS->wdiSSID.sSSID,
-                 phalConfigBSS->ssId.length);
+                 pwdiConfigBSS->wdiSSID.sSSID, 
+                 phalConfigBSS->ssId.length); 
 
   WDI_CopyWDIStaCtxToHALStaCtx( &phalConfigBSS->staContext,
                                 &pwdiConfigBSS->wdiSTAContext);
-
+  
   WDI_CopyWDIRateSetToHALRateSet( &phalConfigBSS->rateSet,
                                   &pwdiConfigBSS->wdiRateSet);
 
@@ -21457,24 +22047,24 @@
                                            &pwdiConfigBSS->wdiVOEDCAParams);
   }
 
-  phalConfigBSS->halPersona = pwdiConfigBSS->ucPersona;
+  phalConfigBSS->halPersona = pwdiConfigBSS->ucPersona; 
 
   phalConfigBSS->bSpectrumMgtEnable = pwdiConfigBSS->bSpectrumMgtEn;
 
 #ifdef WLAN_FEATURE_VOWIFI_11R
 
-  phalConfigBSS->extSetStaKeyParamValid =
+  phalConfigBSS->extSetStaKeyParamValid = 
      pwdiConfigBSS->bExtSetStaKeyParamValid;
-
+  
   if( phalConfigBSS->extSetStaKeyParamValid )
   {
      /*-----------------------------------------------------------------------
        Copy the STA Key parameters into the HAL message
      -----------------------------------------------------------------------*/
-     phalConfigBSS->extSetStaKeyParam.encType =
+     phalConfigBSS->extSetStaKeyParam.encType = 
         WDI_2_HAL_ENC_TYPE (pwdiConfigBSS->wdiExtSetKeyParam.wdiEncType);
 
-     phalConfigBSS->extSetStaKeyParam.wepType =
+     phalConfigBSS->extSetStaKeyParam.wepType = 
         WDI_2_HAL_WEP_TYPE (pwdiConfigBSS->wdiExtSetKeyParam.wdiWEPType );
 
      phalConfigBSS->extSetStaKeyParam.staIdx = pwdiConfigBSS->wdiExtSetKeyParam.ucSTAIdx;
@@ -21487,68 +22077,60 @@
      for(keyIndex = 0; keyIndex < pwdiConfigBSS->wdiExtSetKeyParam.ucNumKeys ;
           keyIndex++)
      {
-        phalConfigBSS->extSetStaKeyParam.key[keyIndex].keyId =
+        phalConfigBSS->extSetStaKeyParam.key[keyIndex].keyId = 
            pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].keyId;
         phalConfigBSS->extSetStaKeyParam.key[keyIndex].unicast =
            pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].unicast;
         phalConfigBSS->extSetStaKeyParam.key[keyIndex].keyDirection =
            pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].keyDirection;
         wpalMemoryCopy(phalConfigBSS->extSetStaKeyParam.key[keyIndex].keyRsc,
-                       pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].keyRsc,
+                       pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].keyRsc, 
                        WDI_MAX_KEY_RSC_LEN);
-        phalConfigBSS->extSetStaKeyParam.key[keyIndex].paeRole =
+        phalConfigBSS->extSetStaKeyParam.key[keyIndex].paeRole = 
            pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].paeRole;
-        phalConfigBSS->extSetStaKeyParam.key[keyIndex].keyLength =
+        phalConfigBSS->extSetStaKeyParam.key[keyIndex].keyLength = 
            pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].keyLength;
         wpalMemoryCopy(phalConfigBSS->extSetStaKeyParam.key[keyIndex].key,
-                       pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].key,
+                       pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[keyIndex].key, 
                        WDI_MAX_KEY_LENGTH);
      }
 #else
-     phalConfigBSS->extSetStaKeyParam.key.keyId =
+     phalConfigBSS->extSetStaKeyParam.key.keyId = 
         pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].keyId;
      phalConfigBSS->extSetStaKeyParam.key.unicast =
         pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].unicast;
      phalConfigBSS->extSetStaKeyParam.key.keyDirection =
         pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].keyDirection;
      wpalMemoryCopy(phalConfigBSS->extSetStaKeyParam.key.keyRsc,
-                    pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].keyRsc,
+                    pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].keyRsc, 
                     WDI_MAX_KEY_RSC_LEN);
-     phalConfigBSS->extSetStaKeyParam.key.paeRole =
+     phalConfigBSS->extSetStaKeyParam.key.paeRole = 
         pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].paeRole;
-     phalConfigBSS->extSetStaKeyParam.key.keyLength =
+     phalConfigBSS->extSetStaKeyParam.key.keyLength = 
         pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].keyLength;
      wpalMemoryCopy(phalConfigBSS->extSetStaKeyParam.key.key,
-                    pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].key,
+                    pwdiConfigBSS->wdiExtSetKeyParam.wdiKey[0].key, 
                     WDI_MAX_KEY_LENGTH);
 #endif
   }
   else/* phalConfigBSS->extSetStaKeyParamValid is not set */
   {
-     wpalMemoryZero( &phalConfigBSS->extSetStaKeyParam,
+     wpalMemoryZero( &phalConfigBSS->extSetStaKeyParam, 
                      sizeof(phalConfigBSS->extSetStaKeyParam) );
   }
 
 #endif /*WLAN_FEATURE_VOWIFI_11R*/
 
-#ifdef WLAN_FEATURE_11AC
-  if(phalConfigBSS_V1 != NULL)
-  {
-      phalConfigBSS_V1->vhtCapable = pwdiConfigBSS->ucVhtCapableSta;
-      phalConfigBSS_V1->vhtTxChannelWidthSet = pwdiConfigBSS->ucVhtTxChannelWidthSet;
-  }
-#endif
-
 }/*WDI_CopyWDIConfigBSSToHALConfigBSS*/
 
 
-/*Extract the request CB function and user data from a request structure
+/*Extract the request CB function and user data from a request structure 
   pointed to by user data */
 WPT_STATIC WPT_INLINE void
 WDI_ExtractRequestCBFromEvent
 (
   WDI_EventInfoType* pEvent,
-  WDI_ReqStatusCb*   ppfnReqCB,
+  WDI_ReqStatusCb*   ppfnReqCB, 
   void**             ppUserData
 )
 {
@@ -21709,7 +22291,7 @@
   case  WDI_REM_BEACON_FILTER_REQ:
     *ppfnReqCB   =  ((WDI_RemBeaconFilterReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
     *ppUserData  =  ((WDI_RemBeaconFilterReqParamsType*)pEvent->pEventData)->pUserData;
-     break;
+     break; 
   case  WDI_SET_RSSI_THRESHOLDS_REQ:
     *ppfnReqCB   =  ((WDI_SetRSSIThresholdsReqParamsType*)pEvent->pEventData)->wdiReqStatusCB;
     *ppUserData  =  ((WDI_SetRSSIThresholdsReqParamsType*)pEvent->pEventData)->pUserData;
@@ -21752,42 +22334,43 @@
   default:
     *ppfnReqCB   =  NULL;
     *ppUserData  =  NULL;
-      break;
+      break; 
   }
 }/*WDI_ExtractRequestCBFromEvent*/
 
 
 /**
- @brief WDI_IsHwFrameTxTranslationCapable checks to see if HW
+ @brief WDI_IsHwFrameTxTranslationCapable checks to see if HW 
         frame xtl is enabled for a particular STA.
 
  WDI_PostAssocReq must have been called.
 
- @param uSTAIdx: STA index
-
+ @param uSTAIdx: STA index 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-wpt_boolean
+wpt_boolean 
 WDI_IsHwFrameTxTranslationCapable
 (
   wpt_uint8 uSTAIdx
 )
 {
-  /*!! FIX ME - this must eventually be per station - for now just feedback
+  /*!! FIX ME - this must eventually be per station - for now just feedback 
     uma value*/
   /*------------------------------------------------------------------------
-    Sanity Check
+    Sanity Check 
   ------------------------------------------------------------------------*/
   if ( eWLAN_PAL_FALSE == gWDIInitialized )
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
               "WDI API call before module is initialized - Fail request");
-
-    return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+    return WDI_STATUS_E_NOT_ALLOWED; 
   }
 
-
+  
   return gWDICb.bFrameTransEnabled;
 }/*WDI_IsHwFrameTxTranslationCapable*/
 
@@ -21795,19 +22378,19 @@
 /**
  @brief WDI_SetPreferredNetworkList
 
- @param pwdiPNOScanReqParams: the Set PNO as specified
+ @param pwdiPNOScanReqParams: the Set PNO as specified 
                       by the Device Interface
-
+  
         wdiPNOScanCb: callback for passing back the response
         of the Set PNO operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetPreferredNetworkReq
 (
   WDI_PNOScanReqParamsType* pwdiPNOScanReqParams,
@@ -21819,23 +22402,24 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_SET_PREF_NETWORK_REQ;
-   wdiEventData.pEventData      = pwdiPNOScanReqParams;
+   wdiEventData.pEventData      = pwdiPNOScanReqParams; 
    wdiEventData.uEventDataSize  = sizeof(*pwdiPNOScanReqParams);
-   wdiEventData.pCBfnc          = wdiPNOScanCb;
+   wdiEventData.pCBfnc          = wdiPNOScanCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -21845,19 +22429,19 @@
 /**
  @brief WDI_SetRssiFilterReq
 
- @param pwdiRssiFilterReqParams: the Set RSSI Filter as
+ @param pwdiRssiFilterReqParams: the Set RSSI Filter as 
                       specified by the Device Interface
-
+  
         wdiRssiFilterCb: callback for passing back the response
         of the Set RSSI Filter operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetRssiFilterReq
 (
   WDI_SetRssiFilterReqParamsType* pwdiRssiFilterReqParams,
@@ -21869,23 +22453,24 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_SET_RSSI_FILTER_REQ;
-   wdiEventData.pEventData      = pwdiRssiFilterReqParams;
+   wdiEventData.pEventData      = pwdiRssiFilterReqParams; 
    wdiEventData.uEventDataSize  = sizeof(*pwdiRssiFilterReqParams);
-   wdiEventData.pCBfnc          = wdiRssiFilterCb;
+   wdiEventData.pCBfnc          = wdiRssiFilterCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -21894,19 +22479,19 @@
 /**
  @brief WDI_UpdateScanParamsReq
 
- @param pwdiUpdateScanParamsInfoType: the Update Scan Params as specified
+ @param pwdiUpdateScanParamsInfoType: the Update Scan Params as specified 
                       by the Device Interface
-
+  
         wdiUpdateScanParamsCb: callback for passing back the response
         of the Set PNO operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_UpdateScanParamsReq
 (
   WDI_UpdateScanParamsInfoType* pwdiUpdateScanParamsInfoType,
@@ -21918,38 +22503,39 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_UPDATE_SCAN_PARAMS_REQ;
-   wdiEventData.pEventData      = pwdiUpdateScanParamsInfoType;
+   wdiEventData.pEventData      = pwdiUpdateScanParamsInfoType; 
    wdiEventData.uEventDataSize  = sizeof(*pwdiUpdateScanParamsInfoType);
-   wdiEventData.pCBfnc          = wdiUpdateScanParamsCb;
+   wdiEventData.pCBfnc          = wdiUpdateScanParamsCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
 
 /**
- @brief Helper function to pack Set Preferred Network List
+ @brief Helper function to pack Set Preferred Network List 
         Request parameters
-
- @param  pWDICtx:         pointer to the WLAN DAL context
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
          pwdiPNOScanReqParams:      pointer to the info received
          from upper layers
          ppSendBuffer, pSize - out pointers of the packed buffer
-         and its size
-
+         and its size 
+  
  @return Result of the function call
 */
 
@@ -21962,146 +22548,153 @@
   wpt_uint16*                pSize
 )
 {
-   wpt_uint8*                 pSendBuffer           = NULL;
+   wpt_uint8*                 pSendBuffer           = NULL; 
    wpt_uint16                 usDataOffset          = 0;
    wpt_uint16                 usSendSize            = 0;
-   tpPrefNetwListParams       pPrefNetwListParams   = NULL;
+   tPrefNetwListParams        pPrefNetwListParams = {0};
    wpt_uint8 i;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
+
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_PREF_NETWORK_REQ,
-                         sizeof(tPrefNetwListParams),
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_PREF_NETWORK_REQ, 
+                         sizeof(pPrefNetwListParams),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
-       ( usSendSize < (usDataOffset + sizeof(tPrefNetwListParams) )))
+       ( usSendSize < (usDataOffset + sizeof(pPrefNetwListParams) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in Set PNO req %x ",
                    pwdiPNOScanReqParams);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   pPrefNetwListParams = (tpPrefNetwListParams)(pSendBuffer + usDataOffset);
-
    /*-------------------------------------------------------------------------
      Fill prefNetwListParams from pwdiPNOScanReqParams->wdiPNOScanInfo
    -------------------------------------------------------------------------*/
-   pPrefNetwListParams->enable  = 
+   pPrefNetwListParams.enable  = 
      pwdiPNOScanReqParams->wdiPNOScanInfo.bEnable;
-   pPrefNetwListParams->modePNO = 
+   pPrefNetwListParams.modePNO = 
      pwdiPNOScanReqParams->wdiPNOScanInfo.wdiModePNO;
 
-   pPrefNetwListParams->ucNetworksCount = 
-     (pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount <
+   pPrefNetwListParams.ucNetworksCount = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount < 
       WLAN_HAL_PNO_MAX_SUPP_NETWORKS)?
-     pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount :
+     pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount : 
       WLAN_HAL_PNO_MAX_SUPP_NETWORKS;
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "WDI SET PNO: Enable %d, Mode %d, Netw Count %d",
+               "WDI SET PNO: Enable %d, Mode %d, Netw Count %d", 
                pwdiPNOScanReqParams->wdiPNOScanInfo.bEnable,
                pwdiPNOScanReqParams->wdiPNOScanInfo.wdiModePNO,
                pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount);
-
-   for ( i = 0; i < pPrefNetwListParams->ucNetworksCount; i++ )
+#endif
+   for ( i = 0; i < pPrefNetwListParams.ucNetworksCount; i++ )
    {
      /*SSID of the BSS*/
-     pPrefNetwListParams->aNetworks[i].ssId.length
+     pPrefNetwListParams.aNetworks[i].ssId.length
         = pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ssId.ucLength;
 
-     wpalMemoryCopy( pPrefNetwListParams->aNetworks[i].ssId.ssId,
+     wpalMemoryCopy( pPrefNetwListParams.aNetworks[i].ssId.ssId,
           pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ssId.sSSID,
-          pPrefNetwListParams->aNetworks[i].ssId.length);
+          pPrefNetwListParams.aNetworks[i].ssId.length);
 
      /*Authentication type for the network*/
-     pPrefNetwListParams->aNetworks[i].authentication = 
-       (tAuthType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiAuth;
+     pPrefNetwListParams.aNetworks[i].authentication = 
+       (tAuthType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiAuth; 
 
      /*Encryption type for the network*/
-     pPrefNetwListParams->aNetworks[i].encryption = 
-       (tEdType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiEncryption;
+     pPrefNetwListParams.aNetworks[i].encryption = 
+       (tEdType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiEncryption; 
 
-     /*Indicate the channel on which the Network can be found
+     /*Indicate the channel on which the Network can be found 
        0 - if all channels */
-     pPrefNetwListParams->aNetworks[i].ucChannelCount =
-       (pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ucChannelCount <
-        WLAN_HAL_PNO_MAX_NETW_CHANNELS)?
-       pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ucChannelCount :
-        WLAN_HAL_PNO_MAX_NETW_CHANNELS;
+     pPrefNetwListParams.aNetworks[i].ucChannelCount = 
+       pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ucChannelCount;
 
-     wpalMemoryCopy(pPrefNetwListParams->aNetworks[i].aChannels,
+     wpalMemoryCopy(pPrefNetwListParams.aNetworks[i].aChannels,
                     pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].aChannels,
-                    pPrefNetwListParams->aNetworks[i].ucChannelCount);
+                    pPrefNetwListParams.aNetworks[i].ucChannelCount);
 
      /*Indicates the RSSI threshold for the network to be considered*/
-     pPrefNetwListParams->aNetworks[i].rssiThreshold =
+     pPrefNetwListParams.aNetworks[i].rssiThreshold =
        pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].rssiThreshold;
 
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "WDI SET PNO: SSID %d %s",
-               pPrefNetwListParams->aNetworks[i].ssId.length,
-               pPrefNetwListParams->aNetworks[i].ssId.ssId);
+               "WDI SET PNO: SSID %d %s", 
+               pPrefNetwListParams.aNetworks[i].ssId.length,
+               pPrefNetwListParams.aNetworks[i].ssId.ssId);
+#endif
    }
 
-   pPrefNetwListParams->scanTimers.ucScanTimersCount = 
-     (pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.ucScanTimersCount <
+   pPrefNetwListParams.scanTimers.ucScanTimersCount = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.ucScanTimersCount < 
       WLAN_HAL_PNO_MAX_SCAN_TIMERS)?
      pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.ucScanTimersCount :
       WLAN_HAL_PNO_MAX_SCAN_TIMERS;
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "WDI SET PNO: Scan timers count %d 24G P %d 5G Probe %d",
-               pPrefNetwListParams->scanTimers.ucScanTimersCount,
+               "WDI SET PNO: Scan timers count %d 24G P %d 5G Probe %d", 
+               pPrefNetwListParams.scanTimers.ucScanTimersCount,
                pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize,
                pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize);
-
-   for ( i = 0; i < pPrefNetwListParams->scanTimers.ucScanTimersCount; i++   )
+#endif
+   for ( i = 0; i < pPrefNetwListParams.scanTimers.ucScanTimersCount; i++   )
    {
-     pPrefNetwListParams->scanTimers.aTimerValues[i].uTimerValue  = 
+     pPrefNetwListParams.scanTimers.aTimerValues[i].uTimerValue  = 
        pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.aTimerValues[i].uTimerValue;
-     pPrefNetwListParams->scanTimers.aTimerValues[i].uTimerRepeat = 
+     pPrefNetwListParams.scanTimers.aTimerValues[i].uTimerRepeat = 
        pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.aTimerValues[i].uTimerRepeat;
    }
 
    /*Copy the probe template*/
-   pPrefNetwListParams->us24GProbeSize = 
+   pPrefNetwListParams.us24GProbeSize = 
      (pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize<
      WLAN_HAL_PNO_MAX_PROBE_SIZE)?
      pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize:
-     WLAN_HAL_PNO_MAX_PROBE_SIZE;
+     WLAN_HAL_PNO_MAX_PROBE_SIZE; 
 
-   wpalMemoryCopy(pPrefNetwListParams->a24GProbeTemplate, 
-                  pwdiPNOScanReqParams->wdiPNOScanInfo.a24GProbeTemplate,
-                  pPrefNetwListParams->us24GProbeSize); 
+   wpalMemoryCopy(pPrefNetwListParams.a24GProbeTemplate, 
+                  pwdiPNOScanReqParams->wdiPNOScanInfo.a24GProbeTemplate, 
+                  pPrefNetwListParams.us24GProbeSize); 
 
-   pPrefNetwListParams->us5GProbeSize = 
+   pPrefNetwListParams.us5GProbeSize = 
      (pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize <
      WLAN_HAL_PNO_MAX_PROBE_SIZE)?
      pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize:
-     WLAN_HAL_PNO_MAX_PROBE_SIZE;
+     WLAN_HAL_PNO_MAX_PROBE_SIZE; 
 
-   wpalMemoryCopy(pPrefNetwListParams->a5GProbeTemplate, 
-                  pwdiPNOScanReqParams->wdiPNOScanInfo.a5GProbeTemplate,
-                  pPrefNetwListParams->us5GProbeSize); 
+   wpalMemoryCopy(pPrefNetwListParams.a5GProbeTemplate, 
+                  pwdiPNOScanReqParams->wdiPNOScanInfo.a5GProbeTemplate, 
+                  pPrefNetwListParams.us5GProbeSize); 
+
+   /*Pack the buffer*/
+   wpalMemoryCopy( pSendBuffer+usDataOffset, &pPrefNetwListParams, 
+                   sizeof(pPrefNetwListParams)); 
 
    /*Set the output values*/
    *ppSendBuffer = pSendBuffer;
-   *pSize        = usSendSize;
+   *pSize        = usSendSize; 
 
    return WDI_STATUS_SUCCESS;
 }/*WDI_PackPreferredNetworkList*/
 
 /**
- @brief Helper function to pack Set Preferred Network List
+ @brief Helper function to pack Set Preferred Network List 
         Request parameters
-
- @param  pWDICtx:         pointer to the WLAN DAL context
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
          pwdiPNOScanReqParams:      pointer to the info received
          from upper layers
          ppSendBuffer, pSize - out pointers of the packed buffer
-         and its size
-
+         and its size 
+  
  @return Result of the function call
 */
 
@@ -22114,171 +22707,182 @@
   wpt_uint16*                pSize
 )
 {
-   wpt_uint8*                 pSendBuffer           = NULL;
+   wpt_uint8*                 pSendBuffer           = NULL; 
    wpt_uint16                 usDataOffset          = 0;
    wpt_uint16                 usSendSize            = 0;
-   tpPrefNetwListParamsNew    pPrefNetwListParams;
+   tPrefNetwListParamsNew     pPrefNetwListParams;
    wpt_uint8 i;
+   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
 
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_PREF_NETWORK_REQ,
-                         sizeof(tPrefNetwListParamsNew),
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_PREF_NETWORK_REQ, 
+                         sizeof(pPrefNetwListParams),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
-       ( usSendSize < (usDataOffset + sizeof(tPrefNetwListParamsNew) )))
+       ( usSendSize < (usDataOffset + sizeof(pPrefNetwListParams) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in Set PNO req %x  ",
                    pwdiPNOScanReqParams);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   pPrefNetwListParams = (tpPrefNetwListParamsNew)(pSendBuffer + usDataOffset);
-
    /*-------------------------------------------------------------------------
      Fill prefNetwListParams from pwdiPNOScanReqParams->wdiPNOScanInfo
    -------------------------------------------------------------------------*/
-   pPrefNetwListParams->enable  = 
+   pPrefNetwListParams.enable  = 
      pwdiPNOScanReqParams->wdiPNOScanInfo.bEnable;
-   pPrefNetwListParams->modePNO = 
+   pPrefNetwListParams.modePNO = 
      pwdiPNOScanReqParams->wdiPNOScanInfo.wdiModePNO;
 
-   pPrefNetwListParams->ucNetworksCount = 
-     (pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount <
+   pPrefNetwListParams.ucNetworksCount = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount < 
       WLAN_HAL_PNO_MAX_SUPP_NETWORKS)?
-     pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount :
+     pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount : 
       WLAN_HAL_PNO_MAX_SUPP_NETWORKS;
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "WDI SET PNO: Enable %d, Mode %d, Netw Count %d",
+               "WDI SET PNO: Enable %d, Mode %d, Netw Count %d", 
                pwdiPNOScanReqParams->wdiPNOScanInfo.bEnable,
                pwdiPNOScanReqParams->wdiPNOScanInfo.wdiModePNO,
                pwdiPNOScanReqParams->wdiPNOScanInfo.ucNetworksCount);
-
-   for ( i = 0; i < pPrefNetwListParams->ucNetworksCount; i++ )
+#endif
+   for ( i = 0; i < pPrefNetwListParams.ucNetworksCount; i++ )
    {
      /*SSID of the BSS*/
-     pPrefNetwListParams->aNetworks[i].ssId.length
+     pPrefNetwListParams.aNetworks[i].ssId.length
         = pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ssId.ucLength;
 
-     wpalMemoryCopy( pPrefNetwListParams->aNetworks[i].ssId.ssId,
+     wpalMemoryCopy( pPrefNetwListParams.aNetworks[i].ssId.ssId,
           pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ssId.sSSID,
-          pPrefNetwListParams->aNetworks[i].ssId.length);
+          pPrefNetwListParams.aNetworks[i].ssId.length);
 
      /*Authentication type for the network*/
-     pPrefNetwListParams->aNetworks[i].authentication = 
-       (tAuthType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiAuth;
+     pPrefNetwListParams.aNetworks[i].authentication = 
+       (tAuthType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiAuth; 
 
      /*Encryption type for the network*/
-     pPrefNetwListParams->aNetworks[i].encryption = 
-       (tEdType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiEncryption;
+     pPrefNetwListParams.aNetworks[i].encryption = 
+       (tEdType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiEncryption; 
 
      /*SSID bcast type for the network*/
-     pPrefNetwListParams->aNetworks[i].bcastNetworkType = 
-       (tSSIDBcastType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiBcastNetworkType;
+     pPrefNetwListParams.aNetworks[i].bcastNetworkType = 
+       (tSSIDBcastType)pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].wdiBcastNetworkType; 
 
-     /*Indicate the channel on which the Network can be found
+     /*Indicate the channel on which the Network can be found 
        0 - if all channels */
-     pPrefNetwListParams->aNetworks[i].ucChannelCount = 
+     pPrefNetwListParams.aNetworks[i].ucChannelCount = 
        pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].ucChannelCount;
 
-     wpalMemoryCopy(pPrefNetwListParams->aNetworks[i].aChannels,
+     wpalMemoryCopy(pPrefNetwListParams.aNetworks[i].aChannels,
                     pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].aChannels,
-                    pPrefNetwListParams->aNetworks[i].ucChannelCount);
+                    pPrefNetwListParams.aNetworks[i].ucChannelCount);
 
      /*Indicates the RSSI threshold for the network to be considered*/
-     pPrefNetwListParams->aNetworks[i].rssiThreshold =
+     pPrefNetwListParams.aNetworks[i].rssiThreshold =
        pwdiPNOScanReqParams->wdiPNOScanInfo.aNetworks[i].rssiThreshold;
 
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "WDI SET PNO: SSID %d %s",
-               pPrefNetwListParams->aNetworks[i].ssId.length,
-               pPrefNetwListParams->aNetworks[i].ssId.ssId);
+               "WDI SET PNO: SSID %d %s", 
+               pPrefNetwListParams.aNetworks[i].ssId.length,
+               pPrefNetwListParams.aNetworks[i].ssId.ssId);
+#endif
    }
 
-   pPrefNetwListParams->scanTimers.ucScanTimersCount = 
-     (pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.ucScanTimersCount <
+   pPrefNetwListParams.scanTimers.ucScanTimersCount = 
+     (pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.ucScanTimersCount < 
       WLAN_HAL_PNO_MAX_SCAN_TIMERS)?
      pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.ucScanTimersCount :
       WLAN_HAL_PNO_MAX_SCAN_TIMERS;
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-               "WDI SET PNO: Scan timers count %d 24G P %d 5G Probe %d",
-               pPrefNetwListParams->scanTimers.ucScanTimersCount,
+               "WDI SET PNO: Scan timers count %d 24G P %d 5G Probe %d", 
+               pPrefNetwListParams.scanTimers.ucScanTimersCount,
                pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize,
                pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize);
+#endif
 
-   for ( i = 0; i < pPrefNetwListParams->scanTimers.ucScanTimersCount; i++   )
+   for ( i = 0; i < pPrefNetwListParams.scanTimers.ucScanTimersCount; i++   )
    {
-     pPrefNetwListParams->scanTimers.aTimerValues[i].uTimerValue  = 
+     pPrefNetwListParams.scanTimers.aTimerValues[i].uTimerValue  = 
        pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.aTimerValues[i].uTimerValue;
-     pPrefNetwListParams->scanTimers.aTimerValues[i].uTimerRepeat = 
+     pPrefNetwListParams.scanTimers.aTimerValues[i].uTimerRepeat = 
        pwdiPNOScanReqParams->wdiPNOScanInfo.scanTimers.aTimerValues[i].uTimerRepeat;
    }
 
    /*Copy the probe template*/
-   pPrefNetwListParams->us24GProbeSize = 
+   pPrefNetwListParams.us24GProbeSize = 
      (pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize<
      WLAN_HAL_PNO_MAX_PROBE_SIZE)?
      pwdiPNOScanReqParams->wdiPNOScanInfo.us24GProbeSize:
-     WLAN_HAL_PNO_MAX_PROBE_SIZE;
+     WLAN_HAL_PNO_MAX_PROBE_SIZE; 
 
-   wpalMemoryCopy(pPrefNetwListParams->a24GProbeTemplate, 
-                  pwdiPNOScanReqParams->wdiPNOScanInfo.a24GProbeTemplate,
-                  pPrefNetwListParams->us24GProbeSize); 
+   wpalMemoryCopy(pPrefNetwListParams.a24GProbeTemplate, 
+                  pwdiPNOScanReqParams->wdiPNOScanInfo.a24GProbeTemplate, 
+                  pPrefNetwListParams.us24GProbeSize); 
 
-   pPrefNetwListParams->us5GProbeSize = 
+   pPrefNetwListParams.us5GProbeSize = 
      (pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize <
      WLAN_HAL_PNO_MAX_PROBE_SIZE)?
      pwdiPNOScanReqParams->wdiPNOScanInfo.us5GProbeSize:
-     WLAN_HAL_PNO_MAX_PROBE_SIZE;
+     WLAN_HAL_PNO_MAX_PROBE_SIZE; 
 
-   wpalMemoryCopy(pPrefNetwListParams->a5GProbeTemplate, 
-                  pwdiPNOScanReqParams->wdiPNOScanInfo.a5GProbeTemplate,
-                  pPrefNetwListParams->us5GProbeSize); 
+   wpalMemoryCopy(pPrefNetwListParams.a5GProbeTemplate, 
+                  pwdiPNOScanReqParams->wdiPNOScanInfo.a5GProbeTemplate, 
+                  pPrefNetwListParams.us5GProbeSize); 
 
+   /*Pack the buffer*/
+   wpalMemoryCopy( pSendBuffer+usDataOffset, &pPrefNetwListParams, 
+                   sizeof(pPrefNetwListParams)); 
 
    /*Set the output values*/
    *ppSendBuffer = pSendBuffer;
-   *pSize        = usSendSize;
+   *pSize        = usSendSize; 
 
    return WDI_STATUS_SUCCESS;
 }/*WDI_PackPreferredNetworkListNew*/
 
 /**
  @brief Process Set Preferred Network List Request function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetPreferredNetworkReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_PNOScanReqParamsType*  pwdiPNOScanReqParams  = NULL;
    WDI_PNOScanCb              wdiPNOScanCb          = NULL;
-   wpt_uint8*                 pSendBuffer           = NULL;
+   wpt_uint8*                 pSendBuffer           = NULL; 
    wpt_uint16                 usSendSize            = 0;
-   WDI_Status                 wdiStatus;
+   WDI_Status                 wdiStatus; 
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiPNOScanReqParams = (WDI_PNOScanReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiPNOScanCb   = (WDI_PNOScanCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-------------------------------------------------------------------------
@@ -22286,19 +22890,21 @@
    -------------------------------------------------------------------------*/
    if ( pWDICtx->wdiPNOVersion > 0 )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-                  "%s: PNO new version %d ", __FUNCTION__,
+                  "%s: PNO new version %d ", __FUNCTION__, 
                   pWDICtx->wdiPNOVersion);
-
+#endif
      wdiStatus = WDI_PackPreferredNetworkListNew( pWDICtx, pwdiPNOScanReqParams,
                                       &pSendBuffer, &usSendSize);
    }
    else
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-                  "%s: PNO old version %d ", __FUNCTION__,
+                  "%s: PNO old version %d ", __FUNCTION__, 
                   pWDICtx->wdiPNOVersion);
-
+#endif
      wdiStatus = WDI_PackPreferredNetworkList( pWDICtx, pwdiPNOScanReqParams,
                                       &pSendBuffer, &usSendSize);
    }
@@ -22306,142 +22912,154 @@
    if (( WDI_STATUS_SUCCESS != wdiStatus )||
        ( NULL == pSendBuffer )||( 0 == usSendSize ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: failed to pack request parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return wdiStatus;
+#endif
+      return wdiStatus; 
    }
 
    pWDICtx->wdiReqStatusCB     = pwdiPNOScanReqParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiPNOScanReqParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiPNOScanReqParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-               wdiPNOScanCb, pEventData->pUserData, WDI_SET_PREF_NETWORK_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+               wdiPNOScanCb, pEventData->pUserData, WDI_SET_PREF_NETWORK_RESP); 
 }
 
 /**
  @brief Process Set RSSI Filter Request function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetRssiFilterReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_SetRssiFilterReqParamsType* pwdiRssiFilterReqParams = NULL;
    WDI_RssiFilterCb                wdiRssiFilterCb         = NULL;
-   wpt_uint8*                      pSendBuffer             = NULL;
+   wpt_uint8*                      pSendBuffer             = NULL; 
    wpt_uint16                      usDataOffset            = 0;
    wpt_uint16                      usSendSize              = 0;
    wpt_uint8                       ucRssiThreshold;
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiRssiFilterReqParams = (WDI_SetRssiFilterReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiRssiFilterCb   = (WDI_RssiFilterCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_PREF_NETWORK_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_PREF_NETWORK_REQ, 
                          sizeof(ucRssiThreshold),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(ucRssiThreshold) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in Set PNO req %x %x %x",
                   pEventData, pwdiRssiFilterReqParams, wdiRssiFilterCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    ucRssiThreshold = pwdiRssiFilterReqParams->rssiThreshold;
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &ucRssiThreshold,
-                   sizeof(ucRssiThreshold));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &ucRssiThreshold, 
+                   sizeof(ucRssiThreshold)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiRssiFilterReqParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiRssiFilterReqParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiRssiFilterReqParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiRssiFilterCb, pEventData->pUserData, WDI_SET_RSSI_FILTER_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiRssiFilterCb, pEventData->pUserData, WDI_SET_RSSI_FILTER_RESP); 
 }
 
 
 /**
  @brief Process Update Scan Params function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateScanParamsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_UpdateScanParamsInfoType* pwdiUpdateScanParams  = NULL;
    WDI_UpdateScanParamsCb        wdiUpdateScanParamsCb = NULL;
-   wpt_uint8*                    pSendBuffer           = NULL;
+   wpt_uint8*                    pSendBuffer           = NULL; 
    wpt_uint16                    usDataOffset          = 0;
    wpt_uint16                    usSendSize            = 0;
    tUpdateScanParams             updateScanParams = {0};
 
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiUpdateScanParams = (WDI_UpdateScanParamsInfoType*)pEventData->pEventData)) ||
        ( NULL == (wdiUpdateScanParamsCb   = (WDI_UpdateScanParamsCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
                "Begin WDI Update Scan Parameters");
+#endif
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPDATE_SCAN_PARAMS_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_UPDATE_SCAN_PARAMS_REQ, 
                          sizeof(updateScanParams),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(updateScanParams) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in Update Scan Params req %x %x %x",
                   pEventData, pwdiUpdateScanParams, wdiUpdateScanParamsCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    //
@@ -22450,13 +23068,13 @@
 
    updateScanParams.b11dEnabled    = pwdiUpdateScanParams->wdiUpdateScanParamsInfo.b11dEnabled;
    updateScanParams.b11dResolved   = pwdiUpdateScanParams->wdiUpdateScanParamsInfo.b11dResolved;
-   updateScanParams.ucChannelCount =
+   updateScanParams.ucChannelCount = 
      (pwdiUpdateScanParams->wdiUpdateScanParamsInfo.ucChannelCount <
      WLAN_HAL_PNO_MAX_NETW_CHANNELS)?
      pwdiUpdateScanParams->wdiUpdateScanParamsInfo.ucChannelCount :
      WLAN_HAL_PNO_MAX_NETW_CHANNELS;
 
-   wpalMemoryCopy( updateScanParams.aChannels,
+   wpalMemoryCopy( updateScanParams.aChannels, 
                    pwdiUpdateScanParams->wdiUpdateScanParamsInfo.aChannels,
                    updateScanParams.ucChannelCount);
 
@@ -22466,34 +23084,36 @@
    updateScanParams.usPassiveMaxChTime = pwdiUpdateScanParams->wdiUpdateScanParamsInfo.usPassiveMaxChTime;
    updateScanParams.cbState            = pwdiUpdateScanParams->wdiUpdateScanParamsInfo.cbState;
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &updateScanParams,
-                   sizeof(updateScanParams));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &updateScanParams, 
+                   sizeof(updateScanParams)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiUpdateScanParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiUpdateScanParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiUpdateScanParams->pUserData; 
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
                "End Update Scan Parameters");
+#endif
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiUpdateScanParamsCb, pEventData->pUserData, WDI_UPDATE_SCAN_PARAMS_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiUpdateScanParamsCb, pEventData->pUserData, WDI_UPDATE_SCAN_PARAMS_RESP); 
 }
 
 /**
  @brief Process Preferred Network Found Indication function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessPrefNetworkFoundInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -22503,66 +23123,69 @@
 
 
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT( 0 );
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
     Extract indication and send it to UMAC
   -------------------------------------------------------------------------*/
-  wpalMemoryCopy( (void *)&prefNetwFoundInd.prefNetwFoundParams,
-                  pEventData->pEventData,
+  wpalMemoryCopy( (void *)&prefNetwFoundInd.prefNetwFoundParams, 
+                  pEventData->pEventData, 
                   sizeof(tPrefNetwFoundParams));
 
   /*Fill in the indication parameters*/
-  wdiInd.wdiIndicationType = WDI_PREF_NETWORK_FOUND_IND;
+  wdiInd.wdiIndicationType = WDI_PREF_NETWORK_FOUND_IND; 
 
   wpalMemoryZero(wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.sSSID,32);
 
-  wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.ucLength =
+  wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.ucLength = 
      (prefNetwFoundInd.prefNetwFoundParams.ssId.length < 31 )?
-      prefNetwFoundInd.prefNetwFoundParams.ssId.length : 31;
+      prefNetwFoundInd.prefNetwFoundParams.ssId.length : 31; 
 
-  wpalMemoryCopy( wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.sSSID,
-                  prefNetwFoundInd.prefNetwFoundParams.ssId.ssId,
+  wpalMemoryCopy( wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.sSSID, 
+                  prefNetwFoundInd.prefNetwFoundParams.ssId.ssId, 
                   wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.ucLength);
 
   wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.rssi =
      prefNetwFoundInd.prefNetwFoundParams.rssi;
 
   // DEBUG
+#ifdef WLAN_DEBUG
   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
               "[PNO WDI] PREF_NETWORK_FOUND_IND Type (%x) data (SSID=%s, RSSI=%d)",
               wdiInd.wdiIndicationType,
               wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.ssId.sSSID,
               wdiInd.wdiIndicationData.wdiPrefNetworkFoundInd.rssi );
-
+#endif
   /*Notify UMAC*/
   pWDICtx->wdiLowLevelIndCB( &wdiInd, pWDICtx->pIndUserData );
-
-  return WDI_STATUS_SUCCESS;
+  
+  return WDI_STATUS_SUCCESS; 
 }
 
 /**
  @brief Process PNO Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetPreferredNetworkRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -22573,45 +23196,47 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
 
-   wdiPNOScanCb = (WDI_PNOScanCb)pWDICtx->pfncRspCB;
+   wdiPNOScanCb = (WDI_PNOScanCb)pWDICtx->pfncRspCB; 
 
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiPNOScanCb(wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetPreferredNetworkRsp*/
 
 /**
  @brief Process RSSI Filter Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetRssiFilterRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -22622,101 +23247,107 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wdiRssiFilterCb = (WDI_RssiFilterCb)pWDICtx->pfncRspCB;
+   wdiRssiFilterCb = (WDI_RssiFilterCb)pWDICtx->pfncRspCB; 
 
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiRssiFilterCb(wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetRssiFilterRsp*/
 
 /**
  @brief Process Update Scan Params Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessUpdateScanParamsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_Status             wdiStatus;
-   tUpdateScanParamsResp  halUpdScanParams;
+   tUpdateScanParamsResp  halUpdScanParams; 
    WDI_UpdateScanParamsCb wdiUpdateScanParamsCb   = NULL;
-   wpt_uint32             uStatus;
+   wpt_uint32             uStatus; 
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                   "Process UPD scan params ptr : %x", __FUNCTION__);
-
-  wdiUpdateScanParamsCb = (WDI_UpdateScanParamsCb)pWDICtx->pfncRspCB;
+#endif
+  wdiUpdateScanParamsCb = (WDI_UpdateScanParamsCb)pWDICtx->pfncRspCB; 
 
   /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
-  wpalMemoryCopy( (void *)&halUpdScanParams.status,
-                  pEventData->pEventData,
+  wpalMemoryCopy( (void *)&halUpdScanParams.status, 
+                  pEventData->pEventData, 
                   sizeof(halUpdScanParams.status));
 
   uStatus  = halUpdScanParams.status;
 
   /*Extract PNO version - 1st bit of the status */
-  pWDICtx->wdiPNOVersion = (uStatus & WDI_PNO_VERSION_MASK)? 1:0;
+  pWDICtx->wdiPNOVersion = (uStatus & WDI_PNO_VERSION_MASK)? 1:0; 
 
   /*Remove version bit*/
-  uStatus = uStatus & ( ~(WDI_PNO_VERSION_MASK));
+  uStatus = uStatus & ( ~(WDI_PNO_VERSION_MASK)); 
 
-  wdiStatus   =   WDI_HAL_2_WDI_STATUS(uStatus);
+  wdiStatus   =   WDI_HAL_2_WDI_STATUS(uStatus); 
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
-              "UPD Scan Parameters rsp with status: %d",
+              "UPD Scan Parameters rsp with status: %d", 
               halUpdScanParams.status);
-
+#endif
   /*Notify UMAC*/
   wdiUpdateScanParamsCb(wdiStatus, pWDICtx->pRspCBUserData);
 
-  return WDI_STATUS_SUCCESS;
+  return WDI_STATUS_SUCCESS; 
 }
 #endif // FEATURE_WLAN_SCAN_PNO
 
 #ifdef WLAN_FEATURE_PACKET_FILTERING
-WDI_Status
+WDI_Status 
 WDI_8023MulticastListReq
 (
   WDI_RcvFltPktSetMcListReqParamsType*  pwdiRcvFltPktSetMcListReqInfo,
@@ -22727,33 +23358,35 @@
    WDI_EventInfoType      wdiEventData;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s", __FUNCTION__);
-
+#endif
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_8023_MULTICAST_LIST_REQ;
-   wdiEventData.pEventData      = pwdiRcvFltPktSetMcListReqInfo;
+   wdiEventData.pEventData      = pwdiRcvFltPktSetMcListReqInfo; 
    wdiEventData.uEventDataSize  = sizeof(*pwdiRcvFltPktSetMcListReqInfo);
-   wdiEventData.pCBfnc          = wdi8023MulticastListCallback;
+   wdiEventData.pCBfnc          = wdi8023MulticastListCallback; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
 
-WDI_Status
+WDI_Status 
 WDI_ReceiveFilterSetFilterReq
 (
   WDI_SetRcvPktFilterReqParamsType* pwdiSetRcvPktFilterReqInfo,
@@ -22764,36 +23397,38 @@
    WDI_EventInfoType      wdiEventData;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s",__FUNCTION__);
-
+#endif
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_RECEIVE_FILTER_SET_FILTER_REQ;
-   wdiEventData.pEventData      = pwdiSetRcvPktFilterReqInfo;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiSetRcvPktFilterReqInfo) +
-                                  (pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.numFieldParams
+   wdiEventData.pEventData      = pwdiSetRcvPktFilterReqInfo; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiSetRcvPktFilterReqInfo) + 
+                                  (pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.numFieldParams 
                                   * sizeof(WDI_RcvPktFilterFieldParams) - 1);
-   wdiEventData.pCBfnc          = wdiReceiveFilterSetFilterCallback;
+   wdiEventData.pCBfnc          = wdiReceiveFilterSetFilterCallback; 
    wdiEventData.pUserData       = pUserData;
 
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
 
-WDI_Status
+WDI_Status 
 WDI_FilterMatchCountReq
 (
   WDI_RcvFltPktMatchCntReqParamsType* pwdiRcvFltPktMatchCntReqInfo,
@@ -22804,34 +23439,36 @@
    WDI_EventInfoType      wdiEventData;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s",__FUNCTION__);
-
+#endif
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ;
-   wdiEventData.pEventData      = pwdiRcvFltPktMatchCntReqInfo;
+   wdiEventData.pEventData      = pwdiRcvFltPktMatchCntReqInfo; 
    wdiEventData.uEventDataSize  = sizeof(*pwdiRcvFltPktMatchCntReqInfo);
-   wdiEventData.pCBfnc          = wdiFilterMatchCountCallback;
+   wdiEventData.pCBfnc          = wdiFilterMatchCountCallback; 
    wdiEventData.pUserData       = pUserData;
 
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
 
-WDI_Status
+WDI_Status 
 WDI_ReceiveFilterClearFilterReq
 (
   WDI_RcvFltPktClearReqParamsType*  pwdiRcvFltPktClearReqInfo,
@@ -22842,27 +23479,29 @@
    WDI_EventInfoType      wdiEventData;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s",__FUNCTION__);
-
+#endif
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_RECEIVE_FILTER_CLEAR_FILTER_REQ;
-   wdiEventData.pEventData      = pwdiRcvFltPktClearReqInfo;
+   wdiEventData.pEventData      = pwdiRcvFltPktClearReqInfo; 
    wdiEventData.uEventDataSize  = sizeof(*pwdiRcvFltPktClearReqInfo);
-   wdiEventData.pCBfnc          = wdiReceiveFilterClearFilterCallback;
+   wdiEventData.pCBfnc          = wdiReceiveFilterClearFilterCallback; 
    wdiEventData.pUserData       = pUserData;
 
 
@@ -22871,169 +23510,141 @@
 
 /**
  @brief Process 8023 Multicast List Request function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_Process8023MulticastListReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_RcvFltPktSetMcListReqParamsType* pwdiFltPktSetMcListReqParamsType  = NULL;
    WDI_8023MulticastListCb    wdi8023MulticastListCb = NULL;
-   wpt_uint8*                 pSendBuffer           = NULL;
+   wpt_uint8*                 pSendBuffer           = NULL; 
    wpt_uint16                 usDataOffset          = 0;
    wpt_uint16                 usSendSize            = 0;
-   tpHalRcvFltMcAddrListType  pRcvFltMcAddrListType;
+   tHalRcvFltMcAddrListType   rcvFltMcAddrListType;
    wpt_uint8                  i;
-   wpt_uint8                  ucCurrentBSSSesIdx = 0;
-   WDI_BSSSessionType*        pBSSSes = NULL;
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s",__FUNCTION__);
-
-   pRcvFltMcAddrListType = wpalMemoryAllocate(sizeof(tHalRcvFltMcAddrListType)) ;
-   if( NULL == pRcvFltMcAddrListType )
-   {
-     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
-                 "Failed to alloc in WDI_Process8023MulticastListReq");
-     return WDI_STATUS_E_FAILURE; 
-   }
-
+#endif
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
-       ( NULL == (pwdiFltPktSetMcListReqParamsType =
+       ( NULL == (pwdiFltPktSetMcListReqParamsType = 
        (WDI_RcvFltPktSetMcListReqParamsType*)pEventData->pEventData)) ||
-       ( NULL == (wdi8023MulticastListCb =
+       ( NULL == (wdi8023MulticastListCb = 
        (WDI_8023MulticastListCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
-      wpalMemoryFree(pRcvFltMcAddrListType);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-   }
-
-   ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                            pwdiFltPktSetMcListReqParamsType->mcAddrList.bssId,
-                            &pBSSSes);
-   if ( NULL == pBSSSes )
-   {
-       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                 " %s : Association for this BSSID does not exist",__FUNCTION__);
-       wpalMemoryFree(pRcvFltMcAddrListType);   
-       return WDI_STATUS_E_FAILURE; 
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                         WDI_8023_MULTICAST_LIST_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                         WDI_8023_MULTICAST_LIST_REQ, 
                          sizeof(tHalRcvFltMcAddrListType),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(tHalRcvFltMcAddrListType))))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in "
                   "WDI_Process8023MulticastListReq() %x %x %x",
                   pEventData, pwdiFltPktSetMcListReqParamsType,
                   wdi8023MulticastListCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   pRcvFltMcAddrListType->cMulticastAddr = 
-       pwdiFltPktSetMcListReqParamsType->mcAddrList.ulMulticastAddrCnt;
-   for( i = 0; i < pRcvFltMcAddrListType->cMulticastAddr; i++ )
+   rcvFltMcAddrListType.cMulticastAddr = 
+       pwdiFltPktSetMcListReqParamsType->mcAddrList.ulMulticastAddrCnt; 
+   for( i = 0; i < rcvFltMcAddrListType.cMulticastAddr; i++ )
    {
-      wpalMemoryCopy(pRcvFltMcAddrListType->multicastAddr[i],
+      wpalMemoryCopy(rcvFltMcAddrListType.multicastAddr[i],
                  pwdiFltPktSetMcListReqParamsType->mcAddrList.multicastAddr[i],
                  sizeof(tSirMacAddr));
    }
 
-   pRcvFltMcAddrListType->bssIdx = pBSSSes->ucBSSIdx;
    wpalMemoryCopy( pSendBuffer+usDataOffset, 
-                   pRcvFltMcAddrListType, 
-                   sizeof(tHalRcvFltMcAddrListType)); 
+                   &rcvFltMcAddrListType, 
+                   sizeof(rcvFltMcAddrListType)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiFltPktSetMcListReqParamsType->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiFltPktSetMcListReqParamsType->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiFltPktSetMcListReqParamsType->pUserData; 
 
 
-   wpalMemoryFree(pRcvFltMcAddrListType);
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                         wdi8023MulticastListCb, pEventData->pUserData,
-                        WDI_8023_MULTICAST_LIST_RESP);
+                        WDI_8023_MULTICAST_LIST_RESP); 
 }
 
 /**
  @brief Process Receive Filter Set Filter Request function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessReceiveFilterSetFilterReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_SetRcvPktFilterReqParamsType* pwdiSetRcvPktFilterReqInfo  = NULL;
    WDI_ReceiveFilterSetFilterCb      wdiReceiveFilterSetFilterCb = NULL;
-   wpt_uint8*                 pSendBuffer           = NULL;
+   wpt_uint8*                 pSendBuffer           = NULL; 
    wpt_uint16                 usDataOffset          = 0;
    wpt_uint16                 usSendSize            = 0;
    wpt_uint32                 usRcvPktFilterCfgSize;
    tHalRcvPktFilterCfgType    *pRcvPktFilterCfg;
    wpt_uint8                  i;
-   wpt_uint8                  ucCurrentBSSSesIdx = 0;
-   WDI_BSSSessionType*        pBSSSes = NULL;
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s",__FUNCTION__);
-
+#endif
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
-       ( NULL == (pwdiSetRcvPktFilterReqInfo =
+       ( NULL == (pwdiSetRcvPktFilterReqInfo = 
        (WDI_SetRcvPktFilterReqParamsType*)pEventData->pEventData)) ||
-       ( NULL == (wdiReceiveFilterSetFilterCb =
+       ( NULL == (wdiReceiveFilterSetFilterCb = 
        (WDI_ReceiveFilterSetFilterCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                            pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.bssId,
-                            &pBSSSes);
-   if ( NULL == pBSSSes )
-   {
-       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                 " %s : Association for this BSSID does not exist",__FUNCTION__);
-       return WDI_STATUS_E_FAILURE;
-   }
-
-   usRcvPktFilterCfgSize = sizeof(tHalRcvPktFilterCfgType) +
+   usRcvPktFilterCfgSize = sizeof(tHalRcvPktFilterCfgType) + 
        ((pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.numFieldParams - 1)
         * sizeof(tHalRcvPktFilterParams));
 
@@ -23042,62 +23653,67 @@
 
   if(NULL == pRcvPktFilterCfg)
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
             "%s: Failed to allocate memory for "
             "tHalRcvPktFilterCfgType: %x %x %x ",
             __FUNCTION__, pWDICtx, pEventData, pEventData->pEventData);
     WDI_ASSERT(0);
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   wpalMemoryZero(pRcvPktFilterCfg, usRcvPktFilterCfgSize);
 
    /*-----------------------------------------------------------------------
      Get message buffer
-
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RECEIVE_FILTER_SET_FILTER_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_RECEIVE_FILTER_SET_FILTER_REQ, 
                          usRcvPktFilterCfgSize,
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + usRcvPktFilterCfgSize)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in "
                   "WDI_ProcessReceiveFilterSetFilterReq() %x %x %x",
                   pEventData, pwdiSetRcvPktFilterReqInfo,
                   wdiReceiveFilterSetFilterCb);
       WDI_ASSERT(0);
+#endif
       wpalMemoryFree(pRcvPktFilterCfg);
-      return WDI_STATUS_E_FAILURE;
+      return WDI_STATUS_E_FAILURE; 
    }
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-              "UsData Off %d UsSend %d cfg %d",usDataOffset,
+              "UsData Off %d UsSend %d cfg %d",usDataOffset, 
               usSendSize,usRcvPktFilterCfgSize);
-
+#endif
    pRcvPktFilterCfg->filterId = pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.filterId;
-   pRcvPktFilterCfg->filterType = pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.filterType;
+   pRcvPktFilterCfg->filterType = pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.filterType;   
    pRcvPktFilterCfg->numParams = pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.numFieldParams;
-   pRcvPktFilterCfg->coalesceTime = pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.coalesceTime;
+   pRcvPktFilterCfg->coleasceTime = pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.coalesceTime;
 
-   //pRcvPktFilterCfg->bssIdx = pBSSSes->ucBSSIdx;
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-              "Out: FID %d FT %d",pRcvPktFilterCfg->filterId,
+              "Out: FID %d FT %d",pRcvPktFilterCfg->filterId, 
               pRcvPktFilterCfg->filterType);
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
-              "NParams %d CT %d",pRcvPktFilterCfg->numParams,
-              pRcvPktFilterCfg->coalesceTime);
+              "NParams %d CT %d",pRcvPktFilterCfg->numParams, 
+              pRcvPktFilterCfg->coleasceTime);
+#endif
 
    for ( i = 0; i < pRcvPktFilterCfg->numParams; i++ )
    {
-       pRcvPktFilterCfg->paramsData[i].protocolLayer =
+       pRcvPktFilterCfg->paramsData[i].protocolLayer = 
            pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.paramsData[i].protocolLayer;
-       pRcvPktFilterCfg->paramsData[i].cmpFlag =
+       pRcvPktFilterCfg->paramsData[i].cmpFlag = 
            pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.paramsData[i].cmpFlag;
-       pRcvPktFilterCfg->paramsData[i].dataOffset =
+       pRcvPktFilterCfg->paramsData[i].dataOffset = 
            pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.paramsData[i].dataOffset;
-        pRcvPktFilterCfg->paramsData[i].dataLength =
+        pRcvPktFilterCfg->paramsData[i].dataLength = 
             pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.paramsData[i].dataLength;
 
        wpalMemoryCopy(&pRcvPktFilterCfg->paramsData[i].compareData,
@@ -23107,67 +23723,71 @@
                     &pwdiSetRcvPktFilterReqInfo->wdiPktFilterCfg.paramsData[i].dataMask,
                     8);
 
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
            "Out:Proto %d Comp Flag %d \n",
-           pRcvPktFilterCfg->paramsData[i].protocolLayer,
+           pRcvPktFilterCfg->paramsData[i].protocolLayer, 
            pRcvPktFilterCfg->paramsData[i].cmpFlag);
 
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
            "Data Offset %d Data Len %d\n",
-           pRcvPktFilterCfg->paramsData[i].dataOffset,
+           pRcvPktFilterCfg->paramsData[i].dataOffset, 
            pRcvPktFilterCfg->paramsData[i].dataLength);
 
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
            "CData: %d:%d:%d:%d:%d:%d\n",
-           pRcvPktFilterCfg->paramsData[i].compareData[0],
-           pRcvPktFilterCfg->paramsData[i].compareData[1],
-           pRcvPktFilterCfg->paramsData[i].compareData[2],
+           pRcvPktFilterCfg->paramsData[i].compareData[0], 
+           pRcvPktFilterCfg->paramsData[i].compareData[1], 
+           pRcvPktFilterCfg->paramsData[i].compareData[2], 
            pRcvPktFilterCfg->paramsData[i].compareData[3],
-           pRcvPktFilterCfg->paramsData[i].compareData[4],
+           pRcvPktFilterCfg->paramsData[i].compareData[4], 
            pRcvPktFilterCfg->paramsData[i].compareData[5]);
 
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
            "MData: %d:%d:%d:%d:%d:%d\n",
-           pRcvPktFilterCfg->paramsData[i].dataMask[0],
-           pRcvPktFilterCfg->paramsData[i].dataMask[1],
-           pRcvPktFilterCfg->paramsData[i].dataMask[2],
+           pRcvPktFilterCfg->paramsData[i].dataMask[0], 
+           pRcvPktFilterCfg->paramsData[i].dataMask[1], 
+           pRcvPktFilterCfg->paramsData[i].dataMask[2], 
            pRcvPktFilterCfg->paramsData[i].dataMask[3],
-           pRcvPktFilterCfg->paramsData[i].dataMask[4],
+           pRcvPktFilterCfg->paramsData[i].dataMask[4], 
            pRcvPktFilterCfg->paramsData[i].dataMask[5]);
+#endif
    }
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   pRcvPktFilterCfg,
-                   usRcvPktFilterCfgSize);
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   pRcvPktFilterCfg, 
+                   usRcvPktFilterCfgSize); 
 
 
    pWDICtx->wdiReqStatusCB     = pwdiSetRcvPktFilterReqInfo->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiSetRcvPktFilterReqInfo->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiSetRcvPktFilterReqInfo->pUserData; 
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s",__FUNCTION__);
+#endif
    wpalMemoryFree(pRcvPktFilterCfg);
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                         wdiReceiveFilterSetFilterCb, pEventData->pUserData,
-                        WDI_RECEIVE_FILTER_SET_FILTER_RESP);
+                        WDI_RECEIVE_FILTER_SET_FILTER_RESP); 
 }
 
 /**
  @brief Process Packet Filter Match Count Request function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessFilterMatchCountReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -23176,168 +23796,165 @@
                                                                          NULL;
    WDI_FilterMatchCountCb                 wdiFilterMatchCountCb              =
                                                                          NULL;
-   wpt_uint8*                             pSendBuffer           = NULL;
+   wpt_uint8*                             pSendBuffer           = NULL; 
    wpt_uint16                             usDataOffset          = 0;
    wpt_uint16                             usSendSize            = 0;
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s",__FUNCTION__);
-
+#endif
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
-       ( NULL == (pwdiRcvFltPktMatchCntReqParamsType =
+       ( NULL == (pwdiRcvFltPktMatchCntReqParamsType = 
        (WDI_RcvFltPktMatchCntReqParamsType*)pEventData->pEventData)) ||
-       ( NULL == (wdiFilterMatchCountCb =
+       ( NULL == (wdiFilterMatchCountCb = 
        (WDI_FilterMatchCountCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                         WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, 
+                         WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_REQ, 
                          0,
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < usDataOffset))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in "
                   "WDI_ProcessFilterMatchCountReq() %x %x %x",
                   pEventData, pwdiRcvFltPktMatchCntReqParamsType,
                   wdiFilterMatchCountCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    //
    // Don't need to fill send buffer other than header
    //
    pWDICtx->wdiReqStatusCB     = pwdiRcvFltPktMatchCntReqParamsType->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiRcvFltPktMatchCntReqParamsType->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiRcvFltPktMatchCntReqParamsType->pUserData; 
 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiFilterMatchCountCb,
-                        pEventData->pUserData,
-                        WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiFilterMatchCountCb, 
+                        pEventData->pUserData, 
+                        WDI_PACKET_COALESCING_FILTER_MATCH_COUNT_RESP); 
 }
 
 /**
  @brief Process Receive Filter Clear Filter Request function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessReceiveFilterClearFilterReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
-{
+{ 
    WDI_RcvFltPktClearReqParamsType* pwdiRcvFltPktClearReqParamsType = NULL;
    WDI_ReceiveFilterClearFilterCb   wdiRcvFltPktClearFilterCb       = NULL;
-   wpt_uint8*                       pSendBuffer           = NULL;
+   wpt_uint8*                       pSendBuffer           = NULL; 
    wpt_uint16                       usDataOffset          = 0;
    wpt_uint16                       usSendSize            = 0;
    tHalRcvFltPktClearParam          rcvFltPktClearParam;
-   wpt_uint8                        ucCurrentBSSSesIdx = 0;
-   WDI_BSSSessionType*              pBSSSes = NULL;
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s",__FUNCTION__);
-
+#endif
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiRcvFltPktClearReqParamsType =
        (WDI_RcvFltPktClearReqParamsType*)pEventData->pEventData)) ||
-       ( NULL == (wdiRcvFltPktClearFilterCb =
+       ( NULL == (wdiRcvFltPktClearFilterCb = 
        (WDI_ReceiveFilterClearFilterCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
-   }
-
-   ucCurrentBSSSesIdx = WDI_FindAssocSession( pWDICtx,
-                            pwdiRcvFltPktClearReqParamsType->filterClearParam.bssId,
-                            &pBSSSes);
-   if ( NULL == pBSSSes )
-   {
-       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-                 " %s : Association for this BSSID does not exist",__FUNCTION__);
-       return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
    if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                         WDI_RECEIVE_FILTER_CLEAR_FILTER_REQ,
+                         WDI_RECEIVE_FILTER_CLEAR_FILTER_REQ, 
                          sizeof(tHalRcvFltPktClearParam),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(tHalRcvFltPktClearParam))))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in "
                   "WDI_ProcessReceiveFilterClearFilterReq() %x %x %x",
                   pEventData, pwdiRcvFltPktClearReqParamsType,
                   wdiRcvFltPktClearFilterCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
 
    rcvFltPktClearParam.status = pwdiRcvFltPktClearReqParamsType->
-                                                    filterClearParam.status;
+                                                    filterClearParam.status; 
    rcvFltPktClearParam.filterId = pwdiRcvFltPktClearReqParamsType->
-                                                    filterClearParam.filterId;
+                                                    filterClearParam.filterId; 
 
-   rcvFltPktClearParam.bssIdx = pBSSSes->ucBSSIdx;
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &rcvFltPktClearParam,
-                   sizeof(rcvFltPktClearParam));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &rcvFltPktClearParam, 
+                   sizeof(rcvFltPktClearParam)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiRcvFltPktClearReqParamsType->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiRcvFltPktClearReqParamsType->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiRcvFltPktClearReqParamsType->pUserData; 
 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                         wdiRcvFltPktClearFilterCb, pEventData->pUserData,
-                        WDI_RECEIVE_FILTER_CLEAR_FILTER_RESP);
+                        WDI_RECEIVE_FILTER_CLEAR_FILTER_RESP); 
 }
 
 /**
  @brief Process 8023 Multicast List Response function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_Process8023MulticastListRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -23347,48 +23964,51 @@
    WDI_8023MulticastListCb wdi8023MulticastListCb;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s",__FUNCTION__);
-
+#endif
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wdi8023MulticastListCb = (WDI_8023MulticastListCb)pWDICtx->pfncRspCB;
+   wdi8023MulticastListCb = (WDI_8023MulticastListCb)pWDICtx->pfncRspCB; 
 
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdi8023MulticastListCb(wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }
 
 /**
  @brief Process Set Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessReceiveFilterSetFilterRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -23398,48 +24018,51 @@
    WDI_ReceiveFilterSetFilterCb wdiReceiveFilterSetFilterCb;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
           "%s",__FUNCTION__);
-
+#endif
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiReceiveFilterSetFilterCb = (WDI_ReceiveFilterSetFilterCb)pWDICtx->
-                                                                   pfncRspCB;
+                                                                   pfncRspCB; 
 
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiReceiveFilterSetFilterCb(wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }
 
 /**
  @brief Process Packet Filter Match Count Response function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessFilterMatchCountRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -23451,47 +24074,50 @@
 
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s",__FUNCTION__);
-
+#endif
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wdiFilterMatchCountCb = (WDI_FilterMatchCountCb)pWDICtx->pfncRspCB;
+   wdiFilterMatchCountCb = (WDI_FilterMatchCountCb)pWDICtx->pfncRspCB; 
 
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiFilterMatchCountCb(wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }
 
 /**
  @brief Process Receive Filter Clear Filter Response function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessReceiveFilterClearFilterRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -23501,34 +24127,37 @@
    WDI_ReceiveFilterClearFilterCb wdiReceiveFilterClearFilterCb;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
              "%s",__FUNCTION__);
-
+#endif
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    wdiReceiveFilterClearFilterCb = (WDI_ReceiveFilterClearFilterCb)pWDICtx->
-                                                                 pfncRspCB;
+                                                                 pfncRspCB; 
 
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiReceiveFilterClearFilterCb(wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }
 #endif // WLAN_FEATURE_PACKET_FILTERING
 
@@ -23536,42 +24165,44 @@
  @brief Process Shutdown Rsp function
         There is no shutdown response comming from HAL
         - function just kept for simmetry
-
+ 
  @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
+         pEventData:      pointer to the event information structure 
 
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessShutdownRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
   /*There is no shutdown response comming from HAL - function just kept for
   simmetry */
+#ifdef WLAN_DEBUNG
   WDI_ASSERT(0);
+#endif
   return WDI_STATUS_SUCCESS;
 }/*WDI_ProcessShutdownRsp*/
 
 /**
  @brief WDI_SetPowerParamsReq
 
- @param pwdiPowerParamsReqParams: the Set Power Params as
+ @param pwdiPowerParamsReqParams: the Set Power Params as 
                       specified by the Device Interface
-
+  
         wdiPowerParamsCb: callback for passing back the response
         of the Set Power Params operation received from the
         device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_SetPowerParamsReq
 (
   WDI_SetPowerParamsReqParamsType* pwdiPowerParamsReqParams,
@@ -23583,23 +24214,24 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_SET_POWER_PARAMS_REQ;
-   wdiEventData.pEventData      = pwdiPowerParamsReqParams;
+   wdiEventData.pEventData      = pwdiPowerParamsReqParams; 
    wdiEventData.uEventDataSize  = sizeof(*pwdiPowerParamsReqParams);
-   wdiEventData.pCBfnc          = wdiPowerParamsCb;
+   wdiEventData.pCBfnc          = wdiPowerParamsCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -23607,107 +24239,111 @@
 
 /**
  @brief Process Set Power Params Request function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetPowerParamsReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_SetPowerParamsReqParamsType* pwdiPowerParamsReqParams = NULL;
    WDI_SetPowerParamsCb             wdiPowerParamsCb         = NULL;
-   wpt_uint8*                       pSendBuffer              = NULL;
+   wpt_uint8*                       pSendBuffer              = NULL; 
    wpt_uint16                       usDataOffset             = 0;
    wpt_uint16                       usSendSize               = 0;
    tSetPowerParamsType              powerParams;
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiPowerParamsReqParams = (WDI_SetPowerParamsReqParamsType*)pEventData->pEventData)) ||
        ( NULL == (wdiPowerParamsCb   = (WDI_SetPowerParamsCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_POWER_PARAMS_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_POWER_PARAMS_REQ, 
                          sizeof(powerParams),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(powerParams) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in Set PNO req %x %x %x",
                   pEventData, pwdiPowerParamsReqParams, wdiPowerParamsCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
   /*  Ignore DTIM */
-  powerParams.uIgnoreDTIM =
+  powerParams.uIgnoreDTIM = 
     pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uIgnoreDTIM;
 
   /*DTIM Period*/
-  powerParams.uDTIMPeriod =
+  powerParams.uDTIMPeriod = 
     pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uDTIMPeriod;
 
   /* Listen Interval */
-  powerParams.uListenInterval=
+  powerParams.uListenInterval= 
     pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uListenInterval;
 
   /* Broadcast Multicas Filter  */
-  powerParams.uBcastMcastFilter =
+  powerParams.uBcastMcastFilter = 
     pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uBcastMcastFilter;
 
   /* Beacon Early Termination */
-  powerParams.uEnableBET =
+  powerParams.uEnableBET = 
     pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uEnableBET;
 
   /* Beacon Early Termination Interval */
-  powerParams.uBETInterval =
-    pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uBETInterval;
+  powerParams.uBETInterval = 
+    pwdiPowerParamsReqParams->wdiSetPowerParamsInfo.uBETInterval; 
+    
 
-
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &powerParams,
-                   sizeof(powerParams));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &powerParams, 
+                   sizeof(powerParams)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiPowerParamsReqParams->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiPowerParamsReqParams->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiPowerParamsReqParams->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiPowerParamsCb, pEventData->pUserData, WDI_SET_POWER_PARAMS_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiPowerParamsCb, pEventData->pUserData, WDI_SET_POWER_PARAMS_RESP); 
 }
 
 /**
  @brief Process Power Params Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetPowerParamsRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -23718,57 +24354,59 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wdiPowerParamsCb = (WDI_SetPowerParamsCb)pWDICtx->pfncRspCB;
+   wdiPowerParamsCb = (WDI_SetPowerParamsCb)pWDICtx->pfncRspCB; 
 
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiPowerParamsCb(wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetPowerParamsRsp*/
 
 #ifdef WLAN_FEATURE_GTK_OFFLOAD
 /**
- @brief WDI_GTKOffloadReq will be called when the upper MAC
+ @brief WDI_GTKOffloadReq will be called when the upper MAC 
         wants to set GTK Rekey Counter while in power save. Upon
         the call of this API the WLAN DAL will pack and send a
         HAL GTK offload request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param pwdiGtkOffloadParams: the GTK offload as specified
+ @param pwdiGtkOffloadParams: the GTK offload as specified 
                       by the Device Interface
-
+  
         wdiGtkOffloadCb: callback for passing back the response
         of the GTK offload operation received from the device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_GTKOffloadReq
 (
   WDI_GtkOffloadReqMsg*      pwdiGtkOffloadReqMsg,
@@ -23780,23 +24418,24 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_GTK_OFFLOAD_REQ;
-   wdiEventData.pEventData      = pwdiGtkOffloadReqMsg;
-   wdiEventData.uEventDataSize  = sizeof(*pwdiGtkOffloadReqMsg);;
-   wdiEventData.pCBfnc          = wdiGtkOffloadCb;
+   wdiEventData.pEventData      = pwdiGtkOffloadReqMsg; 
+   wdiEventData.uEventDataSize  = sizeof(*pwdiGtkOffloadReqMsg);; 
+   wdiEventData.pCBfnc          = wdiGtkOffloadCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -23804,32 +24443,32 @@
 
 
 /**
- @brief WDI_GTKOffloadGetInfoReq will be called when the upper
+ @brief WDI_GTKOffloadGetInfoReq will be called when the upper 
           MAC wants to get GTK Rekey Counter while in power save.
           Upon the call of this API the WLAN DAL will pack and
           send a HAL GTK offload request message to the lower RIVA
         sub-system if DAL is in state STARTED.
 
         In state BUSY this request will be queued. Request won't
-        be allowed in any other state.
+        be allowed in any other state. 
 
  WDI_PostAssocReq must have been called.
 
- @param pwdiGtkOffloadGetInfoReqMsg: the GTK Offload
+ @param pwdiGtkOffloadGetInfoReqMsg: the GTK Offload 
                         Information Message as specified by the
                         Device Interface
-
+  
           wdiGtkOffloadGetInfoCb: callback for passing back the
           response of the GTK offload operation received from the
           device
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see WDI_PostAssocReq
  @return Result of the function call
 */
-WDI_Status
+WDI_Status 
 WDI_GTKOffloadGetInfoReq
 (
   WDI_GtkOffloadGetInfoReqMsg*  pwdiGtkOffloadGetInfoReqMsg,
@@ -23841,23 +24480,24 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-     return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+     return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /*------------------------------------------------------------------------
      Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    wdiEventData.wdiRequest      = WDI_GTK_OFFLOAD_GETINFO_REQ;
-   wdiEventData.pEventData      = pwdiGtkOffloadGetInfoReqMsg;
+   wdiEventData.pEventData      = pwdiGtkOffloadGetInfoReqMsg; 
    wdiEventData.uEventDataSize  = sizeof(*pwdiGtkOffloadGetInfoReqMsg);
-   wdiEventData.pCBfnc          = wdiGtkOffloadGetInfoCb;
+   wdiEventData.pCBfnc          = wdiGtkOffloadGetInfoCb; 
    wdiEventData.pUserData       = pUserData;
 
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
@@ -23865,55 +24505,59 @@
 
 
 /**
- @brief Process set GTK Offload Request function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ @brief Process set GTK Offload Request function 
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessGTKOffloadReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_GtkOffloadReqMsg*    pwdiGtkOffloadReqMsg = NULL;
    WDI_GtkOffloadCb         wdiGtkOffloadCb      = NULL;
-   wpt_uint8*               pSendBuffer          = NULL;
+   wpt_uint8*               pSendBuffer          = NULL; 
    wpt_uint16               usDataOffset         = 0;
    wpt_uint16               usSendSize           = 0;
    tHalGtkOffloadReqParams  gtkOffloadReqParams = {0};
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiGtkOffloadReqMsg = (WDI_GtkOffloadReqMsg*)pEventData->pEventData)) ||
        ( NULL == (wdiGtkOffloadCb   = (WDI_GtkOffloadCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_GTK_OFFLOAD_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_GTK_OFFLOAD_REQ, 
                          sizeof(gtkOffloadReqParams),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(gtkOffloadReqParams) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in GTK offload req %x %x %x",
                   pEventData, pwdiGtkOffloadReqMsg, wdiGtkOffloadCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    //
@@ -23927,69 +24571,73 @@
    // Copy KeyReplayCounter
    wpalMemoryCopy(&(gtkOffloadReqParams.ullKeyReplayCounter), &(pwdiGtkOffloadReqMsg->gtkOffloadReqParams.ullKeyReplayCounter), sizeof(v_U64_t));
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &gtkOffloadReqParams,
-                   sizeof(gtkOffloadReqParams));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &gtkOffloadReqParams, 
+                   sizeof(gtkOffloadReqParams)); 
 
    pWDICtx->wdiReqStatusCB     = pwdiGtkOffloadReqMsg->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiGtkOffloadReqMsg->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiGtkOffloadReqMsg->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiGtkOffloadCb, pEventData->pUserData, WDI_GTK_OFFLOAD_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiGtkOffloadCb, pEventData->pUserData, WDI_GTK_OFFLOAD_RESP); 
 }
 
 
 /**
  @brief Process GTK Offload Get Information Request function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessGTKOffloadGetInfoReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
    WDI_GtkOffloadGetInfoReqMsg*     pwdiGtkOffloadGetInfoReqMsg = NULL;
    WDI_GtkOffloadGetInfoCb          wdiGtkOffloadGetInfoCb      = NULL;
-   wpt_uint8*                       pSendBuffer           = NULL;
+   wpt_uint8*                       pSendBuffer           = NULL; 
    wpt_uint16                       usDataOffset          = 0;
    wpt_uint16                       usSendSize            = 0;
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiGtkOffloadGetInfoReqMsg = (WDI_GtkOffloadGetInfoReqMsg*)pEventData->pEventData)) ||
        ( NULL == (wdiGtkOffloadGetInfoCb = (WDI_GtkOffloadGetInfoCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_GTK_OFFLOAD_GETINFO_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_GTK_OFFLOAD_GETINFO_REQ, 
                          0,
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < usDataOffset))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in WDI_ProcessGTKOffloadGetInfoReq() %x %x %x",
                   pEventData, pwdiGtkOffloadGetInfoReqMsg, wdiGtkOffloadGetInfoCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    //
@@ -23997,28 +24645,28 @@
    //
 
    pWDICtx->wdiReqStatusCB     = pwdiGtkOffloadGetInfoReqMsg->wdiReqStatusCB;
-   pWDICtx->pReqStatusUserData = pwdiGtkOffloadGetInfoReqMsg->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiGtkOffloadGetInfoReqMsg->pUserData; 
 
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiGtkOffloadGetInfoCb, pEventData->pUserData, WDI_GTK_OFFLOAD_GETINFO_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiGtkOffloadGetInfoCb, pEventData->pUserData, WDI_GTK_OFFLOAD_GETINFO_RESP); 
 }
 
 /**
  @brief Process host offload Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessGtkOffloadRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -24028,44 +24676,46 @@
    WDI_GtkOffloadCb    wdiGtkOffloadCb   = NULL;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-   wdiGtkOffloadCb = (WDI_GtkOffloadCb)pWDICtx->pfncRspCB;
+   wdiGtkOffloadCb = (WDI_GtkOffloadCb)pWDICtx->pfncRspCB; 
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiGtkOffloadCb( wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }
 
 /**
  @brief Process GTK Offload Get Information Response function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessGTKOffloadGetInfoRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -24077,39 +24727,41 @@
 
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
-   wdiGtkOffloadGetInfoCb = (WDI_GtkOffloadGetInfoCb)pWDICtx->pfncRspCB;
+   wdiGtkOffloadGetInfoCb = (WDI_GtkOffloadGetInfoCb)pWDICtx->pfncRspCB; 
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    //wdiUpdateScanParamsCb(wdiStatus, pWDICtx->pRspCBUserData);
    //wdiReceiveFilterClearFilterCb(wdiStatus, pWDICtx->pRspCBUserData);
    wdiGtkOffloadGetInfoCb(wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }
 #endif // WLAN_FEATURE_GTK_OFFLOAD
 
 #ifdef WLAN_WAKEUP_EVENTS
 WDI_Status
 WDI_ProcessWakeReasonInd
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -24118,26 +24770,29 @@
   tpWakeReasonParams pWakeReasonParams;
   wpt_uint32 allocSize = 0;
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
             "+%s", __FUNCTION__);
-
+#endif
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
       ( NULL == pEventData->pEventData ))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT( 0 );
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-------------------------------------------------------------------------
     Extract indication and send it to UMAC
   -------------------------------------------------------------------------*/
   pWakeReasonParams = (tpWakeReasonParams)(pEventData->pEventData);
-
+  
   allocSize = sizeof(WDI_LowLevelIndType) + (pWakeReasonParams->ulStoredDataLen - 1);
 
   //Allocate memory for WDI_WakeReasonIndType structure
@@ -24145,36 +24800,39 @@
 
   if(NULL == pWdiInd)
   {
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
             "%s: Failed to allocate memory for WDI_WakeReasonIndType: %x %x %x ",
                 __FUNCTION__, pWDICtx, pEventData, pEventData->pEventData);
     WDI_ASSERT(0);
-    return WDI_STATUS_E_FAILURE;
+#endif
+    return WDI_STATUS_E_FAILURE; 
   }
 
   wpalMemoryZero(pWdiInd, allocSize);
 
   /* Fill in the indication parameters*/
   // Fill wdiInd.wdiIndicationData.wakeReasonInd structure from wakeReasonInd.wakeReasonParams
-  pWdiInd->wdiIndicationType = WDI_WAKE_REASON_IND;
+  pWdiInd->wdiIndicationType = WDI_WAKE_REASON_IND; 
   pWdiInd->wdiIndicationData.wdiWakeReasonInd.ulReason = pWakeReasonParams->ulReason;
   pWdiInd->wdiIndicationData.wdiWakeReasonInd.ulReasonArg = pWakeReasonParams->ulReasonArg;
   pWdiInd->wdiIndicationData.wdiWakeReasonInd.ulStoredDataLen = pWakeReasonParams->ulStoredDataLen;
-  pWdiInd->wdiIndicationData.wdiWakeReasonInd.ulActualDataLen = pWakeReasonParams->ulActualDataLen;
-  wpalMemoryCopy( (void *)&(pWdiInd->wdiIndicationData.wdiWakeReasonInd.aDataStart[0]),
-                  &(pWakeReasonParams->aDataStart[0]),
+  pWdiInd->wdiIndicationData.wdiWakeReasonInd.ulActualDataLen = pWakeReasonParams->ulActualDataLen;    
+  wpalMemoryCopy( (void *)&(pWdiInd->wdiIndicationData.wdiWakeReasonInd.aDataStart[0]), 
+                  &(pWakeReasonParams->aDataStart[0]), 
                   pWakeReasonParams->ulStoredDataLen);
 
   /*Notify UMAC*/
   pWDICtx->wdiLowLevelIndCB( pWdiInd, pWDICtx->pIndUserData );
-
+  
   //Free memory allocated for WDI_WakeReasonIndType structure
   wpalMemoryFree(pWdiInd);
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
             "-%s", __FUNCTION__);
-
-  return WDI_STATUS_SUCCESS;
+#endif
+  return WDI_STATUS_SUCCESS; 
 }
 #endif // WLAN_WAKEUP_EVENTS
 
@@ -24192,16 +24850,16 @@
 /**
  @brief Process Set TM Level Rsp function (called when a
         response is being received over the bus from HAL)
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessSetTmLevelRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
@@ -24212,37 +24870,39 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData ))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
-   wdiSetTmLevelCb = (WDI_SetPowerParamsCb)pWDICtx->pfncRspCB;
+   wdiSetTmLevelCb = (WDI_SetPowerParamsCb)pWDICtx->pfncRspCB; 
 
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
    halStatus = *((eHalStatus*)pEventData->pEventData);
-   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus);
+   wdiStatus   =   WDI_HAL_2_WDI_STATUS(halStatus); 
 
    /*Notify UMAC*/
    wdiSetTmLevelCb(wdiStatus, pWDICtx->pRspCBUserData);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }/*WDI_ProcessSetTmLevelRsp*/
 
 /**
  @brief Process Set Thermal Mitigation level Changed request
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
@@ -24255,59 +24915,63 @@
 {
    WDI_SetTmLevelReqType           *pwdiSetTmLevelReq = NULL;
    WDI_SetTmLevelCb                 wdiSetTmLevelCb   = NULL;
-   wpt_uint8*                       pSendBuffer       = NULL;
+   wpt_uint8*                       pSendBuffer       = NULL; 
    wpt_uint16                       usDataOffset      = 0;
    wpt_uint16                       usSendSize        = 0;
    tSetThermalMitgationType         halTmMsg;
 
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pEventData ) ||
        ( NULL == (pwdiSetTmLevelReq = (WDI_SetTmLevelReqType*)pEventData->pEventData)) ||
        ( NULL == (wdiSetTmLevelCb   = (WDI_SetTmLevelCb)pEventData->pCBfnc)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /*-----------------------------------------------------------------------
      Get message buffer
    -----------------------------------------------------------------------*/
-   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_TM_LEVEL_REQ,
+   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx, WDI_SET_TM_LEVEL_REQ, 
                          sizeof(halTmMsg),
                          &pSendBuffer, &usDataOffset, &usSendSize))||
        ( usSendSize < (usDataOffset + sizeof(halTmMsg) )))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_WARN,
                   "Unable to get send buffer in Set PNO req %x %x %x",
                   pEventData, pwdiSetTmLevelReq, wdiSetTmLevelCb);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    halTmMsg.thermalMitMode = pwdiSetTmLevelReq->tmMode;
    halTmMsg.thermalMitLevel = pwdiSetTmLevelReq->tmLevel;
 
-   wpalMemoryCopy( pSendBuffer+usDataOffset,
-                   &halTmMsg,
-                   sizeof(halTmMsg));
+   wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                   &halTmMsg, 
+                   sizeof(halTmMsg)); 
 
-   pWDICtx->pReqStatusUserData = pwdiSetTmLevelReq->pUserData;
+   pWDICtx->pReqStatusUserData = pwdiSetTmLevelReq->pUserData; 
    pWDICtx->pfncRspCB = NULL;
    /*-------------------------------------------------------------------------
-     Send Get STA Request to HAL
+     Send Get STA Request to HAL 
    -------------------------------------------------------------------------*/
-   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
-                        wdiSetTmLevelCb, pEventData->pUserData, WDI_SET_TM_LEVEL_RESP);
+   return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
+                        wdiSetTmLevelCb, pEventData->pUserData, WDI_SET_TM_LEVEL_RESP); 
 }
 
 /* Fill the value from the global features enabled array to the global capabilities
- * bitmap struct
+ * bitmap struct 
  */
-static void
+static void 
 FillAllFeatureCaps(tWlanFeatCaps *fCaps, placeHolderInCapBitmap *enabledFeat, wpt_int8 len)
 {
    wpt_int8 i;
@@ -24320,18 +24984,18 @@
 /**
  @brief WDI_featureCapsExchangeReq
         Post feature capability bitmap exchange event.
-        Host will send its own capability to FW in this req and
+        Host will send its own capability to FW in this req and 
         expect FW to send its capability back as a bitmap in Response
-
- @param
-
+ 
+ @param 
+  
         wdiFeatureCapsExchangeCb: callback called on getting the response.
         It is kept to mantain similarity between WDI reqs and if needed, can
         be used in future. Currently, It is set to NULL
-
+  
         pUserData: user data will be passed back with the
-        callback
-
+        callback 
+  
  @see
  @return Result of the function call
 */
@@ -24344,16 +25008,17 @@
 {
    WDI_EventInfoType   wdiEventData;
    wpt_int32           fCapsStructSize;
-
+   
    /*------------------------------------------------------------------------
-     Sanity Check
+     Sanity Check 
    ------------------------------------------------------------------------*/
    if ( eWLAN_PAL_FALSE == gWDIInitialized )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                "WDI API call before module is initialized - Fail request");
-
-      return WDI_STATUS_E_NOT_ALLOWED;
+#endif
+      return WDI_STATUS_E_NOT_ALLOWED; 
    }
 
    /* Allocate memory separately for global variable carrying FW caps */
@@ -24361,73 +25026,79 @@
    gpHostWlanFeatCaps = wpalMemoryAllocate(fCapsStructSize);
    if ( NULL ==  gpHostWlanFeatCaps )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "Cannot allocate memory for host capability info\n");
+               "Cannot allocate memory for host capability info\n"); 
       WDI_ASSERT(0);
+#endif
       return WDI_STATUS_MEM_FAILURE;
    }
 
    wpalMemoryZero(gpHostWlanFeatCaps, fCapsStructSize);
-
+   
    /*------------------------------------------------------------------------
    Fill in Event data and post to the Main FSM
    ------------------------------------------------------------------------*/
    FillAllFeatureCaps(gpHostWlanFeatCaps, supportEnabledFeatures,
       (sizeof(supportEnabledFeatures)/sizeof(supportEnabledFeatures[0])));
-   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
-      "Host caps %x %x %x %x\n",
+#ifdef WLAN_DEBUG
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+      "bit 0 - %x %x %x %x - bit 128\n",
       gpHostWlanFeatCaps->featCaps[0],
       gpHostWlanFeatCaps->featCaps[1],
       gpHostWlanFeatCaps->featCaps[2],
       gpHostWlanFeatCaps->featCaps[3]
    );
-
+#endif
    wdiEventData.wdiRequest      = WDI_FEATURE_CAPS_EXCHANGE_REQ;
-   wdiEventData.pEventData      = gpHostWlanFeatCaps;
-   wdiEventData.uEventDataSize  = fCapsStructSize;
-   wdiEventData.pCBfnc          = wdiFeatureCapsExchangeCb;
+   wdiEventData.pEventData      = gpHostWlanFeatCaps; 
+   wdiEventData.uEventDataSize  = fCapsStructSize; 
+   wdiEventData.pCBfnc          = wdiFeatureCapsExchangeCb; 
    wdiEventData.pUserData       = pUserData;
-
+   
    return WDI_PostMainEvent(&gWDICb, WDI_REQUEST_EVENT, &wdiEventData);
 }
 
 /**
  @brief Process Host-FW Capability Exchange Request function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessFeatureCapsExchangeReq
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
-  wpt_uint8*              pSendBuffer        = NULL;
+  wpt_uint8*              pSendBuffer        = NULL; 
   wpt_uint16              usDataOffset       = 0;
   wpt_uint16              usSendSize         = 0;
-  wpt_uint16              usLen              = 0;
+  wpt_uint16              usLen              = 0; 
 
   /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
          "%s", __FUNCTION__);
-
+#endif
   /*-------------------------------------------------------------------------
-    Sanity check
+    Sanity check 
   -------------------------------------------------------------------------*/
   /* Call back function is NULL since not required for cap exchange req */
   if (( NULL == pEventData ) ||
       ( NULL == (tWlanFeatCaps *)pEventData->pEventData))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                  "%s: Invalid parameters", __FUNCTION__);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
   /*-----------------------------------------------------------------------
@@ -24436,112 +25107,121 @@
   usLen = sizeof(tWlanFeatCaps);
 
   if (( WDI_STATUS_SUCCESS != WDI_GetMessageBuffer( pWDICtx,
-                        WDI_FEATURE_CAPS_EXCHANGE_REQ,
+                        WDI_FEATURE_CAPS_EXCHANGE_REQ, 
                         usLen,
                         &pSendBuffer, &usDataOffset, &usSendSize))||
       ( usSendSize < (usDataOffset + usLen )))
   {
+#ifdef WLAN_DEBUG
      WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_FATAL,
               "Unable to get send buffer in feat caps exchange req %x %x",
                 pEventData, (tWlanFeatCaps *)pEventData->pEventData);
      WDI_ASSERT(0);
-     return WDI_STATUS_E_FAILURE;
+#endif
+     return WDI_STATUS_E_FAILURE; 
   }
 
+#ifdef WLAN_DEBUG
   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
-       "Host Caps - %x %x %x %x\n",
+       "bit 0 - %x %x %x %x - bit 128\n",
       ((tWlanFeatCaps *)pEventData->pEventData)->featCaps[0],
       ((tWlanFeatCaps *)pEventData->pEventData)->featCaps[1],
       ((tWlanFeatCaps *)pEventData->pEventData)->featCaps[2],
       ((tWlanFeatCaps *)pEventData->pEventData)->featCaps[3]
     );
-
-  /* Copy host caps after the offset in the send buffer */
-  wpalMemoryCopy( pSendBuffer+usDataOffset,
-                  (tWlanFeatCaps *)pEventData->pEventData,
-                  usLen);
+#endif
+  /* Copy host caps after the offset in the send buffer */  
+  wpalMemoryCopy( pSendBuffer+usDataOffset, 
+                  (tWlanFeatCaps *)pEventData->pEventData, 
+                  usLen); 
 
   /*-------------------------------------------------------------------------
-    Send Start Request to HAL
+    Send Start Request to HAL 
   -------------------------------------------------------------------------*/
-  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize,
+  return  WDI_SendMsg( pWDICtx, pSendBuffer, usSendSize, 
                        (WDI_StartRspCb)pEventData->pCBfnc,
                        pEventData->pUserData, WDI_FEATURE_CAPS_EXCHANGE_RESP);
-
+  
 }/*WDI_ProcessFeatureCapsExchangeReq*/
 
 /**
  @brief Process Host-FW Capability Exchange Response function
-
- @param  pWDICtx:         pointer to the WLAN DAL context
-         pEventData:      pointer to the event information structure
-
+ 
+ @param  pWDICtx:         pointer to the WLAN DAL context 
+         pEventData:      pointer to the event information structure 
+  
  @see
  @return Result of the function call
 */
 WDI_Status
 WDI_ProcessFeatureCapsExchangeRsp
-(
+( 
   WDI_ControlBlockType*  pWDICtx,
   WDI_EventInfoType*     pEventData
 )
 {
-   WDI_featureCapsExchangeCb    wdiFeatureCapsExchangeCb;
+   WDI_featureCapsExchangeCb    wdiFeatureCapsExchangeCb;   
    wpt_int32                   fCapsStructSize;
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
+#ifdef WLAN_DEBUG
    WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
           "%s", __FUNCTION__);
-
+#endif
    /*-------------------------------------------------------------------------
-     Sanity check
+     Sanity check 
    -------------------------------------------------------------------------*/
    if (( NULL == pWDICtx ) || ( NULL == pEventData ) ||
        ( NULL == pEventData->pEventData ))
    {
       /* It will go here when riva is old (doesn't understand this msg) and host is new */
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN,
                   "%s: Invalid parameters", __FUNCTION__);
       WDI_ASSERT(0);
-      return WDI_STATUS_E_FAILURE;
+#endif
+      return WDI_STATUS_E_FAILURE; 
    }
 
    /* Allocate memory separately for global variable carrying FW caps */
    fCapsStructSize = sizeof(tWlanFeatCaps);
-   gpFwWlanFeatCaps = wpalMemoryAllocate(fCapsStructSize);
+   gpFwWlanFeatCaps = wpalMemoryAllocate(fCapsStructSize);   
    if ( NULL ==  gpFwWlanFeatCaps )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-               "Cannot allocate memory for host capability info\n");
+               "Cannot allocate memory for host capability info\n"); 
       WDI_ASSERT(0);
+#endif
       return WDI_STATUS_MEM_FAILURE;
    }
 
    /*-------------------------------------------------------------------------
      Unpack HAL Response Message - the header was already extracted by the
-     main Response Handling procedure
-   -------------------------------------------------------------------------*/
+     main Response Handling procedure 
+   -------------------------------------------------------------------------*/   
    /*-------------------------------------------------------------------------
      Extract response and send it to UMAC
    -------------------------------------------------------------------------*/
 
    wpalMemoryCopy(gpFwWlanFeatCaps,(tWlanFeatCaps *) pEventData -> pEventData,
                     fCapsStructSize);
-   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_INFO,
-      "FW caps %x %x %x %x\n",
+#ifdef WLAN_DEBUG
+   WPAL_TRACE( eWLAN_MODULE_DAL_CTRL,  eWLAN_PAL_TRACE_LEVEL_ERROR,
+      "bit 0 - %x %x %x %x - bit 128\n",
       gpFwWlanFeatCaps->featCaps[0],
       gpFwWlanFeatCaps->featCaps[1],
       gpFwWlanFeatCaps->featCaps[2],
       gpFwWlanFeatCaps->featCaps[3]
      );
-
-   wdiFeatureCapsExchangeCb = (WDI_featureCapsExchangeCb) pWDICtx -> pfncRspCB;
+#endif
+   wdiFeatureCapsExchangeCb = (WDI_featureCapsExchangeCb) pWDICtx -> pfncRspCB; 
 
    /*Notify UMAC - there is no callback right now but can be used in future if reqd */
    if (wdiFeatureCapsExchangeCb != NULL)
       wdiFeatureCapsExchangeCb(NULL, NULL);
 
-   return WDI_STATUS_SUCCESS;
+   return WDI_STATUS_SUCCESS; 
 }
 
 /**
@@ -24551,13 +25231,13 @@
         variable storing host capability bitmap to find this. This can be used by
         other moduels to decide certain things like call different APIs based on
         whether a particular feature is supported.
-
- @param
-
+ 
+ @param 
+  
         feat_enum_value: enum value for the feature as in placeHolderInCapBitmap in wlan_hal_msg.h.
 
  @see
- @return
+ @return 
         0 - if the feature is NOT supported in host
         any non-zero value - if the feature is SUPPORTED in host.
 */
@@ -24568,11 +25248,13 @@
    {
       getFeatCaps(gpHostWlanFeatCaps, feat_enum_value, featSupported);
    }
+#ifdef WLAN_DEBUG
    else
    {
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-        "Caps exchange feature NOT supported. Return NOT SUPPORTED for %u feature", feat_enum_value);
+        "Caps exchange feature NOT supported. Return NOT SUPPORTED for %u feature\n", feat_enum_value);
    }
+#endif
    return featSupported;
 }
 
@@ -24583,14 +25265,14 @@
         variable storing host capability bitmap to find this. This can be used by
         other moduels to decide certain things like call different APIs based on
         whether a particular feature is supported.
-
- @param
-
+ 
+ @param 
+  
         feat_enum_value: enum value for the feature as in placeHolderInCapBitmap
                                     in wlan_hal_msg.h.
 
  @see
- @return
+ @return 
         0 - if the feature is NOT supported in FW
         any non-zero value - if the feature is SUPPORTED in FW.
 */
@@ -24601,33 +25283,12 @@
     {
       getFeatCaps(gpFwWlanFeatCaps, feat_enum_value, featSupported);
     }
+#ifdef WLAN_DEBUG
     else
     {
        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
-         "Caps exchange feature NOT supported. Return NOT SUPPORTED for %u feature", feat_enum_value);
+         "Caps exchange feature NOT supported. Return NOT SUPPORTED for %u feature\n", feat_enum_value);
     }
+#endif
     return featSupported;
 }
-
-/**
- @brief WDI_TransportChannelDebug -
-    Display DXE Channel debugging information
-    User may request to display DXE channel snapshot
-    Or if host driver detects any abnormal stcuk may display
-
- @param  displaySnapshot : Dispaly DXE snapshot option
- @param  enableStallDetect : Enable stall detect feature
-                        This feature will take effect to data performance
-                        Not integrate till fully verification
- @see
- @return none
-*/
-void WDI_TransportChannelDebug
-(
-   wpt_boolean  displaySnapshot,
-   wpt_boolean  toggleStallDetect
-)
-{
-   WDTS_ChannelDebug(displaySnapshot, toggleStallDetect);
-   return;
-}
diff --git a/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi_dp.c b/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi_dp.c
index 8912408..1d830e4 100644
--- a/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi_dp.c
+++ b/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi_dp.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -399,6 +399,7 @@
     ucType = (ucTypeSubtype & WDI_FRAME_TYPE_MASK) >> WDI_FRAME_TYPE_OFFSET;
     ucSubType = (ucTypeSubtype & WDI_FRAME_SUBTYPE_MASK);
 
+#ifdef WLAN_DEBUG
     WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_WARN, 
                "Type: %d/%d, MAC S: %08x. MAC D: %08x., Tid=%d, frmXlat=%d, pTxBD=%08x ucTxFlag 0x%X\n", 
                 ucType, ucSubType, 
@@ -406,6 +407,7 @@
                *((wpt_uint32 *) pDestMacAddr), 
                 ucTid, 
                !ucDisableFrmXtl, pTxBd, ucTxFlag );
+#endif
 
 
     //logic to determine the version match between host and riva to find out when to enable using STA rate for bcast frames.
@@ -603,13 +605,14 @@
             ucIsRMF = 1;
          ucDisableFrmXtl = 1;
     } 
+#ifdef WLAN_DEBUG
     else 
     {   // Control Packet
         /* We should never get a control packet, asserting here since something
         is wrong */
         WDI_ASSERT(0);
     }
-
+#endif
     pBd->ub = !ucUnicastDst;
 
     /* Fast path: Leverage UMA for BD filling/frame translation.
@@ -652,7 +655,9 @@
                                               *(wpt_macAddr*)pAddr2, &ucStaId );
            if (WDI_STATUS_SUCCESS != wdiStatus) 
            {
+#ifdef WLAN_DEBUG
                 WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR, "WDI_STATableFindStaidByAddr failed");
+#endif
                 return WDI_STATUS_E_FAILURE;
            }
 #else
@@ -691,72 +696,25 @@
            if( ucUnicastDst ) 
            {
              wdiStatus = WDI_STATableFindStaidByAddr( pWDICtx, 
-                 *(wpt_macAddr*)pDestMacAddr, &ucStaId ); 
-             // In STA mode the unicast data frame could be 
-             // transmitted to a DestAddr for which there might not be an entry in 
-             // HAL STA table and the lookup would fail. In such cases use the Addr2 
-             // (self MAC address) to get the selfStaIdx.
-             // From SelfStaIdx, get BSSIdx and use BSS MacAddr to get the staIdx 
-             // corresponding to peerSta(AP).
-             // Drop frames only it is a data frame. Management frames can still
-             // go out using selfStaIdx.
+                                        *(wpt_macAddr*)pDestMacAddr, &ucStaId ); 
+               // Only case this look would fail would be in STA mode, in AP & IBSS mode 
+               // this look should pass. In STA mode the unicast data frame could be 
+               // transmitted to a DestAddr for which there might not be an entry in 
+               // HAL STA table and the lookup would fail. In such cases use the Addr2 
+               // (self MAC address) to get the selfStaIdx.
 
 
-             if (WDI_STATUS_SUCCESS != wdiStatus) 
-             {
-               if(ucType == WDI_MAC_MGMT_FRAME)
-               {
-                 //For management frames, use self staIdx if peer sta 
-                 //entry is not found.
-                 wdiStatus = WDI_STATableFindStaidByAddr( pWDICtx, 
-                     *(wpt_macAddr*)pAddr2, &ucStaId ); 
-               }
-               else
-               {
-                 if( !ucDisableFrmXtl )
-                 {
-                   // FrameTranslation in HW is enanled. This means, 
-                   // pDestMacaddress may be unknown. Get the station index 
-                   // for ADDR2, which should be the self MAC addr
-                   wdiStatus = WDI_STATableFindStaidByAddr( pWDICtx, 
-                       *(wpt_macAddr*)pAddr2, &ucStaId ); 
-                   if (WDI_STATUS_SUCCESS == wdiStatus)
-                   {
-                     //Found self Sta index.
-                     WDI_StaStruct* pSTATable = (WDI_StaStruct*) pWDICtx->staTable;
-                     wpt_uint8                 bssIdx  = 0;
-
-                     pBSSSes = NULL;
-                     //Initialize WDI status to error.
-                     wdiStatus = WDI_STATUS_E_NOT_ALLOWED;
-
-                     //Check if its BSSIdx is valid.
-                     if (pSTATable[ucStaId].bssIdx != WDI_BSS_INVALID_IDX) 
-                     {
-                       //Use BSSIdx to get the association sequence and use
-                       //macBssId to get the peerMac Address(MacBSSID).
-                       bssIdx = WDI_FindAssocSessionByBSSIdx( pWDICtx,
-                           pSTATable[ucStaId].bssIdx,
-                           &pBSSSes);
-
-                       if ( NULL != pBSSSes )
-                       {
-                         //Get staId from the peerMac. 
-                         wdiStatus = WDI_STATableFindStaidByAddr( pWDICtx, 
-                             pBSSSes->macBSSID, &ucStaId ); 
-                       }
-                     }
-                   }
-                 }
-               }
-               //wdiStatus will be success if it found valid peerStaIdx
-               //Otherwise return failure.
-               if(WDI_STATUS_SUCCESS != wdiStatus )
-               {
-                 return WDI_STATUS_E_NOT_ALLOWED;
-               }
-             }
-           } 
+              if (WDI_STATUS_SUCCESS != wdiStatus) 
+              {
+                // Get the station index for ADDR2, which should be the self MAC addr
+                wdiStatus = WDI_STATableFindStaidByAddr( pWDICtx, 
+                                       *(wpt_macAddr*)pAddr2, &ucStaId ); 
+                if (WDI_STATUS_SUCCESS != wdiStatus)
+                {
+                  return WDI_STATUS_E_FAILURE;
+                }
+              }
+            } 
             else
             {
               // For bcast frames use the bcast station index
diff --git a/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi_sta.c b/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi_sta.c
index b05dc04..85e9f13 100644
--- a/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi_sta.c
+++ b/drivers/staging/prima/CORE/WDI/CP/src/wlan_qct_wdi_sta.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -102,8 +102,10 @@
             
         WDI_STATableClose(pWDICtx);
 
+#ifdef WLAN_DEBUG
         WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "Error allocating memory on WDI_STATableInit"); 
+#endif
         return WDI_STATUS_E_FAILURE;
     }
     
@@ -228,9 +230,11 @@
     if (( pwdiParam->ucSTAIdx  == WDI_STA_INVALID_IDX) ||
         ( pwdiParam->ucSTAIdx >= pWDICtx->ucMaxStations ))
     {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "Station id sent by HAL is invalid - not OK"); 
       WDI_ASSERT(0); 
+#endif
       return WDI_STATUS_E_FAILURE; 
     }
     
@@ -275,9 +279,11 @@
                                                      ucSTAIdx, 
                                                      pwdiParam->staMacAddr))
     {
+#ifdef WLAN_DEBUG
        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "Failed to update station entry - internal failure");
        WDI_ASSERT(0);
+#endif
        return WDI_STATUS_E_FAILURE; 
     }
 
@@ -286,9 +292,11 @@
                                                      ucSTAIdx, 
                                                      pwdiParam->macBSSID))
     {
+#ifdef WLAN_DEBUG
        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "Failed to update station entry - internal failure");
        WDI_ASSERT(0);
+#endif
        return WDI_STATUS_E_FAILURE; 
     }
 
@@ -323,9 +331,11 @@
     if(( ucSTAIdx  == WDI_STA_INVALID_IDX )||
         ( ucSTAIdx >= pWDICtx->ucMaxStations ))
     {
+#ifdef WLAN_DEBUG
        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "STA Id invalid on Del STA - internal failure");
        WDI_ASSERT(0);
+#endif
        return WDI_STATUS_E_FAILURE; 
     }
     
diff --git a/drivers/staging/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h b/drivers/staging/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h
index 49e93f8..2a3bd0c 100644
--- a/drivers/staging/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h
+++ b/drivers/staging/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds_i.h b/drivers/staging/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds_i.h
index 04568b3..482c224 100644
--- a/drivers/staging/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds_i.h
+++ b/drivers/staging/prima/CORE/WDI/DP/inc/wlan_qct_wdi_ds_i.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/DP/src/wlan_qct_wdi_bd.c b/drivers/staging/prima/CORE/WDI/DP/src/wlan_qct_wdi_bd.c
index 13ff1dc..b21d305 100644
--- a/drivers/staging/prima/CORE/WDI/DP/src/wlan_qct_wdi_bd.c
+++ b/drivers/staging/prima/CORE/WDI/DP/src/wlan_qct_wdi_bd.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/DP/src/wlan_qct_wdi_ds.c b/drivers/staging/prima/CORE/WDI/DP/src/wlan_qct_wdi_ds.c
index 8798d70..d472c7e 100644
--- a/drivers/staging/prima/CORE/WDI/DP/src/wlan_qct_wdi_ds.c
+++ b/drivers/staging/prima/CORE/WDI/DP/src/wlan_qct_wdi_ds.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h b/drivers/staging/prima/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h
index 2448892..6401340 100644
--- a/drivers/staging/prima/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h
+++ b/drivers/staging/prima/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -235,18 +235,4 @@
   wpt_uint32           uLen
 );
 
-/**
- @brief    This helper function is used to clean up the pending 
-           messages in the transport queue
-
- @param wctsHandlehandle:  transport handle
-
- @see
- @return   0 for success
-*/
-wpt_uint32
-WCTS_ClearPendingQueue
-(
-   WCTS_HandleType      wctsHandle
-);
 #endif /* #ifndef WLAN_QCT_WDI_CTS_H */
diff --git a/drivers/staging/prima/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c b/drivers/staging/prima/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c
index d6bb577..ebabe19 100644
--- a/drivers/staging/prima/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c
+++ b/drivers/staging/prima/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -199,15 +199,19 @@
      Sanity check
      --------------------------------------------------------------------*/
    if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "WCTS_PALOpenCallback: Invalid parameters received.");
+#endif
       return;
    }
 
    if (WCTS_STATE_OPEN_PENDING != pWCTSCb->wctsState) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "WCTS_PALOpenCallback: Invoke from invalid state %d.",
                  pWCTSCb->wctsState);
+#endif
       return;
    }
 
@@ -250,8 +254,10 @@
      Sanity check
      --------------------------------------------------------------------*/
    if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "WCTS_PALReadCallback: Invalid parameter received.");
+#endif
       return;
    }
 
@@ -274,9 +280,11 @@
 
       buffer = wpalMemoryAllocate(packet_size);
       if (NULL ==  buffer) {
+#ifdef WLAN_DEBUG
          WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                     "WCTS_PALReadCallback: Memory allocation failure");
          WPAL_ASSERT(0);
+#endif
          return;
       }
 
@@ -286,10 +294,14 @@
 
       if (bytes_read != packet_size) {
          /*Some problem, do not forward it to WDI.*/
+#ifdef WLAN_DEBUG
          WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                     "WCTS_PALReadCallback: Failed to read data from SMD");
+#endif
          wpalMemoryFree(buffer);
+#ifdef WLAN_DEBUG
          WPAL_ASSERT(0);
+#endif
          return;
       }
 
@@ -335,8 +347,10 @@
      Sanity check
      --------------------------------------------------------------------*/
    if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "WCTS_PALWriteCallback: Invalid parameter received.");
+#endif
       return;
    }
 
@@ -372,9 +386,10 @@
       written = smd_write(pWCTSCb->wctsChannel, pBuffer, len);
       if (written != len) {
          /* Something went wrong */
+#ifdef WLAN_DEBUG
          WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                     "WCTS_PALWriteCallback: channel write failure");
-
+#endif
          /* we were unable to send the message that was at the head
             of the deferred list.  there is nothing else we can do
             other than drop it, so we will just fall through to the
@@ -440,7 +455,7 @@
  @see
  @return   0 for success
 */
-wpt_uint32
+static wpt_uint32
 WCTS_ClearPendingQueue
 (
    WCTS_HandleType      wctsHandle
@@ -454,8 +469,10 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "WCTS_ClearPendingQueue: Invalid parameters received.");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -467,6 +484,7 @@
       wpalMemoryFree(pBuffer);
       wpalMemoryFree(pBufferQueue);
    }
+
    return eWLAN_PAL_STATUS_SUCCESS;
 
 }/*WCTS_ClearPendingQueue*/
@@ -501,10 +519,11 @@
      Sanity check
      --------------------------------------------------------------------*/
    if (WCTS_CB_MAGIC != pWCTSCb->wctsMagic) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Received unexpected SMD event %u",
                  __FUNCTION__, event);
-
+#endif
       /* TODO_PRIMA what error recovery options do we have? */
       return;
    }
@@ -512,16 +531,19 @@
    /* Serialize processing in the control thread */
    switch (event) {
    case SMD_EVENT_OPEN:
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "%s: received SMD_EVENT_OPEN from SMD", __FUNCTION__);
-      /* If the prev state was 'remote closed' then it is a Riva 'restart',
+#endif      /* If the prev state was 'remote closed' then it is a Riva 'restart',
        * subsystem restart re-init
        */
       if (WCTS_STATE_REM_CLOSED == pWCTSCb->wctsState)
       {
+#ifdef WLAN_DEBUG
            WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "%s: received SMD_EVENT_OPEN in WCTS_STATE_REM_CLOSED state",
                  __FUNCTION__);
+#endif
            /* call subsystem restart re-init function */
            wpalDriverReInit();
            return;
@@ -532,40 +554,52 @@
    case SMD_EVENT_DATA:
       if (WCTS_STATE_REM_CLOSED == pWCTSCb->wctsState)
       {
+#ifdef WLAN_DEBUG
            WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: received SMD data when the state is remote closed ",
                  __FUNCTION__);
+#endif
            /* we should not be getting any data now */
            return;
       }
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "%s: received SMD_EVENT_DATA from SMD", __FUNCTION__);
+#endif
       palMsg = &pWCTSCb->wctsDataMsg;
       break;
 
    case SMD_EVENT_CLOSE:
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "%s: received SMD_EVENT_CLOSE from SMD", __FUNCTION__);
+#endif
       /* SMD channel was closed from the remote side,
        * this would happen only when Riva crashed and SMD is
        * closing the channel on behalf of Riva */
       pWCTSCb->wctsState = WCTS_STATE_REM_CLOSED;
+      WCTS_ClearPendingQueue (pWCTSCb);
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "%s: received SMD_EVENT_CLOSE WLAN driver going down now",
                  __FUNCTION__);
+#endif
       /* subsystem restart: shutdown */
       wpalDriverShutdown();
       return;
 
    case SMD_EVENT_STATUS:
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "%s: received SMD_EVENT_STATUS from SMD", __FUNCTION__);
+#endif
       return;
 
    case SMD_EVENT_REOPEN_READY:
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "%s: received SMD_EVENT_REOPEN_READY from SMD", __FUNCTION__);
-
+#endif
       /* unlike other events which occur when our kernel threads are
          running, this one is received when the threads are closed and
          the rmmod thread is waiting.  so just unblock that thread */
@@ -573,10 +607,11 @@
       return;
 
    default:
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Unexpected event %u received from SMD",
                  __FUNCTION__, event);
-
+#endif
       return;
    }
 
@@ -629,22 +664,26 @@
      ---------------------------------------------------------------------*/
    if ((NULL == wctsCBs) || (NULL == szName) ||
        (NULL == wctsCBs->wctsNotifyCB) || (NULL == wctsCBs->wctsRxMsgCB)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "WCTS_OpenTransport: Invalid parameters received.");
-
+#endif
       return NULL;
    }
 
    /* This open is coming after a SSR, we don't need to reopen SMD,
     * the SMD port was never closed during SSR*/
    if (gwctsHandle) {
+#ifdef WLAN_DEBUG
        WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                "WCTS_OpenTransport port is already open\n");
-
+#endif
        pWCTSCb = gwctsHandle;
        if (WCTS_CB_MAGIC != pWCTSCb->wctsMagic) {
+#ifdef WLAN_DEBUG
            WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                    "WCTS_OpenTransport: Invalid magic.");
+#endif
            return NULL;
        }   
        pWCTSCb->wctsState = WCTS_STATE_OPEN;
@@ -676,8 +715,10 @@
    /* allocate a ControlBlock to hold all context */
    pWCTSCb = wpalMemoryAllocate(sizeof(*pWCTSCb));
    if (NULL == pWCTSCb) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "WCTS_OpenTransport: Memory allocation failure.");
+#endif
       return NULL;
    }
 
@@ -729,24 +770,30 @@
                                       pWCTSCb,
                                       WCTS_NotifyCallback);
    if (0 != smdstatus) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: smd_named_open_on_edge failed with status %d",
                  __FUNCTION__, smdstatus);
+#endif
       goto fail;
    }
 
    /* wait for the channel to be fully opened before we proceed */
    status = wpalEventWait(&pWCTSCb->wctsEvent, WCTS_SMD_OPEN_TIMEOUT);
    if (eWLAN_PAL_STATUS_SUCCESS != status) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: failed to receive SMD_EVENT_OPEN",
                  __FUNCTION__);
+#endif
       /* since we opened one end of the channel, close it */
       smdstatus = smd_close(pWCTSCb->wctsChannel);
       if (0 != smdstatus) {
+#ifdef WLAN_DEBUG
          WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                     "%s: smd_close failed with status %d",
                     __FUNCTION__, smdstatus);
+#endif
       }
       goto fail;
    }
@@ -798,8 +845,10 @@
    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
    if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "WCTS_CloseTransport: Invalid parameters received.");
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -830,9 +879,11 @@
    wpalEventReset(&pWCTSCb->wctsEvent);
    smdstatus = smd_close(pWCTSCb->wctsChannel);
    if (0 != smdstatus) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: smd_close failed with status %d",
                  __FUNCTION__, smdstatus);
+#endif
       /* SMD did not successfully close the channel, therefore we
          won't receive an asynchronous close notification so don't
          bother to wait for an event that won't come */
@@ -840,11 +891,13 @@
    } else {
       /* close command was sent -- wait for the callback to complete */
       status = wpalEventWait(&pWCTSCb->wctsEvent, WCTS_SMD_CLOSE_TIMEOUT);
+#ifdef WLAN_DEBUG
       if (eWLAN_PAL_STATUS_SUCCESS != status) {
          WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                     "%s: failed to receive SMD_EVENT_REOPEN_READY",
                     __FUNCTION__);
       }
+#endif
 
       /* During the close sequence we deregistered from SMD.  As part
          of deregistration SMD will call back into our driver with an
@@ -864,7 +917,6 @@
    /* release the resource */
    pWCTSCb->wctsMagic = 0;
    wpalMemoryFree(pWCTSCb);
-   gwctsHandle = NULL;
 
    return eWLAN_PAL_STATUS_SUCCESS;
 
@@ -913,9 +965,11 @@
      --------------------------------------------------------------------*/
    if ((NULL == pWCTSCb) || (WCTS_CB_MAGIC != pWCTSCb->wctsMagic) ||
        (NULL == pMsg) || (0 == uLen) || (0x7fffffff < uLen)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "WCTS_SendMessage: Invalid parameters received.");
       WPAL_ASSERT(0);
+#endif
       if (NULL != pMsg) {
          wpalMemoryFree(pMsg);
       }
@@ -931,22 +985,30 @@
          written = smd_write(pWCTSCb->wctsChannel, pMsg, len);
       }
    } else if (WCTS_STATE_DEFERRED == pWCTSCb->wctsState) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "WCTS_SendMessage: FIFO space not available, the packets will be queued");
+#endif
    } else {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "WCTS_SendMessage: Channel in illegal state [%d].",
                  pWCTSCb->wctsState);
+#endif
       /* force following logic to reclaim the buffer */
       written = -1;
    }
 
    if (-1 == written) {
       /*Something wrong*/
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "WCTS_SendMessage: Failed to send message over the bus.");
+#endif
       wpalMemoryFree(pMsg);
+#ifdef WLAN_DEBUG
       WPAL_ASSERT(0);
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    } else if (written == len) {
       /* Message sent! No deferred state, free the buffer*/
@@ -956,10 +1018,14 @@
          queue the rest of the data for later*/
       pBufferQueue = wpalMemoryAllocate(sizeof(WCTS_BufferType));
       if (NULL == pBufferQueue) {
+#ifdef WLAN_DEBUG
          WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                     "WCTS_SendMessage: Cannot allocate memory for queuing the buffer");
+#endif
          wpalMemoryFree(pMsg);
+#ifdef WLAN_DEBUG
          WPAL_ASSERT(0);
+#endif
          return eWLAN_PAL_STATUS_E_NOMEM;
       }
 
diff --git a/drivers/staging/prima/CORE/WDI/TRP/DTS/inc/wlan_qct_wdi_dts.h b/drivers/staging/prima/CORE/WDI/TRP/DTS/inc/wlan_qct_wdi_dts.h
index 51ccc85..c459fa4 100644
--- a/drivers/staging/prima/CORE/WDI/TRP/DTS/inc/wlan_qct_wdi_dts.h
+++ b/drivers/staging/prima/CORE/WDI/TRP/DTS/inc/wlan_qct_wdi_dts.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -104,8 +104,6 @@
   wpt_status (*txComplete) (void *pContext, wpt_uint32 ucTxResReq);
   wpt_status (*setPowerState) (void *pContext, WDTS_PowerStateType   powerState, 
                                WDTS_SetPSCbType cBack);
-  void (*channelDebug)(wpt_boolean displaySnapshot,
-                       wpt_boolean enableStallDetect);
   wpt_status (*stop) (void *pContext);
   wpt_status (*close) (void *pContext);
   wpt_uint32 (*getFreeTxDataResNumber) (void *pContext);
@@ -180,20 +178,6 @@
 wpt_status WDTS_SetPowerState(void *pContext, WDTS_PowerStateType powerState,
                               WDTS_SetPowerStateCbType cback);
 
-/* DTS Transport Channel Debug
- * Display DXE Channel debugging information
- * User may request to display DXE channel snapshot
- * Or if host driver detects any abnormal stcuk may display
- * Parameters:
- *  displaySnapshot : Dispaly DXE snapshot option
- *  enableStallDetect : Enable stall detect feature
-                        This feature will take effect to data performance
-                        Not integrate till fully verification
- * Return Value: NONE
- *
- */
-void WDTS_ChannelDebug(wpt_boolean dispalySnapshot, wpt_boolean toggleStallDetect);
-
 /* DTS Stop function. 
  * Stop Transport driver, ie DXE, SDIO
  * Parameters:
diff --git a/drivers/staging/prima/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c b/drivers/staging/prima/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
index 61741a4..3ca56fb 100644
--- a/drivers/staging/prima/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
+++ b/drivers/staging/prima/CORE/WDI/TRP/DTS/src/wlan_qct_wdi_dts.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -50,7 +50,6 @@
   WLANDXE_TxFrame,
   WLANDXE_CompleteTX,
   WLANDXE_SetPowerState,
-  WLANDXE_ChannelDebug,
   WLANDXE_Stop,
   WLANDXE_Close,
   WLANDXE_GetFreeTxDataResNumber
@@ -561,24 +560,6 @@
    return status;
 }
 
-/* DTS Transport Channel Debug
- * Display DXE Channel debugging information
- * User may request to display DXE channel snapshot
- * Or if host driver detects any abnormal stcuk may display
- * Parameters:
- *  displaySnapshot : Dispaly DXE snapshot option
- *  enableStallDetect : Enable stall detect feature
-                        This feature will take effect to data performance
-                        Not integrate till fully verification
- * Return Value: NONE
- *
- */
-void WDTS_ChannelDebug(wpt_boolean dispalySnapshot, wpt_boolean toggleStallDetect)
-{
-   gTransportDriver.channelDebug(dispalySnapshot, toggleStallDetect);
-   return;
-}
-
 /* DTS Stop function. 
  * Stop Transport driver, ie DXE, SDIO
  * Parameters:
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_list.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_list.h
index 1f58546..56161ef 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_list.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_list.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_status.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_status.h
index 5b0588d..5d544fb 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_status.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_status.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_sync.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_sync.h
index f7256e8..f7bb44e 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_sync.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_sync.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_timer.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_timer.h
index 1666890..80ede5a 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_timer.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_timer.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_trace.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_trace.h
index 67f855a..839e2bb 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_trace.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_trace.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_type.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_type.h
index bfd9984..24a8e1c 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_type.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_os_type.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pack_align.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pack_align.h
index fb15b2a..7b1a350 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pack_align.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pack_align.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_api.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_api.h
index 1819dfa..d71cba8 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_api.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_api.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -295,13 +295,4 @@
 ---------------------------------------------------------------------------*/
 wpt_status wpalRivaSubystemRestart(void);
 
-/*---------------------------------------------------------------------------
-    wpalWlanReload -  Initiate WLAN Driver reload
-
-    Param:
-       None
-    Return:
-       NONE
----------------------------------------------------------------------------*/
-void wpalWlanReload(void);
 #endif // __WLAN_QCT_PAL_API_H
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h
index f649615..c7e395e 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_device.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_list.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_list.h
index ed82e71..fff0aa1 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_list.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_list.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_msg.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_msg.h
index 0244861..34f1cce 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_msg.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_msg.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h
index 9f80b55..17ae26c 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_packet.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -223,7 +223,7 @@
         NULL - fail.
         Otherwise the address of the starting of the buffer
 ---------------------------------------------------------------------------*/
-extern wpt_uint8 *wpalPacketGetRawBuf(wpt_packet *pPkt);
+extern WPT_INLINE wpt_uint8 *wpalPacketGetRawBuf(wpt_packet *pPkt);
 
 
 /*---------------------------------------------------------------------------
@@ -236,7 +236,7 @@
         NULL - fail.
         Otherwise the address of the starting of the buffer
 ---------------------------------------------------------------------------*/
-extern wpt_status wpalPacketSetRxLength(wpt_packet *pPkt, wpt_uint32 len);
+extern WPT_INLINE wpt_status wpalPacketSetRxLength(wpt_packet *pPkt, wpt_uint32 len);
 
 
 /*---------------------------------------------------------------------------
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_status.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_status.h
index e27cc6d..9cf532a 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_status.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_status.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_sync.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_sync.h
index b954db7..14158ba 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_sync.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_sync.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_timer.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_timer.h
index db1a0ba..7bdcff7 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_timer.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_timer.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_trace.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_trace.h
index 7623fda..612e704 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_trace.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_trace.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_type.h b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_type.h
index 4ecfeda..e8affb4 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_type.h
+++ b/drivers/staging/prima/CORE/WDI/WPAL/inc/wlan_qct_pal_type.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_api.c b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_api.c
index beee761..db99318a 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_api.c
+++ b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_api.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -92,9 +92,11 @@
    status = wpalDeviceInit(pOSContext);
    if (!WLAN_PAL_IS_STATUS_SUCCESS(status))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                  "%s: wpalDeviceInit failed with status %u",
                  __FUNCTION__, status);
+#endif
    }
 
    return status;
@@ -212,8 +214,10 @@
    pv = dma_alloc_coherent(NULL, uAllocLen, &PhyAddr, GFP_KERNEL);
    if ( NULL == pv ) 
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                  "%s Unable to allocate DMA buffer\n", __FUNCTION__);
+#endif
      return NULL;
    }
 
@@ -365,9 +369,11 @@
      * SSR */
     if (vos_is_load_unload_in_progress(VOS_MODULE_ID_WDI, NULL))
     {
+#ifdef WLAN_DEBUG
          WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                  "%s: loading/unloading in progress,"
                  " SSR will be done at the end of unload", __FUNCTION__);
+#endif
          return eWLAN_PAL_STATUS_E_FAILURE;
     }
     if (0 == subsystem_restart("riva")) 
@@ -376,17 +382,3 @@
     }
     return eWLAN_PAL_STATUS_E_FAILURE;
 }
-
-/*---------------------------------------------------------------------------
-    wpalWlanReload -  Initiate WLAN Driver reload
-
-    Param:
-       None
-    Return:
-       NONE
----------------------------------------------------------------------------*/
-void wpalWlanReload(void)
-{
-   vos_wlanRestart();
-   return;
-}
\ No newline at end of file
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_device.c b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
index 168b968..386037c 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
+++ b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_device.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -67,12 +67,9 @@
  * Preprocessor Definitions and Constants
  * -------------------------------------------------------------------------*/
 
-// address in the Host physical memory map
-#ifdef WCN_PRONTO
-#define WCNSS_BASE_ADDRESS 0xFB000000
-#else
+// address in the 8960 physical memory map
 #define WCNSS_BASE_ADDRESS 0x03000000
-#endif
+
 /*----------------------------------------------------------------------------
  * Type Declarations
  * -------------------------------------------------------------------------*/
@@ -189,22 +186,27 @@
 )
 {
    if (NULL == gpEnv) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: invoked before subsystem initialized",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    if (NULL == callbackFunction) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: invoked with NULL callback",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    switch (intType) {
 
    case DXE_INTERRUPT_TX_COMPLE:
+#ifdef WLAN_DEBUG
       if (NULL != gpEnv->tx_isr) {
          /* TX complete handler already registered */
          WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
@@ -212,11 +214,13 @@
                  __FUNCTION__);
          /* fall though and accept the new values */
       }
+#endif
       gpEnv->tx_isr = callbackFunction;
       gpEnv->tx_context = usrCtxt;
       break;
 
    case DXE_INTERRUPT_RX_READY:
+#ifdef WLAN_DEBUG
       if (NULL != gpEnv->rx_isr) {
          /* RX complete handler already registered */
          WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_WARN,
@@ -224,14 +228,17 @@
                  __FUNCTION__);
          /* fall though and accept the new values */
       }
+#endif
       gpEnv->rx_isr = callbackFunction;
       gpEnv->rx_context = usrCtxt;
       break;
 
    default:
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Unknown interrupt type [%u]",
                  __FUNCTION__, intType);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -255,9 +262,11 @@
 )
 {
    if (NULL == gpEnv) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: invoked before subsystem initialized",
                  __FUNCTION__);
+#endif
       return;
    }
 
@@ -286,9 +295,11 @@
       break;
 
    default:
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Unknown interrupt type [%u]",
                  __FUNCTION__, intType);
+#endif
       return;
    }
 
@@ -326,20 +337,22 @@
          ret = request_irq(gpEnv->rx_irq, wpalRxIsr, IRQF_TRIGGER_HIGH,
                      "wcnss_wlan", gpEnv);
          if (ret) {
+#ifdef WLAN_DEBUG
             WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                        "%s: RX IRQ request failure",
                        __FUNCTION__);
+#endif
            break;
          }
-      
-        
          ret = enable_irq_wake(gpEnv->rx_irq);
+#ifdef WLAN_DEBUG
          if (ret) {
             WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                        "%s: enable_irq_wake failed for RX IRQ",
                        __FUNCTION__);
             /* not fatal -- keep on going */
          }
+#endif
       }
       else
       {
@@ -353,20 +366,22 @@
          ret = request_irq(gpEnv->tx_irq, wpalTxIsr, IRQF_TRIGGER_HIGH,
                            "wcnss_wlan", gpEnv);
          if (ret) {
+#ifdef WLAN_DEBUG
             WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                        "%s: TX IRQ request failure",
                        __FUNCTION__);
+#endif
             break;
          }
-   
-   
          ret = enable_irq_wake(gpEnv->tx_irq);
+#ifdef WLAN_DEBUG
          if (ret) {
             WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                        "%s: enable_irq_wake failed for TX IRQ",
                        __FUNCTION__);
             /* not fatal -- keep on going */
          }
+#endif
       }
       else
       {
@@ -374,9 +389,11 @@
       }
       break;
    default:
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                     "%s: unknown interrupt: %d",
                     __FUNCTION__, (int)intType);
+#endif
       break;
    }
    /* on the integrated platform there is no platform-specific
@@ -413,9 +430,11 @@
       disable_irq_nosync(gpEnv->tx_irq);
       break;
    default:
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                     "%s: unknown interrupt: %d",
                     __FUNCTION__, (int)intType);
+#endif
       break;
    }
 
@@ -440,25 +459,31 @@
 )
 {
    if (NULL == gpEnv) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: invoked before subsystem initialized",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    if ((address < gpEnv->wcnss_memory->start) ||
        (address > gpEnv->wcnss_memory->end)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Register address 0x%0x out of range 0x%0x - 0x%0x",
                  __FUNCTION__, address,
                  gpEnv->wcnss_memory->start, gpEnv->wcnss_memory->end);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    if (0 != (address & 0x3)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Register address 0x%0x is not word aligned",
                  __FUNCTION__, address);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -484,25 +509,31 @@
 )
 {
    if (NULL == gpEnv) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: invoked before subsystem initialized",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    if ((address < gpEnv->wcnss_memory->start) ||
        (address > gpEnv->wcnss_memory->end)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Register address 0x%0x out of range 0x%0x - 0x%0x",
                  __FUNCTION__, address,
                  gpEnv->wcnss_memory->start, gpEnv->wcnss_memory->end);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    if (0 != (address & 0x3)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Register address 0x%0x is not word aligned",
                  __FUNCTION__, address);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -531,18 +562,22 @@
 )
 {
    if (NULL == gpEnv) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: invoked before subsystem initialized",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    if ((address < gpEnv->wcnss_memory->start) ||
        ((address + len) > gpEnv->wcnss_memory->end)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Memory address 0x%0x len %d out of range 0x%0x - 0x%0x",
                  __FUNCTION__, address, len,
                  gpEnv->wcnss_memory->start, gpEnv->wcnss_memory->end);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -571,18 +606,22 @@
 )
 {
    if (NULL == gpEnv) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: invoked before subsystem initialized",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    if ((address < gpEnv->wcnss_memory->start) ||
        ((address + len) > gpEnv->wcnss_memory->end)) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: Memory address 0x%0x len %d out of range 0x%0x - 0x%0x",
                  __FUNCTION__, address, len,
                  gpEnv->wcnss_memory->start, gpEnv->wcnss_memory->end);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -614,48 +653,60 @@
    int rx_irq;
 
    if (NULL != gpEnv) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: invoked  after subsystem initialized",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    if (NULL == wcnss_device) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: invalid device",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    wcnss_memory = wcnss_wlan_get_memory_map(wcnss_device);
    if (NULL == wcnss_memory) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: WCNSS memory map unavailable",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
 
    tx_irq = wcnss_wlan_get_dxe_tx_irq(wcnss_device);
    if (0 > tx_irq) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: WCNSS TX IRQ unavailable",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
 
    rx_irq = wcnss_wlan_get_dxe_rx_irq(wcnss_device);
    if (0 > rx_irq) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: WCNSS RX IRQ unavailable",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
 
    gpEnv = wpalMemoryAllocate(sizeof(*gpEnv));
    if (NULL == gpEnv) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: memory allocation failure",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_NOMEM;
    }
 
@@ -672,9 +723,11 @@
 
    gpEnv->mmio = ioremap(wcnss_memory->start, resource_size(wcnss_memory));
    if (NULL == gpEnv->mmio) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: memory remap failure",
                  __FUNCTION__);
+#endif
       goto err_ioremap;
    }
 
@@ -709,9 +762,11 @@
  )
 {
    if (NULL == gpEnv) {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: invoked before subsystem initialized",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -750,9 +805,11 @@
    rc = smsm_change_state(SMSM_APPS_STATE, clrSt, setSt);
    if(0 != rc) 
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_DAL_DATA, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: smsm_change_state failed",
                  __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
    return eWLAN_PAL_STATUS_SUCCESS;
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_msg.c b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_msg.c
index 999ac2e..6d42ac1 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_msg.c
+++ b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_msg.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -53,9 +53,11 @@
 
    if (NULL == pMsg)
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: NULL message pointer", __FUNCTION__);
       WPAL_ASSERT(0);
+#endif
       return status;
    }
 
@@ -67,12 +69,13 @@
    {
       status = eWLAN_PAL_STATUS_SUCCESS;
    }
+#ifdef WLAN_DEBUG
    else
    {
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s fail to post msg %d\n",
                   __FUNCTION__, pMsg->type);
    }
-
+#endif
    return status;
 }
 
@@ -91,9 +94,11 @@
 
    if (NULL == pMsg)
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: NULL message pointer", __FUNCTION__);
       WPAL_ASSERT(0);
+#endif
       return status;
    }
 
@@ -105,12 +110,13 @@
    {
       status = eWLAN_PAL_STATUS_SUCCESS;
    }
+#ifdef WLAN_DEBUG
    else
    {
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s fail to post msg %d\n",
                   __FUNCTION__, pMsg->type);
    }
-
+#endif
    return status;
 }
 
@@ -128,9 +134,11 @@
 
    if (NULL == pMsg)
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                  "%s: NULL message pointer", __FUNCTION__);
       WPAL_ASSERT(0);
+#endif
       return status;
    }
 
@@ -142,12 +150,13 @@
    {
       status = eWLAN_PAL_STATUS_SUCCESS;
    }
+#ifdef WLAN_DEBUG
    else
    {
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s fail to post msg %d\n",
                   __FUNCTION__, pMsg->type);
    }
-
+#endif
    return status;
 }
 
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c
index 07dc4d9..516a5bb 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c
+++ b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_packet.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -96,23 +96,29 @@
 
    if (NULL == pPacket)
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                   "Get new RX PAL packet fail");
+#endif
       return VOS_STATUS_E_FAILURE;
    }
    vosStatus = vos_pkt_reserve_head_fast( pPacket, &pData,
                                           VPKT_SIZE_BUFFER );
    if(VOS_STATUS_SUCCESS != vosStatus)
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                   "Prepare RX packet for DXE fail");
+#endif
       return VOS_STATUS_E_FAILURE;
    }
 
    if((NULL == wpalPacketAvailableCB) || (NULL == userData))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                   "Invalid ARG for new RX packet");
+#endif
       return VOS_STATUS_E_FAILURE;
    }
 
@@ -161,13 +167,19 @@
       else
       {
         wpalPacketAvailableCB = rxLowCB;
+#ifdef WLAN_DEBUG
+        WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                    "Failed to allocate packet : %d ", (int)vosStatus);
+#endif
       }
 #endif /* FEATURE_R33D */
       break;
 
    default:
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                   " try to allocate unsupported packet type (%d)\n", pktType);
+#endif
       break;
    }
 
@@ -221,8 +233,10 @@
    // Validate the parameter pointers
    if (unlikely(NULL == pPkt))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s : NULL packet pointer", __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -235,12 +249,13 @@
    {
       len += pktLen;
    }
+#ifdef WLAN_DEBUG
    else
    {
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s  failed\n",
          __FUNCTION__);
    }
-
+#endif
    return ((wpt_uint32)len);
 }/*wpalPacketGetLength*/
 
@@ -263,8 +278,10 @@
    // Validate the parameter pointers
    if (unlikely(NULL == pPkt))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s : NULL packet pointer", __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -273,8 +290,10 @@
 
    if( !VOS_IS_STATUS_SUCCESS(vos_pkt_trim_head(WPAL_TO_VOS_PKT(pPkt), (v_SIZE_t)size)) )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s  Invalid trim(%d)\n",
          __FUNCTION__, size);
+#endif
       status = eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -296,8 +315,10 @@
    // Validate the parameter pointers
    if (unlikely(NULL == pPkt))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s : NULL packet pointer", __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -305,8 +326,10 @@
                (eWLAN_PAL_PKT_TYPE_RX_RAW == WPAL_PACKET_GET_TYPE(pPkt)) );
    if( !VOS_IS_STATUS_SUCCESS(vos_pkt_trim_tail(WPAL_TO_VOS_PKT(pPkt), (v_SIZE_t)size)) )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s  Invalid trim(%d)\n",
          __FUNCTION__, size);
+#endif
       status = eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -331,8 +354,10 @@
    // Validate the parameter pointers
    if (unlikely(NULL == pPkt))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s : NULL packet pointer", __FUNCTION__);
+#endif
       return NULL;
    }
 
@@ -341,7 +366,9 @@
        (eWLAN_PAL_PKT_TYPE_TX_802_11_MGMT == WPAL_PACKET_GET_TYPE(pPkt)) )
    {
       vos_pkt_peek_data(WPAL_TO_VOS_PKT(pPkt), 0, (v_VOID_t**)&pRet, 1);
+#ifdef WLAN_DEBUG
       WPAL_ASSERT(NULL != pRet);
+#endif
    }            
 
    return pRet;
@@ -363,17 +390,21 @@
    // Validate the parameter pointers
    if (unlikely(NULL == pPkt))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s : NULL packet pointer", __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    /*Only allowed for RX Raw packets */
    if( (eWLAN_PAL_PKT_TYPE_RX_RAW != WPAL_PACKET_GET_TYPE(pPkt)))
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                 "%s  Invalid packet type(%d)\n",  __FUNCTION__, 
                 WPAL_PACKET_GET_TYPE(pPkt));
+#endif
      return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -464,16 +495,20 @@
    // Validate the parameter pointers
    if (unlikely((NULL == pPacket)||(NULL==pIter)))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s : NULL input pointers %x %x", __FUNCTION__, pPacket, pIter);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
    pPktInfo = (wpt_iterator_info*)pPacket->pInternalData;
    if (unlikely(NULL == pPktInfo))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s : Invalid Packet Info", __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -492,8 +527,10 @@
      // Validate the memory allocation
      if (unlikely(NULL == pCurInfo))
      {
+#ifdef WLAN_DEBUG
         WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                   "%s : Failed to allocate memory ", __FUNCTION__);
+#endif
         return eWLAN_PAL_STATUS_E_INVAL;
      }
 
@@ -532,8 +569,10 @@
    if (unlikely(( NULL == pIter )||( NULL == pPacket ) || 
       ( NULL == ppAddr ) || ( NULL == pLen )))
    {
+#ifdef WLAN_DEBUG
      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                 "%s  Invalid input parameters \n",  __FUNCTION__ );
+#endif
      return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -592,8 +631,10 @@
    // Validate the parameter pointers
    if (unlikely(NULL == pPacket))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s : NULL input pointer", __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -631,10 +672,12 @@
 
    default:
       {
+#ifdef WLAN_DEBUG
          WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                     " WLAN_PAL: %s: Invalid packet type %d!",  __FUNCTION__, 
                     WPAL_PACKET_GET_TYPE(pPacket) ); 
          WPAL_ASSERT(0); 
+#endif
          return eWLAN_PAL_STATUS_E_FAILURE;
       }
    }
@@ -648,8 +691,10 @@
    // Validate the memory allocation
    if (unlikely(NULL == pInfo))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s : Failed to allocate memory ", __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -677,8 +722,10 @@
    // Validate the parameter pointers
    if (unlikely(NULL == pPacket))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s : NULL input pointer pPacket", __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -687,8 +734,10 @@
    // Validate pInfo
    if (unlikely(NULL == pInfo))
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_FATAL,
                 "%s : NULL input pointer pInfo", __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -726,10 +775,12 @@
 
    default:
       {
+#ifdef WLAN_DEBUG
          WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                     " WLAN_PAL: %s: Invalid packet type %d!",  __FUNCTION__, 
                     WPAL_PACKET_GET_TYPE(pPacket) ); 
          WPAL_ASSERT(0); 
+#endif
          return eWLAN_PAL_STATUS_E_FAILURE;
       }
    }
@@ -757,8 +808,10 @@
    /* Validate the parameter pointers */
    if (NULL == pPacket)
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s : NULL input pointer", __FUNCTION__);
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_sync.c b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_sync.c
index 0af6282..5149839 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_sync.c
+++ b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_sync.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -57,8 +57,10 @@
 
    if( vos_lock_init( (vos_lock_t*)pMutex  ) != VOS_STATUS_SUCCESS )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                  " mutex init fail\n");
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
 
@@ -78,8 +80,10 @@
 
    if( vos_lock_destroy( (vos_lock_t*)pMutex  ) != VOS_STATUS_SUCCESS )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                  " mutex delete fail\n");
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
 
@@ -99,8 +103,10 @@
 
    if( vos_lock_acquire( (vos_lock_t*)pMutex  ) != VOS_STATUS_SUCCESS )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                  " mutex acquire fail\n");
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
 
@@ -120,8 +126,10 @@
 
    if( vos_lock_release( (vos_lock_t*)pMutex ) != VOS_STATUS_SUCCESS )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                  " mutex release\n");
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
 
@@ -141,8 +149,10 @@
 
    if( vos_event_init( (vos_event_t*)pEvent ) != VOS_STATUS_SUCCESS )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                  " create event fail\n");
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
 
@@ -163,8 +173,10 @@
 
    if( vos_event_destroy( (vos_event_t*)pEvent ) != VOS_STATUS_SUCCESS )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, 
                  " delete event fail\n");
+#endif
       return eWLAN_PAL_STATUS_E_FAILURE;
    }
 
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_timer.c b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_timer.c
index de7a3c3..9cf35ca 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_timer.c
+++ b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_timer.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -53,11 +53,13 @@
    {
       pTimer->callback(pTimer->pUserData);
    }
+#ifdef WLAN_DEBUG
    else
    {
       WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_WARN, " %s pTimer(%d) callback after deleted \n",
          __FUNCTION__, (wpt_uint32)pTimer );
    }
+#endif
 }/*wpalTimerCback*/
 
 /*---------------------------------------------------------------------------
@@ -74,8 +76,10 @@
    /* Sanity Checks */
    if( pTimer == NULL || callback == NULL )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d) callback(%d)\n",
          __FUNCTION__, (wpt_uint32)pTimer, (wpt_uint32)callback );
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -105,8 +109,10 @@
    /* Sanity Checks */
    if( pTimer == NULL )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d)\n",
          __FUNCTION__, (wpt_uint32)pTimer );
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
 
@@ -136,8 +142,10 @@
    /* Sanity Checks */
    if( pTimer == NULL )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d)\n",
          __FUNCTION__, (wpt_uint32)pTimer );
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
    return ( WPAL_VOS_TO_WPAL_STATUS( vos_timer_start( &pTimer->timer.timerObj,
@@ -159,8 +167,10 @@
    /* Sanity Checks */
    if( pTimer == NULL )
    {
+#ifdef WLAN_DEBUG
       WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d)\n",
          __FUNCTION__, (wpt_uint32)pTimer );
+#endif
       return eWLAN_PAL_STATUS_E_INVAL;
    }
    return (WPAL_VOS_TO_WPAL_STATUS( vos_timer_stop( &pTimer->timer.timerObj )));
diff --git a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_trace.c b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_trace.c
index 0e8b9aa..eba3942 100644
--- a/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_trace.c
+++ b/drivers/staging/prima/CORE/WDI/WPAL/src/wlan_qct_pal_trace.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/Kconfig b/drivers/staging/prima/Kconfig
index 2d54675..f59e8ae 100644
--- a/drivers/staging/prima/Kconfig
+++ b/drivers/staging/prima/Kconfig
@@ -15,12 +15,8 @@
 	bool "Enable the Prima WLAN BT-AMP feature"
 	default n
 
-config PRIMA_WLAN_LFR
-	bool "Enable the Prima WLAN Legacy Fast Roaming feature"
-	default n
-
-config PRIMA_WLAN_OKC
-	bool "Enable the Prima WLAN Opportunistic Key Caching feature"
+config HTC_WIFI_NVS
+	bool "Read WiFi data from HTC NVS"
 	default n
 
 endif # PRIMA_WLAN
diff --git a/drivers/staging/prima/Makefile b/drivers/staging/prima/Makefile
index 6c2ddc4..136327c 100644
--- a/drivers/staging/prima/Makefile
+++ b/drivers/staging/prima/Makefile
@@ -1,4 +1,4 @@
-MODNAME := wlan
+MODNAME := prima_wlan
 
 #Do we panic on bug?  default is to warn
 PANIC_ON_BUG := 0
@@ -429,7 +429,7 @@
 # Some of the WLAN structures are larger, so we increase the size.
 # Note that Linux kernel threads have an 8K stack, so take care not
 # to exceed that value in a "normal" call tree
-EXTRA_CFLAGS += -Wframe-larger-than=${CONFIG_FRAME_WARN}
+EXTRA_CFLAGS += -Wframe-larger-than=4096
 
 CDEFINES  := -DANI_PRODUCT_TYPE_CLIENT=1 \
 		-DANI_BUS_TYPE_PLATFORM=1 \
@@ -448,10 +448,6 @@
 		-DWNI_POLARIS_FW_OS=6 \
 		-DADVANCED=3 \
 		-DWNI_POLARIS_FW_PACKAGE=9 \
-		-DTRACE_RECORD \
-		-DPE_DEBUG_LOGW \
-		-DPE_DEBUG_LOGE \
-		-DDEBUG \
 		-DANI_LOGDUMP \
 		-DWLAN_PERF \
 		-DUSE_LOCKED_QUEUE \
@@ -459,7 +455,6 @@
 		-DFEATURE_WLAN_UAPSD_FW_TRG_FRAMES \
 		-DWLAN_SOFTAP_FEATURE \
 		-Wall\
-		-DWLAN_DEBUG \
 		-D__linux__ \
 		-DMSM_PLATFORM \
 		-DFEATURE_WLAN_INTEGRATED_SOC \
@@ -504,14 +499,6 @@
 CDEFINES += -DFEATURE_WLAN_CCX
 endif
 
-ifeq ($(CONFIG_PRIMA_WLAN_LFR),y)
-CDEFINES += -DFEATURE_WLAN_LFR
-endif
-
-ifeq ($(CONFIG_PRIMA_WLAN_OKC),y)
-CDEFINES += -DFEATURE_WLAN_OKC
-endif
-
 ifeq ($(BUILD_DIAG_VERSION),1)
 CDEFINES += -DFEATURE_WLAN_DIAG_SUPPORT
 CDEFINES += -DFEATURE_WLAN_DIAG_SUPPORT_CSR
@@ -533,10 +520,6 @@
 CDEFINES += -DWLAN_BTAMP_FEATURE
 endif
 
-CDEFINES += -DWLAN_FEATURE_11AC
-
-CDEFINES += -DWLAN_OPEN_SOURCE
-
 KBUILD_CPPFLAGS += $(CDEFINES)
 
 
diff --git a/drivers/staging/prima/riva/inc/halCompiler.h b/drivers/staging/prima/riva/inc/halCompiler.h
index 263ec52..2ae5226 100644
--- a/drivers/staging/prima/riva/inc/halCompiler.h
+++ b/drivers/staging/prima/riva/inc/halCompiler.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/riva/inc/halLegacyPalTypes.h b/drivers/staging/prima/riva/inc/halLegacyPalTypes.h
index 057c8ca..70fcaba 100644
--- a/drivers/staging/prima/riva/inc/halLegacyPalTypes.h
+++ b/drivers/staging/prima/riva/inc/halLegacyPalTypes.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/riva/inc/pttFrameGen.h b/drivers/staging/prima/riva/inc/pttFrameGen.h
index a3d1765..abff9d8 100644
--- a/drivers/staging/prima/riva/inc/pttFrameGen.h
+++ b/drivers/staging/prima/riva/inc/pttFrameGen.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/riva/inc/pttModule.h b/drivers/staging/prima/riva/inc/pttModule.h
index 362d8f7..3c07780 100644
--- a/drivers/staging/prima/riva/inc/pttModule.h
+++ b/drivers/staging/prima/riva/inc/pttModule.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/riva/inc/pttMsgApi.h b/drivers/staging/prima/riva/inc/pttMsgApi.h
index ecb478c..8809c9d 100644
--- a/drivers/staging/prima/riva/inc/pttMsgApi.h
+++ b/drivers/staging/prima/riva/inc/pttMsgApi.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/riva/inc/wlan_hal_cfg.h b/drivers/staging/prima/riva/inc/wlan_hal_cfg.h
index d665bde..ca769a8 100644
--- a/drivers/staging/prima/riva/inc/wlan_hal_cfg.h
+++ b/drivers/staging/prima/riva/inc/wlan_hal_cfg.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -134,26 +134,11 @@
 #define QWLAN_HAL_CFG_WCNSS_API_VERSION                  80
 #define QWLAN_HAL_CFG_AP_KEEPALIVE_TIMEOUT               81
 #define QWLAN_HAL_CFG_GO_KEEPALIVE_TIMEOUT               82
-#define QWLAN_HAL_CFG_ENABLE_MC_ADDR_LIST                83
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_BT              84
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_BT             85
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_BT             86
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_BT               87
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_WLAN            88
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_WLAN           89
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_WLAN           90
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_WLAN             91
-#define QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_BT                 92
-#define QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_WLAN               93
-#define QWLAN_HAL_CFG_BTC_MAX_SCO_BLOCK_PERC             94
-#define QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_A2DP              95
-#define QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_SCO               96
-#define QWLAN_HAL_CFG_MAX_PARAMS                         97
+#define QWLAN_HAL_CFG_MAX_PARAMS                         83
 
 
 /* Total number of Integer CFGs. This is used while allocating the memory for TLV */
-#define QWLAN_HAL_CFG_INTEGER_PARAM                      93
-
+#define QWLAN_HAL_CFG_INTEGER_PARAM                      79
 
 /*-------------------------------------------------------------------------
   Configuration Parameter min, max, defaults
@@ -628,7 +613,7 @@
 
 /* QWLAN_HAL_CFG_WCNSS_API_VERSION */
 #define QWLAN_HAL_CFG_WCNSS_API_VERSION_MIN  0           /* equivalent to 0.0.0.0 */
-#define QWLAN_HAL_CFG_WCNSS_API_VERSION_MAX  4294967295U /* equivalent to 255.255.255.255 */
+#define QWLAN_HAL_CFG_WCNSS_API_VERSION_MAX  4294967295  /* equivalent to 255.255.255.255 */
 #define QWLAN_HAL_CFG_WCNSS_API_VERSION_DEF  0           /* equivalent to 0.0.0.0 */
 
 /* QWLAN_HAL_CFG_AP_KEEPALIVE_TIMEOUT */
@@ -641,76 +626,6 @@
 #define QWLAN_HAL_CFG_GO_KEEPALIVE_TIMEOUT_MAX  255
 #define QWLAN_HAL_CFG_GO_KEEPALIVE_TIMEOUT_DEF  20
 
-/* QWLAN_HAL_CFG_ENABLE_MC_ADDR_LIST */
-#define QWLAN_HAL_CFG_ENABLE_MC_ADDR_LIST_MIN  0
-#define QWLAN_HAL_CFG_ENABLE_MC_ADDR_LIST_MAX  1
-#define QWLAN_HAL_CFG_ENABLE_MC_ADDR_LIST_DEF  0
-
-/* QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_BT */
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_BT_MIN 5000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_BT_MAX 500000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_BT_DEF 120000
-
-/* QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_BT */
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_BT_MIN 5000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_BT_MAX 500000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_BT_DEF 10000
-
-/* QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_BT */
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_BT_MIN 5000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_BT_MAX 500000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_BT_DEF 10000
-
-/* QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_BT */
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_BT_MIN 5000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_BT_MAX 500000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_BT_DEF 10000
-
-/* QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_WLAN */
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_WLAN_MIN 0
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_WLAN_MAX 500000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_WLAN_DEF 30000
-
-/* QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_WLAN */
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_WLAN_MIN 0
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_WLAN_MAX 500000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_WLAN_DEF 0
-
-/* QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_WLAN */
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_WLAN_MIN 0
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_WLAN_MAX 500000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_WLAN_DEF 0
-
-/* QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_WLAN */
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_WLAN_MIN 0
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_WLAN_MAX 500000
-#define QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_WLAN_DEF 0
-
-/* QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_BT */
-#define QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_BT_MIN 25000
-#define QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_BT_MAX 500000
-#define QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_BT_DEF 250000
-
-/* QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_WLAN */
-#define QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_WLAN_MIN 15000
-#define QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_WLAN_MAX 500000
-#define QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_WLAN_DEF 45000
-
-/* QWLAN_HAL_CFG_BTC_MAX_SCO_BLOCK_PERC */
-#define QWLAN_HAL_CFG_BTC_MAX_SCO_BLOCK_PERC_MIN 0
-#define QWLAN_HAL_CFG_BTC_MAX_SCO_BLOCK_PERC_MAX 100
-#define QWLAN_HAL_CFG_BTC_MAX_SCO_BLOCK_PERC_DEF 1
-
-/* QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_A2DP */
-#define QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_A2DP_MIN 0
-#define QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_A2DP_MAX 1
-#define QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_A2DP_DEF 1
-
-/* QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_SCO */
-#define QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_SCO_MIN 0
-#define QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_SCO_MAX 1
-#define QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_SCO_DEF 0
-
 typedef struct 
 {
    uint8    cfgStaId[QCOM_WLAN_CFG_STA_ID_LEN]; //QWLAN_HAL_CFG_STA_ID
@@ -797,20 +712,6 @@
    uint32   cfgWcnssApiVersion;               //QWLAN_HAL_CFG_WCNSS_API_VERSION
    uint32   cfgApKeepAliveTimeout;            //QWLAN_HAL_CFG_AP_KEEPALIVE_TIMEOUT
    uint32   cfgGoKeepAliveTimeout;            //QWLAN_HAL_CFG_GO_KEEPALIVE_TIMEOUT
-   uint32   cfgEnableMCAddrList;              //QWLAN_HAL_CFG_ENABLE_MC_ADDR_LIST   
-   uint32   cfgBtcStaticLenInqBt;             //QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_BT
-   uint32   cfgBtcStaticLenPageBt;            //QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_BT
-   uint32   cfgBtcStaticLenConnBt;            //QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_BT
-   uint32   cfgBtcStaticLenLeBt;              //QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_BT
-   uint32   cfgBtcStaticLenInqWlan;           //QWLAN_HAL_CFG_BTC_STATIC_LEN_INQ_WLAN
-   uint32   cfgBtcStaticLenPageWlan;          //QWLAN_HAL_CFG_BTC_STATIC_LEN_PAGE_WLAN
-   uint32   cfgBtcStaticLenConnWlan;          //QWLAN_HAL_CFG_BTC_STATIC_LEN_CONN_WLAN
-   uint32   cfgBtcStaticLenLeWlan;            //QWLAN_HAL_CFG_BTC_STATIC_LEN_LE_WLAN
-   uint32   cfgBtcDynMaxLenBt;                //QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_BT
-   uint32   cfgBtcDynMaxLenWlan;              //QWLAN_HAL_CFG_BTC_DYN_MAX_LEN_WLAN
-   uint32   cfgBtcMaxScoBlockPerc;            //QWLAN_HAL_CFG_BTC_MAX_SCO_BLOCK_PERC
-   uint32   cfgBtcDhcpProtOnA2dp;             //QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_A2DP
-   uint32   cfgBtcDhcpProtOnSco;              //QWLAN_HAL_CFG_BTC_DHCP_PROT_ON_SCO
 }tAniHalCfg, *tpAniHalCfg;
 
 #endif //__WLAN_HAL_CFG_H__
diff --git a/drivers/staging/prima/riva/inc/wlan_hal_msg.h b/drivers/staging/prima/riva/inc/wlan_hal_msg.h
index d332c4f..e4d6adf 100644
--- a/drivers/staging/prima/riva/inc/wlan_hal_msg.h
+++ b/drivers/staging/prima/riva/inc/wlan_hal_msg.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -39,6 +39,7 @@
 #include "halCompiler.h"
 #include "wlan_qct_dev_defs.h"
 #include "wlan_nv.h"
+
 /*---------------------------------------------------------------------------
   API VERSIONING INFORMATION
 
@@ -53,8 +54,8 @@
       or if a new API is added
   All values are in the range 0..255 (ie they are 8-bit values)
  ---------------------------------------------------------------------------*/
-#define WLAN_HAL_VER_MAJOR 1
-#define WLAN_HAL_VER_MINOR 3
+#define WLAN_HAL_VER_MAJOR 0
+#define WLAN_HAL_VER_MINOR 1
 #define WLAN_HAL_VER_VERSION 1
 #define WLAN_HAL_VER_REVISION 0
 
@@ -64,7 +65,6 @@
 
 //This is to force compiler to use the maximum of an int ( 4 bytes )
 #define WLAN_HAL_MAX_ENUM_SIZE    0x7FFFFFFF
-#define WLAN_HAL_MSG_TYPE_MAX_ENUM_SIZE    0x7FFF
 
 //Max no. of transmit categories
 #define STACFG_MAX_TC    8
@@ -349,17 +349,9 @@
    WLAN_HAL_SET_THERMAL_MITIGATION_REQ      = 178,
    WLAN_HAL_SET_THERMAL_MITIGATION_RSP      = 179,
 
-  WLAN_HAL_MSG_MAX = WLAN_HAL_MSG_TYPE_MAX_ENUM_SIZE
+   WLAN_HAL_MSG_MAX = WLAN_HAL_MAX_ENUM_SIZE
 }tHalHostMsgType;
 
-/* Enumeration for Version */
-typedef enum
-{
-   WLAN_HAL_MSG_VERSION0 = 0,
-   WLAN_HAL_MSG_VERSION1 = 1,
-   WLAN_HAL_MSG_VERSION_MAX_FIELD = 0x7FFF /*define as 2 bytes data*/
-}tHalHostMsgVersion;
-
 /* Enumeration for Boolean - False/True, On/Off */
 typedef enum tagAniBoolean 
 {
@@ -393,8 +385,6 @@
    eHAL_SYS_MODE_SCAN,
    eHAL_SYS_MODE_PROMISC,
    eHAL_SYS_MODE_SUSPEND_LINK,
-   eHAL_SYS_MODE_ROAM_SCAN,
-   eHAL_SYS_MODE_ROAM_SUSPEND_LINK,
    eHAL_SYS_MODE_MAX = WLAN_HAL_MAX_ENUM_SIZE
 } eHalSysMode;
 
@@ -404,15 +394,6 @@
     PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1,  // 40MHz IF bandwidth with lower 20MHz supporting the primary channel
     PHY_DOUBLE_CHANNEL_CENTERED = 2,     // 40MHz IF bandwidth centered on IF carrier
     PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3, // 40MHz IF bandwidth with higher 20MHz supporting the primary channel
-#ifdef WLAN_FEATURE_11AC
-    PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED = 4, //20/40MHZ offset LOW 40/80MHZ offset CENTERED
-    PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED = 5, //20/40MHZ offset CENTERED 40/80MHZ offset CENTERED
-    PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED = 6, //20/40MHZ offset HIGH 40/80MHZ offset CENTERED
-    PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW = 7,//20/40MHZ offset LOW 40/80MHZ offset LOW
-    PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW = 8, //20/40MHZ offset HIGH 40/80MHZ offset LOW
-    PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH = 9, //20/40MHZ offset LOW 40/80MHZ offset HIGH
-    PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH = 10,//20/40MHZ offset-HIGH 40/80MHZ offset HIGH
-#endif
     PHY_CHANNEL_BONDING_STATE_MAX = WLAN_HAL_MAX_ENUM_SIZE
 }ePhyChanBondState;
 
@@ -435,9 +416,6 @@
     eSTA_11bg,
     eSTA_11a,
     eSTA_11n,
-#ifdef WLAN_FEATURE_11AC
-    eSTA_11ac,
-#endif
     eSTA_INVALID_RATE_MODE = WLAN_HAL_MAX_ENUM_SIZE
 } tStaRateMode, *tpStaRateMode;
 
@@ -481,6 +459,14 @@
   eSIR_HT_OP_MODE_MAX = WLAN_HAL_MAX_ENUM_SIZE
 } tSirMacHTOperatingMode;
 
+typedef enum eSirMacHTSecondaryChannelOffset
+{
+    eHT_SECONDARY_CHANNEL_OFFSET_NONE = 0,
+    eHT_SECONDARY_CHANNEL_OFFSET_UP = 1,
+    eHT_SECONDARY_CHANNEL_OFFSET_DOWN = 3,
+    eHT_SECONDARY_CHANNEL_OFFSET_MAX = WLAN_HAL_MAX_ENUM_SIZE
+} tSirMacHTSecondaryChannelOffset;
+
 /// Encryption type enum used with peer
 typedef enum eAniEdType
 {
@@ -508,7 +494,9 @@
     eSIR_TX_ONLY,
     eSIR_RX_ONLY,
     eSIR_TX_RX,
+#ifdef WLAN_SOFTAP_FEATURE
     eSIR_TX_DEFAULT,
+#endif
     eSIR_DONOT_USE_KEY_DIRECTION = WLAN_HAL_MAX_ENUM_SIZE
 } tAniKeyDirection;
 
@@ -627,8 +615,12 @@
     /*Default WEP key, valid only for static WEP, must between 0 and 3.*/
     tANI_U8         defWEPIdx;
 
+#ifdef WLAN_SOFTAP_FEATURE
     /* valid only for non-static WEP encyrptions */
     tSirKeys        key[SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS];            
+#else
+    tSirKeys        key;
+#endif
   
     /*Control for Replay Count, 1= Single TID based replay count on Tx
       0 = Per TID based replay count on TX */
@@ -641,8 +633,7 @@
 /* 4-byte control message header used by HAL*/
 typedef PACKED_PRE struct PACKED_POST
 {
-   tHalHostMsgType  msgType:16;
-   tHalHostMsgVersion msgVersion:16;
+   tHalHostMsgType  msgType;
    tANI_U32         msgLen;
 } tHalMsgHeader, *tpHalMsgHeader;
 
@@ -1206,173 +1197,9 @@
     /*Short GI support for 20Mhz packets*/
     tANI_U8 fShortGI20Mhz;
 
-    /*Robust Management Frame (RMF) enabled/disabled*/
-    tANI_U8 rmfEnabled;
-
-    /* The unicast encryption type in the association */
-    tANI_U32 encryptType;
-
-    /*HAL should update the existing STA entry, if this flag is set. UMAC
-      will set this flag in case of RE-ASSOC, where we want to reuse the old
-      STA ID. 0 = Add, 1 = Update*/
-    tANI_U8 action;
-
-    /*U-APSD Flags: 1b per AC.  Encoded as follows:
-       b7 b6 b5 b4 b3 b2 b1 b0 =
-       X  X  X  X  BE BK VI VO */
-    tANI_U8 uAPSD;
-
-    /*Max SP Length*/
-    tANI_U8 maxSPLen;
-
-    /*11n Green Field preamble support
-      0 - Not supported, 1 - Supported */
-    tANI_U8 greenFieldCapable;
-
-    /*MIMO Power Save mode*/
-    tSirMacHTMIMOPowerSaveState mimoPS;
-
-    /*Delayed BA Support*/
-    tANI_U8 delayedBASupport;
-
-    /*Max AMPDU duration in 32us*/
-    tANI_U8 us32MaxAmpduDuration;
-
-    /*HT STA should set it to 1 if it is enabled in BSS. HT STA should set
-      it to 0 if AP does not support it. This indication is sent to HAL and
-      HAL uses this flag to pickup up appropriate 40Mhz rates.*/
-    tANI_U8 fDsssCckMode40Mhz;
-
-    /* Valid STA Idx when action=Update. Set to 0xFF when invalid!
-       Retained for backward compalibity with existing HAL code*/
-    tANI_U8 staIdx;
-
-    /* BSSID of BSS to which station is associated. Set to 0xFF when invalid.
-       Retained for backward compalibity with existing HAL code*/
-    tANI_U8 bssIdx;
-
-    tANI_U8  p2pCapableSta;
-
-    /*Reserved to align next field on a dword boundary*/
-    tANI_U8  reserved;
-
     /*These rates are the intersection of peer and self capabilities.*/
     tSirSupportedRates supportedRates;
 
-} tConfigStaParams, *tpConfigStaParams;
-
-/*------------------------------------------------------------------------
- * WLAN_HAL_CONFIG_STA_REQ
- * ----------------------------------------------------------------------*/
-
-typedef PACKED_PRE struct PACKED_POST {
-    /*
-    * For Self STA Entry: this represents Self Mode.
-    * For Peer Stations, this represents the mode of the peer.
-    * On Station:
-    * --this mode is updated when PE adds the Self Entry.
-    * -- OR when PE sends 'ADD_BSS' message and station context in BSS is used to indicate the mode of the AP.
-    * ON AP:
-    * -- this mode is updated when PE sends 'ADD_BSS' and Sta entry for that BSS is used
-    *     to indicate the self mode of the AP.
-    * -- OR when a station is associated, PE sends 'ADD_STA' message with this mode updated.
-    */
-
-    tStaRateMode        opRateMode;
-    // 11b, 11a and aniLegacyRates are IE rates which gives rate in unit of 500Kbps
-    tANI_U16             llbRates[SIR_NUM_11B_RATES];
-    tANI_U16             llaRates[SIR_NUM_11A_RATES];
-    tANI_U16             aniLegacyRates[SIR_NUM_POLARIS_RATES];
-    tANI_U16             reserved;
-
-    //Taurus only supports 26 Titan Rates(no ESF/concat Rates will be supported)
-    //First 26 bits are reserved for those Titan rates and
-    //the last 4 bits(bit28-31) for Taurus, 2(bit26-27) bits are reserved.
-    tANI_U32             aniEnhancedRateBitmap; //Titan and Taurus Rates
-
-    /*
-    * 0-76 bits used, remaining reserved
-    * bits 0-15 and 32 should be set.
-    */
-    tANI_U8 supportedMCSSet[SIR_MAC_MAX_SUPPORTED_MCS_SET];
-
-    /*
-     * RX Highest Supported Data Rate defines the highest data
-     * rate that the STA is able to receive, in unites of 1Mbps.
-     * This value is derived from "Supported MCS Set field" inside
-     * the HT capability element.
-     */
-    tANI_U16 rxHighestDataRate;
-
-    /* Indicates the Maximum MCS that can be received for each number
-        * of spacial streams */
-    tANI_U16 vhtRxMCSMap;
-
-    /*Indicate the highest VHT data rate that the STA is able to receive*/
-    tANI_U16 vhtRxHighestDataRate;
-
-    /* Indicates the Maximum MCS that can be transmitted  for each number
-         * of spacial streams */
-    tANI_U16 vhtTxMCSMap;
-
-    /*Indicate the highest VHT data rate that the STA is able to transmit*/
-    tANI_U16 vhtTxHighestDataRate;
-
-} tSirSupportedRates_V1, *tpSirSupportedRates_V1;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-    /*BSSID of STA*/
-    tSirMacAddr bssId;
-
-    /*ASSOC ID, as assigned by UMAC*/
-    tANI_U16 assocId;
-
-    /* STA entry Type: 0 - Self, 1 - Other/Peer, 2 - BSSID, 3 - BCAST */
-    tANI_U8 staType;
-
-    /*Short Preamble Supported.*/
-    tANI_U8 shortPreambleSupported;
-
-    /*MAC Address of STA*/
-    tSirMacAddr staMac;
-
-    /*Listen interval of the STA*/
-    tANI_U16 listenInterval;
-
-    /*Support for 11e/WMM*/
-    tANI_U8 wmmEnabled;
-
-    /*11n HT capable STA*/
-    tANI_U8 htCapable;
-
-    /*TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz*/
-    tANI_U8 txChannelWidthSet;
-
-    /*RIFS mode 0 - NA, 1 - Allowed */
-    tANI_U8 rifsMode;
-
-    /*L-SIG TXOP Protection mechanism
-      0 - No Support, 1 - Supported
-      SG - there is global field */
-    tANI_U8 lsigTxopProtection;
-
-    /*Max Ampdu Size supported by STA. TPE programming.
-      0 : 8k , 1 : 16k, 2 : 32k, 3 : 64k */
-    tANI_U8 maxAmpduSize;
-
-    /*Max Ampdu density. Used by RA.  3 : 0~7 : 2^(11nAMPDUdensity -4)*/
-    tANI_U8 maxAmpduDensity;
-
-    /*Max AMSDU size 1 : 3839 bytes, 0 : 7935 bytes*/
-    tANI_U8 maxAmsduSize;
-
-    /*Short GI support for 40Mhz packets*/
-    tANI_U8 fShortGI40Mhz;
-
-    /*Short GI support for 20Mhz packets*/
-    tANI_U8 fShortGI20Mhz;
-
     /*Robust Management Frame (RMF) enabled/disabled*/
     tANI_U8 rmfEnabled;
 
@@ -1420,23 +1247,12 @@
 
     tANI_U8  p2pCapableSta;
 
-    /*Reserved to align next field on a dword boundary*/
-    tANI_U8  reserved;
-        /*These rates are the intersection of peer and self capabilities.*/
-    tSirSupportedRates_V1 supportedRates;
-
-    tANI_U8  vhtCapable;
-    tANI_U8  vhtTxChannelWidthSet;
-
-} tConfigStaParams_V1, *tpConfigStaParams_V1;
+} tConfigStaParams, *tpConfigStaParams;
 
 typedef PACKED_PRE struct PACKED_POST
 {
    tHalMsgHeader header;
-   PACKED_PRE union PACKED_POST {
    tConfigStaParams configStaParams;
-    tConfigStaParams_V1 configStaParams_V1;
-   } uStaParams;
 }  tConfigStaReqMsg, *tpConfigStaReqMsg;
 
 /*---------------------------------------------------------------------------
@@ -1604,8 +1420,10 @@
     /* BSSID */
     tSirMacAddr bssId;
 
+#ifdef HAL_SELF_STA_PER_BSS
     /* Self Mac Address */
     tSirMacAddr  selfMacAddr;
+#endif
 
     /* BSS type */
     tSirBssType bssType;
@@ -1658,140 +1476,11 @@
     /*Reserved to align next field on a dword boundary*/
     tANI_U8 reserved;
 
-    /*SSID of the BSS*/
-    tSirMacSSid ssId;
-
-    /*HAL should update the existing BSS entry, if this flag is set.
-      UMAC will set this flag in case of reassoc, where we want to resue the
-      the old BSSID and still return success 0 = Add, 1 = Update*/
-    tANI_U8 action;
-
-    /* MAC Rate Set */
-    tSirMacRateSet rateSet;
-
-    /*Enable/Disable HT capabilities of the BSS*/
-    tANI_U8 htCapable;
-
-    // Enable/Disable OBSS protection
-    tANI_U8 obssProtEnabled;
-
-    /*RMF enabled/disabled*/
-    tANI_U8 rmfEnabled;
-
-    /*HT Operating Mode operating mode of the 802.11n STA*/
-    tSirMacHTOperatingMode htOperMode;
-
-    /*Dual CTS Protection: 0 - Unused, 1 - Used*/
-    tANI_U8 dualCTSProtection;
-
-    /* Probe Response Max retries */
-    tANI_U8   ucMaxProbeRespRetryLimit;
-
-    /* To Enable Hidden ssid */
-    tANI_U8   bHiddenSSIDEn;
-
-    /* To Enable Disable FW Proxy Probe Resp */
-    tANI_U8   bProxyProbeRespEn;
-
-    /* Boolean to indicate if EDCA params are valid. UMAC might not have valid
-       EDCA params or might not desire to apply EDCA params during config BSS.
-       0 implies Not Valid ; Non-Zero implies valid*/
-    tANI_U8   edcaParamsValid;
-
-    /*EDCA Parameters for Best Effort Access Category*/
-    tSirMacEdcaParamRecord acbe;
-
-    /*EDCA Parameters forBackground Access Category*/
-    tSirMacEdcaParamRecord acbk;
-
-    /*EDCA Parameters for Video Access Category*/
-    tSirMacEdcaParamRecord acvi;
-
-    /*EDCA Parameters for Voice Access Category*/
-    tSirMacEdcaParamRecord acvo;
-
-#ifdef WLAN_FEATURE_VOWIFI_11R
-    tANI_U8 extSetStaKeyParamValid; //Ext Bss Config Msg if set
-    tSetStaKeyParams extSetStaKeyParam;  //SetStaKeyParams for ext bss msg
-#endif
-
-    /* Persona for the BSS can be STA,AP,GO,CLIENT value same as tHalConMode */
-    tANI_U8   halPersona;
-
-    tANI_U8 bSpectrumMgtEnable;
-
-    /*HAL fills in the tx power used for mgmt frames in txMgmtPower*/
-    tANI_S8     txMgmtPower;
-    /*maxTxPower has max power to be used after applying the power constraint if any */
-    tANI_S8     maxTxPower;
     /*Context of the station being added in HW
       Add a STA entry for "itself" -
       On AP  - Add the AP itself in an "STA context"
       On STA - Add the AP to which this STA is joining in an "STA context" */
     tConfigStaParams staContext;
-} tConfigBssParams, * tpConfigBssParams;
-
-
-/*--------------------------------------------------------------------------
- * WLAN_HAL_CONFIG_BSS_REQ
- *--------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-    /* BSSID */
-    tSirMacAddr bssId;
-
-    /* Self Mac Address */
-    tSirMacAddr  selfMacAddr;
-
-    /* BSS type */
-    tSirBssType bssType;
-
-    /*Operational Mode: AP =0, STA = 1*/
-    tANI_U8 operMode;
-
-    /*Network Type*/
-    tSirNwType nwType;
-
-    /*Used to classify PURE_11G/11G_MIXED to program MTU*/
-    tANI_U8 shortSlotTimeSupported;
-
-    /*Co-exist with 11a STA*/
-    tANI_U8 llaCoexist;
-
-    /*Co-exist with 11b STA*/
-    tANI_U8 llbCoexist;
-
-    /*Co-exist with 11g STA*/
-    tANI_U8 llgCoexist;
-
-    /*Coexistence with 11n STA*/
-    tANI_U8 ht20Coexist;
-
-    /*Non GF coexist flag*/
-    tANI_U8 llnNonGFCoexist;
-
-    /*TXOP protection support*/
-    tANI_U8 fLsigTXOPProtectionFullSupport;
-    /*RIFS mode*/
-    tANI_U8 fRIFSMode;
-
-    /*Beacon Interval in TU*/
-    tSirMacBeaconInterval beaconInterval;
-
-    /*DTIM period*/
-    tANI_U8 dtimPeriod;
-
-    /*TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz*/
-    tANI_U8 txChannelWidthSet;
-
-    /*Operating channel*/
-    tANI_U8 currentOperChannel;
-
-    /*Extension channel for channel bonding*/
-    tANI_U8 currentExtChannel;
-
-    /*Reserved to align next field on a dword boundary*/
-    tANI_U8 reserved;
 
     /*SSID of the BSS*/
     tSirMacSSid ssId;
@@ -1859,23 +1548,13 @@
     tANI_S8     txMgmtPower;
     /*maxTxPower has max power to be used after applying the power constraint if any */
     tANI_S8     maxTxPower;
-    /*Context of the station being added in HW
-      Add a STA entry for "itself" -
-      On AP  - Add the AP itself in an "STA context"
-      On STA - Add the AP to which this STA is joining in an "STA context" */
-    tConfigStaParams_V1 staContext;
   
-    tANI_U8   vhtCapable;
-    tANI_U8   vhtTxChannelWidthSet;
-} tConfigBssParams_V1, * tpConfigBssParams_V1;
+} tConfigBssParams, * tpConfigBssParams;
 
 typedef PACKED_PRE struct PACKED_POST
 {
    tHalMsgHeader header;
-   PACKED_PRE union PACKED_POST {
    tConfigBssParams configBssParams;
-    tConfigBssParams_V1 configBssParams_V1;
-   }uBssParams;
 }  tConfigBssReqMsg, *tpConfigBssReqMsg;
 
 /*---------------------------------------------------------------------------
@@ -1987,7 +1666,7 @@
   tANI_U8         ucLocalPowerConstraint;
 
   /*Secondary channel offset */
-  ePhyChanBondState  secondaryChannelOffset;
+  tSirMacHTSecondaryChannelOffset  secondaryChannelOffset;
 
   /*link State*/
   tSirLinkState   linkState;
@@ -2240,14 +1919,14 @@
 --------------------------------------------------------------------------*/
 typedef PACKED_PRE struct PACKED_POST
 {
-    tANI_U32                 status;
-    tSirMacAddr              selfMacAddr;
+    tANI_U32                status;
+    tSirMacAddr             selfMacAddr;
     tANI_U8                 oemDataReq[OEM_DATA_REQ_SIZE];
 } tStartOemDataReqParams, *tpStartOemDataReqParams;
 
 typedef PACKED_PRE struct PACKED_POST
 {
-    tHalMsgHeader                header;
+    tHalMsgHeader           header;
     tStartOemDataReqParams  startOemDataReqParams;
 } tStartOemDataReqMsg, *tpStartOemDataReqMsg;
 
@@ -2283,7 +1962,7 @@
     tANI_U8 localPowerConstraint;
 
     /*Secondary channel offset */
-    ePhyChanBondState secondaryChannelOffset;
+    tSirMacHTSecondaryChannelOffset secondaryChannelOffset;
 
     //HAL fills in the tx power used for mgmt frames in this field.
     tPowerdBm txMgmtPower;
@@ -3243,7 +2922,9 @@
     tANI_U32 beaconLength; //length of the template.
     tANI_U8 beacon[BEACON_TEMPLATE_SIZE];     // Beacon data.
     tSirMacAddr bssId;
+#ifdef WLAN_SOFTAP_FEATURE
     tANI_U32 timIeOffset; //TIM IE offset from the beginning of the template.
+#endif
     tANI_U16 p2pIeOffset; //P2P IE offset from the begining of the template
 }tSendBeaconParams, *tpSendBeaconParams;
 
@@ -3382,6 +3063,7 @@
 
 #endif
 
+#ifdef WLAN_SOFTAP_FEATURE
 /*---------------------------------------------------------------------------
  *WLAN_HAL_UPDATE_PROBE_RSP_TEMPLATE_REQ
  *-------------------------------------------------------------------------*/
@@ -3443,8 +3125,10 @@
     tANI_U16    staId;
     tSirMacAddr bssId; // TO SUPPORT BT-AMP
                        // HAL copies bssid from the sta table.
+#ifdef WLAN_SOFTAP_FEATURE
     tSirMacAddr addr2;        //
     tANI_U16    reasonCode;   // To unify the keepalive / unknown A2 / tim-based disa                                                                        
+#endif
 
 }tDeleteStaContextParams, *tpDeleteStaContextParams;
 
@@ -3455,6 +3139,7 @@
     tDeleteStaContextParams deleteStaContextParams;
 }tDeleteStaContextIndMsg, *tpDeleteStaContextIndMsg;
 
+#endif
 
 /*---------------------------------------------------------------------------
  *WLAN_HAL_SIGNAL_BTAMP_EVENT_REQ
@@ -3586,7 +3271,6 @@
 typedef PACKED_PRE struct PACKED_POST
 {
    tANI_U8     sendDataNull;
-   tANI_U8     bssIdx;
 } tHalExitBmpsReqParams, *tpHalExitBmpsReqParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -3670,7 +3354,6 @@
    tANI_U8 targetIPv6Addr2Valid : 1;
    tANI_U8 reserved1 : 5;
    tANI_U8 reserved2;   //make it DWORD aligned
-   tANI_U8 bssIdx;
 } tHalNSOffloadParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -3710,7 +3393,6 @@
     tHalIpv4Addr     hostIpv4Addr; 
     tHalIpv4Addr     destIpv4Addr;
     tSirMacAddr      destMacAddr;
-    tANI_U8          bssIdx;
 } tHalKeepAliveReq, *tpHalKeepAliveReq;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -3755,7 +3437,6 @@
     tANI_U8     beTriggerEnabled:1;
     tANI_U8     viTriggerEnabled:1;
     tANI_U8     voTriggerEnabled:1;
-    tANI_U8     bssIdx;
 } tUapsdReqParams, *tpUapsdReqParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -3770,7 +3451,6 @@
 typedef PACKED_PRE struct PACKED_POST
 {
    tHalMsgHeader header;
-   tANI_U8       bssIdx;
 }  tHalExitUapsdReqMsg, *tpHalExitUapsdReqMsg;
 
 /*---------------------------------------------------------------------------
@@ -3791,7 +3471,6 @@
     tANI_U8  ucPatternMask[HAL_WOWL_BCAST_PATTERN_MAX_SIZE]; // Pattern mask
     tANI_U8  ucPatternExt[HAL_WOWL_BCAST_PATTERN_MAX_SIZE]; // Extra pattern
     tANI_U8  ucPatternMaskExt[HAL_WOWL_BCAST_PATTERN_MAX_SIZE]; // Extra pattern mask
-    tANI_U8  bssIdx;
 } tHalWowlAddBcastPtrn, *tpHalWowlAddBcastPtrn;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -3799,8 +3478,6 @@
    tHalMsgHeader header;
    tHalWowlAddBcastPtrn ptrnParams;
 }  tHalWowlAddBcastPtrnReqMsg, *tpHalWowlAddBcastPtrnReqMsg;
-                                
-
 
 /*---------------------------------------------------------------------------
  * WLAN_HAL_DEL_WOWL_BCAST_PTRN
@@ -3809,7 +3486,6 @@
 {
     /* Pattern ID of the wakeup pattern to be deleted */
     tANI_U8  ucPatternId;
-    tANI_U8  bssIdx;
 } tHalWowlDelBcastPtrn, *tpHalWowlDelBcastPtrn;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -3899,8 +3575,6 @@
      */
     tANI_U8   ucWoWBSSConnLoss;
 
-    tANI_U8   bssIdx;
-
 } tHalWowlEnterParams, *tpHalWowlEnterParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -3912,17 +3586,9 @@
 /*---------------------------------------------------------------------------
  * WLAN_HAL_EXIT_WOWL_REQ
  *--------------------------------------------------------------------------*/
-
 typedef PACKED_PRE struct PACKED_POST
 {
-    tANI_U8   bssIdx;
-
-} tHalWowlExitParams, *tpHalWowlExitParams;
-
-typedef PACKED_PRE struct PACKED_POST
-{
-   tHalMsgHeader     header;
-   tHalWowlExitParams exitWowlParams;
+   tHalMsgHeader header;
 }  tHalWowlExitReqMsg, *tpHalWowlExitReqMsg;
 
 /*---------------------------------------------------------------------------
@@ -4002,7 +3668,6 @@
 {
     /* success or failure */
     tANI_U32   status;
-    tANI_U8    bssIdx;
 } tHalEnterBmpsRspParams, *tpHalEnterBmpsRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -4018,7 +3683,6 @@
 {
     /* success or failure */
     tANI_U32   status;
-    tANI_U8    bssIdx;
 } tHalExitBmpsRspParams, *tpHalExitBmpsRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -4034,7 +3698,6 @@
 {
     /* success or failure */
     tANI_U32    status;
-    tANI_U8     bssIdx;
 }tUapsdRspParams, *tpUapsdRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -4050,7 +3713,6 @@
 {
     /* success or failure */
     tANI_U32   status;
-    tANI_U8    bssIdx;
 } tHalExitUapsdRspParams, *tpHalExitUapsdRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -4101,8 +3763,7 @@
 typedef PACKED_PRE struct PACKED_POST
 {
     /* success or failure */
-   tANI_U32   status;
-   tANI_U8    bssIdx;
+    tANI_U32   status;
 } tHalEnterWowlRspParams, *tpHalEnterWowlRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -4117,8 +3778,7 @@
 typedef PACKED_PRE struct PACKED_POST
 {
     /* success or failure */
-   tANI_U32   status;
-   tANI_U8    bssIdx;
+    tANI_U32   status;
 } tHalExitWowlRspParams, *tpHalExitWowlRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -4163,8 +3823,7 @@
 typedef PACKED_PRE struct PACKED_POST
 {
     /* success or failure */
-   tANI_U32   status;
-   tANI_U8    bssIdx;
+    tANI_U32   status;
 } tHalAddWowlBcastPtrnRspParams, *tpHalAddWowlBcastPtrnRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -4179,8 +3838,7 @@
 typedef PACKED_PRE struct PACKED_POST
 {
     /* success or failure */
-   tANI_U32   status;
-   tANI_U8    bssIdx;
+    tANI_U32   status;
 } tHalDelWowlBcastPtrnRspParams, *tpHalDelWowlBcastPtrnRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -4313,7 +3971,6 @@
 {
     /* TX Power in milli watts */
     tANI_U32  txPower;
-    tANI_U8   bssIdx;
 }tSetTxPwrReqParams, *tpSetTxPwrReqParams;
 
 
@@ -5187,39 +4844,28 @@
     tANI_U8                         filterId;
     tANI_U8                         filterType;
     tANI_U8                         numParams; 
-    tANI_U32                        coalesceTime;
+    tANI_U32                        coleasceTime; 
     tHalRcvPktFilterParams          paramsData[1];
 }tHalRcvPktFilterCfgType, *tpHalRcvPktFilterCfgType;
 
 typedef PACKED_PRE struct PACKED_POST
 {
-    tANI_U8                         filterId;
-    tANI_U8                         filterType;
-    tANI_U8                         numParams; 
-    tANI_U32                        coleasceTime; 
-    tANI_U8                         bssIdx;
-    tHalRcvPktFilterParams          paramsData[1];
-}tHalSessionizedRcvPktFilterCfgType, *tpHalSessionizedRcvPktFilterCfgType;
-
-typedef PACKED_PRE struct PACKED_POST
-{
   tHalMsgHeader                 header;
   tHalRcvPktFilterCfgType       pktFilterCfg;
 } tHalSetRcvPktFilterReqMsg, *tpHalSetRcvPktFilterReqMsg;
 
-typedef PACKED_PRE struct PACKED_POST
+
+typedef PACKED_PRE struct PACKED_POST 
 {
     tANI_U8         dataOffset; /* from start of the respective frame header */
     tANI_U32       cMulticastAddr;
     tSirMacAddr    multicastAddr[HAL_MAX_NUM_MULTICAST_ADDRESS];
-    tANI_U8        bssIdx;
 } tHalRcvFltMcAddrListType, *tpHalRcvFltMcAddrListType;
 
 typedef PACKED_PRE struct PACKED_POST
 {
     /* success or failure */
     tANI_U32   status;
-    tANI_U8    bssIdx;
 } tHalSetPktFilterRspParams, *tpHalSetPktFilterRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -5228,18 +4874,12 @@
    tHalSetPktFilterRspParams   pktFilterRspParams;
 }  tHalSetPktFilterRspMsg, *tpHalSetPktFilterRspMsg;
 
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U8    bssIdx;
-} tHalRcvFltPktMatchCntReqParams, *tpHalRcvFltPktMatchCntReqParams;
 
 typedef PACKED_PRE struct PACKED_POST
 {
    tHalMsgHeader        header;
-   tHalRcvFltPktMatchCntReqParams   pktMatchCntReqParams;
 } tHalRcvFltPktMatchCntReqMsg, *tpHalRcvFltPktMatchCntReqMsg;
 
-
 typedef PACKED_PRE struct PACKED_POST
 {
    tANI_U8    filterId;
@@ -5251,7 +4891,6 @@
    tANI_U32                 status;
    tANI_U32                 matchCnt;   
    tHalRcvFltPktMatchCnt    filterMatchCnt[HAL_MAX_NUM_FILTERS]; 
-   tANI_U8                  bssIdx;
 } tHalRcvFltPktMatchRspParams, *tptHalRcvFltPktMatchRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -5264,7 +4903,6 @@
 {
     tANI_U32   status;  /* only valid for response message */
     tANI_U8    filterId;
-    tANI_U8    bssIdx;
 }tHalRcvFltPktClearParam, *tpHalRcvFltPktClearParam;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -5282,7 +4920,6 @@
 typedef PACKED_PRE struct PACKED_POST
 {
     tANI_U32   status;  
-    tANI_U8    bssIdx;
 }tHalRcvFltPktSetMcListRspType, *tpHalRcvFltPktSetMcListRspType;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -5359,37 +4996,28 @@
 typedef enum {
     MCC        = 0,
     P2P        = 1,
-    DOT11AC    = 2,
-    SLM_SESSIONIZATION = 3,
     MAX_FEATURE_SUPPORTED = 128,
 } placeHolderInCapBitmap;
 
-
-#define IS_MCC_SUPPORTED_BY_HOST (!!(halMsg_GetHostWlanFeatCaps(MCC)))
-#define IS_SLM_SESSIONIZATION_SUPPORTED_BY_HOST (!!(halMsg_GetHostWlanFeatCaps(SLM_SESSIONIZATION)))
-
-
-tANI_U8 halMsg_GetHostWlanFeatCaps(tANI_U8 feat_enum_value);
-
 #define setFeatCaps(a,b)   {  tANI_U32 arr_index, bit_index; \
-                              if ((b<=127)) { \
+                              if ((b>=0) && (b<=127)) { \
                                 arr_index = b/32; \
                                 bit_index = b % 32; \
                                 (a)->featCaps[arr_index] |= (1<<bit_index); \
                               } \
                            }
 #define getFeatCaps(a,b,c) {  tANI_U32 arr_index, bit_index; \
-                              if ((b<=127)) { \
+                              if ((b>=0) && (b<=127)) { \
                                 arr_index = b/32; \
                                 bit_index = b % 32; \
                                 c = (a)->featCaps[arr_index] & (1<<bit_index); \
                               } \
                            }
 #define clearFeatCaps(a,b) {  tANI_U32 arr_index, bit_index; \
-                              if ((b<=127)) { \
+                              if ((b>=0) && (b<=127)) { \
                                 arr_index = b/32; \
                                 bit_index = b % 32; \
-                                (a)->featCaps[arr_index] &= ~(1<<bit_index); \
+                                (a)->featCaps[arr_index] |= (0<<bit_index); \
                               } \
                            }
 
@@ -5463,8 +5091,6 @@
 {
     tHalMsgHeader       header;
     tWakeReasonParams   wakeReasonParams;
-    tANI_U32            uBssIdx : 8;
-    tANI_U32            bReserved : 24;
 } tHalWakeReasonInd, *tpHalWakeReasonInd;
 
 /*---------------------------------------------------------------------------
@@ -5482,7 +5108,6 @@
   tANI_U8      aKCK[HAL_GTK_KCK_BYTES];  /* Key confirmation key */ 
   tANI_U8      aKEK[HAL_GTK_KEK_BYTES];  /* key encryption key */
   tANI_U64     ullKeyReplayCounter; /* replay counter */
-  tANI_U8      bssIdx;
 } tHalGtkOffloadReqParams, *tpHalGtkOffloadReqParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -5497,7 +5122,6 @@
 typedef PACKED_PRE struct PACKED_POST
 {
     tANI_U32   ulStatus;   /* success or failure */
-    tANI_U8    bssIdx;
 } tHalGtkOffloadRspParams, *tpHalGtkOffloadRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -5510,16 +5134,10 @@
 /*---------------------------------------------------------------------------
 * WLAN_HAL_GTK_OFFLOAD_GETINFO_REQ
 *--------------------------------------------------------------------------*/
-typedef PACKED_PRE struct PACKED_POST
-{
-   tANI_U8    bssIdx;
-
-} tHalGtkOffloadGetInfoReqParams, *tptHalGtkOffloadGetInfoReqParams;
 
 typedef PACKED_PRE struct PACKED_POST
 {
    tHalMsgHeader header;
-   tHalGtkOffloadGetInfoReqParams gtkOffloadGetInfoReqParams;
 }  tHalGtkOffloadGetInfoReqMsg, *tpHalGtkOffloadGetInfoReqMsg;
 
 /*---------------------------------------------------------------------------
@@ -5533,7 +5151,6 @@
    tANI_U32   ulTotalRekeyCount;    /* total rekey attempts */
    tANI_U32   ulGTKRekeyCount;      /* successful GTK rekeys */
    tANI_U32   ulIGTKRekeyCount;     /* successful iGTK rekeys */
-   tANI_U8    bssIdx;
 } tHalGtkOffloadGetInfoRspParams, *tptHalGtkOffloadGetInfoRspParams;
 
 typedef PACKED_PRE struct PACKED_POST
@@ -5616,4 +5233,3 @@
 #endif
 
 #endif /* _WLAN_HAL_MSG_H_ */
-
diff --git a/drivers/staging/prima/riva/inc/wlan_nv.h b/drivers/staging/prima/riva/inc/wlan_nv.h
index a4d06ea..de4ec17 100644
--- a/drivers/staging/prima/riva/inc/wlan_nv.h
+++ b/drivers/staging/prima/riva/inc/wlan_nv.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -523,92 +523,10 @@
     HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_135_MBPS,
     HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
 
-#ifdef WLAN_FEATURE_11AC
-    /*11A duplicate 80MHz Rates*/
-    HAL_PHY_RATE_11AC_DUP_6_MBPS,
-    HAL_PHY_RATE_11AC_DUP_9_MBPS,
-    HAL_PHY_RATE_11AC_DUP_12_MBPS,
-    HAL_PHY_RATE_11AC_DUP_18_MBPS,
-    HAL_PHY_RATE_11AC_DUP_24_MBPS,
-    HAL_PHY_RATE_11AC_DUP_36_MBPS,
-    HAL_PHY_RATE_11AC_DUP_48_MBPS,
-    HAL_PHY_RATE_11AC_DUP_54_MBPS,
-
-    /*11AC rate 20MHZ Normal GI*/
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_6_5_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_13_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_19_5_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_26_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_39_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_52_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_58_5_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_65_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_NGI_78_MBPS,
-    
-    /*11AC rate 20MHZ Shortl GI*/
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_7_2_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_14_4_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_21_6_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_28_8_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_43_3_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_57_7_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_65_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_72_2_MBPS,
-    HAL_PHY_RATE_VHT_20MHZ_MCS_1NSS_SGI_86_6_MBPS,
-    
-    /*11AC rates 40MHZ normal GI*/
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_13_5_MBPS ,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_27_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_40_5_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_54_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_81_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_108_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_121_5_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_135_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_162_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_NGI_180_MBPS,
-    
-    /*11AC rates 40MHZ short GI*/
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_15_MBPS ,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_30_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_45_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_60_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_90_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_120_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_135_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_150_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_180_MBPS,
-    HAL_PHY_RATE_VHT_40MHZ_MCS_1NSS_CB_SGI_200_MBPS,
-    
-    /*11AC rates 80 MHZ normal GI*/
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_29_3_MBPS ,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_58_5_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_87_8_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_117_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_175_5_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_234_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_263_3_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_292_5_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_351_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_NGI_390_MBPS,
-    
-    /*11AC rates 80 MHZ short GI*/
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_32_5_MBPS ,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_65_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_97_5_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_130_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_195_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_260_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_292_5_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_325_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_390_MBPS,
-    HAL_PHY_RATE_VHT_80MHZ_MCS_1NSS_CB_SGI_433_3_MBPS,
-#endif //WLAN_FEATURE_11AC
-
     NUM_HAL_PHY_RATES,
     HAL_PHY_RATE_INVALID,
     MIN_RATE_INDEX = 0,
-    MAX_RATE_INDEX = NUM_HAL_PHY_RATES - 1,
+    MAX_RATE_INDEX = HAL_PHY_RATE_MCS_1NSS_MM_SG_CB_150_MBPS,
     HAL_PHY_RATE_INVALID_MAX_FIELD = 0x7FFFFFFF  /* define as 4 bytes data */
 }eHalPhyRates;
 
diff --git a/drivers/staging/prima/riva/inc/wlan_phy.h b/drivers/staging/prima/riva/inc/wlan_phy.h
index 47c1d6c..e4ec4db 100644
--- a/drivers/staging/prima/riva/inc/wlan_phy.h
+++ b/drivers/staging/prima/riva/inc/wlan_phy.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/prima/riva/inc/wlan_qct_dev_defs.h b/drivers/staging/prima/riva/inc/wlan_qct_dev_defs.h
index 3527fde..c0e9ddb 100644
--- a/drivers/staging/prima/riva/inc/wlan_qct_dev_defs.h
+++ b/drivers/staging/prima/riva/inc/wlan_qct_dev_defs.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -37,45 +37,14 @@
  * --------------------------------------------------------------------
  */
 
-#ifdef WCN_PRONTO
-#ifdef WCN_PRONTO_V1
-
-/* In Pronto 1.0 TPE descriptor size is increased to 1K per station
- * but not the cMEM allocated for hardware descriptors. Due to this
- * memory limitation the number of stations are limited to 9 and BSS
- * to 2 respectively. 
- *
- * In Pronto 2.0, TPE descriptor size is reverted
- * back to 512 bytes and hence more stations and BSSs can be supported
- * from Pronto 2.0
- *
- * In Pronto 1.0, 9 HW stations are supported including BCAST STA(staId 0)
- * and SELF STA(staId 1). So total ASSOC stations which can connect to
- * Pronto 1.0 Softap = 9 - 1(self sta) - 1(Bcast sta) = 7 stations
- */
-#define HAL_NUM_STA                 9
-#define HAL_NUM_BSSID               2
-#define HAL_NUM_UMA_DESC_ENTRIES    9
-
-#else /* WCN_PRONTO_V1 */
-
-#define HAL_NUM_STA                 14
-#define HAL_NUM_BSSID               4
-#define HAL_NUM_UMA_DESC_ENTRIES    14
-
-#endif /* WCN_PRONTO_V1 */
-#else  /* WCN_PRONTO */
-
 /*In prima 12 HW stations are supported including BCAST STA(staId 0)
  and SELF STA(staId 1) so total ASSOC stations which can connect to Prima
  SoftAP = 12 - 1(Self STa) - 1(Bcast Sta) = 10 Stations. */
+
 #define HAL_NUM_STA                 12
 #define HAL_NUM_BSSID               2
 #define HAL_NUM_UMA_DESC_ENTRIES    12
 
-#endif /* WCN_PRONTO */
-
-
 #define HAL_INVALID_BSSIDX          HAL_NUM_BSSID
 
 #define MAX_NUM_OF_BACKOFFS         8
@@ -152,21 +121,11 @@
     /* Special WQ for BMU to dropping all frames coming to this WQ ID */
     BMUWQ_SINK = 255,
 
-#ifdef WCN_PRONTO
-    BMUWQ_BMU_CMEM_IDLE_BD = 27,
-    /* Total BMU WQ count in Pronto */
-    BMUWQ_NUM = 28,
-    
-    //WQs 17 through 22 are enabled in Pronto. So, set not supported mask to 0.
-    BMUWQ_NOT_SUPPORTED_MASK = 0x0,
-#else
-    /* Total BMU WQ count in Prima */
+    /* Total BMU WQ count in Volans */
     BMUWQ_NUM = 27,
 
-    //Prima has excluded support for WQs 17 through 22.
+    //Volans has excluded support for WQs 17 through 22.
     BMUWQ_NOT_SUPPORTED_MASK = 0x7e0000,
-#endif //WCN_PRONTO
-
 
     /* Aliases */
     BMUWQ_BTQM_TX_MGMT = BMUWQ_BTQM,
diff --git a/drivers/staging/prima/riva/inc/wlan_status_code.h b/drivers/staging/prima/riva/inc/wlan_status_code.h
index eae1bc6..4a332c0 100644
--- a/drivers/staging/prima/riva/inc/wlan_status_code.h
+++ b/drivers/staging/prima/riva/inc/wlan_status_code.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
index e419b4f..2c80745 100644
--- a/drivers/staging/rtl8712/usb_intf.c
+++ b/drivers/staging/rtl8712/usb_intf.c
@@ -102,6 +102,8 @@
 	/* - */
 	{USB_DEVICE(0x20F4, 0x646B)},
 	{USB_DEVICE(0x083A, 0xC512)},
+	{USB_DEVICE(0x25D4, 0x4CA1)},
+	{USB_DEVICE(0x25D4, 0x4CAB)},
 
 /* RTL8191SU */
 	/* Realtek */
diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
index 917461c..175b3c9 100644
--- a/drivers/staging/zsmalloc/zsmalloc-main.c
+++ b/drivers/staging/zsmalloc/zsmalloc-main.c
@@ -426,12 +426,6 @@
 }
 
 
-/*
- * If this becomes a separate module, register zs_init() with
- * module_init(), zs_exit with module_exit(), and remove zs_initialized
-*/
-static int zs_initialized;
-
 static int zs_cpu_notifier(struct notifier_block *nb, unsigned long action,
 				void *pcpu)
 {
@@ -490,7 +484,7 @@
 
 struct zs_pool *zs_create_pool(const char *name, gfp_t flags)
 {
-	int i, error, ovhd_size;
+	int i, ovhd_size;
 	struct zs_pool *pool;
 
 	if (!name)
@@ -517,28 +511,9 @@
 
 	}
 
-	/*
-	 * If this becomes a separate module, register zs_init with
-	 * module_init, and remove this block
-	*/
-	if (!zs_initialized) {
-		error = zs_init();
-		if (error)
-			goto cleanup;
-		zs_initialized = 1;
-	}
-
 	pool->flags = flags;
 	pool->name = name;
 
-	error = 0; /* Success */
-
-cleanup:
-	if (error) {
-		zs_destroy_pool(pool);
-		pool = NULL;
-	}
-
 	return pool;
 }
 EXPORT_SYMBOL_GPL(zs_create_pool);
@@ -749,3 +724,9 @@
 	return npages << PAGE_SHIFT;
 }
 EXPORT_SYMBOL_GPL(zs_get_total_size_bytes);
+
+module_init(zs_init);
+module_exit(zs_exit);
+
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_AUTHOR("Nitin Gupta <ngupta@vflare.org>");
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index e569132..5018132 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -427,19 +427,8 @@
 
 int iscsit_del_np_comm(struct iscsi_np *np)
 {
-	if (!np->np_socket)
-		return 0;
-
-	/*
-	 * Some network transports allocate their own struct sock->file,
-	 * see  if we need to free any additional allocated resources.
-	 */
-	if (np->np_flags & NPF_SCTP_STRUCT_FILE) {
-		kfree(np->np_socket->file);
-		np->np_socket->file = NULL;
-	}
-
-	sock_release(np->np_socket);
+	if (np->np_socket)
+		sock_release(np->np_socket);
 	return 0;
 }
 
@@ -4089,13 +4078,8 @@
 	kfree(conn->conn_ops);
 	conn->conn_ops = NULL;
 
-	if (conn->sock) {
-		if (conn->conn_flags & CONNFLAG_SCTP_STRUCT_FILE) {
-			kfree(conn->sock->file);
-			conn->sock->file = NULL;
-		}
+	if (conn->sock)
 		sock_release(conn->sock);
-	}
 	conn->thread_set = NULL;
 
 	pr_debug("Moving to TARG_CONN_STATE_FREE.\n");
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h
index 2aaee7e..d1c4bc2 100644
--- a/drivers/target/iscsi/iscsi_target_core.h
+++ b/drivers/target/iscsi/iscsi_target_core.h
@@ -224,7 +224,6 @@
 /* Used for struct iscsi_np->np_flags */
 enum np_flags_table {
 	NPF_IP_NETWORK		= 0x00,
-	NPF_SCTP_STRUCT_FILE	= 0x01 /* Bugfix */
 };
 
 /* Used for struct iscsi_np->np_thread_state */
@@ -511,7 +510,6 @@
 	u16			local_port;
 	int			net_size;
 	u32			auth_id;
-#define CONNFLAG_SCTP_STRUCT_FILE			0x01
 	u32			conn_flags;
 	/* Used for iscsi_tx_login_rsp() */
 	u32			login_itt;
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
index a3656c9..ae30424 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -795,22 +795,6 @@
 	}
 	np->np_socket = sock;
 	/*
-	 * The SCTP stack needs struct socket->file.
-	 */
-	if ((np->np_network_transport == ISCSI_SCTP_TCP) ||
-	    (np->np_network_transport == ISCSI_SCTP_UDP)) {
-		if (!sock->file) {
-			sock->file = kzalloc(sizeof(struct file), GFP_KERNEL);
-			if (!sock->file) {
-				pr_err("Unable to allocate struct"
-						" file for SCTP\n");
-				ret = -ENOMEM;
-				goto fail;
-			}
-			np->np_flags |= NPF_SCTP_STRUCT_FILE;
-		}
-	}
-	/*
 	 * Setup the np->np_sockaddr from the passed sockaddr setup
 	 * in iscsi_target_configfs.c code..
 	 */
@@ -869,21 +853,15 @@
 
 fail:
 	np->np_socket = NULL;
-	if (sock) {
-		if (np->np_flags & NPF_SCTP_STRUCT_FILE) {
-			kfree(sock->file);
-			sock->file = NULL;
-		}
-
+	if (sock)
 		sock_release(sock);
-	}
 	return ret;
 }
 
 static int __iscsi_target_login_thread(struct iscsi_np *np)
 {
 	u8 buffer[ISCSI_HDR_LEN], iscsi_opcode, zero_tsih = 0;
-	int err, ret = 0, set_sctp_conn_flag, stop;
+	int err, ret = 0, stop;
 	struct iscsi_conn *conn = NULL;
 	struct iscsi_login *login;
 	struct iscsi_portal_group *tpg = NULL;
@@ -894,7 +872,6 @@
 	struct sockaddr_in6 sock_in6;
 
 	flush_signals(current);
-	set_sctp_conn_flag = 0;
 	sock = np->np_socket;
 
 	spin_lock_bh(&np->np_thread_lock);
@@ -917,35 +894,12 @@
 		spin_unlock_bh(&np->np_thread_lock);
 		goto out;
 	}
-	/*
-	 * The SCTP stack needs struct socket->file.
-	 */
-	if ((np->np_network_transport == ISCSI_SCTP_TCP) ||
-	    (np->np_network_transport == ISCSI_SCTP_UDP)) {
-		if (!new_sock->file) {
-			new_sock->file = kzalloc(
-					sizeof(struct file), GFP_KERNEL);
-			if (!new_sock->file) {
-				pr_err("Unable to allocate struct"
-						" file for SCTP\n");
-				sock_release(new_sock);
-				/* Get another socket */
-				return 1;
-			}
-			set_sctp_conn_flag = 1;
-		}
-	}
-
 	iscsi_start_login_thread_timer(np);
 
 	conn = kzalloc(sizeof(struct iscsi_conn), GFP_KERNEL);
 	if (!conn) {
 		pr_err("Could not allocate memory for"
 			" new connection\n");
-		if (set_sctp_conn_flag) {
-			kfree(new_sock->file);
-			new_sock->file = NULL;
-		}
 		sock_release(new_sock);
 		/* Get another socket */
 		return 1;
@@ -955,9 +909,6 @@
 	conn->conn_state = TARG_CONN_STATE_FREE;
 	conn->sock = new_sock;
 
-	if (set_sctp_conn_flag)
-		conn->conn_flags |= CONNFLAG_SCTP_STRUCT_FILE;
-
 	pr_debug("Moving to TARG_CONN_STATE_XPT_UP.\n");
 	conn->conn_state = TARG_CONN_STATE_XPT_UP;
 
@@ -1205,13 +1156,8 @@
 		iscsi_release_param_list(conn->param_list);
 		conn->param_list = NULL;
 	}
-	if (conn->sock) {
-		if (conn->conn_flags & CONNFLAG_SCTP_STRUCT_FILE) {
-			kfree(conn->sock->file);
-			conn->sock->file = NULL;
-		}
+	if (conn->sock)
 		sock_release(conn->sock);
-	}
 	kfree(conn);
 
 	if (tpg) {
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index c7746a3..f30e124 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -351,9 +351,11 @@
 
 out:
 	transport_kunmap_data_sg(cmd);
-	task->task_scsi_status = GOOD;
-	transport_complete_task(task, 1);
-	return 0;
+	if (!rc) {
+		task->task_scsi_status = GOOD;
+		transport_complete_task(task, 1);
+	}
+	return rc;
 }
 
 static inline int core_alua_state_nonoptimized(
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c
index 30a6770..52a5f62 100644
--- a/drivers/target/target_core_cdb.c
+++ b/drivers/target/target_core_cdb.c
@@ -1022,11 +1022,11 @@
 	struct se_cmd *cmd = task->task_se_cmd;
 	struct se_device *dev = cmd->se_dev;
 	unsigned char *buf, *ptr = NULL;
-	unsigned char *cdb = &cmd->t_task_cdb[0];
 	sector_t lba;
-	unsigned int size = cmd->data_length, range;
-	int ret = 0, offset;
-	unsigned short dl, bd_dl;
+	int size = cmd->data_length;
+	u32 range;
+	int ret = 0;
+	int dl, bd_dl;
 
 	if (!dev->transport->do_discard) {
 		pr_err("UNMAP emulation not supported for: %s\n",
@@ -1035,24 +1035,41 @@
 		return -ENOSYS;
 	}
 
-	/* First UNMAP block descriptor starts at 8 byte offset */
-	offset = 8;
-	size -= 8;
-	dl = get_unaligned_be16(&cdb[0]);
-	bd_dl = get_unaligned_be16(&cdb[2]);
-
 	buf = transport_kmap_data_sg(cmd);
 
-	ptr = &buf[offset];
-	pr_debug("UNMAP: Sub: %s Using dl: %hu bd_dl: %hu size: %hu"
+	dl = get_unaligned_be16(&buf[0]);
+	bd_dl = get_unaligned_be16(&buf[2]);
+
+	size = min(size - 8, bd_dl);
+	if (size / 16 > dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) {
+		cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST;
+		ret = -EINVAL;
+		goto err;
+	}
+
+	/* First UNMAP block descriptor starts at 8 byte offset */
+	ptr = &buf[8];
+	pr_debug("UNMAP: Sub: %s Using dl: %u bd_dl: %u size: %u"
 		" ptr: %p\n", dev->transport->name, dl, bd_dl, size, ptr);
 
-	while (size) {
+	while (size >= 16) {
 		lba = get_unaligned_be64(&ptr[0]);
 		range = get_unaligned_be32(&ptr[8]);
 		pr_debug("UNMAP: Using lba: %llu and range: %u\n",
 				 (unsigned long long)lba, range);
 
+		if (range > dev->se_sub_dev->se_dev_attrib.max_unmap_lba_count) {
+			cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST;
+			ret = -EINVAL;
+			goto err;
+		}
+
+		if (lba + range > dev->transport->get_blocks(dev) + 1) {
+			cmd->scsi_sense_reason = TCM_ADDRESS_OUT_OF_RANGE;
+			ret = -EINVAL;
+			goto err;
+		}
+
 		ret = dev->transport->do_discard(dev, lba, range);
 		if (ret < 0) {
 			pr_err("blkdev_issue_discard() failed: %d\n",
@@ -1107,7 +1124,7 @@
 	if (num_blocks != 0)
 		range = num_blocks;
 	else
-		range = (dev->transport->get_blocks(dev) - lba);
+		range = (dev->transport->get_blocks(dev) - lba) + 1;
 
 	pr_debug("WRITE_SAME UNMAP: LBA: %llu Range: %llu\n",
 		 (unsigned long long)lba, (unsigned long long)range);
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index c3148b1..89d10e6 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -2038,7 +2038,7 @@
 	if (IS_ERR(file) || !file || !file->f_dentry) {
 		pr_err("filp_open(%s) for APTPL metadata"
 			" failed\n", path);
-		return (PTR_ERR(file) < 0 ? PTR_ERR(file) : -ENOENT);
+		return IS_ERR(file) ? PTR_ERR(file) : -ENOENT;
 	}
 
 	iov[0].iov_base = &buf[0];
@@ -3826,7 +3826,7 @@
 			" SPC-2 reservation is held, returning"
 			" RESERVATION_CONFLICT\n");
 		cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT;
-		ret = EINVAL;
+		ret = -EINVAL;
 		goto out;
 	}
 
@@ -3836,7 +3836,8 @@
 	 */
 	if (!cmd->se_sess) {
 		cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
-		return -EINVAL;
+		ret = -EINVAL;
+		goto out;
 	}
 
 	if (cmd->data_length < 24) {
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 843ad54..c24f54c 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1978,6 +1978,7 @@
 	case TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE:
 	case TCM_UNKNOWN_MODE_PAGE:
 	case TCM_WRITE_PROTECTED:
+	case TCM_ADDRESS_OUT_OF_RANGE:
 	case TCM_CHECK_CONDITION_ABORT_CMD:
 	case TCM_CHECK_CONDITION_UNIT_ATTENTION:
 	case TCM_CHECK_CONDITION_NOT_READY:
@@ -4661,6 +4662,15 @@
 		/* WRITE PROTECTED */
 		buffer[offset+SPC_ASC_KEY_OFFSET] = 0x27;
 		break;
+	case TCM_ADDRESS_OUT_OF_RANGE:
+		/* CURRENT ERROR */
+		buffer[offset] = 0x70;
+		buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
+		/* ILLEGAL REQUEST */
+		buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
+		/* LOGICAL BLOCK ADDRESS OUT OF RANGE */
+		buffer[offset+SPC_ASC_KEY_OFFSET] = 0x21;
+		break;
 	case TCM_CHECK_CONDITION_UNIT_ATTENTION:
 		/* CURRENT ERROR */
 		buffer[offset] = 0x70;
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c
index a375f25..da90f64 100644
--- a/drivers/target/tcm_fc/tfc_cmd.c
+++ b/drivers/target/tcm_fc/tfc_cmd.c
@@ -240,6 +240,8 @@
 {
 	struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd);
 
+	if (cmd->aborted)
+		return ~0;
 	return fc_seq_exch(cmd->seq)->rxid;
 }
 
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
index cb99da9..87901fa 100644
--- a/drivers/target/tcm_fc/tfc_sess.c
+++ b/drivers/target/tcm_fc/tfc_sess.c
@@ -58,7 +58,8 @@
 	struct ft_tport *tport;
 	int i;
 
-	tport = rcu_dereference(lport->prov[FC_TYPE_FCP]);
+	tport = rcu_dereference_protected(lport->prov[FC_TYPE_FCP],
+					  lockdep_is_held(&ft_lport_lock));
 	if (tport && tport->tpg)
 		return tport;
 
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index 83d5c88..944eaeb 100644
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -214,24 +214,24 @@
 	/* already configured */
 	if (info->intf != NULL)
 		return 0;
-
+	/*
+	 * If the toolstack (or the hypervisor) hasn't set these values, the
+	 * default value is 0. Even though mfn = 0 and evtchn = 0 are
+	 * theoretically correct values, in practice they never are and they
+	 * mean that a legacy toolstack hasn't initialized the pv console correctly.
+	 */
 	r = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v);
-	if (r < 0) {
-		kfree(info);
-		return -ENODEV;
-	}
+	if (r < 0 || v == 0)
+		goto err;
 	info->evtchn = v;
-	hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v);
-	if (r < 0) {
-		kfree(info);
-		return -ENODEV;
-	}
+	v = 0;
+	r = hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v);
+	if (r < 0 || v == 0)
+		goto err;
 	mfn = v;
 	info->intf = ioremap(mfn << PAGE_SHIFT, PAGE_SIZE);
-	if (info->intf == NULL) {
-		kfree(info);
-		return -ENODEV;
-	}
+	if (info->intf == NULL)
+		goto err;
 	info->vtermno = HVC_COOKIE;
 
 	spin_lock(&xencons_lock);
@@ -239,6 +239,9 @@
 	spin_unlock(&xencons_lock);
 
 	return 0;
+err:
+	kfree(info);
+	return -ENODEV;
 }
 
 static int xen_pv_console_init(void)
@@ -430,9 +433,9 @@
 	if (devid == 0)
 		return -ENODEV;
 
-	info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL | __GFP_ZERO);
+	info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL);
 	if (!info)
-		goto error_nomem;
+		return -ENOMEM;
 	dev_set_drvdata(&dev->dev, info);
 	info->xbdev = dev;
 	info->vtermno = xenbus_devid_to_vtermno(devid);
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index 5c27f7e..d537431 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -2280,10 +2280,11 @@
 		quot++;
 
 	if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) {
-		if (baud < 2400)
-			fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_1;
-		else
-			fcr = uart_config[port->type].fcr;
+		fcr = uart_config[port->type].fcr;
+		if (baud < 2400) {
+			fcr &= ~UART_FCR_TRIGGER_MASK;
+			fcr |= UART_FCR_TRIGGER_1;
+		}
 	}
 
 	/*
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 858dca8..3614973 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1609,54 +1609,72 @@
 	{
 		.vendor         = PCI_VENDOR_ID_INTEL,
 		.device         = 0x8811,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
 		.init		= pci_eg20t_init,
 		.setup		= pci_default_setup,
 	},
 	{
 		.vendor         = PCI_VENDOR_ID_INTEL,
 		.device         = 0x8812,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
 		.init		= pci_eg20t_init,
 		.setup		= pci_default_setup,
 	},
 	{
 		.vendor         = PCI_VENDOR_ID_INTEL,
 		.device         = 0x8813,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
 		.init		= pci_eg20t_init,
 		.setup		= pci_default_setup,
 	},
 	{
 		.vendor         = PCI_VENDOR_ID_INTEL,
 		.device         = 0x8814,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
 		.init		= pci_eg20t_init,
 		.setup		= pci_default_setup,
 	},
 	{
 		.vendor         = 0x10DB,
 		.device         = 0x8027,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
 		.init		= pci_eg20t_init,
 		.setup		= pci_default_setup,
 	},
 	{
 		.vendor         = 0x10DB,
 		.device         = 0x8028,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
 		.init		= pci_eg20t_init,
 		.setup		= pci_default_setup,
 	},
 	{
 		.vendor         = 0x10DB,
 		.device         = 0x8029,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
 		.init		= pci_eg20t_init,
 		.setup		= pci_default_setup,
 	},
 	{
 		.vendor         = 0x10DB,
 		.device         = 0x800C,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
 		.init		= pci_eg20t_init,
 		.setup		= pci_default_setup,
 	},
 	{
 		.vendor         = 0x10DB,
 		.device         = 0x800D,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
 		.init		= pci_eg20t_init,
 		.setup		= pci_default_setup,
 	},
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 55fd362..039c054 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -369,6 +369,8 @@
 
 	writel(ctrl, u->membase + AUART_LINECTRL);
 	writel(ctrl2, u->membase + AUART_CTRL2);
+
+	uart_update_timeout(u, termios->c_cflag, baud);
 }
 
 static irqreturn_t mxs_auart_irq_handle(int irq, void *context)
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index 654755a..333c8d0 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -1348,10 +1348,16 @@
 static int pmz_poll_get_char(struct uart_port *port)
 {
 	struct uart_pmac_port *uap = (struct uart_pmac_port *)port;
+	int tries = 2;
 
-	while ((read_zsreg(uap, R0) & Rx_CH_AV) == 0)
-		udelay(5);
-	return read_zsdata(uap);
+	while (tries) {
+		if ((read_zsreg(uap, R0) & Rx_CH_AV) != 0)
+			return read_zsdata(uap);
+		if (tries--)
+			udelay(5);
+	}
+
+	return NO_POLL_CHAR;
 }
 
 static void pmz_poll_put_char(struct uart_port *port, unsigned char c)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 9ca64ac..450c891 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2289,6 +2289,7 @@
 	tty_unregister_driver(p);
 	put_tty_driver(p);
 	kfree(drv->state);
+	drv->state = NULL;
 	drv->tty_driver = NULL;
 }
 
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index b32ccb4..640cf79 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -567,6 +567,14 @@
 
 	usb_autopm_put_interface(acm->control);
 
+	/*
+	 * Unthrottle device in case the TTY was closed while throttled.
+	 */
+	spin_lock_irq(&acm->read_lock);
+	acm->throttled = 0;
+	acm->throttle_req = 0;
+	spin_unlock_irq(&acm->read_lock);
+
 	if (acm_submit_read_urbs(acm, GFP_KERNEL))
 		goto error_submit_read_urbs;
 
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 0bb2b32..01d247e 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -55,6 +55,15 @@
 		.bInterfaceSubClass = 1,
 		.bInterfaceProtocol = 9, /* NOTE: CDC ECM control interface! */
 	},
+	{
+		 /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */
+		.match_flags        = USB_DEVICE_ID_MATCH_VENDOR |
+				      USB_DEVICE_ID_MATCH_INT_INFO,
+		.idVendor           = HUAWEI_VENDOR_ID,
+		.bInterfaceClass    = USB_CLASS_VENDOR_SPEC,
+		.bInterfaceSubClass = 1,
+		.bInterfaceProtocol = 57, /* NOTE: CDC ECM control interface! */
+	},
 	{ }
 };
 
@@ -309,9 +318,6 @@
 
 static void cleanup(struct wdm_device *desc)
 {
-	spin_lock(&wdm_device_list_lock);
-	list_del(&desc->device_list);
-	spin_unlock(&wdm_device_list_lock);
 	kfree(desc->sbuf);
 	kfree(desc->inbuf);
 	kfree(desc->orq);
@@ -491,6 +497,8 @@
 			goto retry;
 		}
 		if (!desc->reslength) { /* zero length read */
+			dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__);
+			clear_bit(WDM_READ, &desc->flags);
 			spin_unlock_irq(&desc->iuspin);
 			goto retry;
 		}
@@ -530,11 +538,13 @@
 	struct wdm_device *desc = file->private_data;
 
 	wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags));
-	if (desc->werr < 0)
+
+	/* cannot dereference desc->intf if WDM_DISCONNECTING */
+	if (desc->werr < 0 && !test_bit(WDM_DISCONNECTING, &desc->flags))
 		dev_err(&desc->intf->dev, "Error in flush path: %d\n",
 			desc->werr);
 
-	return desc->werr;
+	return usb_translate_errors(desc->werr);
 }
 
 static unsigned int wdm_poll(struct file *file, struct poll_table_struct *wait)
@@ -545,7 +555,7 @@
 
 	spin_lock_irqsave(&desc->iuspin, flags);
 	if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
-		mask = POLLERR;
+		mask = POLLHUP | POLLERR;
 		spin_unlock_irqrestore(&desc->iuspin, flags);
 		goto desc_out;
 	}
@@ -621,10 +631,15 @@
 	mutex_unlock(&desc->wlock);
 
 	if (!desc->count) {
-		dev_dbg(&desc->intf->dev, "wdm_release: cleanup");
-		kill_urbs(desc);
-		if (!test_bit(WDM_DISCONNECTING, &desc->flags))
+		if (!test_bit(WDM_DISCONNECTING, &desc->flags)) {
+			dev_dbg(&desc->intf->dev, "wdm_release: cleanup");
+			kill_urbs(desc);
 			desc->manage_power(desc->intf, 0);
+		} else {
+			/* must avoid dev_printk here as desc->intf is invalid */
+			pr_debug(KBUILD_MODNAME " %s: device gone - cleaning up\n", __func__);
+			cleanup(desc);
+		}
 	}
 	mutex_unlock(&wdm_mutex);
 	return 0;
@@ -771,6 +786,9 @@
 out:
 	return rv;
 err:
+	spin_lock(&wdm_device_list_lock);
+	list_del(&desc->device_list);
+	spin_unlock(&wdm_device_list_lock);
 	cleanup(desc);
 	return rv;
 }
@@ -896,6 +914,12 @@
 	cancel_work_sync(&desc->rxwork);
 	mutex_unlock(&desc->wlock);
 	mutex_unlock(&desc->rlock);
+
+	/* the desc->intf pointer used as list key is now invalid */
+	spin_lock(&wdm_device_list_lock);
+	list_del(&desc->device_list);
+	spin_unlock(&wdm_device_list_lock);
+
 	if (!desc->count)
 		cleanup(desc);
 	mutex_unlock(&wdm_mutex);
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 8df4b76..404413b 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -333,17 +333,14 @@
 static struct async *async_getpending(struct dev_state *ps,
 					     void __user *userurb)
 {
-	unsigned long flags;
 	struct async *as;
 
-	spin_lock_irqsave(&ps->lock, flags);
 	list_for_each_entry(as, &ps->async_pending, asynclist)
 		if (as->userurb == userurb) {
 			list_del_init(&as->asynclist);
-			spin_unlock_irqrestore(&ps->lock, flags);
 			return as;
 		}
-	spin_unlock_irqrestore(&ps->lock, flags);
+
 	return NULL;
 }
 
@@ -398,6 +395,7 @@
 __releases(ps->lock)
 __acquires(ps->lock)
 {
+	struct urb *urb;
 	struct async *as;
 
 	/* Mark all the pending URBs that match bulk_addr, up to but not
@@ -420,8 +418,11 @@
 	list_for_each_entry(as, &ps->async_pending, asynclist) {
 		if (as->bulk_status == AS_UNLINK) {
 			as->bulk_status = 0;		/* Only once */
+			urb = as->urb;
+			usb_get_urb(urb);
 			spin_unlock(&ps->lock);		/* Allow completions */
-			usb_unlink_urb(as->urb);
+			usb_unlink_urb(urb);
+			usb_put_urb(urb);
 			spin_lock(&ps->lock);
 			goto rescan;
 		}
@@ -472,6 +473,7 @@
 
 static void destroy_async(struct dev_state *ps, struct list_head *list)
 {
+	struct urb *urb;
 	struct async *as;
 	unsigned long flags;
 
@@ -479,10 +481,13 @@
 	while (!list_empty(list)) {
 		as = list_entry(list->next, struct async, asynclist);
 		list_del_init(&as->asynclist);
+		urb = as->urb;
+		usb_get_urb(urb);
 
 		/* drop the spinlock so the completion handler can run */
 		spin_unlock_irqrestore(&ps->lock, flags);
-		usb_kill_urb(as->urb);
+		usb_kill_urb(urb);
+		usb_put_urb(urb);
 		spin_lock_irqsave(&ps->lock, flags);
 	}
 	spin_unlock_irqrestore(&ps->lock, flags);
@@ -1410,12 +1415,24 @@
 
 static int proc_unlinkurb(struct dev_state *ps, void __user *arg)
 {
+	struct urb *urb;
 	struct async *as;
+	unsigned long flags;
 
+	spin_lock_irqsave(&ps->lock, flags);
 	as = async_getpending(ps, arg);
-	if (!as)
+	if (!as) {
+		spin_unlock_irqrestore(&ps->lock, flags);
 		return -EINVAL;
-	usb_kill_urb(as->urb);
+	}
+
+	urb = as->urb;
+	usb_get_urb(urb);
+	spin_unlock_irqrestore(&ps->lock, flags);
+
+	usb_kill_urb(urb);
+	usb_put_urb(urb);
+
 	return 0;
 }
 
@@ -1598,10 +1615,14 @@
 	void __user *addr = as->userurb;
 	unsigned int i;
 
-	if (as->userbuffer && urb->actual_length)
-		if (copy_to_user(as->userbuffer, urb->transfer_buffer,
-				 urb->actual_length))
+	if (as->userbuffer && urb->actual_length) {
+		if (urb->number_of_packets > 0)		/* Isochronous */
+			i = urb->transfer_buffer_length;
+		else					/* Non-Isoc */
+			i = urb->actual_length;
+		if (copy_to_user(as->userbuffer, urb->transfer_buffer, i))
 			return -EFAULT;
+	}
 	if (put_user(as->status, &userurb->status))
 		return -EFAULT;
 	if (put_user(urb->actual_length, &userurb->actual_length))
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 2382640..60f10ef 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1280,6 +1280,42 @@
 }
 
 #ifdef CONFIG_USB_OTG
+#define DO_UNBIND	0
+#define DO_REBIND	1
+
+/* Unbind drivers for @udev's interfaces that don't support suspend/resume,
+ * or rebind interfaces that have been unbound, according to @action.
+ *
+ * The caller must hold @udev's device lock.
+ */
+static void do_unbind_rebind(struct usb_device *udev, int action)
+{
+	struct usb_host_config	*config;
+	int			i;
+	struct usb_interface	*intf;
+	struct usb_driver	*drv;
+
+	config = udev->actconfig;
+	if (config) {
+		for (i = 0; i < config->desc.bNumInterfaces; ++i) {
+			intf = config->interface[i];
+			switch (action) {
+			case DO_UNBIND:
+				if (intf->dev.driver) {
+					drv = to_usb_driver(intf->dev.driver);
+					if (!drv->suspend || !drv->resume)
+						usb_forced_unbind_intf(intf);
+				}
+				break;
+			case DO_REBIND:
+				if (intf->needs_binding)
+					usb_rebind_intf(intf);
+				break;
+			}
+		}
+	}
+}
+
 void usb_hnp_polling_work(struct work_struct *work)
 {
 	int ret;
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 57ed9e4..622b4a4 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -493,15 +493,6 @@
 
 	pci_save_state(pci_dev);
 
-	/*
-	 * Some systems crash if an EHCI controller is in D3 during
-	 * a sleep transition.  We have to leave such controllers in D0.
-	 */
-	if (hcd->broken_pci_sleep) {
-		dev_dbg(dev, "Staying in PCI D0\n");
-		return retval;
-	}
-
 	/* If the root hub is dead rather than suspended, disallow remote
 	 * wakeup.  usb_hc_died() should ensure that both hosts are marked as
 	 * dying, so we only need to check the primary roothub.
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index d97d548..8e2232d 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -25,6 +25,7 @@
 #include <linux/mutex.h>
 #include <linux/freezer.h>
 #include <linux/usb/otg.h>
+#include <linux/random.h>
 
 #include <asm/uaccess.h>
 #include <asm/byteorder.h>
@@ -2038,6 +2039,14 @@
 	/* Tell the world! */
 	announce_device(udev);
 
+	if (udev->serial)
+		add_device_randomness(udev->serial, strlen(udev->serial));
+	if (udev->product)
+		add_device_randomness(udev->product, strlen(udev->product));
+	if (udev->manufacturer)
+		add_device_randomness(udev->manufacturer,
+				      strlen(udev->manufacturer));
+
 	device_enable_async_suspend(&udev->dev);
 
 	/*
@@ -2189,12 +2198,16 @@
 static int hub_port_reset(struct usb_hub *hub, int port1,
 			struct usb_device *udev, unsigned int delay, bool warm);
 
-/* Is a USB 3.0 port in the Inactive state? */
-static bool hub_port_inactive(struct usb_hub *hub, u16 portstatus)
+/* Is a USB 3.0 port in the Inactive or Complinance Mode state?
+ * Port worm reset is required to recover
+ */
+static bool hub_port_warm_reset_required(struct usb_hub *hub, u16 portstatus)
 {
 	return hub_is_superspeed(hub->hdev) &&
-		(portstatus & USB_PORT_STAT_LINK_STATE) ==
-		USB_SS_PORT_LS_SS_INACTIVE;
+		(((portstatus & USB_PORT_STAT_LINK_STATE) ==
+		  USB_SS_PORT_LS_SS_INACTIVE) ||
+		 ((portstatus & USB_PORT_STAT_LINK_STATE) ==
+		  USB_SS_PORT_LS_COMP_MOD)) ;
 }
 
 static int hub_port_wait_reset(struct usb_hub *hub, int port1,
@@ -2230,7 +2243,7 @@
 			 *
 			 * See https://bugzilla.kernel.org/show_bug.cgi?id=41752
 			 */
-			if (hub_port_inactive(hub, portstatus)) {
+			if (hub_port_warm_reset_required(hub, portstatus)) {
 				int ret;
 
 				if ((portchange & USB_PORT_STAT_C_CONNECTION))
@@ -2602,6 +2615,10 @@
 				NULL, 0,
 				USB_CTRL_SET_TIMEOUT);
 
+		/* Try to enable USB2 hardware LPM again */
+		if (udev->usb2_hw_lpm_capable == 1)
+			usb_set_usb2_hardware_lpm(udev, 1);
+
 		/* System sleep transitions should never fail */
 		if (!PMSG_IS_AUTO(msg))
 			status = 0;
@@ -4071,9 +4088,7 @@
 			/* Warm reset a USB3 protocol port if it's in
 			 * SS.Inactive state.
 			 */
-			if (hub_is_superspeed(hub->hdev) &&
-				(portstatus & USB_PORT_STAT_LINK_STATE)
-					== USB_SS_PORT_LS_SS_INACTIVE) {
+			if (hub_port_warm_reset_required(hub, portstatus)) {
 				dev_dbg(hub_dev, "warm reset port %d\n", i);
 				hub_port_reset(hub, i, NULL,
 						HUB_BH_RESET_TIME, true);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 3aa16b1..2c9fc03 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1807,7 +1807,6 @@
 		intfc = cp->intf_cache[i];
 		intf->altsetting = intfc->altsetting;
 		intf->num_altsetting = intfc->num_altsetting;
-		intf->intf_assoc = find_iad(dev, cp, i);
 		kref_get(&intfc->ref);
 
 		alt = usb_altnum_to_altsetting(intf, 0);
@@ -1820,6 +1819,8 @@
 		if (!alt)
 			alt = &intf->altsetting[0];
 
+		intf->intf_assoc =
+			find_iad(dev, cp, alt->desc.bInterfaceNumber);
 		intf->cur_altsetting = alt;
 		usb_enable_interface(dev, intf, true);
 		intf->dev.parent = &dev->dev;
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 200dc9b..1df3f06 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -123,6 +123,9 @@
 	/* Guillemot Webcam Hercules Dualpix Exchange*/
 	{ USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME },
 
+	/* Midiman M-Audio Keystation 88es */
+	{ USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME },
+
 	/* M-Systems Flash Disk Pioneers */
 	{ USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
 
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index cd9b3a2..9d912bf 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -681,6 +681,27 @@
 EXPORT_SYMBOL_GPL(usb_unpoison_urb);
 
 /**
+ * usb_block_urb - reliably prevent further use of an URB
+ * @urb: pointer to URB to be blocked, may be NULL
+ *
+ * After the routine has run, attempts to resubmit the URB will fail
+ * with error -EPERM.  Thus even if the URB's completion handler always
+ * tries to resubmit, it will not succeed and the URB will become idle.
+ *
+ * The URB must not be deallocated while this routine is running.  In
+ * particular, when a driver calls this routine, it must insure that the
+ * completion handler cannot deallocate the URB.
+ */
+void usb_block_urb(struct urb *urb)
+{
+	if (!urb)
+		return;
+
+	atomic_inc(&urb->reject);
+}
+EXPORT_SYMBOL_GPL(usb_block_urb);
+
+/**
  * usb_kill_anchored_urbs - cancel transfer requests en masse
  * @anchor: anchor the requests are bound to
  *
diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c
index 1fc8f12..347bb05 100644
--- a/drivers/usb/early/ehci-dbgp.c
+++ b/drivers/usb/early/ehci-dbgp.c
@@ -450,7 +450,7 @@
 	writel(FLAG_CF, &ehci_regs->configured_flag);
 
 	/* Wait until the controller is no longer halted */
-	loop = 10;
+	loop = 1000;
 	do {
 		status = readl(&ehci_regs->status);
 		if (!(status & STS_HALT))
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 55abfb6..188a89f 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -736,6 +736,8 @@
 		lastreq = list_entry(ep->queue.prev, struct fsl_req, queue);
 		lastreq->tail->next_td_ptr =
 			cpu_to_hc32(req->head->td_dma & DTD_ADDR_MASK);
+		/* Ensure dTD's next dtd pointer to be updated */
+		wmb();
 		/* Read prime bit, if 1 goto done */
 		if (fsl_readl(&dr_regs->endpointprime) & bitmask)
 			return;
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index dd62224..cc2851f 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -849,6 +849,8 @@
 	spin_lock_irqsave(&dev->lock, flags);
 	if (dev->port_usb) {
 		struct gether	*link = dev->port_usb;
+		const struct usb_endpoint_descriptor *in;
+		const struct usb_endpoint_descriptor *out;
 
 		if (link->close)
 			link->close(link);
@@ -862,6 +864,8 @@
 		 * their own pace; the network stack can handle old packets.
 		 * For the moment we leave this here, since it works.
 		 */
+		in = link->in_ep->desc;
+		out = link->out_ep->desc;
 		usb_ep_disable(link->in_ep);
 		usb_ep_disable(link->out_ep);
 		if (netif_carrier_ok(net)) {
@@ -874,6 +878,8 @@
 				return -EINVAL;
 			}
 			DBG(dev, "host still using in/out endpoints\n");
+			link->in_ep->desc = in;
+			link->out_ep->desc = out;
 			usb_ep_enable(link->in_ep);
 			usb_ep_enable(link->out_ep);
 		}
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index adbf217..020a153 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -684,7 +684,9 @@
 	hw = ehci->async->hw;
 	hw->hw_next = QH_NEXT(ehci, ehci->async->qh_dma);
 	hw->hw_info1 = cpu_to_hc32(ehci, QH_HEAD);
+#if defined(CONFIG_PPC_PS3)
 	hw->hw_info1 |= cpu_to_hc32(ehci, (1 << 7));	/* I = 1 */
+#endif
 	hw->hw_token = cpu_to_hc32(ehci, QTD_STS_HALT);
 	hw->hw_qtd_next = EHCI_LIST_END(ehci);
 	ehci->async->qh_state = QH_STATE_LINKED;
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 5c78f9e..e669c6a 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -242,15 +242,6 @@
 
 	ehci_reset(omap_ehci);
 
-	ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
-	if (ret) {
-		dev_err(dev, "failed to add hcd with err %d\n", ret);
-		goto err_add_hcd;
-	}
-
-	/* root ports should always stay powered */
-	ehci_port_power(omap_ehci, 1);
-
 	if (pdata->phy_reset) {
 		/* Hold the PHY in RESET for enough time till
 		 * PHY is settled and ready
@@ -264,6 +255,15 @@
 			gpio_set_value(pdata->reset_gpio_port[1], 1);
 	}
 
+	ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
+	if (ret) {
+		dev_err(dev, "failed to add hcd with err %d\n", ret);
+		goto err_add_hcd;
+	}
+
+	/* root ports should always stay powered */
+	ehci_port_power(omap_ehci, 1);
+
 	return 0;
 
 err_add_hcd:
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index fe8dc06..1234817 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -144,14 +144,6 @@
 			hcd->has_tt = 1;
 			tdi_reset(ehci);
 		}
-		if (pdev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK) {
-			/* EHCI #1 or #2 on 6 Series/C200 Series chipset */
-			if (pdev->device == 0x1c26 || pdev->device == 0x1c2d) {
-				ehci_info(ehci, "broken D3 during system sleep on ASUS\n");
-				hcd->broken_pci_sleep = 1;
-				device_set_wakeup_capable(&pdev->dev, false);
-			}
-		}
 		break;
 	case PCI_VENDOR_ID_TDI:
 		if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
@@ -368,7 +360,9 @@
 {
 	return pdev->class == PCI_CLASS_SERIAL_USB_EHCI &&
 		pdev->vendor == PCI_VENDOR_ID_INTEL &&
-		pdev->device == 0x1E26;
+		(pdev->device == 0x1E26 ||
+		 pdev->device == 0x8C2D ||
+		 pdev->device == 0x8C26);
 }
 
 static void ehci_enable_xhci_companion(void)
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index d238b4e2..82c1eb8 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -75,8 +75,6 @@
 	.relinquish_port	= ehci_relinquish_port,
 	.port_handed_over	= ehci_port_handed_over,
 
-	.update_device		= ehci_update_device,
-
 	.clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
 };
 
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 13ebeca..55d3d64 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -223,7 +223,7 @@
 /*-------------------------------------------------------------------------*/
 
 static int __devinit
-ohci_at91_start (struct usb_hcd *hcd)
+ohci_at91_reset (struct usb_hcd *hcd)
 {
 	struct at91_usbh_data	*board = hcd->self.controller->platform_data;
 	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
@@ -233,6 +233,14 @@
 		return ret;
 
 	ohci->num_ports = board->ports;
+	return 0;
+}
+
+static int __devinit
+ohci_at91_start (struct usb_hcd *hcd)
+{
+	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
+	int			ret;
 
 	if ((ret = ohci_run(ohci)) < 0) {
 		err("can't start %s", hcd->self.bus_name);
@@ -418,6 +426,7 @@
 	/*
 	 * basic lifecycle operations
 	 */
+	.reset =		ohci_at91_reset,
 	.start =		ohci_at91_start,
 	.stop =			ohci_stop,
 	.shutdown =		ohci_shutdown,
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 32dada8..c5e9e4a 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -9,6 +9,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/kconfig.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
 #include <linux/init.h>
@@ -712,12 +713,28 @@
 	return -ETIMEDOUT;
 }
 
-bool usb_is_intel_switchable_xhci(struct pci_dev *pdev)
+#define PCI_DEVICE_ID_INTEL_LYNX_POINT_XHCI	0x8C31
+
+bool usb_is_intel_ppt_switchable_xhci(struct pci_dev *pdev)
 {
 	return pdev->class == PCI_CLASS_SERIAL_USB_XHCI &&
 		pdev->vendor == PCI_VENDOR_ID_INTEL &&
 		pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI;
 }
+
+/* The Intel Lynx Point chipset also has switchable ports. */
+bool usb_is_intel_lpt_switchable_xhci(struct pci_dev *pdev)
+{
+	return pdev->class == PCI_CLASS_SERIAL_USB_XHCI &&
+		pdev->vendor == PCI_VENDOR_ID_INTEL &&
+		pdev->device == PCI_DEVICE_ID_INTEL_LYNX_POINT_XHCI;
+}
+
+bool usb_is_intel_switchable_xhci(struct pci_dev *pdev)
+{
+	return usb_is_intel_ppt_switchable_xhci(pdev) ||
+		usb_is_intel_lpt_switchable_xhci(pdev);
+}
 EXPORT_SYMBOL_GPL(usb_is_intel_switchable_xhci);
 
 /*
@@ -742,6 +759,19 @@
 {
 	u32		ports_available;
 
+	/* Don't switchover the ports if the user hasn't compiled the xHCI
+	 * driver.  Otherwise they will see "dead" USB ports that don't power
+	 * the devices.
+	 */
+	if (!IS_ENABLED(CONFIG_USB_XHCI_HCD)) {
+		dev_warn(&xhci_pdev->dev,
+				"CONFIG_USB_XHCI_HCD is turned off, "
+				"defaulting to EHCI.\n");
+		dev_warn(&xhci_pdev->dev,
+				"USB 3.0 devices will work at USB 2.0 speeds.\n");
+		return;
+	}
+
 	ports_available = 0xffffffff;
 	/* Write USB3_PSSEN, the USB 3.0 Port SuperSpeed Enable
 	 * Register, to turn on SuperSpeed terminations for all
@@ -770,6 +800,13 @@
 }
 EXPORT_SYMBOL_GPL(usb_enable_xhci_ports);
 
+void usb_disable_xhci_ports(struct pci_dev *xhci_pdev)
+{
+	pci_write_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN, 0x0);
+	pci_write_config_dword(xhci_pdev, USB_INTEL_XUSB2PR, 0x0);
+}
+EXPORT_SYMBOL_GPL(usb_disable_xhci_ports);
+
 /**
  * PCI Quirks for xHCI.
  *
diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h
index b1002a8..ef004a5 100644
--- a/drivers/usb/host/pci-quirks.h
+++ b/drivers/usb/host/pci-quirks.h
@@ -10,6 +10,7 @@
 void usb_amd_quirk_pll_enable(void);
 bool usb_is_intel_switchable_xhci(struct pci_dev *pdev);
 void usb_enable_xhci_ports(struct pci_dev *xhci_pdev);
+void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
 #else
 static inline void usb_amd_quirk_pll_disable(void) {}
 static inline void usb_amd_quirk_pll_enable(void) {}
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 78ece8d..f97ab9f 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -472,6 +472,42 @@
 	}
 }
 
+/* Updates Link Status for super Speed port */
+static void xhci_hub_report_link_state(u32 *status, u32 status_reg)
+{
+	u32 pls = status_reg & PORT_PLS_MASK;
+
+	/* resume state is a xHCI internal state.
+	 * Do not report it to usb core.
+	 */
+	if (pls == XDEV_RESUME)
+		return;
+
+	/* When the CAS bit is set then warm reset
+	 * should be performed on port
+	 */
+	if (status_reg & PORT_CAS) {
+		/* The CAS bit can be set while the port is
+		 * in any link state.
+		 * Only roothubs have CAS bit, so we
+		 * pretend to be in compliance mode
+		 * unless we're already in compliance
+		 * or the inactive state.
+		 */
+		if (pls != USB_SS_PORT_LS_COMP_MOD &&
+		    pls != USB_SS_PORT_LS_SS_INACTIVE) {
+			pls = USB_SS_PORT_LS_COMP_MOD;
+		}
+		/* Return also connection bit -
+		 * hub state machine resets port
+		 * when this bit is set.
+		 */
+		pls |= USB_PORT_STAT_CONNECTION;
+	}
+	/* update status field */
+	*status |= pls;
+}
+
 int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 		u16 wIndex, char *buf, u16 wLength)
 {
@@ -568,6 +604,7 @@
 				xhci_dbg(xhci, "Resume USB2 port %d\n",
 					wIndex + 1);
 				bus_state->resume_done[wIndex] = 0;
+				clear_bit(wIndex, &bus_state->resuming_ports);
 				xhci_set_link_state(xhci, port_array, wIndex,
 							XDEV_U0);
 				xhci_dbg(xhci, "set port %d resume\n",
@@ -614,13 +651,9 @@
 			else
 				status |= USB_PORT_STAT_POWER;
 		}
-		/* Port Link State */
+		/* Update Port Link State for super speed ports*/
 		if (hcd->speed == HCD_USB3) {
-			/* resume state is a xHCI internal state.
-			 * Do not report it to usb core.
-			 */
-			if ((temp & PORT_PLS_MASK) != XDEV_RESUME)
-				status |= (temp & PORT_PLS_MASK);
+			xhci_hub_report_link_state(&status, temp);
 		}
 		if (bus_state->port_c_suspend & (1 << wIndex))
 			status |= 1 << USB_PORT_FEAT_C_SUSPEND;
@@ -861,7 +894,12 @@
 	/* Initial status is no changes */
 	retval = (max_ports + 8) / 8;
 	memset(buf, 0, retval);
-	status = 0;
+
+	/*
+	 * Inform the usbcore about resume-in-progress by returning
+	 * a non-zero value even if there are no status changes.
+	 */
+	status = bus_state->resuming_ports;
 
 	mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC;
 
@@ -901,15 +939,11 @@
 	spin_lock_irqsave(&xhci->lock, flags);
 
 	if (hcd->self.root_hub->do_remote_wakeup) {
-		port_index = max_ports;
-		while (port_index--) {
-			if (bus_state->resume_done[port_index] != 0) {
-				spin_unlock_irqrestore(&xhci->lock, flags);
-				xhci_dbg(xhci, "suspend failed because "
-						"port %d is resuming\n",
-						port_index + 1);
-				return -EBUSY;
-			}
+		if (bus_state->resuming_ports) {
+			spin_unlock_irqrestore(&xhci->lock, flags);
+			xhci_dbg(xhci, "suspend failed because "
+						"a port is resuming\n");
+			return -EBUSY;
 		}
 	}
 
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 68eaa90..6b90824 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -793,10 +793,9 @@
 		struct xhci_virt_device *virt_dev,
 		int slot_id)
 {
-	struct list_head *tt;
 	struct list_head *tt_list_head;
-	struct list_head *tt_next;
-	struct xhci_tt_bw_info *tt_info;
+	struct xhci_tt_bw_info *tt_info, *next;
+	bool slot_found = false;
 
 	/* If the device never made it past the Set Address stage,
 	 * it may not have the real_port set correctly.
@@ -808,34 +807,16 @@
 	}
 
 	tt_list_head = &(xhci->rh_bw[virt_dev->real_port - 1].tts);
-	if (list_empty(tt_list_head))
-		return;
-
-	list_for_each(tt, tt_list_head) {
-		tt_info = list_entry(tt, struct xhci_tt_bw_info, tt_list);
-		if (tt_info->slot_id == slot_id)
+	list_for_each_entry_safe(tt_info, next, tt_list_head, tt_list) {
+		/* Multi-TT hubs will have more than one entry */
+		if (tt_info->slot_id == slot_id) {
+			slot_found = true;
+			list_del(&tt_info->tt_list);
+			kfree(tt_info);
+		} else if (slot_found) {
 			break;
+		}
 	}
-	/* Cautionary measure in case the hub was disconnected before we
-	 * stored the TT information.
-	 */
-	if (tt_info->slot_id != slot_id)
-		return;
-
-	tt_next = tt->next;
-	tt_info = list_entry(tt, struct xhci_tt_bw_info,
-			tt_list);
-	/* Multi-TT hubs will have more than one entry */
-	do {
-		list_del(tt);
-		kfree(tt_info);
-		tt = tt_next;
-		if (list_empty(tt_list_head))
-			break;
-		tt_next = tt->next;
-		tt_info = list_entry(tt, struct xhci_tt_bw_info,
-				tt_list);
-	} while (tt_info->slot_id == slot_id);
 }
 
 int xhci_alloc_tt_info(struct xhci_hcd *xhci,
@@ -1793,7 +1774,7 @@
 	struct dev_info	*dev_info, *next;
 	unsigned long	flags;
 	int size;
-	int i;
+	int i, j, num_ports;
 
 	/* Free the Event Ring Segment Table and the actual Event Ring */
 	size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);
@@ -1807,6 +1788,7 @@
 	xhci->event_ring = NULL;
 	xhci_dbg(xhci, "Freed event ring\n");
 
+	xhci->cmd_ring_reserved_trbs = 0;
 	if (xhci->cmd_ring)
 		xhci_ring_free(xhci, xhci->cmd_ring);
 	xhci->cmd_ring = NULL;
@@ -1849,8 +1831,27 @@
 	}
 	spin_unlock_irqrestore(&xhci->lock, flags);
 
+	num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
+	for (i = 0; i < num_ports; i++) {
+		struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table;
+		for (j = 0; j < XHCI_MAX_INTERVAL; j++) {
+			struct list_head *ep = &bwt->interval_bw[j].endpoints;
+			while (!list_empty(ep))
+				list_del_init(ep->next);
+		}
+	}
+
+	for (i = 0; i < num_ports; i++) {
+		struct xhci_tt_bw_info *tt, *n;
+		list_for_each_entry_safe(tt, n, &xhci->rh_bw[i].tts, tt_list) {
+			list_del(&tt->tt_list);
+			kfree(tt);
+		}
+	}
+
 	xhci->num_usb2_ports = 0;
 	xhci->num_usb3_ports = 0;
+	xhci->num_active_eps = 0;
 	kfree(xhci->usb2_ports);
 	kfree(xhci->usb3_ports);
 	kfree(xhci->port_array);
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 7a856a7..f152740 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -72,6 +72,7 @@
 		xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u "
 				"has broken MSI implementation\n",
 				pdev->revision);
+		xhci->quirks |= XHCI_TRUST_TX_LENGTH;
 	}
 
 	if (pdev->vendor == PCI_VENDOR_ID_NEC)
@@ -89,11 +90,21 @@
 		xhci->quirks |= XHCI_EP_LIMIT_QUIRK;
 		xhci->limit_active_eps = 64;
 		xhci->quirks |= XHCI_SW_BW_CHECKING;
+		/*
+		 * PPT desktop boards DH77EB and DH77DF will power back on after
+		 * a few seconds of being shutdown.  The fix for this is to
+		 * switch the ports from xHCI to EHCI on shutdown.  We can't use
+		 * DMI information to find those particular boards (since each
+		 * vendor will change the board name), so we have to key off all
+		 * PPT chipsets.
+		 */
+		xhci->quirks |= XHCI_SPURIOUS_REBOOT;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
 			pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
 		xhci->quirks |= XHCI_RESET_ON_RESUME;
 		xhci_dbg(xhci, "QUIRK: Resetting on resume\n");
+		xhci->quirks |= XHCI_TRUST_TX_LENGTH;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_VIA)
 		xhci->quirks |= XHCI_RESET_ON_RESUME;
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 3d9422f..203ba31 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -145,29 +145,37 @@
  */
 static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring)
 {
-	union xhci_trb *next;
 	unsigned long long addr;
 
 	ring->deq_updates++;
 
-	/* If this is not event ring, there is one more usable TRB */
+	/*
+	 * If this is not event ring, and the dequeue pointer
+	 * is not on a link TRB, there is one more usable TRB
+	 */
 	if (ring->type != TYPE_EVENT &&
 			!last_trb(xhci, ring, ring->deq_seg, ring->dequeue))
 		ring->num_trbs_free++;
-	next = ++(ring->dequeue);
 
-	/* Update the dequeue pointer further if that was a link TRB or we're at
-	 * the end of an event ring segment (which doesn't have link TRBS)
-	 */
-	while (last_trb(xhci, ring, ring->deq_seg, next)) {
-		if (ring->type == TYPE_EVENT &&	last_trb_on_last_seg(xhci,
-				ring, ring->deq_seg, next)) {
-			ring->cycle_state = (ring->cycle_state ? 0 : 1);
+	do {
+		/*
+		 * Update the dequeue pointer further if that was a link TRB or
+		 * we're at the end of an event ring segment (which doesn't have
+		 * link TRBS)
+		 */
+		if (last_trb(xhci, ring, ring->deq_seg, ring->dequeue)) {
+			if (ring->type == TYPE_EVENT &&
+					last_trb_on_last_seg(xhci, ring,
+						ring->deq_seg, ring->dequeue)) {
+				ring->cycle_state = (ring->cycle_state ? 0 : 1);
+			}
+			ring->deq_seg = ring->deq_seg->next;
+			ring->dequeue = ring->deq_seg->trbs;
+		} else {
+			ring->dequeue++;
 		}
-		ring->deq_seg = ring->deq_seg->next;
-		ring->dequeue = ring->deq_seg->trbs;
-		next = ring->dequeue;
-	}
+	} while (last_trb(xhci, ring, ring->deq_seg, ring->dequeue));
+
 	addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
 }
 
@@ -885,6 +893,17 @@
 	num_trbs_free_temp = ep_ring->num_trbs_free;
 	dequeue_temp = ep_ring->dequeue;
 
+	/* If we get two back-to-back stalls, and the first stalled transfer
+	 * ends just before a link TRB, the dequeue pointer will be left on
+	 * the link TRB by the code in the while loop.  So we have to update
+	 * the dequeue pointer one segment further, or we'll jump off
+	 * the segment into la-la-land.
+	 */
+	if (last_trb(xhci, ep_ring, ep_ring->deq_seg, ep_ring->dequeue)) {
+		ep_ring->deq_seg = ep_ring->deq_seg->next;
+		ep_ring->dequeue = ep_ring->deq_seg->trbs;
+	}
+
 	while (ep_ring->dequeue != dev->eps[ep_index].queued_deq_ptr) {
 		/* We have more usable TRBs */
 		ep_ring->num_trbs_free++;
@@ -1377,6 +1396,7 @@
 			xhci_dbg(xhci, "resume HS port %d\n", port_id);
 			bus_state->resume_done[faked_port_index] = jiffies +
 				msecs_to_jiffies(20);
+			set_bit(faked_port_index, &bus_state->resuming_ports);
 			mod_timer(&hcd->rh_timer,
 				  bus_state->resume_done[faked_port_index]);
 			/* Do the rest in GetPortStatus */
@@ -1786,8 +1806,12 @@
 	/* handle completion code */
 	switch (trb_comp_code) {
 	case COMP_SUCCESS:
-		frame->status = 0;
-		break;
+		if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) {
+			frame->status = 0;
+			break;
+		}
+		if ((xhci->quirks & XHCI_TRUST_TX_LENGTH))
+			trb_comp_code = COMP_SHORT_TX;
 	case COMP_SHORT_TX:
 		frame->status = td->urb->transfer_flags & URB_SHORT_NOT_OK ?
 				-EREMOTEIO : 0;
@@ -1803,6 +1827,7 @@
 		break;
 	case COMP_DEV_ERR:
 	case COMP_STALL:
+	case COMP_TX_ERR:
 		frame->status = -EPROTO;
 		skip_td = true;
 		break;
@@ -1883,13 +1908,16 @@
 	switch (trb_comp_code) {
 	case COMP_SUCCESS:
 		/* Double check that the HW transferred everything. */
-		if (event_trb != td->last_trb) {
+		if (event_trb != td->last_trb ||
+				TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
 			xhci_warn(xhci, "WARN Successful completion "
 					"on short TX\n");
 			if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
 				*status = -EREMOTEIO;
 			else
 				*status = 0;
+			if ((xhci->quirks & XHCI_TRUST_TX_LENGTH))
+				trb_comp_code = COMP_SHORT_TX;
 		} else {
 			*status = 0;
 		}
@@ -2048,6 +2076,13 @@
 	 * transfer type
 	 */
 	case COMP_SUCCESS:
+		if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
+			break;
+		if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
+			trb_comp_code = COMP_SHORT_TX;
+		else
+			xhci_warn(xhci, "WARN Successful completion on short TX: "
+					"needs XHCI_TRUST_TX_LENGTH quirk?\n");
 	case COMP_SHORT_TX:
 		break;
 	case COMP_STOP:
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 2c26998..ea4a12d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -152,7 +152,7 @@
 {
 	u32 command;
 	u32 state;
-	int ret;
+	int ret, i;
 
 	state = xhci_readl(xhci, &xhci->op_regs->status);
 	if ((state & STS_HALT) == 0) {
@@ -166,7 +166,7 @@
 	xhci_writel(xhci, command, &xhci->op_regs->command);
 
 	ret = handshake(xhci, &xhci->op_regs->command,
-			CMD_RESET, 0, 250 * 1000);
+			CMD_RESET, 0, 10 * 1000 * 1000);
 	if (ret)
 		return ret;
 
@@ -175,7 +175,16 @@
 	 * xHCI cannot write to any doorbells or operational registers other
 	 * than status until the "Controller Not Ready" flag is cleared.
 	 */
-	return handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000);
+	ret = handshake(xhci, &xhci->op_regs->status,
+			STS_CNR, 0, 10 * 1000 * 1000);
+
+	for (i = 0; i < 2; ++i) {
+		xhci->bus_state[i].port_c_suspend = 0;
+		xhci->bus_state[i].suspended_ports = 0;
+		xhci->bus_state[i].resuming_ports = 0;
+	}
+
+	return ret;
 }
 
 #ifdef CONFIG_PCI
@@ -643,6 +652,9 @@
 {
 	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
 
+	if (xhci->quirks && XHCI_SPURIOUS_REBOOT)
+		usb_disable_xhci_ports(to_pci_dev(hcd->self.controller));
+
 	spin_lock_irq(&xhci->lock);
 	xhci_halt(xhci);
 	spin_unlock_irq(&xhci->lock);
@@ -797,8 +809,8 @@
 	command = xhci_readl(xhci, &xhci->op_regs->command);
 	command |= CMD_CSS;
 	xhci_writel(xhci, command, &xhci->op_regs->command);
-	if (handshake(xhci, &xhci->op_regs->status, STS_SAVE, 0, 10*100)) {
-		xhci_warn(xhci, "WARN: xHC CMD_CSS timeout\n");
+	if (handshake(xhci, &xhci->op_regs->status, STS_SAVE, 0, 10 * 1000)) {
+		xhci_warn(xhci, "WARN: xHC save state timeout\n");
 		spin_unlock_irq(&xhci->lock);
 		return -ETIMEDOUT;
 	}
@@ -850,8 +862,8 @@
 		command |= CMD_CRS;
 		xhci_writel(xhci, command, &xhci->op_regs->command);
 		if (handshake(xhci, &xhci->op_regs->status,
-			      STS_RESTORE, 0, 10*100)) {
-			xhci_dbg(xhci, "WARN: xHC CMD_CSS timeout\n");
+			      STS_RESTORE, 0, 10 * 1000)) {
+			xhci_warn(xhci, "WARN: xHC restore state timeout\n");
 			spin_unlock_irq(&xhci->lock);
 			return -ETIMEDOUT;
 		}
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 127b0e9..370eeca 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -341,7 +341,11 @@
 #define PORT_PLC	(1 << 22)
 /* port configure error change - port failed to configure its link partner */
 #define PORT_CEC	(1 << 23)
-/* bit 24 reserved */
+/* Cold Attach Status - xHC can set this bit to report device attached during
+ * Sx state. Warm port reset should be perfomed to clear this bit and move port
+ * to connected state.
+ */
+#define PORT_CAS	(1 << 24)
 /* wake on connect (enable) */
 #define PORT_WKCONN_E	(1 << 25)
 /* wake on disconnect (enable) */
@@ -1362,6 +1366,8 @@
 	u32			suspended_ports;
 	u32			port_remote_wakeup;
 	unsigned long		resume_done[USB_MAXCHILDREN];
+	/* which ports have started to resume */
+	unsigned long		resuming_ports;
 };
 
 static inline unsigned int hcd_index(struct usb_hcd *hcd)
@@ -1479,6 +1485,8 @@
 #define XHCI_RESET_ON_RESUME	(1 << 7)
 #define	XHCI_SW_BW_CHECKING	(1 << 8)
 #define XHCI_AMD_0x96_HOST	(1 << 9)
+#define XHCI_TRUST_TX_LENGTH	(1 << 10)
+#define XHCI_SPURIOUS_REBOOT	(1 << 13)
 /*
  * In Synopsis DWC3 controller, PORTSC register access involves multiple clock
  * domains. When the software does a PORTSC write, handshakes are needed
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 9dcb68f..055b84a 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -1028,7 +1028,10 @@
 		case 13:	/* short read, resembling case 10 */
 			req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
 			/* last data packet "should" be DATA1, not DATA0 */
-			len = 1024 - udev->descriptor.bMaxPacketSize0;
+			if (udev->speed == USB_SPEED_SUPER)
+				len = 1024 - 512;
+			else
+				len = 1024 - udev->descriptor.bMaxPacketSize0;
 			expected = -EREMOTEIO;
 			break;
 		case 14:	/* short read; try to fill the last packet */
@@ -1387,11 +1390,15 @@
 
 static int halt_simple(struct usbtest_dev *dev)
 {
-	int		ep;
-	int		retval = 0;
-	struct urb	*urb;
+	int			ep;
+	int			retval = 0;
+	struct urb		*urb;
+	struct usb_device	*udev = testdev_to_usbdev(dev);
 
-	urb = simple_alloc_urb(testdev_to_usbdev(dev), 0, 512);
+	if (udev->speed == USB_SPEED_SUPER)
+		urb = simple_alloc_urb(udev, 0, 1024);
+	else
+		urb = simple_alloc_urb(udev, 0, 512);
 	if (urb == NULL)
 		return -ENOMEM;
 
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 768b4b5..9d63ba4 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -34,6 +34,7 @@
 #include <linux/dma-mapping.h>
 
 #include <mach/cputype.h>
+#include <mach/hardware.h>
 
 #include <asm/mach-types.h>
 
diff --git a/drivers/usb/musb/davinci.h b/drivers/usb/musb/davinci.h
index 046c844..371baa0 100644
--- a/drivers/usb/musb/davinci.h
+++ b/drivers/usb/musb/davinci.h
@@ -15,7 +15,7 @@
  */
 
 /* Integrated highspeed/otg PHY */
-#define USBPHY_CTL_PADDR	(DAVINCI_SYSTEM_MODULE_BASE + 0x34)
+#define USBPHY_CTL_PADDR	0x01c40034
 #define USBPHY_DATAPOL		BIT(11)	/* (dm355) switch D+/D- */
 #define USBPHY_PHYCLKGD		BIT(8)
 #define USBPHY_SESNDEN		BIT(7)	/* v(sess_end) comparator */
@@ -27,7 +27,7 @@
 #define USBPHY_OTGPDWN		BIT(1)
 #define USBPHY_PHYPDWN		BIT(0)
 
-#define DM355_DEEPSLEEP_PADDR	(DAVINCI_SYSTEM_MODULE_BASE + 0x48)
+#define DM355_DEEPSLEEP_PADDR	0x01c40048
 #define DRVVBUS_FORCE		BIT(2)
 #define DRVVBUS_OVERRIDE	BIT(1)
 
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index f42c29b..95918da 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1232,6 +1232,7 @@
 	}
 
 	musb_ep->desc = NULL;
+	musb_ep->end_point.desc = NULL;
 
 	/* abort all pending DMA and requests */
 	nuke(musb_ep, -ESHUTDOWN);
diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile
index 5afb02e..31949fd 100644
--- a/drivers/usb/otg/Makefile
+++ b/drivers/usb/otg/Makefile
@@ -18,7 +18,11 @@
 obj-$(CONFIG_USB_ULPI)		+= ulpi.o
 obj-$(CONFIG_USB_ULPI_VIEWPORT)	+= ulpi_viewport.o
 obj-$(CONFIG_USB_MSM_OTG_72K)	+= msm72k_otg.o
+ifeq ($(CONFIG_MACH_HTC),y)
+obj-$(CONFIG_USB_MSM_OTG)	+= msm_otg_htc.o
+else
 obj-$(CONFIG_USB_MSM_OTG)	+= msm_otg.o
+endif
 obj-$(CONFIG_AB8500_USB)	+= ab8500-usb.o
 fsl_usb2_otg-objs		:= fsl_otg.o otg_fsm.o
 obj-$(CONFIG_FSL_USB2_OTG)	+= fsl_usb2_otg.o
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
index a0a2178..fe20864 100644
--- a/drivers/usb/otg/gpio_vbus.c
+++ b/drivers/usb/otg/gpio_vbus.c
@@ -37,7 +37,7 @@
 	struct regulator       *vbus_draw;
 	int			vbus_draw_enabled;
 	unsigned		mA;
-	struct work_struct	work;
+	struct delayed_work	work;
 };
 
 
@@ -94,7 +94,7 @@
 static void gpio_vbus_work(struct work_struct *work)
 {
 	struct gpio_vbus_data *gpio_vbus =
-		container_of(work, struct gpio_vbus_data, work);
+		container_of(work, struct gpio_vbus_data, work.work);
 	struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data;
 	int gpio, status;
 
@@ -152,7 +152,7 @@
 		otg->gadget ? otg->gadget->name : "none");
 
 	if (otg->gadget)
-		schedule_work(&gpio_vbus->work);
+		schedule_delayed_work(&gpio_vbus->work, msecs_to_jiffies(100));
 
 	return IRQ_HANDLED;
 }
@@ -300,7 +300,7 @@
 
 	ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier);
 
-	INIT_WORK(&gpio_vbus->work, gpio_vbus_work);
+	INIT_DELAYED_WORK(&gpio_vbus->work, gpio_vbus_work);
 
 	gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw");
 	if (IS_ERR(gpio_vbus->vbus_draw)) {
diff --git a/drivers/usb/otg/msm_otg_htc.c b/drivers/usb/otg/msm_otg_htc.c
new file mode 100644
index 0000000..0fc8f98
--- /dev/null
+++ b/drivers/usb/otg/msm_otg_htc.c
@@ -0,0 +1,4332 @@
+/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+#include <linux/slab.h>
+#include <linux/interrupt.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/uaccess.h>
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+#include <linux/pm_runtime.h>
+#include <linux/of.h>
+#include <linux/dma-mapping.h>
+
+#include <linux/usb.h>
+#include <linux/usb/otg.h>
+#include <linux/usb/ulpi.h>
+#include <linux/usb/gadget.h>
+#include <linux/usb/hcd.h>
+#include <linux/usb/quirks.h>
+#include <linux/usb/msm_hsusb.h>
+#include <linux/usb/msm_hsusb_hw.h>
+#include <linux/usb/htc_info.h>
+#include <linux/regulator/consumer.h>
+#include <linux/mfd/pm8xxx/pm8921-charger.h>
+#include <linux/mfd/pm8xxx/misc.h>
+#include <linux/power_supply.h>
+
+#include <mach/clk.h>
+#include <mach/msm_xo.h>
+#include <mach/msm_bus.h>
+#include <mach/rpm-regulator.h>
+#include <mach/cable_detect.h>
+#include <mach/board.h>
+#include <mach/board_htc.h>
+
+#define MSM_USB_BASE	(motg->regs)
+#define DRIVER_NAME	"msm_otg"
+
+static int htc_otg_vbus;
+static int USB_disabled;
+static struct msm_otg *the_msm_otg;
+
+enum {
+    NOT_ON_AUTOBOT,
+    DOCK_ON_AUTOBOT,
+    HTC_MODE_RUNNING
+};
+
+static DEFINE_MUTEX(notify_sem);
+static void send_usb_connect_notify(struct work_struct *w)
+{
+	static struct t_usb_status_notifier *notifier;
+	struct msm_otg *motg = container_of(w, struct msm_otg,	notifier_work);
+	if (!motg)
+		return;
+
+	motg->connect_type_ready = 1;
+	USBH_INFO("send connect type %d\n", motg->connect_type);
+	mutex_lock(&notify_sem);
+	list_for_each_entry(notifier, &g_lh_usb_notifier_list, notifier_link) {
+		if (notifier->func != NULL) {
+			/* Notify other drivers about connect type. */
+			/* use slow charging for unknown type*/
+			if (motg->connect_type == CONNECT_TYPE_UNKNOWN)
+				notifier->func(CONNECT_TYPE_USB);
+			else
+				notifier->func(motg->connect_type);
+		}
+	}
+	mutex_unlock(&notify_sem);
+}
+
+int htc_usb_register_notifier(struct t_usb_status_notifier *notifier)
+{
+	if (!notifier || !notifier->name || !notifier->func)
+		return -EINVAL;
+
+	mutex_lock(&notify_sem);
+	list_add(&notifier->notifier_link,
+		&g_lh_usb_notifier_list);
+	mutex_unlock(&notify_sem);
+	return 0;
+}
+
+int usb_is_connect_type_ready(void)
+{
+	if (!the_msm_otg)
+		return 0;
+	return the_msm_otg->connect_type_ready;
+}
+EXPORT_SYMBOL(usb_is_connect_type_ready);
+
+int usb_get_connect_type(void)
+{
+	if (!the_msm_otg)
+		return 0;
+#ifdef CONFIG_MACH_VERDI_LTE
+	if (the_msm_otg->connect_type == CONNECT_TYPE_USB_9V_AC)
+		return CONNECT_TYPE_9V_AC;
+#endif
+	return the_msm_otg->connect_type;
+}
+EXPORT_SYMBOL(usb_get_connect_type);
+
+
+static bool is_msm_otg_support_power_collapse(struct msm_otg *motg)
+{
+	bool ret = true;
+
+	if (!motg->pdata->ldo_power_collapse)
+		return false;
+
+	if (get_kernel_flag() & KERNEL_FLAG_SERIAL_HSL_ENABLE &&
+		(motg->pdata->ldo_power_collapse & POWER_COLLAPSE_LDO3V3)) {
+		/* Not to turn off the L3 due to it owns the switch power */
+		motg->pdata->ldo_power_collapse &= ~POWER_COLLAPSE_LDO3V3;
+		USBH_INFO("%s: kernel_flag_serial_hsl_enable."
+			" POWER_COLLAPSE_LDO3V3 disabled\n", __func__);
+	}
+
+	if (motg->pdata->ldo_power_collapse & POWER_COLLAPSE_LDO3V3)
+		USBH_INFO("%s: POWER_COLLAPSE_LDO3V3\n", __func__);
+	if (motg->pdata->ldo_power_collapse & POWER_COLLAPSE_LDO1V8)
+		USBH_INFO("%s: POWER_COLLAPSE_LDO1V8\n", __func__);
+
+	if (board_mfg_mode() == 8) {
+		ret = false;
+		USBH_DEBUG("%s:No. under mfgkernel\n", __func__);
+	}
+	return ret;
+}
+
+#define ID_TIMER_FREQ		(jiffies + msecs_to_jiffies(500))
+#define ULPI_IO_TIMEOUT_USEC	(10 * 1000)
+#define USB_PHY_3P3_VOL_MIN	3050000 /* uV */
+#define USB_PHY_3P3_VOL_MAX	3300000 /* uV */
+#define USB_PHY_3P3_HPM_LOAD	50000	/* uA */
+#define USB_PHY_3P3_LPM_LOAD	4000	/* uA */
+
+#define USB_PHY_1P8_VOL_MIN	1800000 /* uV */
+#define USB_PHY_1P8_VOL_MAX	1800000 /* uV */
+#define USB_PHY_1P8_HPM_LOAD	50000	/* uA */
+#define USB_PHY_1P8_LPM_LOAD	4000	/* uA */
+
+#define USB_PHY_VDD_DIG_VOL_NONE	0 /*uV */
+#define USB_PHY_VDD_DIG_VOL_MIN	1045000 /* uV */
+#define USB_PHY_VDD_DIG_VOL_MAX	1320000 /* uV */
+
+static DECLARE_COMPLETION(pmic_vbus_init);
+static struct msm_otg *the_msm_otg;
+static bool debug_aca_enabled;
+static bool debug_bus_voting_enabled;
+
+static struct regulator *hsusb_3p3;
+static struct regulator *hsusb_1p8;
+static struct regulator *hsusb_vddcx;
+/*static struct regulator *vbus_otg;*/
+static struct regulator *mhl_usb_hs_switch;
+static struct power_supply *psy;
+
+static bool aca_id_turned_on;
+static inline bool aca_enabled(void)
+{
+#ifdef CONFIG_USB_MSM_ACA
+	return true;
+#else
+	return debug_aca_enabled;
+#endif
+}
+
+static const int vdd_val[VDD_TYPE_MAX][VDD_VAL_MAX] = {
+		{  /* VDD_CX CORNER Voting */
+			[VDD_NONE]	= RPM_VREG_CORNER_NONE,
+			[VDD_MIN]	= RPM_VREG_CORNER_NOMINAL,
+			[VDD_MAX]	= RPM_VREG_CORNER_HIGH,
+		},
+		{ /* VDD_CX Voltage Voting */
+			[VDD_NONE]	= USB_PHY_VDD_DIG_VOL_NONE,
+			[VDD_MIN]	= USB_PHY_VDD_DIG_VOL_MIN,
+			[VDD_MAX]	= USB_PHY_VDD_DIG_VOL_MAX,
+		},
+};
+
+static int msm_hsusb_ldo_init(struct msm_otg *motg, int init)
+{
+	int rc = 0;
+
+	if (init) {
+		hsusb_3p3 = devm_regulator_get(motg->phy.dev, "HSUSB_3p3");
+		if (IS_ERR(hsusb_3p3)) {
+			USBH_ERR("unable to get hsusb 3p3\n");
+			return PTR_ERR(hsusb_3p3);
+		}
+
+		rc = regulator_set_voltage(hsusb_3p3, USB_PHY_3P3_VOL_MIN,
+				USB_PHY_3P3_VOL_MAX);
+		if (rc) {
+			USBH_ERR("unable to set voltage level for"
+					"hsusb 3p3\n");
+			return rc;
+		}
+		hsusb_1p8 = devm_regulator_get(motg->phy.dev, "HSUSB_1p8");
+		if (IS_ERR(hsusb_1p8)) {
+			USBH_ERR("unable to get hsusb 1p8\n");
+			rc = PTR_ERR(hsusb_1p8);
+			goto put_3p3_lpm;
+		}
+		rc = regulator_set_voltage(hsusb_1p8, USB_PHY_1P8_VOL_MIN,
+				USB_PHY_1P8_VOL_MAX);
+		if (rc) {
+			dev_err(motg->otg.dev, "unable to set voltage level for"
+					"hsusb 1p8\n");
+			goto put_1p8;
+		}
+
+		return 0;
+	}
+
+put_1p8:
+	regulator_set_voltage(hsusb_1p8, 0, USB_PHY_1P8_VOL_MAX);
+put_3p3_lpm:
+	regulator_set_voltage(hsusb_3p3, 0, USB_PHY_3P3_VOL_MAX);
+	return rc;
+}
+
+static int msm_hsusb_config_vddcx(int high)
+{
+	struct msm_otg *motg = the_msm_otg;
+	enum usb_vdd_type vdd_type = motg->vdd_type;
+	int max_vol = vdd_val[vdd_type][VDD_MAX];
+	int min_vol;
+	int ret;
+
+	min_vol = vdd_val[vdd_type][!!high];
+	ret = regulator_set_voltage(hsusb_vddcx, min_vol, max_vol);
+	if (ret) {
+		USBH_ERR("%s: unable to set the voltage for regulator "
+			"HSUSB_VDDCX\n", __func__);
+		return ret;
+	}
+
+	USBH_DEBUG("%s: min_vol:%d max_vol:%d\n", __func__, min_vol, max_vol);
+
+	return ret;
+}
+
+static int msm_hsusb_ldo_enable(struct msm_otg *motg, int on)
+{
+	int ret = 0;
+
+	if (IS_ERR(hsusb_1p8)) {
+		USBH_ERR("%s: HSUSB_1p8 is not initialized\n", __func__);
+		return -ENODEV;
+	}
+
+	if (IS_ERR(hsusb_3p3)) {
+		USBH_ERR("%s: HSUSB_3p3 is not initialized\n", __func__);
+		return -ENODEV;
+	}
+
+	if (on) {
+		ret = regulator_set_optimum_mode(hsusb_1p8,
+				USB_PHY_1P8_HPM_LOAD);
+		if (ret < 0) {
+			USBH_ERR("%s: Unable to set HPM of the regulator:"
+				"HSUSB_1p8\n", __func__);
+			return ret;
+		} else
+			USBH_INFO("%s: hsusb_1p8: %duA\n", __func__, USB_PHY_1P8_HPM_LOAD);
+
+		ret = regulator_enable(hsusb_1p8);
+		if (ret) {
+			USBH_ERR("%s: unable to enable the hsusb 1p8\n",
+				__func__);
+			regulator_set_optimum_mode(hsusb_1p8, 0);
+			return ret;
+		}
+
+		ret = regulator_set_optimum_mode(hsusb_3p3,
+				USB_PHY_3P3_HPM_LOAD);
+		if (ret < 0) {
+			USBH_ERR("%s: Unable to set HPM of the regulator:"
+				"HSUSB_3p3\n", __func__);
+			regulator_set_optimum_mode(hsusb_1p8, 0);
+			regulator_disable(hsusb_1p8);
+			return ret;
+		} else
+			USBH_INFO("%s: hsusb_3p3: %duA\n", __func__, USB_PHY_3P3_HPM_LOAD);
+
+		ret = regulator_enable(hsusb_3p3);
+		if (ret) {
+			USBH_ERR("%s: unable to enable the hsusb 3p3\n",
+				__func__);
+			regulator_set_optimum_mode(hsusb_3p3, 0);
+			regulator_set_optimum_mode(hsusb_1p8, 0);
+			regulator_disable(hsusb_1p8);
+			return ret;
+		}
+
+	} else {
+		if (motg->pdata->ldo_power_collapse & POWER_COLLAPSE_LDO1V8) {
+			ret = regulator_disable(hsusb_1p8);
+			if (ret) {
+				USBH_ERR("%s: unable to disable the hsusb 1p8\n",
+						__func__);
+				return ret;
+			}
+
+			ret = regulator_set_optimum_mode(hsusb_1p8, 0);
+			if (ret < 0)
+				USBH_ERR("%s: Unable to set LPM of the regulator:"
+						"HSUSB_1p8\n", __func__);
+			else
+				USBH_INFO("%s: hsusb_1p8: 0uA\n", __func__);
+		}
+		if (motg->pdata->ldo_power_collapse & POWER_COLLAPSE_LDO3V3) {
+			ret = regulator_disable(hsusb_3p3);
+			if (ret) {
+				USBH_ERR("%s: unable to disable the hsusb 3p3\n",
+						__func__);
+				return ret;
+			}
+			ret = regulator_set_optimum_mode(hsusb_3p3, 0);
+			if (ret < 0)
+				USBH_ERR("%s: Unable to set LPM of the regulator:"
+						"HSUSB_3p3\n", __func__);
+			else
+				USBH_INFO("%s: hsusb_3p3: 0uA\n", __func__);
+		}
+	}
+
+	USBH_DEBUG("reg (%s)\n", on ? "HPM" : "LPM");
+	return ret < 0 ? ret : 0;
+}
+
+static const char *state_string(enum usb_otg_state state)
+{
+	switch (state) {
+	case OTG_STATE_A_IDLE:		return "a_idle";
+	case OTG_STATE_A_WAIT_VRISE:	return "a_wait_vrise";
+	case OTG_STATE_A_WAIT_BCON:	return "a_wait_bcon";
+	case OTG_STATE_A_HOST:		return "a_host";
+	case OTG_STATE_A_SUSPEND:	return "a_suspend";
+	case OTG_STATE_A_PERIPHERAL:	return "a_peripheral";
+	case OTG_STATE_A_WAIT_VFALL:	return "a_wait_vfall";
+	case OTG_STATE_A_VBUS_ERR:	return "a_vbus_err";
+	case OTG_STATE_B_IDLE:		return "b_idle";
+	case OTG_STATE_B_SRP_INIT:	return "b_srp_init";
+	case OTG_STATE_B_PERIPHERAL:	return "b_peripheral";
+	case OTG_STATE_B_WAIT_ACON:	return "b_wait_acon";
+	case OTG_STATE_B_HOST:		return "b_host";
+	default:			return "UNDEFINED";
+	}
+}
+
+static const char *chg_state_string(enum usb_chg_state state)
+{
+	switch (state) {
+	case USB_CHG_STATE_UNDEFINED:		return "CHG_STATE_UNDEFINED";
+	case USB_CHG_STATE_WAIT_FOR_DCD:	return "CHG_WAIT_FOR_DCD";
+	case USB_CHG_STATE_DCD_DONE:	return "CHG_DCD_DONE";
+	case USB_CHG_STATE_PRIMARY_DONE:		return "CHG_PRIMARY_DONE";
+	case USB_CHG_STATE_SECONDARY_DONE:	return "CHG_SECONDARY_DONE";
+	case USB_CHG_STATE_DETECTED:	return "CHG_DETECTED";
+	default:			return "UNDEFINED";
+	}
+}
+
+static void msm_hsusb_mhl_switch_enable(struct msm_otg *motg, bool on)
+{
+	struct msm_otg_platform_data *pdata = motg->pdata;
+
+	if (!pdata->mhl_enable)
+		return;
+
+	if (!mhl_usb_hs_switch) {
+		pr_err("%s: mhl_usb_hs_switch is NULL.\n", __func__);
+		return;
+	}
+
+	if (on) {
+		if (regulator_enable(mhl_usb_hs_switch))
+			pr_err("unable to enable mhl_usb_hs_switch\n");
+	} else {
+		regulator_disable(mhl_usb_hs_switch);
+	}
+}
+
+static int ulpi_read(struct usb_phy *phy, u32 reg)
+{
+	struct msm_otg *motg = container_of(phy, struct msm_otg, phy);
+	int cnt = 0;
+
+	if (motg->pdata->phy_type == CI_45NM_INTEGRATED_PHY)
+		udelay(200);
+
+	/* initiate read operation */
+	writel(ULPI_RUN | ULPI_READ | ULPI_ADDR(reg),
+	       USB_ULPI_VIEWPORT);
+
+	/* wait for completion */
+	while (cnt < ULPI_IO_TIMEOUT_USEC) {
+		if (!(readl(USB_ULPI_VIEWPORT) & ULPI_RUN))
+			break;
+		udelay(1);
+		cnt++;
+	}
+
+	if (cnt >= ULPI_IO_TIMEOUT_USEC) {
+		USBH_WARNING("ulpi_read: timeout %08x reg: 0x%x\n",
+			readl(USB_ULPI_VIEWPORT), reg);
+		return -ETIMEDOUT;
+	}
+	return ULPI_DATA_READ(readl(USB_ULPI_VIEWPORT));
+}
+
+static int ulpi_write(struct usb_phy *phy, u32 val, u32 reg)
+{
+	struct msm_otg *motg = container_of(phy, struct msm_otg, phy);
+	int cnt = 0;
+
+	if (motg->pdata->phy_type == CI_45NM_INTEGRATED_PHY)
+		udelay(200);
+
+	/* initiate write operation */
+	writel(ULPI_RUN | ULPI_WRITE |
+	       ULPI_ADDR(reg) | ULPI_DATA(val),
+	       USB_ULPI_VIEWPORT);
+
+	/* wait for completion */
+	while (cnt < ULPI_IO_TIMEOUT_USEC) {
+		if (!(readl(USB_ULPI_VIEWPORT) & ULPI_RUN))
+			break;
+		udelay(1);
+		cnt++;
+	}
+
+	if (cnt >= ULPI_IO_TIMEOUT_USEC) {
+		USBH_WARNING("ulpi_write: timeout reg: 0x%x ,val: 0x%x\n", reg, val);
+		return -ETIMEDOUT;
+	}
+	return 0;
+}
+
+ssize_t otg_show_usb_phy_setting(char *buf)
+{
+	struct msm_otg *motg = the_msm_otg;
+	unsigned length = 0;
+	int i;
+
+	for (i = 0; i <= 0x14; i++)
+		length += sprintf(buf + length, "0x%x = 0x%x\n",
+					i, ulpi_read(&motg->phy, i));
+
+	for (i = 0x30; i <= 0x37; i++)
+		length += sprintf(buf + length, "0x%x = 0x%x\n",
+					i, ulpi_read(&motg->phy, i));
+
+	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY) {
+		for (i = 0x80; i <= 0x83; i++)
+			length += sprintf(buf + length, "0x%x = 0x%x\n",
+						i, ulpi_read(&motg->phy, i));
+	}
+
+	return length;
+}
+
+ssize_t otg_store_usb_phy_setting(const char *buf, size_t count)
+{
+	struct msm_otg *motg = the_msm_otg;
+	char *token[10];
+	unsigned long reg;
+	unsigned long value;
+	int i;
+
+	USBH_INFO("%s\n", buf);
+	for (i = 0; i < 2; i++)
+		token[i] = strsep((char **)&buf, " ");
+
+	i = strict_strtoul(token[0], 16, (unsigned long *)&reg);
+	if (i < 0) {
+		USBH_ERR("%s: reg %d\n", __func__, i);
+		return 0;
+	}
+	i = strict_strtoul(token[1], 16, (unsigned long *)&value);
+	if (i < 0) {
+		USBH_ERR("%s: value %d\n", __func__, i);
+		return 0;
+	}
+	USBH_INFO("Set 0x%02lx = 0x%02lx\n", reg, value);
+
+	ulpi_write(&motg->phy, value, reg);
+
+	return count;
+}
+
+static struct usb_phy_io_ops msm_otg_io_ops = {
+	.read = ulpi_read,
+	.write = ulpi_write,
+};
+
+static void ulpi_init(struct msm_otg *motg)
+{
+	struct msm_otg_platform_data *pdata = motg->pdata;
+	int *seq = pdata->phy_init_seq;
+
+	if (!seq)
+		return;
+
+	while (seq[0] >= 0) {
+		USBH_INFO("ulpi: write 0x%02x to 0x%02x\n",
+				seq[0], seq[1]);
+		ulpi_write(&motg->phy, seq[0], seq[1]);
+		seq += 2;
+	}
+}
+
+static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)
+{
+	int ret;
+
+	if (IS_ERR(motg->clk))
+		return 0;
+
+	if (assert) {
+		ret = clk_reset(motg->clk, CLK_RESET_ASSERT);
+		if (ret)
+			USBH_ERR("usb hs_clk assert failed\n");
+	} else {
+		ret = clk_reset(motg->clk, CLK_RESET_DEASSERT);
+		if (ret)
+			USBH_ERR("usb hs_clk deassert failed\n");
+	}
+	return ret;
+}
+
+static int msm_otg_phy_clk_reset(struct msm_otg *motg)
+{
+	int ret;
+
+	if (IS_ERR(motg->phy_reset_clk))
+		return 0;
+
+	ret = clk_reset(motg->phy_reset_clk, CLK_RESET_ASSERT);
+	if (ret) {
+		USBH_ERR("usb phy clk assert failed\n");
+		return ret;
+	}
+	usleep_range(10000, 12000);
+	ret = clk_reset(motg->phy_reset_clk, CLK_RESET_DEASSERT);
+	if (ret)
+		USBH_ERR("usb phy clk deassert failed\n");
+	return ret;
+}
+
+static int msm_otg_phy_reset(struct msm_otg *motg)
+{
+	u32 val;
+	int ret;
+	int retries;
+
+	ret = msm_otg_link_clk_reset(motg, 1);
+	if (ret)
+		return ret;
+	ret = msm_otg_phy_clk_reset(motg);
+	if (ret)
+		return ret;
+	ret = msm_otg_link_clk_reset(motg, 0);
+	if (ret)
+		return ret;
+
+	val = readl(USB_PORTSC) & ~PORTSC_PTS_MASK;
+	writel(val | PORTSC_PTS_ULPI, USB_PORTSC);
+
+	for (retries = 3; retries > 0; retries--) {
+		ret = ulpi_write(&motg->phy, ULPI_FUNC_CTRL_SUSPENDM,
+				ULPI_CLR(ULPI_FUNC_CTRL));
+		if (!ret)
+			break;
+		ret = msm_otg_phy_clk_reset(motg);
+		if (ret)
+			return ret;
+	}
+	if (!retries)
+		return -ETIMEDOUT;
+
+	/* This reset calibrates the phy, if the above write succeeded */
+	ret = msm_otg_phy_clk_reset(motg);
+	if (ret)
+		return ret;
+
+	for (retries = 3; retries > 0; retries--) {
+		ret = ulpi_read(&motg->phy, ULPI_DEBUG);
+		if (ret != -ETIMEDOUT)
+			break;
+		ret = msm_otg_phy_clk_reset(motg);
+		if (ret)
+			return ret;
+	}
+	if (!retries)
+		return -ETIMEDOUT;
+
+	USBH_INFO("phy_reset: success\n");
+	return 0;
+}
+
+#define LINK_RESET_TIMEOUT_USEC		(250 * 1000)
+static int msm_otg_link_reset(struct msm_otg *motg)
+{
+	int cnt = 0;
+
+	writel_relaxed(USBCMD_RESET, USB_USBCMD);
+	while (cnt < LINK_RESET_TIMEOUT_USEC) {
+		if (!(readl_relaxed(USB_USBCMD) & USBCMD_RESET))
+			break;
+		udelay(1);
+		cnt++;
+	}
+	if (cnt >= LINK_RESET_TIMEOUT_USEC)
+		return -ETIMEDOUT;
+
+	/* select ULPI phy */
+	writel_relaxed(0x80000000, USB_PORTSC);
+	writel_relaxed(0x0, USB_AHBBURST);
+	writel_relaxed(0x08, USB_AHBMODE);
+
+	return 0;
+}
+
+static int msm_otg_reset(struct usb_phy *phy)
+{
+	struct msm_otg *motg = container_of(phy, struct msm_otg, phy);
+	struct msm_otg_platform_data *pdata = motg->pdata;
+	int ret;
+	u32 val = 0;
+	u32 ulpi_val = 0;
+	USBH_INFO("%s\n", __func__);
+
+	/*
+	 * USB PHY and Link reset also reset the USB BAM.
+	 * Thus perform reset operation only once to avoid
+	 * USB BAM reset on other cases e.g. USB cable disconnections.
+	 */
+	if (pdata->disable_reset_on_disconnect) {
+		if (motg->reset_counter)
+			return 0;
+		else
+			motg->reset_counter++;
+	}
+
+	if (!IS_ERR(motg->clk))
+		clk_prepare_enable(motg->clk);
+	ret = msm_otg_phy_reset(motg);
+	if (ret) {
+		USBH_ERR("phy_reset failed\n");
+		return ret;
+	}
+
+	/* suppress id signal from phy */
+	if (readl(USB_OTGSC) & OTGSC_IDPU)
+		writel(readl(USB_OTGSC) & ~OTGSC_IDPU, USB_OTGSC);
+
+	aca_id_turned_on = false;
+	ret = msm_otg_link_reset(motg);
+	if (ret) {
+		dev_err(phy->dev, "link reset failed\n");
+		return ret;
+	}
+	msleep(100);
+
+	ulpi_init(motg);
+
+	/* Ensure that RESET operation is completed before turning off clock */
+	mb();
+
+	if (!IS_ERR(motg->clk))
+		clk_disable_unprepare(motg->clk);
+
+	if (pdata->otg_control == OTG_PHY_CONTROL) {
+		val = readl_relaxed(USB_OTGSC);
+		if (pdata->mode == USB_OTG) {
+			ulpi_val = ULPI_INT_IDGRD | ULPI_INT_SESS_VALID;
+			val |= OTGSC_IDIE | OTGSC_BSVIE;
+		} else if (pdata->mode == USB_PERIPHERAL) {
+			ulpi_val = ULPI_INT_SESS_VALID;
+			val |= OTGSC_BSVIE;
+		}
+		writel_relaxed(val, USB_OTGSC);
+		ulpi_write(phy, ulpi_val, ULPI_USB_INT_EN_RISE);
+		ulpi_write(phy, ulpi_val, ULPI_USB_INT_EN_FALL);
+	} else if (pdata->otg_control == OTG_PMIC_CONTROL) {
+		ulpi_write(phy, OTG_COMP_DISABLE,
+			ULPI_SET(ULPI_PWR_CLK_MNG_REG));
+		/* Enable PMIC pull-up */
+		pm8xxx_usb_id_pullup(1);
+	}
+
+	return 0;
+}
+
+static const char *timer_string(int bit)
+{
+	switch (bit) {
+	case A_WAIT_VRISE:		return "a_wait_vrise";
+	case A_WAIT_VFALL:		return "a_wait_vfall";
+	case B_SRP_FAIL:		return "b_srp_fail";
+	case A_WAIT_BCON:		return "a_wait_bcon";
+	case A_AIDL_BDIS:		return "a_aidl_bdis";
+	case A_BIDL_ADIS:		return "a_bidl_adis";
+	case B_ASE0_BRST:		return "b_ase0_brst";
+	case A_TST_MAINT:		return "a_tst_maint";
+	case B_TST_SRP:			return "b_tst_srp";
+	case B_TST_CONFIG:		return "b_tst_config";
+	default:			return "UNDEFINED";
+	}
+}
+
+static enum hrtimer_restart msm_otg_timer_func(struct hrtimer *hrtimer)
+{
+	struct msm_otg *motg = container_of(hrtimer, struct msm_otg, timer);
+
+	switch (motg->active_tmout) {
+	case A_WAIT_VRISE:
+		/* TODO: use vbus_vld interrupt */
+		set_bit(A_VBUS_VLD, &motg->inputs);
+		break;
+	case A_TST_MAINT:
+		/* OTG PET: End session after TA_TST_MAINT */
+		set_bit(A_BUS_DROP, &motg->inputs);
+		break;
+	case B_TST_SRP:
+		/*
+		 * OTG PET: Initiate SRP after TB_TST_SRP of
+		 * previous session end.
+		 */
+		set_bit(B_BUS_REQ, &motg->inputs);
+		break;
+	case B_TST_CONFIG:
+		clear_bit(A_CONN, &motg->inputs);
+		break;
+	default:
+		set_bit(motg->active_tmout, &motg->tmouts);
+	}
+
+	pr_debug("expired %s timer\n", timer_string(motg->active_tmout));
+	queue_work(system_nrt_wq, &motg->sm_work);
+	return HRTIMER_NORESTART;
+}
+
+static void msm_otg_del_timer(struct msm_otg *motg)
+{
+	int bit = motg->active_tmout;
+
+	pr_debug("deleting %s timer. remaining %lld msec\n", timer_string(bit),
+			div_s64(ktime_to_us(hrtimer_get_remaining(
+					&motg->timer)), 1000));
+	hrtimer_cancel(&motg->timer);
+	clear_bit(bit, &motg->tmouts);
+}
+
+static void msm_otg_start_timer(struct msm_otg *motg, int time, int bit)
+{
+	clear_bit(bit, &motg->tmouts);
+	motg->active_tmout = bit;
+	pr_debug("starting %s timer\n", timer_string(bit));
+	hrtimer_start(&motg->timer,
+			ktime_set(time / 1000, (time % 1000) * 1000000),
+			HRTIMER_MODE_REL);
+}
+
+static void msm_otg_init_timer(struct msm_otg *motg)
+{
+	hrtimer_init(&motg->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+	motg->timer.function = msm_otg_timer_func;
+}
+
+static int msm_otg_start_hnp(struct usb_otg *otg)
+{
+	struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy);
+
+	if (otg->phy->state != OTG_STATE_A_HOST) {
+		pr_err("HNP can not be initiated in %s state\n",
+				otg_state_string(otg->phy->state));
+		return -EINVAL;
+	}
+
+	pr_debug("A-Host: HNP initiated\n");
+	clear_bit(A_BUS_REQ, &motg->inputs);
+	queue_work(system_nrt_wq, &motg->sm_work);
+	return 0;
+}
+
+static int msm_otg_start_srp(struct usb_otg *otg)
+{
+	struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy);
+	u32 val;
+	int ret = 0;
+
+	if (otg->phy->state != OTG_STATE_B_IDLE) {
+		pr_err("SRP can not be initiated in %s state\n",
+				otg_state_string(otg->phy->state));
+		ret = -EINVAL;
+		goto out;
+	}
+
+	if ((jiffies - motg->b_last_se0_sess) < msecs_to_jiffies(TB_SRP_INIT)) {
+		pr_debug("initial conditions of SRP are not met. Try again"
+				"after some time\n");
+		ret = -EAGAIN;
+		goto out;
+	}
+
+	pr_debug("B-Device SRP started\n");
+
+	/*
+	 * PHY won't pull D+ high unless it detects Vbus valid.
+	 * Since by definition, SRP is only done when Vbus is not valid,
+	 * software work-around needs to be used to spoof the PHY into
+	 * thinking it is valid. This can be done using the VBUSVLDEXTSEL and
+	 * VBUSVLDEXT register bits.
+	 */
+	ulpi_write(otg->phy, 0x03, 0x97);
+	/*
+	 * Harware auto assist data pulsing: Data pulse is given
+	 * for 7msec; wait for vbus
+	 */
+	val = readl_relaxed(USB_OTGSC);
+	writel_relaxed((val & ~OTGSC_INTSTS_MASK) | OTGSC_HADP, USB_OTGSC);
+
+	/* VBUS plusing is obsoleted in OTG 2.0 supplement */
+out:
+	return ret;
+}
+
+static void msm_otg_host_hnp_enable(struct usb_otg *otg, bool enable)
+{
+	struct usb_hcd *hcd = bus_to_hcd(otg->host);
+	struct usb_device *rhub = otg->host->root_hub;
+
+	if (enable) {
+		pm_runtime_disable(&rhub->dev);
+		rhub->state = USB_STATE_NOTATTACHED;
+		hcd->driver->bus_suspend(hcd);
+		clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+	} else {
+		usb_remove_hcd(hcd);
+		msm_otg_reset(otg->phy);
+		usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
+	}
+}
+
+static int msm_otg_set_suspend(struct usb_phy *phy, int suspend)
+{
+	struct msm_otg *motg = container_of(phy, struct msm_otg, phy);
+
+	if (aca_enabled() || (test_bit(ID, &motg->inputs) &&
+				 !test_bit(ID_A, &motg->inputs)))
+		return 0;
+
+	if (atomic_read(&motg->in_lpm) == suspend)
+		return 0;
+
+	if (suspend) {
+		switch (phy->state) {
+		case OTG_STATE_A_WAIT_BCON:
+			if (TA_WAIT_BCON > 0)
+				break;
+			/* fall through */
+		case OTG_STATE_A_HOST:
+			pr_debug("host bus suspend\n");
+			clear_bit(A_BUS_REQ, &motg->inputs);
+			queue_work(system_nrt_wq, &motg->sm_work);
+			break;
+		case OTG_STATE_B_PERIPHERAL:
+			pr_debug("peripheral bus suspend\n");
+			if (!(motg->caps & ALLOW_LPM_ON_DEV_SUSPEND))
+				break;
+			set_bit(A_BUS_SUSPEND, &motg->inputs);
+			queue_work(system_nrt_wq, &motg->sm_work);
+			break;
+
+		default:
+			break;
+		}
+	} else {
+		switch (phy->state) {
+		case OTG_STATE_A_SUSPEND:
+			/* Remote wakeup or resume */
+			set_bit(A_BUS_REQ, &motg->inputs);
+			phy->state = OTG_STATE_A_HOST;
+
+			/* ensure hardware is not in low power mode */
+			pm_runtime_resume(phy->dev);
+			break;
+		case OTG_STATE_B_PERIPHERAL:
+			pr_debug("peripheral bus resume\n");
+			if (!(motg->caps & ALLOW_LPM_ON_DEV_SUSPEND))
+				break;
+			clear_bit(A_BUS_SUSPEND, &motg->inputs);
+			queue_work(system_nrt_wq, &motg->sm_work);
+			break;
+		default:
+			break;
+		}
+	}
+	return 0;
+}
+
+#define PHY_SUSPEND_TIMEOUT_USEC	(500 * 1000)
+#define PHY_RESUME_TIMEOUT_USEC	(100 * 1000)
+
+#ifdef CONFIG_PM_SLEEP
+static int msm_otg_suspend(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	struct usb_bus *bus = phy->otg->host;
+	struct usb_otg *otg = motg->phy.otg;
+	struct msm_otg_platform_data *pdata = motg->pdata;
+	int cnt = 0;
+	bool host_bus_suspend, device_bus_suspend, dcp;
+	u32 phy_ctrl_val = 0, cmd_val;
+	unsigned ret;
+	u32 portsc;
+
+	if (atomic_read(&motg->in_lpm))
+		return 0;
+
+	USBH_INFO("%s\n", __func__);
+
+	disable_irq(motg->irq);
+	host_bus_suspend = phy->otg->host && !test_bit(ID, &motg->inputs);
+	device_bus_suspend = phy->otg->gadget && test_bit(ID, &motg->inputs) &&
+		test_bit(A_BUS_SUSPEND, &motg->inputs) &&
+		motg->caps & ALLOW_LPM_ON_DEV_SUSPEND;
+	dcp = motg->chg_type == USB_DCP_CHARGER;
+	/*
+	 * Chipidea 45-nm PHY suspend sequence:
+	 *
+	 * Interrupt Latch Register auto-clear feature is not present
+	 * in all PHY versions. Latch register is clear on read type.
+	 * Clear latch register to avoid spurious wakeup from
+	 * low power mode (LPM).
+	 *
+	 * PHY comparators are disabled when PHY enters into low power
+	 * mode (LPM). Keep PHY comparators ON in LPM only when we expect
+	 * VBUS/Id notifications from USB PHY. Otherwise turn off USB
+	 * PHY comparators. This save significant amount of power.
+	 *
+	 * PLL is not turned off when PHY enters into low power mode (LPM).
+	 * Disable PLL for maximum power savings.
+	 */
+
+	if (motg->pdata->phy_type == CI_45NM_INTEGRATED_PHY) {
+		ulpi_read(phy, 0x14);
+		if (pdata->otg_control == OTG_PHY_CONTROL)
+			ulpi_write(phy, 0x01, 0x30);
+		ulpi_write(phy, 0x08, 0x09);
+	}
+
+
+	/* Set the PHCD bit, only if it is not set by the controller.
+	 * PHY may take some time or even fail to enter into low power
+	 * mode (LPM). Hence poll for 500 msec and reset the PHY and link
+	 * in failure case.
+	 */
+	portsc = readl_relaxed(USB_PORTSC);
+	if (!(portsc & PORTSC_PHCD)) {
+		writel_relaxed(portsc | PORTSC_PHCD,
+				USB_PORTSC);
+		while (cnt < PHY_SUSPEND_TIMEOUT_USEC) {
+			if (readl_relaxed(USB_PORTSC) & PORTSC_PHCD)
+				break;
+			udelay(1);
+			cnt++;
+		}
+	}
+
+	if (cnt >= PHY_SUSPEND_TIMEOUT_USEC) {
+		USBH_WARNING("Unable to suspend PHY\n");
+		msm_otg_reset(phy);
+		enable_irq(motg->irq);
+		return -ETIMEDOUT;
+	}
+
+	/*
+	 * PHY has capability to generate interrupt asynchronously in low
+	 * power mode (LPM). This interrupt is level triggered. So USB IRQ
+	 * line must be disabled till async interrupt enable bit is cleared
+	 * in USBCMD register. Assert STP (ULPI interface STOP signal) to
+	 * block data communication from PHY.
+	 *
+	 * PHY retention mode is disallowed while entering to LPM with wall
+	 * charger connected.  But PHY is put into suspend mode. Hence
+	 * enable asynchronous interrupt to detect charger disconnection when
+	 * PMIC notifications are unavailable.
+	 */
+	if (otg->phy->state == OTG_STATE_A_WAIT_BCON) {
+		USBH_INFO("%s:enable the ASYNC_INTR\n", __func__);
+		cmd_val = readl_relaxed(USB_USBCMD);
+		if (host_bus_suspend || device_bus_suspend ||
+				(motg->pdata->otg_control == OTG_PHY_CONTROL && dcp))
+			cmd_val |= ASYNC_INTR_CTRL | ULPI_STP_CTRL;
+		else
+			cmd_val |= ULPI_STP_CTRL;
+		writel_relaxed(cmd_val, USB_USBCMD);
+	} else {
+		/* Remove ASYNC_INTR_CTRL to avoid random wakeup */
+		/* for normal case*/
+		writel(readl(USB_USBCMD) | ULPI_STP_CTRL, USB_USBCMD);
+	}
+	/*
+	 * BC1.2 spec mandates PD to enable VDP_SRC when charging from DCP.
+	 * PHY retention and collapse can not happen with VDP_SRC enabled.
+	 */
+	if (motg->caps & ALLOW_PHY_RETENTION && !host_bus_suspend &&
+		!device_bus_suspend && !dcp) {
+		phy_ctrl_val = readl_relaxed(USB_PHY_CTRL);
+		if (motg->pdata->otg_control == OTG_PHY_CONTROL)
+			/* Enable PHY HV interrupts to wake MPM/Link */
+			phy_ctrl_val |=
+				(PHY_IDHV_INTEN | PHY_OTGSESSVLDHV_INTEN);
+		/* for 8064 MPM USB PHY ID pin issue. Disable level shift*/
+		phy_ctrl_val &= ~(1<<10);
+		writel_relaxed(phy_ctrl_val & ~PHY_RETEN, USB_PHY_CTRL);
+		motg->lpm_flags |= PHY_RETENTIONED;
+	}
+
+	/* Ensure that above operation is completed before turning off clocks */
+	mb();
+	if (!motg->pdata->core_clk_always_on_workaround) {
+		clk_disable_unprepare(motg->pclk);
+		clk_disable_unprepare(motg->core_clk);
+	}
+
+	/* usb phy no more require TCXO clock, hence vote for TCXO disable */
+	if (!host_bus_suspend) {
+		ret = msm_xo_mode_vote(motg->xo_handle, MSM_XO_MODE_OFF);
+		if (ret)
+			dev_err(phy->dev, "%s failed to devote for "
+				"TCXO D0 buffer%d\n", __func__, ret);
+		else
+			motg->lpm_flags |= XO_SHUTDOWN;
+	}
+
+	if (motg->caps & ALLOW_PHY_POWER_COLLAPSE &&
+			!host_bus_suspend && !dcp) {
+		msm_hsusb_ldo_enable(motg, 0);
+		motg->lpm_flags |= PHY_PWR_COLLAPSED;
+	}
+
+	if (motg->lpm_flags & PHY_RETENTIONED) {
+		msm_hsusb_config_vddcx(0);
+		msm_hsusb_mhl_switch_enable(motg, 0);
+	}
+
+	if (device_may_wakeup(phy->dev)) {
+		enable_irq_wake(motg->irq);
+		if (motg->pdata->pmic_id_irq)
+			enable_irq_wake(motg->pdata->pmic_id_irq);
+	}
+	if (bus)
+		clear_bit(HCD_FLAG_HW_ACCESSIBLE, &(bus_to_hcd(bus))->flags);
+
+	atomic_set(&motg->in_lpm, 1);
+	enable_irq(motg->irq);
+
+	USBH_INFO("USB in low power mode\n");
+
+	return 0;
+}
+
+/*HTC_WIFI_START*/
+int msm_otg_setclk(int on)
+{
+    if (on) {
+        if (!the_msm_otg->pdata->core_clk_always_on_workaround) {
+            clk_prepare_enable(the_msm_otg->core_clk);
+            //clk_prepare_enable(the_msm_otg->pclk);
+        }
+    }
+    else {
+        if (!the_msm_otg->pdata->core_clk_always_on_workaround) {
+            clk_disable_unprepare(the_msm_otg->core_clk);
+            //clk_disable_unprepare(the_msm_otg->pclk);
+        }
+    }
+    return 0;
+}
+EXPORT_SYMBOL(msm_otg_setclk);
+/*HTC_WIFI_END*/
+
+static int msm_otg_resume(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	struct usb_bus *bus = phy->otg->host;
+	struct usb_otg *otg = motg->phy.otg;
+	int cnt = 0;
+	unsigned temp;
+	u32 phy_ctrl_val = 0;
+	unsigned ret;
+
+	if (!atomic_read(&motg->in_lpm))
+		return 0;
+
+	USBH_INFO("%s\n", __func__);
+	/* Vote for TCXO when waking up the phy */
+	if (motg->lpm_flags & XO_SHUTDOWN) {
+		ret = msm_xo_mode_vote(motg->xo_handle, MSM_XO_MODE_ON);
+		if (ret)
+			dev_err(phy->dev, "%s failed to vote for "
+				"TCXO D0 buffer%d\n", __func__, ret);
+		motg->lpm_flags &= ~XO_SHUTDOWN;
+	}
+
+	if (!motg->pdata->core_clk_always_on_workaround) {
+		clk_prepare_enable(motg->core_clk);
+		clk_prepare_enable(motg->pclk);
+	}
+
+	if (motg->lpm_flags & PHY_PWR_COLLAPSED) {
+		msm_hsusb_ldo_enable(motg, 1);
+		motg->lpm_flags &= ~PHY_PWR_COLLAPSED;
+		USBH_DEBUG("exit phy power collapse...\n");
+	}
+
+	if (motg->lpm_flags & PHY_RETENTIONED) {
+		msm_hsusb_mhl_switch_enable(motg, 1);
+		msm_hsusb_config_vddcx(1);
+		phy_ctrl_val = readl_relaxed(USB_PHY_CTRL);
+		phy_ctrl_val |= PHY_RETEN;
+		if (motg->pdata->otg_control == OTG_PHY_CONTROL)
+			/* Disable PHY HV interrupts */
+			phy_ctrl_val &=
+				~(PHY_IDHV_INTEN | PHY_OTGSESSVLDHV_INTEN);
+		/* for 8064 MPM USB PHY ID pin issue. Disable level shift*/
+		phy_ctrl_val |= (1<<10);
+		writel_relaxed(phy_ctrl_val, USB_PHY_CTRL);
+		motg->lpm_flags &= ~PHY_RETENTIONED;
+	}
+
+	temp = readl(USB_USBCMD);
+	if (otg->phy->state != OTG_STATE_A_WAIT_BCON) {
+		USBH_INFO("%s:disable the ASYNC_INTR\n", __func__);
+		temp &= ~ASYNC_INTR_CTRL;
+	}
+	temp &= ~ULPI_STP_CTRL;
+	writel(temp, USB_USBCMD);
+
+	/*
+	 * PHY comes out of low power mode (LPM) in case of wakeup
+	 * from asynchronous interrupt.
+	 */
+	if (!(readl(USB_PORTSC) & PORTSC_PHCD))
+		goto skip_phy_resume;
+
+	writel(readl(USB_PORTSC) & ~PORTSC_PHCD, USB_PORTSC);
+	while (cnt < PHY_RESUME_TIMEOUT_USEC) {
+		if (!(readl(USB_PORTSC) & PORTSC_PHCD))
+			break;
+		udelay(1);
+		cnt++;
+	}
+
+	if (cnt >= PHY_RESUME_TIMEOUT_USEC) {
+		/*
+		 * This is a fatal error. Reset the link and
+		 * PHY. USB state can not be restored. Re-insertion
+		 * of USB cable is the only way to get USB working.
+		 */
+		USBH_ERR("Unable to resume USB."
+				"Re-plugin the cable\n");
+		msm_otg_reset(phy);
+	}
+
+skip_phy_resume:
+	if (device_may_wakeup(phy->dev)) {
+		disable_irq_wake(motg->irq);
+		if (motg->pdata->pmic_id_irq)
+			disable_irq_wake(motg->pdata->pmic_id_irq);
+	}
+	if (bus)
+		set_bit(HCD_FLAG_HW_ACCESSIBLE, &(bus_to_hcd(bus))->flags);
+
+	atomic_set(&motg->in_lpm, 0);
+
+	if (motg->async_int) {
+		motg->async_int = 0;
+		enable_irq(motg->irq);
+	}
+
+	USBH_INFO("USB exited from low power mode\n");
+
+	return 0;
+}
+#endif
+/*
+static int msm_otg_notify_host_mode(struct msm_otg *motg, bool host_mode)
+{
+	if (!psy)
+		goto psy_not_supported;
+
+	if (host_mode)
+		power_supply_set_scope(psy, POWER_SUPPLY_SCOPE_SYSTEM);
+	else
+		power_supply_set_scope(psy, POWER_SUPPLY_SCOPE_DEVICE);
+
+psy_not_supported:
+	dev_dbg(motg->phy.dev, "Power Supply doesn't support USB charger\n");
+	return -ENXIO;
+}
+*/
+static int msm_otg_notify_chg_type(struct msm_otg *motg)
+{
+	static int charger_type;
+	/*
+	 * TODO
+	 * Unify OTG driver charger types and power supply charger types
+	 */
+	if (charger_type == motg->chg_type)
+		return 0;
+
+	if (motg->chg_type == USB_SDP_CHARGER)
+		charger_type = POWER_SUPPLY_TYPE_USB;
+	else if (motg->chg_type == USB_CDP_CHARGER)
+		charger_type = POWER_SUPPLY_TYPE_USB_CDP;
+	else if (motg->chg_type == USB_DCP_CHARGER ||
+			motg->chg_type == USB_PROPRIETARY_CHARGER)
+		charger_type = POWER_SUPPLY_TYPE_USB_DCP;
+	else if ((motg->chg_type == USB_ACA_DOCK_CHARGER ||
+		motg->chg_type == USB_ACA_A_CHARGER ||
+		motg->chg_type == USB_ACA_B_CHARGER ||
+		motg->chg_type == USB_ACA_C_CHARGER))
+		charger_type = POWER_SUPPLY_TYPE_USB_ACA;
+	else
+		charger_type = POWER_SUPPLY_TYPE_BATTERY;
+
+	return pm8921_set_usb_power_supply_type(charger_type);
+}
+
+static int msm_otg_notify_power_supply(struct msm_otg *motg, unsigned mA)
+{
+
+	if (!psy)
+		goto psy_not_supported;
+
+	if (motg->cur_power == 0 && mA > 0) {
+		/* Enable charging */
+		if (power_supply_set_online(psy, true))
+			goto psy_not_supported;
+	} else if (motg->cur_power > 0 && mA == 0) {
+		/* Disable charging */
+		if (power_supply_set_online(psy, false))
+			goto psy_not_supported;
+		return 0;
+	}
+	/* Set max current limit */
+	if (power_supply_set_current_limit(psy, 1000*mA))
+		goto psy_not_supported;
+
+	return 0;
+
+psy_not_supported:
+	dev_dbg(motg->phy.dev, "Power Supply doesn't support USB charger\n");
+	return -ENXIO;
+}
+
+static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA)
+{
+	struct usb_gadget *g = motg->phy.otg->gadget;
+
+	if (g && g->is_a_peripheral)
+		return;
+
+	if ((motg->chg_type == USB_ACA_DOCK_CHARGER ||
+		motg->chg_type == USB_ACA_A_CHARGER ||
+		motg->chg_type == USB_ACA_B_CHARGER ||
+		motg->chg_type == USB_ACA_C_CHARGER) &&
+			mA > IDEV_ACA_CHG_LIMIT)
+		mA = IDEV_ACA_CHG_LIMIT;
+
+	if (msm_otg_notify_chg_type(motg))
+		dev_err(motg->phy.dev,
+			"Failed notifying %d charger type to PMIC\n",
+							motg->chg_type);
+
+	if (motg->cur_power == mA)
+		return;
+
+	dev_info(motg->phy.dev, "Avail curr from USB = %u\n", mA);
+
+	/*
+	 *  Use Power Supply API if supported, otherwise fallback
+	 *  to legacy pm8921 API.
+	 */
+	if (msm_otg_notify_power_supply(motg, mA))
+		pm8921_charger_vbus_draw(mA);
+
+	motg->cur_power = mA;
+}
+
+static void msm_otg_notify_usb_attached(void)
+{
+	struct msm_otg *motg = the_msm_otg;
+
+	if (motg->connect_type != CONNECT_TYPE_USB) {
+		motg->connect_type = CONNECT_TYPE_USB;
+		queue_work(motg->usb_wq, &motg->notifier_work);
+	}
+
+	motg->ac_detect_count = 0;
+	__cancel_delayed_work(&motg->ac_detect_work);
+}
+
+static int msm_otg_set_power(struct usb_phy *phy, unsigned mA)
+{
+	struct msm_otg *motg = container_of(phy, struct msm_otg, phy);
+
+	/*
+	 * Gadget driver uses set_power method to notify about the
+	 * available current based on suspend/configured states.
+	 *
+	 * IDEV_CHG can be drawn irrespective of suspend/un-configured
+	 * states when CDP/ACA is connected.
+	 */
+	if (motg->chg_type == USB_SDP_CHARGER)
+		msm_otg_notify_charger(motg, mA);
+
+	return 0;
+}
+
+static void msm_otg_start_host(struct usb_otg *otg, int on)
+{
+	struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy);
+	struct msm_otg_platform_data *pdata = motg->pdata;
+	struct usb_hcd *hcd;
+
+	if (!otg->host)
+		return;
+
+	hcd = bus_to_hcd(otg->host);
+
+	if (on) {
+		USBH_DEBUG("host on\n");
+
+		if (pdata->otg_control == OTG_PHY_CONTROL)
+			ulpi_write(otg->phy, OTG_COMP_DISABLE,
+				ULPI_SET(ULPI_PWR_CLK_MNG_REG));
+
+		/*
+		 * Some boards have a switch cotrolled by gpio
+		 * to enable/disable internal HUB. Enable internal
+		 * HUB before kicking the host.
+		 */
+		if (pdata->setup_gpio)
+			pdata->setup_gpio(OTG_STATE_A_HOST);
+		usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
+	} else {
+		USBH_DEBUG("host off\n");
+
+		usb_remove_hcd(hcd);
+		/* HCD core reset all bits of PORTSC. select ULPI phy */
+		writel_relaxed(0x80000000, USB_PORTSC);
+
+		if (pdata->setup_gpio)
+			pdata->setup_gpio(OTG_STATE_UNDEFINED);
+
+		if (pdata->otg_control == OTG_PHY_CONTROL)
+			ulpi_write(otg->phy, OTG_COMP_DISABLE,
+				ULPI_CLR(ULPI_PWR_CLK_MNG_REG));
+	}
+}
+
+static int msm_otg_usbdev_notify(struct notifier_block *self,
+			unsigned long action, void *priv)
+{
+	struct msm_otg *motg = container_of(self, struct msm_otg, usbdev_nb);
+	struct usb_otg *otg = motg->phy.otg;
+	struct usb_device *udev = priv;
+
+	if (action == USB_BUS_ADD || action == USB_BUS_REMOVE)
+		goto out;
+
+	if (udev->bus != otg->host)
+		goto out;
+	/*
+	 * Interested in devices connected directly to the root hub.
+	 * ACA dock can supply IDEV_CHG irrespective devices connected
+	 * on the accessory port.
+	 */
+	if (!udev->parent || udev->parent->parent ||
+			motg->chg_type == USB_ACA_DOCK_CHARGER)
+		goto out;
+
+	switch (action) {
+	case USB_DEVICE_ADD:
+		if (aca_enabled())
+			usb_disable_autosuspend(udev);
+		if (otg->phy->state == OTG_STATE_A_WAIT_BCON) {
+			pr_debug("B_CONN set\n");
+			set_bit(B_CONN, &motg->inputs);
+			msm_otg_del_timer(motg);
+			otg->phy->state = OTG_STATE_A_HOST;
+			/*
+			 * OTG PET: A-device must end session within
+			 * 10 sec after PET enumeration.
+			 */
+			if (udev->quirks & USB_QUIRK_OTG_PET)
+				msm_otg_start_timer(motg, TA_TST_MAINT,
+						A_TST_MAINT);
+		}
+		/* fall through */
+	case USB_DEVICE_CONFIG:
+		if (udev->actconfig)
+			motg->mA_port = udev->actconfig->desc.bMaxPower * 2;
+		else
+			motg->mA_port = IUNIT;
+		if (otg->phy->state == OTG_STATE_B_HOST)
+			msm_otg_del_timer(motg);
+		break;
+	case USB_DEVICE_REMOVE:
+		if ((otg->phy->state == OTG_STATE_A_HOST) ||
+			(otg->phy->state == OTG_STATE_A_SUSPEND)) {
+			pr_debug("B_CONN clear\n");
+			clear_bit(B_CONN, &motg->inputs);
+			/*
+			 * OTG PET: A-device must end session after
+			 * PET disconnection if it is enumerated
+			 * with bcdDevice[0] = 1. USB core sets
+			 * bus->otg_vbus_off for us. clear it here.
+			 */
+			if (udev->bus->otg_vbus_off) {
+				udev->bus->otg_vbus_off = 0;
+				set_bit(A_BUS_DROP, &motg->inputs);
+			}
+			queue_work(system_nrt_wq, &motg->sm_work);
+		}
+	default:
+		break;
+	}
+	if (test_bit(ID_A, &motg->inputs))
+		msm_otg_notify_charger(motg, IDEV_ACA_CHG_MAX -
+				motg->mA_port);
+out:
+	return NOTIFY_OK;
+}
+
+static void msm_hsusb_vbus_power(struct msm_otg *motg, bool on)
+{
+	int ret;
+	static bool vbus_is_on;
+
+	if (vbus_is_on == on)
+		return;
+
+	if (motg->pdata->vbus_power) {
+		ret = motg->pdata->vbus_power(on);
+		if (!ret)
+			vbus_is_on = on;
+	} else {
+		/* send connect type to battery to enable boost 5v */
+		vbus_is_on = on;
+	}
+
+	if (on) {
+		motg->connect_type = CONNECT_TYPE_INTERNAL;
+		queue_work(motg->usb_wq, &motg->notifier_work);
+	} else {
+		motg->connect_type = CONNECT_TYPE_CLEAR;
+		queue_work(motg->usb_wq, &motg->notifier_work);
+	}
+	return;
+#if 0
+	if (!vbus_otg) {
+		pr_err("vbus_otg is NULL.");
+		return;
+	}
+
+	/*
+	 * if entering host mode tell the charger to not draw any current
+	 * from usb before turning on the boost.
+	 * if exiting host mode disable the boost before enabling to draw
+	 * current from the source.
+	 */
+	if (on) {
+		msm_otg_notify_host_mode(motg, on);
+		ret = regulator_enable(vbus_otg);
+		if (ret) {
+			pr_err("unable to enable vbus_otg\n");
+			return;
+		}
+		vbus_is_on = true;
+	} else {
+		ret = regulator_disable(vbus_otg);
+		if (ret) {
+			pr_err("unable to disable vbus_otg\n");
+			return;
+		}
+		msm_otg_notify_host_mode(motg, on);
+		vbus_is_on = false;
+	}
+#endif
+}
+
+static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
+{
+	struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy);
+	struct usb_hcd *hcd;
+
+	/*
+	 * Fail host registration if this board can support
+	 * only peripheral configuration.
+	 */
+	if (motg->pdata->mode == USB_PERIPHERAL) {
+		USBH_INFO("Host mode is not supported\n");
+		return -ENODEV;
+	}
+/*
+	if (!motg->pdata->vbus_power && host) {
+		vbus_otg = devm_regulator_get(motg->phy.dev, "vbus_otg");
+		if (IS_ERR(vbus_otg)) {
+			pr_err("Unable to get vbus_otg\n");
+			return -ENODEV;
+		}
+	}
+*/
+
+	if (!host) {
+		USB_WARNING("%s: no host\n", __func__);
+		if (otg->phy->state == OTG_STATE_A_HOST) {
+			pm_runtime_get_sync(otg->phy->dev);
+			usb_unregister_notify(&motg->usbdev_nb);
+			msm_otg_start_host(otg, 0);
+			msm_hsusb_vbus_power(motg, 0);
+			otg->host = NULL;
+			otg->phy->state = OTG_STATE_UNDEFINED;
+			queue_work(system_nrt_wq, &motg->sm_work);
+		} else {
+			otg->host = NULL;
+		}
+
+		return 0;
+	}
+
+	hcd = bus_to_hcd(host);
+	hcd->power_budget = motg->pdata->power_budget;
+
+#ifdef CONFIG_USB_OTG
+	host->otg_port = 1;
+#endif
+	motg->usbdev_nb.notifier_call = msm_otg_usbdev_notify;
+	usb_register_notify(&motg->usbdev_nb);
+	otg->host = host;
+	USBH_DEBUG("host driver registered w/ tranceiver\n");
+
+	/*
+	 * Kick the state machine work, if peripheral is not supported
+	 * or peripheral is already registered with us.
+	 */
+	if (motg->pdata->mode == USB_HOST || otg->gadget) {
+		USB_WARNING("host only, otg->gadget exist\n");
+		pm_runtime_get_sync(otg->phy->dev);
+		queue_work(system_nrt_wq, &motg->sm_work);
+	}
+
+	return 0;
+}
+
+static void msm_otg_start_peripheral(struct usb_otg *otg, int on)
+{
+	int ret;
+	struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy);
+	struct msm_otg_platform_data *pdata = motg->pdata;
+
+	if (!otg->gadget)
+		return;
+
+	if (on) {
+		USBH_DEBUG("gadget on\n");
+		/* FIXME: hold a wake_lock here... */
+		wake_lock(&motg->wlock);
+		/*
+		 * Some boards have a switch cotrolled by gpio
+		 * to enable/disable internal HUB. Disable internal
+		 * HUB before kicking the gadget.
+		 */
+		if (pdata->setup_gpio)
+			pdata->setup_gpio(OTG_STATE_B_PERIPHERAL);
+
+		/* Configure BUS performance parameters for MAX bandwidth */
+		if (motg->bus_perf_client && debug_bus_voting_enabled) {
+			ret = msm_bus_scale_client_update_request(
+					motg->bus_perf_client, 1);
+			if (ret)
+				dev_err(motg->phy.dev, "%s: Failed to vote for "
+					   "bus bandwidth %d\n", __func__, ret);
+		}
+		usb_gadget_vbus_connect(otg->gadget);
+	} else {
+		USBH_DEBUG("gadget off\n");
+		usb_gadget_vbus_disconnect(otg->gadget);
+		/* Configure BUS performance parameters to default */
+		if (motg->bus_perf_client) {
+			ret = msm_bus_scale_client_update_request(
+					motg->bus_perf_client, 0);
+			if (ret)
+				dev_err(motg->phy.dev, "%s: Failed to devote "
+					   "for bus bw %d\n", __func__, ret);
+		}
+		if (pdata->setup_gpio)
+			pdata->setup_gpio(OTG_STATE_UNDEFINED);
+		/* FIXME: release a wake lock here... */
+		wake_unlock(&motg->wlock);
+	}
+
+}
+
+static int msm_otg_set_peripheral(struct usb_otg *otg,
+			struct usb_gadget *gadget)
+{
+	struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy);
+
+	/*
+	 * Fail peripheral registration if this board can support
+	 * only host configuration.
+	 */
+	if (motg->pdata->mode == USB_HOST) {
+		USBH_ERR("Peripheral mode is not supported\n");
+		return -ENODEV;
+	}
+
+	if (!gadget) {
+		USB_WARNING("%s: no gadget\n", __func__);
+		if (otg->phy->state == OTG_STATE_B_PERIPHERAL) {
+			pm_runtime_get_sync(otg->phy->dev);
+			msm_otg_start_peripheral(otg, 0);
+			otg->gadget = NULL;
+			otg->phy->state = OTG_STATE_UNDEFINED;
+			queue_work(system_nrt_wq, &motg->sm_work);
+		} else {
+			otg->gadget = NULL;
+		}
+
+		return 0;
+	}
+	otg->gadget = gadget;
+	USBH_DEBUG("peripheral driver registered w/ tranceiver\n");
+
+	/*
+	 * Kick the state machine work, if host is not supported
+	 * or host is already registered with us.
+	 */
+	if (motg->pdata->mode == USB_PERIPHERAL || otg->host) {
+		USB_WARNING("peripheral only, otg->host exist\n");
+		pm_runtime_get_sync(otg->phy->dev);
+		queue_work(system_nrt_wq, &motg->sm_work);
+	}
+
+	return 0;
+}
+
+static bool msm_chg_aca_detect(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	u32 int_sts;
+	bool ret = false;
+
+	if (!aca_enabled())
+		goto out;
+
+	if (motg->pdata->phy_type == CI_45NM_INTEGRATED_PHY)
+		goto out;
+
+	int_sts = ulpi_read(phy, 0x87);
+	switch (int_sts & 0x1C) {
+	case 0x08:
+		if (!test_and_set_bit(ID_A, &motg->inputs)) {
+			USBH_DEBUG("ID_A\n");
+			motg->chg_type = USB_ACA_A_CHARGER;
+			motg->chg_state = USB_CHG_STATE_DETECTED;
+			clear_bit(ID_B, &motg->inputs);
+			clear_bit(ID_C, &motg->inputs);
+			set_bit(ID, &motg->inputs);
+			ret = true;
+		}
+		break;
+	case 0x0C:
+		if (!test_and_set_bit(ID_B, &motg->inputs)) {
+			USBH_DEBUG("ID_B\n");
+			motg->chg_type = USB_ACA_B_CHARGER;
+			motg->chg_state = USB_CHG_STATE_DETECTED;
+			clear_bit(ID_A, &motg->inputs);
+			clear_bit(ID_C, &motg->inputs);
+			set_bit(ID, &motg->inputs);
+			ret = true;
+		}
+		break;
+	case 0x10:
+		if (!test_and_set_bit(ID_C, &motg->inputs)) {
+			USBH_DEBUG("ID_C\n");
+			motg->chg_type = USB_ACA_C_CHARGER;
+			motg->chg_state = USB_CHG_STATE_DETECTED;
+			clear_bit(ID_A, &motg->inputs);
+			clear_bit(ID_B, &motg->inputs);
+			set_bit(ID, &motg->inputs);
+			ret = true;
+		}
+		break;
+	case 0x04:
+		if (test_and_clear_bit(ID, &motg->inputs)) {
+			dev_dbg(phy->dev, "ID_GND\n");
+			motg->chg_type = USB_INVALID_CHARGER;
+			motg->chg_state = USB_CHG_STATE_UNDEFINED;
+			clear_bit(ID_A, &motg->inputs);
+			clear_bit(ID_B, &motg->inputs);
+			clear_bit(ID_C, &motg->inputs);
+			ret = true;
+		}
+		break;
+	default:
+		ret = test_and_clear_bit(ID_A, &motg->inputs) |
+			test_and_clear_bit(ID_B, &motg->inputs) |
+			test_and_clear_bit(ID_C, &motg->inputs) |
+			!test_and_set_bit(ID, &motg->inputs);
+		if (ret) {
+			USBH_DEBUG("ID A/B/C/GND is no more\n");
+			motg->chg_type = USB_INVALID_CHARGER;
+			motg->chg_state = USB_CHG_STATE_UNDEFINED;
+		}
+	}
+out:
+	return ret;
+}
+
+static void msm_chg_enable_aca_det(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+
+	if (!aca_enabled())
+		return;
+
+	switch (motg->pdata->phy_type) {
+	case SNPS_28NM_INTEGRATED_PHY:
+		/* Disable ID_GND in link and PHY */
+		writel_relaxed(readl_relaxed(USB_OTGSC) & ~(OTGSC_IDPU |
+				OTGSC_IDIE), USB_OTGSC);
+		ulpi_write(phy, 0x01, 0x0C);
+		ulpi_write(phy, 0x10, 0x0F);
+		ulpi_write(phy, 0x10, 0x12);
+		/* Disable PMIC ID pull-up */
+		pm8xxx_usb_id_pullup(0);
+		/* Enable ACA ID detection */
+		ulpi_write(phy, 0x20, 0x85);
+		aca_id_turned_on = true;
+		break;
+	default:
+		break;
+	}
+}
+
+static void msm_chg_enable_aca_intr(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+
+	if (!aca_enabled())
+		return;
+
+	switch (motg->pdata->phy_type) {
+	case SNPS_28NM_INTEGRATED_PHY:
+		/* Enable ACA Detection interrupt (on any RID change) */
+		ulpi_write(phy, 0x01, 0x94);
+		break;
+	default:
+		break;
+	}
+}
+
+static void msm_chg_disable_aca_intr(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+
+	if (!aca_enabled())
+		return;
+
+	switch (motg->pdata->phy_type) {
+	case SNPS_28NM_INTEGRATED_PHY:
+		ulpi_write(phy, 0x01, 0x95);
+		break;
+	default:
+		break;
+	}
+}
+
+static bool msm_chg_check_aca_intr(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	bool ret = false;
+
+	if (!aca_enabled())
+		return ret;
+
+	switch (motg->pdata->phy_type) {
+	case SNPS_28NM_INTEGRATED_PHY:
+		if (ulpi_read(phy, 0x91) & 1) {
+			USBH_DEBUG("RID change\n");
+			ulpi_write(phy, 0x01, 0x92);
+			ret = msm_chg_aca_detect(motg);
+		}
+	default:
+		break;
+	}
+	return ret;
+}
+
+static void msm_otg_id_timer_func(unsigned long data)
+{
+	struct msm_otg *motg = (struct msm_otg *) data;
+
+	if (!aca_enabled())
+		return;
+
+	if (atomic_read(&motg->in_lpm)) {
+		dev_dbg(motg->phy.dev, "timer: in lpm\n");
+		return;
+	}
+
+	if (motg->phy.state == OTG_STATE_A_SUSPEND)
+		goto out;
+
+	if (msm_chg_check_aca_intr(motg)) {
+		dev_dbg(motg->phy.dev, "timer: aca work\n");
+		queue_work(system_nrt_wq, &motg->sm_work);
+	}
+
+out:
+	if (!test_bit(ID, &motg->inputs) || test_bit(ID_A, &motg->inputs))
+		mod_timer(&motg->id_timer, ID_TIMER_FREQ);
+}
+
+static bool msm_chg_check_secondary_det(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	u32 chg_det;
+	bool ret = false;
+
+	switch (motg->pdata->phy_type) {
+	case CI_45NM_INTEGRATED_PHY:
+		chg_det = ulpi_read(phy, 0x34);
+		ret = chg_det & (1 << 4);
+		break;
+	case SNPS_28NM_INTEGRATED_PHY:
+		chg_det = ulpi_read(phy, 0x87);
+		ret = chg_det & 1;
+		break;
+	default:
+		break;
+	}
+	return ret;
+}
+
+static void msm_chg_enable_secondary_det(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	u32 chg_det;
+
+	switch (motg->pdata->phy_type) {
+	case CI_45NM_INTEGRATED_PHY:
+		chg_det = ulpi_read(phy, 0x34);
+		/* Turn off charger block */
+		chg_det |= ~(1 << 1);
+		ulpi_write(phy, chg_det, 0x34);
+		udelay(20);
+		/* control chg block via ULPI */
+		chg_det &= ~(1 << 3);
+		ulpi_write(phy, chg_det, 0x34);
+		/* put it in host mode for enabling D- source */
+		chg_det &= ~(1 << 2);
+		ulpi_write(phy, chg_det, 0x34);
+		/* Turn on chg detect block */
+		chg_det &= ~(1 << 1);
+		ulpi_write(phy, chg_det, 0x34);
+		udelay(20);
+		/* enable chg detection */
+		chg_det &= ~(1 << 0);
+		ulpi_write(phy, chg_det, 0x34);
+		break;
+	case SNPS_28NM_INTEGRATED_PHY:
+		/*
+		 * Configure DM as current source, DP as current sink
+		 * and enable battery charging comparators.
+		 */
+		ulpi_write(phy, 0x8, 0x85);
+		ulpi_write(phy, 0x2, 0x85);
+		ulpi_write(phy, 0x1, 0x85);
+		break;
+	default:
+		break;
+	}
+}
+
+static bool msm_chg_check_primary_det(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	u32 chg_det;
+	bool ret = false;
+
+	switch (motg->pdata->phy_type) {
+	case CI_45NM_INTEGRATED_PHY:
+		chg_det = ulpi_read(phy, 0x34);
+		ret = chg_det & (1 << 4);
+		break;
+	case SNPS_28NM_INTEGRATED_PHY:
+		chg_det = ulpi_read(phy, 0x87);
+		ret = chg_det & 1;
+		/* Turn off VDP_SRC */
+		ulpi_write(phy, 0x3, 0x86);
+		msleep(20);
+		break;
+	default:
+		break;
+	}
+	return ret;
+}
+
+static void msm_chg_enable_primary_det(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	u32 chg_det;
+
+	switch (motg->pdata->phy_type) {
+	case CI_45NM_INTEGRATED_PHY:
+		chg_det = ulpi_read(phy, 0x34);
+		/* enable chg detection */
+		chg_det &= ~(1 << 0);
+		ulpi_write(phy, chg_det, 0x34);
+		break;
+	case SNPS_28NM_INTEGRATED_PHY:
+		/*
+		 * Configure DP as current source, DM as current sink
+		 * and enable battery charging comparators.
+		 */
+		ulpi_write(phy, 0x2, 0x85);
+		ulpi_write(phy, 0x1, 0x85);
+		break;
+	default:
+		break;
+	}
+}
+
+static bool msm_chg_check_dcd(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	u32 line_state;
+	bool ret = false;
+
+	switch (motg->pdata->phy_type) {
+	case CI_45NM_INTEGRATED_PHY:
+		line_state = ulpi_read(phy, 0x15);
+		ret = !(line_state & 1);
+		break;
+	case SNPS_28NM_INTEGRATED_PHY:
+		line_state = ulpi_read(phy, 0x87);
+		ret = line_state & 2;
+		break;
+	default:
+		break;
+	}
+	return ret;
+}
+
+static void msm_chg_disable_dcd(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	u32 chg_det;
+
+	switch (motg->pdata->phy_type) {
+	case CI_45NM_INTEGRATED_PHY:
+		chg_det = ulpi_read(phy, 0x34);
+		chg_det &= ~(1 << 5);
+		ulpi_write(phy, chg_det, 0x34);
+		break;
+	case SNPS_28NM_INTEGRATED_PHY:
+		ulpi_write(phy, 0x10, 0x86);
+		break;
+	default:
+		break;
+	}
+}
+
+static void msm_chg_enable_dcd(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	u32 chg_det;
+
+	switch (motg->pdata->phy_type) {
+	case CI_45NM_INTEGRATED_PHY:
+		chg_det = ulpi_read(phy, 0x34);
+		/* Turn on D+ current source */
+		chg_det |= (1 << 5);
+		ulpi_write(phy, chg_det, 0x34);
+		break;
+	case SNPS_28NM_INTEGRATED_PHY:
+		/* Data contact detection enable */
+		ulpi_write(phy, 0x10, 0x85);
+		break;
+	default:
+		break;
+	}
+}
+
+static void msm_chg_block_on(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	u32 func_ctrl, chg_det;
+
+	/* put the controller in non-driving mode */
+	func_ctrl = ulpi_read(phy, ULPI_FUNC_CTRL);
+	func_ctrl &= ~ULPI_FUNC_CTRL_OPMODE_MASK;
+	func_ctrl |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING;
+	ulpi_write(phy, func_ctrl, ULPI_FUNC_CTRL);
+
+	switch (motg->pdata->phy_type) {
+	case CI_45NM_INTEGRATED_PHY:
+		chg_det = ulpi_read(phy, 0x34);
+		/* control chg block via ULPI */
+		chg_det &= ~(1 << 3);
+		ulpi_write(phy, chg_det, 0x34);
+		/* Turn on chg detect block */
+		chg_det &= ~(1 << 1);
+		ulpi_write(phy, chg_det, 0x34);
+		udelay(20);
+		break;
+	case SNPS_28NM_INTEGRATED_PHY:
+		/* Clear charger detecting control bits */
+		ulpi_write(phy, 0x1F, 0x86);
+		/* Clear alt interrupt latch and enable bits */
+		ulpi_write(phy, 0x1F, 0x92);
+		ulpi_write(phy, 0x1F, 0x95);
+		udelay(100);
+		break;
+	default:
+		break;
+	}
+}
+
+static void msm_chg_block_off(struct msm_otg *motg)
+{
+	struct usb_phy *phy = &motg->phy;
+	u32 func_ctrl, chg_det;
+
+	switch (motg->pdata->phy_type) {
+	case CI_45NM_INTEGRATED_PHY:
+		chg_det = ulpi_read(phy, 0x34);
+		/* Turn off charger block */
+		chg_det |= ~(1 << 1);
+		ulpi_write(phy, chg_det, 0x34);
+		break;
+	case SNPS_28NM_INTEGRATED_PHY:
+		/* Clear charger detecting control bits */
+		ulpi_write(phy, 0x3F, 0x86);
+		/* Clear alt interrupt latch and enable bits */
+		ulpi_write(phy, 0x1F, 0x92);
+		ulpi_write(phy, 0x1F, 0x95);
+		break;
+	default:
+		break;
+	}
+
+	/* put the controller in normal mode */
+	func_ctrl = ulpi_read(phy, ULPI_FUNC_CTRL);
+	func_ctrl &= ~ULPI_FUNC_CTRL_OPMODE_MASK;
+	func_ctrl |= ULPI_FUNC_CTRL_OPMODE_NORMAL;
+	ulpi_write(phy, func_ctrl, ULPI_FUNC_CTRL);
+}
+
+static const char *chg_to_string(enum usb_chg_type chg_type)
+{
+	switch (chg_type) {
+	case USB_SDP_CHARGER:		return "USB_SDP_CHARGER";
+	case USB_DCP_CHARGER:		return "USB_DCP_CHARGER";
+	case USB_CDP_CHARGER:		return "USB_CDP_CHARGER";
+	case USB_ACA_A_CHARGER:		return "USB_ACA_A_CHARGER";
+	case USB_ACA_B_CHARGER:		return "USB_ACA_B_CHARGER";
+	case USB_ACA_C_CHARGER:		return "USB_ACA_C_CHARGER";
+	case USB_ACA_DOCK_CHARGER:	return "USB_ACA_DOCK_CHARGER";
+	case USB_PROPRIETARY_CHARGER:	return "USB_PROPRIETARY_CHARGER";
+	default:			return "INVALID_CHARGER";
+	}
+}
+
+#define MSM_CHG_DCD_POLL_TIME		(100 * HZ/1000) /* 100 msec */
+#define MSM_CHG_DCD_MAX_RETRIES		6 /* Tdcd_tmout = 6 * 100 msec */
+#define MSM_CHG_PRIMARY_DET_TIME	(50 * HZ/1000) /* TVDPSRC_ON */
+#define MSM_CHG_SECONDARY_DET_TIME	(50 * HZ/1000) /* TVDMSRC_ON */
+static void msm_chg_detect_work(struct work_struct *w)
+{
+	struct msm_otg *motg = container_of(w, struct msm_otg, chg_work.work);
+	struct usb_otg *otg = motg->phy.otg;
+	bool is_dcd = false, tmout, vout, is_aca;
+	u32 line_state, dm_vlgc;
+	unsigned long delay;
+
+	USBH_INFO("%s: state:%s\n", __func__,
+		chg_state_string(motg->chg_state));
+	if (otg->phy->state >= OTG_STATE_A_IDLE) {
+		motg->chg_state = USB_CHG_STATE_UNDEFINED;
+		USBH_INFO("%s: usb host, charger state:%s\n", __func__, chg_state_string(motg->chg_state));
+		if (motg->connect_type != CONNECT_TYPE_NONE) {
+			motg->connect_type = CONNECT_TYPE_NONE;
+			queue_work(motg->usb_wq, &motg->notifier_work);
+		}
+		return;
+	}
+	switch (motg->chg_state) {
+	case USB_CHG_STATE_UNDEFINED:
+		msm_chg_block_on(motg);
+		if (motg->pdata->enable_dcd)
+			msm_chg_enable_dcd(motg);
+		msm_chg_enable_aca_det(motg);
+		motg->chg_state = USB_CHG_STATE_WAIT_FOR_DCD;
+		motg->dcd_time = 0;
+		delay = MSM_CHG_DCD_POLL_TIME;
+		break;
+	case USB_CHG_STATE_WAIT_FOR_DCD:
+		is_aca = msm_chg_aca_detect(motg);
+		if (is_aca) {
+			/*
+			 * ID_A can be ACA dock too. continue
+			 * primary detection after DCD.
+			 */
+			if (test_bit(ID_A, &motg->inputs)) {
+				motg->chg_state = USB_CHG_STATE_WAIT_FOR_DCD;
+			} else {
+				delay = 0;
+				break;
+			}
+		}
+		if (motg->pdata->enable_dcd)
+			is_dcd = msm_chg_check_dcd(motg);
+		tmout = ++motg->dcd_time == MSM_CHG_DCD_MAX_RETRIES;
+		if (is_dcd || tmout) {
+			if (motg->pdata->enable_dcd)
+				msm_chg_disable_dcd(motg);
+			msm_chg_enable_primary_det(motg);
+			delay = MSM_CHG_PRIMARY_DET_TIME;
+			motg->chg_state = USB_CHG_STATE_DCD_DONE;
+		} else {
+			delay = MSM_CHG_DCD_POLL_TIME;
+		}
+		break;
+	case USB_CHG_STATE_DCD_DONE:
+		vout = msm_chg_check_primary_det(motg);
+		line_state = readl_relaxed(USB_PORTSC) & PORTSC_LS;
+		dm_vlgc = line_state & PORTSC_LS_DM;
+		if (vout && !dm_vlgc) { /* VDAT_REF < DM < VLGC */
+			if (test_bit(ID_A, &motg->inputs)) {
+				motg->chg_type = USB_ACA_DOCK_CHARGER;
+				motg->chg_state = USB_CHG_STATE_DETECTED;
+				delay = 0;
+				break;
+			}
+			if (line_state) { /* DP > VLGC */
+				motg->chg_type = USB_PROPRIETARY_CHARGER;
+				motg->chg_state = USB_CHG_STATE_DETECTED;
+				delay = 0;
+			} else {
+				msm_chg_enable_secondary_det(motg);
+				delay = MSM_CHG_SECONDARY_DET_TIME;
+				motg->chg_state = USB_CHG_STATE_PRIMARY_DONE;
+			}
+		} else { /* DM < VDAT_REF || DM > VLGC */
+			if (test_bit(ID_A, &motg->inputs)) {
+				motg->chg_type = USB_ACA_A_CHARGER;
+				motg->chg_state = USB_CHG_STATE_DETECTED;
+				delay = 0;
+				break;
+			}
+
+			if (line_state) /* DP > VLGC or/and DM > VLGC */
+				motg->chg_type = USB_PROPRIETARY_CHARGER;
+			else
+				motg->chg_type = USB_SDP_CHARGER;
+
+			motg->chg_state = USB_CHG_STATE_DETECTED;
+			motg->connect_type = CONNECT_TYPE_UNKNOWN;
+			delay = 0;
+		}
+		break;
+	case USB_CHG_STATE_PRIMARY_DONE:
+		vout = msm_chg_check_secondary_det(motg);
+		if (vout)
+			motg->chg_type = USB_DCP_CHARGER;
+		else
+			motg->chg_type = USB_CDP_CHARGER;
+		motg->connect_type = CONNECT_TYPE_AC;
+		motg->chg_state = USB_CHG_STATE_SECONDARY_DONE;
+		/* fall through */
+	case USB_CHG_STATE_SECONDARY_DONE:
+		motg->chg_state = USB_CHG_STATE_DETECTED;
+	case USB_CHG_STATE_DETECTED:
+		msm_chg_block_off(motg);
+		msm_chg_enable_aca_det(motg);
+		/*
+		 * Spurious interrupt is seen after enabling ACA detection
+		 * due to which charger detection fails in case of PET.
+		 * Add delay of 100 microsec to avoid that.
+		 */
+		udelay(100);
+		msm_chg_enable_aca_intr(motg);
+		USBH_INFO("chg_type = %s\n",
+			chg_to_string(motg->chg_type));
+		queue_work(system_nrt_wq, &motg->sm_work);
+		queue_work(motg->usb_wq, &motg->notifier_work);
+		return;
+	default:
+		return;
+	}
+
+	queue_delayed_work(system_nrt_wq, &motg->chg_work, delay);
+}
+
+/*
+ * We support OTG, Peripheral only and Host only configurations. In case
+ * of OTG, mode switch (host-->peripheral/peripheral-->host) can happen
+ * via Id pin status or user request (debugfs). Id/BSV interrupts are not
+ * enabled when switch is controlled by user and default mode is supplied
+ * by board file, which can be changed by userspace later.
+ */
+static void msm_otg_init_sm(struct msm_otg *motg)
+{
+	struct msm_otg_platform_data *pdata = motg->pdata;
+	u32 otgsc = readl(USB_OTGSC);
+
+	switch (pdata->mode) {
+	case USB_OTG:
+		if (pdata->otg_control == OTG_USER_CONTROL) {
+			if (pdata->default_mode == USB_HOST) {
+				clear_bit(ID, &motg->inputs);
+			} else if (pdata->default_mode == USB_PERIPHERAL) {
+				set_bit(ID, &motg->inputs);
+				set_bit(B_SESS_VLD, &motg->inputs);
+			} else {
+				set_bit(ID, &motg->inputs);
+				clear_bit(B_SESS_VLD, &motg->inputs);
+			}
+		} else if (pdata->otg_control == OTG_PHY_CONTROL) {
+			if (otgsc & OTGSC_ID) {
+				set_bit(ID, &motg->inputs);
+			} else {
+				clear_bit(ID, &motg->inputs);
+				set_bit(A_BUS_REQ, &motg->inputs);
+			}
+			if (otgsc & OTGSC_BSV)
+				set_bit(B_SESS_VLD, &motg->inputs);
+			else
+				clear_bit(B_SESS_VLD, &motg->inputs);
+		} else if (pdata->otg_control == OTG_PMIC_CONTROL) {
+			if (pdata->pmic_id_irq) {
+				unsigned long flags;
+				local_irq_save(flags);
+				if (irq_read_line(pdata->pmic_id_irq))
+					set_bit(ID, &motg->inputs);
+				else
+					clear_bit(ID, &motg->inputs);
+				local_irq_restore(flags);
+			} else
+				set_bit(ID, &motg->inputs);
+
+			/*
+			 * VBUS initial state is reported after PMIC
+			 * driver initialization. Wait for it.
+			 */
+			wait_for_completion(&pmic_vbus_init);
+		}
+		break;
+	case USB_HOST:
+		clear_bit(ID, &motg->inputs);
+		break;
+	case USB_PERIPHERAL:
+		set_bit(ID, &motg->inputs);
+		if (pdata->otg_control == OTG_PHY_CONTROL) {
+			if (otgsc & OTGSC_BSV)
+				set_bit(B_SESS_VLD, &motg->inputs);
+			else
+				clear_bit(B_SESS_VLD, &motg->inputs);
+		} else if (pdata->otg_control == OTG_PMIC_CONTROL) {
+			/*
+			 * VBUS initial state is reported after PMIC
+			 * driver initialization. Wait for it.
+			 */
+			wait_for_completion(&pmic_vbus_init);
+		}
+		break;
+	default:
+		break;
+	}
+
+	if (test_bit(B_SESS_VLD, &motg->inputs)) {
+		if (motg->pdata->usb_uart_switch)
+			motg->pdata->usb_uart_switch(0);
+	}
+}
+
+static void msm_otg_sm_work(struct work_struct *w)
+{
+	struct msm_otg *motg = container_of(w, struct msm_otg, sm_work);
+	struct usb_otg *otg = motg->phy.otg;
+	bool work = 0, srp_reqd;
+	USBH_INFO("%s: state:%s bit:0x%08x\n", __func__,
+		state_string(motg->phy.state), (unsigned) motg->inputs);
+
+	if (!motg->phy.dev) {
+		USB_ERR("%s: otg->dev was null. state: %d\n",
+						__func__, motg->phy.state);
+		return;
+	}
+	pm_runtime_resume(otg->phy->dev);
+	pr_debug("%s work\n", otg_state_string(otg->phy->state));
+	switch (otg->phy->state) {
+	case OTG_STATE_UNDEFINED:
+		dev_dbg(otg->dev, "OTG_STATE_UNDEFINED state\n");
+		msm_otg_reset(otg->phy);
+		msm_otg_init_sm(motg);
+		psy = power_supply_get_by_name("usb");
+		if (!psy)
+			pr_err("couldn't get usb power supply\n");
+		otg->phy->state = OTG_STATE_B_IDLE;
+		if (!test_bit(B_SESS_VLD, &motg->inputs) &&
+				test_bit(ID, &motg->inputs)) {
+			pm_runtime_put_noidle(otg->phy->dev);
+			pm_runtime_suspend(otg->phy->dev);
+			break;
+		}
+		/* FALL THROUGH */
+	case OTG_STATE_B_IDLE:
+		dev_dbg(otg->dev, "OTG_STATE_B_IDLE state\n");
+		if ((!test_bit(ID, &motg->inputs) ||
+				test_bit(ID_A, &motg->inputs)) && otg->host) {
+			USBH_INFO("!id || id_a\n");
+			clear_bit(B_BUS_REQ, &motg->inputs);
+			set_bit(A_BUS_REQ, &motg->inputs);
+			otg->phy->state = OTG_STATE_A_IDLE;
+			if (motg->connect_type != CONNECT_TYPE_NONE) {
+				motg->connect_type = CONNECT_TYPE_NONE;
+				queue_work(motg->usb_wq, &motg->notifier_work);
+			}
+			work = 1;
+		} else if (test_bit(B_SESS_VLD, &motg->inputs)) {
+			USBH_INFO("b_sess_vld\n");
+			switch (motg->chg_state) {
+			case USB_CHG_STATE_UNDEFINED:
+				msm_chg_detect_work(&motg->chg_work.work);
+				break;
+			case USB_CHG_STATE_DETECTED:
+				switch (motg->chg_type) {
+				case USB_DCP_CHARGER:
+					/* Enable VDP_SRC */
+					ulpi_write(otg->phy, 0x2, 0x85);
+					/* fall through */
+				case USB_PROPRIETARY_CHARGER:
+					msm_otg_notify_charger(motg,
+							IDEV_CHG_MAX);
+					if (motg->reset_phy_before_lpm)
+						msm_otg_reset(otg->phy);
+					pm_runtime_put_noidle(otg->phy->dev);
+					pm_runtime_suspend(otg->phy->dev);
+					break;
+				case USB_ACA_B_CHARGER:
+					msm_otg_notify_charger(motg,
+							IDEV_ACA_CHG_MAX);
+					/*
+					 * (ID_B --> ID_C) PHY_ALT interrupt can
+					 * not be detected in LPM.
+					 */
+					break;
+				case USB_CDP_CHARGER:
+					msm_otg_notify_charger(motg,
+							IDEV_CHG_MAX);
+					msm_otg_start_peripheral(otg, 1);
+					otg->phy->state =
+						OTG_STATE_B_PERIPHERAL;
+					break;
+				case USB_ACA_C_CHARGER:
+					msm_otg_notify_charger(motg,
+							IDEV_ACA_CHG_MAX);
+					msm_otg_start_peripheral(otg, 1);
+					otg->phy->state =
+						OTG_STATE_B_PERIPHERAL;
+					break;
+				case USB_SDP_CHARGER:
+					/* Change USB SDP charger current from 100mA to 500mA
+					 * msm_otg_notify_charger(motg, IUNIT);
+					 */
+					if (USB_disabled) {
+						USBH_INFO("Fake Sleep: disable USB function\n");
+						/* Enable VDP_SRC */
+						ulpi_write(otg->phy, 0x2, 0x85);
+						msm_otg_notify_charger(motg,IDEV_CHG_MIN);
+						if (motg->reset_phy_before_lpm)
+							msm_otg_reset(otg->phy);
+						pm_runtime_put_noidle(otg->phy->dev);
+						pm_runtime_suspend(otg->phy->dev);
+					} else {
+						/* Turn off VDP_SRC */
+						ulpi_write(otg->phy, 0x3, 0x86);
+						msm_otg_notify_charger(motg, IDEV_CHG_MIN);
+						msm_otg_start_peripheral(otg, 1);
+						otg->phy->state = OTG_STATE_B_PERIPHERAL;
+						motg->ac_detect_count = 0;
+						queue_delayed_work(system_nrt_wq, &motg->ac_detect_work, 3 * HZ);
+					 }
+					break;
+				default:
+					break;
+				}
+				break;
+			default:
+				break;
+			}
+		} else if (test_bit(B_BUS_REQ, &motg->inputs)) {
+			USBH_INFO("b_sess_end && b_bus_req\n");
+			if (msm_otg_start_srp(otg) < 0) {
+				clear_bit(B_BUS_REQ, &motg->inputs);
+				work = 1;
+				break;
+			}
+			otg->phy->state = OTG_STATE_B_SRP_INIT;
+			msm_otg_start_timer(motg, TB_SRP_FAIL, B_SRP_FAIL);
+			break;
+		} else {
+			pr_debug("chg_work cancel");
+			USBH_INFO("!b_sess_vld && id\n");
+			cancel_delayed_work_sync(&motg->chg_work);
+			motg->chg_state = USB_CHG_STATE_UNDEFINED;
+			motg->chg_type = USB_INVALID_CHARGER;
+			msm_otg_notify_charger(motg, 0);
+			msm_otg_reset(otg->phy);
+
+			if (motg->connect_type != CONNECT_TYPE_NONE) {
+				motg->connect_type = CONNECT_TYPE_NONE;
+				queue_work(motg->usb_wq, &motg->notifier_work);
+			}
+
+			pm_runtime_put_noidle(otg->phy->dev);
+			pm_runtime_suspend(otg->phy->dev);
+		}
+		break;
+	case OTG_STATE_B_SRP_INIT:
+		if (!test_bit(ID, &motg->inputs) ||
+				test_bit(ID_A, &motg->inputs) ||
+				test_bit(ID_C, &motg->inputs) ||
+				(test_bit(B_SESS_VLD, &motg->inputs) &&
+				!test_bit(ID_B, &motg->inputs))) {
+			USBH_INFO("!id || id_a/c || b_sess_vld+!id_b\n");
+			msm_otg_del_timer(motg);
+			otg->phy->state = OTG_STATE_B_IDLE;
+			/*
+			 * clear VBUSVLDEXTSEL and VBUSVLDEXT register
+			 * bits after SRP initiation.
+			 */
+			ulpi_write(otg->phy, 0x0, 0x98);
+			work = 1;
+		} else if (test_bit(B_SRP_FAIL, &motg->tmouts)) {
+			USBH_INFO("b_srp_fail\n");
+			pr_info("A-device did not respond to SRP\n");
+			clear_bit(B_BUS_REQ, &motg->inputs);
+			clear_bit(B_SRP_FAIL, &motg->tmouts);
+			otg_send_event(OTG_EVENT_NO_RESP_FOR_SRP);
+			ulpi_write(otg->phy, 0x0, 0x98);
+			otg->phy->state = OTG_STATE_B_IDLE;
+			motg->b_last_se0_sess = jiffies;
+			work = 1;
+		}
+		break;
+	case OTG_STATE_B_PERIPHERAL:
+		dev_dbg(otg->dev, "OTG_STATE_B_PERIPHERAL state\n");
+		if (!test_bit(ID, &motg->inputs) ||
+				test_bit(ID_A, &motg->inputs) ||
+				test_bit(ID_B, &motg->inputs) ||
+				!test_bit(B_SESS_VLD, &motg->inputs)) {
+			if (motg->connect_type != CONNECT_TYPE_NONE) {
+				motg->connect_type = CONNECT_TYPE_NONE;
+				queue_work(motg->usb_wq, &motg->notifier_work);
+			}
+
+                        //			if (check_htc_mode_status() != NOT_ON_AUTOBOT) {
+                        //				htc_mode_enable(0);
+                        //				android_switch_default();
+                        //			}
+			USBH_INFO("!id  || id_a/b || !b_sess_vld\n");
+			motg->chg_state = USB_CHG_STATE_UNDEFINED;
+			motg->chg_type = USB_INVALID_CHARGER;
+			msm_otg_notify_charger(motg, 0);
+			srp_reqd = otg->gadget->otg_srp_reqd;
+			msm_otg_start_peripheral(otg, 0);
+			if (test_bit(ID_B, &motg->inputs))
+				clear_bit(ID_B, &motg->inputs);
+			clear_bit(B_BUS_REQ, &motg->inputs);
+			otg->phy->state = OTG_STATE_B_IDLE;
+			motg->ac_detect_count = 0;
+			cancel_delayed_work_sync(&motg->ac_detect_work);
+			motg->b_last_se0_sess = jiffies;
+			if (srp_reqd)
+				msm_otg_start_timer(motg,
+					TB_TST_SRP, B_TST_SRP);
+			else
+				work = 1;
+		} else if (test_bit(B_BUS_REQ, &motg->inputs) &&
+				otg->gadget->b_hnp_enable &&
+				test_bit(A_BUS_SUSPEND, &motg->inputs)) {
+			USBH_INFO("b_bus_req && b_hnp_en && a_bus_suspend\n");
+			msm_otg_start_timer(motg, TB_ASE0_BRST, B_ASE0_BRST);
+			/* D+ pullup should not be disconnected within 4msec
+			 * after A device suspends the bus. Otherwise PET will
+			 * fail the compliance test.
+			 */
+			udelay(1000);
+			msm_otg_start_peripheral(otg, 0);
+			otg->phy->state = OTG_STATE_B_WAIT_ACON;
+			/*
+			 * start HCD even before A-device enable
+			 * pull-up to meet HNP timings.
+			 */
+			otg->host->is_b_host = 1;
+			msm_otg_start_host(otg, 1);
+		} else if (test_bit(A_BUS_SUSPEND, &motg->inputs) &&
+				   test_bit(B_SESS_VLD, &motg->inputs)) {
+			pr_debug("a_bus_suspend && b_sess_vld\n");
+			if (motg->caps & ALLOW_LPM_ON_DEV_SUSPEND) {
+				pm_runtime_put_noidle(otg->phy->dev);
+				pm_runtime_suspend(otg->phy->dev);
+			}
+		} else if (test_bit(ID_C, &motg->inputs)) {
+			USBH_INFO("id_c\n");
+			msm_otg_notify_charger(motg, IDEV_ACA_CHG_MAX);
+		} else if (test_bit(B_SESS_VLD, &motg->inputs)) {
+			/* redetect to China AC*/
+			if (motg->chg_type == USB_DCP_CHARGER ||
+				(motg->chg_type == USB_SDP_CHARGER &&
+				 USB_disabled)
+				) {
+				msm_otg_start_peripheral(otg, 0);
+				otg->phy->state = OTG_STATE_B_IDLE;
+				work = 1;
+				motg->ac_detect_count = 0;
+				cancel_delayed_work_sync(&motg->ac_detect_work);
+			} else
+				USBH_DEBUG("do nothing !!!\n");
+		} else
+			USBH_DEBUG("do nothing !!\n");
+		break;
+	case OTG_STATE_B_WAIT_ACON:
+		if (!test_bit(ID, &motg->inputs) ||
+				test_bit(ID_A, &motg->inputs) ||
+				test_bit(ID_B, &motg->inputs) ||
+				!test_bit(B_SESS_VLD, &motg->inputs)) {
+			USBH_INFO("!id || id_a/b || !b_sess_vld\n");
+			msm_otg_del_timer(motg);
+			/*
+			 * A-device is physically disconnected during
+			 * HNP. Remove HCD.
+			 */
+			msm_otg_start_host(otg, 0);
+			otg->host->is_b_host = 0;
+
+			clear_bit(B_BUS_REQ, &motg->inputs);
+			clear_bit(A_BUS_SUSPEND, &motg->inputs);
+			motg->b_last_se0_sess = jiffies;
+			otg->phy->state = OTG_STATE_B_IDLE;
+			msm_otg_reset(otg->phy);
+			work = 1;
+		} else if (test_bit(A_CONN, &motg->inputs)) {
+			USBH_INFO("a_conn\n");
+			clear_bit(A_BUS_SUSPEND, &motg->inputs);
+			otg->phy->state = OTG_STATE_B_HOST;
+			/*
+			 * PET disconnects D+ pullup after reset is generated
+			 * by B device in B_HOST role which is not detected by
+			 * B device. As workaorund , start timer of 300msec
+			 * and stop timer if A device is enumerated else clear
+			 * A_CONN.
+			 */
+			msm_otg_start_timer(motg, TB_TST_CONFIG,
+						B_TST_CONFIG);
+		} else if (test_bit(B_ASE0_BRST, &motg->tmouts)) {
+			USBH_INFO("b_ase0_brst_tmout\n");
+			pr_info("B HNP fail:No response from A device\n");
+			msm_otg_start_host(otg, 0);
+			msm_otg_reset(otg->phy);
+			otg->host->is_b_host = 0;
+			clear_bit(B_ASE0_BRST, &motg->tmouts);
+			clear_bit(A_BUS_SUSPEND, &motg->inputs);
+			clear_bit(B_BUS_REQ, &motg->inputs);
+			otg_send_event(OTG_EVENT_HNP_FAILED);
+			otg->phy->state = OTG_STATE_B_IDLE;
+			work = 1;
+		} else if (test_bit(ID_C, &motg->inputs)) {
+			msm_otg_notify_charger(motg, IDEV_ACA_CHG_MAX);
+		}
+		break;
+	case OTG_STATE_B_HOST:
+		if (!test_bit(B_BUS_REQ, &motg->inputs) ||
+				!test_bit(A_CONN, &motg->inputs) ||
+				!test_bit(B_SESS_VLD, &motg->inputs)) {
+			USBH_INFO("!b_bus_req || !a_conn || !b_sess_vld\n");
+			clear_bit(A_CONN, &motg->inputs);
+			clear_bit(B_BUS_REQ, &motg->inputs);
+			msm_otg_start_host(otg, 0);
+			otg->host->is_b_host = 0;
+			otg->phy->state = OTG_STATE_B_IDLE;
+			msm_otg_reset(otg->phy);
+			work = 1;
+		} else if (test_bit(ID_C, &motg->inputs)) {
+			msm_otg_notify_charger(motg, IDEV_ACA_CHG_MAX);
+		}
+		break;
+	case OTG_STATE_A_IDLE:
+		otg->default_a = 1;
+		if (test_bit(ID, &motg->inputs) &&
+			!test_bit(ID_A, &motg->inputs)) {
+			USBH_INFO("id && !id_a\n");
+			otg->default_a = 0;
+			clear_bit(A_BUS_DROP, &motg->inputs);
+			otg->phy->state = OTG_STATE_B_IDLE;
+			del_timer_sync(&motg->id_timer);
+			msm_otg_link_reset(motg);
+			msm_chg_enable_aca_intr(motg);
+			msm_otg_notify_charger(motg, 0);
+			work = 1;
+		} else if (!test_bit(A_BUS_DROP, &motg->inputs) &&
+				(test_bit(A_SRP_DET, &motg->inputs) ||
+				 test_bit(A_BUS_REQ, &motg->inputs))) {
+			USBH_INFO("!a_bus_drop && (a_srp_det || a_bus_req)\n");
+
+			clear_bit(A_SRP_DET, &motg->inputs);
+			/* Disable SRP detection */
+			writel_relaxed((readl_relaxed(USB_OTGSC) &
+					~OTGSC_INTSTS_MASK) &
+					~OTGSC_DPIE, USB_OTGSC);
+
+			otg->phy->state = OTG_STATE_A_WAIT_VRISE;
+			/* VBUS should not be supplied before end of SRP pulse
+			 * generated by PET, if not complaince test fail.
+			 */
+			usleep_range(10000, 12000);
+			/* ACA: ID_A: Stop charging untill enumeration */
+			if (test_bit(ID_A, &motg->inputs))
+				msm_otg_notify_charger(motg, 0);
+			else
+				msm_hsusb_vbus_power(motg, 1);
+			msm_otg_start_timer(motg, TA_WAIT_VRISE, A_WAIT_VRISE);
+		} else {
+			USBH_INFO("No session requested\n");
+			clear_bit(A_BUS_DROP, &motg->inputs);
+			if (test_bit(ID_A, &motg->inputs)) {
+					msm_otg_notify_charger(motg,
+							IDEV_ACA_CHG_MAX);
+			} else if (!test_bit(ID, &motg->inputs)) {
+				msm_otg_notify_charger(motg, 0);
+				/*
+				 * A-device is not providing power on VBUS.
+				 * Enable SRP detection.
+				 */
+				writel_relaxed(0x13, USB_USBMODE);
+				writel_relaxed((readl_relaxed(USB_OTGSC) &
+						~OTGSC_INTSTS_MASK) |
+						OTGSC_DPIE, USB_OTGSC);
+				mb();
+			}
+		}
+		break;
+	case OTG_STATE_A_WAIT_VRISE:
+		if ((test_bit(ID, &motg->inputs) &&
+				!test_bit(ID_A, &motg->inputs)) ||
+				test_bit(A_BUS_DROP, &motg->inputs) ||
+				test_bit(A_WAIT_VRISE, &motg->tmouts)) {
+			USBH_INFO("id || a_bus_drop || a_wait_vrise_tmout\n");
+			clear_bit(A_BUS_REQ, &motg->inputs);
+			msm_otg_del_timer(motg);
+			msm_hsusb_vbus_power(motg, 0);
+			otg->phy->state = OTG_STATE_A_WAIT_VFALL;
+			msm_otg_start_timer(motg, TA_WAIT_VFALL, A_WAIT_VFALL);
+		} else if (test_bit(A_VBUS_VLD, &motg->inputs)) {
+			USBH_INFO("a_vbus_vld\n");
+			otg->phy->state = OTG_STATE_A_WAIT_BCON;
+			if (TA_WAIT_BCON > 0)
+				msm_otg_start_timer(motg, TA_WAIT_BCON,
+					A_WAIT_BCON);
+			msm_otg_start_host(otg, 1);
+			msm_chg_enable_aca_det(motg);
+			msm_chg_disable_aca_intr(motg);
+			mod_timer(&motg->id_timer, ID_TIMER_FREQ);
+			if (msm_chg_check_aca_intr(motg))
+				work = 1;
+		}
+		break;
+	case OTG_STATE_A_WAIT_BCON:
+		if ((test_bit(ID, &motg->inputs) &&
+				!test_bit(ID_A, &motg->inputs)) ||
+				test_bit(A_BUS_DROP, &motg->inputs) ||
+				test_bit(A_WAIT_BCON, &motg->tmouts)) {
+			USBH_INFO("(id && id_a/b/c) || a_bus_drop ||"
+					"a_wait_bcon_tmout\n");
+			if (test_bit(A_WAIT_BCON, &motg->tmouts)) {
+				pr_info("Device No Response\n");
+				otg_send_event(OTG_EVENT_DEV_CONN_TMOUT);
+			}
+			msm_otg_del_timer(motg);
+			clear_bit(A_BUS_REQ, &motg->inputs);
+			clear_bit(B_CONN, &motg->inputs);
+			msm_otg_start_host(otg, 0);
+			/*
+			 * ACA: ID_A with NO accessory, just the A plug is
+			 * attached to ACA: Use IDCHG_MAX for charging
+			 */
+			if (test_bit(ID_A, &motg->inputs))
+				msm_otg_notify_charger(motg, IDEV_CHG_MIN);
+			else
+				msm_hsusb_vbus_power(motg, 0);
+			otg->phy->state = OTG_STATE_A_WAIT_VFALL;
+			msm_otg_start_timer(motg, TA_WAIT_VFALL, A_WAIT_VFALL);
+		} else if (!test_bit(A_VBUS_VLD, &motg->inputs)) {
+			USBH_INFO("!a_vbus_vld\n");
+			clear_bit(B_CONN, &motg->inputs);
+			msm_otg_del_timer(motg);
+			msm_otg_start_host(otg, 0);
+			otg->phy->state = OTG_STATE_A_VBUS_ERR;
+			msm_otg_reset(otg->phy);
+		} else if (test_bit(ID_A, &motg->inputs)) {
+			msm_hsusb_vbus_power(motg, 0);
+		} else if (!test_bit(A_BUS_REQ, &motg->inputs)) {
+			/*
+			 * If TA_WAIT_BCON is infinite, we don;t
+			 * turn off VBUS. Enter low power mode.
+			 */
+			if (TA_WAIT_BCON < 0)
+				pm_runtime_put_sync(otg->phy->dev);
+		} else if (!test_bit(ID, &motg->inputs)) {
+			msm_hsusb_vbus_power(motg, 1);
+		}
+		break;
+	case OTG_STATE_A_HOST:
+		dev_dbg(otg->dev, "OTG_STATE_A_HOST state\n");
+		if ((test_bit(ID, &motg->inputs) &&
+				!test_bit(ID_A, &motg->inputs)) ||
+				test_bit(A_BUS_DROP, &motg->inputs)) {
+			USBH_INFO("id_a/b/c || a_bus_drop\n");
+			clear_bit(B_CONN, &motg->inputs);
+			clear_bit(A_BUS_REQ, &motg->inputs);
+			msm_otg_del_timer(motg);
+			otg->phy->state = OTG_STATE_A_WAIT_VFALL;
+			msm_otg_start_host(otg, 0);
+			if (!test_bit(ID_A, &motg->inputs))
+				msm_hsusb_vbus_power(motg, 0);
+			msm_otg_start_timer(motg, TA_WAIT_VFALL, A_WAIT_VFALL);
+		} else if (!test_bit(A_VBUS_VLD, &motg->inputs)) {
+			USBH_INFO("!a_vbus_vld\n");
+			clear_bit(B_CONN, &motg->inputs);
+			msm_otg_del_timer(motg);
+			otg->phy->state = OTG_STATE_A_VBUS_ERR;
+			msm_otg_start_host(otg, 0);
+			msm_otg_reset(otg->phy);
+		} else if (!test_bit(A_BUS_REQ, &motg->inputs)) {
+			/*
+			 * a_bus_req is de-asserted when root hub is
+			 * suspended or HNP is in progress.
+			 */
+			USBH_INFO("!a_bus_req\n");
+			msm_otg_del_timer(motg);
+			otg->phy->state = OTG_STATE_A_SUSPEND;
+			if (otg->host->b_hnp_enable)
+				msm_otg_start_timer(motg, TA_AIDL_BDIS,
+						A_AIDL_BDIS);
+			else
+				pm_runtime_put_sync(otg->phy->dev);
+		} else if (!test_bit(B_CONN, &motg->inputs)) {
+			USBH_INFO("!b_conn\n");
+			msm_otg_del_timer(motg);
+			otg->phy->state = OTG_STATE_A_WAIT_BCON;
+			if (TA_WAIT_BCON > 0)
+				msm_otg_start_timer(motg, TA_WAIT_BCON,
+					A_WAIT_BCON);
+			if (msm_chg_check_aca_intr(motg))
+				work = 1;
+		} else if (test_bit(ID_A, &motg->inputs)) {
+			msm_otg_del_timer(motg);
+			msm_hsusb_vbus_power(motg, 0);
+			if (motg->chg_type == USB_ACA_DOCK_CHARGER)
+				msm_otg_notify_charger(motg,
+						IDEV_ACA_CHG_MAX);
+			else
+				msm_otg_notify_charger(motg,
+						IDEV_CHG_MIN - motg->mA_port);
+		} else if (!test_bit(ID, &motg->inputs)) {
+			motg->chg_state = USB_CHG_STATE_UNDEFINED;
+			motg->chg_type = USB_INVALID_CHARGER;
+			msm_otg_notify_charger(motg, 0);
+			msm_hsusb_vbus_power(motg, 1);
+		}
+		break;
+	case OTG_STATE_A_SUSPEND:
+		if ((test_bit(ID, &motg->inputs) &&
+				!test_bit(ID_A, &motg->inputs)) ||
+				test_bit(A_BUS_DROP, &motg->inputs) ||
+				test_bit(A_AIDL_BDIS, &motg->tmouts)) {
+			USBH_INFO("id_a/b/c || a_bus_drop ||"
+					"a_aidl_bdis_tmout\n");
+			msm_otg_del_timer(motg);
+			clear_bit(B_CONN, &motg->inputs);
+			otg->phy->state = OTG_STATE_A_WAIT_VFALL;
+			msm_otg_start_host(otg, 0);
+			msm_otg_reset(otg->phy);
+			if (!test_bit(ID_A, &motg->inputs))
+				msm_hsusb_vbus_power(motg, 0);
+			msm_otg_start_timer(motg, TA_WAIT_VFALL, A_WAIT_VFALL);
+		} else if (!test_bit(A_VBUS_VLD, &motg->inputs)) {
+			USBH_INFO("!a_vbus_vld\n");
+			msm_otg_del_timer(motg);
+			clear_bit(B_CONN, &motg->inputs);
+			otg->phy->state = OTG_STATE_A_VBUS_ERR;
+			msm_otg_start_host(otg, 0);
+			msm_otg_reset(otg->phy);
+		} else if (!test_bit(B_CONN, &motg->inputs) &&
+				otg->host->b_hnp_enable) {
+			USBH_INFO("!b_conn && b_hnp_enable");
+			otg->phy->state = OTG_STATE_A_PERIPHERAL;
+			msm_otg_host_hnp_enable(otg, 1);
+			otg->gadget->is_a_peripheral = 1;
+			msm_otg_start_peripheral(otg, 1);
+		} else if (!test_bit(B_CONN, &motg->inputs) &&
+				!otg->host->b_hnp_enable) {
+			USBH_INFO("!b_conn && !b_hnp_enable");
+			/*
+			 * bus request is dropped during suspend.
+			 * acquire again for next device.
+			 */
+			set_bit(A_BUS_REQ, &motg->inputs);
+			otg->phy->state = OTG_STATE_A_WAIT_BCON;
+			if (TA_WAIT_BCON > 0)
+				msm_otg_start_timer(motg, TA_WAIT_BCON,
+					A_WAIT_BCON);
+		} else if (test_bit(ID_A, &motg->inputs)) {
+			msm_hsusb_vbus_power(motg, 0);
+			msm_otg_notify_charger(motg,
+					IDEV_CHG_MIN - motg->mA_port);
+		} else if (!test_bit(ID, &motg->inputs)) {
+			msm_otg_notify_charger(motg, 0);
+			msm_hsusb_vbus_power(motg, 1);
+		}
+		break;
+	case OTG_STATE_A_PERIPHERAL:
+		if ((test_bit(ID, &motg->inputs) &&
+				!test_bit(ID_A, &motg->inputs)) ||
+				test_bit(A_BUS_DROP, &motg->inputs)) {
+			USBH_INFO("id _f/b/c || a_bus_drop\n");
+			/* Clear BIDL_ADIS timer */
+			msm_otg_del_timer(motg);
+			otg->phy->state = OTG_STATE_A_WAIT_VFALL;
+			msm_otg_start_peripheral(otg, 0);
+			otg->gadget->is_a_peripheral = 0;
+			msm_otg_start_host(otg, 0);
+			msm_otg_reset(otg->phy);
+			if (!test_bit(ID_A, &motg->inputs))
+				msm_hsusb_vbus_power(motg, 0);
+			msm_otg_start_timer(motg, TA_WAIT_VFALL, A_WAIT_VFALL);
+		} else if (!test_bit(A_VBUS_VLD, &motg->inputs)) {
+			USBH_INFO("!a_vbus_vld\n");
+			/* Clear BIDL_ADIS timer */
+			msm_otg_del_timer(motg);
+			otg->phy->state = OTG_STATE_A_VBUS_ERR;
+			msm_otg_start_peripheral(otg, 0);
+			otg->gadget->is_a_peripheral = 0;
+			msm_otg_start_host(otg, 0);
+		} else if (test_bit(A_BIDL_ADIS, &motg->tmouts)) {
+			USBH_INFO("a_bidl_adis_tmout\n");
+			msm_otg_start_peripheral(otg, 0);
+			otg->gadget->is_a_peripheral = 0;
+			otg->phy->state = OTG_STATE_A_WAIT_BCON;
+			set_bit(A_BUS_REQ, &motg->inputs);
+			msm_otg_host_hnp_enable(otg, 0);
+			if (TA_WAIT_BCON > 0)
+				msm_otg_start_timer(motg, TA_WAIT_BCON,
+					A_WAIT_BCON);
+		} else if (test_bit(ID_A, &motg->inputs)) {
+			msm_hsusb_vbus_power(motg, 0);
+			msm_otg_notify_charger(motg,
+					IDEV_CHG_MIN - motg->mA_port);
+		} else if (!test_bit(ID, &motg->inputs)) {
+			USBH_INFO("!id\n");
+			msm_otg_notify_charger(motg, 0);
+			msm_hsusb_vbus_power(motg, 1);
+		}
+		break;
+	case OTG_STATE_A_WAIT_VFALL:
+		if (test_bit(A_WAIT_VFALL, &motg->tmouts)) {
+			clear_bit(A_VBUS_VLD, &motg->inputs);
+			otg->phy->state = OTG_STATE_A_IDLE;
+			work = 1;
+		}
+		break;
+	case OTG_STATE_A_VBUS_ERR:
+		if ((test_bit(ID, &motg->inputs) &&
+				!test_bit(ID_A, &motg->inputs)) ||
+				test_bit(A_BUS_DROP, &motg->inputs) ||
+				test_bit(A_CLR_ERR, &motg->inputs)) {
+			otg->phy->state = OTG_STATE_A_WAIT_VFALL;
+			if (!test_bit(ID_A, &motg->inputs))
+				msm_hsusb_vbus_power(motg, 0);
+			msm_otg_start_timer(motg, TA_WAIT_VFALL, A_WAIT_VFALL);
+			motg->chg_state = USB_CHG_STATE_UNDEFINED;
+			motg->chg_type = USB_INVALID_CHARGER;
+			msm_otg_notify_charger(motg, 0);
+		}
+		break;
+	default:
+		break;
+	}
+	if (work)
+		queue_work(system_nrt_wq, &motg->sm_work);
+}
+
+static irqreturn_t msm_otg_irq(int irq, void *data)
+{
+	struct msm_otg *motg = data;
+	struct usb_otg *otg = motg->phy.otg;
+	u32 otgsc = 0, usbsts, pc;
+	bool work = 0;
+	irqreturn_t ret = IRQ_HANDLED;
+
+	if (atomic_read(&motg->in_lpm)) {
+		pr_debug("OTG IRQ: in LPM\n");
+		disable_irq_nosync(irq);
+		motg->async_int = 1;
+		if (atomic_read(&motg->pm_suspended))
+			motg->sm_work_pending = true;
+		else
+			pm_request_resume(otg->phy->dev);
+		return IRQ_HANDLED;
+	}
+
+	usbsts = readl(USB_USBSTS);
+	otgsc = readl(USB_OTGSC);
+
+	if (!(otgsc & OTG_OTGSTS_MASK) && !(usbsts & OTG_USBSTS_MASK))
+		return IRQ_NONE;
+
+	if ((otgsc & OTGSC_IDIS) && (otgsc & OTGSC_IDIE)) {
+		if (otgsc & OTGSC_ID) {
+			pr_debug("Id set\n");
+			set_bit(ID, &motg->inputs);
+		} else {
+			pr_debug("Id clear\n");
+			/*
+			 * Assert a_bus_req to supply power on
+			 * VBUS when Micro/Mini-A cable is connected
+			 * with out user intervention.
+			 */
+			set_bit(A_BUS_REQ, &motg->inputs);
+			clear_bit(ID, &motg->inputs);
+			msm_chg_enable_aca_det(motg);
+		}
+		writel_relaxed(otgsc, USB_OTGSC);
+		work = 1;
+	} else if (otgsc & OTGSC_DPIS) {
+		pr_debug("DPIS detected\n");
+		writel_relaxed(otgsc, USB_OTGSC);
+		set_bit(A_SRP_DET, &motg->inputs);
+		set_bit(A_BUS_REQ, &motg->inputs);
+		work = 1;
+	} else if (otgsc & OTGSC_BSVIS) {
+		writel_relaxed(otgsc, USB_OTGSC);
+		/*
+		 * BSV interrupt comes when operating as an A-device
+		 * (VBUS on/off).
+		 * But, handle BSV when charger is removed from ACA in ID_A
+		 */
+		/*
+		if ((otg->phy->state >= OTG_STATE_A_IDLE) &&
+			!test_bit(ID_A, &motg->inputs))
+			return IRQ_HANDLED;
+		if (otgsc & OTGSC_BSV) {
+			pr_debug("BSV set\n");
+			set_bit(B_SESS_VLD, &motg->inputs);
+		} else {
+			pr_debug("BSV clear\n");
+			clear_bit(B_SESS_VLD, &motg->inputs);
+			clear_bit(A_BUS_SUSPEND, &motg->inputs);
+
+			msm_chg_check_aca_intr(motg);
+		}
+		work = 1;
+		*/
+	} else if (usbsts & STS_PCI) {
+		pc = readl_relaxed(USB_PORTSC);
+		pr_debug("portsc = %x\n", pc);
+		ret = IRQ_NONE;
+		/*
+		 * HCD Acks PCI interrupt. We use this to switch
+		 * between different OTG states.
+		 */
+		work = 1;
+		switch (otg->phy->state) {
+		case OTG_STATE_A_SUSPEND:
+			if (otg->host->b_hnp_enable && (pc & PORTSC_CSC) &&
+					!(pc & PORTSC_CCS)) {
+				pr_debug("B_CONN clear\n");
+				clear_bit(B_CONN, &motg->inputs);
+				msm_otg_del_timer(motg);
+			}
+			break;
+		case OTG_STATE_A_PERIPHERAL:
+			/*
+			 * A-peripheral observed activity on bus.
+			 * clear A_BIDL_ADIS timer.
+			 */
+			msm_otg_del_timer(motg);
+			work = 0;
+			break;
+		case OTG_STATE_B_WAIT_ACON:
+			if ((pc & PORTSC_CSC) && (pc & PORTSC_CCS)) {
+				pr_debug("A_CONN set\n");
+				set_bit(A_CONN, &motg->inputs);
+				/* Clear ASE0_BRST timer */
+				msm_otg_del_timer(motg);
+			}
+			break;
+		case OTG_STATE_B_HOST:
+			if ((pc & PORTSC_CSC) && !(pc & PORTSC_CCS)) {
+				pr_debug("A_CONN clear\n");
+				clear_bit(A_CONN, &motg->inputs);
+				msm_otg_del_timer(motg);
+			}
+			break;
+		case OTG_STATE_A_WAIT_BCON:
+			if (TA_WAIT_BCON < 0)
+				set_bit(A_BUS_REQ, &motg->inputs);
+		default:
+			work = 0;
+			break;
+		}
+	} else if (usbsts & STS_URI) {
+		ret = IRQ_NONE;
+		switch (otg->phy->state) {
+		case OTG_STATE_A_PERIPHERAL:
+			/*
+			 * A-peripheral observed activity on bus.
+			 * clear A_BIDL_ADIS timer.
+			 */
+			msm_otg_del_timer(motg);
+			work = 0;
+			break;
+		default:
+			work = 0;
+			break;
+		}
+	} else if (usbsts & STS_SLI) {
+		ret = IRQ_NONE;
+		work = 0;
+		switch (otg->phy->state) {
+		case OTG_STATE_B_PERIPHERAL:
+			if (otg->gadget->b_hnp_enable) {
+				set_bit(A_BUS_SUSPEND, &motg->inputs);
+				set_bit(B_BUS_REQ, &motg->inputs);
+				work = 1;
+			}
+			break;
+		case OTG_STATE_A_PERIPHERAL:
+			msm_otg_start_timer(motg, TA_BIDL_ADIS,
+					A_BIDL_ADIS);
+			break;
+		default:
+			break;
+		}
+	} else if ((usbsts & PHY_ALT_INT)) {
+		writel_relaxed(PHY_ALT_INT, USB_USBSTS);
+		if (msm_chg_check_aca_intr(motg))
+			work = 1;
+		ret = IRQ_HANDLED;
+	}
+	if (work)
+		queue_work(system_nrt_wq, &motg->sm_work);
+
+	return ret;
+}
+
+
+/* The dedicated 9V detection GPIO will be high if VBUS is in and over 6V.
+ * Since D+/D- status is not involved, there is no timing issue between
+ * D+/D- and VBUS. 9V AC should NOT be found here.
+ */
+static void ac_detect_expired_work(struct work_struct *w)
+{
+	u32 delay = 0;
+	struct msm_otg *motg = the_msm_otg;
+	struct usb_phy *usb_phy = &motg->phy;
+
+	USBH_INFO("%s: count = %d, connect_type = %d\n", __func__,
+			motg->ac_detect_count, motg->connect_type);
+
+	if (motg->connect_type == CONNECT_TYPE_USB || motg->ac_detect_count >= 3)
+		return;
+
+	/* detect shorted D+/D-, indicating AC power */
+	if ((readl(USB_PORTSC) & PORTSC_LS) != PORTSC_LS) {
+		/* Some carkit can't be recognized as AC mode.
+		 * Add SW solution here to notify battery driver should
+		 * work as AC charger when car mode activated.
+		 */
+#ifdef CONFIG_CABLE_DETECT_ACCESSORY
+		if (cable_get_accessory_type() == DOCK_STATE_CAR
+			||cable_get_accessory_type() == DOCK_STATE_AUDIO_DOCK) {
+				USBH_INFO("car/audio dock mode charger\n");
+				motg->chg_type = USB_DCP_CHARGER;
+				motg->chg_state = USB_CHG_STATE_DETECTED;
+				motg->connect_type = CONNECT_TYPE_AC;
+				motg->ac_detect_count = 0;
+
+				msm_otg_start_peripheral(usb_phy->otg, 0);
+				usb_phy->state = OTG_STATE_B_IDLE;
+				queue_work(system_nrt_wq, &motg->sm_work);
+
+				queue_work(motg->usb_wq, &motg->notifier_work);
+				return;
+		}
+#endif
+		motg->ac_detect_count++;
+		if (motg->ac_detect_count == 1)
+			delay = 5 * HZ;
+		else if (motg->ac_detect_count == 2)
+			delay = 10 * HZ;
+
+		queue_delayed_work(system_nrt_wq, &motg->ac_detect_work, delay);
+	} else {
+		USBH_INFO("AC charger\n");
+		motg->chg_type = USB_DCP_CHARGER;
+		motg->chg_state = USB_CHG_STATE_DETECTED;
+		motg->connect_type = CONNECT_TYPE_AC;
+		motg->ac_detect_count = 0;
+
+		msm_otg_start_peripheral(usb_phy->otg, 0);
+		usb_phy->state = OTG_STATE_B_IDLE;
+		queue_work(system_nrt_wq, &motg->sm_work);
+
+		queue_work(motg->usb_wq, &motg->notifier_work);
+	}
+}
+
+static void htc_vbus_notify(int online)
+{
+	cable_detection_vbus_irq_handler();
+	/*cable_detection_vbus_notify(online);*/
+}
+
+int msm_otg_get_vbus_state(void)
+{
+	return htc_otg_vbus;
+}
+
+void msm_otg_set_vbus_state(int online)
+{
+	static bool init;
+	struct msm_otg *motg = the_msm_otg;
+	struct usb_otg *otg = motg->phy.otg;
+	USBH_INFO("%s: %d\n", __func__, online);
+
+	htc_otg_vbus = online;
+	/* In A Host Mode, ignore received BSV interrupts */
+	if (online && otg->phy->state >= OTG_STATE_A_IDLE)
+		return;
+
+	if (online) {
+		pr_debug("PMIC: BSV set\n");
+		set_bit(B_SESS_VLD, &motg->inputs);
+		/* VBUS interrupt will be triggered while HOST
+		 * 5V power turn on */
+
+		/*USB*/
+		if (motg->pdata->usb_uart_switch)
+			motg->pdata->usb_uart_switch(0);
+	} else {
+		pr_debug("PMIC: BSV clear\n");
+		clear_bit(B_SESS_VLD, &motg->inputs);
+
+		/*UART*/
+		if (motg->pdata->usb_uart_switch)
+			motg->pdata->usb_uart_switch(1);
+	}
+
+	if (!init) {
+		init = true;
+		complete(&pmic_vbus_init);
+		pr_debug("PMIC: BSV init complete\n");
+		return;
+	}
+
+	wake_lock_timeout(&motg->cable_detect_wlock, 3 * HZ);
+	if (atomic_read(&motg->pm_suspended))
+		motg->sm_work_pending = true;
+	else
+		queue_work(system_nrt_wq, &motg->sm_work);
+}
+
+
+#if (defined(CONFIG_USB_OTG) && defined(CONFIG_USB_OTG_HOST))
+void msm_otg_set_id_state(int id)
+{
+	struct msm_otg *motg = the_msm_otg;
+
+	if (id) {
+		pr_debug("PMIC: ID set\n");
+		set_bit(ID, &motg->inputs);
+	} else {
+		pr_debug("PMIC: ID clear\n");
+		clear_bit(ID, &motg->inputs);
+	}
+
+	if (motg->phy.state != OTG_STATE_UNDEFINED) {
+		/* Hold a wake_lock so that it will not sleep in detection */
+		wake_lock_timeout(&motg->cable_detect_wlock, 3 * HZ);
+		schedule_work(&motg->sm_work);
+	}
+}
+
+static void usb_host_cable_detect(bool cable_in)
+{
+	if (cable_in)
+		msm_otg_set_id_state(0);
+	else
+		msm_otg_set_id_state(1);
+}
+#endif
+
+void msm_otg_set_disable_usb(int disable_usb)
+{
+	struct msm_otg *motg = the_msm_otg;
+
+	USB_disabled = disable_usb;
+
+	queue_work(system_nrt_wq, &motg->sm_work);
+}
+
+static void msm_pmic_id_status_w(struct work_struct *w)
+{
+	struct msm_otg *motg = container_of(w, struct msm_otg,
+						pmic_id_status_work.work);
+	int work = 0;
+	unsigned long flags;
+
+	local_irq_save(flags);
+	if (irq_read_line(motg->pdata->pmic_id_irq)) {
+		if (!test_and_set_bit(ID, &motg->inputs)) {
+			pr_debug("PMIC: ID set\n");
+			work = 1;
+		}
+	} else {
+		if (test_and_clear_bit(ID, &motg->inputs)) {
+			pr_debug("PMIC: ID clear\n");
+			set_bit(A_BUS_REQ, &motg->inputs);
+			work = 1;
+		}
+	}
+
+	if (work && (motg->phy.state != OTG_STATE_UNDEFINED)) {
+		if (atomic_read(&motg->pm_suspended))
+			motg->sm_work_pending = true;
+		else
+			queue_work(system_nrt_wq, &motg->sm_work);
+	}
+	local_irq_restore(flags);
+
+}
+
+#define MSM_PMIC_ID_STATUS_DELAY	5 /* 5msec */
+static irqreturn_t msm_pmic_id_irq(int irq, void *data)
+{
+	struct msm_otg *motg = data;
+
+	if (!aca_id_turned_on)
+		/*schedule delayed work for 5msec for ID line state to settle*/
+		queue_delayed_work(system_nrt_wq, &motg->pmic_id_status_work,
+				msecs_to_jiffies(MSM_PMIC_ID_STATUS_DELAY));
+
+	return IRQ_HANDLED;
+}
+
+static int msm_otg_mode_show(struct seq_file *s, void *unused)
+{
+	struct msm_otg *motg = s->private;
+	struct usb_phy *phy = &motg->phy;
+
+	switch (phy->state) {
+	case OTG_STATE_A_HOST:
+		seq_printf(s, "host\n");
+		break;
+	case OTG_STATE_B_PERIPHERAL:
+		seq_printf(s, "peripheral\n");
+		break;
+	default:
+		seq_printf(s, "none\n");
+		break;
+	}
+
+	return 0;
+}
+
+static int msm_otg_mode_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, msm_otg_mode_show, inode->i_private);
+}
+
+static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
+				size_t count, loff_t *ppos)
+{
+	struct seq_file *s = file->private_data;
+	struct msm_otg *motg = s->private;
+	char buf[16];
+	struct usb_phy *phy = &motg->phy;
+	int status = count;
+	enum usb_mode_type req_mode;
+
+	memset(buf, 0x00, sizeof(buf));
+
+	if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) {
+		status = -EFAULT;
+		goto out;
+	}
+
+	if (!strncmp(buf, "host", 4)) {
+		req_mode = USB_HOST;
+	} else if (!strncmp(buf, "peripheral", 10)) {
+		req_mode = USB_PERIPHERAL;
+	} else if (!strncmp(buf, "none", 4)) {
+		req_mode = USB_NONE;
+	} else {
+		status = -EINVAL;
+		goto out;
+	}
+
+	USB_INFO("%s: %s\n", __func__, (req_mode == USB_HOST)?"host"
+			:(req_mode == USB_PERIPHERAL)?"peripheral":"none");
+
+	switch (req_mode) {
+	case USB_NONE:
+		switch (phy->state) {
+		case OTG_STATE_A_HOST:
+		case OTG_STATE_B_PERIPHERAL:
+			set_bit(ID, &motg->inputs);
+			clear_bit(B_SESS_VLD, &motg->inputs);
+			break;
+		default:
+			goto out;
+		}
+		break;
+	case USB_PERIPHERAL:
+		switch (phy->state) {
+		case OTG_STATE_B_IDLE:
+		case OTG_STATE_A_HOST:
+			set_bit(ID, &motg->inputs);
+			set_bit(B_SESS_VLD, &motg->inputs);
+			break;
+		default:
+			goto out;
+		}
+		break;
+	case USB_HOST:
+		switch (phy->state) {
+		case OTG_STATE_B_IDLE:
+		case OTG_STATE_B_PERIPHERAL:
+			clear_bit(ID, &motg->inputs);
+			break;
+		default:
+			goto out;
+		}
+		break;
+	default:
+		goto out;
+	}
+
+	pm_runtime_resume(phy->dev);
+	queue_work(system_nrt_wq, &motg->sm_work);
+out:
+	return status;
+}
+
+const struct file_operations msm_otg_mode_fops = {
+	.open = msm_otg_mode_open,
+	.read = seq_read,
+	.write = msm_otg_mode_write,
+	.llseek = seq_lseek,
+	.release = single_release,
+};
+
+static int msm_otg_show_otg_state(struct seq_file *s, void *unused)
+{
+	struct msm_otg *motg = s->private;
+	struct usb_phy *phy = &motg->phy;
+
+	seq_printf(s, "%s\n", otg_state_string(phy->state));
+	return 0;
+}
+
+static int msm_otg_otg_state_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, msm_otg_show_otg_state, inode->i_private);
+}
+
+const struct file_operations msm_otg_state_fops = {
+	.open = msm_otg_otg_state_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+};
+
+static int msm_otg_show_chg_type(struct seq_file *s, void *unused)
+{
+	struct msm_otg *motg = s->private;
+
+	seq_printf(s, "%s\n", chg_to_string(motg->chg_type));
+	return 0;
+}
+
+static int msm_otg_chg_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, msm_otg_show_chg_type, inode->i_private);
+}
+
+const struct file_operations msm_otg_chg_fops = {
+	.open = msm_otg_chg_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+};
+
+static int msm_otg_aca_show(struct seq_file *s, void *unused)
+{
+	if (debug_aca_enabled)
+		seq_printf(s, "enabled\n");
+	else
+		seq_printf(s, "disabled\n");
+
+	return 0;
+}
+
+static int msm_otg_aca_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, msm_otg_aca_show, inode->i_private);
+}
+
+static ssize_t msm_otg_aca_write(struct file *file, const char __user *ubuf,
+				size_t count, loff_t *ppos)
+{
+	char buf[8];
+
+	memset(buf, 0x00, sizeof(buf));
+
+	if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
+		return -EFAULT;
+
+	if (!strncmp(buf, "enable", 6))
+		debug_aca_enabled = true;
+	else
+		debug_aca_enabled = false;
+
+	return count;
+}
+
+const struct file_operations msm_otg_aca_fops = {
+	.open = msm_otg_aca_open,
+	.read = seq_read,
+	.write = msm_otg_aca_write,
+	.llseek = seq_lseek,
+	.release = single_release,
+};
+
+static int msm_otg_bus_show(struct seq_file *s, void *unused)
+{
+	if (debug_bus_voting_enabled)
+		seq_printf(s, "enabled\n");
+	else
+		seq_printf(s, "disabled\n");
+
+	return 0;
+}
+
+static int msm_otg_bus_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, msm_otg_bus_show, inode->i_private);
+}
+
+static ssize_t msm_otg_bus_write(struct file *file, const char __user *ubuf,
+				size_t count, loff_t *ppos)
+{
+	char buf[8];
+	int ret;
+	struct seq_file *s = file->private_data;
+	struct msm_otg *motg = s->private;
+
+	memset(buf, 0x00, sizeof(buf));
+
+	if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
+		return -EFAULT;
+
+	if (!strncmp(buf, "enable", 6)) {
+		/* Do not vote here. Let OTG statemachine decide when to vote */
+		debug_bus_voting_enabled = true;
+	} else {
+		debug_bus_voting_enabled = false;
+		if (motg->bus_perf_client) {
+			ret = msm_bus_scale_client_update_request(
+					motg->bus_perf_client, 0);
+			if (ret)
+				dev_err(motg->phy.dev, "%s: Failed to devote "
+					   "for bus bw %d\n", __func__, ret);
+		}
+	}
+
+	return count;
+}
+
+const struct file_operations msm_otg_bus_fops = {
+	.open = msm_otg_bus_open,
+	.read = seq_read,
+	.write = msm_otg_bus_write,
+	.llseek = seq_lseek,
+	.release = single_release,
+};
+
+static struct dentry *msm_otg_dbg_root;
+
+static int msm_otg_debugfs_init(struct msm_otg *motg)
+{
+	struct dentry *msm_otg_dentry;
+
+	msm_otg_dbg_root = debugfs_create_dir("msm_otg", NULL);
+
+	if (!msm_otg_dbg_root || IS_ERR(msm_otg_dbg_root))
+		return -ENODEV;
+
+	if (motg->pdata->mode == USB_OTG &&
+		motg->pdata->otg_control == OTG_USER_CONTROL) {
+
+		msm_otg_dentry = debugfs_create_file("mode", S_IRUGO |
+			S_IWUSR, msm_otg_dbg_root, motg,
+			&msm_otg_mode_fops);
+
+		if (!msm_otg_dentry) {
+			debugfs_remove(msm_otg_dbg_root);
+			msm_otg_dbg_root = NULL;
+			return -ENODEV;
+		}
+	}
+
+	msm_otg_dentry = debugfs_create_file("chg_type", S_IRUGO,
+		msm_otg_dbg_root, motg,
+		&msm_otg_chg_fops);
+
+	if (!msm_otg_dentry) {
+		debugfs_remove_recursive(msm_otg_dbg_root);
+		return -ENODEV;
+	}
+
+	msm_otg_dentry = debugfs_create_file("aca", S_IRUGO | S_IWUSR,
+		msm_otg_dbg_root, motg,
+		&msm_otg_aca_fops);
+
+	if (!msm_otg_dentry) {
+		debugfs_remove_recursive(msm_otg_dbg_root);
+		return -ENODEV;
+	}
+
+	msm_otg_dentry = debugfs_create_file("bus_voting", S_IRUGO | S_IWUSR,
+		msm_otg_dbg_root, motg,
+		&msm_otg_bus_fops);
+
+	if (!msm_otg_dentry) {
+		debugfs_remove_recursive(msm_otg_dbg_root);
+		return -ENODEV;
+	}
+
+	msm_otg_dentry = debugfs_create_file("otg_state", S_IRUGO,
+				msm_otg_dbg_root, motg, &msm_otg_state_fops);
+
+	if (!msm_otg_dentry) {
+		debugfs_remove_recursive(msm_otg_dbg_root);
+		return -ENODEV;
+	}
+	return 0;
+}
+
+static void msm_otg_debugfs_cleanup(void)
+{
+	debugfs_remove_recursive(msm_otg_dbg_root);
+}
+
+#if (defined(CONFIG_USB_OTG) && defined(CONFIG_USB_OTG_HOST))
+static struct t_usb_host_status_notifier usb_host_status_notifier = {
+	.name = "usb_host",
+	.func = usb_host_cable_detect,
+};
+#endif
+
+static u64 msm_otg_dma_mask = DMA_BIT_MASK(64);
+static struct platform_device *msm_otg_add_pdev(
+		struct platform_device *ofdev, const char *name)
+{
+	struct platform_device *pdev;
+	const struct resource *res = ofdev->resource;
+	unsigned int num = ofdev->num_resources;
+	int retval;
+
+	pdev = platform_device_alloc(name, -1);
+	if (!pdev) {
+		retval = -ENOMEM;
+		goto error;
+	}
+
+	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+	pdev->dev.dma_mask = &msm_otg_dma_mask;
+
+	if (num) {
+		retval = platform_device_add_resources(pdev, res, num);
+		if (retval)
+			goto error;
+	}
+
+	retval = platform_device_add(pdev);
+	if (retval)
+		goto error;
+
+	return pdev;
+
+error:
+	platform_device_put(pdev);
+	return ERR_PTR(retval);
+}
+
+static int msm_otg_setup_devices(struct platform_device *ofdev,
+		enum usb_mode_type mode, bool init)
+{
+	const char *gadget_name = "msm_hsusb";
+	const char *host_name = "msm_hsusb_host";
+	static struct platform_device *gadget_pdev;
+	static struct platform_device *host_pdev;
+	int retval = 0;
+
+	if (!init) {
+		if (gadget_pdev)
+			platform_device_unregister(gadget_pdev);
+		if (host_pdev)
+			platform_device_unregister(host_pdev);
+		return 0;
+	}
+
+	switch (mode) {
+	case USB_OTG:
+		/* fall through */
+	case USB_PERIPHERAL:
+		gadget_pdev = msm_otg_add_pdev(ofdev, gadget_name);
+		if (IS_ERR(gadget_pdev)) {
+			retval = PTR_ERR(gadget_pdev);
+			break;
+		}
+		if (mode == USB_PERIPHERAL)
+			break;
+		/* fall through */
+	case USB_HOST:
+		host_pdev = msm_otg_add_pdev(ofdev, host_name);
+		if (IS_ERR(host_pdev)) {
+			retval = PTR_ERR(host_pdev);
+			if (mode == USB_OTG)
+				platform_device_unregister(gadget_pdev);
+		}
+		break;
+	default:
+		break;
+	}
+
+	return retval;
+}
+
+struct msm_otg_platform_data *msm_otg_dt_to_pdata(struct platform_device *pdev)
+{
+	struct device_node *node = pdev->dev.of_node;
+	struct msm_otg_platform_data *pdata;
+	int len = 0;
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata) {
+		pr_err("unable to allocate platform data\n");
+		return NULL;
+	}
+	of_get_property(node, "qcom,hsusb-otg-phy-init-seq", &len);
+	if (len) {
+		pdata->phy_init_seq = devm_kzalloc(&pdev->dev, len, GFP_KERNEL);
+		if (!pdata->phy_init_seq)
+			return NULL;
+		of_property_read_u32_array(node, "qcom,hsusb-otg-phy-init-seq",
+				pdata->phy_init_seq,
+				len/sizeof(*pdata->phy_init_seq));
+	}
+	of_property_read_u32(node, "qcom,hsusb-otg-power-budget",
+				&pdata->power_budget);
+	of_property_read_u32(node, "qcom,hsusb-otg-mode",
+				&pdata->mode);
+	of_property_read_u32(node, "qcom,hsusb-otg-otg-control",
+				&pdata->otg_control);
+	of_property_read_u32(node, "qcom,hsusb-otg-default-mode",
+				&pdata->default_mode);
+	of_property_read_u32(node, "qcom,hsusb-otg-phy-type",
+				&pdata->phy_type);
+	of_property_read_u32(node, "qcom,hsusb-otg-pmic-id-irq",
+				&pdata->pmic_id_irq);
+	return pdata;
+}
+
+
+static const char *event_string(enum usb_otg_event event)
+{
+	switch (event) {
+	case OTG_EVENT_DEV_CONN_TMOUT:
+		return "DEV_CONN_TMOUT";
+	case OTG_EVENT_NO_RESP_FOR_HNP_ENABLE:
+		return "NO_RESP_FOR_HNP_ENABLE";
+	case OTG_EVENT_HUB_NOT_SUPPORTED:
+		return "HUB_NOT_SUPPORTED";
+	case OTG_EVENT_DEV_NOT_SUPPORTED:
+		return "DEV_NOT_SUPPORTED";
+	case OTG_EVENT_HNP_FAILED:
+		return "HNP_FAILED";
+	case OTG_EVENT_NO_RESP_FOR_SRP:
+		return "NO_RESP_FOR_SRP";
+	case OTG_EVENT_INSUFFICIENT_POWER:
+		return "DEV_NOT_SUPPORTED";
+	default:
+		return "UNDEFINED";
+	}
+}
+
+static int msm_otg_send_event(struct usb_phy *phy,
+				enum usb_otg_event event)
+{
+	char module_name[16];
+	char udev_event[128];
+	char *envp[] = { module_name, udev_event, NULL };
+	int ret;
+	/* we only broadcast customize event now*/
+	switch (event) {
+	case OTG_EVENT_INSUFFICIENT_POWER:
+	case OTG_EVENT_DEV_NOT_SUPPORTED:
+#if 1
+			USBH_DEBUG("sending %s event\n", event_string(event));
+#endif
+			snprintf(module_name, 16, "MODULE=%s", DRIVER_NAME);
+			snprintf(udev_event, 128, "EVENT=%s", event_string(event));
+			ret = kobject_uevent_env(&phy->dev->kobj, KOBJ_CHANGE, envp);
+#if 1
+			if (ret < 0)
+				USBH_ERR("uevent sending failed with ret = %d\n", ret);
+#endif
+		break;
+	default:
+		return 0;
+		break;
+	}
+	return ret;
+}
+
+
+static int msm_otg_send_event2(struct usb_otg *otg, enum usb_otg_event event){
+	return msm_otg_send_event(otg->phy,event);
+}
+
+static int __init msm_otg_probe(struct platform_device *pdev)
+{
+	int ret = 0;
+	struct resource *res;
+	struct msm_otg *motg;
+	struct usb_phy *phy;
+	struct msm_otg_platform_data *pdata;
+
+	dev_info(&pdev->dev, "msm_otg probe\n");
+
+	if (pdev->dev.of_node) {
+		dev_dbg(&pdev->dev, "device tree enabled\n");
+		pdata = msm_otg_dt_to_pdata(pdev);
+		if (!pdata)
+			return -ENOMEM;
+		ret = msm_otg_setup_devices(pdev, pdata->mode, true);
+		if (ret) {
+			dev_err(&pdev->dev, "devices setup failed\n");
+			return ret;
+		}
+	} else if (!pdev->dev.platform_data) {
+		dev_err(&pdev->dev, "No platform data given. Bailing out\n");
+		return -ENODEV;
+	} else {
+		pdata = pdev->dev.platform_data;
+	}
+
+	motg = kzalloc(sizeof(struct msm_otg), GFP_KERNEL);
+	if (!motg) {
+		dev_err(&pdev->dev, "unable to allocate msm_otg\n");
+		return -ENOMEM;
+	}
+
+	motg->phy.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
+	if (!motg->phy.otg) {
+		dev_err(&pdev->dev, "unable to allocate usb_otg\n");
+		ret = -ENOMEM;
+		goto free_motg;
+	}
+
+	the_msm_otg = motg;
+	motg->pdata = pdata;
+	motg->connect_type_ready = 0;
+	phy = &motg->phy;
+	phy->dev = &pdev->dev;
+	motg->reset_phy_before_lpm = pdata->reset_phy_before_lpm;
+	/*
+	 * ACA ID_GND threshold range is overlapped with OTG ID_FLOAT.  Hence
+	 * PHY treat ACA ID_GND as float and no interrupt is generated.  But
+	 * PMIC can detect ACA ID_GND and generate an interrupt.
+	 */
+	if (aca_enabled() && motg->pdata->otg_control != OTG_PMIC_CONTROL) {
+		dev_err(&pdev->dev, "ACA can not be enabled without PMIC\n");
+		ret = -EINVAL;
+		goto free_otg;
+	}
+
+	/* initialize reset counter */
+	motg->reset_counter = 0;
+
+	/* Some targets don't support PHY clock. */
+	motg->phy_reset_clk = clk_get(&pdev->dev, "phy_clk");
+	if (IS_ERR(motg->phy_reset_clk))
+		dev_err(&pdev->dev, "failed to get phy_clk\n");
+
+	/*
+	 * Targets on which link uses asynchronous reset methodology,
+	 * free running clock is not required during the reset.
+	 */
+	motg->clk = clk_get(&pdev->dev, "alt_core_clk");
+	if (IS_ERR(motg->clk))
+		dev_dbg(&pdev->dev, "alt_core_clk is not present\n");
+	else
+		clk_set_rate(motg->clk, 60000000);
+
+	/*
+	 * USB Core is running its protocol engine based on CORE CLK,
+	 * CORE CLK  must be running at >55Mhz for correct HSUSB
+	 * operation and USB core cannot tolerate frequency changes on
+	 * CORE CLK. For such USB cores, vote for maximum clk frequency
+	 * on pclk source
+	 */
+	motg->core_clk = clk_get(&pdev->dev, "core_clk");
+	if (IS_ERR(motg->core_clk)) {
+		motg->core_clk = NULL;
+		dev_err(&pdev->dev, "failed to get core_clk\n");
+		ret = PTR_ERR(motg->core_clk);
+		goto put_clk;
+	}
+	clk_set_rate(motg->core_clk, INT_MAX);
+
+	motg->pclk = clk_get(&pdev->dev, "iface_clk");
+	if (IS_ERR(motg->pclk)) {
+		dev_err(&pdev->dev, "failed to get iface_clk\n");
+		ret = PTR_ERR(motg->pclk);
+		goto put_core_clk;
+	}
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "failed to get platform resource mem\n");
+		ret = -ENODEV;
+		goto put_pclk;
+	}
+
+	motg->regs = ioremap(res->start, resource_size(res));
+	if (!motg->regs) {
+		dev_err(&pdev->dev, "ioremap failed\n");
+		ret = -ENOMEM;
+		goto put_pclk;
+	}
+	dev_info(&pdev->dev, "OTG regs = %p\n", motg->regs);
+
+	motg->irq = platform_get_irq(pdev, 0);
+	if (!motg->irq) {
+		dev_err(&pdev->dev, "platform_get_irq failed\n");
+		ret = -ENODEV;
+		goto free_regs;
+	}
+
+	motg->xo_handle = msm_xo_get(MSM_XO_TCXO_D0, "usb");
+	if (IS_ERR(motg->xo_handle)) {
+		dev_err(&pdev->dev, "%s not able to get the handle "
+			"to vote for TCXO D0 buffer\n", __func__);
+		ret = PTR_ERR(motg->xo_handle);
+		goto free_regs;
+	}
+
+	ret = msm_xo_mode_vote(motg->xo_handle, MSM_XO_MODE_ON);
+	if (ret) {
+		dev_err(&pdev->dev, "%s failed to vote for TCXO "
+			"D0 buffer%d\n", __func__, ret);
+		goto free_xo_handle;
+	}
+
+	clk_prepare_enable(motg->pclk);
+
+	motg->vdd_type = VDDCX_CORNER;
+	hsusb_vddcx = devm_regulator_get(motg->phy.dev, "hsusb_vdd_dig");
+	if (IS_ERR(hsusb_vddcx)) {
+		hsusb_vddcx = devm_regulator_get(motg->phy.dev, "HSUSB_VDDCX");
+		if (IS_ERR(hsusb_vddcx)) {
+			dev_err(motg->phy.dev, "unable to get hsusb vddcx\n");
+			ret = PTR_ERR(hsusb_vddcx);
+			goto devote_xo_handle;
+		}
+		motg->vdd_type = VDDCX;
+	}
+
+	ret = msm_hsusb_config_vddcx(1);
+	if (ret) {
+		dev_err(&pdev->dev, "hsusb vddcx configuration failed\n");
+		goto devote_xo_handle;
+	}
+
+	ret = regulator_enable(hsusb_vddcx);
+	if (ret) {
+		dev_err(&pdev->dev, "unable to enable the hsusb vddcx\n");
+		goto free_config_vddcx;
+	}
+
+	ret = msm_hsusb_ldo_init(motg, 1);
+	if (ret) {
+		dev_err(&pdev->dev, "hsusb vreg configuration failed\n");
+		goto free_hsusb_vddcx;
+	}
+
+	if (pdata->mhl_enable) {
+		mhl_usb_hs_switch = devm_regulator_get(motg->phy.dev,
+							"mhl_usb_hs_switch");
+		if (IS_ERR(mhl_usb_hs_switch)) {
+			dev_err(&pdev->dev, "Unable to get mhl_usb_hs_switch\n");
+			ret = PTR_ERR(mhl_usb_hs_switch);
+			goto free_ldo_init;
+		}
+	}
+
+	ret = msm_hsusb_ldo_enable(motg, 1);
+	if (ret) {
+		dev_err(&pdev->dev, "hsusb vreg enable failed\n");
+		goto free_ldo_init;
+	}
+	clk_prepare_enable(motg->core_clk);
+
+	writel(0, USB_USBINTR);
+	writel(0, USB_OTGSC);
+	/* Ensure that above STOREs are completed before enabling interrupts */
+	mb();
+
+	motg->usb_wq = create_singlethread_workqueue("msm_hsusb");
+	if (motg->usb_wq == 0) {
+		USB_ERR("fail to create workqueue\n");
+		goto free_ldo_init;
+	}
+
+	wake_lock_init(&motg->wlock, WAKE_LOCK_SUSPEND, "msm_otg");
+	wake_lock_init(&motg->cable_detect_wlock, WAKE_LOCK_SUSPEND, "msm_usb_cable");
+	msm_otg_init_timer(motg);
+	INIT_WORK(&motg->sm_work, msm_otg_sm_work);
+	INIT_WORK(&motg->notifier_work, send_usb_connect_notify);
+	INIT_DELAYED_WORK(&motg->ac_detect_work, ac_detect_expired_work);
+	INIT_DELAYED_WORK(&motg->chg_work, msm_chg_detect_work);
+	INIT_DELAYED_WORK(&motg->pmic_id_status_work, msm_pmic_id_status_w);
+	setup_timer(&motg->id_timer, msm_otg_id_timer_func,
+				(unsigned long) motg);
+	motg->ac_detect_count = 0;
+
+	ret = request_irq(motg->irq, msm_otg_irq, IRQF_SHARED,
+					"msm_otg", motg);
+	if (ret) {
+		dev_err(&pdev->dev, "request irq failed\n");
+		goto destroy_wlock;
+	}
+
+	phy->init = msm_otg_reset;
+	phy->set_power = msm_otg_set_power;
+	phy->set_suspend = msm_otg_set_suspend;
+	phy->notify_usb_attached = msm_otg_notify_usb_attached;
+	phy->io_ops = &msm_otg_io_ops;
+	phy->send_event = msm_otg_send_event;
+	phy->otg->send_event = msm_otg_send_event2;
+	phy->otg->phy = &motg->phy;
+	phy->otg->set_host = msm_otg_set_host;
+	phy->otg->set_peripheral = msm_otg_set_peripheral;
+	phy->otg->start_hnp = msm_otg_start_hnp;
+	phy->otg->start_srp = msm_otg_start_srp;
+
+	ret = usb_set_transceiver(&motg->phy);
+	if (ret) {
+		dev_err(&pdev->dev, "usb_set_transceiver failed\n");
+		goto free_irq;
+	}
+
+	if (motg->pdata->mode == USB_OTG &&
+		motg->pdata->otg_control == OTG_PMIC_CONTROL) {
+		if (motg->pdata->pmic_id_irq) {
+			ret = request_irq(motg->pdata->pmic_id_irq,
+						msm_pmic_id_irq,
+						IRQF_TRIGGER_RISING |
+						IRQF_TRIGGER_FALLING,
+						"msm_otg", motg);
+			if (ret) {
+				dev_err(&pdev->dev, "request irq failed for PMIC ID\n");
+				goto remove_phy;
+			}
+		} else {
+			/* HTC hw design doesn't need the following code. mask it when hw is not EVM*/
+			/*
+			ret = -ENODEV;
+			dev_err(&pdev->dev, "PMIC IRQ for ID notifications doesn't exist\n");
+			goto remove_otg;
+			*/
+			dev_dbg(&pdev->dev, "PMIC IRQ for ID notifications doesn't exist. Maybe monitor id pin by GPIO");
+		}
+	}
+
+	msm_hsusb_mhl_switch_enable(motg, 1);
+
+	platform_set_drvdata(pdev, motg);
+	device_init_wakeup(&pdev->dev, 1);
+	motg->mA_port = IUNIT;
+
+	ret = msm_otg_debugfs_init(motg);
+	if (ret)
+		dev_dbg(&pdev->dev, "mode debugfs file is"
+			"not available\n");
+
+	if (motg->pdata->otg_control == OTG_PMIC_CONTROL)
+		pm8921_charger_register_vbus_sn(&htc_vbus_notify/*&msm_otg_set_vbus_state*/);
+
+#if (defined(CONFIG_USB_OTG) && defined(CONFIG_USB_OTG_HOST))
+	usb_host_detect_register_notifier(&usb_host_status_notifier);
+#endif
+
+	if (motg->pdata->phy_type == SNPS_28NM_INTEGRATED_PHY) {
+#if 0
+		if (motg->pdata->otg_control == OTG_PMIC_CONTROL &&
+			(!(motg->pdata->mode == USB_OTG) ||
+			 motg->pdata->pmic_id_irq))
+			motg->caps = /*ALLOW_PHY_POWER_COLLAPSE |*/ ALLOW_PHY_RETENTION;
+#endif
+
+		if (motg->pdata->otg_control == OTG_PMIC_CONTROL)
+			motg->caps = ALLOW_PHY_RETENTION;
+		if (motg->pdata->otg_control == OTG_PHY_CONTROL)
+			motg->caps = ALLOW_PHY_RETENTION;
+		if (is_msm_otg_support_power_collapse(motg)) {
+			motg->caps |= ALLOW_PHY_POWER_COLLAPSE;
+			USBH_DEBUG("%s support power collapse\n", __func__);
+		}
+	}
+
+
+
+	if (motg->pdata->enable_lpm_on_dev_suspend)
+		motg->caps |= ALLOW_LPM_ON_DEV_SUSPEND;
+
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
+	if (motg->pdata->bus_scale_table) {
+		motg->bus_perf_client =
+		    msm_bus_scale_register_client(motg->pdata->bus_scale_table);
+		if (!motg->bus_perf_client)
+			dev_err(motg->phy.dev, "%s: Failed to register BUS "
+						"scaling client!!\n", __func__);
+		else
+			debug_bus_voting_enabled = true;
+	}
+
+	return 0;
+
+remove_phy:
+	usb_set_transceiver(NULL);
+free_irq:
+	free_irq(motg->irq, motg);
+destroy_wlock:
+	wake_lock_destroy(&motg->wlock);
+	wake_lock_destroy(&motg->cable_detect_wlock);
+	clk_disable_unprepare(motg->core_clk);
+	msm_hsusb_ldo_enable(motg, 0);
+free_ldo_init:
+	msm_hsusb_ldo_init(motg, 0);
+free_hsusb_vddcx:
+	regulator_disable(hsusb_vddcx);
+free_config_vddcx:
+	regulator_set_voltage(hsusb_vddcx,
+		vdd_val[motg->vdd_type][VDD_NONE],
+		vdd_val[motg->vdd_type][VDD_MAX]);
+devote_xo_handle:
+	clk_disable_unprepare(motg->pclk);
+	msm_xo_mode_vote(motg->xo_handle, MSM_XO_MODE_OFF);
+free_xo_handle:
+	msm_xo_put(motg->xo_handle);
+free_regs:
+	iounmap(motg->regs);
+put_pclk:
+	clk_put(motg->pclk);
+put_core_clk:
+	clk_put(motg->core_clk);
+put_clk:
+	if (!IS_ERR(motg->clk))
+		clk_put(motg->clk);
+	if (!IS_ERR(motg->phy_reset_clk))
+		clk_put(motg->phy_reset_clk);
+free_otg:
+	kfree(motg->phy.otg);
+free_motg:
+	kfree(motg);
+	return ret;
+}
+
+static int __devexit msm_otg_remove(struct platform_device *pdev)
+{
+	struct msm_otg *motg = platform_get_drvdata(pdev);
+	struct usb_otg *otg = motg->phy.otg;
+	int cnt = 0;
+
+	if (otg->host || otg->gadget)
+		return -EBUSY;
+
+	USB_INFO("%s\n", __func__);
+
+	if (pdev->dev.of_node)
+		msm_otg_setup_devices(pdev, motg->pdata->mode, false);
+	if (motg->pdata->otg_control == OTG_PMIC_CONTROL)
+		pm8921_charger_unregister_vbus_sn(0);
+	msm_otg_debugfs_cleanup();
+	cancel_delayed_work_sync(&motg->chg_work);
+	cancel_delayed_work_sync(&motg->pmic_id_status_work);
+	cancel_work_sync(&motg->sm_work);
+
+	pm_runtime_resume(&pdev->dev);
+
+	device_init_wakeup(&pdev->dev, 0);
+	pm_runtime_disable(&pdev->dev);
+	wake_lock_destroy(&motg->wlock);
+	wake_lock_destroy(&motg->cable_detect_wlock);
+
+	msm_hsusb_mhl_switch_enable(motg, 0);
+	if (motg->pdata->pmic_id_irq)
+		free_irq(motg->pdata->pmic_id_irq, motg);
+	usb_set_transceiver(NULL);
+	free_irq(motg->irq, motg);
+
+	/*
+	 * Put PHY in low power mode.
+	 */
+	ulpi_read(otg->phy, 0x14);
+	ulpi_write(otg->phy, 0x08, 0x09);
+
+	writel(readl(USB_PORTSC) | PORTSC_PHCD, USB_PORTSC);
+	while (cnt < PHY_SUSPEND_TIMEOUT_USEC) {
+		if (readl(USB_PORTSC) & PORTSC_PHCD)
+			break;
+		udelay(1);
+		cnt++;
+	}
+	if (cnt >= PHY_SUSPEND_TIMEOUT_USEC)
+		dev_err(otg->phy->dev, "Unable to suspend PHY\n");
+
+	clk_disable_unprepare(motg->pclk);
+	clk_disable_unprepare(motg->core_clk);
+	msm_xo_put(motg->xo_handle);
+	msm_hsusb_ldo_enable(motg, 0);
+	msm_hsusb_ldo_init(motg, 0);
+	regulator_disable(hsusb_vddcx);
+	regulator_set_voltage(hsusb_vddcx,
+		vdd_val[motg->vdd_type][VDD_NONE],
+		vdd_val[motg->vdd_type][VDD_MAX]);
+
+	iounmap(motg->regs);
+	pm_runtime_set_suspended(&pdev->dev);
+
+	if (!IS_ERR(motg->phy_reset_clk))
+		clk_put(motg->phy_reset_clk);
+	clk_put(motg->pclk);
+	if (!IS_ERR(motg->clk))
+		clk_put(motg->clk);
+	clk_put(motg->core_clk);
+
+	if (motg->bus_perf_client)
+		msm_bus_scale_unregister_client(motg->bus_perf_client);
+
+	kfree(motg->phy.otg);
+	kfree(motg);
+	return 0;
+}
+
+#ifdef CONFIG_PM_RUNTIME
+static int msm_otg_runtime_idle(struct device *dev)
+{
+	struct msm_otg *motg = dev_get_drvdata(dev);
+	struct usb_phy *phy = &motg->phy;
+
+	dev_dbg(dev, "OTG runtime idle\n");
+
+	if (phy->state == OTG_STATE_UNDEFINED)
+		return -EAGAIN;
+	else
+		return 0;
+}
+
+static int msm_otg_runtime_suspend(struct device *dev)
+{
+	struct msm_otg *motg = dev_get_drvdata(dev);
+
+	dev_dbg(dev, "OTG runtime suspend\n");
+	return msm_otg_suspend(motg);
+}
+
+static int msm_otg_runtime_resume(struct device *dev)
+{
+	struct msm_otg *motg = dev_get_drvdata(dev);
+
+	dev_dbg(dev, "OTG runtime resume\n");
+	pm_runtime_get_noresume(dev);
+	return msm_otg_resume(motg);
+}
+#endif
+
+#ifdef CONFIG_PM_SLEEP
+static int msm_otg_pm_suspend(struct device *dev)
+{
+	int ret = 0;
+	struct msm_otg *motg = dev_get_drvdata(dev);
+
+	dev_dbg(dev, "OTG PM suspend\n");
+
+	atomic_set(&motg->pm_suspended, 1);
+	ret = msm_otg_suspend(motg);
+	if (ret)
+		atomic_set(&motg->pm_suspended, 0);
+
+	return ret;
+}
+
+static int msm_otg_pm_resume(struct device *dev)
+{
+	int ret = 0;
+	struct msm_otg *motg = dev_get_drvdata(dev);
+
+	dev_dbg(dev, "OTG PM resume\n");
+
+	atomic_set(&motg->pm_suspended, 0);
+	if (motg->sm_work_pending) {
+		motg->sm_work_pending = false;
+
+		pm_runtime_get_noresume(dev);
+		ret = msm_otg_resume(motg);
+
+		/* Update runtime PM status */
+		pm_runtime_disable(dev);
+		pm_runtime_set_active(dev);
+		pm_runtime_enable(dev);
+
+		queue_work(system_nrt_wq, &motg->sm_work);
+	}
+
+	return ret;
+}
+#endif
+
+#ifdef CONFIG_PM
+static const struct dev_pm_ops msm_otg_dev_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(msm_otg_pm_suspend, msm_otg_pm_resume)
+	SET_RUNTIME_PM_OPS(msm_otg_runtime_suspend, msm_otg_runtime_resume,
+				msm_otg_runtime_idle)
+};
+#endif
+
+static struct of_device_id msm_otg_dt_match[] = {
+	{	.compatible = "qcom,hsusb-otg",
+	},
+	{}
+};
+
+static struct platform_driver msm_otg_driver = {
+	.remove = __devexit_p(msm_otg_remove),
+	.driver = {
+		.name = DRIVER_NAME,
+		.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm = &msm_otg_dev_pm_ops,
+#endif
+		.of_match_table = msm_otg_dt_match,
+	},
+};
+
+static int __init msm_otg_init(void)
+{
+	return platform_driver_probe(&msm_otg_driver, msm_otg_probe);
+}
+
+static void __exit msm_otg_exit(void)
+{
+	platform_driver_unregister(&msm_otg_driver);
+}
+
+module_init(msm_otg_init);
+module_exit(msm_otg_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("MSM USB transceiver driver");
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index ec30f95..53e7e69 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -82,6 +82,7 @@
 	{ USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */
 	{ USB_DEVICE(0x10C4, 0x806F) }, /* IMS USB to RS422 Converter Cable */
 	{ USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */
+	{ USB_DEVICE(0x10C4, 0x80C4) }, /* Cygnal Integrated Products, Inc., Optris infrared thermometer */
 	{ USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */
 	{ USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */
 	{ USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */
@@ -92,6 +93,7 @@
 	{ USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
 	{ USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */
 	{ USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
+	{ USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */
 	{ USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */
 	{ USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */
 	{ USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */
@@ -133,7 +135,13 @@
 	{ USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */
 	{ USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */
 	{ USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */
+	{ USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */
+	{ USB_DEVICE(0x166A, 0x0301) }, /* Clipsal 5800PC C-Bus Wireless PC Interface */
 	{ USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
+	{ USB_DEVICE(0x166A, 0x0304) }, /* Clipsal 5000CT2 C-Bus Black and White Touchscreen */
+	{ USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */
+	{ USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */
+	{ USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */
 	{ USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
 	{ USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */
 	{ USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */
@@ -145,7 +153,11 @@
 	{ USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
 	{ USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
 	{ USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
+	{ USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */
+	{ USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */
 	{ USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
+	{ USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */
+	{ USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
 	{ USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
 	{ } /* Terminating Entry */
 };
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 02e7f2d..f5819cb 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -737,6 +737,7 @@
 	{ USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) },
 	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) },
+	{ USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_RTS01_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) },
 	{ USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
@@ -809,6 +810,8 @@
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
 	{ USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) },
 	{ USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) },
+	{ USB_DEVICE(PI_VID, PI_E861_PID) },
+	{ USB_DEVICE(KONDO_VID, KONDO_USB_SERIAL_PID) },
 	{ USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
 	{ USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 0838baf8..5dd96ca 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -784,6 +784,22 @@
 #define RTSYSTEMS_VID			0x2100	/* Vendor ID */
 #define RTSYSTEMS_SERIAL_VX7_PID	0x9e52	/* Serial converter for VX-7 Radios using FT232RL */
 #define RTSYSTEMS_CT29B_PID		0x9e54	/* CT29B Radio Cable */
+#define RTSYSTEMS_RTS01_PID		0x9e57	/* USB-RTS01 Radio Cable */
+
+
+/*
+ * Physik Instrumente
+ * http://www.physikinstrumente.com/en/products/
+ */
+#define PI_VID              0x1a72  /* Vendor ID */
+#define PI_E861_PID         0x1008  /* E-861 piezo controller USB connection */
+
+/*
+ * Kondo Kagaku Co.Ltd.
+ * http://www.kondo-robot.com/EN
+ */
+#define KONDO_VID 		0x165c
+#define KONDO_USB_SERIAL_PID	0x0002
 
 /*
  * Bayer Ascensia Contour blood glucose meter USB-converter cable.
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 6edd261..ef4d7ad 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -317,13 +317,16 @@
 			MCT_U232_SET_REQUEST_TYPE,
 			0, 0, buf, MCT_U232_SET_MODEM_CTRL_SIZE,
 			WDR_TIMEOUT);
-	if (rc < 0)
-		dev_err(&serial->dev->dev,
-			"Set MODEM CTRL 0x%x failed (error = %d)\n", mcr, rc);
+	kfree(buf);
+
 	dbg("set_modem_ctrl: state=0x%x ==> mcr=0x%x", control_state, mcr);
 
-	kfree(buf);
-	return rc;
+	if (rc < 0) {
+		dev_err(&serial->dev->dev,
+			"Set MODEM CTRL 0x%x failed (error = %d)\n", mcr, rc);
+		return rc;
+	}
+	return 0;
 } /* mct_u232_set_modem_ctrl */
 
 static int mct_u232_get_modem_stat(struct usb_serial *serial,
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c
index 08d16e8..7c14671 100644
--- a/drivers/usb/serial/metro-usb.c
+++ b/drivers/usb/serial/metro-usb.c
@@ -171,14 +171,6 @@
 	metro_priv->throttled = 0;
 	spin_unlock_irqrestore(&metro_priv->lock, flags);
 
-	/*
-	 * Force low_latency on so that our tty_push actually forces the data
-	 * through, otherwise it is scheduled, and with high data rates (like
-	 * with OHCI) data can get lost.
-	 */
-	if (tty)
-		tty->low_latency = 1;
-
 	/* Clear the urb pipe. */
 	usb_clear_halt(serial->dev, port->interrupt_in_urb->pipe);
 
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index c526550..c1505c3 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -206,7 +206,7 @@
 	{}			/* terminating entry */
 };
 
-static const struct usb_device_id moschip_id_table_combined[] __devinitconst = {
+static const struct usb_device_id moschip_id_table_combined[] = {
 	{USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)},
 	{USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
 	{USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)},
@@ -1189,9 +1189,12 @@
 	}
 
 	spin_lock_irqsave(&mos7840_port->pool_lock, flags);
-	for (i = 0; i < NUM_URBS; ++i)
-		if (mos7840_port->busy[i])
-			chars += URB_TRANSFER_BUFFER_SIZE;
+	for (i = 0; i < NUM_URBS; ++i) {
+		if (mos7840_port->busy[i]) {
+			struct urb *urb = mos7840_port->write_urb_pool[i];
+			chars += urb->transfer_buffer_length;
+		}
+	}
 	spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
 	dbg("%s - returns %d", __func__, chars);
 	return chars;
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index f4465cc..ee693cc 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -47,6 +47,7 @@
 /* Function prototypes */
 static int  option_probe(struct usb_serial *serial,
 			const struct usb_device_id *id);
+static void option_release(struct usb_serial *serial);
 static int option_send_setup(struct usb_serial_port *port);
 static void option_instat_callback(struct urb *urb);
 
@@ -79,84 +80,9 @@
 #define OPTION_PRODUCT_GTM380_MODEM		0x7201
 
 #define HUAWEI_VENDOR_ID			0x12D1
-#define HUAWEI_PRODUCT_E600			0x1001
-#define HUAWEI_PRODUCT_E220			0x1003
-#define HUAWEI_PRODUCT_E220BIS			0x1004
-#define HUAWEI_PRODUCT_E1401			0x1401
-#define HUAWEI_PRODUCT_E1402			0x1402
-#define HUAWEI_PRODUCT_E1403			0x1403
-#define HUAWEI_PRODUCT_E1404			0x1404
-#define HUAWEI_PRODUCT_E1405			0x1405
-#define HUAWEI_PRODUCT_E1406			0x1406
-#define HUAWEI_PRODUCT_E1407			0x1407
-#define HUAWEI_PRODUCT_E1408			0x1408
-#define HUAWEI_PRODUCT_E1409			0x1409
-#define HUAWEI_PRODUCT_E140A			0x140A
-#define HUAWEI_PRODUCT_E140B			0x140B
-#define HUAWEI_PRODUCT_E140C			0x140C
-#define HUAWEI_PRODUCT_E140D			0x140D
-#define HUAWEI_PRODUCT_E140E			0x140E
-#define HUAWEI_PRODUCT_E140F			0x140F
-#define HUAWEI_PRODUCT_E1410			0x1410
-#define HUAWEI_PRODUCT_E1411			0x1411
-#define HUAWEI_PRODUCT_E1412			0x1412
-#define HUAWEI_PRODUCT_E1413			0x1413
-#define HUAWEI_PRODUCT_E1414			0x1414
-#define HUAWEI_PRODUCT_E1415			0x1415
-#define HUAWEI_PRODUCT_E1416			0x1416
-#define HUAWEI_PRODUCT_E1417			0x1417
-#define HUAWEI_PRODUCT_E1418			0x1418
-#define HUAWEI_PRODUCT_E1419			0x1419
-#define HUAWEI_PRODUCT_E141A			0x141A
-#define HUAWEI_PRODUCT_E141B			0x141B
-#define HUAWEI_PRODUCT_E141C			0x141C
-#define HUAWEI_PRODUCT_E141D			0x141D
-#define HUAWEI_PRODUCT_E141E			0x141E
-#define HUAWEI_PRODUCT_E141F			0x141F
-#define HUAWEI_PRODUCT_E1420			0x1420
-#define HUAWEI_PRODUCT_E1421			0x1421
-#define HUAWEI_PRODUCT_E1422			0x1422
-#define HUAWEI_PRODUCT_E1423			0x1423
-#define HUAWEI_PRODUCT_E1424			0x1424
-#define HUAWEI_PRODUCT_E1425			0x1425
-#define HUAWEI_PRODUCT_E1426			0x1426
-#define HUAWEI_PRODUCT_E1427			0x1427
-#define HUAWEI_PRODUCT_E1428			0x1428
-#define HUAWEI_PRODUCT_E1429			0x1429
-#define HUAWEI_PRODUCT_E142A			0x142A
-#define HUAWEI_PRODUCT_E142B			0x142B
-#define HUAWEI_PRODUCT_E142C			0x142C
-#define HUAWEI_PRODUCT_E142D			0x142D
-#define HUAWEI_PRODUCT_E142E			0x142E
-#define HUAWEI_PRODUCT_E142F			0x142F
-#define HUAWEI_PRODUCT_E1430			0x1430
-#define HUAWEI_PRODUCT_E1431			0x1431
-#define HUAWEI_PRODUCT_E1432			0x1432
-#define HUAWEI_PRODUCT_E1433			0x1433
-#define HUAWEI_PRODUCT_E1434			0x1434
-#define HUAWEI_PRODUCT_E1435			0x1435
-#define HUAWEI_PRODUCT_E1436			0x1436
-#define HUAWEI_PRODUCT_E1437			0x1437
-#define HUAWEI_PRODUCT_E1438			0x1438
-#define HUAWEI_PRODUCT_E1439			0x1439
-#define HUAWEI_PRODUCT_E143A			0x143A
-#define HUAWEI_PRODUCT_E143B			0x143B
-#define HUAWEI_PRODUCT_E143C			0x143C
-#define HUAWEI_PRODUCT_E143D			0x143D
-#define HUAWEI_PRODUCT_E143E			0x143E
-#define HUAWEI_PRODUCT_E143F			0x143F
 #define HUAWEI_PRODUCT_K4505			0x1464
 #define HUAWEI_PRODUCT_K3765			0x1465
-#define HUAWEI_PRODUCT_E14AC			0x14AC
-#define HUAWEI_PRODUCT_K3806			0x14AE
 #define HUAWEI_PRODUCT_K4605			0x14C6
-#define HUAWEI_PRODUCT_K3770			0x14C9
-#define HUAWEI_PRODUCT_K3771			0x14CA
-#define HUAWEI_PRODUCT_K4510			0x14CB
-#define HUAWEI_PRODUCT_K4511			0x14CC
-#define HUAWEI_PRODUCT_ETS1220			0x1803
-#define HUAWEI_PRODUCT_E353			0x1506
-#define HUAWEI_PRODUCT_E173S			0x1C05
 
 #define QUANTA_VENDOR_ID			0x0408
 #define QUANTA_PRODUCT_Q101			0xEA02
@@ -234,6 +160,7 @@
 #define NOVATELWIRELESS_PRODUCT_G1		0xA001
 #define NOVATELWIRELESS_PRODUCT_G1_M		0xA002
 #define NOVATELWIRELESS_PRODUCT_G2		0xA010
+#define NOVATELWIRELESS_PRODUCT_MC551		0xB001
 
 /* AMOI PRODUCTS */
 #define AMOI_VENDOR_ID				0x1614
@@ -425,7 +352,7 @@
 #define SAMSUNG_VENDOR_ID                       0x04e8
 #define SAMSUNG_PRODUCT_GT_B3730                0x6889
 
-/* YUGA products  www.yuga-info.com*/
+/* YUGA products  www.yuga-info.com gavin.kx@qq.com */
 #define YUGA_VENDOR_ID				0x257A
 #define YUGA_PRODUCT_CEM600			0x1601
 #define YUGA_PRODUCT_CEM610			0x1602
@@ -442,6 +369,8 @@
 #define YUGA_PRODUCT_CEU516			0x160C
 #define YUGA_PRODUCT_CEU528			0x160D
 #define YUGA_PRODUCT_CEU526			0x160F
+#define YUGA_PRODUCT_CEU881			0x161F
+#define YUGA_PRODUCT_CEU882			0x162F
 
 #define YUGA_PRODUCT_CWM600			0x2601
 #define YUGA_PRODUCT_CWM610			0x2602
@@ -457,23 +386,26 @@
 #define YUGA_PRODUCT_CWU518			0x260B
 #define YUGA_PRODUCT_CWU516			0x260C
 #define YUGA_PRODUCT_CWU528			0x260D
+#define YUGA_PRODUCT_CWU581			0x260E
 #define YUGA_PRODUCT_CWU526			0x260F
+#define YUGA_PRODUCT_CWU582			0x261F
+#define YUGA_PRODUCT_CWU583			0x262F
 
-#define YUGA_PRODUCT_CLM600			0x2601
-#define YUGA_PRODUCT_CLM610			0x2602
-#define YUGA_PRODUCT_CLM500			0x2603
-#define YUGA_PRODUCT_CLM510			0x2604
-#define YUGA_PRODUCT_CLM800			0x2605
-#define YUGA_PRODUCT_CLM900			0x2606
+#define YUGA_PRODUCT_CLM600			0x3601
+#define YUGA_PRODUCT_CLM610			0x3602
+#define YUGA_PRODUCT_CLM500			0x3603
+#define YUGA_PRODUCT_CLM510			0x3604
+#define YUGA_PRODUCT_CLM800			0x3605
+#define YUGA_PRODUCT_CLM900			0x3606
 
-#define YUGA_PRODUCT_CLU718			0x2607
-#define YUGA_PRODUCT_CLU716			0x2608
-#define YUGA_PRODUCT_CLU728			0x2609
-#define YUGA_PRODUCT_CLU726			0x260A
-#define YUGA_PRODUCT_CLU518			0x260B
-#define YUGA_PRODUCT_CLU516			0x260C
-#define YUGA_PRODUCT_CLU528			0x260D
-#define YUGA_PRODUCT_CLU526			0x260F
+#define YUGA_PRODUCT_CLU718			0x3607
+#define YUGA_PRODUCT_CLU716			0x3608
+#define YUGA_PRODUCT_CLU728			0x3609
+#define YUGA_PRODUCT_CLU726			0x360A
+#define YUGA_PRODUCT_CLU518			0x360B
+#define YUGA_PRODUCT_CLU516			0x360C
+#define YUGA_PRODUCT_CLU528			0x360D
+#define YUGA_PRODUCT_CLU526			0x360F
 
 /* Viettel products */
 #define VIETTEL_VENDOR_ID			0x2262
@@ -489,6 +421,19 @@
 
 /* MediaTek products */
 #define MEDIATEK_VENDOR_ID			0x0e8d
+#define MEDIATEK_PRODUCT_DC_1COM		0x00a0
+#define MEDIATEK_PRODUCT_DC_4COM		0x00a5
+#define MEDIATEK_PRODUCT_DC_5COM		0x00a4
+#define MEDIATEK_PRODUCT_7208_1COM		0x7101
+#define MEDIATEK_PRODUCT_7208_2COM		0x7102
+#define MEDIATEK_PRODUCT_FP_1COM		0x0003
+#define MEDIATEK_PRODUCT_FP_2COM		0x0023
+#define MEDIATEK_PRODUCT_FPDC_1COM		0x0043
+#define MEDIATEK_PRODUCT_FPDC_2COM		0x0033
+
+/* Cellient products */
+#define CELLIENT_VENDOR_ID			0x2692
+#define CELLIENT_PRODUCT_MEN200			0x9005
 
 /* some devices interfaces need special handling due to a number of reasons */
 enum option_blacklist_reason {
@@ -542,6 +487,10 @@
 	.reserved = BIT(1),
 };
 
+static const struct option_blacklist_info net_intf2_blacklist = {
+	.reserved = BIT(2),
+};
+
 static const struct option_blacklist_info net_intf3_blacklist = {
 	.reserved = BIT(3),
 };
@@ -590,99 +539,123 @@
 	{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLX) },
 	{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GKE) },
 	{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1402, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1404, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1407, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140A, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140B, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140C, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140D, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140E, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140F, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141A, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141B, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141C, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141D, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141E, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141F, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1420, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1421, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1422, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1423, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1424, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1425, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1426, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1427, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1428, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1429, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142A, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142B, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142C, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142D, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142E, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142F, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1430, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1431, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1432, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1433, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1434, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1435, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1436, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1437, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1438, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1439, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143A, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143B, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143C, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff),
 		.driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff),
 		.driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3806, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff),
 		.driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x31) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x32) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x31) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x32) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4510, 0xff, 0x01, 0x31) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4510, 0xff, 0x01, 0x32) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4511, 0xff, 0x01, 0x31) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4511, 0xff, 0x01, 0x32) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x02) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x03) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x10) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x12) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x13) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x01) },  /* E398 3G Modem */
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x02) },  /* E398 3G PC UI Interface */
-	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x03) },  /* E398 3G Application Interface */
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x01) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x02) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x03) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x04) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x05) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x06) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0D) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0E) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0F) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x10) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x12) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x13) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x14) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x15) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x17) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x18) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x19) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x1A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x1B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x1C) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x31) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x32) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x33) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x34) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x35) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x36) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3D) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3E) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3F) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x48) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x49) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x4A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x4B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x4C) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x61) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x62) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x63) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x64) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x65) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x66) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6D) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6E) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6F) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x78) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x79) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7C) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x01) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x02) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x03) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x04) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x05) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x06) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0D) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0E) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0F) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x10) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x12) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x13) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x14) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x15) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x17) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x18) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x19) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x1A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x1B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x1C) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x31) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x32) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x33) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x34) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x35) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x36) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3D) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3E) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3F) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x48) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x49) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x4A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x4B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x4C) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x61) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x62) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x63) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x64) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x65) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x66) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6D) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6E) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6F) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x78) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x79) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7A) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7B) },
+	{ USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7C) },
+
+
 	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) },
 	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) },
 	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) },
@@ -722,6 +695,8 @@
 	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1) },
 	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1_M) },
 	{ USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) },
+	/* Novatel Ovation MC551 a.k.a. Verizon USB551L */
+	{ USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) },
 
 	{ USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
 	{ USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },
@@ -904,11 +879,15 @@
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff),
 	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
 	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
 	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1018, 0xff, 0xff, 0xff),
+	  .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) },
@@ -1080,6 +1059,8 @@
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff),
+		.driver_info = (kernel_ulong_t)&net_intf2_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff,
 	  0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
@@ -1209,6 +1190,11 @@
 	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU516) },
 	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU528) },
 	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) },
+	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU881) },
+	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU882) },
+	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU581) },
+	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU582) },
+	{ USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU583) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZD_VENDOR_ID, ZD_PRODUCT_7000, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE(LG_VENDOR_ID, LG_PRODUCT_L02C) }, /* docomo L-02C modem */
@@ -1216,6 +1202,18 @@
 	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x02, 0x01) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x00, 0x00) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x02, 0x01) },        /* MediaTek MT6276M modem & app port */
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_1COM, 0x0a, 0x00, 0x00) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_5COM, 0xff, 0x02, 0x01) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_5COM, 0xff, 0x00, 0x00) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM, 0xff, 0x02, 0x01) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM, 0xff, 0x00, 0x00) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7208_1COM, 0x02, 0x00, 0x00) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7208_2COM, 0x02, 0x02, 0x01) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_1COM, 0x0a, 0x00, 0x00) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_2COM, 0x0a, 0x00, 0x00) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) },
+	{ USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
 	{ } /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, option_ids);
@@ -1257,7 +1255,7 @@
 	.ioctl             = usb_wwan_ioctl,
 	.attach            = usb_wwan_startup,
 	.disconnect        = usb_wwan_disconnect,
-	.release           = usb_wwan_release,
+	.release           = option_release,
 	.read_int_callback = option_instat_callback,
 #ifdef CONFIG_PM
 	.suspend           = usb_wwan_suspend,
@@ -1271,35 +1269,6 @@
 
 static bool debug;
 
-/* per port private data */
-
-#define N_IN_URB 4
-#define N_OUT_URB 4
-#define IN_BUFLEN 4096
-#define OUT_BUFLEN 4096
-
-struct option_port_private {
-	/* Input endpoints and buffer for this port */
-	struct urb *in_urbs[N_IN_URB];
-	u8 *in_buffer[N_IN_URB];
-	/* Output endpoints and buffer for this port */
-	struct urb *out_urbs[N_OUT_URB];
-	u8 *out_buffer[N_OUT_URB];
-	unsigned long out_busy;		/* Bit vector of URBs in use */
-	int opened;
-	struct usb_anchor delayed;
-
-	/* Settings for the port */
-	int rts_state;	/* Handshaking pins (outputs) */
-	int dtr_state;
-	int cts_state;	/* Handshaking pins (inputs) */
-	int dsr_state;
-	int dcd_state;
-	int ri_state;
-
-	unsigned long tx_start_time[N_OUT_URB];
-};
-
 module_usb_serial_driver(option_driver, serial_drivers);
 
 static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason,
@@ -1368,12 +1337,22 @@
 	return 0;
 }
 
+static void option_release(struct usb_serial *serial)
+{
+	struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);
+
+	usb_wwan_release(serial);
+
+	kfree(priv);
+}
+
 static void option_instat_callback(struct urb *urb)
 {
 	int err;
 	int status = urb->status;
 	struct usb_serial_port *port =  urb->context;
-	struct option_port_private *portdata = usb_get_serial_port_data(port);
+	struct usb_wwan_port_private *portdata =
+					usb_get_serial_port_data(port);
 
 	dbg("%s", __func__);
 	dbg("%s: urb %p port %p has data %p", __func__, urb, port, portdata);
@@ -1434,7 +1413,7 @@
 	struct usb_serial *serial = port->serial;
 	struct usb_wwan_intf_private *intfdata =
 		(struct usb_wwan_intf_private *) serial->private;
-	struct option_port_private *portdata;
+	struct usb_wwan_port_private *portdata;
 	int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
 	int val = 0;
 	dbg("%s", __func__);
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index fd6c48d..f5b2c95 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -105,7 +105,13 @@
 	{USB_DEVICE(0x1410, 0xa021)},	/* Novatel Gobi 3000 Composite */
 	{USB_DEVICE(0x413c, 0x8193)},	/* Dell Gobi 3000 QDL */
 	{USB_DEVICE(0x413c, 0x8194)},	/* Dell Gobi 3000 Composite */
+	{USB_DEVICE(0x1199, 0x9010)},	/* Sierra Wireless Gobi 3000 QDL */
+	{USB_DEVICE(0x1199, 0x9012)},	/* Sierra Wireless Gobi 3000 QDL */
 	{USB_DEVICE(0x1199, 0x9013)},	/* Sierra Wireless Gobi 3000 Modem device (MC8355) */
+	{USB_DEVICE(0x1199, 0x9014)},	/* Sierra Wireless Gobi 3000 QDL */
+	{USB_DEVICE(0x1199, 0x9015)},	/* Sierra Wireless Gobi 3000 Modem device */
+	{USB_DEVICE(0x1199, 0x9018)},	/* Sierra Wireless Gobi 3000 QDL */
+	{USB_DEVICE(0x1199, 0x9019)},	/* Sierra Wireless Gobi 3000 Modem device */
 	{USB_DEVICE(0x12D1, 0x14F0)},	/* Sony Gobi 3000 QDL */
 	{USB_DEVICE(0x12D1, 0x14F1)},	/* Sony Gobi 3000 Composite */
 	{USB_DEVICE(0x05c6, 0x9048)},	/* MDM9x15 device */
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 8c8bf80..449bf6d 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -304,6 +304,10 @@
 	{ USB_DEVICE(0x1199, 0x68A3), 	/* Sierra Wireless Direct IP modems */
 	  .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
 	},
+	/* AT&T Direct IP LTE modems */
+	{ USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF),
+	  .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
+	},
 	{ USB_DEVICE(0x0f3d, 0x68A3), 	/* Airprime/Sierra Wireless Direct IP modems */
 	  .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
 	},
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index ab74123..3377437 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -165,7 +165,7 @@
 /* the array dimension is the number of default entries plus */
 /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */
 /* null entry */
-static struct usb_device_id ti_id_table_3410[14+TI_EXTRA_VID_PID_COUNT+1] = {
+static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = {
 	{ USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
 	{ USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
 	{ USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -180,6 +180,7 @@
 	{ USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
 	{ USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
 	{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
+	{ USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
 };
 
 static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
@@ -189,7 +190,7 @@
 	{ USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
 };
 
-static struct usb_device_id ti_id_table_combined[18+2*TI_EXTRA_VID_PID_COUNT+1] = {
+static struct usb_device_id ti_id_table_combined[19+2*TI_EXTRA_VID_PID_COUNT+1] = {
 	{ USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
 	{ USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
 	{ USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -208,6 +209,7 @@
 	{ USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
 	{ USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
 	{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
+	{ USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
 	{ }
 };
 
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
index f140f1b..b353e7e 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.h
+++ b/drivers/usb/serial/ti_usb_3410_5052.h
@@ -37,6 +37,7 @@
 #define TI_5152_BOOT_PRODUCT_ID		0x5152	/* no EEPROM, no firmware */
 #define TI_5052_EEPROM_PRODUCT_ID	0x505A	/* EEPROM, no firmware */
 #define TI_5052_FIRMWARE_PRODUCT_ID	0x505F	/* firmware is running */
+#define FRI2_PRODUCT_ID			0x5053  /* Fish River Island II */
 
 /* Multi-Tech vendor and product ids */
 #define MTS_VENDOR_ID			0x06E0
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 97355a1..bcf2617 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -670,12 +670,14 @@
 static struct usb_serial_driver *search_serial_device(
 					struct usb_interface *iface)
 {
-	const struct usb_device_id *id;
+	const struct usb_device_id *id = NULL;
 	struct usb_serial_driver *drv;
+	struct usb_driver *driver = to_usb_driver(iface->dev.driver);
 
 	/* Check if the usb id matches a known device */
 	list_for_each_entry(drv, &usb_serial_driver_list, driver_list) {
-		id = get_iface_id(drv, iface);
+		if (drv->usb_driver == driver)
+			id = get_iface_id(drv, iface);
 		if (id)
 			return drv;
 	}
@@ -1338,7 +1340,6 @@
 				driver->description);
 		return -EINVAL;
 	}
-	driver->usb_driver->supports_autosuspend = 1;
 
 	/* Add this device to our list of devices */
 	mutex_lock(&table_lock);
@@ -1373,7 +1374,7 @@
  * @serial_drivers: NULL-terminated array of pointers to drivers to be registered
  *
  * Registers @udriver and all the drivers in the @serial_drivers array.
- * Automatically fills in the .no_dynamic_id field in @udriver and
+ * Automatically fills in the .no_dynamic_id and PM fields in @udriver and
  * the .usb_driver field in each serial driver.
  */
 int usb_serial_register_drivers(struct usb_driver *udriver,
@@ -1392,11 +1393,17 @@
 	 * the serial drivers are registered, because the probe would
 	 * simply fail for lack of a matching serial driver.
 	 * Therefore save off udriver's id_table until we are all set.
+	 *
+	 * Suspend/resume support is implemented in the usb-serial core,
+	 * so fill in the PM-related fields in udriver.
 	 */
 	saved_id_table = udriver->id_table;
 	udriver->id_table = NULL;
 
 	udriver->no_dynamic_id = 1;
+	udriver->supports_autosuspend = 1;
+	udriver->suspend = usb_serial_suspend;
+	udriver->resume = usb_serial_resume;
 	rc = usb_register(udriver);
 	if (rc)
 		return rc;
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index a324a5d..11418da 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -202,6 +202,12 @@
 		if (us->fflags & US_FL_NO_READ_CAPACITY_16)
 			sdev->no_read_capacity_16 = 1;
 
+		/*
+		 * Many devices do not respond properly to READ_CAPACITY_16.
+		 * Tell the SCSI layer to try READ_CAPACITY_10 first.
+		 */
+		sdev->try_rc_10_first = 1;
+
 		/* assume SPC3 or latter devices support sense size > 18 */
 		if (sdev->scsi_level > SCSI_SPC_2)
 			us->fflags |= US_FL_SANE_SENSE;
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 8ec8a6e..f98ba40 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -58,9 +58,6 @@
 	SUBMIT_DATA_OUT_URB	= (1 << 5),
 	ALLOC_CMD_URB		= (1 << 6),
 	SUBMIT_CMD_URB		= (1 << 7),
-	COMPLETED_DATA_IN	= (1 << 8),
-	COMPLETED_DATA_OUT	= (1 << 9),
-	DATA_COMPLETES_CMD	= (1 << 10),
 };
 
 /* Overrides scsi_pointer */
@@ -114,7 +111,6 @@
 {
 	struct sense_iu *sense_iu = urb->transfer_buffer;
 	struct scsi_device *sdev = cmnd->device;
-	struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;
 
 	if (urb->actual_length > 16) {
 		unsigned len = be16_to_cpup(&sense_iu->len);
@@ -132,15 +128,13 @@
 	}
 
 	cmnd->result = sense_iu->status;
-	if (!(cmdinfo->state & DATA_COMPLETES_CMD))
-		cmnd->scsi_done(cmnd);
+	cmnd->scsi_done(cmnd);
 }
 
 static void uas_sense_old(struct urb *urb, struct scsi_cmnd *cmnd)
 {
 	struct sense_iu_old *sense_iu = urb->transfer_buffer;
 	struct scsi_device *sdev = cmnd->device;
-	struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;
 
 	if (urb->actual_length > 8) {
 		unsigned len = be16_to_cpup(&sense_iu->len) - 2;
@@ -158,8 +152,7 @@
 	}
 
 	cmnd->result = sense_iu->status;
-	if (!(cmdinfo->state & DATA_COMPLETES_CMD))
-		cmnd->scsi_done(cmnd);
+	cmnd->scsi_done(cmnd);
 }
 
 static void uas_xfer_data(struct urb *urb, struct scsi_cmnd *cmnd,
@@ -184,7 +177,6 @@
 	struct Scsi_Host *shost = urb->context;
 	struct uas_dev_info *devinfo = (void *)shost->hostdata[0];
 	struct scsi_cmnd *cmnd;
-	struct uas_cmd_info *cmdinfo;
 	u16 tag;
 	int ret;
 
@@ -210,32 +202,12 @@
 			dev_err(&urb->dev->dev, "failed submit status urb\n");
 		return;
 	}
-	cmdinfo = (void *)&cmnd->SCp;
 
 	switch (iu->iu_id) {
 	case IU_ID_STATUS:
 		if (devinfo->cmnd == cmnd)
 			devinfo->cmnd = NULL;
 
-		if (!(cmdinfo->state & COMPLETED_DATA_IN) &&
-				cmdinfo->data_in_urb) {
-		       if (devinfo->use_streams) {
-			       cmdinfo->state |= DATA_COMPLETES_CMD;
-			       usb_unlink_urb(cmdinfo->data_in_urb);
-		       } else {
-			       usb_free_urb(cmdinfo->data_in_urb);
-		       }
-		}
-		if (!(cmdinfo->state & COMPLETED_DATA_OUT) &&
-				cmdinfo->data_out_urb) {
-			if (devinfo->use_streams) {
-				cmdinfo->state |= DATA_COMPLETES_CMD;
-				usb_unlink_urb(cmdinfo->data_in_urb);
-			} else {
-				usb_free_urb(cmdinfo->data_out_urb);
-			}
-		}
-
 		if (urb->actual_length < 16)
 			devinfo->uas_sense_old = 1;
 		if (devinfo->uas_sense_old)
@@ -264,59 +236,27 @@
 		dev_err(&urb->dev->dev, "failed submit status urb\n");
 }
 
-static void uas_data_out_cmplt(struct urb *urb)
+static void uas_data_cmplt(struct urb *urb)
 {
-	struct scsi_cmnd *cmnd = urb->context;
-	struct scsi_data_buffer *sdb = scsi_out(cmnd);
-	struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;
-
-	cmdinfo->state |= COMPLETED_DATA_OUT;
-
+	struct scsi_data_buffer *sdb = urb->context;
 	sdb->resid = sdb->length - urb->actual_length;
 	usb_free_urb(urb);
-
-	if (cmdinfo->state & DATA_COMPLETES_CMD)
-		cmnd->scsi_done(cmnd);
-}
-
-static void uas_data_in_cmplt(struct urb *urb)
-{
-	struct scsi_cmnd *cmnd = urb->context;
-	struct scsi_data_buffer *sdb = scsi_in(cmnd);
-	struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;
-
-	cmdinfo->state |= COMPLETED_DATA_IN;
-
-	sdb->resid = sdb->length - urb->actual_length;
-	usb_free_urb(urb);
-
-	if (cmdinfo->state & DATA_COMPLETES_CMD)
-		cmnd->scsi_done(cmnd);
 }
 
 static struct urb *uas_alloc_data_urb(struct uas_dev_info *devinfo, gfp_t gfp,
-		unsigned int pipe, struct scsi_cmnd *cmnd,
-		enum dma_data_direction dir)
+				unsigned int pipe, u16 stream_id,
+				struct scsi_data_buffer *sdb,
+				enum dma_data_direction dir)
 {
-	struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;
 	struct usb_device *udev = devinfo->udev;
 	struct urb *urb = usb_alloc_urb(0, gfp);
-	struct scsi_data_buffer *sdb;
-	usb_complete_t complete_fn;
-	u16 stream_id = cmdinfo->stream;
 
 	if (!urb)
 		goto out;
-	if (dir == DMA_FROM_DEVICE) {
-		sdb = scsi_in(cmnd);
-		complete_fn = uas_data_in_cmplt;
-	} else {
-		sdb = scsi_out(cmnd);
-		complete_fn = uas_data_out_cmplt;
-	}
-	usb_fill_bulk_urb(urb, udev, pipe, NULL, sdb->length,
-			complete_fn, cmnd);
-	urb->stream_id = stream_id;
+	usb_fill_bulk_urb(urb, udev, pipe, NULL, sdb->length, uas_data_cmplt,
+									sdb);
+	if (devinfo->use_streams)
+		urb->stream_id = stream_id;
 	urb->num_sgs = udev->bus->sg_tablesize ? sdb->table.nents : 0;
 	urb->sg = sdb->table.sgl;
  out:
@@ -418,8 +358,8 @@
 
 	if (cmdinfo->state & ALLOC_DATA_IN_URB) {
 		cmdinfo->data_in_urb = uas_alloc_data_urb(devinfo, gfp,
-					devinfo->data_in_pipe, cmnd,
-					DMA_FROM_DEVICE);
+					devinfo->data_in_pipe, cmdinfo->stream,
+					scsi_in(cmnd), DMA_FROM_DEVICE);
 		if (!cmdinfo->data_in_urb)
 			return SCSI_MLQUEUE_DEVICE_BUSY;
 		cmdinfo->state &= ~ALLOC_DATA_IN_URB;
@@ -436,8 +376,8 @@
 
 	if (cmdinfo->state & ALLOC_DATA_OUT_URB) {
 		cmdinfo->data_out_urb = uas_alloc_data_urb(devinfo, gfp,
-					devinfo->data_out_pipe, cmnd,
-					DMA_TO_DEVICE);
+					devinfo->data_out_pipe, cmdinfo->stream,
+					scsi_out(cmnd), DMA_TO_DEVICE);
 		if (!cmdinfo->data_out_urb)
 			return SCSI_MLQUEUE_DEVICE_BUSY;
 		cmdinfo->state &= ~ALLOC_DATA_OUT_URB;
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 856ad92..8f3cbb8 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1885,6 +1885,13 @@
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_IGNORE_RESIDUE ),
 
+/* Reported by Jesse Feddema <jdfeddema@gmail.com> */
+UNUSUAL_DEV(  0x177f, 0x0400, 0x0000, 0x0000,
+		"Yarvik",
+		"PMP400",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ),
+
 /* Reported by Hans de Goede <hdegoede@redhat.com>
  * These Appotech controllers are found in Picture Frames, they provide a
  * (buggy) emulation of a cdrom drive which contains the windows software
diff --git a/drivers/video/msm/mdp4.h b/drivers/video/msm/mdp4.h
index 50e50a9..7a2fcdd 100644
--- a/drivers/video/msm/mdp4.h
+++ b/drivers/video/msm/mdp4.h
@@ -495,6 +495,7 @@
 void mdp4_dtv_base_swap(int cndx, struct mdp4_overlay_pipe *pipe);
 void mdp4_dtv_pipe_queue(int cndx, struct mdp4_overlay_pipe *pipe);
 int mdp4_dtv_pipe_commit(int cndx, int wait);
+void mdp4_dtv_free_base_pipe(struct msm_fb_data_type *mfd);
 #else
 static inline void mdp4_overlay_dtv_start(void)
 {
@@ -553,6 +554,10 @@
 {
 	return 0;
 }
+static inline void mdp4_dtv_free_base_pipe(struct msm_fb_data_type *mfd)
+{
+	/* empty */
+}
 #endif /* CONFIG_FB_MSM_DTV */
 
 void mdp4_dtv_set_black_screen(void);
@@ -710,7 +715,6 @@
 void mdp4_dsi_video_free_base_pipe(struct msm_fb_data_type *mfd);
 void mdp4_dsi_cmd_free_base_pipe(struct msm_fb_data_type *mfd);
 void mdp4_lcdc_free_base_pipe(struct msm_fb_data_type *mfd);
-void mdp4_dtv_free_base_pipe(struct msm_fb_data_type *mfd);
 
 #ifdef CONFIG_FB_MSM_MDP40
 static inline void mdp3_dsi_cmd_dma_busy_wait(struct msm_fb_data_type *mfd)
diff --git a/drivers/video/msm/mdp4_wfd_writeback_panel.c b/drivers/video/msm/mdp4_wfd_writeback_panel.c
index c3d0431..b9cab5f 100644
--- a/drivers/video/msm/mdp4_wfd_writeback_panel.c
+++ b/drivers/video/msm/mdp4_wfd_writeback_panel.c
@@ -80,4 +80,4 @@
 	return rc;
 }
 
-module_init(writeback_panel_init);
+late_initcall(writeback_panel_init);
diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c
index 2d0be86..c886633 100644
--- a/drivers/video/msm/msm_fb.c
+++ b/drivers/video/msm/msm_fb.c
@@ -207,7 +207,7 @@
 
 static struct led_classdev backlight_led = {
 	.name		= "lcd-backlight",
-	.brightness	= MAX_BACKLIGHT_BRIGHTNESS,
+	.brightness	= (MAX_BACKLIGHT_BRIGHTNESS * .75),
 	.brightness_set	= msm_fb_set_bl_brightness,
 };
 #endif
@@ -462,8 +462,10 @@
 	if (!lcd_backlight_registered) {
 		if (led_classdev_register(&pdev->dev, &backlight_led))
 			printk(KERN_ERR "led_classdev_register failed\n");
-		else
+		else {
+			msm_fb_set_bl_brightness(&backlight_led, backlight_led.brightness);
 			lcd_backlight_registered = 1;
+		}
 	}
 #endif
 
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index b10b3bc..cb19af2 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -927,7 +927,7 @@
 	dssdev = ovl->manager->device;
 
 	dispc_ovl_compute_fifo_thresholds(ovl->id, &fifo_low, &fifo_high,
-			use_fifo_merge);
+			use_fifo_merge, ovl_manual_update(ovl));
 
 	dss_apply_ovl_fifo_thresholds(ovl, fifo_low, fifo_high);
 }
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index ee30937..c4d0e44 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1063,7 +1063,8 @@
 }
 
 void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane,
-		u32 *fifo_low, u32 *fifo_high, bool use_fifomerge)
+		u32 *fifo_low, u32 *fifo_high, bool use_fifomerge,
+		bool manual_update)
 {
 	/*
 	 * All sizes are in bytes. Both the buffer and burst are made of
@@ -1091,7 +1092,7 @@
 	 * combined fifo size
 	 */
 
-	if (dss_has_feature(FEAT_OMAP3_DSI_FIFO_BUG)) {
+	if (manual_update && dss_has_feature(FEAT_OMAP3_DSI_FIFO_BUG)) {
 		*fifo_low = ovl_fifo_size - burst_size * 2;
 		*fifo_high = total_fifo_size - burst_size;
 	} else {
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index d4b3dff..d0638da 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -424,7 +424,8 @@
 
 void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high);
 void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane,
-		u32 *fifo_low, u32 *fifo_high, bool use_fifomerge);
+		u32 *fifo_low, u32 *fifo_high, bool use_fifomerge,
+		bool manual_update);
 int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
 		bool ilace, bool replication);
 int dispc_ovl_enable(enum omap_plane plane, bool enable);
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 7a0b301..e672698 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -758,7 +758,7 @@
 		}
 
 		lcdc_write_chan(ch, LDDFR, tmp);
-		lcdc_write_chan(ch, LDMLSR, ch->pitch);
+		lcdc_write_chan(ch, LDMLSR, ch->line_size);
 		lcdc_write_chan(ch, LDSA1R, ch->base_addr_y);
 		if (ch->format->yuv)
 			lcdc_write_chan(ch, LDSA2R, ch->base_addr_c);
@@ -847,6 +847,7 @@
 
 		ch->base_addr_y = ch->dma_handle;
 		ch->base_addr_c = ch->base_addr_y + ch->xres * ch->yres_virtual;
+		ch->line_size = ch->pitch;
 
 		/* Enable MERAM if possible. */
 		if (mdev == NULL || mdev->ops == NULL ||
@@ -882,7 +883,7 @@
 
 		meram = mdev->ops->meram_register(mdev, ch->cfg->meram_cfg,
 					ch->pitch, ch->yres, pixelformat,
-					&ch->pitch);
+					&ch->line_size);
 		if (!IS_ERR(meram)) {
 			mdev->ops->meram_update(mdev, meram,
 					ch->base_addr_y, ch->base_addr_c,
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
index da1c26e..5c3bddd 100644
--- a/drivers/video/sh_mobile_lcdcfb.h
+++ b/drivers/video/sh_mobile_lcdcfb.h
@@ -84,6 +84,7 @@
 
 	unsigned long base_addr_y;
 	unsigned long base_addr_c;
+	unsigned int line_size;
 
 	int (*notify)(struct sh_mobile_lcdc_chan *ch,
 		      enum sh_mobile_lcdc_entity_event event,
diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c
index ccbfef5..1e1e2d2 100644
--- a/drivers/video/smscufx.c
+++ b/drivers/video/smscufx.c
@@ -904,7 +904,7 @@
 	result = fb_sys_write(info, buf, count, ppos);
 
 	if (result > 0) {
-		int start = max((int)(offset / info->fix.line_length) - 1, 0);
+		int start = max((int)(offset / info->fix.line_length), 0);
 		int lines = min((u32)((result / info->fix.line_length) + 1),
 				(u32)info->var.yres);
 
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 0a8a17c..6908e4c 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -611,7 +611,7 @@
 	disable_dynirq(data);
 }
 
-static int find_irq_by_gsi(unsigned gsi)
+int xen_irq_from_gsi(unsigned gsi)
 {
 	struct irq_info *info;
 
@@ -625,6 +625,7 @@
 
 	return -1;
 }
+EXPORT_SYMBOL_GPL(xen_irq_from_gsi);
 
 /*
  * Do not make any assumptions regarding the relationship between the
@@ -644,7 +645,7 @@
 
 	mutex_lock(&irq_mapping_update_lock);
 
-	irq = find_irq_by_gsi(gsi);
+	irq = xen_irq_from_gsi(gsi);
 	if (irq != -1) {
 		printk(KERN_INFO "xen_map_pirq_gsi: returning irq %d for gsi %u\n",
 		       irq, gsi);
diff --git a/fs/aio.c b/fs/aio.c
index 67a6db3..e7f2fad 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1456,6 +1456,10 @@
 	if (ret < 0)
 		goto out;
 
+	ret = rw_verify_area(type, kiocb->ki_filp, &kiocb->ki_pos, ret);
+	if (ret < 0)
+		goto out;
+
 	kiocb->ki_nr_segs = kiocb->ki_nbytes;
 	kiocb->ki_cur_seg = 0;
 	/* ki_nbytes/left now reflect bytes instead of segs */
@@ -1467,11 +1471,17 @@
 	return ret;
 }
 
-static ssize_t aio_setup_single_vector(struct kiocb *kiocb)
+static ssize_t aio_setup_single_vector(int type, struct file * file, struct kiocb *kiocb)
 {
+	int bytes;
+
+	bytes = rw_verify_area(type, file, &kiocb->ki_pos, kiocb->ki_left);
+	if (bytes < 0)
+		return bytes;
+
 	kiocb->ki_iovec = &kiocb->ki_inline_vec;
 	kiocb->ki_iovec->iov_base = kiocb->ki_buf;
-	kiocb->ki_iovec->iov_len = kiocb->ki_left;
+	kiocb->ki_iovec->iov_len = bytes;
 	kiocb->ki_nr_segs = 1;
 	kiocb->ki_cur_seg = 0;
 	return 0;
@@ -1496,10 +1506,7 @@
 		if (unlikely(!access_ok(VERIFY_WRITE, kiocb->ki_buf,
 			kiocb->ki_left)))
 			break;
-		ret = security_file_permission(file, MAY_READ);
-		if (unlikely(ret))
-			break;
-		ret = aio_setup_single_vector(kiocb);
+		ret = aio_setup_single_vector(READ, file, kiocb);
 		if (ret)
 			break;
 		ret = -EINVAL;
@@ -1514,10 +1521,7 @@
 		if (unlikely(!access_ok(VERIFY_READ, kiocb->ki_buf,
 			kiocb->ki_left)))
 			break;
-		ret = security_file_permission(file, MAY_WRITE);
-		if (unlikely(ret))
-			break;
-		ret = aio_setup_single_vector(kiocb);
+		ret = aio_setup_single_vector(WRITE, file, kiocb);
 		if (ret)
 			break;
 		ret = -EINVAL;
@@ -1528,9 +1532,6 @@
 		ret = -EBADF;
 		if (unlikely(!(file->f_mode & FMODE_READ)))
 			break;
-		ret = security_file_permission(file, MAY_READ);
-		if (unlikely(ret))
-			break;
 		ret = aio_setup_vectored_rw(READ, kiocb, compat);
 		if (ret)
 			break;
@@ -1542,9 +1543,6 @@
 		ret = -EBADF;
 		if (unlikely(!(file->f_mode & FMODE_WRITE)))
 			break;
-		ret = security_file_permission(file, MAY_WRITE);
-		if (unlikely(ret))
-			break;
 		ret = aio_setup_vectored_rw(WRITE, kiocb, compat);
 		if (ret)
 			break;
diff --git a/fs/attr.c b/fs/attr.c
index 73f69a6..d94d1b6 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -176,6 +176,11 @@
 			return -EPERM;
 	}
 
+	if ((ia_valid & ATTR_SIZE) && IS_I_VERSION(inode)) {
+		if (attr->ia_size != inode->i_size)
+			inode_inc_iversion(inode);
+	}
+
 	if ((ia_valid & ATTR_MODE)) {
 		umode_t amode = attr->ia_mode;
 		/* Flag setting protected by i_mutex */
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index 4270414..58b7d14 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -206,10 +206,17 @@
 
 		work->ordered_func(work);
 
-		/* now take the lock again and call the freeing code */
+		/* now take the lock again and drop our item from the list */
 		spin_lock(&workers->order_lock);
 		list_del(&work->order_list);
+		spin_unlock(&workers->order_lock);
+
+		/*
+		 * we don't want to call the ordered free functions
+		 * with the lock held though
+		 */
 		work->ordered_free(work);
+		spin_lock(&workers->order_lock);
 	}
 
 	spin_unlock(&workers->order_lock);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 61b16c6..0df0d1f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -257,10 +257,13 @@
 	ret = insert_inline_extent(trans, root, inode, start,
 				   inline_len, compressed_size,
 				   compress_type, compressed_pages);
-	if (ret) {
+	if (ret && ret != -ENOSPC) {
 		btrfs_abort_transaction(trans, root, ret);
 		return ret;
+	} else if (ret == -ENOSPC) {
+		return 1;
 	}
+
 	btrfs_delalloc_release_metadata(inode, end + 1 - start);
 	btrfs_drop_extent_cache(inode, start, aligned_end - 1, 0);
 	return 0;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index eb1ae90..dce89da 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -690,6 +690,8 @@
 	kfree(name);
 
 	iput(inode);
+
+	btrfs_run_delayed_items(trans, root);
 	return ret;
 }
 
@@ -895,6 +897,7 @@
 				ret = btrfs_unlink_inode(trans, root, dir,
 							 inode, victim_name,
 							 victim_name_len);
+				btrfs_run_delayed_items(trans, root);
 			}
 			kfree(victim_name);
 			ptr = (unsigned long)(victim_ref + 1) + victim_name_len;
@@ -1475,6 +1478,9 @@
 			ret = btrfs_unlink_inode(trans, root, dir, inode,
 						 name, name_len);
 			BUG_ON(ret);
+
+			btrfs_run_delayed_items(trans, root);
+
 			kfree(name);
 			iput(inode);
 
diff --git a/fs/buffer.c b/fs/buffer.c
index daa0c3d..badcbc0 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1036,6 +1036,9 @@
 static struct buffer_head *
 __getblk_slow(struct block_device *bdev, sector_t block, int size)
 {
+	int ret;
+	struct buffer_head *bh;
+
 	/* Size must be multiple of hard sectorsize */
 	if (unlikely(size & (bdev_logical_block_size(bdev)-1) ||
 			(size < 512 || size > PAGE_SIZE))) {
@@ -1048,20 +1051,21 @@
 		return NULL;
 	}
 
-	for (;;) {
-		struct buffer_head * bh;
-		int ret;
+retry:
+	bh = __find_get_block(bdev, block, size);
+	if (bh)
+		return bh;
 
+	ret = grow_buffers(bdev, block, size);
+	if (ret == 0) {
+		free_more_memory();
+		goto retry;
+	} else if (ret > 0) {
 		bh = __find_get_block(bdev, block, size);
 		if (bh)
 			return bh;
-
-		ret = grow_buffers(bdev, block, size);
-		if (ret < 0)
-			return NULL;
-		if (ret == 0)
-			free_more_memory();
 	}
+	return NULL;
 }
 
 /*
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 4ff6313..73fea28 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -43,6 +43,7 @@
 
 #define CIFS_MIN_RCV_POOL 4
 
+#define MAX_REOPEN_ATT	5 /* these many maximum attempts to reopen a file */
 /*
  * default attribute cache timeout (jiffies)
  */
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 96192c1..97f5d03 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -192,11 +192,13 @@
 
 extern int CIFSFindFirst(const int xid, struct cifs_tcon *tcon,
 		const char *searchName, const struct nls_table *nls_codepage,
-		__u16 *searchHandle, struct cifs_search_info *psrch_inf,
+		__u16 *searchHandle, __u16 search_flags,
+		struct cifs_search_info *psrch_inf,
 		int map, const char dirsep);
 
 extern int CIFSFindNext(const int xid, struct cifs_tcon *tcon,
-		__u16 searchHandle, struct cifs_search_info *psrch_inf);
+		__u16 searchHandle, __u16 search_flags,
+		struct cifs_search_info *psrch_inf);
 
 extern int CIFSFindClose(const int, struct cifs_tcon *tcon,
 			const __u16 search_handle);
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index da2f544..3a75ee5 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -89,6 +89,32 @@
 /* Forward declarations */
 static void cifs_readv_complete(struct work_struct *work);
 
+#ifdef CONFIG_HIGHMEM
+/*
+ * On arches that have high memory, kmap address space is limited. By
+ * serializing the kmap operations on those arches, we ensure that we don't
+ * end up with a bunch of threads in writeback with partially mapped page
+ * arrays, stuck waiting for kmap to come back. That situation prevents
+ * progress and can deadlock.
+ */
+static DEFINE_MUTEX(cifs_kmap_mutex);
+
+static inline void
+cifs_kmap_lock(void)
+{
+	mutex_lock(&cifs_kmap_mutex);
+}
+
+static inline void
+cifs_kmap_unlock(void)
+{
+	mutex_unlock(&cifs_kmap_mutex);
+}
+#else /* !CONFIG_HIGHMEM */
+#define cifs_kmap_lock() do { ; } while(0)
+#define cifs_kmap_unlock() do { ; } while(0)
+#endif /* CONFIG_HIGHMEM */
+
 /* Mark as invalid, all open files on tree connections since they
    were closed when session to server was lost */
 static void mark_open_files_invalid(struct cifs_tcon *pTcon)
@@ -1557,6 +1583,7 @@
 	eof_index = eof ? (eof - 1) >> PAGE_CACHE_SHIFT : 0;
 	cFYI(1, "eof=%llu eof_index=%lu", eof, eof_index);
 
+	cifs_kmap_lock();
 	list_for_each_entry_safe(page, tpage, &rdata->pages, lru) {
 		if (remaining >= PAGE_CACHE_SIZE) {
 			/* enough data to fill the page */
@@ -1606,6 +1633,7 @@
 			page_cache_release(page);
 		}
 	}
+	cifs_kmap_unlock();
 
 	/* issue the read if we have any iovecs left to fill */
 	if (rdata->nr_iov > 1) {
@@ -2194,7 +2222,9 @@
 	 * and set the iov_len properly for each one. It may also set
 	 * wdata->bytes too.
 	 */
+	cifs_kmap_lock();
 	wdata->marshal_iov(iov, wdata);
+	cifs_kmap_unlock();
 
 	cFYI(1, "async write at %llu %u bytes", wdata->offset, wdata->bytes);
 
@@ -4344,7 +4374,7 @@
 CIFSFindFirst(const int xid, struct cifs_tcon *tcon,
 	      const char *searchName,
 	      const struct nls_table *nls_codepage,
-	      __u16 *pnetfid,
+	      __u16 *pnetfid, __u16 search_flags,
 	      struct cifs_search_info *psrch_inf, int remap, const char dirsep)
 {
 /* level 257 SMB_ */
@@ -4416,8 +4446,7 @@
 	    cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM |
 			ATTR_DIRECTORY);
 	pSMB->SearchCount = cpu_to_le16(CIFSMaxBufSize/sizeof(FILE_UNIX_INFO));
-	pSMB->SearchFlags = cpu_to_le16(CIFS_SEARCH_CLOSE_AT_END |
-		CIFS_SEARCH_RETURN_RESUME);
+	pSMB->SearchFlags = cpu_to_le16(search_flags);
 	pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
 
 	/* BB what should we set StorageType to? Does it matter? BB */
@@ -4487,8 +4516,8 @@
 	return rc;
 }
 
-int CIFSFindNext(const int xid, struct cifs_tcon *tcon,
-		 __u16 searchHandle, struct cifs_search_info *psrch_inf)
+int CIFSFindNext(const int xid, struct cifs_tcon *tcon, __u16 searchHandle,
+		 __u16 search_flags, struct cifs_search_info *psrch_inf)
 {
 	TRANSACTION2_FNEXT_REQ *pSMB = NULL;
 	TRANSACTION2_FNEXT_RSP *pSMBr = NULL;
@@ -4531,8 +4560,7 @@
 		cpu_to_le16(CIFSMaxBufSize / sizeof(FILE_UNIX_INFO));
 	pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
 	pSMB->ResumeKey = psrch_inf->resume_key;
-	pSMB->SearchFlags =
-	      cpu_to_le16(CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME);
+	pSMB->SearchFlags = cpu_to_le16(search_flags);
 
 	name_len = psrch_inf->resume_name_len;
 	params += name_len;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index e0b56d7..65a78e9 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -238,8 +238,8 @@
 enum {
 	Opt_sec_krb5, Opt_sec_krb5i, Opt_sec_krb5p,
 	Opt_sec_ntlmsspi, Opt_sec_ntlmssp,
-	Opt_ntlm, Opt_sec_ntlmi, Opt_sec_ntlmv2i,
-	Opt_sec_nontlm, Opt_sec_lanman,
+	Opt_ntlm, Opt_sec_ntlmi, Opt_sec_ntlmv2,
+	Opt_sec_ntlmv2i, Opt_sec_lanman,
 	Opt_sec_none,
 
 	Opt_sec_err
@@ -253,8 +253,9 @@
 	{ Opt_sec_ntlmssp, "ntlmssp" },
 	{ Opt_ntlm, "ntlm" },
 	{ Opt_sec_ntlmi, "ntlmi" },
+	{ Opt_sec_ntlmv2, "nontlm" },
+	{ Opt_sec_ntlmv2, "ntlmv2" },
 	{ Opt_sec_ntlmv2i, "ntlmv2i" },
-	{ Opt_sec_nontlm, "nontlm" },
 	{ Opt_sec_lanman, "lanman" },
 	{ Opt_sec_none, "none" },
 
@@ -1163,7 +1164,7 @@
 	case Opt_sec_ntlmi:
 		vol->secFlg |= CIFSSEC_MAY_NTLM | CIFSSEC_MUST_SIGN;
 		break;
-	case Opt_sec_nontlm:
+	case Opt_sec_ntlmv2:
 		vol->secFlg |= CIFSSEC_MAY_NTLMV2;
 		break;
 	case Opt_sec_ntlmv2i:
@@ -1585,24 +1586,26 @@
 			 * If yes, we have encountered a double deliminator
 			 * reset the NULL character to the deliminator
 			 */
-			if (tmp_end < end && tmp_end[1] == delim)
+			if (tmp_end < end && tmp_end[1] == delim) {
 				tmp_end[0] = delim;
 
-			/* Keep iterating until we get to a single deliminator
-			 * OR the end
-			 */
-			while ((tmp_end = strchr(tmp_end, delim)) != NULL &&
-			       (tmp_end[1] == delim)) {
-				tmp_end = (char *) &tmp_end[2];
-			}
+				/* Keep iterating until we get to a single
+				 * deliminator OR the end
+				 */
+				while ((tmp_end = strchr(tmp_end, delim))
+					!= NULL && (tmp_end[1] == delim)) {
+						tmp_end = (char *) &tmp_end[2];
+				}
 
-			/* Reset var options to point to next element */
-			if (tmp_end) {
-				tmp_end[0] = '\0';
-				options = (char *) &tmp_end[1];
-			} else
-				/* Reached the end of the mount option string */
-				options = end;
+				/* Reset var options to point to next element */
+				if (tmp_end) {
+					tmp_end[0] = '\0';
+					options = (char *) &tmp_end[1];
+				} else
+					/* Reached the end of the mount option
+					 * string */
+					options = end;
+			}
 
 			/* Now build new password string */
 			temp_len = strlen(value);
@@ -3346,6 +3349,18 @@
 #define CIFS_DEFAULT_NON_POSIX_RSIZE (60 * 1024)
 #define CIFS_DEFAULT_NON_POSIX_WSIZE (65536)
 
+/*
+ * On hosts with high memory, we can't currently support wsize/rsize that are
+ * larger than we can kmap at once. Cap the rsize/wsize at
+ * LAST_PKMAP * PAGE_SIZE. We'll never be able to fill a read or write request
+ * larger than that anyway.
+ */
+#ifdef CONFIG_HIGHMEM
+#define CIFS_KMAP_SIZE_LIMIT	(LAST_PKMAP * PAGE_CACHE_SIZE)
+#else /* CONFIG_HIGHMEM */
+#define CIFS_KMAP_SIZE_LIMIT	(1<<24)
+#endif /* CONFIG_HIGHMEM */
+
 static unsigned int
 cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info)
 {
@@ -3376,6 +3391,9 @@
 		wsize = min_t(unsigned int, wsize,
 				server->maxBuf - sizeof(WRITE_REQ) + 4);
 
+	/* limit to the amount that we can kmap at once */
+	wsize = min_t(unsigned int, wsize, CIFS_KMAP_SIZE_LIMIT);
+
 	/* hard limit of CIFS_MAX_WSIZE */
 	wsize = min_t(unsigned int, wsize, CIFS_MAX_WSIZE);
 
@@ -3396,18 +3414,15 @@
 	 * MS-CIFS indicates that servers are only limited by the client's
 	 * bufsize for reads, testing against win98se shows that it throws
 	 * INVALID_PARAMETER errors if you try to request too large a read.
+	 * OS/2 just sends back short reads.
 	 *
-	 * If the server advertises a MaxBufferSize of less than one page,
-	 * assume that it also can't satisfy reads larger than that either.
-	 *
-	 * FIXME: Is there a better heuristic for this?
+	 * If the server doesn't advertise CAP_LARGE_READ_X, then assume that
+	 * it can't handle a read request larger than its MaxBufferSize either.
 	 */
 	if (tcon->unix_ext && (unix_cap & CIFS_UNIX_LARGE_READ_CAP))
 		defsize = CIFS_DEFAULT_IOSIZE;
 	else if (server->capabilities & CAP_LARGE_READ_X)
 		defsize = CIFS_DEFAULT_NON_POSIX_RSIZE;
-	else if (server->maxBuf >= PAGE_CACHE_SIZE)
-		defsize = CIFSMaxBufSize;
 	else
 		defsize = server->maxBuf - sizeof(READ_RSP);
 
@@ -3420,6 +3435,9 @@
 	if (!(server->capabilities & CAP_LARGE_READ_X))
 		rsize = min_t(unsigned int, CIFSMaxBufSize, rsize);
 
+	/* limit to the amount that we can kmap at once */
+	rsize = min_t(unsigned int, rsize, CIFS_KMAP_SIZE_LIMIT);
+
 	/* hard limit of CIFS_MAX_RSIZE */
 	rsize = min_t(unsigned int, rsize, CIFS_MAX_RSIZE);
 
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 81725e9..e7ebb5a 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1539,10 +1539,11 @@
 struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode,
 					bool fsuid_only)
 {
-	struct cifsFileInfo *open_file;
+	struct cifsFileInfo *open_file, *inv_file = NULL;
 	struct cifs_sb_info *cifs_sb;
 	bool any_available = false;
 	int rc;
+	unsigned int refind = 0;
 
 	/* Having a null inode here (because mapping->host was set to zero by
 	the VFS or MM) should not happen but we had reports of on oops (due to
@@ -1562,40 +1563,25 @@
 
 	spin_lock(&cifs_file_list_lock);
 refind_writable:
+	if (refind > MAX_REOPEN_ATT) {
+		spin_unlock(&cifs_file_list_lock);
+		return NULL;
+	}
 	list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
 		if (!any_available && open_file->pid != current->tgid)
 			continue;
 		if (fsuid_only && open_file->uid != current_fsuid())
 			continue;
 		if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) {
-			cifsFileInfo_get(open_file);
-
 			if (!open_file->invalidHandle) {
 				/* found a good writable file */
+				cifsFileInfo_get(open_file);
 				spin_unlock(&cifs_file_list_lock);
 				return open_file;
+			} else {
+				if (!inv_file)
+					inv_file = open_file;
 			}
-
-			spin_unlock(&cifs_file_list_lock);
-
-			/* Had to unlock since following call can block */
-			rc = cifs_reopen_file(open_file, false);
-			if (!rc)
-				return open_file;
-
-			/* if it fails, try another handle if possible */
-			cFYI(1, "wp failed on reopen file");
-			cifsFileInfo_put(open_file);
-
-			spin_lock(&cifs_file_list_lock);
-
-			/* else we simply continue to the next entry. Thus
-			   we do not loop on reopen errors.  If we
-			   can not reopen the file, for example if we
-			   reconnected to a server with another client
-			   racing to delete or lock the file we would not
-			   make progress if we restarted before the beginning
-			   of the loop here. */
 		}
 	}
 	/* couldn't find useable FH with same pid, try any available */
@@ -1603,7 +1589,30 @@
 		any_available = true;
 		goto refind_writable;
 	}
+
+	if (inv_file) {
+		any_available = false;
+		cifsFileInfo_get(inv_file);
+	}
+
 	spin_unlock(&cifs_file_list_lock);
+
+	if (inv_file) {
+		rc = cifs_reopen_file(inv_file, false);
+		if (!rc)
+			return inv_file;
+		else {
+			spin_lock(&cifs_file_list_lock);
+			list_move_tail(&inv_file->flist,
+					&cifs_inode->openFileList);
+			spin_unlock(&cifs_file_list_lock);
+			cifsFileInfo_put(inv_file);
+			spin_lock(&cifs_file_list_lock);
+			++refind;
+			goto refind_writable;
+		}
+	}
+
 	return NULL;
 }
 
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index e2bbc68..a4217f0 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -86,9 +86,12 @@
 
 	dentry = d_lookup(parent, name);
 	if (dentry) {
-		/* FIXME: check for inode number changes? */
-		if (dentry->d_inode != NULL)
+		inode = dentry->d_inode;
+		/* update inode in place if i_ino didn't change */
+		if (inode && CIFS_I(inode)->uniqueid == fattr->cf_uniqueid) {
+			cifs_fattr_to_inode(inode, fattr);
 			return dentry;
+		}
 		d_drop(dentry);
 		dput(dentry);
 	}
@@ -219,6 +222,7 @@
 
 static int initiate_cifs_search(const int xid, struct file *file)
 {
+	__u16 search_flags;
 	int rc = 0;
 	char *full_path = NULL;
 	struct cifsFileInfo *cifsFile;
@@ -270,8 +274,12 @@
 		cifsFile->srch_inf.info_level = SMB_FIND_FILE_DIRECTORY_INFO;
 	}
 
+	search_flags = CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME;
+	if (backup_cred(cifs_sb))
+		search_flags |= CIFS_SEARCH_BACKUP_SEARCH;
+
 	rc = CIFSFindFirst(xid, pTcon, full_path, cifs_sb->local_nls,
-		&cifsFile->netfid, &cifsFile->srch_inf,
+		&cifsFile->netfid, search_flags, &cifsFile->srch_inf,
 		cifs_sb->mnt_cifs_flags &
 			CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb));
 	if (rc == 0)
@@ -502,11 +510,13 @@
 static int find_cifs_entry(const int xid, struct cifs_tcon *pTcon,
 	struct file *file, char **ppCurrentEntry, int *num_to_ret)
 {
+	__u16 search_flags;
 	int rc = 0;
 	int pos_in_buf = 0;
 	loff_t first_entry_in_buffer;
 	loff_t index_to_find = file->f_pos;
 	struct cifsFileInfo *cifsFile = file->private_data;
+	struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
 	/* check if index in the buffer */
 
 	if ((cifsFile == NULL) || (ppCurrentEntry == NULL) ||
@@ -560,10 +570,14 @@
 						cifsFile);
 	}
 
+	search_flags = CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME;
+	if (backup_cred(cifs_sb))
+		search_flags |= CIFS_SEARCH_BACKUP_SEARCH;
+
 	while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) &&
 	      (rc == 0) && !cifsFile->srch_inf.endOfSearch) {
 		cFYI(1, "calling findnext2");
-		rc = CIFSFindNext(xid, pTcon, cifsFile->netfid,
+		rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, search_flags,
 				  &cifsFile->srch_inf);
 		/* FindFirst/Next set last_entry to NULL on malformed reply */
 		if (cifsFile->srch_inf.last_entry)
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 0961336..b17a433 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -340,7 +340,7 @@
 {
 	int error;
 
-	error = wait_event_freezekillable(server->response_q,
+	error = wait_event_freezekillable_unsafe(server->response_q,
 				    midQ->mid_state != MID_REQUEST_SUBMITTED);
 	if (error < 0)
 		return -ERESTARTSYS;
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c
index 69f994a..0dbe58a 100644
--- a/fs/ecryptfs/kthread.c
+++ b/fs/ecryptfs/kthread.c
@@ -149,7 +149,7 @@
 	(*lower_file) = dentry_open(lower_dentry, lower_mnt, flags, cred);
 	if (!IS_ERR(*lower_file))
 		goto out;
-	if (flags & O_RDONLY) {
+	if ((flags & O_ACCMODE) == O_RDONLY) {
 		rc = PTR_ERR((*lower_file));
 		goto out;
 	}
diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c
index 3a06f40..c0038f6 100644
--- a/fs/ecryptfs/miscdev.c
+++ b/fs/ecryptfs/miscdev.c
@@ -49,7 +49,10 @@
 	mutex_lock(&ecryptfs_daemon_hash_mux);
 	/* TODO: Just use file->private_data? */
 	rc = ecryptfs_find_daemon_by_euid(&daemon, euid, current_user_ns());
-	BUG_ON(rc || !daemon);
+	if (rc || !daemon) {
+		mutex_unlock(&ecryptfs_daemon_hash_mux);
+		return -EINVAL;
+	}
 	mutex_lock(&daemon->mux);
 	mutex_unlock(&ecryptfs_daemon_hash_mux);
 	if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) {
@@ -122,6 +125,7 @@
 		goto out_unlock_daemon;
 	}
 	daemon->flags |= ECRYPTFS_DAEMON_MISCDEV_OPEN;
+	file->private_data = daemon;
 	atomic_inc(&ecryptfs_num_miscdev_opens);
 out_unlock_daemon:
 	mutex_unlock(&daemon->mux);
@@ -152,9 +156,9 @@
 
 	mutex_lock(&ecryptfs_daemon_hash_mux);
 	rc = ecryptfs_find_daemon_by_euid(&daemon, euid, current_user_ns());
-	BUG_ON(rc || !daemon);
+	if (rc || !daemon)
+		daemon = file->private_data;
 	mutex_lock(&daemon->mux);
-	BUG_ON(daemon->pid != task_pid(current));
 	BUG_ON(!(daemon->flags & ECRYPTFS_DAEMON_MISCDEV_OPEN));
 	daemon->flags &= ~ECRYPTFS_DAEMON_MISCDEV_OPEN;
 	atomic_dec(&ecryptfs_num_miscdev_opens);
@@ -191,31 +195,32 @@
 			  struct ecryptfs_msg_ctx *msg_ctx, u8 msg_type,
 			  u16 msg_flags, struct ecryptfs_daemon *daemon)
 {
-	int rc = 0;
+	struct ecryptfs_message *msg;
 
-	mutex_lock(&msg_ctx->mux);
-	msg_ctx->msg = kmalloc((sizeof(*msg_ctx->msg) + data_size),
-			       GFP_KERNEL);
-	if (!msg_ctx->msg) {
-		rc = -ENOMEM;
+	msg = kmalloc((sizeof(*msg) + data_size), GFP_KERNEL);
+	if (!msg) {
 		printk(KERN_ERR "%s: Out of memory whilst attempting "
 		       "to kmalloc(%zd, GFP_KERNEL)\n", __func__,
-		       (sizeof(*msg_ctx->msg) + data_size));
-		goto out_unlock;
+		       (sizeof(*msg) + data_size));
+		return -ENOMEM;
 	}
+
+	mutex_lock(&msg_ctx->mux);
+	msg_ctx->msg = msg;
 	msg_ctx->msg->index = msg_ctx->index;
 	msg_ctx->msg->data_len = data_size;
 	msg_ctx->type = msg_type;
 	memcpy(msg_ctx->msg->data, data, data_size);
 	msg_ctx->msg_size = (sizeof(*msg_ctx->msg) + data_size);
-	mutex_lock(&daemon->mux);
 	list_add_tail(&msg_ctx->daemon_out_list, &daemon->msg_ctx_out_queue);
+	mutex_unlock(&msg_ctx->mux);
+
+	mutex_lock(&daemon->mux);
 	daemon->num_queued_msg_ctx++;
 	wake_up_interruptible(&daemon->wait);
 	mutex_unlock(&daemon->mux);
-out_unlock:
-	mutex_unlock(&msg_ctx->mux);
-	return rc;
+
+	return 0;
 }
 
 /*
@@ -269,8 +274,16 @@
 	mutex_lock(&ecryptfs_daemon_hash_mux);
 	/* TODO: Just use file->private_data? */
 	rc = ecryptfs_find_daemon_by_euid(&daemon, euid, current_user_ns());
-	BUG_ON(rc || !daemon);
+	if (rc || !daemon) {
+		mutex_unlock(&ecryptfs_daemon_hash_mux);
+		return -EINVAL;
+	}
 	mutex_lock(&daemon->mux);
+	if (task_pid(current) != daemon->pid) {
+		mutex_unlock(&daemon->mux);
+		mutex_unlock(&ecryptfs_daemon_hash_mux);
+		return -EPERM;
+	}
 	if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) {
 		rc = 0;
 		mutex_unlock(&ecryptfs_daemon_hash_mux);
@@ -307,9 +320,6 @@
 		 * message from the queue; try again */
 		goto check_list;
 	}
-	BUG_ON(euid != daemon->euid);
-	BUG_ON(current_user_ns() != daemon->user_ns);
-	BUG_ON(task_pid(current) != daemon->pid);
 	msg_ctx = list_first_entry(&daemon->msg_ctx_out_queue,
 				   struct ecryptfs_msg_ctx, daemon_out_list);
 	BUG_ON(!msg_ctx);
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index c0b3c70..497accd 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -33,6 +33,7 @@
 #include <linux/bitops.h>
 #include <linux/mutex.h>
 #include <linux/anon_inodes.h>
+#include <linux/freezer.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/mman.h>
@@ -1415,7 +1416,8 @@
 			}
 
 			spin_unlock_irqrestore(&ep->lock, flags);
-			if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS))
+			if (!freezable_schedule_hrtimeout_range(to, slack,
+								HRTIMER_MODE_ABS))
 				timed_out = 1;
 
 			spin_lock_irqsave(&ep->lock, flags);
diff --git a/fs/exec.c b/fs/exec.c
index b1fd202..126e01c 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -823,10 +823,10 @@
 	/* Notify parent that we're no longer interested in the old VM */
 	tsk = current;
 	old_mm = current->mm;
-	sync_mm_rss(old_mm);
 	mm_release(tsk, old_mm);
 
 	if (old_mm) {
+		sync_mm_rss(old_mm);
 		/*
 		 * Make sure that if there is a core dump in progress
 		 * for the old mm, we get out and die instead of going
@@ -1024,7 +1024,7 @@
 		unsigned long set, i;
 
 		j++;
-		i = j * __NFDBITS;
+		i = j * BITS_PER_LONG;
 		fdt = files_fdtable(files);
 		if (i >= fdt->max_fds)
 			break;
diff --git a/fs/exofs/ore.c b/fs/exofs/ore.c
index 49cf230..1585db1a 100644
--- a/fs/exofs/ore.c
+++ b/fs/exofs/ore.c
@@ -735,13 +735,7 @@
 out:
 	ios->numdevs = devs_in_group;
 	ios->pages_consumed = cur_pg;
-	if (unlikely(ret)) {
-		if (length == ios->length)
-			return ret;
-		else
-			ios->length -= length;
-	}
-	return 0;
+	return ret;
 }
 
 int ore_create(struct ore_io_state *ios)
@@ -843,11 +837,11 @@
 				bio->bi_rw |= REQ_WRITE;
 			}
 
-			osd_req_write(or, _ios_obj(ios, dev), per_dev->offset,
-				      bio, per_dev->length);
+			osd_req_write(or, _ios_obj(ios, cur_comp),
+				      per_dev->offset, bio, per_dev->length);
 			ORE_DBGMSG("write(0x%llx) offset=0x%llx "
 				      "length=0x%llx dev=%d\n",
-				     _LLU(_ios_obj(ios, dev)->id),
+				     _LLU(_ios_obj(ios, cur_comp)->id),
 				     _LLU(per_dev->offset),
 				     _LLU(per_dev->length), dev);
 		} else if (ios->kern_buff) {
@@ -859,20 +853,20 @@
 			       (ios->si.unit_off + ios->length >
 				ios->layout->stripe_unit));
 
-			ret = osd_req_write_kern(or, _ios_obj(ios, per_dev->dev),
+			ret = osd_req_write_kern(or, _ios_obj(ios, cur_comp),
 						 per_dev->offset,
 						 ios->kern_buff, ios->length);
 			if (unlikely(ret))
 				goto out;
 			ORE_DBGMSG2("write_kern(0x%llx) offset=0x%llx "
 				      "length=0x%llx dev=%d\n",
-				     _LLU(_ios_obj(ios, dev)->id),
+				     _LLU(_ios_obj(ios, cur_comp)->id),
 				     _LLU(per_dev->offset),
 				     _LLU(ios->length), per_dev->dev);
 		} else {
-			osd_req_set_attributes(or, _ios_obj(ios, dev));
+			osd_req_set_attributes(or, _ios_obj(ios, cur_comp));
 			ORE_DBGMSG2("obj(0x%llx) set_attributes=%d dev=%d\n",
-				     _LLU(_ios_obj(ios, dev)->id),
+				     _LLU(_ios_obj(ios, cur_comp)->id),
 				     ios->out_attr_len, dev);
 		}
 
diff --git a/fs/exofs/ore_raid.c b/fs/exofs/ore_raid.c
index d222c77..fff2070 100644
--- a/fs/exofs/ore_raid.c
+++ b/fs/exofs/ore_raid.c
@@ -461,16 +461,12 @@
  * ios->sp2d[p][*], xor is calculated the same way. These pages are
  * allocated/freed and don't go through cache
  */
-static int _read_4_write(struct ore_io_state *ios)
+static int _read_4_write_first_stripe(struct ore_io_state *ios)
 {
-	struct ore_io_state *ios_read;
 	struct ore_striping_info read_si;
 	struct __stripe_pages_2d *sp2d = ios->sp2d;
 	u64 offset = ios->si.first_stripe_start;
-	u64 last_stripe_end;
-	unsigned bytes_in_stripe = ios->si.bytes_in_stripe;
-	unsigned i, c, p, min_p = sp2d->pages_in_unit, max_p = -1;
-	int ret;
+	unsigned c, p, min_p = sp2d->pages_in_unit, max_p = -1;
 
 	if (offset == ios->offset) /* Go to start collect $200 */
 		goto read_last_stripe;
@@ -478,6 +474,9 @@
 	min_p = _sp2d_min_pg(sp2d);
 	max_p = _sp2d_max_pg(sp2d);
 
+	ORE_DBGMSG("stripe_start=0x%llx ios->offset=0x%llx min_p=%d max_p=%d\n",
+		   offset, ios->offset, min_p, max_p);
+
 	for (c = 0; ; c++) {
 		ore_calc_stripe_info(ios->layout, offset, 0, &read_si);
 		read_si.obj_offset += min_p * PAGE_SIZE;
@@ -512,6 +511,18 @@
 	}
 
 read_last_stripe:
+	return 0;
+}
+
+static int _read_4_write_last_stripe(struct ore_io_state *ios)
+{
+	struct ore_striping_info read_si;
+	struct __stripe_pages_2d *sp2d = ios->sp2d;
+	u64 offset;
+	u64 last_stripe_end;
+	unsigned bytes_in_stripe = ios->si.bytes_in_stripe;
+	unsigned c, p, min_p = sp2d->pages_in_unit, max_p = -1;
+
 	offset = ios->offset + ios->length;
 	if (offset % PAGE_SIZE)
 		_add_to_r4w_last_page(ios, &offset);
@@ -527,15 +538,15 @@
 	c = _dev_order(ios->layout->group_width * ios->layout->mirrors_p1,
 		       ios->layout->mirrors_p1, read_si.par_dev, read_si.dev);
 
-	BUG_ON(ios->si.first_stripe_start + bytes_in_stripe != last_stripe_end);
-	/* unaligned IO must be within a single stripe */
-
 	if (min_p == sp2d->pages_in_unit) {
 		/* Didn't do it yet */
 		min_p = _sp2d_min_pg(sp2d);
 		max_p = _sp2d_max_pg(sp2d);
 	}
 
+	ORE_DBGMSG("offset=0x%llx stripe_end=0x%llx min_p=%d max_p=%d\n",
+		   offset, last_stripe_end, min_p, max_p);
+
 	while (offset < last_stripe_end) {
 		struct __1_page_stripe *_1ps = &sp2d->_1p_stripes[p];
 
@@ -568,6 +579,15 @@
 	}
 
 read_it:
+	return 0;
+}
+
+static int _read_4_write_execute(struct ore_io_state *ios)
+{
+	struct ore_io_state *ios_read;
+	unsigned i;
+	int ret;
+
 	ios_read = ios->ios_read_4_write;
 	if (!ios_read)
 		return 0;
@@ -591,6 +611,8 @@
 	}
 
 	_mark_read4write_pages_uptodate(ios_read, ret);
+	ore_put_io_state(ios_read);
+	ios->ios_read_4_write = NULL; /* Might need a reuse at last stripe */
 	return 0;
 }
 
@@ -626,8 +648,11 @@
 			/* If first stripe, Read in all read4write pages
 			 * (if needed) before we calculate the first parity.
 			 */
-			_read_4_write(ios);
+			_read_4_write_first_stripe(ios);
 		}
+		if (!cur_len) /* If last stripe r4w pages of last stripe */
+			_read_4_write_last_stripe(ios);
+		_read_4_write_execute(ios);
 
 		for (i = 0; i < num_pages; i++) {
 			pages[i] = _raid_page_alloc();
@@ -654,34 +679,14 @@
 
 int _ore_post_alloc_raid_stuff(struct ore_io_state *ios)
 {
-	struct ore_layout *layout = ios->layout;
-
 	if (ios->parity_pages) {
+		struct ore_layout *layout = ios->layout;
 		unsigned pages_in_unit = layout->stripe_unit / PAGE_SIZE;
-		unsigned stripe_size = ios->si.bytes_in_stripe;
-		u64 last_stripe, first_stripe;
 
 		if (_sp2d_alloc(pages_in_unit, layout->group_width,
 				layout->parity, &ios->sp2d)) {
 			return -ENOMEM;
 		}
-
-		/* Round io down to last full strip */
-		first_stripe = div_u64(ios->offset, stripe_size);
-		last_stripe = div_u64(ios->offset + ios->length, stripe_size);
-
-		/* If an IO spans more then a single stripe it must end at
-		 * a stripe boundary. The reminder at the end is pushed into the
-		 * next IO.
-		 */
-		if (last_stripe != first_stripe) {
-			ios->length = last_stripe * stripe_size - ios->offset;
-
-			BUG_ON(!ios->length);
-			ios->nr_pages = (ios->length + PAGE_SIZE - 1) /
-					PAGE_SIZE;
-			ios->si.length = ios->length; /*make it consistent */
-		}
 	}
 	return 0;
 }
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 735ca06..59e0849 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -745,7 +745,6 @@
 	sbi->one_comp.obj.partition = opts->pid;
 	sbi->one_comp.obj.id = 0;
 	exofs_make_credential(sbi->one_comp.cred, &sbi->one_comp.obj);
-	sbi->oc.numdevs = 1;
 	sbi->oc.single_comp = EC_SINGLE_COMP;
 	sbi->oc.comps = &sbi->one_comp;
 
@@ -804,6 +803,7 @@
 			goto free_sbi;
 
 		ore_comp_set_dev(&sbi->oc, 0, od);
+		sbi->oc.numdevs = 1;
 	}
 
 	__sbi_read_stats(sbi);
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 4bbd07a..df76291 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -90,8 +90,8 @@
 	 * unusual file system layouts.
 	 */
 	if (ext4_block_in_group(sb, ext4_block_bitmap(sb, gdp), block_group)) {
-		block_cluster = EXT4_B2C(sbi, (start -
-					       ext4_block_bitmap(sb, gdp)));
+		block_cluster = EXT4_B2C(sbi,
+					 ext4_block_bitmap(sb, gdp) - start);
 		if (block_cluster < num_clusters)
 			block_cluster = -1;
 		else if (block_cluster == num_clusters) {
@@ -102,7 +102,7 @@
 
 	if (ext4_block_in_group(sb, ext4_inode_bitmap(sb, gdp), block_group)) {
 		inode_cluster = EXT4_B2C(sbi,
-					 start - ext4_inode_bitmap(sb, gdp));
+					 ext4_inode_bitmap(sb, gdp) - start);
 		if (inode_cluster < num_clusters)
 			inode_cluster = -1;
 		else if (inode_cluster == num_clusters) {
@@ -114,7 +114,7 @@
 	itbl_blk = ext4_inode_table(sb, gdp);
 	for (i = 0; i < sbi->s_itb_per_group; i++) {
 		if (ext4_block_in_group(sb, itbl_blk + i, block_group)) {
-			c = EXT4_B2C(sbi, start - itbl_blk + i);
+			c = EXT4_B2C(sbi, itbl_blk + i - start);
 			if ((c < num_clusters) || (c == inode_cluster) ||
 			    (c == block_cluster) || (c == itbl_cluster))
 				continue;
@@ -584,7 +584,8 @@
 		if (bitmap_bh == NULL)
 			continue;
 
-		x = ext4_count_free(bitmap_bh, sb->s_blocksize);
+		x = ext4_count_free(bitmap_bh->b_data,
+				    EXT4_BLOCKS_PER_GROUP(sb) / 8);
 		printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n",
 			i, ext4_free_group_clusters(sb, gdp), x);
 		bitmap_count += x;
diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
index fa3af81..bbde5d5 100644
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -11,21 +11,15 @@
 #include <linux/jbd2.h>
 #include "ext4.h"
 
-#ifdef EXT4FS_DEBUG
-
 static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
 
-unsigned int ext4_count_free(struct buffer_head *map, unsigned int numchars)
+unsigned int ext4_count_free(char *bitmap, unsigned int numchars)
 {
 	unsigned int i, sum = 0;
 
-	if (!map)
-		return 0;
 	for (i = 0; i < numchars; i++)
-		sum += nibblemap[map->b_data[i] & 0xf] +
-			nibblemap[(map->b_data[i] >> 4) & 0xf];
+		sum += nibblemap[bitmap[i] & 0xf] +
+			nibblemap[(bitmap[i] >> 4) & 0xf];
 	return sum;
 }
 
-#endif  /*  EXT4FS_DEBUG  */
-
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 0e01e90..47d1c8c 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1140,8 +1140,7 @@
 	unsigned long s_desc_per_block;	/* Number of group descriptors per block */
 	ext4_group_t s_groups_count;	/* Number of groups in the fs */
 	ext4_group_t s_blockfile_groups;/* Groups acceptable for non-extent files */
-	unsigned long s_overhead_last;  /* Last calculated overhead */
-	unsigned long s_blocks_last;    /* Last seen block count */
+	unsigned long s_overhead;  /* # of fs overhead clusters */
 	unsigned int s_cluster_ratio;	/* Number of blocks per cluster */
 	unsigned int s_cluster_bits;	/* log2 of s_cluster_ratio */
 	loff_t s_bitmap_maxbytes;	/* max bytes for bitmap files */
@@ -1783,7 +1782,7 @@
 # define NORET_AND	noreturn,
 
 /* bitmap.c */
-extern unsigned int ext4_count_free(struct buffer_head *, unsigned);
+extern unsigned int ext4_count_free(char *bitmap, unsigned numchars);
 
 /* balloc.c */
 extern unsigned int ext4_block_group(struct super_block *sb,
@@ -1950,6 +1949,7 @@
 extern int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count);
 
 /* super.c */
+extern int ext4_calculate_overhead(struct super_block *sb);
 extern void *ext4_kvmalloc(size_t size, gfp_t flags);
 extern void *ext4_kvzalloc(size_t size, gfp_t flags);
 extern void ext4_kvfree(void *ptr);
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index abcdeab..8b384cc 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2503,10 +2503,10 @@
 {
 	struct super_block *sb = inode->i_sb;
 	int depth = ext_depth(inode);
-	struct ext4_ext_path *path;
+	struct ext4_ext_path *path = NULL;
 	ext4_fsblk_t partial_cluster = 0;
 	handle_t *handle;
-	int i, err;
+	int i = 0, err;
 
 	ext_debug("truncate since %u to %u\n", start, end);
 
@@ -2539,8 +2539,12 @@
 		}
 		depth = ext_depth(inode);
 		ex = path[depth].p_ext;
-		if (!ex)
+		if (!ex) {
+			ext4_ext_drop_refs(path);
+			kfree(path);
+			path = NULL;
 			goto cont;
+		}
 
 		ee_block = le32_to_cpu(ex->ee_block);
 
@@ -2570,8 +2574,6 @@
 			if (err < 0)
 				goto out;
 		}
-		ext4_ext_drop_refs(path);
-		kfree(path);
 	}
 cont:
 
@@ -2580,19 +2582,28 @@
 	 * after i_size and walking into the tree depth-wise.
 	 */
 	depth = ext_depth(inode);
-	path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 1), GFP_NOFS);
-	if (path == NULL) {
-		ext4_journal_stop(handle);
-		return -ENOMEM;
-	}
-	path[0].p_depth = depth;
-	path[0].p_hdr = ext_inode_hdr(inode);
+	if (path) {
+		int k = i = depth;
+		while (--k > 0)
+			path[k].p_block =
+				le16_to_cpu(path[k].p_hdr->eh_entries)+1;
+	} else {
+		path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 1),
+			       GFP_NOFS);
+		if (path == NULL) {
+			ext4_journal_stop(handle);
+			return -ENOMEM;
+		}
+		path[0].p_depth = depth;
+		path[0].p_hdr = ext_inode_hdr(inode);
+		i = 0;
 
-	if (ext4_ext_check(inode, path[0].p_hdr, depth)) {
-		err = -EIO;
-		goto out;
+		if (ext4_ext_check(inode, path[0].p_hdr, depth)) {
+			err = -EIO;
+			goto out;
+		}
 	}
-	i = err = 0;
+	err = 0;
 
 	while (i >= 0 && err == 0) {
 		if (i == depth) {
@@ -2706,8 +2717,10 @@
 out:
 	ext4_ext_drop_refs(path);
 	kfree(path);
-	if (err == -EAGAIN)
+	if (err == -EAGAIN) {
+		path = NULL;
 		goto again;
+	}
 	ext4_journal_stop(handle);
 
 	return err;
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 409c2ee..0ee374d 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -488,10 +488,12 @@
 	for (i = 0; i < ngroups; i++) {
 		grp = (parent_group + i) % ngroups;
 		desc = ext4_get_group_desc(sb, grp, NULL);
-		grp_free = ext4_free_inodes_count(sb, desc);
-		if (desc && grp_free && grp_free >= avefreei) {
-			*group = grp;
-			return 0;
+		if (desc) {
+			grp_free = ext4_free_inodes_count(sb, desc);
+			if (grp_free && grp_free >= avefreei) {
+				*group = grp;
+				return 0;
+			}
 		}
 	}
 
@@ -1011,7 +1013,8 @@
 		if (!bitmap_bh)
 			continue;
 
-		x = ext4_count_free(bitmap_bh, EXT4_INODES_PER_GROUP(sb) / 8);
+		x = ext4_count_free(bitmap_bh->b_data,
+				    EXT4_INODES_PER_GROUP(sb) / 8);
 		printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n",
 			(unsigned long) i, ext4_free_inodes_count(sb, gdp), x);
 		bitmap_count += x;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index c77b0bd..55a654d 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -279,6 +279,15 @@
 		used = ei->i_reserved_data_blocks;
 	}
 
+	if (unlikely(ei->i_allocated_meta_blocks > ei->i_reserved_meta_blocks)) {
+		ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, allocated %d "
+			 "with only %d reserved metadata blocks\n", __func__,
+			 inode->i_ino, ei->i_allocated_meta_blocks,
+			 ei->i_reserved_meta_blocks);
+		WARN_ON(1);
+		ei->i_allocated_meta_blocks = ei->i_reserved_meta_blocks;
+	}
+
 	/* Update per-inode reservations */
 	ei->i_reserved_data_blocks -= used;
 	ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;
@@ -1104,18 +1113,8 @@
 	struct ext4_inode_info *ei = EXT4_I(inode);
 	unsigned int md_needed;
 	int ret;
-
-	/*
-	 * recalculate the amount of metadata blocks to reserve
-	 * in order to allocate nrblocks
-	 * worse case is one extent per block
-	 */
-repeat:
-	spin_lock(&ei->i_block_reservation_lock);
-	md_needed = EXT4_NUM_B2C(sbi,
-				 ext4_calc_metadata_amount(inode, lblock));
-	trace_ext4_da_reserve_space(inode, md_needed);
-	spin_unlock(&ei->i_block_reservation_lock);
+	ext4_lblk_t save_last_lblock;
+	int save_len;
 
 	/*
 	 * We will charge metadata quota at writeout time; this saves
@@ -1125,19 +1124,39 @@
 	ret = dquot_reserve_block(inode, EXT4_C2B(sbi, 1));
 	if (ret)
 		return ret;
+
+	/*
+	 * recalculate the amount of metadata blocks to reserve
+	 * in order to allocate nrblocks
+	 * worse case is one extent per block
+	 */
+repeat:
+	spin_lock(&ei->i_block_reservation_lock);
+	/*
+	 * ext4_calc_metadata_amount() has side effects, which we have
+	 * to be prepared undo if we fail to claim space.
+	 */
+	save_len = ei->i_da_metadata_calc_len;
+	save_last_lblock = ei->i_da_metadata_calc_last_lblock;
+	md_needed = EXT4_NUM_B2C(sbi,
+				 ext4_calc_metadata_amount(inode, lblock));
+	trace_ext4_da_reserve_space(inode, md_needed);
+
 	/*
 	 * We do still charge estimated metadata to the sb though;
 	 * we cannot afford to run out of free blocks.
 	 */
 	if (ext4_claim_free_clusters(sbi, md_needed + 1, 0)) {
-		dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1));
+		ei->i_da_metadata_calc_len = save_len;
+		ei->i_da_metadata_calc_last_lblock = save_last_lblock;
+		spin_unlock(&ei->i_block_reservation_lock);
 		if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
 			yield();
 			goto repeat;
 		}
+		dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1));
 		return -ENOSPC;
 	}
-	spin_lock(&ei->i_block_reservation_lock);
 	ei->i_reserved_data_blocks++;
 	ei->i_reserved_meta_blocks += md_needed;
 	spin_unlock(&ei->i_block_reservation_lock);
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 6eee255..9727522 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -38,7 +38,7 @@
 		handle_t *handle = NULL;
 		int err, migrate = 0;
 		struct ext4_iloc iloc;
-		unsigned int oldflags;
+		unsigned int oldflags, mask, i;
 		unsigned int jflag;
 
 		if (!inode_owner_or_capable(inode))
@@ -115,9 +115,14 @@
 		if (err)
 			goto flags_err;
 
-		flags = flags & EXT4_FL_USER_MODIFIABLE;
-		flags |= oldflags & ~EXT4_FL_USER_MODIFIABLE;
-		ei->i_flags = flags;
+		for (i = 0, mask = 1; i < 32; i++, mask <<= 1) {
+			if (!(mask & EXT4_FL_USER_MODIFIABLE))
+				continue;
+			if (mask & flags)
+				ext4_set_inode_flag(inode, i);
+			else
+				ext4_clear_inode_flag(inode, i);
+		}
 
 		ext4_set_inode_flags(inode);
 		inode->i_ctime = ext4_current_time(inode);
@@ -256,7 +261,6 @@
 		err = ext4_move_extents(filp, donor_filp, me.orig_start,
 					me.donor_start, me.len, &me.moved_len);
 		mnt_drop_write_file(filp);
-		mnt_drop_write(filp->f_path.mnt);
 
 		if (copy_to_user((struct move_extent __user *)arg,
 				 &me, sizeof(me)))
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 99ab428..6b0a57e 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2517,6 +2517,9 @@
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits);
 
+	if (sbi->s_proc)
+		remove_proc_entry("mb_groups", sbi->s_proc);
+
 	if (sbi->s_group_info) {
 		for (i = 0; i < ngroups; i++) {
 			grinfo = ext4_get_group_info(sb, i);
@@ -2564,8 +2567,6 @@
 	}
 
 	free_percpu(sbi->s_locality_groups);
-	if (sbi->s_proc)
-		remove_proc_entry("mb_groups", sbi->s_proc);
 
 	return 0;
 }
@@ -4636,6 +4637,7 @@
 		 */
 		new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS);
 		if (!new_entry) {
+			ext4_mb_unload_buddy(&e4b);
 			err = -ENOMEM;
 			goto error_return;
 		}
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 349d7b3..0a94cbb 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1037,6 +1037,12 @@
 			EXT4_ERROR_INODE(dir, "bad inode number: %u", ino);
 			return ERR_PTR(-EIO);
 		}
+		if (unlikely(ino == dir->i_ino)) {
+			EXT4_ERROR_INODE(dir, "'%.*s' linked to parent dir",
+					 dentry->d_name.len,
+					 dentry->d_name.name);
+			return ERR_PTR(-EIO);
+		}
 		inode = ext4_iget(dir->i_sb, ino);
 		if (inode == ERR_PTR(-ESTALE)) {
 			EXT4_ERROR_INODE(dir,
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 59fa0be..aa72ee7 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -161,6 +161,8 @@
 	if (flex_gd == NULL)
 		goto out3;
 
+	if (flexbg_size >= UINT_MAX / sizeof(struct ext4_new_flex_group_data))
+		goto out2;
 	flex_gd->count = flexbg_size;
 
 	flex_gd->groups = kmalloc(sizeof(struct ext4_new_group_data) *
@@ -1214,6 +1216,11 @@
 			   &sbi->s_flex_groups[flex_group].free_inodes);
 	}
 
+	/*
+	 * Update the fs overhead information
+	 */
+	ext4_calculate_overhead(sb);
+
 	if (test_opt(sb, DEBUG))
 		printk(KERN_DEBUG "EXT4-fs: added group %u:"
 		       "%llu blocks(%llu free %llu reserved)\n", flex_gd->count,
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e1fb1d5..12a278f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -497,6 +497,7 @@
 	printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: comm %s: %pV\n",
 	       sb->s_id, function, line, current->comm, &vaf);
 	va_end(args);
+	save_error_info(sb, function, line);
 
 	ext4_handle_error(sb);
 }
@@ -931,6 +932,7 @@
 	ei->i_reserved_meta_blocks = 0;
 	ei->i_allocated_meta_blocks = 0;
 	ei->i_da_metadata_calc_len = 0;
+	ei->i_da_metadata_calc_last_lblock = 0;
 	spin_lock_init(&(ei->i_block_reservation_lock));
 #ifdef CONFIG_QUOTA
 	ei->i_reserved_quota = 0;
@@ -2943,6 +2945,118 @@
 	kthread_stop(ext4_lazyinit_task);
 }
 
+/*
+ * Note: calculating the overhead so we can be compatible with
+ * historical BSD practice is quite difficult in the face of
+ * clusters/bigalloc.  This is because multiple metadata blocks from
+ * different block group can end up in the same allocation cluster.
+ * Calculating the exact overhead in the face of clustered allocation
+ * requires either O(all block bitmaps) in memory or O(number of block
+ * groups**2) in time.  We will still calculate the superblock for
+ * older file systems --- and if we come across with a bigalloc file
+ * system with zero in s_overhead_clusters the estimate will be close to
+ * correct especially for very large cluster sizes --- but for newer
+ * file systems, it's better to calculate this figure once at mkfs
+ * time, and store it in the superblock.  If the superblock value is
+ * present (even for non-bigalloc file systems), we will use it.
+ */
+static int count_overhead(struct super_block *sb, ext4_group_t grp,
+			  char *buf)
+{
+	struct ext4_sb_info	*sbi = EXT4_SB(sb);
+	struct ext4_group_desc	*gdp;
+	ext4_fsblk_t		first_block, last_block, b;
+	ext4_group_t		i, ngroups = ext4_get_groups_count(sb);
+	int			s, j, count = 0;
+
+	if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_BIGALLOC))
+		return (ext4_bg_has_super(sb, grp) + ext4_bg_num_gdb(sb, grp) +
+			sbi->s_itb_per_group + 2);
+
+	first_block = le32_to_cpu(sbi->s_es->s_first_data_block) +
+		(grp * EXT4_BLOCKS_PER_GROUP(sb));
+	last_block = first_block + EXT4_BLOCKS_PER_GROUP(sb) - 1;
+	for (i = 0; i < ngroups; i++) {
+		gdp = ext4_get_group_desc(sb, i, NULL);
+		b = ext4_block_bitmap(sb, gdp);
+		if (b >= first_block && b <= last_block) {
+			ext4_set_bit(EXT4_B2C(sbi, b - first_block), buf);
+			count++;
+		}
+		b = ext4_inode_bitmap(sb, gdp);
+		if (b >= first_block && b <= last_block) {
+			ext4_set_bit(EXT4_B2C(sbi, b - first_block), buf);
+			count++;
+		}
+		b = ext4_inode_table(sb, gdp);
+		if (b >= first_block && b + sbi->s_itb_per_group <= last_block)
+			for (j = 0; j < sbi->s_itb_per_group; j++, b++) {
+				int c = EXT4_B2C(sbi, b - first_block);
+				ext4_set_bit(c, buf);
+				count++;
+			}
+		if (i != grp)
+			continue;
+		s = 0;
+		if (ext4_bg_has_super(sb, grp)) {
+			ext4_set_bit(s++, buf);
+			count++;
+		}
+		for (j = ext4_bg_num_gdb(sb, grp); j > 0; j--) {
+			ext4_set_bit(EXT4_B2C(sbi, s++), buf);
+			count++;
+		}
+	}
+	if (!count)
+		return 0;
+	return EXT4_CLUSTERS_PER_GROUP(sb) -
+		ext4_count_free(buf, EXT4_CLUSTERS_PER_GROUP(sb) / 8);
+}
+
+/*
+ * Compute the overhead and stash it in sbi->s_overhead
+ */
+int ext4_calculate_overhead(struct super_block *sb)
+{
+	struct ext4_sb_info *sbi = EXT4_SB(sb);
+	struct ext4_super_block *es = sbi->s_es;
+	ext4_group_t i, ngroups = ext4_get_groups_count(sb);
+	ext4_fsblk_t overhead = 0;
+	char *buf = (char *) get_zeroed_page(GFP_KERNEL);
+
+	memset(buf, 0, PAGE_SIZE);
+	if (!buf)
+		return -ENOMEM;
+
+	/*
+	 * Compute the overhead (FS structures).  This is constant
+	 * for a given filesystem unless the number of block groups
+	 * changes so we cache the previous value until it does.
+	 */
+
+	/*
+	 * All of the blocks before first_data_block are overhead
+	 */
+	overhead = EXT4_B2C(sbi, le32_to_cpu(es->s_first_data_block));
+
+	/*
+	 * Add the overhead found in each block group
+	 */
+	for (i = 0; i < ngroups; i++) {
+		int blks;
+
+		blks = count_overhead(sb, i, buf);
+		overhead += blks;
+		if (blks)
+			memset(buf, 0, PAGE_SIZE);
+		cond_resched();
+	}
+	sbi->s_overhead = overhead;
+	smp_wmb();
+	free_page((unsigned long) buf);
+	return 0;
+}
+
 static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 {
 	char *orig_data = kstrdup(data, GFP_KERNEL);
@@ -3558,6 +3672,18 @@
 
 no_journal:
 	/*
+	 * Get the # of file system overhead blocks from the
+	 * superblock if present.
+	 */
+	if (es->s_overhead_clusters)
+		sbi->s_overhead = le32_to_cpu(es->s_overhead_clusters);
+	else {
+		ret = ext4_calculate_overhead(sb);
+		if (ret)
+			goto failed_mount_wq;
+	}
+
+	/*
 	 * The maximum number of concurrent works can be high and
 	 * concurrency isn't really necessary.  Limit it to 1.
 	 */
@@ -3592,7 +3718,8 @@
 		goto failed_mount4;
 	}
 
-	ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY);
+	if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY))
+		sb->s_flags |= MS_RDONLY;
 
 	/* determine the minimum size of new large inodes, if present */
 	if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {
@@ -4105,6 +4232,7 @@
 		ext4_commit_super(sb, 1);
 
 		jbd2_journal_clear_err(journal);
+		jbd2_journal_update_sb_errno(journal);
 	}
 }
 
@@ -4419,67 +4547,21 @@
 	return err;
 }
 
-/*
- * Note: calculating the overhead so we can be compatible with
- * historical BSD practice is quite difficult in the face of
- * clusters/bigalloc.  This is because multiple metadata blocks from
- * different block group can end up in the same allocation cluster.
- * Calculating the exact overhead in the face of clustered allocation
- * requires either O(all block bitmaps) in memory or O(number of block
- * groups**2) in time.  We will still calculate the superblock for
- * older file systems --- and if we come across with a bigalloc file
- * system with zero in s_overhead_clusters the estimate will be close to
- * correct especially for very large cluster sizes --- but for newer
- * file systems, it's better to calculate this figure once at mkfs
- * time, and store it in the superblock.  If the superblock value is
- * present (even for non-bigalloc file systems), we will use it.
- */
 static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
 	struct super_block *sb = dentry->d_sb;
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct ext4_super_block *es = sbi->s_es;
-	struct ext4_group_desc *gdp;
+	ext4_fsblk_t overhead = 0;
 	u64 fsid;
 	s64 bfree;
 
-	if (test_opt(sb, MINIX_DF)) {
-		sbi->s_overhead_last = 0;
-	} else if (es->s_overhead_clusters) {
-		sbi->s_overhead_last = le32_to_cpu(es->s_overhead_clusters);
-	} else if (sbi->s_blocks_last != ext4_blocks_count(es)) {
-		ext4_group_t i, ngroups = ext4_get_groups_count(sb);
-		ext4_fsblk_t overhead = 0;
-
-		/*
-		 * Compute the overhead (FS structures).  This is constant
-		 * for a given filesystem unless the number of block groups
-		 * changes so we cache the previous value until it does.
-		 */
-
-		/*
-		 * All of the blocks before first_data_block are
-		 * overhead
-		 */
-		overhead = EXT4_B2C(sbi, le32_to_cpu(es->s_first_data_block));
-
-		/*
-		 * Add the overhead found in each block group
-		 */
-		for (i = 0; i < ngroups; i++) {
-			gdp = ext4_get_group_desc(sb, i, NULL);
-			overhead += ext4_num_overhead_clusters(sb, i, gdp);
-			cond_resched();
-		}
-		sbi->s_overhead_last = overhead;
-		smp_wmb();
-		sbi->s_blocks_last = ext4_blocks_count(es);
-	}
+	if (!test_opt(sb, MINIX_DF))
+		overhead = sbi->s_overhead;
 
 	buf->f_type = EXT4_SUPER_MAGIC;
 	buf->f_bsize = sb->s_blocksize;
-	buf->f_blocks = (ext4_blocks_count(es) -
-			 EXT4_C2B(sbi, sbi->s_overhead_last));
+	buf->f_blocks = ext4_blocks_count(es) - EXT4_C2B(sbi, sbi->s_overhead);
 	bfree = percpu_counter_sum_positive(&sbi->s_freeclusters_counter) -
 		percpu_counter_sum_positive(&sbi->s_dirtyclusters_counter);
 	/* prevent underflow in case that few free space is available */
diff --git a/fs/fifo.c b/fs/fifo.c
index b1a524d..cf6f434 100644
--- a/fs/fifo.c
+++ b/fs/fifo.c
@@ -14,7 +14,7 @@
 #include <linux/sched.h>
 #include <linux/pipe_fs_i.h>
 
-static void wait_for_partner(struct inode* inode, unsigned int *cnt)
+static int wait_for_partner(struct inode* inode, unsigned int *cnt)
 {
 	int cur = *cnt;	
 
@@ -23,6 +23,7 @@
 		if (signal_pending(current))
 			break;
 	}
+	return cur == *cnt ? -ERESTARTSYS : 0;
 }
 
 static void wake_up_partner(struct inode* inode)
@@ -67,8 +68,7 @@
 				 * seen a writer */
 				filp->f_version = pipe->w_counter;
 			} else {
-				wait_for_partner(inode, &pipe->w_counter);
-				if(signal_pending(current))
+				if (wait_for_partner(inode, &pipe->w_counter))
 					goto err_rd;
 			}
 		}
@@ -90,8 +90,7 @@
 			wake_up_partner(inode);
 
 		if (!pipe->readers) {
-			wait_for_partner(inode, &pipe->r_counter);
-			if (signal_pending(current))
+			if (wait_for_partner(inode, &pipe->r_counter))
 				goto err_wr;
 		}
 		break;
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index df5ac04..bc43832 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -863,6 +863,7 @@
 		if (stat) {
 			generic_fillattr(inode, stat);
 			stat->mode = fi->orig_i_mode;
+			stat->ino = fi->orig_ino;
 		}
 	}
 
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 6b83222..d96318b 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1734,7 +1734,7 @@
 	size_t n;
 	u32 max = FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT;
 
-	for (n = 0; n < count; n++) {
+	for (n = 0; n < count; n++, iov++) {
 		if (iov->iov_len > (size_t) max)
 			return -ENOMEM;
 		max -= iov->iov_len;
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 572cefc..d181926 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -82,6 +82,9 @@
 	    preserve the original mode */
 	umode_t orig_i_mode;
 
+	/** 64 bit inode number */
+	u64 orig_ino;
+
 	/** Version of last attribute change */
 	u64 attr_version;
 
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 26783eb..a59cf5e 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -91,6 +91,7 @@
 	fi->nlookup = 0;
 	fi->attr_version = 0;
 	fi->writectr = 0;
+	fi->orig_ino = 0;
 	INIT_LIST_HEAD(&fi->write_files);
 	INIT_LIST_HEAD(&fi->queued_writes);
 	INIT_LIST_HEAD(&fi->writepages);
@@ -139,6 +140,18 @@
 	return 0;
 }
 
+/*
+ * ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value down
+ * so that it will fit.
+ */
+static ino_t fuse_squash_ino(u64 ino64)
+{
+	ino_t ino = (ino_t) ino64;
+	if (sizeof(ino_t) < sizeof(u64))
+		ino ^= ino64 >> (sizeof(u64) - sizeof(ino_t)) * 8;
+	return ino;
+}
+
 void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
 				   u64 attr_valid)
 {
@@ -148,7 +161,7 @@
 	fi->attr_version = ++fc->attr_version;
 	fi->i_time = attr_valid;
 
-	inode->i_ino     = attr->ino;
+	inode->i_ino     = fuse_squash_ino(attr->ino);
 	inode->i_mode    = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
 	set_nlink(inode, attr->nlink);
 	inode->i_uid     = attr->uid;
@@ -174,6 +187,8 @@
 	fi->orig_i_mode = inode->i_mode;
 	if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS))
 		inode->i_mode &= ~S_ISVTX;
+
+	fi->orig_ino = attr->ino;
 }
 
 void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index c640ba5..09addc8 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -31,6 +31,7 @@
 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);
 	struct hfsplus_vh *vh = sbi->s_vhdr;
 	struct hfsplus_vh *bvh = sbi->s_backup_vhdr;
+	u32 cnid = (unsigned long)dentry->d_fsdata;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
@@ -41,8 +42,12 @@
 	vh->finder_info[0] = bvh->finder_info[0] =
 		cpu_to_be32(parent_ino(dentry));
 
-	/* Bootloader */
-	vh->finder_info[1] = bvh->finder_info[1] = cpu_to_be32(inode->i_ino);
+	/*
+	 * Bootloader. Just using the inode here breaks in the case of
+	 * hard links - the firmware wants the ID of the hard link file,
+	 * but the inode points at the indirect inode
+	 */
+	vh->finder_info[1] = bvh->finder_info[1] = cpu_to_be32(cnid);
 
 	/* Per spec, the OS X system folder - same as finder_info[0] here */
 	vh->finder_info[5] = bvh->finder_info[5] =
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
index 7daf4b8..90effcc 100644
--- a/fs/hfsplus/wrapper.c
+++ b/fs/hfsplus/wrapper.c
@@ -56,7 +56,7 @@
 	DECLARE_COMPLETION_ONSTACK(wait);
 	struct bio *bio;
 	int ret = 0;
-	unsigned int io_size;
+	u64 io_size;
 	loff_t start;
 	int offset;
 
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index e52effd..9599d39 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1340,7 +1340,7 @@
  * Update a journal's errno.  Write updated superblock to disk waiting for IO
  * to complete.
  */
-static void jbd2_journal_update_sb_errno(journal_t *journal)
+void jbd2_journal_update_sb_errno(journal_t *journal)
 {
 	journal_superblock_t *sb = journal->j_superblock;
 
@@ -1352,6 +1352,7 @@
 
 	jbd2_write_superblock(journal, WRITE_SYNC);
 }
+EXPORT_SYMBOL(jbd2_journal_update_sb_errno);
 
 /*
  * Read the superblock for a given journal, performing initial
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index ba1dc2e..ca0a080 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -56,7 +56,7 @@
 	u32 nlm_version = (nlm_init->nfs_version == 2) ? 1 : 4;
 	int status;
 
-	status = lockd_up();
+	status = lockd_up(nlm_init->net);
 	if (status < 0)
 		return ERR_PTR(status);
 
@@ -65,7 +65,7 @@
 				   nlm_init->hostname, nlm_init->noresvport,
 				   nlm_init->net);
 	if (host == NULL) {
-		lockd_down();
+		lockd_down(nlm_init->net);
 		return ERR_PTR(-ENOLCK);
 	}
 
@@ -80,8 +80,10 @@
  */
 void nlmclnt_done(struct nlm_host *host)
 {
+	struct net *net = host->net;
+
 	nlmclnt_release_host(host);
-	lockd_down();
+	lockd_down(net);
 }
 EXPORT_SYMBOL_GPL(nlmclnt_done);
 
@@ -220,11 +222,12 @@
 	struct nlm_wait	  *block;
 	struct file_lock *fl, *next;
 	u32 nsmstate;
+	struct net *net = host->net;
 
 	allow_signal(SIGKILL);
 
 	down_write(&host->h_rwsem);
-	lockd_up();	/* note: this cannot fail as lockd is already running */
+	lockd_up(net);	/* note: this cannot fail as lockd is already running */
 
 	dprintk("lockd: reclaiming locks for host %s\n", host->h_name);
 
@@ -275,6 +278,6 @@
 
 	/* Release host handle after use */
 	nlmclnt_release_host(host);
-	lockd_down();
+	lockd_down(net);
 	return 0;
 }
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index f49b9af..3250f28 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -257,7 +257,7 @@
 	struct svc_serv *serv = nlmsvc_rqst->rq_server;
 	int error;
 
-	if (ln->nlmsvc_users)
+	if (ln->nlmsvc_users++)
 		return 0;
 
 	error = svc_rpcb_setup(serv, net);
@@ -272,6 +272,7 @@
 err_socks:
 	svc_rpcb_cleanup(serv, net);
 err_rpcb:
+	ln->nlmsvc_users--;
 	return error;
 }
 
@@ -295,11 +296,11 @@
 /*
  * Bring up the lockd process if it's not already up.
  */
-int lockd_up(void)
+int lockd_up(struct net *net)
 {
 	struct svc_serv *serv;
 	int		error = 0;
-	struct net *net = current->nsproxy->net_ns;
+	struct lockd_net *ln = net_generic(net, lockd_net_id);
 
 	mutex_lock(&nlmsvc_mutex);
 	/*
@@ -325,9 +326,17 @@
 		goto out;
 	}
 
+	error = svc_bind(serv, net);
+	if (error < 0) {
+		printk(KERN_WARNING "lockd_up: bind service failed\n");
+		goto destroy_and_out;
+	}
+
+	ln->nlmsvc_users++;
+
 	error = make_socks(serv, net);
 	if (error < 0)
-		goto destroy_and_out;
+		goto err_start;
 
 	/*
 	 * Create the kernel thread and wait for it to start.
@@ -339,7 +348,7 @@
 		printk(KERN_WARNING
 			"lockd_up: svc_rqst allocation failed, error=%d\n",
 			error);
-		goto destroy_and_out;
+		goto err_start;
 	}
 
 	svc_sock_update_bufs(serv);
@@ -353,7 +362,7 @@
 		nlmsvc_rqst = NULL;
 		printk(KERN_WARNING
 			"lockd_up: kthread_run failed, error=%d\n", error);
-		goto destroy_and_out;
+		goto err_start;
 	}
 
 	/*
@@ -363,14 +372,14 @@
 destroy_and_out:
 	svc_destroy(serv);
 out:
-	if (!error) {
-		struct lockd_net *ln = net_generic(net, lockd_net_id);
-
-		ln->nlmsvc_users++;
+	if (!error)
 		nlmsvc_users++;
-	}
 	mutex_unlock(&nlmsvc_mutex);
 	return error;
+
+err_start:
+	lockd_down_net(net);
+	goto destroy_and_out;
 }
 EXPORT_SYMBOL_GPL(lockd_up);
 
@@ -378,14 +387,13 @@
  * Decrement the user count and bring down lockd if we're the last.
  */
 void
-lockd_down(void)
+lockd_down(struct net *net)
 {
 	mutex_lock(&nlmsvc_mutex);
+	lockd_down_net(net);
 	if (nlmsvc_users) {
-		if (--nlmsvc_users) {
-			lockd_down_net(current->nsproxy->net_ns);
+		if (--nlmsvc_users)
 			goto out;
-		}
 	} else {
 		printk(KERN_ERR "lockd_down: no users! task=%p\n",
 			nlmsvc_task);
diff --git a/fs/locks.c b/fs/locks.c
index 0d68f1f..fcc50ab 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -308,7 +308,7 @@
 	return 0;
 }
 
-static int assign_type(struct file_lock *fl, int type)
+static int assign_type(struct file_lock *fl, long type)
 {
 	switch (type) {
 	case F_RDLCK:
@@ -445,7 +445,7 @@
 /*
  * Initialize a lease, use the default lock manager operations
  */
-static int lease_init(struct file *filp, int type, struct file_lock *fl)
+static int lease_init(struct file *filp, long type, struct file_lock *fl)
  {
 	if (assign_type(fl, type) != 0)
 		return -EINVAL;
@@ -463,7 +463,7 @@
 }
 
 /* Allocate a file_lock initialised to this type of lease */
-static struct file_lock *lease_alloc(struct file *filp, int type)
+static struct file_lock *lease_alloc(struct file *filp, long type)
 {
 	struct file_lock *fl = locks_alloc_lock();
 	int error = -ENOMEM;
@@ -1465,7 +1465,7 @@
 	case F_WRLCK:
 		return generic_add_lease(filp, arg, flp);
 	default:
-		BUG();
+		return -EINVAL;
 	}
 }
 EXPORT_SYMBOL(generic_setlease);
diff --git a/fs/namespace.c b/fs/namespace.c
index e608199..4e46539 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1073,8 +1073,9 @@
 		list_del_init(&p->mnt_expire);
 		list_del_init(&p->mnt_list);
 		__touch_mnt_namespace(p->mnt_ns);
+		if (p->mnt_ns)
+			__mnt_make_shortterm(p);
 		p->mnt_ns = NULL;
-		__mnt_make_shortterm(p);
 		list_del_init(&p->mnt_child);
 		if (mnt_has_parent(p)) {
 			p->mnt_parent->mnt_ghosts++;
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index eb95f50..38a44c6 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -106,7 +106,7 @@
 {
 	int ret;
 
-	ret = svc_create_xprt(serv, "tcp", xprt->xprt_net, PF_INET,
+	ret = svc_create_xprt(serv, "tcp", &init_net, PF_INET,
 				nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
 	if (ret <= 0)
 		goto out_err;
@@ -114,7 +114,7 @@
 	dprintk("NFS: Callback listener port = %u (af %u)\n",
 			nfs_callback_tcpport, PF_INET);
 
-	ret = svc_create_xprt(serv, "tcp", xprt->xprt_net, PF_INET6,
+	ret = svc_create_xprt(serv, "tcp", &init_net, PF_INET6,
 				nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
 	if (ret > 0) {
 		nfs_callback_tcpport6 = ret;
@@ -183,7 +183,7 @@
 	 * fore channel connection.
 	 * Returns the input port (0) and sets the svc_serv bc_xprt on success
 	 */
-	ret = svc_create_xprt(serv, "tcp-bc", xprt->xprt_net, PF_INET, 0,
+	ret = svc_create_xprt(serv, "tcp-bc", &init_net, PF_INET, 0,
 			      SVC_SOCK_ANONYMOUS);
 	if (ret < 0) {
 		rqstp = ERR_PTR(ret);
@@ -253,6 +253,7 @@
 	char svc_name[12];
 	int ret = 0;
 	int minorversion_setup;
+	struct net *net = &init_net;
 
 	mutex_lock(&nfs_callback_mutex);
 	if (cb_info->users++ || cb_info->task != NULL) {
@@ -265,6 +266,12 @@
 		goto out_err;
 	}
 
+	ret = svc_bind(serv, net);
+	if (ret < 0) {
+		printk(KERN_WARNING "NFS: bind callback service failed\n");
+		goto out_err;
+	}
+
 	minorversion_setup =  nfs_minorversion_callback_svc_setup(minorversion,
 					serv, xprt, &rqstp, &callback_svc);
 	if (!minorversion_setup) {
@@ -306,6 +313,8 @@
 	dprintk("NFS: Couldn't create callback socket or server thread; "
 		"err = %d\n", ret);
 	cb_info->users--;
+	if (serv)
+		svc_shutdown_net(serv, net);
 	goto out;
 }
 
@@ -320,6 +329,7 @@
 	cb_info->users--;
 	if (cb_info->users == 0 && cb_info->task != NULL) {
 		kthread_stop(cb_info->task);
+		svc_shutdown_net(cb_info->serv, &init_net);
 		svc_exit_thread(cb_info->rqst);
 		cb_info->serv = NULL;
 		cb_info->rqst = NULL;
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index aa9b709..f0f439d 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -451,8 +451,11 @@
 
 	dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);
 
-	/* Only do I/O if gfp is a superset of GFP_KERNEL */
-	if (mapping && (gfp & GFP_KERNEL) == GFP_KERNEL) {
+	/* Only do I/O if gfp is a superset of GFP_KERNEL, and we're not
+	 * doing this memory reclaim for a fs-related allocation.
+	 */
+	if (mapping && (gfp & GFP_KERNEL) == GFP_KERNEL &&
+	    !(current->flags & PF_FSTRANS)) {
 		int how = FLUSH_SYNC;
 
 		/* Don't let kswapd deadlock waiting for OOM RPC calls */
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index ba3019f..929ba011 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -57,6 +57,11 @@
 static const struct cred *id_resolver_cache;
 static struct key_type key_type_id_resolver_legacy;
 
+struct idmap {
+	struct rpc_pipe		*idmap_pipe;
+	struct key_construction	*idmap_key_cons;
+	struct mutex		idmap_mutex;
+};
 
 /**
  * nfs_fattr_init_names - initialise the nfs_fattr owner_name/group_name fields
@@ -200,12 +205,18 @@
 	if (ret < 0)
 		goto failed_put_key;
 
+	ret = register_key_type(&key_type_id_resolver_legacy);
+	if (ret < 0)
+		goto failed_reg_legacy;
+
 	set_bit(KEY_FLAG_ROOT_CAN_CLEAR, &keyring->flags);
 	cred->thread_keyring = keyring;
 	cred->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING;
 	id_resolver_cache = cred;
 	return 0;
 
+failed_reg_legacy:
+	unregister_key_type(&key_type_id_resolver);
 failed_put_key:
 	key_put(keyring);
 failed_put_cred:
@@ -217,6 +228,7 @@
 {
 	key_revoke(id_resolver_cache->thread_keyring);
 	unregister_key_type(&key_type_id_resolver);
+	unregister_key_type(&key_type_id_resolver_legacy);
 	put_cred(id_resolver_cache);
 }
 
@@ -310,9 +322,11 @@
 					    name, namelen, type, data,
 					    data_size, NULL);
 	if (ret < 0) {
+		mutex_lock(&idmap->idmap_mutex);
 		ret = nfs_idmap_request_key(&key_type_id_resolver_legacy,
 					    name, namelen, type, data,
 					    data_size, idmap);
+		mutex_unlock(&idmap->idmap_mutex);
 	}
 	return ret;
 }
@@ -354,11 +368,6 @@
 /* idmap classic begins here */
 module_param(nfs_idmap_cache_timeout, int, 0644);
 
-struct idmap {
-	struct rpc_pipe		*idmap_pipe;
-	struct key_construction	*idmap_key_cons;
-};
-
 enum {
 	Opt_find_uid, Opt_find_gid, Opt_find_user, Opt_find_group, Opt_find_err
 };
@@ -383,7 +392,7 @@
 };
 
 static struct key_type key_type_id_resolver_legacy = {
-	.name		= "id_resolver",
+	.name		= "id_legacy",
 	.instantiate	= user_instantiate,
 	.match		= user_match,
 	.revoke		= user_revoke,
@@ -469,6 +478,7 @@
 		return error;
 	}
 	idmap->idmap_pipe = pipe;
+	mutex_init(&idmap->idmap_mutex);
 
 	clp->cl_idmap = idmap;
 	return 0;
@@ -640,25 +650,22 @@
 	struct idmap_msg *im;
 	struct idmap *idmap = (struct idmap *)aux;
 	struct key *key = cons->key;
-	int ret;
+	int ret = -ENOMEM;
 
 	/* msg and im are freed in idmap_pipe_destroy_msg */
 	msg = kmalloc(sizeof(*msg), GFP_KERNEL);
-	if (IS_ERR(msg)) {
-		ret = PTR_ERR(msg);
+	if (!msg)
 		goto out0;
-	}
 
 	im = kmalloc(sizeof(*im), GFP_KERNEL);
-	if (IS_ERR(im)) {
-		ret = PTR_ERR(im);
+	if (!im)
 		goto out1;
-	}
 
 	ret = nfs_idmap_prepare_message(key->description, im, msg);
 	if (ret < 0)
 		goto out2;
 
+	BUG_ON(idmap->idmap_key_cons != NULL);
 	idmap->idmap_key_cons = cons;
 
 	ret = rpc_queue_upcall(idmap->idmap_pipe, msg);
@@ -672,8 +679,7 @@
 out1:
 	kfree(msg);
 out0:
-	key_revoke(cons->key);
-	key_revoke(cons->authkey);
+	complete_request_key(cons, ret);
 	return ret;
 }
 
@@ -707,11 +713,18 @@
 {
 	struct rpc_inode *rpci = RPC_I(filp->f_path.dentry->d_inode);
 	struct idmap *idmap = (struct idmap *)rpci->private;
-	struct key_construction *cons = idmap->idmap_key_cons;
+	struct key_construction *cons;
 	struct idmap_msg im;
 	size_t namelen_in;
 	int ret;
 
+	/* If instantiation is successful, anyone waiting for key construction
+	 * will have been woken up and someone else may now have used
+	 * idmap_key_cons - so after this point we may no longer touch it.
+	 */
+	cons = ACCESS_ONCE(idmap->idmap_key_cons);
+	idmap->idmap_key_cons = NULL;
+
 	if (mlen != sizeof(im)) {
 		ret = -ENOSPC;
 		goto out;
@@ -724,7 +737,7 @@
 
 	if (!(im.im_status & IDMAP_STATUS_SUCCESS)) {
 		ret = mlen;
-		complete_request_key(idmap->idmap_key_cons, -ENOKEY);
+		complete_request_key(cons, -ENOKEY);
 		goto out_incomplete;
 	}
 
@@ -741,7 +754,7 @@
 	}
 
 out:
-	complete_request_key(idmap->idmap_key_cons, ret);
+	complete_request_key(cons, ret);
 out_incomplete:
 	return ret;
 }
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index e8bbfa5..2c0c609 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -79,7 +79,7 @@
 {
 	if (fatal_signal_pending(current))
 		return -ERESTARTSYS;
-	freezable_schedule();
+	freezable_schedule_unsafe();
 	return 0;
 }
 
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 5242eae..2ab36b4 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -33,7 +33,7 @@
 		res = rpc_call_sync(clnt, msg, flags);
 		if (res != -EJUKEBOX && res != -EKEYEXPIRED)
 			break;
-		freezable_schedule_timeout_killable(NFS_JUKEBOX_RETRY_TIME);
+		freezable_schedule_timeout_killable_unsafe(NFS_JUKEBOX_RETRY_TIME);
 		res = -ERESTARTSYS;
 	} while (!fatal_signal_pending(current));
 	return res;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 99650aa..535f384 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -101,6 +101,8 @@
 	case -NFS4ERR_BADOWNER:
 	case -NFS4ERR_BADNAME:
 		return -EINVAL;
+	case -NFS4ERR_SHARE_DENIED:
+		return -EACCES;
 	default:
 		dprintk("%s could not handle NFSv4 error %d\n",
 				__func__, -err);
@@ -248,7 +250,7 @@
 		*timeout = NFS4_POLL_RETRY_MIN;
 	if (*timeout > NFS4_POLL_RETRY_MAX)
 		*timeout = NFS4_POLL_RETRY_MAX;
-	freezable_schedule_timeout_killable(*timeout);
+	freezable_schedule_timeout_killable_unsafe(*timeout);
 	if (fatal_signal_pending(current))
 		res = -ERESTARTSYS;
 	*timeout <<= 1;
@@ -1859,6 +1861,7 @@
 	struct nfs4_state *res;
 	int status;
 
+	fmode &= FMODE_READ|FMODE_WRITE;
 	do {
 		status = _nfs4_do_open(dir, dentry, fmode, flags, sattr, cred, &res);
 		if (status == 0)
@@ -4161,7 +4164,7 @@
 static unsigned long
 nfs4_set_lock_task_retry(unsigned long timeout)
 {
-	freezable_schedule_timeout_killable(timeout);
+	freezable_schedule_timeout_killable_unsafe(timeout);
 	timeout <<= 1;
 	if (timeout > NFS4_LOCK_MAXTIMEOUT)
 		return NFS4_LOCK_MAXTIMEOUT;
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
index 4bff4a3..1afe74c 100644
--- a/fs/nfs/objlayout/objio_osd.c
+++ b/fs/nfs/objlayout/objio_osd.c
@@ -453,7 +453,10 @@
 	objios->ios->done = _read_done;
 	dprintk("%s: offset=0x%llx length=0x%x\n", __func__,
 		rdata->args.offset, rdata->args.count);
-	return ore_read(objios->ios);
+	ret = ore_read(objios->ios);
+	if (unlikely(ret))
+		objio_free_result(&objios->oir);
+	return ret;
 }
 
 /*
@@ -484,8 +487,16 @@
 	struct objio_state *objios = priv;
 	struct nfs_write_data *wdata = objios->oir.rpcdata;
 	pgoff_t index = offset / PAGE_SIZE;
-	struct page *page = find_get_page(wdata->inode->i_mapping, index);
+	struct page *page;
+	loff_t i_size = i_size_read(wdata->inode);
 
+	if (offset >= i_size) {
+		*uptodate = true;
+		dprintk("%s: g_zero_page index=0x%lx\n", __func__, index);
+		return ZERO_PAGE(0);
+	}
+
+	page = find_get_page(wdata->inode->i_mapping, index);
 	if (!page) {
 		page = find_or_create_page(wdata->inode->i_mapping,
 						index, GFP_NOFS);
@@ -506,8 +517,10 @@
 
 static void __r4w_put_page(void *priv, struct page *page)
 {
-	dprintk("%s: index=0x%lx\n", __func__, page->index);
-	page_cache_release(page);
+	dprintk("%s: index=0x%lx\n", __func__,
+		(page == ZERO_PAGE(0)) ? -1UL : page->index);
+	if (ZERO_PAGE(0) != page)
+		page_cache_release(page);
 	return;
 }
 
@@ -537,8 +550,10 @@
 	dprintk("%s: offset=0x%llx length=0x%x\n", __func__,
 		wdata->args.offset, wdata->args.count);
 	ret = ore_write(objios->ios);
-	if (unlikely(ret))
+	if (unlikely(ret)) {
+		objio_free_result(&objios->oir);
 		return ret;
+	}
 
 	if (objios->sync)
 		_write_done(objios->ios, objios);
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 7f71c69..e79c24e 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -862,7 +862,7 @@
 	struct nfsd4_session *ses;
 	int mem;
 
-	BUG_ON(!spin_is_locked(&client_lock));
+	lockdep_assert_held(&client_lock);
 	ses = container_of(kref, struct nfsd4_session, se_ref);
 	nfsd4_del_conns(ses);
 	spin_lock(&nfsd_drc_lock);
@@ -1041,7 +1041,7 @@
 static inline void
 free_client(struct nfs4_client *clp)
 {
-	BUG_ON(!spin_is_locked(&client_lock));
+	lockdep_assert_held(&client_lock);
 	while (!list_empty(&clp->cl_sessions)) {
 		struct nfsd4_session *ses;
 		ses = list_entry(clp->cl_sessions.next, struct nfsd4_session,
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index e35df2d..9358760 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2245,7 +2245,7 @@
 	if (bmval0 & FATTR4_WORD0_CASE_INSENSITIVE) {
 		if ((buflen -= 4) < 0)
 			goto out_resource;
-		WRITE32(1);
+		WRITE32(0);
 	}
 	if (bmval0 & FATTR4_WORD0_CASE_PRESERVING) {
 		if ((buflen -= 4) < 0)
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 2c53be6..3ab12eb 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -651,6 +651,7 @@
 {
 	char *mesg = buf;
 	int fd, err;
+	struct net *net = &init_net;
 
 	err = get_int(&mesg, &fd);
 	if (err != 0 || fd < 0)
@@ -662,6 +663,8 @@
 
 	err = svc_addsock(nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT);
 	if (err < 0) {
+		if (nfsd_serv->sv_nrthreads == 1)
+			svc_shutdown_net(nfsd_serv, net);
 		svc_destroy(nfsd_serv);
 		return err;
 	}
@@ -699,6 +702,7 @@
 	char transport[16];
 	struct svc_xprt *xprt;
 	int port, err;
+	struct net *net = &init_net;
 
 	if (sscanf(buf, "%15s %4u", transport, &port) != 2)
 		return -EINVAL;
@@ -710,12 +714,12 @@
 	if (err != 0)
 		return err;
 
-	err = svc_create_xprt(nfsd_serv, transport, &init_net,
+	err = svc_create_xprt(nfsd_serv, transport, net,
 				PF_INET, port, SVC_SOCK_ANONYMOUS);
 	if (err < 0)
 		goto out_err;
 
-	err = svc_create_xprt(nfsd_serv, transport, &init_net,
+	err = svc_create_xprt(nfsd_serv, transport, net,
 				PF_INET6, port, SVC_SOCK_ANONYMOUS);
 	if (err < 0 && err != -EAFNOSUPPORT)
 		goto out_close;
@@ -724,12 +728,14 @@
 	nfsd_serv->sv_nrthreads--;
 	return 0;
 out_close:
-	xprt = svc_find_xprt(nfsd_serv, transport, &init_net, PF_INET, port);
+	xprt = svc_find_xprt(nfsd_serv, transport, net, PF_INET, port);
 	if (xprt != NULL) {
 		svc_close_xprt(xprt);
 		svc_xprt_put(xprt);
 	}
 out_err:
+	if (nfsd_serv->sv_nrthreads == 1)
+		svc_shutdown_net(nfsd_serv, net);
 	svc_destroy(nfsd_serv);
 	return err;
 }
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 28dfad3..bcda12a 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/fs_struct.h>
 #include <linux/swap.h>
+#include <linux/nsproxy.h>
 
 #include <linux/sunrpc/stats.h>
 #include <linux/sunrpc/svcsock.h>
@@ -220,7 +221,7 @@
 	ret = nfsd_init_socks(port);
 	if (ret)
 		goto out_racache;
-	ret = lockd_up();
+	ret = lockd_up(&init_net);
 	if (ret)
 		goto out_racache;
 	ret = nfs4_state_start();
@@ -229,7 +230,7 @@
 	nfsd_up = true;
 	return 0;
 out_lockd:
-	lockd_down();
+	lockd_down(&init_net);
 out_racache:
 	nfsd_racache_shutdown();
 	return ret;
@@ -246,7 +247,7 @@
 	if (!nfsd_up)
 		return;
 	nfs4_state_shutdown();
-	lockd_down();
+	lockd_down(&init_net);
 	nfsd_racache_shutdown();
 	nfsd_up = false;
 }
@@ -330,6 +331,8 @@
 
 int nfsd_create_serv(void)
 {
+	int error;
+
 	WARN_ON(!mutex_is_locked(&nfsd_mutex));
 	if (nfsd_serv) {
 		svc_get(nfsd_serv);
@@ -343,6 +346,12 @@
 	if (nfsd_serv == NULL)
 		return -ENOMEM;
 
+	error = svc_bind(nfsd_serv, current->nsproxy->net_ns);
+	if (error < 0) {
+		svc_destroy(nfsd_serv);
+		return error;
+	}
+
 	set_max_drc();
 	do_gettimeofday(&nfssvc_boot);		/* record boot time */
 	return 0;
@@ -373,6 +382,7 @@
 	int i = 0;
 	int tot = 0;
 	int err = 0;
+	struct net *net = &init_net;
 
 	WARN_ON(!mutex_is_locked(&nfsd_mutex));
 
@@ -417,6 +427,9 @@
 		if (err)
 			break;
 	}
+
+	if (nfsd_serv->sv_nrthreads == 1)
+		svc_shutdown_net(nfsd_serv, net);
 	svc_destroy(nfsd_serv);
 
 	return err;
@@ -432,6 +445,7 @@
 {
 	int	error;
 	bool	nfsd_up_before;
+	struct net *net = &init_net;
 
 	mutex_lock(&nfsd_mutex);
 	dprintk("nfsd: creating service\n");
@@ -464,6 +478,8 @@
 	if (error < 0 && !nfsd_up_before)
 		nfsd_shutdown();
 out_destroy:
+	if (nfsd_serv->sv_nrthreads == 1)
+		svc_shutdown_net(nfsd_serv, net);
 	svc_destroy(nfsd_serv);		/* Release server */
 out:
 	mutex_unlock(&nfsd_mutex);
@@ -547,6 +563,9 @@
 	nfsdstats.th_cnt --;
 
 out:
+	if (rqstp->rq_server->sv_nrthreads == 1)
+		svc_shutdown_net(rqstp->rq_server, &init_net);
+
 	/* Release the thread */
 	svc_exit_thread(rqstp);
 
@@ -659,8 +678,12 @@
 int nfsd_pool_stats_release(struct inode *inode, struct file *file)
 {
 	int ret = seq_release(inode, file);
+	struct net *net = &init_net;
+
 	mutex_lock(&nfsd_mutex);
 	/* this function really, really should have been called svc_put() */
+	if (nfsd_serv->sv_nrthreads == 1)
+		svc_shutdown_net(nfsd_serv, net);
 	svc_destroy(nfsd_serv);
 	mutex_unlock(&nfsd_mutex);
 	return ret;
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
index 08a07a2..57ceaf3 100644
--- a/fs/nilfs2/gcinode.c
+++ b/fs/nilfs2/gcinode.c
@@ -191,6 +191,8 @@
 	while (!list_empty(head)) {
 		ii = list_first_entry(head, struct nilfs_inode_info, i_dirty);
 		list_del_init(&ii->i_dirty);
+		truncate_inode_pages(&ii->vfs_inode.i_data, 0);
+		nilfs_btnode_cache_clear(&ii->i_btnode_cache);
 		iput(&ii->vfs_inode);
 	}
 }
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 2a70fce..6fe98ed 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -182,7 +182,7 @@
 	if (copy_from_user(&cpmode, argp, sizeof(cpmode)))
 		goto out;
 
-	down_read(&inode->i_sb->s_umount);
+	mutex_lock(&nilfs->ns_snapshot_mount_mutex);
 
 	nilfs_transaction_begin(inode->i_sb, &ti, 0);
 	ret = nilfs_cpfile_change_cpmode(
@@ -192,7 +192,7 @@
 	else
 		nilfs_transaction_commit(inode->i_sb); /* never fails */
 
-	up_read(&inode->i_sb->s_umount);
+	mutex_unlock(&nilfs->ns_snapshot_mount_mutex);
 out:
 	mnt_drop_write_file(filp);
 	return ret;
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 0e72ad6..88e11fb 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2309,6 +2309,8 @@
 		if (!test_bit(NILFS_I_UPDATED, &ii->i_state))
 			continue;
 		list_del_init(&ii->i_dirty);
+		truncate_inode_pages(&ii->vfs_inode.i_data, 0);
+		nilfs_btnode_cache_clear(&ii->i_btnode_cache);
 		iput(&ii->vfs_inode);
 	}
 }
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 1099a76..496904b 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -948,6 +948,8 @@
 	struct nilfs_root *root;
 	int ret;
 
+	mutex_lock(&nilfs->ns_snapshot_mount_mutex);
+
 	down_read(&nilfs->ns_segctor_sem);
 	ret = nilfs_cpfile_is_snapshot(nilfs->ns_cpfile, cno);
 	up_read(&nilfs->ns_segctor_sem);
@@ -972,6 +974,7 @@
 	ret = nilfs_get_root_dentry(s, root, root_dentry);
 	nilfs_put_root(root);
  out:
+	mutex_unlock(&nilfs->ns_snapshot_mount_mutex);
 	return ret;
 }
 
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index 501b7f8..41e6a04 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -76,6 +76,7 @@
 	nilfs->ns_bdev = bdev;
 	atomic_set(&nilfs->ns_ndirtyblks, 0);
 	init_rwsem(&nilfs->ns_sem);
+	mutex_init(&nilfs->ns_snapshot_mount_mutex);
 	INIT_LIST_HEAD(&nilfs->ns_dirty_files);
 	INIT_LIST_HEAD(&nilfs->ns_gc_inodes);
 	spin_lock_init(&nilfs->ns_inode_lock);
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
index 9992b11..de7435f 100644
--- a/fs/nilfs2/the_nilfs.h
+++ b/fs/nilfs2/the_nilfs.h
@@ -47,6 +47,7 @@
  * @ns_flags: flags
  * @ns_bdev: block device
  * @ns_sem: semaphore for shared states
+ * @ns_snapshot_mount_mutex: mutex to protect snapshot mounts
  * @ns_sbh: buffer heads of on-disk super blocks
  * @ns_sbp: pointers to super block data
  * @ns_sbwtime: previous write time of super block
@@ -99,6 +100,7 @@
 
 	struct block_device    *ns_bdev;
 	struct rw_semaphore	ns_sem;
+	struct mutex		ns_snapshot_mount_mutex;
 
 	/*
 	 * used for
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 061591a..7602783 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1950,7 +1950,7 @@
 	if (ret < 0)
 		mlog_errno(ret);
 
-	if (file->f_flags & O_SYNC)
+	if (file && (file->f_flags & O_SYNC))
 		handle->h_sync = 1;
 
 	ocfs2_commit_trans(osb, handle);
@@ -2422,8 +2422,10 @@
 		unaligned_dio = 0;
 	}
 
-	if (unaligned_dio)
+	if (unaligned_dio) {
+		ocfs2_iocb_clear_unaligned_aio(iocb);
 		atomic_dec(&OCFS2_I(inode)->ip_unaligned_aio);
+	}
 
 out:
 	if (rw_level != -1)
diff --git a/fs/open.c b/fs/open.c
index 5720854..3f1108b 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -396,10 +396,10 @@
 {
 	struct file *file;
 	struct inode *inode;
-	int error;
+	int error, fput_needed;
 
 	error = -EBADF;
-	file = fget(fd);
+	file = fget_raw_light(fd, &fput_needed);
 	if (!file)
 		goto out;
 
@@ -413,7 +413,7 @@
 	if (!error)
 		set_fs_pwd(current->fs, &file->f_path);
 out_putf:
-	fput(file);
+	fput_light(file, fput_needed);
 out:
 	return error;
 }
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 2f198da..c8cb15d 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1838,7 +1838,7 @@
 			rcu_read_lock();
 			file = fcheck_files(files, fd);
 			if (file) {
-				unsigned i_mode, f_mode = file->f_mode;
+				unsigned f_mode = file->f_mode;
 
 				rcu_read_unlock();
 				put_files_struct(files);
@@ -1854,12 +1854,14 @@
 					inode->i_gid = 0;
 				}
 
-				i_mode = S_IFLNK;
-				if (f_mode & FMODE_READ)
-					i_mode |= S_IRUSR | S_IXUSR;
-				if (f_mode & FMODE_WRITE)
-					i_mode |= S_IWUSR | S_IXUSR;
-				inode->i_mode = i_mode;
+				if (S_ISLNK(inode->i_mode)) {
+					unsigned i_mode = S_IFLNK;
+					if (f_mode & FMODE_READ)
+						i_mode |= S_IRUSR | S_IXUSR;
+					if (f_mode & FMODE_WRITE)
+						i_mode |= S_IWUSR | S_IXUSR;
+					inode->i_mode = i_mode;
+				}
 
 				security_task_to_inode(task, inode);
 				put_task_struct(task);
@@ -1894,6 +1896,7 @@
 	ei = PROC_I(inode);
 	ei->fd = fd;
 
+	inode->i_mode = S_IFLNK;
 	inode->i_op = &proc_pid_link_inode_operations;
 	inode->i_size = 64;
 	ei->op.proc_get_link = proc_fd_link;
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 1030a71..7faaf2a 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -784,7 +784,7 @@
 
 	/* find the first VMA at or above 'addr' */
 	vma = find_vma(walk->mm, addr);
-	if (pmd_trans_huge_lock(pmd, vma) == 1) {
+	if (vma && pmd_trans_huge_lock(pmd, vma) == 1) {
 		for (; addr != end; addr += PAGE_SIZE) {
 			unsigned long offset;
 
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index fbb0b47..d5378d0 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -110,6 +110,7 @@
 
 		/* prevent the page from being discarded on memory pressure */
 		SetPageDirty(page);
+		SetPageUptodate(page);
 
 		unlock_page(page);
 		put_page(page);
diff --git a/fs/select.c b/fs/select.c
index 17d33d0..3954a66 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -26,6 +26,7 @@
 #include <linux/fs.h>
 #include <linux/rcupdate.h>
 #include <linux/hrtimer.h>
+#include <linux/freezer.h>
 
 #include <asm/uaccess.h>
 
@@ -236,7 +237,8 @@
 
 	set_current_state(state);
 	if (!pwq->triggered)
-		rc = schedule_hrtimeout_range(expires, slack, HRTIMER_MODE_ABS);
+		rc = freezable_schedule_hrtimeout_range(expires, slack,
+							HRTIMER_MODE_ABS);
 	__set_current_state(TASK_RUNNING);
 
 	/*
@@ -345,8 +347,8 @@
 	struct fdtable *fdt;
 
 	/* handle last in-complete long-word first */
-	set = ~(~0UL << (n & (__NFDBITS-1)));
-	n /= __NFDBITS;
+	set = ~(~0UL << (n & (BITS_PER_LONG-1)));
+	n /= BITS_PER_LONG;
 	fdt = files_fdtable(current->files);
 	open_fds = fdt->open_fds + n;
 	max = 0;
@@ -373,7 +375,7 @@
 			max++;
 			set >>= 1;
 		} while (set);
-		max += n * __NFDBITS;
+		max += n * BITS_PER_LONG;
 	}
 
 	return max;
@@ -435,11 +437,11 @@
 			in = *inp++; out = *outp++; ex = *exp++;
 			all_bits = in | out | ex;
 			if (all_bits == 0) {
-				i += __NFDBITS;
+				i += BITS_PER_LONG;
 				continue;
 			}
 
-			for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) {
+			for (j = 0; j < BITS_PER_LONG; ++j, ++i, bit <<= 1) {
 				int fput_needed;
 				if (i >= n)
 					break;
diff --git a/fs/splice.c b/fs/splice.c
index f847684..5cac690 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -273,13 +273,16 @@
  * Check if we need to grow the arrays holding pages and partial page
  * descriptions.
  */
-int splice_grow_spd(struct pipe_inode_info *pipe, struct splice_pipe_desc *spd)
+int splice_grow_spd(const struct pipe_inode_info *pipe, struct splice_pipe_desc *spd)
 {
-	if (pipe->buffers <= PIPE_DEF_BUFFERS)
+	unsigned int buffers = ACCESS_ONCE(pipe->buffers);
+
+	spd->nr_pages_max = buffers;
+	if (buffers <= PIPE_DEF_BUFFERS)
 		return 0;
 
-	spd->pages = kmalloc(pipe->buffers * sizeof(struct page *), GFP_KERNEL);
-	spd->partial = kmalloc(pipe->buffers * sizeof(struct partial_page), GFP_KERNEL);
+	spd->pages = kmalloc(buffers * sizeof(struct page *), GFP_KERNEL);
+	spd->partial = kmalloc(buffers * sizeof(struct partial_page), GFP_KERNEL);
 
 	if (spd->pages && spd->partial)
 		return 0;
@@ -289,10 +292,9 @@
 	return -ENOMEM;
 }
 
-void splice_shrink_spd(struct pipe_inode_info *pipe,
-		       struct splice_pipe_desc *spd)
+void splice_shrink_spd(struct splice_pipe_desc *spd)
 {
-	if (pipe->buffers <= PIPE_DEF_BUFFERS)
+	if (spd->nr_pages_max <= PIPE_DEF_BUFFERS)
 		return;
 
 	kfree(spd->pages);
@@ -315,6 +317,7 @@
 	struct splice_pipe_desc spd = {
 		.pages = pages,
 		.partial = partial,
+		.nr_pages_max = PIPE_DEF_BUFFERS,
 		.flags = flags,
 		.ops = &page_cache_pipe_buf_ops,
 		.spd_release = spd_release_page,
@@ -326,7 +329,7 @@
 	index = *ppos >> PAGE_CACHE_SHIFT;
 	loff = *ppos & ~PAGE_CACHE_MASK;
 	req_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
-	nr_pages = min(req_pages, pipe->buffers);
+	nr_pages = min(req_pages, spd.nr_pages_max);
 
 	/*
 	 * Lookup the (hopefully) full range of pages we need.
@@ -497,7 +500,7 @@
 	if (spd.nr_pages)
 		error = splice_to_pipe(pipe, &spd);
 
-	splice_shrink_spd(pipe, &spd);
+	splice_shrink_spd(&spd);
 	return error;
 }
 
@@ -598,6 +601,7 @@
 	struct splice_pipe_desc spd = {
 		.pages = pages,
 		.partial = partial,
+		.nr_pages_max = PIPE_DEF_BUFFERS,
 		.flags = flags,
 		.ops = &default_pipe_buf_ops,
 		.spd_release = spd_release_page,
@@ -608,8 +612,8 @@
 
 	res = -ENOMEM;
 	vec = __vec;
-	if (pipe->buffers > PIPE_DEF_BUFFERS) {
-		vec = kmalloc(pipe->buffers * sizeof(struct iovec), GFP_KERNEL);
+	if (spd.nr_pages_max > PIPE_DEF_BUFFERS) {
+		vec = kmalloc(spd.nr_pages_max * sizeof(struct iovec), GFP_KERNEL);
 		if (!vec)
 			goto shrink_ret;
 	}
@@ -617,7 +621,7 @@
 	offset = *ppos & ~PAGE_CACHE_MASK;
 	nr_pages = (len + offset + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 
-	for (i = 0; i < nr_pages && i < pipe->buffers && len; i++) {
+	for (i = 0; i < nr_pages && i < spd.nr_pages_max && len; i++) {
 		struct page *page;
 
 		page = alloc_page(GFP_USER);
@@ -665,7 +669,7 @@
 shrink_ret:
 	if (vec != __vec)
 		kfree(vec);
-	splice_shrink_spd(pipe, &spd);
+	splice_shrink_spd(&spd);
 	return res;
 
 err:
@@ -1612,6 +1616,7 @@
 	struct splice_pipe_desc spd = {
 		.pages = pages,
 		.partial = partial,
+		.nr_pages_max = PIPE_DEF_BUFFERS,
 		.flags = flags,
 		.ops = &user_page_pipe_buf_ops,
 		.spd_release = spd_release_page,
@@ -1627,13 +1632,13 @@
 
 	spd.nr_pages = get_iovec_page_array(iov, nr_segs, spd.pages,
 					    spd.partial, flags & SPLICE_F_GIFT,
-					    pipe->buffers);
+					    spd.nr_pages_max);
 	if (spd.nr_pages <= 0)
 		ret = spd.nr_pages;
 	else
 		ret = splice_to_pipe(pipe, &spd);
 
-	splice_shrink_spd(pipe, &spd);
+	splice_shrink_spd(&spd);
 	return ret;
 }
 
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 771f7fb..a7be8e2 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -724,8 +724,12 @@
 		lnum = ubifs_next_log_lnum(c, lnum);
 	}
 
-	/* Fixup the current log head */
-	err = fixup_leb(c, c->lhead_lnum, c->lhead_offs);
+	/*
+	 * Fixup the log head which contains the only a CS node at the
+	 * beginning.
+	 */
+	err = fixup_leb(c, c->lhead_lnum,
+			ALIGN(UBIFS_CS_NODE_SZ, c->min_io_size));
 	if (err)
 		goto out;
 
diff --git a/fs/udf/super.c b/fs/udf/super.c
index ac8a348..e660ffd 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -56,6 +56,7 @@
 #include <linux/seq_file.h>
 #include <linux/bitmap.h>
 #include <linux/crc-itu-t.h>
+#include <linux/log2.h>
 #include <asm/byteorder.h>
 
 #include "udf_sb.h"
@@ -1215,16 +1216,65 @@
 	return ret;
 }
 
+static int udf_load_sparable_map(struct super_block *sb,
+				 struct udf_part_map *map,
+				 struct sparablePartitionMap *spm)
+{
+	uint32_t loc;
+	uint16_t ident;
+	struct sparingTable *st;
+	struct udf_sparing_data *sdata = &map->s_type_specific.s_sparing;
+	int i;
+	struct buffer_head *bh;
+
+	map->s_partition_type = UDF_SPARABLE_MAP15;
+	sdata->s_packet_len = le16_to_cpu(spm->packetLength);
+	if (!is_power_of_2(sdata->s_packet_len)) {
+		udf_err(sb, "error loading logical volume descriptor: "
+			"Invalid packet length %u\n",
+			(unsigned)sdata->s_packet_len);
+		return -EIO;
+	}
+	if (spm->numSparingTables > 4) {
+		udf_err(sb, "error loading logical volume descriptor: "
+			"Too many sparing tables (%d)\n",
+			(int)spm->numSparingTables);
+		return -EIO;
+	}
+
+	for (i = 0; i < spm->numSparingTables; i++) {
+		loc = le32_to_cpu(spm->locSparingTable[i]);
+		bh = udf_read_tagged(sb, loc, loc, &ident);
+		if (!bh)
+			continue;
+
+		st = (struct sparingTable *)bh->b_data;
+		if (ident != 0 ||
+		    strncmp(st->sparingIdent.ident, UDF_ID_SPARING,
+			    strlen(UDF_ID_SPARING)) ||
+		    sizeof(*st) + le16_to_cpu(st->reallocationTableLen) >
+							sb->s_blocksize) {
+			brelse(bh);
+			continue;
+		}
+
+		sdata->s_spar_map[i] = bh;
+	}
+	map->s_partition_func = udf_get_pblock_spar15;
+	return 0;
+}
+
 static int udf_load_logicalvol(struct super_block *sb, sector_t block,
 			       struct kernel_lb_addr *fileset)
 {
 	struct logicalVolDesc *lvd;
-	int i, j, offset;
+	int i, offset;
 	uint8_t type;
 	struct udf_sb_info *sbi = UDF_SB(sb);
 	struct genericPartitionMap *gpm;
 	uint16_t ident;
 	struct buffer_head *bh;
+	unsigned int table_len;
 	int ret = 0;
 
 	bh = udf_read_tagged(sb, block, block, &ident);
@@ -1232,15 +1282,20 @@
 		return 1;
 	BUG_ON(ident != TAG_IDENT_LVD);
 	lvd = (struct logicalVolDesc *)bh->b_data;
-
-	i = udf_sb_alloc_partition_maps(sb, le32_to_cpu(lvd->numPartitionMaps));
-	if (i != 0) {
-		ret = i;
+	table_len = le32_to_cpu(lvd->mapTableLength);
+	if (table_len > sb->s_blocksize - sizeof(*lvd)) {
+		udf_err(sb, "error loading logical volume descriptor: "
+			"Partition table too long (%u > %lu)\n", table_len,
+			sb->s_blocksize - sizeof(*lvd));
 		goto out_bh;
 	}
 
+	ret = udf_sb_alloc_partition_maps(sb, le32_to_cpu(lvd->numPartitionMaps));
+	if (ret)
+		goto out_bh;
+
 	for (i = 0, offset = 0;
-	     i < sbi->s_partitions && offset < le32_to_cpu(lvd->mapTableLength);
+	     i < sbi->s_partitions && offset < table_len;
 	     i++, offset += gpm->partitionMapLength) {
 		struct udf_part_map *map = &sbi->s_partmaps[i];
 		gpm = (struct genericPartitionMap *)
@@ -1275,38 +1330,9 @@
 			} else if (!strncmp(upm2->partIdent.ident,
 						UDF_ID_SPARABLE,
 						strlen(UDF_ID_SPARABLE))) {
-				uint32_t loc;
-				struct sparingTable *st;
-				struct sparablePartitionMap *spm =
-					(struct sparablePartitionMap *)gpm;
-
-				map->s_partition_type = UDF_SPARABLE_MAP15;
-				map->s_type_specific.s_sparing.s_packet_len =
-						le16_to_cpu(spm->packetLength);
-				for (j = 0; j < spm->numSparingTables; j++) {
-					struct buffer_head *bh2;
-
-					loc = le32_to_cpu(
-						spm->locSparingTable[j]);
-					bh2 = udf_read_tagged(sb, loc, loc,
-							     &ident);
-					map->s_type_specific.s_sparing.
-							s_spar_map[j] = bh2;
-
-					if (bh2 == NULL)
-						continue;
-
-					st = (struct sparingTable *)bh2->b_data;
-					if (ident != 0 || strncmp(
-						st->sparingIdent.ident,
-						UDF_ID_SPARING,
-						strlen(UDF_ID_SPARING))) {
-						brelse(bh2);
-						map->s_type_specific.s_sparing.
-							s_spar_map[j] = NULL;
-					}
-				}
-				map->s_partition_func = udf_get_pblock_spar15;
+				if (udf_load_sparable_map(sb, map,
+				    (struct sparablePartitionMap *)gpm) < 0)
+					goto out_bh;
 			} else if (!strncmp(upm2->partIdent.ident,
 						UDF_ID_METADATA,
 						strlen(UDF_ID_METADATA))) {
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 125c54e..c7ec2cd 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -446,6 +446,18 @@
 #endif /* __HAVE_ARCH_PMD_WRITE */
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 
+#ifndef pmd_read_atomic
+static inline pmd_t pmd_read_atomic(pmd_t *pmdp)
+{
+	/*
+	 * Depend on compiler for an atomic pmd read. NOTE: this is
+	 * only going to work, if the pmdval_t isn't larger than
+	 * an unsigned long.
+	 */
+	return *pmdp;
+}
+#endif
+
 /*
  * This function is meant to be used by sites walking pagetables with
  * the mmap_sem hold in read mode to protect against MADV_DONTNEED and
@@ -459,14 +471,30 @@
  * undefined so behaving like if the pmd was none is safe (because it
  * can return none anyway). The compiler level barrier() is critically
  * important to compute the two checks atomically on the same pmdval.
+ *
+ * For 32bit kernels with a 64bit large pmd_t this automatically takes
+ * care of reading the pmd atomically to avoid SMP race conditions
+ * against pmd_populate() when the mmap_sem is hold for reading by the
+ * caller (a special atomic read not done by "gcc" as in the generic
+ * version above, is also needed when THP is disabled because the page
+ * fault can populate the pmd from under us).
  */
 static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd)
 {
-	/* depend on compiler for an atomic pmd read */
-	pmd_t pmdval = *pmd;
+	pmd_t pmdval = pmd_read_atomic(pmd);
 	/*
 	 * The barrier will stabilize the pmdval in a register or on
 	 * the stack so that it will stop changing under the code.
+	 *
+	 * When CONFIG_TRANSPARENT_HUGEPAGE=y on x86 32bit PAE,
+	 * pmd_read_atomic is allowed to return a not atomic pmdval
+	 * (for example pointing to an hugepage that has never been
+	 * mapped in the pmd). The below checks will only care about
+	 * the low part of the pmd with 32bit PAE x86 anyway, with the
+	 * exception of pmd_none(). So the important thing is that if
+	 * the low part of the pmd is found null, the high part will
+	 * be also null or the pmd_none() check below would be
+	 * confused.
 	 */
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 	barrier();
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 58d0bda..53392e8 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -181,6 +181,7 @@
 	{0x1002, 0x6747, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6748, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x674A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6751, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
@@ -198,6 +199,7 @@
 	{0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x6771, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
@@ -215,9 +217,12 @@
 	{0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6801, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6802, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x6806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x6816, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x6817, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6819, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -229,10 +234,11 @@
 	{0x1002, 0x6827, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
-	{0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
-	{0x1002, 0x6831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
+	{0x1002, 0x6831, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6838, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
 	{0x1002, 0x6839, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \
@@ -531,6 +537,7 @@
 	{0x1002, 0x9645, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO2|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x9647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
 	{0x1002, 0x9648, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
+	{0x1002, 0x9649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
 	{0x1002, 0x964a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x964b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x964c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
@@ -550,6 +557,7 @@
 	{0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x9808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x9809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
+	{0x1002, 0x980A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x9900, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x9901, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x9903, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
@@ -561,11 +569,19 @@
 	{0x1002, 0x9909, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x990A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x990F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
+	{0x1002, 0x9910, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
+	{0x1002, 0x9913, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
+	{0x1002, 0x9917, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
+	{0x1002, 0x9918, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
+	{0x1002, 0x9919, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x9990, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x9991, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x9992, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x9993, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0x1002, 0x9994, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
+	{0x1002, 0x99A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
+	{0x1002, 0x99A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
+	{0x1002, 0x99A4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_ARUBA|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
 	{0, 0, 0}
 
 #define r128_PCI_IDS \
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 3e681aa..fefa919 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -233,6 +233,7 @@
 header-y += kdev_t.h
 header-y += kernel.h
 header-y += kernelcapi.h
+header-y += kernel-page-flags.h
 header-y += keyboard.h
 header-y += keyctl.h
 header-y += l2tp.h
@@ -281,6 +282,7 @@
 header-y += netfilter_ipv6.h
 header-y += netlink.h
 header-y += netrom.h
+header-y += nfc.h
 header-y += nfs.h
 header-y += nfs2.h
 header-y += nfs3.h
diff --git a/include/linux/a1028.h b/include/linux/a1028.h
new file mode 100644
index 0000000..7c6e295
--- /dev/null
+++ b/include/linux/a1028.h
@@ -0,0 +1,218 @@
+/* include/linux/a1028.h - a1028 voice processor driver
+ *
+ * Copyright (C) 2009 HTC Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LINUX_A1028_H
+#define __LINUX_A1028_H
+
+#include <linux/ioctl.h>
+
+#define A1028_I2C_NAME "audience_a1028"
+#define A1028_MAX_FW_SIZE	(32*1024)
+struct a1028img {
+	unsigned char *buf;
+	unsigned img_size;
+};
+
+enum A1028_PathID {
+	A1028_PATH_SUSPEND,
+	A1028_PATH_INCALL_RECEIVER,
+	A1028_PATH_INCALL_HEADSET,
+	A1028_PATH_INCALL_SPEAKER,
+	A1028_PATH_INCALL_BT,
+	A1028_PATH_VR_NO_NS_RECEIVER,
+	A1028_PATH_VR_NO_NS_HEADSET,
+	A1028_PATH_VR_NO_NS_SPEAKER,
+	A1028_PATH_VR_NO_NS_BT,
+	A1028_PATH_VR_NS_RECEIVER,
+	A1028_PATH_VR_NS_HEADSET,
+	A1028_PATH_VR_NS_SPEAKER,
+	A1028_PATH_VR_NS_BT,
+	A1028_PATH_RECORD_RECEIVER,
+	A1028_PATH_RECORD_HEADSET,
+	A1028_PATH_RECORD_SPEAKER,
+	A1028_PATH_RECORD_BT,
+	A1028_PATH_CAMCORDER,
+	A1028_PATH_INCALL_TTY,
+	A1028_PATH_MFG_LOOPBACK,
+	A1028_PATH_MAX
+};
+
+struct A1028_config_data {
+	unsigned int data_len;
+	unsigned int mode_num;
+	unsigned char *cmd_data;  
+};
+
+enum A1028_NS_states {
+	A1028_NS_STATE_AUTO,	
+	A1028_NS_STATE_OFF,	
+	A1028_NS_STATE_CT,	
+	A1028_NS_STATE_FT,	
+	A1028_NS_NUM_STATES
+};
+
+#define A1028_IOCTL_MAGIC 'u'
+
+#define A1028_BOOTUP_INIT  _IOW(A1028_IOCTL_MAGIC, 0x01, struct a1028img *)
+#define A1028_SET_CONFIG   _IOW(A1028_IOCTL_MAGIC, 0x02, enum A1028_PathID)
+#define A1028_SET_NS_STATE _IOW(A1028_IOCTL_MAGIC, 0x03, enum A1028_NS_states)
+#define A1028_SET_PARAM	   _IOW(A1028_IOCTL_MAGIC, 0x04,  unsigned)
+#define A1028_SET_MIC_ONOFF	_IOW(A1028_IOCTL_MAGIC, 0x50, unsigned)
+#define A1028_SET_MICSEL_ONOFF	_IOW(A1028_IOCTL_MAGIC, 0x51, unsigned)
+#define A1028_READ_DATA		_IOR(A1028_IOCTL_MAGIC, 0x52, unsigned)
+#define A1028_WRITE_MSG		_IOW(A1028_IOCTL_MAGIC, 0x53, unsigned)
+#define A1028_SYNC_CMD		_IO(A1028_IOCTL_MAGIC, 0x54)
+#define A1028_SET_CMD_FILE	_IOW(A1028_IOCTL_MAGIC, 0x55, unsigned)
+
+#ifdef __KERNEL__
+
+#define CtrlMode_LAL		0x0001 
+#define CtrlMode_LAH		0x0002 
+#define CtrlMode_FE		0x0003 
+#define CtrlMode_RE		0x0004 
+#define A100_msg_Sync		0x80000000
+#define A100_msg_Sync_Ack	0x80000000
+
+#define A100_msg_Reset		0x8002
+#define RESET_IMMEDIATE		0x0000
+#define RESET_DELAYED		0x0001
+
+#define A100_msg_BootloadInitiate	0x8003
+#define A100_msg_GetDeviceParm		0x800B
+#define A100_msg_SetDeviceParmID	0x800C
+#define A100_msg_SetDeviceParm		0x800D
+
+#define PCM0WordLength		0x0100
+#define PCM0DelFromFsTx		0x0101
+#define PCM0DelFromFsRx		0x0102
+#define PCM0LatchEdge		0x0103
+#define PCM0Endianness		0x0105
+#define PCM0TristateEnable	0x0107
+
+#define PCM1WordLength		0x0200
+#define PCM1DelFromFsTx		0x0201
+#define PCM1DelFromFsRx		0x0202
+#define PCM1LatchEdge		0x0203
+#define PCM1Endianness		0x0205
+#define PCM1TristateEnable	0x0207
+
+#define PCMWordLength_16bit	0x10 
+#define PCMWordLength_24bit	0x18
+#define PCMWordLength_32bit	0x20
+#define PCMLatchEdge_Tx_F_Rx_R	0x00 
+#define PCMLatchEdge_Tx_R_Rx_F	0x03 
+#define PCMEndianness_Little	0x00
+#define PCMEndianness_Big	0x01 
+#define PCMTristate_Disable	0x00 
+#define PCMTristate_Enable	0x01
+
+#define ADC0Gain	0x0300
+#define ADC0Rate	0x0301
+#define ADC0CutoffFreq	0x0302
+
+#define ADC1Gain	0x0400
+#define ADC1Rate	0x0401
+#define ADC1CutoffFreq	0x0402
+
+#define ADC_Gain_0db			0x00
+#define ADC_Gain_6db			0x01
+#define ADC_Gain_12db			0x02
+#define ADC_Gain_18db			0x03
+#define ADC_Gain_24db			0x04 
+#define ADC_Gain_30db			0x05
+#define ADC_Rate_8kHz			0x00 
+#define ADC_Rate_16kHz			0x01
+#define ADC_CutoffFreq_NO_DC_Filter	0x00
+#define ADC_CutoffFreq_59p68Hz		0x01 
+#define ADC_CutoffFreq_7p46Hz		0x02
+#define ADC_CutoffFreq_3p73Hz		0x03
+
+#define A100_msg_Sleep		0x80100001
+
+#define A100_msg_GetAlgorithmParm	0x8016
+#define A100_msg_SetAlgorithmParmID	0x8017
+#define A100_msg_SetAlgorithmParm	0x8018
+
+#define AIS_Global_Supression_Level	0x0000
+#define Mic_Config			0x0002
+#define AEC_Mode			0x0003
+#define AEC_CNG				0x0023
+#define Output_AGC			0x0004
+#define Output_AGC_Target_Level		0x0005
+#define Output_AGC_Noise_Floor		0x0006
+#define Output_AGC_SNR_Improvement	0x0007
+#define Comfort_Noise			0x001A
+#define Comfort_Noise_Level		0x001B
+
+#define Speaker_Volume			0x0012
+#define VEQ_Mode			0x0009
+#define VEQ_Max_FarEnd_Limiter_Level	0x000D
+#define VEQ_Noise_Estimation_Adj	0x0025
+#define Receive_NS			0x000E
+#define Receive_NS_Level		0x000F
+#define SideTone			0x0015
+#define SideTone_Gain			0x0016
+
+#define A100_msg_GetTxDigitalInputGain  0x801A
+#define A100_msg_SetTxDigitalInputGain  0x801B
+
+#define A100_msg_GetRcvDigitalInputGain 0x8022
+#define A100_msg_SetRcvDigitalInputGain 0x8023
+
+#define A100_msg_GetTxDigitalOutputGain 0x801D
+#define A100_msg_SetTxDigitalOutputGain 0x8015
+
+#define A100_msg_Bypass		0x801C 
+#define A1028_msg_VP_ON		0x801C0001
+#define A1028_msg_VP_OFF	0x801C0000
+
+#define A100_msg_GetMicRMS	0x8013
+#define A100_msg_GetMicPeak	0x8014
+#define DiagPath_Pri_Input_Mic	0x0000
+#define DiagPath_Sec_Input_Mic	0x0001
+#define DiagPath_Output_Mic	0x0002
+#define DiagPath_Far_End_Input	0x0003
+#define DiagPath_Far_End_Output	0x0004
+#define A100_msg_SwapInputCh	0x8019
+#define A100_msg_OutputKnownSig	0x801E
+
+#define A1028_msg_BOOT		0x0001
+#define A1028_msg_BOOT_ACK	0x01
+
+#define TIMEOUT			20 
+#define RETRY_CNT		5
+#define POLLING_RETRY_CNT	3
+#define A1028_ERROR_CODE	0xffff
+#define A1028_SLEEP		0
+#define A1028_ACTIVE		1
+#define A1028_CMD_FIFO_DEPTH	64
+
+enum A1028_config_mode {
+	A1028_CONFIG_FULL,
+	A1028_CONFIG_VP
+};
+
+struct a1028_platform_data {
+	uint32_t gpio_a1028_micsel;
+	uint32_t gpio_a1028_wakeup;
+	uint32_t gpio_a1028_reset;
+	uint32_t gpio_a1028_int;
+	uint32_t gpio_a1028_clk;
+	uint32_t gpio_a1028_micswitch;
+};
+
+
+#endif 
+#endif 
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 2314ad8..b1a520e 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -140,6 +140,7 @@
 		(x)->ki_dtor = NULL;			\
 		(x)->ki_obj.tsk = tsk;			\
 		(x)->ki_user_data = 0;                  \
+		(x)->private = NULL;			\
 	} while (0)
 
 #define AIO_RING_MAGIC			0xa10a10a1
diff --git a/include/linux/akm8975.h b/include/linux/akm8975.h
index 6a7c432..ac8d046 100644
--- a/include/linux/akm8975.h
+++ b/include/linux/akm8975.h
@@ -1,27 +1,11 @@
-/*
- * Definitions for akm8975 compass chip.
- */
 #ifndef AKM8975_H
 #define AKM8975_H
 
 #include <linux/ioctl.h>
 
-/*! \name AK8975 operation mode
- \anchor AK8975_Mode
- Defines an operation mode of the AK8975.*/
-/*! @{*/
-#define AK8975_MODE_SNG_MEASURE   0x01
-#define	AK8975_MODE_SELF_TEST     0x08
-#define	AK8975_MODE_FUSE_ACCESS   0x0F
-#define	AK8975_MODE_POWER_DOWN    0x00
-/*! @}*/
+#define AKM8975_I2C_NAME "akm8975"
 
-#define RBUFF_SIZE		8	/* Rx buffer size */
 
-/*! \name AK8975 register address
-\anchor AK8975_REG
-Defines a register address of the AK8975.*/
-/*! @{*/
 #define AK8975_REG_WIA		0x00
 #define AK8975_REG_INFO		0x01
 #define AK8975_REG_ST1		0x02
@@ -38,50 +22,61 @@
 #define AK8975_REG_TS1		0x0D
 #define AK8975_REG_TS2		0x0E
 #define AK8975_REG_I2CDIS	0x0F
-/*! @}*/
 
-/*! \name AK8975 fuse-rom address
-\anchor AK8975_FUSE
-Defines a read-only address of the fuse ROM of the AK8975.*/
-/*! @{*/
+
+
 #define AK8975_FUSE_ASAX	0x10
 #define AK8975_FUSE_ASAY	0x11
 #define AK8975_FUSE_ASAZ	0x12
-/*! @}*/
 
-#define AKMIO                   0xA1
 
-/* IOCTLs for AKM library */
-#define ECS_IOCTL_WRITE                 _IOW(AKMIO, 0x02, char[5])
-#define ECS_IOCTL_READ                  _IOWR(AKMIO, 0x03, char[5])
-#define ECS_IOCTL_GETDATA               _IOR(AKMIO, 0x08, char[RBUFF_SIZE])
-#define ECS_IOCTL_SET_YPR               _IOW(AKMIO, 0x0C, short[12])
-#define ECS_IOCTL_GET_OPEN_STATUS       _IOR(AKMIO, 0x0D, int)
-#define ECS_IOCTL_GET_CLOSE_STATUS      _IOR(AKMIO, 0x0E, int)
-#define ECS_IOCTL_GET_DELAY             _IOR(AKMIO, 0x30, short)
+#define AK8975_CNTL_SNG_MEASURE		0x01
+#define	AK8975_CNTL_CONT_MEASURE	0x02
+#define	AK8975_CNTL_TRIG_MEASURE	0x04
+#define	AK8975_CNTL_SELF_TEST		0x08
+#define	AK8975_CNTL_FUSE_ACCESS		0x0F
+#define	AK8975_CNTL_POWER_DOWN		0x00
 
-/* IOCTLs for APPs */
-#define ECS_IOCTL_APP_SET_MFLAG		_IOW(AKMIO, 0x11, short)
-#define ECS_IOCTL_APP_GET_MFLAG		_IOW(AKMIO, 0x12, short)
-#define ECS_IOCTL_APP_SET_AFLAG		_IOW(AKMIO, 0x13, short)
-#define ECS_IOCTL_APP_GET_AFLAG		_IOR(AKMIO, 0x14, short)
-#define ECS_IOCTL_APP_SET_DELAY		_IOW(AKMIO, 0x18, short)
-#define ECS_IOCTL_APP_GET_DELAY		ECS_IOCTL_GET_DELAY
-/* Set raw magnetic vector flag */
-#define ECS_IOCTL_APP_SET_MVFLAG	_IOW(AKMIO, 0x19, short)
-/* Get raw magnetic vector flag */
-#define ECS_IOCTL_APP_GET_MVFLAG	_IOR(AKMIO, 0x1A, short)
-#define ECS_IOCTL_APP_SET_TFLAG         _IOR(AKMIO, 0x15, short)
+#define RBUFF_SIZE_8975		8	
 
+#define AKMIO				0xA1
+
+#define ECS_IOCTL_WRITE              _IOW(AKMIO, 0x01, char[5])
+#define ECS_IOCTL_READ               _IOWR(AKMIO, 0x02, char[5])
+#define ECS_IOCTL_SET_MODE           _IOW(AKMIO, 0x0F, short)
+#define ECS_IOCTL_GETDATA            _IOR(AKMIO, 0x05, char[RBUFF_SIZE_8975+1])
+#define ECS_IOCTL_SET_YPR            _IOW(AKMIO, 0x06, short[12])
+#define ECS_IOCTL_GET_OPEN_STATUS    _IOR(AKMIO, 0x07, int)
+#define ECS_IOCTL_GET_CLOSE_STATUS   _IOR(AKMIO, 0x08, int)
+#define ECS_IOCTL_GET_DELAY          _IOR(AKMIO, 0x30, short)
+#define ECS_IOCTL_GET_MATRIX         _IOR(AKMIO, 0x0E, short [4][3][3])
+#define ECS_IOCTL_GET_DATA_FOR_GYRO    _IOR(AKMIO, 0x31, short[12])
+#define ECS_IOCTL_GET_COMP_FLAG        _IOR(AKMIO, 0x32, int)
+
+#define ECS_IOCTL_APP_SET_MODE         _IOW(AKMIO, 0x10, short)
+#define ECS_IOCTL_APP_SET_MFLAG        _IOW(AKMIO, 0x11, short)
+#define ECS_IOCTL_APP_GET_MFLAG        _IOW(AKMIO, 0x12, short)
+#define ECS_IOCTL_APP_SET_AFLAG        _IOW(AKMIO, 0x13, short)
+#define ECS_IOCTL_APP_GET_AFLAG        _IOR(AKMIO, 0x14, short)
+#define ECS_IOCTL_APP_SET_TFLAG        _IOR(AKMIO, 0x15, short)
+#define ECS_IOCTL_APP_GET_TFLAG        _IOR(AKMIO, 0x16, short)
+#define ECS_IOCTL_APP_RESET_PEDOMETER  _IO(AKMIO, 0x17)
+#define ECS_IOCTL_APP_SET_DELAY        _IOW(AKMIO, 0x18, short)
+#define ECS_IOCTL_APP_GET_DELAY	       ECS_IOCTL_GET_DELAY
+
+#define ECS_IOCTL_APP_SET_MVFLAG       _IOW(AKMIO, 0x19, short)
+
+#define ECS_IOCTL_APP_GET_MVFLAG       _IOR(AKMIO, 0x1A, short)
 
 struct akm8975_platform_data {
-	int intr;
-
-	int (*init)(void);
-	void (*exit)(void);
-	int (*power_on)(void);
-	int (*power_off)(void);
+	short layouts[4][3][3];
+	short irq_trigger;
+	int use_pana_gyro;
 };
 
+void akm_get_akmd_data(short *getdata);
+int  akm_get_akmd_ready(void);
+extern int EWTZMU2_Report_Value(void);
+extern int EWTZMU2_Report_Value_akm(int ifirst, int x, int y, int z);
 #endif
 
diff --git a/include/linux/atmel_qt602240.h b/include/linux/atmel_qt602240.h
new file mode 100644
index 0000000..8f7abff
--- /dev/null
+++ b/include/linux/atmel_qt602240.h
@@ -0,0 +1,508 @@
+#ifndef _LINUX_ATMEL_H
+#define _LINUX_ATMEL_H
+
+#include <linux/bitops.h>
+
+#define ATMEL_QT602240_NAME "atmel_qt602240"
+#define ATMEL_MXT224E_NAME "atmel_mxt224e"
+
+#define INFO_BLK_FID                            0
+#define INFO_BLK_VID                            1
+#define INFO_BLK_VER                            2
+#define INFO_BLK_BUILD                          3
+#define INFO_BLK_XSIZE                          4
+#define INFO_BLK_YSIZE                          5
+#define INFO_BLK_OBJS                           6
+
+#define OBJ_TABLE_TYPE                          0
+#define OBJ_TABLE_LSB                           1
+#define OBJ_TABLE_MSB                           2
+#define OBJ_TABLE_SIZE                          3
+#define OBJ_TABLE_INSTANCES                     4
+#define OBJ_TABLE_RIDS                          5
+
+#define RESERVED_T0                               0u
+#define RESERVED_T1                               1u
+#define DEBUG_DELTAS_T2                           2u
+#define DEBUG_REFERENCES_T3                       3u
+#define DEBUG_SIGNALS_T4                          4u
+#define GEN_MESSAGEPROCESSOR_T5                   5u
+#define GEN_COMMANDPROCESSOR_T6                   6u
+#define GEN_POWERCONFIG_T7                        7u
+#define GEN_ACQUISITIONCONFIG_T8                  8u
+#define TOUCH_MULTITOUCHSCREEN_T9                 9u
+#define TOUCH_SINGLETOUCHSCREEN_T10               10u
+#define TOUCH_XSLIDER_T11                         11u
+#define TOUCH_YSLIDER_T12                         12u
+#define TOUCH_XWHEEL_T13                          13u
+#define TOUCH_YWHEEL_T14                          14u
+#define TOUCH_KEYARRAY_T15                        15u
+#define PROCG_SIGNALFILTER_T16                    16u
+#define PROCI_LINEARIZATIONTABLE_T17              17u
+#define SPT_COMCONFIG_T18                         18u
+#define SPT_GPIOPWM_T19                           19u
+#define PROCI_GRIPFACESUPPRESSION_T20             20u
+#define RESERVED_T21                              21u
+#define PROCG_NOISESUPPRESSION_T22                22u
+#define TOUCH_PROXIMITY_T23                       23u
+#define PROCI_ONETOUCHGESTUREPROCESSOR_T24        24u
+#define SPT_SELFTEST_T25                          25u
+#define DEBUG_CTERANGE_T26                        26u
+#define PROCI_TWOTOUCHGESTUREPROCESSOR_T27        27u
+#define SPT_CTECONFIG_T28                         28u
+#define SPT_GPI_T29                               29u
+#define SPT_GATE_T30                              30u
+#define TOUCH_KEYSET_T31                          31u
+#define TOUCH_XSLIDERSET_T32                      32u
+#define SPT_PROTOTYPE_T35                         35u 
+#define DIAGNOSTIC_T37                            37u
+#define PROCI_GRIPSUPPRESSION_T40                 40u 
+#define PROCI_TOUCHSUPPRESSION_T42                42u 
+#define SPT_MESSAGECOUNT_T44                      44u 
+#define SPT_CTECONFIG_T46                         46u 
+#define PROCI_STYLUS_T47                          47u 
+#define PROCG_NOISESUPPRESSION_T48                48u 
+#define PROCI_ADAPTIVETHRESHOLD_T55               55u 
+#define EXTRA_NOISE_SUPPRESSION_T58		  58u 
+
+#define T37_PAGE_SIZE                           128
+
+#define T37_TCH_FLAG_SIZE                       80
+#define T37_TCH_FLAG_IDX                        0
+#define T37_ATCH_FLAG_IDX                       40
+
+#define T37_MODE                                0
+#define T37_PAGE                                1
+#define T37_DATA                                2 
+
+#define T37_PAGE_NUM0                           0
+#define T37_PAGE_NUM1                           1
+#define T37_PAGE_NUM2                           2
+#define T37_PAGE_NUM3                           3
+
+#define MSG_RID                                 0
+
+#define T6_CFG_RESET                            0
+#define T6_CFG_BACKUPNV                         1
+#define T6_CFG_CALIBRATE                        2
+#define T6_CFG_REPORTALL                        3
+#define T6_CFG_DIAG                             5
+
+#define T6_CFG_DIAG_CMD_PAGEUP                  0x01
+#define T6_CFG_DIAG_CMD_PAGEDOWN                0x02
+#define T6_CFG_DIAG_CMD_DELTAS                  0x10
+#define T6_CFG_DIAG_CMD_REF                     0x11
+#define T6_CFG_DIAG_CMD_CTE                     0x31
+#define T6_CFG_DIAG_CMD_TCH                     0xF3
+
+#define T6_MSG_STATUS                           1
+#define T6_MSG_CHECKSUM                         2 
+
+#define T6_MSG_STATUS_COMSERR                   BIT(2)
+#define T6_MSG_STATUS_CFGERR                    BIT(3)
+#define T6_MSG_STATUS_CAL                       BIT(4)
+#define T6_MSG_STATUS_SIGERR                    BIT(5)
+#define T6_MSG_STATUS_OFL                       BIT(6)
+#define T6_MSG_STATUS_RESET                     BIT(7)
+
+#define T7_CFG_IDLEACQINT                       0
+#define T7_CFG_ACTVACQINT                       1
+#define T7_CFG_ACTV2IDLETO                      2
+
+#define T8_CFG_CHRGTIME                         0
+#define T8_CFG_TCHDRIFT                         2
+#define T8_CFG_DRIFTST                          3
+#define T8_CFG_TCHAUTOCAL                       4
+#define T8_CFG_SYNC                             5
+#define T8_CFG_ATCHCALST                        6
+#define T8_CFG_ATCHCALSTHR                      7
+#define T8_CFG_ATCHFRCCALTHR                    8 
+#define T8_CFG_ATCHFRCCALRATIO                  9 
+
+#define T9_CFG_CTRL                             0
+#define T9_CFG_XORIGIN                          1
+#define T9_CFG_YORIGIN                          2
+#define T9_CFG_XSIZE                            3
+#define T9_CFG_YSIZE                            4
+#define T9_CFG_AKSCFG                           5
+#define T9_CFG_BLEN                             6
+#define T9_CFG_TCHTHR                           7
+#define T9_CFG_TCHDI                            8
+#define T9_CFG_ORIENT                           9
+#define T9_CFG_MRGTIMEOUT                       10
+#define T9_CFG_MOVHYSTI                         11
+#define T9_CFG_MOVHYSTN                         12
+#define T9_CFG_MOVFILTER                        13
+#define T9_CFG_NUMTOUCH                         14
+#define T9_CFG_MRGHYST                          15
+#define T9_CFG_MRGTHR                           16
+#define T9_CFG_AMPHYST                          17
+#define T9_CFG_XRANGE                           18 
+#define T9_CFG_YRANGE                           20 
+#define T9_CFG_XLOCLIP                          22
+#define T9_CFG_XHICLIP                          23
+#define T9_CFG_YLOCLIP                          24
+#define T9_CFG_YHICLIP                          25
+#define T9_CFG_XEDGECTRL                        26
+#define T9_CFG_XEDGEDIST                        27
+#define T9_CFG_YEDGECTRL                        28
+#define T9_CFG_YEDGEDIST                        29
+#define T9_CFG_JUMPLIMIT                        30
+#define T9_CFG_TCHHYST                          31 
+#define T9_CFG_XPITCH				32 
+#define T9_CFG_YPITCH				33
+#define T9_CFG_NEXTTCHDI			34
+
+#define T9_MSG_STATUS                           1
+#define T9_MSG_XPOSMSB                          2
+#define T9_MSG_YPOSMSB                          3
+#define T9_MSG_XYPOSLSB                         4
+#define T9_MSG_TCHAREA                          5
+#define T9_MSG_TCHAMPLITUDE                     6
+#define T9_MSG_TCHVECTOR                        7
+
+#define T9_MSG_STATUS_UNGRIP                    BIT(0) 
+#define T9_MSG_STATUS_SUPPRESS                  BIT(1)
+#define T9_MSG_STATUS_AMP                       BIT(2)
+#define T9_MSG_STATUS_VECTOR                    BIT(3)
+#define T9_MSG_STATUS_MOVE                      BIT(4)
+#define T9_MSG_STATUS_RELEASE                   BIT(5)
+#define T9_MSG_STATUS_PRESS                     BIT(6)
+#define T9_MSG_STATUS_DETECT                    BIT(7)
+
+#define T20_CFG_CTRL                            0
+#define T20_CFG_XLOGRIP                         1
+#define T20_CFG_XHIGRIP                         2
+#define T20_CFG_YLOGRIP                         3
+#define T20_CFG_YHIGRIP                         4
+#define T20_CFG_MAXTCHS                         5
+#define T20_CFG_SZTHR1                          7
+#define T20_CFG_SZTHR2                          8
+#define T20_CFG_SHPTHR1                         9
+#define T20_CFG_SHPTHR2                         10
+#define T20_CFG_SHPEXTTO                        11
+
+#define T20_MSG_STATUS                          1
+
+#define T20_MSG_STATUS_FACESUP                  BIT(0)
+
+#define T22_CFG_CTRL                            0
+#define T22_CFG_GCAFUL                          3 
+#define T22_CFG_GCAFLL                          5 
+#define T22_CFG_ACTVGCAFVALID                   7
+#define T22_CFG_NOISETHR                        8
+#define T22_CFG_FREQHOPSCALE                    10
+#define T22_CFG_FREQ                            11 
+#define T22_CFG_IDLEGCAFVAILD                   16
+
+#define T22_MSG_STATUS                          1
+#define T22_MSG_GCAFDEPTH                       2
+#define T22_MSG_FREQINDEX                       3
+
+#define T22_MSG_STATUS_FHCHG                    BIT(0)
+#define T22_MSG_STATUS_GCAFERR                  BIT(2)
+#define T22_MSG_STATUS_FHERR                    BIT(3)
+#define T22_MSG_STATUS_GCAFCHG                  BIT(4)
+
+#define T19_CFG_CTRL                            0
+#define T19_CFG_REPORTMASK                      1
+#define T19_CFG_DIR                             2
+#define T19_CFG_INTPULLUP                       3
+#define T19_CFG_OUT                             4
+#define T19_CFG_WAKE                            5
+#define T19_CFG_PWM                             6
+#define T19_CFG_PERIOD                          7
+#define T19_CFG_DUTY0                           8
+#define T19_CFG_DUTY1                           9
+#define T19_CFG_DUTY2                           10
+#define T19_CFG_DUTY3                           11
+#define T19_CFG_TRIGGER0                        12
+#define T19_CFG_TRIGGER1                        13
+#define T19_CFG_TRIGGER2                        14
+#define T19_CFG_TRIGGER3                        15
+
+#define T19_CFG_CTRL_ENABLE                     BIT(0)
+#define T19_CFG_CTRL_RPTEN                      BIT(1)
+#define T19_CFG_CTRL_FORCERPT                   BIT(2)
+
+#define T19_MSG_STATUS                          1
+
+#define T25_CFG_CTRL                            0
+#define T25_CFG_CMD                             1
+
+#define T25_MSG_STATUS                          1
+#define T25_MSG_INFO                            2 
+
+#define T28_CFG_CTRL                            0
+#define T28_CFG_CMD                             1
+#define T28_CFG_MODE                            2
+#define T28_CFG_IDLEGCAFDEPTH                   3
+#define T28_CFG_ACTVGCAFDEPTH                   4
+#define T28_CFG_VOLTAGE                         5
+
+#define T28_CFG_MODE0_X                         16
+#define T28_CFG_MODE0_Y                         14
+
+#define T28_MSG_STATUS                          1
+
+#define T40_CFG_CTRL                            0
+#define T40_CFG_XLOGRIP                         1
+#define T40_CFG_XHIGRIP                         2
+#define T40_CFG_YLOGRIP                         3
+#define T40_CFG_YHIGRIP                         4
+
+#define T42_CFG_CTRL                            0
+#define T42_CFG_APPRTHR                         1
+#define T42_CFG_MAXAPPRAREA                     2
+#define T42_CFG_MAXTCHAREA                      3
+#define T42_CFG_SUPSTRENGTH                     4
+#define T42_CFG_SUPEXTTO                        5
+#define T42_CFG_MAXNUMTCHS                      6
+#define T42_CFG_SHAPESTRENGTH                   7
+
+#define T42_MSG_STATUS                          1
+
+#define T47_CFG_CTRL                            0
+#define T47_CFG_CONTMIN                         1
+#define T47_CFG_CONTMAX                         2
+#define T47_CFG_STABILITY                       3
+#define T47_CFG_MAXTCHAREA                      4
+#define T47_CFG_AMPLTHR                         5
+#define T47_CFG_STYSHAPE                        6
+#define T47_CFG_HOVERSUP                        7
+#define T47_CFG_CONFTHR                         8
+#define T47_CFG_SYNCSPERX                       9
+
+#define T48_CFG_CTRL                            0
+#define T48_CFG_CFG                             1
+#define T48_CFG_CALCFG                          2
+#define T48_CFG_BASEFREQ                        3
+#define T48_CFG_FREQ                            4 
+#define T48_CFG_MFFREQ                          8 
+#define T48_CFG_NLGAIN                          10
+#define T48_CFG_NLTHR                           11
+#define T48_CFG_GCLIMIT                         12
+#define T48_CFG_GCACTVINVLDADCS                 13
+#define T48_CFG_GCIDLEINVLDADCS                 14
+#define T48_CFG_GCINVALIDTHR                    15 
+#define T48_CFG_GCMAXADCSPERX                   17
+#define T48_CFG_GCLIMITMIN                      18
+#define T48_CFG_GCLIMITMAX                      19
+#define T48_CFG_GCCOUNTMINTGT                   20 
+#define T48_CFG_MFINVLDDIFFTHR                  22
+#define T48_CFG_MFINCADCSPXTHR                  23 
+#define T48_CFG_MFERRORTHR                      25 
+#define T48_CFG_SELFREQMAX                      27
+#define T48_CFG_NOCALCFG                        28 
+#define T48_CFG_T9SETTINGS                      34
+
+#define T48_MSG_STATUS                          1
+#define T48_MSG_ADCSPERX                        2
+#define T48_MSG_FREQ                            3
+#define T48_MSG_STATE                           4
+#define T48_MSG_NOISE_LV                        5
+#define T48_MSG_NLTHR				6
+
+#define T48_MSG_STATUS_FREQCHG                  BIT(0)
+#define T48_MSG_STATUS_APXCHG                   BIT(1)
+#define T48_MSG_STATUS_ALGOERR                  BIT(2)
+#define T48_MSG_STATUS_STATCHG                  BIT(4)
+#define T48_MSG_STATUS_NLVLCGH			BIT(5)
+
+#define T48_MSG_STATE_OFF                       0
+#define T48_MSG_STATE_SEARCH                    1
+#define T48_MSG_STATE_GC                        2
+#define T48_MSG_STATE_GC_ERR                    3
+#define T48_MSG_STATE_MF                        4
+#define T48_MSG_STATE_MF_ERR                    5
+#define T48_MSG_STATE_NORMAL                    6
+
+#define T46_CFG_CTRL                            0
+#define T46_CFG_MODE                            1
+#define T46_CFG_IDLESYNCSPERX                   2
+#define T46_CFG_ACTVSYNCSPERX                   3
+#define T46_CFG_ADCSPERSYNC                     4
+#define T46_CFG_PULSESPERADC                    5
+#define T46_CFG_XSLEW                           6
+#define T46_CFG_SYNCDELAY                       7 
+
+#define T46_CFG_MODE0_X                         16
+#define T46_CFG_MODE0_Y                         14
+
+#define T46_MSG_STATUS                          1
+
+#define T35_CFG_MAXTCHTHR			0
+#define T35_CFG_MAXNLTHR			1
+#define T35_CFG_MAXDI				2
+#define T35_CFG_MAXFILTER			3
+#define T35_CFG_THRCHTHR			4
+
+#define T58_CFG_INCTCHTHR			0
+#define T58_CFG_MAXNLTHR			1
+#define T58_CFG_MAXDI				2
+#define T58_CFG_MAXFILTER			3
+#define T58_CFG_THRCHTHR			4
+
+#define CB_TCHTHR                               0
+#define CB_NOISETHR                             1
+#define CB_IDLEGCAFDEPTH                        2
+#define CB_ACTVGCAFDEPTH                        3
+#define CB_NLTHR				1 
+#define CB_IDLESYNCSPERX                        2 
+#define CB_ACTVSYNCSPERX                        3 
+#define CB_SELFREQMAX				4 
+#define CB_BASEFREQ				5
+#define CB_TCHDI				6 
+#define CB_NEXTTCHDI				7 
+#define CB_INCTCHTHR				8 
+#define CB_MAXNLTHR				9
+#define CB_MINTCHDI				10
+#define CB_MINMOVFILTER				11
+#define CB_TCHTHRCHGTHR				12
+
+#define WLC_IDLEACQINT                          0
+#define WLC_ACTVACQINT                          1
+#define WLC_ACTV2IDLETO                         2
+#define WLC_TCHTHR                              3
+#define WLC_NOISETHR                            4
+#define WLC_IDLEGCAFDEPTH                       5
+#define WLC_ACTVGCAFDEPTH                       6
+
+#define NC_TCHTHR                               0
+#define NC_TCHDI                                1
+#define NC_NOISETHR                             2
+
+#define FL_XLOGRIPMIN                           0
+#define FL_XLOGRIPMAX                           1
+#define FL_XHIGRIPMIN                           2
+#define FL_XHIGRIPMAX                           3
+
+#define TW_SHIFT				1
+
+#define SYN_AND_REPORT_TYPE_A           0
+#define SYN_AND_REPORT_TYPE_B           1
+
+struct info_id_t {
+	uint8_t family_id;
+	uint8_t variant_id;
+	uint8_t version;
+	uint8_t build;
+	uint8_t matrix_x_size;
+	uint8_t matrix_y_size;
+	uint8_t num_declared_objects;
+};
+
+struct object_t {
+	uint8_t object_type;
+	uint16_t i2c_address;
+	uint8_t size;
+	uint8_t instances;
+	uint8_t num_report_ids;
+	uint8_t report_ids;
+};
+
+struct atmel_virtual_key {
+	int keycode;
+	int range_min;
+	int range_max;
+};
+
+struct atmel_finger_data {
+	int x;
+	int y;
+	int w;
+	int z;
+};
+
+struct atmel_cfg {
+	uint8_t objid;
+	uint8_t byte;
+	uint8_t value;
+	uint8_t orival;
+};
+
+struct atmel_mferr {
+	uint8_t cnt;
+	struct atmel_cfg *cfg;
+};
+
+struct atmel_i2c_platform_data {
+	uint16_t version;
+	uint16_t source;
+	uint16_t build;
+	uint16_t abs_x_min;
+	uint16_t abs_x_max;
+	uint16_t abs_y_min;
+	uint16_t abs_y_max;
+	uint8_t abs_pressure_min;
+	uint8_t abs_pressure_max;
+	uint8_t abs_width_min;
+	uint8_t abs_width_max;
+	int gpio_irq;
+	int gpio_rst;
+	int (*power)(int on);
+	uint8_t unlock_attr;
+	uint8_t report_type;
+	int8_t config_T6[6];
+	int8_t config_T7[3];
+	int8_t config_T8[10];
+	int8_t config_T9[35];
+	int8_t config_T15[11];
+	int8_t config_T18[2];
+	int8_t config_T19[16];
+	int8_t config_T20[12];
+	int8_t config_T22[17];
+	int8_t config_T23[15];
+	int8_t config_T24[19];
+	int8_t config_T25[14];
+	int8_t config_T27[7];
+	int8_t config_T28[6];
+	int8_t config_T35[11];
+	int8_t config_T40[5];
+	int8_t config_T42[8];
+	int8_t config_T46[9];
+	int8_t config_T47[10];
+	int8_t config_T48[54];
+	int8_t config_T55[4];
+	int8_t config_T58[11];
+	uint8_t object_crc[3];
+	int8_t cable_config_T7[3];
+	int8_t cable_config_T8[10];
+	int8_t cable_config_T9[35];
+	int8_t cable_config_T22[17];
+	int8_t cable_config_T28[6];
+	int8_t wlc_config[7];
+	uint8_t wlc_freq[5];
+	int8_t noise_config[3];
+	uint8_t call_tchthr[2];
+	uint8_t locking_config[1];
+	uint16_t filter_level[4];
+	uint8_t GCAF_level[5];
+	struct atmel_mferr mferr_config;
+	struct atmel_mferr cfm_calb;
+	struct atmel_mferr cable_config;
+	uint8_t noiseLine_config[8];
+	uint8_t workaround;
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+	uint16_t flt_th;
+#endif
+};
+
+struct atmel_config_data {
+	int8_t config[6];
+	int8_t *config_T7;
+	int8_t *config_T8;
+	int8_t *config_T9;
+	int8_t *config_T22;
+	int8_t *config_T28;
+	int8_t *config_T35;
+	int8_t *config_T40;
+	int8_t *config_T42;
+	int8_t *config_T46;
+	int8_t *config_T48;
+	int8_t *config_T55;
+	int8_t *config_T58;
+};
+
+#endif
+
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 9c49d17..2b4542a 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -135,7 +135,7 @@
 				 * throttling rules. Don't do it again. */
 
 	/* request only flags */
-	__REQ_SORTED,		/* elevator knows about this request */
+	__REQ_SORTED = __REQ_RAHEAD, /* elevator knows about this request */
 	__REQ_SOFTBARRIER,	/* may not be passed by ioscheduler */
 	__REQ_NOMERGE,		/* don't touch this for merging */
 	__REQ_STARTED,		/* drive already may have started this one */
@@ -151,6 +151,7 @@
 	__REQ_IO_STAT,		/* account I/O stat */
 	__REQ_MIXED_MERGE,	/* merge of different types, fail separately */
 	__REQ_SANITIZE,		/* sanitize */
+	__REQ_URGENT,		/* urgent request */
 	__REQ_NR_BITS,		/* stops here */
 };
 
@@ -163,6 +164,7 @@
 #define REQ_PRIO		(1 << __REQ_PRIO)
 #define REQ_DISCARD		(1 << __REQ_DISCARD)
 #define REQ_SANITIZE		(1 << __REQ_SANITIZE)
+#define REQ_URGENT		(1 << __REQ_URGENT)
 #define REQ_NOIDLE		(1 << __REQ_NOIDLE)
 
 #define REQ_FAILFAST_MASK \
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index e76b0ae..6502841 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -282,6 +282,7 @@
 	struct request_list	rq;
 
 	request_fn_proc		*request_fn;
+	request_fn_proc		*urgent_request_fn;
 	make_request_fn		*make_request_fn;
 	prep_rq_fn		*prep_rq_fn;
 	unprep_rq_fn		*unprep_rq_fn;
@@ -365,6 +366,8 @@
 	struct list_head	icq_list;
 
 	struct queue_limits	limits;
+	bool			notified_urgent;
+	bool			dispatched_urgent;
 
 	/*
 	 * sg stuff
@@ -673,6 +676,8 @@
 extern struct request *blk_make_request(struct request_queue *, struct bio *,
 					gfp_t);
 extern void blk_requeue_request(struct request_queue *, struct request *);
+extern int blk_reinsert_request(struct request_queue *q, struct request *rq);
+extern bool blk_reinsert_req_sup(struct request_queue *q);
 extern void blk_add_request_payload(struct request *rq, struct page *page,
 		unsigned int len);
 extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
@@ -822,6 +827,7 @@
 extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);
 extern struct request_queue *blk_init_allocated_queue(struct request_queue *,
 						      request_fn_proc *, spinlock_t *);
+extern void blk_urgent_request(struct request_queue *q, request_fn_proc *fn);
 extern void blk_cleanup_queue(struct request_queue *);
 extern void blk_queue_make_request(struct request_queue *, make_request_fn *);
 extern void blk_queue_bounce_limit(struct request_queue *, u64);
diff --git a/include/linux/bma250.h b/include/linux/bma250.h
new file mode 100644
index 0000000..35d4c99
--- /dev/null
+++ b/include/linux/bma250.h
@@ -0,0 +1,752 @@
+#ifndef BMA250_H
+#define BMA250_H
+
+#include <linux/ioctl.h>
+
+#define SENSOR_NAME 			"bma250"
+#define ABSMIN				-512
+#define ABSMAX				512
+#define SLOPE_THRESHOLD_VALUE 		32
+#define SLOPE_DURATION_VALUE 		1
+#define INTERRUPT_LATCH_MODE 		13
+#define INTERRUPT_ENABLE 		1
+#define INTERRUPT_DISABLE 		0
+#define MAP_SLOPE_INTERRUPT 		2
+#define SLOPE_X_INDEX 			5
+#define SLOPE_Y_INDEX 			6
+#define SLOPE_Z_INDEX 			7
+#define BMA250_MAX_DELAY		200
+#define BMA250_CHIP_ID			3
+#define BMA250_RANGE_SET		0
+#define BMA250_BW_SET			2
+
+#define LOW_G_INTERRUPT				REL_Z
+#define HIGH_G_INTERRUPT 			REL_HWHEEL
+#define SLOP_INTERRUPT 				REL_DIAL
+#define DOUBLE_TAP_INTERRUPT 			REL_WHEEL
+#define SINGLE_TAP_INTERRUPT 			REL_MISC
+#define ORIENT_INTERRUPT 			ABS_PRESSURE
+#define FLAT_INTERRUPT 				ABS_DISTANCE
+
+
+#define HIGH_G_INTERRUPT_X_HAPPENED			1
+#define HIGH_G_INTERRUPT_Y_HAPPENED 			2
+#define HIGH_G_INTERRUPT_Z_HAPPENED 			3
+#define HIGH_G_INTERRUPT_X_NEGATIVE_HAPPENED 		4
+#define HIGH_G_INTERRUPT_Y_NEGATIVE_HAPPENED		5
+#define HIGH_G_INTERRUPT_Z_NEGATIVE_HAPPENED 		6
+#define SLOPE_INTERRUPT_X_HAPPENED 			7
+#define SLOPE_INTERRUPT_Y_HAPPENED 			8
+#define SLOPE_INTERRUPT_Z_HAPPENED 			9
+#define SLOPE_INTERRUPT_X_NEGATIVE_HAPPENED 		10
+#define SLOPE_INTERRUPT_Y_NEGATIVE_HAPPENED 		11
+#define SLOPE_INTERRUPT_Z_NEGATIVE_HAPPENED 		12
+#define DOUBLE_TAP_INTERRUPT_HAPPENED 			13
+#define SINGLE_TAP_INTERRUPT_HAPPENED 			14
+#define UPWARD_PORTRAIT_UP_INTERRUPT_HAPPENED 		15
+#define UPWARD_PORTRAIT_DOWN_INTERRUPT_HAPPENED	 	16
+#define UPWARD_LANDSCAPE_LEFT_INTERRUPT_HAPPENED 	17
+#define UPWARD_LANDSCAPE_RIGHT_INTERRUPT_HAPPENED	18
+#define DOWNWARD_PORTRAIT_UP_INTERRUPT_HAPPENED 	19
+#define DOWNWARD_PORTRAIT_DOWN_INTERRUPT_HAPPENED 	20
+#define DOWNWARD_LANDSCAPE_LEFT_INTERRUPT_HAPPENED 	21
+#define DOWNWARD_LANDSCAPE_RIGHT_INTERRUPT_HAPPENED 	22
+#define FLAT_INTERRUPT_TURE_HAPPENED			23
+#define FLAT_INTERRUPT_FALSE_HAPPENED			24
+#define LOW_G_INTERRUPT_HAPPENED			25
+
+#define PAD_LOWG					0
+#define PAD_HIGHG					1
+#define PAD_SLOP					2
+#define PAD_DOUBLE_TAP					3
+#define PAD_SINGLE_TAP					4
+#define PAD_ORIENT					5
+#define PAD_FLAT					6
+
+
+#define BMA250_CHIP_ID_REG                      0x00
+#define BMA250_VERSION_REG                      0x01
+#define BMA250_X_AXIS_LSB_REG                   0x02
+#define BMA250_X_AXIS_MSB_REG                   0x03
+#define BMA250_Y_AXIS_LSB_REG                   0x04
+#define BMA250_Y_AXIS_MSB_REG                   0x05
+#define BMA250_Z_AXIS_LSB_REG                   0x06
+#define BMA250_Z_AXIS_MSB_REG                   0x07
+#define BMA250_TEMP_RD_REG                      0x08
+#define BMA250_STATUS1_REG                      0x09
+#define BMA250_STATUS2_REG                      0x0A
+#define BMA250_STATUS_TAP_SLOPE_REG             0x0B
+#define BMA250_STATUS_ORIENT_HIGH_REG           0x0C
+#define BMA250_RANGE_SEL_REG                    0x0F
+#define BMA250_BW_SEL_REG                       0x10
+#define BMA250_MODE_CTRL_REG                    0x11
+#define BMA250_LOW_NOISE_CTRL_REG               0x12
+#define BMA250_DATA_CTRL_REG                    0x13
+#define BMA250_RESET_REG                        0x14
+#define BMA250_INT_ENABLE1_REG                  0x16
+#define BMA250_INT_ENABLE2_REG                  0x17
+#define BMA250_INT1_PAD_SEL_REG                 0x19
+#define BMA250_INT_DATA_SEL_REG                 0x1A
+#define BMA250_INT2_PAD_SEL_REG                 0x1B
+#define BMA250_INT_SRC_REG                      0x1E
+#define BMA250_INT_SET_REG                      0x20
+#define BMA250_INT_CTRL_REG                     0x21
+#define BMA250_LOW_DURN_REG                     0x22
+#define BMA250_LOW_THRES_REG                    0x23
+#define BMA250_LOW_HIGH_HYST_REG                0x24
+#define BMA250_HIGH_DURN_REG                    0x25
+#define BMA250_HIGH_THRES_REG                   0x26
+#define BMA250_SLOPE_DURN_REG                   0x27
+#define BMA250_SLOPE_THRES_REG                  0x28
+#define BMA250_TAP_PARAM_REG                    0x2A
+#define BMA250_TAP_THRES_REG                    0x2B
+#define BMA250_ORIENT_PARAM_REG                 0x2C
+#define BMA250_THETA_BLOCK_REG                  0x2D
+#define BMA250_THETA_FLAT_REG                   0x2E
+#define BMA250_FLAT_HOLD_TIME_REG               0x2F
+#define BMA250_STATUS_LOW_POWER_REG             0x31
+#define BMA250_SELF_TEST_REG                    0x32
+#define BMA250_EEPROM_CTRL_REG                  0x33
+#define BMA250_SERIAL_CTRL_REG                  0x34
+#define BMA250_CTRL_UNLOCK_REG                  0x35
+#define BMA250_OFFSET_CTRL_REG                  0x36
+#define BMA250_OFFSET_PARAMS_REG                0x37
+#define BMA250_OFFSET_FILT_X_REG                0x38
+#define BMA250_OFFSET_FILT_Y_REG                0x39
+#define BMA250_OFFSET_FILT_Z_REG                0x3A
+#define BMA250_OFFSET_UNFILT_X_REG              0x3B
+#define BMA250_OFFSET_UNFILT_Y_REG              0x3C
+#define BMA250_OFFSET_UNFILT_Z_REG              0x3D
+#define BMA250_SPARE_0_REG                      0x3E
+#define BMA250_SPARE_1_REG                      0x3F
+
+#define BMA250_ACC_X_LSB__POS           6
+#define BMA250_ACC_X_LSB__LEN           2
+#define BMA250_ACC_X_LSB__MSK           0xC0
+#define BMA250_ACC_X_LSB__REG           BMA250_X_AXIS_LSB_REG
+
+#define BMA250_ACC_X_MSB__POS           0
+#define BMA250_ACC_X_MSB__LEN           8
+#define BMA250_ACC_X_MSB__MSK           0xFF
+#define BMA250_ACC_X_MSB__REG           BMA250_X_AXIS_MSB_REG
+
+#define BMA250_ACC_Y_LSB__POS           6
+#define BMA250_ACC_Y_LSB__LEN           2
+#define BMA250_ACC_Y_LSB__MSK           0xC0
+#define BMA250_ACC_Y_LSB__REG           BMA250_Y_AXIS_LSB_REG
+
+#define BMA250_ACC_Y_MSB__POS           0
+#define BMA250_ACC_Y_MSB__LEN           8
+#define BMA250_ACC_Y_MSB__MSK           0xFF
+#define BMA250_ACC_Y_MSB__REG           BMA250_Y_AXIS_MSB_REG
+
+#define BMA250_ACC_Z_LSB__POS           6
+#define BMA250_ACC_Z_LSB__LEN           2
+#define BMA250_ACC_Z_LSB__MSK           0xC0
+#define BMA250_ACC_Z_LSB__REG           BMA250_Z_AXIS_LSB_REG
+
+#define BMA250_ACC_Z_MSB__POS           0
+#define BMA250_ACC_Z_MSB__LEN           8
+#define BMA250_ACC_Z_MSB__MSK           0xFF
+#define BMA250_ACC_Z_MSB__REG           BMA250_Z_AXIS_MSB_REG
+
+#define BMA250_RANGE_SEL__POS             0
+#define BMA250_RANGE_SEL__LEN             4
+#define BMA250_RANGE_SEL__MSK             0x0F
+#define BMA250_RANGE_SEL__REG             BMA250_RANGE_SEL_REG
+
+#define BMA250_BANDWIDTH__POS             0
+#define BMA250_BANDWIDTH__LEN             5
+#define BMA250_BANDWIDTH__MSK             0x1F
+#define BMA250_BANDWIDTH__REG             BMA250_BW_SEL_REG
+
+#define BMA250_EN_LOW_POWER__POS          6
+#define BMA250_EN_LOW_POWER__LEN          1
+#define BMA250_EN_LOW_POWER__MSK          0x40
+#define BMA250_EN_LOW_POWER__REG          BMA250_MODE_CTRL_REG
+
+#define BMA250_EN_SUSPEND__POS            7
+#define BMA250_EN_SUSPEND__LEN            1
+#define BMA250_EN_SUSPEND__MSK            0x80
+#define BMA250_EN_SUSPEND__REG            BMA250_MODE_CTRL_REG
+
+#define BMA250_INT_MODE_SEL__POS                0
+#define BMA250_INT_MODE_SEL__LEN                4
+#define BMA250_INT_MODE_SEL__MSK                0x0F
+#define BMA250_INT_MODE_SEL__REG                BMA250_INT_CTRL_REG
+
+#define BMA250_LOWG_INT_S__POS          0
+#define BMA250_LOWG_INT_S__LEN          1
+#define BMA250_LOWG_INT_S__MSK          0x01
+#define BMA250_LOWG_INT_S__REG          BMA250_STATUS1_REG
+
+#define BMA250_HIGHG_INT_S__POS          1
+#define BMA250_HIGHG_INT_S__LEN          1
+#define BMA250_HIGHG_INT_S__MSK          0x02
+#define BMA250_HIGHG_INT_S__REG          BMA250_STATUS1_REG
+
+#define BMA250_SLOPE_INT_S__POS          2
+#define BMA250_SLOPE_INT_S__LEN          1
+#define BMA250_SLOPE_INT_S__MSK          0x04
+#define BMA250_SLOPE_INT_S__REG          BMA250_STATUS1_REG
+
+#define BMA250_DOUBLE_TAP_INT_S__POS     4
+#define BMA250_DOUBLE_TAP_INT_S__LEN     1
+#define BMA250_DOUBLE_TAP_INT_S__MSK     0x10
+#define BMA250_DOUBLE_TAP_INT_S__REG     BMA250_STATUS1_REG
+
+#define BMA250_SINGLE_TAP_INT_S__POS     5
+#define BMA250_SINGLE_TAP_INT_S__LEN     1
+#define BMA250_SINGLE_TAP_INT_S__MSK     0x20
+#define BMA250_SINGLE_TAP_INT_S__REG     BMA250_STATUS1_REG
+
+#define BMA250_ORIENT_INT_S__POS         6
+#define BMA250_ORIENT_INT_S__LEN         1
+#define BMA250_ORIENT_INT_S__MSK         0x40
+#define BMA250_ORIENT_INT_S__REG         BMA250_STATUS1_REG
+
+#define BMA250_FLAT_INT_S__POS           7
+#define BMA250_FLAT_INT_S__LEN           1
+#define BMA250_FLAT_INT_S__MSK           0x80
+#define BMA250_FLAT_INT_S__REG           BMA250_STATUS1_REG
+
+#define BMA250_DATA_INT_S__POS           7
+#define BMA250_DATA_INT_S__LEN           1
+#define BMA250_DATA_INT_S__MSK           0x80
+#define BMA250_DATA_INT_S__REG           BMA250_STATUS2_REG
+
+#define BMA250_SLOPE_FIRST_X__POS        0
+#define BMA250_SLOPE_FIRST_X__LEN        1
+#define BMA250_SLOPE_FIRST_X__MSK        0x01
+#define BMA250_SLOPE_FIRST_X__REG        BMA250_STATUS_TAP_SLOPE_REG
+
+#define BMA250_SLOPE_FIRST_Y__POS        1
+#define BMA250_SLOPE_FIRST_Y__LEN        1
+#define BMA250_SLOPE_FIRST_Y__MSK        0x02
+#define BMA250_SLOPE_FIRST_Y__REG        BMA250_STATUS_TAP_SLOPE_REG
+
+#define BMA250_SLOPE_FIRST_Z__POS        2
+#define BMA250_SLOPE_FIRST_Z__LEN        1
+#define BMA250_SLOPE_FIRST_Z__MSK        0x04
+#define BMA250_SLOPE_FIRST_Z__REG        BMA250_STATUS_TAP_SLOPE_REG
+
+#define BMA250_SLOPE_SIGN_S__POS         3
+#define BMA250_SLOPE_SIGN_S__LEN         1
+#define BMA250_SLOPE_SIGN_S__MSK         0x08
+#define BMA250_SLOPE_SIGN_S__REG         BMA250_STATUS_TAP_SLOPE_REG
+
+#define BMA250_TAP_FIRST_X__POS        4
+#define BMA250_TAP_FIRST_X__LEN        1
+#define BMA250_TAP_FIRST_X__MSK        0x10
+#define BMA250_TAP_FIRST_X__REG        BMA250_STATUS_TAP_SLOPE_REG
+
+#define BMA250_TAP_FIRST_Y__POS        5
+#define BMA250_TAP_FIRST_Y__LEN        1
+#define BMA250_TAP_FIRST_Y__MSK        0x20
+#define BMA250_TAP_FIRST_Y__REG        BMA250_STATUS_TAP_SLOPE_REG
+
+#define BMA250_TAP_FIRST_Z__POS        6
+#define BMA250_TAP_FIRST_Z__LEN        1
+#define BMA250_TAP_FIRST_Z__MSK        0x40
+#define BMA250_TAP_FIRST_Z__REG        BMA250_STATUS_TAP_SLOPE_REG
+
+#define BMA250_TAP_FIRST_XYZ__POS        4
+#define BMA250_TAP_FIRST_XYZ__LEN        3
+#define BMA250_TAP_FIRST_XYZ__MSK        0x70
+#define BMA250_TAP_FIRST_XYZ__REG        BMA250_STATUS_TAP_SLOPE_REG
+
+#define BMA250_TAP_SIGN_S__POS         7
+#define BMA250_TAP_SIGN_S__LEN         1
+#define BMA250_TAP_SIGN_S__MSK         0x80
+#define BMA250_TAP_SIGN_S__REG         BMA250_STATUS_TAP_SLOPE_REG
+
+#define BMA250_HIGHG_FIRST_X__POS        0
+#define BMA250_HIGHG_FIRST_X__LEN        1
+#define BMA250_HIGHG_FIRST_X__MSK        0x01
+#define BMA250_HIGHG_FIRST_X__REG        BMA250_STATUS_ORIENT_HIGH_REG
+
+#define BMA250_HIGHG_FIRST_Y__POS        1
+#define BMA250_HIGHG_FIRST_Y__LEN        1
+#define BMA250_HIGHG_FIRST_Y__MSK        0x02
+#define BMA250_HIGHG_FIRST_Y__REG        BMA250_STATUS_ORIENT_HIGH_REG
+
+#define BMA250_HIGHG_FIRST_Z__POS        2
+#define BMA250_HIGHG_FIRST_Z__LEN        1
+#define BMA250_HIGHG_FIRST_Z__MSK        0x04
+#define BMA250_HIGHG_FIRST_Z__REG        BMA250_STATUS_ORIENT_HIGH_REG
+
+#define BMA250_HIGHG_SIGN_S__POS         3
+#define BMA250_HIGHG_SIGN_S__LEN         1
+#define BMA250_HIGHG_SIGN_S__MSK         0x08
+#define BMA250_HIGHG_SIGN_S__REG         BMA250_STATUS_ORIENT_HIGH_REG
+
+#define BMA250_ORIENT_S__POS             4
+#define BMA250_ORIENT_S__LEN             3
+#define BMA250_ORIENT_S__MSK             0x70
+#define BMA250_ORIENT_S__REG             BMA250_STATUS_ORIENT_HIGH_REG
+
+#define BMA250_FLAT_S__POS               7
+#define BMA250_FLAT_S__LEN               1
+#define BMA250_FLAT_S__MSK               0x80
+#define BMA250_FLAT_S__REG               BMA250_STATUS_ORIENT_HIGH_REG
+
+#define BMA250_EN_SLOPE_X_INT__POS         0
+#define BMA250_EN_SLOPE_X_INT__LEN         1
+#define BMA250_EN_SLOPE_X_INT__MSK         0x01
+#define BMA250_EN_SLOPE_X_INT__REG         BMA250_INT_ENABLE1_REG
+
+#define BMA250_EN_SLOPE_Y_INT__POS         1
+#define BMA250_EN_SLOPE_Y_INT__LEN         1
+#define BMA250_EN_SLOPE_Y_INT__MSK         0x02
+#define BMA250_EN_SLOPE_Y_INT__REG         BMA250_INT_ENABLE1_REG
+
+#define BMA250_EN_SLOPE_Z_INT__POS         2
+#define BMA250_EN_SLOPE_Z_INT__LEN         1
+#define BMA250_EN_SLOPE_Z_INT__MSK         0x04
+#define BMA250_EN_SLOPE_Z_INT__REG         BMA250_INT_ENABLE1_REG
+
+#define BMA250_EN_SLOPE_XYZ_INT__POS         0
+#define BMA250_EN_SLOPE_XYZ_INT__LEN         3
+#define BMA250_EN_SLOPE_XYZ_INT__MSK         0x07
+#define BMA250_EN_SLOPE_XYZ_INT__REG         BMA250_INT_ENABLE1_REG
+
+#define BMA250_EN_DOUBLE_TAP_INT__POS      4
+#define BMA250_EN_DOUBLE_TAP_INT__LEN      1
+#define BMA250_EN_DOUBLE_TAP_INT__MSK      0x10
+#define BMA250_EN_DOUBLE_TAP_INT__REG      BMA250_INT_ENABLE1_REG
+
+#define BMA250_EN_SINGLE_TAP_INT__POS      5
+#define BMA250_EN_SINGLE_TAP_INT__LEN      1
+#define BMA250_EN_SINGLE_TAP_INT__MSK      0x20
+#define BMA250_EN_SINGLE_TAP_INT__REG      BMA250_INT_ENABLE1_REG
+
+#define BMA250_EN_ORIENT_INT__POS          6
+#define BMA250_EN_ORIENT_INT__LEN          1
+#define BMA250_EN_ORIENT_INT__MSK          0x40
+#define BMA250_EN_ORIENT_INT__REG          BMA250_INT_ENABLE1_REG
+
+#define BMA250_EN_FLAT_INT__POS            7
+#define BMA250_EN_FLAT_INT__LEN            1
+#define BMA250_EN_FLAT_INT__MSK            0x80
+#define BMA250_EN_FLAT_INT__REG            BMA250_INT_ENABLE1_REG
+
+#define BMA250_EN_HIGHG_X_INT__POS         0
+#define BMA250_EN_HIGHG_X_INT__LEN         1
+#define BMA250_EN_HIGHG_X_INT__MSK         0x01
+#define BMA250_EN_HIGHG_X_INT__REG         BMA250_INT_ENABLE2_REG
+
+#define BMA250_EN_HIGHG_Y_INT__POS         1
+#define BMA250_EN_HIGHG_Y_INT__LEN         1
+#define BMA250_EN_HIGHG_Y_INT__MSK         0x02
+#define BMA250_EN_HIGHG_Y_INT__REG         BMA250_INT_ENABLE2_REG
+
+#define BMA250_EN_HIGHG_Z_INT__POS         2
+#define BMA250_EN_HIGHG_Z_INT__LEN         1
+#define BMA250_EN_HIGHG_Z_INT__MSK         0x04
+#define BMA250_EN_HIGHG_Z_INT__REG         BMA250_INT_ENABLE2_REG
+
+#define BMA250_EN_HIGHG_XYZ_INT__POS         2
+#define BMA250_EN_HIGHG_XYZ_INT__LEN         1
+#define BMA250_EN_HIGHG_XYZ_INT__MSK         0x04
+#define BMA250_EN_HIGHG_XYZ_INT__REG         BMA250_INT_ENABLE2_REG
+
+#define BMA250_EN_LOWG_INT__POS            3
+#define BMA250_EN_LOWG_INT__LEN            1
+#define BMA250_EN_LOWG_INT__MSK            0x08
+#define BMA250_EN_LOWG_INT__REG            BMA250_INT_ENABLE2_REG
+
+#define BMA250_EN_NEW_DATA_INT__POS        4
+#define BMA250_EN_NEW_DATA_INT__LEN        1
+#define BMA250_EN_NEW_DATA_INT__MSK        0x10
+#define BMA250_EN_NEW_DATA_INT__REG        BMA250_INT_ENABLE2_REG
+
+#define BMA250_EN_INT1_PAD_LOWG__POS        0
+#define BMA250_EN_INT1_PAD_LOWG__LEN        1
+#define BMA250_EN_INT1_PAD_LOWG__MSK        0x01
+#define BMA250_EN_INT1_PAD_LOWG__REG        BMA250_INT1_PAD_SEL_REG
+
+#define BMA250_EN_INT1_PAD_HIGHG__POS       1
+#define BMA250_EN_INT1_PAD_HIGHG__LEN       1
+#define BMA250_EN_INT1_PAD_HIGHG__MSK       0x02
+#define BMA250_EN_INT1_PAD_HIGHG__REG       BMA250_INT1_PAD_SEL_REG
+
+#define BMA250_EN_INT1_PAD_SLOPE__POS       2
+#define BMA250_EN_INT1_PAD_SLOPE__LEN       1
+#define BMA250_EN_INT1_PAD_SLOPE__MSK       0x04
+#define BMA250_EN_INT1_PAD_SLOPE__REG       BMA250_INT1_PAD_SEL_REG
+
+#define BMA250_EN_INT1_PAD_DB_TAP__POS      4
+#define BMA250_EN_INT1_PAD_DB_TAP__LEN      1
+#define BMA250_EN_INT1_PAD_DB_TAP__MSK      0x10
+#define BMA250_EN_INT1_PAD_DB_TAP__REG      BMA250_INT1_PAD_SEL_REG
+
+#define BMA250_EN_INT1_PAD_SNG_TAP__POS     5
+#define BMA250_EN_INT1_PAD_SNG_TAP__LEN     1
+#define BMA250_EN_INT1_PAD_SNG_TAP__MSK     0x20
+#define BMA250_EN_INT1_PAD_SNG_TAP__REG     BMA250_INT1_PAD_SEL_REG
+
+#define BMA250_EN_INT1_PAD_ORIENT__POS      6
+#define BMA250_EN_INT1_PAD_ORIENT__LEN      1
+#define BMA250_EN_INT1_PAD_ORIENT__MSK      0x40
+#define BMA250_EN_INT1_PAD_ORIENT__REG      BMA250_INT1_PAD_SEL_REG
+
+#define BMA250_EN_INT1_PAD_FLAT__POS        7
+#define BMA250_EN_INT1_PAD_FLAT__LEN        1
+#define BMA250_EN_INT1_PAD_FLAT__MSK        0x80
+#define BMA250_EN_INT1_PAD_FLAT__REG        BMA250_INT1_PAD_SEL_REG
+
+#define BMA250_EN_INT2_PAD_LOWG__POS        0
+#define BMA250_EN_INT2_PAD_LOWG__LEN        1
+#define BMA250_EN_INT2_PAD_LOWG__MSK        0x01
+#define BMA250_EN_INT2_PAD_LOWG__REG        BMA250_INT2_PAD_SEL_REG
+
+#define BMA250_EN_INT2_PAD_HIGHG__POS       1
+#define BMA250_EN_INT2_PAD_HIGHG__LEN       1
+#define BMA250_EN_INT2_PAD_HIGHG__MSK       0x02
+#define BMA250_EN_INT2_PAD_HIGHG__REG       BMA250_INT2_PAD_SEL_REG
+
+#define BMA250_EN_INT2_PAD_SLOPE__POS       2
+#define BMA250_EN_INT2_PAD_SLOPE__LEN       1
+#define BMA250_EN_INT2_PAD_SLOPE__MSK       0x04
+#define BMA250_EN_INT2_PAD_SLOPE__REG       BMA250_INT2_PAD_SEL_REG
+
+#define BMA250_EN_INT2_PAD_DB_TAP__POS      4
+#define BMA250_EN_INT2_PAD_DB_TAP__LEN      1
+#define BMA250_EN_INT2_PAD_DB_TAP__MSK      0x10
+#define BMA250_EN_INT2_PAD_DB_TAP__REG      BMA250_INT2_PAD_SEL_REG
+
+#define BMA250_EN_INT2_PAD_SNG_TAP__POS     5
+#define BMA250_EN_INT2_PAD_SNG_TAP__LEN     1
+#define BMA250_EN_INT2_PAD_SNG_TAP__MSK     0x20
+#define BMA250_EN_INT2_PAD_SNG_TAP__REG     BMA250_INT2_PAD_SEL_REG
+
+#define BMA250_EN_INT2_PAD_ORIENT__POS      6
+#define BMA250_EN_INT2_PAD_ORIENT__LEN      1
+#define BMA250_EN_INT2_PAD_ORIENT__MSK      0x40
+#define BMA250_EN_INT2_PAD_ORIENT__REG      BMA250_INT2_PAD_SEL_REG
+
+#define BMA250_EN_INT2_PAD_FLAT__POS        7
+#define BMA250_EN_INT2_PAD_FLAT__LEN        1
+#define BMA250_EN_INT2_PAD_FLAT__MSK        0x80
+#define BMA250_EN_INT2_PAD_FLAT__REG        BMA250_INT2_PAD_SEL_REG
+
+#define BMA250_EN_INT1_PAD_NEWDATA__POS     0
+#define BMA250_EN_INT1_PAD_NEWDATA__LEN     1
+#define BMA250_EN_INT1_PAD_NEWDATA__MSK     0x01
+#define BMA250_EN_INT1_PAD_NEWDATA__REG     BMA250_INT_DATA_SEL_REG
+
+#define BMA250_EN_INT2_PAD_NEWDATA__POS     7
+#define BMA250_EN_INT2_PAD_NEWDATA__LEN     1
+#define BMA250_EN_INT2_PAD_NEWDATA__MSK     0x80
+#define BMA250_EN_INT2_PAD_NEWDATA__REG     BMA250_INT_DATA_SEL_REG
+
+
+#define BMA250_UNFILT_INT_SRC_LOWG__POS        0
+#define BMA250_UNFILT_INT_SRC_LOWG__LEN        1
+#define BMA250_UNFILT_INT_SRC_LOWG__MSK        0x01
+#define BMA250_UNFILT_INT_SRC_LOWG__REG        BMA250_INT_SRC_REG
+
+#define BMA250_UNFILT_INT_SRC_HIGHG__POS       1
+#define BMA250_UNFILT_INT_SRC_HIGHG__LEN       1
+#define BMA250_UNFILT_INT_SRC_HIGHG__MSK       0x02
+#define BMA250_UNFILT_INT_SRC_HIGHG__REG       BMA250_INT_SRC_REG
+
+#define BMA250_UNFILT_INT_SRC_SLOPE__POS       2
+#define BMA250_UNFILT_INT_SRC_SLOPE__LEN       1
+#define BMA250_UNFILT_INT_SRC_SLOPE__MSK       0x04
+#define BMA250_UNFILT_INT_SRC_SLOPE__REG       BMA250_INT_SRC_REG
+
+#define BMA250_UNFILT_INT_SRC_TAP__POS         4
+#define BMA250_UNFILT_INT_SRC_TAP__LEN         1
+#define BMA250_UNFILT_INT_SRC_TAP__MSK         0x10
+#define BMA250_UNFILT_INT_SRC_TAP__REG         BMA250_INT_SRC_REG
+
+#define BMA250_UNFILT_INT_SRC_DATA__POS        5
+#define BMA250_UNFILT_INT_SRC_DATA__LEN        1
+#define BMA250_UNFILT_INT_SRC_DATA__MSK        0x20
+#define BMA250_UNFILT_INT_SRC_DATA__REG        BMA250_INT_SRC_REG
+
+#define BMA250_INT1_PAD_ACTIVE_LEVEL__POS       0
+#define BMA250_INT1_PAD_ACTIVE_LEVEL__LEN       1
+#define BMA250_INT1_PAD_ACTIVE_LEVEL__MSK       0x01
+#define BMA250_INT1_PAD_ACTIVE_LEVEL__REG       BMA250_INT_SET_REG
+
+#define BMA250_INT2_PAD_ACTIVE_LEVEL__POS       2
+#define BMA250_INT2_PAD_ACTIVE_LEVEL__LEN       1
+#define BMA250_INT2_PAD_ACTIVE_LEVEL__MSK       0x04
+#define BMA250_INT2_PAD_ACTIVE_LEVEL__REG       BMA250_INT_SET_REG
+
+#define BMA250_INT1_PAD_OUTPUT_TYPE__POS        1
+#define BMA250_INT1_PAD_OUTPUT_TYPE__LEN        1
+#define BMA250_INT1_PAD_OUTPUT_TYPE__MSK        0x02
+#define BMA250_INT1_PAD_OUTPUT_TYPE__REG        BMA250_INT_SET_REG
+
+#define BMA250_INT2_PAD_OUTPUT_TYPE__POS        3
+#define BMA250_INT2_PAD_OUTPUT_TYPE__LEN        1
+#define BMA250_INT2_PAD_OUTPUT_TYPE__MSK        0x08
+#define BMA250_INT2_PAD_OUTPUT_TYPE__REG        BMA250_INT_SET_REG
+
+
+#define BMA250_INT_MODE_SEL__POS                0
+#define BMA250_INT_MODE_SEL__LEN                4
+#define BMA250_INT_MODE_SEL__MSK                0x0F
+#define BMA250_INT_MODE_SEL__REG                BMA250_INT_CTRL_REG
+
+
+#define BMA250_INT_RESET_LATCHED__POS           7
+#define BMA250_INT_RESET_LATCHED__LEN           1
+#define BMA250_INT_RESET_LATCHED__MSK           0x80
+#define BMA250_INT_RESET_LATCHED__REG           BMA250_INT_CTRL_REG
+
+#define BMA250_LOWG_DUR__POS                    0
+#define BMA250_LOWG_DUR__LEN                    8
+#define BMA250_LOWG_DUR__MSK                    0xFF
+#define BMA250_LOWG_DUR__REG                    BMA250_LOW_DURN_REG
+
+#define BMA250_LOWG_THRES__POS                  0
+#define BMA250_LOWG_THRES__LEN                  8
+#define BMA250_LOWG_THRES__MSK                  0xFF
+#define BMA250_LOWG_THRES__REG                  BMA250_LOW_THRES_REG
+
+#define BMA250_LOWG_HYST__POS                   0
+#define BMA250_LOWG_HYST__LEN                   2
+#define BMA250_LOWG_HYST__MSK                   0x03
+#define BMA250_LOWG_HYST__REG                   BMA250_LOW_HIGH_HYST_REG
+
+#define BMA250_LOWG_INT_MODE__POS               2
+#define BMA250_LOWG_INT_MODE__LEN               1
+#define BMA250_LOWG_INT_MODE__MSK               0x04
+#define BMA250_LOWG_INT_MODE__REG               BMA250_LOW_HIGH_HYST_REG
+
+#define BMA250_HIGHG_DUR__POS                    0
+#define BMA250_HIGHG_DUR__LEN                    8
+#define BMA250_HIGHG_DUR__MSK                    0xFF
+#define BMA250_HIGHG_DUR__REG                    BMA250_HIGH_DURN_REG
+
+#define BMA250_HIGHG_THRES__POS                  0
+#define BMA250_HIGHG_THRES__LEN                  8
+#define BMA250_HIGHG_THRES__MSK                  0xFF
+#define BMA250_HIGHG_THRES__REG                  BMA250_HIGH_THRES_REG
+
+#define BMA250_HIGHG_HYST__POS                  6
+#define BMA250_HIGHG_HYST__LEN                  2
+#define BMA250_HIGHG_HYST__MSK                  0xC0
+#define BMA250_HIGHG_HYST__REG                  BMA250_LOW_HIGH_HYST_REG
+
+#define BMA250_SLOPE_DUR__POS                    0
+#define BMA250_SLOPE_DUR__LEN                    2
+#define BMA250_SLOPE_DUR__MSK                    0x03
+#define BMA250_SLOPE_DUR__REG                    BMA250_SLOPE_DURN_REG
+
+#define BMA250_SLOPE_THRES__POS                  0
+#define BMA250_SLOPE_THRES__LEN                  8
+#define BMA250_SLOPE_THRES__MSK                  0xFF
+#define BMA250_SLOPE_THRES__REG                  BMA250_SLOPE_THRES_REG
+
+#define BMA250_TAP_DUR__POS                    0
+#define BMA250_TAP_DUR__LEN                    3
+#define BMA250_TAP_DUR__MSK                    0x07
+#define BMA250_TAP_DUR__REG                    BMA250_TAP_PARAM_REG
+
+#define BMA250_TAP_SHOCK_DURN__POS             6
+#define BMA250_TAP_SHOCK_DURN__LEN             1
+#define BMA250_TAP_SHOCK_DURN__MSK             0x40
+#define BMA250_TAP_SHOCK_DURN__REG             BMA250_TAP_PARAM_REG
+
+#define BMA250_TAP_QUIET_DURN__POS             7
+#define BMA250_TAP_QUIET_DURN__LEN             1
+#define BMA250_TAP_QUIET_DURN__MSK             0x80
+#define BMA250_TAP_QUIET_DURN__REG             BMA250_TAP_PARAM_REG
+
+#define BMA250_TAP_THRES__POS                  0
+#define BMA250_TAP_THRES__LEN                  5
+#define BMA250_TAP_THRES__MSK                  0x1F
+#define BMA250_TAP_THRES__REG                  BMA250_TAP_THRES_REG
+
+#define BMA250_TAP_SAMPLES__POS                6
+#define BMA250_TAP_SAMPLES__LEN                2
+#define BMA250_TAP_SAMPLES__MSK                0xC0
+#define BMA250_TAP_SAMPLES__REG                BMA250_TAP_THRES_REG
+
+#define BMA250_ORIENT_MODE__POS                  0
+#define BMA250_ORIENT_MODE__LEN                  2
+#define BMA250_ORIENT_MODE__MSK                  0x03
+#define BMA250_ORIENT_MODE__REG                  BMA250_ORIENT_PARAM_REG
+
+#define BMA250_ORIENT_BLOCK__POS                 2
+#define BMA250_ORIENT_BLOCK__LEN                 2
+#define BMA250_ORIENT_BLOCK__MSK                 0x0C
+#define BMA250_ORIENT_BLOCK__REG                 BMA250_ORIENT_PARAM_REG
+
+#define BMA250_ORIENT_HYST__POS                  4
+#define BMA250_ORIENT_HYST__LEN                  3
+#define BMA250_ORIENT_HYST__MSK                  0x70
+#define BMA250_ORIENT_HYST__REG                  BMA250_ORIENT_PARAM_REG
+
+#define BMA250_ORIENT_AXIS__POS                  7
+#define BMA250_ORIENT_AXIS__LEN                  1
+#define BMA250_ORIENT_AXIS__MSK                  0x80
+#define BMA250_ORIENT_AXIS__REG                  BMA250_THETA_BLOCK_REG
+
+#define BMA250_THETA_BLOCK__POS                  0
+#define BMA250_THETA_BLOCK__LEN                  6
+#define BMA250_THETA_BLOCK__MSK                  0x3F
+#define BMA250_THETA_BLOCK__REG                  BMA250_THETA_BLOCK_REG
+
+#define BMA250_THETA_FLAT__POS                  0
+#define BMA250_THETA_FLAT__LEN                  6
+#define BMA250_THETA_FLAT__MSK                  0x3F
+#define BMA250_THETA_FLAT__REG                  BMA250_THETA_FLAT_REG
+
+#define BMA250_FLAT_HOLD_TIME__POS              4
+#define BMA250_FLAT_HOLD_TIME__LEN              2
+#define BMA250_FLAT_HOLD_TIME__MSK              0x30
+#define BMA250_FLAT_HOLD_TIME__REG              BMA250_FLAT_HOLD_TIME_REG
+
+#define BMA250_EN_SELF_TEST__POS                0
+#define BMA250_EN_SELF_TEST__LEN                2
+#define BMA250_EN_SELF_TEST__MSK                0x03
+#define BMA250_EN_SELF_TEST__REG                BMA250_SELF_TEST_REG
+
+
+
+#define BMA250_NEG_SELF_TEST__POS               2
+#define BMA250_NEG_SELF_TEST__LEN               1
+#define BMA250_NEG_SELF_TEST__MSK               0x04
+#define BMA250_NEG_SELF_TEST__REG               BMA250_SELF_TEST_REG
+
+
+#define BMA250_LOW_POWER_MODE_S__POS            0
+#define BMA250_LOW_POWER_MODE_S__LEN            1
+#define BMA250_LOW_POWER_MODE_S__MSK            0x01
+#define BMA250_LOW_POWER_MODE_S__REG            BMA250_STATUS_LOW_POWER_REG
+
+#define BMA250_EN_FAST_COMP__POS                5
+#define BMA250_EN_FAST_COMP__LEN                2
+#define BMA250_EN_FAST_COMP__MSK                0x60
+#define BMA250_EN_FAST_COMP__REG                BMA250_OFFSET_CTRL_REG
+
+#define BMA250_FAST_COMP_RDY_S__POS             4
+#define BMA250_FAST_COMP_RDY_S__LEN             1
+#define BMA250_FAST_COMP_RDY_S__MSK             0x10
+#define BMA250_FAST_COMP_RDY_S__REG             BMA250_OFFSET_CTRL_REG
+
+#define BMA250_COMP_TARGET_OFFSET_X__POS        1
+#define BMA250_COMP_TARGET_OFFSET_X__LEN        2
+#define BMA250_COMP_TARGET_OFFSET_X__MSK        0x06
+#define BMA250_COMP_TARGET_OFFSET_X__REG        BMA250_OFFSET_PARAMS_REG
+
+#define BMA250_COMP_TARGET_OFFSET_Y__POS        3
+#define BMA250_COMP_TARGET_OFFSET_Y__LEN        2
+#define BMA250_COMP_TARGET_OFFSET_Y__MSK        0x18
+#define BMA250_COMP_TARGET_OFFSET_Y__REG        BMA250_OFFSET_PARAMS_REG
+
+#define BMA250_COMP_TARGET_OFFSET_Z__POS        5
+#define BMA250_COMP_TARGET_OFFSET_Z__LEN        2
+#define BMA250_COMP_TARGET_OFFSET_Z__MSK        0x60
+#define BMA250_COMP_TARGET_OFFSET_Z__REG        BMA250_OFFSET_PARAMS_REG
+
+#define BMA250_UNLOCK_EE_WRITE_SETTING__POS     0
+#define BMA250_UNLOCK_EE_WRITE_SETTING__LEN     1
+#define BMA250_UNLOCK_EE_WRITE_SETTING__MSK     0x01
+#define BMA250_UNLOCK_EE_WRITE_SETTING__REG     BMA250_EEPROM_CTRL_REG
+
+#define BMA250_START_EE_WRITE_SETTING__POS      1
+#define BMA250_START_EE_WRITE_SETTING__LEN      1
+#define BMA250_START_EE_WRITE_SETTING__MSK      0x02
+#define BMA250_START_EE_WRITE_SETTING__REG      BMA250_EEPROM_CTRL_REG
+
+#define BMA250_EE_WRITE_SETTING_S__POS          2
+#define BMA250_EE_WRITE_SETTING_S__LEN          1
+#define BMA250_EE_WRITE_SETTING_S__MSK          0x04
+#define BMA250_EE_WRITE_SETTING_S__REG          BMA250_EEPROM_CTRL_REG
+
+#define BMA250_RANGE_2G                 0
+#define BMA250_RANGE_4G                 1
+#define BMA250_RANGE_8G                 2
+#define BMA250_RANGE_16G                3
+
+#define BMA250_BW_7_81HZ        0x08
+#define BMA250_BW_15_63HZ       0x09
+#define BMA250_BW_31_25HZ       0x0A
+#define BMA250_BW_62_50HZ       0x0B
+#define BMA250_BW_125HZ         0x0C
+#define BMA250_BW_250HZ         0x0D
+#define BMA250_BW_500HZ         0x0E
+#define BMA250_BW_1000HZ        0x0F
+
+#define BMA250_MODE_NORMAL      0
+#define BMA250_MODE_LOWPOWER    1
+#define BMA250_MODE_SUSPEND     2
+
+#define BMA250_GET_BITSLICE(regvar, bitname)\
+	((regvar & bitname##__MSK) >> bitname##__POS)
+
+#define BMA250_SET_BITSLICE(regvar, bitname, val)\
+		((regvar & ~bitname##__MSK) | ((val<<bitname##__POS)&bitname##__MSK))
+
+#define BMA250_I2C_NAME "bma250"
+
+#define BMAIO			0xA1
+
+#define bma250_CHIP_ID_REG	0x00
+#define bma250_X_AXIS_LSB_REG	0x2
+#define bma250_RANGE_SEL_REG	0x0F
+#define bma250_BW_SEL_REG	0x10
+#define bma250_MODE_CTRL_REG	0x11
+
+#define BMA_IOCTL_INIT			_IO(BMAIO, 0x31)
+#define BMA_IOCTL_WRITE			_IOW(BMAIO, 0x32, char[5])
+#define BMA_IOCTL_READ			_IOWR(BMAIO, 0x33, char[5])
+#define BMA_IOCTL_READ_ACCELERATION	_IOWR(BMAIO, 0x34, short[7])
+#define BMA_IOCTL_SET_MODE		_IOW(BMAIO, 0x35, short)
+#define BMA_IOCTL_GET_INT		_IOR(BMAIO, 0x36, short)
+#define BMA_IOCTL_GET_CHIP_LAYOUT	_IOR(BMAIO, 0x37, short)
+#define BMA_IOCTL_GET_CALI_MODE		_IOR(BMAIO, 0x38, short)
+#define BMA_IOCTL_SET_CALI_MODE		_IOW(BMAIO, 0x39, short)
+#define BMA_IOCTL_READ_CALI_VALUE       _IOR(BMAIO, 0x3a, char[3])
+#define BMA_IOCTL_WRITE_CALI_VALUE      _IOW(BMAIO, 0x3b, int)
+#define BMA_IOCTL_GET_UPDATE_USER_CALI_DATA    _IOR(BMAIO, 0x3c, short)
+#define BMA_IOCTL_SET_UPDATE_USER_CALI_DATA    _IOW(BMAIO, 0x3d, short)
+
+#define BMA_RANGE_2G		0x3
+#define BMA_RANGE_4G		0x5
+#define BMA_RANGE_8G		0x8
+#define BMA_RANGE_16G		0xC
+
+#define BMA_BW_7_81HZ		0x8
+#define BMA_BW_15_63HZ		0x9
+#define BMA_BW_31_25HZ		0xA
+#define BMA_BW_62_5HZ		0xB
+#define BMA_BW_125HZ		0xC
+#define BMA_BW_250HZ		0xD
+#define BMA_BW_500HZ		0xE
+#define BMA_BW_1000HZ		0xF
+
+#define E_OUT_OF_RANGE          (char)(-2)
+
+#define bma250_MODE_NORMAL      0
+#define bma250_MODE_SUSPEND     1
+
+extern unsigned int gs_kvalue;
+
+struct bma250_platform_data {
+	int intr;
+	int chip_layout;
+	int calibration_mode;
+	int gs_kvalue;
+	unsigned int (*G_Sensor_Compass_POR)(void);
+
+        
+        u8 axis_map_x;
+        u8 axis_map_y;
+        u8 axis_map_z;
+
+        u8 negate_x;
+        u8 negate_y;
+        u8 negate_z;
+
+	int (*power_LPM)(int on);
+};
+
+#endif
diff --git a/include/linux/capella_cm3602.h b/include/linux/capella_cm3602.h
new file mode 100644
index 0000000..dce39c8
--- /dev/null
+++ b/include/linux/capella_cm3602.h
@@ -0,0 +1,42 @@
+/* include/linux/capella_cm3602.h
+ *
+ * Copyright (C) 2009 Google, Inc.
+ * Author: Iliyan Malchev <malchev@google.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LINUX_CAPELLA_CM3602_H
+#define __LINUX_CAPELLA_CM3602_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#define CAPELLA_CM3602_IOCTL_MAGIC 'c'
+#define CAPELLA_CM3602_IOCTL_GET_ENABLED \
+		_IOR(CAPELLA_CM3602_IOCTL_MAGIC, 1, int *)
+#define CAPELLA_CM3602_IOCTL_ENABLE \
+		_IOW(CAPELLA_CM3602_IOCTL_MAGIC, 2, int *)
+
+#ifdef __KERNEL__
+#define CAPELLA_CM3602 "capella_cm3602"
+#define LS_PWR_ON					(1 << 0)
+#define PS_PWR_ON					(1 << 1)
+struct capella_cm3602_platform_data {
+	int (*power)(int, uint8_t); 
+	int (*enable)(uint8_t); 
+	int p_en; 
+	int p_out; 
+	int irq;
+};
+#endif 
+
+#endif
diff --git a/include/linux/cm3629.h b/include/linux/cm3629.h
new file mode 100644
index 0000000..46b8213
--- /dev/null
+++ b/include/linux/cm3629.h
@@ -0,0 +1,187 @@
+/* include/linux/cm3629.h
+ *
+ * Copyright (C) 2010 HTC, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LINUX_CM3629_H
+#define __LINUX_CM3629_H
+
+#define CM3629_I2C_NAME "CM3629"
+
+
+#define ALS_config_cmd		0x00
+#define ALS_high_thd		0x01
+#define ALS_low_thd		0x02
+
+#define PS_config		0x03
+#define PS_config_ms		0x04
+#define PS_CANC			0x05
+#define PS_1_thd		0x06
+#define PS_2_thd		0x07
+#define PS_data			0x08
+#define ALS_data		0x09
+#define INT_FLAG		0x0B
+#define CH_ID			0x0C
+
+
+#define ALS_CALIBRATED		0x6DA5
+#define PS_CALIBRATED		0x5053
+
+#define CM3629_ALS_IT_50ms 	(0 << 6)
+#define CM3629_ALS_IT_100ms 	(1 << 6)
+#define CM3629_ALS_IT_200ms 	(2 << 6)
+#define CM3629_ALS_IT_400ms 	(3 << 6)
+
+#define CM3629_ALS_IT_80ms 		(0 << 6)
+#define CM3629_ALS_IT_160ms 	(1 << 6)
+#define CM3629_ALS_IT_320ms 	(2 << 6)
+#define CM3629_ALS_IT_640ms 	(3 << 6)
+
+
+#define CM3629_ALS_AV_1		(0 << 4)
+#define CM3629_ALS_AV_2		(1 << 4)
+#define CM3629_ALS_AV_4		(2 << 4)
+#define CM3629_ALS_AV_8		(3 << 4)
+#define CM3629_ALS_PERS_1 	(0 << 2) 
+#define CM3629_ALS_PERS_2 	(1 << 2)
+#define CM3629_ALS_PERS_4 	(2 << 2)
+#define CM3629_ALS_PERS_8 	(3 << 2)
+#define CM3629_ALS_INT_EN	(1 << 1) 
+#define CM3629_ALS_SD		(1 << 0) 
+
+#define CM3629_PS_63_STEPS 	(0 << 4)
+#define CM3629_PS_120_STEPS 	(1 << 4)
+#define CM3629_PS_191_STEPS 	(2 << 4)
+#define CM3629_PS_255_STEPS 	(3 << 4)
+
+
+
+#define CM3629_PS_DR_1_40 	(0 << 6)
+#define CM3629_PS_DR_1_80 	(1 << 6)
+#define CM3629_PS_DR_1_160 	(2 << 6)
+#define CM3629_PS_DR_1_320 	(3 << 6)
+
+#define CM3629_PS_IT_1T 	(0 << 4)
+#define CM3629_PS_IT_1_3T 	(1 << 4)
+#define CM3629_PS_IT_1_6T 	(2 << 4)
+#define CM3629_PS_IT_2T 	(3 << 4)
+
+#define CM3629_PS1_PERS_1 	(0 << 2)
+#define CM3629_PS1_PERS_2 	(1 << 2)
+#define CM3629_PS1_PERS_3 	(2 << 2)
+#define CM3629_PS1_PERS_4 	(3 << 2)
+
+#define CM3629_PS2_SD		(1 << 1) 
+#define CM3629_PS1_SD		(1 << 0) 
+
+#define CM3629_PS_ITB_1_2 	(0 << 6)
+#define CM3629_PS_ITB_1 	(1 << 6)
+#define CM3629_PS_ITB_2 	(2 << 6)
+#define CM3629_PS_ITB_4 	(3 << 6)
+
+#define CM3629_PS_ITR_1 	(0 << 4)
+#define CM3629_PS_ITR_1_2  	(1 << 4)
+#define CM3629_PS_ITR_1_4 	(2 << 4)
+#define CM3629_PS_ITR_1_8 	(3 << 4)
+
+#define CM3629_PS2_INT_DIS 	(0 << 2)
+#define CM3629_PS2_INT_CLS 	(1 << 2)
+#define CM3629_PS2_INT_AWY 	(2 << 2)
+#define CM3629_PS2_INT_BOTH	(3 << 2)
+
+#define CM3629_PS1_INT_DIS 	(0 << 0)
+#define CM3629_PS1_INT_CLS 	(1 << 0)
+#define CM3629_PS1_INT_AWY 	(2 << 0)
+#define CM3629_PS1_INT_BOTH	(3 << 0)
+
+
+#define CM3629_PS2_PROL_4 	(0 << 6)
+#define CM3629_PS2_PROL_8 	(1 << 6)
+#define CM3629_PS2_PROL_16	(2 << 6)
+#define CM3629_PS2_PROL_32 	(3 << 6)
+
+#define CM3629_PS_INTT 		(1 << 5)
+#define CM3629_PS_SMART_PRES 	(1 << 4)
+#define CM3629_PS_PS_FOR 	(1 << 3)
+#define CM3629_PS_PS_TRIG	(1 << 2)
+
+#define CM3629_PS2_PERS_1 	(0 << 0)
+#define CM3629_PS2_PERS_2 	(1 << 0)
+#define CM3629_PS2_PERS_3 	(2 << 0)
+#define CM3629_PS2_PERS_4 	(3 << 0)
+
+#define CM3629_PS_MS 		(1 << 5)
+
+#define CM3629_PS2_SPFLAG 	(1 << 7)
+#define CM3629_PS1_SPFLAG 	(1 << 6)
+
+#define CM3629_ALS_IF_L 	(1 << 5)
+#define CM3629_ALS_IF_H 	(1 << 4)
+#define CM3629_PS2_IF_CLOSE	(1 << 3)
+#define CM3629_PS2_IF_AWAY	(1 << 2)
+#define CM3629_PS1_IF_CLOSE	(1 << 1)
+#define CM3629_PS1_IF_AWAY	(1 << 0)
+
+extern unsigned int ps_kparam1;
+extern unsigned int ps_kparam2;
+extern unsigned int als_kadc;
+enum {
+	CAPELLA_CM36282,
+	CAPELLA_CM36292,
+};
+
+enum {
+	CM3629_PS_DISABLE,
+	CM3629_PS1_ONLY,
+	CM3629_PS2_ONLY,
+	CM3629_PS1_PS2_BOTH,
+};
+
+struct cm3629_platform_data {
+	int model;
+	int intr;
+	uint16_t levels[10];
+	uint16_t golden_adc;
+	int (*power)(int, uint8_t); 
+	int (*lpm_power)(uint8_t); 
+	uint16_t cm3629_slave_address;
+	uint8_t ps_select;
+	uint8_t ps1_thd_set;
+	uint8_t ps1_thh_diff;
+	uint8_t ps2_thd_set;
+	uint8_t inte_cancel_set;
+	
+	uint8_t ps_conf2_val; 
+	uint8_t *mapping_table;
+	uint8_t mapping_size;
+	uint8_t ps_base_index;
+
+	uint8_t ps_calibration_rule;
+	uint8_t ps_conf1_val;
+	uint8_t ps_conf3_val;
+	uint8_t enable_polling_ignore;
+	uint8_t ps1_thd_no_cal;
+	uint8_t ps1_thd_with_cal;
+	uint8_t ps2_thd_no_cal;
+	uint8_t ps2_thd_with_cal;
+	uint8_t ls_cmd;
+	uint8_t ps1_adc_offset;
+	uint8_t ps2_adc_offset;
+	uint8_t ps_debounce;
+	uint16_t ps_delay_time;
+	unsigned int no_need_change_setting;
+	uint8_t dark_level;
+};
+
+int power_key_check_in_pocket(void);
+#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 11dd01b..caec85b 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -75,8 +75,9 @@
 	/* migration should happen before other stuff but after perf */
 	CPU_PRI_PERF		= 20,
 	CPU_PRI_MIGRATION	= 10,
-	/* prepare workqueues for other notifiers */
-	CPU_PRI_WORKQUEUE	= 5,
+	/* bring up workqueues before normal notifiers and down after */
+	CPU_PRI_WORKQUEUE_UP	= 5,
+	CPU_PRI_WORKQUEUE_DOWN	= -5,
 };
 
 #define CPU_ONLINE		0x0002 /* CPU (unsigned)v is up */
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 3bd46f7..a975de1 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -51,7 +51,7 @@
 extern void debug_show_all_locks(void);
 extern void debug_show_held_locks(struct task_struct *task);
 extern void debug_check_no_locks_freed(const void *from, unsigned long len);
-extern void debug_check_no_locks_held(struct task_struct *task);
+extern void debug_check_no_locks_held(void);
 #else
 static inline void debug_show_all_locks(void)
 {
@@ -67,7 +67,7 @@
 }
 
 static inline void
-debug_check_no_locks_held(struct task_struct *task)
+debug_check_no_locks_held(void)
 {
 }
 #endif
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 7d4e035..b36b28f 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -22,6 +22,9 @@
 typedef int (elevator_dispatch_fn) (struct request_queue *, int);
 
 typedef void (elevator_add_req_fn) (struct request_queue *, struct request *);
+typedef int (elevator_reinsert_req_fn) (struct request_queue *,
+					struct request *);
+typedef bool (elevator_is_urgent_fn) (struct request_queue *);
 typedef struct request *(elevator_request_list_fn) (struct request_queue *, struct request *);
 typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *);
 typedef int (elevator_may_queue_fn) (struct request_queue *, int);
@@ -46,6 +49,9 @@
 
 	elevator_dispatch_fn *elevator_dispatch_fn;
 	elevator_add_req_fn *elevator_add_req_fn;
+	elevator_reinsert_req_fn *elevator_reinsert_req_fn;
+	elevator_is_urgent_fn *elevator_is_urgent_fn;
+
 	elevator_activate_req_fn *elevator_activate_req_fn;
 	elevator_deactivate_req_fn *elevator_deactivate_req_fn;
 
@@ -122,6 +128,7 @@
 extern void elv_bio_merged(struct request_queue *q, struct request *,
 				struct bio *);
 extern void elv_requeue_request(struct request_queue *, struct request *);
+extern int elv_reinsert_request(struct request_queue *, struct request *);
 extern struct request *elv_former_request(struct request_queue *, struct request *);
 extern struct request *elv_latter_request(struct request_queue *, struct request *);
 extern int elv_register_queue(struct request_queue *q);
diff --git a/include/linux/ewtzmu2.h b/include/linux/ewtzmu2.h
new file mode 100644
index 0000000..184d997
--- /dev/null
+++ b/include/linux/ewtzmu2.h
@@ -0,0 +1,205 @@
+/* include/linux/ewtzmu2.h - EWTZMU compass driver
+ *
+ * Copyright (C) 2011 Prolific Technology Inc.
+ * Author: Kyle Chen
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef EWTZMU2_H
+#define EWTZMU2_H
+
+#include <linux/ioctl.h>
+
+#define EWTZMU_I2C_ADDRESS 			0x69
+#define EWTZMU_REG_GYROX_H          0xFB
+
+#define EWTZMU_REG_PWR_MGM          0x3E
+#define EWTZMU_SLEP                 0x00
+#define EWTZMU_POWERON              0x40
+
+#define EWTZMU_INT                  0x17
+#define EWTZMU_WTMON	            0x08
+
+#define EWTZMU_DLPF                 0x16
+#define EWTZMU_2000ds_1khz          0x1A
+#define EWTZMU_HPF		            0x80
+
+#define EWTZMU_SMPL         		0x15
+#define EWTZMU_100hz		        0x09  
+
+#define EWTZMU_FIFO_CTR             0x14
+#define EWTZMU_stream		        0x40
+#define EWTZMU_SAMPLE_100HZ			0x00
+#define EWTZMU_SAMPLE_50HZ			0x01   
+#define EWTZMU_SAMPLE_20HZ			0x04
+#define EWTZMU_SAMPLE_16HZ			0x05
+#define EWTZMU_SAMPLE_5HZ			0x13
+
+#define EWTZMU_FIFO_STS				0x13
+#define EWTZMU_PNT_H				0x02
+#define	EWTZMU_PNT_L				0x00
+
+#define EWIO						        0x83
+#define EW_IOCTL_SET_INIT              	    _IO(EWIO, 0x01)
+#define EW_IOCTL_SET_STANDBY				_IO(EWIO, 0x02)
+#define EW_IOCTL_READ_CHIPINFO         		_IOR(EWIO, 0x03, int)
+#define EW_IOCTL_READ_SENSORDATA       		_IOR(EWIO, 0x04, int)
+#define EW_IOCTL_READ_SENSORDATA_FIFO       _IOR(EWIO, 0x05, int)
+#define EW_IOCTL_READ_POSTUREDATA      		_IOR(EWIO, 0x06, int)
+#define EW_IOCTL_WRITE_POSTUREDATA     		_IOW(EWIO, 0x07, int)
+#define EW_IOCTL_READ_CALIDATA         		_IOR(EWIO, 0x08, int)
+#define EW_IOCTL_WRITE_CALIDATA        		_IOW(EWIO, 0x09, int)
+#define EW_IOCTL_READ_GYRODATA         		_IOR(EWIO, 0x0A, int)
+#define EW_IOCTL_WRITE_GYRODATA        		_IOW(EWIO, 0x0B, int)
+#define EW_IOCTL_READ_PEDODATA         		_IOR(EWIO, 0x0C, long)
+#define EW_IOCTL_WRITE_PEDODATA        		_IOW(EWIO, 0x0D, long)
+#define EW_IOCTL_READ_PEDOPARAM        		_IOR(EWIO, 0x0E, int)
+#define EW_IOCTL_WRITE_PEDOPARAM       		_IOW(EWIO, 0x0F, int)
+#define EW_IOCTL_READ_CONTROL          		_IOR(EWIO, 0x10, int)
+#define EW_IOCTL_WRITE_CONTROL         		_IOW(EWIO, 0x11, int)
+#define EW_IOCTL_WRITE_MODE            		_IOW(EWIO, 0x12, int)
+#define EW_IOCTL_WRITE_REPORT          		_IO(EWIO, 0x13)
+#define EW_IOCTL_READ_WIA			   		_IOR(EWIO, 0x14, int)
+#define EW_IOCTL_READ_AXISINTERFERENCE		_IOR(EWIO, 0x15, int)
+#define EW_IOCTL_GET_DIRPOLARITY			_IOR(EWIO, 0x16, int)
+#define EW_IOCTL_READ_ROTATION_VECTOR		_IOR(EWIO, 0x17, int)
+#define EW_IOCTL_WRITE_ROTATION_VECTOR		_IOW(EWIO, 0x18, int)
+#define EW_IOCTL_READ_LINEAR_ACCEL			_IOR(EWIO, 0x19, int)
+#define EW_IOCTL_WRITE_LINEAR_ACCEL			_IOW(EWIO, 0x1A, int)
+#define EW_IOCTL_READ_GRAVITY				_IOR(EWIO, 0x1B, int)
+#define EW_IOCTL_WRITE_GRAVITY				_IOW(EWIO, 0x1C, int)
+#define EW_IOCTL_SET_SAMPLERATE				_IOW(EWIO, 0x1D, int)
+
+#define EW_IOCTL_WRITE_I2CDATA				_IOW(EWIO, 0x1E, int)
+#define EW_IOCTL_WRITE_I2CADDR				_IOW(EWIO, 0x1F, int)
+#define EW_IOCTL_READ_I2CDATA				_IOR(EWIO, 0x20, int)
+
+#define EWDAEIO						       0x84
+#define EWDAE_IOCTL_SET_INIT				_IO(EWDAEIO, 0x01)
+#define EWDAE_IOCTL_SET_STANDBY				_IO(EWDAEIO, 0x02)
+#define EWDAE_IOCTL_GET_SENSORDATA     		_IOR(EWDAEIO, 0x03, int)
+#define EWDAE_IOCTL_GET_SENSORDATA_FIFO     _IOR(EWDAEIO, 0x13, int)
+#define EWDAE_IOCTL_SET_POSTURE        		_IOW(EWDAEIO, 0x04, int)
+#define EWDAE_IOCTL_SET_CALIDATA       		_IOW(EWDAEIO, 0x05, int)
+#define EWDAE_IOCTL_SET_GYRODATA       		_IOW(EWDAEIO, 0x06, int)
+#define EWDAE_IOCTL_SET_PEDODATA       		_IOW(EWDAEIO, 0x07, long)
+#define EWDAE_IOCTL_GET_PEDOPARAM      		_IOR(EWDAEIO, 0x08, int)
+#define EWDAE_IOCTL_SET_PEDOPARAM      		_IOR(EWDAEIO, 0x09, int)
+#define EWDAE_IOCTL_SET_CONTROL        		_IOW(EWDAEIO, 0x0A, int)
+#define EWDAE_IOCTL_GET_CONTROL        		_IOR(EWDAEIO, 0x0B, int)
+#define EWDAE_IOCTL_SET_MODE           		_IOW(EWDAEIO, 0x0C, int)
+#define EWDAE_IOCTL_SET_REPORT         		_IO(EWDAEIO, 0x0D)
+#define EWDAE_IOCTL_GET_WIA			   		_IOR(EWDAEIO, 0x0E, int)
+#define EWDAE_IOCTL_GET_AXISINTERFERENCE	_IOR(EWDAEIO, 0x0F, int)
+#define EWDAE_IOCTL_SET_SAMPLERATE			_IOW(EWDAEIO, 0x10, int)
+#define EWDAE_IOCTL_GET_DIRPOLARITY			_IOR(EWDAEIO, 0x11, int)
+#define EWDAE_IOCTL_GET_AKM_DATA			_IOR(EWDAEIO, 0x12, short[12])
+#define EWDAE_IOCTL_SET_ROTATION_VECTOR		_IOW(EWDAEIO, 0x14, int)
+#define EWDAE_IOCTL_SET_LINEAR_ACCEL		_IOW(EWDAEIO, 0x15, int)
+#define EWDAE_IOCTL_SET_GRAVITY				_IOW(EWDAEIO, 0x16, int)
+#define EWDAE_IOCTL_GET_AKM_READY			_IOR(EWDAEIO, 0x17, int)
+#define EWDAE_IOCTL_GET_GYRO_CAL_DATA			_IOR(EWDAEIO, 0x18, unsigned char[12])
+
+#define EWDAE_IOCTL_WRITE_I2CDATA			_IOW(EWDAEIO, 0x19, int)
+#define EWDAE_IOCTL_WRITE_I2CADDR			_IOW(EWDAEIO, 0x1A, int)
+#define EWDAE_IOCTL_READ_I2CDATA			_IOR(EWDAEIO, 0x1B, int)
+
+
+#define EWHALIO						   0x85
+#define EWHAL_IOCTL_GET_SENSORDATA     _IOR(EWHALIO, 0x01, int)
+#define EWHAL_IOCTL_GET_POSTURE        _IOR(EWHALIO, 0x02, int)
+#define EWHAL_IOCTL_GET_CALIDATA       _IOR(EWHALIO, 0x03, int)
+#define EWHAL_IOCTL_GET_GYRODATA       _IOR(EWHALIO, 0x04, int)
+#define EWHAL_IOCTL_GET_PEDODATA       _IOR(EWHALIO, 0x05, long)
+#define EWHAL_IOCTL_GET_PEDOPARAM      _IOR(EWHALIO, 0x06, int)
+#define EWHAL_IOCTL_SET_PEDOPARAM      _IOW(EWHALIO, 0x07, int)
+#define EWHAL_IOCTL_GET_CONTROL        _IOR(EWHALIO, 0x08, int)
+#define EWHAL_IOCTL_SET_CONTROL        _IOW(EWHALIO, 0x09, int)
+#define EWHAL_IOCTL_GET_WIA			   _IOR(EWHALIO, 0x0A, int)
+#define EWHAL_IOCTL_GET_ROTATION_VECTOR	 _IOR(EWHALIO, 0x0B, int)
+#define EWHAL_IOCTL_GET_LINEAR_ACCEL	 _IOR(EWHALIO, 0x0C, int)
+#define EWHAL_IOCTL_GET_GRAVITY			 _IOR(EWHALIO, 0x0D, int)
+
+#define EW_CHIPSET				    0
+#define EW_BUFSIZE				    256
+#define EW_AXIS_INTERFERENCE	    127
+#define EW_NORMAL_MODE			    0
+#define EW_DEFAULT_POLLING_TIME     200
+#define EW_REPORT_EN_COMPASS        1
+#define EW_REPORT_EN_GYROSCOPE      2
+
+#define EW_CB_LENGTH			10
+#define EW_CB_LOOPDELAY			 0
+#define EW_CB_RUN				 1
+#define EW_CB_ACCCALI			 2
+#define EW_CB_MAGCALI			 3
+#define EW_CB_ACTIVESENSORS		 4
+#define EW_CB_PD_RESET			 5
+#define EW_CB_PD_EN_PARAM		 6
+#define EW_CB_GYROCALI		     7
+#define EW_CB_ALGORITHMLOG		 8
+#define EW_CB_UNDEFINE_1		 9
+
+#define EW_DP_LENGTH			 6
+#define EW_DP_ACC_DIR			 0
+#define EW_DP_ACC_POLARITY		 1
+#define EW_DP_MAG_DIR			 2
+#define EW_DP_MAG_POLARITY		 3
+#define EW_DP_GYRO_DIR			 4
+#define EW_DP_GYRO_POLARITY		 5
+
+#define EW_PD_LENGTH			10
+#define EW_PD_PRARM_IIR1		 0
+#define EW_PD_PRARM_IIR2		 1
+#define EW_PD_PRARM_IIR3		 2
+#define EW_PD_PRARM_IIR4		 3
+#define EW_PD_PRARM_TH1			 4
+#define EW_PD_PRARM_TH2			 5
+#define EW_PD_PRARM_TH3			 6
+#define EW_PD_PRARM_TH4			 7
+#define EW_PD_UNDEFINE_1		 8
+#define EW_PD_UNDEFINE_2		 9
+
+#define EW_ACCELEROMETER_SENSOR	    0
+#define EW_MAGNETIC_FIELD_SENSOR	1
+#define EW_ORIENTATION_SENSOR		2
+#define EW_ROTATION_VECTOR			3
+#define EW_LINEAR_ACCELERATION		4
+#define EW_GRAVITY					5
+#define EW_GYROSCOPE_SENSOR	        6
+#define EW_PEDOMETER_SENSOR	        9
+
+#define EW_BIT_ACCELEROMETER		(1<<EW_ACCELEROMETER_SENSOR)
+#define EW_BIT_MAGNETIC_FIELD		(1<<EW_MAGNETIC_FIELD_SENSOR)
+#define EW_BIT_ORIENTATION		    (1<<EW_ORIENTATION_SENSOR)
+#define EW_BIT_ROTATION_VECTOR		(1<<EW_ROTATION_VECTOR)
+#define EW_BIT_LINEAR_ACCELERATION	(1<<EW_LINEAR_ACCELERATION)
+#define EW_BIT_GRAVITY				(1<<EW_GRAVITY)
+#define EW_BIT_GYROSCOPE			(1<<EW_GYROSCOPE_SENSOR)
+#define EW_BIT_PEDOMETER			(1<<EW_PEDOMETER_SENSOR)
+
+struct pana_gyro_platform_data {
+	int reset_line;
+	int reset_asserted;
+	int gpio_data_ready_int;
+	int acc_dir;
+	int	acc_polarity;
+	int gyro_dir;
+	int gyro_polarity;
+	int mag_dir;
+	int mag_polarity;
+	int sleep_pin;
+	void (*config_gyro_diag_gpios)(bool enable);
+};
+extern unsigned char gyro_gsensor_kvalue[37];
+
+#endif
diff --git a/include/linux/ewtzmu2_cal.h b/include/linux/ewtzmu2_cal.h
new file mode 100644
index 0000000..48c597e
--- /dev/null
+++ b/include/linux/ewtzmu2_cal.h
@@ -0,0 +1,30 @@
+#ifndef EWTZMU2_CALI_H
+#define EWTZMU2_CALI_H
+
+#define EW_GYROCALI_START			1
+#define EW_GYROCALI_END				0
+#define EW_BIAS_LENGTH				3
+
+#define EW_CALI_SUCCESS				0
+#define EW_DRV_SUCCESS 				 0
+#define EW_I2C_ERROR				-1
+#define EW_CLIENT_ERROR				-2
+#define EW_BUFFER_PARAMS			-3
+#define EW_DRV_FAILURE				-4
+#define EW_DEVNODE_FAILURE			-5
+#define EW_DATA_RANGE_ERROR			-6
+#define EW_OUT_OF_SPEC_NOT_STABLE	-7
+#define EW_FILE_FAILURE				-8
+#define EW_JNI_FAILURE				-9
+#define EW_DIAG_FAILURE				-10
+#define EW_DATA_OFFSET_ERROR		-11
+#define EW_DATA_REPEAT_ERROR_X		-12
+#define EW_DATA_REPEAT_ERROR_Y		-13
+#define EW_DATA_REPEAT_ERROR_Z		-14
+
+
+
+#define BIAS_MULTI_TIMES				100
+
+#endif
+
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 80e7fae..b56d26c 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -3,6 +3,7 @@
 #ifndef FREEZER_H_INCLUDED
 #define FREEZER_H_INCLUDED
 
+#include <linux/debug_locks.h>
 #include <linux/sched.h>
 #include <linux/wait.h>
 #include <linux/atomic.h>
@@ -41,7 +42,22 @@
 extern void thaw_processes(void);
 extern void thaw_kernel_threads(void);
 
-static inline bool try_to_freeze(void)
+/*
+ * HACK: prevent sleeping while atomic warnings due to ARM signal handling
+ * disabling irqs
+ */
+static inline bool try_to_freeze_nowarn(void)
+{
+	if (likely(!freezing(current)))
+		return false;
+	return __refrigerator(false);
+}
+
+/*
+ * DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION
+ * If try_to_freeze causes a lockdep warning it means the caller may deadlock
+ */
+static inline bool try_to_freeze_unsafe(void)
 {
 /* This causes problems for ARM targets and is a known
  * problem upstream.
@@ -52,6 +68,13 @@
 	return __refrigerator(false);
 }
 
+static inline bool try_to_freeze(void)
+{
+	if (!(current->flags & PF_NOFREEZE))
+		debug_check_no_locks_held();
+	return try_to_freeze_unsafe();
+}
+
 extern bool freeze_task(struct task_struct *p);
 extern bool set_freezable(void);
 
@@ -94,8 +117,23 @@
 	try_to_freeze();
 }
 
-/*
- * Check if the task should be counted as freezable by the freezer
+/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
+static inline void freezer_count_unsafe(void)
+{
+	current->flags &= ~PF_FREEZER_SKIP;
+	smp_mb();
+	try_to_freeze_unsafe();
+}
+
+/**
+ * freezer_should_skip - whether to skip a task when determining frozen
+ *			 state is reached
+ * @p: task in quesion
+ *
+ * This function is used by freezers after establishing %true freezing() to
+ * test whether a task should be skipped when determining the target frozen
+ * state is reached.  IOW, if this function returns %true, @p is considered
+ * frozen enough.
  */
 static inline int freezer_should_skip(struct task_struct *p)
 {
@@ -103,29 +141,87 @@
 }
 
 /*
- * These macros are intended to be used whenever you want allow a task that's
+ * These functions are intended to be used whenever you want allow a task that's
  * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note
  * that neither return any clear indication of whether a freeze event happened
  * while in this function.
  */
 
 /* Like schedule(), but should not block the freezer. */
-#define freezable_schedule()						\
-({									\
-	freezer_do_not_count();						\
-	schedule();							\
-	freezer_count();						\
-})
+static inline void freezable_schedule(void)
+{
+	freezer_do_not_count();
+	schedule();
+	freezer_count();
+}
+
+/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
+static inline void freezable_schedule_unsafe(void)
+{
+	freezer_do_not_count();
+	schedule();
+	freezer_count_unsafe();
+}
+
+/*
+ * Like freezable_schedule_timeout(), but should not block the freezer.  Do not
+ * call this with locks held.
+ */
+static inline long freezable_schedule_timeout(long timeout)
+{
+	long __retval;
+	freezer_do_not_count();
+	__retval = schedule_timeout(timeout);
+	freezer_count();
+	return __retval;
+}
+
+/*
+ * Like schedule_timeout_interruptible(), but should not block the freezer.  Do not
+ * call this with locks held.
+ */
+static inline long freezable_schedule_timeout_interruptible(long timeout)
+{
+	long __retval;
+	freezer_do_not_count();
+	__retval = schedule_timeout_interruptible(timeout);
+	freezer_count();
+	return __retval;
+}
 
 /* Like schedule_timeout_killable(), but should not block the freezer. */
-#define freezable_schedule_timeout_killable(timeout)			\
-({									\
-	long __retval;							\
-	freezer_do_not_count();						\
-	__retval = schedule_timeout_killable(timeout);			\
-	freezer_count();						\
-	__retval;							\
-})
+static inline long freezable_schedule_timeout_killable(long timeout)
+{
+	long __retval;
+	freezer_do_not_count();
+	__retval = schedule_timeout_killable(timeout);
+	freezer_count();
+	return __retval;
+}
+
+/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
+static inline long freezable_schedule_timeout_killable_unsafe(long timeout)
+{
+	long __retval;
+	freezer_do_not_count();
+	__retval = schedule_timeout_killable(timeout);
+	freezer_count_unsafe();
+	return __retval;
+}
+
+/*
+ * Like schedule_hrtimeout_range(), but should not block the freezer.  Do not
+ * call this with locks held.
+ */
+static inline int freezable_schedule_hrtimeout_range(ktime_t *expires,
+		unsigned long delta, const enum hrtimer_mode mode)
+{
+	int __retval;
+	freezer_do_not_count();
+	__retval = schedule_hrtimeout_range(expires, delta, mode);
+	freezer_count();
+	return __retval;
+}
 
 /*
  * Freezer-friendly wrappers around wait_event_interruptible(),
@@ -142,33 +238,45 @@
 	__retval;							\
 })
 
+/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
+#define wait_event_freezekillable_unsafe(wq, condition)			\
+({									\
+	int __retval;							\
+	freezer_do_not_count();						\
+	__retval = wait_event_killable(wq, (condition));		\
+	freezer_count_unsafe();						\
+	__retval;							\
+})
+
 #define wait_event_freezable(wq, condition)				\
 ({									\
 	int __retval;							\
-	for (;;) {							\
-		__retval = wait_event_interruptible(wq, 		\
-				(condition) || freezing(current));	\
-		if (__retval || (condition))				\
-			break;						\
-		try_to_freeze();					\
-	}								\
+	freezer_do_not_count();						\
+	__retval = wait_event_interruptible(wq, (condition));		\
+	freezer_count();						\
 	__retval;							\
 })
 
 #define wait_event_freezable_timeout(wq, condition, timeout)		\
 ({									\
 	long __retval = timeout;					\
-	for (;;) {							\
-		__retval = wait_event_interruptible_timeout(wq,		\
-				(condition) || freezing(current),	\
-				__retval); 				\
-		if (__retval <= 0 || (condition))			\
-			break;						\
-		try_to_freeze();					\
-	}								\
+	freezer_do_not_count();						\
+	__retval = wait_event_interruptible_timeout(wq,	(condition),	\
+				__retval);				\
+	freezer_count();						\
 	__retval;							\
 })
 
+#define wait_event_freezable_exclusive(wq, condition)			\
+({									\
+	int __retval;							\
+	freezer_do_not_count();						\
+	__retval = wait_event_interruptible_exclusive(wq, condition);	\
+	freezer_count();						\
+	__retval;							\
+})
+
+
 #else /* !CONFIG_FREEZER */
 static inline bool frozen(struct task_struct *p) { return false; }
 static inline bool freezing(struct task_struct *p) { return false; }
@@ -189,18 +297,37 @@
 
 #define freezable_schedule()  schedule()
 
+#define freezable_schedule_unsafe()  schedule()
+
+#define freezable_schedule_timeout(timeout)  schedule_timeout(timeout)
+
+#define freezable_schedule_timeout_interruptible(timeout)		\
+	schedule_timeout_interruptible(timeout)
+
 #define freezable_schedule_timeout_killable(timeout)			\
 	schedule_timeout_killable(timeout)
 
+#define freezable_schedule_timeout_killable_unsafe(timeout)		\
+	schedule_timeout_killable(timeout)
+
+#define freezable_schedule_hrtimeout_range(expires, delta, mode)	\
+	schedule_hrtimeout_range(expires, delta, mode)
+
 #define wait_event_freezable(wq, condition)				\
 		wait_event_interruptible(wq, condition)
 
 #define wait_event_freezable_timeout(wq, condition, timeout)		\
 		wait_event_interruptible_timeout(wq, condition, timeout)
 
+#define wait_event_freezable_exclusive(wq, condition)			\
+		wait_event_interruptible_exclusive(wq, condition)
+
 #define wait_event_freezekillable(wq, condition)		\
 		wait_event_killable(wq, condition)
 
+#define wait_event_freezekillable_unsafe(wq, condition)			\
+		wait_event_killable(wq, condition)
+
 #endif /* !CONFIG_FREEZER */
 
 #endif	/* FREEZER_H_INCLUDED */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index fd0dc30..cc07d27 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -165,6 +165,7 @@
  * @lock:		lock protecting the base and associated clock bases
  *			and timers
  * @active_bases:	Bitfield to mark bases with active timers
+ * @clock_was_set:	Indicates that clock was set from irq context.
  * @expires_next:	absolute time of the next event which was scheduled
  *			via clock_set_next_event()
  * @hres_active:	State of high resolution mode
@@ -177,7 +178,8 @@
  */
 struct hrtimer_cpu_base {
 	raw_spinlock_t			lock;
-	unsigned long			active_bases;
+	unsigned int			active_bases;
+	unsigned int			clock_was_set;
 #ifdef CONFIG_HIGH_RES_TIMERS
 	ktime_t				expires_next;
 	int				hres_active;
@@ -286,6 +288,8 @@
 # define MONOTONIC_RES_NSEC	HIGH_RES_NSEC
 # define KTIME_MONOTONIC_RES	KTIME_HIGH_RES
 
+extern void clock_was_set_delayed(void);
+
 #else
 
 # define MONOTONIC_RES_NSEC	LOW_RES_NSEC
@@ -306,6 +310,9 @@
 {
 	return 0;
 }
+
+static inline void clock_was_set_delayed(void) { }
+
 #endif
 
 extern void clock_was_set(void);
@@ -320,6 +327,7 @@
 extern ktime_t ktime_get_real(void);
 extern ktime_t ktime_get_boottime(void);
 extern ktime_t ktime_get_monotonic_offset(void);
+extern ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot);
 
 DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
 
diff --git a/include/linux/htc_flashlight.h b/include/linux/htc_flashlight.h
new file mode 100644
index 0000000..15be786
--- /dev/null
+++ b/include/linux/htc_flashlight.h
@@ -0,0 +1,92 @@
+/*
+ * arch/arm/mach-msm/include/mach/msm_flashlight.h - The flashlight header
+ * Copyright (C) 2009  HTC Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef __HTC_FLASHLIGHT_H
+#define __HTC_FLASHLIGHT_H
+#include <linux/earlysuspend.h>
+
+#define FLASHLIGHT_NAME "flashlight"
+
+#define FLASHLIGHT_OFF   0
+#define FLASHLIGHT_TORCH 1
+#define FLASHLIGHT_FLASH 2
+#define FLASHLIGHT_NUM   3
+
+
+enum flashlight_mode_flags {
+	FL_MODE_OFF = 0,
+	FL_MODE_TORCH,
+	FL_MODE_FLASH,
+	FL_MODE_PRE_FLASH,
+	FL_MODE_TORCH_LED_A,
+	FL_MODE_TORCH_LED_B,
+	FL_MODE_TORCH_LEVEL_1,
+	FL_MODE_TORCH_LEVEL_2,
+	FL_MODE_CAMERA_EFFECT_FLASH,
+	FL_MODE_CAMERA_EFFECT_PRE_FLASH,
+	FL_MODE_FLASH_LEVEL1,
+	FL_MODE_FLASH_LEVEL2,
+	FL_MODE_FLASH_LEVEL3,
+	FL_MODE_FLASH_LEVEL4,
+	FL_MODE_FLASH_LEVEL5,
+	FL_MODE_FLASH_LEVEL6,
+	FL_MODE_FLASH_LEVEL7,
+
+};
+
+#ifdef CONFIG_FLASHLIGHT_AAT
+struct flashlight_platform_data {
+	void (*gpio_init) (void);
+	uint32_t torch;
+	uint32_t flash;
+	uint32_t flash_adj;
+	uint32_t torch_set1;
+	uint32_t torch_set2;
+	uint32_t flash_duration_ms;
+	uint8_t led_count; 
+	uint32_t chip_model;
+};
+
+enum flashlight_chip{
+	AAT1271 = 0,
+	AAT3177,
+	AAT1277,
+};
+#endif
+
+#ifdef CONFIG_FLASHLIGHT_TPS61310
+struct TPS61310_flashlight_platform_data {
+	void (*gpio_init) (void);
+	uint32_t flash_duration_ms;
+	uint8_t led_count; 
+	uint32_t tps61310_strb0;
+	uint32_t tps61310_strb1;
+	uint8_t mode_pin_suspend_state_low;
+};
+
+int aat1271_flashlight_control(int mode);
+int adp1650_flashlight_control(int mode);
+int aat3177_flashlight_control(int mode);
+int aat1277_flashlight_control(int mode);
+int tps61310_flashlight_control(int mode);
+int htc_flashlight_control(int flashlight_mode);
+#endif
+
+#undef __HTC_FLASHLIGHT_H
+#endif
diff --git a/include/linux/input.h b/include/linux/input.h
index d4cdb02..8d2912f 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -470,6 +470,9 @@
 
 #define KEY_MICMUTE		248	/* Mute / unmute the microphone */
 
+#define KEY_APP_SWITCH		249	/* key for app list */
+#define KEY_WEIBO		250	/* key for weibo */
+
 /* Code 255 is reserved for special needs of AT keyboard driver */
 
 #define BTN_MISC		0x100
@@ -803,6 +806,9 @@
 
 #define ABS_MISC		0x28
 
+#define ABS_MT_POSITION		0x2a
+#define ABS_MT_AMPLITUDE	0x2b
+
 #define ABS_MT_SLOT		0x2f	/* MT slot being modified */
 #define ABS_MT_TOUCH_MAJOR	0x30	/* Major axis of touching ellipse */
 #define ABS_MT_TOUCH_MINOR	0x31	/* Minor axis (omit if circular) */
diff --git a/include/linux/input/cy8c_cs.h b/include/linux/input/cy8c_cs.h
new file mode 100644
index 0000000..8a4558b
--- /dev/null
+++ b/include/linux/input/cy8c_cs.h
@@ -0,0 +1,82 @@
+#ifndef CY8C_CS_I2C_H
+#define CY8C_CS_I2C_H
+
+
+#include <linux/types.h>
+
+#define CYPRESS_CS_NAME 	"CY8C20224"
+#define CYPRESS_SS_NAME 	"CY8C21x34B"
+
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+#include <linux/notifier.h>
+#endif
+
+#define CS_STATUS		(uint8_t) 0x00
+
+#define CS_FW_VERSION		(uint8_t) 0x01
+#define CS_FW_CONFIG		(uint8_t) 0xAA		
+
+#define CS_IDAC_BTN_BASE	(uint8_t) 0x02
+#define CS_IDAC_BTN_PAD1	(uint8_t) 0x02
+#define CS_IDAC_BTN_PAD2        (uint8_t) 0x03
+#define CS_IDAC_BTN_PAD3        (uint8_t) 0x04
+#define CS_IDAC_BTN_PAD4        (uint8_t) 0x05
+
+#define CS_MODE			(uint8_t) 0x06
+#define CS_DTIME		(uint8_t) 0x07
+#define CS_SLEEPTIME		(uint8_t) 0x08
+#define CS_FW_CHIPID		(uint8_t) 0x0A		
+#define CS_FW_KEYCFG		(uint8_t) 0x0B		
+
+#define CS_SELECT		(uint8_t) 0x0C
+#define CS_BL_HB		(uint8_t) 0x0D
+#define CS_BL_LB		(uint8_t) 0x0E
+#define CS_RC_HB		(uint8_t) 0x0F
+#define	CS_RC_LB		(uint8_t) 0x10
+#define CS_DF_HB		(uint8_t) 0x11
+#define CS_DF_LB		(uint8_t) 0x12
+#define CS_INT_STATUS		(uint8_t) 0x13
+
+
+#define CS_CMD_BASELINE		(0x55)
+#define CS_CMD_DSLEEP		(0x02)
+#define CS_CMD_BTN1		(0xA0)
+#define CS_CMD_BTN2		(0xA1)
+#define CS_CMD_BTN3		(0xA2)
+#define CS_CMD_BTN4		(0xA3)
+
+#define CS_CHIPID		(0x36)
+#define CS_KEY_4		(0x04)
+#define CS_KEY_3		(0x03)
+
+#define CS_FUNC_PRINTRAW	(0x01)
+
+#define ENABLE_CAP_ONLY_3KEY   1        
+
+struct infor {
+	uint8_t  config;
+	uint16_t chipid;
+	uint16_t version;
+};
+
+struct cy8c_i2c_cs_platform_data {
+	struct 	infor id;
+	uint16_t gpio_rst;
+	uint16_t gpio_irq;
+	int 	(*power)(int on);
+	int 	(*reset)(void);
+	int	keycode[4];
+	void 	(*gpio_init)(void);
+	int 	func_support;
+	int     prj_info;
+};
+
+
+#if defined(CONFIG_TOUCH_KEY_FILTER)
+extern struct blocking_notifier_head touchkey_notifier_list;
+
+extern int register_notifier_by_touchkey(struct notifier_block *nb);
+extern int unregister_notifier_by_touchkey(struct notifier_block *nb);
+#endif
+
+#endif
diff --git a/include/linux/input/eeti_ts.h b/include/linux/input/eeti_ts.h
index f875b31..16625d7 100644
--- a/include/linux/input/eeti_ts.h
+++ b/include/linux/input/eeti_ts.h
@@ -2,6 +2,7 @@
 #define LINUX_INPUT_EETI_TS_H
 
 struct eeti_ts_platform_data {
+	int irq_gpio;
 	unsigned int irq_active_high;
 };
 
diff --git a/include/linux/ion.h b/include/linux/ion.h
index 7fee5ff..c56faa4 100644
--- a/include/linux/ion.h
+++ b/include/linux/ion.h
@@ -515,6 +515,13 @@
 	struct ion_handle *handle;
 };
 
+
+struct ion_allocation_data_compat {
+	size_t len;
+	size_t align;
+	unsigned int flags;
+	struct ion_handle *handle;
+};
 /**
  * struct ion_fd_data - metadata passed to/from userspace for a handle/fd pair
  * @handle:	a handle
@@ -550,6 +557,19 @@
 	unsigned int cmd;
 	unsigned long arg;
 };
+
+struct ion_flush_data {
+        struct ion_handle *handle;
+        int fd;
+        void *vaddr;
+        unsigned int offset;
+        unsigned int length;
+};
+struct ion_flag_data {
+        struct ion_handle *handle;
+        unsigned long flags;
+};
+
 #define ION_IOC_MAGIC		'I'
 
 /**
@@ -561,6 +581,9 @@
 #define ION_IOC_ALLOC		_IOWR(ION_IOC_MAGIC, 0, \
 				      struct ion_allocation_data)
 
+
+#define ION_IOC_ALLOC_COMPAT		_IOWR(ION_IOC_MAGIC, 0, \
+				      struct ion_allocation_data_compat)
 /**
  * DOC: ION_IOC_FREE - free memory
  *
@@ -597,6 +620,7 @@
  * filed set to the corresponding opaque handle.
  */
 #define ION_IOC_IMPORT		_IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
+#define ION_IOC_IMPORT_COMPAT		_IOWR(ION_IOC_MAGIC, 5, int)
 
 /**
  * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl
@@ -606,5 +630,13 @@
  */
 #define ION_IOC_CUSTOM		_IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
 
+#define ION_IOC_CLEAN_CACHES_COMPAT    _IOWR(ION_IOC_MAGIC, 7, \
+                                                struct ion_flush_data)
+#define ION_IOC_INV_CACHES_COMPAT      _IOWR(ION_IOC_MAGIC, 8, \
+                                                struct ion_flush_data)
+#define ION_IOC_CLEAN_INV_CACHES_COMPAT       _IOWR(ION_IOC_MAGIC, 9, \
+                                                struct ion_flush_data)
+#define ION_IOC_GET_FLAGS_COMPAT               _IOWR(ION_IOC_MAGIC, 10, \
+                                                struct ion_flag_data)
 
 #endif /* _LINUX_ION_H */
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 771cb35..4d22be2 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -39,7 +39,6 @@
  */
 struct irq_desc {
 	struct irq_data		irq_data;
-	struct timer_rand_state *timer_rand_state;
 	unsigned int __percpu	*kstat_irqs;
 	irq_flow_handler_t	handle_irq;
 #ifdef CONFIG_IRQ_PREFLOW_FASTEOI
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 912c30a..2ed66ef 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1091,6 +1091,7 @@
 extern int	   jbd2_journal_recover    (journal_t *journal);
 extern int	   jbd2_journal_wipe       (journal_t *, int);
 extern int	   jbd2_journal_skip_recovery	(journal_t *);
+extern void	   jbd2_journal_update_sb_errno(journal_t *);
 extern void	   jbd2_journal_update_sb_log_tail	(journal_t *, tid_t,
 				unsigned long, int);
 extern void	   __jbd2_journal_abort_hard	(journal_t *);
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h
index 26a6571..a1bdf69 100644
--- a/include/linux/kernel-page-flags.h
+++ b/include/linux/kernel-page-flags.h
@@ -32,6 +32,8 @@
 #define KPF_KSM			21
 #define KPF_THP			22
 
+#ifdef __KERNEL__
+
 /* kernel hacking assistances
  * WARNING: subject to change, never rely on them!
  */
@@ -44,4 +46,6 @@
 #define KPF_ARCH		38
 #define KPF_UNCACHED		39
 
+#endif /* __KERNEL__ */
+
 #endif /* LINUX_KERNEL_PAGE_FLAGS_H */
diff --git a/include/linux/leds-pm8xxx-htc.h b/include/linux/leds-pm8xxx-htc.h
new file mode 100644
index 0000000..ff0b72f
--- /dev/null
+++ b/include/linux/leds-pm8xxx-htc.h
@@ -0,0 +1,107 @@
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __LEDS_PM8XXX_H__
+#define __LEDS_PM8XXX_H__
+
+
+#define PM8XXX_LEDS_DEV_NAME	"pm8xxx-led"
+
+#include <linux/android_alarm.h>
+#include <linux/leds.h>
+
+enum pm8xxx_blink_type {
+	BLINK_STOP = -1,
+	BLINK_UNCHANGE = 0,
+	BLINK_64MS_PER_2SEC,
+	BLINK_64MS_ON_310MS_PER_2SEC,
+	BLINK_64MS_ON_2SEC_PER_2SEC,
+	BLINK_1SEC_PER_2SEC,
+};
+
+enum pm8xxx_leds {
+	PM8XXX_ID_GPIO24 = 0,
+	PM8XXX_ID_GPIO25,
+	PM8XXX_ID_GPIO26,
+	PM8XXX_ID_LED_KB_LIGHT,
+	PM8XXX_ID_LED_2,
+	PM8XXX_ID_LED_1,
+	PM8XXX_ID_LED_0,
+	PM8XXX_ID_FLASH_LED_0,
+	PM8XXX_ID_FLASH_LED_1,
+};
+
+enum pm8xxx_led_modes {
+	PM8XXX_LED_MODE_MANUAL = 0,
+	PM8XXX_LED_MODE_PWM1,
+	PM8XXX_LED_MODE_PWM2,
+	PM8XXX_LED_MODE_PWM3,
+	PM8XXX_LED_MODE_DTEST1,
+	PM8XXX_LED_MODE_DTEST2,
+	PM8XXX_LED_MODE_DTEST3,
+	PM8XXX_LED_MODE_DTEST4
+};
+
+int pm8xxx_led_config(enum pm8xxx_leds led_id,
+		enum pm8xxx_led_modes led_mode, int max_current);
+
+#define LED_PWM_FUNCTION	(1 << 0)
+#define LED_BLINK_FUNCTION	(1 << 1)
+#define LED_BRETH_FUNCTION	(1 << 2)
+
+struct pm8xxx_led_configure {
+	const char	*name;
+	int		flags;
+	int 		period_us;
+	int 		start_index;
+	int 		duites_size;
+	int 		duty_time_ms;
+	int 		lut_flag;
+	int 		led_sync;
+	int		out_current;
+	int		function_flags;
+	int		duties[64];
+	int		pwm_coefficient;
+	void 		(*gpio_status_switch)(bool);
+};
+
+struct pm8xxx_led_platform_data {
+	int				num_leds;
+	struct pm8xxx_led_configure	*leds;
+};
+
+struct pm8xxx_led_data {
+	struct led_classdev			cdev;
+	struct pwm_device 		*pwm_led;
+	int							  id;
+	int							bank;
+	int				  function_flags;
+	int					   period_us;
+	int 				duty_time_ms;
+	int 				 start_index;
+	int 				 duites_size;
+	int 					lut_flag;
+	int					 out_current;
+	int 				     *duties;
+	int 					led_sync;
+	int				pwm_coefficient;
+	u8			             	 reg;
+	struct device				*dev;
+	struct delayed_work		blink_delayed_work;
+	struct delayed_work 	fade_delayed_work;
+	struct work_struct 		led_work;
+	struct alarm		   led_alarm;
+	void (*gpio_status_switch)(bool);
+};
+void pm8xxx_led_current_set_for_key(int brightness_key);
+
+#endif 
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e926df7..6e887c7 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -247,6 +247,7 @@
 	ATA_HOST_SIMPLEX	= (1 << 0),	/* Host is simplex, one DMA channel per host only */
 	ATA_HOST_STARTED	= (1 << 1),	/* Host started */
 	ATA_HOST_PARALLEL_SCAN	= (1 << 2),	/* Ports on this host can be scanned in parallel */
+	ATA_HOST_IGNORE_ATA	= (1 << 3),	/* Ignore ATA devices on this host. */
 
 	/* bits 24:31 of host->flags are reserved for LLD specific flags */
 
diff --git a/include/linux/lightsensor.h b/include/linux/lightsensor.h
new file mode 100644
index 0000000..caae98c
--- /dev/null
+++ b/include/linux/lightsensor.h
@@ -0,0 +1,42 @@
+/* include/linux/lightsensor.h
+ *
+ * Copyright (C) 2009 Google, Inc.
+ * Author: Iliyan Malchev <malchev@google.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LINUX_LIGHTSENSOR_H
+#define __LINUX_LIGHTSENSOR_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#define LIGHTSENSOR_IOCTL_MAGIC 'l'
+
+#define LIGHTSENSOR_IOCTL_GET_ENABLED _IOR(LIGHTSENSOR_IOCTL_MAGIC, 1, int *)
+#define LIGHTSENSOR_IOCTL_ENABLE _IOW(LIGHTSENSOR_IOCTL_MAGIC, 2, int *)
+
+struct lightsensor_mpp_config_data {
+	uint32_t lightsensor_mpp;
+	uint32_t lightsensor_amux;
+};
+
+struct lightsensor_smd_platform_data {
+	const char      *name;
+	uint16_t        levels[10];
+	uint16_t        golden_adc;
+	uint16_t		m_voltage;
+	int             (*ls_power)(int, uint8_t);
+	struct lightsensor_mpp_config_data mpp_data;
+};
+
+#endif
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 11a966e..4d24d64 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -54,7 +54,7 @@
 
 extern int	nlmclnt_proc(struct nlm_host *host, int cmd,
 					struct file_lock *fl);
-extern int	lockd_up(void);
-extern void	lockd_down(void);
+extern int	lockd_up(struct net *net);
+extern void	lockd_down(struct net *net);
 
 #endif /* LINUX_LOCKD_BIND_H */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 36bc2f5..2243362 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -50,9 +50,7 @@
 				phys_addr_t size, phys_addr_t align, int nid);
 phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
 				   phys_addr_t size, phys_addr_t align);
-int memblock_free_reserved_regions(void);
-int memblock_reserve_reserved_regions(void);
-
+phys_addr_t get_allocated_memblock_reserved_regions_info(phys_addr_t *addr);
 void memblock_allow_resize(void);
 int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid);
 int memblock_add(phys_addr_t base, phys_addr_t size);
diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h
index 40c37216..32a1b5c 100644
--- a/include/linux/mfd/ezx-pcap.h
+++ b/include/linux/mfd/ezx-pcap.h
@@ -16,6 +16,7 @@
 struct pcap_platform_data {
 	unsigned int irq_base;
 	unsigned int config;
+	int gpio;
 	void (*init) (void *);	/* board specific init */
 	int num_subdevs;
 	struct pcap_subdev *subdevs;
diff --git a/include/linux/mfd/pm8xxx/batt-alarm.h b/include/linux/mfd/pm8xxx/batt-alarm.h
index b266f3e..8f514cd 100644
--- a/include/linux/mfd/pm8xxx/batt-alarm.h
+++ b/include/linux/mfd/pm8xxx/batt-alarm.h
@@ -162,6 +162,34 @@
  */
 int pm8xxx_batt_alarm_pwm_rate_set(int use_pwm, int clock_scaler,
 				   int clock_divider);
+
+#ifdef CONFIG_MACH_HTC
+/**
+ * pm8xxx_batt_lower_alarm_register_notifier - register notifier for
+ *					       htc_gauge
+ * @callback:	callback function to register
+ *
+ * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
+ */
+int pm8xxx_batt_lower_alarm_register_notifier(void (*callback)(int));
+
+/**
+ * pm8xxx_batt_lower_alarm_enable - enable low comparator voltage alarm *
+ * @enable:	1 = enable, 0 = disable
+ *
+ * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
+ */
+int pm8xxx_batt_lower_alarm_enable(int enable);
+
+/**
+ * pm8xxx_batt_lower_alarm_threshold_set - set the lower alarm thresholds
+ * @threshold_mV:  battery voltage threshold in millivolts
+ *      set points = 2500-5675 mV in 25 mV steps
+ *
+ * RETURNS: an appropriate -ERRNO error value on error, or zero for success.
+ */
+int pm8xxx_batt_lower_alarm_threshold_set(int threshold_mV);
+#endif /* CONFIG_MACH_HTC */
 #else
 
 static inline int
@@ -195,6 +223,15 @@
 pm8xxx_batt_alarm_pwm_rate_set(int use_pwm, int clock_scaler, int clock_divider)
 { return -ENODEV; }
 
+#ifdef CONFIG_MACH_HTC
+static inline int
+pm8xxx_batt_lower_alarm_register_notifier(void (*callback)(int))
+{ return -ENODEV; }
+
+static inline int pm8xxx_batt_lower_alarm_threshold_set(int threshold_mV)
+{ return -ENODEV; }
+#endif /* CONFIG_MACH_HTC */
+
 #endif
 
 
diff --git a/include/linux/mfd/pm8xxx/ccadc.h b/include/linux/mfd/pm8xxx/ccadc.h
index a29486f..3121998 100644
--- a/include/linux/mfd/pm8xxx/ccadc.h
+++ b/include/linux/mfd/pm8xxx/ccadc.h
@@ -76,6 +76,24 @@
  *
  */
 int pm8xxx_ccadc_get_battery_current(int *bat_current);
+
+#ifdef CONFIG_MACH_HTC
+/**
+ * pm8xxx_ccadc_dump_all - dump register contents to log
+ *
+ * RETURNS:	0
+ */
+int pm8xxx_ccadc_dump_all(void);
+
+/**
+ * pm8xxx_ccadc_get_attr_text - get registers contents as text string
+ * @buf:	The pointer to the buffer
+ * @size:	The size in bytes of the buffer
+ *
+ * RETURNS:	The length of the text string returned.
+ */
+int pm8xxx_ccadc_get_attr_text(char *buf, int size);
+#endif /* CONFIG_MACH_HTC */
 #else
 static inline s64 pm8xxx_cc_adjust_for_gain(s64 uv)
 {
@@ -88,6 +106,16 @@
 {
 	return -ENXIO;
 }
+#ifdef CONFIG_MACH_HTC
+static inline int pm8xxx_ccadc_dump_all(void)
+{
+	return -ENXIO;
+}
+static inline int pm8xxx_ccadc_get_attr_text(char *buf, int size)
+{
+	return -ENXIO;
+}
+#endif /* CONFIG_MACH_HTC */
 #endif
 
 #endif /* __PMIC8XXX_CCADC_H__ */
diff --git a/include/linux/mfd/pm8xxx/pm8921-bms-htc.h b/include/linux/mfd/pm8xxx/pm8921-bms-htc.h
new file mode 100644
index 0000000..d38ecbe
--- /dev/null
+++ b/include/linux/mfd/pm8xxx/pm8921-bms-htc.h
@@ -0,0 +1,186 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __PM8XXX_BMS_H
+#define __PM8XXX_BMS_H
+
+#include <linux/errno.h>
+
+#define PM8921_BMS_DEV_NAME	"pm8921-bms"
+
+#define FCC_CC_COLS		5
+#define FCC_TEMP_COLS		8
+
+#define PC_CC_ROWS             29
+#define PC_CC_COLS             13
+
+#define PC_TEMP_ROWS		29
+#define PC_TEMP_COLS		8
+
+#define MAX_SINGLE_LUT_COLS	20
+
+struct single_row_lut {
+	int x[MAX_SINGLE_LUT_COLS];
+	int y[MAX_SINGLE_LUT_COLS];
+	int cols;
+};
+
+struct sf_lut {
+	int rows;
+	int cols;
+	int row_entries[PC_CC_COLS];
+	int percent[PC_CC_ROWS];
+	int sf[PC_CC_ROWS][PC_CC_COLS];
+};
+
+struct pc_temp_ocv_lut {
+	int rows;
+	int cols;
+	int temp[PC_TEMP_COLS];
+	int percent[PC_TEMP_ROWS];
+	int ocv[PC_TEMP_ROWS][PC_TEMP_COLS];
+};
+
+struct pm8921_bms_battery_data {
+	unsigned int		fcc;
+	struct single_row_lut	*fcc_temp_lut;
+	struct single_row_lut	*fcc_sf_lut;
+	struct pc_temp_ocv_lut	*pc_temp_ocv_lut;
+	struct sf_lut		*pc_sf_lut;
+	struct sf_lut		*rbatt_sf_lut;
+	int			default_rbatt_mohm;
+	int			delta_rbatt_mohm;
+};
+
+struct pm8xxx_bms_core_data {
+	unsigned int	batt_temp_channel;
+	unsigned int	vbat_channel;
+	unsigned int	ref625mv_channel;
+	unsigned int	ref1p25v_channel;
+	unsigned int	batt_id_channel;
+};
+
+enum battery_type {
+	BATT_UNKNOWN = 0,
+	BATT_PALLADIUM,
+	BATT_DESAY,
+};
+
+struct pm8921_bms_platform_data {
+	struct pm8xxx_bms_core_data	bms_cdata;
+	enum battery_type		battery_type;
+	unsigned int			r_sense;
+	unsigned int			i_test;
+	unsigned int			v_failure;
+	unsigned int			max_voltage_uv;
+	unsigned int			rconn_mohm;
+	int				enable_fcc_learning;
+};
+
+#if defined(CONFIG_PM8921_BMS) || defined(CONFIG_PM8921_BMS_MODULE)
+extern struct pm8921_bms_battery_data  palladium_1500_data;
+extern struct pm8921_bms_battery_data  desay_5200_data;
+int pm8921_bms_get_vsense_avg(int *result);
+
+int pm8921_bms_get_battery_current(int *result);
+
+int pm8921_bms_get_percent_charge(void);
+
+int pm8921_bms_get_fcc(void);
+
+int pm8921_bms_charging_began(void);
+void pm8921_bms_charging_end(int is_battery_full);
+
+void pm8921_bms_calibrate_hkadc(void);
+int pm8921_bms_stop_ocv_updates(void);
+int pm8921_bms_start_ocv_updates(void);
+int pm8921_bms_get_simultaneous_battery_voltage_and_current(int *ibat_ua,
+								int *vbat_uv);
+int pm8921_bms_get_rbatt(void);
+void pm8921_bms_invalidate_shutdown_soc(void);
+int pm8921_bms_dump_all(void);
+#ifdef CONFIG_HTC_BATT_8960
+int pm8921_bms_get_batt_current(int *result);
+
+int pm8921_bms_get_batt_soc(int *result);
+int pm8921_bms_get_batt_cc(int *result);
+int pm8921_bms_get_attr_text(char *buf, int size);
+#endif 
+#else
+static inline int pm8921_bms_get_vsense_avg(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_bms_get_battery_current(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_bms_get_percent_charge(void)
+{
+	return -ENXIO;
+}
+static inline int pm8921_bms_get_fcc(void)
+{
+	return -ENXIO;
+}
+static inline void pm8921_bms_charging_began(void)
+{
+}
+static inline void pm8921_bms_charging_end(int is_battery_full)
+{
+}
+static inline void pm8921_bms_calibrate_hkadc(void)
+{
+}
+static inline void pm8921_bms_stop_ocv_updates(void)
+{
+}
+static inline void pm8921_bms_start_ocv_updates(void)
+{
+}
+static inline int pm8921_bms_get_simultaneous_battery_voltage_and_current(
+						int *ibat_ua, int *vbat_uv)
+{
+	return -ENXIO;
+}
+static inline int pm8921_bms_get_rbatt(void)
+{
+	return -EINVAL;
+}
+static inline void pm8921_bms_invalidate_shutdown_soc(void)
+{
+}
+static inline int pm8921_bms_dump_all(void)
+{
+	return -ENXIO;
+}
+#ifdef CONFIG_HTC_BATT_8960
+static inline int pm8921_bms_get_batt_current(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_bms_get_batt_soc(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_bms_get_batt_cc(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_bms_get_attr_text(char *buf, int size)
+{
+	return 0;
+}
+#endif 
+#endif
+
+#endif
diff --git a/include/linux/mfd/pm8xxx/pm8921-charger-htc.h b/include/linux/mfd/pm8xxx/pm8921-charger-htc.h
new file mode 100644
index 0000000..f4151cb
--- /dev/null
+++ b/include/linux/mfd/pm8xxx/pm8921-charger-htc.h
@@ -0,0 +1,354 @@
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __PM8XXX_CHARGER_H
+#define __PM8XXX_CHARGER_H
+
+#include <linux/errno.h>
+#include <linux/power_supply.h>
+#ifdef CONFIG_HTC_BATT_8960
+#include <mach/htc_charger.h>
+#endif
+
+#define PM8921_CHARGER_DEV_NAME	"pm8921-charger"
+
+struct pm8xxx_charger_core_data {
+	unsigned int	vbat_channel;
+	unsigned int	batt_temp_channel;
+	unsigned int	batt_id_channel;
+};
+
+enum pm8921_chg_cold_thr {
+	PM_SMBC_BATT_TEMP_COLD_THR__LOW,
+	PM_SMBC_BATT_TEMP_COLD_THR__HIGH
+};
+
+enum pm8921_chg_hot_thr	{
+	PM_SMBC_BATT_TEMP_HOT_THR__LOW,
+	PM_SMBC_BATT_TEMP_HOT_THR__HIGH
+};
+
+enum pm8921_usb_ov_threshold {
+	PM_USB_OV_5P5V,
+	PM_USB_OV_6V,
+	PM_USB_OV_6P5V,
+	PM_USB_OV_7V,
+};
+
+enum pm8921_usb_debounce_time {
+	PM_USB_BYPASS_DEBOUNCER,
+	PM_USB_DEBOUNCE_20P5MS,
+	PM_USB_DEBOUNCE_40P5MS,
+	PM_USB_DEBOUNCE_80P5MS,
+};
+
+enum pm8921_chg_led_src_config {
+	LED_SRC_GND,
+	LED_SRC_VPH_PWR,
+	LED_SRC_5V,
+	LED_SRC_MIN_VPH_5V,
+	LED_SRC_BYPASS,
+};
+
+
+struct ext_usb_chg_pm8921 {
+	const char	*name;
+	void		*ctx;
+	int		(*start_charging) (void *ctx);
+	int		(*stop_charging) (void *ctx);
+	bool		(*is_trickle) (void *ctx);
+	struct htc_charger	*ichg;
+};
+
+
+struct pm8921_charger_platform_data {
+	struct pm8xxx_charger_core_data	charger_cdata;
+	unsigned int			safety_time;
+	unsigned int			ttrkl_time;
+	unsigned int			update_time;
+	unsigned int			max_voltage;
+	unsigned int			min_voltage;
+	unsigned int			resume_voltage_delta;
+	unsigned int			term_current;
+	int				cool_temp;
+	int				warm_temp;
+	unsigned int			temp_check_period;
+	unsigned int			max_bat_chg_current;
+	unsigned int			cool_bat_chg_current;
+	unsigned int			warm_bat_chg_current;
+	unsigned int			cool_bat_voltage;
+	unsigned int			warm_bat_voltage;
+	unsigned int			(*get_batt_capacity_percent) (void);
+	int64_t				batt_id_min;
+	int64_t				batt_id_max;
+	bool				keep_btm_on_suspend;
+	bool				dc_unplug_check;
+	int				trkl_voltage;
+	int				weak_voltage;
+	int				trkl_current;
+	int				weak_current;
+	int				vin_min;
+	int				*thermal_mitigation;
+	int				thermal_levels;
+	int				mbat_in_gpio;
+	int				is_embeded_batt;
+	enum pm8921_chg_cold_thr	cold_thr;
+	enum pm8921_chg_hot_thr		hot_thr;
+	int				rconn_mohm;
+	enum pm8921_chg_led_src_config	led_src_config;
+	struct ext_usb_chg_pm8921	*ext_usb;
+};
+
+enum pm8921_charger_source {
+	PM8921_CHG_SRC_NONE,
+	PM8921_CHG_SRC_USB,
+	PM8921_CHG_SRC_DC,
+};
+
+struct ext_chg_pm8921 {
+	const char	*name;
+	void		*ctx;
+	int		(*start_charging) (void *ctx);
+	int		(*stop_charging) (void *ctx);
+	bool		(*is_trickle) (void *ctx);
+};
+
+#ifdef CONFIG_HTC_BATT_8960
+struct pm8921_charger_batt_param {
+	unsigned int max_voltage;
+	unsigned int cool_bat_voltage;
+	unsigned int warm_bat_voltage;
+};
+#endif 
+
+#if defined(CONFIG_PM8921_CHARGER) || defined(CONFIG_PM8921_CHARGER_MODULE)
+void pm8921_charger_vbus_draw(unsigned int mA);
+int pm8921_charger_register_vbus_sn(void (*callback)(int));
+void pm8921_charger_unregister_vbus_sn(void (*callback)(int));
+int pm8921_charger_enable(bool enable);
+
+int pm8921_is_usb_chg_plugged_in(void);
+
+int pm8921_is_dc_chg_plugged_in(void);
+
+int pm8921_is_pwr_src_plugged_in(void);
+
+int pm8921_is_battery_present(void);
+
+int pm8921_set_max_battery_charge_current(int ma);
+
+int pm8921_disable_input_current_limit(bool disable);
+
+
+int pm8921_set_usb_power_supply_type(enum power_supply_type type);
+
+int pm8921_disable_source_current(bool disable);
+
+int pm8921_regulate_input_voltage(int voltage);
+bool pm8921_is_battery_charging(int *source);
+
+int pm8921_batt_temperature(void);
+int register_external_dc_charger(struct ext_chg_pm8921 *ext);
+
+void unregister_external_dc_charger(struct ext_chg_pm8921 *ext);
+
+int pm8921_usb_ovp_set_threshold(enum pm8921_usb_ov_threshold ov);
+
+int pm8921_usb_ovp_set_hystersis(enum pm8921_usb_debounce_time ms);
+
+int pm8921_usb_ovp_disable(int disable);
+
+#ifdef CONFIG_HTC_BATT_8960
+int pm8921_get_batt_voltage(int *result);
+
+int pm8921_get_batt_temperature(int *result);
+
+int pm8921_get_batt_id(int *result);
+
+int pm8921_is_batt_temperature_fault(int *result);
+
+int pm8921_is_batt_temp_fault_disable_chg(int *result);
+
+int pm8921_is_batt_full(int *result);
+
+int pm8921_get_charging_source(int *result);
+
+int pm8921_get_charging_enabled(int *result);
+
+int pm8921_pwrsrc_enable(bool enable);
+
+int pm8921_set_pwrsrc_and_charger_enable(enum htc_power_source_type src,
+		bool chg_enable, bool pwrsrc_enable);
+
+int pm8921_limit_charge_enable(bool enable);
+
+int pm8921_is_charger_ovp(int *result);
+
+int pm8921_dump_all(void);
+
+int pm8921_charger_get_attr_text(char *buf, int size);
+
+int pm8921_charger_get_attr_text_with_ext_charger(char *buf, int size);
+
+int pm8921_gauge_get_attr_text(char *buf, int size);
+#endif 
+void pm8921_chg_disable_usbin_valid_irq(void);
+void pm8921_chg_enable_usbin_valid_irq(void);
+#else
+static inline void pm8921_charger_vbus_draw(unsigned int mA)
+{
+}
+static inline int pm8921_charger_register_vbus_sn(void (*callback)(int))
+{
+	return -ENXIO;
+}
+static inline void pm8921_charger_unregister_vbus_sn(void (*callback)(int))
+{
+}
+static inline int pm8921_charger_enable(bool enable)
+{
+	return -ENXIO;
+}
+static inline int pm8921_is_usb_chg_plugged_in(void)
+{
+	return -ENXIO;
+}
+static inline int pm8921_is_dc_chg_plugged_in(void)
+{
+	return -ENXIO;
+}
+static inline int pm8921_is_pwr_src_plugged_in(void)
+{
+	return -ENXIO;
+}
+static inline int pm8921_is_battery_present(void)
+{
+	return -ENXIO;
+}
+static inline int pm8921_disable_input_current_limit(bool disable)
+{
+	return -ENXIO;
+}
+static inline int pm8921_set_usb_power_supply_type(enum power_supply_type type)
+{
+	return -ENXIO;
+}
+static inline int pm8921_set_max_battery_charge_current(int ma)
+{
+	return -ENXIO;
+}
+static inline int pm8921_disable_source_current(bool disable)
+{
+	return -ENXIO;
+}
+static inline int pm8921_regulate_input_voltage(int voltage)
+{
+	return -ENXIO;
+}
+static inline bool pm8921_is_battery_charging(int *source)
+{
+	*source = PM8921_CHG_SRC_NONE;
+	return 0;
+}
+static inline int pm8921_batt_temperature(void)
+{
+	return -ENXIO;
+}
+static inline int register_external_dc_charger(struct ext_chg_pm8921 *ext)
+{
+	pr_err("%s.not implemented.\n", __func__);
+	return -ENODEV;
+}
+static inline void unregister_external_dc_charger(struct ext_chg_pm8921 *ext)
+{
+	pr_err("%s.not implemented.\n", __func__);
+}
+static inline int pm8921_usb_ovp_set_threshold(enum pm8921_usb_ov_threshold ov)
+{
+	return -ENXIO;
+}
+static inline int pm8921_usb_ovp_set_hystersis(enum pm8921_usb_debounce_time ms)
+{
+	return -ENXIO;
+}
+static inline int pm8921_usb_ovp_disable(int disable)
+{
+	return -ENXIO;
+}
+#ifdef CONFIG_HTC_BATT_8960
+static inline int pm8921_get_batt_voltage(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_get_batt_temperature(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_get_batt_id(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_is_batt_temperature_fault(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_is_batt_temp_fault_disable_chg(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_is_batt_full(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_get_charging_source(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_get_charging_enabled(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_pwrsrc_enable(bool enable)
+{
+	return -ENXIO;
+}
+static inline int pm8921_set_pwrsrc_and_charger_enable(enum htc_power_source_type src,
+		bool chg_enable, bool pwrsrc_enable)
+{
+	return -ENXIO;
+}
+static inline int pm8921_limit_charge_enable(bool enable)
+{
+	return -ENXIO;
+}
+static inline int pm8921_is_charger_ovp(int *result)
+{
+	return -ENXIO;
+}
+static inline int pm8921_charger_get_attr_text(char *buf, int size)
+{
+	return -ENXIO;
+}
+static inline int pm8921_gauge_get_attr_text(char *buf, int size)
+{
+	return -ENXIO;
+}
+#endif 
+static inline void pm8921_chg_disable_usbin_valid_irq(void)
+{
+}
+static inline void pm8921_chg_enable_usbin_valid_irq(void)
+{
+}
+#endif
+
+#endif
diff --git a/include/linux/mfd/pm8xxx/pm8921.h b/include/linux/mfd/pm8xxx/pm8921.h
index aabbb21..d9710ca 100644
--- a/include/linux/mfd/pm8xxx/pm8921.h
+++ b/include/linux/mfd/pm8xxx/pm8921.h
@@ -29,10 +29,16 @@
 #include <linux/input/pmic8xxx-pwrkey.h>
 #include <linux/input/pmic8xxx-keypad.h>
 #include <linux/regulator/pm8xxx-regulator.h>
-#include <linux/mfd/pm8xxx/pm8921-charger.h>
 #include <linux/mfd/pm8xxx/pm8xxx-adc.h>
+#ifdef CONFIG_HTC_BATT_8960
+#include <linux/mfd/pm8xxx/pm8921-charger-htc.h>
+#include <linux/mfd/pm8xxx/pm8921-bms-htc.h>
+#include <linux/leds-pm8xxx-htc.h>
+#else
+#include <linux/mfd/pm8xxx/pm8921-charger.h>
 #include <linux/mfd/pm8xxx/pm8921-bms.h>
 #include <linux/leds-pm8xxx.h>
+#endif
 #include <linux/mfd/pm8xxx/vibrator.h>
 #include <linux/mfd/pm8xxx/ccadc.h>
 
diff --git a/include/linux/mfd/pm8xxx/pm8xxx-adc.h b/include/linux/mfd/pm8xxx/pm8xxx-adc.h
index f40633a..ba6e714 100644
--- a/include/linux/mfd/pm8xxx/pm8xxx-adc.h
+++ b/include/linux/mfd/pm8xxx/pm8xxx-adc.h
@@ -104,12 +104,18 @@
 #define PM8XXX_CHANNEL_MPP_SCALE1_IDX	20
 #define PM8XXX_CHANNEL_MPP_SCALE3_IDX	40
 
+#define PM8XXX_AMUX_MPP_1	0x1
+#define PM8XXX_AMUX_MPP_2	0x2
 #define PM8XXX_AMUX_MPP_3	0x3
 #define PM8XXX_AMUX_MPP_4	0x4
 #define PM8XXX_AMUX_MPP_5	0x5
 #define PM8XXX_AMUX_MPP_6	0x6
 #define PM8XXX_AMUX_MPP_7	0x7
 #define PM8XXX_AMUX_MPP_8	0x8
+#define PM8XXX_AMUX_MPP_9	0x9
+#define PM8XXX_AMUX_MPP_10	0xA
+#define PM8XXX_AMUX_MPP_11	0xB
+#define PM8XXX_AMUX_MPP_12	0xC
 
 #define PM8XXX_ADC_DEV_NAME	"pm8xxx-adc"
 
@@ -508,6 +514,9 @@
 	struct pm8xxx_adc_amux		*adc_channel;
 	uint32_t			adc_num_board_channel;
 	uint32_t			adc_mpp_base;
+#ifdef CONFIG_MACH_HTC
+	void				(*pm8xxx_adc_device_register)(void);
+#endif
 };
 
 /* Public API */
@@ -584,6 +593,20 @@
  *			events are triggered.
  */
 uint32_t pm8xxx_adc_btm_configure(struct pm8xxx_adc_arb_btm_param *);
+
+#ifdef CONFIG_MACH_HTC
+/**
+ * pm8xxx_adc_btm_is_cool() - Get btm battery cool status
+ * @param: none.
+ */
+int pm8xxx_adc_btm_is_cool(void);
+
+/**
+ * pm8xxx_adc_btm_is_warm() - Get btm battery warm status
+ * @param: none.
+ */
+int pm8xxx_adc_btm_is_warm(void);
+#endif /* CONFIG_MACH_HTC */
 #else
 static inline uint32_t pm8xxx_adc_read(uint32_t channel,
 				struct pm8xxx_adc_chan_result *result)
@@ -599,6 +622,12 @@
 static inline uint32_t pm8xxx_adc_btm_configure(
 		struct pm8xxx_adc_arb_btm_param *param)
 { return -ENXIO; }
+#ifdef CONFIG_MACH_HTC
+static inline int pm8xxx_adc_btm_is_cool(void)
+{ return -ENXIO; }
+static inline int pm8xxx_adc_btm_is_warm(void)
+{ return -ENXIO; }
+#endif /* CONFIG_MACH_HTC */
 #endif
 
 #endif /* PM8XXX_ADC_H */
diff --git a/include/linux/mfd/pm8xxx/pm8xxx-vibrator-pwm.h b/include/linux/mfd/pm8xxx/pm8xxx-vibrator-pwm.h
new file mode 100644
index 0000000..e83a40c
--- /dev/null
+++ b/include/linux/mfd/pm8xxx/pm8xxx-vibrator-pwm.h
@@ -0,0 +1,38 @@
+/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+ *
+ *This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __PMIC8XXX_VIBRATOR_PWM_H__
+#define __PMIC8XXX_VIBRATOR_PWM_H__
+
+
+#define PM8XXX_VIBRATOR_PWM_DEV_NAME "pm8xxx-vib-pwm"
+struct pm8xxx_vibrator_pwm_platform_data {
+	int initial_vibrate_ms;
+	int max_timeout_ms;
+	int duty_us;
+	int PERIOD_US;
+	int bank;
+	int ena_gpio;
+	int vdd_gpio;
+	int pwm_gpio;
+	int (*set_vdd_power)(int en);
+};
+enum amp_state {
+	DISABLE_AMP,
+	ENABLE_AMP,
+};
+enum vdd_state {
+	DISABLE_VDD,
+	ENABLE_VDD,
+};
+#endif 
+
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ddfb7c5..daaff44 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1599,6 +1599,7 @@
 enum mf_flags {
 	MF_COUNT_INCREASED = 1 << 0,
 	MF_ACTION_REQUIRED = 1 << 1,
+	MF_MUST_KILL = 1 << 2,
 };
 extern int memory_failure(unsigned long pfn, int trapno, int flags);
 extern void memory_failure_queue(unsigned long pfn, int trapno, int flags);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 3cc3062..b35752f 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -56,8 +56,18 @@
 		};
 
 		union {
+#if defined(CONFIG_HAVE_CMPXCHG_DOUBLE) && \
+	defined(CONFIG_HAVE_ALIGNED_STRUCT_PAGE)
 			/* Used for cmpxchg_double in slub */
 			unsigned long counters;
+#else
+			/*
+			 * Keep _count separate from slub cmpxchg_double data.
+			 * As the rest of the double word is protected by
+			 * slab_lock but _count is not.
+			 */
+			unsigned counters;
+#endif
 
 			struct {
 
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index d3141ac..f6b5772 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -707,7 +707,7 @@
 					     range, including holes */
 	int node_id;
 	wait_queue_head_t kswapd_wait;
-	struct task_struct *kswapd;
+	struct task_struct *kswapd;	/* Protected by lock_memory_hotplug() */
 	int kswapd_max_order;
 	enum zone_type classzone_idx;
 } pg_data_t;
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index ea36486..944bc18 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -128,7 +128,7 @@
  * The ops can have NULL set or get functions.
  */
 #define module_param_cb(name, ops, arg, perm)				      \
-	__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, 0)
+	__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1)
 
 /**
  * <level>_param_cb - general callback for a module/cmdline parameter
@@ -192,7 +192,7 @@
 		 { (void *)set, (void *)get };				\
 	__module_param_call(MODULE_PARAM_PREFIX,			\
 			    name, &__param_ops_##name, arg,		\
-			    (perm) + sizeof(__check_old_set_param(set))*0, 0)
+			    (perm) + sizeof(__check_old_set_param(set))*0, -1)
 
 /* We don't get oldget: it's often a new-style param_get_uint, etc. */
 static inline int
@@ -272,7 +272,7 @@
  */
 #define core_param(name, var, type, perm)				\
 	param_check_##type(name, &(var));				\
-	__module_param_call("", name, &param_ops_##type, &var, perm, 0)
+	__module_param_call("", name, &param_ops_##type, &var, perm, -1)
 #endif /* !MODULE */
 
 /**
@@ -290,7 +290,7 @@
 		= { len, string };					\
 	__module_param_call(MODULE_PARAM_PREFIX, name,			\
 			    &param_ops_string,				\
-			    .str = &__param_string_##name, perm, 0);	\
+			    .str = &__param_string_##name, perm, -1);	\
 	__MODULE_PARM_TYPE(name, "string")
 
 /**
@@ -431,7 +431,7 @@
 	__module_param_call(MODULE_PARAM_PREFIX, name,			\
 			    &param_array_ops,				\
 			    .arr = &__param_arr_##name,			\
-			    perm, 0);					\
+			    perm, -1);					\
 	__MODULE_PARM_TYPE(name, "array of " #type)
 
 extern struct kernel_param_ops param_array_ops;
diff --git a/include/linux/mpu.h b/include/linux/mpu.h
new file mode 100644
index 0000000..0a2ec64
--- /dev/null
+++ b/include/linux/mpu.h
@@ -0,0 +1,391 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+#ifndef __MPU_H_
+#define __MPU_H_
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#endif
+
+#ifdef M_HW
+#include "mpu6000.h"
+#else
+#include "mpu3050.h"
+#endif
+
+#define GYRO_NUM_AXES               (3)
+#define ACCEL_NUM_AXES              (3)
+#define COMPASS_NUM_AXES            (3)
+
+#define MPU_SET_MPU_CONFIG          (0x00)
+#define MPU_SET_INT_CONFIG          (0x01)
+#define MPU_SET_EXT_SYNC            (0x02)
+#define MPU_SET_FULL_SCALE          (0x03)
+#define MPU_SET_LPF                 (0x04)
+#define MPU_SET_CLK_SRC             (0x05)
+#define MPU_SET_DIVIDER             (0x06)
+#define MPU_SET_LEVEL_SHIFTER       (0x07)
+#define MPU_SET_DMP_ENABLE          (0x08)
+#define MPU_SET_FIFO_ENABLE         (0x09)
+#define MPU_SET_DMP_CFG1            (0x0a)
+#define MPU_SET_DMP_CFG2            (0x0b)
+#define MPU_SET_OFFSET_TC           (0x0c)
+#define MPU_SET_RAM                 (0x0d)
+
+#define MPU_SET_PLATFORM_DATA       (0x0e)
+
+#define MPU_GET_MPU_CONFIG          (0x80)
+#define MPU_GET_INT_CONFIG          (0x81)
+#define MPU_GET_EXT_SYNC            (0x82)
+#define MPU_GET_FULL_SCALE          (0x83)
+#define MPU_GET_LPF                 (0x84)
+#define MPU_GET_CLK_SRC             (0x85)
+#define MPU_GET_DIVIDER             (0x86)
+#define MPU_GET_LEVEL_SHIFTER       (0x87)
+#define MPU_GET_DMP_ENABLE          (0x88)
+#define MPU_GET_FIFO_ENABLE         (0x89)
+#define MPU_GET_DMP_CFG1            (0x8a)
+#define MPU_GET_DMP_CFG2            (0x8b)
+#define MPU_GET_OFFSET_TC           (0x8c)
+#define MPU_GET_RAM                 (0x8d)
+
+#define MPU_READ_REGISTER           (0x40)
+#define MPU_WRITE_REGISTER          (0x41)
+#define MPU_READ_MEMORY             (0x42)
+#define MPU_WRITE_MEMORY            (0x43)
+
+#define MPU_SUSPEND                 (0x44)
+#define MPU_RESUME                  (0x45)
+#define MPU_READ_COMPASS            (0x46)
+#define MPU_READ_ACCEL              (0x47)
+#define MPU_READ_PRESSURE           (0x48)
+
+#define MPU_CONFIG_ACCEL            (0x20)
+#define MPU_CONFIG_COMPASS          (0x21)
+#define MPU_CONFIG_PRESSURE         (0x22)
+
+#define MPU_GET_CONFIG_ACCEL        (0x28)
+#define MPU_GET_CONFIG_COMPASS      (0x29)
+#define MPU_GET_CONFIG_PRESSURE     (0x2a)
+
+#define HTC_READ_CAL_DATA
+#ifdef HTC_READ_CAL_DATA
+#define MPU_READ_CAL_DATA           (0xef)
+extern unsigned char gyro_gsensor_kvalue[37];
+#endif
+
+struct mpu_read_write {
+	unsigned short address;
+	unsigned short length;
+	unsigned char *data;
+};
+
+struct mpuirq_data {
+	int interruptcount;
+	unsigned long long irqtime;
+	int data_type;
+	int data_size;
+	void *data;
+};
+enum ext_slave_config_key {
+	MPU_SLAVE_CONFIG_ODR_SUSPEND,
+	MPU_SLAVE_CONFIG_ODR_RESUME,
+	MPU_SLAVE_CONFIG_FSR_SUSPEND,
+	MPU_SLAVE_CONFIG_FSR_RESUME,
+	MPU_SLAVE_CONFIG_MOT_THS,
+	MPU_SLAVE_CONFIG_NMOT_THS,
+	MPU_SLAVE_CONFIG_MOT_DUR,
+	MPU_SLAVE_CONFIG_NMOT_DUR,
+	MPU_SLAVE_CONFIG_IRQ_SUSPEND,
+	MPU_SLAVE_CONFIG_IRQ_RESUME,
+	MPU_SLAVE_WRITE_REGISTERS,
+	MPU_SLAVE_READ_REGISTERS,
+	MPU_SLAVE_CONFIG_NUM_CONFIG_KEYS,
+};
+
+enum ext_slave_config_irq_type {
+	MPU_SLAVE_IRQ_TYPE_NONE,
+	MPU_SLAVE_IRQ_TYPE_MOTION,
+	MPU_SLAVE_IRQ_TYPE_DATA_READY,
+};
+
+struct ext_slave_config {
+	int key;
+	int len;
+	int apply;
+	void *data;
+};
+
+enum ext_slave_type {
+	EXT_SLAVE_TYPE_GYROSCOPE,
+	EXT_SLAVE_TYPE_ACCELEROMETER,
+	EXT_SLAVE_TYPE_COMPASS,
+	EXT_SLAVE_TYPE_PRESSURE,
+	
+};
+
+enum ext_slave_id {
+	ID_INVALID = 0,
+
+	ACCEL_ID_LIS331,
+	ACCEL_ID_LSM303,
+	ACCEL_ID_KXSD9,
+	ACCEL_ID_KXTF9,
+	ACCEL_ID_BMA150,
+	ACCEL_ID_BMA222,
+	ACCEL_ID_ADI346,
+	ACCEL_ID_MMA8450,
+	ACCEL_ID_MMA845X,
+	ACCEL_ID_MPU6000,
+    ACCEL_ID_LIS3DH,
+
+	COMPASS_ID_AKM,
+	COMPASS_ID_AKM8963,
+	COMPASS_ID_AMI30X,
+	COMPASS_ID_YAS529,
+	COMPASS_ID_HMC5883,
+	COMPASS_ID_LSM303,
+	COMPASS_ID_MMC314X,
+	COMPASS_ID_HSCDTD002B,
+	COMPASS_ID_HSCDTD004A,
+
+	PRESSURE_ID_BMA085,
+	ACCEL_ID_BMA250,
+};
+
+enum ext_slave_endian {
+	EXT_SLAVE_BIG_ENDIAN,
+	EXT_SLAVE_LITTLE_ENDIAN,
+	EXT_SLAVE_FS8_BIG_ENDIAN,
+	EXT_SLAVE_FS16_BIG_ENDIAN,
+};
+
+enum ext_slave_bus {
+	EXT_SLAVE_BUS_INVALID = -1,
+	EXT_SLAVE_BUS_PRIMARY = 0,
+	EXT_SLAVE_BUS_SECONDARY = 1
+};
+
+
+struct ext_slave_platform_data {
+	struct ext_slave_descr *(*get_slave_descr) (void);
+	int irq;
+	int adapt_num;
+	int bus;
+	unsigned char address;
+	signed char orientation[9];
+	void *irq_data;
+	void *private_data;
+};
+
+
+struct tFixPntRange {
+	long mantissa;
+	long fraction;
+};
+
+struct ext_slave_descr {
+	int (*init) (void *mlsl_handle,
+		     struct ext_slave_descr *slave,
+		     struct ext_slave_platform_data *pdata);
+	int (*exit) (void *mlsl_handle,
+		     struct ext_slave_descr *slave,
+		     struct ext_slave_platform_data *pdata);
+	int (*suspend) (void *mlsl_handle,
+			struct ext_slave_descr *slave,
+			struct ext_slave_platform_data *pdata);
+	int (*resume) (void *mlsl_handle,
+		       struct ext_slave_descr *slave,
+		       struct ext_slave_platform_data *pdata);
+	int (*read) (void *mlsl_handle,
+		     struct ext_slave_descr *slave,
+		     struct ext_slave_platform_data *pdata,
+		     unsigned char *data);
+	int (*config) (void *mlsl_handle,
+		       struct ext_slave_descr *slave,
+		       struct ext_slave_platform_data *pdata,
+		       struct ext_slave_config *config);
+	int (*get_config) (void *mlsl_handle,
+			   struct ext_slave_descr *slave,
+			   struct ext_slave_platform_data *pdata,
+			   struct ext_slave_config *config);
+
+	char *name;
+	unsigned char type;
+	unsigned char id;
+	unsigned char reg;
+	unsigned int len;
+	unsigned char endian;
+	struct tFixPntRange range;
+};
+
+struct mpu3050_platform_data {
+	unsigned char int_config;
+	signed char orientation[MPU_NUM_AXES * MPU_NUM_AXES];
+	unsigned char level_shifter;
+	struct ext_slave_platform_data accel;
+	struct ext_slave_platform_data compass;
+	struct ext_slave_platform_data pressure;
+	int (*g_sensors_reset)(void);
+	int (*power_LPM)(int on);
+};
+
+
+#define get_accel_slave_descr NULL
+
+#ifdef CONFIG_MPU_SENSORS_ADXL346	
+struct ext_slave_descr *adxl346_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr adxl346_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_BMA150	
+struct ext_slave_descr *bma150_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr bma150_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_BMA250	
+struct ext_slave_descr *bma250_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr bma250_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_BMA222	
+struct ext_slave_descr *bma222_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr bma222_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_KXSD9	
+struct ext_slave_descr *kxsd9_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr kxsd9_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_KXTF9	
+struct ext_slave_descr *kxtf9_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr kxtf9_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_LIS331DLH	
+struct ext_slave_descr *lis331dlh_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr lis331dlh_get_slave_descr
+#endif
+
+
+#ifdef CONFIG_MPU_SENSORS_LIS3DH	
+struct ext_slave_descr *lis3dh_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr lis3dh_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_LSM303DLHA	
+struct ext_slave_descr *lsm303dlha_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr lsm303dlha_get_slave_descr
+#endif
+
+#if defined(CONFIG_MPU_SENSORS_MPU6000) || \
+    defined(CONFIG_MPU_SENSORS_MPU6000_MODULE)
+struct ext_slave_descr *mantis_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr mantis_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_MMA8450	
+struct ext_slave_descr *mma8450_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr mma8450_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_MMA845X	
+struct ext_slave_descr *mma845x_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr mma845x_get_slave_descr
+#endif
+
+
+#define get_compass_slave_descr NULL
+
+#ifdef CONFIG_MPU_SENSORS_AK8975	
+struct ext_slave_descr *ak8975_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr ak8975_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_AK8963	
+struct ext_slave_descr *ak8963_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr ak8963_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_AMI30X	
+struct ext_slave_descr *ami30x_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr ami30x_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_HMC5883	
+struct ext_slave_descr *hmc5883_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr hmc5883_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_MMC314X	
+struct ext_slave_descr *mmc314x_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr mmc314x_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_LSM303DLHM	
+struct ext_slave_descr *lsm303dlhm_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr lsm303dlhm_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_YAS529	
+struct ext_slave_descr *yas529_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr yas529_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_HSCDTD002B	
+struct ext_slave_descr *hscdtd002b_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr hscdtd002b_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_HSCDTD004A	
+struct ext_slave_descr *hscdtd004a_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr hscdtd004a_get_slave_descr
+#endif
+#define get_pressure_slave_descr NULL
+
+#ifdef CONFIG_MPU_SENSORS_BMA085	
+struct ext_slave_descr *bma085_get_slave_descr(void);
+#undef get_pressure_slave_descr
+#define get_pressure_slave_descr bma085_get_slave_descr
+#endif
+
+#endif				
diff --git a/include/linux/mpu3050.h b/include/linux/mpu3050.h
new file mode 100644
index 0000000..936d136
--- /dev/null
+++ b/include/linux/mpu3050.h
@@ -0,0 +1,240 @@
+/*
+ $License:
+    Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  $
+ */
+
+#ifndef __MPU3050_H_
+#define __MPU3050_H_
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#endif
+
+#ifdef M_HW
+#error MPU6000 build including MPU3050 header
+#endif
+
+#define MPU_NAME "mpu3050"
+#define DEFAULT_MPU_SLAVEADDR       0x68
+
+enum mpu_register {
+	MPUREG_WHO_AM_I = 0,	
+	MPUREG_PRODUCT_ID,	
+	MPUREG_02_RSVD,		
+	MPUREG_03_RSVD,		
+	MPUREG_04_RSVD,		
+	MPUREG_XG_OFFS_TC,	
+	MPUREG_06_RSVD,		
+	MPUREG_07_RSVD,		
+	MPUREG_YG_OFFS_TC,	
+	MPUREG_09_RSVD,		
+	MPUREG_0A_RSVD,		
+	MPUREG_ZG_OFFS_TC,	
+	MPUREG_X_OFFS_USRH,	
+	MPUREG_X_OFFS_USRL,	
+	MPUREG_Y_OFFS_USRH,	
+	MPUREG_Y_OFFS_USRL,	
+	MPUREG_Z_OFFS_USRH,	
+	MPUREG_Z_OFFS_USRL,	
+	MPUREG_FIFO_EN1,	
+	MPUREG_FIFO_EN2,	
+	MPUREG_AUX_SLV_ADDR,	
+	MPUREG_SMPLRT_DIV,	
+	MPUREG_DLPF_FS_SYNC,	
+	MPUREG_INT_CFG,		
+	MPUREG_ACCEL_BURST_ADDR,
+	MPUREG_19_RSVD,		
+	MPUREG_INT_STATUS,	
+	MPUREG_TEMP_OUT_H,	
+	MPUREG_TEMP_OUT_L,	
+	MPUREG_GYRO_XOUT_H,	
+	MPUREG_GYRO_XOUT_L,	
+	MPUREG_GYRO_YOUT_H,	
+	MPUREG_GYRO_YOUT_L,	
+	MPUREG_GYRO_ZOUT_H,	
+	MPUREG_GYRO_ZOUT_L,	
+	MPUREG_23_RSVD,		
+	MPUREG_24_RSVD,		
+	MPUREG_25_RSVD,		
+	MPUREG_26_RSVD,		
+	MPUREG_27_RSVD,		
+	MPUREG_28_RSVD,		
+	MPUREG_29_RSVD,		
+	MPUREG_2A_RSVD,		
+	MPUREG_2B_RSVD,		
+	MPUREG_2C_RSVD,		
+	MPUREG_2D_RSVD,		
+	MPUREG_2E_RSVD,		
+	MPUREG_2F_RSVD,		
+	MPUREG_30_RSVD,		
+	MPUREG_31_RSVD,		
+	MPUREG_32_RSVD,		
+	MPUREG_33_RSVD,		
+	MPUREG_34_RSVD,		
+	MPUREG_DMP_CFG_1,	
+	MPUREG_DMP_CFG_2,	
+	MPUREG_BANK_SEL,	
+	MPUREG_MEM_START_ADDR,	
+	MPUREG_MEM_R_W,		
+	MPUREG_FIFO_COUNTH,	
+	MPUREG_FIFO_COUNTL,	
+	MPUREG_FIFO_R_W,	
+	MPUREG_USER_CTRL,	
+	MPUREG_PWR_MGM,		
+	MPUREG_3F_RSVD,		
+	NUM_OF_MPU_REGISTERS	
+};
+
+
+#define BIT_TEMP_OUT                0x80
+#define BIT_GYRO_XOUT               0x40
+#define BIT_GYRO_YOUT               0x20
+#define BIT_GYRO_ZOUT               0x10
+#define BIT_ACCEL_XOUT              0x08
+#define BIT_ACCEL_YOUT              0x04
+#define BIT_ACCEL_ZOUT              0x02
+#define BIT_AUX_1OUT                0x01
+#define BIT_AUX_2OUT                0x02
+#define BIT_AUX_3OUT                0x01
+#define BITS_EXT_SYNC_NONE          0x00
+#define BITS_EXT_SYNC_TEMP          0x20
+#define BITS_EXT_SYNC_GYROX         0x40
+#define BITS_EXT_SYNC_GYROY         0x60
+#define BITS_EXT_SYNC_GYROZ         0x80
+#define BITS_EXT_SYNC_ACCELX        0xA0
+#define BITS_EXT_SYNC_ACCELY        0xC0
+#define BITS_EXT_SYNC_ACCELZ        0xE0
+#define BITS_EXT_SYNC_MASK          0xE0
+#define BITS_FS_250DPS              0x00
+#define BITS_FS_500DPS              0x08
+#define BITS_FS_1000DPS             0x10
+#define BITS_FS_2000DPS             0x18
+#define BITS_FS_MASK                0x18
+#define BITS_DLPF_CFG_256HZ_NOLPF2  0x00
+#define BITS_DLPF_CFG_188HZ         0x01
+#define BITS_DLPF_CFG_98HZ          0x02
+#define BITS_DLPF_CFG_42HZ          0x03
+#define BITS_DLPF_CFG_20HZ          0x04
+#define BITS_DLPF_CFG_10HZ          0x05
+#define BITS_DLPF_CFG_5HZ           0x06
+#define BITS_DLPF_CFG_2100HZ_NOLPF  0x07
+#define BITS_DLPF_CFG_MASK          0x07
+#define BIT_ACTL                    0x80
+#define BIT_ACTL_LOW                0x80
+#define BIT_ACTL_HIGH               0x00
+#define BIT_OPEN                    0x40
+#define BIT_OPEN_DRAIN              0x40
+#define BIT_PUSH_PULL               0x00
+#define BIT_LATCH_INT_EN            0x20
+#define BIT_LATCH_INT_EN            0x20
+#define BIT_INT_PULSE_WIDTH_50US    0x00
+#define BIT_INT_ANYRD_2CLEAR        0x10
+#define BIT_INT_STAT_READ_2CLEAR    0x00
+#define BIT_MPU_RDY_EN              0x04
+#define BIT_DMP_INT_EN              0x02
+#define BIT_RAW_RDY_EN              0x01
+#define BIT_INT_STATUS_FIFO_OVERLOW 0x80
+#define BIT_MPU_RDY                 0x04
+#define BIT_DMP_INT                 0x02
+#define BIT_RAW_RDY                 0x01
+#define BIT_PRFTCH_EN               0x20
+#define BIT_CFG_USER_BANK           0x10
+#define BITS_MEM_SEL                0x0f
+#define BIT_DMP_EN                  0x80
+#define BIT_FIFO_EN                 0x40
+#define BIT_AUX_IF_EN               0x20
+#define BIT_AUX_RD_LENG             0x10
+#define BIT_AUX_IF_RST              0x08
+#define BIT_DMP_RST                 0x04
+#define BIT_FIFO_RST                0x02
+#define BIT_GYRO_RST                0x01
+#define BIT_H_RESET                 0x80
+#define BIT_SLEEP                   0x40
+#define BIT_STBY_XG                 0x20
+#define BIT_STBY_YG                 0x10
+#define BIT_STBY_ZG                 0x08
+#define BITS_CLKSEL                 0x07
+
+#define MPU_SILICON_REV_A4           1	
+#define MPU_SILICON_REV_B1           2	
+#define MPU_SILICON_REV_B4           3	
+#define MPU_SILICON_REV_B6           4	
+
+#define MPU_MEM_BANK_SIZE           (256)
+#define FIFO_HW_SIZE                (512)
+
+enum MPU_MEMORY_BANKS {
+	MPU_MEM_RAM_BANK_0 = 0,
+	MPU_MEM_RAM_BANK_1,
+	MPU_MEM_RAM_BANK_2,
+	MPU_MEM_RAM_BANK_3,
+	MPU_MEM_NUM_RAM_BANKS,
+	MPU_MEM_OTP_BANK_0 = MPU_MEM_NUM_RAM_BANKS,
+	
+	MPU_MEM_NUM_BANKS
+};
+
+#define MPU_NUM_AXES (3)
+
+enum mpu_filter {
+	MPU_FILTER_256HZ_NOLPF2 = 0,
+	MPU_FILTER_188HZ,
+	MPU_FILTER_98HZ,
+	MPU_FILTER_42HZ,
+	MPU_FILTER_20HZ,
+	MPU_FILTER_10HZ,
+	MPU_FILTER_5HZ,
+	MPU_FILTER_2100HZ_NOLPF,
+	NUM_MPU_FILTER
+};
+
+enum mpu_fullscale {
+	MPU_FS_250DPS = 0,
+	MPU_FS_500DPS,
+	MPU_FS_1000DPS,
+	MPU_FS_2000DPS,
+	NUM_MPU_FS
+};
+
+enum mpu_clock_sel {
+	MPU_CLK_SEL_INTERNAL = 0,
+	MPU_CLK_SEL_PLLGYROX,
+	MPU_CLK_SEL_PLLGYROY,
+	MPU_CLK_SEL_PLLGYROZ,
+	MPU_CLK_SEL_PLLEXT32K,
+	MPU_CLK_SEL_PLLEXT19M,
+	MPU_CLK_SEL_RESERVED,
+	MPU_CLK_SEL_STOP,
+	NUM_CLK_SEL
+};
+
+enum mpu_ext_sync {
+	MPU_EXT_SYNC_NONE = 0,
+	MPU_EXT_SYNC_TEMP,
+	MPU_EXT_SYNC_GYROX,
+	MPU_EXT_SYNC_GYROY,
+	MPU_EXT_SYNC_GYROZ,
+	MPU_EXT_SYNC_ACCELX,
+	MPU_EXT_SYNC_ACCELY,
+	MPU_EXT_SYNC_ACCELZ,
+	NUM_MPU_EXT_SYNC
+};
+
+#define DLPF_FS_SYNC_VALUE(ext_sync, full_scale, lpf) \
+    ((ext_sync << 5) | (full_scale << 3) | lpf)
+
+#endif				
diff --git a/include/linux/msm_ion.h b/include/linux/msm_ion.h
index 86dd70a..1437bfa 100644
--- a/include/linux/msm_ion.h
+++ b/include/linux/msm_ion.h
@@ -91,6 +91,17 @@
  * Macro should be used with ion_heap_ids defined above.
  */
 #define ION_HEAP(bit) (1 << (bit))
+#define ion_full_heap_mask (ION_HEAP(ION_CP_MM_HEAP_ID) | \
+			   ION_HEAP(ION_CP_MFC_HEAP_ID) | \
+			   ION_HEAP(ION_CP_WB_HEAP_ID) | \
+			   ION_HEAP(ION_CAMERA_HEAP_ID) | \
+			   ION_HEAP(ION_SF_HEAP_ID) | \
+			   ION_HEAP(ION_IOMMU_HEAP_ID) | \
+			   ION_HEAP(ION_QSECOM_HEAP_ID) | \
+			   ION_HEAP(ION_AUDIO_HEAP_ID) | \
+			   ION_HEAP(ION_MM_FIRMWARE_HEAP_ID) | \
+			   ION_HEAP(ION_SYSTEM_HEAP_ID) )
+
 
 #define ION_ADSP_HEAP_NAME	"adsp"
 #define ION_VMALLOC_HEAP_NAME	"vmalloc"
@@ -274,6 +285,7 @@
  * of the handle, p + offset through p + offset + length will have
  * the cache operations performed
  */
+/*
 struct ion_flush_data {
 	struct ion_handle *handle;
 	int fd;
@@ -281,7 +293,7 @@
 	unsigned int offset;
 	unsigned int length;
 };
-
+*/
 /* struct ion_flag_data - information about flags for this buffer
  *
  * @handle:	handle to get flags from
@@ -290,11 +302,12 @@
  * Takes handle as an input and outputs the flags from the handle
  * in the flag field.
  */
+/*
 struct ion_flag_data {
 	struct ion_handle *handle;
 	unsigned long flags;
 };
-
+*/
 #define ION_IOC_MSM_MAGIC 'M'
 
 /**
@@ -304,6 +317,7 @@
  */
 #define ION_IOC_CLEAN_CACHES	_IOWR(ION_IOC_MSM_MAGIC, 0, \
 						struct ion_flush_data)
+
 /**
  * DOC: ION_IOC_INV_CACHES - invalidate the caches
  *
@@ -327,5 +341,4 @@
  */
 #define ION_IOC_GET_FLAGS		_IOWR(ION_IOC_MSM_MAGIC, 3, \
 						struct ion_flag_data)
-
 #endif
diff --git a/include/linux/net.h b/include/linux/net.h
index be60c7f..95fea14 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -72,6 +72,7 @@
 #define SOCK_NOSPACE		2
 #define SOCK_PASSCRED		3
 #define SOCK_PASSSEC		4
+#define SOCK_EXTERNALLY_ALLOCATED 5
 
 #ifndef ARCH_HAS_SOCKET_TYPES
 /**
diff --git a/include/linux/pl_sensor.h b/include/linux/pl_sensor.h
new file mode 100644
index 0000000..c831a0e
--- /dev/null
+++ b/include/linux/pl_sensor.h
@@ -0,0 +1,11 @@
+#ifndef __LINUX_PL_SENSOR_H
+#define __LINUX_PL_SENSOR_H
+
+extern struct blocking_notifier_head psensor_notifier_list;
+
+extern int register_notifier_by_psensor(struct notifier_block *nb);
+extern int unregister_notifier_by_psensor(struct notifier_block *nb);
+int psensor_enable_by_touch_driver(int on);
+int power_key_check_in_pocket(void);
+#endif
+
diff --git a/include/linux/pn544.h b/include/linux/pn544.h
new file mode 100644
index 0000000..61a7843
--- /dev/null
+++ b/include/linux/pn544.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2010 NXP Semiconductors
+ */
+
+#define PN544_I2C_NAME "pn544"
+
+#define PN544_MAGIC	0xE9
+#define PN544_SET_PWR	_IOW(PN544_MAGIC, 0x01, unsigned int)
+#define IO_WAKE_LOCK_TIMEOUT (2*HZ)
+
+struct pn544_i2c_platform_data {
+	void (*gpio_init) (void);
+	unsigned int irq_gpio;
+	unsigned int ven_gpio;
+	unsigned int firm_gpio;
+	unsigned int ven_isinvert;
+};
diff --git a/include/linux/posix_types.h b/include/linux/posix_types.h
index f04c98c..988f76e 100644
--- a/include/linux/posix_types.h
+++ b/include/linux/posix_types.h
@@ -15,26 +15,14 @@
  */
 
 /*
- * Those macros may have been defined in <gnu/types.h>. But we always
- * use the ones here. 
+ * This macro may have been defined in <gnu/types.h>. But we always
+ * use the one here.
  */
-#undef __NFDBITS
-#define __NFDBITS	(8 * sizeof(unsigned long))
-
 #undef __FD_SETSIZE
 #define __FD_SETSIZE	1024
 
-#undef __FDSET_LONGS
-#define __FDSET_LONGS	(__FD_SETSIZE/__NFDBITS)
-
-#undef __FDELT
-#define	__FDELT(d)	((d) / __NFDBITS)
-
-#undef __FDMASK
-#define	__FDMASK(d)	(1UL << ((d) % __NFDBITS))
-
 typedef struct {
-	unsigned long fds_bits [__FDSET_LONGS];
+	unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))];
 } __kernel_fd_set;
 
 /* Type of a signal handler.  */
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index cb56293..662a517 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -129,6 +129,9 @@
 	POWER_SUPPLY_PROP_MODEL_NAME,
 	POWER_SUPPLY_PROP_MANUFACTURER,
 	POWER_SUPPLY_PROP_SERIAL_NUMBER,
+#ifdef CONFIG_HTC_BATT_8960
+	POWER_SUPPLY_PROP_OVERLOAD,
+#endif
 };
 
 enum power_supply_type {
@@ -137,6 +140,9 @@
 	POWER_SUPPLY_TYPE_UPS,
 	POWER_SUPPLY_TYPE_MAINS,
 	POWER_SUPPLY_TYPE_USB,		/* Standard Downstream Port */
+#ifdef CONFIG_HTC_BATT_8960
+	POWER_SUPPLY_TYPE_WIRELESS,	/* Wireless Charger */
+#endif
 	POWER_SUPPLY_TYPE_USB_DCP,	/* Dedicated Charging Port */
 	POWER_SUPPLY_TYPE_USB_CDP,	/* Charging Downstream Port */
 	POWER_SUPPLY_TYPE_USB_ACA,	/* Accessory Charger Adapters */
diff --git a/include/linux/r3gd20.h b/include/linux/r3gd20.h
new file mode 100644
index 0000000..24d7f8c
--- /dev/null
+++ b/include/linux/r3gd20.h
@@ -0,0 +1,97 @@
+/******************** (C) COPYRIGHT 2011 STMicroelectronics ********************
+*
+* File Name		: r3gd20.h
+* Authors		: MH - C&I BU - Application Team
+*			: Carmine Iascone (carmine.iascone@st.com)
+*			: Matteo Dameno (matteo.dameno@st.com)
+*			: Both authors are willing to be considered the contact
+*			: and update points for the driver.
+* Version		: V 1.1.5 sysfs
+* Date			: 2011/Sep/24
+* Description		: R3GD20 digital output gyroscope sensor API
+*
+********************************************************************************
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2 as
+* published by the Free Software Foundation.
+*
+* THE PRESENT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES
+* OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, FOR THE SOLE
+* PURPOSE TO SUPPORT YOUR APPLICATION DEVELOPMENT.
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+*
+********************************************************************************
+* REVISON HISTORY
+*
+* VERSION	| DATE		| AUTHORS		| DESCRIPTION
+* 1.0		| 2010/May/02	| Carmine Iascone	| First Release
+* 1.1.3		| 2011/Jun/24	| Matteo Dameno		| Corrects ODR Bug
+* 1.1.4		| 2011/Sep/02	| Matteo Dameno		| SMB Bus Mng,
+* 		|		|			| forces BDU setting
+* 1.1.5		| 2011/Sep/24	| Matteo Dameno		| Introduces FIFO Feat.
+* 1.1.5.1 | 2011/Nov/6  | Morris Chen     | change name from l3g to r3g
+*                                         | change default FS to 2000DPS
+*                                         | change default poll_rate to 50ms
+*                                         | chage the attribute of sysfs file as 666
+*******************************************************************************/
+
+#ifndef __R3GD20_H__
+#define __R3GD20_H__
+
+
+#define R3GD20_MIN_POLL_PERIOD_MS	2
+
+#define SAD0L				0x00
+#define SAD0H				0x01
+#define R3GD20_GYR_I2C_SADROOT		0x6A
+#define R3GD20_GYR_I2C_SAD_L		((R3GD20_GYR_I2C_SADROOT<<1)|SAD0L)
+#define R3GD20_GYR_I2C_SAD_H		((R3GD20_GYR_I2C_SADROOT<<1)|SAD0H)
+
+#define R3GD20_GYR_DEV_NAME		"r3gd20_gyr"
+
+#define R3GD20_GYR_FS_250DPS	0x00
+#define R3GD20_GYR_FS_500DPS	0x10
+#define R3GD20_GYR_FS_2000DPS	0x30
+
+#define R3GD20_GYR_ENABLED	1
+#define R3GD20_GYR_DISABLED	0
+
+extern unsigned char gyro_gsensor_kvalue[37];
+
+#ifdef __KERNEL__
+struct r3gd20_gyr_platform_data {
+	int (*init)(void);
+	void (*exit)(void);
+	int (*power_on)(void);
+	int (*power_off)(void);
+	unsigned int poll_interval;
+	unsigned int min_interval;
+
+	u8 fs_range;
+
+	
+	u8 watermark;
+	u8 fifomode;
+
+	
+	int gpio_int1;
+	int gpio_int2;		
+
+	
+	u8 axis_map_x;
+	u8 axis_map_y;
+	u8 axis_map_z;
+
+	u8 negate_x;
+	u8 negate_y;
+	u8 negate_z;
+
+	int (*power_LPM)(int on);
+};
+#endif 
+
+#endif  
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 0d04cd6..ffc444c 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -368,8 +368,11 @@
 			iter->index++;
 			if (likely(*slot))
 				return slot;
-			if (flags & RADIX_TREE_ITER_CONTIG)
+			if (flags & RADIX_TREE_ITER_CONTIG) {
+				/* forbid switching to the next chunk */
+				iter->next_index = 0;
 				break;
+			}
 		}
 	}
 	return NULL;
diff --git a/include/linux/random.h b/include/linux/random.h
index 8f74538..ac621ce 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -48,13 +48,13 @@
 
 #ifdef __KERNEL__
 
-extern void rand_initialize_irq(int irq);
-
+extern void add_device_randomness(const void *, unsigned int);
 extern void add_input_randomness(unsigned int type, unsigned int code,
 				 unsigned int value);
-extern void add_interrupt_randomness(int irq);
+extern void add_interrupt_randomness(int irq, int irq_flags);
 
 extern void get_random_bytes(void *buf, int nbytes);
+extern void get_random_bytes_arch(void *buf, int nbytes);
 void generate_random_uuid(unsigned char uuid_out[16]);
 
 #ifndef MODULE
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
new file mode 100644
index 0000000..b84b10f
--- /dev/null
+++ b/include/linux/rmi.h
@@ -0,0 +1,424 @@
+/*
+ * Copyright (c) 2011 Synaptics Incorporated
+ * Copyright (c) 2011 Unixphere
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef _RMI_H
+#define _RMI_H
+#include <linux/kernel.h>
+#include <linux/lockdep.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/device.h>
+#include <linux/cdev.h>
+#include <linux/mutex.h>
+#include <linux/stat.h>
+#include <linux/wait.h>
+#include <linux/list.h>
+#include <linux/interrupt.h>
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#include <linux/earlysuspend.h>
+#endif
+
+
+#define RMI_RO_ATTR S_IRUGO
+#define RMI_RW_ATTR (S_IRUGO | S_IWUGO)
+#define RMI_WO_ATTR S_IWUGO
+
+#define PDT_START_SCAN_LOCATION 0x00e9
+
+enum rmi_irq_polarity {
+	RMI_IRQ_ACTIVE_LOW = 0,
+	RMI_IRQ_ACTIVE_HIGH = 1
+};
+
+struct rmi_f11_2d_axis_alignment {
+	bool swap_axes;
+	bool flip_x;
+	bool flip_y;
+	int clip_X_low;
+	int clip_Y_low;
+	int clip_X_high;
+	int clip_Y_high;
+	int offset_X;
+	int offset_Y;
+	int rel_report_enabled;
+};
+
+union rmi_f11_2d_ctrl0 {
+	struct {
+		u8 reporting_mode:3;
+		u8 abs_pos_filt:1;
+		u8 rel_pos_filt:1;
+		u8 rel_ballistics:1;
+		u8 dribble:1;
+		u8 report_beyond_clip:1;
+	};
+	u8 reg;
+};
+
+union rmi_f11_2d_ctrl1 {
+	struct {
+		u8 palm_detect_thres:4;
+		u8 motion_sensitivity:2;
+		u8 man_track_en:1;
+		u8 man_tracked_finger:1;
+	};
+	u8 reg;
+};
+
+union rmi_f11_2d_ctrl2__3 {
+	struct {
+		u8 delta_x_threshold:8;
+		u8 delta_y_threshold:8;
+	};
+	u8 regs[2];
+};
+
+union rmi_f11_2d_ctrl4 {
+	struct {
+		u8 velocity:8;
+	};
+	u8 reg;
+};
+
+union rmi_f11_2d_ctrl5 {
+	struct {
+		u8 acceleration:8;
+	};
+	u8 reg;
+};
+
+union rmi_f11_2d_ctrl6__7 {
+	struct {
+		u16 sensor_max_x_pos:12;
+	};
+	u8 regs[2];
+};
+
+union rmi_f11_2d_ctrl8__9 {
+	struct {
+		u16 sensor_max_y_pos:12;
+	};
+	u8 regs[2];
+};
+
+union rmi_f11_2d_ctrl10 {
+	struct {
+		u8 single_tap_int_enable:1;
+		u8 tap_n_hold_int_enable:1;
+		u8 double_tap_int_enable:1;
+		u8 early_tap_int_enable:1;
+		u8 flick_int_enable:1;
+		u8 press_int_enable:1;
+		u8 pinch_int_enable:1;
+	};
+	u8 reg;
+};
+
+union rmi_f11_2d_ctrl11 {
+	struct {
+		u8 palm_detect_int_enable:1;
+		u8 rotate_int_enable:1;
+		u8 touch_shape_int_enable:1;
+		u8 scroll_zone_int_enable:1;
+		u8 multi_finger_scroll_int_enable:1;
+	};
+	u8 reg;
+};
+
+union rmi_f11_2d_ctrl12 {
+	struct {
+		u8 sensor_map:7;
+		u8 xy_sel:1;
+	};
+	u8 reg;
+};
+
+union rmi_f11_2d_ctrl14 {
+	struct {
+		u8 sens_adjustment:5;
+		u8 hyst_adjustment:3;
+	};
+	u8 reg;
+};
+
+struct  rmi_f11_2d_ctrl {
+	union rmi_f11_2d_ctrl0		*ctrl0;
+	union rmi_f11_2d_ctrl1		*ctrl1;
+	union rmi_f11_2d_ctrl2__3	*ctrl2__3;
+	union rmi_f11_2d_ctrl4		*ctrl4;
+	union rmi_f11_2d_ctrl5		*ctrl5;
+	union rmi_f11_2d_ctrl6__7	*ctrl6__7;
+	union rmi_f11_2d_ctrl8__9	*ctrl8__9;
+	union rmi_f11_2d_ctrl10		*ctrl10;
+	union rmi_f11_2d_ctrl11		*ctrl11;
+	union rmi_f11_2d_ctrl12		*ctrl12;
+	u8				ctrl12_size;
+	union rmi_f11_2d_ctrl14		*ctrl14;
+	u8				*ctrl15;
+	u8				*ctrl16;
+	u8				*ctrl17;
+	u8				*ctrl18;
+	u8				*ctrl19;
+};
+
+struct rmi_f19_button_map {
+	unsigned char nbuttons;
+	unsigned char *map;
+};
+
+struct rmi_device_platform_data_spi {
+	int block_delay_us;
+	int split_read_block_delay_us;
+	int byte_delay_us;
+	int split_read_byte_delay_us;
+	int pre_delay_us;
+	int post_delay_us;
+
+	void *cs_assert_data;
+	int (*cs_assert) (const void *cs_assert_data, const bool assert);
+};
+
+struct rmi_device_platform_data {
+	char *driver_name;
+
+	int irq_no;
+	int irq;
+	enum rmi_irq_polarity irq_polarity;
+	int (*gpio_config)(void);
+
+	struct rmi_device_platform_data_spi spi_v2;
+
+	
+	struct rmi_f11_2d_ctrl *f11_ctrl;
+	struct rmi_f11_2d_axis_alignment axis_align;
+	struct rmi_f19_button_map *button_map;
+
+#ifdef	CONFIG_PM
+	void *pm_data;
+	int (*pre_suspend) (const void *pm_data);
+	int (*post_resume) (const void *pm_data);
+#endif
+};
+
+struct rmi_function_descriptor {
+	u16 query_base_addr;
+	u16 command_base_addr;
+	u16 control_base_addr;
+	u16 data_base_addr;
+	u8 interrupt_source_count;
+	u8 function_number;
+	u8 function_version;
+};
+
+struct rmi_function_container;
+struct rmi_device;
+
+struct rmi_function_handler {
+	int func;
+	int (*init)(struct rmi_function_container *fc);
+	int (*attention)(struct rmi_function_container *fc, u8 *irq_bits);
+#ifdef CONFIG_PM
+	int (*suspend)(struct rmi_function_container *fc);
+	int (*resume)(struct rmi_function_container *fc);
+#endif
+	void (*remove)(struct rmi_function_container *fc);
+};
+
+struct rmi_function_device {
+	struct device dev;
+};
+
+struct rmi_function_container {
+	struct list_head list;
+
+	struct rmi_function_descriptor fd;
+	struct rmi_device *rmi_dev;
+	struct rmi_function_handler *fh;
+	struct device dev;
+
+	int num_of_irqs;
+	int irq_pos;
+	u8 *irq_mask;
+
+	void *data;
+};
+#define to_rmi_function_container(d) \
+		container_of(d, struct rmi_function_container, dev);
+#define to_rmi_function_device(d) \
+		container_of(d, struct rmi_function_device, dev);
+
+
+
+#define RMI_CHAR_DEV_TMPBUF_SZ 128
+#define RMI_REG_ADDR_PAGE_SELECT 0xFF
+
+struct rmi_char_dev {
+	
+	struct mutex mutex_file_op;
+	
+	struct cdev main_dev;
+
+	
+	
+
+	
+	
+	struct rmi_phys_device *phys;
+	
+	int ref_count;
+};
+
+int rmi_char_dev_register(void);
+void rmi_char_dev_unregister(struct rmi_phys_device *phys);
+
+
+
+
+struct rmi_driver {
+	struct device_driver driver;
+
+	int (*probe)(struct rmi_device *rmi_dev);
+	int (*remove)(struct rmi_device *rmi_dev);
+	void (*shutdown)(struct rmi_device *rmi_dev);
+	int (*irq_handler)(struct rmi_device *rmi_dev, int irq);
+	void (*fh_add)(struct rmi_device *rmi_dev,
+		       struct rmi_function_handler *fh);
+	void (*fh_remove)(struct rmi_device *rmi_dev,
+			  struct rmi_function_handler *fh);
+	u8* (*get_func_irq_mask)(struct rmi_device *rmi_dev,
+			    struct rmi_function_container *fc);
+	int (*store_irq_mask)(struct rmi_device *rmi_dev, u8* new_interupts);
+	int (*restore_irq_mask)(struct rmi_device *rmi_dev);
+	void *data;
+};
+#define to_rmi_driver(d) \
+	container_of(d, struct rmi_driver, driver);
+
+struct rmi_phys_info {
+	char *proto;
+	long tx_count;
+	long tx_bytes;
+	long tx_errs;
+	long rx_count;
+	long rx_bytes;
+	long rx_errs;
+	long attn_count;
+	long attn;
+};
+
+struct rmi_phys_device {
+	struct device *dev;
+	struct rmi_device *rmi_dev;
+
+	int (*write)(struct rmi_phys_device *phys, u16 addr, u8 data);
+	int (*write_block)(struct rmi_phys_device *phys, u16 addr, u8 *buf,
+			   int len);
+	int (*read)(struct rmi_phys_device *phys, u16 addr, u8 *buf);
+	int (*read_block)(struct rmi_phys_device *phys, u16 addr, u8 *buf,
+			  int len);
+
+	int (*enable_device) (struct rmi_phys_device *phys);
+	void (*disable_device) (struct rmi_phys_device *phys);
+
+	void *data;
+
+	struct rmi_phys_info info;
+
+	
+	struct rmi_char_dev *char_dev;
+	struct class *rmi_char_device_class;
+};
+
+struct rmi_device {
+	struct device dev;
+
+	struct rmi_driver *driver;
+	struct rmi_phys_device *phys;
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+	struct early_suspend early_suspend_handler;
+#endif
+};
+#define to_rmi_device(d) container_of(d, struct rmi_device, dev);
+#define to_rmi_platform_data(d) ((d)->phys->dev->platform_data);
+
+int i2c_rmi_read(uint16_t addr, uint8_t *data, uint16_t length);
+int i2c_rmi_write(uint16_t addr, uint8_t *data, uint16_t length);
+
+static inline void rmi_set_driverdata(struct rmi_device *d, void *data)
+{
+	dev_set_drvdata(&d->dev, data);
+}
+
+static inline void *rmi_get_driverdata(struct rmi_device *d)
+{
+	return dev_get_drvdata(&d->dev);
+}
+
+static inline int rmi_read(struct rmi_device *d, u16 addr, u8 *buf)
+{
+	return d->phys->read(d->phys, addr, buf);
+}
+
+static inline int rmi_read_block(struct rmi_device *d, u16 addr, u8 *buf,
+				 int len)
+{
+	return d->phys->read_block(d->phys, addr, buf, len);
+}
+
+static inline int rmi_write(struct rmi_device *d, u16 addr, u8 data)
+{
+	return d->phys->write(d->phys, addr, data);
+}
+
+static inline int rmi_write_block(struct rmi_device *d, u16 addr, u8 *buf,
+				  int len)
+{
+	return d->phys->write_block(d->phys, addr, buf, len);
+}
+
+int rmi_register_driver(struct rmi_driver *driver);
+
+void rmi_unregister_driver(struct rmi_driver *driver);
+
+int rmi_register_phys_device(struct rmi_phys_device *phys);
+
+void rmi_unregister_phys_device(struct rmi_phys_device *phys);
+
+int rmi_register_function_driver(struct rmi_function_handler *fh);
+
+void rmi_unregister_function_driver(struct rmi_function_handler *fh);
+
+struct rmi_function_handler *rmi_get_function_handler(int id);
+
+ssize_t rmi_store_error(struct device *dev,
+			struct device_attribute *attr,
+			const char *buf, size_t count);
+
+ssize_t rmi_show_error(struct device *dev,
+		       struct device_attribute *attr,
+		       char *buf);
+
+void u8_set_bit(u8 *target, int pos);
+void u8_clear_bit(u8 *target, int pos);
+bool u8_is_set(u8 *target, int pos);
+bool u8_is_any_set(u8 *target, int size);
+void u8_or(u8 *dest, u8* target1, u8* target2, int size);
+void u8_and(u8 *dest, u8* target1, u8* target2, int size);
+#endif
diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h
index a8e50e4..82a6739 100644
--- a/include/linux/rpmsg.h
+++ b/include/linux/rpmsg.h
@@ -38,6 +38,8 @@
 #include <linux/types.h>
 #include <linux/device.h>
 #include <linux/mod_devicetable.h>
+#include <linux/kref.h>
+#include <linux/mutex.h>
 
 /* The feature bitmap for virtio rpmsg */
 #define VIRTIO_RPMSG_F_NS	0 /* RP supports name service notifications */
@@ -120,7 +122,9 @@
 /**
  * struct rpmsg_endpoint - binds a local rpmsg address to its user
  * @rpdev: rpmsg channel device
+ * @refcount: when this drops to zero, the ept is deallocated
  * @cb: rx callback handler
+ * @cb_lock: must be taken before accessing/changing @cb
  * @addr: local rpmsg address
  * @priv: private data for the driver's use
  *
@@ -140,7 +144,9 @@
  */
 struct rpmsg_endpoint {
 	struct rpmsg_channel *rpdev;
+	struct kref refcount;
 	rpmsg_rx_cb_t cb;
+	struct mutex cb_lock;
 	u32 addr;
 	void *priv;
 };
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 67889bf..7ddd804 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1947,6 +1947,14 @@
 		current->flags &= ~PF_WAKE_UP_IDLE;
 }
 
+#ifdef CONFIG_NO_HZ
+void calc_load_enter_idle(void);
+void calc_load_exit_idle(void);
+#else
+static inline void calc_load_enter_idle(void) { }
+static inline void calc_load_exit_idle(void) { }
+#endif /* CONFIG_NO_HZ */
+
 #ifndef CONFIG_CPUMASK_OFFSTACK
 static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
 {
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 111f26b..c1bae8d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -225,14 +225,11 @@
 	/* device driver is going to provide hardware time stamp */
 	SKBTX_IN_PROGRESS = 1 << 2,
 
-	/* ensure the originating sk reference is available on driver level */
-	SKBTX_DRV_NEEDS_SK_REF = 1 << 3,
-
 	/* device driver supports TX zero-copy buffers */
-	SKBTX_DEV_ZEROCOPY = 1 << 4,
+	SKBTX_DEV_ZEROCOPY = 1 << 3,
 
 	/* generate wifi status information (where possible) */
-	SKBTX_WIFI_STATUS = 1 << 5,
+	SKBTX_WIFI_STATUS = 1 << 4,
 };
 
 /*
@@ -1881,8 +1878,6 @@
 {
 	int delta = 0;
 
-	if (headroom < NET_SKB_PAD)
-		headroom = NET_SKB_PAD;
 	if (headroom > skb_headroom(skb))
 		delta = headroom - skb_headroom(skb);
 
diff --git a/include/linux/smb349.h b/include/linux/smb349.h
new file mode 100644
index 0000000..9189358
--- /dev/null
+++ b/include/linux/smb349.h
@@ -0,0 +1,377 @@
+/* Copyright (c) 2012 Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful;
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#ifndef __SMB349_H__
+#define __SMB349_H__
+
+#ifdef CONFIG_HTC_BATT_8960
+#include <mach/htc_charger.h>
+#endif
+
+#define SMB_CHG_CURR_REG			0x00
+#define CHG_OTHER_CURRENT_REG		0x01
+#define VAR_FUNC_REG			0x02
+#define FLOAT_VOLTAGE_REG		0x03
+#define CHG_CTRL_REG			0x04
+#define STAT_TIMER_REG			0x05
+#define PIN_ENABLE_CTRL_REG		0x06
+#define THERM_CTRL_A_REG		0x07
+#define SYSOK_USB3_SEL_REG		0x08
+#define CTRL_FUNC_REG		0x09
+#define OTG_TLIM_THERM_CNTRL_REG	0x0A
+#define LIMIT_CELL_TEMP_MONI_REG 0x0B
+#define FAULT_IRQ_REG				0x0C
+#define STATUS_IRQ_REG				0x0D
+#define SYSOK_REG				0x0E
+#define AUTO_INPUT_VOL_DET_REG		0x10
+#define I2C_BUS_REG				0x12
+#define CMD_A_REG				0x30
+#define CMD_B_REG				0x31
+#define CMD_C_REG				0x33
+#define IRQ_A_REG				0x35
+#define IRQ_B_REG				0x36
+#define IRQ_C_REG				0x37
+#define IRQ_D_REG				0x38
+#define IRQ_E_REG				0x39
+#define IRQ_F_REG				0x3A
+#define STATUS_A_REG				0x3B
+#define STATUS_B_REG				0x3C
+#define STATUS_C_REG				0x3D
+#define STATUS_D_REG				0x3E
+#define STATUS_E_REG				0x3F
+
+#define CHG_STATUS_MASK		SMB349_MASK(2, 1)
+#define CHG_ENABLE_STATUS_BIT		BIT(0)
+
+#define FAST_CHG_CURRENT_MASK			SMB349_MASK(4, 4)
+
+
+#define SUSPEND_MODE_MASK				SMB349_MASK(1, 2)
+
+#define CHARGING_ENABLE_MASK				SMB349_MASK(1, 1)
+#define VOLIATILE_WRITE_PERMISSIOIN_MASK		SMB349_MASK(1, 7)
+#define CURRENT_TERMINATION_MASK			SMB349_MASK(1, 6)
+
+#define OTG_ENABLE_MASK				SMB349_MASK(1, 4)
+#define AICL_MASK				SMB349_MASK(1, 4)
+#define USBCS_MASK				SMB349_MASK(1, 4)
+
+#define AC_INPUT_CURRENT_LIMIT_MASK		SMB349_MASK(4, 0)
+#define DC_INPUT_CURRENT_LIMIT_MASK		SMB349_MASK(4, 0)
+
+#define PRE_CHG_CURRENT_MASK			SMB349_MASK(3, 5)
+
+#define USB_HC_MODE_MASK			SMB349_MASK(1, 0)
+#define TERMINATION_CURRENT_MASK		SMB349_MASK(3, 2)
+
+#define USB_1_5_MODE_MASK			SMB349_MASK(1, 1)
+
+#define IS_SUSPEND_MODE_MASK			SMB349_MASK(1, 7)
+
+#define OTG_CURRENT_MASK			SMB349_MASK(2, 2)
+
+
+#define PIN_CONTROL_ACTIVE_MASK			SMB349_MASK(2, 5)
+
+#define PRE_CHG_TO_FAST_CHG_THRESH_MASK		SMB349_MASK(2, 6)
+#define SWITCH_FREQ_MASK			SMB349_MASK(2, 6)
+#define OTG_I2C_PIN_MASK			SMB349_MASK(2, 6)
+
+#define PRE_CHG_TO_FAST_CHG_ENABLE_MASK		SMB349_MASK(1, 1)
+#define FLOAT_VOLTAGE_MASK			SMB349_MASK(6, 0)
+
+
+#define SUSPEND_MODE_BIT			BIT(2)
+#define CHG_ENABLE_BIT				BIT(1)
+#define VOLATILE_W_PERM_BIT			BIT(7)
+#define USB_SELECTION_BIT			BIT(1)
+#define SYSTEM_FET_ENABLE_BIT			BIT(7)
+#define AICL_COMPLETE_STATUS_BIT		BIT(4)
+#define AUTOMATIC_INPUT_CURR_LIMIT_BIT		BIT(4)
+#define I2C_CONTROL_CHARGER_BIT			BIT(5)
+#define AUTOMATIC_POWER_SOURCE_DETECTION_BIT	BIT(2)
+#define BATT_OV_END_CHG_BIT			BIT(1)
+#define VCHG_FUNCTION				BIT(0)
+#define USB_1_5_MODE				BIT(1)
+#define USB_HC_MODE				BIT(0)
+#define POWER_OK_STATUS				BIT(0)
+#define USBCS_PIN_MODE				BIT(4)
+#define USBCS_REGISTER_MODE			0
+#define CURR_TERM_END_CHG_BIT			BIT(6)
+
+#define SMB349_HOT_TEMPERATURE_HARD_LIMIT_IRQ			7
+#define SMB349_HOT_TEMPERATURE_HARD_LIMIT_STATUS                6
+#define SMB349_COLD_TEMPERATURE_HARD_LIMIT_IRQ                  5
+#define SMB349_COLD_TEMPERATURE_HARD_LIMIT_STATUS               4
+#define SMB349_HOT_TEMPERATURE_SOFT_LIMIT_IRQ                   3
+#define SMB349_HOT_TEMPERATURE_SOFT_LIMIT_STATUS                2
+#define SMB349_COLD_TEMPERATURE_SOFT_LIMIT_IRQ                  1
+#define SMB349_COLD_TEMPERATURE_SOFT_LIMIT_STATUS               0
+
+#define SMB349_BATTERY_OVER_VOLTAGE_CONDITION_IRQ		7
+#define SMB349_BATTERY_OVER_VOLTAGE_STATUS			6
+#define SMB349_MISSING_BATTER_IRQ                               5
+#define SMB349_MISSING_BATTERY_STATUS                           4
+#define SMB349_LOW_BATTERY_VOLTAGE_IRQ                          3
+#define SMB349_LOW_BATTERY_VOLTAGE_STATUS                       2
+#define SMB349_PRE_TO_FAST_CHARGE_BATTERY_VOLTAGE_IRQ           1
+#define SMB349_PRE_TO_FAST_CHARGE_BATTERY_VOLTAGE_STATUS        0
+
+#define SMB349_INTERNAL_TEMPERATURE_LIMIT_IRQ			7
+#define SMB349_INTERNAL_TEMPERATURE_LIMIT_STATUS                6
+#define SMB349_RE_CHARGE_BATTERY_THRESHOLD_IRQ                  5
+#define SMB349_RE_CHARGE_BATTERY_THRESHOLD_STATUS               4
+#define SMB349_TAPER_CHARGING_MODE_IRQ                          3
+#define SMB349_TAPER_CHARGING_MODE_STATUS                       2
+#define SMB349_TERMINATION_CHARGING_CURRENT_HIT_IRQ             1
+#define SMB349_TERMINATION_CHARGING_CURRENT_HIT_STATUS          0
+
+#define SMB349_APSD_COMPLETED_IRQ				7
+#define SMB349_APSD_COMPLETED_STATUS                            6
+#define SMB349_AICL_COMPLETE_IRQ                                5
+#define SMB349_AICL_COMPLETE_STATUS                             4
+#define SMB349_RESERVED_3                                         3
+#define SMB349_RESERVED_2                                         2
+#define SMB349_CHARGE_TIMEOUT_IRQ                               1
+#define SMB349_CHARGE_TIMEOUT_STATUS                            0
+
+
+#define SMB349_CIN_OVER_VOLTAGE_IRQ				7
+#define SMB349_DCIN_OVER_VOLTAGE_STATUS				6
+#define SMB349_DCIN_UNDER_VOLTAGE_IRQ				5
+#define SMB349_DCIN_UNDER_VOLTAGE_STATUS			4
+#define SMB349_AFVC_ACTIVE_IRQ					3
+#define SMB349_AFVC_ACTIVE_STATUS				2
+
+#define SMB349_OTG_OVER_CURRENT_LIMIT_IRQ			7
+#define SMB349_OTG_OVER_CURRENT_LIMIT_STATUS            	6
+#define SMB349_OTG_BATTERY_UNDER_VOLTAGE_IRQ            	5
+#define SMB349_OTG_BATTERY_UNDER_VOLTAGE_STATUS         	4
+#define SMB349_OTG_DETECTION_IRQ                        	3
+#define SMB349_OTG_DETECTION_STATUS                     	2
+#define SMB349_POWER_OK_IRQ					1
+#define SMB349_POWER_OK_STATUS					0
+
+
+#define SMB349_FAST_CHG_MIN_MA	1000
+#define SMB349_FAST_CHG_STEP_MA	200
+#define SMB349_FAST_CHG_MAX_MA	4000
+#define SMB349_FAST_CHG_SHIFT	4
+#define SMB349_PRE_CHG_SHIFT	5
+
+#define SMB349_OTG_I2C_PIN_SHIFT	6
+
+#define SMB349_OTG_I2C_CONTROL		0x0
+#define SMB349_OTG_PIN_CONTROL		0x1
+
+#define SMB34X_OTG_CURR_LIMIT_SHIFT	2
+#define SMB349_SWITCH_FREQ_SHIFT	6
+
+#define SMB349_PIN_CONTROL_SHIFT	5
+#define SMB349_USBCS_REGISTER_CTRL	0
+#define SMB349_USBCS_PIN_CTRL		1
+
+#define SMB349_NO_CHARGING				0
+#define SMB349_PRE_CHARGING				1
+#define SMB349_FAST_CHARGING				2
+#define SMB349_TAPER_CHARGING				3
+
+
+
+#define	SMB349_FLOAT_VOL_4000_MV	0x1B
+#define	SMB349_FLOAT_VOL_4200_MV	0x25
+#define	SMB349_FLOAT_VOL_4220_MV	0x26
+#define	SMB349_FLOAT_VOL_4240_MV	0x27
+#define	SMB349_FLOAT_VOL_4260_MV	0x28
+#define	SMB349_FLOAT_VOL_4280_MV	0x29
+#define	SMB349_FLOAT_VOL_4300_MV	0x2A
+#define	SMB349_FLOAT_VOL_4320_MV	0x2B
+#define	SMB349_FLOAT_VOL_4340_MV	0x2C
+#define	SMB349_FLOAT_VOL_4350_MV	0x2D
+
+
+#define SMB_OTG_CURR_LIMIT_250MA		0x0
+#define SMB_OTG_CURR_LIMIT_500MA		0x1
+#define SMB_OTG_CURR_LIMIT_750MA		0x2
+#define SMB_OTG_CURR_LIMIT_1000MA		0x3
+
+
+#define SMB349_I2C_CONTROL_ACTIVE_HIGH		0x0
+#define SMB349_I2C_CONTROL_ACTIVE_LOW		0x1
+#define SMB349_PIN_CONTROL_ACTIVE_HIGH		0x2
+#define SMB349_PIN_CONTROL_ACTIVE_LOW		0x3
+
+#define		AICL_RESULT_500MA	0x0
+#define		AICL_RESULT_900MA       0x1
+#define		AICL_RESULT_1000MA      0x2
+#define		AICL_RESULT_1100MA      0x3
+#define		AICL_RESULT_1200MA      0x4
+#define		AICL_RESULT_1300MA      0x5
+#define		AICL_RESULT_1500MA      0x6
+#define		AICL_RESULT_1600MA      0x7
+#define		AICL_RESULT_1700MA      0x8
+#define		AICL_RESULT_1800MA      0x9
+#define		AICL_RESULT_2000MA      0xa
+#define		AICL_RESULT_2200MA      0xb
+#define		AICL_RESULT_2400MA      0xc
+#define		AICL_RESULT_2500MA      0xd
+#define		AICL_RESULT_3000MA      0xe
+#define		AICL_RESULT_3500MA      0xf
+
+#define		SWITCH_FREQ_750KHZ	0x0
+#define		SWITCH_FREQ_1MHZ       	0x1
+#define		SWITCH_FREQ_1D5MHZ     	0x2
+#define		SWITCH_FREQ_3MHZ       	0x3
+
+#define SMB349_USB_MODE		0
+#define SMB349_HC_MODE		1
+
+#define		FAST_CHARGE_500MA	0x0
+#define		FAST_CHARGE_600MA       0x1
+#define		FAST_CHARGE_700MA       0x2
+#define		FAST_CHARGE_800MA       0x3
+#define		FAST_CHARGE_900MA       0x4
+#define		FAST_CHARGE_1000MA      0x5
+#define		FAST_CHARGE_1100MA      0x6
+#define		FAST_CHARGE_1200MA      0x7
+#define		FAST_CHARGE_1300MA      0x8
+#define		FAST_CHARGE_1400MA      0x9
+#define		FAST_CHARGE_1500MA      0xa
+#define		FAST_CHARGE_1600MA      0xb
+#define		FAST_CHARGE_1700MA      0xc
+#define		FAST_CHARGE_1800MA      0xd
+#define		FAST_CHARGE_1900MA      0xe
+#define		FAST_CHARGE_2000MA      0xf
+
+
+#define         SMB340_FASTCHG_1000MA      0x0
+#define         SMB340_FASTCHG_1200MA      0x1
+#define         SMB340_FASTCHG_1400MA      0x2
+#define         SMB340_FASTCHG_1600MA      0x3
+#define         SMB340_FASTCHG_1800MA      0x4
+#define         SMB340_FASTCHG_2000MA      0x5
+#define         SMB340_FASTCHG_2200MA      0x6
+#define         SMB340_FASTCHG_2400MA      0x7
+#define         SMB340_FASTCHG_2600MA      0x8
+#define         SMB340_FASTCHG_2800MA      0x9
+#define         SMB340_FASTCHG_3000MA      0xa
+#define         SMB340_FASTCHG_3200MA      0xb
+#define         SMB340_FASTCHG_3400MA      0xc
+#define         SMB340_FASTCHG_3600MA      0xd
+#define         SMB340_FASTCHG_3800MA      0xe
+#define         SMB340_FASTCHG_4000MA      0xf
+
+
+
+#define		DC_INPUT_500MA		0x0
+#define		DC_INPUT_900MA		0x1
+#define		DC_INPUT_1000MA		0x2
+#define		DC_INPUT_1100MA		0x3
+#define		DC_INPUT_1200MA		0x4
+#define		DC_INPUT_1300MA		0x5
+#define		DC_INPUT_1500MA		0x6
+#define		DC_INPUT_1600MA		0x7
+#define		DC_INPUT_1700MA		0x8
+#define		DC_INPUT_1800MA		0x9
+#define		DC_INPUT_2000MA		0xa
+#define		DC_INPUT_2200MA		0xb
+#define		DC_INPUT_2400MA		0xc
+#define		DC_INPUT_2500MA		0xd
+#define		DC_INPUT_3000MA		0xe
+#define		DC_INPUT_3500MA		0xf
+
+#define		PRECHG_CURR_100MA		0x0
+#define		PRECHG_CURR_150MA		0x1
+#define		PRECHG_CURR_200MA		0x2
+#define		PRECHG_CURR_250MA		0x3
+#define		PRECHG_CURR_300MA		0x4
+#define		PRECHG_CURR_350MA		0x5
+#define		PRECHG_CURR_50MA		0x6
+
+#define         SMB340_PRECHG_CURR_200MA	0x0
+#define         SMB340_PRECHG_CURR_300MA	0x1
+#define         SMB340_PRECHG_CURR_400MA	0x2
+#define         SMB340_PRECHG_CURR_500MA	0x3
+#define         SMB340_PRECHG_CURR_600MA	0x4
+#define         SMB340_PRECHG_CURR_700MA	0x5
+#define         SMB340_PRECHG_CURR_100MA	0x6
+
+
+#define		SMB_349		1
+#define		SMB_340		2
+
+enum smb349_thermal_state {
+	STATE_HI_V_SCRN_ON = 1,
+	STATE_LO_V_SCRN_ON,
+	STATE_HI_V_SCRN_OFF,
+	STATE_LO_V_SCRN_OFF,
+};
+
+struct smb349_chg_int_notifier {
+	struct list_head notifier_link;
+	const char *name;
+	void (*func)(int int_reg, int value);
+};
+
+struct smb349_platform_data {
+	int chg_susp_gpio;
+	int chg_current_ma;
+	int chip_rev;
+#ifdef CONFIG_SUPPORT_DQ_BATTERY
+	int dq_result;
+#endif
+	int aicl_result_threshold;
+	int dc_input_max;
+};
+
+struct smb349_charger_batt_param {
+	int max_voltage;
+	int cool_bat_voltage;
+};
+int smb349_set_AICL_mode(unsigned int enable);
+int smb349_allow_fast_charging_setting(void);
+int smb349_allow_volatile_wrtting(void);
+int smb349_enable_charging(bool enable);
+int smb349_eoc_notify(enum htc_extchg_event_type main_event);
+int smb349_event_notify(enum htc_extchg_event_type extchg_event);
+int smb349_temp_notify(enum htc_extchg_event_type main_event);
+int smb349_enable_5v_output(bool mhl_in);
+int smb349_config(void);
+void smb349_dbg(void);
+int  smb349_dump_reg(u8 reg);
+void smb349_partial_reg_dump(void);
+int smb349_dump_all(void);
+int smb349_is_AICL_complete(void);
+int smb349_is_AICL_enabled(void);
+int smb349_is_charger_bit_low_active(void);
+int smb349_is_charger_error(void);
+int smb349_reset_max_chg_vol(enum htc_extchg_event_type main_event);
+int smb349_is_charging_enabled(void);
+int smb349_is_batt_temp_fault_disable_chg(int *result);
+int smb349_get_i2c_slave_id(void);
+int smb349_is_hc_mode(void);
+int smb349_is_usbcs_register_mode(void);
+int smb349_masked_write(int reg, u8 mask, u8 val);
+int smb349_not_allow_charging_cycle_end(void);
+int smb349_enable_pwrsrc(bool enable);
+int smb349_set_pwrsrc_and_charger_enable(enum htc_power_source_type src, bool chg_enable, bool pwrsrc_enable);
+int smb349_set_hc_mode(unsigned int enable);
+int smb349_switch_usbcs_mode(int mode);
+int smb349_limit_charge_enable(bool enable);
+int smb349_get_charging_src(int *result);
+int smb349_get_charging_enabled(int *result);
+int smb349_is_charger_overvoltage(int* result);
+int smb349_charger_get_attr_text(char *buf, int size);
+int smb349_start_charging(void *ctx);
+int smb349_stop_charging(void *ctx);
+bool smb349_is_trickle_charging(void *ctx);
+#endif		
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index fa702ae..b6a6f6c 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -685,6 +685,9 @@
 		const void *txbuf, unsigned n_tx,
 		void *rxbuf, unsigned n_rx);
 
+extern int spi_write_and_read(struct spi_device *spi,
+		u8 *txbuf, u8 *rxbuf, unsigned size);
+
 /**
  * spi_w8r8 - SPI synchronous 8 bit write followed by 8 bit read
  * @spi: device with which data will be exchanged
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 26e5b61..09a545a 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -51,7 +51,8 @@
 struct splice_pipe_desc {
 	struct page **pages;		/* page map */
 	struct partial_page *partial;	/* pages[] may not be contig */
-	int nr_pages;			/* number of pages in map */
+	int nr_pages;			/* number of populated pages in map */
+	unsigned int nr_pages_max;	/* pages[] & partial[] arrays size */
 	unsigned int flags;		/* splice flags */
 	const struct pipe_buf_operations *ops;/* ops associated with output pipe */
 	void (*spd_release)(struct splice_pipe_desc *, unsigned int);
@@ -85,9 +86,8 @@
 /*
  * for dynamic pipe sizing
  */
-extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *);
-extern void splice_shrink_spd(struct pipe_inode_info *,
-				struct splice_pipe_desc *);
+extern int splice_grow_spd(const struct pipe_inode_info *, struct splice_pipe_desc *);
+extern void splice_shrink_spd(struct splice_pipe_desc *);
 extern void spd_release_page(struct splice_pipe_desc *, unsigned int);
 
 extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 51b29ac..2b43e02 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -416,6 +416,7 @@
  */
 int svc_rpcb_setup(struct svc_serv *serv, struct net *net);
 void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net);
+int svc_bind(struct svc_serv *serv, struct net *net);
 struct svc_serv *svc_create(struct svc_program *, unsigned int,
 			    void (*shutdown)(struct svc_serv *, struct net *net));
 struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index 792d16d..47ead51 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -9,13 +9,15 @@
  * get good packing density in that tree, so the index should be dense in
  * the low-order bits.
  *
- * We arrange the `type' and `offset' fields so that `type' is at the five
+ * We arrange the `type' and `offset' fields so that `type' is at the seven
  * high-order bits of the swp_entry_t and `offset' is right-aligned in the
- * remaining bits.
+ * remaining bits.  Although `type' itself needs only five bits, we allow for
+ * shmem/tmpfs to shift it all up a further two bits: see swp_to_radix_entry().
  *
  * swp_entry_t's are *never* stored anywhere in their arch-dependent format.
  */
-#define SWP_TYPE_SHIFT(e)	(sizeof(e.val) * 8 - MAX_SWAPFILES_SHIFT)
+#define SWP_TYPE_SHIFT(e)	((sizeof(e.val) * 8) - \
+			(MAX_SWAPFILES_SHIFT + RADIX_TREE_EXCEPTIONAL_SHIFT))
 #define SWP_OFFSET_MASK(e)	((1UL << SWP_TYPE_SHIFT(e)) - 1)
 
 /*
diff --git a/include/linux/synaptics_i2c_rmi.h b/include/linux/synaptics_i2c_rmi.h
index 5539cc5..e66d982 100644
--- a/include/linux/synaptics_i2c_rmi.h
+++ b/include/linux/synaptics_i2c_rmi.h
@@ -18,6 +18,38 @@
 #define _LINUX_SYNAPTICS_I2C_RMI_H
 
 #define SYNAPTICS_I2C_RMI_NAME "synaptics-rmi-ts"
+#define SYNAPTICS_T1007_NAME "synaptics-t1007"
+#define SYNAPTICS_T1021_NAME "synaptics-t1021"
+#define SYNAPTICS_3K_NAME "synaptics-3k"
+#define SYNAPTICS_3K_INCELL_NAME "synaptics-3k-incell"
+#define SYNAPTICS_3200_NAME "synaptics-3200"
+#define SYNAPTICS_FW_3_2_PACKRAT 1115999
+#define SYNAPTICS_FW_NOCAL_PACKRAT 1293981
+
+
+#define SYN_CONFIG_SIZE 32 * 16
+#define SYN_MAX_PAGE 4
+#define SYN_BL_PAGE 1
+#define SYN_F01DATA_BASEADDR 0x0013
+#define SYN_PROCESS_ERR -1
+
+#define SYN_AND_REPORT_TYPE_A		0
+#define	SYN_AND_REPORT_TYPE_B		1
+#define SYN_AND_REPORT_TYPE_HTC		2
+
+#define TAP_DX_OUTER		0
+#define TAP_DY_OUTER		1
+#define TAP_TIMEOUT		2
+#define TAP_DX_INTER		3
+#define TAP_DY_INTER		4
+
+#define CUS_REG_SIZE		4
+#define CUS_REG_BASE		0
+#define CUS_BALLISTICS_CTRL	1
+#define CUS_LAND_CTRL		2
+#define CUS_LIFT_CTRL		3
+
+#define SENSOR_ID_CHECKING_EN	1 << 16
 
 enum {
 	SYNAPTICS_FLIP_X = 1UL << 0,
@@ -26,11 +58,37 @@
 	SYNAPTICS_SNAP_TO_INACTIVE_EDGE = 1UL << 3,
 };
 
+enum {
+	FINGER_1_REPORT = 1 << 0,
+	FINGER_2_REPORT = 1 << 1,
+};
+
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
+struct synaptics_virtual_key {
+	int index;
+	int keycode;
+	int x_range_min;
+	int x_range_max;
+	int y_range_min;
+	int y_range_max;
+};
+#endif
+
 struct synaptics_i2c_rmi_platform_data {
 	uint32_t version;	/* Use this entry for panels with */
 				/* (major << 8 | minor) version or above. */
 				/* If non-zero another array entry follows */
 	int (*power)(int on);	/* Only valid in first array entry */
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
+	struct synaptics_virtual_key *virtual_key;
+	uint8_t virtual_key_num;
+	struct kobject *vk_obj;
+	struct kobj_attribute *vk2Use;
+	uint8_t sensitivity;
+	uint8_t finger_support;
+	uint32_t gap_area;
+	uint32_t key_area;
+#endif
 	uint32_t flags;
 	unsigned long irqflags;
 	uint32_t inactive_left; /* 0x10000 = screen width */
@@ -47,9 +105,80 @@
 	uint32_t snap_bottom_off; /* 0x10000 = screen height */
 	uint32_t fuzz_x; /* 0x10000 = screen width */
 	uint32_t fuzz_y; /* 0x10000 = screen height */
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
+	int abs_x_min;
+	int abs_x_max;
+	int abs_y_min;
+	int abs_y_max;
+#endif
 	int fuzz_p;
 	int fuzz_w;
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
+	uint32_t display_width;
+	uint32_t display_height;
+#endif
 	int8_t sensitivity_adjust;
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
+	uint32_t dup_threshold;
+	uint32_t margin_inactive_pixel[4];
+	uint16_t filter_level[4];
+	uint8_t reduce_report_level[5];
+	uint8_t noise_information;
+	uint8_t jumpfq_enable;
+	uint8_t cable_support;
+	uint8_t config[SYN_CONFIG_SIZE];
+	int gpio_irq;
+	int gpio_reset;
+	uint8_t default_config;
+	uint8_t report_type;
+	uint8_t large_obj_check;
+	uint16_t tw_pin_mask;
+	uint32_t sensor_id;
+	uint32_t packrat_number;
+	uint8_t support_htc_event;
+	uint8_t mfg_flag;
+	uint8_t customer_register[CUS_REG_SIZE];
+	uint8_t segmentation_bef_unlock;
+	uint8_t threshold_bef_unlock;
+	uint16_t saturation_bef_unlock;
+	uint8_t i2c_err_handler_en;
+	uint8_t energy_ratio_relaxation;
+	uint8_t multitouch_calibration;
+	uint8_t psensor_detection;
+	uint8_t PixelTouchThreshold_bef_unlock;
+#endif
 };
 
+#ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
+struct page_description {
+	uint8_t addr;
+	uint8_t value;
+};
+
+struct syn_finger_data {
+	int x;
+	int y;
+	int w;
+	int z;
+};
+
+struct function_t {
+	uint8_t function_type;
+	uint8_t interrupt_source;
+	uint16_t data_base;
+	uint16_t control_base;
+	uint16_t command_base;
+	uint16_t query_base;
+};
+enum {
+	QUERY_BASE,
+	COMMAND_BASE,
+	CONTROL_BASE,
+	DATA_BASE,
+	INTR_SOURCE,
+	FUNCTION
+};
+
+extern uint8_t getPowerKeyState(void);
+#endif /* CONFIG_TOUCHSCREEN_SYNAPTICS_3K */
 #endif /* _LINUX_SYNAPTICS_I2C_RMI_H */
diff --git a/include/linux/time.h b/include/linux/time.h
index 33a92ea..8da5129 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -258,14 +258,6 @@
 
 #endif /* __KERNEL__ */
 
-#define NFDBITS			__NFDBITS
-
-#define FD_SETSIZE		__FD_SETSIZE
-#define FD_SET(fd,fdsetp)	__FD_SET(fd,fdsetp)
-#define FD_CLR(fd,fdsetp)	__FD_CLR(fd,fdsetp)
-#define FD_ISSET(fd,fdsetp)	__FD_ISSET(fd,fdsetp)
-#define FD_ZERO(fdsetp)		__FD_ZERO(fdsetp)
-
 /*
  * Names of the interval timers, and structure
  * defining a timer setting:
diff --git a/include/linux/usb.h b/include/linux/usb.h
index e8114f0..5c9b683 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -839,6 +839,27 @@
 	.bInterfaceSubClass = (sc), \
 	.bInterfaceProtocol = (pr)
 
+/**
+ * USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces
+ * @vend: the 16 bit USB Vendor ID
+ * @cl: bInterfaceClass value
+ * @sc: bInterfaceSubClass value
+ * @pr: bInterfaceProtocol value
+ *
+ * This macro is used to create a struct usb_device_id that matches a
+ * specific vendor with a specific class of interfaces.
+ *
+ * This is especially useful when explicitly matching devices that have
+ * vendor specific bDeviceClass values, but standards-compliant interfaces.
+ */
+#define USB_VENDOR_AND_INTERFACE_INFO(vend, cl, sc, pr) \
+	.match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
+		| USB_DEVICE_ID_MATCH_VENDOR, \
+	.idVendor = (vend), \
+	.bInterfaceClass = (cl), \
+	.bInterfaceSubClass = (sc), \
+	.bInterfaceProtocol = (pr)
+
 /* ----------------------------------------------------------------------- */
 
 /* Stuff for dynamic usb ids */
@@ -1435,6 +1456,7 @@
 extern void usb_kill_urb(struct urb *urb);
 extern void usb_poison_urb(struct urb *urb);
 extern void usb_unpoison_urb(struct urb *urb);
+extern void usb_block_urb(struct urb *urb);
 extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
 extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
 extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
@@ -1447,6 +1469,8 @@
 extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
 extern int usb_anchor_empty(struct usb_anchor *anchor);
 
+#define usb_unblock_urb	usb_unpoison_urb
+
 /**
  * usb_urb_dir_in - check if an URB describes an IN transfer
  * @urb: URB to be checked
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index a2c6424..961d7c7 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -126,8 +126,6 @@
 	unsigned		wireless:1;	/* Wireless USB HCD */
 	unsigned		authorized_default:1;
 	unsigned		has_tt:1;	/* Integrated TT in root hub */
-	unsigned		broken_pci_sleep:1;	/* Don't put the
-			controller in PCI-D3 for system sleep */
 
 	unsigned int		irq;		/* irq allocated */
 	void __iomem		*regs;		/* device memory/io */
diff --git a/include/linux/usb/htc_info.h b/include/linux/usb/htc_info.h
new file mode 100644
index 0000000..5646aa6
--- /dev/null
+++ b/include/linux/usb/htc_info.h
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2011 HTC, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __HTC_INFO__
+#define __HTC_INFO__
+
+#include <mach/board.h>
+struct usb_info {
+	int *phy_init_seq;
+	void (*phy_reset)(void);
+	void (*hw_reset)(bool en);
+	void (*usb_uart_switch)(int);
+	void (*serial_debug_gpios)(int);
+	void (*usb_hub_enable)(bool);
+	int (*china_ac_detect)(void);
+	void (*disable_usb_charger)(void);
+	void (*change_phy_voltage)(int);
+	int (*ldo_init) (int init);
+	int (*ldo_enable) (int enable);
+	void (*usb_mhl_switch)(bool);
+
+	
+	int connect_type_ready;
+	void (*usb_connected)(int);
+
+	enum usb_connect_type connect_type;
+	struct delayed_work chg_stop;
+};
+
+extern ssize_t otg_show_usb_phy_setting(char *buf);
+extern ssize_t otg_store_usb_phy_setting(const char *buf, size_t count);
+
+extern int usb_get_connect_type(void);
+extern int android_switch_function(unsigned func);
+extern int android_show_function(char *buf);
+extern void android_set_serialno(char *serialno);
+extern void android_force_reset(void);
+extern int htc_usb_enable_function(char *name, int ebl);
+
+extern void htc_mode_enable(int enable);
+extern int check_htc_mode_status(void);
+extern void android_switch_default(void);
+extern void android_switch_htc_mode(void);
+
+#ifdef err
+#undef err
+#endif
+#ifdef warn
+#undef warn
+#endif
+#ifdef info
+#undef info
+#endif
+
+#define USB_ERR(fmt, args...) \
+	printk(KERN_ERR "[USB:ERR] " fmt, ## args)
+#define USB_WARNING(fmt, args...) \
+	printk(KERN_WARNING "[USB] " fmt, ## args)
+#define USB_INFO(fmt, args...) \
+	printk(KERN_INFO "[USB] " fmt, ## args)
+#define USB_DEBUG(fmt, args...) \
+	printk(KERN_DEBUG "[USB] " fmt, ## args)
+
+#define USBH_ERR(fmt, args...) \
+	printk(KERN_ERR "[USBH:ERR] " fmt, ## args)
+#define USBH_WARNING(fmt, args...) \
+	printk(KERN_WARNING "[USBH] " fmt, ## args)
+#define USBH_INFO(fmt, args...) \
+	printk(KERN_INFO "[USBH] " fmt, ## args)
+#define USBH_DEBUG(fmt, args...) \
+	printk(KERN_DEBUG "[USBH] " fmt, ## args)
+
+#ifdef dev_err
+#undef dev_err
+#endif
+#define dev_err(dev, fmt, args...) \
+	printk(KERN_ERR "[USB] " pr_fmt(fmt), ## args)
+
+#ifdef dev_dbg
+#undef dev_dbg
+#endif
+#define dev_dbg(dev, fmt, args...) \
+	printk(KERN_INFO "[USB] " pr_fmt(fmt), ## args)
+
+#ifdef dev_info
+#undef dev_info
+#endif
+#define dev_info(dev, fmt, args...) \
+	printk(KERN_INFO "[USB] " pr_fmt(fmt), ## args)
+
+#ifdef pr_debug
+#undef pr_debug
+#endif
+#define pr_debug(fmt, args...) \
+	printk(KERN_INFO "[USB] " pr_fmt(fmt), ## args)
+
+#ifdef pr_err
+#undef pr_err
+#endif
+#define pr_err(fmt, args...) \
+	printk(KERN_ERR "[USB] " pr_fmt(fmt), ## args)
+
+#ifdef pr_info
+#undef pr_info
+#endif
+#define pr_info(fmt, args...) \
+	printk(KERN_INFO "[USB] " pr_fmt(fmt), ## args)
+
+#endif 
+
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 61c9460..aaf0a05 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -23,6 +23,9 @@
 #include <linux/usb/gadget.h>
 #include <linux/usb/otg.h>
 #include <linux/wakelock.h>
+#ifdef CONFIG_MACH_HTC
+#include <mach/board.h>
+#endif
 #include <linux/pm_qos.h>
 #include <linux/hrtimer.h>
 
@@ -174,6 +177,9 @@
 	VDD_VAL_MAX,
 };
 
+#define POWER_COLLAPSE_LDO3V3	(1 << 0) /* Regulator L3 */
+#define POWER_COLLAPSE_LDO1V8	(1 << 1) /* Regulator L4 */
+
 /**
  * struct msm_otg_platform_data - platform device data
  *              for msm_otg driver.
@@ -213,10 +219,19 @@
 	unsigned int mpm_otgsessvld_int;
 	bool mhl_enable;
 	bool disable_reset_on_disconnect;
+#ifdef CONFIG_MACH_HTC
+        bool enable_dcd;
+#endif
 	bool enable_lpm_on_dev_suspend;
 	bool core_clk_always_on_workaround;
 	struct msm_bus_scale_pdata *bus_scale_table;
+#ifdef CONFIG_MACH_HTC
+	int reset_phy_before_lpm;
+	void (*usb_uart_switch)(int uart);
+	int ldo_power_collapse;
+#else
 	const char *mhl_dev_name;
+#endif
 };
 
 /* Timeout (in msec) values (min - max) associated with OTG timers */
@@ -295,7 +310,9 @@
 	struct usb_phy phy;
 	struct msm_otg_platform_data *pdata;
 	int irq;
+#ifndef CONFIG_MACH_HTC
 	int async_irq;
+#endif
 	struct clk *clk;
 	struct clk *pclk;
 	struct clk *phy_reset_clk;
@@ -318,7 +335,9 @@
 #define A_BUS_SUSPEND	14
 #define A_CONN		15
 #define B_BUS_REQ	16
+#ifndef CONFIG_MACH_HTC
 #define MHL	        17
+#endif
 	unsigned long inputs;
 	struct work_struct sm_work;
 	bool sm_work_pending;
@@ -328,18 +347,26 @@
 	unsigned cur_power;
 	struct delayed_work chg_work;
 	struct delayed_work pmic_id_status_work;
+#ifndef CONFIG_MACH_HTC
 	struct delayed_work check_ta_work;
+#endif
 	enum usb_chg_state chg_state;
 	enum usb_chg_type chg_type;
 	unsigned dcd_time;
 	struct wake_lock wlock;
+#ifdef CONFIG_MACH_HTC
+	struct wake_lock usb_otg_wlock;
+	struct wake_lock cable_detect_wlock;
+#endif
 	struct notifier_block usbdev_nb;
 	unsigned mA_port;
 	struct timer_list id_timer;
 	unsigned long caps;
 	struct msm_xo_voter *xo_handle;
 	uint32_t bus_perf_client;
+#ifndef CONFIG_MACH_HTC
 	bool mhl_enabled;
+#endif
 	/*
 	 * Allowing PHY power collpase turns off the HSUSB 3.3v and 1.8v
 	 * analog regulators while going to low power mode.
@@ -362,7 +389,18 @@
 #define PHY_PWR_COLLAPSED		BIT(0)
 #define PHY_RETENTIONED			BIT(1)
 #define XO_SHUTDOWN			BIT(2)
+#ifndef CONFIG_MACH_HTC
 #define CLOCKS_DOWN			BIT(3)
+#endif
+#ifdef CONFIG_MACH_HTC
+	struct work_struct notifier_work;
+	enum usb_connect_type connect_type;
+	int connect_type_ready;
+	struct workqueue_struct *usb_wq;
+	struct delayed_work ac_detect_work;
+	int ac_detect_count;
+	int reset_phy_before_lpm;
+#endif
 	int reset_counter;
 	unsigned long b_last_se0_sess;
 	unsigned long tmouts;
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index ae3ffe4..a584d24 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -61,6 +61,12 @@
 	 * within TB_SRP_FAIL time.
 	 */
 	OTG_EVENT_NO_RESP_FOR_SRP,
+#ifdef CONFIG_MACH_HTC
+	/* broadcast uevent when device vbus ouput is
+	    lower than the repuirement of otg device.
+	*/
+	OTG_EVENT_INSUFFICIENT_POWER,
+#endif
 };
 
 enum usb_phy_events {
@@ -149,6 +155,13 @@
 	int	(*set_suspend)(struct usb_phy *x,
 				int suspend);
 
+#ifdef CONFIG_MACH_HTC
+	/* send events to user space */
+	int	(*send_event)(struct usb_phy *phy,
+			enum usb_otg_event event);
+
+	void	(*notify_usb_attached)(void);
+#endif
 };
 
 
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 498a762..1639106 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -57,7 +57,7 @@
 #define __LINUX_VIDEODEV2_H
 
 #ifdef __KERNEL__
-#include <linux/time.h>     /* need struct timeval */
+#include <linux/time.h>     
 #else
 #include <sys/time.h>
 #endif
@@ -65,65 +65,43 @@
 #include <linux/ioctl.h>
 #include <linux/types.h>
 
-/*
- * Common stuff for both V4L1 and V4L2
- * Moved from videodev.h
- */
 #define VIDEO_MAX_FRAME               32
 #define VIDEO_MAX_PLANES               8
 
 #ifndef __KERNEL__
 
-/* These defines are V4L1 specific and should not be used with the V4L2 API!
-   They will be removed from this header in the future. */
 
-#define VID_TYPE_CAPTURE	1	/* Can capture */
-#define VID_TYPE_TUNER		2	/* Can tune */
-#define VID_TYPE_TELETEXT	4	/* Does teletext */
-#define VID_TYPE_OVERLAY	8	/* Overlay onto frame buffer */
-#define VID_TYPE_CHROMAKEY	16	/* Overlay by chromakey */
-#define VID_TYPE_CLIPPING	32	/* Can clip */
-#define VID_TYPE_FRAMERAM	64	/* Uses the frame buffer memory */
-#define VID_TYPE_SCALES		128	/* Scalable */
-#define VID_TYPE_MONOCHROME	256	/* Monochrome only */
-#define VID_TYPE_SUBCAPTURE	512	/* Can capture subareas of the image */
-#define VID_TYPE_MPEG_DECODER	1024	/* Can decode MPEG streams */
-#define VID_TYPE_MPEG_ENCODER	2048	/* Can encode MPEG streams */
-#define VID_TYPE_MJPEG_DECODER	4096	/* Can decode MJPEG streams */
-#define VID_TYPE_MJPEG_ENCODER	8192	/* Can encode MJPEG streams */
+#define VID_TYPE_CAPTURE	1	
+#define VID_TYPE_TUNER		2	
+#define VID_TYPE_TELETEXT	4	
+#define VID_TYPE_OVERLAY	8	
+#define VID_TYPE_CHROMAKEY	16	
+#define VID_TYPE_CLIPPING	32	
+#define VID_TYPE_FRAMERAM	64	
+#define VID_TYPE_SCALES		128	
+#define VID_TYPE_MONOCHROME	256	
+#define VID_TYPE_SUBCAPTURE	512	
+#define VID_TYPE_MPEG_DECODER	1024	
+#define VID_TYPE_MPEG_ENCODER	2048	
+#define VID_TYPE_MJPEG_DECODER	4096	
+#define VID_TYPE_MJPEG_ENCODER	8192	
 #endif
 
-/*
- *	M I S C E L L A N E O U S
- */
 
-/*  Four-character-code (FOURCC) */
 #define v4l2_fourcc(a, b, c, d)\
 	((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
 
-/*
- *	E N U M S
- */
 enum v4l2_field {
-	V4L2_FIELD_ANY           = 0, /* driver can choose from none,
-					 top, bottom, interlaced
-					 depending on whatever it thinks
-					 is approximate ... */
-	V4L2_FIELD_NONE          = 1, /* this device has no fields ... */
-	V4L2_FIELD_TOP           = 2, /* top field only */
-	V4L2_FIELD_BOTTOM        = 3, /* bottom field only */
-	V4L2_FIELD_INTERLACED    = 4, /* both fields interlaced */
-	V4L2_FIELD_SEQ_TB        = 5, /* both fields sequential into one
-					 buffer, top-bottom order */
-	V4L2_FIELD_SEQ_BT        = 6, /* same as above + bottom-top order */
-	V4L2_FIELD_ALTERNATE     = 7, /* both fields alternating into
-					 separate buffers */
-	V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field
-					 first and the top field is
-					 transmitted first */
-	V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field
-					 first and the bottom field is
-					 transmitted first */
+	V4L2_FIELD_ANY           = 0, 
+	V4L2_FIELD_NONE          = 1, 
+	V4L2_FIELD_TOP           = 2, 
+	V4L2_FIELD_BOTTOM        = 3, 
+	V4L2_FIELD_INTERLACED    = 4, 
+	V4L2_FIELD_SEQ_TB        = 5, 
+	V4L2_FIELD_SEQ_BT        = 6, 
+	V4L2_FIELD_ALTERNATE     = 7, 
+	V4L2_FIELD_INTERLACED_TB = 8, 
+	V4L2_FIELD_INTERLACED_BT = 9, 
 };
 #define V4L2_FIELD_HAS_TOP(field)	\
 	((field) == V4L2_FIELD_TOP 	||\
@@ -155,7 +133,7 @@
 	V4L2_BUF_TYPE_SLICED_VBI_CAPTURE   = 6,
 	V4L2_BUF_TYPE_SLICED_VBI_OUTPUT    = 7,
 #if 1
-	/* Experimental */
+	
 	V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
 #endif
 	V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
@@ -187,36 +165,31 @@
 	V4L2_MEMORY_OVERLAY          = 3,
 };
 
-/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
 enum v4l2_colorspace {
-	/* ITU-R 601 -- broadcast NTSC/PAL */
+	
 	V4L2_COLORSPACE_SMPTE170M     = 1,
 
-	/* 1125-Line (US) HDTV */
+	
 	V4L2_COLORSPACE_SMPTE240M     = 2,
 
-	/* HD and modern captures. */
+	
 	V4L2_COLORSPACE_REC709        = 3,
 
-	/* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
+	
 	V4L2_COLORSPACE_BT878         = 4,
 
-	/* These should be useful.  Assume 601 extents. */
+	
 	V4L2_COLORSPACE_470_SYSTEM_M  = 5,
 	V4L2_COLORSPACE_470_SYSTEM_BG = 6,
 
-	/* I know there will be cameras that send this.  So, this is
-	 * unspecified chromaticities and full 0-255 on each of the
-	 * Y'CbCr components
-	 */
 	V4L2_COLORSPACE_JPEG          = 7,
 
-	/* For RGB colourspaces, this is probably a good start. */
+	
 	V4L2_COLORSPACE_SRGB          = 8,
 };
 
 enum v4l2_priority {
-	V4L2_PRIORITY_UNSET       = 0,  /* not initialized */
+	V4L2_PRIORITY_UNSET       = 0,  
 	V4L2_PRIORITY_BACKGROUND  = 1,
 	V4L2_PRIORITY_INTERACTIVE = 2,
 	V4L2_PRIORITY_RECORD      = 3,
@@ -235,231 +208,164 @@
 	__u32   denominator;
 };
 
-/**
-  * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP
-  *
-  * @driver:	   name of the driver module (e.g. "bttv")
-  * @card:	   name of the card (e.g. "Hauppauge WinTV")
-  * @bus_info:	   name of the bus (e.g. "PCI:" + pci_name(pci_dev) )
-  * @version:	   KERNEL_VERSION
-  * @capabilities: capabilities of the physical device as a whole
-  * @device_caps:  capabilities accessed via this particular device (node)
-  * @reserved:	   reserved fields for future extensions
-  */
 struct v4l2_capability {
-	__u8	driver[16];
-	__u8	card[32];
-	__u8	bus_info[32];
-	__u32   version;
-	__u32	capabilities;
-	__u32	device_caps;
-	__u32	reserved[3];
+	__u8	driver[16];	
+	__u8	card[32];	
+	__u8	bus_info[32];	
+	__u32   version;        
+	__u32	capabilities;	
+	__u32	reserved[4];
 };
 
-/* Values for 'capabilities' field */
-#define V4L2_CAP_VIDEO_CAPTURE		0x00000001  /* Is a video capture device */
-#define V4L2_CAP_VIDEO_OUTPUT		0x00000002  /* Is a video output device */
-#define V4L2_CAP_VIDEO_OVERLAY		0x00000004  /* Can do video overlay */
-#define V4L2_CAP_VBI_CAPTURE		0x00000010  /* Is a raw VBI capture device */
-#define V4L2_CAP_VBI_OUTPUT		0x00000020  /* Is a raw VBI output device */
-#define V4L2_CAP_SLICED_VBI_CAPTURE	0x00000040  /* Is a sliced VBI capture device */
-#define V4L2_CAP_SLICED_VBI_OUTPUT	0x00000080  /* Is a sliced VBI output device */
-#define V4L2_CAP_RDS_CAPTURE		0x00000100  /* RDS data capture */
-#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY	0x00000200  /* Can do video output overlay */
-#define V4L2_CAP_HW_FREQ_SEEK		0x00000400  /* Can do hardware frequency seek  */
-#define V4L2_CAP_RDS_OUTPUT		0x00000800  /* Is an RDS encoder */
+#define V4L2_CAP_VIDEO_CAPTURE		0x00000001  
+#define V4L2_CAP_VIDEO_OUTPUT		0x00000002  
+#define V4L2_CAP_VIDEO_OVERLAY		0x00000004  
+#define V4L2_CAP_VBI_CAPTURE		0x00000010  
+#define V4L2_CAP_VBI_OUTPUT		0x00000020  
+#define V4L2_CAP_SLICED_VBI_CAPTURE	0x00000040  
+#define V4L2_CAP_SLICED_VBI_OUTPUT	0x00000080  
+#define V4L2_CAP_RDS_CAPTURE		0x00000100  
+#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY	0x00000200  
+#define V4L2_CAP_HW_FREQ_SEEK		0x00000400  
+#define V4L2_CAP_RDS_OUTPUT		0x00000800  
 
-/* Is a video capture device that supports multiplanar formats */
 #define V4L2_CAP_VIDEO_CAPTURE_MPLANE	0x00001000
-/* Is a video output device that supports multiplanar formats */
 #define V4L2_CAP_VIDEO_OUTPUT_MPLANE	0x00002000
 
-#define V4L2_CAP_TUNER			0x00010000  /* has a tuner */
-#define V4L2_CAP_AUDIO			0x00020000  /* has audio support */
-#define V4L2_CAP_RADIO			0x00040000  /* is a radio device */
-#define V4L2_CAP_MODULATOR		0x00080000  /* has a modulator */
+#define V4L2_CAP_TUNER			0x00010000  
+#define V4L2_CAP_AUDIO			0x00020000  
+#define V4L2_CAP_RADIO			0x00040000  
+#define V4L2_CAP_MODULATOR		0x00080000  
 
-#define V4L2_CAP_READWRITE              0x01000000  /* read/write systemcalls */
-#define V4L2_CAP_ASYNCIO                0x02000000  /* async I/O */
-#define V4L2_CAP_STREAMING              0x04000000  /* streaming I/O ioctls */
+#define V4L2_CAP_READWRITE              0x01000000  
+#define V4L2_CAP_ASYNCIO                0x02000000  
+#define V4L2_CAP_STREAMING              0x04000000  
 
-#define V4L2_CAP_DEVICE_CAPS            0x80000000  /* sets device capabilities field */
-
-/*
- *	V I D E O   I M A G E   F O R M A T
- */
 struct v4l2_pix_format {
 	__u32         		width;
 	__u32			height;
 	__u32			pixelformat;
 	enum v4l2_field  	field;
-	__u32            	bytesperline;	/* for padding, zero if unused */
+	__u32            	bytesperline;	
 	__u32          		sizeimage;
 	enum v4l2_colorspace	colorspace;
-	__u32			priv;		/* private data, depends on pixelformat */
+	__u32			priv;		
 };
 
-/*      Pixel format         FOURCC                          depth  Description  */
 
-/* RGB formats */
-#define V4L2_PIX_FMT_RGB332  v4l2_fourcc('R', 'G', 'B', '1') /*  8  RGB-3-3-2     */
-#define V4L2_PIX_FMT_RGB444  v4l2_fourcc('R', '4', '4', '4') /* 16  xxxxrrrr ggggbbbb */
-#define V4L2_PIX_FMT_RGB555  v4l2_fourcc('R', 'G', 'B', 'O') /* 16  RGB-5-5-5     */
-#define V4L2_PIX_FMT_RGB565  v4l2_fourcc('R', 'G', 'B', 'P') /* 16  RGB-5-6-5     */
-#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16  RGB-5-5-5 BE  */
-#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16  RGB-5-6-5 BE  */
-#define V4L2_PIX_FMT_BGR666  v4l2_fourcc('B', 'G', 'R', 'H') /* 18  BGR-6-6-6	  */
-#define V4L2_PIX_FMT_BGR24   v4l2_fourcc('B', 'G', 'R', '3') /* 24  BGR-8-8-8     */
-#define V4L2_PIX_FMT_RGB24   v4l2_fourcc('R', 'G', 'B', '3') /* 24  RGB-8-8-8     */
-#define V4L2_PIX_FMT_BGR32   v4l2_fourcc('B', 'G', 'R', '4') /* 32  BGR-8-8-8-8   */
-#define V4L2_PIX_FMT_RGB32   v4l2_fourcc('R', 'G', 'B', '4') /* 32  RGB-8-8-8-8   */
+#define V4L2_PIX_FMT_RGB332  v4l2_fourcc('R', 'G', 'B', '1') 
+#define V4L2_PIX_FMT_RGB444  v4l2_fourcc('R', '4', '4', '4') 
+#define V4L2_PIX_FMT_RGB555  v4l2_fourcc('R', 'G', 'B', 'O') 
+#define V4L2_PIX_FMT_RGB565  v4l2_fourcc('R', 'G', 'B', 'P') 
+#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') 
+#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') 
+#define V4L2_PIX_FMT_BGR666  v4l2_fourcc('B', 'G', 'R', 'H') 
+#define V4L2_PIX_FMT_BGR24   v4l2_fourcc('B', 'G', 'R', '3') 
+#define V4L2_PIX_FMT_RGB24   v4l2_fourcc('R', 'G', 'B', '3') 
+#define V4L2_PIX_FMT_BGR32   v4l2_fourcc('B', 'G', 'R', '4') 
+#define V4L2_PIX_FMT_RGB32   v4l2_fourcc('R', 'G', 'B', '4') 
 
-/* Grey formats */
-#define V4L2_PIX_FMT_GREY    v4l2_fourcc('G', 'R', 'E', 'Y') /*  8  Greyscale     */
-#define V4L2_PIX_FMT_Y4      v4l2_fourcc('Y', '0', '4', ' ') /*  4  Greyscale     */
-#define V4L2_PIX_FMT_Y6      v4l2_fourcc('Y', '0', '6', ' ') /*  6  Greyscale     */
-#define V4L2_PIX_FMT_Y10     v4l2_fourcc('Y', '1', '0', ' ') /* 10  Greyscale     */
-#define V4L2_PIX_FMT_Y12     v4l2_fourcc('Y', '1', '2', ' ') /* 12  Greyscale     */
-#define V4L2_PIX_FMT_Y16     v4l2_fourcc('Y', '1', '6', ' ') /* 16  Greyscale     */
+#define V4L2_PIX_FMT_GREY    v4l2_fourcc('G', 'R', 'E', 'Y') 
+#define V4L2_PIX_FMT_Y4      v4l2_fourcc('Y', '0', '4', ' ') 
+#define V4L2_PIX_FMT_Y6      v4l2_fourcc('Y', '0', '6', ' ') 
+#define V4L2_PIX_FMT_Y10     v4l2_fourcc('Y', '1', '0', ' ') 
+#define V4L2_PIX_FMT_Y12     v4l2_fourcc('Y', '1', '2', ' ') 
+#define V4L2_PIX_FMT_Y16     v4l2_fourcc('Y', '1', '6', ' ') 
 
-/* Grey bit-packed formats */
-#define V4L2_PIX_FMT_Y10BPACK    v4l2_fourcc('Y', '1', '0', 'B') /* 10  Greyscale bit-packed */
+#define V4L2_PIX_FMT_Y10BPACK    v4l2_fourcc('Y', '1', '0', 'B') 
 
-/* Palette formats */
-#define V4L2_PIX_FMT_PAL8    v4l2_fourcc('P', 'A', 'L', '8') /*  8  8-bit palette */
+#define V4L2_PIX_FMT_PAL8    v4l2_fourcc('P', 'A', 'L', '8') 
 
-/* Luminance+Chrominance formats */
-#define V4L2_PIX_FMT_YVU410  v4l2_fourcc('Y', 'V', 'U', '9') /*  9  YVU 4:1:0     */
-#define V4L2_PIX_FMT_YVU420  v4l2_fourcc('Y', 'V', '1', '2') /* 12  YVU 4:2:0     */
-#define V4L2_PIX_FMT_YUYV    v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16  YUV 4:2:2     */
-#define V4L2_PIX_FMT_YYUV    v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16  YUV 4:2:2     */
-#define V4L2_PIX_FMT_YVYU    v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
-#define V4L2_PIX_FMT_UYVY    v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16  YUV 4:2:2     */
-#define V4L2_PIX_FMT_VYUY    v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16  YUV 4:2:2     */
-#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16  YVU422 planar */
-#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16  YVU411 planar */
-#define V4L2_PIX_FMT_Y41P    v4l2_fourcc('Y', '4', '1', 'P') /* 12  YUV 4:1:1     */
-#define V4L2_PIX_FMT_YUV444  v4l2_fourcc('Y', '4', '4', '4') /* 16  xxxxyyyy uuuuvvvv */
-#define V4L2_PIX_FMT_YUV555  v4l2_fourcc('Y', 'U', 'V', 'O') /* 16  YUV-5-5-5     */
-#define V4L2_PIX_FMT_YUV565  v4l2_fourcc('Y', 'U', 'V', 'P') /* 16  YUV-5-6-5     */
-#define V4L2_PIX_FMT_YUV32   v4l2_fourcc('Y', 'U', 'V', '4') /* 32  YUV-8-8-8-8   */
-#define V4L2_PIX_FMT_YUV410  v4l2_fourcc('Y', 'U', 'V', '9') /*  9  YUV 4:1:0     */
-#define V4L2_PIX_FMT_YUV420  v4l2_fourcc('Y', 'U', '1', '2') /* 12  YUV 4:2:0     */
-#define V4L2_PIX_FMT_HI240   v4l2_fourcc('H', 'I', '2', '4') /*  8  8-bit color   */
-#define V4L2_PIX_FMT_HM12    v4l2_fourcc('H', 'M', '1', '2') /*  8  YUV 4:2:0 16x16 macroblocks */
-#define V4L2_PIX_FMT_M420    v4l2_fourcc('M', '4', '2', '0') /* 12  YUV 4:2:0 2 lines y, 1 line uv interleaved */
+#define V4L2_PIX_FMT_YVU410  v4l2_fourcc('Y', 'V', 'U', '9') 
+#define V4L2_PIX_FMT_YVU420  v4l2_fourcc('Y', 'V', '1', '2') 
+#define V4L2_PIX_FMT_YUYV    v4l2_fourcc('Y', 'U', 'Y', 'V') 
+#define V4L2_PIX_FMT_YYUV    v4l2_fourcc('Y', 'Y', 'U', 'V') 
+#define V4L2_PIX_FMT_YVYU    v4l2_fourcc('Y', 'V', 'Y', 'U') 
+#define V4L2_PIX_FMT_UYVY    v4l2_fourcc('U', 'Y', 'V', 'Y') 
+#define V4L2_PIX_FMT_VYUY    v4l2_fourcc('V', 'Y', 'U', 'Y') 
+#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') 
+#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') 
+#define V4L2_PIX_FMT_Y41P    v4l2_fourcc('Y', '4', '1', 'P') 
+#define V4L2_PIX_FMT_YUV444  v4l2_fourcc('Y', '4', '4', '4') 
+#define V4L2_PIX_FMT_YUV555  v4l2_fourcc('Y', 'U', 'V', 'O') 
+#define V4L2_PIX_FMT_YUV565  v4l2_fourcc('Y', 'U', 'V', 'P') 
+#define V4L2_PIX_FMT_YUV32   v4l2_fourcc('Y', 'U', 'V', '4') 
+#define V4L2_PIX_FMT_YUV410  v4l2_fourcc('Y', 'U', 'V', '9') 
+#define V4L2_PIX_FMT_YUV420  v4l2_fourcc('Y', 'U', '1', '2') 
+#define V4L2_PIX_FMT_HI240   v4l2_fourcc('H', 'I', '2', '4') 
+#define V4L2_PIX_FMT_HM12    v4l2_fourcc('H', 'M', '1', '2') 
+#define V4L2_PIX_FMT_M420    v4l2_fourcc('M', '4', '2', '0') 
 
-/* two planes -- one Y, one Cr + Cb interleaved  */
-#define V4L2_PIX_FMT_NV12    v4l2_fourcc('N', 'V', '1', '2') /* 12  Y/CbCr 4:2:0  */
-#define V4L2_PIX_FMT_NV21    v4l2_fourcc('N', 'V', '2', '1') /* 12  Y/CrCb 4:2:0  */
-#define V4L2_PIX_FMT_NV16    v4l2_fourcc('N', 'V', '1', '6') /* 16  Y/CbCr 4:2:2  */
-#define V4L2_PIX_FMT_NV61    v4l2_fourcc('N', 'V', '6', '1') /* 16  Y/CrCb 4:2:2  */
-#define V4L2_PIX_FMT_NV24    v4l2_fourcc('N', 'V', '2', '4') /* 24  Y/CbCr 4:4:4  */
-#define V4L2_PIX_FMT_NV42    v4l2_fourcc('N', 'V', '4', '2') /* 24  Y/CrCb 4:4:4  */
+#define V4L2_PIX_FMT_NV12    v4l2_fourcc('N', 'V', '1', '2') 
+#define V4L2_PIX_FMT_NV21    v4l2_fourcc('N', 'V', '2', '1') 
+#define V4L2_PIX_FMT_NV16    v4l2_fourcc('N', 'V', '1', '6') 
+#define V4L2_PIX_FMT_NV61    v4l2_fourcc('N', 'V', '6', '1') 
 
-/* two non contiguous planes - one Y, one Cr + Cb interleaved  */
-#define V4L2_PIX_FMT_NV12M   v4l2_fourcc('N', 'M', '1', '2') /* 12  Y/CbCr 4:2:0  */
-#define V4L2_PIX_FMT_NV12MT  v4l2_fourcc('T', 'M', '1', '2') /* 12  Y/CbCr 4:2:0 64x32 macroblocks */
+#define V4L2_PIX_FMT_NV12M   v4l2_fourcc('N', 'M', '1', '2') 
+#define V4L2_PIX_FMT_NV12MT  v4l2_fourcc('T', 'M', '1', '2') 
 
-/* three non contiguous planes - Y, Cb, Cr */
-#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12  YUV420 planar */
+#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') 
 
-/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
-#define V4L2_PIX_FMT_SBGGR8  v4l2_fourcc('B', 'A', '8', '1') /*  8  BGBG.. GRGR.. */
-#define V4L2_PIX_FMT_SGBRG8  v4l2_fourcc('G', 'B', 'R', 'G') /*  8  GBGB.. RGRG.. */
-#define V4L2_PIX_FMT_SGRBG8  v4l2_fourcc('G', 'R', 'B', 'G') /*  8  GRGR.. BGBG.. */
-#define V4L2_PIX_FMT_SRGGB8  v4l2_fourcc('R', 'G', 'G', 'B') /*  8  RGRG.. GBGB.. */
-#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10  BGBG.. GRGR.. */
-#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10  GBGB.. RGRG.. */
-#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10  GRGR.. BGBG.. */
-#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10  RGRG.. GBGB.. */
-#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12  BGBG.. GRGR.. */
-#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12  GBGB.. RGRG.. */
-#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12  GRGR.. BGBG.. */
-#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12  RGRG.. GBGB.. */
-	/* 10bit raw bayer DPCM compressed to 8 bits */
+#define V4L2_PIX_FMT_SBGGR8  v4l2_fourcc('B', 'A', '8', '1') 
+#define V4L2_PIX_FMT_SGBRG8  v4l2_fourcc('G', 'B', 'R', 'G') 
+#define V4L2_PIX_FMT_SGRBG8  v4l2_fourcc('G', 'R', 'B', 'G') 
+#define V4L2_PIX_FMT_SRGGB8  v4l2_fourcc('R', 'G', 'G', 'B') 
+#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') 
+#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') 
+#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') 
+#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') 
+#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') 
+#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') 
+#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') 
+#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') 
+	
 #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
-	/*
-	 * 10bit raw bayer, expanded to 16 bits
-	 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
-	 */
-#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') 
 
-/* compressed formats */
-#define V4L2_PIX_FMT_MJPEG    v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG   */
-#define V4L2_PIX_FMT_JPEG     v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG     */
-#define V4L2_PIX_FMT_DV       v4l2_fourcc('d', 'v', 's', 'd') /* 1394          */
-#define V4L2_PIX_FMT_MPEG     v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */
-#define V4L2_PIX_FMT_H264     v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */
-#define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */
-#define V4L2_PIX_FMT_H263     v4l2_fourcc('H', '2', '6', '3') /* H263          */
-#define V4L2_PIX_FMT_MPEG1    v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES     */
-#define V4L2_PIX_FMT_MPEG2    v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES     */
-#define V4L2_PIX_FMT_MPEG4    v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 ES     */
-#define V4L2_PIX_FMT_XVID     v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid           */
-#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
-#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
-#define V4L2_PIX_FMT_DIVX_311  v4l2_fourcc('D', 'I', 'V', '3') /* DIVX311     */
-#define V4L2_PIX_FMT_DIVX      v4l2_fourcc('D', 'I', 'V', 'X') /* DIVX        */
-#define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* ON2 VP8 stream */
+#define V4L2_PIX_FMT_MJPEG    v4l2_fourcc('M', 'J', 'P', 'G') 
+#define V4L2_PIX_FMT_JPEG     v4l2_fourcc('J', 'P', 'E', 'G') 
+#define V4L2_PIX_FMT_DV       v4l2_fourcc('d', 'v', 's', 'd') 
+#define V4L2_PIX_FMT_MPEG     v4l2_fourcc('M', 'P', 'E', 'G') 
+#define V4L2_PIX_FMT_H264     v4l2_fourcc('H', '2', '6', '4') 
+#define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') 
+#define V4L2_PIX_FMT_H263     v4l2_fourcc('H', '2', '6', '3') 
+#define V4L2_PIX_FMT_MPEG1    v4l2_fourcc('M', 'P', 'G', '1') 
+#define V4L2_PIX_FMT_MPEG2    v4l2_fourcc('M', 'P', 'G', '2') 
+#define V4L2_PIX_FMT_MPEG4    v4l2_fourcc('M', 'P', 'G', '4') 
+#define V4L2_PIX_FMT_XVID     v4l2_fourcc('X', 'V', 'I', 'D') 
+#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') 
+#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') 
 
-/*  Vendor-specific formats   */
-#define V4L2_PIX_FMT_CPIA1    v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
-#define V4L2_PIX_FMT_WNVA     v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
-#define V4L2_PIX_FMT_SN9C10X  v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
-#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */
-#define V4L2_PIX_FMT_PWC1     v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */
-#define V4L2_PIX_FMT_PWC2     v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */
-#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */
-#define V4L2_PIX_FMT_SPCA501  v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */
-#define V4L2_PIX_FMT_SPCA505  v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */
-#define V4L2_PIX_FMT_SPCA508  v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
-#define V4L2_PIX_FMT_SPCA561  v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
-#define V4L2_PIX_FMT_PAC207   v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
-#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
-#define V4L2_PIX_FMT_JL2005BCD v4l2_fourcc('J', 'L', '2', '0') /* compressed RGGB bayer */
-#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
-#define V4L2_PIX_FMT_SQ905C   v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
-#define V4L2_PIX_FMT_PJPG     v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
-#define V4L2_PIX_FMT_OV511    v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
-#define V4L2_PIX_FMT_OV518    v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
-#define V4L2_PIX_FMT_STV0680  v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
-#define V4L2_PIX_FMT_TM6000   v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
-#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
-#define V4L2_PIX_FMT_KONICA420  v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
-#define V4L2_PIX_FMT_JPGL	v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
-/* se401 janggu compressed rgb */
-#define V4L2_PIX_FMT_SE401      v4l2_fourcc('S', '4', '0', '1')
-/* Composite stats */
-#define V4L2_PIX_FMT_STATS_COMB v4l2_fourcc('S', 'T', 'C', 'M')
-/* AEC stats */
-#define V4L2_PIX_FMT_STATS_AE   v4l2_fourcc('S', 'T', 'A', 'E')
-/* AF stats */
-#define V4L2_PIX_FMT_STATS_AF   v4l2_fourcc('S', 'T', 'A', 'F')
-/* AWB stats */
-#define V4L2_PIX_FMT_STATS_AWB  v4l2_fourcc('S', 'T', 'W', 'B')
-/* IHIST stats */
-#define V4L2_PIX_FMT_STATS_IHST v4l2_fourcc('I', 'H', 'S', 'T')
-/* Column count stats */
-#define V4L2_PIX_FMT_STATS_CS   v4l2_fourcc('S', 'T', 'C', 'S')
-/* Row count stats */
-#define V4L2_PIX_FMT_STATS_RS   v4l2_fourcc('S', 'T', 'R', 'S')
-/* Bayer Grid stats */
-#define V4L2_PIX_FMT_STATS_BG   v4l2_fourcc('S', 'T', 'B', 'G')
-/* Bayer focus stats */
-#define V4L2_PIX_FMT_STATS_BF   v4l2_fourcc('S', 'T', 'B', 'F')
-/* Bayer hist stats */
-#define V4L2_PIX_FMT_STATS_BHST v4l2_fourcc('B', 'H', 'S', 'T')
+#define V4L2_PIX_FMT_CPIA1    v4l2_fourcc('C', 'P', 'I', 'A') 
+#define V4L2_PIX_FMT_WNVA     v4l2_fourcc('W', 'N', 'V', 'A') 
+#define V4L2_PIX_FMT_SN9C10X  v4l2_fourcc('S', '9', '1', '0') 
+#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') 
+#define V4L2_PIX_FMT_PWC1     v4l2_fourcc('P', 'W', 'C', '1') 
+#define V4L2_PIX_FMT_PWC2     v4l2_fourcc('P', 'W', 'C', '2') 
+#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') 
+#define V4L2_PIX_FMT_SPCA501  v4l2_fourcc('S', '5', '0', '1') 
+#define V4L2_PIX_FMT_SPCA505  v4l2_fourcc('S', '5', '0', '5') 
+#define V4L2_PIX_FMT_SPCA508  v4l2_fourcc('S', '5', '0', '8') 
+#define V4L2_PIX_FMT_SPCA561  v4l2_fourcc('S', '5', '6', '1') 
+#define V4L2_PIX_FMT_PAC207   v4l2_fourcc('P', '2', '0', '7') 
+#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') 
+#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') 
+#define V4L2_PIX_FMT_SQ905C   v4l2_fourcc('9', '0', '5', 'C') 
+#define V4L2_PIX_FMT_PJPG     v4l2_fourcc('P', 'J', 'P', 'G') 
+#define V4L2_PIX_FMT_OV511    v4l2_fourcc('O', '5', '1', '1') 
+#define V4L2_PIX_FMT_OV518    v4l2_fourcc('O', '5', '1', '8') 
+#define V4L2_PIX_FMT_STV0680  v4l2_fourcc('S', '6', '8', '0') 
+#define V4L2_PIX_FMT_TM6000   v4l2_fourcc('T', 'M', '6', '0') 
+#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') 
+#define V4L2_PIX_FMT_KONICA420  v4l2_fourcc('K', 'O', 'N', 'I') 
+#define V4L2_PIX_FMT_JPGL	v4l2_fourcc('J', 'P', 'G', 'L') 
 
-/*
- *	F O R M A T   E N U M E R A T I O N
- */
 struct v4l2_fmtdesc {
-	__u32		    index;             /* Format number      */
-	enum v4l2_buf_type  type;              /* buffer type        */
+	__u32		    index;             
+	enum v4l2_buf_type  type;              
 	__u32               flags;
-	__u8		    description[32];   /* Description string */
-	__u32		    pixelformat;       /* Format fourcc      */
+	__u8		    description[32];   
+	__u32		    pixelformat;       
 	__u32		    reserved[4];
 };
 
@@ -467,10 +373,7 @@
 #define V4L2_FMT_FLAG_EMULATED   0x0002
 
 #if 1
-	/* Experimental Frame Size and frame rate enumeration */
-/*
- *	F R A M E   S I Z E   E N U M E R A T I O N
- */
+	
 enum v4l2_frmsizetypes {
 	V4L2_FRMSIZE_TYPE_DISCRETE	= 1,
 	V4L2_FRMSIZE_TYPE_CONTINUOUS	= 2,
@@ -478,35 +381,32 @@
 };
 
 struct v4l2_frmsize_discrete {
-	__u32			width;		/* Frame width [pixel] */
-	__u32			height;		/* Frame height [pixel] */
+	__u32			width;		
+	__u32			height;		
 };
 
 struct v4l2_frmsize_stepwise {
-	__u32			min_width;	/* Minimum frame width [pixel] */
-	__u32			max_width;	/* Maximum frame width [pixel] */
-	__u32			step_width;	/* Frame width step size [pixel] */
-	__u32			min_height;	/* Minimum frame height [pixel] */
-	__u32			max_height;	/* Maximum frame height [pixel] */
-	__u32			step_height;	/* Frame height step size [pixel] */
+	__u32			min_width;	
+	__u32			max_width;	
+	__u32			step_width;	
+	__u32			min_height;	
+	__u32			max_height;	
+	__u32			step_height;	
 };
 
 struct v4l2_frmsizeenum {
-	__u32			index;		/* Frame size number */
-	__u32			pixel_format;	/* Pixel format */
-	__u32			type;		/* Frame size type the device supports. */
+	__u32			index;		
+	__u32			pixel_format;	
+	__u32			type;		
 
-	union {					/* Frame size */
+	union {					
 		struct v4l2_frmsize_discrete	discrete;
 		struct v4l2_frmsize_stepwise	stepwise;
 	};
 
-	__u32   reserved[2];			/* Reserved space for future use */
+	__u32   reserved[2];			
 };
 
-/*
- *	F R A M E   R A T E   E N U M E R A T I O N
- */
 enum v4l2_frmivaltypes {
 	V4L2_FRMIVAL_TYPE_DISCRETE	= 1,
 	V4L2_FRMIVAL_TYPE_CONTINUOUS	= 2,
@@ -514,30 +414,27 @@
 };
 
 struct v4l2_frmival_stepwise {
-	struct v4l2_fract	min;		/* Minimum frame interval [s] */
-	struct v4l2_fract	max;		/* Maximum frame interval [s] */
-	struct v4l2_fract	step;		/* Frame interval step size [s] */
+	struct v4l2_fract	min;		
+	struct v4l2_fract	max;		
+	struct v4l2_fract	step;		
 };
 
 struct v4l2_frmivalenum {
-	__u32			index;		/* Frame format index */
-	__u32			pixel_format;	/* Pixel format */
-	__u32			width;		/* Frame width */
-	__u32			height;		/* Frame height */
-	__u32			type;		/* Frame interval type the device supports. */
+	__u32			index;		
+	__u32			pixel_format;	
+	__u32			width;		
+	__u32			height;		
+	__u32			type;		
 
-	union {					/* Frame interval */
+	union {					
 		struct v4l2_fract		discrete;
 		struct v4l2_frmival_stepwise	stepwise;
 	};
 
-	__u32	reserved[2];			/* Reserved space for future use */
+	__u32	reserved[2];			
 };
 #endif
 
-/*
- *	T I M E C O D E
- */
 struct v4l2_timecode {
 	__u32	type;
 	__u32	flags;
@@ -548,53 +445,37 @@
 	__u8	userbits[4];
 };
 
-/*  Type  */
 #define V4L2_TC_TYPE_24FPS		1
 #define V4L2_TC_TYPE_25FPS		2
 #define V4L2_TC_TYPE_30FPS		3
 #define V4L2_TC_TYPE_50FPS		4
 #define V4L2_TC_TYPE_60FPS		5
 
-/*  Flags  */
-#define V4L2_TC_FLAG_DROPFRAME		0x0001 /* "drop-frame" mode */
+#define V4L2_TC_FLAG_DROPFRAME		0x0001 
 #define V4L2_TC_FLAG_COLORFRAME		0x0002
 #define V4L2_TC_USERBITS_field		0x000C
 #define V4L2_TC_USERBITS_USERDEFINED	0x0000
 #define V4L2_TC_USERBITS_8BITCHARS	0x0008
-/* The above is based on SMPTE timecodes */
 
 struct v4l2_jpegcompression {
 	int quality;
 
-	int  APPn;              /* Number of APP segment to be written,
-				 * must be 0..15 */
-	int  APP_len;           /* Length of data in JPEG APPn segment */
-	char APP_data[60];      /* Data in the JPEG APPn segment. */
+	int  APPn;              
+	int  APP_len;           
+	char APP_data[60];      
 
-	int  COM_len;           /* Length of data in JPEG COM segment */
-	char COM_data[60];      /* Data in JPEG COM segment */
+	int  COM_len;           
+	char COM_data[60];      
 
-	__u32 jpeg_markers;     /* Which markers should go into the JPEG
-				 * output. Unless you exactly know what
-				 * you do, leave them untouched.
-				 * Inluding less markers will make the
-				 * resulting code smaller, but there will
-				 * be fewer applications which can read it.
-				 * The presence of the APP and COM marker
-				 * is influenced by APP_len and COM_len
-				 * ONLY, not by this property! */
+	__u32 jpeg_markers;     
 
-#define V4L2_JPEG_MARKER_DHT (1<<3)    /* Define Huffman Tables */
-#define V4L2_JPEG_MARKER_DQT (1<<4)    /* Define Quantization Tables */
-#define V4L2_JPEG_MARKER_DRI (1<<5)    /* Define Restart Interval */
-#define V4L2_JPEG_MARKER_COM (1<<6)    /* Comment segment */
-#define V4L2_JPEG_MARKER_APP (1<<7)    /* App segment, driver will
-					* allways use APP0 */
+#define V4L2_JPEG_MARKER_DHT (1<<3)    
+#define V4L2_JPEG_MARKER_DQT (1<<4)    
+#define V4L2_JPEG_MARKER_DRI (1<<5)    
+#define V4L2_JPEG_MARKER_COM (1<<6)    
+#define V4L2_JPEG_MARKER_APP (1<<7)    
 };
 
-/*
- *	M E M O R Y - M A P P I N G   B U F F E R S
- */
 struct v4l2_requestbuffers {
 	__u32			count;
 	enum v4l2_buf_type      type;
@@ -602,24 +483,6 @@
 	__u32			reserved[2];
 };
 
-/**
- * struct v4l2_plane - plane info for multi-planar buffers
- * @bytesused:		number of bytes occupied by data in the plane (payload)
- * @length:		size of this plane (NOT the payload) in bytes
- * @mem_offset:		when memory in the associated struct v4l2_buffer is
- *			V4L2_MEMORY_MMAP, equals the offset from the start of
- *			the device memory for this plane (or is a "cookie" that
- *			should be passed to mmap() called on the video node)
- * @userptr:		when memory is V4L2_MEMORY_USERPTR, a userspace pointer
- *			pointing to this plane
- * @data_offset:	offset in the plane to the start of data; usually 0,
- *			unless there is a header in front of the data
- *
- * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer
- * with two planes can have one plane for Y, and another for interleaved CbCr
- * components. Each plane can reside in a separate memory buffer, or even in
- * a completely separate memory node (e.g. in embedded devices).
- */
 struct v4l2_plane {
 	__u32			bytesused;
 	__u32			length;
@@ -631,33 +494,6 @@
 	__u32			reserved[11];
 };
 
-/**
- * struct v4l2_buffer - video buffer info
- * @index:	id number of the buffer
- * @type:	buffer type (type == *_MPLANE for multiplanar buffers)
- * @bytesused:	number of bytes occupied by data in the buffer (payload);
- *		unused (set to 0) for multiplanar buffers
- * @flags:	buffer informational flags
- * @field:	field order of the image in the buffer
- * @timestamp:	frame timestamp
- * @timecode:	frame timecode
- * @sequence:	sequence count of this frame
- * @memory:	the method, in which the actual video data is passed
- * @offset:	for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
- *		offset from the start of the device memory for this plane,
- *		(or a "cookie" that should be passed to mmap() as offset)
- * @userptr:	for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
- *		a userspace pointer pointing to this buffer
- * @planes:	for multiplanar buffers; userspace pointer to the array of plane
- *		info structs for this buffer
- * @length:	size in bytes of the buffer (NOT its payload) for single-plane
- *		buffers (when type != *_MPLANE); number of elements in the
- *		planes array for multi-plane buffers
- * @input:	input number from which the video data has has been captured
- *
- * Contains data exchanged by application and driver using one of the Streaming
- * I/O methods.
- */
 struct v4l2_buffer {
 	__u32			index;
 	enum v4l2_buf_type      type;
@@ -668,7 +504,7 @@
 	struct v4l2_timecode	timecode;
 	__u32			sequence;
 
-	/* memory location */
+	
 	enum v4l2_memory        memory;
 	union {
 		__u32           offset;
@@ -680,35 +516,25 @@
 	__u32			reserved;
 };
 
-/*  Flags for 'flags' field */
-#define V4L2_BUF_FLAG_MAPPED	0x0001  /* Buffer is mapped (flag) */
-#define V4L2_BUF_FLAG_QUEUED	0x0002	/* Buffer is queued for processing */
-#define V4L2_BUF_FLAG_DONE	0x0004	/* Buffer is ready */
-#define V4L2_BUF_FLAG_KEYFRAME	0x0008	/* Image is a keyframe (I-frame) */
-#define V4L2_BUF_FLAG_PFRAME	0x0010	/* Image is a P-frame */
-#define V4L2_BUF_FLAG_BFRAME	0x0020	/* Image is a B-frame */
-/* Buffer is ready, but the data contained within is corrupted. */
+#define V4L2_BUF_FLAG_MAPPED	0x0001  
+#define V4L2_BUF_FLAG_QUEUED	0x0002	
+#define V4L2_BUF_FLAG_DONE	0x0004	
+#define V4L2_BUF_FLAG_KEYFRAME	0x0008	
+#define V4L2_BUF_FLAG_PFRAME	0x0010	
+#define V4L2_BUF_FLAG_BFRAME	0x0020	
 #define V4L2_BUF_FLAG_ERROR	0x0040
-#define V4L2_BUF_FLAG_TIMECODE	0x0100	/* timecode field is valid */
-#define V4L2_BUF_FLAG_INPUT     0x0200  /* input field is valid */
-#define V4L2_BUF_FLAG_PREPARED	0x0400	/* Buffer is prepared for queuing */
-/* Cache handling flags */
+#define V4L2_BUF_FLAG_TIMECODE	0x0100	
+#define V4L2_BUF_FLAG_INPUT     0x0200  
+#define V4L2_BUF_FLAG_PREPARED	0x0400	
 #define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE	0x0800
 #define V4L2_BUF_FLAG_NO_CACHE_CLEAN		0x1000
-#define V4L2_BUF_FLAG_EOS		0x2000
 
-/*
- *	O V E R L A Y   P R E V I E W
- */
 struct v4l2_framebuffer {
 	__u32			capability;
 	__u32			flags;
-/* FIXME: in theory we should pass something like PCI device + memory
- * region + offset instead of some physical address */
 	void                    *base;
 	struct v4l2_pix_format	fmt;
 };
-/*  Flags for the 'capability' field. Read only */
 #define V4L2_FBUF_CAP_EXTERNOVERLAY	0x0001
 #define V4L2_FBUF_CAP_CHROMAKEY		0x0002
 #define V4L2_FBUF_CAP_LIST_CLIPPING     0x0004
@@ -717,7 +543,6 @@
 #define V4L2_FBUF_CAP_GLOBAL_ALPHA	0x0020
 #define V4L2_FBUF_CAP_LOCAL_INV_ALPHA	0x0040
 #define V4L2_FBUF_CAP_SRC_CHROMAKEY	0x0080
-/*  Flags for the 'flags' field. */
 #define V4L2_FBUF_FLAG_PRIMARY		0x0001
 #define V4L2_FBUF_FLAG_OVERLAY		0x0002
 #define V4L2_FBUF_FLAG_CHROMAKEY	0x0004
@@ -741,39 +566,32 @@
 	__u8                    global_alpha;
 };
 
-/*
- *	C A P T U R E   P A R A M E T E R S
- */
 struct v4l2_captureparm {
-	__u32		   capability;	  /*  Supported modes */
-	__u32		   capturemode;	  /*  Current mode */
-	struct v4l2_fract  timeperframe;  /*  Time per frame in .1us units */
-	__u32		   extendedmode;  /*  Driver-specific extensions */
-	__u32              readbuffers;   /*  # of buffers for read */
+	__u32		   capability;	  
+	__u32		   capturemode;	  
+	struct v4l2_fract  timeperframe;  
+	__u32		   extendedmode;  
+	__u32              readbuffers;   
 	__u32		   reserved[4];
 };
 
-/*  Flags for 'capability' and 'capturemode' fields */
-#define V4L2_MODE_HIGHQUALITY	0x0001	/*  High quality imaging mode */
-#define V4L2_CAP_TIMEPERFRAME	0x1000	/*  timeperframe field is supported */
-#define V4L2_CAP_QCOM_FRAMESKIP	0x2000	/*  frame skipping is supported */
+#define V4L2_MODE_HIGHQUALITY	0x0001	
+#define V4L2_CAP_TIMEPERFRAME	0x1000	
+#define V4L2_CAP_QCOM_FRAMESKIP	0x2000	
 
 struct v4l2_qcom_frameskip {
 	__u64		maxframeinterval;
 };
 
 struct v4l2_outputparm {
-	__u32		   capability;	 /*  Supported modes */
-	__u32		   outputmode;	 /*  Current mode */
-	struct v4l2_fract  timeperframe; /*  Time per frame in seconds */
-	__u32		   extendedmode; /*  Driver-specific extensions */
-	__u32              writebuffers; /*  # of buffers for write */
+	__u32		   capability;	 
+	__u32		   outputmode;	 
+	struct v4l2_fract  timeperframe; 
+	__u32		   extendedmode; 
+	__u32              writebuffers; 
 	__u32		   reserved[4];
 };
 
-/*
- *	I N P U T   I M A G E   C R O P P I N G
- */
 struct v4l2_cropcap {
 	enum v4l2_buf_type      type;
 	struct v4l2_rect        bounds;
@@ -786,55 +604,9 @@
 	struct v4l2_rect        c;
 };
 
-/* Hints for adjustments of selection rectangle */
-#define V4L2_SEL_FLAG_GE	0x00000001
-#define V4L2_SEL_FLAG_LE	0x00000002
-
-/* Selection targets */
-
-/* Current cropping area */
-#define V4L2_SEL_TGT_CROP_ACTIVE	0x0000
-/* Default cropping area */
-#define V4L2_SEL_TGT_CROP_DEFAULT	0x0001
-/* Cropping bounds */
-#define V4L2_SEL_TGT_CROP_BOUNDS	0x0002
-/* Current composing area */
-#define V4L2_SEL_TGT_COMPOSE_ACTIVE	0x0100
-/* Default composing area */
-#define V4L2_SEL_TGT_COMPOSE_DEFAULT	0x0101
-/* Composing bounds */
-#define V4L2_SEL_TGT_COMPOSE_BOUNDS	0x0102
-/* Current composing area plus all padding pixels */
-#define V4L2_SEL_TGT_COMPOSE_PADDED	0x0103
-
-/**
- * struct v4l2_selection - selection info
- * @type:	buffer type (do not use *_MPLANE types)
- * @target:	selection target, used to choose one of possible rectangles
- * @flags:	constraints flags
- * @r:		coordinates of selection window
- * @reserved:	for future use, rounds structure size to 64 bytes, set to zero
- *
- * Hardware may use multiple helper windows to process a video stream.
- * The structure is used to exchange this selection areas between
- * an application and a driver.
- */
-struct v4l2_selection {
-	__u32			type;
-	__u32			target;
-	__u32                   flags;
-	struct v4l2_rect        r;
-	__u32                   reserved[9];
-};
-
-
-/*
- *      A N A L O G   V I D E O   S T A N D A R D
- */
 
 typedef __u64 v4l2_std_id;
 
-/* one bit for each */
 #define V4L2_STD_PAL_B          ((v4l2_std_id)0x00000001)
 #define V4L2_STD_PAL_B1         ((v4l2_std_id)0x00000002)
 #define V4L2_STD_PAL_G          ((v4l2_std_id)0x00000004)
@@ -849,10 +621,10 @@
 #define V4L2_STD_PAL_Nc         ((v4l2_std_id)0x00000400)
 #define V4L2_STD_PAL_60         ((v4l2_std_id)0x00000800)
 
-#define V4L2_STD_NTSC_M         ((v4l2_std_id)0x00001000)	/* BTSC */
-#define V4L2_STD_NTSC_M_JP      ((v4l2_std_id)0x00002000)	/* EIA-J */
+#define V4L2_STD_NTSC_M         ((v4l2_std_id)0x00001000)
+#define V4L2_STD_NTSC_M_JP      ((v4l2_std_id)0x00002000)
 #define V4L2_STD_NTSC_443       ((v4l2_std_id)0x00004000)
-#define V4L2_STD_NTSC_M_KR      ((v4l2_std_id)0x00008000)	/* FM A2 */
+#define V4L2_STD_NTSC_M_KR      ((v4l2_std_id)0x00008000)
 
 #define V4L2_STD_SECAM_B        ((v4l2_std_id)0x00010000)
 #define V4L2_STD_SECAM_D        ((v4l2_std_id)0x00020000)
@@ -863,99 +635,49 @@
 #define V4L2_STD_SECAM_L        ((v4l2_std_id)0x00400000)
 #define V4L2_STD_SECAM_LC       ((v4l2_std_id)0x00800000)
 
-/* ATSC/HDTV */
 #define V4L2_STD_ATSC_8_VSB     ((v4l2_std_id)0x01000000)
 #define V4L2_STD_ATSC_16_VSB    ((v4l2_std_id)0x02000000)
 
-/* FIXME:
-   Although std_id is 64 bits, there is an issue on PPC32 architecture that
-   makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding
-   this value to 32 bits.
-   As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide),
-   it should work fine. However, if needed to add more than two standards,
-   v4l2-common.c should be fixed.
- */
 
-/*
- * Some macros to merge video standards in order to make live easier for the
- * drivers and V4L2 applications
- */
+#define V4L2_STD_MN	(V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
+#define V4L2_STD_B	(V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
+#define V4L2_STD_GH	(V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
+#define V4L2_STD_DK	(V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
 
-/*
- * "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is
- * Missing here.
- */
-#define V4L2_STD_NTSC           (V4L2_STD_NTSC_M	|\
-				 V4L2_STD_NTSC_M_JP     |\
-				 V4L2_STD_NTSC_M_KR)
-/* Secam macros */
-#define V4L2_STD_SECAM_DK      	(V4L2_STD_SECAM_D	|\
-				 V4L2_STD_SECAM_K	|\
-				 V4L2_STD_SECAM_K1)
-/* All Secam Standards */
-#define V4L2_STD_SECAM		(V4L2_STD_SECAM_B	|\
-				 V4L2_STD_SECAM_G	|\
-				 V4L2_STD_SECAM_H	|\
-				 V4L2_STD_SECAM_DK	|\
-				 V4L2_STD_SECAM_L       |\
-				 V4L2_STD_SECAM_LC)
-/* PAL macros */
 #define V4L2_STD_PAL_BG		(V4L2_STD_PAL_B		|\
 				 V4L2_STD_PAL_B1	|\
 				 V4L2_STD_PAL_G)
 #define V4L2_STD_PAL_DK		(V4L2_STD_PAL_D		|\
 				 V4L2_STD_PAL_D1	|\
 				 V4L2_STD_PAL_K)
-/*
- * "Common" PAL - This macro is there to be compatible with the old
- * V4L1 concept of "PAL": /BGDKHI.
- * Several PAL standards are mising here: /M, /N and /Nc
- */
 #define V4L2_STD_PAL		(V4L2_STD_PAL_BG	|\
 				 V4L2_STD_PAL_DK	|\
 				 V4L2_STD_PAL_H		|\
 				 V4L2_STD_PAL_I)
-/* Chroma "agnostic" standards */
-#define V4L2_STD_B		(V4L2_STD_PAL_B		|\
-				 V4L2_STD_PAL_B1	|\
-				 V4L2_STD_SECAM_B)
-#define V4L2_STD_G		(V4L2_STD_PAL_G		|\
-				 V4L2_STD_SECAM_G)
-#define V4L2_STD_H		(V4L2_STD_PAL_H		|\
-				 V4L2_STD_SECAM_H)
-#define V4L2_STD_L		(V4L2_STD_SECAM_L	|\
+#define V4L2_STD_NTSC           (V4L2_STD_NTSC_M	|\
+				 V4L2_STD_NTSC_M_JP     |\
+				 V4L2_STD_NTSC_M_KR)
+#define V4L2_STD_SECAM_DK      	(V4L2_STD_SECAM_D	|\
+				 V4L2_STD_SECAM_K	|\
+				 V4L2_STD_SECAM_K1)
+#define V4L2_STD_SECAM		(V4L2_STD_SECAM_B	|\
+				 V4L2_STD_SECAM_G	|\
+				 V4L2_STD_SECAM_H	|\
+				 V4L2_STD_SECAM_DK	|\
+				 V4L2_STD_SECAM_L       |\
 				 V4L2_STD_SECAM_LC)
-#define V4L2_STD_GH		(V4L2_STD_G		|\
-				 V4L2_STD_H)
-#define V4L2_STD_DK		(V4L2_STD_PAL_DK	|\
-				 V4L2_STD_SECAM_DK)
-#define V4L2_STD_BG		(V4L2_STD_B		|\
-				 V4L2_STD_G)
-#define V4L2_STD_MN		(V4L2_STD_PAL_M		|\
-				 V4L2_STD_PAL_N		|\
-				 V4L2_STD_PAL_Nc	|\
-				 V4L2_STD_NTSC)
 
-/* Standards where MTS/BTSC stereo could be found */
-#define V4L2_STD_MTS		(V4L2_STD_NTSC_M	|\
-				 V4L2_STD_PAL_M		|\
-				 V4L2_STD_PAL_N		|\
-				 V4L2_STD_PAL_Nc)
-
-/* Standards for Countries with 60Hz Line frequency */
 #define V4L2_STD_525_60		(V4L2_STD_PAL_M		|\
 				 V4L2_STD_PAL_60	|\
 				 V4L2_STD_NTSC		|\
 				 V4L2_STD_NTSC_443)
-/* Standards for Countries with 50Hz Line frequency */
 #define V4L2_STD_625_50		(V4L2_STD_PAL		|\
 				 V4L2_STD_PAL_N		|\
 				 V4L2_STD_PAL_Nc	|\
 				 V4L2_STD_SECAM)
-
 #define V4L2_STD_ATSC           (V4L2_STD_ATSC_8_VSB    |\
 				 V4L2_STD_ATSC_16_VSB)
-/* Macros with none and all analog standards */
+
 #define V4L2_STD_UNKNOWN        0
 #define V4L2_STD_ALL            (V4L2_STD_525_60	|\
 				 V4L2_STD_625_50)
@@ -964,93 +686,71 @@
 	__u32		     index;
 	v4l2_std_id          id;
 	__u8		     name[24];
-	struct v4l2_fract    frameperiod; /* Frames, not fields */
+	struct v4l2_fract    frameperiod; 
 	__u32		     framelines;
 	__u32		     reserved[4];
 };
 
-/*
- *	V I D E O	T I M I N G S	D V	P R E S E T
- */
 struct v4l2_dv_preset {
 	__u32	preset;
 	__u32	reserved[4];
 };
 
-/*
- *	D V	P R E S E T S	E N U M E R A T I O N
- */
 struct v4l2_dv_enum_preset {
 	__u32	index;
 	__u32	preset;
-	__u8	name[32]; /* Name of the preset timing */
+	__u8	name[32]; 
 	__u32	width;
 	__u32	height;
 	__u32	reserved[4];
 };
 
-/*
- * 	D V	P R E S E T	V A L U E S
- */
 #define		V4L2_DV_INVALID		0
-#define		V4L2_DV_480P59_94	1 /* BT.1362 */
-#define		V4L2_DV_576P50		2 /* BT.1362 */
-#define		V4L2_DV_720P24		3 /* SMPTE 296M */
-#define		V4L2_DV_720P25		4 /* SMPTE 296M */
-#define		V4L2_DV_720P30		5 /* SMPTE 296M */
-#define		V4L2_DV_720P50		6 /* SMPTE 296M */
-#define		V4L2_DV_720P59_94	7 /* SMPTE 274M */
-#define		V4L2_DV_720P60		8 /* SMPTE 274M/296M */
-#define		V4L2_DV_1080I29_97	9 /* BT.1120/ SMPTE 274M */
-#define		V4L2_DV_1080I30		10 /* BT.1120/ SMPTE 274M */
-#define		V4L2_DV_1080I25		11 /* BT.1120 */
-#define		V4L2_DV_1080I50		12 /* SMPTE 296M */
-#define		V4L2_DV_1080I60		13 /* SMPTE 296M */
-#define		V4L2_DV_1080P24		14 /* SMPTE 296M */
-#define		V4L2_DV_1080P25		15 /* SMPTE 296M */
-#define		V4L2_DV_1080P30		16 /* SMPTE 296M */
-#define		V4L2_DV_1080P50		17 /* BT.1120 */
-#define		V4L2_DV_1080P60		18 /* BT.1120 */
+#define		V4L2_DV_480P59_94	1 
+#define		V4L2_DV_576P50		2 
+#define		V4L2_DV_720P24		3 
+#define		V4L2_DV_720P25		4 
+#define		V4L2_DV_720P30		5 
+#define		V4L2_DV_720P50		6 
+#define		V4L2_DV_720P59_94	7 
+#define		V4L2_DV_720P60		8 
+#define		V4L2_DV_1080I29_97	9 
+#define		V4L2_DV_1080I30		10 
+#define		V4L2_DV_1080I25		11 
+#define		V4L2_DV_1080I50		12 
+#define		V4L2_DV_1080I60		13 
+#define		V4L2_DV_1080P24		14 
+#define		V4L2_DV_1080P25		15 
+#define		V4L2_DV_1080P30		16 
+#define		V4L2_DV_1080P50		17 
+#define		V4L2_DV_1080P60		18 
 
-/*
- *	D V 	B T	T I M I N G S
- */
 
-/* BT.656/BT.1120 timing data */
 struct v4l2_bt_timings {
-	__u32	width;		/* width in pixels */
-	__u32	height;		/* height in lines */
-	__u32	interlaced;	/* Interlaced or progressive */
-	__u32	polarities;	/* Positive or negative polarity */
-	__u64	pixelclock;	/* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
-	__u32	hfrontporch;	/* Horizpontal front porch in pixels */
-	__u32	hsync;		/* Horizontal Sync length in pixels */
-	__u32	hbackporch;	/* Horizontal back porch in pixels */
-	__u32	vfrontporch;	/* Vertical front porch in pixels */
-	__u32	vsync;		/* Vertical Sync length in lines */
-	__u32	vbackporch;	/* Vertical back porch in lines */
-	__u32	il_vfrontporch;	/* Vertical front porch for bottom field of
-				 * interlaced field formats
-				 */
-	__u32	il_vsync;	/* Vertical sync length for bottom field of
-				 * interlaced field formats
-				 */
-	__u32	il_vbackporch;	/* Vertical back porch for bottom field of
-				 * interlaced field formats
-				 */
+	__u32	width;		
+	__u32	height;		
+	__u32	interlaced;	
+	__u32	polarities;	
+	__u64	pixelclock;	
+	__u32	hfrontporch;	
+	__u32	hsync;		
+	__u32	hbackporch;	
+	__u32	vfrontporch;	
+	__u32	vsync;		
+	__u32	vbackporch;	
+	__u32	il_vfrontporch;	
+	__u32	il_vsync;	
+	__u32	il_vbackporch;	
 	__u32	reserved[16];
 } __attribute__ ((packed));
 
-/* Interlaced or progressive format */
 #define	V4L2_DV_PROGRESSIVE	0
 #define	V4L2_DV_INTERLACED	1
 
-/* Polarities. If bit is not set, it is assumed to be negative polarity */
 #define V4L2_DV_VSYNC_POS_POL	0x00000001
 #define V4L2_DV_HSYNC_POS_POL	0x00000002
 
 
-/* DV timings */
 struct v4l2_dv_timings {
 	__u32 type;
 	union {
@@ -1059,83 +759,63 @@
 	};
 } __attribute__ ((packed));
 
-/* Values for the type field */
-#define V4L2_DV_BT_656_1120	0	/* BT.656/1120 timing type */
+#define V4L2_DV_BT_656_1120	0	
 
-/*
- *	V I D E O   I N P U T S
- */
 struct v4l2_input {
-	__u32	     index;		/*  Which input */
-	__u8	     name[32];		/*  Label */
-	__u32	     type;		/*  Type of input */
-	__u32	     audioset;		/*  Associated audios (bitfield) */
-	__u32        tuner;             /*  Associated tuner */
+	__u32	     index;		
+	__u8	     name[32];		
+	__u32	     type;		
+	__u32	     audioset;		
+	__u32        tuner;             
 	v4l2_std_id  std;
 	__u32	     status;
 	__u32	     capabilities;
 	__u32	     reserved[3];
 };
 
-/*  Values for the 'type' field */
 #define V4L2_INPUT_TYPE_TUNER		1
 #define V4L2_INPUT_TYPE_CAMERA		2
 
-/* field 'status' - general */
-#define V4L2_IN_ST_NO_POWER    0x00000001  /* Attached device is off */
+#define V4L2_IN_ST_NO_POWER    0x00000001  
 #define V4L2_IN_ST_NO_SIGNAL   0x00000002
 #define V4L2_IN_ST_NO_COLOR    0x00000004
 
-/* field 'status' - sensor orientation */
-/* If sensor is mounted upside down set both bits */
-#define V4L2_IN_ST_HFLIP       0x00000010 /* Frames are flipped horizontally */
-#define V4L2_IN_ST_VFLIP       0x00000020 /* Frames are flipped vertically */
+#define V4L2_IN_ST_HFLIP       0x00000010 
+#define V4L2_IN_ST_VFLIP       0x00000020 
 
-/* field 'status' - analog */
-#define V4L2_IN_ST_NO_H_LOCK   0x00000100  /* No horizontal sync lock */
-#define V4L2_IN_ST_COLOR_KILL  0x00000200  /* Color killer is active */
+#define V4L2_IN_ST_NO_H_LOCK   0x00000100  
+#define V4L2_IN_ST_COLOR_KILL  0x00000200  
 
-/* field 'status' - digital */
-#define V4L2_IN_ST_NO_SYNC     0x00010000  /* No synchronization lock */
-#define V4L2_IN_ST_NO_EQU      0x00020000  /* No equalizer lock */
-#define V4L2_IN_ST_NO_CARRIER  0x00040000  /* Carrier recovery failed */
+#define V4L2_IN_ST_NO_SYNC     0x00010000  
+#define V4L2_IN_ST_NO_EQU      0x00020000  
+#define V4L2_IN_ST_NO_CARRIER  0x00040000  
 
-/* field 'status' - VCR and set-top box */
-#define V4L2_IN_ST_MACROVISION 0x01000000  /* Macrovision detected */
-#define V4L2_IN_ST_NO_ACCESS   0x02000000  /* Conditional access denied */
-#define V4L2_IN_ST_VTR         0x04000000  /* VTR time constant */
+#define V4L2_IN_ST_MACROVISION 0x01000000  
+#define V4L2_IN_ST_NO_ACCESS   0x02000000  
+#define V4L2_IN_ST_VTR         0x04000000  
 
-/* capabilities flags */
-#define V4L2_IN_CAP_PRESETS		0x00000001 /* Supports S_DV_PRESET */
-#define V4L2_IN_CAP_CUSTOM_TIMINGS	0x00000002 /* Supports S_DV_TIMINGS */
-#define V4L2_IN_CAP_STD			0x00000004 /* Supports S_STD */
+#define V4L2_IN_CAP_PRESETS		0x00000001 
+#define V4L2_IN_CAP_CUSTOM_TIMINGS	0x00000002 
+#define V4L2_IN_CAP_STD			0x00000004 
 
-/*
- *	V I D E O   O U T P U T S
- */
 struct v4l2_output {
-	__u32	     index;		/*  Which output */
-	__u8	     name[32];		/*  Label */
-	__u32	     type;		/*  Type of output */
-	__u32	     audioset;		/*  Associated audios (bitfield) */
-	__u32	     modulator;         /*  Associated modulator */
+	__u32	     index;		
+	__u8	     name[32];		
+	__u32	     type;		
+	__u32	     audioset;		
+	__u32	     modulator;         
 	v4l2_std_id  std;
 	__u32	     capabilities;
 	__u32	     reserved[3];
 };
-/*  Values for the 'type' field */
 #define V4L2_OUTPUT_TYPE_MODULATOR		1
 #define V4L2_OUTPUT_TYPE_ANALOG			2
 #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY	3
 
-/* capabilities flags */
-#define V4L2_OUT_CAP_PRESETS		0x00000001 /* Supports S_DV_PRESET */
-#define V4L2_OUT_CAP_CUSTOM_TIMINGS	0x00000002 /* Supports S_DV_TIMINGS */
-#define V4L2_OUT_CAP_STD		0x00000004 /* Supports S_STD */
+#define V4L2_OUT_CAP_PRESETS		0x00000001 
+#define V4L2_OUT_CAP_CUSTOM_TIMINGS	0x00000002 
+#define V4L2_OUT_CAP_STD		0x00000004 
 
-/*
- *	C O N T R O L S
- */
 struct v4l2_control {
 	__u32		     id;
 	__s32		     value;
@@ -1160,13 +840,10 @@
 	struct v4l2_ext_control *controls;
 };
 
-/*  Values for ctrl_class field */
-#define V4L2_CTRL_CLASS_USER 0x00980000	/* Old-style 'user' controls */
-#define V4L2_CTRL_CLASS_MPEG 0x00990000	/* MPEG-compression controls */
-#define V4L2_CTRL_CLASS_CAMERA 0x009a0000	/* Camera class controls */
-#define V4L2_CTRL_CLASS_FM_TX 0x009b0000	/* FM Modulator control class */
-#define V4L2_CTRL_CLASS_FLASH 0x009c0000	/* Camera flash controls */
-#define V4L2_CTRL_CLASS_JPEG 0x009d0000		/* JPEG-compression controls */
+#define V4L2_CTRL_CLASS_USER 0x00980000	
+#define V4L2_CTRL_CLASS_MPEG 0x00990000	
+#define V4L2_CTRL_CLASS_CAMERA 0x009a0000	
+#define V4L2_CTRL_CLASS_FM_TX 0x009b0000	
 
 #define V4L2_CTRL_ID_MASK      	  (0x0fffffff)
 #define V4L2_CTRL_ID2CLASS(id)    ((id) & 0x0fff0000UL)
@@ -1180,15 +857,13 @@
 	V4L2_CTRL_TYPE_INTEGER64     = 5,
 	V4L2_CTRL_TYPE_CTRL_CLASS    = 6,
 	V4L2_CTRL_TYPE_STRING        = 7,
-	V4L2_CTRL_TYPE_BITMASK       = 8,
 };
 
-/*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
 struct v4l2_queryctrl {
 	__u32		     id;
 	enum v4l2_ctrl_type  type;
-	__u8		     name[32];	/* Whatever */
-	__s32		     minimum;	/* Note signedness */
+	__u8		     name[32];	
+	__s32		     minimum;	
 	__s32		     maximum;
 	__s32		     step;
 	__s32		     default_value;
@@ -1196,15 +871,13 @@
 	__u32		     reserved[2];
 };
 
-/*  Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
 struct v4l2_querymenu {
 	__u32		id;
 	__u32		index;
-	__u8		name[32];	/* Whatever */
+	__u8		name[32];	
 	__u32		reserved;
 };
 
-/*  Control flags  */
 #define V4L2_CTRL_FLAG_DISABLED		0x0001
 #define V4L2_CTRL_FLAG_GRABBED		0x0002
 #define V4L2_CTRL_FLAG_READ_ONLY 	0x0004
@@ -1212,16 +885,12 @@
 #define V4L2_CTRL_FLAG_INACTIVE 	0x0010
 #define V4L2_CTRL_FLAG_SLIDER 		0x0020
 #define V4L2_CTRL_FLAG_WRITE_ONLY 	0x0040
-#define V4L2_CTRL_FLAG_VOLATILE		0x0080
 
-/*  Query flag, to be ORed with the control ID */
 #define V4L2_CTRL_FLAG_NEXT_CTRL	0x80000000
 
-/*  User-class control IDs defined by V4L2 */
 #define V4L2_CID_MAX_CTRLS		1024
 #define V4L2_CID_BASE			(V4L2_CTRL_CLASS_USER | 0x900)
 #define V4L2_CID_USER_BASE 		V4L2_CID_BASE
-/*  IDs reserved for driver specific controls */
 #define V4L2_CID_PRIVATE_BASE		0x08000000
 
 #define V4L2_CID_USER_CLASS 		(V4L2_CTRL_CLASS_USER | 1)
@@ -1235,20 +904,19 @@
 #define V4L2_CID_AUDIO_TREBLE		(V4L2_CID_BASE+8)
 #define V4L2_CID_AUDIO_MUTE		(V4L2_CID_BASE+9)
 #define V4L2_CID_AUDIO_LOUDNESS		(V4L2_CID_BASE+10)
-#define V4L2_CID_BLACK_LEVEL		(V4L2_CID_BASE+11) /* Deprecated */
+#define V4L2_CID_BLACK_LEVEL		(V4L2_CID_BASE+11) 
 #define V4L2_CID_AUTO_WHITE_BALANCE	(V4L2_CID_BASE+12)
 #define V4L2_CID_DO_WHITE_BALANCE	(V4L2_CID_BASE+13)
 #define V4L2_CID_RED_BALANCE		(V4L2_CID_BASE+14)
 #define V4L2_CID_BLUE_BALANCE		(V4L2_CID_BASE+15)
 #define V4L2_CID_GAMMA			(V4L2_CID_BASE+16)
-#define V4L2_CID_WHITENESS		(V4L2_CID_GAMMA) /* Deprecated */
+#define V4L2_CID_WHITENESS		(V4L2_CID_GAMMA) 
 #define V4L2_CID_EXPOSURE		(V4L2_CID_BASE+17)
 #define V4L2_CID_AUTOGAIN		(V4L2_CID_BASE+18)
 #define V4L2_CID_GAIN			(V4L2_CID_BASE+19)
 #define V4L2_CID_HFLIP			(V4L2_CID_BASE+20)
 #define V4L2_CID_VFLIP			(V4L2_CID_BASE+21)
 
-/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
 #define V4L2_CID_HCENTER		(V4L2_CID_BASE+22)
 #define V4L2_CID_VCENTER		(V4L2_CID_BASE+23)
 
@@ -1257,7 +925,6 @@
 	V4L2_CID_POWER_LINE_FREQUENCY_DISABLED	= 0,
 	V4L2_CID_POWER_LINE_FREQUENCY_50HZ	= 1,
 	V4L2_CID_POWER_LINE_FREQUENCY_60HZ	= 2,
-	V4L2_CID_POWER_LINE_FREQUENCY_AUTO	= 3,
 };
 #define V4L2_CID_HUE_AUTO			(V4L2_CID_BASE+25)
 #define V4L2_CID_WHITE_BALANCE_TEMPERATURE	(V4L2_CID_BASE+26)
@@ -1292,26 +959,21 @@
 #define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE	(V4L2_CID_BASE+39)
 #define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT		(V4L2_CID_BASE+40)
 
-#define V4L2_CID_ALPHA_COMPONENT		(V4L2_CID_BASE+41)
-
-/* last CID + 1 */
 #define V4L2_CID_LASTP1                         (V4L2_CID_BASE+42)
 #define V4L2_CID_SPECIAL_EFFECT			(V4L2_CID_BASE+43)
-/* Minimum number of buffer neede by the device */
 
-/*  MPEG-class control IDs defined by V4L2 */
+
 #define V4L2_CID_MPEG_BASE 			(V4L2_CTRL_CLASS_MPEG | 0x900)
 #define V4L2_CID_MPEG_CLASS 			(V4L2_CTRL_CLASS_MPEG | 1)
 
-/*  MPEG streams, specific to multiplexed streams */
 #define V4L2_CID_MPEG_STREAM_TYPE 		(V4L2_CID_MPEG_BASE+0)
 enum v4l2_mpeg_stream_type {
-	V4L2_MPEG_STREAM_TYPE_MPEG2_PS   = 0, /* MPEG-2 program stream */
-	V4L2_MPEG_STREAM_TYPE_MPEG2_TS   = 1, /* MPEG-2 transport stream */
-	V4L2_MPEG_STREAM_TYPE_MPEG1_SS   = 2, /* MPEG-1 system stream */
-	V4L2_MPEG_STREAM_TYPE_MPEG2_DVD  = 3, /* MPEG-2 DVD-compatible stream */
-	V4L2_MPEG_STREAM_TYPE_MPEG1_VCD  = 4, /* MPEG-1 VCD-compatible stream */
-	V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
+	V4L2_MPEG_STREAM_TYPE_MPEG2_PS   = 0, 
+	V4L2_MPEG_STREAM_TYPE_MPEG2_TS   = 1, 
+	V4L2_MPEG_STREAM_TYPE_MPEG1_SS   = 2, 
+	V4L2_MPEG_STREAM_TYPE_MPEG2_DVD  = 3, 
+	V4L2_MPEG_STREAM_TYPE_MPEG1_VCD  = 4, 
+	V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, 
 };
 #define V4L2_CID_MPEG_STREAM_PID_PMT 		(V4L2_CID_MPEG_BASE+1)
 #define V4L2_CID_MPEG_STREAM_PID_AUDIO 		(V4L2_CID_MPEG_BASE+2)
@@ -1321,11 +983,10 @@
 #define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO 	(V4L2_CID_MPEG_BASE+6)
 #define V4L2_CID_MPEG_STREAM_VBI_FMT 		(V4L2_CID_MPEG_BASE+7)
 enum v4l2_mpeg_stream_vbi_fmt {
-	V4L2_MPEG_STREAM_VBI_FMT_NONE = 0,  /* No VBI in the MPEG stream */
-	V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1,  /* VBI in private packets, IVTV format */
+	V4L2_MPEG_STREAM_VBI_FMT_NONE = 0,  
+	V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1,  
 };
 
-/*  MPEG audio controls specific to multiplexed streams  */
 #define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ 	(V4L2_CID_MPEG_BASE+100)
 enum v4l2_mpeg_audio_sampling_freq {
 	V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
@@ -1440,18 +1101,7 @@
 	V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
 	V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
 };
-#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK	(V4L2_CID_MPEG_BASE+112)
-enum v4l2_mpeg_audio_dec_playback {
-	V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO	    = 0,
-	V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO	    = 1,
-	V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT	    = 2,
-	V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT	    = 3,
-	V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO	    = 4,
-	V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5,
-};
-#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113)
 
-/*  MPEG video controls specific to multiplexed streams */
 #define V4L2_CID_MPEG_VIDEO_ENCODING 		(V4L2_CID_MPEG_BASE+200)
 enum v4l2_mpeg_video_encoding {
 	V4L2_MPEG_VIDEO_ENCODING_MPEG_1     = 0,
@@ -1488,6 +1138,7 @@
 	V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE			= 0,
 	V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME	= 1,
 	V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_I_FRAME		= 2,
+
 };
 #define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC			(V4L2_CID_MPEG_BASE+217)
 #define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE		(V4L2_CID_MPEG_BASE+218)
@@ -1500,9 +1151,6 @@
 	V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES	= 2,
 };
 #define V4L2_CID_MPEG_VIDEO_VBV_SIZE			(V4L2_CID_MPEG_BASE+222)
-#define V4L2_CID_MPEG_VIDEO_DEC_PTS			(V4L2_CID_MPEG_BASE+223)
-#define V4L2_CID_MPEG_VIDEO_DEC_FRAME			(V4L2_CID_MPEG_BASE+224)
-
 #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP		(V4L2_CID_MPEG_BASE+300)
 #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP		(V4L2_CID_MPEG_BASE+301)
 #define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP		(V4L2_CID_MPEG_BASE+302)
@@ -1598,7 +1246,6 @@
 #define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP	(V4L2_CID_MPEG_BASE+403)
 #define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP	(V4L2_CID_MPEG_BASE+404)
 #define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL		(V4L2_CID_MPEG_BASE+405)
-
 enum v4l2_mpeg_video_mpeg4_level {
 	V4L2_MPEG_VIDEO_MPEG4_LEVEL_0	= 0,
 	V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B	= 1,
@@ -1619,7 +1266,6 @@
 };
 #define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL		(V4L2_CID_MPEG_BASE+407)
 
-/*  MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
 #define V4L2_CID_MPEG_CX2341X_BASE 				(V4L2_CTRL_CLASS_MPEG | 0x1000)
 #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE 	(V4L2_CID_MPEG_CX2341X_BASE+0)
 enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
@@ -1660,15 +1306,10 @@
 #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP 	(V4L2_CID_MPEG_CX2341X_BASE+10)
 #define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS 	(V4L2_CID_MPEG_CX2341X_BASE+11)
 
-/*  MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */
 #define V4L2_CID_MPEG_MFC51_BASE				(V4L2_CTRL_CLASS_MPEG | 0x1100)
 #define V4L2_CID_MPEG_QCOM_BASE	(V4L2_CTRL_CLASS_MPEG | 0x2100)
 
 #define V4L2_CID_MPEG_QCOM_SET_PERF_LEVEL (V4L2_CID_MPEG_QCOM_BASE + 0)
-enum v3l2_mpeg_qcom_perf_level {
-	V4L2_CID_MPEG_QCOM_PERF_LEVEL_PERFORMANCE		= 0,
-	V4L2_CID_MPEG_QCOM_PERF_LEVEL_TURBO			= 1,
-};
 
 #define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY		(V4L2_CID_MPEG_MFC51_BASE+0)
 #define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE	(V4L2_CID_MPEG_MFC51_BASE+1)
@@ -1694,124 +1335,6 @@
 #define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC		(V4L2_CID_MPEG_MFC51_BASE+53)
 #define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P		(V4L2_CID_MPEG_MFC51_BASE+54)
 
-/*  MPEG-class control IDs specific to the msm_vidc driver */
-#define V4L2_CID_MPEG_MSM_VIDC_BASE		(V4L2_CTRL_CLASS_MPEG | 0x2000)
-
-#define V4L2_CID_MPEG_VIDC_VIDEO_ENABLE_PICTURE_TYPE \
-			(V4L2_CID_MPEG_MSM_VIDC_BASE+0)
-#define V4L2_CID_MPEG_VIDC_VIDEO_KEEP_ASPECT_RATIO \
-			(V4L2_CID_MPEG_MSM_VIDC_BASE+1)
-#define V4L2_CID_MPEG_VIDC_VIDEO_POST_LOOP_DEBLOCKER_MODE \
-			(V4L2_CID_MPEG_MSM_VIDC_BASE+2)
-#define V4L2_CID_MPEG_VIDC_VIDEO_DIVX_FORMAT \
-			(V4L2_CID_MPEG_MSM_VIDC_BASE+3)
-enum v4l2_mpeg_vidc_video_divx_format_type {
-	V4L2_MPEG_VIDC_VIDEO_DIVX_FORMAT_4		= 0,
-	V4L2_MPEG_VIDC_VIDEO_DIVX_FORMAT_5		= 1,
-	V4L2_MPEG_VIDC_VIDEO_DIVX_FORMAT_6	    = 2,
-};
-#define V4L2_CID_MPEG_VIDC_VIDEO_MB_ERROR_MAP_REPORTING	\
-			(V4L2_CID_MPEG_MSM_VIDC_BASE+4)
-#define V4L2_CID_MPEG_VIDC_VIDEO_CONTINUE_DATA_TRANSFER \
-			(V4L2_CID_MPEG_MSM_VIDC_BASE+5)
-
-#define V4L2_CID_MPEG_VIDC_VIDEO_STREAM_FORMAT   (V4L2_CID_MPEG_MSM_VIDC_BASE+6)
-enum v4l2_mpeg_vidc_video_stream_format {
-	V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_STARTCODES         = 0,
-	V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_ONE_NAL_PER_BUFFER = 1,
-	V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_ONE_BYTE_LENGTH    = 2,
-	V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_TWO_BYTE_LENGTH    = 3,
-	V4L2_MPEG_VIDC_VIDEO_NAL_FORMAT_FOUR_BYTE_LENGTH   = 4,
-};
-
-#define V4L2_CID_MPEG_VIDC_VIDEO_OUTPUT_ORDER   (V4L2_CID_MPEG_MSM_VIDC_BASE+7)
-enum v4l2_mpeg_vidc_video_output_order {
-	V4L2_MPEG_VIDC_VIDEO_OUTPUT_ORDER_DISPLAY         = 0,
-	V4L2_MPEG_VIDC_VIDEO_OUTPUT_ORDER_DECODE          = 1,
-};
-
-#define V4L2_CID_MPEG_VIDC_VIDEO_FRAME_RATE   (V4L2_CID_MPEG_MSM_VIDC_BASE+8)
-#define V4L2_CID_MPEG_VIDC_VIDEO_IDR_PERIOD   (V4L2_CID_MPEG_MSM_VIDC_BASE+9)
-#define V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES (V4L2_CID_MPEG_MSM_VIDC_BASE+10)
-#define V4L2_CID_MPEG_VIDC_VIDEO_NUM_B_FRAMES (V4L2_CID_MPEG_MSM_VIDC_BASE+11)
-#define V4L2_CID_MPEG_VIDC_VIDEO_REQUEST_IFRAME (V4L2_CID_MPEG_MSM_VIDC_BASE+12)
-
-#define V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL (V4L2_CID_MPEG_MSM_VIDC_BASE+13)
-enum v4l2_mpeg_vidc_video_rate_control {
-	V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_OFF = 0,
-	V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_VBR_VFR = 1,
-	V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_VBR_CFR = 2,
-	V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_VFR = 3,
-	V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_CFR = 4,
-};
-
-#define V4L2_CID_MPEG_VIDC_VIDEO_ROTATION (V4L2_CID_MPEG_MSM_VIDC_BASE+14)
-enum v4l2_mpeg_vidc_video_rotation {
-	V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_NONE = 0,
-	V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_90 = 1,
-	V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_180 = 2,
-	V4L2_CID_MPEG_VIDC_VIDEO_ROTATION_270 = 3,
-};
-#define MSM_VIDC_BASE V4L2_CID_MPEG_MSM_VIDC_BASE
-#define V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL (MSM_VIDC_BASE+15)
-enum v4l2_mpeg_vidc_h264_cabac_model {
-	V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL_0 = 0,
-	V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL_1 = 1,
-	V4L2_CID_MPEG_VIDC_VIDEO_H264_CABAC_MODEL_2 = 2,
-};
-
-#define V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_MODE (MSM_VIDC_BASE+16)
-enum v4l2_mpeg_vidc_video_intra_refresh_mode {
-	V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_NONE = 0,
-	V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_CYCLIC = 1,
-	V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_ADAPTIVE = 2,
-	V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_CYCLIC_ADAPTIVE = 3,
-	V4L2_CID_MPEG_VIDC_VIDEO_INTRA_REFRESH_RANDOM = 4,
-};
-#define V4L2_CID_MPEG_VIDC_VIDEO_AIR_MBS (V4L2_CID_MPEG_MSM_VIDC_BASE+17)
-#define V4L2_CID_MPEG_VIDC_VIDEO_AIR_REF (V4L2_CID_MPEG_MSM_VIDC_BASE+18)
-#define V4L2_CID_MPEG_VIDC_VIDEO_CIR_MBS (V4L2_CID_MPEG_MSM_VIDC_BASE+19)
-
-#define V4L2_CID_MPEG_VIDC_VIDEO_H263_PROFILE (V4L2_CID_MPEG_MSM_VIDC_BASE+20)
-enum v4l2_mpeg_vidc_video_h263_profile {
-	V4L2_MPEG_VIDC_VIDEO_H263_PROFILE_BASELINE = 0,
-	V4L2_MPEG_VIDC_VIDEO_H263_PROFILE_H320CODING	= 1,
-	V4L2_MPEG_VIDC_VIDEO_H263_PROFILE_BACKWARDCOMPATIBLE = 2,
-	V4L2_MPEG_VIDC_VIDEO_H263_PROFILE_ISWV2 = 3,
-	V4L2_MPEG_VIDC_VIDEO_H263_PROFILE_ISWV3 = 4,
-	V4L2_MPEG_VIDC_VIDEO_H263_PROFILE_HIGHCOMPRESSION = 5,
-	V4L2_MPEG_VIDC_VIDEO_H263_PROFILE_INTERNET = 6,
-	V4L2_MPEG_VIDC_VIDEO_H263_PROFILE_INTERLACE = 7,
-	V4L2_MPEG_VIDC_VIDEO_H263_PROFILE_HIGHLATENCY = 8,
-};
-
-#define V4L2_CID_MPEG_VIDC_VIDEO_H263_LEVEL (V4L2_CID_MPEG_MSM_VIDC_BASE+21)
-enum v4l2_mpeg_vidc_video_h263_level {
-	V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_1_0 = 0,
-	V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_2_0 = 1,
-	V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_3_0 = 2,
-	V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_4_0 = 3,
-	V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_4_5 = 4,
-	V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_5_0 = 5,
-	V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_6_0 = 6,
-	V4L2_MPEG_VIDC_VIDEO_H263_LEVEL_7_0 = 7,
-};
-
-#define V4L2_CID_MPEG_VIDC_VIDEO_H264_AU_DELIMITER \
-		(V4L2_CID_MPEG_MSM_VIDC_BASE + 22)
-enum v4l2_mpeg_vidc_video_h264_au_delimiter {
-	V4L2_MPEG_VIDC_VIDEO_H264_AU_DELIMITER_DISABLED = 0,
-	V4L2_MPEG_VIDC_VIDEO_H264_AU_DELIMITER_ENABLED = 1
-};
-
-#define V4L2_CID_MPEG_VIDC_VIDEO_H264_VUI_TIMING_INFO \
-		(V4L2_CID_MPEG_MSM_VIDC_BASE + 23)
-enum v4l2_mpeg_vidc_video_h264_vui_timing_info {
-	V4L2_MPEG_VIDC_VIDEO_H264_VUI_TIMING_INFO_DISABLED = 0,
-	V4L2_MPEG_VIDC_VIDEO_H264_VUI_TIMING_INFO_ENABLED = 1
-};
-
-/*  Camera class control IDs */
 #define V4L2_CID_CAMERA_CLASS_BASE 	(V4L2_CTRL_CLASS_CAMERA | 0x900)
 #define V4L2_CID_CAMERA_CLASS 		(V4L2_CTRL_CLASS_CAMERA | 1)
 
@@ -1846,7 +1369,6 @@
 #define V4L2_CID_IRIS_ABSOLUTE			(V4L2_CID_CAMERA_CLASS_BASE+17)
 #define V4L2_CID_IRIS_RELATIVE			(V4L2_CID_CAMERA_CLASS_BASE+18)
 
-/* FM Modulator class control IDs */
 #define V4L2_CID_FM_TX_CLASS_BASE		(V4L2_CTRL_CLASS_FM_TX | 0x900)
 #define V4L2_CID_FM_TX_CLASS			(V4L2_CTRL_CLASS_FM_TX | 1)
 
@@ -1879,69 +1401,6 @@
 #define V4L2_CID_TUNE_POWER_LEVEL		(V4L2_CID_FM_TX_CLASS_BASE + 113)
 #define V4L2_CID_TUNE_ANTENNA_CAPACITOR		(V4L2_CID_FM_TX_CLASS_BASE + 114)
 
-/* Flash and privacy (indicator) light controls */
-#define V4L2_CID_FLASH_CLASS_BASE		(V4L2_CTRL_CLASS_FLASH | 0x900)
-#define V4L2_CID_FLASH_CLASS			(V4L2_CTRL_CLASS_FLASH | 1)
-
-#define V4L2_CID_FLASH_LED_MODE			(V4L2_CID_FLASH_CLASS_BASE + 1)
-enum v4l2_flash_led_mode {
-	V4L2_FLASH_LED_MODE_NONE,
-	V4L2_FLASH_LED_MODE_FLASH,
-	V4L2_FLASH_LED_MODE_TORCH,
-};
-
-#define V4L2_CID_FLASH_STROBE_SOURCE		(V4L2_CID_FLASH_CLASS_BASE + 2)
-enum v4l2_flash_strobe_source {
-	V4L2_FLASH_STROBE_SOURCE_SOFTWARE,
-	V4L2_FLASH_STROBE_SOURCE_EXTERNAL,
-};
-
-#define V4L2_CID_FLASH_STROBE			(V4L2_CID_FLASH_CLASS_BASE + 3)
-#define V4L2_CID_FLASH_STROBE_STOP		(V4L2_CID_FLASH_CLASS_BASE + 4)
-#define V4L2_CID_FLASH_STROBE_STATUS		(V4L2_CID_FLASH_CLASS_BASE + 5)
-
-#define V4L2_CID_FLASH_TIMEOUT			(V4L2_CID_FLASH_CLASS_BASE + 6)
-#define V4L2_CID_FLASH_INTENSITY		(V4L2_CID_FLASH_CLASS_BASE + 7)
-#define V4L2_CID_FLASH_TORCH_INTENSITY		(V4L2_CID_FLASH_CLASS_BASE + 8)
-#define V4L2_CID_FLASH_INDICATOR_INTENSITY	(V4L2_CID_FLASH_CLASS_BASE + 9)
-
-#define V4L2_CID_FLASH_FAULT			(V4L2_CID_FLASH_CLASS_BASE + 10)
-#define V4L2_FLASH_FAULT_OVER_VOLTAGE		(1 << 0)
-#define V4L2_FLASH_FAULT_TIMEOUT		(1 << 1)
-#define V4L2_FLASH_FAULT_OVER_TEMPERATURE	(1 << 2)
-#define V4L2_FLASH_FAULT_SHORT_CIRCUIT		(1 << 3)
-#define V4L2_FLASH_FAULT_OVER_CURRENT		(1 << 4)
-#define V4L2_FLASH_FAULT_INDICATOR		(1 << 5)
-
-#define V4L2_CID_FLASH_CHARGE			(V4L2_CID_FLASH_CLASS_BASE + 11)
-#define V4L2_CID_FLASH_READY			(V4L2_CID_FLASH_CLASS_BASE + 12)
-
-/*  JPEG-class control IDs defined by V4L2 */
-#define V4L2_CID_JPEG_CLASS_BASE		(V4L2_CTRL_CLASS_JPEG | 0x900)
-#define V4L2_CID_JPEG_CLASS			(V4L2_CTRL_CLASS_JPEG | 1)
-
-#define	V4L2_CID_JPEG_CHROMA_SUBSAMPLING	(V4L2_CID_JPEG_CLASS_BASE + 1)
-enum v4l2_jpeg_chroma_subsampling {
-	V4L2_JPEG_CHROMA_SUBSAMPLING_444	= 0,
-	V4L2_JPEG_CHROMA_SUBSAMPLING_422	= 1,
-	V4L2_JPEG_CHROMA_SUBSAMPLING_420	= 2,
-	V4L2_JPEG_CHROMA_SUBSAMPLING_411	= 3,
-	V4L2_JPEG_CHROMA_SUBSAMPLING_410	= 4,
-	V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY	= 5,
-};
-#define	V4L2_CID_JPEG_RESTART_INTERVAL		(V4L2_CID_JPEG_CLASS_BASE + 2)
-#define	V4L2_CID_JPEG_COMPRESSION_QUALITY	(V4L2_CID_JPEG_CLASS_BASE + 3)
-
-#define	V4L2_CID_JPEG_ACTIVE_MARKER		(V4L2_CID_JPEG_CLASS_BASE + 4)
-#define	V4L2_JPEG_ACTIVE_MARKER_APP0		(1 << 0)
-#define	V4L2_JPEG_ACTIVE_MARKER_APP1		(1 << 1)
-#define	V4L2_JPEG_ACTIVE_MARKER_COM		(1 << 16)
-#define	V4L2_JPEG_ACTIVE_MARKER_DQT		(1 << 17)
-#define	V4L2_JPEG_ACTIVE_MARKER_DHT		(1 << 18)
-
-/*
- *	T U N I N G
- */
 struct v4l2_tuner {
 	__u32                   index;
 	__u8			name[32];
@@ -1966,7 +1425,6 @@
 	__u32			reserved[4];
 };
 
-/*  Flags for the 'capability' field */
 #define V4L2_TUNER_CAP_LOW		0x0001
 #define V4L2_TUNER_CAP_NORM		0x0002
 #define V4L2_TUNER_CAP_STEREO		0x0010
@@ -1977,7 +1435,6 @@
 #define V4L2_TUNER_CAP_RDS_BLOCK_IO	0x0100
 #define V4L2_TUNER_CAP_RDS_CONTROLS	0x0200
 
-/*  Flags for the 'rxsubchans' field */
 #define V4L2_TUNER_SUB_MONO		0x0001
 #define V4L2_TUNER_SUB_STEREO		0x0002
 #define V4L2_TUNER_SUB_LANG2		0x0004
@@ -1985,7 +1442,6 @@
 #define V4L2_TUNER_SUB_LANG1		0x0008
 #define V4L2_TUNER_SUB_RDS		0x0010
 
-/*  Values for the 'audmode' field */
 #define V4L2_TUNER_MODE_MONO		0x0000
 #define V4L2_TUNER_MODE_STEREO		0x0001
 #define V4L2_TUNER_MODE_LANG2		0x0002
@@ -2009,9 +1465,6 @@
 	__u32		      reserved[7];
 };
 
-/*
- *	R D S
- */
 
 struct v4l2_rds_data {
 	__u8 	lsb;
@@ -2030,9 +1483,6 @@
 #define V4L2_RDS_BLOCK_CORRECTED 0x40
 #define V4L2_RDS_BLOCK_ERROR 	 0x80
 
-/*
- *	A U D I O
- */
 struct v4l2_audio {
 	__u32	index;
 	__u8	name[32];
@@ -2041,11 +1491,9 @@
 	__u32	reserved[2];
 };
 
-/*  Flags for the 'capability' field */
 #define V4L2_AUDCAP_STEREO		0x00001
 #define V4L2_AUDCAP_AVL			0x00002
 
-/*  Flags for the 'mode' field */
 #define V4L2_AUDMODE_AVL		0x00001
 
 struct v4l2_audioout {
@@ -2056,11 +1504,6 @@
 	__u32	reserved[2];
 };
 
-/*
- *	M P E G   S E R V I C E S
- *
- *	NOTE: EXPERIMENTAL API
- */
 #if 1
 #define V4L2_ENC_IDX_FRAME_I    (0)
 #define V4L2_ENC_IDX_FRAME_P    (1)
@@ -2089,7 +1532,6 @@
 #define V4L2_ENC_CMD_PAUSE      (2)
 #define V4L2_ENC_CMD_RESUME     (3)
 
-/* Flags for V4L2_ENC_CMD_STOP */
 #define V4L2_ENC_CMD_STOP_AT_GOP_END    (1 << 0)
 
 struct v4l2_encoder_cmd {
@@ -2102,112 +1544,35 @@
 	};
 };
 
-#define V4L2_QCOM_BUF_FLAG_CODECCONFIG	0x4000
-
-/* Decoder commands */
-#define V4L2_DEC_CMD_START       (0)
-#define V4L2_DEC_CMD_STOP        (1)
-#define V4L2_DEC_CMD_PAUSE       (2)
-#define V4L2_DEC_CMD_RESUME      (3)
-#define V4L2_DEC_QCOM_CMD_FLUSH  (4)
-
-/* Flags for V4L2_DEC_CMD_START */
-#define V4L2_DEC_CMD_START_MUTE_AUDIO	(1 << 0)
-
-/* Flags for V4L2_DEC_CMD_PAUSE */
-#define V4L2_DEC_CMD_PAUSE_TO_BLACK	(1 << 0)
-
-/* Flags for V4L2_DEC_CMD_STOP */
-#define V4L2_DEC_CMD_STOP_TO_BLACK	(1 << 0)
-#define V4L2_DEC_CMD_STOP_IMMEDIATELY	(1 << 1)
-
-/* Flags for V4L2_DEC_QCOM_CMD_FLUSH */
-#define V4L2_DEC_QCOM_CMD_FLUSH_OUTPUT  (1 << 0)
-#define V4L2_DEC_QCOM_CMD_FLUSH_CAPTURE (1 << 1)
-
-/* Play format requirements (returned by the driver): */
-
-/* The decoder has no special format requirements */
-#define V4L2_DEC_START_FMT_NONE		(0)
-/* The decoder requires full GOPs */
-#define V4L2_DEC_START_FMT_GOP		(1)
-
-/* The structure must be zeroed before use by the application
-   This ensures it can be extended safely in the future. */
-struct v4l2_decoder_cmd {
-	__u32 cmd;
-	__u32 flags;
-	union {
-		struct {
-			__u64 pts;
-		} stop;
-
-		struct {
-			/* 0 or 1000 specifies normal speed,
-			   1 specifies forward single stepping,
-			   -1 specifies backward single stepping,
-			   >1: playback at speed/1000 of the normal speed,
-			   <-1: reverse playback at (-speed/1000) of the normal speed. */
-			__s32 speed;
-			__u32 format;
-		} start;
-
-		struct {
-			__u32 data[16];
-		} raw;
-	};
-};
 #endif
 
 
-/*
- *	D A T A   S E R V I C E S   ( V B I )
- *
- *	Data services API by Michael Schimek
- */
 
-/* Raw VBI */
 struct v4l2_vbi_format {
-	__u32	sampling_rate;		/* in 1 Hz */
+	__u32	sampling_rate;		
 	__u32	offset;
 	__u32	samples_per_line;
-	__u32	sample_format;		/* V4L2_PIX_FMT_* */
+	__u32	sample_format;		
 	__s32	start[2];
 	__u32	count[2];
-	__u32	flags;			/* V4L2_VBI_* */
-	__u32	reserved[2];		/* must be zero */
+	__u32	flags;			
+	__u32	reserved[2];		
 };
 
-/*  VBI flags  */
 #define V4L2_VBI_UNSYNC		(1 << 0)
 #define V4L2_VBI_INTERLACED	(1 << 1)
 
-/* Sliced VBI
- *
- *    This implements is a proposal V4L2 API to allow SLICED VBI
- * required for some hardware encoders. It should change without
- * notice in the definitive implementation.
- */
 
 struct v4l2_sliced_vbi_format {
 	__u16   service_set;
-	/* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
-	   service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
-				 (equals frame lines 313-336 for 625 line video
-				  standards, 263-286 for 525 line standards) */
 	__u16   service_lines[2][24];
 	__u32   io_size;
-	__u32   reserved[2];            /* must be zero */
+	__u32   reserved[2];            
 };
 
-/* Teletext World System Teletext
-   (WST), defined on ITU-R BT.653-2 */
 #define V4L2_SLICED_TELETEXT_B          (0x0001)
-/* Video Program System, defined on ETS 300 231*/
 #define V4L2_SLICED_VPS                 (0x0400)
-/* Closed Caption, defined on EIA-608 */
 #define V4L2_SLICED_CAPTION_525         (0x1000)
-/* Wide Screen System, defined on ITU-R BT1119.1 */
 #define V4L2_SLICED_WSS_625             (0x4000)
 
 #define V4L2_SLICED_VBI_525             (V4L2_SLICED_CAPTION_525)
@@ -2215,52 +1580,33 @@
 
 struct v4l2_sliced_vbi_cap {
 	__u16   service_set;
-	/* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
-	   service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
-				 (equals frame lines 313-336 for 625 line video
-				  standards, 263-286 for 525 line standards) */
 	__u16   service_lines[2][24];
 	enum v4l2_buf_type type;
-	__u32   reserved[3];    /* must be 0 */
+	__u32   reserved[3];    
 };
 
 struct v4l2_sliced_vbi_data {
 	__u32   id;
-	__u32   field;          /* 0: first field, 1: second field */
-	__u32   line;           /* 1-23 */
-	__u32   reserved;       /* must be 0 */
+	__u32   field;          
+	__u32   line;           
+	__u32   reserved;       
 	__u8    data[48];
 };
 
-/*
- * Sliced VBI data inserted into MPEG Streams
- */
 
-/*
- * V4L2_MPEG_STREAM_VBI_FMT_IVTV:
- *
- * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an
- * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI
- * data
- *
- * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header
- * definitions are not included here.  See the MPEG-2 specifications for details
- * on these headers.
- */
 
-/* Line type IDs */
 #define V4L2_MPEG_VBI_IVTV_TELETEXT_B     (1)
 #define V4L2_MPEG_VBI_IVTV_CAPTION_525    (4)
 #define V4L2_MPEG_VBI_IVTV_WSS_625        (5)
 #define V4L2_MPEG_VBI_IVTV_VPS            (7)
 
 struct v4l2_mpeg_vbi_itv0_line {
-	__u8 id;	/* One of V4L2_MPEG_VBI_IVTV_* above */
-	__u8 data[42];	/* Sliced VBI data for the line */
+	__u8 id;	
+	__u8 data[42];	
 } __attribute__ ((packed));
 
 struct v4l2_mpeg_vbi_itv0 {
-	__le32 linemask[2]; /* Bitmasks of VBI service lines present */
+	__le32 linemask[2]; 
 	struct v4l2_mpeg_vbi_itv0_line line[35];
 } __attribute__ ((packed));
 
@@ -2279,33 +1625,13 @@
 	};
 } __attribute__ ((packed));
 
-/*
- *	A G G R E G A T E   S T R U C T U R E S
- */
 
-/**
- * struct v4l2_plane_pix_format - additional, per-plane format definition
- * @sizeimage:		maximum size in bytes required for data, for which
- *			this plane will be used
- * @bytesperline:	distance in bytes between the leftmost pixels in two
- *			adjacent lines
- */
 struct v4l2_plane_pix_format {
 	__u32		sizeimage;
 	__u16		bytesperline;
 	__u16		reserved[7];
 } __attribute__ ((packed));
 
-/**
- * struct v4l2_pix_format_mplane - multiplanar format definition
- * @width:		image width in pixels
- * @height:		image height in pixels
- * @pixelformat:	little endian four character code (fourcc)
- * @field:		field order (for interlaced video)
- * @colorspace:		supplemental to pixelformat
- * @plane_fmt:		per-plane information
- * @num_planes:		number of planes for this format
- */
 struct v4l2_pix_format_mplane {
 	__u32				width;
 	__u32				height;
@@ -2318,129 +1644,65 @@
 	__u8				reserved[11];
 } __attribute__ ((packed));
 
-/**
- * struct v4l2_format - stream data format
- * @type:	type of the data stream
- * @pix:	definition of an image format
- * @pix_mp:	definition of a multiplanar image format
- * @win:	definition of an overlaid image
- * @vbi:	raw VBI capture or output parameters
- * @sliced:	sliced VBI capture or output parameters
- * @raw_data:	placeholder for future extensions and custom formats
- */
 struct v4l2_format {
 	enum v4l2_buf_type type;
 	union {
-		struct v4l2_pix_format		pix;     /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
-		struct v4l2_pix_format_mplane	pix_mp;  /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
-		struct v4l2_window		win;     /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
-		struct v4l2_vbi_format		vbi;     /* V4L2_BUF_TYPE_VBI_CAPTURE */
-		struct v4l2_sliced_vbi_format	sliced;  /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
-		__u8	raw_data[200];                   /* user-defined */
+		struct v4l2_pix_format		pix;     
+		struct v4l2_pix_format_mplane	pix_mp;  
+		struct v4l2_window		win;     
+		struct v4l2_vbi_format		vbi;     
+		struct v4l2_sliced_vbi_format	sliced;  
+		__u8	raw_data[200];                   
 	} fmt;
 };
 
-/*	Stream type-dependent parameters
- */
 struct v4l2_streamparm {
 	enum v4l2_buf_type type;
 	union {
 		struct v4l2_captureparm	capture;
 		struct v4l2_outputparm	output;
-		__u8	raw_data[200];  /* user-defined */
+		__u8	raw_data[200];  
 	} parm;
 };
 
-/*
- *	E V E N T S
- */
 
 #define V4L2_EVENT_ALL				0
 #define V4L2_EVENT_VSYNC			1
 #define V4L2_EVENT_EOS				2
-#define V4L2_EVENT_CTRL				3
-#define V4L2_EVENT_FRAME_SYNC			4
 #define V4L2_EVENT_PRIVATE_START		0x08000000
 
-#define V4L2_EVENT_MSM_VIDC_START	(V4L2_EVENT_PRIVATE_START + 0x00001000)
-#define V4L2_EVENT_MSM_VIDC_FLUSH_DONE	(V4L2_EVENT_MSM_VIDC_START + 1)
-#define V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_CHANGED_SUFFICIENT	\
-		(V4L2_EVENT_MSM_VIDC_START + 2)
-#define V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_CHANGED_INSUFFICIENT	\
-		(V4L2_EVENT_MSM_VIDC_START + 3)
-#define V4L2_EVENT_MSM_VIDC_CLOSE_DONE	(V4L2_EVENT_MSM_VIDC_START + 4)
-
-
-/* Payload for V4L2_EVENT_VSYNC */
 struct v4l2_event_vsync {
-	/* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
+	
 	__u8 field;
 } __attribute__ ((packed));
 
-/* Payload for V4L2_EVENT_CTRL */
-#define V4L2_EVENT_CTRL_CH_VALUE		(1 << 0)
-#define V4L2_EVENT_CTRL_CH_FLAGS		(1 << 1)
-
-struct v4l2_event_ctrl {
-	__u32 changes;
-	__u32 type;
-	union {
-		__s32 value;
-		__s64 value64;
-	};
-	__u32 flags;
-	__s32 minimum;
-	__s32 maximum;
-	__s32 step;
-	__s32 default_value;
-};
-
-struct v4l2_event_frame_sync {
-	__u32 frame_sequence;
-};
-
 struct v4l2_event {
 	__u32				type;
 	union {
-		struct v4l2_event_vsync		vsync;
-		struct v4l2_event_ctrl		ctrl;
-		struct v4l2_event_frame_sync	frame_sync;
-		__u8				data[64];
+		struct v4l2_event_vsync vsync;
+		__u8			data[64];
 	} u;
 	__u32				pending;
 	__u32				sequence;
 	struct timespec			timestamp;
-	__u32				id;
-	__u32				reserved[8];
+	__u32				reserved[9];
 };
 
-#define V4L2_EVENT_SUB_FL_SEND_INITIAL		(1 << 0)
-#define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK	(1 << 1)
-
 struct v4l2_event_subscription {
 	__u32				type;
-	__u32				id;
-	__u32				flags;
-	__u32				reserved[5];
+	__u32				reserved[7];
 };
 
-/*
- *	A D V A N C E D   D E B U G G I N G
- *
- *	NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
- *	FOR DEBUGGING, TESTING AND INTERNAL USE ONLY!
- */
 
-/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
 
-#define V4L2_CHIP_MATCH_HOST       0  /* Match against chip ID on host (0 for the host) */
-#define V4L2_CHIP_MATCH_I2C_DRIVER 1  /* Match against I2C driver name */
-#define V4L2_CHIP_MATCH_I2C_ADDR   2  /* Match against I2C 7-bit address */
-#define V4L2_CHIP_MATCH_AC97       3  /* Match against anciliary AC97 chip */
+#define V4L2_CHIP_MATCH_HOST       0  
+#define V4L2_CHIP_MATCH_I2C_DRIVER 1  
+#define V4L2_CHIP_MATCH_I2C_ADDR   2  
+#define V4L2_CHIP_MATCH_AC97       3  
 
 struct v4l2_dbg_match {
-	__u32 type; /* Match type */
-	union {     /* Match this chip, meaning determined by type */
+	__u32 type; 
+	union {     
 		__u32 addr;
 		char name[32];
 	};
@@ -2448,39 +1710,25 @@
 
 struct v4l2_dbg_register {
 	struct v4l2_dbg_match match;
-	__u32 size;	/* register size in bytes */
+	__u32 size;	
 	__u64 reg;
 	__u64 val;
 } __attribute__ ((packed));
 
-/* VIDIOC_DBG_G_CHIP_IDENT */
 struct v4l2_dbg_chip_ident {
 	struct v4l2_dbg_match match;
-	__u32 ident;       /* chip identifier as specified in <media/v4l2-chip-ident.h> */
-	__u32 revision;    /* chip revision, chip specific */
+	__u32 ident;       
+	__u32 revision;    
 } __attribute__ ((packed));
 
-/**
- * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument
- * @index:	on return, index of the first created buffer
- * @count:	entry: number of requested buffers,
- *		return: number of created buffers
- * @memory:	buffer memory type
- * @format:	frame format, for which buffers are requested
- * @reserved:	future extensions
- */
 struct v4l2_create_buffers {
-	__u32			index;
+	__u32			index;		
 	__u32			count;
 	enum v4l2_memory        memory;
-	struct v4l2_format	format;
+	struct v4l2_format	format;		
 	__u32			reserved[8];
 };
 
-/*
- *	I O C T L   C O D E S   F O R   V I D E O   D E V I C E S
- *
- */
 #define VIDIOC_QUERYCAP		 _IOR('V',  0, struct v4l2_capability)
 #define VIDIOC_RESERVED		  _IO('V',  1)
 #define VIDIOC_ENUM_FMT         _IOWR('V',  2, struct v4l2_fmtdesc)
@@ -2545,14 +1793,9 @@
 #endif
 
 #if 1
-/* Experimental, meant for debugging, testing and internal use.
-   Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
-   You must be root to use these ioctls. Never use these in applications! */
 #define	VIDIOC_DBG_S_REGISTER 	 _IOW('V', 79, struct v4l2_dbg_register)
 #define	VIDIOC_DBG_G_REGISTER 	_IOWR('V', 80, struct v4l2_dbg_register)
 
-/* Experimental, meant for debugging, testing and internal use.
-   Never use this ioctl in applications! */
 #define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
 #endif
 
@@ -2567,23 +1810,10 @@
 #define	VIDIOC_SUBSCRIBE_EVENT	 _IOW('V', 90, struct v4l2_event_subscription)
 #define	VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
 
-/* Experimental, the below two ioctls may change over the next couple of kernel
-   versions */
 #define VIDIOC_CREATE_BUFS	_IOWR('V', 92, struct v4l2_create_buffers)
 #define VIDIOC_PREPARE_BUF	_IOWR('V', 93, struct v4l2_buffer)
 
-/* Experimental selection API */
-#define VIDIOC_G_SELECTION	_IOWR('V', 94, struct v4l2_selection)
-#define VIDIOC_S_SELECTION	_IOWR('V', 95, struct v4l2_selection)
 
-/* Experimental, these two ioctls may change over the next couple of kernel
-   versions. */
-#define VIDIOC_DECODER_CMD	_IOWR('V', 96, struct v4l2_decoder_cmd)
-#define VIDIOC_TRY_DECODER_CMD	_IOWR('V', 97, struct v4l2_decoder_cmd)
+#define BASE_VIDIOC_PRIVATE	192		
 
-/* Reminder: when adding new ioctls please add support for them to
-   drivers/media/video/v4l2-compat-ioctl32.c as well! */
-
-#define BASE_VIDIOC_PRIVATE	192		/* 192-255 are private */
-
-#endif /* __LINUX_VIDEODEV2_H */
+#endif 
diff --git a/include/media/linux_rawchip.h b/include/media/linux_rawchip.h
new file mode 100644
index 0000000..0b691f9
--- /dev/null
+++ b/include/media/linux_rawchip.h
@@ -0,0 +1,102 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU General Public License, version 2, in which case the provisions
+ * of the GPL version 2 are required INSTEAD OF the BSD license.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
+ * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+#ifndef __LINUX_RAWCHIP_H
+#define __LINUX_RAWCHIP_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#define RAWCHIP_IOCTL_MAGIC 'g'
+
+#define RAWCHIP_IOCTL_GET_INT \
+	_IOR(RAWCHIP_IOCTL_MAGIC, 1, struct rawchip_stats_event_ctrl *)
+
+#define RAWCHIP_IOCTL_GET_AF_STATUS \
+	_IOR(RAWCHIP_IOCTL_MAGIC, 2, struct rawchip_stats_event_ctrl *)
+
+#define RAWCHIP_IOCTL_UPDATE_AEC_AWB \
+	_IOW(RAWCHIP_IOCTL_MAGIC, 3, struct rawchip_stats_event_ctrl *)
+
+#define RAWCHIP_IOCTL_UPDATE_AF \
+	_IOW(RAWCHIP_IOCTL_MAGIC, 4, struct rawchip_stats_event_ctrl *)
+
+#define RAWCHIP_IOCTL_UPDATE_3A \
+	_IOW(RAWCHIP_IOCTL_MAGIC, 5, struct rawchip_stats_event_ctrl *)
+
+#define RAWCHIP_IOCTL_SET_DXOPRC_AF_STRATEGY \
+	_IOW(RAWCHIP_IOCTL_MAGIC, 6, struct rawchip_stats_event_ctrl *)
+
+#define RAWCHIP_IOCTL_GET_DXOPRC_VER\
+	_IOW(RAWCHIP_IOCTL_MAGIC, 7, struct rawchip_stats_event_ctrl *)
+	
+#define RAWCHIP_IOCTL_GET_DXOPRC_FRAMESETTING\
+	_IOW(RAWCHIP_IOCTL_MAGIC, 8, struct rawchip_stats_event_ctrl *)
+	
+typedef struct
+{	
+	uint8_t 	orientation;
+	uint16_t	xStart;
+	uint16_t	yStart;
+	uint16_t	xEnd;
+	uint16_t	yEnd;
+	uint16_t	xEvenInc;  
+	uint16_t	xOddInc;
+	uint16_t	yEvenInc;  
+	uint16_t	yOddInc;
+	uint8_t 	binning;	
+} rawchip_dxo_frameSetting ;
+
+typedef struct {
+	uint16_t 	udwDOPUcodeId;
+	uint16_t 	udwDOPHwId;
+	uint32_t 	udwDOPCalibId;
+
+	uint16_t 	udwDPPUcodeId;
+	uint16_t 	udwDPPHwId;
+	uint32_t 	udwDPPCalibId;
+	
+	uint16_t 	udwPDPUcodeId;
+	uint16_t 	udwPDPHwId;
+	uint32_t 	udwPDPCalibId;
+} rawchip_dxo_version;
+
+struct rawchip_stats_event_ctrl {
+	uint32_t type;
+	uint32_t timeout_ms;
+	uint32_t length;
+	void *data;
+};
+
+#endif 
+
diff --git a/include/media/msm_camera.h b/include/media/msm_camera.h
index 72deeee..7cb49b7 100644
--- a/include/media/msm_camera.h
+++ b/include/media/msm_camera.h
@@ -1,5 +1,5 @@
-/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
-*
+/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
  * only version 2 as published by the Free Software Foundation.
@@ -16,7 +16,6 @@
 #ifdef MSM_CAMERA_BIONIC
 #include <sys/types.h>
 #endif
-#include <linux/videodev2.h>
 #include <linux/types.h>
 #include <linux/ioctl.h>
 #ifdef __KERNEL__
@@ -29,13 +28,8 @@
 #endif
 
 #include <linux/msm_ion.h>
-
-#define BIT(nr)   (1UL << (nr))
-
 #define MSM_CAM_IOCTL_MAGIC 'm'
 
-#define MAX_SERVER_PAYLOAD_LENGTH 8192
-
 #define MSM_CAM_IOCTL_GET_SENSOR_INFO \
 	_IOR(MSM_CAM_IOCTL_MAGIC, 1, struct msm_camsensor_info *)
 
@@ -154,7 +148,7 @@
 	_IOW(MSM_CAM_IOCTL_MAGIC, 39, struct msm_camera_st_frame *)
 
 #define MSM_CAM_IOCTL_V4L2_EVT_NOTIFY \
-	_IOW(MSM_CAM_IOCTL_MAGIC, 40, struct v4l2_event_and_payload)
+	_IOR(MSM_CAM_IOCTL_MAGIC, 40, struct v4l2_event *)
 
 #define MSM_CAM_IOCTL_SET_MEM_MAP_INFO \
 	_IOR(MSM_CAM_IOCTL_MAGIC, 41, struct msm_mem_map_info *)
@@ -192,86 +186,19 @@
 #define MSM_CAM_IOCTL_GET_ACTUATOR_INFO \
 	_IOW(MSM_CAM_IOCTL_MAGIC, 52, struct msm_actuator_cfg_data *)
 
-#define MSM_CAM_IOCTL_EEPROM_IO_CFG \
-	_IOW(MSM_CAM_IOCTL_MAGIC, 53, struct msm_eeprom_cfg_data *)
+#define QCT_IOCTL_MAX 54 
 
-#define MSM_CAM_IOCTL_ISPIF_IO_CFG \
-	_IOR(MSM_CAM_IOCTL_MAGIC, 54, struct ispif_cfg_data *)
+#define MSM_CAM_IOCTL_ENABLE_DROP_FRAME \
+	_IOW(MSM_CAM_IOCTL_MAGIC, QCT_IOCTL_MAX+1, int *)
 
-#define MSM_CAM_IOCTL_STATS_REQBUF \
-	_IOR(MSM_CAM_IOCTL_MAGIC, 55, struct msm_stats_reqbuf *)
+#define MSM_CAM_IOCTL_SET_DROP_FRAME_NUM \
+	_IOW(MSM_CAM_IOCTL_MAGIC, QCT_IOCTL_MAX+2, int *)
 
-#define MSM_CAM_IOCTL_STATS_ENQUEUEBUF \
-	_IOR(MSM_CAM_IOCTL_MAGIC, 56, struct msm_stats_buf_info *)
+#define MSM_CAM_IOCTL_RETURN_FREE_FRAME \
+	_IOR(MSM_CAM_IOCTL_MAGIC, QCT_IOCTL_MAX+3, struct msm_cam_evt_divert_frame *)
 
-#define MSM_CAM_IOCTL_STATS_FLUSH_BUFQ \
-	_IOR(MSM_CAM_IOCTL_MAGIC, 57, struct msm_stats_flush_bufq *)
-
-#define MSM_CAM_IOCTL_SET_MCTL_SDEV \
-	_IOW(MSM_CAM_IOCTL_MAGIC, 58, struct msm_mctl_set_sdev_data *)
-
-#define MSM_CAM_IOCTL_UNSET_MCTL_SDEV \
-	_IOW(MSM_CAM_IOCTL_MAGIC, 59, struct msm_mctl_set_sdev_data *)
-
-#define MSM_CAM_IOCTL_GET_INST_HANDLE \
-	_IOR(MSM_CAM_IOCTL_MAGIC, 60, uint32_t *)
-
-#define MSM_CAM_IOCTL_STATS_UNREG_BUF \
-	_IOR(MSM_CAM_IOCTL_MAGIC, 61, struct msm_stats_flush_bufq *)
-
-#define MSM_CAM_IOCTL_CSIC_IO_CFG \
-	_IOWR(MSM_CAM_IOCTL_MAGIC, 62, struct csic_cfg_data *)
-
-#define MSM_CAM_IOCTL_CSID_IO_CFG \
-	_IOWR(MSM_CAM_IOCTL_MAGIC, 63, struct csid_cfg_data *)
-
-#define MSM_CAM_IOCTL_CSIPHY_IO_CFG \
-	_IOR(MSM_CAM_IOCTL_MAGIC, 64, struct csiphy_cfg_data *)
-
-#define MSM_CAM_IOCTL_OEM \
-	_IOW(MSM_CAM_IOCTL_MAGIC, 65, struct sensor_cfg_data *)
-
-#define MSM_CAM_IOCTL_AXI_INIT \
-	_IOWR(MSM_CAM_IOCTL_MAGIC, 66, uint8_t *)
-
-#define MSM_CAM_IOCTL_AXI_RELEASE \
-	_IO(MSM_CAM_IOCTL_MAGIC, 67)
-
-#define MSM_CAM_IOCTL_V4L2_EVT_NATIVE_CMD \
-	_IOWR(MSM_CAM_IOCTL_MAGIC, 68, struct msm_camera_v4l2_ioctl_t)
-
-#define MSM_CAM_IOCTL_V4L2_EVT_NATIVE_FRONT_CMD \
-	_IOWR(MSM_CAM_IOCTL_MAGIC, 69, struct msm_camera_v4l2_ioctl_t)
-
-#define MSM_CAM_IOCTL_AXI_LOW_POWER_MODE \
-	_IOWR(MSM_CAM_IOCTL_MAGIC, 70, uint8_t *)
-
-#define MSM_CAM_IOCTL_INTF_MCTL_MAPPING_CFG \
-	_IOR(MSM_CAM_IOCTL_MAGIC, 71, struct intf_mctl_mapping_cfg *)
-
-struct ioctl_native_cmd {
-	unsigned short mode;
-	unsigned short address;
-	unsigned short value_1;
-	unsigned short value_2;
-	unsigned short value_3;
-};
-
-struct v4l2_event_and_payload {
-	struct v4l2_event evt;
-	uint32_t payload_length;
-	uint32_t transaction_id;
-	void *payload;
-};
-
-struct msm_stats_reqbuf {
-	int num_buf;		/* how many buffers requested */
-	int stats_type;	/* stats type */
-};
-
-struct msm_stats_flush_bufq {
-	int stats_type;	/* enum msm_stats_enum_type */
-};
+#define MSM_CAM_IOCTL_SET_PERF_LOCK \
+	_IOW(MSM_CAM_IOCTL_MAGIC, QCT_IOCTL_MAX+4, int *)
 
 struct msm_mctl_pp_cmd {
 	int32_t  id;
@@ -305,118 +232,82 @@
 #define MAX_ACTUATOR_TYPE_SIZE 32
 #define MAX_ACTUATOR_REG_TBL_SIZE 8
 
-
 #define MSM_MAX_CAMERA_CONFIGS 2
 
-#define PP_SNAP  BIT(0)
-#define PP_RAW_SNAP BIT(1)
-#define PP_PREV  BIT(2)
-#define PP_THUMB BIT(3)
-#define PP_RDI   BIT(4)
+#define PP_SNAP  0x01
+#define PP_RAW_SNAP ((0x01)<<1)
+#define PP_PREV  ((0x01)<<2)
+#define PP_THUMB ((0x01)<<3)
 #define PP_MASK		(PP_SNAP|PP_RAW_SNAP|PP_PREV|PP_THUMB)
 
 #define MSM_CAM_CTRL_CMD_DONE  0
 #define MSM_CAM_SENSOR_VFE_CMD 1
 
-/* Should be same as VIDEO_MAX_PLANES in videodev2.h */
 #define MAX_PLANES 8
 
-/*****************************************************
- *  structure
- *****************************************************/
 
-/* define five type of structures for userspace <==> kernel
- * space communication:
- * command 1 - 2 are from userspace ==> kernel
- * command 3 - 4 are from kernel ==> userspace
- *
- * 1. control command: control command(from control thread),
- *                     control status (from config thread);
- */
 struct msm_ctrl_cmd {
 	uint16_t type;
 	uint16_t length;
 	void *value;
 	uint16_t status;
 	uint32_t timeout_ms;
-	int resp_fd; /* FIXME: to be used by the kernel, pass-through for now */
-	int vnode_id;  /* video dev id. Can we overload resp_fd? */
+	int resp_fd; 
+	int vnode_id;  
 	int queue_idx;
 	uint32_t evt_id;
-	uint32_t stream_type; /* used to pass value to qcamera server */
-	int config_ident; /*used as identifier for config node*/
+	uint32_t stream_type; 
+	int config_ident; 
 };
 
 struct msm_cam_evt_msg {
-	unsigned short type;	/* 1 == event (RPC), 0 == message (adsp) */
+	unsigned short type;	
 	unsigned short msg_id;
-	unsigned int len;	/* size in, number of bytes out */
+	unsigned int len;	
 	uint32_t frame_id;
 	void *data;
 	struct timespec timestamp;
 };
 
 struct msm_pp_frame_sp {
-	/* phy addr of the buffer */
+	
 	unsigned long  phy_addr;
 	uint32_t       y_off;
 	uint32_t       cbcr_off;
-	/* buffer length */
+	
 	uint32_t       length;
 	int32_t        fd;
 	uint32_t       addr_offset;
-	/* mapped addr */
+	
 	unsigned long  vaddr;
 };
 
 struct msm_pp_frame_mp {
-	/* phy addr of the plane */
+	
 	unsigned long  phy_addr;
-	/* offset of plane data */
+	
 	uint32_t       data_offset;
-	/* plane length */
+	
 	uint32_t       length;
 	int32_t        fd;
 	uint32_t       addr_offset;
-	/* mapped addr */
+	
 	unsigned long  vaddr;
 };
 
 struct msm_pp_frame {
-	uint32_t       handle; /* stores vb cookie */
+	uint32_t       handle; 
 	uint32_t       frame_id;
 	unsigned short buf_idx;
 	int            path;
 	unsigned short image_type;
-	unsigned short num_planes; /* 1 for sp */
+	unsigned short num_planes; 
 	struct timeval timestamp;
 	union {
 		struct msm_pp_frame_sp sp;
 		struct msm_pp_frame_mp mp[MAX_PLANES];
 	};
 	int node_type;
-	uint32_t inst_handle;
-};
-
-struct msm_pp_crop {
-	uint32_t  src_x;
-	uint32_t  src_y;
-	uint32_t  src_w;
-	uint32_t  src_h;
-	uint32_t  dst_x;
-	uint32_t  dst_y;
-	uint32_t  dst_w;
-	uint32_t  dst_h;
-	uint8_t update_flag;
-};
-
-struct msm_mctl_pp_frame_cmd {
-	uint32_t cookie;
-	uint8_t  vpe_output_action;
-	struct msm_pp_frame src_frame;
-	struct msm_pp_frame dest_frame;
-	struct msm_pp_crop crop;
-	int path;
 };
 
 struct msm_cam_evt_divert_frame {
@@ -429,9 +320,9 @@
 };
 
 struct msm_mctl_pp_cmd_ack_event {
-	uint32_t cmd;        /* VPE_CMD_ZOOM? */
-	int      status;     /* 0 done, < 0 err */
-	uint32_t cookie;     /* daemon's cookie */
+	uint32_t cmd;        
+	int      status;     
+	uint32_t cookie;     
 };
 
 struct msm_mctl_pp_event_info {
@@ -464,26 +355,19 @@
 #define MSM_CAM_APP_NOTIFY_EVENT  0
 #define MSM_CAM_APP_NOTIFY_ERROR_EVENT  1
 
-/* this one is used to send ctrl/status up to config thread */
 
 struct msm_stats_event_ctrl {
-	/* 0 - ctrl_cmd from control thread,
-	 * 1 - stats/event kernel,
-	 * 2 - V4L control or read request */
 	int resptype;
 	int timeout_ms;
 	struct msm_ctrl_cmd ctrl_cmd;
-	/* struct  vfe_event_t  stats_event; */
+	
 	struct msm_cam_evt_msg stats_event;
 };
 
-/* 2. config command: config command(from config thread); */
 struct msm_camera_cfg_cmd {
-	/* what to config:
-	 * 1 - sensor config, 2 - vfe config */
 	uint16_t cfg_type;
 
-	/* sensor config type */
+	
 	uint16_t cmd_type;
 	uint16_t queue;
 	uint16_t length;
@@ -507,11 +391,11 @@
 #define CMD_STATS_AF_ENABLE		13
 #define CMD_STATS_AEC_ENABLE		14
 #define CMD_STATS_AWB_ENABLE		15
-#define CMD_STATS_ENABLE		16
+#define CMD_STATS_ENABLE  		16
 
 #define CMD_STATS_AXI_CFG		17
 #define CMD_STATS_AEC_AXI_CFG		18
-#define CMD_STATS_AF_AXI_CFG		19
+#define CMD_STATS_AF_AXI_CFG 		19
 #define CMD_STATS_AWB_AXI_CFG		20
 #define CMD_STATS_RS_AXI_CFG		21
 #define CMD_STATS_CS_AXI_CFG		22
@@ -541,7 +425,6 @@
 #define CMD_AXI_CFG_ZSL 43
 #define CMD_AXI_CFG_SNAP_VPE 44
 #define CMD_AXI_CFG_SNAP_THUMB_VPE 45
-
 #define CMD_CONFIG_PING_ADDR 46
 #define CMD_CONFIG_PONG_ADDR 47
 #define CMD_CONFIG_FREE_BUF_ADDR 48
@@ -549,39 +432,12 @@
 #define CMD_AXI_CFG_VIDEO_ALL_CHNLS 50
 #define CMD_VFE_BUFFER_RELEASE 51
 #define CMD_VFE_PROCESS_IRQ 52
-#define CMD_STATS_BG_ENABLE 53
-#define CMD_STATS_BF_ENABLE 54
-#define CMD_STATS_BHIST_ENABLE 55
-#define CMD_STATS_BG_BUF_RELEASE 56
-#define CMD_STATS_BF_BUF_RELEASE 57
-#define CMD_STATS_BHIST_BUF_RELEASE 58
-#define CMD_VFE_PIX_SOF_COUNT_UPDATE 59
-#define CMD_VFE_COUNT_PIX_SOF_ENABLE 60
 
-#define CMD_AXI_CFG_PRIM               BIT(8)
-#define CMD_AXI_CFG_PRIM_ALL_CHNLS     BIT(9)
-#define CMD_AXI_CFG_SEC                BIT(10)
-#define CMD_AXI_CFG_SEC_ALL_CHNLS      BIT(11)
-#define CMD_AXI_CFG_TERT1              BIT(12)
-#define CMD_AXI_CFG_TERT2              BIT(13)
-#define CMD_AXI_CFG_TERT3              BIT(14)
+#define CMD_AXI_CFG_PRIM		0xF1
+#define CMD_AXI_CFG_PRIM_ALL_CHNLS	0xF2
+#define CMD_AXI_CFG_SEC			0xF4
+#define CMD_AXI_CFG_SEC_ALL_CHNLS	0xF8
 
-#define CMD_AXI_START  0xE1
-#define CMD_AXI_STOP   0xE2
-#define CMD_AXI_RESET  0xE3
-#define CMD_AXI_ABORT  0xE4
-#define CMD_AXI_STOP_RECOVERY  0xE5
-
-
-
-#define AXI_CMD_PREVIEW      BIT(0)
-#define AXI_CMD_CAPTURE      BIT(1)
-#define AXI_CMD_RECORD       BIT(2)
-#define AXI_CMD_ZSL          BIT(3)
-#define AXI_CMD_RAW_CAPTURE  BIT(4)
-#define AXI_CMD_LIVESHOT     BIT(5)
-
-/* vfe config command: config command(from config thread)*/
 struct msm_vfe_cfg_cmd {
 	int cmd_type;
 	uint16_t length;
@@ -619,10 +475,7 @@
 #define MSM_PMEM_C2D			17
 #define MSM_PMEM_MAINIMG_VPE    18
 #define MSM_PMEM_THUMBNAIL_VPE  19
-#define MSM_PMEM_BAYER_GRID		20
-#define MSM_PMEM_BAYER_FOCUS	21
-#define MSM_PMEM_BAYER_HIST		22
-#define MSM_PMEM_MAX            23
+#define MSM_PMEM_MAX            20
 
 #define STAT_AEAW			0
 #define STAT_AEC			1
@@ -632,10 +485,7 @@
 #define STAT_CS				5
 #define STAT_IHIST			6
 #define STAT_SKIN			7
-#define STAT_BG				8
-#define STAT_BF				9
-#define STAT_BHIST			10
-#define STAT_MAX			11
+#define STAT_MAX			8
 
 #define FRAME_PREVIEW_OUTPUT1		0
 #define FRAME_PREVIEW_OUTPUT2		1
@@ -644,37 +494,6 @@
 #define FRAME_RAW_SNAPSHOT		4
 #define FRAME_MAX			5
 
-enum msm_stats_enum_type {
-	MSM_STATS_TYPE_AEC, /* legacy based AEC */
-	MSM_STATS_TYPE_AF,  /* legacy based AF */
-	MSM_STATS_TYPE_AWB, /* legacy based AWB */
-	MSM_STATS_TYPE_RS,  /* legacy based RS */
-	MSM_STATS_TYPE_CS,  /* legacy based CS */
-	MSM_STATS_TYPE_IHIST,   /* legacy based HIST */
-	MSM_STATS_TYPE_SKIN,    /* legacy based SKIN */
-	MSM_STATS_TYPE_BG,  /* Bayer Grids */
-	MSM_STATS_TYPE_BF,  /* Bayer Focus */
-	MSM_STATS_TYPE_BHIST,   /* Bayer Hist */
-	MSM_STATS_TYPE_AE_AW,   /* legacy stats for vfe 2.x*/
-	MSM_STATS_TYPE_COMP, /* Composite stats */
-	MSM_STATS_TYPE_MAX  /* MAX */
-};
-
-struct msm_stats_buf_info {
-	int type; /* msm_stats_enum_type */
-	int fd;
-	void *vaddr;
-	uint32_t offset;
-	uint32_t len;
-	uint32_t y_off;
-	uint32_t cbcr_off;
-	uint32_t planar0_off;
-	uint32_t planar1_off;
-	uint32_t planar2_off;
-	uint8_t active;
-	int buf_idx;
-};
-
 struct msm_pmem_info {
 	int type;
 	int fd;
@@ -702,8 +521,8 @@
 
 #define OUTPUT_1	0
 #define OUTPUT_2	1
-#define OUTPUT_1_AND_2            2   /* snapshot only */
-#define OUTPUT_1_AND_3            3   /* video */
+#define OUTPUT_1_AND_2            2   
+#define OUTPUT_1_AND_3            3   
 #define CAMIF_TO_AXI_VIA_OUTPUT_2 4
 #define OUTPUT_1_AND_CAMIF_TO_AXI_VIA_OUTPUT_2 5
 #define OUTPUT_2_AND_CAMIF_TO_AXI_VIA_OUTPUT_1 6
@@ -713,34 +532,24 @@
 #define OUTPUT_ZSL_ALL_CHNLS 10
 #define LAST_AXI_OUTPUT_MODE_ENUM = OUTPUT_ZSL_ALL_CHNLS
 
-#define OUTPUT_PRIM              BIT(8)
-#define OUTPUT_PRIM_ALL_CHNLS    BIT(9)
-#define OUTPUT_SEC               BIT(10)
-#define OUTPUT_SEC_ALL_CHNLS     BIT(11)
-#define OUTPUT_TERT1             BIT(12)
-#define OUTPUT_TERT2             BIT(13)
-#define OUTPUT_TERT3             BIT(14)
+#define OUTPUT_PRIM		0xF1
+#define OUTPUT_PRIM_ALL_CHNLS	0xF2
+#define OUTPUT_SEC		0xF4
+#define OUTPUT_SEC_ALL_CHNLS	0xF8
+
 
 #define MSM_FRAME_PREV_1	0
 #define MSM_FRAME_PREV_2	1
 #define MSM_FRAME_ENC		2
 
-#define OUTPUT_TYPE_P    BIT(0)
-#define OUTPUT_TYPE_T    BIT(1)
-#define OUTPUT_TYPE_S    BIT(2)
-#define OUTPUT_TYPE_V    BIT(3)
-#define OUTPUT_TYPE_L    BIT(4)
-#define OUTPUT_TYPE_ST_L BIT(5)
-#define OUTPUT_TYPE_ST_R BIT(6)
-#define OUTPUT_TYPE_ST_D BIT(7)
-#define OUTPUT_TYPE_R    BIT(8)
-#define OUTPUT_TYPE_R1   BIT(9)
-#define OUTPUT_TYPE_SAEC   BIT(10)
-#define OUTPUT_TYPE_SAFC   BIT(11)
-#define OUTPUT_TYPE_SAWB   BIT(12)
-#define OUTPUT_TYPE_IHST   BIT(13)
-#define OUTPUT_TYPE_CSTA   BIT(14)
-#define OUTPUT_TYPE_R2   BIT(15)
+#define OUTPUT_TYPE_P    (1<<0)
+#define OUTPUT_TYPE_T    (1<<1)
+#define OUTPUT_TYPE_S    (1<<2)
+#define OUTPUT_TYPE_V    (1<<3)
+#define OUTPUT_TYPE_L    (1<<4)
+#define OUTPUT_TYPE_ST_L (1<<5)
+#define OUTPUT_TYPE_ST_R (1<<6)
+#define OUTPUT_TYPE_ST_D (1<<7)
 
 struct fd_roi_info {
 	void *info;
@@ -841,53 +650,19 @@
 	int length;
 	struct ion_handle *handle;
 	uint32_t frame_id;
-	int buf_idx;
 };
 #define MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT 0
-/* video capture mode in VIDIOC_S_PARM */
 #define MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW \
 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+1)
-/* extendedmode for video recording in VIDIOC_S_PARM */
 #define MSM_V4L2_EXT_CAPTURE_MODE_VIDEO \
 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+2)
-/* extendedmode for the full size main image in VIDIOC_S_PARM */
 #define MSM_V4L2_EXT_CAPTURE_MODE_MAIN (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+3)
-/* extendedmode for the thumb nail image in VIDIOC_S_PARM */
 #define MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL \
 	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+4)
-/* ISP_PIX_OUTPUT1: no pp, directly send output1 buf to user */
-#define MSM_V4L2_EXT_CAPTURE_MODE_ISP_PIX_OUTPUT1 \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+5)
-/* ISP_PIX_OUTPUT2: no pp, directly send output2 buf to user */
-#define MSM_V4L2_EXT_CAPTURE_MODE_ISP_PIX_OUTPUT2 \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+6)
-/* raw image type */
 #define MSM_V4L2_EXT_CAPTURE_MODE_RAW \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+7)
-/* RDI dump */
-#define MSM_V4L2_EXT_CAPTURE_MODE_RDI \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+8)
-/* RDI dump 1 */
-#define MSM_V4L2_EXT_CAPTURE_MODE_RDI1 \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+9)
-/* RDI dump 2 */
-#define MSM_V4L2_EXT_CAPTURE_MODE_RDI2 \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+10)
-#define MSM_V4L2_EXT_CAPTURE_MODE_AEC \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+11)
-#define MSM_V4L2_EXT_CAPTURE_MODE_AWB \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+12)
-#define MSM_V4L2_EXT_CAPTURE_MODE_AF \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+13)
-#define MSM_V4L2_EXT_CAPTURE_MODE_IHIST \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+14)
-#define MSM_V4L2_EXT_CAPTURE_MODE_CS \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+15)
-#define MSM_V4L2_EXT_CAPTURE_MODE_RS \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+16)
-#define MSM_V4L2_EXT_CAPTURE_MODE_CSTA \
-	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+17)
-#define MSM_V4L2_EXT_CAPTURE_MODE_MAX (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+18)
+	(MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+5)
+#define MSM_V4L2_EXT_CAPTURE_MODE_MAX (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+6)
+
 
 #define MSM_V4L2_PID_MOTION_ISO              V4L2_CID_PRIVATE_BASE
 #define MSM_V4L2_PID_EFFECT                 (V4L2_CID_PRIVATE_BASE+1)
@@ -905,24 +680,17 @@
 #define MSM_V4L2_PID_CTRL_CMD               (V4L2_CID_PRIVATE_BASE+13)
 #define MSM_V4L2_PID_EVT_SUB_INFO           (V4L2_CID_PRIVATE_BASE+14)
 #define MSM_V4L2_PID_STROBE_FLASH           (V4L2_CID_PRIVATE_BASE+15)
-#define MSM_V4L2_PID_INST_HANDLE            (V4L2_CID_PRIVATE_BASE+16)
+#define MSM_V4L2_PID_MMAP_ENTRY             (V4L2_CID_PRIVATE_BASE+16)
 #define MSM_V4L2_PID_MMAP_INST              (V4L2_CID_PRIVATE_BASE+17)
 #define MSM_V4L2_PID_PP_PLANE_INFO          (V4L2_CID_PRIVATE_BASE+18)
 #define MSM_V4L2_PID_MAX                    MSM_V4L2_PID_PP_PLANE_INFO
 
-/* camera operation mode for video recording - two frame output queues */
 #define MSM_V4L2_CAM_OP_DEFAULT         0
-/* camera operation mode for video recording - two frame output queues */
 #define MSM_V4L2_CAM_OP_PREVIEW         (MSM_V4L2_CAM_OP_DEFAULT+1)
-/* camera operation mode for video recording - two frame output queues */
 #define MSM_V4L2_CAM_OP_VIDEO           (MSM_V4L2_CAM_OP_DEFAULT+2)
-/* camera operation mode for standard shapshot - two frame output queues */
 #define MSM_V4L2_CAM_OP_CAPTURE         (MSM_V4L2_CAM_OP_DEFAULT+3)
-/* camera operation mode for zsl shapshot - three output queues */
 #define MSM_V4L2_CAM_OP_ZSL             (MSM_V4L2_CAM_OP_DEFAULT+4)
-/* camera operation mode for raw snapshot - one frame output queue */
 #define MSM_V4L2_CAM_OP_RAW             (MSM_V4L2_CAM_OP_DEFAULT+5)
-/* camera operation mode for jpeg snapshot - one frame output queue */
 #define MSM_V4L2_CAM_OP_JPEG_CAPTURE    (MSM_V4L2_CAM_OP_DEFAULT+6)
 
 
@@ -940,8 +708,7 @@
 #define MSM_V4L2_CLOSE			11
 #define MSM_V4L2_SET_CTRL_CMD	12
 #define MSM_V4L2_EVT_SUB_MASK	13
-#define MSM_V4L2_PRIVATE_CMD    14
-#define MSM_V4L2_MAX			15
+#define MSM_V4L2_MAX			14
 #define V4L2_CAMERA_EXIT		43
 
 struct crop_info {
@@ -993,58 +760,79 @@
 #define CFG_GET_3D_CALI_DATA 30
 #define CFG_GET_CALIB_DATA		31
 #define CFG_GET_OUTPUT_INFO		32
-#define CFG_GET_EEPROM_INFO		33
-#define CFG_GET_EEPROM_DATA		34
-#define CFG_SET_ACTUATOR_INFO		35
-#define CFG_GET_ACTUATOR_INFO           36
-/* TBD: QRD */
-#define CFG_SET_SATURATION            37
-#define CFG_SET_SHARPNESS             38
-#define CFG_SET_TOUCHAEC              39
-#define CFG_SET_AUTO_FOCUS            40
-#define CFG_SET_AUTOFLASH             41
-#define CFG_SET_EXPOSURE_COMPENSATION 42
-#define CFG_SET_ISO                   43
-#define CFG_START_STREAM              44
-#define CFG_STOP_STREAM               45
-#define CFG_GET_CSI_PARAMS            46
-#define CFG_POWER_UP                  47
-#define CFG_POWER_DOWN                48
-#define CFG_WRITE_I2C_ARRAY           49
-#define CFG_READ_I2C_ARRAY            50
-#define CFG_PCLK_CHANGE               51
-#define CFG_CONFIG_VREG_ARRAY         52
-#define CFG_CONFIG_CLK_ARRAY          53
-#define CFG_GPIO_OP                   54
-#define CFG_SET_VISION_MODE           55
-#define CFG_SET_VISION_AE             56
-#define CFG_HDR_UPDATE                57
-#define CFG_ACTUAOTOR_REG_INIT        58
-#define CFG_MAX                       59
+#define CFG_GET_EEPROM_DATA		33
+#define CFG_SET_ACTUATOR_INFO		34
+#define CFG_GET_ACTUATOR_INFO           35
+#define CFG_SET_SATURATION            36
+#define CFG_SET_SHARPNESS             37
+#define CFG_SET_TOUCHAEC              38
+#define CFG_SET_AUTO_FOCUS            39
+#define CFG_SET_AUTOFLASH             40
+#define CFG_SET_EXPOSURE_COMPENSATION 41
+#define CFG_SET_ISO                   42
+#if 1 
+#define CFG_SET_OV_LSC_RAW_CAPTURE 43
+#define CFG_SET_COORDINATE		44
+#define CFG_RUN_AUTO_FOCUS		45
+#define CFG_CANCEL_AUTO_FOCUS		46
+#define CFG_GET_EXP_FOR_LED		47
+#define CFG_UPDATE_AEC_FOR_LED		48
+#define CFG_SET_FRONT_CAMERA_MODE	49
+#define CFG_SET_QCT_LSC_RAW_CAPTURE 50
+#define CFG_SET_QTR_SIZE_MODE		51
+#define CFG_GET_AF_STATE		52
+#define CFG_SET_DMODE			53
+#define CFG_SET_CALIBRATION	54
+#define CFG_SET_AF_MODE		55
+#define CFG_GET_SP3D_L_FRAME	56
+#define CFG_GET_SP3D_R_FRAME	57
+#define CFG_SET_FLASHLIGHT		58
+#define CFG_SET_FLASHLIGHT_EXP_DIV 59
+#define CFG_GET_ISO             60
+#define CFG_GET_EXP_GAIN	61
+#define CFG_SET_FRAMERATE 	62
+#endif 
+#define CFG_GET_ACTUATOR_CURR_STEP_POS 63
+#define CFG_GET_VCM_OPTIMIZED_POSITIONS 64 
+#define CFG_MAX			65
 
+#define CFG_I2C_IOCTL_R_OTP 70
 
 #define MOVE_NEAR	0
 #define MOVE_FAR	1
 
-#define SENSOR_PREVIEW_MODE		0
-#define SENSOR_SNAPSHOT_MODE		1
-#define SENSOR_RAW_SNAPSHOT_MODE	2
+#define SENSOR_PREVIEW_MODE		0 
+#define SENSOR_SNAPSHOT_MODE		1 
+#define SENSOR_RAW_SNAPSHOT_MODE	2 
 #define SENSOR_HFR_60FPS_MODE 3
 #define SENSOR_HFR_90FPS_MODE 4
 #define SENSOR_HFR_120FPS_MODE 5
+#define SENSOR_PREVIEW_MODE_WIDE 6
 
 #define SENSOR_QTR_SIZE			0
 #define SENSOR_FULL_SIZE		1
 #define SENSOR_QVGA_SIZE		2
 #define SENSOR_INVALID_SIZE		3
 
-/* QRD */
+#define CAMERA_EFFECT_OFF		0
+#define CAMERA_EFFECT_MONO		1
+#define CAMERA_EFFECT_NEGATIVE		2
+#define CAMERA_EFFECT_SOLARIZE		3
+#define CAMERA_EFFECT_SEPIA		4
+#define CAMERA_EFFECT_POSTERIZE		5
+#define CAMERA_EFFECT_WHITEBOARD	6
+#define CAMERA_EFFECT_BLACKBOARD	7
+#define CAMERA_EFFECT_AQUA		8
+#define CAMERA_EFFECT_EMBOSS		9
+#define CAMERA_EFFECT_SKETCH		10
+#define CAMERA_EFFECT_NEON		11
+#define CAMERA_EFFECT_MAX		12
+
 #define CAMERA_EFFECT_BW		10
 #define CAMERA_EFFECT_BLUISH	12
 #define CAMERA_EFFECT_REDDISH	13
 #define CAMERA_EFFECT_GREENISH	14
 
-/* QRD */
 #define CAMERA_ANTIBANDING_OFF		0
 #define CAMERA_ANTIBANDING_50HZ		2
 #define CAMERA_ANTIBANDING_60HZ		1
@@ -1097,7 +885,7 @@
 #define CAMERA_SETAE_AVERAGE		0
 #define CAMERA_SETAE_CENWEIGHT	1
 
-#define  CAMERA_WB_AUTO               1 /* This list must match aeecamera.h */
+#define  CAMERA_WB_AUTO               1 
 #define  CAMERA_WB_CUSTOM             2
 #define  CAMERA_WB_INCANDESCENT       3
 #define  CAMERA_WB_FLUORESCENT        4
@@ -1125,7 +913,6 @@
 	MSM_V4L2_SATURATION_L9,
 	MSM_V4L2_SATURATION_L10,
 };
-
 enum msm_v4l2_contrast_level {
 	MSM_V4L2_CONTRAST_L0,
 	MSM_V4L2_CONTRAST_L1,
@@ -1140,7 +927,6 @@
 	MSM_V4L2_CONTRAST_L10,
 };
 
-
 enum msm_v4l2_exposure_level {
 	MSM_V4L2_EXPOSURE_N2,
 	MSM_V4L2_EXPOSURE_N1,
@@ -1224,8 +1010,7 @@
 struct exp_gain_cfg {
 	uint16_t gain;
 	uint32_t line;
-	int32_t luma_avg;
-	uint16_t fgain;
+	uint16_t dig_gain; 
 };
 
 struct focus_cfg {
@@ -1252,7 +1037,7 @@
 	uint16_t gb_gain;
 	uint16_t gain_adjust;
 };
-struct sensor_3d_cali_data_t {
+struct sensor_3d_cali_data_t{
 	unsigned char left_p_matrix[3][4][8];
 	unsigned char right_p_matrix[3][4][8];
 	unsigned char square_len[8];
@@ -1283,12 +1068,12 @@
 };
 
 struct sensor_calib_data {
-	/* Color Related Measurements */
+	
 	uint16_t r_over_g;
 	uint16_t b_over_g;
 	uint16_t gr_over_gb;
 
-	/* Lens Related Measurements */
+	
 	uint16_t macro_2_inf;
 	uint16_t inf_2_macro;
 	uint16_t stroke_amt;
@@ -1299,6 +1084,9 @@
 enum msm_sensor_resolution_t {
 	MSM_SENSOR_RES_FULL,
 	MSM_SENSOR_RES_QTR,
+	MSM_SENSOR_RES_VIDEO,
+	MSM_SENSOR_RES_VIDEO_HFR,
+	MSM_SENSOR_RES_16_9,
 	MSM_SENSOR_RES_2,
 	MSM_SENSOR_RES_3,
 	MSM_SENSOR_RES_4,
@@ -1316,49 +1104,32 @@
 	uint32_t vt_pixel_clk;
 	uint32_t op_pixel_clk;
 	uint16_t binning_factor;
+	
+	uint16_t x_addr_start;
+	uint16_t y_addr_start;
+	uint16_t x_addr_end;
+	uint16_t y_addr_end;
+	uint16_t x_even_inc;
+	uint16_t x_odd_inc;
+	uint16_t y_even_inc;
+	uint16_t y_odd_inc;
+	uint8_t binning_rawchip;
+	
 };
 
 struct sensor_output_info_t {
 	struct msm_sensor_output_info_t *output_info;
 	uint16_t num_info;
-};
-
-struct msm_sensor_exp_gain_info_t {
-	uint16_t coarse_int_time_addr;
-	uint16_t global_gain_addr;
+ 
 	uint16_t vert_offset;
+	uint16_t min_vert;
+	int mirror_flip;
+	uint32_t sensor_max_linecount; 
 };
 
-struct msm_sensor_output_reg_addr_t {
-	uint16_t x_output;
-	uint16_t y_output;
-	uint16_t line_length_pclk;
-	uint16_t frame_length_lines;
-};
-
-enum sensor_hdr_update_t {
-	SENSOR_HDR_UPDATE_AWB,
-	SENSOR_HDR_UPDATE_LSC,
-};
-
-struct sensor_hdr_update_parm_t {
-	enum sensor_hdr_update_t type;
-	uint16_t awb_gain_r, awb_gain_b;
-	uint8_t lsc_table[504];
-};
-
-struct sensor_driver_params_type {
-	struct msm_camera_i2c_reg_setting *init_settings;
-	uint16_t init_settings_size;
-	struct msm_camera_i2c_reg_setting *mode_settings;
-	uint16_t mode_settings_size;
-	struct msm_sensor_output_reg_addr_t *sensor_output_reg_addr;
-	struct msm_camera_i2c_reg_setting *start_settings;
-	struct msm_camera_i2c_reg_setting *stop_settings;
-	struct msm_camera_i2c_reg_setting *groupon_settings;
-	struct msm_camera_i2c_reg_setting *groupoff_settings;
-	struct msm_sensor_exp_gain_info_t *sensor_exp_gain_info;
-	struct msm_sensor_output_info_t *output_info;
+struct sensor_eeprom_data_t {
+	void *eeprom_data;
+	uint16_t index;
 };
 
 struct mirror_flip {
@@ -1371,270 +1142,101 @@
 	uint32_t y;
 };
 
-struct msm_eeprom_data_t {
-	void *eeprom_data;
-	uint16_t index;
+#if 1 
+enum antibanding_mode{
+	CAMERA_ANTI_BANDING_50HZ,
+	CAMERA_ANTI_BANDING_60HZ,
+	CAMERA_ANTI_BANDING_AUTO,
 };
 
-struct msm_camera_csid_vc_cfg {
-	uint8_t cid;
-	uint8_t dt;
-	uint8_t decode_format;
+enum brightness_t{
+	CAMERA_BRIGHTNESS_N3,
+	CAMERA_BRIGHTNESS_N2,
+	CAMERA_BRIGHTNESS_N1,
+	CAMERA_BRIGHTNESS_D,
+	CAMERA_BRIGHTNESS_P1,
+	CAMERA_BRIGHTNESS_P2,
+	CAMERA_BRIGHTNESS_P3,
+	CAMERA_BRIGHTNESS_P4,
+	CAMERA_BRIGHTNESS_N4,
 };
 
-struct csi_lane_params_t {
-	uint16_t csi_lane_assign;
-	uint8_t csi_lane_mask;
-	uint8_t csi_if;
-	uint8_t csid_core[2];
-	uint8_t csi_phy_sel;
+enum frontcam_t{
+	CAMERA_MIRROR,
+	CAMERA_REVERSE,
+	CAMERA_PORTRAIT_REVERSE, 
 };
 
-struct msm_camera_csid_lut_params {
-	uint8_t num_cid;
-	struct msm_camera_csid_vc_cfg *vc_cfg;
+enum wb_mode{
+	CAMERA_AWB_AUTO,
+	CAMERA_AWB_CLOUDY,
+	CAMERA_AWB_INDOOR_HOME,
+	CAMERA_AWB_INDOOR_OFFICE,
+	CAMERA_AWB_SUNNY,
 };
 
-struct msm_camera_csid_params {
-	uint8_t lane_cnt;
-	uint16_t lane_assign;
-	uint8_t phy_sel;
-	struct msm_camera_csid_lut_params lut_params;
+enum iso_mode{
+  CAMERA_ISO_MODE_AUTO = 0,
+  CAMERA_ISO_MODE_DEBLUR,
+  CAMERA_ISO_MODE_100,
+  CAMERA_ISO_MODE_200,
+  CAMERA_ISO_MODE_400,
+  CAMERA_ISO_MODE_800,
+  CAMERA_ISO_MODE_1250,
+  CAMERA_ISO_MODE_1600,
+  CAMERA_ISO_MODE_MAX
 };
 
-struct msm_camera_csiphy_params {
-	uint8_t lane_cnt;
-	uint8_t settle_cnt;
-	uint16_t lane_mask;
-	uint8_t combo_mode;
+enum sharpness_mode{
+	CAMERA_SHARPNESS_X0,
+	CAMERA_SHARPNESS_X1,
+	CAMERA_SHARPNESS_X2,
+	CAMERA_SHARPNESS_X3,
+	CAMERA_SHARPNESS_X4,
+	CAMERA_SHARPNESS_X5,
+	CAMERA_SHARPNESS_X6,
 };
 
-struct msm_camera_csi2_params {
-	struct msm_camera_csid_params csid_params;
-	struct msm_camera_csiphy_params csiphy_params;
+enum saturation_mode{
+	CAMERA_SATURATION_X0,
+	CAMERA_SATURATION_X05,
+	CAMERA_SATURATION_X1,
+	CAMERA_SATURATION_X15,
+	CAMERA_SATURATION_X2,
 };
 
-enum msm_camera_csi_data_format {
-	CSI_8BIT,
-	CSI_10BIT,
-	CSI_12BIT,
+enum contrast_mode{
+	CAMERA_CONTRAST_N2,
+	CAMERA_CONTRAST_N1,
+	CAMERA_CONTRAST_D,
+	CAMERA_CONTRAST_P1,
+	CAMERA_CONTRAST_P2,
 };
 
-struct msm_camera_csi_params {
-	enum msm_camera_csi_data_format data_format;
-	uint8_t lane_cnt;
-	uint8_t lane_assign;
-	uint8_t settle_cnt;
-	uint8_t dpcm_scheme;
+enum qtr_size_mode{
+	NORMAL_QTR_SIZE_MODE,
+	LARGER_QTR_SIZE_MODE,
 };
 
-enum csic_cfg_type_t {
-	CSIC_INIT,
-	CSIC_CFG,
+enum sensor_af_mode{
+	SENSOR_AF_MODE_AUTO,
+	SENSOR_AF_MODE_NORMAL,
+	SENSOR_AF_MODE_MACRO,
+};
+#endif 
+
+struct fuse_id{
+	uint32_t fuse_id_word1;
+	uint32_t fuse_id_word2;
+	uint32_t fuse_id_word3;
+	uint32_t fuse_id_word4;
 };
 
-struct csic_cfg_data {
-	enum csic_cfg_type_t cfgtype;
-	struct msm_camera_csi_params *csic_params;
-};
-
-enum csid_cfg_type_t {
-	CSID_INIT,
-	CSID_CFG,
-};
-
-struct csid_cfg_data {
-	enum csid_cfg_type_t cfgtype;
-	union {
-		uint32_t csid_version;
-		struct msm_camera_csid_params *csid_params;
-	} cfg;
-};
-
-enum csiphy_cfg_type_t {
-	CSIPHY_INIT,
-	CSIPHY_CFG,
-};
-
-struct csiphy_cfg_data {
-	enum csiphy_cfg_type_t cfgtype;
-	struct msm_camera_csiphy_params *csiphy_params;
-};
-
-#define CSI_EMBED_DATA 0x12
-#define CSI_RESERVED_DATA_0 0x13
-#define CSI_YUV422_8  0x1E
-#define CSI_RAW8    0x2A
-#define CSI_RAW10   0x2B
-#define CSI_RAW12   0x2C
-#define CSI_YUV420_Y_8 0x30
-#define CSI_YUV420_UV_8 0x31
-#define CSI_YUV420_JM_8 0x32
-
-#define CSI_DECODE_6BIT 0
-#define CSI_DECODE_8BIT 1
-#define CSI_DECODE_10BIT 2
-#define CSI_DECODE_DPCM_10_8_10 5
-
-#define ISPIF_STREAM(intf, action, vfe) (((intf)<<ISPIF_S_STREAM_SHIFT)+\
-	(action)+((vfe)<<ISPIF_VFE_INTF_SHIFT))
-#define ISPIF_ON_FRAME_BOUNDARY   (0x01 << 0)
-#define ISPIF_OFF_FRAME_BOUNDARY  (0x01 << 1)
-#define ISPIF_OFF_IMMEDIATELY     (0x01 << 2)
-#define ISPIF_S_STREAM_SHIFT      4
-#define ISPIF_VFE_INTF_SHIFT      12
-
-#define PIX_0 (0x01 << 0)
-#define RDI_0 (0x01 << 1)
-#define PIX_1 (0x01 << 2)
-#define RDI_1 (0x01 << 3)
-#define RDI_2 (0x01 << 4)
-
-enum msm_ispif_vfe_intf {
-	VFE0,
-	VFE1,
-	VFE_MAX,
-};
-
-enum msm_ispif_intftype {
-	PIX0,
-	RDI0,
-	PIX1,
-	RDI1,
-	RDI2,
-	INTF_MAX,
-};
-
-enum msm_ispif_vc {
-	VC0,
-	VC1,
-	VC2,
-	VC3,
-};
-
-enum msm_ispif_cid {
-	CID0,
-	CID1,
-	CID2,
-	CID3,
-	CID4,
-	CID5,
-	CID6,
-	CID7,
-	CID8,
-	CID9,
-	CID10,
-	CID11,
-	CID12,
-	CID13,
-	CID14,
-	CID15,
-};
-
-struct msm_ispif_params {
-	uint8_t intftype;
-	uint16_t cid_mask;
-	uint8_t csid;
-	uint8_t vfe_intf;
-};
-
-struct msm_ispif_params_list {
-	uint32_t len;
-	struct msm_ispif_params params[4];
-};
-
-enum ispif_cfg_type_t {
-	ISPIF_INIT,
-	ISPIF_SET_CFG,
-	ISPIF_SET_ON_FRAME_BOUNDARY,
-	ISPIF_SET_OFF_FRAME_BOUNDARY,
-	ISPIF_SET_OFF_IMMEDIATELY,
-	ISPIF_RELEASE,
-};
-
-struct ispif_cfg_data {
-	enum ispif_cfg_type_t cfgtype;
-	union {
-		uint32_t csid_version;
-		int cmd;
-		struct msm_ispif_params_list ispif_params;
-	} cfg;
-};
-
-enum msm_camera_i2c_reg_addr_type {
-	MSM_CAMERA_I2C_BYTE_ADDR = 1,
-	MSM_CAMERA_I2C_WORD_ADDR,
-};
-
-struct msm_camera_i2c_reg_array {
-	uint16_t reg_addr;
-	uint16_t reg_data;
-};
-
-enum msm_camera_i2c_data_type {
-	MSM_CAMERA_I2C_BYTE_DATA = 1,
-	MSM_CAMERA_I2C_WORD_DATA,
-	MSM_CAMERA_I2C_SET_BYTE_MASK,
-	MSM_CAMERA_I2C_UNSET_BYTE_MASK,
-	MSM_CAMERA_I2C_SET_WORD_MASK,
-	MSM_CAMERA_I2C_UNSET_WORD_MASK,
-	MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA,
-};
-
-struct msm_camera_i2c_reg_setting {
-	struct msm_camera_i2c_reg_array *reg_setting;
-	uint16_t size;
-	enum msm_camera_i2c_reg_addr_type addr_type;
-	enum msm_camera_i2c_data_type data_type;
-	uint16_t delay;
-};
-
-enum oem_setting_type {
-	I2C_READ = 1,
-	I2C_WRITE,
-	GPIO_OP,
-	EEPROM_READ,
-	VREG_SET,
-	CLK_SET,
-};
-
-struct sensor_oem_setting {
-	enum oem_setting_type type;
-	void *data;
-};
-
-enum camera_vreg_type {
-	REG_LDO,
-	REG_VS,
-	REG_GPIO,
-};
-
-struct camera_vreg_t {
-	const char *reg_name;
-	enum camera_vreg_type type;
-	int min_voltage;
-	int max_voltage;
-	int op_mode;
-	uint32_t delay;
-};
-
-struct msm_camera_vreg_setting {
-	struct camera_vreg_t *cam_vreg;
-	uint16_t num_vreg;
-	uint8_t enable;
-};
-
-struct msm_cam_clk_info {
-	const char *clk_name;
-	long clk_rate;
-	uint32_t delay;
-};
-
-struct msm_cam_clk_setting {
-	struct msm_cam_clk_info *clk_info;
-	uint16_t num_clk_info;
-	uint8_t enable;
-};
+typedef struct{
+    uint16_t min;
+    uint16_t med;
+    uint16_t max;
+}vcm_pos;
 
 struct sensor_cfg_data {
 	int cfgtype;
@@ -1661,10 +1263,8 @@
 		struct sensor_3d_exp_cfg sensor_3d_exp;
 		struct sensor_calib_data calib_info;
 		struct sensor_output_info_t output_info;
-		struct msm_eeprom_data_t eeprom_data;
-		struct csi_lane_params_t csi_lane_params;
-		struct sensor_hdr_update_parm_t hdr_update_parm;
-		/* QRD */
+		struct sensor_eeprom_data_t eeprom_data;
+		
 		uint16_t antibanding;
 		uint8_t contrast;
 		uint8_t saturation;
@@ -1673,32 +1273,31 @@
 		int ae_mode;
 		uint8_t wb_val;
 		int8_t exp_compensation;
-		uint32_t pclk;
 		struct cord aec_cord;
 		int is_autoflash;
 		struct mirror_flip mirror_flip;
-		void *setting;
-		int32_t vision_mode_enable;
-		int32_t vision_ae;
+
+		
+		
+		struct fuse_id fuse;
+		
+		vcm_pos calib_vcm_pos; 
+#if 1 
+		enum antibanding_mode antibanding_value;
+		enum brightness_t brightness_value;
+		enum frontcam_t frontcam_value;
+		enum wb_mode wb_value;
+		enum iso_mode iso_value;
+		enum sharpness_mode sharpness_value;
+		enum saturation_mode saturation_value;
+		enum contrast_mode contrast_value;
+		enum qtr_size_mode qtr_size_mode_value;
+		enum sensor_af_mode af_mode_value;
+#endif 
+
 	} cfg;
 };
 
-enum gpio_operation_type {
-	GPIO_REQUEST,
-	GPIO_FREE,
-	GPIO_SET_DIRECTION_OUTPUT,
-	GPIO_SET_DIRECTION_INPUT,
-	GPIO_GET_VALUE,
-	GPIO_SET_VALUE,
-};
-
-struct msm_cam_gpio_operation {
-	enum gpio_operation_type op_type;
-	unsigned address;
-	int value;
-	const char *tag;
-};
-
 struct damping_params_t {
 	uint32_t damping_step;
 	uint32_t damping_delay;
@@ -1708,7 +1307,6 @@
 enum actuator_type {
 	ACTUATOR_VCM,
 	ACTUATOR_PIEZO,
-	ACTUATOR_HALL_EFFECT,
 };
 
 enum msm_actuator_data_type {
@@ -1740,9 +1338,6 @@
 };
 
 struct region_params_t {
-	/* [0] = ForwardDirection Macro boundary
-	   [1] = ReverseDirection Inf boundary
-	 */
 	uint16_t step_bound[2];
 	uint16_t code_per_step;
 };
@@ -1776,6 +1371,9 @@
 };
 
 struct msm_actuator_set_info_t {
+	uint32_t total_steps; 
+	uint16_t gross_steps; 
+	uint16_t fine_steps; 
 	struct msm_actuator_params_t actuator_params;
 	struct msm_actuator_tuning_params_t af_tuning_params;
 };
@@ -1815,66 +1413,7 @@
 		struct msm_actuator_set_info_t set_info;
 		struct msm_actuator_get_info_t get_info;
 		enum af_camera_name cam_name;
-	} cfg;
-};
-
-struct msm_eeprom_support {
-	uint16_t is_supported;
-	uint16_t size;
-	uint16_t index;
-	uint16_t qvalue;
-};
-
-struct msm_calib_wb {
-	uint16_t r_over_g;
-	uint16_t b_over_g;
-	uint16_t gr_over_gb;
-};
-
-struct msm_calib_af {
-	uint16_t macro_dac;
-	uint16_t inf_dac;
-	uint16_t start_dac;
-};
-
-struct msm_calib_lsc {
-	uint16_t r_gain[221];
-	uint16_t b_gain[221];
-	uint16_t gr_gain[221];
-	uint16_t gb_gain[221];
-};
-
-struct pixel_t {
-	int x;
-	int y;
-};
-
-struct msm_calib_dpc {
-	uint16_t validcount;
-	struct pixel_t snapshot_coord[128];
-	struct pixel_t preview_coord[128];
-	struct pixel_t video_coord[128];
-};
-
-struct msm_calib_raw {
-	uint8_t *data;
-	uint32_t size;
-};
-
-struct msm_camera_eeprom_info_t {
-	struct msm_eeprom_support af;
-	struct msm_eeprom_support wb;
-	struct msm_eeprom_support lsc;
-	struct msm_eeprom_support dpc;
-	struct msm_eeprom_support raw;
-};
-
-struct msm_eeprom_cfg_data {
-	int cfgtype;
-	uint8_t is_eeprom_supported;
-	union {
-		struct msm_eeprom_data_t get_data;
-		struct msm_camera_eeprom_info_t get_info;
+		int16_t curr_step_pos; 
 	} cfg;
 };
 
@@ -1948,16 +1487,16 @@
 	uint8_t flash_enabled;
 	uint8_t strobe_flash_enabled;
 	uint8_t actuator_enabled;
-	uint8_t ispif_supported;
 	int8_t total_steps;
 	uint8_t support_3d;
 	enum flash_type flashtype;
 	enum sensor_type_t sensor_type;
-	uint32_t pxlcode; /* enum v4l2_mbus_pixelcode */
-	uint32_t camera_type; /* msm_camera_type */
+	uint32_t pxlcode; 
+	uint32_t camera_type; 
 	int mount_angle;
 	uint32_t max_width;
 	uint32_t max_height;
+	uint8_t use_rawchip; 
 };
 
 #define V4L2_SINGLE_PLANE	0
@@ -1976,323 +1515,39 @@
 	uint32_t width;
 	uint32_t height;
 	uint32_t pixelformat;
-	uint8_t buffer_type; /*Single/Multi planar*/
+	uint8_t buffer_type; 
 	uint8_t output_port;
 	uint32_t ext_mode;
 	uint8_t num_planes;
 	struct plane_data plane[MAX_PLANES];
 	uint32_t sp_y_offset;
-	uint32_t inst_handle;
+	uint8_t vpe_can_use;
 };
 
 #define QCAMERA_NAME "qcamera"
-#define QCAMERA_SERVER_NAME "qcamera_server"
 #define QCAMERA_DEVICE_GROUP_ID 1
 #define QCAMERA_VNODE_GROUP_ID 2
-
-enum msm_cam_subdev_type {
-	CSIPHY_DEV,
-	CSID_DEV,
-	CSIC_DEV,
-	ISPIF_DEV,
-	VFE_DEV,
-	AXI_DEV,
-	VPE_DEV,
-	SENSOR_DEV,
-	ACTUATOR_DEV,
-	EEPROM_DEV,
-	GESTURE_DEV,
-	IRQ_ROUTER_DEV,
-	CPP_DEV,
-	CCI_DEV,
-};
-
-struct msm_mctl_set_sdev_data {
-	uint32_t revision;
-	enum msm_cam_subdev_type sdev_type;
-};
-
 #define MSM_CAM_V4L2_IOCTL_GET_CAMERA_INFO \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct msm_camera_v4l2_ioctl_t)
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct msm_camera_v4l2_ioctl_t *)
 
 #define MSM_CAM_V4L2_IOCTL_GET_CONFIG_INFO \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct msm_camera_v4l2_ioctl_t)
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct msm_camera_v4l2_ioctl_t *)
 
 #define MSM_CAM_V4L2_IOCTL_GET_MCTL_INFO \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct msm_camera_v4l2_ioctl_t)
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct msm_camera_v4l2_ioctl_t *)
 
 #define MSM_CAM_V4L2_IOCTL_CTRL_CMD_DONE \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct msm_camera_v4l2_ioctl_t)
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct msm_camera_v4l2_ioctl_t *)
 
 #define MSM_CAM_V4L2_IOCTL_GET_EVENT_PAYLOAD \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct msm_camera_v4l2_ioctl_t)
-
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct msm_camera_v4l2_ioctl_t *)
+	
 #define MSM_CAM_IOCTL_SEND_EVENT \
 	_IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct v4l2_event)
 
-#define MSM_CAM_V4L2_IOCTL_CFG_VPE \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct msm_vpe_cfg_cmd)
-
-#define MSM_CAM_V4L2_IOCTL_PRIVATE_S_CTRL \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 8, struct msm_camera_v4l2_ioctl_t)
-
-#define MSM_CAM_V4L2_IOCTL_PRIVATE_G_CTRL \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 9, struct msm_camera_v4l2_ioctl_t)
-
-#define MSM_CAM_V4L2_IOCTL_PRIVATE_GENERAL \
-	_IOW('V', BASE_VIDIOC_PRIVATE + 10, struct msm_camera_v4l2_ioctl_t)
-
-#define VIDIOC_MSM_VPE_INIT \
-	_IO('V', BASE_VIDIOC_PRIVATE + 15)
-
-#define VIDIOC_MSM_VPE_RELEASE \
-	_IO('V', BASE_VIDIOC_PRIVATE + 16)
-
-#define VIDIOC_MSM_VPE_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 17, struct msm_mctl_pp_params *)
-
-#define VIDIOC_MSM_AXI_INIT \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 18, uint8_t *)
-
-#define VIDIOC_MSM_AXI_RELEASE \
-	_IO('V', BASE_VIDIOC_PRIVATE + 19)
-
-#define VIDIOC_MSM_AXI_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 20, void *)
-
-#define VIDIOC_MSM_AXI_IRQ \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 21, void *)
-
-#define VIDIOC_MSM_AXI_BUF_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 22, void *)
-
-#define VIDIOC_MSM_AXI_RDI_COUNT_UPDATE \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 23, struct rdi_count_msg)
-
-#define VIDIOC_MSM_VFE_INIT \
-	_IO('V', BASE_VIDIOC_PRIVATE + 24)
-
-#define VIDIOC_MSM_VFE_RELEASE \
-	_IO('V', BASE_VIDIOC_PRIVATE + 25)
-
-#define VIDIOC_MSM_AXI_LOW_POWER_MODE \
-	_IO('V', BASE_VIDIOC_PRIVATE + 26)
-
-
 struct msm_camera_v4l2_ioctl_t {
-	uint32_t id;
-	uint32_t len;
-	uint32_t trans_code;
 	void __user *ioctl_ptr;
 };
 
-struct msm_camera_vfe_params_t {
-	uint32_t operation_mode;
-	uint32_t capture_count;
-	uint8_t  skip_reset;
-	uint8_t  stop_immediately;
-	uint16_t port_info;
-	uint32_t inst_handle;
-	uint16_t cmd_type;
-	uint8_t stream_error;
-};
 
-enum msm_camss_irq_idx {
-	CAMERA_SS_IRQ_0,
-	CAMERA_SS_IRQ_1,
-	CAMERA_SS_IRQ_2,
-	CAMERA_SS_IRQ_3,
-	CAMERA_SS_IRQ_4,
-	CAMERA_SS_IRQ_5,
-	CAMERA_SS_IRQ_6,
-	CAMERA_SS_IRQ_7,
-	CAMERA_SS_IRQ_8,
-	CAMERA_SS_IRQ_9,
-	CAMERA_SS_IRQ_10,
-	CAMERA_SS_IRQ_11,
-	CAMERA_SS_IRQ_12,
-	CAMERA_SS_IRQ_MAX
-};
-
-enum msm_cam_hw_idx {
-	MSM_CAM_HW_MICRO,
-	MSM_CAM_HW_CCI,
-	MSM_CAM_HW_CSI0,
-	MSM_CAM_HW_CSI1,
-	MSM_CAM_HW_CSI2,
-	MSM_CAM_HW_CSI3,
-	MSM_CAM_HW_ISPIF,
-	MSM_CAM_HW_CPP,
-	MSM_CAM_HW_VFE0,
-	MSM_CAM_HW_VFE1,
-	MSM_CAM_HW_JPEG0,
-	MSM_CAM_HW_JPEG1,
-	MSM_CAM_HW_JPEG2,
-	MSM_CAM_HW_MAX
-};
-
-struct msm_camera_irq_cfg {
-	/* Bit mask of all the camera hardwares that needs to
-	 * be composited into a single IRQ to the MSM.
-	 * Current usage: (may be updated based on hw changes)
-	 * Bits 31:13 - Reserved.
-	 * Bits 12:0
-	 * 12 - MSM_CAM_HW_JPEG2
-	 * 11 - MSM_CAM_HW_JPEG1
-	 * 10 - MSM_CAM_HW_JPEG0
-	 *  9 - MSM_CAM_HW_VFE1
-	 *  8 - MSM_CAM_HW_VFE0
-	 *  7 - MSM_CAM_HW_CPP
-	 *  6 - MSM_CAM_HW_ISPIF
-	 *  5 - MSM_CAM_HW_CSI3
-	 *  4 - MSM_CAM_HW_CSI2
-	 *  3 - MSM_CAM_HW_CSI1
-	 *  2 - MSM_CAM_HW_CSI0
-	 *  1 - MSM_CAM_HW_CCI
-	 *  0 - MSM_CAM_HW_MICRO
-	 */
-	uint32_t cam_hw_mask;
-	uint8_t  irq_idx;
-	uint8_t  num_hwcore;
-};
-
-#define MSM_IRQROUTER_CFG_COMPIRQ \
-	_IOWR('V', BASE_VIDIOC_PRIVATE, void __user *)
-
-#define MAX_NUM_CPP_STRIPS 8
-
-enum msm_cpp_frame_type {
-	MSM_CPP_OFFLINE_FRAME,
-	MSM_CPP_REALTIME_FRAME,
-};
-
-struct msm_cpp_frame_strip_info {
-	int scale_v_en;
-	int scale_h_en;
-
-	int upscale_v_en;
-	int upscale_h_en;
-
-	int src_start_x;
-	int src_end_x;
-	int src_start_y;
-	int src_end_y;
-
-	/* Padding is required for upscaler because it does not
-	 * pad internally like other blocks, also needed for rotation
-	 * rotation expects all the blocks in the stripe to be the same size
-	 * Padding is done such that all the extra padded pixels
-	 * are on the right and bottom
-	*/
-	int pad_bottom;
-	int pad_top;
-	int pad_right;
-	int pad_left;
-
-	int v_init_phase;
-	int h_init_phase;
-	int h_phase_step;
-	int v_phase_step;
-
-	int prescale_crop_width_first_pixel;
-	int prescale_crop_width_last_pixel;
-	int prescale_crop_height_first_line;
-	int prescale_crop_height_last_line;
-
-	int postscale_crop_height_first_line;
-	int postscale_crop_height_last_line;
-	int postscale_crop_width_first_pixel;
-	int postscale_crop_width_last_pixel;
-
-	int dst_start_x;
-	int dst_end_x;
-	int dst_start_y;
-	int dst_end_y;
-
-	int bytes_per_pixel;
-	unsigned int source_address;
-	unsigned int destination_address;
-	unsigned int src_stride;
-	unsigned int dst_stride;
-	int rotate_270;
-	int horizontal_flip;
-	int vertical_flip;
-	int scale_output_width;
-	int scale_output_height;
-};
-
-struct msm_cpp_frame_info_t {
-	int32_t frame_id;
-	uint32_t inst_id;
-	uint32_t client_id;
-	enum msm_cpp_frame_type frame_type;
-	uint32_t num_strips;
-	struct msm_cpp_frame_strip_info *strip_info;
-};
-
-struct msm_ver_num_info {
-	uint32_t main;
-	uint32_t minor;
-	uint32_t rev;
-};
-
-struct intf_mctl_mapping_cfg {
-	int is_bayer_sensor;
-	int vnode_id;
-	int num_entries;
-	uint32_t image_modes[MSM_V4L2_EXT_CAPTURE_MODE_MAX];
-};
-
-#define VIDIOC_MSM_CPP_CFG \
-	_IOWR('V', BASE_VIDIOC_PRIVATE, struct msm_camera_v4l2_ioctl_t)
-
-#define VIDIOC_MSM_CPP_GET_EVENTPAYLOAD \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct msm_camera_v4l2_ioctl_t)
-
-#define VIDIOC_MSM_CPP_GET_INST_INFO \
-	_IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct msm_camera_v4l2_ioctl_t)
-
-#define V4L2_EVENT_CPP_FRAME_DONE  (V4L2_EVENT_PRIVATE_START + 0)
-
-/* Instance Handle - inst_handle
- * Data bundle containing the information about where
- * to get a buffer for a particular camera instance.
- * This is a bitmask containing the following data:
- * Buffer Handle Bitmask:
- *      ------------------------------------
- *      Bits    :  Purpose
- *      ------------------------------------
- *      31      :  is Dev ID valid?
- *      30 - 24 :  Dev ID.
- *      23      :  is Image mode valid?
- *      22 - 16 :  Image mode.
- *      15      :  is MCTL PP inst idx valid?
- *      14 - 8  :  MCTL PP inst idx.
- *      7       :  is Video inst idx valid?
- *      6 - 0   :  Video inst idx.
- */
-#define CLR_DEVID_MODE(handle)	(handle &= 0x00FFFFFF)
-#define SET_DEVID_MODE(handle, data)	\
-	(handle |= ((0x1 << 31) | ((data & 0x7F) << 24)))
-#define GET_DEVID_MODE(handle)	\
-	((handle & 0x80000000) ? ((handle & 0x7F000000) >> 24) : 0xFF)
-
-#define CLR_IMG_MODE(handle)	(handle &= 0xFF00FFFF)
-#define SET_IMG_MODE(handle, data)	\
-	(handle |= ((0x1 << 23) | ((data & 0x7F) << 16)))
-#define GET_IMG_MODE(handle)	\
-	((handle & 0x800000) ? ((handle & 0x7F0000) >> 16) : 0xFF)
-
-#define CLR_MCTLPP_INST_IDX(handle)	(handle &= 0xFFFF00FF)
-#define SET_MCTLPP_INST_IDX(handle, data)	\
-	(handle |= ((0x1 << 15) | ((data & 0x7F) << 8)))
-#define GET_MCTLPP_INST_IDX(handle)	\
-	((handle & 0x8000) ? ((handle & 0x7F00) >> 8) : 0xFF)
-
-#define CLR_VIDEO_INST_IDX(handle)	(handle &= 0xFFFFFF00)
-#define GET_VIDEO_INST_IDX(handle)	\
-	((handle & 0x80) ? (handle & 0x7F) : 0xFF)
-#define SET_VIDEO_INST_IDX(handle, data)	\
-	(handle |= (0x1 << 7) | (data & 0x7F))
-
-#endif /* __LINUX_MSM_CAMERA_H */
+#endif 
diff --git a/include/media/msm_isp.h b/include/media/msm_isp.h
index 19953ac..984bb40 100644
--- a/include/media/msm_isp.h
+++ b/include/media/msm_isp.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -15,7 +15,6 @@
 
 #define BIT(nr)			(1UL << (nr))
 
-/* ISP message IDs */
 #define MSG_ID_RESET_ACK                0
 #define MSG_ID_START_ACK                1
 #define MSG_ID_STOP_ACK                 2
@@ -59,21 +58,9 @@
 #define MSG_ID_OUTPUT_PRIMARY           40
 #define MSG_ID_OUTPUT_SECONDARY         41
 #define MSG_ID_STATS_COMPOSITE          42
-#define MSG_ID_OUTPUT_TERTIARY1         43
+#define MSG_ID_HDR_SOF_ACK              43 
 #define MSG_ID_STOP_LS_ACK              44
-#define MSG_ID_OUTPUT_TERTIARY2         45
-#define MSG_ID_STATS_BG                 46
-#define MSG_ID_STATS_BF                 47
-#define MSG_ID_STATS_BHIST              48
-#define MSG_ID_RDI0_UPDATE_ACK          49
-#define MSG_ID_RDI1_UPDATE_ACK          50
-#define MSG_ID_RDI2_UPDATE_ACK          51
-#define MSG_ID_PIX0_UPDATE_ACK          52
-#define MSG_ID_PREV_STOP_ACK            53
-#define MSG_ID_OUTPUT_TERTIARY3         54
 
-
-/* ISP command IDs */
 #define VFE_CMD_DUMMY_0                                 0
 #define VFE_CMD_SET_CLK                                 1
 #define VFE_CMD_RESET                                   2
@@ -213,34 +200,6 @@
 #define VFE_CMD_CAPTURE_RAW                             136
 #define VFE_CMD_STOP_LIVESHOT                           137
 #define VFE_CMD_RECONFIG_VFE                            138
-#define VFE_CMD_STATS_REQBUF                            139
-#define VFE_CMD_STATS_ENQUEUEBUF                        140
-#define VFE_CMD_STATS_FLUSH_BUFQ                        141
-#define VFE_CMD_STATS_UNREGBUF                          142
-#define VFE_CMD_STATS_BG_START                          143
-#define VFE_CMD_STATS_BG_STOP                           144
-#define VFE_CMD_STATS_BF_START                          145
-#define VFE_CMD_STATS_BF_STOP                           146
-#define VFE_CMD_STATS_BHIST_START                       147
-#define VFE_CMD_STATS_BHIST_STOP                        148
-#define VFE_CMD_RESET_2                                 149
-#define VFE_CMD_FOV_ENC_CFG                             150
-#define VFE_CMD_FOV_VIEW_CFG                            151
-#define VFE_CMD_FOV_ENC_UPDATE                          152
-#define VFE_CMD_FOV_VIEW_UPDATE                         153
-#define VFE_CMD_SCALER_ENC_CFG                          154
-#define VFE_CMD_SCALER_VIEW_CFG                         155
-#define VFE_CMD_SCALER_ENC_UPDATE                       156
-#define VFE_CMD_SCALER_VIEW_UPDATE                      157
-#define VFE_CMD_COLORXFORM_ENC_CFG                      158
-#define VFE_CMD_COLORXFORM_VIEW_CFG                     159
-#define VFE_CMD_COLORXFORM_ENC_UPDATE                   160
-#define VFE_CMD_COLORXFORM_VIEW_UPDATE                  161
-#define VFE_CMD_TEST_GEN_CFG                            162
-#define VFE_CMD_SELECT_RDI                              163
-#define VFE_CMD_SET_STATS_VER                           164
-#define VFE_CMD_RGB_ALL_CFG                             165
-#define VFE_CMD_RGB_ALL_UPDATE                          166
 
 struct msm_isp_cmd {
 	int32_t  id;
@@ -263,16 +222,15 @@
 #define VPE_CMD_ZOOM                                    13
 #define VPE_CMD_MAX                                     14
 
-#define MSM_PP_CMD_TYPE_NOT_USED        0  /* not used */
-#define MSM_PP_CMD_TYPE_VPE             1  /* VPE cmd */
-#define MSM_PP_CMD_TYPE_MCTL            2  /* MCTL cmd */
+#define MSM_PP_CMD_TYPE_NOT_USED        0  
+#define MSM_PP_CMD_TYPE_VPE             1  
+#define MSM_PP_CMD_TYPE_MCTL            2  
 
-#define MCTL_CMD_DUMMY_0                0  /* not used */
-#define MCTL_CMD_GET_FRAME_BUFFER       1  /* reserve a free frame buffer */
-#define MCTL_CMD_PUT_FRAME_BUFFER       2  /* return the free frame buffer */
-#define MCTL_CMD_DIVERT_FRAME_PP_PATH   3  /* divert frame for pp */
+#define MCTL_CMD_DUMMY_0                0  
+#define MCTL_CMD_GET_FRAME_BUFFER       1  
+#define MCTL_CMD_PUT_FRAME_BUFFER       2  
+#define MCTL_CMD_DIVERT_FRAME_PP_PATH   3  
 
-/* event typese sending to MCTL PP module */
 #define MCTL_PP_EVENT_NOTUSED           0
 #define MCTL_PP_EVENT_CMD_ACK           1
 
@@ -332,35 +290,41 @@
 struct msm_vpe_clock_rate {
 	uint32_t rate;
 };
-
+struct msm_pp_crop {
+	uint32_t  src_x;
+	uint32_t  src_y;
+	uint32_t  src_w;
+	uint32_t  src_h;
+	uint32_t  dst_x;
+	uint32_t  dst_y;
+	uint32_t  dst_w;
+	uint32_t  dst_h;
+	uint8_t update_flag;
+};
 #define MSM_MCTL_PP_VPE_FRAME_ACK    (1<<0)
 #define MSM_MCTL_PP_VPE_FRAME_TO_APP (1<<1)
 
-#define VFE_OUTPUTS_MAIN_AND_PREVIEW    BIT(0)
-#define VFE_OUTPUTS_MAIN_AND_VIDEO      BIT(1)
-#define VFE_OUTPUTS_MAIN_AND_THUMB      BIT(2)
-#define VFE_OUTPUTS_THUMB_AND_MAIN      BIT(3)
-#define VFE_OUTPUTS_PREVIEW_AND_VIDEO   BIT(4)
-#define VFE_OUTPUTS_VIDEO_AND_PREVIEW   BIT(5)
-#define VFE_OUTPUTS_PREVIEW             BIT(6)
-#define VFE_OUTPUTS_VIDEO               BIT(7)
-#define VFE_OUTPUTS_RAW                 BIT(8)
-#define VFE_OUTPUTS_JPEG_AND_THUMB      BIT(9)
-#define VFE_OUTPUTS_THUMB_AND_JPEG      BIT(10)
-#define VFE_OUTPUTS_RDI0                BIT(11)
-#define VFE_OUTPUTS_RDI1                BIT(12)
-#define VFE_OUTPUTS_RDI2                BIT(13)
-
-#define	VFE_RDI_COMPOSITE				(1 << 0)
-#define	VFE_RDI_NON_COMPOSITE			(1 << 1)
-
-#define VFE_STATS_TYPE_LEGACY		0
-#define VFE_STATS_TYPE_BAYER		(1 << 2)
-
-struct msm_frame_info {
-	uint32_t inst_handle;
-	uint32_t path;
+struct msm_mctl_pp_frame_cmd {
+	uint32_t cookie;
+	uint8_t  vpe_output_action;
+	uint32_t src_buf_handle;
+	uint32_t dest_buf_handle;
+	struct msm_pp_crop crop;
+	int path;
+	
 };
 
-#endif /*__MSM_ISP_H__*/
+#define VFE_OUTPUTS_MAIN_AND_PREVIEW	BIT(0)
+#define VFE_OUTPUTS_MAIN_AND_VIDEO	BIT(1)
+#define VFE_OUTPUTS_MAIN_AND_THUMB	BIT(2)
+#define VFE_OUTPUTS_THUMB_AND_MAIN	BIT(3)
+#define VFE_OUTPUTS_PREVIEW_AND_VIDEO	BIT(4)
+#define VFE_OUTPUTS_VIDEO_AND_PREVIEW	BIT(5)
+#define VFE_OUTPUTS_PREVIEW		BIT(6)
+#define VFE_OUTPUTS_VIDEO		BIT(7)
+#define VFE_OUTPUTS_RAW			BIT(8)
+#define VFE_OUTPUTS_JPEG_AND_THUMB	BIT(9)
+#define VFE_OUTPUTS_THUMB_AND_JPEG	BIT(10)
+
+#endif 
 
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 7395c81..51a1c2d 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -24,27 +24,23 @@
 #ifndef V4L2_CHIP_IDENT_H_
 #define V4L2_CHIP_IDENT_H_
 
-/* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */
 
-/* KEEP THIS LIST ORDERED BY ID!
-   Otherwise it will be hard to see which ranges are already in use when
-   adding support to a new chip family. */
 enum {
-	/* general idents: reserved range 0-49 */
-	V4L2_IDENT_NONE      = 0,       /* No chip matched */
-	V4L2_IDENT_AMBIGUOUS = 1,       /* Match too general, multiple chips matched */
-	V4L2_IDENT_UNKNOWN   = 2,       /* Chip found, but cannot identify */
+	
+	V4L2_IDENT_NONE      = 0,       
+	V4L2_IDENT_AMBIGUOUS = 1,       
+	V4L2_IDENT_UNKNOWN   = 2,       
 
-	/* module tvaudio: reserved range 50-99 */
-	V4L2_IDENT_TVAUDIO = 50,	/* A tvaudio chip, unknown which it is exactly */
+	
+	V4L2_IDENT_TVAUDIO = 50,	
 
-	/* Sony IMX074 */
+	
 	V4L2_IDENT_IMX074 = 74,
 
-	/* module saa7110: just ident 100 */
+	
 	V4L2_IDENT_SAA7110 = 100,
 
-	/* module saa7115: reserved range 101-149 */
+	
 	V4L2_IDENT_SAA7111 = 101,
 	V4L2_IDENT_SAA7111A = 102,
 	V4L2_IDENT_SAA7113 = 103,
@@ -52,11 +48,11 @@
 	V4L2_IDENT_SAA7115 = 105,
 	V4L2_IDENT_SAA7118 = 108,
 
-	/* module saa7127: reserved range 150-199 */
+	
 	V4L2_IDENT_SAA7127 = 157,
 	V4L2_IDENT_SAA7129 = 159,
 
-	/* module cx25840: reserved range 200-249 */
+	
 	V4L2_IDENT_CX25836 = 236,
 	V4L2_IDENT_CX25837 = 237,
 	V4L2_IDENT_CX25840 = 240,
@@ -64,7 +60,7 @@
 	V4L2_IDENT_CX25842 = 242,
 	V4L2_IDENT_CX25843 = 243,
 
-	/* OmniVision sensors: reserved range 250-299 */
+	
 	V4L2_IDENT_OV7670 = 250,
 	V4L2_IDENT_OV7720 = 251,
 	V4L2_IDENT_OV7725 = 252,
@@ -76,157 +72,151 @@
 	V4L2_IDENT_OV6650 = 258,
 	V4L2_IDENT_OV2640 = 259,
 	V4L2_IDENT_OV9740 = 260,
-	V4L2_IDENT_OV5642 = 261,
 
-	/* module saa7146: reserved range 300-309 */
+	
 	V4L2_IDENT_SAA7146 = 300,
 
-	/* Conexant MPEG encoder/decoders: reserved range 400-420 */
-	V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */
+	
+	V4L2_IDENT_CX23418_843 = 403, 
 	V4L2_IDENT_CX23415 = 415,
 	V4L2_IDENT_CX23416 = 416,
 	V4L2_IDENT_CX23417 = 417,
 	V4L2_IDENT_CX23418 = 418,
 
-	/* module bt819: reserved range 810-819 */
+	
 	V4L2_IDENT_BT815A = 815,
 	V4L2_IDENT_BT817A = 817,
 	V4L2_IDENT_BT819A = 819,
 
-	/* module au0828 */
+	
 	V4L2_IDENT_AU0828 = 828,
 
-	/* module bt856: just ident 856 */
+	
 	V4L2_IDENT_BT856 = 856,
 
-	/* module bt866: just ident 866 */
+	
 	V4L2_IDENT_BT866 = 866,
 
-	/* module ks0127: reserved range 1120-1129 */
+	
 	V4L2_IDENT_KS0122S = 1122,
 	V4L2_IDENT_KS0127  = 1127,
 	V4L2_IDENT_KS0127B = 1128,
 
-	/* module indycam: just ident 2000 */
+	
 	V4L2_IDENT_INDYCAM = 2000,
 
-	/* module vp27smpx: just ident 2700 */
+	
 	V4L2_IDENT_VP27SMPX = 2700,
 
-	/* module vpx3220: reserved range: 3210-3229 */
+	
 	V4L2_IDENT_VPX3214C = 3214,
 	V4L2_IDENT_VPX3216B = 3216,
 	V4L2_IDENT_VPX3220A = 3220,
 
-	/* VX855 just ident 3409 */
-	/* Other via devs could use 3314, 3324, 3327, 3336, 3364, 3353 */
+	
+	
 	V4L2_IDENT_VIA_VX855 = 3409,
 
-	/* module tvp5150 */
+	
 	V4L2_IDENT_TVP5150 = 5150,
 
-	/* module saa5246a: just ident 5246 */
+	
 	V4L2_IDENT_SAA5246A = 5246,
 
-	/* module saa5249: just ident 5249 */
+	
 	V4L2_IDENT_SAA5249 = 5249,
 
-	/* module cs5345: just ident 5345 */
+	
 	V4L2_IDENT_CS5345 = 5345,
 
-	/* module tea6415c: just ident 6415 */
+	
 	V4L2_IDENT_TEA6415C = 6415,
 
-	/* module tea6420: just ident 6420 */
+	
 	V4L2_IDENT_TEA6420 = 6420,
 
-	/* module saa6588: just ident 6588 */
+	
 	V4L2_IDENT_SAA6588 = 6588,
 
-	/* module vs6624: just ident 6624 */
-	V4L2_IDENT_VS6624 = 6624,
-
-	/* module saa6752hs: reserved range 6750-6759 */
+	
 	V4L2_IDENT_SAA6752HS = 6752,
 	V4L2_IDENT_SAA6752HS_AC3 = 6753,
 
-	/* modules tef6862: just ident 6862 */
+	
 	V4L2_IDENT_TEF6862 = 6862,
 
-	/* module tvp7002: just ident 7002 */
+	
 	V4L2_IDENT_TVP7002 = 7002,
 
-	/* module adv7170: just ident 7170 */
+	
 	V4L2_IDENT_ADV7170 = 7170,
 
-	/* module adv7175: just ident 7175 */
+	
 	V4L2_IDENT_ADV7175 = 7175,
 
-	/* module adv7180: just ident 7180 */
+	
 	V4L2_IDENT_ADV7180 = 7180,
 
-	/* module adv7183: just ident 7183 */
-	V4L2_IDENT_ADV7183 = 7183,
-
-	/* module saa7185: just ident 7185 */
+	
 	V4L2_IDENT_SAA7185 = 7185,
 
-	/* module saa7191: just ident 7191 */
+	
 	V4L2_IDENT_SAA7191 = 7191,
 
-	/* module ths7303: just ident 7303 */
+	
 	V4L2_IDENT_THS7303 = 7303,
 
-	/* module adv7343: just ident 7343 */
+	
 	V4L2_IDENT_ADV7343 = 7343,
 
-	/* module saa7706h: just ident 7706 */
+	
 	V4L2_IDENT_SAA7706H = 7706,
 
-	/* module mt9v011, just ident 8243 */
+	
 	V4L2_IDENT_MT9V011 = 8243,
 
-	/* module wm8739: just ident 8739 */
+	
 	V4L2_IDENT_WM8739 = 8739,
 
-	/* module wm8775: just ident 8775 */
+	
 	V4L2_IDENT_WM8775 = 8775,
 
-	/* Marvell controllers starting at 8801 */
+	
 	V4L2_IDENT_CAFE = 8801,
-	V4L2_IDENT_ARMADA610 = 8802,
 
-	/* AKM AK8813/AK8814 */
+	
 	V4L2_IDENT_AK8813 = 8813,
 	V4L2_IDENT_AK8814 = 8814,
 
-	/* module cx23885 and cx25840 */
+	
 	V4L2_IDENT_CX23885    = 8850,
-	V4L2_IDENT_CX23885_AV = 8851, /* Integrated A/V decoder */
+	V4L2_IDENT_CX23885_AV = 8851, 
 	V4L2_IDENT_CX23887    = 8870,
-	V4L2_IDENT_CX23887_AV = 8871, /* Integrated A/V decoder */
+	V4L2_IDENT_CX23887_AV = 8871, 
 	V4L2_IDENT_CX23888    = 8880,
-	V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */
-	V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */
+	V4L2_IDENT_CX23888_AV = 8881, 
+	V4L2_IDENT_CX23888_IR = 8882, 
 
-	/* module tda9840: just ident 9840 */
+	
 	V4L2_IDENT_TDA9840 = 9840,
 
-	/* module tw9910: just ident 9910 */
+	
 	V4L2_IDENT_TW9910 = 9910,
 
-	/* module sn9c20x: just ident 10000 */
+	
 	V4L2_IDENT_SN9C20X = 10000,
 
-	/* module cx231xx and cx25840 */
-	V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */
+	
+	V4L2_IDENT_NOON010PC30	= 10100,
+
+	
+	V4L2_IDENT_CX2310X_AV = 23099, 
 	V4L2_IDENT_CX23100    = 23100,
 	V4L2_IDENT_CX23101    = 23101,
 	V4L2_IDENT_CX23102    = 23102,
 
-	/* module msp3400: reserved range 34000-34999 for msp34xx */
-	V4L2_IDENT_MSPX4XX  = 34000, /* generic MSPX4XX identifier, only
-					use internally (tveeprom.c). */
+	
+	V4L2_IDENT_MSPX4XX  = 34000, 
 
 	V4L2_IDENT_MSP3400B = 34002,
 	V4L2_IDENT_MSP3400C = 34003,
@@ -278,7 +268,7 @@
 	V4L2_IDENT_MSP3465G = 34657,
 	V4L2_IDENT_MSP3467G = 34677,
 
-	/* module msp3400: reserved range 44000-44999 for msp44xx */
+	
 	V4L2_IDENT_MSP4400G = 44007,
 	V4L2_IDENT_MSP4408G = 44087,
 	V4L2_IDENT_MSP4410G = 44107,
@@ -290,43 +280,43 @@
 	V4L2_IDENT_MSP4450G = 44507,
 	V4L2_IDENT_MSP4458G = 44587,
 
-	/* Micron CMOS sensor chips: 45000-45099 */
+	
 	V4L2_IDENT_MT9M001C12ST		= 45000,
 	V4L2_IDENT_MT9M001C12STM	= 45005,
 	V4L2_IDENT_MT9M111		= 45007,
 	V4L2_IDENT_MT9M112		= 45008,
-	V4L2_IDENT_MT9V022IX7ATC	= 45010, /* No way to detect "normal" I77ATx */
-	V4L2_IDENT_MT9V022IX7ATM	= 45015, /* and "lead free" IA7ATx chips */
+	V4L2_IDENT_MT9V022IX7ATC	= 45010, 
+	V4L2_IDENT_MT9V022IX7ATM	= 45015, 
 	V4L2_IDENT_MT9T031		= 45020,
 	V4L2_IDENT_MT9T111		= 45021,
 	V4L2_IDENT_MT9T112		= 45022,
 	V4L2_IDENT_MT9V111		= 45031,
 	V4L2_IDENT_MT9V112		= 45032,
 
-	/* HV7131R CMOS sensor: just ident 46000 */
+	
 	V4L2_IDENT_HV7131R		= 46000,
 
-	/* Sharp RJ54N1CB0C, 0xCB0C = 51980 */
+	
 	V4L2_IDENT_RJ54N1CB0C = 51980,
 
-	/* module m52790: just ident 52790 */
+	
 	V4L2_IDENT_M52790 = 52790,
 
-	/* module cs53132a: just ident 53132 */
+	
 	V4L2_IDENT_CS53l32A = 53132,
 
-	/* modules upd61151 MPEG2 encoder: just ident 54000 */
+	
 	V4L2_IDENT_UPD61161 = 54000,
-	/* modules upd61152 MPEG2 encoder with AC3: just ident 54001 */
+	
 	V4L2_IDENT_UPD61162 = 54001,
 
-	/* module upd64031a: just ident 64031 */
+	
 	V4L2_IDENT_UPD64031A = 64031,
 
-	/* module upd64083: just ident 64083 */
+	
 	V4L2_IDENT_UPD64083 = 64083,
 
-	/* Don't just add new IDs at the end: KEEP THIS LIST ORDERED BY ID! */
+	
 };
 
 #endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index a298ec4..24bca98 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -28,9 +28,6 @@
 
 #include <media/v4l2-dev.h>
 
-/* Common printk constucts for v4l-i2c drivers. These macros create a unique
-   prefix consisting of the driver name, the adapter number and the i2c
-   address. */
 #define v4l_printk(level, name, adapter, addr, fmt, arg...) \
 	printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg)
 
@@ -47,17 +44,13 @@
 #define v4l_info(client, fmt, arg...) \
 	v4l_client_printk(KERN_INFO, client, fmt , ## arg)
 
-/* These three macros assume that the debug level is set with a module
-   parameter called 'debug'. */
 #define v4l_dbg(level, debug, client, fmt, arg...)			     \
 	do { 								     \
 		if (debug >= (level))					     \
 			v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \
 	} while (0)
 
-/* ------------------------------------------------------------------------- */
 
-/* These printk constructs can be used with v4l2_device and v4l2_subdev */
 #define v4l2_printk(level, dev, fmt, arg...) \
 	printk(level "%s: " fmt, (dev)->name , ## arg)
 
@@ -70,17 +63,13 @@
 #define v4l2_info(dev, fmt, arg...) \
 	v4l2_printk(KERN_INFO, dev, fmt , ## arg)
 
-/* These three macros assume that the debug level is set with a module
-   parameter called 'debug'. */
 #define v4l2_dbg(level, debug, dev, fmt, arg...)			\
 	do { 								\
 		if (debug >= (level))					\
 			v4l2_printk(KERN_DEBUG, dev, fmt , ## arg); 	\
 	} while (0)
 
-/* ------------------------------------------------------------------------- */
 
-/* Control helper functions */
 
 int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
 		const char * const *menu_items);
@@ -92,25 +81,17 @@
 #define V4L2_CTRL_MENU_IDS_END (0xffffffff)
 int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids);
 
-/* Note: ctrl_classes points to an array of u32 pointers. Each u32 array is a
-   0-terminated array of control IDs. Each array must be sorted low to high
-   and belong to the same control class. The array of u32 pointers must also
-   be sorted, from low class IDs to high class IDs. */
 u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
 
-/* ------------------------------------------------------------------------- */
 
-/* Register/chip ident helper function */
 
-struct i2c_client; /* forward reference */
+struct i2c_client; 
 int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct v4l2_dbg_match *match);
 int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_dbg_chip_ident *chip,
 		u32 ident, u32 revision);
 int v4l2_chip_match_host(const struct v4l2_dbg_match *match);
 
-/* ------------------------------------------------------------------------- */
 
-/* I2C Helper functions */
 
 struct i2c_driver;
 struct i2c_adapter;
@@ -121,8 +102,6 @@
 struct v4l2_subdev_ops;
 
 
-/* Load an i2c module and return an initialized v4l2_subdev struct.
-   The client_type argument is the name of the chip that's on the adapter. */
 struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
 		struct i2c_adapter *adapter, const char *client_type,
 		u8 addr, const unsigned short *probe_addrs);
@@ -133,52 +112,34 @@
 		struct i2c_adapter *adapter, struct i2c_board_info *info,
 		const unsigned short *probe_addrs);
 
-/* Initialize an v4l2_subdev with data from an i2c_client struct */
 void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
 		const struct v4l2_subdev_ops *ops);
-/* Return i2c client address of v4l2_subdev. */
 unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd);
 
 enum v4l2_i2c_tuner_type {
-	ADDRS_RADIO,	/* Radio tuner addresses */
-	ADDRS_DEMOD,	/* Demod tuner addresses */
-	ADDRS_TV,	/* TV tuner addresses */
-	/* TV tuner addresses if demod is present, this excludes
-	   addresses used by the demodulator from the list of
-	   candidates. */
+	ADDRS_RADIO,	
+	ADDRS_DEMOD,	
+	ADDRS_TV,	
 	ADDRS_TV_WITH_DEMOD,
 };
-/* Return a list of I2C tuner addresses to probe. Use only if the tuner
-   addresses are unknown. */
 const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type);
 
-/* ------------------------------------------------------------------------- */
 
-/* SPI Helper functions */
 #if defined(CONFIG_SPI)
 
 #include <linux/spi/spi.h>
 
 struct spi_device;
 
-/* Load an spi module and return an initialized v4l2_subdev struct.
-   The client_type argument is the name of the chip that's on the adapter. */
 struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev,
 		struct spi_master *master, struct spi_board_info *info);
 
-/* Initialize an v4l2_subdev with data from an spi_device struct */
 void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi,
 		const struct v4l2_subdev_ops *ops);
 #endif
 
-/* ------------------------------------------------------------------------- */
 
-/* Note: these remaining ioctls/structs should be removed as well, but they are
-   still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and
-   v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup
-   is needed in those modules. */
 
-/* s_config */
 struct v4l2_priv_tun_config {
 	int tuner;
 	void *priv;
@@ -192,9 +153,7 @@
 	u32 output;
 };
 
-/* ------------------------------------------------------------------------- */
 
-/* Miscellaneous helper functions */
 
 void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
 			   unsigned int wmax, unsigned int walign,
@@ -212,4 +171,4 @@
 		const struct v4l2_discrete_probe *probe,
 		s32 width, s32 height);
 
-#endif /* V4L2_COMMON_H_ */
+#endif 
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 3a44b62..166f624 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -22,94 +22,23 @@
 #define _V4L2_CTRLS_H
 
 #include <linux/list.h>
+#include <linux/device.h>
 #include <linux/videodev2.h>
 
-/* forward references */
 struct v4l2_ctrl_handler;
-struct v4l2_ctrl_helper;
 struct v4l2_ctrl;
 struct video_device;
 struct v4l2_subdev;
-struct v4l2_subscribed_event;
-struct v4l2_fh;
-struct poll_table_struct;
-struct file;
 
-/** struct v4l2_ctrl_ops - The control operations that the driver has to provide.
-  * @g_volatile_ctrl: Get a new value for this control. Generally only relevant
-  *		for volatile (and usually read-only) controls such as a control
-  *		that returns the current signal strength which changes
-  *		continuously.
-  *		If not set, then the currently cached value will be returned.
-  * @try_ctrl:	Test whether the control's value is valid. Only relevant when
-  *		the usual min/max/step checks are not sufficient.
-  * @s_ctrl:	Actually set the new control value. s_ctrl is compulsory. The
-  *		ctrl->handler->lock is held when these ops are called, so no
-  *		one else can access controls owned by that handler.
-  */
 struct v4l2_ctrl_ops {
 	int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl);
 	int (*try_ctrl)(struct v4l2_ctrl *ctrl);
 	int (*s_ctrl)(struct v4l2_ctrl *ctrl);
 };
 
-/** struct v4l2_ctrl - The control structure.
-  * @node:	The list node.
-  * @ev_subs:	The list of control event subscriptions.
-  * @handler:	The handler that owns the control.
-  * @cluster:	Point to start of cluster array.
-  * @ncontrols:	Number of controls in cluster array.
-  * @done:	Internal flag: set for each processed control.
-  * @is_new:	Set when the user specified a new value for this control. It
-  *		is also set when called from v4l2_ctrl_handler_setup. Drivers
-  *		should never set this flag.
-  * @is_private: If set, then this control is private to its handler and it
-  *		will not be added to any other handlers. Drivers can set
-  *		this flag.
-  * @is_auto:   If set, then this control selects whether the other cluster
-  *		members are in 'automatic' mode or 'manual' mode. This is
-  *		used for autogain/gain type clusters. Drivers should never
-  *		set this flag directly.
-  * @has_volatiles: If set, then one or more members of the cluster are volatile.
-  *		Drivers should never touch this flag.
-  * @manual_mode_value: If the is_auto flag is set, then this is the value
-  *		of the auto control that determines if that control is in
-  *		manual mode. So if the value of the auto control equals this
-  *		value, then the whole cluster is in manual mode. Drivers should
-  *		never set this flag directly.
-  * @ops:	The control ops.
-  * @id:	The control ID.
-  * @name:	The control name.
-  * @type:	The control type.
-  * @minimum:	The control's minimum value.
-  * @maximum:	The control's maximum value.
-  * @default_value: The control's default value.
-  * @step:	The control's step value for non-menu controls.
-  * @menu_skip_mask: The control's skip mask for menu controls. This makes it
-  *		easy to skip menu items that are not valid. If bit X is set,
-  *		then menu item X is skipped. Of course, this only works for
-  *		menus with <= 32 menu items. There are no menus that come
-  *		close to that number, so this is OK. Should we ever need more,
-  *		then this will have to be extended to a u64 or a bit array.
-  * @qmenu:	A const char * array for all menu items. Array entries that are
-  *		empty strings ("") correspond to non-existing menu items (this
-  *		is in addition to the menu_skip_mask above). The last entry
-  *		must be NULL.
-  * @flags:	The control's flags.
-  * @cur:	The control's current value.
-  * @val:	The control's new s32 value.
-  * @val64:	The control's new s64 value.
-  * @string:	The control's new string value.
-  * @priv:	The control's private pointer. For use by the driver. It is
-  *		untouched by the control framework. Note that this pointer is
-  *		not freed when the control is deleted. Should this be needed
-  *		then a new internal bitfield can be added to tell the framework
-  *		to free this pointer.
-  */
 struct v4l2_ctrl {
-	/* Administrative fields */
+	
 	struct list_head node;
-	struct list_head ev_subs;
 	struct v4l2_ctrl_handler *handler;
 	struct v4l2_ctrl **cluster;
 	unsigned ncontrols;
@@ -117,9 +46,7 @@
 
 	unsigned int is_new:1;
 	unsigned int is_private:1;
-	unsigned int is_auto:1;
-	unsigned int has_volatiles:1;
-	unsigned int manual_mode_value:8;
+	unsigned int is_volatile:1;
 
 	const struct v4l2_ctrl_ops *ops;
 	u32 id;
@@ -145,36 +72,12 @@
 	void *priv;
 };
 
-/** struct v4l2_ctrl_ref - The control reference.
-  * @node:	List node for the sorted list.
-  * @next:	Single-link list node for the hash.
-  * @ctrl:	The actual control information.
-  * @helper:	Pointer to helper struct. Used internally in prepare_ext_ctrls().
-  *
-  * Each control handler has a list of these refs. The list_head is used to
-  * keep a sorted-by-control-ID list of all controls, while the next pointer
-  * is used to link the control in the hash's bucket.
-  */
 struct v4l2_ctrl_ref {
 	struct list_head node;
 	struct v4l2_ctrl_ref *next;
 	struct v4l2_ctrl *ctrl;
-	struct v4l2_ctrl_helper *helper;
 };
 
-/** struct v4l2_ctrl_handler - The control handler keeps track of all the
-  * controls: both the controls owned by the handler and those inherited
-  * from other handlers.
-  * @lock:	Lock to control access to this handler and its controls.
-  * @ctrls:	The list of controls owned by this handler.
-  * @ctrl_refs:	The list of control references.
-  * @cached:	The last found control reference. It is common that the same
-  *		control is needed multiple times, so this is a simple
-  *		optimization.
-  * @buckets:	Buckets for the hashing. Allows for quick control lookup.
-  * @nr_of_buckets: Total number of buckets in the array.
-  * @error:	The error code of the first failed control addition.
-  */
 struct v4l2_ctrl_handler {
 	struct mutex lock;
 	struct list_head ctrls;
@@ -185,29 +88,6 @@
 	int error;
 };
 
-/** struct v4l2_ctrl_config - Control configuration structure.
-  * @ops:	The control ops.
-  * @id:	The control ID.
-  * @name:	The control name.
-  * @type:	The control type.
-  * @min:	The control's minimum value.
-  * @max:	The control's maximum value.
-  * @step:	The control's step value for non-menu controls.
-  * @def: 	The control's default value.
-  * @flags:	The control's flags.
-  * @menu_skip_mask: The control's skip mask for menu controls. This makes it
-  *		easy to skip menu items that are not valid. If bit X is set,
-  *		then menu item X is skipped. Of course, this only works for
-  *		menus with <= 32 menu items. There are no menus that come
-  *		close to that number, so this is OK. Should we ever need more,
-  *		then this will have to be extended to a u64 or a bit array.
-  * @qmenu:	A const char * array for all menu items. Array entries that are
-  *		empty strings ("") correspond to non-existing menu items (this
-  *		is in addition to the menu_skip_mask above). The last entry
-  *		must be NULL.
-  * @is_private: If set, then this control is private to its handler and it
-  *		will not be added to any other handlers.
-  */
 struct v4l2_ctrl_config {
 	const struct v4l2_ctrl_ops *ops;
 	u32 id;
@@ -221,303 +101,73 @@
 	u32 menu_skip_mask;
 	const char * const *qmenu;
 	unsigned int is_private:1;
+	unsigned int is_volatile:1;
 };
 
-/** v4l2_ctrl_fill() - Fill in the control fields based on the control ID.
-  *
-  * This works for all standard V4L2 controls.
-  * For non-standard controls it will only fill in the given arguments
-  * and @name will be NULL.
-  *
-  * This function will overwrite the contents of @name, @type and @flags.
-  * The contents of @min, @max, @step and @def may be modified depending on
-  * the type.
-  *
-  * Do not use in drivers! It is used internally for backwards compatibility
-  * control handling only. Once all drivers are converted to use the new
-  * control framework this function will no longer be exported.
-  */
 void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 		    s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags);
 
 
-/** v4l2_ctrl_handler_init() - Initialize the control handler.
-  * @hdl:	The control handler.
-  * @nr_of_controls_hint: A hint of how many controls this handler is
-  *		expected to refer to. This is the total number, so including
-  *		any inherited controls. It doesn't have to be precise, but if
-  *		it is way off, then you either waste memory (too many buckets
-  *		are allocated) or the control lookup becomes slower (not enough
-  *		buckets are allocated, so there are more slow list lookups).
-  *		It will always work, though.
-  *
-  * Returns an error if the buckets could not be allocated. This error will
-  * also be stored in @hdl->error.
-  */
 int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl,
 			   unsigned nr_of_controls_hint);
 
-/** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free
-  * the control list.
-  * @hdl:	The control handler.
-  *
-  * Does nothing if @hdl == NULL.
-  */
 void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl);
 
-/** v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging
-  * to the handler to initialize the hardware to the current control values.
-  * @hdl:	The control handler.
-  *
-  * Button controls will be skipped, as are read-only controls.
-  *
-  * If @hdl == NULL, then this just returns 0.
-  */
 int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl);
 
-/** v4l2_ctrl_handler_log_status() - Log all controls owned by the handler.
-  * @hdl:	The control handler.
-  * @prefix:	The prefix to use when logging the control values. If the
-  *		prefix does not end with a space, then ": " will be added
-  *		after the prefix. If @prefix == NULL, then no prefix will be
-  *		used.
-  *
-  * For use with VIDIOC_LOG_STATUS.
-  *
-  * Does nothing if @hdl == NULL.
-  */
 void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
 				  const char *prefix);
 
-/** v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2
-  * control.
-  * @hdl:	The control handler.
-  * @cfg:	The control's configuration data.
-  * @priv:	The control's driver-specific private data.
-  *
-  * If the &v4l2_ctrl struct could not be allocated then NULL is returned
-  * and @hdl->error is set to the error code (if it wasn't set already).
-  */
 struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
 			const struct v4l2_ctrl_config *cfg, void *priv);
 
-/** v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu control.
-  * @hdl:	The control handler.
-  * @ops:	The control ops.
-  * @id:	The control ID.
-  * @min:	The control's minimum value.
-  * @max:	The control's maximum value.
-  * @step:	The control's step value
-  * @def: 	The control's default value.
-  *
-  * If the &v4l2_ctrl struct could not be allocated, or the control
-  * ID is not known, then NULL is returned and @hdl->error is set to the
-  * appropriate error code (if it wasn't set already).
-  *
-  * If @id refers to a menu control, then this function will return NULL.
-  *
-  * Use v4l2_ctrl_new_std_menu() when adding menu controls.
-  */
 struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl,
 			const struct v4l2_ctrl_ops *ops,
 			u32 id, s32 min, s32 max, u32 step, s32 def);
 
-/** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control.
-  * @hdl:	The control handler.
-  * @ops:	The control ops.
-  * @id:	The control ID.
-  * @max:	The control's maximum value.
-  * @mask: 	The control's skip mask for menu controls. This makes it
-  *		easy to skip menu items that are not valid. If bit X is set,
-  *		then menu item X is skipped. Of course, this only works for
-  *		menus with <= 32 menu items. There are no menus that come
-  *		close to that number, so this is OK. Should we ever need more,
-  *		then this will have to be extended to a u64 or a bit array.
-  * @def: 	The control's default value.
-  *
-  * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value
-  * determines which menu items are to be skipped.
-  *
-  * If @id refers to a non-menu control, then this function will return NULL.
-  */
 struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
 			const struct v4l2_ctrl_ops *ops,
 			u32 id, s32 max, s32 mask, s32 def);
 
-/** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler.
-  * @hdl:	The control handler.
-  * @ctrl:	The control to add.
-  *
-  * It will return NULL if it was unable to add the control reference.
-  * If the control already belonged to the handler, then it will do
-  * nothing and just return @ctrl.
-  */
 struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl,
 					  struct v4l2_ctrl *ctrl);
 
-/** v4l2_ctrl_add_handler() - Add all controls from handler @add to
-  * handler @hdl.
-  * @hdl:	The control handler.
-  * @add:	The control handler whose controls you want to add to
-  *		the @hdl control handler.
-  *
-  * Does nothing if either of the two is a NULL pointer.
-  * In case of an error @hdl->error will be set to the error code (if it
-  * wasn't set already).
-  */
 int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
 			  struct v4l2_ctrl_handler *add);
 
 
-/** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster.
-  * @ncontrols:	The number of controls in this cluster.
-  * @controls: 	The cluster control array of size @ncontrols.
-  */
 void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls);
 
 
-/** v4l2_ctrl_auto_cluster() - Mark all controls in the cluster as belonging to
-  * that cluster and set it up for autofoo/foo-type handling.
-  * @ncontrols:	The number of controls in this cluster.
-  * @controls:	The cluster control array of size @ncontrols. The first control
-  *		must be the 'auto' control (e.g. autogain, autoexposure, etc.)
-  * @manual_val: The value for the first control in the cluster that equals the
-  *		manual setting.
-  * @set_volatile: If true, then all controls except the first auto control will
-  *		be volatile.
-  *
-  * Use for control groups where one control selects some automatic feature and
-  * the other controls are only active whenever the automatic feature is turned
-  * off (manual mode). Typical examples: autogain vs gain, auto-whitebalance vs
-  * red and blue balance, etc.
-  *
-  * The behavior of such controls is as follows:
-  *
-  * When the autofoo control is set to automatic, then any manual controls
-  * are set to inactive and any reads will call g_volatile_ctrl (if the control
-  * was marked volatile).
-  *
-  * When the autofoo control is set to manual, then any manual controls will
-  * be marked active, and any reads will just return the current value without
-  * going through g_volatile_ctrl.
-  *
-  * In addition, this function will set the V4L2_CTRL_FLAG_UPDATE flag
-  * on the autofoo control and V4L2_CTRL_FLAG_INACTIVE on the foo control(s)
-  * if autofoo is in auto mode.
-  */
-void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls,
-			u8 manual_val, bool set_volatile);
-
-
-/** v4l2_ctrl_find() - Find a control with the given ID.
-  * @hdl:	The control handler.
-  * @id:	The control ID to find.
-  *
-  * If @hdl == NULL this will return NULL as well. Will lock the handler so
-  * do not use from inside &v4l2_ctrl_ops.
-  */
 struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id);
 
-/** v4l2_ctrl_activate() - Make the control active or inactive.
-  * @ctrl:	The control to (de)activate.
-  * @active:	True if the control should become active.
-  *
-  * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically.
-  * Does nothing if @ctrl == NULL.
-  * This will usually be called from within the s_ctrl op.
-  * The V4L2_EVENT_CTRL event will be generated afterwards.
-  *
-  * This function assumes that the control handler is locked.
-  */
 void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active);
 
-/** v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed.
-  * @ctrl:	The control to (de)activate.
-  * @grabbed:	True if the control should become grabbed.
-  *
-  * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
-  * Does nothing if @ctrl == NULL.
-  * The V4L2_EVENT_CTRL event will be generated afterwards.
-  * This will usually be called when starting or stopping streaming in the
-  * driver.
-  *
-  * This function assumes that the control handler is not locked and will
-  * take the lock itself.
-  */
 void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
 
-/** v4l2_ctrl_lock() - Helper function to lock the handler
-  * associated with the control.
-  * @ctrl:	The control to lock.
-  */
 static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
 {
 	mutex_lock(&ctrl->handler->lock);
 }
 
-/** v4l2_ctrl_lock() - Helper function to unlock the handler
-  * associated with the control.
-  * @ctrl:	The control to unlock.
-  */
 static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
 {
 	mutex_unlock(&ctrl->handler->lock);
 }
 
-/** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver.
-  * @ctrl:	The control.
-  *
-  * This returns the control's value safely by going through the control
-  * framework. This function will lock the control's handler, so it cannot be
-  * used from within the &v4l2_ctrl_ops functions.
-  *
-  * This function is for integer type controls only.
-  */
 s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
 
-/** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver.
-  * @ctrl:	The control.
-  * @val:	The new value.
-  *
-  * This set the control's new value safely by going through the control
-  * framework. This function will lock the control's handler, so it cannot be
-  * used from within the &v4l2_ctrl_ops functions.
-  *
-  * This function is for integer type controls only.
-  */
 int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
 
-/* Internal helper functions that deal with control events. */
-void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl,
-		struct v4l2_subscribed_event *sev);
-void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl,
-		struct v4l2_subscribed_event *sev);
 
-/* Can be used as a vidioc_log_status function that just dumps all controls
-   associated with the filehandle. */
-int v4l2_ctrl_log_status(struct file *file, void *fh);
-
-/* Can be used as a vidioc_subscribe_event function that just subscribes
-   control events. */
-int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
-				struct v4l2_event_subscription *sub);
-
-/* Can be used as a poll function that just polls for control events. */
-unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
-
-/* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */
 int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc);
 int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm);
 int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
-int v4l2_s_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
-						struct v4l2_control *ctrl);
+int v4l2_s_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl);
 int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
 int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
-int v4l2_s_ext_ctrls(struct v4l2_fh *fh, struct v4l2_ctrl_handler *hdl,
-						struct v4l2_ext_controls *c);
+int v4l2_s_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c);
 
-/* Helpers for subdevices. If the associated ctrl_handler == NULL then they
-   will all return -EINVAL. */
 int v4l2_subdev_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
 int v4l2_subdev_querymenu(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
 int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs);
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 96d2221..b7bee3f 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -1,11 +1,3 @@
-/*
- *
- *	V 4 L 2   D R I V E R   H E L P E R   A P I
- *
- * Moved from videodev2.h
- *
- *	Some commonly needed functions for drivers (v4l2-common.o module)
- */
 #ifndef _V4L2_DEV_H
 #define _V4L2_DEV_H
 
@@ -31,16 +23,10 @@
 struct v4l2_device;
 struct v4l2_ctrl_handler;
 
-/* Flag to mark the video_device struct as registered.
-   Drivers can clear this flag if they want to block all future
-   device access. It is cleared by video_unregister_device. */
 #define V4L2_FL_REGISTERED	(0)
-/* file->private_data points to struct v4l2_fh */
 #define V4L2_FL_USES_V4L2_FH	(1)
-/* Use the prio field of v4l2_fh for core priority checking */
 #define V4L2_FL_USE_FH_PRIO	(2)
 
-/* Priority helper functions */
 
 struct v4l2_prio_state {
 	atomic_t prios[4];
@@ -62,9 +48,6 @@
 	unsigned int (*poll) (struct file *, struct poll_table_struct *);
 	long (*ioctl) (struct file *, unsigned int, unsigned long);
 	long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
-#ifdef CONFIG_COMPAT
-	long (*compat_ioctl32) (struct file *, unsigned int, unsigned long);
-#endif
 	unsigned long (*get_unmapped_area) (struct file *, unsigned long,
 				unsigned long, unsigned long, unsigned long);
 	int (*mmap) (struct file *, struct vm_area_struct *);
@@ -72,108 +55,87 @@
 	int (*release) (struct file *);
 };
 
-/*
- * Newer version of video_device, handled by videodev2.c
- * 	This version moves redundant code from video device code to
- *	the common handler
- */
 
 struct video_device
 {
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	struct media_entity entity;
 #endif
-	/* device ops */
+	
 	const struct v4l2_file_operations *fops;
 
-	/* sysfs */
-	struct device dev;		/* v4l device */
-	struct cdev *cdev;		/* character device */
+	
+	struct device dev;		
+	struct cdev *cdev;		
 
-	/* Set either parent or v4l2_dev if your driver uses v4l2_device */
-	struct device *parent;		/* device parent */
-	struct v4l2_device *v4l2_dev;	/* v4l2_device parent */
+	
+	struct device *parent;		
+	struct v4l2_device *v4l2_dev;	
 
-	/* Control handler associated with this device node. May be NULL. */
+	
 	struct v4l2_ctrl_handler *ctrl_handler;
 
-	/* Priority state. If NULL, then v4l2_dev->prio will be used. */
+	
 	struct v4l2_prio_state *prio;
 
-	/* device info */
+	
 	char name[32];
 	int vfl_type;
-	/* 'minor' is set to -1 if the registration failed */
+	
 	int minor;
 	u16 num;
-	/* use bitops to set/clear/test flags */
+	
 	unsigned long flags;
-	/* attribute to differentiate multiple indices on one physical device */
+	
 	int index;
 
-	/* V4L2 file handles */
-	spinlock_t		fh_lock; /* Lock for all v4l2_fhs */
-	struct list_head	fh_list; /* List of struct v4l2_fh */
+	
+	spinlock_t		fh_lock; 
+	struct list_head	fh_list; 
 
-	int debug;			/* Activates debug level*/
+	int debug;			
 
-	/* Video standard vars */
-	v4l2_std_id tvnorms;		/* Supported tv norms */
-	v4l2_std_id current_norm;	/* Current tvnorm */
+	
+	v4l2_std_id tvnorms;		
+	v4l2_std_id current_norm;	
 
-	/* callbacks */
+	
 	void (*release)(struct video_device *vdev);
 
-	/* ioctl callbacks */
+	
 	const struct v4l2_ioctl_ops *ioctl_ops;
 
-	/* serialization lock */
+	
 	struct mutex *lock;
 };
 
 #define media_entity_to_video_device(__e) \
 	container_of(__e, struct video_device, entity)
-/* dev to video-device */
 #define to_video_device(cd) container_of(cd, struct video_device, dev)
 
 int __must_check __video_register_device(struct video_device *vdev, int type,
 		int nr, int warn_if_nr_in_use, struct module *owner);
 
-/* Register video devices. Note that if video_register_device fails,
-   the release() callback of the video_device structure is *not* called, so
-   the caller is responsible for freeing any data. Usually that means that
-   you call video_device_release() on failure. */
 static inline int __must_check video_register_device(struct video_device *vdev,
 		int type, int nr)
 {
 	return __video_register_device(vdev, type, nr, 1, vdev->fops->owner);
 }
 
-/* Same as video_register_device, but no warning is issued if the desired
-   device node number was already in use. */
 static inline int __must_check video_register_device_no_warn(
 		struct video_device *vdev, int type, int nr)
 {
 	return __video_register_device(vdev, type, nr, 0, vdev->fops->owner);
 }
 
-/* Unregister video devices. Will do nothing if vdev == NULL or
-   video_is_registered() returns false. */
 void video_unregister_device(struct video_device *vdev);
 
-/* helper functions to alloc/release struct video_device, the
-   latter can also be used for video_device->release(). */
 struct video_device * __must_check video_device_alloc(void);
 
-/* this release function frees the vdev pointer */
 void video_device_release(struct video_device *vdev);
 
-/* this release function does nothing, use when the video_device is a
-   static global struct. Note that having a static video_device is
-   a dubious construction at best. */
 void video_device_release_empty(struct video_device *vdev);
 
-/* helper functions to access driver private data. */
 static inline void *video_get_drvdata(struct video_device *vdev)
 {
 	return dev_get_drvdata(&vdev->dev);
@@ -186,8 +148,6 @@
 
 struct video_device *video_devdata(struct file *file);
 
-/* Combine video_get_drvdata and video_devdata as this is
-   used very often. */
 static inline void *video_drvdata(struct file *file)
 {
 	return video_get_drvdata(video_devdata(file));
@@ -203,4 +163,4 @@
 	return test_bit(V4L2_FL_REGISTERED, &vdev->flags);
 }
 
-#endif /* _V4L2_DEV_H */
+#endif 
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index d61febf..a69738e 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -25,44 +25,33 @@
 #include <media/v4l2-subdev.h>
 #include <media/v4l2-dev.h>
 
-/* Each instance of a V4L2 device should create the v4l2_device struct,
-   either stand-alone or embedded in a larger struct.
-
-   It allows easy access to sub-devices (see v4l2-subdev.h) and provides
-   basic V4L2 device-level support.
- */
 
 #define V4L2_DEVICE_NAME_SIZE (20 + 16)
 
 struct v4l2_ctrl_handler;
 
 struct v4l2_device {
-	/* dev->driver_data points to this struct.
-	   Note: dev might be NULL if there is no parent device
-	   as is the case with e.g. ISA devices. */
 	struct device *dev;
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	struct media_device *mdev;
 #endif
-	/* used to keep track of the registered subdevs */
+	
 	struct list_head subdevs;
-	/* lock this struct; can be used by the driver as well if this
-	   struct is embedded into a larger struct. */
 	spinlock_t lock;
-	/* unique device name, by default the driver name + bus ID */
+	
 	char name[V4L2_DEVICE_NAME_SIZE];
-	/* notify callback called by some sub-devices. */
+	
 	void (*notify)(struct v4l2_subdev *sd,
 			unsigned int notification, void *arg);
-	/* The control handler. May be NULL. */
+	
 	struct v4l2_ctrl_handler *ctrl_handler;
-	/* Device's priority state */
+	
 	struct v4l2_prio_state prio;
-	/* BKL replacement mutex. Temporary solution only. */
+	
 	struct mutex ioctl_lock;
-	/* Keep track of the references to this struct. */
+	
 	struct kref ref;
-	/* Release function that is called when the ref count goes to 0. */
+	
 	void (*release)(struct v4l2_device *v4l2_dev);
 };
 
@@ -73,60 +62,25 @@
 
 int v4l2_device_put(struct v4l2_device *v4l2_dev);
 
-/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev.
-   dev may be NULL in rare cases (ISA devices). In that case you
-   must fill in the v4l2_dev->name field before calling this function. */
 int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev);
 
-/* Optional function to initialize the name field of struct v4l2_device using
-   the driver name and a driver-global atomic_t instance.
-   This function will increment the instance counter and returns the instance
-   value used in the name.
-
-   Example:
-
-   static atomic_t drv_instance = ATOMIC_INIT(0);
-
-   ...
-
-   instance = v4l2_device_set_name(&v4l2_dev, "foo", &drv_instance);
-
-   The first time this is called the name field will be set to foo0 and
-   this function returns 0. If the name ends with a digit (e.g. cx18),
-   then the name will be set to cx18-0 since cx180 looks really odd. */
 int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename,
 						atomic_t *instance);
 
-/* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects.
-   Since the parent disappears this ensures that v4l2_dev doesn't have an
-   invalid parent pointer. */
 void v4l2_device_disconnect(struct v4l2_device *v4l2_dev);
 
-/* Unregister all sub-devices and any other resources related to v4l2_dev. */
 void v4l2_device_unregister(struct v4l2_device *v4l2_dev);
 
-/* Register a subdev with a v4l2 device. While registered the subdev module
-   is marked as in-use. An error is returned if the module is no longer
-   loaded when you attempt to register it. */
 int __must_check v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
 						struct v4l2_subdev *sd);
-/* Unregister a subdev with a v4l2 device. Can also be called if the subdev
-   wasn't registered. In that case it will do nothing. */
 void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
 
-/* Register device nodes for all subdev of the v4l2 device that are marked with
- * the V4L2_SUBDEV_FL_HAS_DEVNODE flag.
- */
 int __must_check
 v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev);
 
-/* Iterate over all subdevs. */
 #define v4l2_device_for_each_subdev(sd, v4l2_dev)			\
 	list_for_each_entry(sd, &(v4l2_dev)->subdevs, list)
 
-/* Call the specified callback for all subdevs matching the condition.
-   Ignore any errors. Note that you cannot add or delete a subdev
-   while walking the subdevs list. */
 #define __v4l2_device_call_subdevs_p(v4l2_dev, sd, cond, o, f, args...)	\
 	do { 								\
 		list_for_each_entry((sd), &(v4l2_dev)->subdevs, list)	\
@@ -142,10 +96,6 @@
 						f , ##args);		\
 	} while (0)
 
-/* Call the specified callback for all subdevs matching the condition.
-   If the callback returns an error other than 0 or -ENOIOCTLCMD, then
-   return with that error code. Note that you cannot add or delete a
-   subdev while walking the subdevs list. */
 #define __v4l2_device_call_subdevs_until_err_p(v4l2_dev, sd, cond, o, f, args...) \
 ({ 									\
 	long __err = 0;							\
@@ -166,9 +116,6 @@
 						f , ##args);		\
 })
 
-/* Call the specified callback for all subdevs matching grp_id (if 0, then
-   match them all). Ignore any errors. Note that you cannot add or delete
-   a subdev while walking the subdevs list. */
 #define v4l2_device_call_all(v4l2_dev, grpid, o, f, args...)		\
 	do {								\
 		struct v4l2_subdev *__sd;				\
@@ -178,10 +125,6 @@
 			##args);					\
 	} while (0)
 
-/* Call the specified callback for all subdevs matching grp_id (if 0, then
-   match them all). If the callback returns an error other than 0 or
-   -ENOIOCTLCMD, then return with that error code. Note that you cannot
-   add or delete a subdev while walking the subdevs list. */
 #define v4l2_device_call_until_err(v4l2_dev, grpid, o, f, args...) 	\
 ({									\
 	struct v4l2_subdev *__sd;					\
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
index 5f14e88..fb1841e 100644
--- a/include/media/v4l2-event.h
+++ b/include/media/v4l2-event.h
@@ -29,95 +29,39 @@
 #include <linux/videodev2.h>
 #include <linux/wait.h>
 
-/*
- * Overview:
- *
- * Events are subscribed per-filehandle. An event specification consists of a
- * type and is optionally associated with an object identified through the
- * 'id' field. So an event is uniquely identified by the (type, id) tuple.
- *
- * The v4l2-fh struct has a list of subscribed events. The v4l2_subscribed_event
- * struct is added to that list, one for every subscribed event.
- *
- * Each v4l2_subscribed_event struct ends with an array of v4l2_kevent structs.
- * This array (ringbuffer, really) is used to store any events raised by the
- * driver. The v4l2_kevent struct links into the 'available' list of the
- * v4l2_fh struct so VIDIOC_DQEVENT will know which event to dequeue first.
- *
- * Finally, if the event subscription is associated with a particular object
- * such as a V4L2 control, then that object needs to know about that as well
- * so that an event can be raised by that object. So the 'node' field can
- * be used to link the v4l2_subscribed_event struct into a list of that
- * object.
- *
- * So to summarize:
- *
- * struct v4l2_fh has two lists: one of the subscribed events, and one of the
- * pending events.
- *
- * struct v4l2_subscribed_event has a ringbuffer of raised (pending) events of
- * that particular type.
- *
- * If struct v4l2_subscribed_event is associated with a specific object, then
- * that object will have an internal list of struct v4l2_subscribed_event so
- * it knows who subscribed an event to that object.
- */
-
 struct v4l2_fh;
-struct v4l2_subscribed_event;
 struct video_device;
 
-/** struct v4l2_kevent - Internal kernel event struct.
-  * @list:	List node for the v4l2_fh->available list.
-  * @sev:	Pointer to parent v4l2_subscribed_event.
-  * @event:	The event itself.
-  */
 struct v4l2_kevent {
 	struct list_head	list;
-	struct v4l2_subscribed_event *sev;
 	struct v4l2_event	event;
 };
 
-/** struct v4l2_subscribed_event - Internal struct representing a subscribed event.
-  * @list:	List node for the v4l2_fh->subscribed list.
-  * @type:	Event type.
-  * @id:	Associated object ID (e.g. control ID). 0 if there isn't any.
-  * @flags:	Copy of v4l2_event_subscription->flags.
-  * @fh:	Filehandle that subscribed to this event.
-  * @node:	List node that hooks into the object's event list (if there is one).
-  * @replace:	Optional callback that can replace event 'old' with event 'new'.
-  * @merge:	Optional callback that can merge event 'old' into event 'new'.
-  * @elems:	The number of elements in the events array.
-  * @first:	The index of the events containing the oldest available event.
-  * @in_use:	The number of queued events.
-  * @events:	An array of @elems events.
-  */
 struct v4l2_subscribed_event {
 	struct list_head	list;
 	u32			type;
-	u32			id;
-	u32			flags;
-	struct v4l2_fh		*fh;
-	struct list_head	node;
-	void			(*replace)(struct v4l2_event *old,
-					   const struct v4l2_event *new);
-	void			(*merge)(const struct v4l2_event *old,
-					 struct v4l2_event *new);
-	unsigned		elems;
-	unsigned		first;
-	unsigned		in_use;
-	struct v4l2_kevent	events[];
 };
 
+struct v4l2_events {
+	wait_queue_head_t	wait;
+	struct list_head	subscribed; 
+	struct list_head	free; 
+	struct list_head	available; 
+	unsigned int		navailable;
+	unsigned int		nallocated; 
+	u32			sequence;
+};
+
+int v4l2_event_init(struct v4l2_fh *fh);
+int v4l2_event_alloc(struct v4l2_fh *fh, unsigned int n);
+void v4l2_event_free(struct v4l2_fh *fh);
 int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event,
 		       int nonblocking);
 void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev);
-void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev);
 int v4l2_event_pending(struct v4l2_fh *fh);
 int v4l2_event_subscribe(struct v4l2_fh *fh,
-			 struct v4l2_event_subscription *sub, unsigned elems);
+			 struct v4l2_event_subscription *sub);
 int v4l2_event_unsubscribe(struct v4l2_fh *fh,
 			   struct v4l2_event_subscription *sub);
-void v4l2_event_unsubscribe_all(struct v4l2_fh *fh);
 
-#endif /* V4L2_EVENT_H */
+#endif 
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
index 52513c2..9509e9d 100644
--- a/include/media/v4l2-fh.h
+++ b/include/media/v4l2-fh.h
@@ -29,73 +29,25 @@
 #include <linux/list.h>
 
 struct video_device;
-struct v4l2_ctrl_handler;
+struct v4l2_events;
 
 struct v4l2_fh {
 	struct list_head	list;
 	struct video_device	*vdev;
-	struct v4l2_ctrl_handler *ctrl_handler;
+	struct v4l2_events      *events; 
 	enum v4l2_priority	prio;
-
-	/* Events */
-	wait_queue_head_t	wait;
-	struct list_head	subscribed; /* Subscribed events */
-	struct list_head	available; /* Dequeueable event */
-	unsigned int		navailable;
-	u32			sequence;
 };
 
-/*
- * Initialise the file handle. Parts of the V4L2 framework using the
- * file handles should be initialised in this function. Must be called
- * from driver's v4l2_file_operations->open() handler if the driver
- * uses v4l2_fh.
- */
-void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
-/*
- * Add the fh to the list of file handles on a video_device. The file
- * handle must be initialised first.
- */
+int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
 void v4l2_fh_add(struct v4l2_fh *fh);
-/*
- * Can be used as the open() op of v4l2_file_operations.
- * It allocates a v4l2_fh and inits and adds it to the video_device associated
- * with the file pointer.
- */
 int v4l2_fh_open(struct file *filp);
-/*
- * Remove file handle from the list of file handles. Must be called in
- * v4l2_file_operations->release() handler if the driver uses v4l2_fh.
- * On error filp->private_data will be NULL, otherwise it will point to
- * the v4l2_fh struct.
- */
 void v4l2_fh_del(struct v4l2_fh *fh);
-/*
- * Release resources related to a file handle. Parts of the V4L2
- * framework using the v4l2_fh must release their resources here, too.
- * Must be called in v4l2_file_operations->release() handler if the
- * driver uses v4l2_fh.
- */
 void v4l2_fh_exit(struct v4l2_fh *fh);
-/*
- * Can be used as the release() op of v4l2_file_operations.
- * It deletes and exits the v4l2_fh associated with the file pointer and
- * frees it. It will do nothing if filp->private_data (the pointer to the
- * v4l2_fh struct) is NULL. This function always returns 0.
- */
 int v4l2_fh_release(struct file *filp);
-/*
- * Returns 1 if this filehandle is the only filehandle opened for the
- * associated video_device. If fh is NULL, then it returns 0.
- */
 int v4l2_fh_is_singular(struct v4l2_fh *fh);
-/*
- * Helper function with struct file as argument. If filp->private_data is
- * NULL, then it will return 0.
- */
 static inline int v4l2_fh_is_singular_file(struct file *filp)
 {
 	return v4l2_fh_is_singular(filp->private_data);
 }
 
-#endif /* V4L2_EVENT_H */
+#endif 
diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
index e6aa231..e52ddc9 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -25,23 +25,17 @@
 #ifndef V4L2_INT_DEVICE_H
 #define V4L2_INT_DEVICE_H
 
+#include <linux/module.h>
 #include <media/v4l2-common.h>
 
 #define V4L2NAMESIZE 32
 
-/*
- *
- * The internal V4L2 device interface core.
- *
- */
 
 enum v4l2_int_type {
 	v4l2_int_type_master = 1,
 	v4l2_int_type_slave
 };
 
-struct module;
-
 struct v4l2_int_device;
 
 struct v4l2_int_master {
@@ -59,7 +53,7 @@
 };
 
 struct v4l2_int_slave {
-	/* Don't touch master. */
+	
 	struct v4l2_int_device *master;
 
 	char attach_to[V4L2NAMESIZE];
@@ -69,7 +63,7 @@
 };
 
 struct v4l2_int_device {
-	/* Don't touch head. */
+	
 	struct list_head head;
 
 	struct module *module;
@@ -93,11 +87,6 @@
 int v4l2_int_ioctl_0(struct v4l2_int_device *d, int cmd);
 int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg);
 
-/*
- *
- * Types and definitions for IOCTL commands.
- *
- */
 
 enum v4l2_power {
 	V4L2_POWER_OFF = 0,
@@ -105,56 +94,35 @@
 	V4L2_POWER_STANDBY,
 };
 
-/* Slave interface type. */
 enum v4l2_if_type {
-	/*
-	 * Parallel 8-, 10- or 12-bit interface, used by for example
-	 * on certain image sensors.
-	 */
 	V4L2_IF_TYPE_BT656,
 };
 
 enum v4l2_if_type_bt656_mode {
-	/*
-	 * Modes without Bt synchronisation codes. Separate
-	 * synchronisation signal lines are used.
-	 */
 	V4L2_IF_TYPE_BT656_MODE_NOBT_8BIT,
 	V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT,
 	V4L2_IF_TYPE_BT656_MODE_NOBT_12BIT,
-	/*
-	 * Use Bt synchronisation codes. The vertical and horizontal
-	 * synchronisation is done based on synchronisation codes.
-	 */
 	V4L2_IF_TYPE_BT656_MODE_BT_8BIT,
 	V4L2_IF_TYPE_BT656_MODE_BT_10BIT,
 };
 
 struct v4l2_if_type_bt656 {
-	/*
-	 * 0: Frame begins when vsync is high.
-	 * 1: Frame begins when vsync changes from low to high.
-	 */
 	unsigned frame_start_on_rising_vs:1;
-	/* Use Bt synchronisation codes for sync correction. */
+	
 	unsigned bt_sync_correct:1;
-	/* Swap every two adjacent image data elements. */
+	
 	unsigned swap:1;
-	/* Inverted latch clock polarity from slave. */
+	
 	unsigned latch_clk_inv:1;
-	/* Hs polarity. 0 is active high, 1 active low. */
+	
 	unsigned nobt_hs_inv:1;
-	/* Vs polarity. 0 is active high, 1 active low. */
+	
 	unsigned nobt_vs_inv:1;
 	enum v4l2_if_type_bt656_mode mode;
-	/* Minimum accepted bus clock for slave (in Hz). */
+	
 	u32 clock_min;
-	/* Maximum accepted bus clock for slave. */
+	
 	u32 clock_max;
-	/*
-	 * Current wish of the slave. May only change in response to
-	 * ioctls that affect image capture.
-	 */
 	u32 clock_curr;
 };
 
@@ -165,13 +133,7 @@
 	} u;
 };
 
-/* IOCTL command numbers. */
 enum v4l2_int_ioctl_num {
-	/*
-	 *
-	 * "Proper" V4L ioctls, as in struct video_device.
-	 *
-	 */
 	vidioc_int_enum_fmt_cap_num = 1,
 	vidioc_int_g_fmt_cap_num,
 	vidioc_int_s_fmt_cap_num,
@@ -188,54 +150,30 @@
 	vidioc_int_s_std_num,
 	vidioc_int_s_video_routing_num,
 
-	/*
-	 *
-	 * Strictly internal ioctls.
-	 *
-	 */
-	/* Initialise the device when slave attaches to the master. */
+	
 	vidioc_int_dev_init_num = 1000,
-	/* Delinitialise the device at slave detach. */
+	
 	vidioc_int_dev_exit_num,
-	/* Set device power state. */
+	
 	vidioc_int_s_power_num,
-	/*
-	* Get slave private data, e.g. platform-specific slave
-	* configuration used by the master.
-	*/
 	vidioc_int_g_priv_num,
-	/* Get slave interface parameters. */
+	
 	vidioc_int_g_ifparm_num,
-	/* Does the slave need to be reset after VIDIOC_DQBUF? */
+	
 	vidioc_int_g_needs_reset_num,
 	vidioc_int_enum_framesizes_num,
 	vidioc_int_enum_frameintervals_num,
 
-	/*
-	 *
-	 * VIDIOC_INT_* ioctls.
-	 *
-	 */
-	/* VIDIOC_INT_RESET */
+	
 	vidioc_int_reset_num,
-	/* VIDIOC_INT_INIT */
+	
 	vidioc_int_init_num,
-	/* VIDIOC_DBG_G_CHIP_IDENT */
+	
 	vidioc_int_g_chip_ident_num,
 
-	/*
-	 *
-	 * Start of private ioctls.
-	 *
-	 */
 	vidioc_int_priv_start_num = 2000,
 };
 
-/*
- *
- * IOCTL wrapper functions for better type checking.
- *
- */
 
 #define V4L2_INT_WRAPPER_0(name)					\
 	static inline int vidioc_int_##name(struct v4l2_int_device *d)	\
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 3cb939c..7209cda 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -1,35 +1,28 @@
-/*
- *
- *	V 4 L 2   D R I V E R   H E L P E R   A P I
- *
- * Moved from videodev2.h
- *
- *	Some commonly needed functions for drivers (v4l2-common.o module)
- */
 #ifndef _V4L2_IOCTL_H
 #define _V4L2_IOCTL_H
 
 #include <linux/poll.h>
 #include <linux/fs.h>
+#include <linux/device.h>
 #include <linux/mutex.h>
-#include <linux/compiler.h> /* need __user */
+#include <linux/compiler.h> 
 #include <linux/videodev2.h>
 
 struct v4l2_fh;
 
 struct v4l2_ioctl_ops {
-	/* ioctl callbacks */
+	
 
-	/* VIDIOC_QUERYCAP handler */
+	
 	int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
 
-	/* Priority handling */
+	
 	int (*vidioc_g_priority)   (struct file *file, void *fh,
 				    enum v4l2_priority *p);
 	int (*vidioc_s_priority)   (struct file *file, void *fh,
 				    enum v4l2_priority p);
 
-	/* VIDIOC_ENUM_FMT handlers */
+	
 	int (*vidioc_enum_fmt_vid_cap)     (struct file *file, void *fh,
 					    struct v4l2_fmtdesc *f);
 	int (*vidioc_enum_fmt_vid_overlay) (struct file *file, void *fh,
@@ -43,7 +36,7 @@
 	int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
 					    struct v4l2_fmtdesc *f);
 
-	/* VIDIOC_G_FMT handlers */
+	
 	int (*vidioc_g_fmt_vid_cap)    (struct file *file, void *fh,
 					struct v4l2_format *f);
 	int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
@@ -67,7 +60,7 @@
 	int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
 					struct v4l2_format *f);
 
-	/* VIDIOC_S_FMT handlers */
+	
 	int (*vidioc_s_fmt_vid_cap)    (struct file *file, void *fh,
 					struct v4l2_format *f);
 	int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh,
@@ -91,7 +84,7 @@
 	int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
 					struct v4l2_format *f);
 
-	/* VIDIOC_TRY_FMT handlers */
+	
 	int (*vidioc_try_fmt_vid_cap)    (struct file *file, void *fh,
 					  struct v4l2_format *f);
 	int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
@@ -115,14 +108,12 @@
 	int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
 					  struct v4l2_format *f);
 
-	/* Buffer handlers */
+	
 	int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
 	int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
 	int (*vidioc_qbuf)    (struct file *file, void *fh, struct v4l2_buffer *b);
 	int (*vidioc_dqbuf)   (struct file *file, void *fh, struct v4l2_buffer *b);
 
-	int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b);
-	int (*vidioc_prepare_buf)(struct file *file, void *fh, struct v4l2_buffer *b);
 
 	int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i);
 	int (*vidioc_g_fbuf)   (struct file *file, void *fh,
@@ -130,30 +121,27 @@
 	int (*vidioc_s_fbuf)   (struct file *file, void *fh,
 				struct v4l2_framebuffer *a);
 
-		/* Stream on/off */
+		
 	int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i);
 	int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i);
 
-		/* Standard handling
-			ENUMSTD is handled by videodev.c
-		 */
 	int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm);
 	int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id *norm);
 	int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a);
 
-		/* Input handling */
+		
 	int (*vidioc_enum_input)(struct file *file, void *fh,
 				 struct v4l2_input *inp);
 	int (*vidioc_g_input)   (struct file *file, void *fh, unsigned int *i);
 	int (*vidioc_s_input)   (struct file *file, void *fh, unsigned int i);
 
-		/* Output handling */
+		
 	int (*vidioc_enum_output) (struct file *file, void *fh,
 				  struct v4l2_output *a);
 	int (*vidioc_g_output)   (struct file *file, void *fh, unsigned int *i);
 	int (*vidioc_s_output)   (struct file *file, void *fh, unsigned int i);
 
-		/* Control handling */
+		
 	int (*vidioc_queryctrl)        (struct file *file, void *fh,
 					struct v4l2_queryctrl *a);
 	int (*vidioc_g_ctrl)           (struct file *file, void *fh,
@@ -169,7 +157,7 @@
 	int (*vidioc_querymenu)        (struct file *file, void *fh,
 					struct v4l2_querymenu *a);
 
-	/* Audio ioctls */
+	
 	int (*vidioc_enumaudio)        (struct file *file, void *fh,
 					struct v4l2_audio *a);
 	int (*vidioc_g_audio)          (struct file *file, void *fh,
@@ -177,7 +165,7 @@
 	int (*vidioc_s_audio)          (struct file *file, void *fh,
 					struct v4l2_audio *a);
 
-	/* Audio out ioctls */
+	
 	int (*vidioc_enumaudout)       (struct file *file, void *fh,
 					struct v4l2_audioout *a);
 	int (*vidioc_g_audout)         (struct file *file, void *fh,
@@ -188,18 +176,14 @@
 					struct v4l2_modulator *a);
 	int (*vidioc_s_modulator)      (struct file *file, void *fh,
 					struct v4l2_modulator *a);
-	/* Crop ioctls */
+	
 	int (*vidioc_cropcap)          (struct file *file, void *fh,
 					struct v4l2_cropcap *a);
 	int (*vidioc_g_crop)           (struct file *file, void *fh,
 					struct v4l2_crop *a);
 	int (*vidioc_s_crop)           (struct file *file, void *fh,
 					struct v4l2_crop *a);
-	int (*vidioc_g_selection)      (struct file *file, void *fh,
-					struct v4l2_selection *s);
-	int (*vidioc_s_selection)      (struct file *file, void *fh,
-					struct v4l2_selection *s);
-	/* Compression ioctls */
+	
 	int (*vidioc_g_jpegcomp)       (struct file *file, void *fh,
 					struct v4l2_jpegcompression *a);
 	int (*vidioc_s_jpegcomp)       (struct file *file, void *fh,
@@ -210,18 +194,14 @@
 					struct v4l2_encoder_cmd *a);
 	int (*vidioc_try_encoder_cmd)  (struct file *file, void *fh,
 					struct v4l2_encoder_cmd *a);
-	int (*vidioc_decoder_cmd)      (struct file *file, void *fh,
-					struct v4l2_decoder_cmd *a);
-	int (*vidioc_try_decoder_cmd)  (struct file *file, void *fh,
-					struct v4l2_decoder_cmd *a);
 
-	/* Stream type-dependent parameter ioctls */
+	
 	int (*vidioc_g_parm)           (struct file *file, void *fh,
 					struct v4l2_streamparm *a);
 	int (*vidioc_s_parm)           (struct file *file, void *fh,
 					struct v4l2_streamparm *a);
 
-	/* Tuner ioctls */
+	
 	int (*vidioc_g_tuner)          (struct file *file, void *fh,
 					struct v4l2_tuner *a);
 	int (*vidioc_s_tuner)          (struct file *file, void *fh,
@@ -231,17 +211,17 @@
 	int (*vidioc_s_frequency)      (struct file *file, void *fh,
 					struct v4l2_frequency *a);
 
-	/* Sliced VBI cap */
+	
 	int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh,
 					struct v4l2_sliced_vbi_cap *a);
 
-	/* Log status ioctl */
+	
 	int (*vidioc_log_status)       (struct file *file, void *fh);
 
 	int (*vidioc_s_hw_freq_seek)   (struct file *file, void *fh,
 					struct v4l2_hw_freq_seek *a);
 
-	/* Debugging ioctls */
+	
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 	int (*vidioc_g_register)       (struct file *file, void *fh,
 					struct v4l2_dbg_register *reg);
@@ -257,7 +237,7 @@
 	int (*vidioc_enum_frameintervals) (struct file *file, void *fh,
 					   struct v4l2_frmivalenum *fival);
 
-	/* DV Timings IOCTLs */
+	
 	int (*vidioc_enum_dv_presets) (struct file *file, void *fh,
 				       struct v4l2_dv_enum_preset *preset);
 
@@ -277,47 +257,38 @@
 	int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
 					struct v4l2_event_subscription *sub);
 
-	/* For other private ioctls */
+	
 	long (*vidioc_default)	       (struct file *file, void *fh,
 					bool valid_prio, int cmd, void *arg);
 };
 
 
-/* v4l debugging and diagnostics */
 
-/* Debug bitmask flags to be used on V4L2 */
 #define V4L2_DEBUG_IOCTL     0x01
 #define V4L2_DEBUG_IOCTL_ARG 0x02
 
-/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
 #define v4l_print_ioctl(name, cmd)  		 \
 	do {  					 \
 		printk(KERN_DEBUG "%s: ", name); \
 		v4l_printk_ioctl(cmd);		 \
 	} while (0)
 
-/* Use this macro in I2C drivers where 'client' is the struct i2c_client
-   pointer */
 #define v4l_i2c_print_ioctl(client, cmd) 		   \
 	do {      					   \
 		v4l_client_printk(KERN_DEBUG, client, ""); \
 		v4l_printk_ioctl(cmd);			   \
 	} while (0)
 
-/*  Video standard functions  */
 extern const char *v4l2_norm_to_name(v4l2_std_id id);
 extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
 extern int v4l2_video_std_construct(struct v4l2_standard *vs,
 				    int id, const char *name);
-/* Prints the ioctl in a human-readable format */
 extern void v4l_printk_ioctl(unsigned int cmd);
 
-/* names for fancy debug output */
 extern const char *v4l2_field_names[];
 extern const char *v4l2_type_names[];
 
 #ifdef CONFIG_COMPAT
-/* 32 Bits compatibility layer for 64 bits processors */
 extern long v4l2_compat_ioctl32(struct file *file, unsigned int cmd,
 				unsigned long arg);
 #endif
@@ -325,12 +296,10 @@
 typedef long (*v4l2_kioctl)(struct file *file,
 		unsigned int cmd, void *arg);
 
-/* Include support for obsoleted stuff */
 extern long video_usercopy(struct file *file, unsigned int cmd,
 				unsigned long arg, v4l2_kioctl func);
 
-/* Standard handlers for V4L ioctl's */
 extern long video_ioctl2(struct file *file,
 			unsigned int cmd, unsigned long arg);
 
-#endif /* _V4L2_IOCTL_H */
+#endif 
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 83ae07e..971c7fa 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -13,77 +13,6 @@
 
 #include <linux/v4l2-mediabus.h>
 
-/* Parallel flags */
-/*
- * Can the client run in master or in slave mode. By "Master mode" an operation
- * mode is meant, when the client (e.g., a camera sensor) is producing
- * horizontal and vertical synchronisation. In "Slave mode" the host is
- * providing these signals to the slave.
- */
-#define V4L2_MBUS_MASTER			(1 << 0)
-#define V4L2_MBUS_SLAVE				(1 << 1)
-/*
- * Signal polarity flags
- * Note: in BT.656 mode HSYNC, FIELD, and VSYNC are unused
- * V4L2_MBUS_[HV]SYNC* flags should be also used for specifying
- * configuration of hardware that uses [HV]REF signals
- */
-#define V4L2_MBUS_HSYNC_ACTIVE_HIGH		(1 << 2)
-#define V4L2_MBUS_HSYNC_ACTIVE_LOW		(1 << 3)
-#define V4L2_MBUS_VSYNC_ACTIVE_HIGH		(1 << 4)
-#define V4L2_MBUS_VSYNC_ACTIVE_LOW		(1 << 5)
-#define V4L2_MBUS_PCLK_SAMPLE_RISING		(1 << 6)
-#define V4L2_MBUS_PCLK_SAMPLE_FALLING		(1 << 7)
-#define V4L2_MBUS_DATA_ACTIVE_HIGH		(1 << 8)
-#define V4L2_MBUS_DATA_ACTIVE_LOW		(1 << 9)
-/* FIELD = 0/1 - Field1 (odd)/Field2 (even) */
-#define V4L2_MBUS_FIELD_EVEN_HIGH		(1 << 10)
-/* FIELD = 1/0 - Field1 (odd)/Field2 (even) */
-#define V4L2_MBUS_FIELD_EVEN_LOW		(1 << 11)
-
-/* Serial flags */
-/* How many lanes the client can use */
-#define V4L2_MBUS_CSI2_1_LANE			(1 << 0)
-#define V4L2_MBUS_CSI2_2_LANE			(1 << 1)
-#define V4L2_MBUS_CSI2_3_LANE			(1 << 2)
-#define V4L2_MBUS_CSI2_4_LANE			(1 << 3)
-/* On which channels it can send video data */
-#define V4L2_MBUS_CSI2_CHANNEL_0		(1 << 4)
-#define V4L2_MBUS_CSI2_CHANNEL_1		(1 << 5)
-#define V4L2_MBUS_CSI2_CHANNEL_2		(1 << 6)
-#define V4L2_MBUS_CSI2_CHANNEL_3		(1 << 7)
-/* Does it support only continuous or also non-continuous clock mode */
-#define V4L2_MBUS_CSI2_CONTINUOUS_CLOCK		(1 << 8)
-#define V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK	(1 << 9)
-
-#define V4L2_MBUS_CSI2_LANES		(V4L2_MBUS_CSI2_1_LANE | V4L2_MBUS_CSI2_2_LANE | \
-					 V4L2_MBUS_CSI2_3_LANE | V4L2_MBUS_CSI2_4_LANE)
-#define V4L2_MBUS_CSI2_CHANNELS		(V4L2_MBUS_CSI2_CHANNEL_0 | V4L2_MBUS_CSI2_CHANNEL_1 | \
-					 V4L2_MBUS_CSI2_CHANNEL_2 | V4L2_MBUS_CSI2_CHANNEL_3)
-
-/**
- * v4l2_mbus_type - media bus type
- * @V4L2_MBUS_PARALLEL:	parallel interface with hsync and vsync
- * @V4L2_MBUS_BT656:	parallel interface with embedded synchronisation, can
- *			also be used for BT.1120
- * @V4L2_MBUS_CSI2:	MIPI CSI-2 serial interface
- */
-enum v4l2_mbus_type {
-	V4L2_MBUS_PARALLEL,
-	V4L2_MBUS_BT656,
-	V4L2_MBUS_CSI2,
-};
-
-/**
- * v4l2_mbus_config - media bus configuration
- * @type:	in: interface type
- * @flags:	in / out: configuration flags, depending on @type
- */
-struct v4l2_mbus_config {
-	enum v4l2_mbus_type type;
-	unsigned int flags;
-};
-
 static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt,
 				const struct v4l2_mbus_framefmt *mbus_fmt)
 {
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index f0f3358..defd4bc 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -28,7 +28,6 @@
 #include <media/v4l2-fh.h>
 #include <media/v4l2-mediabus.h>
 
-/* generic v4l2_device notify callback notification values */
 #define V4L2_SUBDEV_IR_RX_NOTIFY		_IOW('v', 0, u32)
 #define V4L2_SUBDEV_IR_RX_FIFO_SERVICE_REQ	0x00000001
 #define V4L2_SUBDEV_IR_RX_END_OF_RX_DETECTED	0x00000002
@@ -46,102 +45,29 @@
 struct v4l2_subdev_fh;
 struct tuner_setup;
 
-/* decode_vbi_line */
 struct v4l2_decode_vbi_line {
-	u32 is_second_field;	/* Set to 0 for the first (odd) field,
-				   set to 1 for the second (even) field. */
-	u8 *p; 			/* Pointer to the sliced VBI data from the decoder.
-				   On exit points to the start of the payload. */
-	u32 line;		/* Line number of the sliced VBI data (1-23) */
-	u32 type;		/* VBI service type (V4L2_SLICED_*). 0 if no service found */
+	u32 is_second_field;	
+	u8 *p; 			
+	u32 line;		
+	u32 type;		
 };
 
-/* Sub-devices are devices that are connected somehow to the main bridge
-   device. These devices are usually audio/video muxers/encoders/decoders or
-   sensors and webcam controllers.
 
-   Usually these devices are controlled through an i2c bus, but other busses
-   may also be used.
 
-   The v4l2_subdev struct provides a way of accessing these devices in a
-   generic manner. Most operations that these sub-devices support fall in
-   a few categories: core ops, audio ops, video ops and tuner ops.
-
-   More categories can be added if needed, although this should remain a
-   limited set (no more than approx. 8 categories).
-
-   Each category has its own set of ops that subdev drivers can implement.
-
-   A subdev driver can leave the pointer to the category ops NULL if
-   it does not implement them (e.g. an audio subdev will generally not
-   implement the video category ops). The exception is the core category:
-   this must always be present.
-
-   These ops are all used internally so it is no problem to change, remove
-   or add ops or move ops from one to another category. Currently these
-   ops are based on the original ioctls, but since ops are not limited to
-   one argument there is room for improvement here once all i2c subdev
-   drivers are converted to use these ops.
- */
-
-/* Core ops: it is highly recommended to implement at least these ops:
-
-   g_chip_ident
-   log_status
-   g_register
-   s_register
-
-   This provides basic debugging support.
-
-   The ioctl ops is meant for generic ioctl-like commands. Depending on
-   the use-case it might be better to use subdev-specific ops (currently
-   not yet implemented) since ops provide proper type-checking.
- */
-
-/* Subdevice external IO pin configuration */
-#define V4L2_SUBDEV_IO_PIN_DISABLE	(1 << 0) /* ENABLE assumed */
+#define V4L2_SUBDEV_IO_PIN_DISABLE	(1 << 0) 
 #define V4L2_SUBDEV_IO_PIN_OUTPUT	(1 << 1)
 #define V4L2_SUBDEV_IO_PIN_INPUT	(1 << 2)
-#define V4L2_SUBDEV_IO_PIN_SET_VALUE	(1 << 3) /* Set output value */
-#define V4L2_SUBDEV_IO_PIN_ACTIVE_LOW	(1 << 4) /* ACTIVE HIGH assumed */
+#define V4L2_SUBDEV_IO_PIN_SET_VALUE	(1 << 3) 
+#define V4L2_SUBDEV_IO_PIN_ACTIVE_LOW	(1 << 4) 
 
 struct v4l2_subdev_io_pin_config {
-	u32 flags;	/* V4L2_SUBDEV_IO_PIN_* flags for this pin's config */
-	u8 pin;		/* Chip external IO pin to configure */
-	u8 function;	/* Internal signal pad/function to route to IO pin */
-	u8 value;	/* Initial value for pin - e.g. GPIO output value */
-	u8 strength;	/* Pin drive strength */
+	u32 flags;	
+	u8 pin;		
+	u8 function;	
+	u8 value;	
+	u8 strength;	
 };
 
-/*
-   s_io_pin_config: configure one or more chip I/O pins for chips that
-	multiplex different internal signal pads out to IO pins.  This function
-	takes a pointer to an array of 'n' pin configuration entries, one for
-	each pin being configured.  This function could be called at times
-	other than just subdevice initialization.
-
-   init: initialize the sensor registors to some sort of reasonable default
-	values. Do not use for new drivers and should be removed in existing
-	drivers.
-
-   load_fw: load firmware.
-
-   reset: generic reset command. The argument selects which subsystems to
-	reset. Passing 0 will always reset the whole chip. Do not use for new
-	drivers without discussing this first on the linux-media mailinglist.
-	There should be no reason normally to reset a device.
-
-   s_gpio: set GPIO pins. Very simple right now, might need to be extended with
-	a direction argument if needed.
-
-   s_power: puts subdevice in power saving mode (on == 0) or normal operation
-	mode (on == 1).
-
-   interrupt_service_routine: Called by the bridge chip's interrupt service
-	handler, when an interrupt status has be raised due to this subdev,
-	so that this subdev can handle the details.  It may schedule work to be
-	performed later.  It must not sleep.  *Called from an IRQ context*.
- */
 struct v4l2_subdev_core_ops {
 	int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
 	int (*log_status)(struct v4l2_subdev *sd);
@@ -158,7 +84,6 @@
 	int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
 	int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
 	int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
-	int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm);
 	int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
 	long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
 #ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -174,19 +99,6 @@
 				 struct v4l2_event_subscription *sub);
 };
 
-/* s_radio: v4l device was opened in radio mode.
-
-   g_frequency: freq->type must be filled in. Normally done by video_ioctl2
-	or the bridge driver.
-
-   g_tuner:
-   s_tuner: vt->type must be filled in. Normally done by video_ioctl2 or the
-	bridge driver.
-
-   s_type_addr: sets tuner type and its I2C addr.
-
-   s_config: sets tda9887 specific stuff, like port1, port2 and qss
- */
 struct v4l2_subdev_tuner_ops {
 	int (*s_radio)(struct v4l2_subdev *sd);
 	int (*s_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
@@ -199,26 +111,6 @@
 	int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
 };
 
-/* s_clock_freq: set the frequency (in Hz) of the audio clock output.
-	Used to slave an audio processor to the video decoder, ensuring that
-	audio and video remain synchronized. Usual values for the frequency
-	are 48000, 44100 or 32000 Hz. If the frequency is not supported, then
-	-EINVAL is returned.
-
-   s_i2s_clock_freq: sets I2S speed in bps. This is used to provide a standard
-	way to select I2S clock used by driving digital audio streams at some
-	board designs. Usual values for the frequency are 1024000 and 2048000.
-	If the frequency is not supported, then -EINVAL is returned.
-
-   s_routing: used to define the input and/or output pins of an audio chip,
-	and any additional configuration data.
-	Never attempt to use user-level input IDs (e.g. Composite, S-Video,
-	Tuner) at this level. An i2c device shouldn't know about whether an
-	input pin is connected to a Composite connector, become on another
-	board or platform it might be connected to something else entirely.
-	The calling driver is responsible for mapping a user-level input to
-	the right pins on the i2c device.
- */
 struct v4l2_subdev_audio_ops {
 	int (*s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
 	int (*s_i2s_clock_freq)(struct v4l2_subdev *sd, u32 freq);
@@ -226,62 +118,11 @@
 	int (*s_stream)(struct v4l2_subdev *sd, int enable);
 };
 
-/*
-   s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
-	video input devices.
-
-   g_std_output: get current standard for video OUTPUT devices. This is ignored
-	by video input devices.
-
-   g_tvnorms_output: get v4l2_std_id with all standards supported by video
-	OUTPUT device. This is ignored by video input devices.
-
-   s_crystal_freq: sets the frequency of the crystal used to generate the
-	clocks in Hz. An extra flags field allows device specific configuration
-	regarding clock frequency dividers, etc. If not used, then set flags
-	to 0. If the frequency is not supported, then -EINVAL is returned.
-
-   g_input_status: get input status. Same as the status field in the v4l2_input
-	struct.
-
-   s_routing: see s_routing in audio_ops, except this version is for video
-	devices.
-
-   s_dv_preset: set dv (Digital Video) preset in the sub device. Similar to
-	s_std()
-
-   g_dv_preset: get current dv (Digital Video) preset in the sub device.
-
-   query_dv_preset: query dv preset in the sub device. This is similar to
-	querystd()
-
-   s_dv_timings(): Set custom dv timings in the sub device. This is used
-	when sub device is capable of setting detailed timing information
-	in the hardware to generate/detect the video signal.
-
-   g_dv_timings(): Get custom dv timings in the sub device.
-
-   enum_mbus_fmt: enumerate pixel formats, provided by a video data source
-
-   g_mbus_fmt: get the current pixel format, provided by a video data source
-
-   try_mbus_fmt: try to set a pixel format on a video data source
-
-   s_mbus_fmt: set a pixel format on a video data source
-
-   g_mbus_config: get supported mediabus configurations
-
-   s_mbus_config: set a certain mediabus configuration. This operation is added
-	for compatibility with soc-camera drivers and should not be used by new
-	software.
- */
 struct v4l2_subdev_video_ops {
 	int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
 	int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
 	int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
-	int (*g_std_output)(struct v4l2_subdev *sd, v4l2_std_id *std);
 	int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
-	int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std);
 	int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
 	int (*s_stream)(struct v4l2_subdev *sd, int enable);
 	int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc);
@@ -299,8 +140,6 @@
 			struct v4l2_dv_enum_preset *preset);
 	int (*s_dv_preset)(struct v4l2_subdev *sd,
 			struct v4l2_dv_preset *preset);
-	int (*g_dv_preset)(struct v4l2_subdev *sd,
-			struct v4l2_dv_preset *preset);
 	int (*query_dv_preset)(struct v4l2_subdev *sd,
 			struct v4l2_dv_preset *preset);
 	int (*s_dv_timings)(struct v4l2_subdev *sd,
@@ -317,41 +156,8 @@
 			    struct v4l2_mbus_framefmt *fmt);
 	int (*s_mbus_fmt)(struct v4l2_subdev *sd,
 			  struct v4l2_mbus_framefmt *fmt);
-	int (*g_mbus_config)(struct v4l2_subdev *sd,
-			     struct v4l2_mbus_config *cfg);
-	int (*s_mbus_config)(struct v4l2_subdev *sd,
-			     const struct v4l2_mbus_config *cfg);
 };
 
-/*
-   decode_vbi_line: video decoders that support sliced VBI need to implement
-	this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the
-	start of the VBI data that was generated by the decoder. The driver
-	then parses the sliced VBI data and sets the other fields in the
-	struct accordingly. The pointer p is updated to point to the start of
-	the payload which can be copied verbatim into the data field of the
-	v4l2_sliced_vbi_data struct. If no valid VBI data was found, then the
-	type field is set to 0 on return.
-
-   s_vbi_data: used to generate VBI signals on a video signal.
-	v4l2_sliced_vbi_data is filled with the data packets that should be
-	output. Note that if you set the line field to 0, then that VBI signal
-	is disabled. If no valid VBI data was found, then the type field is
-	set to 0 on return.
-
-   g_vbi_data: used to obtain the sliced VBI packet from a readback register.
-	Not all video decoders support this. If no data is available because
-	the readback register contains invalid or erroneous data -EIO is
-	returned. Note that you must fill in the 'id' member and the 'field'
-	member (to determine whether CC data from the first or second field
-	should be obtained).
-
-   s_raw_fmt: setup the video encoder/decoder for raw VBI.
-
-   g_sliced_fmt: retrieve the current sliced VBI settings.
-
-   s_sliced_fmt: setup the sliced VBI settings.
- */
 struct v4l2_subdev_vbi_ops {
 	int (*decode_vbi_line)(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi_line);
 	int (*s_vbi_data)(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *vbi_data);
@@ -362,75 +168,43 @@
 	int (*s_sliced_fmt)(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *fmt);
 };
 
-/**
- * struct v4l2_subdev_sensor_ops - v4l2-subdev sensor operations
- * @g_skip_top_lines: number of lines at the top of the image to be skipped.
- *		      This is needed for some sensors, which always corrupt
- *		      several top lines of the output image, or which send their
- *		      metadata in them.
- * @g_skip_frames: number of frames to skip at stream start. This is needed for
- *		   buggy sensors that generate faulty frames when they are
- *		   turned on.
- */
 struct v4l2_subdev_sensor_ops {
 	int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines);
 	int (*g_skip_frames)(struct v4l2_subdev *sd, u32 *frames);
 };
 
-/*
-   [rt]x_g_parameters: Get the current operating parameters and state of the
-	the IR receiver or transmitter.
-
-   [rt]x_s_parameters: Set the current operating parameters and state of the
-	the IR receiver or transmitter.  It is recommended to call
-	[rt]x_g_parameters first to fill out the current state, and only change
-	the fields that need to be changed.  Upon return, the actual device
-	operating parameters and state will be returned.  Note that hardware
-	limitations may prevent the actual settings from matching the requested
-	settings - e.g. an actual carrier setting of 35,904 Hz when 36,000 Hz
-	was requested.  An exception is when the shutdown parameter is true.
-	The last used operational parameters will be returned, but the actual
-	state of the hardware be different to minimize power consumption and
-	processing when shutdown is true.
-
-   rx_read: Reads received codes or pulse width data.
-	The semantics are similar to a non-blocking read() call.
-
-   tx_write: Writes codes or pulse width data for transmission.
-	The semantics are similar to a non-blocking write() call.
- */
 
 enum v4l2_subdev_ir_mode {
-	V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* uses struct ir_raw_event records */
+	V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, 
 };
 
 struct v4l2_subdev_ir_parameters {
-	/* Either Rx or Tx */
-	unsigned int bytes_per_data_element; /* of data in read or write call */
+	
+	unsigned int bytes_per_data_element; 
 	enum v4l2_subdev_ir_mode mode;
 
 	bool enable;
 	bool interrupt_enable;
-	bool shutdown; /* true: set hardware to low/no power, false: normal */
+	bool shutdown; 
 
-	bool modulation;           /* true: uses carrier, false: baseband */
-	u32 max_pulse_width;       /* ns,      valid only for baseband signal */
-	unsigned int carrier_freq; /* Hz,      valid only for modulated signal*/
-	unsigned int duty_cycle;   /* percent, valid only for modulated signal*/
-	bool invert_level;	   /* invert signal level */
+	bool modulation;           
+	u32 max_pulse_width;       
+	unsigned int carrier_freq; 
+	unsigned int duty_cycle;   
+	bool invert_level;	   
 
-	/* Tx only */
-	bool invert_carrier_sense; /* Send 0/space as a carrier burst */
+	
+	bool invert_carrier_sense; 
 
-	/* Rx only */
-	u32 noise_filter_min_width;       /* ns, min time of a valid pulse */
-	unsigned int carrier_range_lower; /* Hz, valid only for modulated sig */
-	unsigned int carrier_range_upper; /* Hz, valid only for modulated sig */
-	u32 resolution;                   /* ns */
+	
+	u32 noise_filter_min_width;       
+	unsigned int carrier_range_lower; 
+	unsigned int carrier_range_upper; 
+	u32 resolution;                   
 };
 
 struct v4l2_subdev_ir_ops {
-	/* Receiver */
+	
 	int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count,
 				ssize_t *num);
 
@@ -439,7 +213,7 @@
 	int (*rx_s_parameters)(struct v4l2_subdev *sd,
 				struct v4l2_subdev_ir_parameters *params);
 
-	/* Transmitter */
+	
 	int (*tx_write)(struct v4l2_subdev *sd, u8 *buf, size_t count,
 				ssize_t *num);
 
@@ -479,20 +253,6 @@
 	const struct v4l2_subdev_pad_ops	*pad;
 };
 
-/*
- * Internal ops. Never call this from drivers, only the v4l2 framework can call
- * these ops.
- *
- * registered: called when this subdev is registered. When called the v4l2_dev
- *	field is set to the correct v4l2_device.
- *
- * unregistered: called when this subdev is unregistered. When called the
- *	v4l2_dev field is still set to the correct v4l2_device.
- *
- * open: called when the subdev device node is opened by an application.
- *
- * close: called when the subdev device node is closed.
- */
 struct v4l2_subdev_internal_ops {
 	int (*registered)(struct v4l2_subdev *sd);
 	void (*unregistered)(struct v4l2_subdev *sd);
@@ -502,18 +262,11 @@
 
 #define V4L2_SUBDEV_NAME_SIZE 32
 
-/* Set this flag if this subdev is a i2c device. */
 #define V4L2_SUBDEV_FL_IS_I2C			(1U << 0)
-/* Set this flag if this subdev is a spi device. */
 #define V4L2_SUBDEV_FL_IS_SPI			(1U << 1)
-/* Set this flag if this subdev needs a device node. */
 #define V4L2_SUBDEV_FL_HAS_DEVNODE		(1U << 2)
-/* Set this flag if this subdev generates events. */
 #define V4L2_SUBDEV_FL_HAS_EVENTS		(1U << 3)
 
-/* Each instance of a subdev driver should create this struct, either
-   stand-alone or embedded in a larger struct.
- */
 struct v4l2_subdev {
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	struct media_entity entity;
@@ -523,29 +276,28 @@
 	u32 flags;
 	struct v4l2_device *v4l2_dev;
 	const struct v4l2_subdev_ops *ops;
-	/* Never call these internal ops from within a driver! */
+	
 	const struct v4l2_subdev_internal_ops *internal_ops;
-	/* The control handler of this subdev. May be NULL. */
+	
 	struct v4l2_ctrl_handler *ctrl_handler;
-	/* name must be unique */
+	
 	char name[V4L2_SUBDEV_NAME_SIZE];
-	/* can be used to group similar subdevs, value is driver-specific */
+	
 	u32 grp_id;
-	/* pointer to private data */
+	
 	void *dev_priv;
 	void *host_priv;
-	/* subdev device node */
-	struct video_device *devnode;
+	
+	struct video_device devnode;
+	
+	unsigned int nevents;
 };
 
 #define media_entity_to_v4l2_subdev(ent) \
 	container_of(ent, struct v4l2_subdev, entity)
 #define vdev_to_v4l2_subdev(vdev) \
-	video_get_drvdata(vdev)
+	container_of(vdev, struct v4l2_subdev, devnode)
 
-/*
- * Used for storing subdev information per file handle
- */
 struct v4l2_subdev_fh {
 	struct v4l2_fh vfh;
 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
@@ -596,16 +348,10 @@
 void v4l2_subdev_init(struct v4l2_subdev *sd,
 		      const struct v4l2_subdev_ops *ops);
 
-/* Call an ops of a v4l2_subdev, doing the right checks against
-   NULL pointers.
-
-   Example: err = v4l2_subdev_call(sd, core, g_chip_ident, &chip);
- */
 #define v4l2_subdev_call(sd, o, f, args...)				\
-	(!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ?	\
+	(!(sd) ? -ENODEV : (((sd)->ops && (sd)->ops->o && (sd)->ops->o->f) ?	\
 		(sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD))
 
-/* Send a notification to v4l2_device. */
 #define v4l2_subdev_notify(sd, notification, arg)			   \
 	((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \
 	 (sd)->v4l2_dev->notify((sd), (notification), (arg)))
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 2918b94..08680c8 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -20,43 +20,6 @@
 struct vb2_alloc_ctx;
 struct vb2_fileio_data;
 
-/**
- * struct vb2_mem_ops - memory handling/memory allocator operations
- * @alloc:	allocate video memory and, optionally, allocator private data,
- *		return NULL on failure or a pointer to allocator private,
- *		per-buffer data on success; the returned private structure
- *		will then be passed as buf_priv argument to other ops in this
- *		structure
- * @put:	inform the allocator that the buffer will no longer be used;
- *		usually will result in the allocator freeing the buffer (if
- *		no other users of this buffer are present); the buf_priv
- *		argument is the allocator private per-buffer structure
- *		previously returned from the alloc callback
- * @get_userptr: acquire userspace memory for a hardware operation; used for
- *		 USERPTR memory types; vaddr is the address passed to the
- *		 videobuf layer when queuing a video buffer of USERPTR type;
- *		 should return an allocator private per-buffer structure
- *		 associated with the buffer on success, NULL on failure;
- *		 the returned private structure will then be passed as buf_priv
- *		 argument to other ops in this structure
- * @put_userptr: inform the allocator that a USERPTR buffer will no longer
- *		 be used
- * @vaddr:	return a kernel virtual address to a given memory buffer
- *		associated with the passed private structure or NULL if no
- *		such mapping exists
- * @cookie:	return allocator specific cookie for a given memory buffer
- *		associated with the passed private structure or NULL if not
- *		available
- * @num_users:	return the current number of users of a memory buffer;
- *		return 1 if the videobuf layer (or actually the driver using
- *		it) is the only user
- * @mmap:	setup a userspace mapping for a given memory buffer under
- *		the provided virtual memory region
- *
- * Required ops for USERPTR types: get_userptr, put_userptr.
- * Required ops for MMAP types: alloc, put, num_users, mmap.
- * Required ops for read/write access types: alloc, put, num_users, vaddr
- */
 struct vb2_mem_ops {
 	void		*(*alloc)(void *alloc_ctx, unsigned long size);
 	void		(*put)(void *buf_priv);
@@ -75,15 +38,9 @@
 
 struct vb2_plane {
 	void			*mem_priv;
+	int			mapped:1;
 };
 
-/**
- * enum vb2_io_modes - queue access methods
- * @VB2_MMAP:		driver supports MMAP with streaming API
- * @VB2_USERPTR:	driver supports USERPTR with streaming API
- * @VB2_READ:		driver supports read() style access
- * @VB2_WRITE:		driver supports write() style access
- */
 enum vb2_io_modes {
 	VB2_MMAP	= (1 << 0),
 	VB2_USERPTR	= (1 << 1),
@@ -91,33 +48,13 @@
 	VB2_WRITE	= (1 << 3),
 };
 
-/**
- * enum vb2_fileio_flags - flags for selecting a mode of the file io emulator,
- * by default the 'streaming' style is used by the file io emulator
- * @VB2_FILEIO_READ_ONCE:	report EOF after reading the first buffer
- * @VB2_FILEIO_WRITE_IMMEDIATELY:	queue buffer after each write() call
- */
 enum vb2_fileio_flags {
 	VB2_FILEIO_READ_ONCE		= (1 << 0),
 	VB2_FILEIO_WRITE_IMMEDIATELY	= (1 << 1),
 };
 
-/**
- * enum vb2_buffer_state - current video buffer state
- * @VB2_BUF_STATE_DEQUEUED:	buffer under userspace control
- * @VB2_BUF_STATE_PREPARED:	buffer prepared in videobuf and by the driver
- * @VB2_BUF_STATE_QUEUED:	buffer queued in videobuf, but not in driver
- * @VB2_BUF_STATE_ACTIVE:	buffer queued in driver and possibly used
- *				in a hardware operation
- * @VB2_BUF_STATE_DONE:		buffer returned from driver to videobuf, but
- *				not yet dequeued to userspace
- * @VB2_BUF_STATE_ERROR:	same as above, but the operation on the buffer
- *				has ended with an error, which will be reported
- *				to the userspace when it is dequeued
- */
 enum vb2_buffer_state {
 	VB2_BUF_STATE_DEQUEUED,
-	VB2_BUF_STATE_PREPARED,
 	VB2_BUF_STATE_QUEUED,
 	VB2_BUF_STATE_ACTIVE,
 	VB2_BUF_STATE_DONE,
@@ -126,29 +63,6 @@
 
 struct vb2_queue;
 
-/**
- * struct vb2_buffer - represents a video buffer
- * @v4l2_buf:		struct v4l2_buffer associated with this buffer; can
- *			be read by the driver and relevant entries can be
- *			changed by the driver in case of CAPTURE types
- *			(such as timestamp)
- * @v4l2_planes:	struct v4l2_planes associated with this buffer; can
- *			be read by the driver and relevant entries can be
- *			changed by the driver in case of CAPTURE types
- *			(such as bytesused); NOTE that even for single-planar
- *			types, the v4l2_planes[0] struct should be used
- *			instead of v4l2_buf for filling bytesused - drivers
- *			should use the vb2_set_plane_payload() function for that
- * @vb2_queue:		the queue to which this driver belongs
- * @num_planes:		number of planes in the buffer
- *			on an internal driver queue
- * @state:		current buffer state; do not change
- * @queued_entry:	entry on the queued buffers list, which holds all
- *			buffers queued from userspace
- * @done_entry:		entry on the list that stores all buffers ready to
- *			be dequeued to userspace
- * @planes:		private per-plane information; do not change
- */
 struct vb2_buffer {
 	struct v4l2_buffer	v4l2_buf;
 	struct v4l2_plane	v4l2_planes[VIDEO_MAX_PLANES];
@@ -157,78 +71,19 @@
 
 	unsigned int		num_planes;
 
-/* Private: internal use only */
 	enum vb2_buffer_state	state;
 
 	struct list_head	queued_entry;
 	struct list_head	done_entry;
 
 	struct vb2_plane	planes[VIDEO_MAX_PLANES];
+	unsigned int		num_planes_mapped;
 };
 
-/**
- * struct vb2_ops - driver-specific callbacks
- *
- * @queue_setup:	called from VIDIOC_REQBUFS and VIDIOC_CREATE_BUFS
- *			handlers before memory allocation, or, if
- *			*num_planes != 0, after the allocation to verify a
- *			smaller number of buffers. Driver should return
- *			the required number of buffers in *num_buffers, the
- *			required number of planes per buffer in *num_planes; the
- *			size of each plane should be set in the sizes[] array
- *			and optional per-plane allocator specific context in the
- *			alloc_ctxs[] array. When called from VIDIOC_REQBUFS,
- *			fmt == NULL, the driver has to use the currently
- *			configured format and *num_buffers is the total number
- *			of buffers, that are being allocated. When called from
- *			VIDIOC_CREATE_BUFS, fmt != NULL and it describes the
- *			target frame format. In this case *num_buffers are being
- *			allocated additionally to q->num_buffers.
- * @wait_prepare:	release any locks taken while calling vb2 functions;
- *			it is called before an ioctl needs to wait for a new
- *			buffer to arrive; required to avoid a deadlock in
- *			blocking access type
- * @wait_finish:	reacquire all locks released in the previous callback;
- *			required to continue operation after sleeping while
- *			waiting for a new buffer to arrive
- * @buf_init:		called once after allocating a buffer (in MMAP case)
- *			or after acquiring a new USERPTR buffer; drivers may
- *			perform additional buffer-related initialization;
- *			initialization failure (return != 0) will prevent
- *			queue setup from completing successfully; optional
- * @buf_prepare:	called every time the buffer is queued from userspace
- *			and from the VIDIOC_PREPARE_BUF ioctl; drivers may
- *			perform any initialization required before each hardware
- *			operation in this callback; if an error is returned, the
- *			buffer will not be queued in driver; optional
- * @buf_finish:		called before every dequeue of the buffer back to
- *			userspace; drivers may perform any operations required
- *			before userspace accesses the buffer; optional
- * @buf_cleanup:	called once before the buffer is freed; drivers may
- *			perform any additional cleanup; optional
- * @start_streaming:	called once to enter 'streaming' state; the driver may
- *			receive buffers with @buf_queue callback before
- *			@start_streaming is called; the driver gets the number
- *			of already queued buffers in count parameter; driver
- *			can return an error if hardware fails or not enough
- *			buffers has been queued, in such case all buffers that
- *			have been already given by the @buf_queue callback are
- *			invalidated.
- * @stop_streaming:	called when 'streaming' state must be disabled; driver
- *			should stop any DMA transactions or wait until they
- *			finish and give back all buffers it got from buf_queue()
- *			callback; may use vb2_wait_for_all_buffers() function
- * @buf_queue:		passes buffer vb to the driver; driver may start
- *			hardware operation on this buffer; driver should give
- *			the buffer back by calling vb2_buffer_done() function;
- *			it is allways called after calling STREAMON ioctl;
- *			might be called before start_streaming callback if user
- *			pre-queued buffers before calling STREAMON
- */
 struct vb2_ops {
-	int (*queue_setup)(struct vb2_queue *q, const struct v4l2_format *fmt,
-			   unsigned int *num_buffers, unsigned int *num_planes,
-			   unsigned int sizes[], void *alloc_ctxs[]);
+	int (*queue_setup)(struct vb2_queue *q, unsigned int *num_buffers,
+			   unsigned int *num_planes, unsigned long sizes[],
+			   void *alloc_ctxs[]);
 
 	void (*wait_prepare)(struct vb2_queue *q);
 	void (*wait_finish)(struct vb2_queue *q);
@@ -238,37 +93,12 @@
 	int (*buf_finish)(struct vb2_buffer *vb);
 	void (*buf_cleanup)(struct vb2_buffer *vb);
 
-	int (*start_streaming)(struct vb2_queue *q, unsigned int count);
+	int (*start_streaming)(struct vb2_queue *q);
 	int (*stop_streaming)(struct vb2_queue *q);
 
 	void (*buf_queue)(struct vb2_buffer *vb);
 };
 
-/**
- * struct vb2_queue - a videobuf queue
- *
- * @type:	queue type (see V4L2_BUF_TYPE_* in linux/videodev2.h
- * @io_modes:	supported io methods (see vb2_io_modes enum)
- * @io_flags:	additional io flags (see vb2_fileio_flags enum)
- * @ops:	driver-specific callbacks
- * @mem_ops:	memory allocator specific callbacks
- * @drv_priv:	driver private data
- * @buf_struct_size: size of the driver-specific buffer structure;
- *		"0" indicates the driver doesn't want to use a custom buffer
- *		structure type, so sizeof(struct vb2_buffer) will is used
- *
- * @memory:	current memory type used
- * @bufs:	videobuf buffer structures
- * @num_buffers: number of allocated/used buffers
- * @queued_list: list of buffers currently queued from userspace
- * @queued_count: number of buffers owned by the driver
- * @done_list:	list of buffers ready to be dequeued to userspace
- * @done_lock:	lock to protect done_list list
- * @done_wq:	waitqueue for processes waiting for buffers ready to be dequeued
- * @alloc_ctx:	memory type/allocator-specific contexts for each plane
- * @streaming:	current streaming state
- * @fileio:	file io emulator internal data, used only if emulator is active
- */
 struct vb2_queue {
 	enum v4l2_buf_type		type;
 	unsigned int			io_modes;
@@ -279,7 +109,6 @@
 	void				*drv_priv;
 	unsigned int			buf_struct_size;
 
-/* private: internal use only */
 	enum v4l2_memory		memory;
 	struct vb2_buffer		*bufs[VIDEO_MAX_FRAME];
 	unsigned int			num_buffers;
@@ -289,11 +118,9 @@
 	atomic_t			queued_count;
 	struct list_head		done_list;
 	spinlock_t			done_lock;
-	struct mutex		q_lock;
 	wait_queue_head_t		done_wq;
 
 	void				*alloc_ctx[VIDEO_MAX_PLANES];
-	unsigned int			plane_sizes[VIDEO_MAX_PLANES];
 
 	unsigned int			streaming:1;
 
@@ -309,9 +136,6 @@
 int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b);
 int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req);
 
-int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create);
-int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b);
-
 int vb2_queue_init(struct vb2_queue *q);
 
 void vb2_queue_release(struct vb2_queue *q);
@@ -323,54 +147,27 @@
 int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type);
 
 int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma);
-#ifndef CONFIG_MMU
-unsigned long vb2_get_unmapped_area(struct vb2_queue *q,
-				    unsigned long addr,
-				    unsigned long len,
-				    unsigned long pgoff,
-				    unsigned long flags);
-#endif
 unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait);
 size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count,
 		loff_t *ppos, int nonblock);
 size_t vb2_write(struct vb2_queue *q, char __user *data, size_t count,
 		loff_t *ppos, int nonblock);
 
-/**
- * vb2_is_streaming() - return streaming status of the queue
- * @q:		videobuf queue
- */
 static inline bool vb2_is_streaming(struct vb2_queue *q)
 {
 	return q->streaming;
 }
 
-/**
- * vb2_is_busy() - return busy status of the queue
- * @q:		videobuf queue
- *
- * This function checks if queue has any buffers allocated.
- */
 static inline bool vb2_is_busy(struct vb2_queue *q)
 {
 	return (q->num_buffers > 0);
 }
 
-/**
- * vb2_get_drv_priv() - return driver private data associated with the queue
- * @q:		videobuf queue
- */
 static inline void *vb2_get_drv_priv(struct vb2_queue *q)
 {
 	return q->drv_priv;
 }
 
-/**
- * vb2_set_plane_payload() - set bytesused for the plane plane_no
- * @vb:		buffer for which plane payload should be set
- * @plane_no:	plane number for which payload should be set
- * @size:	payload in bytes
- */
 static inline void vb2_set_plane_payload(struct vb2_buffer *vb,
 				 unsigned int plane_no, unsigned long size)
 {
@@ -378,12 +175,6 @@
 		vb->v4l2_planes[plane_no].bytesused = size;
 }
 
-/**
- * vb2_get_plane_payload() - get bytesused for the plane plane_no
- * @vb:		buffer for which plane payload should be set
- * @plane_no:	plane number for which payload should be set
- * @size:	payload in bytes
- */
 static inline unsigned long vb2_get_plane_payload(struct vb2_buffer *vb,
 				 unsigned int plane_no)
 {
@@ -392,11 +183,6 @@
 	return 0;
 }
 
-/**
- * vb2_plane_size() - return plane size in bytes
- * @vb:		buffer for which plane size should be returned
- * @plane_no:	plane number for which size should be returned
- */
 static inline unsigned long
 vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no)
 {
@@ -405,4 +191,4 @@
 	return 0;
 }
 
-#endif /* _MEDIA_VIDEOBUF2_CORE_H */
+#endif 
diff --git a/include/media/videobuf2-dma-contig.h b/include/media/videobuf2-dma-contig.h
index 19ae1e3..7e6c68b 100644
--- a/include/media/videobuf2-dma-contig.h
+++ b/include/media/videobuf2-dma-contig.h
@@ -17,11 +17,11 @@
 #include <linux/dma-mapping.h>
 
 static inline dma_addr_t
-vb2_dma_contig_plane_dma_addr(struct vb2_buffer *vb, unsigned int plane_no)
+vb2_dma_contig_plane_paddr(struct vb2_buffer *vb, unsigned int plane_no)
 {
-	dma_addr_t *addr = vb2_plane_cookie(vb, plane_no);
+	dma_addr_t *paddr = vb2_plane_cookie(vb, plane_no);
 
-	return *addr;
+	return *paddr;
 }
 
 void *vb2_dma_contig_init_ctx(struct device *dev);
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h
index 84e1f6c..ed352f5 100644
--- a/include/media/videobuf2-memops.h
+++ b/include/media/videobuf2-memops.h
@@ -16,12 +16,6 @@
 
 #include <media/videobuf2-core.h>
 
-/**
- * vb2_vmarea_handler - common vma refcount tracking handler
- * @refcount:	pointer to refcount entry in the buffer
- * @put:	callback to function that decreases buffer refcount
- * @arg:	argument for @put callback
- */
 struct vb2_vmarea_handler {
 	atomic_t		*refcount;
 	void			(*put)(void *arg);
diff --git a/include/media/videobuf2-msm-mem.h b/include/media/videobuf2-msm-mem.h
index 49625c4..d23a0f6 100644
--- a/include/media/videobuf2-msm-mem.h
+++ b/include/media/videobuf2-msm-mem.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -16,7 +16,7 @@
 #define _VIDEOBUF2_PMEM_CONTIG_H
 
 #include <media/videobuf2-core.h>
-#include <mach/iommu_domains.h>
+#include <mach/msm_subsystem_map.h>
 #include <linux/msm_ion.h>
 
 struct videobuf2_mapping {
@@ -46,12 +46,12 @@
 	int phyaddr;
 	unsigned long size;
 	int is_userptr;
-	/* Offset of the plane inside the buffer */
+	
 	struct videobuf2_msm_offset offset;
 	enum videobuf2_buffer_type buffer_type;
 	int path;
 	struct file *file;
-	/* Offset of the buffer */
+	
 	uint32_t addr_offset;
 	int dirty;
 	unsigned int count;
@@ -72,11 +72,10 @@
 					struct videobuf2_msm_offset *offset,
 					enum videobuf2_buffer_type,
 					uint32_t addr_offset, int path,
-					struct ion_client *client,
-					int domain_num);
+					struct ion_client *client);
 void videobuf2_pmem_contig_user_put(struct videobuf2_contig_pmem *mem,
-				struct ion_client *client, int domain_num);
+					struct ion_client *client);
 unsigned long videobuf2_to_pmem_contig(struct vb2_buffer *buf,
 					unsigned int plane_no);
 
-#endif /* _VIDEOBUF2_PMEM_CONTIG_H */
+#endif 
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index 9808877..a7a683e 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -42,6 +42,7 @@
 #include <net/netlabel.h>
 #include <net/request_sock.h>
 #include <linux/atomic.h>
+#include <asm/unaligned.h>
 
 /* known doi values */
 #define CIPSO_V4_DOI_UNKNOWN          0x00000000
@@ -285,7 +286,33 @@
 static inline int cipso_v4_validate(const struct sk_buff *skb,
 				    unsigned char **option)
 {
-	return -ENOSYS;
+	unsigned char *opt = *option;
+	unsigned char err_offset = 0;
+	u8 opt_len = opt[1];
+	u8 opt_iter;
+
+	if (opt_len < 8) {
+		err_offset = 1;
+		goto out;
+	}
+
+	if (get_unaligned_be32(&opt[2]) == 0) {
+		err_offset = 2;
+		goto out;
+	}
+
+	for (opt_iter = 6; opt_iter < opt_len;) {
+		if (opt[opt_iter + 1] > (opt_len - opt_iter)) {
+			err_offset = opt_iter + 1;
+			goto out;
+		}
+		opt_iter += opt[opt_iter + 1];
+	}
+
+out:
+	*option = opt + err_offset;
+	return err_offset;
+
 }
 #endif /* CONFIG_NETLABEL */
 
diff --git a/include/net/dst.h b/include/net/dst.h
index bed833d..8197ead 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -60,6 +60,7 @@
 #define DST_NOCOUNT		0x0020
 #define DST_NOPEER		0x0040
 #define DST_FAKE_RTABLE		0x0080
+#define DST_XFRM_TUNNEL		0x0100
 
 	short			error;
 	short			obsolete;
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index b94765e..2040bff 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -40,7 +40,10 @@
 	u32			pmtu_orig;
 	u32			pmtu_learned;
 	struct inetpeer_addr_base redirect_learned;
-	struct list_head	gc_list;
+	union {
+		struct list_head	gc_list;
+		struct rcu_head     gc_rcu;
+	};
 	/*
 	 * Once inet_peer is queued for deletion (refcnt == -1), following fields
 	 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 55ce96b..9d7d54a 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -220,13 +220,16 @@
 
 struct qdisc_skb_cb {
 	unsigned int		pkt_len;
-	unsigned char		data[24];
+	u16			bond_queue_mapping;
+	u16			_pad;
+	unsigned char		data[20];
 };
 
 static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz)
 {
 	struct qdisc_skb_cb *qcb;
-	BUILD_BUG_ON(sizeof(skb->cb) < sizeof(unsigned int) + sz);
+
+	BUILD_BUG_ON(sizeof(skb->cb) < offsetof(struct qdisc_skb_cb, data) + sz);
 	BUILD_BUG_ON(sizeof(qcb->data) < sz);
 }
 
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index f4f1c96..10ce74f 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -163,6 +163,8 @@
         ATAPI_COMMAND_SET = 1,
 };
 
+#define ATA_RESP_FIS_SIZE 24
+
 struct sata_device {
         enum   ata_command_set command_set;
         struct smp_resp        rps_resp; /* report_phy_sata_resp */
@@ -171,7 +173,7 @@
 
 	struct ata_port *ap;
 	struct ata_host ata_host;
-	struct ata_taskfile tf;
+	u8     fis[ATA_RESP_FIS_SIZE];
 };
 
 enum {
@@ -537,7 +539,7 @@
  */
 struct ata_task_resp {
 	u16  frame_len;
-	u8   ending_fis[24];	  /* dev to host or data-in */
+	u8   ending_fis[ATA_RESP_FIS_SIZE];	  /* dev to host or data-in */
 };
 
 #define SAS_STATUS_BUF_SIZE 96
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 1e11985..ac06cc5 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -134,10 +134,16 @@
 
 static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
 {
+	struct scsi_driver **sdp;
+
 	if (!cmd->request->rq_disk)
 		return NULL;
 
-	return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
+	sdp = (struct scsi_driver **)cmd->request->rq_disk->private_data;
+	if (!sdp)
+		return NULL;
+
+	return *sdp;
 }
 
 extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 6efb2e1..ba96988 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -151,6 +151,7 @@
 					   SD_LAST_BUGGY_SECTORS */
 	unsigned no_read_disc_info:1;	/* Avoid READ_DISC_INFO cmds */
 	unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */
+	unsigned try_rc_10_first:1;	/* Try READ_CAPACACITY_10 first */
 	unsigned is_visible:1;	/* is the device visible in sysfs */
 
 	DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
diff --git a/include/sound/tpa2051d3.h b/include/sound/tpa2051d3.h
new file mode 100644
index 0000000..b12a990
--- /dev/null
+++ b/include/sound/tpa2051d3.h
@@ -0,0 +1,58 @@
+/*
+ * Definitions for tpa2051d3 speaker amp chip.
+ */
+#ifndef TPA2051D3_H
+#define TPA2051D3_H
+
+#include <linux/ioctl.h>
+
+#define TPA2051D3_I2C_NAME "tpa2051d3"
+#define SPKR_OUTPUT 0
+#define HEADSET_OUTPUT 1
+#define DUAL_OUTPUT 2
+#define HANDSET_OUTPUT 3
+#define LINEOUT_OUTPUT 4
+#define MODE_CMD_LEM 9
+struct tpa2051d3_platform_data {
+	uint32_t gpio_tpa2051_spk_en;
+	unsigned char spkr_cmd[7];
+	unsigned char hsed_cmd[7];
+	unsigned char rece_cmd[7];
+	/* for spk enable gpio on cpu */
+	uint32_t gpio_tpa2051_spk_en_cpu;
+};
+
+struct tpa2051_config_data {
+	unsigned int data_len;
+	unsigned int mode_num;
+	unsigned char *cmd_data;  /* [mode][mode_kind][reserve][cmds..] */
+};
+
+enum TPA2051_Mode {
+	TPA2051_MODE_OFF,
+	TPA2051_MODE_PLAYBACK_SPKR,
+	TPA2051_MODE_PLAYBACK_HEADSET,
+	TPA2051_MODE_RING,
+	TPA2051_MODE_VOICECALL_SPKR,
+	TPA2051_MODE_VOICECALL_HEADSET,
+	TPA2051_MODE_FM_SPKR,
+	TPA2051_MODE_FM_HEADSET,
+	TPA2051_MODE_PLAYBACK_HANDSET,
+	TPA2051_MODE_VOICECALL_HANDSET,
+	TPA2051_MODE_LINEOUT,
+	TPA2051_MAX_MODE
+};
+#define TPA2051_IOCTL_MAGIC 'a'
+#define TPA2051_SET_CONFIG	_IOW(TPA2051_IOCTL_MAGIC, 0x01,	unsigned)
+#define TPA2051_READ_CONFIG	_IOW(TPA2051_IOCTL_MAGIC, 0x02, unsigned)
+#define TPA2051_SET_MODE        _IOW(TPA2051_IOCTL_MAGIC, 0x03, unsigned)
+#define TPA2051_SET_PARAM       _IOW(TPA2051_IOCTL_MAGIC, 0x04,  unsigned)
+#define TPA2051_WRITE_REG       _IOW(TPA2051_IOCTL_MAGIC, 0x07,  unsigned)
+
+void set_speaker_amp(int on);
+void set_headset_amp(int on);
+void set_speaker_headset_amp(int on);
+void set_handset_amp(int on);
+void set_usb_audio_amp(int on);
+#endif
+
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 372c60d..03710e5 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -229,6 +229,7 @@
 	TCM_CHECK_CONDITION_UNIT_ATTENTION	= 0x0e,
 	TCM_CHECK_CONDITION_NOT_READY		= 0x0f,
 	TCM_RESERVATION_CONFLICT		= 0x10,
+	TCM_ADDRESS_OUT_OF_RANGE		= 0x11,
 };
 
 enum target_sc_flags_table {
diff --git a/include/trace/events/cpufreq_interactive.h b/include/trace/events/cpufreq_interactive.h
index ea83664..951e6ca 100644
--- a/include/trace/events/cpufreq_interactive.h
+++ b/include/trace/events/cpufreq_interactive.h
@@ -28,13 +28,7 @@
 	      __entry->actualfreq)
 );
 
-DEFINE_EVENT(set, cpufreq_interactive_up,
-	TP_PROTO(u32 cpu_id, unsigned long targfreq,
-	     unsigned long actualfreq),
-	TP_ARGS(cpu_id, targfreq, actualfreq)
-);
-
-DEFINE_EVENT(set, cpufreq_interactive_down,
+DEFINE_EVENT(set, cpufreq_interactive_setspeed,
 	TP_PROTO(u32 cpu_id, unsigned long targfreq,
 	     unsigned long actualfreq),
 	TP_ARGS(cpu_id, targfreq, actualfreq)
@@ -42,44 +36,50 @@
 
 DECLARE_EVENT_CLASS(loadeval,
 	    TP_PROTO(unsigned long cpu_id, unsigned long load,
-		     unsigned long curfreq, unsigned long targfreq),
-	    TP_ARGS(cpu_id, load, curfreq, targfreq),
+		     unsigned long curtarg, unsigned long curactual,
+		     unsigned long newtarg),
+		    TP_ARGS(cpu_id, load, curtarg, curactual, newtarg),
 
 	    TP_STRUCT__entry(
 		    __field(unsigned long, cpu_id    )
 		    __field(unsigned long, load      )
-		    __field(unsigned long, curfreq   )
-		    __field(unsigned long, targfreq  )
+		    __field(unsigned long, curtarg   )
+		    __field(unsigned long, curactual )
+		    __field(unsigned long, newtarg   )
 	    ),
 
 	    TP_fast_assign(
 		    __entry->cpu_id = cpu_id;
 		    __entry->load = load;
-		    __entry->curfreq = curfreq;
-		    __entry->targfreq = targfreq;
+		    __entry->curtarg = curtarg;
+		    __entry->curactual = curactual;
+		    __entry->newtarg = newtarg;
 	    ),
 
-	    TP_printk("cpu=%lu load=%lu cur=%lu targ=%lu",
-		      __entry->cpu_id, __entry->load, __entry->curfreq,
-		      __entry->targfreq)
+	    TP_printk("cpu=%lu load=%lu cur=%lu actual=%lu targ=%lu",
+		      __entry->cpu_id, __entry->load, __entry->curtarg,
+		      __entry->curactual, __entry->newtarg)
 );
 
 DEFINE_EVENT(loadeval, cpufreq_interactive_target,
 	    TP_PROTO(unsigned long cpu_id, unsigned long load,
-		     unsigned long curfreq, unsigned long targfreq),
-	    TP_ARGS(cpu_id, load, curfreq, targfreq)
+		     unsigned long curtarg, unsigned long curactual,
+		     unsigned long newtarg),
+	    TP_ARGS(cpu_id, load, curtarg, curactual, newtarg)
 );
 
 DEFINE_EVENT(loadeval, cpufreq_interactive_already,
 	    TP_PROTO(unsigned long cpu_id, unsigned long load,
-		     unsigned long curfreq, unsigned long targfreq),
-	    TP_ARGS(cpu_id, load, curfreq, targfreq)
+		     unsigned long curtarg, unsigned long curactual,
+		     unsigned long newtarg),
+	    TP_ARGS(cpu_id, load, curtarg, curactual, newtarg)
 );
 
 DEFINE_EVENT(loadeval, cpufreq_interactive_notyet,
 	    TP_PROTO(unsigned long cpu_id, unsigned long load,
-		     unsigned long curfreq, unsigned long targfreq),
-	    TP_ARGS(cpu_id, load, curfreq, targfreq)
+		     unsigned long curtarg, unsigned long curactual,
+		     unsigned long newtarg),
+	    TP_ARGS(cpu_id, load, curtarg, curactual, newtarg)
 );
 
 TRACE_EVENT(cpufreq_interactive_boost,
diff --git a/include/trace/events/random.h b/include/trace/events/random.h
new file mode 100644
index 0000000..422df19
--- /dev/null
+++ b/include/trace/events/random.h
@@ -0,0 +1,134 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM random
+
+#if !defined(_TRACE_RANDOM_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_RANDOM_H
+
+#include <linux/writeback.h>
+#include <linux/tracepoint.h>
+
+DECLARE_EVENT_CLASS(random__mix_pool_bytes,
+	TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
+
+	TP_ARGS(pool_name, bytes, IP),
+
+	TP_STRUCT__entry(
+		__field( const char *,	pool_name		)
+		__field(	  int,	bytes			)
+		__field(unsigned long,	IP			)
+	),
+
+	TP_fast_assign(
+		__entry->pool_name	= pool_name;
+		__entry->bytes		= bytes;
+		__entry->IP		= IP;
+	),
+
+	TP_printk("%s pool: bytes %d caller %pF",
+		  __entry->pool_name, __entry->bytes, (void *)__entry->IP)
+);
+
+DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes,
+	TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
+
+	TP_ARGS(pool_name, bytes, IP)
+);
+
+DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes_nolock,
+	TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
+
+	TP_ARGS(pool_name, bytes, IP)
+);
+
+TRACE_EVENT(credit_entropy_bits,
+	TP_PROTO(const char *pool_name, int bits, int entropy_count,
+		 int entropy_total, unsigned long IP),
+
+	TP_ARGS(pool_name, bits, entropy_count, entropy_total, IP),
+
+	TP_STRUCT__entry(
+		__field( const char *,	pool_name		)
+		__field(	  int,	bits			)
+		__field(	  int,	entropy_count		)
+		__field(	  int,	entropy_total		)
+		__field(unsigned long,	IP			)
+	),
+
+	TP_fast_assign(
+		__entry->pool_name	= pool_name;
+		__entry->bits		= bits;
+		__entry->entropy_count	= entropy_count;
+		__entry->entropy_total	= entropy_total;
+		__entry->IP		= IP;
+	),
+
+	TP_printk("%s pool: bits %d entropy_count %d entropy_total %d "
+		  "caller %pF", __entry->pool_name, __entry->bits,
+		  __entry->entropy_count, __entry->entropy_total,
+		  (void *)__entry->IP)
+);
+
+TRACE_EVENT(get_random_bytes,
+	TP_PROTO(int nbytes, unsigned long IP),
+
+	TP_ARGS(nbytes, IP),
+
+	TP_STRUCT__entry(
+		__field(	  int,	nbytes			)
+		__field(unsigned long,	IP			)
+	),
+
+	TP_fast_assign(
+		__entry->nbytes		= nbytes;
+		__entry->IP		= IP;
+	),
+
+	TP_printk("nbytes %d caller %pF", __entry->nbytes, (void *)__entry->IP)
+);
+
+DECLARE_EVENT_CLASS(random__extract_entropy,
+	TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
+		 unsigned long IP),
+
+	TP_ARGS(pool_name, nbytes, entropy_count, IP),
+
+	TP_STRUCT__entry(
+		__field( const char *,	pool_name		)
+		__field(	  int,	nbytes			)
+		__field(	  int,	entropy_count		)
+		__field(unsigned long,	IP			)
+	),
+
+	TP_fast_assign(
+		__entry->pool_name	= pool_name;
+		__entry->nbytes		= nbytes;
+		__entry->entropy_count	= entropy_count;
+		__entry->IP		= IP;
+	),
+
+	TP_printk("%s pool: nbytes %d entropy_count %d caller %pF",
+		  __entry->pool_name, __entry->nbytes, __entry->entropy_count,
+		  (void *)__entry->IP)
+);
+
+
+DEFINE_EVENT(random__extract_entropy, extract_entropy,
+	TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
+		 unsigned long IP),
+
+	TP_ARGS(pool_name, nbytes, entropy_count, IP)
+);
+
+DEFINE_EVENT(random__extract_entropy, extract_entropy_user,
+	TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
+		 unsigned long IP),
+
+	TP_ARGS(pool_name, nbytes, entropy_count, IP)
+);
+
+
+
+#endif /* _TRACE_RANDOM_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/include/xen/events.h b/include/xen/events.h
index 0f77370..04399b2 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -103,6 +103,9 @@
 /* Return the pirq allocated to the irq. */
 int xen_pirq_from_irq(unsigned irq);
 
+/* Return the irq allocated to the gsi */
+int xen_irq_from_gsi(unsigned gsi);
+
 /* Determine whether to ignore this IRQ if it is passed to a guest. */
 int xen_test_irq_shared(int irq);
 
diff --git a/init/main.c b/init/main.c
index 737ab05..feb0ba5 100644
--- a/init/main.c
+++ b/init/main.c
@@ -510,7 +510,7 @@
 	parse_early_param();
 	parse_args("Booting kernel", static_command_line, __start___param,
 		   __stop___param - __start___param,
-		   0, 0, &unknown_bootoption);
+		   -1, -1, &unknown_bootoption);
 
 	jump_label_init();
 
@@ -562,9 +562,6 @@
 	early_boot_irqs_disabled = false;
 	local_irq_enable();
 
-	/* Interrupts are enabled now so all GFP allocations are safe. */
-	gfp_allowed_mask = __GFP_BITS_MASK;
-
 	kmem_cache_init_late();
 
 	/*
@@ -844,6 +841,10 @@
 	 * Wait until kthreadd is all set-up.
 	 */
 	wait_for_completion(&kthreadd_done);
+
+	/* Now the scheduler is fully set up and can do blocking allocations */
+	gfp_allowed_mask = __GFP_BITS_MASK;
+
 	/*
 	 * init can allocate pages on any node
 	 */
diff --git a/kernel/events/core.c b/kernel/events/core.c
index fd126f8..aafa4c1 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5118,7 +5118,7 @@
 
 static int perf_swevent_init(struct perf_event *event)
 {
-	int event_id = event->attr.config;
+	u64 event_id = event->attr.config;
 
 	if (event->attr.type != PERF_TYPE_SOFTWARE)
 		return -ENOENT;
diff --git a/kernel/exit.c b/kernel/exit.c
index 6096e80..7b8aafc 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -471,7 +471,7 @@
 	rcu_read_unlock();
 	for (;;) {
 		unsigned long set;
-		i = j * __NFDBITS;
+		i = j * BITS_PER_LONG;
 		if (i >= fdt->max_fds)
 			break;
 		set = fdt->open_fds[j++];
@@ -644,6 +644,7 @@
 	mm_release(tsk, mm);
 	if (!mm)
 		return;
+	sync_mm_rss(mm);
 	/*
 	 * Serialize with any possible pending coredump.
 	 * We must hold mmap_sem around checking core_state
@@ -1030,7 +1031,7 @@
 	/*
 	 * Make sure we are holding no locks:
 	 */
-	debug_check_no_locks_held(tsk);
+	debug_check_no_locks_held();
 	/*
 	 * We can do this unlocked here. The futex code uses this flag
 	 * just to verify whether the pi state cleanup has been done
diff --git a/kernel/fork.c b/kernel/fork.c
index 0de735c..965c148 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -372,7 +372,8 @@
 		}
 		charge = 0;
 		if (mpnt->vm_flags & VM_ACCOUNT) {
-			unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
+			unsigned long len;
+			len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
 			if (security_vm_enough_memory_mm(oldmm, len)) /* sic */
 				goto fail_nomem;
 			charge = len;
diff --git a/kernel/freezer.c b/kernel/freezer.c
index 11f82a4..d1db423 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -110,6 +110,18 @@
 {
 	unsigned long flags;
 
+	/*
+	 * This check can race with freezer_do_not_count, but worst case that
+	 * will result in an extra wakeup being sent to the task.  It does not
+	 * race with freezer_count(), the barriers in freezer_count() and
+	 * freezer_should_skip() ensure that either freezer_count() sees
+	 * freezing == true in try_to_freeze() and freezes, or
+	 * freezer_should_skip() sees !PF_FREEZE_SKIP and freezes the task
+	 * normally.
+	 */
+	if (freezer_should_skip(p))
+		return false;
+
 	spin_lock_irqsave(&freezer_lock, flags);
 	if (!freezing(p) || frozen(p)) {
 		spin_unlock_irqrestore(&freezer_lock, flags);
diff --git a/kernel/futex.c b/kernel/futex.c
index e2b0fb9..3312eaa 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -60,6 +60,7 @@
 #include <linux/pid.h>
 #include <linux/nsproxy.h>
 #include <linux/ptrace.h>
+#include <linux/freezer.h>
 
 #include <asm/futex.h>
 
@@ -1786,7 +1787,7 @@
 		 * is no timeout, or if it has yet to expire.
 		 */
 		if (!timeout || timeout->task)
-			schedule();
+			freezable_schedule();
 	}
 	__set_current_state(TASK_RUNNING);
 }
@@ -2231,11 +2232,11 @@
  * @uaddr2:	the pi futex we will take prior to returning to user-space
  *
  * The caller will wait on uaddr and will be requeued by futex_requeue() to
- * uaddr2 which must be PI aware.  Normal wakeup will wake on uaddr2 and
- * complete the acquisition of the rt_mutex prior to returning to userspace.
- * This ensures the rt_mutex maintains an owner when it has waiters; without
- * one, the pi logic wouldn't know which task to boost/deboost, if there was a
- * need to.
+ * uaddr2 which must be PI aware and unique from uaddr.  Normal wakeup will wake
+ * on uaddr2 and complete the acquisition of the rt_mutex prior to returning to
+ * userspace.  This ensures the rt_mutex maintains an owner when it has waiters;
+ * without one, the pi logic would not know which task to boost/deboost, if
+ * there was a need to.
  *
  * We call schedule in futex_wait_queue_me() when we enqueue and return there
  * via the following:
@@ -2272,6 +2273,9 @@
 	struct futex_q q = futex_q_init;
 	int res, ret;
 
+	if (uaddr == uaddr2)
+		return -EINVAL;
+
 	if (!bitset)
 		return -EINVAL;
 
@@ -2343,7 +2347,7 @@
 		 * signal.  futex_unlock_pi() will not destroy the lock_ptr nor
 		 * the pi_state.
 		 */
-		WARN_ON(!&q.pi_state);
+		WARN_ON(!q.pi_state);
 		pi_mutex = &q.pi_state->pi_mutex;
 		ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter, 1);
 		debug_rt_mutex_free_waiter(&rt_waiter);
@@ -2370,7 +2374,7 @@
 	 * fault, unlock the rt_mutex and return the fault to userspace.
 	 */
 	if (ret == -EFAULT) {
-		if (rt_mutex_owner(pi_mutex) == current)
+		if (pi_mutex && rt_mutex_owner(pi_mutex) == current)
 			rt_mutex_unlock(pi_mutex);
 	} else if (ret == -EINTR) {
 		/*
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index d1e73a4..c66928e 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -45,6 +45,7 @@
 #include <linux/debugobjects.h>
 #include <linux/sched.h>
 #include <linux/timer.h>
+#include <linux/freezer.h>
 
 #include <asm/uaccess.h>
 
@@ -658,6 +659,14 @@
 	return 0;
 }
 
+static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
+{
+	ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset;
+	ktime_t *offs_boot = &base->clock_base[HRTIMER_BASE_BOOTTIME].offset;
+
+	return ktime_get_update_offsets(offs_real, offs_boot);
+}
+
 /*
  * Retrigger next event is called after clock was set
  *
@@ -666,22 +675,12 @@
 static void retrigger_next_event(void *arg)
 {
 	struct hrtimer_cpu_base *base = &__get_cpu_var(hrtimer_bases);
-	struct timespec realtime_offset, xtim, wtm, sleep;
 
 	if (!hrtimer_hres_active())
 		return;
 
-	/* Optimized out for !HIGH_RES */
-	get_xtime_and_monotonic_and_sleep_offset(&xtim, &wtm, &sleep);
-	set_normalized_timespec(&realtime_offset, -wtm.tv_sec, -wtm.tv_nsec);
-
-	/* Adjust CLOCK_REALTIME offset */
 	raw_spin_lock(&base->lock);
-	base->clock_base[HRTIMER_BASE_REALTIME].offset =
-		timespec_to_ktime(realtime_offset);
-	base->clock_base[HRTIMER_BASE_BOOTTIME].offset =
-		timespec_to_ktime(sleep);
-
+	hrtimer_update_base(base);
 	hrtimer_force_reprogram(base, 0);
 	raw_spin_unlock(&base->lock);
 }
@@ -711,13 +710,25 @@
 		base->clock_base[i].resolution = KTIME_HIGH_RES;
 
 	tick_setup_sched_timer();
-
 	/* "Retrigger" the interrupt to get things going */
 	retrigger_next_event(NULL);
 	local_irq_restore(flags);
 	return 1;
 }
 
+/*
+ * Called from timekeeping code to reprogramm the hrtimer interrupt
+ * device. If called from the timer interrupt context we defer it to
+ * softirq context.
+ */
+void clock_was_set_delayed(void)
+{
+	struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
+
+	cpu_base->clock_was_set = 1;
+	__raise_softirq_irqoff(HRTIMER_SOFTIRQ);
+}
+
 #else
 
 static inline int hrtimer_hres_active(void) { return 0; }
@@ -1251,11 +1262,10 @@
 	cpu_base->nr_events++;
 	dev->next_event.tv64 = KTIME_MAX;
 
-	entry_time = now = ktime_get();
+	raw_spin_lock(&cpu_base->lock);
+	entry_time = now = hrtimer_update_base(cpu_base);
 retry:
 	expires_next.tv64 = KTIME_MAX;
-
-	raw_spin_lock(&cpu_base->lock);
 	/*
 	 * We set expires_next to KTIME_MAX here with cpu_base->lock
 	 * held to prevent that a timer is enqueued in our queue via
@@ -1331,8 +1341,12 @@
 	 * We need to prevent that we loop forever in the hrtimer
 	 * interrupt routine. We give it 3 attempts to avoid
 	 * overreacting on some spurious event.
+	 *
+	 * Acquire base lock for updating the offsets and retrieving
+	 * the current time.
 	 */
-	now = ktime_get();
+	raw_spin_lock(&cpu_base->lock);
+	now = hrtimer_update_base(cpu_base);
 	cpu_base->nr_retries++;
 	if (++retries < 3)
 		goto retry;
@@ -1344,6 +1358,7 @@
 	 */
 	cpu_base->nr_hangs++;
 	cpu_base->hang_detected = 1;
+	raw_spin_unlock(&cpu_base->lock);
 	delta = ktime_sub(now, entry_time);
 	if (delta.tv64 > cpu_base->max_hang_time.tv64)
 		cpu_base->max_hang_time = delta;
@@ -1396,6 +1411,13 @@
 
 static void run_hrtimer_softirq(struct softirq_action *h)
 {
+	struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
+
+	if (cpu_base->clock_was_set) {
+		cpu_base->clock_was_set = 0;
+		clock_was_set();
+	}
+
 	hrtimer_peek_ahead_timers();
 }
 
@@ -1502,7 +1524,7 @@
 			t->task = NULL;
 
 		if (likely(t->task))
-			schedule();
+			freezable_schedule();
 
 		hrtimer_cancel(&t->timer);
 		mode = HRTIMER_MODE_ABS;
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index bdb1803..131ca17 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -133,7 +133,7 @@
 handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action)
 {
 	irqreturn_t retval = IRQ_NONE;
-	unsigned int random = 0, irq = desc->irq_data.irq;
+	unsigned int flags = 0, irq = desc->irq_data.irq;
 
 	do {
 		irqreturn_t res;
@@ -161,7 +161,7 @@
 
 			/* Fall through to add to randomness */
 		case IRQ_HANDLED:
-			random |= action->flags;
+			flags |= action->flags;
 			break;
 
 		default:
@@ -172,8 +172,7 @@
 		action = action->next;
 	} while (action);
 
-	if (random & IRQF_SAMPLE_RANDOM)
-		add_interrupt_randomness(irq);
+	add_interrupt_randomness(irq, flags);
 
 	if (!noirqdebug)
 		note_interrupt(irq, desc, retval);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 165d5dc..8550d4b 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -916,22 +916,6 @@
 		return -ENOSYS;
 	if (!try_module_get(desc->owner))
 		return -ENODEV;
-	/*
-	 * Some drivers like serial.c use request_irq() heavily,
-	 * so we have to be careful not to interfere with a
-	 * running system.
-	 */
-	if (new->flags & IRQF_SAMPLE_RANDOM) {
-		/*
-		 * This function might sleep, we want to call it first,
-		 * outside of the atomic block.
-		 * Yes, this might clear the entropy pool if the wrong
-		 * driver is attempted to be loaded, without actually
-		 * installing a new handler, but is this really a problem,
-		 * only the sysadmin is able to do this.
-		 */
-		rand_initialize_irq(irq);
-	}
 
 	/*
 	 * Check whether the interrupt nests into another interrupt
@@ -1372,7 +1356,6 @@
  *	Flags:
  *
  *	IRQF_SHARED		Interrupt is shared
- *	IRQF_SAMPLE_RANDOM	The interrupt can be used for entropy
  *	IRQF_TRIGGER_*		Specify active edge(s) or level
  *
  */
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index ea9ee45..fdcf7ec 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -4044,7 +4044,7 @@
 }
 EXPORT_SYMBOL_GPL(debug_check_no_locks_freed);
 
-static void print_held_locks_bug(struct task_struct *curr)
+static void print_held_locks_bug(void)
 {
 	if (!debug_locks_off())
 		return;
@@ -4053,22 +4053,21 @@
 
 	printk("\n");
 	printk("=====================================\n");
-	printk("[ BUG: lock held at task exit time! ]\n");
+	printk("[ BUG: %s/%d still has locks held! ]\n",
+	       current->comm, task_pid_nr(current));
 	print_kernel_ident();
 	printk("-------------------------------------\n");
-	printk("%s/%d is exiting with locks still held!\n",
-		curr->comm, task_pid_nr(curr));
-	lockdep_print_held_locks(curr);
-
+	lockdep_print_held_locks(current);
 	printk("\nstack backtrace:\n");
 	dump_stack();
 }
 
-void debug_check_no_locks_held(struct task_struct *task)
+void debug_check_no_locks_held(void)
 {
-	if (unlikely(task->lockdep_depth > 0))
-		print_held_locks_bug(task);
+	if (unlikely(current->lockdep_depth > 0))
+		print_held_locks_bug();
 }
+EXPORT_SYMBOL_GPL(debug_check_no_locks_held);
 
 void debug_show_all_locks(void)
 {
diff --git a/kernel/panic.c b/kernel/panic.c
index 4ffbce8..c03f5b7 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -131,8 +131,6 @@
 	 */
 	crash_kexec(NULL);
 
-	kmsg_dump(KMSG_DUMP_PANIC);
-
 	/*
 	 * Note smp_send_stop is the usual smp shutdown function, which
 	 * unfortunately means it may not be hardened to work in a panic
@@ -140,6 +138,8 @@
 	 */
 	smp_send_stop();
 
+	kmsg_dump(KMSG_DUMP_PANIC);
+
 	atomic_notifier_call_chain(&panic_notifier_list, 0, buf);
 
 	bust_spinlocks(0);
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index e09dfbf..52a1817 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -352,6 +352,7 @@
 	}
 
 	suspend_console();
+	ftrace_stop();
 	pm_restrict_gfp_mask();
 
 	error = dpm_suspend(PMSG_FREEZE);
@@ -377,6 +378,7 @@
 	if (error || !in_suspend)
 		pm_restore_gfp_mask();
 
+	ftrace_start();
 	resume_console();
 	dpm_complete(msg);
 
@@ -479,6 +481,7 @@
 
 	pm_prepare_console();
 	suspend_console();
+	ftrace_stop();
 	pm_restrict_gfp_mask();
 	error = dpm_suspend_start(PMSG_QUIESCE);
 	if (!error) {
@@ -486,6 +489,7 @@
 		dpm_resume_end(PMSG_RECOVER);
 	}
 	pm_restore_gfp_mask();
+	ftrace_start();
 	resume_console();
 	pm_restore_console();
 	return error;
@@ -512,6 +516,7 @@
 
 	entering_platform_hibernation = true;
 	suspend_console();
+	ftrace_stop();
 	error = dpm_suspend_start(PMSG_HIBERNATE);
 	if (error) {
 		if (hibernation_ops->recover)
@@ -555,6 +560,7 @@
  Resume_devices:
 	entering_platform_hibernation = false;
 	dpm_resume_end(PMSG_RESTORE);
+	ftrace_start();
 	resume_console();
 
  Close:
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 00259a8..2ee12f7 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -32,9 +32,10 @@
 	unsigned int todo;
 	bool wq_busy = false;
 	struct timeval start, end;
-	u64 elapsed_csecs64;
-	unsigned int elapsed_csecs;
+	u64 elapsed_msecs64;
+	unsigned int elapsed_msecs;
 	bool wakeup = false;
+	int sleep_usecs = USEC_PER_MSEC;
 
 	do_gettimeofday(&start);
 
@@ -85,49 +86,39 @@
 
 		/*
 		 * We need to retry, but first give the freezing tasks some
-		 * time to enter the regrigerator.
+		 * time to enter the refrigerator.  Start with an initial
+		 * 1 ms sleep followed by exponential backoff until 8 ms.
 		 */
-		msleep(10);
+		usleep_range(sleep_usecs / 2, sleep_usecs);
+		if (sleep_usecs < 8 * USEC_PER_MSEC)
+			sleep_usecs *= 2;
 	}
 
 	do_gettimeofday(&end);
-	elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
-	do_div(elapsed_csecs64, NSEC_PER_SEC / 100);
-	elapsed_csecs = elapsed_csecs64;
+	elapsed_msecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
+	do_div(elapsed_msecs64, NSEC_PER_MSEC);
+	elapsed_msecs = elapsed_msecs64;
 
 	if (todo) {
-		/* This does not unfreeze processes that are already frozen
-		 * (we have slightly ugly calling convention in that respect,
-		 * and caller must call thaw_processes() if something fails),
-		 * but it cleans up leftover PF_FREEZE requests.
-		 */
-		if(wakeup) {
-			printk("\n");
-			printk(KERN_ERR "Freezing of %s aborted\n",
-					user_only ? "user space " : "tasks ");
-		}
-		else {
-			printk("\n");
-			printk(KERN_ERR "Freezing of tasks %s after %d.%02d seconds "
-			       "(%d tasks refusing to freeze, wq_busy=%d):\n",
-			       wakeup ? "aborted" : "failed",
-			       elapsed_csecs / 100, elapsed_csecs % 100,
-			       todo - wq_busy, wq_busy);
-		}
+		printk("\n");
+		printk(KERN_ERR "Freezing of tasks %s after %d.%03d seconds "
+		       "(%d tasks refusing to freeze, wq_busy=%d):\n",
+		       wakeup ? "aborted" : "failed",
+		       elapsed_msecs / 1000, elapsed_msecs % 1000,
+		       todo - wq_busy, wq_busy);
 
 		if (!wakeup) {
 			read_lock(&tasklist_lock);
 			do_each_thread(g, p) {
 				if (p != current && !freezer_should_skip(p)
-				    && freezing(p) && !frozen(p) &&
-				    elapsed_csecs > 100)
+				    && freezing(p) && !frozen(p))
 					sched_show_task(p);
 			} while_each_thread(g, p);
 			read_unlock(&tasklist_lock);
 		}
 	} else {
-		printk("(elapsed %d.%02d seconds) ", elapsed_csecs / 100,
-			elapsed_csecs % 100);
+		printk("(elapsed %d.%03d seconds) ", elapsed_msecs / 1000,
+			elapsed_msecs % 1000);
 	}
 
 	return todo ? -EBUSY : 0;
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 10d58d4..da9ec86 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -25,6 +25,7 @@
 #include <linux/suspend.h>
 #include <linux/syscore_ops.h>
 #include <linux/rtc.h>
+#include <linux/ftrace.h>
 #include <trace/events/power.h>
 
 #include "power.h"
@@ -216,6 +217,7 @@
 			goto Close;
 	}
 	suspend_console();
+	ftrace_stop();
 	suspend_test_start();
 	error = dpm_suspend_start(PMSG_SUSPEND);
 	if (error) {
@@ -235,6 +237,7 @@
 	suspend_test_start();
 	dpm_resume_end(PMSG_RESUME);
 	suspend_test_finish("resume devices");
+	ftrace_start();
 	resume_console();
  Close:
 	if (suspend_ops->end)
diff --git a/kernel/relay.c b/kernel/relay.c
index ab56a17..e8cd202 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -1235,6 +1235,7 @@
 	struct splice_pipe_desc spd = {
 		.pages = pages,
 		.nr_pages = 0,
+		.nr_pages_max = PIPE_DEF_BUFFERS,
 		.partial = partial,
 		.flags = flags,
 		.ops = &relay_pipe_buf_ops,
@@ -1302,8 +1303,8 @@
                 ret += padding;
 
 out:
-	splice_shrink_spd(pipe, &spd);
-        return ret;
+	splice_shrink_spd(&spd);
+	return ret;
 }
 
 static ssize_t relay_file_splice_read(struct file *in,
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 45a8d86..7645abe 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2162,11 +2162,73 @@
 }
 
 
+/*
+ * Global load-average calculations
+ *
+ * We take a distributed and async approach to calculating the global load-avg
+ * in order to minimize overhead.
+ *
+ * The global load average is an exponentially decaying average of nr_running +
+ * nr_uninterruptible.
+ *
+ * Once every LOAD_FREQ:
+ *
+ *   nr_active = 0;
+ *   for_each_possible_cpu(cpu)
+ *   	nr_active += cpu_of(cpu)->nr_running + cpu_of(cpu)->nr_uninterruptible;
+ *
+ *   avenrun[n] = avenrun[0] * exp_n + nr_active * (1 - exp_n)
+ *
+ * Due to a number of reasons the above turns in the mess below:
+ *
+ *  - for_each_possible_cpu() is prohibitively expensive on machines with
+ *    serious number of cpus, therefore we need to take a distributed approach
+ *    to calculating nr_active.
+ *
+ *        \Sum_i x_i(t) = \Sum_i x_i(t) - x_i(t_0) | x_i(t_0) := 0
+ *                      = \Sum_i { \Sum_j=1 x_i(t_j) - x_i(t_j-1) }
+ *
+ *    So assuming nr_active := 0 when we start out -- true per definition, we
+ *    can simply take per-cpu deltas and fold those into a global accumulate
+ *    to obtain the same result. See calc_load_fold_active().
+ *
+ *    Furthermore, in order to avoid synchronizing all per-cpu delta folding
+ *    across the machine, we assume 10 ticks is sufficient time for every
+ *    cpu to have completed this task.
+ *
+ *    This places an upper-bound on the IRQ-off latency of the machine. Then
+ *    again, being late doesn't loose the delta, just wrecks the sample.
+ *
+ *  - cpu_rq()->nr_uninterruptible isn't accurately tracked per-cpu because
+ *    this would add another cross-cpu cacheline miss and atomic operation
+ *    to the wakeup path. Instead we increment on whatever cpu the task ran
+ *    when it went into uninterruptible state and decrement on whatever cpu
+ *    did the wakeup. This means that only the sum of nr_uninterruptible over
+ *    all cpus yields the correct result.
+ *
+ *  This covers the NO_HZ=n code, for extra head-aches, see the comment below.
+ */
+
 /* Variables and functions for calc_load */
 static atomic_long_t calc_load_tasks;
 static unsigned long calc_load_update;
 unsigned long avenrun[3];
-EXPORT_SYMBOL(avenrun);
+EXPORT_SYMBOL(avenrun); /* should be removed */
+
+/**
+ * get_avenrun - get the load average array
+ * @loads:	pointer to dest load array
+ * @offset:	offset to add
+ * @shift:	shift count to shift the result left
+ *
+ * These values are estimates at best, so no need for locking.
+ */
+void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
+{
+	loads[0] = (avenrun[0] + offset) << shift;
+	loads[1] = (avenrun[1] + offset) << shift;
+	loads[2] = (avenrun[2] + offset) << shift;
+}
 
 static long calc_load_fold_active(struct rq *this_rq)
 {
@@ -2183,6 +2245,9 @@
 	return delta;
 }
 
+/*
+ * a1 = a0 * e + a * (1 - e)
+ */
 static unsigned long
 calc_load(unsigned long load, unsigned long exp, unsigned long active)
 {
@@ -2194,30 +2259,118 @@
 
 #ifdef CONFIG_NO_HZ
 /*
- * For NO_HZ we delay the active fold to the next LOAD_FREQ update.
+ * Handle NO_HZ for the global load-average.
+ *
+ * Since the above described distributed algorithm to compute the global
+ * load-average relies on per-cpu sampling from the tick, it is affected by
+ * NO_HZ.
+ *
+ * The basic idea is to fold the nr_active delta into a global idle-delta upon
+ * entering NO_HZ state such that we can include this as an 'extra' cpu delta
+ * when we read the global state.
+ *
+ * Obviously reality has to ruin such a delightfully simple scheme:
+ *
+ *  - When we go NO_HZ idle during the window, we can negate our sample
+ *    contribution, causing under-accounting.
+ *
+ *    We avoid this by keeping two idle-delta counters and flipping them
+ *    when the window starts, thus separating old and new NO_HZ load.
+ *
+ *    The only trick is the slight shift in index flip for read vs write.
+ *
+ *        0s            5s            10s           15s
+ *          +10           +10           +10           +10
+ *        |-|-----------|-|-----------|-|-----------|-|
+ *    r:0 0 1           1 0           0 1           1 0
+ *    w:0 1 1           0 0           1 1           0 0
+ *
+ *    This ensures we'll fold the old idle contribution in this window while
+ *    accumlating the new one.
+ *
+ *  - When we wake up from NO_HZ idle during the window, we push up our
+ *    contribution, since we effectively move our sample point to a known
+ *    busy state.
+ *
+ *    This is solved by pushing the window forward, and thus skipping the
+ *    sample, for this cpu (effectively using the idle-delta for this cpu which
+ *    was in effect at the time the window opened). This also solves the issue
+ *    of having to deal with a cpu having been in NOHZ idle for multiple
+ *    LOAD_FREQ intervals.
  *
  * When making the ILB scale, we should try to pull this in as well.
  */
-static atomic_long_t calc_load_tasks_idle;
+static atomic_long_t calc_load_idle[2];
+static int calc_load_idx;
 
-void calc_load_account_idle(struct rq *this_rq)
+static inline int calc_load_write_idx(void)
 {
+	int idx = calc_load_idx;
+
+	/*
+	 * See calc_global_nohz(), if we observe the new index, we also
+	 * need to observe the new update time.
+	 */
+	smp_rmb();
+
+	/*
+	 * If the folding window started, make sure we start writing in the
+	 * next idle-delta.
+	 */
+	if (!time_before(jiffies, calc_load_update))
+		idx++;
+
+	return idx & 1;
+}
+
+static inline int calc_load_read_idx(void)
+{
+	return calc_load_idx & 1;
+}
+
+void calc_load_enter_idle(void)
+{
+	struct rq *this_rq = this_rq();
 	long delta;
 
+	/*
+	 * We're going into NOHZ mode, if there's any pending delta, fold it
+	 * into the pending idle delta.
+	 */
 	delta = calc_load_fold_active(this_rq);
-	if (delta)
-		atomic_long_add(delta, &calc_load_tasks_idle);
+	if (delta) {
+		int idx = calc_load_write_idx();
+		atomic_long_add(delta, &calc_load_idle[idx]);
+	}
+}
+
+void calc_load_exit_idle(void)
+{
+	struct rq *this_rq = this_rq();
+
+	/*
+	 * If we're still before the sample window, we're done.
+	 */
+	if (time_before(jiffies, this_rq->calc_load_update))
+		return;
+
+	/*
+	 * We woke inside or after the sample window, this means we're already
+	 * accounted through the nohz accounting, so skip the entire deal and
+	 * sync up for the next window.
+	 */
+	this_rq->calc_load_update = calc_load_update;
+	if (time_before(jiffies, this_rq->calc_load_update + 10))
+		this_rq->calc_load_update += LOAD_FREQ;
 }
 
 static long calc_load_fold_idle(void)
 {
+	int idx = calc_load_read_idx();
 	long delta = 0;
 
-	/*
-	 * Its got a race, we don't care...
-	 */
-	if (atomic_long_read(&calc_load_tasks_idle))
-		delta = atomic_long_xchg(&calc_load_tasks_idle, 0);
+	if (atomic_long_read(&calc_load_idle[idx]))
+		delta = atomic_long_xchg(&calc_load_idle[idx], 0);
 
 	return delta;
 }
@@ -2303,66 +2456,39 @@
 {
 	long delta, active, n;
 
-	/*
-	 * If we crossed a calc_load_update boundary, make sure to fold
-	 * any pending idle changes, the respective CPUs might have
-	 * missed the tick driven calc_load_account_active() update
-	 * due to NO_HZ.
-	 */
-	delta = calc_load_fold_idle();
-	if (delta)
-		atomic_long_add(delta, &calc_load_tasks);
+	if (!time_before(jiffies, calc_load_update + 10)) {
+		/*
+		 * Catch-up, fold however many we are behind still
+		 */
+		delta = jiffies - calc_load_update - 10;
+		n = 1 + (delta / LOAD_FREQ);
+
+		active = atomic_long_read(&calc_load_tasks);
+		active = active > 0 ? active * FIXED_1 : 0;
+
+		avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n);
+		avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n);
+		avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n);
+
+		calc_load_update += n * LOAD_FREQ;
+	}
 
 	/*
-	 * It could be the one fold was all it took, we done!
+	 * Flip the idle index...
+	 *
+	 * Make sure we first write the new time then flip the index, so that
+	 * calc_load_write_idx() will see the new time when it reads the new
+	 * index, this avoids a double flip messing things up.
 	 */
-	if (time_before(jiffies, calc_load_update + 10))
-		return;
-
-	/*
-	 * Catch-up, fold however many we are behind still
-	 */
-	delta = jiffies - calc_load_update - 10;
-	n = 1 + (delta / LOAD_FREQ);
-
-	active = atomic_long_read(&calc_load_tasks);
-	active = active > 0 ? active * FIXED_1 : 0;
-
-	avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n);
-	avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n);
-	avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n);
-
-	calc_load_update += n * LOAD_FREQ;
+	smp_wmb();
+	calc_load_idx++;
 }
-#else
-void calc_load_account_idle(struct rq *this_rq)
-{
-}
+#else /* !CONFIG_NO_HZ */
 
-static inline long calc_load_fold_idle(void)
-{
-	return 0;
-}
+static inline long calc_load_fold_idle(void) { return 0; }
+static inline void calc_global_nohz(void) { }
 
-static void calc_global_nohz(void)
-{
-}
-#endif
-
-/**
- * get_avenrun - get the load average array
- * @loads:	pointer to dest load array
- * @offset:	offset to add
- * @shift:	shift count to shift the result left
- *
- * These values are estimates at best, so no need for locking.
- */
-void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
-{
-	loads[0] = (avenrun[0] + offset) << shift;
-	loads[1] = (avenrun[1] + offset) << shift;
-	loads[2] = (avenrun[2] + offset) << shift;
-}
+#endif /* CONFIG_NO_HZ */
 
 /*
  * calc_load - update the avenrun load estimates 10 ticks after the
@@ -2370,11 +2496,18 @@
  */
 void calc_global_load(unsigned long ticks)
 {
-	long active;
+	long active, delta;
 
 	if (time_before(jiffies, calc_load_update + 10))
 		return;
 
+	/*
+	 * Fold the 'old' idle-delta to include all NO_HZ cpus.
+	 */
+	delta = calc_load_fold_idle();
+	if (delta)
+		atomic_long_add(delta, &calc_load_tasks);
+
 	active = atomic_long_read(&calc_load_tasks);
 	active = active > 0 ? active * FIXED_1 : 0;
 
@@ -2385,12 +2518,7 @@
 	calc_load_update += LOAD_FREQ;
 
 	/*
-	 * Account one period with whatever state we found before
-	 * folding in the nohz state and ageing the entire idle period.
-	 *
-	 * This avoids loosing a sample when we go idle between 
-	 * calc_load_account_active() (10 ticks ago) and now and thus
-	 * under-accounting.
+	 * In case we idled for multiple LOAD_FREQ intervals, catch up in bulk.
 	 */
 	calc_global_nohz();
 }
@@ -2407,7 +2535,6 @@
 		return;
 
 	delta  = calc_load_fold_active(this_rq);
-	delta += calc_load_fold_idle();
 	if (delta)
 		atomic_long_add(delta, &calc_load_tasks);
 
@@ -2415,6 +2542,10 @@
 }
 
 /*
+ * End of global load-average stuff
+ */
+
+/*
  * The exact cpuload at various idx values, calculated at every tick would be
  * load = (2^idx - 1) / 2^idx * load + 1 / 2^idx * cur_load
  *
@@ -6248,11 +6379,8 @@
 
 static int __init setup_relax_domain_level(char *str)
 {
-	unsigned long val;
-
-	val = simple_strtoul(str, NULL, 0);
-	if (val < sched_domain_level_max)
-		default_relax_domain_level = val;
+	if (kstrtoint(str, 0, &default_relax_domain_level))
+		pr_warn("Unable to set relax_domain_level\n");
 
 	return 1;
 }
@@ -6457,7 +6585,6 @@
 	if (!sd)
 		return child;
 
-	set_domain_attribute(sd, attr);
 	cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu));
 	if (child) {
 		sd->level = child->level + 1;
@@ -6465,6 +6592,7 @@
 		child->parent = sd;
 	}
 	sd->child = child;
+	set_domain_attribute(sd, attr);
 
 	return sd;
 }
diff --git a/kernel/sched/idle_task.c b/kernel/sched/idle_task.c
index 91b4c95..fdf7522 100644
--- a/kernel/sched/idle_task.c
+++ b/kernel/sched/idle_task.c
@@ -25,7 +25,6 @@
 static struct task_struct *pick_next_task_idle(struct rq *rq)
 {
 	schedstat_inc(rq, sched_goidle);
-	calc_load_account_idle(rq);
 	return rq->idle;
 }
 
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 451bd4f..7392855 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -942,8 +942,6 @@
 	return (u64)sysctl_sched_time_avg * NSEC_PER_MSEC / 2;
 }
 
-void calc_load_account_idle(struct rq *this_rq);
-
 #ifdef CONFIG_SCHED_HRTICK
 
 /*
diff --git a/kernel/signal.c b/kernel/signal.c
index 7a06651..42d8318 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2212,7 +2212,7 @@
 	 * Now that we woke up, it's crucial if we're supposed to be
 	 * frozen that we freeze now before running anything substantial.
 	 */
-	try_to_freeze();
+	try_to_freeze_nowarn();
 
 	spin_lock_irq(&sighand->siglock);
 	/*
@@ -2765,7 +2765,7 @@
 		recalc_sigpending();
 		spin_unlock_irq(&tsk->sighand->siglock);
 
-		timeout = schedule_timeout_interruptible(timeout);
+		timeout = freezable_schedule_timeout_interruptible(timeout);
 
 		spin_lock_irq(&tsk->sighand->siglock);
 		__set_task_blocked(tsk, &tsk->real_blocked);
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index f03fd83..8b70710 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -409,15 +409,20 @@
 			time_state = TIME_DEL;
 		break;
 	case TIME_INS:
-		if (secs % 86400 == 0) {
+		if (!(time_status & STA_INS))
+			time_state = TIME_OK;
+		else if (secs % 86400 == 0) {
 			leap = -1;
 			time_state = TIME_OOP;
+			time_tai++;
 			printk(KERN_NOTICE
 				"Clock: inserting leap second 23:59:60 UTC\n");
 		}
 		break;
 	case TIME_DEL:
-		if ((secs + 1) % 86400 == 0) {
+		if (!(time_status & STA_DEL))
+			time_state = TIME_OK;
+		else if ((secs + 1) % 86400 == 0) {
 			leap = 1;
 			time_tai--;
 			time_state = TIME_WAIT;
@@ -426,7 +431,6 @@
 		}
 		break;
 	case TIME_OOP:
-		time_tai++;
 		time_state = TIME_WAIT;
 		break;
 
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index c6cd85b..46f6300 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -407,6 +407,7 @@
 		 */
 		if (!ts->tick_stopped) {
 			select_nohz_load_balancer(1);
+			calc_load_enter_idle();
 
 			ts->idle_tick = hrtimer_get_expires(&ts->sched_timer);
 			ts->tick_stopped = 1;
@@ -596,6 +597,7 @@
 		account_idle_ticks(ticks);
 #endif
 
+	calc_load_exit_idle();
 	touch_softlockup_watchdog();
 	/*
 	 * Cancel the scheduled timer and restore the tick
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index d66b213..7c50de8 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -70,6 +70,12 @@
 	/* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */
 	struct timespec raw_time;
 
+	/* Offset clock monotonic -> clock realtime */
+	ktime_t offs_real;
+
+	/* Offset clock monotonic -> clock boottime */
+	ktime_t offs_boot;
+
 	/* Seqlock for all timekeeper values */
 	seqlock_t lock;
 };
@@ -172,6 +178,14 @@
 	return clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift);
 }
 
+static void update_rt_offset(void)
+{
+	struct timespec tmp, *wtm = &timekeeper.wall_to_monotonic;
+
+	set_normalized_timespec(&tmp, -wtm->tv_sec, -wtm->tv_nsec);
+	timekeeper.offs_real = timespec_to_ktime(tmp);
+}
+
 /* must hold write on timekeeper.lock */
 static void timekeeping_update(bool clearntp)
 {
@@ -179,6 +193,7 @@
 		timekeeper.ntp_error = 0;
 		ntp_clear();
 	}
+	update_rt_offset();
 	update_vsyscall(&timekeeper.xtime, &timekeeper.wall_to_monotonic,
 			 timekeeper.clock, timekeeper.mult);
 }
@@ -606,6 +621,7 @@
 	}
 	set_normalized_timespec(&timekeeper.wall_to_monotonic,
 				-boot.tv_sec, -boot.tv_nsec);
+	update_rt_offset();
 	timekeeper.total_sleep_time.tv_sec = 0;
 	timekeeper.total_sleep_time.tv_nsec = 0;
 	write_sequnlock_irqrestore(&timekeeper.lock, flags);
@@ -614,6 +630,12 @@
 /* time in seconds when suspend began */
 static struct timespec timekeeping_suspend_time;
 
+static void update_sleep_time(struct timespec t)
+{
+	timekeeper.total_sleep_time = t;
+	timekeeper.offs_boot = timespec_to_ktime(t);
+}
+
 /**
  * __timekeeping_inject_sleeptime - Internal function to add sleep interval
  * @delta: pointer to a timespec delta value
@@ -632,8 +654,7 @@
 	timekeeper.xtime = timespec_add(timekeeper.xtime, *delta);
 	timekeeper.wall_to_monotonic =
 			timespec_sub(timekeeper.wall_to_monotonic, *delta);
-	timekeeper.total_sleep_time = timespec_add(
-					timekeeper.total_sleep_time, *delta);
+	update_sleep_time(timespec_add(timekeeper.total_sleep_time, *delta));
 }
 
 
@@ -698,6 +719,7 @@
 	timekeeper.clock->cycle_last = timekeeper.clock->read(timekeeper.clock);
 	timekeeper.ntp_error = 0;
 	timekeeping_suspended = 0;
+	timekeeping_update(false);
 	write_sequnlock_irqrestore(&timekeeper.lock, flags);
 
 	touch_softlockup_watchdog();
@@ -964,6 +986,9 @@
 		timekeeper.xtime.tv_sec++;
 		leap = second_overflow(timekeeper.xtime.tv_sec);
 		timekeeper.xtime.tv_sec += leap;
+		timekeeper.wall_to_monotonic.tv_sec -= leap;
+		if (leap)
+			clock_was_set_delayed();
 	}
 
 	/* Accumulate raw time */
@@ -1079,6 +1104,9 @@
 		timekeeper.xtime.tv_sec++;
 		leap = second_overflow(timekeeper.xtime.tv_sec);
 		timekeeper.xtime.tv_sec += leap;
+		timekeeper.wall_to_monotonic.tv_sec -= leap;
+		if (leap)
+			clock_was_set_delayed();
 	}
 
 	timekeeping_update(false);
@@ -1246,6 +1274,40 @@
 	} while (read_seqretry(&timekeeper.lock, seq));
 }
 
+#ifdef CONFIG_HIGH_RES_TIMERS
+/**
+ * ktime_get_update_offsets - hrtimer helper
+ * @offs_real:	pointer to storage for monotonic -> realtime offset
+ * @offs_boot:	pointer to storage for monotonic -> boottime offset
+ *
+ * Returns current monotonic time and updates the offsets
+ * Called from hrtimer_interupt() or retrigger_next_event()
+ */
+ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot)
+{
+	ktime_t now;
+	unsigned int seq;
+	u64 secs, nsecs;
+
+	do {
+		seq = read_seqbegin(&timekeeper.lock);
+
+		secs = timekeeper.xtime.tv_sec;
+		nsecs = timekeeper.xtime.tv_nsec;
+		nsecs += timekeeping_get_ns();
+		/* If arch requires, add in gettimeoffset() */
+		nsecs += arch_gettimeoffset();
+
+		*offs_real = timekeeper.offs_real;
+		*offs_boot = timekeeper.offs_boot;
+	} while (read_seqretry(&timekeeper.lock, seq));
+
+	now = ktime_add_ns(ktime_set(secs, 0), nsecs);
+	now = ktime_sub(now, *offs_real);
+	return now;
+}
+#endif
+
 /**
  * ktime_get_monotonic_offset() - get wall_to_monotonic in ktime_t format
  */
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 700d2ae..8da07dd 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -384,7 +384,7 @@
 void tracing_off(void)
 {
 	if (global_trace.buffer)
-		ring_buffer_record_on(global_trace.buffer);
+		ring_buffer_record_off(global_trace.buffer);
 	/*
 	 * This flag is only looked at when buffers haven't been
 	 * allocated yet. We don't really care about the race
@@ -2650,10 +2650,12 @@
 		if (cpumask_test_cpu(cpu, tracing_cpumask) &&
 				!cpumask_test_cpu(cpu, tracing_cpumask_new)) {
 			atomic_inc(&global_trace.data[cpu]->disabled);
+			ring_buffer_record_disable_cpu(global_trace.buffer, cpu);
 		}
 		if (!cpumask_test_cpu(cpu, tracing_cpumask) &&
 				cpumask_test_cpu(cpu, tracing_cpumask_new)) {
 			atomic_dec(&global_trace.data[cpu]->disabled);
+			ring_buffer_record_enable_cpu(global_trace.buffer, cpu);
 		}
 	}
 	arch_spin_unlock(&ftrace_max_lock);
@@ -3565,6 +3567,7 @@
 		.pages		= pages_def,
 		.partial	= partial_def,
 		.nr_pages	= 0, /* This gets updated below. */
+		.nr_pages_max	= PIPE_DEF_BUFFERS,
 		.flags		= flags,
 		.ops		= &tracing_pipe_buf_ops,
 		.spd_release	= tracing_spd_release_pipe,
@@ -3636,7 +3639,7 @@
 
 	ret = splice_to_pipe(pipe, &spd);
 out:
-	splice_shrink_spd(pipe, &spd);
+	splice_shrink_spd(&spd);
 	return ret;
 
 out_err:
@@ -4128,6 +4131,7 @@
 	struct splice_pipe_desc spd = {
 		.pages		= pages_def,
 		.partial	= partial_def,
+		.nr_pages_max	= PIPE_DEF_BUFFERS,
 		.flags		= flags,
 		.ops		= &buffer_pipe_buf_ops,
 		.spd_release	= buffer_spd_release,
@@ -4215,7 +4219,7 @@
 	}
 
 	ret = splice_to_pipe(pipe, &spd);
-	splice_shrink_spd(pipe, &spd);
+	splice_shrink_spd(&spd);
 out:
 	return ret;
 }
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 7da267c..bfe3f8a 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3582,6 +3582,41 @@
 	return notifier_from_errno(0);
 }
 
+/*
+ * Workqueues should be brought up before normal priority CPU notifiers.
+ * This will be registered high priority CPU notifier.
+ */
+static int __devinit workqueue_cpu_up_callback(struct notifier_block *nfb,
+					       unsigned long action,
+					       void *hcpu)
+{
+	switch (action & ~CPU_TASKS_FROZEN) {
+	case CPU_UP_PREPARE:
+	case CPU_UP_CANCELED:
+	case CPU_DOWN_FAILED:
+	case CPU_ONLINE:
+		return workqueue_cpu_callback(nfb, action, hcpu);
+	}
+	return NOTIFY_OK;
+}
+
+/*
+ * Workqueues should be brought down after normal priority CPU notifiers.
+ * This will be registered as low priority CPU notifier.
+ */
+static int __devinit workqueue_cpu_down_callback(struct notifier_block *nfb,
+						 unsigned long action,
+						 void *hcpu)
+{
+	switch (action & ~CPU_TASKS_FROZEN) {
+	case CPU_DOWN_PREPARE:
+	case CPU_DYING:
+	case CPU_POST_DEAD:
+		return workqueue_cpu_callback(nfb, action, hcpu);
+	}
+	return NOTIFY_OK;
+}
+
 #ifdef CONFIG_SMP
 
 struct work_for_cpu {
@@ -3775,7 +3810,8 @@
 	unsigned int cpu;
 	int i;
 
-	cpu_notifier(workqueue_cpu_callback, CPU_PRI_WORKQUEUE);
+	cpu_notifier(workqueue_cpu_up_callback, CPU_PRI_WORKQUEUE_UP);
+	cpu_notifier(workqueue_cpu_down_callback, CPU_PRI_WORKQUEUE_DOWN);
 
 	/* initialize gcwqs */
 	for_each_gcwq_cpu(cpu) {
diff --git a/lib/btree.c b/lib/btree.c
index e5ec1e9..5cf9e74 100644
--- a/lib/btree.c
+++ b/lib/btree.c
@@ -319,8 +319,8 @@
 
 	if (head->height == 0)
 		return NULL;
-retry:
 	longcpy(key, __key, geo->keylen);
+retry:
 	dec_key(geo, key);
 
 	node = head->node;
@@ -351,7 +351,7 @@
 	}
 miss:
 	if (retry_key) {
-		__key = retry_key;
+		longcpy(key, retry_key, geo->keylen);
 		retry_key = NULL;
 		goto retry;
 	}
diff --git a/lib/dynamic_queue_limits.c b/lib/dynamic_queue_limits.c
index 6ab4587..0777c5a 100644
--- a/lib/dynamic_queue_limits.c
+++ b/lib/dynamic_queue_limits.c
@@ -10,23 +10,27 @@
 #include <linux/jiffies.h>
 #include <linux/dynamic_queue_limits.h>
 
-#define POSDIFF(A, B) ((A) > (B) ? (A) - (B) : 0)
+#define POSDIFF(A, B) ((int)((A) - (B)) > 0 ? (A) - (B) : 0)
+#define AFTER_EQ(A, B) ((int)((A) - (B)) >= 0)
 
 /* Records completed count and recalculates the queue limit */
 void dql_completed(struct dql *dql, unsigned int count)
 {
 	unsigned int inprogress, prev_inprogress, limit;
-	unsigned int ovlimit, all_prev_completed, completed;
+	unsigned int ovlimit, completed, num_queued;
+	bool all_prev_completed;
+
+	num_queued = ACCESS_ONCE(dql->num_queued);
 
 	/* Can't complete more than what's in queue */
-	BUG_ON(count > dql->num_queued - dql->num_completed);
+	BUG_ON(count > num_queued - dql->num_completed);
 
 	completed = dql->num_completed + count;
 	limit = dql->limit;
-	ovlimit = POSDIFF(dql->num_queued - dql->num_completed, limit);
-	inprogress = dql->num_queued - completed;
+	ovlimit = POSDIFF(num_queued - dql->num_completed, limit);
+	inprogress = num_queued - completed;
 	prev_inprogress = dql->prev_num_queued - dql->num_completed;
-	all_prev_completed = POSDIFF(completed, dql->prev_num_queued);
+	all_prev_completed = AFTER_EQ(completed, dql->prev_num_queued);
 
 	if ((ovlimit && !inprogress) ||
 	    (dql->prev_ovlimit && all_prev_completed)) {
@@ -104,7 +108,7 @@
 	dql->prev_ovlimit = ovlimit;
 	dql->prev_last_obj_cnt = dql->last_obj_cnt;
 	dql->num_completed = completed;
-	dql->prev_num_queued = dql->num_queued;
+	dql->prev_num_queued = num_queued;
 }
 EXPORT_SYMBOL(dql_completed);
 
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 86516f5..3ac50dc 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -673,6 +673,9 @@
 	 * during iterating; it can be zero only at the beginning.
 	 * And we cannot overflow iter->next_index in a single step,
 	 * because RADIX_TREE_MAP_SHIFT < BITS_PER_LONG.
+	 *
+	 * This condition also used by radix_tree_next_slot() to stop
+	 * contiguous iterating, and forbid swithing to the next chunk.
 	 */
 	index = iter->next_index;
 	if (!index && iter->index)
diff --git a/mm/compaction.c b/mm/compaction.c
index 353f1c5..260a487 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -698,8 +698,11 @@
 		if (err) {
 			putback_lru_pages(&cc->migratepages);
 			cc->nr_migratepages = 0;
+			if (err == -ENOMEM) {
+				ret = COMPACT_PARTIAL;
+				goto out;
+			}
 		}
-
 	}
 
 out:
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ae8f708..a799df5 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2157,6 +2157,15 @@
 		kref_get(&reservations->refs);
 }
 
+static void resv_map_put(struct vm_area_struct *vma)
+{
+	struct resv_map *reservations = vma_resv_map(vma);
+
+	if (!reservations)
+		return;
+	kref_put(&reservations->refs, resv_map_release);
+}
+
 static void hugetlb_vm_op_close(struct vm_area_struct *vma)
 {
 	struct hstate *h = hstate_vma(vma);
@@ -2173,7 +2182,7 @@
 		reserve = (end - start) -
 			region_count(&reservations->regions, start, end);
 
-		kref_put(&reservations->refs, resv_map_release);
+		resv_map_put(vma);
 
 		if (reserve) {
 			hugetlb_acct_memory(h, -reserve);
@@ -2383,6 +2392,22 @@
 {
 	mutex_lock(&vma->vm_file->f_mapping->i_mmap_mutex);
 	__unmap_hugepage_range(vma, start, end, ref_page);
+	/*
+	 * Clear this flag so that x86's huge_pmd_share page_table_shareable
+	 * test will fail on a vma being torn down, and not grab a page table
+	 * on its way out.  We're lucky that the flag has such an appropriate
+	 * name, and can in fact be safely cleared here. We could clear it
+	 * before the __unmap_hugepage_range above, but all that's necessary
+	 * is to clear it before releasing the i_mmap_mutex below.
+	 *
+	 * This works because in the contexts this is called, the VMA is
+	 * going to be destroyed. It is not vunerable to madvise(DONTNEED)
+	 * because madvise is not supported on hugetlbfs. The same applies
+	 * for direct IO. unmap_hugepage_range() is only being called just
+	 * before free_pgtables() so clearing VM_MAYSHARE will not cause
+	 * surprises later.
+	 */
+	vma->vm_flags &= ~VM_MAYSHARE;
 	mutex_unlock(&vma->vm_file->f_mapping->i_mmap_mutex);
 }
 
@@ -2949,9 +2974,14 @@
 		}
 	}
 	spin_unlock(&mm->page_table_lock);
-	mutex_unlock(&vma->vm_file->f_mapping->i_mmap_mutex);
-
+	/*
+	 * Must flush TLB before releasing i_mmap_mutex: x86's huge_pmd_unshare
+	 * may have cleared our pud entry and done put_page on the page table:
+	 * once we release i_mmap_mutex, another task can do the final put_page
+	 * and that page table be reused and filled with junk.
+	 */
 	flush_tlb_range(vma, start, end);
+	mutex_unlock(&vma->vm_file->f_mapping->i_mmap_mutex);
 }
 
 int hugetlb_reserve_pages(struct inode *inode,
@@ -2990,12 +3020,16 @@
 		set_vma_resv_flags(vma, HPAGE_RESV_OWNER);
 	}
 
-	if (chg < 0)
-		return chg;
+	if (chg < 0) {
+		ret = chg;
+		goto out_err;
+	}
 
 	/* There must be enough pages in the subpool for the mapping */
-	if (hugepage_subpool_get_pages(spool, chg))
-		return -ENOSPC;
+	if (hugepage_subpool_get_pages(spool, chg)) {
+		ret = -ENOSPC;
+		goto out_err;
+	}
 
 	/*
 	 * Check enough hugepages are available for the reservation.
@@ -3004,7 +3038,7 @@
 	ret = hugetlb_acct_memory(h, chg);
 	if (ret < 0) {
 		hugepage_subpool_put_pages(spool, chg);
-		return ret;
+		goto out_err;
 	}
 
 	/*
@@ -3021,6 +3055,10 @@
 	if (!vma || vma->vm_flags & VM_MAYSHARE)
 		region_add(&inode->i_mapping->private_list, from, to);
 	return 0;
+out_err:
+	if (vma)
+		resv_map_put(vma);
+	return ret;
 }
 
 void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed)
diff --git a/mm/madvise.c b/mm/madvise.c
index 1ccbba5..55f645c 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -13,6 +13,7 @@
 #include <linux/hugetlb.h>
 #include <linux/sched.h>
 #include <linux/ksm.h>
+#include <linux/file.h>
 
 /*
  * Any behaviour which results in changes to the vma->vm_flags needs to
@@ -203,14 +204,16 @@
 	struct address_space *mapping;
 	loff_t offset, endoff;
 	int error;
+	struct file *f;
 
 	*prev = NULL;	/* tell sys_madvise we drop mmap_sem */
 
 	if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB))
 		return -EINVAL;
 
-	if (!vma->vm_file || !vma->vm_file->f_mapping
-		|| !vma->vm_file->f_mapping->host) {
+	f = vma->vm_file;
+
+	if (!f || !f->f_mapping || !f->f_mapping->host) {
 			return -EINVAL;
 	}
 
@@ -224,9 +227,16 @@
 	endoff = (loff_t)(end - vma->vm_start - 1)
 			+ ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
 
-	/* vmtruncate_range needs to take i_mutex */
+	/*
+	 * vmtruncate_range may need to take i_mutex.  We need to
+	 * explicitly grab a reference because the vma (and hence the
+	 * vma's reference to the file) can go away as soon as we drop
+	 * mmap_sem.
+	 */
+	get_file(f);
 	up_read(&current->mm->mmap_sem);
 	error = vmtruncate_range(mapping->host, offset, endoff);
+	fput(f);
 	down_read(&current->mm->mmap_sem);
 	return error;
 }
diff --git a/mm/memblock.c b/mm/memblock.c
index b510ca5..85ba00a 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -37,6 +37,8 @@
 
 int memblock_debug __initdata_memblock;
 static int memblock_can_resize __initdata_memblock;
+static int memblock_memory_in_slab __initdata_memblock = 0;
+static int memblock_reserved_in_slab __initdata_memblock = 0;
 
 /* inline so we don't get a warning when pr_debug is compiled out */
 static inline const char *memblock_type_name(struct memblock_type *type)
@@ -141,30 +143,6 @@
 					   MAX_NUMNODES);
 }
 
-/*
- * Free memblock.reserved.regions
- */
-int __init_memblock memblock_free_reserved_regions(void)
-{
-	if (memblock.reserved.regions == memblock_reserved_init_regions)
-		return 0;
-
-	return memblock_free(__pa(memblock.reserved.regions),
-		 sizeof(struct memblock_region) * memblock.reserved.max);
-}
-
-/*
- * Reserve memblock.reserved.regions
- */
-int __init_memblock memblock_reserve_reserved_regions(void)
-{
-	if (memblock.reserved.regions == memblock_reserved_init_regions)
-		return 0;
-
-	return memblock_reserve(__pa(memblock.reserved.regions),
-		 sizeof(struct memblock_region) * memblock.reserved.max);
-}
-
 static void __init_memblock memblock_remove_region(struct memblock_type *type, unsigned long r)
 {
 	type->total_size -= type->regions[r].size;
@@ -182,11 +160,42 @@
 	}
 }
 
-static int __init_memblock memblock_double_array(struct memblock_type *type)
+phys_addr_t __init_memblock get_allocated_memblock_reserved_regions_info(
+					phys_addr_t *addr)
+{
+	if (memblock.reserved.regions == memblock_reserved_init_regions)
+		return 0;
+
+	*addr = __pa(memblock.reserved.regions);
+
+	return PAGE_ALIGN(sizeof(struct memblock_region) *
+			  memblock.reserved.max);
+}
+
+/**
+ * memblock_double_array - double the size of the memblock regions array
+ * @type: memblock type of the regions array being doubled
+ * @new_area_start: starting address of memory range to avoid overlap with
+ * @new_area_size: size of memory range to avoid overlap with
+ *
+ * Double the size of the @type regions array. If memblock is being used to
+ * allocate memory for a new reserved regions array and there is a previously
+ * allocated memory range [@new_area_start,@new_area_start+@new_area_size]
+ * waiting to be reserved, ensure the memory used by the new array does
+ * not overlap.
+ *
+ * RETURNS:
+ * 0 on success, -1 on failure.
+ */
+static int __init_memblock memblock_double_array(struct memblock_type *type,
+						phys_addr_t new_area_start,
+						phys_addr_t new_area_size)
 {
 	struct memblock_region *new_array, *old_array;
+	phys_addr_t old_alloc_size, new_alloc_size;
 	phys_addr_t old_size, new_size, addr;
 	int use_slab = slab_is_available();
+	int *in_slab;
 
 	/* We don't allow resizing until we know about the reserved regions
 	 * of memory that aren't suitable for allocation
@@ -197,6 +206,18 @@
 	/* Calculate new doubled size */
 	old_size = type->max * sizeof(struct memblock_region);
 	new_size = old_size << 1;
+	/*
+	 * We need to allocated new one align to PAGE_SIZE,
+	 *   so we can free them completely later.
+	 */
+	old_alloc_size = PAGE_ALIGN(old_size);
+	new_alloc_size = PAGE_ALIGN(new_size);
+
+	/* Retrieve the slab flag */
+	if (type == &memblock.memory)
+		in_slab = &memblock_memory_in_slab;
+	else
+		in_slab = &memblock_reserved_in_slab;
 
 	/* Try to find some space for it.
 	 *
@@ -212,14 +233,26 @@
 	if (use_slab) {
 		new_array = kmalloc(new_size, GFP_KERNEL);
 		addr = new_array ? __pa(new_array) : 0;
-	} else
-		addr = memblock_find_in_range(0, MEMBLOCK_ALLOC_ACCESSIBLE, new_size, sizeof(phys_addr_t));
+	} else {
+		/* only exclude range when trying to double reserved.regions */
+		if (type != &memblock.reserved)
+			new_area_start = new_area_size = 0;
+
+		addr = memblock_find_in_range(new_area_start + new_area_size,
+						memblock.current_limit,
+						new_alloc_size, PAGE_SIZE);
+		if (!addr && new_area_size)
+			addr = memblock_find_in_range(0,
+					min(new_area_start, memblock.current_limit),
+					new_alloc_size, PAGE_SIZE);
+
+		new_array = addr ? __va(addr) : 0;
+	}
 	if (!addr) {
 		pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n",
 		       memblock_type_name(type), type->max, type->max * 2);
 		return -1;
 	}
-	new_array = __va(addr);
 
 	memblock_dbg("memblock: %s array is doubled to %ld at [%#010llx-%#010llx]",
 		 memblock_type_name(type), type->max * 2, (u64)addr, (u64)addr + new_size - 1);
@@ -234,21 +267,23 @@
 	type->regions = new_array;
 	type->max <<= 1;
 
-	/* If we use SLAB that's it, we are done */
-	if (use_slab)
-		return 0;
-
-	/* Add the new reserved region now. Should not fail ! */
-	BUG_ON(memblock_reserve(addr, new_size));
-
-	/* If the array wasn't our static init one, then free it. We only do
-	 * that before SLAB is available as later on, we don't know whether
-	 * to use kfree or free_bootmem_pages(). Shouldn't be a big deal
-	 * anyways
+	/* Free old array. We needn't free it if the array is the
+	 * static one
 	 */
-	if (old_array != memblock_memory_init_regions &&
-	    old_array != memblock_reserved_init_regions)
-		memblock_free(__pa(old_array), old_size);
+	if (*in_slab)
+		kfree(old_array);
+	else if (old_array != memblock_memory_init_regions &&
+		 old_array != memblock_reserved_init_regions)
+		memblock_free(__pa(old_array), old_alloc_size);
+
+	/* Reserve the new array if that comes from the memblock.
+	 * Otherwise, we needn't do it
+	 */
+	if (!use_slab)
+		BUG_ON(memblock_reserve(addr, new_alloc_size));
+
+	/* Update slab flag */
+	*in_slab = use_slab;
 
 	return 0;
 }
@@ -387,7 +422,7 @@
 	 */
 	if (!insert) {
 		while (type->cnt + nr_new > type->max)
-			if (memblock_double_array(type) < 0)
+			if (memblock_double_array(type, obase, size) < 0)
 				return -ENOMEM;
 		insert = true;
 		goto repeat;
@@ -438,7 +473,7 @@
 
 	/* we'll create at most two more regions */
 	while (type->cnt + 2 > type->max)
-		if (memblock_double_array(type) < 0)
+		if (memblock_double_array(type, base, size) < 0)
 			return -ENOMEM;
 
 	for (i = 0; i < type->cnt; i++) {
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index c99ad4e..9299eea 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -345,14 +345,14 @@
  * Also when FAIL is set do a force kill because something went
  * wrong earlier.
  */
-static void kill_procs(struct list_head *to_kill, int doit, int trapno,
+static void kill_procs(struct list_head *to_kill, int forcekill, int trapno,
 			  int fail, struct page *page, unsigned long pfn,
 			  int flags)
 {
 	struct to_kill *tk, *next;
 
 	list_for_each_entry_safe (tk, next, to_kill, nd) {
-		if (doit) {
+		if (forcekill) {
 			/*
 			 * In case something went wrong with munmapping
 			 * make sure the process doesn't catch the
@@ -858,7 +858,7 @@
 	struct address_space *mapping;
 	LIST_HEAD(tokill);
 	int ret;
-	int kill = 1;
+	int kill = 1, forcekill;
 	struct page *hpage = compound_head(p);
 	struct page *ppage;
 
@@ -888,7 +888,7 @@
 	 * be called inside page lock (it's recommended but not enforced).
 	 */
 	mapping = page_mapping(hpage);
-	if (!PageDirty(hpage) && mapping &&
+	if (!(flags & MF_MUST_KILL) && !PageDirty(hpage) && mapping &&
 	    mapping_cap_writeback_dirty(mapping)) {
 		if (page_mkclean(hpage)) {
 			SetPageDirty(hpage);
@@ -965,12 +965,14 @@
 	 * Now that the dirty bit has been propagated to the
 	 * struct page and all unmaps done we can decide if
 	 * killing is needed or not.  Only kill when the page
-	 * was dirty, otherwise the tokill list is merely
+	 * was dirty or the process is not restartable,
+	 * otherwise the tokill list is merely
 	 * freed.  When there was a problem unmapping earlier
 	 * use a more force-full uncatchable kill to prevent
 	 * any accesses to the poisoned memory.
 	 */
-	kill_procs(&tokill, !!PageDirty(ppage), trapno,
+	forcekill = PageDirty(ppage) || (flags & MF_MUST_KILL);
+	kill_procs(&tokill, forcekill, trapno,
 		      ret != SWAP_SUCCESS, p, pfn, flags);
 
 	return ret;
@@ -1431,8 +1433,8 @@
 	/* Keep page count to indicate a given hugepage is isolated. */
 
 	list_add(&hpage->lru, &pagelist);
-	ret = migrate_huge_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, 0,
-				true);
+	ret = migrate_huge_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, false,
+				MIGRATE_SYNC);
 	if (ret) {
 		struct page *page1, *page2;
 		list_for_each_entry_safe(page1, page2, &pagelist, lru)
@@ -1561,7 +1563,7 @@
 					    page_is_file_cache(page));
 		list_add(&page->lru, &pagelist);
 		ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
-							0, MIGRATE_SYNC);
+							false, MIGRATE_SYNC);
 		if (ret) {
 			putback_lru_pages(&pagelist);
 			pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index b195691..bf5b485 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -607,27 +607,6 @@
 	return first;
 }
 
-/* Apply policy to a single VMA */
-static int policy_vma(struct vm_area_struct *vma, struct mempolicy *new)
-{
-	int err = 0;
-	struct mempolicy *old = vma->vm_policy;
-
-	pr_debug("vma %lx-%lx/%lx vm_ops %p vm_file %p set_policy %p\n",
-		 vma->vm_start, vma->vm_end, vma->vm_pgoff,
-		 vma->vm_ops, vma->vm_file,
-		 vma->vm_ops ? vma->vm_ops->set_policy : NULL);
-
-	if (vma->vm_ops && vma->vm_ops->set_policy)
-		err = vma->vm_ops->set_policy(vma, new);
-	if (!err) {
-		mpol_get(new);
-		vma->vm_policy = new;
-		mpol_put(old);
-	}
-	return err;
-}
-
 /* Step 2: apply policy to a range and do splits. */
 static int mbind_range(struct mm_struct *mm, unsigned long start,
 		       unsigned long end, struct mempolicy *new_pol)
@@ -676,9 +655,23 @@
 			if (err)
 				goto out;
 		}
-		err = policy_vma(vma, new_pol);
-		if (err)
-			goto out;
+
+		/*
+		 * Apply policy to a single VMA. The reference counting of
+		 * policy for vma_policy linkages has already been handled by
+		 * vma_merge and split_vma as necessary. If this is a shared
+		 * policy then ->set_policy will increment the reference count
+		 * for an sp node.
+		 */
+		pr_debug("vma %lx-%lx/%lx vm_ops %p vm_file %p set_policy %p\n",
+			vma->vm_start, vma->vm_end, vma->vm_pgoff,
+			vma->vm_ops, vma->vm_file,
+			vma->vm_ops ? vma->vm_ops->set_policy : NULL);
+		if (vma->vm_ops && vma->vm_ops->set_policy) {
+			err = vma->vm_ops->set_policy(vma, new_pol);
+			if (err)
+				goto out;
+		}
 	}
 
  out:
diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
index 9a611d3..862b608 100644
--- a/mm/mmu_notifier.c
+++ b/mm/mmu_notifier.c
@@ -33,6 +33,24 @@
 void __mmu_notifier_release(struct mm_struct *mm)
 {
 	struct mmu_notifier *mn;
+	struct hlist_node *n;
+
+	/*
+	 * RCU here will block mmu_notifier_unregister until
+	 * ->release returns.
+	 */
+	rcu_read_lock();
+	hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_mm->list, hlist)
+		/*
+		 * if ->release runs before mmu_notifier_unregister it
+		 * must be handled as it's the only way for the driver
+		 * to flush all existing sptes and stop the driver
+		 * from establishing any more sptes before all the
+		 * pages in the mm are freed.
+		 */
+		if (mn->ops->release)
+			mn->ops->release(mn, mm);
+	rcu_read_unlock();
 
 	spin_lock(&mm->mmu_notifier_mm->lock);
 	while (unlikely(!hlist_empty(&mm->mmu_notifier_mm->list))) {
@@ -46,23 +64,6 @@
 		 * mmu_notifier_unregister to return.
 		 */
 		hlist_del_init_rcu(&mn->hlist);
-		/*
-		 * RCU here will block mmu_notifier_unregister until
-		 * ->release returns.
-		 */
-		rcu_read_lock();
-		spin_unlock(&mm->mmu_notifier_mm->lock);
-		/*
-		 * if ->release runs before mmu_notifier_unregister it
-		 * must be handled as it's the only way for the driver
-		 * to flush all existing sptes and stop the driver
-		 * from establishing any more sptes before all the
-		 * pages in the mm are freed.
-		 */
-		if (mn->ops->release)
-			mn->ops->release(mn, mm);
-		rcu_read_unlock();
-		spin_lock(&mm->mmu_notifier_mm->lock);
 	}
 	spin_unlock(&mm->mmu_notifier_mm->lock);
 
@@ -284,16 +285,13 @@
 {
 	BUG_ON(atomic_read(&mm->mm_count) <= 0);
 
-	spin_lock(&mm->mmu_notifier_mm->lock);
 	if (!hlist_unhashed(&mn->hlist)) {
-		hlist_del_rcu(&mn->hlist);
-
 		/*
 		 * RCU here will force exit_mmap to wait ->release to finish
 		 * before freeing the pages.
 		 */
 		rcu_read_lock();
-		spin_unlock(&mm->mmu_notifier_mm->lock);
+
 		/*
 		 * exit_mmap will block in mmu_notifier_release to
 		 * guarantee ->release is called before freeing the
@@ -302,8 +300,11 @@
 		if (mn->ops->release)
 			mn->ops->release(mn, mm);
 		rcu_read_unlock();
-	} else
+
+		spin_lock(&mm->mmu_notifier_mm->lock);
+		hlist_del_rcu(&mn->hlist);
 		spin_unlock(&mm->mmu_notifier_mm->lock);
+	}
 
 	/*
 	 * Wait any running method to finish, of course including
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index 1983fb1..218e6f9 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -105,27 +105,35 @@
 		__free_pages_bootmem(pfn_to_page(i), 0);
 }
 
+static unsigned long __init __free_memory_core(phys_addr_t start,
+				 phys_addr_t end)
+{
+	unsigned long start_pfn = PFN_UP(start);
+	unsigned long end_pfn = min_t(unsigned long,
+				      PFN_DOWN(end), max_low_pfn);
+
+	if (start_pfn > end_pfn)
+		return 0;
+
+	__free_pages_memory(start_pfn, end_pfn);
+
+	return end_pfn - start_pfn;
+}
+
 unsigned long __init free_low_memory_core_early(int nodeid)
 {
 	unsigned long count = 0;
-	phys_addr_t start, end;
+	phys_addr_t start, end, size;
 	u64 i;
 
-	/* free reserved array temporarily so that it's treated as free area */
-	memblock_free_reserved_regions();
+	for_each_free_mem_range(i, MAX_NUMNODES, &start, &end, NULL)
+		count += __free_memory_core(start, end);
 
-	for_each_free_mem_range(i, MAX_NUMNODES, &start, &end, NULL) {
-		unsigned long start_pfn = PFN_UP(start);
-		unsigned long end_pfn = min_t(unsigned long,
-					      PFN_DOWN(end), max_low_pfn);
-		if (start_pfn < end_pfn) {
-			__free_pages_memory(start_pfn, end_pfn);
-			count += end_pfn - start_pfn;
-		}
-	}
+	/* free range that is used for reserved array if we allocate it */
+	size = get_allocated_memblock_reserved_regions_info(&start);
+	if (size)
+		count += __free_memory_core(start, start + size);
 
-	/* put region array back? */
-	memblock_reserve_reserved_regions();
 	return count;
 }
 
diff --git a/mm/shmem.c b/mm/shmem.c
index e281f06..2910f0d 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1365,6 +1365,7 @@
 	struct splice_pipe_desc spd = {
 		.pages = pages,
 		.partial = partial,
+		.nr_pages_max = PIPE_DEF_BUFFERS,
 		.flags = flags,
 		.ops = &page_cache_pipe_buf_ops,
 		.spd_release = spd_release_page,
@@ -1453,7 +1454,7 @@
 	if (spd.nr_pages)
 		error = splice_to_pipe(pipe, &spd);
 
-	splice_shrink_spd(pipe, &spd);
+	splice_shrink_spd(&spd);
 
 	if (error > 0) {
 		*ppos += error;
diff --git a/mm/slub.c b/mm/slub.c
index 80848cd..71de9b5 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1514,15 +1514,19 @@
 		freelist = page->freelist;
 		counters = page->counters;
 		new.counters = counters;
-		if (mode)
+		if (mode) {
 			new.inuse = page->objects;
+			new.freelist = NULL;
+		} else {
+			new.freelist = freelist;
+		}
 
 		VM_BUG_ON(new.frozen);
 		new.frozen = 1;
 
 	} while (!__cmpxchg_double_slab(s, page,
 			freelist, counters,
-			NULL, new.counters,
+			new.freelist, new.counters,
 			"lock and freeze"));
 
 	remove_partial(n, page);
@@ -1564,7 +1568,6 @@
 			object = t;
 			available =  page->objects - page->inuse;
 		} else {
-			page->freelist = t;
 			available = put_cpu_partial(s, page, 0);
 			stat(s, CPU_PARTIAL_NODE);
 		}
diff --git a/mm/swapfile.c b/mm/swapfile.c
index fafc26d..38186d9 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1924,24 +1924,20 @@
 
 	/*
 	 * Find out how many pages are allowed for a single swap
-	 * device. There are three limiting factors: 1) the number
+	 * device. There are two limiting factors: 1) the number
 	 * of bits for the swap offset in the swp_entry_t type, and
 	 * 2) the number of bits in the swap pte as defined by the
-	 * the different architectures, and 3) the number of free bits
-	 * in an exceptional radix_tree entry. In order to find the
+	 * different architectures. In order to find the
 	 * largest possible bit mask, a swap entry with swap type 0
 	 * and swap offset ~0UL is created, encoded to a swap pte,
 	 * decoded to a swp_entry_t again, and finally the swap
 	 * offset is extracted. This will mask all the bits from
 	 * the initial ~0UL mask that can't be encoded in either
 	 * the swp_entry_t or the architecture definition of a
-	 * swap pte.  Then the same is done for a radix_tree entry.
+	 * swap pte.
 	 */
 	maxpages = swp_offset(pte_to_swp_entry(
-			swp_entry_to_pte(swp_entry(0, ~0UL))));
-	maxpages = swp_offset(radix_to_swp_entry(
-			swp_to_radix_entry(swp_entry(0, maxpages)))) + 1;
-
+			swp_entry_to_pte(swp_entry(0, ~0UL)))) + 1;
 	if (maxpages > swap_header->info.last_page) {
 		maxpages = swap_header->info.last_page + 1;
 		/* p->max is an unsigned int: don't overflow it */
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 33dc256..be5bc0a 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -722,7 +722,7 @@
 		return PAGEREF_RECLAIM;
 
 	if (referenced_ptes) {
-		if (PageAnon(page))
+		if (PageSwapBacked(page))
 			return PAGEREF_ACTIVATE;
 		/*
 		 * All mapped pages start out with page table
@@ -3013,7 +3013,10 @@
 		 * them before going back to sleep.
 		 */
 		set_pgdat_percpu_threshold(pgdat, calculate_normal_threshold);
-		schedule();
+
+		if (!kthread_should_stop())
+			schedule();
+
 		set_pgdat_percpu_threshold(pgdat, calculate_pressure_threshold);
 	} else {
 		if (remaining)
@@ -3279,14 +3282,17 @@
 }
 
 /*
- * Called by memory hotplug when all memory in a node is offlined.
+ * Called by memory hotplug when all memory in a node is offlined.  Caller must
+ * hold lock_memory_hotplug().
  */
 void kswapd_stop(int nid)
 {
 	struct task_struct *kswapd = NODE_DATA(nid)->kswapd;
 
-	if (kswapd)
+	if (kswapd) {
 		kthread_stop(kswapd);
+		NODE_DATA(nid)->kswapd = NULL;
+	}
 }
 
 static int __init kswapd_init(void)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index efea35b..cf4a49c 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -403,6 +403,9 @@
 		break;
 
 	case NETDEV_DOWN:
+		if (dev->features & NETIF_F_HW_VLAN_FILTER)
+			vlan_vid_del(dev, 0);
+
 		/* Put all VLANs for this dev in the down state too.  */
 		for (i = 0; i < VLAN_N_VID; i++) {
 			vlandev = vlan_group_get_device(grp, i);
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 3d43206..052d343 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -192,10 +192,10 @@
 		s = rest_of_page(data);
 		if (s > count)
 			s = count;
+		BUG_ON(index > limit);
 		sg_set_buf(&sg[index++], data, s);
 		count -= s;
 		data += s;
-		BUG_ON(index > limit);
 	}
 
 	return index-start;
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 7f8e158..8df3a1f 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -618,6 +618,8 @@
 			 * changes */
 			if (skb_linearize(skb) < 0)
 				goto out;
+			/* skb_linearize() possibly changed skb->data */
+			tt_query = (struct tt_query_packet *)skb->data;
 
 			tt_len = tt_query->tt_data * sizeof(struct tt_change);
 
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 1f86921..f014bf8 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1803,10 +1803,10 @@
 {
 	struct tt_local_entry *tt_local_entry = NULL;
 	struct tt_global_entry *tt_global_entry = NULL;
-	bool ret = true;
+	bool ret = false;
 
 	if (!atomic_read(&bat_priv->ap_isolation))
-		return false;
+		goto out;
 
 	tt_local_entry = tt_local_hash_find(bat_priv, dst);
 	if (!tt_local_entry)
@@ -1816,10 +1816,10 @@
 	if (!tt_global_entry)
 		goto out;
 
-	if (_is_ap_isolated(tt_local_entry, tt_global_entry))
+	if (!_is_ap_isolated(tt_local_entry, tt_global_entry))
 		goto out;
 
-	ret = false;
+	ret = true;
 
 out:
 	if (tt_global_entry)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 0a942fb..e1144e1 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -240,6 +240,7 @@
 		return -ENOMEM;
 
 	dev_net_set(dev, net);
+	dev->rtnl_link_ops = &br_link_ops;
 
 	res = register_netdev(dev);
 	if (res)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index a1daf82..cbf9ccd 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -211,7 +211,7 @@
 	return 0;
 }
 
-static struct rtnl_link_ops br_link_ops __read_mostly = {
+struct rtnl_link_ops br_link_ops __read_mostly = {
 	.kind		= "bridge",
 	.priv_size	= sizeof(struct net_bridge),
 	.setup		= br_dev_setup,
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index e1d8822..51e8826 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -538,6 +538,7 @@
 #endif
 
 /* br_netlink.c */
+extern struct rtnl_link_ops br_link_ops;
 extern int br_netlink_init(void);
 extern void br_netlink_fini(void);
 extern void br_ifinfo_notify(int event, struct net_bridge_port *port);
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index aa6f716..7bf4c21 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -562,9 +562,9 @@
 
 static void __exit caif_device_exit(void)
 {
-	unregister_pernet_subsys(&caif_net_ops);
 	unregister_netdevice_notifier(&caif_device_notifier);
 	dev_remove_pack(&caif_packet_type);
+	unregister_pernet_subsys(&caif_net_ops);
 }
 
 module_init(caif_device_init);
diff --git a/net/can/raw.c b/net/can/raw.c
index cde1b4a..46cca3a 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -681,9 +681,6 @@
 	if (err < 0)
 		goto free_skb;
 
-	/* to be able to check the received tx sock reference in raw_rcv() */
-	skb_shinfo(skb)->tx_flags |= SKBTX_DRV_NEEDS_SK_REF;
-
 	skb->dev = dev;
 	skb->sk  = sk;
 
diff --git a/net/compat.c b/net/compat.c
index e055708..ae6d67a 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -221,6 +221,8 @@
 {
 	struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
 	struct compat_cmsghdr cmhdr;
+	struct compat_timeval ctv;
+	struct compat_timespec cts[3];
 	int cmlen;
 
 	if (cm == NULL || kmsg->msg_controllen < sizeof(*cm)) {
@@ -229,8 +231,6 @@
 	}
 
 	if (!COMPAT_USE_64BIT_TIME) {
-		struct compat_timeval ctv;
-		struct compat_timespec cts[3];
 		if (level == SOL_SOCKET && type == SCM_TIMESTAMP) {
 			struct timeval *tv = (struct timeval *)data;
 			ctv.tv_sec = tv->tv_sec;
diff --git a/net/core/dev.c b/net/core/dev.c
index 99e1d75..c299416 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1173,6 +1173,7 @@
 		net_dmaengine_get();
 		dev_set_rx_mode(dev);
 		dev_activate(dev);
+		add_device_randomness(dev->dev_addr, dev->addr_len);
 	}
 
 	return ret;
@@ -2091,25 +2092,6 @@
 	return 0;
 }
 
-/*
- * Try to orphan skb early, right before transmission by the device.
- * We cannot orphan skb if tx timestamp is requested or the sk-reference
- * is needed on driver level for other reasons, e.g. see net/can/raw.c
- */
-static inline void skb_orphan_try(struct sk_buff *skb)
-{
-	struct sock *sk = skb->sk;
-
-	if (sk && !skb_shinfo(skb)->tx_flags) {
-		/* skb_tx_hash() wont be able to get sk.
-		 * We copy sk_hash into skb->rxhash
-		 */
-		if (!skb->rxhash)
-			skb->rxhash = sk->sk_hash;
-		skb_orphan(skb);
-	}
-}
-
 static bool can_checksum_protocol(netdev_features_t features, __be16 protocol)
 {
 	return ((features & NETIF_F_GEN_CSUM) ||
@@ -2195,8 +2177,6 @@
 		if (!list_empty(&ptype_all))
 			dev_queue_xmit_nit(skb, dev);
 
-		skb_orphan_try(skb);
-
 		features = netif_skb_features(skb);
 
 		if (vlan_tx_tag_present(skb) &&
@@ -2306,7 +2286,7 @@
 	if (skb->sk && skb->sk->sk_hash)
 		hash = skb->sk->sk_hash;
 	else
-		hash = (__force u16) skb->protocol ^ skb->rxhash;
+		hash = (__force u16) skb->protocol;
 	hash = jhash_1word(hash, hashrnd);
 
 	return (u16) (((u64) hash * qcount) >> 32) + qoffset;
@@ -4786,6 +4766,7 @@
 	err = ops->ndo_set_mac_address(dev, sa);
 	if (!err)
 		call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
+	add_device_randomness(dev->dev_addr, dev->addr_len);
 	return err;
 }
 EXPORT_SYMBOL(dev_set_mac_address);
@@ -5564,6 +5545,7 @@
 	dev_init_scheduler(dev);
 	dev_hold(dev);
 	list_netdevice(dev);
+	add_device_randomness(dev->dev_addr, dev->addr_len);
 
 	/* Notify protocols, that a new device appeared. */
 	ret = call_netdevice_notifiers(NETDEV_REGISTER, dev);
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index a7cad74..b856f87 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -33,9 +33,6 @@
 #define TRACE_ON 1
 #define TRACE_OFF 0
 
-static void send_dm_alert(struct work_struct *unused);
-
-
 /*
  * Globals, our netlink socket pointer
  * and the work handle that will send up
@@ -45,11 +42,10 @@
 static DEFINE_MUTEX(trace_state_mutex);
 
 struct per_cpu_dm_data {
-	struct work_struct dm_alert_work;
-	struct sk_buff __rcu *skb;
-	atomic_t dm_hit_count;
-	struct timer_list send_timer;
-	int cpu;
+	spinlock_t		lock;
+	struct sk_buff		*skb;
+	struct work_struct	dm_alert_work;
+	struct timer_list	send_timer;
 };
 
 struct dm_hw_stat_delta {
@@ -75,13 +71,13 @@
 static unsigned long dm_hw_check_delta = 2*HZ;
 static LIST_HEAD(hw_stats_list);
 
-static void reset_per_cpu_data(struct per_cpu_dm_data *data)
+static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
 {
 	size_t al;
 	struct net_dm_alert_msg *msg;
 	struct nlattr *nla;
 	struct sk_buff *skb;
-	struct sk_buff *oskb = rcu_dereference_protected(data->skb, 1);
+	unsigned long flags;
 
 	al = sizeof(struct net_dm_alert_msg);
 	al += dm_hit_limit * sizeof(struct net_dm_drop_point);
@@ -96,65 +92,40 @@
 				  sizeof(struct net_dm_alert_msg));
 		msg = nla_data(nla);
 		memset(msg, 0, al);
-	} else
-		schedule_work_on(data->cpu, &data->dm_alert_work);
-
-	/*
-	 * Don't need to lock this, since we are guaranteed to only
-	 * run this on a single cpu at a time.
-	 * Note also that we only update data->skb if the old and new skb
-	 * pointers don't match.  This ensures that we don't continually call
-	 * synchornize_rcu if we repeatedly fail to alloc a new netlink message.
-	 */
-	if (skb != oskb) {
-		rcu_assign_pointer(data->skb, skb);
-
-		synchronize_rcu();
-
-		atomic_set(&data->dm_hit_count, dm_hit_limit);
+	} else {
+		mod_timer(&data->send_timer, jiffies + HZ / 10);
 	}
 
+	spin_lock_irqsave(&data->lock, flags);
+	swap(data->skb, skb);
+	spin_unlock_irqrestore(&data->lock, flags);
+
+	return skb;
 }
 
-static void send_dm_alert(struct work_struct *unused)
+static void send_dm_alert(struct work_struct *work)
 {
 	struct sk_buff *skb;
-	struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data);
+	struct per_cpu_dm_data *data;
 
-	WARN_ON_ONCE(data->cpu != smp_processor_id());
+	data = container_of(work, struct per_cpu_dm_data, dm_alert_work);
 
-	/*
-	 * Grab the skb we're about to send
-	 */
-	skb = rcu_dereference_protected(data->skb, 1);
+	skb = reset_per_cpu_data(data);
 
-	/*
-	 * Replace it with a new one
-	 */
-	reset_per_cpu_data(data);
-
-	/*
-	 * Ship it!
-	 */
 	if (skb)
 		genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL);
-
-	put_cpu_var(dm_cpu_data);
 }
 
 /*
  * This is the timer function to delay the sending of an alert
  * in the event that more drops will arrive during the
- * hysteresis period.  Note that it operates under the timer interrupt
- * so we don't need to disable preemption here
+ * hysteresis period.
  */
-static void sched_send_work(unsigned long unused)
+static void sched_send_work(unsigned long _data)
 {
-	struct per_cpu_dm_data *data =  &get_cpu_var(dm_cpu_data);
+	struct per_cpu_dm_data *data = (struct per_cpu_dm_data *)_data;
 
-	schedule_work_on(smp_processor_id(), &data->dm_alert_work);
-
-	put_cpu_var(dm_cpu_data);
+	schedule_work(&data->dm_alert_work);
 }
 
 static void trace_drop_common(struct sk_buff *skb, void *location)
@@ -164,33 +135,28 @@
 	struct nlattr *nla;
 	int i;
 	struct sk_buff *dskb;
-	struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data);
+	struct per_cpu_dm_data *data;
+	unsigned long flags;
 
-
-	rcu_read_lock();
-	dskb = rcu_dereference(data->skb);
+	local_irq_save(flags);
+	data = &__get_cpu_var(dm_cpu_data);
+	spin_lock(&data->lock);
+	dskb = data->skb;
 
 	if (!dskb)
 		goto out;
 
-	if (!atomic_add_unless(&data->dm_hit_count, -1, 0)) {
-		/*
-		 * we're already at zero, discard this hit
-		 */
-		goto out;
-	}
-
 	nlh = (struct nlmsghdr *)dskb->data;
 	nla = genlmsg_data(nlmsg_data(nlh));
 	msg = nla_data(nla);
 	for (i = 0; i < msg->entries; i++) {
 		if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) {
 			msg->points[i].count++;
-			atomic_inc(&data->dm_hit_count);
 			goto out;
 		}
 	}
-
+	if (msg->entries == dm_hit_limit)
+		goto out;
 	/*
 	 * We need to create a new entry
 	 */
@@ -202,13 +168,11 @@
 
 	if (!timer_pending(&data->send_timer)) {
 		data->send_timer.expires = jiffies + dm_delay * HZ;
-		add_timer_on(&data->send_timer, smp_processor_id());
+		add_timer(&data->send_timer);
 	}
 
 out:
-	rcu_read_unlock();
-	put_cpu_var(dm_cpu_data);
-	return;
+	spin_unlock_irqrestore(&data->lock, flags);
 }
 
 static void trace_kfree_skb_hit(void *ignore, struct sk_buff *skb, void *location)
@@ -406,11 +370,11 @@
 
 	for_each_present_cpu(cpu) {
 		data = &per_cpu(dm_cpu_data, cpu);
-		data->cpu = cpu;
 		INIT_WORK(&data->dm_alert_work, send_dm_alert);
 		init_timer(&data->send_timer);
-		data->send_timer.data = cpu;
+		data->send_timer.data = (unsigned long)data;
 		data->send_timer.function = sched_send_work;
+		spin_lock_init(&data->lock);
 		reset_per_cpu_data(data);
 	}
 
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 0a68045..73b9035 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2214,9 +2214,7 @@
 	rcu_read_lock_bh();
 	nht = rcu_dereference_bh(tbl->nht);
 
-	for (h = 0; h < (1 << nht->hash_shift); h++) {
-		if (h < s_h)
-			continue;
+	for (h = s_h; h < (1 << nht->hash_shift); h++) {
 		if (h > s_h)
 			s_idx = 0;
 		for (n = rcu_dereference_bh(nht->hash_buckets[h]), idx = 0;
@@ -2255,9 +2253,7 @@
 
 	read_lock_bh(&tbl->lock);
 
-	for (h = 0; h <= PNEIGH_HASHMASK; h++) {
-		if (h < s_h)
-			continue;
+	for (h = s_h; h <= PNEIGH_HASHMASK; h++) {
 		if (h > s_h)
 			s_idx = 0;
 		for (n = tbl->phash_buckets[h], idx = 0; n; n = n->next) {
@@ -2292,7 +2288,7 @@
 	struct neigh_table *tbl;
 	int t, family, s_t;
 	int proxy = 0;
-	int err = 0;
+	int err;
 
 	read_lock(&neigh_tbl_lock);
 	family = ((struct rtgenmsg *) nlmsg_data(cb->nlh))->rtgen_family;
@@ -2306,7 +2302,7 @@
 
 	s_t = cb->args[0];
 
-	for (tbl = neigh_tables, t = 0; tbl && (err >= 0);
+	for (tbl = neigh_tables, t = 0; tbl;
 	     tbl = tbl->next, t++) {
 		if (t < s_t || (family && tbl->family != family))
 			continue;
@@ -2317,6 +2313,8 @@
 			err = pneigh_dump_table(tbl, skb, cb);
 		else
 			err = neigh_dump_table(tbl, skb, cb);
+		if (err < 0)
+			break;
 	}
 	read_unlock(&neigh_tbl_lock);
 
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 3d84fb9..f9f40b9 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -362,22 +362,23 @@
 
 void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
 {
-	int total_len, eth_len, ip_len, udp_len;
+	int total_len, ip_len, udp_len;
 	struct sk_buff *skb;
 	struct udphdr *udph;
 	struct iphdr *iph;
 	struct ethhdr *eth;
 
 	udp_len = len + sizeof(*udph);
-	ip_len = eth_len = udp_len + sizeof(*iph);
-	total_len = eth_len + ETH_HLEN + NET_IP_ALIGN;
+	ip_len = udp_len + sizeof(*iph);
+	total_len = ip_len + LL_RESERVED_SPACE(np->dev);
 
-	skb = find_skb(np, total_len, total_len - len);
+	skb = find_skb(np, total_len + np->dev->needed_tailroom,
+		       total_len - len);
 	if (!skb)
 		return;
 
 	skb_copy_to_linear_data(skb, msg, len);
-	skb->len += len;
+	skb_put(skb, len);
 
 	skb_push(skb, sizeof(*udph));
 	skb_reset_transport_header(skb);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 90430b7..900fc61 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -671,6 +671,12 @@
 	}
 }
 
+static unsigned int rtnl_dev_get_flags(const struct net_device *dev)
+{
+	return (dev->flags & ~(IFF_PROMISC | IFF_ALLMULTI)) |
+	       (dev->gflags & (IFF_PROMISC | IFF_ALLMULTI));
+}
+
 static unsigned int rtnl_dev_combine_flags(const struct net_device *dev,
 					   const struct ifinfomsg *ifm)
 {
@@ -679,7 +685,7 @@
 	/* bugwards compatibility: ifi_change == 0 is treated as ~0 */
 	if (ifm->ifi_change)
 		flags = (flags & ifm->ifi_change) |
-			(dev->flags & ~ifm->ifi_change);
+			(rtnl_dev_get_flags(dev) & ~ifm->ifi_change);
 
 	return flags;
 }
@@ -1370,6 +1376,7 @@
 			goto errout;
 		send_addr_notify = 1;
 		modified = 1;
+		add_device_randomness(dev->dev_addr, dev->addr_len);
 	}
 
 	if (tb[IFLA_MTU]) {
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index e598400..e99aedd 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1712,6 +1712,7 @@
 	struct splice_pipe_desc spd = {
 		.pages = pages,
 		.partial = partial,
+		.nr_pages_max = MAX_SKB_FRAGS,
 		.flags = flags,
 		.ops = &sock_pipe_buf_ops,
 		.spd_release = sock_spd_release,
@@ -1758,7 +1759,7 @@
 		lock_sock(sk);
 	}
 
-	splice_shrink_spd(pipe, &spd);
+	splice_shrink_spd(&spd);
 	return ret;
 }
 
diff --git a/net/core/sock.c b/net/core/sock.c
index b2e14c0..0f8402e 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1600,6 +1600,11 @@
 	gfp_t gfp_mask;
 	long timeo;
 	int err;
+	int npages = (data_len + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
+
+	err = -EMSGSIZE;
+	if (npages > MAX_SKB_FRAGS)
+		goto failure;
 
 	gfp_mask = sk->sk_allocation;
 	if (gfp_mask & __GFP_WAIT)
@@ -1618,14 +1623,12 @@
 		if (atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
 			skb = alloc_skb(header_len, gfp_mask);
 			if (skb) {
-				int npages;
 				int i;
 
 				/* No pages, we're done... */
 				if (!data_len)
 					break;
 
-				npages = (data_len + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
 				skb->truesize += data_len;
 				skb_shinfo(skb)->nr_frags = npages;
 				for (i = 0; i < npages; i++) {
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index c48adc5..667c1d4 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -1725,8 +1725,10 @@
 		case CIPSO_V4_TAG_LOCAL:
 			/* This is a non-standard tag that we only allow for
 			 * local connections, so if the incoming interface is
-			 * not the loopback device drop the packet. */
-			if (!(skb->dev->flags & IFF_LOOPBACK)) {
+			 * not the loopback device drop the packet. Further,
+			 * there is no legitimate reason for setting this from
+			 * userspace so reject it if skb is NULL. */
+			if (skb == NULL || !(skb->dev->flags & IFF_LOOPBACK)) {
 				err_offset = opt_iter;
 				goto validate_return_locked;
 			}
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 89a47b3..cb982a6 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -459,28 +459,22 @@
 	struct esp_data *esp = x->data;
 	u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4);
 	u32 align = max_t(u32, blksize, esp->padlen);
-	u32 rem;
-
-	mtu -= x->props.header_len + crypto_aead_authsize(esp->aead);
-	rem = mtu & (align - 1);
-	mtu &= ~(align - 1);
+	unsigned int net_adj;
 
 	switch (x->props.mode) {
+	case XFRM_MODE_TRANSPORT:
+	case XFRM_MODE_BEET:
+		net_adj = sizeof(struct iphdr);
+		break;
 	case XFRM_MODE_TUNNEL:
+		net_adj = 0;
 		break;
 	default:
-	case XFRM_MODE_TRANSPORT:
-		/* The worst case */
-		mtu -= blksize - 4;
-		mtu += min_t(u32, blksize - 4, rem);
-		break;
-	case XFRM_MODE_BEET:
-		/* The worst case. */
-		mtu += min_t(u32, IPV4_BEET_PHMAXLEN, rem);
-		break;
+		BUG();
 	}
 
-	return mtu - 2;
+	return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) -
+		 net_adj) & ~(align - 1)) + (net_adj - 2);
 }
 
 static void esp4_err(struct sk_buff *skb, u32 info)
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index d4d61b6..dfba343 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -560,6 +560,17 @@
 }
 EXPORT_SYMBOL(inet_peer_xrlim_allow);
 
+static void inetpeer_inval_rcu(struct rcu_head *head)
+{
+	struct inet_peer *p = container_of(head, struct inet_peer, gc_rcu);
+
+	spin_lock_bh(&gc_lock);
+	list_add_tail(&p->gc_list, &gc_list);
+	spin_unlock_bh(&gc_lock);
+
+	schedule_delayed_work(&gc_work, gc_delay);
+}
+
 void inetpeer_invalidate_tree(int family)
 {
 	struct inet_peer *old, *new, *prev;
@@ -576,10 +587,7 @@
 	prev = cmpxchg(&base->root, old, new);
 	if (prev == old) {
 		base->total = 0;
-		spin_lock(&gc_lock);
-		list_add_tail(&prev->gc_list, &gc_list);
-		spin_unlock(&gc_lock);
-		schedule_delayed_work(&gc_work, gc_delay);
+		call_rcu(&prev->gc_rcu, inetpeer_inval_rcu);
 	}
 
 out:
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index b2b0e99..64c356d 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2423,7 +2423,10 @@
 		/* Cap the max timeout in ms TCP will retry/retrans
 		 * before giving up and aborting (ETIMEDOUT) a connection.
 		 */
-		icsk->icsk_user_timeout = msecs_to_jiffies(val);
+		if (val < 0)
+			err = -EINVAL;
+		else
+			icsk->icsk_user_timeout = msecs_to_jiffies(val);
 		break;
 	default:
 		err = -ENOPROTOOPT;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 257b617..56a9c8d 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5441,7 +5441,9 @@
 			if (tp->copied_seq == tp->rcv_nxt &&
 			    len - tcp_header_len <= tp->ucopy.len) {
 #ifdef CONFIG_NET_DMA
-				if (tcp_dma_try_early_copy(sk, skb, tcp_header_len)) {
+				if (tp->ucopy.task == current &&
+				    sock_owned_by_user(sk) &&
+				    tcp_dma_try_early_copy(sk, skb, tcp_header_len)) {
 					copied_early = 1;
 					eaten = 1;
 				}
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 1ac7938..65dd543 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -411,19 +411,15 @@
 	struct esp_data *esp = x->data;
 	u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4);
 	u32 align = max_t(u32, blksize, esp->padlen);
-	u32 rem;
+	unsigned int net_adj;
 
-	mtu -= x->props.header_len + crypto_aead_authsize(esp->aead);
-	rem = mtu & (align - 1);
-	mtu &= ~(align - 1);
+	if (x->props.mode != XFRM_MODE_TUNNEL)
+		net_adj = sizeof(struct ipv6hdr);
+	else
+		net_adj = 0;
 
-	if (x->props.mode != XFRM_MODE_TUNNEL) {
-		u32 padsize = ((blksize - 1) & 7) + 1;
-		mtu -= blksize - padsize;
-		mtu += min_t(u32, blksize - padsize, rem);
-	}
-
-	return mtu - 2;
+	return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) -
+		 net_adj) & ~(align - 1)) + (net_adj - 2);
 }
 
 static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 9371743..92bb9cb 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1560,7 +1560,7 @@
 				neigh_flags = neigh->flags;
 				neigh_release(neigh);
 			}
-			if (neigh_flags & NTF_ROUTER) {
+			if (!(neigh_flags & NTF_ROUTER)) {
 				RT6_TRACE("purging route %p via non-router but gateway\n",
 					  rt);
 				return -1;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 02d7f1c..ec329a3 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1182,6 +1182,29 @@
 	return src ? kmemdup(src, (src->hdrlen + 1) * 8, gfp) : NULL;
 }
 
+static void ip6_append_data_mtu(int *mtu,
+				int *maxfraglen,
+				unsigned int fragheaderlen,
+				struct sk_buff *skb,
+				struct rt6_info *rt)
+{
+	if (!(rt->dst.flags & DST_XFRM_TUNNEL)) {
+		if (skb == NULL) {
+			/* first fragment, reserve header_len */
+			*mtu = *mtu - rt->dst.header_len;
+
+		} else {
+			/*
+			 * this fragment is not first, the headers
+			 * space is regarded as data space.
+			 */
+			*mtu = dst_mtu(rt->dst.path);
+		}
+		*maxfraglen = ((*mtu - fragheaderlen) & ~7)
+			      + fragheaderlen - sizeof(struct frag_hdr);
+	}
+}
+
 int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
 	int offset, int len, int odd, struct sk_buff *skb),
 	void *from, int length, int transhdrlen,
@@ -1191,7 +1214,7 @@
 	struct inet_sock *inet = inet_sk(sk);
 	struct ipv6_pinfo *np = inet6_sk(sk);
 	struct inet_cork *cork;
-	struct sk_buff *skb;
+	struct sk_buff *skb, *skb_prev = NULL;
 	unsigned int maxfraglen, fragheaderlen;
 	int exthdrlen;
 	int dst_exthdrlen;
@@ -1249,8 +1272,12 @@
 		inet->cork.fl.u.ip6 = *fl6;
 		np->cork.hop_limit = hlimit;
 		np->cork.tclass = tclass;
-		mtu = np->pmtudisc == IPV6_PMTUDISC_PROBE ?
-		      rt->dst.dev->mtu : dst_mtu(&rt->dst);
+		if (rt->dst.flags & DST_XFRM_TUNNEL)
+			mtu = np->pmtudisc == IPV6_PMTUDISC_PROBE ?
+			      rt->dst.dev->mtu : dst_mtu(&rt->dst);
+		else
+			mtu = np->pmtudisc == IPV6_PMTUDISC_PROBE ?
+			      rt->dst.dev->mtu : dst_mtu(rt->dst.path);
 		if (np->frag_size < mtu) {
 			if (np->frag_size)
 				mtu = np->frag_size;
@@ -1346,25 +1373,27 @@
 			unsigned int fraglen;
 			unsigned int fraggap;
 			unsigned int alloclen;
-			struct sk_buff *skb_prev;
 alloc_new_skb:
-			skb_prev = skb;
-
 			/* There's no room in the current skb */
-			if (skb_prev)
-				fraggap = skb_prev->len - maxfraglen;
+			if (skb)
+				fraggap = skb->len - maxfraglen;
 			else
 				fraggap = 0;
+			/* update mtu and maxfraglen if necessary */
+			if (skb == NULL || skb_prev == NULL)
+				ip6_append_data_mtu(&mtu, &maxfraglen,
+						    fragheaderlen, skb, rt);
+
+			skb_prev = skb;
 
 			/*
 			 * If remaining data exceeds the mtu,
 			 * we know we need more fragment(s).
 			 */
 			datalen = length + fraggap;
-			if (datalen > (cork->length <= mtu && !(cork->flags & IPCORK_ALLFRAG) ? mtu : maxfraglen) - fragheaderlen)
-				datalen = maxfraglen - fragheaderlen;
 
-			fraglen = datalen + fragheaderlen;
+			if (datalen > (cork->length <= mtu && !(cork->flags & IPCORK_ALLFRAG) ? mtu : maxfraglen) - fragheaderlen)
+				datalen = maxfraglen - fragheaderlen - rt->dst.trailer_len;
 			if ((flags & MSG_MORE) &&
 			    !(rt->dst.dev->features&NETIF_F_SG))
 				alloclen = mtu;
@@ -1373,13 +1402,16 @@
 
 			alloclen += dst_exthdrlen;
 
-			/*
-			 * The last fragment gets additional space at tail.
-			 * Note: we overallocate on fragments with MSG_MODE
-			 * because we have no idea if we're the last one.
-			 */
-			if (datalen == length + fraggap)
-				alloclen += rt->dst.trailer_len;
+			if (datalen != length + fraggap) {
+				/*
+				 * this is not the last fragment, the trailer
+				 * space is regarded as data space.
+				 */
+				datalen += rt->dst.trailer_len;
+			}
+
+			alloclen += rt->dst.trailer_len;
+			fraglen = datalen + fragheaderlen;
 
 			/*
 			 * We just reserve space for fragment header.
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index bc4888d..c4920ca 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2953,10 +2953,6 @@
 	net->ipv6.sysctl.ip6_rt_mtu_expires = 10*60*HZ;
 	net->ipv6.sysctl.ip6_rt_min_advmss = IPV6_MIN_MTU - 20 - 40;
 
-#ifdef CONFIG_PROC_FS
-	proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops);
-	proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops);
-#endif
 	net->ipv6.ip6_rt_gc_expire = 30*HZ;
 
 	ret = 0;
@@ -2977,10 +2973,6 @@
 
 static void __net_exit ip6_route_net_exit(struct net *net)
 {
-#ifdef CONFIG_PROC_FS
-	proc_net_remove(net, "ipv6_route");
-	proc_net_remove(net, "rt6_stats");
-#endif
 	kfree(net->ipv6.ip6_null_entry);
 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
 	kfree(net->ipv6.ip6_prohibit_entry);
@@ -2989,11 +2981,33 @@
 	dst_entries_destroy(&net->ipv6.ip6_dst_ops);
 }
 
+static int __net_init ip6_route_net_init_late(struct net *net)
+{
+#ifdef CONFIG_PROC_FS
+	proc_net_fops_create(net, "ipv6_route", 0, &ipv6_route_proc_fops);
+	proc_net_fops_create(net, "rt6_stats", S_IRUGO, &rt6_stats_seq_fops);
+#endif
+	return 0;
+}
+
+static void __net_exit ip6_route_net_exit_late(struct net *net)
+{
+#ifdef CONFIG_PROC_FS
+	proc_net_remove(net, "ipv6_route");
+	proc_net_remove(net, "rt6_stats");
+#endif
+}
+
 static struct pernet_operations ip6_route_net_ops = {
 	.init = ip6_route_net_init,
 	.exit = ip6_route_net_exit,
 };
 
+static struct pernet_operations ip6_route_net_late_ops = {
+	.init = ip6_route_net_init_late,
+	.exit = ip6_route_net_exit_late,
+};
+
 static struct notifier_block ip6_route_dev_notifier = {
 	.notifier_call = ip6_route_dev_notify,
 	.priority = 0,
@@ -3043,19 +3057,25 @@
 	if (ret)
 		goto xfrm6_init;
 
+	ret = register_pernet_subsys(&ip6_route_net_late_ops);
+	if (ret)
+		goto fib6_rules_init;
+
 	ret = -ENOBUFS;
 	if (__rtnl_register(PF_INET6, RTM_NEWROUTE, inet6_rtm_newroute, NULL, NULL) ||
 	    __rtnl_register(PF_INET6, RTM_DELROUTE, inet6_rtm_delroute, NULL, NULL) ||
 	    __rtnl_register(PF_INET6, RTM_GETROUTE, inet6_rtm_getroute, NULL, NULL))
-		goto fib6_rules_init;
+		goto out_register_late_subsys;
 
 	ret = register_netdevice_notifier(&ip6_route_dev_notifier);
 	if (ret)
-		goto fib6_rules_init;
+		goto out_register_late_subsys;
 
 out:
 	return ret;
 
+out_register_late_subsys:
+	unregister_pernet_subsys(&ip6_route_net_late_ops);
 fib6_rules_init:
 	fib6_rules_cleanup();
 xfrm6_init:
@@ -3074,6 +3094,7 @@
 void ip6_route_cleanup(void)
 {
 	unregister_netdevice_notifier(&ip6_route_dev_notifier);
+	unregister_pernet_subsys(&ip6_route_net_late_ops);
 	fib6_rules_cleanup();
 	xfrm6_fini();
 	fib6_gc_cleanup();
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 07d7d55..cd6f7a9 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -372,7 +372,6 @@
 			skb_trim(skb, skb->dev->mtu);
 	}
 	skb->protocol = ETH_P_AF_IUCV;
-	skb_shinfo(skb)->tx_flags |= SKBTX_DRV_NEEDS_SK_REF;
 	nskb = skb_clone(skb, GFP_ATOMIC);
 	if (!nskb)
 		return -ENOMEM;
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index 63fe5f3..7446038 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -167,6 +167,7 @@
 		if (dev) {
 			unregister_netdev(dev);
 			spriv->dev = NULL;
+			module_put(THIS_MODULE);
 		}
 	}
 }
@@ -254,6 +255,7 @@
 	if (rc < 0)
 		goto out_del_dev;
 
+	__module_get(THIS_MODULE);
 	/* Must be done after register_netdev() */
 	strlcpy(session->ifname, dev->name, IFNAMSIZ);
 
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 6274f0b..b1d4370 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -251,9 +251,16 @@
 {
 	struct inet_sock *inet = inet_sk(sk);
 	struct sockaddr_l2tpip *addr = (struct sockaddr_l2tpip *) uaddr;
-	int ret = -EINVAL;
+	int ret;
 	int chk_addr_ret;
 
+	if (!sock_flag(sk, SOCK_ZAPPED))
+		return -EINVAL;
+	if (addr_len < sizeof(struct sockaddr_l2tpip))
+		return -EINVAL;
+	if (addr->l2tp_family != AF_INET)
+		return -EINVAL;
+
 	ret = -EADDRINUSE;
 	read_lock_bh(&l2tp_ip_lock);
 	if (__l2tp_ip_bind_lookup(&init_net, addr->l2tp_addr.s_addr, sk->sk_bound_dev_if, addr->l2tp_conn_id))
@@ -284,6 +291,8 @@
 	sk_del_node_init(sk);
 	write_unlock_bh(&l2tp_ip_lock);
 	ret = 0;
+	sock_reset_flag(sk, SOCK_ZAPPED);
+
 out:
 	release_sock(sk);
 
@@ -304,13 +313,14 @@
 	__be32 saddr;
 	int oif, rc;
 
-	rc = -EINVAL;
-	if (addr_len < sizeof(*lsa))
-		goto out;
+	if (sock_flag(sk, SOCK_ZAPPED)) /* Must bind first - autobinding does not work */
+		return -EINVAL;
 
-	rc = -EAFNOSUPPORT;
+	if (addr_len < sizeof(*lsa))
+		return -EINVAL;
+
 	if (lsa->l2tp_family != AF_INET)
-		goto out;
+		return -EAFNOSUPPORT;
 
 	lock_sock(sk);
 
@@ -364,6 +374,14 @@
 	return rc;
 }
 
+static int l2tp_ip_disconnect(struct sock *sk, int flags)
+{
+	if (sock_flag(sk, SOCK_ZAPPED))
+		return 0;
+
+	return udp_disconnect(sk, flags);
+}
+
 static int l2tp_ip_getname(struct socket *sock, struct sockaddr *uaddr,
 			   int *uaddr_len, int peer)
 {
@@ -498,10 +516,12 @@
 					   sk->sk_bound_dev_if);
 		if (IS_ERR(rt))
 			goto no_route;
-		if (connected)
+		if (connected) {
 			sk_setup_caps(sk, &rt->dst);
-		else
-			dst_release(&rt->dst); /* safe since we hold rcu_read_lock */
+		} else {
+			skb_dst_set(skb, &rt->dst);
+			goto xmit;
+		}
 	}
 
 	/* We dont need to clone dst here, it is guaranteed to not disappear.
@@ -509,6 +529,7 @@
 	 */
 	skb_dst_set_noref(skb, &rt->dst);
 
+xmit:
 	/* Queue the packet to IP for output */
 	rc = ip_queue_xmit(skb, &inet->cork.fl);
 	rcu_read_unlock();
@@ -599,7 +620,7 @@
 	.close		   = l2tp_ip_close,
 	.bind		   = l2tp_ip_bind,
 	.connect	   = l2tp_ip_connect,
-	.disconnect	   = udp_disconnect,
+	.disconnect	   = l2tp_ip_disconnect,
 	.ioctl		   = udp_ioctl,
 	.destroy	   = l2tp_ip_destroy_sock,
 	.setsockopt	   = ip_setsockopt,
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index c20051b..48f937e 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -514,6 +514,18 @@
 		ieee80211_configure_filter(local);
 		break;
 	default:
+		mutex_lock(&local->mtx);
+		if (local->hw_roc_dev == sdata->dev &&
+		    local->hw_roc_channel) {
+			/* ignore return value since this is racy */
+			drv_cancel_remain_on_channel(local);
+			ieee80211_queue_work(&local->hw, &local->hw_roc_done);
+		}
+		mutex_unlock(&local->mtx);
+
+		flush_work(&local->hw_roc_start);
+		flush_work(&local->hw_roc_done);
+
 		flush_work(&sdata->work);
 		/*
 		 * When we get here, the interface is marked down.
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index e5fbb7c..e80fa33 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -595,6 +595,7 @@
 
 	del_timer_sync(&sdata->u.mesh.housekeeping_timer);
 	del_timer_sync(&sdata->u.mesh.mesh_path_root_timer);
+	del_timer_sync(&sdata->u.mesh.mesh_path_timer);
 	/*
 	 * If the timer fired while we waited for it, it will have
 	 * requeued the work. Now the work will be running again
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a48a35c..a382a91 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -187,7 +187,7 @@
 	u32 changed = 0;
 	int hti_cfreq;
 	u16 ht_opmode;
-	bool enable_ht = true;
+	bool enable_ht = true, queues_stopped = false;
 	enum nl80211_channel_type prev_chantype;
 	enum nl80211_channel_type rx_channel_type = NL80211_CHAN_NO_HT;
 	enum nl80211_channel_type tx_channel_type;
@@ -254,6 +254,7 @@
 		 */
 		ieee80211_stop_queues_by_reason(&sdata->local->hw,
 				IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE);
+		queues_stopped = true;
 
 		/* flush out all packets */
 		synchronize_net();
@@ -272,12 +273,12 @@
 						 IEEE80211_RC_HT_CHANGED,
 						 tx_channel_type);
 		rcu_read_unlock();
-
-		if (beacon_htcap_ie)
-			ieee80211_wake_queues_by_reason(&sdata->local->hw,
-				IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE);
 	}
 
+	if (queues_stopped)
+		ieee80211_wake_queues_by_reason(&sdata->local->hw,
+			IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE);
+
 	ht_opmode = le16_to_cpu(hti->operation_mode);
 
 	/* if bss configuration changed store the new one */
@@ -1399,7 +1400,6 @@
 	struct ieee80211_local *local = sdata->local;
 	struct sta_info *sta;
 	u32 changed = 0;
-	u8 bssid[ETH_ALEN];
 
 	ASSERT_MGD_MTX(ifmgd);
 
@@ -1409,10 +1409,7 @@
 	if (WARN_ON(!ifmgd->associated))
 		return;
 
-	memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
-
 	ifmgd->associated = NULL;
-	memset(ifmgd->bssid, 0, ETH_ALEN);
 
 	/*
 	 * we need to commit the associated = NULL change because the
@@ -1432,7 +1429,7 @@
 	netif_carrier_off(sdata->dev);
 
 	mutex_lock(&local->sta_mtx);
-	sta = sta_info_get(sdata, bssid);
+	sta = sta_info_get(sdata, ifmgd->bssid);
 	if (sta) {
 		set_sta_flag(sta, WLAN_STA_BLOCK_BA);
 		ieee80211_sta_tear_down_BA_sessions(sta, tx);
@@ -1441,13 +1438,16 @@
 
 	/* deauthenticate/disassociate now */
 	if (tx || frame_buf)
-		ieee80211_send_deauth_disassoc(sdata, bssid, stype, reason,
-					       tx, frame_buf);
+		ieee80211_send_deauth_disassoc(sdata, ifmgd->bssid, stype,
+					       reason, tx, frame_buf);
 
 	/* flush out frame */
 	if (tx)
 		drv_flush(local, false);
 
+	/* clear bssid only after building the needed mgmt frames */
+	memset(ifmgd->bssid, 0, ETH_ALEN);
+
 	/* remove AP and TDLS peers */
 	sta_info_flush(local, sdata);
 
@@ -1837,7 +1837,8 @@
 	if (status_code != WLAN_STATUS_SUCCESS) {
 		printk(KERN_DEBUG "%s: %pM denied authentication (status %d)\n",
 		       sdata->name, mgmt->sa, status_code);
-		goto out;
+		ieee80211_destroy_auth_data(sdata, false);
+		return RX_MGMT_CFG80211_RX_AUTH;
 	}
 
 	switch (ifmgd->auth_data->algorithm) {
@@ -1859,7 +1860,6 @@
 	}
 
 	printk(KERN_DEBUG "%s: authenticated\n", sdata->name);
- out:
 	ifmgd->auth_data->done = true;
 	ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC;
 	run_again(ifmgd, ifmgd->auth_data->timeout);
@@ -2207,15 +2207,13 @@
 		       sdata->name, mgmt->sa, status_code);
 		ieee80211_destroy_assoc_data(sdata, false);
 	} else {
-		printk(KERN_DEBUG "%s: associated\n", sdata->name);
-
 		if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) {
 			/* oops -- internal error -- send timeout for now */
-			ieee80211_destroy_assoc_data(sdata, true);
-			sta_info_destroy_addr(sdata, mgmt->bssid);
+			ieee80211_destroy_assoc_data(sdata, false);
 			cfg80211_put_bss(*bss);
 			return RX_MGMT_CFG80211_ASSOC_TIMEOUT;
 		}
+		printk(KERN_DEBUG "%s: associated\n", sdata->name);
 
 		/*
 		 * destroy assoc_data afterwards, as otherwise an idle
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index f054e94..935aa4b 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -234,6 +234,22 @@
 		return;
 	}
 
+	/* was never transmitted */
+	if (local->hw_roc_skb) {
+		u64 cookie;
+
+		cookie = local->hw_roc_cookie ^ 2;
+
+		cfg80211_mgmt_tx_status(local->hw_roc_dev, cookie,
+					local->hw_roc_skb->data,
+					local->hw_roc_skb->len, false,
+					GFP_KERNEL);
+
+		kfree_skb(local->hw_roc_skb);
+		local->hw_roc_skb = NULL;
+		local->hw_roc_skb_for_status = NULL;
+	}
+
 	if (!local->hw_roc_for_tx)
 		cfg80211_remain_on_channel_expired(local->hw_roc_dev,
 						   local->hw_roc_cookie,
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index d64e285..c9b508e 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2459,7 +2459,7 @@
 	 * frames that we didn't handle, including returning unknown
 	 * ones. For all other modes we will return them to the sender,
 	 * setting the 0x80 bit in the action category, as required by
-	 * 802.11-2007 7.3.1.11.
+	 * 802.11-2012 9.24.4.
 	 * Newer versions of hostapd shall also use the management frame
 	 * registration mechanisms, but older ones still use cooked
 	 * monitor interfaces so push all frames there.
@@ -2469,6 +2469,9 @@
 	     sdata->vif.type == NL80211_IFTYPE_AP_VLAN))
 		return RX_DROP_MONITOR;
 
+	if (is_multicast_ether_addr(mgmt->da))
+		return RX_DROP_MONITOR;
+
 	/* do not return rejected action frames */
 	if (mgmt->u.action.category & 0x80)
 		return RX_DROP_UNUSABLE;
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 38137cb..d93d39b 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -378,7 +378,7 @@
 	/* make the station visible */
 	sta_info_hash_add(local, sta);
 
-	list_add(&sta->list, &local->sta_list);
+	list_add_rcu(&sta->list, &local->sta_list);
 
 	set_sta_flag(sta, WLAN_STA_INSERTED);
 
@@ -688,7 +688,7 @@
 	if (ret)
 		return ret;
 
-	list_del(&sta->list);
+	list_del_rcu(&sta->list);
 
 	mutex_lock(&local->key_mtx);
 	for (i = 0; i < NUM_DEFAULT_KEYS; i++)
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 1faea9d..70699db 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1227,7 +1227,7 @@
 			enum ieee80211_sta_state state;
 
 			for (state = IEEE80211_STA_NOTEXIST;
-			     state < sta->sta_state - 1; state++)
+			     state < sta->sta_state; state++)
 				WARN_ON(drv_sta_state(local, sta->sdata, sta,
 						      state, state + 1));
 		}
@@ -1324,6 +1324,12 @@
 		}
 	}
 
+	/* add back keys */
+	list_for_each_entry(sdata, &local->interfaces, list)
+		if (ieee80211_sdata_running(sdata))
+			ieee80211_enable_keys(sdata);
+
+ wake_up:
 	/*
 	 * Clear the WLAN_STA_BLOCK_BA flag so new aggregation
 	 * sessions can be established after a resume.
@@ -1345,12 +1351,6 @@
 		mutex_unlock(&local->sta_mtx);
 	}
 
-	/* add back keys */
-	list_for_each_entry(sdata, &local->interfaces, list)
-		if (ieee80211_sdata_running(sdata))
-			ieee80211_enable_keys(sdata);
-
- wake_up:
 	ieee80211_wake_queues_by_reason(hw,
 			IEEE80211_QUEUE_STOP_REASON_SUSPEND);
 
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index 2e3dee4..e460cf1 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -106,7 +106,7 @@
 	nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data));
 	data += 2;
 
-	nfca_poll->nfcid1_len = *data++;
+	nfca_poll->nfcid1_len = min_t(__u8, *data++, NFC_NFCID1_MAXSIZE);
 
 	pr_debug("sens_res 0x%x, nfcid1_len %d\n",
 		 nfca_poll->sens_res, nfca_poll->nfcid1_len);
@@ -130,7 +130,7 @@
 			struct rf_tech_specific_params_nfcb_poll *nfcb_poll,
 						     __u8 *data)
 {
-	nfcb_poll->sensb_res_len = *data++;
+	nfcb_poll->sensb_res_len = min_t(__u8, *data++, NFC_SENSB_RES_MAXSIZE);
 
 	pr_debug("sensb_res_len %d\n", nfcb_poll->sensb_res_len);
 
@@ -145,7 +145,7 @@
 						     __u8 *data)
 {
 	nfcf_poll->bit_rate = *data++;
-	nfcf_poll->sensf_res_len = *data++;
+	nfcf_poll->sensf_res_len = min_t(__u8, *data++, NFC_SENSF_RES_MAXSIZE);
 
 	pr_debug("bit_rate %d, sensf_res_len %d\n",
 		 nfcf_poll->bit_rate, nfcf_poll->sensf_res_len);
@@ -331,7 +331,7 @@
 	switch (ntf->activation_rf_tech_and_mode) {
 	case NCI_NFC_A_PASSIVE_POLL_MODE:
 		nfca_poll = &ntf->activation_params.nfca_poll_iso_dep;
-		nfca_poll->rats_res_len = *data++;
+		nfca_poll->rats_res_len = min_t(__u8, *data++, 20);
 		pr_debug("rats_res_len %d\n", nfca_poll->rats_res_len);
 		if (nfca_poll->rats_res_len > 0) {
 			memcpy(nfca_poll->rats_res,
@@ -341,7 +341,7 @@
 
 	case NCI_NFC_B_PASSIVE_POLL_MODE:
 		nfcb_poll = &ntf->activation_params.nfcb_poll_iso_dep;
-		nfcb_poll->attrib_res_len = *data++;
+		nfcb_poll->attrib_res_len = min_t(__u8, *data++, 50);
 		pr_debug("attrib_res_len %d\n", nfcb_poll->attrib_res_len);
 		if (nfcb_poll->attrib_res_len > 0) {
 			memcpy(nfcb_poll->attrib_res,
diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c
index 5a839ce..e879dce 100644
--- a/net/nfc/rawsock.c
+++ b/net/nfc/rawsock.c
@@ -54,7 +54,10 @@
 {
 	struct sock *sk = sock->sk;
 
-	pr_debug("sock=%p\n", sock);
+	pr_debug("sock=%p sk=%p\n", sock, sk);
+
+	if (!sk)
+		return 0;
 
 	sock_orphan(sk);
 	sock_put(sk);
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index ebd2296..992acaa 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -329,29 +329,22 @@
 	return PSCHED_NS2TICKS(ticks);
 }
 
-static int tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch)
+static void tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch)
 {
 	struct sk_buff_head *list = &sch->q;
 	psched_time_t tnext = netem_skb_cb(nskb)->time_to_send;
-	struct sk_buff *skb;
+	struct sk_buff *skb = skb_peek_tail(list);
 
-	if (likely(skb_queue_len(list) < sch->limit)) {
-		skb = skb_peek_tail(list);
-		/* Optimize for add at tail */
-		if (likely(!skb || tnext >= netem_skb_cb(skb)->time_to_send))
-			return qdisc_enqueue_tail(nskb, sch);
+	/* Optimize for add at tail */
+	if (likely(!skb || tnext >= netem_skb_cb(skb)->time_to_send))
+		return __skb_queue_tail(list, nskb);
 
-		skb_queue_reverse_walk(list, skb) {
-			if (tnext >= netem_skb_cb(skb)->time_to_send)
-				break;
-		}
-
-		__skb_queue_after(list, skb, nskb);
-		sch->qstats.backlog += qdisc_pkt_len(nskb);
-		return NET_XMIT_SUCCESS;
+	skb_queue_reverse_walk(list, skb) {
+		if (tnext >= netem_skb_cb(skb)->time_to_send)
+			break;
 	}
 
-	return qdisc_reshape_fail(nskb, sch);
+	__skb_queue_after(list, skb, nskb);
 }
 
 /*
@@ -366,7 +359,6 @@
 	/* We don't fill cb now as skb_unshare() may invalidate it */
 	struct netem_skb_cb *cb;
 	struct sk_buff *skb2;
-	int ret;
 	int count = 1;
 
 	/* Random duplication */
@@ -414,6 +406,11 @@
 		skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8);
 	}
 
+	if (unlikely(skb_queue_len(&sch->q) >= sch->limit))
+		return qdisc_reshape_fail(skb, sch);
+
+	sch->qstats.backlog += qdisc_pkt_len(skb);
+
 	cb = netem_skb_cb(skb);
 	if (q->gap == 0 ||		/* not doing reordering */
 	    q->counter < q->gap - 1 ||	/* inside last reordering gap */
@@ -445,7 +442,7 @@
 
 		cb->time_to_send = now + delay;
 		++q->counter;
-		ret = tfifo_enqueue(skb, sch);
+		tfifo_enqueue(skb, sch);
 	} else {
 		/*
 		 * Do re-ordering by putting one out of N packets at the front
@@ -455,16 +452,7 @@
 		q->counter = 0;
 
 		__skb_queue_head(&sch->q, skb);
-		sch->qstats.backlog += qdisc_pkt_len(skb);
 		sch->qstats.requeues++;
-		ret = NET_XMIT_SUCCESS;
-	}
-
-	if (ret != NET_XMIT_SUCCESS) {
-		if (net_xmit_drop_count(ret)) {
-			sch->qstats.drops++;
-			return ret;
-		}
 	}
 
 	return NET_XMIT_SUCCESS;
diff --git a/net/sched/sch_sfb.c b/net/sched/sch_sfb.c
index d7eea99..c6a5867 100644
--- a/net/sched/sch_sfb.c
+++ b/net/sched/sch_sfb.c
@@ -570,6 +570,8 @@
 
 	sch->qstats.backlog = q->qdisc->qstats.backlog;
 	opts = nla_nest_start(skb, TCA_OPTIONS);
+	if (opts == NULL)
+		goto nla_put_failure;
 	NLA_PUT(skb, TCA_SFB_PARMS, sizeof(opt), &opt);
 	return nla_nest_end(skb, opts);
 
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 80f71af..be772c0 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -736,15 +736,12 @@
 
 	epb = &ep->base;
 
-	if (hlist_unhashed(&epb->node))
-		return;
-
 	epb->hashent = sctp_ep_hashfn(epb->bind_addr.port);
 
 	head = &sctp_ep_hashtable[epb->hashent];
 
 	sctp_write_lock(&head->lock);
-	__hlist_del(&epb->node);
+	hlist_del_init(&epb->node);
 	sctp_write_unlock(&head->lock);
 }
 
@@ -825,7 +822,7 @@
 	head = &sctp_assoc_hashtable[epb->hashent];
 
 	sctp_write_lock(&head->lock);
-	__hlist_del(&epb->node);
+	hlist_del_init(&epb->node);
 	sctp_write_unlock(&head->lock);
 }
 
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 92ba71d..dba20d6 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1231,8 +1231,14 @@
 	SCTP_DEBUG_PRINTK("About to exit __sctp_connect() free asoc: %p"
 			  " kaddrs: %p err: %d\n",
 			  asoc, kaddrs, err);
-	if (asoc)
+	if (asoc) {
+		/* sctp_primitive_ASSOCIATE may have added this association
+		 * To the hash table, try to unhash it, just in case, its a noop
+		 * if it wasn't hashed so we're safe
+		 */
+		sctp_unhash_established(asoc);
 		sctp_association_free(asoc);
+	}
 	return err;
 }
 
@@ -1942,8 +1948,10 @@
 	goto out_unlock;
 
 out_free:
-	if (new_asoc)
+	if (new_asoc) {
+		sctp_unhash_established(asoc);
 		sctp_association_free(asoc);
+	}
 out_unlock:
 	sctp_release_sock(sk);
 
diff --git a/net/socket.c b/net/socket.c
index 851edcd..573b261 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -522,6 +522,9 @@
 	if (rcu_dereference_protected(sock->wq, 1)->fasync_list)
 		printk(KERN_ERR "sock_release: fasync list not empty!\n");
 
+	if (test_bit(SOCK_EXTERNALLY_ALLOCATED, &sock->flags))
+		return;
+
 	percpu_sub(sockets_in_use, 1);
 	if (!sock->file) {
 		iput(SOCK_INODE(sock));
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index adf2990..57f2731 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1288,6 +1288,8 @@
 	}
 
 	switch (status) {
+	case -ENOMEM:
+		rpc_delay(task, HZ >> 2);
 	case -EAGAIN:	/* woken up; retry */
 		task->tk_action = call_reserve;
 		return;
@@ -1844,12 +1846,13 @@
 		return;
 	}
 	if (RPC_IS_SOFT(task)) {
-		if (clnt->cl_chatty)
+		if (clnt->cl_chatty) {
 			rcu_read_lock();
 			printk(KERN_NOTICE "%s: server %s not responding, timed out\n",
 				clnt->cl_protname,
 				rcu_dereference(clnt->cl_xprt)->servername);
 			rcu_read_unlock();
+		}
 		if (task->tk_flags & RPC_TASK_TIMEOUT)
 			rpc_exit(task, -ETIMEDOUT);
 		else
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 3b62cf2..faa078f 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -71,7 +71,9 @@
 		msg->errno = err;
 		destroy_msg(msg);
 	} while (!list_empty(head));
-	wake_up(waitq);
+
+	if (waitq)
+		wake_up(waitq);
 }
 
 static void
@@ -91,11 +93,9 @@
 	}
 	dentry = dget(pipe->dentry);
 	spin_unlock(&pipe->lock);
-	if (dentry) {
-		rpc_purge_list(&RPC_I(dentry->d_inode)->waitq,
-			       &free_list, destroy_msg, -ETIMEDOUT);
-		dput(dentry);
-	}
+	rpc_purge_list(dentry ? &RPC_I(dentry->d_inode)->waitq : NULL,
+			&free_list, destroy_msg, -ETIMEDOUT);
+	dput(dentry);
 }
 
 ssize_t rpc_pipe_generic_upcall(struct file *filp, struct rpc_pipe_msg *msg,
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 78ac39f..4d53ad5 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -180,14 +180,16 @@
 	struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
 	struct rpc_clnt *clnt = sn->rpcb_local_clnt;
 	struct rpc_clnt *clnt4 = sn->rpcb_local_clnt4;
-	int shutdown;
+	int shutdown = 0;
 
 	spin_lock(&sn->rpcb_clnt_lock);
-	if (--sn->rpcb_users == 0) {
-		sn->rpcb_local_clnt = NULL;
-		sn->rpcb_local_clnt4 = NULL;
+	if (sn->rpcb_users) {
+		if (--sn->rpcb_users == 0) {
+			sn->rpcb_local_clnt = NULL;
+			sn->rpcb_local_clnt4 = NULL;
+		}
+		shutdown = !sn->rpcb_users;
 	}
-	shutdown = !sn->rpcb_users;
 	spin_unlock(&sn->rpcb_clnt_lock);
 
 	if (shutdown) {
@@ -249,7 +251,7 @@
 	if (IS_ERR(clnt)) {
 		dprintk("RPC:       failed to create AF_LOCAL rpcbind "
 				"client (errno %ld).\n", PTR_ERR(clnt));
-		result = -PTR_ERR(clnt);
+		result = PTR_ERR(clnt);
 		goto out;
 	}
 
@@ -296,7 +298,7 @@
 	if (IS_ERR(clnt)) {
 		dprintk("RPC:       failed to create local rpcbind "
 				"client (errno %ld).\n", PTR_ERR(clnt));
-		result = -PTR_ERR(clnt);
+		result = PTR_ERR(clnt);
 		goto out;
 	}
 
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 994cfea..d6c37f9 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -233,7 +233,7 @@
 {
 	if (fatal_signal_pending(current))
 		return -ERESTARTSYS;
-	freezable_schedule();
+	freezable_schedule_unsafe();
 	return 0;
 }
 
@@ -790,7 +790,9 @@
 
 static void rpc_async_schedule(struct work_struct *work)
 {
+	current->flags |= PF_FSTRANS;
 	__rpc_execute(container_of(work, struct rpc_task, u.tk_work));
+	current->flags &= ~PF_FSTRANS;
 }
 
 /**
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 4153846..cb7c13f 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -407,6 +407,14 @@
 	return 0;
 }
 
+int svc_bind(struct svc_serv *serv, struct net *net)
+{
+	if (!svc_uses_rpcbind(serv))
+		return 0;
+	return svc_rpcb_setup(serv, net);
+}
+EXPORT_SYMBOL_GPL(svc_bind);
+
 /*
  * Create an RPC service
  */
@@ -471,15 +479,8 @@
 		spin_lock_init(&pool->sp_lock);
 	}
 
-	if (svc_uses_rpcbind(serv)) {
-		if (svc_rpcb_setup(serv, current->nsproxy->net_ns) < 0) {
-			kfree(serv->sv_pools);
-			kfree(serv);
-			return NULL;
-		}
-		if (!serv->sv_shutdown)
-			serv->sv_shutdown = svc_rpcb_cleanup;
-	}
+	if (svc_uses_rpcbind(serv) && (!serv->sv_shutdown))
+		serv->sv_shutdown = svc_rpcb_cleanup;
 
 	return serv;
 }
@@ -536,8 +537,6 @@
 void
 svc_destroy(struct svc_serv *serv)
 {
-	struct net *net = current->nsproxy->net_ns;
-
 	dprintk("svc: svc_destroy(%s, %d)\n",
 				serv->sv_program->pg_name,
 				serv->sv_nrthreads);
@@ -552,8 +551,6 @@
 
 	del_timer_sync(&serv->sv_temptimer);
 
-	svc_shutdown_net(serv, net);
-
 	/*
 	 * The last user is gone and thus all sockets have to be destroyed to
 	 * the point. Check this.
@@ -1379,7 +1376,8 @@
 						sizeof(req->rq_snd_buf));
 		return bc_send(req);
 	} else {
-		/* Nothing to do to drop request */
+		/* drop request */
+		xprt_free_bc_request(req);
 		return 0;
 	}
 }
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 0cbcd1a..da72492 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -984,15 +984,16 @@
 		goto out_init_req;
 	switch (PTR_ERR(req)) {
 	case -ENOMEM:
-		rpc_delay(task, HZ >> 2);
 		dprintk("RPC:       dynamic allocation of request slot "
 				"failed! Retrying\n");
+		task->tk_status = -ENOMEM;
 		break;
 	case -EAGAIN:
 		rpc_sleep_on(&xprt->backlog, task, NULL);
 		dprintk("RPC:       waiting for request slot\n");
+	default:
+		task->tk_status = -EAGAIN;
 	}
-	task->tk_status = -EAGAIN;
 	return;
 out_init_req:
 	task->tk_status = 0;
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index b446e10..06cdbff 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -200,6 +200,7 @@
 	int rc = 0;
 
 	if (!xprt->shutdown) {
+		current->flags |= PF_FSTRANS;
 		xprt_clear_connected(xprt);
 
 		dprintk("RPC:       %s: %sconnect\n", __func__,
@@ -212,10 +213,10 @@
 
 out:
 	xprt_wake_pending_tasks(xprt, rc);
-
 out_clear:
 	dprintk("RPC:       %s: exit\n", __func__);
 	xprt_clear_connecting(xprt);
+	current->flags &= ~PF_FSTRANS;
 }
 
 /*
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 890b03f..b88c6bf 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1895,6 +1895,8 @@
 	if (xprt->shutdown)
 		goto out;
 
+	current->flags |= PF_FSTRANS;
+
 	clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
 	status = __sock_create(xprt->xprt_net, AF_LOCAL,
 					SOCK_STREAM, 0, &sock, 1);
@@ -1928,6 +1930,7 @@
 out:
 	xprt_clear_connecting(xprt);
 	xprt_wake_pending_tasks(xprt, status);
+	current->flags &= ~PF_FSTRANS;
 }
 
 static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
@@ -1970,6 +1973,8 @@
 	if (xprt->shutdown)
 		goto out;
 
+	current->flags |= PF_FSTRANS;
+
 	/* Start by resetting any existing state */
 	xs_reset_transport(transport);
 	sock = xs_create_sock(xprt, transport,
@@ -1988,6 +1993,7 @@
 out:
 	xprt_clear_connecting(xprt);
 	xprt_wake_pending_tasks(xprt, status);
+	current->flags &= ~PF_FSTRANS;
 }
 
 /*
@@ -2113,6 +2119,8 @@
 	if (xprt->shutdown)
 		goto out;
 
+	current->flags |= PF_FSTRANS;
+
 	if (!sock) {
 		clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
 		sock = xs_create_sock(xprt, transport,
@@ -2162,6 +2170,7 @@
 	case -EINPROGRESS:
 	case -EALREADY:
 		xprt_clear_connecting(xprt);
+		current->flags &= ~PF_FSTRANS;
 		return;
 	case -EINVAL:
 		/* Happens, for instance, if the user specified a link
@@ -2174,6 +2183,7 @@
 out:
 	xprt_clear_connecting(xprt);
 	xprt_wake_pending_tasks(xprt, status);
+	current->flags &= ~PF_FSTRANS;
 }
 
 /**
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 109e30b..8d932a5 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -114,6 +114,7 @@
 #include <linux/mount.h>
 #include <net/checksum.h>
 #include <linux/security.h>
+#include <linux/freezer.h>
 
 struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
 EXPORT_SYMBOL_GPL(unix_socket_table);
@@ -1874,7 +1875,7 @@
 
 		set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
 		unix_state_unlock(sk);
-		timeo = schedule_timeout(timeo);
+		timeo = freezable_schedule_timeout(timeo);
 		unix_state_lock(sk);
 		clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
 	}
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 788a12c..2ab7850 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -602,36 +602,31 @@
 		 * successfully, add it to the interface list.
 		 */
 
-		if (dev->name == NULL) {
-			err = -EINVAL;
-		} else {
+#ifdef WANDEBUG
+		printk(KERN_INFO "%s: registering interface %s...\n",
+		       wanrouter_modname, dev->name);
+#endif
 
-			#ifdef WANDEBUG
-			printk(KERN_INFO "%s: registering interface %s...\n",
-				wanrouter_modname, dev->name);
-			#endif
+		err = register_netdev(dev);
+		if (!err) {
+			struct net_device *slave = NULL;
+			unsigned long smp_flags=0;
 
-			err = register_netdev(dev);
-			if (!err) {
-				struct net_device *slave = NULL;
-				unsigned long smp_flags=0;
+			lock_adapter_irq(&wandev->lock, &smp_flags);
 
-				lock_adapter_irq(&wandev->lock, &smp_flags);
-
-				if (wandev->dev == NULL) {
-					wandev->dev = dev;
-				} else {
-					for (slave=wandev->dev;
-					     DEV_TO_SLAVE(slave);
-					     slave = DEV_TO_SLAVE(slave))
-						DEV_TO_SLAVE(slave) = dev;
-				}
-				++wandev->ndev;
-
-				unlock_adapter_irq(&wandev->lock, &smp_flags);
-				err = 0;	/* done !!! */
-				goto out;
+			if (wandev->dev == NULL) {
+				wandev->dev = dev;
+			} else {
+				for (slave=wandev->dev;
+				     DEV_TO_SLAVE(slave);
+				     slave = DEV_TO_SLAVE(slave))
+					DEV_TO_SLAVE(slave) = dev;
 			}
+			++wandev->ndev;
+
+			unlock_adapter_irq(&wandev->lock, &smp_flags);
+			err = 0;	/* done !!! */
+			goto out;
 		}
 		if (wandev->del_if)
 			wandev->del_if(wandev, dev);
diff --git a/net/wireless/core.c b/net/wireless/core.c
index ccdfed8..bb5302d 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -975,6 +975,11 @@
 		 */
 		synchronize_rcu();
 		INIT_LIST_HEAD(&wdev->list);
+		/*
+		 * Ensure that all events have been processed and
+		 * freed.
+		 */
+		cfg80211_process_wdev_events(wdev);
 		break;
 	case NETDEV_PRE_UP:
 		if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 036faee..d95937b 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -426,6 +426,7 @@
 			  struct net_device *dev, enum nl80211_iftype ntype,
 			  u32 *flags, struct vif_params *params);
 void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev);
+void cfg80211_process_wdev_events(struct wireless_dev *wdev);
 
 int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
 				  struct wireless_dev *wdev,
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index e9a0ac8..460af03 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -388,7 +388,15 @@
 
 	schedule_work(&reg_regdb_work);
 }
+
+/* Feel free to add any other sanity checks here */
+static void reg_regdb_size_check(void)
+{
+	/* We should ideally BUILD_BUG_ON() but then random builds would fail */
+	WARN_ONCE(!reg_regdb_size, "db.txt is empty, you should update it...");
+}
 #else
+static inline void reg_regdb_size_check(void) {}
 static inline void reg_regdb_query(const char *alpha2) {}
 #endif /* CONFIG_CFG80211_INTERNAL_REGDB */
 
@@ -883,7 +891,21 @@
 	chan->max_antenna_gain = min(chan->orig_mag,
 		(int) MBI_TO_DBI(power_rule->max_antenna_gain));
 	chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp);
-	chan->max_power = min(chan->max_power, chan->max_reg_power);
+	if (chan->orig_mpwr) {
+		/*
+		 * Devices that have their own custom regulatory domain
+		 * but also use WIPHY_FLAG_STRICT_REGULATORY will follow the
+		 * passed country IE power settings.
+		 */
+		if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE &&
+		    wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY &&
+		    wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)
+			chan->max_power = chan->max_reg_power;
+		else
+			chan->max_power = min(chan->orig_mpwr,
+					      chan->max_reg_power);
+	} else
+		chan->max_power = chan->max_reg_power;
 }
 
 static void handle_band(struct wiphy *wiphy,
@@ -1381,7 +1403,7 @@
 	spin_unlock(&reg_requests_lock);
 
 	if (last_request->initiator == NL80211_REGDOM_SET_BY_USER)
-		cancel_delayed_work_sync(&reg_timeout);
+		cancel_delayed_work(&reg_timeout);
 
 	if (need_more_processing)
 		schedule_work(&reg_work);
@@ -2322,6 +2344,8 @@
 	spin_lock_init(&reg_requests_lock);
 	spin_lock_init(&reg_pending_beacons_lock);
 
+	reg_regdb_size_check();
+
 	cfg80211_regdomain = cfg80211_world_regdom;
 
 	user_alpha2[0] = '9';
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 7dcb067..f181501 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -721,7 +721,7 @@
 	wdev->connect_keys = NULL;
 }
 
-static void cfg80211_process_wdev_events(struct wireless_dev *wdev)
+void cfg80211_process_wdev_events(struct wireless_dev *wdev)
 {
 	struct cfg80211_event *ev;
 	unsigned long flags;
@@ -809,7 +809,7 @@
 	     ntype == NL80211_IFTYPE_P2P_CLIENT))
 		return -EBUSY;
 
-	if (ntype != otype) {
+	if (ntype != otype && netif_running(dev)) {
 		err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr,
 						    ntype);
 		if (err)
@@ -1013,6 +1013,7 @@
 				  enum nl80211_iftype iftype)
 {
 	struct wireless_dev *wdev_iter;
+	u32 used_iftypes = BIT(iftype);
 	int num[NUM_NL80211_IFTYPES];
 	int total = 1;
 	int i, j;
@@ -1046,12 +1047,17 @@
 
 		num[wdev_iter->iftype]++;
 		total++;
+		used_iftypes |= BIT(wdev_iter->iftype);
 	}
 	mutex_unlock(&rdev->devlist_mtx);
 
+	if (total == 1)
+		return 0;
+
 	for (i = 0; i < rdev->wiphy.n_iface_combinations; i++) {
 		const struct ieee80211_iface_combination *c;
 		struct ieee80211_iface_limit *limits;
+		u32 all_iftypes = 0;
 
 		c = &rdev->wiphy.iface_combinations[i];
 
@@ -1066,6 +1072,7 @@
 			if (rdev->wiphy.software_iftypes & BIT(iftype))
 				continue;
 			for (j = 0; j < c->n_limits; j++) {
+				all_iftypes |= limits[j].types;
 				if (!(limits[j].types & BIT(iftype)))
 					continue;
 				if (limits[j].max < num[iftype])
@@ -1073,7 +1080,20 @@
 				limits[j].max -= num[iftype];
 			}
 		}
-		/* yay, it fits */
+
+		/*
+		 * Finally check that all iftypes that we're currently
+		 * using are actually part of this combination. If they
+		 * aren't then we can't use this combination and have
+		 * to continue to the next.
+		 */
+		if ((all_iftypes & used_iftypes) != used_iftypes)
+			goto cont;
+
+		/*
+		 * This combination covered all interface types and
+		 * supported the requested numbers, so we're good.
+		 */
 		kfree(limits);
 		return 0;
  cont:
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 7661576..a15d2a0 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1919,6 +1919,9 @@
 	}
 ok:
 	xfrm_pols_put(pols, drop_pols);
+	if (dst && dst->xfrm &&
+	    dst->xfrm->props.mode == XFRM_MODE_TUNNEL)
+		dst->flags |= DST_XFRM_TUNNEL;
 	return dst;
 
 nopol:
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index d85b793..5626222 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2162,7 +2162,7 @@
 		int fd;
 
 		j++;
-		i = j * __NFDBITS;
+		i = j * BITS_PER_LONG;
 		fdt = files_fdtable(files);
 		if (i >= fdt->max_fds)
 			break;
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index d7018bf..3068d16 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1232,6 +1232,7 @@
 		kfree(bool_pending_names[i]);
 	kfree(bool_pending_names);
 	kfree(bool_pending_values);
+	bool_num = 0;
 	bool_pending_names = NULL;
 	bool_pending_values = NULL;
 
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c
index 1cff331..4608c2c 100644
--- a/sound/drivers/mpu401/mpu401_uart.c
+++ b/sound/drivers/mpu401/mpu401_uart.c
@@ -554,6 +554,7 @@
 	spin_lock_init(&mpu->output_lock);
 	spin_lock_init(&mpu->timer_lock);
 	mpu->hardware = hardware;
+	mpu->irq = -1;
 	if (! (info_flags & MPU401_INFO_INTEGRATED)) {
 		int res_size = hardware == MPU401_HW_PC98II ? 4 : 2;
 		mpu->res = request_region(port, res_size, "MPU401 UART");
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 841475c..926b455 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1192,6 +1192,7 @@
 {
 	if (!codec)
 		return;
+	snd_hda_jack_tbl_clear(codec);
 	restore_init_pincfgs(codec);
 #ifdef CONFIG_SND_HDA_POWER_SAVE
 	cancel_delayed_work(&codec->power_work);
@@ -1200,6 +1201,7 @@
 	list_del(&codec->list);
 	snd_array_free(&codec->mixers);
 	snd_array_free(&codec->nids);
+	snd_array_free(&codec->cvt_setups);
 	snd_array_free(&codec->conn_lists);
 	snd_array_free(&codec->spdif_out);
 	codec->bus->caddr_tbl[codec->addr] = NULL;
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index d906c5b..3897027 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -2975,7 +2975,6 @@
 	SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTRO),
 	SND_PCI_QUIRK(0x1028, 0x02f5, "Dell Vostro 320", CXT5066_IDEAPAD),
 	SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO),
-	SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO),
 	SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD),
 	SND_PCI_QUIRK(0x1028, 0x050f, "Dell Inspiron", CXT5066_IDEAPAD),
 	SND_PCI_QUIRK(0x1028, 0x0510, "Dell Vostro", CXT5066_IDEAPAD),
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 83f345f..d1b805a 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -876,7 +876,6 @@
 	struct hdmi_spec_per_pin *per_pin;
 	struct hdmi_eld *eld;
 	struct hdmi_spec_per_cvt *per_cvt = NULL;
-	int pinctl;
 
 	/* Validate hinfo */
 	pin_idx = hinfo_to_pin_index(spec, hinfo);
@@ -912,11 +911,6 @@
 	snd_hda_codec_write(codec, per_pin->pin_nid, 0,
 			    AC_VERB_SET_CONNECT_SEL,
 			    mux_idx);
-	pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
-				    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
-	snd_hda_codec_write(codec, per_pin->pin_nid, 0,
-			    AC_VERB_SET_PIN_WIDGET_CONTROL,
-			    pinctl | PIN_OUT);
 	snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
 
 	/* Initially set the converter's capabilities */
@@ -1153,11 +1147,17 @@
 	struct hdmi_spec *spec = codec->spec;
 	int pin_idx = hinfo_to_pin_index(spec, hinfo);
 	hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
+	int pinctl;
 
 	hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
 
 	hdmi_setup_audio_infoframe(codec, pin_idx, substream);
 
+	pinctl = snd_hda_codec_read(codec, pin_nid, 0,
+				    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+	snd_hda_codec_write(codec, pin_nid, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl | PIN_OUT);
+
 	return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
 }
 
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 7810913..152d91b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5858,6 +5858,15 @@
 }
 #endif /* CONFIG_PM */
 
+static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
+						 const struct alc_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+
+	if (action == ALC_FIXUP_ACT_PRE_PROBE)
+		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
+}
+
 static void alc269_fixup_hweq(struct hda_codec *codec,
 			       const struct alc_fixup *fix, int action)
 {
@@ -5984,6 +5993,8 @@
 	ALC269VB_FIXUP_AMIC,
 	ALC269VB_FIXUP_DMIC,
 	ALC269_FIXUP_MIC2_MUTE_LED,
+	ALC269_FIXUP_LENOVO_DOCK,
+	ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
 };
 
 static const struct alc_fixup alc269_fixups[] = {
@@ -6045,6 +6056,8 @@
 	[ALC269_FIXUP_PCM_44K] = {
 		.type = ALC_FIXUP_FUNC,
 		.v.func = alc269_fixup_pcm_44k,
+		.chained = true,
+		.chain_id = ALC269_FIXUP_QUANTA_MUTE
 	},
 	[ALC269_FIXUP_STEREO_DMIC] = {
 		.type = ALC_FIXUP_FUNC,
@@ -6108,6 +6121,20 @@
 		.type = ALC_FIXUP_FUNC,
 		.v.func = alc269_fixup_mic2_mute,
 	},
+	[ALC269_FIXUP_LENOVO_DOCK] = {
+		.type = ALC_FIXUP_PINS,
+		.v.pins = (const struct alc_pincfg[]) {
+			{ 0x19, 0x23a11040 }, /* dock mic */
+			{ 0x1b, 0x2121103f }, /* dock headphone */
+			{ }
+		},
+		.chained = true,
+		.chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
+	},
+	[ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
+		.type = ALC_FIXUP_FUNC,
+		.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
+	},
 };
 
 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -6131,8 +6158,11 @@
 	SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
 	SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
 	SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
-	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_QUANTA_MUTE),
-	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Lenovo Ideapd", ALC269_FIXUP_PCM_44K),
+	SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
+	SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
+	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
+	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
+	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
 	SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
 
 #if 0
@@ -6189,6 +6219,7 @@
 static const struct alc_model_fixup alc269_fixup_models[] = {
 	{.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
 	{.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
+	{.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
 	{}
 };
 
@@ -6606,6 +6637,7 @@
 	ALC662_FIXUP_ASUS_MODE7,
 	ALC662_FIXUP_ASUS_MODE8,
 	ALC662_FIXUP_NO_JACK_DETECT,
+	ALC662_FIXUP_ZOTAC_Z68,
 };
 
 static const struct alc_fixup alc662_fixups[] = {
@@ -6755,6 +6787,13 @@
 		.type = ALC_FIXUP_FUNC,
 		.v.func = alc_fixup_no_jack_detect,
 	},
+	[ALC662_FIXUP_ZOTAC_Z68] = {
+		.type = ALC_FIXUP_PINS,
+		.v.pins = (const struct alc_pincfg[]) {
+			{ 0x1b, 0x02214020 }, /* Front HP */
+			{ }
+		}
+	},
 };
 
 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -6768,6 +6807,7 @@
 	SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
 	SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
+	SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
 	SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
 
 #if 0
@@ -6967,6 +7007,8 @@
 	{ .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
 	{ .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
 	{ .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
+	{ .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
+	{ .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
 	{ .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
 	  .patch = patch_alc861 },
 	{ .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 2cb1e08..fd53312 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -100,6 +100,8 @@
 	STAC_92HD83XXX_HP_cNB11_INTQUAD,
 	STAC_HP_DV7_4000,
 	STAC_HP_ZEPHYR,
+	STAC_92HD83XXX_HP_LED,
+	STAC_92HD83XXX_HP_INV_LED,
 	STAC_92HD83XXX_MODELS
 };
 
@@ -1672,6 +1674,8 @@
 	[STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad",
 	[STAC_HP_DV7_4000] = "hp-dv7-4000",
 	[STAC_HP_ZEPHYR] = "hp-zephyr",
+	[STAC_92HD83XXX_HP_LED] = "hp-led",
+	[STAC_92HD83XXX_HP_INV_LED] = "hp-inv-led",
 };
 
 static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
@@ -1726,6 +1730,8 @@
 			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
 	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561,
 			  "HP", STAC_HP_ZEPHYR),
+	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
+			  "HP Mini", STAC_92HD83XXX_HP_LED),
 	{} /* terminator */
 };
 
@@ -4388,7 +4394,7 @@
 					 AC_PINCTL_IN_EN);
 	for (i = 0; i < spec->num_pwrs; i++)  {
 		hda_nid_t nid = spec->pwr_nids[i];
-		int pinctl, def_conf;
+		unsigned int pinctl, def_conf;
 
 		/* power on when no jack detection is available */
 		/* or when the VREF is used for controlling LED */
@@ -4415,7 +4421,7 @@
 		def_conf = get_defcfg_connect(def_conf);
 		/* skip any ports that don't have jacks since presence
  		 * detection is useless */
-		if (def_conf != AC_JACK_PORT_NONE &&
+		if (def_conf != AC_JACK_PORT_COMPLEX ||
 		    !is_jack_detectable(codec, nid)) {
 			stac_toggle_power_map(codec, nid, 1);
 			continue;
@@ -4431,7 +4437,13 @@
 	snd_hda_jack_report_sync(codec);
 
 	/* sync mute LED */
-	snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
+	if (spec->gpio_led) {
+		if (spec->vmaster_mute.hook)
+			snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
+		else /* the very first init call doesn't have vmaster yet */
+			stac92xx_update_led_status(codec, false);
+	}
+
 	if (spec->dac_list)
 		stac92xx_power_down(codec);
 	return 0;
@@ -5528,6 +5540,7 @@
 static int patch_stac92hd83xxx(struct hda_codec *codec)
 {
 	struct sigmatel_spec *spec;
+	int default_polarity = -1; /* no default cfg */
 	int err;
 
 	spec  = kzalloc(sizeof(*spec), GFP_KERNEL);
@@ -5576,9 +5589,15 @@
 	case STAC_HP_ZEPHYR:
 		spec->init = stac92hd83xxx_hp_zephyr_init;
 		break;
+	case STAC_92HD83XXX_HP_LED:
+		default_polarity = 0;
+		break;
+	case STAC_92HD83XXX_HP_INV_LED:
+		default_polarity = 1;
+		break;
 	}
 
-	if (find_mute_led_cfg(codec, -1/*no default cfg*/))
+	if (find_mute_led_cfg(codec, default_polarity))
 		snd_printd("mute LED gpio %d polarity %d\n",
 				spec->gpio_led,
 				spec->gpio_led_polarity);
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 06214fd..3998d09b 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -3233,7 +3233,7 @@
 {
 	struct via_spec *spec = codec->spec;
 	int imux_is_smixer;
-	unsigned int parm;
+	unsigned int parm, parm2;
 	/* MUX6 (1eh) = stereo mixer */
 	imux_is_smixer =
 	snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
@@ -3256,7 +3256,7 @@
 	parm = AC_PWRST_D3;
 	set_pin_power_state(codec, 0x27, &parm);
 	update_power_state(codec, 0x1a, parm);
-	update_power_state(codec, 0xb, parm);
+	parm2 = parm; /* for pin 0x0b */
 
 	/* PW2 (26h), AOW2 (ah) */
 	parm = AC_PWRST_D3;
@@ -3271,6 +3271,9 @@
 	if (!spec->hp_independent_mode) /* check for redirected HP */
 		set_pin_power_state(codec, 0x28, &parm);
 	update_power_state(codec, 0x8, parm);
+	if (!spec->hp_independent_mode && parm2 != AC_PWRST_D3)
+		parm = parm2;
+	update_power_state(codec, 0xb, parm);
 	/* MW9 (21h), Mw2 (1ah), AOW0 (8h) */
 	update_power_state(codec, 0x21, imux_is_smixer ? AC_PWRST_D0 : parm);
 
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 0e99137..bb883af 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -454,3 +454,9 @@
 	default n
 	help
 	  Texas Instruments 3W Mono Class-D Audio Amplifier
+
+config SND_SOC_TPA2051D3
+	tristate "TI TPA2051D3 Speaker AMP Driver"
+	depends on I2C=y
+	help
+	  TI TPA2051D3 Speaker AMP Driver implemented by HTC.
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index ec05d3c..91a5542 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -213,3 +213,4 @@
 obj-$(CONFIG_SND_SOC_MAX9877)	+= snd-soc-max9877.o
 obj-$(CONFIG_SND_SOC_TPA6130A2)	+= snd-soc-tpa6130a2.o
 obj-$(CONFIG_SND_SOC_TPA2028D)	+= tpa2028d.o
+obj-$(CONFIG_SND_SOC_TPA2051D3)	+= tpa2051d3.o
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 8d20f6e..b8f0262 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -936,9 +936,7 @@
 	}
 
 found:
-	data = snd_soc_read(codec, AIC3X_PLL_PROGA_REG);
-	snd_soc_write(codec, AIC3X_PLL_PROGA_REG,
-		      data | (pll_p << PLLP_SHIFT));
+	snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, PLLP_MASK, pll_p);
 	snd_soc_write(codec, AIC3X_OVRF_STATUS_AND_PLLR_REG,
 		      pll_r << PLLR_SHIFT);
 	snd_soc_write(codec, AIC3X_PLL_PROGB_REG, pll_j << PLLJ_SHIFT);
diff --git a/sound/soc/codecs/tlv320aic3x.h b/sound/soc/codecs/tlv320aic3x.h
index 6f097fb..08c7f66 100644
--- a/sound/soc/codecs/tlv320aic3x.h
+++ b/sound/soc/codecs/tlv320aic3x.h
@@ -166,6 +166,7 @@
 
 /* PLL registers bitfields */
 #define PLLP_SHIFT		0
+#define PLLP_MASK		7
 #define PLLQ_SHIFT		3
 #define PLLR_SHIFT		0
 #define PLLJ_SHIFT		2
diff --git a/sound/soc/codecs/tpa2051d3.c b/sound/soc/codecs/tpa2051d3.c
new file mode 100644
index 0000000..2f73b3e
--- /dev/null
+++ b/sound/soc/codecs/tpa2051d3.c
@@ -0,0 +1,523 @@
+/* driver/i2c/chip/tap2051d3.c
+ *
+ * TI tpa2051d3 Speaker Amp
+ *
+ * Copyright (C) 2010 HTC Corporation
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <linux/slab.h>
+#include <linux/irq.h>
+#include <linux/miscdevice.h>
+#include <asm/uaccess.h>
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/workqueue.h>
+#include <linux/freezer.h>
+#include <sound/tpa2051d3.h>
+#include <linux/mutex.h>
+
+#include <linux/gpio.h>
+#include <linux/mfd/pm8xxx/pm8921.h>
+
+
+#ifdef CONFIG_AMP_TPA2051D3_ON_GPIO
+#define DEBUG (1)
+#else
+#define DEBUG (0)
+#endif
+#define AMP_ON_CMD_LEN 7
+#define RETRY_CNT 5
+static struct i2c_client *this_client;
+static struct tpa2051d3_platform_data *pdata;
+static char *config_data;
+static int tpa2051_mode_cnt;
+struct mutex spk_amp_lock;
+static int tpa2051d3_opened;
+static int last_spkamp_state;
+static char SPK_AMP_ON[] =
+			{0x00, 0x82, 0x25, 0x57, 0x2D, 0xCD, 0x0D};
+static char HEADSET_AMP_ON[] =
+			{0x00, 0x8C, 0x25, 0x57, 0x73, 0x4D, 0x0D};
+static char RING_AMP_ON[] =
+			{0x00, 0x8E, 0x25, 0x57, 0x8D, 0xCD, 0x0D};
+static char HANDSET_AMP_ON[] =
+			{0x00, 0x82, 0x25, 0x57, 0x13, 0xCD, 0x0D};
+static char LINEOUT_AMP_ON[] =
+			{0x00, 0x8C, 0x25, 0x57, 0x73, 0x4D, 0x0D};
+static char AMP_0FF[] = {0x00, 0x90};
+
+static int tpa2051_write_reg(u8 reg, u8 val)
+{
+	int err;
+	struct i2c_msg msg[1];
+	unsigned char data[2];
+
+	msg->addr = this_client->addr;
+	msg->flags = 0;
+	msg->len = 2;
+	msg->buf = data;
+	data[0] = reg;
+	data[1] = val;
+
+	err = i2c_transfer(this_client->adapter, msg, 1);
+	if (err >= 0)
+		return 0;
+
+	return err;
+}
+
+static int tpa2051_i2c_write(char *txData, int length)
+{
+	int i, retry, pass = 0;
+	char buf[2];
+	struct i2c_msg msg[] = {
+		{
+		 .addr = this_client->addr,
+		 .flags = 0,
+		 .len = 2,
+		 .buf = buf,
+		},
+	};
+	for (i = 0; i < length; i++) {
+		if (i == 2)  /* According to tpa2051d3 Spec */
+			mdelay(1);
+		buf[0] = i;
+		buf[1] = txData[i];
+#if DEBUG
+		pr_info("i2c_write %d=%x\n", i, buf[1]);
+#endif
+		msg->buf = buf;
+		retry = RETRY_CNT;
+		pass = 0;
+		while (retry--) {
+			if (i2c_transfer(this_client->adapter, msg, 1) < 0) {
+				pr_err("%s: I2C transfer error %d retry %d\n",
+						__func__, i, retry);
+				msleep(20);
+			} else {
+				pass = 1;
+				break;
+			}
+		}
+		if (pass == 0) {
+			pr_err("I2C transfer error, retry fail\n");
+			return -EIO;
+		}
+	}
+	return 0;
+}
+
+static int tpa2051_i2c_write_for_read(char *txData, int length)
+{
+	int i, retry, pass = 0;
+	char buf[2];
+	struct i2c_msg msg[] = {
+		{
+		 .addr = this_client->addr,
+		 .flags = 0,
+		 .len = 2,
+		 .buf = buf,
+		},
+	};
+	for (i = 0; i < length; i++) {
+		if (i == 2)  /* According to tpa2051 Spec */
+			mdelay(1);
+		buf[0] = i;
+		buf[1] = txData[i];
+#if DEBUG
+		pr_info("i2c_write %d=%x\n", i, buf[1]);
+#endif
+		msg->buf = buf;
+		retry = RETRY_CNT;
+		pass = 0;
+		while (retry--) {
+			if (i2c_transfer(this_client->adapter, msg, 1) < 0) {
+				pr_err("%s: I2C transfer error %d retry %d\n",
+						__func__, i, retry);
+				msleep(20);
+			} else {
+				pass = 1;
+				break;
+			}
+		}
+		if (pass == 0) {
+			pr_err("I2C transfer error, retry fail\n");
+			return -EIO;
+		}
+	}
+	return 0;
+}
+
+static int tpa2051_i2c_read(char *rxData, int length)
+{
+	int rc;
+	struct i2c_msg msgs[] = {
+		{
+		 .addr = this_client->addr,
+		 .flags = I2C_M_RD,
+		 .len = length,
+		 .buf = rxData,
+		},
+	};
+
+	rc = i2c_transfer(this_client->adapter, msgs, 1);
+	if (rc < 0) {
+		pr_err("%s: transfer error %d\n", __func__, rc);
+		return rc;
+	}
+
+#if DEBUG
+	{
+		int i = 0;
+		for (i = 0; i < length; i++)
+			pr_info("i2c_read %s: rx[%d] = %2x\n", __func__, i, \
+				rxData[i]);
+	}
+#endif
+
+	return 0;
+}
+
+static int tpa2051d3_open(struct inode *inode, struct file *file)
+{
+	int rc = 0;
+
+	mutex_lock(&spk_amp_lock);
+
+	if (tpa2051d3_opened) {
+		pr_err("%s: busy\n", __func__);
+		rc = -EBUSY;
+		goto done;
+	}
+	tpa2051d3_opened = 1;
+done:
+	mutex_unlock(&spk_amp_lock);
+	return rc;
+}
+
+static int tpa2051d3_release(struct inode *inode, struct file *file)
+{
+	mutex_lock(&spk_amp_lock);
+	tpa2051d3_opened = 0;
+	mutex_unlock(&spk_amp_lock);
+
+	return 0;
+}
+void set_amp(int on, char *i2c_command)
+{
+	pr_info("%s: %d\n", __func__, on);
+	mutex_lock(&spk_amp_lock);
+	if (on && !last_spkamp_state) {
+		if (tpa2051_i2c_write(i2c_command, AMP_ON_CMD_LEN) == 0) {
+			last_spkamp_state = 1;
+			pr_info("%s: ON reg1=%x, reg2=%x\n",
+				__func__, i2c_command[1], i2c_command[2]);
+		}
+	} else if (!on && last_spkamp_state) {
+		if (tpa2051_i2c_write(AMP_0FF, sizeof(AMP_0FF)) == 0) {
+			last_spkamp_state = 0;
+			pr_debug("%s: OFF\n", __func__);
+		}
+	}
+	mutex_unlock(&spk_amp_lock);
+}
+
+void set_speaker_amp(int on)
+{
+	set_amp(on, SPK_AMP_ON);
+}
+
+void set_headset_amp(int on)
+{
+	set_amp(on, HEADSET_AMP_ON);
+}
+
+void set_speaker_headset_amp(int on)
+{
+	set_amp(on, RING_AMP_ON);
+}
+
+void set_handset_amp(int on)
+{
+	set_amp(on, HANDSET_AMP_ON);
+}
+
+void set_usb_audio_amp(int on)
+{
+	set_amp(on, LINEOUT_AMP_ON);
+}
+
+int update_amp_parameter(int mode)
+{
+	if (mode > tpa2051_mode_cnt)
+		return EINVAL;
+	if (*(config_data + mode * MODE_CMD_LEM + 1) == SPKR_OUTPUT)
+		memcpy(SPK_AMP_ON, config_data + mode * MODE_CMD_LEM + 2,
+				sizeof(SPK_AMP_ON));
+	else if (*(config_data + mode * MODE_CMD_LEM + 1) == HEADSET_OUTPUT)
+		memcpy(HEADSET_AMP_ON, config_data + mode * MODE_CMD_LEM + 2,
+				sizeof(HEADSET_AMP_ON));
+	else if (*(config_data + mode * MODE_CMD_LEM + 1) == DUAL_OUTPUT)
+		memcpy(RING_AMP_ON, config_data + mode * MODE_CMD_LEM + 2,
+				sizeof(RING_AMP_ON));
+	else if (*(config_data + mode * MODE_CMD_LEM + 1) == HANDSET_OUTPUT)
+		memcpy(HANDSET_AMP_ON, config_data + mode * MODE_CMD_LEM + 2,
+				sizeof(HANDSET_AMP_ON));
+	else if (*(config_data + mode * MODE_CMD_LEM + 1) == LINEOUT_OUTPUT)
+		memcpy(LINEOUT_AMP_ON, config_data + mode * MODE_CMD_LEM + 2,
+				sizeof(LINEOUT_AMP_ON));
+	else {
+		pr_info("[AUD] wrong mode id %d\n", mode);
+		return -EINVAL;
+	}
+	return 0;
+}
+
+
+static long tpa2051d3_ioctl(struct file *file, unsigned int cmd,
+	   unsigned long arg)
+{
+	void __user *argp = (void __user *)arg;
+	int rc = 0, modeid = 0;
+	unsigned char tmp[7];
+	unsigned char reg_idx[1] = {0x01};
+	unsigned char spk_cfg[8];
+	unsigned char reg_value[2];
+	struct tpa2051_config_data cfg;
+
+	switch (cmd) {
+	case TPA2051_WRITE_REG:
+		pr_info("%s: TPA2051_WRITE_REG\n", __func__);
+		mutex_lock(&spk_amp_lock);
+		if (!last_spkamp_state) {
+			/* According to tpa2051d3 Spec */
+			mdelay(30);
+		}
+		if (copy_from_user(reg_value, argp, sizeof(reg_value)))
+			goto err1;
+		pr_info("%s: reg_value[0]=%2x, reg_value[1]=%2x\n", __func__,  \
+				reg_value[0], reg_value[1]);
+		rc = tpa2051_write_reg(reg_value[0], reg_value[1]);
+
+err1:
+		mutex_unlock(&spk_amp_lock);
+		break;
+	case TPA2051_SET_CONFIG:
+		if (copy_from_user(spk_cfg, argp, sizeof(spk_cfg)))
+			return -EFAULT;
+		if (spk_cfg[0] == SPKR_OUTPUT)
+			memcpy(SPK_AMP_ON, spk_cfg + 1,
+					sizeof(SPK_AMP_ON));
+		else if (spk_cfg[0] == HEADSET_OUTPUT)
+			memcpy(HEADSET_AMP_ON, spk_cfg + 1,
+					sizeof(HEADSET_AMP_ON));
+		else if (spk_cfg[0] == DUAL_OUTPUT)
+			memcpy(RING_AMP_ON, spk_cfg + 1,
+					sizeof(RING_AMP_ON));
+		else if (spk_cfg[0] == LINEOUT_OUTPUT)
+			memcpy(LINEOUT_AMP_ON, spk_cfg + 1,
+					sizeof(LINEOUT_AMP_ON));
+		else
+			return -EINVAL;
+		break;
+	case TPA2051_READ_CONFIG:
+		mutex_lock(&spk_amp_lock);
+		if (!last_spkamp_state) {
+			/* According to tpa2051d3 Spec */
+			mdelay(30);
+		}
+
+		rc = tpa2051_i2c_write_for_read(reg_idx, sizeof(reg_idx));
+		if (rc < 0)
+			goto err2;
+
+		rc = tpa2051_i2c_read(tmp, sizeof(tmp));
+		if (rc < 0)
+			goto err2;
+
+		if (copy_to_user(argp, &tmp, sizeof(tmp)))
+			rc = -EFAULT;
+err2:
+		mutex_unlock(&spk_amp_lock);
+		break;
+	case TPA2051_SET_MODE:
+		if (copy_from_user(&modeid, argp, sizeof(modeid)))
+			return -EFAULT;
+
+		if (modeid > tpa2051_mode_cnt || modeid <= 0) {
+			pr_err("unsupported tpa2051 mode %d\n", modeid);
+			return -EINVAL;
+		}
+		rc = update_amp_parameter(modeid);
+		pr_info("set tpa2051 mode to %d\n", modeid);
+		break;
+	case TPA2051_SET_PARAM:
+		cfg.cmd_data = 0;
+		tpa2051_mode_cnt = 0;
+		if (copy_from_user(&cfg, argp, sizeof(cfg))) {
+			pr_err("%s: copy from user failed.\n", __func__);
+			return -EFAULT;
+		}
+
+		if (cfg.data_len <= 0) {
+			pr_err("%s: invalid data length %d\n",
+					__func__, cfg.data_len);
+			return -EINVAL;
+		}
+		if (config_data == NULL)
+			config_data = kmalloc(cfg.data_len, GFP_KERNEL);
+		if (!config_data) {
+			pr_err("%s: out of memory\n", __func__);
+			return -ENOMEM;
+		}
+		if (copy_from_user(config_data, cfg.cmd_data, cfg.data_len)) {
+			pr_err("%s: copy data from user failed.\n", __func__);
+			kfree(config_data);
+			config_data = NULL;
+			return -EFAULT;
+		}
+		tpa2051_mode_cnt = cfg.mode_num;
+		pr_info("%s: update tpa2051 i2c commands #%d success.\n",
+				__func__, cfg.data_len);
+		/* update default paramater from csv*/
+		update_amp_parameter(TPA2051_MODE_PLAYBACK_SPKR);
+		update_amp_parameter(TPA2051_MODE_PLAYBACK_HEADSET);
+		update_amp_parameter(TPA2051_MODE_RING);
+		update_amp_parameter(TPA2051_MODE_PLAYBACK_HANDSET);
+		update_amp_parameter(TPA2051_MODE_LINEOUT);
+		rc = 0;
+		break;
+	default:
+		pr_err("%s: Invalid command\n", __func__);
+		rc = -EINVAL;
+		break;
+	}
+	return rc;
+}
+
+static struct file_operations tpa2051d3_fops = {
+	.owner = THIS_MODULE,
+	.open = tpa2051d3_open,
+	.release = tpa2051d3_release,
+	.unlocked_ioctl = tpa2051d3_ioctl,
+};
+
+static struct miscdevice tpa2051d3_device = {
+	.minor = MISC_DYNAMIC_MINOR,
+	.name = "tpa2051d3",
+	.fops = &tpa2051d3_fops,
+};
+
+int tpa2051d3_probe(struct i2c_client *client, const struct i2c_device_id *id)
+{
+	int ret = 0;
+
+	pdata = client->dev.platform_data;
+
+	if (pdata == NULL) {
+		pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+		if (pdata == NULL) {
+			ret = -ENOMEM;
+			pr_err("%s: platform data is NULL\n", __func__);
+			goto err_alloc_data_failed;
+		}
+	}
+
+	this_client = client;
+
+	if (ret < 0) {
+		pr_err("%s: pmic request aud_spk_en pin failed\n", __func__);
+		goto err_free_gpio_all;
+	}
+
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+		pr_err("%s: i2c check functionality error\n", __func__);
+		ret = -ENODEV;
+		goto err_free_gpio_all;
+	}
+
+	ret = misc_register(&tpa2051d3_device);
+	if (ret) {
+		pr_err("%s: tpa2051d3_device register failed\n", __func__);
+		goto err_free_gpio_all;
+	}
+
+	if (pdata->spkr_cmd[1] != 0)  /* path id != 0 */
+		memcpy(SPK_AMP_ON, pdata->spkr_cmd, sizeof(SPK_AMP_ON));
+	if (pdata->hsed_cmd[1] != 0)
+		memcpy(HEADSET_AMP_ON, pdata->hsed_cmd, sizeof(HEADSET_AMP_ON));
+	if (pdata->rece_cmd[1] != 0)
+		memcpy(HANDSET_AMP_ON, pdata->rece_cmd, sizeof(HANDSET_AMP_ON));
+
+	return 0;
+
+err_free_gpio_all:
+	return ret;
+err_alloc_data_failed:
+	return ret;
+}
+
+static int tpa2051d3_remove(struct i2c_client *client)
+{
+	struct tpa2051d3_platform_data *p2051data = i2c_get_clientdata(client);
+	kfree(p2051data);
+
+	return 0;
+}
+
+static int tpa2051d3_suspend(struct i2c_client *client, pm_message_t mesg)
+{
+	return 0;
+}
+
+static int tpa2051d3_resume(struct i2c_client *client)
+{
+	return 0;
+}
+
+static const struct i2c_device_id tpa2051d3_id[] = {
+	{ TPA2051D3_I2C_NAME, 0 },
+	{ }
+};
+
+static struct i2c_driver tpa2051d3_driver = {
+	.probe = tpa2051d3_probe,
+	.remove = tpa2051d3_remove,
+	.suspend = tpa2051d3_suspend,
+	.resume = tpa2051d3_resume,
+	.id_table = tpa2051d3_id,
+	.driver = {
+		.name = TPA2051D3_I2C_NAME,
+	},
+};
+
+static int __init tpa2051d3_init(void)
+{
+	pr_info("%s\n", __func__);
+	mutex_init(&spk_amp_lock);
+	return i2c_add_driver(&tpa2051d3_driver);
+}
+
+static void __exit tpa2051d3_exit(void)
+{
+	i2c_del_driver(&tpa2051d3_driver);
+}
+
+module_init(tpa2051d3_init);
+module_exit(tpa2051d3_exit);
+
+MODULE_DESCRIPTION("tpa2051d3 Speaker Amp driver");
+MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index acbdc5f..32682c1 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -1491,6 +1491,7 @@
 
 static int wm2200_bclk_rates_cd[WM2200_NUM_BCLK_RATES] = {
 	5644800,
+	3763200,
 	2882400,
 	1881600,
 	1411200,
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 65d525d..4e190b5 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -2084,7 +2084,6 @@
 {
 	struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
 	struct wm8904_pdata *pdata = wm8904->pdata;
-	u16 *reg_cache = codec->reg_cache;
 	int ret, i;
 
 	codec->cache_sync = 1;
@@ -2180,14 +2179,18 @@
 			if (!pdata->gpio_cfg[i])
 				continue;
 
-			reg_cache[WM8904_GPIO_CONTROL_1 + i]
-				= pdata->gpio_cfg[i] & 0xffff;
+			regmap_update_bits(wm8904->regmap,
+					   WM8904_GPIO_CONTROL_1 + i,
+					   0xffff,
+					   pdata->gpio_cfg[i]);
 		}
 
 		/* Zero is the default value for these anyway */
 		for (i = 0; i < WM8904_MIC_REGS; i++)
-			reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i]
-				= pdata->mic_cfg[i];
+			regmap_update_bits(wm8904->regmap,
+					   WM8904_MIC_BIAS_CONTROL_0 + i,
+					   0xffff,
+					   pdata->mic_cfg[i]);
 	}
 
 	/* Set Class W by default - this will be managed by the Class
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 15d467f..96f6f9f 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2488,6 +2488,9 @@
 		/* VMID 2*250k */
 		snd_soc_update_bits(codec, WM8962_PWR_MGMT_1,
 				    WM8962_VMID_SEL_MASK, 0x100);
+
+		if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
+			msleep(100);
 		break;
 
 	case SND_SOC_BIAS_OFF:
@@ -3710,6 +3713,9 @@
 	}
 
 	regcache_cache_only(wm8962->regmap, false);
+
+	wm8962_reset(wm8962);
+
 	regcache_sync(wm8962->regmap);
 
 	regmap_update_bits(wm8962->regmap, WM8962_ANTI_POP,
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 2de12eb..4c471a5 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -46,6 +46,39 @@
 #define WM8994_NUM_DRC 3
 #define WM8994_NUM_EQ  3
 
+static struct {
+	unsigned int reg;
+	unsigned int mask;
+} wm8994_vu_bits[] = {
+	{ WM8994_LEFT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
+	{ WM8994_RIGHT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
+	{ WM8994_LEFT_LINE_INPUT_3_4_VOLUME, WM8994_IN2_VU },
+	{ WM8994_RIGHT_LINE_INPUT_3_4_VOLUME, WM8994_IN2_VU },
+	{ WM8994_SPEAKER_VOLUME_LEFT, WM8994_SPKOUT_VU },
+	{ WM8994_SPEAKER_VOLUME_RIGHT, WM8994_SPKOUT_VU },
+	{ WM8994_LEFT_OUTPUT_VOLUME, WM8994_HPOUT1_VU },
+	{ WM8994_RIGHT_OUTPUT_VOLUME, WM8994_HPOUT1_VU },
+	{ WM8994_LEFT_OPGA_VOLUME, WM8994_MIXOUT_VU },
+	{ WM8994_RIGHT_OPGA_VOLUME, WM8994_MIXOUT_VU },
+
+	{ WM8994_AIF1_DAC1_LEFT_VOLUME, WM8994_AIF1DAC1_VU },
+	{ WM8994_AIF1_DAC1_RIGHT_VOLUME, WM8994_AIF1DAC1_VU },
+	{ WM8994_AIF1_DAC2_LEFT_VOLUME, WM8994_AIF1DAC2_VU },
+	{ WM8994_AIF1_DAC2_RIGHT_VOLUME, WM8994_AIF1DAC2_VU },
+	{ WM8994_AIF2_DAC_LEFT_VOLUME, WM8994_AIF2DAC_VU },
+	{ WM8994_AIF2_DAC_RIGHT_VOLUME, WM8994_AIF2DAC_VU },
+	{ WM8994_AIF1_ADC1_LEFT_VOLUME, WM8994_AIF1ADC1_VU },
+	{ WM8994_AIF1_ADC1_RIGHT_VOLUME, WM8994_AIF1ADC1_VU },
+	{ WM8994_AIF1_ADC2_LEFT_VOLUME, WM8994_AIF1ADC2_VU },
+	{ WM8994_AIF1_ADC2_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
+	{ WM8994_AIF2_ADC_LEFT_VOLUME, WM8994_AIF2ADC_VU },
+	{ WM8994_AIF2_ADC_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
+	{ WM8994_DAC1_LEFT_VOLUME, WM8994_DAC1_VU },
+	{ WM8994_DAC1_RIGHT_VOLUME, WM8994_DAC1_VU },
+	{ WM8994_DAC2_LEFT_VOLUME, WM8994_DAC2_VU },
+	{ WM8994_DAC2_RIGHT_VOLUME, WM8994_DAC2_VU },
+};
+
 static int wm8994_drc_base[] = {
 	WM8994_AIF1_DRC1_1,
 	WM8994_AIF1_DRC2_1,
@@ -1006,6 +1039,7 @@
 	struct snd_soc_codec *codec = w->codec;
 	struct wm8994 *control = codec->control_data;
 	int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA;
+	int i;
 	int dac;
 	int adc;
 	int val;
@@ -1064,6 +1098,13 @@
 				    WM8994_AIF1DAC2L_ENA);
 		break;
 
+	case SND_SOC_DAPM_POST_PMU:
+		for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
+			snd_soc_write(codec, wm8994_vu_bits[i].reg,
+				      snd_soc_read(codec,
+						   wm8994_vu_bits[i].reg));
+		break;
+
 	case SND_SOC_DAPM_PRE_PMD:
 	case SND_SOC_DAPM_POST_PMD:
 		snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
@@ -1089,6 +1130,7 @@
 		      struct snd_kcontrol *kcontrol, int event)
 {
 	struct snd_soc_codec *codec = w->codec;
+	int i;
 	int dac;
 	int adc;
 	int val;
@@ -1139,6 +1181,13 @@
 				    WM8994_AIF2DACR_ENA);
 		break;
 
+	case SND_SOC_DAPM_POST_PMU:
+		for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
+			snd_soc_write(codec, wm8994_vu_bits[i].reg,
+				      snd_soc_read(codec,
+						   wm8994_vu_bits[i].reg));
+		break;
+
 	case SND_SOC_DAPM_PRE_PMD:
 	case SND_SOC_DAPM_POST_PMD:
 		snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
@@ -1207,17 +1256,19 @@
 	switch (event) {
 	case SND_SOC_DAPM_PRE_PMU:
 		if (wm8994->aif1clk_enable) {
-			aif1clk_ev(w, kcontrol, event);
+			aif1clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMU);
 			snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
 					    WM8994_AIF1CLK_ENA_MASK,
 					    WM8994_AIF1CLK_ENA);
+			aif1clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMU);
 			wm8994->aif1clk_enable = 0;
 		}
 		if (wm8994->aif2clk_enable) {
-			aif2clk_ev(w, kcontrol, event);
+			aif2clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMU);
 			snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
 					    WM8994_AIF2CLK_ENA_MASK,
 					    WM8994_AIF2CLK_ENA);
+			aif2clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMU);
 			wm8994->aif2clk_enable = 0;
 		}
 		break;
@@ -1238,15 +1289,17 @@
 	switch (event) {
 	case SND_SOC_DAPM_POST_PMD:
 		if (wm8994->aif1clk_disable) {
+			aif1clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMD);
 			snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
 					    WM8994_AIF1CLK_ENA_MASK, 0);
-			aif1clk_ev(w, kcontrol, event);
+			aif1clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMD);
 			wm8994->aif1clk_disable = 0;
 		}
 		if (wm8994->aif2clk_disable) {
+			aif2clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMD);
 			snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
 					    WM8994_AIF2CLK_ENA_MASK, 0);
-			aif2clk_ev(w, kcontrol, event);
+			aif2clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMD);
 			wm8994->aif2clk_disable = 0;
 		}
 		break;
@@ -1583,9 +1636,11 @@
 
 static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = {
 SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, aif1clk_ev,
-		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
+		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
+		    SND_SOC_DAPM_PRE_PMD),
 SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, aif2clk_ev,
-		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
+		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
+		    SND_SOC_DAPM_PRE_PMD),
 SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0),
 SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0,
 		   left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)),
@@ -2640,7 +2695,7 @@
 		return -EINVAL;
 	}
 
-	bclk_rate = params_rate(params) * 2;
+	bclk_rate = params_rate(params) * 4;
 	switch (params_format(params)) {
 	case SNDRV_PCM_FORMAT_S16_LE:
 		bclk_rate *= 16;
@@ -3939,39 +3994,11 @@
 
 	pm_runtime_put(codec->dev);
 
-	/* Latch volume updates (right only; we always do left then right). */
-	snd_soc_update_bits(codec, WM8994_AIF1_DAC1_LEFT_VOLUME,
-			    WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU);
-	snd_soc_update_bits(codec, WM8994_AIF1_DAC1_RIGHT_VOLUME,
-			    WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU);
-	snd_soc_update_bits(codec, WM8994_AIF1_DAC2_LEFT_VOLUME,
-			    WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU);
-	snd_soc_update_bits(codec, WM8994_AIF1_DAC2_RIGHT_VOLUME,
-			    WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU);
-	snd_soc_update_bits(codec, WM8994_AIF2_DAC_LEFT_VOLUME,
-			    WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU);
-	snd_soc_update_bits(codec, WM8994_AIF2_DAC_RIGHT_VOLUME,
-			    WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU);
-	snd_soc_update_bits(codec, WM8994_AIF1_ADC1_LEFT_VOLUME,
-			    WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU);
-	snd_soc_update_bits(codec, WM8994_AIF1_ADC1_RIGHT_VOLUME,
-			    WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU);
-	snd_soc_update_bits(codec, WM8994_AIF1_ADC2_LEFT_VOLUME,
-			    WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU);
-	snd_soc_update_bits(codec, WM8994_AIF1_ADC2_RIGHT_VOLUME,
-			    WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU);
-	snd_soc_update_bits(codec, WM8994_AIF2_ADC_LEFT_VOLUME,
-			    WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU);
-	snd_soc_update_bits(codec, WM8994_AIF2_ADC_RIGHT_VOLUME,
-			    WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU);
-	snd_soc_update_bits(codec, WM8994_DAC1_LEFT_VOLUME,
-			    WM8994_DAC1_VU, WM8994_DAC1_VU);
-	snd_soc_update_bits(codec, WM8994_DAC1_RIGHT_VOLUME,
-			    WM8994_DAC1_VU, WM8994_DAC1_VU);
-	snd_soc_update_bits(codec, WM8994_DAC2_LEFT_VOLUME,
-			    WM8994_DAC2_VU, WM8994_DAC2_VU);
-	snd_soc_update_bits(codec, WM8994_DAC2_RIGHT_VOLUME,
-			    WM8994_DAC2_VU, WM8994_DAC2_VU);
+	/* Latch volume update bits */
+	for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
+		snd_soc_update_bits(codec, wm8994_vu_bits[i].reg,
+				    wm8994_vu_bits[i].mask,
+				    wm8994_vu_bits[i].mask);
 
 	/* Set the low bit of the 3D stereo depth so TLV matches */
 	snd_soc_update_bits(codec, WM8994_AIF1_DAC1_FILTERS_2,
diff --git a/sound/soc/msm/Makefile b/sound/soc/msm/Makefile
index be7eccf..54d5472 100644
--- a/sound/soc/msm/Makefile
+++ b/sound/soc/msm/Makefile
@@ -61,8 +61,10 @@
 snd-soc-qdsp6-objs += msm-pcm-lpa.o msm-pcm-afe.o
 obj-$(CONFIG_SND_SOC_QDSP6) += snd-soc-qdsp6.o
 
+ifneq ($(CONFIG_MACH_HTC),y)
 snd-soc-msm8960-objs := msm8960.o apq8064.o msm8930.o mpq8064.o apq8064-i2s.o
 obj-$(CONFIG_SND_SOC_MSM8960) += snd-soc-msm8960.o
+endif
 
 # Generic MSM drivers
 snd-soc-hostless-pcm-objs := msm-pcm-hostless.o
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 9904717..c88dd28 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1597,7 +1597,15 @@
 	}
 
 	list_for_each_entry(w, &card->widgets, list) {
-		list_del_init(&w->dirty);
+		switch (w->id) {
+		case snd_soc_dapm_pre:
+		case snd_soc_dapm_post:
+			/* These widgets always need to be powered */
+			break;
+		default:
+			list_del_init(&w->dirty);
+			break;
+		}
 
 		if (w->power) {
 			d = w->dapm;
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 1452312..0c87116 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -724,7 +724,11 @@
 	}
 
 	usbaudiosdev = kzalloc(sizeof(usbaudiosdev), GFP_KERNEL);
+#ifdef CONFIG_HTC_HEADSET_MGR
+	usbaudiosdev->name = "usb_audio_class";
+#else
 	usbaudiosdev->name = "usb_audio";
+#endif
 
 	err = switch_dev_register(usbaudiosdev);
 	if (err)
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 379baad..5e634a2 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -111,7 +111,8 @@
 		return 0;
 
 	/* If a clock source can't tell us whether it's valid, we assume it is */
-	if (!uac2_control_is_readable(cs_desc->bmControls, UAC2_CS_CONTROL_CLOCK_VALID))
+	if (!uac2_control_is_readable(cs_desc->bmControls,
+				      UAC2_CS_CONTROL_CLOCK_VALID - 1))
 		return 1;
 
 	err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 0eed611..67a4d6d 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -699,6 +699,9 @@
 	int count = 0, needs_knot = 0;
 	int err;
 
+	kfree(subs->rate_list.list);
+	subs->rate_list.list = NULL;
+
 	list_for_each_entry(fp, &subs->fmt_list, list) {
 		if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS)
 			return 0;
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 146fd61..d9834b3 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -701,14 +701,18 @@
 	pfd.fd = fd;
 
 	while (1) {
+		struct sockaddr *addr_p = (struct sockaddr *) &addr;
+		socklen_t addr_l = sizeof(addr);
 		pfd.events = POLLIN;
 		pfd.revents = 0;
 		poll(&pfd, 1, -1);
 
-		len = recv(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0);
+		len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0,
+				addr_p, &addr_l);
 
-		if (len < 0) {
-			syslog(LOG_ERR, "recv failed; error:%d", len);
+		if (len < 0 || addr.nl_pid) {
+			syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s",
+					addr.nl_pid, errno, strerror(errno));
 			close(fd);
 			return -1;
 		}
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
index 4b107b5..8674b9e 100644
--- a/tools/usb/ffs-test.c
+++ b/tools/usb/ffs-test.c
@@ -297,7 +297,7 @@
 
 		ret = t->in(t, t->buf, t->buf_size);
 		if (ret > 0) {
-			ret = t->out(t, t->buf, t->buf_size);
+			ret = t->out(t, t->buf, ret);
 			name = out_name;
 			op = "write";
 		} else {
diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c
index 7dab7b25..f77c96b 100644
--- a/tools/vm/page-types.c
+++ b/tools/vm/page-types.c
@@ -35,6 +35,7 @@
 #include <sys/mount.h>
 #include <sys/statfs.h>
 #include "../../include/linux/magic.h"
+#include "../../include/linux/kernel-page-flags.h"
 
 
 #ifndef MAX_PATH
@@ -73,33 +74,6 @@
 #define KPF_BYTES		8
 #define PROC_KPAGEFLAGS		"/proc/kpageflags"
 
-/* copied from kpageflags_read() */
-#define KPF_LOCKED		0
-#define KPF_ERROR		1
-#define KPF_REFERENCED		2
-#define KPF_UPTODATE		3
-#define KPF_DIRTY		4
-#define KPF_LRU			5
-#define KPF_ACTIVE		6
-#define KPF_SLAB		7
-#define KPF_WRITEBACK		8
-#define KPF_RECLAIM		9
-#define KPF_BUDDY		10
-
-/* [11-20] new additions in 2.6.31 */
-#define KPF_MMAP		11
-#define KPF_ANON		12
-#define KPF_SWAPCACHE		13
-#define KPF_SWAPBACKED		14
-#define KPF_COMPOUND_HEAD	15
-#define KPF_COMPOUND_TAIL	16
-#define KPF_HUGE		17
-#define KPF_UNEVICTABLE		18
-#define KPF_HWPOISON		19
-#define KPF_NOPAGE		20
-#define KPF_KSM			21
-#define KPF_THP			22
-
 /* [32-] kernel hacking assistances */
 #define KPF_RESERVED		32
 #define KPF_MLOCKED		33